From: support Date: Wed, 23 Nov 2022 14:08:15 +0000 (+0000) Subject: Built motion from commit 87b834ec.|2.6.23 X-Git-Url: http://repos.xcallymotion.com/?a=commitdiff_plain;h=681ca19e947c3c333ed1e3f180a190d49a862ea8;p=motion2.git Built motion from commit 87b834ec.|2.6.23 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 9b67e12..10f7d00 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-11-23T08:31:00.805Z", + "time": "2022-11-23T13:59:53.734Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 66f912e..4bcccb2 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-11-23T08:31:00.805Z", + "time": "2022-11-23T13:59:53.734Z", "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 3258124..0100867 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 _0xbf16=['urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','STRING','contactManager','integration','motionbar','jscripty','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[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]'];(function(_0x2c2b30,_0x48ed61){var _0x3b386a=function(_0x4f95ad){while(--_0x4f95ad){_0x2c2b30['push'](_0x2c2b30['shift']());}};_0x3b386a(++_0x48ed61);}(_0xbf16,0x73));var _0x6bf1=function(_0x24ae08,_0x299dee){_0x24ae08=_0x24ae08-0x0;var _0x18339c=_0xbf16[_0x24ae08];return _0x18339c;};'use strict';var Sequelize=require(_0x6bf1('0x0'));module[_0x6bf1('0x1')]={'name':{'type':Sequelize[_0x6bf1('0x2')],'get':function(_0x5525f6){return this[_0x6bf1('0x3')]('action');}},'action':{'type':Sequelize[_0x6bf1('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x6bf1('0x5'),_0x6bf1('0x6'),_0x6bf1('0x7'),_0x6bf1('0x8'),'urlForward',_0x6bf1('0x9'),_0x6bf1('0xa'),_0x6bf1('0xb')]],'msg':_0x6bf1('0xc')}},'comment':_0x6bf1('0xc')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x6bf1('0xd')},'data2':{'type':Sequelize[_0x6bf1('0x4')](0x1000),'comment':_0x6bf1('0xe')},'data3':{'type':Sequelize[_0x6bf1('0x4')](0x1000),'comment':_0x6bf1('0xf')},'data4':{'type':Sequelize[_0x6bf1('0x4')](0x1000),'comments':_0x6bf1('0x10')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x6bf1('0x11')},'data6':{'type':Sequelize['STRING'],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize['TEXT'],'comments':_0x6bf1('0x12')}}; \ No newline at end of file +var _0xe44f=['integration','motionbar','jscripty','urlForward','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','urlForward[body]','getDataValue','action','STRING','contactManager'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0xe44f,0x95));var _0xfe44=function(_0x5b0c93,_0x4ca03a){_0x5b0c93=_0x5b0c93-0x0;var _0x22acb5=_0xe44f[_0x5b0c93];return _0x22acb5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x7799d9){return this[_0xfe44('0x0')](_0xfe44('0x1'));}},'action':{'type':Sequelize[_0xfe44('0x2')],'allowNull':![],'validate':{'isIn':{'args':[[_0xfe44('0x3'),_0xfe44('0x4'),_0xfe44('0x5'),_0xfe44('0x6'),_0xfe44('0x7'),'browser',_0xfe44('0x8'),'script']],'msg':_0xfe44('0x9')}},'comment':_0xfe44('0x9')},'data1':{'type':Sequelize[_0xfe44('0x2')](0x1000),'comment':_0xfe44('0xa')},'data2':{'type':Sequelize[_0xfe44('0x2')](0x1000),'comment':_0xfe44('0xb')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0xfe44('0xc')},'data4':{'type':Sequelize[_0xfe44('0x2')](0x1000),'comments':_0xfe44('0xd')},'data5':{'type':Sequelize[_0xfe44('0x2')](0x1000),'comments':_0xfe44('0xe')},'data6':{'type':Sequelize[_0xfe44('0x2')],'comments':_0xfe44('0xf')},'data7':{'type':Sequelize['TEXT'],'comments':_0xfe44('0x10')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 4c27122..3384338 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 _0x2a68=['count','set','save','destroy','end','sendStatus','error','stack','name','send','body','find','params','then','catch','rimraf','fast-json-patch','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined'];(function(_0x53a625,_0xba388d){var _0x303cc0=function(_0x792727){while(--_0x792727){_0x53a625['push'](_0x53a625['shift']());}};_0x303cc0(++_0xba388d);}(_0x2a68,0x13c));var _0x82a6=function(_0xc66af2,_0x14f6d8){_0xc66af2=_0xc66af2-0x0;var _0x38d439=_0x2a68[_0xc66af2];return _0x38d439;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x82a6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x82a6('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x82a6('0x2'));var path=require(_0x82a6('0x3'));var sox=require('sox');var csv=require(_0x82a6('0x4'));var ejs=require(_0x82a6('0x5'));var fs=require('fs');var fs_extra=require(_0x82a6('0x6'));var _=require(_0x82a6('0x7'));var squel=require(_0x82a6('0x8'));var crypto=require('crypto');var jsforce=require(_0x82a6('0x9'));var deskjs=require(_0x82a6('0xa'));var toCsv=require(_0x82a6('0x4'));var querystring=require(_0x82a6('0xb'));var Papa=require(_0x82a6('0xc'));var Redis=require(_0x82a6('0xd'));var authService=require(_0x82a6('0xe'));var qs=require(_0x82a6('0xf'));var as=require(_0x82a6('0x10'));var hardwareService=require(_0x82a6('0x11'));var logger=require('../../config/logger')(_0x82a6('0x12'));var utils=require(_0x82a6('0x13'));var config=require(_0x82a6('0x14'));var licenseUtil=require(_0x82a6('0x15'));var db=require(_0x82a6('0x16'))['db'];function respondWithStatusCode(_0x63bb7e,_0x547fdd){_0x547fdd=_0x547fdd||0xcc;return function(_0xa91f16){if(_0xa91f16){return _0x63bb7e['sendStatus'](_0x547fdd);}return _0x63bb7e[_0x82a6('0x17')](_0x547fdd)['end']();};}function respondWithResult(_0x42a959,_0x466786){_0x466786=_0x466786||0xc8;return function(_0x4dd6f4){if(_0x4dd6f4){return _0x42a959[_0x82a6('0x17')](_0x466786)[_0x82a6('0x18')](_0x4dd6f4);}};}function respondWithFilteredResult(_0x3a9fb7,_0xb8ddeb){return function(_0x9cfff7){if(_0x9cfff7){var _0x55e48d=typeof _0xb8ddeb[_0x82a6('0x19')]==='undefined'&&typeof _0xb8ddeb[_0x82a6('0x1a')]===_0x82a6('0x1b');var _0x4f809f=_0x9cfff7[_0x82a6('0x1c')];var _0x4f263a=_0x55e48d?0x0:_0xb8ddeb['offset'];var _0x55be56=_0x55e48d?_0x9cfff7[_0x82a6('0x1c')]:_0xb8ddeb['offset']+_0xb8ddeb['limit'];var _0x32c4ab;if(_0x55be56>=_0x4f809f){_0x55be56=_0x4f809f;_0x32c4ab=0xc8;}else{_0x32c4ab=0xce;}_0x3a9fb7['status'](_0x32c4ab);return _0x3a9fb7[_0x82a6('0x1d')]('Content-Range',_0x4f263a+'-'+_0x55be56+'/'+_0x4f809f)[_0x82a6('0x18')](_0x9cfff7);}return null;};}function patchUpdates(_0x1d8a6f){return function(_0x53011e){try{jsonpatch['apply'](_0x53011e,_0x1d8a6f,!![]);}catch(_0x5419f5){return BPromise['reject'](_0x5419f5);}return _0x53011e[_0x82a6('0x1e')]();};}function saveUpdates(_0x330e91,_0x4b1db1){return function(_0x15abfa){if(_0x15abfa){return _0x15abfa['update'](_0x330e91)['then'](function(_0x51c3e2){return _0x51c3e2;});}return null;};}function removeEntity(_0x1e3934,_0x58080c){return function(_0x171320){if(_0x171320){return _0x171320[_0x82a6('0x1f')]()['then'](function(){_0x1e3934[_0x82a6('0x17')](0xcc)[_0x82a6('0x20')]();});}};}function handleEntityNotFound(_0x29d2e9,_0x3ff6fb){return function(_0x2feee4){if(!_0x2feee4){_0x29d2e9[_0x82a6('0x21')](0x194);}return _0x2feee4;};}function handleError(_0x182937,_0x103440){_0x103440=_0x103440||0x1f4;return function(_0x1083c4){logger[_0x82a6('0x22')](_0x1083c4[_0x82a6('0x23')]);if(_0x1083c4[_0x82a6('0x24')]){delete _0x1083c4['name'];}_0x182937[_0x82a6('0x17')](_0x103440)[_0x82a6('0x25')](_0x1083c4);};}exports['update']=function(_0x4b206c,_0x1a2080){if(_0x4b206c[_0x82a6('0x26')]['id']){delete _0x4b206c[_0x82a6('0x26')]['id'];}return db['Action'][_0x82a6('0x27')]({'where':{'id':_0x4b206c[_0x82a6('0x28')]['id']}})[_0x82a6('0x29')](handleEntityNotFound(_0x1a2080,null))[_0x82a6('0x29')](saveUpdates(_0x4b206c[_0x82a6('0x26')],null))[_0x82a6('0x29')](respondWithResult(_0x1a2080,null))[_0x82a6('0x2a')](handleError(_0x1a2080,null));};exports[_0x82a6('0x1f')]=function(_0x373341,_0x2e88ec){return db['Action']['find']({'where':{'id':_0x373341[_0x82a6('0x28')]['id']}})['then'](handleEntityNotFound(_0x2e88ec,null))[_0x82a6('0x29')](removeEntity(_0x2e88ec,null))[_0x82a6('0x2a')](handleError(_0x2e88ec,null));}; \ No newline at end of file +var _0xfe91=['moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','stack','name','send','body','Action','find','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x4812e0,_0x2ccf3c){var _0x252e0f=function(_0x14cdb8){while(--_0x14cdb8){_0x4812e0['push'](_0x4812e0['shift']());}};_0x252e0f(++_0x2ccf3c);}(_0xfe91,0xdc));var _0x1fe9=function(_0x19ac6e,_0x435862){_0x19ac6e=_0x19ac6e-0x0;var _0x1cdcf3=_0xfe91[_0x19ac6e];return _0x1cdcf3;};'use strict';var emlformat=require(_0x1fe9('0x0'));var rimraf=require(_0x1fe9('0x1'));var zipdir=require(_0x1fe9('0x2'));var jsonpatch=require(_0x1fe9('0x3'));var rp=require(_0x1fe9('0x4'));var moment=require(_0x1fe9('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1fe9('0x6'));var path=require('path');var sox=require(_0x1fe9('0x7'));var csv=require(_0x1fe9('0x8'));var ejs=require(_0x1fe9('0x9'));var fs=require('fs');var fs_extra=require(_0x1fe9('0xa'));var _=require(_0x1fe9('0xb'));var squel=require(_0x1fe9('0xc'));var crypto=require(_0x1fe9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1fe9('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1fe9('0xf'));var Papa=require('papaparse');var Redis=require(_0x1fe9('0x10'));var authService=require(_0x1fe9('0x11'));var qs=require(_0x1fe9('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1fe9('0x13'));var utils=require('../../config/utils');var config=require(_0x1fe9('0x14'));var licenseUtil=require(_0x1fe9('0x15'));var db=require(_0x1fe9('0x16'))['db'];function respondWithStatusCode(_0x7960cf,_0x5f39ff){_0x5f39ff=_0x5f39ff||0xcc;return function(_0xde69b8){if(_0xde69b8){return _0x7960cf[_0x1fe9('0x17')](_0x5f39ff);}return _0x7960cf[_0x1fe9('0x18')](_0x5f39ff)[_0x1fe9('0x19')]();};}function respondWithResult(_0x3c3764,_0x3f2340){_0x3f2340=_0x3f2340||0xc8;return function(_0x192031){if(_0x192031){return _0x3c3764[_0x1fe9('0x18')](_0x3f2340)[_0x1fe9('0x1a')](_0x192031);}};}function respondWithFilteredResult(_0x3dd7aa,_0x322280){return function(_0x5cf274){if(_0x5cf274){var _0x44a086=typeof _0x322280[_0x1fe9('0x1b')]===_0x1fe9('0x1c')&&typeof _0x322280[_0x1fe9('0x1d')]===_0x1fe9('0x1c');var _0x5f0b8d=_0x5cf274[_0x1fe9('0x1e')];var _0x2262a1=_0x44a086?0x0:_0x322280[_0x1fe9('0x1b')];var _0x22188f=_0x44a086?_0x5cf274['count']:_0x322280[_0x1fe9('0x1b')]+_0x322280[_0x1fe9('0x1d')];var _0x195f0b;if(_0x22188f>=_0x5f0b8d){_0x22188f=_0x5f0b8d;_0x195f0b=0xc8;}else{_0x195f0b=0xce;}_0x3dd7aa[_0x1fe9('0x18')](_0x195f0b);return _0x3dd7aa[_0x1fe9('0x1f')]('Content-Range',_0x2262a1+'-'+_0x22188f+'/'+_0x5f0b8d)[_0x1fe9('0x1a')](_0x5cf274);}return null;};}function patchUpdates(_0x238410){return function(_0x3430ff){try{jsonpatch['apply'](_0x3430ff,_0x238410,!![]);}catch(_0x544567){return BPromise[_0x1fe9('0x20')](_0x544567);}return _0x3430ff[_0x1fe9('0x21')]();};}function saveUpdates(_0x166ef5,_0x4ce214){return function(_0x24d6fb){if(_0x24d6fb){return _0x24d6fb[_0x1fe9('0x22')](_0x166ef5)[_0x1fe9('0x23')](function(_0x192d5e){return _0x192d5e;});}return null;};}function removeEntity(_0x3f9a52,_0x58aead){return function(_0xa3e335){if(_0xa3e335){return _0xa3e335[_0x1fe9('0x24')]()[_0x1fe9('0x23')](function(){_0x3f9a52[_0x1fe9('0x18')](0xcc)[_0x1fe9('0x19')]();});}};}function handleEntityNotFound(_0x4a9bbe,_0x371873){return function(_0x15768f){if(!_0x15768f){_0x4a9bbe[_0x1fe9('0x17')](0x194);}return _0x15768f;};}function handleError(_0x1b69e5,_0x25fc87){_0x25fc87=_0x25fc87||0x1f4;return function(_0x438ca4){logger['error'](_0x438ca4[_0x1fe9('0x25')]);if(_0x438ca4[_0x1fe9('0x26')]){delete _0x438ca4[_0x1fe9('0x26')];}_0x1b69e5[_0x1fe9('0x18')](_0x25fc87)[_0x1fe9('0x27')](_0x438ca4);};}exports[_0x1fe9('0x22')]=function(_0x1a00a4,_0x1a9b4d){if(_0x1a00a4['body']['id']){delete _0x1a00a4[_0x1fe9('0x28')]['id'];}return db[_0x1fe9('0x29')][_0x1fe9('0x2a')]({'where':{'id':_0x1a00a4['params']['id']}})[_0x1fe9('0x23')](handleEntityNotFound(_0x1a9b4d,null))['then'](saveUpdates(_0x1a00a4[_0x1fe9('0x28')],null))['then'](respondWithResult(_0x1a9b4d,null))['catch'](handleError(_0x1a9b4d,null));};exports[_0x1fe9('0x24')]=function(_0x3f1188,_0x3e4bcd){return db['Action']['find']({'where':{'id':_0x3f1188[_0x1fe9('0x2b')]['id']}})[_0x1fe9('0x23')](handleEntityNotFound(_0x3e4bcd,null))['then'](removeEntity(_0x3e4bcd,null))[_0x1fe9('0x2c')](handleError(_0x3e4bcd,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index cbb4449..b2bc4ef 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 _0x6f33=['request-promise','../../config/environment','exports','define','tools_actions','lodash','util','../../config/logger','bluebird'];(function(_0xc20f22,_0x49698f){var _0x1535d5=function(_0x5ce3f3){while(--_0x5ce3f3){_0xc20f22['push'](_0xc20f22['shift']());}};_0x1535d5(++_0x49698f);}(_0x6f33,0x7a));var _0x36f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f33[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x36f3('0x0'));var util=require(_0x36f3('0x1'));var logger=require(_0x36f3('0x2'))('api');var moment=require('moment');var BPromise=require(_0x36f3('0x3'));var rp=require(_0x36f3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x36f3('0x5'));var attributes=require('./action.attributes');module[_0x36f3('0x6')]=function(_0x54b611,_0x5c12f6){return _0x54b611[_0x36f3('0x7')]('Action',attributes,{'tableName':_0x36f3('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa5bf=['moment','bluebird','path','../../config/environment','./action.attributes','exports','tools_actions','lodash','../../config/logger','api'];(function(_0x34d277,_0x16ef66){var _0x5210e=function(_0x314cc4){while(--_0x314cc4){_0x34d277['push'](_0x34d277['shift']());}};_0x5210e(++_0x16ef66);}(_0xa5bf,0x101));var _0xfa5b=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0xa5bf[_0x58dc25];return _0x21b0a7;};'use strict';var _=require(_0xfa5b('0x0'));var util=require('util');var logger=require(_0xfa5b('0x1'))(_0xfa5b('0x2'));var moment=require(_0xfa5b('0x3'));var BPromise=require(_0xfa5b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfa5b('0x5'));var rimraf=require('rimraf');var config=require(_0xfa5b('0x6'));var attributes=require(_0xfa5b('0x7'));module[_0xfa5b('0x8')]=function(_0x3d46c8,_0x38d68e){return _0x3d46c8['define']('Action',attributes,{'tableName':_0xfa5b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 58303fb..79edcb7 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','Action,\x20%s,\x20%s','Action,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x358b92,_0x2d671a){var _0x58f1a5=function(_0xc03bac){while(--_0xc03bac){_0x358b92['push'](_0x358b92['shift']());}};_0x58f1a5(++_0x2d671a);}(_0xe14b,0x93));var _0xbe14=function(_0x3dc439,_0x7d1ec8){_0x3dc439=_0x3dc439-0x0;var _0x3405cf=_0xe14b[_0x3dc439];return _0x3405cf;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file +var _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(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x7217,0x19e));var _0x7721=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x7217[_0x2bf141];return _0x48277b;};'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 ca58b3f..334586c 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 _0x1c23=['delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1c23,0x110));var _0x31c2=function(_0x3dc292,_0x5d0d37){_0x3dc292=_0x3dc292-0x0;var _0xbbe021=_0x1c23[_0x3dc292];return _0xbbe021;};'use strict';var multer=require(_0x31c2('0x0'));var util=require('util');var path=require(_0x31c2('0x1'));var timeout=require(_0x31c2('0x2'));var express=require(_0x31c2('0x3'));var router=express[_0x31c2('0x4')]();var fs_extra=require(_0x31c2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x31c2('0x6'));var config=require(_0x31c2('0x7'));var controller=require(_0x31c2('0x8'));router[_0x31c2('0x9')](_0x31c2('0xa'),auth[_0x31c2('0xb')](),controller[_0x31c2('0xc')]);router[_0x31c2('0xd')]('/:id',auth[_0x31c2('0xb')](),controller['destroy']);module[_0x31c2('0xe')]=router; \ No newline at end of file +var _0x764a=['../../config/environment','./action.controller','put','isAuthenticated','update','delete','/:id','destroy','exports','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x41be4a,_0x16fb7f){var _0xfd0ae1=function(_0x3e94b6){while(--_0x3e94b6){_0x41be4a['push'](_0x41be4a['shift']());}};_0xfd0ae1(++_0x16fb7f);}(_0x764a,0x19f));var _0xa764=function(_0x3ba5fd,_0xbe4159){_0x3ba5fd=_0x3ba5fd-0x0;var _0x3574d3=_0x764a[_0x3ba5fd];return _0x3574d3;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa764('0x0'));var router=express[_0xa764('0x1')]();var fs_extra=require(_0xa764('0x2'));var auth=require(_0xa764('0x3'));var interaction=require(_0xa764('0x4'));var config=require(_0xa764('0x5'));var controller=require(_0xa764('0x6'));router[_0xa764('0x7')]('/:id',auth[_0xa764('0x8')](),controller[_0xa764('0x9')]);router[_0xa764('0xa')](_0xa764('0xb'),auth[_0xa764('0x8')](),controller[_0xa764('0xc')]);module[_0xa764('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index d4da8fd..5129e1d 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 _0x5075=['exports','STRING','TEXT','sequelize'];(function(_0x2f3b14,_0x554f94){var _0x20e924=function(_0x3f4c1c){while(--_0x3f4c1c){_0x2f3b14['push'](_0x2f3b14['shift']());}};_0x20e924(++_0x554f94);}(_0x5075,0x73));var _0x5507=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0x5075[_0x35da42];return _0x370035;};'use strict';var Sequelize=require(_0x5507('0x0'));module[_0x5507('0x1')]={'name':{'type':Sequelize[_0x5507('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x5507('0x2')]},'parent':{'type':Sequelize[_0x5507('0x2')]},'table':{'type':Sequelize[_0x5507('0x2')]},'conditions':{'type':Sequelize[_0x5507('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x7dfd=['STRING','TEXT','sequelize','exports'];(function(_0x297259,_0x17e45d){var _0x2f137c=function(_0x5cb8bf){while(--_0x5cb8bf){_0x297259['push'](_0x297259['shift']());}};_0x2f137c(++_0x17e45d);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd7df('0x0'));module[_0xd7df('0x1')]={'name':{'type':Sequelize[_0xd7df('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd7df('0x2')]},'parent':{'type':Sequelize[_0xd7df('0x2')]},'table':{'type':Sequelize[_0xd7df('0x2')]},'conditions':{'type':Sequelize[_0xd7df('0x3')]},'joins':{'type':Sequelize[_0xd7df('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index a684b3c..3fa351c 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 _0x58a6=['attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticCustomReport','includeAll','findAll','rows','show','params','include','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','metric','replace','function','format','groupBy','orderBy','DESC','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','debug','toString','sequelize','QueryTypes','COUNT(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','from','clone','output','web','fullPath','randomstring','generate','csv','AnalyticExtractedReport','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','child_process','fork','../../components/export/','../../files/reports','countTable','SELECT','run','runReport','parentKey','Limited\x20Query:','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','destroy','then','CustomReports','UserProfileResource','send','map','type','key','name','keys','filters','intersection','model','query'];(function(_0x15b1b6,_0x184912){var _0x704435=function(_0x19e530){while(--_0x19e530){_0x15b1b6['push'](_0x15b1b6['shift']());}};_0x704435(++_0x184912);}(_0x58a6,0x109));var _0x658a=function(_0x424c63,_0x49c9e4){_0x424c63=_0x424c63-0x0;var _0x27b529=_0x58a6[_0x424c63];return _0x27b529;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x658a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x658a('0x1'));var rp=require('request-promise');var moment=require(_0x658a('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x658a('0x3'));var util=require(_0x658a('0x4'));var path=require(_0x658a('0x5'));var sox=require(_0x658a('0x6'));var csv=require(_0x658a('0x7'));var ejs=require(_0x658a('0x8'));var fs=require('fs');var fs_extra=require(_0x658a('0x9'));var _=require('lodash');var squel=require(_0x658a('0xa'));var crypto=require(_0x658a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x658a('0xc'));var toCsv=require('to-csv');var querystring=require(_0x658a('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x658a('0xe'));var qs=require(_0x658a('0xf'));var as=require(_0x658a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x658a('0x11'))(_0x658a('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x658a('0x13'));var db=require(_0x658a('0x14'))['db'];var dbH=require(_0x658a('0x14'))[_0x658a('0x15')];function respondWithStatusCode(_0x3f2613,_0x48f1ab){_0x48f1ab=_0x48f1ab||0xcc;return function(_0x371e43){if(_0x371e43){return _0x3f2613[_0x658a('0x16')](_0x48f1ab);}return _0x3f2613[_0x658a('0x17')](_0x48f1ab)[_0x658a('0x18')]();};}function respondWithResult(_0x579b47,_0x1da786){_0x1da786=_0x1da786||0xc8;return function(_0x2ddd8c){if(_0x2ddd8c){return _0x579b47['status'](_0x1da786)['json'](_0x2ddd8c);}};}function respondWithFilteredResult(_0x2b4b6b,_0x454105){return function(_0x29009c){if(_0x29009c){var _0x9d64c9=typeof _0x454105[_0x658a('0x19')]===_0x658a('0x1a')&&typeof _0x454105[_0x658a('0x1b')]===_0x658a('0x1a');var _0x2656d8=_0x29009c[_0x658a('0x1c')];var _0x3563ae=_0x9d64c9?0x0:_0x454105['offset'];var _0x3ee499=_0x9d64c9?_0x29009c['count']:_0x454105['offset']+_0x454105[_0x658a('0x1b')];var _0x113238;if(_0x3ee499>=_0x2656d8){_0x3ee499=_0x2656d8;_0x113238=0xc8;}else{_0x113238=0xce;}_0x2b4b6b[_0x658a('0x17')](_0x113238);return _0x2b4b6b[_0x658a('0x1d')](_0x658a('0x1e'),_0x3563ae+'-'+_0x3ee499+'/'+_0x2656d8)[_0x658a('0x1f')](_0x29009c);}return null;};}function patchUpdates(_0x5d53ae){return function(_0x1ccfe7){try{jsonpatch[_0x658a('0x20')](_0x1ccfe7,_0x5d53ae,!![]);}catch(_0x328f9e){return BPromise['reject'](_0x328f9e);}return _0x1ccfe7['save']();};}function saveUpdates(_0x2b45dd,_0x46e2f4){return function(_0x309cb4){if(_0x309cb4){return _0x309cb4['update'](_0x2b45dd)['then'](function(_0x1235ed){return _0x1235ed;});}return null;};}function removeEntity(_0x638219,_0x377c8a){return function(_0x11a3fe){if(_0x11a3fe){return _0x11a3fe[_0x658a('0x21')]()[_0x658a('0x22')](function(){var _0x3956b4=_0x11a3fe['get']({'plain':!![]});var _0x44c149=_0x658a('0x23');return db[_0x658a('0x24')][_0x658a('0x21')]({'where':{'type':_0x44c149,'resourceId':_0x3956b4['id']}})[_0x658a('0x22')](function(){return _0x11a3fe;});})['then'](function(){_0x638219[_0x658a('0x17')](0xcc)[_0x658a('0x18')]();});}};}function handleEntityNotFound(_0x294626,_0x2258c6){return function(_0x4f9e50){if(!_0x4f9e50){_0x294626[_0x658a('0x16')](0x194);}return _0x4f9e50;};}function handleError(_0x25236a,_0x3fa57b){_0x3fa57b=_0x3fa57b||0x1f4;return function(_0x3d7350){logger['error'](_0x3d7350['stack']);if(_0x3d7350['name']){delete _0x3d7350['name'];}_0x25236a[_0x658a('0x17')](_0x3fa57b)[_0x658a('0x25')](_0x3d7350);};}exports['index']=function(_0x52fdaa,_0x2f6300){var _0x1fae56={},_0x41cf2d={},_0x6cf542={'count':0x0,'rows':[]};var _0x316a06=_[_0x658a('0x26')](db['AnalyticCustomReport']['rawAttributes'],function(_0x35499c){return{'name':_0x35499c['fieldName'],'type':_0x35499c[_0x658a('0x27')][_0x658a('0x28')]};});_0x41cf2d['model']=_[_0x658a('0x26')](_0x316a06,_0x658a('0x29'));_0x41cf2d['query']=_[_0x658a('0x2a')](_0x52fdaa['query']);_0x41cf2d[_0x658a('0x2b')]=_[_0x658a('0x2c')](_0x41cf2d[_0x658a('0x2d')],_0x41cf2d[_0x658a('0x2e')]);_0x1fae56[_0x658a('0x2f')]=_[_0x658a('0x2c')](_0x41cf2d[_0x658a('0x2d')],qs[_0x658a('0x30')](_0x52fdaa[_0x658a('0x2e')][_0x658a('0x30')]));_0x1fae56['attributes']=_0x1fae56[_0x658a('0x2f')][_0x658a('0x31')]?_0x1fae56[_0x658a('0x2f')]:_0x41cf2d[_0x658a('0x2d')];if(!_0x52fdaa['query']['hasOwnProperty']('nolimit')){_0x1fae56[_0x658a('0x1b')]=qs[_0x658a('0x1b')](_0x52fdaa['query'][_0x658a('0x1b')]);_0x1fae56[_0x658a('0x19')]=qs[_0x658a('0x19')](_0x52fdaa[_0x658a('0x2e')][_0x658a('0x19')]);}_0x1fae56[_0x658a('0x32')]=qs[_0x658a('0x33')](_0x52fdaa['query'][_0x658a('0x33')]);_0x1fae56[_0x658a('0x34')]=qs['filters'](_[_0x658a('0x35')](_0x52fdaa[_0x658a('0x2e')],_0x41cf2d[_0x658a('0x2b')]),_0x316a06);if(_0x52fdaa[_0x658a('0x2e')][_0x658a('0x36')]){_0x1fae56['where']=_[_0x658a('0x37')](_0x1fae56[_0x658a('0x34')],{'$or':_[_0x658a('0x26')](_0x316a06,function(_0x4d0515){if(_0x4d0515[_0x658a('0x27')]!==_0x658a('0x38')){var _0x82e405={};_0x82e405[_0x4d0515[_0x658a('0x29')]]={'$like':'%'+_0x52fdaa['query']['filter']+'%'};return _0x82e405;}})});}_0x1fae56=_['merge']({},_0x1fae56,_0x52fdaa[_0x658a('0x39')]);var _0x13da64={'where':_0x1fae56[_0x658a('0x34')]};return db[_0x658a('0x3a')]['count'](_0x13da64)['then'](function(_0x500656){_0x6cf542[_0x658a('0x1c')]=_0x500656;if(_0x52fdaa[_0x658a('0x2e')][_0x658a('0x3b')]){_0x1fae56['include']=[{'all':!![]}];}return db[_0x658a('0x3a')][_0x658a('0x3c')](_0x1fae56);})[_0x658a('0x22')](function(_0x4ff4ab){_0x6cf542[_0x658a('0x3d')]=_0x4ff4ab;return _0x6cf542;})[_0x658a('0x22')](respondWithFilteredResult(_0x2f6300,_0x1fae56))['catch'](handleError(_0x2f6300,null));};exports[_0x658a('0x3e')]=function(_0x1f217b,_0x457563){var _0x38e804={'raw':![],'where':{'id':_0x1f217b[_0x658a('0x3f')]['id']}},_0x15e4a0={};_0x15e4a0[_0x658a('0x2d')]=_[_0x658a('0x2a')](db[_0x658a('0x3a')]['rawAttributes']);_0x15e4a0['query']=_['keys'](_0x1f217b[_0x658a('0x2e')]);_0x15e4a0[_0x658a('0x2b')]=_['intersection'](_0x15e4a0[_0x658a('0x2d')],_0x15e4a0[_0x658a('0x2e')]);_0x38e804[_0x658a('0x2f')]=_[_0x658a('0x2c')](_0x15e4a0[_0x658a('0x2d')],qs[_0x658a('0x30')](_0x1f217b['query'][_0x658a('0x30')]));_0x38e804[_0x658a('0x2f')]=_0x38e804[_0x658a('0x2f')][_0x658a('0x31')]?_0x38e804[_0x658a('0x2f')]:_0x15e4a0[_0x658a('0x2d')];if(_0x1f217b[_0x658a('0x2e')][_0x658a('0x3b')]){_0x38e804[_0x658a('0x40')]=[{'all':!![]}];}_0x38e804=_['merge']({},_0x38e804,_0x1f217b[_0x658a('0x39')]);return db['AnalyticCustomReport'][_0x658a('0x41')](_0x38e804)[_0x658a('0x22')](handleEntityNotFound(_0x457563,null))['then'](respondWithResult(_0x457563,null))[_0x658a('0x42')](handleError(_0x457563,null));};exports[_0x658a('0x43')]=function(_0x31fc66,_0x501a57){return db['AnalyticCustomReport'][_0x658a('0x43')](_0x31fc66['body'],{})['then'](function(_0x226d00){var _0x114539=_0x31fc66[_0x658a('0x44')][_0x658a('0x45')]({'plain':!![]});if(!_0x114539)throw new Error(_0x658a('0x46'));if(_0x114539[_0x658a('0x47')]===_0x658a('0x44')){var _0x7426ae=_0x226d00[_0x658a('0x45')]({'plain':!![]});var _0x491de1=_0x658a('0x48');return db[_0x658a('0x49')][_0x658a('0x41')]({'where':{'name':_0x491de1,'userProfileId':_0x114539['userProfileId']},'raw':!![]})['then'](function(_0x1e7e77){if(_0x1e7e77&&_0x1e7e77[_0x658a('0x4a')]===0x0){return db[_0x658a('0x24')][_0x658a('0x43')]({'name':_0x7426ae[_0x658a('0x29')],'resourceId':_0x7426ae['id'],'type':_0x658a('0x23'),'sectionId':_0x1e7e77['id']},{})[_0x658a('0x22')](function(){return _0x226d00;});}else{return _0x226d00;}})[_0x658a('0x42')](function(_0x44b9f9){logger[_0x658a('0x4b')](_0x658a('0x4c'),_0x44b9f9);throw _0x44b9f9;});}return _0x226d00;})[_0x658a('0x22')](respondWithResult(_0x501a57,0xc9))['catch'](handleError(_0x501a57,null));};exports['update']=function(_0x4bc1ec,_0x1f3088){if(_0x4bc1ec[_0x658a('0x4d')]['id']){delete _0x4bc1ec[_0x658a('0x4d')]['id'];}return db['AnalyticCustomReport'][_0x658a('0x41')]({'where':{'id':_0x4bc1ec[_0x658a('0x3f')]['id']}})[_0x658a('0x22')](handleEntityNotFound(_0x1f3088,null))['then'](saveUpdates(_0x4bc1ec[_0x658a('0x4d')],null))[_0x658a('0x22')](respondWithResult(_0x1f3088,null))['catch'](handleError(_0x1f3088,null));};exports[_0x658a('0x21')]=function(_0x19934c,_0x9ae3e4){return db[_0x658a('0x3a')][_0x658a('0x41')]({'where':{'id':_0x19934c[_0x658a('0x3f')]['id']}})[_0x658a('0x22')](handleEntityNotFound(_0x9ae3e4,null))[_0x658a('0x22')](removeEntity(_0x9ae3e4,null))[_0x658a('0x42')](handleError(_0x9ae3e4,null));};exports['preview']=function(_0x3d09db,_0x429dc4){var _0x24e676=0xa;var _0x1feb0b=[_0x658a('0x4e'),_0x658a('0x4f'),_0x658a('0x50'),_0x658a('0x51')];var _0x18390e={'SUM':_0x658a('0x52'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x658a('0x53'),'MAX':_0x658a('0x54'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x658a('0x55'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x658a('0x56')};var _0x35906b={'SEC_TO_TIME':_0x658a('0x57'),'DATE':_0x658a('0x58'),'HOUR':_0x658a('0x59'),'ROUND':_0x658a('0x5a'),'UNIX_TIMESTAMP':_0x658a('0x5b')};var _0x1fbd7d=function(_0x4157f9){return!_[_0x658a('0x5c')]([_0x658a('0x5d'),_0x658a('0x5e'),_0x658a('0x5f'),_0x658a('0x60')],_0x4157f9);};var _0x312239=function(_0x3ae403){if(!_0x3ae403||!_0x3ae403['rules'][_0x658a('0x31')]){return'';}for(var _0x4e8531='(',_0xff1d43=0x0;_0xff1d43<_0x3ae403[_0x658a('0x61')][_0x658a('0x31')];_0xff1d43+=0x1){_0xff1d43>0x0&&(_0x4e8531+='\x20'+_0x3ae403[_0x658a('0x62')]+'\x20');_0x4e8531+=_0x3ae403[_0x658a('0x61')][_0xff1d43]['group']?_0x312239(_0x3ae403[_0x658a('0x61')][_0xff1d43][_0x658a('0x63')]):_0x3ae403[_0x658a('0x61')][_0xff1d43][_0x658a('0x64')]+'\x20'+_0x3ae403[_0x658a('0x61')][_0xff1d43][_0x658a('0x65')]+(_0x1fbd7d(_0x3ae403['rules'][_0xff1d43]['condition'])?'\x20'+_0x3ae403[_0x658a('0x61')][_0xff1d43][_0x658a('0x66')]:'');}return _0x4e8531+')';};var _0x43540e={'where':{'id':_0x3d09db[_0x658a('0x3f')]['id']}},_0x35cf96,_0x4bf6cd,_0xf50503,_0x4eb3ac,_0x2f678f;_0x43540e=_[_0x658a('0x37')]({},_0x43540e,_0x3d09db[_0x658a('0x39')]);return db[_0x658a('0x3a')][_0x658a('0x41')](_0x43540e)[_0x658a('0x22')](function(_0x3f9ede){if(_0x3f9ede){_0x35cf96=_0x3f9ede;return _0x3f9ede[_0x658a('0x67')]();}return null;})['then'](function(_0x34d98b){if(_0x34d98b){if(!_0x34d98b[_0x658a('0x31')]){throw new db[(_0x658a('0x68'))][(_0x658a('0x69'))](_0x658a('0x6a'),0x193);}_0x4bf6cd=_0x34d98b;return db[_0x658a('0x6b')][_0x658a('0x3c')]({'raw':!![]});}return null;})[_0x658a('0x22')](function(_0x1dcdd6){if(_0x1dcdd6){_0xf50503=_[_0x658a('0x6c')](_0x1dcdd6,'id');var _0x1aa0ed;var _0x17d35f=squel[_0x658a('0x6d')]();_0x17d35f['from'](_0x35cf96[_0x658a('0x6e')]);for(var _0xfda05f=0x0;_0xfda05f<_0x4bf6cd[_0x658a('0x31')];_0xfda05f+=0x1){_0x1aa0ed=_0x4bf6cd[_0xfda05f][_0x658a('0x6f')]?_0xf50503[_0x4bf6cd[_0xfda05f]['MetricId']][_0x658a('0x70')]:_0x4bf6cd[_0xfda05f][_0x658a('0x64')];_0x1aa0ed=_0x4bf6cd[_0xfda05f]['function']?_[_0x658a('0x71')](_0x18390e[_0x4bf6cd[_0xfda05f][_0x658a('0x72')]],'%s',_0x1aa0ed):_0x1aa0ed;_0x1aa0ed=_0x4bf6cd[_0xfda05f][_0x658a('0x73')]?_[_0x658a('0x71')](_0x35906b[_0x4bf6cd[_0xfda05f]['format']],'%s',_0x1aa0ed):_0x1aa0ed;if(_0x4bf6cd[_0xfda05f][_0x658a('0x74')]){_0x17d35f[_0x658a('0x63')](_0x1aa0ed);}_0x4bf6cd[_0xfda05f][_0x658a('0x75')]&&_0x17d35f[_0x658a('0x32')](_0x1aa0ed,_0x4bf6cd[_0xfda05f]['orderBy']===_0x658a('0x76')?![]:!![]);_0x17d35f['field'](_0x1aa0ed,_0x4bf6cd[_0xfda05f][_0x658a('0x77')]||_0x1aa0ed);}if(_0x35cf96[_0x658a('0x78')]){_0x35cf96[_0x658a('0x78')]=JSON[_0x658a('0x79')](_0x35cf96[_0x658a('0x78')]);for(var _0x37f697=0x0;_0x37f697<_0x35cf96[_0x658a('0x78')][_0x658a('0x31')];_0x37f697+=0x1){if(_0x35cf96[_0x658a('0x78')][_0x37f697][_0x658a('0x27')]&&_[_0x658a('0x5c')](_0x1feb0b,_0x35cf96[_0x658a('0x78')][_0x37f697][_0x658a('0x27')])&&_0x35cf96[_0x658a('0x78')][_0x37f697]['parentKey']&&_0x35cf96[_0x658a('0x78')][_0x37f697][_0x658a('0x7a')]&&_0x35cf96[_0x658a('0x78')][_0x37f697][_0x658a('0x7b')]){_0x17d35f[_0x35cf96[_0x658a('0x78')][_0x37f697][_0x658a('0x27')]](_0x35cf96[_0x658a('0x78')][_0x37f697][_0x658a('0x7a')],null,util[_0x658a('0x73')](_0x658a('0x7c'),_0x35cf96[_0x658a('0x6e')],_0x35cf96[_0x658a('0x78')][_0x37f697]['parentKey'],_0x35cf96['joins'][_0x37f697]['foreignTable'],_0x35cf96['joins'][_0x37f697][_0x658a('0x7b')]));}}}if(_0x35cf96[_0x658a('0x7d')]){_0x35cf96[_0x658a('0x7d')]=JSON[_0x658a('0x79')](_0x35cf96[_0x658a('0x7d')]);_0x17d35f[_0x658a('0x34')](_0x312239(_0x35cf96[_0x658a('0x7d')]['group']));}_0x2f678f=_0x17d35f['clone']();_0x17d35f[_0x658a('0x1b')](_0x24e676);_0x17d35f[_0x658a('0x19')](0x0);logger[_0x658a('0x7e')]('Limited\x20Query:',_0x17d35f[_0x658a('0x7f')]());return dbH['sequelize'][_0x658a('0x2e')](_0x17d35f[_0x658a('0x7f')](),{'type':dbH[_0x658a('0x80')][_0x658a('0x81')]['SELECT']});}})['then'](respondWithResult(_0x429dc4,null))[_0x658a('0x42')](handleError(_0x429dc4,null));};function runReport(_0x37d5a1,_0x5b4f74,_0x173da5){var _0x494302=_0x5b4f74[_0x658a('0x29')];var _0x25008c=0xa;var _0x59c528=[_0x658a('0x4e'),_0x658a('0x4f'),_0x658a('0x50'),'cross_join'];var _0x15cb1b={'SUM':_0x658a('0x52'),'COUNT':_0x658a('0x82'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x658a('0x54'),'MIN':_0x658a('0x83'),'AVG':_0x658a('0x84'),'GROUP_CONCAT':_0x658a('0x55'),'GROUP_CONCAT ASC':_0x658a('0x85'),'GROUP_CONCAT DESC':_0x658a('0x56')};var _0x37f5a7={'SEC_TO_TIME':_0x658a('0x57'),'DATE':_0x658a('0x58'),'HOUR':_0x658a('0x59'),'ROUND':_0x658a('0x5a'),'UNIX_TIMESTAMP':_0x658a('0x5b')};var _0xca5f52=function(_0x5cf102){return!_[_0x658a('0x5c')](['IS\x20NULL',_0x658a('0x5e'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x5cf102);};var _0x17a94b=function(_0xf64188){if(!_0xf64188||!_0xf64188[_0x658a('0x61')][_0x658a('0x31')]){return'';}for(var _0x2321a9='(',_0x14e43f=0x0;_0x14e43f<_0xf64188[_0x658a('0x61')][_0x658a('0x31')];_0x14e43f+=0x1){_0x14e43f>0x0&&(_0x2321a9+='\x20'+_0xf64188[_0x658a('0x62')]+'\x20');_0x2321a9+=_0xf64188[_0x658a('0x61')][_0x14e43f][_0x658a('0x63')]?_0x17a94b(_0xf64188['rules'][_0x14e43f][_0x658a('0x63')]):_0xf64188[_0x658a('0x61')][_0x14e43f]['field']+'\x20'+_0xf64188[_0x658a('0x61')][_0x14e43f][_0x658a('0x65')]+(_0xca5f52(_0xf64188[_0x658a('0x61')][_0x14e43f][_0x658a('0x65')])?'\x20'+_0xf64188[_0x658a('0x61')][_0x14e43f][_0x658a('0x66')]:'');}return _0x2321a9+')';};var _0x46f74d={'where':{'id':_0x37d5a1['id']}},_0x57b4ba,_0x55e6a4,_0x517d56,_0x3a6d77,_0x14133e;_0x46f74d=_[_0x658a('0x37')]({},_0x46f74d,_0x173da5);return db[_0x658a('0x3a')][_0x658a('0x41')](_0x46f74d)[_0x658a('0x22')](function(_0x2b94a9){if(_0x2b94a9){_0x57b4ba=_0x2b94a9;return _0x2b94a9['getFields']();}return null;})[_0x658a('0x22')](function(_0x29a790){if(_0x29a790){if(!_0x29a790['length']){throw new db[(_0x658a('0x68'))][(_0x658a('0x69'))](_0x658a('0x6a'),0x193);}_0x55e6a4=_0x29a790;return db[_0x658a('0x6b')][_0x658a('0x3c')]({'raw':!![]});}return null;})[_0x658a('0x22')](function(_0x1e77f5){if(_0x1e77f5){_0x517d56=_[_0x658a('0x6c')](_0x1e77f5,'id');var _0xdbf012;var _0x3af52c=squel['select']();_0x3af52c[_0x658a('0x86')](_0x57b4ba[_0x658a('0x6e')]);for(var _0x2304a4=0x0;_0x2304a4<_0x55e6a4[_0x658a('0x31')];_0x2304a4+=0x1){_0xdbf012=_0x55e6a4[_0x2304a4][_0x658a('0x6f')]?_0x517d56[_0x55e6a4[_0x2304a4][_0x658a('0x6f')]][_0x658a('0x70')]:_0x55e6a4[_0x2304a4]['field'];_0xdbf012=_0x55e6a4[_0x2304a4]['function']?_['replace'](_0x15cb1b[_0x55e6a4[_0x2304a4][_0x658a('0x72')]],'%s',_0xdbf012):_0xdbf012;_0xdbf012=_0x55e6a4[_0x2304a4]['format']?_[_0x658a('0x71')](_0x37f5a7[_0x55e6a4[_0x2304a4][_0x658a('0x73')]],'%s',_0xdbf012):_0xdbf012;if(_0x55e6a4[_0x2304a4][_0x658a('0x74')]){_0x3af52c[_0x658a('0x63')](_0xdbf012);}_0x55e6a4[_0x2304a4]['orderBy']&&_0x3af52c['order'](_0xdbf012,_0x55e6a4[_0x2304a4][_0x658a('0x75')]==='DESC'?![]:!![]);_0x3af52c['field'](_0xdbf012,_0x55e6a4[_0x2304a4][_0x658a('0x77')]||_0xdbf012);}if(_0x57b4ba[_0x658a('0x78')]){_0x57b4ba['joins']=JSON[_0x658a('0x79')](_0x57b4ba[_0x658a('0x78')]);for(var _0x318314=0x0;_0x318314<_0x57b4ba[_0x658a('0x78')][_0x658a('0x31')];_0x318314+=0x1){if(_0x57b4ba[_0x658a('0x78')][_0x318314][_0x658a('0x27')]&&_[_0x658a('0x5c')](_0x59c528,_0x57b4ba[_0x658a('0x78')][_0x318314][_0x658a('0x27')])&&_0x57b4ba['joins'][_0x318314]['parentKey']&&_0x57b4ba['joins'][_0x318314][_0x658a('0x7a')]&&_0x57b4ba[_0x658a('0x78')][_0x318314][_0x658a('0x7b')]){_0x3af52c[_0x57b4ba[_0x658a('0x78')][_0x318314][_0x658a('0x27')]](_0x57b4ba[_0x658a('0x78')][_0x318314]['foreignTable'],null,util[_0x658a('0x73')](_0x658a('0x7c'),_0x57b4ba[_0x658a('0x6e')],_0x57b4ba[_0x658a('0x78')][_0x318314]['parentKey'],_0x57b4ba[_0x658a('0x78')][_0x318314][_0x658a('0x7a')],_0x57b4ba[_0x658a('0x78')][_0x318314][_0x658a('0x7b')]));}}}if(_0x57b4ba['conditions']){_0x57b4ba[_0x658a('0x7d')]=JSON[_0x658a('0x79')](_0x57b4ba[_0x658a('0x7d')]);_0x3af52c[_0x658a('0x34')](_0x17a94b(_0x57b4ba['conditions']['group']));}_0x14133e=_0x3af52c[_0x658a('0x87')]();_0x3af52c[_0x658a('0x1b')](_0x25008c);_0x3af52c[_0x658a('0x19')](0x0);return;}})['then'](function(){if(_0x5b4f74[_0x658a('0x88')]===_0x658a('0x89')){return null;}var _0x4faaf4=_['merge'](_0x5b4f74,{'name':_0x5b4f74[_0x658a('0x8a')]||_0x5b4f74['name']||_0x57b4ba['name'],'basename':_0x494302,'savename':util[_0x658a('0x73')]('%s-%s.%s',_0x5b4f74[_0x658a('0x29')]||_0x57b4ba['name'],require(_0x658a('0x8b'))[_0x658a('0x8c')](0x4),_0x5b4f74['output']||_0x658a('0x8d')),'reportId':_0x57b4ba['id'],'reportType':'custom'});return db[_0x658a('0x8e')][_0x658a('0x43')](_0x4faaf4,{'raw':!![]});})[_0x658a('0x22')](function(_0x486f8e){if(_0x57b4ba[_0x658a('0x6e')]==='cdr'){_0x14133e['where'](_0x57b4ba[_0x658a('0x6e')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x5b4f74[_0x658a('0x8f')],_0x5b4f74[_0x658a('0x90')]);}else{_0x14133e[_0x658a('0x34')](_0x57b4ba[_0x658a('0x6e')]+_0x658a('0x91'),_0x5b4f74[_0x658a('0x8f')],_0x5b4f74[_0x658a('0x90')]);}if(_0x486f8e){logger['info']('Run\x20Query:',_0x14133e[_0x658a('0x7f')]());require(_0x658a('0x92'))[_0x658a('0x93')](path['join'](__dirname,_0x658a('0x94'),_0x486f8e[_0x658a('0x88')]),[_0x486f8e['id'],_0x14133e[_0x658a('0x7f')](),path[_0x658a('0x4e')](__dirname,_0x658a('0x95'),_0x486f8e['savename']),_0x494302]);return _0x486f8e;}else{var _0x27b81f=squel[_0x658a('0x6d')]();_0x27b81f['from']('('+_0x14133e[_0x658a('0x7f')]()+')',_0x658a('0x96'));_0x27b81f['field']('COUNT(*)',_0x658a('0x1c'));_0x14133e[_0x658a('0x1b')](_0x5b4f74[_0x658a('0x1b')]||_0x25008c);_0x14133e[_0x658a('0x19')](_0x5b4f74[_0x658a('0x19')]||0x0);return dbH[_0x658a('0x80')]['query'](_0x27b81f[_0x658a('0x7f')](),{'type':dbH[_0x658a('0x80')][_0x658a('0x81')][_0x658a('0x97')]})['then'](function(_0xb743ed){if(!_0xb743ed[_0x658a('0x31')]){_0x3a6d77=0x0;}else{_0x3a6d77=_0xb743ed[0x0]['count']||0x0;}return dbH['sequelize']['query'](_0x14133e[_0x658a('0x7f')](),{'type':dbH[_0x658a('0x80')][_0x658a('0x81')][_0x658a('0x97')]});})[_0x658a('0x22')](function(_0xe51c1d){return{'rows':_0xe51c1d||[],'count':_0x3a6d77};});}});}exports[_0x658a('0x98')]=function(_0x19154e,_0x154652){return runReport(_0x19154e[_0x658a('0x3f')],_0x19154e[_0x658a('0x2e')],_0x19154e[_0x658a('0x39')])[_0x658a('0x22')](respondWithResult(_0x154652,null))[_0x658a('0x42')](handleError(_0x154652,null));};exports[_0x658a('0x99')]=runReport;exports[_0x658a('0x2e')]=function(_0x15e62f,_0x266a19){var _0x4d75b3=0xa;var _0x465f42=[_0x658a('0x4e'),_0x658a('0x4f'),_0x658a('0x50'),_0x658a('0x51')];var _0x3275a6={'SUM':'SUM(%s)','COUNT':_0x658a('0x82'),'COUNT DISTINCT':_0x658a('0x53'),'MAX':_0x658a('0x54'),'MIN':'MIN(%s)','AVG':_0x658a('0x84'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x658a('0x85'),'GROUP_CONCAT DESC':_0x658a('0x56')};var _0x5b0a55={'SEC_TO_TIME':_0x658a('0x57'),'DATE':_0x658a('0x58'),'HOUR':_0x658a('0x59'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x658a('0x5b')};var _0x3d63c8=function(_0xab1ebf){return!_[_0x658a('0x5c')]([_0x658a('0x5d'),_0x658a('0x5e'),_0x658a('0x5f'),'IS\x20NOT\x20EMPTY'],_0xab1ebf);};var _0x1f9ba5=function(_0x55115e){if(!_0x55115e||!_0x55115e[_0x658a('0x61')][_0x658a('0x31')]){return'';}for(var _0x6ab582='(',_0x1a0ab3=0x0;_0x1a0ab3<_0x55115e[_0x658a('0x61')][_0x658a('0x31')];_0x1a0ab3+=0x1){_0x1a0ab3>0x0&&(_0x6ab582+='\x20'+_0x55115e[_0x658a('0x62')]+'\x20');_0x6ab582+=_0x55115e[_0x658a('0x61')][_0x1a0ab3]['group']?_0x1f9ba5(_0x55115e['rules'][_0x1a0ab3][_0x658a('0x63')]):_0x55115e[_0x658a('0x61')][_0x1a0ab3][_0x658a('0x64')]+'\x20'+_0x55115e['rules'][_0x1a0ab3]['condition']+(_0x3d63c8(_0x55115e[_0x658a('0x61')][_0x1a0ab3][_0x658a('0x65')])?'\x20'+_0x55115e[_0x658a('0x61')][_0x1a0ab3][_0x658a('0x66')]:'');}return _0x6ab582+')';};var _0x417c5a={'where':{'id':_0x15e62f['params']['id']}},_0x5de7cb,_0x155b4b,_0x3186fc,_0x104b0e,_0x2a2bc0;_0x417c5a=_[_0x658a('0x37')]({},_0x417c5a,_0x15e62f['options']);return db['AnalyticCustomReport'][_0x658a('0x41')](_0x417c5a)[_0x658a('0x22')](function(_0x4e47d3){if(_0x4e47d3){_0x5de7cb=_0x4e47d3;return _0x4e47d3[_0x658a('0x67')]();}return null;})[_0x658a('0x22')](function(_0x28334d){if(_0x28334d){if(!_0x28334d[_0x658a('0x31')]){throw new db[(_0x658a('0x68'))][(_0x658a('0x69'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x155b4b=_0x28334d;return db[_0x658a('0x6b')][_0x658a('0x3c')]({'raw':!![]});}return null;})['then'](function(_0x7a4acf){if(_0x7a4acf){_0x3186fc=_['keyBy'](_0x7a4acf,'id');var _0x37e132;var _0x3cb72f=squel[_0x658a('0x6d')]();_0x3cb72f['from'](_0x5de7cb[_0x658a('0x6e')]);for(var _0x35078c=0x0;_0x35078c<_0x155b4b[_0x658a('0x31')];_0x35078c+=0x1){_0x37e132=_0x155b4b[_0x35078c][_0x658a('0x6f')]?_0x3186fc[_0x155b4b[_0x35078c][_0x658a('0x6f')]]['metric']:_0x155b4b[_0x35078c][_0x658a('0x64')];_0x37e132=_0x155b4b[_0x35078c][_0x658a('0x72')]?_['replace'](_0x3275a6[_0x155b4b[_0x35078c][_0x658a('0x72')]],'%s',_0x37e132):_0x37e132;_0x37e132=_0x155b4b[_0x35078c]['format']?_[_0x658a('0x71')](_0x5b0a55[_0x155b4b[_0x35078c][_0x658a('0x73')]],'%s',_0x37e132):_0x37e132;if(_0x155b4b[_0x35078c]['groupBy']){_0x3cb72f['group'](_0x37e132);}_0x155b4b[_0x35078c][_0x658a('0x75')]&&_0x3cb72f['order'](_0x37e132,_0x155b4b[_0x35078c][_0x658a('0x75')]===_0x658a('0x76')?![]:!![]);_0x3cb72f[_0x658a('0x64')](_0x37e132,_0x155b4b[_0x35078c][_0x658a('0x77')]||_0x37e132);}if(_0x5de7cb['joins']){_0x5de7cb['joins']=JSON[_0x658a('0x79')](_0x5de7cb[_0x658a('0x78')]);for(var _0x3f9c37=0x0;_0x3f9c37<_0x5de7cb[_0x658a('0x78')]['length'];_0x3f9c37+=0x1){if(_0x5de7cb[_0x658a('0x78')][_0x3f9c37][_0x658a('0x27')]&&_[_0x658a('0x5c')](_0x465f42,_0x5de7cb[_0x658a('0x78')][_0x3f9c37]['type'])&&_0x5de7cb[_0x658a('0x78')][_0x3f9c37][_0x658a('0x9a')]&&_0x5de7cb[_0x658a('0x78')][_0x3f9c37]['foreignTable']&&_0x5de7cb[_0x658a('0x78')][_0x3f9c37][_0x658a('0x7b')]){_0x3cb72f[_0x5de7cb['joins'][_0x3f9c37][_0x658a('0x27')]](_0x5de7cb[_0x658a('0x78')][_0x3f9c37][_0x658a('0x7a')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x5de7cb[_0x658a('0x6e')],_0x5de7cb[_0x658a('0x78')][_0x3f9c37][_0x658a('0x9a')],_0x5de7cb['joins'][_0x3f9c37][_0x658a('0x7a')],_0x5de7cb[_0x658a('0x78')][_0x3f9c37][_0x658a('0x7b')]));}}}if(_0x5de7cb[_0x658a('0x7d')]){_0x5de7cb[_0x658a('0x7d')]=JSON[_0x658a('0x79')](_0x5de7cb[_0x658a('0x7d')]);_0x3cb72f[_0x658a('0x34')](_0x1f9ba5(_0x5de7cb[_0x658a('0x7d')]['group']));}_0x2a2bc0=_0x3cb72f[_0x658a('0x87')]();_0x3cb72f[_0x658a('0x1b')](_0x4d75b3);_0x3cb72f[_0x658a('0x19')](0x0);logger['debug'](_0x658a('0x9b'),_0x3cb72f[_0x658a('0x7f')]());return dbH[_0x658a('0x80')][_0x658a('0x2e')](_0x3cb72f['toString'](),{'type':dbH['sequelize'][_0x658a('0x81')][_0x658a('0x97')]});}})[_0x658a('0x22')](function(){return{'sql':_0x2a2bc0[_0x658a('0x7f')]()};})['then'](respondWithResult(_0x266a19,null))[_0x658a('0x42')](handleError(_0x266a19,null));}; \ No newline at end of file +var _0xceff=['foreignTable','foreignKey','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','left_join','cross_join','SUM(%s)','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','UNIX_TIMESTAMP(%s)','MetricId','web','fullPath','%s-%s.%s','generate','output','csv','custom','cdr','startDate','endDate','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','SELECT','DATE(%s)','%s.%s\x20=\x20%s.%s','debug','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','json','apply','reject','save','update','then','destroy','get','CustomReports','UserProfileResource','stack','name','index','AnalyticCustomReport','fieldName','type','key','model','map','keys','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','intersection','find','create','body','userProfileId','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','right_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','metric','replace','function','format','groupBy','orderBy','order','DESC','alias','joins','parse','parentKey'];(function(_0x12e451,_0xd5bbdf){var _0x1cbcb7=function(_0x30c11b){while(--_0x30c11b){_0x12e451['push'](_0x12e451['shift']());}};_0x1cbcb7(++_0xd5bbdf);}(_0xceff,0xc5));var _0xfcef=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xceff[_0x3d42d8];return _0x27fc41;};'use strict';var emlformat=require(_0xfcef('0x0'));var rimraf=require(_0xfcef('0x1'));var zipdir=require(_0xfcef('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfcef('0x3'));var moment=require(_0xfcef('0x4'));var BPromise=require(_0xfcef('0x5'));var Mustache=require(_0xfcef('0x6'));var util=require(_0xfcef('0x7'));var path=require(_0xfcef('0x8'));var sox=require(_0xfcef('0x9'));var csv=require(_0xfcef('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfcef('0xb'));var _=require(_0xfcef('0xc'));var squel=require(_0xfcef('0xd'));var crypto=require(_0xfcef('0xe'));var jsforce=require(_0xfcef('0xf'));var deskjs=require(_0xfcef('0x10'));var toCsv=require('to-csv');var querystring=require(_0xfcef('0x11'));var Papa=require('papaparse');var Redis=require(_0xfcef('0x12'));var authService=require(_0xfcef('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xfcef('0x14'));var hardwareService=require(_0xfcef('0x15'));var logger=require('../../config/logger')(_0xfcef('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfcef('0x17'));var db=require(_0xfcef('0x18'))['db'];var dbH=require(_0xfcef('0x18'))['dbH'];function respondWithStatusCode(_0x306bd9,_0x122b03){_0x122b03=_0x122b03||0xcc;return function(_0x157c18){if(_0x157c18){return _0x306bd9[_0xfcef('0x19')](_0x122b03);}return _0x306bd9[_0xfcef('0x1a')](_0x122b03)[_0xfcef('0x1b')]();};}function respondWithResult(_0x557260,_0x106480){_0x106480=_0x106480||0xc8;return function(_0x5958d3){if(_0x5958d3){return _0x557260[_0xfcef('0x1a')](_0x106480)['json'](_0x5958d3);}};}function respondWithFilteredResult(_0x2a9585,_0x27c284){return function(_0x2370c4){if(_0x2370c4){var _0x5c213d=typeof _0x27c284[_0xfcef('0x1c')]==='undefined'&&typeof _0x27c284['limit']===_0xfcef('0x1d');var _0x4adace=_0x2370c4['count'];var _0x217a17=_0x5c213d?0x0:_0x27c284[_0xfcef('0x1c')];var _0x20dae4=_0x5c213d?_0x2370c4[_0xfcef('0x1e')]:_0x27c284[_0xfcef('0x1c')]+_0x27c284[_0xfcef('0x1f')];var _0x5c7d67;if(_0x20dae4>=_0x4adace){_0x20dae4=_0x4adace;_0x5c7d67=0xc8;}else{_0x5c7d67=0xce;}_0x2a9585[_0xfcef('0x1a')](_0x5c7d67);return _0x2a9585['set']('Content-Range',_0x217a17+'-'+_0x20dae4+'/'+_0x4adace)[_0xfcef('0x20')](_0x2370c4);}return null;};}function patchUpdates(_0x5d987b){return function(_0x47a10e){try{jsonpatch[_0xfcef('0x21')](_0x47a10e,_0x5d987b,!![]);}catch(_0x11f194){return BPromise[_0xfcef('0x22')](_0x11f194);}return _0x47a10e[_0xfcef('0x23')]();};}function saveUpdates(_0x59ed14,_0x122197){return function(_0x22bbd3){if(_0x22bbd3){return _0x22bbd3[_0xfcef('0x24')](_0x59ed14)[_0xfcef('0x25')](function(_0x190835){return _0x190835;});}return null;};}function removeEntity(_0xa8e476,_0x33d798){return function(_0x19179f){if(_0x19179f){return _0x19179f[_0xfcef('0x26')]()[_0xfcef('0x25')](function(){var _0x2ddcd8=_0x19179f[_0xfcef('0x27')]({'plain':!![]});var _0x2eca98=_0xfcef('0x28');return db[_0xfcef('0x29')]['destroy']({'where':{'type':_0x2eca98,'resourceId':_0x2ddcd8['id']}})[_0xfcef('0x25')](function(){return _0x19179f;});})[_0xfcef('0x25')](function(){_0xa8e476[_0xfcef('0x1a')](0xcc)[_0xfcef('0x1b')]();});}};}function handleEntityNotFound(_0x323e53,_0x3fb0f2){return function(_0x53f2ea){if(!_0x53f2ea){_0x323e53[_0xfcef('0x19')](0x194);}return _0x53f2ea;};}function handleError(_0x4d6946,_0x5beb6d){_0x5beb6d=_0x5beb6d||0x1f4;return function(_0xd0332b){logger['error'](_0xd0332b[_0xfcef('0x2a')]);if(_0xd0332b[_0xfcef('0x2b')]){delete _0xd0332b[_0xfcef('0x2b')];}_0x4d6946[_0xfcef('0x1a')](_0x5beb6d)['send'](_0xd0332b);};}exports[_0xfcef('0x2c')]=function(_0x1dada5,_0xc677a2){var _0x1a2e29={},_0x10d121={},_0x31cf07={'count':0x0,'rows':[]};var _0x2840da=_['map'](db[_0xfcef('0x2d')]['rawAttributes'],function(_0x682b8c){return{'name':_0x682b8c[_0xfcef('0x2e')],'type':_0x682b8c[_0xfcef('0x2f')][_0xfcef('0x30')]};});_0x10d121[_0xfcef('0x31')]=_[_0xfcef('0x32')](_0x2840da,_0xfcef('0x2b'));_0x10d121['query']=_[_0xfcef('0x33')](_0x1dada5[_0xfcef('0x34')]);_0x10d121['filters']=_['intersection'](_0x10d121[_0xfcef('0x31')],_0x10d121[_0xfcef('0x34')]);_0x1a2e29[_0xfcef('0x35')]=_['intersection'](_0x10d121['model'],qs[_0xfcef('0x36')](_0x1dada5[_0xfcef('0x34')]['fields']));_0x1a2e29['attributes']=_0x1a2e29['attributes'][_0xfcef('0x37')]?_0x1a2e29[_0xfcef('0x35')]:_0x10d121[_0xfcef('0x31')];if(!_0x1dada5[_0xfcef('0x34')][_0xfcef('0x38')](_0xfcef('0x39'))){_0x1a2e29[_0xfcef('0x1f')]=qs[_0xfcef('0x1f')](_0x1dada5['query'][_0xfcef('0x1f')]);_0x1a2e29['offset']=qs['offset'](_0x1dada5[_0xfcef('0x34')][_0xfcef('0x1c')]);}_0x1a2e29['order']=qs[_0xfcef('0x3a')](_0x1dada5[_0xfcef('0x34')][_0xfcef('0x3a')]);_0x1a2e29[_0xfcef('0x3b')]=qs[_0xfcef('0x3c')](_[_0xfcef('0x3d')](_0x1dada5[_0xfcef('0x34')],_0x10d121['filters']),_0x2840da);if(_0x1dada5['query']['filter']){_0x1a2e29[_0xfcef('0x3b')]=_['merge'](_0x1a2e29['where'],{'$or':_[_0xfcef('0x32')](_0x2840da,function(_0x1496d1){if(_0x1496d1['type']!==_0xfcef('0x3e')){var _0x1e8ab1={};_0x1e8ab1[_0x1496d1[_0xfcef('0x2b')]]={'$like':'%'+_0x1dada5[_0xfcef('0x34')][_0xfcef('0x3f')]+'%'};return _0x1e8ab1;}})});}_0x1a2e29=_[_0xfcef('0x40')]({},_0x1a2e29,_0x1dada5[_0xfcef('0x41')]);var _0x4ef584={'where':_0x1a2e29['where']};return db[_0xfcef('0x2d')][_0xfcef('0x1e')](_0x4ef584)[_0xfcef('0x25')](function(_0x23c44c){_0x31cf07[_0xfcef('0x1e')]=_0x23c44c;if(_0x1dada5['query'][_0xfcef('0x42')]){_0x1a2e29[_0xfcef('0x43')]=[{'all':!![]}];}return db[_0xfcef('0x2d')][_0xfcef('0x44')](_0x1a2e29);})[_0xfcef('0x25')](function(_0x240008){_0x31cf07[_0xfcef('0x45')]=_0x240008;return _0x31cf07;})[_0xfcef('0x25')](respondWithFilteredResult(_0xc677a2,_0x1a2e29))['catch'](handleError(_0xc677a2,null));};exports[_0xfcef('0x46')]=function(_0x303129,_0x128a81){var _0x559be7={'raw':![],'where':{'id':_0x303129[_0xfcef('0x47')]['id']}},_0x515ae4={};_0x515ae4[_0xfcef('0x31')]=_[_0xfcef('0x33')](db[_0xfcef('0x2d')][_0xfcef('0x48')]);_0x515ae4[_0xfcef('0x34')]=_[_0xfcef('0x33')](_0x303129[_0xfcef('0x34')]);_0x515ae4[_0xfcef('0x3c')]=_[_0xfcef('0x49')](_0x515ae4['model'],_0x515ae4[_0xfcef('0x34')]);_0x559be7['attributes']=_[_0xfcef('0x49')](_0x515ae4[_0xfcef('0x31')],qs[_0xfcef('0x36')](_0x303129[_0xfcef('0x34')]['fields']));_0x559be7[_0xfcef('0x35')]=_0x559be7['attributes']['length']?_0x559be7[_0xfcef('0x35')]:_0x515ae4[_0xfcef('0x31')];if(_0x303129[_0xfcef('0x34')]['includeAll']){_0x559be7['include']=[{'all':!![]}];}_0x559be7=_[_0xfcef('0x40')]({},_0x559be7,_0x303129[_0xfcef('0x41')]);return db['AnalyticCustomReport'][_0xfcef('0x4a')](_0x559be7)['then'](handleEntityNotFound(_0x128a81,null))[_0xfcef('0x25')](respondWithResult(_0x128a81,null))['catch'](handleError(_0x128a81,null));};exports['create']=function(_0x59c0ea,_0x5014ed){return db[_0xfcef('0x2d')][_0xfcef('0x4b')](_0x59c0ea[_0xfcef('0x4c')],{})[_0xfcef('0x25')](function(_0x2f3dc6){var _0x52440d=_0x59c0ea['user'][_0xfcef('0x27')]({'plain':!![]});if(!_0x52440d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x52440d['role']==='user'){var _0x2c429d=_0x2f3dc6[_0xfcef('0x27')]({'plain':!![]});var _0x12186e='Reports';return db['UserProfileSection'][_0xfcef('0x4a')]({'where':{'name':_0x12186e,'userProfileId':_0x52440d[_0xfcef('0x4d')]},'raw':!![]})[_0xfcef('0x25')](function(_0x5e5108){if(_0x5e5108&&_0x5e5108['autoAssociation']===0x0){return db[_0xfcef('0x29')]['create']({'name':_0x2c429d[_0xfcef('0x2b')],'resourceId':_0x2c429d['id'],'type':'CustomReports','sectionId':_0x5e5108['id']},{})[_0xfcef('0x25')](function(){return _0x2f3dc6;});}else{return _0x2f3dc6;}})[_0xfcef('0x4e')](function(_0x331d3b){logger[_0xfcef('0x4f')](_0xfcef('0x50'),_0x331d3b);throw _0x331d3b;});}return _0x2f3dc6;})[_0xfcef('0x25')](respondWithResult(_0x5014ed,0xc9))[_0xfcef('0x4e')](handleError(_0x5014ed,null));};exports[_0xfcef('0x24')]=function(_0x20cc47,_0x3a2f1d){if(_0x20cc47['body']['id']){delete _0x20cc47[_0xfcef('0x4c')]['id'];}return db[_0xfcef('0x2d')][_0xfcef('0x4a')]({'where':{'id':_0x20cc47[_0xfcef('0x47')]['id']}})[_0xfcef('0x25')](handleEntityNotFound(_0x3a2f1d,null))['then'](saveUpdates(_0x20cc47['body'],null))['then'](respondWithResult(_0x3a2f1d,null))['catch'](handleError(_0x3a2f1d,null));};exports[_0xfcef('0x26')]=function(_0x19d984,_0x392296){return db[_0xfcef('0x2d')][_0xfcef('0x4a')]({'where':{'id':_0x19d984[_0xfcef('0x47')]['id']}})[_0xfcef('0x25')](handleEntityNotFound(_0x392296,null))['then'](removeEntity(_0x392296,null))[_0xfcef('0x4e')](handleError(_0x392296,null));};exports[_0xfcef('0x51')]=function(_0x4873c5,_0x3dc98b){var _0x48d05a=0xa;var _0x39e7cd=[_0xfcef('0x52'),'left_join',_0xfcef('0x53'),'cross_join'];var _0x2e3258={'SUM':'SUM(%s)','COUNT':_0xfcef('0x54'),'COUNT DISTINCT':_0xfcef('0x55'),'MAX':'MAX(%s)','MIN':_0xfcef('0x56'),'AVG':_0xfcef('0x57'),'GROUP_CONCAT':_0xfcef('0x58'),'GROUP_CONCAT ASC':_0xfcef('0x59'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x583b85={'SEC_TO_TIME':_0xfcef('0x5a'),'DATE':'DATE(%s)','HOUR':_0xfcef('0x5b'),'ROUND':_0xfcef('0x5c'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4040e2=function(_0x516d91){return!_[_0xfcef('0x5d')]([_0xfcef('0x5e'),_0xfcef('0x5f'),_0xfcef('0x60'),_0xfcef('0x61')],_0x516d91);};var _0x78eaf4=function(_0x19a2bc){if(!_0x19a2bc||!_0x19a2bc[_0xfcef('0x62')][_0xfcef('0x37')]){return'';}for(var _0x2d408d='(',_0xd9d927=0x0;_0xd9d927<_0x19a2bc[_0xfcef('0x62')][_0xfcef('0x37')];_0xd9d927+=0x1){_0xd9d927>0x0&&(_0x2d408d+='\x20'+_0x19a2bc[_0xfcef('0x63')]+'\x20');_0x2d408d+=_0x19a2bc[_0xfcef('0x62')][_0xd9d927][_0xfcef('0x64')]?_0x78eaf4(_0x19a2bc['rules'][_0xd9d927][_0xfcef('0x64')]):_0x19a2bc['rules'][_0xd9d927][_0xfcef('0x65')]+'\x20'+_0x19a2bc[_0xfcef('0x62')][_0xd9d927][_0xfcef('0x66')]+(_0x4040e2(_0x19a2bc[_0xfcef('0x62')][_0xd9d927][_0xfcef('0x66')])?'\x20'+_0x19a2bc[_0xfcef('0x62')][_0xd9d927][_0xfcef('0x67')]:'');}return _0x2d408d+')';};var _0x4818f3={'where':{'id':_0x4873c5[_0xfcef('0x47')]['id']}},_0x4a3e93,_0x400c50,_0x450b12,_0x1f13c8,_0x9bd881;_0x4818f3=_['merge']({},_0x4818f3,_0x4873c5['options']);return db[_0xfcef('0x2d')][_0xfcef('0x4a')](_0x4818f3)['then'](function(_0x2b727c){if(_0x2b727c){_0x4a3e93=_0x2b727c;return _0x2b727c[_0xfcef('0x68')]();}return null;})[_0xfcef('0x25')](function(_0x1a87c5){if(_0x1a87c5){if(!_0x1a87c5[_0xfcef('0x37')]){throw new db[(_0xfcef('0x69'))][(_0xfcef('0x6a'))](_0xfcef('0x6b'),0x193);}_0x400c50=_0x1a87c5;return db[_0xfcef('0x6c')]['findAll']({'raw':!![]});}return null;})[_0xfcef('0x25')](function(_0x1084a9){if(_0x1084a9){_0x450b12=_[_0xfcef('0x6d')](_0x1084a9,'id');var _0x2e2420;var _0x37fffa=squel[_0xfcef('0x6e')]();_0x37fffa[_0xfcef('0x6f')](_0x4a3e93[_0xfcef('0x70')]);for(var _0x3d7601=0x0;_0x3d7601<_0x400c50[_0xfcef('0x37')];_0x3d7601+=0x1){_0x2e2420=_0x400c50[_0x3d7601]['MetricId']?_0x450b12[_0x400c50[_0x3d7601]['MetricId']][_0xfcef('0x71')]:_0x400c50[_0x3d7601][_0xfcef('0x65')];_0x2e2420=_0x400c50[_0x3d7601]['function']?_[_0xfcef('0x72')](_0x2e3258[_0x400c50[_0x3d7601][_0xfcef('0x73')]],'%s',_0x2e2420):_0x2e2420;_0x2e2420=_0x400c50[_0x3d7601][_0xfcef('0x74')]?_[_0xfcef('0x72')](_0x583b85[_0x400c50[_0x3d7601][_0xfcef('0x74')]],'%s',_0x2e2420):_0x2e2420;if(_0x400c50[_0x3d7601][_0xfcef('0x75')]){_0x37fffa[_0xfcef('0x64')](_0x2e2420);}_0x400c50[_0x3d7601][_0xfcef('0x76')]&&_0x37fffa[_0xfcef('0x77')](_0x2e2420,_0x400c50[_0x3d7601][_0xfcef('0x76')]===_0xfcef('0x78')?![]:!![]);_0x37fffa[_0xfcef('0x65')](_0x2e2420,_0x400c50[_0x3d7601][_0xfcef('0x79')]||_0x2e2420);}if(_0x4a3e93[_0xfcef('0x7a')]){_0x4a3e93[_0xfcef('0x7a')]=JSON[_0xfcef('0x7b')](_0x4a3e93[_0xfcef('0x7a')]);for(var _0x11e5ac=0x0;_0x11e5ac<_0x4a3e93[_0xfcef('0x7a')][_0xfcef('0x37')];_0x11e5ac+=0x1){if(_0x4a3e93[_0xfcef('0x7a')][_0x11e5ac][_0xfcef('0x2f')]&&_[_0xfcef('0x5d')](_0x39e7cd,_0x4a3e93[_0xfcef('0x7a')][_0x11e5ac][_0xfcef('0x2f')])&&_0x4a3e93['joins'][_0x11e5ac][_0xfcef('0x7c')]&&_0x4a3e93[_0xfcef('0x7a')][_0x11e5ac][_0xfcef('0x7d')]&&_0x4a3e93['joins'][_0x11e5ac]['foreignKey']){_0x37fffa[_0x4a3e93[_0xfcef('0x7a')][_0x11e5ac]['type']](_0x4a3e93[_0xfcef('0x7a')][_0x11e5ac][_0xfcef('0x7d')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x4a3e93[_0xfcef('0x70')],_0x4a3e93[_0xfcef('0x7a')][_0x11e5ac]['parentKey'],_0x4a3e93[_0xfcef('0x7a')][_0x11e5ac][_0xfcef('0x7d')],_0x4a3e93[_0xfcef('0x7a')][_0x11e5ac][_0xfcef('0x7e')]));}}}if(_0x4a3e93[_0xfcef('0x7f')]){_0x4a3e93[_0xfcef('0x7f')]=JSON[_0xfcef('0x7b')](_0x4a3e93[_0xfcef('0x7f')]);_0x37fffa[_0xfcef('0x3b')](_0x78eaf4(_0x4a3e93['conditions'][_0xfcef('0x64')]));}_0x9bd881=_0x37fffa[_0xfcef('0x80')]();_0x37fffa[_0xfcef('0x1f')](_0x48d05a);_0x37fffa['offset'](0x0);logger['debug'](_0xfcef('0x81'),_0x37fffa[_0xfcef('0x82')]());return dbH[_0xfcef('0x83')][_0xfcef('0x34')](_0x37fffa[_0xfcef('0x82')](),{'type':dbH['sequelize'][_0xfcef('0x84')]['SELECT']});}})['then'](respondWithResult(_0x3dc98b,null))[_0xfcef('0x4e')](handleError(_0x3dc98b,null));};function runReport(_0x51a700,_0x42b9b9,_0x2e232e){var _0x12af18=_0x42b9b9[_0xfcef('0x2b')];var _0x207e66=0xa;var _0x5c0030=[_0xfcef('0x52'),_0xfcef('0x85'),_0xfcef('0x53'),_0xfcef('0x86')];var _0x432719={'SUM':_0xfcef('0x87'),'COUNT':_0xfcef('0x54'),'COUNT DISTINCT':_0xfcef('0x55'),'MAX':_0xfcef('0x88'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xfcef('0x89')};var _0x5bb62c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xfcef('0x5b'),'ROUND':_0xfcef('0x5c'),'UNIX_TIMESTAMP':_0xfcef('0x8a')};var _0x19ab04=function(_0xcfba98){return!_[_0xfcef('0x5d')]([_0xfcef('0x5e'),_0xfcef('0x5f'),_0xfcef('0x60'),'IS\x20NOT\x20EMPTY'],_0xcfba98);};var _0x5480dc=function(_0x14d65e){if(!_0x14d65e||!_0x14d65e[_0xfcef('0x62')][_0xfcef('0x37')]){return'';}for(var _0x4ff2dc='(',_0x499471=0x0;_0x499471<_0x14d65e[_0xfcef('0x62')]['length'];_0x499471+=0x1){_0x499471>0x0&&(_0x4ff2dc+='\x20'+_0x14d65e['operator']+'\x20');_0x4ff2dc+=_0x14d65e['rules'][_0x499471][_0xfcef('0x64')]?_0x5480dc(_0x14d65e[_0xfcef('0x62')][_0x499471]['group']):_0x14d65e[_0xfcef('0x62')][_0x499471][_0xfcef('0x65')]+'\x20'+_0x14d65e[_0xfcef('0x62')][_0x499471][_0xfcef('0x66')]+(_0x19ab04(_0x14d65e[_0xfcef('0x62')][_0x499471][_0xfcef('0x66')])?'\x20'+_0x14d65e[_0xfcef('0x62')][_0x499471][_0xfcef('0x67')]:'');}return _0x4ff2dc+')';};var _0x403d45={'where':{'id':_0x51a700['id']}},_0x5548d5,_0x3d6b1b,_0x2c4a5f,_0x4e6aa4,_0x189836;_0x403d45=_['merge']({},_0x403d45,_0x2e232e);return db[_0xfcef('0x2d')][_0xfcef('0x4a')](_0x403d45)[_0xfcef('0x25')](function(_0x548d4f){if(_0x548d4f){_0x5548d5=_0x548d4f;return _0x548d4f[_0xfcef('0x68')]();}return null;})[_0xfcef('0x25')](function(_0x539bfa){if(_0x539bfa){if(!_0x539bfa[_0xfcef('0x37')]){throw new db[(_0xfcef('0x69'))][(_0xfcef('0x6a'))](_0xfcef('0x6b'),0x193);}_0x3d6b1b=_0x539bfa;return db[_0xfcef('0x6c')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x434976){if(_0x434976){_0x2c4a5f=_['keyBy'](_0x434976,'id');var _0x200549;var _0x48b0d1=squel[_0xfcef('0x6e')]();_0x48b0d1[_0xfcef('0x6f')](_0x5548d5[_0xfcef('0x70')]);for(var _0x15b836=0x0;_0x15b836<_0x3d6b1b[_0xfcef('0x37')];_0x15b836+=0x1){_0x200549=_0x3d6b1b[_0x15b836]['MetricId']?_0x2c4a5f[_0x3d6b1b[_0x15b836][_0xfcef('0x8b')]]['metric']:_0x3d6b1b[_0x15b836][_0xfcef('0x65')];_0x200549=_0x3d6b1b[_0x15b836][_0xfcef('0x73')]?_[_0xfcef('0x72')](_0x432719[_0x3d6b1b[_0x15b836][_0xfcef('0x73')]],'%s',_0x200549):_0x200549;_0x200549=_0x3d6b1b[_0x15b836][_0xfcef('0x74')]?_[_0xfcef('0x72')](_0x5bb62c[_0x3d6b1b[_0x15b836][_0xfcef('0x74')]],'%s',_0x200549):_0x200549;if(_0x3d6b1b[_0x15b836]['groupBy']){_0x48b0d1['group'](_0x200549);}_0x3d6b1b[_0x15b836][_0xfcef('0x76')]&&_0x48b0d1[_0xfcef('0x77')](_0x200549,_0x3d6b1b[_0x15b836][_0xfcef('0x76')]===_0xfcef('0x78')?![]:!![]);_0x48b0d1[_0xfcef('0x65')](_0x200549,_0x3d6b1b[_0x15b836][_0xfcef('0x79')]||_0x200549);}if(_0x5548d5[_0xfcef('0x7a')]){_0x5548d5[_0xfcef('0x7a')]=JSON['parse'](_0x5548d5['joins']);for(var _0x4cb967=0x0;_0x4cb967<_0x5548d5[_0xfcef('0x7a')][_0xfcef('0x37')];_0x4cb967+=0x1){if(_0x5548d5['joins'][_0x4cb967][_0xfcef('0x2f')]&&_['includes'](_0x5c0030,_0x5548d5['joins'][_0x4cb967]['type'])&&_0x5548d5[_0xfcef('0x7a')][_0x4cb967][_0xfcef('0x7c')]&&_0x5548d5[_0xfcef('0x7a')][_0x4cb967][_0xfcef('0x7d')]&&_0x5548d5[_0xfcef('0x7a')][_0x4cb967]['foreignKey']){_0x48b0d1[_0x5548d5[_0xfcef('0x7a')][_0x4cb967][_0xfcef('0x2f')]](_0x5548d5[_0xfcef('0x7a')][_0x4cb967][_0xfcef('0x7d')],null,util[_0xfcef('0x74')]('%s.%s\x20=\x20%s.%s',_0x5548d5[_0xfcef('0x70')],_0x5548d5[_0xfcef('0x7a')][_0x4cb967][_0xfcef('0x7c')],_0x5548d5['joins'][_0x4cb967][_0xfcef('0x7d')],_0x5548d5[_0xfcef('0x7a')][_0x4cb967]['foreignKey']));}}}if(_0x5548d5[_0xfcef('0x7f')]){_0x5548d5[_0xfcef('0x7f')]=JSON[_0xfcef('0x7b')](_0x5548d5['conditions']);_0x48b0d1['where'](_0x5480dc(_0x5548d5[_0xfcef('0x7f')][_0xfcef('0x64')]));}_0x189836=_0x48b0d1[_0xfcef('0x80')]();_0x48b0d1['limit'](_0x207e66);_0x48b0d1['offset'](0x0);return;}})[_0xfcef('0x25')](function(){if(_0x42b9b9['output']===_0xfcef('0x8c')){return null;}var _0x24ef3b=_['merge'](_0x42b9b9,{'name':_0x42b9b9[_0xfcef('0x8d')]||_0x42b9b9[_0xfcef('0x2b')]||_0x5548d5[_0xfcef('0x2b')],'basename':_0x12af18,'savename':util['format'](_0xfcef('0x8e'),_0x42b9b9[_0xfcef('0x2b')]||_0x5548d5[_0xfcef('0x2b')],require('randomstring')[_0xfcef('0x8f')](0x4),_0x42b9b9[_0xfcef('0x90')]||_0xfcef('0x91')),'reportId':_0x5548d5['id'],'reportType':_0xfcef('0x92')});return db['AnalyticExtractedReport'][_0xfcef('0x4b')](_0x24ef3b,{'raw':!![]});})[_0xfcef('0x25')](function(_0x48aea3){if(_0x5548d5[_0xfcef('0x70')]===_0xfcef('0x93')){_0x189836[_0xfcef('0x3b')](_0x5548d5['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x42b9b9[_0xfcef('0x94')],_0x42b9b9[_0xfcef('0x95')]);}else{_0x189836[_0xfcef('0x3b')](_0x5548d5[_0xfcef('0x70')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x42b9b9[_0xfcef('0x94')],_0x42b9b9['endDate']);}if(_0x48aea3){logger['info'](_0xfcef('0x96'),_0x189836[_0xfcef('0x82')]());require(_0xfcef('0x97'))['fork'](path['join'](__dirname,_0xfcef('0x98'),_0x48aea3[_0xfcef('0x90')]),[_0x48aea3['id'],_0x189836[_0xfcef('0x82')](),path[_0xfcef('0x52')](__dirname,_0xfcef('0x99'),_0x48aea3[_0xfcef('0x9a')]),_0x12af18]);return _0x48aea3;}else{var _0x2ced8a=squel[_0xfcef('0x6e')]();_0x2ced8a[_0xfcef('0x6f')]('('+_0x189836[_0xfcef('0x82')]()+')',_0xfcef('0x9b'));_0x2ced8a[_0xfcef('0x65')](_0xfcef('0x9c'),_0xfcef('0x1e'));_0x189836[_0xfcef('0x1f')](_0x42b9b9[_0xfcef('0x1f')]||_0x207e66);_0x189836[_0xfcef('0x1c')](_0x42b9b9[_0xfcef('0x1c')]||0x0);return dbH[_0xfcef('0x83')][_0xfcef('0x34')](_0x2ced8a[_0xfcef('0x82')](),{'type':dbH[_0xfcef('0x83')][_0xfcef('0x84')][_0xfcef('0x9d')]})[_0xfcef('0x25')](function(_0x390d87){if(!_0x390d87['length']){_0x4e6aa4=0x0;}else{_0x4e6aa4=_0x390d87[0x0][_0xfcef('0x1e')]||0x0;}return dbH['sequelize'][_0xfcef('0x34')](_0x189836['toString'](),{'type':dbH[_0xfcef('0x83')][_0xfcef('0x84')][_0xfcef('0x9d')]});})[_0xfcef('0x25')](function(_0x1a15bc){return{'rows':_0x1a15bc||[],'count':_0x4e6aa4};});}});}exports['run']=function(_0xe7d43e,_0x311f4a){return runReport(_0xe7d43e[_0xfcef('0x47')],_0xe7d43e[_0xfcef('0x34')],_0xe7d43e[_0xfcef('0x41')])[_0xfcef('0x25')](respondWithResult(_0x311f4a,null))[_0xfcef('0x4e')](handleError(_0x311f4a,null));};exports['runReport']=runReport;exports[_0xfcef('0x34')]=function(_0x3413dc,_0x5e0eb1){var _0x4fef91=0xa;var _0x2e5ab1=[_0xfcef('0x52'),_0xfcef('0x85'),_0xfcef('0x53'),'cross_join'];var _0x30622a={'SUM':_0xfcef('0x87'),'COUNT':_0xfcef('0x54'),'COUNT DISTINCT':_0xfcef('0x55'),'MAX':_0xfcef('0x88'),'MIN':_0xfcef('0x56'),'AVG':_0xfcef('0x57'),'GROUP_CONCAT':_0xfcef('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x474dde={'SEC_TO_TIME':_0xfcef('0x5a'),'DATE':_0xfcef('0x9e'),'HOUR':_0xfcef('0x5b'),'ROUND':_0xfcef('0x5c'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x552a79=function(_0x162a2e){return!_[_0xfcef('0x5d')]([_0xfcef('0x5e'),_0xfcef('0x5f'),_0xfcef('0x60'),'IS\x20NOT\x20EMPTY'],_0x162a2e);};var _0x3b163a=function(_0xa29368){if(!_0xa29368||!_0xa29368['rules'][_0xfcef('0x37')]){return'';}for(var _0x45e05f='(',_0x4b839d=0x0;_0x4b839d<_0xa29368[_0xfcef('0x62')][_0xfcef('0x37')];_0x4b839d+=0x1){_0x4b839d>0x0&&(_0x45e05f+='\x20'+_0xa29368['operator']+'\x20');_0x45e05f+=_0xa29368['rules'][_0x4b839d][_0xfcef('0x64')]?_0x3b163a(_0xa29368[_0xfcef('0x62')][_0x4b839d][_0xfcef('0x64')]):_0xa29368['rules'][_0x4b839d][_0xfcef('0x65')]+'\x20'+_0xa29368[_0xfcef('0x62')][_0x4b839d][_0xfcef('0x66')]+(_0x552a79(_0xa29368[_0xfcef('0x62')][_0x4b839d][_0xfcef('0x66')])?'\x20'+_0xa29368[_0xfcef('0x62')][_0x4b839d][_0xfcef('0x67')]:'');}return _0x45e05f+')';};var _0x50bec2={'where':{'id':_0x3413dc[_0xfcef('0x47')]['id']}},_0xd29185,_0x45dc86,_0x2f5a99,_0x182085,_0x24c580;_0x50bec2=_[_0xfcef('0x40')]({},_0x50bec2,_0x3413dc['options']);return db[_0xfcef('0x2d')][_0xfcef('0x4a')](_0x50bec2)[_0xfcef('0x25')](function(_0x1fce6b){if(_0x1fce6b){_0xd29185=_0x1fce6b;return _0x1fce6b[_0xfcef('0x68')]();}return null;})[_0xfcef('0x25')](function(_0x596499){if(_0x596499){if(!_0x596499['length']){throw new db[(_0xfcef('0x69'))][(_0xfcef('0x6a'))](_0xfcef('0x6b'),0x193);}_0x45dc86=_0x596499;return db[_0xfcef('0x6c')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x18f582){if(_0x18f582){_0x2f5a99=_['keyBy'](_0x18f582,'id');var _0x1e41ae;var _0x235173=squel['select']();_0x235173['from'](_0xd29185[_0xfcef('0x70')]);for(var _0x3a9ab4=0x0;_0x3a9ab4<_0x45dc86[_0xfcef('0x37')];_0x3a9ab4+=0x1){_0x1e41ae=_0x45dc86[_0x3a9ab4][_0xfcef('0x8b')]?_0x2f5a99[_0x45dc86[_0x3a9ab4][_0xfcef('0x8b')]][_0xfcef('0x71')]:_0x45dc86[_0x3a9ab4]['field'];_0x1e41ae=_0x45dc86[_0x3a9ab4][_0xfcef('0x73')]?_[_0xfcef('0x72')](_0x30622a[_0x45dc86[_0x3a9ab4][_0xfcef('0x73')]],'%s',_0x1e41ae):_0x1e41ae;_0x1e41ae=_0x45dc86[_0x3a9ab4][_0xfcef('0x74')]?_[_0xfcef('0x72')](_0x474dde[_0x45dc86[_0x3a9ab4][_0xfcef('0x74')]],'%s',_0x1e41ae):_0x1e41ae;if(_0x45dc86[_0x3a9ab4][_0xfcef('0x75')]){_0x235173[_0xfcef('0x64')](_0x1e41ae);}_0x45dc86[_0x3a9ab4][_0xfcef('0x76')]&&_0x235173[_0xfcef('0x77')](_0x1e41ae,_0x45dc86[_0x3a9ab4][_0xfcef('0x76')]===_0xfcef('0x78')?![]:!![]);_0x235173[_0xfcef('0x65')](_0x1e41ae,_0x45dc86[_0x3a9ab4][_0xfcef('0x79')]||_0x1e41ae);}if(_0xd29185[_0xfcef('0x7a')]){_0xd29185['joins']=JSON[_0xfcef('0x7b')](_0xd29185[_0xfcef('0x7a')]);for(var _0x3d4020=0x0;_0x3d4020<_0xd29185[_0xfcef('0x7a')][_0xfcef('0x37')];_0x3d4020+=0x1){if(_0xd29185['joins'][_0x3d4020][_0xfcef('0x2f')]&&_[_0xfcef('0x5d')](_0x2e5ab1,_0xd29185['joins'][_0x3d4020][_0xfcef('0x2f')])&&_0xd29185[_0xfcef('0x7a')][_0x3d4020][_0xfcef('0x7c')]&&_0xd29185[_0xfcef('0x7a')][_0x3d4020][_0xfcef('0x7d')]&&_0xd29185[_0xfcef('0x7a')][_0x3d4020]['foreignKey']){_0x235173[_0xd29185[_0xfcef('0x7a')][_0x3d4020][_0xfcef('0x2f')]](_0xd29185[_0xfcef('0x7a')][_0x3d4020]['foreignTable'],null,util['format'](_0xfcef('0x9f'),_0xd29185[_0xfcef('0x70')],_0xd29185['joins'][_0x3d4020]['parentKey'],_0xd29185['joins'][_0x3d4020]['foreignTable'],_0xd29185[_0xfcef('0x7a')][_0x3d4020][_0xfcef('0x7e')]));}}}if(_0xd29185[_0xfcef('0x7f')]){_0xd29185[_0xfcef('0x7f')]=JSON[_0xfcef('0x7b')](_0xd29185[_0xfcef('0x7f')]);_0x235173[_0xfcef('0x3b')](_0x3b163a(_0xd29185[_0xfcef('0x7f')][_0xfcef('0x64')]));}_0x24c580=_0x235173[_0xfcef('0x80')]();_0x235173['limit'](_0x4fef91);_0x235173['offset'](0x0);logger[_0xfcef('0xa0')](_0xfcef('0x81'),_0x235173[_0xfcef('0x82')]());return dbH[_0xfcef('0x83')]['query'](_0x235173[_0xfcef('0x82')](),{'type':dbH[_0xfcef('0x83')][_0xfcef('0x84')][_0xfcef('0x9d')]});}})[_0xfcef('0x25')](function(){return{'sql':_0x24c580[_0xfcef('0x82')]()};})[_0xfcef('0x25')](respondWithResult(_0x5e0eb1,null))['catch'](handleError(_0x5e0eb1,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 82a9055..8dc386d 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 _0x83f0=['AnalyticCustomReport','analytics_custom_reports','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x47dec4,_0x3efca2){var _0x531676=function(_0x5689b9){while(--_0x5689b9){_0x47dec4['push'](_0x47dec4['shift']());}};_0x531676(++_0x3efca2);}(_0x83f0,0x176));var _0x083f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x83f0[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x083f('0x0'));var util=require(_0x083f('0x1'));var logger=require('../../config/logger')(_0x083f('0x2'));var moment=require(_0x083f('0x3'));var BPromise=require('bluebird');var rp=require(_0x083f('0x4'));var fs=require('fs');var path=require(_0x083f('0x5'));var rimraf=require(_0x083f('0x6'));var config=require(_0x083f('0x7'));var attributes=require('./analyticCustomReport.attributes');module[_0x083f('0x8')]=function(_0x3c84be,_0x3a2c1b){return _0x3c84be[_0x083f('0x9')](_0x083f('0xa'),attributes,{'tableName':_0x083f('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd129=['exports','analytics_custom_reports','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x463683,_0x403c60){var _0x1c7fa1=function(_0x224c11){while(--_0x224c11){_0x463683['push'](_0x463683['shift']());}};_0x1c7fa1(++_0x403c60);}(_0xd129,0x134));var _0x9d12=function(_0x32594b,_0x528a37){_0x32594b=_0x32594b-0x0;var _0x86c97=_0xd129[_0x32594b];return _0x86c97;};'use strict';var _=require(_0x9d12('0x0'));var util=require('util');var logger=require(_0x9d12('0x1'))(_0x9d12('0x2'));var moment=require(_0x9d12('0x3'));var BPromise=require(_0x9d12('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9d12('0x5'));var rimraf=require(_0x9d12('0x6'));var config=require('../../config/environment');var attributes=require('./analyticCustomReport.attributes');module[_0x9d12('0x7')]=function(_0x44df39,_0x4ce38c){return _0x44df39['define']('AnalyticCustomReport',attributes,{'tableName':_0x9d12('0x8'),'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 b5aebac..5916de3 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 _0xb80d=['request\x20sent','moment','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','http','then','AnalyticCustomReport,\x20%s,\x20%s','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info'];(function(_0xd8203d,_0x454961){var _0x1a1430=function(_0x17d837){while(--_0x17d837){_0xd8203d['push'](_0xd8203d['shift']());}};_0x1a1430(++_0x454961);}(_0xb80d,0x155));var _0xdb80=function(_0x1e9424,_0x191cba){_0x1e9424=_0x1e9424-0x0;var _0x1bd96c=_0xb80d[_0x1e9424];return _0x1bd96c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xdb80('0x0'));var BPromise=require(_0xdb80('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdb80('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdb80('0x3'))('rpc');var config=require(_0xdb80('0x4'));var jayson=require(_0xdb80('0x5'));var client=jayson['client'][_0xdb80('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x514e7b,_0x496ec7,_0x5e3fb7){return new BPromise(function(_0x1a855,_0x13e1bc){return client['request'](_0x514e7b,_0x5e3fb7)[_0xdb80('0x7')](function(_0x6a56bb){logger['info'](_0xdb80('0x8'),_0x496ec7,'request\x20sent');logger[_0xdb80('0x9')](_0xdb80('0xa'),_0x496ec7,'request\x20sent',JSON[_0xdb80('0xb')](_0x6a56bb));if(_0x6a56bb['error']){if(_0x6a56bb['error'][_0xdb80('0xc')]===0x1f4){logger[_0xdb80('0xd')](_0xdb80('0x8'),_0x496ec7,_0x6a56bb[_0xdb80('0xd')][_0xdb80('0xe')]);return _0x13e1bc(_0x6a56bb[_0xdb80('0xd')][_0xdb80('0xe')]);}logger[_0xdb80('0xd')](_0xdb80('0x8'),_0x496ec7,_0x6a56bb[_0xdb80('0xd')]['message']);return _0x1a855(_0x6a56bb[_0xdb80('0xd')][_0xdb80('0xe')]);}else{logger[_0xdb80('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0x496ec7,_0xdb80('0x10'));_0x1a855(_0x6a56bb['result']['message']);}})['catch'](function(_0x522fc5){logger[_0xdb80('0xd')](_0xdb80('0x8'),_0x496ec7,_0x522fc5);_0x13e1bc(_0x522fc5);});});} \ No newline at end of file +var _0x9b51=['rpc','../../config/environment','http','request','info','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x497acd,_0x90d88){var _0xf8e61c=function(_0xf79d5d){while(--_0xf79d5d){_0x497acd['push'](_0x497acd['shift']());}};_0xf8e61c(++_0x90d88);}(_0x9b51,0xf5));var _0x19b5=function(_0x122da1,_0x158e84){_0x122da1=_0x122da1-0x0;var _0x273065=_0x9b51[_0x122da1];return _0x273065;};'use strict';var _=require(_0x19b5('0x0'));var util=require(_0x19b5('0x1'));var moment=require(_0x19b5('0x2'));var BPromise=require(_0x19b5('0x3'));var rs=require(_0x19b5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x19b5('0x5'));var logger=require(_0x19b5('0x6'))(_0x19b5('0x7'));var config=require(_0x19b5('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x19b5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21f004,_0x5b1637,_0x288cc0){return new BPromise(function(_0x28bc5a,_0x1b0ff7){return client[_0x19b5('0xa')](_0x21f004,_0x288cc0)['then'](function(_0x15bba2){logger[_0x19b5('0xb')]('AnalyticCustomReport,\x20%s,\x20%s',_0x5b1637,_0x19b5('0xc'));logger[_0x19b5('0xd')](_0x19b5('0xe'),_0x5b1637,_0x19b5('0xc'),JSON[_0x19b5('0xf')](_0x15bba2));if(_0x15bba2[_0x19b5('0x10')]){if(_0x15bba2[_0x19b5('0x10')][_0x19b5('0x11')]===0x1f4){logger[_0x19b5('0x10')](_0x19b5('0x12'),_0x5b1637,_0x15bba2[_0x19b5('0x10')]['message']);return _0x1b0ff7(_0x15bba2[_0x19b5('0x10')][_0x19b5('0x13')]);}logger[_0x19b5('0x10')](_0x19b5('0x12'),_0x5b1637,_0x15bba2[_0x19b5('0x10')][_0x19b5('0x13')]);return _0x28bc5a(_0x15bba2['error'][_0x19b5('0x13')]);}else{logger[_0x19b5('0xb')](_0x19b5('0x12'),_0x5b1637,_0x19b5('0xc'));_0x28bc5a(_0x15bba2['result'][_0x19b5('0x13')]);}})[_0x19b5('0x14')](function(_0x4cd530){logger[_0x19b5('0x10')](_0x19b5('0x12'),_0x5b1637,_0x4cd530);_0x1b0ff7(_0x4cd530);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index d4fad9a..db4ac21 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 _0x51f7=['run','/:id/query','query','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','isAuthenticated','get','/:id','show','/:id/preview','preview','/:id/run'];(function(_0x2fa371,_0x50a68b){var _0x36744a=function(_0x4650bc){while(--_0x4650bc){_0x2fa371['push'](_0x2fa371['shift']());}};_0x36744a(++_0x50a68b);}(_0x51f7,0x9f));var _0x751f=function(_0x489b87,_0xd51c93){_0x489b87=_0x489b87-0x0;var _0x1823b6=_0x51f7[_0x489b87];return _0x1823b6;};'use strict';var multer=require('multer');var util=require(_0x751f('0x0'));var path=require(_0x751f('0x1'));var timeout=require(_0x751f('0x2'));var express=require(_0x751f('0x3'));var router=express[_0x751f('0x4')]();var fs_extra=require(_0x751f('0x5'));var auth=require(_0x751f('0x6'));var interaction=require(_0x751f('0x7'));var config=require('../../config/environment');var controller=require(_0x751f('0x8'));router['get']('/',auth[_0x751f('0x9')](),controller['index']);router[_0x751f('0xa')](_0x751f('0xb'),auth[_0x751f('0x9')](),controller[_0x751f('0xc')]);router[_0x751f('0xa')](_0x751f('0xd'),auth[_0x751f('0x9')](),controller[_0x751f('0xe')]);router['get'](_0x751f('0xf'),auth[_0x751f('0x9')](),controller[_0x751f('0x10')]);router[_0x751f('0xa')](_0x751f('0x11'),auth['isAuthenticated'](),controller[_0x751f('0x12')]);router[_0x751f('0x13')]('/',auth[_0x751f('0x9')](),controller[_0x751f('0x14')]);router[_0x751f('0x15')](_0x751f('0xb'),auth[_0x751f('0x9')](),controller[_0x751f('0x16')]);router[_0x751f('0x17')](_0x751f('0xb'),auth[_0x751f('0x9')](),controller[_0x751f('0x18')]);module['exports']=router; \ No newline at end of file +var _0x9c69=['/:id/query','post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','preview','/:id/run','run'];(function(_0x57ed97,_0x149ea){var _0x9cb533=function(_0x5dd737){while(--_0x5dd737){_0x57ed97['push'](_0x57ed97['shift']());}};_0x9cb533(++_0x149ea);}(_0x9c69,0x14a));var _0x99c6=function(_0x23983a,_0x38947d){_0x23983a=_0x23983a-0x0;var _0x127ff1=_0x9c69[_0x23983a];return _0x127ff1;};'use strict';var multer=require(_0x99c6('0x0'));var util=require(_0x99c6('0x1'));var path=require(_0x99c6('0x2'));var timeout=require(_0x99c6('0x3'));var express=require(_0x99c6('0x4'));var router=express[_0x99c6('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x99c6('0x6'));var interaction=require(_0x99c6('0x7'));var config=require(_0x99c6('0x8'));var controller=require('./analyticCustomReport.controller');router[_0x99c6('0x9')]('/',auth[_0x99c6('0xa')](),controller['index']);router['get']('/:id',auth[_0x99c6('0xa')](),controller[_0x99c6('0xb')]);router[_0x99c6('0x9')]('/:id/preview',auth[_0x99c6('0xa')](),controller[_0x99c6('0xc')]);router['get'](_0x99c6('0xd'),auth[_0x99c6('0xa')](),controller[_0x99c6('0xe')]);router[_0x99c6('0x9')](_0x99c6('0xf'),auth[_0x99c6('0xa')](),controller['query']);router[_0x99c6('0x10')]('/',auth['isAuthenticated'](),controller[_0x99c6('0x11')]);router[_0x99c6('0x12')](_0x99c6('0x13'),auth[_0x99c6('0xa')](),controller[_0x99c6('0x14')]);router[_0x99c6('0x15')](_0x99c6('0x13'),auth[_0x99c6('0xa')](),controller[_0x99c6('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 859f2b8..bcd5b1c 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(_0x5aa9da,_0x2a08f4){var _0x412c52=function(_0xf23e19){while(--_0xf23e19){_0x5aa9da['push'](_0x5aa9da['shift']());}};_0x412c52(++_0x2a08f4);}(_0x3eea,0x1ca));var _0xa3ee=function(_0xf2f21e,_0x966cf2){_0xf2f21e=_0xf2f21e-0x0;var _0x1c5925=_0x3eea[_0xf2f21e];return _0x1c5925;};'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 _0x4819=['TEXT','exports','STRING'];(function(_0x16bb4b,_0x5fe431){var _0x8aeb84=function(_0x36ba6e){while(--_0x36ba6e){_0x16bb4b['push'](_0x16bb4b['shift']());}};_0x8aeb84(++_0x5fe431);}(_0x4819,0xcd));var _0x9481=function(_0x4df671,_0x12b67f){_0x4df671=_0x4df671-0x0;var _0x3f9658=_0x4819[_0x4df671];return _0x3f9658;};'use strict';var Sequelize=require('sequelize');module[_0x9481('0x0')]={'name':{'type':Sequelize[_0x9481('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x9481('0x1')]},'parent':{'type':Sequelize[_0x9481('0x1')]},'table':{'type':Sequelize[_0x9481('0x1')]},'conditions':{'type':Sequelize[_0x9481('0x2')]},'joins':{'type':Sequelize[_0x9481('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 91f7786..3134b3a 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 _0x6d38=['Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','select','countTable','COUNT(*)','sequelize','run','SEC_TO_TIME(%s)','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','limit','count','Content-Range','save','update','then','get','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','AnalyticDefaultReport','findAll','rows','show','keys','fields','find','catch','create','body','user','role','Reports','autoAssociation','UserProfileResource','DefaultReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20EMPTY','rules','operator','group','field','condition','value','getFields','ValidationErrorItem','AnalyticMetric','keyBy','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','debug','toString','QueryTypes','SELECT','left_join','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','DESC','%s.%s\x20=\x20%s.%s','output','web','fullPath','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','startDate','endDate','info'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x6d38,0x1ef));var _0x86d3=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x6d38[_0x36eaaa];return _0x461349;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x86d3('0x0'));var zipdir=require(_0x86d3('0x1'));var jsonpatch=require(_0x86d3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x86d3('0x3'));var Mustache=require('mustache');var util=require(_0x86d3('0x4'));var path=require(_0x86d3('0x5'));var sox=require(_0x86d3('0x6'));var csv=require('to-csv');var ejs=require(_0x86d3('0x7'));var fs=require('fs');var fs_extra=require(_0x86d3('0x8'));var _=require(_0x86d3('0x9'));var squel=require(_0x86d3('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x86d3('0xb'));var toCsv=require(_0x86d3('0xc'));var querystring=require(_0x86d3('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x86d3('0xe'));var qs=require(_0x86d3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x86d3('0x10'))(_0x86d3('0x11'));var utils=require('../../config/utils');var config=require(_0x86d3('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x86d3('0x13'))['db'];var dbH=require(_0x86d3('0x13'))[_0x86d3('0x14')];function respondWithStatusCode(_0x26d64c,_0xe1b3d7){_0xe1b3d7=_0xe1b3d7||0xcc;return function(_0x1b8d0a){if(_0x1b8d0a){return _0x26d64c[_0x86d3('0x15')](_0xe1b3d7);}return _0x26d64c[_0x86d3('0x16')](_0xe1b3d7)['end']();};}function respondWithResult(_0x1c1ba8,_0x1f35cf){_0x1f35cf=_0x1f35cf||0xc8;return function(_0x356e7d){if(_0x356e7d){return _0x1c1ba8[_0x86d3('0x16')](_0x1f35cf)[_0x86d3('0x17')](_0x356e7d);}};}function respondWithFilteredResult(_0x34fb3b,_0x1ff008){return function(_0x44436d){if(_0x44436d){var _0x53b437=typeof _0x1ff008[_0x86d3('0x18')]===_0x86d3('0x19')&&typeof _0x1ff008[_0x86d3('0x1a')]===_0x86d3('0x19');var _0x46feec=_0x44436d[_0x86d3('0x1b')];var _0x33e459=_0x53b437?0x0:_0x1ff008[_0x86d3('0x18')];var _0x9b76f2=_0x53b437?_0x44436d['count']:_0x1ff008[_0x86d3('0x18')]+_0x1ff008['limit'];var _0x6ced9e;if(_0x9b76f2>=_0x46feec){_0x9b76f2=_0x46feec;_0x6ced9e=0xc8;}else{_0x6ced9e=0xce;}_0x34fb3b['status'](_0x6ced9e);return _0x34fb3b['set'](_0x86d3('0x1c'),_0x33e459+'-'+_0x9b76f2+'/'+_0x46feec)[_0x86d3('0x17')](_0x44436d);}return null;};}function patchUpdates(_0x988066){return function(_0x1720ae){try{jsonpatch['apply'](_0x1720ae,_0x988066,!![]);}catch(_0x2901de){return BPromise['reject'](_0x2901de);}return _0x1720ae[_0x86d3('0x1d')]();};}function saveUpdates(_0x3fdf67,_0x1ce849){return function(_0x5b990d){if(_0x5b990d){return _0x5b990d[_0x86d3('0x1e')](_0x3fdf67)[_0x86d3('0x1f')](function(_0x1fa4ac){return _0x1fa4ac;});}return null;};}function removeEntity(_0x4bf5b8,_0x58ba51){return function(_0x26262a){if(_0x26262a){return _0x26262a['destroy']()[_0x86d3('0x1f')](function(){var _0x1bea5e=_0x26262a[_0x86d3('0x20')]({'plain':!![]});var _0x3c5fe4='DefaultReports';return db['UserProfileResource'][_0x86d3('0x21')]({'where':{'type':_0x3c5fe4,'resourceId':_0x1bea5e['id']}})[_0x86d3('0x1f')](function(){return _0x26262a;});})['then'](function(){_0x4bf5b8[_0x86d3('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42413c,_0x41e2f0){return function(_0x287b96){if(!_0x287b96){_0x42413c[_0x86d3('0x15')](0x194);}return _0x287b96;};}function handleError(_0x11a6fd,_0x14c9ff){_0x14c9ff=_0x14c9ff||0x1f4;return function(_0x1f203e){logger[_0x86d3('0x22')](_0x1f203e[_0x86d3('0x23')]);if(_0x1f203e[_0x86d3('0x24')]){delete _0x1f203e[_0x86d3('0x24')];}_0x11a6fd[_0x86d3('0x16')](_0x14c9ff)[_0x86d3('0x25')](_0x1f203e);};}exports[_0x86d3('0x26')]=function(_0x5b09f6,_0x120a0c){var _0x403be3={},_0x2bda35={},_0x31cefe={'count':0x0,'rows':[]};var _0x7709f0=_[_0x86d3('0x27')](db['AnalyticDefaultReport'][_0x86d3('0x28')],function(_0x5c71df){return{'name':_0x5c71df['fieldName'],'type':_0x5c71df[_0x86d3('0x29')][_0x86d3('0x2a')]};});_0x2bda35[_0x86d3('0x2b')]=_['map'](_0x7709f0,_0x86d3('0x24'));_0x2bda35[_0x86d3('0x2c')]=_['keys'](_0x5b09f6[_0x86d3('0x2c')]);_0x2bda35[_0x86d3('0x2d')]=_[_0x86d3('0x2e')](_0x2bda35[_0x86d3('0x2b')],_0x2bda35[_0x86d3('0x2c')]);_0x403be3[_0x86d3('0x2f')]=_[_0x86d3('0x2e')](_0x2bda35[_0x86d3('0x2b')],qs['fields'](_0x5b09f6['query']['fields']));_0x403be3[_0x86d3('0x2f')]=_0x403be3['attributes'][_0x86d3('0x30')]?_0x403be3['attributes']:_0x2bda35[_0x86d3('0x2b')];if(!_0x5b09f6[_0x86d3('0x2c')][_0x86d3('0x31')](_0x86d3('0x32'))){_0x403be3[_0x86d3('0x1a')]=qs[_0x86d3('0x1a')](_0x5b09f6[_0x86d3('0x2c')]['limit']);_0x403be3[_0x86d3('0x18')]=qs[_0x86d3('0x18')](_0x5b09f6['query'][_0x86d3('0x18')]);}_0x403be3[_0x86d3('0x33')]=qs[_0x86d3('0x34')](_0x5b09f6[_0x86d3('0x2c')]['sort']);_0x403be3[_0x86d3('0x35')]=qs[_0x86d3('0x2d')](_[_0x86d3('0x36')](_0x5b09f6['query'],_0x2bda35[_0x86d3('0x2d')]),_0x7709f0);if(_0x5b09f6[_0x86d3('0x2c')][_0x86d3('0x37')]){_0x403be3[_0x86d3('0x35')]=_[_0x86d3('0x38')](_0x403be3[_0x86d3('0x35')],{'$or':_[_0x86d3('0x27')](_0x7709f0,function(_0x436065){if(_0x436065['type']!==_0x86d3('0x39')){var _0x470978={};_0x470978[_0x436065[_0x86d3('0x24')]]={'$like':'%'+_0x5b09f6[_0x86d3('0x2c')]['filter']+'%'};return _0x470978;}})});}_0x403be3=_[_0x86d3('0x38')]({},_0x403be3,_0x5b09f6[_0x86d3('0x3a')]);var _0x6f72be={'where':_0x403be3[_0x86d3('0x35')]};return db['AnalyticDefaultReport']['count'](_0x6f72be)[_0x86d3('0x1f')](function(_0x4f422b){_0x31cefe['count']=_0x4f422b;if(_0x5b09f6[_0x86d3('0x2c')][_0x86d3('0x3b')]){_0x403be3[_0x86d3('0x3c')]=[{'all':!![]}];}return db[_0x86d3('0x3d')][_0x86d3('0x3e')](_0x403be3);})['then'](function(_0x2a5f6c){_0x31cefe[_0x86d3('0x3f')]=_0x2a5f6c;return _0x31cefe;})[_0x86d3('0x1f')](respondWithFilteredResult(_0x120a0c,_0x403be3))['catch'](handleError(_0x120a0c,null));};exports[_0x86d3('0x40')]=function(_0x810d10,_0x5dfae8){var _0x369f68={'raw':!![],'where':{'id':_0x810d10['params']['id']}},_0xcf6c9e={};_0xcf6c9e['model']=_['keys'](db[_0x86d3('0x3d')][_0x86d3('0x28')]);_0xcf6c9e[_0x86d3('0x2c')]=_[_0x86d3('0x41')](_0x810d10[_0x86d3('0x2c')]);_0xcf6c9e[_0x86d3('0x2d')]=_['intersection'](_0xcf6c9e[_0x86d3('0x2b')],_0xcf6c9e[_0x86d3('0x2c')]);_0x369f68['attributes']=_[_0x86d3('0x2e')](_0xcf6c9e[_0x86d3('0x2b')],qs[_0x86d3('0x42')](_0x810d10[_0x86d3('0x2c')][_0x86d3('0x42')]));_0x369f68[_0x86d3('0x2f')]=_0x369f68['attributes'][_0x86d3('0x30')]?_0x369f68[_0x86d3('0x2f')]:_0xcf6c9e['model'];if(_0x810d10[_0x86d3('0x2c')][_0x86d3('0x3b')]){_0x369f68[_0x86d3('0x3c')]=[{'all':!![]}];}_0x369f68=_[_0x86d3('0x38')]({},_0x369f68,_0x810d10[_0x86d3('0x3a')]);return db['AnalyticDefaultReport'][_0x86d3('0x43')](_0x369f68)[_0x86d3('0x1f')](handleEntityNotFound(_0x5dfae8,null))[_0x86d3('0x1f')](respondWithResult(_0x5dfae8,null))[_0x86d3('0x44')](handleError(_0x5dfae8,null));};exports[_0x86d3('0x45')]=function(_0x7af7b3,_0x1a4345){return db[_0x86d3('0x3d')][_0x86d3('0x45')](_0x7af7b3[_0x86d3('0x46')],{})[_0x86d3('0x1f')](function(_0x1236ea){var _0x4ea940=_0x7af7b3[_0x86d3('0x47')][_0x86d3('0x20')]({'plain':!![]});if(!_0x4ea940)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ea940[_0x86d3('0x48')]===_0x86d3('0x47')){var _0x197047=_0x1236ea[_0x86d3('0x20')]({'plain':!![]});var _0x1dcff0=_0x86d3('0x49');return db['UserProfileSection']['find']({'where':{'name':_0x1dcff0,'userProfileId':_0x4ea940['userProfileId']},'raw':!![]})['then'](function(_0x159253){if(_0x159253&&_0x159253[_0x86d3('0x4a')]===0x0){return db[_0x86d3('0x4b')][_0x86d3('0x45')]({'name':_0x197047[_0x86d3('0x24')],'resourceId':_0x197047['id'],'type':_0x86d3('0x4c'),'sectionId':_0x159253['id']},{})[_0x86d3('0x1f')](function(){return _0x1236ea;});}else{return _0x1236ea;}})['catch'](function(_0x2afb07){logger[_0x86d3('0x22')](_0x86d3('0x4d'),_0x2afb07);throw _0x2afb07;});}return _0x1236ea;})[_0x86d3('0x1f')](respondWithResult(_0x1a4345,0xc9))[_0x86d3('0x44')](handleError(_0x1a4345,null));};exports[_0x86d3('0x1e')]=function(_0x34935f,_0x4c8828){if(_0x34935f[_0x86d3('0x46')]['id']){delete _0x34935f['body']['id'];}return db[_0x86d3('0x3d')][_0x86d3('0x43')]({'where':{'id':_0x34935f[_0x86d3('0x4e')]['id']}})[_0x86d3('0x1f')](handleEntityNotFound(_0x4c8828,null))[_0x86d3('0x1f')](saveUpdates(_0x34935f['body'],null))[_0x86d3('0x1f')](respondWithResult(_0x4c8828,null))[_0x86d3('0x44')](handleError(_0x4c8828,null));};exports[_0x86d3('0x21')]=function(_0x4e10d9,_0x4ad164){return db['AnalyticDefaultReport'][_0x86d3('0x43')]({'where':{'id':_0x4e10d9['params']['id']}})[_0x86d3('0x1f')](handleEntityNotFound(_0x4ad164,null))[_0x86d3('0x1f')](removeEntity(_0x4ad164,null))[_0x86d3('0x44')](handleError(_0x4ad164,null));};exports[_0x86d3('0x4f')]=function(_0x5963bb,_0x4cd835){var _0x551806=0xa;var _0x28655a=[_0x86d3('0x50'),'left_join',_0x86d3('0x51'),_0x86d3('0x52')];var _0xa085b2={'SUM':_0x86d3('0x53'),'COUNT':_0x86d3('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x86d3('0x55'),'MIN':_0x86d3('0x56'),'AVG':_0x86d3('0x57'),'GROUP_CONCAT':_0x86d3('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x86d3('0x59')};var _0x41fad7={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x86d3('0x5a'),'HOUR':_0x86d3('0x5b'),'ROUND':_0x86d3('0x5c'),'UNIX_TIMESTAMP':_0x86d3('0x5d')};var _0x4598d4=function(_0x4029a4){return!_[_0x86d3('0x5e')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x86d3('0x5f'),'IS\x20NOT\x20EMPTY'],_0x4029a4);};var _0x528ca8=function(_0x58e4b6){if(!_0x58e4b6||!_0x58e4b6[_0x86d3('0x60')]['length']){return'';}for(var _0x254ac3='(',_0x5f2ed6=0x0;_0x5f2ed6<_0x58e4b6[_0x86d3('0x60')][_0x86d3('0x30')];_0x5f2ed6+=0x1){_0x5f2ed6>0x0&&(_0x254ac3+='\x20'+_0x58e4b6[_0x86d3('0x61')]+'\x20');_0x254ac3+=_0x58e4b6['rules'][_0x5f2ed6]['group']?_0x528ca8(_0x58e4b6[_0x86d3('0x60')][_0x5f2ed6][_0x86d3('0x62')]):_0x58e4b6[_0x86d3('0x60')][_0x5f2ed6][_0x86d3('0x63')]+'\x20'+_0x58e4b6[_0x86d3('0x60')][_0x5f2ed6][_0x86d3('0x64')]+(_0x4598d4(_0x58e4b6[_0x86d3('0x60')][_0x5f2ed6][_0x86d3('0x64')])?'\x20'+_0x58e4b6[_0x86d3('0x60')][_0x5f2ed6][_0x86d3('0x65')]:'');}return _0x254ac3+')';};var _0x1e3479={'where':{'id':_0x5963bb[_0x86d3('0x4e')]['id']}},_0x265beb,_0xfaf168,_0xf0dbbb,_0x3f978c,_0x5e1835;_0x1e3479=_[_0x86d3('0x38')]({},_0x1e3479,_0x5963bb['options']);return db[_0x86d3('0x3d')][_0x86d3('0x43')](_0x1e3479)[_0x86d3('0x1f')](function(_0x52dc99){if(_0x52dc99){_0x265beb=_0x52dc99;return _0x52dc99[_0x86d3('0x66')]();}return null;})[_0x86d3('0x1f')](function(_0x45e8d9){if(_0x45e8d9){if(!_0x45e8d9[_0x86d3('0x30')]){throw new db['Sequelize'][(_0x86d3('0x67'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xfaf168=_0x45e8d9;return db[_0x86d3('0x68')][_0x86d3('0x3e')]({'raw':!![]});}return null;})[_0x86d3('0x1f')](function(_0x2d4bc1){if(_0x2d4bc1){_0xf0dbbb=_[_0x86d3('0x69')](_0x2d4bc1,'id');var _0x56fd96;var _0x3cc1d8=squel['select']();_0x3cc1d8[_0x86d3('0x6a')](_0x265beb[_0x86d3('0x6b')]);for(var _0x5866fe=0x0;_0x5866fe<_0xfaf168[_0x86d3('0x30')];_0x5866fe+=0x1){_0x56fd96=_0xfaf168[_0x5866fe][_0x86d3('0x6c')]?_0xf0dbbb[_0xfaf168[_0x5866fe][_0x86d3('0x6c')]][_0x86d3('0x6d')]:_0xfaf168[_0x5866fe][_0x86d3('0x63')];_0x56fd96=_0xfaf168[_0x5866fe][_0x86d3('0x6e')]?_[_0x86d3('0x6f')](_0xa085b2[_0xfaf168[_0x5866fe]['function']],'%s',_0x56fd96):_0x56fd96;_0x56fd96=_0xfaf168[_0x5866fe][_0x86d3('0x70')]?_[_0x86d3('0x6f')](_0x41fad7[_0xfaf168[_0x5866fe][_0x86d3('0x70')]],'%s',_0x56fd96):_0x56fd96;if(_0xfaf168[_0x5866fe][_0x86d3('0x71')]){_0x3cc1d8[_0x86d3('0x62')](_0x56fd96);}_0xfaf168[_0x5866fe]['orderBy']&&_0x3cc1d8[_0x86d3('0x33')](_0x56fd96,_0xfaf168[_0x5866fe][_0x86d3('0x72')]==='DESC'?![]:!![]);_0x3cc1d8[_0x86d3('0x63')](_0x56fd96,_0xfaf168[_0x5866fe][_0x86d3('0x73')]||_0x56fd96);}if(_0x265beb[_0x86d3('0x74')]){_0x265beb[_0x86d3('0x74')]=JSON[_0x86d3('0x75')](_0x265beb[_0x86d3('0x74')]);for(var _0x1bf5ba=0x0;_0x1bf5ba<_0x265beb[_0x86d3('0x74')][_0x86d3('0x30')];_0x1bf5ba+=0x1){if(_0x265beb[_0x86d3('0x74')][_0x1bf5ba][_0x86d3('0x29')]&&_[_0x86d3('0x5e')](_0x28655a,_0x265beb[_0x86d3('0x74')][_0x1bf5ba][_0x86d3('0x29')])&&_0x265beb['joins'][_0x1bf5ba][_0x86d3('0x76')]&&_0x265beb[_0x86d3('0x74')][_0x1bf5ba][_0x86d3('0x77')]&&_0x265beb[_0x86d3('0x74')][_0x1bf5ba]['foreignKey']){_0x3cc1d8[_0x265beb[_0x86d3('0x74')][_0x1bf5ba][_0x86d3('0x29')]](_0x265beb[_0x86d3('0x74')][_0x1bf5ba][_0x86d3('0x77')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x265beb[_0x86d3('0x6b')],_0x265beb['joins'][_0x1bf5ba][_0x86d3('0x76')],_0x265beb['joins'][_0x1bf5ba]['foreignTable'],_0x265beb[_0x86d3('0x74')][_0x1bf5ba][_0x86d3('0x78')]));}}}if(_0x265beb[_0x86d3('0x79')]){_0x265beb[_0x86d3('0x79')]=JSON[_0x86d3('0x75')](_0x265beb['conditions']);_0x3cc1d8[_0x86d3('0x35')](_0x528ca8(_0x265beb[_0x86d3('0x79')]['group']));}_0x5e1835=_0x3cc1d8[_0x86d3('0x7a')]();_0x3cc1d8[_0x86d3('0x1a')](_0x551806);_0x3cc1d8['offset'](0x0);logger[_0x86d3('0x7b')]('Limited\x20Query:',_0x3cc1d8[_0x86d3('0x7c')]());return dbH['sequelize']['query'](_0x3cc1d8[_0x86d3('0x7c')](),{'type':dbH['sequelize'][_0x86d3('0x7d')][_0x86d3('0x7e')]});}})[_0x86d3('0x1f')](respondWithResult(_0x4cd835,null))[_0x86d3('0x44')](handleError(_0x4cd835,null));};function runReport(_0x3193d5,_0x3a1acc,_0x268c93){var _0x3b989c=_0x3a1acc['name'];var _0x245b39=0xa;var _0x158f56=[_0x86d3('0x50'),_0x86d3('0x7f'),_0x86d3('0x51'),'cross_join'];var _0x3d8b35={'SUM':_0x86d3('0x53'),'COUNT':_0x86d3('0x54'),'COUNT DISTINCT':_0x86d3('0x80'),'MAX':_0x86d3('0x55'),'MIN':_0x86d3('0x56'),'AVG':_0x86d3('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x86d3('0x81'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0xca2e0={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x86d3('0x5b'),'ROUND':_0x86d3('0x5c'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1b503a=function(_0x24410c){return!_[_0x86d3('0x5e')]([_0x86d3('0x82'),_0x86d3('0x83'),_0x86d3('0x5f'),_0x86d3('0x84')],_0x24410c);};var _0x5f4a38=function(_0x593b85){if(!_0x593b85||!_0x593b85[_0x86d3('0x60')][_0x86d3('0x30')]){return'';}for(var _0x3fac94='(',_0x28d98e=0x0;_0x28d98e<_0x593b85[_0x86d3('0x60')][_0x86d3('0x30')];_0x28d98e+=0x1){_0x28d98e>0x0&&(_0x3fac94+='\x20'+_0x593b85['operator']+'\x20');_0x3fac94+=_0x593b85[_0x86d3('0x60')][_0x28d98e][_0x86d3('0x62')]?_0x5f4a38(_0x593b85[_0x86d3('0x60')][_0x28d98e][_0x86d3('0x62')]):_0x593b85[_0x86d3('0x60')][_0x28d98e][_0x86d3('0x63')]+'\x20'+_0x593b85[_0x86d3('0x60')][_0x28d98e][_0x86d3('0x64')]+(_0x1b503a(_0x593b85[_0x86d3('0x60')][_0x28d98e]['condition'])?'\x20'+_0x593b85[_0x86d3('0x60')][_0x28d98e][_0x86d3('0x65')]:'');}return _0x3fac94+')';};var _0x4b871b={'where':{'id':_0x3193d5['id']}},_0x584a57,_0x36ee46,_0x1cbc3a,_0x682a6d,_0x5004cd;_0x4b871b=_[_0x86d3('0x38')]({},_0x4b871b,_0x268c93);return db[_0x86d3('0x3d')][_0x86d3('0x43')](_0x4b871b)[_0x86d3('0x1f')](function(_0x3d3e7f){if(_0x3d3e7f){_0x584a57=_0x3d3e7f;return _0x3d3e7f['getFields']();}return null;})[_0x86d3('0x1f')](function(_0x1aaf08){if(_0x1aaf08){if(!_0x1aaf08['length']){throw new db[(_0x86d3('0x85'))][(_0x86d3('0x67'))](_0x86d3('0x86'),0x193);}_0x36ee46=_0x1aaf08;return db[_0x86d3('0x68')]['findAll']({'raw':!![]});}return null;})[_0x86d3('0x1f')](function(_0x2896e1){if(_0x2896e1){_0x1cbc3a=_[_0x86d3('0x69')](_0x2896e1,'id');var _0x18295c;var _0x44af1c=squel['select']();_0x44af1c[_0x86d3('0x6a')](_0x584a57[_0x86d3('0x6b')]);for(var _0x3582a2=0x0;_0x3582a2<_0x36ee46[_0x86d3('0x30')];_0x3582a2+=0x1){_0x18295c=_0x36ee46[_0x3582a2][_0x86d3('0x6c')]?_0x1cbc3a[_0x36ee46[_0x3582a2][_0x86d3('0x6c')]][_0x86d3('0x6d')]:_0x36ee46[_0x3582a2][_0x86d3('0x63')];_0x18295c=_0x36ee46[_0x3582a2][_0x86d3('0x6e')]?_[_0x86d3('0x6f')](_0x3d8b35[_0x36ee46[_0x3582a2]['function']],'%s',_0x18295c):_0x18295c;_0x18295c=_0x36ee46[_0x3582a2]['format']?_[_0x86d3('0x6f')](_0xca2e0[_0x36ee46[_0x3582a2][_0x86d3('0x70')]],'%s',_0x18295c):_0x18295c;if(_0x36ee46[_0x3582a2]['groupBy']){_0x44af1c[_0x86d3('0x62')](_0x18295c);}_0x36ee46[_0x3582a2][_0x86d3('0x72')]&&_0x44af1c[_0x86d3('0x33')](_0x18295c,_0x36ee46[_0x3582a2][_0x86d3('0x72')]===_0x86d3('0x87')?![]:!![]);_0x44af1c[_0x86d3('0x63')](_0x18295c,_0x36ee46[_0x3582a2][_0x86d3('0x73')]||_0x18295c);}if(_0x584a57[_0x86d3('0x74')]){_0x584a57[_0x86d3('0x74')]=JSON['parse'](_0x584a57['joins']);for(var _0x48a6d7=0x0;_0x48a6d7<_0x584a57['joins'][_0x86d3('0x30')];_0x48a6d7+=0x1){if(_0x584a57[_0x86d3('0x74')][_0x48a6d7][_0x86d3('0x29')]&&_[_0x86d3('0x5e')](_0x158f56,_0x584a57[_0x86d3('0x74')][_0x48a6d7][_0x86d3('0x29')])&&_0x584a57[_0x86d3('0x74')][_0x48a6d7]['parentKey']&&_0x584a57[_0x86d3('0x74')][_0x48a6d7][_0x86d3('0x77')]&&_0x584a57[_0x86d3('0x74')][_0x48a6d7][_0x86d3('0x78')]){_0x44af1c[_0x584a57['joins'][_0x48a6d7][_0x86d3('0x29')]](_0x584a57['joins'][_0x48a6d7][_0x86d3('0x77')],null,util[_0x86d3('0x70')](_0x86d3('0x88'),_0x584a57[_0x86d3('0x6b')],_0x584a57[_0x86d3('0x74')][_0x48a6d7]['parentKey'],_0x584a57['joins'][_0x48a6d7][_0x86d3('0x77')],_0x584a57['joins'][_0x48a6d7][_0x86d3('0x78')]));}}}if(_0x584a57['conditions']){_0x584a57[_0x86d3('0x79')]=JSON['parse'](_0x584a57['conditions']);_0x44af1c[_0x86d3('0x35')](_0x5f4a38(_0x584a57[_0x86d3('0x79')][_0x86d3('0x62')]));}_0x5004cd=_0x44af1c[_0x86d3('0x7a')]();_0x44af1c[_0x86d3('0x1a')](_0x245b39);_0x44af1c[_0x86d3('0x18')](0x0);return;}})[_0x86d3('0x1f')](function(){if(_0x3a1acc[_0x86d3('0x89')]===_0x86d3('0x8a')){return null;}var _0x120a85=_[_0x86d3('0x38')](_0x3a1acc,{'name':_0x3a1acc[_0x86d3('0x8b')]||_0x3a1acc[_0x86d3('0x24')]||_0x584a57[_0x86d3('0x24')],'basename':_0x3b989c,'savename':util[_0x86d3('0x70')]('%s-%s.%s',_0x3a1acc['name']||_0x584a57['name'],require(_0x86d3('0x8c'))[_0x86d3('0x8d')](0x4),_0x3a1acc[_0x86d3('0x89')]||_0x86d3('0x8e')),'reportId':_0x584a57['id'],'reportType':_0x86d3('0x8f')});return db[_0x86d3('0x90')][_0x86d3('0x45')](_0x120a85,{'raw':!![]});})[_0x86d3('0x1f')](function(_0x10e23d){if(_0x584a57[_0x86d3('0x6b')]===_0x86d3('0x91')){_0x5004cd['where'](_0x584a57[_0x86d3('0x6b')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x3a1acc[_0x86d3('0x92')],_0x3a1acc[_0x86d3('0x93')]);}else{_0x5004cd[_0x86d3('0x35')](_0x584a57[_0x86d3('0x6b')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3a1acc[_0x86d3('0x92')],_0x3a1acc[_0x86d3('0x93')]);}if(_0x10e23d){logger[_0x86d3('0x94')](_0x86d3('0x95'),_0x5004cd[_0x86d3('0x7c')]());require(_0x86d3('0x96'))[_0x86d3('0x97')](path[_0x86d3('0x50')](__dirname,_0x86d3('0x98'),_0x10e23d[_0x86d3('0x89')]),[_0x10e23d['id'],_0x5004cd[_0x86d3('0x7c')](),path[_0x86d3('0x50')](__dirname,_0x86d3('0x99'),_0x10e23d[_0x86d3('0x9a')]),_0x3b989c]);return _0x10e23d;}else{var _0x428b11=squel[_0x86d3('0x9b')]();_0x428b11[_0x86d3('0x6a')]('('+_0x5004cd['toString']()+')',_0x86d3('0x9c'));_0x428b11[_0x86d3('0x63')](_0x86d3('0x9d'),_0x86d3('0x1b'));_0x5004cd['limit'](_0x3a1acc[_0x86d3('0x1a')]||_0x245b39);_0x5004cd['offset'](_0x3a1acc['offset']||0x0);return dbH[_0x86d3('0x9e')][_0x86d3('0x2c')](_0x428b11[_0x86d3('0x7c')](),{'type':dbH[_0x86d3('0x9e')][_0x86d3('0x7d')][_0x86d3('0x7e')]})[_0x86d3('0x1f')](function(_0x4777f1){if(!_0x4777f1['length']){_0x682a6d=0x0;}else{_0x682a6d=_0x4777f1[0x0]['count']||0x0;}return dbH['sequelize'][_0x86d3('0x2c')](_0x5004cd[_0x86d3('0x7c')](),{'type':dbH[_0x86d3('0x9e')]['QueryTypes'][_0x86d3('0x7e')]});})['then'](function(_0x435b8e){return{'rows':_0x435b8e||[],'count':_0x682a6d};});}});}exports[_0x86d3('0x9f')]=function(_0x73b8e6,_0x2c98e1){return runReport(_0x73b8e6['params'],_0x73b8e6[_0x86d3('0x2c')],_0x73b8e6[_0x86d3('0x3a')])[_0x86d3('0x1f')](respondWithResult(_0x2c98e1,null))['catch'](handleError(_0x2c98e1,null));};exports['runReport']=runReport;exports['query']=function(_0x458997,_0x1e3559){var _0x49a101=0xa;var _0x38d724=['join',_0x86d3('0x7f'),_0x86d3('0x51'),_0x86d3('0x52')];var _0x56ff91={'SUM':_0x86d3('0x53'),'COUNT':_0x86d3('0x54'),'COUNT DISTINCT':_0x86d3('0x80'),'MAX':_0x86d3('0x55'),'MIN':_0x86d3('0x56'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x86d3('0x58'),'GROUP_CONCAT ASC':_0x86d3('0x81'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1f347e={'SEC_TO_TIME':_0x86d3('0xa0'),'DATE':'DATE(%s)','HOUR':_0x86d3('0x5b'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x45b210=function(_0x144e43){return!_[_0x86d3('0x5e')]([_0x86d3('0x82'),_0x86d3('0x83'),_0x86d3('0x5f'),_0x86d3('0x84')],_0x144e43);};var _0xdc7c21=function(_0x2e0397){if(!_0x2e0397||!_0x2e0397[_0x86d3('0x60')][_0x86d3('0x30')]){return'';}for(var _0x2cc617='(',_0x25339c=0x0;_0x25339c<_0x2e0397['rules'][_0x86d3('0x30')];_0x25339c+=0x1){_0x25339c>0x0&&(_0x2cc617+='\x20'+_0x2e0397[_0x86d3('0x61')]+'\x20');_0x2cc617+=_0x2e0397[_0x86d3('0x60')][_0x25339c][_0x86d3('0x62')]?_0xdc7c21(_0x2e0397[_0x86d3('0x60')][_0x25339c][_0x86d3('0x62')]):_0x2e0397['rules'][_0x25339c][_0x86d3('0x63')]+'\x20'+_0x2e0397['rules'][_0x25339c][_0x86d3('0x64')]+(_0x45b210(_0x2e0397[_0x86d3('0x60')][_0x25339c]['condition'])?'\x20'+_0x2e0397['rules'][_0x25339c][_0x86d3('0x65')]:'');}return _0x2cc617+')';};var _0x2c0070={'where':{'id':_0x458997[_0x86d3('0x4e')]['id']}},_0x31d436,_0x56e713,_0x525559,_0x3b9e1e,_0x1d8d7c;_0x2c0070=_['merge']({},_0x2c0070,_0x458997[_0x86d3('0x3a')]);return db[_0x86d3('0x3d')][_0x86d3('0x43')](_0x2c0070)[_0x86d3('0x1f')](function(_0x1f80be){if(_0x1f80be){_0x31d436=_0x1f80be;return _0x1f80be[_0x86d3('0x66')]();}return null;})[_0x86d3('0x1f')](function(_0x3dddbe){if(_0x3dddbe){if(!_0x3dddbe[_0x86d3('0x30')]){throw new db[(_0x86d3('0x85'))][(_0x86d3('0x67'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x56e713=_0x3dddbe;return db[_0x86d3('0x68')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x1d7e83){if(_0x1d7e83){_0x525559=_[_0x86d3('0x69')](_0x1d7e83,'id');var _0x5d9385;var _0x49a499=squel[_0x86d3('0x9b')]();_0x49a499[_0x86d3('0x6a')](_0x31d436[_0x86d3('0x6b')]);for(var _0x33e0a5=0x0;_0x33e0a5<_0x56e713['length'];_0x33e0a5+=0x1){_0x5d9385=_0x56e713[_0x33e0a5][_0x86d3('0x6c')]?_0x525559[_0x56e713[_0x33e0a5][_0x86d3('0x6c')]][_0x86d3('0x6d')]:_0x56e713[_0x33e0a5][_0x86d3('0x63')];_0x5d9385=_0x56e713[_0x33e0a5][_0x86d3('0x6e')]?_['replace'](_0x56ff91[_0x56e713[_0x33e0a5][_0x86d3('0x6e')]],'%s',_0x5d9385):_0x5d9385;_0x5d9385=_0x56e713[_0x33e0a5][_0x86d3('0x70')]?_[_0x86d3('0x6f')](_0x1f347e[_0x56e713[_0x33e0a5]['format']],'%s',_0x5d9385):_0x5d9385;if(_0x56e713[_0x33e0a5][_0x86d3('0x71')]){_0x49a499['group'](_0x5d9385);}_0x56e713[_0x33e0a5][_0x86d3('0x72')]&&_0x49a499[_0x86d3('0x33')](_0x5d9385,_0x56e713[_0x33e0a5]['orderBy']===_0x86d3('0x87')?![]:!![]);_0x49a499[_0x86d3('0x63')](_0x5d9385,_0x56e713[_0x33e0a5][_0x86d3('0x73')]||_0x5d9385);}if(_0x31d436[_0x86d3('0x74')]){_0x31d436[_0x86d3('0x74')]=JSON[_0x86d3('0x75')](_0x31d436['joins']);for(var _0x10af91=0x0;_0x10af91<_0x31d436['joins'][_0x86d3('0x30')];_0x10af91+=0x1){if(_0x31d436[_0x86d3('0x74')][_0x10af91][_0x86d3('0x29')]&&_[_0x86d3('0x5e')](_0x38d724,_0x31d436['joins'][_0x10af91][_0x86d3('0x29')])&&_0x31d436[_0x86d3('0x74')][_0x10af91][_0x86d3('0x76')]&&_0x31d436[_0x86d3('0x74')][_0x10af91][_0x86d3('0x77')]&&_0x31d436[_0x86d3('0x74')][_0x10af91]['foreignKey']){_0x49a499[_0x31d436[_0x86d3('0x74')][_0x10af91][_0x86d3('0x29')]](_0x31d436['joins'][_0x10af91]['foreignTable'],null,util[_0x86d3('0x70')]('%s.%s\x20=\x20%s.%s',_0x31d436['table'],_0x31d436[_0x86d3('0x74')][_0x10af91][_0x86d3('0x76')],_0x31d436[_0x86d3('0x74')][_0x10af91]['foreignTable'],_0x31d436[_0x86d3('0x74')][_0x10af91][_0x86d3('0x78')]));}}}if(_0x31d436[_0x86d3('0x79')]){_0x31d436[_0x86d3('0x79')]=JSON[_0x86d3('0x75')](_0x31d436['conditions']);_0x49a499[_0x86d3('0x35')](_0xdc7c21(_0x31d436[_0x86d3('0x79')]['group']));}_0x1d8d7c=_0x49a499['clone']();_0x49a499['limit'](_0x49a101);_0x49a499[_0x86d3('0x18')](0x0);logger['debug']('Limited\x20Query:',_0x49a499[_0x86d3('0x7c')]());return dbH[_0x86d3('0x9e')]['query'](_0x49a499['toString'](),{'type':dbH[_0x86d3('0x9e')][_0x86d3('0x7d')][_0x86d3('0x7e')]});}})['then'](function(){return{'sql':_0x1d8d7c[_0x86d3('0x7c')]()};})[_0x86d3('0x1f')](respondWithResult(_0x1e3559,null))[_0x86d3('0x44')](handleError(_0x1e3559,null));}; \ No newline at end of file +var _0x1261=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','offset','limit','undefined','set','json','apply','reject','save','then','destroy','get','DefaultReports','UserProfileResource','error','name','index','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','count','include','findAll','rows','show','length','includeAll','options','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','params','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignTable','foreignKey','conditions','parse','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','AVG(%s)','DATE(%s)','value','keyBy','select','order','%s.%s\x20=\x20%s.%s','clone','web','fullPath','randomstring','generate','output','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','Run\x20Query:','../../components/export/','savename','COUNT(*)','run','runReport','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','Sequelize','debug'];(function(_0x488e86,_0x4acf5e){var _0x2c94c3=function(_0x6647f){while(--_0x6647f){_0x488e86['push'](_0x488e86['shift']());}};_0x2c94c3(++_0x4acf5e);}(_0x1261,0x144));var _0x1126=function(_0x14915a,_0x222f6b){_0x14915a=_0x14915a-0x0;var _0x2f683c=_0x1261[_0x14915a];return _0x2f683c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1126('0x0'));var zipdir=require(_0x1126('0x1'));var jsonpatch=require(_0x1126('0x2'));var rp=require(_0x1126('0x3'));var moment=require(_0x1126('0x4'));var BPromise=require(_0x1126('0x5'));var Mustache=require(_0x1126('0x6'));var util=require(_0x1126('0x7'));var path=require(_0x1126('0x8'));var sox=require(_0x1126('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1126('0xa'));var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];var dbH=require(_0x1126('0x17'))[_0x1126('0x18')];function respondWithStatusCode(_0xca0355,_0x3f10e9){_0x3f10e9=_0x3f10e9||0xcc;return function(_0xd8ca42){if(_0xd8ca42){return _0xca0355[_0x1126('0x19')](_0x3f10e9);}return _0xca0355[_0x1126('0x1a')](_0x3f10e9)['end']();};}function respondWithResult(_0x5de9a7,_0x1af673){_0x1af673=_0x1af673||0xc8;return function(_0x154e20){if(_0x154e20){return _0x5de9a7[_0x1126('0x1a')](_0x1af673)['json'](_0x154e20);}};}function respondWithFilteredResult(_0x45149c,_0x4794a7){return function(_0x35fe9f){if(_0x35fe9f){var _0x42f379=typeof _0x4794a7[_0x1126('0x1b')]==='undefined'&&typeof _0x4794a7[_0x1126('0x1c')]===_0x1126('0x1d');var _0x4a7b49=_0x35fe9f['count'];var _0x22ae0b=_0x42f379?0x0:_0x4794a7[_0x1126('0x1b')];var _0x58d11a=_0x42f379?_0x35fe9f['count']:_0x4794a7[_0x1126('0x1b')]+_0x4794a7['limit'];var _0x22ed37;if(_0x58d11a>=_0x4a7b49){_0x58d11a=_0x4a7b49;_0x22ed37=0xc8;}else{_0x22ed37=0xce;}_0x45149c[_0x1126('0x1a')](_0x22ed37);return _0x45149c[_0x1126('0x1e')]('Content-Range',_0x22ae0b+'-'+_0x58d11a+'/'+_0x4a7b49)[_0x1126('0x1f')](_0x35fe9f);}return null;};}function patchUpdates(_0x49d209){return function(_0x56efeb){try{jsonpatch[_0x1126('0x20')](_0x56efeb,_0x49d209,!![]);}catch(_0x3a9bed){return BPromise[_0x1126('0x21')](_0x3a9bed);}return _0x56efeb[_0x1126('0x22')]();};}function saveUpdates(_0x526ca1,_0x29ab60){return function(_0x477e6a){if(_0x477e6a){return _0x477e6a['update'](_0x526ca1)[_0x1126('0x23')](function(_0x59cd8e){return _0x59cd8e;});}return null;};}function removeEntity(_0x529dd9,_0x4b57ab){return function(_0x2199d9){if(_0x2199d9){return _0x2199d9[_0x1126('0x24')]()[_0x1126('0x23')](function(){var _0x34bcf1=_0x2199d9[_0x1126('0x25')]({'plain':!![]});var _0x1b07a7=_0x1126('0x26');return db[_0x1126('0x27')]['destroy']({'where':{'type':_0x1b07a7,'resourceId':_0x34bcf1['id']}})[_0x1126('0x23')](function(){return _0x2199d9;});})[_0x1126('0x23')](function(){_0x529dd9[_0x1126('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x541bc9,_0xeb7d89){return function(_0x39bf0e){if(!_0x39bf0e){_0x541bc9['sendStatus'](0x194);}return _0x39bf0e;};}function handleError(_0x2fb797,_0x23d2bc){_0x23d2bc=_0x23d2bc||0x1f4;return function(_0x4a334a){logger[_0x1126('0x28')](_0x4a334a['stack']);if(_0x4a334a[_0x1126('0x29')]){delete _0x4a334a['name'];}_0x2fb797[_0x1126('0x1a')](_0x23d2bc)['send'](_0x4a334a);};}exports[_0x1126('0x2a')]=function(_0x5f2611,_0x5252e0){var _0x4a53ab={},_0x17646e={},_0xa8906d={'count':0x0,'rows':[]};var _0x1cef48=_['map'](db[_0x1126('0x2b')][_0x1126('0x2c')],function(_0x56f7f8){return{'name':_0x56f7f8[_0x1126('0x2d')],'type':_0x56f7f8[_0x1126('0x2e')][_0x1126('0x2f')]};});_0x17646e[_0x1126('0x30')]=_['map'](_0x1cef48,'name');_0x17646e[_0x1126('0x31')]=_[_0x1126('0x32')](_0x5f2611[_0x1126('0x31')]);_0x17646e[_0x1126('0x33')]=_['intersection'](_0x17646e[_0x1126('0x30')],_0x17646e[_0x1126('0x31')]);_0x4a53ab[_0x1126('0x34')]=_[_0x1126('0x35')](_0x17646e[_0x1126('0x30')],qs['fields'](_0x5f2611[_0x1126('0x31')][_0x1126('0x36')]));_0x4a53ab[_0x1126('0x34')]=_0x4a53ab[_0x1126('0x34')]['length']?_0x4a53ab['attributes']:_0x17646e[_0x1126('0x30')];if(!_0x5f2611[_0x1126('0x31')]['hasOwnProperty'](_0x1126('0x37'))){_0x4a53ab[_0x1126('0x1c')]=qs[_0x1126('0x1c')](_0x5f2611['query']['limit']);_0x4a53ab[_0x1126('0x1b')]=qs[_0x1126('0x1b')](_0x5f2611[_0x1126('0x31')][_0x1126('0x1b')]);}_0x4a53ab['order']=qs[_0x1126('0x38')](_0x5f2611['query'][_0x1126('0x38')]);_0x4a53ab[_0x1126('0x39')]=qs[_0x1126('0x33')](_[_0x1126('0x3a')](_0x5f2611[_0x1126('0x31')],_0x17646e['filters']),_0x1cef48);if(_0x5f2611[_0x1126('0x31')][_0x1126('0x3b')]){_0x4a53ab[_0x1126('0x39')]=_[_0x1126('0x3c')](_0x4a53ab[_0x1126('0x39')],{'$or':_[_0x1126('0x3d')](_0x1cef48,function(_0x3052f9){if(_0x3052f9['type']!==_0x1126('0x3e')){var _0x154c28={};_0x154c28[_0x3052f9[_0x1126('0x29')]]={'$like':'%'+_0x5f2611[_0x1126('0x31')][_0x1126('0x3b')]+'%'};return _0x154c28;}})});}_0x4a53ab=_['merge']({},_0x4a53ab,_0x5f2611['options']);var _0x1c4f06={'where':_0x4a53ab[_0x1126('0x39')]};return db[_0x1126('0x2b')][_0x1126('0x3f')](_0x1c4f06)[_0x1126('0x23')](function(_0x276fd5){_0xa8906d['count']=_0x276fd5;if(_0x5f2611['query']['includeAll']){_0x4a53ab[_0x1126('0x40')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x1126('0x41')](_0x4a53ab);})[_0x1126('0x23')](function(_0x3584a3){_0xa8906d[_0x1126('0x42')]=_0x3584a3;return _0xa8906d;})['then'](respondWithFilteredResult(_0x5252e0,_0x4a53ab))['catch'](handleError(_0x5252e0,null));};exports[_0x1126('0x43')]=function(_0xa93167,_0x1d63b9){var _0x5f5d3a={'raw':!![],'where':{'id':_0xa93167['params']['id']}},_0x2f8551={};_0x2f8551[_0x1126('0x30')]=_['keys'](db[_0x1126('0x2b')][_0x1126('0x2c')]);_0x2f8551[_0x1126('0x31')]=_['keys'](_0xa93167[_0x1126('0x31')]);_0x2f8551[_0x1126('0x33')]=_[_0x1126('0x35')](_0x2f8551['model'],_0x2f8551['query']);_0x5f5d3a['attributes']=_[_0x1126('0x35')](_0x2f8551['model'],qs[_0x1126('0x36')](_0xa93167['query'][_0x1126('0x36')]));_0x5f5d3a[_0x1126('0x34')]=_0x5f5d3a[_0x1126('0x34')][_0x1126('0x44')]?_0x5f5d3a[_0x1126('0x34')]:_0x2f8551['model'];if(_0xa93167[_0x1126('0x31')][_0x1126('0x45')]){_0x5f5d3a['include']=[{'all':!![]}];}_0x5f5d3a=_[_0x1126('0x3c')]({},_0x5f5d3a,_0xa93167[_0x1126('0x46')]);return db['AnalyticDefaultReport'][_0x1126('0x47')](_0x5f5d3a)[_0x1126('0x23')](handleEntityNotFound(_0x1d63b9,null))['then'](respondWithResult(_0x1d63b9,null))[_0x1126('0x48')](handleError(_0x1d63b9,null));};exports[_0x1126('0x49')]=function(_0x213a76,_0x59656d){return db[_0x1126('0x2b')][_0x1126('0x49')](_0x213a76[_0x1126('0x4a')],{})[_0x1126('0x23')](function(_0x224456){var _0x2081f2=_0x213a76[_0x1126('0x4b')][_0x1126('0x25')]({'plain':!![]});if(!_0x2081f2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2081f2[_0x1126('0x4c')]==='user'){var _0x40168e=_0x224456[_0x1126('0x25')]({'plain':!![]});var _0x4a1831='Reports';return db[_0x1126('0x4d')][_0x1126('0x47')]({'where':{'name':_0x4a1831,'userProfileId':_0x2081f2[_0x1126('0x4e')]},'raw':!![]})['then'](function(_0x3cb44c){if(_0x3cb44c&&_0x3cb44c[_0x1126('0x4f')]===0x0){return db[_0x1126('0x27')][_0x1126('0x49')]({'name':_0x40168e['name'],'resourceId':_0x40168e['id'],'type':_0x1126('0x26'),'sectionId':_0x3cb44c['id']},{})[_0x1126('0x23')](function(){return _0x224456;});}else{return _0x224456;}})['catch'](function(_0x4bcc08){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4bcc08);throw _0x4bcc08;});}return _0x224456;})[_0x1126('0x23')](respondWithResult(_0x59656d,0xc9))[_0x1126('0x48')](handleError(_0x59656d,null));};exports['update']=function(_0x16552b,_0x1c7a2b){if(_0x16552b[_0x1126('0x4a')]['id']){delete _0x16552b[_0x1126('0x4a')]['id'];}return db[_0x1126('0x2b')]['find']({'where':{'id':_0x16552b[_0x1126('0x50')]['id']}})[_0x1126('0x23')](handleEntityNotFound(_0x1c7a2b,null))['then'](saveUpdates(_0x16552b[_0x1126('0x4a')],null))[_0x1126('0x23')](respondWithResult(_0x1c7a2b,null))[_0x1126('0x48')](handleError(_0x1c7a2b,null));};exports[_0x1126('0x24')]=function(_0xc8a0f,_0x59c3d0){return db[_0x1126('0x2b')]['find']({'where':{'id':_0xc8a0f[_0x1126('0x50')]['id']}})[_0x1126('0x23')](handleEntityNotFound(_0x59c3d0,null))[_0x1126('0x23')](removeEntity(_0x59c3d0,null))['catch'](handleError(_0x59c3d0,null));};exports[_0x1126('0x51')]=function(_0x2340f8,_0x5763b4){var _0x30812d=0xa;var _0x25038f=[_0x1126('0x52'),'left_join',_0x1126('0x53'),_0x1126('0x54')];var _0x22ab18={'SUM':_0x1126('0x55'),'COUNT':_0x1126('0x56'),'COUNT DISTINCT':_0x1126('0x57'),'MAX':_0x1126('0x58'),'MIN':_0x1126('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x1126('0x5a'),'GROUP_CONCAT ASC':_0x1126('0x5b'),'GROUP_CONCAT DESC':_0x1126('0x5c')};var _0x2a5422={'SEC_TO_TIME':_0x1126('0x5d'),'DATE':'DATE(%s)','HOUR':_0x1126('0x5e'),'ROUND':_0x1126('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3767e4=function(_0x5246aa){return!_[_0x1126('0x60')]([_0x1126('0x61'),'IS\x20NOT\x20NULL',_0x1126('0x62'),_0x1126('0x63')],_0x5246aa);};var _0x375b76=function(_0x592960){if(!_0x592960||!_0x592960[_0x1126('0x64')]['length']){return'';}for(var _0x558b6e='(',_0xbdc58=0x0;_0xbdc58<_0x592960[_0x1126('0x64')][_0x1126('0x44')];_0xbdc58+=0x1){_0xbdc58>0x0&&(_0x558b6e+='\x20'+_0x592960[_0x1126('0x65')]+'\x20');_0x558b6e+=_0x592960[_0x1126('0x64')][_0xbdc58][_0x1126('0x66')]?_0x375b76(_0x592960[_0x1126('0x64')][_0xbdc58]['group']):_0x592960[_0x1126('0x64')][_0xbdc58][_0x1126('0x67')]+'\x20'+_0x592960[_0x1126('0x64')][_0xbdc58][_0x1126('0x68')]+(_0x3767e4(_0x592960[_0x1126('0x64')][_0xbdc58][_0x1126('0x68')])?'\x20'+_0x592960['rules'][_0xbdc58]['value']:'');}return _0x558b6e+')';};var _0x16a343={'where':{'id':_0x2340f8[_0x1126('0x50')]['id']}},_0x3921c2,_0x4bf2b3,_0x5ee130,_0x5e9260,_0x51a28d;_0x16a343=_[_0x1126('0x3c')]({},_0x16a343,_0x2340f8[_0x1126('0x46')]);return db['AnalyticDefaultReport'][_0x1126('0x47')](_0x16a343)[_0x1126('0x23')](function(_0x170bf0){if(_0x170bf0){_0x3921c2=_0x170bf0;return _0x170bf0[_0x1126('0x69')]();}return null;})[_0x1126('0x23')](function(_0x3f007b){if(_0x3f007b){if(!_0x3f007b[_0x1126('0x44')]){throw new db['Sequelize'][(_0x1126('0x6a'))](_0x1126('0x6b'),0x193);}_0x4bf2b3=_0x3f007b;return db[_0x1126('0x6c')][_0x1126('0x41')]({'raw':!![]});}return null;})[_0x1126('0x23')](function(_0x56c003){if(_0x56c003){_0x5ee130=_['keyBy'](_0x56c003,'id');var _0x15cf3d;var _0x2643d7=squel['select']();_0x2643d7[_0x1126('0x6d')](_0x3921c2[_0x1126('0x6e')]);for(var _0x366675=0x0;_0x366675<_0x4bf2b3[_0x1126('0x44')];_0x366675+=0x1){_0x15cf3d=_0x4bf2b3[_0x366675][_0x1126('0x6f')]?_0x5ee130[_0x4bf2b3[_0x366675][_0x1126('0x6f')]][_0x1126('0x70')]:_0x4bf2b3[_0x366675][_0x1126('0x67')];_0x15cf3d=_0x4bf2b3[_0x366675][_0x1126('0x71')]?_[_0x1126('0x72')](_0x22ab18[_0x4bf2b3[_0x366675][_0x1126('0x71')]],'%s',_0x15cf3d):_0x15cf3d;_0x15cf3d=_0x4bf2b3[_0x366675][_0x1126('0x73')]?_[_0x1126('0x72')](_0x2a5422[_0x4bf2b3[_0x366675]['format']],'%s',_0x15cf3d):_0x15cf3d;if(_0x4bf2b3[_0x366675][_0x1126('0x74')]){_0x2643d7[_0x1126('0x66')](_0x15cf3d);}_0x4bf2b3[_0x366675][_0x1126('0x75')]&&_0x2643d7['order'](_0x15cf3d,_0x4bf2b3[_0x366675]['orderBy']===_0x1126('0x76')?![]:!![]);_0x2643d7[_0x1126('0x67')](_0x15cf3d,_0x4bf2b3[_0x366675][_0x1126('0x77')]||_0x15cf3d);}if(_0x3921c2[_0x1126('0x78')]){_0x3921c2['joins']=JSON['parse'](_0x3921c2['joins']);for(var _0x79afca=0x0;_0x79afca<_0x3921c2[_0x1126('0x78')][_0x1126('0x44')];_0x79afca+=0x1){if(_0x3921c2[_0x1126('0x78')][_0x79afca]['type']&&_[_0x1126('0x60')](_0x25038f,_0x3921c2['joins'][_0x79afca][_0x1126('0x2e')])&&_0x3921c2[_0x1126('0x78')][_0x79afca][_0x1126('0x79')]&&_0x3921c2[_0x1126('0x78')][_0x79afca][_0x1126('0x7a')]&&_0x3921c2[_0x1126('0x78')][_0x79afca][_0x1126('0x7b')]){_0x2643d7[_0x3921c2['joins'][_0x79afca][_0x1126('0x2e')]](_0x3921c2['joins'][_0x79afca][_0x1126('0x7a')],null,util[_0x1126('0x73')]('%s.%s\x20=\x20%s.%s',_0x3921c2[_0x1126('0x6e')],_0x3921c2[_0x1126('0x78')][_0x79afca]['parentKey'],_0x3921c2[_0x1126('0x78')][_0x79afca][_0x1126('0x7a')],_0x3921c2['joins'][_0x79afca]['foreignKey']));}}}if(_0x3921c2[_0x1126('0x7c')]){_0x3921c2[_0x1126('0x7c')]=JSON[_0x1126('0x7d')](_0x3921c2['conditions']);_0x2643d7['where'](_0x375b76(_0x3921c2['conditions'][_0x1126('0x66')]));}_0x51a28d=_0x2643d7['clone']();_0x2643d7['limit'](_0x30812d);_0x2643d7[_0x1126('0x1b')](0x0);logger['debug'](_0x1126('0x7e'),_0x2643d7[_0x1126('0x7f')]());return dbH['sequelize'][_0x1126('0x31')](_0x2643d7[_0x1126('0x7f')](),{'type':dbH[_0x1126('0x80')][_0x1126('0x81')][_0x1126('0x82')]});}})['then'](respondWithResult(_0x5763b4,null))[_0x1126('0x48')](handleError(_0x5763b4,null));};function runReport(_0x426faa,_0x5679ec,_0xd182b1){var _0x2d6fcf=_0x5679ec[_0x1126('0x29')];var _0x2af2d0=0xa;var _0x2598a7=[_0x1126('0x52'),_0x1126('0x83'),_0x1126('0x53'),_0x1126('0x54')];var _0x9a2af0={'SUM':_0x1126('0x55'),'COUNT':_0x1126('0x56'),'COUNT DISTINCT':_0x1126('0x57'),'MAX':_0x1126('0x58'),'MIN':_0x1126('0x59'),'AVG':_0x1126('0x84'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x1126('0x5b'),'GROUP_CONCAT DESC':_0x1126('0x5c')};var _0x33cccf={'SEC_TO_TIME':_0x1126('0x5d'),'DATE':_0x1126('0x85'),'HOUR':'HOUR(%s)','ROUND':_0x1126('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5bdb30=function(_0xb1199b){return!_[_0x1126('0x60')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x1126('0x62'),_0x1126('0x63')],_0xb1199b);};var _0x228552=function(_0x1ee970){if(!_0x1ee970||!_0x1ee970[_0x1126('0x64')][_0x1126('0x44')]){return'';}for(var _0x2d7150='(',_0x35a9a4=0x0;_0x35a9a4<_0x1ee970[_0x1126('0x64')]['length'];_0x35a9a4+=0x1){_0x35a9a4>0x0&&(_0x2d7150+='\x20'+_0x1ee970[_0x1126('0x65')]+'\x20');_0x2d7150+=_0x1ee970[_0x1126('0x64')][_0x35a9a4][_0x1126('0x66')]?_0x228552(_0x1ee970[_0x1126('0x64')][_0x35a9a4][_0x1126('0x66')]):_0x1ee970[_0x1126('0x64')][_0x35a9a4]['field']+'\x20'+_0x1ee970[_0x1126('0x64')][_0x35a9a4][_0x1126('0x68')]+(_0x5bdb30(_0x1ee970[_0x1126('0x64')][_0x35a9a4][_0x1126('0x68')])?'\x20'+_0x1ee970[_0x1126('0x64')][_0x35a9a4][_0x1126('0x86')]:'');}return _0x2d7150+')';};var _0x2418ca={'where':{'id':_0x426faa['id']}},_0x2d2dfc,_0x38eac6,_0xc3503b,_0x5d6edb,_0x50238d;_0x2418ca=_[_0x1126('0x3c')]({},_0x2418ca,_0xd182b1);return db['AnalyticDefaultReport'][_0x1126('0x47')](_0x2418ca)['then'](function(_0x4461ae){if(_0x4461ae){_0x2d2dfc=_0x4461ae;return _0x4461ae['getFields']();}return null;})[_0x1126('0x23')](function(_0x4fbd44){if(_0x4fbd44){if(!_0x4fbd44['length']){throw new db['Sequelize'][(_0x1126('0x6a'))](_0x1126('0x6b'),0x193);}_0x38eac6=_0x4fbd44;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x1126('0x23')](function(_0xe2f82d){if(_0xe2f82d){_0xc3503b=_[_0x1126('0x87')](_0xe2f82d,'id');var _0x5dfb8f;var _0x48f914=squel[_0x1126('0x88')]();_0x48f914['from'](_0x2d2dfc[_0x1126('0x6e')]);for(var _0x39d9a0=0x0;_0x39d9a0<_0x38eac6[_0x1126('0x44')];_0x39d9a0+=0x1){_0x5dfb8f=_0x38eac6[_0x39d9a0][_0x1126('0x6f')]?_0xc3503b[_0x38eac6[_0x39d9a0][_0x1126('0x6f')]]['metric']:_0x38eac6[_0x39d9a0]['field'];_0x5dfb8f=_0x38eac6[_0x39d9a0][_0x1126('0x71')]?_[_0x1126('0x72')](_0x9a2af0[_0x38eac6[_0x39d9a0][_0x1126('0x71')]],'%s',_0x5dfb8f):_0x5dfb8f;_0x5dfb8f=_0x38eac6[_0x39d9a0][_0x1126('0x73')]?_[_0x1126('0x72')](_0x33cccf[_0x38eac6[_0x39d9a0][_0x1126('0x73')]],'%s',_0x5dfb8f):_0x5dfb8f;if(_0x38eac6[_0x39d9a0][_0x1126('0x74')]){_0x48f914[_0x1126('0x66')](_0x5dfb8f);}_0x38eac6[_0x39d9a0][_0x1126('0x75')]&&_0x48f914[_0x1126('0x89')](_0x5dfb8f,_0x38eac6[_0x39d9a0][_0x1126('0x75')]==='DESC'?![]:!![]);_0x48f914[_0x1126('0x67')](_0x5dfb8f,_0x38eac6[_0x39d9a0]['alias']||_0x5dfb8f);}if(_0x2d2dfc[_0x1126('0x78')]){_0x2d2dfc['joins']=JSON[_0x1126('0x7d')](_0x2d2dfc[_0x1126('0x78')]);for(var _0x215d4d=0x0;_0x215d4d<_0x2d2dfc[_0x1126('0x78')]['length'];_0x215d4d+=0x1){if(_0x2d2dfc[_0x1126('0x78')][_0x215d4d][_0x1126('0x2e')]&&_['includes'](_0x2598a7,_0x2d2dfc['joins'][_0x215d4d][_0x1126('0x2e')])&&_0x2d2dfc[_0x1126('0x78')][_0x215d4d][_0x1126('0x79')]&&_0x2d2dfc['joins'][_0x215d4d][_0x1126('0x7a')]&&_0x2d2dfc['joins'][_0x215d4d][_0x1126('0x7b')]){_0x48f914[_0x2d2dfc[_0x1126('0x78')][_0x215d4d]['type']](_0x2d2dfc[_0x1126('0x78')][_0x215d4d][_0x1126('0x7a')],null,util[_0x1126('0x73')](_0x1126('0x8a'),_0x2d2dfc[_0x1126('0x6e')],_0x2d2dfc['joins'][_0x215d4d][_0x1126('0x79')],_0x2d2dfc[_0x1126('0x78')][_0x215d4d][_0x1126('0x7a')],_0x2d2dfc['joins'][_0x215d4d]['foreignKey']));}}}if(_0x2d2dfc['conditions']){_0x2d2dfc[_0x1126('0x7c')]=JSON[_0x1126('0x7d')](_0x2d2dfc[_0x1126('0x7c')]);_0x48f914[_0x1126('0x39')](_0x228552(_0x2d2dfc['conditions'][_0x1126('0x66')]));}_0x50238d=_0x48f914[_0x1126('0x8b')]();_0x48f914[_0x1126('0x1c')](_0x2af2d0);_0x48f914[_0x1126('0x1b')](0x0);return;}})[_0x1126('0x23')](function(){if(_0x5679ec['output']===_0x1126('0x8c')){return null;}var _0x21c487=_['merge'](_0x5679ec,{'name':_0x5679ec[_0x1126('0x8d')]||_0x5679ec['name']||_0x2d2dfc['name'],'basename':_0x2d6fcf,'savename':util[_0x1126('0x73')]('%s-%s.%s',_0x5679ec[_0x1126('0x29')]||_0x2d2dfc[_0x1126('0x29')],require(_0x1126('0x8e'))[_0x1126('0x8f')](0x4),_0x5679ec[_0x1126('0x90')]||_0x1126('0x91')),'reportId':_0x2d2dfc['id'],'reportType':_0x1126('0x92')});return db[_0x1126('0x93')][_0x1126('0x49')](_0x21c487,{'raw':!![]});})['then'](function(_0x2577f5){if(_0x2d2dfc[_0x1126('0x6e')]===_0x1126('0x94')){_0x50238d[_0x1126('0x39')](_0x2d2dfc['table']+_0x1126('0x95'),_0x5679ec[_0x1126('0x96')],_0x5679ec[_0x1126('0x97')]);}else{_0x50238d[_0x1126('0x39')](_0x2d2dfc['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5679ec['startDate'],_0x5679ec[_0x1126('0x97')]);}if(_0x2577f5){logger['info'](_0x1126('0x98'),_0x50238d[_0x1126('0x7f')]());require('child_process')['fork'](path[_0x1126('0x52')](__dirname,_0x1126('0x99'),_0x2577f5['output']),[_0x2577f5['id'],_0x50238d[_0x1126('0x7f')](),path[_0x1126('0x52')](__dirname,'../../files/reports',_0x2577f5[_0x1126('0x9a')]),_0x2d6fcf]);return _0x2577f5;}else{var _0x4a9941=squel[_0x1126('0x88')]();_0x4a9941[_0x1126('0x6d')]('('+_0x50238d[_0x1126('0x7f')]()+')','countTable');_0x4a9941[_0x1126('0x67')](_0x1126('0x9b'),_0x1126('0x3f'));_0x50238d[_0x1126('0x1c')](_0x5679ec[_0x1126('0x1c')]||_0x2af2d0);_0x50238d[_0x1126('0x1b')](_0x5679ec[_0x1126('0x1b')]||0x0);return dbH[_0x1126('0x80')][_0x1126('0x31')](_0x4a9941[_0x1126('0x7f')](),{'type':dbH[_0x1126('0x80')][_0x1126('0x81')][_0x1126('0x82')]})[_0x1126('0x23')](function(_0x12ffa5){if(!_0x12ffa5[_0x1126('0x44')]){_0x5d6edb=0x0;}else{_0x5d6edb=_0x12ffa5[0x0][_0x1126('0x3f')]||0x0;}return dbH['sequelize'][_0x1126('0x31')](_0x50238d[_0x1126('0x7f')](),{'type':dbH['sequelize']['QueryTypes'][_0x1126('0x82')]});})[_0x1126('0x23')](function(_0x35065c){return{'rows':_0x35065c||[],'count':_0x5d6edb};});}});}exports[_0x1126('0x9c')]=function(_0x5c0215,_0x444f94){return runReport(_0x5c0215[_0x1126('0x50')],_0x5c0215['query'],_0x5c0215[_0x1126('0x46')])['then'](respondWithResult(_0x444f94,null))[_0x1126('0x48')](handleError(_0x444f94,null));};exports[_0x1126('0x9d')]=runReport;exports['query']=function(_0x4d43ad,_0xa02d9e){var _0x548f9e=0xa;var _0x5edb83=[_0x1126('0x52'),_0x1126('0x83'),_0x1126('0x53'),_0x1126('0x54')];var _0x4f29ce={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x1126('0x57'),'MAX':_0x1126('0x58'),'MIN':'MIN(%s)','AVG':_0x1126('0x84'),'GROUP_CONCAT':_0x1126('0x5a'),'GROUP_CONCAT ASC':_0x1126('0x5b'),'GROUP_CONCAT DESC':_0x1126('0x5c')};var _0x17b25d={'SEC_TO_TIME':_0x1126('0x5d'),'DATE':_0x1126('0x85'),'HOUR':_0x1126('0x5e'),'ROUND':_0x1126('0x5f'),'UNIX_TIMESTAMP':_0x1126('0x9e')};var _0x3a4a91=function(_0x55145f){return!_[_0x1126('0x60')](['IS\x20NULL',_0x1126('0x9f'),_0x1126('0x62'),_0x1126('0x63')],_0x55145f);};var _0x4c7dc7=function(_0x33a27b){if(!_0x33a27b||!_0x33a27b[_0x1126('0x64')][_0x1126('0x44')]){return'';}for(var _0x578c1b='(',_0x1562b2=0x0;_0x1562b2<_0x33a27b[_0x1126('0x64')][_0x1126('0x44')];_0x1562b2+=0x1){_0x1562b2>0x0&&(_0x578c1b+='\x20'+_0x33a27b[_0x1126('0x65')]+'\x20');_0x578c1b+=_0x33a27b[_0x1126('0x64')][_0x1562b2]['group']?_0x4c7dc7(_0x33a27b['rules'][_0x1562b2][_0x1126('0x66')]):_0x33a27b[_0x1126('0x64')][_0x1562b2][_0x1126('0x67')]+'\x20'+_0x33a27b[_0x1126('0x64')][_0x1562b2][_0x1126('0x68')]+(_0x3a4a91(_0x33a27b[_0x1126('0x64')][_0x1562b2][_0x1126('0x68')])?'\x20'+_0x33a27b[_0x1126('0x64')][_0x1562b2][_0x1126('0x86')]:'');}return _0x578c1b+')';};var _0x2fb228={'where':{'id':_0x4d43ad[_0x1126('0x50')]['id']}},_0x2c95b6,_0x4a4b43,_0x588f4f,_0x5ac4d6,_0x1168a5;_0x2fb228=_['merge']({},_0x2fb228,_0x4d43ad['options']);return db[_0x1126('0x2b')][_0x1126('0x47')](_0x2fb228)[_0x1126('0x23')](function(_0x48b088){if(_0x48b088){_0x2c95b6=_0x48b088;return _0x48b088[_0x1126('0x69')]();}return null;})[_0x1126('0x23')](function(_0x5a28f9){if(_0x5a28f9){if(!_0x5a28f9[_0x1126('0x44')]){throw new db[(_0x1126('0xa0'))][(_0x1126('0x6a'))](_0x1126('0x6b'),0x193);}_0x4a4b43=_0x5a28f9;return db[_0x1126('0x6c')]['findAll']({'raw':!![]});}return null;})[_0x1126('0x23')](function(_0x1140ec){if(_0x1140ec){_0x588f4f=_['keyBy'](_0x1140ec,'id');var _0x578f5c;var _0x559dae=squel[_0x1126('0x88')]();_0x559dae[_0x1126('0x6d')](_0x2c95b6[_0x1126('0x6e')]);for(var _0x9d7819=0x0;_0x9d7819<_0x4a4b43[_0x1126('0x44')];_0x9d7819+=0x1){_0x578f5c=_0x4a4b43[_0x9d7819]['MetricId']?_0x588f4f[_0x4a4b43[_0x9d7819][_0x1126('0x6f')]]['metric']:_0x4a4b43[_0x9d7819][_0x1126('0x67')];_0x578f5c=_0x4a4b43[_0x9d7819][_0x1126('0x71')]?_['replace'](_0x4f29ce[_0x4a4b43[_0x9d7819]['function']],'%s',_0x578f5c):_0x578f5c;_0x578f5c=_0x4a4b43[_0x9d7819][_0x1126('0x73')]?_[_0x1126('0x72')](_0x17b25d[_0x4a4b43[_0x9d7819]['format']],'%s',_0x578f5c):_0x578f5c;if(_0x4a4b43[_0x9d7819]['groupBy']){_0x559dae[_0x1126('0x66')](_0x578f5c);}_0x4a4b43[_0x9d7819][_0x1126('0x75')]&&_0x559dae[_0x1126('0x89')](_0x578f5c,_0x4a4b43[_0x9d7819][_0x1126('0x75')]===_0x1126('0x76')?![]:!![]);_0x559dae[_0x1126('0x67')](_0x578f5c,_0x4a4b43[_0x9d7819][_0x1126('0x77')]||_0x578f5c);}if(_0x2c95b6[_0x1126('0x78')]){_0x2c95b6[_0x1126('0x78')]=JSON[_0x1126('0x7d')](_0x2c95b6['joins']);for(var _0x4d6528=0x0;_0x4d6528<_0x2c95b6[_0x1126('0x78')][_0x1126('0x44')];_0x4d6528+=0x1){if(_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x2e')]&&_[_0x1126('0x60')](_0x5edb83,_0x2c95b6[_0x1126('0x78')][_0x4d6528]['type'])&&_0x2c95b6['joins'][_0x4d6528][_0x1126('0x79')]&&_0x2c95b6['joins'][_0x4d6528]['foreignTable']&&_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x7b')]){_0x559dae[_0x2c95b6['joins'][_0x4d6528][_0x1126('0x2e')]](_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x7a')],null,util[_0x1126('0x73')]('%s.%s\x20=\x20%s.%s',_0x2c95b6[_0x1126('0x6e')],_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x79')],_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x7a')],_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x7b')]));}}}if(_0x2c95b6['conditions']){_0x2c95b6[_0x1126('0x7c')]=JSON[_0x1126('0x7d')](_0x2c95b6[_0x1126('0x7c')]);_0x559dae[_0x1126('0x39')](_0x4c7dc7(_0x2c95b6['conditions'][_0x1126('0x66')]));}_0x1168a5=_0x559dae[_0x1126('0x8b')]();_0x559dae['limit'](_0x548f9e);_0x559dae[_0x1126('0x1b')](0x0);logger[_0x1126('0xa1')](_0x1126('0x7e'),_0x559dae['toString']());return dbH[_0x1126('0x80')][_0x1126('0x31')](_0x559dae[_0x1126('0x7f')](),{'type':dbH[_0x1126('0x80')][_0x1126('0x81')][_0x1126('0x82')]});}})['then'](function(){return{'sql':_0x1168a5[_0x1126('0x7f')]()};})[_0x1126('0x23')](respondWithResult(_0xa02d9e,null))['catch'](handleError(_0xa02d9e,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 31cb616..a04da64 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 _0x741d=['path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','util','moment','request-promise'];(function(_0x8f6fa5,_0x320980){var _0x2e1201=function(_0x92e939){while(--_0x92e939){_0x8f6fa5['push'](_0x8f6fa5['shift']());}};_0x2e1201(++_0x320980);}(_0x741d,0xef));var _0xd741=function(_0x57d452,_0x1c7d16){_0x57d452=_0x57d452-0x0;var _0x2e12d2=_0x741d[_0x57d452];return _0x2e12d2;};'use strict';var _=require('lodash');var util=require(_0xd741('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xd741('0x1'));var BPromise=require('bluebird');var rp=require(_0xd741('0x2'));var fs=require('fs');var path=require(_0xd741('0x3'));var rimraf=require(_0xd741('0x4'));var config=require(_0xd741('0x5'));var attributes=require(_0xd741('0x6'));module[_0xd741('0x7')]=function(_0x164197,_0x5a67e4){return _0x164197[_0xd741('0x8')](_0xd741('0x9'),attributes,{'tableName':_0xd741('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7027=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','analytics_default_reports','util'];(function(_0x190349,_0x5b508e){var _0x1a236c=function(_0x4b1e56){while(--_0x4b1e56){_0x190349['push'](_0x190349['shift']());}};_0x1a236c(++_0x5b508e);}(_0x7027,0x1af));var _0x7702=function(_0x1076ae,_0x4da4e1){_0x1076ae=_0x1076ae-0x0;var _0x263108=_0x7027[_0x1076ae];return _0x263108;};'use strict';var _=require('lodash');var util=require(_0x7702('0x0'));var logger=require('../../config/logger')(_0x7702('0x1'));var moment=require(_0x7702('0x2'));var BPromise=require(_0x7702('0x3'));var rp=require(_0x7702('0x4'));var fs=require('fs');var path=require(_0x7702('0x5'));var rimraf=require(_0x7702('0x6'));var config=require(_0x7702('0x7'));var attributes=require(_0x7702('0x8'));module[_0x7702('0x9')]=function(_0xb07ec4,_0x1aa36a){return _0xb07ec4[_0x7702('0xa')]('AnalyticDefaultReport',attributes,{'tableName':_0x7702('0xb'),'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 9130260..bdaf87d 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 _0xcfca=['result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x28ccd4,_0x83c4c){var _0x220be4=function(_0x2669db){while(--_0x2669db){_0x28ccd4['push'](_0x28ccd4['shift']());}};_0x220be4(++_0x83c4c);}(_0xcfca,0x152));var _0xacfc=function(_0x316a8c,_0x187236){_0x316a8c=_0x316a8c-0x0;var _0xf54b36=_0xcfca[_0x316a8c];return _0xf54b36;};'use strict';var _=require(_0xacfc('0x0'));var util=require(_0xacfc('0x1'));var moment=require(_0xacfc('0x2'));var BPromise=require(_0xacfc('0x3'));var rs=require(_0xacfc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xacfc('0x5'));var logger=require(_0xacfc('0x6'))(_0xacfc('0x7'));var config=require(_0xacfc('0x8'));var jayson=require(_0xacfc('0x9'));var client=jayson[_0xacfc('0xa')][_0xacfc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5bc9de,_0x2188da,_0x49c779){return new BPromise(function(_0x5e6e8e,_0x7263de){return client['request'](_0x5bc9de,_0x49c779)['then'](function(_0x7420b4){logger[_0xacfc('0xc')](_0xacfc('0xd'),_0x2188da,_0xacfc('0xe'));logger['debug'](_0xacfc('0xf'),_0x2188da,'request\x20sent',JSON['stringify'](_0x7420b4));if(_0x7420b4[_0xacfc('0x10')]){if(_0x7420b4[_0xacfc('0x10')][_0xacfc('0x11')]===0x1f4){logger['error'](_0xacfc('0xd'),_0x2188da,_0x7420b4[_0xacfc('0x10')][_0xacfc('0x12')]);return _0x7263de(_0x7420b4[_0xacfc('0x10')][_0xacfc('0x12')]);}logger[_0xacfc('0x10')](_0xacfc('0xd'),_0x2188da,_0x7420b4['error']['message']);return _0x5e6e8e(_0x7420b4[_0xacfc('0x10')][_0xacfc('0x12')]);}else{logger['info'](_0xacfc('0xd'),_0x2188da,_0xacfc('0xe'));_0x5e6e8e(_0x7420b4[_0xacfc('0x13')][_0xacfc('0x12')]);}})[_0xacfc('0x14')](function(_0x23a610){logger[_0xacfc('0x10')](_0xacfc('0xd'),_0x2188da,_0x23a610);_0x7263de(_0x23a610);});});} \ No newline at end of file +var _0xf5cc=['AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','then','info','debug'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xf5cc,0x127));var _0xcf5c=function(_0x571c1d,_0x3b0586){_0x571c1d=_0x571c1d-0x0;var _0x33c609=_0xf5cc[_0x571c1d];return _0x33c609;};'use strict';var _=require('lodash');var util=require(_0xcf5c('0x0'));var moment=require(_0xcf5c('0x1'));var BPromise=require(_0xcf5c('0x2'));var rs=require(_0xcf5c('0x3'));var fs=require('fs');var Redis=require(_0xcf5c('0x4'));var db=require(_0xcf5c('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xcf5c('0x6'));var client=jayson[_0xcf5c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x263938,_0xbf6e20,_0x407c0c){return new BPromise(function(_0x26c5ca,_0x3f7d64){return client['request'](_0x263938,_0x407c0c)[_0xcf5c('0x8')](function(_0x26607c){logger[_0xcf5c('0x9')]('AnalyticDefaultReport,\x20%s,\x20%s',_0xbf6e20,'request\x20sent');logger[_0xcf5c('0xa')](_0xcf5c('0xb'),_0xbf6e20,_0xcf5c('0xc'),JSON['stringify'](_0x26607c));if(_0x26607c[_0xcf5c('0xd')]){if(_0x26607c[_0xcf5c('0xd')][_0xcf5c('0xe')]===0x1f4){logger[_0xcf5c('0xd')](_0xcf5c('0xf'),_0xbf6e20,_0x26607c[_0xcf5c('0xd')][_0xcf5c('0x10')]);return _0x3f7d64(_0x26607c[_0xcf5c('0xd')]['message']);}logger[_0xcf5c('0xd')](_0xcf5c('0xf'),_0xbf6e20,_0x26607c[_0xcf5c('0xd')][_0xcf5c('0x10')]);return _0x26c5ca(_0x26607c['error'][_0xcf5c('0x10')]);}else{logger[_0xcf5c('0x9')](_0xcf5c('0xf'),_0xbf6e20,_0xcf5c('0xc'));_0x26c5ca(_0x26607c[_0xcf5c('0x11')]['message']);}})['catch'](function(_0x4e9817){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0xbf6e20,_0x4e9817);_0x3f7d64(_0x4e9817);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 86bda7a..36e6a57 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 _0x66ef=['./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','preview','/:id/run','query','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x4581cb,_0x166469){var _0x11593f=function(_0x4447bd){while(--_0x4447bd){_0x4581cb['push'](_0x4581cb['shift']());}};_0x11593f(++_0x166469);}(_0x66ef,0x123));var _0xf66e=function(_0x2283e2,_0x49043f){_0x2283e2=_0x2283e2-0x0;var _0x1fe85b=_0x66ef[_0x2283e2];return _0x1fe85b;};'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('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf66e('0x6'));var config=require(_0xf66e('0x7'));var controller=require(_0xf66e('0x8'));router[_0xf66e('0x9')]('/',auth[_0xf66e('0xa')](),controller[_0xf66e('0xb')]);router[_0xf66e('0x9')](_0xf66e('0xc'),auth[_0xf66e('0xa')](),controller[_0xf66e('0xd')]);router[_0xf66e('0x9')]('/:id/preview',auth[_0xf66e('0xa')](),controller[_0xf66e('0xe')]);router['get'](_0xf66e('0xf'),auth[_0xf66e('0xa')](),controller['run']);router[_0xf66e('0x9')]('/:id/query',auth['isAuthenticated'](),controller[_0xf66e('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf66e('0x11')]);router[_0xf66e('0x12')](_0xf66e('0xc'),auth[_0xf66e('0xa')](),controller[_0xf66e('0x13')]);router[_0xf66e('0x14')](_0xf66e('0xc'),auth[_0xf66e('0xa')](),controller[_0xf66e('0x15')]);module[_0xf66e('0x16')]=router; \ No newline at end of file +var _0x68fb=['put','delete','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create'];(function(_0x5749fa,_0x57f51e){var _0x2ffe02=function(_0xb18855){while(--_0xb18855){_0x5749fa['push'](_0x5749fa['shift']());}};_0x2ffe02(++_0x57f51e);}(_0x68fb,0x1d1));var _0xb68f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x68fb[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xb68f('0x0'));var path=require('path');var timeout=require(_0xb68f('0x1'));var express=require('express');var router=express[_0xb68f('0x2')]();var fs_extra=require(_0xb68f('0x3'));var auth=require(_0xb68f('0x4'));var interaction=require(_0xb68f('0x5'));var config=require('../../config/environment');var controller=require('./analyticDefaultReport.controller');router[_0xb68f('0x6')]('/',auth[_0xb68f('0x7')](),controller[_0xb68f('0x8')]);router[_0xb68f('0x6')](_0xb68f('0x9'),auth[_0xb68f('0x7')](),controller[_0xb68f('0xa')]);router[_0xb68f('0x6')](_0xb68f('0xb'),auth[_0xb68f('0x7')](),controller[_0xb68f('0xc')]);router[_0xb68f('0x6')](_0xb68f('0xd'),auth[_0xb68f('0x7')](),controller[_0xb68f('0xe')]);router['get'](_0xb68f('0xf'),auth[_0xb68f('0x7')](),controller[_0xb68f('0x10')]);router[_0xb68f('0x11')]('/',auth[_0xb68f('0x7')](),controller[_0xb68f('0x12')]);router[_0xb68f('0x13')](_0xb68f('0x9'),auth[_0xb68f('0x7')](),controller['update']);router[_0xb68f('0x14')](_0xb68f('0x9'),auth[_0xb68f('0x7')](),controller['destroy']);module[_0xb68f('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index c50d202..5a983fc 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 _0x0301=['sequelize','moment','STRING','ENUM','csv','pdf','xlsx','DATE','manual','INTEGER','UNSIGNED'];(function(_0x1a9713,_0x2197de){var _0xf59b37=function(_0x193709){while(--_0x193709){_0x1a9713['push'](_0x1a9713['shift']());}};_0xf59b37(++_0x2197de);}(_0x0301,0xe7));var _0x1030=function(_0x2cb91f,_0x406af5){_0x2cb91f=_0x2cb91f-0x0;var _0x51c7e3=_0x0301[_0x2cb91f];return _0x51c7e3;};'use strict';var Sequelize=require(_0x1030('0x0'));var moment=require(_0x1030('0x1'));module['exports']={'name':{'type':Sequelize[_0x1030('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x1030('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x1030('0x3')](_0x1030('0x4'),_0x1030('0x5'),_0x1030('0x6')),'allowNull':![],'defaultValue':_0x1030('0x4')},'savename':{'type':Sequelize[_0x1030('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x1030('0x7')]},'endDate':{'type':Sequelize[_0x1030('0x7')]},'status':{'type':Sequelize[_0x1030('0x2')],'defaultValue':'Loading'},'type':{'type':Sequelize['ENUM']('manual','scheduled'),'allowNull':![],'defaultValue':_0x1030('0x8')},'reportId':{'type':Sequelize[_0x1030('0x9')](0xb)[_0x1030('0xa')]},'reportType':{'type':Sequelize[_0x1030('0x2')]}}; \ No newline at end of file +var _0x156b=['manual','scheduled','INTEGER','sequelize','moment','exports','STRING','csv','pdf','DATE','Loading','ENUM'];(function(_0x2142f0,_0x4ffea8){var _0x573b7f=function(_0x3c9853){while(--_0x3c9853){_0x2142f0['push'](_0x2142f0['shift']());}};_0x573b7f(++_0x4ffea8);}(_0x156b,0x87));var _0xb156=function(_0x1a1131,_0x404e25){_0x1a1131=_0x1a1131-0x0;var _0x2a73ee=_0x156b[_0x1a1131];return _0x2a73ee;};'use strict';var Sequelize=require(_0xb156('0x0'));var moment=require(_0xb156('0x1'));module[_0xb156('0x2')]={'name':{'type':Sequelize[_0xb156('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0xb156('0x3')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0xb156('0x4'),_0xb156('0x5'),'xlsx'),'allowNull':![],'defaultValue':_0xb156('0x4')},'savename':{'type':Sequelize[_0xb156('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0xb156('0x6')]},'endDate':{'type':Sequelize[_0xb156('0x6')]},'status':{'type':Sequelize[_0xb156('0x3')],'defaultValue':_0xb156('0x7')},'type':{'type':Sequelize[_0xb156('0x8')](_0xb156('0x9'),_0xb156('0xa')),'allowNull':![],'defaultValue':_0xb156('0x9')},'reportId':{'type':Sequelize[_0xb156('0xb')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0xb156('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index ef8add4..99e8a9c 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 _0xd035=['download','basename','savename','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','output','toLowerCase','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','get','ExtractedReports','UserProfileResource','destroy','end','error','stack','name','send','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation'];(function(_0x585e6c,_0x456254){var _0x372276=function(_0x3d7e23){while(--_0x3d7e23){_0x585e6c['push'](_0x585e6c['shift']());}};_0x372276(++_0x456254);}(_0xd035,0x12c));var _0x5d03=function(_0x173452,_0x3aa870){_0x173452=_0x173452-0x0;var _0xee3fd0=_0xd035[_0x173452];return _0xee3fd0;};'use strict';var emlformat=require(_0x5d03('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5d03('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5d03('0x2'));var moment=require(_0x5d03('0x3'));var BPromise=require(_0x5d03('0x4'));var Mustache=require('mustache');var util=require(_0x5d03('0x5'));var path=require(_0x5d03('0x6'));var sox=require(_0x5d03('0x7'));var csv=require('to-csv');var ejs=require(_0x5d03('0x8'));var fs=require('fs');var fs_extra=require(_0x5d03('0x9'));var _=require(_0x5d03('0xa'));var squel=require(_0x5d03('0xb'));var crypto=require(_0x5d03('0xc'));var jsforce=require(_0x5d03('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5d03('0xe'));var Papa=require(_0x5d03('0xf'));var Redis=require('ioredis');var authService=require(_0x5d03('0x10'));var qs=require(_0x5d03('0x11'));var as=require(_0x5d03('0x12'));var hardwareService=require(_0x5d03('0x13'));var logger=require('../../config/logger')(_0x5d03('0x14'));var utils=require(_0x5d03('0x15'));var config=require(_0x5d03('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5d03('0x17'))['db'];function respondWithStatusCode(_0x416161,_0xe259d5){_0xe259d5=_0xe259d5||0xcc;return function(_0x22ce2e){if(_0x22ce2e){return _0x416161[_0x5d03('0x18')](_0xe259d5);}return _0x416161[_0x5d03('0x19')](_0xe259d5)['end']();};}function respondWithResult(_0x3b683e,_0x1a9caa){_0x1a9caa=_0x1a9caa||0xc8;return function(_0x10595c){if(_0x10595c){return _0x3b683e['status'](_0x1a9caa)[_0x5d03('0x1a')](_0x10595c);}};}function respondWithFilteredResult(_0x3bb924,_0x36f4b5){return function(_0x30f691){if(_0x30f691){var _0x33d874=typeof _0x36f4b5[_0x5d03('0x1b')]===_0x5d03('0x1c')&&typeof _0x36f4b5['limit']==='undefined';var _0x4ec4f1=_0x30f691[_0x5d03('0x1d')];var _0x9dcf86=_0x33d874?0x0:_0x36f4b5[_0x5d03('0x1b')];var _0x3a9fab=_0x33d874?_0x30f691[_0x5d03('0x1d')]:_0x36f4b5['offset']+_0x36f4b5[_0x5d03('0x1e')];var _0x4825bd;if(_0x3a9fab>=_0x4ec4f1){_0x3a9fab=_0x4ec4f1;_0x4825bd=0xc8;}else{_0x4825bd=0xce;}_0x3bb924[_0x5d03('0x19')](_0x4825bd);return _0x3bb924[_0x5d03('0x1f')](_0x5d03('0x20'),_0x9dcf86+'-'+_0x3a9fab+'/'+_0x4ec4f1)[_0x5d03('0x1a')](_0x30f691);}return null;};}function patchUpdates(_0x43bca4){return function(_0x3c7817){try{jsonpatch[_0x5d03('0x21')](_0x3c7817,_0x43bca4,!![]);}catch(_0x1c70df){return BPromise['reject'](_0x1c70df);}return _0x3c7817[_0x5d03('0x22')]();};}function saveUpdates(_0xfae50b,_0x3e884e){return function(_0x537627){if(_0x537627){return _0x537627[_0x5d03('0x23')](_0xfae50b)[_0x5d03('0x24')](function(_0x16e033){return _0x16e033;});}return null;};}function removeEntity(_0x1e5b01,_0xe7db1){return function(_0x4f4e17){if(_0x4f4e17){return _0x4f4e17['destroy']()[_0x5d03('0x24')](function(){var _0x5a0449=_0x4f4e17[_0x5d03('0x25')]({'plain':!![]});var _0x15589d=_0x5d03('0x26');return db[_0x5d03('0x27')][_0x5d03('0x28')]({'where':{'type':_0x15589d,'resourceId':_0x5a0449['id']}})['then'](function(){return _0x4f4e17;});})[_0x5d03('0x24')](function(){_0x1e5b01[_0x5d03('0x19')](0xcc)[_0x5d03('0x29')]();});}};}function handleEntityNotFound(_0x31a03e,_0x35975f){return function(_0x38100a){if(!_0x38100a){_0x31a03e[_0x5d03('0x18')](0x194);}return _0x38100a;};}function handleError(_0x4f5eba,_0x909aaa){_0x909aaa=_0x909aaa||0x1f4;return function(_0x568b3c){logger[_0x5d03('0x2a')](_0x568b3c[_0x5d03('0x2b')]);if(_0x568b3c[_0x5d03('0x2c')]){delete _0x568b3c[_0x5d03('0x2c')];}_0x4f5eba[_0x5d03('0x19')](_0x909aaa)[_0x5d03('0x2d')](_0x568b3c);};}exports['index']=function(_0x541431,_0x38e24f){var _0x5c59c5={},_0x44f3ac={},_0x294158={'count':0x0,'rows':[]};var _0x4c0350=_[_0x5d03('0x2e')](db[_0x5d03('0x2f')][_0x5d03('0x30')],function(_0x4ab344){return{'name':_0x4ab344[_0x5d03('0x31')],'type':_0x4ab344[_0x5d03('0x32')][_0x5d03('0x33')]};});_0x44f3ac['model']=_['map'](_0x4c0350,_0x5d03('0x2c'));_0x44f3ac['query']=_['keys'](_0x541431[_0x5d03('0x34')]);_0x44f3ac[_0x5d03('0x35')]=_[_0x5d03('0x36')](_0x44f3ac[_0x5d03('0x37')],_0x44f3ac[_0x5d03('0x34')]);_0x5c59c5[_0x5d03('0x38')]=_[_0x5d03('0x36')](_0x44f3ac[_0x5d03('0x37')],qs[_0x5d03('0x39')](_0x541431[_0x5d03('0x34')][_0x5d03('0x39')]));_0x5c59c5[_0x5d03('0x38')]=_0x5c59c5[_0x5d03('0x38')][_0x5d03('0x3a')]?_0x5c59c5['attributes']:_0x44f3ac[_0x5d03('0x37')];if(!_0x541431[_0x5d03('0x34')][_0x5d03('0x3b')](_0x5d03('0x3c'))){_0x5c59c5['limit']=qs['limit'](_0x541431['query'][_0x5d03('0x1e')]);_0x5c59c5[_0x5d03('0x1b')]=qs['offset'](_0x541431[_0x5d03('0x34')][_0x5d03('0x1b')]);}_0x5c59c5[_0x5d03('0x3d')]=qs[_0x5d03('0x3e')](_0x541431[_0x5d03('0x34')]['sort']);_0x5c59c5['where']=qs['filters'](_['pick'](_0x541431[_0x5d03('0x34')],_0x44f3ac[_0x5d03('0x35')]),_0x4c0350);if(_0x541431['query'][_0x5d03('0x3f')]){_0x5c59c5[_0x5d03('0x40')]=_[_0x5d03('0x41')](_0x5c59c5[_0x5d03('0x40')],{'$or':_[_0x5d03('0x2e')](_0x4c0350,function(_0x24d68e){if(_0x24d68e['type']!==_0x5d03('0x42')){var _0xfb043a={};_0xfb043a[_0x24d68e[_0x5d03('0x2c')]]={'$like':'%'+_0x541431['query'][_0x5d03('0x3f')]+'%'};return _0xfb043a;}})});}_0x5c59c5=_['merge']({},_0x5c59c5,_0x541431[_0x5d03('0x43')]);var _0x1cce26={'where':_0x5c59c5[_0x5d03('0x40')]};return db[_0x5d03('0x2f')]['count'](_0x1cce26)[_0x5d03('0x24')](function(_0x2ca4ef){_0x294158[_0x5d03('0x1d')]=_0x2ca4ef;if(_0x541431[_0x5d03('0x34')][_0x5d03('0x44')]){_0x5c59c5[_0x5d03('0x45')]=[{'all':!![]}];}return db[_0x5d03('0x2f')][_0x5d03('0x46')](_0x5c59c5);})[_0x5d03('0x24')](function(_0x19a18d){_0x294158[_0x5d03('0x47')]=_0x19a18d;return _0x294158;})[_0x5d03('0x24')](respondWithFilteredResult(_0x38e24f,_0x5c59c5))['catch'](handleError(_0x38e24f,null));};exports[_0x5d03('0x48')]=function(_0x4347f7,_0x32d853){var _0x4aa47e={'raw':!![],'where':{'id':_0x4347f7[_0x5d03('0x49')]['id']}},_0x19b405={};_0x19b405[_0x5d03('0x37')]=_[_0x5d03('0x4a')](db['AnalyticExtractedReport'][_0x5d03('0x30')]);_0x19b405[_0x5d03('0x34')]=_['keys'](_0x4347f7[_0x5d03('0x34')]);_0x19b405['filters']=_[_0x5d03('0x36')](_0x19b405[_0x5d03('0x37')],_0x19b405[_0x5d03('0x34')]);_0x4aa47e['attributes']=_['intersection'](_0x19b405[_0x5d03('0x37')],qs[_0x5d03('0x39')](_0x4347f7[_0x5d03('0x34')][_0x5d03('0x39')]));_0x4aa47e['attributes']=_0x4aa47e[_0x5d03('0x38')]['length']?_0x4aa47e[_0x5d03('0x38')]:_0x19b405[_0x5d03('0x37')];if(_0x4347f7[_0x5d03('0x34')]['includeAll']){_0x4aa47e[_0x5d03('0x45')]=[{'all':!![]}];}_0x4aa47e=_[_0x5d03('0x41')]({},_0x4aa47e,_0x4347f7[_0x5d03('0x43')]);return db[_0x5d03('0x2f')]['find'](_0x4aa47e)[_0x5d03('0x24')](handleEntityNotFound(_0x32d853,null))['then'](respondWithResult(_0x32d853,null))[_0x5d03('0x4b')](handleError(_0x32d853,null));};exports[_0x5d03('0x4c')]=function(_0x538d13,_0x23e86e){return db['AnalyticExtractedReport'][_0x5d03('0x4c')](_0x538d13[_0x5d03('0x4d')],{})[_0x5d03('0x24')](function(_0x415a45){var _0x373c6f=_0x538d13[_0x5d03('0x4e')][_0x5d03('0x25')]({'plain':!![]});if(!_0x373c6f)throw new Error(_0x5d03('0x4f'));if(_0x373c6f[_0x5d03('0x50')]===_0x5d03('0x4e')){var _0x18e74a=_0x415a45[_0x5d03('0x25')]({'plain':!![]});var _0x35090c='ExtractedReports';return db[_0x5d03('0x51')][_0x5d03('0x52')]({'where':{'name':_0x35090c,'userProfileId':_0x373c6f['userProfileId']},'raw':!![]})[_0x5d03('0x24')](function(_0x2959cc){if(_0x2959cc&&_0x2959cc[_0x5d03('0x53')]===0x0){return db[_0x5d03('0x27')]['create']({'name':_0x18e74a['name'],'resourceId':_0x18e74a['id'],'type':_0x2959cc[_0x5d03('0x2c')],'sectionId':_0x2959cc['id']},{})[_0x5d03('0x24')](function(){return _0x415a45;});}else{return _0x415a45;}})[_0x5d03('0x4b')](function(_0x9eeb44){logger[_0x5d03('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x9eeb44);throw _0x9eeb44;});}return _0x415a45;})[_0x5d03('0x24')](respondWithResult(_0x23e86e,0xc9))[_0x5d03('0x4b')](handleError(_0x23e86e,null));};exports['update']=function(_0x4f8541,_0x46cc29){if(_0x4f8541[_0x5d03('0x4d')]['id']){delete _0x4f8541['body']['id'];}return db[_0x5d03('0x2f')]['find']({'where':{'id':_0x4f8541[_0x5d03('0x49')]['id']}})[_0x5d03('0x24')](handleEntityNotFound(_0x46cc29,null))['then'](saveUpdates(_0x4f8541[_0x5d03('0x4d')],null))[_0x5d03('0x24')](respondWithResult(_0x46cc29,null))[_0x5d03('0x4b')](handleError(_0x46cc29,null));};exports[_0x5d03('0x28')]=function(_0x709ba7,_0x183711){return db[_0x5d03('0x2f')][_0x5d03('0x52')]({'where':{'id':_0x709ba7[_0x5d03('0x49')]['id']}})[_0x5d03('0x24')](handleEntityNotFound(_0x183711,null))[_0x5d03('0x24')](removeEntity(_0x183711,null))[_0x5d03('0x4b')](handleError(_0x183711,null));};exports[_0x5d03('0x54')]=function(_0x23e549,_0x38d016,_0x51a153){return db[_0x5d03('0x2f')][_0x5d03('0x52')]({'where':{'id':_0x23e549[_0x5d03('0x49')]['id']},'attributes':[_0x5d03('0x2c'),_0x5d03('0x55'),_0x5d03('0x56'),'output'],'raw':!![]})[_0x5d03('0x24')](handleEntityNotFound(_0x38d016,null))[_0x5d03('0x24')](function(_0x47924a){if(_0x47924a){if(!fs['existsSync'](path[_0x5d03('0x57')](config[_0x5d03('0x58')],_0x5d03('0x59'),_0x47924a['savename']))){throw new db[(_0x5d03('0x5a'))][(_0x5d03('0x5b'))](_0x5d03('0x5c'));}if(_0x23e549['query'][_0x5d03('0x5d')]){return _0x38d016['sendStatus'](0xc8);}return _0x38d016['download'](path['join'](config['root'],_0x5d03('0x59'),_0x47924a[_0x5d03('0x56')]),util['format']('%s.%s',_0x47924a[_0x5d03('0x55')]||_0x47924a[_0x5d03('0x2c')],_0x47924a[_0x5d03('0x5e')][_0x5d03('0x5f')]()));}})['catch'](handleError(_0x38d016,null));}; \ No newline at end of file +var _0x1daf=['apply','reject','save','destroy','then','get','ExtractedReports','UserProfileResource','error','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','AnalyticExtractedReport','includeAll','include','findAll','rows','catch','show','params','length','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','create','update','download','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','fs-extra','lodash','crypto','jsforce','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json'];(function(_0x2597cc,_0x40b415){var _0xaa509f=function(_0x121adf){while(--_0x121adf){_0x2597cc['push'](_0x2597cc['shift']());}};_0xaa509f(++_0x40b415);}(_0x1daf,0xa0));var _0xf1da=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x1daf[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0xf1da('0x0'));var rimraf=require(_0xf1da('0x1'));var zipdir=require(_0xf1da('0x2'));var jsonpatch=require(_0xf1da('0x3'));var rp=require(_0xf1da('0x4'));var moment=require(_0xf1da('0x5'));var BPromise=require(_0xf1da('0x6'));var Mustache=require(_0xf1da('0x7'));var util=require('util');var path=require(_0xf1da('0x8'));var sox=require(_0xf1da('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf1da('0xa'));var _=require(_0xf1da('0xb'));var squel=require('squel');var crypto=require(_0xf1da('0xc'));var jsforce=require(_0xf1da('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf1da('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf1da('0xf'));var qs=require(_0xf1da('0x10'));var as=require(_0xf1da('0x11'));var hardwareService=require(_0xf1da('0x12'));var logger=require(_0xf1da('0x13'))(_0xf1da('0x14'));var utils=require(_0xf1da('0x15'));var config=require(_0xf1da('0x16'));var licenseUtil=require(_0xf1da('0x17'));var db=require(_0xf1da('0x18'))['db'];function respondWithStatusCode(_0x17f470,_0x5a71e5){_0x5a71e5=_0x5a71e5||0xcc;return function(_0x2d5aee){if(_0x2d5aee){return _0x17f470[_0xf1da('0x19')](_0x5a71e5);}return _0x17f470[_0xf1da('0x1a')](_0x5a71e5)[_0xf1da('0x1b')]();};}function respondWithResult(_0x1944ce,_0x2e46f4){_0x2e46f4=_0x2e46f4||0xc8;return function(_0x329515){if(_0x329515){return _0x1944ce[_0xf1da('0x1a')](_0x2e46f4)['json'](_0x329515);}};}function respondWithFilteredResult(_0x1f3222,_0x14afb6){return function(_0x511ce7){if(_0x511ce7){var _0x4af491=typeof _0x14afb6['offset']===_0xf1da('0x1c')&&typeof _0x14afb6[_0xf1da('0x1d')]==='undefined';var _0x504b40=_0x511ce7[_0xf1da('0x1e')];var _0x3b1a0c=_0x4af491?0x0:_0x14afb6[_0xf1da('0x1f')];var _0x5e444b=_0x4af491?_0x511ce7['count']:_0x14afb6['offset']+_0x14afb6[_0xf1da('0x1d')];var _0x23ca7a;if(_0x5e444b>=_0x504b40){_0x5e444b=_0x504b40;_0x23ca7a=0xc8;}else{_0x23ca7a=0xce;}_0x1f3222[_0xf1da('0x1a')](_0x23ca7a);return _0x1f3222['set'](_0xf1da('0x20'),_0x3b1a0c+'-'+_0x5e444b+'/'+_0x504b40)[_0xf1da('0x21')](_0x511ce7);}return null;};}function patchUpdates(_0x5eaf15){return function(_0x34e8bd){try{jsonpatch[_0xf1da('0x22')](_0x34e8bd,_0x5eaf15,!![]);}catch(_0x4c5f4a){return BPromise[_0xf1da('0x23')](_0x4c5f4a);}return _0x34e8bd[_0xf1da('0x24')]();};}function saveUpdates(_0x1050c1,_0x46c0bd){return function(_0x111903){if(_0x111903){return _0x111903['update'](_0x1050c1)['then'](function(_0x5c7510){return _0x5c7510;});}return null;};}function removeEntity(_0x52cb0c,_0x411599){return function(_0x57e242){if(_0x57e242){return _0x57e242[_0xf1da('0x25')]()[_0xf1da('0x26')](function(){var _0x529853=_0x57e242[_0xf1da('0x27')]({'plain':!![]});var _0x109844=_0xf1da('0x28');return db[_0xf1da('0x29')][_0xf1da('0x25')]({'where':{'type':_0x109844,'resourceId':_0x529853['id']}})[_0xf1da('0x26')](function(){return _0x57e242;});})[_0xf1da('0x26')](function(){_0x52cb0c['status'](0xcc)[_0xf1da('0x1b')]();});}};}function handleEntityNotFound(_0x38407b,_0x2a7ad1){return function(_0x4af31d){if(!_0x4af31d){_0x38407b[_0xf1da('0x19')](0x194);}return _0x4af31d;};}function handleError(_0x166297,_0x4ae60e){_0x4ae60e=_0x4ae60e||0x1f4;return function(_0x5be13e){logger[_0xf1da('0x2a')](_0x5be13e['stack']);if(_0x5be13e[_0xf1da('0x2b')]){delete _0x5be13e[_0xf1da('0x2b')];}_0x166297[_0xf1da('0x1a')](_0x4ae60e)['send'](_0x5be13e);};}exports[_0xf1da('0x2c')]=function(_0x507b25,_0x23ca4e){var _0x4b667f={},_0xc09377={},_0x497e41={'count':0x0,'rows':[]};var _0xab71b=_[_0xf1da('0x2d')](db['AnalyticExtractedReport'][_0xf1da('0x2e')],function(_0x243e35){return{'name':_0x243e35[_0xf1da('0x2f')],'type':_0x243e35[_0xf1da('0x30')][_0xf1da('0x31')]};});_0xc09377[_0xf1da('0x32')]=_[_0xf1da('0x2d')](_0xab71b,_0xf1da('0x2b'));_0xc09377[_0xf1da('0x33')]=_[_0xf1da('0x34')](_0x507b25[_0xf1da('0x33')]);_0xc09377[_0xf1da('0x35')]=_[_0xf1da('0x36')](_0xc09377['model'],_0xc09377[_0xf1da('0x33')]);_0x4b667f[_0xf1da('0x37')]=_['intersection'](_0xc09377['model'],qs[_0xf1da('0x38')](_0x507b25[_0xf1da('0x33')][_0xf1da('0x38')]));_0x4b667f[_0xf1da('0x37')]=_0x4b667f[_0xf1da('0x37')]['length']?_0x4b667f[_0xf1da('0x37')]:_0xc09377[_0xf1da('0x32')];if(!_0x507b25[_0xf1da('0x33')][_0xf1da('0x39')](_0xf1da('0x3a'))){_0x4b667f[_0xf1da('0x1d')]=qs['limit'](_0x507b25['query'][_0xf1da('0x1d')]);_0x4b667f[_0xf1da('0x1f')]=qs[_0xf1da('0x1f')](_0x507b25[_0xf1da('0x33')][_0xf1da('0x1f')]);}_0x4b667f[_0xf1da('0x3b')]=qs[_0xf1da('0x3c')](_0x507b25[_0xf1da('0x33')][_0xf1da('0x3c')]);_0x4b667f[_0xf1da('0x3d')]=qs[_0xf1da('0x35')](_['pick'](_0x507b25[_0xf1da('0x33')],_0xc09377[_0xf1da('0x35')]),_0xab71b);if(_0x507b25[_0xf1da('0x33')][_0xf1da('0x3e')]){_0x4b667f['where']=_[_0xf1da('0x3f')](_0x4b667f['where'],{'$or':_[_0xf1da('0x2d')](_0xab71b,function(_0x479720){if(_0x479720['type']!==_0xf1da('0x40')){var _0x3bee35={};_0x3bee35[_0x479720['name']]={'$like':'%'+_0x507b25['query'][_0xf1da('0x3e')]+'%'};return _0x3bee35;}})});}_0x4b667f=_[_0xf1da('0x3f')]({},_0x4b667f,_0x507b25['options']);var _0x475b3c={'where':_0x4b667f['where']};return db[_0xf1da('0x41')]['count'](_0x475b3c)['then'](function(_0xbf0f){_0x497e41['count']=_0xbf0f;if(_0x507b25[_0xf1da('0x33')][_0xf1da('0x42')]){_0x4b667f[_0xf1da('0x43')]=[{'all':!![]}];}return db[_0xf1da('0x41')][_0xf1da('0x44')](_0x4b667f);})['then'](function(_0x48a5d0){_0x497e41[_0xf1da('0x45')]=_0x48a5d0;return _0x497e41;})[_0xf1da('0x26')](respondWithFilteredResult(_0x23ca4e,_0x4b667f))[_0xf1da('0x46')](handleError(_0x23ca4e,null));};exports[_0xf1da('0x47')]=function(_0x6407b5,_0x2e0c35){var _0x316949={'raw':!![],'where':{'id':_0x6407b5[_0xf1da('0x48')]['id']}},_0x5a7070={};_0x5a7070[_0xf1da('0x32')]=_[_0xf1da('0x34')](db[_0xf1da('0x41')][_0xf1da('0x2e')]);_0x5a7070[_0xf1da('0x33')]=_[_0xf1da('0x34')](_0x6407b5[_0xf1da('0x33')]);_0x5a7070[_0xf1da('0x35')]=_[_0xf1da('0x36')](_0x5a7070[_0xf1da('0x32')],_0x5a7070[_0xf1da('0x33')]);_0x316949[_0xf1da('0x37')]=_[_0xf1da('0x36')](_0x5a7070[_0xf1da('0x32')],qs[_0xf1da('0x38')](_0x6407b5[_0xf1da('0x33')]['fields']));_0x316949[_0xf1da('0x37')]=_0x316949['attributes'][_0xf1da('0x49')]?_0x316949[_0xf1da('0x37')]:_0x5a7070[_0xf1da('0x32')];if(_0x6407b5['query']['includeAll']){_0x316949[_0xf1da('0x43')]=[{'all':!![]}];}_0x316949=_[_0xf1da('0x3f')]({},_0x316949,_0x6407b5['options']);return db[_0xf1da('0x41')][_0xf1da('0x4a')](_0x316949)[_0xf1da('0x26')](handleEntityNotFound(_0x2e0c35,null))[_0xf1da('0x26')](respondWithResult(_0x2e0c35,null))[_0xf1da('0x46')](handleError(_0x2e0c35,null));};exports['create']=function(_0x25f90b,_0x5d8739){return db[_0xf1da('0x41')]['create'](_0x25f90b[_0xf1da('0x4b')],{})[_0xf1da('0x26')](function(_0x6d798){var _0x4e5540=_0x25f90b[_0xf1da('0x4c')][_0xf1da('0x27')]({'plain':!![]});if(!_0x4e5540)throw new Error(_0xf1da('0x4d'));if(_0x4e5540[_0xf1da('0x4e')]===_0xf1da('0x4c')){var _0x24c714=_0x6d798['get']({'plain':!![]});var _0x1bf52a='ExtractedReports';return db[_0xf1da('0x4f')][_0xf1da('0x4a')]({'where':{'name':_0x1bf52a,'userProfileId':_0x4e5540['userProfileId']},'raw':!![]})[_0xf1da('0x26')](function(_0x22bfbd){if(_0x22bfbd&&_0x22bfbd['autoAssociation']===0x0){return db[_0xf1da('0x29')][_0xf1da('0x50')]({'name':_0x24c714[_0xf1da('0x2b')],'resourceId':_0x24c714['id'],'type':_0x22bfbd[_0xf1da('0x2b')],'sectionId':_0x22bfbd['id']},{})[_0xf1da('0x26')](function(){return _0x6d798;});}else{return _0x6d798;}})[_0xf1da('0x46')](function(_0x187672){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x187672);throw _0x187672;});}return _0x6d798;})[_0xf1da('0x26')](respondWithResult(_0x5d8739,0xc9))['catch'](handleError(_0x5d8739,null));};exports[_0xf1da('0x51')]=function(_0x24ef7a,_0x3336ee){if(_0x24ef7a['body']['id']){delete _0x24ef7a[_0xf1da('0x4b')]['id'];}return db[_0xf1da('0x41')]['find']({'where':{'id':_0x24ef7a[_0xf1da('0x48')]['id']}})[_0xf1da('0x26')](handleEntityNotFound(_0x3336ee,null))[_0xf1da('0x26')](saveUpdates(_0x24ef7a[_0xf1da('0x4b')],null))[_0xf1da('0x26')](respondWithResult(_0x3336ee,null))[_0xf1da('0x46')](handleError(_0x3336ee,null));};exports[_0xf1da('0x25')]=function(_0x3b85dd,_0x3e46c2){return db[_0xf1da('0x41')][_0xf1da('0x4a')]({'where':{'id':_0x3b85dd[_0xf1da('0x48')]['id']}})[_0xf1da('0x26')](handleEntityNotFound(_0x3e46c2,null))['then'](removeEntity(_0x3e46c2,null))['catch'](handleError(_0x3e46c2,null));};exports[_0xf1da('0x52')]=function(_0x549482,_0x254dcb,_0x77874e){return db[_0xf1da('0x41')][_0xf1da('0x4a')]({'where':{'id':_0x549482['params']['id']},'attributes':[_0xf1da('0x2b'),_0xf1da('0x53'),_0xf1da('0x54'),_0xf1da('0x55')],'raw':!![]})['then'](handleEntityNotFound(_0x254dcb,null))['then'](function(_0x197d4e){if(_0x197d4e){if(!fs[_0xf1da('0x56')](path[_0xf1da('0x57')](config[_0xf1da('0x58')],_0xf1da('0x59'),_0x197d4e[_0xf1da('0x54')]))){throw new db[(_0xf1da('0x5a'))][(_0xf1da('0x5b'))](_0xf1da('0x5c'));}if(_0x549482[_0xf1da('0x33')][_0xf1da('0x5d')]){return _0x254dcb[_0xf1da('0x19')](0xc8);}return _0x254dcb[_0xf1da('0x52')](path[_0xf1da('0x57')](config[_0xf1da('0x58')],_0xf1da('0x59'),_0x197d4e[_0xf1da('0x54')]),util[_0xf1da('0x5e')](_0xf1da('0x5f'),_0x197d4e[_0xf1da('0x53')]||_0x197d4e[_0xf1da('0x2b')],_0x197d4e['output'][_0xf1da('0x60')]()));}})[_0xf1da('0x46')](handleError(_0x254dcb,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 980590c..8b9eca2 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 _0x93f8=['AnalyticExtractedReport','analytics_extracted_reports','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports'];(function(_0x11154e,_0x1f6679){var _0x62962=function(_0x3943ec){while(--_0x3943ec){_0x11154e['push'](_0x11154e['shift']());}};_0x62962(++_0x1f6679);}(_0x93f8,0x1be));var _0x893f=function(_0x695762,_0x5137e1){_0x695762=_0x695762-0x0;var _0x5241c3=_0x93f8[_0x695762];return _0x5241c3;};'use strict';var _=require(_0x893f('0x0'));var util=require('util');var logger=require(_0x893f('0x1'))(_0x893f('0x2'));var moment=require('moment');var BPromise=require(_0x893f('0x3'));var rp=require(_0x893f('0x4'));var fs=require('fs');var path=require(_0x893f('0x5'));var rimraf=require(_0x893f('0x6'));var config=require(_0x893f('0x7'));var attributes=require(_0x893f('0x8'));module[_0x893f('0x9')]=function(_0xbdc308,_0x4048b1){return _0xbdc308['define'](_0x893f('0xa'),attributes,{'tableName':_0x893f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8785=['analytics_extracted_reports','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','define','AnalyticExtractedReport'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0x8785,0x1ed));var _0x5878=function(_0x2c9cf1,_0x1cf0f1){_0x2c9cf1=_0x2c9cf1-0x0;var _0x133ef4=_0x8785[_0x2c9cf1];return _0x133ef4;};'use strict';var _=require(_0x5878('0x0'));var util=require(_0x5878('0x1'));var logger=require(_0x5878('0x2'))('api');var moment=require(_0x5878('0x3'));var BPromise=require(_0x5878('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5878('0x5'));var rimraf=require(_0x5878('0x6'));var config=require(_0x5878('0x7'));var attributes=require('./analyticExtractedReport.attributes');module[_0x5878('0x8')]=function(_0x38e90a,_0x3d85f5){return _0x38e90a[_0x5878('0x9')](_0x5878('0xa'),attributes,{'tableName':_0x5878('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 42e63eb..078d7b1 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 _0x176f=['stringify','error','code','AnalyticExtractedReport,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s'];(function(_0x5a6961,_0xd41ca6){var _0x4af0a6=function(_0x1201fe){while(--_0x1201fe){_0x5a6961['push'](_0x5a6961['shift']());}};_0x4af0a6(++_0xd41ca6);}(_0x176f,0x97));var _0xf176=function(_0x41d246,_0x481f8b){_0x41d246=_0x41d246-0x0;var _0x56541d=_0x176f[_0x41d246];return _0x56541d;};'use strict';var _=require(_0xf176('0x0'));var util=require(_0xf176('0x1'));var moment=require(_0xf176('0x2'));var BPromise=require(_0xf176('0x3'));var rs=require(_0xf176('0x4'));var fs=require('fs');var Redis=require(_0xf176('0x5'));var db=require(_0xf176('0x6'))['db'];var utils=require(_0xf176('0x7'));var logger=require(_0xf176('0x8'))(_0xf176('0x9'));var config=require(_0xf176('0xa'));var jayson=require(_0xf176('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xd420d0,_0xa1bd4b,_0x2b423a){return new BPromise(function(_0x37c633,_0x1f2a35){return client[_0xf176('0xc')](_0xd420d0,_0x2b423a)[_0xf176('0xd')](function(_0x3b3a5a){logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0xa1bd4b,_0xf176('0xe'));logger[_0xf176('0xf')](_0xf176('0x10'),_0xa1bd4b,_0xf176('0xe'),JSON[_0xf176('0x11')](_0x3b3a5a));if(_0x3b3a5a[_0xf176('0x12')]){if(_0x3b3a5a['error'][_0xf176('0x13')]===0x1f4){logger[_0xf176('0x12')](_0xf176('0x14'),_0xa1bd4b,_0x3b3a5a[_0xf176('0x12')]['message']);return _0x1f2a35(_0x3b3a5a['error'][_0xf176('0x15')]);}logger[_0xf176('0x12')](_0xf176('0x14'),_0xa1bd4b,_0x3b3a5a[_0xf176('0x12')][_0xf176('0x15')]);return _0x37c633(_0x3b3a5a['error'][_0xf176('0x15')]);}else{logger[_0xf176('0x16')](_0xf176('0x14'),_0xa1bd4b,_0xf176('0xe'));_0x37c633(_0x3b3a5a['result'][_0xf176('0x15')]);}})[_0xf176('0x17')](function(_0xc3be2f){logger['error'](_0xf176('0x14'),_0xa1bd4b,_0xc3be2f);_0x1f2a35(_0xc3be2f);});});} \ No newline at end of file +var _0x4c35=['info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x4c35,0xd9));var _0x54c3=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0x4c35[_0x342700];return _0x53406f;};'use strict';var _=require(_0x54c3('0x0'));var util=require('util');var moment=require(_0x54c3('0x1'));var BPromise=require(_0x54c3('0x2'));var rs=require(_0x54c3('0x3'));var fs=require('fs');var Redis=require(_0x54c3('0x4'));var db=require(_0x54c3('0x5'))['db'];var utils=require(_0x54c3('0x6'));var logger=require(_0x54c3('0x7'))('rpc');var config=require(_0x54c3('0x8'));var jayson=require(_0x54c3('0x9'));var client=jayson[_0x54c3('0xa')][_0x54c3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bc7cf,_0x5bfa2a,_0x2707c4){return new BPromise(function(_0x3488e9,_0x1c951f){return client['request'](_0x3bc7cf,_0x2707c4)[_0x54c3('0xc')](function(_0x13be2c){logger[_0x54c3('0xd')](_0x54c3('0xe'),_0x5bfa2a,_0x54c3('0xf'));logger[_0x54c3('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x5bfa2a,_0x54c3('0xf'),JSON[_0x54c3('0x11')](_0x13be2c));if(_0x13be2c['error']){if(_0x13be2c[_0x54c3('0x12')][_0x54c3('0x13')]===0x1f4){logger[_0x54c3('0x12')](_0x54c3('0xe'),_0x5bfa2a,_0x13be2c['error'][_0x54c3('0x14')]);return _0x1c951f(_0x13be2c[_0x54c3('0x12')]['message']);}logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x5bfa2a,_0x13be2c['error'][_0x54c3('0x14')]);return _0x3488e9(_0x13be2c[_0x54c3('0x12')][_0x54c3('0x14')]);}else{logger[_0x54c3('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x5bfa2a,_0x54c3('0xf'));_0x3488e9(_0x13be2c[_0x54c3('0x15')][_0x54c3('0x14')]);}})[_0x54c3('0x16')](function(_0x2472d3){logger[_0x54c3('0x12')](_0x54c3('0xe'),_0x5bfa2a,_0x2472d3);_0x1c951f(_0x2472d3);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index d34f778..ce40ca0 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 _0x020c=['update','delete','destroy','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','isAuthenticated','index','get','/:id','/:id/download','download','put'];(function(_0x12f59c,_0x13d956){var _0x2db43e=function(_0x1743fb){while(--_0x1743fb){_0x12f59c['push'](_0x12f59c['shift']());}};_0x2db43e(++_0x13d956);}(_0x020c,0x1d7));var _0xc020=function(_0x2dce5a,_0x2e992b){_0x2dce5a=_0x2dce5a-0x0;var _0x62fa90=_0x020c[_0x2dce5a];return _0x62fa90;};'use strict';var multer=require(_0xc020('0x0'));var util=require(_0xc020('0x1'));var path=require('path');var timeout=require(_0xc020('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc020('0x3'));var auth=require(_0xc020('0x4'));var interaction=require(_0xc020('0x5'));var config=require(_0xc020('0x6'));var controller=require(_0xc020('0x7'));router['get']('/',auth[_0xc020('0x8')](),controller[_0xc020('0x9')]);router[_0xc020('0xa')](_0xc020('0xb'),auth[_0xc020('0x8')](),controller['show']);router[_0xc020('0xa')](_0xc020('0xc'),auth[_0xc020('0x8')](),controller[_0xc020('0xd')]);router['post']('/',auth[_0xc020('0x8')](),controller['create']);router[_0xc020('0xe')]('/:id',auth[_0xc020('0x8')](),controller[_0xc020('0xf')]);router[_0xc020('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xc020('0x11')]);module['exports']=router; \ No newline at end of file +var _0xef56=['isAuthenticated','index','/:id','/:id/download','download','post','create','update','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get'];(function(_0x5e6ea3,_0x9addd2){var _0x4048b5=function(_0x9092e4){while(--_0x9092e4){_0x5e6ea3['push'](_0x5e6ea3['shift']());}};_0x4048b5(++_0x9addd2);}(_0xef56,0xce));var _0x6ef5=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xef56[_0x5608a3];return _0x1ed50a;};'use strict';var multer=require(_0x6ef5('0x0'));var util=require(_0x6ef5('0x1'));var path=require(_0x6ef5('0x2'));var timeout=require('connect-timeout');var express=require(_0x6ef5('0x3'));var router=express[_0x6ef5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6ef5('0x5'));var interaction=require(_0x6ef5('0x6'));var config=require(_0x6ef5('0x7'));var controller=require(_0x6ef5('0x8'));router[_0x6ef5('0x9')]('/',auth[_0x6ef5('0xa')](),controller[_0x6ef5('0xb')]);router[_0x6ef5('0x9')](_0x6ef5('0xc'),auth[_0x6ef5('0xa')](),controller['show']);router['get'](_0x6ef5('0xd'),auth['isAuthenticated'](),controller[_0x6ef5('0xe')]);router[_0x6ef5('0xf')]('/',auth[_0x6ef5('0xa')](),controller[_0x6ef5('0x10')]);router['put']('/:id',auth[_0x6ef5('0xa')](),controller[_0x6ef5('0x11')]);router['delete']('/:id',auth[_0x6ef5('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 957d008..502ac94 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 _0xce48=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x211711,_0x3f64af){var _0x13deec=function(_0x4f50de){while(--_0x4f50de){_0x211711['push'](_0x211711['shift']());}};_0x13deec(++_0x3f64af);}(_0xce48,0x149));var _0x8ce4=function(_0x3fb150,_0x5e32ed){_0x3fb150=_0x3fb150-0x0;var _0x56f4a8=_0xce48[_0x3fb150];return _0x56f4a8;};'use strict';var Sequelize=require(_0x8ce4('0x0'));module[_0x8ce4('0x1')]={'field':{'type':Sequelize[_0x8ce4('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x8ce4('0x3')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0x8ce4('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x8ce4('0x3')]},'custom':{'type':Sequelize[_0x8ce4('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xe4eb=['exports','STRING','BOOLEAN','sequelize'];(function(_0x12a890,_0x4f3cb5){var _0x1a79ef=function(_0x5723f4){while(--_0x5723f4){_0x12a890['push'](_0x12a890['shift']());}};_0x1a79ef(++_0x4f3cb5);}(_0xe4eb,0x67));var _0xbe4e=function(_0x3a4c87,_0x3068ff){_0x3a4c87=_0x3a4c87-0x0;var _0x5ef79c=_0xe4eb[_0x3a4c87];return _0x5ef79c;};'use strict';var Sequelize=require(_0xbe4e('0x0'));module[_0xbe4e('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0xbe4e('0x2')]},'function':{'type':Sequelize[_0xbe4e('0x2')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xbe4e('0x2')]},'custom':{'type':Sequelize[_0xbe4e('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 262e24a..7e37868 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 _0x8a1f=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','name','send','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','destroy','CustomReportId','eml-format'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x8a1f,0x1ad));var _0xf8a1=function(_0x3a5a8d,_0x22dac9){_0x3a5a8d=_0x3a5a8d-0x0;var _0x1b94b7=_0x8a1f[_0x3a5a8d];return _0x1b94b7;};'use strict';var emlformat=require(_0xf8a1('0x0'));var rimraf=require(_0xf8a1('0x1'));var zipdir=require(_0xf8a1('0x2'));var jsonpatch=require(_0xf8a1('0x3'));var rp=require(_0xf8a1('0x4'));var moment=require(_0xf8a1('0x5'));var BPromise=require(_0xf8a1('0x6'));var Mustache=require(_0xf8a1('0x7'));var util=require(_0xf8a1('0x8'));var path=require('path');var sox=require(_0xf8a1('0x9'));var csv=require(_0xf8a1('0xa'));var ejs=require(_0xf8a1('0xb'));var fs=require('fs');var fs_extra=require(_0xf8a1('0xc'));var _=require(_0xf8a1('0xd'));var squel=require(_0xf8a1('0xe'));var crypto=require(_0xf8a1('0xf'));var jsforce=require(_0xf8a1('0x10'));var deskjs=require(_0xf8a1('0x11'));var toCsv=require(_0xf8a1('0xa'));var querystring=require(_0xf8a1('0x12'));var Papa=require('papaparse');var Redis=require(_0xf8a1('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xf8a1('0x14'));var as=require(_0xf8a1('0x15'));var hardwareService=require(_0xf8a1('0x16'));var logger=require(_0xf8a1('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xf8a1('0x18'));var licenseUtil=require(_0xf8a1('0x19'));var db=require(_0xf8a1('0x1a'))['db'];function respondWithStatusCode(_0x4c6cee,_0x29c5f9){_0x29c5f9=_0x29c5f9||0xcc;return function(_0xa28473){if(_0xa28473){return _0x4c6cee[_0xf8a1('0x1b')](_0x29c5f9);}return _0x4c6cee[_0xf8a1('0x1c')](_0x29c5f9)[_0xf8a1('0x1d')]();};}function respondWithResult(_0x264cf0,_0x3cc7fd){_0x3cc7fd=_0x3cc7fd||0xc8;return function(_0x362650){if(_0x362650){return _0x264cf0['status'](_0x3cc7fd)[_0xf8a1('0x1e')](_0x362650);}};}function respondWithFilteredResult(_0x30b0dc,_0xaec725){return function(_0x230c16){if(_0x230c16){var _0x12b643=typeof _0xaec725['offset']===_0xf8a1('0x1f')&&typeof _0xaec725[_0xf8a1('0x20')]==='undefined';var _0x32fad6=_0x230c16['count'];var _0x317121=_0x12b643?0x0:_0xaec725['offset'];var _0x397238=_0x12b643?_0x230c16[_0xf8a1('0x21')]:_0xaec725['offset']+_0xaec725['limit'];var _0x4fe48b;if(_0x397238>=_0x32fad6){_0x397238=_0x32fad6;_0x4fe48b=0xc8;}else{_0x4fe48b=0xce;}_0x30b0dc[_0xf8a1('0x1c')](_0x4fe48b);return _0x30b0dc[_0xf8a1('0x22')](_0xf8a1('0x23'),_0x317121+'-'+_0x397238+'/'+_0x32fad6)[_0xf8a1('0x1e')](_0x230c16);}return null;};}function patchUpdates(_0x5dcb89){return function(_0x2b1d0d){try{jsonpatch[_0xf8a1('0x24')](_0x2b1d0d,_0x5dcb89,!![]);}catch(_0x1c8714){return BPromise[_0xf8a1('0x25')](_0x1c8714);}return _0x2b1d0d['save']();};}function saveUpdates(_0x200489,_0x1baeb8){return function(_0x47e575){if(_0x47e575){return _0x47e575[_0xf8a1('0x26')](_0x200489)[_0xf8a1('0x27')](function(_0x33e269){return _0x33e269;});}return null;};}function removeEntity(_0x37f7ac,_0x2396b7){return function(_0x4dace2){if(_0x4dace2){return _0x4dace2['destroy']()[_0xf8a1('0x27')](function(){_0x37f7ac[_0xf8a1('0x1c')](0xcc)[_0xf8a1('0x1d')]();});}};}function handleEntityNotFound(_0x5d8618,_0x58c449){return function(_0x293913){if(!_0x293913){_0x5d8618[_0xf8a1('0x1b')](0x194);}return _0x293913;};}function handleError(_0x1ce9f8,_0x4e0fa6){_0x4e0fa6=_0x4e0fa6||0x1f4;return function(_0x40e8b9){logger[_0xf8a1('0x28')](_0x40e8b9['stack']);if(_0x40e8b9[_0xf8a1('0x29')]){delete _0x40e8b9[_0xf8a1('0x29')];}_0x1ce9f8['status'](_0x4e0fa6)[_0xf8a1('0x2a')](_0x40e8b9);};}exports['index']=function(_0x5cdd38,_0x4fdcb1){var _0x3eaeed={},_0x29ce04={},_0x2cf506={'count':0x0,'rows':[]};var _0x585798=_[_0xf8a1('0x2b')](db[_0xf8a1('0x2c')][_0xf8a1('0x2d')],function(_0x38bd65){return{'name':_0x38bd65[_0xf8a1('0x2e')],'type':_0x38bd65[_0xf8a1('0x2f')][_0xf8a1('0x30')]};});_0x29ce04[_0xf8a1('0x31')]=_[_0xf8a1('0x2b')](_0x585798,_0xf8a1('0x29'));_0x29ce04[_0xf8a1('0x32')]=_[_0xf8a1('0x33')](_0x5cdd38['query']);_0x29ce04[_0xf8a1('0x34')]=_[_0xf8a1('0x35')](_0x29ce04[_0xf8a1('0x31')],_0x29ce04['query']);_0x3eaeed[_0xf8a1('0x36')]=_['intersection'](_0x29ce04['model'],qs['fields'](_0x5cdd38['query'][_0xf8a1('0x37')]));_0x3eaeed['attributes']=_0x3eaeed['attributes'][_0xf8a1('0x38')]?_0x3eaeed[_0xf8a1('0x36')]:_0x29ce04[_0xf8a1('0x31')];if(!_0x5cdd38[_0xf8a1('0x32')][_0xf8a1('0x39')](_0xf8a1('0x3a'))){_0x3eaeed[_0xf8a1('0x20')]=qs[_0xf8a1('0x20')](_0x5cdd38[_0xf8a1('0x32')][_0xf8a1('0x20')]);_0x3eaeed[_0xf8a1('0x3b')]=qs[_0xf8a1('0x3b')](_0x5cdd38['query'][_0xf8a1('0x3b')]);}_0x3eaeed[_0xf8a1('0x3c')]=qs[_0xf8a1('0x3d')](_0x5cdd38[_0xf8a1('0x32')][_0xf8a1('0x3d')]);_0x3eaeed['where']=qs[_0xf8a1('0x34')](_[_0xf8a1('0x3e')](_0x5cdd38[_0xf8a1('0x32')],_0x29ce04['filters']),_0x585798);if(_0x5cdd38[_0xf8a1('0x32')][_0xf8a1('0x3f')]){_0x3eaeed['where']=_[_0xf8a1('0x40')](_0x3eaeed[_0xf8a1('0x41')],{'$or':_[_0xf8a1('0x2b')](_0x585798,function(_0x36f35b){if(_0x36f35b[_0xf8a1('0x2f')]!==_0xf8a1('0x42')){var _0x5f364a={};_0x5f364a[_0x36f35b[_0xf8a1('0x29')]]={'$like':'%'+_0x5cdd38[_0xf8a1('0x32')][_0xf8a1('0x3f')]+'%'};return _0x5f364a;}})});}_0x3eaeed=_[_0xf8a1('0x40')]({},_0x3eaeed,_0x5cdd38[_0xf8a1('0x43')]);var _0x15076b={'where':_0x3eaeed['where']};return db[_0xf8a1('0x2c')][_0xf8a1('0x21')](_0x15076b)['then'](function(_0xa62d37){_0x2cf506['count']=_0xa62d37;if(_0x5cdd38['query'][_0xf8a1('0x44')]){_0x3eaeed[_0xf8a1('0x45')]=[{'all':!![]}];}return db[_0xf8a1('0x2c')][_0xf8a1('0x46')](_0x3eaeed);})[_0xf8a1('0x27')](function(_0x3b4c77){_0x2cf506['rows']=_0x3b4c77;return _0x2cf506;})[_0xf8a1('0x27')](respondWithFilteredResult(_0x4fdcb1,_0x3eaeed))[_0xf8a1('0x47')](handleError(_0x4fdcb1,null));};exports['show']=function(_0x30042a,_0x5a72ad){var _0x5eec5f={'raw':![],'where':{'id':_0x30042a[_0xf8a1('0x48')]['id']}},_0x3038ca={};_0x3038ca['model']=_['keys'](db[_0xf8a1('0x2c')][_0xf8a1('0x2d')]);_0x3038ca[_0xf8a1('0x32')]=_[_0xf8a1('0x33')](_0x30042a[_0xf8a1('0x32')]);_0x3038ca['filters']=_['intersection'](_0x3038ca[_0xf8a1('0x31')],_0x3038ca[_0xf8a1('0x32')]);_0x5eec5f[_0xf8a1('0x36')]=_[_0xf8a1('0x35')](_0x3038ca[_0xf8a1('0x31')],qs[_0xf8a1('0x37')](_0x30042a['query'][_0xf8a1('0x37')]));_0x5eec5f[_0xf8a1('0x36')]=_0x5eec5f[_0xf8a1('0x36')][_0xf8a1('0x38')]?_0x5eec5f[_0xf8a1('0x36')]:_0x3038ca['model'];if(_0x30042a[_0xf8a1('0x32')][_0xf8a1('0x44')]){_0x5eec5f['include']=[{'all':!![]}];}_0x5eec5f=_['merge']({},_0x5eec5f,_0x30042a[_0xf8a1('0x43')]);return db[_0xf8a1('0x2c')][_0xf8a1('0x49')](_0x5eec5f)[_0xf8a1('0x27')](handleEntityNotFound(_0x5a72ad,null))['then'](respondWithResult(_0x5a72ad,null))[_0xf8a1('0x47')](handleError(_0x5a72ad,null));};exports[_0xf8a1('0x4a')]=function(_0x1ed6a2,_0x259161){return db[_0xf8a1('0x2c')][_0xf8a1('0x4a')](_0x1ed6a2[_0xf8a1('0x4b')],{})[_0xf8a1('0x27')](respondWithResult(_0x259161,0xc9))[_0xf8a1('0x47')](handleError(_0x259161,null));};exports[_0xf8a1('0x4c')]=function(_0xb8bc65,_0x63e338){return db[_0xf8a1('0x2c')]['bulkCreate'](_0xb8bc65[_0xf8a1('0x4b')],{'raw':![],'individualHooks':!![]})[_0xf8a1('0x27')](respondWithResult(_0x63e338,0xc9))[_0xf8a1('0x47')](handleError(_0x63e338,null));};exports[_0xf8a1('0x26')]=function(_0x21cd9f,_0x6c114){if(_0x21cd9f['body']['id']){delete _0x21cd9f[_0xf8a1('0x4b')]['id'];}return db[_0xf8a1('0x2c')][_0xf8a1('0x49')]({'where':{'id':_0x21cd9f[_0xf8a1('0x48')]['id']}})[_0xf8a1('0x27')](handleEntityNotFound(_0x6c114,null))[_0xf8a1('0x27')](saveUpdates(_0x21cd9f[_0xf8a1('0x4b')],null))[_0xf8a1('0x27')](respondWithResult(_0x6c114,null))['catch'](handleError(_0x6c114,null));};exports['destroy']=function(_0x7c5c52,_0x51c6ed){return db[_0xf8a1('0x2c')][_0xf8a1('0x49')]({'where':{'id':_0x7c5c52[_0xf8a1('0x48')]['id']}})[_0xf8a1('0x27')](handleEntityNotFound(_0x51c6ed,null))[_0xf8a1('0x27')](removeEntity(_0x51c6ed,null))[_0xf8a1('0x47')](handleError(_0x51c6ed,null));};exports[_0xf8a1('0x4d')]=function(_0x3cc71a,_0x522912){return db[_0xf8a1('0x2c')]['destroy']({'where':{'id':_0x3cc71a[_0xf8a1('0x32')][_0xf8a1('0x4e')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x522912,0xcc))['catch'](handleError(_0x522912,null));};exports[_0xf8a1('0x4f')]=function(_0x24784b,_0x52a32e,_0x45d494){return db[_0xf8a1('0x50')][_0xf8a1('0x51')]({'where':{'id':_0x24784b['params']['id']}})['then'](handleEntityNotFound(_0x52a32e,null))[_0xf8a1('0x27')](function(_0x1000cd){if(_0x1000cd){return db[_0xf8a1('0x52')][_0xf8a1('0x53')](function(_0x440ace){return db[_0xf8a1('0x2c')][_0xf8a1('0x54')]({'where':{'CustomReportId':_0x24784b['params']['id']},'transaction':_0x440ace})['then'](function(_0x4a2af3){var _0x1fc043=_['map'](_0x24784b[_0xf8a1('0x4b')],function(_0x38ed01){delete _0x38ed01['id'];_0x38ed01[_0xf8a1('0x55')]=_0x24784b[_0xf8a1('0x48')]['id'];return _0x38ed01;});return db[_0xf8a1('0x2c')][_0xf8a1('0x4c')](_0x1fc043,{'transaction':_0x440ace});});})[_0xf8a1('0x27')](function(){return db[_0xf8a1('0x2c')]['findAll']({'where':{'CustomReportId':_0x24784b['params']['id']}});});}})['then'](respondWithResult(_0x52a32e,null))['catch'](handleError(_0x52a32e,null));}; \ No newline at end of file +var _0xa0e9=['fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','filter','merge','map','type','options','AnalyticFieldReport','findAll','catch','show','includeAll','body','bulkCreate','find','params','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','transaction','CustomReportId','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','offset','undefined','count','set','Content-Range','save','update','destroy','then','sendStatus','error','stack','name','send','index','rawAttributes'];(function(_0x26dbc0,_0xf2424f){var _0x2a8e66=function(_0x1526d4){while(--_0x1526d4){_0x26dbc0['push'](_0x26dbc0['shift']());}};_0x2a8e66(++_0xf2424f);}(_0xa0e9,0x1eb));var _0x9a0e=function(_0x497274,_0x274702){_0x497274=_0x497274-0x0;var _0x1eb43c=_0xa0e9[_0x497274];return _0x1eb43c;};'use strict';var emlformat=require(_0x9a0e('0x0'));var rimraf=require(_0x9a0e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9a0e('0x2'));var moment=require(_0x9a0e('0x3'));var BPromise=require(_0x9a0e('0x4'));var Mustache=require(_0x9a0e('0x5'));var util=require(_0x9a0e('0x6'));var path=require(_0x9a0e('0x7'));var sox=require('sox');var csv=require(_0x9a0e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9a0e('0x9'));var _=require('lodash');var squel=require(_0x9a0e('0xa'));var crypto=require('crypto');var jsforce=require(_0x9a0e('0xb'));var deskjs=require(_0x9a0e('0xc'));var toCsv=require(_0x9a0e('0x8'));var querystring=require('querystring');var Papa=require(_0x9a0e('0xd'));var Redis=require(_0x9a0e('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9a0e('0xf'));var hardwareService=require(_0x9a0e('0x10'));var logger=require(_0x9a0e('0x11'))(_0x9a0e('0x12'));var utils=require(_0x9a0e('0x13'));var config=require(_0x9a0e('0x14'));var licenseUtil=require(_0x9a0e('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x203dec,_0x41d64d){_0x41d64d=_0x41d64d||0xcc;return function(_0x315f68){if(_0x315f68){return _0x203dec['sendStatus'](_0x41d64d);}return _0x203dec['status'](_0x41d64d)[_0x9a0e('0x16')]();};}function respondWithResult(_0x1b6132,_0x151fbb){_0x151fbb=_0x151fbb||0xc8;return function(_0x2a869){if(_0x2a869){return _0x1b6132[_0x9a0e('0x17')](_0x151fbb)[_0x9a0e('0x18')](_0x2a869);}};}function respondWithFilteredResult(_0x5a25ff,_0x1392e4){return function(_0x329c86){if(_0x329c86){var _0x238741=typeof _0x1392e4[_0x9a0e('0x19')]===_0x9a0e('0x1a')&&typeof _0x1392e4['limit']==='undefined';var _0x311cf4=_0x329c86[_0x9a0e('0x1b')];var _0x5007c4=_0x238741?0x0:_0x1392e4['offset'];var _0x41aa1c=_0x238741?_0x329c86[_0x9a0e('0x1b')]:_0x1392e4[_0x9a0e('0x19')]+_0x1392e4['limit'];var _0xc6d3f6;if(_0x41aa1c>=_0x311cf4){_0x41aa1c=_0x311cf4;_0xc6d3f6=0xc8;}else{_0xc6d3f6=0xce;}_0x5a25ff['status'](_0xc6d3f6);return _0x5a25ff[_0x9a0e('0x1c')](_0x9a0e('0x1d'),_0x5007c4+'-'+_0x41aa1c+'/'+_0x311cf4)[_0x9a0e('0x18')](_0x329c86);}return null;};}function patchUpdates(_0xf6d33){return function(_0x47f6c6){try{jsonpatch['apply'](_0x47f6c6,_0xf6d33,!![]);}catch(_0x3bc6d1){return BPromise['reject'](_0x3bc6d1);}return _0x47f6c6[_0x9a0e('0x1e')]();};}function saveUpdates(_0x28bcb4,_0x282b6){return function(_0x1cdac5){if(_0x1cdac5){return _0x1cdac5[_0x9a0e('0x1f')](_0x28bcb4)['then'](function(_0x1fd478){return _0x1fd478;});}return null;};}function removeEntity(_0x190ed2,_0x4fda96){return function(_0x599e81){if(_0x599e81){return _0x599e81[_0x9a0e('0x20')]()[_0x9a0e('0x21')](function(){_0x190ed2[_0x9a0e('0x17')](0xcc)[_0x9a0e('0x16')]();});}};}function handleEntityNotFound(_0x207aa6,_0x2a000d){return function(_0x1466df){if(!_0x1466df){_0x207aa6[_0x9a0e('0x22')](0x194);}return _0x1466df;};}function handleError(_0x1e1383,_0x5ad194){_0x5ad194=_0x5ad194||0x1f4;return function(_0x36630c){logger[_0x9a0e('0x23')](_0x36630c[_0x9a0e('0x24')]);if(_0x36630c[_0x9a0e('0x25')]){delete _0x36630c[_0x9a0e('0x25')];}_0x1e1383[_0x9a0e('0x17')](_0x5ad194)[_0x9a0e('0x26')](_0x36630c);};}exports[_0x9a0e('0x27')]=function(_0xcbbe7b,_0x2c873){var _0x1af0db={},_0x32340a={},_0x27b1c1={'count':0x0,'rows':[]};var _0x4a31d0=_['map'](db['AnalyticFieldReport'][_0x9a0e('0x28')],function(_0x373a3b){return{'name':_0x373a3b[_0x9a0e('0x29')],'type':_0x373a3b['type'][_0x9a0e('0x2a')]};});_0x32340a[_0x9a0e('0x2b')]=_['map'](_0x4a31d0,_0x9a0e('0x25'));_0x32340a[_0x9a0e('0x2c')]=_[_0x9a0e('0x2d')](_0xcbbe7b[_0x9a0e('0x2c')]);_0x32340a[_0x9a0e('0x2e')]=_[_0x9a0e('0x2f')](_0x32340a['model'],_0x32340a['query']);_0x1af0db[_0x9a0e('0x30')]=_[_0x9a0e('0x2f')](_0x32340a[_0x9a0e('0x2b')],qs[_0x9a0e('0x31')](_0xcbbe7b['query'][_0x9a0e('0x31')]));_0x1af0db[_0x9a0e('0x30')]=_0x1af0db[_0x9a0e('0x30')][_0x9a0e('0x32')]?_0x1af0db['attributes']:_0x32340a[_0x9a0e('0x2b')];if(!_0xcbbe7b[_0x9a0e('0x2c')][_0x9a0e('0x33')]('nolimit')){_0x1af0db['limit']=qs[_0x9a0e('0x34')](_0xcbbe7b[_0x9a0e('0x2c')][_0x9a0e('0x34')]);_0x1af0db[_0x9a0e('0x19')]=qs['offset'](_0xcbbe7b[_0x9a0e('0x2c')][_0x9a0e('0x19')]);}_0x1af0db['order']=qs[_0x9a0e('0x35')](_0xcbbe7b['query']['sort']);_0x1af0db[_0x9a0e('0x36')]=qs[_0x9a0e('0x2e')](_['pick'](_0xcbbe7b[_0x9a0e('0x2c')],_0x32340a[_0x9a0e('0x2e')]),_0x4a31d0);if(_0xcbbe7b[_0x9a0e('0x2c')][_0x9a0e('0x37')]){_0x1af0db[_0x9a0e('0x36')]=_[_0x9a0e('0x38')](_0x1af0db['where'],{'$or':_[_0x9a0e('0x39')](_0x4a31d0,function(_0x59163f){if(_0x59163f[_0x9a0e('0x3a')]!=='VIRTUAL'){var _0x38beea={};_0x38beea[_0x59163f[_0x9a0e('0x25')]]={'$like':'%'+_0xcbbe7b[_0x9a0e('0x2c')][_0x9a0e('0x37')]+'%'};return _0x38beea;}})});}_0x1af0db=_[_0x9a0e('0x38')]({},_0x1af0db,_0xcbbe7b[_0x9a0e('0x3b')]);var _0xbae5e9={'where':_0x1af0db[_0x9a0e('0x36')]};return db['AnalyticFieldReport'][_0x9a0e('0x1b')](_0xbae5e9)[_0x9a0e('0x21')](function(_0x470be2){_0x27b1c1[_0x9a0e('0x1b')]=_0x470be2;if(_0xcbbe7b['query']['includeAll']){_0x1af0db['include']=[{'all':!![]}];}return db[_0x9a0e('0x3c')][_0x9a0e('0x3d')](_0x1af0db);})['then'](function(_0x2e6b88){_0x27b1c1['rows']=_0x2e6b88;return _0x27b1c1;})[_0x9a0e('0x21')](respondWithFilteredResult(_0x2c873,_0x1af0db))[_0x9a0e('0x3e')](handleError(_0x2c873,null));};exports[_0x9a0e('0x3f')]=function(_0x3094ae,_0x1258e4){var _0x291ae7={'raw':![],'where':{'id':_0x3094ae['params']['id']}},_0x279b25={};_0x279b25[_0x9a0e('0x2b')]=_['keys'](db[_0x9a0e('0x3c')][_0x9a0e('0x28')]);_0x279b25['query']=_[_0x9a0e('0x2d')](_0x3094ae[_0x9a0e('0x2c')]);_0x279b25[_0x9a0e('0x2e')]=_[_0x9a0e('0x2f')](_0x279b25['model'],_0x279b25[_0x9a0e('0x2c')]);_0x291ae7[_0x9a0e('0x30')]=_[_0x9a0e('0x2f')](_0x279b25[_0x9a0e('0x2b')],qs[_0x9a0e('0x31')](_0x3094ae['query'][_0x9a0e('0x31')]));_0x291ae7[_0x9a0e('0x30')]=_0x291ae7[_0x9a0e('0x30')]['length']?_0x291ae7[_0x9a0e('0x30')]:_0x279b25['model'];if(_0x3094ae[_0x9a0e('0x2c')][_0x9a0e('0x40')]){_0x291ae7['include']=[{'all':!![]}];}_0x291ae7=_[_0x9a0e('0x38')]({},_0x291ae7,_0x3094ae[_0x9a0e('0x3b')]);return db[_0x9a0e('0x3c')]['find'](_0x291ae7)['then'](handleEntityNotFound(_0x1258e4,null))[_0x9a0e('0x21')](respondWithResult(_0x1258e4,null))[_0x9a0e('0x3e')](handleError(_0x1258e4,null));};exports['create']=function(_0x59da81,_0x39e97f){return db[_0x9a0e('0x3c')]['create'](_0x59da81[_0x9a0e('0x41')],{})[_0x9a0e('0x21')](respondWithResult(_0x39e97f,0xc9))[_0x9a0e('0x3e')](handleError(_0x39e97f,null));};exports[_0x9a0e('0x42')]=function(_0x3285f2,_0x2bf8c5){return db['AnalyticFieldReport'][_0x9a0e('0x42')](_0x3285f2['body'],{'raw':![],'individualHooks':!![]})[_0x9a0e('0x21')](respondWithResult(_0x2bf8c5,0xc9))[_0x9a0e('0x3e')](handleError(_0x2bf8c5,null));};exports[_0x9a0e('0x1f')]=function(_0x2a2e51,_0x3d4edf){if(_0x2a2e51['body']['id']){delete _0x2a2e51[_0x9a0e('0x41')]['id'];}return db[_0x9a0e('0x3c')]['find']({'where':{'id':_0x2a2e51['params']['id']}})['then'](handleEntityNotFound(_0x3d4edf,null))['then'](saveUpdates(_0x2a2e51['body'],null))[_0x9a0e('0x21')](respondWithResult(_0x3d4edf,null))[_0x9a0e('0x3e')](handleError(_0x3d4edf,null));};exports[_0x9a0e('0x20')]=function(_0x2d6a32,_0x86d605){return db['AnalyticFieldReport'][_0x9a0e('0x43')]({'where':{'id':_0x2d6a32[_0x9a0e('0x44')]['id']}})['then'](handleEntityNotFound(_0x86d605,null))[_0x9a0e('0x21')](removeEntity(_0x86d605,null))[_0x9a0e('0x3e')](handleError(_0x86d605,null));};exports[_0x9a0e('0x45')]=function(_0x4659bb,_0xc141f3){return db['AnalyticFieldReport'][_0x9a0e('0x20')]({'where':{'id':_0x4659bb['query'][_0x9a0e('0x46')]||[]},'raw':![],'individualHooks':!![]})[_0x9a0e('0x21')](respondWithResult(_0xc141f3,0xcc))[_0x9a0e('0x3e')](handleError(_0xc141f3,null));};exports[_0x9a0e('0x47')]=function(_0x23c737,_0x11ef9c,_0x17b2dc){return db[_0x9a0e('0x48')][_0x9a0e('0x49')]({'where':{'id':_0x23c737['params']['id']}})['then'](handleEntityNotFound(_0x11ef9c,null))[_0x9a0e('0x21')](function(_0x2c0073){if(_0x2c0073){return db['sequelize'][_0x9a0e('0x4a')](function(_0x18bd21){return db['AnalyticFieldReport']['destroy']({'where':{'CustomReportId':_0x23c737[_0x9a0e('0x44')]['id']},'transaction':_0x18bd21})[_0x9a0e('0x21')](function(_0x1ef7db){var _0xa2a549=_['map'](_0x23c737['body'],function(_0x466654){delete _0x466654['id'];_0x466654[_0x9a0e('0x4b')]=_0x23c737[_0x9a0e('0x44')]['id'];return _0x466654;});return db[_0x9a0e('0x3c')][_0x9a0e('0x42')](_0xa2a549,{'transaction':_0x18bd21});});})['then'](function(){return db[_0x9a0e('0x3c')][_0x9a0e('0x3d')]({'where':{'CustomReportId':_0x23c737['params']['id']}});});}})[_0x9a0e('0x21')](respondWithResult(_0x11ef9c,null))[_0x9a0e('0x3e')](handleError(_0x11ef9c,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 6d479e6..cd1bb38 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 _0xa0e4=['../../config/environment','define','AnalyticFieldReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4778ad,_0x22a372){var _0x345476=function(_0x47fd6f){while(--_0x47fd6f){_0x4778ad['push'](_0x4778ad['shift']());}};_0x345476(++_0x22a372);}(_0xa0e4,0x12c));var _0x4a0e=function(_0x435ba5,_0x55875f){_0x435ba5=_0x435ba5-0x0;var _0x5af51d=_0xa0e4[_0x435ba5];return _0x5af51d;};'use strict';var _=require(_0x4a0e('0x0'));var util=require(_0x4a0e('0x1'));var logger=require(_0x4a0e('0x2'))(_0x4a0e('0x3'));var moment=require(_0x4a0e('0x4'));var BPromise=require(_0x4a0e('0x5'));var rp=require(_0x4a0e('0x6'));var fs=require('fs');var path=require(_0x4a0e('0x7'));var rimraf=require('rimraf');var config=require(_0x4a0e('0x8'));var attributes=require('./analyticFieldReport.attributes');module['exports']=function(_0x4ddbc4,_0x2f666d){return _0x4ddbc4[_0x4a0e('0x9')](_0x4a0e('0xa'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a55=['analytics_report_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticFieldReport.attributes','define','AnalyticFieldReport'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x6a55,0xeb));var _0x56a5=function(_0x29df9a,_0x42aff3){_0x29df9a=_0x29df9a-0x0;var _0x3a8e96=_0x6a55[_0x29df9a];return _0x3a8e96;};'use strict';var _=require(_0x56a5('0x0'));var util=require(_0x56a5('0x1'));var logger=require(_0x56a5('0x2'))(_0x56a5('0x3'));var moment=require(_0x56a5('0x4'));var BPromise=require(_0x56a5('0x5'));var rp=require(_0x56a5('0x6'));var fs=require('fs');var path=require(_0x56a5('0x7'));var rimraf=require('rimraf');var config=require(_0x56a5('0x8'));var attributes=require(_0x56a5('0x9'));module['exports']=function(_0x178644,_0x5a3bd2){return _0x178644[_0x56a5('0xa')](_0x56a5('0xb'),attributes,{'tableName':_0x56a5('0xc'),'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 b64b613..8996da5 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 _0x8537=['AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info'];(function(_0x49aee4,_0x17186c){var _0x4042b7=function(_0x2d86cf){while(--_0x2d86cf){_0x49aee4['push'](_0x49aee4['shift']());}};_0x4042b7(++_0x17186c);}(_0x8537,0xe2));var _0x7853=function(_0x1c7c63,_0x5337aa){_0x1c7c63=_0x1c7c63-0x0;var _0x385f7a=_0x8537[_0x1c7c63];return _0x385f7a;};'use strict';var _=require(_0x7853('0x0'));var util=require('util');var moment=require(_0x7853('0x1'));var BPromise=require(_0x7853('0x2'));var rs=require(_0x7853('0x3'));var fs=require('fs');var Redis=require(_0x7853('0x4'));var db=require(_0x7853('0x5'))['db'];var utils=require(_0x7853('0x6'));var logger=require(_0x7853('0x7'))(_0x7853('0x8'));var config=require(_0x7853('0x9'));var jayson=require(_0x7853('0xa'));var client=jayson['client'][_0x7853('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2da0a3,_0x39ff2e,_0x5dfe39){return new BPromise(function(_0x4a6b16,_0x3f2fc7){return client['request'](_0x2da0a3,_0x5dfe39)[_0x7853('0xc')](function(_0x30e9dc){logger[_0x7853('0xd')](_0x7853('0xe'),_0x39ff2e,_0x7853('0xf'));logger[_0x7853('0x10')](_0x7853('0x11'),_0x39ff2e,_0x7853('0xf'),JSON[_0x7853('0x12')](_0x30e9dc));if(_0x30e9dc[_0x7853('0x13')]){if(_0x30e9dc[_0x7853('0x13')][_0x7853('0x14')]===0x1f4){logger[_0x7853('0x13')](_0x7853('0xe'),_0x39ff2e,_0x30e9dc[_0x7853('0x13')]['message']);return _0x3f2fc7(_0x30e9dc[_0x7853('0x13')][_0x7853('0x15')]);}logger[_0x7853('0x13')]('AnalyticFieldReport,\x20%s,\x20%s',_0x39ff2e,_0x30e9dc['error'][_0x7853('0x15')]);return _0x4a6b16(_0x30e9dc[_0x7853('0x13')][_0x7853('0x15')]);}else{logger[_0x7853('0xd')](_0x7853('0xe'),_0x39ff2e,_0x7853('0xf'));_0x4a6b16(_0x30e9dc[_0x7853('0x16')][_0x7853('0x15')]);}})[_0x7853('0x17')](function(_0x365fce){logger[_0x7853('0x13')](_0x7853('0xe'),_0x39ff2e,_0x365fce);_0x3f2fc7(_0x365fce);});});} \ No newline at end of file +var _0x3fc4=['error','code','message','result','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0xdcde19,_0x224474){var _0x44200c=function(_0x39b31c){while(--_0x39b31c){_0xdcde19['push'](_0xdcde19['shift']());}};_0x44200c(++_0x224474);}(_0x3fc4,0x125));var _0x43fc=function(_0x5c66d2,_0x5f220f){_0x5c66d2=_0x5c66d2-0x0;var _0x8ed5e3=_0x3fc4[_0x5c66d2];return _0x8ed5e3;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x43fc('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x43fc('0x1'));var db=require(_0x43fc('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x43fc('0x3'))('rpc');var config=require(_0x43fc('0x4'));var jayson=require(_0x43fc('0x5'));var client=jayson[_0x43fc('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe30928,_0x1be3dc,_0xdc6037){return new BPromise(function(_0x44be1f,_0x5137ea){return client[_0x43fc('0x7')](_0xe30928,_0xdc6037)[_0x43fc('0x8')](function(_0x36f347){logger[_0x43fc('0x9')](_0x43fc('0xa'),_0x1be3dc,'request\x20sent');logger['debug']('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x1be3dc,_0x43fc('0xb'),JSON[_0x43fc('0xc')](_0x36f347));if(_0x36f347[_0x43fc('0xd')]){if(_0x36f347[_0x43fc('0xd')][_0x43fc('0xe')]===0x1f4){logger[_0x43fc('0xd')](_0x43fc('0xa'),_0x1be3dc,_0x36f347[_0x43fc('0xd')][_0x43fc('0xf')]);return _0x5137ea(_0x36f347['error']['message']);}logger[_0x43fc('0xd')](_0x43fc('0xa'),_0x1be3dc,_0x36f347[_0x43fc('0xd')][_0x43fc('0xf')]);return _0x44be1f(_0x36f347['error']['message']);}else{logger[_0x43fc('0x9')](_0x43fc('0xa'),_0x1be3dc,_0x43fc('0xb'));_0x44be1f(_0x36f347[_0x43fc('0x10')][_0x43fc('0xf')]);}})['catch'](function(_0x2fa605){logger[_0x43fc('0xd')](_0x43fc('0xa'),_0x1be3dc,_0x2fa605);_0x5137ea(_0x2fa605);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index b73cc21..0c5ef49 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(_0x362058,_0x446816){var _0x1e4d4b=function(_0x2d4b2a){while(--_0x2d4b2a){_0x362058['push'](_0x362058['shift']());}};_0x1e4d4b(++_0x446816);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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(_0x135c0b,_0x4a8182){var _0x3ff6be=function(_0x43ee7f){while(--_0x43ee7f){_0x135c0b['push'](_0x135c0b['shift']());}};_0x3ff6be(++_0x4a8182);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 bbe4848..a59cae4 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 _0xb077=['TEXT','STRING','sequelize','name'];(function(_0xa066f8,_0x4636af){var _0x2b5cb8=function(_0x3a4052){while(--_0x3a4052){_0xa066f8['push'](_0xa066f8['shift']());}};_0x2b5cb8(++_0x4636af);}(_0xb077,0x7a));var _0x7b07=function(_0x555e0e,_0x379d86){_0x555e0e=_0x555e0e-0x0;var _0x798715=_0xb077[_0x555e0e];return _0x798715;};'use strict';var Sequelize=require(_0x7b07('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x7b07('0x1')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x7b07('0x2')]},'description':{'type':Sequelize[_0x7b07('0x3')]}}; \ No newline at end of file +var _0x0901=['STRING','name','TEXT','sequelize','exports'];(function(_0x332339,_0x3a98e1){var _0x2d78e9=function(_0x574ea5){while(--_0x574ea5){_0x332339['push'](_0x332339['shift']());}};_0x2d78e9(++_0x3a98e1);}(_0x0901,0x134));var _0x1090=function(_0x36d65a,_0x2f23e9){_0x36d65a=_0x36d65a-0x0;var _0x859c46=_0x0901[_0x36d65a];return _0x859c46;};'use strict';var Sequelize=require(_0x1090('0x0'));module[_0x1090('0x1')]={'name':{'type':Sequelize[_0x1090('0x2')],'allowNull':![],'unique':_0x1090('0x3')},'table':{'type':Sequelize[_0x1090('0x2')]},'metric':{'type':Sequelize[_0x1090('0x4')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 2a93a17..91d53e5 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 _0xf2ca=['filter','merge','map','type','VIRTUAL','options','AnalyticMetric','count','includeAll','findAll','rows','catch','keys','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','then','get','Metrics','UserProfileResource','destroy','stack','name','send','index','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x5ac3b7,_0x4e43a3){var _0x56b129=function(_0x2b75c0){while(--_0x2b75c0){_0x5ac3b7['push'](_0x5ac3b7['shift']());}};_0x56b129(++_0x4e43a3);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x389318,_0x13a53d){_0x389318=_0x389318-0x0;var _0x7919e3=_0xf2ca[_0x389318];return _0x7919e3;};'use strict';var emlformat=require(_0xaf2c('0x0'));var rimraf=require(_0xaf2c('0x1'));var zipdir=require(_0xaf2c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf2c('0x3'));var moment=require(_0xaf2c('0x4'));var BPromise=require(_0xaf2c('0x5'));var Mustache=require(_0xaf2c('0x6'));var util=require(_0xaf2c('0x7'));var path=require(_0xaf2c('0x8'));var sox=require('sox');var csv=require(_0xaf2c('0x9'));var ejs=require(_0xaf2c('0xa'));var fs=require('fs');var fs_extra=require(_0xaf2c('0xb'));var _=require(_0xaf2c('0xc'));var squel=require('squel');var crypto=require(_0xaf2c('0xd'));var jsforce=require(_0xaf2c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xaf2c('0x9'));var querystring=require('querystring');var Papa=require(_0xaf2c('0xf'));var Redis=require('ioredis');var authService=require(_0xaf2c('0x10'));var qs=require(_0xaf2c('0x11'));var as=require(_0xaf2c('0x12'));var hardwareService=require(_0xaf2c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xaf2c('0x14'));var config=require(_0xaf2c('0x15'));var licenseUtil=require(_0xaf2c('0x16'));var db=require(_0xaf2c('0x17'))['db'];function respondWithStatusCode(_0x285dac,_0x59a59b){_0x59a59b=_0x59a59b||0xcc;return function(_0x590126){if(_0x590126){return _0x285dac[_0xaf2c('0x18')](_0x59a59b);}return _0x285dac[_0xaf2c('0x19')](_0x59a59b)[_0xaf2c('0x1a')]();};}function respondWithResult(_0x18a8a5,_0x293ca6){_0x293ca6=_0x293ca6||0xc8;return function(_0x152c73){if(_0x152c73){return _0x18a8a5[_0xaf2c('0x19')](_0x293ca6)[_0xaf2c('0x1b')](_0x152c73);}};}function respondWithFilteredResult(_0x2119c8,_0x1d0633){return function(_0x6ac8e){if(_0x6ac8e){var _0x2b4d13=typeof _0x1d0633[_0xaf2c('0x1c')]===_0xaf2c('0x1d')&&typeof _0x1d0633[_0xaf2c('0x1e')]==='undefined';var _0x3ca650=_0x6ac8e['count'];var _0x278a28=_0x2b4d13?0x0:_0x1d0633[_0xaf2c('0x1c')];var _0x1d544a=_0x2b4d13?_0x6ac8e['count']:_0x1d0633[_0xaf2c('0x1c')]+_0x1d0633[_0xaf2c('0x1e')];var _0x1fec4c;if(_0x1d544a>=_0x3ca650){_0x1d544a=_0x3ca650;_0x1fec4c=0xc8;}else{_0x1fec4c=0xce;}_0x2119c8[_0xaf2c('0x19')](_0x1fec4c);return _0x2119c8[_0xaf2c('0x1f')](_0xaf2c('0x20'),_0x278a28+'-'+_0x1d544a+'/'+_0x3ca650)['json'](_0x6ac8e);}return null;};}function patchUpdates(_0x35e712){return function(_0x164bcb){try{jsonpatch[_0xaf2c('0x21')](_0x164bcb,_0x35e712,!![]);}catch(_0x3bfd3f){return BPromise[_0xaf2c('0x22')](_0x3bfd3f);}return _0x164bcb['save']();};}function saveUpdates(_0x396646,_0xbf6f62){return function(_0x18153c){if(_0x18153c){return _0x18153c['update'](_0x396646)['then'](function(_0x29cbdf){return _0x29cbdf;});}return null;};}function removeEntity(_0x303546,_0x1cafad){return function(_0x99f78d){if(_0x99f78d){return _0x99f78d['destroy']()[_0xaf2c('0x23')](function(){var _0xf1a7cf=_0x99f78d[_0xaf2c('0x24')]({'plain':!![]});var _0x3c1ae6=_0xaf2c('0x25');return db[_0xaf2c('0x26')][_0xaf2c('0x27')]({'where':{'type':_0x3c1ae6,'resourceId':_0xf1a7cf['id']}})['then'](function(){return _0x99f78d;});})[_0xaf2c('0x23')](function(){_0x303546[_0xaf2c('0x19')](0xcc)[_0xaf2c('0x1a')]();});}};}function handleEntityNotFound(_0x410536,_0x4b7cf2){return function(_0x3fb190){if(!_0x3fb190){_0x410536['sendStatus'](0x194);}return _0x3fb190;};}function handleError(_0x38db1b,_0x42f980){_0x42f980=_0x42f980||0x1f4;return function(_0x15466b){logger['error'](_0x15466b[_0xaf2c('0x28')]);if(_0x15466b[_0xaf2c('0x29')]){delete _0x15466b[_0xaf2c('0x29')];}_0x38db1b['status'](_0x42f980)[_0xaf2c('0x2a')](_0x15466b);};}exports[_0xaf2c('0x2b')]=function(_0x42e2a5,_0x19364e){var _0x59d858={},_0x3da072={},_0x4072ff={'count':0x0,'rows':[]};var _0x1be1ef=_['map'](db['AnalyticMetric'][_0xaf2c('0x2c')],function(_0x4c9b4f){return{'name':_0x4c9b4f[_0xaf2c('0x2d')],'type':_0x4c9b4f['type'][_0xaf2c('0x2e')]};});_0x3da072[_0xaf2c('0x2f')]=_['map'](_0x1be1ef,_0xaf2c('0x29'));_0x3da072[_0xaf2c('0x30')]=_['keys'](_0x42e2a5[_0xaf2c('0x30')]);_0x3da072[_0xaf2c('0x31')]=_[_0xaf2c('0x32')](_0x3da072[_0xaf2c('0x2f')],_0x3da072[_0xaf2c('0x30')]);_0x59d858[_0xaf2c('0x33')]=_['intersection'](_0x3da072[_0xaf2c('0x2f')],qs['fields'](_0x42e2a5[_0xaf2c('0x30')]['fields']));_0x59d858[_0xaf2c('0x33')]=_0x59d858['attributes'][_0xaf2c('0x34')]?_0x59d858['attributes']:_0x3da072[_0xaf2c('0x2f')];if(!_0x42e2a5['query'][_0xaf2c('0x35')](_0xaf2c('0x36'))){_0x59d858[_0xaf2c('0x1e')]=qs[_0xaf2c('0x1e')](_0x42e2a5[_0xaf2c('0x30')]['limit']);_0x59d858['offset']=qs[_0xaf2c('0x1c')](_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x1c')]);}_0x59d858[_0xaf2c('0x37')]=qs[_0xaf2c('0x38')](_0x42e2a5[_0xaf2c('0x30')]['sort']);_0x59d858[_0xaf2c('0x39')]=qs[_0xaf2c('0x31')](_['pick'](_0x42e2a5[_0xaf2c('0x30')],_0x3da072[_0xaf2c('0x31')]),_0x1be1ef);if(_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x3a')]){_0x59d858[_0xaf2c('0x39')]=_[_0xaf2c('0x3b')](_0x59d858[_0xaf2c('0x39')],{'$or':_[_0xaf2c('0x3c')](_0x1be1ef,function(_0x296ca8){if(_0x296ca8[_0xaf2c('0x3d')]!==_0xaf2c('0x3e')){var _0x43f606={};_0x43f606[_0x296ca8[_0xaf2c('0x29')]]={'$like':'%'+_0x42e2a5['query']['filter']+'%'};return _0x43f606;}})});}_0x59d858=_['merge']({},_0x59d858,_0x42e2a5[_0xaf2c('0x3f')]);var _0x3cb075={'where':_0x59d858[_0xaf2c('0x39')]};return db[_0xaf2c('0x40')][_0xaf2c('0x41')](_0x3cb075)[_0xaf2c('0x23')](function(_0x51c441){_0x4072ff[_0xaf2c('0x41')]=_0x51c441;if(_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x42')]){_0x59d858['include']=[{'all':!![]}];}return db['AnalyticMetric'][_0xaf2c('0x43')](_0x59d858);})['then'](function(_0x181787){_0x4072ff[_0xaf2c('0x44')]=_0x181787;return _0x4072ff;})[_0xaf2c('0x23')](respondWithFilteredResult(_0x19364e,_0x59d858))[_0xaf2c('0x45')](handleError(_0x19364e,null));};exports['show']=function(_0x2091eb,_0x532d5f){var _0x2056b8={'raw':!![],'where':{'id':_0x2091eb['params']['id']}},_0x8ebb65={};_0x8ebb65[_0xaf2c('0x2f')]=_['keys'](db[_0xaf2c('0x40')][_0xaf2c('0x2c')]);_0x8ebb65[_0xaf2c('0x30')]=_[_0xaf2c('0x46')](_0x2091eb[_0xaf2c('0x30')]);_0x8ebb65[_0xaf2c('0x31')]=_[_0xaf2c('0x32')](_0x8ebb65[_0xaf2c('0x2f')],_0x8ebb65[_0xaf2c('0x30')]);_0x2056b8['attributes']=_['intersection'](_0x8ebb65[_0xaf2c('0x2f')],qs['fields'](_0x2091eb['query']['fields']));_0x2056b8[_0xaf2c('0x33')]=_0x2056b8[_0xaf2c('0x33')][_0xaf2c('0x34')]?_0x2056b8[_0xaf2c('0x33')]:_0x8ebb65['model'];if(_0x2091eb[_0xaf2c('0x30')]['includeAll']){_0x2056b8[_0xaf2c('0x47')]=[{'all':!![]}];}_0x2056b8=_['merge']({},_0x2056b8,_0x2091eb[_0xaf2c('0x3f')]);return db[_0xaf2c('0x40')][_0xaf2c('0x48')](_0x2056b8)[_0xaf2c('0x23')](handleEntityNotFound(_0x532d5f,null))[_0xaf2c('0x23')](respondWithResult(_0x532d5f,null))['catch'](handleError(_0x532d5f,null));};exports[_0xaf2c('0x49')]=function(_0x26afee,_0x4b3ca4){return db['AnalyticMetric'][_0xaf2c('0x49')](_0x26afee['body'],{})[_0xaf2c('0x23')](function(_0x23642b){var _0x17b9ec=_0x26afee[_0xaf2c('0x4a')][_0xaf2c('0x24')]({'plain':!![]});if(!_0x17b9ec)throw new Error(_0xaf2c('0x4b'));if(_0x17b9ec[_0xaf2c('0x4c')]===_0xaf2c('0x4a')){var _0x31ccfe=_0x23642b[_0xaf2c('0x24')]({'plain':!![]});var _0x371486='Metrics';return db[_0xaf2c('0x4d')][_0xaf2c('0x48')]({'where':{'name':_0x371486,'userProfileId':_0x17b9ec['userProfileId']},'raw':!![]})['then'](function(_0x56d7ce){if(_0x56d7ce&&_0x56d7ce[_0xaf2c('0x4e')]===0x0){return db[_0xaf2c('0x26')]['create']({'name':_0x31ccfe[_0xaf2c('0x29')],'resourceId':_0x31ccfe['id'],'type':_0x56d7ce[_0xaf2c('0x29')],'sectionId':_0x56d7ce['id']},{})[_0xaf2c('0x23')](function(){return _0x23642b;});}else{return _0x23642b;}})[_0xaf2c('0x45')](function(_0x265748){logger[_0xaf2c('0x4f')](_0xaf2c('0x50'),_0x265748);throw _0x265748;});}return _0x23642b;})['then'](respondWithResult(_0x4b3ca4,0xc9))[_0xaf2c('0x45')](handleError(_0x4b3ca4,null));};exports[_0xaf2c('0x51')]=function(_0x5771e5,_0x245797){if(_0x5771e5[_0xaf2c('0x52')]['id']){delete _0x5771e5[_0xaf2c('0x52')]['id'];}return db[_0xaf2c('0x40')][_0xaf2c('0x48')]({'where':{'id':_0x5771e5[_0xaf2c('0x53')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x245797,null))[_0xaf2c('0x23')](saveUpdates(_0x5771e5[_0xaf2c('0x52')],null))[_0xaf2c('0x23')](respondWithResult(_0x245797,null))[_0xaf2c('0x45')](handleError(_0x245797,null));};exports[_0xaf2c('0x27')]=function(_0x411e84,_0x2356a0){return db[_0xaf2c('0x40')][_0xaf2c('0x48')]({'where':{'id':_0x411e84[_0xaf2c('0x53')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x2356a0,null))[_0xaf2c('0x23')](removeEntity(_0x2356a0,null))[_0xaf2c('0x45')](handleError(_0x2356a0,null));}; \ No newline at end of file +var _0x1cb9=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','reject','save','update','then','destroy','get','Metrics','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','show','params','keys','length','find','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cb9,0x14e));var _0x91cb=function(_0x18001b,_0x482b75){_0x18001b=_0x18001b-0x0;var _0x16f3f3=_0x1cb9[_0x18001b];return _0x16f3f3;};'use strict';var emlformat=require(_0x91cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91cb('0x1'));var jsonpatch=require(_0x91cb('0x2'));var rp=require(_0x91cb('0x3'));var moment=require(_0x91cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91cb('0x5'));var util=require(_0x91cb('0x6'));var path=require('path');var sox=require(_0x91cb('0x7'));var csv=require(_0x91cb('0x8'));var ejs=require(_0x91cb('0x9'));var fs=require('fs');var fs_extra=require(_0x91cb('0xa'));var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x8'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x91cb('0x18'))['db'];function respondWithStatusCode(_0x366f09,_0x4ba2f2){_0x4ba2f2=_0x4ba2f2||0xcc;return function(_0x20e6e0){if(_0x20e6e0){return _0x366f09[_0x91cb('0x19')](_0x4ba2f2);}return _0x366f09[_0x91cb('0x1a')](_0x4ba2f2)[_0x91cb('0x1b')]();};}function respondWithResult(_0x4a7d45,_0x4cc6ef){_0x4cc6ef=_0x4cc6ef||0xc8;return function(_0x4aae25){if(_0x4aae25){return _0x4a7d45[_0x91cb('0x1a')](_0x4cc6ef)['json'](_0x4aae25);}};}function respondWithFilteredResult(_0x528f73,_0x576369){return function(_0xc3629e){if(_0xc3629e){var _0x347980=typeof _0x576369['offset']===_0x91cb('0x1c')&&typeof _0x576369[_0x91cb('0x1d')]==='undefined';var _0xc594e3=_0xc3629e[_0x91cb('0x1e')];var _0x1cd34b=_0x347980?0x0:_0x576369[_0x91cb('0x1f')];var _0x5cc1c3=_0x347980?_0xc3629e[_0x91cb('0x1e')]:_0x576369[_0x91cb('0x1f')]+_0x576369['limit'];var _0x123847;if(_0x5cc1c3>=_0xc594e3){_0x5cc1c3=_0xc594e3;_0x123847=0xc8;}else{_0x123847=0xce;}_0x528f73['status'](_0x123847);return _0x528f73['set'](_0x91cb('0x20'),_0x1cd34b+'-'+_0x5cc1c3+'/'+_0xc594e3)[_0x91cb('0x21')](_0xc3629e);}return null;};}function patchUpdates(_0x56e409){return function(_0x51a1d5){try{jsonpatch['apply'](_0x51a1d5,_0x56e409,!![]);}catch(_0x438162){return BPromise[_0x91cb('0x22')](_0x438162);}return _0x51a1d5[_0x91cb('0x23')]();};}function saveUpdates(_0x1dbee2,_0x5c6a15){return function(_0x45c4b3){if(_0x45c4b3){return _0x45c4b3[_0x91cb('0x24')](_0x1dbee2)[_0x91cb('0x25')](function(_0x55fa78){return _0x55fa78;});}return null;};}function removeEntity(_0x26f18f,_0x1a7a54){return function(_0x2447e7){if(_0x2447e7){return _0x2447e7[_0x91cb('0x26')]()[_0x91cb('0x25')](function(){var _0x7ad361=_0x2447e7[_0x91cb('0x27')]({'plain':!![]});var _0x423c4f=_0x91cb('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x423c4f,'resourceId':_0x7ad361['id']}})[_0x91cb('0x25')](function(){return _0x2447e7;});})['then'](function(){_0x26f18f[_0x91cb('0x1a')](0xcc)[_0x91cb('0x1b')]();});}};}function handleEntityNotFound(_0x318031,_0x5595c5){return function(_0x9b26a6){if(!_0x9b26a6){_0x318031['sendStatus'](0x194);}return _0x9b26a6;};}function handleError(_0x4572f6,_0x308e8c){_0x308e8c=_0x308e8c||0x1f4;return function(_0x3b3ee6){logger[_0x91cb('0x29')](_0x3b3ee6[_0x91cb('0x2a')]);if(_0x3b3ee6['name']){delete _0x3b3ee6[_0x91cb('0x2b')];}_0x4572f6['status'](_0x308e8c)[_0x91cb('0x2c')](_0x3b3ee6);};}exports[_0x91cb('0x2d')]=function(_0x445fe1,_0x4944bd){var _0x775c25={},_0x146e1f={},_0x25bbf9={'count':0x0,'rows':[]};var _0x361e4c=_[_0x91cb('0x2e')](db[_0x91cb('0x2f')][_0x91cb('0x30')],function(_0x3bbde3){return{'name':_0x3bbde3[_0x91cb('0x31')],'type':_0x3bbde3['type'][_0x91cb('0x32')]};});_0x146e1f[_0x91cb('0x33')]=_[_0x91cb('0x2e')](_0x361e4c,_0x91cb('0x2b'));_0x146e1f[_0x91cb('0x34')]=_['keys'](_0x445fe1[_0x91cb('0x34')]);_0x146e1f[_0x91cb('0x35')]=_[_0x91cb('0x36')](_0x146e1f[_0x91cb('0x33')],_0x146e1f[_0x91cb('0x34')]);_0x775c25['attributes']=_[_0x91cb('0x36')](_0x146e1f['model'],qs['fields'](_0x445fe1['query'][_0x91cb('0x37')]));_0x775c25['attributes']=_0x775c25[_0x91cb('0x38')]['length']?_0x775c25['attributes']:_0x146e1f[_0x91cb('0x33')];if(!_0x445fe1[_0x91cb('0x34')][_0x91cb('0x39')](_0x91cb('0x3a'))){_0x775c25[_0x91cb('0x1d')]=qs['limit'](_0x445fe1[_0x91cb('0x34')][_0x91cb('0x1d')]);_0x775c25[_0x91cb('0x1f')]=qs[_0x91cb('0x1f')](_0x445fe1['query']['offset']);}_0x775c25[_0x91cb('0x3b')]=qs[_0x91cb('0x3c')](_0x445fe1['query'][_0x91cb('0x3c')]);_0x775c25[_0x91cb('0x3d')]=qs['filters'](_[_0x91cb('0x3e')](_0x445fe1[_0x91cb('0x34')],_0x146e1f['filters']),_0x361e4c);if(_0x445fe1[_0x91cb('0x34')]['filter']){_0x775c25[_0x91cb('0x3d')]=_[_0x91cb('0x3f')](_0x775c25[_0x91cb('0x3d')],{'$or':_[_0x91cb('0x2e')](_0x361e4c,function(_0x51d0ea){if(_0x51d0ea[_0x91cb('0x40')]!=='VIRTUAL'){var _0xa90111={};_0xa90111[_0x51d0ea[_0x91cb('0x2b')]]={'$like':'%'+_0x445fe1['query'][_0x91cb('0x41')]+'%'};return _0xa90111;}})});}_0x775c25=_['merge']({},_0x775c25,_0x445fe1[_0x91cb('0x42')]);var _0x2eac87={'where':_0x775c25[_0x91cb('0x3d')]};return db[_0x91cb('0x2f')]['count'](_0x2eac87)[_0x91cb('0x25')](function(_0x5af0e6){_0x25bbf9[_0x91cb('0x1e')]=_0x5af0e6;if(_0x445fe1[_0x91cb('0x34')][_0x91cb('0x43')]){_0x775c25[_0x91cb('0x44')]=[{'all':!![]}];}return db[_0x91cb('0x2f')][_0x91cb('0x45')](_0x775c25);})[_0x91cb('0x25')](function(_0x3cc4c1){_0x25bbf9['rows']=_0x3cc4c1;return _0x25bbf9;})[_0x91cb('0x25')](respondWithFilteredResult(_0x4944bd,_0x775c25))['catch'](handleError(_0x4944bd,null));};exports[_0x91cb('0x46')]=function(_0x5537a0,_0x335879){var _0x52e82c={'raw':!![],'where':{'id':_0x5537a0[_0x91cb('0x47')]['id']}},_0x138f48={};_0x138f48[_0x91cb('0x33')]=_[_0x91cb('0x48')](db['AnalyticMetric'][_0x91cb('0x30')]);_0x138f48[_0x91cb('0x34')]=_['keys'](_0x5537a0[_0x91cb('0x34')]);_0x138f48[_0x91cb('0x35')]=_[_0x91cb('0x36')](_0x138f48[_0x91cb('0x33')],_0x138f48[_0x91cb('0x34')]);_0x52e82c[_0x91cb('0x38')]=_[_0x91cb('0x36')](_0x138f48[_0x91cb('0x33')],qs[_0x91cb('0x37')](_0x5537a0['query'][_0x91cb('0x37')]));_0x52e82c[_0x91cb('0x38')]=_0x52e82c[_0x91cb('0x38')][_0x91cb('0x49')]?_0x52e82c[_0x91cb('0x38')]:_0x138f48[_0x91cb('0x33')];if(_0x5537a0[_0x91cb('0x34')][_0x91cb('0x43')]){_0x52e82c['include']=[{'all':!![]}];}_0x52e82c=_[_0x91cb('0x3f')]({},_0x52e82c,_0x5537a0[_0x91cb('0x42')]);return db[_0x91cb('0x2f')][_0x91cb('0x4a')](_0x52e82c)['then'](handleEntityNotFound(_0x335879,null))[_0x91cb('0x25')](respondWithResult(_0x335879,null))[_0x91cb('0x4b')](handleError(_0x335879,null));};exports['create']=function(_0x212473,_0x47cdb7){return db[_0x91cb('0x2f')]['create'](_0x212473['body'],{})['then'](function(_0x98245b){var _0xff3d11=_0x212473[_0x91cb('0x4c')][_0x91cb('0x27')]({'plain':!![]});if(!_0xff3d11)throw new Error(_0x91cb('0x4d'));if(_0xff3d11['role']==='user'){var _0x1d26b8=_0x98245b[_0x91cb('0x27')]({'plain':!![]});var _0x140994=_0x91cb('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x140994,'userProfileId':_0xff3d11['userProfileId']},'raw':!![]})[_0x91cb('0x25')](function(_0x490417){if(_0x490417&&_0x490417[_0x91cb('0x4e')]===0x0){return db['UserProfileResource'][_0x91cb('0x4f')]({'name':_0x1d26b8[_0x91cb('0x2b')],'resourceId':_0x1d26b8['id'],'type':_0x490417[_0x91cb('0x2b')],'sectionId':_0x490417['id']},{})[_0x91cb('0x25')](function(){return _0x98245b;});}else{return _0x98245b;}})[_0x91cb('0x4b')](function(_0x362532){logger[_0x91cb('0x29')](_0x91cb('0x50'),_0x362532);throw _0x362532;});}return _0x98245b;})[_0x91cb('0x25')](respondWithResult(_0x47cdb7,0xc9))[_0x91cb('0x4b')](handleError(_0x47cdb7,null));};exports[_0x91cb('0x24')]=function(_0x5752ed,_0x1e445a){if(_0x5752ed[_0x91cb('0x51')]['id']){delete _0x5752ed['body']['id'];}return db[_0x91cb('0x2f')][_0x91cb('0x4a')]({'where':{'id':_0x5752ed['params']['id']}})[_0x91cb('0x25')](handleEntityNotFound(_0x1e445a,null))[_0x91cb('0x25')](saveUpdates(_0x5752ed[_0x91cb('0x51')],null))[_0x91cb('0x25')](respondWithResult(_0x1e445a,null))[_0x91cb('0x4b')](handleError(_0x1e445a,null));};exports[_0x91cb('0x26')]=function(_0x1d4b96,_0x274fff){return db[_0x91cb('0x2f')][_0x91cb('0x4a')]({'where':{'id':_0x1d4b96[_0x91cb('0x47')]['id']}})['then'](handleEntityNotFound(_0x274fff,null))[_0x91cb('0x25')](removeEntity(_0x274fff,null))['catch'](handleError(_0x274fff,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index d3d87c7..399f34c 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 _0x46ed=['lodash','util','api','moment','bluebird','path','rimraf','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0x46ed,0x168));var _0xd46e=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x46ed[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var logger=require('../../config/logger')(_0xd46e('0x2'));var moment=require(_0xd46e('0x3'));var BPromise=require(_0xd46e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd46e('0x5'));var rimraf=require(_0xd46e('0x6'));var config=require('../../config/environment');var attributes=require(_0xd46e('0x7'));module[_0xd46e('0x8')]=function(_0x160bcf,_0x25cf78){return _0x160bcf[_0xd46e('0x9')](_0xd46e('0xa'),attributes,{'tableName':_0xd46e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8a5=['analytics_metrics','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric'];(function(_0x3b80e7,_0x8f4796){var _0x2fdca1=function(_0x446920){while(--_0x446920){_0x3b80e7['push'](_0x3b80e7['shift']());}};_0x2fdca1(++_0x8f4796);}(_0xd8a5,0x160));var _0x5d8a=function(_0x4b187b,_0x431650){_0x4b187b=_0x4b187b-0x0;var _0x321553=_0xd8a5[_0x4b187b];return _0x321553;};'use strict';var _=require(_0x5d8a('0x0'));var util=require('util');var logger=require(_0x5d8a('0x1'))(_0x5d8a('0x2'));var moment=require('moment');var BPromise=require(_0x5d8a('0x3'));var rp=require(_0x5d8a('0x4'));var fs=require('fs');var path=require(_0x5d8a('0x5'));var rimraf=require(_0x5d8a('0x6'));var config=require(_0x5d8a('0x7'));var attributes=require(_0x5d8a('0x8'));module[_0x5d8a('0x9')]=function(_0x38eaa5,_0x1ef405){return _0x38eaa5[_0x5d8a('0xa')](_0x5d8a('0xb'),attributes,{'tableName':_0x5d8a('0xc'),'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 097524e..c0057f5 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 _0x87cd=['info','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','code','AnalyticMetric,\x20%s,\x20%s','message','catch','util','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xc18fc0,_0x2fa31c){var _0x208c93=function(_0x58a2c0){while(--_0x58a2c0){_0xc18fc0['push'](_0xc18fc0['shift']());}};_0x208c93(++_0x2fa31c);}(_0x87cd,0xe6));var _0xd87c=function(_0xc9ed15,_0x1401a8){_0xc9ed15=_0xc9ed15-0x0;var _0x470a09=_0x87cd[_0xc9ed15];return _0x470a09;};'use strict';var _=require('lodash');var util=require(_0xd87c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd87c('0x1'));var fs=require('fs');var Redis=require(_0xd87c('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd87c('0x3'));var config=require(_0xd87c('0x4'));var jayson=require(_0xd87c('0x5'));var client=jayson[_0xd87c('0x6')][_0xd87c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2fe4f8,_0x4e5676,_0x1243b4){return new BPromise(function(_0x361c30,_0xf1f770){return client['request'](_0x2fe4f8,_0x1243b4)['then'](function(_0x4b13c9){logger[_0xd87c('0x8')]('AnalyticMetric,\x20%s,\x20%s',_0x4e5676,_0xd87c('0x9'));logger[_0xd87c('0xa')](_0xd87c('0xb'),_0x4e5676,'request\x20sent',JSON['stringify'](_0x4b13c9));if(_0x4b13c9['error']){if(_0x4b13c9[_0xd87c('0xc')][_0xd87c('0xd')]===0x1f4){logger[_0xd87c('0xc')](_0xd87c('0xe'),_0x4e5676,_0x4b13c9[_0xd87c('0xc')]['message']);return _0xf1f770(_0x4b13c9[_0xd87c('0xc')]['message']);}logger[_0xd87c('0xc')](_0xd87c('0xe'),_0x4e5676,_0x4b13c9['error'][_0xd87c('0xf')]);return _0x361c30(_0x4b13c9[_0xd87c('0xc')]['message']);}else{logger[_0xd87c('0x8')](_0xd87c('0xe'),_0x4e5676,_0xd87c('0x9'));_0x361c30(_0x4b13c9['result'][_0xd87c('0xf')]);}})[_0xd87c('0x10')](function(_0x23864d){logger[_0xd87c('0xc')](_0xd87c('0xe'),_0x4e5676,_0x23864d);_0xf1f770(_0x23864d);});});} \ No newline at end of file +var _0x4f5d=['request','then','info','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','AnalyticMetric,\x20%s,\x20%s','message','error','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x4f9b56,_0x4de94e){var _0x5b1e25=function(_0x4dc9fe){while(--_0x4dc9fe){_0x4f9b56['push'](_0x4f9b56['shift']());}};_0x5b1e25(++_0x4de94e);}(_0x4f5d,0x97));var _0xd4f5=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x4f5d[_0xdea41a];return _0x15d0d8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd4f5('0x0'));var BPromise=require('bluebird');var rs=require(_0xd4f5('0x1'));var fs=require('fs');var Redis=require(_0xd4f5('0x2'));var db=require(_0xd4f5('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd4f5('0x4'))(_0xd4f5('0x5'));var config=require(_0xd4f5('0x6'));var jayson=require(_0xd4f5('0x7'));var client=jayson['client'][_0xd4f5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33ff92,_0x51f8cf,_0x1a4c53){return new BPromise(function(_0x4336f7,_0x405ae3){return client[_0xd4f5('0x9')](_0x33ff92,_0x1a4c53)[_0xd4f5('0xa')](function(_0x1f73cc){logger[_0xd4f5('0xb')]('AnalyticMetric,\x20%s,\x20%s',_0x51f8cf,_0xd4f5('0xc'));logger[_0xd4f5('0xd')](_0xd4f5('0xe'),_0x51f8cf,_0xd4f5('0xc'),JSON['stringify'](_0x1f73cc));if(_0x1f73cc['error']){if(_0x1f73cc['error']['code']===0x1f4){logger['error'](_0xd4f5('0xf'),_0x51f8cf,_0x1f73cc['error'][_0xd4f5('0x10')]);return _0x405ae3(_0x1f73cc[_0xd4f5('0x11')][_0xd4f5('0x10')]);}logger[_0xd4f5('0x11')](_0xd4f5('0xf'),_0x51f8cf,_0x1f73cc[_0xd4f5('0x11')][_0xd4f5('0x10')]);return _0x4336f7(_0x1f73cc[_0xd4f5('0x11')][_0xd4f5('0x10')]);}else{logger[_0xd4f5('0xb')]('AnalyticMetric,\x20%s,\x20%s',_0x51f8cf,_0xd4f5('0xc'));_0x4336f7(_0x1f73cc[_0xd4f5('0x12')][_0xd4f5('0x10')]);}})[_0xd4f5('0x13')](function(_0x323a5a){logger[_0xd4f5('0x11')](_0xd4f5('0xf'),_0x51f8cf,_0x323a5a);_0x405ae3(_0x323a5a);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 1a59465..c02e9c4 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 _0x79a8=['path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','create','update','multer'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x79a8,0x1d0));var _0x879a=function(_0xd29c88,_0x141c80){_0xd29c88=_0xd29c88-0x0;var _0x375635=_0x79a8[_0xd29c88];return _0x375635;};'use strict';var multer=require(_0x879a('0x0'));var util=require('util');var path=require(_0x879a('0x1'));var timeout=require(_0x879a('0x2'));var express=require(_0x879a('0x3'));var router=express['Router']();var fs_extra=require(_0x879a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x879a('0x5'));var config=require(_0x879a('0x6'));var controller=require(_0x879a('0x7'));router[_0x879a('0x8')]('/',auth[_0x879a('0x9')](),controller[_0x879a('0xa')]);router[_0x879a('0x8')](_0x879a('0xb'),auth['isAuthenticated'](),controller[_0x879a('0xc')]);router['post']('/',auth[_0x879a('0x9')](),controller[_0x879a('0xd')]);router['put'](_0x879a('0xb'),auth[_0x879a('0x9')](),controller[_0x879a('0xe')]);router['delete'](_0x879a('0xb'),auth[_0x879a('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa261=['./analyticMetric.controller','get','isAuthenticated','index','post','create','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x1d0cba,_0x2731b1){var _0xdc3278=function(_0x3b20f5){while(--_0x3b20f5){_0x1d0cba['push'](_0x1d0cba['shift']());}};_0xdc3278(++_0x2731b1);}(_0xa261,0x1a3));var _0x1a26=function(_0x20f563,_0x4a3bf6){_0x20f563=_0x20f563-0x0;var _0x5c15a1=_0xa261[_0x20f563];return _0x5c15a1;};'use strict';var multer=require(_0x1a26('0x0'));var util=require('util');var path=require(_0x1a26('0x1'));var timeout=require(_0x1a26('0x2'));var express=require(_0x1a26('0x3'));var router=express[_0x1a26('0x4')]();var fs_extra=require(_0x1a26('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1a26('0x6'));router[_0x1a26('0x7')]('/',auth[_0x1a26('0x8')](),controller[_0x1a26('0x9')]);router[_0x1a26('0x7')]('/:id',auth[_0x1a26('0x8')](),controller['show']);router[_0x1a26('0xa')]('/',auth[_0x1a26('0x8')](),controller[_0x1a26('0xb')]);router['put'](_0x1a26('0xc'),auth[_0x1a26('0x8')](),controller[_0x1a26('0xd')]);router[_0x1a26('0xe')](_0x1a26('0xc'),auth['isAuthenticated'](),controller[_0x1a26('0xf')]);module[_0x1a26('0x10')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 8ab2944..63847d9 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 _0x8f6a=['TEXT','sequelize','exports'];(function(_0x9ae5b4,_0x139b17){var _0xa4d634=function(_0x57500e){while(--_0x57500e){_0x9ae5b4['push'](_0x9ae5b4['shift']());}};_0xa4d634(++_0x139b17);}(_0x8f6a,0x12d));var _0xa8f6=function(_0x59ddda,_0x332c06){_0x59ddda=_0x59ddda-0x0;var _0x1ab861=_0x8f6a[_0x59ddda];return _0x1ab861;};'use strict';var Sequelize=require(_0xa8f6('0x0'));module[_0xa8f6('0x1')]={'tree':{'type':Sequelize[_0xa8f6('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x4e05=['exports','sequelize'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x4e05,0x193));var _0x54e0=function(_0x5cd25b,_0x950abb){_0x5cd25b=_0x5cd25b-0x0;var _0x1c57a2=_0x4e05[_0x5cd25b];return _0x1c57a2;};'use strict';var Sequelize=require(_0x54e0('0x0'));module[_0x54e0('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 29df0b9..566ddf2 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 _0x27d7=['pick','filter','merge','type','VIRTUAL','count','includeAll','catch','show','params','fields','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','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','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','AnalyticTreeReport','rawAttributes','key','map','keys','query','filters','intersection','model','attributes','length','nolimit','order','sort','where'];(function(_0x470137,_0x41829f){var _0x3737e0=function(_0x4b652e){while(--_0x4b652e){_0x470137['push'](_0x470137['shift']());}};_0x3737e0(++_0x41829f);}(_0x27d7,0xa7));var _0x727d=function(_0x51e5bd,_0x3c2cf1){_0x51e5bd=_0x51e5bd-0x0;var _0x250aed=_0x27d7[_0x51e5bd];return _0x250aed;};'use strict';var emlformat=require(_0x727d('0x0'));var rimraf=require(_0x727d('0x1'));var zipdir=require(_0x727d('0x2'));var jsonpatch=require(_0x727d('0x3'));var rp=require(_0x727d('0x4'));var moment=require('moment');var BPromise=require(_0x727d('0x5'));var Mustache=require('mustache');var util=require(_0x727d('0x6'));var path=require('path');var sox=require(_0x727d('0x7'));var csv=require(_0x727d('0x8'));var ejs=require(_0x727d('0x9'));var fs=require('fs');var fs_extra=require(_0x727d('0xa'));var _=require(_0x727d('0xb'));var squel=require(_0x727d('0xc'));var crypto=require(_0x727d('0xd'));var jsforce=require(_0x727d('0xe'));var deskjs=require(_0x727d('0xf'));var toCsv=require(_0x727d('0x8'));var querystring=require('querystring');var Papa=require(_0x727d('0x10'));var Redis=require(_0x727d('0x11'));var authService=require(_0x727d('0x12'));var qs=require(_0x727d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x727d('0x14'));var logger=require(_0x727d('0x15'))(_0x727d('0x16'));var utils=require(_0x727d('0x17'));var config=require(_0x727d('0x18'));var licenseUtil=require(_0x727d('0x19'));var db=require(_0x727d('0x1a'))['db'];function respondWithStatusCode(_0x321068,_0x1ca9c7){_0x1ca9c7=_0x1ca9c7||0xcc;return function(_0x1d860c){if(_0x1d860c){return _0x321068[_0x727d('0x1b')](_0x1ca9c7);}return _0x321068['status'](_0x1ca9c7)[_0x727d('0x1c')]();};}function respondWithResult(_0x429a79,_0x48821d){_0x48821d=_0x48821d||0xc8;return function(_0x12d790){if(_0x12d790){return _0x429a79[_0x727d('0x1d')](_0x48821d)[_0x727d('0x1e')](_0x12d790);}};}function respondWithFilteredResult(_0x11832c,_0x396d42){return function(_0x1a2467){if(_0x1a2467){var _0x303fea=typeof _0x396d42[_0x727d('0x1f')]===_0x727d('0x20')&&typeof _0x396d42[_0x727d('0x21')]==='undefined';var _0x513849=_0x1a2467['count'];var _0x403fac=_0x303fea?0x0:_0x396d42[_0x727d('0x1f')];var _0x3cc4dc=_0x303fea?_0x1a2467['count']:_0x396d42['offset']+_0x396d42[_0x727d('0x21')];var _0x594e80;if(_0x3cc4dc>=_0x513849){_0x3cc4dc=_0x513849;_0x594e80=0xc8;}else{_0x594e80=0xce;}_0x11832c[_0x727d('0x1d')](_0x594e80);return _0x11832c[_0x727d('0x22')](_0x727d('0x23'),_0x403fac+'-'+_0x3cc4dc+'/'+_0x513849)[_0x727d('0x1e')](_0x1a2467);}return null;};}function patchUpdates(_0x8b6a01){return function(_0xe32817){try{jsonpatch[_0x727d('0x24')](_0xe32817,_0x8b6a01,!![]);}catch(_0x8d51a0){return BPromise[_0x727d('0x25')](_0x8d51a0);}return _0xe32817[_0x727d('0x26')]();};}function saveUpdates(_0x5d0772,_0x22c65e){return function(_0x376e35){if(_0x376e35){return _0x376e35[_0x727d('0x27')](_0x5d0772)[_0x727d('0x28')](function(_0x20ff11){return _0x20ff11;});}return null;};}function removeEntity(_0x48ac12,_0x3d5677){return function(_0x466ced){if(_0x466ced){return _0x466ced[_0x727d('0x29')]()[_0x727d('0x28')](function(){_0x48ac12['status'](0xcc)[_0x727d('0x1c')]();});}};}function handleEntityNotFound(_0x5f19c3,_0x4055bf){return function(_0x55559e){if(!_0x55559e){_0x5f19c3[_0x727d('0x1b')](0x194);}return _0x55559e;};}function handleError(_0x1cb4fa,_0x2db44f){_0x2db44f=_0x2db44f||0x1f4;return function(_0x43fe4d){logger[_0x727d('0x2a')](_0x43fe4d['stack']);if(_0x43fe4d['name']){delete _0x43fe4d[_0x727d('0x2b')];}_0x1cb4fa[_0x727d('0x1d')](_0x2db44f)[_0x727d('0x2c')](_0x43fe4d);};}exports[_0x727d('0x2d')]=function(_0x3fc033,_0x3d1081){var _0x160bd0={},_0x1db63b={},_0x4b8e45={'count':0x0,'rows':[]};var _0x47df5d=_['map'](db[_0x727d('0x2e')][_0x727d('0x2f')],function(_0x21fc5c){return{'name':_0x21fc5c['fieldName'],'type':_0x21fc5c['type'][_0x727d('0x30')]};});_0x1db63b['model']=_[_0x727d('0x31')](_0x47df5d,_0x727d('0x2b'));_0x1db63b['query']=_[_0x727d('0x32')](_0x3fc033[_0x727d('0x33')]);_0x1db63b[_0x727d('0x34')]=_[_0x727d('0x35')](_0x1db63b[_0x727d('0x36')],_0x1db63b[_0x727d('0x33')]);_0x160bd0[_0x727d('0x37')]=_['intersection'](_0x1db63b[_0x727d('0x36')],qs['fields'](_0x3fc033[_0x727d('0x33')]['fields']));_0x160bd0[_0x727d('0x37')]=_0x160bd0[_0x727d('0x37')][_0x727d('0x38')]?_0x160bd0[_0x727d('0x37')]:_0x1db63b[_0x727d('0x36')];if(!_0x3fc033[_0x727d('0x33')]['hasOwnProperty'](_0x727d('0x39'))){_0x160bd0[_0x727d('0x21')]=qs[_0x727d('0x21')](_0x3fc033[_0x727d('0x33')][_0x727d('0x21')]);_0x160bd0[_0x727d('0x1f')]=qs[_0x727d('0x1f')](_0x3fc033[_0x727d('0x33')][_0x727d('0x1f')]);}_0x160bd0[_0x727d('0x3a')]=qs[_0x727d('0x3b')](_0x3fc033[_0x727d('0x33')][_0x727d('0x3b')]);_0x160bd0[_0x727d('0x3c')]=qs[_0x727d('0x34')](_[_0x727d('0x3d')](_0x3fc033['query'],_0x1db63b[_0x727d('0x34')]),_0x47df5d);if(_0x3fc033[_0x727d('0x33')][_0x727d('0x3e')]){_0x160bd0[_0x727d('0x3c')]=_[_0x727d('0x3f')](_0x160bd0[_0x727d('0x3c')],{'$or':_[_0x727d('0x31')](_0x47df5d,function(_0x55b1fc){if(_0x55b1fc[_0x727d('0x40')]!==_0x727d('0x41')){var _0x3c99a5={};_0x3c99a5[_0x55b1fc[_0x727d('0x2b')]]={'$like':'%'+_0x3fc033[_0x727d('0x33')][_0x727d('0x3e')]+'%'};return _0x3c99a5;}})});}_0x160bd0=_['merge']({},_0x160bd0,_0x3fc033['options']);var _0x2da1e3={'where':_0x160bd0[_0x727d('0x3c')]};return db[_0x727d('0x2e')]['count'](_0x2da1e3)[_0x727d('0x28')](function(_0x1f4a23){_0x4b8e45[_0x727d('0x42')]=_0x1f4a23;if(_0x3fc033[_0x727d('0x33')][_0x727d('0x43')]){_0x160bd0['include']=[{'all':!![]}];}return db['AnalyticTreeReport']['findAll'](_0x160bd0);})[_0x727d('0x28')](function(_0x5e4cc3){_0x4b8e45['rows']=_0x5e4cc3;return _0x4b8e45;})[_0x727d('0x28')](respondWithFilteredResult(_0x3d1081,_0x160bd0))[_0x727d('0x44')](handleError(_0x3d1081,null));};exports[_0x727d('0x45')]=function(_0x4f8ee3,_0x15db7c){var _0x4794c0={'raw':!![],'where':{'id':_0x4f8ee3[_0x727d('0x46')]['id']}},_0x3f9dd5={};_0x3f9dd5['model']=_[_0x727d('0x32')](db['AnalyticTreeReport'][_0x727d('0x2f')]);_0x3f9dd5[_0x727d('0x33')]=_['keys'](_0x4f8ee3[_0x727d('0x33')]);_0x3f9dd5[_0x727d('0x34')]=_['intersection'](_0x3f9dd5['model'],_0x3f9dd5[_0x727d('0x33')]);_0x4794c0[_0x727d('0x37')]=_['intersection'](_0x3f9dd5[_0x727d('0x36')],qs[_0x727d('0x47')](_0x4f8ee3[_0x727d('0x33')][_0x727d('0x47')]));_0x4794c0[_0x727d('0x37')]=_0x4794c0[_0x727d('0x37')]['length']?_0x4794c0[_0x727d('0x37')]:_0x3f9dd5[_0x727d('0x36')];if(_0x4f8ee3[_0x727d('0x33')][_0x727d('0x43')]){_0x4794c0[_0x727d('0x48')]=[{'all':!![]}];}_0x4794c0=_[_0x727d('0x3f')]({},_0x4794c0,_0x4f8ee3['options']);return db[_0x727d('0x2e')][_0x727d('0x49')](_0x4794c0)['then'](handleEntityNotFound(_0x15db7c,null))[_0x727d('0x28')](respondWithResult(_0x15db7c,null))['catch'](handleError(_0x15db7c,null));};exports[_0x727d('0x4a')]=function(_0x1e5dec,_0x4699a2){return db[_0x727d('0x2e')][_0x727d('0x4a')](_0x1e5dec[_0x727d('0x4b')],{})[_0x727d('0x28')](respondWithResult(_0x4699a2,0xc9))[_0x727d('0x44')](handleError(_0x4699a2,null));};exports[_0x727d('0x27')]=function(_0x2e6407,_0x1cacd8){if(_0x2e6407['body']['id']){delete _0x2e6407[_0x727d('0x4b')]['id'];}return db[_0x727d('0x2e')]['find']({'where':{'id':_0x2e6407['params']['id']}})[_0x727d('0x28')](handleEntityNotFound(_0x1cacd8,null))[_0x727d('0x28')](saveUpdates(_0x2e6407[_0x727d('0x4b')],null))[_0x727d('0x28')](respondWithResult(_0x1cacd8,null))[_0x727d('0x44')](handleError(_0x1cacd8,null));};exports[_0x727d('0x29')]=function(_0x90c82e,_0x4d81c1){return db[_0x727d('0x2e')][_0x727d('0x49')]({'where':{'id':_0x90c82e[_0x727d('0x46')]['id']}})[_0x727d('0x28')](handleEntityNotFound(_0x4d81c1,null))['then'](removeEntity(_0x4d81c1,null))[_0x727d('0x44')](handleError(_0x4d81c1,null));}; \ No newline at end of file +var _0x153a=['catch','keys','find','create','update','body','params','destroy','eml-format','rimraf','zip-dir','request-promise','moment','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/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','then','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','model','query','intersection','fields','length','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','AnalyticTreeReport','includeAll','include','findAll','rows'];(function(_0x48c444,_0x5e2c6d){var _0x4304c7=function(_0x18136b){while(--_0x18136b){_0x48c444['push'](_0x48c444['shift']());}};_0x4304c7(++_0x5e2c6d);}(_0x153a,0x138));var _0xa153=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x153a[_0x2aea9e];return _0x430b92;};'use strict';var emlformat=require(_0xa153('0x0'));var rimraf=require(_0xa153('0x1'));var zipdir=require(_0xa153('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa153('0x3'));var moment=require(_0xa153('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa153('0x5'));var util=require(_0xa153('0x6'));var path=require('path');var sox=require(_0xa153('0x7'));var csv=require(_0xa153('0x8'));var ejs=require(_0xa153('0x9'));var fs=require('fs');var fs_extra=require(_0xa153('0xa'));var _=require(_0xa153('0xb'));var squel=require(_0xa153('0xc'));var crypto=require('crypto');var jsforce=require(_0xa153('0xd'));var deskjs=require(_0xa153('0xe'));var toCsv=require(_0xa153('0x8'));var querystring=require(_0xa153('0xf'));var Papa=require(_0xa153('0x10'));var Redis=require(_0xa153('0x11'));var authService=require(_0xa153('0x12'));var qs=require(_0xa153('0x13'));var as=require(_0xa153('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa153('0x15'))(_0xa153('0x16'));var utils=require(_0xa153('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xa153('0x18'));var db=require(_0xa153('0x19'))['db'];function respondWithStatusCode(_0x3c041d,_0x412f27){_0x412f27=_0x412f27||0xcc;return function(_0x24a9c7){if(_0x24a9c7){return _0x3c041d['sendStatus'](_0x412f27);}return _0x3c041d[_0xa153('0x1a')](_0x412f27)[_0xa153('0x1b')]();};}function respondWithResult(_0x468c65,_0x2108ff){_0x2108ff=_0x2108ff||0xc8;return function(_0x10f537){if(_0x10f537){return _0x468c65[_0xa153('0x1a')](_0x2108ff)['json'](_0x10f537);}};}function respondWithFilteredResult(_0x4cd52e,_0x21ed69){return function(_0x4353be){if(_0x4353be){var _0x317943=typeof _0x21ed69[_0xa153('0x1c')]===_0xa153('0x1d')&&typeof _0x21ed69[_0xa153('0x1e')]==='undefined';var _0x41f389=_0x4353be[_0xa153('0x1f')];var _0x479bec=_0x317943?0x0:_0x21ed69[_0xa153('0x1c')];var _0xee6dab=_0x317943?_0x4353be[_0xa153('0x1f')]:_0x21ed69[_0xa153('0x1c')]+_0x21ed69['limit'];var _0x12a98e;if(_0xee6dab>=_0x41f389){_0xee6dab=_0x41f389;_0x12a98e=0xc8;}else{_0x12a98e=0xce;}_0x4cd52e['status'](_0x12a98e);return _0x4cd52e['set'](_0xa153('0x20'),_0x479bec+'-'+_0xee6dab+'/'+_0x41f389)[_0xa153('0x21')](_0x4353be);}return null;};}function patchUpdates(_0x3bd8f0){return function(_0x49fe91){try{jsonpatch[_0xa153('0x22')](_0x49fe91,_0x3bd8f0,!![]);}catch(_0x31c30d){return BPromise[_0xa153('0x23')](_0x31c30d);}return _0x49fe91[_0xa153('0x24')]();};}function saveUpdates(_0x35077d,_0x5b497c){return function(_0x3bc7ed){if(_0x3bc7ed){return _0x3bc7ed['update'](_0x35077d)[_0xa153('0x25')](function(_0x1b2e5f){return _0x1b2e5f;});}return null;};}function removeEntity(_0x214f79,_0x1fc3fb){return function(_0x2a61f4){if(_0x2a61f4){return _0x2a61f4['destroy']()[_0xa153('0x25')](function(){_0x214f79[_0xa153('0x1a')](0xcc)[_0xa153('0x1b')]();});}};}function handleEntityNotFound(_0x55d350,_0x45acf4){return function(_0x3abecd){if(!_0x3abecd){_0x55d350[_0xa153('0x26')](0x194);}return _0x3abecd;};}function handleError(_0x156f45,_0x442df1){_0x442df1=_0x442df1||0x1f4;return function(_0x734897){logger[_0xa153('0x27')](_0x734897[_0xa153('0x28')]);if(_0x734897[_0xa153('0x29')]){delete _0x734897[_0xa153('0x29')];}_0x156f45[_0xa153('0x1a')](_0x442df1)[_0xa153('0x2a')](_0x734897);};}exports[_0xa153('0x2b')]=function(_0x36f811,_0x4c20e0){var _0xbbc6ee={},_0x3ce108={},_0x3f2646={'count':0x0,'rows':[]};var _0x5d62f8=_[_0xa153('0x2c')](db['AnalyticTreeReport'][_0xa153('0x2d')],function(_0x3a2aa2){return{'name':_0x3a2aa2['fieldName'],'type':_0x3a2aa2[_0xa153('0x2e')][_0xa153('0x2f')]};});_0x3ce108[_0xa153('0x30')]=_[_0xa153('0x2c')](_0x5d62f8,_0xa153('0x29'));_0x3ce108['query']=_['keys'](_0x36f811[_0xa153('0x31')]);_0x3ce108['filters']=_[_0xa153('0x32')](_0x3ce108[_0xa153('0x30')],_0x3ce108[_0xa153('0x31')]);_0xbbc6ee['attributes']=_['intersection'](_0x3ce108[_0xa153('0x30')],qs[_0xa153('0x33')](_0x36f811[_0xa153('0x31')]['fields']));_0xbbc6ee['attributes']=_0xbbc6ee['attributes'][_0xa153('0x34')]?_0xbbc6ee[_0xa153('0x35')]:_0x3ce108['model'];if(!_0x36f811[_0xa153('0x31')][_0xa153('0x36')](_0xa153('0x37'))){_0xbbc6ee[_0xa153('0x1e')]=qs['limit'](_0x36f811[_0xa153('0x31')][_0xa153('0x1e')]);_0xbbc6ee[_0xa153('0x1c')]=qs[_0xa153('0x1c')](_0x36f811[_0xa153('0x31')][_0xa153('0x1c')]);}_0xbbc6ee['order']=qs[_0xa153('0x38')](_0x36f811[_0xa153('0x31')][_0xa153('0x38')]);_0xbbc6ee[_0xa153('0x39')]=qs[_0xa153('0x3a')](_[_0xa153('0x3b')](_0x36f811['query'],_0x3ce108[_0xa153('0x3a')]),_0x5d62f8);if(_0x36f811[_0xa153('0x31')][_0xa153('0x3c')]){_0xbbc6ee['where']=_[_0xa153('0x3d')](_0xbbc6ee['where'],{'$or':_[_0xa153('0x2c')](_0x5d62f8,function(_0x2cd152){if(_0x2cd152[_0xa153('0x2e')]!=='VIRTUAL'){var _0x478c7f={};_0x478c7f[_0x2cd152['name']]={'$like':'%'+_0x36f811[_0xa153('0x31')]['filter']+'%'};return _0x478c7f;}})});}_0xbbc6ee=_['merge']({},_0xbbc6ee,_0x36f811[_0xa153('0x3e')]);var _0x27a77c={'where':_0xbbc6ee[_0xa153('0x39')]};return db[_0xa153('0x3f')][_0xa153('0x1f')](_0x27a77c)['then'](function(_0xd3df11){_0x3f2646['count']=_0xd3df11;if(_0x36f811[_0xa153('0x31')][_0xa153('0x40')]){_0xbbc6ee[_0xa153('0x41')]=[{'all':!![]}];}return db[_0xa153('0x3f')][_0xa153('0x42')](_0xbbc6ee);})[_0xa153('0x25')](function(_0x3140a2){_0x3f2646[_0xa153('0x43')]=_0x3140a2;return _0x3f2646;})[_0xa153('0x25')](respondWithFilteredResult(_0x4c20e0,_0xbbc6ee))[_0xa153('0x44')](handleError(_0x4c20e0,null));};exports['show']=function(_0x5a70ed,_0x224afd){var _0xfa67db={'raw':!![],'where':{'id':_0x5a70ed['params']['id']}},_0x44e83d={};_0x44e83d[_0xa153('0x30')]=_[_0xa153('0x45')](db['AnalyticTreeReport'][_0xa153('0x2d')]);_0x44e83d[_0xa153('0x31')]=_[_0xa153('0x45')](_0x5a70ed[_0xa153('0x31')]);_0x44e83d[_0xa153('0x3a')]=_['intersection'](_0x44e83d[_0xa153('0x30')],_0x44e83d['query']);_0xfa67db[_0xa153('0x35')]=_['intersection'](_0x44e83d[_0xa153('0x30')],qs['fields'](_0x5a70ed[_0xa153('0x31')][_0xa153('0x33')]));_0xfa67db[_0xa153('0x35')]=_0xfa67db[_0xa153('0x35')][_0xa153('0x34')]?_0xfa67db['attributes']:_0x44e83d['model'];if(_0x5a70ed[_0xa153('0x31')][_0xa153('0x40')]){_0xfa67db[_0xa153('0x41')]=[{'all':!![]}];}_0xfa67db=_[_0xa153('0x3d')]({},_0xfa67db,_0x5a70ed[_0xa153('0x3e')]);return db['AnalyticTreeReport'][_0xa153('0x46')](_0xfa67db)['then'](handleEntityNotFound(_0x224afd,null))[_0xa153('0x25')](respondWithResult(_0x224afd,null))['catch'](handleError(_0x224afd,null));};exports[_0xa153('0x47')]=function(_0x40e46e,_0x4e7fc4){return db[_0xa153('0x3f')]['create'](_0x40e46e['body'],{})[_0xa153('0x25')](respondWithResult(_0x4e7fc4,0xc9))[_0xa153('0x44')](handleError(_0x4e7fc4,null));};exports[_0xa153('0x48')]=function(_0xd18485,_0x456fe3){if(_0xd18485[_0xa153('0x49')]['id']){delete _0xd18485['body']['id'];}return db[_0xa153('0x3f')]['find']({'where':{'id':_0xd18485[_0xa153('0x4a')]['id']}})[_0xa153('0x25')](handleEntityNotFound(_0x456fe3,null))['then'](saveUpdates(_0xd18485[_0xa153('0x49')],null))['then'](respondWithResult(_0x456fe3,null))['catch'](handleError(_0x456fe3,null));};exports[_0xa153('0x4b')]=function(_0x57e33f,_0x50f310){return db[_0xa153('0x3f')][_0xa153('0x46')]({'where':{'id':_0x57e33f['params']['id']}})[_0xa153('0x25')](handleEntityNotFound(_0x50f310,null))[_0xa153('0x25')](removeEntity(_0x50f310,null))[_0xa153('0x44')](handleError(_0x50f310,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 1b8f523..05be132 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 _0xaf96=['path','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','util','../../config/logger','api','moment','bluebird'];(function(_0x5a5f0f,_0x197f35){var _0x5d2113=function(_0x4ea33c){while(--_0x4ea33c){_0x5a5f0f['push'](_0x5a5f0f['shift']());}};_0x5d2113(++_0x197f35);}(_0xaf96,0x8b));var _0x6af9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaf96[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x6af9('0x0'));var logger=require(_0x6af9('0x1'))(_0x6af9('0x2'));var moment=require(_0x6af9('0x3'));var BPromise=require(_0x6af9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6af9('0x5'));var rimraf=require('rimraf');var config=require(_0x6af9('0x6'));var attributes=require(_0x6af9('0x7'));module[_0x6af9('0x8')]=function(_0x3dd17a,_0x2939bc){return _0x3dd17a[_0x6af9('0x9')](_0x6af9('0xa'),attributes,{'tableName':_0x6af9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc6c=['../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','util','api','bluebird','request-promise','path','rimraf'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xdc6c,0x68));var _0xcdc6=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xdc6c[_0x88cd7b];return _0x56fcc8;};'use strict';var _=require('lodash');var util=require(_0xcdc6('0x0'));var logger=require('../../config/logger')(_0xcdc6('0x1'));var moment=require('moment');var BPromise=require(_0xcdc6('0x2'));var rp=require(_0xcdc6('0x3'));var fs=require('fs');var path=require(_0xcdc6('0x4'));var rimraf=require(_0xcdc6('0x5'));var config=require(_0xcdc6('0x6'));var attributes=require(_0xcdc6('0x7'));module[_0xcdc6('0x8')]=function(_0x306308,_0x450fdf){return _0x306308[_0xcdc6('0x9')](_0xcdc6('0xa'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 19083e7..be42a80 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 _0x7a54=['info','AnalyticTreeReport,\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(_0x5e62e9,_0x566fed){_0x5e62e9=_0x5e62e9-0x0;var _0x32271e=_0x7a54[_0x5e62e9];return _0x32271e;};'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')]('AnalyticTreeReport,\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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x97a80f,_0x3d70d7){var _0x534071=function(_0xd8966e){while(--_0xd8966e){_0x97a80f['push'](_0x97a80f['shift']());}};_0x534071(++_0x3d70d7);}(_0xadb5,0xad));var _0x5adb=function(_0x2622a3,_0x2a099e){_0x2622a3=_0x2622a3-0x0;var _0x1000e7=_0xadb5[_0x2622a3];return _0x1000e7;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 39f8526..57d26b4 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 _0xaeae=['../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x3810f6,_0x41f38f){var _0x442125=function(_0x394205){while(--_0x394205){_0x3810f6['push'](_0x3810f6['shift']());}};_0x442125(++_0x41f38f);}(_0xaeae,0xa1));var _0xeaea=function(_0x14151d,_0x9bc455){_0x14151d=_0x14151d-0x0;var _0x371652=_0xaeae[_0x14151d];return _0x371652;};'use strict';var multer=require(_0xeaea('0x0'));var util=require(_0xeaea('0x1'));var path=require(_0xeaea('0x2'));var timeout=require(_0xeaea('0x3'));var express=require(_0xeaea('0x4'));var router=express[_0xeaea('0x5')]();var fs_extra=require(_0xeaea('0x6'));var auth=require(_0xeaea('0x7'));var interaction=require(_0xeaea('0x8'));var config=require(_0xeaea('0x9'));var controller=require(_0xeaea('0xa'));router[_0xeaea('0xb')]('/',auth[_0xeaea('0xc')](),controller[_0xeaea('0xd')]);router['get'](_0xeaea('0xe'),auth[_0xeaea('0xc')](),controller[_0xeaea('0xf')]);router[_0xeaea('0x10')]('/',auth[_0xeaea('0xc')](),controller['create']);router[_0xeaea('0x11')](_0xeaea('0xe'),auth[_0xeaea('0xc')](),controller[_0xeaea('0x12')]);router[_0xeaea('0x13')](_0xeaea('0xe'),auth['isAuthenticated'](),controller[_0xeaea('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa743=['isAuthenticated','get','/:id','show','create','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xa743,0x86));var _0x3a74=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0xa743[_0x39e283];return _0x7de89f;};'use strict';var multer=require(_0x3a74('0x0'));var util=require('util');var path=require(_0x3a74('0x1'));var timeout=require(_0x3a74('0x2'));var express=require(_0x3a74('0x3'));var router=express[_0x3a74('0x4')]();var fs_extra=require(_0x3a74('0x5'));var auth=require(_0x3a74('0x6'));var interaction=require(_0x3a74('0x7'));var config=require(_0x3a74('0x8'));var controller=require(_0x3a74('0x9'));router['get']('/',auth[_0x3a74('0xa')](),controller['index']);router[_0x3a74('0xb')](_0x3a74('0xc'),auth[_0x3a74('0xa')](),controller[_0x3a74('0xd')]);router['post']('/',auth[_0x3a74('0xa')](),controller[_0x3a74('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x3a74('0xf')](_0x3a74('0xc'),auth[_0x3a74('0xa')](),controller[_0x3a74('0x10')]);module[_0x3a74('0x11')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 59bb1d7..a537755 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 _0xb6b1=['STRING','sequelize'];(function(_0x3f9584,_0x5ab12c){var _0x9d54c=function(_0x2882df){while(--_0x2882df){_0x3f9584['push'](_0x3f9584['shift']());}};_0x9d54c(++_0x5ab12c);}(_0xb6b1,0x17b));var _0x1b6b=function(_0xa79977,_0x4f7f12){_0xa79977=_0xa79977-0x0;var _0x109f10=_0xb6b1[_0xa79977];return _0x109f10;};'use strict';var Sequelize=require(_0x1b6b('0x0'));module['exports']={'name':{'type':Sequelize[_0x1b6b('0x1')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x1b6b('0x1')]}}; \ No newline at end of file +var _0x057a=['exports','STRING','sequelize'];(function(_0x1081f0,_0x1d5187){var _0x142afa=function(_0x5c9f4b){while(--_0x5c9f4b){_0x1081f0['push'](_0x1081f0['shift']());}};_0x142afa(++_0x1d5187);}(_0x057a,0x1a6));var _0xa057=function(_0x5d53c0,_0x2e113f){_0x5d53c0=_0x5d53c0-0x0;var _0xb29b20=_0x057a[_0x5d53c0];return _0xb29b20;};'use strict';var Sequelize=require(_0xa057('0x0'));module[_0xa057('0x1')]={'name':{'type':Sequelize[_0xa057('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xa057('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index a189964..3564895 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 _0x95ae=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','Attachment','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','fields','includeAll','merge','find','get','omit','createdAt','updatedAt','body','create','file','originalname','basename','filename','mimetype','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel'];(function(_0x55c485,_0x3fe77e){var _0x6bb521=function(_0x466a3d){while(--_0x466a3d){_0x55c485['push'](_0x55c485['shift']());}};_0x6bb521(++_0x3fe77e);}(_0x95ae,0xb1));var _0xe95a=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x95ae[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require(_0xe95a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe95a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe95a('0x2'));var moment=require(_0xe95a('0x3'));var BPromise=require(_0xe95a('0x4'));var Mustache=require(_0xe95a('0x5'));var util=require(_0xe95a('0x6'));var path=require(_0xe95a('0x7'));var sox=require(_0xe95a('0x8'));var csv=require('to-csv');var ejs=require(_0xe95a('0x9'));var fs=require('fs');var fs_extra=require(_0xe95a('0xa'));var _=require(_0xe95a('0xb'));var squel=require(_0xe95a('0xc'));var crypto=require(_0xe95a('0xd'));var jsforce=require(_0xe95a('0xe'));var deskjs=require(_0xe95a('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe95a('0x10'));var Papa=require(_0xe95a('0x11'));var Redis=require(_0xe95a('0x12'));var authService=require(_0xe95a('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe95a('0x14'));var hardwareService=require(_0xe95a('0x15'));var logger=require('../../config/logger')(_0xe95a('0x16'));var utils=require(_0xe95a('0x17'));var config=require(_0xe95a('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe95a('0x19'))['db'];function respondWithStatusCode(_0x24b257,_0x564a3d){_0x564a3d=_0x564a3d||0xcc;return function(_0x15e61c){if(_0x15e61c){return _0x24b257['sendStatus'](_0x564a3d);}return _0x24b257[_0xe95a('0x1a')](_0x564a3d)[_0xe95a('0x1b')]();};}function respondWithResult(_0x1447af,_0x25ab84){_0x25ab84=_0x25ab84||0xc8;return function(_0x44c517){if(_0x44c517){return _0x1447af[_0xe95a('0x1a')](_0x25ab84)[_0xe95a('0x1c')](_0x44c517);}};}function respondWithFilteredResult(_0xe4787d,_0x482013){return function(_0x5ceb8f){if(_0x5ceb8f){var _0x45ea0c=typeof _0x482013[_0xe95a('0x1d')]===_0xe95a('0x1e')&&typeof _0x482013[_0xe95a('0x1f')]===_0xe95a('0x1e');var _0x350ce3=_0x5ceb8f[_0xe95a('0x20')];var _0x46ee37=_0x45ea0c?0x0:_0x482013[_0xe95a('0x1d')];var _0xb1e685=_0x45ea0c?_0x5ceb8f[_0xe95a('0x20')]:_0x482013[_0xe95a('0x1d')]+_0x482013['limit'];var _0x11dc7b;if(_0xb1e685>=_0x350ce3){_0xb1e685=_0x350ce3;_0x11dc7b=0xc8;}else{_0x11dc7b=0xce;}_0xe4787d[_0xe95a('0x1a')](_0x11dc7b);return _0xe4787d[_0xe95a('0x21')](_0xe95a('0x22'),_0x46ee37+'-'+_0xb1e685+'/'+_0x350ce3)[_0xe95a('0x1c')](_0x5ceb8f);}return null;};}function patchUpdates(_0x3d90ea){return function(_0x15b873){try{jsonpatch[_0xe95a('0x23')](_0x15b873,_0x3d90ea,!![]);}catch(_0x30dfe5){return BPromise[_0xe95a('0x24')](_0x30dfe5);}return _0x15b873[_0xe95a('0x25')]();};}function saveUpdates(_0x3b04f6,_0x398270){return function(_0x257b2a){if(_0x257b2a){return _0x257b2a[_0xe95a('0x26')](_0x3b04f6)[_0xe95a('0x27')](function(_0x486451){return _0x486451;});}return null;};}function removeEntity(_0x56b347,_0x157cc3){return function(_0x1668c4){if(_0x1668c4){return _0x1668c4[_0xe95a('0x28')]()[_0xe95a('0x27')](function(){_0x56b347['status'](0xcc)[_0xe95a('0x1b')]();});}};}function handleEntityNotFound(_0x4e2174,_0x61925e){return function(_0x109bad){if(!_0x109bad){_0x4e2174[_0xe95a('0x29')](0x194);}return _0x109bad;};}function handleError(_0x24377b,_0x38534d){_0x38534d=_0x38534d||0x1f4;return function(_0x2e2e5a){logger[_0xe95a('0x2a')](_0x2e2e5a[_0xe95a('0x2b')]);if(_0x2e2e5a[_0xe95a('0x2c')]){delete _0x2e2e5a[_0xe95a('0x2c')];}_0x24377b[_0xe95a('0x1a')](_0x38534d)[_0xe95a('0x2d')](_0x2e2e5a);};}exports[_0xe95a('0x2e')]=function(_0x7984ec,_0x3cb7ff){var _0x2efdee={},_0x2902d3={},_0x3dc720={'count':0x0,'rows':[]};var _0x252ab1=_['map'](db[_0xe95a('0x2f')][_0xe95a('0x30')],function(_0x2674de){return{'name':_0x2674de[_0xe95a('0x31')],'type':_0x2674de['type'][_0xe95a('0x32')]};});_0x2902d3[_0xe95a('0x33')]=_['map'](_0x252ab1,'name');_0x2902d3[_0xe95a('0x34')]=_['keys'](_0x7984ec[_0xe95a('0x34')]);_0x2902d3[_0xe95a('0x35')]=_[_0xe95a('0x36')](_0x2902d3['model'],_0x2902d3[_0xe95a('0x34')]);_0x2efdee[_0xe95a('0x37')]=_[_0xe95a('0x36')](_0x2902d3[_0xe95a('0x33')],qs['fields'](_0x7984ec['query']['fields']));_0x2efdee['attributes']=_0x2efdee['attributes'][_0xe95a('0x38')]?_0x2efdee[_0xe95a('0x37')]:_0x2902d3[_0xe95a('0x33')];if(!_0x7984ec[_0xe95a('0x34')][_0xe95a('0x39')](_0xe95a('0x3a'))){_0x2efdee['limit']=qs['limit'](_0x7984ec[_0xe95a('0x34')][_0xe95a('0x1f')]);_0x2efdee[_0xe95a('0x1d')]=qs[_0xe95a('0x1d')](_0x7984ec[_0xe95a('0x34')]['offset']);}_0x2efdee[_0xe95a('0x3b')]=qs[_0xe95a('0x3c')](_0x7984ec['query'][_0xe95a('0x3c')]);_0x2efdee['where']=qs[_0xe95a('0x35')](_[_0xe95a('0x3d')](_0x7984ec[_0xe95a('0x34')],_0x2902d3[_0xe95a('0x35')]),_0x252ab1);if(_0x7984ec['query'][_0xe95a('0x3e')]){_0x2efdee[_0xe95a('0x3f')]=_['merge'](_0x2efdee['where'],{'$or':_['map'](_0x252ab1,function(_0x5e28e8){if(_0x5e28e8[_0xe95a('0x40')]!==_0xe95a('0x41')){var _0x3a0109={};_0x3a0109[_0x5e28e8[_0xe95a('0x2c')]]={'$like':'%'+_0x7984ec[_0xe95a('0x34')][_0xe95a('0x3e')]+'%'};return _0x3a0109;}})});}_0x2efdee=_['merge']({},_0x2efdee,_0x7984ec[_0xe95a('0x42')]);var _0x19f2ec={'where':_0x2efdee[_0xe95a('0x3f')]};return db['Attachment'][_0xe95a('0x20')](_0x19f2ec)[_0xe95a('0x27')](function(_0x1cf34c){_0x3dc720[_0xe95a('0x20')]=_0x1cf34c;if(_0x7984ec[_0xe95a('0x34')]['includeAll']){_0x2efdee[_0xe95a('0x43')]=[{'all':!![]}];}return db['Attachment'][_0xe95a('0x44')](_0x2efdee);})[_0xe95a('0x27')](function(_0x5cd4ea){_0x3dc720[_0xe95a('0x45')]=_0x5cd4ea;return _0x3dc720;})['then'](respondWithFilteredResult(_0x3cb7ff,_0x2efdee))[_0xe95a('0x46')](handleError(_0x3cb7ff,null));};exports[_0xe95a('0x47')]=function(_0x2e6dea,_0x561775){var _0x7cadbc={'raw':!![],'where':{'id':_0x2e6dea[_0xe95a('0x48')]['id']}},_0x8ed769={};_0x8ed769[_0xe95a('0x33')]=_[_0xe95a('0x49')](db[_0xe95a('0x2f')]['rawAttributes']);_0x8ed769['query']=_[_0xe95a('0x49')](_0x2e6dea[_0xe95a('0x34')]);_0x8ed769[_0xe95a('0x35')]=_[_0xe95a('0x36')](_0x8ed769[_0xe95a('0x33')],_0x8ed769[_0xe95a('0x34')]);_0x7cadbc[_0xe95a('0x37')]=_[_0xe95a('0x36')](_0x8ed769[_0xe95a('0x33')],qs['fields'](_0x2e6dea['query'][_0xe95a('0x4a')]));_0x7cadbc[_0xe95a('0x37')]=_0x7cadbc[_0xe95a('0x37')]['length']?_0x7cadbc[_0xe95a('0x37')]:_0x8ed769[_0xe95a('0x33')];if(_0x2e6dea[_0xe95a('0x34')][_0xe95a('0x4b')]){_0x7cadbc['include']=[{'all':!![]}];}_0x7cadbc=_[_0xe95a('0x4c')]({},_0x7cadbc,_0x2e6dea[_0xe95a('0x42')]);return db[_0xe95a('0x2f')]['find'](_0x7cadbc)['then'](handleEntityNotFound(_0x561775,null))[_0xe95a('0x27')](respondWithResult(_0x561775,null))[_0xe95a('0x46')](handleError(_0x561775,null));};exports['clone']=function(_0x53ae61,_0x40c020){var _0x2b2689={'where':{'id':_0x53ae61[_0xe95a('0x48')]['id']}},_0x15b1be={};_0x15b1be[_0xe95a('0x33')]=_[_0xe95a('0x49')](db[_0xe95a('0x2f')][_0xe95a('0x30')]);_0x2b2689[_0xe95a('0x37')]=_[_0xe95a('0x36')](_0x15b1be[_0xe95a('0x33')],qs['fields'](_0x53ae61[_0xe95a('0x34')][_0xe95a('0x4a')]));_0x2b2689[_0xe95a('0x37')]=_0x2b2689['attributes'][_0xe95a('0x38')]?_0x2b2689[_0xe95a('0x37')]:_0x15b1be['model'];if(_0x53ae61[_0xe95a('0x34')][_0xe95a('0x4b')]){_0x2b2689[_0xe95a('0x43')]=[{'all':!![]}];}_0x2b2689=_[_0xe95a('0x4c')]({},_0x2b2689,_0x53ae61[_0xe95a('0x42')]);return db['Attachment'][_0xe95a('0x4d')](_0x2b2689)[_0xe95a('0x27')](handleEntityNotFound(_0x40c020,null))[_0xe95a('0x27')](function(_0x2d02ab){if(_0x2d02ab){var _0x5af28d=_0x2d02ab[_0xe95a('0x4e')]({'plain':!![]});_0x5af28d=qs[_0xe95a('0x4f')](_0x5af28d,['id',_0xe95a('0x50'),_0xe95a('0x51')]);_0x53ae61[_0xe95a('0x52')]=_['omit'](_0x53ae61[_0xe95a('0x52')],['id',_0xe95a('0x50'),_0xe95a('0x51')]);return db[_0xe95a('0x2f')][_0xe95a('0x53')](_[_0xe95a('0x4c')](_0x5af28d,_0x53ae61[_0xe95a('0x52')]),{'include':_0x53ae61[_0xe95a('0x34')][_0xe95a('0x4b')]?[{'all':!![]}]:undefined});}})[_0xe95a('0x27')](respondWithResult(_0x40c020,0xc9))['catch'](handleError(_0x40c020,null));};exports[_0xe95a('0x26')]=function(_0x6146a5,_0x24d347){if(_0x6146a5['body']['id']){delete _0x6146a5[_0xe95a('0x52')]['id'];}return db[_0xe95a('0x2f')][_0xe95a('0x4d')]({'where':{'id':_0x6146a5['params']['id']}})[_0xe95a('0x27')](handleEntityNotFound(_0x24d347,null))[_0xe95a('0x27')](saveUpdates(_0x6146a5[_0xe95a('0x52')],null))['then'](respondWithResult(_0x24d347,null))[_0xe95a('0x46')](handleError(_0x24d347,null));};exports['destroy']=function(_0x3aa9b2,_0x1c6f94){return db[_0xe95a('0x2f')][_0xe95a('0x4d')]({'where':{'id':_0x3aa9b2[_0xe95a('0x48')]['id']}})['then'](handleEntityNotFound(_0x1c6f94,null))['then'](removeEntity(_0x1c6f94,null))[_0xe95a('0x46')](handleError(_0x1c6f94,null));};exports[_0xe95a('0x53')]=function(_0xeaf732,_0x23114f,_0x215eec){_0xeaf732[_0xe95a('0x52')]['name']=_0xeaf732[_0xe95a('0x54')][_0xe95a('0x55')];_0xeaf732[_0xe95a('0x52')][_0xe95a('0x56')]=_0xeaf732[_0xe95a('0x54')][_0xe95a('0x57')];_0xeaf732[_0xe95a('0x52')][_0xe95a('0x40')]=_0xeaf732['file'][_0xe95a('0x58')];return db[_0xe95a('0x2f')][_0xe95a('0x53')](_0xeaf732[_0xe95a('0x52')])['then'](respondWithResult(_0x23114f,0xc9))[_0xe95a('0x46')](handleError(_0x23114f,null));};exports['download']=function(_0x44fc11,_0x373039,_0x3c7e62){return db[_0xe95a('0x2f')]['findOne']({'where':{'id':_0x44fc11[_0xe95a('0x48')]['id']},'raw':!![]})[_0xe95a('0x27')](handleEntityNotFound(_0x373039,null))['then'](function(_0x1db057){if(_0x1db057){var _0x3851b4=_0x1db057[_0xe95a('0x59')]!==null;var _0x5cab7b=path[_0xe95a('0x5a')](config[_0xe95a('0x5b')],_0xe95a('0x5c'));if(_0x3851b4){_0x5cab7b=path[_0xe95a('0x5a')](_0x5cab7b,_0xe95a('0x5d'));}var _0x4d060c=path[_0xe95a('0x5a')](_0x5cab7b,_0x1db057[_0xe95a('0x56')]);return _0x373039[_0xe95a('0x5e')](_0x4d060c);}})['catch'](handleError(_0x373039,null));}; \ No newline at end of file +var _0x3174=['sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','clone','length','get','omit','createdAt','updatedAt','body','create','file','originalname','basename','filename','mimetype','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','stack','name','index','map','Attachment','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','hasOwnProperty','nolimit'];(function(_0x2ee20d,_0x354e70){var _0xade530=function(_0x1db7cc){while(--_0x1db7cc){_0x2ee20d['push'](_0x2ee20d['shift']());}};_0xade530(++_0x354e70);}(_0x3174,0x18c));var _0x4317=function(_0x50df1f,_0x45b8b1){_0x50df1f=_0x50df1f-0x0;var _0x5180e3=_0x3174[_0x50df1f];return _0x5180e3;};'use strict';var emlformat=require(_0x4317('0x0'));var rimraf=require(_0x4317('0x1'));var zipdir=require(_0x4317('0x2'));var jsonpatch=require(_0x4317('0x3'));var rp=require(_0x4317('0x4'));var moment=require('moment');var BPromise=require(_0x4317('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4317('0x6'));var sox=require(_0x4317('0x7'));var csv=require(_0x4317('0x8'));var ejs=require(_0x4317('0x9'));var fs=require('fs');var fs_extra=require(_0x4317('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4317('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4317('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4317('0xd'));var Redis=require(_0x4317('0xe'));var authService=require(_0x4317('0xf'));var qs=require(_0x4317('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4317('0x11'));var logger=require(_0x4317('0x12'))(_0x4317('0x13'));var utils=require(_0x4317('0x14'));var config=require(_0x4317('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x4317('0x16'))['db'];function respondWithStatusCode(_0x18a625,_0x33fd1c){_0x33fd1c=_0x33fd1c||0xcc;return function(_0x298aed){if(_0x298aed){return _0x18a625[_0x4317('0x17')](_0x33fd1c);}return _0x18a625[_0x4317('0x18')](_0x33fd1c)[_0x4317('0x19')]();};}function respondWithResult(_0x49920a,_0x26ef32){_0x26ef32=_0x26ef32||0xc8;return function(_0x10024e){if(_0x10024e){return _0x49920a[_0x4317('0x18')](_0x26ef32)[_0x4317('0x1a')](_0x10024e);}};}function respondWithFilteredResult(_0x57901b,_0x250fc3){return function(_0x219adf){if(_0x219adf){var _0x150d36=typeof _0x250fc3[_0x4317('0x1b')]===_0x4317('0x1c')&&typeof _0x250fc3[_0x4317('0x1d')]===_0x4317('0x1c');var _0x17bcf8=_0x219adf['count'];var _0x37aa88=_0x150d36?0x0:_0x250fc3['offset'];var _0x5a4177=_0x150d36?_0x219adf[_0x4317('0x1e')]:_0x250fc3[_0x4317('0x1b')]+_0x250fc3['limit'];var _0x3a9466;if(_0x5a4177>=_0x17bcf8){_0x5a4177=_0x17bcf8;_0x3a9466=0xc8;}else{_0x3a9466=0xce;}_0x57901b[_0x4317('0x18')](_0x3a9466);return _0x57901b[_0x4317('0x1f')](_0x4317('0x20'),_0x37aa88+'-'+_0x5a4177+'/'+_0x17bcf8)[_0x4317('0x1a')](_0x219adf);}return null;};}function patchUpdates(_0x2ea18a){return function(_0xd4cb2c){try{jsonpatch[_0x4317('0x21')](_0xd4cb2c,_0x2ea18a,!![]);}catch(_0x554294){return BPromise['reject'](_0x554294);}return _0xd4cb2c['save']();};}function saveUpdates(_0x2b88cc,_0x5c495a){return function(_0x22d28){if(_0x22d28){return _0x22d28[_0x4317('0x22')](_0x2b88cc)[_0x4317('0x23')](function(_0x35855e){return _0x35855e;});}return null;};}function removeEntity(_0x30360e,_0x2a3eb0){return function(_0x407b6c){if(_0x407b6c){return _0x407b6c[_0x4317('0x24')]()[_0x4317('0x23')](function(){_0x30360e[_0x4317('0x18')](0xcc)[_0x4317('0x19')]();});}};}function handleEntityNotFound(_0x4b179e,_0x3ea927){return function(_0x15c091){if(!_0x15c091){_0x4b179e[_0x4317('0x17')](0x194);}return _0x15c091;};}function handleError(_0x97e718,_0x42c0a6){_0x42c0a6=_0x42c0a6||0x1f4;return function(_0x4c50e7){logger['error'](_0x4c50e7[_0x4317('0x25')]);if(_0x4c50e7[_0x4317('0x26')]){delete _0x4c50e7[_0x4317('0x26')];}_0x97e718[_0x4317('0x18')](_0x42c0a6)['send'](_0x4c50e7);};}exports[_0x4317('0x27')]=function(_0x14ec45,_0x18409e){var _0x36b6d1={},_0x2b21c4={},_0x5702ce={'count':0x0,'rows':[]};var _0xa5b3d3=_[_0x4317('0x28')](db[_0x4317('0x29')][_0x4317('0x2a')],function(_0x260e5f){return{'name':_0x260e5f[_0x4317('0x2b')],'type':_0x260e5f[_0x4317('0x2c')][_0x4317('0x2d')]};});_0x2b21c4['model']=_['map'](_0xa5b3d3,_0x4317('0x26'));_0x2b21c4['query']=_[_0x4317('0x2e')](_0x14ec45[_0x4317('0x2f')]);_0x2b21c4['filters']=_[_0x4317('0x30')](_0x2b21c4[_0x4317('0x31')],_0x2b21c4[_0x4317('0x2f')]);_0x36b6d1[_0x4317('0x32')]=_['intersection'](_0x2b21c4['model'],qs[_0x4317('0x33')](_0x14ec45[_0x4317('0x2f')][_0x4317('0x33')]));_0x36b6d1[_0x4317('0x32')]=_0x36b6d1[_0x4317('0x32')]['length']?_0x36b6d1['attributes']:_0x2b21c4[_0x4317('0x31')];if(!_0x14ec45['query'][_0x4317('0x34')](_0x4317('0x35'))){_0x36b6d1[_0x4317('0x1d')]=qs[_0x4317('0x1d')](_0x14ec45['query'][_0x4317('0x1d')]);_0x36b6d1[_0x4317('0x1b')]=qs[_0x4317('0x1b')](_0x14ec45[_0x4317('0x2f')][_0x4317('0x1b')]);}_0x36b6d1['order']=qs[_0x4317('0x36')](_0x14ec45[_0x4317('0x2f')]['sort']);_0x36b6d1['where']=qs[_0x4317('0x37')](_[_0x4317('0x38')](_0x14ec45[_0x4317('0x2f')],_0x2b21c4[_0x4317('0x37')]),_0xa5b3d3);if(_0x14ec45[_0x4317('0x2f')][_0x4317('0x39')]){_0x36b6d1[_0x4317('0x3a')]=_[_0x4317('0x3b')](_0x36b6d1[_0x4317('0x3a')],{'$or':_['map'](_0xa5b3d3,function(_0x3328d8){if(_0x3328d8[_0x4317('0x2c')]!==_0x4317('0x3c')){var _0xe3e1e7={};_0xe3e1e7[_0x3328d8[_0x4317('0x26')]]={'$like':'%'+_0x14ec45['query']['filter']+'%'};return _0xe3e1e7;}})});}_0x36b6d1=_['merge']({},_0x36b6d1,_0x14ec45[_0x4317('0x3d')]);var _0x344eee={'where':_0x36b6d1[_0x4317('0x3a')]};return db[_0x4317('0x29')]['count'](_0x344eee)[_0x4317('0x23')](function(_0x17a217){_0x5702ce[_0x4317('0x1e')]=_0x17a217;if(_0x14ec45[_0x4317('0x2f')][_0x4317('0x3e')]){_0x36b6d1[_0x4317('0x3f')]=[{'all':!![]}];}return db[_0x4317('0x29')][_0x4317('0x40')](_0x36b6d1);})[_0x4317('0x23')](function(_0x1732d8){_0x5702ce[_0x4317('0x41')]=_0x1732d8;return _0x5702ce;})[_0x4317('0x23')](respondWithFilteredResult(_0x18409e,_0x36b6d1))[_0x4317('0x42')](handleError(_0x18409e,null));};exports[_0x4317('0x43')]=function(_0xe3cf85,_0x5b510b){var _0xc37a78={'raw':!![],'where':{'id':_0xe3cf85[_0x4317('0x44')]['id']}},_0x52f7e0={};_0x52f7e0[_0x4317('0x31')]=_['keys'](db[_0x4317('0x29')][_0x4317('0x2a')]);_0x52f7e0[_0x4317('0x2f')]=_['keys'](_0xe3cf85['query']);_0x52f7e0[_0x4317('0x37')]=_[_0x4317('0x30')](_0x52f7e0[_0x4317('0x31')],_0x52f7e0[_0x4317('0x2f')]);_0xc37a78[_0x4317('0x32')]=_[_0x4317('0x30')](_0x52f7e0[_0x4317('0x31')],qs[_0x4317('0x33')](_0xe3cf85[_0x4317('0x2f')]['fields']));_0xc37a78[_0x4317('0x32')]=_0xc37a78[_0x4317('0x32')]['length']?_0xc37a78[_0x4317('0x32')]:_0x52f7e0[_0x4317('0x31')];if(_0xe3cf85[_0x4317('0x2f')][_0x4317('0x3e')]){_0xc37a78[_0x4317('0x3f')]=[{'all':!![]}];}_0xc37a78=_[_0x4317('0x3b')]({},_0xc37a78,_0xe3cf85[_0x4317('0x3d')]);return db['Attachment'][_0x4317('0x45')](_0xc37a78)[_0x4317('0x23')](handleEntityNotFound(_0x5b510b,null))['then'](respondWithResult(_0x5b510b,null))['catch'](handleError(_0x5b510b,null));};exports[_0x4317('0x46')]=function(_0x501991,_0x5a52a9){var _0x568750={'where':{'id':_0x501991['params']['id']}},_0xfa9647={};_0xfa9647[_0x4317('0x31')]=_[_0x4317('0x2e')](db['Attachment'][_0x4317('0x2a')]);_0x568750['attributes']=_[_0x4317('0x30')](_0xfa9647['model'],qs[_0x4317('0x33')](_0x501991[_0x4317('0x2f')]['fields']));_0x568750[_0x4317('0x32')]=_0x568750[_0x4317('0x32')][_0x4317('0x47')]?_0x568750[_0x4317('0x32')]:_0xfa9647[_0x4317('0x31')];if(_0x501991[_0x4317('0x2f')][_0x4317('0x3e')]){_0x568750[_0x4317('0x3f')]=[{'all':!![]}];}_0x568750=_['merge']({},_0x568750,_0x501991[_0x4317('0x3d')]);return db[_0x4317('0x29')][_0x4317('0x45')](_0x568750)[_0x4317('0x23')](handleEntityNotFound(_0x5a52a9,null))[_0x4317('0x23')](function(_0x41645e){if(_0x41645e){var _0x1fd5d2=_0x41645e[_0x4317('0x48')]({'plain':!![]});_0x1fd5d2=qs[_0x4317('0x49')](_0x1fd5d2,['id',_0x4317('0x4a'),_0x4317('0x4b')]);_0x501991[_0x4317('0x4c')]=_[_0x4317('0x49')](_0x501991[_0x4317('0x4c')],['id',_0x4317('0x4a'),_0x4317('0x4b')]);return db[_0x4317('0x29')][_0x4317('0x4d')](_[_0x4317('0x3b')](_0x1fd5d2,_0x501991[_0x4317('0x4c')]),{'include':_0x501991[_0x4317('0x2f')][_0x4317('0x3e')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x5a52a9,0xc9))[_0x4317('0x42')](handleError(_0x5a52a9,null));};exports[_0x4317('0x22')]=function(_0x4b6176,_0x2f1b2b){if(_0x4b6176[_0x4317('0x4c')]['id']){delete _0x4b6176[_0x4317('0x4c')]['id'];}return db[_0x4317('0x29')][_0x4317('0x45')]({'where':{'id':_0x4b6176['params']['id']}})[_0x4317('0x23')](handleEntityNotFound(_0x2f1b2b,null))['then'](saveUpdates(_0x4b6176[_0x4317('0x4c')],null))[_0x4317('0x23')](respondWithResult(_0x2f1b2b,null))[_0x4317('0x42')](handleError(_0x2f1b2b,null));};exports['destroy']=function(_0x37d421,_0x80cf75){return db[_0x4317('0x29')][_0x4317('0x45')]({'where':{'id':_0x37d421[_0x4317('0x44')]['id']}})['then'](handleEntityNotFound(_0x80cf75,null))[_0x4317('0x23')](removeEntity(_0x80cf75,null))[_0x4317('0x42')](handleError(_0x80cf75,null));};exports['create']=function(_0x4cabe5,_0x345b02,_0x7183ae){_0x4cabe5['body'][_0x4317('0x26')]=_0x4cabe5[_0x4317('0x4e')][_0x4317('0x4f')];_0x4cabe5[_0x4317('0x4c')][_0x4317('0x50')]=_0x4cabe5[_0x4317('0x4e')][_0x4317('0x51')];_0x4cabe5[_0x4317('0x4c')][_0x4317('0x2c')]=_0x4cabe5['file'][_0x4317('0x52')];return db[_0x4317('0x29')][_0x4317('0x4d')](_0x4cabe5[_0x4317('0x4c')])[_0x4317('0x23')](respondWithResult(_0x345b02,0xc9))[_0x4317('0x42')](handleError(_0x345b02,null));};exports['download']=function(_0x46113e,_0x22b46e,_0x5bed47){return db[_0x4317('0x29')][_0x4317('0x53')]({'where':{'id':_0x46113e['params']['id']},'raw':!![]})[_0x4317('0x23')](handleEntityNotFound(_0x22b46e,null))[_0x4317('0x23')](function(_0x52a3f0){if(_0x52a3f0){var _0x45f418=_0x52a3f0[_0x4317('0x54')]!==null;var _0x469ea0=path[_0x4317('0x55')](config[_0x4317('0x56')],_0x4317('0x57'));if(_0x45f418){_0x469ea0=path[_0x4317('0x55')](_0x469ea0,_0x4317('0x58'));}var _0x555a16=path[_0x4317('0x55')](_0x469ea0,_0x52a3f0[_0x4317('0x50')]);return _0x22b46e[_0x4317('0x59')](_0x555a16);}})[_0x4317('0x42')](handleError(_0x22b46e,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index d1aba7c..a29b5b7 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 _0x9d83=['attachments','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','define'];(function(_0x321b2f,_0x2a1ee1){var _0x18e486=function(_0x578758){while(--_0x578758){_0x321b2f['push'](_0x321b2f['shift']());}};_0x18e486(++_0x2a1ee1);}(_0x9d83,0x1d5));var _0x39d8=function(_0xd467d7,_0x2f13cd){_0xd467d7=_0xd467d7-0x0;var _0x23b23d=_0x9d83[_0xd467d7];return _0x23b23d;};'use strict';var _=require(_0x39d8('0x0'));var util=require(_0x39d8('0x1'));var logger=require('../../config/logger')(_0x39d8('0x2'));var moment=require(_0x39d8('0x3'));var BPromise=require(_0x39d8('0x4'));var rp=require(_0x39d8('0x5'));var fs=require('fs');var path=require(_0x39d8('0x6'));var rimraf=require(_0x39d8('0x7'));var config=require(_0x39d8('0x8'));var attributes=require(_0x39d8('0x9'));module[_0x39d8('0xa')]=function(_0x4e8750,_0x645c29){return _0x4e8750[_0x39d8('0xb')]('Attachment',attributes,{'tableName':_0x39d8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd390=['moment','bluebird','path','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','lodash','util'];(function(_0x6ea56b,_0x4b98e4){var _0x2ef411=function(_0x4271dd){while(--_0x4271dd){_0x6ea56b['push'](_0x6ea56b['shift']());}};_0x2ef411(++_0x4b98e4);}(_0xd390,0x76));var _0x0d39=function(_0x54f298,_0x5681d4){_0x54f298=_0x54f298-0x0;var _0x489e44=_0xd390[_0x54f298];return _0x489e44;};'use strict';var _=require(_0x0d39('0x0'));var util=require(_0x0d39('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0d39('0x2'));var BPromise=require(_0x0d39('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0d39('0x4'));var rimraf=require(_0x0d39('0x5'));var config=require(_0x0d39('0x6'));var attributes=require(_0x0d39('0x7'));module[_0x0d39('0x8')]=function(_0x4cc6e2,_0x176183){return _0x4cc6e2[_0x0d39('0x9')](_0x0d39('0xa'),attributes,{'tableName':_0x0d39('0xb'),'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 5a22369..50a296e 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 _0x9de3=['jayson/promise','http','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','create','options','CreateAttachment','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x4a1380,_0x3362cd){var _0x217ff1=function(_0x5e5abe){while(--_0x5e5abe){_0x4a1380['push'](_0x4a1380['shift']());}};_0x217ff1(++_0x3362cd);}(_0x9de3,0xea));var _0x39de=function(_0x496511,_0x449bc7){_0x496511=_0x496511-0x0;var _0x5c3fe8=_0x9de3[_0x496511];return _0x5c3fe8;};'use strict';var _=require(_0x39de('0x0'));var util=require('util');var moment=require(_0x39de('0x1'));var BPromise=require(_0x39de('0x2'));var rs=require(_0x39de('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x39de('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x39de('0x5'))(_0x39de('0x6'));var config=require(_0x39de('0x7'));var jayson=require(_0x39de('0x8'));var client=jayson['client'][_0x39de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x185872,_0x3ed6a1,_0x87049c){return new BPromise(function(_0x2604fa,_0x59ce28){return client['request'](_0x185872,_0x87049c)['then'](function(_0x27e596){logger[_0x39de('0xa')](_0x39de('0xb'),_0x3ed6a1,_0x39de('0xc'));logger[_0x39de('0xd')](_0x39de('0xe'),_0x3ed6a1,_0x39de('0xc'),JSON[_0x39de('0xf')](_0x27e596));if(_0x27e596['error']){if(_0x27e596[_0x39de('0x10')]['code']===0x1f4){logger['error'](_0x39de('0xb'),_0x3ed6a1,_0x27e596[_0x39de('0x10')][_0x39de('0x11')]);return _0x59ce28(_0x27e596['error'][_0x39de('0x11')]);}logger[_0x39de('0x10')](_0x39de('0xb'),_0x3ed6a1,_0x27e596[_0x39de('0x10')][_0x39de('0x11')]);return _0x2604fa(_0x27e596[_0x39de('0x10')][_0x39de('0x11')]);}else{logger[_0x39de('0xa')](_0x39de('0xb'),_0x3ed6a1,_0x39de('0xc'));_0x2604fa(_0x27e596['result'][_0x39de('0x11')]);}})[_0x39de('0x12')](function(_0x20bd18){logger[_0x39de('0x10')]('Attachment,\x20%s,\x20%s',_0x3ed6a1,_0x20bd18);_0x59ce28(_0x20bd18);});});}exports['CreateAttachment']=function(_0x2d355b){var _0x5e9e37=this;return new Promise(function(_0x1fb6fa,_0x1d08a2){return db['Attachment'][_0x39de('0x13')](_0x2d355b['body'],{'raw':_0x2d355b[_0x39de('0x14')]?_0x2d355b[_0x39de('0x14')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0xab6f89){logger['info']('CreateAttachment',_0x2d355b);logger[_0x39de('0xd')](_0x39de('0x15'),_0x2d355b,JSON[_0x39de('0xf')](_0xab6f89));_0x1fb6fa(_0xab6f89);})[_0x39de('0x12')](function(_0x400d62){logger[_0x39de('0x10')]('CreateAttachment',_0x400d62[_0x39de('0x11')],_0x2d355b);_0x1d08a2(_0x5e9e37[_0x39de('0x10')](0x1f4,_0x400d62[_0x39de('0x11')]));});});}; \ No newline at end of file +var _0x7794=['http','request','then','info','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','Attachment,\x20%s,\x20%s','message','result','catch','CreateAttachment','Attachment','create','options','raw','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0xa61fd1,_0x934c7b){var _0x82399b=function(_0x4c3878){while(--_0x4c3878){_0xa61fd1['push'](_0xa61fd1['shift']());}};_0x82399b(++_0x934c7b);}(_0x7794,0x7b));var _0x4779=function(_0x305093,_0x1826d0){_0x305093=_0x305093-0x0;var _0x8bc9cd=_0x7794[_0x305093];return _0x8bc9cd;};'use strict';var _=require('lodash');var util=require(_0x4779('0x0'));var moment=require(_0x4779('0x1'));var BPromise=require(_0x4779('0x2'));var rs=require(_0x4779('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4779('0x4'))['db'];var utils=require(_0x4779('0x5'));var logger=require('../../config/logger')(_0x4779('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x4779('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x339512,_0x523c93,_0xb3fe18){return new BPromise(function(_0x13bb66,_0x270a5f){return client[_0x4779('0x8')](_0x339512,_0xb3fe18)[_0x4779('0x9')](function(_0x7179e1){logger[_0x4779('0xa')]('Attachment,\x20%s,\x20%s',_0x523c93,_0x4779('0xb'));logger[_0x4779('0xc')](_0x4779('0xd'),_0x523c93,_0x4779('0xb'),JSON[_0x4779('0xe')](_0x7179e1));if(_0x7179e1[_0x4779('0xf')]){if(_0x7179e1[_0x4779('0xf')][_0x4779('0x10')]===0x1f4){logger[_0x4779('0xf')](_0x4779('0x11'),_0x523c93,_0x7179e1['error']['message']);return _0x270a5f(_0x7179e1['error'][_0x4779('0x12')]);}logger[_0x4779('0xf')](_0x4779('0x11'),_0x523c93,_0x7179e1[_0x4779('0xf')]['message']);return _0x13bb66(_0x7179e1[_0x4779('0xf')][_0x4779('0x12')]);}else{logger['info']('Attachment,\x20%s,\x20%s',_0x523c93,_0x4779('0xb'));_0x13bb66(_0x7179e1[_0x4779('0x13')][_0x4779('0x12')]);}})[_0x4779('0x14')](function(_0x56ec51){logger['error'](_0x4779('0x11'),_0x523c93,_0x56ec51);_0x270a5f(_0x56ec51);});});}exports[_0x4779('0x15')]=function(_0x19fbb6){var _0x582e89=this;return new Promise(function(_0x3dbe70,_0x5d9a58){return db[_0x4779('0x16')][_0x4779('0x17')](_0x19fbb6['body'],{'raw':_0x19fbb6[_0x4779('0x18')]?_0x19fbb6['options'][_0x4779('0x19')]===undefined?!![]:![]:!![]})[_0x4779('0x9')](function(_0x143ef6){logger[_0x4779('0xa')](_0x4779('0x15'),_0x19fbb6);logger[_0x4779('0xc')]('CreateAttachment',_0x19fbb6,JSON[_0x4779('0xe')](_0x143ef6));_0x3dbe70(_0x143ef6);})['catch'](function(_0x4ad246){logger[_0x4779('0xf')](_0x4779('0x15'),_0x4ad246[_0x4779('0x12')],_0x19fbb6);_0x5d9a58(_0x582e89[_0x4779('0xf')](0x1f4,_0x4ad246['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 3c83bee..efd6272 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1c1fba,_0xd5872d){_0x1c1fba=_0x1c1fba-0x0;var _0x37e346=_0x0b0e[_0x1c1fba];return _0x37e346;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['download']);router[_0xe0b0('0xe')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);var upload=multer({'storage':multer[_0xe0b0('0x11')]({'destination':function(_0x574d96,_0x399320,_0x2cdad2){_0x2cdad2(null,path[_0xe0b0('0x12')](config['root'],_0xe0b0('0x13')));},'filename':function(_0x1c358a,_0x3cc19a,_0x45f914){_0x45f914(null,util[_0xe0b0('0x14')]('%s-%s',Date[_0xe0b0('0x15')](),_0x3cc19a[_0xe0b0('0x16')][_0xe0b0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe0b0('0xe')]('/',upload[_0xe0b0('0x18')]('file'),controller[_0xe0b0('0x19')]);router['put'](_0xe0b0('0x1a'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x1b')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x5f66=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','/:id/clone','clone','diskStorage','root','format','%s-%s','now','originalname','replace','post','single','file','create','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5f66,0x1a0));var _0x65f6=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5f66[_0x17d9e3];return _0x14192d;};'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('./attachment.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['download']);router['post'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);var upload=multer({'storage':multer[_0x65f6('0xe')]({'destination':function(_0x50d26d,_0x41a7fd,_0x571436){_0x571436(null,path['join'](config[_0x65f6('0xf')],'server/files/attachments/'));},'filename':function(_0x419819,_0x4862a5,_0x2f964a){_0x2f964a(null,util[_0x65f6('0x10')](_0x65f6('0x11'),Date[_0x65f6('0x12')](),_0x4862a5[_0x65f6('0x13')][_0x65f6('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x65f6('0x15')]('/',upload[_0x65f6('0x16')](_0x65f6('0x17')),controller[_0x65f6('0x18')]);router['put'](_0x65f6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x65f6('0x19')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1a')]);module[_0x65f6('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 3b87422..0539f41 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 _0xe1e7=['adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','role','disabled','blocked','user','name','then','blockedAt','add','getLicense','status','send','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','use','User','passport','Strategy','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','url','domain','authenticate','error','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','blockDuration'];(function(_0xf08c83,_0x4fd61d){var _0x139e49=function(_0xa03366){while(--_0xa03366){_0xf08c83['push'](_0xf08c83['shift']());}};_0x139e49(++_0x4fd61d);}(_0xe1e7,0xe5));var _0x7e1e=function(_0x5c2888,_0x435a80){_0x5c2888=_0x5c2888-0x0;var _0xfbdf00=_0xe1e7[_0x5c2888];return _0xfbdf00;};'use strict';var passport=require(_0x7e1e('0x0'));var LocalStrategy=require('passport-local')[_0x7e1e('0x1')];var moment=require('moment');var ActiveDirectory=require(_0x7e1e('0x2'));var BPromise=require(_0x7e1e('0x3'));var util=require(_0x7e1e('0x4'));var db=require(_0x7e1e('0x5'))['db'];var authService=require(_0x7e1e('0x6'));var utils=require(_0x7e1e('0x7'));var config=require(_0x7e1e('0x8'));var logger=require(_0x7e1e('0x9'))(_0x7e1e('0xa'));function isActiveDirectoryConfigured(_0x1140fa){var _0xb94dc=![];if(typeof _0x1140fa[_0x7e1e('0xb')]!==_0x7e1e('0xc')){_0xb94dc=_0x1140fa[_0x7e1e('0xb')]['baseDN']&&_0x1140fa[_0x7e1e('0xb')][_0x7e1e('0xd')]&&_0x1140fa[_0x7e1e('0xb')][_0x7e1e('0xe')];}return _0xb94dc;}function adAuthenticate(_0x21b72e,_0x9b2260,_0x23f7e9){return new BPromise(function(_0x562cdb,_0x1dee70){try{var _0x20526a=new ActiveDirectory(_0x21b72e);_0x20526a[_0x7e1e('0xf')](_0x9b2260,_0x23f7e9,function(_0xb472cb,_0x5467f4){if(_0xb472cb){logger[_0x7e1e('0x10')]('Error\x20authenticate\x20%s:\x20%s',_0x9b2260,util[_0x7e1e('0x11')](_0xb472cb,{'showHidden':![],'depth':null}));_0x1dee70('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x5467f4){logger['error']('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x9b2260);_0x1dee70(_0x7e1e('0x12'));}else{_0x562cdb(_0x5467f4);}});}catch(_0xed2d76){_0x1dee70(_0xed2d76);}});}function ActiveDirectoryAuthenticate(_0x1b9e5f,_0x54a5a1,_0x584059,_0x50ffb7){var _0x4a92db,_0x5b07a0;if(!isActiveDirectoryConfigured(config)){logger['error'](_0x7e1e('0x13'),_0x54a5a1);return _0x50ffb7(null,![],{'message':_0x7e1e('0x12')});}return db[_0x7e1e('0x14')][_0x7e1e('0x15')]({'where':{'id':0x1},'attributes':['adSsoEnabled',_0x7e1e('0x16')],'raw':!![]})['then'](function(_0x5eee11){_0x4a92db=_0x5eee11;if(!_0x4a92db[_0x7e1e('0x17')]){logger['error'](_0x7e1e('0x18'),_0x54a5a1);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x1b9e5f[_0x7e1e('0x15')]({'attributes':['id','name','password','salt',_0x7e1e('0x19'),_0x7e1e('0x1a'),_0x7e1e('0x1b'),'blockedAt','online'],'where':{'name':_0x54a5a1,'role':{'$or':['admin',_0x7e1e('0x1c'),'agent']},'adSsoEnabled':!![]}});})['then'](function(_0x4ebc10){if(!_0x4ebc10||_0x4ebc10&&_0x4ebc10[_0x7e1e('0x1d')]!==_0x54a5a1){throw new Error(_0x7e1e('0x12'));}_0x5b07a0=_0x4ebc10;var _0x5a684e=_0x5b07a0[_0x7e1e('0x1d')]+'@'+config[_0x7e1e('0xb')]['domain'];return adAuthenticate(config['activedirectory'],_0x5a684e,_0x584059);})[_0x7e1e('0x1e')](function(_0xb0574e){if(_0x5b07a0[_0x7e1e('0x1a')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x4a92db[_0x7e1e('0x16')]>0x0){if(_0x5b07a0[_0x7e1e('0x1b')]){if(moment(_0x5b07a0[_0x7e1e('0x1f')])[_0x7e1e('0x20')](_0x4a92db[_0x7e1e('0x16')],'minutes')>moment()){throw new Error(_0x7e1e('0x12'));}return utils['clearBlockUser'](_0x5b07a0,0x0,![],null)['then'](function(){return utils[_0x7e1e('0x21')](_0x5b07a0);})[_0x7e1e('0x1e')](function(){return _0x50ffb7(null,_0x5b07a0);});}else{return utils[_0x7e1e('0x21')](_0x5b07a0)['then'](function(){return _0x50ffb7(null,_0x5b07a0);});}}else{return utils[_0x7e1e('0x21')](_0x5b07a0)[_0x7e1e('0x1e')](function(){return _0x50ffb7(null,_0x5b07a0);});}})['catch'](function(_0x184160){return _0x50ffb7(null,![],_0x184160);});}function handleError(_0x4ba40d,_0x5a5e07,_0x39c147){return _0x4ba40d[_0x7e1e('0x22')](_0x5a5e07||0x1f4)[_0x7e1e('0x23')]({'message':_0x39c147?_0x39c147['message']||_0x39c147:''});}exports[_0x7e1e('0x24')]=function(_0x168d63,_0x3a4287,_0x43977b){passport[_0x7e1e('0xf')](_0x7e1e('0x25'),function(_0x2c100e,_0x311b7e,_0x3442e9){var _0x3cbcbd=_0x2c100e||_0x3442e9;if(_0x3cbcbd){return handleError(_0x3a4287,0x191,_0x3cbcbd);}if(!_0x311b7e){return handleError(_0x3a4287,0x194,{'message':_0x7e1e('0x26')});}else{var _0xb8c240={'payload':{'id':_0x311b7e['id'],'role':_0x311b7e[_0x7e1e('0x19')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0xb8c240)[_0x7e1e('0x1e')](function(_0x507ecc){_0x3a4287[_0x7e1e('0x27')]({'id':_0x311b7e['id'],'token':_0x507ecc,'statusCall':'','isAlreadyLogged':_0x311b7e['online']});});}})(_0x168d63,_0x3a4287,_0x43977b);};passport[_0x7e1e('0x28')]('ad-login',new LocalStrategy({'usernameField':_0x7e1e('0x1d'),'passwordField':'password'},function(_0x106a47,_0x3158d8,_0x56f44b){return ActiveDirectoryAuthenticate(db[_0x7e1e('0x29')],_0x106a47,_0x3158d8,_0x56f44b);})); \ No newline at end of file +var _0x9eb7=['name','password','salt','role','disabled','blocked','blockedAt','online','admin','agent','add','clearBlockUser','getLicense','catch','status','send','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','use','ad-login','Strategy','moment','activedirectory2','bluebird','../../mysqldb','../../config/environment','api','activedirectory','baseDN','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','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'];(function(_0x10488b,_0x3f8915){var _0x15a90a=function(_0x5f380e){while(--_0x5f380e){_0x10488b['push'](_0x10488b['shift']());}};_0x15a90a(++_0x3f8915);}(_0x9eb7,0x117));var _0x79eb=function(_0x3316a0,_0x12f083){_0x3316a0=_0x3316a0-0x0;var _0x30e148=_0x9eb7[_0x3316a0];return _0x30e148;};'use strict';var passport=require('passport');var LocalStrategy=require('passport-local')[_0x79eb('0x0')];var moment=require(_0x79eb('0x1'));var ActiveDirectory=require(_0x79eb('0x2'));var BPromise=require(_0x79eb('0x3'));var util=require('util');var db=require(_0x79eb('0x4'))['db'];var authService=require('../../components/auth/service');var utils=require('../../config/utils');var config=require(_0x79eb('0x5'));var logger=require('../../config/logger')(_0x79eb('0x6'));function isActiveDirectoryConfigured(_0x492ad5){var _0x333b61=![];if(typeof _0x492ad5[_0x79eb('0x7')]!=='undefined'){_0x333b61=_0x492ad5[_0x79eb('0x7')][_0x79eb('0x8')]&&_0x492ad5[_0x79eb('0x7')][_0x79eb('0x9')]&&_0x492ad5[_0x79eb('0x7')][_0x79eb('0xa')];}return _0x333b61;}function adAuthenticate(_0x3d2c85,_0x20327f,_0x4c4bd1){return new BPromise(function(_0x39a4b0,_0x471aad){try{var _0x356675=new ActiveDirectory(_0x3d2c85);_0x356675[_0x79eb('0xb')](_0x20327f,_0x4c4bd1,function(_0x2a413b,_0x5cac28){if(_0x2a413b){logger[_0x79eb('0xc')](_0x79eb('0xd'),_0x20327f,util[_0x79eb('0xe')](_0x2a413b,{'showHidden':![],'depth':null}));_0x471aad(_0x79eb('0xf'));}else if(!_0x5cac28){logger['error']('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x20327f);_0x471aad(_0x79eb('0xf'));}else{_0x39a4b0(_0x5cac28);}});}catch(_0x173c35){_0x471aad(_0x173c35);}});}function ActiveDirectoryAuthenticate(_0x174134,_0x749dfc,_0x4a567a,_0x298829){var _0x30e8ee,_0x14c767;if(!isActiveDirectoryConfigured(config)){logger[_0x79eb('0xc')](_0x79eb('0x10'),_0x749dfc);return _0x298829(null,![],{'message':_0x79eb('0xf')});}return db[_0x79eb('0x11')]['findOne']({'where':{'id':0x1},'attributes':['adSsoEnabled',_0x79eb('0x12')],'raw':!![]})[_0x79eb('0x13')](function(_0x56b7cb){_0x30e8ee=_0x56b7cb;if(!_0x30e8ee[_0x79eb('0x14')]){logger['error'](_0x79eb('0x15'),_0x749dfc);throw new Error(_0x79eb('0xf'));}return _0x174134['findOne']({'attributes':['id',_0x79eb('0x16'),_0x79eb('0x17'),_0x79eb('0x18'),_0x79eb('0x19'),_0x79eb('0x1a'),_0x79eb('0x1b'),_0x79eb('0x1c'),_0x79eb('0x1d')],'where':{'name':_0x749dfc,'role':{'$or':[_0x79eb('0x1e'),'user',_0x79eb('0x1f')]},'adSsoEnabled':!![]}});})[_0x79eb('0x13')](function(_0x29d075){if(!_0x29d075||_0x29d075&&_0x29d075[_0x79eb('0x16')]!==_0x749dfc){throw new Error(_0x79eb('0xf'));}_0x14c767=_0x29d075;var _0x250490=_0x14c767[_0x79eb('0x16')]+'@'+config[_0x79eb('0x7')][_0x79eb('0xa')];return adAuthenticate(config[_0x79eb('0x7')],_0x250490,_0x4a567a);})['then'](function(_0x563f57){if(_0x14c767[_0x79eb('0x1a')]){throw new Error(_0x79eb('0xf'));}if(_0x30e8ee[_0x79eb('0x12')]>0x0){if(_0x14c767[_0x79eb('0x1b')]){if(moment(_0x14c767[_0x79eb('0x1c')])[_0x79eb('0x20')](_0x30e8ee[_0x79eb('0x12')],'minutes')>moment()){throw new Error(_0x79eb('0xf'));}return utils[_0x79eb('0x21')](_0x14c767,0x0,![],null)['then'](function(){return utils[_0x79eb('0x22')](_0x14c767);})['then'](function(){return _0x298829(null,_0x14c767);});}else{return utils[_0x79eb('0x22')](_0x14c767)[_0x79eb('0x13')](function(){return _0x298829(null,_0x14c767);});}}else{return utils[_0x79eb('0x22')](_0x14c767)['then'](function(){return _0x298829(null,_0x14c767);});}})[_0x79eb('0x23')](function(_0x4cdc6d){return _0x298829(null,![],_0x4cdc6d);});}function handleError(_0x1afc3a,_0xbad17d,_0x42326e){return _0x1afc3a[_0x79eb('0x24')](_0xbad17d||0x1f4)[_0x79eb('0x25')]({'message':_0x42326e?_0x42326e['message']||_0x42326e:''});}exports[_0x79eb('0x26')]=function(_0x132c63,_0x13c1c0,_0x27d022){passport[_0x79eb('0xb')]('ad-login',function(_0x11c99f,_0x22e85f,_0x33f98f){var _0x2fa2f5=_0x11c99f||_0x33f98f;if(_0x2fa2f5){return handleError(_0x13c1c0,0x191,_0x2fa2f5);}if(!_0x22e85f){return handleError(_0x13c1c0,0x194,{'message':_0x79eb('0x27')});}else{var _0x3701a5={'payload':{'id':_0x22e85f['id'],'role':_0x22e85f['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x3701a5)[_0x79eb('0x13')](function(_0x6c34e5){_0x13c1c0[_0x79eb('0x28')]({'id':_0x22e85f['id'],'token':_0x6c34e5,'statusCall':'','isAlreadyLogged':_0x22e85f[_0x79eb('0x1d')]});});}})(_0x132c63,_0x13c1c0,_0x27d022);};passport[_0x79eb('0x29')](_0x79eb('0x2a'),new LocalStrategy({'usernameField':'name','passwordField':_0x79eb('0x17')},function(_0x571adb,_0x5d15bf,_0x103f27){return ActiveDirectoryAuthenticate(db['User'],_0x571adb,_0x5d15bf,_0x103f27);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 82f21f8..1bd11ce 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 _0xc76d=['express','Router','post','login','exports'];(function(_0x4ea590,_0x4dcd74){var _0x1151e7=function(_0x5bc2eb){while(--_0x5bc2eb){_0x4ea590['push'](_0x4ea590['shift']());}};_0x1151e7(++_0x4dcd74);}(_0xc76d,0xd7));var _0xdc76=function(_0x16de68,_0x33d7ff){_0x16de68=_0x16de68-0x0;var _0x1c277e=_0xc76d[_0x16de68];return _0x1c277e;};'use strict';var express=require(_0xdc76('0x0'));var router=express[_0xdc76('0x1')]();var controller=require('./authActiveDirectory.controller');router[_0xdc76('0x2')]('/',controller[_0xdc76('0x3')]);module[_0xdc76('0x4')]=router; \ No newline at end of file +var _0xbe7a=['Router','./authActiveDirectory.controller','post','login','exports','express'];(function(_0x104a84,_0x285970){var _0x4973ff=function(_0x5064e7){while(--_0x5064e7){_0x104a84['push'](_0x104a84['shift']());}};_0x4973ff(++_0x285970);}(_0xbe7a,0x11f));var _0xabe7=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0xbe7a[_0x8a969d];return _0x1d8dc7;};'use strict';var express=require(_0xabe7('0x0'));var router=express[_0xabe7('0x1')]();var controller=require(_0xabe7('0x2'));router[_0xabe7('0x3')]('/',controller[_0xabe7('0x4')]);module[_0xabe7('0x5')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 5f7c665..890b6b6 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(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0x7a54,0x106));var _0x47a5=function(_0x35c504,_0x574374){_0x35c504=_0x35c504-0x0;var _0x2ffd85=_0x7a54[_0x35c504];return _0x2ffd85;};'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 _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(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0x7a54,0x106));var _0x47a5=function(_0x5b1b95,_0x434da4){_0x5b1b95=_0x5b1b95-0x0;var _0x2347bf=_0x7a54[_0x5b1b95];return _0x2347bf;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 1e37d50..d286079 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 _0x1288=['isMiddleware','setTokenCookie','express','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback','callback'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x1288,0x14c));var _0x8128=function(_0x28d54c,_0x53d9ba){_0x28d54c=_0x28d54c-0x0;var _0x32ab5c=_0x1288[_0x28d54c];return _0x32ab5c;};'use strict';var express=require(_0x8128('0x0'));var passport=require('passport');var router=express[_0x8128('0x1')]();var controller=require(_0x8128('0x2'));var userController=require(_0x8128('0x3'));var authService=require(_0x8128('0x4'));router[_0x8128('0x5')]('/',controller[_0x8128('0x6')]);router[_0x8128('0x5')](_0x8128('0x7'),controller[_0x8128('0x8')],authService[_0x8128('0x9')],userController[_0x8128('0x6')],authService[_0x8128('0xa')]);module['exports']=router; \ No newline at end of file +var _0xa04c=['isMiddleware','./authGoogle.controller','../user/user.controller.js','get','login','/callback','callback'];(function(_0x176977,_0x597043){var _0x35f50d=function(_0x3db271){while(--_0x3db271){_0x176977['push'](_0x176977['shift']());}};_0x35f50d(++_0x597043);}(_0xa04c,0x151));var _0xca04=function(_0x520621,_0x26e013){_0x520621=_0x520621-0x0;var _0x3d9e0c=_0xa04c[_0x520621];return _0x3d9e0c;};'use strict';var express=require('express');var passport=require('passport');var router=express['Router']();var controller=require(_0xca04('0x0'));var userController=require(_0xca04('0x1'));var authService=require('../../components/auth/service');router[_0xca04('0x2')]('/',controller[_0xca04('0x3')]);router[_0xca04('0x2')](_0xca04('0x4'),controller[_0xca04('0x5')],authService[_0xca04('0x6')],userController[_0xca04('0x3')],authService['setTokenCookie']);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index b537510..484e7d0 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 _0xd053=['body','trim','User','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','add','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','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.','securePassword','enforcePasswordHistory','previousPasswords','validatePasswordHistory','passwordHistoryLimit','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','lodash','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','allowedLoginAttempts','then','findOne','name','password','salt','role','disabled','blocked','loginAttempts','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blockDuration','blockedAt','minutes','clearBlockUser','getLicense','catch','MailAccount','email','MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','format','\x22%s\x22\x20<%s>','Smtp','request','SendMail','error','message','stringify','status','send','login','local-login','signToken','online','forgot','Email\x20parameter\x20is\x20missing','generate'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0xd053,0x1c7));var _0x3d05=function(_0x3d27ba,_0x2671a3){_0x3d27ba=_0x3d27ba-0x0;var _0xf01885=_0xd053[_0x3d27ba];return _0xf01885;};'use strict';var util=require(_0x3d05('0x0'));var passport=require(_0x3d05('0x1'));var LocalStrategy=require(_0x3d05('0x2'))[_0x3d05('0x3')];var jayson=require(_0x3d05('0x4'));var _=require(_0x3d05('0x5'));var rs=require('randomstring');var moment=require('moment');var db=require(_0x3d05('0x6'))['db'];var authService=require(_0x3d05('0x7'));var utils=require(_0x3d05('0x8'));var client=jayson[_0x3d05('0x9')][_0x3d05('0xa')]({'port':0x232b});function localAuthenticate(_0x165846,_0x35623c,_0x11bb10,_0x3d068c){var _0xd09f9d,_0x1701fd;return db[_0x3d05('0xb')]['findOne']({'where':{'id':0x1},'attributes':[_0x3d05('0xc'),'blockDuration'],'raw':!![]})[_0x3d05('0xd')](function(_0x456157){_0xd09f9d=_0x456157;return _0x165846[_0x3d05('0xe')]({'attributes':['id',_0x3d05('0xf'),_0x3d05('0x10'),_0x3d05('0x11'),_0x3d05('0x12'),_0x3d05('0x13'),_0x3d05('0x14'),'blockedAt',_0x3d05('0x15')],'where':{'name':_0x35623c,'role':{'$or':['admin',_0x3d05('0x16'),_0x3d05('0x17')]}}});})['then'](function(_0x8c3f36){if(!_0x8c3f36||_0x8c3f36&&_0x8c3f36['name']!==_0x35623c){throw new Error(_0x3d05('0x18'));}else{_0x1701fd=_0x8c3f36;return _0x1701fd;}})[_0x3d05('0xd')](function(){_0x1701fd[_0x3d05('0x19')](_0x11bb10,function(_0x36fde5,_0x29c463){var _0x1f1bf3=_0x1701fd[_0x3d05('0x15')]+0x1;if(_0x36fde5){return _0x3d068c(_0x36fde5);}else if(!_0x29c463){if(_0x1701fd['disabled']){return _0x3d068c(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0xd09f9d['allowedLoginAttempts']>0x0){if(_0x1701fd['blocked']){if(_0xd09f9d[_0x3d05('0x1a')]>0x0){if(moment(_0x1701fd[_0x3d05('0x1b')])['add'](_0xd09f9d[_0x3d05('0x1a')],_0x3d05('0x1c'))>moment()){return _0x3d068c(null,![],{'message':_0x3d05('0x18')});}else{return utils[_0x3d05('0x1d')](_0x1701fd,_0x1f1bf3,![],null)[_0x3d05('0xd')](function(){return _0x3d068c(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x3d068c(null,![],{'message':_0x3d05('0x18')});}}else{if(_0x1f1bf3>=_0xd09f9d[_0x3d05('0xc')]){return utils[_0x3d05('0x1d')](_0x1701fd,0x0,!![],moment())[_0x3d05('0xd')](function(){return _0x3d068c(null,![],{'message':_0x3d05('0x18')});});}else{return utils[_0x3d05('0x1d')](_0x1701fd,_0x1f1bf3,![],null)['then'](function(){return _0x3d068c(null,![],{'message':_0x3d05('0x18')});});}}}else{return _0x3d068c(null,![],{'message':_0x3d05('0x18')});}}else{if(_0x1701fd[_0x3d05('0x13')]){return _0x3d068c(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0xd09f9d['allowedLoginAttempts']>0x0){if(_0x1701fd[_0x3d05('0x14')]){if(_0xd09f9d[_0x3d05('0x1a')]>0x0){if(moment(_0x1701fd[_0x3d05('0x1b')])['add'](_0xd09f9d['blockDuration'],_0x3d05('0x1c'))>moment()){return _0x3d068c(null,![],{'message':_0x3d05('0x18')});}else{return utils[_0x3d05('0x1d')](_0x1701fd,0x0,![],null)[_0x3d05('0xd')](function(){return utils[_0x3d05('0x1e')](_0x1701fd);})[_0x3d05('0xd')](function(){return _0x3d068c(null,_0x1701fd);});}}else{return _0x3d068c(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x3d05('0x1d')](_0x1701fd,0x0,![],null)[_0x3d05('0xd')](function(){return utils[_0x3d05('0x1e')](_0x1701fd);})[_0x3d05('0xd')](function(){return _0x3d068c(null,_0x1701fd);})[_0x3d05('0x1f')](function(_0x2be856){return _0x3d068c(null,![],_0x2be856);});}}else{if(_0x1701fd[_0x3d05('0x14')]){return _0x3d068c(null,![],{'message':_0x3d05('0x18')});}else{return utils['getLicense'](_0x1701fd)['then'](function(){return _0x3d068c(null,_0x1701fd);});}}}});})['catch'](function(_0xb420a6){return _0x3d068c(null,![],_0xb420a6);});}function sendServiceMail(_0x579faf){return db[_0x3d05('0x20')]['find']({'where':{'service':!![]},'attributes':['id',_0x3d05('0xf'),_0x3d05('0x21')],'include':[{'model':db[_0x3d05('0x22')],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':_0x3d05('0x23')}]}]})[_0x3d05('0xd')](function(_0x5418ed){if(!_0x5418ed){throw new Error(_0x3d05('0x24'));}var _0x496e62=_0x5418ed['getSmtpOptions']();var _0x28715c={'account':_0x496e62,'message':_[_0x3d05('0x25')]({'from':util[_0x3d05('0x26')](_0x3d05('0x27'),_0x5418ed[_0x3d05('0xf')],_0x5418ed['email']||_0x5418ed[_0x3d05('0x28')][_0x3d05('0x16')])},_0x579faf)};return client[_0x3d05('0x29')](_0x3d05('0x2a'),_0x28715c);})[_0x3d05('0xd')](function(_0x1f78ca){if(_0x1f78ca[_0x3d05('0x2b')]){throw new Error(util[_0x3d05('0x26')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x1f78ca[_0x3d05('0x2b')][_0x3d05('0x2c')]||JSON[_0x3d05('0x2d')](_0x1f78ca['error'])));}return!![];});}function handleError(_0x4cc02d,_0xd3d645,_0x5ba33b){return _0x4cc02d[_0x3d05('0x2e')](_0xd3d645||0x1f4)[_0x3d05('0x2f')]({'message':_0x5ba33b?_0x5ba33b[_0x3d05('0x2c')]||_0x5ba33b:''});}exports[_0x3d05('0x30')]=function(_0x37de9e,_0xdd8f4,_0x26a639){passport['authenticate'](_0x3d05('0x31'),function(_0x1c837c,_0x516100,_0x4e2b78){var _0x547a66=_0x1c837c||_0x4e2b78;if(_0x547a66){return handleError(_0xdd8f4,0x191,_0x547a66);}if(!_0x516100){return handleError(_0xdd8f4,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x409abe={'payload':{'id':_0x516100['id'],'role':_0x516100[_0x3d05('0x12')]},'options':{'expiresIn':0x15180}};return authService[_0x3d05('0x32')](_0x409abe)[_0x3d05('0xd')](function(_0x4cb6e8){_0xdd8f4['json']({'id':_0x516100['id'],'token':_0x4cb6e8,'statusCall':'','isAlreadyLogged':_0x516100[_0x3d05('0x33')]});});}})(_0x37de9e,_0xdd8f4,_0x26a639);};exports[_0x3d05('0x34')]=function(_0x4db180,_0x44c1e5){if(!_0x4db180['body'][_0x3d05('0x21')]){return handleError(_0x44c1e5,0x1f4,{'message':_0x3d05('0x35')});}var _0x4b7fc7=rs[_0x3d05('0x36')]();_0x4db180[_0x3d05('0x37')]['email']=_0x4db180[_0x3d05('0x37')][_0x3d05('0x21')][_0x3d05('0x38')]()['toLowerCase']();var _0x1e6d8e;return db[_0x3d05('0xb')][_0x3d05('0xe')]({'where':{'id':0x1},'attributes':[_0x3d05('0xc'),_0x3d05('0x1a')],'raw':!![]})[_0x3d05('0xd')](function(_0x44206f){_0x1e6d8e=_0x44206f;return db[_0x3d05('0x39')][_0x3d05('0x3a')]({'where':{'email':_0x4db180[_0x3d05('0x37')][_0x3d05('0x21')]}});})[_0x3d05('0xd')](function(_0xcf5308){if(!_0xcf5308){throw new Error(_0x3d05('0x3b'));}if(_0xcf5308[_0x3d05('0x13')]){throw new Error(_0x3d05('0x3c'));}if(_0xcf5308[_0x3d05('0x14')]){if(moment(_0xcf5308[_0x3d05('0x1b')])[_0x3d05('0x3d')](_0x1e6d8e[_0x3d05('0x1a')],_0x3d05('0x1c'))>moment()){throw new Error(_0x3d05('0x3e'));}else{_0xcf5308[_0x3d05('0x14')]=![];_0xcf5308[_0x3d05('0x1b')]=null;}}_0xcf5308[_0x3d05('0x3f')]=_0x4b7fc7;_0xcf5308[_0x3d05('0x40')]=Date[_0x3d05('0x41')]()+0x36ee80;return _0xcf5308[_0x3d05('0x42')]();})['then'](function(){return sendServiceMail({'to':_0x4db180[_0x3d05('0x37')][_0x3d05('0x21')],'subject':_0x3d05('0x43'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x3d05('0x44')+_0x3d05('0x45')+_0x4db180[_0x3d05('0x46')][_0x3d05('0x47')]+_0x3d05('0x48')+_0x4b7fc7+'\x0a\x0a'+_0x3d05('0x49')});})[_0x3d05('0xd')](function(){_0x44c1e5[_0x3d05('0x2e')](0xc8)[_0x3d05('0x2f')]({'message':'Reset\x20Email\x20sent!'});})['catch'](function(_0x58288e){return handleError(_0x44c1e5,0x1f4,_0x58288e);});};exports[_0x3d05('0x4a')]=function(_0x127916,_0x595d9f){return db[_0x3d05('0x39')][_0x3d05('0x3a')]({'where':{'resetPasswordToken':_0x127916[_0x3d05('0x4b')][_0x3d05('0x4c')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x3d05('0xd')](function(_0x22de9a){if(!_0x22de9a){throw new Error(_0x3d05('0x4d'));}return db[_0x3d05('0xb')]['findOne']({'attributes':['id',_0x3d05('0x4e'),_0x3d05('0x4f'),'passwordHistoryLimit']})[_0x3d05('0xd')](function(_0xbf20bb){if(_0xbf20bb[_0x3d05('0x4e')])authService['validatePasswordPattern'](_0x127916[_0x3d05('0x37')][_0x3d05('0x10')]);if(!_0xbf20bb[_0x3d05('0x4f')]||!_0x22de9a[_0x3d05('0x50')])return _0x22de9a;authService[_0x3d05('0x51')](_0x127916[_0x3d05('0x37')][_0x3d05('0x10')],_0x22de9a[_0x3d05('0x50')],_0xbf20bb[_0x3d05('0x52')]);return _0x22de9a;})['then'](function(){_0x22de9a[_0x3d05('0x10')]=_0x127916['body'][_0x3d05('0x10')];_0x22de9a[_0x3d05('0x3f')]=null;_0x22de9a[_0x3d05('0x40')]=null;return _0x22de9a[_0x3d05('0x42')]();});})['then'](function(){_0x595d9f[_0x3d05('0x2e')](0xc8)['send']({'message':_0x3d05('0x53')});})[_0x3d05('0x1f')](function(_0x52433c){return handleError(_0x595d9f,0x1f4,_0x52433c);});};passport[_0x3d05('0x54')](_0x3d05('0x31'),new LocalStrategy({'usernameField':_0x3d05('0xf'),'passwordField':_0x3d05('0x10')},function(_0x173a58,_0x67b70e,_0xf195c9){return localAuthenticate(db[_0x3d05('0x39')],_0x173a58,_0x67b70e,_0xf195c9);})); \ No newline at end of file +var _0xf67e=['now','save','xCally\x20Motion\x20Password\x20Reset','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','previousPasswords','validatePasswordHistory','passwordHistoryLimit','resetPasswordExpires','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','name','password','blocked','loginAttempts','admin','user','agent','then','authenticate','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockedAt','add','minutes','clearBlockUser','getLicense','catch','MailAccount','email','MailServerOut','Smtp','CloudProvider','getSmtpOptions','merge','\x22%s\x22\x20<%s>','request','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','online','forgot','body','generate','trim','toLowerCase','User','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf67e,0x171));var _0xef67=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xf67e[_0x1e4360];return _0x31e6b4;};'use strict';var util=require(_0xef67('0x0'));var passport=require(_0xef67('0x1'));var LocalStrategy=require(_0xef67('0x2'))[_0xef67('0x3')];var jayson=require(_0xef67('0x4'));var _=require('lodash');var rs=require(_0xef67('0x5'));var moment=require(_0xef67('0x6'));var db=require(_0xef67('0x7'))['db'];var authService=require(_0xef67('0x8'));var utils=require(_0xef67('0x9'));var client=jayson[_0xef67('0xa')][_0xef67('0xb')]({'port':0x232b});function localAuthenticate(_0x281532,_0x4b3adb,_0x1aed7c,_0x687c6e){var _0x3f849f,_0x212d4c;return db[_0xef67('0xc')][_0xef67('0xd')]({'where':{'id':0x1},'attributes':[_0xef67('0xe'),_0xef67('0xf')],'raw':!![]})['then'](function(_0xc88006){_0x3f849f=_0xc88006;return _0x281532['findOne']({'attributes':['id',_0xef67('0x10'),_0xef67('0x11'),'salt','role','disabled',_0xef67('0x12'),'blockedAt',_0xef67('0x13')],'where':{'name':_0x4b3adb,'role':{'$or':[_0xef67('0x14'),_0xef67('0x15'),_0xef67('0x16')]}}});})[_0xef67('0x17')](function(_0x5c6b7f){if(!_0x5c6b7f||_0x5c6b7f&&_0x5c6b7f[_0xef67('0x10')]!==_0x4b3adb){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x212d4c=_0x5c6b7f;return _0x212d4c;}})['then'](function(){_0x212d4c[_0xef67('0x18')](_0x1aed7c,function(_0x1556c6,_0x1df774){var _0xd4954a=_0x212d4c[_0xef67('0x13')]+0x1;if(_0x1556c6){return _0x687c6e(_0x1556c6);}else if(!_0x1df774){if(_0x212d4c[_0xef67('0x19')]){return _0x687c6e(null,![],{'message':_0xef67('0x1a')});}else if(_0x3f849f[_0xef67('0xe')]>0x0){if(_0x212d4c[_0xef67('0x12')]){if(_0x3f849f[_0xef67('0xf')]>0x0){if(moment(_0x212d4c[_0xef67('0x1b')])[_0xef67('0x1c')](_0x3f849f['blockDuration'],_0xef67('0x1d'))>moment()){return _0x687c6e(null,![],{'message':_0xef67('0x1a')});}else{return utils[_0xef67('0x1e')](_0x212d4c,_0xd4954a,![],null)[_0xef67('0x17')](function(){return _0x687c6e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x687c6e(null,![],{'message':_0xef67('0x1a')});}}else{if(_0xd4954a>=_0x3f849f[_0xef67('0xe')]){return utils[_0xef67('0x1e')](_0x212d4c,0x0,!![],moment())[_0xef67('0x17')](function(){return _0x687c6e(null,![],{'message':_0xef67('0x1a')});});}else{return utils['clearBlockUser'](_0x212d4c,_0xd4954a,![],null)[_0xef67('0x17')](function(){return _0x687c6e(null,![],{'message':_0xef67('0x1a')});});}}}else{return _0x687c6e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x212d4c[_0xef67('0x19')]){return _0x687c6e(null,![],{'message':_0xef67('0x1a')});}else if(_0x3f849f[_0xef67('0xe')]>0x0){if(_0x212d4c[_0xef67('0x12')]){if(_0x3f849f['blockDuration']>0x0){if(moment(_0x212d4c[_0xef67('0x1b')])[_0xef67('0x1c')](_0x3f849f['blockDuration'],_0xef67('0x1d'))>moment()){return _0x687c6e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x212d4c,0x0,![],null)[_0xef67('0x17')](function(){return utils[_0xef67('0x1f')](_0x212d4c);})['then'](function(){return _0x687c6e(null,_0x212d4c);});}}else{return _0x687c6e(null,![],{'message':_0xef67('0x1a')});}}else{return utils['clearBlockUser'](_0x212d4c,0x0,![],null)[_0xef67('0x17')](function(){return utils[_0xef67('0x1f')](_0x212d4c);})[_0xef67('0x17')](function(){return _0x687c6e(null,_0x212d4c);})[_0xef67('0x20')](function(_0x34a333){return _0x687c6e(null,![],_0x34a333);});}}else{if(_0x212d4c['blocked']){return _0x687c6e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xef67('0x1f')](_0x212d4c)['then'](function(){return _0x687c6e(null,_0x212d4c);});}}}});})[_0xef67('0x20')](function(_0x4e2557){return _0x687c6e(null,![],_0x4e2557);});}function sendServiceMail(_0xebf68c){return db[_0xef67('0x21')]['find']({'where':{'service':!![]},'attributes':['id',_0xef67('0x10'),_0xef67('0x22')],'include':[{'model':db[_0xef67('0x23')],'as':_0xef67('0x24'),'include':[{'model':db[_0xef67('0x25')],'as':_0xef67('0x25')}]}]})[_0xef67('0x17')](function(_0x1b0786){if(!_0x1b0786){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0xfee50b=_0x1b0786[_0xef67('0x26')]();var _0x57a091={'account':_0xfee50b,'message':_[_0xef67('0x27')]({'from':util['format'](_0xef67('0x28'),_0x1b0786['name'],_0x1b0786[_0xef67('0x22')]||_0x1b0786[_0xef67('0x24')][_0xef67('0x15')])},_0xebf68c)};return client[_0xef67('0x29')]('SendMail',_0x57a091);})[_0xef67('0x17')](function(_0x2ce879){if(_0x2ce879[_0xef67('0x2a')]){throw new Error(util[_0xef67('0x2b')](_0xef67('0x2c'),_0x2ce879['error'][_0xef67('0x2d')]||JSON[_0xef67('0x2e')](_0x2ce879[_0xef67('0x2a')])));}return!![];});}function handleError(_0x707d9,_0x45f4ca,_0x3103f6){return _0x707d9['status'](_0x45f4ca||0x1f4)[_0xef67('0x2f')]({'message':_0x3103f6?_0x3103f6['message']||_0x3103f6:''});}exports[_0xef67('0x30')]=function(_0x2d1b16,_0x44b700,_0x2faccc){passport['authenticate'](_0xef67('0x31'),function(_0x47c1b3,_0x37769c,_0x32ec64){var _0x2c6115=_0x47c1b3||_0x32ec64;if(_0x2c6115){return handleError(_0x44b700,0x191,_0x2c6115);}if(!_0x37769c){return handleError(_0x44b700,0x194,{'message':_0xef67('0x32')});}else{var _0x240166={'payload':{'id':_0x37769c['id'],'role':_0x37769c[_0xef67('0x33')]},'options':{'expiresIn':0x15180}};return authService[_0xef67('0x34')](_0x240166)['then'](function(_0x30cd87){_0x44b700[_0xef67('0x35')]({'id':_0x37769c['id'],'token':_0x30cd87,'statusCall':'','isAlreadyLogged':_0x37769c[_0xef67('0x36')]});});}})(_0x2d1b16,_0x44b700,_0x2faccc);};exports[_0xef67('0x37')]=function(_0x78b690,_0x4f671f){if(!_0x78b690[_0xef67('0x38')][_0xef67('0x22')]){return handleError(_0x4f671f,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x88f569=rs[_0xef67('0x39')]();_0x78b690[_0xef67('0x38')][_0xef67('0x22')]=_0x78b690[_0xef67('0x38')]['email'][_0xef67('0x3a')]()[_0xef67('0x3b')]();var _0x3aef62;return db['Setting'][_0xef67('0xd')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xef67('0xf')],'raw':!![]})[_0xef67('0x17')](function(_0x54696d){_0x3aef62=_0x54696d;return db[_0xef67('0x3c')][_0xef67('0x3d')]({'where':{'email':_0x78b690[_0xef67('0x38')]['email']}});})['then'](function(_0x50567f){if(!_0x50567f){throw new Error(_0xef67('0x3e'));}if(_0x50567f[_0xef67('0x19')]){throw new Error(_0xef67('0x3f'));}if(_0x50567f[_0xef67('0x12')]){if(moment(_0x50567f['blockedAt'])['add'](_0x3aef62['blockDuration'],_0xef67('0x1d'))>moment()){throw new Error(_0xef67('0x40'));}else{_0x50567f['blocked']=![];_0x50567f[_0xef67('0x1b')]=null;}}_0x50567f[_0xef67('0x41')]=_0x88f569;_0x50567f['resetPasswordExpires']=Date[_0xef67('0x42')]()+0x36ee80;return _0x50567f[_0xef67('0x43')]();})['then'](function(){return sendServiceMail({'to':_0x78b690[_0xef67('0x38')][_0xef67('0x22')],'subject':_0xef67('0x44'),'text':'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'+_0xef67('0x45')+_0x78b690[_0xef67('0x46')][_0xef67('0x47')]+_0xef67('0x48')+_0x88f569+'\x0a\x0a'+_0xef67('0x49')});})['then'](function(){_0x4f671f[_0xef67('0x4a')](0xc8)[_0xef67('0x2f')]({'message':'Reset\x20Email\x20sent!'});})[_0xef67('0x20')](function(_0x21fe4b){return handleError(_0x4f671f,0x1f4,_0x21fe4b);});};exports[_0xef67('0x4b')]=function(_0x2595fa,_0xeaea89){return db['User'][_0xef67('0x3d')]({'where':{'resetPasswordToken':_0x2595fa[_0xef67('0x4c')][_0xef67('0x4d')],'resetPasswordExpires':{'$gt':Date[_0xef67('0x42')]()}}})['then'](function(_0x13d12e){if(!_0x13d12e){throw new Error(_0xef67('0x4e'));}return db[_0xef67('0xc')]['findOne']({'attributes':['id',_0xef67('0x4f'),_0xef67('0x50'),'passwordHistoryLimit']})[_0xef67('0x17')](function(_0xd1efb2){if(_0xd1efb2[_0xef67('0x4f')])authService['validatePasswordPattern'](_0x2595fa['body'][_0xef67('0x11')]);if(!_0xd1efb2[_0xef67('0x50')]||!_0x13d12e[_0xef67('0x51')])return _0x13d12e;authService[_0xef67('0x52')](_0x2595fa[_0xef67('0x38')][_0xef67('0x11')],_0x13d12e[_0xef67('0x51')],_0xd1efb2[_0xef67('0x53')]);return _0x13d12e;})[_0xef67('0x17')](function(){_0x13d12e[_0xef67('0x11')]=_0x2595fa[_0xef67('0x38')][_0xef67('0x11')];_0x13d12e[_0xef67('0x41')]=null;_0x13d12e[_0xef67('0x54')]=null;return _0x13d12e[_0xef67('0x43')]();});})[_0xef67('0x17')](function(){_0xeaea89[_0xef67('0x4a')](0xc8)[_0xef67('0x2f')]({'message':_0xef67('0x55')});})['catch'](function(_0x14117c){return handleError(_0xeaea89,0x1f4,_0x14117c);});};passport[_0xef67('0x56')](_0xef67('0x31'),new LocalStrategy({'usernameField':_0xef67('0x10'),'passwordField':'password'},function(_0x1a70c2,_0xaa3d08,_0x29ea8e){return localAuthenticate(db[_0xef67('0x3c')],_0x1a70c2,_0xaa3d08,_0x29ea8e);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 67ebcff..cb1d654 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 _0xffa1=['/forgot','reset','exports','express','Router','post'];(function(_0x43b08,_0x15f967){var _0x5e05f4=function(_0x4bb0cb){while(--_0x4bb0cb){_0x43b08['push'](_0x43b08['shift']());}};_0x5e05f4(++_0x15f967);}(_0xffa1,0x87));var _0x1ffa=function(_0xa21809,_0x3ac2ef){_0xa21809=_0xa21809-0x0;var _0x870ae1=_0xffa1[_0xa21809];return _0x870ae1;};'use strict';var express=require(_0x1ffa('0x0'));var router=express[_0x1ffa('0x1')]();var controller=require('./authLocal.controller');router[_0x1ffa('0x2')]('/',controller['login']);router[_0x1ffa('0x2')](_0x1ffa('0x3'),controller['forgot']);router['post']('/reset/:token',controller[_0x1ffa('0x4')]);module[_0x1ffa('0x5')]=router; \ No newline at end of file +var _0x6b86=['/reset/:token','reset','Router','./authLocal.controller','post','login','/forgot','forgot'];(function(_0x5ef3e5,_0x1df146){var _0x293362=function(_0x5a69ff){while(--_0x5a69ff){_0x5ef3e5['push'](_0x5ef3e5['shift']());}};_0x293362(++_0x1df146);}(_0x6b86,0x152));var _0x66b8=function(_0x576a26,_0x43c6){_0x576a26=_0x576a26-0x0;var _0x231d3a=_0x6b86[_0x576a26];return _0x231d3a;};'use strict';var express=require('express');var router=express[_0x66b8('0x0')]();var controller=require(_0x66b8('0x1'));router[_0x66b8('0x2')]('/',controller[_0x66b8('0x3')]);router[_0x66b8('0x2')](_0x66b8('0x4'),controller[_0x66b8('0x5')]);router[_0x66b8('0x2')](_0x66b8('0x6'),controller[_0x66b8('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 01db78c..aee71e0 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 _0x51fa=['BOOLEAN','sequelize','STRING'];(function(_0x3ca916,_0xee3579){var _0x1ec219=function(_0x33365b){while(--_0x33365b){_0x3ca916['push'](_0x3ca916['shift']());}};_0x1ec219(++_0xee3579);}(_0x51fa,0x73));var _0xa51f=function(_0x4c8acb,_0x1d3959){_0x4c8acb=_0x4c8acb-0x0;var _0x24b7b2=_0x51fa[_0x4c8acb];return _0x24b7b2;};'use strict';var Sequelize=require(_0xa51f('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa51f('0x1')]},'status':{'type':Sequelize[_0xa51f('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0x62f5=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x62f5,0x131));var _0x562f=function(_0x15c9ec,_0x3a5153){_0x15c9ec=_0x15c9ec-0x0;var _0x6369ee=_0x62f5[_0x15c9ec];return _0x6369ee;};'use strict';var Sequelize=require(_0x562f('0x0'));module[_0x562f('0x1')]={'name':{'type':Sequelize[_0x562f('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x562f('0x2')]},'status':{'type':Sequelize[_0x562f('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x562f('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index c108c0f..9ffff87 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 _0xc461=['include','findAll','show','params','options','find','catch','create','body','destroy','Condition','addConditions','ids','omit','getConditions','findOne','filter','Action','addActions','getActions','order','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','jsforce','desk.js','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','Content-Range','apply','reject','save','update','then','error','stack','name','send','Automation','rawAttributes','fieldName','key','map','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','type','includeAll'];(function(_0xc5c9ac,_0x57c492){var _0x3f4606=function(_0x2aa448){while(--_0x2aa448){_0xc5c9ac['push'](_0xc5c9ac['shift']());}};_0x3f4606(++_0x57c492);}(_0xc461,0x68));var _0x1c46=function(_0x2b8332,_0x18b4b8){_0x2b8332=_0x2b8332-0x0;var _0x46a4da=_0xc461[_0x2b8332];return _0x46a4da;};'use strict';var emlformat=require(_0x1c46('0x0'));var rimraf=require(_0x1c46('0x1'));var zipdir=require(_0x1c46('0x2'));var jsonpatch=require(_0x1c46('0x3'));var rp=require(_0x1c46('0x4'));var moment=require(_0x1c46('0x5'));var BPromise=require(_0x1c46('0x6'));var Mustache=require('mustache');var util=require(_0x1c46('0x7'));var path=require(_0x1c46('0x8'));var sox=require(_0x1c46('0x9'));var csv=require('to-csv');var ejs=require(_0x1c46('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1c46('0xb'));var deskjs=require(_0x1c46('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1c46('0xd'));var Redis=require(_0x1c46('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x1c46('0xf'));var as=require(_0x1c46('0x10'));var hardwareService=require(_0x1c46('0x11'));var logger=require(_0x1c46('0x12'))(_0x1c46('0x13'));var utils=require('../../config/utils');var config=require(_0x1c46('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x1c46('0x15'))['db'];function respondWithStatusCode(_0x2ee0f9,_0x1654b1){_0x1654b1=_0x1654b1||0xcc;return function(_0x55b4a2){if(_0x55b4a2){return _0x2ee0f9[_0x1c46('0x16')](_0x1654b1);}return _0x2ee0f9[_0x1c46('0x17')](_0x1654b1)[_0x1c46('0x18')]();};}function respondWithResult(_0x56845d,_0x10e16e){_0x10e16e=_0x10e16e||0xc8;return function(_0x5e3f1a){if(_0x5e3f1a){return _0x56845d[_0x1c46('0x17')](_0x10e16e)[_0x1c46('0x19')](_0x5e3f1a);}};}function respondWithFilteredResult(_0x42cd15,_0xe9812b){return function(_0x3782cf){if(_0x3782cf){var _0x387217=typeof _0xe9812b[_0x1c46('0x1a')]===_0x1c46('0x1b')&&typeof _0xe9812b[_0x1c46('0x1c')]==='undefined';var _0x331cca=_0x3782cf[_0x1c46('0x1d')];var _0x1a772b=_0x387217?0x0:_0xe9812b[_0x1c46('0x1a')];var _0x1dfa67=_0x387217?_0x3782cf[_0x1c46('0x1d')]:_0xe9812b[_0x1c46('0x1a')]+_0xe9812b[_0x1c46('0x1c')];var _0x112d3d;if(_0x1dfa67>=_0x331cca){_0x1dfa67=_0x331cca;_0x112d3d=0xc8;}else{_0x112d3d=0xce;}_0x42cd15[_0x1c46('0x17')](_0x112d3d);return _0x42cd15[_0x1c46('0x1e')](_0x1c46('0x1f'),_0x1a772b+'-'+_0x1dfa67+'/'+_0x331cca)['json'](_0x3782cf);}return null;};}function patchUpdates(_0x5b7bb5){return function(_0x5df8e8){try{jsonpatch[_0x1c46('0x20')](_0x5df8e8,_0x5b7bb5,!![]);}catch(_0x40cc6c){return BPromise[_0x1c46('0x21')](_0x40cc6c);}return _0x5df8e8[_0x1c46('0x22')]();};}function saveUpdates(_0x149e9a,_0x3246bf){return function(_0x358fe6){if(_0x358fe6){return _0x358fe6[_0x1c46('0x23')](_0x149e9a)[_0x1c46('0x24')](function(_0x1deddc){return _0x1deddc;});}return null;};}function removeEntity(_0x30d766,_0x2b451e){return function(_0x4f6562){if(_0x4f6562){return _0x4f6562['destroy']()[_0x1c46('0x24')](function(){_0x30d766[_0x1c46('0x17')](0xcc)[_0x1c46('0x18')]();});}};}function handleEntityNotFound(_0x395801,_0x197bbd){return function(_0x481558){if(!_0x481558){_0x395801[_0x1c46('0x16')](0x194);}return _0x481558;};}function handleError(_0x2f2abe,_0x5a0ecf){_0x5a0ecf=_0x5a0ecf||0x1f4;return function(_0x3700fe){logger[_0x1c46('0x25')](_0x3700fe[_0x1c46('0x26')]);if(_0x3700fe['name']){delete _0x3700fe[_0x1c46('0x27')];}_0x2f2abe[_0x1c46('0x17')](_0x5a0ecf)[_0x1c46('0x28')](_0x3700fe);};}exports['index']=function(_0x11331d,_0x3eb679){var _0xddb15={},_0x355fc8={},_0x315d72={'count':0x0,'rows':[]};var _0x1c517c=_['map'](db[_0x1c46('0x29')][_0x1c46('0x2a')],function(_0x2e8e73){return{'name':_0x2e8e73[_0x1c46('0x2b')],'type':_0x2e8e73['type'][_0x1c46('0x2c')]};});_0x355fc8['model']=_[_0x1c46('0x2d')](_0x1c517c,'name');_0x355fc8[_0x1c46('0x2e')]=_[_0x1c46('0x2f')](_0x11331d[_0x1c46('0x2e')]);_0x355fc8['filters']=_[_0x1c46('0x30')](_0x355fc8[_0x1c46('0x31')],_0x355fc8[_0x1c46('0x2e')]);_0xddb15['attributes']=_[_0x1c46('0x30')](_0x355fc8[_0x1c46('0x31')],qs[_0x1c46('0x32')](_0x11331d[_0x1c46('0x2e')][_0x1c46('0x32')]));_0xddb15[_0x1c46('0x33')]=_0xddb15[_0x1c46('0x33')][_0x1c46('0x34')]?_0xddb15[_0x1c46('0x33')]:_0x355fc8[_0x1c46('0x31')];if(!_0x11331d[_0x1c46('0x2e')][_0x1c46('0x35')](_0x1c46('0x36'))){_0xddb15['limit']=qs[_0x1c46('0x1c')](_0x11331d[_0x1c46('0x2e')][_0x1c46('0x1c')]);_0xddb15[_0x1c46('0x1a')]=qs[_0x1c46('0x1a')](_0x11331d['query'][_0x1c46('0x1a')]);}_0xddb15['order']=qs[_0x1c46('0x37')](_0x11331d[_0x1c46('0x2e')][_0x1c46('0x37')]);_0xddb15[_0x1c46('0x38')]=qs[_0x1c46('0x39')](_[_0x1c46('0x3a')](_0x11331d[_0x1c46('0x2e')],_0x355fc8[_0x1c46('0x39')]),_0x1c517c);if(_0x11331d[_0x1c46('0x2e')]['filter']){_0xddb15[_0x1c46('0x38')]=_[_0x1c46('0x3b')](_0xddb15['where'],{'$or':_[_0x1c46('0x2d')](_0x1c517c,function(_0x30fb54){if(_0x30fb54[_0x1c46('0x3c')]!=='VIRTUAL'){var _0x3b6793={};_0x3b6793[_0x30fb54['name']]={'$like':'%'+_0x11331d[_0x1c46('0x2e')]['filter']+'%'};return _0x3b6793;}})});}_0xddb15=_['merge']({},_0xddb15,_0x11331d['options']);var _0x4b3951={'where':_0xddb15[_0x1c46('0x38')]};return db[_0x1c46('0x29')][_0x1c46('0x1d')](_0x4b3951)[_0x1c46('0x24')](function(_0x5022e5){_0x315d72[_0x1c46('0x1d')]=_0x5022e5;if(_0x11331d[_0x1c46('0x2e')][_0x1c46('0x3d')]){_0xddb15[_0x1c46('0x3e')]=[{'all':!![]}];}return db[_0x1c46('0x29')][_0x1c46('0x3f')](_0xddb15);})[_0x1c46('0x24')](function(_0x19da41){_0x315d72['rows']=_0x19da41;return _0x315d72;})[_0x1c46('0x24')](respondWithFilteredResult(_0x3eb679,_0xddb15))['catch'](handleError(_0x3eb679,null));};exports[_0x1c46('0x40')]=function(_0x388a1d,_0x2787dc){var _0x19f8b3={'raw':![],'where':{'id':_0x388a1d[_0x1c46('0x41')]['id']}},_0x255c7b={};_0x255c7b['model']=_[_0x1c46('0x2f')](db[_0x1c46('0x29')][_0x1c46('0x2a')]);_0x255c7b[_0x1c46('0x2e')]=_[_0x1c46('0x2f')](_0x388a1d['query']);_0x255c7b[_0x1c46('0x39')]=_[_0x1c46('0x30')](_0x255c7b['model'],_0x255c7b[_0x1c46('0x2e')]);_0x19f8b3[_0x1c46('0x33')]=_[_0x1c46('0x30')](_0x255c7b[_0x1c46('0x31')],qs[_0x1c46('0x32')](_0x388a1d[_0x1c46('0x2e')][_0x1c46('0x32')]));_0x19f8b3[_0x1c46('0x33')]=_0x19f8b3[_0x1c46('0x33')][_0x1c46('0x34')]?_0x19f8b3['attributes']:_0x255c7b['model'];if(_0x388a1d['query'][_0x1c46('0x3d')]){_0x19f8b3[_0x1c46('0x3e')]=[{'all':!![]}];}_0x19f8b3=_['merge']({},_0x19f8b3,_0x388a1d[_0x1c46('0x42')]);return db[_0x1c46('0x29')][_0x1c46('0x43')](_0x19f8b3)[_0x1c46('0x24')](handleEntityNotFound(_0x2787dc,null))[_0x1c46('0x24')](respondWithResult(_0x2787dc,null))[_0x1c46('0x44')](handleError(_0x2787dc,null));};exports[_0x1c46('0x45')]=function(_0x385baf,_0x2fabeb){return db[_0x1c46('0x29')][_0x1c46('0x45')](_0x385baf['body'],{})['then'](respondWithResult(_0x2fabeb,0xc9))[_0x1c46('0x44')](handleError(_0x2fabeb,null));};exports[_0x1c46('0x23')]=function(_0x30a52e,_0x4a7bfb){if(_0x30a52e[_0x1c46('0x46')]['id']){delete _0x30a52e[_0x1c46('0x46')]['id'];}return db[_0x1c46('0x29')][_0x1c46('0x43')]({'where':{'id':_0x30a52e[_0x1c46('0x41')]['id']}})[_0x1c46('0x24')](handleEntityNotFound(_0x4a7bfb,null))[_0x1c46('0x24')](saveUpdates(_0x30a52e[_0x1c46('0x46')],null))[_0x1c46('0x24')](respondWithResult(_0x4a7bfb,null))[_0x1c46('0x44')](handleError(_0x4a7bfb,null));};exports[_0x1c46('0x47')]=function(_0xacc9ec,_0x3e7c7f){return db['Automation'][_0x1c46('0x43')]({'where':{'id':_0xacc9ec[_0x1c46('0x41')]['id']}})[_0x1c46('0x24')](handleEntityNotFound(_0x3e7c7f,null))[_0x1c46('0x24')](removeEntity(_0x3e7c7f,null))[_0x1c46('0x44')](handleError(_0x3e7c7f,null));};exports['addConditions']=function(_0x3d7a5e,_0x2815fc,_0x553356){return db[_0x1c46('0x48')]['find']({'where':{'id':_0x3d7a5e['params']['id']}})[_0x1c46('0x24')](handleEntityNotFound(_0x2815fc,null))[_0x1c46('0x24')](function(_0x57ee07){if(_0x57ee07){return _0x57ee07[_0x1c46('0x49')](_0x3d7a5e[_0x1c46('0x46')][_0x1c46('0x4a')],_[_0x1c46('0x4b')](_0x3d7a5e[_0x1c46('0x46')],['ids','id'])||{});}})['then'](respondWithResult(_0x2815fc,null))[_0x1c46('0x44')](handleError(_0x2815fc,null));};exports[_0x1c46('0x4c')]=function(_0x455f55,_0x59d1c3,_0x26e454){var _0x50d99e={};var _0x2fe34f={};var _0x4d9f5f;var _0x4bacce;return db['Automation'][_0x1c46('0x4d')]({'where':{'id':_0x455f55[_0x1c46('0x41')]['id']}})[_0x1c46('0x24')](handleEntityNotFound(_0x59d1c3,null))[_0x1c46('0x24')](function(_0x14c4ae){if(_0x14c4ae){_0x4d9f5f=_0x14c4ae;_0x2fe34f[_0x1c46('0x31')]=_[_0x1c46('0x2f')](db[_0x1c46('0x48')][_0x1c46('0x2a')]);_0x2fe34f[_0x1c46('0x2e')]=_['keys'](_0x455f55[_0x1c46('0x2e')]);_0x2fe34f[_0x1c46('0x39')]=_[_0x1c46('0x30')](_0x2fe34f[_0x1c46('0x31')],_0x2fe34f[_0x1c46('0x2e')]);_0x50d99e['attributes']=_[_0x1c46('0x30')](_0x2fe34f[_0x1c46('0x31')],qs[_0x1c46('0x32')](_0x455f55[_0x1c46('0x2e')][_0x1c46('0x32')]));_0x50d99e['attributes']=_0x50d99e['attributes'][_0x1c46('0x34')]?_0x50d99e[_0x1c46('0x33')]:_0x2fe34f[_0x1c46('0x31')];_0x50d99e['order']=qs[_0x1c46('0x37')](_0x455f55[_0x1c46('0x2e')][_0x1c46('0x37')]);_0x50d99e['where']=qs[_0x1c46('0x39')](_[_0x1c46('0x3a')](_0x455f55[_0x1c46('0x2e')],_0x2fe34f['filters']));if(_0x455f55[_0x1c46('0x2e')][_0x1c46('0x4e')]){_0x50d99e['where']=_['merge'](_0x50d99e[_0x1c46('0x38')],{'$or':_['map'](_0x50d99e[_0x1c46('0x33')],function(_0x136539){var _0x389c1e={};_0x389c1e[_0x136539]={'$like':'%'+_0x455f55[_0x1c46('0x2e')][_0x1c46('0x4e')]+'%'};return _0x389c1e;})});}_0x50d99e=_['merge']({},_0x50d99e,_0x455f55[_0x1c46('0x42')]);return _0x4d9f5f[_0x1c46('0x4c')](_0x50d99e);}})['then'](function(_0x55098b){if(_0x55098b){_0x4bacce=_0x55098b[_0x1c46('0x34')];if(!_0x455f55['query'][_0x1c46('0x35')](_0x1c46('0x36'))){_0x50d99e[_0x1c46('0x1c')]=qs['limit'](_0x455f55['query'][_0x1c46('0x1c')]);_0x50d99e['offset']=qs[_0x1c46('0x1a')](_0x455f55[_0x1c46('0x2e')][_0x1c46('0x1a')]);}return _0x4d9f5f[_0x1c46('0x4c')](_0x50d99e);}})[_0x1c46('0x24')](function(_0x16b40b){if(_0x16b40b){return _0x16b40b?{'count':_0x4bacce,'rows':_0x16b40b}:null;}})[_0x1c46('0x24')](respondWithResult(_0x59d1c3,null))[_0x1c46('0x44')](handleError(_0x59d1c3,null));};exports['addActions']=function(_0x3ad3a5,_0x1a6fb0,_0xef5f20){return db[_0x1c46('0x4f')]['find']({'where':{'id':_0x3ad3a5[_0x1c46('0x41')]['id']}})['then'](handleEntityNotFound(_0x1a6fb0,null))[_0x1c46('0x24')](function(_0xfbbfb1){if(_0xfbbfb1){return _0xfbbfb1[_0x1c46('0x50')](_0x3ad3a5[_0x1c46('0x46')][_0x1c46('0x4a')],_['omit'](_0x3ad3a5[_0x1c46('0x46')],[_0x1c46('0x4a'),'id'])||{});}})[_0x1c46('0x24')](respondWithResult(_0x1a6fb0,null))[_0x1c46('0x44')](handleError(_0x1a6fb0,null));};exports[_0x1c46('0x51')]=function(_0x61511d,_0x346d3e,_0x50e51f){var _0x459b2e={};var _0x4f2c8e={};var _0x39efa9;var _0x58c7c9;return db[_0x1c46('0x29')][_0x1c46('0x4d')]({'where':{'id':_0x61511d[_0x1c46('0x41')]['id']}})[_0x1c46('0x24')](handleEntityNotFound(_0x346d3e,null))[_0x1c46('0x24')](function(_0x40e929){if(_0x40e929){_0x39efa9=_0x40e929;_0x4f2c8e['model']=_[_0x1c46('0x2f')](db['Action']['rawAttributes']);_0x4f2c8e[_0x1c46('0x2e')]=_[_0x1c46('0x2f')](_0x61511d[_0x1c46('0x2e')]);_0x4f2c8e[_0x1c46('0x39')]=_[_0x1c46('0x30')](_0x4f2c8e['model'],_0x4f2c8e[_0x1c46('0x2e')]);_0x459b2e['attributes']=_[_0x1c46('0x30')](_0x4f2c8e[_0x1c46('0x31')],qs[_0x1c46('0x32')](_0x61511d[_0x1c46('0x2e')]['fields']));_0x459b2e[_0x1c46('0x33')]=_0x459b2e['attributes'][_0x1c46('0x34')]?_0x459b2e[_0x1c46('0x33')]:_0x4f2c8e['model'];_0x459b2e[_0x1c46('0x52')]=qs[_0x1c46('0x37')](_0x61511d[_0x1c46('0x2e')][_0x1c46('0x37')]);_0x459b2e['where']=qs[_0x1c46('0x39')](_[_0x1c46('0x3a')](_0x61511d[_0x1c46('0x2e')],_0x4f2c8e[_0x1c46('0x39')]));if(_0x61511d[_0x1c46('0x2e')][_0x1c46('0x4e')]){_0x459b2e[_0x1c46('0x38')]=_[_0x1c46('0x3b')](_0x459b2e[_0x1c46('0x38')],{'$or':_[_0x1c46('0x2d')](_0x459b2e[_0x1c46('0x33')],function(_0x199c2e){var _0x545df9={};_0x545df9[_0x199c2e]={'$like':'%'+_0x61511d[_0x1c46('0x2e')][_0x1c46('0x4e')]+'%'};return _0x545df9;})});}_0x459b2e=_[_0x1c46('0x3b')]({},_0x459b2e,_0x61511d['options']);return _0x39efa9[_0x1c46('0x51')](_0x459b2e);}})[_0x1c46('0x24')](function(_0x4846f9){if(_0x4846f9){_0x58c7c9=_0x4846f9[_0x1c46('0x34')];if(!_0x61511d['query'][_0x1c46('0x35')](_0x1c46('0x36'))){_0x459b2e[_0x1c46('0x1c')]=qs['limit'](_0x61511d[_0x1c46('0x2e')][_0x1c46('0x1c')]);_0x459b2e[_0x1c46('0x1a')]=qs[_0x1c46('0x1a')](_0x61511d['query'][_0x1c46('0x1a')]);}return _0x39efa9[_0x1c46('0x51')](_0x459b2e);}})[_0x1c46('0x24')](function(_0x2df8fb){if(_0x2df8fb){return _0x2df8fb?{'count':_0x58c7c9,'rows':_0x2df8fb}:null;}})[_0x1c46('0x24')](respondWithResult(_0x346d3e,null))[_0x1c46('0x44')](handleError(_0x346d3e,null));}; \ No newline at end of file +var _0x632e=['end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','Automation','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','find','create','body','addConditions','Condition','ids','omit','findOne','getConditions','hasOwnProperty','nolimit','addActions','Action','getActions','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x21a286,_0x26db62){var _0x526809=function(_0x18f3b0){while(--_0x18f3b0){_0x21a286['push'](_0x21a286['shift']());}};_0x526809(++_0x26db62);}(_0x632e,0x1ef));var _0xe632=function(_0x32b122,_0x1ad490){_0x32b122=_0x32b122-0x0;var _0x4ad25a=_0x632e[_0x32b122];return _0x4ad25a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe632('0x0'));var jsonpatch=require(_0xe632('0x1'));var rp=require(_0xe632('0x2'));var moment=require(_0xe632('0x3'));var BPromise=require(_0xe632('0x4'));var Mustache=require('mustache');var util=require(_0xe632('0x5'));var path=require(_0xe632('0x6'));var sox=require(_0xe632('0x7'));var csv=require('to-csv');var ejs=require(_0xe632('0x8'));var fs=require('fs');var fs_extra=require(_0xe632('0x9'));var _=require(_0xe632('0xa'));var squel=require(_0xe632('0xb'));var crypto=require(_0xe632('0xc'));var jsforce=require(_0xe632('0xd'));var deskjs=require(_0xe632('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe632('0xf'));var Redis=require(_0xe632('0x10'));var authService=require(_0xe632('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe632('0x12'));var hardwareService=require(_0xe632('0x13'));var logger=require(_0xe632('0x14'))(_0xe632('0x15'));var utils=require(_0xe632('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe632('0x17'));var db=require(_0xe632('0x18'))['db'];function respondWithStatusCode(_0xc1f14a,_0xec6603){_0xec6603=_0xec6603||0xcc;return function(_0x304fbe){if(_0x304fbe){return _0xc1f14a[_0xe632('0x19')](_0xec6603);}return _0xc1f14a[_0xe632('0x1a')](_0xec6603)[_0xe632('0x1b')]();};}function respondWithResult(_0x539791,_0x4bc89f){_0x4bc89f=_0x4bc89f||0xc8;return function(_0xcc4e89){if(_0xcc4e89){return _0x539791[_0xe632('0x1a')](_0x4bc89f)[_0xe632('0x1c')](_0xcc4e89);}};}function respondWithFilteredResult(_0x2e7269,_0x2d67ba){return function(_0x18ded0){if(_0x18ded0){var _0x5ab7b6=typeof _0x2d67ba[_0xe632('0x1d')]===_0xe632('0x1e')&&typeof _0x2d67ba['limit']===_0xe632('0x1e');var _0x4f6634=_0x18ded0[_0xe632('0x1f')];var _0x4757e3=_0x5ab7b6?0x0:_0x2d67ba[_0xe632('0x1d')];var _0x365390=_0x5ab7b6?_0x18ded0[_0xe632('0x1f')]:_0x2d67ba['offset']+_0x2d67ba[_0xe632('0x20')];var _0x1d86d9;if(_0x365390>=_0x4f6634){_0x365390=_0x4f6634;_0x1d86d9=0xc8;}else{_0x1d86d9=0xce;}_0x2e7269[_0xe632('0x1a')](_0x1d86d9);return _0x2e7269[_0xe632('0x21')](_0xe632('0x22'),_0x4757e3+'-'+_0x365390+'/'+_0x4f6634)['json'](_0x18ded0);}return null;};}function patchUpdates(_0x475e96){return function(_0x2acf0b){try{jsonpatch[_0xe632('0x23')](_0x2acf0b,_0x475e96,!![]);}catch(_0x126fce){return BPromise[_0xe632('0x24')](_0x126fce);}return _0x2acf0b[_0xe632('0x25')]();};}function saveUpdates(_0x810713,_0xcb9468){return function(_0x2050e7){if(_0x2050e7){return _0x2050e7[_0xe632('0x26')](_0x810713)[_0xe632('0x27')](function(_0x18952e){return _0x18952e;});}return null;};}function removeEntity(_0x53549b,_0x3ff38e){return function(_0x466b75){if(_0x466b75){return _0x466b75[_0xe632('0x28')]()[_0xe632('0x27')](function(){_0x53549b[_0xe632('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e779f,_0x3af543){return function(_0x177ac6){if(!_0x177ac6){_0x3e779f[_0xe632('0x19')](0x194);}return _0x177ac6;};}function handleError(_0x49d724,_0x5422c5){_0x5422c5=_0x5422c5||0x1f4;return function(_0x5eea04){logger[_0xe632('0x29')](_0x5eea04[_0xe632('0x2a')]);if(_0x5eea04[_0xe632('0x2b')]){delete _0x5eea04[_0xe632('0x2b')];}_0x49d724[_0xe632('0x1a')](_0x5422c5)[_0xe632('0x2c')](_0x5eea04);};}exports['index']=function(_0x439149,_0x1ddc3f){var _0x2eb25d={},_0x3cf90c={},_0x40b26d={'count':0x0,'rows':[]};var _0xa48265=_['map'](db[_0xe632('0x2d')][_0xe632('0x2e')],function(_0x4102a8){return{'name':_0x4102a8[_0xe632('0x2f')],'type':_0x4102a8[_0xe632('0x30')][_0xe632('0x31')]};});_0x3cf90c[_0xe632('0x32')]=_[_0xe632('0x33')](_0xa48265,'name');_0x3cf90c['query']=_[_0xe632('0x34')](_0x439149[_0xe632('0x35')]);_0x3cf90c[_0xe632('0x36')]=_[_0xe632('0x37')](_0x3cf90c['model'],_0x3cf90c[_0xe632('0x35')]);_0x2eb25d['attributes']=_[_0xe632('0x37')](_0x3cf90c[_0xe632('0x32')],qs[_0xe632('0x38')](_0x439149[_0xe632('0x35')][_0xe632('0x38')]));_0x2eb25d[_0xe632('0x39')]=_0x2eb25d[_0xe632('0x39')]['length']?_0x2eb25d[_0xe632('0x39')]:_0x3cf90c[_0xe632('0x32')];if(!_0x439149[_0xe632('0x35')]['hasOwnProperty']('nolimit')){_0x2eb25d['limit']=qs[_0xe632('0x20')](_0x439149['query'][_0xe632('0x20')]);_0x2eb25d[_0xe632('0x1d')]=qs[_0xe632('0x1d')](_0x439149[_0xe632('0x35')]['offset']);}_0x2eb25d[_0xe632('0x3a')]=qs['sort'](_0x439149['query'][_0xe632('0x3b')]);_0x2eb25d[_0xe632('0x3c')]=qs['filters'](_[_0xe632('0x3d')](_0x439149[_0xe632('0x35')],_0x3cf90c['filters']),_0xa48265);if(_0x439149[_0xe632('0x35')][_0xe632('0x3e')]){_0x2eb25d[_0xe632('0x3c')]=_[_0xe632('0x3f')](_0x2eb25d['where'],{'$or':_['map'](_0xa48265,function(_0x367218){if(_0x367218[_0xe632('0x30')]!==_0xe632('0x40')){var _0x19d9ac={};_0x19d9ac[_0x367218['name']]={'$like':'%'+_0x439149[_0xe632('0x35')][_0xe632('0x3e')]+'%'};return _0x19d9ac;}})});}_0x2eb25d=_[_0xe632('0x3f')]({},_0x2eb25d,_0x439149[_0xe632('0x41')]);var _0x4d8700={'where':_0x2eb25d['where']};return db[_0xe632('0x2d')][_0xe632('0x1f')](_0x4d8700)[_0xe632('0x27')](function(_0x516b9a){_0x40b26d['count']=_0x516b9a;if(_0x439149['query'][_0xe632('0x42')]){_0x2eb25d[_0xe632('0x43')]=[{'all':!![]}];}return db[_0xe632('0x2d')][_0xe632('0x44')](_0x2eb25d);})[_0xe632('0x27')](function(_0x34e754){_0x40b26d['rows']=_0x34e754;return _0x40b26d;})[_0xe632('0x27')](respondWithFilteredResult(_0x1ddc3f,_0x2eb25d))[_0xe632('0x45')](handleError(_0x1ddc3f,null));};exports[_0xe632('0x46')]=function(_0x4d9cc5,_0x50b1c2){var _0x4634ab={'raw':![],'where':{'id':_0x4d9cc5[_0xe632('0x47')]['id']}},_0x1dac46={};_0x1dac46[_0xe632('0x32')]=_[_0xe632('0x34')](db[_0xe632('0x2d')][_0xe632('0x2e')]);_0x1dac46[_0xe632('0x35')]=_[_0xe632('0x34')](_0x4d9cc5[_0xe632('0x35')]);_0x1dac46[_0xe632('0x36')]=_[_0xe632('0x37')](_0x1dac46[_0xe632('0x32')],_0x1dac46[_0xe632('0x35')]);_0x4634ab[_0xe632('0x39')]=_['intersection'](_0x1dac46[_0xe632('0x32')],qs['fields'](_0x4d9cc5[_0xe632('0x35')][_0xe632('0x38')]));_0x4634ab['attributes']=_0x4634ab[_0xe632('0x39')][_0xe632('0x48')]?_0x4634ab[_0xe632('0x39')]:_0x1dac46['model'];if(_0x4d9cc5[_0xe632('0x35')][_0xe632('0x42')]){_0x4634ab[_0xe632('0x43')]=[{'all':!![]}];}_0x4634ab=_[_0xe632('0x3f')]({},_0x4634ab,_0x4d9cc5['options']);return db['Automation'][_0xe632('0x49')](_0x4634ab)['then'](handleEntityNotFound(_0x50b1c2,null))[_0xe632('0x27')](respondWithResult(_0x50b1c2,null))[_0xe632('0x45')](handleError(_0x50b1c2,null));};exports[_0xe632('0x4a')]=function(_0xb96944,_0x396c4f){return db['Automation'][_0xe632('0x4a')](_0xb96944[_0xe632('0x4b')],{})[_0xe632('0x27')](respondWithResult(_0x396c4f,0xc9))[_0xe632('0x45')](handleError(_0x396c4f,null));};exports[_0xe632('0x26')]=function(_0xbb9146,_0x45968e){if(_0xbb9146[_0xe632('0x4b')]['id']){delete _0xbb9146[_0xe632('0x4b')]['id'];}return db[_0xe632('0x2d')]['find']({'where':{'id':_0xbb9146[_0xe632('0x47')]['id']}})[_0xe632('0x27')](handleEntityNotFound(_0x45968e,null))[_0xe632('0x27')](saveUpdates(_0xbb9146['body'],null))['then'](respondWithResult(_0x45968e,null))[_0xe632('0x45')](handleError(_0x45968e,null));};exports[_0xe632('0x28')]=function(_0x11b2d0,_0x33d63c){return db['Automation'][_0xe632('0x49')]({'where':{'id':_0x11b2d0[_0xe632('0x47')]['id']}})['then'](handleEntityNotFound(_0x33d63c,null))[_0xe632('0x27')](removeEntity(_0x33d63c,null))[_0xe632('0x45')](handleError(_0x33d63c,null));};exports[_0xe632('0x4c')]=function(_0x1be386,_0x14d320,_0xebdab0){return db[_0xe632('0x4d')][_0xe632('0x49')]({'where':{'id':_0x1be386[_0xe632('0x47')]['id']}})['then'](handleEntityNotFound(_0x14d320,null))[_0xe632('0x27')](function(_0x5a7700){if(_0x5a7700){return _0x5a7700['addConditions'](_0x1be386[_0xe632('0x4b')][_0xe632('0x4e')],_[_0xe632('0x4f')](_0x1be386['body'],[_0xe632('0x4e'),'id'])||{});}})[_0xe632('0x27')](respondWithResult(_0x14d320,null))['catch'](handleError(_0x14d320,null));};exports['getConditions']=function(_0x464943,_0x39dd82,_0x3ddf7c){var _0x50c603={};var _0x5848f6={};var _0x5708d9;var _0x3124a5;return db['Automation'][_0xe632('0x50')]({'where':{'id':_0x464943[_0xe632('0x47')]['id']}})[_0xe632('0x27')](handleEntityNotFound(_0x39dd82,null))['then'](function(_0x2cd0fc){if(_0x2cd0fc){_0x5708d9=_0x2cd0fc;_0x5848f6['model']=_[_0xe632('0x34')](db[_0xe632('0x4d')][_0xe632('0x2e')]);_0x5848f6['query']=_[_0xe632('0x34')](_0x464943[_0xe632('0x35')]);_0x5848f6[_0xe632('0x36')]=_[_0xe632('0x37')](_0x5848f6[_0xe632('0x32')],_0x5848f6[_0xe632('0x35')]);_0x50c603['attributes']=_[_0xe632('0x37')](_0x5848f6[_0xe632('0x32')],qs[_0xe632('0x38')](_0x464943[_0xe632('0x35')]['fields']));_0x50c603[_0xe632('0x39')]=_0x50c603[_0xe632('0x39')][_0xe632('0x48')]?_0x50c603['attributes']:_0x5848f6[_0xe632('0x32')];_0x50c603[_0xe632('0x3a')]=qs['sort'](_0x464943['query'][_0xe632('0x3b')]);_0x50c603['where']=qs[_0xe632('0x36')](_[_0xe632('0x3d')](_0x464943['query'],_0x5848f6[_0xe632('0x36')]));if(_0x464943[_0xe632('0x35')][_0xe632('0x3e')]){_0x50c603[_0xe632('0x3c')]=_[_0xe632('0x3f')](_0x50c603[_0xe632('0x3c')],{'$or':_[_0xe632('0x33')](_0x50c603['attributes'],function(_0x1f72b1){var _0x33741b={};_0x33741b[_0x1f72b1]={'$like':'%'+_0x464943[_0xe632('0x35')][_0xe632('0x3e')]+'%'};return _0x33741b;})});}_0x50c603=_[_0xe632('0x3f')]({},_0x50c603,_0x464943[_0xe632('0x41')]);return _0x5708d9[_0xe632('0x51')](_0x50c603);}})[_0xe632('0x27')](function(_0x460f74){if(_0x460f74){_0x3124a5=_0x460f74['length'];if(!_0x464943['query'][_0xe632('0x52')](_0xe632('0x53'))){_0x50c603[_0xe632('0x20')]=qs[_0xe632('0x20')](_0x464943[_0xe632('0x35')][_0xe632('0x20')]);_0x50c603[_0xe632('0x1d')]=qs['offset'](_0x464943[_0xe632('0x35')][_0xe632('0x1d')]);}return _0x5708d9['getConditions'](_0x50c603);}})['then'](function(_0x374e11){if(_0x374e11){return _0x374e11?{'count':_0x3124a5,'rows':_0x374e11}:null;}})[_0xe632('0x27')](respondWithResult(_0x39dd82,null))[_0xe632('0x45')](handleError(_0x39dd82,null));};exports[_0xe632('0x54')]=function(_0x49693b,_0x247905,_0x362760){return db[_0xe632('0x55')][_0xe632('0x49')]({'where':{'id':_0x49693b[_0xe632('0x47')]['id']}})['then'](handleEntityNotFound(_0x247905,null))['then'](function(_0x42fd20){if(_0x42fd20){return _0x42fd20['addActions'](_0x49693b['body'][_0xe632('0x4e')],_[_0xe632('0x4f')](_0x49693b[_0xe632('0x4b')],[_0xe632('0x4e'),'id'])||{});}})[_0xe632('0x27')](respondWithResult(_0x247905,null))[_0xe632('0x45')](handleError(_0x247905,null));};exports[_0xe632('0x56')]=function(_0x1d9513,_0x12fbe5,_0x1c85ac){var _0x317724={};var _0x44d522={};var _0xd863af;var _0x54b3c6;return db[_0xe632('0x2d')][_0xe632('0x50')]({'where':{'id':_0x1d9513[_0xe632('0x47')]['id']}})[_0xe632('0x27')](handleEntityNotFound(_0x12fbe5,null))[_0xe632('0x27')](function(_0x11ab4b){if(_0x11ab4b){_0xd863af=_0x11ab4b;_0x44d522['model']=_[_0xe632('0x34')](db[_0xe632('0x55')]['rawAttributes']);_0x44d522[_0xe632('0x35')]=_[_0xe632('0x34')](_0x1d9513[_0xe632('0x35')]);_0x44d522[_0xe632('0x36')]=_[_0xe632('0x37')](_0x44d522[_0xe632('0x32')],_0x44d522[_0xe632('0x35')]);_0x317724[_0xe632('0x39')]=_[_0xe632('0x37')](_0x44d522[_0xe632('0x32')],qs[_0xe632('0x38')](_0x1d9513[_0xe632('0x35')][_0xe632('0x38')]));_0x317724[_0xe632('0x39')]=_0x317724[_0xe632('0x39')][_0xe632('0x48')]?_0x317724[_0xe632('0x39')]:_0x44d522[_0xe632('0x32')];_0x317724[_0xe632('0x3a')]=qs[_0xe632('0x3b')](_0x1d9513[_0xe632('0x35')][_0xe632('0x3b')]);_0x317724[_0xe632('0x3c')]=qs[_0xe632('0x36')](_['pick'](_0x1d9513[_0xe632('0x35')],_0x44d522[_0xe632('0x36')]));if(_0x1d9513[_0xe632('0x35')][_0xe632('0x3e')]){_0x317724[_0xe632('0x3c')]=_[_0xe632('0x3f')](_0x317724[_0xe632('0x3c')],{'$or':_[_0xe632('0x33')](_0x317724[_0xe632('0x39')],function(_0x39a344){var _0xf25480={};_0xf25480[_0x39a344]={'$like':'%'+_0x1d9513[_0xe632('0x35')][_0xe632('0x3e')]+'%'};return _0xf25480;})});}_0x317724=_[_0xe632('0x3f')]({},_0x317724,_0x1d9513[_0xe632('0x41')]);return _0xd863af[_0xe632('0x56')](_0x317724);}})['then'](function(_0x4643fc){if(_0x4643fc){_0x54b3c6=_0x4643fc[_0xe632('0x48')];if(!_0x1d9513[_0xe632('0x35')][_0xe632('0x52')](_0xe632('0x53'))){_0x317724[_0xe632('0x20')]=qs['limit'](_0x1d9513[_0xe632('0x35')]['limit']);_0x317724['offset']=qs[_0xe632('0x1d')](_0x1d9513[_0xe632('0x35')]['offset']);}return _0xd863af[_0xe632('0x56')](_0x317724);}})[_0xe632('0x27')](function(_0x129654){if(_0x129654){return _0x129654?{'count':_0x54b3c6,'rows':_0x129654}:null;}})[_0xe632('0x27')](respondWithResult(_0x12fbe5,null))[_0xe632('0x45')](handleError(_0x12fbe5,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 39da091..13b68ac 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 _0x0b54=['define','Automation','tools_automations','lodash','api','moment','path','rimraf','../../config/environment','exports'];(function(_0x11abe5,_0x2cc613){var _0x88fb48=function(_0x29fa80){while(--_0x29fa80){_0x11abe5['push'](_0x11abe5['shift']());}};_0x88fb48(++_0x2cc613);}(_0x0b54,0xc1));var _0x40b5=function(_0x3a8dc1,_0x2f03b8){_0x3a8dc1=_0x3a8dc1-0x0;var _0x4b3595=_0x0b54[_0x3a8dc1];return _0x4b3595;};'use strict';var _=require(_0x40b5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x40b5('0x1'));var moment=require(_0x40b5('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x40b5('0x3'));var rimraf=require(_0x40b5('0x4'));var config=require(_0x40b5('0x5'));var attributes=require('./automation.attributes');module[_0x40b5('0x6')]=function(_0x12cfd6,_0x41a796){return _0x12cfd6[_0x40b5('0x7')](_0x40b5('0x8'),attributes,{'tableName':_0x40b5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6dea=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./automation.attributes','define','tools_automations','lodash'];(function(_0x4cef57,_0x4da0e4){var _0x3bf7dd=function(_0xe01cb4){while(--_0xe01cb4){_0x4cef57['push'](_0x4cef57['shift']());}};_0x3bf7dd(++_0x4da0e4);}(_0x6dea,0xfb));var _0xa6de=function(_0x27f477,_0x5131b0){_0x27f477=_0x27f477-0x0;var _0x300a6f=_0x6dea[_0x27f477];return _0x300a6f;};'use strict';var _=require(_0xa6de('0x0'));var util=require(_0xa6de('0x1'));var logger=require(_0xa6de('0x2'))(_0xa6de('0x3'));var moment=require(_0xa6de('0x4'));var BPromise=require('bluebird');var rp=require(_0xa6de('0x5'));var fs=require('fs');var path=require(_0xa6de('0x6'));var rimraf=require(_0xa6de('0x7'));var config=require(_0xa6de('0x8'));var attributes=require(_0xa6de('0x9'));module['exports']=function(_0x207318,_0x140d16){return _0x207318[_0xa6de('0xa')]('Automation',attributes,{'tableName':_0xa6de('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 57e8394..2808e28 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 _0xd237=['client','request','then','info','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5e7fbe,_0x49c047){var _0x3ec021=function(_0x2c149b){while(--_0x2c149b){_0x5e7fbe['push'](_0x5e7fbe['shift']());}};_0x3ec021(++_0x49c047);}(_0xd237,0x14f));var _0x7d23=function(_0x141a31,_0x3ab263){_0x141a31=_0x141a31-0x0;var _0x44b4e3=_0xd237[_0x141a31];return _0x44b4e3;};'use strict';var _=require(_0x7d23('0x0'));var util=require(_0x7d23('0x1'));var moment=require(_0x7d23('0x2'));var BPromise=require(_0x7d23('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7d23('0x4'));var db=require(_0x7d23('0x5'))['db'];var utils=require(_0x7d23('0x6'));var logger=require(_0x7d23('0x7'))(_0x7d23('0x8'));var config=require(_0x7d23('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7d23('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ca126,_0x48358f,_0xc43371){return new BPromise(function(_0x42c334,_0x6ce28d){return client[_0x7d23('0xb')](_0x5ca126,_0xc43371)[_0x7d23('0xc')](function(_0x23f1d6){logger[_0x7d23('0xd')](_0x7d23('0xe'),_0x48358f,'request\x20sent');logger[_0x7d23('0xf')](_0x7d23('0x10'),_0x48358f,_0x7d23('0x11'),JSON['stringify'](_0x23f1d6));if(_0x23f1d6[_0x7d23('0x12')]){if(_0x23f1d6['error'][_0x7d23('0x13')]===0x1f4){logger[_0x7d23('0x12')](_0x7d23('0xe'),_0x48358f,_0x23f1d6[_0x7d23('0x12')][_0x7d23('0x14')]);return _0x6ce28d(_0x23f1d6[_0x7d23('0x12')][_0x7d23('0x14')]);}logger['error']('Automation,\x20%s,\x20%s',_0x48358f,_0x23f1d6[_0x7d23('0x12')][_0x7d23('0x14')]);return _0x42c334(_0x23f1d6[_0x7d23('0x12')][_0x7d23('0x14')]);}else{logger['info'](_0x7d23('0xe'),_0x48358f,'request\x20sent');_0x42c334(_0x23f1d6[_0x7d23('0x15')]['message']);}})[_0x7d23('0x16')](function(_0x46a35b){logger[_0x7d23('0x12')](_0x7d23('0xe'),_0x48358f,_0x46a35b);_0x6ce28d(_0x46a35b);});});} \ No newline at end of file +var _0x7b08=['code','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','error'];(function(_0x14a0a0,_0x45d0cf){var _0x56b651=function(_0x1fae09){while(--_0x1fae09){_0x14a0a0['push'](_0x14a0a0['shift']());}};_0x56b651(++_0x45d0cf);}(_0x7b08,0x163));var _0x87b0=function(_0x13c8df,_0x102892){_0x13c8df=_0x13c8df-0x0;var _0xc33f48=_0x7b08[_0x13c8df];return _0xc33f48;};'use strict';var _=require(_0x87b0('0x0'));var util=require('util');var moment=require(_0x87b0('0x1'));var BPromise=require(_0x87b0('0x2'));var rs=require(_0x87b0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x87b0('0x4'))['db'];var utils=require(_0x87b0('0x5'));var logger=require(_0x87b0('0x6'))(_0x87b0('0x7'));var config=require('../../config/environment');var jayson=require(_0x87b0('0x8'));var client=jayson[_0x87b0('0x9')][_0x87b0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x419841,_0x130650,_0x41dcc8){return new BPromise(function(_0x1a7f35,_0x4015e2){return client[_0x87b0('0xb')](_0x419841,_0x41dcc8)[_0x87b0('0xc')](function(_0x52f596){logger[_0x87b0('0xd')](_0x87b0('0xe'),_0x130650,_0x87b0('0xf'));logger[_0x87b0('0x10')](_0x87b0('0x11'),_0x130650,_0x87b0('0xf'),JSON['stringify'](_0x52f596));if(_0x52f596['error']){if(_0x52f596[_0x87b0('0x12')][_0x87b0('0x13')]===0x1f4){logger[_0x87b0('0x12')](_0x87b0('0xe'),_0x130650,_0x52f596[_0x87b0('0x12')][_0x87b0('0x14')]);return _0x4015e2(_0x52f596['error'][_0x87b0('0x14')]);}logger[_0x87b0('0x12')]('Automation,\x20%s,\x20%s',_0x130650,_0x52f596['error'][_0x87b0('0x14')]);return _0x1a7f35(_0x52f596['error']['message']);}else{logger['info'](_0x87b0('0xe'),_0x130650,_0x87b0('0xf'));_0x1a7f35(_0x52f596['result'][_0x87b0('0x14')]);}})[_0x87b0('0x15')](function(_0x2b37d6){logger[_0x87b0('0x12')](_0x87b0('0xe'),_0x130650,_0x2b37d6);_0x4015e2(_0x2b37d6);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index d5b6d1a..d830a1a 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 _0x5455=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./automation.controller','get','/:id','show','isAuthenticated','getConditions','/:id/actions','getActions','post','create','addConditions','addActions','put','update','delete','destroy','exports','util'];(function(_0x5d1502,_0x4d4ba5){var _0x4ffad4=function(_0x2d4a19){while(--_0x2d4a19){_0x5d1502['push'](_0x5d1502['shift']());}};_0x4ffad4(++_0x4d4ba5);}(_0x5455,0x197));var _0x5545=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x5455[_0x160c73];return _0xd9302;};'use strict';var multer=require('multer');var util=require(_0x5545('0x0'));var path=require(_0x5545('0x1'));var timeout=require(_0x5545('0x2'));var express=require(_0x5545('0x3'));var router=express[_0x5545('0x4')]();var fs_extra=require(_0x5545('0x5'));var auth=require(_0x5545('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5545('0x7'));router[_0x5545('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5545('0x8')](_0x5545('0x9'),auth['isAuthenticated'](),controller[_0x5545('0xa')]);router[_0x5545('0x8')]('/:id/conditions',auth[_0x5545('0xb')](),controller[_0x5545('0xc')]);router[_0x5545('0x8')](_0x5545('0xd'),auth[_0x5545('0xb')](),controller[_0x5545('0xe')]);router[_0x5545('0xf')]('/',auth[_0x5545('0xb')](),controller[_0x5545('0x10')]);router['post']('/:id/conditions',auth[_0x5545('0xb')](),controller[_0x5545('0x11')]);router[_0x5545('0xf')](_0x5545('0xd'),auth['isAuthenticated'](),controller[_0x5545('0x12')]);router[_0x5545('0x13')]('/:id',auth[_0x5545('0xb')](),controller[_0x5545('0x14')]);router[_0x5545('0x15')](_0x5545('0x9'),auth['isAuthenticated'](),controller[_0x5545('0x16')]);module[_0x5545('0x17')]=router; \ No newline at end of file +var _0x826a=['getActions','post','addConditions','put','update','destroy','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','/:id/actions'];(function(_0x6a1321,_0x579f93){var _0x5d84ed=function(_0x477e8d){while(--_0x477e8d){_0x6a1321['push'](_0x6a1321['shift']());}};_0x5d84ed(++_0x579f93);}(_0x826a,0x1aa));var _0xa826=function(_0x21b990,_0x13409d){_0x21b990=_0x21b990-0x0;var _0x42550f=_0x826a[_0x21b990];return _0x42550f;};'use strict';var multer=require('multer');var util=require(_0xa826('0x0'));var path=require('path');var timeout=require(_0xa826('0x1'));var express=require('express');var router=express[_0xa826('0x2')]();var fs_extra=require(_0xa826('0x3'));var auth=require(_0xa826('0x4'));var interaction=require(_0xa826('0x5'));var config=require('../../config/environment');var controller=require(_0xa826('0x6'));router[_0xa826('0x7')]('/',auth[_0xa826('0x8')](),controller[_0xa826('0x9')]);router[_0xa826('0x7')](_0xa826('0xa'),auth[_0xa826('0x8')](),controller[_0xa826('0xb')]);router[_0xa826('0x7')](_0xa826('0xc'),auth[_0xa826('0x8')](),controller[_0xa826('0xd')]);router[_0xa826('0x7')](_0xa826('0xe'),auth[_0xa826('0x8')](),controller[_0xa826('0xf')]);router['post']('/',auth[_0xa826('0x8')](),controller['create']);router[_0xa826('0x10')](_0xa826('0xc'),auth[_0xa826('0x8')](),controller[_0xa826('0x11')]);router[_0xa826('0x10')](_0xa826('0xe'),auth[_0xa826('0x8')](),controller['addActions']);router[_0xa826('0x12')]('/:id',auth[_0xa826('0x8')](),controller[_0xa826('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa826('0x14')]);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 6154e03..3fbe1b3 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 _0xeef7=['DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','name','ENUM','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','STRING','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\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)'];(function(_0x5ed21f,_0x24e6c6){var _0x18a335=function(_0x29dd35){while(--_0x29dd35){_0x5ed21f['push'](_0x5ed21f['shift']());}};_0x18a335(++_0x24e6c6);}(_0xeef7,0x7d));var _0x7eef=function(_0x758841,_0x29e9df){_0x758841=_0x758841-0x0;var _0x24e623=_0xeef7[_0x758841];return _0x24e623;};'use strict';var Sequelize=require(_0x7eef('0x0'));module[_0x7eef('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x7eef('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x7eef('0x3')]('ivr'),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x7eef('0x4')],'defaultValue':0x0,'comment':_0x7eef('0x5')},'limitCalls':{'type':Sequelize[_0x7eef('0x6')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x7eef('0x7')]},'dialOriginateTimeout':{'type':Sequelize[_0x7eef('0x6')](0x3)[_0x7eef('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x7eef('0x6')](0x3)[_0x7eef('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7eef('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x7eef('0x6')](0x5)[_0x7eef('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7eef('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0x7eef('0x6')](0x3)[_0x7eef('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7eef('0xb')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7eef('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7eef('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x7eef('0x6')](0x3)[_0x7eef('0x8')],'defaultValue':0x3,'comment':_0x7eef('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x7eef('0x6')](0x5)[_0x7eef('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x7eef('0x6')](0x3)[_0x7eef('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x7eef('0xe')},'dialTimezone':{'type':Sequelize[_0x7eef('0x7')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x7eef('0x3')](_0x7eef('0xf'),_0x7eef('0x10'),_0x7eef('0x11')),'defaultValue':_0x7eef('0xf')},'dialAMDActive':{'type':Sequelize[_0x7eef('0x4')],'defaultValue':0x0,'comment':_0x7eef('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0x7eef('0x6')](0x9)[_0x7eef('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x7eef('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x7eef('0x6')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x7eef('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x7eef('0x6')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x7eef('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x7eef('0x6')](0x9)[_0x7eef('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7eef('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0x7eef('0x6')](0x9)[_0x7eef('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x7eef('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x7eef('0x6')](0x9)[_0x7eef('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x7eef('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x7eef('0x6')](0x9)[_0x7eef('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x7eef('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x7eef('0x6')](0x5)[_0x7eef('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x7eef('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x7eef('0x6')](0x9)[_0x7eef('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x7eef('0x3')]('DESC','ASC'),'defaultValue':_0x7eef('0x1b')},'dialPrefix':{'type':Sequelize[_0x7eef('0x7')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x7eef('0x6')](0x3)[_0x7eef('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7eef('0x1c')},'dialCutDigit':{'type':Sequelize[_0x7eef('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7eef('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x7eef('0x6')](0x3)[_0x7eef('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7eef('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x7eef('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7eef('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0x7eef('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7eef('0x20')},'dialDropRetryFrequency':{'type':Sequelize[_0x7eef('0x6')](0x5)[_0x7eef('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7eef('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x7eef('0x6')](0x3)[_0x7eef('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7eef('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x7eef('0x6')](0x5)[_0x7eef('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x7eef('0x6')](0x3)[_0x7eef('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x7eef('0x6')](0x5)[_0x7eef('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7eef('0x23')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x7eef('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7eef('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x7eef('0x6')](0x5)[_0x7eef('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7eef('0x25')}}; \ No newline at end of file +var _0x94b8=['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)','STRING','ENUM','ivr','BOOLEAN','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#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)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x94b8,0x111));var _0x894b=function(_0x2a4ea4,_0x5c6b7d){_0x2a4ea4=_0x2a4ea4-0x0;var _0x1d84b3=_0x94b8[_0x2a4ea4];return _0x1d84b3;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x894b('0x0')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x894b('0x1')](_0x894b('0x2')),'allowNull':![],'defaultValue':_0x894b('0x2')},'description':{'type':Sequelize[_0x894b('0x0')]},'active':{'type':Sequelize[_0x894b('0x3')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x894b('0x4')](0x4)[_0x894b('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x894b('0x4')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x894b('0x6')},'dialCongestionMaxRetry':{'type':Sequelize[_0x894b('0x4')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x894b('0x7')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x894b('0x4')](0x5)[_0x894b('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x894b('0x8')},'dialBusyMaxRetry':{'type':Sequelize[_0x894b('0x4')](0x3)[_0x894b('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x894b('0x4')](0x5)[_0x894b('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x894b('0x4')](0x3)[_0x894b('0x5')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x894b('0x4')](0x5)[_0x894b('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x894b('0x5')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x894b('0x9')},'dialTimezone':{'type':Sequelize[_0x894b('0x0')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x894b('0x0')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x894b('0xa'),_0x894b('0xb'),_0x894b('0xc')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x894b('0x3')],'defaultValue':0x0,'comment':_0x894b('0xd')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x894b('0x5')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x894b('0xe')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x894b('0x4')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x894b('0xf')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x894b('0x4')](0x9)[_0x894b('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x894b('0x10')},'dialAMDMinWordLength':{'type':Sequelize[_0x894b('0x4')](0x9)[_0x894b('0x5')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x894b('0x4')](0x9)[_0x894b('0x5')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x894b('0x5')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x894b('0x11')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x894b('0x4')](0x5)[_0x894b('0x5')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x894b('0x12')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x894b('0x4')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x894b('0x13')},'dialOrderByScheduledAt':{'type':Sequelize[_0x894b('0x1')](_0x894b('0x14'),'ASC'),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x894b('0x0')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x894b('0x5')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x894b('0x15')},'dialCutDigit':{'type':Sequelize[_0x894b('0x4')](0x3)[_0x894b('0x5')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x894b('0x16')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x894b('0x4')](0x3)[_0x894b('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x894b('0x17')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x894b('0x4')](0x5)[_0x894b('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x894b('0x18')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x894b('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x894b('0x19')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x894b('0x1a')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x894b('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x894b('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x894b('0x1b')},'dialMachineMaxRetry':{'type':Sequelize[_0x894b('0x4')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x894b('0x4')](0x5)[_0x894b('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x894b('0x1c')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x894b('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x894b('0x1d')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x894b('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index d227e86..75925fc 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 _0xd3d3=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','Campaign','includeAll','include','rows','catch','show','params','find','create','user','role','IvrCampaigns','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','findOne','CampaignId','CmHopper','getHopperHistories','CmHopperHistory','findAll','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','select','field','ContactId','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','NOW()','phone\x20IS\x20NOT\x20NULL','cm_hopper_additional_phones','cmHopperId','OrderBy','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','push','sequelize','all','getBlackLists','addBlackLists','YYYY-MM-DD\x20HH:mm:ss','cm_hopper_black','zip-dir','fast-json-patch','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x584b87,_0x3542b8){var _0x3e7b7e=function(_0xe8964d){while(--_0xe8964d){_0x584b87['push'](_0x584b87['shift']());}};_0x3e7b7e(++_0x3542b8);}(_0xd3d3,0x19a));var _0x3d3d=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0xd3d3[_0x474bc0];return _0x4b24cf;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3d3d('0x0'));var jsonpatch=require(_0x3d3d('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3d3d('0x2'));var util=require(_0x3d3d('0x3'));var path=require(_0x3d3d('0x4'));var sox=require('sox');var csv=require(_0x3d3d('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3d3d('0x6'));var _=require(_0x3d3d('0x7'));var squel=require(_0x3d3d('0x8'));var crypto=require(_0x3d3d('0x9'));var jsforce=require(_0x3d3d('0xa'));var deskjs=require(_0x3d3d('0xb'));var toCsv=require(_0x3d3d('0x5'));var querystring=require('querystring');var Papa=require(_0x3d3d('0xc'));var Redis=require(_0x3d3d('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x3d3d('0xe'));var as=require(_0x3d3d('0xf'));var hardwareService=require(_0x3d3d('0x10'));var logger=require(_0x3d3d('0x11'))(_0x3d3d('0x12'));var utils=require(_0x3d3d('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x3d3d('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1cb5f3,_0xe37fe6){_0xe37fe6=_0xe37fe6||0xcc;return function(_0x12cef1){if(_0x12cef1){return _0x1cb5f3['sendStatus'](_0xe37fe6);}return _0x1cb5f3[_0x3d3d('0x15')](_0xe37fe6)[_0x3d3d('0x16')]();};}function respondWithResult(_0x25305d,_0x553f92){_0x553f92=_0x553f92||0xc8;return function(_0x32ca75){if(_0x32ca75){return _0x25305d[_0x3d3d('0x15')](_0x553f92)[_0x3d3d('0x17')](_0x32ca75);}};}function respondWithFilteredResult(_0x16274f,_0xb02393){return function(_0x22bb7d){if(_0x22bb7d){var _0x3840b8=typeof _0xb02393['offset']===_0x3d3d('0x18')&&typeof _0xb02393[_0x3d3d('0x19')]===_0x3d3d('0x18');var _0x5a3bcd=_0x22bb7d[_0x3d3d('0x1a')];var _0x4658b9=_0x3840b8?0x0:_0xb02393[_0x3d3d('0x1b')];var _0x94eba2=_0x3840b8?_0x22bb7d[_0x3d3d('0x1a')]:_0xb02393[_0x3d3d('0x1b')]+_0xb02393[_0x3d3d('0x19')];var _0x4eff34;if(_0x94eba2>=_0x5a3bcd){_0x94eba2=_0x5a3bcd;_0x4eff34=0xc8;}else{_0x4eff34=0xce;}_0x16274f[_0x3d3d('0x15')](_0x4eff34);return _0x16274f['set'](_0x3d3d('0x1c'),_0x4658b9+'-'+_0x94eba2+'/'+_0x5a3bcd)[_0x3d3d('0x17')](_0x22bb7d);}return null;};}function patchUpdates(_0x5691d9){return function(_0x5ede83){try{jsonpatch[_0x3d3d('0x1d')](_0x5ede83,_0x5691d9,!![]);}catch(_0x2cafd4){return BPromise[_0x3d3d('0x1e')](_0x2cafd4);}return _0x5ede83[_0x3d3d('0x1f')]();};}function saveUpdates(_0x49685a,_0x4291cb){return function(_0xf88a7e){if(_0xf88a7e){return _0xf88a7e[_0x3d3d('0x20')](_0x49685a)['then'](function(_0x388900){return _0x388900;});}return null;};}function removeEntity(_0x288002,_0x1dbb69){return function(_0x557bab){if(_0x557bab){return _0x557bab['destroy']()[_0x3d3d('0x21')](function(){var _0x38cd63=_0x557bab[_0x3d3d('0x22')]({'plain':!![]});var _0x25854e='IvrCampaigns';return db[_0x3d3d('0x23')][_0x3d3d('0x24')]({'where':{'type':_0x25854e,'resourceId':_0x38cd63['id']}})[_0x3d3d('0x21')](function(){return _0x557bab;});})[_0x3d3d('0x21')](function(){_0x288002[_0x3d3d('0x15')](0xcc)[_0x3d3d('0x16')]();});}};}function handleEntityNotFound(_0x158504,_0x50fbad){return function(_0x49a2b7){if(!_0x49a2b7){_0x158504['sendStatus'](0x194);}return _0x49a2b7;};}function handleError(_0x566dd8,_0x5bf25b){_0x5bf25b=_0x5bf25b||0x1f4;return function(_0x51c8fb){logger[_0x3d3d('0x25')](_0x51c8fb[_0x3d3d('0x26')]);if(_0x51c8fb[_0x3d3d('0x27')]){delete _0x51c8fb[_0x3d3d('0x27')];}_0x566dd8[_0x3d3d('0x15')](_0x5bf25b)[_0x3d3d('0x28')](_0x51c8fb);};}exports[_0x3d3d('0x29')]=function(_0x5c1e3c,_0xecbe5b){var _0x20f7b8={},_0x421152={},_0x413e80={'count':0x0,'rows':[]};var _0x237815=_[_0x3d3d('0x2a')](db['Campaign'][_0x3d3d('0x2b')],function(_0x366414){return{'name':_0x366414[_0x3d3d('0x2c')],'type':_0x366414[_0x3d3d('0x2d')][_0x3d3d('0x2e')]};});_0x421152['model']=_['map'](_0x237815,_0x3d3d('0x27'));_0x421152[_0x3d3d('0x2f')]=_[_0x3d3d('0x30')](_0x5c1e3c[_0x3d3d('0x2f')]);_0x421152['filters']=_['intersection'](_0x421152[_0x3d3d('0x31')],_0x421152[_0x3d3d('0x2f')]);_0x20f7b8[_0x3d3d('0x32')]=_[_0x3d3d('0x33')](_0x421152[_0x3d3d('0x31')],qs[_0x3d3d('0x34')](_0x5c1e3c[_0x3d3d('0x2f')][_0x3d3d('0x34')]));_0x20f7b8[_0x3d3d('0x32')]=_0x20f7b8[_0x3d3d('0x32')][_0x3d3d('0x35')]?_0x20f7b8['attributes']:_0x421152[_0x3d3d('0x31')];if(!_0x5c1e3c[_0x3d3d('0x2f')][_0x3d3d('0x36')](_0x3d3d('0x37'))){_0x20f7b8[_0x3d3d('0x19')]=qs[_0x3d3d('0x19')](_0x5c1e3c[_0x3d3d('0x2f')][_0x3d3d('0x19')]);_0x20f7b8[_0x3d3d('0x1b')]=qs['offset'](_0x5c1e3c['query'][_0x3d3d('0x1b')]);}_0x20f7b8[_0x3d3d('0x38')]=qs['sort'](_0x5c1e3c[_0x3d3d('0x2f')][_0x3d3d('0x39')]);_0x20f7b8['where']=qs[_0x3d3d('0x3a')](_[_0x3d3d('0x3b')](_0x5c1e3c[_0x3d3d('0x2f')],_0x421152[_0x3d3d('0x3a')]),_0x237815);if(_0x5c1e3c['query'][_0x3d3d('0x3c')]){_0x20f7b8[_0x3d3d('0x3d')]=_[_0x3d3d('0x3e')](_0x20f7b8[_0x3d3d('0x3d')],{'$or':_[_0x3d3d('0x2a')](_0x237815,function(_0x54647b){if(_0x54647b[_0x3d3d('0x2d')]!==_0x3d3d('0x3f')){var _0x486fc4={};_0x486fc4[_0x54647b[_0x3d3d('0x27')]]={'$like':'%'+_0x5c1e3c[_0x3d3d('0x2f')][_0x3d3d('0x3c')]+'%'};return _0x486fc4;}})});}_0x20f7b8=_['merge']({},_0x20f7b8,_0x5c1e3c[_0x3d3d('0x40')]);var _0x49db65={'where':_0x20f7b8[_0x3d3d('0x3d')]};return db[_0x3d3d('0x41')]['count'](_0x49db65)[_0x3d3d('0x21')](function(_0x130686){_0x413e80[_0x3d3d('0x1a')]=_0x130686;if(_0x5c1e3c[_0x3d3d('0x2f')][_0x3d3d('0x42')]){_0x20f7b8[_0x3d3d('0x43')]=[{'all':!![]}];}return db['Campaign']['findAll'](_0x20f7b8);})['then'](function(_0xe5e1){_0x413e80[_0x3d3d('0x44')]=_0xe5e1;return _0x413e80;})[_0x3d3d('0x21')](respondWithFilteredResult(_0xecbe5b,_0x20f7b8))[_0x3d3d('0x45')](handleError(_0xecbe5b,null));};exports[_0x3d3d('0x46')]=function(_0x214357,_0x4fad9f){var _0x158b1d={'raw':![],'where':{'id':_0x214357[_0x3d3d('0x47')]['id']}},_0xde01a5={};_0xde01a5[_0x3d3d('0x31')]=_['keys'](db[_0x3d3d('0x41')]['rawAttributes']);_0xde01a5[_0x3d3d('0x2f')]=_[_0x3d3d('0x30')](_0x214357[_0x3d3d('0x2f')]);_0xde01a5[_0x3d3d('0x3a')]=_['intersection'](_0xde01a5[_0x3d3d('0x31')],_0xde01a5[_0x3d3d('0x2f')]);_0x158b1d['attributes']=_[_0x3d3d('0x33')](_0xde01a5['model'],qs['fields'](_0x214357['query'][_0x3d3d('0x34')]));_0x158b1d['attributes']=_0x158b1d[_0x3d3d('0x32')]['length']?_0x158b1d['attributes']:_0xde01a5['model'];if(_0x214357[_0x3d3d('0x2f')][_0x3d3d('0x42')]){_0x158b1d['include']=[{'all':!![]}];}_0x158b1d=_[_0x3d3d('0x3e')]({},_0x158b1d,_0x214357['options']);return db[_0x3d3d('0x41')][_0x3d3d('0x48')](_0x158b1d)[_0x3d3d('0x21')](handleEntityNotFound(_0x4fad9f,null))[_0x3d3d('0x21')](respondWithResult(_0x4fad9f,null))[_0x3d3d('0x45')](handleError(_0x4fad9f,null));};exports[_0x3d3d('0x49')]=function(_0x1825e8,_0x437782){return db[_0x3d3d('0x41')][_0x3d3d('0x49')](_0x1825e8['body'],{})[_0x3d3d('0x21')](function(_0x25f7a5){var _0x25d2f6=_0x1825e8[_0x3d3d('0x4a')][_0x3d3d('0x22')]({'plain':!![]});if(!_0x25d2f6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x25d2f6[_0x3d3d('0x4b')]===_0x3d3d('0x4a')){var _0xbad206=_0x25f7a5[_0x3d3d('0x22')]({'plain':!![]});var _0x1b22a9=_0x3d3d('0x4c');return db['UserProfileSection'][_0x3d3d('0x48')]({'where':{'name':_0x1b22a9,'userProfileId':_0x25d2f6['userProfileId']},'raw':!![]})[_0x3d3d('0x21')](function(_0x181c76){if(_0x181c76&&_0x181c76['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0xbad206[_0x3d3d('0x27')],'resourceId':_0xbad206['id'],'type':_0x181c76[_0x3d3d('0x27')],'sectionId':_0x181c76['id']},{})['then'](function(){return _0x25f7a5;});}else{return _0x25f7a5;}})['catch'](function(_0x1a0c6d){logger[_0x3d3d('0x25')](_0x3d3d('0x4d'),_0x1a0c6d);throw _0x1a0c6d;});}return _0x25f7a5;})[_0x3d3d('0x21')](respondWithResult(_0x437782,0xc9))[_0x3d3d('0x45')](handleError(_0x437782,null));};exports[_0x3d3d('0x4e')]=function(_0x346b0c,_0x1a98a1){var _0x50c0b1={'where':{'id':_0x346b0c[_0x3d3d('0x47')]['id']}},_0x24418d={};_0x24418d['model']=_[_0x3d3d('0x30')](db[_0x3d3d('0x41')][_0x3d3d('0x2b')]);_0x50c0b1[_0x3d3d('0x32')]=_['intersection'](_0x24418d['model'],qs['fields'](_0x346b0c['query'][_0x3d3d('0x34')]));_0x50c0b1['attributes']=_0x50c0b1[_0x3d3d('0x32')]['length']?_0x50c0b1[_0x3d3d('0x32')]:_0x24418d[_0x3d3d('0x31')];if(_0x346b0c[_0x3d3d('0x2f')][_0x3d3d('0x42')]){_0x50c0b1[_0x3d3d('0x43')]=[{'all':!![]}];}_0x50c0b1=_['merge']({},_0x50c0b1,_0x346b0c['options']);return db[_0x3d3d('0x41')][_0x3d3d('0x48')](_0x50c0b1)['then'](handleEntityNotFound(_0x1a98a1,null))[_0x3d3d('0x21')](function(_0x51be10){if(_0x51be10){var _0x419c4e=_0x51be10['get']({'plain':!![]});_0x419c4e=qs[_0x3d3d('0x4f')](_0x419c4e,['id',_0x3d3d('0x50'),_0x3d3d('0x51')]);_0x346b0c[_0x3d3d('0x52')]=_['omit'](_0x346b0c[_0x3d3d('0x52')],['id','createdAt',_0x3d3d('0x51')]);return db[_0x3d3d('0x41')]['create'](_[_0x3d3d('0x3e')](_0x419c4e,_0x346b0c[_0x3d3d('0x52')]),{'include':_0x346b0c[_0x3d3d('0x2f')][_0x3d3d('0x42')]?[{'all':!![]}]:undefined})['then'](function(_0x3c68fb){var _0x4d79ce=_0x346b0c[_0x3d3d('0x4a')][_0x3d3d('0x22')]({'plain':!![]});if(!_0x4d79ce)throw new Error(_0x3d3d('0x53'));if(_0x4d79ce[_0x3d3d('0x4b')]===_0x3d3d('0x4a')){var _0x5f0de4=_0x3c68fb['get']({'plain':!![]});var _0x130ee8=_0x3d3d('0x4c');return db['UserProfileSection'][_0x3d3d('0x48')]({'where':{'name':_0x130ee8,'userProfileId':_0x4d79ce[_0x3d3d('0x54')]},'raw':!![]})['then'](function(_0x46de23){if(_0x46de23&&_0x46de23['autoAssociation']===0x0){return db[_0x3d3d('0x23')][_0x3d3d('0x49')]({'name':_0x5f0de4['name'],'resourceId':_0x5f0de4['id'],'type':_0x46de23[_0x3d3d('0x27')],'sectionId':_0x46de23['id']},{})['then'](function(){return _0x3c68fb;});}else{return _0x3c68fb;}})['catch'](function(_0x4eb7da){logger[_0x3d3d('0x25')](_0x3d3d('0x4d'),_0x4eb7da);throw _0x4eb7da;});}return _0x3c68fb;});}})[_0x3d3d('0x21')](respondWithResult(_0x1a98a1,0xc9))[_0x3d3d('0x45')](handleError(_0x1a98a1,null));};exports[_0x3d3d('0x20')]=function(_0x4e7390,_0x57e663){if(_0x4e7390[_0x3d3d('0x52')]['id']){delete _0x4e7390[_0x3d3d('0x52')]['id'];}return db[_0x3d3d('0x41')][_0x3d3d('0x48')]({'where':{'id':_0x4e7390[_0x3d3d('0x47')]['id']}})['then'](handleEntityNotFound(_0x57e663,null))[_0x3d3d('0x21')](saveUpdates(_0x4e7390[_0x3d3d('0x52')],null))[_0x3d3d('0x21')](respondWithResult(_0x57e663,null))[_0x3d3d('0x45')](handleError(_0x57e663,null));};exports[_0x3d3d('0x24')]=function(_0x391c12,_0xbe69c4){return db[_0x3d3d('0x41')][_0x3d3d('0x48')]({'where':{'id':_0x391c12[_0x3d3d('0x47')]['id']}})[_0x3d3d('0x21')](handleEntityNotFound(_0xbe69c4,null))[_0x3d3d('0x21')](removeEntity(_0xbe69c4,null))['catch'](handleError(_0xbe69c4,null));};exports['getHoppers']=function(_0x45d1d4,_0x16e672,_0x5b5554){var _0x19dae8={'raw':!![],'where':{}};var _0x158b51={};var _0x3fdd24={'count':0x0,'rows':[]};return db[_0x3d3d('0x41')][_0x3d3d('0x55')]({'where':{'id':_0x45d1d4[_0x3d3d('0x47')]['id']}})[_0x3d3d('0x21')](handleEntityNotFound(_0x16e672,null))[_0x3d3d('0x21')](function(_0x2421a7){if(_0x2421a7){_0x158b51[_0x3d3d('0x31')]=_[_0x3d3d('0x30')](db['CmHopper'][_0x3d3d('0x2b')]);_0x158b51['query']=_[_0x3d3d('0x30')](_0x45d1d4[_0x3d3d('0x2f')]);_0x158b51[_0x3d3d('0x3a')]=_['intersection'](_0x158b51['model'],_0x158b51[_0x3d3d('0x2f')]);_0x19dae8['attributes']=_[_0x3d3d('0x33')](_0x158b51[_0x3d3d('0x31')],qs[_0x3d3d('0x34')](_0x45d1d4[_0x3d3d('0x2f')][_0x3d3d('0x34')]));_0x19dae8[_0x3d3d('0x32')]=_0x19dae8[_0x3d3d('0x32')][_0x3d3d('0x35')]?_0x19dae8['attributes']:_0x158b51['model'];if(!_0x45d1d4[_0x3d3d('0x2f')][_0x3d3d('0x36')](_0x3d3d('0x37'))){_0x19dae8[_0x3d3d('0x19')]=qs[_0x3d3d('0x19')](_0x45d1d4[_0x3d3d('0x2f')][_0x3d3d('0x19')]);_0x19dae8[_0x3d3d('0x1b')]=qs['offset'](_0x45d1d4[_0x3d3d('0x2f')]['offset']);}_0x19dae8[_0x3d3d('0x38')]=qs[_0x3d3d('0x39')](_0x45d1d4[_0x3d3d('0x2f')][_0x3d3d('0x39')]);_0x19dae8['where']=qs[_0x3d3d('0x3a')](_[_0x3d3d('0x3b')](_0x45d1d4['query'],_0x158b51[_0x3d3d('0x3a')]));_0x19dae8[_0x3d3d('0x3d')][_0x3d3d('0x56')]=_0x2421a7['id'];if(_0x45d1d4['query']['filter']){_0x19dae8[_0x3d3d('0x3d')]=_[_0x3d3d('0x3e')](_0x19dae8[_0x3d3d('0x3d')],{'$or':_[_0x3d3d('0x2a')](_0x19dae8[_0x3d3d('0x32')],function(_0x1417b5){var _0x30de4e={};_0x30de4e[_0x1417b5]={'$like':'%'+_0x45d1d4[_0x3d3d('0x2f')][_0x3d3d('0x3c')]+'%'};return _0x30de4e;})});}_0x19dae8=_['merge']({},_0x19dae8,_0x45d1d4['options']);return db[_0x3d3d('0x57')]['count']({'where':_0x19dae8['where']})[_0x3d3d('0x21')](function(_0x7d16f8){_0x3fdd24[_0x3d3d('0x1a')]=_0x7d16f8;if(_0x45d1d4[_0x3d3d('0x2f')]['includeAll']){_0x19dae8[_0x3d3d('0x43')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x19dae8);})[_0x3d3d('0x21')](function(_0x85ba84){_0x3fdd24[_0x3d3d('0x44')]=_0x85ba84;return _0x3fdd24;});}})[_0x3d3d('0x21')](respondWithFilteredResult(_0x16e672,_0x19dae8))[_0x3d3d('0x45')](handleError(_0x16e672,null));};exports[_0x3d3d('0x58')]=function(_0x6557b8,_0x1f78d8,_0x31124f){var _0x352b53={'raw':!![],'where':{}};var _0x221832={};var _0x46b342={'count':0x0,'rows':[]};return db[_0x3d3d('0x41')][_0x3d3d('0x55')]({'where':{'id':_0x6557b8[_0x3d3d('0x47')]['id']}})['then'](handleEntityNotFound(_0x1f78d8,null))[_0x3d3d('0x21')](function(_0x413607){if(_0x413607){_0x221832[_0x3d3d('0x31')]=_[_0x3d3d('0x30')](db['CmHopperHistory']['rawAttributes']);_0x221832[_0x3d3d('0x2f')]=_[_0x3d3d('0x30')](_0x6557b8[_0x3d3d('0x2f')]);_0x221832[_0x3d3d('0x3a')]=_[_0x3d3d('0x33')](_0x221832[_0x3d3d('0x31')],_0x221832[_0x3d3d('0x2f')]);_0x352b53[_0x3d3d('0x32')]=_[_0x3d3d('0x33')](_0x221832[_0x3d3d('0x31')],qs[_0x3d3d('0x34')](_0x6557b8[_0x3d3d('0x2f')][_0x3d3d('0x34')]));_0x352b53['attributes']=_0x352b53[_0x3d3d('0x32')]['length']?_0x352b53['attributes']:_0x221832[_0x3d3d('0x31')];if(!_0x6557b8[_0x3d3d('0x2f')][_0x3d3d('0x36')](_0x3d3d('0x37'))){_0x352b53[_0x3d3d('0x19')]=qs['limit'](_0x6557b8[_0x3d3d('0x2f')][_0x3d3d('0x19')]);_0x352b53['offset']=qs[_0x3d3d('0x1b')](_0x6557b8[_0x3d3d('0x2f')][_0x3d3d('0x1b')]);}_0x352b53[_0x3d3d('0x38')]=qs['sort'](_0x6557b8[_0x3d3d('0x2f')][_0x3d3d('0x39')]);_0x352b53['where']=qs['filters'](_[_0x3d3d('0x3b')](_0x6557b8[_0x3d3d('0x2f')],_0x221832[_0x3d3d('0x3a')]));_0x352b53[_0x3d3d('0x3d')][_0x3d3d('0x56')]=_0x413607['id'];if(_0x6557b8[_0x3d3d('0x2f')][_0x3d3d('0x3c')]){_0x352b53[_0x3d3d('0x3d')]=_[_0x3d3d('0x3e')](_0x352b53[_0x3d3d('0x3d')],{'$or':_[_0x3d3d('0x2a')](_0x352b53['attributes'],function(_0x1f7fa8){var _0x34fa27={};_0x34fa27[_0x1f7fa8]={'$like':'%'+_0x6557b8[_0x3d3d('0x2f')][_0x3d3d('0x3c')]+'%'};return _0x34fa27;})});}_0x352b53=_[_0x3d3d('0x3e')]({},_0x352b53,_0x6557b8[_0x3d3d('0x40')]);return db[_0x3d3d('0x59')][_0x3d3d('0x1a')]({'where':_0x352b53[_0x3d3d('0x3d')]})[_0x3d3d('0x21')](function(_0x22f909){_0x46b342[_0x3d3d('0x1a')]=_0x22f909;if(_0x6557b8['query'][_0x3d3d('0x42')]){_0x352b53[_0x3d3d('0x43')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x3d3d('0x5a')](_0x352b53);})[_0x3d3d('0x21')](function(_0x235d77){_0x46b342[_0x3d3d('0x44')]=_0x235d77;return _0x46b342;});}})[_0x3d3d('0x21')](respondWithFilteredResult(_0x1f78d8,_0x352b53))[_0x3d3d('0x45')](handleError(_0x1f78d8,null));};exports[_0x3d3d('0x5b')]=function(_0x574ac5,_0x219b4f,_0x5643f6){var _0x31aa86={'raw':!![],'where':{}};var _0x35c479={};var _0x1acccf={'count':0x0,'rows':[]};return db[_0x3d3d('0x41')][_0x3d3d('0x55')]({'where':{'id':_0x574ac5[_0x3d3d('0x47')]['id']}})['then'](handleEntityNotFound(_0x219b4f,null))[_0x3d3d('0x21')](function(_0x3682e5){if(_0x3682e5){_0x35c479[_0x3d3d('0x31')]=_[_0x3d3d('0x30')](db[_0x3d3d('0x5c')][_0x3d3d('0x2b')]);_0x35c479['query']=_['keys'](_0x574ac5['query']);_0x35c479[_0x3d3d('0x3a')]=_['intersection'](_0x35c479[_0x3d3d('0x31')],_0x35c479[_0x3d3d('0x2f')]);_0x31aa86[_0x3d3d('0x32')]=_[_0x3d3d('0x33')](_0x35c479[_0x3d3d('0x31')],qs['fields'](_0x574ac5[_0x3d3d('0x2f')]['fields']));_0x31aa86[_0x3d3d('0x32')]=_0x31aa86[_0x3d3d('0x32')][_0x3d3d('0x35')]?_0x31aa86['attributes']:_0x35c479[_0x3d3d('0x31')];if(!_0x574ac5[_0x3d3d('0x2f')][_0x3d3d('0x36')](_0x3d3d('0x37'))){_0x31aa86[_0x3d3d('0x19')]=qs[_0x3d3d('0x19')](_0x574ac5[_0x3d3d('0x2f')][_0x3d3d('0x19')]);_0x31aa86[_0x3d3d('0x1b')]=qs[_0x3d3d('0x1b')](_0x574ac5[_0x3d3d('0x2f')][_0x3d3d('0x1b')]);}_0x31aa86[_0x3d3d('0x38')]=qs[_0x3d3d('0x39')](_0x574ac5[_0x3d3d('0x2f')][_0x3d3d('0x39')]);_0x31aa86[_0x3d3d('0x3d')]=qs[_0x3d3d('0x3a')](_['pick'](_0x574ac5[_0x3d3d('0x2f')],_0x35c479['filters']));_0x31aa86[_0x3d3d('0x3d')][_0x3d3d('0x56')]=_0x3682e5['id'];if(_0x574ac5[_0x3d3d('0x2f')][_0x3d3d('0x3c')]){_0x31aa86[_0x3d3d('0x3d')]=_['merge'](_0x31aa86['where'],{'$or':_[_0x3d3d('0x2a')](_0x31aa86['attributes'],function(_0x1c6a86){var _0xbde49e={};_0xbde49e[_0x1c6a86]={'$like':'%'+_0x574ac5[_0x3d3d('0x2f')][_0x3d3d('0x3c')]+'%'};return _0xbde49e;})});}_0x31aa86=_[_0x3d3d('0x3e')]({},_0x31aa86,_0x574ac5[_0x3d3d('0x40')]);return db[_0x3d3d('0x5c')][_0x3d3d('0x1a')]({'where':_0x31aa86[_0x3d3d('0x3d')]})[_0x3d3d('0x21')](function(_0x5ecd08){_0x1acccf[_0x3d3d('0x1a')]=_0x5ecd08;if(_0x574ac5[_0x3d3d('0x2f')][_0x3d3d('0x42')]){_0x31aa86[_0x3d3d('0x43')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x3d3d('0x5a')](_0x31aa86);})['then'](function(_0x292bf5){_0x1acccf[_0x3d3d('0x44')]=_0x292bf5;return _0x1acccf;});}})[_0x3d3d('0x21')](respondWithFilteredResult(_0x219b4f,_0x31aa86))[_0x3d3d('0x45')](handleError(_0x219b4f,null));};exports[_0x3d3d('0x5d')]=function(_0x347df4,_0x34f11d,_0x412aa7){var _0xcf6326={'raw':!![],'where':{}};var _0x112a70={};var _0x36734f={'count':0x0,'rows':[]};return db[_0x3d3d('0x41')]['findOne']({'where':{'id':_0x347df4['params']['id']}})[_0x3d3d('0x21')](handleEntityNotFound(_0x34f11d,null))['then'](function(_0x9e7fca){if(_0x9e7fca){_0x112a70['model']=_[_0x3d3d('0x30')](db[_0x3d3d('0x5e')][_0x3d3d('0x2b')]);_0x112a70[_0x3d3d('0x2f')]=_[_0x3d3d('0x30')](_0x347df4[_0x3d3d('0x2f')]);_0x112a70[_0x3d3d('0x3a')]=_[_0x3d3d('0x33')](_0x112a70[_0x3d3d('0x31')],_0x112a70[_0x3d3d('0x2f')]);_0xcf6326[_0x3d3d('0x32')]=_[_0x3d3d('0x33')](_0x112a70['model'],qs['fields'](_0x347df4['query'][_0x3d3d('0x34')]));_0xcf6326[_0x3d3d('0x32')]=_0xcf6326['attributes'][_0x3d3d('0x35')]?_0xcf6326[_0x3d3d('0x32')]:_0x112a70['model'];if(!_0x347df4[_0x3d3d('0x2f')][_0x3d3d('0x36')](_0x3d3d('0x37'))){_0xcf6326[_0x3d3d('0x19')]=qs['limit'](_0x347df4['query'][_0x3d3d('0x19')]);_0xcf6326[_0x3d3d('0x1b')]=qs[_0x3d3d('0x1b')](_0x347df4[_0x3d3d('0x2f')][_0x3d3d('0x1b')]);}_0xcf6326['order']=qs[_0x3d3d('0x39')](_0x347df4['query'][_0x3d3d('0x39')]);_0xcf6326[_0x3d3d('0x3d')]=qs['filters'](_[_0x3d3d('0x3b')](_0x347df4[_0x3d3d('0x2f')],_0x112a70[_0x3d3d('0x3a')]));_0xcf6326[_0x3d3d('0x3d')]['CampaignId']=_0x9e7fca['id'];if(_0x347df4[_0x3d3d('0x2f')][_0x3d3d('0x3c')]){_0xcf6326[_0x3d3d('0x3d')]=_[_0x3d3d('0x3e')](_0xcf6326[_0x3d3d('0x3d')],{'$or':_[_0x3d3d('0x2a')](_0xcf6326[_0x3d3d('0x32')],function(_0x28210f){var _0xce2318={};_0xce2318[_0x28210f]={'$like':'%'+_0x347df4['query'][_0x3d3d('0x3c')]+'%'};return _0xce2318;})});}_0xcf6326=_[_0x3d3d('0x3e')]({},_0xcf6326,_0x347df4[_0x3d3d('0x40')]);return db[_0x3d3d('0x5e')]['count']({'where':_0xcf6326[_0x3d3d('0x3d')]})[_0x3d3d('0x21')](function(_0x5d962e){_0x36734f[_0x3d3d('0x1a')]=_0x5d962e;if(_0x347df4[_0x3d3d('0x2f')][_0x3d3d('0x42')]){_0xcf6326[_0x3d3d('0x43')]=[{'all':!![]}];}return db[_0x3d3d('0x5e')][_0x3d3d('0x5a')](_0xcf6326);})[_0x3d3d('0x21')](function(_0x5234a){_0x36734f[_0x3d3d('0x44')]=_0x5234a;return _0x36734f;});}})[_0x3d3d('0x21')](respondWithFilteredResult(_0x34f11d,_0xcf6326))['catch'](handleError(_0x34f11d,null));};exports[_0x3d3d('0x5f')]=function(_0x20a20f,_0x56e805,_0x3587f1){var _0x32eb44={};var _0x191ba1={};var _0x278afa;var _0x3fcfe8;return db[_0x3d3d('0x41')][_0x3d3d('0x55')]({'where':{'id':_0x20a20f[_0x3d3d('0x47')]['id']}})[_0x3d3d('0x21')](handleEntityNotFound(_0x56e805,null))[_0x3d3d('0x21')](function(_0x36a57c){if(_0x36a57c){_0x278afa=_0x36a57c;_0x191ba1['model']=_[_0x3d3d('0x30')](db[_0x3d3d('0x60')][_0x3d3d('0x2b')]);_0x191ba1[_0x3d3d('0x2f')]=_[_0x3d3d('0x30')](_0x20a20f[_0x3d3d('0x2f')]);_0x191ba1[_0x3d3d('0x3a')]=_[_0x3d3d('0x33')](_0x191ba1[_0x3d3d('0x31')],_0x191ba1[_0x3d3d('0x2f')]);_0x32eb44[_0x3d3d('0x32')]=_['intersection'](_0x191ba1[_0x3d3d('0x31')],qs['fields'](_0x20a20f[_0x3d3d('0x2f')][_0x3d3d('0x34')]));_0x32eb44[_0x3d3d('0x32')]=_0x32eb44[_0x3d3d('0x32')]['length']?_0x32eb44[_0x3d3d('0x32')]:_0x191ba1[_0x3d3d('0x31')];_0x32eb44[_0x3d3d('0x38')]=qs['sort'](_0x20a20f[_0x3d3d('0x2f')][_0x3d3d('0x39')]);_0x32eb44[_0x3d3d('0x3d')]=qs['filters'](_['pick'](_0x20a20f[_0x3d3d('0x2f')],_0x191ba1[_0x3d3d('0x3a')]));if(_0x20a20f[_0x3d3d('0x2f')][_0x3d3d('0x3c')]){_0x32eb44[_0x3d3d('0x3d')]=_['merge'](_0x32eb44['where'],{'$or':_[_0x3d3d('0x2a')](_0x32eb44['attributes'],function(_0x2f826f){var _0x1f7ff1={};_0x1f7ff1[_0x2f826f]={'$like':'%'+_0x20a20f['query'][_0x3d3d('0x3c')]+'%'};return _0x1f7ff1;})});}_0x32eb44=_[_0x3d3d('0x3e')]({},_0x32eb44,_0x20a20f[_0x3d3d('0x40')]);return _0x278afa[_0x3d3d('0x5f')](_0x32eb44);}})[_0x3d3d('0x21')](function(_0x5cea6d){if(_0x5cea6d){_0x3fcfe8=_0x5cea6d[_0x3d3d('0x35')];if(!_0x20a20f[_0x3d3d('0x2f')]['hasOwnProperty'](_0x3d3d('0x37'))){_0x32eb44[_0x3d3d('0x19')]=qs['limit'](_0x20a20f[_0x3d3d('0x2f')][_0x3d3d('0x19')]);_0x32eb44[_0x3d3d('0x1b')]=qs[_0x3d3d('0x1b')](_0x20a20f[_0x3d3d('0x2f')][_0x3d3d('0x1b')]);}return _0x278afa[_0x3d3d('0x5f')](_0x32eb44);}})[_0x3d3d('0x21')](function(_0x5091c5){if(_0x5091c5){return _0x5091c5?{'count':_0x3fcfe8,'rows':_0x5091c5}:null;}})[_0x3d3d('0x21')](respondWithResult(_0x56e805,null))[_0x3d3d('0x45')](handleError(_0x56e805,null));};exports[_0x3d3d('0x61')]=function(_0x4e5209,_0x47392e,_0x1ee1cd){var _0x4dd81a,_0x5ef8bb;var _0x10808a=[];var _0xf9473d=moment()[_0x3d3d('0x62')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x3d3d('0x41')][_0x3d3d('0x48')]({'where':{'id':_0x4e5209['params']['id']}})[_0x3d3d('0x21')](handleEntityNotFound(_0x47392e,null))['then'](function(_0x35ddb9){if(_0x35ddb9){_0x5ef8bb=_0x35ddb9;return _0x35ddb9[_0x3d3d('0x61')](_0x4e5209[_0x3d3d('0x52')][_0x3d3d('0x63')],_[_0x3d3d('0x4f')](_0x4e5209['body'],['ids','id'])||{});}return null;})[_0x3d3d('0x64')](function(_0xbb1bfa){var _0x4f880c;var _0x19a6cf;_0x4dd81a=_0xbb1bfa||[];var _0x12e6cc=[];if(_0xbb1bfa){for(var _0x4aeba1=0x0;_0x4aeba1<_0xbb1bfa['length'];_0x4aeba1+=0x1){var _0x51d50f=_0xbb1bfa[_0x4aeba1][_0x3d3d('0x22')]({'plain':!![]});_0x5ef8bb[_0x3d3d('0x65')]=_0x4e5209[_0x3d3d('0x52')][_0x3d3d('0x65')]?_0x4e5209[_0x3d3d('0x52')][_0x3d3d('0x65')]:_0x5ef8bb[_0x3d3d('0x65')];switch(_0x5ef8bb[_0x3d3d('0x65')]){case _0x3d3d('0x66'):_0x4f880c=squel[_0x3d3d('0x67')]()[_0x3d3d('0x68')](_0x3d3d('0x69'))[_0x3d3d('0x6a')]([_0x3d3d('0x6b'),_0x3d3d('0x6c'),'ContactId',_0x3d3d('0x6d'),_0x3d3d('0x56'),_0x3d3d('0x50'),'updatedAt'],squel[_0x3d3d('0x6e')]()[_0x3d3d('0x6f')](_0x3d3d('0x6b'),_0x3d3d('0x6b'))['field']('NOW()','scheduledAt')[_0x3d3d('0x6f')]('id',_0x3d3d('0x70'))['field'](_0x51d50f[_0x3d3d('0x71')]['toString'](),_0x3d3d('0x6d'))[_0x3d3d('0x6f')](_0x4e5209[_0x3d3d('0x47')]['id'][_0x3d3d('0x72')](),_0x3d3d('0x56'))[_0x3d3d('0x6f')]('\x27'+_0xf9473d+'\x27','createdAt')[_0x3d3d('0x6f')]('\x27'+_0xf9473d+'\x27',_0x3d3d('0x51'))[_0x3d3d('0x73')](_0x3d3d('0x74'))[_0x3d3d('0x3d')](_0x3d3d('0x75'))[_0x3d3d('0x3d')](_0x3d3d('0x76'),_0x51d50f[_0x3d3d('0x71')][_0x3d3d('0x72')]())[_0x3d3d('0x3d')]('phone\x20IS\x20NOT\x20NULL')[_0x3d3d('0x3d')]('phone\x20NOT\x20IN\x20(?)',squel[_0x3d3d('0x6e')]()[_0x3d3d('0x6f')](_0x3d3d('0x77'))[_0x3d3d('0x73')](_0x3d3d('0x78'))[_0x3d3d('0x3d')](_0x3d3d('0x79'),_0x4e5209[_0x3d3d('0x47')]['id']['toString']()))['where'](_0x3d3d('0x7a'),squel[_0x3d3d('0x6e')]()[_0x3d3d('0x6f')](_0x3d3d('0x7b'))[_0x3d3d('0x73')]('cm_hopper')[_0x3d3d('0x3d')]('CampaignId\x20=\x20?',_0x4e5209[_0x3d3d('0x47')]['id']['toString']())))[_0x3d3d('0x72')]();break;case _0x3d3d('0x7c'):_0x4f880c=squel['insert']()[_0x3d3d('0x68')]('cm_hopper')[_0x3d3d('0x6a')]([_0x3d3d('0x6b'),_0x3d3d('0x6c'),_0x3d3d('0x70'),'ListId','CampaignId',_0x3d3d('0x50'),_0x3d3d('0x51')],squel[_0x3d3d('0x6e')]()[_0x3d3d('0x6f')](_0x3d3d('0x6b'),_0x3d3d('0x6b'))[_0x3d3d('0x6f')](_0x3d3d('0x7d'),_0x3d3d('0x6c'))['field']('id',_0x3d3d('0x70'))[_0x3d3d('0x6f')](_0x51d50f[_0x3d3d('0x71')]['toString'](),_0x3d3d('0x6d'))[_0x3d3d('0x6f')](_0x4e5209[_0x3d3d('0x47')]['id']['toString'](),'CampaignId')[_0x3d3d('0x6f')]('\x27'+_0xf9473d+'\x27','createdAt')[_0x3d3d('0x6f')]('\x27'+_0xf9473d+'\x27',_0x3d3d('0x51'))[_0x3d3d('0x73')]('cm_contacts')[_0x3d3d('0x3d')]('deletedAt\x20IS\x20NULL')[_0x3d3d('0x3d')](_0x3d3d('0x76'),_0x51d50f[_0x3d3d('0x71')][_0x3d3d('0x72')]())[_0x3d3d('0x3d')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x3d3d('0x6e')]()[_0x3d3d('0x6f')](_0x3d3d('0x7b'))[_0x3d3d('0x73')](_0x3d3d('0x69'))['where']('CampaignId\x20=\x20?',_0x4e5209[_0x3d3d('0x47')]['id']['toString']())))[_0x3d3d('0x72')]();break;default:_0x4f880c=squel[_0x3d3d('0x67')]()[_0x3d3d('0x68')](_0x3d3d('0x69'))[_0x3d3d('0x6a')](['phone',_0x3d3d('0x6c'),_0x3d3d('0x70'),_0x3d3d('0x6d'),'CampaignId','createdAt','updatedAt'],squel[_0x3d3d('0x6e')]()[_0x3d3d('0x6f')]('phone',_0x3d3d('0x6b'))[_0x3d3d('0x6f')](_0x3d3d('0x7d'),_0x3d3d('0x6c'))[_0x3d3d('0x6f')]('id',_0x3d3d('0x70'))['field'](_0x51d50f['CmListId'][_0x3d3d('0x72')](),_0x3d3d('0x6d'))[_0x3d3d('0x6f')](_0x4e5209[_0x3d3d('0x47')]['id'][_0x3d3d('0x72')](),_0x3d3d('0x56'))[_0x3d3d('0x6f')]('\x27'+_0xf9473d+'\x27',_0x3d3d('0x50'))[_0x3d3d('0x6f')]('\x27'+_0xf9473d+'\x27','updatedAt')[_0x3d3d('0x73')]('cm_contacts')[_0x3d3d('0x3d')](_0x3d3d('0x75'))[_0x3d3d('0x3d')](_0x3d3d('0x76'),_0x51d50f[_0x3d3d('0x71')][_0x3d3d('0x72')]())[_0x3d3d('0x3d')](_0x3d3d('0x7e')))[_0x3d3d('0x72')]();}_0x19a6cf=squel[_0x3d3d('0x67')]()[_0x3d3d('0x68')](_0x3d3d('0x7f'))[_0x3d3d('0x6a')]([_0x3d3d('0x80'),_0x3d3d('0x6c'),_0x3d3d('0x6b'),_0x3d3d('0x81'),_0x3d3d('0x50'),'updatedAt'],squel[_0x3d3d('0x6e')]()[_0x3d3d('0x6f')]('h.id','id')[_0x3d3d('0x6f')](_0x3d3d('0x7d'),'scheduledAt')[_0x3d3d('0x6f')]('ci.item',_0x3d3d('0x6b'))[_0x3d3d('0x6f')](_0x3d3d('0x82'),_0x3d3d('0x81'))[_0x3d3d('0x6f')]('\x27'+_0xf9473d+'\x27',_0x3d3d('0x50'))['field']('\x27'+_0xf9473d+'\x27','updatedAt')[_0x3d3d('0x73')](_0x3d3d('0x83'),'ci')[_0x3d3d('0x84')](_0x3d3d('0x69'),'h',_0x3d3d('0x85'))[_0x3d3d('0x3d')](_0x3d3d('0x86'),_0x51d50f[_0x3d3d('0x71')][_0x3d3d('0x72')]())[_0x3d3d('0x3d')]('h.CampaignId=?',_0x4e5209[_0x3d3d('0x47')]['id']['toString']())[_0x3d3d('0x3d')]('h.createdAt\x20=\x20?',_0xf9473d))[_0x3d3d('0x72')]();_0x12e6cc[_0x3d3d('0x87')](db[_0x3d3d('0x88')]['query'](_0x4f880c));_0x10808a['push'](db['sequelize'][_0x3d3d('0x2f')](_0x19a6cf));}return BPromise[_0x3d3d('0x89')](_0x12e6cc);}})['then'](function(){return BPromise[_0x3d3d('0x89')](_0x10808a);})[_0x3d3d('0x21')](function(){return _0x4dd81a;})[_0x3d3d('0x21')](respondWithResult(_0x47392e,null))[_0x3d3d('0x45')](handleError(_0x47392e,null));};exports['removeLists']=function(_0xede95d,_0x3409f3,_0xa2a580){return db[_0x3d3d('0x41')][_0x3d3d('0x48')]({'where':{'id':_0xede95d[_0x3d3d('0x47')]['id']}})['then'](handleEntityNotFound(_0x3409f3,null))[_0x3d3d('0x21')](function(_0x32b787){if(_0x32b787){return _0x32b787['removeLists'](_0xede95d[_0x3d3d('0x2f')][_0x3d3d('0x63')]);}})[_0x3d3d('0x21')](function(_0x1c246e){if(_0x1c246e){return db[_0x3d3d('0x57')][_0x3d3d('0x24')]({'where':{'ListId':_0xede95d['query'][_0x3d3d('0x63')],'CampaignId':_0xede95d[_0x3d3d('0x47')]['id']}})[_0x3d3d('0x21')](function(){return _0x1c246e;});}})[_0x3d3d('0x21')](respondWithStatusCode(_0x3409f3,null))[_0x3d3d('0x45')](handleError(_0x3409f3,null));};exports[_0x3d3d('0x8a')]=function(_0x2ce4d5,_0x46f091,_0x1b14e0){var _0xb39e95={};var _0x63d492={};var _0x2a73e6;var _0x5b97e7;return db[_0x3d3d('0x41')][_0x3d3d('0x55')]({'where':{'id':_0x2ce4d5['params']['id']}})[_0x3d3d('0x21')](handleEntityNotFound(_0x46f091,null))[_0x3d3d('0x21')](function(_0x1cc399){if(_0x1cc399){_0x2a73e6=_0x1cc399;_0x63d492[_0x3d3d('0x31')]=_[_0x3d3d('0x30')](db['CmList'][_0x3d3d('0x2b')]);_0x63d492[_0x3d3d('0x2f')]=_['keys'](_0x2ce4d5[_0x3d3d('0x2f')]);_0x63d492[_0x3d3d('0x3a')]=_[_0x3d3d('0x33')](_0x63d492['model'],_0x63d492[_0x3d3d('0x2f')]);_0xb39e95['attributes']=_['intersection'](_0x63d492[_0x3d3d('0x31')],qs[_0x3d3d('0x34')](_0x2ce4d5['query'][_0x3d3d('0x34')]));_0xb39e95[_0x3d3d('0x32')]=_0xb39e95[_0x3d3d('0x32')][_0x3d3d('0x35')]?_0xb39e95[_0x3d3d('0x32')]:_0x63d492[_0x3d3d('0x31')];_0xb39e95[_0x3d3d('0x38')]=qs[_0x3d3d('0x39')](_0x2ce4d5[_0x3d3d('0x2f')][_0x3d3d('0x39')]);_0xb39e95[_0x3d3d('0x3d')]=qs[_0x3d3d('0x3a')](_[_0x3d3d('0x3b')](_0x2ce4d5[_0x3d3d('0x2f')],_0x63d492[_0x3d3d('0x3a')]));if(_0x2ce4d5[_0x3d3d('0x2f')]['filter']){_0xb39e95[_0x3d3d('0x3d')]=_[_0x3d3d('0x3e')](_0xb39e95[_0x3d3d('0x3d')],{'$or':_[_0x3d3d('0x2a')](_0xb39e95['attributes'],function(_0x5a45a0){var _0x448054={};_0x448054[_0x5a45a0]={'$like':'%'+_0x2ce4d5[_0x3d3d('0x2f')][_0x3d3d('0x3c')]+'%'};return _0x448054;})});}_0xb39e95=_['merge']({},_0xb39e95,_0x2ce4d5[_0x3d3d('0x40')]);return _0x2a73e6[_0x3d3d('0x8a')](_0xb39e95);}})['then'](function(_0x4eb054){if(_0x4eb054){_0x5b97e7=_0x4eb054[_0x3d3d('0x35')];if(!_0x2ce4d5[_0x3d3d('0x2f')][_0x3d3d('0x36')](_0x3d3d('0x37'))){_0xb39e95[_0x3d3d('0x19')]=qs[_0x3d3d('0x19')](_0x2ce4d5[_0x3d3d('0x2f')]['limit']);_0xb39e95[_0x3d3d('0x1b')]=qs['offset'](_0x2ce4d5[_0x3d3d('0x2f')]['offset']);}return _0x2a73e6[_0x3d3d('0x8a')](_0xb39e95);}})[_0x3d3d('0x21')](function(_0x86c019){if(_0x86c019){return _0x86c019?{'count':_0x5b97e7,'rows':_0x86c019}:null;}})['then'](respondWithResult(_0x46f091,null))[_0x3d3d('0x45')](handleError(_0x46f091,null));};exports[_0x3d3d('0x8b')]=function(_0x5a20f4,_0x5bc772,_0x5ee542){var _0x42e28e,_0x2aed8d;var _0xecc5d9=[];var _0x5d498f=moment()[_0x3d3d('0x62')](_0x3d3d('0x8c'));return db['Campaign'][_0x3d3d('0x48')]({'where':{'id':_0x5a20f4[_0x3d3d('0x47')]['id']}})[_0x3d3d('0x21')](handleEntityNotFound(_0x5bc772,null))[_0x3d3d('0x21')](function(_0x92bf6b){if(_0x92bf6b){_0x2aed8d=_0x92bf6b;return _0x92bf6b[_0x3d3d('0x8b')](_0x5a20f4[_0x3d3d('0x52')][_0x3d3d('0x63')],_[_0x3d3d('0x4f')](_0x5a20f4[_0x3d3d('0x52')],['ids','id'])||{});}return null;})['spread'](function(_0x4cf2e7){var _0x1e15b4;var _0xdbfc9e;_0x42e28e=_0x4cf2e7||[];var _0x19438f=[];if(_0x4cf2e7){for(var _0x574b5e=0x0;_0x574b5e<_0x4cf2e7['length'];_0x574b5e+=0x1){var _0x376459=_0x4cf2e7[_0x574b5e][_0x3d3d('0x22')]({'plain':!![]});_0x1e15b4=squel[_0x3d3d('0x67')]()[_0x3d3d('0x68')](_0x3d3d('0x8d'))[_0x3d3d('0x6a')]([_0x3d3d('0x6b'),_0x3d3d('0x70'),_0x3d3d('0x6d'),'CampaignId',_0x3d3d('0x50'),_0x3d3d('0x51')],squel[_0x3d3d('0x6e')]()[_0x3d3d('0x6f')](_0x3d3d('0x6b'),_0x3d3d('0x6b'))['field']('id',_0x3d3d('0x70'))[_0x3d3d('0x6f')](_0x376459['CmListId']['toString'](),_0x3d3d('0x6d'))[_0x3d3d('0x6f')](_0x5a20f4[_0x3d3d('0x47')]['id']['toString'](),_0x3d3d('0x56'))[_0x3d3d('0x6f')]('NOW()',_0x3d3d('0x50'))[_0x3d3d('0x6f')](_0x3d3d('0x7d'),_0x3d3d('0x51'))[_0x3d3d('0x73')](_0x3d3d('0x74'))[_0x3d3d('0x3d')](_0x3d3d('0x75'))['where']('ListId\x20=\x20?',_0x376459['CmListId']['toString']())[_0x3d3d('0x3d')](_0x3d3d('0x7e')))['toString']();_0x19438f[_0x3d3d('0x87')](db['sequelize'][_0x3d3d('0x2f')](_0x1e15b4));}return BPromise[_0x3d3d('0x89')](_0x19438f);}})['then'](function(){return _0x42e28e;})[_0x3d3d('0x21')](respondWithResult(_0x5bc772,null))[_0x3d3d('0x45')](handleError(_0x5bc772,null));};exports['removeBlackLists']=function(_0x5170a8,_0x1d3aa3,_0x7b8ed1){return db['Campaign']['find']({'where':{'id':_0x5170a8['params']['id']}})['then'](handleEntityNotFound(_0x1d3aa3,null))[_0x3d3d('0x21')](function(_0x7b66f6){if(_0x7b66f6){return _0x7b66f6['removeBlackLists'](_0x5170a8['query'][_0x3d3d('0x63')]);}})['then'](function(_0x323172){if(_0x323172){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x5170a8[_0x3d3d('0x2f')]['ids'],'CampaignId':_0x5170a8['params']['id']}})[_0x3d3d('0x21')](function(){return _0x323172;});}})[_0x3d3d('0x21')](respondWithStatusCode(_0x1d3aa3,null))[_0x3d3d('0x45')](handleError(_0x1d3aa3,null));}; \ No newline at end of file +var _0x6f33=['count','offset','Content-Range','apply','reject','update','destroy','get','IvrCampaigns','then','sendStatus','stack','send','index','map','Campaign','rawAttributes','fieldName','key','model','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','where','filters','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','userProfileId','autoAssociation','getHoppers','findOne','CmHopper','nolimit','sort','pick','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','ids','spread','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','insert','NOW()','COALESCE(phone,\x27\x27)','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','YYYY-MM-DD\x20HH:mm:ss','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','moment','bluebird','path','to-csv','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/environment','../../mysqldb','status','end','json','undefined','limit'];(function(_0x1ac77b,_0x1cbdac){var _0x5c0165=function(_0x22cb2a){while(--_0x22cb2a){_0x1ac77b['push'](_0x1ac77b['shift']());}};_0x5c0165(++_0x1cbdac);}(_0x6f33,0x7a));var _0x36f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f33[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x36f3('0x0'));var rimraf=require(_0x36f3('0x1'));var zipdir=require(_0x36f3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x36f3('0x3'));var BPromise=require(_0x36f3('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x36f3('0x5'));var sox=require('sox');var csv=require(_0x36f3('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x36f3('0x7'));var squel=require('squel');var crypto=require(_0x36f3('0x8'));var jsforce=require(_0x36f3('0x9'));var deskjs=require(_0x36f3('0xa'));var toCsv=require(_0x36f3('0x6'));var querystring=require('querystring');var Papa=require(_0x36f3('0xb'));var Redis=require(_0x36f3('0xc'));var authService=require(_0x36f3('0xd'));var qs=require(_0x36f3('0xe'));var as=require(_0x36f3('0xf'));var hardwareService=require(_0x36f3('0x10'));var logger=require(_0x36f3('0x11'))(_0x36f3('0x12'));var utils=require(_0x36f3('0x13'));var config=require(_0x36f3('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x36f3('0x15'))['db'];function respondWithStatusCode(_0x47740d,_0x4dda9e){_0x4dda9e=_0x4dda9e||0xcc;return function(_0x424a2f){if(_0x424a2f){return _0x47740d['sendStatus'](_0x4dda9e);}return _0x47740d[_0x36f3('0x16')](_0x4dda9e)[_0x36f3('0x17')]();};}function respondWithResult(_0x112a9d,_0x12eb9b){_0x12eb9b=_0x12eb9b||0xc8;return function(_0x9da06a){if(_0x9da06a){return _0x112a9d['status'](_0x12eb9b)[_0x36f3('0x18')](_0x9da06a);}};}function respondWithFilteredResult(_0x25d29a,_0x2b108e){return function(_0x126414){if(_0x126414){var _0x116c49=typeof _0x2b108e['offset']===_0x36f3('0x19')&&typeof _0x2b108e[_0x36f3('0x1a')]===_0x36f3('0x19');var _0x376216=_0x126414[_0x36f3('0x1b')];var _0x2cc9ea=_0x116c49?0x0:_0x2b108e['offset'];var _0x232fd3=_0x116c49?_0x126414[_0x36f3('0x1b')]:_0x2b108e[_0x36f3('0x1c')]+_0x2b108e[_0x36f3('0x1a')];var _0x3cf8a2;if(_0x232fd3>=_0x376216){_0x232fd3=_0x376216;_0x3cf8a2=0xc8;}else{_0x3cf8a2=0xce;}_0x25d29a['status'](_0x3cf8a2);return _0x25d29a['set'](_0x36f3('0x1d'),_0x2cc9ea+'-'+_0x232fd3+'/'+_0x376216)[_0x36f3('0x18')](_0x126414);}return null;};}function patchUpdates(_0x402dc8){return function(_0x1930f4){try{jsonpatch[_0x36f3('0x1e')](_0x1930f4,_0x402dc8,!![]);}catch(_0xbf3556){return BPromise[_0x36f3('0x1f')](_0xbf3556);}return _0x1930f4['save']();};}function saveUpdates(_0x54f131,_0x57d1c2){return function(_0x496d70){if(_0x496d70){return _0x496d70[_0x36f3('0x20')](_0x54f131)['then'](function(_0x2cb42c){return _0x2cb42c;});}return null;};}function removeEntity(_0x292143,_0x481d99){return function(_0x4c45eb){if(_0x4c45eb){return _0x4c45eb[_0x36f3('0x21')]()['then'](function(){var _0x256f53=_0x4c45eb[_0x36f3('0x22')]({'plain':!![]});var _0x165633=_0x36f3('0x23');return db['UserProfileResource'][_0x36f3('0x21')]({'where':{'type':_0x165633,'resourceId':_0x256f53['id']}})['then'](function(){return _0x4c45eb;});})[_0x36f3('0x24')](function(){_0x292143[_0x36f3('0x16')](0xcc)[_0x36f3('0x17')]();});}};}function handleEntityNotFound(_0x4ba389,_0x58036d){return function(_0x405e24){if(!_0x405e24){_0x4ba389[_0x36f3('0x25')](0x194);}return _0x405e24;};}function handleError(_0x1dd545,_0x145edf){_0x145edf=_0x145edf||0x1f4;return function(_0x188080){logger['error'](_0x188080[_0x36f3('0x26')]);if(_0x188080['name']){delete _0x188080['name'];}_0x1dd545[_0x36f3('0x16')](_0x145edf)[_0x36f3('0x27')](_0x188080);};}exports[_0x36f3('0x28')]=function(_0x276b7c,_0x1809b6){var _0x596497={},_0x89d37a={},_0x26b25e={'count':0x0,'rows':[]};var _0x43e167=_[_0x36f3('0x29')](db[_0x36f3('0x2a')][_0x36f3('0x2b')],function(_0x59e157){return{'name':_0x59e157[_0x36f3('0x2c')],'type':_0x59e157['type'][_0x36f3('0x2d')]};});_0x89d37a[_0x36f3('0x2e')]=_[_0x36f3('0x29')](_0x43e167,_0x36f3('0x2f'));_0x89d37a['query']=_[_0x36f3('0x30')](_0x276b7c[_0x36f3('0x31')]);_0x89d37a['filters']=_[_0x36f3('0x32')](_0x89d37a[_0x36f3('0x2e')],_0x89d37a[_0x36f3('0x31')]);_0x596497[_0x36f3('0x33')]=_[_0x36f3('0x32')](_0x89d37a[_0x36f3('0x2e')],qs[_0x36f3('0x34')](_0x276b7c[_0x36f3('0x31')][_0x36f3('0x34')]));_0x596497[_0x36f3('0x33')]=_0x596497[_0x36f3('0x33')][_0x36f3('0x35')]?_0x596497[_0x36f3('0x33')]:_0x89d37a[_0x36f3('0x2e')];if(!_0x276b7c[_0x36f3('0x31')][_0x36f3('0x36')]('nolimit')){_0x596497[_0x36f3('0x1a')]=qs['limit'](_0x276b7c[_0x36f3('0x31')][_0x36f3('0x1a')]);_0x596497[_0x36f3('0x1c')]=qs[_0x36f3('0x1c')](_0x276b7c[_0x36f3('0x31')][_0x36f3('0x1c')]);}_0x596497[_0x36f3('0x37')]=qs['sort'](_0x276b7c['query']['sort']);_0x596497[_0x36f3('0x38')]=qs[_0x36f3('0x39')](_['pick'](_0x276b7c[_0x36f3('0x31')],_0x89d37a[_0x36f3('0x39')]),_0x43e167);if(_0x276b7c[_0x36f3('0x31')]['filter']){_0x596497[_0x36f3('0x38')]=_['merge'](_0x596497[_0x36f3('0x38')],{'$or':_['map'](_0x43e167,function(_0x234f73){if(_0x234f73[_0x36f3('0x3a')]!==_0x36f3('0x3b')){var _0x51732b={};_0x51732b[_0x234f73[_0x36f3('0x2f')]]={'$like':'%'+_0x276b7c[_0x36f3('0x31')][_0x36f3('0x3c')]+'%'};return _0x51732b;}})});}_0x596497=_[_0x36f3('0x3d')]({},_0x596497,_0x276b7c[_0x36f3('0x3e')]);var _0x565c52={'where':_0x596497['where']};return db['Campaign'][_0x36f3('0x1b')](_0x565c52)[_0x36f3('0x24')](function(_0x1aabc0){_0x26b25e[_0x36f3('0x1b')]=_0x1aabc0;if(_0x276b7c['query'][_0x36f3('0x3f')]){_0x596497[_0x36f3('0x40')]=[{'all':!![]}];}return db[_0x36f3('0x2a')][_0x36f3('0x41')](_0x596497);})[_0x36f3('0x24')](function(_0xd63988){_0x26b25e[_0x36f3('0x42')]=_0xd63988;return _0x26b25e;})['then'](respondWithFilteredResult(_0x1809b6,_0x596497))['catch'](handleError(_0x1809b6,null));};exports['show']=function(_0x3f8011,_0x5721af){var _0x4255ff={'raw':![],'where':{'id':_0x3f8011[_0x36f3('0x43')]['id']}},_0x277b40={};_0x277b40['model']=_[_0x36f3('0x30')](db[_0x36f3('0x2a')][_0x36f3('0x2b')]);_0x277b40[_0x36f3('0x31')]=_[_0x36f3('0x30')](_0x3f8011[_0x36f3('0x31')]);_0x277b40[_0x36f3('0x39')]=_[_0x36f3('0x32')](_0x277b40[_0x36f3('0x2e')],_0x277b40[_0x36f3('0x31')]);_0x4255ff[_0x36f3('0x33')]=_[_0x36f3('0x32')](_0x277b40[_0x36f3('0x2e')],qs['fields'](_0x3f8011[_0x36f3('0x31')][_0x36f3('0x34')]));_0x4255ff[_0x36f3('0x33')]=_0x4255ff[_0x36f3('0x33')][_0x36f3('0x35')]?_0x4255ff[_0x36f3('0x33')]:_0x277b40[_0x36f3('0x2e')];if(_0x3f8011[_0x36f3('0x31')][_0x36f3('0x3f')]){_0x4255ff['include']=[{'all':!![]}];}_0x4255ff=_[_0x36f3('0x3d')]({},_0x4255ff,_0x3f8011[_0x36f3('0x3e')]);return db[_0x36f3('0x2a')][_0x36f3('0x44')](_0x4255ff)[_0x36f3('0x24')](handleEntityNotFound(_0x5721af,null))[_0x36f3('0x24')](respondWithResult(_0x5721af,null))[_0x36f3('0x45')](handleError(_0x5721af,null));};exports[_0x36f3('0x46')]=function(_0x2be4e0,_0x477cf6){return db[_0x36f3('0x2a')][_0x36f3('0x46')](_0x2be4e0[_0x36f3('0x47')],{})[_0x36f3('0x24')](function(_0x24e2c8){var _0x39dad3=_0x2be4e0[_0x36f3('0x48')][_0x36f3('0x22')]({'plain':!![]});if(!_0x39dad3)throw new Error(_0x36f3('0x49'));if(_0x39dad3['role']===_0x36f3('0x48')){var _0x6f3400=_0x24e2c8[_0x36f3('0x22')]({'plain':!![]});var _0x36960c=_0x36f3('0x23');return db['UserProfileSection'][_0x36f3('0x44')]({'where':{'name':_0x36960c,'userProfileId':_0x39dad3['userProfileId']},'raw':!![]})[_0x36f3('0x24')](function(_0x29d7ac){if(_0x29d7ac&&_0x29d7ac['autoAssociation']===0x0){return db[_0x36f3('0x4a')][_0x36f3('0x46')]({'name':_0x6f3400[_0x36f3('0x2f')],'resourceId':_0x6f3400['id'],'type':_0x29d7ac[_0x36f3('0x2f')],'sectionId':_0x29d7ac['id']},{})['then'](function(){return _0x24e2c8;});}else{return _0x24e2c8;}})[_0x36f3('0x45')](function(_0x167170){logger[_0x36f3('0x4b')](_0x36f3('0x4c'),_0x167170);throw _0x167170;});}return _0x24e2c8;})[_0x36f3('0x24')](respondWithResult(_0x477cf6,0xc9))[_0x36f3('0x45')](handleError(_0x477cf6,null));};exports[_0x36f3('0x4d')]=function(_0x425bc3,_0x2c9fc4){var _0x58c0ec={'where':{'id':_0x425bc3[_0x36f3('0x43')]['id']}},_0x385acd={};_0x385acd[_0x36f3('0x2e')]=_[_0x36f3('0x30')](db[_0x36f3('0x2a')][_0x36f3('0x2b')]);_0x58c0ec[_0x36f3('0x33')]=_[_0x36f3('0x32')](_0x385acd[_0x36f3('0x2e')],qs[_0x36f3('0x34')](_0x425bc3['query'][_0x36f3('0x34')]));_0x58c0ec['attributes']=_0x58c0ec[_0x36f3('0x33')][_0x36f3('0x35')]?_0x58c0ec[_0x36f3('0x33')]:_0x385acd['model'];if(_0x425bc3[_0x36f3('0x31')][_0x36f3('0x3f')]){_0x58c0ec[_0x36f3('0x40')]=[{'all':!![]}];}_0x58c0ec=_[_0x36f3('0x3d')]({},_0x58c0ec,_0x425bc3[_0x36f3('0x3e')]);return db['Campaign'][_0x36f3('0x44')](_0x58c0ec)['then'](handleEntityNotFound(_0x2c9fc4,null))[_0x36f3('0x24')](function(_0x3b14d6){if(_0x3b14d6){var _0x543f50=_0x3b14d6[_0x36f3('0x22')]({'plain':!![]});_0x543f50=qs[_0x36f3('0x4e')](_0x543f50,['id',_0x36f3('0x4f'),_0x36f3('0x50')]);_0x425bc3[_0x36f3('0x47')]=_[_0x36f3('0x4e')](_0x425bc3['body'],['id',_0x36f3('0x4f'),_0x36f3('0x50')]);return db[_0x36f3('0x2a')][_0x36f3('0x46')](_[_0x36f3('0x3d')](_0x543f50,_0x425bc3['body']),{'include':_0x425bc3[_0x36f3('0x31')][_0x36f3('0x3f')]?[{'all':!![]}]:undefined})['then'](function(_0xa51b26){var _0x49b0fe=_0x425bc3['user'][_0x36f3('0x22')]({'plain':!![]});if(!_0x49b0fe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x49b0fe[_0x36f3('0x51')]==='user'){var _0x5b2e50=_0xa51b26[_0x36f3('0x22')]({'plain':!![]});var _0x35303e=_0x36f3('0x23');return db['UserProfileSection'][_0x36f3('0x44')]({'where':{'name':_0x35303e,'userProfileId':_0x49b0fe[_0x36f3('0x52')]},'raw':!![]})[_0x36f3('0x24')](function(_0x42e06e){if(_0x42e06e&&_0x42e06e[_0x36f3('0x53')]===0x0){return db[_0x36f3('0x4a')]['create']({'name':_0x5b2e50[_0x36f3('0x2f')],'resourceId':_0x5b2e50['id'],'type':_0x42e06e[_0x36f3('0x2f')],'sectionId':_0x42e06e['id']},{})[_0x36f3('0x24')](function(){return _0xa51b26;});}else{return _0xa51b26;}})[_0x36f3('0x45')](function(_0x19bc69){logger['error'](_0x36f3('0x4c'),_0x19bc69);throw _0x19bc69;});}return _0xa51b26;});}})[_0x36f3('0x24')](respondWithResult(_0x2c9fc4,0xc9))[_0x36f3('0x45')](handleError(_0x2c9fc4,null));};exports[_0x36f3('0x20')]=function(_0x941d43,_0x5d0b0e){if(_0x941d43[_0x36f3('0x47')]['id']){delete _0x941d43['body']['id'];}return db['Campaign'][_0x36f3('0x44')]({'where':{'id':_0x941d43[_0x36f3('0x43')]['id']}})['then'](handleEntityNotFound(_0x5d0b0e,null))[_0x36f3('0x24')](saveUpdates(_0x941d43[_0x36f3('0x47')],null))[_0x36f3('0x24')](respondWithResult(_0x5d0b0e,null))['catch'](handleError(_0x5d0b0e,null));};exports[_0x36f3('0x21')]=function(_0x2ec6c2,_0x241835){return db['Campaign']['find']({'where':{'id':_0x2ec6c2[_0x36f3('0x43')]['id']}})[_0x36f3('0x24')](handleEntityNotFound(_0x241835,null))[_0x36f3('0x24')](removeEntity(_0x241835,null))[_0x36f3('0x45')](handleError(_0x241835,null));};exports[_0x36f3('0x54')]=function(_0x33cc89,_0x34be3b,_0x4be9a5){var _0x174ae6={'raw':!![],'where':{}};var _0x4560e3={};var _0x5bc385={'count':0x0,'rows':[]};return db[_0x36f3('0x2a')][_0x36f3('0x55')]({'where':{'id':_0x33cc89[_0x36f3('0x43')]['id']}})[_0x36f3('0x24')](handleEntityNotFound(_0x34be3b,null))[_0x36f3('0x24')](function(_0x317add){if(_0x317add){_0x4560e3[_0x36f3('0x2e')]=_['keys'](db[_0x36f3('0x56')][_0x36f3('0x2b')]);_0x4560e3['query']=_[_0x36f3('0x30')](_0x33cc89[_0x36f3('0x31')]);_0x4560e3[_0x36f3('0x39')]=_[_0x36f3('0x32')](_0x4560e3[_0x36f3('0x2e')],_0x4560e3[_0x36f3('0x31')]);_0x174ae6[_0x36f3('0x33')]=_[_0x36f3('0x32')](_0x4560e3['model'],qs['fields'](_0x33cc89['query']['fields']));_0x174ae6[_0x36f3('0x33')]=_0x174ae6[_0x36f3('0x33')][_0x36f3('0x35')]?_0x174ae6[_0x36f3('0x33')]:_0x4560e3[_0x36f3('0x2e')];if(!_0x33cc89[_0x36f3('0x31')][_0x36f3('0x36')](_0x36f3('0x57'))){_0x174ae6[_0x36f3('0x1a')]=qs['limit'](_0x33cc89[_0x36f3('0x31')][_0x36f3('0x1a')]);_0x174ae6['offset']=qs[_0x36f3('0x1c')](_0x33cc89[_0x36f3('0x31')][_0x36f3('0x1c')]);}_0x174ae6[_0x36f3('0x37')]=qs['sort'](_0x33cc89[_0x36f3('0x31')][_0x36f3('0x58')]);_0x174ae6['where']=qs['filters'](_[_0x36f3('0x59')](_0x33cc89[_0x36f3('0x31')],_0x4560e3[_0x36f3('0x39')]));_0x174ae6[_0x36f3('0x38')][_0x36f3('0x5a')]=_0x317add['id'];if(_0x33cc89[_0x36f3('0x31')][_0x36f3('0x3c')]){_0x174ae6[_0x36f3('0x38')]=_[_0x36f3('0x3d')](_0x174ae6[_0x36f3('0x38')],{'$or':_[_0x36f3('0x29')](_0x174ae6['attributes'],function(_0x4a6ea8){var _0x36d33c={};_0x36d33c[_0x4a6ea8]={'$like':'%'+_0x33cc89[_0x36f3('0x31')][_0x36f3('0x3c')]+'%'};return _0x36d33c;})});}_0x174ae6=_[_0x36f3('0x3d')]({},_0x174ae6,_0x33cc89[_0x36f3('0x3e')]);return db[_0x36f3('0x56')][_0x36f3('0x1b')]({'where':_0x174ae6[_0x36f3('0x38')]})[_0x36f3('0x24')](function(_0x4d0f72){_0x5bc385['count']=_0x4d0f72;if(_0x33cc89[_0x36f3('0x31')][_0x36f3('0x3f')]){_0x174ae6['include']=[{'all':!![]}];}return db[_0x36f3('0x56')][_0x36f3('0x41')](_0x174ae6);})['then'](function(_0x3dfbdc){_0x5bc385[_0x36f3('0x42')]=_0x3dfbdc;return _0x5bc385;});}})[_0x36f3('0x24')](respondWithFilteredResult(_0x34be3b,_0x174ae6))[_0x36f3('0x45')](handleError(_0x34be3b,null));};exports[_0x36f3('0x5b')]=function(_0x39fabe,_0x1b8f5e,_0x8ef369){var _0x1474f5={'raw':!![],'where':{}};var _0x503b6d={};var _0x17fe21={'count':0x0,'rows':[]};return db['Campaign'][_0x36f3('0x55')]({'where':{'id':_0x39fabe['params']['id']}})[_0x36f3('0x24')](handleEntityNotFound(_0x1b8f5e,null))[_0x36f3('0x24')](function(_0x4694be){if(_0x4694be){_0x503b6d[_0x36f3('0x2e')]=_['keys'](db[_0x36f3('0x5c')][_0x36f3('0x2b')]);_0x503b6d[_0x36f3('0x31')]=_[_0x36f3('0x30')](_0x39fabe[_0x36f3('0x31')]);_0x503b6d[_0x36f3('0x39')]=_['intersection'](_0x503b6d[_0x36f3('0x2e')],_0x503b6d[_0x36f3('0x31')]);_0x1474f5['attributes']=_[_0x36f3('0x32')](_0x503b6d[_0x36f3('0x2e')],qs[_0x36f3('0x34')](_0x39fabe[_0x36f3('0x31')]['fields']));_0x1474f5['attributes']=_0x1474f5[_0x36f3('0x33')]['length']?_0x1474f5[_0x36f3('0x33')]:_0x503b6d[_0x36f3('0x2e')];if(!_0x39fabe['query'][_0x36f3('0x36')](_0x36f3('0x57'))){_0x1474f5[_0x36f3('0x1a')]=qs[_0x36f3('0x1a')](_0x39fabe[_0x36f3('0x31')][_0x36f3('0x1a')]);_0x1474f5[_0x36f3('0x1c')]=qs[_0x36f3('0x1c')](_0x39fabe[_0x36f3('0x31')][_0x36f3('0x1c')]);}_0x1474f5[_0x36f3('0x37')]=qs[_0x36f3('0x58')](_0x39fabe[_0x36f3('0x31')][_0x36f3('0x58')]);_0x1474f5[_0x36f3('0x38')]=qs['filters'](_[_0x36f3('0x59')](_0x39fabe[_0x36f3('0x31')],_0x503b6d[_0x36f3('0x39')]));_0x1474f5[_0x36f3('0x38')][_0x36f3('0x5a')]=_0x4694be['id'];if(_0x39fabe[_0x36f3('0x31')]['filter']){_0x1474f5['where']=_['merge'](_0x1474f5[_0x36f3('0x38')],{'$or':_[_0x36f3('0x29')](_0x1474f5[_0x36f3('0x33')],function(_0x36fd5b){var _0x5d23d3={};_0x5d23d3[_0x36fd5b]={'$like':'%'+_0x39fabe['query'][_0x36f3('0x3c')]+'%'};return _0x5d23d3;})});}_0x1474f5=_[_0x36f3('0x3d')]({},_0x1474f5,_0x39fabe[_0x36f3('0x3e')]);return db[_0x36f3('0x5c')][_0x36f3('0x1b')]({'where':_0x1474f5['where']})['then'](function(_0x4f45c9){_0x17fe21[_0x36f3('0x1b')]=_0x4f45c9;if(_0x39fabe[_0x36f3('0x31')][_0x36f3('0x3f')]){_0x1474f5[_0x36f3('0x40')]=[{'all':!![]}];}return db[_0x36f3('0x5c')][_0x36f3('0x41')](_0x1474f5);})[_0x36f3('0x24')](function(_0x46e556){_0x17fe21[_0x36f3('0x42')]=_0x46e556;return _0x17fe21;});}})[_0x36f3('0x24')](respondWithFilteredResult(_0x1b8f5e,_0x1474f5))[_0x36f3('0x45')](handleError(_0x1b8f5e,null));};exports[_0x36f3('0x5d')]=function(_0x55d724,_0x5c255e,_0x5a44bd){var _0x39a41e={'raw':!![],'where':{}};var _0x2fcdae={};var _0x24ff28={'count':0x0,'rows':[]};return db[_0x36f3('0x2a')]['findOne']({'where':{'id':_0x55d724[_0x36f3('0x43')]['id']}})['then'](handleEntityNotFound(_0x5c255e,null))['then'](function(_0x40bc98){if(_0x40bc98){_0x2fcdae[_0x36f3('0x2e')]=_[_0x36f3('0x30')](db['CmHopperFinal'][_0x36f3('0x2b')]);_0x2fcdae[_0x36f3('0x31')]=_[_0x36f3('0x30')](_0x55d724[_0x36f3('0x31')]);_0x2fcdae['filters']=_[_0x36f3('0x32')](_0x2fcdae[_0x36f3('0x2e')],_0x2fcdae[_0x36f3('0x31')]);_0x39a41e[_0x36f3('0x33')]=_[_0x36f3('0x32')](_0x2fcdae[_0x36f3('0x2e')],qs[_0x36f3('0x34')](_0x55d724[_0x36f3('0x31')][_0x36f3('0x34')]));_0x39a41e[_0x36f3('0x33')]=_0x39a41e['attributes']['length']?_0x39a41e['attributes']:_0x2fcdae['model'];if(!_0x55d724[_0x36f3('0x31')][_0x36f3('0x36')](_0x36f3('0x57'))){_0x39a41e[_0x36f3('0x1a')]=qs[_0x36f3('0x1a')](_0x55d724[_0x36f3('0x31')][_0x36f3('0x1a')]);_0x39a41e[_0x36f3('0x1c')]=qs[_0x36f3('0x1c')](_0x55d724[_0x36f3('0x31')]['offset']);}_0x39a41e[_0x36f3('0x37')]=qs[_0x36f3('0x58')](_0x55d724['query']['sort']);_0x39a41e[_0x36f3('0x38')]=qs[_0x36f3('0x39')](_[_0x36f3('0x59')](_0x55d724[_0x36f3('0x31')],_0x2fcdae['filters']));_0x39a41e[_0x36f3('0x38')]['CampaignId']=_0x40bc98['id'];if(_0x55d724[_0x36f3('0x31')]['filter']){_0x39a41e[_0x36f3('0x38')]=_['merge'](_0x39a41e[_0x36f3('0x38')],{'$or':_[_0x36f3('0x29')](_0x39a41e[_0x36f3('0x33')],function(_0x54e90a){var _0x3f3fe7={};_0x3f3fe7[_0x54e90a]={'$like':'%'+_0x55d724[_0x36f3('0x31')]['filter']+'%'};return _0x3f3fe7;})});}_0x39a41e=_[_0x36f3('0x3d')]({},_0x39a41e,_0x55d724[_0x36f3('0x3e')]);return db[_0x36f3('0x5e')][_0x36f3('0x1b')]({'where':_0x39a41e[_0x36f3('0x38')]})[_0x36f3('0x24')](function(_0x2c819a){_0x24ff28[_0x36f3('0x1b')]=_0x2c819a;if(_0x55d724[_0x36f3('0x31')][_0x36f3('0x3f')]){_0x39a41e[_0x36f3('0x40')]=[{'all':!![]}];}return db[_0x36f3('0x5e')]['findAll'](_0x39a41e);})[_0x36f3('0x24')](function(_0x49e7d3){_0x24ff28[_0x36f3('0x42')]=_0x49e7d3;return _0x24ff28;});}})[_0x36f3('0x24')](respondWithFilteredResult(_0x5c255e,_0x39a41e))[_0x36f3('0x45')](handleError(_0x5c255e,null));};exports[_0x36f3('0x5f')]=function(_0x4b3574,_0x517773,_0x2d8f99){var _0x2c5690={'raw':!![],'where':{}};var _0x81dad4={};var _0x1dd6fd={'count':0x0,'rows':[]};return db[_0x36f3('0x2a')][_0x36f3('0x55')]({'where':{'id':_0x4b3574[_0x36f3('0x43')]['id']}})[_0x36f3('0x24')](handleEntityNotFound(_0x517773,null))[_0x36f3('0x24')](function(_0x235ecb){if(_0x235ecb){_0x81dad4[_0x36f3('0x2e')]=_['keys'](db['CmHopperBlack'][_0x36f3('0x2b')]);_0x81dad4[_0x36f3('0x31')]=_[_0x36f3('0x30')](_0x4b3574['query']);_0x81dad4[_0x36f3('0x39')]=_[_0x36f3('0x32')](_0x81dad4['model'],_0x81dad4[_0x36f3('0x31')]);_0x2c5690['attributes']=_[_0x36f3('0x32')](_0x81dad4[_0x36f3('0x2e')],qs[_0x36f3('0x34')](_0x4b3574[_0x36f3('0x31')][_0x36f3('0x34')]));_0x2c5690[_0x36f3('0x33')]=_0x2c5690[_0x36f3('0x33')]['length']?_0x2c5690[_0x36f3('0x33')]:_0x81dad4['model'];if(!_0x4b3574[_0x36f3('0x31')][_0x36f3('0x36')](_0x36f3('0x57'))){_0x2c5690[_0x36f3('0x1a')]=qs[_0x36f3('0x1a')](_0x4b3574[_0x36f3('0x31')][_0x36f3('0x1a')]);_0x2c5690[_0x36f3('0x1c')]=qs['offset'](_0x4b3574[_0x36f3('0x31')][_0x36f3('0x1c')]);}_0x2c5690[_0x36f3('0x37')]=qs[_0x36f3('0x58')](_0x4b3574[_0x36f3('0x31')]['sort']);_0x2c5690[_0x36f3('0x38')]=qs[_0x36f3('0x39')](_[_0x36f3('0x59')](_0x4b3574[_0x36f3('0x31')],_0x81dad4[_0x36f3('0x39')]));_0x2c5690[_0x36f3('0x38')][_0x36f3('0x5a')]=_0x235ecb['id'];if(_0x4b3574[_0x36f3('0x31')][_0x36f3('0x3c')]){_0x2c5690['where']=_[_0x36f3('0x3d')](_0x2c5690[_0x36f3('0x38')],{'$or':_[_0x36f3('0x29')](_0x2c5690[_0x36f3('0x33')],function(_0x36e606){var _0x5e88ce={};_0x5e88ce[_0x36e606]={'$like':'%'+_0x4b3574['query'][_0x36f3('0x3c')]+'%'};return _0x5e88ce;})});}_0x2c5690=_[_0x36f3('0x3d')]({},_0x2c5690,_0x4b3574[_0x36f3('0x3e')]);return db[_0x36f3('0x60')]['count']({'where':_0x2c5690['where']})['then'](function(_0x3ff4c6){_0x1dd6fd[_0x36f3('0x1b')]=_0x3ff4c6;if(_0x4b3574[_0x36f3('0x31')][_0x36f3('0x3f')]){_0x2c5690[_0x36f3('0x40')]=[{'all':!![]}];}return db[_0x36f3('0x60')][_0x36f3('0x41')](_0x2c5690);})[_0x36f3('0x24')](function(_0x3ea5d8){_0x1dd6fd['rows']=_0x3ea5d8;return _0x1dd6fd;});}})[_0x36f3('0x24')](respondWithFilteredResult(_0x517773,_0x2c5690))[_0x36f3('0x45')](handleError(_0x517773,null));};exports[_0x36f3('0x61')]=function(_0x3a5b6b,_0x484f8f,_0x4bc023){var _0x57b113={};var _0x6561e0={};var _0x23f36a;var _0x6d9551;return db[_0x36f3('0x2a')][_0x36f3('0x55')]({'where':{'id':_0x3a5b6b[_0x36f3('0x43')]['id']}})['then'](handleEntityNotFound(_0x484f8f,null))[_0x36f3('0x24')](function(_0x4af77b){if(_0x4af77b){_0x23f36a=_0x4af77b;_0x6561e0[_0x36f3('0x2e')]=_[_0x36f3('0x30')](db[_0x36f3('0x62')][_0x36f3('0x2b')]);_0x6561e0[_0x36f3('0x31')]=_[_0x36f3('0x30')](_0x3a5b6b[_0x36f3('0x31')]);_0x6561e0['filters']=_[_0x36f3('0x32')](_0x6561e0[_0x36f3('0x2e')],_0x6561e0[_0x36f3('0x31')]);_0x57b113[_0x36f3('0x33')]=_['intersection'](_0x6561e0[_0x36f3('0x2e')],qs['fields'](_0x3a5b6b[_0x36f3('0x31')][_0x36f3('0x34')]));_0x57b113['attributes']=_0x57b113['attributes'][_0x36f3('0x35')]?_0x57b113[_0x36f3('0x33')]:_0x6561e0[_0x36f3('0x2e')];_0x57b113['order']=qs['sort'](_0x3a5b6b[_0x36f3('0x31')][_0x36f3('0x58')]);_0x57b113[_0x36f3('0x38')]=qs[_0x36f3('0x39')](_[_0x36f3('0x59')](_0x3a5b6b[_0x36f3('0x31')],_0x6561e0[_0x36f3('0x39')]));if(_0x3a5b6b[_0x36f3('0x31')][_0x36f3('0x3c')]){_0x57b113['where']=_[_0x36f3('0x3d')](_0x57b113[_0x36f3('0x38')],{'$or':_[_0x36f3('0x29')](_0x57b113[_0x36f3('0x33')],function(_0x146f03){var _0x3a3704={};_0x3a3704[_0x146f03]={'$like':'%'+_0x3a5b6b[_0x36f3('0x31')]['filter']+'%'};return _0x3a3704;})});}_0x57b113=_[_0x36f3('0x3d')]({},_0x57b113,_0x3a5b6b[_0x36f3('0x3e')]);return _0x23f36a[_0x36f3('0x61')](_0x57b113);}})[_0x36f3('0x24')](function(_0xedb9e4){if(_0xedb9e4){_0x6d9551=_0xedb9e4[_0x36f3('0x35')];if(!_0x3a5b6b['query']['hasOwnProperty'](_0x36f3('0x57'))){_0x57b113[_0x36f3('0x1a')]=qs['limit'](_0x3a5b6b[_0x36f3('0x31')][_0x36f3('0x1a')]);_0x57b113[_0x36f3('0x1c')]=qs[_0x36f3('0x1c')](_0x3a5b6b['query'][_0x36f3('0x1c')]);}return _0x23f36a[_0x36f3('0x61')](_0x57b113);}})[_0x36f3('0x24')](function(_0x1197bd){if(_0x1197bd){return _0x1197bd?{'count':_0x6d9551,'rows':_0x1197bd}:null;}})['then'](respondWithResult(_0x484f8f,null))[_0x36f3('0x45')](handleError(_0x484f8f,null));};exports[_0x36f3('0x63')]=function(_0x4954ad,_0x473210,_0x44f758){var _0x46c91b,_0x51e520;var _0xc2a3af=[];var _0x2b1ede=moment()[_0x36f3('0x64')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x36f3('0x2a')][_0x36f3('0x44')]({'where':{'id':_0x4954ad[_0x36f3('0x43')]['id']}})[_0x36f3('0x24')](handleEntityNotFound(_0x473210,null))[_0x36f3('0x24')](function(_0x44f7bf){if(_0x44f7bf){_0x51e520=_0x44f7bf;return _0x44f7bf['addLists'](_0x4954ad['body'][_0x36f3('0x65')],_[_0x36f3('0x4e')](_0x4954ad[_0x36f3('0x47')],[_0x36f3('0x65'),'id'])||{});}return null;})[_0x36f3('0x66')](function(_0x1bbef0){var _0xfc72b;var _0x15fe57;_0x46c91b=_0x1bbef0||[];var _0x5e2954=[];if(_0x1bbef0){for(var _0x91c233=0x0;_0x91c233<_0x1bbef0[_0x36f3('0x35')];_0x91c233+=0x1){var _0x59d425=_0x1bbef0[_0x91c233][_0x36f3('0x22')]({'plain':!![]});_0x51e520['dialCheckDuplicateType']=_0x4954ad[_0x36f3('0x47')][_0x36f3('0x67')]?_0x4954ad[_0x36f3('0x47')][_0x36f3('0x67')]:_0x51e520[_0x36f3('0x67')];switch(_0x51e520[_0x36f3('0x67')]){case _0x36f3('0x68'):_0xfc72b=squel['insert']()[_0x36f3('0x69')](_0x36f3('0x6a'))[_0x36f3('0x6b')]([_0x36f3('0x6c'),_0x36f3('0x6d'),_0x36f3('0x6e'),_0x36f3('0x6f'),'CampaignId',_0x36f3('0x4f'),_0x36f3('0x50')],squel[_0x36f3('0x70')]()[_0x36f3('0x71')](_0x36f3('0x6c'),_0x36f3('0x6c'))['field']('NOW()',_0x36f3('0x6d'))[_0x36f3('0x71')]('id',_0x36f3('0x6e'))[_0x36f3('0x71')](_0x59d425['CmListId'][_0x36f3('0x72')](),_0x36f3('0x6f'))[_0x36f3('0x71')](_0x4954ad['params']['id'][_0x36f3('0x72')](),_0x36f3('0x5a'))[_0x36f3('0x71')]('\x27'+_0x2b1ede+'\x27',_0x36f3('0x4f'))[_0x36f3('0x71')]('\x27'+_0x2b1ede+'\x27',_0x36f3('0x50'))[_0x36f3('0x73')](_0x36f3('0x74'))['where'](_0x36f3('0x75'))[_0x36f3('0x38')](_0x36f3('0x76'),_0x59d425[_0x36f3('0x77')]['toString']())[_0x36f3('0x38')](_0x36f3('0x78'))[_0x36f3('0x38')](_0x36f3('0x79'),squel[_0x36f3('0x70')]()[_0x36f3('0x71')](_0x36f3('0x7a'))[_0x36f3('0x73')]('cm_hopper_final')[_0x36f3('0x38')](_0x36f3('0x7b'),_0x4954ad[_0x36f3('0x43')]['id'][_0x36f3('0x72')]()))['where'](_0x36f3('0x79'),squel[_0x36f3('0x70')]()[_0x36f3('0x71')]('COALESCE(phone,\x27\x27)')[_0x36f3('0x73')]('cm_hopper')[_0x36f3('0x38')](_0x36f3('0x7b'),_0x4954ad[_0x36f3('0x43')]['id'][_0x36f3('0x72')]())))['toString']();break;case _0x36f3('0x7c'):_0xfc72b=squel[_0x36f3('0x7d')]()[_0x36f3('0x69')]('cm_hopper')[_0x36f3('0x6b')]([_0x36f3('0x6c'),_0x36f3('0x6d'),_0x36f3('0x6e'),_0x36f3('0x6f'),'CampaignId','createdAt',_0x36f3('0x50')],squel['select']()['field'](_0x36f3('0x6c'),_0x36f3('0x6c'))[_0x36f3('0x71')](_0x36f3('0x7e'),'scheduledAt')[_0x36f3('0x71')]('id',_0x36f3('0x6e'))[_0x36f3('0x71')](_0x59d425[_0x36f3('0x77')][_0x36f3('0x72')](),_0x36f3('0x6f'))[_0x36f3('0x71')](_0x4954ad[_0x36f3('0x43')]['id']['toString'](),_0x36f3('0x5a'))[_0x36f3('0x71')]('\x27'+_0x2b1ede+'\x27',_0x36f3('0x4f'))[_0x36f3('0x71')]('\x27'+_0x2b1ede+'\x27','updatedAt')['from'](_0x36f3('0x74'))[_0x36f3('0x38')](_0x36f3('0x75'))[_0x36f3('0x38')](_0x36f3('0x76'),_0x59d425[_0x36f3('0x77')][_0x36f3('0x72')]())[_0x36f3('0x38')]('phone\x20IS\x20NOT\x20NULL')[_0x36f3('0x38')](_0x36f3('0x79'),squel[_0x36f3('0x70')]()['field'](_0x36f3('0x7f'))[_0x36f3('0x73')](_0x36f3('0x6a'))[_0x36f3('0x38')](_0x36f3('0x7b'),_0x4954ad['params']['id'][_0x36f3('0x72')]())))['toString']();break;default:_0xfc72b=squel[_0x36f3('0x7d')]()[_0x36f3('0x69')]('cm_hopper')['fromQuery'](['phone',_0x36f3('0x6d'),'ContactId',_0x36f3('0x6f'),'CampaignId',_0x36f3('0x4f'),_0x36f3('0x50')],squel[_0x36f3('0x70')]()[_0x36f3('0x71')](_0x36f3('0x6c'),_0x36f3('0x6c'))[_0x36f3('0x71')](_0x36f3('0x7e'),_0x36f3('0x6d'))['field']('id',_0x36f3('0x6e'))[_0x36f3('0x71')](_0x59d425['CmListId'][_0x36f3('0x72')](),_0x36f3('0x6f'))[_0x36f3('0x71')](_0x4954ad[_0x36f3('0x43')]['id'][_0x36f3('0x72')](),_0x36f3('0x5a'))['field']('\x27'+_0x2b1ede+'\x27',_0x36f3('0x4f'))[_0x36f3('0x71')]('\x27'+_0x2b1ede+'\x27',_0x36f3('0x50'))[_0x36f3('0x73')](_0x36f3('0x74'))[_0x36f3('0x38')]('deletedAt\x20IS\x20NULL')[_0x36f3('0x38')](_0x36f3('0x76'),_0x59d425[_0x36f3('0x77')][_0x36f3('0x72')]())['where'](_0x36f3('0x78')))[_0x36f3('0x72')]();}_0x15fe57=squel['insert']()[_0x36f3('0x69')](_0x36f3('0x80'))['fromQuery']([_0x36f3('0x81'),_0x36f3('0x6d'),_0x36f3('0x6c'),_0x36f3('0x82'),_0x36f3('0x4f'),_0x36f3('0x50')],squel[_0x36f3('0x70')]()['field'](_0x36f3('0x83'),'id')[_0x36f3('0x71')]('NOW()',_0x36f3('0x6d'))['field'](_0x36f3('0x84'),_0x36f3('0x6c'))['field'](_0x36f3('0x85'),_0x36f3('0x82'))[_0x36f3('0x71')]('\x27'+_0x2b1ede+'\x27','createdAt')[_0x36f3('0x71')]('\x27'+_0x2b1ede+'\x27',_0x36f3('0x50'))[_0x36f3('0x73')](_0x36f3('0x86'),'ci')[_0x36f3('0x87')](_0x36f3('0x6a'),'h',_0x36f3('0x88'))[_0x36f3('0x38')](_0x36f3('0x89'),_0x59d425[_0x36f3('0x77')][_0x36f3('0x72')]())[_0x36f3('0x38')](_0x36f3('0x8a'),_0x4954ad[_0x36f3('0x43')]['id'][_0x36f3('0x72')]())[_0x36f3('0x38')](_0x36f3('0x8b'),_0x2b1ede))[_0x36f3('0x72')]();_0x5e2954[_0x36f3('0x8c')](db[_0x36f3('0x8d')][_0x36f3('0x31')](_0xfc72b));_0xc2a3af['push'](db[_0x36f3('0x8d')]['query'](_0x15fe57));}return BPromise['all'](_0x5e2954);}})['then'](function(){return BPromise[_0x36f3('0x8e')](_0xc2a3af);})[_0x36f3('0x24')](function(){return _0x46c91b;})[_0x36f3('0x24')](respondWithResult(_0x473210,null))[_0x36f3('0x45')](handleError(_0x473210,null));};exports[_0x36f3('0x8f')]=function(_0x1bc0a0,_0x3892d0,_0x14e89c){return db[_0x36f3('0x2a')][_0x36f3('0x44')]({'where':{'id':_0x1bc0a0[_0x36f3('0x43')]['id']}})['then'](handleEntityNotFound(_0x3892d0,null))[_0x36f3('0x24')](function(_0x351135){if(_0x351135){return _0x351135['removeLists'](_0x1bc0a0[_0x36f3('0x31')][_0x36f3('0x65')]);}})[_0x36f3('0x24')](function(_0x568d03){if(_0x568d03){return db[_0x36f3('0x56')][_0x36f3('0x21')]({'where':{'ListId':_0x1bc0a0[_0x36f3('0x31')][_0x36f3('0x65')],'CampaignId':_0x1bc0a0[_0x36f3('0x43')]['id']}})[_0x36f3('0x24')](function(){return _0x568d03;});}})[_0x36f3('0x24')](respondWithStatusCode(_0x3892d0,null))[_0x36f3('0x45')](handleError(_0x3892d0,null));};exports['getBlackLists']=function(_0x126c2b,_0x19df44,_0x268db3){var _0xb907ef={};var _0xd6df25={};var _0x2971e7;var _0x44b358;return db['Campaign'][_0x36f3('0x55')]({'where':{'id':_0x126c2b[_0x36f3('0x43')]['id']}})[_0x36f3('0x24')](handleEntityNotFound(_0x19df44,null))[_0x36f3('0x24')](function(_0x511987){if(_0x511987){_0x2971e7=_0x511987;_0xd6df25['model']=_[_0x36f3('0x30')](db['CmList']['rawAttributes']);_0xd6df25['query']=_[_0x36f3('0x30')](_0x126c2b[_0x36f3('0x31')]);_0xd6df25[_0x36f3('0x39')]=_[_0x36f3('0x32')](_0xd6df25[_0x36f3('0x2e')],_0xd6df25[_0x36f3('0x31')]);_0xb907ef[_0x36f3('0x33')]=_[_0x36f3('0x32')](_0xd6df25[_0x36f3('0x2e')],qs[_0x36f3('0x34')](_0x126c2b[_0x36f3('0x31')][_0x36f3('0x34')]));_0xb907ef['attributes']=_0xb907ef['attributes']['length']?_0xb907ef['attributes']:_0xd6df25['model'];_0xb907ef[_0x36f3('0x37')]=qs[_0x36f3('0x58')](_0x126c2b['query'][_0x36f3('0x58')]);_0xb907ef['where']=qs['filters'](_['pick'](_0x126c2b[_0x36f3('0x31')],_0xd6df25['filters']));if(_0x126c2b[_0x36f3('0x31')][_0x36f3('0x3c')]){_0xb907ef[_0x36f3('0x38')]=_[_0x36f3('0x3d')](_0xb907ef['where'],{'$or':_[_0x36f3('0x29')](_0xb907ef[_0x36f3('0x33')],function(_0x3099bb){var _0x5cdad1={};_0x5cdad1[_0x3099bb]={'$like':'%'+_0x126c2b[_0x36f3('0x31')][_0x36f3('0x3c')]+'%'};return _0x5cdad1;})});}_0xb907ef=_['merge']({},_0xb907ef,_0x126c2b[_0x36f3('0x3e')]);return _0x2971e7['getBlackLists'](_0xb907ef);}})[_0x36f3('0x24')](function(_0x45b91c){if(_0x45b91c){_0x44b358=_0x45b91c[_0x36f3('0x35')];if(!_0x126c2b[_0x36f3('0x31')][_0x36f3('0x36')](_0x36f3('0x57'))){_0xb907ef[_0x36f3('0x1a')]=qs[_0x36f3('0x1a')](_0x126c2b['query'][_0x36f3('0x1a')]);_0xb907ef['offset']=qs[_0x36f3('0x1c')](_0x126c2b[_0x36f3('0x31')]['offset']);}return _0x2971e7[_0x36f3('0x90')](_0xb907ef);}})[_0x36f3('0x24')](function(_0x365b97){if(_0x365b97){return _0x365b97?{'count':_0x44b358,'rows':_0x365b97}:null;}})['then'](respondWithResult(_0x19df44,null))[_0x36f3('0x45')](handleError(_0x19df44,null));};exports[_0x36f3('0x91')]=function(_0x377efa,_0x59671a,_0x1f7cdb){var _0x240087,_0x5dadfc;var _0x399e66=[];var _0x229222=moment()['format'](_0x36f3('0x92'));return db[_0x36f3('0x2a')][_0x36f3('0x44')]({'where':{'id':_0x377efa['params']['id']}})[_0x36f3('0x24')](handleEntityNotFound(_0x59671a,null))['then'](function(_0xe7250b){if(_0xe7250b){_0x5dadfc=_0xe7250b;return _0xe7250b['addBlackLists'](_0x377efa[_0x36f3('0x47')]['ids'],_[_0x36f3('0x4e')](_0x377efa[_0x36f3('0x47')],[_0x36f3('0x65'),'id'])||{});}return null;})[_0x36f3('0x66')](function(_0x5aae79){var _0xd6f65b;var _0xcee22d;_0x240087=_0x5aae79||[];var _0x1c983c=[];if(_0x5aae79){for(var _0x2c81b9=0x0;_0x2c81b9<_0x5aae79[_0x36f3('0x35')];_0x2c81b9+=0x1){var _0xc31b5=_0x5aae79[_0x2c81b9][_0x36f3('0x22')]({'plain':!![]});_0xd6f65b=squel[_0x36f3('0x7d')]()[_0x36f3('0x69')](_0x36f3('0x93'))['fromQuery']([_0x36f3('0x6c'),'ContactId',_0x36f3('0x6f'),_0x36f3('0x5a'),_0x36f3('0x4f'),'updatedAt'],squel[_0x36f3('0x70')]()['field'](_0x36f3('0x6c'),_0x36f3('0x6c'))[_0x36f3('0x71')]('id','ContactId')[_0x36f3('0x71')](_0xc31b5[_0x36f3('0x77')][_0x36f3('0x72')](),_0x36f3('0x6f'))[_0x36f3('0x71')](_0x377efa[_0x36f3('0x43')]['id'][_0x36f3('0x72')](),_0x36f3('0x5a'))[_0x36f3('0x71')]('NOW()',_0x36f3('0x4f'))[_0x36f3('0x71')](_0x36f3('0x7e'),_0x36f3('0x50'))[_0x36f3('0x73')](_0x36f3('0x74'))[_0x36f3('0x38')]('deletedAt\x20IS\x20NULL')[_0x36f3('0x38')](_0x36f3('0x76'),_0xc31b5[_0x36f3('0x77')][_0x36f3('0x72')]())['where'](_0x36f3('0x78')))[_0x36f3('0x72')]();_0x1c983c['push'](db['sequelize'][_0x36f3('0x31')](_0xd6f65b));}return BPromise[_0x36f3('0x8e')](_0x1c983c);}})['then'](function(){return _0x240087;})[_0x36f3('0x24')](respondWithResult(_0x59671a,null))[_0x36f3('0x45')](handleError(_0x59671a,null));};exports[_0x36f3('0x94')]=function(_0x18e14c,_0x12d654,_0xfdedbc){return db['Campaign'][_0x36f3('0x44')]({'where':{'id':_0x18e14c[_0x36f3('0x43')]['id']}})['then'](handleEntityNotFound(_0x12d654,null))['then'](function(_0x225fcf){if(_0x225fcf){return _0x225fcf[_0x36f3('0x94')](_0x18e14c[_0x36f3('0x31')][_0x36f3('0x65')]);}})[_0x36f3('0x24')](function(_0x5eb44d){if(_0x5eb44d){return db[_0x36f3('0x60')]['destroy']({'where':{'ListId':_0x18e14c[_0x36f3('0x31')][_0x36f3('0x65')],'CampaignId':_0x18e14c['params']['id']}})['then'](function(){return _0x5eb44d;});}})[_0x36f3('0x24')](respondWithStatusCode(_0x12d654,null))['catch'](handleError(_0x12d654,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 78f4839..ce3418d 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(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x4d1f59,_0x4483ec){var _0x468441=function(_0x183185){while(--_0x183185){_0x4d1f59['push'](_0x4d1f59['shift']());}};_0x468441(++_0x4483ec);}(_0x7a54,0x106));var _0x47a5=function(_0x412a12,_0x430906){_0x412a12=_0x412a12-0x0;var _0x18946e=_0x7a54[_0x412a12];return _0x18946e;};'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 353969b..c8ed0f3 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 _0x37b4=['stringify','error','Campaign,\x20%s,\x20%s','message','result','catch','GetCampaign','Campaign','options','attributes','include','map','model','then','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','info','request\x20sent'];(function(_0x3cf68c,_0x32feab){var _0x741a2c=function(_0x108349){while(--_0x108349){_0x3cf68c['push'](_0x3cf68c['shift']());}};_0x741a2c(++_0x32feab);}(_0x37b4,0xef));var _0x437b=function(_0x12833b,_0x26c1d2){_0x12833b=_0x12833b-0x0;var _0x3acad3=_0x37b4[_0x12833b];return _0x3acad3;};'use strict';var _=require(_0x437b('0x0'));var util=require('util');var moment=require(_0x437b('0x1'));var BPromise=require(_0x437b('0x2'));var rs=require(_0x437b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x437b('0x4'))['db'];var utils=require(_0x437b('0x5'));var logger=require(_0x437b('0x6'))(_0x437b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x437b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c7dea,_0x4aada7,_0x226e3c){return new BPromise(function(_0x5df980,_0x432b63){return client['request'](_0x3c7dea,_0x226e3c)['then'](function(_0x44bf1d){logger[_0x437b('0x9')]('Campaign,\x20%s,\x20%s',_0x4aada7,_0x437b('0xa'));logger['debug']('Campaign,\x20%s,\x20%s,\x20%s',_0x4aada7,_0x437b('0xa'),JSON[_0x437b('0xb')](_0x44bf1d));if(_0x44bf1d[_0x437b('0xc')]){if(_0x44bf1d[_0x437b('0xc')]['code']===0x1f4){logger[_0x437b('0xc')](_0x437b('0xd'),_0x4aada7,_0x44bf1d[_0x437b('0xc')]['message']);return _0x432b63(_0x44bf1d[_0x437b('0xc')][_0x437b('0xe')]);}logger[_0x437b('0xc')]('Campaign,\x20%s,\x20%s',_0x4aada7,_0x44bf1d[_0x437b('0xc')]['message']);return _0x5df980(_0x44bf1d[_0x437b('0xc')][_0x437b('0xe')]);}else{logger[_0x437b('0x9')]('Campaign,\x20%s,\x20%s',_0x4aada7,_0x437b('0xa'));_0x5df980(_0x44bf1d[_0x437b('0xf')][_0x437b('0xe')]);}})[_0x437b('0x10')](function(_0x1d31af){logger[_0x437b('0xc')]('Campaign,\x20%s,\x20%s',_0x4aada7,_0x1d31af);_0x432b63(_0x1d31af);});});}exports[_0x437b('0x11')]=function(_0x501d8c){var _0x2b3994=this;return new Promise(function(_0x107024,_0x1c91bc){return db[_0x437b('0x12')]['findAll']({'raw':_0x501d8c['options']?_0x501d8c['options']['raw']===undefined?!![]:![]:!![],'where':_0x501d8c[_0x437b('0x13')]?_0x501d8c[_0x437b('0x13')]['where']||null:null,'attributes':_0x501d8c[_0x437b('0x13')]?_0x501d8c['options'][_0x437b('0x14')]||null:null,'limit':_0x501d8c[_0x437b('0x13')]?_0x501d8c[_0x437b('0x13')]['limit']||null:null,'include':_0x501d8c['options']?_0x501d8c['options'][_0x437b('0x15')]?_[_0x437b('0x16')](_0x501d8c[_0x437b('0x13')][_0x437b('0x15')],function(_0x8c5852){return{'model':db[_0x8c5852[_0x437b('0x17')]],'as':_0x8c5852['as'],'attributes':_0x8c5852[_0x437b('0x14')],'include':_0x8c5852[_0x437b('0x15')]?_[_0x437b('0x16')](_0x8c5852[_0x437b('0x15')],function(_0x258198){return{'model':db[_0x258198['model']],'as':_0x258198['as'],'attributes':_0x258198[_0x437b('0x14')],'include':_0x258198[_0x437b('0x15')]?_[_0x437b('0x16')](_0x258198[_0x437b('0x15')],function(_0x17092c){return{'model':db[_0x17092c['model']],'as':_0x17092c['as'],'attributes':_0x17092c[_0x437b('0x14')]};}):[]};}):[]};}):[]:[]})[_0x437b('0x18')](function(_0x4a7d0b){logger[_0x437b('0x9')]('GetCampaign',_0x501d8c);logger['debug']('GetCampaign',_0x501d8c,JSON[_0x437b('0xb')](_0x4a7d0b));_0x107024(_0x4a7d0b);})['catch'](function(_0x37a3d7){logger[_0x437b('0xc')](_0x437b('0x11'),_0x37a3d7['message'],_0x501d8c);_0x1c91bc(_0x2b3994['error'](0x1f4,_0x37a3d7[_0x437b('0xe')]));});});}; \ No newline at end of file +var _0x7119=['limit','include','model','map','GetCampaign','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Campaign','options','raw','attributes'];(function(_0x592007,_0x522e94){var _0x2c8434=function(_0x2e98c1){while(--_0x2e98c1){_0x592007['push'](_0x592007['shift']());}};_0x2c8434(++_0x522e94);}(_0x7119,0x1c7));var _0x9711=function(_0x64a51,_0x1c61b7){_0x64a51=_0x64a51-0x0;var _0x1eba45=_0x7119[_0x64a51];return _0x1eba45;};'use strict';var _=require('lodash');var util=require(_0x9711('0x0'));var moment=require('moment');var BPromise=require(_0x9711('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9711('0x2'));var db=require(_0x9711('0x3'))['db'];var utils=require(_0x9711('0x4'));var logger=require(_0x9711('0x5'))('rpc');var config=require(_0x9711('0x6'));var jayson=require(_0x9711('0x7'));var client=jayson[_0x9711('0x8')][_0x9711('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x191701,_0x4c75dd,_0x31af88){return new BPromise(function(_0x3a5f79,_0x132b5b){return client['request'](_0x191701,_0x31af88)[_0x9711('0xa')](function(_0x4b13b9){logger[_0x9711('0xb')](_0x9711('0xc'),_0x4c75dd,_0x9711('0xd'));logger['debug'](_0x9711('0xe'),_0x4c75dd,_0x9711('0xd'),JSON[_0x9711('0xf')](_0x4b13b9));if(_0x4b13b9[_0x9711('0x10')]){if(_0x4b13b9[_0x9711('0x10')][_0x9711('0x11')]===0x1f4){logger[_0x9711('0x10')](_0x9711('0xc'),_0x4c75dd,_0x4b13b9[_0x9711('0x10')][_0x9711('0x12')]);return _0x132b5b(_0x4b13b9[_0x9711('0x10')]['message']);}logger['error'](_0x9711('0xc'),_0x4c75dd,_0x4b13b9[_0x9711('0x10')][_0x9711('0x12')]);return _0x3a5f79(_0x4b13b9[_0x9711('0x10')][_0x9711('0x12')]);}else{logger['info'](_0x9711('0xc'),_0x4c75dd,'request\x20sent');_0x3a5f79(_0x4b13b9[_0x9711('0x13')][_0x9711('0x12')]);}})[_0x9711('0x14')](function(_0x640894){logger[_0x9711('0x10')]('Campaign,\x20%s,\x20%s',_0x4c75dd,_0x640894);_0x132b5b(_0x640894);});});}exports['GetCampaign']=function(_0x2ef16c){var _0x3615c9=this;return new Promise(function(_0x210f8b,_0x4629e2){return db[_0x9711('0x15')]['findAll']({'raw':_0x2ef16c[_0x9711('0x16')]?_0x2ef16c[_0x9711('0x16')][_0x9711('0x17')]===undefined?!![]:![]:!![],'where':_0x2ef16c[_0x9711('0x16')]?_0x2ef16c['options']['where']||null:null,'attributes':_0x2ef16c['options']?_0x2ef16c[_0x9711('0x16')][_0x9711('0x18')]||null:null,'limit':_0x2ef16c[_0x9711('0x16')]?_0x2ef16c['options'][_0x9711('0x19')]||null:null,'include':_0x2ef16c[_0x9711('0x16')]?_0x2ef16c['options'][_0x9711('0x1a')]?_['map'](_0x2ef16c[_0x9711('0x16')]['include'],function(_0x3023cf){return{'model':db[_0x3023cf[_0x9711('0x1b')]],'as':_0x3023cf['as'],'attributes':_0x3023cf['attributes'],'include':_0x3023cf[_0x9711('0x1a')]?_[_0x9711('0x1c')](_0x3023cf[_0x9711('0x1a')],function(_0x2db327){return{'model':db[_0x2db327['model']],'as':_0x2db327['as'],'attributes':_0x2db327['attributes'],'include':_0x2db327[_0x9711('0x1a')]?_[_0x9711('0x1c')](_0x2db327['include'],function(_0x4d16e5){return{'model':db[_0x4d16e5['model']],'as':_0x4d16e5['as'],'attributes':_0x4d16e5['attributes']};}):[]};}):[]};}):[]:[]})[_0x9711('0xa')](function(_0x270da2){logger['info'](_0x9711('0x1d'),_0x2ef16c);logger['debug'](_0x9711('0x1d'),_0x2ef16c,JSON[_0x9711('0xf')](_0x270da2));_0x210f8b(_0x270da2);})['catch'](function(_0x3fc5bb){logger[_0x9711('0x10')](_0x9711('0x1d'),_0x3fc5bb[_0x9711('0x12')],_0x2ef16c);_0x4629e2(_0x3615c9['error'](0x1f4,_0x3fc5bb[_0x9711('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 370caae..080bc7a 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 _0x8f2e=['put','update','delete','destroy','removeLists','removeBlackLists','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./campaign.controller','get','/:id','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addLists'];(function(_0x25b606,_0x25d3b2){var _0x148b67=function(_0x5b7d74){while(--_0x5b7d74){_0x25b606['push'](_0x25b606['shift']());}};_0x148b67(++_0x25d3b2);}(_0x8f2e,0xb0));var _0xe8f2=function(_0x46ba64,_0x55b3e7){_0x46ba64=_0x46ba64-0x0;var _0x2f6edb=_0x8f2e[_0x46ba64];return _0x2f6edb;};'use strict';var multer=require(_0xe8f2('0x0'));var util=require('util');var path=require(_0xe8f2('0x1'));var timeout=require('connect-timeout');var express=require(_0xe8f2('0x2'));var router=express[_0xe8f2('0x3')]();var fs_extra=require(_0xe8f2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe8f2('0x5'));var config=require(_0xe8f2('0x6'));var controller=require(_0xe8f2('0x7'));router[_0xe8f2('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xe8f2('0x9'),auth[_0xe8f2('0xa')](),controller[_0xe8f2('0xb')]);router[_0xe8f2('0x8')](_0xe8f2('0xc'),auth['isAuthenticated'](),controller[_0xe8f2('0xd')]);router[_0xe8f2('0x8')](_0xe8f2('0xe'),auth['isAuthenticated'](),controller[_0xe8f2('0xf')]);router['get'](_0xe8f2('0x10'),auth[_0xe8f2('0xa')](),controller[_0xe8f2('0x11')]);router['get'](_0xe8f2('0x12'),auth['isAuthenticated'](),controller['getHopperBlacks']);router[_0xe8f2('0x8')](_0xe8f2('0x13'),auth[_0xe8f2('0xa')](),controller[_0xe8f2('0x14')]);router[_0xe8f2('0x8')](_0xe8f2('0x15'),auth[_0xe8f2('0xa')](),controller[_0xe8f2('0x16')]);router[_0xe8f2('0x17')]('/',auth['isAuthenticated'](),controller[_0xe8f2('0x18')]);router[_0xe8f2('0x17')](_0xe8f2('0x19'),auth[_0xe8f2('0xa')](),controller[_0xe8f2('0x1a')]);router['post']('/:id/lists',auth[_0xe8f2('0xa')](),controller[_0xe8f2('0x1b')]);router[_0xe8f2('0x17')](_0xe8f2('0x15'),auth[_0xe8f2('0xa')](),controller['addBlackLists']);router[_0xe8f2('0x1c')](_0xe8f2('0x9'),auth[_0xe8f2('0xa')](),controller[_0xe8f2('0x1d')]);router[_0xe8f2('0x1e')](_0xe8f2('0x9'),auth[_0xe8f2('0xa')](),controller[_0xe8f2('0x1f')]);router[_0xe8f2('0x1e')](_0xe8f2('0x13'),auth[_0xe8f2('0xa')](),controller[_0xe8f2('0x20')]);router[_0xe8f2('0x1e')]('/:id/blacklists',auth[_0xe8f2('0xa')](),controller[_0xe8f2('0x21')]);module['exports']=router; \ No newline at end of file +var _0xb7ef=['fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','getLists','post','create','/:id/clone','clone','/:id/lists','addLists','/:id/blacklists','delete','destroy','removeLists','removeBlackLists','multer','util','path','connect-timeout','express','Router'];(function(_0x157db1,_0x5652bf){var _0x169249=function(_0x463401){while(--_0x463401){_0x157db1['push'](_0x157db1['shift']());}};_0x169249(++_0x5652bf);}(_0xb7ef,0x1ac));var _0xfb7e=function(_0x3717a9,_0x17f9bc){_0x3717a9=_0x3717a9-0x0;var _0x485b85=_0xb7ef[_0x3717a9];return _0x485b85;};'use strict';var multer=require(_0xfb7e('0x0'));var util=require(_0xfb7e('0x1'));var path=require(_0xfb7e('0x2'));var timeout=require(_0xfb7e('0x3'));var express=require(_0xfb7e('0x4'));var router=express[_0xfb7e('0x5')]();var fs_extra=require(_0xfb7e('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xfb7e('0x7'));var config=require(_0xfb7e('0x8'));var controller=require('./campaign.controller');router[_0xfb7e('0x9')]('/',auth[_0xfb7e('0xa')](),controller[_0xfb7e('0xb')]);router[_0xfb7e('0x9')](_0xfb7e('0xc'),auth[_0xfb7e('0xa')](),controller['show']);router[_0xfb7e('0x9')](_0xfb7e('0xd'),auth[_0xfb7e('0xa')](),controller[_0xfb7e('0xe')]);router[_0xfb7e('0x9')]('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0xfb7e('0xf')]);router[_0xfb7e('0x9')](_0xfb7e('0x10'),auth[_0xfb7e('0xa')](),controller[_0xfb7e('0x11')]);router['get']('/:id/hopper_black',auth[_0xfb7e('0xa')](),controller[_0xfb7e('0x12')]);router[_0xfb7e('0x9')]('/:id/lists',auth[_0xfb7e('0xa')](),controller[_0xfb7e('0x13')]);router[_0xfb7e('0x9')]('/:id/blacklists',auth[_0xfb7e('0xa')](),controller['getBlackLists']);router[_0xfb7e('0x14')]('/',auth[_0xfb7e('0xa')](),controller[_0xfb7e('0x15')]);router[_0xfb7e('0x14')](_0xfb7e('0x16'),auth[_0xfb7e('0xa')](),controller[_0xfb7e('0x17')]);router[_0xfb7e('0x14')](_0xfb7e('0x18'),auth[_0xfb7e('0xa')](),controller[_0xfb7e('0x19')]);router[_0xfb7e('0x14')](_0xfb7e('0x1a'),auth[_0xfb7e('0xa')](),controller['addBlackLists']);router['put'](_0xfb7e('0xc'),auth[_0xfb7e('0xa')](),controller['update']);router[_0xfb7e('0x1b')](_0xfb7e('0xc'),auth[_0xfb7e('0xa')](),controller[_0xfb7e('0x1c')]);router[_0xfb7e('0x1b')](_0xfb7e('0x18'),auth[_0xfb7e('0xa')](),controller[_0xfb7e('0x1d')]);router['delete'](_0xfb7e('0x1a'),auth[_0xfb7e('0xa')](),controller[_0xfb7e('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index d0370e9..492a4bb 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 _0x422d=['key','sequelize','exports','STRING','TEXT','VIRTUAL'];(function(_0xc898bb,_0x51b13a){var _0x2b8ca6=function(_0x5b3ecf){while(--_0x5b3ecf){_0xc898bb['push'](_0xc898bb['shift']());}};_0x2b8ca6(++_0x51b13a);}(_0x422d,0x18d));var _0xd422=function(_0x18a0da,_0x8cb375){_0x18a0da=_0x18a0da-0x0;var _0x3cf6b8=_0x422d[_0x18a0da];return _0x3cf6b8;};'use strict';var Sequelize=require(_0xd422('0x0'));module[_0xd422('0x1')]={'key':{'type':Sequelize[_0xd422('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xd422('0x3')],'length':'medium','allowNull':![]},'description':{'type':Sequelize[_0xd422('0x2')]},'name':{'type':Sequelize[_0xd422('0x4')],'get':function(){return this['getDataValue'](_0xd422('0x5'));}}}; \ No newline at end of file +var _0x6248=['STRING','VIRTUAL','key','sequelize','TEXT','medium'];(function(_0x598f75,_0x318fbe){var _0x2351c1=function(_0x12f0b0){while(--_0x12f0b0){_0x598f75['push'](_0x598f75['shift']());}};_0x2351c1(++_0x318fbe);}(_0x6248,0x10b));var _0x8624=function(_0x562eca,_0x3fa3b3){_0x562eca=_0x562eca-0x0;var _0x189dc3=_0x6248[_0x562eca];return _0x189dc3;};'use strict';var Sequelize=require(_0x8624('0x0'));module['exports']={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x8624('0x1')],'length':_0x8624('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x8624('0x3')]},'name':{'type':Sequelize[_0x8624('0x4')],'get':function(){return this['getDataValue'](_0x8624('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 56cf2c3..9777d53 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 _0x2671=['filter','merge','options','CannedAnswer','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','user','UserProfileSection','CannedAnswers','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','sendStatus','status','end','json','limit','undefined','offset','count','set','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','index','map','type','key','query','keys','filters','attributes','intersection','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x2671,0x165));var _0x1267=function(_0x35b87c,_0x166a8c){_0x35b87c=_0x35b87c-0x0;var _0x24795b=_0x2671[_0x35b87c];return _0x24795b;};'use strict';var emlformat=require(_0x1267('0x0'));var rimraf=require(_0x1267('0x1'));var zipdir=require(_0x1267('0x2'));var jsonpatch=require(_0x1267('0x3'));var rp=require(_0x1267('0x4'));var moment=require(_0x1267('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1267('0x6'));var util=require('util');var path=require('path');var sox=require(_0x1267('0x7'));var csv=require(_0x1267('0x8'));var ejs=require(_0x1267('0x9'));var fs=require('fs');var fs_extra=require(_0x1267('0xa'));var _=require('lodash');var squel=require(_0x1267('0xb'));var crypto=require(_0x1267('0xc'));var jsforce=require(_0x1267('0xd'));var deskjs=require(_0x1267('0xe'));var toCsv=require(_0x1267('0x8'));var querystring=require(_0x1267('0xf'));var Papa=require('papaparse');var Redis=require(_0x1267('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1267('0x11'));var hardwareService=require(_0x1267('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x1267('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x68e727,_0x4936a9){_0x4936a9=_0x4936a9||0xcc;return function(_0x2a51b4){if(_0x2a51b4){return _0x68e727[_0x1267('0x14')](_0x4936a9);}return _0x68e727[_0x1267('0x15')](_0x4936a9)[_0x1267('0x16')]();};}function respondWithResult(_0x522cca,_0xf0b899){_0xf0b899=_0xf0b899||0xc8;return function(_0x36ccc1){if(_0x36ccc1){return _0x522cca[_0x1267('0x15')](_0xf0b899)[_0x1267('0x17')](_0x36ccc1);}};}function respondWithFilteredResult(_0x36d02e,_0x220815){return function(_0x366631){if(_0x366631){var _0x2b740f=typeof _0x220815['offset']==='undefined'&&typeof _0x220815[_0x1267('0x18')]===_0x1267('0x19');var _0x24bfb6=_0x366631['count'];var _0x2e33e9=_0x2b740f?0x0:_0x220815[_0x1267('0x1a')];var _0x20840f=_0x2b740f?_0x366631[_0x1267('0x1b')]:_0x220815['offset']+_0x220815[_0x1267('0x18')];var _0x1047ef;if(_0x20840f>=_0x24bfb6){_0x20840f=_0x24bfb6;_0x1047ef=0xc8;}else{_0x1047ef=0xce;}_0x36d02e['status'](_0x1047ef);return _0x36d02e[_0x1267('0x1c')]('Content-Range',_0x2e33e9+'-'+_0x20840f+'/'+_0x24bfb6)[_0x1267('0x17')](_0x366631);}return null;};}function patchUpdates(_0x27b4b7){return function(_0x520066){try{jsonpatch[_0x1267('0x1d')](_0x520066,_0x27b4b7,!![]);}catch(_0x3652dc){return BPromise[_0x1267('0x1e')](_0x3652dc);}return _0x520066[_0x1267('0x1f')]();};}function saveUpdates(_0x1928aa,_0x4862d4){return function(_0x5bf4cf){if(_0x5bf4cf){return _0x5bf4cf[_0x1267('0x20')](_0x1928aa)[_0x1267('0x21')](function(_0xcab624){return _0xcab624;});}return null;};}function removeEntity(_0x28f2e5,_0x51571f){return function(_0x4ff670){if(_0x4ff670){return _0x4ff670[_0x1267('0x22')]()[_0x1267('0x21')](function(){var _0x3f4729=_0x4ff670[_0x1267('0x23')]({'plain':!![]});var _0x502397='CannedAnswers';return db[_0x1267('0x24')]['destroy']({'where':{'type':_0x502397,'resourceId':_0x3f4729['id']}})[_0x1267('0x21')](function(){return _0x4ff670;});})[_0x1267('0x21')](function(){_0x28f2e5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b4286,_0x2040d3){return function(_0x1ee27b){if(!_0x1ee27b){_0x4b4286['sendStatus'](0x194);}return _0x1ee27b;};}function handleError(_0x5707c1,_0x1665a1){_0x1665a1=_0x1665a1||0x1f4;return function(_0x364ac6){logger[_0x1267('0x25')](_0x364ac6[_0x1267('0x26')]);if(_0x364ac6[_0x1267('0x27')]){delete _0x364ac6[_0x1267('0x27')];}_0x5707c1[_0x1267('0x15')](_0x1665a1)['send'](_0x364ac6);};}exports[_0x1267('0x28')]=function(_0x598853,_0x50b7e3){var _0x3ae431={},_0x1561f9={},_0x52ec9c={'count':0x0,'rows':[]};var _0x5df264=_[_0x1267('0x29')](db['CannedAnswer']['rawAttributes'],function(_0xc6411c){return{'name':_0xc6411c['fieldName'],'type':_0xc6411c[_0x1267('0x2a')][_0x1267('0x2b')]};});_0x1561f9['model']=_[_0x1267('0x29')](_0x5df264,'name');_0x1561f9[_0x1267('0x2c')]=_[_0x1267('0x2d')](_0x598853[_0x1267('0x2c')]);_0x1561f9[_0x1267('0x2e')]=_['intersection'](_0x1561f9['model'],_0x1561f9[_0x1267('0x2c')]);_0x3ae431[_0x1267('0x2f')]=_[_0x1267('0x30')](_0x1561f9['model'],qs[_0x1267('0x31')](_0x598853['query']['fields']));_0x3ae431[_0x1267('0x2f')]=_0x3ae431['attributes'][_0x1267('0x32')]?_0x3ae431['attributes']:_0x1561f9[_0x1267('0x33')];if(!_0x598853[_0x1267('0x2c')][_0x1267('0x34')](_0x1267('0x35'))){_0x3ae431[_0x1267('0x18')]=qs['limit'](_0x598853[_0x1267('0x2c')][_0x1267('0x18')]);_0x3ae431['offset']=qs[_0x1267('0x1a')](_0x598853[_0x1267('0x2c')]['offset']);}_0x3ae431[_0x1267('0x36')]=qs[_0x1267('0x37')](_0x598853[_0x1267('0x2c')]['sort']);_0x3ae431[_0x1267('0x38')]=qs[_0x1267('0x2e')](_[_0x1267('0x39')](_0x598853[_0x1267('0x2c')],_0x1561f9[_0x1267('0x2e')]),_0x5df264);if(_0x598853[_0x1267('0x2c')][_0x1267('0x3a')]){_0x3ae431[_0x1267('0x38')]=_['merge'](_0x3ae431[_0x1267('0x38')],{'$or':[{'key':{'$like':'%'+_0x598853[_0x1267('0x2c')][_0x1267('0x3a')]+'%'}},{'value':{'$like':'%'+_0x598853[_0x1267('0x2c')][_0x1267('0x3a')]+'%'}}]});}_0x3ae431=_[_0x1267('0x3b')]({},_0x3ae431,_0x598853[_0x1267('0x3c')]);var _0x367ec1={'where':_0x3ae431[_0x1267('0x38')]};return db[_0x1267('0x3d')][_0x1267('0x1b')](_0x367ec1)[_0x1267('0x21')](function(_0x1e11c4){_0x52ec9c[_0x1267('0x1b')]=_0x1e11c4;if(_0x598853[_0x1267('0x2c')][_0x1267('0x3e')]){_0x3ae431[_0x1267('0x3f')]=[{'all':!![]}];}return db[_0x1267('0x3d')][_0x1267('0x40')](_0x3ae431);})['then'](function(_0x66e9c){_0x52ec9c[_0x1267('0x41')]=_0x66e9c;return _0x52ec9c;})[_0x1267('0x21')](respondWithFilteredResult(_0x50b7e3,_0x3ae431))[_0x1267('0x42')](handleError(_0x50b7e3,null));};exports[_0x1267('0x43')]=function(_0xef9a7a,_0x398f9d){var _0x363dcf={'raw':!![],'where':{'id':_0xef9a7a[_0x1267('0x44')]['id']}},_0x2076d9={};_0x2076d9[_0x1267('0x33')]=_[_0x1267('0x2d')](db['CannedAnswer'][_0x1267('0x45')]);_0x2076d9[_0x1267('0x2c')]=_[_0x1267('0x2d')](_0xef9a7a[_0x1267('0x2c')]);_0x2076d9[_0x1267('0x2e')]=_[_0x1267('0x30')](_0x2076d9[_0x1267('0x33')],_0x2076d9[_0x1267('0x2c')]);_0x363dcf[_0x1267('0x2f')]=_[_0x1267('0x30')](_0x2076d9[_0x1267('0x33')],qs[_0x1267('0x31')](_0xef9a7a['query'][_0x1267('0x31')]));_0x363dcf['attributes']=_0x363dcf[_0x1267('0x2f')]['length']?_0x363dcf[_0x1267('0x2f')]:_0x2076d9[_0x1267('0x33')];if(_0xef9a7a[_0x1267('0x2c')][_0x1267('0x3e')]){_0x363dcf['include']=[{'all':!![]}];}_0x363dcf=_[_0x1267('0x3b')]({},_0x363dcf,_0xef9a7a[_0x1267('0x3c')]);return db[_0x1267('0x3d')][_0x1267('0x46')](_0x363dcf)[_0x1267('0x21')](handleEntityNotFound(_0x398f9d,null))[_0x1267('0x21')](respondWithResult(_0x398f9d,null))[_0x1267('0x42')](handleError(_0x398f9d,null));};exports['update']=function(_0x298058,_0x28c0dc){if(_0x298058[_0x1267('0x47')]['id']){delete _0x298058[_0x1267('0x47')]['id'];}return db[_0x1267('0x3d')]['find']({'where':{'id':_0x298058['params']['id']}})[_0x1267('0x21')](handleEntityNotFound(_0x28c0dc,null))[_0x1267('0x21')](saveUpdates(_0x298058[_0x1267('0x47')],null))[_0x1267('0x21')](respondWithResult(_0x28c0dc,null))[_0x1267('0x42')](handleError(_0x28c0dc,null));};exports[_0x1267('0x22')]=function(_0x45896b,_0xcc05d3){return db[_0x1267('0x3d')]['find']({'where':{'id':_0x45896b[_0x1267('0x44')]['id']}})['then'](handleEntityNotFound(_0xcc05d3,null))[_0x1267('0x21')](removeEntity(_0xcc05d3,null))['catch'](handleError(_0xcc05d3,null));};exports[_0x1267('0x48')]=function(_0x25a580,_0xde7b88){var _0x24fb5b={'key':_0x25a580[_0x1267('0x47')][_0x1267('0x2b')]};if(_0x25a580[_0x1267('0x47')]['MailAccountId']){_0x24fb5b[_0x1267('0x49')]=_0x25a580['body'][_0x1267('0x49')];}else if(_0x25a580[_0x1267('0x47')][_0x1267('0x4a')]){_0x24fb5b['SmsAccountId']=_0x25a580[_0x1267('0x47')][_0x1267('0x4a')];}else if(_0x25a580[_0x1267('0x47')]['OpenchannelAccountId']){_0x24fb5b[_0x1267('0x4b')]=_0x25a580['body']['OpenchannelAccountId'];}else if(_0x25a580['body'][_0x1267('0x4c')]){_0x24fb5b[_0x1267('0x4c')]=_0x25a580['body']['ChatWebsiteId'];}return db[_0x1267('0x3d')][_0x1267('0x46')]({'where':_0x24fb5b})['then'](function(_0x36fb86){if(_0x36fb86){throw new db[(_0x1267('0x4d'))]['ValidationError']('The\x20inserted\x20key\x20already\x20exists.');}return db['CannedAnswer']['create'](_0x25a580['body']);})[_0x1267('0x21')](function(_0x303e9f){var _0x32e390=_0x25a580[_0x1267('0x4e')]['get']({'plain':!![]});if(!_0x32e390)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x32e390['role']===_0x1267('0x4e')){var _0x59982a=_0x303e9f[_0x1267('0x23')]({'plain':!![]});return db[_0x1267('0x4f')][_0x1267('0x46')]({'where':{'name':_0x1267('0x50'),'userProfileId':_0x32e390[_0x1267('0x51')]},'raw':!![]})[_0x1267('0x21')](function(_0x1b087e){if(_0x1b087e&&_0x1b087e['autoAssociation']===0x0){return db['UserProfileResource'][_0x1267('0x48')]({'name':_0x59982a['name'],'resourceId':_0x59982a['id'],'type':_0x1b087e[_0x1267('0x27')],'sectionId':_0x1b087e['id']},{})[_0x1267('0x21')](function(){return _0x303e9f;});}else{return _0x303e9f;}})['catch'](function(_0x2abc40){logger['error'](_0x1267('0x52'),_0x2abc40);throw _0x2abc40;});}return _0x303e9f;})[_0x1267('0x21')](respondWithResult(_0xde7b88,0xc9))[_0x1267('0x42')](handleError(_0xde7b88,null));}; \ No newline at end of file +var _0xa7b4=['key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','get','CannedAnswers','error','stack','name','send','index','map','CannedAnswer','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','includeAll','include','rows','catch','show','rawAttributes','options','find','body','params','create'];(function(_0x7179ba,_0x37504f){var _0x4ad820=function(_0x131107){while(--_0x131107){_0x7179ba['push'](_0x7179ba['shift']());}};_0x4ad820(++_0x37504f);}(_0xa7b4,0xc9));var _0x4a7b=function(_0x1716c1,_0x4f3a3b){_0x1716c1=_0x1716c1-0x0;var _0x1ca528=_0xa7b4[_0x1716c1];return _0x1ca528;};'use strict';var emlformat=require(_0x4a7b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4a7b('0x1'));var jsonpatch=require(_0x4a7b('0x2'));var rp=require(_0x4a7b('0x3'));var moment=require(_0x4a7b('0x4'));var BPromise=require(_0x4a7b('0x5'));var Mustache=require('mustache');var util=require(_0x4a7b('0x6'));var path=require(_0x4a7b('0x7'));var sox=require(_0x4a7b('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4a7b('0x9'));var squel=require(_0x4a7b('0xa'));var crypto=require('crypto');var jsforce=require(_0x4a7b('0xb'));var deskjs=require(_0x4a7b('0xc'));var toCsv=require(_0x4a7b('0xd'));var querystring=require(_0x4a7b('0xe'));var Papa=require(_0x4a7b('0xf'));var Redis=require(_0x4a7b('0x10'));var authService=require(_0x4a7b('0x11'));var qs=require(_0x4a7b('0x12'));var as=require(_0x4a7b('0x13'));var hardwareService=require(_0x4a7b('0x14'));var logger=require(_0x4a7b('0x15'))(_0x4a7b('0x16'));var utils=require(_0x4a7b('0x17'));var config=require(_0x4a7b('0x18'));var licenseUtil=require(_0x4a7b('0x19'));var db=require(_0x4a7b('0x1a'))['db'];function respondWithStatusCode(_0x1b172f,_0x3b33e1){_0x3b33e1=_0x3b33e1||0xcc;return function(_0x50ad78){if(_0x50ad78){return _0x1b172f[_0x4a7b('0x1b')](_0x3b33e1);}return _0x1b172f[_0x4a7b('0x1c')](_0x3b33e1)[_0x4a7b('0x1d')]();};}function respondWithResult(_0x5c7c08,_0x3b5361){_0x3b5361=_0x3b5361||0xc8;return function(_0x5ba39d){if(_0x5ba39d){return _0x5c7c08['status'](_0x3b5361)['json'](_0x5ba39d);}};}function respondWithFilteredResult(_0x4881f3,_0x204fe7){return function(_0x314285){if(_0x314285){var _0x153d70=typeof _0x204fe7[_0x4a7b('0x1e')]===_0x4a7b('0x1f')&&typeof _0x204fe7[_0x4a7b('0x20')]===_0x4a7b('0x1f');var _0x4a3130=_0x314285[_0x4a7b('0x21')];var _0x6d5a08=_0x153d70?0x0:_0x204fe7['offset'];var _0x25caac=_0x153d70?_0x314285[_0x4a7b('0x21')]:_0x204fe7[_0x4a7b('0x1e')]+_0x204fe7[_0x4a7b('0x20')];var _0x192b47;if(_0x25caac>=_0x4a3130){_0x25caac=_0x4a3130;_0x192b47=0xc8;}else{_0x192b47=0xce;}_0x4881f3['status'](_0x192b47);return _0x4881f3[_0x4a7b('0x22')](_0x4a7b('0x23'),_0x6d5a08+'-'+_0x25caac+'/'+_0x4a3130)[_0x4a7b('0x24')](_0x314285);}return null;};}function patchUpdates(_0x49b0fa){return function(_0x5331bb){try{jsonpatch[_0x4a7b('0x25')](_0x5331bb,_0x49b0fa,!![]);}catch(_0x513164){return BPromise['reject'](_0x513164);}return _0x5331bb[_0x4a7b('0x26')]();};}function saveUpdates(_0x2ab5fd,_0x38a81b){return function(_0x29d759){if(_0x29d759){return _0x29d759[_0x4a7b('0x27')](_0x2ab5fd)[_0x4a7b('0x28')](function(_0x4a4f6d){return _0x4a4f6d;});}return null;};}function removeEntity(_0x5c7d4d,_0x1cef0f){return function(_0x415792){if(_0x415792){return _0x415792[_0x4a7b('0x29')]()[_0x4a7b('0x28')](function(){var _0x3465e8=_0x415792[_0x4a7b('0x2a')]({'plain':!![]});var _0x10d99c=_0x4a7b('0x2b');return db['UserProfileResource'][_0x4a7b('0x29')]({'where':{'type':_0x10d99c,'resourceId':_0x3465e8['id']}})[_0x4a7b('0x28')](function(){return _0x415792;});})[_0x4a7b('0x28')](function(){_0x5c7d4d[_0x4a7b('0x1c')](0xcc)[_0x4a7b('0x1d')]();});}};}function handleEntityNotFound(_0x257f47,_0x3168e1){return function(_0x9572f6){if(!_0x9572f6){_0x257f47[_0x4a7b('0x1b')](0x194);}return _0x9572f6;};}function handleError(_0xb0f608,_0x41e82d){_0x41e82d=_0x41e82d||0x1f4;return function(_0x2748ae){logger[_0x4a7b('0x2c')](_0x2748ae[_0x4a7b('0x2d')]);if(_0x2748ae[_0x4a7b('0x2e')]){delete _0x2748ae[_0x4a7b('0x2e')];}_0xb0f608[_0x4a7b('0x1c')](_0x41e82d)[_0x4a7b('0x2f')](_0x2748ae);};}exports[_0x4a7b('0x30')]=function(_0xd41606,_0x424a39){var _0x33d10d={},_0xe6ca22={},_0x5062a1={'count':0x0,'rows':[]};var _0x51bde7=_[_0x4a7b('0x31')](db[_0x4a7b('0x32')]['rawAttributes'],function(_0x3745b6){return{'name':_0x3745b6['fieldName'],'type':_0x3745b6[_0x4a7b('0x33')]['key']};});_0xe6ca22[_0x4a7b('0x34')]=_['map'](_0x51bde7,_0x4a7b('0x2e'));_0xe6ca22['query']=_[_0x4a7b('0x35')](_0xd41606[_0x4a7b('0x36')]);_0xe6ca22['filters']=_[_0x4a7b('0x37')](_0xe6ca22[_0x4a7b('0x34')],_0xe6ca22[_0x4a7b('0x36')]);_0x33d10d[_0x4a7b('0x38')]=_[_0x4a7b('0x37')](_0xe6ca22[_0x4a7b('0x34')],qs['fields'](_0xd41606['query'][_0x4a7b('0x39')]));_0x33d10d[_0x4a7b('0x38')]=_0x33d10d[_0x4a7b('0x38')][_0x4a7b('0x3a')]?_0x33d10d['attributes']:_0xe6ca22[_0x4a7b('0x34')];if(!_0xd41606[_0x4a7b('0x36')][_0x4a7b('0x3b')](_0x4a7b('0x3c'))){_0x33d10d[_0x4a7b('0x20')]=qs[_0x4a7b('0x20')](_0xd41606[_0x4a7b('0x36')]['limit']);_0x33d10d[_0x4a7b('0x1e')]=qs[_0x4a7b('0x1e')](_0xd41606[_0x4a7b('0x36')][_0x4a7b('0x1e')]);}_0x33d10d[_0x4a7b('0x3d')]=qs['sort'](_0xd41606[_0x4a7b('0x36')]['sort']);_0x33d10d[_0x4a7b('0x3e')]=qs[_0x4a7b('0x3f')](_[_0x4a7b('0x40')](_0xd41606['query'],_0xe6ca22['filters']),_0x51bde7);if(_0xd41606[_0x4a7b('0x36')][_0x4a7b('0x41')]){_0x33d10d[_0x4a7b('0x3e')]=_['merge'](_0x33d10d[_0x4a7b('0x3e')],{'$or':[{'key':{'$like':'%'+_0xd41606['query'][_0x4a7b('0x41')]+'%'}},{'value':{'$like':'%'+_0xd41606[_0x4a7b('0x36')][_0x4a7b('0x41')]+'%'}}]});}_0x33d10d=_[_0x4a7b('0x42')]({},_0x33d10d,_0xd41606['options']);var _0x45f426={'where':_0x33d10d[_0x4a7b('0x3e')]};return db[_0x4a7b('0x32')][_0x4a7b('0x21')](_0x45f426)[_0x4a7b('0x28')](function(_0x131cf5){_0x5062a1[_0x4a7b('0x21')]=_0x131cf5;if(_0xd41606[_0x4a7b('0x36')][_0x4a7b('0x43')]){_0x33d10d[_0x4a7b('0x44')]=[{'all':!![]}];}return db[_0x4a7b('0x32')]['findAll'](_0x33d10d);})['then'](function(_0x2b983d){_0x5062a1[_0x4a7b('0x45')]=_0x2b983d;return _0x5062a1;})[_0x4a7b('0x28')](respondWithFilteredResult(_0x424a39,_0x33d10d))[_0x4a7b('0x46')](handleError(_0x424a39,null));};exports[_0x4a7b('0x47')]=function(_0x461d4e,_0x18d947){var _0x364ba5={'raw':!![],'where':{'id':_0x461d4e['params']['id']}},_0xd7bb25={};_0xd7bb25[_0x4a7b('0x34')]=_[_0x4a7b('0x35')](db['CannedAnswer'][_0x4a7b('0x48')]);_0xd7bb25['query']=_['keys'](_0x461d4e[_0x4a7b('0x36')]);_0xd7bb25[_0x4a7b('0x3f')]=_[_0x4a7b('0x37')](_0xd7bb25[_0x4a7b('0x34')],_0xd7bb25[_0x4a7b('0x36')]);_0x364ba5[_0x4a7b('0x38')]=_[_0x4a7b('0x37')](_0xd7bb25['model'],qs['fields'](_0x461d4e[_0x4a7b('0x36')][_0x4a7b('0x39')]));_0x364ba5['attributes']=_0x364ba5[_0x4a7b('0x38')][_0x4a7b('0x3a')]?_0x364ba5[_0x4a7b('0x38')]:_0xd7bb25[_0x4a7b('0x34')];if(_0x461d4e[_0x4a7b('0x36')][_0x4a7b('0x43')]){_0x364ba5[_0x4a7b('0x44')]=[{'all':!![]}];}_0x364ba5=_[_0x4a7b('0x42')]({},_0x364ba5,_0x461d4e[_0x4a7b('0x49')]);return db[_0x4a7b('0x32')][_0x4a7b('0x4a')](_0x364ba5)[_0x4a7b('0x28')](handleEntityNotFound(_0x18d947,null))[_0x4a7b('0x28')](respondWithResult(_0x18d947,null))[_0x4a7b('0x46')](handleError(_0x18d947,null));};exports['update']=function(_0x208da2,_0x1d818e){if(_0x208da2[_0x4a7b('0x4b')]['id']){delete _0x208da2[_0x4a7b('0x4b')]['id'];}return db[_0x4a7b('0x32')]['find']({'where':{'id':_0x208da2[_0x4a7b('0x4c')]['id']}})[_0x4a7b('0x28')](handleEntityNotFound(_0x1d818e,null))[_0x4a7b('0x28')](saveUpdates(_0x208da2['body'],null))[_0x4a7b('0x28')](respondWithResult(_0x1d818e,null))[_0x4a7b('0x46')](handleError(_0x1d818e,null));};exports[_0x4a7b('0x29')]=function(_0x30bec3,_0x4c6f0e){return db[_0x4a7b('0x32')]['find']({'where':{'id':_0x30bec3[_0x4a7b('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4c6f0e,null))[_0x4a7b('0x28')](removeEntity(_0x4c6f0e,null))[_0x4a7b('0x46')](handleError(_0x4c6f0e,null));};exports[_0x4a7b('0x4d')]=function(_0x1b1550,_0x1f5b4e){var _0x52a45f={'key':_0x1b1550['body'][_0x4a7b('0x4e')]};if(_0x1b1550[_0x4a7b('0x4b')][_0x4a7b('0x4f')]){_0x52a45f['MailAccountId']=_0x1b1550[_0x4a7b('0x4b')][_0x4a7b('0x4f')];}else if(_0x1b1550[_0x4a7b('0x4b')]['SmsAccountId']){_0x52a45f['SmsAccountId']=_0x1b1550[_0x4a7b('0x4b')][_0x4a7b('0x50')];}else if(_0x1b1550[_0x4a7b('0x4b')][_0x4a7b('0x51')]){_0x52a45f[_0x4a7b('0x51')]=_0x1b1550[_0x4a7b('0x4b')]['OpenchannelAccountId'];}else if(_0x1b1550[_0x4a7b('0x4b')]['ChatWebsiteId']){_0x52a45f[_0x4a7b('0x52')]=_0x1b1550[_0x4a7b('0x4b')]['ChatWebsiteId'];}return db[_0x4a7b('0x32')][_0x4a7b('0x4a')]({'where':_0x52a45f})['then'](function(_0x1f3427){if(_0x1f3427){throw new db[(_0x4a7b('0x53'))][(_0x4a7b('0x54'))](_0x4a7b('0x55'));}return db[_0x4a7b('0x32')][_0x4a7b('0x4d')](_0x1b1550[_0x4a7b('0x4b')]);})[_0x4a7b('0x28')](function(_0x246e0f){var _0x39811c=_0x1b1550[_0x4a7b('0x56')][_0x4a7b('0x2a')]({'plain':!![]});if(!_0x39811c)throw new Error(_0x4a7b('0x57'));if(_0x39811c['role']===_0x4a7b('0x56')){var _0x32f0fc=_0x246e0f['get']({'plain':!![]});return db[_0x4a7b('0x58')]['find']({'where':{'name':'CannedAnswers','userProfileId':_0x39811c[_0x4a7b('0x59')]},'raw':!![]})['then'](function(_0x505b62){if(_0x505b62&&_0x505b62[_0x4a7b('0x5a')]===0x0){return db[_0x4a7b('0x5b')][_0x4a7b('0x4d')]({'name':_0x32f0fc[_0x4a7b('0x2e')],'resourceId':_0x32f0fc['id'],'type':_0x505b62['name'],'sectionId':_0x505b62['id']},{})['then'](function(){return _0x246e0f;});}else{return _0x246e0f;}})[_0x4a7b('0x46')](function(_0x4fa965){logger[_0x4a7b('0x2c')](_0x4a7b('0x5c'),_0x4fa965);throw _0x4fa965;});}return _0x246e0f;})[_0x4a7b('0x28')](respondWithResult(_0x1f5b4e,0xc9))[_0x4a7b('0x46')](handleError(_0x1f5b4e,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 7599e66..9a5b990 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 _0xd446=['./cannedAnswer.attributes','exports','define','tools_canned_answers','utf8mb4','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x582d0b,_0x28f609){var _0x2e93e1=function(_0xb6a81c){while(--_0xb6a81c){_0x582d0b['push'](_0x582d0b['shift']());}};_0x2e93e1(++_0x28f609);}(_0xd446,0x171));var _0x6d44=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd446[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6d44('0x0'));var util=require('util');var logger=require(_0x6d44('0x1'))('api');var moment=require(_0x6d44('0x2'));var BPromise=require(_0x6d44('0x3'));var rp=require(_0x6d44('0x4'));var fs=require('fs');var path=require(_0x6d44('0x5'));var rimraf=require(_0x6d44('0x6'));var config=require(_0x6d44('0x7'));var attributes=require(_0x6d44('0x8'));module[_0x6d44('0x9')]=function(_0x16b328,_0x3b75b2){return _0x16b328[_0x6d44('0xa')]('CannedAnswer',attributes,{'tableName':_0x6d44('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6d44('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xee69=['exports','define','CannedAnswer','tools_canned_answers','utf8mb4','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes'];(function(_0x149254,_0xafe8da){var _0x249023=function(_0x5d99fd){while(--_0x5d99fd){_0x149254['push'](_0x149254['shift']());}};_0x249023(++_0xafe8da);}(_0xee69,0x91));var _0x9ee6=function(_0x1395e7,_0x1138c2){_0x1395e7=_0x1395e7-0x0;var _0x5d5331=_0xee69[_0x1395e7];return _0x5d5331;};'use strict';var _=require('lodash');var util=require(_0x9ee6('0x0'));var logger=require(_0x9ee6('0x1'))(_0x9ee6('0x2'));var moment=require(_0x9ee6('0x3'));var BPromise=require('bluebird');var rp=require(_0x9ee6('0x4'));var fs=require('fs');var path=require(_0x9ee6('0x5'));var rimraf=require(_0x9ee6('0x6'));var config=require(_0x9ee6('0x7'));var attributes=require(_0x9ee6('0x8'));module[_0x9ee6('0x9')]=function(_0x136381,_0x327327){return _0x136381[_0x9ee6('0xa')](_0x9ee6('0xb'),attributes,{'tableName':_0x9ee6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9ee6('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 317f973..0e49142 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(_0x339e44,_0x361cea){var _0x3c1be2=function(_0x7a04ce){while(--_0x7a04ce){_0x339e44['push'](_0x339e44['shift']());}};_0x3c1be2(++_0x361cea);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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(_0x3ac366,_0x2d6458){var _0x195225=function(_0x4f4e74){while(--_0x4f4e74){_0x3ac366['push'](_0x3ac366['shift']());}};_0x195225(++_0x2d6458);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index ba187d3..7bbf6b9 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 _0x8473=['../../components/interaction/service','../../config/environment','./cannedAnswer.controller','isAuthenticated','index','/:id','post','create','put','update','delete','exports','util','path','express','fs-extra'];(function(_0x526b29,_0x3e9b10){var _0x1289b4=function(_0x5ec127){while(--_0x5ec127){_0x526b29['push'](_0x526b29['shift']());}};_0x1289b4(++_0x3e9b10);}(_0x8473,0xec));var _0x3847=function(_0x1f17db,_0x1b258e){_0x1f17db=_0x1f17db-0x0;var _0x68d72b=_0x8473[_0x1f17db];return _0x68d72b;};'use strict';var multer=require('multer');var util=require(_0x3847('0x0'));var path=require(_0x3847('0x1'));var timeout=require('connect-timeout');var express=require(_0x3847('0x2'));var router=express['Router']();var fs_extra=require(_0x3847('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x3847('0x4'));var config=require(_0x3847('0x5'));var controller=require(_0x3847('0x6'));router['get']('/',auth[_0x3847('0x7')](),controller[_0x3847('0x8')]);router['get'](_0x3847('0x9'),auth[_0x3847('0x7')](),controller['show']);router[_0x3847('0xa')]('/',auth[_0x3847('0x7')](),controller[_0x3847('0xb')]);router[_0x3847('0xc')](_0x3847('0x9'),auth[_0x3847('0x7')](),controller[_0x3847('0xd')]);router[_0x3847('0xe')]('/:id',auth[_0x3847('0x7')](),controller['destroy']);module[_0x3847('0xf')]=router; \ No newline at end of file +var _0xbdb8=['delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x50cd41,_0x4874a7){var _0x399475=function(_0x1946da){while(--_0x1946da){_0x50cd41['push'](_0x50cd41['shift']());}};_0x399475(++_0x4874a7);}(_0xbdb8,0xb3));var _0x8bdb=function(_0x137f1a,_0x2887df){_0x137f1a=_0x137f1a-0x0;var _0x439923=_0xbdb8[_0x137f1a];return _0x439923;};'use strict';var multer=require(_0x8bdb('0x0'));var util=require(_0x8bdb('0x1'));var path=require('path');var timeout=require(_0x8bdb('0x2'));var express=require(_0x8bdb('0x3'));var router=express[_0x8bdb('0x4')]();var fs_extra=require(_0x8bdb('0x5'));var auth=require(_0x8bdb('0x6'));var interaction=require(_0x8bdb('0x7'));var config=require(_0x8bdb('0x8'));var controller=require(_0x8bdb('0x9'));router[_0x8bdb('0xa')]('/',auth[_0x8bdb('0xb')](),controller[_0x8bdb('0xc')]);router[_0x8bdb('0xa')](_0x8bdb('0xd'),auth['isAuthenticated'](),controller[_0x8bdb('0xe')]);router[_0x8bdb('0xf')]('/',auth[_0x8bdb('0xb')](),controller[_0x8bdb('0x10')]);router[_0x8bdb('0x11')]('/:id',auth[_0x8bdb('0xb')](),controller[_0x8bdb('0x12')]);router[_0x8bdb('0x13')](_0x8bdb('0xd'),auth[_0x8bdb('0xb')](),controller[_0x8bdb('0x14')]);module[_0x8bdb('0x15')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 544ceff..ad6183b 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 _0x106b=['sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x52f3d5,_0x43cda9){var _0x51b27b=function(_0x1d3137){while(--_0x1d3137){_0x52f3d5['push'](_0x52f3d5['shift']());}};_0x51b27b(++_0x43cda9);}(_0x106b,0xa2));var _0xb106=function(_0xd39959,_0x302d09){_0xd39959=_0xd39959-0x0;var _0x1ff69c=_0x106b[_0xd39959];return _0x1ff69c;};'use strict';var Sequelize=require(_0xb106('0x0'));module[_0xb106('0x1')]={'calldate':{'type':Sequelize[_0xb106('0x2')],'allowNull':![],'defaultValue':_0xb106('0x3')},'clid':{'type':Sequelize[_0xb106('0x4')]},'src':{'type':Sequelize[_0xb106('0x4')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0xb106('0x4')]},'channel':{'type':Sequelize[_0xb106('0x4')]},'dstchannel':{'type':Sequelize[_0xb106('0x4')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xb106('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xb106('0x4')]},'amaflags':{'type':Sequelize[_0xb106('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xb106('0x4')]},'userfield':{'type':Sequelize[_0xb106('0x4')]},'uniqueid':{'type':Sequelize[_0xb106('0x4')]},'linkedid':{'type':Sequelize[_0xb106('0x4')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0xb106('0x4')]},'type':{'type':Sequelize[_0xb106('0x4')]},'tag':{'type':Sequelize[_0xb106('0x4')]}}; \ No newline at end of file +var _0x225c=['STRING','INTEGER','sequelize','exports'];(function(_0xba5a61,_0x160004){var _0x4eaab4=function(_0x8ccfb7){while(--_0x8ccfb7){_0xba5a61['push'](_0xba5a61['shift']());}};_0x4eaab4(++_0x160004);}(_0x225c,0x106));var _0xc225=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x225c[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xc225('0x0'));module[_0xc225('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0xc225('0x2')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0xc225('0x2')]},'dcontext':{'type':Sequelize[_0xc225('0x2')]},'channel':{'type':Sequelize[_0xc225('0x2')]},'dstchannel':{'type':Sequelize[_0xc225('0x2')]},'lastapp':{'type':Sequelize[_0xc225('0x2')]},'lastdata':{'type':Sequelize[_0xc225('0x2')]},'duration':{'type':Sequelize[_0xc225('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xc225('0x2')]},'amaflags':{'type':Sequelize[_0xc225('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xc225('0x2')]},'userfield':{'type':Sequelize[_0xc225('0x2')]},'uniqueid':{'type':Sequelize[_0xc225('0x2')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xc225('0x2')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xc225('0x2')]},'tag':{'type':Sequelize[_0xc225('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 96e63dd..10eacdd 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 _0x5162=['undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','Cdr','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','catch','show','params','intersection','find','create','body','eml-format','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5162,0x103));var _0x2516=function(_0x173336,_0x3f98c4){_0x173336=_0x173336-0x0;var _0x12dc79=_0x5162[_0x173336];return _0x12dc79;};'use strict';var emlformat=require(_0x2516('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2516('0x1'));var BPromise=require(_0x2516('0x2'));var Mustache=require(_0x2516('0x3'));var util=require(_0x2516('0x4'));var path=require(_0x2516('0x5'));var sox=require(_0x2516('0x6'));var csv=require(_0x2516('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2516('0x8'));var crypto=require(_0x2516('0x9'));var jsforce=require(_0x2516('0xa'));var deskjs=require(_0x2516('0xb'));var toCsv=require(_0x2516('0x7'));var querystring=require(_0x2516('0xc'));var Papa=require(_0x2516('0xd'));var Redis=require('ioredis');var authService=require(_0x2516('0xe'));var qs=require(_0x2516('0xf'));var as=require(_0x2516('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x2516('0x11'));var licenseUtil=require(_0x2516('0x12'));var db=require(_0x2516('0x13'))['db'];function respondWithStatusCode(_0x3ef6ff,_0x56c69c){_0x56c69c=_0x56c69c||0xcc;return function(_0x33496b){if(_0x33496b){return _0x3ef6ff[_0x2516('0x14')](_0x56c69c);}return _0x3ef6ff[_0x2516('0x15')](_0x56c69c)[_0x2516('0x16')]();};}function respondWithResult(_0x42c771,_0x558d20){_0x558d20=_0x558d20||0xc8;return function(_0x3e5e0f){if(_0x3e5e0f){return _0x42c771[_0x2516('0x15')](_0x558d20)[_0x2516('0x17')](_0x3e5e0f);}};}function respondWithFilteredResult(_0x181a28,_0x2637e8){return function(_0x2ec31f){if(_0x2ec31f){var _0x19aacb=typeof _0x2637e8[_0x2516('0x18')]===_0x2516('0x19')&&typeof _0x2637e8['limit']===_0x2516('0x19');var _0x1ced29=_0x2ec31f[_0x2516('0x1a')];var _0x564d05=_0x19aacb?0x0:_0x2637e8[_0x2516('0x18')];var _0x5e96c7=_0x19aacb?_0x2ec31f['count']:_0x2637e8[_0x2516('0x18')]+_0x2637e8[_0x2516('0x1b')];var _0x151168;if(_0x5e96c7>=_0x1ced29){_0x5e96c7=_0x1ced29;_0x151168=0xc8;}else{_0x151168=0xce;}_0x181a28[_0x2516('0x15')](_0x151168);return _0x181a28[_0x2516('0x1c')](_0x2516('0x1d'),_0x564d05+'-'+_0x5e96c7+'/'+_0x1ced29)[_0x2516('0x17')](_0x2ec31f);}return null;};}function patchUpdates(_0x113616){return function(_0x248c5a){try{jsonpatch[_0x2516('0x1e')](_0x248c5a,_0x113616,!![]);}catch(_0x39ba5b){return BPromise[_0x2516('0x1f')](_0x39ba5b);}return _0x248c5a[_0x2516('0x20')]();};}function saveUpdates(_0x4fb7d9,_0x559a3e){return function(_0x12db4d){if(_0x12db4d){return _0x12db4d[_0x2516('0x21')](_0x4fb7d9)[_0x2516('0x22')](function(_0x2d5b1b){return _0x2d5b1b;});}return null;};}function removeEntity(_0x3ffb6d,_0x32de7a){return function(_0x3d906d){if(_0x3d906d){return _0x3d906d[_0x2516('0x23')]()['then'](function(){_0x3ffb6d[_0x2516('0x15')](0xcc)[_0x2516('0x16')]();});}};}function handleEntityNotFound(_0x774b60,_0x434d54){return function(_0x47f4fb){if(!_0x47f4fb){_0x774b60[_0x2516('0x14')](0x194);}return _0x47f4fb;};}function handleError(_0x30eeb9,_0x1f722c){_0x1f722c=_0x1f722c||0x1f4;return function(_0x3d728a){logger[_0x2516('0x24')](_0x3d728a['stack']);if(_0x3d728a[_0x2516('0x25')]){delete _0x3d728a[_0x2516('0x25')];}_0x30eeb9[_0x2516('0x15')](_0x1f722c)[_0x2516('0x26')](_0x3d728a);};}exports[_0x2516('0x27')]=function(_0x285e67,_0x556f01){var _0x136893={},_0x20dc9f={},_0x493a3e={'count':0x0,'rows':[]};var _0x19d90d=_[_0x2516('0x28')](db[_0x2516('0x29')][_0x2516('0x2a')],function(_0x539704){return{'name':_0x539704[_0x2516('0x2b')],'type':_0x539704[_0x2516('0x2c')][_0x2516('0x2d')]};});_0x20dc9f[_0x2516('0x2e')]=_[_0x2516('0x28')](_0x19d90d,_0x2516('0x25'));_0x20dc9f[_0x2516('0x2f')]=_[_0x2516('0x30')](_0x285e67[_0x2516('0x2f')]);_0x20dc9f[_0x2516('0x31')]=_['intersection'](_0x20dc9f[_0x2516('0x2e')],_0x20dc9f['query']);_0x136893[_0x2516('0x32')]=_['intersection'](_0x20dc9f[_0x2516('0x2e')],qs['fields'](_0x285e67[_0x2516('0x2f')][_0x2516('0x33')]));_0x136893[_0x2516('0x32')]=_0x136893[_0x2516('0x32')][_0x2516('0x34')]?_0x136893[_0x2516('0x32')]:_0x20dc9f[_0x2516('0x2e')];if(!_0x285e67[_0x2516('0x2f')][_0x2516('0x35')]('nolimit')){_0x136893[_0x2516('0x1b')]=qs[_0x2516('0x1b')](_0x285e67[_0x2516('0x2f')][_0x2516('0x1b')]);_0x136893['offset']=qs['offset'](_0x285e67[_0x2516('0x2f')][_0x2516('0x18')]);}_0x136893[_0x2516('0x36')]=qs[_0x2516('0x37')](_0x285e67[_0x2516('0x2f')][_0x2516('0x37')]);_0x136893[_0x2516('0x38')]=qs[_0x2516('0x31')](_[_0x2516('0x39')](_0x285e67[_0x2516('0x2f')],_0x20dc9f['filters']),_0x19d90d);if(_0x285e67['query'][_0x2516('0x3a')]){_0x136893[_0x2516('0x38')]=_['merge'](_0x136893['where'],{'$or':_[_0x2516('0x28')](_0x19d90d,function(_0x3b310f){if(_0x3b310f['type']!==_0x2516('0x3b')){var _0x52ef6b={};_0x52ef6b[_0x3b310f[_0x2516('0x25')]]={'$like':'%'+_0x285e67[_0x2516('0x2f')]['filter']+'%'};return _0x52ef6b;}})});}_0x136893=_[_0x2516('0x3c')]({},_0x136893,_0x285e67[_0x2516('0x3d')]);var _0x155cf7={'where':_0x136893[_0x2516('0x38')]};return db[_0x2516('0x29')][_0x2516('0x1a')](_0x155cf7)[_0x2516('0x22')](function(_0x2371a8){_0x493a3e[_0x2516('0x1a')]=_0x2371a8;if(_0x285e67[_0x2516('0x2f')][_0x2516('0x3e')]){_0x136893[_0x2516('0x3f')]=[{'all':!![]}];}return db[_0x2516('0x29')]['findAll'](_0x136893);})[_0x2516('0x22')](function(_0x1bc0e){_0x493a3e['rows']=_0x1bc0e;return _0x493a3e;})[_0x2516('0x22')](respondWithFilteredResult(_0x556f01,_0x136893))[_0x2516('0x40')](handleError(_0x556f01,null));};exports[_0x2516('0x41')]=function(_0x1afefb,_0x421c58){var _0x582cb6={'raw':!![],'where':{'id':_0x1afefb[_0x2516('0x42')]['id']}},_0x1a8d2d={};_0x1a8d2d[_0x2516('0x2e')]=_[_0x2516('0x30')](db[_0x2516('0x29')][_0x2516('0x2a')]);_0x1a8d2d['query']=_[_0x2516('0x30')](_0x1afefb[_0x2516('0x2f')]);_0x1a8d2d[_0x2516('0x31')]=_[_0x2516('0x43')](_0x1a8d2d[_0x2516('0x2e')],_0x1a8d2d[_0x2516('0x2f')]);_0x582cb6[_0x2516('0x32')]=_['intersection'](_0x1a8d2d[_0x2516('0x2e')],qs['fields'](_0x1afefb[_0x2516('0x2f')]['fields']));_0x582cb6[_0x2516('0x32')]=_0x582cb6[_0x2516('0x32')][_0x2516('0x34')]?_0x582cb6['attributes']:_0x1a8d2d['model'];if(_0x1afefb[_0x2516('0x2f')][_0x2516('0x3e')]){_0x582cb6['include']=[{'all':!![]}];}_0x582cb6=_['merge']({},_0x582cb6,_0x1afefb[_0x2516('0x3d')]);return db[_0x2516('0x29')][_0x2516('0x44')](_0x582cb6)['then'](handleEntityNotFound(_0x421c58,null))[_0x2516('0x22')](respondWithResult(_0x421c58,null))['catch'](handleError(_0x421c58,null));};exports[_0x2516('0x45')]=function(_0x39fd32,_0x318128){return db[_0x2516('0x29')]['create'](_0x39fd32[_0x2516('0x46')],{})[_0x2516('0x22')](respondWithResult(_0x318128,0xc9))[_0x2516('0x40')](handleError(_0x318128,null));};exports[_0x2516('0x21')]=function(_0x43874c,_0x482883){if(_0x43874c[_0x2516('0x46')]['id']){delete _0x43874c[_0x2516('0x46')]['id'];}return db[_0x2516('0x29')][_0x2516('0x44')]({'where':{'id':_0x43874c['params']['id']}})[_0x2516('0x22')](handleEntityNotFound(_0x482883,null))[_0x2516('0x22')](saveUpdates(_0x43874c[_0x2516('0x46')],null))[_0x2516('0x22')](respondWithResult(_0x482883,null))[_0x2516('0x40')](handleError(_0x482883,null));};exports['destroy']=function(_0x1c4be3,_0x1aa854){return db[_0x2516('0x29')][_0x2516('0x44')]({'where':{'id':_0x1c4be3[_0x2516('0x42')]['id']}})[_0x2516('0x22')](handleEntityNotFound(_0x1aa854,null))['then'](removeEntity(_0x1aa854,null))['catch'](handleError(_0x1aa854,null));};exports['describe']=function(_0x323590,_0x4f7eb4){return db['Cdr']['describe']()[_0x2516('0x22')](respondWithResult(_0x4f7eb4,null))[_0x2516('0x40')](handleError(_0x4f7eb4,null));}; \ No newline at end of file +var _0xb647=['bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','end','sendStatus','name','send','index','Cdr','rawAttributes','fieldName','type','key','query','filters','model','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','intersection','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x437e8a,_0x44dfba){var _0x5e9910=function(_0x3b71e1){while(--_0x3b71e1){_0x437e8a['push'](_0x437e8a['shift']());}};_0x5e9910(++_0x44dfba);}(_0xb647,0xdb));var _0x7b64=function(_0x2014d7,_0x3668de){_0x2014d7=_0x2014d7-0x0;var _0x355af3=_0xb647[_0x2014d7];return _0x355af3;};'use strict';var emlformat=require(_0x7b64('0x0'));var rimraf=require(_0x7b64('0x1'));var zipdir=require(_0x7b64('0x2'));var jsonpatch=require(_0x7b64('0x3'));var rp=require(_0x7b64('0x4'));var moment=require(_0x7b64('0x5'));var BPromise=require(_0x7b64('0x6'));var Mustache=require(_0x7b64('0x7'));var util=require('util');var path=require(_0x7b64('0x8'));var sox=require('sox');var csv=require(_0x7b64('0x9'));var ejs=require(_0x7b64('0xa'));var fs=require('fs');var fs_extra=require(_0x7b64('0xb'));var _=require(_0x7b64('0xc'));var squel=require(_0x7b64('0xd'));var crypto=require(_0x7b64('0xe'));var jsforce=require(_0x7b64('0xf'));var deskjs=require(_0x7b64('0x10'));var toCsv=require(_0x7b64('0x9'));var querystring=require('querystring');var Papa=require(_0x7b64('0x11'));var Redis=require('ioredis');var authService=require(_0x7b64('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7b64('0x13'));var logger=require(_0x7b64('0x14'))('api');var utils=require(_0x7b64('0x15'));var config=require(_0x7b64('0x16'));var licenseUtil=require(_0x7b64('0x17'));var db=require(_0x7b64('0x18'))['db'];function respondWithStatusCode(_0x25e135,_0x432626){_0x432626=_0x432626||0xcc;return function(_0x5ea1dd){if(_0x5ea1dd){return _0x25e135['sendStatus'](_0x432626);}return _0x25e135[_0x7b64('0x19')](_0x432626)['end']();};}function respondWithResult(_0x530938,_0x2f21d8){_0x2f21d8=_0x2f21d8||0xc8;return function(_0x29a596){if(_0x29a596){return _0x530938[_0x7b64('0x19')](_0x2f21d8)[_0x7b64('0x1a')](_0x29a596);}};}function respondWithFilteredResult(_0x33ebe7,_0x437ddc){return function(_0x306a4e){if(_0x306a4e){var _0x519316=typeof _0x437ddc[_0x7b64('0x1b')]===_0x7b64('0x1c')&&typeof _0x437ddc[_0x7b64('0x1d')]===_0x7b64('0x1c');var _0x157c03=_0x306a4e['count'];var _0x3935c3=_0x519316?0x0:_0x437ddc[_0x7b64('0x1b')];var _0x58517e=_0x519316?_0x306a4e[_0x7b64('0x1e')]:_0x437ddc[_0x7b64('0x1b')]+_0x437ddc['limit'];var _0x23845e;if(_0x58517e>=_0x157c03){_0x58517e=_0x157c03;_0x23845e=0xc8;}else{_0x23845e=0xce;}_0x33ebe7[_0x7b64('0x19')](_0x23845e);return _0x33ebe7[_0x7b64('0x1f')](_0x7b64('0x20'),_0x3935c3+'-'+_0x58517e+'/'+_0x157c03)['json'](_0x306a4e);}return null;};}function patchUpdates(_0x123a3b){return function(_0x5c4135){try{jsonpatch['apply'](_0x5c4135,_0x123a3b,!![]);}catch(_0x3f73cf){return BPromise['reject'](_0x3f73cf);}return _0x5c4135[_0x7b64('0x21')]();};}function saveUpdates(_0x587da6,_0x1bbd87){return function(_0x1ad95f){if(_0x1ad95f){return _0x1ad95f[_0x7b64('0x22')](_0x587da6)[_0x7b64('0x23')](function(_0x450b7e){return _0x450b7e;});}return null;};}function removeEntity(_0x3c0d97,_0x215ea9){return function(_0x3d4bef){if(_0x3d4bef){return _0x3d4bef[_0x7b64('0x24')]()[_0x7b64('0x23')](function(){_0x3c0d97[_0x7b64('0x19')](0xcc)[_0x7b64('0x25')]();});}};}function handleEntityNotFound(_0x24b68e,_0x42efa1){return function(_0x50d06c){if(!_0x50d06c){_0x24b68e[_0x7b64('0x26')](0x194);}return _0x50d06c;};}function handleError(_0x5d9586,_0x1580d0){_0x1580d0=_0x1580d0||0x1f4;return function(_0x21fbd3){logger['error'](_0x21fbd3['stack']);if(_0x21fbd3[_0x7b64('0x27')]){delete _0x21fbd3[_0x7b64('0x27')];}_0x5d9586[_0x7b64('0x19')](_0x1580d0)[_0x7b64('0x28')](_0x21fbd3);};}exports[_0x7b64('0x29')]=function(_0x3c9fad,_0x6740b2){var _0x2729f1={},_0x53e29b={},_0x1616c9={'count':0x0,'rows':[]};var _0x2c4619=_['map'](db[_0x7b64('0x2a')][_0x7b64('0x2b')],function(_0x369402){return{'name':_0x369402[_0x7b64('0x2c')],'type':_0x369402[_0x7b64('0x2d')][_0x7b64('0x2e')]};});_0x53e29b['model']=_['map'](_0x2c4619,_0x7b64('0x27'));_0x53e29b[_0x7b64('0x2f')]=_['keys'](_0x3c9fad['query']);_0x53e29b[_0x7b64('0x30')]=_['intersection'](_0x53e29b[_0x7b64('0x31')],_0x53e29b['query']);_0x2729f1['attributes']=_['intersection'](_0x53e29b[_0x7b64('0x31')],qs[_0x7b64('0x32')](_0x3c9fad[_0x7b64('0x2f')]['fields']));_0x2729f1[_0x7b64('0x33')]=_0x2729f1['attributes'][_0x7b64('0x34')]?_0x2729f1[_0x7b64('0x33')]:_0x53e29b[_0x7b64('0x31')];if(!_0x3c9fad[_0x7b64('0x2f')][_0x7b64('0x35')]('nolimit')){_0x2729f1[_0x7b64('0x1d')]=qs[_0x7b64('0x1d')](_0x3c9fad[_0x7b64('0x2f')][_0x7b64('0x1d')]);_0x2729f1['offset']=qs[_0x7b64('0x1b')](_0x3c9fad[_0x7b64('0x2f')][_0x7b64('0x1b')]);}_0x2729f1[_0x7b64('0x36')]=qs[_0x7b64('0x37')](_0x3c9fad[_0x7b64('0x2f')][_0x7b64('0x37')]);_0x2729f1['where']=qs['filters'](_[_0x7b64('0x38')](_0x3c9fad[_0x7b64('0x2f')],_0x53e29b[_0x7b64('0x30')]),_0x2c4619);if(_0x3c9fad[_0x7b64('0x2f')][_0x7b64('0x39')]){_0x2729f1[_0x7b64('0x3a')]=_[_0x7b64('0x3b')](_0x2729f1[_0x7b64('0x3a')],{'$or':_[_0x7b64('0x3c')](_0x2c4619,function(_0x5b1278){if(_0x5b1278[_0x7b64('0x2d')]!==_0x7b64('0x3d')){var _0x451f9b={};_0x451f9b[_0x5b1278[_0x7b64('0x27')]]={'$like':'%'+_0x3c9fad[_0x7b64('0x2f')][_0x7b64('0x39')]+'%'};return _0x451f9b;}})});}_0x2729f1=_[_0x7b64('0x3b')]({},_0x2729f1,_0x3c9fad[_0x7b64('0x3e')]);var _0x3c4467={'where':_0x2729f1[_0x7b64('0x3a')]};return db[_0x7b64('0x2a')][_0x7b64('0x1e')](_0x3c4467)[_0x7b64('0x23')](function(_0x36cfce){_0x1616c9[_0x7b64('0x1e')]=_0x36cfce;if(_0x3c9fad[_0x7b64('0x2f')][_0x7b64('0x3f')]){_0x2729f1[_0x7b64('0x40')]=[{'all':!![]}];}return db[_0x7b64('0x2a')][_0x7b64('0x41')](_0x2729f1);})['then'](function(_0x442d65){_0x1616c9[_0x7b64('0x42')]=_0x442d65;return _0x1616c9;})[_0x7b64('0x23')](respondWithFilteredResult(_0x6740b2,_0x2729f1))['catch'](handleError(_0x6740b2,null));};exports[_0x7b64('0x43')]=function(_0x2e4d0f,_0x55c889){var _0x216c58={'raw':!![],'where':{'id':_0x2e4d0f['params']['id']}},_0xf0d4a1={};_0xf0d4a1[_0x7b64('0x31')]=_['keys'](db[_0x7b64('0x2a')][_0x7b64('0x2b')]);_0xf0d4a1[_0x7b64('0x2f')]=_['keys'](_0x2e4d0f[_0x7b64('0x2f')]);_0xf0d4a1[_0x7b64('0x30')]=_[_0x7b64('0x44')](_0xf0d4a1[_0x7b64('0x31')],_0xf0d4a1[_0x7b64('0x2f')]);_0x216c58[_0x7b64('0x33')]=_['intersection'](_0xf0d4a1[_0x7b64('0x31')],qs[_0x7b64('0x32')](_0x2e4d0f[_0x7b64('0x2f')][_0x7b64('0x32')]));_0x216c58[_0x7b64('0x33')]=_0x216c58['attributes']['length']?_0x216c58['attributes']:_0xf0d4a1['model'];if(_0x2e4d0f[_0x7b64('0x2f')][_0x7b64('0x3f')]){_0x216c58[_0x7b64('0x40')]=[{'all':!![]}];}_0x216c58=_[_0x7b64('0x3b')]({},_0x216c58,_0x2e4d0f[_0x7b64('0x3e')]);return db[_0x7b64('0x2a')][_0x7b64('0x45')](_0x216c58)[_0x7b64('0x23')](handleEntityNotFound(_0x55c889,null))[_0x7b64('0x23')](respondWithResult(_0x55c889,null))[_0x7b64('0x46')](handleError(_0x55c889,null));};exports[_0x7b64('0x47')]=function(_0x38983a,_0x4add4d){return db['Cdr'][_0x7b64('0x47')](_0x38983a[_0x7b64('0x48')],{})[_0x7b64('0x23')](respondWithResult(_0x4add4d,0xc9))[_0x7b64('0x46')](handleError(_0x4add4d,null));};exports[_0x7b64('0x22')]=function(_0x5a8639,_0x3e5321){if(_0x5a8639[_0x7b64('0x48')]['id']){delete _0x5a8639[_0x7b64('0x48')]['id'];}return db['Cdr'][_0x7b64('0x45')]({'where':{'id':_0x5a8639[_0x7b64('0x49')]['id']}})[_0x7b64('0x23')](handleEntityNotFound(_0x3e5321,null))[_0x7b64('0x23')](saveUpdates(_0x5a8639[_0x7b64('0x48')],null))['then'](respondWithResult(_0x3e5321,null))[_0x7b64('0x46')](handleError(_0x3e5321,null));};exports[_0x7b64('0x24')]=function(_0x52b04a,_0x3656b8){return db[_0x7b64('0x2a')]['find']({'where':{'id':_0x52b04a[_0x7b64('0x49')]['id']}})[_0x7b64('0x23')](handleEntityNotFound(_0x3656b8,null))[_0x7b64('0x23')](removeEntity(_0x3656b8,null))[_0x7b64('0x46')](handleError(_0x3656b8,null));};exports[_0x7b64('0x4a')]=function(_0x79cbc9,_0x253b33){return db[_0x7b64('0x2a')][_0x7b64('0x4a')]()[_0x7b64('0x23')](respondWithResult(_0x253b33,null))[_0x7b64('0x46')](handleError(_0x253b33,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index e455df5..ecda3b3 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(_0x2d8a02,_0x1f4e5d){var _0xe7aaf8=function(_0x1ba751){while(--_0x1ba751){_0x2d8a02['push'](_0x2d8a02['shift']());}};_0xe7aaf8(++_0x1f4e5d);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'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(_0x388113,_0x16cac1){var _0x5c3a72=function(_0x34c96a){while(--_0x34c96a){_0x388113['push'](_0x388113['shift']());}};_0x5c3a72(++_0x16cac1);}(_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':'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 67babbe..b0737e9 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 _0x2421=['stringify','error','Cdr,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x395aaf,_0x48a467){var _0x1b39d3=function(_0x228248){while(--_0x228248){_0x395aaf['push'](_0x395aaf['shift']());}};_0x1b39d3(++_0x48a467);}(_0x2421,0x11a));var _0x1242=function(_0x46f6bd,_0xb41e){_0x46f6bd=_0x46f6bd-0x0;var _0x233b9e=_0x2421[_0x46f6bd];return _0x233b9e;};'use strict';var _=require('lodash');var util=require(_0x1242('0x0'));var moment=require(_0x1242('0x1'));var BPromise=require(_0x1242('0x2'));var rs=require(_0x1242('0x3'));var fs=require('fs');var Redis=require(_0x1242('0x4'));var db=require(_0x1242('0x5'))['db'];var utils=require(_0x1242('0x6'));var logger=require(_0x1242('0x7'))('rpc');var config=require(_0x1242('0x8'));var jayson=require(_0x1242('0x9'));var client=jayson[_0x1242('0xa')][_0x1242('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5cf342,_0x1b1e59,_0x1881d1){return new BPromise(function(_0x43298b,_0x3898a5){return client[_0x1242('0xc')](_0x5cf342,_0x1881d1)[_0x1242('0xd')](function(_0x5aa53d){logger[_0x1242('0xe')]('Cdr,\x20%s,\x20%s',_0x1b1e59,'request\x20sent');logger['debug'](_0x1242('0xf'),_0x1b1e59,_0x1242('0x10'),JSON[_0x1242('0x11')](_0x5aa53d));if(_0x5aa53d[_0x1242('0x12')]){if(_0x5aa53d['error']['code']===0x1f4){logger[_0x1242('0x12')](_0x1242('0x13'),_0x1b1e59,_0x5aa53d[_0x1242('0x12')][_0x1242('0x14')]);return _0x3898a5(_0x5aa53d['error']['message']);}logger[_0x1242('0x12')](_0x1242('0x13'),_0x1b1e59,_0x5aa53d[_0x1242('0x12')]['message']);return _0x43298b(_0x5aa53d[_0x1242('0x12')]['message']);}else{logger[_0x1242('0xe')](_0x1242('0x13'),_0x1b1e59,_0x1242('0x10'));_0x43298b(_0x5aa53d[_0x1242('0x15')][_0x1242('0x14')]);}})[_0x1242('0x16')](function(_0x5d2dfb){logger[_0x1242('0x12')]('Cdr,\x20%s,\x20%s',_0x1b1e59,_0x5d2dfb);_0x3898a5(_0x5d2dfb);});});} \ No newline at end of file +var _0x2353=['Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x3e6cfe,_0x1943c1){var _0x51799b=function(_0x2e8ac1){while(--_0x2e8ac1){_0x3e6cfe['push'](_0x3e6cfe['shift']());}};_0x51799b(++_0x1943c1);}(_0x2353,0x195));var _0x3235=function(_0x482b0b,_0x37ac86){_0x482b0b=_0x482b0b-0x0;var _0x5e5991=_0x2353[_0x482b0b];return _0x5e5991;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3235('0x0'));var BPromise=require(_0x3235('0x1'));var rs=require(_0x3235('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3235('0x3'))['db'];var utils=require(_0x3235('0x4'));var logger=require('../../config/logger')(_0x3235('0x5'));var config=require(_0x3235('0x6'));var jayson=require(_0x3235('0x7'));var client=jayson[_0x3235('0x8')][_0x3235('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x436c8f,_0x399e66,_0x36d16b){return new BPromise(function(_0x146796,_0x2e36fa){return client[_0x3235('0xa')](_0x436c8f,_0x36d16b)[_0x3235('0xb')](function(_0x3a04e9){logger[_0x3235('0xc')](_0x3235('0xd'),_0x399e66,_0x3235('0xe'));logger[_0x3235('0xf')](_0x3235('0x10'),_0x399e66,'request\x20sent',JSON[_0x3235('0x11')](_0x3a04e9));if(_0x3a04e9[_0x3235('0x12')]){if(_0x3a04e9[_0x3235('0x12')]['code']===0x1f4){logger['error'](_0x3235('0xd'),_0x399e66,_0x3a04e9[_0x3235('0x12')][_0x3235('0x13')]);return _0x2e36fa(_0x3a04e9[_0x3235('0x12')][_0x3235('0x13')]);}logger['error'](_0x3235('0xd'),_0x399e66,_0x3a04e9[_0x3235('0x12')][_0x3235('0x13')]);return _0x146796(_0x3a04e9[_0x3235('0x12')][_0x3235('0x13')]);}else{logger['info'](_0x3235('0xd'),_0x399e66,_0x3235('0xe'));_0x146796(_0x3a04e9[_0x3235('0x14')][_0x3235('0x13')]);}})[_0x3235('0x15')](function(_0x459b2b){logger['error'](_0x3235('0xd'),_0x399e66,_0x459b2b);_0x2e36fa(_0x459b2b);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 3d39e90..757dad7 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x481342,_0x39c5b0){var _0x47e1ad=function(_0x35e7db){while(--_0x35e7db){_0x481342['push'](_0x481342['shift']());}};_0x47e1ad(++_0x39c5b0);}(_0xb10b,0x12a));var _0xbb10=function(_0x5426d0,_0x4a4f10){_0x5426d0=_0x5426d0-0x0;var _0x37be89=_0xb10b[_0x5426d0];return _0x37be89;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file +var _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(_0x1a4748,_0x40c46e){var _0x28ca99=function(_0x99232c){while(--_0x99232c){_0x1a4748['push'](_0x1a4748['shift']());}};_0x28ca99(++_0x40c46e);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./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 8038650..97dda9a 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 _0x3f92=['STRING','sequelize','INTEGER','TEXT'];(function(_0x4a655c,_0x5054ee){var _0x987318=function(_0x4d3ef6){while(--_0x4d3ef6){_0x4a655c['push'](_0x4a655c['shift']());}};_0x987318(++_0x5054ee);}(_0x3f92,0x131));var _0x23f9=function(_0x25d3c8,_0x5dcdf0){_0x25d3c8=_0x25d3c8-0x0;var _0x35afa5=_0x3f92[_0x25d3c8];return _0x35afa5;};'use strict';var Sequelize=require(_0x23f9('0x0'));module['exports']={'priority':{'type':Sequelize[_0x23f9('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x23f9('0x2')]()},'description':{'type':Sequelize[_0x23f9('0x3')]},'interval':{'type':Sequelize[_0x23f9('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xadeb=['TEXT','sequelize','exports','STRING'];(function(_0xc2f824,_0x5521e4){var _0x2a601e=function(_0x25315e){while(--_0x25315e){_0xc2f824['push'](_0xc2f824['shift']());}};_0x2a601e(++_0x5521e4);}(_0xadeb,0xad));var _0xbade=function(_0x369cc7,_0x16abfc){_0x369cc7=_0x369cc7-0x0;var _0x53273c=_0xadeb[_0x369cc7];return _0x53273c;};'use strict';var Sequelize=require(_0xbade('0x0'));module[_0xbade('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xbade('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xbade('0x3')]()},'description':{'type':Sequelize[_0xbade('0x2')]},'interval':{'type':Sequelize[_0xbade('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index c6deded..391de4d 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 _0x5d31=['then','destroy','error','stack','name','send','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','merge','options','ChatApplication','find','catch','body','params','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update'];(function(_0x3be8b2,_0x26c3b4){var _0x47672e=function(_0x1633b6){while(--_0x1633b6){_0x3be8b2['push'](_0x3be8b2['shift']());}};_0x47672e(++_0x26c3b4);}(_0x5d31,0xf7));var _0x15d3=function(_0x38c2b5,_0x4de8fa){_0x38c2b5=_0x38c2b5-0x0;var _0x46deb3=_0x5d31[_0x38c2b5];return _0x46deb3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x15d3('0x0'));var zipdir=require(_0x15d3('0x1'));var jsonpatch=require(_0x15d3('0x2'));var rp=require('request-promise');var moment=require(_0x15d3('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x15d3('0x4'));var path=require(_0x15d3('0x5'));var sox=require(_0x15d3('0x6'));var csv=require(_0x15d3('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x15d3('0x8'));var _=require(_0x15d3('0x9'));var squel=require(_0x15d3('0xa'));var crypto=require(_0x15d3('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x15d3('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x15d3('0xd'));var Redis=require('ioredis');var authService=require(_0x15d3('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x15d3('0xf'));var logger=require(_0x15d3('0x10'))(_0x15d3('0x11'));var utils=require(_0x15d3('0x12'));var config=require(_0x15d3('0x13'));var licenseUtil=require(_0x15d3('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x219867,_0x1397d8){_0x1397d8=_0x1397d8||0xcc;return function(_0x2811b5){if(_0x2811b5){return _0x219867[_0x15d3('0x15')](_0x1397d8);}return _0x219867[_0x15d3('0x16')](_0x1397d8)[_0x15d3('0x17')]();};}function respondWithResult(_0x24eb07,_0x1658cf){_0x1658cf=_0x1658cf||0xc8;return function(_0x44b5a4){if(_0x44b5a4){return _0x24eb07[_0x15d3('0x16')](_0x1658cf)[_0x15d3('0x18')](_0x44b5a4);}};}function respondWithFilteredResult(_0x4af3a7,_0x304a13){return function(_0x17401b){if(_0x17401b){var _0x5bbfef=typeof _0x304a13[_0x15d3('0x19')]===_0x15d3('0x1a')&&typeof _0x304a13[_0x15d3('0x1b')]===_0x15d3('0x1a');var _0x1b7b3f=_0x17401b[_0x15d3('0x1c')];var _0x46f9ce=_0x5bbfef?0x0:_0x304a13[_0x15d3('0x19')];var _0x46e18b=_0x5bbfef?_0x17401b[_0x15d3('0x1c')]:_0x304a13[_0x15d3('0x19')]+_0x304a13['limit'];var _0x41c358;if(_0x46e18b>=_0x1b7b3f){_0x46e18b=_0x1b7b3f;_0x41c358=0xc8;}else{_0x41c358=0xce;}_0x4af3a7[_0x15d3('0x16')](_0x41c358);return _0x4af3a7['set']('Content-Range',_0x46f9ce+'-'+_0x46e18b+'/'+_0x1b7b3f)['json'](_0x17401b);}return null;};}function patchUpdates(_0x4ebc97){return function(_0x39bb05){try{jsonpatch[_0x15d3('0x1d')](_0x39bb05,_0x4ebc97,!![]);}catch(_0x40a327){return BPromise[_0x15d3('0x1e')](_0x40a327);}return _0x39bb05[_0x15d3('0x1f')]();};}function saveUpdates(_0x2fa13c,_0x4da198){return function(_0x49eb89){if(_0x49eb89){return _0x49eb89[_0x15d3('0x20')](_0x2fa13c)[_0x15d3('0x21')](function(_0x444075){return _0x444075;});}return null;};}function removeEntity(_0x72852f,_0x5b06cc){return function(_0x232078){if(_0x232078){return _0x232078[_0x15d3('0x22')]()[_0x15d3('0x21')](function(){_0x72852f[_0x15d3('0x16')](0xcc)[_0x15d3('0x17')]();});}};}function handleEntityNotFound(_0x240cf4,_0x4a499a){return function(_0x514380){if(!_0x514380){_0x240cf4['sendStatus'](0x194);}return _0x514380;};}function handleError(_0x31706f,_0x1cd5bc){_0x1cd5bc=_0x1cd5bc||0x1f4;return function(_0x23e1f8){logger[_0x15d3('0x23')](_0x23e1f8[_0x15d3('0x24')]);if(_0x23e1f8[_0x15d3('0x25')]){delete _0x23e1f8[_0x15d3('0x25')];}_0x31706f[_0x15d3('0x16')](_0x1cd5bc)[_0x15d3('0x26')](_0x23e1f8);};}exports['show']=function(_0x5f445a,_0x164aa1){var _0x4e5840={'raw':!![],'where':{'id':_0x5f445a['params']['id']}},_0x6a9c0c={};_0x6a9c0c[_0x15d3('0x27')]=_[_0x15d3('0x28')](db['ChatApplication'][_0x15d3('0x29')]);_0x6a9c0c[_0x15d3('0x2a')]=_[_0x15d3('0x28')](_0x5f445a[_0x15d3('0x2a')]);_0x6a9c0c[_0x15d3('0x2b')]=_[_0x15d3('0x2c')](_0x6a9c0c[_0x15d3('0x27')],_0x6a9c0c[_0x15d3('0x2a')]);_0x4e5840[_0x15d3('0x2d')]=_[_0x15d3('0x2c')](_0x6a9c0c['model'],qs[_0x15d3('0x2e')](_0x5f445a[_0x15d3('0x2a')][_0x15d3('0x2e')]));_0x4e5840[_0x15d3('0x2d')]=_0x4e5840[_0x15d3('0x2d')][_0x15d3('0x2f')]?_0x4e5840[_0x15d3('0x2d')]:_0x6a9c0c[_0x15d3('0x27')];if(_0x5f445a['query'][_0x15d3('0x30')]){_0x4e5840['include']=[{'all':!![]}];}_0x4e5840=_[_0x15d3('0x31')]({},_0x4e5840,_0x5f445a[_0x15d3('0x32')]);return db[_0x15d3('0x33')][_0x15d3('0x34')](_0x4e5840)[_0x15d3('0x21')](handleEntityNotFound(_0x164aa1,null))[_0x15d3('0x21')](respondWithResult(_0x164aa1,null))[_0x15d3('0x35')](handleError(_0x164aa1,null));};exports[_0x15d3('0x20')]=function(_0x340d03,_0x20e680){if(_0x340d03[_0x15d3('0x36')]['id']){delete _0x340d03[_0x15d3('0x36')]['id'];}return db[_0x15d3('0x33')][_0x15d3('0x34')]({'where':{'id':_0x340d03[_0x15d3('0x37')]['id']}})['then'](handleEntityNotFound(_0x20e680,null))[_0x15d3('0x21')](saveUpdates(_0x340d03[_0x15d3('0x36')],null))['then'](respondWithResult(_0x20e680,null))[_0x15d3('0x35')](handleError(_0x20e680,null));};exports[_0x15d3('0x22')]=function(_0xd2708,_0x51963f){return db[_0x15d3('0x33')]['find']({'where':{'id':_0xd2708[_0x15d3('0x37')]['id']}})[_0x15d3('0x21')](handleEntityNotFound(_0x51963f,null))['then'](removeEntity(_0x51963f,null))[_0x15d3('0x35')](handleError(_0x51963f,null));}; \ No newline at end of file +var _0xb676=['ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','merge','options','catch','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','show','params','model','keys'];(function(_0x3ba559,_0x131d7e){var _0x4d76fb=function(_0x504678){while(--_0x504678){_0x3ba559['push'](_0x3ba559['shift']());}};_0x4d76fb(++_0x131d7e);}(_0xb676,0xbc));var _0x6b67=function(_0x2aecb2,_0x343312){_0x2aecb2=_0x2aecb2-0x0;var _0x3ebb80=_0xb676[_0x2aecb2];return _0x3ebb80;};'use strict';var emlformat=require(_0x6b67('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6b67('0x1'));var jsonpatch=require(_0x6b67('0x2'));var rp=require(_0x6b67('0x3'));var moment=require(_0x6b67('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6b67('0x5'));var path=require(_0x6b67('0x6'));var sox=require('sox');var csv=require(_0x6b67('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6b67('0x8'));var _=require(_0x6b67('0x9'));var squel=require(_0x6b67('0xa'));var crypto=require('crypto');var jsforce=require(_0x6b67('0xb'));var deskjs=require(_0x6b67('0xc'));var toCsv=require(_0x6b67('0x7'));var querystring=require('querystring');var Papa=require(_0x6b67('0xd'));var Redis=require(_0x6b67('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x6b67('0xf'));var as=require(_0x6b67('0x10'));var hardwareService=require(_0x6b67('0x11'));var logger=require(_0x6b67('0x12'))('api');var utils=require(_0x6b67('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6b67('0x14'));var db=require(_0x6b67('0x15'))['db'];function respondWithStatusCode(_0x1ebceb,_0x2ab6c5){_0x2ab6c5=_0x2ab6c5||0xcc;return function(_0x3e1bc6){if(_0x3e1bc6){return _0x1ebceb[_0x6b67('0x16')](_0x2ab6c5);}return _0x1ebceb[_0x6b67('0x17')](_0x2ab6c5)[_0x6b67('0x18')]();};}function respondWithResult(_0x2de534,_0x5fb6b3){_0x5fb6b3=_0x5fb6b3||0xc8;return function(_0x8a29a2){if(_0x8a29a2){return _0x2de534['status'](_0x5fb6b3)[_0x6b67('0x19')](_0x8a29a2);}};}function respondWithFilteredResult(_0x2213f4,_0x51e798){return function(_0x187fd4){if(_0x187fd4){var _0x1b6c60=typeof _0x51e798[_0x6b67('0x1a')]===_0x6b67('0x1b')&&typeof _0x51e798['limit']===_0x6b67('0x1b');var _0x46c44e=_0x187fd4[_0x6b67('0x1c')];var _0x46d828=_0x1b6c60?0x0:_0x51e798[_0x6b67('0x1a')];var _0x37d964=_0x1b6c60?_0x187fd4['count']:_0x51e798[_0x6b67('0x1a')]+_0x51e798['limit'];var _0x37cf6d;if(_0x37d964>=_0x46c44e){_0x37d964=_0x46c44e;_0x37cf6d=0xc8;}else{_0x37cf6d=0xce;}_0x2213f4[_0x6b67('0x17')](_0x37cf6d);return _0x2213f4[_0x6b67('0x1d')](_0x6b67('0x1e'),_0x46d828+'-'+_0x37d964+'/'+_0x46c44e)['json'](_0x187fd4);}return null;};}function patchUpdates(_0xd36be3){return function(_0x360208){try{jsonpatch[_0x6b67('0x1f')](_0x360208,_0xd36be3,!![]);}catch(_0x50fdfc){return BPromise[_0x6b67('0x20')](_0x50fdfc);}return _0x360208[_0x6b67('0x21')]();};}function saveUpdates(_0x1fedd5,_0x4d48e1){return function(_0xd4fda5){if(_0xd4fda5){return _0xd4fda5[_0x6b67('0x22')](_0x1fedd5)[_0x6b67('0x23')](function(_0x3a0a3f){return _0x3a0a3f;});}return null;};}function removeEntity(_0x393b3d,_0x17d27b){return function(_0x3c89d2){if(_0x3c89d2){return _0x3c89d2[_0x6b67('0x24')]()[_0x6b67('0x23')](function(){_0x393b3d[_0x6b67('0x17')](0xcc)[_0x6b67('0x18')]();});}};}function handleEntityNotFound(_0x47c927,_0x265245){return function(_0x3cffdf){if(!_0x3cffdf){_0x47c927[_0x6b67('0x16')](0x194);}return _0x3cffdf;};}function handleError(_0x5dca55,_0x2b67f6){_0x2b67f6=_0x2b67f6||0x1f4;return function(_0x1c73b0){logger['error'](_0x1c73b0[_0x6b67('0x25')]);if(_0x1c73b0[_0x6b67('0x26')]){delete _0x1c73b0[_0x6b67('0x26')];}_0x5dca55[_0x6b67('0x17')](_0x2b67f6)[_0x6b67('0x27')](_0x1c73b0);};}exports[_0x6b67('0x28')]=function(_0x3b65af,_0x5d9f6d){var _0x320a70={'raw':!![],'where':{'id':_0x3b65af[_0x6b67('0x29')]['id']}},_0x433881={};_0x433881[_0x6b67('0x2a')]=_[_0x6b67('0x2b')](db[_0x6b67('0x2c')][_0x6b67('0x2d')]);_0x433881[_0x6b67('0x2e')]=_['keys'](_0x3b65af[_0x6b67('0x2e')]);_0x433881[_0x6b67('0x2f')]=_[_0x6b67('0x30')](_0x433881[_0x6b67('0x2a')],_0x433881[_0x6b67('0x2e')]);_0x320a70[_0x6b67('0x31')]=_['intersection'](_0x433881['model'],qs[_0x6b67('0x32')](_0x3b65af[_0x6b67('0x2e')][_0x6b67('0x32')]));_0x320a70[_0x6b67('0x31')]=_0x320a70['attributes'][_0x6b67('0x33')]?_0x320a70['attributes']:_0x433881[_0x6b67('0x2a')];if(_0x3b65af[_0x6b67('0x2e')][_0x6b67('0x34')]){_0x320a70['include']=[{'all':!![]}];}_0x320a70=_[_0x6b67('0x35')]({},_0x320a70,_0x3b65af[_0x6b67('0x36')]);return db[_0x6b67('0x2c')]['find'](_0x320a70)[_0x6b67('0x23')](handleEntityNotFound(_0x5d9f6d,null))[_0x6b67('0x23')](respondWithResult(_0x5d9f6d,null))[_0x6b67('0x37')](handleError(_0x5d9f6d,null));};exports[_0x6b67('0x22')]=function(_0x4c3a86,_0x2092f6){if(_0x4c3a86[_0x6b67('0x38')]['id']){delete _0x4c3a86[_0x6b67('0x38')]['id'];}return db[_0x6b67('0x2c')][_0x6b67('0x39')]({'where':{'id':_0x4c3a86[_0x6b67('0x29')]['id']}})[_0x6b67('0x23')](handleEntityNotFound(_0x2092f6,null))[_0x6b67('0x23')](saveUpdates(_0x4c3a86['body'],null))[_0x6b67('0x23')](respondWithResult(_0x2092f6,null))[_0x6b67('0x37')](handleError(_0x2092f6,null));};exports[_0x6b67('0x24')]=function(_0x4d259f,_0x3889ef){return db[_0x6b67('0x2c')][_0x6b67('0x39')]({'where':{'id':_0x4d259f[_0x6b67('0x29')]['id']}})['then'](handleEntityNotFound(_0x3889ef,null))['then'](removeEntity(_0x3889ef,null))[_0x6b67('0x37')](handleError(_0x3889ef,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index bd786fb..448132d 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 _0x8865=['../../config/environment','./chatApplication.attributes','exports','define','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','request-promise','path','rimraf'];(function(_0x55a1ce,_0x3aba0e){var _0x20a711=function(_0x3642c7){while(--_0x3642c7){_0x55a1ce['push'](_0x55a1ce['shift']());}};_0x20a711(++_0x3aba0e);}(_0x8865,0x173));var _0x5886=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x8865[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x5886('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5886('0x1'));var moment=require(_0x5886('0x2'));var BPromise=require('bluebird');var rp=require(_0x5886('0x3'));var fs=require('fs');var path=require(_0x5886('0x4'));var rimraf=require(_0x5886('0x5'));var config=require(_0x5886('0x6'));var attributes=require(_0x5886('0x7'));module[_0x5886('0x8')]=function(_0xd48fdd,_0x141d99){return _0xd48fdd[_0x5886('0x9')]('ChatApplication',attributes,{'tableName':_0x5886('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5886('0xb'),'collate':_0x5886('0xc')});}; \ No newline at end of file +var _0x5e4a=['chat_applications','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define'];(function(_0x1877a0,_0x5353f6){var _0x49b933=function(_0x288094){while(--_0x288094){_0x1877a0['push'](_0x1877a0['shift']());}};_0x49b933(++_0x5353f6);}(_0x5e4a,0x1b5));var _0xa5e4=function(_0x1e68ef,_0x4546e7){_0x1e68ef=_0x1e68ef-0x0;var _0x547bfa=_0x5e4a[_0x1e68ef];return _0x547bfa;};'use strict';var _=require(_0xa5e4('0x0'));var util=require(_0xa5e4('0x1'));var logger=require(_0xa5e4('0x2'))(_0xa5e4('0x3'));var moment=require(_0xa5e4('0x4'));var BPromise=require(_0xa5e4('0x5'));var rp=require(_0xa5e4('0x6'));var fs=require('fs');var path=require(_0xa5e4('0x7'));var rimraf=require(_0xa5e4('0x8'));var config=require(_0xa5e4('0x9'));var attributes=require(_0xa5e4('0xa'));module[_0xa5e4('0xb')]=function(_0x249dc9,_0x5ca551){return _0x249dc9[_0xa5e4('0xc')]('ChatApplication',attributes,{'tableName':_0xa5e4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa5e4('0xe'),'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 103fc25..9f359ad 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 _0x88c0=['rpc','../../config/environment','jayson/promise','client','request','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','util','moment','randomstring','../../config/utils','../../config/logger'];(function(_0x2c856c,_0x1eeaa6){var _0xa9d840=function(_0x1576e3){while(--_0x1576e3){_0x2c856c['push'](_0x2c856c['shift']());}};_0xa9d840(++_0x1eeaa6);}(_0x88c0,0x13e));var _0x088c=function(_0x379d46,_0x590ea8){_0x379d46=_0x379d46-0x0;var _0x5f80c6=_0x88c0[_0x379d46];return _0x5f80c6;};'use strict';var _=require('lodash');var util=require(_0x088c('0x0'));var moment=require(_0x088c('0x1'));var BPromise=require('bluebird');var rs=require(_0x088c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x088c('0x3'));var logger=require(_0x088c('0x4'))(_0x088c('0x5'));var config=require(_0x088c('0x6'));var jayson=require(_0x088c('0x7'));var client=jayson[_0x088c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18a09a,_0x44f89b,_0x4e0d2d){return new BPromise(function(_0xa09013,_0x50f61c){return client[_0x088c('0x9')](_0x18a09a,_0x4e0d2d)['then'](function(_0x446e05){logger[_0x088c('0xa')](_0x088c('0xb'),_0x44f89b,_0x088c('0xc'));logger[_0x088c('0xd')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x44f89b,_0x088c('0xc'),JSON[_0x088c('0xe')](_0x446e05));if(_0x446e05['error']){if(_0x446e05[_0x088c('0xf')]['code']===0x1f4){logger[_0x088c('0xf')](_0x088c('0xb'),_0x44f89b,_0x446e05[_0x088c('0xf')]['message']);return _0x50f61c(_0x446e05[_0x088c('0xf')][_0x088c('0x10')]);}logger[_0x088c('0xf')](_0x088c('0xb'),_0x44f89b,_0x446e05['error']['message']);return _0xa09013(_0x446e05[_0x088c('0xf')][_0x088c('0x10')]);}else{logger['info'](_0x088c('0xb'),_0x44f89b,'request\x20sent');_0xa09013(_0x446e05[_0x088c('0x11')][_0x088c('0x10')]);}})[_0x088c('0x12')](function(_0x10a216){logger[_0x088c('0xf')](_0x088c('0xb'),_0x44f89b,_0x10a216);_0x50f61c(_0x10a216);});});} \ No newline at end of file +var _0x82df=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatApplication,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','bluebird','ioredis','../../mysqldb'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x82df,0xb1));var _0xf82d=function(_0xefd9a0,_0x663dcd){_0xefd9a0=_0xefd9a0-0x0;var _0x355f43=_0x82df[_0xefd9a0];return _0x355f43;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xf82d('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf82d('0x1'));var db=require(_0xf82d('0x2'))['db'];var utils=require(_0xf82d('0x3'));var logger=require('../../config/logger')(_0xf82d('0x4'));var config=require(_0xf82d('0x5'));var jayson=require(_0xf82d('0x6'));var client=jayson[_0xf82d('0x7')][_0xf82d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x6853b5,_0x4878a0,_0x18ea7a){return new BPromise(function(_0x7d3cd0,_0x5a7bc4){return client[_0xf82d('0x9')](_0x6853b5,_0x18ea7a)[_0xf82d('0xa')](function(_0x300cad){logger['info'](_0xf82d('0xb'),_0x4878a0,_0xf82d('0xc'));logger['debug']('ChatApplication,\x20%s,\x20%s,\x20%s',_0x4878a0,_0xf82d('0xc'),JSON['stringify'](_0x300cad));if(_0x300cad[_0xf82d('0xd')]){if(_0x300cad[_0xf82d('0xd')]['code']===0x1f4){logger[_0xf82d('0xd')]('ChatApplication,\x20%s,\x20%s',_0x4878a0,_0x300cad['error']['message']);return _0x5a7bc4(_0x300cad[_0xf82d('0xd')][_0xf82d('0xe')]);}logger['error'](_0xf82d('0xb'),_0x4878a0,_0x300cad['error']['message']);return _0x7d3cd0(_0x300cad['error']['message']);}else{logger[_0xf82d('0xf')](_0xf82d('0xb'),_0x4878a0,_0xf82d('0xc'));_0x7d3cd0(_0x300cad[_0xf82d('0x10')][_0xf82d('0xe')]);}})[_0xf82d('0x11')](function(_0x1996b8){logger['error'](_0xf82d('0xb'),_0x4878a0,_0x1996b8);_0x5a7bc4(_0x1996b8);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 3d18269..529ca3c 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 _0x4fb3=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatApplication.controller','/:id','isAuthenticated','show','exports','multer'];(function(_0x33ca22,_0xbcc94){var _0x1790c3=function(_0x448b06){while(--_0x448b06){_0x33ca22['push'](_0x33ca22['shift']());}};_0x1790c3(++_0xbcc94);}(_0x4fb3,0xb5));var _0x34fb=function(_0x300e3a,_0x25164b){_0x300e3a=_0x300e3a-0x0;var _0xbdd812=_0x4fb3[_0x300e3a];return _0xbdd812;};'use strict';var multer=require(_0x34fb('0x0'));var util=require('util');var path=require(_0x34fb('0x1'));var timeout=require(_0x34fb('0x2'));var express=require(_0x34fb('0x3'));var router=express[_0x34fb('0x4')]();var fs_extra=require(_0x34fb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x34fb('0x6'));var config=require(_0x34fb('0x7'));var controller=require(_0x34fb('0x8'));router['get'](_0x34fb('0x9'),auth[_0x34fb('0xa')](),controller[_0x34fb('0xb')]);router['put'](_0x34fb('0x9'),auth[_0x34fb('0xa')](),controller['update']);router['delete'](_0x34fb('0x9'),auth[_0x34fb('0xa')](),controller['destroy']);module[_0x34fb('0xc')]=router; \ No newline at end of file +var _0x42de=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0x42de,0x9d));var _0xe42d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x42de[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xe42d('0x0'));var util=require(_0xe42d('0x1'));var path=require(_0xe42d('0x2'));var timeout=require(_0xe42d('0x3'));var express=require(_0xe42d('0x4'));var router=express[_0xe42d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe42d('0x6'));var interaction=require(_0xe42d('0x7'));var config=require(_0xe42d('0x8'));var controller=require(_0xe42d('0x9'));router[_0xe42d('0xa')](_0xe42d('0xb'),auth[_0xe42d('0xc')](),controller[_0xe42d('0xd')]);router[_0xe42d('0xe')](_0xe42d('0xb'),auth['isAuthenticated'](),controller[_0xe42d('0xf')]);router[_0xe42d('0x10')](_0xe42d('0xb'),auth['isAuthenticated'](),controller[_0xe42d('0x11')]);module[_0xe42d('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 5b73301..de9bb02 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 _0x8b02=['STRING','BOOLEAN'];(function(_0x5452b9,_0x3e1158){var _0x218041=function(_0x566dd1){while(--_0x566dd1){_0x5452b9['push'](_0x5452b9['shift']());}};_0x218041(++_0x3e1158);}(_0x8b02,0x94));var _0x28b0=function(_0x1731bd,_0x4830f0){_0x1731bd=_0x1731bd-0x0;var _0x33e629=_0x8b02[_0x1731bd];return _0x33e629;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x28b0('0x0')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x28b0('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0xe0c1=['BOOLEAN','sequelize','exports','STRING'];(function(_0x5c3c83,_0x4929ef){var _0x1713b9=function(_0x1fd80d){while(--_0x1fd80d){_0x5c3c83['push'](_0x5c3c83['shift']());}};_0x1713b9(++_0x4929ef);}(_0xe0c1,0x175));var _0x1e0c=function(_0xa40467,_0x97ce36){_0xa40467=_0xa40467-0x0;var _0x12f835=_0xe0c1[_0xa40467];return _0x12f835;};'use strict';var Sequelize=require(_0x1e0c('0x0'));module[_0x1e0c('0x1')]={'name':{'type':Sequelize[_0x1e0c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x1e0c('0x2')]},'write':{'type':Sequelize[_0x1e0c('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index c75a874..acf327c 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 _0xc5d6=['order','sort','where','filters','pick','filter','merge','includeAll','include','rows','catch','show','params','rawAttributes','intersection','options','find','create','body','describe','ChatInternalMessage','user','toInteger','addMembers','ids','getMembers','findOne','nolimit','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','ChatGroup','fieldName','type','key','model','map','keys','query','attributes','fields','length','hasOwnProperty'];(function(_0x588460,_0x54b426){var _0x144a23=function(_0x5b7892){while(--_0x5b7892){_0x588460['push'](_0x588460['shift']());}};_0x144a23(++_0x54b426);}(_0xc5d6,0x19c));var _0x6c5d=function(_0x3c6efc,_0x44841d){_0x3c6efc=_0x3c6efc-0x0;var _0x386160=_0xc5d6[_0x3c6efc];return _0x386160;};'use strict';var emlformat=require(_0x6c5d('0x0'));var rimraf=require(_0x6c5d('0x1'));var zipdir=require(_0x6c5d('0x2'));var jsonpatch=require(_0x6c5d('0x3'));var rp=require('request-promise');var moment=require(_0x6c5d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6c5d('0x5'));var util=require('util');var path=require(_0x6c5d('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6c5d('0x7'));var fs=require('fs');var fs_extra=require(_0x6c5d('0x8'));var _=require(_0x6c5d('0x9'));var squel=require(_0x6c5d('0xa'));var crypto=require(_0x6c5d('0xb'));var jsforce=require(_0x6c5d('0xc'));var deskjs=require(_0x6c5d('0xd'));var toCsv=require(_0x6c5d('0xe'));var querystring=require(_0x6c5d('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6c5d('0x10'));var qs=require(_0x6c5d('0x11'));var as=require(_0x6c5d('0x12'));var hardwareService=require(_0x6c5d('0x13'));var logger=require(_0x6c5d('0x14'))(_0x6c5d('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x6c5d('0x16')]=_[_0x6c5d('0x17')](config[_0x6c5d('0x16')],{'host':_0x6c5d('0x18'),'port':0x18eb});var socket=require(_0x6c5d('0x19'))(new Redis(config['redis']));require(_0x6c5d('0x1a'))['register'](socket);function respondWithStatusCode(_0x122fc6,_0x5786e6){_0x5786e6=_0x5786e6||0xcc;return function(_0x17e933){if(_0x17e933){return _0x122fc6[_0x6c5d('0x1b')](_0x5786e6);}return _0x122fc6[_0x6c5d('0x1c')](_0x5786e6)[_0x6c5d('0x1d')]();};}function respondWithResult(_0x3b0683,_0x582353){_0x582353=_0x582353||0xc8;return function(_0x5c86e2){if(_0x5c86e2){return _0x3b0683[_0x6c5d('0x1c')](_0x582353)[_0x6c5d('0x1e')](_0x5c86e2);}};}function respondWithFilteredResult(_0x102e9f,_0x3a15c5){return function(_0x1fc128){if(_0x1fc128){var _0x4a1a14=typeof _0x3a15c5[_0x6c5d('0x1f')]==='undefined'&&typeof _0x3a15c5[_0x6c5d('0x20')]==='undefined';var _0x468972=_0x1fc128[_0x6c5d('0x21')];var _0x3ca9e3=_0x4a1a14?0x0:_0x3a15c5[_0x6c5d('0x1f')];var _0x5546a1=_0x4a1a14?_0x1fc128[_0x6c5d('0x21')]:_0x3a15c5[_0x6c5d('0x1f')]+_0x3a15c5['limit'];var _0x1c1a16;if(_0x5546a1>=_0x468972){_0x5546a1=_0x468972;_0x1c1a16=0xc8;}else{_0x1c1a16=0xce;}_0x102e9f[_0x6c5d('0x1c')](_0x1c1a16);return _0x102e9f['set'](_0x6c5d('0x22'),_0x3ca9e3+'-'+_0x5546a1+'/'+_0x468972)[_0x6c5d('0x1e')](_0x1fc128);}return null;};}function patchUpdates(_0x55a896){return function(_0x5b7914){try{jsonpatch[_0x6c5d('0x23')](_0x5b7914,_0x55a896,!![]);}catch(_0x164ed0){return BPromise[_0x6c5d('0x24')](_0x164ed0);}return _0x5b7914[_0x6c5d('0x25')]();};}function saveUpdates(_0x2134b0,_0x465202){return function(_0x4735bf){if(_0x4735bf){return _0x4735bf[_0x6c5d('0x26')](_0x2134b0)[_0x6c5d('0x27')](function(_0x4b67ed){return _0x4b67ed;});}return null;};}function removeEntity(_0x1fb2e2,_0x201602){return function(_0x29cdba){if(_0x29cdba){return _0x29cdba[_0x6c5d('0x28')]()[_0x6c5d('0x27')](function(){_0x1fb2e2[_0x6c5d('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x474443,_0x27ba8c){return function(_0x223229){if(!_0x223229){_0x474443['sendStatus'](0x194);}return _0x223229;};}function handleError(_0xb74692,_0x424fa2){_0x424fa2=_0x424fa2||0x1f4;return function(_0x922f2a){logger[_0x6c5d('0x29')](_0x922f2a[_0x6c5d('0x2a')]);if(_0x922f2a[_0x6c5d('0x2b')]){delete _0x922f2a[_0x6c5d('0x2b')];}_0xb74692[_0x6c5d('0x1c')](_0x424fa2)[_0x6c5d('0x2c')](_0x922f2a);};}exports[_0x6c5d('0x2d')]=function(_0xf7752c,_0x29f604){var _0x581824={},_0x4220da={},_0x3b0f03={'count':0x0,'rows':[]};var _0x44d7a7=_['map'](db[_0x6c5d('0x2e')]['rawAttributes'],function(_0xf8a441){return{'name':_0xf8a441[_0x6c5d('0x2f')],'type':_0xf8a441[_0x6c5d('0x30')][_0x6c5d('0x31')]};});_0x4220da[_0x6c5d('0x32')]=_[_0x6c5d('0x33')](_0x44d7a7,'name');_0x4220da['query']=_[_0x6c5d('0x34')](_0xf7752c[_0x6c5d('0x35')]);_0x4220da['filters']=_['intersection'](_0x4220da['model'],_0x4220da[_0x6c5d('0x35')]);_0x581824[_0x6c5d('0x36')]=_['intersection'](_0x4220da[_0x6c5d('0x32')],qs[_0x6c5d('0x37')](_0xf7752c[_0x6c5d('0x35')][_0x6c5d('0x37')]));_0x581824['attributes']=_0x581824['attributes'][_0x6c5d('0x38')]?_0x581824[_0x6c5d('0x36')]:_0x4220da['model'];if(!_0xf7752c[_0x6c5d('0x35')][_0x6c5d('0x39')]('nolimit')){_0x581824['limit']=qs[_0x6c5d('0x20')](_0xf7752c[_0x6c5d('0x35')][_0x6c5d('0x20')]);_0x581824['offset']=qs[_0x6c5d('0x1f')](_0xf7752c[_0x6c5d('0x35')][_0x6c5d('0x1f')]);}_0x581824[_0x6c5d('0x3a')]=qs[_0x6c5d('0x3b')](_0xf7752c[_0x6c5d('0x35')][_0x6c5d('0x3b')]);_0x581824[_0x6c5d('0x3c')]=qs[_0x6c5d('0x3d')](_[_0x6c5d('0x3e')](_0xf7752c[_0x6c5d('0x35')],_0x4220da['filters']),_0x44d7a7);if(_0xf7752c[_0x6c5d('0x35')][_0x6c5d('0x3f')]){_0x581824[_0x6c5d('0x3c')]=_[_0x6c5d('0x40')](_0x581824[_0x6c5d('0x3c')],{'$or':_[_0x6c5d('0x33')](_0x44d7a7,function(_0x23d0d7){if(_0x23d0d7[_0x6c5d('0x30')]!=='VIRTUAL'){var _0x4714fc={};_0x4714fc[_0x23d0d7[_0x6c5d('0x2b')]]={'$like':'%'+_0xf7752c['query'][_0x6c5d('0x3f')]+'%'};return _0x4714fc;}})});}_0x581824=_[_0x6c5d('0x40')]({},_0x581824,_0xf7752c['options']);var _0x37f300={'where':_0x581824['where']};return db[_0x6c5d('0x2e')][_0x6c5d('0x21')](_0x37f300)[_0x6c5d('0x27')](function(_0x1fbdb6){_0x3b0f03[_0x6c5d('0x21')]=_0x1fbdb6;if(_0xf7752c[_0x6c5d('0x35')][_0x6c5d('0x41')]){_0x581824[_0x6c5d('0x42')]=[{'all':!![]}];}return db[_0x6c5d('0x2e')]['findAll'](_0x581824);})[_0x6c5d('0x27')](function(_0x16b9f4){_0x3b0f03[_0x6c5d('0x43')]=_0x16b9f4;return _0x3b0f03;})[_0x6c5d('0x27')](respondWithFilteredResult(_0x29f604,_0x581824))[_0x6c5d('0x44')](handleError(_0x29f604,null));};exports[_0x6c5d('0x45')]=function(_0x217ec4,_0x1338b4){var _0x9dbfc2={'raw':!![],'where':{'id':_0x217ec4[_0x6c5d('0x46')]['id']}},_0xb9a0bb={};_0xb9a0bb['model']=_[_0x6c5d('0x34')](db[_0x6c5d('0x2e')][_0x6c5d('0x47')]);_0xb9a0bb['query']=_[_0x6c5d('0x34')](_0x217ec4[_0x6c5d('0x35')]);_0xb9a0bb[_0x6c5d('0x3d')]=_[_0x6c5d('0x48')](_0xb9a0bb[_0x6c5d('0x32')],_0xb9a0bb['query']);_0x9dbfc2[_0x6c5d('0x36')]=_[_0x6c5d('0x48')](_0xb9a0bb[_0x6c5d('0x32')],qs[_0x6c5d('0x37')](_0x217ec4[_0x6c5d('0x35')][_0x6c5d('0x37')]));_0x9dbfc2[_0x6c5d('0x36')]=_0x9dbfc2[_0x6c5d('0x36')][_0x6c5d('0x38')]?_0x9dbfc2['attributes']:_0xb9a0bb[_0x6c5d('0x32')];if(_0x217ec4[_0x6c5d('0x35')][_0x6c5d('0x41')]){_0x9dbfc2[_0x6c5d('0x42')]=[{'all':!![]}];}_0x9dbfc2=_[_0x6c5d('0x40')]({},_0x9dbfc2,_0x217ec4[_0x6c5d('0x49')]);return db[_0x6c5d('0x2e')][_0x6c5d('0x4a')](_0x9dbfc2)[_0x6c5d('0x27')](handleEntityNotFound(_0x1338b4,null))[_0x6c5d('0x27')](respondWithResult(_0x1338b4,null))[_0x6c5d('0x44')](handleError(_0x1338b4,null));};exports[_0x6c5d('0x4b')]=function(_0x871037,_0x10ef98){return db[_0x6c5d('0x2e')][_0x6c5d('0x4b')](_0x871037[_0x6c5d('0x4c')],{})[_0x6c5d('0x27')](respondWithResult(_0x10ef98,0xc9))['catch'](handleError(_0x10ef98,null));};exports[_0x6c5d('0x26')]=function(_0x491194,_0x3998da){if(_0x491194[_0x6c5d('0x4c')]['id']){delete _0x491194[_0x6c5d('0x4c')]['id'];}return db['ChatGroup'][_0x6c5d('0x4a')]({'where':{'id':_0x491194[_0x6c5d('0x46')]['id']}})[_0x6c5d('0x27')](handleEntityNotFound(_0x3998da,null))['then'](saveUpdates(_0x491194['body'],null))[_0x6c5d('0x27')](respondWithResult(_0x3998da,null))[_0x6c5d('0x44')](handleError(_0x3998da,null));};exports[_0x6c5d('0x28')]=function(_0x3f2fd3,_0x52365f){return db['ChatGroup'][_0x6c5d('0x4a')]({'where':{'id':_0x3f2fd3[_0x6c5d('0x46')]['id']}})['then'](handleEntityNotFound(_0x52365f,null))[_0x6c5d('0x27')](removeEntity(_0x52365f,null))[_0x6c5d('0x44')](handleError(_0x52365f,null));};exports[_0x6c5d('0x4d')]=function(_0xb97c00,_0x2d731e){return db['ChatGroup'][_0x6c5d('0x4d')]()[_0x6c5d('0x27')](respondWithResult(_0x2d731e,null))[_0x6c5d('0x44')](handleError(_0x2d731e,null));};exports['getUnread']=function(_0xcf571e,_0x4c90ea,_0x39b014){return db[_0x6c5d('0x4e')][_0x6c5d('0x21')]({'where':{'ChatGroupId':_0xcf571e[_0x6c5d('0x46')]['id'],'ToId':_0xcf571e[_0x6c5d('0x4f')]['id'],'read':![]}})[_0x6c5d('0x27')](function(_0x35bf31){return{'id':_[_0x6c5d('0x50')](_0xcf571e['params']['id']),'count':_0x35bf31};})[_0x6c5d('0x27')](respondWithResult(_0x4c90ea,null))[_0x6c5d('0x44')](handleError(_0x4c90ea,null));};exports[_0x6c5d('0x51')]=function(_0x445a92,_0x258351,_0x28473d){return db['ChatGroup']['find']({'where':{'id':_0x445a92[_0x6c5d('0x46')]['id']}})['then'](handleEntityNotFound(_0x258351,null))[_0x6c5d('0x27')](function(_0x11ccf8){if(_0x11ccf8){return _0x11ccf8[_0x6c5d('0x51')](_0x445a92[_0x6c5d('0x4c')][_0x6c5d('0x52')],_['omit'](_0x445a92[_0x6c5d('0x4c')],[_0x6c5d('0x52'),'id'])||{});}})[_0x6c5d('0x27')](respondWithResult(_0x258351,null))['catch'](handleError(_0x258351,null));};exports[_0x6c5d('0x53')]=function(_0x509a07,_0x4dd3d1,_0x3dd8ab){var _0x4785e5={};var _0x523c18={};var _0x343f03;var _0x4eedc4;return db['ChatGroup'][_0x6c5d('0x54')]({'where':{'id':_0x509a07[_0x6c5d('0x46')]['id']}})['then'](handleEntityNotFound(_0x4dd3d1,null))['then'](function(_0x11189b){if(_0x11189b){_0x343f03=_0x11189b;_0x523c18[_0x6c5d('0x32')]=_[_0x6c5d('0x34')](db['User']['rawAttributes']);_0x523c18[_0x6c5d('0x35')]=_[_0x6c5d('0x34')](_0x509a07[_0x6c5d('0x35')]);_0x523c18[_0x6c5d('0x3d')]=_[_0x6c5d('0x48')](_0x523c18['model'],_0x523c18[_0x6c5d('0x35')]);_0x4785e5['attributes']=_['intersection'](_0x523c18['model'],qs['fields'](_0x509a07[_0x6c5d('0x35')][_0x6c5d('0x37')]));_0x4785e5[_0x6c5d('0x36')]=_0x4785e5[_0x6c5d('0x36')][_0x6c5d('0x38')]?_0x4785e5[_0x6c5d('0x36')]:_0x523c18[_0x6c5d('0x32')];_0x4785e5['order']=qs['sort'](_0x509a07[_0x6c5d('0x35')][_0x6c5d('0x3b')]);_0x4785e5['where']=qs[_0x6c5d('0x3d')](_[_0x6c5d('0x3e')](_0x509a07['query'],_0x523c18['filters']));if(_0x509a07[_0x6c5d('0x35')][_0x6c5d('0x3f')]){_0x4785e5['where']=_[_0x6c5d('0x40')](_0x4785e5[_0x6c5d('0x3c')],{'$or':_[_0x6c5d('0x33')](_0x4785e5[_0x6c5d('0x36')],function(_0x207b7d){var _0x1661ec={};_0x1661ec[_0x207b7d]={'$like':'%'+_0x509a07[_0x6c5d('0x35')]['filter']+'%'};return _0x1661ec;})});}_0x4785e5=_[_0x6c5d('0x40')]({},_0x4785e5,_0x509a07[_0x6c5d('0x49')]);return _0x343f03['getMembers'](_0x4785e5);}})[_0x6c5d('0x27')](function(_0x1638a9){if(_0x1638a9){_0x4eedc4=_0x1638a9[_0x6c5d('0x38')];if(!_0x509a07['query']['hasOwnProperty'](_0x6c5d('0x55'))){_0x4785e5[_0x6c5d('0x20')]=qs[_0x6c5d('0x20')](_0x509a07['query']['limit']);_0x4785e5['offset']=qs['offset'](_0x509a07[_0x6c5d('0x35')]['offset']);}return _0x343f03[_0x6c5d('0x53')](_0x4785e5);}})['then'](function(_0x3f5f44){if(_0x3f5f44){return _0x3f5f44?{'count':_0x4eedc4,'rows':_0x3f5f44}:null;}})[_0x6c5d('0x27')](respondWithResult(_0x4dd3d1,null))['catch'](handleError(_0x4dd3d1,null));};exports[_0x6c5d('0x56')]=function(_0x3a0d63,_0x4c6a39,_0x4e7c16){return db[_0x6c5d('0x2e')][_0x6c5d('0x4a')]({'where':{'id':_0x3a0d63[_0x6c5d('0x46')]['id']}})[_0x6c5d('0x27')](handleEntityNotFound(_0x4c6a39,null))['then'](function(_0xb1737){if(_0xb1737){return _0xb1737[_0x6c5d('0x56')](_0x3a0d63[_0x6c5d('0x35')][_0x6c5d('0x52')]);}})[_0x6c5d('0x27')](respondWithStatusCode(_0x4c6a39,null))[_0x6c5d('0x44')](handleError(_0x4c6a39,null));};exports[_0x6c5d('0x57')]=function(_0x33e9dd,_0x46be47,_0x36c566){if(_0x33e9dd[_0x6c5d('0x4c')]['id']){delete _0x33e9dd[_0x6c5d('0x4c')]['id'];}return db[_0x6c5d('0x2e')]['find']({'where':{'id':_0x33e9dd[_0x6c5d('0x46')]['id']}})[_0x6c5d('0x27')](handleEntityNotFound(_0x46be47,null))[_0x6c5d('0x27')](function(_0x149924){if(_0x149924){_0x33e9dd[_0x6c5d('0x4c')][_0x6c5d('0x58')]=_0x149924['id'];return db[_0x6c5d('0x4e')]['create'](_0x33e9dd[_0x6c5d('0x4c')]);}})[_0x6c5d('0x27')](respondWithResult(_0x46be47,null))[_0x6c5d('0x44')](handleError(_0x46be47,null));};exports[_0x6c5d('0x59')]=function(_0x4f90cd,_0x5e8d59,_0x2772e9){var _0x43347e={};var _0x36632e={};var _0x281849;var _0x831f5;return db[_0x6c5d('0x2e')]['findOne']({'where':{'id':_0x4f90cd[_0x6c5d('0x46')]['id']}})[_0x6c5d('0x27')](handleEntityNotFound(_0x5e8d59,null))[_0x6c5d('0x27')](function(_0x47c19d){if(_0x47c19d){_0x281849=_0x47c19d;_0x36632e[_0x6c5d('0x32')]=_[_0x6c5d('0x34')](db[_0x6c5d('0x4e')][_0x6c5d('0x47')]);_0x36632e[_0x6c5d('0x35')]=_[_0x6c5d('0x34')](_0x4f90cd[_0x6c5d('0x35')]);_0x36632e['filters']=_[_0x6c5d('0x48')](_0x36632e[_0x6c5d('0x32')],_0x36632e[_0x6c5d('0x35')]);_0x43347e[_0x6c5d('0x36')]=_[_0x6c5d('0x48')](_0x36632e[_0x6c5d('0x32')],qs[_0x6c5d('0x37')](_0x4f90cd[_0x6c5d('0x35')]['fields']));_0x43347e[_0x6c5d('0x36')]=_0x43347e[_0x6c5d('0x36')]['length']?_0x43347e['attributes']:_0x36632e[_0x6c5d('0x32')];_0x43347e[_0x6c5d('0x3a')]=qs[_0x6c5d('0x3b')](_0x4f90cd[_0x6c5d('0x35')][_0x6c5d('0x3b')]);_0x43347e[_0x6c5d('0x3c')]=qs[_0x6c5d('0x3d')](_[_0x6c5d('0x3e')](_0x4f90cd['query'],_0x36632e[_0x6c5d('0x3d')]));if(_0x4f90cd[_0x6c5d('0x35')][_0x6c5d('0x3f')]){_0x43347e['where']=_[_0x6c5d('0x40')](_0x43347e[_0x6c5d('0x3c')],{'$or':_[_0x6c5d('0x33')](_0x43347e[_0x6c5d('0x36')],function(_0x1c3e48){var _0xcc0b48={};_0xcc0b48[_0x1c3e48]={'$like':'%'+_0x4f90cd[_0x6c5d('0x35')][_0x6c5d('0x3f')]+'%'};return _0xcc0b48;})});}if(_0x4f90cd[_0x6c5d('0x35')][_0x6c5d('0x5a')]){var _0x1eca20=_0x4f90cd[_0x6c5d('0x35')][_0x6c5d('0x5a')][_0x6c5d('0x5b')](',');var _0x3eb113={};_0x3eb113[_0x1eca20[0x0]]={'$gte':moment(_0x1eca20[0x1])[_0x6c5d('0x5c')](_0x6c5d('0x5d'))};_0x43347e[_0x6c5d('0x3c')]=_[_0x6c5d('0x40')](_0x43347e['where'],_0x3eb113);}_0x43347e=_[_0x6c5d('0x40')]({},_0x43347e,_0x4f90cd[_0x6c5d('0x49')]);return _0x281849[_0x6c5d('0x59')](_0x43347e);}})[_0x6c5d('0x27')](function(_0x1a92ca){if(_0x1a92ca){_0x831f5=_0x1a92ca['length'];if(!_0x4f90cd[_0x6c5d('0x35')][_0x6c5d('0x39')]('nolimit')){_0x43347e[_0x6c5d('0x20')]=qs[_0x6c5d('0x20')](_0x4f90cd[_0x6c5d('0x35')][_0x6c5d('0x20')]);_0x43347e[_0x6c5d('0x1f')]=qs[_0x6c5d('0x1f')](_0x4f90cd[_0x6c5d('0x35')][_0x6c5d('0x1f')]);}return _0x281849[_0x6c5d('0x59')](_0x43347e);}})[_0x6c5d('0x27')](function(_0x3caf05){if(_0x3caf05){return _0x3caf05?{'count':_0x831f5,'rows':_0x3caf05}:null;}})[_0x6c5d('0x27')](respondWithResult(_0x5e8d59,null))[_0x6c5d('0x44')](handleError(_0x5e8d59,null));}; \ No newline at end of file +var _0x40e2=['redis','./chatGroup.socket','register','offset','limit','undefined','count','status','Content-Range','json','apply','reject','save','update','then','end','stack','name','map','ChatGroup','rawAttributes','fieldName','type','key','keys','query','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','include','find','create','body','destroy','describe','ChatInternalMessage','toInteger','addMembers','ids','getMembers','findOne','User','removeMembers','addMessage','ChatGroupId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter'];(function(_0x187399,_0x40c56d){var _0x40fa92=function(_0x36058c){while(--_0x36058c){_0x187399['push'](_0x187399['shift']());}};_0x40fa92(++_0x40c56d);}(_0x40e2,0x15d));var _0x240e=function(_0x42abd1,_0x7d92f2){_0x42abd1=_0x42abd1-0x0;var _0x115bc1=_0x40e2[_0x42abd1];return _0x115bc1;};'use strict';var emlformat=require(_0x240e('0x0'));var rimraf=require(_0x240e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x240e('0x2'));var moment=require(_0x240e('0x3'));var BPromise=require(_0x240e('0x4'));var Mustache=require(_0x240e('0x5'));var util=require('util');var path=require(_0x240e('0x6'));var sox=require(_0x240e('0x7'));var csv=require(_0x240e('0x8'));var ejs=require(_0x240e('0x9'));var fs=require('fs');var fs_extra=require(_0x240e('0xa'));var _=require(_0x240e('0xb'));var squel=require(_0x240e('0xc'));var crypto=require(_0x240e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x240e('0xe'));var toCsv=require('to-csv');var querystring=require(_0x240e('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x240e('0x10'));var qs=require(_0x240e('0x11'));var as=require(_0x240e('0x12'));var hardwareService=require(_0x240e('0x13'));var logger=require('../../config/logger')(_0x240e('0x14'));var utils=require(_0x240e('0x15'));var config=require(_0x240e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x240e('0x17'))['db'];config['redis']=_[_0x240e('0x18')](config['redis'],{'host':_0x240e('0x19'),'port':0x18eb});var socket=require(_0x240e('0x1a'))(new Redis(config[_0x240e('0x1b')]));require(_0x240e('0x1c'))[_0x240e('0x1d')](socket);function respondWithStatusCode(_0x4ea60b,_0x117244){_0x117244=_0x117244||0xcc;return function(_0x5db782){if(_0x5db782){return _0x4ea60b['sendStatus'](_0x117244);}return _0x4ea60b['status'](_0x117244)['end']();};}function respondWithResult(_0x189a08,_0x2966ac){_0x2966ac=_0x2966ac||0xc8;return function(_0x44c50c){if(_0x44c50c){return _0x189a08['status'](_0x2966ac)['json'](_0x44c50c);}};}function respondWithFilteredResult(_0x2dc614,_0x1572c8){return function(_0x2b80b4){if(_0x2b80b4){var _0x427c2f=typeof _0x1572c8[_0x240e('0x1e')]==='undefined'&&typeof _0x1572c8[_0x240e('0x1f')]===_0x240e('0x20');var _0x26a4de=_0x2b80b4['count'];var _0x174452=_0x427c2f?0x0:_0x1572c8[_0x240e('0x1e')];var _0x4517e5=_0x427c2f?_0x2b80b4[_0x240e('0x21')]:_0x1572c8[_0x240e('0x1e')]+_0x1572c8[_0x240e('0x1f')];var _0x441f6e;if(_0x4517e5>=_0x26a4de){_0x4517e5=_0x26a4de;_0x441f6e=0xc8;}else{_0x441f6e=0xce;}_0x2dc614[_0x240e('0x22')](_0x441f6e);return _0x2dc614['set'](_0x240e('0x23'),_0x174452+'-'+_0x4517e5+'/'+_0x26a4de)[_0x240e('0x24')](_0x2b80b4);}return null;};}function patchUpdates(_0x170a9c){return function(_0x233bcd){try{jsonpatch[_0x240e('0x25')](_0x233bcd,_0x170a9c,!![]);}catch(_0x38ad95){return BPromise[_0x240e('0x26')](_0x38ad95);}return _0x233bcd[_0x240e('0x27')]();};}function saveUpdates(_0x47fbd1,_0xf1f331){return function(_0x1b4e96){if(_0x1b4e96){return _0x1b4e96[_0x240e('0x28')](_0x47fbd1)[_0x240e('0x29')](function(_0x4fcb21){return _0x4fcb21;});}return null;};}function removeEntity(_0x3c6e9d,_0x14da96){return function(_0xaef70a){if(_0xaef70a){return _0xaef70a['destroy']()[_0x240e('0x29')](function(){_0x3c6e9d[_0x240e('0x22')](0xcc)[_0x240e('0x2a')]();});}};}function handleEntityNotFound(_0x390c98,_0x4953cc){return function(_0x4c8082){if(!_0x4c8082){_0x390c98['sendStatus'](0x194);}return _0x4c8082;};}function handleError(_0x47e1cf,_0x5a5060){_0x5a5060=_0x5a5060||0x1f4;return function(_0x4b9b57){logger['error'](_0x4b9b57[_0x240e('0x2b')]);if(_0x4b9b57[_0x240e('0x2c')]){delete _0x4b9b57[_0x240e('0x2c')];}_0x47e1cf[_0x240e('0x22')](_0x5a5060)['send'](_0x4b9b57);};}exports['index']=function(_0x45217,_0x291b49){var _0x4da16d={},_0x4f78d8={},_0x37a24a={'count':0x0,'rows':[]};var _0x492b4d=_[_0x240e('0x2d')](db[_0x240e('0x2e')][_0x240e('0x2f')],function(_0x172709){return{'name':_0x172709[_0x240e('0x30')],'type':_0x172709[_0x240e('0x31')][_0x240e('0x32')]};});_0x4f78d8['model']=_[_0x240e('0x2d')](_0x492b4d,_0x240e('0x2c'));_0x4f78d8['query']=_[_0x240e('0x33')](_0x45217[_0x240e('0x34')]);_0x4f78d8['filters']=_['intersection'](_0x4f78d8[_0x240e('0x35')],_0x4f78d8['query']);_0x4da16d['attributes']=_[_0x240e('0x36')](_0x4f78d8[_0x240e('0x35')],qs['fields'](_0x45217[_0x240e('0x34')][_0x240e('0x37')]));_0x4da16d[_0x240e('0x38')]=_0x4da16d[_0x240e('0x38')][_0x240e('0x39')]?_0x4da16d[_0x240e('0x38')]:_0x4f78d8[_0x240e('0x35')];if(!_0x45217[_0x240e('0x34')][_0x240e('0x3a')](_0x240e('0x3b'))){_0x4da16d[_0x240e('0x1f')]=qs[_0x240e('0x1f')](_0x45217[_0x240e('0x34')][_0x240e('0x1f')]);_0x4da16d[_0x240e('0x1e')]=qs[_0x240e('0x1e')](_0x45217['query'][_0x240e('0x1e')]);}_0x4da16d[_0x240e('0x3c')]=qs[_0x240e('0x3d')](_0x45217['query'][_0x240e('0x3d')]);_0x4da16d[_0x240e('0x3e')]=qs[_0x240e('0x3f')](_[_0x240e('0x40')](_0x45217['query'],_0x4f78d8[_0x240e('0x3f')]),_0x492b4d);if(_0x45217[_0x240e('0x34')][_0x240e('0x41')]){_0x4da16d['where']=_[_0x240e('0x42')](_0x4da16d['where'],{'$or':_[_0x240e('0x2d')](_0x492b4d,function(_0x5f0ad1){if(_0x5f0ad1['type']!==_0x240e('0x43')){var _0x4f3de5={};_0x4f3de5[_0x5f0ad1[_0x240e('0x2c')]]={'$like':'%'+_0x45217[_0x240e('0x34')][_0x240e('0x41')]+'%'};return _0x4f3de5;}})});}_0x4da16d=_[_0x240e('0x42')]({},_0x4da16d,_0x45217[_0x240e('0x44')]);var _0x45376c={'where':_0x4da16d['where']};return db[_0x240e('0x2e')][_0x240e('0x21')](_0x45376c)[_0x240e('0x29')](function(_0x406d82){_0x37a24a[_0x240e('0x21')]=_0x406d82;if(_0x45217['query'][_0x240e('0x45')]){_0x4da16d['include']=[{'all':!![]}];}return db['ChatGroup'][_0x240e('0x46')](_0x4da16d);})[_0x240e('0x29')](function(_0x394b5e){_0x37a24a['rows']=_0x394b5e;return _0x37a24a;})['then'](respondWithFilteredResult(_0x291b49,_0x4da16d))[_0x240e('0x47')](handleError(_0x291b49,null));};exports[_0x240e('0x48')]=function(_0x756b96,_0x5433e8){var _0x3b7bde={'raw':!![],'where':{'id':_0x756b96[_0x240e('0x49')]['id']}},_0x596658={};_0x596658['model']=_[_0x240e('0x33')](db[_0x240e('0x2e')][_0x240e('0x2f')]);_0x596658[_0x240e('0x34')]=_[_0x240e('0x33')](_0x756b96[_0x240e('0x34')]);_0x596658[_0x240e('0x3f')]=_[_0x240e('0x36')](_0x596658[_0x240e('0x35')],_0x596658['query']);_0x3b7bde[_0x240e('0x38')]=_['intersection'](_0x596658[_0x240e('0x35')],qs['fields'](_0x756b96['query'][_0x240e('0x37')]));_0x3b7bde['attributes']=_0x3b7bde[_0x240e('0x38')][_0x240e('0x39')]?_0x3b7bde[_0x240e('0x38')]:_0x596658[_0x240e('0x35')];if(_0x756b96[_0x240e('0x34')][_0x240e('0x45')]){_0x3b7bde[_0x240e('0x4a')]=[{'all':!![]}];}_0x3b7bde=_[_0x240e('0x42')]({},_0x3b7bde,_0x756b96[_0x240e('0x44')]);return db['ChatGroup'][_0x240e('0x4b')](_0x3b7bde)['then'](handleEntityNotFound(_0x5433e8,null))['then'](respondWithResult(_0x5433e8,null))['catch'](handleError(_0x5433e8,null));};exports[_0x240e('0x4c')]=function(_0x3ff153,_0x19f6e3){return db['ChatGroup'][_0x240e('0x4c')](_0x3ff153[_0x240e('0x4d')],{})[_0x240e('0x29')](respondWithResult(_0x19f6e3,0xc9))[_0x240e('0x47')](handleError(_0x19f6e3,null));};exports[_0x240e('0x28')]=function(_0x2638d1,_0x28e0c6){if(_0x2638d1['body']['id']){delete _0x2638d1[_0x240e('0x4d')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x2638d1['params']['id']}})[_0x240e('0x29')](handleEntityNotFound(_0x28e0c6,null))[_0x240e('0x29')](saveUpdates(_0x2638d1['body'],null))['then'](respondWithResult(_0x28e0c6,null))[_0x240e('0x47')](handleError(_0x28e0c6,null));};exports[_0x240e('0x4e')]=function(_0x4e10c4,_0x3dd92e){return db[_0x240e('0x2e')][_0x240e('0x4b')]({'where':{'id':_0x4e10c4['params']['id']}})[_0x240e('0x29')](handleEntityNotFound(_0x3dd92e,null))[_0x240e('0x29')](removeEntity(_0x3dd92e,null))[_0x240e('0x47')](handleError(_0x3dd92e,null));};exports[_0x240e('0x4f')]=function(_0x34893e,_0x4947da){return db[_0x240e('0x2e')][_0x240e('0x4f')]()['then'](respondWithResult(_0x4947da,null))[_0x240e('0x47')](handleError(_0x4947da,null));};exports['getUnread']=function(_0x5ef313,_0x1d2bae,_0x26aa2f){return db[_0x240e('0x50')]['count']({'where':{'ChatGroupId':_0x5ef313[_0x240e('0x49')]['id'],'ToId':_0x5ef313['user']['id'],'read':![]}})[_0x240e('0x29')](function(_0x316acd){return{'id':_[_0x240e('0x51')](_0x5ef313['params']['id']),'count':_0x316acd};})[_0x240e('0x29')](respondWithResult(_0x1d2bae,null))['catch'](handleError(_0x1d2bae,null));};exports[_0x240e('0x52')]=function(_0x1835a6,_0x409048,_0x48fe52){return db[_0x240e('0x2e')][_0x240e('0x4b')]({'where':{'id':_0x1835a6[_0x240e('0x49')]['id']}})[_0x240e('0x29')](handleEntityNotFound(_0x409048,null))[_0x240e('0x29')](function(_0x540c47){if(_0x540c47){return _0x540c47[_0x240e('0x52')](_0x1835a6[_0x240e('0x4d')][_0x240e('0x53')],_['omit'](_0x1835a6['body'],[_0x240e('0x53'),'id'])||{});}})[_0x240e('0x29')](respondWithResult(_0x409048,null))['catch'](handleError(_0x409048,null));};exports[_0x240e('0x54')]=function(_0x2376e8,_0x1e15f4,_0x596959){var _0x314776={};var _0x3a7c78={};var _0x414ae7;var _0x402fa8;return db['ChatGroup'][_0x240e('0x55')]({'where':{'id':_0x2376e8[_0x240e('0x49')]['id']}})[_0x240e('0x29')](handleEntityNotFound(_0x1e15f4,null))['then'](function(_0x3c1659){if(_0x3c1659){_0x414ae7=_0x3c1659;_0x3a7c78[_0x240e('0x35')]=_[_0x240e('0x33')](db[_0x240e('0x56')][_0x240e('0x2f')]);_0x3a7c78[_0x240e('0x34')]=_[_0x240e('0x33')](_0x2376e8['query']);_0x3a7c78['filters']=_[_0x240e('0x36')](_0x3a7c78['model'],_0x3a7c78[_0x240e('0x34')]);_0x314776[_0x240e('0x38')]=_['intersection'](_0x3a7c78[_0x240e('0x35')],qs[_0x240e('0x37')](_0x2376e8[_0x240e('0x34')][_0x240e('0x37')]));_0x314776[_0x240e('0x38')]=_0x314776[_0x240e('0x38')][_0x240e('0x39')]?_0x314776[_0x240e('0x38')]:_0x3a7c78[_0x240e('0x35')];_0x314776['order']=qs[_0x240e('0x3d')](_0x2376e8['query'][_0x240e('0x3d')]);_0x314776['where']=qs[_0x240e('0x3f')](_[_0x240e('0x40')](_0x2376e8[_0x240e('0x34')],_0x3a7c78[_0x240e('0x3f')]));if(_0x2376e8[_0x240e('0x34')][_0x240e('0x41')]){_0x314776[_0x240e('0x3e')]=_[_0x240e('0x42')](_0x314776[_0x240e('0x3e')],{'$or':_[_0x240e('0x2d')](_0x314776[_0x240e('0x38')],function(_0x19f9e1){var _0x960955={};_0x960955[_0x19f9e1]={'$like':'%'+_0x2376e8[_0x240e('0x34')]['filter']+'%'};return _0x960955;})});}_0x314776=_['merge']({},_0x314776,_0x2376e8[_0x240e('0x44')]);return _0x414ae7[_0x240e('0x54')](_0x314776);}})['then'](function(_0x40353f){if(_0x40353f){_0x402fa8=_0x40353f[_0x240e('0x39')];if(!_0x2376e8[_0x240e('0x34')][_0x240e('0x3a')](_0x240e('0x3b'))){_0x314776['limit']=qs[_0x240e('0x1f')](_0x2376e8['query'][_0x240e('0x1f')]);_0x314776['offset']=qs[_0x240e('0x1e')](_0x2376e8[_0x240e('0x34')][_0x240e('0x1e')]);}return _0x414ae7[_0x240e('0x54')](_0x314776);}})[_0x240e('0x29')](function(_0x1be30d){if(_0x1be30d){return _0x1be30d?{'count':_0x402fa8,'rows':_0x1be30d}:null;}})['then'](respondWithResult(_0x1e15f4,null))[_0x240e('0x47')](handleError(_0x1e15f4,null));};exports[_0x240e('0x57')]=function(_0x5ef2a8,_0x35736e,_0x163d49){return db[_0x240e('0x2e')]['find']({'where':{'id':_0x5ef2a8[_0x240e('0x49')]['id']}})[_0x240e('0x29')](handleEntityNotFound(_0x35736e,null))[_0x240e('0x29')](function(_0x5f2004){if(_0x5f2004){return _0x5f2004[_0x240e('0x57')](_0x5ef2a8[_0x240e('0x34')][_0x240e('0x53')]);}})['then'](respondWithStatusCode(_0x35736e,null))['catch'](handleError(_0x35736e,null));};exports[_0x240e('0x58')]=function(_0x4bd5db,_0x5c5dba,_0x52e7e9){if(_0x4bd5db[_0x240e('0x4d')]['id']){delete _0x4bd5db['body']['id'];}return db[_0x240e('0x2e')][_0x240e('0x4b')]({'where':{'id':_0x4bd5db[_0x240e('0x49')]['id']}})[_0x240e('0x29')](handleEntityNotFound(_0x5c5dba,null))[_0x240e('0x29')](function(_0x9ecc39){if(_0x9ecc39){_0x4bd5db['body'][_0x240e('0x59')]=_0x9ecc39['id'];return db[_0x240e('0x50')][_0x240e('0x4c')](_0x4bd5db['body']);}})[_0x240e('0x29')](respondWithResult(_0x5c5dba,null))[_0x240e('0x47')](handleError(_0x5c5dba,null));};exports['getMessages']=function(_0x3841ec,_0x5e8e55,_0x15e8f6){var _0x322249={};var _0x37a370={};var _0x5a88d4;var _0x3c8773;return db[_0x240e('0x2e')]['findOne']({'where':{'id':_0x3841ec['params']['id']}})[_0x240e('0x29')](handleEntityNotFound(_0x5e8e55,null))[_0x240e('0x29')](function(_0x599b9d){if(_0x599b9d){_0x5a88d4=_0x599b9d;_0x37a370[_0x240e('0x35')]=_[_0x240e('0x33')](db[_0x240e('0x50')][_0x240e('0x2f')]);_0x37a370[_0x240e('0x34')]=_[_0x240e('0x33')](_0x3841ec['query']);_0x37a370[_0x240e('0x3f')]=_[_0x240e('0x36')](_0x37a370['model'],_0x37a370[_0x240e('0x34')]);_0x322249[_0x240e('0x38')]=_['intersection'](_0x37a370['model'],qs[_0x240e('0x37')](_0x3841ec[_0x240e('0x34')]['fields']));_0x322249[_0x240e('0x38')]=_0x322249[_0x240e('0x38')][_0x240e('0x39')]?_0x322249[_0x240e('0x38')]:_0x37a370[_0x240e('0x35')];_0x322249[_0x240e('0x3c')]=qs[_0x240e('0x3d')](_0x3841ec['query'][_0x240e('0x3d')]);_0x322249[_0x240e('0x3e')]=qs[_0x240e('0x3f')](_[_0x240e('0x40')](_0x3841ec[_0x240e('0x34')],_0x37a370[_0x240e('0x3f')]));if(_0x3841ec['query'][_0x240e('0x41')]){_0x322249[_0x240e('0x3e')]=_[_0x240e('0x42')](_0x322249[_0x240e('0x3e')],{'$or':_[_0x240e('0x2d')](_0x322249[_0x240e('0x38')],function(_0x21a7a8){var _0x12e549={};_0x12e549[_0x21a7a8]={'$like':'%'+_0x3841ec['query']['filter']+'%'};return _0x12e549;})});}if(_0x3841ec[_0x240e('0x34')]['$gte']){var _0x5683cf=_0x3841ec[_0x240e('0x34')][_0x240e('0x5a')][_0x240e('0x5b')](',');var _0x33136f={};_0x33136f[_0x5683cf[0x0]]={'$gte':moment(_0x5683cf[0x1])[_0x240e('0x5c')](_0x240e('0x5d'))};_0x322249[_0x240e('0x3e')]=_[_0x240e('0x42')](_0x322249[_0x240e('0x3e')],_0x33136f);}_0x322249=_[_0x240e('0x42')]({},_0x322249,_0x3841ec[_0x240e('0x44')]);return _0x5a88d4['getMessages'](_0x322249);}})[_0x240e('0x29')](function(_0x268dfc){if(_0x268dfc){_0x3c8773=_0x268dfc[_0x240e('0x39')];if(!_0x3841ec[_0x240e('0x34')][_0x240e('0x3a')](_0x240e('0x3b'))){_0x322249[_0x240e('0x1f')]=qs[_0x240e('0x1f')](_0x3841ec[_0x240e('0x34')][_0x240e('0x1f')]);_0x322249[_0x240e('0x1e')]=qs[_0x240e('0x1e')](_0x3841ec[_0x240e('0x34')][_0x240e('0x1e')]);}return _0x5a88d4['getMessages'](_0x322249);}})[_0x240e('0x29')](function(_0xed495c){if(_0xed495c){return _0xed495c?{'count':_0x3c8773,'rows':_0xed495c}:null;}})['then'](respondWithResult(_0x5e8e55,null))[_0x240e('0x47')](handleError(_0x5e8e55,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 0a0aad0..b7658ab 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 _0x0b36=['ChatGroup','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x2f47a9,_0x4805d8){var _0x560aa3=function(_0x1df9e4){while(--_0x1df9e4){_0x2f47a9['push'](_0x2f47a9['shift']());}};_0x560aa3(++_0x4805d8);}(_0x0b36,0x10c));var _0x60b3=function(_0x419e17,_0x7fe78c){_0x419e17=_0x419e17-0x0;var _0x1f2044=_0x0b36[_0x419e17];return _0x1f2044;};'use strict';var EventEmitter=require(_0x60b3('0x0'));var ChatGroup=require(_0x60b3('0x1'))['db'][_0x60b3('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x60b3('0x3')};function emitEvent(_0x530d5b){return function(_0xa0e029,_0x19dbae,_0x3afbc7){ChatGroupEvents[_0x60b3('0x4')](_0x530d5b+':'+_0xa0e029['id'],_0xa0e029);ChatGroupEvents[_0x60b3('0x4')](_0x530d5b,_0xa0e029);_0x3afbc7(null);};}for(var e in events){if(events[_0x60b3('0x5')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x8786=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','ChatGroup'];(function(_0x48ac17,_0x1147b5){var _0x12c118=function(_0x1b9bdc){while(--_0x1b9bdc){_0x48ac17['push'](_0x48ac17['shift']());}};_0x12c118(++_0x1147b5);}(_0x8786,0x153));var _0x6878=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x8786[_0x1035c1];return _0x308d67;};'use strict';var EventEmitter=require(_0x6878('0x0'));var ChatGroup=require(_0x6878('0x1'))['db'][_0x6878('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6878('0x3'),'afterUpdate':_0x6878('0x4'),'afterDestroy':_0x6878('0x5')};function emitEvent(_0x57ff21){return function(_0x347e06,_0x439475,_0x23647a){ChatGroupEvents[_0x6878('0x6')](_0x57ff21+':'+_0x347e06['id'],_0x347e06);ChatGroupEvents['emit'](_0x57ff21,_0x347e06);_0x23647a(null);};}for(var e in events){if(events[_0x6878('0x7')](e)){var event=events[e];ChatGroup[_0x6878('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 81bec29..c6bf1c5 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 _0x29f6=['api','moment','path','rimraf','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','../../config/logger'];(function(_0x330414,_0x4f3207){var _0x99dbff=function(_0x166f85){while(--_0x166f85){_0x330414['push'](_0x330414['shift']());}};_0x99dbff(++_0x4f3207);}(_0x29f6,0xb9));var _0x629f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x29f6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x629f('0x0'));var util=require('util');var logger=require(_0x629f('0x1'))(_0x629f('0x2'));var moment=require(_0x629f('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x629f('0x4'));var rimraf=require(_0x629f('0x5'));var config=require('../../config/environment');var attributes=require(_0x629f('0x6'));module[_0x629f('0x7')]=function(_0x57554c,_0x1a92e2){return _0x57554c[_0x629f('0x8')](_0x629f('0x9'),attributes,{'tableName':_0x629f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf1d5=['lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','define','ChatGroup'];(function(_0x2a3688,_0x3923aa){var _0x255227=function(_0x5d9443){while(--_0x5d9443){_0x2a3688['push'](_0x2a3688['shift']());}};_0x255227(++_0x3923aa);}(_0xf1d5,0x96));var _0x5f1d=function(_0x222240,_0x465d97){_0x222240=_0x222240-0x0;var _0xbe0206=_0xf1d5[_0x222240];return _0xbe0206;};'use strict';var _=require(_0x5f1d('0x0'));var util=require('util');var logger=require(_0x5f1d('0x1'))(_0x5f1d('0x2'));var moment=require('moment');var BPromise=require(_0x5f1d('0x3'));var rp=require(_0x5f1d('0x4'));var fs=require('fs');var path=require(_0x5f1d('0x5'));var rimraf=require('rimraf');var config=require(_0x5f1d('0x6'));var attributes=require('./chatGroup.attributes');module[_0x5f1d('0x7')]=function(_0x7f1525,_0x29b2f7){return _0x7f1525[_0x5f1d('0x8')](_0x5f1d('0x9'),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 392df3f..e4673d8 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 _0xad86=['ChatGroup,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','./chatGroup.socket','register','request','then','request\x20sent','debug','error','message'];(function(_0x2f7d02,_0x21afa7){var _0x3969ec=function(_0x32aa8e){while(--_0x32aa8e){_0x2f7d02['push'](_0x2f7d02['shift']());}};_0x3969ec(++_0x21afa7);}(_0xad86,0x194));var _0x6ad8=function(_0x51793f,_0xeefc7e){_0x51793f=_0x51793f-0x0;var _0x14b589=_0xad86[_0x51793f];return _0x14b589;};'use strict';var _=require(_0x6ad8('0x0'));var util=require(_0x6ad8('0x1'));var moment=require(_0x6ad8('0x2'));var BPromise=require(_0x6ad8('0x3'));var rs=require(_0x6ad8('0x4'));var fs=require('fs');var Redis=require(_0x6ad8('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6ad8('0x6'))(_0x6ad8('0x7'));var config=require(_0x6ad8('0x8'));var jayson=require(_0x6ad8('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x6ad8('0xa')]=_[_0x6ad8('0xb')](config[_0x6ad8('0xa')],{'host':_0x6ad8('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6ad8('0xd'))[_0x6ad8('0xe')](socket);function respondWithRpcPromise(_0x3a9cae,_0x1c04bc,_0x355abf){return new BPromise(function(_0x3a6b94,_0x41332f){return client[_0x6ad8('0xf')](_0x3a9cae,_0x355abf)[_0x6ad8('0x10')](function(_0x5ca991){logger['info']('ChatGroup,\x20%s,\x20%s',_0x1c04bc,_0x6ad8('0x11'));logger[_0x6ad8('0x12')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x1c04bc,_0x6ad8('0x11'),JSON['stringify'](_0x5ca991));if(_0x5ca991[_0x6ad8('0x13')]){if(_0x5ca991[_0x6ad8('0x13')]['code']===0x1f4){logger[_0x6ad8('0x13')]('ChatGroup,\x20%s,\x20%s',_0x1c04bc,_0x5ca991[_0x6ad8('0x13')][_0x6ad8('0x14')]);return _0x41332f(_0x5ca991[_0x6ad8('0x13')][_0x6ad8('0x14')]);}logger['error'](_0x6ad8('0x15'),_0x1c04bc,_0x5ca991[_0x6ad8('0x13')][_0x6ad8('0x14')]);return _0x3a6b94(_0x5ca991[_0x6ad8('0x13')]['message']);}else{logger[_0x6ad8('0x16')](_0x6ad8('0x15'),_0x1c04bc,'request\x20sent');_0x3a6b94(_0x5ca991[_0x6ad8('0x17')]['message']);}})[_0x6ad8('0x18')](function(_0x157fa2){logger[_0x6ad8('0x13')](_0x6ad8('0x15'),_0x1c04bc,_0x157fa2);_0x41332f(_0x157fa2);});});} \ No newline at end of file +var _0x3148=['ChatGroup,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./chatGroup.socket','register','request','then','info'];(function(_0x6845ef,_0x3c578b){var _0x57bd16=function(_0x5c5591){while(--_0x5c5591){_0x6845ef['push'](_0x6845ef['shift']());}};_0x57bd16(++_0x3c578b);}(_0x3148,0x1d3));var _0x8314=function(_0x29f82c,_0x5a6380){_0x29f82c=_0x29f82c-0x0;var _0x58a330=_0x3148[_0x29f82c];return _0x58a330;};'use strict';var _=require(_0x8314('0x0'));var util=require(_0x8314('0x1'));var moment=require('moment');var BPromise=require(_0x8314('0x2'));var rs=require(_0x8314('0x3'));var fs=require('fs');var Redis=require(_0x8314('0x4'));var db=require(_0x8314('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8314('0x6'))(_0x8314('0x7'));var config=require(_0x8314('0x8'));var jayson=require(_0x8314('0x9'));var client=jayson[_0x8314('0xa')][_0x8314('0xb')]({'port':0x232a});config[_0x8314('0xc')]=_['defaults'](config[_0x8314('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x8314('0xd'))(new Redis(config[_0x8314('0xc')]));require(_0x8314('0xe'))[_0x8314('0xf')](socket);function respondWithRpcPromise(_0x118966,_0x5284ac,_0x5b5459){return new BPromise(function(_0xfaf56c,_0x34b949){return client[_0x8314('0x10')](_0x118966,_0x5b5459)[_0x8314('0x11')](function(_0x5cf1cf){logger[_0x8314('0x12')](_0x8314('0x13'),_0x5284ac,'request\x20sent');logger[_0x8314('0x14')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x5284ac,'request\x20sent',JSON[_0x8314('0x15')](_0x5cf1cf));if(_0x5cf1cf[_0x8314('0x16')]){if(_0x5cf1cf[_0x8314('0x16')][_0x8314('0x17')]===0x1f4){logger['error'](_0x8314('0x13'),_0x5284ac,_0x5cf1cf[_0x8314('0x16')][_0x8314('0x18')]);return _0x34b949(_0x5cf1cf[_0x8314('0x16')][_0x8314('0x18')]);}logger[_0x8314('0x16')]('ChatGroup,\x20%s,\x20%s',_0x5284ac,_0x5cf1cf['error'][_0x8314('0x18')]);return _0xfaf56c(_0x5cf1cf[_0x8314('0x16')][_0x8314('0x18')]);}else{logger['info'](_0x8314('0x13'),_0x5284ac,_0x8314('0x19'));_0xfaf56c(_0x5cf1cf['result'][_0x8314('0x18')]);}})[_0x8314('0x1a')](function(_0x4ac7c8){logger[_0x8314('0x16')]('ChatGroup,\x20%s,\x20%s',_0x5284ac,_0x4ac7c8);_0x34b949(_0x4ac7c8);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 7745d61..99a1a0c 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 _0x6ad9=['update','emit','removeListener','register','length','./chatGroup.events','save','remove'];(function(_0x51a415,_0xf9de36){var _0x16f409=function(_0x2f0dd9){while(--_0x2f0dd9){_0x51a415['push'](_0x51a415['shift']());}};_0x16f409(++_0xf9de36);}(_0x6ad9,0x1bd));var _0x96ad=function(_0x11d0a5,_0x4ecf1f){_0x11d0a5=_0x11d0a5-0x0;var _0x5b1ff4=_0x6ad9[_0x11d0a5];return _0x5b1ff4;};'use strict';var ChatGroupEvents=require(_0x96ad('0x0'));var events=[_0x96ad('0x1'),_0x96ad('0x2'),_0x96ad('0x3')];function createListener(_0x26a951,_0x5724b1){return function(_0xbd7176){_0x5724b1[_0x96ad('0x4')](_0x26a951,_0xbd7176);};}function removeListener(_0x5a4b01,_0x2b241b){return function(){ChatGroupEvents[_0x96ad('0x5')](_0x5a4b01,_0x2b241b);};}exports[_0x96ad('0x6')]=function(_0x5d0be9){for(var _0x10daff=0x0,_0x5c3970=events[_0x96ad('0x7')];_0x10daff<_0x5c3970;_0x10daff++){var _0x4db874=events[_0x10daff];var _0x15a9fe=createListener('chatGroup:'+_0x4db874,_0x5d0be9);ChatGroupEvents['on'](_0x4db874,_0x15a9fe);}}; \ No newline at end of file +var _0x8e53=['length','chatGroup:','./chatGroup.events','update','register'];(function(_0x5f0c5f,_0x1a58ae){var _0x2112e3=function(_0x419017){while(--_0x419017){_0x5f0c5f['push'](_0x5f0c5f['shift']());}};_0x2112e3(++_0x1a58ae);}(_0x8e53,0x1d8));var _0x38e5=function(_0x8522bf,_0x5d0930){_0x8522bf=_0x8522bf-0x0;var _0x32a616=_0x8e53[_0x8522bf];return _0x32a616;};'use strict';var ChatGroupEvents=require(_0x38e5('0x0'));var events=['save','remove',_0x38e5('0x1')];function createListener(_0x20654c,_0x304fed){return function(_0x41c1de){_0x304fed['emit'](_0x20654c,_0x41c1de);};}function removeListener(_0x29c26e,_0x2f0de0){return function(){ChatGroupEvents['removeListener'](_0x29c26e,_0x2f0de0);};}exports[_0x38e5('0x2')]=function(_0x5c692f){for(var _0x132b26=0x0,_0x206e96=events[_0x38e5('0x3')];_0x132b26<_0x206e96;_0x132b26++){var _0xd7b1c5=events[_0x132b26];var _0x4bd88a=createListener(_0x38e5('0x4')+_0xd7b1c5,_0x5c692f);ChatGroupEvents['on'](_0xd7b1c5,_0x4bd88a);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index e73af23..4da985b 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 _0x0283=['../../components/auth/service','./chatGroup.controller','get','index','/describe','/:id','isAuthenticated','show','/:id/unread','getUnread','getMessages','post','create','/:id/members','addMembers','/:id/messages','addMessage','update','delete','removeMembers','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x4ebd4b,_0x460f6b){var _0x40db91=function(_0x2d947c){while(--_0x2d947c){_0x4ebd4b['push'](_0x4ebd4b['shift']());}};_0x40db91(++_0x460f6b);}(_0x0283,0xa1));var _0x3028=function(_0x9b2bb0,_0x3965b1){_0x9b2bb0=_0x9b2bb0-0x0;var _0x2cdb3b=_0x0283[_0x9b2bb0];return _0x2cdb3b;};'use strict';var multer=require(_0x3028('0x0'));var util=require(_0x3028('0x1'));var path=require(_0x3028('0x2'));var timeout=require(_0x3028('0x3'));var express=require(_0x3028('0x4'));var router=express[_0x3028('0x5')]();var fs_extra=require(_0x3028('0x6'));var auth=require(_0x3028('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3028('0x8'));router[_0x3028('0x9')]('/',auth['isAuthenticated'](),controller[_0x3028('0xa')]);router[_0x3028('0x9')](_0x3028('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x3028('0x9')](_0x3028('0xc'),auth[_0x3028('0xd')](),controller[_0x3028('0xe')]);router['get'](_0x3028('0xf'),auth['isAuthenticated'](),controller[_0x3028('0x10')]);router[_0x3028('0x9')]('/:id/members',auth[_0x3028('0xd')](),controller['getMembers']);router[_0x3028('0x9')]('/:id/messages',auth[_0x3028('0xd')](),controller[_0x3028('0x11')]);router[_0x3028('0x12')]('/',auth[_0x3028('0xd')](),controller[_0x3028('0x13')]);router['post'](_0x3028('0x14'),auth[_0x3028('0xd')](),controller[_0x3028('0x15')]);router['post'](_0x3028('0x16'),auth['isAuthenticated'](),controller[_0x3028('0x17')]);router['put']('/:id',auth[_0x3028('0xd')](),controller[_0x3028('0x18')]);router[_0x3028('0x19')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x3028('0x19')](_0x3028('0x14'),auth[_0x3028('0xd')](),controller[_0x3028('0x1a')]);module[_0x3028('0x1b')]=router; \ No newline at end of file +var _0x90cc=['../../config/environment','./chatGroup.controller','isAuthenticated','index','/describe','describe','/:id','show','/:id/unread','getUnread','get','/:id/members','getMembers','/:id/messages','getMessages','create','post','addMessage','put','update','delete','removeMembers','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x36b9ba,_0x1a935a){var _0x5ad6d3=function(_0x1b44ca){while(--_0x1b44ca){_0x36b9ba['push'](_0x36b9ba['shift']());}};_0x5ad6d3(++_0x1a935a);}(_0x90cc,0xd1));var _0xc90c=function(_0x169c54,_0x5d3841){_0x169c54=_0x169c54-0x0;var _0x928a9b=_0x90cc[_0x169c54];return _0x928a9b;};'use strict';var multer=require('multer');var util=require(_0xc90c('0x0'));var path=require(_0xc90c('0x1'));var timeout=require(_0xc90c('0x2'));var express=require(_0xc90c('0x3'));var router=express[_0xc90c('0x4')]();var fs_extra=require(_0xc90c('0x5'));var auth=require(_0xc90c('0x6'));var interaction=require(_0xc90c('0x7'));var config=require(_0xc90c('0x8'));var controller=require(_0xc90c('0x9'));router['get']('/',auth[_0xc90c('0xa')](),controller[_0xc90c('0xb')]);router['get'](_0xc90c('0xc'),auth[_0xc90c('0xa')](),controller[_0xc90c('0xd')]);router['get'](_0xc90c('0xe'),auth[_0xc90c('0xa')](),controller[_0xc90c('0xf')]);router['get'](_0xc90c('0x10'),auth[_0xc90c('0xa')](),controller[_0xc90c('0x11')]);router[_0xc90c('0x12')](_0xc90c('0x13'),auth['isAuthenticated'](),controller[_0xc90c('0x14')]);router[_0xc90c('0x12')](_0xc90c('0x15'),auth[_0xc90c('0xa')](),controller[_0xc90c('0x16')]);router['post']('/',auth[_0xc90c('0xa')](),controller[_0xc90c('0x17')]);router[_0xc90c('0x18')](_0xc90c('0x13'),auth[_0xc90c('0xa')](),controller['addMembers']);router['post'](_0xc90c('0x15'),auth[_0xc90c('0xa')](),controller[_0xc90c('0x19')]);router[_0xc90c('0x1a')](_0xc90c('0xe'),auth[_0xc90c('0xa')](),controller[_0xc90c('0x1b')]);router[_0xc90c('0x1c')]('/:id',auth[_0xc90c('0xa')](),controller['destroy']);router[_0xc90c('0x1c')](_0xc90c('0x13'),auth['isAuthenticated'](),controller[_0xc90c('0x1d')]);module[_0xc90c('0x1e')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index ef83828..d35c8c1 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 _0x765d=['out','sequelize','exports','BOOLEAN','INTEGER','ENUM','thumb','star','TEXT','DATE','STRING'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x765d,0xd2));var _0xd765=function(_0x18cbd6,_0x1633d2){_0x18cbd6=_0x18cbd6-0x0;var _0x441c99=_0x765d[_0x18cbd6];return _0x441c99;};'use strict';var Sequelize=require(_0xd765('0x0'));module[_0xd765('0x1')]={'closed':{'type':Sequelize[_0xd765('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xd765('0x3')]},'ratingType':{'type':Sequelize[_0xd765('0x4')]('star',_0xd765('0x5')),'defaultValue':_0xd765('0x6')},'ratingMessage':{'type':Sequelize[_0xd765('0x7')]},'pathTranscript':{'type':Sequelize[_0xd765('0x7')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xd765('0x8')]},'disposition':{'type':Sequelize[_0xd765('0x9')]},'secondDisposition':{'type':Sequelize[_0xd765('0x9')]},'thirdDisposition':{'type':Sequelize[_0xd765('0x9')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0xd765('0x9')]},'browserVersion':{'type':Sequelize[_0xd765('0x9')]},'osName':{'type':Sequelize[_0xd765('0x9')]},'osVersion':{'type':Sequelize[_0xd765('0x9')]},'deviceModel':{'type':Sequelize[_0xd765('0x9')]},'deviceVendor':{'type':Sequelize[_0xd765('0x9')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0xd765('0x7')]},'customerIp':{'type':Sequelize[_0xd765('0x9')]},'formData':{'type':Sequelize[_0xd765('0x7')]('long')},'read1stAt':{'type':Sequelize[_0xd765('0x8')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xd765('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xd765('0x9')]},'customerPort':{'type':Sequelize[_0xd765('0x9')]},'vidaooSessionId':{'type':Sequelize[_0xd765('0x7')]},'autoreplyExecuted':{'type':Sequelize[_0xd765('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xd765('0x3')]}}; \ No newline at end of file +var _0x1cdf=['exports','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','out'];(function(_0x4e9d27,_0x8f7f92){var _0x2b1a38=function(_0xae029d){while(--_0xae029d){_0x4e9d27['push'](_0x4e9d27['shift']());}};_0x2b1a38(++_0x8f7f92);}(_0x1cdf,0xf3));var _0xf1cd=function(_0x46939d,_0xc1b36d){_0x46939d=_0x46939d-0x0;var _0x5105e8=_0x1cdf[_0x46939d];return _0x5105e8;};'use strict';var Sequelize=require('sequelize');module[_0xf1cd('0x0')]={'closed':{'type':Sequelize[_0xf1cd('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xf1cd('0x2')]},'ratingType':{'type':Sequelize[_0xf1cd('0x3')](_0xf1cd('0x4'),_0xf1cd('0x5')),'defaultValue':_0xf1cd('0x4')},'ratingMessage':{'type':Sequelize[_0xf1cd('0x6')]},'pathTranscript':{'type':Sequelize[_0xf1cd('0x6')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xf1cd('0x7')]},'secondDisposition':{'type':Sequelize[_0xf1cd('0x7')]},'thirdDisposition':{'type':Sequelize[_0xf1cd('0x7')]},'note':{'type':Sequelize[_0xf1cd('0x7')]},'browserName':{'type':Sequelize[_0xf1cd('0x7')]},'browserVersion':{'type':Sequelize[_0xf1cd('0x7')]},'osName':{'type':Sequelize[_0xf1cd('0x7')]},'osVersion':{'type':Sequelize[_0xf1cd('0x7')]},'deviceModel':{'type':Sequelize[_0xf1cd('0x7')]},'deviceVendor':{'type':Sequelize[_0xf1cd('0x7')]},'deviceType':{'type':Sequelize[_0xf1cd('0x7')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0xf1cd('0x7')]},'formData':{'type':Sequelize[_0xf1cd('0x6')]('long')},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xf1cd('0x3')]('in',_0xf1cd('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xf1cd('0x7')]},'customerPort':{'type':Sequelize[_0xf1cd('0x7')]},'vidaooSessionId':{'type':Sequelize[_0xf1cd('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0xf1cd('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 33724f7..fe6b6bc 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 _0xfc64=['destroy','stack','name','send','merge','body','contact','agent','interaction','account','index','map','ChatInteraction','fieldName','type','key','getOptions','findAll','chat','params','keys','rawAttributes','query','filters','model','attributes','intersection','fields','length','include','options','find','create','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','user','fullname','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','vidaooNote','vidaooMetadata','metadata','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandon','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','originalname','basename','file','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','root','join','download','close','mailTranscript','server/files/chat/upload/','format','now','pathTranscript','User','ContactId','Messages','agentAlias','System','customer','%s%d','Visitor','agentIdentifier','website_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','MailServerOut','Smtp','CloudProvider','getSmtpOptions','sendMail','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','order','sort','where','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','hasOwnProperty','includeAgent','addTags','setTags','omit','spread','emit','removeTags','unix','toString','server','tmp','push','firstName','lastName','attachments','read','Owner','mkdirSync','Chat','Account','N.A.','closedAt','browserName','osName','referer','customerIp','customerPort','existsSync','pipe','createWriteStream','value','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','moment','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update'];(function(_0x1b1426,_0x5a45e9){var _0x44b0d5=function(_0x48317b){while(--_0x48317b){_0x1b1426['push'](_0x1b1426['shift']());}};_0x44b0d5(++_0x5a45e9);}(_0xfc64,0x9f));var _0x4fc6=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xfc64[_0x6131cd];return _0x47e916;};'use strict';var rimraf=require(_0x4fc6('0x0'));var zipdir=require(_0x4fc6('0x1'));var rp=require('request-promise');var moment=require(_0x4fc6('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0x4fc6('0x3'));var Redis=require(_0x4fc6('0x4'));var interaction=require(_0x4fc6('0x5'));var qs=require('../../components/parsers/qs');var pdf=require(_0x4fc6('0x6'));var logger=require(_0x4fc6('0x7'))(_0x4fc6('0x8'));var config=require('../../config/environment');var db=require(_0x4fc6('0x9'))['db'];config[_0x4fc6('0xa')]=_['defaults'](config[_0x4fc6('0xa')],{'host':_0x4fc6('0xb'),'port':0x18eb});var socket=require(_0x4fc6('0xc'))(new Redis(config[_0x4fc6('0xa')]));require(_0x4fc6('0xd'))[_0x4fc6('0xe')](socket);var jayson=require(_0x4fc6('0xf'));var client=jayson[_0x4fc6('0x10')][_0x4fc6('0x11')]({'port':0x232b});var client9004=jayson[_0x4fc6('0x10')][_0x4fc6('0x11')]({'port':0x232c});function respondWithRpcPromise(_0x25dd95,_0x4fd544,_0x3f0c88,_0x4990ce){return new BPromise(function(_0x23120e,_0x5b7852){var _0x49c388=_0x4990ce||client;return _0x49c388['request'](_0x25dd95,_0x3f0c88)[_0x4fc6('0x12')](function(_0xab8d70){logger['info'](_0x4fc6('0x13'),_0x4fd544,_0x4fc6('0x14'));logger[_0x4fc6('0x15')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x4fd544,'request\x20sent',JSON['stringify'](_0xab8d70));if(_0xab8d70['error']){if(_0xab8d70[_0x4fc6('0x16')][_0x4fc6('0x17')]===0x1f4){logger[_0x4fc6('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x4fd544,_0xab8d70['error'][_0x4fc6('0x18')]);return _0x5b7852(_0xab8d70[_0x4fc6('0x16')]['message']);}logger[_0x4fc6('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x4fd544,_0xab8d70[_0x4fc6('0x16')]['message']);return _0x23120e(_0xab8d70['error']['message']);}else{logger[_0x4fc6('0x19')]('ChatInteraction,\x20%s,\x20%s',_0x4fd544,_0x4fc6('0x14'));_0x23120e(_0xab8d70[_0x4fc6('0x1a')][_0x4fc6('0x18')]);}})[_0x4fc6('0x1b')](function(_0x11f4f8){logger[_0x4fc6('0x16')](_0x4fc6('0x13'),_0x4fd544,_0x11f4f8);_0x5b7852(_0x11f4f8);});});}function respondWithStatusCode(_0x1cc4bd,_0x4c78a7){_0x4c78a7=_0x4c78a7||0xcc;return function(_0x1814e5){if(_0x1814e5){return _0x1cc4bd[_0x4fc6('0x1c')](_0x4c78a7);}return _0x1cc4bd[_0x4fc6('0x1d')](_0x4c78a7)[_0x4fc6('0x1e')]();};}function respondWithResult(_0x35eab1,_0x1d12b3){_0x1d12b3=_0x1d12b3||0xc8;return function(_0x47b570){if(_0x47b570){return _0x35eab1[_0x4fc6('0x1d')](_0x1d12b3)[_0x4fc6('0x1f')](_0x47b570);}};}function respondWithFilteredResult(_0x4de676,_0xcc1f2f){return function(_0x8cbf49){if(_0x8cbf49){var _0x4baabd=typeof _0xcc1f2f[_0x4fc6('0x20')]==='undefined'&&typeof _0xcc1f2f[_0x4fc6('0x21')]===_0x4fc6('0x22');var _0x156b7f=_0x8cbf49[_0x4fc6('0x23')];var _0x5eac17=_0x4baabd?0x0:_0xcc1f2f[_0x4fc6('0x20')];var _0x3af3c8=_0x4baabd?_0x8cbf49[_0x4fc6('0x23')]:_0xcc1f2f[_0x4fc6('0x20')]+_0xcc1f2f['limit'];var _0x36ca34;if(_0x3af3c8>=_0x156b7f){_0x3af3c8=_0x156b7f;_0x36ca34=0xc8;}else{_0x36ca34=0xce;}_0x4de676[_0x4fc6('0x1d')](_0x36ca34);return _0x4de676[_0x4fc6('0x24')](_0x4fc6('0x25'),_0x5eac17+'-'+_0x3af3c8+'/'+_0x156b7f)[_0x4fc6('0x1f')](_0x8cbf49);}return null;};}function saveUpdates(_0x1f8edc){return function(_0x1e189a){if(_0x1e189a){return _0x1e189a[_0x4fc6('0x26')](_0x1f8edc)[_0x4fc6('0x12')](function(_0x508108){return _0x508108;});}return null;};}function removeEntity(_0xa3947e){return function(_0x219ef9){if(_0x219ef9){return _0x219ef9[_0x4fc6('0x27')]()['then'](function(){_0xa3947e[_0x4fc6('0x1d')](0xcc)[_0x4fc6('0x1e')]();});}};}function handleEntityNotFound(_0x5ceef0){return function(_0x506fbb){if(!_0x506fbb){_0x5ceef0[_0x4fc6('0x1c')](0x194);}return _0x506fbb;};}function handleError(_0xf776a5,_0x461ba){_0x461ba=_0x461ba||0x1f4;return function(_0x3f5e78){logger['error'](_0x3f5e78[_0x4fc6('0x28')]);if(_0x3f5e78[_0x4fc6('0x29')]){delete _0x3f5e78[_0x4fc6('0x29')];}_0xf776a5[_0x4fc6('0x1d')](_0x461ba)[_0x4fc6('0x2a')](_0x3f5e78);};}function getMustacheRender(_0x2880b7,_0x3100ce){return Mustache['render'](_0x2880b7,_[_0x4fc6('0x2b')](_0x3100ce[_0x4fc6('0x2c')],{'contact':_0x3100ce[_0x4fc6('0x2d')],'message':_0x3100ce[_0x4fc6('0x18')],'agent':_0x3100ce[_0x4fc6('0x2e')],'interaction':_0x3100ce[_0x4fc6('0x2f')],'account':_0x3100ce[_0x4fc6('0x30')]}))||'';}exports[_0x4fc6('0x31')]=function(_0x1542bd,_0x9475f5){var _0x49218e={};var _0x13a217=_[_0x4fc6('0x32')](db[_0x4fc6('0x33')]['rawAttributes'],function(_0x151029){return{'name':_0x151029[_0x4fc6('0x34')],'type':_0x151029[_0x4fc6('0x35')][_0x4fc6('0x36')]};});_0x49218e=qs[_0x4fc6('0x37')](_0x13a217,_0x1542bd);return interaction[_0x4fc6('0x38')](_0x4fc6('0x39'),_0x1542bd['query'],_0x1542bd['user'],_0x49218e,_0x13a217)['then'](respondWithFilteredResult(_0x9475f5,_0x49218e))[_0x4fc6('0x1b')](handleError(_0x9475f5,null));};exports['show']=function(_0x148850,_0x8d2329){var _0x3d8053={'raw':![],'where':{'id':_0x148850[_0x4fc6('0x3a')]['id']}},_0xa792ed={};_0xa792ed['model']=_[_0x4fc6('0x3b')](db[_0x4fc6('0x33')][_0x4fc6('0x3c')]);_0xa792ed[_0x4fc6('0x3d')]=_[_0x4fc6('0x3b')](_0x148850[_0x4fc6('0x3d')]);_0xa792ed[_0x4fc6('0x3e')]=_['intersection'](_0xa792ed[_0x4fc6('0x3f')],_0xa792ed[_0x4fc6('0x3d')]);_0x3d8053[_0x4fc6('0x40')]=_[_0x4fc6('0x41')](_0xa792ed['model'],qs[_0x4fc6('0x42')](_0x148850[_0x4fc6('0x3d')][_0x4fc6('0x42')]));_0x3d8053[_0x4fc6('0x40')]=_0x3d8053['attributes'][_0x4fc6('0x43')]?_0x3d8053[_0x4fc6('0x40')]:_0xa792ed[_0x4fc6('0x3f')];if(_0x148850[_0x4fc6('0x3d')]['includeAll']){_0x3d8053[_0x4fc6('0x44')]=[{'all':!![]}];}_0x3d8053=_['merge']({},_0x3d8053,_0x148850[_0x4fc6('0x45')]);return db[_0x4fc6('0x33')][_0x4fc6('0x46')](_0x3d8053)[_0x4fc6('0x12')](handleEntityNotFound(_0x8d2329,null))['then'](respondWithResult(_0x8d2329,null))[_0x4fc6('0x1b')](handleError(_0x8d2329,null));};exports[_0x4fc6('0x47')]=function(_0x1d28c6,_0x19132d){return db[_0x4fc6('0x33')][_0x4fc6('0x47')](_0x1d28c6['body'],{})[_0x4fc6('0x12')](respondWithResult(_0x19132d,0xc9))[_0x4fc6('0x1b')](handleError(_0x19132d,null));};exports[_0x4fc6('0x26')]=function(_0x54b28b,_0x4abaab){if(_0x54b28b[_0x4fc6('0x2c')]['id']){delete _0x54b28b[_0x4fc6('0x2c')]['id'];}return db[_0x4fc6('0x33')][_0x4fc6('0x46')]({'where':{'id':_0x54b28b[_0x4fc6('0x3a')]['id']}})[_0x4fc6('0x12')](handleEntityNotFound(_0x4abaab,null))['then'](saveUpdates(_0x54b28b[_0x4fc6('0x2c')],null))[_0x4fc6('0x12')](respondWithResult(_0x4abaab,null))['catch'](handleError(_0x4abaab,null));};exports[_0x4fc6('0x27')]=function(_0x1f458b,_0x460eb2){return db[_0x4fc6('0x33')][_0x4fc6('0x46')]({'where':{'id':_0x1f458b[_0x4fc6('0x3a')]['id']}})['then'](handleEntityNotFound(_0x460eb2,null))[_0x4fc6('0x12')](removeEntity(_0x460eb2,null))[_0x4fc6('0x1b')](handleError(_0x460eb2,null));};exports[_0x4fc6('0x48')]=function(_0xb6c9da,_0x1cd548){return db['ChatInteraction'][_0x4fc6('0x48')]()[_0x4fc6('0x12')](respondWithResult(_0x1cd548,null))['catch'](handleError(_0x1cd548,null));};exports[_0x4fc6('0x49')]=function(_0x678a15,_0x542bd5){var _0xc6db2e=_0x678a15[_0x4fc6('0x3a')]['id'];var _0x200fe6;var _0x1d24db;var _0x498c6d;return db[_0x4fc6('0x33')][_0x4fc6('0x4a')]({'where':{'id':_0xc6db2e}})[_0x4fc6('0x12')](function(_0x5b45d6){_0x200fe6=_0x5b45d6;return db[_0x4fc6('0x4b')]['findOne']({'where':{'id':_0x5b45d6[_0x4fc6('0x4c')]},'attributes':['id',_0x4fc6('0x4d'),_0x4fc6('0x4e'),_0x4fc6('0x4f'),'vidaooNote','vidaooMetadata'],'raw':!![]});})[_0x4fc6('0x12')](function(_0x50ce8c){if(_0x50ce8c&&_0x50ce8c[_0x4fc6('0x4d')]&&_0x50ce8c[_0x4fc6('0x4e')]){_0x1d24db=_0x50ce8c;var _0x45c24b={'interaction':{'id':_0xc6db2e},'agent':{'id':_0x678a15[_0x4fc6('0x50')]['id'],'name':_0x678a15[_0x4fc6('0x50')]['name'],'fullname':_0x678a15['user'][_0x4fc6('0x51')],'email':_0x678a15[_0x4fc6('0x50')]['email']},'contact':_0x678a15[_0x4fc6('0x2c')][_0x4fc6('0x2d')],'account':_0x678a15[_0x4fc6('0x2c')][_0x4fc6('0x30')]};var _0x190a07={'rejectUnauthorized':![],'method':_0x4fc6('0x52'),'url':_0x4fc6('0x53'),'headers':{'X-APIKEY':_0x50ce8c['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x678a15[_0x4fc6('0x50')]['email']],'buttons':null,'topic':_0x1d24db[_0x4fc6('0x4f')],'note':_[_0x4fc6('0x54')](_0x1d24db['vidaooNote'])?null:getMustacheRender(_0x1d24db[_0x4fc6('0x55')],_0x45c24b),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0x4fc6('0x54')](_0x1d24db[_0x4fc6('0x56')])){var _0x4832b7=getMustacheRender(_0x1d24db['vidaooMetadata'],_0x45c24b);var _0x588970=JSON['parse'](_0x4832b7);_0x190a07[_0x4fc6('0x2c')][_0x4fc6('0x57')]=_0x588970;}}catch(_0x43114c){throw new db[(_0x4fc6('0x58'))]['ValidationError']('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x190a07);}else{throw new db[(_0x4fc6('0x58'))][(_0x4fc6('0x59'))](_0x4fc6('0x5a'));}})[_0x4fc6('0x12')](function(_0x4a62fd){_0x498c6d=_0x4a62fd;if(_0x498c6d['id']){var _0x331a92={'body':_0x498c6d[_0x4fc6('0x5b')],'ChatWebsiteId':_0x1d24db['id'],'ChatInteractionId':_0x200fe6['id'],'direction':_0x4fc6('0x5c'),'UserId':_0x678a15['user']['id']};return db[_0x4fc6('0x5d')][_0x4fc6('0x47')](_0x331a92,{});}else{throw new db[(_0x4fc6('0x58'))][(_0x4fc6('0x59'))](_0x4fc6('0x5e'));}})['then'](function(){return _0x200fe6[_0x4fc6('0x5f')]({'vidaooSessionId':_0x498c6d['id']});})[_0x4fc6('0x12')](respondWithResult(_0x542bd5,null))['catch'](handleError(_0x542bd5,null));};exports[_0x4fc6('0x60')]=function(_0x3e4b17,_0xb94fbc){if(_0x3e4b17[_0x4fc6('0x2c')]['id']){delete _0x3e4b17['body']['id'];}return db[_0x4fc6('0x33')][_0x4fc6('0x46')]({'where':{'id':_0x3e4b17['params']['id']},'include':[{'model':db[_0x4fc6('0x61')],'as':_0x4fc6('0x62')}]})[_0x4fc6('0x12')](handleEntityNotFound(_0xb94fbc,null))[_0x4fc6('0x12')](saveUpdates(_0x3e4b17[_0x4fc6('0x2c')],null))[_0x4fc6('0x12')](respondWithResult(_0xb94fbc,null))['catch'](handleError(_0xb94fbc,null));};exports[_0x4fc6('0x63')]=function(_0x445a04,_0x214439){if(_0x445a04[_0x4fc6('0x2c')]['id']){delete _0x445a04['body']['id'];}return db[_0x4fc6('0x33')][_0x4fc6('0x46')]({'where':{'id':_0x445a04[_0x4fc6('0x3a')]['id']}})[_0x4fc6('0x12')](function(_0x566eb8){if(!_0x566eb8){logger[_0x4fc6('0x16')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x4fc6('0x63'),0x194,_0x4fc6('0x64'));_0x214439[_0x4fc6('0x1c')](0x194);}else{if(_0x566eb8[_0x4fc6('0x65')]){throw new db[(_0x4fc6('0x58'))][(_0x4fc6('0x59'))](_0x4fc6('0x66'));}}return _0x566eb8;})[_0x4fc6('0x12')](function(_0x298ea8){if(_0x298ea8){return _0x298ea8[_0x4fc6('0x26')]({'closed':_0x445a04[_0x4fc6('0x2c')][_0x4fc6('0x67')],'disposition':_0x445a04['body'][_0x4fc6('0x68')]})['then'](function(_0x218576){return _0x218576;});}})[_0x4fc6('0x12')](function(){return respondWithRpcPromise(_0x4fc6('0x69'),'abandon',_0x445a04[_0x4fc6('0x2c')],client9004);})['then'](respondWithResult(_0x214439,null))['catch'](handleError(_0x214439,null));};exports[_0x4fc6('0x6a')]=function(_0x1f7f8f,_0x881371){_0x1f7f8f['body'][_0x4fc6('0x29')]=_0x1f7f8f['file'][_0x4fc6('0x6b')];_0x1f7f8f[_0x4fc6('0x2c')][_0x4fc6('0x6c')]=_0x1f7f8f[_0x4fc6('0x6d')]['filename'];_0x1f7f8f[_0x4fc6('0x2c')]['type']=_0x1f7f8f['file'][_0x4fc6('0x6e')];return db[_0x4fc6('0x6f')]['create'](_0x1f7f8f[_0x4fc6('0x2c')])[_0x4fc6('0x12')](respondWithResult(_0x881371,0xc9))['catch'](handleError(_0x881371,null));};exports[_0x4fc6('0x70')]=function(_0x16ea78,_0x482fa6){return db[_0x4fc6('0x33')]['findOne']({'where':{'id':_0x16ea78['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x482fa6,null))[_0x4fc6('0x12')](function(_0x4e2f4f){if(_0x4e2f4f){if(_0x4e2f4f[_0x4fc6('0x67')]){return _0x482fa6['status'](0x193)[_0x4fc6('0x1f')]({'status':0x193,'message':_0x4fc6('0x71')});}return db[_0x4fc6('0x6f')]['findOne']({'where':{'id':_0x16ea78[_0x4fc6('0x3d')][_0x4fc6('0x72')]},'raw':!![]})[_0x4fc6('0x12')](handleEntityNotFound(_0x482fa6,null));}})[_0x4fc6('0x12')](function(_0x161c6b){if(_0x161c6b){var _0xd1278c=_0x161c6b['ChatOfflineMessageId']!==null;var _0x2c4159=path['join'](config[_0x4fc6('0x73')],'server/files/attachments/');if(_0xd1278c){_0x2c4159=path[_0x4fc6('0x74')](_0x2c4159,'offline-chat/');}var _0x56b389=path['join'](_0x2c4159,_0x161c6b[_0x4fc6('0x6c')]);return _0x482fa6[_0x4fc6('0x75')](_0x56b389);}})[_0x4fc6('0x1b')](handleError(_0x482fa6,null));};exports[_0x4fc6('0x76')]=function(_0x1eb4f2,_0x5f2297){var _0x4da04e=null;var _0x242141=null;var _0x4527da=null;if(_0x1eb4f2[_0x4fc6('0x2c')]['id']){delete _0x1eb4f2[_0x4fc6('0x2c')]['id'];}if(_0x1eb4f2[_0x4fc6('0x2c')][_0x4fc6('0x77')]){_0x4527da=path[_0x4fc6('0x74')](config[_0x4fc6('0x73')],_0x4fc6('0x78'),util[_0x4fc6('0x79')]('transcript-%s.txt',Date[_0x4fc6('0x7a')]()));_0x1eb4f2[_0x4fc6('0x2c')][_0x4fc6('0x7b')]=_0x4527da;}return db['ChatInteraction'][_0x4fc6('0x46')]({'where':{'id':_0x1eb4f2['params']['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db[_0x4fc6('0x7c')],'as':_0x4fc6('0x7c')}]}]})['then'](handleEntityNotFound(_0x5f2297,null))[_0x4fc6('0x12')](saveUpdates(_0x1eb4f2[_0x4fc6('0x2c')],null))[_0x4fc6('0x12')](function(_0x373a97){if(_0x373a97){_0x4da04e=_0x373a97;return db[_0x4fc6('0x4b')][_0x4fc6('0x46')]({'where':{'id':_0x4da04e[_0x4fc6('0x4c')]}});}})[_0x4fc6('0x12')](function(_0x2bee20){if(_0x2bee20){_0x242141=_0x2bee20;return db[_0x4fc6('0x61')][_0x4fc6('0x46')]({'where':{'id':_0x4da04e[_0x4fc6('0x7d')]}});}})[_0x4fc6('0x12')](function(_0x4d3723){if(_0x4d3723){if(_0x4527da){var _0x1c8309=null;for(var _0xf6c2b4=0x1;_0xf6c2b4<_0x4da04e[_0x4fc6('0x7e')][_0x4fc6('0x43')];++_0xf6c2b4){_0x1c8309=_0x4da04e[_0x4fc6('0x7e')][_0xf6c2b4];var _0x5e3bb4=_0x1c8309[_0x4fc6('0x65')]?util['format']('%s%d',_0x242141[_0x4fc6('0x7f')],_0x1c8309[_0x4fc6('0x65')]):_0x4fc6('0x80');var _0x20a21c=_0x1eb4f2['body'][_0x4fc6('0x81')]||util[_0x4fc6('0x79')](_0x4fc6('0x82'),_0x4fc6('0x83'),_0x1c8309[_0x4fc6('0x7d')]);switch(_0x242141[_0x4fc6('0x84')]){case _0x4fc6('0x85'):_0x5e3bb4=_0x1c8309[_0x4fc6('0x65')]?util[_0x4fc6('0x79')](_0x4fc6('0x82'),_0x242141[_0x4fc6('0x7f')],_0x1c8309[_0x4fc6('0x65')]):_0x4fc6('0x80');break;case'agent_alias':_0x5e3bb4=_0x1c8309[_0x4fc6('0x65')]?_0x1c8309[_0x4fc6('0x7c')][_0x4fc6('0x86')]||_0x1c8309[_0x4fc6('0x7c')][_0x4fc6('0x51')]:_0x4fc6('0x80');break;case _0x4fc6('0x87'):_0x5e3bb4=_0x1c8309[_0x4fc6('0x65')]?_0x1c8309[_0x4fc6('0x7c')]['fullname']:_0x4fc6('0x80');break;default:_0x5e3bb4=_0x1c8309[_0x4fc6('0x65')]?util[_0x4fc6('0x79')](_0x4fc6('0x82'),_0x242141[_0x4fc6('0x7f')],_0x1c8309[_0x4fc6('0x65')]):_0x4fc6('0x80');}var _0xcc09d0=util[_0x4fc6('0x79')](_0x4fc6('0x88'),moment(_0x1c8309[_0x4fc6('0x89')])[_0x4fc6('0x79')](_0x4fc6('0x8a')),_0x1c8309[_0x4fc6('0x8b')]==='in'?_0x20a21c:_0x5e3bb4,_0x1c8309[_0x4fc6('0x2c')]);if(!_0x1c8309[_0x4fc6('0x8c')]){fs['appendFileSync'](_0x4527da,_0xcc09d0);}}return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x4fc6('0x8d')],'as':_0x4fc6('0x8e'),'raw':!![],'include':[{'model':db[_0x4fc6('0x8f')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0x4fc6('0x12')](function(_0x49d9d8){if(!_0x49d9d8||!_0x49d9d8[_0x4fc6('0x8e')]||!_0x1eb4f2['body'])return _0x4da04e;var _0x3964c0=_0x49d9d8[_0x4fc6('0x90')]();return respondWithRpcPromise('SendMail',_0x4fc6('0x91'),{'account':_0x3964c0,'message':{'from':util[_0x4fc6('0x79')]('\x22%s\x22\x20<%s>',_0x49d9d8[_0x4fc6('0x29')],_0x49d9d8['email']||_0x49d9d8[_0x4fc6('0x8e')]['user']),'to':_0x1eb4f2[_0x4fc6('0x2c')][_0x4fc6('0x77')],'subject':'Mail\x20Transcript','text':util[_0x4fc6('0x79')](_0x4fc6('0x92'),_0x1eb4f2[_0x4fc6('0x2c')][_0x4fc6('0x77')]),'attachments':[{'path':_0x4527da}]}})[_0x4fc6('0x12')](function(){return _0x4da04e;})[_0x4fc6('0x1b')](function(_0x2409e6){logger['error'](_0x2409e6);});})[_0x4fc6('0x12')](respondWithStatusCode(_0x5f2297,0xc8))[_0x4fc6('0x1b')](handleError(_0x5f2297,null));};exports['addMessage']=function(_0x1b08da,_0x2820c6){return db[_0x4fc6('0x5d')][_0x4fc6('0x46')]({'where':{'id':_0x1b08da['params']['id']}})[_0x4fc6('0x12')](handleEntityNotFound(_0x2820c6,null))[_0x4fc6('0x12')](function(_0x4b2ac2){if(_0x4b2ac2){return _0x4b2ac2[_0x4fc6('0x93')](_0x1b08da[_0x4fc6('0x2c')][_0x4fc6('0x94')],_['omit'](_0x1b08da[_0x4fc6('0x2c')],[_0x4fc6('0x94'),'id'])||{});}})[_0x4fc6('0x12')](respondWithResult(_0x2820c6,null))['catch'](handleError(_0x2820c6,null));};exports['getMessages']=function(_0xacf389,_0x54d3ed){var _0x318a5a={'raw':![],'where':{}};var _0x777f49={};var _0x33160f={'count':0x0,'rows':[]};return db[_0x4fc6('0x33')][_0x4fc6('0x4a')]({'where':{'id':_0xacf389[_0x4fc6('0x3a')]['id']}})[_0x4fc6('0x12')](handleEntityNotFound(_0x54d3ed,null))[_0x4fc6('0x12')](function(_0x5a3a84){if(_0x5a3a84){_0x777f49['model']=_[_0x4fc6('0x3b')](db[_0x4fc6('0x5d')][_0x4fc6('0x3c')]);_0x777f49[_0x4fc6('0x3d')]=_[_0x4fc6('0x3b')](_0xacf389[_0x4fc6('0x3d')]);_0x777f49[_0x4fc6('0x3e')]=_[_0x4fc6('0x41')](_0x777f49['model'],_0x777f49[_0x4fc6('0x3d')]);_0x318a5a['attributes']=_[_0x4fc6('0x41')](_0x777f49[_0x4fc6('0x3f')],qs[_0x4fc6('0x42')](_0xacf389[_0x4fc6('0x3d')][_0x4fc6('0x42')]));_0x318a5a[_0x4fc6('0x40')]=_0x318a5a['attributes']['length']?_0x318a5a[_0x4fc6('0x40')]:_0x777f49[_0x4fc6('0x3f')];if(!_0xacf389['query']['hasOwnProperty']('nolimit')){_0x318a5a[_0x4fc6('0x21')]=qs[_0x4fc6('0x21')](_0xacf389['query'][_0x4fc6('0x21')]);_0x318a5a[_0x4fc6('0x20')]=qs[_0x4fc6('0x20')](_0xacf389[_0x4fc6('0x3d')][_0x4fc6('0x20')]);}_0x318a5a[_0x4fc6('0x95')]=qs['sort'](_0xacf389[_0x4fc6('0x3d')][_0x4fc6('0x96')]);_0x318a5a['where']=qs[_0x4fc6('0x3e')](_['pick'](_0xacf389[_0x4fc6('0x3d')],_0x777f49[_0x4fc6('0x3e')]));_0x318a5a[_0x4fc6('0x97')][_0x4fc6('0x98')]=_0x5a3a84['id'];if(_0xacf389[_0x4fc6('0x3d')]['filter']){_0x318a5a[_0x4fc6('0x97')]=_[_0x4fc6('0x2b')](_0x318a5a[_0x4fc6('0x97')],{'$or':_[_0x4fc6('0x32')](_0x318a5a[_0x4fc6('0x40')],function(_0x1d7b5a){var _0x13a47c={};_0x13a47c[_0x1d7b5a]={'$like':'%'+_0xacf389[_0x4fc6('0x3d')][_0x4fc6('0x99')]+'%'};return _0x13a47c;})});}if(_0xacf389[_0x4fc6('0x3d')]['$gte']){var _0xae8b3e=_0xacf389[_0x4fc6('0x3d')][_0x4fc6('0x9a')][_0x4fc6('0x9b')](',');var _0x2434d0={};_0x2434d0[_0xae8b3e[0x0]]={'$gte':moment(_0xae8b3e[0x1])[_0x4fc6('0x79')](_0x4fc6('0x9c'))};_0x318a5a[_0x4fc6('0x97')]=_[_0x4fc6('0x2b')](_0x318a5a[_0x4fc6('0x97')],_0x2434d0);}_0x318a5a=_[_0x4fc6('0x2b')]({},_0x318a5a,_0xacf389[_0x4fc6('0x45')]);return db[_0x4fc6('0x5d')][_0x4fc6('0x23')]({'where':_0x318a5a[_0x4fc6('0x97')]})[_0x4fc6('0x12')](function(_0x3c4a22){_0x33160f[_0x4fc6('0x23')]=_0x3c4a22;if(_0xacf389[_0x4fc6('0x3d')][_0x4fc6('0x9d')]){_0x318a5a[_0x4fc6('0x44')]=[{'all':!![]}];}return db[_0x4fc6('0x5d')][_0x4fc6('0x38')](_0x318a5a);})['then'](function(_0x52c6ba){_0x33160f[_0x4fc6('0x9e')]=_0x52c6ba;return _0x33160f;});}})[_0x4fc6('0x12')](respondWithFilteredResult(_0x54d3ed,_0x318a5a))[_0x4fc6('0x1b')](handleError(_0x54d3ed,null));};exports['getMyMessages']=function(_0x81b7ed,_0x540c02){var _0x496b2a={'where':{}},_0xf354bc={},_0x1ebc25={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x4fc6('0x4a')]({'where':{'id':_0x81b7ed[_0x4fc6('0x3a')]['id']}})[_0x4fc6('0x12')](handleEntityNotFound(_0x540c02,null))[_0x4fc6('0x12')](function(_0x4c1e22){if(_0x4c1e22){_0xf354bc['model']=_[_0x4fc6('0x3b')](db[_0x4fc6('0x5d')][_0x4fc6('0x3c')]);_0xf354bc[_0x4fc6('0x3d')]=_['keys'](_0x81b7ed[_0x4fc6('0x3d')]);_0xf354bc['filters']=_[_0x4fc6('0x41')](_0xf354bc['model'],_0xf354bc['query']);_0x496b2a['attributes']=_[_0x4fc6('0x41')](_0xf354bc[_0x4fc6('0x3f')],qs[_0x4fc6('0x42')](_0x81b7ed[_0x4fc6('0x3d')][_0x4fc6('0x42')]));_0x496b2a[_0x4fc6('0x40')]=_0x496b2a[_0x4fc6('0x40')][_0x4fc6('0x43')]?_0x496b2a['attributes']:_0xf354bc['model'];if(!_0x81b7ed[_0x4fc6('0x3d')][_0x4fc6('0x9f')]('nolimit')){_0x496b2a['limit']=qs[_0x4fc6('0x21')](_0x81b7ed[_0x4fc6('0x3d')][_0x4fc6('0x21')]);_0x496b2a[_0x4fc6('0x20')]=qs['offset'](_0x81b7ed['query'][_0x4fc6('0x20')]);}_0x496b2a['order']=qs[_0x4fc6('0x96')](_0x81b7ed['query'][_0x4fc6('0x96')]);_0x496b2a[_0x4fc6('0x97')]=qs[_0x4fc6('0x3e')](_['pick'](_0x81b7ed['query'],_0xf354bc[_0x4fc6('0x3e')]));_0x496b2a[_0x4fc6('0x97')]['ChatInteractionId']=_0x4c1e22['id'];if(_0x81b7ed[_0x4fc6('0x3d')][_0x4fc6('0x99')]){_0x496b2a['where']=_[_0x4fc6('0x2b')](_0x496b2a[_0x4fc6('0x97')],{'$or':_[_0x4fc6('0x32')](_0x496b2a['attributes'],function(_0x37ca7a){var _0x49ee3f={};_0x49ee3f[_0x37ca7a]={'$like':'%'+_0x81b7ed[_0x4fc6('0x3d')][_0x4fc6('0x99')]+'%'};return _0x49ee3f;})});}_0x496b2a[_0x4fc6('0x97')][_0x4fc6('0x8c')]=![];if(_0x81b7ed[_0x4fc6('0x3d')]['id']){_0x496b2a[_0x4fc6('0x97')]['id']={'$gt':_0x81b7ed[_0x4fc6('0x3d')]['id']};}_0x496b2a=_[_0x4fc6('0x2b')]({},_0x496b2a,_0x81b7ed['options']);return db['ChatMessage']['count']({'where':_0x496b2a[_0x4fc6('0x97')]})[_0x4fc6('0x12')](function(_0x12d291){_0x1ebc25['count']=_0x12d291;_0x496b2a[_0x4fc6('0x44')]=[];if(_0x81b7ed[_0x4fc6('0x3d')][_0x4fc6('0xa0')]){_0x496b2a['include']['push']({'model':db[_0x4fc6('0x7c')],'as':_0x4fc6('0x7c'),'attributes':['id','fullname','alias']});}if(_0x81b7ed[_0x4fc6('0x3d')][_0x4fc6('0x9d')]){_0x496b2a[_0x4fc6('0x44')]=[{'all':!![]}];}return db[_0x4fc6('0x5d')][_0x4fc6('0x38')](_0x496b2a);})[_0x4fc6('0x12')](function(_0x27b030){_0x1ebc25['rows']=_0x27b030;return _0x1ebc25;});}})[_0x4fc6('0x12')](respondWithFilteredResult(_0x540c02,_0x496b2a))[_0x4fc6('0x1b')](handleError(_0x540c02,null));};exports[_0x4fc6('0xa1')]=function(_0xe15a,_0x525d39){return db[_0x4fc6('0x33')][_0x4fc6('0x46')]({'where':{'id':_0xe15a['params']['id']}})[_0x4fc6('0x12')](handleEntityNotFound(_0x525d39,null))['then'](function(_0x224af2){if(_0x224af2){return _0x224af2[_0x4fc6('0xa2')](_0xe15a[_0x4fc6('0x2c')][_0x4fc6('0x94')],_[_0x4fc6('0xa3')](_0xe15a[_0x4fc6('0x2c')],['ids','id'])||{})[_0x4fc6('0xa4')](function(){return db['Tag'][_0x4fc6('0x38')]({'attributes':['id',_0x4fc6('0x29'),'color'],'where':{'id':_0xe15a[_0x4fc6('0x2c')][_0x4fc6('0x94')]}});})[_0x4fc6('0x12')](function(_0x1f5f6b){socket[_0x4fc6('0xa5')]('chatInteractionTags:save',{'id':Number(_0xe15a[_0x4fc6('0x3a')]['id']),'tags':_0x1f5f6b||[]});return{'id':Number(_0xe15a[_0x4fc6('0x3a')]['id']),'tags':_0x1f5f6b||[]};});}})[_0x4fc6('0x12')](respondWithResult(_0x525d39,null))[_0x4fc6('0x1b')](handleError(_0x525d39,null));};exports[_0x4fc6('0xa6')]=function(_0x541ab2,_0x3200cc){return db[_0x4fc6('0x33')]['find']({'where':{'id':_0x541ab2[_0x4fc6('0x3a')]['id']}})['then'](handleEntityNotFound(_0x3200cc,null))[_0x4fc6('0x12')](function(_0xfdbc0f){if(_0xfdbc0f){return _0xfdbc0f['removeTags'](_0x541ab2[_0x4fc6('0x3d')][_0x4fc6('0x94')]);}})[_0x4fc6('0x12')](respondWithStatusCode(_0x3200cc,null))[_0x4fc6('0x1b')](handleError(_0x3200cc,null));};exports[_0x4fc6('0x75')]=function(_0x4a9147,_0x3698f9){var _0xc8f65=moment()[_0x4fc6('0xa7')]()[_0x4fc6('0xa8')]();var _0x3ba9e3=path['join'](config[_0x4fc6('0x73')],_0x4fc6('0xa9'),'files',_0x4fc6('0xaa'));var _0x40f016=path['join'](config[_0x4fc6('0x73')],_0x4fc6('0xa9'),'files','attachments');var _0x4a4593=path['join'](_0x3ba9e3,_0xc8f65);var _0x30e85a=util[_0x4fc6('0x79')]('transcript-%d-%s.zip',_0x4a9147[_0x4fc6('0x3a')]['id'],_0xc8f65);var _0x39f2c5=path['join'](_0x3ba9e3,_0x30e85a);var _0x240a54=[];_0x240a54['push']({'model':db['User'],'as':_0x4fc6('0x7c'),'attributes':['id',_0x4fc6('0x51')],'raw':!![]});_0x240a54[_0x4fc6('0xab')]({'model':db[_0x4fc6('0x61')],'as':_0x4fc6('0x62'),'attributes':['id',_0x4fc6('0xac'),_0x4fc6('0xad')],'raw':!![]});if(_0x4a9147[_0x4fc6('0x3d')][_0x4fc6('0xae')]){_0x240a54[_0x4fc6('0xab')]({'model':db['Attachment'],'as':_0x4fc6('0x6f'),'raw':!![]});}var _0x18b2fc=[{'model':db['ChatMessage'],'as':_0x4fc6('0x7e'),'attributes':['id',_0x4fc6('0x2c'),_0x4fc6('0x89'),_0x4fc6('0x8b'),_0x4fc6('0x8c'),_0x4fc6('0xaf')],'include':_0x240a54}];_0x18b2fc['push']({'model':db[_0x4fc6('0x4b')],'as':'Account','attributes':['id',_0x4fc6('0x29')]});_0x18b2fc[_0x4fc6('0xab')]({'model':db['User'],'as':_0x4fc6('0xb0'),'attributes':['id','fullname']});return db[_0x4fc6('0x33')][_0x4fc6('0x46')]({'where':{'id':_0x4a9147[_0x4fc6('0x3a')]['id']},'include':_0x18b2fc})['then'](handleEntityNotFound(_0x3698f9,null))[_0x4fc6('0x12')](function(_0x51a6d1){if(_0x51a6d1){var _0x4627af=_0x51a6d1['get']({'plain':!![]});fs[_0x4fc6('0xb1')](_0x4a4593);var _0x272bc8={'channel':_0x4fc6('0xb2'),'account':_0x4627af[_0x4fc6('0xb3')][_0x4fc6('0x29')],'agent':_0x4627af[_0x4fc6('0xb0')]?_0x4627af[_0x4fc6('0xb0')][_0x4fc6('0x51')]:_0x4fc6('0xb4'),'createdAt':moment(_0x4627af[_0x4fc6('0x89')])[_0x4fc6('0x79')](_0x4fc6('0x9c'))['toString'](),'closedAt':_0x4627af[_0x4fc6('0x67')]?moment(_0x4627af[_0x4fc6('0xb5')])[_0x4fc6('0x79')]('YYYY-MM-DD\x20HH:mm:ss')[_0x4fc6('0xa8')]():'','disposition':_0x4627af[_0x4fc6('0x68')],'chatInfo':{'browser':_0x4627af[_0x4fc6('0xb6')],'os':_0x4627af[_0x4fc6('0xb7')],'referer':_0x4627af[_0x4fc6('0xb8')],'customerIp':_0x4627af[_0x4fc6('0xb9')],'customerPort':_0x4627af[_0x4fc6('0xba')]?_0x4627af[_0x4fc6('0xba')]:'N.A.'},'messages':_(_0x4627af['Messages'])['tail']()[_0x4fc6('0x99')]({'secret':![]})[_0x4fc6('0x32')](function(_0x53aaba){if(_0x53aaba[_0x4fc6('0x6f')]){var _0x4e6a6e=path['join'](_0x40f016,_0x53aaba[_0x4fc6('0x6f')][_0x4fc6('0x6c')]);if(fs[_0x4fc6('0xbb')](_0x4e6a6e)){fs['createReadStream'](_0x4e6a6e)[_0x4fc6('0xbc')](fs[_0x4fc6('0xbd')](path[_0x4fc6('0x74')](_0x4a4593,_0x53aaba['Attachment'][_0x4fc6('0x6c')])));}}return{'date':moment(_0x53aaba[_0x4fc6('0x89')])[_0x4fc6('0x79')]('YYYY-MM-DD\x20HH:mm:ss')[_0x4fc6('0xa8')](),'sender':_0x53aaba['direction']===_0x4fc6('0x5c')?_0x53aaba[_0x4fc6('0x7c')]?_0x53aaba[_0x4fc6('0x7c')][_0x4fc6('0x51')]:_0x4fc6('0x80'):_0x53aaba[_0x4fc6('0x62')][_0x4fc6('0xac')]+(_0x53aaba['Contact']['lastName']?'\x20'+_0x53aaba[_0x4fc6('0x62')]['lastName']:''),'body':_0x53aaba[_0x4fc6('0x6f')]?_0x53aaba[_0x4fc6('0x6f')]['basename']:_0x53aaba['body'],'direction':_0x53aaba[_0x4fc6('0x8b')]===_0x4fc6('0x5c')?'A':'C','secret':_0x53aaba['secret'],'read':_0x53aaba['read'],'attachment':_0x53aaba[_0x4fc6('0x6f')]};})[_0x4fc6('0xbe')]()};return ejs[_0x4fc6('0xbf')](path[_0x4fc6('0x74')](config[_0x4fc6('0x73')],_0x4fc6('0xa9'),_0x4fc6('0xc0'),_0x4fc6('0xc1')),{'interaction':_0x272bc8})[_0x4fc6('0x12')](function(_0x2d2e8e){var _0x3638ee=path['join'](_0x4a4593,_0x4fc6('0xc2')+_0x4627af['id']+'-'+_0xc8f65+'.pdf');var _0x45e3b0={'path':_0x3638ee,'channel':_0x4fc6('0xb2'),'interactionId':_0x4627af['id']};return pdf[_0x4fc6('0xc3')](_0x2d2e8e,_0x45e3b0);})[_0x4fc6('0x12')](function(){return new Promise(function(_0x50d3da,_0x57156a){zipdir(_0x4a4593,{'saveTo':_0x39f2c5},function(_0x7cea3,_0x155c68){if(_0x7cea3)return _0x57156a(_0x7cea3);return _0x50d3da(_0x155c68);});})[_0x4fc6('0x12')](function(){return new BPromise(function(_0xfc4b5c,_0x3b9f48){rimraf(_0x4a4593,function(_0x57a028){if(_0x57a028)_0x3b9f48(_0x57a028);return _0xfc4b5c();});});})['then'](function(){return _0x3698f9['download'](_0x39f2c5,_0x30e85a,function(_0x59d344){if(_0x59d344){logger[_0x4fc6('0x16')](_0x4fc6('0xc4'),_0x59d344);}else{fs[_0x4fc6('0xc5')](_0x39f2c5);}});});});}else{return _0x3698f9[_0x4fc6('0x1c')](0xc8);}})[_0x4fc6('0x1b')](handleError(_0x3698f9,null));}; \ No newline at end of file +var _0x5a45=['join','server/files/attachments/','offline-chat/','download','close','mailTranscript','root','server/files/chat/upload/','format','now','pathTranscript','Messages','User','CmContact','ContactId','%s%d','System','customer','Visitor','agentIdentifier','website_alias','agentAlias','agent_alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','addMessage','omit','ids','getMessages','hasOwnProperty','order','sort','where','pick','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','getMyMessages','nolimit','includeAgent','push','alias','rows','addTags','setTags','Tag','color','emit','chatInteractionTags:save','removeTags','unix','toString','server','files','attachments','transcript-%d-%s.zip','firstName','lastName','createdAt','Account','Owner','get','mkdirSync','N.A.','closedAt','disposition','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','read','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Chat','err','rimraf','bluebird','mustache','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','redis','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','update','end','stack','name','send','render','merge','body','contact','agent','map','ChatInteraction','rawAttributes','fieldName','type','key','findAll','show','keys','query','filters','intersection','model','attributes','fields','length','includeAll','include','options','create','find','params','createVidaooSession','ChatWebsite','findOne','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooMetadata','fullname','user','email','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','vidaooNote','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','AbandonInteraction','attachmentUpload','originalname','basename','file','filename','Attachment','attachmentDownload','closed','Unauthorized','attachId'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5a45,0x128));var _0x55a4=function(_0x58e8ff,_0x45af96){_0x58e8ff=_0x58e8ff-0x0;var _0x348be2=_0x5a45[_0x58e8ff];return _0x348be2;};'use strict';var rimraf=require(_0x55a4('0x0'));var zipdir=require('zip-dir');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x55a4('0x1'));var Mustache=require(_0x55a4('0x2'));var util=require('util');var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0x55a4('0x3'));var Redis=require(_0x55a4('0x4'));var interaction=require(_0x55a4('0x5'));var qs=require(_0x55a4('0x6'));var pdf=require('../../components/export/pdf');var logger=require(_0x55a4('0x7'))(_0x55a4('0x8'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x55a4('0x9')]=_['defaults'](config[_0x55a4('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x55a4('0xa'))[_0x55a4('0xb')](socket);var jayson=require(_0x55a4('0xc'));var client=jayson[_0x55a4('0xd')][_0x55a4('0xe')]({'port':0x232b});var client9004=jayson[_0x55a4('0xd')][_0x55a4('0xe')]({'port':0x232c});function respondWithRpcPromise(_0x5c3c05,_0xdd3d7d,_0xe311c1,_0x3c0a9e){return new BPromise(function(_0x562c24,_0x3248da){var _0x541ba0=_0x3c0a9e||client;return _0x541ba0[_0x55a4('0xf')](_0x5c3c05,_0xe311c1)[_0x55a4('0x10')](function(_0x5cca1b){logger[_0x55a4('0x11')](_0x55a4('0x12'),_0xdd3d7d,_0x55a4('0x13'));logger[_0x55a4('0x14')](_0x55a4('0x15'),_0xdd3d7d,'request\x20sent',JSON[_0x55a4('0x16')](_0x5cca1b));if(_0x5cca1b['error']){if(_0x5cca1b[_0x55a4('0x17')]['code']===0x1f4){logger[_0x55a4('0x17')](_0x55a4('0x12'),_0xdd3d7d,_0x5cca1b[_0x55a4('0x17')]['message']);return _0x3248da(_0x5cca1b[_0x55a4('0x17')][_0x55a4('0x18')]);}logger[_0x55a4('0x17')]('ChatInteraction,\x20%s,\x20%s',_0xdd3d7d,_0x5cca1b[_0x55a4('0x17')][_0x55a4('0x18')]);return _0x562c24(_0x5cca1b[_0x55a4('0x17')]['message']);}else{logger[_0x55a4('0x11')](_0x55a4('0x12'),_0xdd3d7d,_0x55a4('0x13'));_0x562c24(_0x5cca1b[_0x55a4('0x19')][_0x55a4('0x18')]);}})[_0x55a4('0x1a')](function(_0x4bd3ab){logger[_0x55a4('0x17')](_0x55a4('0x12'),_0xdd3d7d,_0x4bd3ab);_0x3248da(_0x4bd3ab);});});}function respondWithStatusCode(_0x32760e,_0x5ab941){_0x5ab941=_0x5ab941||0xcc;return function(_0x85b2db){if(_0x85b2db){return _0x32760e[_0x55a4('0x1b')](_0x5ab941);}return _0x32760e[_0x55a4('0x1c')](_0x5ab941)['end']();};}function respondWithResult(_0x58ea4c,_0x40527e){_0x40527e=_0x40527e||0xc8;return function(_0x27b8ba){if(_0x27b8ba){return _0x58ea4c[_0x55a4('0x1c')](_0x40527e)[_0x55a4('0x1d')](_0x27b8ba);}};}function respondWithFilteredResult(_0x2eaba6,_0x991d7e){return function(_0x2b4c1c){if(_0x2b4c1c){var _0x47a26f=typeof _0x991d7e['offset']===_0x55a4('0x1e')&&typeof _0x991d7e[_0x55a4('0x1f')]===_0x55a4('0x1e');var _0x5cb513=_0x2b4c1c[_0x55a4('0x20')];var _0x1b0aa9=_0x47a26f?0x0:_0x991d7e[_0x55a4('0x21')];var _0x1c1f2f=_0x47a26f?_0x2b4c1c['count']:_0x991d7e[_0x55a4('0x21')]+_0x991d7e[_0x55a4('0x1f')];var _0x8f5fde;if(_0x1c1f2f>=_0x5cb513){_0x1c1f2f=_0x5cb513;_0x8f5fde=0xc8;}else{_0x8f5fde=0xce;}_0x2eaba6[_0x55a4('0x1c')](_0x8f5fde);return _0x2eaba6[_0x55a4('0x22')](_0x55a4('0x23'),_0x1b0aa9+'-'+_0x1c1f2f+'/'+_0x5cb513)[_0x55a4('0x1d')](_0x2b4c1c);}return null;};}function saveUpdates(_0x1e846a){return function(_0x1a59de){if(_0x1a59de){return _0x1a59de[_0x55a4('0x24')](_0x1e846a)[_0x55a4('0x10')](function(_0x7f299b){return _0x7f299b;});}return null;};}function removeEntity(_0x2d2d13){return function(_0x5aac7a){if(_0x5aac7a){return _0x5aac7a['destroy']()['then'](function(){_0x2d2d13[_0x55a4('0x1c')](0xcc)[_0x55a4('0x25')]();});}};}function handleEntityNotFound(_0x252e81){return function(_0x214f61){if(!_0x214f61){_0x252e81[_0x55a4('0x1b')](0x194);}return _0x214f61;};}function handleError(_0x46d4aa,_0x3bc04e){_0x3bc04e=_0x3bc04e||0x1f4;return function(_0x24f4a0){logger[_0x55a4('0x17')](_0x24f4a0[_0x55a4('0x26')]);if(_0x24f4a0[_0x55a4('0x27')]){delete _0x24f4a0[_0x55a4('0x27')];}_0x46d4aa[_0x55a4('0x1c')](_0x3bc04e)[_0x55a4('0x28')](_0x24f4a0);};}function getMustacheRender(_0x260612,_0x227695){return Mustache[_0x55a4('0x29')](_0x260612,_[_0x55a4('0x2a')](_0x227695[_0x55a4('0x2b')],{'contact':_0x227695[_0x55a4('0x2c')],'message':_0x227695[_0x55a4('0x18')],'agent':_0x227695[_0x55a4('0x2d')],'interaction':_0x227695['interaction'],'account':_0x227695['account']}))||'';}exports['index']=function(_0x173ddc,_0x396367){var _0x555807={};var _0x4fa371=_[_0x55a4('0x2e')](db[_0x55a4('0x2f')][_0x55a4('0x30')],function(_0x224527){return{'name':_0x224527[_0x55a4('0x31')],'type':_0x224527[_0x55a4('0x32')][_0x55a4('0x33')]};});_0x555807=qs['getOptions'](_0x4fa371,_0x173ddc);return interaction[_0x55a4('0x34')]('chat',_0x173ddc['query'],_0x173ddc['user'],_0x555807,_0x4fa371)['then'](respondWithFilteredResult(_0x396367,_0x555807))[_0x55a4('0x1a')](handleError(_0x396367,null));};exports[_0x55a4('0x35')]=function(_0x1e9b2f,_0x52be91){var _0xe5b93={'raw':![],'where':{'id':_0x1e9b2f['params']['id']}},_0x331a42={};_0x331a42['model']=_[_0x55a4('0x36')](db[_0x55a4('0x2f')][_0x55a4('0x30')]);_0x331a42[_0x55a4('0x37')]=_[_0x55a4('0x36')](_0x1e9b2f[_0x55a4('0x37')]);_0x331a42[_0x55a4('0x38')]=_[_0x55a4('0x39')](_0x331a42[_0x55a4('0x3a')],_0x331a42[_0x55a4('0x37')]);_0xe5b93[_0x55a4('0x3b')]=_[_0x55a4('0x39')](_0x331a42['model'],qs[_0x55a4('0x3c')](_0x1e9b2f[_0x55a4('0x37')][_0x55a4('0x3c')]));_0xe5b93[_0x55a4('0x3b')]=_0xe5b93[_0x55a4('0x3b')][_0x55a4('0x3d')]?_0xe5b93[_0x55a4('0x3b')]:_0x331a42['model'];if(_0x1e9b2f[_0x55a4('0x37')][_0x55a4('0x3e')]){_0xe5b93[_0x55a4('0x3f')]=[{'all':!![]}];}_0xe5b93=_[_0x55a4('0x2a')]({},_0xe5b93,_0x1e9b2f[_0x55a4('0x40')]);return db['ChatInteraction']['find'](_0xe5b93)[_0x55a4('0x10')](handleEntityNotFound(_0x52be91,null))['then'](respondWithResult(_0x52be91,null))[_0x55a4('0x1a')](handleError(_0x52be91,null));};exports[_0x55a4('0x41')]=function(_0x48e915,_0x23c358){return db[_0x55a4('0x2f')]['create'](_0x48e915[_0x55a4('0x2b')],{})[_0x55a4('0x10')](respondWithResult(_0x23c358,0xc9))[_0x55a4('0x1a')](handleError(_0x23c358,null));};exports[_0x55a4('0x24')]=function(_0x2d5eb7,_0x5c2410){if(_0x2d5eb7[_0x55a4('0x2b')]['id']){delete _0x2d5eb7[_0x55a4('0x2b')]['id'];}return db[_0x55a4('0x2f')][_0x55a4('0x42')]({'where':{'id':_0x2d5eb7[_0x55a4('0x43')]['id']}})[_0x55a4('0x10')](handleEntityNotFound(_0x5c2410,null))[_0x55a4('0x10')](saveUpdates(_0x2d5eb7['body'],null))['then'](respondWithResult(_0x5c2410,null))['catch'](handleError(_0x5c2410,null));};exports['destroy']=function(_0x2c33e3,_0x30bbdc){return db[_0x55a4('0x2f')][_0x55a4('0x42')]({'where':{'id':_0x2c33e3[_0x55a4('0x43')]['id']}})[_0x55a4('0x10')](handleEntityNotFound(_0x30bbdc,null))[_0x55a4('0x10')](removeEntity(_0x30bbdc,null))['catch'](handleError(_0x30bbdc,null));};exports['describe']=function(_0x2457ee,_0x1754ba){return db[_0x55a4('0x2f')]['describe']()[_0x55a4('0x10')](respondWithResult(_0x1754ba,null))['catch'](handleError(_0x1754ba,null));};exports[_0x55a4('0x44')]=function(_0x57a4c9,_0x14e6bf){var _0x55d6f9=_0x57a4c9['params']['id'];var _0x330603;var _0x476347;var _0xff2c74;return db[_0x55a4('0x2f')]['findOne']({'where':{'id':_0x55d6f9}})['then'](function(_0x1110de){_0x330603=_0x1110de;return db[_0x55a4('0x45')][_0x55a4('0x46')]({'where':{'id':_0x1110de[_0x55a4('0x47')]},'attributes':['id',_0x55a4('0x48'),_0x55a4('0x49'),_0x55a4('0x4a'),'vidaooNote',_0x55a4('0x4b')],'raw':!![]});})[_0x55a4('0x10')](function(_0x3ca227){if(_0x3ca227&&_0x3ca227['vidaooApiKey']&&_0x3ca227[_0x55a4('0x49')]){_0x476347=_0x3ca227;var _0x461ff8={'interaction':{'id':_0x55d6f9},'agent':{'id':_0x57a4c9['user']['id'],'name':_0x57a4c9['user'][_0x55a4('0x27')],'fullname':_0x57a4c9['user'][_0x55a4('0x4c')],'email':_0x57a4c9[_0x55a4('0x4d')][_0x55a4('0x4e')]},'contact':_0x57a4c9[_0x55a4('0x2b')][_0x55a4('0x2c')],'account':_0x57a4c9[_0x55a4('0x2b')]['account']};var _0xafaebc={'rejectUnauthorized':![],'method':'POST','url':_0x55a4('0x4f'),'headers':{'X-APIKEY':_0x3ca227[_0x55a4('0x48')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x57a4c9[_0x55a4('0x4d')][_0x55a4('0x4e')]],'buttons':null,'topic':_0x476347[_0x55a4('0x4a')],'note':_[_0x55a4('0x50')](_0x476347['vidaooNote'])?null:getMustacheRender(_0x476347[_0x55a4('0x51')],_0x461ff8),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0x55a4('0x50')](_0x476347[_0x55a4('0x4b')])){var _0x34fc6d=getMustacheRender(_0x476347[_0x55a4('0x4b')],_0x461ff8);var _0x1f2997=JSON[_0x55a4('0x52')](_0x34fc6d);_0xafaebc[_0x55a4('0x2b')][_0x55a4('0x53')]=_0x1f2997;}}catch(_0x4c8e07){throw new db[(_0x55a4('0x54'))][(_0x55a4('0x55'))](_0x55a4('0x56'));}return rp(_0xafaebc);}else{throw new db[(_0x55a4('0x54'))][(_0x55a4('0x55'))](_0x55a4('0x57'));}})[_0x55a4('0x10')](function(_0x4540c6){_0xff2c74=_0x4540c6;if(_0xff2c74['id']){var _0x2b8b7f={'body':_0xff2c74['join_url'],'ChatWebsiteId':_0x476347['id'],'ChatInteractionId':_0x330603['id'],'direction':_0x55a4('0x58'),'UserId':_0x57a4c9[_0x55a4('0x4d')]['id']};return db[_0x55a4('0x59')][_0x55a4('0x41')](_0x2b8b7f,{});}else{throw new db[(_0x55a4('0x54'))][(_0x55a4('0x55'))](_0x55a4('0x5a'));}})['then'](function(){return _0x330603[_0x55a4('0x5b')]({'vidaooSessionId':_0xff2c74['id']});})['then'](respondWithResult(_0x14e6bf,null))[_0x55a4('0x1a')](handleError(_0x14e6bf,null));};exports[_0x55a4('0x5c')]=function(_0xb38acb,_0x4f3c60){if(_0xb38acb[_0x55a4('0x2b')]['id']){delete _0xb38acb['body']['id'];}return db['ChatInteraction']['find']({'where':{'id':_0xb38acb[_0x55a4('0x43')]['id']},'include':[{'model':db['CmContact'],'as':_0x55a4('0x5d')}]})[_0x55a4('0x10')](handleEntityNotFound(_0x4f3c60,null))[_0x55a4('0x10')](saveUpdates(_0xb38acb['body'],null))['then'](respondWithResult(_0x4f3c60,null))['catch'](handleError(_0x4f3c60,null));};exports[_0x55a4('0x5e')]=function(_0x144d80,_0x499a73){if(_0x144d80['body']['id']){delete _0x144d80[_0x55a4('0x2b')]['id'];}return db[_0x55a4('0x2f')]['find']({'where':{'id':_0x144d80['params']['id']}})[_0x55a4('0x10')](function(_0x4cd6ea){if(!_0x4cd6ea){logger[_0x55a4('0x17')](_0x55a4('0x5f'),_0x55a4('0x5e'),0x194,_0x55a4('0x60'));_0x499a73['sendStatus'](0x194);}else{if(_0x4cd6ea[_0x55a4('0x61')]){throw new db['Sequelize']['ValidationError'](_0x55a4('0x62'));}}return _0x4cd6ea;})[_0x55a4('0x10')](function(_0x57dc54){if(_0x57dc54){return _0x57dc54[_0x55a4('0x24')]({'closed':_0x144d80[_0x55a4('0x2b')]['closed'],'disposition':_0x144d80[_0x55a4('0x2b')]['disposition']})[_0x55a4('0x10')](function(_0x4a8d55){return _0x4a8d55;});}})[_0x55a4('0x10')](function(){return respondWithRpcPromise(_0x55a4('0x63'),_0x55a4('0x5e'),_0x144d80['body'],client9004);})['then'](respondWithResult(_0x499a73,null))[_0x55a4('0x1a')](handleError(_0x499a73,null));};exports[_0x55a4('0x64')]=function(_0x22484c,_0x811f6d){_0x22484c[_0x55a4('0x2b')]['name']=_0x22484c['file'][_0x55a4('0x65')];_0x22484c[_0x55a4('0x2b')][_0x55a4('0x66')]=_0x22484c[_0x55a4('0x67')][_0x55a4('0x68')];_0x22484c[_0x55a4('0x2b')]['type']=_0x22484c[_0x55a4('0x67')]['mimetype'];return db[_0x55a4('0x69')][_0x55a4('0x41')](_0x22484c[_0x55a4('0x2b')])[_0x55a4('0x10')](respondWithResult(_0x811f6d,0xc9))[_0x55a4('0x1a')](handleError(_0x811f6d,null));};exports[_0x55a4('0x6a')]=function(_0x203d6e,_0x41dbe7){return db[_0x55a4('0x2f')][_0x55a4('0x46')]({'where':{'id':_0x203d6e['params']['id']},'raw':!![]})[_0x55a4('0x10')](handleEntityNotFound(_0x41dbe7,null))[_0x55a4('0x10')](function(_0x1fdca8){if(_0x1fdca8){if(_0x1fdca8[_0x55a4('0x6b')]){return _0x41dbe7[_0x55a4('0x1c')](0x193)[_0x55a4('0x1d')]({'status':0x193,'message':_0x55a4('0x6c')});}return db[_0x55a4('0x69')][_0x55a4('0x46')]({'where':{'id':_0x203d6e[_0x55a4('0x37')][_0x55a4('0x6d')]},'raw':!![]})[_0x55a4('0x10')](handleEntityNotFound(_0x41dbe7,null));}})['then'](function(_0x540318){if(_0x540318){var _0x17387f=_0x540318['ChatOfflineMessageId']!==null;var _0x2d56f9=path[_0x55a4('0x6e')](config['root'],_0x55a4('0x6f'));if(_0x17387f){_0x2d56f9=path[_0x55a4('0x6e')](_0x2d56f9,_0x55a4('0x70'));}var _0x1b7d98=path['join'](_0x2d56f9,_0x540318['basename']);return _0x41dbe7[_0x55a4('0x71')](_0x1b7d98);}})[_0x55a4('0x1a')](handleError(_0x41dbe7,null));};exports[_0x55a4('0x72')]=function(_0x2b237f,_0x13e270){var _0x5bcdc7=null;var _0x4227f2=null;var _0x328dd9=null;if(_0x2b237f['body']['id']){delete _0x2b237f['body']['id'];}if(_0x2b237f[_0x55a4('0x2b')][_0x55a4('0x73')]){_0x328dd9=path[_0x55a4('0x6e')](config[_0x55a4('0x74')],_0x55a4('0x75'),util[_0x55a4('0x76')]('transcript-%s.txt',Date[_0x55a4('0x77')]()));_0x2b237f[_0x55a4('0x2b')][_0x55a4('0x78')]=_0x328dd9;}return db[_0x55a4('0x2f')][_0x55a4('0x42')]({'where':{'id':_0x2b237f[_0x55a4('0x43')]['id']},'include':[{'model':db[_0x55a4('0x59')],'as':_0x55a4('0x79'),'include':[{'model':db[_0x55a4('0x7a')],'as':_0x55a4('0x7a')}]}]})[_0x55a4('0x10')](handleEntityNotFound(_0x13e270,null))['then'](saveUpdates(_0x2b237f['body'],null))['then'](function(_0x716346){if(_0x716346){_0x5bcdc7=_0x716346;return db[_0x55a4('0x45')][_0x55a4('0x42')]({'where':{'id':_0x5bcdc7['ChatWebsiteId']}});}})[_0x55a4('0x10')](function(_0x1aafc5){if(_0x1aafc5){_0x4227f2=_0x1aafc5;return db[_0x55a4('0x7b')][_0x55a4('0x42')]({'where':{'id':_0x5bcdc7[_0x55a4('0x7c')]}});}})[_0x55a4('0x10')](function(_0x50ad77){if(_0x50ad77){if(_0x328dd9){var _0x5eef13=null;for(var _0x3d62b6=0x1;_0x3d62b6<_0x5bcdc7[_0x55a4('0x79')][_0x55a4('0x3d')];++_0x3d62b6){_0x5eef13=_0x5bcdc7[_0x55a4('0x79')][_0x3d62b6];var _0x282fd3=_0x5eef13['UserId']?util[_0x55a4('0x76')](_0x55a4('0x7d'),_0x4227f2['agentAlias'],_0x5eef13['UserId']):_0x55a4('0x7e');var _0x3eefe5=_0x2b237f[_0x55a4('0x2b')][_0x55a4('0x7f')]||util[_0x55a4('0x76')](_0x55a4('0x7d'),_0x55a4('0x80'),_0x5eef13[_0x55a4('0x7c')]);switch(_0x4227f2[_0x55a4('0x81')]){case _0x55a4('0x82'):_0x282fd3=_0x5eef13[_0x55a4('0x61')]?util[_0x55a4('0x76')](_0x55a4('0x7d'),_0x4227f2[_0x55a4('0x83')],_0x5eef13[_0x55a4('0x61')]):_0x55a4('0x7e');break;case _0x55a4('0x84'):_0x282fd3=_0x5eef13[_0x55a4('0x61')]?_0x5eef13[_0x55a4('0x7a')]['alias']||_0x5eef13[_0x55a4('0x7a')][_0x55a4('0x4c')]:_0x55a4('0x7e');break;case _0x55a4('0x85'):_0x282fd3=_0x5eef13[_0x55a4('0x61')]?_0x5eef13[_0x55a4('0x7a')][_0x55a4('0x4c')]:'System';break;default:_0x282fd3=_0x5eef13[_0x55a4('0x61')]?util[_0x55a4('0x76')](_0x55a4('0x7d'),_0x4227f2['agentAlias'],_0x5eef13['UserId']):'System';}var _0x4f36b7=util[_0x55a4('0x76')](_0x55a4('0x86'),moment(_0x5eef13['createdAt'])[_0x55a4('0x76')](_0x55a4('0x87')),_0x5eef13[_0x55a4('0x88')]==='in'?_0x3eefe5:_0x282fd3,_0x5eef13[_0x55a4('0x2b')]);if(!_0x5eef13[_0x55a4('0x89')]){fs['appendFileSync'](_0x328dd9,_0x4f36b7);}}return db['MailAccount'][_0x55a4('0x46')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x55a4('0x8a'),'raw':!![],'include':[{'model':db[_0x55a4('0x8b')],'as':_0x55a4('0x8b'),'raw':!![]}]}]});}}})[_0x55a4('0x10')](function(_0x132a41){if(!_0x132a41||!_0x132a41['Smtp']||!_0x2b237f[_0x55a4('0x2b')])return _0x5bcdc7;var _0x5d8da3=_0x132a41[_0x55a4('0x8c')]();return respondWithRpcPromise(_0x55a4('0x8d'),_0x55a4('0x8e'),{'account':_0x5d8da3,'message':{'from':util[_0x55a4('0x76')](_0x55a4('0x8f'),_0x132a41[_0x55a4('0x27')],_0x132a41[_0x55a4('0x4e')]||_0x132a41[_0x55a4('0x8a')][_0x55a4('0x4d')]),'to':_0x2b237f[_0x55a4('0x2b')]['mailTranscript'],'subject':'Mail\x20Transcript','text':util[_0x55a4('0x76')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x2b237f[_0x55a4('0x2b')]['mailTranscript']),'attachments':[{'path':_0x328dd9}]}})[_0x55a4('0x10')](function(){return _0x5bcdc7;})[_0x55a4('0x1a')](function(_0x1d78ed){logger[_0x55a4('0x17')](_0x1d78ed);});})['then'](respondWithStatusCode(_0x13e270,0xc8))[_0x55a4('0x1a')](handleError(_0x13e270,null));};exports[_0x55a4('0x90')]=function(_0x57b88b,_0x3172b2){return db[_0x55a4('0x59')][_0x55a4('0x42')]({'where':{'id':_0x57b88b['params']['id']}})[_0x55a4('0x10')](handleEntityNotFound(_0x3172b2,null))['then'](function(_0x580db2){if(_0x580db2){return _0x580db2[_0x55a4('0x90')](_0x57b88b[_0x55a4('0x2b')]['ids'],_[_0x55a4('0x91')](_0x57b88b[_0x55a4('0x2b')],[_0x55a4('0x92'),'id'])||{});}})[_0x55a4('0x10')](respondWithResult(_0x3172b2,null))[_0x55a4('0x1a')](handleError(_0x3172b2,null));};exports[_0x55a4('0x93')]=function(_0x26877f,_0x33447c){var _0x4a72d3={'raw':![],'where':{}};var _0x585084={};var _0x49d237={'count':0x0,'rows':[]};return db[_0x55a4('0x2f')][_0x55a4('0x46')]({'where':{'id':_0x26877f[_0x55a4('0x43')]['id']}})[_0x55a4('0x10')](handleEntityNotFound(_0x33447c,null))[_0x55a4('0x10')](function(_0x41b7c8){if(_0x41b7c8){_0x585084[_0x55a4('0x3a')]=_[_0x55a4('0x36')](db[_0x55a4('0x59')]['rawAttributes']);_0x585084[_0x55a4('0x37')]=_['keys'](_0x26877f[_0x55a4('0x37')]);_0x585084[_0x55a4('0x38')]=_[_0x55a4('0x39')](_0x585084[_0x55a4('0x3a')],_0x585084[_0x55a4('0x37')]);_0x4a72d3[_0x55a4('0x3b')]=_[_0x55a4('0x39')](_0x585084[_0x55a4('0x3a')],qs[_0x55a4('0x3c')](_0x26877f[_0x55a4('0x37')]['fields']));_0x4a72d3[_0x55a4('0x3b')]=_0x4a72d3['attributes']['length']?_0x4a72d3[_0x55a4('0x3b')]:_0x585084['model'];if(!_0x26877f[_0x55a4('0x37')][_0x55a4('0x94')]('nolimit')){_0x4a72d3[_0x55a4('0x1f')]=qs[_0x55a4('0x1f')](_0x26877f[_0x55a4('0x37')]['limit']);_0x4a72d3[_0x55a4('0x21')]=qs['offset'](_0x26877f[_0x55a4('0x37')]['offset']);}_0x4a72d3[_0x55a4('0x95')]=qs[_0x55a4('0x96')](_0x26877f[_0x55a4('0x37')][_0x55a4('0x96')]);_0x4a72d3[_0x55a4('0x97')]=qs[_0x55a4('0x38')](_[_0x55a4('0x98')](_0x26877f[_0x55a4('0x37')],_0x585084[_0x55a4('0x38')]));_0x4a72d3[_0x55a4('0x97')][_0x55a4('0x99')]=_0x41b7c8['id'];if(_0x26877f[_0x55a4('0x37')][_0x55a4('0x9a')]){_0x4a72d3[_0x55a4('0x97')]=_[_0x55a4('0x2a')](_0x4a72d3[_0x55a4('0x97')],{'$or':_[_0x55a4('0x2e')](_0x4a72d3[_0x55a4('0x3b')],function(_0x226d04){var _0x1c9ea5={};_0x1c9ea5[_0x226d04]={'$like':'%'+_0x26877f[_0x55a4('0x37')]['filter']+'%'};return _0x1c9ea5;})});}if(_0x26877f['query'][_0x55a4('0x9b')]){var _0x43b9de=_0x26877f[_0x55a4('0x37')][_0x55a4('0x9b')][_0x55a4('0x9c')](',');var _0x268997={};_0x268997[_0x43b9de[0x0]]={'$gte':moment(_0x43b9de[0x1])['format'](_0x55a4('0x9d'))};_0x4a72d3[_0x55a4('0x97')]=_[_0x55a4('0x2a')](_0x4a72d3[_0x55a4('0x97')],_0x268997);}_0x4a72d3=_[_0x55a4('0x2a')]({},_0x4a72d3,_0x26877f['options']);return db['ChatMessage'][_0x55a4('0x20')]({'where':_0x4a72d3['where']})['then'](function(_0x2b2440){_0x49d237[_0x55a4('0x20')]=_0x2b2440;if(_0x26877f[_0x55a4('0x37')][_0x55a4('0x3e')]){_0x4a72d3[_0x55a4('0x3f')]=[{'all':!![]}];}return db[_0x55a4('0x59')][_0x55a4('0x34')](_0x4a72d3);})[_0x55a4('0x10')](function(_0x448cc2){_0x49d237['rows']=_0x448cc2;return _0x49d237;});}})[_0x55a4('0x10')](respondWithFilteredResult(_0x33447c,_0x4a72d3))[_0x55a4('0x1a')](handleError(_0x33447c,null));};exports[_0x55a4('0x9e')]=function(_0x2f727c,_0x5ab1bf){var _0x57ef7b={'where':{}},_0x4f7e71={},_0x341d47={'count':0x0,'rows':[]};return db[_0x55a4('0x2f')][_0x55a4('0x46')]({'where':{'id':_0x2f727c[_0x55a4('0x43')]['id']}})[_0x55a4('0x10')](handleEntityNotFound(_0x5ab1bf,null))[_0x55a4('0x10')](function(_0x79d8b7){if(_0x79d8b7){_0x4f7e71[_0x55a4('0x3a')]=_[_0x55a4('0x36')](db['ChatMessage']['rawAttributes']);_0x4f7e71[_0x55a4('0x37')]=_['keys'](_0x2f727c[_0x55a4('0x37')]);_0x4f7e71[_0x55a4('0x38')]=_['intersection'](_0x4f7e71[_0x55a4('0x3a')],_0x4f7e71[_0x55a4('0x37')]);_0x57ef7b[_0x55a4('0x3b')]=_['intersection'](_0x4f7e71[_0x55a4('0x3a')],qs[_0x55a4('0x3c')](_0x2f727c[_0x55a4('0x37')]['fields']));_0x57ef7b[_0x55a4('0x3b')]=_0x57ef7b[_0x55a4('0x3b')]['length']?_0x57ef7b[_0x55a4('0x3b')]:_0x4f7e71[_0x55a4('0x3a')];if(!_0x2f727c[_0x55a4('0x37')]['hasOwnProperty'](_0x55a4('0x9f'))){_0x57ef7b['limit']=qs[_0x55a4('0x1f')](_0x2f727c['query']['limit']);_0x57ef7b[_0x55a4('0x21')]=qs[_0x55a4('0x21')](_0x2f727c['query'][_0x55a4('0x21')]);}_0x57ef7b[_0x55a4('0x95')]=qs['sort'](_0x2f727c[_0x55a4('0x37')][_0x55a4('0x96')]);_0x57ef7b['where']=qs['filters'](_[_0x55a4('0x98')](_0x2f727c['query'],_0x4f7e71[_0x55a4('0x38')]));_0x57ef7b[_0x55a4('0x97')][_0x55a4('0x99')]=_0x79d8b7['id'];if(_0x2f727c[_0x55a4('0x37')][_0x55a4('0x9a')]){_0x57ef7b[_0x55a4('0x97')]=_[_0x55a4('0x2a')](_0x57ef7b[_0x55a4('0x97')],{'$or':_[_0x55a4('0x2e')](_0x57ef7b[_0x55a4('0x3b')],function(_0x50a9ae){var _0x3c818e={};_0x3c818e[_0x50a9ae]={'$like':'%'+_0x2f727c[_0x55a4('0x37')]['filter']+'%'};return _0x3c818e;})});}_0x57ef7b['where']['secret']=![];if(_0x2f727c['query']['id']){_0x57ef7b[_0x55a4('0x97')]['id']={'$gt':_0x2f727c[_0x55a4('0x37')]['id']};}_0x57ef7b=_[_0x55a4('0x2a')]({},_0x57ef7b,_0x2f727c[_0x55a4('0x40')]);return db['ChatMessage'][_0x55a4('0x20')]({'where':_0x57ef7b[_0x55a4('0x97')]})[_0x55a4('0x10')](function(_0x406598){_0x341d47[_0x55a4('0x20')]=_0x406598;_0x57ef7b['include']=[];if(_0x2f727c[_0x55a4('0x37')][_0x55a4('0xa0')]){_0x57ef7b['include'][_0x55a4('0xa1')]({'model':db['User'],'as':_0x55a4('0x7a'),'attributes':['id',_0x55a4('0x4c'),_0x55a4('0xa2')]});}if(_0x2f727c[_0x55a4('0x37')][_0x55a4('0x3e')]){_0x57ef7b[_0x55a4('0x3f')]=[{'all':!![]}];}return db[_0x55a4('0x59')][_0x55a4('0x34')](_0x57ef7b);})[_0x55a4('0x10')](function(_0x2d97cc){_0x341d47[_0x55a4('0xa3')]=_0x2d97cc;return _0x341d47;});}})['then'](respondWithFilteredResult(_0x5ab1bf,_0x57ef7b))['catch'](handleError(_0x5ab1bf,null));};exports[_0x55a4('0xa4')]=function(_0x134bf9,_0x37fc77){return db[_0x55a4('0x2f')]['find']({'where':{'id':_0x134bf9['params']['id']}})[_0x55a4('0x10')](handleEntityNotFound(_0x37fc77,null))[_0x55a4('0x10')](function(_0x4a8c8a){if(_0x4a8c8a){return _0x4a8c8a[_0x55a4('0xa5')](_0x134bf9[_0x55a4('0x2b')][_0x55a4('0x92')],_[_0x55a4('0x91')](_0x134bf9[_0x55a4('0x2b')],[_0x55a4('0x92'),'id'])||{})['spread'](function(){return db[_0x55a4('0xa6')][_0x55a4('0x34')]({'attributes':['id',_0x55a4('0x27'),_0x55a4('0xa7')],'where':{'id':_0x134bf9[_0x55a4('0x2b')][_0x55a4('0x92')]}});})[_0x55a4('0x10')](function(_0x49140a){socket[_0x55a4('0xa8')](_0x55a4('0xa9'),{'id':Number(_0x134bf9['params']['id']),'tags':_0x49140a||[]});return{'id':Number(_0x134bf9[_0x55a4('0x43')]['id']),'tags':_0x49140a||[]};});}})[_0x55a4('0x10')](respondWithResult(_0x37fc77,null))[_0x55a4('0x1a')](handleError(_0x37fc77,null));};exports[_0x55a4('0xaa')]=function(_0x4f9a77,_0x28d96a){return db['ChatInteraction'][_0x55a4('0x42')]({'where':{'id':_0x4f9a77['params']['id']}})[_0x55a4('0x10')](handleEntityNotFound(_0x28d96a,null))[_0x55a4('0x10')](function(_0x4477ab){if(_0x4477ab){return _0x4477ab['removeTags'](_0x4f9a77[_0x55a4('0x37')]['ids']);}})[_0x55a4('0x10')](respondWithStatusCode(_0x28d96a,null))[_0x55a4('0x1a')](handleError(_0x28d96a,null));};exports[_0x55a4('0x71')]=function(_0x24d3b2,_0x27c53f){var _0x3f0351=moment()[_0x55a4('0xab')]()[_0x55a4('0xac')]();var _0x262bcf=path[_0x55a4('0x6e')](config['root'],_0x55a4('0xad'),_0x55a4('0xae'),'tmp');var _0x466a78=path[_0x55a4('0x6e')](config[_0x55a4('0x74')],'server',_0x55a4('0xae'),_0x55a4('0xaf'));var _0x234213=path[_0x55a4('0x6e')](_0x262bcf,_0x3f0351);var _0x1b88b6=util[_0x55a4('0x76')](_0x55a4('0xb0'),_0x24d3b2[_0x55a4('0x43')]['id'],_0x3f0351);var _0x25538d=path['join'](_0x262bcf,_0x1b88b6);var _0x52adc1=[];_0x52adc1[_0x55a4('0xa1')]({'model':db[_0x55a4('0x7a')],'as':_0x55a4('0x7a'),'attributes':['id',_0x55a4('0x4c')],'raw':!![]});_0x52adc1[_0x55a4('0xa1')]({'model':db['CmContact'],'as':_0x55a4('0x5d'),'attributes':['id',_0x55a4('0xb1'),_0x55a4('0xb2')],'raw':!![]});if(_0x24d3b2['query']['attachments']){_0x52adc1['push']({'model':db[_0x55a4('0x69')],'as':'Attachment','raw':!![]});}var _0x52c232=[{'model':db['ChatMessage'],'as':_0x55a4('0x79'),'attributes':['id',_0x55a4('0x2b'),_0x55a4('0xb3'),_0x55a4('0x88'),'secret','read'],'include':_0x52adc1}];_0x52c232[_0x55a4('0xa1')]({'model':db['ChatWebsite'],'as':_0x55a4('0xb4'),'attributes':['id',_0x55a4('0x27')]});_0x52c232['push']({'model':db[_0x55a4('0x7a')],'as':_0x55a4('0xb5'),'attributes':['id',_0x55a4('0x4c')]});return db['ChatInteraction']['find']({'where':{'id':_0x24d3b2[_0x55a4('0x43')]['id']},'include':_0x52c232})[_0x55a4('0x10')](handleEntityNotFound(_0x27c53f,null))[_0x55a4('0x10')](function(_0x3a1e6b){if(_0x3a1e6b){var _0x5e6fc4=_0x3a1e6b[_0x55a4('0xb6')]({'plain':!![]});fs[_0x55a4('0xb7')](_0x234213);var _0x27556d={'channel':'Chat','account':_0x5e6fc4[_0x55a4('0xb4')]['name'],'agent':_0x5e6fc4[_0x55a4('0xb5')]?_0x5e6fc4[_0x55a4('0xb5')]['fullname']:_0x55a4('0xb8'),'createdAt':moment(_0x5e6fc4[_0x55a4('0xb3')])[_0x55a4('0x76')](_0x55a4('0x9d'))[_0x55a4('0xac')](),'closedAt':_0x5e6fc4[_0x55a4('0x6b')]?moment(_0x5e6fc4[_0x55a4('0xb9')])[_0x55a4('0x76')](_0x55a4('0x9d'))['toString']():'','disposition':_0x5e6fc4[_0x55a4('0xba')],'chatInfo':{'browser':_0x5e6fc4['browserName'],'os':_0x5e6fc4[_0x55a4('0xbb')],'referer':_0x5e6fc4[_0x55a4('0xbc')],'customerIp':_0x5e6fc4[_0x55a4('0xbd')],'customerPort':_0x5e6fc4['customerPort']?_0x5e6fc4[_0x55a4('0xbe')]:_0x55a4('0xb8')},'messages':_(_0x5e6fc4['Messages'])[_0x55a4('0xbf')]()[_0x55a4('0x9a')]({'secret':![]})[_0x55a4('0x2e')](function(_0x251480){if(_0x251480['Attachment']){var _0x3184c7=path[_0x55a4('0x6e')](_0x466a78,_0x251480['Attachment']['basename']);if(fs[_0x55a4('0xc0')](_0x3184c7)){fs[_0x55a4('0xc1')](_0x3184c7)['pipe'](fs['createWriteStream'](path['join'](_0x234213,_0x251480[_0x55a4('0x69')][_0x55a4('0x66')])));}}return{'date':moment(_0x251480[_0x55a4('0xb3')])['format'](_0x55a4('0x9d'))[_0x55a4('0xac')](),'sender':_0x251480[_0x55a4('0x88')]===_0x55a4('0x58')?_0x251480[_0x55a4('0x7a')]?_0x251480[_0x55a4('0x7a')][_0x55a4('0x4c')]:_0x55a4('0x7e'):_0x251480[_0x55a4('0x5d')][_0x55a4('0xb1')]+(_0x251480['Contact'][_0x55a4('0xb2')]?'\x20'+_0x251480[_0x55a4('0x5d')][_0x55a4('0xb2')]:''),'body':_0x251480[_0x55a4('0x69')]?_0x251480[_0x55a4('0x69')][_0x55a4('0x66')]:_0x251480[_0x55a4('0x2b')],'direction':_0x251480[_0x55a4('0x88')]===_0x55a4('0x58')?'A':'C','secret':_0x251480[_0x55a4('0x89')],'read':_0x251480[_0x55a4('0xc2')],'attachment':_0x251480[_0x55a4('0x69')]};})[_0x55a4('0xc3')]()};return ejs[_0x55a4('0xc4')](path[_0x55a4('0x6e')](config[_0x55a4('0x74')],'server',_0x55a4('0xc5'),_0x55a4('0xc6')),{'interaction':_0x27556d})['then'](function(_0x4d387a){var _0x134c72=path[_0x55a4('0x6e')](_0x234213,_0x55a4('0xc7')+_0x5e6fc4['id']+'-'+_0x3f0351+_0x55a4('0xc8'));var _0x240241={'path':_0x134c72,'channel':_0x55a4('0xc9'),'interactionId':_0x5e6fc4['id']};return pdf['createPdfFromHTML'](_0x4d387a,_0x240241);})[_0x55a4('0x10')](function(){return new Promise(function(_0x1733ac,_0x5501cf){zipdir(_0x234213,{'saveTo':_0x25538d},function(_0x9a10ca,_0x3b17ac){if(_0x9a10ca)return _0x5501cf(_0x9a10ca);return _0x1733ac(_0x3b17ac);});})[_0x55a4('0x10')](function(){return new BPromise(function(_0x19da3e,_0x5c1266){rimraf(_0x234213,function(_0x47e12d){if(_0x47e12d)_0x5c1266(_0x47e12d);return _0x19da3e();});});})[_0x55a4('0x10')](function(){return _0x27c53f[_0x55a4('0x71')](_0x25538d,_0x1b88b6,function(_0x52ddc9){if(_0x52ddc9){logger[_0x55a4('0x17')](_0x55a4('0xca'),_0x52ddc9);}else{fs['unlinkSync'](_0x25538d);}});});});}else{return _0x27c53f[_0x55a4('0x1b')](0xc8);}})['catch'](handleError(_0x27c53f,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 902e324..186b344 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 _0x59a3=['length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','map','unreadMessages'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0x59a3,0x102));var _0x359a=function(_0x7a50a5,_0x19b21a){_0x7a50a5=_0x7a50a5-0x0;var _0x5acd1b=_0x59a3[_0x7a50a5];return _0x5acd1b;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x359a('0x0'))['db'][_0x359a('0x1')];var ChatMessage=require(_0x359a('0x0'))['db'][_0x359a('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x359a('0x3')](0x0);var events={'afterCreate':_0x359a('0x4'),'afterUpdate':_0x359a('0x5'),'afterDestroy':_0x359a('0x6')};function emitEvent(_0x1f925c){return function(_0x224013,_0x5c6dd6,_0x4ba71b){_0x224013['getUsers']({'attributes':['id'],'raw':!![]})[_0x359a('0x7')](function(_0x11d97f){_0x224013[_0x359a('0x8')](_0x359a('0x9'),_0x11d97f[_0x359a('0xa')](function(_0x6cb691){return{'id':_0x6cb691['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x224013['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5f3ef0){_0x224013['setDataValue'](_0x359a('0xb'),_0x5f3ef0[_0x359a('0xc')]);ChatInteractionEvents[_0x359a('0xd')](_0x1f925c+':'+_0x224013['id'],_0x224013);ChatInteractionEvents['emit'](_0x1f925c,_0x224013);_0x4ba71b(null);})[_0x359a('0xe')](_0x4ba71b(null));};}for(var e in events){if(events[_0x359a('0xf')](e)){var event=events[e];ChatInteraction[_0x359a('0x10')](e,emitEvent(event));}}module[_0x359a('0x11')]=ChatInteractionEvents; \ No newline at end of file +var _0x8c72=['map','unreadMessages','emit','catch','hasOwnProperty','exports','../../mysqldb','ChatMessage','setMaxListeners','save','update','getUsers','then','setDataValue'];(function(_0x1d1860,_0x55062b){var _0x19ddca=function(_0x2e2b62){while(--_0x2e2b62){_0x1d1860['push'](_0x1d1860['shift']());}};_0x19ddca(++_0x55062b);}(_0x8c72,0x19c));var _0x28c7=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0x8c72[_0x119d5a];return _0x15bff4;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x28c7('0x0'))['db']['ChatInteraction'];var ChatMessage=require(_0x28c7('0x0'))['db'][_0x28c7('0x1')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x28c7('0x2')](0x0);var events={'afterCreate':_0x28c7('0x3'),'afterUpdate':_0x28c7('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3318dd){return function(_0x249068,_0x9f7639,_0x2d7d54){_0x249068[_0x28c7('0x5')]({'attributes':['id'],'raw':!![]})[_0x28c7('0x6')](function(_0x2a1d8c){_0x249068[_0x28c7('0x7')]('Users',_0x2a1d8c[_0x28c7('0x8')](function(_0x1923b1){return{'id':_0x1923b1['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x249068['id'],'direction':'in','read':![]},'raw':!![]});})[_0x28c7('0x6')](function(_0x204754){_0x249068[_0x28c7('0x7')](_0x28c7('0x9'),_0x204754['length']);ChatInteractionEvents['emit'](_0x3318dd+':'+_0x249068['id'],_0x249068);ChatInteractionEvents[_0x28c7('0xa')](_0x3318dd,_0x249068);_0x2d7d54(null);})[_0x28c7('0xb')](_0x2d7d54(null));};}for(var e in events){if(events[_0x28c7('0xc')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x28c7('0xd')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 1461c8f..aa90c8d 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 _0x60e2=['changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','path','rimraf','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions'];(function(_0x39503a,_0x3d959e){var _0x3110cc=function(_0x4090c3){while(--_0x4090c3){_0x39503a['push'](_0x39503a['shift']());}};_0x3110cc(++_0x3d959e);}(_0x60e2,0x1e5));var _0x260e=function(_0x152cb6,_0x10b962){_0x152cb6=_0x152cb6-0x0;var _0x22080a=_0x60e2[_0x152cb6];return _0x22080a;};'use strict';var _=require('lodash');var util=require(_0x260e('0x0'));var logger=require(_0x260e('0x1'))('api');var moment=require(_0x260e('0x2'));var BPromise=require(_0x260e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x260e('0x4'));var rimraf=require(_0x260e('0x5'));var config=require('../../config/environment');var attributes=require(_0x260e('0x6'));module[_0x260e('0x7')]=function(_0x2d2fcb,_0x385b20){return _0x2d2fcb[_0x260e('0x8')](_0x260e('0x9'),attributes,{'tableName':_0x260e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x315fdf,_0x4cdb66,_0x40aa75){if(_0x315fdf[_0x260e('0xb')](_0x260e('0xc'))){_0x315fdf[_0x260e('0xd')]=moment()['format'](_0x260e('0xe'));}_0x40aa75(null,_0x315fdf);}},'charset':'utf8mb4','collate':_0x260e('0xf')});}; \ No newline at end of file +var _0x2154=['../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5a0bc9,_0x33e977){var _0xea2e04=function(_0x48f2d9){while(--_0x48f2d9){_0x5a0bc9['push'](_0x5a0bc9['shift']());}};_0xea2e04(++_0x33e977);}(_0x2154,0xa0));var _0x4215=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0x2154[_0x1abb09];return _0xea1c07;};'use strict';var _=require('lodash');var util=require(_0x4215('0x0'));var logger=require(_0x4215('0x1'))(_0x4215('0x2'));var moment=require(_0x4215('0x3'));var BPromise=require(_0x4215('0x4'));var rp=require(_0x4215('0x5'));var fs=require('fs');var path=require(_0x4215('0x6'));var rimraf=require(_0x4215('0x7'));var config=require(_0x4215('0x8'));var attributes=require(_0x4215('0x9'));module[_0x4215('0xa')]=function(_0x44fe7d,_0x18ea4f){return _0x44fe7d[_0x4215('0xb')](_0x4215('0xc'),attributes,{'tableName':_0x4215('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x54bf6f,_0x29283f,_0x540479){if(_0x54bf6f[_0x4215('0xe')](_0x4215('0xf'))){_0x54bf6f[_0x4215('0x10')]=moment()[_0x4215('0x11')](_0x4215('0x12'));}_0x540479(null,_0x54bf6f);}},'charset':_0x4215('0x13'),'collate':_0x4215('0x14')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 7702aeb..c62c64d 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 _0x0009=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./chatInteraction.socket','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','ChatInteraction','raw','options','where','attributes','limit','UpdateChatInteraction','stringify','AddTagsToChatInteraction','find','addTags','ids','omit','body','spread','AddTags','lodash','util','bluebird','randomstring','ioredis'];(function(_0x4d1f8e,_0x1c9026){var _0x5020d7=function(_0x327227){while(--_0x327227){_0x4d1f8e['push'](_0x4d1f8e['shift']());}};_0x5020d7(++_0x1c9026);}(_0x0009,0x121));var _0x9000=function(_0x5706fb,_0xacfe3c){_0x5706fb=_0x5706fb-0x0;var _0x21799d=_0x0009[_0x5706fb];return _0x21799d;};'use strict';var _=require(_0x9000('0x0'));var util=require(_0x9000('0x1'));var moment=require('moment');var BPromise=require(_0x9000('0x2'));var rs=require(_0x9000('0x3'));var fs=require('fs');var Redis=require(_0x9000('0x4'));var db=require(_0x9000('0x5'))['db'];var utils=require(_0x9000('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x9000('0x7'));var jayson=require(_0x9000('0x8'));var client=jayson[_0x9000('0x9')]['http']({'port':0x232a});config[_0x9000('0xa')]=_['defaults'](config[_0x9000('0xa')],{'host':_0x9000('0xb'),'port':0x18eb});var socket=require(_0x9000('0xc'))(new Redis(config[_0x9000('0xa')]));require(_0x9000('0xd'))['register'](socket);function respondWithRpcPromise(_0x49863d,_0x2addf9,_0x4952ec){return new BPromise(function(_0x4b9705,_0x20f63e){return client[_0x9000('0xe')](_0x49863d,_0x4952ec)[_0x9000('0xf')](function(_0x4caee6){logger[_0x9000('0x10')]('ChatInteraction,\x20%s,\x20%s',_0x2addf9,_0x9000('0x11'));logger[_0x9000('0x12')](_0x9000('0x13'),_0x2addf9,_0x9000('0x11'),JSON['stringify'](_0x4caee6));if(_0x4caee6[_0x9000('0x14')]){if(_0x4caee6[_0x9000('0x14')][_0x9000('0x15')]===0x1f4){logger[_0x9000('0x14')](_0x9000('0x16'),_0x2addf9,_0x4caee6[_0x9000('0x14')][_0x9000('0x17')]);return _0x20f63e(_0x4caee6[_0x9000('0x14')][_0x9000('0x17')]);}logger[_0x9000('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x2addf9,_0x4caee6[_0x9000('0x14')][_0x9000('0x17')]);return _0x4b9705(_0x4caee6['error'][_0x9000('0x17')]);}else{logger[_0x9000('0x10')](_0x9000('0x16'),_0x2addf9,'request\x20sent');_0x4b9705(_0x4caee6[_0x9000('0x18')][_0x9000('0x17')]);}})[_0x9000('0x19')](function(_0x333259){logger['error'](_0x9000('0x16'),_0x2addf9,_0x333259);_0x20f63e(_0x333259);});});}exports['UpdateChatInteraction']=function(_0x2833f4){var _0x5b393c=this;return new Promise(function(_0x2d9d27,_0xd7afcd){return db[_0x9000('0x1a')]['update'](_0x2833f4['body'],{'raw':_0x2833f4['options']?_0x2833f4['options'][_0x9000('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2833f4[_0x9000('0x1c')]?_0x2833f4[_0x9000('0x1c')][_0x9000('0x1d')]||null:null,'attributes':_0x2833f4[_0x9000('0x1c')]?_0x2833f4[_0x9000('0x1c')][_0x9000('0x1e')]||null:null,'limit':_0x2833f4[_0x9000('0x1c')]?_0x2833f4[_0x9000('0x1c')][_0x9000('0x1f')]||null:null})[_0x9000('0xf')](function(_0x50b295){logger[_0x9000('0x10')](_0x9000('0x20'),_0x2833f4);logger['debug'](_0x9000('0x20'),_0x2833f4,JSON[_0x9000('0x21')](_0x50b295));_0x2d9d27(_0x50b295);})['catch'](function(_0x5cbeed){logger[_0x9000('0x14')](_0x9000('0x20'),_0x5cbeed['message'],_0x2833f4);_0xd7afcd(_0x5b393c[_0x9000('0x14')](0x1f4,_0x5cbeed[_0x9000('0x17')]));});});};exports[_0x9000('0x22')]=function(_0x442214){return new Promise(function(_0x298488,_0x16c8fa){return db['ChatInteraction'][_0x9000('0x23')]({'where':_0x442214[_0x9000('0x1c')]?_0x442214[_0x9000('0x1c')][_0x9000('0x1d')]||null:null})[_0x9000('0xf')](function(_0x9a2999){if(_0x9a2999){return _0x9a2999[_0x9000('0x24')](_0x442214['body'][_0x9000('0x25')],_[_0x9000('0x26')](_0x442214[_0x9000('0x27')],[_0x9000('0x25'),'id'])||{});}})[_0x9000('0x28')](function(_0x2e2334){logger[_0x9000('0x10')](_0x9000('0x29'),_0x442214);logger['debug'](_0x9000('0x29'),_0x442214,JSON['stringify'](_0x2e2334));_0x298488(_0x2e2334);})[_0x9000('0x19')](function(_0x36f10e){logger[_0x9000('0x14')](_0x9000('0x29'),_0x36f10e[_0x9000('0x17')],_0x442214);_0x16c8fa(_this[_0x9000('0x14')](0x1f4,_0x36f10e[_0x9000('0x17')]));});});}; \ No newline at end of file +var _0x0f97=['request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','error','message','UpdateChatInteraction','ChatInteraction','body','options','raw','where','limit','stringify','catch','AddTagsToChatInteraction','addTags','omit','spread','debug','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./chatInteraction.socket','register'];(function(_0x4ff81c,_0x5c0db3){var _0x175291=function(_0x3f14c3){while(--_0x3f14c3){_0x4ff81c['push'](_0x4ff81c['shift']());}};_0x175291(++_0x5c0db3);}(_0x0f97,0xaf));var _0x70f9=function(_0x2d6375,_0x149216){_0x2d6375=_0x2d6375-0x0;var _0x29186f=_0x0f97[_0x2d6375];return _0x29186f;};'use strict';var _=require(_0x70f9('0x0'));var util=require(_0x70f9('0x1'));var moment=require(_0x70f9('0x2'));var BPromise=require('bluebird');var rs=require(_0x70f9('0x3'));var fs=require('fs');var Redis=require(_0x70f9('0x4'));var db=require(_0x70f9('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x70f9('0x6'));var config=require(_0x70f9('0x7'));var jayson=require(_0x70f9('0x8'));var client=jayson['client'][_0x70f9('0x9')]({'port':0x232a});config[_0x70f9('0xa')]=_['defaults'](config[_0x70f9('0xa')],{'host':_0x70f9('0xb'),'port':0x18eb});var socket=require(_0x70f9('0xc'))(new Redis(config['redis']));require(_0x70f9('0xd'))[_0x70f9('0xe')](socket);function respondWithRpcPromise(_0xa9bf84,_0x1878bd,_0x108db2){return new BPromise(function(_0x53f04d,_0x229b21){return client[_0x70f9('0xf')](_0xa9bf84,_0x108db2)[_0x70f9('0x10')](function(_0x402489){logger[_0x70f9('0x11')](_0x70f9('0x12'),_0x1878bd,_0x70f9('0x13'));logger['debug'](_0x70f9('0x14'),_0x1878bd,_0x70f9('0x13'),JSON['stringify'](_0x402489));if(_0x402489[_0x70f9('0x15')]){if(_0x402489[_0x70f9('0x15')]['code']===0x1f4){logger['error'](_0x70f9('0x12'),_0x1878bd,_0x402489[_0x70f9('0x15')][_0x70f9('0x16')]);return _0x229b21(_0x402489['error']['message']);}logger[_0x70f9('0x15')](_0x70f9('0x12'),_0x1878bd,_0x402489[_0x70f9('0x15')][_0x70f9('0x16')]);return _0x53f04d(_0x402489[_0x70f9('0x15')]['message']);}else{logger['info'](_0x70f9('0x12'),_0x1878bd,_0x70f9('0x13'));_0x53f04d(_0x402489['result']['message']);}})['catch'](function(_0x3d7757){logger[_0x70f9('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x1878bd,_0x3d7757);_0x229b21(_0x3d7757);});});}exports[_0x70f9('0x17')]=function(_0x5ec653){var _0x33dde5=this;return new Promise(function(_0x50d0c4,_0x5e2276){return db[_0x70f9('0x18')]['update'](_0x5ec653[_0x70f9('0x19')],{'raw':_0x5ec653[_0x70f9('0x1a')]?_0x5ec653['options'][_0x70f9('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ec653['options']?_0x5ec653['options'][_0x70f9('0x1c')]||null:null,'attributes':_0x5ec653[_0x70f9('0x1a')]?_0x5ec653['options']['attributes']||null:null,'limit':_0x5ec653[_0x70f9('0x1a')]?_0x5ec653[_0x70f9('0x1a')][_0x70f9('0x1d')]||null:null})[_0x70f9('0x10')](function(_0x163b5a){logger[_0x70f9('0x11')](_0x70f9('0x17'),_0x5ec653);logger['debug']('UpdateChatInteraction',_0x5ec653,JSON[_0x70f9('0x1e')](_0x163b5a));_0x50d0c4(_0x163b5a);})[_0x70f9('0x1f')](function(_0x1c474b){logger[_0x70f9('0x15')]('UpdateChatInteraction',_0x1c474b['message'],_0x5ec653);_0x5e2276(_0x33dde5[_0x70f9('0x15')](0x1f4,_0x1c474b[_0x70f9('0x16')]));});});};exports[_0x70f9('0x20')]=function(_0x83e7d0){return new Promise(function(_0xdeca2,_0x308c14){return db[_0x70f9('0x18')]['find']({'where':_0x83e7d0[_0x70f9('0x1a')]?_0x83e7d0[_0x70f9('0x1a')][_0x70f9('0x1c')]||null:null})[_0x70f9('0x10')](function(_0x5d5d6a){if(_0x5d5d6a){return _0x5d5d6a[_0x70f9('0x21')](_0x83e7d0['body']['ids'],_[_0x70f9('0x22')](_0x83e7d0['body'],['ids','id'])||{});}})[_0x70f9('0x23')](function(_0x29d3a4){logger['info']('AddTags',_0x83e7d0);logger[_0x70f9('0x24')](_0x70f9('0x25'),_0x83e7d0,JSON[_0x70f9('0x1e')](_0x29d3a4));_0xdeca2(_0x29d3a4);})[_0x70f9('0x1f')](function(_0x2aa59b){logger[_0x70f9('0x15')]('AddTags',_0x2aa59b['message'],_0x83e7d0);_0x308c14(_this[_0x70f9('0x15')](0x1f4,_0x2aa59b[_0x70f9('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 403551e..8927cf8 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 _0x8873=['emit','removeListener','register','length','chatInteraction:','./chatInteraction.events','save','remove'];(function(_0x462545,_0x3c0f1b){var _0x680d51=function(_0x22727b){while(--_0x22727b){_0x462545['push'](_0x462545['shift']());}};_0x680d51(++_0x3c0f1b);}(_0x8873,0xad));var _0x3887=function(_0x2e0ffa,_0x451f12){_0x2e0ffa=_0x2e0ffa-0x0;var _0x24d627=_0x8873[_0x2e0ffa];return _0x24d627;};'use strict';var ChatInteractionEvents=require(_0x3887('0x0'));var events=[_0x3887('0x1'),_0x3887('0x2'),'update'];function createListener(_0x24558e,_0x3dd931){return function(_0x1ce9b5){_0x3dd931[_0x3887('0x3')](_0x24558e,_0x1ce9b5);};}function removeListener(_0x5b4e43,_0x203e5d){return function(){ChatInteractionEvents[_0x3887('0x4')](_0x5b4e43,_0x203e5d);};}exports[_0x3887('0x5')]=function(_0x3eb246){for(var _0x5358ef=0x0,_0x5c651f=events[_0x3887('0x6')];_0x5358ef<_0x5c651f;_0x5358ef++){var _0x4a46ff=events[_0x5358ef];var _0x42e810=createListener(_0x3887('0x7')+_0x4a46ff,_0x3eb246);ChatInteractionEvents['on'](_0x4a46ff,_0x42e810);}}; \ No newline at end of file +var _0x98ac=['remove','emit','register','length','chatInteraction:'];(function(_0x47f32a,_0x1dbe9b){var _0x22512d=function(_0x4874a0){while(--_0x4874a0){_0x47f32a['push'](_0x47f32a['shift']());}};_0x22512d(++_0x1dbe9b);}(_0x98ac,0x1d1));var _0xc98a=function(_0x14b1fa,_0x5aa6df){_0x14b1fa=_0x14b1fa-0x0;var _0x5cbea1=_0x98ac[_0x14b1fa];return _0x5cbea1;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=['save',_0xc98a('0x0'),'update'];function createListener(_0x54c55e,_0x402f8a){return function(_0x434f17){_0x402f8a[_0xc98a('0x1')](_0x54c55e,_0x434f17);};}function removeListener(_0x141041,_0xe44835){return function(){ChatInteractionEvents['removeListener'](_0x141041,_0xe44835);};}exports[_0xc98a('0x2')]=function(_0x3e95c6){for(var _0x531dba=0x0,_0x22a165=events[_0xc98a('0x3')];_0x531dba<_0x22a165;_0x531dba++){var _0x3d9c82=events[_0x531dba];var _0x17fcf8=createListener(_0xc98a('0x4')+_0x3d9c82,_0x3e95c6);ChatInteractionEvents['on'](_0x3d9c82,_0x17fcf8);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index e9d22c5..d0560c4 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 _0x075d=['attachmentUpload','/:id/messages','addMessage','tracked','chat','chatinteraction:addtags','put','chatinteraction:update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','chatinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','isChatInteractionAuthorized','show','/:id/attachment_download','/:id/my_messages','getMyMessages','/:id/download','download','post','create','createVidaooSession','diskStorage','format','%s-%s','now','originalname','replace'];(function(_0x5ced7d,_0x20ce01){var _0x5ceaa6=function(_0xdc898f){while(--_0xdc898f){_0x5ced7d['push'](_0x5ced7d['shift']());}};_0x5ceaa6(++_0x20ce01);}(_0x075d,0xf8));var _0xd075=function(_0x20763f,_0x95bba){_0x20763f=_0x20763f-0x0;var _0x5462a3=_0x075d[_0x20763f];return _0x5462a3;};'use strict';var multer=require(_0xd075('0x0'));var util=require(_0xd075('0x1'));var path=require(_0xd075('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd075('0x3')]();var fs_extra=require(_0xd075('0x4'));var auth=require(_0xd075('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd075('0x6'));var controller=require('./chatInteraction.controller');router[_0xd075('0x7')]('/',auth[_0xd075('0x8')](),controller[_0xd075('0x9')]);router['get'](_0xd075('0xa'),auth[_0xd075('0x8')](),controller[_0xd075('0xb')]);router[_0xd075('0x7')]('/:id',auth[_0xd075('0xc')](),controller[_0xd075('0xd')]);router[_0xd075('0x7')](_0xd075('0xe'),auth[_0xd075('0xc')](),controller['attachmentDownload']);router[_0xd075('0x7')]('/:id/messages',auth[_0xd075('0x8')](),controller['getMessages']);router['get'](_0xd075('0xf'),auth[_0xd075('0xc')](),controller[_0xd075('0x10')]);router[_0xd075('0x7')](_0xd075('0x11'),auth[_0xd075('0x8')](),controller[_0xd075('0x12')]);router[_0xd075('0x13')]('/',auth[_0xd075('0x8')](),controller[_0xd075('0x14')]);router[_0xd075('0x13')]('/:id/vidaoo',auth[_0xd075('0x8')](),controller[_0xd075('0x15')]);var upload=multer({'storage':multer[_0xd075('0x16')]({'destination':function(_0x3c3c84,_0x1dd101,_0x40c45d){_0x40c45d(null,path['join'](config['root'],'server/files/attachments/'));},'filename':function(_0x2e0d91,_0x22ef12,_0x1e1831){_0x1e1831(null,util[_0xd075('0x17')](_0xd075('0x18'),Date[_0xd075('0x19')](),_0x22ef12[_0xd075('0x1a')][_0xd075('0x1b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xd075('0x13')]('/:id/attachment_upload',upload['single']('file'),controller[_0xd075('0x1c')]);router['post'](_0xd075('0x1d'),auth[_0xd075('0xc')](),controller[_0xd075('0x1e')]);router[_0xd075('0x13')]('/:id/tags',auth[_0xd075('0x8')](),interaction[_0xd075('0x1f')](_0xd075('0x20'),_0xd075('0x21')),controller['addTags']);router[_0xd075('0x22')]('/:id',auth[_0xd075('0x8')](),interaction[_0xd075('0x1f')]('chat',_0xd075('0x23')),controller['update']);router['put'](_0xd075('0x24'),controller[_0xd075('0x25')]);router[_0xd075('0x22')](_0xd075('0x26'),auth['isChatInteractionAuthorized'](),controller[_0xd075('0x27')]);router[_0xd075('0x22')](_0xd075('0x28'),controller['close']);router['delete']('/:id',auth[_0xd075('0x8')](),interaction['tracked']('chat',_0xd075('0x29')),controller[_0xd075('0x2a')]);router[_0xd075('0x2b')]('/:id/tags',auth['isAuthenticated'](),controller[_0xd075('0x2c')]);module[_0xd075('0x2d')]=router; \ No newline at end of file +var _0xcc17=['../../components/auth/service','./chatInteraction.controller','get','isAuthenticated','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','/:id/messages','/:id/my_messages','getMyMessages','download','post','create','/:id/vidaoo','createVidaooSession','join','format','now','/:id/attachment_upload','single','file','attachmentUpload','addMessage','tracked','chat','chatinteraction:addtags','addTags','put','update','/:id/custom_update','/:id/abandon','delete','chatinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','path','express','Router','fs-extra'];(function(_0x1fe0d4,_0x3e9d58){var _0x49675a=function(_0x1c96e9){while(--_0x1c96e9){_0x1fe0d4['push'](_0x1fe0d4['shift']());}};_0x49675a(++_0x3e9d58);}(_0xcc17,0x10e));var _0x7cc1=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0xcc17[_0x166d93];return _0xba708;};'use strict';var multer=require(_0x7cc1('0x0'));var util=require(_0x7cc1('0x1'));var path=require(_0x7cc1('0x2'));var timeout=require('connect-timeout');var express=require(_0x7cc1('0x3'));var router=express[_0x7cc1('0x4')]();var fs_extra=require(_0x7cc1('0x5'));var auth=require(_0x7cc1('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7cc1('0x7'));router[_0x7cc1('0x8')]('/',auth[_0x7cc1('0x9')](),controller['index']);router['get'](_0x7cc1('0xa'),auth[_0x7cc1('0x9')](),controller[_0x7cc1('0xb')]);router[_0x7cc1('0x8')](_0x7cc1('0xc'),auth[_0x7cc1('0xd')](),controller[_0x7cc1('0xe')]);router[_0x7cc1('0x8')](_0x7cc1('0xf'),auth['isChatInteractionAuthorized'](),controller['attachmentDownload']);router['get'](_0x7cc1('0x10'),auth[_0x7cc1('0x9')](),controller['getMessages']);router[_0x7cc1('0x8')](_0x7cc1('0x11'),auth[_0x7cc1('0xd')](),controller[_0x7cc1('0x12')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x7cc1('0x13')]);router[_0x7cc1('0x14')]('/',auth[_0x7cc1('0x9')](),controller[_0x7cc1('0x15')]);router[_0x7cc1('0x14')](_0x7cc1('0x16'),auth['isAuthenticated'](),controller[_0x7cc1('0x17')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xb5148a,_0x537b2d,_0x37beb7){_0x37beb7(null,path[_0x7cc1('0x18')](config['root'],'server/files/attachments/'));},'filename':function(_0x3f7fc5,_0x219443,_0x46b275){_0x46b275(null,util[_0x7cc1('0x19')]('%s-%s',Date[_0x7cc1('0x1a')](),_0x219443['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x7cc1('0x1b'),upload[_0x7cc1('0x1c')](_0x7cc1('0x1d')),controller[_0x7cc1('0x1e')]);router['post'](_0x7cc1('0x10'),auth[_0x7cc1('0xd')](),controller[_0x7cc1('0x1f')]);router[_0x7cc1('0x14')]('/:id/tags',auth[_0x7cc1('0x9')](),interaction[_0x7cc1('0x20')](_0x7cc1('0x21'),_0x7cc1('0x22')),controller[_0x7cc1('0x23')]);router[_0x7cc1('0x24')](_0x7cc1('0xc'),auth[_0x7cc1('0x9')](),interaction[_0x7cc1('0x20')](_0x7cc1('0x21'),'chatinteraction:update'),controller[_0x7cc1('0x25')]);router[_0x7cc1('0x24')](_0x7cc1('0x26'),controller['customUpdate']);router[_0x7cc1('0x24')](_0x7cc1('0x27'),auth['isChatInteractionAuthorized'](),controller['abandon']);router[_0x7cc1('0x24')]('/:id/close',controller['close']);router[_0x7cc1('0x28')]('/:id',auth[_0x7cc1('0x9')](),interaction[_0x7cc1('0x20')](_0x7cc1('0x21'),_0x7cc1('0x29')),controller[_0x7cc1('0x2a')]);router['delete'](_0x7cc1('0x2b'),auth[_0x7cc1('0x9')](),controller[_0x7cc1('0x2c')]);module[_0x7cc1('0x2d')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index f8dc066..e3eb276 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 _0x41c6=['sequelize','TEXT','INTEGER'];(function(_0x4332a5,_0xa5b7f5){var _0x41d367=function(_0xff6d4c){while(--_0xff6d4c){_0x4332a5['push'](_0x4332a5['shift']());}};_0x41d367(++_0xa5b7f5);}(_0x41c6,0x87));var _0x641c=function(_0x599d26,_0x48ef3f){_0x599d26=_0x599d26-0x0;var _0x2ebcfc=_0x41c6[_0x599d26];return _0x2ebcfc;};'use strict';var Sequelize=require(_0x641c('0x0'));module['exports']={'body':{'type':Sequelize[_0x641c('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x641c('0x2')]}}; \ No newline at end of file +var _0x2bc9=['TEXT','medium','sequelize','exports'];(function(_0x17590e,_0x426474){var _0x22884e=function(_0x1f9d5f){while(--_0x1f9d5f){_0x17590e['push'](_0x17590e['shift']());}};_0x22884e(++_0x426474);}(_0x2bc9,0x1d6));var _0x92bc=function(_0x2cdd4d,_0x394c2f){_0x2cdd4d=_0x2cdd4d-0x0;var _0x55cbc8=_0x2bc9[_0x2cdd4d];return _0x55cbc8;};'use strict';var Sequelize=require(_0x92bc('0x0'));module[_0x92bc('0x1')]={'body':{'type':Sequelize[_0x92bc('0x2')](_0x92bc('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index e6225bc..3627c8b 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 _0x2377=['include','findAll','rows','show','keys','fields','includeAll','find','catch','create','body','describe','get','messages','lastMessageAt','lastMessage','format','agent','user','fullname','userpic','internal','online','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','role','Agents','userProfileId','autoAssociation','resourceId','push','createdAt','FromId','ToId','read','-createdAt','all','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','end','status','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','ChatInternalMessage'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x2377,0x93));var _0x7237=function(_0x4d8d65,_0x22a6bd){_0x4d8d65=_0x4d8d65-0x0;var _0x26c8b2=_0x2377[_0x4d8d65];return _0x26c8b2;};'use strict';var emlformat=require(_0x7237('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7237('0x1'));var jsonpatch=require(_0x7237('0x2'));var rp=require(_0x7237('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7237('0x4'));var util=require(_0x7237('0x5'));var path=require(_0x7237('0x6'));var sox=require(_0x7237('0x7'));var csv=require('to-csv');var ejs=require(_0x7237('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7237('0x9'));var squel=require(_0x7237('0xa'));var crypto=require(_0x7237('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7237('0xc'));var querystring=require(_0x7237('0xd'));var Papa=require(_0x7237('0xe'));var Redis=require(_0x7237('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7237('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7237('0x11'));var utils=require(_0x7237('0x12'));var config=require(_0x7237('0x13'));var licenseUtil=require(_0x7237('0x14'));var db=require(_0x7237('0x15'))['db'];config[_0x7237('0x16')]=_[_0x7237('0x17')](config[_0x7237('0x16')],{'host':_0x7237('0x18'),'port':0x18eb});var socket=require(_0x7237('0x19'))(new Redis(config[_0x7237('0x16')]));require('./chatInternalMessage.socket')[_0x7237('0x1a')](socket);function respondWithStatusCode(_0xcafef6,_0x168c82){_0x168c82=_0x168c82||0xcc;return function(_0x24da65){if(_0x24da65){return _0xcafef6['sendStatus'](_0x168c82);}return _0xcafef6['status'](_0x168c82)[_0x7237('0x1b')]();};}function respondWithResult(_0x3cb196,_0x3ab93e){_0x3ab93e=_0x3ab93e||0xc8;return function(_0x34878a){if(_0x34878a){return _0x3cb196[_0x7237('0x1c')](_0x3ab93e)[_0x7237('0x1d')](_0x34878a);}};}function respondWithFilteredResult(_0x52e388,_0x532f66){return function(_0x1abd2e){if(_0x1abd2e){var _0x172da1=typeof _0x532f66['offset']===_0x7237('0x1e')&&typeof _0x532f66[_0x7237('0x1f')]===_0x7237('0x1e');var _0xe7afc=_0x1abd2e[_0x7237('0x20')];var _0x4512af=_0x172da1?0x0:_0x532f66[_0x7237('0x21')];var _0x2478c3=_0x172da1?_0x1abd2e[_0x7237('0x20')]:_0x532f66[_0x7237('0x21')]+_0x532f66['limit'];var _0x2593ac;if(_0x2478c3>=_0xe7afc){_0x2478c3=_0xe7afc;_0x2593ac=0xc8;}else{_0x2593ac=0xce;}_0x52e388[_0x7237('0x1c')](_0x2593ac);return _0x52e388['set'](_0x7237('0x22'),_0x4512af+'-'+_0x2478c3+'/'+_0xe7afc)['json'](_0x1abd2e);}return null;};}function patchUpdates(_0x2e16af){return function(_0x44f9bd){try{jsonpatch['apply'](_0x44f9bd,_0x2e16af,!![]);}catch(_0xb30025){return BPromise[_0x7237('0x23')](_0xb30025);}return _0x44f9bd[_0x7237('0x24')]();};}function saveUpdates(_0x269fa8,_0x34d9f2){return function(_0x240f02){if(_0x240f02){return _0x240f02[_0x7237('0x25')](_0x269fa8)[_0x7237('0x26')](function(_0x1d6e2d){return _0x1d6e2d;});}return null;};}function removeEntity(_0x45ce73,_0x4bc4a2){return function(_0x4fc5fe){if(_0x4fc5fe){return _0x4fc5fe[_0x7237('0x27')]()[_0x7237('0x26')](function(){_0x45ce73['status'](0xcc)[_0x7237('0x1b')]();});}};}function handleEntityNotFound(_0x26b8f4,_0x3fa628){return function(_0xf903ba){if(!_0xf903ba){_0x26b8f4[_0x7237('0x28')](0x194);}return _0xf903ba;};}function handleError(_0x45f7f9,_0x528b16){_0x528b16=_0x528b16||0x1f4;return function(_0x48358a){logger['error'](_0x48358a[_0x7237('0x29')]);if(_0x48358a[_0x7237('0x2a')]){delete _0x48358a['name'];}_0x45f7f9[_0x7237('0x1c')](_0x528b16)[_0x7237('0x2b')](_0x48358a);};}exports[_0x7237('0x2c')]=function(_0x34e45b,_0x21152c){var _0x57f4ef={},_0x252a22={},_0x30bf6a={'count':0x0,'rows':[]};var _0x3f9958=_[_0x7237('0x2d')](db['ChatInternalMessage'][_0x7237('0x2e')],function(_0x3124e2){return{'name':_0x3124e2[_0x7237('0x2f')],'type':_0x3124e2[_0x7237('0x30')][_0x7237('0x31')]};});_0x252a22['model']=_[_0x7237('0x2d')](_0x3f9958,_0x7237('0x2a'));_0x252a22[_0x7237('0x32')]=_['keys'](_0x34e45b[_0x7237('0x32')]);_0x252a22[_0x7237('0x33')]=_[_0x7237('0x34')](_0x252a22['model'],_0x252a22[_0x7237('0x32')]);_0x57f4ef['attributes']=_[_0x7237('0x34')](_0x252a22[_0x7237('0x35')],qs['fields'](_0x34e45b['query']['fields']));_0x57f4ef[_0x7237('0x36')]=_0x57f4ef['attributes'][_0x7237('0x37')]?_0x57f4ef[_0x7237('0x36')]:_0x252a22[_0x7237('0x35')];if(!_0x34e45b[_0x7237('0x32')][_0x7237('0x38')](_0x7237('0x39'))){_0x57f4ef[_0x7237('0x1f')]=qs[_0x7237('0x1f')](_0x34e45b[_0x7237('0x32')]['limit']);_0x57f4ef[_0x7237('0x21')]=qs['offset'](_0x34e45b[_0x7237('0x32')][_0x7237('0x21')]);}_0x57f4ef[_0x7237('0x3a')]=qs[_0x7237('0x3b')](_0x34e45b['query'][_0x7237('0x3b')]);_0x57f4ef['where']=qs[_0x7237('0x33')](_[_0x7237('0x3c')](_0x34e45b[_0x7237('0x32')],_0x252a22[_0x7237('0x33')]),_0x3f9958);if(_0x34e45b[_0x7237('0x32')]['filter']){_0x57f4ef['where']=_[_0x7237('0x3d')](_0x57f4ef[_0x7237('0x3e')],{'$or':_[_0x7237('0x2d')](_0x3f9958,function(_0x587424){if(_0x587424[_0x7237('0x30')]!==_0x7237('0x3f')){var _0x202c13={};_0x202c13[_0x587424[_0x7237('0x2a')]]={'$like':'%'+_0x34e45b[_0x7237('0x32')][_0x7237('0x40')]+'%'};return _0x202c13;}})});}_0x57f4ef=_[_0x7237('0x3d')]({},_0x57f4ef,_0x34e45b[_0x7237('0x41')]);var _0x3065cd={'where':_0x57f4ef[_0x7237('0x3e')]};return db[_0x7237('0x42')][_0x7237('0x20')](_0x3065cd)[_0x7237('0x26')](function(_0x2c98e2){_0x30bf6a[_0x7237('0x20')]=_0x2c98e2;if(_0x34e45b[_0x7237('0x32')]['includeAll']){_0x57f4ef[_0x7237('0x43')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x7237('0x44')](_0x57f4ef);})[_0x7237('0x26')](function(_0x4b9d3f){_0x30bf6a[_0x7237('0x45')]=_0x4b9d3f;return _0x30bf6a;})['then'](respondWithFilteredResult(_0x21152c,_0x57f4ef))['catch'](handleError(_0x21152c,null));};exports[_0x7237('0x46')]=function(_0x21ab9b,_0x55666d){var _0x314da1={'raw':!![],'where':{'id':_0x21ab9b['params']['id']}},_0x159ab1={};_0x159ab1[_0x7237('0x35')]=_['keys'](db[_0x7237('0x42')][_0x7237('0x2e')]);_0x159ab1[_0x7237('0x32')]=_[_0x7237('0x47')](_0x21ab9b['query']);_0x159ab1[_0x7237('0x33')]=_[_0x7237('0x34')](_0x159ab1[_0x7237('0x35')],_0x159ab1['query']);_0x314da1[_0x7237('0x36')]=_[_0x7237('0x34')](_0x159ab1[_0x7237('0x35')],qs[_0x7237('0x48')](_0x21ab9b[_0x7237('0x32')][_0x7237('0x48')]));_0x314da1['attributes']=_0x314da1['attributes'][_0x7237('0x37')]?_0x314da1['attributes']:_0x159ab1[_0x7237('0x35')];if(_0x21ab9b[_0x7237('0x32')][_0x7237('0x49')]){_0x314da1['include']=[{'all':!![]}];}_0x314da1=_['merge']({},_0x314da1,_0x21ab9b[_0x7237('0x41')]);return db[_0x7237('0x42')][_0x7237('0x4a')](_0x314da1)[_0x7237('0x26')](handleEntityNotFound(_0x55666d,null))[_0x7237('0x26')](respondWithResult(_0x55666d,null))[_0x7237('0x4b')](handleError(_0x55666d,null));};exports[_0x7237('0x4c')]=function(_0x192832,_0xdbdddb){return db['ChatInternalMessage'][_0x7237('0x4c')](_0x192832['body'],{})[_0x7237('0x26')](respondWithResult(_0xdbdddb,0xc9))[_0x7237('0x4b')](handleError(_0xdbdddb,null));};exports['update']=function(_0x1c3a6b,_0x2d323){if(_0x1c3a6b['body']['id']){delete _0x1c3a6b[_0x7237('0x4d')]['id'];}return db['ChatInternalMessage'][_0x7237('0x4a')]({'where':{'id':_0x1c3a6b['params']['id']}})[_0x7237('0x26')](handleEntityNotFound(_0x2d323,null))[_0x7237('0x26')](saveUpdates(_0x1c3a6b[_0x7237('0x4d')],null))[_0x7237('0x26')](respondWithResult(_0x2d323,null))[_0x7237('0x4b')](handleError(_0x2d323,null));};exports[_0x7237('0x27')]=function(_0x4ca215,_0xd9369b){return db[_0x7237('0x42')]['find']({'where':{'id':_0x4ca215['params']['id']}})[_0x7237('0x26')](handleEntityNotFound(_0xd9369b,null))[_0x7237('0x26')](removeEntity(_0xd9369b,null))['catch'](handleError(_0xd9369b,null));};exports['describe']=function(_0x514bd0,_0x47423e){return db[_0x7237('0x42')][_0x7237('0x4e')]()[_0x7237('0x26')](respondWithResult(_0x47423e,null))[_0x7237('0x4b')](handleError(_0x47423e,null));};function wrapUser(_0x5df70f){return function(_0x1cf28a){var _0xb39162=_0x5df70f[_0x7237('0x4f')]({'plain':!![]});_0xb39162[_0x7237('0x50')]=[];if(_0x1cf28a){_0xb39162[_0x7237('0x51')]=_0x1cf28a['createdAt'];_0xb39162[_0x7237('0x52')]=_0x1cf28a;}else{_0xb39162[_0x7237('0x51')]=moment(0x0)[_0x7237('0x53')]('YYYY-MM-DD\x20HH:mm:ss');_0xb39162[_0x7237('0x52')]={};}return _0xb39162;};}exports['getUsers']=function(_0x17cb09,_0x264b2e,_0x416eab){var _0x45e03c=[];return db['User']['findAll']({'where':{'role':[_0x7237('0x54'),'admin',_0x7237('0x55')]},'attributes':['id',_0x7237('0x56'),_0x7237('0x2a'),'role',_0x7237('0x57'),_0x7237('0x58'),_0x7237('0x59'),'lastLoginAt',_0x7237('0x5a'),_0x7237('0x5b')],'order':qs['sort'](_0x7237('0x5c')),'include':[{'model':db[_0x7237('0x5d')],'as':_0x7237('0x5e'),'attributes':['id',_0x7237('0x2a'),_0x7237('0x30')],'through':{'attributes':[]}}]})[_0x7237('0x26')](function(_0x3cb866){if(_0x3cb866){var _0x3ef253=_0x17cb09[_0x7237('0x55')][_0x7237('0x4f')]({'plain':!![]});if(!_0x3ef253)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ef253[_0x7237('0x5f')]===_0x7237('0x55')){return db['UserProfileSection'][_0x7237('0x4a')]({'where':{'name':_0x7237('0x60'),'userProfileId':_0x3ef253[_0x7237('0x61')]},'raw':!![]})[_0x7237('0x26')](function(_0xee2c23){if(_0xee2c23){if(_0xee2c23[_0x7237('0x62')]===0x0){return db['UserProfileResource'][_0x7237('0x44')]({'where':{'sectionId':_0xee2c23['id']},'raw':!![]})[_0x7237('0x26')](function(_0x3b83bb){var _0x43edf1=[];if(_['isEmpty'](_0x3b83bb)){_0x43edf1=_[_0x7237('0x40')](_0x3cb866,function(_0x5979c6){if(_0x5979c6['role']!==_0x7237('0x54')){return _0x5979c6;}});return _0x43edf1;}else{for(var _0x5f5a79=0x0;_0x5f5a79<_0x3cb866[_0x7237('0x37')];_0x5f5a79++){var _0x269eff=_0x3cb866[_0x5f5a79];if(_0x269eff[_0x7237('0x5f')]===_0x7237('0x54')){var _0xe01da4=_['find'](_0x3b83bb,function(_0x26f5a9){return _0x26f5a9[_0x7237('0x63')]===_0x269eff['id'];});if(_0xe01da4)_0x43edf1[_0x7237('0x64')](_0x269eff);}else{_0x43edf1['push'](_0x269eff);}}return _0x43edf1;}});}else{return _0x3cb866;}}else{var _0x46dffd=_[_0x7237('0x40')](_0x3cb866,function(_0x3c4ac0){if(_0x3c4ac0[_0x7237('0x5f')]!==_0x7237('0x54')){return _0x3c4ac0;}});return _0x46dffd;}});}else{return _0x3cb866;}}})[_0x7237('0x26')](function(_0x1ce085){var _0x83dcaf=[];if(_0x1ce085){_0x45e03c=_0x1ce085;for(var _0x6301f9=0x0;_0x6301f9<_0x1ce085['length'];_0x6301f9+=0x1){_0x45e03c[_0x6301f9][_0x7237('0x50')]=[];_0x83dcaf['push'](db['ChatInternalMessage'][_0x7237('0x4a')]({'where':{'FromId':[_0x17cb09[_0x7237('0x55')]['id'],_0x1ce085[_0x6301f9]['id']],'ToId':[_0x17cb09[_0x7237('0x55')]['id'],_0x1ce085[_0x6301f9]['id']],'ChatGroupId':null},'attributes':['id',_0x7237('0x65'),_0x7237('0x66'),_0x7237('0x67'),_0x7237('0x68'),'body'],'order':qs[_0x7237('0x3b')](_0x7237('0x69')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x7237('0x26')](wrapUser(_0x1ce085[_0x6301f9])));}return BPromise[_0x7237('0x6a')](_0x83dcaf);}return[];})[_0x7237('0x26')](function(_0x506514){return{'rows':_0x506514,'count':_0x506514[_0x7237('0x37')]};})[_0x7237('0x26')](respondWithResult(_0x264b2e,null))['catch'](handleError(_0x264b2e,null));}; \ No newline at end of file +var _0x70ff=['../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','json','offset','undefined','count','set','save','update','then','end','error','stack','name','send','index','ChatInternalMessage','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','rawAttributes','merge','find','catch','create','body','describe','get','lastMessageAt','createdAt','lastMessage','getUsers','User','agent','admin','fullname','internal','online','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','VoiceQueues','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','resourceId','push','messages','ToId','read','-createdAt','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','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/utils'];(function(_0x16c925,_0x16f4c3){var _0x54e4ca=function(_0x13597b){while(--_0x13597b){_0x16c925['push'](_0x16c925['shift']());}};_0x54e4ca(++_0x16f4c3);}(_0x70ff,0x12f));var _0xf70f=function(_0x8d8f23,_0x8c1961){_0x8d8f23=_0x8d8f23-0x0;var _0x22bf54=_0x70ff[_0x8d8f23];return _0x22bf54;};'use strict';var emlformat=require(_0xf70f('0x0'));var rimraf=require(_0xf70f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf70f('0x2'));var rp=require(_0xf70f('0x3'));var moment=require(_0xf70f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf70f('0x5'));var util=require(_0xf70f('0x6'));var path=require('path');var sox=require(_0xf70f('0x7'));var csv=require('to-csv');var ejs=require(_0xf70f('0x8'));var fs=require('fs');var fs_extra=require(_0xf70f('0x9'));var _=require(_0xf70f('0xa'));var squel=require(_0xf70f('0xb'));var crypto=require(_0xf70f('0xc'));var jsforce=require(_0xf70f('0xd'));var deskjs=require(_0xf70f('0xe'));var toCsv=require(_0xf70f('0xf'));var querystring=require(_0xf70f('0x10'));var Papa=require(_0xf70f('0x11'));var Redis=require(_0xf70f('0x12'));var authService=require(_0xf70f('0x13'));var qs=require(_0xf70f('0x14'));var as=require(_0xf70f('0x15'));var hardwareService=require(_0xf70f('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xf70f('0x17'));var config=require(_0xf70f('0x18'));var licenseUtil=require(_0xf70f('0x19'));var db=require(_0xf70f('0x1a'))['db'];config[_0xf70f('0x1b')]=_[_0xf70f('0x1c')](config['redis'],{'host':_0xf70f('0x1d'),'port':0x18eb});var socket=require(_0xf70f('0x1e'))(new Redis(config[_0xf70f('0x1b')]));require(_0xf70f('0x1f'))[_0xf70f('0x20')](socket);function respondWithStatusCode(_0x36808b,_0x195827){_0x195827=_0x195827||0xcc;return function(_0x4257e9){if(_0x4257e9){return _0x36808b[_0xf70f('0x21')](_0x195827);}return _0x36808b[_0xf70f('0x22')](_0x195827)['end']();};}function respondWithResult(_0x159cdf,_0x38ba86){_0x38ba86=_0x38ba86||0xc8;return function(_0x3bfdb1){if(_0x3bfdb1){return _0x159cdf[_0xf70f('0x22')](_0x38ba86)[_0xf70f('0x23')](_0x3bfdb1);}};}function respondWithFilteredResult(_0x20177e,_0x1551a4){return function(_0x290314){if(_0x290314){var _0x516680=typeof _0x1551a4[_0xf70f('0x24')]===_0xf70f('0x25')&&typeof _0x1551a4['limit']==='undefined';var _0x41be77=_0x290314[_0xf70f('0x26')];var _0x378b57=_0x516680?0x0:_0x1551a4[_0xf70f('0x24')];var _0x2c1b3b=_0x516680?_0x290314[_0xf70f('0x26')]:_0x1551a4[_0xf70f('0x24')]+_0x1551a4['limit'];var _0x51f86d;if(_0x2c1b3b>=_0x41be77){_0x2c1b3b=_0x41be77;_0x51f86d=0xc8;}else{_0x51f86d=0xce;}_0x20177e['status'](_0x51f86d);return _0x20177e[_0xf70f('0x27')]('Content-Range',_0x378b57+'-'+_0x2c1b3b+'/'+_0x41be77)[_0xf70f('0x23')](_0x290314);}return null;};}function patchUpdates(_0x2189c2){return function(_0x7c71de){try{jsonpatch['apply'](_0x7c71de,_0x2189c2,!![]);}catch(_0x3afe13){return BPromise['reject'](_0x3afe13);}return _0x7c71de[_0xf70f('0x28')]();};}function saveUpdates(_0x4fd583,_0x553221){return function(_0x3e4bdc){if(_0x3e4bdc){return _0x3e4bdc[_0xf70f('0x29')](_0x4fd583)['then'](function(_0x3278c2){return _0x3278c2;});}return null;};}function removeEntity(_0x15949f,_0x2e6849){return function(_0x197d23){if(_0x197d23){return _0x197d23['destroy']()[_0xf70f('0x2a')](function(){_0x15949f[_0xf70f('0x22')](0xcc)[_0xf70f('0x2b')]();});}};}function handleEntityNotFound(_0xe88ba8,_0x17f8a3){return function(_0x3b0d31){if(!_0x3b0d31){_0xe88ba8['sendStatus'](0x194);}return _0x3b0d31;};}function handleError(_0x3e62cc,_0x43d1f5){_0x43d1f5=_0x43d1f5||0x1f4;return function(_0x5d9dcd){logger[_0xf70f('0x2c')](_0x5d9dcd[_0xf70f('0x2d')]);if(_0x5d9dcd['name']){delete _0x5d9dcd[_0xf70f('0x2e')];}_0x3e62cc[_0xf70f('0x22')](_0x43d1f5)[_0xf70f('0x2f')](_0x5d9dcd);};}exports[_0xf70f('0x30')]=function(_0x20e8fd,_0xb7eaa2){var _0x49732d={},_0x5b5e3c={},_0x424925={'count':0x0,'rows':[]};var _0x447b45=_['map'](db[_0xf70f('0x31')]['rawAttributes'],function(_0x5cfe54){return{'name':_0x5cfe54[_0xf70f('0x32')],'type':_0x5cfe54[_0xf70f('0x33')][_0xf70f('0x34')]};});_0x5b5e3c[_0xf70f('0x35')]=_[_0xf70f('0x36')](_0x447b45,_0xf70f('0x2e'));_0x5b5e3c[_0xf70f('0x37')]=_['keys'](_0x20e8fd['query']);_0x5b5e3c['filters']=_[_0xf70f('0x38')](_0x5b5e3c[_0xf70f('0x35')],_0x5b5e3c['query']);_0x49732d[_0xf70f('0x39')]=_['intersection'](_0x5b5e3c[_0xf70f('0x35')],qs[_0xf70f('0x3a')](_0x20e8fd['query'][_0xf70f('0x3a')]));_0x49732d[_0xf70f('0x39')]=_0x49732d[_0xf70f('0x39')][_0xf70f('0x3b')]?_0x49732d[_0xf70f('0x39')]:_0x5b5e3c[_0xf70f('0x35')];if(!_0x20e8fd[_0xf70f('0x37')][_0xf70f('0x3c')](_0xf70f('0x3d'))){_0x49732d['limit']=qs['limit'](_0x20e8fd[_0xf70f('0x37')]['limit']);_0x49732d[_0xf70f('0x24')]=qs[_0xf70f('0x24')](_0x20e8fd['query'][_0xf70f('0x24')]);}_0x49732d['order']=qs[_0xf70f('0x3e')](_0x20e8fd['query']['sort']);_0x49732d['where']=qs[_0xf70f('0x3f')](_[_0xf70f('0x40')](_0x20e8fd[_0xf70f('0x37')],_0x5b5e3c[_0xf70f('0x3f')]),_0x447b45);if(_0x20e8fd[_0xf70f('0x37')][_0xf70f('0x41')]){_0x49732d[_0xf70f('0x42')]=_['merge'](_0x49732d[_0xf70f('0x42')],{'$or':_[_0xf70f('0x36')](_0x447b45,function(_0x16f3bc){if(_0x16f3bc[_0xf70f('0x33')]!==_0xf70f('0x43')){var _0x330a54={};_0x330a54[_0x16f3bc['name']]={'$like':'%'+_0x20e8fd[_0xf70f('0x37')][_0xf70f('0x41')]+'%'};return _0x330a54;}})});}_0x49732d=_['merge']({},_0x49732d,_0x20e8fd['options']);var _0x36f549={'where':_0x49732d['where']};return db['ChatInternalMessage'][_0xf70f('0x26')](_0x36f549)[_0xf70f('0x2a')](function(_0x37ec2c){_0x424925['count']=_0x37ec2c;if(_0x20e8fd[_0xf70f('0x37')][_0xf70f('0x44')]){_0x49732d[_0xf70f('0x45')]=[{'all':!![]}];}return db[_0xf70f('0x31')][_0xf70f('0x46')](_0x49732d);})[_0xf70f('0x2a')](function(_0xbff51e){_0x424925[_0xf70f('0x47')]=_0xbff51e;return _0x424925;})['then'](respondWithFilteredResult(_0xb7eaa2,_0x49732d))['catch'](handleError(_0xb7eaa2,null));};exports[_0xf70f('0x48')]=function(_0x1cb4ce,_0x4088d9){var _0x73c4f6={'raw':!![],'where':{'id':_0x1cb4ce[_0xf70f('0x49')]['id']}},_0x597210={};_0x597210['model']=_[_0xf70f('0x4a')](db[_0xf70f('0x31')][_0xf70f('0x4b')]);_0x597210[_0xf70f('0x37')]=_[_0xf70f('0x4a')](_0x1cb4ce['query']);_0x597210[_0xf70f('0x3f')]=_[_0xf70f('0x38')](_0x597210[_0xf70f('0x35')],_0x597210['query']);_0x73c4f6[_0xf70f('0x39')]=_['intersection'](_0x597210[_0xf70f('0x35')],qs[_0xf70f('0x3a')](_0x1cb4ce[_0xf70f('0x37')][_0xf70f('0x3a')]));_0x73c4f6[_0xf70f('0x39')]=_0x73c4f6[_0xf70f('0x39')][_0xf70f('0x3b')]?_0x73c4f6[_0xf70f('0x39')]:_0x597210[_0xf70f('0x35')];if(_0x1cb4ce['query'][_0xf70f('0x44')]){_0x73c4f6[_0xf70f('0x45')]=[{'all':!![]}];}_0x73c4f6=_[_0xf70f('0x4c')]({},_0x73c4f6,_0x1cb4ce['options']);return db[_0xf70f('0x31')][_0xf70f('0x4d')](_0x73c4f6)[_0xf70f('0x2a')](handleEntityNotFound(_0x4088d9,null))[_0xf70f('0x2a')](respondWithResult(_0x4088d9,null))[_0xf70f('0x4e')](handleError(_0x4088d9,null));};exports[_0xf70f('0x4f')]=function(_0x3e5fce,_0x1873eb){return db[_0xf70f('0x31')][_0xf70f('0x4f')](_0x3e5fce[_0xf70f('0x50')],{})[_0xf70f('0x2a')](respondWithResult(_0x1873eb,0xc9))[_0xf70f('0x4e')](handleError(_0x1873eb,null));};exports[_0xf70f('0x29')]=function(_0x36e5bd,_0xe02d6b){if(_0x36e5bd[_0xf70f('0x50')]['id']){delete _0x36e5bd[_0xf70f('0x50')]['id'];}return db[_0xf70f('0x31')][_0xf70f('0x4d')]({'where':{'id':_0x36e5bd[_0xf70f('0x49')]['id']}})['then'](handleEntityNotFound(_0xe02d6b,null))['then'](saveUpdates(_0x36e5bd[_0xf70f('0x50')],null))[_0xf70f('0x2a')](respondWithResult(_0xe02d6b,null))[_0xf70f('0x4e')](handleError(_0xe02d6b,null));};exports['destroy']=function(_0xa792fe,_0x497144){return db[_0xf70f('0x31')][_0xf70f('0x4d')]({'where':{'id':_0xa792fe[_0xf70f('0x49')]['id']}})[_0xf70f('0x2a')](handleEntityNotFound(_0x497144,null))[_0xf70f('0x2a')](removeEntity(_0x497144,null))[_0xf70f('0x4e')](handleError(_0x497144,null));};exports['describe']=function(_0x2f8f2e,_0x4cc7c7){return db[_0xf70f('0x31')][_0xf70f('0x51')]()[_0xf70f('0x2a')](respondWithResult(_0x4cc7c7,null))[_0xf70f('0x4e')](handleError(_0x4cc7c7,null));};function wrapUser(_0x530998){return function(_0x58cdc5){var _0x4d167e=_0x530998[_0xf70f('0x52')]({'plain':!![]});_0x4d167e['messages']=[];if(_0x58cdc5){_0x4d167e[_0xf70f('0x53')]=_0x58cdc5[_0xf70f('0x54')];_0x4d167e[_0xf70f('0x55')]=_0x58cdc5;}else{_0x4d167e['lastMessageAt']=moment(0x0)['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4d167e[_0xf70f('0x55')]={};}return _0x4d167e;};}exports[_0xf70f('0x56')]=function(_0x4fc3d,_0x7e5976,_0x5bdac3){var _0x11cd5f=[];return db[_0xf70f('0x57')][_0xf70f('0x46')]({'where':{'role':[_0xf70f('0x58'),_0xf70f('0x59'),'user']},'attributes':['id',_0xf70f('0x5a'),_0xf70f('0x2e'),'role','userpic',_0xf70f('0x5b'),_0xf70f('0x5c'),_0xf70f('0x5d'),_0xf70f('0x5e'),_0xf70f('0x5f')],'order':qs['sort']('-online'),'include':[{'model':db[_0xf70f('0x60')],'as':_0xf70f('0x61'),'attributes':['id','name','type'],'through':{'attributes':[]}}]})[_0xf70f('0x2a')](function(_0x3a582b){if(_0x3a582b){var _0x4f02ba=_0x4fc3d[_0xf70f('0x62')]['get']({'plain':!![]});if(!_0x4f02ba)throw new Error(_0xf70f('0x63'));if(_0x4f02ba[_0xf70f('0x64')]===_0xf70f('0x62')){return db[_0xf70f('0x65')]['find']({'where':{'name':'Agents','userProfileId':_0x4f02ba['userProfileId']},'raw':!![]})[_0xf70f('0x2a')](function(_0x316e5c){if(_0x316e5c){if(_0x316e5c[_0xf70f('0x66')]===0x0){return db['UserProfileResource'][_0xf70f('0x46')]({'where':{'sectionId':_0x316e5c['id']},'raw':!![]})[_0xf70f('0x2a')](function(_0x4bd7a7){var _0x279d93=[];if(_['isEmpty'](_0x4bd7a7)){_0x279d93=_['filter'](_0x3a582b,function(_0x19559a){if(_0x19559a[_0xf70f('0x64')]!==_0xf70f('0x58')){return _0x19559a;}});return _0x279d93;}else{for(var _0x2a6729=0x0;_0x2a6729<_0x3a582b[_0xf70f('0x3b')];_0x2a6729++){var _0x5c2683=_0x3a582b[_0x2a6729];if(_0x5c2683[_0xf70f('0x64')]===_0xf70f('0x58')){var _0x4ab6af=_[_0xf70f('0x4d')](_0x4bd7a7,function(_0x55ef53){return _0x55ef53[_0xf70f('0x67')]===_0x5c2683['id'];});if(_0x4ab6af)_0x279d93['push'](_0x5c2683);}else{_0x279d93[_0xf70f('0x68')](_0x5c2683);}}return _0x279d93;}});}else{return _0x3a582b;}}else{var _0x1b23cb=_['filter'](_0x3a582b,function(_0x27aa59){if(_0x27aa59[_0xf70f('0x64')]!==_0xf70f('0x58')){return _0x27aa59;}});return _0x1b23cb;}});}else{return _0x3a582b;}}})[_0xf70f('0x2a')](function(_0x40e4bf){var _0xea8cc1=[];if(_0x40e4bf){_0x11cd5f=_0x40e4bf;for(var _0x4af2b0=0x0;_0x4af2b0<_0x40e4bf[_0xf70f('0x3b')];_0x4af2b0+=0x1){_0x11cd5f[_0x4af2b0][_0xf70f('0x69')]=[];_0xea8cc1[_0xf70f('0x68')](db[_0xf70f('0x31')][_0xf70f('0x4d')]({'where':{'FromId':[_0x4fc3d[_0xf70f('0x62')]['id'],_0x40e4bf[_0x4af2b0]['id']],'ToId':[_0x4fc3d['user']['id'],_0x40e4bf[_0x4af2b0]['id']],'ChatGroupId':null},'attributes':['id',_0xf70f('0x54'),'FromId',_0xf70f('0x6a'),_0xf70f('0x6b'),_0xf70f('0x50')],'order':qs['sort'](_0xf70f('0x6c')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xf70f('0x2a')](wrapUser(_0x40e4bf[_0x4af2b0])));}return BPromise['all'](_0xea8cc1);}return[];})[_0xf70f('0x2a')](function(_0x523d0d){return{'rows':_0x523d0d,'count':_0x523d0d[_0xf70f('0x3b')]};})[_0xf70f('0x2a')](respondWithResult(_0x7e5976,null))[_0xf70f('0x4e')](handleError(_0x7e5976,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index fffad87..bb2c476 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 _0x8c8f=['exports','events','ChatInternalMessage','hasOwnProperty','hook'];(function(_0x4733d3,_0x454290){var _0x1b9a44=function(_0x1a93bb){while(--_0x1a93bb){_0x4733d3['push'](_0x4733d3['shift']());}};_0x1b9a44(++_0x454290);}(_0x8c8f,0x1e6));var _0xf8c8=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x8c8f[_0x2dadb9];return _0x2f0097;};'use strict';var EventEmitter=require(_0xf8c8('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0xf8c8('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4ad7e8){return function(_0x5f25fe,_0x22f13f,_0x5f1880){ChatInternalMessageEvents['emit'](_0x4ad7e8+':'+_0x5f25fe['id'],_0x5f25fe);ChatInternalMessageEvents['emit'](_0x4ad7e8,_0x5f25fe);_0x5f1880(null);};}for(var e in events){if(events[_0xf8c8('0x2')](e)){var event=events[e];ChatInternalMessage[_0xf8c8('0x3')](e,emitEvent(event));}}module[_0xf8c8('0x4')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x6043=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','update'];(function(_0x19006e,_0x554f02){var _0x2d8060=function(_0x30447d){while(--_0x30447d){_0x19006e['push'](_0x19006e['shift']());}};_0x2d8060(++_0x554f02);}(_0x6043,0x185));var _0x3604=function(_0x73f87f,_0x2eb5c5){_0x73f87f=_0x73f87f-0x0;var _0x11899b=_0x6043[_0x73f87f];return _0x11899b;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x3604('0x0'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x3604('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3604('0x2'),'afterDestroy':_0x3604('0x3')};function emitEvent(_0x5364a8){return function(_0x506e20,_0x6735da,_0x46d3b3){ChatInternalMessageEvents[_0x3604('0x4')](_0x5364a8+':'+_0x506e20['id'],_0x506e20);ChatInternalMessageEvents[_0x3604('0x4')](_0x5364a8,_0x506e20);_0x46d3b3(null);};}for(var e in events){if(events[_0x3604('0x5')](e)){var event=events[e];ChatInternalMessage[_0x3604('0x6')](e,emitEvent(event));}}module[_0x3604('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 c5cccd5..53eab5f 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 _0xf706=['utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','bluebird','request-promise','../../config/environment','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf706,0xca));var _0x6f70=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xf706[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6f70('0x0'))(_0x6f70('0x1'));var moment=require('moment');var BPromise=require(_0x6f70('0x2'));var rp=require(_0x6f70('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6f70('0x4'));var attributes=require('./chatInternalMessage.attributes');module['exports']=function(_0x19e863,_0x51a409){return _0x19e863[_0x6f70('0x5')]('ChatInternalMessage',attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6f70('0x6'),'collate':_0x6f70('0x7')});}; \ No newline at end of file +var _0x719f=['chat_internal_messages','utf8mb4','lodash','util','../../config/logger','api','bluebird','path','./chatInternalMessage.attributes','exports','define'];(function(_0x14081a,_0x36ee7c){var _0x1313cf=function(_0x2fae2e){while(--_0x2fae2e){_0x14081a['push'](_0x14081a['shift']());}};_0x1313cf(++_0x36ee7c);}(_0x719f,0x70));var _0xf719=function(_0x512c83,_0x42a67a){_0x512c83=_0x512c83-0x0;var _0x1f7f25=_0x719f[_0x512c83];return _0x1f7f25;};'use strict';var _=require(_0xf719('0x0'));var util=require(_0xf719('0x1'));var logger=require(_0xf719('0x2'))(_0xf719('0x3'));var moment=require('moment');var BPromise=require(_0xf719('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf719('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf719('0x6'));module[_0xf719('0x7')]=function(_0x4df7ac,_0x5e3ad0){return _0x4df7ac[_0xf719('0x8')]('ChatInternalMessage',attributes,{'tableName':_0xf719('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf719('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 1b4eb3e..a2a626d 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 _0x181d=['../../config/utils','rpc','../../config/environment','http','defaults','redis','localhost','./chatInternalMessage.socket','register','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','moment','randomstring','ioredis','../../mysqldb'];(function(_0xc1743c,_0x154fe5){var _0x3143ff=function(_0x4b9899){while(--_0x4b9899){_0xc1743c['push'](_0xc1743c['shift']());}};_0x3143ff(++_0x154fe5);}(_0x181d,0x10f));var _0xd181=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x181d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd181('0x0'));var BPromise=require('bluebird');var rs=require(_0xd181('0x1'));var fs=require('fs');var Redis=require(_0xd181('0x2'));var db=require(_0xd181('0x3'))['db'];var utils=require(_0xd181('0x4'));var logger=require('../../config/logger')(_0xd181('0x5'));var config=require(_0xd181('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd181('0x7')]({'port':0x232a});config['redis']=_[_0xd181('0x8')](config[_0xd181('0x9')],{'host':_0xd181('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd181('0x9')]));require(_0xd181('0xb'))[_0xd181('0xc')](socket);function respondWithRpcPromise(_0x74ef22,_0x103eee,_0x589470){return new BPromise(function(_0x51d3ce,_0x549dd2){return client['request'](_0x74ef22,_0x589470)[_0xd181('0xd')](function(_0x4cb3f6){logger['info'](_0xd181('0xe'),_0x103eee,_0xd181('0xf'));logger[_0xd181('0x10')](_0xd181('0x11'),_0x103eee,_0xd181('0xf'),JSON[_0xd181('0x12')](_0x4cb3f6));if(_0x4cb3f6[_0xd181('0x13')]){if(_0x4cb3f6[_0xd181('0x13')][_0xd181('0x14')]===0x1f4){logger[_0xd181('0x13')](_0xd181('0xe'),_0x103eee,_0x4cb3f6[_0xd181('0x13')][_0xd181('0x15')]);return _0x549dd2(_0x4cb3f6[_0xd181('0x13')][_0xd181('0x15')]);}logger[_0xd181('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x103eee,_0x4cb3f6[_0xd181('0x13')][_0xd181('0x15')]);return _0x51d3ce(_0x4cb3f6[_0xd181('0x13')]['message']);}else{logger[_0xd181('0x16')](_0xd181('0xe'),_0x103eee,_0xd181('0xf'));_0x51d3ce(_0x4cb3f6[_0xd181('0x17')][_0xd181('0x15')]);}})[_0xd181('0x18')](function(_0x483615){logger[_0xd181('0x13')](_0xd181('0xe'),_0x103eee,_0x483615);_0x549dd2(_0x483615);});});} \ No newline at end of file +var _0xeb6a=['ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x482c19,_0x456e39){var _0x57dc03=function(_0x23ebed){while(--_0x23ebed){_0x482c19['push'](_0x482c19['shift']());}};_0x57dc03(++_0x456e39);}(_0xeb6a,0x1f4));var _0xaeb6=function(_0x52decf,_0x1bd6bc){_0x52decf=_0x52decf-0x0;var _0x43e3cd=_0xeb6a[_0x52decf];return _0x43e3cd;};'use strict';var _=require(_0xaeb6('0x0'));var util=require(_0xaeb6('0x1'));var moment=require(_0xaeb6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaeb6('0x3'));var db=require(_0xaeb6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xaeb6('0x5'))(_0xaeb6('0x6'));var config=require('../../config/environment');var jayson=require(_0xaeb6('0x7'));var client=jayson[_0xaeb6('0x8')][_0xaeb6('0x9')]({'port':0x232a});config[_0xaeb6('0xa')]=_[_0xaeb6('0xb')](config[_0xaeb6('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xaeb6('0xc'))(new Redis(config['redis']));require(_0xaeb6('0xd'))['register'](socket);function respondWithRpcPromise(_0x315ec7,_0x49f280,_0x5d996d){return new BPromise(function(_0x150386,_0x3048bf){return client[_0xaeb6('0xe')](_0x315ec7,_0x5d996d)[_0xaeb6('0xf')](function(_0x5efe69){logger[_0xaeb6('0x10')](_0xaeb6('0x11'),_0x49f280,_0xaeb6('0x12'));logger[_0xaeb6('0x13')](_0xaeb6('0x14'),_0x49f280,'request\x20sent',JSON[_0xaeb6('0x15')](_0x5efe69));if(_0x5efe69['error']){if(_0x5efe69['error'][_0xaeb6('0x16')]===0x1f4){logger[_0xaeb6('0x17')](_0xaeb6('0x11'),_0x49f280,_0x5efe69[_0xaeb6('0x17')]['message']);return _0x3048bf(_0x5efe69[_0xaeb6('0x17')]['message']);}logger[_0xaeb6('0x17')](_0xaeb6('0x11'),_0x49f280,_0x5efe69['error'][_0xaeb6('0x18')]);return _0x150386(_0x5efe69[_0xaeb6('0x17')]['message']);}else{logger[_0xaeb6('0x10')](_0xaeb6('0x11'),_0x49f280,_0xaeb6('0x12'));_0x150386(_0x5efe69['result'][_0xaeb6('0x18')]);}})[_0xaeb6('0x19')](function(_0x199017){logger[_0xaeb6('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x49f280,_0x199017);_0x3048bf(_0x199017);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 51f2619..288c956 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 _0x125d=['length','save','remove','emit','register'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x125d,0x182));var _0xd125=function(_0x2b9978,_0x4c5bc5){_0x2b9978=_0x2b9978-0x0;var _0x5dd096=_0x125d[_0x2b9978];return _0x5dd096;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0xd125('0x0'),_0xd125('0x1'),'update'];function createListener(_0x10d34e,_0x5af449){return function(_0x1c546b){_0x5af449[_0xd125('0x2')](_0x10d34e,_0x1c546b);};}function removeListener(_0x5b9c86,_0x266995){return function(){ChatInternalMessageEvents['removeListener'](_0x5b9c86,_0x266995);};}exports[_0xd125('0x3')]=function(_0x3f65ef){for(var _0x4449d2=0x0,_0x566ca6=events[_0xd125('0x4')];_0x4449d2<_0x566ca6;_0x4449d2++){var _0x278cfa=events[_0x4449d2];var _0x216a4d=createListener('chatInternalMessage:'+_0x278cfa,_0x3f65ef);ChatInternalMessageEvents['on'](_0x278cfa,_0x216a4d);}}; \ No newline at end of file +var _0x9a5b=['removeListener','chatInternalMessage:','./chatInternalMessage.events','save','remove','update'];(function(_0x4f51ca,_0x568e79){var _0x1c0d86=function(_0x5648ae){while(--_0x5648ae){_0x4f51ca['push'](_0x4f51ca['shift']());}};_0x1c0d86(++_0x568e79);}(_0x9a5b,0x1d0));var _0xb9a5=function(_0xdd5006,_0x178b90){_0xdd5006=_0xdd5006-0x0;var _0x3aecea=_0x9a5b[_0xdd5006];return _0x3aecea;};'use strict';var ChatInternalMessageEvents=require(_0xb9a5('0x0'));var events=[_0xb9a5('0x1'),_0xb9a5('0x2'),_0xb9a5('0x3')];function createListener(_0x3206f1,_0xdd6be){return function(_0x2790f6){_0xdd6be['emit'](_0x3206f1,_0x2790f6);};}function removeListener(_0x293e22,_0x562561){return function(){ChatInternalMessageEvents[_0xb9a5('0x4')](_0x293e22,_0x562561);};}exports['register']=function(_0x3af0e1){for(var _0x3a541e=0x0,_0x3e7508=events['length'];_0x3a541e<_0x3e7508;_0x3a541e++){var _0x1c2435=events[_0x3a541e];var _0x6143ea=createListener(_0xb9a5('0x5')+_0x1c2435,_0x3af0e1);ChatInternalMessageEvents['on'](_0x1c2435,_0x6143ea);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 59c163b..4d27862 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 _0x8406=['isAuthenticated','/describe','describe','/users','getUsers','/:id','show','create','update','delete','destroy','exports','util','path','express','../../components/auth/service','../../components/interaction/service','./chatInternalMessage.controller','get'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8406,0x162));var _0x6840=function(_0x4a55c4,_0x15a91d){_0x4a55c4=_0x4a55c4-0x0;var _0x175338=_0x8406[_0x4a55c4];return _0x175338;};'use strict';var multer=require('multer');var util=require(_0x6840('0x0'));var path=require(_0x6840('0x1'));var timeout=require('connect-timeout');var express=require(_0x6840('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6840('0x3'));var interaction=require(_0x6840('0x4'));var config=require('../../config/environment');var controller=require(_0x6840('0x5'));router[_0x6840('0x6')]('/',auth[_0x6840('0x7')](),controller['index']);router[_0x6840('0x6')](_0x6840('0x8'),auth[_0x6840('0x7')](),controller[_0x6840('0x9')]);router[_0x6840('0x6')](_0x6840('0xa'),auth[_0x6840('0x7')](),controller[_0x6840('0xb')]);router[_0x6840('0x6')](_0x6840('0xc'),auth[_0x6840('0x7')](),controller[_0x6840('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6840('0xe')]);router['put'](_0x6840('0xc'),controller[_0x6840('0xf')]);router[_0x6840('0x10')]('/:id',auth[_0x6840('0x7')](),controller[_0x6840('0x11')]);module[_0x6840('0x12')]=router; \ No newline at end of file +var _0xe2a6=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/users','getUsers','post','put','/:id','update','delete','destroy','exports','util'];(function(_0x1ed0e1,_0x45098f){var _0x12b97f=function(_0x1e06dd){while(--_0x1e06dd){_0x1ed0e1['push'](_0x1ed0e1['shift']());}};_0x12b97f(++_0x45098f);}(_0xe2a6,0x8b));var _0x6e2a=function(_0x2c0dc0,_0x19900d){_0x2c0dc0=_0x2c0dc0-0x0;var _0x4c0990=_0xe2a6[_0x2c0dc0];return _0x4c0990;};'use strict';var multer=require('multer');var util=require(_0x6e2a('0x0'));var path=require(_0x6e2a('0x1'));var timeout=require('connect-timeout');var express=require(_0x6e2a('0x2'));var router=express[_0x6e2a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6e2a('0x4'));var interaction=require(_0x6e2a('0x5'));var config=require(_0x6e2a('0x6'));var controller=require('./chatInternalMessage.controller');router[_0x6e2a('0x7')]('/',auth[_0x6e2a('0x8')](),controller[_0x6e2a('0x9')]);router[_0x6e2a('0x7')]('/describe',auth[_0x6e2a('0x8')](),controller[_0x6e2a('0xa')]);router[_0x6e2a('0x7')](_0x6e2a('0xb'),auth['isAuthenticated'](),controller[_0x6e2a('0xc')]);router[_0x6e2a('0x7')]('/:id',auth[_0x6e2a('0x8')](),controller['show']);router[_0x6e2a('0xd')]('/',auth[_0x6e2a('0x8')](),controller['create']);router[_0x6e2a('0xe')](_0x6e2a('0xf'),controller[_0x6e2a('0x10')]);router[_0x6e2a('0x11')](_0x6e2a('0xf'),auth[_0x6e2a('0x8')](),controller[_0x6e2a('0x12')]);module[_0x6e2a('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 727e99c..cac2585 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 _0x720e=['BOOLEAN','out','DATE','STRING','sequelize','exports','TEXT'];(function(_0x3a2797,_0x1f905c){var _0x5c2d96=function(_0x3c7bd7){while(--_0x3c7bd7){_0x3a2797['push'](_0x3a2797['shift']());}};_0x5c2d96(++_0x1f905c);}(_0x720e,0x1cb));var _0xe720=function(_0x5c18ef,_0xa2e81d){_0x5c18ef=_0x5c18ef-0x0;var _0x33789d=_0x720e[_0x5c18ef];return _0x33789d;};'use strict';var Sequelize=require(_0xe720('0x0'));module[_0xe720('0x1')]={'body':{'type':Sequelize[_0xe720('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xe720('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xe720('0x4')),'defaultValue':_0xe720('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xe720('0x5')]},'providerName':{'type':Sequelize[_0xe720('0x6')]},'providerResponse':{'type':Sequelize[_0xe720('0x2')]}}; \ No newline at end of file +var _0x97e7=['STRING','sequelize','exports','TEXT','BOOLEAN','ENUM','out','DATE'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x97e7,0x1a1));var _0x797e=function(_0x389342,_0x6658bc){_0x389342=_0x389342-0x0;var _0x5b33e5=_0x97e7[_0x389342];return _0x5b33e5;};'use strict';var Sequelize=require(_0x797e('0x0'));module[_0x797e('0x1')]={'body':{'type':Sequelize[_0x797e('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x797e('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x797e('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x797e('0x4')]('in',_0x797e('0x5')),'defaultValue':_0x797e('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x797e('0x6')]},'providerName':{'type':Sequelize[_0x797e('0x7')]},'providerResponse':{'type':Sequelize[_0x797e('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 8f47a02..e68de63 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 _0xa2e0=['reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','options','ChatMessage','includeAll','include','findAll','rows','show','params','find','create','body','describe','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','ChatInteraction','ChatInteractionId','isNil','interaction','info','[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','Sequelize','SELECT','User','agent','fullname','email','internal','manual','interface','motionChannel','event','EventManager','acceptmessage','parse','formData','RejectMessage','contact','SIP/%s','channel','rejectmessage','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','register','jayson/promise','client','http','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json'];(function(_0x3aa8b2,_0x5a11e3){var _0x6f394e=function(_0x254bb8){while(--_0x254bb8){_0x3aa8b2['push'](_0x3aa8b2['shift']());}};_0x6f394e(++_0x5a11e3);}(_0xa2e0,0x1e4));var _0x0a2e=function(_0x339798,_0x14d3b7){_0x339798=_0x339798-0x0;var _0x574b4e=_0xa2e0[_0x339798];return _0x574b4e;};'use strict';var emlformat=require(_0x0a2e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0a2e('0x1'));var jsonpatch=require(_0x0a2e('0x2'));var rp=require(_0x0a2e('0x3'));var moment=require(_0x0a2e('0x4'));var BPromise=require(_0x0a2e('0x5'));var Mustache=require(_0x0a2e('0x6'));var util=require(_0x0a2e('0x7'));var path=require('path');var sox=require(_0x0a2e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a2e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0a2e('0xa'));var crypto=require(_0x0a2e('0xb'));var jsforce=require(_0x0a2e('0xc'));var deskjs=require(_0x0a2e('0xd'));var toCsv=require(_0x0a2e('0xe'));var querystring=require(_0x0a2e('0xf'));var Papa=require(_0x0a2e('0x10'));var Redis=require(_0x0a2e('0x11'));var authService=require(_0x0a2e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0a2e('0x13'));var hardwareService=require(_0x0a2e('0x14'));var logger=require(_0x0a2e('0x15'))(_0x0a2e('0x16'));var utils=require(_0x0a2e('0x17'));var config=require(_0x0a2e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0a2e('0x19'))['db'];config[_0x0a2e('0x1a')]=_['defaults'](config[_0x0a2e('0x1a')],{'host':_0x0a2e('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a2e('0x1a')]));require('./chatMessage.socket')[_0x0a2e('0x1c')](socket);var jayson=require(_0x0a2e('0x1d'));var client=jayson[_0x0a2e('0x1e')][_0x0a2e('0x1f')]({'port':0x232c});var client9002=jayson[_0x0a2e('0x1e')][_0x0a2e('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x2b1ed8,_0x4b6087,_0x537b12,_0x473326){return new BPromise(function(_0x119858,_0x514a13){var _0x3a262c=_0x473326||client;return _0x3a262c[_0x0a2e('0x20')](_0x2b1ed8,_0x537b12)[_0x0a2e('0x21')](function(_0xf58d){logger['info'](_0x0a2e('0x22'),_0x4b6087,_0x0a2e('0x23'));logger[_0x0a2e('0x24')](_0x0a2e('0x25'),_0x4b6087,_0x0a2e('0x23'),JSON[_0x0a2e('0x26')](_0xf58d));if(_0xf58d['error']){if(_0xf58d[_0x0a2e('0x27')]['code']===0x1f4){logger['error'](_0x0a2e('0x22'),_0x4b6087,_0xf58d[_0x0a2e('0x27')][_0x0a2e('0x28')]);return _0x514a13(_0xf58d[_0x0a2e('0x27')][_0x0a2e('0x28')]);}logger[_0x0a2e('0x27')](_0x0a2e('0x22'),_0x4b6087,_0xf58d[_0x0a2e('0x27')][_0x0a2e('0x28')]);return _0x119858(_0xf58d[_0x0a2e('0x27')][_0x0a2e('0x28')]);}else{logger['info'](_0x0a2e('0x22'),_0x4b6087,_0x0a2e('0x23'));_0x119858(_0xf58d[_0x0a2e('0x29')]['message']);}})[_0x0a2e('0x2a')](function(_0x11e0fa){logger[_0x0a2e('0x27')]('ChatMessage,\x20%s,\x20%s',_0x4b6087,_0x11e0fa);_0x514a13(_0x11e0fa);});});}function respondWithStatusCode(_0x643c05,_0x290d67){_0x290d67=_0x290d67||0xcc;return function(_0x23107c){if(_0x23107c){return _0x643c05[_0x0a2e('0x2b')](_0x290d67);}return _0x643c05[_0x0a2e('0x2c')](_0x290d67)[_0x0a2e('0x2d')]();};}function respondWithResult(_0xde2054,_0x55c766){_0x55c766=_0x55c766||0xc8;return function(_0x23732a){if(_0x23732a){return _0xde2054[_0x0a2e('0x2c')](_0x55c766)['json'](_0x23732a);}};}function respondWithFilteredResult(_0x5e3162,_0x146961){return function(_0x58e5b2){if(_0x58e5b2){var _0x5f3854=typeof _0x146961[_0x0a2e('0x2e')]==='undefined'&&typeof _0x146961[_0x0a2e('0x2f')]===_0x0a2e('0x30');var _0x2ecb7b=_0x58e5b2[_0x0a2e('0x31')];var _0x1fb83f=_0x5f3854?0x0:_0x146961[_0x0a2e('0x2e')];var _0x5b0b40=_0x5f3854?_0x58e5b2[_0x0a2e('0x31')]:_0x146961['offset']+_0x146961[_0x0a2e('0x2f')];var _0xf0d024;if(_0x5b0b40>=_0x2ecb7b){_0x5b0b40=_0x2ecb7b;_0xf0d024=0xc8;}else{_0xf0d024=0xce;}_0x5e3162['status'](_0xf0d024);return _0x5e3162['set'](_0x0a2e('0x32'),_0x1fb83f+'-'+_0x5b0b40+'/'+_0x2ecb7b)[_0x0a2e('0x33')](_0x58e5b2);}return null;};}function patchUpdates(_0x4eac0a){return function(_0x549810){try{jsonpatch['apply'](_0x549810,_0x4eac0a,!![]);}catch(_0x3212fe){return BPromise[_0x0a2e('0x34')](_0x3212fe);}return _0x549810[_0x0a2e('0x35')]();};}function saveUpdates(_0x576a19,_0x5ae69e){return function(_0x5d677a){if(_0x5d677a){return _0x5d677a[_0x0a2e('0x36')](_0x576a19)[_0x0a2e('0x21')](function(_0x156d1f){return _0x156d1f;});}return null;};}function removeEntity(_0x57b30b,_0x3def0a){return function(_0x4a5f40){if(_0x4a5f40){return _0x4a5f40[_0x0a2e('0x37')]()['then'](function(){_0x57b30b[_0x0a2e('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc97779,_0x577bf2){return function(_0x4929f4){if(!_0x4929f4){_0xc97779['sendStatus'](0x194);}return _0x4929f4;};}function handleError(_0x9294d8,_0x10c4f6){_0x10c4f6=_0x10c4f6||0x1f4;return function(_0x221b7f){logger[_0x0a2e('0x27')](_0x221b7f[_0x0a2e('0x38')]);if(_0x221b7f[_0x0a2e('0x39')]){delete _0x221b7f['name'];}_0x9294d8['status'](_0x10c4f6)[_0x0a2e('0x3a')](_0x221b7f);};}exports[_0x0a2e('0x3b')]=function(_0x5344b9,_0x2d121f){var _0x2c73a2={},_0x33118e={},_0x53953f={'count':0x0,'rows':[]};var _0x32454=_[_0x0a2e('0x3c')](db['ChatMessage'][_0x0a2e('0x3d')],function(_0x35b009){return{'name':_0x35b009[_0x0a2e('0x3e')],'type':_0x35b009[_0x0a2e('0x3f')]['key']};});_0x33118e[_0x0a2e('0x40')]=_[_0x0a2e('0x3c')](_0x32454,_0x0a2e('0x39'));_0x33118e[_0x0a2e('0x41')]=_[_0x0a2e('0x42')](_0x5344b9['query']);_0x33118e[_0x0a2e('0x43')]=_['intersection'](_0x33118e[_0x0a2e('0x40')],_0x33118e[_0x0a2e('0x41')]);_0x2c73a2[_0x0a2e('0x44')]=_[_0x0a2e('0x45')](_0x33118e[_0x0a2e('0x40')],qs[_0x0a2e('0x46')](_0x5344b9[_0x0a2e('0x41')][_0x0a2e('0x46')]));_0x2c73a2[_0x0a2e('0x44')]=_0x2c73a2[_0x0a2e('0x44')][_0x0a2e('0x47')]?_0x2c73a2[_0x0a2e('0x44')]:_0x33118e['model'];if(!_0x5344b9[_0x0a2e('0x41')]['hasOwnProperty'](_0x0a2e('0x48'))){_0x2c73a2[_0x0a2e('0x2f')]=qs[_0x0a2e('0x2f')](_0x5344b9['query'][_0x0a2e('0x2f')]);_0x2c73a2[_0x0a2e('0x2e')]=qs['offset'](_0x5344b9[_0x0a2e('0x41')][_0x0a2e('0x2e')]);}_0x2c73a2[_0x0a2e('0x49')]=qs[_0x0a2e('0x4a')](_0x5344b9['query']['sort']);_0x2c73a2[_0x0a2e('0x4b')]=qs[_0x0a2e('0x43')](_[_0x0a2e('0x4c')](_0x5344b9[_0x0a2e('0x41')],_0x33118e[_0x0a2e('0x43')]),_0x32454);if(_0x5344b9['query'][_0x0a2e('0x4d')]){_0x2c73a2[_0x0a2e('0x4b')]=_['merge'](_0x2c73a2[_0x0a2e('0x4b')],{'$or':_[_0x0a2e('0x3c')](_0x32454,function(_0x220680){if(_0x220680[_0x0a2e('0x3f')]!=='VIRTUAL'){var _0x2ff098={};_0x2ff098[_0x220680[_0x0a2e('0x39')]]={'$like':'%'+_0x5344b9['query'][_0x0a2e('0x4d')]+'%'};return _0x2ff098;}})});}_0x2c73a2=_[_0x0a2e('0x4e')]({},_0x2c73a2,_0x5344b9[_0x0a2e('0x4f')]);var _0x5843f3={'where':_0x2c73a2['where']};return db[_0x0a2e('0x50')][_0x0a2e('0x31')](_0x5843f3)['then'](function(_0x45e8c7){_0x53953f[_0x0a2e('0x31')]=_0x45e8c7;if(_0x5344b9[_0x0a2e('0x41')][_0x0a2e('0x51')]){_0x2c73a2[_0x0a2e('0x52')]=[{'all':!![]}];}return db[_0x0a2e('0x50')][_0x0a2e('0x53')](_0x2c73a2);})[_0x0a2e('0x21')](function(_0x3841e5){_0x53953f[_0x0a2e('0x54')]=_0x3841e5;return _0x53953f;})[_0x0a2e('0x21')](respondWithFilteredResult(_0x2d121f,_0x2c73a2))[_0x0a2e('0x2a')](handleError(_0x2d121f,null));};exports[_0x0a2e('0x55')]=function(_0x257203,_0x466834){var _0x1a246c={'raw':!![],'where':{'id':_0x257203[_0x0a2e('0x56')]['id']}},_0x4117bb={};_0x4117bb[_0x0a2e('0x40')]=_['keys'](db[_0x0a2e('0x50')]['rawAttributes']);_0x4117bb[_0x0a2e('0x41')]=_[_0x0a2e('0x42')](_0x257203[_0x0a2e('0x41')]);_0x4117bb[_0x0a2e('0x43')]=_['intersection'](_0x4117bb[_0x0a2e('0x40')],_0x4117bb[_0x0a2e('0x41')]);_0x1a246c[_0x0a2e('0x44')]=_[_0x0a2e('0x45')](_0x4117bb[_0x0a2e('0x40')],qs[_0x0a2e('0x46')](_0x257203[_0x0a2e('0x41')]['fields']));_0x1a246c[_0x0a2e('0x44')]=_0x1a246c[_0x0a2e('0x44')][_0x0a2e('0x47')]?_0x1a246c[_0x0a2e('0x44')]:_0x4117bb[_0x0a2e('0x40')];if(_0x257203[_0x0a2e('0x41')][_0x0a2e('0x51')]){_0x1a246c[_0x0a2e('0x52')]=[{'all':!![]}];}_0x1a246c=_[_0x0a2e('0x4e')]({},_0x1a246c,_0x257203['options']);return db[_0x0a2e('0x50')][_0x0a2e('0x57')](_0x1a246c)[_0x0a2e('0x21')](handleEntityNotFound(_0x466834,null))[_0x0a2e('0x21')](respondWithResult(_0x466834,null))[_0x0a2e('0x2a')](handleError(_0x466834,null));};exports[_0x0a2e('0x58')]=function(_0x4b9d48,_0x17e734){return db[_0x0a2e('0x50')][_0x0a2e('0x58')](_0x4b9d48[_0x0a2e('0x59')],{})[_0x0a2e('0x21')](respondWithResult(_0x17e734,0xc9))[_0x0a2e('0x2a')](handleError(_0x17e734,null));};exports[_0x0a2e('0x36')]=function(_0x4ffda3,_0x1b2296){if(_0x4ffda3['body']['id']){delete _0x4ffda3['body']['id'];}return db[_0x0a2e('0x50')][_0x0a2e('0x57')]({'where':{'id':_0x4ffda3[_0x0a2e('0x56')]['id']}})[_0x0a2e('0x21')](handleEntityNotFound(_0x1b2296,null))[_0x0a2e('0x21')](saveUpdates(_0x4ffda3[_0x0a2e('0x59')],null))[_0x0a2e('0x21')](respondWithResult(_0x1b2296,null))[_0x0a2e('0x2a')](handleError(_0x1b2296,null));};exports['destroy']=function(_0x7f04b8,_0x31b5f5){return db[_0x0a2e('0x50')][_0x0a2e('0x57')]({'where':{'id':_0x7f04b8[_0x0a2e('0x56')]['id']}})['then'](handleEntityNotFound(_0x31b5f5,null))[_0x0a2e('0x21')](removeEntity(_0x31b5f5,null))[_0x0a2e('0x2a')](handleError(_0x31b5f5,null));};exports[_0x0a2e('0x5a')]=function(_0x1f646d,_0x80bab1){return db[_0x0a2e('0x50')][_0x0a2e('0x5a')]()[_0x0a2e('0x21')](respondWithResult(_0x80bab1,null))[_0x0a2e('0x2a')](handleError(_0x80bab1,null));};var interaction_log=require(_0x0a2e('0x15'))(_0x0a2e('0x5b'));exports[_0x0a2e('0x5c')]=function(_0x29bd76,_0x49a7bc,_0x48ba7b){var _0xb74473={'agent':{},'channel':_0x0a2e('0x5d')};if(_0x29bd76[_0x0a2e('0x59')]['id']){delete _0x29bd76[_0x0a2e('0x59')]['id'];}_0x29bd76[_0x0a2e('0x59')][_0x0a2e('0x5e')]=!![];_0x29bd76[_0x0a2e('0x59')][_0x0a2e('0x5f')]=moment()[_0x0a2e('0x60')](_0x0a2e('0x61'));_0x29bd76[_0x0a2e('0x59')][_0x0a2e('0x62')]=_0x29bd76[_0x0a2e('0x59')][_0x0a2e('0x62')]||_0x29bd76['user']['id'];_0xb74473['agent']['id']=_0x29bd76[_0x0a2e('0x59')][_0x0a2e('0x62')];return db[_0x0a2e('0x50')][_0x0a2e('0x57')]({'where':{'id':_0x29bd76[_0x0a2e('0x56')]['id'],'UserId':null}})[_0x0a2e('0x21')](handleEntityNotFound(_0x49a7bc,null))[_0x0a2e('0x21')](saveUpdates(_0x29bd76[_0x0a2e('0x59')],null))[_0x0a2e('0x21')](function(_0x69bd4d){if(_0x69bd4d){_0xb74473['message']=_0x69bd4d[_0x0a2e('0x63')]({'plain':!![]});return db[_0x0a2e('0x64')][_0x0a2e('0x57')]({'where':{'id':_0x69bd4d[_0x0a2e('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x49a7bc,null))['then'](function(_0x34247d){if(_0x34247d){return _0x34247d[_0x0a2e('0x36')]({'UserId':_0x29bd76[_0x0a2e('0x59')][_0x0a2e('0x62')],'read1stAt':_[_0x0a2e('0x66')](_0x34247d['read1stAt'])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x0a2e('0x21')](function(_0x1832c7){if(_0x1832c7){_0xb74473[_0x0a2e('0x67')]=_0x1832c7[_0x0a2e('0x63')]({'plain':!![]});interaction_log[_0x0a2e('0x68')](_0x0a2e('0x69'),_0x29bd76['user']['id'],_0x29bd76[_0x0a2e('0x6a')][_0x0a2e('0x39')],_0x29bd76[_0x0a2e('0x6a')][_0x0a2e('0x6b')],_0xb74473['interaction']['id'],_0x29bd76[_0x0a2e('0x59')]?JSON[_0x0a2e('0x26')](_0x29bd76['body']):_0x0a2e('0x6c'));return respondWithRpcPromise(_0x0a2e('0x6d'),_0x0a2e('0x6e'),_0xb74473);}return null;})['then'](function(_0x23dbd1){var _0xe2d878=_0x0a2e('0x6f')+_0x23dbd1[_0x0a2e('0x28')][_0x0a2e('0x70')];return db[_0x0a2e('0x71')]['query'](_0xe2d878,{'type':db[_0x0a2e('0x72')]['QueryTypes'][_0x0a2e('0x73')],'raw':!![]})[_0x0a2e('0x21')](function(_0x149b53){return _0x149b53;});})[_0x0a2e('0x21')](function(_0x2e52d6){if(_0x2e52d6){_0xb74473[_0x0a2e('0x28')]['contact']=_0x2e52d6[0x0];if(!_0x29bd76[_0x0a2e('0x59')][_0x0a2e('0x62')])return;return db[_0x0a2e('0x74')][_0x0a2e('0x57')]({'where':{'id':_0x29bd76['body'][_0x0a2e('0x62')],'role':_0x0a2e('0x75')},'attributes':['id','name',_0x0a2e('0x76'),_0x0a2e('0x77'),_0x0a2e('0x78')],'raw':!![]});}return null;})['then'](function(_0x6fbd63){if(!_0x6fbd63)return null;_0xb74473[_0x0a2e('0x28')][_0x0a2e('0x75')]=_0x6fbd63;return _0xb74473;})[_0x0a2e('0x21')](function(_0x4eb8ad){if(_0x4eb8ad){if(_0x29bd76[_0x0a2e('0x59')][_0x0a2e('0x79')]){_0xb74473['message'][_0x0a2e('0x7a')]=util[_0x0a2e('0x60')]('SIP/%s',_0x29bd76['user']['name']);_0xb74473[_0x0a2e('0x28')]['channel']=_0xb74473['channel'];_0xb74473['message'][_0x0a2e('0x7b')]=_0xb74473['channel'];_0xb74473['message'][_0x0a2e('0x7c')]='accept';return respondWithRpcPromise(_0x0a2e('0x7d'),'EventManager',{'event':_0x0a2e('0x7e'),'message':_[_0x0a2e('0x4e')](_0xb74473[_0x0a2e('0x28')],JSON[_0x0a2e('0x7f')](_0xb74473['interaction'][_0x0a2e('0x80')]))},client9002)[_0x0a2e('0x21')](function(){return _0xb74473;});}return _0xb74473;}return null;})[_0x0a2e('0x21')](respondWithResult(_0x49a7bc,null))[_0x0a2e('0x2a')](handleError(_0x49a7bc,null));};var interaction_log=require(_0x0a2e('0x15'))(_0x0a2e('0x5b'));exports[_0x0a2e('0x34')]=function(_0x192580,_0x2ecb01,_0x10c6c9){var _0x44d5d2={'agent':{},'channel':'chat'};if(_0x192580[_0x0a2e('0x59')]['id']){delete _0x192580[_0x0a2e('0x59')]['id'];}_0x192580['body'][_0x0a2e('0x62')]=_0x192580[_0x0a2e('0x59')]['UserId']||_0x192580['user']['id'];_0x44d5d2['agent']['id']=_0x192580[_0x0a2e('0x59')][_0x0a2e('0x62')];return db[_0x0a2e('0x50')][_0x0a2e('0x57')]({'where':{'id':_0x192580[_0x0a2e('0x56')]['id'],'UserId':null}})[_0x0a2e('0x21')](handleEntityNotFound(_0x2ecb01,null))[_0x0a2e('0x21')](function(_0x57178c){if(_0x57178c){_0x44d5d2[_0x0a2e('0x28')]=_0x57178c[_0x0a2e('0x63')]({'plain':!![]});return db[_0x0a2e('0x64')]['find']({'where':{'id':_0x57178c[_0x0a2e('0x65')]}});}return null;})[_0x0a2e('0x21')](handleEntityNotFound(_0x2ecb01,null))['then'](function(_0x924b08){if(_0x924b08){_0x44d5d2[_0x0a2e('0x67')]=_0x924b08[_0x0a2e('0x63')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x192580['user']['id'],_0x192580[_0x0a2e('0x6a')][_0x0a2e('0x39')],_0x192580[_0x0a2e('0x6a')][_0x0a2e('0x6b')],_0x44d5d2[_0x0a2e('0x67')]['id'],_0x192580[_0x0a2e('0x59')]?JSON[_0x0a2e('0x26')](_0x192580[_0x0a2e('0x59')]):_0x0a2e('0x6c'));return respondWithRpcPromise(_0x0a2e('0x81'),'rejectMessage',_0x44d5d2);}return null;})[_0x0a2e('0x21')](function(_0x55a978){var _0x443b2e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x55a978[_0x0a2e('0x28')][_0x0a2e('0x70')];return db['sequelize'][_0x0a2e('0x41')](_0x443b2e,{'type':db['Sequelize']['QueryTypes'][_0x0a2e('0x73')],'raw':!![]})['then'](function(_0x335169){return _0x335169;});})[_0x0a2e('0x21')](function(_0x59d0b9){if(_0x59d0b9){_0x44d5d2[_0x0a2e('0x28')][_0x0a2e('0x82')]=_0x59d0b9[0x0];if(!_0x192580['body']['UserId'])return;return db[_0x0a2e('0x74')]['find']({'where':{'id':_0x192580[_0x0a2e('0x59')][_0x0a2e('0x62')],'role':_0x0a2e('0x75')},'attributes':['id','name',_0x0a2e('0x76'),'email',_0x0a2e('0x78')],'raw':!![]});}return null;})['then'](function(_0x5ce9bd){if(!_0x5ce9bd)return null;_0x44d5d2[_0x0a2e('0x28')]['agent']=_0x5ce9bd;return _0x44d5d2;})[_0x0a2e('0x21')](function(_0x26ed7d){if(_0x26ed7d){_0x26ed7d['message'][_0x0a2e('0x7a')]=util[_0x0a2e('0x60')](_0x0a2e('0x83'),_0x192580[_0x0a2e('0x6a')]['name']);_0x26ed7d[_0x0a2e('0x28')][_0x0a2e('0x84')]=_0x44d5d2['channel'];_0x26ed7d['message'][_0x0a2e('0x7b')]=_0x44d5d2[_0x0a2e('0x84')];_0x26ed7d[_0x0a2e('0x28')]['event']=_0x0a2e('0x34');respondWithRpcPromise(_0x0a2e('0x7d'),_0x0a2e('0x7d'),{'event':_0x0a2e('0x85'),'message':_[_0x0a2e('0x4e')](_0x44d5d2['message'],JSON[_0x0a2e('0x7f')](_0x44d5d2['interaction'][_0x0a2e('0x80')]))},client9002);return _0x44d5d2;}return null;})[_0x0a2e('0x21')](respondWithResult(_0x2ecb01,null))['catch'](handleError(_0x2ecb01,null));}; \ No newline at end of file +var _0x216b=['fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','include','ChatMessage','findAll','rows','show','params','keys','length','includeAll','options','find','create','body','describe','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','fullname','internal','motionChannel','channel','event','acceptmessage','parse','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','sequelize','email','SIP/%s','reject','EventManager','rejectmessage','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./chatMessage.socket','register','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','end','stack','name','send','index','map','rawAttributes','fieldName','key','query','filters','intersection','model','attributes'];(function(_0x568eef,_0x3494a2){var _0x549955=function(_0x8caa2f){while(--_0x8caa2f){_0x568eef['push'](_0x568eef['shift']());}};_0x549955(++_0x3494a2);}(_0x216b,0x1c8));var _0xb216=function(_0x113302,_0x50f3dd){_0x113302=_0x113302-0x0;var _0xa6343=_0x216b[_0x113302];return _0xa6343;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb216('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb216('0x1'));var rp=require('request-promise');var moment=require(_0xb216('0x2'));var BPromise=require(_0xb216('0x3'));var Mustache=require(_0xb216('0x4'));var util=require(_0xb216('0x5'));var path=require(_0xb216('0x6'));var sox=require(_0xb216('0x7'));var csv=require(_0xb216('0x8'));var ejs=require(_0xb216('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb216('0xa'));var squel=require(_0xb216('0xb'));var crypto=require(_0xb216('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb216('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb216('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb216('0xe'));var hardwareService=require(_0xb216('0xf'));var logger=require(_0xb216('0x10'))(_0xb216('0x11'));var utils=require('../../config/utils');var config=require(_0xb216('0x12'));var licenseUtil=require(_0xb216('0x13'));var db=require(_0xb216('0x14'))['db'];config[_0xb216('0x15')]=_[_0xb216('0x16')](config[_0xb216('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb216('0x15')]));require(_0xb216('0x17'))[_0xb216('0x18')](socket);var jayson=require('jayson/promise');var client=jayson[_0xb216('0x19')][_0xb216('0x1a')]({'port':0x232c});var client9002=jayson[_0xb216('0x19')][_0xb216('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x8ea087,_0x51851b,_0x2fcdd6,_0xdd773b){return new BPromise(function(_0x106ccd,_0x3a6618){var _0x2fa920=_0xdd773b||client;return _0x2fa920[_0xb216('0x1b')](_0x8ea087,_0x2fcdd6)[_0xb216('0x1c')](function(_0x1198c3){logger[_0xb216('0x1d')](_0xb216('0x1e'),_0x51851b,'request\x20sent');logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x51851b,'request\x20sent',JSON[_0xb216('0x1f')](_0x1198c3));if(_0x1198c3[_0xb216('0x20')]){if(_0x1198c3[_0xb216('0x20')][_0xb216('0x21')]===0x1f4){logger[_0xb216('0x20')](_0xb216('0x1e'),_0x51851b,_0x1198c3[_0xb216('0x20')][_0xb216('0x22')]);return _0x3a6618(_0x1198c3[_0xb216('0x20')][_0xb216('0x22')]);}logger[_0xb216('0x20')]('ChatMessage,\x20%s,\x20%s',_0x51851b,_0x1198c3[_0xb216('0x20')][_0xb216('0x22')]);return _0x106ccd(_0x1198c3[_0xb216('0x20')][_0xb216('0x22')]);}else{logger[_0xb216('0x1d')]('ChatMessage,\x20%s,\x20%s',_0x51851b,_0xb216('0x23'));_0x106ccd(_0x1198c3[_0xb216('0x24')]['message']);}})[_0xb216('0x25')](function(_0x39c3a8){logger[_0xb216('0x20')](_0xb216('0x1e'),_0x51851b,_0x39c3a8);_0x3a6618(_0x39c3a8);});});}function respondWithStatusCode(_0x13d424,_0x2fa266){_0x2fa266=_0x2fa266||0xcc;return function(_0x459735){if(_0x459735){return _0x13d424[_0xb216('0x26')](_0x2fa266);}return _0x13d424[_0xb216('0x27')](_0x2fa266)['end']();};}function respondWithResult(_0x314988,_0x3da310){_0x3da310=_0x3da310||0xc8;return function(_0x1115a7){if(_0x1115a7){return _0x314988[_0xb216('0x27')](_0x3da310)[_0xb216('0x28')](_0x1115a7);}};}function respondWithFilteredResult(_0x4dfee0,_0x3ffa35){return function(_0x37b0ad){if(_0x37b0ad){var _0x45b89b=typeof _0x3ffa35[_0xb216('0x29')]===_0xb216('0x2a')&&typeof _0x3ffa35['limit']==='undefined';var _0x3385ad=_0x37b0ad[_0xb216('0x2b')];var _0xf31139=_0x45b89b?0x0:_0x3ffa35['offset'];var _0x5cfc62=_0x45b89b?_0x37b0ad[_0xb216('0x2b')]:_0x3ffa35['offset']+_0x3ffa35[_0xb216('0x2c')];var _0x1be53d;if(_0x5cfc62>=_0x3385ad){_0x5cfc62=_0x3385ad;_0x1be53d=0xc8;}else{_0x1be53d=0xce;}_0x4dfee0[_0xb216('0x27')](_0x1be53d);return _0x4dfee0[_0xb216('0x2d')](_0xb216('0x2e'),_0xf31139+'-'+_0x5cfc62+'/'+_0x3385ad)['json'](_0x37b0ad);}return null;};}function patchUpdates(_0x50222a){return function(_0x3e75bb){try{jsonpatch[_0xb216('0x2f')](_0x3e75bb,_0x50222a,!![]);}catch(_0x3d726b){return BPromise['reject'](_0x3d726b);}return _0x3e75bb[_0xb216('0x30')]();};}function saveUpdates(_0x8fdac8,_0x52d851){return function(_0x5a0d49){if(_0x5a0d49){return _0x5a0d49[_0xb216('0x31')](_0x8fdac8)[_0xb216('0x1c')](function(_0x56234d){return _0x56234d;});}return null;};}function removeEntity(_0x98820f,_0x3249d7){return function(_0x39f2fe){if(_0x39f2fe){return _0x39f2fe['destroy']()['then'](function(){_0x98820f['status'](0xcc)[_0xb216('0x32')]();});}};}function handleEntityNotFound(_0x3831aa,_0x5776a3){return function(_0xbf4cf8){if(!_0xbf4cf8){_0x3831aa['sendStatus'](0x194);}return _0xbf4cf8;};}function handleError(_0xe1605a,_0x3e5742){_0x3e5742=_0x3e5742||0x1f4;return function(_0x534720){logger[_0xb216('0x20')](_0x534720[_0xb216('0x33')]);if(_0x534720[_0xb216('0x34')]){delete _0x534720[_0xb216('0x34')];}_0xe1605a[_0xb216('0x27')](_0x3e5742)[_0xb216('0x35')](_0x534720);};}exports[_0xb216('0x36')]=function(_0x30fe71,_0x52c5cf){var _0x234de0={},_0x552590={},_0x3da660={'count':0x0,'rows':[]};var _0x3a9851=_[_0xb216('0x37')](db['ChatMessage'][_0xb216('0x38')],function(_0xc79639){return{'name':_0xc79639[_0xb216('0x39')],'type':_0xc79639['type'][_0xb216('0x3a')]};});_0x552590['model']=_[_0xb216('0x37')](_0x3a9851,'name');_0x552590[_0xb216('0x3b')]=_['keys'](_0x30fe71[_0xb216('0x3b')]);_0x552590[_0xb216('0x3c')]=_[_0xb216('0x3d')](_0x552590[_0xb216('0x3e')],_0x552590[_0xb216('0x3b')]);_0x234de0[_0xb216('0x3f')]=_['intersection'](_0x552590['model'],qs[_0xb216('0x40')](_0x30fe71['query'][_0xb216('0x40')]));_0x234de0[_0xb216('0x3f')]=_0x234de0[_0xb216('0x3f')]['length']?_0x234de0[_0xb216('0x3f')]:_0x552590[_0xb216('0x3e')];if(!_0x30fe71['query'][_0xb216('0x41')](_0xb216('0x42'))){_0x234de0['limit']=qs[_0xb216('0x2c')](_0x30fe71[_0xb216('0x3b')][_0xb216('0x2c')]);_0x234de0[_0xb216('0x29')]=qs[_0xb216('0x29')](_0x30fe71['query'][_0xb216('0x29')]);}_0x234de0[_0xb216('0x43')]=qs[_0xb216('0x44')](_0x30fe71[_0xb216('0x3b')]['sort']);_0x234de0[_0xb216('0x45')]=qs[_0xb216('0x3c')](_[_0xb216('0x46')](_0x30fe71[_0xb216('0x3b')],_0x552590[_0xb216('0x3c')]),_0x3a9851);if(_0x30fe71[_0xb216('0x3b')][_0xb216('0x47')]){_0x234de0['where']=_[_0xb216('0x48')](_0x234de0['where'],{'$or':_[_0xb216('0x37')](_0x3a9851,function(_0x199963){if(_0x199963[_0xb216('0x49')]!==_0xb216('0x4a')){var _0x1adf5a={};_0x1adf5a[_0x199963[_0xb216('0x34')]]={'$like':'%'+_0x30fe71[_0xb216('0x3b')][_0xb216('0x47')]+'%'};return _0x1adf5a;}})});}_0x234de0=_['merge']({},_0x234de0,_0x30fe71['options']);var _0x2be3ac={'where':_0x234de0['where']};return db['ChatMessage'][_0xb216('0x2b')](_0x2be3ac)[_0xb216('0x1c')](function(_0x1de60b){_0x3da660[_0xb216('0x2b')]=_0x1de60b;if(_0x30fe71['query']['includeAll']){_0x234de0[_0xb216('0x4b')]=[{'all':!![]}];}return db[_0xb216('0x4c')][_0xb216('0x4d')](_0x234de0);})[_0xb216('0x1c')](function(_0x2700f4){_0x3da660[_0xb216('0x4e')]=_0x2700f4;return _0x3da660;})[_0xb216('0x1c')](respondWithFilteredResult(_0x52c5cf,_0x234de0))['catch'](handleError(_0x52c5cf,null));};exports[_0xb216('0x4f')]=function(_0x47b6bc,_0x2209e3){var _0x1a01cc={'raw':!![],'where':{'id':_0x47b6bc[_0xb216('0x50')]['id']}},_0x5e8393={};_0x5e8393[_0xb216('0x3e')]=_['keys'](db[_0xb216('0x4c')][_0xb216('0x38')]);_0x5e8393['query']=_[_0xb216('0x51')](_0x47b6bc[_0xb216('0x3b')]);_0x5e8393[_0xb216('0x3c')]=_[_0xb216('0x3d')](_0x5e8393[_0xb216('0x3e')],_0x5e8393[_0xb216('0x3b')]);_0x1a01cc[_0xb216('0x3f')]=_[_0xb216('0x3d')](_0x5e8393[_0xb216('0x3e')],qs['fields'](_0x47b6bc['query'][_0xb216('0x40')]));_0x1a01cc['attributes']=_0x1a01cc[_0xb216('0x3f')][_0xb216('0x52')]?_0x1a01cc[_0xb216('0x3f')]:_0x5e8393[_0xb216('0x3e')];if(_0x47b6bc[_0xb216('0x3b')][_0xb216('0x53')]){_0x1a01cc[_0xb216('0x4b')]=[{'all':!![]}];}_0x1a01cc=_[_0xb216('0x48')]({},_0x1a01cc,_0x47b6bc[_0xb216('0x54')]);return db[_0xb216('0x4c')][_0xb216('0x55')](_0x1a01cc)[_0xb216('0x1c')](handleEntityNotFound(_0x2209e3,null))[_0xb216('0x1c')](respondWithResult(_0x2209e3,null))[_0xb216('0x25')](handleError(_0x2209e3,null));};exports[_0xb216('0x56')]=function(_0x2d2f37,_0x521323){return db['ChatMessage'][_0xb216('0x56')](_0x2d2f37[_0xb216('0x57')],{})[_0xb216('0x1c')](respondWithResult(_0x521323,0xc9))[_0xb216('0x25')](handleError(_0x521323,null));};exports[_0xb216('0x31')]=function(_0xb3bdcf,_0x282012){if(_0xb3bdcf[_0xb216('0x57')]['id']){delete _0xb3bdcf[_0xb216('0x57')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0xb3bdcf[_0xb216('0x50')]['id']}})['then'](handleEntityNotFound(_0x282012,null))['then'](saveUpdates(_0xb3bdcf[_0xb216('0x57')],null))['then'](respondWithResult(_0x282012,null))[_0xb216('0x25')](handleError(_0x282012,null));};exports['destroy']=function(_0x46cd5a,_0x34fcde){return db[_0xb216('0x4c')][_0xb216('0x55')]({'where':{'id':_0x46cd5a[_0xb216('0x50')]['id']}})[_0xb216('0x1c')](handleEntityNotFound(_0x34fcde,null))[_0xb216('0x1c')](removeEntity(_0x34fcde,null))['catch'](handleError(_0x34fcde,null));};exports[_0xb216('0x58')]=function(_0x24ccc0,_0x2023cd){return db['ChatMessage'][_0xb216('0x58')]()[_0xb216('0x1c')](respondWithResult(_0x2023cd,null))['catch'](handleError(_0x2023cd,null));};var interaction_log=require(_0xb216('0x10'))('chat-interactions');exports[_0xb216('0x59')]=function(_0x41067f,_0x5a78e0,_0x3466c9){var _0x58da9f={'agent':{},'channel':_0xb216('0x5a')};if(_0x41067f[_0xb216('0x57')]['id']){delete _0x41067f[_0xb216('0x57')]['id'];}_0x41067f['body'][_0xb216('0x5b')]=!![];_0x41067f[_0xb216('0x57')][_0xb216('0x5c')]=moment()[_0xb216('0x5d')](_0xb216('0x5e'));_0x41067f[_0xb216('0x57')][_0xb216('0x5f')]=_0x41067f['body'][_0xb216('0x5f')]||_0x41067f[_0xb216('0x60')]['id'];_0x58da9f[_0xb216('0x61')]['id']=_0x41067f[_0xb216('0x57')][_0xb216('0x5f')];return db[_0xb216('0x4c')]['find']({'where':{'id':_0x41067f[_0xb216('0x50')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5a78e0,null))[_0xb216('0x1c')](saveUpdates(_0x41067f['body'],null))[_0xb216('0x1c')](function(_0x268fa5){if(_0x268fa5){_0x58da9f[_0xb216('0x22')]=_0x268fa5[_0xb216('0x62')]({'plain':!![]});return db[_0xb216('0x63')][_0xb216('0x55')]({'where':{'id':_0x268fa5[_0xb216('0x64')]}});}return null;})[_0xb216('0x1c')](handleEntityNotFound(_0x5a78e0,null))[_0xb216('0x1c')](function(_0xc71487){if(_0xc71487){return _0xc71487[_0xb216('0x31')]({'UserId':_0x41067f[_0xb216('0x57')]['UserId'],'read1stAt':_[_0xb216('0x65')](_0xc71487['read1stAt'])?moment()[_0xb216('0x5d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xb216('0x1c')](function(_0x34f02a){if(_0x34f02a){_0x58da9f[_0xb216('0x66')]=_0x34f02a[_0xb216('0x62')]({'plain':!![]});interaction_log[_0xb216('0x1d')](_0xb216('0x67'),_0x41067f[_0xb216('0x60')]['id'],_0x41067f[_0xb216('0x60')][_0xb216('0x34')],_0x41067f[_0xb216('0x60')]['role'],_0x58da9f[_0xb216('0x66')]['id'],_0x41067f['body']?JSON[_0xb216('0x1f')](_0x41067f['body']):_0xb216('0x68'));return respondWithRpcPromise('AcceptMessage',_0xb216('0x69'),_0x58da9f);}return null;})[_0xb216('0x1c')](function(_0xd994c4){var _0x49101a=_0xb216('0x6a')+_0xd994c4[_0xb216('0x22')][_0xb216('0x6b')];return db['sequelize'][_0xb216('0x3b')](_0x49101a,{'type':db[_0xb216('0x6c')][_0xb216('0x6d')][_0xb216('0x6e')],'raw':!![]})[_0xb216('0x1c')](function(_0x47c562){return _0x47c562;});})[_0xb216('0x1c')](function(_0x37aab4){if(_0x37aab4){_0x58da9f[_0xb216('0x22')][_0xb216('0x6f')]=_0x37aab4[0x0];if(!_0x41067f[_0xb216('0x57')][_0xb216('0x5f')])return;return db['User'][_0xb216('0x55')]({'where':{'id':_0x41067f['body']['UserId'],'role':_0xb216('0x61')},'attributes':['id',_0xb216('0x34'),_0xb216('0x70'),'email',_0xb216('0x71')],'raw':!![]});}return null;})['then'](function(_0x50e470){if(!_0x50e470)return null;_0x58da9f['message'][_0xb216('0x61')]=_0x50e470;return _0x58da9f;})['then'](function(_0x3197f9){if(_0x3197f9){if(_0x41067f[_0xb216('0x57')]['manual']){_0x58da9f[_0xb216('0x22')]['interface']=util['format']('SIP/%s',_0x41067f['user'][_0xb216('0x34')]);_0x58da9f[_0xb216('0x22')]['channel']=_0x58da9f['channel'];_0x58da9f[_0xb216('0x22')][_0xb216('0x72')]=_0x58da9f[_0xb216('0x73')];_0x58da9f[_0xb216('0x22')][_0xb216('0x74')]=_0xb216('0x59');return respondWithRpcPromise('EventManager','EventManager',{'event':_0xb216('0x75'),'message':_[_0xb216('0x48')](_0x58da9f[_0xb216('0x22')],JSON[_0xb216('0x76')](_0x58da9f['interaction'][_0xb216('0x77')]))},client9002)[_0xb216('0x1c')](function(){return _0x58da9f;});}return _0x58da9f;}return null;})['then'](respondWithResult(_0x5a78e0,null))['catch'](handleError(_0x5a78e0,null));};var interaction_log=require(_0xb216('0x10'))('chat-interactions');exports['reject']=function(_0x4992a7,_0x17f280,_0x363563){var _0x17fb1f={'agent':{},'channel':_0xb216('0x5a')};if(_0x4992a7[_0xb216('0x57')]['id']){delete _0x4992a7['body']['id'];}_0x4992a7['body']['UserId']=_0x4992a7[_0xb216('0x57')][_0xb216('0x5f')]||_0x4992a7[_0xb216('0x60')]['id'];_0x17fb1f[_0xb216('0x61')]['id']=_0x4992a7[_0xb216('0x57')][_0xb216('0x5f')];return db[_0xb216('0x4c')]['find']({'where':{'id':_0x4992a7['params']['id'],'UserId':null}})[_0xb216('0x1c')](handleEntityNotFound(_0x17f280,null))[_0xb216('0x1c')](function(_0x487cad){if(_0x487cad){_0x17fb1f[_0xb216('0x22')]=_0x487cad[_0xb216('0x62')]({'plain':!![]});return db[_0xb216('0x63')][_0xb216('0x55')]({'where':{'id':_0x487cad[_0xb216('0x64')]}});}return null;})[_0xb216('0x1c')](handleEntityNotFound(_0x17f280,null))[_0xb216('0x1c')](function(_0x3c510e){if(_0x3c510e){_0x17fb1f[_0xb216('0x66')]=_0x3c510e[_0xb216('0x62')]({'plain':!![]});interaction_log[_0xb216('0x1d')](_0xb216('0x78'),_0x4992a7[_0xb216('0x60')]['id'],_0x4992a7[_0xb216('0x60')][_0xb216('0x34')],_0x4992a7[_0xb216('0x60')][_0xb216('0x79')],_0x17fb1f['interaction']['id'],_0x4992a7[_0xb216('0x57')]?JSON[_0xb216('0x1f')](_0x4992a7[_0xb216('0x57')]):_0xb216('0x68'));return respondWithRpcPromise(_0xb216('0x7a'),_0xb216('0x7b'),_0x17fb1f);}return null;})[_0xb216('0x1c')](function(_0x22c127){var _0xbf927=_0xb216('0x6a')+_0x22c127[_0xb216('0x22')][_0xb216('0x6b')];return db[_0xb216('0x7c')]['query'](_0xbf927,{'type':db[_0xb216('0x6c')][_0xb216('0x6d')][_0xb216('0x6e')],'raw':!![]})['then'](function(_0x8b9a2f){return _0x8b9a2f;});})['then'](function(_0x5f5e0f){if(_0x5f5e0f){_0x17fb1f[_0xb216('0x22')][_0xb216('0x6f')]=_0x5f5e0f[0x0];if(!_0x4992a7[_0xb216('0x57')][_0xb216('0x5f')])return;return db['User']['find']({'where':{'id':_0x4992a7['body'][_0xb216('0x5f')],'role':_0xb216('0x61')},'attributes':['id',_0xb216('0x34'),_0xb216('0x70'),_0xb216('0x7d'),'internal'],'raw':!![]});}return null;})[_0xb216('0x1c')](function(_0x277ec3){if(!_0x277ec3)return null;_0x17fb1f['message'][_0xb216('0x61')]=_0x277ec3;return _0x17fb1f;})[_0xb216('0x1c')](function(_0x50ee15){if(_0x50ee15){_0x50ee15[_0xb216('0x22')]['interface']=util[_0xb216('0x5d')](_0xb216('0x7e'),_0x4992a7[_0xb216('0x60')][_0xb216('0x34')]);_0x50ee15[_0xb216('0x22')][_0xb216('0x73')]=_0x17fb1f[_0xb216('0x73')];_0x50ee15[_0xb216('0x22')][_0xb216('0x72')]=_0x17fb1f[_0xb216('0x73')];_0x50ee15['message'][_0xb216('0x74')]=_0xb216('0x7f');respondWithRpcPromise('EventManager',_0xb216('0x80'),{'event':_0xb216('0x81'),'message':_[_0xb216('0x48')](_0x17fb1f['message'],JSON[_0xb216('0x76')](_0x17fb1f['interaction'][_0xb216('0x77')]))},client9002);return _0x17fb1f;}return null;})[_0xb216('0x1c')](respondWithResult(_0x17f280,null))['catch'](handleError(_0x17f280,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 15b4af6..187dd62 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 _0xab48=['save','remove','emit','hasOwnProperty','hook','exports','ChatMessage','setMaxListeners'];(function(_0x380667,_0x863bc8){var _0x114eed=function(_0x4127a4){while(--_0x4127a4){_0x380667['push'](_0x380667['shift']());}};_0x114eed(++_0x863bc8);}(_0xab48,0x156));var _0x8ab4=function(_0x3dc538,_0x4f7702){_0x3dc538=_0x3dc538-0x0;var _0x72c2fd=_0xab48[_0x3dc538];return _0x72c2fd;};'use strict';var EventEmitter=require('events');var ChatMessage=require('../../mysqldb')['db'][_0x8ab4('0x0')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x8ab4('0x1')](0x0);var events={'afterCreate':_0x8ab4('0x2'),'afterUpdate':'update','afterDestroy':_0x8ab4('0x3')};function emitEvent(_0x5ad2a5){return function(_0x3e1ece,_0x5da763,_0x27355e){ChatMessageEvents['emit'](_0x5ad2a5+':'+_0x3e1ece['id'],_0x3e1ece);ChatMessageEvents[_0x8ab4('0x4')](_0x5ad2a5,_0x3e1ece);_0x27355e(null);};}for(var e in events){if(events[_0x8ab4('0x5')](e)){var event=events[e];ChatMessage[_0x8ab4('0x6')](e,emitEvent(event));}}module[_0x8ab4('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0x1a83=['hook','exports','../../mysqldb','ChatMessage','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x511ee8,_0x1934be){var _0x4386d6=function(_0x3dfc6f){while(--_0x3dfc6f){_0x511ee8['push'](_0x511ee8['shift']());}};_0x4386d6(++_0x1934be);}(_0x1a83,0xfe));var _0x31a8=function(_0x5eb1a7,_0x4acae9){_0x5eb1a7=_0x5eb1a7-0x0;var _0x39fdf3=_0x1a83[_0x5eb1a7];return _0x39fdf3;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x31a8('0x0'))['db'][_0x31a8('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x31a8('0x2')](0x0);var events={'afterCreate':_0x31a8('0x3'),'afterUpdate':_0x31a8('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1bffcf){return function(_0x431887,_0xa903af,_0x449a3f){ChatMessageEvents[_0x31a8('0x5')](_0x1bffcf+':'+_0x431887['id'],_0x431887);ChatMessageEvents[_0x31a8('0x5')](_0x1bffcf,_0x431887);_0x449a3f(null);};}for(var e in events){if(events[_0x31a8('0x6')](e)){var event=events[e];ChatMessage[_0x31a8('0x7')](e,emitEvent(event));}}module[_0x31a8('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index e2f977c..5aec8ea 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 _0xb0ff=['bluebird','request-promise','rimraf','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','FULLTEXT','get','direction','toLowerCase','out','isNil','UserId','ChatInteraction','then','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xb0ff,0xb3));var _0xfb0f=function(_0x20c0d1,_0x1d76b5){_0x20c0d1=_0x20c0d1-0x0;var _0x2dc2f3=_0xb0ff[_0x20c0d1];return _0x2dc2f3;};'use strict';var _=require('lodash');var util=require(_0xfb0f('0x0'));var logger=require(_0xfb0f('0x1'))('api');var moment=require(_0xfb0f('0x2'));var BPromise=require(_0xfb0f('0x3'));var rp=require(_0xfb0f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfb0f('0x5'));var config=require('../../config/environment');var attributes=require(_0xfb0f('0x6'));module[_0xfb0f('0x7')]=function(_0x334b59,_0x2583f8){return _0x334b59[_0xfb0f('0x8')](_0xfb0f('0x9'),attributes,{'tableName':_0xfb0f('0xa'),'paranoid':![],'indexes':[{'name':_0xfb0f('0xb'),'fields':['body'],'type':_0xfb0f('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1a9323,_0x979445,_0xd17401){var _0x28907c=_0x334b59['models'];var _0xfe7436=_0x1a9323[_0xfb0f('0xd')]({'plain':!![]});if(_0xfe7436[_0xfb0f('0xe')]['toLowerCase']()==='in'||_0xfe7436[_0xfb0f('0xe')][_0xfb0f('0xf')]()===_0xfb0f('0x10')&&!_0xfe7436['secret']&&!_[_0xfb0f('0x11')](_0xfe7436[_0xfb0f('0x12')])){_0x28907c[_0xfb0f('0x13')]['findOne']({'where':{'id':_0xfe7436['ChatInteractionId']}})[_0xfb0f('0x14')](function(_0x45ea50){if(_0x45ea50){_0x45ea50[_0xfb0f('0x15')]({'lastMsgAt':_0xfe7436[_0xfb0f('0x16')],'lastMsgDirection':_0xfe7436[_0xfb0f('0xe')]['toLowerCase']()});}})['catch'](function(_0x34bf7b){console[_0xfb0f('0x17')](_0x34bf7b);});}_0xd17401();}},'charset':_0xfb0f('0x18'),'collate':_0xfb0f('0x19')});}; \ No newline at end of file +var _0x3d7e=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','ChatMessage','chat_messages','fti_chat_messages','FULLTEXT','models','get','direction','toLowerCase','secret','UserId','ChatInteraction','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4','lodash','../../config/logger'];(function(_0x2ecd91,_0x1f21e8){var _0x3bf737=function(_0x1563d7){while(--_0x1563d7){_0x2ecd91['push'](_0x2ecd91['shift']());}};_0x3bf737(++_0x1f21e8);}(_0x3d7e,0x1ae));var _0xe3d7=function(_0x19a49f,_0x444d74){_0x19a49f=_0x19a49f-0x0;var _0x5351ae=_0x3d7e[_0x19a49f];return _0x5351ae;};'use strict';var _=require(_0xe3d7('0x0'));var util=require('util');var logger=require(_0xe3d7('0x1'))('api');var moment=require(_0xe3d7('0x2'));var BPromise=require(_0xe3d7('0x3'));var rp=require(_0xe3d7('0x4'));var fs=require('fs');var path=require(_0xe3d7('0x5'));var rimraf=require(_0xe3d7('0x6'));var config=require(_0xe3d7('0x7'));var attributes=require('./chatMessage.attributes');module[_0xe3d7('0x8')]=function(_0x35e1fc,_0x4498e3){return _0x35e1fc['define'](_0xe3d7('0x9'),attributes,{'tableName':_0xe3d7('0xa'),'paranoid':![],'indexes':[{'name':_0xe3d7('0xb'),'fields':['body'],'type':_0xe3d7('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2d6604,_0x173287,_0x428316){var _0x37b6f9=_0x35e1fc[_0xe3d7('0xd')];var _0x5d7586=_0x2d6604[_0xe3d7('0xe')]({'plain':!![]});if(_0x5d7586[_0xe3d7('0xf')][_0xe3d7('0x10')]()==='in'||_0x5d7586[_0xe3d7('0xf')][_0xe3d7('0x10')]()==='out'&&!_0x5d7586[_0xe3d7('0x11')]&&!_['isNil'](_0x5d7586[_0xe3d7('0x12')])){_0x37b6f9[_0xe3d7('0x13')]['findOne']({'where':{'id':_0x5d7586[_0xe3d7('0x14')]}})[_0xe3d7('0x15')](function(_0xb258cc){if(_0xb258cc){_0xb258cc[_0xe3d7('0x16')]({'lastMsgAt':_0x5d7586[_0xe3d7('0x17')],'lastMsgDirection':_0x5d7586[_0xe3d7('0xf')][_0xe3d7('0x10')]()});}})[_0xe3d7('0x18')](function(_0x2efb98){console[_0xe3d7('0x19')](_0x2efb98);});}_0x428316();}},'charset':_0xe3d7('0x1a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 72e1e0f..2511603 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 _0x7d53=['defaults','localhost','./chatMessage.socket','register','request','request\x20sent','debug','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','info','result','catch','CreateChatMessage','ChatMessage','create','body','options','then','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','redis'];(function(_0x129b99,_0x169e1a){var _0x3aaa57=function(_0x1673a2){while(--_0x1673a2){_0x129b99['push'](_0x129b99['shift']());}};_0x3aaa57(++_0x169e1a);}(_0x7d53,0x1b9));var _0x37d5=function(_0x12f80c,_0x56b096){_0x12f80c=_0x12f80c-0x0;var _0x3cb84d=_0x7d53[_0x12f80c];return _0x3cb84d;};'use strict';var _=require(_0x37d5('0x0'));var util=require(_0x37d5('0x1'));var moment=require(_0x37d5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x37d5('0x3'));var db=require(_0x37d5('0x4'))['db'];var utils=require(_0x37d5('0x5'));var logger=require('../../config/logger')(_0x37d5('0x6'));var config=require('../../config/environment');var jayson=require(_0x37d5('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x37d5('0x8')]=_[_0x37d5('0x9')](config['redis'],{'host':_0x37d5('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x37d5('0x8')]));require(_0x37d5('0xb'))[_0x37d5('0xc')](socket);function respondWithRpcPromise(_0x24451d,_0x5c3f83,_0x3defd8){return new BPromise(function(_0x183c63,_0x331cee){return client[_0x37d5('0xd')](_0x24451d,_0x3defd8)['then'](function(_0x29ddb0){logger['info']('ChatMessage,\x20%s,\x20%s',_0x5c3f83,_0x37d5('0xe'));logger[_0x37d5('0xf')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x5c3f83,_0x37d5('0xe'),JSON[_0x37d5('0x10')](_0x29ddb0));if(_0x29ddb0[_0x37d5('0x11')]){if(_0x29ddb0['error'][_0x37d5('0x12')]===0x1f4){logger[_0x37d5('0x11')](_0x37d5('0x13'),_0x5c3f83,_0x29ddb0[_0x37d5('0x11')]['message']);return _0x331cee(_0x29ddb0['error'][_0x37d5('0x14')]);}logger[_0x37d5('0x11')]('ChatMessage,\x20%s,\x20%s',_0x5c3f83,_0x29ddb0[_0x37d5('0x11')]['message']);return _0x183c63(_0x29ddb0[_0x37d5('0x11')]['message']);}else{logger[_0x37d5('0x15')]('ChatMessage,\x20%s,\x20%s',_0x5c3f83,_0x37d5('0xe'));_0x183c63(_0x29ddb0[_0x37d5('0x16')][_0x37d5('0x14')]);}})[_0x37d5('0x17')](function(_0x324794){logger[_0x37d5('0x11')](_0x37d5('0x13'),_0x5c3f83,_0x324794);_0x331cee(_0x324794);});});}exports[_0x37d5('0x18')]=function(_0x536aeb){var _0x3efc36=this;return new Promise(function(_0x59fa49,_0x4b0ff4){return db[_0x37d5('0x19')][_0x37d5('0x1a')](_0x536aeb[_0x37d5('0x1b')],{'raw':_0x536aeb['options']?_0x536aeb[_0x37d5('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x37d5('0x1d')](function(_0x44715e){logger[_0x37d5('0x15')](_0x37d5('0x18'),_0x536aeb);logger[_0x37d5('0xf')](_0x37d5('0x18'),_0x536aeb,JSON[_0x37d5('0x10')](_0x44715e));_0x59fa49(_0x44715e);})['catch'](function(_0x224f26){logger[_0x37d5('0x11')](_0x37d5('0x18'),_0x224f26[_0x37d5('0x14')],_0x536aeb);_0x4b0ff4(_0x3efc36[_0x37d5('0x11')](0x1f4,_0x224f26[_0x37d5('0x14')]));});});}; \ No newline at end of file +var _0xc5dc=['message','request\x20sent','result','catch','CreateChatMessage','ChatMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','socket.io-emitter','./chatMessage.socket','register','then','info','ChatMessage,\x20%s,\x20%s','stringify','error','code'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc5dc,0x128));var _0xcc5d=function(_0x52826e,_0x3812c4){_0x52826e=_0x52826e-0x0;var _0x3fecd9=_0xc5dc[_0x52826e];return _0x3fecd9;};'use strict';var _=require(_0xcc5d('0x0'));var util=require(_0xcc5d('0x1'));var moment=require(_0xcc5d('0x2'));var BPromise=require(_0xcc5d('0x3'));var rs=require(_0xcc5d('0x4'));var fs=require('fs');var Redis=require(_0xcc5d('0x5'));var db=require(_0xcc5d('0x6'))['db'];var utils=require(_0xcc5d('0x7'));var logger=require(_0xcc5d('0x8'))(_0xcc5d('0x9'));var config=require(_0xcc5d('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xcc5d('0xb')][_0xcc5d('0xc')]({'port':0x232a});config[_0xcc5d('0xd')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xcc5d('0xe'))(new Redis(config[_0xcc5d('0xd')]));require(_0xcc5d('0xf'))[_0xcc5d('0x10')](socket);function respondWithRpcPromise(_0x469175,_0x11998d,_0x1030e7){return new BPromise(function(_0x5b78e0,_0x532fc1){return client['request'](_0x469175,_0x1030e7)[_0xcc5d('0x11')](function(_0x7ded01){logger[_0xcc5d('0x12')](_0xcc5d('0x13'),_0x11998d,'request\x20sent');logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x11998d,'request\x20sent',JSON[_0xcc5d('0x14')](_0x7ded01));if(_0x7ded01[_0xcc5d('0x15')]){if(_0x7ded01['error'][_0xcc5d('0x16')]===0x1f4){logger[_0xcc5d('0x15')](_0xcc5d('0x13'),_0x11998d,_0x7ded01['error'][_0xcc5d('0x17')]);return _0x532fc1(_0x7ded01[_0xcc5d('0x15')]['message']);}logger[_0xcc5d('0x15')](_0xcc5d('0x13'),_0x11998d,_0x7ded01[_0xcc5d('0x15')]['message']);return _0x5b78e0(_0x7ded01['error'][_0xcc5d('0x17')]);}else{logger['info'](_0xcc5d('0x13'),_0x11998d,_0xcc5d('0x18'));_0x5b78e0(_0x7ded01[_0xcc5d('0x19')][_0xcc5d('0x17')]);}})[_0xcc5d('0x1a')](function(_0x3f4eea){logger[_0xcc5d('0x15')](_0xcc5d('0x13'),_0x11998d,_0x3f4eea);_0x532fc1(_0x3f4eea);});});}exports[_0xcc5d('0x1b')]=function(_0x306aeb){var _0x302203=this;return new Promise(function(_0x4f2d54,_0x154fea){return db[_0xcc5d('0x1c')]['create'](_0x306aeb['body'],{'raw':_0x306aeb['options']?_0x306aeb['options']['raw']===undefined?!![]:![]:!![]})[_0xcc5d('0x11')](function(_0x2b0ae3){logger['info'](_0xcc5d('0x1b'),_0x306aeb);logger['debug'](_0xcc5d('0x1b'),_0x306aeb,JSON[_0xcc5d('0x14')](_0x2b0ae3));_0x4f2d54(_0x2b0ae3);})[_0xcc5d('0x1a')](function(_0x3c107d){logger[_0xcc5d('0x15')](_0xcc5d('0x1b'),_0x3c107d[_0xcc5d('0x17')],_0x306aeb);_0x154fea(_0x302203[_0xcc5d('0x15')](0x1f4,_0x3c107d[_0xcc5d('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 07c8951..9dff581 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 _0x8ef6=['length','chatMessage:','./chatMessage.events','save','remove','update','removeListener','register'];(function(_0x90f100,_0x20511d){var _0x2076da=function(_0x15aa9c){while(--_0x15aa9c){_0x90f100['push'](_0x90f100['shift']());}};_0x2076da(++_0x20511d);}(_0x8ef6,0xf2));var _0x68ef=function(_0x588028,_0x34c872){_0x588028=_0x588028-0x0;var _0x551202=_0x8ef6[_0x588028];return _0x551202;};'use strict';var ChatMessageEvents=require(_0x68ef('0x0'));var events=[_0x68ef('0x1'),_0x68ef('0x2'),_0x68ef('0x3')];function createListener(_0x2cc97b,_0x44e0d3){return function(_0x3411a2){_0x44e0d3['emit'](_0x2cc97b,_0x3411a2);};}function removeListener(_0x27d0af,_0x129ce){return function(){ChatMessageEvents[_0x68ef('0x4')](_0x27d0af,_0x129ce);};}exports[_0x68ef('0x5')]=function(_0x4d26e3){for(var _0x4f77f3=0x0,_0x3c2ff3=events[_0x68ef('0x6')];_0x4f77f3<_0x3c2ff3;_0x4f77f3++){var _0x2de776=events[_0x4f77f3];var _0x4eb5eb=createListener(_0x68ef('0x7')+_0x2de776,_0x4d26e3);ChatMessageEvents['on'](_0x2de776,_0x4eb5eb);}}; \ No newline at end of file +var _0x2caf=['removeListener','register','length','chatMessage:','update','emit'];(function(_0x245545,_0x4983b3){var _0x106a5f=function(_0x278277){while(--_0x278277){_0x245545['push'](_0x245545['shift']());}};_0x106a5f(++_0x4983b3);}(_0x2caf,0x6a));var _0xf2ca=function(_0x10c139,_0x356b39){_0x10c139=_0x10c139-0x0;var _0x4dfd12=_0x2caf[_0x10c139];return _0x4dfd12;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=['save','remove',_0xf2ca('0x0')];function createListener(_0x53a64f,_0x3b2612){return function(_0x36e439){_0x3b2612[_0xf2ca('0x1')](_0x53a64f,_0x36e439);};}function removeListener(_0x375e8b,_0x137501){return function(){ChatMessageEvents[_0xf2ca('0x2')](_0x375e8b,_0x137501);};}exports[_0xf2ca('0x3')]=function(_0x51372a){for(var _0x8ce770=0x0,_0x4292b4=events[_0xf2ca('0x4')];_0x8ce770<_0x4292b4;_0x8ce770++){var _0x57e3e8=events[_0x8ce770];var _0x4ea38c=createListener(_0xf2ca('0x5')+_0x57e3e8,_0x51372a);ChatMessageEvents['on'](_0x57e3e8,_0x4ea38c);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 0255da4..fd34c22 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 _0x6e1d=['../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','post','tracked','chat','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x195eb3,_0x59180c){var _0x36ea03=function(_0x5f583d){while(--_0x5f583d){_0x195eb3['push'](_0x195eb3['shift']());}};_0x36ea03(++_0x59180c);}(_0x6e1d,0x132));var _0xd6e1=function(_0x355ce8,_0x5f1d0a){_0x355ce8=_0x355ce8-0x0;var _0x1db8b8=_0x6e1d[_0x355ce8];return _0x1db8b8;};'use strict';var multer=require(_0xd6e1('0x0'));var util=require(_0xd6e1('0x1'));var path=require('path');var timeout=require(_0xd6e1('0x2'));var express=require(_0xd6e1('0x3'));var router=express['Router']();var fs_extra=require(_0xd6e1('0x4'));var auth=require(_0xd6e1('0x5'));var interaction=require(_0xd6e1('0x6'));var config=require(_0xd6e1('0x7'));var controller=require('./chatMessage.controller');router[_0xd6e1('0x8')]('/',auth[_0xd6e1('0x9')](),controller['index']);router['get'](_0xd6e1('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xd6e1('0x8')](_0xd6e1('0xb'),auth['isAuthenticated'](),controller[_0xd6e1('0xc')]);router[_0xd6e1('0xd')]('/',auth[_0xd6e1('0x9')](),interaction[_0xd6e1('0xe')](_0xd6e1('0xf'),'chatmessage:create'),controller[_0xd6e1('0x10')]);router[_0xd6e1('0x11')](_0xd6e1('0xb'),controller[_0xd6e1('0x12')]);router[_0xd6e1('0x11')](_0xd6e1('0x13'),auth['isAuthenticated'](),controller[_0xd6e1('0x14')]);router[_0xd6e1('0x11')](_0xd6e1('0x15'),auth[_0xd6e1('0x9')](),controller[_0xd6e1('0x16')]);router[_0xd6e1('0x17')](_0xd6e1('0xb'),auth[_0xd6e1('0x9')](),controller[_0xd6e1('0x18')]);module[_0xd6e1('0x19')]=router; \ No newline at end of file +var _0x33e3=['fs-extra','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/:id','post','chat','chatmessage:create','update','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','Router'];(function(_0x25abad,_0x19f0a3){var _0x3f8903=function(_0x439e08){while(--_0x439e08){_0x25abad['push'](_0x25abad['shift']());}};_0x3f8903(++_0x19f0a3);}(_0x33e3,0x194));var _0x333e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x33e3[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x333e('0x0'));var util=require('util');var path=require(_0x333e('0x1'));var timeout=require(_0x333e('0x2'));var express=require('express');var router=express[_0x333e('0x3')]();var fs_extra=require(_0x333e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x333e('0x5'));var config=require(_0x333e('0x6'));var controller=require(_0x333e('0x7'));router[_0x333e('0x8')]('/',auth[_0x333e('0x9')](),controller[_0x333e('0xa')]);router[_0x333e('0x8')]('/describe',auth[_0x333e('0x9')](),controller['describe']);router[_0x333e('0x8')](_0x333e('0xb'),auth[_0x333e('0x9')](),controller['show']);router[_0x333e('0xc')]('/',auth[_0x333e('0x9')](),interaction['tracked'](_0x333e('0xd'),_0x333e('0xe')),controller['create']);router['put'](_0x333e('0xb'),controller[_0x333e('0xf')]);router[_0x333e('0x10')](_0x333e('0x11'),auth[_0x333e('0x9')](),controller[_0x333e('0x12')]);router['put'](_0x333e('0x13'),auth[_0x333e('0x9')](),controller[_0x333e('0x14')]);router[_0x333e('0x15')](_0x333e('0xb'),auth['isAuthenticated'](),controller[_0x333e('0x16')]);module[_0x333e('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 7472de0..8ab366c 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 _0x2032=['medium','exports','TEXT'];(function(_0x3ece4e,_0x3585fb){var _0x52decd=function(_0x1f78d5){while(--_0x1f78d5){_0x3ece4e['push'](_0x3ece4e['shift']());}};_0x52decd(++_0x3585fb);}(_0x2032,0xd9));var _0x2203=function(_0x304340,_0x1f9cb6){_0x304340=_0x304340-0x0;var _0x379f25=_0x2032[_0x304340];return _0x379f25;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'body':{'type':Sequelize[_0x2203('0x1')](_0x2203('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x2203('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0x757a=['exports','TEXT'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x757a,0xde));var _0xa757=function(_0x1f6404,_0x37e8b6){_0x1f6404=_0x1f6404-0x0;var _0x235f56=_0x757a[_0x1f6404];return _0x235f56;};'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 731d384..57ae78f 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(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x7a54,0x106));var _0x47a5=function(_0x1b322d,_0x1525dc){_0x1b322d=_0x1b322d-0x0;var _0x51ea67=_0x7a54[_0x1b322d];return _0x51ea67;};'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(_0x968120,_0x31a9ce){var _0x4925d0=function(_0x5d4834){while(--_0x5d4834){_0x968120['push'](_0x968120['shift']());}};_0x4925d0(++_0x31a9ce);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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 59f4ff1..e4bf32d 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 _0x0618=['setMaxListeners','save','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x38fa3f,_0x32e02d){var _0x351d29=function(_0x3bd49e){while(--_0x3bd49e){_0x38fa3f['push'](_0x38fa3f['shift']());}};_0x351d29(++_0x32e02d);}(_0x0618,0x1c6));var _0x8061=function(_0xa83097,_0x15f383){_0xa83097=_0xa83097-0x0;var _0x15fd69=_0x0618[_0xa83097];return _0x15fd69;};'use strict';var EventEmitter=require(_0x8061('0x0'));var ChatOfflineMessage=require(_0x8061('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x8061('0x2')](0x0);var events={'afterCreate':_0x8061('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x32ff20){return function(_0x6aff35,_0x382b13,_0x2683db){ChatOfflineMessageEvents[_0x8061('0x4')](_0x32ff20+':'+_0x6aff35['id'],_0x6aff35);ChatOfflineMessageEvents[_0x8061('0x4')](_0x32ff20,_0x6aff35);_0x2683db(null);};}for(var e in events){if(events[_0x8061('0x5')](e)){var event=events[e];ChatOfflineMessage[_0x8061('0x6')](e,emitEvent(event));}}module[_0x8061('0x7')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x39c7=['save','update','remove','hasOwnProperty','hook','../../mysqldb','ChatOfflineMessage','setMaxListeners'];(function(_0x3e4a34,_0x452723){var _0x2d2d2e=function(_0x1378ec){while(--_0x1378ec){_0x3e4a34['push'](_0x3e4a34['shift']());}};_0x2d2d2e(++_0x452723);}(_0x39c7,0x85));var _0x739c=function(_0x14ec1f,_0x59ef2f){_0x14ec1f=_0x14ec1f-0x0;var _0x5cecb3=_0x39c7[_0x14ec1f];return _0x5cecb3;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0x739c('0x0'))['db'][_0x739c('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x739c('0x2')](0x0);var events={'afterCreate':_0x739c('0x3'),'afterUpdate':_0x739c('0x4'),'afterDestroy':_0x739c('0x5')};function emitEvent(_0x48c547){return function(_0x11c0a6,_0xff8215,_0x43dd74){ChatOfflineMessageEvents['emit'](_0x48c547+':'+_0x11c0a6['id'],_0x11c0a6);ChatOfflineMessageEvents['emit'](_0x48c547,_0x11c0a6);_0x43dd74(null);};}for(var e in events){if(events[_0x739c('0x6')](e)){var event=events[e];ChatOfflineMessage[_0x739c('0x7')](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 4965371..8a2d7db 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 _0x9756=['ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9756,0x1c0));var _0x6975=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0x9756[_0x556927];return _0x5f1235;};'use strict';var attributes=require(_0x6975('0x0'));module[_0x6975('0x1')]=function(_0x2739be){return _0x2739be['define'](_0x6975('0x2'),attributes,{'tableName':_0x6975('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6975('0x4'),'collate':_0x6975('0x5')});}; \ No newline at end of file +var _0x0360=['./chatOfflineMessage.attributes','exports','ChatOfflineMessage','utf8mb4','utf8mb4_unicode_ci'];(function(_0x504f4a,_0x523da1){var _0x1b029f=function(_0x3f18a4){while(--_0x3f18a4){_0x504f4a['push'](_0x504f4a['shift']());}};_0x1b029f(++_0x523da1);}(_0x0360,0x15e));var _0x0036=function(_0xd9d48b,_0x5389be){_0xd9d48b=_0xd9d48b-0x0;var _0x44973c=_0x0360[_0xd9d48b];return _0x44973c;};'use strict';var attributes=require(_0x0036('0x0'));module[_0x0036('0x1')]=function(_0x356a41){return _0x356a41['define'](_0x0036('0x2'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0036('0x3'),'collate':_0x0036('0x4')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 55b04a2..06c3aa7 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 _0xc023=['client','http','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1cdf4e,_0x3ca200){var _0x223592=function(_0xe259e5){while(--_0xe259e5){_0x1cdf4e['push'](_0x1cdf4e['shift']());}};_0x223592(++_0x3ca200);}(_0xc023,0x162));var _0x3c02=function(_0x5bd431,_0x5bc0d0){_0x5bd431=_0x5bd431-0x0;var _0x263dd5=_0xc023[_0x5bd431];return _0x263dd5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3c02('0x0'));var BPromise=require(_0x3c02('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c02('0x2'))['db'];var utils=require(_0x3c02('0x3'));var logger=require(_0x3c02('0x4'))(_0x3c02('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3c02('0x6')][_0x3c02('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2675f2,_0x530fb5,_0x4cb4d5){return new BPromise(function(_0x3dd58f,_0x2dd82d){return client['request'](_0x2675f2,_0x4cb4d5)[_0x3c02('0x8')](function(_0x14f51e){logger[_0x3c02('0x9')](_0x3c02('0xa'),_0x530fb5,_0x3c02('0xb'));logger['debug'](_0x3c02('0xc'),_0x530fb5,_0x3c02('0xb'),JSON[_0x3c02('0xd')](_0x14f51e));if(_0x14f51e[_0x3c02('0xe')]){if(_0x14f51e[_0x3c02('0xe')][_0x3c02('0xf')]===0x1f4){logger[_0x3c02('0xe')]('ChatOfflineMessage,\x20%s,\x20%s',_0x530fb5,_0x14f51e['error'][_0x3c02('0x10')]);return _0x2dd82d(_0x14f51e['error'][_0x3c02('0x10')]);}logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x530fb5,_0x14f51e['error'][_0x3c02('0x10')]);return _0x3dd58f(_0x14f51e[_0x3c02('0xe')][_0x3c02('0x10')]);}else{logger['info'](_0x3c02('0xa'),_0x530fb5,_0x3c02('0xb'));_0x3dd58f(_0x14f51e['result'][_0x3c02('0x10')]);}})[_0x3c02('0x11')](function(_0x56f9b3){logger[_0x3c02('0xe')]('ChatOfflineMessage,\x20%s,\x20%s',_0x530fb5,_0x56f9b3);_0x2dd82d(_0x56f9b3);});});} \ No newline at end of file +var _0x55a8=['debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent'];(function(_0xab1898,_0x535f14){var _0x3a9c70=function(_0x57bb36){while(--_0x57bb36){_0xab1898['push'](_0xab1898['shift']());}};_0x3a9c70(++_0x535f14);}(_0x55a8,0x148));var _0x855a=function(_0x20af9d,_0x295b){_0x20af9d=_0x20af9d-0x0;var _0x292bf8=_0x55a8[_0x20af9d];return _0x292bf8;};'use strict';var _=require(_0x855a('0x0'));var util=require(_0x855a('0x1'));var moment=require(_0x855a('0x2'));var BPromise=require(_0x855a('0x3'));var rs=require(_0x855a('0x4'));var fs=require('fs');var Redis=require(_0x855a('0x5'));var db=require(_0x855a('0x6'))['db'];var utils=require(_0x855a('0x7'));var logger=require(_0x855a('0x8'))(_0x855a('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x855a('0xa')][_0x855a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c579b,_0x5908d6,_0x336987){return new BPromise(function(_0xd30379,_0x3a038b){return client[_0x855a('0xc')](_0x5c579b,_0x336987)[_0x855a('0xd')](function(_0x2b26a6){logger[_0x855a('0xe')](_0x855a('0xf'),_0x5908d6,_0x855a('0x10'));logger[_0x855a('0x11')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x5908d6,_0x855a('0x10'),JSON[_0x855a('0x12')](_0x2b26a6));if(_0x2b26a6['error']){if(_0x2b26a6[_0x855a('0x13')]['code']===0x1f4){logger[_0x855a('0x13')](_0x855a('0xf'),_0x5908d6,_0x2b26a6[_0x855a('0x13')][_0x855a('0x14')]);return _0x3a038b(_0x2b26a6[_0x855a('0x13')][_0x855a('0x14')]);}logger[_0x855a('0x13')](_0x855a('0xf'),_0x5908d6,_0x2b26a6[_0x855a('0x13')][_0x855a('0x14')]);return _0xd30379(_0x2b26a6[_0x855a('0x13')][_0x855a('0x14')]);}else{logger[_0x855a('0xe')](_0x855a('0xf'),_0x5908d6,_0x855a('0x10'));_0xd30379(_0x2b26a6[_0x855a('0x15')][_0x855a('0x14')]);}})[_0x855a('0x16')](function(_0x33d9cb){logger[_0x855a('0x13')](_0x855a('0xf'),_0x5908d6,_0x33d9cb);_0x3a038b(_0x33d9cb);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index b960b98..32b777c 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 _0x7640=['describe','/:id','show','post','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','index','get','/describe'];(function(_0x281ca5,_0x46f921){var _0x796a84=function(_0x50ebca){while(--_0x50ebca){_0x281ca5['push'](_0x281ca5['shift']());}};_0x796a84(++_0x46f921);}(_0x7640,0xe4));var _0x0764=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0x7640[_0xda464c];return _0x19e222;};'use strict';var multer=require(_0x0764('0x0'));var util=require('util');var path=require(_0x0764('0x1'));var timeout=require(_0x0764('0x2'));var express=require(_0x0764('0x3'));var router=express[_0x0764('0x4')]();var fs_extra=require(_0x0764('0x5'));var auth=require(_0x0764('0x6'));var interaction=require(_0x0764('0x7'));var config=require(_0x0764('0x8'));var controller=require(_0x0764('0x9'));router['get']('/',auth[_0x0764('0xa')](),controller[_0x0764('0xb')]);router[_0x0764('0xc')](_0x0764('0xd'),auth['isAuthenticated'](),controller[_0x0764('0xe')]);router[_0x0764('0xc')](_0x0764('0xf'),auth[_0x0764('0xa')](),controller[_0x0764('0x10')]);router[_0x0764('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0764('0x12')](_0x0764('0xf'),auth[_0x0764('0xa')](),controller[_0x0764('0x13')]);router[_0x0764('0x14')](_0x0764('0xf'),auth[_0x0764('0xa')](),controller['destroy']);module[_0x0764('0x15')]=router; \ No newline at end of file +var _0x5bc7=['isAuthenticated','show','post','create','put','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','/describe','describe','/:id'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x5bc7,0x125));var _0x75bc=function(_0x583aa4,_0x42ba7e){_0x583aa4=_0x583aa4-0x0;var _0x4f8b7e=_0x5bc7[_0x583aa4];return _0x4f8b7e;};'use strict';var multer=require(_0x75bc('0x0'));var util=require('util');var path=require(_0x75bc('0x1'));var timeout=require(_0x75bc('0x2'));var express=require(_0x75bc('0x3'));var router=express['Router']();var fs_extra=require(_0x75bc('0x4'));var auth=require(_0x75bc('0x5'));var interaction=require(_0x75bc('0x6'));var config=require('../../config/environment');var controller=require('./chatOfflineMessage.controller');router[_0x75bc('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x75bc('0x7')](_0x75bc('0x8'),auth['isAuthenticated'](),controller[_0x75bc('0x9')]);router['get'](_0x75bc('0xa'),auth[_0x75bc('0xb')](),controller[_0x75bc('0xc')]);router[_0x75bc('0xd')]('/',auth[_0x75bc('0xb')](),controller[_0x75bc('0xe')]);router[_0x75bc('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x75bc('0x10')]);router[_0x75bc('0x11')](_0x75bc('0xa'),auth[_0x75bc('0xb')](),controller['destroy']);module[_0x75bc('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 2f37027..c14cb0d 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 _0xe973=['INTEGER','sequelize','exports','STRING','ENUM','mouseOver'];(function(_0x2cc594,_0x4d727b){var _0x4abff7=function(_0x22b01d){while(--_0x22b01d){_0x2cc594['push'](_0x2cc594['shift']());}};_0x4abff7(++_0x4d727b);}(_0xe973,0x73));var _0x3e97=function(_0x5a36df,_0x3b781f){_0x5a36df=_0x5a36df-0x0;var _0x504577=_0xe973[_0x5a36df];return _0x504577;};'use strict';var Sequelize=require(_0x3e97('0x0'));module[_0x3e97('0x1')]={'name':{'type':Sequelize[_0x3e97('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x3e97('0x3')](_0x3e97('0x4'),'timeout'),'defaultValue':_0x3e97('0x4')},'selector':{'type':Sequelize[_0x3e97('0x2')]},'timeout':{'type':Sequelize[_0x3e97('0x5')]}}; \ No newline at end of file +var _0xec46=['exports','STRING','ENUM','INTEGER','sequelize'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0xec46,0xf4));var _0x6ec4=function(_0x2f5a22,_0x5e9f03){_0x2f5a22=_0x2f5a22-0x0;var _0x326b70=_0xec46[_0x2f5a22];return _0x326b70;};'use strict';var Sequelize=require(_0x6ec4('0x0'));module[_0x6ec4('0x1')]={'name':{'type':Sequelize[_0x6ec4('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x6ec4('0x3')]('mouseOver','timeout'),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x6ec4('0x2')]},'timeout':{'type':Sequelize[_0x6ec4('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index adead08..4e358f1 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 _0x7da7=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','json','apply','reject','update','then','destroy','end','error','stack','name','send','show','params','model','keys','ChatProactiveAction','query','filters','intersection','attributes','fields','include','merge','options','find','create','catch','body','eml-format','rimraf','zip-dir','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0x29655f,_0x35c443){var _0x253f8d=function(_0x2d3da0){while(--_0x2d3da0){_0x29655f['push'](_0x29655f['shift']());}};_0x253f8d(++_0x35c443);}(_0x7da7,0x10d));var _0x77da=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x7da7[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0x77da('0x0'));var rimraf=require(_0x77da('0x1'));var zipdir=require(_0x77da('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x77da('0x3'));var BPromise=require(_0x77da('0x4'));var Mustache=require('mustache');var util=require(_0x77da('0x5'));var path=require(_0x77da('0x6'));var sox=require('sox');var csv=require(_0x77da('0x7'));var ejs=require(_0x77da('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x77da('0x9'));var squel=require('squel');var crypto=require(_0x77da('0xa'));var jsforce=require(_0x77da('0xb'));var deskjs=require(_0x77da('0xc'));var toCsv=require(_0x77da('0x7'));var querystring=require(_0x77da('0xd'));var Papa=require('papaparse');var Redis=require(_0x77da('0xe'));var authService=require(_0x77da('0xf'));var qs=require(_0x77da('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x77da('0x11'));var logger=require(_0x77da('0x12'))(_0x77da('0x13'));var utils=require(_0x77da('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x77da('0x15'));var db=require(_0x77da('0x16'))['db'];function respondWithStatusCode(_0x2acc65,_0x5d6e2f){_0x5d6e2f=_0x5d6e2f||0xcc;return function(_0x4a7748){if(_0x4a7748){return _0x2acc65[_0x77da('0x17')](_0x5d6e2f);}return _0x2acc65[_0x77da('0x18')](_0x5d6e2f)['end']();};}function respondWithResult(_0x3b0ff2,_0x369df0){_0x369df0=_0x369df0||0xc8;return function(_0x355719){if(_0x355719){return _0x3b0ff2[_0x77da('0x18')](_0x369df0)['json'](_0x355719);}};}function respondWithFilteredResult(_0x2172d0,_0x4e130c){return function(_0x29cd7b){if(_0x29cd7b){var _0x366443=typeof _0x4e130c[_0x77da('0x19')]===_0x77da('0x1a')&&typeof _0x4e130c['limit']==='undefined';var _0x514016=_0x29cd7b['count'];var _0x103e46=_0x366443?0x0:_0x4e130c[_0x77da('0x19')];var _0x289887=_0x366443?_0x29cd7b[_0x77da('0x1b')]:_0x4e130c[_0x77da('0x19')]+_0x4e130c[_0x77da('0x1c')];var _0x1d325c;if(_0x289887>=_0x514016){_0x289887=_0x514016;_0x1d325c=0xc8;}else{_0x1d325c=0xce;}_0x2172d0[_0x77da('0x18')](_0x1d325c);return _0x2172d0['set']('Content-Range',_0x103e46+'-'+_0x289887+'/'+_0x514016)[_0x77da('0x1d')](_0x29cd7b);}return null;};}function patchUpdates(_0x4d1512){return function(_0x507979){try{jsonpatch[_0x77da('0x1e')](_0x507979,_0x4d1512,!![]);}catch(_0x304a2b){return BPromise[_0x77da('0x1f')](_0x304a2b);}return _0x507979['save']();};}function saveUpdates(_0x58270c,_0x3e6cfe){return function(_0x58f6c1){if(_0x58f6c1){return _0x58f6c1[_0x77da('0x20')](_0x58270c)[_0x77da('0x21')](function(_0xc52f0e){return _0xc52f0e;});}return null;};}function removeEntity(_0x27b6c7,_0x10399a){return function(_0x270318){if(_0x270318){return _0x270318[_0x77da('0x22')]()['then'](function(){_0x27b6c7['status'](0xcc)[_0x77da('0x23')]();});}};}function handleEntityNotFound(_0x2d009f,_0x835167){return function(_0xbd06b7){if(!_0xbd06b7){_0x2d009f['sendStatus'](0x194);}return _0xbd06b7;};}function handleError(_0x42240b,_0x167240){_0x167240=_0x167240||0x1f4;return function(_0x470c9f){logger[_0x77da('0x24')](_0x470c9f[_0x77da('0x25')]);if(_0x470c9f['name']){delete _0x470c9f[_0x77da('0x26')];}_0x42240b[_0x77da('0x18')](_0x167240)[_0x77da('0x27')](_0x470c9f);};}exports[_0x77da('0x28')]=function(_0x496ecd,_0x5b4638){var _0x4d395a={'raw':!![],'where':{'id':_0x496ecd[_0x77da('0x29')]['id']}},_0x2258e9={};_0x2258e9[_0x77da('0x2a')]=_[_0x77da('0x2b')](db[_0x77da('0x2c')]['rawAttributes']);_0x2258e9[_0x77da('0x2d')]=_[_0x77da('0x2b')](_0x496ecd[_0x77da('0x2d')]);_0x2258e9[_0x77da('0x2e')]=_[_0x77da('0x2f')](_0x2258e9[_0x77da('0x2a')],_0x2258e9['query']);_0x4d395a[_0x77da('0x30')]=_[_0x77da('0x2f')](_0x2258e9[_0x77da('0x2a')],qs[_0x77da('0x31')](_0x496ecd[_0x77da('0x2d')][_0x77da('0x31')]));_0x4d395a[_0x77da('0x30')]=_0x4d395a[_0x77da('0x30')]['length']?_0x4d395a['attributes']:_0x2258e9[_0x77da('0x2a')];if(_0x496ecd[_0x77da('0x2d')]['includeAll']){_0x4d395a[_0x77da('0x32')]=[{'all':!![]}];}_0x4d395a=_[_0x77da('0x33')]({},_0x4d395a,_0x496ecd[_0x77da('0x34')]);return db[_0x77da('0x2c')][_0x77da('0x35')](_0x4d395a)[_0x77da('0x21')](handleEntityNotFound(_0x5b4638,null))[_0x77da('0x21')](respondWithResult(_0x5b4638,null))['catch'](handleError(_0x5b4638,null));};exports[_0x77da('0x36')]=function(_0x4df4b9,_0x54b7f2){return db['ChatProactiveAction'][_0x77da('0x36')](_0x4df4b9['body'],{})[_0x77da('0x21')](respondWithResult(_0x54b7f2,0xc9))[_0x77da('0x37')](handleError(_0x54b7f2,null));};exports[_0x77da('0x20')]=function(_0x3cc78b,_0x3c46d2){if(_0x3cc78b[_0x77da('0x38')]['id']){delete _0x3cc78b[_0x77da('0x38')]['id'];}return db['ChatProactiveAction'][_0x77da('0x35')]({'where':{'id':_0x3cc78b[_0x77da('0x29')]['id']}})[_0x77da('0x21')](handleEntityNotFound(_0x3c46d2,null))[_0x77da('0x21')](saveUpdates(_0x3cc78b[_0x77da('0x38')],null))[_0x77da('0x21')](respondWithResult(_0x3c46d2,null))['catch'](handleError(_0x3c46d2,null));};exports[_0x77da('0x22')]=function(_0x16a0e0,_0x2cd190){return db['ChatProactiveAction'][_0x77da('0x35')]({'where':{'id':_0x16a0e0['params']['id']}})['then'](handleEntityNotFound(_0x2cd190,null))['then'](removeEntity(_0x2cd190,null))['catch'](handleError(_0x2cd190,null));}; \ No newline at end of file +var _0x83d3=['bluebird','mustache','util','path','to-csv','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','then','destroy','error','name','show','params','keys','query','intersection','model','attributes','fields','length','includeAll','merge','ChatProactiveAction','find','create','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x28c8cb,_0x5895e1){var _0x365af1=function(_0x12b9bd){while(--_0x12b9bd){_0x28c8cb['push'](_0x28c8cb['shift']());}};_0x365af1(++_0x5895e1);}(_0x83d3,0x17c));var _0x383d=function(_0x36da00,_0x5b533b){_0x36da00=_0x36da00-0x0;var _0x4b72c5=_0x83d3[_0x36da00];return _0x4b72c5;};'use strict';var emlformat=require(_0x383d('0x0'));var rimraf=require(_0x383d('0x1'));var zipdir=require(_0x383d('0x2'));var jsonpatch=require(_0x383d('0x3'));var rp=require(_0x383d('0x4'));var moment=require('moment');var BPromise=require(_0x383d('0x5'));var Mustache=require(_0x383d('0x6'));var util=require(_0x383d('0x7'));var path=require(_0x383d('0x8'));var sox=require('sox');var csv=require(_0x383d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x383d('0xa'));var squel=require(_0x383d('0xb'));var crypto=require(_0x383d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x383d('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x383d('0xe'));var Redis=require(_0x383d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x383d('0x10'));var as=require(_0x383d('0x11'));var hardwareService=require(_0x383d('0x12'));var logger=require(_0x383d('0x13'))(_0x383d('0x14'));var utils=require(_0x383d('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15e7cf,_0x538c32){_0x538c32=_0x538c32||0xcc;return function(_0x3d5b63){if(_0x3d5b63){return _0x15e7cf[_0x383d('0x16')](_0x538c32);}return _0x15e7cf[_0x383d('0x17')](_0x538c32)[_0x383d('0x18')]();};}function respondWithResult(_0x4c6d4f,_0x556fee){_0x556fee=_0x556fee||0xc8;return function(_0x3999d7){if(_0x3999d7){return _0x4c6d4f['status'](_0x556fee)[_0x383d('0x19')](_0x3999d7);}};}function respondWithFilteredResult(_0x5afc53,_0x531e18){return function(_0x294423){if(_0x294423){var _0x31abf5=typeof _0x531e18['offset']==='undefined'&&typeof _0x531e18[_0x383d('0x1a')]===_0x383d('0x1b');var _0x5be3d7=_0x294423[_0x383d('0x1c')];var _0x18dc97=_0x31abf5?0x0:_0x531e18[_0x383d('0x1d')];var _0xc7868=_0x31abf5?_0x294423[_0x383d('0x1c')]:_0x531e18[_0x383d('0x1d')]+_0x531e18[_0x383d('0x1a')];var _0x55fb74;if(_0xc7868>=_0x5be3d7){_0xc7868=_0x5be3d7;_0x55fb74=0xc8;}else{_0x55fb74=0xce;}_0x5afc53[_0x383d('0x17')](_0x55fb74);return _0x5afc53[_0x383d('0x1e')](_0x383d('0x1f'),_0x18dc97+'-'+_0xc7868+'/'+_0x5be3d7)[_0x383d('0x19')](_0x294423);}return null;};}function patchUpdates(_0x2043e5){return function(_0x45ee85){try{jsonpatch[_0x383d('0x20')](_0x45ee85,_0x2043e5,!![]);}catch(_0x562a28){return BPromise['reject'](_0x562a28);}return _0x45ee85[_0x383d('0x21')]();};}function saveUpdates(_0x28b880,_0x4e3d9e){return function(_0x17d883){if(_0x17d883){return _0x17d883[_0x383d('0x22')](_0x28b880)[_0x383d('0x23')](function(_0x45d1a1){return _0x45d1a1;});}return null;};}function removeEntity(_0x3e36a2,_0x376ea7){return function(_0xcbedc9){if(_0xcbedc9){return _0xcbedc9[_0x383d('0x24')]()[_0x383d('0x23')](function(){_0x3e36a2[_0x383d('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x599756,_0x1d5a10){return function(_0x1e5a7f){if(!_0x1e5a7f){_0x599756[_0x383d('0x16')](0x194);}return _0x1e5a7f;};}function handleError(_0x70fdba,_0x267643){_0x267643=_0x267643||0x1f4;return function(_0x1d553b){logger[_0x383d('0x25')](_0x1d553b['stack']);if(_0x1d553b[_0x383d('0x26')]){delete _0x1d553b[_0x383d('0x26')];}_0x70fdba['status'](_0x267643)['send'](_0x1d553b);};}exports[_0x383d('0x27')]=function(_0x3f86e2,_0x13f872){var _0xbe4a1f={'raw':!![],'where':{'id':_0x3f86e2[_0x383d('0x28')]['id']}},_0x202853={};_0x202853['model']=_[_0x383d('0x29')](db['ChatProactiveAction']['rawAttributes']);_0x202853[_0x383d('0x2a')]=_[_0x383d('0x29')](_0x3f86e2[_0x383d('0x2a')]);_0x202853['filters']=_[_0x383d('0x2b')](_0x202853[_0x383d('0x2c')],_0x202853['query']);_0xbe4a1f[_0x383d('0x2d')]=_[_0x383d('0x2b')](_0x202853['model'],qs[_0x383d('0x2e')](_0x3f86e2['query'][_0x383d('0x2e')]));_0xbe4a1f[_0x383d('0x2d')]=_0xbe4a1f['attributes'][_0x383d('0x2f')]?_0xbe4a1f['attributes']:_0x202853[_0x383d('0x2c')];if(_0x3f86e2['query'][_0x383d('0x30')]){_0xbe4a1f['include']=[{'all':!![]}];}_0xbe4a1f=_[_0x383d('0x31')]({},_0xbe4a1f,_0x3f86e2['options']);return db[_0x383d('0x32')][_0x383d('0x33')](_0xbe4a1f)[_0x383d('0x23')](handleEntityNotFound(_0x13f872,null))[_0x383d('0x23')](respondWithResult(_0x13f872,null))['catch'](handleError(_0x13f872,null));};exports[_0x383d('0x34')]=function(_0x5379cc,_0x23aeb4){return db[_0x383d('0x32')][_0x383d('0x34')](_0x5379cc[_0x383d('0x35')],{})[_0x383d('0x23')](respondWithResult(_0x23aeb4,0xc9))[_0x383d('0x36')](handleError(_0x23aeb4,null));};exports['update']=function(_0x386f89,_0x5cc6c4){if(_0x386f89[_0x383d('0x35')]['id']){delete _0x386f89['body']['id'];}return db[_0x383d('0x32')][_0x383d('0x33')]({'where':{'id':_0x386f89[_0x383d('0x28')]['id']}})['then'](handleEntityNotFound(_0x5cc6c4,null))[_0x383d('0x23')](saveUpdates(_0x386f89[_0x383d('0x35')],null))[_0x383d('0x23')](respondWithResult(_0x5cc6c4,null))['catch'](handleError(_0x5cc6c4,null));};exports[_0x383d('0x24')]=function(_0x51aa4c,_0x38f783){return db[_0x383d('0x32')]['find']({'where':{'id':_0x51aa4c['params']['id']}})[_0x383d('0x23')](handleEntityNotFound(_0x38f783,null))[_0x383d('0x23')](removeEntity(_0x38f783,null))[_0x383d('0x36')](handleError(_0x38f783,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index dd72281..ce6a2d6 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 _0x3d52=['./chatProactiveAction.attributes','define','ChatProactiveAction','chat_proactive_actions','lodash','util','api','request-promise','path'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x3d52,0x16c));var _0x23d5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d52[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x23d5('0x0'));var util=require(_0x23d5('0x1'));var logger=require('../../config/logger')(_0x23d5('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x23d5('0x3'));var fs=require('fs');var path=require(_0x23d5('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x23d5('0x5'));module['exports']=function(_0x2adfce,_0x50bbf3){return _0x2adfce[_0x23d5('0x6')](_0x23d5('0x7'),attributes,{'tableName':_0x23d5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc491=['./chatProactiveAction.attributes','define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x95612a,_0x5e6fbc){var _0x38de09=function(_0xaaf990){while(--_0xaaf990){_0x95612a['push'](_0x95612a['shift']());}};_0x38de09(++_0x5e6fbc);}(_0xc491,0x1a8));var _0x1c49=function(_0x2c6810,_0x23c079){_0x2c6810=_0x2c6810-0x0;var _0x213881=_0xc491[_0x2c6810];return _0x213881;};'use strict';var _=require(_0x1c49('0x0'));var util=require(_0x1c49('0x1'));var logger=require(_0x1c49('0x2'))(_0x1c49('0x3'));var moment=require(_0x1c49('0x4'));var BPromise=require(_0x1c49('0x5'));var rp=require(_0x1c49('0x6'));var fs=require('fs');var path=require(_0x1c49('0x7'));var rimraf=require(_0x1c49('0x8'));var config=require(_0x1c49('0x9'));var attributes=require(_0x1c49('0xa'));module['exports']=function(_0x4dde76,_0x308f17){return _0x4dde76[_0x1c49('0xb')](_0x1c49('0xc'),attributes,{'tableName':_0x1c49('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 af1cd1e..fbb4663 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 _0x4ca3=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x4ca3,0x150));var _0x34ca=function(_0x2f32ae,_0x84ea81){_0x2f32ae=_0x2f32ae-0x0;var _0x23374c=_0x4ca3[_0x2f32ae];return _0x23374c;};'use strict';var _=require(_0x34ca('0x0'));var util=require(_0x34ca('0x1'));var moment=require(_0x34ca('0x2'));var BPromise=require(_0x34ca('0x3'));var rs=require(_0x34ca('0x4'));var fs=require('fs');var Redis=require(_0x34ca('0x5'));var db=require(_0x34ca('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x34ca('0x7'));var config=require(_0x34ca('0x8'));var jayson=require(_0x34ca('0x9'));var client=jayson[_0x34ca('0xa')][_0x34ca('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16f55e,_0x340f9d,_0x1434a8){return new BPromise(function(_0x1656ea,_0x1daf41){return client[_0x34ca('0xc')](_0x16f55e,_0x1434a8)[_0x34ca('0xd')](function(_0x2036c1){logger['info'](_0x34ca('0xe'),_0x340f9d,_0x34ca('0xf'));logger[_0x34ca('0x10')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x340f9d,_0x34ca('0xf'),JSON[_0x34ca('0x11')](_0x2036c1));if(_0x2036c1[_0x34ca('0x12')]){if(_0x2036c1[_0x34ca('0x12')][_0x34ca('0x13')]===0x1f4){logger['error'](_0x34ca('0xe'),_0x340f9d,_0x2036c1[_0x34ca('0x12')][_0x34ca('0x14')]);return _0x1daf41(_0x2036c1['error'][_0x34ca('0x14')]);}logger['error'](_0x34ca('0xe'),_0x340f9d,_0x2036c1[_0x34ca('0x12')]['message']);return _0x1656ea(_0x2036c1['error'][_0x34ca('0x14')]);}else{logger[_0x34ca('0x15')](_0x34ca('0xe'),_0x340f9d,_0x34ca('0xf'));_0x1656ea(_0x2036c1[_0x34ca('0x16')][_0x34ca('0x14')]);}})[_0x34ca('0x17')](function(_0x29c1b3){logger[_0x34ca('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x340f9d,_0x29c1b3);_0x1daf41(_0x29c1b3);});});} \ No newline at end of file +var _0xf8d2=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x274d4b,_0x128681){var _0x1a1f03=function(_0x420675){while(--_0x420675){_0x274d4b['push'](_0x274d4b['shift']());}};_0x1a1f03(++_0x128681);}(_0xf8d2,0x162));var _0x2f8d=function(_0x3f0a7c,_0x16edda){_0x3f0a7c=_0x3f0a7c-0x0;var _0x2b3a28=_0xf8d2[_0x3f0a7c];return _0x2b3a28;};'use strict';var _=require(_0x2f8d('0x0'));var util=require(_0x2f8d('0x1'));var moment=require(_0x2f8d('0x2'));var BPromise=require(_0x2f8d('0x3'));var rs=require(_0x2f8d('0x4'));var fs=require('fs');var Redis=require(_0x2f8d('0x5'));var db=require(_0x2f8d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2f8d('0x7'))(_0x2f8d('0x8'));var config=require(_0x2f8d('0x9'));var jayson=require(_0x2f8d('0xa'));var client=jayson['client'][_0x2f8d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52f9fc,_0x4705b6,_0x2bd0b1){return new BPromise(function(_0x409128,_0x4108b1){return client[_0x2f8d('0xc')](_0x52f9fc,_0x2bd0b1)[_0x2f8d('0xd')](function(_0x10a487){logger[_0x2f8d('0xe')](_0x2f8d('0xf'),_0x4705b6,_0x2f8d('0x10'));logger[_0x2f8d('0x11')](_0x2f8d('0x12'),_0x4705b6,_0x2f8d('0x10'),JSON[_0x2f8d('0x13')](_0x10a487));if(_0x10a487[_0x2f8d('0x14')]){if(_0x10a487[_0x2f8d('0x14')][_0x2f8d('0x15')]===0x1f4){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x4705b6,_0x10a487[_0x2f8d('0x14')]['message']);return _0x4108b1(_0x10a487['error'][_0x2f8d('0x16')]);}logger[_0x2f8d('0x14')]('ChatProactiveAction,\x20%s,\x20%s',_0x4705b6,_0x10a487[_0x2f8d('0x14')]['message']);return _0x409128(_0x10a487[_0x2f8d('0x14')]['message']);}else{logger['info'](_0x2f8d('0xf'),_0x4705b6,_0x2f8d('0x10'));_0x409128(_0x10a487[_0x2f8d('0x17')][_0x2f8d('0x16')]);}})[_0x2f8d('0x18')](function(_0x516dd5){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x4705b6,_0x516dd5);_0x4108b1(_0x516dd5);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 24332e3..c0a4b95 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 _0x8d0e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','isAuthenticated','show','post','create','put','/:id','delete','multer','util','path','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x37eed1,_0x2bf10d){_0x37eed1=_0x37eed1-0x0;var _0x5157e9=_0x8d0e[_0x37eed1];return _0x5157e9;};'use strict';var multer=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var path=require(_0xe8d0('0x2'));var timeout=require(_0xe8d0('0x3'));var express=require(_0xe8d0('0x4'));var router=express[_0xe8d0('0x5')]();var fs_extra=require(_0xe8d0('0x6'));var auth=require(_0xe8d0('0x7'));var interaction=require(_0xe8d0('0x8'));var config=require('../../config/environment');var controller=require(_0xe8d0('0x9'));router['get']('/:id',auth[_0xe8d0('0xa')](),controller[_0xe8d0('0xb')]);router[_0xe8d0('0xc')]('/',auth[_0xe8d0('0xa')](),controller[_0xe8d0('0xd')]);router[_0xe8d0('0xe')](_0xe8d0('0xf'),auth[_0xe8d0('0xa')](),controller['update']);router[_0xe8d0('0x10')](_0xe8d0('0xf'),auth[_0xe8d0('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf494=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','create','put','update','delete','exports','multer','util'];(function(_0x52c30a,_0x40107d){var _0x33a05b=function(_0x404d55){while(--_0x404d55){_0x52c30a['push'](_0x52c30a['shift']());}};_0x33a05b(++_0x40107d);}(_0xf494,0x1c6));var _0x4f49=function(_0x326109,_0x2055e0){_0x326109=_0x326109-0x0;var _0x3302d4=_0xf494[_0x326109];return _0x3302d4;};'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')](_0x4f49('0xb'),auth[_0x4f49('0xc')](),controller[_0x4f49('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4f49('0xe')]);router[_0x4f49('0xf')](_0x4f49('0xb'),auth[_0x4f49('0xc')](),controller[_0x4f49('0x10')]);router[_0x4f49('0x11')](_0x4f49('0xb'),auth[_0x4f49('0xc')](),controller['destroy']);module[_0x4f49('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index eabf02b..861ca7d 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 _0xe482=['name','INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports','STRING'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0xe482,0xa5));var _0x2e48=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0xe482[_0x266618];return _0x54dbf5;};'use strict';var Sequelize=require(_0x2e48('0x0'));module[_0x2e48('0x1')]={'name':{'type':Sequelize[_0x2e48('0x2')],'unique':_0x2e48('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2e48('0x2')]},'timeout':{'type':Sequelize[_0x2e48('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2e48('0x5')](_0x2e48('0x6'),'beepall',_0x2e48('0x7'))}}; \ No newline at end of file +var _0x57a3=['sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','roundrobin'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x57a3,0xc0));var _0x357a=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x57a3[_0x2dea24];return _0x309d58;};'use strict';var Sequelize=require(_0x357a('0x0'));module[_0x357a('0x1')]={'name':{'type':Sequelize[_0x357a('0x2')],'unique':_0x357a('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x357a('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x357a('0x5')](_0x357a('0x6'),'beepall',_0x357a('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index c5f9a17..c205ab0 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 _0xf92f=['defaults','localhost','./chatQueue.socket','register','sendStatus','status','offset','undefined','limit','count','set','json','update','then','destroy','get','ChatQueues','UserProfileResource','end','error','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','model','keys','intersection','fields','attributes','length','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','describe','getMembers','findOne','filters','hasOwnProperty','nolimit','order','sort','pick','ChatQueueId','filter','UserChatQueue','UserId','chatPause','updatedAt','%s/%s','createdAt','getTeams','Team','addTeams','ids','User','Agents','online','interface','flatMap','transaction','findOrCreate','forEach','userChatQueue:save','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','sequelize','QueryTypes','every','TeamId','includes','all','union','compact','removeAgents','emit','userChatQueue:remove','addAgents','spread','isArray','getAgents','bluebird','lodash','squel','ioredis','../../config/environment','../../mysqldb','redis'];(function(_0x44dc4c,_0x357e6a){var _0x4e644e=function(_0x2f033e){while(--_0x2f033e){_0x44dc4c['push'](_0x44dc4c['shift']());}};_0x4e644e(++_0x357e6a);}(_0xf92f,0xdf));var _0xff92=function(_0x11e1b2,_0x24d02c){_0x11e1b2=_0x11e1b2-0x0;var _0x2d6782=_0xf92f[_0x11e1b2];return _0x2d6782;};'use strict';var BPromise=require(_0xff92('0x0'));var util=require('util');var _=require(_0xff92('0x1'));var squel=require(_0xff92('0x2'));var Redis=require(_0xff92('0x3'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require(_0xff92('0x4'));var db=require(_0xff92('0x5'))['db'];config[_0xff92('0x6')]=_[_0xff92('0x7')](config['redis'],{'host':_0xff92('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xff92('0x6')]));require(_0xff92('0x9'))[_0xff92('0xa')](socket);function respondWithStatusCode(_0x53b9df,_0x4fcbc9){_0x4fcbc9=_0x4fcbc9||0xcc;return function(_0x1dd006){if(_0x1dd006){return _0x53b9df[_0xff92('0xb')](_0x4fcbc9);}return _0x53b9df[_0xff92('0xc')](_0x4fcbc9)['end']();};}function respondWithResult(_0x46b0fc,_0x4ba40b){_0x4ba40b=_0x4ba40b||0xc8;return function(_0x54577b){if(_0x54577b){return _0x46b0fc['status'](_0x4ba40b)['json'](_0x54577b);}};}function respondWithFilteredResult(_0x660daf,_0x2ce5b4){return function(_0x1551ae){if(_0x1551ae){var _0x398cf6=typeof _0x2ce5b4[_0xff92('0xd')]===_0xff92('0xe')&&typeof _0x2ce5b4[_0xff92('0xf')]==='undefined';var _0x46b3f=_0x1551ae[_0xff92('0x10')];var _0x3d8006=_0x398cf6?0x0:_0x2ce5b4['offset'];var _0x269c68=_0x398cf6?_0x1551ae[_0xff92('0x10')]:_0x2ce5b4[_0xff92('0xd')]+_0x2ce5b4[_0xff92('0xf')];var _0xeafb2;if(_0x269c68>=_0x46b3f){_0x269c68=_0x46b3f;_0xeafb2=0xc8;}else{_0xeafb2=0xce;}_0x660daf[_0xff92('0xc')](_0xeafb2);return _0x660daf[_0xff92('0x11')]('Content-Range',_0x3d8006+'-'+_0x269c68+'/'+_0x46b3f)[_0xff92('0x12')](_0x1551ae);}return null;};}function saveUpdates(_0x58b21a){return function(_0x5da68f){if(_0x5da68f){return _0x5da68f[_0xff92('0x13')](_0x58b21a)[_0xff92('0x14')](function(_0x50b770){return _0x50b770;});}return null;};}function removeEntity(_0x35ad2a){return function(_0x32e45a){if(_0x32e45a){return _0x32e45a[_0xff92('0x15')]()['then'](function(){var _0x558427=_0x32e45a[_0xff92('0x16')]({'plain':!![]});var _0x285f69=_0xff92('0x17');return db[_0xff92('0x18')]['destroy']({'where':{'type':_0x285f69,'resourceId':_0x558427['id']}})[_0xff92('0x14')](function(){return _0x32e45a;});})['then'](function(){_0x35ad2a['status'](0xcc)[_0xff92('0x19')]();});}};}function handleEntityNotFound(_0x53d1d5){return function(_0x5c7487){if(!_0x5c7487){_0x53d1d5[_0xff92('0xb')](0x194);}return _0x5c7487;};}function handleError(_0x24f6d7,_0x2c53bb){_0x2c53bb=_0x2c53bb||0x1f4;return function(_0xbcd1f4){logger[_0xff92('0x1a')](_0xbcd1f4[_0xff92('0x1b')]);if(_0xbcd1f4[_0xff92('0x1c')]){delete _0xbcd1f4[_0xff92('0x1c')];}_0x24f6d7[_0xff92('0xc')](_0x2c53bb)[_0xff92('0x1d')](_0xbcd1f4);};}exports[_0xff92('0x1e')]=function(_0x49dc1f,_0x1fbd78){var _0x40d5ec={};var _0x38c7a2={'count':0x0,'rows':[]};var _0x599dd5=_[_0xff92('0x1f')](db[_0xff92('0x20')][_0xff92('0x21')],function(_0x4893fc){return{'name':_0x4893fc[_0xff92('0x22')],'type':_0x4893fc[_0xff92('0x23')][_0xff92('0x24')]};});_0x40d5ec=qs[_0xff92('0x25')](_0x599dd5,_0x49dc1f);var _0x1df3f7={'where':_0x40d5ec[_0xff92('0x26')]};return db[_0xff92('0x20')][_0xff92('0x10')](_0x1df3f7)['then'](function(_0x39c308){_0x38c7a2[_0xff92('0x10')]=_0x39c308;_0x40d5ec[_0xff92('0x27')]=qs['include'](_0x49dc1f[_0xff92('0x28')]);return db['ChatQueue'][_0xff92('0x29')](_0x40d5ec);})['then'](function(_0x2c1bfb){_0x38c7a2[_0xff92('0x2a')]=_0x2c1bfb;return _0x38c7a2;})[_0xff92('0x14')](respondWithFilteredResult(_0x1fbd78,_0x40d5ec))[_0xff92('0x2b')](handleError(_0x1fbd78,null));};exports[_0xff92('0x2c')]=function(_0x3b5953,_0x467f65){var _0xab4e18={'raw':!![],'where':{'id':_0x3b5953[_0xff92('0x2d')]['id']}},_0x42f7f3={};_0x42f7f3[_0xff92('0x2e')]=_[_0xff92('0x2f')](db[_0xff92('0x20')][_0xff92('0x21')]);_0x42f7f3[_0xff92('0x28')]=_[_0xff92('0x2f')](_0x3b5953[_0xff92('0x28')]);_0x42f7f3['filters']=_[_0xff92('0x30')](_0x42f7f3[_0xff92('0x2e')],_0x42f7f3['query']);_0xab4e18['attributes']=_[_0xff92('0x30')](_0x42f7f3[_0xff92('0x2e')],qs[_0xff92('0x31')](_0x3b5953[_0xff92('0x28')][_0xff92('0x31')]));_0xab4e18[_0xff92('0x32')]=_0xab4e18[_0xff92('0x32')][_0xff92('0x33')]?_0xab4e18[_0xff92('0x32')]:_0x42f7f3[_0xff92('0x2e')];if(_0x3b5953['query']['includeAll']){_0xab4e18[_0xff92('0x27')]=[{'all':!![]}];}_0xab4e18=_[_0xff92('0x34')]({},_0xab4e18,_0x3b5953[_0xff92('0x35')]);return db[_0xff92('0x20')][_0xff92('0x36')](_0xab4e18)[_0xff92('0x14')](handleEntityNotFound(_0x467f65,null))[_0xff92('0x14')](respondWithResult(_0x467f65,null))[_0xff92('0x2b')](handleError(_0x467f65,null));};exports['create']=function(_0x373cd3,_0x435aed){return db[_0xff92('0x20')][_0xff92('0x37')](_0x373cd3[_0xff92('0x38')],{})[_0xff92('0x14')](function(_0x1187a1){var _0x3c33f9=_0x373cd3[_0xff92('0x39')][_0xff92('0x16')]({'plain':!![]});if(!_0x3c33f9)throw new Error(_0xff92('0x3a'));if(_0x3c33f9['role']===_0xff92('0x39')){var _0x4fa64d=_0x1187a1[_0xff92('0x16')]({'plain':!![]});var _0xc25d4e=_0xff92('0x17');return db[_0xff92('0x3b')][_0xff92('0x36')]({'where':{'name':_0xc25d4e,'userProfileId':_0x3c33f9[_0xff92('0x3c')]},'raw':!![]})[_0xff92('0x14')](function(_0x25fb46){if(_0x25fb46&&_0x25fb46[_0xff92('0x3d')]===0x0){return db[_0xff92('0x18')]['create']({'name':_0x4fa64d[_0xff92('0x1c')],'resourceId':_0x4fa64d['id'],'type':_0x25fb46[_0xff92('0x1c')],'sectionId':_0x25fb46['id']},{})[_0xff92('0x14')](function(){return _0x1187a1;});}else{return _0x1187a1;}})[_0xff92('0x2b')](function(_0x54cebf){logger[_0xff92('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x54cebf);throw _0x54cebf;});}return _0x1187a1;})[_0xff92('0x14')](respondWithResult(_0x435aed,0xc9))['catch'](handleError(_0x435aed,null));};exports[_0xff92('0x13')]=function(_0x509940,_0x45dbc5){if(_0x509940[_0xff92('0x38')]['id']){delete _0x509940[_0xff92('0x38')]['id'];}return db[_0xff92('0x20')][_0xff92('0x36')]({'where':{'id':_0x509940[_0xff92('0x2d')]['id']}})[_0xff92('0x14')](handleEntityNotFound(_0x45dbc5,null))['then'](saveUpdates(_0x509940['body'],null))[_0xff92('0x14')](respondWithResult(_0x45dbc5,null))['catch'](handleError(_0x45dbc5,null));};exports['destroy']=function(_0x3eee9e,_0x595abd){return db[_0xff92('0x20')][_0xff92('0x36')]({'where':{'id':_0x3eee9e[_0xff92('0x2d')]['id']}})[_0xff92('0x14')](handleEntityNotFound(_0x595abd,null))[_0xff92('0x14')](removeEntity(_0x595abd,null))['catch'](handleError(_0x595abd,null));};exports[_0xff92('0x3e')]=function(_0x4160b5,_0x7bcde6){return db[_0xff92('0x20')][_0xff92('0x3e')]()[_0xff92('0x14')](respondWithResult(_0x7bcde6,null))[_0xff92('0x2b')](handleError(_0x7bcde6,null));};exports[_0xff92('0x3f')]=function(_0x4780d0,_0x31f70b){var _0x26d292={'raw':!![],'where':{}},_0x446277={},_0x42800f;return db[_0xff92('0x20')][_0xff92('0x40')]({'where':{'id':_0x4780d0[_0xff92('0x2d')]['id']}})['then'](handleEntityNotFound(_0x31f70b,null))[_0xff92('0x14')](function(_0x8cd9c5){if(_0x8cd9c5){_0x42800f=_0x8cd9c5[_0xff92('0x16')]({'plain':!![]});_0x446277['model']=_[_0xff92('0x2f')](db['UserChatQueue'][_0xff92('0x21')]);_0x446277[_0xff92('0x28')]=_['keys'](_0x4780d0['query']);_0x446277[_0xff92('0x41')]=_[_0xff92('0x30')](_0x446277[_0xff92('0x2e')],_0x446277[_0xff92('0x28')]);_0x26d292[_0xff92('0x32')]=_['intersection'](_0x446277['model'],qs[_0xff92('0x31')](_0x4780d0['query'][_0xff92('0x31')]));_0x26d292[_0xff92('0x32')]=_0x26d292['attributes'][_0xff92('0x33')]?_0x26d292[_0xff92('0x32')]:_0x446277[_0xff92('0x2e')];if(!_0x4780d0['query'][_0xff92('0x42')](_0xff92('0x43'))){_0x26d292['limit']=qs[_0xff92('0xf')](_0x4780d0['query'][_0xff92('0xf')]);_0x26d292[_0xff92('0xd')]=qs[_0xff92('0xd')](_0x4780d0[_0xff92('0x28')][_0xff92('0xd')]);}_0x26d292[_0xff92('0x44')]=qs[_0xff92('0x45')](_0x4780d0[_0xff92('0x28')]['sort']);_0x26d292[_0xff92('0x26')]=qs['filters'](_[_0xff92('0x46')](_0x4780d0[_0xff92('0x28')],_0x446277[_0xff92('0x41')]));_0x26d292[_0xff92('0x26')][_0xff92('0x47')]=_0x8cd9c5['id'];if(_0x4780d0['query'][_0xff92('0x48')]){_0x26d292[_0xff92('0x26')]=_[_0xff92('0x34')](_0x26d292[_0xff92('0x26')],{'$or':_[_0xff92('0x1f')](_0x26d292[_0xff92('0x32')],function(_0x1510b3){var _0x59b4f0={};_0x59b4f0[_0x1510b3]={'$like':'%'+_0x4780d0[_0xff92('0x28')][_0xff92('0x48')]+'%'};return _0x59b4f0;})});}_0x26d292=_['merge']({},_0x26d292,_0x4780d0[_0xff92('0x35')]);return db[_0xff92('0x49')][_0xff92('0x29')](_0x26d292);}})[_0xff92('0x14')](function(_0x36e7ad){if(_0x36e7ad){return db['User']['findAndCountAll']({'where':{'id':_[_0xff92('0x1f')](_0x36e7ad,_0xff92('0x4a')),'role':'agent'},'attributes':['id',_0xff92('0x1c'),_0xff92('0x4b'),_0xff92('0x4c'),'createdAt']});}})[_0xff92('0x14')](function(_0x18a64a){if(_0x18a64a){return{'count':_0x18a64a[_0xff92('0x10')],'rows':_['map'](_0x18a64a[_0xff92('0x2a')],function(_0x1de085){return{'membername':_0x1de085['name'],'UserId':_0x1de085['id'],'queue_name':_0x42800f['name'],'ChatQueueId':_0x42800f['id'],'interface':util['format'](_0xff92('0x4d'),'SIP',_0x1de085[_0xff92('0x1c')]),'penalty':0x0,'paused':_0x1de085[_0xff92('0x4b')],'createdAt':_0x1de085[_0xff92('0x4e')],'updatedAt':_0x1de085[_0xff92('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xff92('0x14')](respondWithFilteredResult(_0x31f70b,_0x26d292))[_0xff92('0x2b')](handleError(_0x31f70b,null));};exports[_0xff92('0x4f')]=function(_0x23203a,_0x597489){var _0x2d3723={};var _0x2ae8f8={};var _0xb16e2;var _0x35e24c;return db[_0xff92('0x20')][_0xff92('0x40')]({'where':{'id':_0x23203a[_0xff92('0x2d')]['id']}})[_0xff92('0x14')](handleEntityNotFound(_0x597489,null))[_0xff92('0x14')](function(_0x987c52){if(_0x987c52){_0xb16e2=_0x987c52;_0x2ae8f8[_0xff92('0x2e')]=_[_0xff92('0x2f')](db[_0xff92('0x50')][_0xff92('0x21')]);_0x2ae8f8[_0xff92('0x28')]=_[_0xff92('0x2f')](_0x23203a[_0xff92('0x28')]);_0x2ae8f8[_0xff92('0x41')]=_[_0xff92('0x30')](_0x2ae8f8['model'],_0x2ae8f8[_0xff92('0x28')]);_0x2d3723[_0xff92('0x32')]=_[_0xff92('0x30')](_0x2ae8f8[_0xff92('0x2e')],qs['fields'](_0x23203a['query'][_0xff92('0x31')]));_0x2d3723[_0xff92('0x32')]=_0x2d3723[_0xff92('0x32')][_0xff92('0x33')]?_0x2d3723[_0xff92('0x32')]:_0x2ae8f8[_0xff92('0x2e')];_0x2d3723[_0xff92('0x44')]=qs[_0xff92('0x45')](_0x23203a[_0xff92('0x28')][_0xff92('0x45')]);_0x2d3723['where']=qs[_0xff92('0x41')](_[_0xff92('0x46')](_0x23203a[_0xff92('0x28')],_0x2ae8f8[_0xff92('0x41')]));if(_0x23203a['query'][_0xff92('0x48')]){_0x2d3723[_0xff92('0x26')]=_[_0xff92('0x34')](_0x2d3723[_0xff92('0x26')],{'$or':_[_0xff92('0x1f')](_0x2d3723[_0xff92('0x32')],function(_0x2cdc86){var _0x486de7={};_0x486de7[_0x2cdc86]={'$like':'%'+_0x23203a[_0xff92('0x28')]['filter']+'%'};return _0x486de7;})});}_0x2d3723=_[_0xff92('0x34')]({},_0x2d3723,_0x23203a[_0xff92('0x35')]);return _0xb16e2['getTeams'](_0x2d3723);}})['then'](function(_0x3f4b31){if(_0x3f4b31){_0x35e24c=_0x3f4b31['length'];if(!_0x23203a[_0xff92('0x28')][_0xff92('0x42')](_0xff92('0x43'))){_0x2d3723[_0xff92('0xf')]=qs['limit'](_0x23203a[_0xff92('0x28')][_0xff92('0xf')]);_0x2d3723[_0xff92('0xd')]=qs['offset'](_0x23203a[_0xff92('0x28')][_0xff92('0xd')]);}return _0xb16e2['getTeams'](_0x2d3723);}})[_0xff92('0x14')](function(_0x43a4a){if(_0x43a4a){return _0x43a4a?{'count':_0x35e24c,'rows':_0x43a4a}:null;}})[_0xff92('0x14')](respondWithResult(_0x597489,null))[_0xff92('0x2b')](handleError(_0x597489,null));};exports[_0xff92('0x51')]=function(_0xbd93a4,_0x153d60){var _0x41f718=_0xbd93a4[_0xff92('0x38')][_0xff92('0x52')];return db[_0xff92('0x50')]['findAll']({'where':{'id':_0x41f718},'attributes':['id'],'include':[{'model':db[_0xff92('0x53')],'as':_0xff92('0x54'),'attributes':['id',_0xff92('0x1c'),_0xff92('0x55'),'voicePause',_0xff92('0x56')],'raw':!![]}]})[_0xff92('0x14')](function(_0x3ba60a){if(_0x3ba60a){var _0x52fd2f=_[_0xff92('0x57')](_0x3ba60a,function(_0x1ab607){var _0x5d5727=_0x1ab607[_0xff92('0x16')]({'plain':!![]});return _0x5d5727['Agents'];});return db[_0xff92('0x20')][_0xff92('0x36')]({'where':{'id':_0xbd93a4[_0xff92('0x2d')]['id']}})['then'](function(_0x3da8cf){return db['sequelize'][_0xff92('0x58')](function(_0x410873){return _0x3da8cf[_0xff92('0x51')](_0x41f718,{'transaction':_0x410873})[_0xff92('0x14')](function(){return BPromise['each'](_0x52fd2f,function(_0x264730){return db[_0xff92('0x49')][_0xff92('0x59')]({'where':{'UserId':_0x264730['id'],'ChatQueueId':_0xbd93a4[_0xff92('0x2d')]['id']},'transaction':_0x410873});});})[_0xff92('0x14')](function(){_0x52fd2f[_0xff92('0x5a')](function(_0x543ade){socket['emit'](_0xff92('0x5b'),{'UserId':_0x543ade['id'],'ChatQueueId':_0x3da8cf['id']});});});});});}})[_0xff92('0x14')](respondWithStatusCode(_0x153d60,null))[_0xff92('0x2b')](handleError(_0x153d60,null));};exports['removeTeams']=function(_0x51d691,_0x91006){return db[_0xff92('0x50')][_0xff92('0x29')]({'where':{'id':_0x51d691['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xff92('0x53')],'as':_0xff92('0x54'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x91006,null))['then'](function(_0x4c52ed){var _0x5a3c60=_[_0xff92('0x1f')](_0x4c52ed,'id');var _0x5338c6=[];var _0x379f7e=[];var _0x2eb81a=squel['select']();_0x2eb81a[_0xff92('0x5c')](_0xff92('0x5d'))[_0xff92('0x5e')](_0xff92('0x5f'),'tq')[_0xff92('0x60')](_0xff92('0x61'),'ut',_0xff92('0x62'))[_0xff92('0x26')](_0xff92('0x63'),_0x51d691['params']['id']);for(var _0x1f2aaf=0x0;_0x1f2aaf<_0x4c52ed[_0xff92('0x33')];_0x1f2aaf+=0x1){let _0x227dd1=_0x4c52ed[_0x1f2aaf];for(var _0x8ae2e1=0x0;_0x8ae2e1<_0x227dd1[_0xff92('0x54')]['length'];_0x8ae2e1+=0x1){let _0x175a1e=_0x227dd1['Agents'][_0x8ae2e1];var _0xf6f2e=_0x2eb81a['clone']();_0xf6f2e[_0xff92('0x26')]('ut.UserId\x20=\x20?',_0x175a1e['id']);_0x379f7e['push'](db[_0xff92('0x64')][_0xff92('0x28')](_0xf6f2e['toString'](),{'type':db['sequelize'][_0xff92('0x65')]['SELECT']})['then'](function(_0xb394f2){if(_0xb394f2['length']===0x1){return _0x175a1e['id'];}else{var _0x4939cd=_[_0xff92('0x66')](_[_0xff92('0x1f')](_0xb394f2,_0xff92('0x67')),function(_0x12c776){return _[_0xff92('0x68')](_0x5a3c60,_0x12c776);});if(_0x4939cd){return _0x175a1e['id'];}}}));}}return BPromise[_0xff92('0x69')](_0x379f7e)[_0xff92('0x14')](function(_0x4db6f7){_0x5338c6=_(_0x5338c6)[_0xff92('0x6a')](_0x4db6f7)[_0xff92('0x6b')]()['value']();return db[_0xff92('0x20')][_0xff92('0x36')]({'where':{'id':_0x51d691[_0xff92('0x2d')]['id']}})[_0xff92('0x14')](function(_0x4963a1){return db[_0xff92('0x64')][_0xff92('0x58')](function(_0x1cfd4d){return _0x4963a1['removeTeams'](_0x51d691[_0xff92('0x28')][_0xff92('0x52')],{'transaction':_0x1cfd4d})['then'](function(){if(!_['isEmpty'](_0x5338c6)){return _0x4963a1[_0xff92('0x6c')](_0x5338c6,{'transaction':_0x1cfd4d});}})[_0xff92('0x14')](function(){_0x5338c6[_0xff92('0x5a')](function(_0x17bd78){socket[_0xff92('0x6d')](_0xff92('0x6e'),{'UserId':_0x17bd78,'ChatQueueId':_0x4963a1['id']});});});});});});})['then'](respondWithStatusCode(_0x91006,null))[_0xff92('0x2b')](handleError(_0x91006,null));};exports[_0xff92('0x6f')]=function(_0x25903e,_0x634f4f){return db[_0xff92('0x20')][_0xff92('0x36')]({'where':{'id':_0x25903e[_0xff92('0x2d')]['id']}})['then'](handleEntityNotFound(_0x634f4f,null))['then'](function(_0x4a7870){if(_0x4a7870){return _0x4a7870[_0xff92('0x6f')](_0x25903e[_0xff92('0x38')][_0xff92('0x52')],_['omit'](_0x25903e[_0xff92('0x38')],[_0xff92('0x52'),'id'])||{})[_0xff92('0x70')](function(_0x3ec1e1){for(var _0x55d155=0x0;_0x55d155<_0x25903e[_0xff92('0x38')][_0xff92('0x52')][_0xff92('0x33')];_0x55d155+=0x1){socket[_0xff92('0x6d')](_0xff92('0x5b'),{'UserId':Number(_0x25903e[_0xff92('0x38')][_0xff92('0x52')][_0x55d155]),'ChatQueueId':Number(_0x25903e[_0xff92('0x2d')]['id'])});}return _0x3ec1e1;});}})[_0xff92('0x14')](respondWithResult(_0x634f4f,null))['catch'](handleError(_0x634f4f,null));};exports['removeAgents']=function(_0x68baac,_0x5d21ab){return db[_0xff92('0x20')][_0xff92('0x36')]({'where':{'id':_0x68baac['params']['id']}})[_0xff92('0x14')](handleEntityNotFound(_0x5d21ab,null))[_0xff92('0x14')](function(_0x5b297f){if(_0x5b297f){return _0x5b297f[_0xff92('0x6c')](_0x68baac[_0xff92('0x28')]['ids'])[_0xff92('0x14')](function(){if(_[_0xff92('0x71')](_0x68baac[_0xff92('0x28')]['ids'])){for(var _0x5a498c=0x0;_0x5a498c<_0x68baac['query'][_0xff92('0x52')]['length'];_0x5a498c+=0x1){socket[_0xff92('0x6d')](_0xff92('0x6e'),{'UserId':Number(_0x68baac[_0xff92('0x28')]['ids'][_0x5a498c]),'ChatQueueId':Number(_0x68baac[_0xff92('0x2d')]['id'])});}}else{socket[_0xff92('0x6d')](_0xff92('0x6e'),{'UserId':Number(_0x68baac[_0xff92('0x28')][_0xff92('0x52')]),'ChatQueueId':Number(_0x68baac['params']['id'])});}});}})[_0xff92('0x14')](respondWithStatusCode(_0x5d21ab,null))[_0xff92('0x2b')](handleError(_0x5d21ab,null));};exports[_0xff92('0x72')]=function(_0x2c6fbf,_0x3e853d){var _0x55c39f={};var _0xfd12e6={};var _0x2fbed2;var _0x1d5fcf;return db[_0xff92('0x20')][_0xff92('0x40')]({'where':{'id':_0x2c6fbf[_0xff92('0x2d')]['id']}})[_0xff92('0x14')](handleEntityNotFound(_0x3e853d,null))['then'](function(_0x35ca81){if(_0x35ca81){_0x2fbed2=_0x35ca81;_0xfd12e6[_0xff92('0x2e')]=_[_0xff92('0x2f')](db[_0xff92('0x53')][_0xff92('0x21')]);_0xfd12e6[_0xff92('0x28')]=_['keys'](_0x2c6fbf['query']);_0xfd12e6[_0xff92('0x41')]=_[_0xff92('0x30')](_0xfd12e6[_0xff92('0x2e')],_0xfd12e6[_0xff92('0x28')]);_0x55c39f[_0xff92('0x32')]=_['intersection'](_0xfd12e6['model'],qs[_0xff92('0x31')](_0x2c6fbf[_0xff92('0x28')][_0xff92('0x31')]));_0x55c39f[_0xff92('0x32')]=_0x55c39f[_0xff92('0x32')][_0xff92('0x33')]?_0x55c39f[_0xff92('0x32')]:_0xfd12e6[_0xff92('0x2e')];_0x55c39f['order']=qs['sort'](_0x2c6fbf[_0xff92('0x28')]['sort']);_0x55c39f[_0xff92('0x26')]=qs[_0xff92('0x41')](_[_0xff92('0x46')](_0x2c6fbf[_0xff92('0x28')],_0xfd12e6[_0xff92('0x41')]));if(_0x2c6fbf[_0xff92('0x28')][_0xff92('0x48')]){_0x55c39f[_0xff92('0x26')]=_[_0xff92('0x34')](_0x55c39f[_0xff92('0x26')],{'$or':_[_0xff92('0x1f')](_0x55c39f[_0xff92('0x32')],function(_0x4c1b5f){var _0x57ef54={};_0x57ef54[_0x4c1b5f]={'$like':'%'+_0x2c6fbf[_0xff92('0x28')][_0xff92('0x48')]+'%'};return _0x57ef54;})});}_0x55c39f=_['merge']({},_0x55c39f,_0x2c6fbf[_0xff92('0x35')]);return _0x2fbed2[_0xff92('0x72')](_0x55c39f);}})[_0xff92('0x14')](function(_0x543f13){if(_0x543f13){_0x1d5fcf=_0x543f13[_0xff92('0x33')];if(!_0x2c6fbf[_0xff92('0x28')][_0xff92('0x42')](_0xff92('0x43'))){_0x55c39f[_0xff92('0xf')]=qs['limit'](_0x2c6fbf[_0xff92('0x28')][_0xff92('0xf')]);_0x55c39f['offset']=qs[_0xff92('0xd')](_0x2c6fbf[_0xff92('0x28')][_0xff92('0xd')]);}return _0x2fbed2[_0xff92('0x72')](_0x55c39f);}})[_0xff92('0x14')](function(_0x2447dc){if(_0x2447dc){return _0x2447dc?{'count':_0x1d5fcf,'rows':_0x2447dc}:null;}})['then'](respondWithResult(_0x3e853d,null))[_0xff92('0x2b')](handleError(_0x3e853d,null));}; \ No newline at end of file +var _0xa578=['chatPause','createdAt','getTeams','Team','length','sort','addTeams','User','online','voicePause','interface','flatMap','Agents','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','SELECT','every','includes','all','union','value','removeAgents','addAgents','omit','isArray','userChatQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','update','then','destroy','get','ChatQueues','UserProfileResource','error','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','key','getOptions','where','include','rows','catch','show','model','keys','filters','intersection','attributes','fields','query','merge','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','params','getMembers','findOne','UserChatQueue','hasOwnProperty','nolimit','order','pick','ChatQueueId','filter','findAll','findAndCountAll','agent','updatedAt','SIP'];(function(_0x3a7f15,_0x48ac0d){var _0x3b7ec9=function(_0x356ad3){while(--_0x356ad3){_0x3a7f15['push'](_0x3a7f15['shift']());}};_0x3b7ec9(++_0x48ac0d);}(_0xa578,0x19d));var _0x8a57=function(_0x47df4c,_0x55115e){_0x47df4c=_0x47df4c-0x0;var _0x3e3610=_0xa578[_0x47df4c];return _0x3e3610;};'use strict';var BPromise=require(_0x8a57('0x0'));var util=require(_0x8a57('0x1'));var _=require(_0x8a57('0x2'));var squel=require(_0x8a57('0x3'));var Redis=require(_0x8a57('0x4'));var qs=require(_0x8a57('0x5'));var logger=require('../../config/logger')('api');var config=require(_0x8a57('0x6'));var db=require(_0x8a57('0x7'))['db'];config[_0x8a57('0x8')]=_['defaults'](config['redis'],{'host':_0x8a57('0x9'),'port':0x18eb});var socket=require(_0x8a57('0xa'))(new Redis(config[_0x8a57('0x8')]));require('./chatQueue.socket')[_0x8a57('0xb')](socket);function respondWithStatusCode(_0x37d3ea,_0x123346){_0x123346=_0x123346||0xcc;return function(_0x4a7841){if(_0x4a7841){return _0x37d3ea[_0x8a57('0xc')](_0x123346);}return _0x37d3ea[_0x8a57('0xd')](_0x123346)[_0x8a57('0xe')]();};}function respondWithResult(_0xd8efb7,_0xe7623f){_0xe7623f=_0xe7623f||0xc8;return function(_0x1437d6){if(_0x1437d6){return _0xd8efb7[_0x8a57('0xd')](_0xe7623f)['json'](_0x1437d6);}};}function respondWithFilteredResult(_0x28d411,_0xe2b24f){return function(_0x326c7c){if(_0x326c7c){var _0x28c2e2=typeof _0xe2b24f[_0x8a57('0xf')]===_0x8a57('0x10')&&typeof _0xe2b24f[_0x8a57('0x11')]===_0x8a57('0x10');var _0x38ec1d=_0x326c7c[_0x8a57('0x12')];var _0x661cfb=_0x28c2e2?0x0:_0xe2b24f['offset'];var _0x31b5af=_0x28c2e2?_0x326c7c[_0x8a57('0x12')]:_0xe2b24f[_0x8a57('0xf')]+_0xe2b24f['limit'];var _0x3f91c9;if(_0x31b5af>=_0x38ec1d){_0x31b5af=_0x38ec1d;_0x3f91c9=0xc8;}else{_0x3f91c9=0xce;}_0x28d411[_0x8a57('0xd')](_0x3f91c9);return _0x28d411['set'](_0x8a57('0x13'),_0x661cfb+'-'+_0x31b5af+'/'+_0x38ec1d)[_0x8a57('0x14')](_0x326c7c);}return null;};}function saveUpdates(_0x13eb4f){return function(_0x1415f3){if(_0x1415f3){return _0x1415f3[_0x8a57('0x15')](_0x13eb4f)[_0x8a57('0x16')](function(_0x430191){return _0x430191;});}return null;};}function removeEntity(_0x4356a5){return function(_0x2a137c){if(_0x2a137c){return _0x2a137c[_0x8a57('0x17')]()[_0x8a57('0x16')](function(){var _0x52e899=_0x2a137c[_0x8a57('0x18')]({'plain':!![]});var _0xb409b4=_0x8a57('0x19');return db[_0x8a57('0x1a')]['destroy']({'where':{'type':_0xb409b4,'resourceId':_0x52e899['id']}})[_0x8a57('0x16')](function(){return _0x2a137c;});})[_0x8a57('0x16')](function(){_0x4356a5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x75c993){return function(_0x2b9f92){if(!_0x2b9f92){_0x75c993[_0x8a57('0xc')](0x194);}return _0x2b9f92;};}function handleError(_0x395588,_0x61eecb){_0x61eecb=_0x61eecb||0x1f4;return function(_0x18d8d5){logger[_0x8a57('0x1b')](_0x18d8d5[_0x8a57('0x1c')]);if(_0x18d8d5['name']){delete _0x18d8d5[_0x8a57('0x1d')];}_0x395588[_0x8a57('0xd')](_0x61eecb)[_0x8a57('0x1e')](_0x18d8d5);};}exports[_0x8a57('0x1f')]=function(_0x3313fb,_0x3fe7b4){var _0x1d7c6e={};var _0x3c7a99={'count':0x0,'rows':[]};var _0x6c35de=_[_0x8a57('0x20')](db[_0x8a57('0x21')][_0x8a57('0x22')],function(_0x5b5b38){return{'name':_0x5b5b38[_0x8a57('0x23')],'type':_0x5b5b38['type'][_0x8a57('0x24')]};});_0x1d7c6e=qs[_0x8a57('0x25')](_0x6c35de,_0x3313fb);var _0x51a971={'where':_0x1d7c6e[_0x8a57('0x26')]};return db[_0x8a57('0x21')][_0x8a57('0x12')](_0x51a971)[_0x8a57('0x16')](function(_0x2750e1){_0x3c7a99[_0x8a57('0x12')]=_0x2750e1;_0x1d7c6e[_0x8a57('0x27')]=qs['include'](_0x3313fb['query']);return db[_0x8a57('0x21')]['findAll'](_0x1d7c6e);})[_0x8a57('0x16')](function(_0x4e63e8){_0x3c7a99[_0x8a57('0x28')]=_0x4e63e8;return _0x3c7a99;})[_0x8a57('0x16')](respondWithFilteredResult(_0x3fe7b4,_0x1d7c6e))[_0x8a57('0x29')](handleError(_0x3fe7b4,null));};exports[_0x8a57('0x2a')]=function(_0xab4948,_0x454f79){var _0x1d9f65={'raw':!![],'where':{'id':_0xab4948['params']['id']}},_0x38f081={};_0x38f081[_0x8a57('0x2b')]=_['keys'](db[_0x8a57('0x21')][_0x8a57('0x22')]);_0x38f081['query']=_[_0x8a57('0x2c')](_0xab4948['query']);_0x38f081[_0x8a57('0x2d')]=_[_0x8a57('0x2e')](_0x38f081['model'],_0x38f081['query']);_0x1d9f65[_0x8a57('0x2f')]=_['intersection'](_0x38f081[_0x8a57('0x2b')],qs[_0x8a57('0x30')](_0xab4948['query']['fields']));_0x1d9f65['attributes']=_0x1d9f65[_0x8a57('0x2f')]['length']?_0x1d9f65['attributes']:_0x38f081['model'];if(_0xab4948[_0x8a57('0x31')]['includeAll']){_0x1d9f65[_0x8a57('0x27')]=[{'all':!![]}];}_0x1d9f65=_[_0x8a57('0x32')]({},_0x1d9f65,_0xab4948[_0x8a57('0x33')]);return db[_0x8a57('0x21')][_0x8a57('0x34')](_0x1d9f65)[_0x8a57('0x16')](handleEntityNotFound(_0x454f79,null))[_0x8a57('0x16')](respondWithResult(_0x454f79,null))['catch'](handleError(_0x454f79,null));};exports[_0x8a57('0x35')]=function(_0x21d01b,_0x4fec2b){return db[_0x8a57('0x21')][_0x8a57('0x35')](_0x21d01b[_0x8a57('0x36')],{})[_0x8a57('0x16')](function(_0x5d2256){var _0x316d6a=_0x21d01b[_0x8a57('0x37')]['get']({'plain':!![]});if(!_0x316d6a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x316d6a[_0x8a57('0x38')]===_0x8a57('0x37')){var _0x17ad4d=_0x5d2256[_0x8a57('0x18')]({'plain':!![]});var _0x1b805e=_0x8a57('0x19');return db[_0x8a57('0x39')]['find']({'where':{'name':_0x1b805e,'userProfileId':_0x316d6a[_0x8a57('0x3a')]},'raw':!![]})[_0x8a57('0x16')](function(_0x52e9d1){if(_0x52e9d1&&_0x52e9d1[_0x8a57('0x3b')]===0x0){return db[_0x8a57('0x1a')]['create']({'name':_0x17ad4d[_0x8a57('0x1d')],'resourceId':_0x17ad4d['id'],'type':_0x52e9d1[_0x8a57('0x1d')],'sectionId':_0x52e9d1['id']},{})[_0x8a57('0x16')](function(){return _0x5d2256;});}else{return _0x5d2256;}})['catch'](function(_0x26e0f5){logger[_0x8a57('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x26e0f5);throw _0x26e0f5;});}return _0x5d2256;})[_0x8a57('0x16')](respondWithResult(_0x4fec2b,0xc9))[_0x8a57('0x29')](handleError(_0x4fec2b,null));};exports[_0x8a57('0x15')]=function(_0x50ecfc,_0x24d555){if(_0x50ecfc[_0x8a57('0x36')]['id']){delete _0x50ecfc['body']['id'];}return db[_0x8a57('0x21')][_0x8a57('0x34')]({'where':{'id':_0x50ecfc[_0x8a57('0x3c')]['id']}})[_0x8a57('0x16')](handleEntityNotFound(_0x24d555,null))['then'](saveUpdates(_0x50ecfc[_0x8a57('0x36')],null))[_0x8a57('0x16')](respondWithResult(_0x24d555,null))[_0x8a57('0x29')](handleError(_0x24d555,null));};exports['destroy']=function(_0x34f799,_0x4b5004){return db[_0x8a57('0x21')][_0x8a57('0x34')]({'where':{'id':_0x34f799[_0x8a57('0x3c')]['id']}})[_0x8a57('0x16')](handleEntityNotFound(_0x4b5004,null))[_0x8a57('0x16')](removeEntity(_0x4b5004,null))[_0x8a57('0x29')](handleError(_0x4b5004,null));};exports['describe']=function(_0x2b95fc,_0x5c2805){return db[_0x8a57('0x21')]['describe']()[_0x8a57('0x16')](respondWithResult(_0x5c2805,null))[_0x8a57('0x29')](handleError(_0x5c2805,null));};exports[_0x8a57('0x3d')]=function(_0x332abc,_0x21d62c){var _0xe0d270={'raw':!![],'where':{}},_0x28b472={},_0x27e44d;return db['ChatQueue'][_0x8a57('0x3e')]({'where':{'id':_0x332abc[_0x8a57('0x3c')]['id']}})[_0x8a57('0x16')](handleEntityNotFound(_0x21d62c,null))[_0x8a57('0x16')](function(_0x5921c8){if(_0x5921c8){_0x27e44d=_0x5921c8['get']({'plain':!![]});_0x28b472[_0x8a57('0x2b')]=_['keys'](db[_0x8a57('0x3f')][_0x8a57('0x22')]);_0x28b472[_0x8a57('0x31')]=_[_0x8a57('0x2c')](_0x332abc['query']);_0x28b472[_0x8a57('0x2d')]=_[_0x8a57('0x2e')](_0x28b472['model'],_0x28b472['query']);_0xe0d270['attributes']=_[_0x8a57('0x2e')](_0x28b472[_0x8a57('0x2b')],qs[_0x8a57('0x30')](_0x332abc[_0x8a57('0x31')]['fields']));_0xe0d270['attributes']=_0xe0d270[_0x8a57('0x2f')]['length']?_0xe0d270['attributes']:_0x28b472[_0x8a57('0x2b')];if(!_0x332abc[_0x8a57('0x31')][_0x8a57('0x40')](_0x8a57('0x41'))){_0xe0d270[_0x8a57('0x11')]=qs[_0x8a57('0x11')](_0x332abc[_0x8a57('0x31')][_0x8a57('0x11')]);_0xe0d270[_0x8a57('0xf')]=qs[_0x8a57('0xf')](_0x332abc[_0x8a57('0x31')][_0x8a57('0xf')]);}_0xe0d270[_0x8a57('0x42')]=qs['sort'](_0x332abc[_0x8a57('0x31')]['sort']);_0xe0d270[_0x8a57('0x26')]=qs[_0x8a57('0x2d')](_[_0x8a57('0x43')](_0x332abc[_0x8a57('0x31')],_0x28b472[_0x8a57('0x2d')]));_0xe0d270[_0x8a57('0x26')][_0x8a57('0x44')]=_0x5921c8['id'];if(_0x332abc['query'][_0x8a57('0x45')]){_0xe0d270['where']=_[_0x8a57('0x32')](_0xe0d270[_0x8a57('0x26')],{'$or':_['map'](_0xe0d270[_0x8a57('0x2f')],function(_0x27689b){var _0x3eacc1={};_0x3eacc1[_0x27689b]={'$like':'%'+_0x332abc['query'][_0x8a57('0x45')]+'%'};return _0x3eacc1;})});}_0xe0d270=_['merge']({},_0xe0d270,_0x332abc[_0x8a57('0x33')]);return db[_0x8a57('0x3f')][_0x8a57('0x46')](_0xe0d270);}})[_0x8a57('0x16')](function(_0x24465f){if(_0x24465f){return db['User'][_0x8a57('0x47')]({'where':{'id':_[_0x8a57('0x20')](_0x24465f,'UserId'),'role':_0x8a57('0x48')},'attributes':['id',_0x8a57('0x1d'),'chatPause',_0x8a57('0x49'),'createdAt']});}})[_0x8a57('0x16')](function(_0x5ac7b7){if(_0x5ac7b7){return{'count':_0x5ac7b7[_0x8a57('0x12')],'rows':_[_0x8a57('0x20')](_0x5ac7b7['rows'],function(_0xcd4da5){return{'membername':_0xcd4da5['name'],'UserId':_0xcd4da5['id'],'queue_name':_0x27e44d[_0x8a57('0x1d')],'ChatQueueId':_0x27e44d['id'],'interface':util['format']('%s/%s',_0x8a57('0x4a'),_0xcd4da5[_0x8a57('0x1d')]),'penalty':0x0,'paused':_0xcd4da5[_0x8a57('0x4b')],'createdAt':_0xcd4da5[_0x8a57('0x4c')],'updatedAt':_0xcd4da5[_0x8a57('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8a57('0x16')](respondWithFilteredResult(_0x21d62c,_0xe0d270))['catch'](handleError(_0x21d62c,null));};exports[_0x8a57('0x4d')]=function(_0x49c0c7,_0x15bac){var _0x48b8e5={};var _0x15db5f={};var _0x37279b;var _0x513efc;return db[_0x8a57('0x21')]['findOne']({'where':{'id':_0x49c0c7['params']['id']}})[_0x8a57('0x16')](handleEntityNotFound(_0x15bac,null))[_0x8a57('0x16')](function(_0x51bb88){if(_0x51bb88){_0x37279b=_0x51bb88;_0x15db5f[_0x8a57('0x2b')]=_[_0x8a57('0x2c')](db[_0x8a57('0x4e')]['rawAttributes']);_0x15db5f[_0x8a57('0x31')]=_[_0x8a57('0x2c')](_0x49c0c7[_0x8a57('0x31')]);_0x15db5f[_0x8a57('0x2d')]=_['intersection'](_0x15db5f['model'],_0x15db5f[_0x8a57('0x31')]);_0x48b8e5['attributes']=_[_0x8a57('0x2e')](_0x15db5f['model'],qs[_0x8a57('0x30')](_0x49c0c7['query'][_0x8a57('0x30')]));_0x48b8e5['attributes']=_0x48b8e5[_0x8a57('0x2f')][_0x8a57('0x4f')]?_0x48b8e5[_0x8a57('0x2f')]:_0x15db5f[_0x8a57('0x2b')];_0x48b8e5[_0x8a57('0x42')]=qs[_0x8a57('0x50')](_0x49c0c7[_0x8a57('0x31')][_0x8a57('0x50')]);_0x48b8e5[_0x8a57('0x26')]=qs[_0x8a57('0x2d')](_['pick'](_0x49c0c7[_0x8a57('0x31')],_0x15db5f[_0x8a57('0x2d')]));if(_0x49c0c7[_0x8a57('0x31')]['filter']){_0x48b8e5[_0x8a57('0x26')]=_[_0x8a57('0x32')](_0x48b8e5[_0x8a57('0x26')],{'$or':_[_0x8a57('0x20')](_0x48b8e5[_0x8a57('0x2f')],function(_0x1adf82){var _0x3e9507={};_0x3e9507[_0x1adf82]={'$like':'%'+_0x49c0c7[_0x8a57('0x31')][_0x8a57('0x45')]+'%'};return _0x3e9507;})});}_0x48b8e5=_[_0x8a57('0x32')]({},_0x48b8e5,_0x49c0c7[_0x8a57('0x33')]);return _0x37279b[_0x8a57('0x4d')](_0x48b8e5);}})['then'](function(_0x2daffb){if(_0x2daffb){_0x513efc=_0x2daffb['length'];if(!_0x49c0c7[_0x8a57('0x31')][_0x8a57('0x40')]('nolimit')){_0x48b8e5[_0x8a57('0x11')]=qs['limit'](_0x49c0c7[_0x8a57('0x31')][_0x8a57('0x11')]);_0x48b8e5[_0x8a57('0xf')]=qs['offset'](_0x49c0c7[_0x8a57('0x31')][_0x8a57('0xf')]);}return _0x37279b['getTeams'](_0x48b8e5);}})[_0x8a57('0x16')](function(_0xec5a02){if(_0xec5a02){return _0xec5a02?{'count':_0x513efc,'rows':_0xec5a02}:null;}})[_0x8a57('0x16')](respondWithResult(_0x15bac,null))[_0x8a57('0x29')](handleError(_0x15bac,null));};exports[_0x8a57('0x51')]=function(_0x4424db,_0x4c488b){var _0x496a2a=_0x4424db[_0x8a57('0x36')]['ids'];return db['Team'][_0x8a57('0x46')]({'where':{'id':_0x496a2a},'attributes':['id'],'include':[{'model':db[_0x8a57('0x52')],'as':'Agents','attributes':['id',_0x8a57('0x1d'),_0x8a57('0x53'),_0x8a57('0x54'),_0x8a57('0x55')],'raw':!![]}]})['then'](function(_0x41ef34){if(_0x41ef34){var _0x3ceb9c=_[_0x8a57('0x56')](_0x41ef34,function(_0xe84a6b){var _0x22c6e8=_0xe84a6b[_0x8a57('0x18')]({'plain':!![]});return _0x22c6e8[_0x8a57('0x57')];});return db['ChatQueue'][_0x8a57('0x34')]({'where':{'id':_0x4424db[_0x8a57('0x3c')]['id']}})[_0x8a57('0x16')](function(_0x22622a){return db['sequelize'][_0x8a57('0x58')](function(_0x5baa0b){return _0x22622a[_0x8a57('0x51')](_0x496a2a,{'transaction':_0x5baa0b})['then'](function(){return BPromise[_0x8a57('0x59')](_0x3ceb9c,function(_0x4de154){return db[_0x8a57('0x3f')][_0x8a57('0x5a')]({'where':{'UserId':_0x4de154['id'],'ChatQueueId':_0x4424db['params']['id']},'transaction':_0x5baa0b});});})['then'](function(){_0x3ceb9c[_0x8a57('0x5b')](function(_0x451d22){socket[_0x8a57('0x5c')](_0x8a57('0x5d'),{'UserId':_0x451d22['id'],'ChatQueueId':_0x22622a['id']});});});});});}})[_0x8a57('0x16')](respondWithStatusCode(_0x4c488b,null))['catch'](handleError(_0x4c488b,null));};exports[_0x8a57('0x5e')]=function(_0x3c520d,_0x232823){return db[_0x8a57('0x4e')]['findAll']({'where':{'id':_0x3c520d['query'][_0x8a57('0x5f')]},'attributes':['id'],'include':[{'model':db[_0x8a57('0x52')],'as':_0x8a57('0x57'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x232823,null))[_0x8a57('0x16')](function(_0x2e73ae){var _0x107f17=_[_0x8a57('0x20')](_0x2e73ae,'id');var _0x40b548=[];var _0x185dc6=[];var _0x20beed=squel[_0x8a57('0x60')]();_0x20beed[_0x8a57('0x61')](_0x8a57('0x62'))[_0x8a57('0x63')](_0x8a57('0x64'),'tq')[_0x8a57('0x65')]('user_has_teams','ut',_0x8a57('0x66'))[_0x8a57('0x26')](_0x8a57('0x67'),_0x3c520d['params']['id']);for(var _0x56a2ed=0x0;_0x56a2ed<_0x2e73ae[_0x8a57('0x4f')];_0x56a2ed+=0x1){let _0x21b9f4=_0x2e73ae[_0x56a2ed];for(var _0x1a2918=0x0;_0x1a2918<_0x21b9f4[_0x8a57('0x57')][_0x8a57('0x4f')];_0x1a2918+=0x1){let _0x12c3e3=_0x21b9f4['Agents'][_0x1a2918];var _0x37bc14=_0x20beed[_0x8a57('0x68')]();_0x37bc14['where'](_0x8a57('0x69'),_0x12c3e3['id']);_0x185dc6[_0x8a57('0x6a')](db['sequelize'][_0x8a57('0x31')](_0x37bc14[_0x8a57('0x6b')](),{'type':db[_0x8a57('0x6c')][_0x8a57('0x6d')][_0x8a57('0x6e')]})['then'](function(_0x3caecd){if(_0x3caecd[_0x8a57('0x4f')]===0x1){return _0x12c3e3['id'];}else{var _0x2387da=_[_0x8a57('0x6f')](_['map'](_0x3caecd,'TeamId'),function(_0x50671d){return _[_0x8a57('0x70')](_0x107f17,_0x50671d);});if(_0x2387da){return _0x12c3e3['id'];}}}));}}return BPromise[_0x8a57('0x71')](_0x185dc6)[_0x8a57('0x16')](function(_0xdb5ae){_0x40b548=_(_0x40b548)[_0x8a57('0x72')](_0xdb5ae)['compact']()[_0x8a57('0x73')]();return db[_0x8a57('0x21')]['find']({'where':{'id':_0x3c520d[_0x8a57('0x3c')]['id']}})['then'](function(_0x4703f3){return db[_0x8a57('0x6c')][_0x8a57('0x58')](function(_0x462bc6){return _0x4703f3['removeTeams'](_0x3c520d[_0x8a57('0x31')]['ids'],{'transaction':_0x462bc6})[_0x8a57('0x16')](function(){if(!_['isEmpty'](_0x40b548)){return _0x4703f3[_0x8a57('0x74')](_0x40b548,{'transaction':_0x462bc6});}})[_0x8a57('0x16')](function(){_0x40b548['forEach'](function(_0x36ebff){socket['emit']('userChatQueue:remove',{'UserId':_0x36ebff,'ChatQueueId':_0x4703f3['id']});});});});});});})[_0x8a57('0x16')](respondWithStatusCode(_0x232823,null))['catch'](handleError(_0x232823,null));};exports[_0x8a57('0x75')]=function(_0xc1d670,_0x42efe3){return db[_0x8a57('0x21')]['find']({'where':{'id':_0xc1d670['params']['id']}})[_0x8a57('0x16')](handleEntityNotFound(_0x42efe3,null))[_0x8a57('0x16')](function(_0x5758f5){if(_0x5758f5){return _0x5758f5[_0x8a57('0x75')](_0xc1d670[_0x8a57('0x36')][_0x8a57('0x5f')],_[_0x8a57('0x76')](_0xc1d670[_0x8a57('0x36')],[_0x8a57('0x5f'),'id'])||{})['spread'](function(_0x61d6a3){for(var _0xb40c58=0x0;_0xb40c58<_0xc1d670[_0x8a57('0x36')][_0x8a57('0x5f')]['length'];_0xb40c58+=0x1){socket['emit']('userChatQueue:save',{'UserId':Number(_0xc1d670[_0x8a57('0x36')][_0x8a57('0x5f')][_0xb40c58]),'ChatQueueId':Number(_0xc1d670[_0x8a57('0x3c')]['id'])});}return _0x61d6a3;});}})[_0x8a57('0x16')](respondWithResult(_0x42efe3,null))[_0x8a57('0x29')](handleError(_0x42efe3,null));};exports['removeAgents']=function(_0x5619a6,_0xe89474){return db['ChatQueue']['find']({'where':{'id':_0x5619a6[_0x8a57('0x3c')]['id']}})[_0x8a57('0x16')](handleEntityNotFound(_0xe89474,null))['then'](function(_0x395599){if(_0x395599){return _0x395599[_0x8a57('0x74')](_0x5619a6[_0x8a57('0x31')][_0x8a57('0x5f')])[_0x8a57('0x16')](function(){if(_[_0x8a57('0x77')](_0x5619a6[_0x8a57('0x31')]['ids'])){for(var _0x7b99f4=0x0;_0x7b99f4<_0x5619a6[_0x8a57('0x31')][_0x8a57('0x5f')][_0x8a57('0x4f')];_0x7b99f4+=0x1){socket[_0x8a57('0x5c')](_0x8a57('0x78'),{'UserId':Number(_0x5619a6[_0x8a57('0x31')][_0x8a57('0x5f')][_0x7b99f4]),'ChatQueueId':Number(_0x5619a6['params']['id'])});}}else{socket[_0x8a57('0x5c')](_0x8a57('0x78'),{'UserId':Number(_0x5619a6['query'][_0x8a57('0x5f')]),'ChatQueueId':Number(_0x5619a6[_0x8a57('0x3c')]['id'])});}});}})[_0x8a57('0x16')](respondWithStatusCode(_0xe89474,null))[_0x8a57('0x29')](handleError(_0xe89474,null));};exports[_0x8a57('0x79')]=function(_0x444598,_0x402e37){var _0x1a87d6={};var _0x334309={};var _0x10073f;var _0x2b6071;return db[_0x8a57('0x21')][_0x8a57('0x3e')]({'where':{'id':_0x444598['params']['id']}})[_0x8a57('0x16')](handleEntityNotFound(_0x402e37,null))[_0x8a57('0x16')](function(_0xdd34bb){if(_0xdd34bb){_0x10073f=_0xdd34bb;_0x334309[_0x8a57('0x2b')]=_[_0x8a57('0x2c')](db[_0x8a57('0x52')]['rawAttributes']);_0x334309[_0x8a57('0x31')]=_['keys'](_0x444598['query']);_0x334309[_0x8a57('0x2d')]=_[_0x8a57('0x2e')](_0x334309[_0x8a57('0x2b')],_0x334309[_0x8a57('0x31')]);_0x1a87d6[_0x8a57('0x2f')]=_[_0x8a57('0x2e')](_0x334309[_0x8a57('0x2b')],qs[_0x8a57('0x30')](_0x444598[_0x8a57('0x31')]['fields']));_0x1a87d6[_0x8a57('0x2f')]=_0x1a87d6['attributes'][_0x8a57('0x4f')]?_0x1a87d6['attributes']:_0x334309[_0x8a57('0x2b')];_0x1a87d6[_0x8a57('0x42')]=qs['sort'](_0x444598[_0x8a57('0x31')][_0x8a57('0x50')]);_0x1a87d6['where']=qs[_0x8a57('0x2d')](_[_0x8a57('0x43')](_0x444598[_0x8a57('0x31')],_0x334309[_0x8a57('0x2d')]));if(_0x444598[_0x8a57('0x31')][_0x8a57('0x45')]){_0x1a87d6['where']=_[_0x8a57('0x32')](_0x1a87d6[_0x8a57('0x26')],{'$or':_[_0x8a57('0x20')](_0x1a87d6[_0x8a57('0x2f')],function(_0x242792){var _0x2eadd8={};_0x2eadd8[_0x242792]={'$like':'%'+_0x444598[_0x8a57('0x31')]['filter']+'%'};return _0x2eadd8;})});}_0x1a87d6=_[_0x8a57('0x32')]({},_0x1a87d6,_0x444598['options']);return _0x10073f[_0x8a57('0x79')](_0x1a87d6);}})[_0x8a57('0x16')](function(_0x21af6b){if(_0x21af6b){_0x2b6071=_0x21af6b[_0x8a57('0x4f')];if(!_0x444598[_0x8a57('0x31')][_0x8a57('0x40')](_0x8a57('0x41'))){_0x1a87d6[_0x8a57('0x11')]=qs[_0x8a57('0x11')](_0x444598[_0x8a57('0x31')][_0x8a57('0x11')]);_0x1a87d6[_0x8a57('0xf')]=qs[_0x8a57('0xf')](_0x444598[_0x8a57('0x31')][_0x8a57('0xf')]);}return _0x10073f['getAgents'](_0x1a87d6);}})[_0x8a57('0x16')](function(_0x2a4c6b){if(_0x2a4c6b){return _0x2a4c6b?{'count':_0x2b6071,'rows':_0x2a4c6b}:null;}})[_0x8a57('0x16')](respondWithResult(_0x402e37,null))[_0x8a57('0x29')](handleError(_0x402e37,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index e985419..6f9a340 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 _0xcf13=['exports','../../mysqldb','ChatQueue','save','emit','hook'];(function(_0x59e8ed,_0x3c82a1){var _0x3dd124=function(_0x3b9194){while(--_0x3b9194){_0x59e8ed['push'](_0x59e8ed['shift']());}};_0x3dd124(++_0x3c82a1);}(_0xcf13,0x1b7));var _0x3cf1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf13[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x3cf1('0x0'))['db'][_0x3cf1('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3cf1('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x26d776){return function(_0x34cd84,_0x20c5cd,_0x59a857){ChatQueueEvents['emit'](_0x26d776+':'+_0x34cd84['id'],_0x34cd84);ChatQueueEvents[_0x3cf1('0x3')](_0x26d776,_0x34cd84);_0x59a857(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x3cf1('0x4')](e,emitEvent(event));}}module[_0x3cf1('0x5')]=ChatQueueEvents; \ No newline at end of file +var _0xccfc=['hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x5a3ed8,_0x4cf865){var _0x1a894c=function(_0x1d179c){while(--_0x1d179c){_0x5a3ed8['push'](_0x5a3ed8['shift']());}};_0x1a894c(++_0x4cf865);}(_0xccfc,0x19a));var _0xcccf=function(_0x15f0ae,_0x2c4264){_0x15f0ae=_0x15f0ae-0x0;var _0xf4842=_0xccfc[_0x15f0ae];return _0xf4842;};'use strict';var EventEmitter=require(_0xcccf('0x0'));var ChatQueue=require(_0xcccf('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xcccf('0x2')](0x0);var events={'afterCreate':_0xcccf('0x3'),'afterUpdate':_0xcccf('0x4'),'afterDestroy':_0xcccf('0x5')};function emitEvent(_0x431940){return function(_0x7425b5,_0x56ca5b,_0x2685a8){ChatQueueEvents['emit'](_0x431940+':'+_0x7425b5['id'],_0x7425b5);ChatQueueEvents['emit'](_0x431940,_0x7425b5);_0x2685a8(null);};}for(var e in events){if(events[_0xcccf('0x6')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0xcccf('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 d277a7e..628c77c 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 _0x91a6=['lodash','util','../../config/logger','api','request-promise','path','rimraf','./chatQueue.attributes','exports','ChatQueue','chat_queues'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x91a6,0x1ef));var _0x691a=function(_0x544d66,_0x1738b6){_0x544d66=_0x544d66-0x0;var _0x1b6800=_0x91a6[_0x544d66];return _0x1b6800;};'use strict';var _=require(_0x691a('0x0'));var util=require(_0x691a('0x1'));var logger=require(_0x691a('0x2'))(_0x691a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x691a('0x4'));var fs=require('fs');var path=require(_0x691a('0x5'));var rimraf=require(_0x691a('0x6'));var config=require('../../config/environment');var attributes=require(_0x691a('0x7'));module[_0x691a('0x8')]=function(_0x406f39,_0x4cb2a8){return _0x406f39['define'](_0x691a('0x9'),attributes,{'tableName':_0x691a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x237c=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatQueue','chat_queues'];(function(_0x1a91f0,_0x11e203){var _0x12f862=function(_0x48983c){while(--_0x48983c){_0x1a91f0['push'](_0x1a91f0['shift']());}};_0x12f862(++_0x11e203);}(_0x237c,0x179));var _0xc237=function(_0x3eeaa9,_0x18f2c1){_0x3eeaa9=_0x3eeaa9-0x0;var _0x40dfde=_0x237c[_0x3eeaa9];return _0x40dfde;};'use strict';var _=require(_0xc237('0x0'));var util=require(_0xc237('0x1'));var logger=require(_0xc237('0x2'))(_0xc237('0x3'));var moment=require('moment');var BPromise=require(_0xc237('0x4'));var rp=require(_0xc237('0x5'));var fs=require('fs');var path=require(_0xc237('0x6'));var rimraf=require(_0xc237('0x7'));var config=require(_0xc237('0x8'));var attributes=require('./chatQueue.attributes');module[_0xc237('0x9')]=function(_0x133f01,_0x17d044){return _0x133f01[_0xc237('0xa')](_0xc237('0xb'),attributes,{'tableName':_0xc237('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 162ebd2..33d75e8 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 _0x2cf5=['model','stringify','catch','find','ShowChatQueue','lodash','util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','GetChatQueue','ChatQueue','findAll','raw','options','where','attributes','limit','include','map'];(function(_0x456bd3,_0x58161b){var _0x5c5ba1=function(_0x1efab2){while(--_0x1efab2){_0x456bd3['push'](_0x456bd3['shift']());}};_0x5c5ba1(++_0x58161b);}(_0x2cf5,0x19f));var _0x52cf=function(_0x44103b,_0xbfa4fb){_0x44103b=_0x44103b-0x0;var _0x5dba51=_0x2cf5[_0x44103b];return _0x5dba51;};'use strict';var _=require(_0x52cf('0x0'));var util=require(_0x52cf('0x1'));var moment=require('moment');var BPromise=require(_0x52cf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x52cf('0x3'));var db=require(_0x52cf('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x52cf('0x5'));var config=require(_0x52cf('0x6'));var jayson=require(_0x52cf('0x7'));var client=jayson[_0x52cf('0x8')][_0x52cf('0x9')]({'port':0x232a});config[_0x52cf('0xa')]=_[_0x52cf('0xb')](config[_0x52cf('0xa')],{'host':_0x52cf('0xc'),'port':0x18eb});var socket=require(_0x52cf('0xd'))(new Redis(config[_0x52cf('0xa')]));require('./chatQueue.socket')[_0x52cf('0xe')](socket);function respondWithRpcPromise(_0x201710,_0x2b9974,_0x120dab){return new BPromise(function(_0x4e5b19,_0xadb2a6){return client[_0x52cf('0xf')](_0x201710,_0x120dab)[_0x52cf('0x10')](function(_0x54806d){logger[_0x52cf('0x11')](_0x52cf('0x12'),_0x2b9974,_0x52cf('0x13'));logger[_0x52cf('0x14')](_0x52cf('0x15'),_0x2b9974,_0x52cf('0x13'),JSON['stringify'](_0x54806d));if(_0x54806d['error']){if(_0x54806d[_0x52cf('0x16')][_0x52cf('0x17')]===0x1f4){logger[_0x52cf('0x16')](_0x52cf('0x12'),_0x2b9974,_0x54806d[_0x52cf('0x16')][_0x52cf('0x18')]);return _0xadb2a6(_0x54806d[_0x52cf('0x16')][_0x52cf('0x18')]);}logger['error'](_0x52cf('0x12'),_0x2b9974,_0x54806d[_0x52cf('0x16')][_0x52cf('0x18')]);return _0x4e5b19(_0x54806d['error'][_0x52cf('0x18')]);}else{logger['info'](_0x52cf('0x12'),_0x2b9974,_0x52cf('0x13'));_0x4e5b19(_0x54806d[_0x52cf('0x19')][_0x52cf('0x18')]);}})['catch'](function(_0x229595){logger[_0x52cf('0x16')](_0x52cf('0x12'),_0x2b9974,_0x229595);_0xadb2a6(_0x229595);});});}exports[_0x52cf('0x1a')]=function(_0x4ab08f){var _0x326311=this;return new Promise(function(_0x5f5200,_0x1d9fdd){return db[_0x52cf('0x1b')][_0x52cf('0x1c')]({'raw':_0x4ab08f['options']?_0x4ab08f['options'][_0x52cf('0x1d')]===undefined?!![]:![]:!![],'where':_0x4ab08f[_0x52cf('0x1e')]?_0x4ab08f[_0x52cf('0x1e')][_0x52cf('0x1f')]||null:null,'attributes':_0x4ab08f[_0x52cf('0x1e')]?_0x4ab08f[_0x52cf('0x1e')][_0x52cf('0x20')]||null:null,'limit':_0x4ab08f[_0x52cf('0x1e')]?_0x4ab08f[_0x52cf('0x1e')][_0x52cf('0x21')]||null:null,'include':_0x4ab08f['options']?_0x4ab08f['options'][_0x52cf('0x22')]?_[_0x52cf('0x23')](_0x4ab08f[_0x52cf('0x1e')][_0x52cf('0x22')],function(_0x499ac7){return{'model':db[_0x499ac7['model']],'as':_0x499ac7['as'],'attributes':_0x499ac7[_0x52cf('0x20')],'include':_0x499ac7[_0x52cf('0x22')]?_[_0x52cf('0x23')](_0x499ac7[_0x52cf('0x22')],function(_0x42132c){return{'model':db[_0x42132c[_0x52cf('0x24')]],'as':_0x42132c['as'],'attributes':_0x42132c[_0x52cf('0x20')],'include':_0x42132c[_0x52cf('0x22')]?_[_0x52cf('0x23')](_0x42132c['include'],function(_0x4796b5){return{'model':db[_0x4796b5[_0x52cf('0x24')]],'as':_0x4796b5['as'],'attributes':_0x4796b5[_0x52cf('0x20')]};}):[]};}):[]};}):[]:[]})[_0x52cf('0x10')](function(_0x1e1318){logger['info'](_0x52cf('0x1a'),_0x4ab08f);logger[_0x52cf('0x14')](_0x52cf('0x1a'),_0x4ab08f,JSON[_0x52cf('0x25')](_0x1e1318));_0x5f5200(_0x1e1318);})[_0x52cf('0x26')](function(_0x1ed92a){logger['error'](_0x52cf('0x1a'),_0x1ed92a[_0x52cf('0x18')],_0x4ab08f);_0x1d9fdd(_0x326311[_0x52cf('0x16')](0x1f4,_0x1ed92a[_0x52cf('0x18')]));});});};exports['ShowChatQueue']=function(_0x1c6bc2){var _0xcffed3=this;return new Promise(function(_0x46eca4,_0x141871){return db[_0x52cf('0x1b')][_0x52cf('0x27')]({'raw':_0x1c6bc2[_0x52cf('0x1e')]?_0x1c6bc2[_0x52cf('0x1e')][_0x52cf('0x1d')]===undefined?!![]:![]:!![],'where':_0x1c6bc2[_0x52cf('0x1e')]?_0x1c6bc2['options']['where']||null:null,'attributes':_0x1c6bc2[_0x52cf('0x1e')]?_0x1c6bc2[_0x52cf('0x1e')][_0x52cf('0x20')]||null:null,'include':_0x1c6bc2[_0x52cf('0x1e')]?_0x1c6bc2['options']['include']?_[_0x52cf('0x23')](_0x1c6bc2[_0x52cf('0x1e')][_0x52cf('0x22')],function(_0xafd307){return{'model':db[_0xafd307[_0x52cf('0x24')]],'as':_0xafd307['as'],'attributes':_0xafd307[_0x52cf('0x20')],'include':_0xafd307[_0x52cf('0x22')]?_[_0x52cf('0x23')](_0xafd307[_0x52cf('0x22')],function(_0x163181){return{'model':db[_0x163181[_0x52cf('0x24')]],'as':_0x163181['as'],'attributes':_0x163181[_0x52cf('0x20')],'include':_0x163181[_0x52cf('0x22')]?_[_0x52cf('0x23')](_0x163181[_0x52cf('0x22')],function(_0x50d881){return{'model':db[_0x50d881[_0x52cf('0x24')]],'as':_0x50d881['as'],'attributes':_0x50d881[_0x52cf('0x20')]};}):[]};}):[]};}):[]:[]})[_0x52cf('0x10')](function(_0x2f9a0a){logger[_0x52cf('0x11')](_0x52cf('0x28'),_0x1c6bc2);logger[_0x52cf('0x14')]('ShowChatQueue',_0x1c6bc2,JSON[_0x52cf('0x25')](_0x2f9a0a));_0x46eca4(_0x2f9a0a);})[_0x52cf('0x26')](function(_0x5e56cc){logger['error'](_0x52cf('0x28'),_0x5e56cc['message'],_0x1c6bc2);_0x141871(_0xcffed3['error'](0x1f4,_0x5e56cc[_0x52cf('0x18')]));});});}; \ No newline at end of file +var _0x6f54=['find','stringify','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetChatQueue','findAll','options','raw','where','attributes','limit','include','model','map','debug','ShowChatQueue','ChatQueue'];(function(_0x568e42,_0x1e6554){var _0x4f05be=function(_0x4447b6){while(--_0x4447b6){_0x568e42['push'](_0x568e42['shift']());}};_0x4f05be(++_0x1e6554);}(_0x6f54,0xcf));var _0x46f5=function(_0x4bdd47,_0x15f10e){_0x4bdd47=_0x4bdd47-0x0;var _0x2975df=_0x6f54[_0x4bdd47];return _0x2975df;};'use strict';var _=require(_0x46f5('0x0'));var util=require(_0x46f5('0x1'));var moment=require(_0x46f5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x46f5('0x3'));var db=require(_0x46f5('0x4'))['db'];var utils=require(_0x46f5('0x5'));var logger=require(_0x46f5('0x6'))('rpc');var config=require(_0x46f5('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x46f5('0x8')]({'port':0x232a});config['redis']=_[_0x46f5('0x9')](config[_0x46f5('0xa')],{'host':_0x46f5('0xb'),'port':0x18eb});var socket=require(_0x46f5('0xc'))(new Redis(config[_0x46f5('0xa')]));require(_0x46f5('0xd'))[_0x46f5('0xe')](socket);function respondWithRpcPromise(_0x22fe4e,_0x1a6660,_0x356a21){return new BPromise(function(_0x359b6e,_0x18fdc3){return client[_0x46f5('0xf')](_0x22fe4e,_0x356a21)[_0x46f5('0x10')](function(_0x4b946d){logger[_0x46f5('0x11')](_0x46f5('0x12'),_0x1a6660,_0x46f5('0x13'));logger['debug'](_0x46f5('0x14'),_0x1a6660,_0x46f5('0x13'),JSON['stringify'](_0x4b946d));if(_0x4b946d[_0x46f5('0x15')]){if(_0x4b946d[_0x46f5('0x15')][_0x46f5('0x16')]===0x1f4){logger[_0x46f5('0x15')]('ChatQueue,\x20%s,\x20%s',_0x1a6660,_0x4b946d['error'][_0x46f5('0x17')]);return _0x18fdc3(_0x4b946d[_0x46f5('0x15')][_0x46f5('0x17')]);}logger[_0x46f5('0x15')](_0x46f5('0x12'),_0x1a6660,_0x4b946d[_0x46f5('0x15')][_0x46f5('0x17')]);return _0x359b6e(_0x4b946d[_0x46f5('0x15')][_0x46f5('0x17')]);}else{logger[_0x46f5('0x11')](_0x46f5('0x12'),_0x1a6660,'request\x20sent');_0x359b6e(_0x4b946d[_0x46f5('0x18')][_0x46f5('0x17')]);}})[_0x46f5('0x19')](function(_0x9f9165){logger['error'](_0x46f5('0x12'),_0x1a6660,_0x9f9165);_0x18fdc3(_0x9f9165);});});}exports[_0x46f5('0x1a')]=function(_0x2511d8){var _0x2094b0=this;return new Promise(function(_0xf3a7e9,_0x425a2e){return db['ChatQueue'][_0x46f5('0x1b')]({'raw':_0x2511d8[_0x46f5('0x1c')]?_0x2511d8[_0x46f5('0x1c')][_0x46f5('0x1d')]===undefined?!![]:![]:!![],'where':_0x2511d8['options']?_0x2511d8['options'][_0x46f5('0x1e')]||null:null,'attributes':_0x2511d8[_0x46f5('0x1c')]?_0x2511d8[_0x46f5('0x1c')][_0x46f5('0x1f')]||null:null,'limit':_0x2511d8['options']?_0x2511d8['options'][_0x46f5('0x20')]||null:null,'include':_0x2511d8['options']?_0x2511d8[_0x46f5('0x1c')][_0x46f5('0x21')]?_['map'](_0x2511d8[_0x46f5('0x1c')][_0x46f5('0x21')],function(_0x21374d){return{'model':db[_0x21374d[_0x46f5('0x22')]],'as':_0x21374d['as'],'attributes':_0x21374d['attributes'],'include':_0x21374d['include']?_[_0x46f5('0x23')](_0x21374d[_0x46f5('0x21')],function(_0x4b2769){return{'model':db[_0x4b2769['model']],'as':_0x4b2769['as'],'attributes':_0x4b2769[_0x46f5('0x1f')],'include':_0x4b2769[_0x46f5('0x21')]?_[_0x46f5('0x23')](_0x4b2769['include'],function(_0x48b761){return{'model':db[_0x48b761['model']],'as':_0x48b761['as'],'attributes':_0x48b761[_0x46f5('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x46f5('0x10')](function(_0x42837f){logger['info'](_0x46f5('0x1a'),_0x2511d8);logger[_0x46f5('0x24')]('GetChatQueue',_0x2511d8,JSON['stringify'](_0x42837f));_0xf3a7e9(_0x42837f);})[_0x46f5('0x19')](function(_0x456c02){logger[_0x46f5('0x15')](_0x46f5('0x1a'),_0x456c02[_0x46f5('0x17')],_0x2511d8);_0x425a2e(_0x2094b0['error'](0x1f4,_0x456c02[_0x46f5('0x17')]));});});};exports[_0x46f5('0x25')]=function(_0x131f15){var _0x503262=this;return new Promise(function(_0x491aff,_0x5d0c51){return db[_0x46f5('0x26')][_0x46f5('0x27')]({'raw':_0x131f15[_0x46f5('0x1c')]?_0x131f15['options'][_0x46f5('0x1d')]===undefined?!![]:![]:!![],'where':_0x131f15[_0x46f5('0x1c')]?_0x131f15['options'][_0x46f5('0x1e')]||null:null,'attributes':_0x131f15[_0x46f5('0x1c')]?_0x131f15[_0x46f5('0x1c')][_0x46f5('0x1f')]||null:null,'include':_0x131f15['options']?_0x131f15[_0x46f5('0x1c')]['include']?_[_0x46f5('0x23')](_0x131f15['options'][_0x46f5('0x21')],function(_0x1dd293){return{'model':db[_0x1dd293[_0x46f5('0x22')]],'as':_0x1dd293['as'],'attributes':_0x1dd293['attributes'],'include':_0x1dd293[_0x46f5('0x21')]?_[_0x46f5('0x23')](_0x1dd293[_0x46f5('0x21')],function(_0x1ad90c){return{'model':db[_0x1ad90c[_0x46f5('0x22')]],'as':_0x1ad90c['as'],'attributes':_0x1ad90c['attributes'],'include':_0x1ad90c[_0x46f5('0x21')]?_[_0x46f5('0x23')](_0x1ad90c[_0x46f5('0x21')],function(_0x232e68){return{'model':db[_0x232e68['model']],'as':_0x232e68['as'],'attributes':_0x232e68[_0x46f5('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x46f5('0x10')](function(_0xcb164c){logger['info'](_0x46f5('0x25'),_0x131f15);logger[_0x46f5('0x24')](_0x46f5('0x25'),_0x131f15,JSON[_0x46f5('0x28')](_0xcb164c));_0x491aff(_0xcb164c);})[_0x46f5('0x19')](function(_0x5257ce){logger[_0x46f5('0x15')](_0x46f5('0x25'),_0x5257ce[_0x46f5('0x17')],_0x131f15);_0x5d0c51(_0x503262[_0x46f5('0x15')](0x1f4,_0x5257ce[_0x46f5('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 2ad06bd..ba01ef5 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 _0x6737=['chatQueue:','save','remove','emit','removeListener'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x6737,0xe2));var _0x7673=function(_0xf68acb,_0x46d773){_0xf68acb=_0xf68acb-0x0;var _0x26d4c1=_0x6737[_0xf68acb];return _0x26d4c1;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x7673('0x0'),_0x7673('0x1'),'update'];function createListener(_0x2f05d4,_0x2a9cd0){return function(_0x43ee27){_0x2a9cd0[_0x7673('0x2')](_0x2f05d4,_0x43ee27);};}function removeListener(_0x54002e,_0x32e6f2){return function(){ChatQueueEvents[_0x7673('0x3')](_0x54002e,_0x32e6f2);};}exports['register']=function(_0x2f5edc){for(var _0x15230f=0x0,_0x5af802=events['length'];_0x15230f<_0x5af802;_0x15230f++){var _0x53d67d=events[_0x15230f];var _0x5292f7=createListener(_0x7673('0x4')+_0x53d67d,_0x2f5edc);ChatQueueEvents['on'](_0x53d67d,_0x5292f7);}}; \ No newline at end of file +var _0xb903=['update','emit','removeListener','register','chatQueue:','./chatQueue.events','save','remove'];(function(_0x40dd56,_0x726ca5){var _0x4f850f=function(_0x5f899e){while(--_0x5f899e){_0x40dd56['push'](_0x40dd56['shift']());}};_0x4f850f(++_0x726ca5);}(_0xb903,0x185));var _0x3b90=function(_0x29b37a,_0x5debfe){_0x29b37a=_0x29b37a-0x0;var _0x5d9d3f=_0xb903[_0x29b37a];return _0x5d9d3f;};'use strict';var ChatQueueEvents=require(_0x3b90('0x0'));var events=[_0x3b90('0x1'),_0x3b90('0x2'),_0x3b90('0x3')];function createListener(_0x5191d8,_0x3312ca){return function(_0xf414f4){_0x3312ca[_0x3b90('0x4')](_0x5191d8,_0xf414f4);};}function removeListener(_0x1cd5d8,_0x30d8db){return function(){ChatQueueEvents[_0x3b90('0x5')](_0x1cd5d8,_0x30d8db);};}exports[_0x3b90('0x6')]=function(_0x5acd76){for(var _0x15b68f=0x0,_0x5e845a=events['length'];_0x15b68f<_0x5e845a;_0x15b68f++){var _0x153283=events[_0x15b68f];var _0x2e4c06=createListener(_0x3b90('0x7')+_0x153283,_0x5acd76);ChatQueueEvents['on'](_0x153283,_0x2e4c06);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 573c316..b5766ab 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 _0x7217=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0xa015c9,_0x307fb8){var _0x4ef54c=function(_0xc82a6b){while(--_0xc82a6b){_0xa015c9['push'](_0xa015c9['shift']());}};_0x4ef54c(++_0x307fb8);}(_0x7217,0x19e));var _0x7721=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x7217[_0x5783f4];return _0x28e380;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getAgents']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['post'](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['addAgents']);router['put']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);router[_0x7721('0x17')](_0x7721('0xd'),auth['isAuthenticated'](),controller[_0x7721('0x18')]);router['delete'](_0x7721('0x11'),auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x17')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1a')]);module[_0x7721('0x1b')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','/:id/teams','removeTeams','multer','util','path'];(function(_0x5e60dd,_0x117397){var _0x2fd44e=function(_0x15f7a4){while(--_0x15f7a4){_0x5e60dd['push'](_0x5e60dd['shift']());}};_0x2fd44e(++_0x117397);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/teams',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x14')](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x17')]);router[_0x7995('0x18')](_0x7995('0x19'),auth[_0x7995('0xa')](),controller['update']);router[_0x7995('0x1a')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0x1b')]);router[_0x7995('0x1a')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router['delete']('/:id/users',auth[_0x7995('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index b1e79e4..8978c59 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 _0x1aea=['exports','STRING','DATE','moment','sequelize'];(function(_0x13679b,_0xabb2ad){var _0x4b8004=function(_0x54e362){while(--_0x54e362){_0x13679b['push'](_0x13679b['shift']());}};_0x4b8004(++_0xabb2ad);}(_0x1aea,0x1d4));var _0xa1ae=function(_0x590851,_0x496bee){_0x590851=_0x590851-0x0;var _0x3b0115=_0x1aea[_0x590851];return _0x3b0115;};'use strict';var moment=require(_0xa1ae('0x0'));var Sequelize=require(_0xa1ae('0x1'));module[_0xa1ae('0x2')]={'uniqueid':{'type':Sequelize[_0xa1ae('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xa1ae('0x3')]},'joinAt':{'type':Sequelize[_0xa1ae('0x4')]},'leaveAt':{'type':Sequelize[_0xa1ae('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xa1ae('0x3')]}}; \ No newline at end of file +var _0x20ae=['moment','sequelize','STRING','DATE'];(function(_0x31e482,_0x183b9c){var _0x214aa8=function(_0x281c79){while(--_0x281c79){_0x31e482['push'](_0x31e482['shift']());}};_0x214aa8(++_0x183b9c);}(_0x20ae,0x120));var _0xe20a=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x20ae[_0x167cc1];return _0x10bc4b;};'use strict';var moment=require(_0xe20a('0x0'));var Sequelize=require(_0xe20a('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xe20a('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xe20a('0x3')]},'leaveAt':{'type':Sequelize[_0xe20a('0x3')]},'acceptAt':{'type':Sequelize[_0xe20a('0x3')]},'exitAt':{'type':Sequelize[_0xe20a('0x3')]},'reason':{'type':Sequelize[_0xe20a('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index dbe4784..f6945d4 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 _0x8212=['order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','length','ChatQueueReport','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','status','end','undefined','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','limit'];(function(_0x39f36c,_0x15ac8e){var _0x42f49c=function(_0x4195c6){while(--_0x4195c6){_0x39f36c['push'](_0x39f36c['shift']());}};_0x42f49c(++_0x15ac8e);}(_0x8212,0xb3));var _0x2821=function(_0x4ce9b5,_0x465447){_0x4ce9b5=_0x4ce9b5-0x0;var _0x2c3b31=_0x8212[_0x4ce9b5];return _0x2c3b31;};'use strict';var emlformat=require(_0x2821('0x0'));var rimraf=require(_0x2821('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2821('0x2'));var rp=require(_0x2821('0x3'));var moment=require(_0x2821('0x4'));var BPromise=require(_0x2821('0x5'));var Mustache=require(_0x2821('0x6'));var util=require(_0x2821('0x7'));var path=require(_0x2821('0x8'));var sox=require(_0x2821('0x9'));var csv=require('to-csv');var ejs=require(_0x2821('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2821('0xb'));var squel=require(_0x2821('0xc'));var crypto=require('crypto');var jsforce=require(_0x2821('0xd'));var deskjs=require(_0x2821('0xe'));var toCsv=require(_0x2821('0xf'));var querystring=require(_0x2821('0x10'));var Papa=require(_0x2821('0x11'));var Redis=require(_0x2821('0x12'));var authService=require(_0x2821('0x13'));var qs=require(_0x2821('0x14'));var as=require(_0x2821('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2821('0x16'))(_0x2821('0x17'));var utils=require(_0x2821('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c81c1,_0x11d227){_0x11d227=_0x11d227||0xcc;return function(_0x18a2bb){if(_0x18a2bb){return _0x4c81c1[_0x2821('0x19')](_0x11d227);}return _0x4c81c1[_0x2821('0x1a')](_0x11d227)[_0x2821('0x1b')]();};}function respondWithResult(_0x2fbc96,_0x5d5ee5){_0x5d5ee5=_0x5d5ee5||0xc8;return function(_0x3ba091){if(_0x3ba091){return _0x2fbc96['status'](_0x5d5ee5)['json'](_0x3ba091);}};}function respondWithFilteredResult(_0x4142f1,_0xe30acf){return function(_0x243c46){if(_0x243c46){var _0x472238=typeof _0xe30acf['offset']===_0x2821('0x1c')&&typeof _0xe30acf['limit']===_0x2821('0x1c');var _0x2673d2=_0x243c46[_0x2821('0x1d')];var _0x3f1057=_0x472238?0x0:_0xe30acf[_0x2821('0x1e')];var _0x500357=_0x472238?_0x243c46[_0x2821('0x1d')]:_0xe30acf[_0x2821('0x1e')]+_0xe30acf['limit'];var _0x22990a;if(_0x500357>=_0x2673d2){_0x500357=_0x2673d2;_0x22990a=0xc8;}else{_0x22990a=0xce;}_0x4142f1['status'](_0x22990a);return _0x4142f1[_0x2821('0x1f')](_0x2821('0x20'),_0x3f1057+'-'+_0x500357+'/'+_0x2673d2)[_0x2821('0x21')](_0x243c46);}return null;};}function patchUpdates(_0x8ba96e){return function(_0x38d898){try{jsonpatch[_0x2821('0x22')](_0x38d898,_0x8ba96e,!![]);}catch(_0x1c0907){return BPromise[_0x2821('0x23')](_0x1c0907);}return _0x38d898[_0x2821('0x24')]();};}function saveUpdates(_0x1f4e4f,_0x275810){return function(_0x597d8b){if(_0x597d8b){return _0x597d8b['update'](_0x1f4e4f)[_0x2821('0x25')](function(_0x243ff2){return _0x243ff2;});}return null;};}function removeEntity(_0x2838d8,_0x279a46){return function(_0x37c669){if(_0x37c669){return _0x37c669[_0x2821('0x26')]()[_0x2821('0x25')](function(){_0x2838d8[_0x2821('0x1a')](0xcc)[_0x2821('0x1b')]();});}};}function handleEntityNotFound(_0x27cef1,_0x7a49da){return function(_0x1d2c8f){if(!_0x1d2c8f){_0x27cef1[_0x2821('0x19')](0x194);}return _0x1d2c8f;};}function handleError(_0x3ddbe7,_0x14fbd4){_0x14fbd4=_0x14fbd4||0x1f4;return function(_0x2ab3ab){logger[_0x2821('0x27')](_0x2ab3ab[_0x2821('0x28')]);if(_0x2ab3ab[_0x2821('0x29')]){delete _0x2ab3ab[_0x2821('0x29')];}_0x3ddbe7['status'](_0x14fbd4)[_0x2821('0x2a')](_0x2ab3ab);};}exports['index']=function(_0x109262,_0x4402ea){var _0x449e46={},_0x7dfdc3={},_0x5eba60={'count':0x0,'rows':[]};var _0x3ea1de=_[_0x2821('0x2b')](db['ChatQueueReport'][_0x2821('0x2c')],function(_0x2e4395){return{'name':_0x2e4395[_0x2821('0x2d')],'type':_0x2e4395['type'][_0x2821('0x2e')]};});_0x7dfdc3[_0x2821('0x2f')]=_[_0x2821('0x2b')](_0x3ea1de,_0x2821('0x29'));_0x7dfdc3[_0x2821('0x30')]=_[_0x2821('0x31')](_0x109262[_0x2821('0x30')]);_0x7dfdc3['filters']=_[_0x2821('0x32')](_0x7dfdc3[_0x2821('0x2f')],_0x7dfdc3[_0x2821('0x30')]);_0x449e46[_0x2821('0x33')]=_[_0x2821('0x32')](_0x7dfdc3[_0x2821('0x2f')],qs[_0x2821('0x34')](_0x109262[_0x2821('0x30')][_0x2821('0x34')]));_0x449e46[_0x2821('0x33')]=_0x449e46[_0x2821('0x33')]['length']?_0x449e46[_0x2821('0x33')]:_0x7dfdc3[_0x2821('0x2f')];if(!_0x109262[_0x2821('0x30')][_0x2821('0x35')]('nolimit')){_0x449e46[_0x2821('0x36')]=qs[_0x2821('0x36')](_0x109262[_0x2821('0x30')][_0x2821('0x36')]);_0x449e46[_0x2821('0x1e')]=qs[_0x2821('0x1e')](_0x109262[_0x2821('0x30')][_0x2821('0x1e')]);}_0x449e46[_0x2821('0x37')]=qs[_0x2821('0x38')](_0x109262['query'][_0x2821('0x38')]);_0x449e46[_0x2821('0x39')]=qs[_0x2821('0x3a')](_[_0x2821('0x3b')](_0x109262[_0x2821('0x30')],_0x7dfdc3['filters']),_0x3ea1de);if(_0x109262[_0x2821('0x30')]['filter']){_0x449e46['where']=_[_0x2821('0x3c')](_0x449e46[_0x2821('0x39')],{'$or':_[_0x2821('0x2b')](_0x3ea1de,function(_0x276edc){if(_0x276edc[_0x2821('0x3d')]!==_0x2821('0x3e')){var _0x210c60={};_0x210c60[_0x276edc['name']]={'$like':'%'+_0x109262['query'][_0x2821('0x3f')]+'%'};return _0x210c60;}})});}_0x449e46=_[_0x2821('0x3c')]({},_0x449e46,_0x109262[_0x2821('0x40')]);var _0x2737a7={'where':_0x449e46[_0x2821('0x39')]};return db['ChatQueueReport']['count'](_0x2737a7)[_0x2821('0x25')](function(_0x26d389){_0x5eba60[_0x2821('0x1d')]=_0x26d389;if(_0x109262[_0x2821('0x30')][_0x2821('0x41')]){_0x449e46[_0x2821('0x42')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x2821('0x43')](_0x449e46);})[_0x2821('0x25')](function(_0x4fe0cd){_0x5eba60[_0x2821('0x44')]=_0x4fe0cd;return _0x5eba60;})[_0x2821('0x25')](respondWithFilteredResult(_0x4402ea,_0x449e46))[_0x2821('0x45')](handleError(_0x4402ea,null));};exports[_0x2821('0x46')]=function(_0x20c8db,_0x4ffc43){var _0x2b2796={'raw':!![],'where':{'id':_0x20c8db[_0x2821('0x47')]['id']}},_0x8d988a={};_0x8d988a[_0x2821('0x2f')]=_['keys'](db['ChatQueueReport'][_0x2821('0x2c')]);_0x8d988a[_0x2821('0x30')]=_[_0x2821('0x31')](_0x20c8db[_0x2821('0x30')]);_0x8d988a[_0x2821('0x3a')]=_[_0x2821('0x32')](_0x8d988a[_0x2821('0x2f')],_0x8d988a['query']);_0x2b2796['attributes']=_[_0x2821('0x32')](_0x8d988a['model'],qs[_0x2821('0x34')](_0x20c8db[_0x2821('0x30')][_0x2821('0x34')]));_0x2b2796[_0x2821('0x33')]=_0x2b2796[_0x2821('0x33')][_0x2821('0x48')]?_0x2b2796[_0x2821('0x33')]:_0x8d988a['model'];if(_0x20c8db[_0x2821('0x30')][_0x2821('0x41')]){_0x2b2796[_0x2821('0x42')]=[{'all':!![]}];}_0x2b2796=_[_0x2821('0x3c')]({},_0x2b2796,_0x20c8db[_0x2821('0x40')]);return db[_0x2821('0x49')][_0x2821('0x4a')](_0x2b2796)[_0x2821('0x25')](handleEntityNotFound(_0x4ffc43,null))['then'](respondWithResult(_0x4ffc43,null))[_0x2821('0x45')](handleError(_0x4ffc43,null));};exports[_0x2821('0x4b')]=function(_0x175ef3,_0x3f370d){return db['ChatQueueReport'][_0x2821('0x4b')](_0x175ef3[_0x2821('0x4c')],{})[_0x2821('0x25')](respondWithResult(_0x3f370d,0xc9))['catch'](handleError(_0x3f370d,null));};exports['update']=function(_0x5162b3,_0x9721){if(_0x5162b3[_0x2821('0x4c')]['id']){delete _0x5162b3[_0x2821('0x4c')]['id'];}return db['ChatQueueReport'][_0x2821('0x4a')]({'where':{'id':_0x5162b3[_0x2821('0x47')]['id']}})[_0x2821('0x25')](handleEntityNotFound(_0x9721,null))[_0x2821('0x25')](saveUpdates(_0x5162b3[_0x2821('0x4c')],null))[_0x2821('0x25')](respondWithResult(_0x9721,null))['catch'](handleError(_0x9721,null));};exports['destroy']=function(_0x284b28,_0x39fcc9){return db['ChatQueueReport'][_0x2821('0x4a')]({'where':{'id':_0x284b28[_0x2821('0x47')]['id']}})[_0x2821('0x25')](handleEntityNotFound(_0x39fcc9,null))[_0x2821('0x25')](removeEntity(_0x39fcc9,null))[_0x2821('0x45')](handleError(_0x39fcc9,null));};exports[_0x2821('0x4d')]=function(_0x40fecc,_0x2e4a4d){return db[_0x2821('0x49')]['describe']()['then'](respondWithResult(_0x2e4a4d,null))['catch'](handleError(_0x2e4a4d,null));}; \ No newline at end of file +var _0x7b84=['map','ChatQueueReport','fieldName','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error','stack','name','send','index'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x7b84,0x167));var _0x47b8=function(_0x49f3c3,_0x1c2be1){_0x49f3c3=_0x49f3c3-0x0;var _0x32e69b=_0x7b84[_0x49f3c3];return _0x32e69b;};'use strict';var emlformat=require(_0x47b8('0x0'));var rimraf=require(_0x47b8('0x1'));var zipdir=require(_0x47b8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x47b8('0x3'));var BPromise=require(_0x47b8('0x4'));var Mustache=require(_0x47b8('0x5'));var util=require(_0x47b8('0x6'));var path=require(_0x47b8('0x7'));var sox=require(_0x47b8('0x8'));var csv=require(_0x47b8('0x9'));var ejs=require(_0x47b8('0xa'));var fs=require('fs');var fs_extra=require(_0x47b8('0xb'));var _=require(_0x47b8('0xc'));var squel=require(_0x47b8('0xd'));var crypto=require(_0x47b8('0xe'));var jsforce=require(_0x47b8('0xf'));var deskjs=require(_0x47b8('0x10'));var toCsv=require(_0x47b8('0x9'));var querystring=require(_0x47b8('0x11'));var Papa=require(_0x47b8('0x12'));var Redis=require(_0x47b8('0x13'));var authService=require(_0x47b8('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x47b8('0x15'));var logger=require(_0x47b8('0x16'))(_0x47b8('0x17'));var utils=require(_0x47b8('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x47b8('0x19'));var db=require(_0x47b8('0x1a'))['db'];function respondWithStatusCode(_0x50ff5e,_0x1c3cfd){_0x1c3cfd=_0x1c3cfd||0xcc;return function(_0x4e843f){if(_0x4e843f){return _0x50ff5e[_0x47b8('0x1b')](_0x1c3cfd);}return _0x50ff5e[_0x47b8('0x1c')](_0x1c3cfd)[_0x47b8('0x1d')]();};}function respondWithResult(_0x49834d,_0x59388e){_0x59388e=_0x59388e||0xc8;return function(_0x1b1bc4){if(_0x1b1bc4){return _0x49834d['status'](_0x59388e)[_0x47b8('0x1e')](_0x1b1bc4);}};}function respondWithFilteredResult(_0x30fc0b,_0x105e29){return function(_0x1db4de){if(_0x1db4de){var _0x67a4=typeof _0x105e29[_0x47b8('0x1f')]===_0x47b8('0x20')&&typeof _0x105e29[_0x47b8('0x21')]===_0x47b8('0x20');var _0x5dfacd=_0x1db4de[_0x47b8('0x22')];var _0x4c1c0b=_0x67a4?0x0:_0x105e29[_0x47b8('0x1f')];var _0x3da863=_0x67a4?_0x1db4de[_0x47b8('0x22')]:_0x105e29['offset']+_0x105e29[_0x47b8('0x21')];var _0x50f1ae;if(_0x3da863>=_0x5dfacd){_0x3da863=_0x5dfacd;_0x50f1ae=0xc8;}else{_0x50f1ae=0xce;}_0x30fc0b['status'](_0x50f1ae);return _0x30fc0b[_0x47b8('0x23')]('Content-Range',_0x4c1c0b+'-'+_0x3da863+'/'+_0x5dfacd)[_0x47b8('0x1e')](_0x1db4de);}return null;};}function patchUpdates(_0x227cd7){return function(_0x347306){try{jsonpatch[_0x47b8('0x24')](_0x347306,_0x227cd7,!![]);}catch(_0x3a764c){return BPromise[_0x47b8('0x25')](_0x3a764c);}return _0x347306[_0x47b8('0x26')]();};}function saveUpdates(_0x3a45c6,_0x51b6b9){return function(_0x153159){if(_0x153159){return _0x153159[_0x47b8('0x27')](_0x3a45c6)[_0x47b8('0x28')](function(_0x556a09){return _0x556a09;});}return null;};}function removeEntity(_0x3423e2,_0x1f1dd3){return function(_0x251756){if(_0x251756){return _0x251756['destroy']()[_0x47b8('0x28')](function(){_0x3423e2['status'](0xcc)[_0x47b8('0x1d')]();});}};}function handleEntityNotFound(_0x511dbd,_0x62c5db){return function(_0x3e40a1){if(!_0x3e40a1){_0x511dbd[_0x47b8('0x1b')](0x194);}return _0x3e40a1;};}function handleError(_0x177d5c,_0x287ce5){_0x287ce5=_0x287ce5||0x1f4;return function(_0x1dcd63){logger[_0x47b8('0x29')](_0x1dcd63[_0x47b8('0x2a')]);if(_0x1dcd63[_0x47b8('0x2b')]){delete _0x1dcd63[_0x47b8('0x2b')];}_0x177d5c[_0x47b8('0x1c')](_0x287ce5)[_0x47b8('0x2c')](_0x1dcd63);};}exports[_0x47b8('0x2d')]=function(_0x19a605,_0x573c69){var _0x541e0a={},_0x23a317={},_0x9edecd={'count':0x0,'rows':[]};var _0x3e7406=_[_0x47b8('0x2e')](db[_0x47b8('0x2f')]['rawAttributes'],function(_0x4ddef7){return{'name':_0x4ddef7[_0x47b8('0x30')],'type':_0x4ddef7['type'][_0x47b8('0x31')]};});_0x23a317[_0x47b8('0x32')]=_[_0x47b8('0x2e')](_0x3e7406,'name');_0x23a317[_0x47b8('0x33')]=_['keys'](_0x19a605[_0x47b8('0x33')]);_0x23a317['filters']=_[_0x47b8('0x34')](_0x23a317[_0x47b8('0x32')],_0x23a317['query']);_0x541e0a['attributes']=_[_0x47b8('0x34')](_0x23a317['model'],qs[_0x47b8('0x35')](_0x19a605[_0x47b8('0x33')][_0x47b8('0x35')]));_0x541e0a[_0x47b8('0x36')]=_0x541e0a[_0x47b8('0x36')][_0x47b8('0x37')]?_0x541e0a['attributes']:_0x23a317[_0x47b8('0x32')];if(!_0x19a605[_0x47b8('0x33')][_0x47b8('0x38')](_0x47b8('0x39'))){_0x541e0a[_0x47b8('0x21')]=qs[_0x47b8('0x21')](_0x19a605[_0x47b8('0x33')][_0x47b8('0x21')]);_0x541e0a['offset']=qs[_0x47b8('0x1f')](_0x19a605['query'][_0x47b8('0x1f')]);}_0x541e0a[_0x47b8('0x3a')]=qs[_0x47b8('0x3b')](_0x19a605[_0x47b8('0x33')][_0x47b8('0x3b')]);_0x541e0a[_0x47b8('0x3c')]=qs[_0x47b8('0x3d')](_[_0x47b8('0x3e')](_0x19a605[_0x47b8('0x33')],_0x23a317['filters']),_0x3e7406);if(_0x19a605['query'][_0x47b8('0x3f')]){_0x541e0a[_0x47b8('0x3c')]=_['merge'](_0x541e0a[_0x47b8('0x3c')],{'$or':_[_0x47b8('0x2e')](_0x3e7406,function(_0x52155b){if(_0x52155b[_0x47b8('0x40')]!==_0x47b8('0x41')){var _0x290c0a={};_0x290c0a[_0x52155b[_0x47b8('0x2b')]]={'$like':'%'+_0x19a605[_0x47b8('0x33')]['filter']+'%'};return _0x290c0a;}})});}_0x541e0a=_['merge']({},_0x541e0a,_0x19a605[_0x47b8('0x42')]);var _0xe80645={'where':_0x541e0a[_0x47b8('0x3c')]};return db[_0x47b8('0x2f')][_0x47b8('0x22')](_0xe80645)[_0x47b8('0x28')](function(_0x98aadb){_0x9edecd['count']=_0x98aadb;if(_0x19a605[_0x47b8('0x33')][_0x47b8('0x43')]){_0x541e0a[_0x47b8('0x44')]=[{'all':!![]}];}return db[_0x47b8('0x2f')][_0x47b8('0x45')](_0x541e0a);})[_0x47b8('0x28')](function(_0x576f23){_0x9edecd[_0x47b8('0x46')]=_0x576f23;return _0x9edecd;})[_0x47b8('0x28')](respondWithFilteredResult(_0x573c69,_0x541e0a))[_0x47b8('0x47')](handleError(_0x573c69,null));};exports[_0x47b8('0x48')]=function(_0x331a1d,_0x4a85be){var _0x56c59d={'raw':!![],'where':{'id':_0x331a1d['params']['id']}},_0x99ded6={};_0x99ded6[_0x47b8('0x32')]=_[_0x47b8('0x49')](db['ChatQueueReport'][_0x47b8('0x4a')]);_0x99ded6['query']=_[_0x47b8('0x49')](_0x331a1d[_0x47b8('0x33')]);_0x99ded6[_0x47b8('0x3d')]=_[_0x47b8('0x34')](_0x99ded6[_0x47b8('0x32')],_0x99ded6['query']);_0x56c59d[_0x47b8('0x36')]=_[_0x47b8('0x34')](_0x99ded6['model'],qs[_0x47b8('0x35')](_0x331a1d[_0x47b8('0x33')][_0x47b8('0x35')]));_0x56c59d[_0x47b8('0x36')]=_0x56c59d[_0x47b8('0x36')][_0x47b8('0x37')]?_0x56c59d[_0x47b8('0x36')]:_0x99ded6[_0x47b8('0x32')];if(_0x331a1d[_0x47b8('0x33')][_0x47b8('0x43')]){_0x56c59d[_0x47b8('0x44')]=[{'all':!![]}];}_0x56c59d=_['merge']({},_0x56c59d,_0x331a1d[_0x47b8('0x42')]);return db[_0x47b8('0x2f')][_0x47b8('0x4b')](_0x56c59d)['then'](handleEntityNotFound(_0x4a85be,null))[_0x47b8('0x28')](respondWithResult(_0x4a85be,null))['catch'](handleError(_0x4a85be,null));};exports[_0x47b8('0x4c')]=function(_0x4aed88,_0x35f4db){return db[_0x47b8('0x2f')][_0x47b8('0x4c')](_0x4aed88[_0x47b8('0x4d')],{})['then'](respondWithResult(_0x35f4db,0xc9))[_0x47b8('0x47')](handleError(_0x35f4db,null));};exports[_0x47b8('0x27')]=function(_0x165a31,_0x140df1){if(_0x165a31['body']['id']){delete _0x165a31[_0x47b8('0x4d')]['id'];}return db[_0x47b8('0x2f')][_0x47b8('0x4b')]({'where':{'id':_0x165a31[_0x47b8('0x4e')]['id']}})[_0x47b8('0x28')](handleEntityNotFound(_0x140df1,null))[_0x47b8('0x28')](saveUpdates(_0x165a31['body'],null))[_0x47b8('0x28')](respondWithResult(_0x140df1,null))[_0x47b8('0x47')](handleError(_0x140df1,null));};exports[_0x47b8('0x4f')]=function(_0x562eff,_0x411b23){return db[_0x47b8('0x2f')][_0x47b8('0x4b')]({'where':{'id':_0x562eff[_0x47b8('0x4e')]['id']}})['then'](handleEntityNotFound(_0x411b23,null))['then'](removeEntity(_0x411b23,null))[_0x47b8('0x47')](handleError(_0x411b23,null));};exports[_0x47b8('0x50')]=function(_0x814e6c,_0x9e4104){return db[_0x47b8('0x2f')][_0x47b8('0x50')]()[_0x47b8('0x28')](respondWithResult(_0x9e4104,null))[_0x47b8('0x47')](handleError(_0x9e4104,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 754ab97..336656a 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 _0xcb91=['path','rimraf','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x2cc3e7,_0x62ffb6){var _0x20179e=function(_0x1f1ede){while(--_0x1f1ede){_0x2cc3e7['push'](_0x2cc3e7['shift']());}};_0x20179e(++_0x62ffb6);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5f5cce,_0x138cc5){_0x5f5cce=_0x5f5cce-0x0;var _0x705ecf=_0xcb91[_0x5f5cce];return _0x705ecf;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('ChatQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x5071d9,_0x2dcf15){var _0x4b92d1=function(_0x2dfdd7){while(--_0x2dfdd7){_0x5071d9['push'](_0x5071d9['shift']());}};_0x4b92d1(++_0x2dcf15);}(_0xb7e7,0x121));var _0x7b7e=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0xb7e7[_0x513aa5];return _0x1a1a7c;};'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_chat_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 92ad761..f6966b8 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 _0xa832=['options','raw','UpdateChatQueueReport','update','body','where','attributes','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport'];(function(_0x3e864d,_0x43e000){var _0x24bd1b=function(_0x2e76f6){while(--_0x2e76f6){_0x3e864d['push'](_0x3e864d['shift']());}};_0x24bd1b(++_0x43e000);}(_0xa832,0x16f));var _0x2a83=function(_0x2bf67e,_0x16d378){_0x2bf67e=_0x2bf67e-0x0;var _0x5138d5=_0xa832[_0x2bf67e];return _0x5138d5;};'use strict';var _=require('lodash');var util=require(_0x2a83('0x0'));var moment=require(_0x2a83('0x1'));var BPromise=require(_0x2a83('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2a83('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2a83('0x4'));var logger=require(_0x2a83('0x5'))('rpc');var config=require(_0x2a83('0x6'));var jayson=require(_0x2a83('0x7'));var client=jayson['client'][_0x2a83('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5adb1a,_0x12733e,_0x1d296e){return new BPromise(function(_0x4512b2,_0x267f76){return client[_0x2a83('0x9')](_0x5adb1a,_0x1d296e)[_0x2a83('0xa')](function(_0x54ca5d){logger[_0x2a83('0xb')](_0x2a83('0xc'),_0x12733e,_0x2a83('0xd'));logger[_0x2a83('0xe')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x12733e,_0x2a83('0xd'),JSON[_0x2a83('0xf')](_0x54ca5d));if(_0x54ca5d[_0x2a83('0x10')]){if(_0x54ca5d[_0x2a83('0x10')][_0x2a83('0x11')]===0x1f4){logger[_0x2a83('0x10')](_0x2a83('0xc'),_0x12733e,_0x54ca5d['error']['message']);return _0x267f76(_0x54ca5d[_0x2a83('0x10')]['message']);}logger[_0x2a83('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0x12733e,_0x54ca5d['error'][_0x2a83('0x12')]);return _0x4512b2(_0x54ca5d[_0x2a83('0x10')]['message']);}else{logger[_0x2a83('0xb')](_0x2a83('0xc'),_0x12733e,_0x2a83('0xd'));_0x4512b2(_0x54ca5d[_0x2a83('0x13')][_0x2a83('0x12')]);}})[_0x2a83('0x14')](function(_0xf838d6){logger[_0x2a83('0x10')](_0x2a83('0xc'),_0x12733e,_0xf838d6);_0x267f76(_0xf838d6);});});}exports[_0x2a83('0x15')]=function(_0x1a8849){var _0x16dff7=this;return new Promise(function(_0x4a1d1c,_0x260c32){return db[_0x2a83('0x16')]['create'](_0x1a8849['body'],{'raw':_0x1a8849['options']?_0x1a8849[_0x2a83('0x17')][_0x2a83('0x18')]===undefined?!![]:![]:!![]})[_0x2a83('0xa')](function(_0x4a3232){logger[_0x2a83('0xb')](_0x2a83('0x15'),_0x1a8849);logger[_0x2a83('0xe')](_0x2a83('0x15'),_0x1a8849,JSON[_0x2a83('0xf')](_0x4a3232));_0x4a1d1c(_0x4a3232);})[_0x2a83('0x14')](function(_0x6d3dc7){logger[_0x2a83('0x10')](_0x2a83('0x15'),_0x6d3dc7[_0x2a83('0x12')],_0x1a8849);_0x260c32(_0x16dff7['error'](0x1f4,_0x6d3dc7['message']));});});};exports[_0x2a83('0x19')]=function(_0x2234a6){var _0x8afcec=this;return new Promise(function(_0x439888,_0x17fb6f){return db['ChatQueueReport'][_0x2a83('0x1a')](_0x2234a6[_0x2a83('0x1b')],{'raw':_0x2234a6[_0x2a83('0x17')]?_0x2234a6['options'][_0x2a83('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2234a6[_0x2a83('0x17')]?_0x2234a6['options'][_0x2a83('0x1c')]||null:null,'attributes':_0x2234a6['options']?_0x2234a6[_0x2a83('0x17')][_0x2a83('0x1d')]||null:null,'limit':_0x2234a6['options']?_0x2234a6[_0x2a83('0x17')]['limit']||null:null})[_0x2a83('0xa')](function(_0x40d8ea){logger[_0x2a83('0xb')](_0x2a83('0x19'),_0x2234a6);logger[_0x2a83('0xe')](_0x2a83('0x19'),_0x2234a6,JSON[_0x2a83('0xf')](_0x40d8ea));_0x439888(_0x40d8ea);})[_0x2a83('0x14')](function(_0x1c4feb){logger[_0x2a83('0x10')](_0x2a83('0x19'),_0x1c4feb[_0x2a83('0x12')],_0x2234a6);_0x17fb6f(_0x8afcec[_0x2a83('0x10')](0x1f4,_0x1c4feb[_0x2a83('0x12')]));});});}; \ No newline at end of file +var _0x2b88=['jayson/promise','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','options','raw','UpdateChatQueueReport','update','body','where','attributes','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x1a9d06,_0x4c70e3){var _0x7776b9=function(_0x37dfc0){while(--_0x37dfc0){_0x1a9d06['push'](_0x1a9d06['shift']());}};_0x7776b9(++_0x4c70e3);}(_0x2b88,0x1b1));var _0x82b8=function(_0x5d5c49,_0x528f94){_0x5d5c49=_0x5d5c49-0x0;var _0x41cb72=_0x2b88[_0x5d5c49];return _0x41cb72;};'use strict';var _=require(_0x82b8('0x0'));var util=require(_0x82b8('0x1'));var moment=require('moment');var BPromise=require(_0x82b8('0x2'));var rs=require(_0x82b8('0x3'));var fs=require('fs');var Redis=require(_0x82b8('0x4'));var db=require(_0x82b8('0x5'))['db'];var utils=require(_0x82b8('0x6'));var logger=require('../../config/logger')(_0x82b8('0x7'));var config=require(_0x82b8('0x8'));var jayson=require(_0x82b8('0x9'));var client=jayson['client'][_0x82b8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13f2d0,_0x41f35f,_0xccf541){return new BPromise(function(_0x30231a,_0x531491){return client[_0x82b8('0xb')](_0x13f2d0,_0xccf541)[_0x82b8('0xc')](function(_0x33a04a){logger[_0x82b8('0xd')](_0x82b8('0xe'),_0x41f35f,_0x82b8('0xf'));logger[_0x82b8('0x10')](_0x82b8('0x11'),_0x41f35f,_0x82b8('0xf'),JSON[_0x82b8('0x12')](_0x33a04a));if(_0x33a04a[_0x82b8('0x13')]){if(_0x33a04a[_0x82b8('0x13')][_0x82b8('0x14')]===0x1f4){logger[_0x82b8('0x13')](_0x82b8('0xe'),_0x41f35f,_0x33a04a[_0x82b8('0x13')][_0x82b8('0x15')]);return _0x531491(_0x33a04a[_0x82b8('0x13')]['message']);}logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x41f35f,_0x33a04a[_0x82b8('0x13')][_0x82b8('0x15')]);return _0x30231a(_0x33a04a[_0x82b8('0x13')]['message']);}else{logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x41f35f,'request\x20sent');_0x30231a(_0x33a04a[_0x82b8('0x16')][_0x82b8('0x15')]);}})[_0x82b8('0x17')](function(_0x35b09c){logger['error'](_0x82b8('0xe'),_0x41f35f,_0x35b09c);_0x531491(_0x35b09c);});});}exports[_0x82b8('0x18')]=function(_0x49a755){var _0x35324c=this;return new Promise(function(_0x2161e1,_0x33e945){return db[_0x82b8('0x19')][_0x82b8('0x1a')](_0x49a755['body'],{'raw':_0x49a755[_0x82b8('0x1b')]?_0x49a755['options'][_0x82b8('0x1c')]===undefined?!![]:![]:!![]})[_0x82b8('0xc')](function(_0x2fce2f){logger['info'](_0x82b8('0x18'),_0x49a755);logger[_0x82b8('0x10')]('CreateChatQueueReport',_0x49a755,JSON[_0x82b8('0x12')](_0x2fce2f));_0x2161e1(_0x2fce2f);})[_0x82b8('0x17')](function(_0x1c54d8){logger[_0x82b8('0x13')](_0x82b8('0x18'),_0x1c54d8[_0x82b8('0x15')],_0x49a755);_0x33e945(_0x35324c['error'](0x1f4,_0x1c54d8[_0x82b8('0x15')]));});});};exports[_0x82b8('0x1d')]=function(_0x20b7cd){var _0x5831c3=this;return new Promise(function(_0x9aa23c,_0x3315d5){return db[_0x82b8('0x19')][_0x82b8('0x1e')](_0x20b7cd[_0x82b8('0x1f')],{'raw':_0x20b7cd[_0x82b8('0x1b')]?_0x20b7cd['options'][_0x82b8('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20b7cd[_0x82b8('0x1b')]?_0x20b7cd['options'][_0x82b8('0x20')]||null:null,'attributes':_0x20b7cd[_0x82b8('0x1b')]?_0x20b7cd[_0x82b8('0x1b')][_0x82b8('0x21')]||null:null,'limit':_0x20b7cd['options']?_0x20b7cd[_0x82b8('0x1b')]['limit']||null:null})[_0x82b8('0xc')](function(_0x9263aa){logger[_0x82b8('0xd')](_0x82b8('0x1d'),_0x20b7cd);logger[_0x82b8('0x10')]('UpdateChatQueueReport',_0x20b7cd,JSON[_0x82b8('0x12')](_0x9263aa));_0x9aa23c(_0x9263aa);})[_0x82b8('0x17')](function(_0x58b4b0){logger[_0x82b8('0x13')]('UpdateChatQueueReport',_0x58b4b0[_0x82b8('0x15')],_0x20b7cd);_0x3315d5(_0x5831c3[_0x82b8('0x13')](0x1f4,_0x58b4b0['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index f55bc6d..90df9ed 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 _0xa7bc=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','isAuthenticated','index','get','/describe','/:id','show','create','put','update','destroy','exports','multer','util','path'];(function(_0x5ad555,_0x35e672){var _0x346bb9=function(_0x4ff069){while(--_0x4ff069){_0x5ad555['push'](_0x5ad555['shift']());}};_0x346bb9(++_0x35e672);}(_0xa7bc,0x173));var _0xca7b=function(_0x4965ac,_0x5dada2){_0x4965ac=_0x4965ac-0x0;var _0x5a35c2=_0xa7bc[_0x4965ac];return _0x5a35c2;};'use strict';var multer=require(_0xca7b('0x0'));var util=require(_0xca7b('0x1'));var path=require(_0xca7b('0x2'));var timeout=require(_0xca7b('0x3'));var express=require(_0xca7b('0x4'));var router=express[_0xca7b('0x5')]();var fs_extra=require(_0xca7b('0x6'));var auth=require(_0xca7b('0x7'));var interaction=require(_0xca7b('0x8'));var config=require(_0xca7b('0x9'));var controller=require(_0xca7b('0xa'));router['get']('/',auth[_0xca7b('0xb')](),controller[_0xca7b('0xc')]);router[_0xca7b('0xd')](_0xca7b('0xe'),auth[_0xca7b('0xb')](),controller['describe']);router['get'](_0xca7b('0xf'),auth['isAuthenticated'](),controller[_0xca7b('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xca7b('0x11')]);router[_0xca7b('0x12')](_0xca7b('0xf'),auth[_0xca7b('0xb')](),controller[_0xca7b('0x13')]);router['delete'](_0xca7b('0xf'),auth[_0xca7b('0xb')](),controller[_0xca7b('0x14')]);module[_0xca7b('0x15')]=router; \ No newline at end of file +var _0x7732=['create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','./chatQueueReport.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0x42b515,_0x30b55e){var _0x1de82b=function(_0x1c4e81){while(--_0x1c4e81){_0x42b515['push'](_0x42b515['shift']());}};_0x1de82b(++_0x30b55e);}(_0x7732,0xb1));var _0x2773=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x7732[_0x2112d4];return _0x434972;};'use strict';var multer=require(_0x2773('0x0'));var util=require(_0x2773('0x1'));var path=require(_0x2773('0x2'));var timeout=require('connect-timeout');var express=require(_0x2773('0x3'));var router=express[_0x2773('0x4')]();var fs_extra=require(_0x2773('0x5'));var auth=require(_0x2773('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2773('0x7'));router[_0x2773('0x8')]('/',auth[_0x2773('0x9')](),controller['index']);router[_0x2773('0x8')](_0x2773('0xa'),auth[_0x2773('0x9')](),controller[_0x2773('0xb')]);router[_0x2773('0x8')](_0x2773('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x2773('0x9')](),controller[_0x2773('0xd')]);router[_0x2773('0xe')]('/:id',auth[_0x2773('0x9')](),controller[_0x2773('0xf')]);router[_0x2773('0x10')](_0x2773('0xc'),auth[_0x2773('0x9')](),controller[_0x2773('0x11')]);module[_0x2773('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 b171b2c..7e97a76 100644 --- a/server/api/chatTransferReport/chatTransferReport.attributes.js +++ b/server/api/chatTransferReport/chatTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x45b892,_0x3f7e45){var _0x208a1d=function(_0x5cb604){while(--_0x5cb604){_0x45b892['push'](_0x45b892['shift']());}};_0x208a1d(++_0x3f7e45);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x19159a,_0x1cb5c3){_0x19159a=_0x19159a-0x0;var _0xa677f4=_0xcb91[_0x19159a];return _0xa677f4;};'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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x4d04d6,_0x38ae19){var _0x2e937a=function(_0x4961c8){while(--_0x4961c8){_0x4d04d6['push'](_0x4d04d6['shift']());}};_0x2e937a(++_0x38ae19);}(_0x9c44,0x178));var _0x49c4=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x9c44[_0x32f7d7];return _0x133d09;};'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/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 2b9af9e..369519f 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 _0x70a5=['undefined','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','name','send','index','map','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','ChatTransferReport','findAll','rows','catch','params','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end'];(function(_0x12a04a,_0x4e3d1a){var _0x6d5409=function(_0x2b3c9f){while(--_0x2b3c9f){_0x12a04a['push'](_0x12a04a['shift']());}};_0x6d5409(++_0x4e3d1a);}(_0x70a5,0x7b));var _0x570a=function(_0x4ab830,_0x47921f){_0x4ab830=_0x4ab830-0x0;var _0x49c499=_0x70a5[_0x4ab830];return _0x49c499;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x570a('0x0'));var zipdir=require(_0x570a('0x1'));var jsonpatch=require(_0x570a('0x2'));var rp=require(_0x570a('0x3'));var moment=require('moment');var BPromise=require(_0x570a('0x4'));var Mustache=require(_0x570a('0x5'));var util=require(_0x570a('0x6'));var path=require(_0x570a('0x7'));var sox=require(_0x570a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x570a('0x9'));var _=require(_0x570a('0xa'));var squel=require('squel');var crypto=require(_0x570a('0xb'));var jsforce=require(_0x570a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x570a('0xd'));var querystring=require(_0x570a('0xe'));var Papa=require(_0x570a('0xf'));var Redis=require(_0x570a('0x10'));var authService=require(_0x570a('0x11'));var qs=require(_0x570a('0x12'));var as=require(_0x570a('0x13'));var hardwareService=require(_0x570a('0x14'));var logger=require('../../config/logger')(_0x570a('0x15'));var utils=require(_0x570a('0x16'));var config=require(_0x570a('0x17'));var licenseUtil=require(_0x570a('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xcafb61,_0x1403d8){_0x1403d8=_0x1403d8||0xcc;return function(_0x1d02e8){if(_0x1d02e8){return _0xcafb61['sendStatus'](_0x1403d8);}return _0xcafb61[_0x570a('0x19')](_0x1403d8)[_0x570a('0x1a')]();};}function respondWithResult(_0x1ce01b,_0x164d2e){_0x164d2e=_0x164d2e||0xc8;return function(_0x34e875){if(_0x34e875){return _0x1ce01b[_0x570a('0x19')](_0x164d2e)['json'](_0x34e875);}};}function respondWithFilteredResult(_0x773978,_0xcc7610){return function(_0x2eaa1f){if(_0x2eaa1f){var _0x2dd5cd=typeof _0xcc7610['offset']===_0x570a('0x1b')&&typeof _0xcc7610['limit']===_0x570a('0x1b');var _0x1a3bc6=_0x2eaa1f[_0x570a('0x1c')];var _0x1d3d98=_0x2dd5cd?0x0:_0xcc7610[_0x570a('0x1d')];var _0x1a89f8=_0x2dd5cd?_0x2eaa1f[_0x570a('0x1c')]:_0xcc7610[_0x570a('0x1d')]+_0xcc7610['limit'];var _0x46a9ce;if(_0x1a89f8>=_0x1a3bc6){_0x1a89f8=_0x1a3bc6;_0x46a9ce=0xc8;}else{_0x46a9ce=0xce;}_0x773978[_0x570a('0x19')](_0x46a9ce);return _0x773978['set'](_0x570a('0x1e'),_0x1d3d98+'-'+_0x1a89f8+'/'+_0x1a3bc6)[_0x570a('0x1f')](_0x2eaa1f);}return null;};}function patchUpdates(_0x3761eb){return function(_0x3673ce){try{jsonpatch[_0x570a('0x20')](_0x3673ce,_0x3761eb,!![]);}catch(_0x2c5aa1){return BPromise[_0x570a('0x21')](_0x2c5aa1);}return _0x3673ce[_0x570a('0x22')]();};}function saveUpdates(_0x293544,_0x40e75b){return function(_0x7cb61e){if(_0x7cb61e){return _0x7cb61e[_0x570a('0x23')](_0x293544)[_0x570a('0x24')](function(_0x55a3d4){return _0x55a3d4;});}return null;};}function removeEntity(_0x525799,_0x594a25){return function(_0x5c90cf){if(_0x5c90cf){return _0x5c90cf[_0x570a('0x25')]()[_0x570a('0x24')](function(){_0x525799[_0x570a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x79aef3,_0x1e7750){return function(_0x11c1e5){if(!_0x11c1e5){_0x79aef3[_0x570a('0x26')](0x194);}return _0x11c1e5;};}function handleError(_0xf83502,_0xe66f2c){_0xe66f2c=_0xe66f2c||0x1f4;return function(_0x4e5f1a){logger['error'](_0x4e5f1a['stack']);if(_0x4e5f1a['name']){delete _0x4e5f1a[_0x570a('0x27')];}_0xf83502[_0x570a('0x19')](_0xe66f2c)[_0x570a('0x28')](_0x4e5f1a);};}exports[_0x570a('0x29')]=function(_0x49d087,_0x1248e0){var _0x32334a={},_0x340c80={},_0x42a866={'count':0x0,'rows':[]};var _0x925a2a=_[_0x570a('0x2a')](db['ChatTransferReport'][_0x570a('0x2b')],function(_0x1f0a76){return{'name':_0x1f0a76[_0x570a('0x2c')],'type':_0x1f0a76['type']['key']};});_0x340c80[_0x570a('0x2d')]=_[_0x570a('0x2a')](_0x925a2a,_0x570a('0x27'));_0x340c80['query']=_[_0x570a('0x2e')](_0x49d087[_0x570a('0x2f')]);_0x340c80[_0x570a('0x30')]=_[_0x570a('0x31')](_0x340c80['model'],_0x340c80[_0x570a('0x2f')]);_0x32334a[_0x570a('0x32')]=_[_0x570a('0x31')](_0x340c80[_0x570a('0x2d')],qs[_0x570a('0x33')](_0x49d087[_0x570a('0x2f')][_0x570a('0x33')]));_0x32334a[_0x570a('0x32')]=_0x32334a[_0x570a('0x32')][_0x570a('0x34')]?_0x32334a[_0x570a('0x32')]:_0x340c80[_0x570a('0x2d')];if(!_0x49d087[_0x570a('0x2f')]['hasOwnProperty'](_0x570a('0x35'))){_0x32334a[_0x570a('0x36')]=qs['limit'](_0x49d087[_0x570a('0x2f')][_0x570a('0x36')]);_0x32334a[_0x570a('0x1d')]=qs['offset'](_0x49d087[_0x570a('0x2f')][_0x570a('0x1d')]);}_0x32334a[_0x570a('0x37')]=qs[_0x570a('0x38')](_0x49d087[_0x570a('0x2f')]['sort']);_0x32334a[_0x570a('0x39')]=qs[_0x570a('0x30')](_[_0x570a('0x3a')](_0x49d087[_0x570a('0x2f')],_0x340c80[_0x570a('0x30')]),_0x925a2a);if(_0x49d087[_0x570a('0x2f')][_0x570a('0x3b')]){_0x32334a[_0x570a('0x39')]=_[_0x570a('0x3c')](_0x32334a['where'],{'$or':_['map'](_0x925a2a,function(_0x1da7c9){if(_0x1da7c9[_0x570a('0x3d')]!==_0x570a('0x3e')){var _0x459b30={};_0x459b30[_0x1da7c9[_0x570a('0x27')]]={'$like':'%'+_0x49d087[_0x570a('0x2f')][_0x570a('0x3b')]+'%'};return _0x459b30;}})});}_0x32334a=_[_0x570a('0x3c')]({},_0x32334a,_0x49d087[_0x570a('0x3f')]);var _0x15f05d={'where':_0x32334a['where']};return db['ChatTransferReport'][_0x570a('0x1c')](_0x15f05d)[_0x570a('0x24')](function(_0x1c45a8){_0x42a866[_0x570a('0x1c')]=_0x1c45a8;if(_0x49d087[_0x570a('0x2f')][_0x570a('0x40')]){_0x32334a[_0x570a('0x41')]=[{'all':!![]}];}return db[_0x570a('0x42')][_0x570a('0x43')](_0x32334a);})[_0x570a('0x24')](function(_0xc532e1){_0x42a866[_0x570a('0x44')]=_0xc532e1;return _0x42a866;})[_0x570a('0x24')](respondWithFilteredResult(_0x1248e0,_0x32334a))[_0x570a('0x45')](handleError(_0x1248e0,null));};exports['show']=function(_0x3605c2,_0x4de68f){var _0x1a5a22={'raw':!![],'where':{'id':_0x3605c2[_0x570a('0x46')]['id']}},_0x2c4717={};_0x2c4717[_0x570a('0x2d')]=_[_0x570a('0x2e')](db[_0x570a('0x42')][_0x570a('0x2b')]);_0x2c4717[_0x570a('0x2f')]=_['keys'](_0x3605c2['query']);_0x2c4717['filters']=_[_0x570a('0x31')](_0x2c4717[_0x570a('0x2d')],_0x2c4717[_0x570a('0x2f')]);_0x1a5a22[_0x570a('0x32')]=_['intersection'](_0x2c4717[_0x570a('0x2d')],qs[_0x570a('0x33')](_0x3605c2['query'][_0x570a('0x33')]));_0x1a5a22[_0x570a('0x32')]=_0x1a5a22[_0x570a('0x32')][_0x570a('0x34')]?_0x1a5a22[_0x570a('0x32')]:_0x2c4717[_0x570a('0x2d')];if(_0x3605c2[_0x570a('0x2f')][_0x570a('0x40')]){_0x1a5a22[_0x570a('0x41')]=[{'all':!![]}];}_0x1a5a22=_[_0x570a('0x3c')]({},_0x1a5a22,_0x3605c2[_0x570a('0x3f')]);return db['ChatTransferReport']['find'](_0x1a5a22)[_0x570a('0x24')](handleEntityNotFound(_0x4de68f,null))['then'](respondWithResult(_0x4de68f,null))[_0x570a('0x45')](handleError(_0x4de68f,null));};exports[_0x570a('0x47')]=function(_0x310210,_0x3f6e40){return db[_0x570a('0x42')][_0x570a('0x47')](_0x310210['body'],{})[_0x570a('0x24')](respondWithResult(_0x3f6e40,0xc9))[_0x570a('0x45')](handleError(_0x3f6e40,null));};exports[_0x570a('0x23')]=function(_0x132b4d,_0x4598df){if(_0x132b4d[_0x570a('0x48')]['id']){delete _0x132b4d['body']['id'];}return db['ChatTransferReport'][_0x570a('0x49')]({'where':{'id':_0x132b4d[_0x570a('0x46')]['id']}})[_0x570a('0x24')](handleEntityNotFound(_0x4598df,null))[_0x570a('0x24')](saveUpdates(_0x132b4d[_0x570a('0x48')],null))[_0x570a('0x24')](respondWithResult(_0x4598df,null))[_0x570a('0x45')](handleError(_0x4598df,null));};exports[_0x570a('0x25')]=function(_0x35749,_0x392711){return db[_0x570a('0x42')][_0x570a('0x49')]({'where':{'id':_0x35749[_0x570a('0x46')]['id']}})[_0x570a('0x24')](handleEntityNotFound(_0x392711,null))[_0x570a('0x24')](removeEntity(_0x392711,null))[_0x570a('0x45')](handleError(_0x392711,null));};exports['describe']=function(_0x3865fc,_0x115682){return db[_0x570a('0x42')][_0x570a('0x4a')]()[_0x570a('0x24')](respondWithResult(_0x115682,null))['catch'](handleError(_0x115682,null));}; \ No newline at end of file +var _0x29c1=['length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','status','end','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','params','keys'];(function(_0x4e9dcb,_0xd1fb87){var _0x5105fc=function(_0x2df827){while(--_0x2df827){_0x4e9dcb['push'](_0x4e9dcb['shift']());}};_0x5105fc(++_0xd1fb87);}(_0x29c1,0x1c7));var _0x129c=function(_0x781647,_0x18edc0){_0x781647=_0x781647-0x0;var _0x56fcdb=_0x29c1[_0x781647];return _0x56fcdb;};'use strict';var emlformat=require(_0x129c('0x0'));var rimraf=require(_0x129c('0x1'));var zipdir=require(_0x129c('0x2'));var jsonpatch=require(_0x129c('0x3'));var rp=require(_0x129c('0x4'));var moment=require(_0x129c('0x5'));var BPromise=require(_0x129c('0x6'));var Mustache=require(_0x129c('0x7'));var util=require(_0x129c('0x8'));var path=require(_0x129c('0x9'));var sox=require(_0x129c('0xa'));var csv=require('to-csv');var ejs=require(_0x129c('0xb'));var fs=require('fs');var fs_extra=require(_0x129c('0xc'));var _=require(_0x129c('0xd'));var squel=require(_0x129c('0xe'));var crypto=require(_0x129c('0xf'));var jsforce=require(_0x129c('0x10'));var deskjs=require(_0x129c('0x11'));var toCsv=require(_0x129c('0x12'));var querystring=require('querystring');var Papa=require(_0x129c('0x13'));var Redis=require(_0x129c('0x14'));var authService=require(_0x129c('0x15'));var qs=require(_0x129c('0x16'));var as=require(_0x129c('0x17'));var hardwareService=require(_0x129c('0x18'));var logger=require(_0x129c('0x19'))(_0x129c('0x1a'));var utils=require('../../config/utils');var config=require(_0x129c('0x1b'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48f3b3,_0x56a63b){_0x56a63b=_0x56a63b||0xcc;return function(_0x24785a){if(_0x24785a){return _0x48f3b3['sendStatus'](_0x56a63b);}return _0x48f3b3[_0x129c('0x1c')](_0x56a63b)[_0x129c('0x1d')]();};}function respondWithResult(_0x14bd93,_0x51d514){_0x51d514=_0x51d514||0xc8;return function(_0x3d08b2){if(_0x3d08b2){return _0x14bd93[_0x129c('0x1c')](_0x51d514)[_0x129c('0x1e')](_0x3d08b2);}};}function respondWithFilteredResult(_0x326890,_0x400f8c){return function(_0x54f8ce){if(_0x54f8ce){var _0x4c4bce=typeof _0x400f8c['offset']===_0x129c('0x1f')&&typeof _0x400f8c[_0x129c('0x20')]===_0x129c('0x1f');var _0x2b7939=_0x54f8ce[_0x129c('0x21')];var _0x34ee0b=_0x4c4bce?0x0:_0x400f8c[_0x129c('0x22')];var _0x201359=_0x4c4bce?_0x54f8ce[_0x129c('0x21')]:_0x400f8c[_0x129c('0x22')]+_0x400f8c[_0x129c('0x20')];var _0x1309b8;if(_0x201359>=_0x2b7939){_0x201359=_0x2b7939;_0x1309b8=0xc8;}else{_0x1309b8=0xce;}_0x326890['status'](_0x1309b8);return _0x326890['set'](_0x129c('0x23'),_0x34ee0b+'-'+_0x201359+'/'+_0x2b7939)[_0x129c('0x1e')](_0x54f8ce);}return null;};}function patchUpdates(_0x4b1003){return function(_0x3cbffa){try{jsonpatch['apply'](_0x3cbffa,_0x4b1003,!![]);}catch(_0x116381){return BPromise[_0x129c('0x24')](_0x116381);}return _0x3cbffa[_0x129c('0x25')]();};}function saveUpdates(_0x3a7b40,_0x1e363b){return function(_0x3cab81){if(_0x3cab81){return _0x3cab81[_0x129c('0x26')](_0x3a7b40)[_0x129c('0x27')](function(_0xed5304){return _0xed5304;});}return null;};}function removeEntity(_0x5abf95,_0x17ba8c){return function(_0x22c772){if(_0x22c772){return _0x22c772[_0x129c('0x28')]()[_0x129c('0x27')](function(){_0x5abf95[_0x129c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x158bca,_0x5406d2){return function(_0xbf9fac){if(!_0xbf9fac){_0x158bca['sendStatus'](0x194);}return _0xbf9fac;};}function handleError(_0x12c650,_0x1d3b7c){_0x1d3b7c=_0x1d3b7c||0x1f4;return function(_0x1b4d59){logger[_0x129c('0x29')](_0x1b4d59[_0x129c('0x2a')]);if(_0x1b4d59['name']){delete _0x1b4d59[_0x129c('0x2b')];}_0x12c650[_0x129c('0x1c')](_0x1d3b7c)[_0x129c('0x2c')](_0x1b4d59);};}exports['index']=function(_0x383ad1,_0x2462b4){var _0x5259e6={},_0x4e8193={},_0x5d7110={'count':0x0,'rows':[]};var _0x16a0fe=_[_0x129c('0x2d')](db[_0x129c('0x2e')][_0x129c('0x2f')],function(_0xc6ad63){return{'name':_0xc6ad63[_0x129c('0x30')],'type':_0xc6ad63[_0x129c('0x31')][_0x129c('0x32')]};});_0x4e8193[_0x129c('0x33')]=_[_0x129c('0x2d')](_0x16a0fe,_0x129c('0x2b'));_0x4e8193[_0x129c('0x34')]=_['keys'](_0x383ad1['query']);_0x4e8193[_0x129c('0x35')]=_[_0x129c('0x36')](_0x4e8193['model'],_0x4e8193[_0x129c('0x34')]);_0x5259e6[_0x129c('0x37')]=_[_0x129c('0x36')](_0x4e8193[_0x129c('0x33')],qs[_0x129c('0x38')](_0x383ad1[_0x129c('0x34')][_0x129c('0x38')]));_0x5259e6[_0x129c('0x37')]=_0x5259e6[_0x129c('0x37')]['length']?_0x5259e6[_0x129c('0x37')]:_0x4e8193[_0x129c('0x33')];if(!_0x383ad1[_0x129c('0x34')][_0x129c('0x39')]('nolimit')){_0x5259e6[_0x129c('0x20')]=qs[_0x129c('0x20')](_0x383ad1['query'][_0x129c('0x20')]);_0x5259e6[_0x129c('0x22')]=qs['offset'](_0x383ad1[_0x129c('0x34')][_0x129c('0x22')]);}_0x5259e6['order']=qs[_0x129c('0x3a')](_0x383ad1[_0x129c('0x34')][_0x129c('0x3a')]);_0x5259e6[_0x129c('0x3b')]=qs['filters'](_[_0x129c('0x3c')](_0x383ad1[_0x129c('0x34')],_0x4e8193['filters']),_0x16a0fe);if(_0x383ad1[_0x129c('0x34')]['filter']){_0x5259e6[_0x129c('0x3b')]=_[_0x129c('0x3d')](_0x5259e6['where'],{'$or':_[_0x129c('0x2d')](_0x16a0fe,function(_0x3882b5){if(_0x3882b5[_0x129c('0x31')]!==_0x129c('0x3e')){var _0x82d237={};_0x82d237[_0x3882b5[_0x129c('0x2b')]]={'$like':'%'+_0x383ad1['query']['filter']+'%'};return _0x82d237;}})});}_0x5259e6=_[_0x129c('0x3d')]({},_0x5259e6,_0x383ad1[_0x129c('0x3f')]);var _0x59eb15={'where':_0x5259e6[_0x129c('0x3b')]};return db[_0x129c('0x2e')][_0x129c('0x21')](_0x59eb15)[_0x129c('0x27')](function(_0x21b957){_0x5d7110[_0x129c('0x21')]=_0x21b957;if(_0x383ad1[_0x129c('0x34')][_0x129c('0x40')]){_0x5259e6[_0x129c('0x41')]=[{'all':!![]}];}return db['ChatTransferReport']['findAll'](_0x5259e6);})[_0x129c('0x27')](function(_0x47e4ef){_0x5d7110[_0x129c('0x42')]=_0x47e4ef;return _0x5d7110;})[_0x129c('0x27')](respondWithFilteredResult(_0x2462b4,_0x5259e6))[_0x129c('0x43')](handleError(_0x2462b4,null));};exports['show']=function(_0x3fed51,_0x3e0b62){var _0x2e262a={'raw':!![],'where':{'id':_0x3fed51[_0x129c('0x44')]['id']}},_0x34a84d={};_0x34a84d[_0x129c('0x33')]=_[_0x129c('0x45')](db[_0x129c('0x2e')][_0x129c('0x2f')]);_0x34a84d[_0x129c('0x34')]=_['keys'](_0x3fed51[_0x129c('0x34')]);_0x34a84d[_0x129c('0x35')]=_[_0x129c('0x36')](_0x34a84d[_0x129c('0x33')],_0x34a84d[_0x129c('0x34')]);_0x2e262a[_0x129c('0x37')]=_[_0x129c('0x36')](_0x34a84d[_0x129c('0x33')],qs['fields'](_0x3fed51[_0x129c('0x34')][_0x129c('0x38')]));_0x2e262a[_0x129c('0x37')]=_0x2e262a[_0x129c('0x37')][_0x129c('0x46')]?_0x2e262a[_0x129c('0x37')]:_0x34a84d[_0x129c('0x33')];if(_0x3fed51['query'][_0x129c('0x40')]){_0x2e262a[_0x129c('0x41')]=[{'all':!![]}];}_0x2e262a=_[_0x129c('0x3d')]({},_0x2e262a,_0x3fed51[_0x129c('0x3f')]);return db[_0x129c('0x2e')][_0x129c('0x47')](_0x2e262a)[_0x129c('0x27')](handleEntityNotFound(_0x3e0b62,null))[_0x129c('0x27')](respondWithResult(_0x3e0b62,null))['catch'](handleError(_0x3e0b62,null));};exports[_0x129c('0x48')]=function(_0x5b28a7,_0x306f30){return db[_0x129c('0x2e')]['create'](_0x5b28a7[_0x129c('0x49')],{})['then'](respondWithResult(_0x306f30,0xc9))[_0x129c('0x43')](handleError(_0x306f30,null));};exports[_0x129c('0x26')]=function(_0x18aa0e,_0x4722f5){if(_0x18aa0e['body']['id']){delete _0x18aa0e[_0x129c('0x49')]['id'];}return db['ChatTransferReport'][_0x129c('0x47')]({'where':{'id':_0x18aa0e[_0x129c('0x44')]['id']}})[_0x129c('0x27')](handleEntityNotFound(_0x4722f5,null))[_0x129c('0x27')](saveUpdates(_0x18aa0e['body'],null))[_0x129c('0x27')](respondWithResult(_0x4722f5,null))[_0x129c('0x43')](handleError(_0x4722f5,null));};exports[_0x129c('0x28')]=function(_0x3bec16,_0x1750b7){return db[_0x129c('0x2e')][_0x129c('0x47')]({'where':{'id':_0x3bec16[_0x129c('0x44')]['id']}})[_0x129c('0x27')](handleEntityNotFound(_0x1750b7,null))[_0x129c('0x27')](removeEntity(_0x1750b7,null))[_0x129c('0x43')](handleError(_0x1750b7,null));};exports[_0x129c('0x4a')]=function(_0x446023,_0x202151){return db[_0x129c('0x2e')][_0x129c('0x4a')]()[_0x129c('0x27')](respondWithResult(_0x202151,null))['catch'](handleError(_0x202151,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index eea543f..61bef34 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 _0x0154=['ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','define'];(function(_0x3a13cf,_0x478c62){var _0x4817c=function(_0x3a2e75){while(--_0x3a2e75){_0x3a13cf['push'](_0x3a13cf['shift']());}};_0x4817c(++_0x478c62);}(_0x0154,0x71));var _0x4015=function(_0x14a4ff,_0x7fcb89){_0x14a4ff=_0x14a4ff-0x0;var _0x2bd22d=_0x0154[_0x14a4ff];return _0x2bd22d;};'use strict';var _=require(_0x4015('0x0'));var util=require(_0x4015('0x1'));var logger=require(_0x4015('0x2'))('api');var moment=require(_0x4015('0x3'));var BPromise=require(_0x4015('0x4'));var rp=require(_0x4015('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4015('0x6'));var config=require('../../config/environment');var attributes=require('./chatTransferReport.attributes');module['exports']=function(_0x11bdd0,_0x45b284){return _0x11bdd0[_0x4015('0x7')](_0x4015('0x8'),attributes,{'tableName':_0x4015('0x9'),'paranoid':![],'indexes':[{'name':_0x4015('0xa'),'fields':[_0x4015('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb3d=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports','report_chat_transfer','uniqueid','util'];(function(_0x14a468,_0x63dcdf){var _0x4305c6=function(_0x5e1b0e){while(--_0x5e1b0e){_0x14a468['push'](_0x14a468['shift']());}};_0x4305c6(++_0x63dcdf);}(_0xcb3d,0x9f));var _0xdcb3=function(_0x55642e,_0x3f7ab6){_0x55642e=_0x55642e-0x0;var _0x3e5fc9=_0xcb3d[_0x55642e];return _0x3e5fc9;};'use strict';var _=require('lodash');var util=require(_0xdcb3('0x0'));var logger=require(_0xdcb3('0x1'))(_0xdcb3('0x2'));var moment=require('moment');var BPromise=require(_0xdcb3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdcb3('0x4'));var rimraf=require(_0xdcb3('0x5'));var config=require(_0xdcb3('0x6'));var attributes=require('./chatTransferReport.attributes');module[_0xdcb3('0x7')]=function(_0x26e449,_0x52a5a7){return _0x26e449['define']('ChatTransferReport',attributes,{'tableName':_0xdcb3('0x8'),'paranoid':![],'indexes':[{'name':_0xdcb3('0x9'),'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 9e46711..d04c985 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 _0x1c4a=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','ChatTransferReport,\x20%s,\x20%s','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x32c3c2,_0x42a5bf){var _0x43070a=function(_0x12d21d){while(--_0x12d21d){_0x32c3c2['push'](_0x32c3c2['shift']());}};_0x43070a(++_0x42a5bf);}(_0x1c4a,0x71));var _0xa1c4=function(_0x17de86,_0x514d01){_0x17de86=_0x17de86-0x0;var _0xdc4ef4=_0x1c4a[_0x17de86];return _0xdc4ef4;};'use strict';var _=require('lodash');var util=require(_0xa1c4('0x0'));var moment=require(_0xa1c4('0x1'));var BPromise=require(_0xa1c4('0x2'));var rs=require(_0xa1c4('0x3'));var fs=require('fs');var Redis=require(_0xa1c4('0x4'));var db=require(_0xa1c4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa1c4('0x6'))(_0xa1c4('0x7'));var config=require(_0xa1c4('0x8'));var jayson=require(_0xa1c4('0x9'));var client=jayson[_0xa1c4('0xa')][_0xa1c4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8316b1,_0x491938,_0x395d77){return new BPromise(function(_0x5b7851,_0x45af8e){return client['request'](_0x8316b1,_0x395d77)['then'](function(_0x14d852){logger[_0xa1c4('0xc')](_0xa1c4('0xd'),_0x491938,'request\x20sent');logger[_0xa1c4('0xe')](_0xa1c4('0xf'),_0x491938,_0xa1c4('0x10'),JSON['stringify'](_0x14d852));if(_0x14d852[_0xa1c4('0x11')]){if(_0x14d852['error'][_0xa1c4('0x12')]===0x1f4){logger[_0xa1c4('0x11')](_0xa1c4('0xd'),_0x491938,_0x14d852['error'][_0xa1c4('0x13')]);return _0x45af8e(_0x14d852[_0xa1c4('0x11')][_0xa1c4('0x13')]);}logger[_0xa1c4('0x11')](_0xa1c4('0xd'),_0x491938,_0x14d852[_0xa1c4('0x11')][_0xa1c4('0x13')]);return _0x5b7851(_0x14d852['error'][_0xa1c4('0x13')]);}else{logger['info'](_0xa1c4('0xd'),_0x491938,_0xa1c4('0x10'));_0x5b7851(_0x14d852[_0xa1c4('0x14')][_0xa1c4('0x13')]);}})[_0xa1c4('0x15')](function(_0x1f0485){logger[_0xa1c4('0x11')](_0xa1c4('0xd'),_0x491938,_0x1f0485);_0x45af8e(_0x1f0485);});});} \ No newline at end of file +var _0xf51c=['info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x1fe3c8,_0x2be277){var _0x5bdac=function(_0x24cdb0){while(--_0x24cdb0){_0x1fe3c8['push'](_0x1fe3c8['shift']());}};_0x5bdac(++_0x2be277);}(_0xf51c,0x1e8));var _0xcf51=function(_0x1e209e,_0x29d879){_0x1e209e=_0x1e209e-0x0;var _0x1a8e54=_0xf51c[_0x1e209e];return _0x1a8e54;};'use strict';var _=require(_0xcf51('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcf51('0x1'));var rs=require(_0xcf51('0x2'));var fs=require('fs');var Redis=require(_0xcf51('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcf51('0x4'));var logger=require(_0xcf51('0x5'))(_0xcf51('0x6'));var config=require(_0xcf51('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xcf51('0x8')][_0xcf51('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7b8439,_0x1e6f2e,_0x54b8b4){return new BPromise(function(_0x1fc514,_0x37949f){return client[_0xcf51('0xa')](_0x7b8439,_0x54b8b4)[_0xcf51('0xb')](function(_0x4be8f0){logger[_0xcf51('0xc')](_0xcf51('0xd'),_0x1e6f2e,_0xcf51('0xe'));logger['debug'](_0xcf51('0xf'),_0x1e6f2e,'request\x20sent',JSON['stringify'](_0x4be8f0));if(_0x4be8f0[_0xcf51('0x10')]){if(_0x4be8f0[_0xcf51('0x10')]['code']===0x1f4){logger[_0xcf51('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x1e6f2e,_0x4be8f0['error'][_0xcf51('0x11')]);return _0x37949f(_0x4be8f0['error'][_0xcf51('0x11')]);}logger[_0xcf51('0x10')](_0xcf51('0xd'),_0x1e6f2e,_0x4be8f0[_0xcf51('0x10')][_0xcf51('0x11')]);return _0x1fc514(_0x4be8f0[_0xcf51('0x10')][_0xcf51('0x11')]);}else{logger[_0xcf51('0xc')](_0xcf51('0xd'),_0x1e6f2e,_0xcf51('0xe'));_0x1fc514(_0x4be8f0[_0xcf51('0x12')][_0xcf51('0x11')]);}})[_0xcf51('0x13')](function(_0x2823a3){logger[_0xcf51('0x10')](_0xcf51('0xd'),_0x1e6f2e,_0x2823a3);_0x37949f(_0x2823a3);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 56e28a6..4d9fb27 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 _0x23f2=['isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get'];(function(_0x3a2e49,_0x21ebea){var _0x257140=function(_0x5a2362){while(--_0x5a2362){_0x3a2e49['push'](_0x3a2e49['shift']());}};_0x257140(++_0x21ebea);}(_0x23f2,0x193));var _0x223f=function(_0x47855d,_0x5e51b8){_0x47855d=_0x47855d-0x0;var _0x1133b6=_0x23f2[_0x47855d];return _0x1133b6;};'use strict';var multer=require(_0x223f('0x0'));var util=require('util');var path=require(_0x223f('0x1'));var timeout=require(_0x223f('0x2'));var express=require(_0x223f('0x3'));var router=express[_0x223f('0x4')]();var fs_extra=require(_0x223f('0x5'));var auth=require(_0x223f('0x6'));var interaction=require(_0x223f('0x7'));var config=require(_0x223f('0x8'));var controller=require(_0x223f('0x9'));router[_0x223f('0xa')]('/',auth[_0x223f('0xb')](),controller['index']);router[_0x223f('0xa')](_0x223f('0xc'),auth['isAuthenticated'](),controller[_0x223f('0xd')]);router[_0x223f('0xa')](_0x223f('0xe'),auth['isAuthenticated'](),controller[_0x223f('0xf')]);router[_0x223f('0x10')]('/',auth[_0x223f('0xb')](),controller[_0x223f('0x11')]);router[_0x223f('0x12')](_0x223f('0xe'),auth[_0x223f('0xb')](),controller[_0x223f('0x13')]);router[_0x223f('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x223f('0x15')]);module[_0x223f('0x16')]=router; \ No newline at end of file +var _0x5c72=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./chatTransferReport.controller','isAuthenticated','index','get','describe','/:id','show','post','create','put','update','destroy'];(function(_0xc77819,_0x139fdc){var _0x1c9434=function(_0x11d15d){while(--_0x11d15d){_0xc77819['push'](_0xc77819['shift']());}};_0x1c9434(++_0x139fdc);}(_0x5c72,0x156));var _0x25c7=function(_0x595f10,_0x9ac872){_0x595f10=_0x595f10-0x0;var _0x53770b=_0x5c72[_0x595f10];return _0x53770b;};'use strict';var multer=require(_0x25c7('0x0'));var util=require(_0x25c7('0x1'));var path=require(_0x25c7('0x2'));var timeout=require(_0x25c7('0x3'));var express=require(_0x25c7('0x4'));var router=express['Router']();var fs_extra=require(_0x25c7('0x5'));var auth=require(_0x25c7('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x25c7('0x7'));router['get']('/',auth[_0x25c7('0x8')](),controller[_0x25c7('0x9')]);router[_0x25c7('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x25c7('0xb')]);router[_0x25c7('0xa')](_0x25c7('0xc'),auth[_0x25c7('0x8')](),controller[_0x25c7('0xd')]);router[_0x25c7('0xe')]('/',auth[_0x25c7('0x8')](),controller[_0x25c7('0xf')]);router[_0x25c7('0x10')](_0x25c7('0xc'),auth[_0x25c7('0x8')](),controller[_0x25c7('0x11')]);router['delete'](_0x25c7('0xc'),auth[_0x25c7('0x8')](),controller[_0x25c7('0x12')]);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 dd93020..789452e 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 _0x6534=['Leave\x20your\x20comments','parse','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','website_alias','bottom_right','INTEGER','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','Generated\x20by\x20XCALLY\x20Motion','sequelize','randomstring','STRING','email','Agent','#011F6A','#ffffff','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Skip','star','stringify','input','name','text','getDataValue','onlineForm','setDataValue','textarea','Comments'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0x6534,0x14b));var _0x4653=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6534[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x4653('0x0'));var rs=require(_0x4653('0x1'));module['exports']={'name':{'type':Sequelize[_0x4653('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x4653('0x2')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x4653('0x2')],'defaultValue':_0x4653('0x3')},'mapKeyOffline':{'type':Sequelize[_0x4653('0x2')],'defaultValue':'email'},'key':{'type':Sequelize[_0x4653('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x4653('0x2')],'defaultValue':_0x4653('0x4')},'customerAlias':{'type':Sequelize[_0x4653('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x4653('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x4653('0x2')],'allowNull':![],'defaultValue':_0x4653('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4653('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x4653('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x4653('0x2')]},'animation':{'type':Sequelize[_0x4653('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x4653('0x8')](_0x4653('0x9'),_0x4653('0xa')),'defaultValue':_0x4653('0x9')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x4653('0xb')},'start_chat_button':{'type':Sequelize[_0x4653('0x2')],'defaultValue':_0x4653('0xc')},'offline_chat_button':{'type':Sequelize[_0x4653('0x2')],'defaultValue':_0x4653('0xd')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x4653('0xe')},'download_transcript':{'type':Sequelize[_0x4653('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x4653('0x2')],'defaultValue':_0x4653('0xf')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x4653('0x10')]},'closingQuestion':{'type':Sequelize[_0x4653('0x2')],'defaultValue':_0x4653('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0x4653('0x2')],'defaultValue':_0x4653('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0x4653('0x2')],'defaultValue':_0x4653('0x13')},'noteTitle':{'type':Sequelize[_0x4653('0x2')],'defaultValue':_0x4653('0x14')},'placeholderMessage':{'type':Sequelize[_0x4653('0x2')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x4653('0x2')],'defaultValue':_0x4653('0x15')},'closingMessageButton':{'type':Sequelize[_0x4653('0x2')],'defaultValue':_0x4653('0xd')},'skipMessageButton':{'type':Sequelize[_0x4653('0x2')],'defaultValue':_0x4653('0x16')},'conditionAgreement':{'type':Sequelize[_0x4653('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x4653('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x4653('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x4653('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x4653('0x2')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize['ENUM'](_0x4653('0x17'),'thumb'),'defaultValue':_0x4653('0x17')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x4653('0x18')]({'items':[{'type':_0x4653('0x19'),'variable':null,'config':{'placeholder':_0x4653('0x1a'),'type':_0x4653('0x1b'),'required':!![]},'props':{'title':_0x4653('0x1a'),'helpText':''}},{'type':_0x4653('0x19'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x4653('0x3'),'type':_0x4653('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x4653('0x1c')](_0x4653('0x1d'))?JSON['parse'](this[_0x4653('0x1c')](_0x4653('0x1d'))):{};},'set':function(_0x42923b){return this[_0x4653('0x1e')](_0x4653('0x1d'),JSON[_0x4653('0x18')](_0x42923b));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x4653('0x18')]({'items':[{'type':_0x4653('0x19'),'props':{'title':_0x4653('0x3'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x4653('0x3')},'variable':null},{'type':_0x4653('0x1f'),'config':{'placeholder':'Comments'},'props':{'title':_0x4653('0x20'),'helpText':_0x4653('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0x4653('0x1c')]('offlineForm')?JSON[_0x4653('0x22')](this[_0x4653('0x1c')](_0x4653('0x23'))):{};},'set':function(_0x4bb3a0){return this[_0x4653('0x1e')](_0x4653('0x23'),JSON[_0x4653('0x18')](_0x4bb3a0));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x4653('0x24')]();}},'autoclose':{'type':Sequelize[_0x4653('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x4653('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x4653('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x4653('0x2')]},'forwardOffline':{'type':Sequelize[_0x4653('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x4653('0x2')]},'waitingTitle':{'type':Sequelize[_0x4653('0x2')],'defaultValue':_0x4653('0x25')},'waitingMessage':{'type':Sequelize[_0x4653('0x2')],'defaultValue':_0x4653('0x26')},'offlineMessageSubject':{'type':Sequelize[_0x4653('0x2')],'defaultValue':_0x4653('0x27')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x4653('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x4653('0x28')},'skipUnmanaged':{'type':Sequelize[_0x4653('0x2')],'defaultValue':_0x4653('0x16')},'sendUnmanaged':{'type':Sequelize[_0x4653('0x2')],'defaultValue':_0x4653('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x4653('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x4653('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x4653('0x10')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x4653('0x2')]},'notificationTemplate':{'type':Sequelize[_0x4653('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x4653('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4653('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x4653('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x4653('0x2')],'defaultValue':_0x4653('0x29')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x4653('0x2')],'defaultValue':_0x4653('0x2a')},'verticalAlignment':{'type':Sequelize[_0x4653('0x2b')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0x4653('0x2c')},'messagesAlignment':{'type':Sequelize[_0x4653('0x2')],'defaultValue':_0x4653('0x2d')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x4653('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0x4653('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4653('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x4653('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4653('0x2b')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4653('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4653('0x2b')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x4653('0x2f')},'systemAvatar':{'type':Sequelize[_0x4653('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4653('0x2b')],'comment':_0x4653('0x30')},'mandatoryDisposition':{'type':Sequelize[_0x4653('0x7')],'defaultValue':![],'comment':_0x4653('0x31'),'set':function(_0x3d9d8f){if(!_0x3d9d8f)this[_0x4653('0x1e')](_0x4653('0x32'),null);this[_0x4653('0x1e')]('mandatoryDisposition',_0x3d9d8f);}},'vidaooEscalation':{'type':Sequelize[_0x4653('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x4653('0x2')]},'vidaooTopic':{'type':Sequelize[_0x4653('0x2')],'allowNull':![],'defaultValue':_0x4653('0x33')},'vidaooNote':{'type':Sequelize[_0x4653('0x2')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0x4653('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x4653('0x10')]}}; \ No newline at end of file +var _0x3e40=['Your\x20request\x20has\x20not\x20been\x20processed.','website_alias','bottom_right','CHAT','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','email','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','star','TEXT','input','name','getDataValue','parse','onlineForm','setDataValue','stringify','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'];(function(_0x5b80ff,_0x38517e){var _0x3cb5f5=function(_0x5566dd){while(--_0x5566dd){_0x5b80ff['push'](_0x5b80ff['shift']());}};_0x3cb5f5(++_0x38517e);}(_0x3e40,0x131));var _0x03e4=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x3e40[_0x3ab9ee];return _0x82ee88;};'use strict';var Sequelize=require(_0x03e4('0x0'));var rs=require(_0x03e4('0x1'));module[_0x03e4('0x2')]={'name':{'type':Sequelize[_0x03e4('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x03e4('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x03e4('0x3')]},'mapKey':{'type':Sequelize[_0x03e4('0x3')],'defaultValue':_0x03e4('0x4')},'mapKeyOffline':{'type':Sequelize[_0x03e4('0x3')],'defaultValue':_0x03e4('0x4')},'key':{'type':Sequelize[_0x03e4('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x03e4('0x3')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x03e4('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x03e4('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x03e4('0x3')],'allowNull':![],'defaultValue':_0x03e4('0x5'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x03e4('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x03e4('0x3')]},'animation':{'type':Sequelize[_0x03e4('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x03e4('0x8')](_0x03e4('0x9'),'squared'),'defaultValue':_0x03e4('0x9')},'header_online':{'type':Sequelize['STRING'],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x03e4('0x3')],'defaultValue':_0x03e4('0xa')},'offline_chat_button':{'type':Sequelize[_0x03e4('0x3')],'defaultValue':_0x03e4('0xb')},'header_offline':{'type':Sequelize[_0x03e4('0x3')],'defaultValue':_0x03e4('0xc')},'download_transcript':{'type':Sequelize[_0x03e4('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x03e4('0x6')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x03e4('0x3')],'defaultValue':_0x03e4('0xd')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x03e4('0x3')],'defaultValue':_0x03e4('0xe')},'formSubmitSuccessMessage':{'type':Sequelize[_0x03e4('0x3')],'defaultValue':_0x03e4('0xf')},'formSubmitFailureMessage':{'type':Sequelize[_0x03e4('0x3')],'defaultValue':_0x03e4('0x10')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x03e4('0x11')},'placeholderMessage':{'type':Sequelize[_0x03e4('0x3')],'defaultValue':_0x03e4('0x12')},'closingMessage':{'type':Sequelize[_0x03e4('0x3')],'defaultValue':_0x03e4('0x13')},'closingMessageButton':{'type':Sequelize[_0x03e4('0x3')],'defaultValue':_0x03e4('0xb')},'skipMessageButton':{'type':Sequelize[_0x03e4('0x3')],'defaultValue':_0x03e4('0x14')},'conditionAgreement':{'type':Sequelize[_0x03e4('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x03e4('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x03e4('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x03e4('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x03e4('0x3')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize['ENUM'](_0x03e4('0x15'),'thumb'),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x03e4('0x16')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x03e4('0x17'),'variable':null,'config':{'placeholder':'name','type':'text','required':!![]},'props':{'title':_0x03e4('0x18'),'helpText':''}},{'type':'input','props':{'title':_0x03e4('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x03e4('0x4'),'type':_0x03e4('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x03e4('0x19')]('onlineForm')?JSON[_0x03e4('0x1a')](this[_0x03e4('0x19')](_0x03e4('0x1b'))):{};},'set':function(_0x218201){return this[_0x03e4('0x1c')](_0x03e4('0x1b'),JSON[_0x03e4('0x1d')](_0x218201));}},'offlineForm':{'type':Sequelize[_0x03e4('0x16')],'defaultValue':function(){return JSON[_0x03e4('0x1d')]({'items':[{'type':_0x03e4('0x17'),'props':{'title':_0x03e4('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x03e4('0x4')},'variable':null},{'type':'textarea','config':{'placeholder':_0x03e4('0x1e')},'props':{'title':_0x03e4('0x1e'),'helpText':_0x03e4('0x1f')}}],'fromKey':0x0});},'get':function(){return this[_0x03e4('0x19')]('offlineForm')?JSON[_0x03e4('0x1a')](this[_0x03e4('0x19')](_0x03e4('0x20'))):{};},'set':function(_0x14f51c){return this[_0x03e4('0x1c')]('offlineForm',JSON['stringify'](_0x14f51c));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x03e4('0x21')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x03e4('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x03e4('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x03e4('0x3')]},'forwardOffline':{'type':Sequelize[_0x03e4('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x03e4('0x3')]},'waitingTitle':{'type':Sequelize[_0x03e4('0x3')],'defaultValue':_0x03e4('0x22')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x03e4('0x23')},'offlineMessageSubject':{'type':Sequelize[_0x03e4('0x3')],'defaultValue':_0x03e4('0x24')},'offlineMessageBody':{'type':Sequelize[_0x03e4('0x3')],'defaultValue':_0x03e4('0x25')},'enableUnmanagedNote':{'type':Sequelize[_0x03e4('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x03e4('0x3')],'defaultValue':_0x03e4('0x26')},'skipUnmanaged':{'type':Sequelize[_0x03e4('0x3')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x03e4('0x3')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x03e4('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x03e4('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x03e4('0x16')]},'showAgentAvatar':{'type':Sequelize[_0x03e4('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x03e4('0x3')]},'notificationTemplate':{'type':Sequelize[_0x03e4('0x16')],'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[_0x03e4('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x03e4('0x3')],'defaultValue':_0x03e4('0x27')},'waitForTheAssignedAgent':{'type':Sequelize[_0x03e4('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x03e4('0x3')],'defaultValue':_0x03e4('0x28')},'verticalAlignment':{'type':Sequelize[_0x03e4('0x6')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x03e4('0x3')],'defaultValue':_0x03e4('0x29')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x03e4('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x03e4('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x03e4('0x6')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x03e4('0x3')],'allowNull':![],'defaultValue':_0x03e4('0x2a'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x03e4('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x03e4('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x03e4('0x3')],'defaultValue':_0x03e4('0x2b')},'systemAvatar':{'type':Sequelize[_0x03e4('0x16')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x03e4('0x6')],'comment':_0x03e4('0x2c')},'mandatoryDisposition':{'type':Sequelize[_0x03e4('0x7')],'defaultValue':![],'comment':_0x03e4('0x2d'),'set':function(_0x576549){if(!_0x576549)this[_0x03e4('0x1c')](_0x03e4('0x2e'),null);this['setDataValue'](_0x03e4('0x2f'),_0x576549);}},'vidaooEscalation':{'type':Sequelize[_0x03e4('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x03e4('0x3')]},'vidaooTopic':{'type':Sequelize[_0x03e4('0x3')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0x03e4('0x3')],'defaultValue':function(){return _0x03e4('0x30');}},'vidaooMetadata':{'type':Sequelize[_0x03e4('0x16')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x03e4('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 63a6c15..3ee4a82 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 _0x2cd1=['addLogo','sitepic','file','filename','addCustomerAvatar','systemAvatar','getLogo','join','getLicense','isNil','server/files/images/logos/','download','root','server/files/images/avatars/default_avatar.png','agentAvatar','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','customerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','DESC','ChatApplication','Applications','spread','account','list','applications','Contacts','contact','headers','threadId','ChatInteraction','externalUrl','interaction','messageId','created','autoclose','push','close','ChatMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','ChatQueue','queueId','unshift','waitForTheAssignedQueue','Start','startRouting','EventManager','offline','files','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','ChatOfflineMessage','fromString','originalname','server','attachments','basename','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','SendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','mimetype','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','notifyMail','offline-chat','addInteraction','ids','omit','getInteractions','Contact','Owner','fullname','Tags','color','tag','custom','License','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','URL','address','3.5.0','remote','x-real-ip','connection','remoteAddress','virtual','replace','render','alignment','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','Transaction','READ_COMMITTED','findAndCountAll','priority','finally','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','ChatProactiveAction','getFields','online','offlineForm','onlineForm','items','fromKey','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','path','ejs','lodash','querystring','html-to-text','url','api','../../config/environment','../../errors/api','handleError','redis','defaults','localhost','socket.io-emitter','client','http','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','ChatWebsites','UserProfileResource','sendStatus','name','send','Command','getSnippet','format','timezone','iftime\x20%s','interval','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','map','Interval','Intervals','get','all','user-agent-parser','setUA','user-agent','customerIp','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','referer','version','%s\x20%s','unknown','browser','device','%s\x20%s\x20%s','model','vendor','type','index','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','Pause','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','update','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','removeDispositions','addAnswer','CannedAnswer','getAnswers','options'];(function(_0xaeb431,_0x248d88){var _0x2aea8a=function(_0x2caf18){while(--_0x2caf18){_0xaeb431['push'](_0xaeb431['shift']());}};_0x2aea8a(++_0x248d88);}(_0x2cd1,0x1d5));var _0x12cd=function(_0x3edaf9,_0x940c3d){_0x3edaf9=_0x3edaf9-0x0;var _0x2dc4b8=_0x2cd1[_0x3edaf9];return _0x2dc4b8;};'use strict';var Mustache=require(_0x12cd('0x0'));var util=require(_0x12cd('0x1'));var path=require(_0x12cd('0x2'));var ejs=require(_0x12cd('0x3'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x12cd('0x4'));var querystring=require(_0x12cd('0x5'));var htmlToText=require(_0x12cd('0x6'));var Redis=require('ioredis');var jayson=require('jayson/promise');var url=require(_0x12cd('0x7'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x12cd('0x8'));var config=require(_0x12cd('0x9'));var APIOutOfIntervalError=require(_0x12cd('0xa'))['APIOutOfIntervalError'];var APINotFoundError=require(_0x12cd('0xa'))['APINotFoundError'];var APIHandleError=require(_0x12cd('0xa'))[_0x12cd('0xb')];var db=require('../../mysqldb')['db'];config[_0x12cd('0xc')]=_[_0x12cd('0xd')](config['redis'],{'host':_0x12cd('0xe'),'port':0x18eb});var socket=require(_0x12cd('0xf'))(new Redis(config[_0x12cd('0xc')]));require('./chatWebsite.socket')['register'](socket);var client=jayson[_0x12cd('0x10')][_0x12cd('0x11')]({'port':0x232c});var client9002=jayson[_0x12cd('0x10')][_0x12cd('0x11')]({'port':0x232a});var client9003=jayson[_0x12cd('0x10')]['http']({'port':0x232b});var client9001=jayson[_0x12cd('0x10')]['http']({'port':0x2329});function respondWithRpcPromise(_0x52e095,_0x4fb183,_0x281292,_0x17fe3d){return new Promise(function(_0x3c8d00,_0x20e83e){var _0xf155f6=_0x17fe3d||client;return _0xf155f6[_0x12cd('0x12')](_0x52e095,_0x281292)[_0x12cd('0x13')](function(_0x22b69e){logger[_0x12cd('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x4fb183,_0x12cd('0x15'));logger[_0x12cd('0x16')](_0x12cd('0x17'),_0x4fb183,'request\x20sent',JSON[_0x12cd('0x18')](_0x22b69e));if(_0x22b69e[_0x12cd('0x19')]){if(_0x22b69e['error'][_0x12cd('0x1a')]===0x1f4){logger[_0x12cd('0x19')](_0x12cd('0x1b'),_0x4fb183,_0x22b69e[_0x12cd('0x19')]['message']);return _0x20e83e(_0x22b69e['error'][_0x12cd('0x1c')]);}logger[_0x12cd('0x19')](_0x12cd('0x1b'),_0x4fb183,_0x22b69e['error'][_0x12cd('0x1c')]);return _0x3c8d00(_0x22b69e[_0x12cd('0x19')]['message']);}else{logger[_0x12cd('0x14')](_0x12cd('0x1b'),_0x4fb183,_0x12cd('0x15'));_0x3c8d00(_0x22b69e[_0x12cd('0x1d')][_0x12cd('0x1c')]);}})[_0x12cd('0x1e')](function(_0x3b136e){logger['error'](_0x12cd('0x1b'),_0x4fb183,_0x3b136e);_0x20e83e(_0x3b136e);});});}function respondWithStatusCode(_0x423234,_0x4cd3cd){_0x4cd3cd=_0x4cd3cd||0xcc;return function(_0x19dd3b){if(_0x19dd3b){return _0x423234['sendStatus'](_0x4cd3cd);}return _0x423234[_0x12cd('0x1f')](_0x4cd3cd)[_0x12cd('0x20')]();};}function respondWithResult(_0xbf1a94,_0x14b0ba){_0x14b0ba=_0x14b0ba||0xc8;return function(_0x4d4f5e){if(_0x4d4f5e){return _0xbf1a94[_0x12cd('0x1f')](_0x14b0ba)[_0x12cd('0x21')](_0x4d4f5e);}};}function respondWithFilteredResult(_0x3c4c82,_0x4412cf){return function(_0x1cb388){if(_0x1cb388){var _0xf42fee=typeof _0x4412cf[_0x12cd('0x22')]===_0x12cd('0x23')&&typeof _0x4412cf[_0x12cd('0x24')]==='undefined';var _0xa80225=_0x1cb388['count'];var _0x5dcc06=_0xf42fee?0x0:_0x4412cf[_0x12cd('0x22')];var _0x3e4a58=_0xf42fee?_0x1cb388[_0x12cd('0x25')]:_0x4412cf['offset']+_0x4412cf[_0x12cd('0x24')];var _0x27a9a3;if(_0x3e4a58>=_0xa80225){_0x3e4a58=_0xa80225;_0x27a9a3=0xc8;}else{_0x27a9a3=0xce;}_0x3c4c82[_0x12cd('0x1f')](_0x27a9a3);return _0x3c4c82[_0x12cd('0x26')](_0x12cd('0x27'),_0x5dcc06+'-'+_0x3e4a58+'/'+_0xa80225)[_0x12cd('0x21')](_0x1cb388);}return null;};}function saveUpdates(_0x4857dc){return function(_0x258b46){if(_0x258b46){return _0x258b46['update'](_0x4857dc)[_0x12cd('0x13')](function(_0xfa6e7b){return _0xfa6e7b;});}return null;};}function removeEntity(_0x432d22){return function(_0x274c60){if(_0x274c60){return _0x274c60[_0x12cd('0x28')]()[_0x12cd('0x13')](function(){var _0x386d3e=_0x274c60['get']({'plain':!![]});var _0x201940=_0x12cd('0x29');return db[_0x12cd('0x2a')][_0x12cd('0x28')]({'where':{'type':_0x201940,'resourceId':_0x386d3e['id']}})[_0x12cd('0x13')](function(){return _0x274c60;});})[_0x12cd('0x13')](function(){_0x432d22[_0x12cd('0x1f')](0xcc)[_0x12cd('0x20')]();});}};}function handleEntityNotFound(_0x4189ca){return function(_0x1a6d09){if(!_0x1a6d09){_0x4189ca[_0x12cd('0x2b')](0x194);}return _0x1a6d09;};}function handleError(_0x17ca6e,_0x4fe049){_0x4fe049=_0x4fe049||0x1f4;return function(_0x314f34){logger[_0x12cd('0x19')](_0x314f34['stack']);if(_0x314f34[_0x12cd('0x2c')]){delete _0x314f34[_0x12cd('0x2c')];}_0x17ca6e[_0x12cd('0x1f')](_0x4fe049)[_0x12cd('0x2d')](_0x314f34);};}function iftimePromise(_0x4a6984,_0x423a86){return respondWithRpcPromise(_0x12cd('0x2e'),_0x12cd('0x2f'),{'command':_0x423a86['timezone']?util[_0x12cd('0x30')]('iftime\x20%s,%s',_0x4a6984['interval'],_0x423a86[_0x12cd('0x31')]):util['format'](_0x12cd('0x32'),_0x4a6984[_0x12cd('0x33')])},client9002)['then'](function(_0x3a424e){var _0x105c2c=_0x3a424e&&_0x3a424e['indexOf']('true')>=0x0?!![]:![];logger[_0x12cd('0x14')](_0x12cd('0x34'),_0x423a86['id'],_0x4a6984['id'],_0x4a6984[_0x12cd('0x33')],_0x105c2c?_0x12cd('0x35'):_0x12cd('0x36'),_0x423a86[_0x12cd('0x31')]?_0x423a86[_0x12cd('0x31')]:'No\x20timezone');return _0x105c2c;})[_0x12cd('0x1e')](function(_0x242853){logger[_0x12cd('0x19')](_0x12cd('0x34'),_0x423a86['id'],_0x4a6984['id'],_0x4a6984['interval'],util['inspect'](_0x242853,{'showHidden':![],'depth':null}),_0x423a86[_0x12cd('0x31')]?_0x423a86['timezone']:_0x12cd('0x37'));return![];});}function checkWebsiteIntervals(_0x25fc35){var _0x3d54ed=_[_0x12cd('0x38')](_0x25fc35[_0x12cd('0x39')][_0x12cd('0x3a')],function(_0x39697a){var _0x21a6e0=_0x39697a[_0x12cd('0x3b')]({'plain':!![]});return iftimePromise(_0x21a6e0,_0x25fc35);});return Promise[_0x12cd('0x3c')](_0x3d54ed)['then'](function(_0x68ed4e){return _['some'](_0x68ed4e);});}function createInteractionObject(_0x4c9789,_0x28a673,_0x38020d,_0x5ebe5a){var _0x597ef0=require(_0x12cd('0x3d'));var _0x4a31ee=new _0x597ef0();var _0x144d4f=_0x4a31ee[_0x12cd('0x3e')](_0x38020d[_0x12cd('0x3f')])['getResult']();var _0x3a65f1=_0x28a673[_0x12cd('0x40')];if(_0x38020d[_0x12cd('0x41')]){_0x3a65f1=_0x38020d[_0x12cd('0x41')];}else if(_0x38020d[_0x12cd('0x42')]){_0x3a65f1=_['first'](_0x38020d['x-forwarded-for'][_0x12cd('0x43')](','));}return{'ContactId':_0x5ebe5a['id'],'ChatWebsiteId':_0x4c9789,'from':(_0x5ebe5a[_0x12cd('0x44')]||'')+'\x20'+(_0x5ebe5a[_0x12cd('0x45')]||''),'customerIp':_0x3a65f1,'customerPort':_0x38020d[_0x12cd('0x46')]?_0x38020d[_0x12cd('0x46')]:null,'referer':_0x28a673[_0x12cd('0x47')],'browserName':_0x144d4f['browser']['name']&&_0x144d4f['browser'][_0x12cd('0x48')]?util[_0x12cd('0x30')](_0x12cd('0x49'),_0x144d4f['browser']['name'],_0x144d4f['browser'][_0x12cd('0x48')]):_0x12cd('0x4a'),'browserVersion':_0x144d4f[_0x12cd('0x4b')][_0x12cd('0x48')]||_0x12cd('0x4a'),'osName':util[_0x12cd('0x30')](_0x12cd('0x49'),_0x144d4f['os'][_0x12cd('0x2c')],_0x144d4f['os'][_0x12cd('0x48')]),'osVersion':_0x144d4f['os']['version'],'deviceModel':_0x144d4f[_0x12cd('0x4c')]['model']&&_0x144d4f[_0x12cd('0x4c')]['vendor']?util[_0x12cd('0x30')](_0x12cd('0x4d'),_0x144d4f[_0x12cd('0x4c')][_0x12cd('0x4e')],_0x144d4f[_0x12cd('0x4c')][_0x12cd('0x4f')],_0x144d4f[_0x12cd('0x4c')][_0x12cd('0x50')]):null,'deviceVendor':_0x144d4f['device'][_0x12cd('0x4f')],'deviceType':_0x144d4f[_0x12cd('0x4c')][_0x12cd('0x50')],'formData':JSON['stringify'](_0x28a673)};}exports[_0x12cd('0x51')]=function(_0x5b8fdd,_0x10d5dd){var _0x36063b={'include':[{'model':db['Pause'],'as':_0x12cd('0x52')}]},_0x5f0047={},_0x438515={'count':0x0,'rows':[]};var _0x2e7bcc=_['map'](db[_0x12cd('0x53')][_0x12cd('0x54')],function(_0x520e7a){return{'name':_0x520e7a[_0x12cd('0x55')],'type':_0x520e7a[_0x12cd('0x50')][_0x12cd('0x56')]};});_0x5f0047['model']=_[_0x12cd('0x38')](_0x2e7bcc,_0x12cd('0x2c'));_0x5f0047[_0x12cd('0x57')]=_[_0x12cd('0x58')](_0x5b8fdd[_0x12cd('0x57')]);_0x5f0047[_0x12cd('0x59')]=_[_0x12cd('0x5a')](_0x5f0047[_0x12cd('0x4e')],_0x5f0047['query']);_0x36063b[_0x12cd('0x5b')]=_[_0x12cd('0x5a')](_0x5f0047[_0x12cd('0x4e')],qs['fields'](_0x5b8fdd[_0x12cd('0x57')][_0x12cd('0x5c')]));_0x36063b['attributes']=_0x36063b['attributes'][_0x12cd('0x5d')]?_0x36063b['attributes']:_0x5f0047[_0x12cd('0x4e')];if(!_0x5b8fdd[_0x12cd('0x57')][_0x12cd('0x5e')](_0x12cd('0x5f'))){_0x36063b[_0x12cd('0x24')]=qs[_0x12cd('0x24')](_0x5b8fdd[_0x12cd('0x57')][_0x12cd('0x24')]);_0x36063b[_0x12cd('0x22')]=qs[_0x12cd('0x22')](_0x5b8fdd[_0x12cd('0x57')][_0x12cd('0x22')]);}_0x36063b[_0x12cd('0x60')]=qs[_0x12cd('0x61')](_0x5b8fdd[_0x12cd('0x57')]['sort']);_0x36063b['where']=qs[_0x12cd('0x59')](_[_0x12cd('0x62')](_0x5b8fdd[_0x12cd('0x57')],_0x5f0047[_0x12cd('0x59')]),_0x2e7bcc);if(_0x5b8fdd[_0x12cd('0x57')]['filter']){_0x36063b[_0x12cd('0x63')]=_[_0x12cd('0x64')](_0x36063b[_0x12cd('0x63')],{'$or':_['map'](_0x2e7bcc,function(_0x2d5af2){if(_0x2d5af2[_0x12cd('0x50')]!==_0x12cd('0x65')){var _0x2059e2={};_0x2059e2[_0x2d5af2[_0x12cd('0x2c')]]={'$like':'%'+_0x5b8fdd[_0x12cd('0x57')][_0x12cd('0x66')]+'%'};return _0x2059e2;}})});}_0x36063b=_[_0x12cd('0x64')]({},_0x36063b,_0x5b8fdd['options']);var _0x2ed0fa={'where':_0x36063b[_0x12cd('0x63')]};return db[_0x12cd('0x53')]['count'](_0x2ed0fa)['then'](function(_0x51da24){_0x438515[_0x12cd('0x25')]=_0x51da24;if(_0x5b8fdd[_0x12cd('0x57')][_0x12cd('0x67')]){_0x36063b[_0x12cd('0x68')]=[{'all':!![]}];}return db[_0x12cd('0x53')][_0x12cd('0x69')](_0x36063b);})[_0x12cd('0x13')](function(_0x2e611f){_0x438515[_0x12cd('0x6a')]=_0x2e611f;return _0x438515;})[_0x12cd('0x13')](respondWithFilteredResult(_0x10d5dd,_0x36063b))[_0x12cd('0x1e')](handleError(_0x10d5dd,null));};exports[_0x12cd('0x6b')]=function(_0x3dd292,_0x15e4ed){var _0x4f4e83={'raw':![],'where':{'id':_0x3dd292[_0x12cd('0x6c')]['id']},'include':[{'model':db[_0x12cd('0x6d')],'as':_0x12cd('0x52')}]},_0x1f99ec={};_0x1f99ec['model']=_[_0x12cd('0x58')](db[_0x12cd('0x53')][_0x12cd('0x54')]);_0x1f99ec[_0x12cd('0x57')]=_[_0x12cd('0x58')](_0x3dd292['query']);_0x1f99ec[_0x12cd('0x59')]=_['intersection'](_0x1f99ec['model'],_0x1f99ec[_0x12cd('0x57')]);_0x4f4e83[_0x12cd('0x5b')]=_['intersection'](_0x1f99ec['model'],qs[_0x12cd('0x5c')](_0x3dd292[_0x12cd('0x57')][_0x12cd('0x5c')]));_0x4f4e83[_0x12cd('0x5b')]=_0x4f4e83[_0x12cd('0x5b')]['length']?_0x4f4e83[_0x12cd('0x5b')]:_0x1f99ec[_0x12cd('0x4e')];if(_0x3dd292['query'][_0x12cd('0x67')]){_0x4f4e83[_0x12cd('0x68')]=[{'all':!![]}];}_0x4f4e83=_[_0x12cd('0x64')]({},_0x4f4e83,_0x3dd292['options']);return db[_0x12cd('0x53')][_0x12cd('0x6e')](_0x4f4e83)[_0x12cd('0x13')](handleEntityNotFound(_0x15e4ed,null))[_0x12cd('0x13')](respondWithResult(_0x15e4ed,null))[_0x12cd('0x1e')](handleError(_0x15e4ed,null));};exports[_0x12cd('0x6f')]=function(_0x1bd3d9,_0x3b5fba){return db[_0x12cd('0x53')]['create'](_0x1bd3d9[_0x12cd('0x70')],{})[_0x12cd('0x13')](function(_0x525a6a){var _0x3732f0=_0x1bd3d9[_0x12cd('0x71')][_0x12cd('0x3b')]({'plain':!![]});if(!_0x3732f0)throw new Error(_0x12cd('0x72'));if(_0x3732f0['role']==='user'){var _0x2f4f66=_0x525a6a['get']({'plain':!![]});var _0x540fb3=_0x12cd('0x29');return db['UserProfileSection'][_0x12cd('0x6e')]({'where':{'name':_0x540fb3,'userProfileId':_0x3732f0[_0x12cd('0x73')]},'raw':!![]})[_0x12cd('0x13')](function(_0x52d112){if(_0x52d112&&_0x52d112[_0x12cd('0x74')]===0x0){return db[_0x12cd('0x2a')][_0x12cd('0x6f')]({'name':_0x2f4f66[_0x12cd('0x2c')],'resourceId':_0x2f4f66['id'],'type':_0x52d112[_0x12cd('0x2c')],'sectionId':_0x52d112['id']},{})[_0x12cd('0x13')](function(){return _0x525a6a;});}else{return _0x525a6a;}})[_0x12cd('0x1e')](function(_0x57c389){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x57c389);throw _0x57c389;});}return _0x525a6a;})[_0x12cd('0x13')](respondWithResult(_0x3b5fba,0xc9))[_0x12cd('0x1e')](handleError(_0x3b5fba,null));};exports[_0x12cd('0x75')]=function(_0x1d545b,_0x2dc9c0){if(_0x1d545b[_0x12cd('0x70')]['id']){delete _0x1d545b[_0x12cd('0x70')]['id'];}return db[_0x12cd('0x53')][_0x12cd('0x6e')]({'where':{'id':_0x1d545b[_0x12cd('0x6c')]['id']},'include':[{'model':db[_0x12cd('0x6d')],'as':_0x12cd('0x52')}]})[_0x12cd('0x13')](handleEntityNotFound(_0x2dc9c0,null))[_0x12cd('0x13')](saveUpdates(_0x1d545b['body'],null))[_0x12cd('0x13')](respondWithResult(_0x2dc9c0,null))['catch'](handleError(_0x2dc9c0,null));};exports[_0x12cd('0x28')]=function(_0x1c6148,_0x666a4c){return db[_0x12cd('0x53')][_0x12cd('0x6e')]({'where':{'id':_0x1c6148[_0x12cd('0x6c')]['id']}})[_0x12cd('0x13')](handleEntityNotFound(_0x666a4c,null))[_0x12cd('0x13')](removeEntity(_0x666a4c,null))[_0x12cd('0x1e')](handleError(_0x666a4c,null));};exports['describe']=function(_0x36f014,_0x585a27){return db[_0x12cd('0x53')][_0x12cd('0x76')]()[_0x12cd('0x13')](respondWithResult(_0x585a27,null))[_0x12cd('0x1e')](handleError(_0x585a27,null));};exports[_0x12cd('0x77')]=function(_0x6a2772,_0x21f3f1){if(_0x6a2772[_0x12cd('0x70')]['id']){delete _0x6a2772['body']['id'];}return db[_0x12cd('0x53')]['find']({'where':{'id':_0x6a2772[_0x12cd('0x6c')]['id']}})[_0x12cd('0x13')](handleEntityNotFound(_0x21f3f1,null))[_0x12cd('0x13')](function(_0x495208){if(_0x495208){_0x6a2772[_0x12cd('0x70')][_0x12cd('0x78')]=_0x495208['id'];return db[_0x12cd('0x79')][_0x12cd('0x6f')](_0x6a2772[_0x12cd('0x70')]);}})[_0x12cd('0x13')](respondWithResult(_0x21f3f1,null))['catch'](handleError(_0x21f3f1,null));};exports[_0x12cd('0x7a')]=function(_0x1997b8,_0xb83847){var _0x36236d={'raw':![],'where':{}};var _0x533319={};var _0x1c5124={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x12cd('0x7b')]({'where':{'id':_0x1997b8[_0x12cd('0x6c')]['id']}})[_0x12cd('0x13')](handleEntityNotFound(_0xb83847,null))[_0x12cd('0x13')](function(_0x38b1e8){if(_0x38b1e8){_0x533319[_0x12cd('0x4e')]=_[_0x12cd('0x58')](db[_0x12cd('0x79')][_0x12cd('0x54')]);_0x533319[_0x12cd('0x57')]=_[_0x12cd('0x58')](_0x1997b8['query']);_0x533319[_0x12cd('0x59')]=_[_0x12cd('0x5a')](_0x533319[_0x12cd('0x4e')],_0x533319['query']);_0x36236d[_0x12cd('0x5b')]=_['intersection'](_0x533319['model'],qs['fields'](_0x1997b8[_0x12cd('0x57')][_0x12cd('0x5c')]));_0x36236d[_0x12cd('0x5b')]=_0x36236d[_0x12cd('0x5b')][_0x12cd('0x5d')]?_0x36236d['attributes']:_0x533319['model'];if(!_0x1997b8[_0x12cd('0x57')][_0x12cd('0x5e')]('nolimit')){_0x36236d[_0x12cd('0x24')]=qs[_0x12cd('0x24')](_0x1997b8[_0x12cd('0x57')][_0x12cd('0x24')]);_0x36236d[_0x12cd('0x22')]=qs[_0x12cd('0x22')](_0x1997b8[_0x12cd('0x57')][_0x12cd('0x22')]);}_0x36236d['order']=qs['sort'](_0x1997b8[_0x12cd('0x57')][_0x12cd('0x61')]);_0x36236d[_0x12cd('0x63')]=qs['filters'](_[_0x12cd('0x62')](_0x1997b8[_0x12cd('0x57')],_0x533319[_0x12cd('0x59')]));_0x36236d[_0x12cd('0x63')][_0x12cd('0x78')]=_0x38b1e8['id'];if(_0x1997b8[_0x12cd('0x57')][_0x12cd('0x66')]){_0x36236d[_0x12cd('0x63')]=_[_0x12cd('0x64')](_0x36236d['where'],{'$or':_[_0x12cd('0x38')](_0x36236d['attributes'],function(_0x27987e){var _0x39ce3f={};_0x39ce3f[_0x27987e]={'$like':'%'+_0x1997b8[_0x12cd('0x57')][_0x12cd('0x66')]+'%'};return _0x39ce3f;})});}_0x36236d=_['merge']({},_0x36236d,_0x1997b8['options']);return db['Disposition'][_0x12cd('0x25')]({'where':_0x36236d[_0x12cd('0x63')]})[_0x12cd('0x13')](function(_0x472e30){_0x1c5124[_0x12cd('0x25')]=_0x472e30;if(_0x1997b8[_0x12cd('0x57')][_0x12cd('0x67')]){_0x36236d[_0x12cd('0x68')]=[{'all':!![]}];}return db[_0x12cd('0x79')]['findAll'](_0x36236d);})[_0x12cd('0x13')](function(_0x2306db){_0x1c5124[_0x12cd('0x6a')]=_0x2306db;return _0x1c5124;});}})['then'](respondWithFilteredResult(_0xb83847,_0x36236d))['catch'](handleError(_0xb83847,null));};exports['removeDispositions']=function(_0x3cfec7,_0x3ee441){return db[_0x12cd('0x53')]['find']({'where':{'id':_0x3cfec7[_0x12cd('0x6c')]['id']}})[_0x12cd('0x13')](handleEntityNotFound(_0x3ee441,null))[_0x12cd('0x13')](function(_0xc5fc6f){if(_0xc5fc6f){return _0xc5fc6f[_0x12cd('0x7c')](_0x3cfec7[_0x12cd('0x57')]['ids']);}})[_0x12cd('0x13')](respondWithStatusCode(_0x3ee441,null))[_0x12cd('0x1e')](handleError(_0x3ee441,null));};exports[_0x12cd('0x7d')]=function(_0x455d5d,_0x275cb9){if(_0x455d5d[_0x12cd('0x70')]['id']){delete _0x455d5d['body']['id'];}return db[_0x12cd('0x53')][_0x12cd('0x6e')]({'where':{'id':_0x455d5d[_0x12cd('0x6c')]['id']}})[_0x12cd('0x13')](handleEntityNotFound(_0x275cb9,null))['then'](function(_0x1903d0){if(_0x1903d0){_0x455d5d['body']['ChatWebsiteId']=_0x1903d0['id'];return db[_0x12cd('0x7e')][_0x12cd('0x6f')](_0x455d5d[_0x12cd('0x70')]);}})[_0x12cd('0x13')](respondWithResult(_0x275cb9,null))['catch'](handleError(_0x275cb9,null));};exports[_0x12cd('0x7f')]=function(_0x404219,_0x47e832){var _0x455019={'raw':![],'where':{}};var _0x391274={};var _0x5a4d2b={'count':0x0,'rows':[]};return db[_0x12cd('0x53')][_0x12cd('0x7b')]({'where':{'id':_0x404219[_0x12cd('0x6c')]['id']}})[_0x12cd('0x13')](handleEntityNotFound(_0x47e832,null))[_0x12cd('0x13')](function(_0x24851f){if(_0x24851f){_0x391274[_0x12cd('0x4e')]=_[_0x12cd('0x58')](db[_0x12cd('0x7e')]['rawAttributes']);_0x391274['query']=_[_0x12cd('0x58')](_0x404219[_0x12cd('0x57')]);_0x391274[_0x12cd('0x59')]=_[_0x12cd('0x5a')](_0x391274[_0x12cd('0x4e')],_0x391274[_0x12cd('0x57')]);_0x455019[_0x12cd('0x5b')]=_['intersection'](_0x391274[_0x12cd('0x4e')],qs[_0x12cd('0x5c')](_0x404219['query']['fields']));_0x455019[_0x12cd('0x5b')]=_0x455019[_0x12cd('0x5b')][_0x12cd('0x5d')]?_0x455019['attributes']:_0x391274[_0x12cd('0x4e')];if(!_0x404219[_0x12cd('0x57')][_0x12cd('0x5e')]('nolimit')){_0x455019['limit']=qs[_0x12cd('0x24')](_0x404219[_0x12cd('0x57')][_0x12cd('0x24')]);_0x455019[_0x12cd('0x22')]=qs[_0x12cd('0x22')](_0x404219[_0x12cd('0x57')][_0x12cd('0x22')]);}_0x455019['order']=qs[_0x12cd('0x61')](_0x404219[_0x12cd('0x57')][_0x12cd('0x61')]);_0x455019[_0x12cd('0x63')]=qs['filters'](_[_0x12cd('0x62')](_0x404219[_0x12cd('0x57')],_0x391274[_0x12cd('0x59')]));_0x455019[_0x12cd('0x63')]['ChatWebsiteId']=_0x24851f['id'];if(_0x404219['query'][_0x12cd('0x66')]){_0x455019[_0x12cd('0x63')]=_[_0x12cd('0x64')](_0x455019[_0x12cd('0x63')],{'$or':_['map'](_0x455019[_0x12cd('0x5b')],function(_0x36fc5c){var _0x35d79e={};_0x35d79e[_0x36fc5c]={'$like':'%'+_0x404219['query'][_0x12cd('0x66')]+'%'};return _0x35d79e;})});}_0x455019=_['merge']({},_0x455019,_0x404219[_0x12cd('0x80')]);return db[_0x12cd('0x7e')][_0x12cd('0x25')]({'where':_0x455019[_0x12cd('0x63')]})[_0x12cd('0x13')](function(_0x2b27c5){_0x5a4d2b[_0x12cd('0x25')]=_0x2b27c5;if(_0x404219['query'][_0x12cd('0x67')]){_0x455019[_0x12cd('0x68')]=[{'all':!![]}];}return db[_0x12cd('0x7e')][_0x12cd('0x69')](_0x455019);})[_0x12cd('0x13')](function(_0x37ed5b){_0x5a4d2b[_0x12cd('0x6a')]=_0x37ed5b;return _0x5a4d2b;});}})['then'](respondWithFilteredResult(_0x47e832,_0x455019))['catch'](handleError(_0x47e832,null));};exports['removeAnswers']=function(_0x2805ab,_0x2ddd6f){return db['ChatWebsite'][_0x12cd('0x6e')]({'where':{'id':_0x2805ab[_0x12cd('0x6c')]['id']}})['then'](handleEntityNotFound(_0x2ddd6f,null))[_0x12cd('0x13')](function(_0x1b56d3){if(_0x1b56d3){return _0x1b56d3['removeAnswers'](_0x2805ab[_0x12cd('0x57')]['ids']);}})['then'](respondWithStatusCode(_0x2ddd6f,null))[_0x12cd('0x1e')](handleError(_0x2ddd6f,null));};exports[_0x12cd('0x81')]=function(_0xc60783,_0x4f2bc8){_0xc60783['body'][_0x12cd('0x82')]=_0xc60783[_0x12cd('0x83')][_0x12cd('0x84')];return db['ChatWebsite']['find']({'where':{'id':_0xc60783[_0x12cd('0x6c')]['id']}})[_0x12cd('0x13')](handleEntityNotFound(_0x4f2bc8,null))[_0x12cd('0x13')](saveUpdates(_0xc60783[_0x12cd('0x70')],null))[_0x12cd('0x13')](respondWithResult(_0x4f2bc8,null))['catch'](handleError(_0x4f2bc8,null));};exports['addAvatar']=function(_0x2aa9f1,_0x5cbd05){_0x2aa9f1[_0x12cd('0x70')]['agentAvatar']=_0x2aa9f1['file']['filename'];return db[_0x12cd('0x53')]['find']({'where':{'id':_0x2aa9f1[_0x12cd('0x6c')]['id']}})['then'](handleEntityNotFound(_0x5cbd05,null))[_0x12cd('0x13')](saveUpdates(_0x2aa9f1['body'],null))[_0x12cd('0x13')](respondWithResult(_0x5cbd05,null))[_0x12cd('0x1e')](handleError(_0x5cbd05,null));};exports[_0x12cd('0x85')]=function(_0x10cb2f,_0x59cf4b){_0x10cb2f[_0x12cd('0x70')]['customerAvatar']=_0x10cb2f[_0x12cd('0x83')][_0x12cd('0x84')];return db[_0x12cd('0x53')]['find']({'where':{'id':_0x10cb2f[_0x12cd('0x6c')]['id']}})[_0x12cd('0x13')](handleEntityNotFound(_0x59cf4b,null))[_0x12cd('0x13')](saveUpdates(_0x10cb2f[_0x12cd('0x70')],null))[_0x12cd('0x13')](respondWithResult(_0x59cf4b,null))[_0x12cd('0x1e')](handleError(_0x59cf4b,null));};exports['addSystemAvatar']=function(_0x233dad,_0x170d4b){_0x233dad[_0x12cd('0x70')][_0x12cd('0x86')]=_0x233dad[_0x12cd('0x83')][_0x12cd('0x84')];return db[_0x12cd('0x53')][_0x12cd('0x6e')]({'where':{'id':_0x233dad['params']['id']}})[_0x12cd('0x13')](handleEntityNotFound(_0x170d4b,null))[_0x12cd('0x13')](saveUpdates(_0x233dad[_0x12cd('0x70')],null))['then'](respondWithResult(_0x170d4b,null))['catch'](handleError(_0x170d4b,null));};exports[_0x12cd('0x87')]=function(_0x31b809,_0x4a49b2){var _0x3be59f=path[_0x12cd('0x88')](config['root'],'server/files/images/logos/default_logo.svg');var _0x2a11f8={'where':{'id':_0x31b809[_0x12cd('0x6c')]['id']},'attributes':['id',_0x12cd('0x82')],'raw':!![]};var _0x2ffcfd=![];return require('../../config/license/util')[_0x12cd('0x89')]()[_0x12cd('0x13')](function(_0x1009b2){if(_0x1009b2){_0x2ffcfd=_0x1009b2['custom'];}})[_0x12cd('0x13')](function(){return db[_0x12cd('0x53')][_0x12cd('0x6e')](_0x2a11f8);})[_0x12cd('0x13')](handleEntityNotFound(_0x4a49b2,null))[_0x12cd('0x13')](function(_0x44291a){if(_0x44291a){if(!_[_0x12cd('0x8a')](_0x44291a['sitepic'])){if(fs['existsSync'](path[_0x12cd('0x88')](config['root'],_0x12cd('0x8b'),_0x44291a[_0x12cd('0x82')]))&&_0x2ffcfd){_0x3be59f=path[_0x12cd('0x88')](config['root'],'server/files/images/logos/',_0x44291a['sitepic']);}}return _0x4a49b2[_0x12cd('0x8c')](_0x3be59f);}})[_0x12cd('0x1e')](handleError(_0x4a49b2,null));};exports['getAvatar']=function(_0x4dbfac,_0x23b348){var _0x5758d9=path[_0x12cd('0x88')](config[_0x12cd('0x8d')],_0x12cd('0x8e'));var _0x290423={'where':{'id':_0x4dbfac[_0x12cd('0x6c')]['id']},'attributes':['id',_0x12cd('0x8f')],'raw':!![]};return db['ChatWebsite']['find'](_0x290423)[_0x12cd('0x13')](handleEntityNotFound(_0x23b348,null))['then'](function(_0x4d53b6){if(_0x4d53b6){if(!_[_0x12cd('0x8a')](_0x4d53b6[_0x12cd('0x8f')])){if(fs[_0x12cd('0x90')](path[_0x12cd('0x88')](config[_0x12cd('0x8d')],_0x12cd('0x91'),_0x4d53b6[_0x12cd('0x8f')]))){_0x5758d9=path[_0x12cd('0x88')](config[_0x12cd('0x8d')],'server/files/images/avatars/',_0x4d53b6[_0x12cd('0x8f')]);}}return _0x23b348['download'](_0x5758d9);}})[_0x12cd('0x1e')](handleError(_0x23b348,null));};exports[_0x12cd('0x92')]=function(_0x31daef,_0x359fcc){var _0x14ac22=path[_0x12cd('0x88')](config[_0x12cd('0x8d')],_0x12cd('0x93'));var _0x8e3d83={'where':{'id':_0x31daef[_0x12cd('0x6c')]['id']},'attributes':['id','customerAvatar',_0x12cd('0x94')],'raw':!![]};return db[_0x12cd('0x53')][_0x12cd('0x6e')](_0x8e3d83)[_0x12cd('0x13')](handleEntityNotFound(_0x359fcc,null))['then'](function(_0x4be70c){if(_0x4be70c){if(!_[_0x12cd('0x8a')](_0x4be70c[_0x12cd('0x95')])){if(fs['existsSync'](path[_0x12cd('0x88')](config[_0x12cd('0x8d')],_0x12cd('0x91'),_0x4be70c[_0x12cd('0x95')]))&&_0x4be70c[_0x12cd('0x94')]){_0x14ac22=path[_0x12cd('0x88')](config[_0x12cd('0x8d')],_0x12cd('0x91'),_0x4be70c[_0x12cd('0x95')]);}}return _0x359fcc[_0x12cd('0x8c')](_0x14ac22);}})[_0x12cd('0x1e')](handleError(_0x359fcc,null));};exports[_0x12cd('0x96')]=function(_0x2efd7e,_0x14082b){var _0x52e0c6=path['join'](config['root'],_0x12cd('0x97'));var _0x318ade={'where':{'id':_0x2efd7e[_0x12cd('0x6c')]['id']},'attributes':['id',_0x12cd('0x86')],'raw':!![]};return db[_0x12cd('0x53')][_0x12cd('0x6e')](_0x318ade)[_0x12cd('0x13')](handleEntityNotFound(_0x14082b,null))[_0x12cd('0x13')](function(_0xd44765){if(_0xd44765){if(!_['isNil'](_0xd44765[_0x12cd('0x86')])){if(fs[_0x12cd('0x90')](path[_0x12cd('0x88')](config[_0x12cd('0x8d')],_0x12cd('0x91'),_0xd44765[_0x12cd('0x86')]))){_0x52e0c6=path['join'](config[_0x12cd('0x8d')],'server/files/images/avatars/',_0xd44765['systemAvatar']);}}return _0x14082b[_0x12cd('0x8c')](_0x52e0c6);}})['catch'](handleError(_0x14082b,null));};exports[_0x12cd('0x98')]=function(_0x2a3ecb,_0x5ad450){var _0x14c513={'body':_0x2a3ecb[_0x12cd('0x70')],'channel':_0x12cd('0x99')};var _0x5a8390=[];var _0x335fe2=[];var _0x3d9991={};var _0x2c0079=![];return db[_0x12cd('0x9a')]['describe']()['then'](function(_0x3413d9){if(!_0x3413d9){throw new db[(_0x12cd('0x9b'))][(_0x12cd('0x9c'))](_0x12cd('0x9d'));}_0x5a8390=_['difference'](_[_0x12cd('0x58')](_0x3413d9),[_0x12cd('0x9e'),_0x12cd('0x9f')]);_0x335fe2=_[_0x12cd('0xa0')](_[_0x12cd('0x58')](_0x3413d9),['createdAt',_0x12cd('0x9f'),_0x12cd('0xa1'),_0x12cd('0xa2')]);if(_0x2a3ecb[_0x12cd('0x70')]['id']){delete _0x2a3ecb[_0x12cd('0x70')]['id'];}if(_[_0x12cd('0x8a')](_0x2a3ecb[_0x12cd('0x70')]['from'])){throw new db[(_0x12cd('0x9b'))][(_0x12cd('0x9c'))]('from\x20is\x20mandatory');}if(_[_0x12cd('0x8a')](_0x2a3ecb[_0x12cd('0x70')][_0x12cd('0x70')])||_0x2a3ecb[_0x12cd('0x70')][_0x12cd('0x70')]===''){throw new db[(_0x12cd('0x9b'))][(_0x12cd('0x9c'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2a3ecb['body'][_0x12cd('0xa3')])){throw new db[(_0x12cd('0x9b'))]['ValidationError'](_0x12cd('0xa4')+_0x335fe2);}if(!_[_0x12cd('0xa5')](_0x335fe2,_0x2a3ecb['body'][_0x12cd('0xa3')])){throw new db[(_0x12cd('0x9b'))]['ValidationError'](_0x12cd('0xa6')+_0x335fe2);}_0x3d9991[_0x2a3ecb['body'][_0x12cd('0xa3')]]=_0x2a3ecb['body'][_0x12cd('0xa7')];})[_0x12cd('0x13')](function(){return db[_0x12cd('0x53')][_0x12cd('0x6e')]({'where':{'id':_0x2a3ecb[_0x12cd('0x6c')]['id']},'include':[{'model':db[_0x12cd('0xa8')],'as':_0x12cd('0xa9'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x3d9991,'limit':0x1,'order':[[_0x12cd('0x9f'),_0x12cd('0xaa')]]}]},{'model':db[_0x12cd('0xab')],'as':_0x12cd('0xac')},{'model':db[_0x12cd('0x39')],'as':'Interval','include':[{'model':db[_0x12cd('0x39')],'as':'Intervals','attributes':['id',_0x12cd('0x33')],'raw':!![]}]}]});})[_0x12cd('0x13')](function(_0x216353){if(!_0x216353)throw new APINotFoundError(util['format']('Chat\x20Website\x20with\x20id\x20%s\x20not\x20found',_0x2a3ecb[_0x12cd('0x6c')]['id']));if(!_0x216353[_0x12cd('0x39')]||!_0x216353['Interval'][_0x12cd('0x3a')])return[_0x216353,!![]];return[_0x216353,checkWebsiteIntervals(_0x216353)];})[_0x12cd('0xad')](function(_0x7734dd,_0xcc01c8){if(!_0xcc01c8)throw new APIOutOfIntervalError();if(!_0x7734dd['List'])return;_0x14c513[_0x12cd('0xae')]=_0x7734dd;_0x14c513[_0x12cd('0xaf')]=_0x7734dd[_0x12cd('0xa9')];_0x14c513[_0x12cd('0xb0')]=_['orderBy'](_0x7734dd[_0x12cd('0xac')],['priority'],['asc']);if(_0x14c513[_0x12cd('0xae')][_0x12cd('0xac')]){delete _0x14c513[_0x12cd('0xae')][_0x12cd('0xac')];}if(_0x14c513[_0x12cd('0xae')]['List']&&_0x14c513[_0x12cd('0xae')]['List']['Contacts'][_0x12cd('0x5d')]){return _0x14c513['account'][_0x12cd('0xa9')][_0x12cd('0xb1')][0x0];}var _0x459a57=_[_0x12cd('0xd')](_0x2a3ecb[_0x12cd('0x70')],{'firstName':_0x2a3ecb[_0x12cd('0x70')][_0x12cd('0xa7')],'ListId':_0x7734dd[_0x12cd('0xa2')]});_0x459a57[_0x2a3ecb['body'][_0x12cd('0xa3')]]=_0x2a3ecb[_0x12cd('0x70')][_0x12cd('0xa7')];return db[_0x12cd('0x9a')]['create'](_0x459a57,{'fields':_0x5a8390,'raw':!![]});})[_0x12cd('0x13')](function(_0x3d24c3){_0x14c513[_0x12cd('0xb2')]=_0x3d24c3;var _0x31b9a9=createInteractionObject(_0x2a3ecb[_0x12cd('0x6c')]['id'],_0x2a3ecb[_0x12cd('0x70')],_0x2a3ecb[_0x12cd('0xb3')],_0x3d24c3);var _0x4bb76d={'ChatWebsiteId':_0x2a3ecb[_0x12cd('0x6c')]['id'],'closed':![]};if(_0x2a3ecb['body'][_0x12cd('0xb4')]){_0x4bb76d['threadId']=_0x2a3ecb[_0x12cd('0x70')][_0x12cd('0xb4')];return db[_0x12cd('0xb5')][_0x12cd('0x6e')]({'where':_0x4bb76d})[_0x12cd('0x13')](function(_0x25e08a){if(_0x25e08a){_0x2c0079=!![];return _0x25e08a;}_0x31b9a9['threadId']=_0x2a3ecb[_0x12cd('0x70')][_0x12cd('0xb4')];_0x31b9a9[_0x12cd('0xb6')]=_0x2a3ecb[_0x12cd('0x70')]['externalUrl'];return db[_0x12cd('0xb5')][_0x12cd('0x6f')](_0x31b9a9);});}_0x4bb76d['ContactId']=_0x3d24c3['id'];if(_0x2a3ecb[_0x12cd('0x70')][_0x12cd('0xb7')]&&_0x2a3ecb[_0x12cd('0x70')]['interaction']['id']){_0x4bb76d['id']=_0x2a3ecb[_0x12cd('0x70')][_0x12cd('0xb7')]['id'];return db[_0x12cd('0xb5')]['find']({'where':_0x4bb76d})['then'](function(_0x3aff96){if(_0x3aff96){_0x2c0079=!![];return _0x3aff96;}return db[_0x12cd('0xb5')]['create'](_0x31b9a9);});}return db[_0x12cd('0xb5')][_0x12cd('0x6f')](_0x31b9a9);})[_0x12cd('0x13')](function(_0x2d8792){if(!_0x2c0079)return _0x2d8792;var _0x26c640={'from':(_0x14c513[_0x12cd('0xb2')][_0x12cd('0x44')]||'')+'\x20'+(_0x14c513[_0x12cd('0xb2')][_0x12cd('0x45')]||'')};if(_0x2a3ecb['body']['threadId']&&_0x2a3ecb[_0x12cd('0x70')][_0x12cd('0xb8')]&&_0x2a3ecb[_0x12cd('0x70')]['threadId']!=_0x2a3ecb['body']['messageId']){_0x26c640['threadId']=_0x2a3ecb[_0x12cd('0x70')][_0x12cd('0xb8')];}return _0x2d8792[_0x12cd('0x75')](_0x26c640);})[_0x12cd('0x13')](function(_0x37738c){_0x14c513[_0x12cd('0xb7')]=_0x37738c[_0x12cd('0x3b')]({'plain':!![]});_0x14c513[_0x12cd('0xb7')]['created']=!_0x2c0079;if(_0x14c513[_0x12cd('0xb7')][_0x12cd('0xb9')]){if(_0x14c513[_0x12cd('0xae')][_0x12cd('0xba')]){_0x14c513[_0x12cd('0xb0')][_0x12cd('0xbb')]({'id':0x0,'priority':_0x14c513[_0x12cd('0xb0')][_0x12cd('0x5d')]+0x1,'app':_0x12cd('0xbc'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0x12cd('0xbd')][_0x12cd('0x6f')]({'body':_0x2a3ecb[_0x12cd('0x70')][_0x12cd('0x70')],'ChatWebsiteId':_0x2a3ecb[_0x12cd('0x6c')]['id'],'ChatInteractionId':_0x37738c['id'],'direction':'in','ContactId':_0x14c513['contact']['id'],'AttachmentId':_0x2a3ecb[_0x12cd('0x70')][_0x12cd('0xbe')]});})[_0x12cd('0x13')](function(_0x16103e){_0x14c513['message']=_0x16103e;if(!_0x14c513[_0x12cd('0xb7')][_0x12cd('0xbf')]){return;}return db[_0x12cd('0xc0')]['find']({'attributes':['id',_0x12cd('0x2c')],'where':{'id':_0x14c513[_0x12cd('0xb7')][_0x12cd('0xbf')]}});})[_0x12cd('0x13')](function(_0xc5479){if(_0xc5479){_0x14c513[_0x12cd('0xb0')]['unshift']({'id':0x0,'priority':0x0,'app':_0x12cd('0xc1'),'appdata':_0xc5479[_0x12cd('0x2c')]+','+(_0x14c513[_0x12cd('0xae')][_0x12cd('0xc2')]||0xa),'interval':_0x12cd('0xc3')});_0x14c513[_0x12cd('0xc4')]=!![];}if(!_0x14c513['interaction']['queueId']){return;}return db[_0x12cd('0xc5')]['find']({'attributes':['id','name'],'where':{'id':_0x14c513[_0x12cd('0xb7')][_0x12cd('0xc6')]}});})['then'](function(_0x1b81a8){if(_0x1b81a8){_0x14c513[_0x12cd('0xb0')][_0x12cd('0xc7')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x1b81a8[_0x12cd('0x2c')]+','+(_0x14c513[_0x12cd('0xae')][_0x12cd('0xc8')]||0x12c),'interval':_0x12cd('0xc3')});}return respondWithRpcPromise(_0x12cd('0xc9'),_0x12cd('0xca'),_0x14c513);})['then'](function(_0xf4be09){respondWithRpcPromise(_0x12cd('0xcb'),_0x12cd('0xcb'),{'event':_0x12cd('0x98'),'message':_0xf4be09},client9002);return _0xf4be09;})[_0x12cd('0x13')](respondWithResult(_0x5ad450,null))[_0x12cd('0x1e')](APIHandleError(_0x5ad450));};exports[_0x12cd('0xcc')]=function(_0xdd12c,_0xbd5c34){var _0x1bb99b,_0x1120bb,_0x3bc6e3;var _0x16218e=[];var _0x354422={};var _0xa006a3=_0xdd12c[_0x12cd('0xcd')]||[];var _0x57e8a9=[];var _0x5b83d1;return db['CmContact'][_0x12cd('0x76')]()[_0x12cd('0x13')](function(_0x416409){if(!_0x416409){throw new db['Sequelize'][(_0x12cd('0x9c'))](_0x12cd('0x9d'));}_0x16218e=_[_0x12cd('0xa0')](_[_0x12cd('0x58')](_0x416409),['createdAt',_0x12cd('0x9f'),_0x12cd('0xa1'),_0x12cd('0xa2')]);if(_0xdd12c[_0x12cd('0x70')]['id']){delete _0xdd12c[_0x12cd('0x70')]['id'];}if(_[_0x12cd('0x8a')](_0xdd12c[_0x12cd('0x70')]['from'])){throw _0xbd5c34[_0x12cd('0x1f')](0x1f4)['send'](new db[(_0x12cd('0x9b'))][(_0x12cd('0x9c'))](_0x12cd('0xce')));}if(_[_0x12cd('0x8a')](_0xdd12c[_0x12cd('0x70')][_0x12cd('0x70')])||_0xdd12c['body'][_0x12cd('0x70')]===''){throw _0xbd5c34[_0x12cd('0x1f')](0x1f4)['send'](new db[(_0x12cd('0x9b'))]['ValidationError'](_0x12cd('0xcf')));}if(_[_0x12cd('0x8a')](_0xdd12c[_0x12cd('0x70')][_0x12cd('0xd0')])){throw _0xbd5c34[_0x12cd('0x1f')](0x1f4)[_0x12cd('0x2d')](new db[(_0x12cd('0x9b'))][(_0x12cd('0x9c'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x16218e));}if(!_[_0x12cd('0xa5')](_0x16218e,_0xdd12c[_0x12cd('0x70')][_0x12cd('0xd0')])){throw _0xbd5c34[_0x12cd('0x1f')](0x1f4)['send'](new db[(_0x12cd('0x9b'))][(_0x12cd('0x9c'))](_0x12cd('0xd1')+_0x16218e));}_0x354422[_0xdd12c['body'][_0x12cd('0xd0')]]=_0xdd12c['body'][_0x12cd('0xa7')];})['then'](function(){return db[_0x12cd('0x53')][_0x12cd('0x6e')]({'where':{'id':_0xdd12c['params']['id']},'include':[{'model':db[_0x12cd('0xa8')],'as':_0x12cd('0xa9')},{'model':db[_0x12cd('0xd2')],'as':_0x12cd('0xd2')}]});})['then'](handleEntityNotFound(_0xbd5c34,null))[_0x12cd('0x13')](function(_0x5ea350){if(_0x5ea350&&_0x5ea350[_0x12cd('0xa9')]){_0x1120bb=_0x5ea350;var _0x35a80a=_['defaults'](_0xdd12c[_0x12cd('0x70')],{'firstName':_0xdd12c[_0x12cd('0x70')][_0x12cd('0xa7')],'phone':_0xdd12c['body'][_0x12cd('0xa7')],'ListId':_0x5ea350[_0x12cd('0xa2')]});_0x35a80a[_0xdd12c[_0x12cd('0x70')]['mapKeyOffline']]=_0xdd12c[_0x12cd('0x70')][_0x12cd('0xa7')];return db[_0x12cd('0x9a')]['findOrCreate']({'where':_0x354422,'defaults':_0x35a80a});}})[_0x12cd('0xad')](function(_0x413cf0){if(_0x413cf0){_0x3bc6e3=_0x413cf0;var _0x2d7f8a=fs[_0x12cd('0xd3')](path[_0x12cd('0x88')](config['root'],_0x12cd('0xd4')),_0x12cd('0xd5'));var _0x2d92cf=ejs['render'](_0x2d7f8a,{'body':_['toPairs'](_0xdd12c[_0x12cd('0x70')][_0x12cd('0x70')]),'bodyTitle':_0x1120bb['offlineMessageBody']});return db[_0x12cd('0xd6')][_0x12cd('0x6f')]({'body':_0x2d92cf,'plainBody':htmlToText[_0x12cd('0xd7')](_0x2d92cf),'ContactId':_0x413cf0['id'],'ChatWebsiteId':_0x1120bb['id']});}})[_0x12cd('0x13')](function(_0x1fb1a2){_0x5b83d1=_0x1fb1a2;if(_0xa006a3[_0x12cd('0x5d')]){var _0x4a4107=_0xa006a3['map'](function(_0x456c93){return{'name':_0x456c93[_0x12cd('0xd8')],'basename':_0x456c93[_0x12cd('0x84')],'type':_0x456c93['mimetype'],'ChatOfflineMessageId':_0x1fb1a2['id']};});_0x57e8a9=_0x4a4107[_0x12cd('0x38')](_0x2c948b=>{var _0x3dd6f0={'filename':_0x2c948b[_0x12cd('0x2c')],'path':path[_0x12cd('0x88')](config['root'],_0x12cd('0xd9'),_0x12cd('0xcd'),_0x12cd('0xda'),'offline-chat',_0x2c948b[_0x12cd('0xdb')])};return _0x3dd6f0;});if(!_0x1120bb['openNewInteraction']){return db[_0x12cd('0xdc')][_0x12cd('0xdd')](function(_0xae8c3d){return db[_0x12cd('0xde')][_0x12cd('0xdf')](_0x4a4107,{'transaction':_0xae8c3d});});}}})[_0x12cd('0x13')](function(){if(_0x5b83d1){_0x1bb99b=_0x5b83d1;return db['MailAccount'][_0x12cd('0x7b')]({'where':{'service':!![]},'include':[{'model':db[_0x12cd('0xe0')],'as':_0x12cd('0xe1'),'raw':!![],'include':[{'model':db[_0x12cd('0xe2')],'as':_0x12cd('0xe2'),'raw':!![]}]}]});}})[_0x12cd('0x13')](function(_0x520c42){if(_0x520c42&&_0x520c42['Smtp']&&_0x1120bb[_0x12cd('0xe3')]&&_0x1120bb[_0x12cd('0xe4')]){var _0x3fa0ad=_0x520c42['getSmtpOptions']();return respondWithRpcPromise(_0x12cd('0xe5'),'sendMail',{'account':_0x3fa0ad,'message':{'from':util[_0x12cd('0x30')](_0x12cd('0xe6'),_0x520c42[_0x12cd('0x2c')],_0x520c42[_0x12cd('0xe7')]||_0x520c42[_0x12cd('0xe1')][_0x12cd('0x71')]),'to':_0x1120bb[_0x12cd('0xe4')],'subject':_0x1120bb[_0x12cd('0xe8')],'html':_0x1bb99b[_0x12cd('0x70')],'attachments':_0x57e8a9}},client9003)[_0x12cd('0x13')](function(){return _0x1bb99b;})[_0x12cd('0x1e')](function(_0x35d51d){logger['error'](_0x35d51d);});}})[_0x12cd('0x13')](function(){if(_0x1120bb&&_0x1120bb['openNewInteraction']&&_0x1120bb[_0x12cd('0xe9')]){var _0xc884fb=[];if(_0xa006a3[_0x12cd('0x5d')]){_0xc884fb=_0xa006a3[_0x12cd('0x38')](function(_0x1798ad){return{'name':_0x1798ad[_0x12cd('0xd8')],'basename':_0x1798ad['filename'],'type':_0x1798ad[_0x12cd('0xea')],'ChatOfflineMessageId':_0x5b83d1['id']};});}var _0x532d18;if(!_[_0x12cd('0x8a')](_0x1120bb[_0x12cd('0xeb')])){var _0x2b1d79=_[_0x12cd('0x38')](_0xdd12c[_0x12cd('0x70')],function(_0x596a6e){return _0x596a6e;});var _0x277b03=_[_0x12cd('0xec')](_0x2b1d79)[0x0];var _0x2344cf=_[_0x12cd('0xed')](_0x277b03,function(_0x5854ea){return _0x5854ea;});_0x532d18=_0x2344cf[0x1][_0x1120bb[_0x12cd('0xeb')]];}var _0x528056={'from':_0x3bc6e3['email'],'firstName':_0x3bc6e3[_0x12cd('0x44')],'lastName':_0x3bc6e3['lastName'],'mapKey':_0x12cd('0xe7'),'message':{'from':_0x3bc6e3[_0x12cd('0xe7')],'to':_0x1120bb['MailAccount']['email'],'cc':'','subject':_[_0x12cd('0x8a')](_0x532d18)?_0x1120bb[_0x12cd('0xe8')]:_0x532d18,'messageId':'','sentAt':new Date(),'attach':_0xc884fb[_0x12cd('0x5d')],'attachments':_0xc884fb,'originChannel':_0x12cd('0xee'),'ChatWebsiteId':_0x1120bb['id'],'ChatOfflineMessageId':_0x1bb99b['id'],'originTo':_0x1120bb['MailAccount'][_0x12cd('0xe7')]},'body':_0x1bb99b[_0x12cd('0x70')]};var _0x1af560={'account':{'id':_0x1120bb[_0x12cd('0xe9')]},'body':_0x528056,'log':_0x12cd('0xef')};return respondWithRpcPromise(_0x12cd('0xef'),_0x12cd('0xf0'),_0x1af560,client9001)[_0x12cd('0x13')](function(){return _0x1bb99b;})[_0x12cd('0x1e')](function(_0x32b757){logger[_0x12cd('0x19')](_0x32b757);});}return;})[_0x12cd('0x13')](function(){if(_0x1bb99b){return _0x1bb99b;}})[_0x12cd('0x13')](respondWithResult(_0xbd5c34,null))[_0x12cd('0x1e')](function(){for(var _0x4c28c2 of _0xa006a3){var _0x5b9618=path[_0x12cd('0x88')](config[_0x12cd('0x8d')],_0x12cd('0xd9'),_0x12cd('0xcd'),_0x12cd('0xda'),_0x12cd('0xf1'),_0x4c28c2['filename']);fs_extra['remove'](_0x5b9618)[_0x12cd('0x1e')](function(_0x5b76a1){logger[_0x12cd('0x19')]('Could\x20not\x20remove\x20attachment\x20file',_0x5b9618,_0x5b76a1);});}});};exports[_0x12cd('0xf2')]=function(_0x5b95fc,_0x3f9562){return db[_0x12cd('0xb5')]['find']({'where':{'id':_0x5b95fc[_0x12cd('0x6c')]['id']}})[_0x12cd('0x13')](handleEntityNotFound(_0x3f9562,null))[_0x12cd('0x13')](function(_0x501354){if(_0x501354){return _0x501354['addInteraction'](_0x5b95fc[_0x12cd('0x70')][_0x12cd('0xf3')],_[_0x12cd('0xf4')](_0x5b95fc[_0x12cd('0x70')],[_0x12cd('0xf3'),'id'])||{});}})[_0x12cd('0x13')](respondWithResult(_0x3f9562,null))[_0x12cd('0x1e')](handleError(_0x3f9562,null));};exports[_0x12cd('0xf5')]=function(_0x442760,_0x55728a){var _0x5e882d={'raw':![],'where':{}};var _0x5f0eeb={};var _0x753532={'count':0x0,'rows':[]};return db[_0x12cd('0x53')][_0x12cd('0x7b')]({'where':{'id':_0x442760[_0x12cd('0x6c')]['id']}})[_0x12cd('0x13')](handleEntityNotFound(_0x55728a,null))[_0x12cd('0x13')](function(_0x29169e){if(_0x29169e){_0x5f0eeb[_0x12cd('0x4e')]=_['keys'](db['ChatInteraction'][_0x12cd('0x54')]);_0x5f0eeb[_0x12cd('0x57')]=_[_0x12cd('0x58')](_0x442760['query']);_0x5f0eeb[_0x12cd('0x59')]=_[_0x12cd('0x5a')](_0x5f0eeb[_0x12cd('0x4e')],_0x5f0eeb['query']);_0x5e882d[_0x12cd('0x5b')]=_['intersection'](_0x5f0eeb[_0x12cd('0x4e')],qs[_0x12cd('0x5c')](_0x442760[_0x12cd('0x57')][_0x12cd('0x5c')]));_0x5e882d[_0x12cd('0x5b')]=_0x5e882d[_0x12cd('0x5b')]['length']?_0x5e882d['attributes']:_0x5f0eeb[_0x12cd('0x4e')];if(!_0x442760[_0x12cd('0x57')][_0x12cd('0x5e')]('nolimit')){_0x5e882d[_0x12cd('0x24')]=qs[_0x12cd('0x24')](_0x442760[_0x12cd('0x57')][_0x12cd('0x24')]);_0x5e882d[_0x12cd('0x22')]=qs[_0x12cd('0x22')](_0x442760[_0x12cd('0x57')][_0x12cd('0x22')]);}_0x5e882d[_0x12cd('0x60')]=qs[_0x12cd('0x61')](_0x442760[_0x12cd('0x57')][_0x12cd('0x61')]);_0x5e882d[_0x12cd('0x63')]=qs[_0x12cd('0x59')](_['pick'](_0x442760[_0x12cd('0x57')],_0x5f0eeb[_0x12cd('0x59')]));_0x5e882d[_0x12cd('0x63')][_0x12cd('0x78')]=_0x29169e['id'];if(_0x442760[_0x12cd('0x57')][_0x12cd('0x66')]){_0x5e882d[_0x12cd('0x63')]=_[_0x12cd('0x64')](_0x5e882d[_0x12cd('0x63')],{'$or':_[_0x12cd('0x38')](_0x5e882d['attributes'],function(_0x3895ae){var _0xc3fe18={};_0xc3fe18[_0x3895ae]={'$like':'%'+_0x442760[_0x12cd('0x57')][_0x12cd('0x66')]+'%'};return _0xc3fe18;})});}_0x5e882d=_['merge']({},_0x5e882d,_0x442760[_0x12cd('0x80')]);return db['ChatInteraction'][_0x12cd('0x25')]({'where':_0x5e882d[_0x12cd('0x63')]})['then'](function(_0x56ca9f){_0x753532[_0x12cd('0x25')]=_0x56ca9f;if(_0x442760[_0x12cd('0x57')]['includeAll']){_0x5e882d[_0x12cd('0x68')]=[{'model':db['CmContact'],'as':_0x12cd('0xf6'),'required':![]},{'model':db['User'],'as':_0x12cd('0xf7'),'attributes':[_0x12cd('0x2c'),_0x12cd('0xf8'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x12cd('0xf9'),'attributes':['id',_0x12cd('0x2c'),_0x12cd('0xfa')],'where':_0x442760[_0x12cd('0x57')][_0x12cd('0xfb')]?{'id':_0x442760[_0x12cd('0x57')]['tag']}:undefined,'required':_0x442760['query']['tag']?!![]:![]}];}return db[_0x12cd('0xb5')][_0x12cd('0x69')](_0x5e882d);})['then'](function(_0x106c17){_0x753532[_0x12cd('0x6a')]=_0x106c17;return _0x753532;});}})['then'](respondWithFilteredResult(_0x55728a,_0x5e882d))['catch'](handleError(_0x55728a,null));};exports['getSnippet']=function(_0x52b360,_0x4d28e2){var _0x50f7d3=0x0;var _0x20b98a=0x0;var _0x24e44d=![];var _0x59ee60;var _0x2ef3b1;return db[_0x12cd('0x53')][_0x12cd('0x6e')]({'where':{'id':_0x52b360['params']['id']},'include':[{'model':db['Interval'],'as':_0x12cd('0x39'),'include':[{'model':db[_0x12cd('0x39')],'as':'Intervals','attributes':['id',_0x12cd('0x33')]}]}]})[_0x12cd('0x13')](handleEntityNotFound(_0x4d28e2,null))[_0x12cd('0x13')](function(_0x4c070c){if(_0x4c070c){_0x59ee60=_0x4c070c;return _0x4c070c['getProactiveActions']({'raw':!![]});}})[_0x12cd('0x13')](function(_0x59dd4f){if(_0x59ee60){if(_0x59dd4f){_0x2ef3b1=_0x59dd4f;}}return require('../../config/license/util')[_0x12cd('0x89')]();})['then'](function(_0x3a4b80){if(_0x3a4b80){_0x20b98a=_0x3a4b80['virtual'];_0x24e44d=_0x3a4b80[_0x12cd('0xfc')];}})[_0x12cd('0x13')](function(){return db['ChatInteraction'][_0x12cd('0x25')]({'where':{'closed':![]}});})[_0x12cd('0x13')](function(_0x2a25f5){_0x50f7d3=_0x2a25f5;if(_0x20b98a&&_0x2a25f5>_0x20b98a){return db[_0x12cd('0xfd')][_0x12cd('0x7b')]({'where':{'id':0x1}})[_0x12cd('0x13')](function(_0x241790){if(_0x241790){_0x241790[_0x12cd('0xfe')](_0x12cd('0xff'));}});}})[_0x12cd('0x13')](function(){if(!_0x59ee60[_0x12cd('0x39')]||!_0x59ee60[_0x12cd('0x39')][_0x12cd('0x3a')])return!![];return checkWebsiteIntervals(_0x59ee60);})[_0x12cd('0x13')](function(_0x5845bf){var _0x5213b0=fs['readFileSync'](path[_0x12cd('0x88')](config[_0x12cd('0x8d')],_0x12cd('0x100')),_0x12cd('0xd5'));var _0x3a5c7b=new url[(_0x12cd('0x101'))](_0x59ee60[_0x12cd('0x102')])['origin'];var _0x3984af=_0x12cd('0x103');var _0x34684b=![];var _0x444bc3={'chatVersion':_0x3984af,'chatWebsiteAddressOrigin':_0x3a5c7b,'remote':_0x59ee60[_0x12cd('0x104')],'query':querystring[_0x12cd('0x18')](_[_0x12cd('0x64')](_0x59ee60[_0x12cd('0x3b')]({'plain':!![]}),{'customerIp':_0x52b360[_0x12cd('0xb3')][_0x12cd('0x42')]||_0x52b360[_0x12cd('0xb3')][_0x12cd('0x105')]||_0x52b360[_0x12cd('0x106')][_0x12cd('0x107')]||_0x52b360['ip'],'referer':_0x52b360[_0x12cd('0xb3')][_0x12cd('0x47')],'openedInteractions':_0x50f7d3,'maxInteractions':_0x20b98a,'virtual':_0x24e44d[_0x12cd('0x108')],'online':_0x5845bf,'custom':_0x24e44d}))[_0x12cd('0x109')](/'/g,'\x5c\x27')};_0x4d28e2[_0x12cd('0x2d')](ejs[_0x12cd('0x10a')](Mustache[_0x12cd('0x10a')](_0x5213b0,_0x444bc3),{'proactiveActions':_0x2ef3b1,'alignment':_0x59ee60[_0x12cd('0x10b')],'verticalAlignment':_0x59ee60['verticalAlignment'],'div_color':_0x59ee60[_0x12cd('0xfa')],'labelText':_0x59ee60['labelText'],'text_color':_0x59ee60[_0x12cd('0x10c')],'text_button_color':_0x59ee60[_0x12cd('0x10d')],'button_color':_0x59ee60[_0x12cd('0x10e')],'background_color':_0x59ee60[_0x12cd('0x10f')],'hideWhenOffline':_0x59ee60[_0x12cd('0x110')],'intervalId':_0x59ee60[_0x12cd('0x111')],'isDevelopment':_0x34684b,'chatVersion':_0x3984af}));})[_0x12cd('0x1e')](handleError(_0x4d28e2,null));};exports[_0x12cd('0x112')]=function(_0x4830f6,_0x345053){var _0x44ab3f=_0x4830f6[_0x12cd('0x6c')]['id'];var _0x4cb9f3=_0x4830f6[_0x12cd('0x70')];var _0x4e18eb=0xc8;var _0x50fd58=null;return db['sequelize'][_0x12cd('0xdd')]({'isolationLevel':db[_0x12cd('0xdc')][_0x12cd('0x113')]['ISOLATION_LEVELS'][_0x12cd('0x114')]},function(_0x155d3c){return db['ChatWebsite']['findOne']({'where':{'id':_0x44ab3f},'transaction':_0x155d3c})[_0x12cd('0x13')](function(_0x37d75a){if(_0x37d75a){return db['ChatApplication']['destroy']({'where':{'ChatWebsiteId':_0x44ab3f},'transaction':_0x155d3c})['then'](function(){var _0x5452ec=_[_0x12cd('0x38')](_0x4cb9f3,function(_0x54798a){_0x54798a[_0x12cd('0x78')]=_0x44ab3f;return _0x54798a;});return db[_0x12cd('0xab')][_0x12cd('0xdf')](_0x5452ec,{'transaction':_0x155d3c});});}else{_0x4e18eb=0x194;_0x50fd58=[];}});})[_0x12cd('0x13')](function(){if(_0x4e18eb!==0x194){return db[_0x12cd('0xab')][_0x12cd('0x115')]({'where':{'ChatWebsiteId':_0x44ab3f},'order':_0x12cd('0x116')})['then'](function(_0x258967){_0x50fd58=_0x258967;});}})['catch'](function(_0x54ea7e){_0x4e18eb=0x1f4;logger['error'](_0x54ea7e['stack']);if(_0x54ea7e['name']){delete _0x54ea7e[_0x12cd('0x2c')];}_0x50fd58=_0x54ea7e;})[_0x12cd('0x117')](function(){if(_0x50fd58===null){_0x345053[_0x12cd('0x2b')](_0x4e18eb);}else{if(_0x4e18eb===0x1f4){_0x345053['status'](_0x4e18eb)[_0x12cd('0x2d')](_0x50fd58);}else{_0x345053[_0x12cd('0x1f')](_0x4e18eb)[_0x12cd('0x21')](_0x50fd58);}}});};exports[_0x12cd('0x118')]=function(_0x1fef1d,_0x5909f2){var _0x927a45={};var _0x5e9936={};var _0x427dce;var _0x4cf473;return db[_0x12cd('0x53')][_0x12cd('0x7b')]({'where':{'id':_0x1fef1d[_0x12cd('0x6c')]['id']}})[_0x12cd('0x13')](handleEntityNotFound(_0x5909f2,null))[_0x12cd('0x13')](function(_0x5aa08b){if(_0x5aa08b){_0x427dce=_0x5aa08b;_0x5e9936[_0x12cd('0x4e')]=_[_0x12cd('0x58')](db[_0x12cd('0xab')][_0x12cd('0x54')]);_0x5e9936['query']=_[_0x12cd('0x58')](_0x1fef1d[_0x12cd('0x57')]);_0x5e9936['filters']=_['intersection'](_0x5e9936[_0x12cd('0x4e')],_0x5e9936['query']);_0x927a45[_0x12cd('0x5b')]=_[_0x12cd('0x5a')](_0x5e9936[_0x12cd('0x4e')],qs[_0x12cd('0x5c')](_0x1fef1d[_0x12cd('0x57')][_0x12cd('0x5c')]));_0x927a45[_0x12cd('0x5b')]=_0x927a45[_0x12cd('0x5b')][_0x12cd('0x5d')]?_0x927a45[_0x12cd('0x5b')]:_0x5e9936['model'];_0x927a45[_0x12cd('0x60')]=qs[_0x12cd('0x61')](_0x1fef1d[_0x12cd('0x57')][_0x12cd('0x61')]);_0x927a45[_0x12cd('0x63')]=qs[_0x12cd('0x59')](_[_0x12cd('0x62')](_0x1fef1d[_0x12cd('0x57')],_0x5e9936[_0x12cd('0x59')]));if(_0x1fef1d[_0x12cd('0x57')][_0x12cd('0x66')]){_0x927a45[_0x12cd('0x63')]=_[_0x12cd('0x64')](_0x927a45[_0x12cd('0x63')],{'$or':_[_0x12cd('0x38')](_0x927a45[_0x12cd('0x5b')],function(_0x5da4cf){var _0x1ff8fc={};_0x1ff8fc[_0x5da4cf]={'$like':'%'+_0x1fef1d['query']['filter']+'%'};return _0x1ff8fc;})});}_0x927a45=_['merge']({},_0x927a45,_0x1fef1d['options']);return _0x427dce[_0x12cd('0x118')](_0x927a45);}})['then'](function(_0xa77b36){if(_0xa77b36){_0x4cf473=_0xa77b36[_0x12cd('0x5d')];if(!_0x1fef1d[_0x12cd('0x57')]['hasOwnProperty'](_0x12cd('0x5f'))){_0x927a45[_0x12cd('0x24')]=qs[_0x12cd('0x24')](_0x1fef1d[_0x12cd('0x57')][_0x12cd('0x24')]);_0x927a45[_0x12cd('0x22')]=qs['offset'](_0x1fef1d[_0x12cd('0x57')][_0x12cd('0x22')]);}return _0x427dce[_0x12cd('0x118')](_0x927a45);}})[_0x12cd('0x13')](function(_0x41619c){if(_0x41619c){return _0x41619c?{'count':_0x4cf473,'rows':_0x41619c}:null;}})[_0x12cd('0x13')](respondWithResult(_0x5909f2,null))[_0x12cd('0x1e')](handleError(_0x5909f2,null));};exports[_0x12cd('0x119')]=function(_0x135d8d,_0x274fb2){return db[_0x12cd('0x11a')]['find']({'where':{'id':_0x135d8d['params']['id']}})[_0x12cd('0x13')](handleEntityNotFound(_0x274fb2,null))[_0x12cd('0x13')](function(_0x445b9b){if(_0x445b9b){return _0x445b9b[_0x12cd('0x119')](_0x135d8d[_0x12cd('0x70')][_0x12cd('0xf3')],_['omit'](_0x135d8d['body'],[_0x12cd('0xf3'),'id'])||{});}})[_0x12cd('0x13')](respondWithResult(_0x274fb2,null))[_0x12cd('0x1e')](handleError(_0x274fb2,null));};exports[_0x12cd('0x11b')]=function(_0x559c6c,_0x138d75){var _0x37c833={};var _0x310a8d={};var _0x2d22fb;var _0xaffe48;return db[_0x12cd('0x53')]['findOne']({'where':{'id':_0x559c6c[_0x12cd('0x6c')]['id']}})[_0x12cd('0x13')](handleEntityNotFound(_0x138d75,null))['then'](function(_0x58ec37){if(_0x58ec37){_0x2d22fb=_0x58ec37;_0x310a8d[_0x12cd('0x4e')]=_[_0x12cd('0x58')](db[_0x12cd('0x11c')][_0x12cd('0x54')]);_0x310a8d['query']=_[_0x12cd('0x58')](_0x559c6c[_0x12cd('0x57')]);_0x310a8d[_0x12cd('0x59')]=_['intersection'](_0x310a8d[_0x12cd('0x4e')],_0x310a8d[_0x12cd('0x57')]);_0x37c833['attributes']=_[_0x12cd('0x5a')](_0x310a8d[_0x12cd('0x4e')],qs[_0x12cd('0x5c')](_0x559c6c[_0x12cd('0x57')]['fields']));_0x37c833[_0x12cd('0x5b')]=_0x37c833['attributes'][_0x12cd('0x5d')]?_0x37c833[_0x12cd('0x5b')]:_0x310a8d[_0x12cd('0x4e')];_0x37c833[_0x12cd('0x60')]=qs['sort'](_0x559c6c[_0x12cd('0x57')]['sort']);_0x37c833[_0x12cd('0x63')]=qs[_0x12cd('0x59')](_[_0x12cd('0x62')](_0x559c6c['query'],_0x310a8d[_0x12cd('0x59')]));if(_0x559c6c[_0x12cd('0x57')]['filter']){_0x37c833['where']=_[_0x12cd('0x64')](_0x37c833['where'],{'$or':_['map'](_0x37c833[_0x12cd('0x5b')],function(_0x39fd3b){var _0x328192={};_0x328192[_0x39fd3b]={'$like':'%'+_0x559c6c[_0x12cd('0x57')][_0x12cd('0x66')]+'%'};return _0x328192;})});}_0x37c833=_[_0x12cd('0x64')]({},_0x37c833,_0x559c6c[_0x12cd('0x80')]);return _0x2d22fb[_0x12cd('0x11b')](_0x37c833);}})[_0x12cd('0x13')](function(_0x3ee4f1){if(_0x3ee4f1){_0xaffe48=_0x3ee4f1['length'];if(!_0x559c6c[_0x12cd('0x57')]['hasOwnProperty'](_0x12cd('0x5f'))){_0x37c833[_0x12cd('0x24')]=qs[_0x12cd('0x24')](_0x559c6c[_0x12cd('0x57')][_0x12cd('0x24')]);_0x37c833[_0x12cd('0x22')]=qs[_0x12cd('0x22')](_0x559c6c[_0x12cd('0x57')][_0x12cd('0x22')]);}return _0x2d22fb['getProactiveActions'](_0x37c833);}})['then'](function(_0x988c01){if(_0x988c01){return _0x988c01?{'count':_0xaffe48,'rows':_0x988c01}:null;}})['then'](respondWithResult(_0x138d75,null))[_0x12cd('0x1e')](handleError(_0x138d75,null));};exports[_0x12cd('0x11d')]=function(_0x588f5e,_0x597a66){var _0x2ae8cf=_0x588f5e[_0x12cd('0x57')][_0x12cd('0x11e')]==='false'?_0x12cd('0x11f'):_0x12cd('0x120');return db['ChatWebsite'][_0x12cd('0x6e')]({'attributes':['id',_0x2ae8cf],'where':{'id':_0x588f5e[_0x12cd('0x6c')]['id']}})[_0x12cd('0x13')](handleEntityNotFound(_0x597a66,null))['then'](function(_0x141659){if(_0x141659){var _0x5c4204=_0x141659[_0x2ae8cf];var _0x118052=_0x5c4204&&_0x5c4204[_0x12cd('0x121')]?_0x5c4204[_0x12cd('0x121')]:[];_0x597a66[_0x12cd('0x2d')]({'fromKey':_[_0x12cd('0x8a')](_0x5c4204['fromKey'])?undefined:_0x5c4204[_0x12cd('0x122')],'count':_0x118052[_0x12cd('0x5d')],'rows':_0x118052});}})[_0x12cd('0x1e')](handleError(_0x597a66,null));};exports['getOfflineMessages']=function(_0x232d5a,_0xb0a2fe){var _0x10f4df={'raw':![],'where':{}};var _0x3925e0={};var _0x706fe7={'count':0x0,'rows':[]};return db[_0x12cd('0x53')][_0x12cd('0x7b')]({'where':{'id':_0x232d5a[_0x12cd('0x6c')]['id']}})[_0x12cd('0x13')](handleEntityNotFound(_0xb0a2fe,null))[_0x12cd('0x13')](function(_0x32b4b2){if(_0x32b4b2){_0x3925e0['model']=_[_0x12cd('0x58')](db[_0x12cd('0xd6')][_0x12cd('0x54')]);_0x3925e0[_0x12cd('0x57')]=_[_0x12cd('0x58')](_0x232d5a['query']);_0x3925e0[_0x12cd('0x59')]=_['intersection'](_0x3925e0[_0x12cd('0x4e')],_0x3925e0[_0x12cd('0x57')]);_0x10f4df[_0x12cd('0x5b')]=_[_0x12cd('0x5a')](_0x3925e0[_0x12cd('0x4e')],qs[_0x12cd('0x5c')](_0x232d5a[_0x12cd('0x57')]['fields']));_0x10f4df[_0x12cd('0x5b')]=_0x10f4df[_0x12cd('0x5b')]['length']?_0x10f4df[_0x12cd('0x5b')]:_0x3925e0[_0x12cd('0x4e')];if(!_0x232d5a[_0x12cd('0x57')][_0x12cd('0x5e')](_0x12cd('0x5f'))){_0x10f4df[_0x12cd('0x24')]=qs[_0x12cd('0x24')](_0x232d5a[_0x12cd('0x57')][_0x12cd('0x24')]);_0x10f4df[_0x12cd('0x22')]=qs[_0x12cd('0x22')](_0x232d5a[_0x12cd('0x57')][_0x12cd('0x22')]);}_0x10f4df[_0x12cd('0x60')]=qs[_0x12cd('0x61')](_0x232d5a[_0x12cd('0x57')][_0x12cd('0x61')]);_0x10f4df[_0x12cd('0x63')]=qs[_0x12cd('0x59')](_[_0x12cd('0x62')](_0x232d5a[_0x12cd('0x57')],_0x3925e0['filters']));_0x10f4df[_0x12cd('0x63')][_0x12cd('0x78')]=_0x32b4b2['id'];if(_0x232d5a['query'][_0x12cd('0x66')]){_0x10f4df[_0x12cd('0x63')]=_[_0x12cd('0x64')](_0x10f4df[_0x12cd('0x63')],{'$or':_['map'](_0x10f4df[_0x12cd('0x5b')],function(_0x1a404d){var _0x4a34b2={};_0x4a34b2[_0x1a404d]={'$like':'%'+_0x232d5a[_0x12cd('0x57')][_0x12cd('0x66')]+'%'};return _0x4a34b2;})});}_0x10f4df=_[_0x12cd('0x64')]({},_0x10f4df,_0x232d5a[_0x12cd('0x80')]);return db['ChatOfflineMessage'][_0x12cd('0x25')]({'where':_0x10f4df[_0x12cd('0x63')]})[_0x12cd('0x13')](function(_0x40a626){_0x706fe7['count']=_0x40a626;if(_0x232d5a[_0x12cd('0x57')][_0x12cd('0x67')]){_0x10f4df['include']=[{'all':!![]}];}else{_0x10f4df[_0x12cd('0x68')]=[{'model':db[_0x12cd('0x9a')],'as':'Contact','required':![]},{'model':db[_0x12cd('0xde')],'as':_0x12cd('0x123'),'required':![]}];}return db[_0x12cd('0xd6')][_0x12cd('0x69')](_0x10f4df);})[_0x12cd('0x13')](function(_0x73f51e){_0x706fe7[_0x12cd('0x6a')]=_0x73f51e;return _0x706fe7;});}})[_0x12cd('0x13')](respondWithFilteredResult(_0xb0a2fe,_0x10f4df))[_0x12cd('0x1e')](handleError(_0xb0a2fe,null));};exports[_0x12cd('0x124')]=function(_0x165029,_0x24308b){return db[_0x12cd('0x53')]['find']({'where':{'id':_0x165029[_0x12cd('0x6c')]['id']}})[_0x12cd('0x13')](handleEntityNotFound(_0x24308b,null))[_0x12cd('0x13')](function(_0x114bed){if(_0x114bed){return _0x114bed[_0x12cd('0x124')](_0x165029[_0x12cd('0x70')]['ids'],_[_0x12cd('0xf4')](_0x165029[_0x12cd('0x70')],[_0x12cd('0xf3'),'id'])||{})[_0x12cd('0xad')](function(_0x336f67){for(var _0x2501e1=0x0;_0x2501e1<_0x165029[_0x12cd('0x70')][_0x12cd('0xf3')][_0x12cd('0x5d')];_0x2501e1+=0x1){socket[_0x12cd('0x125')](_0x12cd('0x126'),{'UserId':Number(_0x165029[_0x12cd('0x70')][_0x12cd('0xf3')][_0x2501e1]),'ChatWebsiteId':Number(_0x165029['params']['id'])});}return _0x336f67;});}})[_0x12cd('0x13')](respondWithResult(_0x24308b,null))[_0x12cd('0x1e')](handleError(_0x24308b,null));};exports[_0x12cd('0x127')]=function(_0x1791fc,_0x3af55c){return db[_0x12cd('0x53')]['find']({'where':{'id':_0x1791fc[_0x12cd('0x6c')]['id']}})['then'](handleEntityNotFound(_0x3af55c,null))[_0x12cd('0x13')](function(_0x12ad1c){if(_0x12ad1c){return _0x12ad1c[_0x12cd('0x127')](_0x1791fc[_0x12cd('0x57')][_0x12cd('0xf3')])[_0x12cd('0x13')](function(){if(_[_0x12cd('0x128')](_0x1791fc[_0x12cd('0x57')][_0x12cd('0xf3')])){for(var _0x2a869c=0x0;_0x2a869c<_0x1791fc[_0x12cd('0x57')][_0x12cd('0xf3')][_0x12cd('0x5d')];_0x2a869c+=0x1){socket[_0x12cd('0x125')](_0x12cd('0x129'),{'UserId':Number(_0x1791fc['query'][_0x12cd('0xf3')][_0x2a869c]),'ChatWebsiteId':Number(_0x1791fc[_0x12cd('0x6c')]['id'])});}}else{socket[_0x12cd('0x125')](_0x12cd('0x129'),{'UserId':Number(_0x1791fc[_0x12cd('0x57')][_0x12cd('0xf3')]),'ChatWebsiteId':Number(_0x1791fc['params']['id'])});}});}})[_0x12cd('0x13')](respondWithStatusCode(_0x3af55c,null))[_0x12cd('0x1e')](handleError(_0x3af55c,null));};exports[_0x12cd('0x12a')]=function(_0x9c4ca1,_0x3cbc6a){var _0x318e78={};var _0x4a4c49={};var _0x1e63c2;var _0x46fd04;return db[_0x12cd('0x53')][_0x12cd('0x7b')]({'where':{'id':_0x9c4ca1['params']['id']}})[_0x12cd('0x13')](handleEntityNotFound(_0x3cbc6a,null))[_0x12cd('0x13')](function(_0x32d3ec){if(_0x32d3ec){_0x1e63c2=_0x32d3ec;_0x4a4c49['model']=_['keys'](db[_0x12cd('0xc0')][_0x12cd('0x54')]);_0x4a4c49[_0x12cd('0x57')]=_[_0x12cd('0x58')](_0x9c4ca1['query']);_0x4a4c49[_0x12cd('0x59')]=_[_0x12cd('0x5a')](_0x4a4c49['model'],_0x4a4c49[_0x12cd('0x57')]);_0x318e78[_0x12cd('0x5b')]=_[_0x12cd('0x5a')](_0x4a4c49[_0x12cd('0x4e')],qs[_0x12cd('0x5c')](_0x9c4ca1['query'][_0x12cd('0x5c')]));_0x318e78[_0x12cd('0x5b')]=_0x318e78['attributes'][_0x12cd('0x5d')]?_0x318e78[_0x12cd('0x5b')]:_0x4a4c49['model'];_0x318e78['order']=qs['sort'](_0x9c4ca1['query'][_0x12cd('0x61')]);_0x318e78[_0x12cd('0x63')]=qs[_0x12cd('0x59')](_[_0x12cd('0x62')](_0x9c4ca1[_0x12cd('0x57')],_0x4a4c49[_0x12cd('0x59')]));if(_0x9c4ca1[_0x12cd('0x57')][_0x12cd('0x66')]){_0x318e78['where']=_[_0x12cd('0x64')](_0x318e78['where'],{'$or':_[_0x12cd('0x38')](_0x318e78[_0x12cd('0x5b')],function(_0x151e5f){var _0x45dde9={};_0x45dde9[_0x151e5f]={'$like':'%'+_0x9c4ca1[_0x12cd('0x57')][_0x12cd('0x66')]+'%'};return _0x45dde9;})});}_0x318e78=_['merge']({},_0x318e78,_0x9c4ca1[_0x12cd('0x80')]);return _0x1e63c2[_0x12cd('0x12a')](_0x318e78);}})['then'](function(_0x99e510){if(_0x99e510){_0x46fd04=_0x99e510['length'];if(!_0x9c4ca1[_0x12cd('0x57')]['hasOwnProperty'](_0x12cd('0x5f'))){_0x318e78['limit']=qs[_0x12cd('0x24')](_0x9c4ca1[_0x12cd('0x57')]['limit']);_0x318e78[_0x12cd('0x22')]=qs[_0x12cd('0x22')](_0x9c4ca1['query']['offset']);}return _0x1e63c2['getAgents'](_0x318e78);}})[_0x12cd('0x13')](function(_0x3c8420){if(_0x3c8420){return _0x3c8420?{'count':_0x46fd04,'rows':_0x3c8420}:null;}})[_0x12cd('0x13')](respondWithResult(_0x3cbc6a,null))[_0x12cd('0x1e')](handleError(_0x3cbc6a,null));}; \ No newline at end of file +var _0x72c8=['timezone','iftime\x20%s','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','interval','ONLINE','OFFLINE','No\x20timezone','map','Interval','Intervals','all','some','user-agent-parser','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','unknown','%s\x20%s','device','model','type','vendor','index','Pause','mandatoryDispositionPause','rawAttributes','key','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filter','where','VIRTUAL','ChatWebsite','includeAll','include','findAll','rows','show','keys','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatWebsites','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','ChatWebsiteId','Disposition','getDispositions','findOne','pick','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','order','removeAnswers','addLogo','filename','addAvatar','agentAvatar','file','addCustomerAvatar','addSystemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','sitepic','custom','existsSync','join','server/files/images/logos/','getAvatar','server/files/images/avatars/default_avatar.png','isNil','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','customerAvatar','server/files/images/avatars/','download','getSystemAvatar','systemAvatar','notify','chat','CmContact','Sequelize','no\x20available\x20attributes','createdAt','difference','updatedAt','ListId','from','from\x20is\x20mandatory','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','ChatApplication','Applications','spread','priority','account','contact','headers','threadId','ChatInteraction','externalUrl','ContactId','interaction','messageId','created','autoclose','push','applications','close','unmanaged','AttachmentId','unshift','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','ChatQueue','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','files','CompanyId','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','server','attachments','offline-chat','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','email','MailAccountId','mimetype','subjectOffline','toPairsIn','mapValues','offlineMessageSubject','Chat','NotifyMailAccount','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Contact','User','Owner','fullname','Tag','color','tag','getSnippet','../../config/license/util','License','server/files/chat/iframe.ejs','utf8','URL','address','origin','3.5.0','remote','x-real-ip','connection','virtual','alignment','verticalAlignment','labelText','textColor','textButtonColor','color_button','hideWhenOffline','IntervalId','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','getProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','util','path','ejs','fs-extra','html-to-text','ioredis','jayson/promise','../../components/parsers/qs','../../config/logger','../../config/environment','../../errors/api','APIOutOfIntervalError','handleError','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','json','offset','undefined','limit','count','set','update','destroy','get','UserProfileResource','end','sendStatus','name','send','Command','format','iftime\x20%s,%s'];(function(_0x5e7644,_0x560054){var _0x3cd663=function(_0x44687f){while(--_0x44687f){_0x5e7644['push'](_0x5e7644['shift']());}};_0x3cd663(++_0x560054);}(_0x72c8,0xf9));var _0x872c=function(_0x3e2849,_0x8d6597){_0x3e2849=_0x3e2849-0x0;var _0x392ef7=_0x72c8[_0x3e2849];return _0x392ef7;};'use strict';var Mustache=require('mustache');var util=require(_0x872c('0x0'));var path=require(_0x872c('0x1'));var ejs=require(_0x872c('0x2'));var fs=require('fs');var fs_extra=require(_0x872c('0x3'));var _=require('lodash');var querystring=require('querystring');var htmlToText=require(_0x872c('0x4'));var Redis=require(_0x872c('0x5'));var jayson=require(_0x872c('0x6'));var url=require('url');var qs=require(_0x872c('0x7'));var logger=require(_0x872c('0x8'))('api');var config=require(_0x872c('0x9'));var APIOutOfIntervalError=require(_0x872c('0xa'))[_0x872c('0xb')];var APINotFoundError=require(_0x872c('0xa'))['APINotFoundError'];var APIHandleError=require(_0x872c('0xa'))[_0x872c('0xc')];var db=require(_0x872c('0xd'))['db'];config[_0x872c('0xe')]=_[_0x872c('0xf')](config['redis'],{'host':_0x872c('0x10'),'port':0x18eb});var socket=require(_0x872c('0x11'))(new Redis(config[_0x872c('0xe')]));require(_0x872c('0x12'))[_0x872c('0x13')](socket);var client=jayson[_0x872c('0x14')][_0x872c('0x15')]({'port':0x232c});var client9002=jayson['client'][_0x872c('0x15')]({'port':0x232a});var client9003=jayson[_0x872c('0x14')]['http']({'port':0x232b});var client9001=jayson[_0x872c('0x14')][_0x872c('0x15')]({'port':0x2329});function respondWithRpcPromise(_0x23d0f4,_0x5d6759,_0x27baf9,_0x437a26){return new Promise(function(_0x1a39f8,_0x251277){var _0x4e161c=_0x437a26||client;return _0x4e161c['request'](_0x23d0f4,_0x27baf9)[_0x872c('0x16')](function(_0x7b0f3f){logger[_0x872c('0x17')](_0x872c('0x18'),_0x5d6759,_0x872c('0x19'));logger[_0x872c('0x1a')](_0x872c('0x1b'),_0x5d6759,'request\x20sent',JSON[_0x872c('0x1c')](_0x7b0f3f));if(_0x7b0f3f['error']){if(_0x7b0f3f[_0x872c('0x1d')][_0x872c('0x1e')]===0x1f4){logger[_0x872c('0x1d')](_0x872c('0x18'),_0x5d6759,_0x7b0f3f['error'][_0x872c('0x1f')]);return _0x251277(_0x7b0f3f[_0x872c('0x1d')][_0x872c('0x1f')]);}logger[_0x872c('0x1d')](_0x872c('0x18'),_0x5d6759,_0x7b0f3f[_0x872c('0x1d')]['message']);return _0x1a39f8(_0x7b0f3f[_0x872c('0x1d')]['message']);}else{logger[_0x872c('0x17')](_0x872c('0x18'),_0x5d6759,'request\x20sent');_0x1a39f8(_0x7b0f3f['result']['message']);}})[_0x872c('0x20')](function(_0x4e8aaf){logger[_0x872c('0x1d')]('ChatWebsite,\x20%s,\x20%s',_0x5d6759,_0x4e8aaf);_0x251277(_0x4e8aaf);});});}function respondWithStatusCode(_0x3b1855,_0x315768){_0x315768=_0x315768||0xcc;return function(_0x540811){if(_0x540811){return _0x3b1855['sendStatus'](_0x315768);}return _0x3b1855[_0x872c('0x21')](_0x315768)['end']();};}function respondWithResult(_0x3afb7f,_0x2bc0e2){_0x2bc0e2=_0x2bc0e2||0xc8;return function(_0x15f1b0){if(_0x15f1b0){return _0x3afb7f['status'](_0x2bc0e2)[_0x872c('0x22')](_0x15f1b0);}};}function respondWithFilteredResult(_0x1651b9,_0x1290bc){return function(_0x300538){if(_0x300538){var _0x1db7ee=typeof _0x1290bc[_0x872c('0x23')]===_0x872c('0x24')&&typeof _0x1290bc[_0x872c('0x25')]==='undefined';var _0x483217=_0x300538[_0x872c('0x26')];var _0x194a16=_0x1db7ee?0x0:_0x1290bc[_0x872c('0x23')];var _0x5e088e=_0x1db7ee?_0x300538[_0x872c('0x26')]:_0x1290bc['offset']+_0x1290bc[_0x872c('0x25')];var _0xc5b701;if(_0x5e088e>=_0x483217){_0x5e088e=_0x483217;_0xc5b701=0xc8;}else{_0xc5b701=0xce;}_0x1651b9[_0x872c('0x21')](_0xc5b701);return _0x1651b9[_0x872c('0x27')]('Content-Range',_0x194a16+'-'+_0x5e088e+'/'+_0x483217)['json'](_0x300538);}return null;};}function saveUpdates(_0x2589b0){return function(_0x4223bb){if(_0x4223bb){return _0x4223bb[_0x872c('0x28')](_0x2589b0)[_0x872c('0x16')](function(_0x5ef16c){return _0x5ef16c;});}return null;};}function removeEntity(_0x55d9b0){return function(_0x1b3876){if(_0x1b3876){return _0x1b3876[_0x872c('0x29')]()['then'](function(){var _0x225673=_0x1b3876[_0x872c('0x2a')]({'plain':!![]});var _0x59a3af='ChatWebsites';return db[_0x872c('0x2b')][_0x872c('0x29')]({'where':{'type':_0x59a3af,'resourceId':_0x225673['id']}})[_0x872c('0x16')](function(){return _0x1b3876;});})[_0x872c('0x16')](function(){_0x55d9b0['status'](0xcc)[_0x872c('0x2c')]();});}};}function handleEntityNotFound(_0x4d828c){return function(_0x25bca8){if(!_0x25bca8){_0x4d828c[_0x872c('0x2d')](0x194);}return _0x25bca8;};}function handleError(_0x33cb11,_0x4dd56d){_0x4dd56d=_0x4dd56d||0x1f4;return function(_0x5a75b6){logger[_0x872c('0x1d')](_0x5a75b6['stack']);if(_0x5a75b6[_0x872c('0x2e')]){delete _0x5a75b6[_0x872c('0x2e')];}_0x33cb11[_0x872c('0x21')](_0x4dd56d)[_0x872c('0x2f')](_0x5a75b6);};}function iftimePromise(_0x462488,_0x49e929){return respondWithRpcPromise(_0x872c('0x30'),'getSnippet',{'command':_0x49e929['timezone']?util[_0x872c('0x31')](_0x872c('0x32'),_0x462488['interval'],_0x49e929[_0x872c('0x33')]):util[_0x872c('0x31')](_0x872c('0x34'),_0x462488['interval'])},client9002)['then'](function(_0x46fa00){var _0x277e0d=_0x46fa00&&_0x46fa00[_0x872c('0x35')]('true')>=0x0?!![]:![];logger[_0x872c('0x17')](_0x872c('0x36'),_0x49e929['id'],_0x462488['id'],_0x462488[_0x872c('0x37')],_0x277e0d?_0x872c('0x38'):_0x872c('0x39'),_0x49e929[_0x872c('0x33')]?_0x49e929[_0x872c('0x33')]:_0x872c('0x3a'));return _0x277e0d;})[_0x872c('0x20')](function(_0x319346){logger[_0x872c('0x1d')](_0x872c('0x36'),_0x49e929['id'],_0x462488['id'],_0x462488[_0x872c('0x37')],util['inspect'](_0x319346,{'showHidden':![],'depth':null}),_0x49e929['timezone']?_0x49e929[_0x872c('0x33')]:_0x872c('0x3a'));return![];});}function checkWebsiteIntervals(_0x56ad93){var _0xb0c839=_[_0x872c('0x3b')](_0x56ad93[_0x872c('0x3c')][_0x872c('0x3d')],function(_0x9b847b){var _0x43c684=_0x9b847b[_0x872c('0x2a')]({'plain':!![]});return iftimePromise(_0x43c684,_0x56ad93);});return Promise[_0x872c('0x3e')](_0xb0c839)[_0x872c('0x16')](function(_0x149252){return _[_0x872c('0x3f')](_0x149252);});}function createInteractionObject(_0x466845,_0x37bf1f,_0x12a1aa,_0x63fc4a){var _0x117b15=require(_0x872c('0x40'));var _0x337b42=new _0x117b15();var _0x2ec63b=_0x337b42['setUA'](_0x12a1aa['user-agent'])[_0x872c('0x41')]();var _0x3cba9e=_0x37bf1f[_0x872c('0x42')];if(_0x12a1aa[_0x872c('0x43')]){_0x3cba9e=_0x12a1aa[_0x872c('0x43')];}else if(_0x12a1aa[_0x872c('0x44')]){_0x3cba9e=_[_0x872c('0x45')](_0x12a1aa[_0x872c('0x44')][_0x872c('0x46')](','));}return{'ContactId':_0x63fc4a['id'],'ChatWebsiteId':_0x466845,'from':(_0x63fc4a[_0x872c('0x47')]||'')+'\x20'+(_0x63fc4a[_0x872c('0x48')]||''),'customerIp':_0x3cba9e,'customerPort':_0x12a1aa[_0x872c('0x49')]?_0x12a1aa[_0x872c('0x49')]:null,'referer':_0x37bf1f[_0x872c('0x4a')],'browserName':_0x2ec63b['browser'][_0x872c('0x2e')]&&_0x2ec63b[_0x872c('0x4b')][_0x872c('0x4c')]?util[_0x872c('0x31')]('%s\x20%s',_0x2ec63b[_0x872c('0x4b')][_0x872c('0x2e')],_0x2ec63b['browser'][_0x872c('0x4c')]):_0x872c('0x4d'),'browserVersion':_0x2ec63b[_0x872c('0x4b')]['version']||_0x872c('0x4d'),'osName':util[_0x872c('0x31')](_0x872c('0x4e'),_0x2ec63b['os'][_0x872c('0x2e')],_0x2ec63b['os'][_0x872c('0x4c')]),'osVersion':_0x2ec63b['os'][_0x872c('0x4c')],'deviceModel':_0x2ec63b[_0x872c('0x4f')][_0x872c('0x50')]&&_0x2ec63b[_0x872c('0x4f')]['vendor']?util['format']('%s\x20%s\x20%s',_0x2ec63b[_0x872c('0x4f')][_0x872c('0x50')],_0x2ec63b[_0x872c('0x4f')]['vendor'],_0x2ec63b[_0x872c('0x4f')][_0x872c('0x51')]):null,'deviceVendor':_0x2ec63b[_0x872c('0x4f')][_0x872c('0x52')],'deviceType':_0x2ec63b[_0x872c('0x4f')]['type'],'formData':JSON[_0x872c('0x1c')](_0x37bf1f)};}exports[_0x872c('0x53')]=function(_0x361539,_0x27fa07){var _0x4a180b={'include':[{'model':db[_0x872c('0x54')],'as':_0x872c('0x55')}]},_0x505519={},_0x5d3c38={'count':0x0,'rows':[]};var _0x4f162e=_[_0x872c('0x3b')](db['ChatWebsite'][_0x872c('0x56')],function(_0x22a3a8){return{'name':_0x22a3a8['fieldName'],'type':_0x22a3a8[_0x872c('0x51')][_0x872c('0x57')]};});_0x505519[_0x872c('0x50')]=_['map'](_0x4f162e,_0x872c('0x2e'));_0x505519[_0x872c('0x58')]=_['keys'](_0x361539[_0x872c('0x58')]);_0x505519[_0x872c('0x59')]=_['intersection'](_0x505519['model'],_0x505519['query']);_0x4a180b[_0x872c('0x5a')]=_[_0x872c('0x5b')](_0x505519[_0x872c('0x50')],qs[_0x872c('0x5c')](_0x361539[_0x872c('0x58')][_0x872c('0x5c')]));_0x4a180b['attributes']=_0x4a180b[_0x872c('0x5a')][_0x872c('0x5d')]?_0x4a180b['attributes']:_0x505519[_0x872c('0x50')];if(!_0x361539[_0x872c('0x58')][_0x872c('0x5e')](_0x872c('0x5f'))){_0x4a180b['limit']=qs[_0x872c('0x25')](_0x361539[_0x872c('0x58')][_0x872c('0x25')]);_0x4a180b[_0x872c('0x23')]=qs[_0x872c('0x23')](_0x361539['query'][_0x872c('0x23')]);}_0x4a180b['order']=qs[_0x872c('0x60')](_0x361539[_0x872c('0x58')][_0x872c('0x60')]);_0x4a180b['where']=qs[_0x872c('0x59')](_['pick'](_0x361539[_0x872c('0x58')],_0x505519[_0x872c('0x59')]),_0x4f162e);if(_0x361539[_0x872c('0x58')][_0x872c('0x61')]){_0x4a180b[_0x872c('0x62')]=_['merge'](_0x4a180b[_0x872c('0x62')],{'$or':_[_0x872c('0x3b')](_0x4f162e,function(_0x3025aa){if(_0x3025aa[_0x872c('0x51')]!==_0x872c('0x63')){var _0x10c0d9={};_0x10c0d9[_0x3025aa['name']]={'$like':'%'+_0x361539[_0x872c('0x58')]['filter']+'%'};return _0x10c0d9;}})});}_0x4a180b=_['merge']({},_0x4a180b,_0x361539['options']);var _0x3fe0d5={'where':_0x4a180b[_0x872c('0x62')]};return db[_0x872c('0x64')][_0x872c('0x26')](_0x3fe0d5)[_0x872c('0x16')](function(_0x557787){_0x5d3c38['count']=_0x557787;if(_0x361539['query'][_0x872c('0x65')]){_0x4a180b[_0x872c('0x66')]=[{'all':!![]}];}return db[_0x872c('0x64')][_0x872c('0x67')](_0x4a180b);})[_0x872c('0x16')](function(_0x4ad721){_0x5d3c38[_0x872c('0x68')]=_0x4ad721;return _0x5d3c38;})[_0x872c('0x16')](respondWithFilteredResult(_0x27fa07,_0x4a180b))[_0x872c('0x20')](handleError(_0x27fa07,null));};exports[_0x872c('0x69')]=function(_0x1ccc1b,_0xb82f4){var _0x1d1125={'raw':![],'where':{'id':_0x1ccc1b['params']['id']},'include':[{'model':db[_0x872c('0x54')],'as':'mandatoryDispositionPause'}]},_0xdb7266={};_0xdb7266[_0x872c('0x50')]=_[_0x872c('0x6a')](db['ChatWebsite'][_0x872c('0x56')]);_0xdb7266[_0x872c('0x58')]=_[_0x872c('0x6a')](_0x1ccc1b[_0x872c('0x58')]);_0xdb7266[_0x872c('0x59')]=_[_0x872c('0x5b')](_0xdb7266[_0x872c('0x50')],_0xdb7266[_0x872c('0x58')]);_0x1d1125['attributes']=_[_0x872c('0x5b')](_0xdb7266[_0x872c('0x50')],qs[_0x872c('0x5c')](_0x1ccc1b[_0x872c('0x58')]['fields']));_0x1d1125[_0x872c('0x5a')]=_0x1d1125[_0x872c('0x5a')][_0x872c('0x5d')]?_0x1d1125['attributes']:_0xdb7266[_0x872c('0x50')];if(_0x1ccc1b[_0x872c('0x58')][_0x872c('0x65')]){_0x1d1125['include']=[{'all':!![]}];}_0x1d1125=_[_0x872c('0x6b')]({},_0x1d1125,_0x1ccc1b[_0x872c('0x6c')]);return db['ChatWebsite']['find'](_0x1d1125)[_0x872c('0x16')](handleEntityNotFound(_0xb82f4,null))[_0x872c('0x16')](respondWithResult(_0xb82f4,null))['catch'](handleError(_0xb82f4,null));};exports[_0x872c('0x6d')]=function(_0x36412e,_0x31a52f){return db['ChatWebsite'][_0x872c('0x6d')](_0x36412e[_0x872c('0x6e')],{})[_0x872c('0x16')](function(_0x36a1e8){var _0x341c88=_0x36412e[_0x872c('0x6f')][_0x872c('0x2a')]({'plain':!![]});if(!_0x341c88)throw new Error(_0x872c('0x70'));if(_0x341c88[_0x872c('0x71')]==='user'){var _0xc92436=_0x36a1e8[_0x872c('0x2a')]({'plain':!![]});var _0x4c9aca=_0x872c('0x72');return db['UserProfileSection'][_0x872c('0x73')]({'where':{'name':_0x4c9aca,'userProfileId':_0x341c88['userProfileId']},'raw':!![]})['then'](function(_0x202195){if(_0x202195&&_0x202195[_0x872c('0x74')]===0x0){return db[_0x872c('0x2b')][_0x872c('0x6d')]({'name':_0xc92436[_0x872c('0x2e')],'resourceId':_0xc92436['id'],'type':_0x202195[_0x872c('0x2e')],'sectionId':_0x202195['id']},{})[_0x872c('0x16')](function(){return _0x36a1e8;});}else{return _0x36a1e8;}})[_0x872c('0x20')](function(_0x64460d){logger[_0x872c('0x1d')](_0x872c('0x75'),_0x64460d);throw _0x64460d;});}return _0x36a1e8;})['then'](respondWithResult(_0x31a52f,0xc9))[_0x872c('0x20')](handleError(_0x31a52f,null));};exports[_0x872c('0x28')]=function(_0x1652d7,_0x49e90a){if(_0x1652d7['body']['id']){delete _0x1652d7['body']['id'];}return db[_0x872c('0x64')][_0x872c('0x73')]({'where':{'id':_0x1652d7[_0x872c('0x76')]['id']},'include':[{'model':db[_0x872c('0x54')],'as':'mandatoryDispositionPause'}]})[_0x872c('0x16')](handleEntityNotFound(_0x49e90a,null))[_0x872c('0x16')](saveUpdates(_0x1652d7[_0x872c('0x6e')],null))[_0x872c('0x16')](respondWithResult(_0x49e90a,null))[_0x872c('0x20')](handleError(_0x49e90a,null));};exports[_0x872c('0x29')]=function(_0x41106b,_0x57d018){return db[_0x872c('0x64')][_0x872c('0x73')]({'where':{'id':_0x41106b[_0x872c('0x76')]['id']}})[_0x872c('0x16')](handleEntityNotFound(_0x57d018,null))[_0x872c('0x16')](removeEntity(_0x57d018,null))[_0x872c('0x20')](handleError(_0x57d018,null));};exports['describe']=function(_0x4da7f9,_0x3d13a4){return db['ChatWebsite'][_0x872c('0x77')]()[_0x872c('0x16')](respondWithResult(_0x3d13a4,null))[_0x872c('0x20')](handleError(_0x3d13a4,null));};exports['addDisposition']=function(_0x25f969,_0x94f246){if(_0x25f969[_0x872c('0x6e')]['id']){delete _0x25f969[_0x872c('0x6e')]['id'];}return db[_0x872c('0x64')][_0x872c('0x73')]({'where':{'id':_0x25f969[_0x872c('0x76')]['id']}})[_0x872c('0x16')](handleEntityNotFound(_0x94f246,null))['then'](function(_0x56dc02){if(_0x56dc02){_0x25f969[_0x872c('0x6e')][_0x872c('0x78')]=_0x56dc02['id'];return db[_0x872c('0x79')]['create'](_0x25f969[_0x872c('0x6e')]);}})[_0x872c('0x16')](respondWithResult(_0x94f246,null))['catch'](handleError(_0x94f246,null));};exports[_0x872c('0x7a')]=function(_0x474849,_0x3d592c){var _0x1760f3={'raw':![],'where':{}};var _0x295ed3={};var _0x421c74={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x872c('0x7b')]({'where':{'id':_0x474849[_0x872c('0x76')]['id']}})['then'](handleEntityNotFound(_0x3d592c,null))['then'](function(_0x74d79b){if(_0x74d79b){_0x295ed3[_0x872c('0x50')]=_[_0x872c('0x6a')](db['Disposition'][_0x872c('0x56')]);_0x295ed3['query']=_[_0x872c('0x6a')](_0x474849[_0x872c('0x58')]);_0x295ed3[_0x872c('0x59')]=_[_0x872c('0x5b')](_0x295ed3[_0x872c('0x50')],_0x295ed3[_0x872c('0x58')]);_0x1760f3[_0x872c('0x5a')]=_[_0x872c('0x5b')](_0x295ed3[_0x872c('0x50')],qs[_0x872c('0x5c')](_0x474849[_0x872c('0x58')][_0x872c('0x5c')]));_0x1760f3[_0x872c('0x5a')]=_0x1760f3['attributes'][_0x872c('0x5d')]?_0x1760f3[_0x872c('0x5a')]:_0x295ed3['model'];if(!_0x474849[_0x872c('0x58')][_0x872c('0x5e')](_0x872c('0x5f'))){_0x1760f3[_0x872c('0x25')]=qs[_0x872c('0x25')](_0x474849[_0x872c('0x58')]['limit']);_0x1760f3[_0x872c('0x23')]=qs[_0x872c('0x23')](_0x474849['query']['offset']);}_0x1760f3['order']=qs[_0x872c('0x60')](_0x474849[_0x872c('0x58')][_0x872c('0x60')]);_0x1760f3['where']=qs['filters'](_[_0x872c('0x7c')](_0x474849[_0x872c('0x58')],_0x295ed3[_0x872c('0x59')]));_0x1760f3[_0x872c('0x62')][_0x872c('0x78')]=_0x74d79b['id'];if(_0x474849['query'][_0x872c('0x61')]){_0x1760f3['where']=_[_0x872c('0x6b')](_0x1760f3['where'],{'$or':_['map'](_0x1760f3[_0x872c('0x5a')],function(_0x95941e){var _0x187cfe={};_0x187cfe[_0x95941e]={'$like':'%'+_0x474849[_0x872c('0x58')][_0x872c('0x61')]+'%'};return _0x187cfe;})});}_0x1760f3=_[_0x872c('0x6b')]({},_0x1760f3,_0x474849[_0x872c('0x6c')]);return db[_0x872c('0x79')][_0x872c('0x26')]({'where':_0x1760f3[_0x872c('0x62')]})['then'](function(_0x52bf7f){_0x421c74['count']=_0x52bf7f;if(_0x474849['query'][_0x872c('0x65')]){_0x1760f3['include']=[{'all':!![]}];}return db[_0x872c('0x79')][_0x872c('0x67')](_0x1760f3);})['then'](function(_0x7db5f5){_0x421c74[_0x872c('0x68')]=_0x7db5f5;return _0x421c74;});}})[_0x872c('0x16')](respondWithFilteredResult(_0x3d592c,_0x1760f3))[_0x872c('0x20')](handleError(_0x3d592c,null));};exports[_0x872c('0x7d')]=function(_0xe40925,_0x433772){return db[_0x872c('0x64')]['find']({'where':{'id':_0xe40925[_0x872c('0x76')]['id']}})['then'](handleEntityNotFound(_0x433772,null))[_0x872c('0x16')](function(_0x362554){if(_0x362554){return _0x362554['removeDispositions'](_0xe40925['query'][_0x872c('0x7e')]);}})[_0x872c('0x16')](respondWithStatusCode(_0x433772,null))['catch'](handleError(_0x433772,null));};exports[_0x872c('0x7f')]=function(_0x3dc64f,_0xb6c2af){if(_0x3dc64f[_0x872c('0x6e')]['id']){delete _0x3dc64f[_0x872c('0x6e')]['id'];}return db[_0x872c('0x64')]['find']({'where':{'id':_0x3dc64f[_0x872c('0x76')]['id']}})['then'](handleEntityNotFound(_0xb6c2af,null))['then'](function(_0x4e9dca){if(_0x4e9dca){_0x3dc64f['body'][_0x872c('0x78')]=_0x4e9dca['id'];return db['CannedAnswer']['create'](_0x3dc64f['body']);}})['then'](respondWithResult(_0xb6c2af,null))[_0x872c('0x20')](handleError(_0xb6c2af,null));};exports[_0x872c('0x80')]=function(_0x61d42d,_0x4a1c8b){var _0x1fc281={'raw':![],'where':{}};var _0x1f26b8={};var _0x409ab3={'count':0x0,'rows':[]};return db[_0x872c('0x64')][_0x872c('0x7b')]({'where':{'id':_0x61d42d[_0x872c('0x76')]['id']}})[_0x872c('0x16')](handleEntityNotFound(_0x4a1c8b,null))[_0x872c('0x16')](function(_0x340006){if(_0x340006){_0x1f26b8[_0x872c('0x50')]=_[_0x872c('0x6a')](db[_0x872c('0x81')][_0x872c('0x56')]);_0x1f26b8[_0x872c('0x58')]=_[_0x872c('0x6a')](_0x61d42d['query']);_0x1f26b8['filters']=_[_0x872c('0x5b')](_0x1f26b8['model'],_0x1f26b8[_0x872c('0x58')]);_0x1fc281[_0x872c('0x5a')]=_[_0x872c('0x5b')](_0x1f26b8[_0x872c('0x50')],qs['fields'](_0x61d42d['query'][_0x872c('0x5c')]));_0x1fc281['attributes']=_0x1fc281[_0x872c('0x5a')]['length']?_0x1fc281[_0x872c('0x5a')]:_0x1f26b8['model'];if(!_0x61d42d[_0x872c('0x58')]['hasOwnProperty'](_0x872c('0x5f'))){_0x1fc281[_0x872c('0x25')]=qs['limit'](_0x61d42d[_0x872c('0x58')]['limit']);_0x1fc281[_0x872c('0x23')]=qs[_0x872c('0x23')](_0x61d42d['query'][_0x872c('0x23')]);}_0x1fc281[_0x872c('0x82')]=qs['sort'](_0x61d42d[_0x872c('0x58')][_0x872c('0x60')]);_0x1fc281[_0x872c('0x62')]=qs[_0x872c('0x59')](_[_0x872c('0x7c')](_0x61d42d['query'],_0x1f26b8['filters']));_0x1fc281['where']['ChatWebsiteId']=_0x340006['id'];if(_0x61d42d[_0x872c('0x58')][_0x872c('0x61')]){_0x1fc281['where']=_['merge'](_0x1fc281[_0x872c('0x62')],{'$or':_[_0x872c('0x3b')](_0x1fc281['attributes'],function(_0x2df526){var _0x2b7f70={};_0x2b7f70[_0x2df526]={'$like':'%'+_0x61d42d[_0x872c('0x58')]['filter']+'%'};return _0x2b7f70;})});}_0x1fc281=_['merge']({},_0x1fc281,_0x61d42d[_0x872c('0x6c')]);return db[_0x872c('0x81')][_0x872c('0x26')]({'where':_0x1fc281[_0x872c('0x62')]})[_0x872c('0x16')](function(_0x443e9a){_0x409ab3[_0x872c('0x26')]=_0x443e9a;if(_0x61d42d[_0x872c('0x58')][_0x872c('0x65')]){_0x1fc281[_0x872c('0x66')]=[{'all':!![]}];}return db[_0x872c('0x81')][_0x872c('0x67')](_0x1fc281);})[_0x872c('0x16')](function(_0xfb5aad){_0x409ab3[_0x872c('0x68')]=_0xfb5aad;return _0x409ab3;});}})[_0x872c('0x16')](respondWithFilteredResult(_0x4a1c8b,_0x1fc281))[_0x872c('0x20')](handleError(_0x4a1c8b,null));};exports[_0x872c('0x83')]=function(_0x2156bd,_0x26696d){return db[_0x872c('0x64')]['find']({'where':{'id':_0x2156bd[_0x872c('0x76')]['id']}})[_0x872c('0x16')](handleEntityNotFound(_0x26696d,null))[_0x872c('0x16')](function(_0x38e7d6){if(_0x38e7d6){return _0x38e7d6[_0x872c('0x83')](_0x2156bd[_0x872c('0x58')][_0x872c('0x7e')]);}})[_0x872c('0x16')](respondWithStatusCode(_0x26696d,null))['catch'](handleError(_0x26696d,null));};exports[_0x872c('0x84')]=function(_0xe2fe12,_0x230c4f){_0xe2fe12[_0x872c('0x6e')]['sitepic']=_0xe2fe12['file'][_0x872c('0x85')];return db[_0x872c('0x64')][_0x872c('0x73')]({'where':{'id':_0xe2fe12[_0x872c('0x76')]['id']}})[_0x872c('0x16')](handleEntityNotFound(_0x230c4f,null))[_0x872c('0x16')](saveUpdates(_0xe2fe12[_0x872c('0x6e')],null))[_0x872c('0x16')](respondWithResult(_0x230c4f,null))[_0x872c('0x20')](handleError(_0x230c4f,null));};exports[_0x872c('0x86')]=function(_0xd04d90,_0x144d63){_0xd04d90[_0x872c('0x6e')][_0x872c('0x87')]=_0xd04d90[_0x872c('0x88')][_0x872c('0x85')];return db[_0x872c('0x64')][_0x872c('0x73')]({'where':{'id':_0xd04d90[_0x872c('0x76')]['id']}})[_0x872c('0x16')](handleEntityNotFound(_0x144d63,null))[_0x872c('0x16')](saveUpdates(_0xd04d90[_0x872c('0x6e')],null))[_0x872c('0x16')](respondWithResult(_0x144d63,null))[_0x872c('0x20')](handleError(_0x144d63,null));};exports[_0x872c('0x89')]=function(_0x2503ad,_0x32c603){_0x2503ad[_0x872c('0x6e')]['customerAvatar']=_0x2503ad[_0x872c('0x88')][_0x872c('0x85')];return db['ChatWebsite']['find']({'where':{'id':_0x2503ad[_0x872c('0x76')]['id']}})['then'](handleEntityNotFound(_0x32c603,null))[_0x872c('0x16')](saveUpdates(_0x2503ad['body'],null))[_0x872c('0x16')](respondWithResult(_0x32c603,null))[_0x872c('0x20')](handleError(_0x32c603,null));};exports[_0x872c('0x8a')]=function(_0x48f97a,_0x5e0c3e){_0x48f97a[_0x872c('0x6e')]['systemAvatar']=_0x48f97a[_0x872c('0x88')][_0x872c('0x85')];return db['ChatWebsite'][_0x872c('0x73')]({'where':{'id':_0x48f97a[_0x872c('0x76')]['id']}})[_0x872c('0x16')](handleEntityNotFound(_0x5e0c3e,null))[_0x872c('0x16')](saveUpdates(_0x48f97a[_0x872c('0x6e')],null))[_0x872c('0x16')](respondWithResult(_0x5e0c3e,null))['catch'](handleError(_0x5e0c3e,null));};exports[_0x872c('0x8b')]=function(_0x21da88,_0x333639){var _0x5b08cc=path['join'](config[_0x872c('0x8c')],_0x872c('0x8d'));var _0x406639={'where':{'id':_0x21da88[_0x872c('0x76')]['id']},'attributes':['id',_0x872c('0x8e')],'raw':!![]};var _0x283a08=![];return require('../../config/license/util')['getLicense']()['then'](function(_0x18b9bd){if(_0x18b9bd){_0x283a08=_0x18b9bd[_0x872c('0x8f')];}})[_0x872c('0x16')](function(){return db[_0x872c('0x64')][_0x872c('0x73')](_0x406639);})[_0x872c('0x16')](handleEntityNotFound(_0x333639,null))[_0x872c('0x16')](function(_0x78a629){if(_0x78a629){if(!_['isNil'](_0x78a629[_0x872c('0x8e')])){if(fs[_0x872c('0x90')](path[_0x872c('0x91')](config[_0x872c('0x8c')],_0x872c('0x92'),_0x78a629[_0x872c('0x8e')]))&&_0x283a08){_0x5b08cc=path[_0x872c('0x91')](config['root'],_0x872c('0x92'),_0x78a629[_0x872c('0x8e')]);}}return _0x333639['download'](_0x5b08cc);}})[_0x872c('0x20')](handleError(_0x333639,null));};exports[_0x872c('0x93')]=function(_0xeae151,_0x4b168d){var _0x350f96=path[_0x872c('0x91')](config[_0x872c('0x8c')],_0x872c('0x94'));var _0x2d28ed={'where':{'id':_0xeae151[_0x872c('0x76')]['id']},'attributes':['id',_0x872c('0x87')],'raw':!![]};return db[_0x872c('0x64')][_0x872c('0x73')](_0x2d28ed)['then'](handleEntityNotFound(_0x4b168d,null))[_0x872c('0x16')](function(_0x316e8f){if(_0x316e8f){if(!_[_0x872c('0x95')](_0x316e8f[_0x872c('0x87')])){if(fs[_0x872c('0x90')](path['join'](config[_0x872c('0x8c')],'server/files/images/avatars/',_0x316e8f[_0x872c('0x87')]))){_0x350f96=path[_0x872c('0x91')](config[_0x872c('0x8c')],'server/files/images/avatars/',_0x316e8f[_0x872c('0x87')]);}}return _0x4b168d['download'](_0x350f96);}})[_0x872c('0x20')](handleError(_0x4b168d,null));};exports['getCustomerAvatar']=function(_0x4e5d10,_0x2e2c0b){var _0x44125a=path[_0x872c('0x91')](config['root'],_0x872c('0x96'));var _0x402c58={'where':{'id':_0x4e5d10[_0x872c('0x76')]['id']},'attributes':['id','customerAvatar',_0x872c('0x97')],'raw':!![]};return db['ChatWebsite']['find'](_0x402c58)[_0x872c('0x16')](handleEntityNotFound(_0x2e2c0b,null))[_0x872c('0x16')](function(_0x52f967){if(_0x52f967){if(!_[_0x872c('0x95')](_0x52f967[_0x872c('0x98')])){if(fs['existsSync'](path[_0x872c('0x91')](config[_0x872c('0x8c')],_0x872c('0x99'),_0x52f967['customerAvatar']))&&_0x52f967['showCustomerAvatar']){_0x44125a=path[_0x872c('0x91')](config['root'],_0x872c('0x99'),_0x52f967[_0x872c('0x98')]);}}return _0x2e2c0b[_0x872c('0x9a')](_0x44125a);}})[_0x872c('0x20')](handleError(_0x2e2c0b,null));};exports[_0x872c('0x9b')]=function(_0xd8c4e9,_0x291a82){var _0x2a735f=path['join'](config['root'],'server/files/images/avatars/system_avatar.png');var _0x4cb52c={'where':{'id':_0xd8c4e9['params']['id']},'attributes':['id',_0x872c('0x9c')],'raw':!![]};return db['ChatWebsite']['find'](_0x4cb52c)[_0x872c('0x16')](handleEntityNotFound(_0x291a82,null))[_0x872c('0x16')](function(_0x2242b7){if(_0x2242b7){if(!_['isNil'](_0x2242b7[_0x872c('0x9c')])){if(fs['existsSync'](path[_0x872c('0x91')](config['root'],_0x872c('0x99'),_0x2242b7[_0x872c('0x9c')]))){_0x2a735f=path[_0x872c('0x91')](config['root'],_0x872c('0x99'),_0x2242b7['systemAvatar']);}}return _0x291a82[_0x872c('0x9a')](_0x2a735f);}})[_0x872c('0x20')](handleError(_0x291a82,null));};exports[_0x872c('0x9d')]=function(_0x3137b5,_0x2344be){var _0x2c39bb={'body':_0x3137b5[_0x872c('0x6e')],'channel':_0x872c('0x9e')};var _0x210c08=[];var _0x4bf733=[];var _0xa5556e={};var _0x425f1c=![];return db[_0x872c('0x9f')]['describe']()['then'](function(_0x49e5e8){if(!_0x49e5e8){throw new db[(_0x872c('0xa0'))]['ValidationError'](_0x872c('0xa1'));}_0x210c08=_['difference'](_[_0x872c('0x6a')](_0x49e5e8),[_0x872c('0xa2'),'updatedAt']);_0x4bf733=_[_0x872c('0xa3')](_[_0x872c('0x6a')](_0x49e5e8),[_0x872c('0xa2'),_0x872c('0xa4'),'CompanyId',_0x872c('0xa5')]);if(_0x3137b5[_0x872c('0x6e')]['id']){delete _0x3137b5['body']['id'];}if(_[_0x872c('0x95')](_0x3137b5[_0x872c('0x6e')][_0x872c('0xa6')])){throw new db[(_0x872c('0xa0'))]['ValidationError'](_0x872c('0xa7'));}if(_[_0x872c('0x95')](_0x3137b5[_0x872c('0x6e')]['body'])||_0x3137b5[_0x872c('0x6e')]['body']===''){throw new db[(_0x872c('0xa0'))][(_0x872c('0xa8'))](_0x872c('0xa9'));}if(_[_0x872c('0x95')](_0x3137b5[_0x872c('0x6e')][_0x872c('0xaa')])){throw new db['Sequelize'][(_0x872c('0xa8'))](_0x872c('0xab')+_0x4bf733);}if(!_['includes'](_0x4bf733,_0x3137b5[_0x872c('0x6e')][_0x872c('0xaa')])){throw new db[(_0x872c('0xa0'))][(_0x872c('0xa8'))](_0x872c('0xac')+_0x4bf733);}_0xa5556e[_0x3137b5['body'][_0x872c('0xaa')]]=_0x3137b5[_0x872c('0x6e')][_0x872c('0xa6')];})[_0x872c('0x16')](function(){return db[_0x872c('0x64')][_0x872c('0x73')]({'where':{'id':_0x3137b5[_0x872c('0x76')]['id']},'include':[{'model':db['CmList'],'as':_0x872c('0xad'),'include':[{'model':db[_0x872c('0x9f')],'as':_0x872c('0xae'),'where':_0xa5556e,'limit':0x1,'order':[['updatedAt',_0x872c('0xaf')]]}]},{'model':db[_0x872c('0xb0')],'as':_0x872c('0xb1')},{'model':db['Interval'],'as':'Interval','include':[{'model':db[_0x872c('0x3c')],'as':_0x872c('0x3d'),'attributes':['id','interval'],'raw':!![]}]}]});})[_0x872c('0x16')](function(_0x65d1a5){if(!_0x65d1a5)throw new APINotFoundError(util['format']('Chat\x20Website\x20with\x20id\x20%s\x20not\x20found',_0x3137b5['params']['id']));if(!_0x65d1a5['Interval']||!_0x65d1a5[_0x872c('0x3c')]['Intervals'])return[_0x65d1a5,!![]];return[_0x65d1a5,checkWebsiteIntervals(_0x65d1a5)];})[_0x872c('0xb2')](function(_0x2892d7,_0x1281bc){if(!_0x1281bc)throw new APIOutOfIntervalError();if(!_0x2892d7['List'])return;_0x2c39bb['account']=_0x2892d7;_0x2c39bb['list']=_0x2892d7[_0x872c('0xad')];_0x2c39bb['applications']=_['orderBy'](_0x2892d7[_0x872c('0xb1')],[_0x872c('0xb3')],['asc']);if(_0x2c39bb[_0x872c('0xb4')][_0x872c('0xb1')]){delete _0x2c39bb[_0x872c('0xb4')][_0x872c('0xb1')];}if(_0x2c39bb[_0x872c('0xb4')][_0x872c('0xad')]&&_0x2c39bb[_0x872c('0xb4')][_0x872c('0xad')][_0x872c('0xae')][_0x872c('0x5d')]){return _0x2c39bb[_0x872c('0xb4')][_0x872c('0xad')][_0x872c('0xae')][0x0];}var _0x10b0e4=_[_0x872c('0xf')](_0x3137b5[_0x872c('0x6e')],{'firstName':_0x3137b5[_0x872c('0x6e')][_0x872c('0xa6')],'ListId':_0x2892d7[_0x872c('0xa5')]});_0x10b0e4[_0x3137b5[_0x872c('0x6e')][_0x872c('0xaa')]]=_0x3137b5[_0x872c('0x6e')][_0x872c('0xa6')];return db[_0x872c('0x9f')][_0x872c('0x6d')](_0x10b0e4,{'fields':_0x210c08,'raw':!![]});})[_0x872c('0x16')](function(_0x4e235b){_0x2c39bb[_0x872c('0xb5')]=_0x4e235b;var _0x1a737a=createInteractionObject(_0x3137b5[_0x872c('0x76')]['id'],_0x3137b5['body'],_0x3137b5[_0x872c('0xb6')],_0x4e235b);var _0x502c78={'ChatWebsiteId':_0x3137b5[_0x872c('0x76')]['id'],'closed':![]};if(_0x3137b5[_0x872c('0x6e')][_0x872c('0xb7')]){_0x502c78[_0x872c('0xb7')]=_0x3137b5['body'][_0x872c('0xb7')];return db[_0x872c('0xb8')][_0x872c('0x73')]({'where':_0x502c78})[_0x872c('0x16')](function(_0xfcce36){if(_0xfcce36){_0x425f1c=!![];return _0xfcce36;}_0x1a737a[_0x872c('0xb7')]=_0x3137b5[_0x872c('0x6e')]['threadId'];_0x1a737a['externalUrl']=_0x3137b5['body'][_0x872c('0xb9')];return db['ChatInteraction']['create'](_0x1a737a);});}_0x502c78[_0x872c('0xba')]=_0x4e235b['id'];if(_0x3137b5['body'][_0x872c('0xbb')]&&_0x3137b5[_0x872c('0x6e')]['interaction']['id']){_0x502c78['id']=_0x3137b5[_0x872c('0x6e')][_0x872c('0xbb')]['id'];return db[_0x872c('0xb8')][_0x872c('0x73')]({'where':_0x502c78})[_0x872c('0x16')](function(_0x575f53){if(_0x575f53){_0x425f1c=!![];return _0x575f53;}return db[_0x872c('0xb8')][_0x872c('0x6d')](_0x1a737a);});}return db[_0x872c('0xb8')]['create'](_0x1a737a);})[_0x872c('0x16')](function(_0x10ab74){if(!_0x425f1c)return _0x10ab74;var _0x46ad09={'from':(_0x2c39bb[_0x872c('0xb5')][_0x872c('0x47')]||'')+'\x20'+(_0x2c39bb[_0x872c('0xb5')][_0x872c('0x48')]||'')};if(_0x3137b5[_0x872c('0x6e')][_0x872c('0xb7')]&&_0x3137b5[_0x872c('0x6e')][_0x872c('0xbc')]&&_0x3137b5[_0x872c('0x6e')][_0x872c('0xb7')]!=_0x3137b5[_0x872c('0x6e')]['messageId']){_0x46ad09['threadId']=_0x3137b5['body'][_0x872c('0xbc')];}return _0x10ab74[_0x872c('0x28')](_0x46ad09);})[_0x872c('0x16')](function(_0xe18644){_0x2c39bb[_0x872c('0xbb')]=_0xe18644['get']({'plain':!![]});_0x2c39bb[_0x872c('0xbb')][_0x872c('0xbd')]=!_0x425f1c;if(_0x2c39bb[_0x872c('0xbb')][_0x872c('0xbd')]){if(_0x2c39bb[_0x872c('0xb4')][_0x872c('0xbe')]){_0x2c39bb['applications'][_0x872c('0xbf')]({'id':0x0,'priority':_0x2c39bb[_0x872c('0xc0')]['length']+0x1,'app':_0x872c('0xc1'),'appdata':_0x872c('0xc2'),'interval':'*,*,*,*'});}}return db['ChatMessage']['create']({'body':_0x3137b5[_0x872c('0x6e')][_0x872c('0x6e')],'ChatWebsiteId':_0x3137b5[_0x872c('0x76')]['id'],'ChatInteractionId':_0xe18644['id'],'direction':'in','ContactId':_0x2c39bb[_0x872c('0xb5')]['id'],'AttachmentId':_0x3137b5[_0x872c('0x6e')][_0x872c('0xc3')]});})[_0x872c('0x16')](function(_0x30777b){_0x2c39bb[_0x872c('0x1f')]=_0x30777b;if(!_0x2c39bb[_0x872c('0xbb')]['UserId']){return;}return db['User'][_0x872c('0x73')]({'attributes':['id',_0x872c('0x2e')],'where':{'id':_0x2c39bb[_0x872c('0xbb')]['UserId']}});})[_0x872c('0x16')](function(_0x4e846f){if(_0x4e846f){_0x2c39bb[_0x872c('0xc0')][_0x872c('0xc4')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4e846f[_0x872c('0x2e')]+','+(_0x2c39bb[_0x872c('0xb4')][_0x872c('0xc5')]||0xa),'interval':_0x872c('0xc6')});_0x2c39bb[_0x872c('0xc7')]=!![];}if(!_0x2c39bb['interaction']['queueId']){return;}return db[_0x872c('0xc8')][_0x872c('0x73')]({'attributes':['id',_0x872c('0x2e')],'where':{'id':_0x2c39bb[_0x872c('0xbb')]['queueId']}});})[_0x872c('0x16')](function(_0x4dc75c){if(_0x4dc75c){_0x2c39bb[_0x872c('0xc0')]['unshift']({'id':0x0,'priority':0x1,'app':_0x872c('0xc9'),'appdata':_0x4dc75c[_0x872c('0x2e')]+','+(_0x2c39bb['account'][_0x872c('0xca')]||0x12c),'interval':_0x872c('0xc6')});}return respondWithRpcPromise(_0x872c('0xcb'),_0x872c('0xcc'),_0x2c39bb);})[_0x872c('0x16')](function(_0x1fa142){respondWithRpcPromise(_0x872c('0xcd'),_0x872c('0xcd'),{'event':_0x872c('0x9d'),'message':_0x1fa142},client9002);return _0x1fa142;})[_0x872c('0x16')](respondWithResult(_0x2344be,null))[_0x872c('0x20')](APIHandleError(_0x2344be));};exports['offline']=function(_0xec875b,_0x305247){var _0x24cbb6,_0x5a5906,_0x4a0eb1;var _0xd48f05=[];var _0x599044={};var _0x144373=_0xec875b[_0x872c('0xce')]||[];var _0x227098=[];var _0x519f53;return db[_0x872c('0x9f')]['describe']()[_0x872c('0x16')](function(_0x2a2183){if(!_0x2a2183){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0xd48f05=_['difference'](_[_0x872c('0x6a')](_0x2a2183),[_0x872c('0xa2'),_0x872c('0xa4'),_0x872c('0xcf'),_0x872c('0xa5')]);if(_0xec875b['body']['id']){delete _0xec875b['body']['id'];}if(_[_0x872c('0x95')](_0xec875b[_0x872c('0x6e')]['from'])){throw _0x305247[_0x872c('0x21')](0x1f4)[_0x872c('0x2f')](new db[(_0x872c('0xa0'))][(_0x872c('0xa8'))](_0x872c('0xa7')));}if(_[_0x872c('0x95')](_0xec875b[_0x872c('0x6e')]['body'])||_0xec875b[_0x872c('0x6e')][_0x872c('0x6e')]===''){throw _0x305247['status'](0x1f4)[_0x872c('0x2f')](new db[(_0x872c('0xa0'))][(_0x872c('0xa8'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x872c('0x95')](_0xec875b[_0x872c('0x6e')][_0x872c('0xd0')])){throw _0x305247['status'](0x1f4)[_0x872c('0x2f')](new db[(_0x872c('0xa0'))][(_0x872c('0xa8'))](_0x872c('0xd1')+_0xd48f05));}if(!_['includes'](_0xd48f05,_0xec875b[_0x872c('0x6e')][_0x872c('0xd0')])){throw _0x305247[_0x872c('0x21')](0x1f4)[_0x872c('0x2f')](new db['Sequelize']['ValidationError'](_0x872c('0xd2')+_0xd48f05));}_0x599044[_0xec875b[_0x872c('0x6e')][_0x872c('0xd0')]]=_0xec875b['body'][_0x872c('0xa6')];})['then'](function(){return db[_0x872c('0x64')]['find']({'where':{'id':_0xec875b['params']['id']},'include':[{'model':db[_0x872c('0xd3')],'as':_0x872c('0xad')},{'model':db[_0x872c('0xd4')],'as':_0x872c('0xd4')}]});})[_0x872c('0x16')](handleEntityNotFound(_0x305247,null))['then'](function(_0x16958e){if(_0x16958e&&_0x16958e[_0x872c('0xad')]){_0x5a5906=_0x16958e;var _0x3b71e7=_[_0x872c('0xf')](_0xec875b['body'],{'firstName':_0xec875b[_0x872c('0x6e')][_0x872c('0xa6')],'phone':_0xec875b[_0x872c('0x6e')][_0x872c('0xa6')],'ListId':_0x16958e['ListId']});_0x3b71e7[_0xec875b[_0x872c('0x6e')][_0x872c('0xd0')]]=_0xec875b[_0x872c('0x6e')][_0x872c('0xa6')];return db[_0x872c('0x9f')]['findOrCreate']({'where':_0x599044,'defaults':_0x3b71e7});}})[_0x872c('0xb2')](function(_0x39a920){if(_0x39a920){_0x4a0eb1=_0x39a920;var _0x376e0e=fs[_0x872c('0xd5')](path[_0x872c('0x91')](config[_0x872c('0x8c')],_0x872c('0xd6')),'utf8');var _0x181c99=ejs[_0x872c('0xd7')](_0x376e0e,{'body':_[_0x872c('0xd8')](_0xec875b[_0x872c('0x6e')][_0x872c('0x6e')]),'bodyTitle':_0x5a5906[_0x872c('0xd9')]});return db[_0x872c('0xda')][_0x872c('0x6d')]({'body':_0x181c99,'plainBody':htmlToText[_0x872c('0xdb')](_0x181c99),'ContactId':_0x39a920['id'],'ChatWebsiteId':_0x5a5906['id']});}})['then'](function(_0x51c7e6){_0x519f53=_0x51c7e6;if(_0x144373[_0x872c('0x5d')]){var _0x1397d7=_0x144373['map'](function(_0x20a6a0){return{'name':_0x20a6a0[_0x872c('0xdc')],'basename':_0x20a6a0[_0x872c('0x85')],'type':_0x20a6a0['mimetype'],'ChatOfflineMessageId':_0x51c7e6['id']};});_0x227098=_0x1397d7[_0x872c('0x3b')](_0x263ce1=>{var _0x56e6f0={'filename':_0x263ce1[_0x872c('0x2e')],'path':path[_0x872c('0x91')](config[_0x872c('0x8c')],_0x872c('0xdd'),_0x872c('0xce'),_0x872c('0xde'),_0x872c('0xdf'),_0x263ce1['basename'])};return _0x56e6f0;});if(!_0x5a5906[_0x872c('0xe0')]){return db[_0x872c('0xe1')][_0x872c('0xe2')](function(_0x2133a9){return db[_0x872c('0xe3')][_0x872c('0xe4')](_0x1397d7,{'transaction':_0x2133a9});});}}})[_0x872c('0x16')](function(){if(_0x519f53){_0x24cbb6=_0x519f53;return db[_0x872c('0xd4')][_0x872c('0x7b')]({'where':{'service':!![]},'include':[{'model':db[_0x872c('0xe5')],'as':_0x872c('0xe6'),'raw':!![],'include':[{'model':db[_0x872c('0xe7')],'as':'CloudProvider','raw':!![]}]}]});}})[_0x872c('0x16')](function(_0xf4331b){if(_0xf4331b&&_0xf4331b[_0x872c('0xe6')]&&_0x5a5906['forwardOffline']&&_0x5a5906['forwardOfflineAddress']){var _0x53436a=_0xf4331b[_0x872c('0xe8')]();return respondWithRpcPromise(_0x872c('0xe9'),_0x872c('0xea'),{'account':_0x53436a,'message':{'from':util[_0x872c('0x31')]('\x22%s\x22\x20<%s>',_0xf4331b[_0x872c('0x2e')],_0xf4331b[_0x872c('0xeb')]||_0xf4331b[_0x872c('0xe6')][_0x872c('0x6f')]),'to':_0x5a5906['forwardOfflineAddress'],'subject':_0x5a5906['offlineMessageSubject'],'html':_0x24cbb6[_0x872c('0x6e')],'attachments':_0x227098}},client9003)[_0x872c('0x16')](function(){return _0x24cbb6;})[_0x872c('0x20')](function(_0x360398){logger[_0x872c('0x1d')](_0x360398);});}})[_0x872c('0x16')](function(){if(_0x5a5906&&_0x5a5906['openNewInteraction']&&_0x5a5906[_0x872c('0xec')]){var _0x129deb=[];if(_0x144373[_0x872c('0x5d')]){_0x129deb=_0x144373['map'](function(_0x55ea70){return{'name':_0x55ea70[_0x872c('0xdc')],'basename':_0x55ea70[_0x872c('0x85')],'type':_0x55ea70[_0x872c('0xed')],'ChatOfflineMessageId':_0x519f53['id']};});}var _0x134d40;if(!_['isNil'](_0x5a5906[_0x872c('0xee')])){var _0x118b8a=_['map'](_0xec875b[_0x872c('0x6e')],function(_0x45dadc){return _0x45dadc;});var _0x5b0d06=_[_0x872c('0xef')](_0x118b8a)[0x0];var _0xa1cd9=_[_0x872c('0xf0')](_0x5b0d06,function(_0x502801){return _0x502801;});_0x134d40=_0xa1cd9[0x1][_0x5a5906[_0x872c('0xee')]];}var _0x2e77b7={'from':_0x4a0eb1['email'],'firstName':_0x4a0eb1[_0x872c('0x47')],'lastName':_0x4a0eb1[_0x872c('0x48')],'mapKey':'email','message':{'from':_0x4a0eb1[_0x872c('0xeb')],'to':_0x5a5906[_0x872c('0xd4')][_0x872c('0xeb')],'cc':'','subject':_[_0x872c('0x95')](_0x134d40)?_0x5a5906[_0x872c('0xf1')]:_0x134d40,'messageId':'','sentAt':new Date(),'attach':_0x129deb[_0x872c('0x5d')],'attachments':_0x129deb,'originChannel':_0x872c('0xf2'),'ChatWebsiteId':_0x5a5906['id'],'ChatOfflineMessageId':_0x24cbb6['id'],'originTo':_0x5a5906['MailAccount']['email']},'body':_0x24cbb6[_0x872c('0x6e')]};var _0x39d5af={'account':{'id':_0x5a5906[_0x872c('0xec')]},'body':_0x2e77b7,'log':_0x872c('0xf3')};return respondWithRpcPromise(_0x872c('0xf3'),'notifyMail',_0x39d5af,client9001)['then'](function(){return _0x24cbb6;})['catch'](function(_0x2e6e95){logger[_0x872c('0x1d')](_0x2e6e95);});}return;})[_0x872c('0x16')](function(){if(_0x24cbb6){return _0x24cbb6;}})[_0x872c('0x16')](respondWithResult(_0x305247,null))['catch'](function(){for(var _0x1b9832 of _0x144373){var _0x1c9151=path[_0x872c('0x91')](config[_0x872c('0x8c')],_0x872c('0xdd'),_0x872c('0xce'),'attachments','offline-chat',_0x1b9832['filename']);fs_extra['remove'](_0x1c9151)['catch'](function(_0x3348f5){logger[_0x872c('0x1d')](_0x872c('0xf4'),_0x1c9151,_0x3348f5);});}});};exports[_0x872c('0xf5')]=function(_0xf4f5ad,_0xcd2bca){return db['ChatInteraction']['find']({'where':{'id':_0xf4f5ad[_0x872c('0x76')]['id']}})[_0x872c('0x16')](handleEntityNotFound(_0xcd2bca,null))['then'](function(_0x7c9f59){if(_0x7c9f59){return _0x7c9f59[_0x872c('0xf5')](_0xf4f5ad[_0x872c('0x6e')][_0x872c('0x7e')],_[_0x872c('0xf6')](_0xf4f5ad[_0x872c('0x6e')],['ids','id'])||{});}})[_0x872c('0x16')](respondWithResult(_0xcd2bca,null))[_0x872c('0x20')](handleError(_0xcd2bca,null));};exports['getInteractions']=function(_0x1cf9bd,_0x1ff4d8){var _0x8b4fa1={'raw':![],'where':{}};var _0x271c89={};var _0x348740={'count':0x0,'rows':[]};return db[_0x872c('0x64')][_0x872c('0x7b')]({'where':{'id':_0x1cf9bd[_0x872c('0x76')]['id']}})[_0x872c('0x16')](handleEntityNotFound(_0x1ff4d8,null))[_0x872c('0x16')](function(_0x488169){if(_0x488169){_0x271c89[_0x872c('0x50')]=_[_0x872c('0x6a')](db[_0x872c('0xb8')][_0x872c('0x56')]);_0x271c89['query']=_[_0x872c('0x6a')](_0x1cf9bd[_0x872c('0x58')]);_0x271c89[_0x872c('0x59')]=_[_0x872c('0x5b')](_0x271c89[_0x872c('0x50')],_0x271c89['query']);_0x8b4fa1[_0x872c('0x5a')]=_['intersection'](_0x271c89[_0x872c('0x50')],qs[_0x872c('0x5c')](_0x1cf9bd['query']['fields']));_0x8b4fa1['attributes']=_0x8b4fa1[_0x872c('0x5a')][_0x872c('0x5d')]?_0x8b4fa1[_0x872c('0x5a')]:_0x271c89[_0x872c('0x50')];if(!_0x1cf9bd[_0x872c('0x58')]['hasOwnProperty']('nolimit')){_0x8b4fa1[_0x872c('0x25')]=qs[_0x872c('0x25')](_0x1cf9bd[_0x872c('0x58')][_0x872c('0x25')]);_0x8b4fa1['offset']=qs[_0x872c('0x23')](_0x1cf9bd[_0x872c('0x58')]['offset']);}_0x8b4fa1[_0x872c('0x82')]=qs[_0x872c('0x60')](_0x1cf9bd[_0x872c('0x58')][_0x872c('0x60')]);_0x8b4fa1[_0x872c('0x62')]=qs[_0x872c('0x59')](_[_0x872c('0x7c')](_0x1cf9bd[_0x872c('0x58')],_0x271c89[_0x872c('0x59')]));_0x8b4fa1[_0x872c('0x62')]['ChatWebsiteId']=_0x488169['id'];if(_0x1cf9bd[_0x872c('0x58')]['filter']){_0x8b4fa1[_0x872c('0x62')]=_['merge'](_0x8b4fa1[_0x872c('0x62')],{'$or':_['map'](_0x8b4fa1[_0x872c('0x5a')],function(_0x49f8ea){var _0x31138a={};_0x31138a[_0x49f8ea]={'$like':'%'+_0x1cf9bd[_0x872c('0x58')][_0x872c('0x61')]+'%'};return _0x31138a;})});}_0x8b4fa1=_[_0x872c('0x6b')]({},_0x8b4fa1,_0x1cf9bd['options']);return db[_0x872c('0xb8')]['count']({'where':_0x8b4fa1[_0x872c('0x62')]})[_0x872c('0x16')](function(_0x3c0d91){_0x348740['count']=_0x3c0d91;if(_0x1cf9bd['query'][_0x872c('0x65')]){_0x8b4fa1[_0x872c('0x66')]=[{'model':db[_0x872c('0x9f')],'as':_0x872c('0xf7'),'required':![]},{'model':db[_0x872c('0xf8')],'as':_0x872c('0xf9'),'attributes':[_0x872c('0x2e'),_0x872c('0xfa'),'internal'],'required':![]},{'model':db[_0x872c('0xfb')],'as':'Tags','attributes':['id',_0x872c('0x2e'),_0x872c('0xfc')],'where':_0x1cf9bd[_0x872c('0x58')][_0x872c('0xfd')]?{'id':_0x1cf9bd[_0x872c('0x58')]['tag']}:undefined,'required':_0x1cf9bd[_0x872c('0x58')]['tag']?!![]:![]}];}return db[_0x872c('0xb8')][_0x872c('0x67')](_0x8b4fa1);})[_0x872c('0x16')](function(_0x15f4b7){_0x348740[_0x872c('0x68')]=_0x15f4b7;return _0x348740;});}})[_0x872c('0x16')](respondWithFilteredResult(_0x1ff4d8,_0x8b4fa1))[_0x872c('0x20')](handleError(_0x1ff4d8,null));};exports[_0x872c('0xfe')]=function(_0x33ad57,_0x2a2fac){var _0x1e7cb6=0x0;var _0x1454a8=0x0;var _0x509c3b=![];var _0x123d10;var _0x4ff137;return db[_0x872c('0x64')]['find']({'where':{'id':_0x33ad57[_0x872c('0x76')]['id']},'include':[{'model':db[_0x872c('0x3c')],'as':_0x872c('0x3c'),'include':[{'model':db[_0x872c('0x3c')],'as':_0x872c('0x3d'),'attributes':['id',_0x872c('0x37')]}]}]})[_0x872c('0x16')](handleEntityNotFound(_0x2a2fac,null))[_0x872c('0x16')](function(_0x1c7195){if(_0x1c7195){_0x123d10=_0x1c7195;return _0x1c7195['getProactiveActions']({'raw':!![]});}})['then'](function(_0x59c0d4){if(_0x123d10){if(_0x59c0d4){_0x4ff137=_0x59c0d4;}}return require(_0x872c('0xff'))['getLicense']();})['then'](function(_0x301eb1){if(_0x301eb1){_0x1454a8=_0x301eb1['virtual'];_0x509c3b=_0x301eb1['custom'];}})['then'](function(){return db[_0x872c('0xb8')][_0x872c('0x26')]({'where':{'closed':![]}});})[_0x872c('0x16')](function(_0x575cfe){_0x1e7cb6=_0x575cfe;if(_0x1454a8&&_0x575cfe>_0x1454a8){return db[_0x872c('0x100')][_0x872c('0x7b')]({'where':{'id':0x1}})[_0x872c('0x16')](function(_0x1f11bc){if(_0x1f11bc){_0x1f11bc['increment']('chatLicenseExceeded');}});}})[_0x872c('0x16')](function(){if(!_0x123d10[_0x872c('0x3c')]||!_0x123d10[_0x872c('0x3c')][_0x872c('0x3d')])return!![];return checkWebsiteIntervals(_0x123d10);})[_0x872c('0x16')](function(_0x1276bf){var _0x2cd27b=fs[_0x872c('0xd5')](path[_0x872c('0x91')](config['root'],_0x872c('0x101')),_0x872c('0x102'));var _0x4182ff=new url[(_0x872c('0x103'))](_0x123d10[_0x872c('0x104')])[_0x872c('0x105')];var _0x334bd3=_0x872c('0x106');var _0x12ea20=![];var _0x24a032={'chatVersion':_0x334bd3,'chatWebsiteAddressOrigin':_0x4182ff,'remote':_0x123d10[_0x872c('0x107')],'query':querystring[_0x872c('0x1c')](_[_0x872c('0x6b')](_0x123d10[_0x872c('0x2a')]({'plain':!![]}),{'customerIp':_0x33ad57[_0x872c('0xb6')][_0x872c('0x44')]||_0x33ad57[_0x872c('0xb6')][_0x872c('0x108')]||_0x33ad57[_0x872c('0x109')]['remoteAddress']||_0x33ad57['ip'],'referer':_0x33ad57[_0x872c('0xb6')][_0x872c('0x4a')],'openedInteractions':_0x1e7cb6,'maxInteractions':_0x1454a8,'virtual':_0x509c3b[_0x872c('0x10a')],'online':_0x1276bf,'custom':_0x509c3b}))['replace'](/'/g,'\x5c\x27')};_0x2a2fac[_0x872c('0x2f')](ejs[_0x872c('0xd7')](Mustache[_0x872c('0xd7')](_0x2cd27b,_0x24a032),{'proactiveActions':_0x4ff137,'alignment':_0x123d10[_0x872c('0x10b')],'verticalAlignment':_0x123d10[_0x872c('0x10c')],'div_color':_0x123d10[_0x872c('0xfc')],'labelText':_0x123d10[_0x872c('0x10d')],'text_color':_0x123d10[_0x872c('0x10e')],'text_button_color':_0x123d10[_0x872c('0x10f')],'button_color':_0x123d10[_0x872c('0x110')],'background_color':_0x123d10['backgroundColor'],'hideWhenOffline':_0x123d10[_0x872c('0x111')],'intervalId':_0x123d10[_0x872c('0x112')],'isDevelopment':_0x12ea20,'chatVersion':_0x334bd3}));})[_0x872c('0x20')](handleError(_0x2a2fac,null));};exports[_0x872c('0x113')]=function(_0x136729,_0x148551){var _0x1645e4=_0x136729[_0x872c('0x76')]['id'];var _0x4d3d6d=_0x136729[_0x872c('0x6e')];var _0xb3bf6c=0xc8;var _0x5ccb5d=null;return db[_0x872c('0xe1')][_0x872c('0xe2')]({'isolationLevel':db['sequelize'][_0x872c('0x114')][_0x872c('0x115')][_0x872c('0x116')]},function(_0x4439be){return db[_0x872c('0x64')][_0x872c('0x7b')]({'where':{'id':_0x1645e4},'transaction':_0x4439be})['then'](function(_0x19e050){if(_0x19e050){return db[_0x872c('0xb0')][_0x872c('0x29')]({'where':{'ChatWebsiteId':_0x1645e4},'transaction':_0x4439be})[_0x872c('0x16')](function(){var _0x6aaec6=_[_0x872c('0x3b')](_0x4d3d6d,function(_0x5e7186){_0x5e7186[_0x872c('0x78')]=_0x1645e4;return _0x5e7186;});return db[_0x872c('0xb0')][_0x872c('0xe4')](_0x6aaec6,{'transaction':_0x4439be});});}else{_0xb3bf6c=0x194;_0x5ccb5d=[];}});})['then'](function(){if(_0xb3bf6c!==0x194){return db[_0x872c('0xb0')][_0x872c('0x117')]({'where':{'ChatWebsiteId':_0x1645e4},'order':_0x872c('0xb3')})[_0x872c('0x16')](function(_0x2d0a1c){_0x5ccb5d=_0x2d0a1c;});}})['catch'](function(_0x20e6db){_0xb3bf6c=0x1f4;logger[_0x872c('0x1d')](_0x20e6db['stack']);if(_0x20e6db['name']){delete _0x20e6db[_0x872c('0x2e')];}_0x5ccb5d=_0x20e6db;})[_0x872c('0x118')](function(){if(_0x5ccb5d===null){_0x148551[_0x872c('0x2d')](_0xb3bf6c);}else{if(_0xb3bf6c===0x1f4){_0x148551[_0x872c('0x21')](_0xb3bf6c)[_0x872c('0x2f')](_0x5ccb5d);}else{_0x148551[_0x872c('0x21')](_0xb3bf6c)[_0x872c('0x22')](_0x5ccb5d);}}});};exports[_0x872c('0x119')]=function(_0x20f6c1,_0x118ff9){var _0x178ee7={};var _0x8dac6b={};var _0x26a035;var _0x56ab33;return db[_0x872c('0x64')][_0x872c('0x7b')]({'where':{'id':_0x20f6c1[_0x872c('0x76')]['id']}})['then'](handleEntityNotFound(_0x118ff9,null))['then'](function(_0x505f63){if(_0x505f63){_0x26a035=_0x505f63;_0x8dac6b[_0x872c('0x50')]=_[_0x872c('0x6a')](db[_0x872c('0xb0')][_0x872c('0x56')]);_0x8dac6b['query']=_[_0x872c('0x6a')](_0x20f6c1[_0x872c('0x58')]);_0x8dac6b[_0x872c('0x59')]=_['intersection'](_0x8dac6b[_0x872c('0x50')],_0x8dac6b[_0x872c('0x58')]);_0x178ee7[_0x872c('0x5a')]=_['intersection'](_0x8dac6b[_0x872c('0x50')],qs['fields'](_0x20f6c1[_0x872c('0x58')][_0x872c('0x5c')]));_0x178ee7['attributes']=_0x178ee7[_0x872c('0x5a')][_0x872c('0x5d')]?_0x178ee7[_0x872c('0x5a')]:_0x8dac6b[_0x872c('0x50')];_0x178ee7[_0x872c('0x82')]=qs[_0x872c('0x60')](_0x20f6c1[_0x872c('0x58')][_0x872c('0x60')]);_0x178ee7[_0x872c('0x62')]=qs['filters'](_['pick'](_0x20f6c1[_0x872c('0x58')],_0x8dac6b[_0x872c('0x59')]));if(_0x20f6c1[_0x872c('0x58')]['filter']){_0x178ee7[_0x872c('0x62')]=_[_0x872c('0x6b')](_0x178ee7['where'],{'$or':_[_0x872c('0x3b')](_0x178ee7[_0x872c('0x5a')],function(_0x653260){var _0x944729={};_0x944729[_0x653260]={'$like':'%'+_0x20f6c1[_0x872c('0x58')]['filter']+'%'};return _0x944729;})});}_0x178ee7=_[_0x872c('0x6b')]({},_0x178ee7,_0x20f6c1['options']);return _0x26a035[_0x872c('0x119')](_0x178ee7);}})[_0x872c('0x16')](function(_0x3b475b){if(_0x3b475b){_0x56ab33=_0x3b475b[_0x872c('0x5d')];if(!_0x20f6c1[_0x872c('0x58')][_0x872c('0x5e')](_0x872c('0x5f'))){_0x178ee7['limit']=qs[_0x872c('0x25')](_0x20f6c1[_0x872c('0x58')][_0x872c('0x25')]);_0x178ee7[_0x872c('0x23')]=qs['offset'](_0x20f6c1[_0x872c('0x58')][_0x872c('0x23')]);}return _0x26a035[_0x872c('0x119')](_0x178ee7);}})['then'](function(_0x2615af){if(_0x2615af){return _0x2615af?{'count':_0x56ab33,'rows':_0x2615af}:null;}})[_0x872c('0x16')](respondWithResult(_0x118ff9,null))['catch'](handleError(_0x118ff9,null));};exports[_0x872c('0x11a')]=function(_0x5b4604,_0x54c7a1){return db['chatProactiveAction'][_0x872c('0x73')]({'where':{'id':_0x5b4604[_0x872c('0x76')]['id']}})[_0x872c('0x16')](handleEntityNotFound(_0x54c7a1,null))[_0x872c('0x16')](function(_0x404c13){if(_0x404c13){return _0x404c13['addProactiveActions'](_0x5b4604[_0x872c('0x6e')]['ids'],_[_0x872c('0xf6')](_0x5b4604['body'],[_0x872c('0x7e'),'id'])||{});}})[_0x872c('0x16')](respondWithResult(_0x54c7a1,null))[_0x872c('0x20')](handleError(_0x54c7a1,null));};exports[_0x872c('0x11b')]=function(_0x2b71fa,_0x269b3c){var _0xb06672={};var _0x255886={};var _0x5cefce;var _0x5d21dd;return db[_0x872c('0x64')][_0x872c('0x7b')]({'where':{'id':_0x2b71fa['params']['id']}})[_0x872c('0x16')](handleEntityNotFound(_0x269b3c,null))[_0x872c('0x16')](function(_0x4bdd93){if(_0x4bdd93){_0x5cefce=_0x4bdd93;_0x255886[_0x872c('0x50')]=_[_0x872c('0x6a')](db[_0x872c('0x11c')]['rawAttributes']);_0x255886[_0x872c('0x58')]=_[_0x872c('0x6a')](_0x2b71fa[_0x872c('0x58')]);_0x255886[_0x872c('0x59')]=_[_0x872c('0x5b')](_0x255886['model'],_0x255886[_0x872c('0x58')]);_0xb06672['attributes']=_[_0x872c('0x5b')](_0x255886[_0x872c('0x50')],qs[_0x872c('0x5c')](_0x2b71fa[_0x872c('0x58')][_0x872c('0x5c')]));_0xb06672['attributes']=_0xb06672[_0x872c('0x5a')][_0x872c('0x5d')]?_0xb06672[_0x872c('0x5a')]:_0x255886[_0x872c('0x50')];_0xb06672['order']=qs[_0x872c('0x60')](_0x2b71fa[_0x872c('0x58')][_0x872c('0x60')]);_0xb06672[_0x872c('0x62')]=qs[_0x872c('0x59')](_[_0x872c('0x7c')](_0x2b71fa['query'],_0x255886[_0x872c('0x59')]));if(_0x2b71fa[_0x872c('0x58')]['filter']){_0xb06672['where']=_['merge'](_0xb06672[_0x872c('0x62')],{'$or':_['map'](_0xb06672['attributes'],function(_0x25f2fc){var _0x3163b5={};_0x3163b5[_0x25f2fc]={'$like':'%'+_0x2b71fa['query'][_0x872c('0x61')]+'%'};return _0x3163b5;})});}_0xb06672=_['merge']({},_0xb06672,_0x2b71fa[_0x872c('0x6c')]);return _0x5cefce[_0x872c('0x11b')](_0xb06672);}})['then'](function(_0x212a38){if(_0x212a38){_0x5d21dd=_0x212a38['length'];if(!_0x2b71fa[_0x872c('0x58')][_0x872c('0x5e')]('nolimit')){_0xb06672[_0x872c('0x25')]=qs[_0x872c('0x25')](_0x2b71fa[_0x872c('0x58')][_0x872c('0x25')]);_0xb06672[_0x872c('0x23')]=qs[_0x872c('0x23')](_0x2b71fa[_0x872c('0x58')]['offset']);}return _0x5cefce['getProactiveActions'](_0xb06672);}})['then'](function(_0x395211){if(_0x395211){return _0x395211?{'count':_0x5d21dd,'rows':_0x395211}:null;}})['then'](respondWithResult(_0x269b3c,null))[_0x872c('0x20')](handleError(_0x269b3c,null));};exports[_0x872c('0x11d')]=function(_0x3f3a49,_0x129037){var _0x4e6d0e=_0x3f3a49[_0x872c('0x58')][_0x872c('0x11e')]===_0x872c('0x11f')?_0x872c('0x120'):_0x872c('0x121');return db[_0x872c('0x64')][_0x872c('0x73')]({'attributes':['id',_0x4e6d0e],'where':{'id':_0x3f3a49[_0x872c('0x76')]['id']}})[_0x872c('0x16')](handleEntityNotFound(_0x129037,null))[_0x872c('0x16')](function(_0xa6333a){if(_0xa6333a){var _0x1ec9ac=_0xa6333a[_0x4e6d0e];var _0x1eae07=_0x1ec9ac&&_0x1ec9ac['items']?_0x1ec9ac[_0x872c('0x122')]:[];_0x129037[_0x872c('0x2f')]({'fromKey':_[_0x872c('0x95')](_0x1ec9ac[_0x872c('0x123')])?undefined:_0x1ec9ac['fromKey'],'count':_0x1eae07[_0x872c('0x5d')],'rows':_0x1eae07});}})['catch'](handleError(_0x129037,null));};exports[_0x872c('0x124')]=function(_0x2328a4,_0x5135d8){var _0x1c8e31={'raw':![],'where':{}};var _0x3a7d2e={};var _0x67a052={'count':0x0,'rows':[]};return db[_0x872c('0x64')][_0x872c('0x7b')]({'where':{'id':_0x2328a4[_0x872c('0x76')]['id']}})[_0x872c('0x16')](handleEntityNotFound(_0x5135d8,null))[_0x872c('0x16')](function(_0x5aae44){if(_0x5aae44){_0x3a7d2e[_0x872c('0x50')]=_[_0x872c('0x6a')](db['ChatOfflineMessage']['rawAttributes']);_0x3a7d2e[_0x872c('0x58')]=_['keys'](_0x2328a4[_0x872c('0x58')]);_0x3a7d2e[_0x872c('0x59')]=_[_0x872c('0x5b')](_0x3a7d2e[_0x872c('0x50')],_0x3a7d2e[_0x872c('0x58')]);_0x1c8e31[_0x872c('0x5a')]=_['intersection'](_0x3a7d2e['model'],qs['fields'](_0x2328a4[_0x872c('0x58')][_0x872c('0x5c')]));_0x1c8e31['attributes']=_0x1c8e31[_0x872c('0x5a')]['length']?_0x1c8e31[_0x872c('0x5a')]:_0x3a7d2e[_0x872c('0x50')];if(!_0x2328a4['query']['hasOwnProperty'](_0x872c('0x5f'))){_0x1c8e31[_0x872c('0x25')]=qs[_0x872c('0x25')](_0x2328a4[_0x872c('0x58')][_0x872c('0x25')]);_0x1c8e31[_0x872c('0x23')]=qs[_0x872c('0x23')](_0x2328a4[_0x872c('0x58')][_0x872c('0x23')]);}_0x1c8e31[_0x872c('0x82')]=qs[_0x872c('0x60')](_0x2328a4[_0x872c('0x58')][_0x872c('0x60')]);_0x1c8e31[_0x872c('0x62')]=qs['filters'](_['pick'](_0x2328a4['query'],_0x3a7d2e[_0x872c('0x59')]));_0x1c8e31[_0x872c('0x62')][_0x872c('0x78')]=_0x5aae44['id'];if(_0x2328a4['query'][_0x872c('0x61')]){_0x1c8e31[_0x872c('0x62')]=_[_0x872c('0x6b')](_0x1c8e31[_0x872c('0x62')],{'$or':_[_0x872c('0x3b')](_0x1c8e31[_0x872c('0x5a')],function(_0x2c2053){var _0xf24e18={};_0xf24e18[_0x2c2053]={'$like':'%'+_0x2328a4[_0x872c('0x58')][_0x872c('0x61')]+'%'};return _0xf24e18;})});}_0x1c8e31=_[_0x872c('0x6b')]({},_0x1c8e31,_0x2328a4[_0x872c('0x6c')]);return db[_0x872c('0xda')][_0x872c('0x26')]({'where':_0x1c8e31[_0x872c('0x62')]})['then'](function(_0x3f7c67){_0x67a052[_0x872c('0x26')]=_0x3f7c67;if(_0x2328a4['query'][_0x872c('0x65')]){_0x1c8e31[_0x872c('0x66')]=[{'all':!![]}];}else{_0x1c8e31[_0x872c('0x66')]=[{'model':db[_0x872c('0x9f')],'as':_0x872c('0xf7'),'required':![]},{'model':db[_0x872c('0xe3')],'as':_0x872c('0x125'),'required':![]}];}return db[_0x872c('0xda')][_0x872c('0x67')](_0x1c8e31);})['then'](function(_0x2ec01c){_0x67a052[_0x872c('0x68')]=_0x2ec01c;return _0x67a052;});}})['then'](respondWithFilteredResult(_0x5135d8,_0x1c8e31))['catch'](handleError(_0x5135d8,null));};exports[_0x872c('0x126')]=function(_0x1f88d8,_0x19ce18){return db['ChatWebsite'][_0x872c('0x73')]({'where':{'id':_0x1f88d8[_0x872c('0x76')]['id']}})[_0x872c('0x16')](handleEntityNotFound(_0x19ce18,null))[_0x872c('0x16')](function(_0x46c2bb){if(_0x46c2bb){return _0x46c2bb[_0x872c('0x126')](_0x1f88d8[_0x872c('0x6e')][_0x872c('0x7e')],_[_0x872c('0xf6')](_0x1f88d8[_0x872c('0x6e')],[_0x872c('0x7e'),'id'])||{})[_0x872c('0xb2')](function(_0x4e43b3){for(var _0x2bba36=0x0;_0x2bba36<_0x1f88d8[_0x872c('0x6e')]['ids'][_0x872c('0x5d')];_0x2bba36+=0x1){socket[_0x872c('0x127')]('userChatWebsite:save',{'UserId':Number(_0x1f88d8[_0x872c('0x6e')][_0x872c('0x7e')][_0x2bba36]),'ChatWebsiteId':Number(_0x1f88d8[_0x872c('0x76')]['id'])});}return _0x4e43b3;});}})[_0x872c('0x16')](respondWithResult(_0x19ce18,null))[_0x872c('0x20')](handleError(_0x19ce18,null));};exports[_0x872c('0x128')]=function(_0x2b8fa9,_0x36b00b){return db['ChatWebsite'][_0x872c('0x73')]({'where':{'id':_0x2b8fa9['params']['id']}})[_0x872c('0x16')](handleEntityNotFound(_0x36b00b,null))[_0x872c('0x16')](function(_0x5ccd77){if(_0x5ccd77){return _0x5ccd77[_0x872c('0x128')](_0x2b8fa9['query'][_0x872c('0x7e')])['then'](function(){if(_[_0x872c('0x129')](_0x2b8fa9['query']['ids'])){for(var _0x2ad92c=0x0;_0x2ad92c<_0x2b8fa9[_0x872c('0x58')][_0x872c('0x7e')][_0x872c('0x5d')];_0x2ad92c+=0x1){socket[_0x872c('0x127')]('userChatWebsite:remove',{'UserId':Number(_0x2b8fa9[_0x872c('0x58')][_0x872c('0x7e')][_0x2ad92c]),'ChatWebsiteId':Number(_0x2b8fa9[_0x872c('0x76')]['id'])});}}else{socket[_0x872c('0x127')](_0x872c('0x12a'),{'UserId':Number(_0x2b8fa9[_0x872c('0x58')][_0x872c('0x7e')]),'ChatWebsiteId':Number(_0x2b8fa9['params']['id'])});}});}})[_0x872c('0x16')](respondWithStatusCode(_0x36b00b,null))[_0x872c('0x20')](handleError(_0x36b00b,null));};exports[_0x872c('0x12b')]=function(_0x491f86,_0x369225){var _0x4ffc14={};var _0x43ef84={};var _0x3d5689;var _0x6c55eb;return db[_0x872c('0x64')][_0x872c('0x7b')]({'where':{'id':_0x491f86['params']['id']}})['then'](handleEntityNotFound(_0x369225,null))['then'](function(_0x2fd5e8){if(_0x2fd5e8){_0x3d5689=_0x2fd5e8;_0x43ef84[_0x872c('0x50')]=_[_0x872c('0x6a')](db[_0x872c('0xf8')][_0x872c('0x56')]);_0x43ef84[_0x872c('0x58')]=_[_0x872c('0x6a')](_0x491f86[_0x872c('0x58')]);_0x43ef84[_0x872c('0x59')]=_[_0x872c('0x5b')](_0x43ef84[_0x872c('0x50')],_0x43ef84[_0x872c('0x58')]);_0x4ffc14['attributes']=_['intersection'](_0x43ef84['model'],qs['fields'](_0x491f86[_0x872c('0x58')][_0x872c('0x5c')]));_0x4ffc14[_0x872c('0x5a')]=_0x4ffc14[_0x872c('0x5a')][_0x872c('0x5d')]?_0x4ffc14[_0x872c('0x5a')]:_0x43ef84[_0x872c('0x50')];_0x4ffc14['order']=qs['sort'](_0x491f86[_0x872c('0x58')][_0x872c('0x60')]);_0x4ffc14[_0x872c('0x62')]=qs[_0x872c('0x59')](_[_0x872c('0x7c')](_0x491f86[_0x872c('0x58')],_0x43ef84[_0x872c('0x59')]));if(_0x491f86['query']['filter']){_0x4ffc14['where']=_[_0x872c('0x6b')](_0x4ffc14['where'],{'$or':_[_0x872c('0x3b')](_0x4ffc14[_0x872c('0x5a')],function(_0x21b156){var _0x560d62={};_0x560d62[_0x21b156]={'$like':'%'+_0x491f86['query'][_0x872c('0x61')]+'%'};return _0x560d62;})});}_0x4ffc14=_[_0x872c('0x6b')]({},_0x4ffc14,_0x491f86['options']);return _0x3d5689[_0x872c('0x12b')](_0x4ffc14);}})['then'](function(_0x352b0b){if(_0x352b0b){_0x6c55eb=_0x352b0b['length'];if(!_0x491f86[_0x872c('0x58')][_0x872c('0x5e')](_0x872c('0x5f'))){_0x4ffc14[_0x872c('0x25')]=qs[_0x872c('0x25')](_0x491f86[_0x872c('0x58')][_0x872c('0x25')]);_0x4ffc14['offset']=qs[_0x872c('0x23')](_0x491f86['query']['offset']);}return _0x3d5689['getAgents'](_0x4ffc14);}})['then'](function(_0x3f0134){if(_0x3f0134){return _0x3f0134?{'count':_0x6c55eb,'rows':_0x3f0134}:null;}})[_0x872c('0x16')](respondWithResult(_0x369225,null))[_0x872c('0x20')](handleError(_0x369225,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index d908614..17af6d9 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 _0x98d3=['events','../../mysqldb','setMaxListeners','update','emit','hasOwnProperty','exports'];(function(_0x5ca9bb,_0x2ce05c){var _0x1b2a34=function(_0x2e5426){while(--_0x2e5426){_0x5ca9bb['push'](_0x5ca9bb['shift']());}};_0x1b2a34(++_0x2ce05c);}(_0x98d3,0x173));var _0x398d=function(_0x2cd8b0,_0x20b66a){_0x2cd8b0=_0x2cd8b0-0x0;var _0xd5fbcf=_0x98d3[_0x2cd8b0];return _0xd5fbcf;};'use strict';var EventEmitter=require(_0x398d('0x0'));var ChatWebsite=require(_0x398d('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x398d('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x398d('0x3'),'afterDestroy':'remove'};function emitEvent(_0x465d4a){return function(_0x41f57c,_0x4f7a58,_0x547cbc){ChatWebsiteEvents[_0x398d('0x4')](_0x465d4a+':'+_0x41f57c['id'],_0x41f57c);ChatWebsiteEvents[_0x398d('0x4')](_0x465d4a,_0x41f57c);_0x547cbc(null);};}for(var e in events){if(events[_0x398d('0x5')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x398d('0x6')]=ChatWebsiteEvents; \ No newline at end of file +var _0xe198=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','remove','emit'];(function(_0x17de8e,_0x41ad4c){var _0x39aba5=function(_0x255320){while(--_0x255320){_0x17de8e['push'](_0x17de8e['shift']());}};_0x39aba5(++_0x41ad4c);}(_0xe198,0x6f));var _0x8e19=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe198[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0x8e19('0x0'));var ChatWebsite=require(_0x8e19('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8e19('0x2'),'afterUpdate':_0x8e19('0x3'),'afterDestroy':_0x8e19('0x4')};function emitEvent(_0x529200){return function(_0x32f52f,_0x4e3f58,_0x23383d){ChatWebsiteEvents[_0x8e19('0x5')](_0x529200+':'+_0x32f52f['id'],_0x32f52f);ChatWebsiteEvents[_0x8e19('0x5')](_0x529200,_0x32f52f);_0x23383d(null);};}for(var e in events){if(events[_0x8e19('0x6')](e)){var event=events[e];ChatWebsite[_0x8e19('0x7')](e,emitEvent(event));}}module[_0x8e19('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 0811bd3..ee42be4 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 _0x505c=['exports','ChatWebsite','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./chatWebsite.attributes'];(function(_0xdd82b4,_0x5cd8b8){var _0x549bb2=function(_0x426fd9){while(--_0x426fd9){_0xdd82b4['push'](_0xdd82b4['shift']());}};_0x549bb2(++_0x5cd8b8);}(_0x505c,0x10a));var _0xc505=function(_0x3441bb,_0x11052c){_0x3441bb=_0x3441bb-0x0;var _0xd94568=_0x505c[_0x3441bb];return _0xd94568;};'use strict';var _=require(_0xc505('0x0'));var util=require(_0xc505('0x1'));var logger=require(_0xc505('0x2'))('api');var moment=require(_0xc505('0x3'));var BPromise=require(_0xc505('0x4'));var rp=require(_0xc505('0x5'));var fs=require('fs');var path=require(_0xc505('0x6'));var rimraf=require(_0xc505('0x7'));var config=require('../../config/environment');var attributes=require(_0xc505('0x8'));module[_0xc505('0x9')]=function(_0x2ba66b,_0x4d0e53){return _0x2ba66b['define'](_0xc505('0xa'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc80e=['moment','bluebird','path','rimraf','../../config/environment','exports','define','chat_websites','lodash','util','api'];(function(_0x3fa569,_0xf425fe){var _0x44ed1d=function(_0x5801c3){while(--_0x5801c3){_0x3fa569['push'](_0x3fa569['shift']());}};_0x44ed1d(++_0xf425fe);}(_0xc80e,0x152));var _0xec80=function(_0x5a2299,_0x3e2922){_0x5a2299=_0x5a2299-0x0;var _0xedff0f=_0xc80e[_0x5a2299];return _0xedff0f;};'use strict';var _=require(_0xec80('0x0'));var util=require(_0xec80('0x1'));var logger=require('../../config/logger')(_0xec80('0x2'));var moment=require(_0xec80('0x3'));var BPromise=require(_0xec80('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec80('0x5'));var rimraf=require(_0xec80('0x6'));var config=require(_0xec80('0x7'));var attributes=require('./chatWebsite.attributes');module[_0xec80('0x8')]=function(_0x1448b9,_0x1742e3){return _0x1448b9[_0xec80('0x9')]('ChatWebsite',attributes,{'tableName':_0xec80('0xa'),'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 d6a9a4f..1707400 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 _0x6835=['request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./chatWebsite.socket'];(function(_0x132fd3,_0x4352e8){var _0x5ce659=function(_0x17c5a4){while(--_0x17c5a4){_0x132fd3['push'](_0x132fd3['shift']());}};_0x5ce659(++_0x4352e8);}(_0x6835,0xc1));var _0x5683=function(_0x3cba89,_0x5a2845){_0x3cba89=_0x3cba89-0x0;var _0x25c1c5=_0x6835[_0x3cba89];return _0x25c1c5;};'use strict';var _=require(_0x5683('0x0'));var util=require(_0x5683('0x1'));var moment=require(_0x5683('0x2'));var BPromise=require(_0x5683('0x3'));var rs=require(_0x5683('0x4'));var fs=require('fs');var Redis=require(_0x5683('0x5'));var db=require(_0x5683('0x6'))['db'];var utils=require(_0x5683('0x7'));var logger=require(_0x5683('0x8'))(_0x5683('0x9'));var config=require(_0x5683('0xa'));var jayson=require(_0x5683('0xb'));var client=jayson[_0x5683('0xc')]['http']({'port':0x232a});config[_0x5683('0xd')]=_[_0x5683('0xe')](config[_0x5683('0xd')],{'host':_0x5683('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5683('0x10'))['register'](socket);function respondWithRpcPromise(_0x45ea00,_0x1da7ad,_0x2fa270){return new BPromise(function(_0x944285,_0x3a42c2){return client[_0x5683('0x11')](_0x45ea00,_0x2fa270)[_0x5683('0x12')](function(_0x2b31bc){logger[_0x5683('0x13')](_0x5683('0x14'),_0x1da7ad,_0x5683('0x15'));logger[_0x5683('0x16')](_0x5683('0x17'),_0x1da7ad,_0x5683('0x15'),JSON[_0x5683('0x18')](_0x2b31bc));if(_0x2b31bc[_0x5683('0x19')]){if(_0x2b31bc[_0x5683('0x19')][_0x5683('0x1a')]===0x1f4){logger['error'](_0x5683('0x14'),_0x1da7ad,_0x2b31bc[_0x5683('0x19')][_0x5683('0x1b')]);return _0x3a42c2(_0x2b31bc[_0x5683('0x19')]['message']);}logger[_0x5683('0x19')](_0x5683('0x14'),_0x1da7ad,_0x2b31bc[_0x5683('0x19')][_0x5683('0x1b')]);return _0x944285(_0x2b31bc['error']['message']);}else{logger[_0x5683('0x13')](_0x5683('0x14'),_0x1da7ad,_0x5683('0x15'));_0x944285(_0x2b31bc[_0x5683('0x1c')][_0x5683('0x1b')]);}})[_0x5683('0x1d')](function(_0x535f10){logger[_0x5683('0x19')](_0x5683('0x14'),_0x1da7ad,_0x535f10);_0x3a42c2(_0x535f10);});});} \ No newline at end of file +var _0x89ee=['stringify','code','error','message','result','catch','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s'];(function(_0x23f2a7,_0x3bc14f){var _0x547933=function(_0x4137e0){while(--_0x4137e0){_0x23f2a7['push'](_0x23f2a7['shift']());}};_0x547933(++_0x3bc14f);}(_0x89ee,0x14b));var _0xe89e=function(_0x9b2e01,_0x13c214){_0x9b2e01=_0x9b2e01-0x0;var _0x141a4d=_0x89ee[_0x9b2e01];return _0x141a4d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe89e('0x0'));var BPromise=require(_0xe89e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe89e('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xe89e('0x3'))('rpc');var config=require(_0xe89e('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xe89e('0x5')][_0xe89e('0x6')]({'port':0x232a});config[_0xe89e('0x7')]=_[_0xe89e('0x8')](config['redis'],{'host':_0xe89e('0x9'),'port':0x18eb});var socket=require(_0xe89e('0xa'))(new Redis(config[_0xe89e('0x7')]));require(_0xe89e('0xb'))[_0xe89e('0xc')](socket);function respondWithRpcPromise(_0x564978,_0xfc5150,_0x8a9762){return new BPromise(function(_0x58faf5,_0x24e107){return client[_0xe89e('0xd')](_0x564978,_0x8a9762)[_0xe89e('0xe')](function(_0x57de9d){logger[_0xe89e('0xf')](_0xe89e('0x10'),_0xfc5150,_0xe89e('0x11'));logger['debug'](_0xe89e('0x12'),_0xfc5150,_0xe89e('0x11'),JSON[_0xe89e('0x13')](_0x57de9d));if(_0x57de9d['error']){if(_0x57de9d['error'][_0xe89e('0x14')]===0x1f4){logger[_0xe89e('0x15')](_0xe89e('0x10'),_0xfc5150,_0x57de9d['error'][_0xe89e('0x16')]);return _0x24e107(_0x57de9d[_0xe89e('0x15')][_0xe89e('0x16')]);}logger[_0xe89e('0x15')](_0xe89e('0x10'),_0xfc5150,_0x57de9d[_0xe89e('0x15')]['message']);return _0x58faf5(_0x57de9d['error']['message']);}else{logger['info'](_0xe89e('0x10'),_0xfc5150,_0xe89e('0x11'));_0x58faf5(_0x57de9d[_0xe89e('0x17')][_0xe89e('0x16')]);}})[_0xe89e('0x18')](function(_0x37596f){logger[_0xe89e('0x15')]('ChatWebsite,\x20%s,\x20%s',_0xfc5150,_0x37596f);_0x24e107(_0x37596f);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 34b9500..cd9257f 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 _0xcfa5=['./chatWebsite.events','save','update','emit','removeListener','chatWebsite:'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xcfa5,0xc6));var _0x5cfa=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xcfa5[_0x2641f9];return _0x585741;};'use strict';var ChatWebsiteEvents=require(_0x5cfa('0x0'));var events=[_0x5cfa('0x1'),'remove',_0x5cfa('0x2')];function createListener(_0xaca869,_0x172bde){return function(_0x176b06){_0x172bde[_0x5cfa('0x3')](_0xaca869,_0x176b06);};}function removeListener(_0x3ff5e1,_0x453ff0){return function(){ChatWebsiteEvents[_0x5cfa('0x4')](_0x3ff5e1,_0x453ff0);};}exports['register']=function(_0x9f649f){for(var _0x15448c=0x0,_0x278774=events['length'];_0x15448c<_0x278774;_0x15448c++){var _0x372666=events[_0x15448c];var _0x14e777=createListener(_0x5cfa('0x5')+_0x372666,_0x9f649f);ChatWebsiteEvents['on'](_0x372666,_0x14e777);}}; \ No newline at end of file +var _0x6188=['chatWebsite:','remove','update','emit','removeListener','register','length'];(function(_0x114e69,_0x48ee4b){var _0x481772=function(_0x5b2a60){while(--_0x5b2a60){_0x114e69['push'](_0x114e69['shift']());}};_0x481772(++_0x48ee4b);}(_0x6188,0x1b3));var _0x8618=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x6188[_0x525c7b];return _0x27b33e;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=['save',_0x8618('0x0'),_0x8618('0x1')];function createListener(_0x28d4c5,_0x73b45e){return function(_0x1ff4cf){_0x73b45e[_0x8618('0x2')](_0x28d4c5,_0x1ff4cf);};}function removeListener(_0x216b6d,_0xd93a0e){return function(){ChatWebsiteEvents[_0x8618('0x3')](_0x216b6d,_0xd93a0e);};}exports[_0x8618('0x4')]=function(_0x471ec1){for(var _0xbfce31=0x0,_0xa220c3=events[_0x8618('0x5')];_0xbfce31<_0xa220c3;_0xbfce31++){var _0x1b8fa8=events[_0xbfce31];var _0x47a640=createListener(_0x8618('0x6')+_0x1b8fa8,_0x471ec1);ChatWebsiteEvents['on'](_0x1b8fa8,_0x47a640);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 7e7d53a..849e147 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 _0x2f55=['isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','addAnswer','join','root','server/files/images/logos/','format','%s-%s','now','originalname','addLogo','server/files/images/avatars/','single','addAvatar','diskStorage','file','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','ensureDir','replace','extname','/:id/offline','any','offline','addApplications','addProactiveActions','addAgents','put','destroy','delete','removeDispositions','removeAgents','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','get'];(function(_0x5fff96,_0x49b8c8){var _0x5532bc=function(_0x283752){while(--_0x283752){_0x5fff96['push'](_0x5fff96['shift']());}};_0x5532bc(++_0x49b8c8);}(_0x2f55,0x11f));var _0x52f5=function(_0x4254d5,_0x3d3ce9){_0x4254d5=_0x4254d5-0x0;var _0x858b3d=_0x2f55[_0x4254d5];return _0x858b3d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x52f5('0x0'));var timeout=require(_0x52f5('0x1'));var express=require(_0x52f5('0x2'));var router=express[_0x52f5('0x3')]();var fs_extra=require(_0x52f5('0x4'));var auth=require(_0x52f5('0x5'));var interaction=require(_0x52f5('0x6'));var config=require('../../config/environment');var controller=require(_0x52f5('0x7'));router[_0x52f5('0x8')]('/',auth[_0x52f5('0x9')](),controller[_0x52f5('0xa')]);router[_0x52f5('0x8')](_0x52f5('0xb'),auth[_0x52f5('0x9')](),controller[_0x52f5('0xc')]);router[_0x52f5('0x8')](_0x52f5('0xd'),auth[_0x52f5('0x9')](),controller[_0x52f5('0xe')]);router[_0x52f5('0x8')](_0x52f5('0xf'),auth[_0x52f5('0x9')](),controller[_0x52f5('0x10')]);router[_0x52f5('0x8')](_0x52f5('0x11'),auth[_0x52f5('0x9')](),controller[_0x52f5('0x12')]);router[_0x52f5('0x8')](_0x52f5('0x13'),controller[_0x52f5('0x14')]);router[_0x52f5('0x8')](_0x52f5('0x15'),controller['getAvatar']);router['get'](_0x52f5('0x16'),controller[_0x52f5('0x17')]);router[_0x52f5('0x8')](_0x52f5('0x18'),controller[_0x52f5('0x19')]);router[_0x52f5('0x8')](_0x52f5('0x1a'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x52f5('0x8')](_0x52f5('0x1b'),controller[_0x52f5('0x1c')]);router[_0x52f5('0x8')](_0x52f5('0x1d'),auth['isAuthenticated'](),controller[_0x52f5('0x1e')]);router['get'](_0x52f5('0x1f'),auth[_0x52f5('0x9')](),controller[_0x52f5('0x20')]);router[_0x52f5('0x8')](_0x52f5('0x21'),controller['getFields']);router[_0x52f5('0x8')](_0x52f5('0x22'),auth[_0x52f5('0x9')](),controller[_0x52f5('0x23')]);router['get'](_0x52f5('0x24'),auth[_0x52f5('0x9')](),controller[_0x52f5('0x25')]);router[_0x52f5('0x26')]('/',auth['isAuthenticated'](),controller['create']);router[_0x52f5('0x26')](_0x52f5('0xf'),auth['isAuthenticated'](),controller['addDisposition']);router['post'](_0x52f5('0x11'),auth[_0x52f5('0x9')](),controller[_0x52f5('0x27')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x48c66d,_0x2faaf7,_0x53bef1){_0x53bef1(null,path[_0x52f5('0x28')](config[_0x52f5('0x29')],_0x52f5('0x2a')));},'filename':function(_0x3aa4da,_0x4e7557,_0x2772ee){_0x2772ee(null,util[_0x52f5('0x2b')](_0x52f5('0x2c'),Date[_0x52f5('0x2d')](),_0x4e7557[_0x52f5('0x2e')]));}})});router[_0x52f5('0x26')](_0x52f5('0x13'),upload['single']('file'),controller[_0x52f5('0x2f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3db6f2,_0x55605e,_0x5e613c){_0x5e613c(null,path[_0x52f5('0x28')](config['root'],_0x52f5('0x30')));},'filename':function(_0x4f1533,_0x4fbbd0,_0x4a102a){_0x4a102a(null,util[_0x52f5('0x2b')](_0x52f5('0x2c'),Date[_0x52f5('0x2d')](),_0x4fbbd0['originalname']));}})});router[_0x52f5('0x26')](_0x52f5('0x15'),upload[_0x52f5('0x31')]('file'),controller[_0x52f5('0x32')]);var upload=multer({'storage':multer[_0x52f5('0x33')]({'destination':function(_0x58ac90,_0x294cff,_0x138901){_0x138901(null,path[_0x52f5('0x28')](config[_0x52f5('0x29')],_0x52f5('0x30')));},'filename':function(_0x3eb9f7,_0x5b7c62,_0x4c15b0){_0x4c15b0(null,util['format']('%s-%s',Date[_0x52f5('0x2d')](),_0x5b7c62[_0x52f5('0x2e')]));}})});router[_0x52f5('0x26')](_0x52f5('0x16'),upload['single'](_0x52f5('0x34')),controller[_0x52f5('0x35')]);var upload=multer({'storage':multer[_0x52f5('0x33')]({'destination':function(_0x9e78f5,_0x552b87,_0x52d0ba){_0x52d0ba(null,path[_0x52f5('0x28')](config[_0x52f5('0x29')],_0x52f5('0x30')));},'filename':function(_0x2fa4d1,_0x49af2d,_0x51ea35){_0x51ea35(null,util[_0x52f5('0x2b')](_0x52f5('0x2c'),Date[_0x52f5('0x2d')](),_0x49af2d['originalname']));}})});router[_0x52f5('0x26')](_0x52f5('0x18'),upload[_0x52f5('0x31')](_0x52f5('0x34')),controller[_0x52f5('0x36')]);router[_0x52f5('0x26')](_0x52f5('0x37'),controller[_0x52f5('0x38')]);const offlineUploadMulter=multer({'storage':multer[_0x52f5('0x33')]({'destination':function(_0x243780,_0x24da18,_0x397dad){const _0x1e90b6=path[_0x52f5('0x28')](config[_0x52f5('0x29')],_0x52f5('0x39'),_0x52f5('0x3a'),'offline-chat');fs_extra[_0x52f5('0x3b')](_0x1e90b6,function(){_0x397dad(null,_0x1e90b6);});},'filename':function(_0x3d1e33,_0x56619f,_0x334804){const _0x56981d=_0x56619f['originalname'][_0x52f5('0x3c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x3592e5=path[_0x52f5('0x3d')](_0x56981d);const _0x4fe950=Date[_0x52f5('0x2d')]()+'-'+_0x56981d[_0x52f5('0x3c')](_0x3592e5,'')+_0x3592e5;_0x334804(null,_0x4fe950);}})});router[_0x52f5('0x26')](_0x52f5('0x3e'),offlineUploadMulter[_0x52f5('0x3f')](),controller[_0x52f5('0x40')]);router[_0x52f5('0x26')](_0x52f5('0x1a'),auth[_0x52f5('0x9')](),controller['addInteraction']);router[_0x52f5('0x26')](_0x52f5('0x1d'),auth[_0x52f5('0x9')](),controller[_0x52f5('0x41')]);router[_0x52f5('0x26')](_0x52f5('0x1f'),auth[_0x52f5('0x9')](),controller[_0x52f5('0x42')]);router[_0x52f5('0x26')]('/:id/users',auth[_0x52f5('0x9')](),controller[_0x52f5('0x43')]);router[_0x52f5('0x44')](_0x52f5('0xd'),auth[_0x52f5('0x9')](),controller['update']);router['delete'](_0x52f5('0xd'),auth[_0x52f5('0x9')](),controller[_0x52f5('0x45')]);router[_0x52f5('0x46')](_0x52f5('0xf'),auth[_0x52f5('0x9')](),controller[_0x52f5('0x47')]);router[_0x52f5('0x46')]('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router[_0x52f5('0x46')](_0x52f5('0x24'),auth['isAuthenticated'](),controller[_0x52f5('0x48')]);module[_0x52f5('0x49')]=router; \ No newline at end of file +var _0x8368=['/:id/interactions','getInteractions','/:id/snippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','getOfflineMessages','/:id/users','post','create','addDisposition','addAnswer','join','root','server/files/images/logos/','%s-%s','now','originalname','single','file','addLogo','diskStorage','server/files/images/avatars/','addAvatar','addCustomerAvatar','format','addSystemAvatar','/:id/notify','notify','server/files','attachments','ensureDir','replace','offline','addInteraction','addApplications','addProactiveActions','addAgents','update','delete','/:id','removeAnswers','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','get','/describe','describe','show','/:id/dispositions','getDispositions','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar'];(function(_0x6352a6,_0xdbe9b9){var _0x2b473c=function(_0x330739){while(--_0x330739){_0x6352a6['push'](_0x6352a6['shift']());}};_0x2b473c(++_0xdbe9b9);}(_0x8368,0x186));var _0x8836=function(_0x1ec626,_0x22bba4){_0x1ec626=_0x1ec626-0x0;var _0x128ba3=_0x8368[_0x1ec626];return _0x128ba3;};'use strict';var multer=require(_0x8836('0x0'));var util=require(_0x8836('0x1'));var path=require(_0x8836('0x2'));var timeout=require(_0x8836('0x3'));var express=require(_0x8836('0x4'));var router=express[_0x8836('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8836('0x6'));var config=require(_0x8836('0x7'));var controller=require(_0x8836('0x8'));router['get']('/',auth[_0x8836('0x9')](),controller['index']);router[_0x8836('0xa')](_0x8836('0xb'),auth[_0x8836('0x9')](),controller[_0x8836('0xc')]);router[_0x8836('0xa')]('/:id',auth[_0x8836('0x9')](),controller[_0x8836('0xd')]);router[_0x8836('0xa')](_0x8836('0xe'),auth[_0x8836('0x9')](),controller[_0x8836('0xf')]);router[_0x8836('0xa')]('/:id/canned_answers',auth[_0x8836('0x9')](),controller['getAnswers']);router[_0x8836('0xa')](_0x8836('0x10'),controller[_0x8836('0x11')]);router[_0x8836('0xa')](_0x8836('0x12'),controller[_0x8836('0x13')]);router[_0x8836('0xa')](_0x8836('0x14'),controller[_0x8836('0x15')]);router[_0x8836('0xa')](_0x8836('0x16'),controller[_0x8836('0x17')]);router['get'](_0x8836('0x18'),auth[_0x8836('0x9')](),controller[_0x8836('0x19')]);router[_0x8836('0xa')](_0x8836('0x1a'),controller['getSnippet']);router[_0x8836('0xa')]('/:id/applications',auth['isAuthenticated'](),controller[_0x8836('0x1b')]);router[_0x8836('0xa')](_0x8836('0x1c'),auth[_0x8836('0x9')](),controller[_0x8836('0x1d')]);router[_0x8836('0xa')](_0x8836('0x1e'),controller[_0x8836('0x1f')]);router['get']('/:id/offline_messages',auth[_0x8836('0x9')](),controller[_0x8836('0x20')]);router['get'](_0x8836('0x21'),auth['isAuthenticated'](),controller['getAgents']);router[_0x8836('0x22')]('/',auth[_0x8836('0x9')](),controller[_0x8836('0x23')]);router[_0x8836('0x22')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x8836('0x24')]);router[_0x8836('0x22')]('/:id/canned_answers',auth[_0x8836('0x9')](),controller[_0x8836('0x25')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4807b9,_0x54852b,_0x5ee6a0){_0x5ee6a0(null,path[_0x8836('0x26')](config[_0x8836('0x27')],_0x8836('0x28')));},'filename':function(_0x3d29e8,_0xc435ec,_0x1acb0f){_0x1acb0f(null,util['format'](_0x8836('0x29'),Date[_0x8836('0x2a')](),_0xc435ec[_0x8836('0x2b')]));}})});router['post']('/:id/logo',upload[_0x8836('0x2c')](_0x8836('0x2d')),controller[_0x8836('0x2e')]);var upload=multer({'storage':multer[_0x8836('0x2f')]({'destination':function(_0x9c0ba,_0x552e8f,_0x5943a6){_0x5943a6(null,path[_0x8836('0x26')](config[_0x8836('0x27')],_0x8836('0x30')));},'filename':function(_0x47aa75,_0x11b1f0,_0xf9dd54){_0xf9dd54(null,util['format'](_0x8836('0x29'),Date[_0x8836('0x2a')](),_0x11b1f0[_0x8836('0x2b')]));}})});router[_0x8836('0x22')](_0x8836('0x12'),upload[_0x8836('0x2c')](_0x8836('0x2d')),controller[_0x8836('0x31')]);var upload=multer({'storage':multer[_0x8836('0x2f')]({'destination':function(_0x11d7c6,_0x642f13,_0x211c33){_0x211c33(null,path[_0x8836('0x26')](config[_0x8836('0x27')],_0x8836('0x30')));},'filename':function(_0x5a55c9,_0x206c9a,_0x37dc2a){_0x37dc2a(null,util['format']('%s-%s',Date[_0x8836('0x2a')](),_0x206c9a['originalname']));}})});router[_0x8836('0x22')](_0x8836('0x14'),upload['single'](_0x8836('0x2d')),controller[_0x8836('0x32')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x45f488,_0xfefdc6,_0x1aa25f){_0x1aa25f(null,path['join'](config[_0x8836('0x27')],_0x8836('0x30')));},'filename':function(_0x5034ae,_0xddce44,_0x26e064){_0x26e064(null,util[_0x8836('0x33')]('%s-%s',Date[_0x8836('0x2a')](),_0xddce44['originalname']));}})});router['post'](_0x8836('0x16'),upload['single'](_0x8836('0x2d')),controller[_0x8836('0x34')]);router[_0x8836('0x22')](_0x8836('0x35'),controller[_0x8836('0x36')]);const offlineUploadMulter=multer({'storage':multer[_0x8836('0x2f')]({'destination':function(_0x773826,_0x380111,_0x5c6184){const _0x7d9bfa=path[_0x8836('0x26')](config[_0x8836('0x27')],_0x8836('0x37'),_0x8836('0x38'),'offline-chat');fs_extra[_0x8836('0x39')](_0x7d9bfa,function(){_0x5c6184(null,_0x7d9bfa);});},'filename':function(_0x1c22ee,_0x8059fc,_0x37c0a2){const _0x348db9=_0x8059fc[_0x8836('0x2b')][_0x8836('0x3a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0xff5c97=path['extname'](_0x348db9);const _0x1dfa7e=Date[_0x8836('0x2a')]()+'-'+_0x348db9[_0x8836('0x3a')](_0xff5c97,'')+_0xff5c97;_0x37c0a2(null,_0x1dfa7e);}})});router[_0x8836('0x22')]('/:id/offline',offlineUploadMulter['any'](),controller[_0x8836('0x3b')]);router[_0x8836('0x22')](_0x8836('0x18'),auth['isAuthenticated'](),controller[_0x8836('0x3c')]);router[_0x8836('0x22')]('/:id/applications',auth[_0x8836('0x9')](),controller[_0x8836('0x3d')]);router[_0x8836('0x22')]('/:id/proactive_actions',auth[_0x8836('0x9')](),controller[_0x8836('0x3e')]);router[_0x8836('0x22')]('/:id/users',auth[_0x8836('0x9')](),controller[_0x8836('0x3f')]);router['put']('/:id',auth[_0x8836('0x9')](),controller[_0x8836('0x40')]);router[_0x8836('0x41')](_0x8836('0x42'),auth[_0x8836('0x9')](),controller['destroy']);router[_0x8836('0x41')]('/:id/dispositions',auth[_0x8836('0x9')](),controller['removeDispositions']);router[_0x8836('0x41')]('/:id/canned_answers',auth[_0x8836('0x9')](),controller[_0x8836('0x43')]);router[_0x8836('0x41')](_0x8836('0x21'),auth[_0x8836('0x9')](),controller['removeAgents']);module[_0x8836('0x44')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index a335853..bf97744 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 _0xa7fe=['Client-Side\x20logger\x20not\x20found!','expressEndpoint','use','isAuthenticated','exports','beaver-logger/server','../components/auth/service','../config/environment','app','get','client-side-logger'];(function(_0x4aa4e6,_0x278c45){var _0x322588=function(_0x19279d){while(--_0x19279d){_0x4aa4e6['push'](_0x4aa4e6['shift']());}};_0x322588(++_0x278c45);}(_0xa7fe,0x102));var _0xea7f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa7fe[_0x3dd15e];return _0x231fd0;};var beaverLogger=require(_0xea7f('0x0'));var express=require('express');var auth=require(_0xea7f('0x1'));var config=require(_0xea7f('0x2'));var router=express['Router']();var isProduction=config['env']==='production'||![];function clientSideLogs(_0x3f4c68,_0x2e3d87,_0x5bb30f){var _0xd423f7=_0x3f4c68[_0xea7f('0x3')][_0xea7f('0x4')](_0xea7f('0x5'));if(!_0xd423f7){throw new Error(_0xea7f('0x6'));}return beaverLogger[_0xea7f('0x7')]({'uri':'/client-logs','logger':_0xd423f7,'enableCors':!isProduction})(_0x3f4c68,_0x2e3d87,_0x5bb30f);}router[_0xea7f('0x8')](auth[_0xea7f('0x9')](),clientSideLogs);module[_0xea7f('0xa')]=router; \ No newline at end of file +var _0xf016=['production','get','client-side-logger','/client-logs','use','isAuthenticated','exports','express','../components/auth/service','../config/environment','Router','env'];(function(_0x2caf3a,_0x1d65d6){var _0x34f044=function(_0x31410c){while(--_0x31410c){_0x2caf3a['push'](_0x2caf3a['shift']());}};_0x34f044(++_0x1d65d6);}(_0xf016,0xdf));var _0x6f01=function(_0x36980d,_0x266c7f){_0x36980d=_0x36980d-0x0;var _0x18555d=_0xf016[_0x36980d];return _0x18555d;};var beaverLogger=require('beaver-logger/server');var express=require(_0x6f01('0x0'));var auth=require(_0x6f01('0x1'));var config=require(_0x6f01('0x2'));var router=express[_0x6f01('0x3')]();var isProduction=config[_0x6f01('0x4')]===_0x6f01('0x5')||![];function clientSideLogs(_0x4212de,_0x1aa1b1,_0xada4d2){var _0x4ce592=_0x4212de['app'][_0x6f01('0x6')](_0x6f01('0x7'));if(!_0x4ce592){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger['expressEndpoint']({'uri':_0x6f01('0x8'),'logger':_0x4ce592,'enableCors':!isProduction})(_0x4212de,_0x1aa1b1,_0xada4d2);}router[_0x6f01('0x9')](auth[_0x6f01('0xa')](),clientSideLogs);module[_0x6f01('0xb')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 5eaa0c1..0aa6b89 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 _0x7e5c=['MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365'];(function(_0x7791d5,_0xdab65f){var _0x5ce288=function(_0x2b818d){while(--_0x2b818d){_0x7791d5['push'](_0x7791d5['shift']());}};_0x5ce288(++_0xdab65f);}(_0x7e5c,0x7e));var _0xc7e5=function(_0x2e18a9,_0x2ae8c2){_0x2e18a9=_0x2e18a9-0x0;var _0x39d8d7=_0x7e5c[_0x2e18a9];return _0x39d8d7;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc7e5('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xc7e5('0x1')](_0xc7e5('0x2'),_0xc7e5('0x3'),_0xc7e5('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xc7e5('0x1')](_0xc7e5('0x5'),'Dynamics365')},'data1':{'type':Sequelize[_0xc7e5('0x0')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0xc7e5('0x0')],'comment':_0xc7e5('0x6')},'data4':{'type':Sequelize['STRING'],'comment':_0xc7e5('0x7')},'data5':{'type':Sequelize[_0xc7e5('0x8')],'comment':_0xc7e5('0x9')},'data6':{'type':Sequelize[_0xc7e5('0x8')],'comment':_0xc7e5('0xa')},'data7':{'type':Sequelize['TEXT'],'comment':_0xc7e5('0xb')}}; \ No newline at end of file +var _0xba9f=['MicrosoftAzure\x20=>\x20access_token','sequelize','exports','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT'];(function(_0x5d8f86,_0x238cd9){var _0xfece95=function(_0x196473){while(--_0x196473){_0x5d8f86['push'](_0x5d8f86['shift']());}};_0xfece95(++_0x238cd9);}(_0xba9f,0x143));var _0xfba9=function(_0x59af48,_0x54de5c){_0x59af48=_0x59af48-0x0;var _0x386bc6=_0xba9f[_0x59af48];return _0x386bc6;};'use strict';var Sequelize=require(_0xfba9('0x0'));module[_0xfba9('0x1')]={'name':{'type':Sequelize[_0xfba9('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xfba9('0x3')](_0xfba9('0x4'),_0xfba9('0x5'),_0xfba9('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xfba9('0x3')](_0xfba9('0x7'),_0xfba9('0x8'))},'data1':{'type':Sequelize[_0xfba9('0x2')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0xfba9('0x2')],'comment':_0xfba9('0x9')},'data3':{'type':Sequelize[_0xfba9('0x2')],'comment':_0xfba9('0xa')},'data4':{'type':Sequelize[_0xfba9('0x2')],'comment':_0xfba9('0xb')},'data5':{'type':Sequelize[_0xfba9('0xc')],'comment':_0xfba9('0xd')},'data6':{'type':Sequelize[_0xfba9('0xc')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 0bb2a45..189e0a7 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 _0x4e89=['generateMicrosoftAuthorizationUrl','user','error','get','state','Invalid\x20state\x20parameter','from','base64','toString','ascii','parse','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','code','data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update','then','destroy','stack','name','send','slice','map','CloudProvider','fieldName','type','key','model','keys','query','filters','intersection','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','service','MicrosoftAzure','decryptString','data3','show','params','rawAttributes','fields','length','include','find','catch','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','create','findOne'];(function(_0x542503,_0x3074d1){var _0x3b1d94=function(_0x1cbbe9){while(--_0x1cbbe9){_0x542503['push'](_0x542503['shift']());}};_0x3b1d94(++_0x3074d1);}(_0x4e89,0x81));var _0x94e8=function(_0x28b07c,_0x162ebe){_0x28b07c=_0x28b07c-0x0;var _0x25eda7=_0x4e89[_0x28b07c];return _0x25eda7;};'use strict';var _=require('lodash');var Redis=require(_0x94e8('0x0'));var qs=require(_0x94e8('0x1'));var encryptor=require(_0x94e8('0x2'));var config=require(_0x94e8('0x3'));var logger=require(_0x94e8('0x4'))(_0x94e8('0x5'));var db=require('../../mysqldb')['db'];var oauth=require(_0x94e8('0x6'));config[_0x94e8('0x7')]=_[_0x94e8('0x8')](config[_0x94e8('0x7')],{'host':_0x94e8('0x9'),'port':0x18eb});var socket=require(_0x94e8('0xa'))(new Redis(config[_0x94e8('0x7')]));var redis=new Redis(config[_0x94e8('0x7')]);function respondWithStatusCode(_0x40359e,_0x5e92f5){_0x5e92f5=_0x5e92f5||0xcc;return function(_0xf1bdc0){if(_0xf1bdc0){return _0x40359e[_0x94e8('0xb')](_0x5e92f5);}return _0x40359e[_0x94e8('0xc')](_0x5e92f5)[_0x94e8('0xd')]();};}function respondWithResult(_0x1a5743,_0x863cc){_0x863cc=_0x863cc||0xc8;return function(_0x2a3a5d){if(_0x2a3a5d){return _0x1a5743[_0x94e8('0xc')](_0x863cc)[_0x94e8('0xe')](_0x2a3a5d);}};}function respondWithFilteredResult(_0x87a5a8,_0x47653a){return function(_0x42e25f){if(_0x42e25f){var _0x517a1a=typeof _0x47653a[_0x94e8('0xf')]==='undefined'&&typeof _0x47653a[_0x94e8('0x10')]===_0x94e8('0x11');var _0x511bff=_0x42e25f[_0x94e8('0x12')];var _0x24a63d=_0x517a1a?0x0:_0x47653a[_0x94e8('0xf')];var _0x2941c6=_0x517a1a?_0x42e25f[_0x94e8('0x12')]:_0x47653a[_0x94e8('0xf')]+_0x47653a['limit'];var _0x15ba6a;if(_0x2941c6>=_0x511bff){_0x2941c6=_0x511bff;_0x15ba6a=0xc8;}else{_0x15ba6a=0xce;}_0x87a5a8[_0x94e8('0xc')](_0x15ba6a);return _0x87a5a8[_0x94e8('0x13')](_0x94e8('0x14'),_0x24a63d+'-'+_0x2941c6+'/'+_0x511bff)['json'](_0x42e25f);}return null;};}function saveUpdates(_0x566e1f){return function(_0x321698){if(_0x321698){return _0x321698[_0x94e8('0x15')](_0x566e1f)[_0x94e8('0x16')](function(_0x53e11c){return _0x53e11c;});}return null;};}function removeEntity(_0x27ccdd){return function(_0x838ca1){if(_0x838ca1){return _0x838ca1[_0x94e8('0x17')]()[_0x94e8('0x16')](function(){_0x27ccdd[_0x94e8('0xc')](0xcc)[_0x94e8('0xd')]();});}};}function handleEntityNotFound(_0x18077b){return function(_0x434517){if(!_0x434517){_0x18077b[_0x94e8('0xb')](0x194);}return _0x434517;};}function handleError(_0x20d86e,_0x25f928){_0x25f928=_0x25f928||0x1f4;return function(_0x3c2230){logger['error'](_0x3c2230[_0x94e8('0x18')]);if(_0x3c2230['name']){delete _0x3c2230[_0x94e8('0x19')];}_0x20d86e['status'](_0x25f928)[_0x94e8('0x1a')](_0x3c2230);};}function maskClientSecret(_0x35b4d2){return _['padEnd'](_0x35b4d2[_0x94e8('0x1b')](0x0,0x3),0x14,'*');}exports['index']=function(_0x58bceb,_0x3e3ce3){var _0x2fec76={},_0x4665b3={},_0x2c614f={'count':0x0,'rows':[]};var _0x1be93d=_[_0x94e8('0x1c')](db[_0x94e8('0x1d')]['rawAttributes'],function(_0x9ba625){return{'name':_0x9ba625[_0x94e8('0x1e')],'type':_0x9ba625[_0x94e8('0x1f')][_0x94e8('0x20')]};});_0x4665b3[_0x94e8('0x21')]=_[_0x94e8('0x1c')](_0x1be93d,_0x94e8('0x19'));_0x4665b3['query']=_[_0x94e8('0x22')](_0x58bceb[_0x94e8('0x23')]);_0x4665b3[_0x94e8('0x24')]=_[_0x94e8('0x25')](_0x4665b3[_0x94e8('0x21')],_0x4665b3[_0x94e8('0x23')]);_0x2fec76[_0x94e8('0x26')]=_[_0x94e8('0x25')](_0x4665b3[_0x94e8('0x21')],qs['fields'](_0x58bceb[_0x94e8('0x23')]['fields']));_0x2fec76[_0x94e8('0x26')]=_0x2fec76[_0x94e8('0x26')]['length']?_0x2fec76[_0x94e8('0x26')]:_0x4665b3['model'];if(!_0x58bceb[_0x94e8('0x23')][_0x94e8('0x27')](_0x94e8('0x28'))){_0x2fec76[_0x94e8('0x10')]=qs[_0x94e8('0x10')](_0x58bceb[_0x94e8('0x23')][_0x94e8('0x10')]);_0x2fec76[_0x94e8('0xf')]=qs[_0x94e8('0xf')](_0x58bceb['query']['offset']);}_0x2fec76['order']=qs[_0x94e8('0x29')](_0x58bceb[_0x94e8('0x23')][_0x94e8('0x29')]);_0x2fec76[_0x94e8('0x2a')]=qs['filters'](_[_0x94e8('0x2b')](_0x58bceb['query'],_0x4665b3[_0x94e8('0x24')]),_0x1be93d);if(_0x58bceb['query'][_0x94e8('0x2c')]){_0x2fec76['where']=_[_0x94e8('0x2d')](_0x2fec76[_0x94e8('0x2a')],{'$or':_[_0x94e8('0x1c')](_0x1be93d,function(_0x38c719){if(_0x38c719[_0x94e8('0x1f')]!==_0x94e8('0x2e')){var _0x1d724f={};_0x1d724f[_0x38c719[_0x94e8('0x19')]]={'$like':'%'+_0x58bceb['query']['filter']+'%'};return _0x1d724f;}})});}_0x2fec76=_['merge']({},_0x2fec76,_0x58bceb[_0x94e8('0x2f')]);var _0x42cbf4={'where':_0x2fec76[_0x94e8('0x2a')]};return db['CloudProvider'][_0x94e8('0x12')](_0x42cbf4)[_0x94e8('0x16')](function(_0x1e31db){_0x2c614f[_0x94e8('0x12')]=_0x1e31db;if(_0x58bceb[_0x94e8('0x23')]['includeAll']){_0x2fec76['include']=[{'all':!![]}];}return db[_0x94e8('0x1d')][_0x94e8('0x30')](_0x2fec76);})[_0x94e8('0x16')](function(_0x21bd6c){_0x2c614f['rows']=_[_0x94e8('0x1c')](_0x21bd6c,function(_0x452dbf){if(_0x452dbf[_0x94e8('0x31')]===_0x94e8('0x32')){var _0x2e95f9=encryptor[_0x94e8('0x33')](_0x452dbf[_0x94e8('0x34')]);_0x452dbf[_0x94e8('0x34')]=maskClientSecret(_0x2e95f9);}return _0x452dbf;});return _0x2c614f;})['then'](respondWithFilteredResult(_0x3e3ce3,_0x2fec76))['catch'](handleError(_0x3e3ce3,null));};exports[_0x94e8('0x35')]=function(_0x28c8ca,_0x44b5f5){var _0x107fe7={'raw':!![],'where':{'id':_0x28c8ca[_0x94e8('0x36')]['id']}},_0x371426={};_0x371426[_0x94e8('0x21')]=_[_0x94e8('0x22')](db[_0x94e8('0x1d')][_0x94e8('0x37')]);_0x371426['query']=_[_0x94e8('0x22')](_0x28c8ca['query']);_0x371426[_0x94e8('0x24')]=_[_0x94e8('0x25')](_0x371426[_0x94e8('0x21')],_0x371426[_0x94e8('0x23')]);_0x107fe7['attributes']=_[_0x94e8('0x25')](_0x371426[_0x94e8('0x21')],qs['fields'](_0x28c8ca[_0x94e8('0x23')][_0x94e8('0x38')]));_0x107fe7[_0x94e8('0x26')]=_0x107fe7[_0x94e8('0x26')][_0x94e8('0x39')]?_0x107fe7[_0x94e8('0x26')]:_0x371426['model'];if(_0x28c8ca['query']['includeAll']){_0x107fe7[_0x94e8('0x3a')]=[{'all':!![]}];}_0x107fe7=_['merge']({},_0x107fe7,_0x28c8ca[_0x94e8('0x2f')]);return db['CloudProvider'][_0x94e8('0x3b')](_0x107fe7)[_0x94e8('0x16')](handleEntityNotFound(_0x44b5f5,null))['then'](function(_0x11e514){if(_0x11e514[_0x94e8('0x31')]===_0x94e8('0x32')){var _0x295821=encryptor[_0x94e8('0x33')](_0x11e514['data3']);_0x11e514['data3']=maskClientSecret(_0x295821);}return _0x11e514;})[_0x94e8('0x16')](respondWithResult(_0x44b5f5,null))[_0x94e8('0x3c')](handleError(_0x44b5f5,null));};exports['create']=function(_0x409d6b,_0xc0d208){if(!_0x409d6b[_0x94e8('0x3d')]['name'])throw new Error(_0x94e8('0x3e'));if(!_0x409d6b[_0x94e8('0x3d')][_0x94e8('0x31')])throw new Error(_0x94e8('0x3f'));var _0x55de39=db['CloudProvider']['rawAttributes'][_0x94e8('0x31')][_0x94e8('0x40')];if(!_0x55de39[_0x94e8('0x41')](_0x409d6b['body']['service']))throw new Error(_0x94e8('0x42')+_0x55de39[_0x94e8('0x43')](',\x20'));if(_0x409d6b[_0x94e8('0x3d')][_0x94e8('0x31')]===_0x94e8('0x32')&&_0x409d6b[_0x94e8('0x3d')][_0x94e8('0x34')]){_0x409d6b[_0x94e8('0x3d')]['data3']=encryptor[_0x94e8('0x44')](_0x409d6b[_0x94e8('0x3d')][_0x94e8('0x34')]);}return db[_0x94e8('0x1d')][_0x94e8('0x45')](_0x409d6b[_0x94e8('0x3d')],{})[_0x94e8('0x16')](respondWithResult(_0xc0d208,0xc9))[_0x94e8('0x3c')](handleError(_0xc0d208,null));};exports[_0x94e8('0x15')]=function(_0x10df82,_0x42f57d){if(_0x10df82[_0x94e8('0x3d')]['id']){delete _0x10df82[_0x94e8('0x3d')]['id'];}return db[_0x94e8('0x1d')]['find']({'where':{'id':_0x10df82[_0x94e8('0x36')]['id']}})[_0x94e8('0x16')](handleEntityNotFound(_0x42f57d,null))[_0x94e8('0x16')](function(_0x5668a8){if(_0x5668a8['service']===_0x94e8('0x32')&&_0x10df82[_0x94e8('0x3d')][_0x94e8('0x34')]){_0x10df82[_0x94e8('0x3d')][_0x94e8('0x34')]=encryptor['encryptString'](_0x10df82['body']['data3']);}return _0x5668a8;})[_0x94e8('0x16')](saveUpdates(_0x10df82[_0x94e8('0x3d')],null))[_0x94e8('0x16')](respondWithResult(_0x42f57d,null))['catch'](handleError(_0x42f57d,null));};exports[_0x94e8('0x17')]=function(_0x1919ce,_0x4fe895){return db[_0x94e8('0x1d')][_0x94e8('0x3b')]({'where':{'id':_0x1919ce[_0x94e8('0x36')]['id']}})[_0x94e8('0x16')](handleEntityNotFound(_0x4fe895,null))[_0x94e8('0x16')](removeEntity(_0x4fe895,null))[_0x94e8('0x3c')](handleError(_0x4fe895,null));};exports['oauth2MicrosoftAuthorize']=function(_0x213732,_0x30f319){return db[_0x94e8('0x1d')][_0x94e8('0x46')]({'where':{'id':_0x213732[_0x94e8('0x36')]['id']},'raw':!![]})[_0x94e8('0x16')](function(_0x16d987){if(!_0x16d987)return _0x30f319['sendStatus'](0x194);return{'url':oauth[_0x94e8('0x47')](_0x16d987,_0x213732[_0x94e8('0x48')]['id'])};})[_0x94e8('0x16')](respondWithResult(_0x30f319,null))[_0x94e8('0x3c')](handleError(_0x30f319,null));};exports['oauth2MicrosoftCallback']=function(_0x3fba08,_0x19145e){var _0x47da11=_0x3fba08[_0x94e8('0x3d')];var _0x50542d;var _0x149c71;if(_0x47da11[_0x94e8('0x49')])throw _0x47da11;redis[_0x94e8('0x4a')](_0x47da11[_0x94e8('0x4b')])[_0x94e8('0x16')](function(_0x508592){if(!_0x508592)throw new Error(_0x94e8('0x4c'));_0x50542d=JSON['parse'](_0x508592);var _0x59b8aa=Buffer[_0x94e8('0x4d')](_0x47da11[_0x94e8('0x4b')],_0x94e8('0x4e'))[_0x94e8('0x4f')](_0x94e8('0x50'));_0x149c71=JSON[_0x94e8('0x51')](_0x59b8aa);if(!oauth[_0x94e8('0x52')](_0x47da11[_0x94e8('0x53')],_0x50542d[_0x94e8('0x54')]))throw new Error(_0x94e8('0x55'));redis[_0x94e8('0x56')](_0x47da11['state']);return oauth['getOauth2MicrosoftAccessToken'](_0x47da11[_0x94e8('0x57')],_0x50542d);})['then'](function(_0x9658a8){_0x50542d[_0x94e8('0x58')]=_0x9658a8[_0x94e8('0x59')];_0x50542d[_0x94e8('0x5a')]=_0x9658a8[_0x94e8('0x5b')];return db[_0x94e8('0x1d')][_0x94e8('0x15')]({'data5':_0x50542d['data5'],'data6':_0x50542d[_0x94e8('0x5a')]},{'where':{'id':_0x50542d['id']}});})[_0x94e8('0x16')](function(){oauth[_0x94e8('0x5c')](_0x50542d);socket[_0x94e8('0x5d')](_0x94e8('0x5e'),{'id':_0x149c71['id']});return;})[_0x94e8('0x16')](respondWithStatusCode(_0x19145e,null))[_0x94e8('0x3c')](function(_0x2a2b90){if(_0x149c71){socket[_0x94e8('0x5d')](_0x94e8('0x5f'),{'id':_0x149c71['id']});}if(!_0x50542d){logger[_0x94e8('0x49')](_0x94e8('0x60'),_0x2a2b90);return _0x19145e[_0x94e8('0xc')](0x1f4)[_0x94e8('0x1a')](_0x2a2b90[_0x94e8('0x61')]);}logger[_0x94e8('0x49')](_0x94e8('0x62'),_0x50542d['id'],JSON[_0x94e8('0x63')](_0x2a2b90));});}; \ No newline at end of file +var _0x7586=['Invalid\x20state\x20parameter','from','state','base64','toString','isValidIdToken','oauth2Claims','Unable\x20to\x20validate\x20id_token','getOauth2MicrosoftAccessToken','code','data5','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','stringify','lodash','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','./cloudProvider.oauth','defaults','redis','localhost','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','then','name','send','padEnd','slice','index','map','CloudProvider','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','service','decryptString','data3','catch','params','find','MicrosoftAzure','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','update','destroy','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','error','get'];(function(_0x5b3c61,_0x3eb2aa){var _0x153389=function(_0x2a1a99){while(--_0x2a1a99){_0x5b3c61['push'](_0x5b3c61['shift']());}};_0x153389(++_0x3eb2aa);}(_0x7586,0xcc));var _0x6758=function(_0x5168e3,_0x4b9c51){_0x5168e3=_0x5168e3-0x0;var _0x3112c3=_0x7586[_0x5168e3];return _0x3112c3;};'use strict';var _=require(_0x6758('0x0'));var Redis=require('ioredis');var qs=require(_0x6758('0x1'));var encryptor=require(_0x6758('0x2'));var config=require(_0x6758('0x3'));var logger=require(_0x6758('0x4'))('api');var db=require('../../mysqldb')['db'];var oauth=require(_0x6758('0x5'));config['redis']=_[_0x6758('0x6')](config[_0x6758('0x7')],{'host':_0x6758('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6758('0x7')]));var redis=new Redis(config[_0x6758('0x7')]);function respondWithStatusCode(_0x2f9c03,_0x20e32b){_0x20e32b=_0x20e32b||0xcc;return function(_0xe9817c){if(_0xe9817c){return _0x2f9c03[_0x6758('0x9')](_0x20e32b);}return _0x2f9c03[_0x6758('0xa')](_0x20e32b)[_0x6758('0xb')]();};}function respondWithResult(_0x454b04,_0x261774){_0x261774=_0x261774||0xc8;return function(_0x577929){if(_0x577929){return _0x454b04['status'](_0x261774)[_0x6758('0xc')](_0x577929);}};}function respondWithFilteredResult(_0x7c5652,_0x13a6f7){return function(_0xdc858b){if(_0xdc858b){var _0x260583=typeof _0x13a6f7[_0x6758('0xd')]===_0x6758('0xe')&&typeof _0x13a6f7[_0x6758('0xf')]==='undefined';var _0x21a6f0=_0xdc858b[_0x6758('0x10')];var _0x196b66=_0x260583?0x0:_0x13a6f7[_0x6758('0xd')];var _0x5c0fcf=_0x260583?_0xdc858b[_0x6758('0x10')]:_0x13a6f7[_0x6758('0xd')]+_0x13a6f7[_0x6758('0xf')];var _0x8c885c;if(_0x5c0fcf>=_0x21a6f0){_0x5c0fcf=_0x21a6f0;_0x8c885c=0xc8;}else{_0x8c885c=0xce;}_0x7c5652[_0x6758('0xa')](_0x8c885c);return _0x7c5652['set'](_0x6758('0x11'),_0x196b66+'-'+_0x5c0fcf+'/'+_0x21a6f0)[_0x6758('0xc')](_0xdc858b);}return null;};}function saveUpdates(_0x34f05e){return function(_0xd1b264){if(_0xd1b264){return _0xd1b264['update'](_0x34f05e)[_0x6758('0x12')](function(_0x51f2b3){return _0x51f2b3;});}return null;};}function removeEntity(_0x374534){return function(_0x4d329b){if(_0x4d329b){return _0x4d329b['destroy']()['then'](function(){_0x374534['status'](0xcc)[_0x6758('0xb')]();});}};}function handleEntityNotFound(_0x4035c3){return function(_0x2e9308){if(!_0x2e9308){_0x4035c3['sendStatus'](0x194);}return _0x2e9308;};}function handleError(_0x236c25,_0x218a89){_0x218a89=_0x218a89||0x1f4;return function(_0x3dcfe8){logger['error'](_0x3dcfe8['stack']);if(_0x3dcfe8['name']){delete _0x3dcfe8[_0x6758('0x13')];}_0x236c25[_0x6758('0xa')](_0x218a89)[_0x6758('0x14')](_0x3dcfe8);};}function maskClientSecret(_0xb1bc03){return _[_0x6758('0x15')](_0xb1bc03[_0x6758('0x16')](0x0,0x3),0x14,'*');}exports[_0x6758('0x17')]=function(_0x962d0c,_0x1e9d70){var _0x2134e7={},_0x215983={},_0x31cad2={'count':0x0,'rows':[]};var _0x4ec5b4=_[_0x6758('0x18')](db[_0x6758('0x19')][_0x6758('0x1a')],function(_0x41bc7d){return{'name':_0x41bc7d['fieldName'],'type':_0x41bc7d[_0x6758('0x1b')]['key']};});_0x215983[_0x6758('0x1c')]=_[_0x6758('0x18')](_0x4ec5b4,_0x6758('0x13'));_0x215983[_0x6758('0x1d')]=_[_0x6758('0x1e')](_0x962d0c['query']);_0x215983[_0x6758('0x1f')]=_[_0x6758('0x20')](_0x215983['model'],_0x215983[_0x6758('0x1d')]);_0x2134e7['attributes']=_[_0x6758('0x20')](_0x215983[_0x6758('0x1c')],qs[_0x6758('0x21')](_0x962d0c[_0x6758('0x1d')]['fields']));_0x2134e7[_0x6758('0x22')]=_0x2134e7[_0x6758('0x22')][_0x6758('0x23')]?_0x2134e7['attributes']:_0x215983[_0x6758('0x1c')];if(!_0x962d0c[_0x6758('0x1d')][_0x6758('0x24')](_0x6758('0x25'))){_0x2134e7[_0x6758('0xf')]=qs[_0x6758('0xf')](_0x962d0c[_0x6758('0x1d')][_0x6758('0xf')]);_0x2134e7[_0x6758('0xd')]=qs[_0x6758('0xd')](_0x962d0c['query']['offset']);}_0x2134e7[_0x6758('0x26')]=qs[_0x6758('0x27')](_0x962d0c[_0x6758('0x1d')][_0x6758('0x27')]);_0x2134e7[_0x6758('0x28')]=qs['filters'](_[_0x6758('0x29')](_0x962d0c['query'],_0x215983['filters']),_0x4ec5b4);if(_0x962d0c[_0x6758('0x1d')][_0x6758('0x2a')]){_0x2134e7['where']=_['merge'](_0x2134e7[_0x6758('0x28')],{'$or':_[_0x6758('0x18')](_0x4ec5b4,function(_0x26e07a){if(_0x26e07a[_0x6758('0x1b')]!==_0x6758('0x2b')){var _0x49327a={};_0x49327a[_0x26e07a[_0x6758('0x13')]]={'$like':'%'+_0x962d0c[_0x6758('0x1d')][_0x6758('0x2a')]+'%'};return _0x49327a;}})});}_0x2134e7=_[_0x6758('0x2c')]({},_0x2134e7,_0x962d0c[_0x6758('0x2d')]);var _0x9270cf={'where':_0x2134e7['where']};return db[_0x6758('0x19')][_0x6758('0x10')](_0x9270cf)[_0x6758('0x12')](function(_0x14fd97){_0x31cad2[_0x6758('0x10')]=_0x14fd97;if(_0x962d0c[_0x6758('0x1d')]['includeAll']){_0x2134e7[_0x6758('0x2e')]=[{'all':!![]}];}return db[_0x6758('0x19')][_0x6758('0x2f')](_0x2134e7);})[_0x6758('0x12')](function(_0x547863){_0x31cad2[_0x6758('0x30')]=_[_0x6758('0x18')](_0x547863,function(_0x47207c){if(_0x47207c[_0x6758('0x31')]==='MicrosoftAzure'){var _0x2ec7b9=encryptor[_0x6758('0x32')](_0x47207c[_0x6758('0x33')]);_0x47207c[_0x6758('0x33')]=maskClientSecret(_0x2ec7b9);}return _0x47207c;});return _0x31cad2;})[_0x6758('0x12')](respondWithFilteredResult(_0x1e9d70,_0x2134e7))[_0x6758('0x34')](handleError(_0x1e9d70,null));};exports['show']=function(_0x57eb7d,_0x368eb7){var _0x4499de={'raw':!![],'where':{'id':_0x57eb7d[_0x6758('0x35')]['id']}},_0x405ca5={};_0x405ca5['model']=_[_0x6758('0x1e')](db['CloudProvider'][_0x6758('0x1a')]);_0x405ca5[_0x6758('0x1d')]=_[_0x6758('0x1e')](_0x57eb7d[_0x6758('0x1d')]);_0x405ca5[_0x6758('0x1f')]=_[_0x6758('0x20')](_0x405ca5[_0x6758('0x1c')],_0x405ca5['query']);_0x4499de['attributes']=_[_0x6758('0x20')](_0x405ca5[_0x6758('0x1c')],qs[_0x6758('0x21')](_0x57eb7d[_0x6758('0x1d')]['fields']));_0x4499de[_0x6758('0x22')]=_0x4499de[_0x6758('0x22')]['length']?_0x4499de['attributes']:_0x405ca5[_0x6758('0x1c')];if(_0x57eb7d[_0x6758('0x1d')]['includeAll']){_0x4499de['include']=[{'all':!![]}];}_0x4499de=_['merge']({},_0x4499de,_0x57eb7d['options']);return db[_0x6758('0x19')][_0x6758('0x36')](_0x4499de)[_0x6758('0x12')](handleEntityNotFound(_0x368eb7,null))[_0x6758('0x12')](function(_0x2afbd4){if(_0x2afbd4[_0x6758('0x31')]===_0x6758('0x37')){var _0x46cc7a=encryptor[_0x6758('0x32')](_0x2afbd4[_0x6758('0x33')]);_0x2afbd4['data3']=maskClientSecret(_0x46cc7a);}return _0x2afbd4;})['then'](respondWithResult(_0x368eb7,null))['catch'](handleError(_0x368eb7,null));};exports[_0x6758('0x38')]=function(_0x1a5760,_0x4dea1f){if(!_0x1a5760[_0x6758('0x39')][_0x6758('0x13')])throw new Error(_0x6758('0x3a'));if(!_0x1a5760[_0x6758('0x39')][_0x6758('0x31')])throw new Error(_0x6758('0x3b'));var _0x41c0d6=db[_0x6758('0x19')][_0x6758('0x1a')]['service']['values'];if(!_0x41c0d6[_0x6758('0x3c')](_0x1a5760[_0x6758('0x39')][_0x6758('0x31')]))throw new Error(_0x6758('0x3d')+_0x41c0d6[_0x6758('0x3e')](',\x20'));if(_0x1a5760['body'][_0x6758('0x31')]==='MicrosoftAzure'&&_0x1a5760[_0x6758('0x39')]['data3']){_0x1a5760[_0x6758('0x39')]['data3']=encryptor['encryptString'](_0x1a5760[_0x6758('0x39')]['data3']);}return db[_0x6758('0x19')][_0x6758('0x38')](_0x1a5760['body'],{})[_0x6758('0x12')](respondWithResult(_0x4dea1f,0xc9))[_0x6758('0x34')](handleError(_0x4dea1f,null));};exports[_0x6758('0x3f')]=function(_0x252937,_0x3b5850){if(_0x252937[_0x6758('0x39')]['id']){delete _0x252937[_0x6758('0x39')]['id'];}return db['CloudProvider']['find']({'where':{'id':_0x252937[_0x6758('0x35')]['id']}})[_0x6758('0x12')](handleEntityNotFound(_0x3b5850,null))['then'](function(_0x4cdd76){if(_0x4cdd76[_0x6758('0x31')]===_0x6758('0x37')&&_0x252937[_0x6758('0x39')][_0x6758('0x33')]){_0x252937[_0x6758('0x39')][_0x6758('0x33')]=encryptor['encryptString'](_0x252937[_0x6758('0x39')]['data3']);}return _0x4cdd76;})[_0x6758('0x12')](saveUpdates(_0x252937['body'],null))['then'](respondWithResult(_0x3b5850,null))[_0x6758('0x34')](handleError(_0x3b5850,null));};exports[_0x6758('0x40')]=function(_0x41ac59,_0x1c66bc){return db['CloudProvider'][_0x6758('0x36')]({'where':{'id':_0x41ac59[_0x6758('0x35')]['id']}})['then'](handleEntityNotFound(_0x1c66bc,null))[_0x6758('0x12')](removeEntity(_0x1c66bc,null))[_0x6758('0x34')](handleError(_0x1c66bc,null));};exports[_0x6758('0x41')]=function(_0x25fbc6,_0x548ec6){return db[_0x6758('0x19')][_0x6758('0x42')]({'where':{'id':_0x25fbc6[_0x6758('0x35')]['id']},'raw':!![]})[_0x6758('0x12')](function(_0x3f3bac){if(!_0x3f3bac)return _0x548ec6[_0x6758('0x9')](0x194);return{'url':oauth[_0x6758('0x43')](_0x3f3bac,_0x25fbc6[_0x6758('0x44')]['id'])};})['then'](respondWithResult(_0x548ec6,null))[_0x6758('0x34')](handleError(_0x548ec6,null));};exports[_0x6758('0x45')]=function(_0x4dbece,_0xd9dbfd){var _0x560e16=_0x4dbece[_0x6758('0x39')];var _0x14c2f3;var _0x6a412e;if(_0x560e16[_0x6758('0x46')])throw _0x560e16;redis[_0x6758('0x47')](_0x560e16['state'])[_0x6758('0x12')](function(_0x1f451c){if(!_0x1f451c)throw new Error(_0x6758('0x48'));_0x14c2f3=JSON['parse'](_0x1f451c);var _0x3c6885=Buffer[_0x6758('0x49')](_0x560e16[_0x6758('0x4a')],_0x6758('0x4b'))[_0x6758('0x4c')]('ascii');_0x6a412e=JSON['parse'](_0x3c6885);if(!oauth[_0x6758('0x4d')](_0x560e16['id_token'],_0x14c2f3[_0x6758('0x4e')]))throw new Error(_0x6758('0x4f'));redis['del'](_0x560e16[_0x6758('0x4a')]);return oauth[_0x6758('0x50')](_0x560e16[_0x6758('0x51')],_0x14c2f3);})[_0x6758('0x12')](function(_0x29f9bc){_0x14c2f3[_0x6758('0x52')]=_0x29f9bc['access_token'];_0x14c2f3[_0x6758('0x53')]=_0x29f9bc[_0x6758('0x54')];return db[_0x6758('0x19')][_0x6758('0x3f')]({'data5':_0x14c2f3[_0x6758('0x52')],'data6':_0x14c2f3[_0x6758('0x53')]},{'where':{'id':_0x14c2f3['id']}});})[_0x6758('0x12')](function(){oauth[_0x6758('0x55')](_0x14c2f3);socket[_0x6758('0x56')](_0x6758('0x57'),{'id':_0x6a412e['id']});return;})['then'](respondWithStatusCode(_0xd9dbfd,null))[_0x6758('0x34')](function(_0x13d5e6){if(_0x6a412e){socket[_0x6758('0x56')](_0x6758('0x58'),{'id':_0x6a412e['id']});}if(!_0x14c2f3){logger[_0x6758('0x46')](_0x6758('0x59'),_0x13d5e6);return _0xd9dbfd[_0x6758('0xa')](0x1f4)['send'](_0x13d5e6[_0x6758('0x5a')]);}logger[_0x6758('0x46')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x14c2f3['id'],JSON[_0x6758('0x5b')](_0x13d5e6));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 55ff2f3..84f2a3a 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 _0xe93a=['rimraf','../../config/environment','./cloudProvider.attributes','define','cloud_providers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5aebca,_0x47182f){var _0xe24952=function(_0x10a551){while(--_0x10a551){_0x5aebca['push'](_0x5aebca['shift']());}};_0xe24952(++_0x47182f);}(_0xe93a,0x1bf));var _0xae93=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xe93a[_0x1beef3];return _0x5af964;};'use strict';var _=require(_0xae93('0x0'));var util=require(_0xae93('0x1'));var logger=require(_0xae93('0x2'))(_0xae93('0x3'));var moment=require(_0xae93('0x4'));var BPromise=require(_0xae93('0x5'));var rp=require(_0xae93('0x6'));var fs=require('fs');var path=require(_0xae93('0x7'));var rimraf=require(_0xae93('0x8'));var config=require(_0xae93('0x9'));var attributes=require(_0xae93('0xa'));module['exports']=function(_0x3da3fa,_0x140903){return _0x3da3fa[_0xae93('0xb')]('CloudProvider',attributes,{'tableName':_0xae93('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x62ab=['exports','define','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cloudProvider.attributes'];(function(_0x3d38ae,_0x51102b){var _0x3757ee=function(_0x22bac8){while(--_0x22bac8){_0x3d38ae['push'](_0x3d38ae['shift']());}};_0x3757ee(++_0x51102b);}(_0x62ab,0xd6));var _0xb62a=function(_0x2c8ab8,_0xb3663e){_0x2c8ab8=_0x2c8ab8-0x0;var _0x1bcbe3=_0x62ab[_0x2c8ab8];return _0x1bcbe3;};'use strict';var _=require(_0xb62a('0x0'));var util=require(_0xb62a('0x1'));var logger=require(_0xb62a('0x2'))(_0xb62a('0x3'));var moment=require(_0xb62a('0x4'));var BPromise=require(_0xb62a('0x5'));var rp=require(_0xb62a('0x6'));var fs=require('fs');var path=require(_0xb62a('0x7'));var rimraf=require(_0xb62a('0x8'));var config=require('../../config/environment');var attributes=require(_0xb62a('0x9'));module[_0xb62a('0xa')]=function(_0x48d711,_0x61ed74){return _0x48d711[_0xb62a('0xb')](_0xb62a('0xc'),attributes,{'tableName':_0xb62a('0xd'),'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 b277adb..489848f 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 _0x6eed=['access_token','data6','update','data5','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','bind','findAll','exports','lodash','crypto','jsonwebtoken','request-promise','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','/authorize','/token','map','type','push','data7','/.default','join','Dynamics365','replace','data2','from','stringify','base64','hex','client_id','data1','response_type','response_mode','form_post','scope','prompt','login','key','value','oauth2Claims','oauth2/','set','payload','iss','issuer','aud','audience','nonce','isAfter','unix','exp','then','data3','CloudProvider','findOne','refresh_token','decryptString','POST','{TENANT_ID}'];(function(_0x5d7cc3,_0x4e5550){var _0xf00bb0=function(_0x4ac4ab){while(--_0x4ac4ab){_0x5d7cc3['push'](_0x5d7cc3['shift']());}};_0xf00bb0(++_0x4e5550);}(_0x6eed,0x17e));var _0xd6ee=function(_0x3fbca8,_0x2e2902){_0x3fbca8=_0x3fbca8-0x0;var _0x47e565=_0x6eed[_0x3fbca8];return _0x47e565;};'use strict';var _=require(_0xd6ee('0x0'));var crypto=require(_0xd6ee('0x1'));var jwt=require(_0xd6ee('0x2'));var moment=require('moment');var Redis=require('ioredis');var rp=require(_0xd6ee('0x3'));var util=require('util');var encryptor=require('../../components/encryptor');var config=require(_0xd6ee('0x4'));var logger=require(_0xd6ee('0x5'))(_0xd6ee('0x6'));var schedule=require(_0xd6ee('0x7'));var db=require(_0xd6ee('0x8'))['db'];config[_0xd6ee('0x9')]=_['defaults'](config['redis'],{'host':_0xd6ee('0xa'),'port':0x18eb});var redis=new Redis(config[_0xd6ee('0x9')]);var MICROSOFT_AUTH_URL=_0xd6ee('0xb');var AZURE_AUTH_SCOPES={'Outlook365':[_0xd6ee('0xc'),_0xd6ee('0xd'),'email',_0xd6ee('0xe'),_0xd6ee('0xf'),_0xd6ee('0x10'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0xd6ee('0xc'),_0xd6ee('0xe')]};var MICROSOFT_AUTH_ENDPOINT=_0xd6ee('0x11');var MICROSOFT_TOKEN_ENDPOINT=_0xd6ee('0x12');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x460702){var _0x2b4c60=_[_0xd6ee('0x13')](AZURE_AUTH_SCOPES[_0x460702[_0xd6ee('0x14')]]);if(_0x460702[_0xd6ee('0x14')]==='Dynamics365')_0x2b4c60[_0xd6ee('0x15')](_0x460702[_0xd6ee('0x16')]+_0xd6ee('0x17'));return _0x2b4c60[_0xd6ee('0x18')]('\x20');}function getAccessTokenScope(_0x35e0f1){if(_0x35e0f1[_0xd6ee('0x14')]==='Outlook365')return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x35e0f1[_0xd6ee('0x14')]===_0xd6ee('0x19'))return _0x35e0f1[_0xd6ee('0x16')]+_0xd6ee('0x17');}function generateMicrosoftAuthorizationUrl(_0x582fb4,_0x412e20){var _0x587e2f=MICROSOFT_AUTH_URL[_0xd6ee('0x1a')]('{TENANT_ID}',_0x582fb4[_0xd6ee('0x1b')]);var _0x2ed29c=['code','id_token'];var _0x4be323=Buffer[_0xd6ee('0x1c')](JSON[_0xd6ee('0x1d')]({'id':_0x412e20}))['toString'](_0xd6ee('0x1e'));var _0x2fd597=crypto['randomBytes'](0x10)['toString'](_0xd6ee('0x1f'));var _0x4760b3=getAuthorizationScopes(_0x582fb4);var _0x142d38=[{'key':_0xd6ee('0x20'),'value':_0x582fb4[_0xd6ee('0x21')]},{'key':_0xd6ee('0x22'),'value':encodeURIComponent(_0x2ed29c[_0xd6ee('0x18')]('\x20'))},{'key':'redirect_uri','value':_0x582fb4['data4']},{'key':_0xd6ee('0x23'),'value':_0xd6ee('0x24')},{'key':_0xd6ee('0x25'),'value':encodeURIComponent(_0x4760b3)},{'key':'state','value':_0x4be323},{'key':'nonce','value':_0x2fd597},{'key':_0xd6ee('0x26'),'value':_0xd6ee('0x27')}];var _0x1db60f=_0x587e2f+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x142d38,function(_0x6b3175){return _0x6b3175[_0xd6ee('0x28')]+'='+_0x6b3175[_0xd6ee('0x29')];})[_0xd6ee('0x18')]('&');_0x582fb4[_0xd6ee('0x2a')]={'issuer':_0x587e2f[_0xd6ee('0x1a')](_0xd6ee('0x2b'),''),'audience':_0x582fb4[_0xd6ee('0x21')],'state':_0x4be323,'nonce':_0x2fd597};redis[_0xd6ee('0x2c')](_0x4be323,JSON[_0xd6ee('0x1d')](_0x582fb4));return _0x1db60f;}function isValidIdToken(_0xc3ac1,_0x48c522){try{var _0x1ffa1c=jwt['decode'](_0xc3ac1,{'complete':!![]});var _0x170b68=_0x1ffa1c[_0xd6ee('0x2d')];if(_0x170b68[_0xd6ee('0x2e')]!==_0x48c522[_0xd6ee('0x2f')])return![];if(_0x170b68[_0xd6ee('0x30')]!==_0x48c522[_0xd6ee('0x31')])return![];if(_0x170b68[_0xd6ee('0x32')]!==_0x48c522[_0xd6ee('0x32')])return![];if(moment()[_0xd6ee('0x33')](moment[_0xd6ee('0x34')](_0x170b68[_0xd6ee('0x35')])))return![];return!![];}catch(_0x121a08){throw _0x121a08;}}function refreshOauth2MicrosoftAccessToken(_0x2a2944){return Promise['resolve']()[_0xd6ee('0x36')](function(){if(_0x2a2944[_0xd6ee('0x37')])return _0x2a2944;return db[_0xd6ee('0x38')][_0xd6ee('0x39')]({'where':{'id':_0x2a2944['id']},'raw':!![]});})['then'](function(_0x542f55){var _0x5ab2a3={'grant_type':_0xd6ee('0x3a'),'refresh_token':_0x542f55['data6'],'scope':getAccessTokenScope(_0x542f55),'redirect_uri':_0x542f55['data4'],'client_id':_0x542f55[_0xd6ee('0x21')],'client_secret':encryptor[_0xd6ee('0x3b')](_0x542f55[_0xd6ee('0x37')])};var _0x563ac5={'method':_0xd6ee('0x3c'),'uri':MICROSOFT_AUTH_URL['replace'](_0xd6ee('0x3d'),_0x542f55[_0xd6ee('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5ab2a3,'json':!![]};return rp(_0x563ac5);})[_0xd6ee('0x36')](function(_0x4f0f65){_0x2a2944['data5']=_0x4f0f65[_0xd6ee('0x3e')];_0x2a2944[_0xd6ee('0x3f')]=_0x4f0f65['refresh_token'];return db['CloudProvider'][_0xd6ee('0x40')]({'data5':_0x2a2944[_0xd6ee('0x41')],'data6':_0x2a2944[_0xd6ee('0x3f')]},{'where':{'id':_0x2a2944['id']}});})['then'](function(){return _0x2a2944;})[_0xd6ee('0x42')](function(_0x56ab07){logger[_0xd6ee('0x43')](_0xd6ee('0x44'),_0x2a2944['id'],_0x56ab07);});}function getOauth2MicrosoftAccessToken(_0x3d4772,_0x20480c){var _0x1e7d6f={'grant_type':_0xd6ee('0x45'),'code':_0x3d4772,'scope':getAccessTokenScope(_0x20480c),'redirect_uri':_0x20480c['data4'],'client_id':_0x20480c[_0xd6ee('0x21')],'client_secret':encryptor[_0xd6ee('0x3b')](_0x20480c[_0xd6ee('0x37')])};var _0x28d969={'method':_0xd6ee('0x3c'),'uri':MICROSOFT_AUTH_URL[_0xd6ee('0x1a')]('{TENANT_ID}',_0x20480c['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1e7d6f,'json':!![]};return rp(_0x28d969);}function startRefreshInterval(_0x2470f5){var _0x1a8551=schedule[_0xd6ee('0x46')];if(_0x1a8551[_0x2470f5['id']])clearInterval(_0x1a8551[_0x2470f5['id']]);_0x1a8551[_0x2470f5['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xd6ee('0x47')](this,{'id':_0x2470f5['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x1a8551;}function startAllRefreshIntervals(){return db[_0xd6ee('0x38')][_0xd6ee('0x48')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xd6ee('0x36')](function(_0x4907f9){var _0x5e7372=_0x4907f9[_0xd6ee('0x13')](function(_0x3b7a3a){return refreshOauth2MicrosoftAccessToken(_0x3b7a3a)[_0xd6ee('0x36')](function(_0x2c7e50){startRefreshInterval(_0x2c7e50);});});return Promise['all'](_0x5e7372);})[_0xd6ee('0x42')](function(_0x1a07b4){var _0x98bf78=_0x1a07b4?util['inspect'](_0x1a07b4,{'showHidden':![],'depth':null}):'';logger[_0xd6ee('0x43')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x98bf78);});}module[_0xd6ee('0x49')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x8d6b=['https://outlook.office.com/POP.AccessAsUser.All','/authorize','type','Dynamics365','data7','/.default','join','Outlook365','{TENANT_ID}','data2','id_token','stringify','toString','hex','client_id','data1','response_type','redirect_uri','form_post','state','nonce','prompt','map','key','value','replace','set','iss','issuer','aud','audience','isAfter','unix','exp','data3','CloudProvider','findOne','then','data6','data4','POST','data5','access_token','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','decryptString','bind','intervals','findAll','all','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','jsonwebtoken','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All'];(function(_0x739bf5,_0x50002d){var _0x36510b=function(_0x210c62){while(--_0x210c62){_0x739bf5['push'](_0x739bf5['shift']());}};_0x36510b(++_0x50002d);}(_0x8d6b,0x1a4));var _0xb8d6=function(_0x3f9e3a,_0x524ef1){_0x3f9e3a=_0x3f9e3a-0x0;var _0xd1c420=_0x8d6b[_0x3f9e3a];return _0xd1c420;};'use strict';var _=require(_0xb8d6('0x0'));var crypto=require('crypto');var jwt=require(_0xb8d6('0x1'));var moment=require('moment');var Redis=require('ioredis');var rp=require('request-promise');var util=require(_0xb8d6('0x2'));var encryptor=require(_0xb8d6('0x3'));var config=require(_0xb8d6('0x4'));var logger=require(_0xb8d6('0x5'))(_0xb8d6('0x6'));var schedule=require(_0xb8d6('0x7'));var db=require(_0xb8d6('0x8'))['db'];config[_0xb8d6('0x9')]=_[_0xb8d6('0xa')](config[_0xb8d6('0x9')],{'host':_0xb8d6('0xb'),'port':0x18eb});var redis=new Redis(config[_0xb8d6('0x9')]);var MICROSOFT_AUTH_URL=_0xb8d6('0xc');var AZURE_AUTH_SCOPES={'Outlook365':[_0xb8d6('0xd'),_0xb8d6('0xe'),_0xb8d6('0xf'),_0xb8d6('0x10'),_0xb8d6('0x11'),_0xb8d6('0x12'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0xb8d6('0xd'),_0xb8d6('0x10')]};var MICROSOFT_AUTH_ENDPOINT=_0xb8d6('0x13');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x431463){var _0x380cd5=_['map'](AZURE_AUTH_SCOPES[_0x431463[_0xb8d6('0x14')]]);if(_0x431463[_0xb8d6('0x14')]===_0xb8d6('0x15'))_0x380cd5['push'](_0x431463[_0xb8d6('0x16')]+_0xb8d6('0x17'));return _0x380cd5[_0xb8d6('0x18')]('\x20');}function getAccessTokenScope(_0x172434){if(_0x172434[_0xb8d6('0x14')]===_0xb8d6('0x19'))return _0xb8d6('0x11');if(_0x172434[_0xb8d6('0x14')]===_0xb8d6('0x15'))return _0x172434[_0xb8d6('0x16')]+_0xb8d6('0x17');}function generateMicrosoftAuthorizationUrl(_0x3bf2ec,_0x2963f1){var _0x42e286=MICROSOFT_AUTH_URL['replace'](_0xb8d6('0x1a'),_0x3bf2ec[_0xb8d6('0x1b')]);var _0x1f8739=['code',_0xb8d6('0x1c')];var _0x48e7e2=Buffer['from'](JSON[_0xb8d6('0x1d')]({'id':_0x2963f1}))['toString']('base64');var _0x4b38c7=crypto['randomBytes'](0x10)[_0xb8d6('0x1e')](_0xb8d6('0x1f'));var _0x278dd5=getAuthorizationScopes(_0x3bf2ec);var _0x1c643c=[{'key':_0xb8d6('0x20'),'value':_0x3bf2ec[_0xb8d6('0x21')]},{'key':_0xb8d6('0x22'),'value':encodeURIComponent(_0x1f8739[_0xb8d6('0x18')]('\x20'))},{'key':_0xb8d6('0x23'),'value':_0x3bf2ec['data4']},{'key':'response_mode','value':_0xb8d6('0x24')},{'key':'scope','value':encodeURIComponent(_0x278dd5)},{'key':_0xb8d6('0x25'),'value':_0x48e7e2},{'key':_0xb8d6('0x26'),'value':_0x4b38c7},{'key':_0xb8d6('0x27'),'value':'login'}];var _0x4bea7b=_0x42e286+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xb8d6('0x28')](_0x1c643c,function(_0x17d751){return _0x17d751[_0xb8d6('0x29')]+'='+_0x17d751[_0xb8d6('0x2a')];})[_0xb8d6('0x18')]('&');_0x3bf2ec['oauth2Claims']={'issuer':_0x42e286[_0xb8d6('0x2b')]('oauth2/',''),'audience':_0x3bf2ec[_0xb8d6('0x21')],'state':_0x48e7e2,'nonce':_0x4b38c7};redis[_0xb8d6('0x2c')](_0x48e7e2,JSON[_0xb8d6('0x1d')](_0x3bf2ec));return _0x4bea7b;}function isValidIdToken(_0x88c3a1,_0x3080dc){try{var _0x56f77a=jwt['decode'](_0x88c3a1,{'complete':!![]});var _0x40e12b=_0x56f77a['payload'];if(_0x40e12b[_0xb8d6('0x2d')]!==_0x3080dc[_0xb8d6('0x2e')])return![];if(_0x40e12b[_0xb8d6('0x2f')]!==_0x3080dc[_0xb8d6('0x30')])return![];if(_0x40e12b['nonce']!==_0x3080dc[_0xb8d6('0x26')])return![];if(moment()[_0xb8d6('0x31')](moment[_0xb8d6('0x32')](_0x40e12b[_0xb8d6('0x33')])))return![];return!![];}catch(_0x51d7cb){throw _0x51d7cb;}}function refreshOauth2MicrosoftAccessToken(_0x3f3ee0){return Promise['resolve']()['then'](function(){if(_0x3f3ee0[_0xb8d6('0x34')])return _0x3f3ee0;return db[_0xb8d6('0x35')][_0xb8d6('0x36')]({'where':{'id':_0x3f3ee0['id']},'raw':!![]});})[_0xb8d6('0x37')](function(_0x2f16fc){var _0x5bebc1={'grant_type':'refresh_token','refresh_token':_0x2f16fc[_0xb8d6('0x38')],'scope':getAccessTokenScope(_0x2f16fc),'redirect_uri':_0x2f16fc[_0xb8d6('0x39')],'client_id':_0x2f16fc[_0xb8d6('0x21')],'client_secret':encryptor['decryptString'](_0x2f16fc[_0xb8d6('0x34')])};var _0x167dca={'method':_0xb8d6('0x3a'),'uri':MICROSOFT_AUTH_URL[_0xb8d6('0x2b')](_0xb8d6('0x1a'),_0x2f16fc['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5bebc1,'json':!![]};return rp(_0x167dca);})[_0xb8d6('0x37')](function(_0x47e367){_0x3f3ee0[_0xb8d6('0x3b')]=_0x47e367[_0xb8d6('0x3c')];_0x3f3ee0[_0xb8d6('0x38')]=_0x47e367['refresh_token'];return db['CloudProvider'][_0xb8d6('0x3d')]({'data5':_0x3f3ee0['data5'],'data6':_0x3f3ee0[_0xb8d6('0x38')]},{'where':{'id':_0x3f3ee0['id']}});})[_0xb8d6('0x37')](function(){return _0x3f3ee0;})[_0xb8d6('0x3e')](function(_0x3e0e6e){logger[_0xb8d6('0x3f')](_0xb8d6('0x40'),_0x3f3ee0['id'],_0x3e0e6e);});}function getOauth2MicrosoftAccessToken(_0xd17c4,_0x199fd8){var _0x2e8dc2={'grant_type':_0xb8d6('0x41'),'code':_0xd17c4,'scope':getAccessTokenScope(_0x199fd8),'redirect_uri':_0x199fd8[_0xb8d6('0x39')],'client_id':_0x199fd8[_0xb8d6('0x21')],'client_secret':encryptor[_0xb8d6('0x42')](_0x199fd8[_0xb8d6('0x34')])};var _0xf341bc={'method':_0xb8d6('0x3a'),'uri':MICROSOFT_AUTH_URL[_0xb8d6('0x2b')](_0xb8d6('0x1a'),_0x199fd8[_0xb8d6('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2e8dc2,'json':!![]};return rp(_0xf341bc);}function startRefreshInterval(_0x56f827){var _0x310758=schedule['intervals'];if(_0x310758[_0x56f827['id']])clearInterval(_0x310758[_0x56f827['id']]);_0x310758[_0x56f827['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xb8d6('0x43')](this,{'id':_0x56f827['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xb8d6('0x44')]=_0x310758;}function startAllRefreshIntervals(){return db['CloudProvider'][_0xb8d6('0x45')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x18aa20){var _0x4cb686=_0x18aa20[_0xb8d6('0x28')](function(_0x19f94d){return refreshOauth2MicrosoftAccessToken(_0x19f94d)[_0xb8d6('0x37')](function(_0x462641){startRefreshInterval(_0x462641);});});return Promise[_0xb8d6('0x46')](_0x4cb686);})[_0xb8d6('0x3e')](function(_0x3e6a1c){var _0x333195=_0x3e6a1c?util['inspect'](_0x3e6a1c,{'showHidden':![],'depth':null}):'';logger[_0xb8d6('0x3f')](_0xb8d6('0x47'),_0x333195);});}module[_0xb8d6('0x48')]={'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 21eda5c..6d4668a 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 _0xb4f8=['client','http','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x45da0f,_0x370d35){var _0x3ac5ca=function(_0xd9b600){while(--_0xd9b600){_0x45da0f['push'](_0x45da0f['shift']());}};_0x3ac5ca(++_0x370d35);}(_0xb4f8,0x83));var _0x8b4f=function(_0x2962d5,_0x38deda){_0x2962d5=_0x2962d5-0x0;var _0x273406=_0xb4f8[_0x2962d5];return _0x273406;};'use strict';var _=require('lodash');var util=require(_0x8b4f('0x0'));var moment=require(_0x8b4f('0x1'));var BPromise=require(_0x8b4f('0x2'));var rs=require(_0x8b4f('0x3'));var fs=require('fs');var Redis=require(_0x8b4f('0x4'));var db=require(_0x8b4f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8b4f('0x6'))('rpc');var config=require(_0x8b4f('0x7'));var jayson=require(_0x8b4f('0x8'));var client=jayson[_0x8b4f('0x9')][_0x8b4f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2eefde,_0x557bc0,_0x2dfe1c){return new BPromise(function(_0xa91c09,_0x40042b){return client['request'](_0x2eefde,_0x2dfe1c)[_0x8b4f('0xb')](function(_0x13d37a){logger[_0x8b4f('0xc')](_0x8b4f('0xd'),_0x557bc0,_0x8b4f('0xe'));logger['debug'](_0x8b4f('0xf'),_0x557bc0,_0x8b4f('0xe'),JSON['stringify'](_0x13d37a));if(_0x13d37a[_0x8b4f('0x10')]){if(_0x13d37a[_0x8b4f('0x10')]['code']===0x1f4){logger[_0x8b4f('0x10')](_0x8b4f('0xd'),_0x557bc0,_0x13d37a['error'][_0x8b4f('0x11')]);return _0x40042b(_0x13d37a[_0x8b4f('0x10')][_0x8b4f('0x11')]);}logger[_0x8b4f('0x10')]('CloudProvider,\x20%s,\x20%s',_0x557bc0,_0x13d37a[_0x8b4f('0x10')][_0x8b4f('0x11')]);return _0xa91c09(_0x13d37a[_0x8b4f('0x10')][_0x8b4f('0x11')]);}else{logger[_0x8b4f('0xc')](_0x8b4f('0xd'),_0x557bc0,'request\x20sent');_0xa91c09(_0x13d37a[_0x8b4f('0x12')][_0x8b4f('0x11')]);}})[_0x8b4f('0x13')](function(_0x1b4b9f){logger[_0x8b4f('0x10')](_0x8b4f('0xd'),_0x557bc0,_0x1b4b9f);_0x40042b(_0x1b4b9f);});});} \ No newline at end of file +var _0x6ac2=['info','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x6ac2,0x184));var _0x26ac=function(_0x34d0e2,_0x5af29d){_0x34d0e2=_0x34d0e2-0x0;var _0x47004f=_0x6ac2[_0x34d0e2];return _0x47004f;};'use strict';var _=require(_0x26ac('0x0'));var util=require('util');var moment=require(_0x26ac('0x1'));var BPromise=require(_0x26ac('0x2'));var rs=require(_0x26ac('0x3'));var fs=require('fs');var Redis=require(_0x26ac('0x4'));var db=require(_0x26ac('0x5'))['db'];var utils=require(_0x26ac('0x6'));var logger=require('../../config/logger')(_0x26ac('0x7'));var config=require('../../config/environment');var jayson=require(_0x26ac('0x8'));var client=jayson[_0x26ac('0x9')][_0x26ac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x159ba6,_0x36389c,_0x444ca1){return new BPromise(function(_0x1906d0,_0xd8b1e5){return client['request'](_0x159ba6,_0x444ca1)['then'](function(_0x27ff15){logger[_0x26ac('0xb')](_0x26ac('0xc'),_0x36389c,_0x26ac('0xd'));logger['debug'](_0x26ac('0xe'),_0x36389c,_0x26ac('0xd'),JSON[_0x26ac('0xf')](_0x27ff15));if(_0x27ff15[_0x26ac('0x10')]){if(_0x27ff15['error']['code']===0x1f4){logger[_0x26ac('0x10')](_0x26ac('0xc'),_0x36389c,_0x27ff15[_0x26ac('0x10')][_0x26ac('0x11')]);return _0xd8b1e5(_0x27ff15[_0x26ac('0x10')][_0x26ac('0x11')]);}logger[_0x26ac('0x10')]('CloudProvider,\x20%s,\x20%s',_0x36389c,_0x27ff15[_0x26ac('0x10')][_0x26ac('0x11')]);return _0x1906d0(_0x27ff15[_0x26ac('0x10')][_0x26ac('0x11')]);}else{logger['info'](_0x26ac('0xc'),_0x36389c,_0x26ac('0xd'));_0x1906d0(_0x27ff15['result'][_0x26ac('0x11')]);}})[_0x26ac('0x12')](function(_0x3b7c5d){logger[_0x26ac('0x10')]('CloudProvider,\x20%s,\x20%s',_0x36389c,_0x3b7c5d);_0xd8b1e5(_0x3b7c5d);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 2f0fd77..7a07dc0 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(_0x33154d,_0x854047){var _0x3b2f03=function(_0x35f7a6){while(--_0x35f7a6){_0x33154d['push'](_0x33154d['shift']());}};_0x3b2f03(++_0x854047);}(_0x1261,0x144));var _0x1126=function(_0x32b79a,_0xd2538a){_0x32b79a=_0x32b79a-0x0;var _0x483450=_0x1261[_0x32b79a];return _0x483450;};'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(_0x271fe0,_0x2b0c22){var _0x318b44=function(_0x7c8214){while(--_0x7c8214){_0x271fe0['push'](_0x271fe0['shift']());}};_0x318b44(++_0x2b0c22);}(_0xadb5,0xad));var _0x5adb=function(_0x4e17a8,_0x204391){_0x4e17a8=_0x4e17a8-0x0;var _0x4a53c2=_0xadb5[_0x4e17a8];return _0x4a53c2;};'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 0bc7d4b..0901a09 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 _0xab99=['STRING','sequelize'];(function(_0x5e27c9,_0x1fffd2){var _0x529849=function(_0x13a2f7){while(--_0x13a2f7){_0x5e27c9['push'](_0x5e27c9['shift']());}};_0x529849(++_0x1fffd2);}(_0xab99,0x1a7));var _0x9ab9=function(_0x228895,_0x16f857){_0x228895=_0x228895-0x0;var _0x40c252=_0xab99[_0x228895];return _0x40c252;};'use strict';var Sequelize=require(_0x9ab9('0x0'));module['exports']={'name':{'type':Sequelize[_0x9ab9('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x9ab9('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x9ab9('0x1')]},'phone':{'type':Sequelize[_0x9ab9('0x1')]},'fax':{'type':Sequelize[_0x9ab9('0x1')]},'type':{'type':Sequelize[_0x9ab9('0x1')]},'street':{'type':Sequelize[_0x9ab9('0x1')]},'postalCode':{'type':Sequelize[_0x9ab9('0x1')]},'city':{'type':Sequelize[_0x9ab9('0x1')]},'country':{'type':Sequelize[_0x9ab9('0x1')]},'email':{'type':Sequelize[_0x9ab9('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x9ab9('0x1')]},'sStreet':{'type':Sequelize[_0x9ab9('0x1')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x9ab9('0x1')]},'sCountry':{'type':Sequelize[_0x9ab9('0x1')]},'description':{'type':Sequelize[_0x9ab9('0x1')]}}; \ No newline at end of file +var _0x2aff=['STRING','name','exports'];(function(_0x265b59,_0x42b00e){var _0x5d81b9=function(_0x17445f){while(--_0x17445f){_0x265b59['push'](_0x265b59['shift']());}};_0x5d81b9(++_0x42b00e);}(_0x2aff,0x6b));var _0xf2af=function(_0x14adfc,_0x2f05fa){_0x14adfc=_0x14adfc-0x0;var _0x384191=_0x2aff[_0x14adfc];return _0x384191;};'use strict';var Sequelize=require('sequelize');module[_0xf2af('0x0')]={'name':{'type':Sequelize[_0xf2af('0x1')],'unique':_0xf2af('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xf2af('0x1')]},'companyId':{'type':Sequelize[_0xf2af('0x1')]},'website':{'type':Sequelize[_0xf2af('0x1')]},'phone':{'type':Sequelize[_0xf2af('0x1')]},'fax':{'type':Sequelize[_0xf2af('0x1')]},'type':{'type':Sequelize[_0xf2af('0x1')]},'street':{'type':Sequelize[_0xf2af('0x1')]},'postalCode':{'type':Sequelize[_0xf2af('0x1')]},'city':{'type':Sequelize[_0xf2af('0x1')]},'country':{'type':Sequelize[_0xf2af('0x1')]},'email':{'type':Sequelize[_0xf2af('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xf2af('0x1')]},'sStreet':{'type':Sequelize[_0xf2af('0x1')]},'sPostalCode':{'type':Sequelize[_0xf2af('0x1')]},'sCity':{'type':Sequelize[_0xf2af('0x1')]},'sCountry':{'type':Sequelize[_0xf2af('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index a81aef0..e0fe10f 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 _0x4697=['find','create','body','user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','ids','getContacts','findOne','CmContact','rimraf','request-promise','moment','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','Companies','UserProfileResource','then','sendStatus','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','map','filter','options','includeAll','include','findAll','rows','catch','params','rawAttributes','length'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x4697,0x1ed));var _0x7469=function(_0x24114d,_0x4606fc){_0x24114d=_0x24114d-0x0;var _0x21f1c7=_0x4697[_0x24114d];return _0x21f1c7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7469('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7469('0x1'));var moment=require(_0x7469('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x7469('0x3'));var util=require('util');var path=require(_0x7469('0x4'));var sox=require(_0x7469('0x5'));var csv=require('to-csv');var ejs=require(_0x7469('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7469('0x7'));var crypto=require(_0x7469('0x8'));var jsforce=require(_0x7469('0x9'));var deskjs=require(_0x7469('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7469('0xb'));var Redis=require(_0x7469('0xc'));var authService=require(_0x7469('0xd'));var qs=require(_0x7469('0xe'));var as=require(_0x7469('0xf'));var hardwareService=require(_0x7469('0x10'));var logger=require(_0x7469('0x11'))('api');var utils=require(_0x7469('0x12'));var config=require(_0x7469('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x7469('0x14'))['db'];function respondWithStatusCode(_0xb72c09,_0x233fd0){_0x233fd0=_0x233fd0||0xcc;return function(_0x3fdd3f){if(_0x3fdd3f){return _0xb72c09['sendStatus'](_0x233fd0);}return _0xb72c09['status'](_0x233fd0)[_0x7469('0x15')]();};}function respondWithResult(_0x414513,_0x10e166){_0x10e166=_0x10e166||0xc8;return function(_0x27a9c8){if(_0x27a9c8){return _0x414513[_0x7469('0x16')](_0x10e166)[_0x7469('0x17')](_0x27a9c8);}};}function respondWithFilteredResult(_0x34050a,_0x542864){return function(_0x40ae7f){if(_0x40ae7f){var _0x1842f0=typeof _0x542864[_0x7469('0x18')]===_0x7469('0x19')&&typeof _0x542864['limit']==='undefined';var _0x5dd80b=_0x40ae7f[_0x7469('0x1a')];var _0x4b2fb1=_0x1842f0?0x0:_0x542864[_0x7469('0x18')];var _0x25549f=_0x1842f0?_0x40ae7f['count']:_0x542864[_0x7469('0x18')]+_0x542864[_0x7469('0x1b')];var _0x225c24;if(_0x25549f>=_0x5dd80b){_0x25549f=_0x5dd80b;_0x225c24=0xc8;}else{_0x225c24=0xce;}_0x34050a['status'](_0x225c24);return _0x34050a[_0x7469('0x1c')](_0x7469('0x1d'),_0x4b2fb1+'-'+_0x25549f+'/'+_0x5dd80b)[_0x7469('0x17')](_0x40ae7f);}return null;};}function patchUpdates(_0x44f813){return function(_0x3ad0fe){try{jsonpatch['apply'](_0x3ad0fe,_0x44f813,!![]);}catch(_0x51ba20){return BPromise[_0x7469('0x1e')](_0x51ba20);}return _0x3ad0fe[_0x7469('0x1f')]();};}function saveUpdates(_0x1a7058,_0x4d44ae){return function(_0x456b00){if(_0x456b00){return _0x456b00[_0x7469('0x20')](_0x1a7058)['then'](function(_0x55aefd){return _0x55aefd;});}return null;};}function removeEntity(_0x5add64,_0x3a0474){return function(_0x2bc8b1){if(_0x2bc8b1){return _0x2bc8b1[_0x7469('0x21')]()['then'](function(){var _0xeab407=_0x2bc8b1['get']({'plain':!![]});var _0x407777=_0x7469('0x22');return db[_0x7469('0x23')][_0x7469('0x21')]({'where':{'type':_0x407777,'resourceId':_0xeab407['id']}})[_0x7469('0x24')](function(){return _0x2bc8b1;});})[_0x7469('0x24')](function(){_0x5add64[_0x7469('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x361336,_0x1cff15){return function(_0x3222e0){if(!_0x3222e0){_0x361336[_0x7469('0x25')](0x194);}return _0x3222e0;};}function handleError(_0x3c7f37,_0x22c2c3){_0x22c2c3=_0x22c2c3||0x1f4;return function(_0x246799){logger['error'](_0x246799['stack']);if(_0x246799[_0x7469('0x26')]){delete _0x246799[_0x7469('0x26')];}_0x3c7f37[_0x7469('0x16')](_0x22c2c3)[_0x7469('0x27')](_0x246799);};}exports[_0x7469('0x28')]=function(_0x26cf9b,_0x3ecbc8){var _0x2ed1f5={},_0x2685be={},_0x377675={'count':0x0,'rows':[]};return db[_0x7469('0x29')][_0x7469('0x2a')]()[_0x7469('0x24')](function(_0x29eef6){_0x2685be[_0x7469('0x2b')]=_[_0x7469('0x2c')](_0x29eef6);_0x2685be['query']=_['keys'](_0x26cf9b[_0x7469('0x2d')]);_0x2685be[_0x7469('0x2e')]=_[_0x7469('0x2f')](_0x2685be['model'],_0x2685be[_0x7469('0x2d')]);_0x2ed1f5[_0x7469('0x30')]=_[_0x7469('0x2f')](_0x2685be[_0x7469('0x2b')],qs[_0x7469('0x31')](_0x26cf9b[_0x7469('0x2d')]['fields']));_0x2ed1f5[_0x7469('0x30')]=_0x2ed1f5[_0x7469('0x30')]['length']?_0x2ed1f5[_0x7469('0x30')]:_0x2685be[_0x7469('0x2b')];if(!_0x26cf9b[_0x7469('0x2d')][_0x7469('0x32')](_0x7469('0x33'))){_0x2ed1f5[_0x7469('0x1b')]=qs['limit'](_0x26cf9b[_0x7469('0x2d')][_0x7469('0x1b')]);_0x2ed1f5[_0x7469('0x18')]=qs['offset'](_0x26cf9b[_0x7469('0x2d')]['offset']);}_0x2ed1f5[_0x7469('0x34')]=qs[_0x7469('0x35')](_0x26cf9b['query'][_0x7469('0x35')]);_0x2ed1f5[_0x7469('0x36')]=qs[_0x7469('0x2e')](_['pick'](_0x26cf9b[_0x7469('0x2d')],_0x2685be[_0x7469('0x2e')]),_0x29eef6);if(_0x26cf9b[_0x7469('0x2d')]['filter']){_0x2ed1f5[_0x7469('0x36')]=_[_0x7469('0x37')](_0x2ed1f5[_0x7469('0x36')],{'$or':_[_0x7469('0x38')](_0x2ed1f5[_0x7469('0x30')],function(_0x2df343){var _0x852db0={};_0x852db0[_0x2df343]={'$like':'%'+_0x26cf9b[_0x7469('0x2d')][_0x7469('0x39')]+'%'};return _0x852db0;})});}_0x2ed1f5=_['merge']({},_0x2ed1f5,_0x26cf9b[_0x7469('0x3a')]);var _0x5f314f={'where':_0x2ed1f5[_0x7469('0x36')]};return db[_0x7469('0x29')]['count'](_0x5f314f)['then'](function(_0x343dfa){_0x377675[_0x7469('0x1a')]=_0x343dfa;if(_0x26cf9b['query'][_0x7469('0x3b')]){_0x2ed1f5[_0x7469('0x3c')]=[{'all':!![]}];}return db[_0x7469('0x29')][_0x7469('0x3d')](_0x2ed1f5);})[_0x7469('0x24')](function(_0x56a31c){_0x377675[_0x7469('0x3e')]=_0x56a31c;return _0x377675;})[_0x7469('0x24')](respondWithFilteredResult(_0x3ecbc8,_0x2ed1f5))[_0x7469('0x3f')](handleError(_0x3ecbc8,null));})['catch'](handleError(_0x3ecbc8,null));};exports['show']=function(_0x2240cf,_0x411671){var _0x367534={'raw':![],'where':{'id':_0x2240cf[_0x7469('0x40')]['id']}},_0x1aaeef={};_0x1aaeef[_0x7469('0x2b')]=_['keys'](db[_0x7469('0x29')][_0x7469('0x41')]);_0x1aaeef[_0x7469('0x2d')]=_[_0x7469('0x2c')](_0x2240cf[_0x7469('0x2d')]);_0x1aaeef[_0x7469('0x2e')]=_[_0x7469('0x2f')](_0x1aaeef['model'],_0x1aaeef['query']);_0x367534[_0x7469('0x30')]=_[_0x7469('0x2f')](_0x1aaeef[_0x7469('0x2b')],qs[_0x7469('0x31')](_0x2240cf['query'][_0x7469('0x31')]));_0x367534['attributes']=_0x367534[_0x7469('0x30')][_0x7469('0x42')]?_0x367534['attributes']:_0x1aaeef[_0x7469('0x2b')];if(_0x2240cf[_0x7469('0x2d')][_0x7469('0x3b')]){_0x367534[_0x7469('0x3c')]=[{'all':!![]}];}_0x367534=_[_0x7469('0x37')]({},_0x367534,_0x2240cf[_0x7469('0x3a')]);return db[_0x7469('0x29')][_0x7469('0x43')](_0x367534)[_0x7469('0x24')](handleEntityNotFound(_0x411671,null))[_0x7469('0x24')](respondWithResult(_0x411671,null))[_0x7469('0x3f')](handleError(_0x411671,null));};exports[_0x7469('0x44')]=function(_0x24b567,_0x192747){return db['CmCompany'][_0x7469('0x44')](_0x24b567[_0x7469('0x45')],{})[_0x7469('0x24')](function(_0x2b9b54){var _0xbde0ea=_0x24b567[_0x7469('0x46')]['get']({'plain':!![]});if(!_0xbde0ea)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xbde0ea['role']===_0x7469('0x46')){var _0x369bcd=_0x2b9b54['get']({'plain':!![]});var _0x2a4d37=_0x7469('0x22');return db['UserProfileSection'][_0x7469('0x43')]({'where':{'name':_0x2a4d37,'userProfileId':_0xbde0ea[_0x7469('0x47')]},'raw':!![]})[_0x7469('0x24')](function(_0x5c1c35){if(_0x5c1c35&&_0x5c1c35[_0x7469('0x48')]===0x0){return db[_0x7469('0x23')]['create']({'name':_0x369bcd[_0x7469('0x26')],'resourceId':_0x369bcd['id'],'type':_0x5c1c35[_0x7469('0x26')],'sectionId':_0x5c1c35['id']},{})[_0x7469('0x24')](function(){return _0x2b9b54;});}else{return _0x2b9b54;}})['catch'](function(_0x640b06){logger[_0x7469('0x49')](_0x7469('0x4a'),_0x640b06);throw _0x640b06;});}return _0x2b9b54;})[_0x7469('0x24')](respondWithResult(_0x192747,0xc9))['catch'](handleError(_0x192747,null));};exports[_0x7469('0x20')]=function(_0x4d0804,_0x3e88ae){if(_0x4d0804['body']['id']){delete _0x4d0804[_0x7469('0x45')]['id'];}return db[_0x7469('0x29')][_0x7469('0x43')]({'where':{'id':_0x4d0804[_0x7469('0x40')]['id']}})[_0x7469('0x24')](handleEntityNotFound(_0x3e88ae,null))[_0x7469('0x24')](saveUpdates(_0x4d0804[_0x7469('0x45')],null))[_0x7469('0x24')](respondWithResult(_0x3e88ae,null))[_0x7469('0x3f')](handleError(_0x3e88ae,null));};exports['destroy']=function(_0x7b418,_0x552778){return db[_0x7469('0x29')][_0x7469('0x43')]({'where':{'id':_0x7b418[_0x7469('0x40')]['id']}})[_0x7469('0x24')](handleEntityNotFound(_0x552778,null))[_0x7469('0x24')](removeEntity(_0x552778,null))[_0x7469('0x3f')](handleError(_0x552778,null));};exports['describe']=function(_0x47e497,_0x6f9778){return db['CmCompany'][_0x7469('0x2a')]()[_0x7469('0x24')](respondWithResult(_0x6f9778,null))[_0x7469('0x3f')](handleError(_0x6f9778,null));};exports[_0x7469('0x4b')]=function(_0x28653e,_0x3a8be9,_0x5777cb){return db['CmContact'][_0x7469('0x43')]({'where':{'id':_0x28653e['params']['id']}})[_0x7469('0x24')](handleEntityNotFound(_0x3a8be9,null))[_0x7469('0x24')](function(_0x1157e0){if(_0x1157e0){return _0x1157e0['addContacts'](_0x28653e[_0x7469('0x45')][_0x7469('0x4c')],_['omit'](_0x28653e[_0x7469('0x45')],[_0x7469('0x4c'),'id'])||{});}})[_0x7469('0x24')](respondWithResult(_0x3a8be9,null))[_0x7469('0x3f')](handleError(_0x3a8be9,null));};exports[_0x7469('0x4d')]=function(_0x13d103,_0x583d48,_0x5f08a1){var _0x2caa6c={};var _0x3e98b7={};var _0x585631;var _0x1e71b7;return db[_0x7469('0x29')][_0x7469('0x4e')]({'where':{'id':_0x13d103[_0x7469('0x40')]['id']}})['then'](handleEntityNotFound(_0x583d48,null))['then'](function(_0x565a8d){if(_0x565a8d){_0x585631=_0x565a8d;_0x3e98b7[_0x7469('0x2b')]=_[_0x7469('0x2c')](db[_0x7469('0x4f')]['rawAttributes']);_0x3e98b7['query']=_[_0x7469('0x2c')](_0x13d103['query']);_0x3e98b7[_0x7469('0x2e')]=_[_0x7469('0x2f')](_0x3e98b7[_0x7469('0x2b')],_0x3e98b7[_0x7469('0x2d')]);_0x2caa6c['attributes']=_[_0x7469('0x2f')](_0x3e98b7[_0x7469('0x2b')],qs[_0x7469('0x31')](_0x13d103[_0x7469('0x2d')][_0x7469('0x31')]));_0x2caa6c['attributes']=_0x2caa6c[_0x7469('0x30')][_0x7469('0x42')]?_0x2caa6c['attributes']:_0x3e98b7[_0x7469('0x2b')];_0x2caa6c[_0x7469('0x34')]=qs[_0x7469('0x35')](_0x13d103[_0x7469('0x2d')][_0x7469('0x35')]);_0x2caa6c[_0x7469('0x36')]=qs[_0x7469('0x2e')](_['pick'](_0x13d103[_0x7469('0x2d')],_0x3e98b7['filters']));if(_0x13d103[_0x7469('0x2d')][_0x7469('0x39')]){_0x2caa6c[_0x7469('0x36')]=_[_0x7469('0x37')](_0x2caa6c[_0x7469('0x36')],{'$or':_[_0x7469('0x38')](_0x2caa6c['attributes'],function(_0x3f2ef8){var _0xdbb423={};_0xdbb423[_0x3f2ef8]={'$like':'%'+_0x13d103[_0x7469('0x2d')][_0x7469('0x39')]+'%'};return _0xdbb423;})});}_0x2caa6c=_[_0x7469('0x37')]({},_0x2caa6c,_0x13d103[_0x7469('0x3a')]);return _0x585631[_0x7469('0x4d')](_0x2caa6c);}})[_0x7469('0x24')](function(_0x58bb3c){if(_0x58bb3c){_0x1e71b7=_0x58bb3c[_0x7469('0x42')];if(!_0x13d103[_0x7469('0x2d')]['hasOwnProperty'](_0x7469('0x33'))){_0x2caa6c[_0x7469('0x1b')]=qs['limit'](_0x13d103[_0x7469('0x2d')][_0x7469('0x1b')]);_0x2caa6c[_0x7469('0x18')]=qs[_0x7469('0x18')](_0x13d103[_0x7469('0x2d')][_0x7469('0x18')]);}return _0x585631[_0x7469('0x4d')](_0x2caa6c);}})['then'](function(_0x2d7519){if(_0x2d7519){return _0x2d7519?{'count':_0x1e71b7,'rows':_0x2d7519}:null;}})[_0x7469('0x24')](respondWithResult(_0x583d48,null))[_0x7469('0x3f')](handleError(_0x583d48,null));}; \ No newline at end of file +var _0xd245=['length','hasOwnProperty','nolimit','limit','order','sort','where','filter','map','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','addContacts','CmContact','ids','omit','getContacts','findOne','pick','eml-format','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','undefined','count','offset','Content-Range','apply','reject','save','update','then','UserProfileResource','destroy','sendStatus','error','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields'];(function(_0x3de6ad,_0x56ddd2){var _0x5c7ff3=function(_0x2591c5){while(--_0x2591c5){_0x3de6ad['push'](_0x3de6ad['shift']());}};_0x5c7ff3(++_0x56ddd2);}(_0xd245,0x77));var _0x5d24=function(_0x1709e7,_0x2ced21){_0x1709e7=_0x1709e7-0x0;var _0x402819=_0xd245[_0x1709e7];return _0x402819;};'use strict';var emlformat=require(_0x5d24('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5d24('0x1'));var rp=require(_0x5d24('0x2'));var moment=require('moment');var BPromise=require(_0x5d24('0x3'));var Mustache=require('mustache');var util=require(_0x5d24('0x4'));var path=require(_0x5d24('0x5'));var sox=require('sox');var csv=require(_0x5d24('0x6'));var ejs=require(_0x5d24('0x7'));var fs=require('fs');var fs_extra=require(_0x5d24('0x8'));var _=require(_0x5d24('0x9'));var squel=require(_0x5d24('0xa'));var crypto=require(_0x5d24('0xb'));var jsforce=require(_0x5d24('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5d24('0xd'));var Papa=require('papaparse');var Redis=require(_0x5d24('0xe'));var authService=require(_0x5d24('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5d24('0x10'));var hardwareService=require(_0x5d24('0x11'));var logger=require(_0x5d24('0x12'))(_0x5d24('0x13'));var utils=require(_0x5d24('0x14'));var config=require(_0x5d24('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x5d24('0x16'))['db'];function respondWithStatusCode(_0x3da550,_0x2dc999){_0x2dc999=_0x2dc999||0xcc;return function(_0x5c272e){if(_0x5c272e){return _0x3da550['sendStatus'](_0x2dc999);}return _0x3da550['status'](_0x2dc999)[_0x5d24('0x17')]();};}function respondWithResult(_0xb0ee71,_0x94fbde){_0x94fbde=_0x94fbde||0xc8;return function(_0x2b4dde){if(_0x2b4dde){return _0xb0ee71[_0x5d24('0x18')](_0x94fbde)[_0x5d24('0x19')](_0x2b4dde);}};}function respondWithFilteredResult(_0x39109b,_0x2cf044){return function(_0x54a18c){if(_0x54a18c){var _0x64fd1e=typeof _0x2cf044['offset']===_0x5d24('0x1a')&&typeof _0x2cf044['limit']===_0x5d24('0x1a');var _0x44cb4a=_0x54a18c[_0x5d24('0x1b')];var _0x5cf1e8=_0x64fd1e?0x0:_0x2cf044[_0x5d24('0x1c')];var _0x10a9ae=_0x64fd1e?_0x54a18c[_0x5d24('0x1b')]:_0x2cf044[_0x5d24('0x1c')]+_0x2cf044['limit'];var _0x448569;if(_0x10a9ae>=_0x44cb4a){_0x10a9ae=_0x44cb4a;_0x448569=0xc8;}else{_0x448569=0xce;}_0x39109b[_0x5d24('0x18')](_0x448569);return _0x39109b['set'](_0x5d24('0x1d'),_0x5cf1e8+'-'+_0x10a9ae+'/'+_0x44cb4a)['json'](_0x54a18c);}return null;};}function patchUpdates(_0x52605a){return function(_0x2d6b1f){try{jsonpatch[_0x5d24('0x1e')](_0x2d6b1f,_0x52605a,!![]);}catch(_0x4d1690){return BPromise[_0x5d24('0x1f')](_0x4d1690);}return _0x2d6b1f[_0x5d24('0x20')]();};}function saveUpdates(_0x2388aa,_0x5e41ea){return function(_0x40e116){if(_0x40e116){return _0x40e116[_0x5d24('0x21')](_0x2388aa)[_0x5d24('0x22')](function(_0x2eb778){return _0x2eb778;});}return null;};}function removeEntity(_0x3d9c4d,_0x139d35){return function(_0x5873e2){if(_0x5873e2){return _0x5873e2['destroy']()['then'](function(){var _0x889391=_0x5873e2['get']({'plain':!![]});var _0x4b5964='Companies';return db[_0x5d24('0x23')][_0x5d24('0x24')]({'where':{'type':_0x4b5964,'resourceId':_0x889391['id']}})[_0x5d24('0x22')](function(){return _0x5873e2;});})[_0x5d24('0x22')](function(){_0x3d9c4d[_0x5d24('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xcf3fc1,_0x1652cd){return function(_0x9c4f2b){if(!_0x9c4f2b){_0xcf3fc1[_0x5d24('0x25')](0x194);}return _0x9c4f2b;};}function handleError(_0x2b8b20,_0x2488bd){_0x2488bd=_0x2488bd||0x1f4;return function(_0x134c95){logger[_0x5d24('0x26')](_0x134c95['stack']);if(_0x134c95[_0x5d24('0x27')]){delete _0x134c95[_0x5d24('0x27')];}_0x2b8b20[_0x5d24('0x18')](_0x2488bd)[_0x5d24('0x28')](_0x134c95);};}exports[_0x5d24('0x29')]=function(_0x38b722,_0x4190eb){var _0x48d6fc={},_0x116eaa={},_0x28f80a={'count':0x0,'rows':[]};return db[_0x5d24('0x2a')][_0x5d24('0x2b')]()[_0x5d24('0x22')](function(_0x505918){_0x116eaa[_0x5d24('0x2c')]=_[_0x5d24('0x2d')](_0x505918);_0x116eaa['query']=_['keys'](_0x38b722[_0x5d24('0x2e')]);_0x116eaa[_0x5d24('0x2f')]=_[_0x5d24('0x30')](_0x116eaa['model'],_0x116eaa[_0x5d24('0x2e')]);_0x48d6fc[_0x5d24('0x31')]=_[_0x5d24('0x30')](_0x116eaa['model'],qs[_0x5d24('0x32')](_0x38b722[_0x5d24('0x2e')][_0x5d24('0x32')]));_0x48d6fc['attributes']=_0x48d6fc[_0x5d24('0x31')][_0x5d24('0x33')]?_0x48d6fc[_0x5d24('0x31')]:_0x116eaa[_0x5d24('0x2c')];if(!_0x38b722[_0x5d24('0x2e')][_0x5d24('0x34')](_0x5d24('0x35'))){_0x48d6fc['limit']=qs[_0x5d24('0x36')](_0x38b722[_0x5d24('0x2e')][_0x5d24('0x36')]);_0x48d6fc[_0x5d24('0x1c')]=qs[_0x5d24('0x1c')](_0x38b722[_0x5d24('0x2e')][_0x5d24('0x1c')]);}_0x48d6fc[_0x5d24('0x37')]=qs[_0x5d24('0x38')](_0x38b722[_0x5d24('0x2e')][_0x5d24('0x38')]);_0x48d6fc[_0x5d24('0x39')]=qs[_0x5d24('0x2f')](_['pick'](_0x38b722[_0x5d24('0x2e')],_0x116eaa[_0x5d24('0x2f')]),_0x505918);if(_0x38b722[_0x5d24('0x2e')][_0x5d24('0x3a')]){_0x48d6fc[_0x5d24('0x39')]=_['merge'](_0x48d6fc[_0x5d24('0x39')],{'$or':_[_0x5d24('0x3b')](_0x48d6fc[_0x5d24('0x31')],function(_0x15ca3b){var _0x149938={};_0x149938[_0x15ca3b]={'$like':'%'+_0x38b722[_0x5d24('0x2e')][_0x5d24('0x3a')]+'%'};return _0x149938;})});}_0x48d6fc=_[_0x5d24('0x3c')]({},_0x48d6fc,_0x38b722[_0x5d24('0x3d')]);var _0x56bc01={'where':_0x48d6fc[_0x5d24('0x39')]};return db[_0x5d24('0x2a')][_0x5d24('0x1b')](_0x56bc01)['then'](function(_0x39ca5c){_0x28f80a['count']=_0x39ca5c;if(_0x38b722[_0x5d24('0x2e')][_0x5d24('0x3e')]){_0x48d6fc[_0x5d24('0x3f')]=[{'all':!![]}];}return db[_0x5d24('0x2a')][_0x5d24('0x40')](_0x48d6fc);})[_0x5d24('0x22')](function(_0x35b446){_0x28f80a['rows']=_0x35b446;return _0x28f80a;})[_0x5d24('0x22')](respondWithFilteredResult(_0x4190eb,_0x48d6fc))['catch'](handleError(_0x4190eb,null));})[_0x5d24('0x41')](handleError(_0x4190eb,null));};exports[_0x5d24('0x42')]=function(_0x382e75,_0x461c23){var _0x1905ee={'raw':![],'where':{'id':_0x382e75[_0x5d24('0x43')]['id']}},_0x1fc4fd={};_0x1fc4fd[_0x5d24('0x2c')]=_[_0x5d24('0x2d')](db[_0x5d24('0x2a')][_0x5d24('0x44')]);_0x1fc4fd['query']=_[_0x5d24('0x2d')](_0x382e75[_0x5d24('0x2e')]);_0x1fc4fd['filters']=_[_0x5d24('0x30')](_0x1fc4fd[_0x5d24('0x2c')],_0x1fc4fd[_0x5d24('0x2e')]);_0x1905ee[_0x5d24('0x31')]=_['intersection'](_0x1fc4fd[_0x5d24('0x2c')],qs[_0x5d24('0x32')](_0x382e75[_0x5d24('0x2e')][_0x5d24('0x32')]));_0x1905ee['attributes']=_0x1905ee[_0x5d24('0x31')][_0x5d24('0x33')]?_0x1905ee[_0x5d24('0x31')]:_0x1fc4fd[_0x5d24('0x2c')];if(_0x382e75[_0x5d24('0x2e')]['includeAll']){_0x1905ee['include']=[{'all':!![]}];}_0x1905ee=_[_0x5d24('0x3c')]({},_0x1905ee,_0x382e75[_0x5d24('0x3d')]);return db['CmCompany'][_0x5d24('0x45')](_0x1905ee)[_0x5d24('0x22')](handleEntityNotFound(_0x461c23,null))[_0x5d24('0x22')](respondWithResult(_0x461c23,null))['catch'](handleError(_0x461c23,null));};exports[_0x5d24('0x46')]=function(_0x5a4740,_0x44bf85){return db[_0x5d24('0x2a')]['create'](_0x5a4740[_0x5d24('0x47')],{})['then'](function(_0x21f322){var _0x226913=_0x5a4740['user'][_0x5d24('0x48')]({'plain':!![]});if(!_0x226913)throw new Error(_0x5d24('0x49'));if(_0x226913[_0x5d24('0x4a')]===_0x5d24('0x4b')){var _0x3e4eab=_0x21f322[_0x5d24('0x48')]({'plain':!![]});var _0x58e987='Companies';return db[_0x5d24('0x4c')][_0x5d24('0x45')]({'where':{'name':_0x58e987,'userProfileId':_0x226913['userProfileId']},'raw':!![]})[_0x5d24('0x22')](function(_0x5c368b){if(_0x5c368b&&_0x5c368b[_0x5d24('0x4d')]===0x0){return db[_0x5d24('0x23')][_0x5d24('0x46')]({'name':_0x3e4eab[_0x5d24('0x27')],'resourceId':_0x3e4eab['id'],'type':_0x5c368b[_0x5d24('0x27')],'sectionId':_0x5c368b['id']},{})['then'](function(){return _0x21f322;});}else{return _0x21f322;}})[_0x5d24('0x41')](function(_0x3b1c77){logger[_0x5d24('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b1c77);throw _0x3b1c77;});}return _0x21f322;})[_0x5d24('0x22')](respondWithResult(_0x44bf85,0xc9))[_0x5d24('0x41')](handleError(_0x44bf85,null));};exports['update']=function(_0x82aa80,_0x1d0501){if(_0x82aa80[_0x5d24('0x47')]['id']){delete _0x82aa80[_0x5d24('0x47')]['id'];}return db['CmCompany'][_0x5d24('0x45')]({'where':{'id':_0x82aa80[_0x5d24('0x43')]['id']}})[_0x5d24('0x22')](handleEntityNotFound(_0x1d0501,null))[_0x5d24('0x22')](saveUpdates(_0x82aa80[_0x5d24('0x47')],null))[_0x5d24('0x22')](respondWithResult(_0x1d0501,null))[_0x5d24('0x41')](handleError(_0x1d0501,null));};exports['destroy']=function(_0x2e5444,_0x229a4d){return db['CmCompany'][_0x5d24('0x45')]({'where':{'id':_0x2e5444['params']['id']}})[_0x5d24('0x22')](handleEntityNotFound(_0x229a4d,null))[_0x5d24('0x22')](removeEntity(_0x229a4d,null))[_0x5d24('0x41')](handleError(_0x229a4d,null));};exports[_0x5d24('0x2b')]=function(_0x2f7d73,_0x23dedc){return db['CmCompany'][_0x5d24('0x2b')]()[_0x5d24('0x22')](respondWithResult(_0x23dedc,null))[_0x5d24('0x41')](handleError(_0x23dedc,null));};exports[_0x5d24('0x4e')]=function(_0x129e6a,_0x1ad52f,_0x4b283f){return db[_0x5d24('0x4f')][_0x5d24('0x45')]({'where':{'id':_0x129e6a['params']['id']}})[_0x5d24('0x22')](handleEntityNotFound(_0x1ad52f,null))[_0x5d24('0x22')](function(_0x102a30){if(_0x102a30){return _0x102a30['addContacts'](_0x129e6a[_0x5d24('0x47')][_0x5d24('0x50')],_[_0x5d24('0x51')](_0x129e6a[_0x5d24('0x47')],[_0x5d24('0x50'),'id'])||{});}})[_0x5d24('0x22')](respondWithResult(_0x1ad52f,null))[_0x5d24('0x41')](handleError(_0x1ad52f,null));};exports[_0x5d24('0x52')]=function(_0x17e55b,_0x268b22,_0xf57e1d){var _0x582034={};var _0x55e221={};var _0x41bdbd;var _0x1a5a94;return db[_0x5d24('0x2a')][_0x5d24('0x53')]({'where':{'id':_0x17e55b[_0x5d24('0x43')]['id']}})['then'](handleEntityNotFound(_0x268b22,null))[_0x5d24('0x22')](function(_0x246304){if(_0x246304){_0x41bdbd=_0x246304;_0x55e221[_0x5d24('0x2c')]=_['keys'](db['CmContact'][_0x5d24('0x44')]);_0x55e221[_0x5d24('0x2e')]=_[_0x5d24('0x2d')](_0x17e55b[_0x5d24('0x2e')]);_0x55e221['filters']=_[_0x5d24('0x30')](_0x55e221[_0x5d24('0x2c')],_0x55e221[_0x5d24('0x2e')]);_0x582034[_0x5d24('0x31')]=_[_0x5d24('0x30')](_0x55e221['model'],qs[_0x5d24('0x32')](_0x17e55b[_0x5d24('0x2e')][_0x5d24('0x32')]));_0x582034[_0x5d24('0x31')]=_0x582034[_0x5d24('0x31')][_0x5d24('0x33')]?_0x582034[_0x5d24('0x31')]:_0x55e221[_0x5d24('0x2c')];_0x582034[_0x5d24('0x37')]=qs[_0x5d24('0x38')](_0x17e55b[_0x5d24('0x2e')]['sort']);_0x582034['where']=qs[_0x5d24('0x2f')](_[_0x5d24('0x54')](_0x17e55b['query'],_0x55e221['filters']));if(_0x17e55b[_0x5d24('0x2e')][_0x5d24('0x3a')]){_0x582034[_0x5d24('0x39')]=_[_0x5d24('0x3c')](_0x582034[_0x5d24('0x39')],{'$or':_['map'](_0x582034[_0x5d24('0x31')],function(_0x4f90fd){var _0x2d8dfd={};_0x2d8dfd[_0x4f90fd]={'$like':'%'+_0x17e55b['query']['filter']+'%'};return _0x2d8dfd;})});}_0x582034=_[_0x5d24('0x3c')]({},_0x582034,_0x17e55b[_0x5d24('0x3d')]);return _0x41bdbd[_0x5d24('0x52')](_0x582034);}})['then'](function(_0x2617e4){if(_0x2617e4){_0x1a5a94=_0x2617e4[_0x5d24('0x33')];if(!_0x17e55b[_0x5d24('0x2e')]['hasOwnProperty'](_0x5d24('0x35'))){_0x582034[_0x5d24('0x36')]=qs['limit'](_0x17e55b[_0x5d24('0x2e')][_0x5d24('0x36')]);_0x582034[_0x5d24('0x1c')]=qs['offset'](_0x17e55b[_0x5d24('0x2e')][_0x5d24('0x1c')]);}return _0x41bdbd[_0x5d24('0x52')](_0x582034);}})['then'](function(_0x2afe8f){if(_0x2afe8f){return _0x2afe8f?{'count':_0x1a5a94,'rows':_0x2afe8f}:null;}})[_0x5d24('0x22')](respondWithResult(_0x268b22,null))[_0x5d24('0x41')](handleError(_0x268b22,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index b207ecc..5ef59f5 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 _0xe238=['../../config/logger','moment','path','rimraf','./cmCompany.attributes','define','cm_companies'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe238,0xbd));var _0x8e23=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xe238[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8e23('0x0'))('api');var moment=require(_0x8e23('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8e23('0x2'));var rimraf=require(_0x8e23('0x3'));var config=require('../../config/environment');var attributes=require(_0x8e23('0x4'));module['exports']=function(_0x3104f6,_0x29b312){return _0x3104f6[_0x8e23('0x5')]('CmCompany',attributes,{'tableName':_0x8e23('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1db5=['cm_companies','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./cmCompany.attributes','exports','define','CmCompany'];(function(_0x5f2ece,_0x54639e){var _0x3a4986=function(_0xcfbff0){while(--_0xcfbff0){_0x5f2ece['push'](_0x5f2ece['shift']());}};_0x3a4986(++_0x54639e);}(_0x1db5,0x91));var _0x51db=function(_0x9bbc39,_0x19d669){_0x9bbc39=_0x9bbc39-0x0;var _0xdbc706=_0x1db5[_0x9bbc39];return _0xdbc706;};'use strict';var _=require(_0x51db('0x0'));var util=require('util');var logger=require(_0x51db('0x1'))('api');var moment=require(_0x51db('0x2'));var BPromise=require(_0x51db('0x3'));var rp=require(_0x51db('0x4'));var fs=require('fs');var path=require(_0x51db('0x5'));var rimraf=require('rimraf');var config=require(_0x51db('0x6'));var attributes=require(_0x51db('0x7'));module[_0x51db('0x8')]=function(_0x16d5d1,_0xd7ac2){return _0x16d5d1[_0x51db('0x9')](_0x51db('0xa'),attributes,{'tableName':_0x51db('0xb'),'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 a77053f..d78acec 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 _0x4a00=['CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','client','then','info'];(function(_0x3576c0,_0x196351){var _0x310e7d=function(_0x41c25e){while(--_0x41c25e){_0x3576c0['push'](_0x3576c0['shift']());}};_0x310e7d(++_0x196351);}(_0x4a00,0x1c3));var _0x04a0=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4a00[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require(_0x04a0('0x0'));var moment=require(_0x04a0('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x04a0('0x2'))['db'];var utils=require(_0x04a0('0x3'));var logger=require(_0x04a0('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x04a0('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39c87b,_0xacae57,_0x53ef10){return new BPromise(function(_0x43ac8a,_0xc1c197){return client['request'](_0x39c87b,_0x53ef10)[_0x04a0('0x6')](function(_0x294d8e){logger[_0x04a0('0x7')](_0x04a0('0x8'),_0xacae57,_0x04a0('0x9'));logger[_0x04a0('0xa')]('CmCompany,\x20%s,\x20%s,\x20%s',_0xacae57,_0x04a0('0x9'),JSON[_0x04a0('0xb')](_0x294d8e));if(_0x294d8e[_0x04a0('0xc')]){if(_0x294d8e['error'][_0x04a0('0xd')]===0x1f4){logger[_0x04a0('0xc')](_0x04a0('0x8'),_0xacae57,_0x294d8e['error'][_0x04a0('0xe')]);return _0xc1c197(_0x294d8e[_0x04a0('0xc')][_0x04a0('0xe')]);}logger[_0x04a0('0xc')](_0x04a0('0x8'),_0xacae57,_0x294d8e[_0x04a0('0xc')][_0x04a0('0xe')]);return _0x43ac8a(_0x294d8e[_0x04a0('0xc')][_0x04a0('0xe')]);}else{logger[_0x04a0('0x7')](_0x04a0('0x8'),_0xacae57,_0x04a0('0x9'));_0x43ac8a(_0x294d8e[_0x04a0('0xf')][_0x04a0('0xe')]);}})[_0x04a0('0x10')](function(_0x1a4b0e){logger[_0x04a0('0xc')](_0x04a0('0x8'),_0xacae57,_0x1a4b0e);_0xc1c197(_0x1a4b0e);});});} \ No newline at end of file +var _0xd37d=['../../config/utils','rpc','jayson/promise','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x564242,_0x4159f7){var _0x2906fb=function(_0xed2acc){while(--_0xed2acc){_0x564242['push'](_0x564242['shift']());}};_0x2906fb(++_0x4159f7);}(_0xd37d,0xb6));var _0xdd37=function(_0x33e864,_0x2d8439){_0x33e864=_0x33e864-0x0;var _0x1787d7=_0xd37d[_0x33e864];return _0x1787d7;};'use strict';var _=require(_0xdd37('0x0'));var util=require(_0xdd37('0x1'));var moment=require(_0xdd37('0x2'));var BPromise=require(_0xdd37('0x3'));var rs=require(_0xdd37('0x4'));var fs=require('fs');var Redis=require(_0xdd37('0x5'));var db=require(_0xdd37('0x6'))['db'];var utils=require(_0xdd37('0x7'));var logger=require('../../config/logger')(_0xdd37('0x8'));var config=require('../../config/environment');var jayson=require(_0xdd37('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x47c6d1,_0x1ff1de,_0x538515){return new BPromise(function(_0x252a38,_0x385641){return client['request'](_0x47c6d1,_0x538515)[_0xdd37('0xa')](function(_0x27c481){logger[_0xdd37('0xb')](_0xdd37('0xc'),_0x1ff1de,_0xdd37('0xd'));logger['debug'](_0xdd37('0xe'),_0x1ff1de,_0xdd37('0xd'),JSON[_0xdd37('0xf')](_0x27c481));if(_0x27c481['error']){if(_0x27c481[_0xdd37('0x10')][_0xdd37('0x11')]===0x1f4){logger[_0xdd37('0x10')](_0xdd37('0xc'),_0x1ff1de,_0x27c481[_0xdd37('0x10')][_0xdd37('0x12')]);return _0x385641(_0x27c481[_0xdd37('0x10')]['message']);}logger[_0xdd37('0x10')](_0xdd37('0xc'),_0x1ff1de,_0x27c481[_0xdd37('0x10')][_0xdd37('0x12')]);return _0x252a38(_0x27c481[_0xdd37('0x10')]['message']);}else{logger[_0xdd37('0xb')](_0xdd37('0xc'),_0x1ff1de,_0xdd37('0xd'));_0x252a38(_0x27c481[_0xdd37('0x13')]['message']);}})[_0xdd37('0x14')](function(_0x58c586){logger['error'](_0xdd37('0xc'),_0x1ff1de,_0x58c586);_0x385641(_0x58c586);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index e08b721..d7b650f 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 _0x7ffc=['../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/contacts','getContacts','create','post','put','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x29b34c,_0x3aebc8){var _0x595b12=function(_0x58d9bc){while(--_0x58d9bc){_0x29b34c['push'](_0x29b34c['shift']());}};_0x595b12(++_0x3aebc8);}(_0x7ffc,0x144));var _0xc7ff=function(_0xcdd749,_0x19f007){_0xcdd749=_0xcdd749-0x0;var _0xa16c06=_0x7ffc[_0xcdd749];return _0xa16c06;};'use strict';var multer=require(_0xc7ff('0x0'));var util=require(_0xc7ff('0x1'));var path=require(_0xc7ff('0x2'));var timeout=require(_0xc7ff('0x3'));var express=require(_0xc7ff('0x4'));var router=express[_0xc7ff('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc7ff('0x6'));var controller=require('./cmCompany.controller');router['get']('/',auth[_0xc7ff('0x7')](),controller[_0xc7ff('0x8')]);router[_0xc7ff('0x9')](_0xc7ff('0xa'),auth[_0xc7ff('0x7')](),controller[_0xc7ff('0xb')]);router[_0xc7ff('0x9')](_0xc7ff('0xc'),auth['isAuthenticated'](),controller[_0xc7ff('0xd')]);router[_0xc7ff('0x9')](_0xc7ff('0xe'),auth[_0xc7ff('0x7')](),controller[_0xc7ff('0xf')]);router['post']('/',auth[_0xc7ff('0x7')](),controller[_0xc7ff('0x10')]);router[_0xc7ff('0x11')](_0xc7ff('0xe'),auth['isAuthenticated'](),controller['addContacts']);router[_0xc7ff('0x12')](_0xc7ff('0xc'),auth['isAuthenticated'](),controller[_0xc7ff('0x13')]);router[_0xc7ff('0x14')](_0xc7ff('0xc'),auth[_0xc7ff('0x7')](),controller['destroy']);module[_0xc7ff('0x15')]=router; \ No newline at end of file +var _0x6829=['describe','show','/:id/contacts','getContacts','post','create','addContacts','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6829,0xf3));var _0x9682=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x6829[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0x9682('0x0'));var util=require(_0x9682('0x1'));var path=require(_0x9682('0x2'));var timeout=require(_0x9682('0x3'));var express=require(_0x9682('0x4'));var router=express[_0x9682('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9682('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmCompany.controller');router[_0x9682('0x7')]('/',auth[_0x9682('0x8')](),controller['index']);router[_0x9682('0x7')]('/describe',auth[_0x9682('0x8')](),controller[_0x9682('0x9')]);router[_0x9682('0x7')]('/:id',auth[_0x9682('0x8')](),controller[_0x9682('0xa')]);router[_0x9682('0x7')](_0x9682('0xb'),auth[_0x9682('0x8')](),controller[_0x9682('0xc')]);router[_0x9682('0xd')]('/',auth[_0x9682('0x8')](),controller[_0x9682('0xe')]);router['post'](_0x9682('0xb'),auth[_0x9682('0x8')](),controller[_0x9682('0xf')]);router[_0x9682('0x10')](_0x9682('0x11'),auth[_0x9682('0x8')](),controller[_0x9682('0x12')]);router[_0x9682('0x13')]('/:id',auth[_0x9682('0x8')](),controller[_0x9682('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index fd1c6e9..4c2a9db 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 _0x3fde=['STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize','exports'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x3fde,0xcc));var _0xe3fd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3fde[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xe3fd('0x0'));var Sequelize=require(_0xe3fd('0x1'));module[_0xe3fd('0x2')]={'firstName':{'type':Sequelize[_0xe3fd('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xe3fd('0x3')]},'street':{'type':Sequelize[_0xe3fd('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xe3fd('0x3')]},'country':{'type':Sequelize[_0xe3fd('0x3')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe3fd('0x4')]},'phone':{'type':Sequelize[_0xe3fd('0x3')]},'mobile':{'type':Sequelize[_0xe3fd('0x3')]},'fax':{'type':Sequelize[_0xe3fd('0x3')]},'email':{'type':Sequelize[_0xe3fd('0x3')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0xe3fd('0x3')]},'twitter':{'type':Sequelize[_0xe3fd('0x3')]},'skype':{'type':Sequelize[_0xe3fd('0x3')]},'teams':{'type':Sequelize[_0xe3fd('0x3')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0xe3fd('0x3')]},'wechat':{'type':Sequelize[_0xe3fd('0x3')]},'telegram':{'type':Sequelize[_0xe3fd('0x3')]},'UserId':{'type':Sequelize[_0xe3fd('0x5')]},'AdditionalPhones':{'type':Sequelize[_0xe3fd('0x3')]},'priority':{'type':Sequelize[_0xe3fd('0x5')](0x2)[_0xe3fd('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xe3fd('0x7')],'defaultValue':Sequelize[_0xe3fd('0x8')]},'dialTimezone':{'type':Sequelize[_0xe3fd('0x3')]},'utcOffset':{'type':Sequelize[_0xe3fd('0x5')]}}; \ No newline at end of file +var _0xb0d1=['DATE','lodash','sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED'];(function(_0x42f981,_0x3a8798){var _0x55b62a=function(_0x39ce44){while(--_0x39ce44){_0x42f981['push'](_0x42f981['shift']());}};_0x55b62a(++_0x3a8798);}(_0xb0d1,0x159));var _0x1b0d=function(_0x2d04cf,_0x5706ff){_0x2d04cf=_0x2d04cf-0x0;var _0xc2f0e=_0xb0d1[_0x2d04cf];return _0xc2f0e;};'use strict';var _=require(_0x1b0d('0x0'));var Sequelize=require(_0x1b0d('0x1'));module[_0x1b0d('0x2')]={'firstName':{'type':Sequelize[_0x1b0d('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x1b0d('0x3')]},'street':{'type':Sequelize[_0x1b0d('0x3')]},'postalCode':{'type':Sequelize[_0x1b0d('0x3')]},'city':{'type':Sequelize[_0x1b0d('0x3')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x1b0d('0x3')]},'description':{'type':Sequelize[_0x1b0d('0x4')]},'phone':{'type':Sequelize[_0x1b0d('0x3')]},'mobile':{'type':Sequelize[_0x1b0d('0x3')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x1b0d('0x3')]},'url':{'type':Sequelize[_0x1b0d('0x3')]},'facebook':{'type':Sequelize[_0x1b0d('0x3')]},'fb_data':{'type':Sequelize[_0x1b0d('0x3')]},'twitter':{'type':Sequelize[_0x1b0d('0x3')]},'skype':{'type':Sequelize[_0x1b0d('0x3')]},'teams':{'type':Sequelize[_0x1b0d('0x3')]},'viber':{'type':Sequelize[_0x1b0d('0x3')]},'line':{'type':Sequelize[_0x1b0d('0x3')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x1b0d('0x3')]},'UserId':{'type':Sequelize[_0x1b0d('0x5')]},'AdditionalPhones':{'type':Sequelize[_0x1b0d('0x3')]},'priority':{'type':Sequelize[_0x1b0d('0x5')](0x2)[_0x1b0d('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x1b0d('0x7')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0x1b0d('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index b768b77..75362fa 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 _0xea05=['order','pick','filter','nolimit','findOne','ids','setAdditionalPhones','OrderBy','item_types','items','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','intersection','ContactId','options','includeAll','getHopperHistories','sort','include','rows','getHopperFinals','rawAttributes','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','No\x20phone\x20column\x20specified','firstName','root','server/files/tmp','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','upload','createReadStream','parse','file','meta','import','agent','binding','No\x20firstName\x20column\x20specified','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','pid','exit','error\x20child\x20process','importUpdates','User','message','chat','sms','whatsapp','voice','-createdAt','channel','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','destination','callerid','duration','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','DESC','findAndCountAll','fullname','startCase','Website','Account','closed','closedAt','note','disposition','secondDisposition','key','Owner','browserName','customerPort','deviceModel','ratingMessage','ratingType','referer','mail','subject','substatus','externalUrl','flatten','sortBy','reverse','value','slice','moment','util','path','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','socket.io-emitter','./cmContact.socket','register','status','undefined','limit','count','offset','set','update','then','destroy','end','sendStatus','name','send','describe','getOptions','findAll','user','CmContact','find','keys','length','startsWith','columnName','analytics','query','CmCustomField','cf_','displayName','alias','values','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','catch','merge','body','from','get','mergeWith','isArray','tags','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','info','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','SmsInteraction','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','ChatQueueReport','FaxQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','isNil','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','push','ListId','findOrCreate','spread','all','show','params','Tag','Tags','color','CmContactHasItem','Phones','ContactItemType','ItemType','sequelize','literal','$and','omit','map','format','cf_%d','dialTimezone','isEmpty','table','cm_contacts','setFields','toParam','phone','getTags','model','filters','attributes','fields'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0xea05,0x7b));var _0x5ea0=function(_0x380165,_0x4df1cf){_0x380165=_0x380165-0x0;var _0x2183c7=_0xea05[_0x380165];return _0x2183c7;};'use strict';var moment=require(_0x5ea0('0x0'));var BPromise=require('bluebird');var util=require(_0x5ea0('0x1'));var path=require(_0x5ea0('0x2'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x5ea0('0x3'));var contacts=require(_0x5ea0('0x4'));var qs=require(_0x5ea0('0x5'));var logger=require(_0x5ea0('0x6'))(_0x5ea0('0x7'));var config=require(_0x5ea0('0x8'));var shared=require(_0x5ea0('0x9'));var db=require(_0x5ea0('0xa'))['db'];config[_0x5ea0('0xb')]=_[_0x5ea0('0xc')](config[_0x5ea0('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x5ea0('0xd'))(new Redis(config['redis']));require(_0x5ea0('0xe'))[_0x5ea0('0xf')](socket);function respondWithResult(_0x1b1ee7,_0x4a8042){_0x4a8042=_0x4a8042||0xc8;return function(_0x373b72){if(_0x373b72){return _0x1b1ee7[_0x5ea0('0x10')](_0x4a8042)['json'](_0x373b72);}};}function respondWithFilteredResult(_0x1f9e20,_0x1762ac){return function(_0x16ed71){if(_0x16ed71){var _0xcf5b48=typeof _0x1762ac['offset']===_0x5ea0('0x11')&&typeof _0x1762ac[_0x5ea0('0x12')]===_0x5ea0('0x11');var _0x35e3ae=_0x16ed71[_0x5ea0('0x13')];var _0x312edc=_0xcf5b48?0x0:_0x1762ac[_0x5ea0('0x14')];var _0x57ff29=_0xcf5b48?_0x16ed71[_0x5ea0('0x13')]:_0x1762ac[_0x5ea0('0x14')]+_0x1762ac[_0x5ea0('0x12')];var _0x3e6b15;if(_0x57ff29>=_0x35e3ae){_0x57ff29=_0x35e3ae;_0x3e6b15=0xc8;}else{_0x3e6b15=0xce;}_0x1f9e20[_0x5ea0('0x10')](_0x3e6b15);return _0x1f9e20[_0x5ea0('0x15')]('Content-Range',_0x312edc+'-'+_0x57ff29+'/'+_0x35e3ae)['json'](_0x16ed71);}return null;};}function saveUpdates(_0x3d0b7c){return function(_0x1091d1){if(_0x1091d1){return _0x1091d1[_0x5ea0('0x16')](_0x3d0b7c)[_0x5ea0('0x17')](function(_0x598c71){return _0x598c71;});}return null;};}function removeEntity(_0x53a49f){return function(_0x35284d){if(_0x35284d){return _0x35284d[_0x5ea0('0x18')]()[_0x5ea0('0x17')](function(){_0x53a49f['status'](0xcc)[_0x5ea0('0x19')]();});}};}function handleEntityNotFound(_0x56aba3){return function(_0x119d67){if(!_0x119d67){_0x56aba3[_0x5ea0('0x1a')](0x194);}return _0x119d67;};}function handleError(_0x4485d7,_0x3dc778){_0x3dc778=_0x3dc778||0x1f4;return function(_0x2004ec){logger['error'](_0x2004ec['stack']);if(_0x2004ec[_0x5ea0('0x1b')]){delete _0x2004ec[_0x5ea0('0x1b')];}_0x4485d7[_0x5ea0('0x10')](_0x3dc778)[_0x5ea0('0x1c')](_0x2004ec);};}exports['index']=function(_0x46a8fa,_0x18658d){var _0x307299={};return contacts[_0x5ea0('0x1d')]()[_0x5ea0('0x17')](function(_0x2daecb){_0x307299=qs[_0x5ea0('0x1e')](_0x2daecb,_0x46a8fa);return contacts[_0x5ea0('0x1f')](_0x46a8fa['query'],_0x46a8fa[_0x5ea0('0x20')],_0x307299,_0x2daecb);})[_0x5ea0('0x17')](respondWithFilteredResult(_0x18658d,_0x307299))['catch'](handleError(_0x18658d,null));};exports['destroy']=function(_0x52ab96,_0xb42a63){return db[_0x5ea0('0x21')][_0x5ea0('0x22')]({'where':{'id':_0x52ab96['params']['id']}})[_0x5ea0('0x17')](handleEntityNotFound(_0xb42a63,null))[_0x5ea0('0x17')](removeEntity(_0xb42a63,null))['catch'](handleError(_0xb42a63,null));};exports[_0x5ea0('0x1d')]=function(_0x4ed0b6,_0x5c97f6){return db[_0x5ea0('0x21')]['describe']()[_0x5ea0('0x17')](function(_0x10d0e0){delete _0x10d0e0['tags'];for(var _0x11555f=0x0;_0x11555f0x0){return new Promise(function(_0x182512){var _0x56b2b5=[];for(var _0x1311df=0x0;_0x1311df<_0x4bcd76['length'];_0x1311df++){_0x56b2b5[_0x5ea0('0x5c')](insertAdditionalPhones(_0x4bcd76[_0x1311df]['contact'],_0x4bcd76[_0x1311df]['additionalPhones']));}Promise[_0x5ea0('0x60')](_0x56b2b5)[_0x5ea0('0x17')](function(){_0x182512(0x1);});})['then'](function(){return{'success':_0x2f45fa,'failure':_0x176b9c,'duplicates':_0x3bfbe0};});}else{return{'success':_0x2f45fa,'failure':_0x176b9c,'duplicates':_0x3bfbe0};}}})['then'](respondWithResult(_0x33850c,0xc9))[_0x5ea0('0x31')](handleError(_0x33850c,null));};exports[_0x5ea0('0x61')]=function(_0x453771,_0x5b897d){var _0x1b2a25;return db[_0x5ea0('0x21')][_0x5ea0('0x1d')]()['then'](function(_0x396192){return db['CmContact'][_0x5ea0('0x22')]({'where':{'id':_0x453771[_0x5ea0('0x62')]['id']},'include':[{'model':db[_0x5ea0('0x63')],'as':_0x5ea0('0x64'),'attributes':['id',_0x5ea0('0x1b'),_0x5ea0('0x65')],'required':_0x453771[_0x5ea0('0x28')]['tag']?!![]:![]},{'model':db[_0x5ea0('0x66')],'as':_0x5ea0('0x67'),'where':{'CmContactId':_0x453771[_0x5ea0('0x62')]['id']},'required':![],'include':[{'model':db[_0x5ea0('0x68')],'as':_0x5ea0('0x69')}]}],'order':[db[_0x5ea0('0x6a')][_0x5ea0('0x6b')]('Phones.OrderBy')],'attributes':_['keys'](_0x396192)});})[_0x5ea0('0x17')](function(_0x4aea2f){if(!_['isNil'](_0x4aea2f)){_0x1b2a25=_0x4aea2f['get']({'plain':!![]});var _0x4f4f3d={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4aea2f&&_0x4aea2f['ListId']){if(_0x4aea2f[_0x5ea0('0x5d')]){_0x4f4f3d[_0x5ea0('0x5b')][_0x5ea0('0x6c')][_0x5ea0('0x5c')]({'ListId':{'$ne':_0x4aea2f['ListId']}});}}return db[_0x5ea0('0x29')][_0x5ea0('0x1f')](_0x4f4f3d);}})[_0x5ea0('0x17')](function(_0x455807){if(!_[_0x5ea0('0x54')](_0x455807)){return _[_0x5ea0('0x6d')](_0x1b2a25,_[_0x5ea0('0x6e')](_0x455807,function(_0x6bc691){return util[_0x5ea0('0x6f')](_0x5ea0('0x70'),_0x6bc691['id']);}));}})[_0x5ea0('0x17')](handleEntityNotFound(_0x5b897d,null))[_0x5ea0('0x17')](respondWithResult(_0x5b897d,null))[_0x5ea0('0x31')](handleError(_0x5b897d,null));};exports[_0x5ea0('0x16')]=function(_0x39e06a,_0x32c79c){var _0x23b644;if(_0x39e06a['body']['id']){delete _0x39e06a['body']['id'];}if(!_[_0x5ea0('0x54')](_0x39e06a[_0x5ea0('0x33')][_0x5ea0('0x71')])){var _0x5cde87=_0x39e06a[_0x5ea0('0x33')][_0x5ea0('0x71')];if(!_['isNil'](shared[_0x5ea0('0x55')][_0x5cde87]))_0x39e06a[_0x5ea0('0x33')][_0x5ea0('0x56')]=shared['timezones'][_0x5cde87][_0x5ea0('0x56')];}return db[_0x5ea0('0x21')][_0x5ea0('0x22')]({'where':{'id':_0x39e06a['params']['id']}})[_0x5ea0('0x17')](handleEntityNotFound(_0x32c79c,null))[_0x5ea0('0x17')](saveUpdates(_0x39e06a['body'],null))[_0x5ea0('0x17')](function(_0x22e831){_0x23b644=_0x22e831;var _0x6c6c4={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x22e831&&_0x22e831[_0x5ea0('0x5d')]){if(_0x22e831['ListId']){_0x6c6c4[_0x5ea0('0x5b')][_0x5ea0('0x6c')][_0x5ea0('0x5c')]({'ListId':{'$ne':_0x22e831['ListId']}});}}return db[_0x5ea0('0x29')][_0x5ea0('0x1f')](_0x6c6c4);})[_0x5ea0('0x17')](function(_0x4c358){if(_0x4c358){return _[_0x5ea0('0x6d')](_['pickBy'](_0x39e06a[_0x5ea0('0x33')],function(_0xf19be7,_0x23a979){return _[_0x5ea0('0x25')](_0x23a979,_0x5ea0('0x2a'));}),_[_0x5ea0('0x6e')](_0x4c358,function(_0x1c0b0b){return util['format'](_0x5ea0('0x70'),_0x1c0b0b['id']);}));}})[_0x5ea0('0x17')](function(_0x4c217d){if(_0x4c217d&&!_[_0x5ea0('0x72')](_0x4c217d)){var _0x3e34f7=squel[_0x5ea0('0x16')]()[_0x5ea0('0x73')](_0x5ea0('0x74'))[_0x5ea0('0x75')](_0x4c217d)[_0x5ea0('0x5b')]('id\x20=\x20?',_0x39e06a[_0x5ea0('0x62')]['id'])[_0x5ea0('0x76')]();return db[_0x5ea0('0x6a')]['query'](_0x3e34f7['text'],{'replacements':_0x3e34f7[_0x5ea0('0x2d')]});}})[_0x5ea0('0x17')](function(){if(_0x39e06a[_0x5ea0('0x33')][_0x5ea0('0x77')]&&_0x23b644){return db[_0x5ea0('0x3b')]['update']({'phone':_0x39e06a['body']['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x23b644['id']}});}})[_0x5ea0('0x17')](function(){return _0x23b644;})['then'](respondWithResult(_0x32c79c,null))[_0x5ea0('0x31')](handleError(_0x32c79c,null));};exports[_0x5ea0('0x78')]=function(_0x1e1a14,_0x2a6032){var _0x22f1c3={};var _0x3949cb={};var _0x2f8b09;var _0x43d252;return db[_0x5ea0('0x21')]['findOne']({'where':{'id':_0x1e1a14[_0x5ea0('0x62')]['id']}})[_0x5ea0('0x17')](handleEntityNotFound(_0x2a6032,null))[_0x5ea0('0x17')](function(_0x2c1c58){if(_0x2c1c58){_0x2f8b09=_0x2c1c58;_0x3949cb[_0x5ea0('0x79')]=_[_0x5ea0('0x23')](db[_0x5ea0('0x63')]['rawAttributes']);_0x3949cb[_0x5ea0('0x28')]=_['keys'](_0x1e1a14['query']);_0x3949cb[_0x5ea0('0x7a')]=_['intersection'](_0x3949cb[_0x5ea0('0x79')],_0x3949cb['query']);_0x22f1c3[_0x5ea0('0x7b')]=_['intersection'](_0x3949cb[_0x5ea0('0x79')],qs[_0x5ea0('0x7c')](_0x1e1a14['query'][_0x5ea0('0x7c')]));_0x22f1c3['attributes']=_0x22f1c3['attributes'][_0x5ea0('0x24')]?_0x22f1c3['attributes']:_0x3949cb['model'];_0x22f1c3[_0x5ea0('0x7d')]=qs['sort'](_0x1e1a14[_0x5ea0('0x28')]['sort']);_0x22f1c3[_0x5ea0('0x5b')]=qs['filters'](_[_0x5ea0('0x7e')](_0x1e1a14['query'],_0x3949cb[_0x5ea0('0x7a')]));if(_0x1e1a14[_0x5ea0('0x28')][_0x5ea0('0x7f')]){_0x22f1c3['where']=_[_0x5ea0('0x32')](_0x22f1c3[_0x5ea0('0x5b')],{'$or':_['map'](_0x22f1c3[_0x5ea0('0x7b')],function(_0x1536d8){var _0x3cc26={};_0x3cc26[_0x1536d8]={'$like':'%'+_0x1e1a14[_0x5ea0('0x28')][_0x5ea0('0x7f')]+'%'};return _0x3cc26;})});}_0x22f1c3=_[_0x5ea0('0x32')]({},_0x22f1c3,_0x1e1a14['options']);return _0x2f8b09['getTags'](_0x22f1c3);}})['then'](function(_0x37c117){if(_0x37c117){_0x43d252=_0x37c117[_0x5ea0('0x24')];if(!_0x1e1a14[_0x5ea0('0x28')][_0x5ea0('0x30')](_0x5ea0('0x80'))){_0x22f1c3[_0x5ea0('0x12')]=qs[_0x5ea0('0x12')](_0x1e1a14[_0x5ea0('0x28')]['limit']);_0x22f1c3[_0x5ea0('0x14')]=qs[_0x5ea0('0x14')](_0x1e1a14[_0x5ea0('0x28')][_0x5ea0('0x14')]);}return _0x2f8b09['getTags'](_0x22f1c3);}})[_0x5ea0('0x17')](function(_0x5d0d5c){if(_0x5d0d5c){return _0x5d0d5c?{'count':_0x43d252,'rows':_0x5d0d5c}:null;}})[_0x5ea0('0x17')](respondWithResult(_0x2a6032,null))['catch'](handleError(_0x2a6032,null));};exports['setTags']=function(_0x508312,_0xbed269){if(_0x508312[_0x5ea0('0x33')]['id']){delete _0x508312[_0x5ea0('0x33')]['id'];}return db[_0x5ea0('0x21')][_0x5ea0('0x81')]({'where':{'id':_0x508312[_0x5ea0('0x62')]['id']}})[_0x5ea0('0x17')](handleEntityNotFound(_0xbed269,null))['then'](function(_0x405db9){if(_0x405db9){return _0x405db9['setTags'](_0x508312[_0x5ea0('0x33')][_0x5ea0('0x82')]||[]);}return null;})[_0x5ea0('0x17')](respondWithResult(_0xbed269,null))[_0x5ea0('0x31')](handleError(_0xbed269,null));};exports[_0x5ea0('0x83')]=function(_0x456713,_0x3bd2c7){var _0x5efcc5=[];_0x5efcc5['push'](addAdditionalPhones(_0x456713['body']));Promise['all'](_0x5efcc5)[_0x5ea0('0x17')](function(){_0x5efcc5=[];_0x5efcc5[_0x5ea0('0x5c')](deleteCmHopperPhones(_0x456713[_0x5ea0('0x33')]['id']));_0x5efcc5[_0x5ea0('0x5c')](addCmHopperPhones(_0x456713[_0x5ea0('0x33')]['id']));Promise[_0x5ea0('0x60')](_0x5efcc5)[_0x5ea0('0x17')](function(){return[0x1];})['then'](respondWithResult(_0x3bd2c7,null));});};function addAdditionalPhones(_0x323cbe){var _0x1b5238;return new Promise(function(_0x3002b3){return db['CmContactHasItem']['destroy']({'where':{'CmContactId':_0x323cbe['id']}})[_0x5ea0('0x17')](function(){db['ContactItemType']['findAll']({'raw':!![],'attributes':['id',_0x5ea0('0x84')]})[_0x5ea0('0x17')](function(_0x24bd31){var _0x129258=[];for(var _0x50fec7=0x0;_0x50fec7<_0x323cbe['items'][_0x5ea0('0x24')];_0x50fec7++){var _0x48d8fa=_0x323cbe[_0x5ea0('0x85')]?_['isNil'](_0x323cbe[_0x5ea0('0x85')][_0x50fec7])?'':_0x323cbe[_0x5ea0('0x85')][_0x50fec7]:_0x323cbe[_0x5ea0('0x86')][_0x50fec7][_0x5ea0('0x87')]?_0x323cbe[_0x5ea0('0x86')][_0x50fec7]['ItemTypeId']:'';var _0x2dc8d9=_['isNil'](_0x323cbe['items'][_0x50fec7]['description'])?'':_0x323cbe[_0x5ea0('0x86')][_0x50fec7][_0x5ea0('0x88')];var _0x43fad5=_0x48d8fa+':'+_0x323cbe[_0x5ea0('0x86')][_0x50fec7]['phone']+'§'+_0x2dc8d9;if(_['isNil'](_0x1b5238))_0x1b5238=_0x43fad5;else _0x1b5238+=';'+_0x43fad5;var _0x2c3dce=null;var _0x581620=null;if(_0x323cbe['item_types']){if(!_[_0x5ea0('0x54')](_0x323cbe[_0x5ea0('0x85')][_0x50fec7])){_0x581620=_['find'](_0x24bd31,function(_0x25cb66){return _0x25cb66['id']===_0x323cbe[_0x5ea0('0x85')][_0x50fec7];});if(!_['isNil'](_0x581620)){_0x2c3dce=_0x581620[_0x5ea0('0x84')];}}}else{if(!_[_0x5ea0('0x54')](_0x323cbe[_0x5ea0('0x86')][_0x50fec7])){_0x581620=_[_0x5ea0('0x22')](_0x24bd31,function(_0x47de94){return _0x47de94['id']===_0x323cbe[_0x5ea0('0x86')][_0x50fec7][_0x5ea0('0x87')];});if(!_[_0x5ea0('0x54')](_0x581620)){_0x2c3dce=_0x50fec7;}}}if(_[_0x5ea0('0x54')](_0x2c3dce)){_0x2c3dce=0x64;}_0x129258[_0x5ea0('0x5c')](addAdditionalPhone(_0x323cbe['id'],_0x323cbe[_0x5ea0('0x86')][_0x50fec7]['phone'],_0x323cbe[_0x5ea0('0x85')]?_[_0x5ea0('0x54')](_0x323cbe[_0x5ea0('0x85')][_0x50fec7])?null:_0x323cbe[_0x5ea0('0x85')][_0x50fec7]:_0x323cbe[_0x5ea0('0x86')][_0x50fec7][_0x5ea0('0x87')]?_0x323cbe['items'][_0x50fec7][_0x5ea0('0x87')]:null,_0x2c3dce,_0x2dc8d9));}Promise[_0x5ea0('0x60')](_0x129258)[_0x5ea0('0x17')](function(){db['CmContact']['update']({'AdditionalPhones':_0x1b5238},{'where':{'id':_0x323cbe['id']}})[_0x5ea0('0x17')](function(){_0x3002b3(0x1);});});});});});}function addAdditionalPhone(_0x416189,_0x41ad95,_0x3fb1ca,_0x4f17c0,_0x567393){return db[_0x5ea0('0x66')]['find']({'where':{'CmContactId':_0x416189,'item':_0x41ad95}})[_0x5ea0('0x17')](function(_0x8b405d){if(_0x8b405d)logger[_0x5ea0('0x3c')](_0x5ea0('0x89'),_0x8b405d);else{db[_0x5ea0('0x66')]['create']({'CmContactId':_0x416189,'item':_0x41ad95,'ItemTypeId':_0x3fb1ca,'OrderBy':_0x4f17c0,'ItemClass':_0x5ea0('0x8a'),'description':_0x567393});}});}function deleteCmHopperPhones(_0x48a36a){return new Promise(function(_0x40ef64){return db['CmHopper'][_0x5ea0('0x1f')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x48a36a}})[_0x5ea0('0x17')](function(_0x2fed5a){db[_0x5ea0('0x8b')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x5ea0('0x6e')](_0x2fed5a,'id')}}});})[_0x5ea0('0x17')](function(){_0x40ef64(0x1);});});}function addCmHopperPhones(_0x4c4215){return new Promise(function(_0x4f8a82){return db[_0x5ea0('0x3b')][_0x5ea0('0x1f')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x4c4215}})[_0x5ea0('0x17')](function(_0x272883){var _0x1134e4=[];_[_0x5ea0('0x6e')](_0x272883,function(_0x172dbd){_0x1134e4[_0x5ea0('0x5c')](createCmHopperPhone(_0x4c4215,_0x172dbd['id']));});Promise[_0x5ea0('0x60')](_0x1134e4)['then'](function(){_0x4f8a82(0x1);});});});}function createCmHopperPhone(_0x11e0f4,_0x396bc1){return new Promise(function(_0x3e2887){db[_0x5ea0('0x66')][_0x5ea0('0x1f')]({'raw':!![],'attributes':[_0x5ea0('0x8c'),_0x5ea0('0x84')],'where':{'CmContactId':_0x11e0f4,'ItemClass':_0x5ea0('0x8a')},'include':[{'model':db[_0x5ea0('0x68')],'attributes':[_0x5ea0('0x84')],'as':_0x5ea0('0x69')}],'order':[_0x5ea0('0x84'),db['sequelize']['literal'](_0x5ea0('0x8d'))]})[_0x5ea0('0x17')](function(_0x123301){var _0x4877cd=0x1;var _0x1d9bd5=_[_0x5ea0('0x6e')](_0x123301,function(_0x5e1688){_0x5e1688[_0x5ea0('0x8e')]=_0x396bc1;_0x5e1688[_0x5ea0('0x77')]=_0x5e1688[_0x5ea0('0x8c')];_0x5e1688[_0x5ea0('0x84')]=_0x4877cd;delete _0x5e1688[_0x5ea0('0x8f')];_0x4877cd=_0x4877cd+0x1;return _0x5e1688;});return db[_0x5ea0('0x8b')][_0x5ea0('0x58')](_0x1d9bd5,{});})['then'](function(){_0x3e2887(0x1);});});}function insertAdditionalPhones(_0x276e1d,_0x1b8bdc){return new Promise(function(_0x18f96b){var _0x1a6cd4=[];for(var _0x479045=0x0;_0x479045<_0x1b8bdc[_0x5ea0('0x24')];_0x479045++){var _0x340490=_0x1b8bdc[_0x479045];_0x1a6cd4[_0x5ea0('0x5c')](parseContactItemType(_0x340490));}Promise['all'](_0x1a6cd4)[_0x5ea0('0x17')](function(){var _0x42c0f3={'id':_0x276e1d['id'],'items':_0x1b8bdc};return addAdditionalPhones(_0x42c0f3)[_0x5ea0('0x17')](function(){return addCmHopperPhones(_0x276e1d['id']);});})[_0x5ea0('0x17')](function(){_0x18f96b(_0x276e1d);});});}function parseContactItemType(_0x40fa1e){return new Promise(function(_0x317c11){if(_0x40fa1e['hasOwnProperty'](_0x5ea0('0x87'))){_0x317c11(_0x40fa1e);}else{return db[_0x5ea0('0x68')][_0x5ea0('0x22')]({'where':{'name':_0x40fa1e['ItemType']}})[_0x5ea0('0x17')](function(_0x16deb7){if(_[_0x5ea0('0x54')](_0x16deb7))_0x40fa1e[_0x5ea0('0x87')]=null;else _0x40fa1e['ItemTypeId']=_0x16deb7['id'];_0x317c11(_0x40fa1e);});}});}exports[_0x5ea0('0x90')]=function(_0x3e2287,_0xd1fe03){return db['CmContactHasItem'][_0x5ea0('0x1f')]({'raw':!![],'where':{'CmContactId':_0x3e2287[_0x5ea0('0x62')]['id'],'ItemClass':_0x5ea0('0x8a')},'include':[{'model':db[_0x5ea0('0x68')],'as':'ItemType'}],'order':[['OrderBy'],[db[_0x5ea0('0x6a')][_0x5ea0('0x6b')]('`ItemType`.OrderBy')]]})[_0x5ea0('0x17')](function(_0x387895){return _0x387895;})['then'](respondWithResult(_0xd1fe03,null))[_0x5ea0('0x31')](handleError(_0xd1fe03,null));};exports[_0x5ea0('0x91')]=function(_0x443820,_0x62e81e){return db['CmContactHasItem'][_0x5ea0('0x1f')]({'raw':!![],'where':{'CmContactId':_0x443820['body'][_0x5ea0('0x92')]}})['then'](function(_0x58a45a){var _0x5238a3=_[_0x5ea0('0x6e')](_0x58a45a,function(_0x1b681c){_0x1b681c[_0x5ea0('0x93')]=_0x443820[_0x5ea0('0x33')][_0x5ea0('0x94')];return _0x1b681c;});return db[_0x5ea0('0x66')]['bulkCreate'](_0x5238a3,{});})[_0x5ea0('0x17')](function(){return addCmHopperPhones(_0x443820['body'][_0x5ea0('0x94')]);})[_0x5ea0('0x17')](function(){return['ok'];})[_0x5ea0('0x17')](respondWithResult(_0x62e81e,null))[_0x5ea0('0x31')](handleError(_0x62e81e,null));};exports[_0x5ea0('0x95')]=function(_0x2cd70c,_0x14ded6){var _0x340057=[];_0x340057[_0x5ea0('0x5c')](createCmHopperPhone(_0x2cd70c['body']['id'],_0x2cd70c[_0x5ea0('0x33')][_0x5ea0('0x96')]));Promise[_0x5ea0('0x60')](_0x340057)[_0x5ea0('0x17')](function(){return[0x1];})[_0x5ea0('0x17')](respondWithResult(_0x14ded6,null));};exports['getHoppers']=function(_0x37beb9,_0x1c0564){var _0x5a8861={'raw':![],'where':{}};var _0x1bf2b9={};var _0x467e9b={'count':0x0,'rows':[]};return db[_0x5ea0('0x21')][_0x5ea0('0x81')]({'where':{'id':_0x37beb9[_0x5ea0('0x62')]['id']}})['then'](handleEntityNotFound(_0x1c0564,null))[_0x5ea0('0x17')](function(_0x3ca833){if(_0x3ca833){_0x1bf2b9['model']=_['keys'](db[_0x5ea0('0x3b')]['rawAttributes']);_0x1bf2b9[_0x5ea0('0x28')]=_[_0x5ea0('0x23')](_0x37beb9[_0x5ea0('0x28')]);_0x1bf2b9[_0x5ea0('0x7a')]=_['intersection'](_0x1bf2b9[_0x5ea0('0x79')],_0x1bf2b9['query']);_0x5a8861[_0x5ea0('0x7b')]=_[_0x5ea0('0x97')](_0x1bf2b9[_0x5ea0('0x79')],qs[_0x5ea0('0x7c')](_0x37beb9[_0x5ea0('0x28')][_0x5ea0('0x7c')]));_0x5a8861[_0x5ea0('0x7b')]=_0x5a8861['attributes']['length']?_0x5a8861[_0x5ea0('0x7b')]:_0x1bf2b9[_0x5ea0('0x79')];if(!_0x37beb9['query']['hasOwnProperty'](_0x5ea0('0x80'))){_0x5a8861[_0x5ea0('0x12')]=qs[_0x5ea0('0x12')](_0x37beb9[_0x5ea0('0x28')]['limit']);_0x5a8861[_0x5ea0('0x14')]=qs[_0x5ea0('0x14')](_0x37beb9[_0x5ea0('0x28')][_0x5ea0('0x14')]);}_0x5a8861['order']=qs['sort'](_0x37beb9['query']['sort']);_0x5a8861[_0x5ea0('0x5b')]=qs[_0x5ea0('0x7a')](_[_0x5ea0('0x7e')](_0x37beb9['query'],_0x1bf2b9[_0x5ea0('0x7a')]));_0x5a8861[_0x5ea0('0x5b')][_0x5ea0('0x98')]=_0x3ca833['id'];if(_0x37beb9[_0x5ea0('0x28')]['filter']){_0x5a8861['where']=_[_0x5ea0('0x32')](_0x5a8861[_0x5ea0('0x5b')],{'$or':_[_0x5ea0('0x6e')](_0x5a8861['attributes'],function(_0x17c32e){var _0x17d167={};_0x17d167[_0x17c32e]={'$like':'%'+_0x37beb9['query'][_0x5ea0('0x7f')]+'%'};return _0x17d167;})});}_0x5a8861=_['merge']({},_0x5a8861,_0x37beb9[_0x5ea0('0x99')]);return db[_0x5ea0('0x3b')]['count']({'where':_0x5a8861['where']})[_0x5ea0('0x17')](function(_0x5140c7){_0x467e9b[_0x5ea0('0x13')]=_0x5140c7;if(_0x37beb9[_0x5ea0('0x28')][_0x5ea0('0x9a')]){_0x5a8861['include']=[{'all':!![]}];}return db[_0x5ea0('0x3b')][_0x5ea0('0x1f')](_0x5a8861);})['then'](function(_0x577e4d){_0x467e9b['rows']=_0x577e4d;return _0x467e9b;});}})['then'](respondWithFilteredResult(_0x1c0564,_0x5a8861))[_0x5ea0('0x31')](handleError(_0x1c0564,null));};exports[_0x5ea0('0x9b')]=function(_0x1ee13e,_0x54f4dd){var _0x524212={'raw':!![],'where':{}};var _0x50a509={};var _0x2d4b0d={'count':0x0,'rows':[]};return db[_0x5ea0('0x21')][_0x5ea0('0x81')]({'where':{'id':_0x1ee13e[_0x5ea0('0x62')]['id']}})['then'](handleEntityNotFound(_0x54f4dd,null))[_0x5ea0('0x17')](function(_0x53d848){if(_0x53d848){_0x50a509[_0x5ea0('0x79')]=_[_0x5ea0('0x23')](db[_0x5ea0('0x4b')]['rawAttributes']);_0x50a509[_0x5ea0('0x28')]=_[_0x5ea0('0x23')](_0x1ee13e[_0x5ea0('0x28')]);_0x50a509[_0x5ea0('0x7a')]=_[_0x5ea0('0x97')](_0x50a509[_0x5ea0('0x79')],_0x50a509[_0x5ea0('0x28')]);_0x524212['attributes']=_['intersection'](_0x50a509[_0x5ea0('0x79')],qs[_0x5ea0('0x7c')](_0x1ee13e['query'][_0x5ea0('0x7c')]));_0x524212[_0x5ea0('0x7b')]=_0x524212[_0x5ea0('0x7b')][_0x5ea0('0x24')]?_0x524212[_0x5ea0('0x7b')]:_0x50a509[_0x5ea0('0x79')];if(!_0x1ee13e[_0x5ea0('0x28')]['hasOwnProperty'](_0x5ea0('0x80'))){_0x524212[_0x5ea0('0x12')]=qs['limit'](_0x1ee13e[_0x5ea0('0x28')]['limit']);_0x524212[_0x5ea0('0x14')]=qs[_0x5ea0('0x14')](_0x1ee13e['query'][_0x5ea0('0x14')]);}_0x524212[_0x5ea0('0x7d')]=qs[_0x5ea0('0x9c')](_0x1ee13e[_0x5ea0('0x28')][_0x5ea0('0x9c')]);_0x524212[_0x5ea0('0x5b')]=qs[_0x5ea0('0x7a')](_['pick'](_0x1ee13e['query'],_0x50a509['filters']));_0x524212[_0x5ea0('0x5b')][_0x5ea0('0x98')]=_0x53d848['id'];if(_0x1ee13e[_0x5ea0('0x28')]['filter']){_0x524212[_0x5ea0('0x5b')]=_[_0x5ea0('0x32')](_0x524212[_0x5ea0('0x5b')],{'$or':_['map'](_0x524212['attributes'],function(_0x2931f0){var _0x323562={};_0x323562[_0x2931f0]={'$like':'%'+_0x1ee13e[_0x5ea0('0x28')]['filter']+'%'};return _0x323562;})});}_0x524212=_['merge']({},_0x524212,_0x1ee13e['options']);return db['CmHopperHistory']['count']({'where':_0x524212[_0x5ea0('0x5b')]})[_0x5ea0('0x17')](function(_0x1839cf){_0x2d4b0d[_0x5ea0('0x13')]=_0x1839cf;if(_0x1ee13e['query'][_0x5ea0('0x9a')]){_0x524212[_0x5ea0('0x9d')]=[{'all':!![]}];}return db[_0x5ea0('0x4b')][_0x5ea0('0x1f')](_0x524212);})[_0x5ea0('0x17')](function(_0x4116a0){_0x2d4b0d[_0x5ea0('0x9e')]=_0x4116a0;return _0x2d4b0d;});}})['then'](respondWithFilteredResult(_0x54f4dd,_0x524212))[_0x5ea0('0x31')](handleError(_0x54f4dd,null));};exports[_0x5ea0('0x9f')]=function(_0x463159,_0x5133f5){var _0x45c9cd={'raw':!![],'where':{}};var _0x4797d9={};var _0x5ccfe5={'count':0x0,'rows':[]};return db[_0x5ea0('0x21')][_0x5ea0('0x81')]({'where':{'id':_0x463159[_0x5ea0('0x62')]['id']}})['then'](handleEntityNotFound(_0x5133f5,null))[_0x5ea0('0x17')](function(_0x311022){if(_0x311022){_0x4797d9[_0x5ea0('0x79')]=_['keys'](db[_0x5ea0('0x4a')][_0x5ea0('0xa0')]);_0x4797d9[_0x5ea0('0x28')]=_[_0x5ea0('0x23')](_0x463159[_0x5ea0('0x28')]);_0x4797d9[_0x5ea0('0x7a')]=_[_0x5ea0('0x97')](_0x4797d9['model'],_0x4797d9[_0x5ea0('0x28')]);_0x45c9cd[_0x5ea0('0x7b')]=_[_0x5ea0('0x97')](_0x4797d9['model'],qs['fields'](_0x463159['query'][_0x5ea0('0x7c')]));_0x45c9cd['attributes']=_0x45c9cd['attributes']['length']?_0x45c9cd[_0x5ea0('0x7b')]:_0x4797d9[_0x5ea0('0x79')];if(!_0x463159['query']['hasOwnProperty'](_0x5ea0('0x80'))){_0x45c9cd[_0x5ea0('0x12')]=qs['limit'](_0x463159[_0x5ea0('0x28')][_0x5ea0('0x12')]);_0x45c9cd[_0x5ea0('0x14')]=qs['offset'](_0x463159[_0x5ea0('0x28')][_0x5ea0('0x14')]);}_0x45c9cd[_0x5ea0('0x7d')]=qs[_0x5ea0('0x9c')](_0x463159[_0x5ea0('0x28')][_0x5ea0('0x9c')]);_0x45c9cd[_0x5ea0('0x5b')]=qs[_0x5ea0('0x7a')](_[_0x5ea0('0x7e')](_0x463159['query'],_0x4797d9['filters']));_0x45c9cd[_0x5ea0('0x5b')][_0x5ea0('0x98')]=_0x311022['id'];if(_0x463159[_0x5ea0('0x28')][_0x5ea0('0x7f')]){_0x45c9cd[_0x5ea0('0x5b')]=_[_0x5ea0('0x32')](_0x45c9cd['where'],{'$or':_[_0x5ea0('0x6e')](_0x45c9cd[_0x5ea0('0x7b')],function(_0x4cd93e){var _0x9ae5eb={};_0x9ae5eb[_0x4cd93e]={'$like':'%'+_0x463159[_0x5ea0('0x28')][_0x5ea0('0x7f')]+'%'};return _0x9ae5eb;})});}_0x45c9cd=_[_0x5ea0('0x32')]({},_0x45c9cd,_0x463159[_0x5ea0('0x99')]);return db['CmHopperFinal']['count']({'where':_0x45c9cd[_0x5ea0('0x5b')]})['then'](function(_0x3954de){_0x5ccfe5[_0x5ea0('0x13')]=_0x3954de;if(_0x463159[_0x5ea0('0x28')][_0x5ea0('0x9a')]){_0x45c9cd[_0x5ea0('0x9d')]=[{'all':!![]}];}return db[_0x5ea0('0x4a')][_0x5ea0('0x1f')](_0x45c9cd);})['then'](function(_0x25efef){_0x5ccfe5[_0x5ea0('0x9e')]=_0x25efef;return _0x5ccfe5;});}})[_0x5ea0('0x17')](respondWithFilteredResult(_0x5133f5,_0x45c9cd))[_0x5ea0('0x31')](handleError(_0x5133f5,null));};exports['getJscriptySessions']=function(_0x48af3c,_0x1fddf3){var _0x513fa8={'raw':!![],'where':{}};var _0x5692c6={};var _0x1b9446={'count':0x0,'rows':[]};return db['CmContact'][_0x5ea0('0x81')]({'where':{'id':_0x48af3c[_0x5ea0('0x62')]['id']}})[_0x5ea0('0x17')](handleEntityNotFound(_0x1fddf3,null))[_0x5ea0('0x17')](function(_0x254711){if(_0x254711){_0x5692c6[_0x5ea0('0x79')]=_[_0x5ea0('0x23')](db['JscriptySessionReport'][_0x5ea0('0xa0')]);_0x5692c6[_0x5ea0('0x28')]=_[_0x5ea0('0x23')](_0x48af3c[_0x5ea0('0x28')]);_0x5692c6[_0x5ea0('0x7a')]=_[_0x5ea0('0x97')](_0x5692c6['model'],_0x5692c6[_0x5ea0('0x28')]);_0x513fa8[_0x5ea0('0x7b')]=_[_0x5ea0('0x97')](_0x5692c6[_0x5ea0('0x79')],qs[_0x5ea0('0x7c')](_0x48af3c[_0x5ea0('0x28')][_0x5ea0('0x7c')]));_0x513fa8[_0x5ea0('0x7b')]=_0x513fa8[_0x5ea0('0x7b')]['length']?_0x513fa8[_0x5ea0('0x7b')]:_0x5692c6[_0x5ea0('0x79')];if(!_0x48af3c[_0x5ea0('0x28')][_0x5ea0('0x30')](_0x5ea0('0x80'))){_0x513fa8['limit']=qs[_0x5ea0('0x12')](_0x48af3c['query'][_0x5ea0('0x12')]);_0x513fa8[_0x5ea0('0x14')]=qs[_0x5ea0('0x14')](_0x48af3c[_0x5ea0('0x28')][_0x5ea0('0x14')]);}_0x513fa8[_0x5ea0('0x7d')]=qs[_0x5ea0('0x9c')](_0x48af3c[_0x5ea0('0x28')]['sort']);_0x513fa8[_0x5ea0('0x5b')]=qs['filters'](_[_0x5ea0('0x7e')](_0x48af3c['query'],_0x5692c6[_0x5ea0('0x7a')]));_0x513fa8[_0x5ea0('0x5b')]['ContactId']=_0x254711['id'];if(_0x48af3c[_0x5ea0('0x28')]['filter']){_0x513fa8[_0x5ea0('0x5b')]=_['merge'](_0x513fa8[_0x5ea0('0x5b')],{'$or':_[_0x5ea0('0x6e')](_0x513fa8[_0x5ea0('0x7b')],function(_0x1da4fc){var _0x3b9261={};_0x3b9261[_0x1da4fc]={'$like':'%'+_0x48af3c[_0x5ea0('0x28')][_0x5ea0('0x7f')]+'%'};return _0x3b9261;})});}_0x513fa8=_[_0x5ea0('0x32')]({},_0x513fa8,_0x48af3c[_0x5ea0('0x99')]);return db[_0x5ea0('0x51')]['count']({'where':_0x513fa8[_0x5ea0('0x5b')]})[_0x5ea0('0x17')](function(_0x103d5e){_0x1b9446[_0x5ea0('0x13')]=_0x103d5e;if(_0x48af3c[_0x5ea0('0x28')][_0x5ea0('0x9a')]){_0x513fa8[_0x5ea0('0x9d')]=[{'all':!![]}];}return db[_0x5ea0('0x51')]['findAll'](_0x513fa8);})[_0x5ea0('0x17')](function(_0x1bb3ea){_0x1b9446['rows']=_0x1bb3ea;return _0x1b9446;});}})['then'](respondWithFilteredResult(_0x1fddf3,_0x513fa8))[_0x5ea0('0x31')](handleError(_0x1fddf3,null));};exports['uploadCsv']=function(_0x331251,_0x5e3358){try{if(!_0x331251[_0x5ea0('0x33')][_0x5ea0('0x5d')]){throw new Error(_0x5ea0('0xa1'));}if(!_0x331251[_0x5ea0('0x33')][_0x5ea0('0xa2')]){throw new Error(_0x5ea0('0xa3'));}if(!_0x331251['body'][_0x5ea0('0xa4')]){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x331251['body'][_0x5ea0('0xa5')]){throw new Error(_0x5ea0('0xa6'));}var _0x223d30=_0x331251[_0x5ea0('0x33')][_0x5ea0('0xa2')][_0x5ea0('0xa7')](',');var _0x424235=_0x331251[_0x5ea0('0x33')]['binding_values'][_0x5ea0('0xa7')](',');if(!_0x223d30[_0x5ea0('0x24')]||!_0x424235[_0x5ea0('0x24')]||_0x223d30[_0x5ea0('0x24')]!==_0x424235[_0x5ea0('0x24')]){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x331251[_0x5ea0('0x33')]['fields']=_['zipObject'](_0x223d30,_0x424235);if(!_0x331251['body'][_0x5ea0('0x7c')]['phone']){throw new Error(_0x5ea0('0xa8'));}if(!_0x331251[_0x5ea0('0x33')][_0x5ea0('0x7c')][_0x5ea0('0xa9')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x337280=path['join'](config[_0x5ea0('0xaa')],_0x5ea0('0xab'),_0x331251['file'][_0x5ea0('0xac')]);fs[_0x5ea0('0xad')](_0x337280,parseInt(_0x5ea0('0xae'),0x8));var _0x3d71e4=require(_0x5ea0('0xaf'))[_0x5ea0('0xb0')](path[_0x5ea0('0x39')](__dirname,_0x5ea0('0xb1')),[_0x337280,_0x331251['body'][_0x5ea0('0xa2')],_0x331251[_0x5ea0('0x33')][_0x5ea0('0xa4')],_0x331251['body'][_0x5ea0('0x5d')],_0x331251[_0x5ea0('0x33')][_0x5ea0('0xb2')],_0x331251['body'][_0x5ea0('0x5a')],_0x331251['body'][_0x5ea0('0xa5')]]);return _0x5e3358[_0x5ea0('0x10')](0xc8)[_0x5ea0('0xb3')]({'message':_0x5ea0('0xb4'),'pid':_0x3d71e4['pid']});}catch(_0x461cfe){return _0x5e3358[_0x5ea0('0x10')](0x1f4)[_0x5ea0('0x1c')](_0x461cfe);}};exports[_0x5ea0('0xb5')]=function(_0x1261c9,_0x3a1641){var _0x515109=fs[_0x5ea0('0xb6')](_0x1261c9['file'][_0x5ea0('0x2')]);Papa[_0x5ea0('0xb7')](_0x515109,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x493631){return _0x3a1641['status'](0xc8)['json']({'file':_0x1261c9[_0x5ea0('0xb8')],'fields':_0x493631[_0x5ea0('0xb9')][_0x5ea0('0x7c')]});}});};exports[_0x5ea0('0xba')]=function(_0x562882,_0x50880a){return db['User']['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x5ea0('0xbb')}})[_0x5ea0('0x17')](function(_0x1d59a5){var _0x83127a=![];if(!_0x562882[_0x5ea0('0x33')]['ListId']){throw new Error(_0x5ea0('0xa1'));}if(!_0x562882[_0x5ea0('0x33')]['binding']['phone']){throw new Error(_0x5ea0('0xa8'));}if(!_0x562882[_0x5ea0('0x33')][_0x5ea0('0xbc')][_0x5ea0('0xa9')]){throw new Error(_0x5ea0('0xbd'));}if(!_0x562882[_0x5ea0('0x33')][_0x5ea0('0xa5')]){throw new Error(_0x5ea0('0xa6'));}var _0x4c5cf0=require(_0x5ea0('0xaf'))[_0x5ea0('0xb0')](path[_0x5ea0('0x39')](__dirname,_0x5ea0('0xbe')),[_0x562882[_0x5ea0('0x62')]['id'],JSON[_0x5ea0('0xbf')](_0x562882[_0x5ea0('0x33')]),JSON[_0x5ea0('0xbf')](_0x1d59a5)]);_0x4c5cf0['on']('message',function(){_0x83127a=!![];return _0x50880a[_0x5ea0('0x10')](0xc8)[_0x5ea0('0xb3')]({'message':_0x5ea0('0xc0'),'pid':_0x4c5cf0[_0x5ea0('0xc1')]});});_0x4c5cf0['on'](_0x5ea0('0xc2'),function(_0x1718ca){if(_0x1718ca&&!_0x83127a){return _0x50880a[_0x5ea0('0x10')](0x1f4)[_0x5ea0('0xb3')]({'message':_0x5ea0('0xc3'),'pid':_0x4c5cf0[_0x5ea0('0xc1')]});}});})[_0x5ea0('0x31')](handleError(_0x50880a,null));};exports[_0x5ea0('0xc4')]=function(_0x1b4961,_0x500d81){return db[_0x5ea0('0xc5')][_0x5ea0('0x1f')]({'raw':!![],'attributes':['id'],'where':{'role':_0x5ea0('0xbb')}})[_0x5ea0('0x17')](function(_0x3f9755){var _0x477570=![];if(!_0x1b4961[_0x5ea0('0x33')][_0x5ea0('0x5d')]){throw new Error(_0x5ea0('0xa1'));}if(!_0x1b4961['body'][_0x5ea0('0xbc')]['phone']){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x1b4961['body'][_0x5ea0('0xbc')]['firstName']){throw new Error(_0x5ea0('0xbd'));}if(!_0x1b4961['body']['socket_timestamp']){throw new Error(_0x5ea0('0xa6'));}var _0x49d139=require(_0x5ea0('0xaf'))['fork'](path[_0x5ea0('0x39')](__dirname,'../../components/import/cm/csvUpdates'),[_0x1b4961[_0x5ea0('0x62')]['id'],JSON[_0x5ea0('0xbf')](_0x1b4961['body']),JSON[_0x5ea0('0xbf')](_0x3f9755)]);_0x49d139['on'](_0x5ea0('0xc6'),function(){_0x477570=!![];return _0x500d81[_0x5ea0('0x10')](0xc8)[_0x5ea0('0xb3')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x49d139['pid']});});_0x49d139['on'](_0x5ea0('0xc2'),function(_0x537dc6){if(_0x537dc6&&!_0x477570){return _0x500d81[_0x5ea0('0x10')](0x1f4)[_0x5ea0('0xb3')]({'message':_0x5ea0('0xc3'),'pid':_0x49d139['pid']});}});})['catch'](handleError(_0x500d81,null));};exports['getJourney']=function(_0x4289cc,_0x845a88){var _0xf75fd9=['mail',_0x5ea0('0xc7'),_0x5ea0('0xc8'),'openchannel','fax',_0x5ea0('0xc9'),_0x5ea0('0xca')];var _0x4f486d={'offset':0x0,'order':qs['sort'](_0x5ea0('0xcb'))},_0x2c195f={'count':0x0,'rows':[]};Promise['resolve']()[_0x5ea0('0x17')](function(){if(_0x4289cc['query']['channel']){if(!_['includes'](_0xf75fd9,_0x4289cc[_0x5ea0('0x28')][_0x5ea0('0xcc')][_0x5ea0('0xcd')]())){throw new Error(_0x5ea0('0xce'));}_0xf75fd9=[_0x4289cc[_0x5ea0('0x28')]['channel']['toLowerCase']()];}if(_0x4289cc[_0x5ea0('0x28')]['range']){try{var _0x16218f=JSON[_0x5ea0('0xb7')](_0x4289cc[_0x5ea0('0x28')][_0x5ea0('0xcf')]);if(!moment(_0x16218f[_0x5ea0('0x34')])[_0x5ea0('0xd0')]()){throw new Error(_0x5ea0('0xd1'));}if(!moment(_0x16218f['to'])[_0x5ea0('0xd0')]()){throw new Error(_0x5ea0('0xd2'));}}catch(_0x3df7d0){throw new Error(_0x5ea0('0xd3'));}}if(!_0x4289cc[_0x5ea0('0x28')][_0x5ea0('0x30')](_0x5ea0('0x80'))){_0x4f486d[_0x5ea0('0x12')]=qs['limit'](_0x4289cc[_0x5ea0('0x28')]['limit']||0xa);_0x4f486d['offset']=qs[_0x5ea0('0x14')](_0x4289cc['query'][_0x5ea0('0x14')]);}var _0xd2b1e2=_0xf75fd9['map'](function(_0x297d80){if(_0x297d80==='voice'){var _0x28edca={'attributes':['id','uniqueid','type','source',_0x5ea0('0xd4'),_0x5ea0('0xd5'),'starttime','endtime',_0x5ea0('0xd6'),'note',_0x5ea0('0xd7'),_0x5ea0('0xd8'),_0x5ea0('0xd9'),_0x5ea0('0xda'),_0x5ea0('0xdb')],'where':{'ContactId':_0x4289cc[_0x5ea0('0x62')]['id']},'include':[{'model':db[_0x5ea0('0xc5')],'as':_0x5ea0('0xc5'),'attributes':['id',_0x5ea0('0x1b'),'fullname',_0x5ea0('0x2c')]}],'order':[[_0x5ea0('0xd7'),_0x5ea0('0xdc')]]};if(_0x4289cc['query'][_0x5ea0('0xcf')]){_0x28edca[_0x5ea0('0x5b')][_0x5ea0('0xd7')]={'$gte':_0x16218f[_0x5ea0('0x34')],'$lte':_0x16218f['to']};}return db['VoiceCallReport'][_0x5ea0('0xdd')](_0x28edca)[_0x5ea0('0x17')](function(_0x213fe4){_0x2c195f[_0x5ea0('0x13')]+=_0x213fe4[_0x5ea0('0x13')];return _[_0x5ea0('0x6e')](_0x213fe4['rows'],function(_0x1aae8c){var _0x1c8596=_0x1aae8c['get']({'plain':!![]});_0x1c8596[_0x5ea0('0xcc')]=_0x297d80;if(_0x1c8596[_0x5ea0('0xc5')]){_0x1c8596[_0x5ea0('0xc5')]={'id':_0x1c8596[_0x5ea0('0xc5')]['id'],'name':_0x1c8596[_0x5ea0('0xc5')][_0x5ea0('0x1b')],'fullname':_0x1c8596[_0x5ea0('0xc5')][_0x5ea0('0xde')],'alias':_0x1c8596[_0x5ea0('0xc5')][_0x5ea0('0x2c')]};}return _0x1c8596;});});}else{var _0x8e7860=_[_0x5ea0('0xdf')](_0x297d80)+(_0x297d80==='chat'?_0x5ea0('0xe0'):_0x5ea0('0xe1'));var _0xf8cd17={'attributes':['id',_0x5ea0('0xe2'),_0x5ea0('0xe3'),_0x5ea0('0xd7'),_0x5ea0('0xe4'),_0x5ea0('0xe5'),_0x5ea0('0xe6'),'thirdDisposition',_0x5ea0('0xdb'),_0x8e7860+'Id'],'where':{'ContactId':_0x4289cc[_0x5ea0('0x62')]['id']},'include':[{'model':db[_0x8e7860],'as':_0x5ea0('0xe1'),'attributes':['id',_0x5ea0('0x1b'),_0x5ea0('0xe7')]},{'model':db[_0x5ea0('0xc5')],'as':_0x5ea0('0xe8'),'attributes':['id',_0x5ea0('0x1b'),_0x5ea0('0xde')]},{'model':db['Tag'],'as':_0x5ea0('0x64'),'attributes':['id',_0x5ea0('0x1b'),_0x5ea0('0x65')],'through':{'attributes':[]}}],'order':[[_0x5ea0('0xd7'),_0x5ea0('0xdc')]]};if(_0x4289cc[_0x5ea0('0x28')]['range']){_0xf8cd17[_0x5ea0('0x5b')][_0x5ea0('0xd7')]={'$gte':_0x16218f[_0x5ea0('0x34')],'$lte':_0x16218f['to']};}switch(_0x297d80){case _0x5ea0('0xc7'):_0xf8cd17[_0x5ea0('0x7b')][_0x5ea0('0x5c')](_0x5ea0('0xe9'),'customerIp',_0x5ea0('0xea'),_0x5ea0('0xeb'),'osName',_0x5ea0('0xec'),_0x5ea0('0xed'),'ratingValue',_0x5ea0('0xee'));break;case _0x5ea0('0xef'):_0xf8cd17[_0x5ea0('0x7b')][_0x5ea0('0x5c')](_0x5ea0('0xf0'),_0x5ea0('0xf1'));break;case'openchannel':_0xf8cd17[_0x5ea0('0x7b')][_0x5ea0('0x5c')](_0x5ea0('0xf2'),'threadId');break;}return db[_[_0x5ea0('0xdf')](_0x297d80)+'Interaction']['findAndCountAll'](_0xf8cd17)[_0x5ea0('0x17')](function(_0x3a3141){_0x2c195f[_0x5ea0('0x13')]+=_0x3a3141['count'];return _['map'](_0x3a3141[_0x5ea0('0x9e')],function(_0x194b5f){var _0x3da651=_0x194b5f[_0x5ea0('0x35')]({'plain':!![]});_0x3da651[_0x5ea0('0xcc')]=_0x297d80;if(_0x3da651['Owner']){_0x3da651[_0x5ea0('0xe8')]={'id':_0x3da651[_0x5ea0('0xe8')]['id'],'name':_0x3da651[_0x5ea0('0xe8')][_0x5ea0('0x1b')],'fullname':_0x3da651['Owner'][_0x5ea0('0xde')]};}return _0x3da651;});});}});return Promise[_0x5ea0('0x60')](_0xd2b1e2);})[_0x5ea0('0x17')](function(_0x1c011d){return _(_0x1c011d)[_0x5ea0('0xf3')]()[_0x5ea0('0xf4')](_0x5ea0('0xd7'))[_0x5ea0('0xf5')]()[_0x5ea0('0xf6')]();})[_0x5ea0('0x17')](function(_0x5c09d2){_0x2c195f[_0x5ea0('0x9e')]=_0x4f486d['limit']?_0x5c09d2[_0x5ea0('0xf7')](_0x4f486d[_0x5ea0('0x14')],_0x4f486d[_0x5ea0('0x14')]+_0x4f486d[_0x5ea0('0x12')]):_0x5c09d2;return _0x2c195f;})[_0x5ea0('0x17')](respondWithFilteredResult(_0x845a88,_0x4f486d))['catch'](handleError(_0x845a88,null));}; \ No newline at end of file +var _0x409d=['CmContact','find','tags','keys','length','startsWith','columnName','displayName','analytics','CmCustomField','findAll','cf_','custom','type','values','hasOwnProperty','merge','body','from','get','mergeWith','isArray','CmHopper','info','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelMessage','CmContactHasItem','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','join','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','push','ListId','findOrCreate','all','show','params','color','tag','Phones','ItemType','sequelize','literal','Phones.OrderBy','$and','omit','map','format','pickBy','cf_%d','isEmpty','setFields','id\x20=\x20?','toParam','text','phone','findOne','model','rawAttributes','filters','attributes','intersection','fields','order','sort','pick','filter','setTags','ids','setAdditionalPhones','ContactItemType','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','`ItemType`.OrderBy','CmHopperId','item','ItemType.OrderBy','getAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','ContactId','options','count','includeAll','include','rows','getHopperHistories','getHopperFinals','CmHopperFinal','getJscriptySessions','nolimit','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','binding_values','Incorrect\x20binding\x20parameters\x20passed!','zipObject','firstName','No\x20firstName\x20column\x20specified','filename','chmodSync','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','file','parse','meta','agent','binding','No\x20phone\x20column\x20specified','fork','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','User','child_process','../../components/import/cm/csvUpdates','getJourney','mail','chat','sms','openchannel','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','endtime','note','createdAt','userDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','disposition','secondDisposition','thirdDisposition','key','Owner','Tag','Tags','browserName','customerIp','customerPort','deviceModel','ratingValue','referer','substatus','Interaction','flatten','sortBy','reverse','value','slice','moment','path','lodash','squel','papaparse','../../components/contacts','../../components/parsers/qs','../../config/environment/shared','../../mysqldb','redis','defaults','socket.io-emitter','./cmContact.socket','register','json','offset','undefined','limit','status','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','index','describe','getOptions','query','user','catch'];(function(_0x5393a6,_0x3c972d){var _0x477463=function(_0x5d6f37){while(--_0x5d6f37){_0x5393a6['push'](_0x5393a6['shift']());}};_0x477463(++_0x3c972d);}(_0x409d,0xdb));var _0xd409=function(_0x3e54d0,_0x1ce9a9){_0x3e54d0=_0x3e54d0-0x0;var _0x444d03=_0x409d[_0x3e54d0];return _0x444d03;};'use strict';var moment=require(_0xd409('0x0'));var BPromise=require('bluebird');var util=require('util');var path=require(_0xd409('0x1'));var fs=require('fs');var _=require(_0xd409('0x2'));var squel=require(_0xd409('0x3'));var Papa=require(_0xd409('0x4'));var Redis=require('ioredis');var contacts=require(_0xd409('0x5'));var qs=require(_0xd409('0x6'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var shared=require(_0xd409('0x7'));var db=require(_0xd409('0x8'))['db'];config[_0xd409('0x9')]=_[_0xd409('0xa')](config[_0xd409('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xd409('0xb'))(new Redis(config['redis']));require(_0xd409('0xc'))[_0xd409('0xd')](socket);function respondWithResult(_0xdc12a8,_0x1104a6){_0x1104a6=_0x1104a6||0xc8;return function(_0x403e18){if(_0x403e18){return _0xdc12a8['status'](_0x1104a6)[_0xd409('0xe')](_0x403e18);}};}function respondWithFilteredResult(_0x24aed6,_0x1c6eca){return function(_0x3bf5e6){if(_0x3bf5e6){var _0x3ca069=typeof _0x1c6eca[_0xd409('0xf')]===_0xd409('0x10')&&typeof _0x1c6eca[_0xd409('0x11')]==='undefined';var _0x43e33e=_0x3bf5e6['count'];var _0xd903cf=_0x3ca069?0x0:_0x1c6eca[_0xd409('0xf')];var _0x1deb69=_0x3ca069?_0x3bf5e6['count']:_0x1c6eca[_0xd409('0xf')]+_0x1c6eca[_0xd409('0x11')];var _0x50f866;if(_0x1deb69>=_0x43e33e){_0x1deb69=_0x43e33e;_0x50f866=0xc8;}else{_0x50f866=0xce;}_0x24aed6[_0xd409('0x12')](_0x50f866);return _0x24aed6[_0xd409('0x13')](_0xd409('0x14'),_0xd903cf+'-'+_0x1deb69+'/'+_0x43e33e)['json'](_0x3bf5e6);}return null;};}function saveUpdates(_0x2532e9){return function(_0x5ae8a9){if(_0x5ae8a9){return _0x5ae8a9[_0xd409('0x15')](_0x2532e9)[_0xd409('0x16')](function(_0x21ae6f){return _0x21ae6f;});}return null;};}function removeEntity(_0x5155c1){return function(_0x51de57){if(_0x51de57){return _0x51de57[_0xd409('0x17')]()[_0xd409('0x16')](function(){_0x5155c1[_0xd409('0x12')](0xcc)[_0xd409('0x18')]();});}};}function handleEntityNotFound(_0x3e43e6){return function(_0x1313f2){if(!_0x1313f2){_0x3e43e6[_0xd409('0x19')](0x194);}return _0x1313f2;};}function handleError(_0x532ca0,_0x53924b){_0x53924b=_0x53924b||0x1f4;return function(_0x3d9a3e){logger[_0xd409('0x1a')](_0x3d9a3e[_0xd409('0x1b')]);if(_0x3d9a3e['name']){delete _0x3d9a3e[_0xd409('0x1c')];}_0x532ca0[_0xd409('0x12')](_0x53924b)[_0xd409('0x1d')](_0x3d9a3e);};}exports[_0xd409('0x1e')]=function(_0x2ba777,_0x370a72){var _0x34f601={};return contacts[_0xd409('0x1f')]()[_0xd409('0x16')](function(_0x2ee8f2){_0x34f601=qs[_0xd409('0x20')](_0x2ee8f2,_0x2ba777);return contacts['findAll'](_0x2ba777[_0xd409('0x21')],_0x2ba777[_0xd409('0x22')],_0x34f601,_0x2ee8f2);})[_0xd409('0x16')](respondWithFilteredResult(_0x370a72,_0x34f601))[_0xd409('0x23')](handleError(_0x370a72,null));};exports['destroy']=function(_0x9e1559,_0x2d6b93){return db[_0xd409('0x24')][_0xd409('0x25')]({'where':{'id':_0x9e1559['params']['id']}})['then'](handleEntityNotFound(_0x2d6b93,null))['then'](removeEntity(_0x2d6b93,null))['catch'](handleError(_0x2d6b93,null));};exports[_0xd409('0x1f')]=function(_0xabb3d8,_0x1f4e80){return db[_0xd409('0x24')][_0xd409('0x1f')]()[_0xd409('0x16')](function(_0x5b745b){delete _0x5b745b[_0xd409('0x26')];for(var _0x424264=0x0;_0x4242640x0){return new Promise(function(_0x51c1d8){var _0x4d6b39=[];for(var _0x25cb28=0x0;_0x25cb28<_0x5c24b8[_0xd409('0x28')];_0x25cb28++){_0x4d6b39[_0xd409('0x5e')](insertAdditionalPhones(_0x5c24b8[_0x25cb28]['contact'],_0x5c24b8[_0x25cb28][_0xd409('0x59')]));}Promise[_0xd409('0x61')](_0x4d6b39)[_0xd409('0x16')](function(){_0x51c1d8(0x1);});})[_0xd409('0x16')](function(){return{'success':_0x6c170c,'failure':_0x48fda9,'duplicates':_0x340d5d};});}else{return{'success':_0x6c170c,'failure':_0x48fda9,'duplicates':_0x340d5d};}}})[_0xd409('0x16')](respondWithResult(_0x396c69,0xc9))[_0xd409('0x23')](handleError(_0x396c69,null));};exports[_0xd409('0x62')]=function(_0x228245,_0x21c1e9){var _0x18f6cc;return db[_0xd409('0x24')][_0xd409('0x1f')]()['then'](function(_0x345093){return db[_0xd409('0x24')][_0xd409('0x25')]({'where':{'id':_0x228245[_0xd409('0x63')]['id']},'include':[{'model':db['Tag'],'as':'Tags','attributes':['id',_0xd409('0x1c'),_0xd409('0x64')],'required':_0x228245[_0xd409('0x21')][_0xd409('0x65')]?!![]:![]},{'model':db[_0xd409('0x49')],'as':_0xd409('0x66'),'where':{'CmContactId':_0x228245[_0xd409('0x63')]['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':_0xd409('0x67')}]}],'order':[db[_0xd409('0x68')][_0xd409('0x69')](_0xd409('0x6a'))],'attributes':_[_0xd409('0x27')](_0x345093)});})[_0xd409('0x16')](function(_0x1e7bcb){if(!_[_0xd409('0x55')](_0x1e7bcb)){_0x18f6cc=_0x1e7bcb['get']({'plain':!![]});var _0x2b4ce6={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x1e7bcb&&_0x1e7bcb[_0xd409('0x5f')]){if(_0x1e7bcb[_0xd409('0x5f')]){_0x2b4ce6[_0xd409('0x5d')][_0xd409('0x6b')][_0xd409('0x5e')]({'ListId':{'$ne':_0x1e7bcb[_0xd409('0x5f')]}});}}return db[_0xd409('0x2d')][_0xd409('0x2e')](_0x2b4ce6);}})[_0xd409('0x16')](function(_0x4fbc63){if(!_['isNil'](_0x4fbc63)){return _[_0xd409('0x6c')](_0x18f6cc,_[_0xd409('0x6d')](_0x4fbc63,function(_0xf2c266){return util[_0xd409('0x6e')]('cf_%d',_0xf2c266['id']);}));}})[_0xd409('0x16')](handleEntityNotFound(_0x21c1e9,null))[_0xd409('0x16')](respondWithResult(_0x21c1e9,null))['catch'](handleError(_0x21c1e9,null));};exports[_0xd409('0x15')]=function(_0x271ba6,_0x2b3ea1){var _0x218637;if(_0x271ba6[_0xd409('0x35')]['id']){delete _0x271ba6[_0xd409('0x35')]['id'];}if(!_[_0xd409('0x55')](_0x271ba6[_0xd409('0x35')]['dialTimezone'])){var _0x58a45b=_0x271ba6[_0xd409('0x35')]['dialTimezone'];if(!_[_0xd409('0x55')](shared['timezones'][_0x58a45b]))_0x271ba6[_0xd409('0x35')][_0xd409('0x58')]=shared[_0xd409('0x57')][_0x58a45b][_0xd409('0x58')];}return db[_0xd409('0x24')][_0xd409('0x25')]({'where':{'id':_0x271ba6['params']['id']}})[_0xd409('0x16')](handleEntityNotFound(_0x2b3ea1,null))['then'](saveUpdates(_0x271ba6['body'],null))[_0xd409('0x16')](function(_0x4c51b4){_0x218637=_0x4c51b4;var _0x6c42d9={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4c51b4&&_0x4c51b4[_0xd409('0x5f')]){if(_0x4c51b4['ListId']){_0x6c42d9['where']['$and'][_0xd409('0x5e')]({'ListId':{'$ne':_0x4c51b4['ListId']}});}}return db[_0xd409('0x2d')][_0xd409('0x2e')](_0x6c42d9);})[_0xd409('0x16')](function(_0x15edbc){if(_0x15edbc){return _[_0xd409('0x6c')](_[_0xd409('0x6f')](_0x271ba6[_0xd409('0x35')],function(_0x10d161,_0x5005b1){return _['startsWith'](_0x5005b1,'cf_');}),_['map'](_0x15edbc,function(_0x4458b2){return util['format'](_0xd409('0x70'),_0x4458b2['id']);}));}})[_0xd409('0x16')](function(_0x46e09a){if(_0x46e09a&&!_[_0xd409('0x71')](_0x46e09a)){var _0x4e3be4=squel[_0xd409('0x15')]()['table']('cm_contacts')[_0xd409('0x72')](_0x46e09a)[_0xd409('0x5d')](_0xd409('0x73'),_0x271ba6[_0xd409('0x63')]['id'])[_0xd409('0x74')]();return db[_0xd409('0x68')][_0xd409('0x21')](_0x4e3be4[_0xd409('0x75')],{'replacements':_0x4e3be4['values']});}})[_0xd409('0x16')](function(){if(_0x271ba6[_0xd409('0x35')][_0xd409('0x76')]&&_0x218637){return db[_0xd409('0x3a')][_0xd409('0x15')]({'phone':_0x271ba6[_0xd409('0x35')]['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x218637['id']}});}})[_0xd409('0x16')](function(){return _0x218637;})[_0xd409('0x16')](respondWithResult(_0x2b3ea1,null))['catch'](handleError(_0x2b3ea1,null));};exports['getTags']=function(_0x33a4d1,_0x180dfd){var _0x2bbe7f={};var _0x38d59e={};var _0x78274a;var _0x3a6729;return db[_0xd409('0x24')][_0xd409('0x77')]({'where':{'id':_0x33a4d1['params']['id']}})[_0xd409('0x16')](handleEntityNotFound(_0x180dfd,null))[_0xd409('0x16')](function(_0x5d4e1e){if(_0x5d4e1e){_0x78274a=_0x5d4e1e;_0x38d59e[_0xd409('0x78')]=_[_0xd409('0x27')](db['Tag'][_0xd409('0x79')]);_0x38d59e[_0xd409('0x21')]=_[_0xd409('0x27')](_0x33a4d1[_0xd409('0x21')]);_0x38d59e[_0xd409('0x7a')]=_['intersection'](_0x38d59e[_0xd409('0x78')],_0x38d59e['query']);_0x2bbe7f[_0xd409('0x7b')]=_[_0xd409('0x7c')](_0x38d59e[_0xd409('0x78')],qs[_0xd409('0x7d')](_0x33a4d1['query'][_0xd409('0x7d')]));_0x2bbe7f[_0xd409('0x7b')]=_0x2bbe7f[_0xd409('0x7b')][_0xd409('0x28')]?_0x2bbe7f[_0xd409('0x7b')]:_0x38d59e[_0xd409('0x78')];_0x2bbe7f[_0xd409('0x7e')]=qs[_0xd409('0x7f')](_0x33a4d1[_0xd409('0x21')]['sort']);_0x2bbe7f['where']=qs[_0xd409('0x7a')](_[_0xd409('0x80')](_0x33a4d1['query'],_0x38d59e['filters']));if(_0x33a4d1[_0xd409('0x21')][_0xd409('0x81')]){_0x2bbe7f[_0xd409('0x5d')]=_[_0xd409('0x34')](_0x2bbe7f['where'],{'$or':_[_0xd409('0x6d')](_0x2bbe7f[_0xd409('0x7b')],function(_0x2086e6){var _0x2965aa={};_0x2965aa[_0x2086e6]={'$like':'%'+_0x33a4d1[_0xd409('0x21')]['filter']+'%'};return _0x2965aa;})});}_0x2bbe7f=_[_0xd409('0x34')]({},_0x2bbe7f,_0x33a4d1['options']);return _0x78274a['getTags'](_0x2bbe7f);}})[_0xd409('0x16')](function(_0x1d8ac3){if(_0x1d8ac3){_0x3a6729=_0x1d8ac3[_0xd409('0x28')];if(!_0x33a4d1['query'][_0xd409('0x33')]('nolimit')){_0x2bbe7f[_0xd409('0x11')]=qs[_0xd409('0x11')](_0x33a4d1[_0xd409('0x21')][_0xd409('0x11')]);_0x2bbe7f[_0xd409('0xf')]=qs[_0xd409('0xf')](_0x33a4d1[_0xd409('0x21')][_0xd409('0xf')]);}return _0x78274a['getTags'](_0x2bbe7f);}})['then'](function(_0x5c7c11){if(_0x5c7c11){return _0x5c7c11?{'count':_0x3a6729,'rows':_0x5c7c11}:null;}})[_0xd409('0x16')](respondWithResult(_0x180dfd,null))[_0xd409('0x23')](handleError(_0x180dfd,null));};exports['setTags']=function(_0x569606,_0x4abb86){if(_0x569606[_0xd409('0x35')]['id']){delete _0x569606['body']['id'];}return db[_0xd409('0x24')][_0xd409('0x77')]({'where':{'id':_0x569606[_0xd409('0x63')]['id']}})[_0xd409('0x16')](handleEntityNotFound(_0x4abb86,null))['then'](function(_0x377915){if(_0x377915){return _0x377915[_0xd409('0x82')](_0x569606[_0xd409('0x35')][_0xd409('0x83')]||[]);}return null;})[_0xd409('0x16')](respondWithResult(_0x4abb86,null))[_0xd409('0x23')](handleError(_0x4abb86,null));};exports[_0xd409('0x84')]=function(_0x33e89a,_0xcf07cd){var _0x19c94e=[];_0x19c94e[_0xd409('0x5e')](addAdditionalPhones(_0x33e89a['body']));Promise[_0xd409('0x61')](_0x19c94e)[_0xd409('0x16')](function(){_0x19c94e=[];_0x19c94e['push'](deleteCmHopperPhones(_0x33e89a[_0xd409('0x35')]['id']));_0x19c94e[_0xd409('0x5e')](addCmHopperPhones(_0x33e89a[_0xd409('0x35')]['id']));Promise[_0xd409('0x61')](_0x19c94e)[_0xd409('0x16')](function(){return[0x1];})[_0xd409('0x16')](respondWithResult(_0xcf07cd,null));});};function addAdditionalPhones(_0x6d266a){var _0x4c260a;return new Promise(function(_0x11282e){return db['CmContactHasItem']['destroy']({'where':{'CmContactId':_0x6d266a['id']}})['then'](function(){db[_0xd409('0x85')][_0xd409('0x2e')]({'raw':!![],'attributes':['id',_0xd409('0x86')]})[_0xd409('0x16')](function(_0x5ac90c){var _0x58d217=[];for(var _0xf62468=0x0;_0xf62468<_0x6d266a[_0xd409('0x87')][_0xd409('0x28')];_0xf62468++){var _0x44c0dd=_0x6d266a[_0xd409('0x88')]?_[_0xd409('0x55')](_0x6d266a[_0xd409('0x88')][_0xf62468])?'':_0x6d266a[_0xd409('0x88')][_0xf62468]:_0x6d266a['items'][_0xf62468][_0xd409('0x89')]?_0x6d266a[_0xd409('0x87')][_0xf62468][_0xd409('0x89')]:'';var _0x52f04f=_[_0xd409('0x55')](_0x6d266a['items'][_0xf62468][_0xd409('0x8a')])?'':_0x6d266a[_0xd409('0x87')][_0xf62468][_0xd409('0x8a')];var _0x4e647d=_0x44c0dd+':'+_0x6d266a[_0xd409('0x87')][_0xf62468][_0xd409('0x76')]+'§'+_0x52f04f;if(_[_0xd409('0x55')](_0x4c260a))_0x4c260a=_0x4e647d;else _0x4c260a+=';'+_0x4e647d;var _0x48966a=null;var _0x19a61b=null;if(_0x6d266a[_0xd409('0x88')]){if(!_[_0xd409('0x55')](_0x6d266a[_0xd409('0x88')][_0xf62468])){_0x19a61b=_[_0xd409('0x25')](_0x5ac90c,function(_0x3d8033){return _0x3d8033['id']===_0x6d266a[_0xd409('0x88')][_0xf62468];});if(!_[_0xd409('0x55')](_0x19a61b)){_0x48966a=_0x19a61b['OrderBy'];}}}else{if(!_[_0xd409('0x55')](_0x6d266a['items'][_0xf62468])){_0x19a61b=_[_0xd409('0x25')](_0x5ac90c,function(_0x31743a){return _0x31743a['id']===_0x6d266a['items'][_0xf62468]['ItemTypeId'];});if(!_[_0xd409('0x55')](_0x19a61b)){_0x48966a=_0xf62468;}}}if(_[_0xd409('0x55')](_0x48966a)){_0x48966a=0x64;}_0x58d217['push'](addAdditionalPhone(_0x6d266a['id'],_0x6d266a[_0xd409('0x87')][_0xf62468][_0xd409('0x76')],_0x6d266a[_0xd409('0x88')]?_[_0xd409('0x55')](_0x6d266a[_0xd409('0x88')][_0xf62468])?null:_0x6d266a[_0xd409('0x88')][_0xf62468]:_0x6d266a[_0xd409('0x87')][_0xf62468][_0xd409('0x89')]?_0x6d266a[_0xd409('0x87')][_0xf62468][_0xd409('0x89')]:null,_0x48966a,_0x52f04f));}Promise[_0xd409('0x61')](_0x58d217)[_0xd409('0x16')](function(){db[_0xd409('0x24')]['update']({'AdditionalPhones':_0x4c260a},{'where':{'id':_0x6d266a['id']}})[_0xd409('0x16')](function(){_0x11282e(0x1);});});});});});}function addAdditionalPhone(_0x2c2034,_0x3961a2,_0xb2553f,_0x129901,_0xfdf524){return db[_0xd409('0x49')][_0xd409('0x25')]({'where':{'CmContactId':_0x2c2034,'item':_0x3961a2}})['then'](function(_0x1eb0a4){if(_0x1eb0a4)logger[_0xd409('0x3b')](_0xd409('0x8b'),_0x1eb0a4);else{db[_0xd409('0x49')][_0xd409('0x3e')]({'CmContactId':_0x2c2034,'item':_0x3961a2,'ItemTypeId':_0xb2553f,'OrderBy':_0x129901,'ItemClass':_0xd409('0x8c'),'description':_0xfdf524});}});}function deleteCmHopperPhones(_0xd0a0b9){return new Promise(function(_0x32419a){return db[_0xd409('0x3a')][_0xd409('0x2e')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0xd0a0b9}})['then'](function(_0xe80f2f){db[_0xd409('0x8d')][_0xd409('0x17')]({'where':{'CmHopperId':{'$in':_[_0xd409('0x6d')](_0xe80f2f,'id')}}});})[_0xd409('0x16')](function(){_0x32419a(0x1);});});}function addCmHopperPhones(_0x159045){return new Promise(function(_0xee1e4f){return db['CmHopper']['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x159045}})[_0xd409('0x16')](function(_0x1f0315){var _0x3ad4ed=[];_['map'](_0x1f0315,function(_0xaebbd0){_0x3ad4ed[_0xd409('0x5e')](createCmHopperPhone(_0x159045,_0xaebbd0['id']));});Promise[_0xd409('0x61')](_0x3ad4ed)['then'](function(){_0xee1e4f(0x1);});});});}function createCmHopperPhone(_0xe9a6ec,_0x1050d1){return new Promise(function(_0x30868a){db[_0xd409('0x49')][_0xd409('0x2e')]({'raw':!![],'attributes':['item',_0xd409('0x86')],'where':{'CmContactId':_0xe9a6ec,'ItemClass':'PHONE'},'include':[{'model':db[_0xd409('0x85')],'attributes':[_0xd409('0x86')],'as':'ItemType'}],'order':[_0xd409('0x86'),db[_0xd409('0x68')][_0xd409('0x69')](_0xd409('0x8e'))]})[_0xd409('0x16')](function(_0x1b99cf){var _0x223d63=0x1;var _0x16bf5b=_[_0xd409('0x6d')](_0x1b99cf,function(_0x439e42){_0x439e42[_0xd409('0x8f')]=_0x1050d1;_0x439e42[_0xd409('0x76')]=_0x439e42[_0xd409('0x90')];_0x439e42[_0xd409('0x86')]=_0x223d63;delete _0x439e42[_0xd409('0x91')];_0x223d63=_0x223d63+0x1;return _0x439e42;});return db[_0xd409('0x8d')]['bulkCreate'](_0x16bf5b,{});})[_0xd409('0x16')](function(){_0x30868a(0x1);});});}function insertAdditionalPhones(_0x2eb258,_0x3cc2c1){return new Promise(function(_0x95bea0){var _0x4e03a4=[];for(var _0x3b52e3=0x0;_0x3b52e3<_0x3cc2c1['length'];_0x3b52e3++){var _0x494f47=_0x3cc2c1[_0x3b52e3];_0x4e03a4[_0xd409('0x5e')](parseContactItemType(_0x494f47));}Promise[_0xd409('0x61')](_0x4e03a4)[_0xd409('0x16')](function(){var _0x5d66dc={'id':_0x2eb258['id'],'items':_0x3cc2c1};return addAdditionalPhones(_0x5d66dc)[_0xd409('0x16')](function(){return addCmHopperPhones(_0x2eb258['id']);});})[_0xd409('0x16')](function(){_0x95bea0(_0x2eb258);});});}function parseContactItemType(_0x52a4ab){return new Promise(function(_0x264c86){if(_0x52a4ab[_0xd409('0x33')](_0xd409('0x89'))){_0x264c86(_0x52a4ab);}else{return db['ContactItemType']['find']({'where':{'name':_0x52a4ab[_0xd409('0x67')]}})['then'](function(_0x351b12){if(_[_0xd409('0x55')](_0x351b12))_0x52a4ab[_0xd409('0x89')]=null;else _0x52a4ab['ItemTypeId']=_0x351b12['id'];_0x264c86(_0x52a4ab);});}});}exports[_0xd409('0x92')]=function(_0x45af9f,_0xc4f1a){return db[_0xd409('0x49')]['findAll']({'raw':!![],'where':{'CmContactId':_0x45af9f['params']['id'],'ItemClass':_0xd409('0x8c')},'include':[{'model':db[_0xd409('0x85')],'as':_0xd409('0x67')}],'order':[[_0xd409('0x86')],[db['sequelize'][_0xd409('0x69')]('`ItemType`.OrderBy')]]})[_0xd409('0x16')](function(_0x6cde4e){return _0x6cde4e;})[_0xd409('0x16')](respondWithResult(_0xc4f1a,null))[_0xd409('0x23')](handleError(_0xc4f1a,null));};exports['duplicateAdditionalPhones']=function(_0x35f862,_0x370801){return db[_0xd409('0x49')][_0xd409('0x2e')]({'raw':!![],'where':{'CmContactId':_0x35f862['body'][_0xd409('0x93')]}})[_0xd409('0x16')](function(_0x10ebf0){var _0x2a3a1d=_[_0xd409('0x6d')](_0x10ebf0,function(_0xe0482f){_0xe0482f[_0xd409('0x94')]=_0x35f862[_0xd409('0x35')][_0xd409('0x95')];return _0xe0482f;});return db[_0xd409('0x49')][_0xd409('0x5a')](_0x2a3a1d,{});})['then'](function(){return addCmHopperPhones(_0x35f862[_0xd409('0x35')][_0xd409('0x95')]);})['then'](function(){return['ok'];})['then'](respondWithResult(_0x370801,null))[_0xd409('0x23')](handleError(_0x370801,null));};exports[_0xd409('0x96')]=function(_0x1680d1,_0x5afc2b){var _0x4d37d5=[];_0x4d37d5['push'](createCmHopperPhone(_0x1680d1[_0xd409('0x35')]['id'],_0x1680d1[_0xd409('0x35')][_0xd409('0x97')]));Promise['all'](_0x4d37d5)[_0xd409('0x16')](function(){return[0x1];})[_0xd409('0x16')](respondWithResult(_0x5afc2b,null));};exports[_0xd409('0x98')]=function(_0x1ef43a,_0x5b3832){var _0x1fb0bc={'raw':![],'where':{}};var _0x5110ef={};var _0x455db1={'count':0x0,'rows':[]};return db[_0xd409('0x24')]['findOne']({'where':{'id':_0x1ef43a[_0xd409('0x63')]['id']}})[_0xd409('0x16')](handleEntityNotFound(_0x5b3832,null))[_0xd409('0x16')](function(_0x3e87b1){if(_0x3e87b1){_0x5110ef[_0xd409('0x78')]=_[_0xd409('0x27')](db['CmHopper'][_0xd409('0x79')]);_0x5110ef[_0xd409('0x21')]=_[_0xd409('0x27')](_0x1ef43a[_0xd409('0x21')]);_0x5110ef['filters']=_[_0xd409('0x7c')](_0x5110ef['model'],_0x5110ef[_0xd409('0x21')]);_0x1fb0bc[_0xd409('0x7b')]=_[_0xd409('0x7c')](_0x5110ef[_0xd409('0x78')],qs[_0xd409('0x7d')](_0x1ef43a[_0xd409('0x21')][_0xd409('0x7d')]));_0x1fb0bc[_0xd409('0x7b')]=_0x1fb0bc[_0xd409('0x7b')][_0xd409('0x28')]?_0x1fb0bc[_0xd409('0x7b')]:_0x5110ef[_0xd409('0x78')];if(!_0x1ef43a[_0xd409('0x21')]['hasOwnProperty']('nolimit')){_0x1fb0bc[_0xd409('0x11')]=qs[_0xd409('0x11')](_0x1ef43a[_0xd409('0x21')]['limit']);_0x1fb0bc[_0xd409('0xf')]=qs['offset'](_0x1ef43a[_0xd409('0x21')][_0xd409('0xf')]);}_0x1fb0bc[_0xd409('0x7e')]=qs[_0xd409('0x7f')](_0x1ef43a[_0xd409('0x21')][_0xd409('0x7f')]);_0x1fb0bc[_0xd409('0x5d')]=qs[_0xd409('0x7a')](_[_0xd409('0x80')](_0x1ef43a[_0xd409('0x21')],_0x5110ef['filters']));_0x1fb0bc[_0xd409('0x5d')][_0xd409('0x99')]=_0x3e87b1['id'];if(_0x1ef43a[_0xd409('0x21')][_0xd409('0x81')]){_0x1fb0bc[_0xd409('0x5d')]=_[_0xd409('0x34')](_0x1fb0bc[_0xd409('0x5d')],{'$or':_['map'](_0x1fb0bc[_0xd409('0x7b')],function(_0x52922a){var _0x191bee={};_0x191bee[_0x52922a]={'$like':'%'+_0x1ef43a[_0xd409('0x21')]['filter']+'%'};return _0x191bee;})});}_0x1fb0bc=_[_0xd409('0x34')]({},_0x1fb0bc,_0x1ef43a[_0xd409('0x9a')]);return db[_0xd409('0x3a')][_0xd409('0x9b')]({'where':_0x1fb0bc[_0xd409('0x5d')]})[_0xd409('0x16')](function(_0x46f515){_0x455db1[_0xd409('0x9b')]=_0x46f515;if(_0x1ef43a[_0xd409('0x21')][_0xd409('0x9c')]){_0x1fb0bc[_0xd409('0x9d')]=[{'all':!![]}];}return db[_0xd409('0x3a')][_0xd409('0x2e')](_0x1fb0bc);})[_0xd409('0x16')](function(_0x42db8e){_0x455db1[_0xd409('0x9e')]=_0x42db8e;return _0x455db1;});}})[_0xd409('0x16')](respondWithFilteredResult(_0x5b3832,_0x1fb0bc))[_0xd409('0x23')](handleError(_0x5b3832,null));};exports[_0xd409('0x9f')]=function(_0x23114f,_0x2757ad){var _0x188654={'raw':!![],'where':{}};var _0x527d67={};var _0x597286={'count':0x0,'rows':[]};return db[_0xd409('0x24')][_0xd409('0x77')]({'where':{'id':_0x23114f[_0xd409('0x63')]['id']}})[_0xd409('0x16')](handleEntityNotFound(_0x2757ad,null))[_0xd409('0x16')](function(_0xee18b6){if(_0xee18b6){_0x527d67['model']=_[_0xd409('0x27')](db[_0xd409('0x4a')]['rawAttributes']);_0x527d67[_0xd409('0x21')]=_[_0xd409('0x27')](_0x23114f[_0xd409('0x21')]);_0x527d67[_0xd409('0x7a')]=_['intersection'](_0x527d67[_0xd409('0x78')],_0x527d67['query']);_0x188654[_0xd409('0x7b')]=_[_0xd409('0x7c')](_0x527d67[_0xd409('0x78')],qs[_0xd409('0x7d')](_0x23114f[_0xd409('0x21')][_0xd409('0x7d')]));_0x188654[_0xd409('0x7b')]=_0x188654['attributes'][_0xd409('0x28')]?_0x188654[_0xd409('0x7b')]:_0x527d67[_0xd409('0x78')];if(!_0x23114f[_0xd409('0x21')][_0xd409('0x33')]('nolimit')){_0x188654['limit']=qs[_0xd409('0x11')](_0x23114f[_0xd409('0x21')][_0xd409('0x11')]);_0x188654[_0xd409('0xf')]=qs[_0xd409('0xf')](_0x23114f[_0xd409('0x21')][_0xd409('0xf')]);}_0x188654[_0xd409('0x7e')]=qs[_0xd409('0x7f')](_0x23114f['query'][_0xd409('0x7f')]);_0x188654['where']=qs[_0xd409('0x7a')](_[_0xd409('0x80')](_0x23114f[_0xd409('0x21')],_0x527d67[_0xd409('0x7a')]));_0x188654['where'][_0xd409('0x99')]=_0xee18b6['id'];if(_0x23114f[_0xd409('0x21')]['filter']){_0x188654[_0xd409('0x5d')]=_[_0xd409('0x34')](_0x188654[_0xd409('0x5d')],{'$or':_[_0xd409('0x6d')](_0x188654[_0xd409('0x7b')],function(_0xb3d634){var _0x12d343={};_0x12d343[_0xb3d634]={'$like':'%'+_0x23114f[_0xd409('0x21')][_0xd409('0x81')]+'%'};return _0x12d343;})});}_0x188654=_[_0xd409('0x34')]({},_0x188654,_0x23114f[_0xd409('0x9a')]);return db['CmHopperHistory']['count']({'where':_0x188654[_0xd409('0x5d')]})[_0xd409('0x16')](function(_0x517df1){_0x597286[_0xd409('0x9b')]=_0x517df1;if(_0x23114f[_0xd409('0x21')][_0xd409('0x9c')]){_0x188654[_0xd409('0x9d')]=[{'all':!![]}];}return db[_0xd409('0x4a')][_0xd409('0x2e')](_0x188654);})[_0xd409('0x16')](function(_0x5ea89d){_0x597286['rows']=_0x5ea89d;return _0x597286;});}})[_0xd409('0x16')](respondWithFilteredResult(_0x2757ad,_0x188654))[_0xd409('0x23')](handleError(_0x2757ad,null));};exports[_0xd409('0xa0')]=function(_0x4e4a54,_0x585bdf){var _0x32ab7d={'raw':!![],'where':{}};var _0x598187={};var _0x54e73e={'count':0x0,'rows':[]};return db[_0xd409('0x24')][_0xd409('0x77')]({'where':{'id':_0x4e4a54[_0xd409('0x63')]['id']}})[_0xd409('0x16')](handleEntityNotFound(_0x585bdf,null))['then'](function(_0x1db4a4){if(_0x1db4a4){_0x598187[_0xd409('0x78')]=_[_0xd409('0x27')](db[_0xd409('0xa1')][_0xd409('0x79')]);_0x598187[_0xd409('0x21')]=_['keys'](_0x4e4a54[_0xd409('0x21')]);_0x598187[_0xd409('0x7a')]=_['intersection'](_0x598187[_0xd409('0x78')],_0x598187[_0xd409('0x21')]);_0x32ab7d[_0xd409('0x7b')]=_[_0xd409('0x7c')](_0x598187[_0xd409('0x78')],qs[_0xd409('0x7d')](_0x4e4a54[_0xd409('0x21')]['fields']));_0x32ab7d[_0xd409('0x7b')]=_0x32ab7d['attributes'][_0xd409('0x28')]?_0x32ab7d[_0xd409('0x7b')]:_0x598187[_0xd409('0x78')];if(!_0x4e4a54['query'][_0xd409('0x33')]('nolimit')){_0x32ab7d['limit']=qs['limit'](_0x4e4a54[_0xd409('0x21')]['limit']);_0x32ab7d[_0xd409('0xf')]=qs[_0xd409('0xf')](_0x4e4a54[_0xd409('0x21')][_0xd409('0xf')]);}_0x32ab7d['order']=qs[_0xd409('0x7f')](_0x4e4a54['query'][_0xd409('0x7f')]);_0x32ab7d['where']=qs['filters'](_[_0xd409('0x80')](_0x4e4a54[_0xd409('0x21')],_0x598187[_0xd409('0x7a')]));_0x32ab7d[_0xd409('0x5d')][_0xd409('0x99')]=_0x1db4a4['id'];if(_0x4e4a54[_0xd409('0x21')][_0xd409('0x81')]){_0x32ab7d[_0xd409('0x5d')]=_[_0xd409('0x34')](_0x32ab7d[_0xd409('0x5d')],{'$or':_[_0xd409('0x6d')](_0x32ab7d[_0xd409('0x7b')],function(_0x378546){var _0x70c6ad={};_0x70c6ad[_0x378546]={'$like':'%'+_0x4e4a54[_0xd409('0x21')][_0xd409('0x81')]+'%'};return _0x70c6ad;})});}_0x32ab7d=_[_0xd409('0x34')]({},_0x32ab7d,_0x4e4a54[_0xd409('0x9a')]);return db[_0xd409('0xa1')][_0xd409('0x9b')]({'where':_0x32ab7d['where']})['then'](function(_0x3086cb){_0x54e73e['count']=_0x3086cb;if(_0x4e4a54[_0xd409('0x21')][_0xd409('0x9c')]){_0x32ab7d[_0xd409('0x9d')]=[{'all':!![]}];}return db[_0xd409('0xa1')][_0xd409('0x2e')](_0x32ab7d);})['then'](function(_0x54d25d){_0x54e73e[_0xd409('0x9e')]=_0x54d25d;return _0x54e73e;});}})[_0xd409('0x16')](respondWithFilteredResult(_0x585bdf,_0x32ab7d))[_0xd409('0x23')](handleError(_0x585bdf,null));};exports[_0xd409('0xa2')]=function(_0x14711a,_0x3f5931){var _0x5e59a9={'raw':!![],'where':{}};var _0x11bb8e={};var _0xd6fe0a={'count':0x0,'rows':[]};return db['CmContact'][_0xd409('0x77')]({'where':{'id':_0x14711a['params']['id']}})[_0xd409('0x16')](handleEntityNotFound(_0x3f5931,null))['then'](function(_0x585ae5){if(_0x585ae5){_0x11bb8e[_0xd409('0x78')]=_[_0xd409('0x27')](db[_0xd409('0x50')][_0xd409('0x79')]);_0x11bb8e['query']=_[_0xd409('0x27')](_0x14711a[_0xd409('0x21')]);_0x11bb8e[_0xd409('0x7a')]=_['intersection'](_0x11bb8e['model'],_0x11bb8e[_0xd409('0x21')]);_0x5e59a9['attributes']=_['intersection'](_0x11bb8e[_0xd409('0x78')],qs[_0xd409('0x7d')](_0x14711a[_0xd409('0x21')][_0xd409('0x7d')]));_0x5e59a9['attributes']=_0x5e59a9['attributes'][_0xd409('0x28')]?_0x5e59a9[_0xd409('0x7b')]:_0x11bb8e[_0xd409('0x78')];if(!_0x14711a['query'][_0xd409('0x33')](_0xd409('0xa3'))){_0x5e59a9[_0xd409('0x11')]=qs[_0xd409('0x11')](_0x14711a[_0xd409('0x21')]['limit']);_0x5e59a9[_0xd409('0xf')]=qs[_0xd409('0xf')](_0x14711a[_0xd409('0x21')][_0xd409('0xf')]);}_0x5e59a9[_0xd409('0x7e')]=qs[_0xd409('0x7f')](_0x14711a[_0xd409('0x21')][_0xd409('0x7f')]);_0x5e59a9[_0xd409('0x5d')]=qs[_0xd409('0x7a')](_['pick'](_0x14711a[_0xd409('0x21')],_0x11bb8e['filters']));_0x5e59a9['where'][_0xd409('0x99')]=_0x585ae5['id'];if(_0x14711a[_0xd409('0x21')][_0xd409('0x81')]){_0x5e59a9[_0xd409('0x5d')]=_[_0xd409('0x34')](_0x5e59a9[_0xd409('0x5d')],{'$or':_[_0xd409('0x6d')](_0x5e59a9[_0xd409('0x7b')],function(_0x1464a4){var _0x25bf73={};_0x25bf73[_0x1464a4]={'$like':'%'+_0x14711a[_0xd409('0x21')]['filter']+'%'};return _0x25bf73;})});}_0x5e59a9=_['merge']({},_0x5e59a9,_0x14711a['options']);return db[_0xd409('0x50')][_0xd409('0x9b')]({'where':_0x5e59a9['where']})[_0xd409('0x16')](function(_0x507586){_0xd6fe0a[_0xd409('0x9b')]=_0x507586;if(_0x14711a['query'][_0xd409('0x9c')]){_0x5e59a9['include']=[{'all':!![]}];}return db[_0xd409('0x50')][_0xd409('0x2e')](_0x5e59a9);})['then'](function(_0x2802e5){_0xd6fe0a[_0xd409('0x9e')]=_0x2802e5;return _0xd6fe0a;});}})['then'](respondWithFilteredResult(_0x3f5931,_0x5e59a9))[_0xd409('0x23')](handleError(_0x3f5931,null));};exports[_0xd409('0xa4')]=function(_0x1ceeee,_0xb1ecf7){try{if(!_0x1ceeee[_0xd409('0x35')]['ListId']){throw new Error(_0xd409('0xa5'));}if(!_0x1ceeee[_0xd409('0x35')][_0xd409('0xa6')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x1ceeee[_0xd409('0x35')]['binding_values']){throw new Error(_0xd409('0xa7'));}if(!_0x1ceeee[_0xd409('0x35')][_0xd409('0xa8')]){throw new Error(_0xd409('0xa9'));}var _0x33ace5=_0x1ceeee[_0xd409('0x35')][_0xd409('0xa6')][_0xd409('0xaa')](',');var _0x27379f=_0x1ceeee[_0xd409('0x35')][_0xd409('0xab')]['split'](',');if(!_0x33ace5['length']||!_0x27379f[_0xd409('0x28')]||_0x33ace5[_0xd409('0x28')]!==_0x27379f[_0xd409('0x28')]){throw new Error(_0xd409('0xac'));}_0x1ceeee[_0xd409('0x35')][_0xd409('0x7d')]=_[_0xd409('0xad')](_0x33ace5,_0x27379f);if(!_0x1ceeee[_0xd409('0x35')][_0xd409('0x7d')][_0xd409('0x76')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x1ceeee['body']['fields'][_0xd409('0xae')]){throw new Error(_0xd409('0xaf'));}var _0x1a2ea0=path[_0xd409('0x54')](config['root'],'server/files/tmp',_0x1ceeee['file'][_0xd409('0xb0')]);fs[_0xd409('0xb1')](_0x1a2ea0,parseInt('0777',0x8));var _0x406866=require('child_process')['fork'](path[_0xd409('0x54')](__dirname,_0xd409('0xb2')),[_0x1a2ea0,_0x1ceeee[_0xd409('0x35')][_0xd409('0xa6')],_0x1ceeee[_0xd409('0x35')]['binding_values'],_0x1ceeee[_0xd409('0x35')][_0xd409('0x5f')],_0x1ceeee[_0xd409('0x35')][_0xd409('0xb3')],_0x1ceeee[_0xd409('0x35')]['duplicates'],_0x1ceeee[_0xd409('0x35')][_0xd409('0xa8')]]);return _0xb1ecf7[_0xd409('0x12')](0xc8)[_0xd409('0xe')]({'message':_0xd409('0xb4'),'pid':_0x406866[_0xd409('0xb5')]});}catch(_0x443fa3){return _0xb1ecf7['status'](0x1f4)[_0xd409('0x1d')](_0x443fa3);}};exports[_0xd409('0xb6')]=function(_0x5e6c8e,_0x1dac9a){var _0x373aa8=fs[_0xd409('0xb7')](_0x5e6c8e[_0xd409('0xb8')][_0xd409('0x1')]);Papa[_0xd409('0xb9')](_0x373aa8,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x9756e1){return _0x1dac9a[_0xd409('0x12')](0xc8)[_0xd409('0xe')]({'file':_0x5e6c8e[_0xd409('0xb8')],'fields':_0x9756e1[_0xd409('0xba')][_0xd409('0x7d')]});}});};exports['import']=function(_0x320e62,_0x52eaaa){return db['User'][_0xd409('0x2e')]({'raw':!![],'attributes':['id'],'where':{'role':_0xd409('0xbb')}})['then'](function(_0x231b67){var _0x3b510d=![];if(!_0x320e62[_0xd409('0x35')][_0xd409('0x5f')]){throw new Error(_0xd409('0xa5'));}if(!_0x320e62[_0xd409('0x35')][_0xd409('0xbc')][_0xd409('0x76')]){throw new Error(_0xd409('0xbd'));}if(!_0x320e62['body']['binding'][_0xd409('0xae')]){throw new Error(_0xd409('0xaf'));}if(!_0x320e62[_0xd409('0x35')][_0xd409('0xa8')]){throw new Error(_0xd409('0xa9'));}var _0x2cb23a=require('child_process')[_0xd409('0xbe')](path['join'](__dirname,_0xd409('0xbf')),[_0x320e62[_0xd409('0x63')]['id'],JSON[_0xd409('0xc0')](_0x320e62[_0xd409('0x35')]),JSON['stringify'](_0x231b67)]);_0x2cb23a['on'](_0xd409('0xc1'),function(){_0x3b510d=!![];return _0x52eaaa[_0xd409('0x12')](0xc8)[_0xd409('0xe')]({'message':_0xd409('0xc2'),'pid':_0x2cb23a[_0xd409('0xb5')]});});_0x2cb23a['on'](_0xd409('0xc3'),function(_0x1d9997){if(_0x1d9997&&!_0x3b510d){return _0x52eaaa['status'](0x1f4)[_0xd409('0xe')]({'message':_0xd409('0xc4'),'pid':_0x2cb23a['pid']});}});})[_0xd409('0x23')](handleError(_0x52eaaa,null));};exports[_0xd409('0xc5')]=function(_0x55ab61,_0x324e78){return db[_0xd409('0xc6')][_0xd409('0x2e')]({'raw':!![],'attributes':['id'],'where':{'role':_0xd409('0xbb')}})[_0xd409('0x16')](function(_0x4c75a2){var _0x16a78e=![];if(!_0x55ab61[_0xd409('0x35')][_0xd409('0x5f')]){throw new Error('No\x20ListId\x20specified');}if(!_0x55ab61[_0xd409('0x35')]['binding'][_0xd409('0x76')]){throw new Error(_0xd409('0xbd'));}if(!_0x55ab61[_0xd409('0x35')][_0xd409('0xbc')][_0xd409('0xae')]){throw new Error(_0xd409('0xaf'));}if(!_0x55ab61[_0xd409('0x35')][_0xd409('0xa8')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x732dbb=require(_0xd409('0xc7'))['fork'](path[_0xd409('0x54')](__dirname,_0xd409('0xc8')),[_0x55ab61[_0xd409('0x63')]['id'],JSON['stringify'](_0x55ab61['body']),JSON[_0xd409('0xc0')](_0x4c75a2)]);_0x732dbb['on'](_0xd409('0xc1'),function(){_0x16a78e=!![];return _0x324e78[_0xd409('0x12')](0xc8)[_0xd409('0xe')]({'message':_0xd409('0xc2'),'pid':_0x732dbb[_0xd409('0xb5')]});});_0x732dbb['on'](_0xd409('0xc3'),function(_0x4cd7ad){if(_0x4cd7ad&&!_0x16a78e){return _0x324e78[_0xd409('0x12')](0x1f4)[_0xd409('0xe')]({'message':_0xd409('0xc4'),'pid':_0x732dbb['pid']});}});})[_0xd409('0x23')](handleError(_0x324e78,null));};exports[_0xd409('0xc9')]=function(_0x455e9d,_0x3daa09){var _0x457acc=[_0xd409('0xca'),_0xd409('0xcb'),_0xd409('0xcc'),_0xd409('0xcd'),'fax',_0xd409('0xce'),_0xd409('0xcf')];var _0x3a9c13={'offset':0x0,'order':qs[_0xd409('0x7f')](_0xd409('0xd0'))},_0x496e9b={'count':0x0,'rows':[]};Promise[_0xd409('0xd1')]()[_0xd409('0x16')](function(){if(_0x455e9d[_0xd409('0x21')][_0xd409('0xd2')]){if(!_[_0xd409('0xd3')](_0x457acc,_0x455e9d[_0xd409('0x21')][_0xd409('0xd2')][_0xd409('0xd4')]())){throw new Error(_0xd409('0xd5'));}_0x457acc=[_0x455e9d[_0xd409('0x21')]['channel'][_0xd409('0xd4')]()];}if(_0x455e9d[_0xd409('0x21')][_0xd409('0xd6')]){try{var _0x57456a=JSON['parse'](_0x455e9d[_0xd409('0x21')][_0xd409('0xd6')]);if(!moment(_0x57456a['from'])[_0xd409('0xd7')]()){throw new Error(_0xd409('0xd8'));}if(!moment(_0x57456a['to'])[_0xd409('0xd7')]()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0xf19c0d){throw new Error(_0xd409('0xd9'));}}if(!_0x455e9d['query'][_0xd409('0x33')](_0xd409('0xa3'))){_0x3a9c13[_0xd409('0x11')]=qs[_0xd409('0x11')](_0x455e9d[_0xd409('0x21')][_0xd409('0x11')]||0xa);_0x3a9c13[_0xd409('0xf')]=qs[_0xd409('0xf')](_0x455e9d[_0xd409('0x21')][_0xd409('0xf')]);}var _0x1cd671=_0x457acc[_0xd409('0x6d')](function(_0x360f2a){if(_0x360f2a===_0xd409('0xcf')){var _0x3f1b12={'attributes':['id',_0xd409('0xda'),_0xd409('0x31'),_0xd409('0xdb'),_0xd409('0xdc'),_0xd409('0xdd'),_0xd409('0xde'),_0xd409('0xdf'),'duration',_0xd409('0xe0'),_0xd409('0xe1'),_0xd409('0xe2'),'userSecondDisposition','userThirdDisposition',_0xd409('0xe3')],'where':{'ContactId':_0x455e9d[_0xd409('0x63')]['id']},'include':[{'model':db[_0xd409('0xc6')],'as':_0xd409('0xc6'),'attributes':['id',_0xd409('0x1c'),_0xd409('0xe4'),_0xd409('0xe5')]}],'order':[['createdAt',_0xd409('0xe6')]]};if(_0x455e9d[_0xd409('0x21')][_0xd409('0xd6')]){_0x3f1b12[_0xd409('0x5d')][_0xd409('0xe1')]={'$gte':_0x57456a['from'],'$lte':_0x57456a['to']};}return db['VoiceCallReport'][_0xd409('0xe7')](_0x3f1b12)[_0xd409('0x16')](function(_0x5a3e7c){_0x496e9b[_0xd409('0x9b')]+=_0x5a3e7c[_0xd409('0x9b')];return _[_0xd409('0x6d')](_0x5a3e7c['rows'],function(_0x23d267){var _0xbef62f=_0x23d267[_0xd409('0x37')]({'plain':!![]});_0xbef62f['channel']=_0x360f2a;if(_0xbef62f[_0xd409('0xc6')]){_0xbef62f['User']={'id':_0xbef62f[_0xd409('0xc6')]['id'],'name':_0xbef62f[_0xd409('0xc6')][_0xd409('0x1c')],'fullname':_0xbef62f[_0xd409('0xc6')][_0xd409('0xe4')],'alias':_0xbef62f[_0xd409('0xc6')][_0xd409('0xe5')]};}return _0xbef62f;});});}else{var _0x20130a=_[_0xd409('0xe8')](_0x360f2a)+(_0x360f2a===_0xd409('0xcb')?_0xd409('0xe9'):_0xd409('0xea'));var _0x542470={'attributes':['id','closed','closedAt',_0xd409('0xe1'),_0xd409('0xe0'),_0xd409('0xeb'),_0xd409('0xec'),_0xd409('0xed'),_0xd409('0xe3'),_0x20130a+'Id'],'where':{'ContactId':_0x455e9d[_0xd409('0x63')]['id']},'include':[{'model':db[_0x20130a],'as':_0xd409('0xea'),'attributes':['id',_0xd409('0x1c'),_0xd409('0xee')]},{'model':db['User'],'as':_0xd409('0xef'),'attributes':['id',_0xd409('0x1c'),_0xd409('0xe4')]},{'model':db[_0xd409('0xf0')],'as':_0xd409('0xf1'),'attributes':['id',_0xd409('0x1c'),_0xd409('0x64')],'through':{'attributes':[]}}],'order':[[_0xd409('0xe1'),_0xd409('0xe6')]]};if(_0x455e9d['query']['range']){_0x542470[_0xd409('0x5d')][_0xd409('0xe1')]={'$gte':_0x57456a[_0xd409('0x36')],'$lte':_0x57456a['to']};}switch(_0x360f2a){case _0xd409('0xcb'):_0x542470[_0xd409('0x7b')][_0xd409('0x5e')](_0xd409('0xf2'),_0xd409('0xf3'),_0xd409('0xf4'),_0xd409('0xf5'),'osName','ratingMessage','ratingType',_0xd409('0xf6'),_0xd409('0xf7'));break;case _0xd409('0xca'):_0x542470[_0xd409('0x7b')][_0xd409('0x5e')]('subject',_0xd409('0xf8'));break;case'openchannel':_0x542470[_0xd409('0x7b')][_0xd409('0x5e')]('externalUrl','threadId');break;}return db[_[_0xd409('0xe8')](_0x360f2a)+_0xd409('0xf9')]['findAndCountAll'](_0x542470)[_0xd409('0x16')](function(_0x3baebb){_0x496e9b[_0xd409('0x9b')]+=_0x3baebb['count'];return _[_0xd409('0x6d')](_0x3baebb[_0xd409('0x9e')],function(_0x2ba40a){var _0x46eb06=_0x2ba40a[_0xd409('0x37')]({'plain':!![]});_0x46eb06['channel']=_0x360f2a;if(_0x46eb06['Owner']){_0x46eb06[_0xd409('0xef')]={'id':_0x46eb06[_0xd409('0xef')]['id'],'name':_0x46eb06['Owner'][_0xd409('0x1c')],'fullname':_0x46eb06['Owner'][_0xd409('0xe4')]};}return _0x46eb06;});});}});return Promise[_0xd409('0x61')](_0x1cd671);})[_0xd409('0x16')](function(_0x44bf85){return _(_0x44bf85)[_0xd409('0xfa')]()[_0xd409('0xfb')]('createdAt')[_0xd409('0xfc')]()[_0xd409('0xfd')]();})[_0xd409('0x16')](function(_0x14d80d){_0x496e9b[_0xd409('0x9e')]=_0x3a9c13['limit']?_0x14d80d[_0xd409('0xfe')](_0x3a9c13[_0xd409('0xf')],_0x3a9c13[_0xd409('0xf')]+_0x3a9c13[_0xd409('0x11')]):_0x14d80d;return _0x496e9b;})[_0xd409('0x16')](respondWithFilteredResult(_0x3daa09,_0x3a9c13))[_0xd409('0x23')](handleError(_0x3daa09,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 1f824b2..764f43c 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 _0x0708=['exports','../../mysqldb','CmContact','setMaxListeners','save','update','remove','emit','hook'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x0708,0x1b1));var _0x8070=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0x0708[_0x4ed520];return _0x4415a6;};'use strict';var EventEmitter=require('events');var CmContact=require(_0x8070('0x0'))['db'][_0x8070('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x8070('0x2')](0x0);var events={'afterCreate':_0x8070('0x3'),'afterUpdate':_0x8070('0x4'),'afterDestroy':_0x8070('0x5')};function emitEvent(_0x3cdd3d){return function(_0x2a2a3e,_0x148eb0,_0x5bb9a7){CmContactEvents[_0x8070('0x6')](_0x3cdd3d+':'+_0x2a2a3e['id'],_0x2a2a3e);CmContactEvents[_0x8070('0x6')](_0x3cdd3d,_0x2a2a3e);_0x5bb9a7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0x8070('0x7')](e,emitEvent(event));}}module[_0x8070('0x8')]=CmContactEvents; \ No newline at end of file +var _0x9b74=['hook','exports','events','../../mysqldb','setMaxListeners','update','emit'];(function(_0x255c48,_0x2a4449){var _0xaebda3=function(_0x12a04e){while(--_0x12a04e){_0x255c48['push'](_0x255c48['shift']());}};_0xaebda3(++_0x2a4449);}(_0x9b74,0x1ec));var _0x49b7=function(_0x184646,_0x3358d5){_0x184646=_0x184646-0x0;var _0x5b7134=_0x9b74[_0x184646];return _0x5b7134;};'use strict';var EventEmitter=require(_0x49b7('0x0'));var CmContact=require(_0x49b7('0x1'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents[_0x49b7('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x49b7('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1a75c5){return function(_0x46c876,_0x23eaef,_0x5990d7){CmContactEvents[_0x49b7('0x4')](_0x1a75c5+':'+_0x46c876['id'],_0x46c876);CmContactEvents[_0x49b7('0x4')](_0x1a75c5,_0x46c876);_0x5990d7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0x49b7('0x5')](e,emitEvent(event));}}module[_0x49b7('0x6')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 06fd3a0..2e54f1e 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 _0xead8=['path','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','dialTimezone','VoiceQueue','findOne','then','isNil','timezones','utcOffset','add','minutes','ret','CmHopper','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','cmContact','afterCreate','Campaign','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','CmList','Lists','length','dialCheckDuplicateType','always','BlackLists','message','onlyIfOpen','CmHopperBlack','cmContact,\x20%s,\x20%s','destroy','ContactId','VoiceQueueId','push','all','info','[CmContact][afterDestroy][Succesfull]','inspect','[CmContact][afterDestroy][Error]','lodash','util','api','moment'];(function(_0x17e0dc,_0x24af53){var _0x39c2aa=function(_0x361756){while(--_0x361756){_0x17e0dc['push'](_0x17e0dc['shift']());}};_0x39c2aa(++_0x24af53);}(_0xead8,0x120));var _0x8ead=function(_0xeeb6dd,_0x3e5f7b){_0xeeb6dd=_0xeeb6dd-0x0;var _0x95d347=_0xead8[_0xeeb6dd];return _0x95d347;};'use strict';var _=require(_0x8ead('0x0'));var util=require(_0x8ead('0x1'));var logger=require('../../config/logger')(_0x8ead('0x2'));var moment=require(_0x8ead('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8ead('0x4'));var rimraf=require('rimraf');var config=require(_0x8ead('0x5'));var shared=require(_0x8ead('0x6'));var attributes=require(_0x8ead('0x7'));module[_0x8ead('0x8')]=function(_0x1a76ef,_0x3ecbb5){return _0x1a76ef['define'](_0x8ead('0x9'),attributes,{'tableName':_0x8ead('0xa'),'paranoid':!![],'indexes':[{'name':_0x8ead('0xb'),'fields':[_0x8ead('0xb')]},{'name':_0x8ead('0xc'),'fields':[_0x8ead('0xd'),'lastName',_0x8ead('0xb'),'mobile','fax',_0x8ead('0xe')],'type':_0x8ead('0xf')}],'timestamps':!![],'charset':_0x8ead('0x10'),'collate':_0x8ead('0x11'),'hooks':{'afterCreate':function(_0x2c766b,_0x519ab6,_0xfe7f3c){var _0x3f34c5=_0x1a76ef[_0x8ead('0x12')];var _0x3cfeb6=_0x2c766b[_0x8ead('0x13')]({'plain':!![]});function _0x1b7f6c(){return function(_0x31d53e){logger[_0x8ead('0x14')]('cmContact','afterCreate',util['inspect'](_0x31d53e,{'showHidden':![],'depth':null}));};}function _0x2532aa(_0x175fbb,_0x49cf96){var _0x1233b6=_0x49cf96[_0x8ead('0x15')]?_0x49cf96[_0x8ead('0x15')]:moment()[_0x8ead('0x16')](_0x8ead('0x17'));return new BPromise(function(_0xc8f3d,_0x537292){if(_['isNil'](_0x49cf96[_0x8ead('0x18')])){_0xc8f3d({'ret':_0x1233b6});}else{_0x3f34c5[_0x8ead('0x19')][_0x8ead('0x1a')]({'where':{'id':_0x175fbb['id']}})[_0x8ead('0x1b')](function(_0x394a55){if(!_['isNil'](_0x394a55)){var _0x5a4564=_0x394a55[_0x8ead('0x18')];if(!_[_0x8ead('0x1c')](_0x5a4564)){var _0x2f5bae=shared[_0x8ead('0x1d')];var _0x4d2983=_0x2f5bae[_0x5a4564];var _0x5e9b85=_0x2f5bae[_0x49cf96['dialTimezone']];if(!_[_0x8ead('0x1c')](_0x4d2983)&&!_[_0x8ead('0x1c')](_0x5e9b85)){var _0x2b4e58=_0x4d2983[_0x8ead('0x1e')]-_0x5e9b85[_0x8ead('0x1e')];_0x1233b6=_0x49cf96[_0x8ead('0x15')]?_0x49cf96[_0x8ead('0x15')]:moment();var _0x320bbe=moment(_0x1233b6)[_0x8ead('0x1f')](_0x2b4e58,_0x8ead('0x20'));_0xc8f3d({'ret':_0x320bbe[_0x8ead('0x16')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0xc8f3d({'ret':_0x1233b6});}else _0xc8f3d({'ret':_0x1233b6});}else{_0xc8f3d({'ret':_0x1233b6});}});}});return 0xa;}var _0x10de7e=function(_0xd8bc8f){return new BPromise(function(_0x4c89d3,_0x2e08a8){_0x2532aa(_0xd8bc8f,_0x3cfeb6)[_0x8ead('0x1b')](function(_0x584696){_0x3cfeb6['scheduledat']=_0x584696[_0x8ead('0x21')];_0x3f34c5[_0x8ead('0x22')]['findOne']({'where':{'phone':_0x3cfeb6[_0x8ead('0xb')],'VoiceQueueId':_0xd8bc8f['id']}})[_0x8ead('0x1b')](function(_0x377535){if(!_[_0x8ead('0x1c')](_0x377535)){throw new Error(_0x8ead('0x23')+_0x3cfeb6[_0x8ead('0xb')]+_0x8ead('0x24')+_0xd8bc8f['id']);}return _0x3f34c5[_0x8ead('0x22')][_0x8ead('0x25')]({'phone':_0x3cfeb6[_0x8ead('0xb')],'ContactId':_0x3cfeb6['id'],'ListId':_0x3cfeb6[_0x8ead('0x26')],'priority':_0x3cfeb6[_0x8ead('0x27')]?_0x3cfeb6[_0x8ead('0x27')]:0x2,'scheduledat':_0x3cfeb6[_0x8ead('0x15')]?_0x3cfeb6[_0x8ead('0x15')]:moment()['format'](_0x8ead('0x17')),'callback':_0x3cfeb6[_0x8ead('0x28')]?!![]:![],'callbackuniqueid':_0x3cfeb6[_0x8ead('0x28')]?_0x3cfeb6[_0x8ead('0x28')]:undefined,'callbackat':_0x3cfeb6[_0x8ead('0x28')]?moment()[_0x8ead('0x16')](_0x8ead('0x17')):undefined,'VoiceQueueId':_0xd8bc8f['id']});})['catch'](function(_0xa1d3eb){_0x2e08a8(_0xa1d3eb);});});});};var _0x2a5af5=function(_0x28334f){return new BPromise(function(_0x592896,_0x1ae103){_0x2532aa(_0x28334f,_0x3cfeb6)[_0x8ead('0x1b')](function(_0x423bbb){_0x3cfeb6[_0x8ead('0x15')]=_0x423bbb[_0x8ead('0x21')];_0x3f34c5['CmHopper']['findOne']({'where':{'phone':_0x3cfeb6['phone'],'VoiceQueueId':_0x28334f['id']}})['then'](function(_0x4f1845){if(!_[_0x8ead('0x1c')](_0x4f1845)){throw new Error('cmContact,\x20afterCreate\x20'+_0x3cfeb6['phone']+_0x8ead('0x29')+_0x28334f['id']);}return _0x3f34c5[_0x8ead('0x2a')][_0x8ead('0x1a')]({'where':{'calleridnum':_0x3cfeb6['phone'],'VoiceQueueId':_0x28334f['id']}});})[_0x8ead('0x1b')](function(_0x25deb1){if(!_['isNil'](_0x25deb1)){throw new Error(_0x8ead('0x2b')+_0x3cfeb6[_0x8ead('0xb')]+_0x8ead('0x2c')+_0x28334f['id']);}return _0x3f34c5['CmHopper']['create']({'phone':_0x3cfeb6[_0x8ead('0xb')],'ContactId':_0x3cfeb6['id'],'ListId':_0x3cfeb6[_0x8ead('0x26')],'priority':_0x3cfeb6[_0x8ead('0x27')]?_0x3cfeb6[_0x8ead('0x27')]:0x2,'scheduledat':_0x3cfeb6['scheduledat']?_0x3cfeb6[_0x8ead('0x15')]:moment()['format'](_0x8ead('0x17')),'callback':_0x3cfeb6[_0x8ead('0x28')]?!![]:![],'callbackuniqueid':_0x3cfeb6[_0x8ead('0x28')]?_0x3cfeb6[_0x8ead('0x28')]:undefined,'callbackat':_0x3cfeb6[_0x8ead('0x28')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x28334f['id']});})[_0x8ead('0x2d')](function(_0x265cb8){_0x1ae103(_0x265cb8);});});});};function _0x2f91d8(){return function(_0x38e3a1){logger['error'](_0x8ead('0x2e'),_0x8ead('0x2f'),util['inspect'](_0x38e3a1,{'showHidden':![],'depth':null}));};}function _0x2b7144(_0x1e1297,_0x4d5d76){var _0xf71907=_0x4d5d76[_0x8ead('0x15')]?_0x4d5d76[_0x8ead('0x15')]:moment()[_0x8ead('0x16')](_0x8ead('0x17'));return new BPromise(function(_0x5cd446,_0x163864){if(_[_0x8ead('0x1c')](_0x4d5d76[_0x8ead('0x18')])){_0x5cd446({'ret':_0xf71907});}else{_0x3f34c5[_0x8ead('0x30')][_0x8ead('0x1a')]({'where':{'id':_0x1e1297['id']}})[_0x8ead('0x1b')](function(_0x2444b7){if(!_[_0x8ead('0x1c')](_0x2444b7)){var _0x5dfc4a=_0x2444b7[_0x8ead('0x18')];if(!_[_0x8ead('0x1c')](_0x5dfc4a)){var _0xe6d9cb=shared[_0x8ead('0x1d')];var _0x3f91de=_0xe6d9cb[_0x5dfc4a];var _0xa67b2b=_0xe6d9cb[_0x4d5d76['dialTimezone']];if(!_[_0x8ead('0x1c')](_0x3f91de)&&!_[_0x8ead('0x1c')](_0xa67b2b)){var _0x52c0c1=_0x3f91de[_0x8ead('0x1e')]-_0xa67b2b[_0x8ead('0x1e')];_0xf71907=_0x4d5d76[_0x8ead('0x15')]?_0x4d5d76[_0x8ead('0x15')]:moment();var _0x3e2ee0=moment(_0xf71907)[_0x8ead('0x1f')](_0x52c0c1,_0x8ead('0x20'));_0x5cd446({'ret':_0x3e2ee0[_0x8ead('0x16')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x5cd446({'ret':_0xf71907});}else _0x5cd446({'ret':_0xf71907});}else{_0x5cd446({'ret':_0xf71907});}});}});return 0xa;}var _0x2d5a1b=function(_0x5dac65){return new BPromise(function(_0x1693db,_0x13805f){_0x2b7144(_0x5dac65,_0x3cfeb6)[_0x8ead('0x1b')](function(_0x425310){_0x3cfeb6[_0x8ead('0x15')]=_0x425310['ret'];_0x3f34c5['CmHopper'][_0x8ead('0x1a')]({'where':{'phone':_0x3cfeb6[_0x8ead('0xb')],'CampaignId':_0x5dac65['id']}})[_0x8ead('0x1b')](function(_0x20fafd){if(!_[_0x8ead('0x1c')](_0x20fafd)){throw new Error(_0x8ead('0x23')+_0x3cfeb6[_0x8ead('0xb')]+_0x8ead('0x31')+_0x5dac65['id']);}return _0x3f34c5[_0x8ead('0x22')][_0x8ead('0x25')]({'phone':_0x3cfeb6[_0x8ead('0xb')],'ContactId':_0x3cfeb6['id'],'ListId':_0x3cfeb6[_0x8ead('0x26')],'priority':_0x3cfeb6['priority']?_0x3cfeb6['priority']:0x2,'scheduledat':_0x3cfeb6[_0x8ead('0x15')]?_0x3cfeb6[_0x8ead('0x15')]:moment()[_0x8ead('0x16')](_0x8ead('0x17')),'callback':_0x3cfeb6[_0x8ead('0x28')]?!![]:![],'callbackuniqueid':_0x3cfeb6[_0x8ead('0x28')]?_0x3cfeb6['callbackUniqueid']:undefined,'callbackat':_0x3cfeb6[_0x8ead('0x28')]?moment()['format'](_0x8ead('0x17')):undefined,'CampaignId':_0x5dac65['id']});})[_0x8ead('0x2d')](function(_0x5c5193){_0x13805f(_0x5c5193);});});});};var _0x4cd244=function(_0x4c8d46){return new BPromise(function(_0x3e0bd4,_0x45fded){_0x2b7144(_0x4c8d46,_0x3cfeb6)[_0x8ead('0x1b')](function(_0x3fb42f){_0x3cfeb6['scheduledat']=_0x3fb42f['ret'];_0x3f34c5['CmHopper'][_0x8ead('0x1a')]({'where':{'phone':_0x3cfeb6[_0x8ead('0xb')],'CampaignId':_0x4c8d46['id']}})['then'](function(_0x4a38f1){if(!_[_0x8ead('0x1c')](_0x4a38f1)){throw new Error(_0x8ead('0x23')+_0x3cfeb6[_0x8ead('0xb')]+_0x8ead('0x32')+_0x4c8d46['id']);}return _0x3f34c5[_0x8ead('0x2a')]['findOne']({'where':{'calleridnum':_0x3cfeb6[_0x8ead('0xb')],'CampaignId':_0x4c8d46['id']}});})['then'](function(_0x3a1a63){if(!_['isNil'](_0x3a1a63)){throw new Error(_0x8ead('0x2b')+_0x3cfeb6[_0x8ead('0xb')]+_0x8ead('0x33')+_0x4c8d46['id']);}return _0x3f34c5[_0x8ead('0x22')][_0x8ead('0x25')]({'phone':_0x3cfeb6['phone'],'ContactId':_0x3cfeb6['id'],'ListId':_0x3cfeb6[_0x8ead('0x26')],'priority':_0x3cfeb6[_0x8ead('0x27')]?_0x3cfeb6[_0x8ead('0x27')]:0x2,'scheduledat':_0x3cfeb6[_0x8ead('0x15')]?_0x3cfeb6[_0x8ead('0x15')]:moment()[_0x8ead('0x16')](_0x8ead('0x17')),'callback':_0x3cfeb6[_0x8ead('0x28')]?!![]:![],'callbackuniqueid':_0x3cfeb6[_0x8ead('0x28')]?_0x3cfeb6['callbackUniqueid']:undefined,'callbackat':_0x3cfeb6[_0x8ead('0x28')]?moment()[_0x8ead('0x16')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x4c8d46['id']});})[_0x8ead('0x2d')](function(_0x297880){_0x45fded(_0x297880);});});});};if(_0x3cfeb6[_0x8ead('0x26')]){_0x3f34c5['VoiceQueue'][_0x8ead('0x34')]({'where':{'type':_0x8ead('0x35')},'attributes':['id','dialCheckDuplicateType',_0x8ead('0x18')],'include':[{'model':_0x3f34c5[_0x8ead('0x36')],'as':_0x8ead('0x37'),'where':{'id':_0x3cfeb6['ListId']}}]})['then'](function(_0x4ed637){if(_0x4ed637){var _0xd59a96=[];for(var _0x1625c4=0x0,_0x39d229;_0x1625c4<_0x4ed637[_0x8ead('0x38')];_0x1625c4+=0x1){_0x39d229=_0x4ed637[_0x1625c4][_0x8ead('0x13')]({'plain':!![]});switch(_0x39d229[_0x8ead('0x39')]){case _0x8ead('0x3a'):_0x2a5af5(_0x39d229)['catch'](_0x1b7f6c());break;case'onlyIfOpen':_0x10de7e(_0x39d229)[_0x8ead('0x2d')](_0x1b7f6c());break;default:_0x2b7144(_0x39d229,_0x3cfeb6)[_0x8ead('0x1b')](function(_0x171be7){_0x3cfeb6[_0x8ead('0x15')]=_0x171be7['ret'];_0x3f34c5['CmHopper'][_0x8ead('0x25')]({'phone':_0x3cfeb6['phone'],'ContactId':_0x3cfeb6['id'],'ListId':_0x3cfeb6[_0x8ead('0x26')],'scheduledat':_0x3cfeb6[_0x8ead('0x15')]?_0x3cfeb6[_0x8ead('0x15')]:moment()[_0x8ead('0x16')](_0x8ead('0x17')),'priority':_0x3cfeb6[_0x8ead('0x27')]?_0x3cfeb6['priority']:0x2,'callback':_0x3cfeb6[_0x8ead('0x28')]?!![]:![],'callbackuniqueid':_0x3cfeb6[_0x8ead('0x28')]?_0x3cfeb6[_0x8ead('0x28')]:undefined,'callbackat':_0x3cfeb6['callbackUniqueid']?moment()[_0x8ead('0x16')](_0x8ead('0x17')):undefined,'VoiceQueueId':_0x39d229['id']})['catch'](_0x1b7f6c());});}}}})[_0x8ead('0x1b')](function(){return _0x3f34c5[_0x8ead('0x19')][_0x8ead('0x34')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x3f34c5[_0x8ead('0x36')],'as':_0x8ead('0x3b'),'where':{'id':_0x3cfeb6['ListId']}}]})[_0x8ead('0x1b')](function(_0x50f50a){if(_0x50f50a){var _0x2d79a4=[];for(var _0x106007=0x0,_0x15c542;_0x106007<_0x50f50a[_0x8ead('0x38')];_0x106007+=0x1){_0x15c542=_0x50f50a[_0x106007]['get']({'plain':!![]});_0x3f34c5['CmHopperBlack'][_0x8ead('0x25')]({'phone':_0x3cfeb6[_0x8ead('0xb')],'ContactId':_0x3cfeb6['id'],'ListId':_0x3cfeb6[_0x8ead('0x26')],'VoiceQueueId':_0x15c542['id']})[_0x8ead('0x2d')](function(_0x43ac75){logger[_0x8ead('0x14')]('cmContact,\x20%s,\x20%s',_0x8ead('0x2f'),_0x43ac75[_0x8ead('0x3c')]);});}}});})[_0x8ead('0x1b')](function(){return _0x3f34c5[_0x8ead('0x30')][_0x8ead('0x34')]({'attributes':['id',_0x8ead('0x39'),_0x8ead('0x18')],'include':[{'model':_0x3f34c5['CmList'],'as':_0x8ead('0x37'),'where':{'id':_0x3cfeb6[_0x8ead('0x26')]}}]})['then'](function(_0x84bd03){if(_0x84bd03){var _0x6b4d7b=[];for(var _0x4eb332=0x0,_0x3ae33a;_0x4eb332<_0x84bd03[_0x8ead('0x38')];_0x4eb332+=0x1){_0x3ae33a=_0x84bd03[_0x4eb332]['get']({'plain':!![]});switch(_0x3ae33a[_0x8ead('0x39')]){case _0x8ead('0x3a'):_0x4cd244(_0x3ae33a)[_0x8ead('0x2d')](_0x2f91d8());break;case _0x8ead('0x3d'):_0x2d5a1b(_0x3ae33a)[_0x8ead('0x2d')](_0x2f91d8());break;default:_0x3f34c5[_0x8ead('0x22')][_0x8ead('0x25')]({'phone':_0x3cfeb6[_0x8ead('0xb')],'ContactId':_0x3cfeb6['id'],'ListId':_0x3cfeb6[_0x8ead('0x26')],'scheduledat':_0x3cfeb6[_0x8ead('0x15')]?_0x3cfeb6[_0x8ead('0x15')]:moment()[_0x8ead('0x16')](_0x8ead('0x17')),'priority':_0x3cfeb6[_0x8ead('0x27')]?_0x3cfeb6[_0x8ead('0x27')]:0x2,'callback':_0x3cfeb6['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x3cfeb6[_0x8ead('0x28')]?_0x3cfeb6['callbackUniqueid']:undefined,'callbackat':_0x3cfeb6[_0x8ead('0x28')]?moment()[_0x8ead('0x16')](_0x8ead('0x17')):undefined,'CampaignId':_0x3ae33a['id']})['catch'](_0x2f91d8());}}}});})[_0x8ead('0x1b')](function(){return _0x3f34c5[_0x8ead('0x30')][_0x8ead('0x34')]({'attributes':['id'],'include':[{'model':_0x3f34c5[_0x8ead('0x36')],'as':_0x8ead('0x3b'),'where':{'id':_0x3cfeb6[_0x8ead('0x26')]}}]})[_0x8ead('0x1b')](function(_0x28fbcb){if(_0x28fbcb){var _0x577486=[];for(var _0xb9cdf6=0x0,_0x106d3b;_0xb9cdf6<_0x28fbcb[_0x8ead('0x38')];_0xb9cdf6+=0x1){_0x106d3b=_0x28fbcb[_0xb9cdf6][_0x8ead('0x13')]({'plain':!![]});_0x3f34c5[_0x8ead('0x3e')][_0x8ead('0x25')]({'phone':_0x3cfeb6[_0x8ead('0xb')],'ContactId':_0x3cfeb6['id'],'ListId':_0x3cfeb6[_0x8ead('0x26')],'CampaignId':_0x106d3b['id']})[_0x8ead('0x2d')](function(_0x2c02be){logger[_0x8ead('0x14')](_0x8ead('0x3f'),_0x8ead('0x2f'),_0x2c02be[_0x8ead('0x3c')]);});}}});})[_0x8ead('0x1b')](function(){_0xfe7f3c();})[_0x8ead('0x2d')](function(_0x4b8ae2){logger[_0x8ead('0x14')](_0x8ead('0x3f'),_0x8ead('0x2f'),_0x4b8ae2[_0x8ead('0x3c')]);_0xfe7f3c(_0x4b8ae2);});}else{_0xfe7f3c(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0x4c25c6,_0x5a7dd4,_0x4167e0){var _0x4b09d8=_0x1a76ef['models'];var _0x5f11fa=_0x4c25c6[_0x8ead('0x13')]({'plain':!![]});return _0x4b09d8[_0x8ead('0x22')]['findAll']({'raw':!![],'where':{'ListId':_0x5f11fa['ListId'],'ContactId':_0x5f11fa['id']}})['then'](function(_0x3bd192){if(!_['isEmpty'](_0x3bd192)){var _0x3c7a85=[];for(var _0x2cf9f1=0x0;_0x2cf9f1<_0x3bd192[_0x8ead('0x38')];_0x2cf9f1+=0x1){var _0x4f04c8=_0x4b09d8[_0x8ead('0x22')][_0x8ead('0x40')]({'where':{'ListId':_0x3bd192[_0x2cf9f1][_0x8ead('0x26')],'ContactId':_0x3bd192[_0x2cf9f1][_0x8ead('0x41')],'VoiceQueueId':_0x3bd192[_0x2cf9f1][_0x8ead('0x42')],'CampaignId':_0x3bd192[_0x2cf9f1]['CampaignId']}});_0x3c7a85[_0x8ead('0x43')](_0x4f04c8);}return BPromise[_0x8ead('0x44')](_0x3c7a85);}})[_0x8ead('0x1b')](function(_0x541849){logger[_0x8ead('0x45')](_0x8ead('0x46'),util[_0x8ead('0x47')](_0x541849,{'showHidden':![],'depth':null}));_0x4167e0();})[_0x8ead('0x2d')](function(_0x589ff9){logger[_0x8ead('0x14')](_0x8ead('0x48'),util[_0x8ead('0x47')](_0x589ff9,{'showHidden':![],'depth':null}));_0x4167e0(_0x589ff9);});}}});}; \ No newline at end of file +var _0x1b12=['scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','VoiceQueue','findOne','then','timezones','dialTimezone','add','minutes','ret','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','cmContact','Campaign','utcOffset','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','outbound','CmList','length','get','dialCheckDuplicateType','always','onlyIfOpen','findAll','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','Lists','message','List\x20not\x20found','CampaignId','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','cm_contacts','phone','fti_cm_contacts','firstName','fax','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','error','afterCreate','inspect'];(function(_0x456bd2,_0x156c79){var _0x2218c1=function(_0x44f2d4){while(--_0x44f2d4){_0x456bd2['push'](_0x456bd2['shift']());}};_0x2218c1(++_0x156c79);}(_0x1b12,0x103));var _0x21b1=function(_0x57e712,_0x72dd0a){_0x57e712=_0x57e712-0x0;var _0x5262a3=_0x1b12[_0x57e712];return _0x5262a3;};'use strict';var _=require(_0x21b1('0x0'));var util=require(_0x21b1('0x1'));var logger=require(_0x21b1('0x2'))(_0x21b1('0x3'));var moment=require('moment');var BPromise=require(_0x21b1('0x4'));var rp=require(_0x21b1('0x5'));var fs=require('fs');var path=require(_0x21b1('0x6'));var rimraf=require(_0x21b1('0x7'));var config=require(_0x21b1('0x8'));var shared=require(_0x21b1('0x9'));var attributes=require(_0x21b1('0xa'));module[_0x21b1('0xb')]=function(_0x1e6a84,_0x64ba99){return _0x1e6a84[_0x21b1('0xc')]('CmContact',attributes,{'tableName':_0x21b1('0xd'),'paranoid':!![],'indexes':[{'name':_0x21b1('0xe'),'fields':[_0x21b1('0xe')]},{'name':_0x21b1('0xf'),'fields':[_0x21b1('0x10'),'lastName',_0x21b1('0xe'),'mobile',_0x21b1('0x11'),'email'],'type':_0x21b1('0x12')}],'timestamps':!![],'charset':_0x21b1('0x13'),'collate':_0x21b1('0x14'),'hooks':{'afterCreate':function(_0x444260,_0x82dd6c,_0x503ae2){var _0x33f7de=_0x1e6a84[_0x21b1('0x15')];var _0x425a09=_0x444260['get']({'plain':!![]});function _0x24ff95(){return function(_0x38cddb){logger[_0x21b1('0x16')]('cmContact',_0x21b1('0x17'),util[_0x21b1('0x18')](_0x38cddb,{'showHidden':![],'depth':null}));};}function _0x530811(_0x288486,_0x3fafbe){var _0x5c7aa9=_0x3fafbe[_0x21b1('0x19')]?_0x3fafbe[_0x21b1('0x19')]:moment()[_0x21b1('0x1a')](_0x21b1('0x1b'));return new BPromise(function(_0x4d8491,_0x555e2f){if(_[_0x21b1('0x1c')](_0x3fafbe['dialTimezone'])){_0x4d8491({'ret':_0x5c7aa9});}else{_0x33f7de[_0x21b1('0x1d')][_0x21b1('0x1e')]({'where':{'id':_0x288486['id']}})[_0x21b1('0x1f')](function(_0x35aee3){if(!_['isNil'](_0x35aee3)){var _0x373369=_0x35aee3['dialTimezone'];if(!_[_0x21b1('0x1c')](_0x373369)){var _0x2c1068=shared[_0x21b1('0x20')];var _0x49e281=_0x2c1068[_0x373369];var _0x2dd58c=_0x2c1068[_0x3fafbe[_0x21b1('0x21')]];if(!_[_0x21b1('0x1c')](_0x49e281)&&!_[_0x21b1('0x1c')](_0x2dd58c)){var _0x5d2bde=_0x49e281['utcOffset']-_0x2dd58c['utcOffset'];_0x5c7aa9=_0x3fafbe[_0x21b1('0x19')]?_0x3fafbe[_0x21b1('0x19')]:moment();var _0xb21c7d=moment(_0x5c7aa9)[_0x21b1('0x22')](_0x5d2bde,_0x21b1('0x23'));_0x4d8491({'ret':_0xb21c7d[_0x21b1('0x1a')](_0x21b1('0x1b'))});}else _0x4d8491({'ret':_0x5c7aa9});}else _0x4d8491({'ret':_0x5c7aa9});}else{_0x4d8491({'ret':_0x5c7aa9});}});}});return 0xa;}var _0x580956=function(_0x5a1740){return new BPromise(function(_0x53374a,_0xb5a45c){_0x530811(_0x5a1740,_0x425a09)['then'](function(_0x587cbb){_0x425a09[_0x21b1('0x19')]=_0x587cbb[_0x21b1('0x24')];_0x33f7de[_0x21b1('0x25')][_0x21b1('0x1e')]({'where':{'phone':_0x425a09[_0x21b1('0xe')],'VoiceQueueId':_0x5a1740['id']}})[_0x21b1('0x1f')](function(_0x147e99){if(!_[_0x21b1('0x1c')](_0x147e99)){throw new Error(_0x21b1('0x26')+_0x425a09['phone']+_0x21b1('0x27')+_0x5a1740['id']);}return _0x33f7de[_0x21b1('0x25')]['create']({'phone':_0x425a09['phone'],'ContactId':_0x425a09['id'],'ListId':_0x425a09[_0x21b1('0x28')],'priority':_0x425a09[_0x21b1('0x29')]?_0x425a09[_0x21b1('0x29')]:0x2,'scheduledat':_0x425a09[_0x21b1('0x19')]?_0x425a09[_0x21b1('0x19')]:moment()[_0x21b1('0x1a')](_0x21b1('0x1b')),'callback':_0x425a09[_0x21b1('0x2a')]?!![]:![],'callbackuniqueid':_0x425a09[_0x21b1('0x2a')]?_0x425a09[_0x21b1('0x2a')]:undefined,'callbackat':_0x425a09[_0x21b1('0x2a')]?moment()[_0x21b1('0x1a')](_0x21b1('0x1b')):undefined,'VoiceQueueId':_0x5a1740['id']});})[_0x21b1('0x2b')](function(_0x4b62cf){_0xb5a45c(_0x4b62cf);});});});};var _0x29baa8=function(_0x21e83f){return new BPromise(function(_0x1de6de,_0x4fe17b){_0x530811(_0x21e83f,_0x425a09)[_0x21b1('0x1f')](function(_0x299ed4){_0x425a09[_0x21b1('0x19')]=_0x299ed4[_0x21b1('0x24')];_0x33f7de['CmHopper']['findOne']({'where':{'phone':_0x425a09[_0x21b1('0xe')],'VoiceQueueId':_0x21e83f['id']}})[_0x21b1('0x1f')](function(_0x530e58){if(!_[_0x21b1('0x1c')](_0x530e58)){throw new Error(_0x21b1('0x26')+_0x425a09[_0x21b1('0xe')]+_0x21b1('0x2c')+_0x21e83f['id']);}return _0x33f7de['CmHopperFinal'][_0x21b1('0x1e')]({'where':{'calleridnum':_0x425a09['phone'],'VoiceQueueId':_0x21e83f['id']}});})[_0x21b1('0x1f')](function(_0x49c494){if(!_[_0x21b1('0x1c')](_0x49c494)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x425a09[_0x21b1('0xe')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0x21e83f['id']);}return _0x33f7de[_0x21b1('0x25')][_0x21b1('0x2d')]({'phone':_0x425a09[_0x21b1('0xe')],'ContactId':_0x425a09['id'],'ListId':_0x425a09[_0x21b1('0x28')],'priority':_0x425a09[_0x21b1('0x29')]?_0x425a09[_0x21b1('0x29')]:0x2,'scheduledat':_0x425a09[_0x21b1('0x19')]?_0x425a09['scheduledat']:moment()[_0x21b1('0x1a')](_0x21b1('0x1b')),'callback':_0x425a09[_0x21b1('0x2a')]?!![]:![],'callbackuniqueid':_0x425a09['callbackUniqueid']?_0x425a09[_0x21b1('0x2a')]:undefined,'callbackat':_0x425a09[_0x21b1('0x2a')]?moment()[_0x21b1('0x1a')](_0x21b1('0x1b')):undefined,'VoiceQueueId':_0x21e83f['id']});})[_0x21b1('0x2b')](function(_0x37c105){_0x4fe17b(_0x37c105);});});});};function _0x18fc0b(){return function(_0x55900e){logger[_0x21b1('0x16')](_0x21b1('0x2e'),'afterCreate',util['inspect'](_0x55900e,{'showHidden':![],'depth':null}));};}function _0x1326c1(_0x4469b2,_0x50c556){var _0x341903=_0x50c556[_0x21b1('0x19')]?_0x50c556[_0x21b1('0x19')]:moment()[_0x21b1('0x1a')](_0x21b1('0x1b'));return new BPromise(function(_0x57d5da,_0x20dd3f){if(_['isNil'](_0x50c556['dialTimezone'])){_0x57d5da({'ret':_0x341903});}else{_0x33f7de[_0x21b1('0x2f')][_0x21b1('0x1e')]({'where':{'id':_0x4469b2['id']}})[_0x21b1('0x1f')](function(_0x29dc98){if(!_[_0x21b1('0x1c')](_0x29dc98)){var _0x479921=_0x29dc98[_0x21b1('0x21')];if(!_[_0x21b1('0x1c')](_0x479921)){var _0x66f733=shared[_0x21b1('0x20')];var _0x3ab8fe=_0x66f733[_0x479921];var _0x1b5590=_0x66f733[_0x50c556[_0x21b1('0x21')]];if(!_['isNil'](_0x3ab8fe)&&!_[_0x21b1('0x1c')](_0x1b5590)){var _0xe4818f=_0x3ab8fe['utcOffset']-_0x1b5590[_0x21b1('0x30')];_0x341903=_0x50c556[_0x21b1('0x19')]?_0x50c556[_0x21b1('0x19')]:moment();var _0x2ac2ce=moment(_0x341903)[_0x21b1('0x22')](_0xe4818f,_0x21b1('0x23'));_0x57d5da({'ret':_0x2ac2ce[_0x21b1('0x1a')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x57d5da({'ret':_0x341903});}else _0x57d5da({'ret':_0x341903});}else{_0x57d5da({'ret':_0x341903});}});}});return 0xa;}var _0x5b1f5d=function(_0x212d46){return new BPromise(function(_0x52415b,_0x4df70a){_0x1326c1(_0x212d46,_0x425a09)['then'](function(_0x1c5ad9){_0x425a09[_0x21b1('0x19')]=_0x1c5ad9[_0x21b1('0x24')];_0x33f7de[_0x21b1('0x25')][_0x21b1('0x1e')]({'where':{'phone':_0x425a09['phone'],'CampaignId':_0x212d46['id']}})[_0x21b1('0x1f')](function(_0x1988cc){if(!_['isNil'](_0x1988cc)){throw new Error(_0x21b1('0x26')+_0x425a09[_0x21b1('0xe')]+_0x21b1('0x31')+_0x212d46['id']);}return _0x33f7de[_0x21b1('0x25')][_0x21b1('0x2d')]({'phone':_0x425a09[_0x21b1('0xe')],'ContactId':_0x425a09['id'],'ListId':_0x425a09['ListId'],'priority':_0x425a09['priority']?_0x425a09[_0x21b1('0x29')]:0x2,'scheduledat':_0x425a09['scheduledat']?_0x425a09[_0x21b1('0x19')]:moment()[_0x21b1('0x1a')](_0x21b1('0x1b')),'callback':_0x425a09['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x425a09['callbackUniqueid']?_0x425a09[_0x21b1('0x2a')]:undefined,'callbackat':_0x425a09[_0x21b1('0x2a')]?moment()[_0x21b1('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x212d46['id']});})['catch'](function(_0x160381){_0x4df70a(_0x160381);});});});};var _0x4f3ff8=function(_0x3f9128){return new BPromise(function(_0x2a7a24,_0x587d9d){_0x1326c1(_0x3f9128,_0x425a09)['then'](function(_0xec72e6){_0x425a09[_0x21b1('0x19')]=_0xec72e6['ret'];_0x33f7de[_0x21b1('0x25')]['findOne']({'where':{'phone':_0x425a09[_0x21b1('0xe')],'CampaignId':_0x3f9128['id']}})[_0x21b1('0x1f')](function(_0x1e4cc1){if(!_[_0x21b1('0x1c')](_0x1e4cc1)){throw new Error('cmContact,\x20afterCreate\x20'+_0x425a09['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x3f9128['id']);}return _0x33f7de[_0x21b1('0x32')][_0x21b1('0x1e')]({'where':{'calleridnum':_0x425a09[_0x21b1('0xe')],'CampaignId':_0x3f9128['id']}});})[_0x21b1('0x1f')](function(_0xe36f7a){if(!_['isNil'](_0xe36f7a)){throw new Error(_0x21b1('0x33')+_0x425a09[_0x21b1('0xe')]+_0x21b1('0x34')+_0x3f9128['id']);}return _0x33f7de['CmHopper'][_0x21b1('0x2d')]({'phone':_0x425a09[_0x21b1('0xe')],'ContactId':_0x425a09['id'],'ListId':_0x425a09[_0x21b1('0x28')],'priority':_0x425a09[_0x21b1('0x29')]?_0x425a09[_0x21b1('0x29')]:0x2,'scheduledat':_0x425a09[_0x21b1('0x19')]?_0x425a09['scheduledat']:moment()[_0x21b1('0x1a')](_0x21b1('0x1b')),'callback':_0x425a09[_0x21b1('0x2a')]?!![]:![],'callbackuniqueid':_0x425a09[_0x21b1('0x2a')]?_0x425a09['callbackUniqueid']:undefined,'callbackat':_0x425a09[_0x21b1('0x2a')]?moment()[_0x21b1('0x1a')](_0x21b1('0x1b')):undefined,'CampaignId':_0x3f9128['id']});})['catch'](function(_0x3e2177){_0x587d9d(_0x3e2177);});});});};if(_0x425a09[_0x21b1('0x28')]){_0x33f7de['VoiceQueue']['findAll']({'where':{'type':_0x21b1('0x35')},'attributes':['id','dialCheckDuplicateType',_0x21b1('0x21')],'include':[{'model':_0x33f7de[_0x21b1('0x36')],'as':'Lists','where':{'id':_0x425a09[_0x21b1('0x28')]}}]})[_0x21b1('0x1f')](function(_0x34068a){if(_0x34068a){var _0x5cc0ee=[];for(var _0x37cbd0=0x0,_0x1240ce;_0x37cbd0<_0x34068a[_0x21b1('0x37')];_0x37cbd0+=0x1){_0x1240ce=_0x34068a[_0x37cbd0][_0x21b1('0x38')]({'plain':!![]});switch(_0x1240ce[_0x21b1('0x39')]){case _0x21b1('0x3a'):_0x29baa8(_0x1240ce)[_0x21b1('0x2b')](_0x24ff95());break;case _0x21b1('0x3b'):_0x580956(_0x1240ce)[_0x21b1('0x2b')](_0x24ff95());break;default:_0x1326c1(_0x1240ce,_0x425a09)['then'](function(_0x3ecad7){_0x425a09[_0x21b1('0x19')]=_0x3ecad7[_0x21b1('0x24')];_0x33f7de[_0x21b1('0x25')][_0x21b1('0x2d')]({'phone':_0x425a09[_0x21b1('0xe')],'ContactId':_0x425a09['id'],'ListId':_0x425a09[_0x21b1('0x28')],'scheduledat':_0x425a09[_0x21b1('0x19')]?_0x425a09[_0x21b1('0x19')]:moment()[_0x21b1('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x425a09['priority']?_0x425a09[_0x21b1('0x29')]:0x2,'callback':_0x425a09[_0x21b1('0x2a')]?!![]:![],'callbackuniqueid':_0x425a09[_0x21b1('0x2a')]?_0x425a09[_0x21b1('0x2a')]:undefined,'callbackat':_0x425a09[_0x21b1('0x2a')]?moment()[_0x21b1('0x1a')](_0x21b1('0x1b')):undefined,'VoiceQueueId':_0x1240ce['id']})['catch'](_0x24ff95());});}}}})[_0x21b1('0x1f')](function(){return _0x33f7de[_0x21b1('0x1d')][_0x21b1('0x3c')]({'where':{'type':_0x21b1('0x35')},'attributes':['id'],'include':[{'model':_0x33f7de['CmList'],'as':_0x21b1('0x3d'),'where':{'id':_0x425a09[_0x21b1('0x28')]}}]})[_0x21b1('0x1f')](function(_0x2c65ef){if(_0x2c65ef){var _0x5c28bc=[];for(var _0x467b21=0x0,_0x4db297;_0x467b21<_0x2c65ef[_0x21b1('0x37')];_0x467b21+=0x1){_0x4db297=_0x2c65ef[_0x467b21][_0x21b1('0x38')]({'plain':!![]});_0x33f7de[_0x21b1('0x3e')][_0x21b1('0x2d')]({'phone':_0x425a09[_0x21b1('0xe')],'ContactId':_0x425a09['id'],'ListId':_0x425a09[_0x21b1('0x28')],'VoiceQueueId':_0x4db297['id']})[_0x21b1('0x2b')](function(_0x35247a){logger[_0x21b1('0x16')](_0x21b1('0x3f'),'afterCreate',_0x35247a['message']);});}}});})[_0x21b1('0x1f')](function(){return _0x33f7de[_0x21b1('0x2f')]['findAll']({'attributes':['id',_0x21b1('0x39'),_0x21b1('0x21')],'include':[{'model':_0x33f7de['CmList'],'as':_0x21b1('0x40'),'where':{'id':_0x425a09[_0x21b1('0x28')]}}]})[_0x21b1('0x1f')](function(_0x52ad06){if(_0x52ad06){var _0x492a2d=[];for(var _0x44f824=0x0,_0x309465;_0x44f824<_0x52ad06[_0x21b1('0x37')];_0x44f824+=0x1){_0x309465=_0x52ad06[_0x44f824][_0x21b1('0x38')]({'plain':!![]});switch(_0x309465['dialCheckDuplicateType']){case _0x21b1('0x3a'):_0x4f3ff8(_0x309465)['catch'](_0x18fc0b());break;case _0x21b1('0x3b'):_0x5b1f5d(_0x309465)[_0x21b1('0x2b')](_0x18fc0b());break;default:_0x33f7de[_0x21b1('0x25')][_0x21b1('0x2d')]({'phone':_0x425a09[_0x21b1('0xe')],'ContactId':_0x425a09['id'],'ListId':_0x425a09[_0x21b1('0x28')],'scheduledat':_0x425a09[_0x21b1('0x19')]?_0x425a09[_0x21b1('0x19')]:moment()['format'](_0x21b1('0x1b')),'priority':_0x425a09['priority']?_0x425a09[_0x21b1('0x29')]:0x2,'callback':_0x425a09['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x425a09[_0x21b1('0x2a')]?_0x425a09[_0x21b1('0x2a')]:undefined,'callbackat':_0x425a09[_0x21b1('0x2a')]?moment()[_0x21b1('0x1a')](_0x21b1('0x1b')):undefined,'CampaignId':_0x309465['id']})['catch'](_0x18fc0b());}}}});})[_0x21b1('0x1f')](function(){return _0x33f7de['Campaign'][_0x21b1('0x3c')]({'attributes':['id'],'include':[{'model':_0x33f7de[_0x21b1('0x36')],'as':_0x21b1('0x3d'),'where':{'id':_0x425a09[_0x21b1('0x28')]}}]})['then'](function(_0x2263fa){if(_0x2263fa){var _0x1ce004=[];for(var _0x40152a=0x0,_0x58cb04;_0x40152a<_0x2263fa[_0x21b1('0x37')];_0x40152a+=0x1){_0x58cb04=_0x2263fa[_0x40152a][_0x21b1('0x38')]({'plain':!![]});_0x33f7de[_0x21b1('0x3e')][_0x21b1('0x2d')]({'phone':_0x425a09['phone'],'ContactId':_0x425a09['id'],'ListId':_0x425a09[_0x21b1('0x28')],'CampaignId':_0x58cb04['id']})[_0x21b1('0x2b')](function(_0x49eb66){logger[_0x21b1('0x16')](_0x21b1('0x3f'),_0x21b1('0x17'),_0x49eb66[_0x21b1('0x41')]);});}}});})['then'](function(){_0x503ae2();})[_0x21b1('0x2b')](function(_0x1f5273){logger['error'](_0x21b1('0x3f'),_0x21b1('0x17'),_0x1f5273[_0x21b1('0x41')]);_0x503ae2(_0x1f5273);});}else{_0x503ae2(new Error(_0x21b1('0x42')));}},'afterDestroy':function(_0x3fe8b6,_0x22d2bf,_0x493339){var _0x9505d0=_0x1e6a84[_0x21b1('0x15')];var _0x488c6b=_0x3fe8b6['get']({'plain':!![]});return _0x9505d0[_0x21b1('0x25')][_0x21b1('0x3c')]({'raw':!![],'where':{'ListId':_0x488c6b[_0x21b1('0x28')],'ContactId':_0x488c6b['id']}})['then'](function(_0x4666b7){if(!_['isEmpty'](_0x4666b7)){var _0x47d296=[];for(var _0x1b06e0=0x0;_0x1b06e0<_0x4666b7[_0x21b1('0x37')];_0x1b06e0+=0x1){var _0x318c35=_0x9505d0[_0x21b1('0x25')]['destroy']({'where':{'ListId':_0x4666b7[_0x1b06e0][_0x21b1('0x28')],'ContactId':_0x4666b7[_0x1b06e0]['ContactId'],'VoiceQueueId':_0x4666b7[_0x1b06e0]['VoiceQueueId'],'CampaignId':_0x4666b7[_0x1b06e0][_0x21b1('0x43')]}});_0x47d296['push'](_0x318c35);}return BPromise['all'](_0x47d296);}})[_0x21b1('0x1f')](function(_0xcbc64f){logger[_0x21b1('0x44')](_0x21b1('0x45'),util[_0x21b1('0x18')](_0xcbc64f,{'showHidden':![],'depth':null}));_0x493339();})[_0x21b1('0x2b')](function(_0x84c7ce){logger['error'](_0x21b1('0x46'),util[_0x21b1('0x18')](_0x84c7ce,{'showHidden':![],'depth':null}));_0x493339(_0x84c7ce);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 7717192..2463161 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(_0x27ce82,_0x2ab11b){var _0x4df309=function(_0x514605){while(--_0x514605){_0x27ce82['push'](_0x27ce82['shift']());}};_0x4df309(++_0x2ab11b);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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(_0x159b9a,_0x1d82b3){var _0x137ac7=function(_0x24f988){while(--_0x24f988){_0x159b9a['push'](_0x159b9a['shift']());}};_0x137ac7(++_0x1d82b3);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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 1a1b394..84623d4 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 _0x31c2=['sequelize','STRING','INTEGER','PHONE'];(function(_0x43f80a,_0x158675){var _0x2fb4ca=function(_0x19f1e4){while(--_0x19f1e4){_0x43f80a['push'](_0x43f80a['shift']());}};_0x2fb4ca(++_0x158675);}(_0x31c2,0x98));var _0x231c=function(_0x46470b,_0x2e71f1){_0x46470b=_0x46470b-0x0;var _0x57e437=_0x31c2[_0x46470b];return _0x57e437;};'use strict';var Sequelize=require(_0x231c('0x0'));module['exports']={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x231c('0x1')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x231c('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0x231c('0x3')},'OrderBy':{'type':Sequelize[_0x231c('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0x231c('0x1')],'defaultValue':null}}; \ No newline at end of file +var _0xfa7c=['INTEGER','STRING','PHONE','sequelize'];(function(_0x1bb441,_0x3e1d64){var _0x1fad48=function(_0x520d71){while(--_0x520d71){_0x1bb441['push'](_0x1bb441['shift']());}};_0x1fad48(++_0x3e1d64);}(_0xfa7c,0x15b));var _0xcfa7=function(_0x6d4ca0,_0x2d7a84){_0x6d4ca0=_0x6d4ca0-0x0;var _0x439913=_0xfa7c[_0x6d4ca0];return _0x439913;};'use strict';var Sequelize=require(_0xcfa7('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0xcfa7('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0xcfa7('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xcfa7('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xcfa7('0x2')],'defaultValue':_0xcfa7('0x3')},'OrderBy':{'type':Sequelize[_0xcfa7('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0xcfa7('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 19541d5..e17a345 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 _0x7539=['type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','VIRTUAL','merge','CmContactHasItem','includeAll','include','findAll','rows','catch','show','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmContactHasItems','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','fieldName'];(function(_0x3fcfb6,_0x515024){var _0x3b99a7=function(_0x10ddfd){while(--_0x10ddfd){_0x3fcfb6['push'](_0x3fcfb6['shift']());}};_0x3b99a7(++_0x515024);}(_0x7539,0x179));var _0x9753=function(_0x14110b,_0x3ce4f6){_0x14110b=_0x14110b-0x0;var _0x33d8db=_0x7539[_0x14110b];return _0x33d8db;};'use strict';var emlformat=require(_0x9753('0x0'));var rimraf=require(_0x9753('0x1'));var zipdir=require(_0x9753('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9753('0x3'));var moment=require(_0x9753('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9753('0x5'));var util=require(_0x9753('0x6'));var path=require(_0x9753('0x7'));var sox=require(_0x9753('0x8'));var csv=require(_0x9753('0x9'));var ejs=require(_0x9753('0xa'));var fs=require('fs');var fs_extra=require(_0x9753('0xb'));var _=require(_0x9753('0xc'));var squel=require(_0x9753('0xd'));var crypto=require(_0x9753('0xe'));var jsforce=require(_0x9753('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x9753('0x9'));var querystring=require(_0x9753('0x10'));var Papa=require(_0x9753('0x11'));var Redis=require(_0x9753('0x12'));var authService=require(_0x9753('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9753('0x14'));var logger=require(_0x9753('0x15'))(_0x9753('0x16'));var utils=require(_0x9753('0x17'));var config=require(_0x9753('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x9753('0x19'))['db'];function respondWithStatusCode(_0x40f449,_0x2dee60){_0x2dee60=_0x2dee60||0xcc;return function(_0x47662a){if(_0x47662a){return _0x40f449['sendStatus'](_0x2dee60);}return _0x40f449[_0x9753('0x1a')](_0x2dee60)[_0x9753('0x1b')]();};}function respondWithResult(_0x11e5c9,_0x497c81){_0x497c81=_0x497c81||0xc8;return function(_0x115f6e){if(_0x115f6e){return _0x11e5c9[_0x9753('0x1a')](_0x497c81)[_0x9753('0x1c')](_0x115f6e);}};}function respondWithFilteredResult(_0x161797,_0x460b17){return function(_0x43729d){if(_0x43729d){var _0x1fef8d=typeof _0x460b17[_0x9753('0x1d')]===_0x9753('0x1e')&&typeof _0x460b17[_0x9753('0x1f')]===_0x9753('0x1e');var _0x183772=_0x43729d['count'];var _0x542eea=_0x1fef8d?0x0:_0x460b17[_0x9753('0x1d')];var _0x5ef376=_0x1fef8d?_0x43729d[_0x9753('0x20')]:_0x460b17[_0x9753('0x1d')]+_0x460b17[_0x9753('0x1f')];var _0x4dfa12;if(_0x5ef376>=_0x183772){_0x5ef376=_0x183772;_0x4dfa12=0xc8;}else{_0x4dfa12=0xce;}_0x161797['status'](_0x4dfa12);return _0x161797['set'](_0x9753('0x21'),_0x542eea+'-'+_0x5ef376+'/'+_0x183772)[_0x9753('0x1c')](_0x43729d);}return null;};}function patchUpdates(_0x35cec1){return function(_0xc847a5){try{jsonpatch[_0x9753('0x22')](_0xc847a5,_0x35cec1,!![]);}catch(_0x40eee8){return BPromise[_0x9753('0x23')](_0x40eee8);}return _0xc847a5['save']();};}function saveUpdates(_0x3d18d2,_0x3eba83){return function(_0x4c0c60){if(_0x4c0c60){return _0x4c0c60[_0x9753('0x24')](_0x3d18d2)[_0x9753('0x25')](function(_0x4707ad){return _0x4707ad;});}return null;};}function removeEntity(_0x2befa5,_0x34c366){return function(_0x4672e4){if(_0x4672e4){return _0x4672e4[_0x9753('0x26')]()[_0x9753('0x25')](function(){var _0x38639c=_0x4672e4[_0x9753('0x27')]({'plain':!![]});var _0x47a369='CmContactHasItems';return db[_0x9753('0x28')][_0x9753('0x26')]({'where':{'type':_0x47a369,'resourceId':_0x38639c['id']}})[_0x9753('0x25')](function(){return _0x4672e4;});})[_0x9753('0x25')](function(){_0x2befa5[_0x9753('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x217966,_0x3b8964){return function(_0xf95c56){if(!_0xf95c56){_0x217966['sendStatus'](0x194);}return _0xf95c56;};}function handleError(_0x3113f0,_0x1a1f53){_0x1a1f53=_0x1a1f53||0x1f4;return function(_0x12b842){logger[_0x9753('0x29')](_0x12b842[_0x9753('0x2a')]);if(_0x12b842['name']){delete _0x12b842[_0x9753('0x2b')];}_0x3113f0[_0x9753('0x1a')](_0x1a1f53)[_0x9753('0x2c')](_0x12b842);};}exports[_0x9753('0x2d')]=function(_0x212426,_0xe8aefa){var _0x3e7d67={},_0x43076f={},_0x48fa96={'count':0x0,'rows':[]};var _0x4cb98c=_[_0x9753('0x2e')](db['CmContactHasItem']['rawAttributes'],function(_0x170369){return{'name':_0x170369[_0x9753('0x2f')],'type':_0x170369[_0x9753('0x30')][_0x9753('0x31')]};});_0x43076f[_0x9753('0x32')]=_[_0x9753('0x2e')](_0x4cb98c,_0x9753('0x2b'));_0x43076f[_0x9753('0x33')]=_[_0x9753('0x34')](_0x212426[_0x9753('0x33')]);_0x43076f['filters']=_[_0x9753('0x35')](_0x43076f['model'],_0x43076f[_0x9753('0x33')]);_0x3e7d67['attributes']=_['intersection'](_0x43076f['model'],qs[_0x9753('0x36')](_0x212426[_0x9753('0x33')]['fields']));_0x3e7d67[_0x9753('0x37')]=_0x3e7d67[_0x9753('0x37')][_0x9753('0x38')]?_0x3e7d67[_0x9753('0x37')]:_0x43076f['model'];if(!_0x212426[_0x9753('0x33')][_0x9753('0x39')](_0x9753('0x3a'))){_0x3e7d67['limit']=qs[_0x9753('0x1f')](_0x212426['query'][_0x9753('0x1f')]);_0x3e7d67[_0x9753('0x1d')]=qs[_0x9753('0x1d')](_0x212426[_0x9753('0x33')][_0x9753('0x1d')]);}_0x3e7d67[_0x9753('0x3b')]=qs[_0x9753('0x3c')](_0x212426[_0x9753('0x33')][_0x9753('0x3c')]);_0x3e7d67['where']=qs['filters'](_[_0x9753('0x3d')](_0x212426[_0x9753('0x33')],_0x43076f[_0x9753('0x3e')]),_0x4cb98c);if(_0x212426[_0x9753('0x33')][_0x9753('0x3f')]){_0x3e7d67[_0x9753('0x40')]=_['merge'](_0x3e7d67[_0x9753('0x40')],{'$or':_[_0x9753('0x2e')](_0x4cb98c,function(_0x1564a3){if(_0x1564a3[_0x9753('0x30')]!==_0x9753('0x41')){var _0x24169c={};_0x24169c[_0x1564a3['name']]={'$like':'%'+_0x212426[_0x9753('0x33')][_0x9753('0x3f')]+'%'};return _0x24169c;}})});}_0x3e7d67=_[_0x9753('0x42')]({},_0x3e7d67,_0x212426['options']);var _0xc78310={'where':_0x3e7d67[_0x9753('0x40')]};return db[_0x9753('0x43')][_0x9753('0x20')](_0xc78310)['then'](function(_0x192db5){_0x48fa96[_0x9753('0x20')]=_0x192db5;if(_0x212426['query'][_0x9753('0x44')]){_0x3e7d67[_0x9753('0x45')]=[{'all':!![]}];}return db['CmContactHasItem'][_0x9753('0x46')](_0x3e7d67);})[_0x9753('0x25')](function(_0x2a9088){_0x48fa96[_0x9753('0x47')]=_0x2a9088;return _0x48fa96;})['then'](respondWithFilteredResult(_0xe8aefa,_0x3e7d67))[_0x9753('0x48')](handleError(_0xe8aefa,null));};exports[_0x9753('0x49')]=function(_0x22ce75,_0x1fbcaa){var _0x51c025={'raw':!![],'where':{'id':_0x22ce75['params']['id']}},_0x576fd9={};_0x576fd9[_0x9753('0x32')]=_['keys'](db[_0x9753('0x43')]['rawAttributes']);_0x576fd9[_0x9753('0x33')]=_[_0x9753('0x34')](_0x22ce75['query']);_0x576fd9[_0x9753('0x3e')]=_['intersection'](_0x576fd9[_0x9753('0x32')],_0x576fd9[_0x9753('0x33')]);_0x51c025[_0x9753('0x37')]=_[_0x9753('0x35')](_0x576fd9[_0x9753('0x32')],qs[_0x9753('0x36')](_0x22ce75[_0x9753('0x33')][_0x9753('0x36')]));_0x51c025[_0x9753('0x37')]=_0x51c025[_0x9753('0x37')][_0x9753('0x38')]?_0x51c025['attributes']:_0x576fd9[_0x9753('0x32')];if(_0x22ce75[_0x9753('0x33')]['includeAll']){_0x51c025[_0x9753('0x45')]=[{'all':!![]}];}_0x51c025=_[_0x9753('0x42')]({},_0x51c025,_0x22ce75[_0x9753('0x4a')]);return db[_0x9753('0x43')]['find'](_0x51c025)[_0x9753('0x25')](handleEntityNotFound(_0x1fbcaa,null))[_0x9753('0x25')](respondWithResult(_0x1fbcaa,null))['catch'](handleError(_0x1fbcaa,null));};exports[_0x9753('0x4b')]=function(_0x31ffe2,_0x31e57c){return db['CmContactHasItem'][_0x9753('0x4b')](_0x31ffe2[_0x9753('0x4c')],{})['then'](function(_0x35ef0c){var _0x5ccde8=_0x31ffe2[_0x9753('0x4d')]['get']({'plain':!![]});if(!_0x5ccde8)throw new Error(_0x9753('0x4e'));if(_0x5ccde8[_0x9753('0x4f')]===_0x9753('0x4d')){var _0x1a222f=_0x35ef0c['get']({'plain':!![]});var _0xd7e8db=_0x9753('0x50');return db[_0x9753('0x51')]['find']({'where':{'name':_0xd7e8db,'userProfileId':_0x5ccde8[_0x9753('0x52')]},'raw':!![]})['then'](function(_0x2dc611){if(_0x2dc611&&_0x2dc611['autoAssociation']===0x0){return db[_0x9753('0x28')][_0x9753('0x4b')]({'name':_0x1a222f[_0x9753('0x2b')],'resourceId':_0x1a222f['id'],'type':_0x2dc611['name'],'sectionId':_0x2dc611['id']},{})[_0x9753('0x25')](function(){return _0x35ef0c;});}else{return _0x35ef0c;}})[_0x9753('0x48')](function(_0x5bb5b9){logger['error'](_0x9753('0x53'),_0x5bb5b9);throw _0x5bb5b9;});}return _0x35ef0c;})[_0x9753('0x25')](respondWithResult(_0x31e57c,0xc9))[_0x9753('0x48')](handleError(_0x31e57c,null));};exports[_0x9753('0x24')]=function(_0x360010,_0x40d08c){if(_0x360010[_0x9753('0x4c')]['id']){delete _0x360010[_0x9753('0x4c')]['id'];}return db[_0x9753('0x43')]['find']({'where':{'id':_0x360010['params']['id']}})[_0x9753('0x25')](handleEntityNotFound(_0x40d08c,null))['then'](saveUpdates(_0x360010['body'],null))[_0x9753('0x25')](respondWithResult(_0x40d08c,null))[_0x9753('0x48')](handleError(_0x40d08c,null));};exports[_0x9753('0x26')]=function(_0xa96d33,_0x3791a5){return db[_0x9753('0x43')][_0x9753('0x54')]({'where':{'id':_0xa96d33['params']['id']}})[_0x9753('0x25')](handleEntityNotFound(_0x3791a5,null))[_0x9753('0x25')](removeEntity(_0x3791a5,null))[_0x9753('0x48')](handleError(_0x3791a5,null));}; \ No newline at end of file +var _0x477a=['userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','limit','undefined','offset','count','Content-Range','reject','update','then','destroy','CmContactHasItems','sendStatus','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','get','role','UserProfileSection','find'];(function(_0x3b5085,_0x4e7a4d){var _0x2e0639=function(_0x44bdd9){while(--_0x44bdd9){_0x3b5085['push'](_0x3b5085['shift']());}};_0x2e0639(++_0x4e7a4d);}(_0x477a,0x100));var _0xa477=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x477a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xa477('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa477('0x1'));var jsonpatch=require(_0xa477('0x2'));var rp=require(_0xa477('0x3'));var moment=require(_0xa477('0x4'));var BPromise=require(_0xa477('0x5'));var Mustache=require(_0xa477('0x6'));var util=require(_0xa477('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xa477('0x8'));var ejs=require(_0xa477('0x9'));var fs=require('fs');var fs_extra=require(_0xa477('0xa'));var _=require('lodash');var squel=require(_0xa477('0xb'));var crypto=require(_0xa477('0xc'));var jsforce=require(_0xa477('0xd'));var deskjs=require(_0xa477('0xe'));var toCsv=require(_0xa477('0x8'));var querystring=require('querystring');var Papa=require(_0xa477('0xf'));var Redis=require(_0xa477('0x10'));var authService=require(_0xa477('0x11'));var qs=require(_0xa477('0x12'));var as=require(_0xa477('0x13'));var hardwareService=require(_0xa477('0x14'));var logger=require(_0xa477('0x15'))(_0xa477('0x16'));var utils=require(_0xa477('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xa477('0x18'));var db=require(_0xa477('0x19'))['db'];function respondWithStatusCode(_0x109809,_0x3fff65){_0x3fff65=_0x3fff65||0xcc;return function(_0x5a5372){if(_0x5a5372){return _0x109809['sendStatus'](_0x3fff65);}return _0x109809['status'](_0x3fff65)[_0xa477('0x1a')]();};}function respondWithResult(_0x12564f,_0x3c3d1d){_0x3c3d1d=_0x3c3d1d||0xc8;return function(_0x3445a1){if(_0x3445a1){return _0x12564f[_0xa477('0x1b')](_0x3c3d1d)['json'](_0x3445a1);}};}function respondWithFilteredResult(_0x40fe97,_0x2ab0d1){return function(_0x50bd8d){if(_0x50bd8d){var _0x1ce740=typeof _0x2ab0d1['offset']==='undefined'&&typeof _0x2ab0d1[_0xa477('0x1c')]===_0xa477('0x1d');var _0x5de28c=_0x50bd8d['count'];var _0x59e8e9=_0x1ce740?0x0:_0x2ab0d1[_0xa477('0x1e')];var _0x51be87=_0x1ce740?_0x50bd8d[_0xa477('0x1f')]:_0x2ab0d1[_0xa477('0x1e')]+_0x2ab0d1[_0xa477('0x1c')];var _0x38d624;if(_0x51be87>=_0x5de28c){_0x51be87=_0x5de28c;_0x38d624=0xc8;}else{_0x38d624=0xce;}_0x40fe97[_0xa477('0x1b')](_0x38d624);return _0x40fe97['set'](_0xa477('0x20'),_0x59e8e9+'-'+_0x51be87+'/'+_0x5de28c)['json'](_0x50bd8d);}return null;};}function patchUpdates(_0x5c4ef1){return function(_0x480051){try{jsonpatch['apply'](_0x480051,_0x5c4ef1,!![]);}catch(_0x2e2b13){return BPromise[_0xa477('0x21')](_0x2e2b13);}return _0x480051['save']();};}function saveUpdates(_0x19c1ed,_0x330399){return function(_0x4e5017){if(_0x4e5017){return _0x4e5017[_0xa477('0x22')](_0x19c1ed)[_0xa477('0x23')](function(_0x23efba){return _0x23efba;});}return null;};}function removeEntity(_0x2c41f5,_0x310e8d){return function(_0x1c09e5){if(_0x1c09e5){return _0x1c09e5[_0xa477('0x24')]()[_0xa477('0x23')](function(){var _0x5418b4=_0x1c09e5['get']({'plain':!![]});var _0x13345b=_0xa477('0x25');return db['UserProfileResource'][_0xa477('0x24')]({'where':{'type':_0x13345b,'resourceId':_0x5418b4['id']}})[_0xa477('0x23')](function(){return _0x1c09e5;});})[_0xa477('0x23')](function(){_0x2c41f5[_0xa477('0x1b')](0xcc)[_0xa477('0x1a')]();});}};}function handleEntityNotFound(_0x25b9f0,_0x4d1eba){return function(_0x93b7d0){if(!_0x93b7d0){_0x25b9f0[_0xa477('0x26')](0x194);}return _0x93b7d0;};}function handleError(_0x42de62,_0x150950){_0x150950=_0x150950||0x1f4;return function(_0x4cef36){logger[_0xa477('0x27')](_0x4cef36[_0xa477('0x28')]);if(_0x4cef36[_0xa477('0x29')]){delete _0x4cef36['name'];}_0x42de62['status'](_0x150950)[_0xa477('0x2a')](_0x4cef36);};}exports[_0xa477('0x2b')]=function(_0x7bd78f,_0x1686d4){var _0x486dbf={},_0xbc17db={},_0x11a3f1={'count':0x0,'rows':[]};var _0x19d235=_[_0xa477('0x2c')](db[_0xa477('0x2d')][_0xa477('0x2e')],function(_0x3e8bea){return{'name':_0x3e8bea['fieldName'],'type':_0x3e8bea[_0xa477('0x2f')][_0xa477('0x30')]};});_0xbc17db[_0xa477('0x31')]=_[_0xa477('0x2c')](_0x19d235,_0xa477('0x29'));_0xbc17db[_0xa477('0x32')]=_[_0xa477('0x33')](_0x7bd78f['query']);_0xbc17db[_0xa477('0x34')]=_[_0xa477('0x35')](_0xbc17db['model'],_0xbc17db['query']);_0x486dbf['attributes']=_[_0xa477('0x35')](_0xbc17db['model'],qs[_0xa477('0x36')](_0x7bd78f[_0xa477('0x32')][_0xa477('0x36')]));_0x486dbf[_0xa477('0x37')]=_0x486dbf[_0xa477('0x37')][_0xa477('0x38')]?_0x486dbf[_0xa477('0x37')]:_0xbc17db[_0xa477('0x31')];if(!_0x7bd78f[_0xa477('0x32')][_0xa477('0x39')](_0xa477('0x3a'))){_0x486dbf[_0xa477('0x1c')]=qs[_0xa477('0x1c')](_0x7bd78f[_0xa477('0x32')][_0xa477('0x1c')]);_0x486dbf[_0xa477('0x1e')]=qs[_0xa477('0x1e')](_0x7bd78f[_0xa477('0x32')]['offset']);}_0x486dbf[_0xa477('0x3b')]=qs[_0xa477('0x3c')](_0x7bd78f[_0xa477('0x32')][_0xa477('0x3c')]);_0x486dbf[_0xa477('0x3d')]=qs[_0xa477('0x34')](_['pick'](_0x7bd78f['query'],_0xbc17db['filters']),_0x19d235);if(_0x7bd78f['query'][_0xa477('0x3e')]){_0x486dbf[_0xa477('0x3d')]=_[_0xa477('0x3f')](_0x486dbf[_0xa477('0x3d')],{'$or':_[_0xa477('0x2c')](_0x19d235,function(_0x4d544b){if(_0x4d544b[_0xa477('0x2f')]!==_0xa477('0x40')){var _0x5992ec={};_0x5992ec[_0x4d544b[_0xa477('0x29')]]={'$like':'%'+_0x7bd78f['query']['filter']+'%'};return _0x5992ec;}})});}_0x486dbf=_['merge']({},_0x486dbf,_0x7bd78f[_0xa477('0x41')]);var _0x39316d={'where':_0x486dbf[_0xa477('0x3d')]};return db[_0xa477('0x2d')][_0xa477('0x1f')](_0x39316d)['then'](function(_0x313d98){_0x11a3f1['count']=_0x313d98;if(_0x7bd78f[_0xa477('0x32')][_0xa477('0x42')]){_0x486dbf[_0xa477('0x43')]=[{'all':!![]}];}return db[_0xa477('0x2d')][_0xa477('0x44')](_0x486dbf);})['then'](function(_0x136714){_0x11a3f1[_0xa477('0x45')]=_0x136714;return _0x11a3f1;})[_0xa477('0x23')](respondWithFilteredResult(_0x1686d4,_0x486dbf))[_0xa477('0x46')](handleError(_0x1686d4,null));};exports[_0xa477('0x47')]=function(_0x4dad3e,_0x1c40eb){var _0x50f277={'raw':!![],'where':{'id':_0x4dad3e[_0xa477('0x48')]['id']}},_0x2915cb={};_0x2915cb[_0xa477('0x31')]=_[_0xa477('0x33')](db[_0xa477('0x2d')][_0xa477('0x2e')]);_0x2915cb[_0xa477('0x32')]=_['keys'](_0x4dad3e[_0xa477('0x32')]);_0x2915cb['filters']=_[_0xa477('0x35')](_0x2915cb[_0xa477('0x31')],_0x2915cb['query']);_0x50f277[_0xa477('0x37')]=_[_0xa477('0x35')](_0x2915cb[_0xa477('0x31')],qs['fields'](_0x4dad3e[_0xa477('0x32')]['fields']));_0x50f277[_0xa477('0x37')]=_0x50f277[_0xa477('0x37')]['length']?_0x50f277[_0xa477('0x37')]:_0x2915cb[_0xa477('0x31')];if(_0x4dad3e['query'][_0xa477('0x42')]){_0x50f277[_0xa477('0x43')]=[{'all':!![]}];}_0x50f277=_[_0xa477('0x3f')]({},_0x50f277,_0x4dad3e[_0xa477('0x41')]);return db[_0xa477('0x2d')]['find'](_0x50f277)[_0xa477('0x23')](handleEntityNotFound(_0x1c40eb,null))[_0xa477('0x23')](respondWithResult(_0x1c40eb,null))['catch'](handleError(_0x1c40eb,null));};exports[_0xa477('0x49')]=function(_0x3344cd,_0x2e0cd7){return db[_0xa477('0x2d')][_0xa477('0x49')](_0x3344cd[_0xa477('0x4a')],{})[_0xa477('0x23')](function(_0x23b780){var _0x3b4bed=_0x3344cd[_0xa477('0x4b')][_0xa477('0x4c')]({'plain':!![]});if(!_0x3b4bed)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3b4bed[_0xa477('0x4d')]===_0xa477('0x4b')){var _0x403d82=_0x23b780['get']({'plain':!![]});var _0x55c4b0=_0xa477('0x25');return db[_0xa477('0x4e')][_0xa477('0x4f')]({'where':{'name':_0x55c4b0,'userProfileId':_0x3b4bed[_0xa477('0x50')]},'raw':!![]})[_0xa477('0x23')](function(_0xd7c104){if(_0xd7c104&&_0xd7c104[_0xa477('0x51')]===0x0){return db[_0xa477('0x52')][_0xa477('0x49')]({'name':_0x403d82[_0xa477('0x29')],'resourceId':_0x403d82['id'],'type':_0xd7c104[_0xa477('0x29')],'sectionId':_0xd7c104['id']},{})[_0xa477('0x23')](function(){return _0x23b780;});}else{return _0x23b780;}})['catch'](function(_0x41de11){logger['error'](_0xa477('0x53'),_0x41de11);throw _0x41de11;});}return _0x23b780;})['then'](respondWithResult(_0x2e0cd7,0xc9))[_0xa477('0x46')](handleError(_0x2e0cd7,null));};exports[_0xa477('0x22')]=function(_0x1d3faf,_0x232aa0){if(_0x1d3faf[_0xa477('0x4a')]['id']){delete _0x1d3faf[_0xa477('0x4a')]['id'];}return db['CmContactHasItem']['find']({'where':{'id':_0x1d3faf[_0xa477('0x48')]['id']}})[_0xa477('0x23')](handleEntityNotFound(_0x232aa0,null))['then'](saveUpdates(_0x1d3faf[_0xa477('0x4a')],null))['then'](respondWithResult(_0x232aa0,null))[_0xa477('0x46')](handleError(_0x232aa0,null));};exports[_0xa477('0x24')]=function(_0x4abbfc,_0x24a60b){return db['CmContactHasItem']['find']({'where':{'id':_0x4abbfc[_0xa477('0x48')]['id']}})[_0xa477('0x23')](handleEntityNotFound(_0x24a60b,null))[_0xa477('0x23')](removeEntity(_0x24a60b,null))[_0xa477('0x46')](handleError(_0x24a60b,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index a02d7b7..039a006 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 _0x34f2=['util','../../config/logger','moment','bluebird','request-promise','rimraf','./cmContactHasItem.attributes','exports','define','CmContactHasItem','lodash'];(function(_0x13ee4c,_0x26b5ff){var _0x2ea0d5=function(_0x9892e1){while(--_0x9892e1){_0x13ee4c['push'](_0x13ee4c['shift']());}};_0x2ea0d5(++_0x26b5ff);}(_0x34f2,0xd0));var _0x234f=function(_0x3fd595,_0x34a9ab){_0x3fd595=_0x3fd595-0x0;var _0x23e76e=_0x34f2[_0x3fd595];return _0x23e76e;};'use strict';var _=require(_0x234f('0x0'));var util=require(_0x234f('0x1'));var logger=require(_0x234f('0x2'))('api');var moment=require(_0x234f('0x3'));var BPromise=require(_0x234f('0x4'));var rp=require(_0x234f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x234f('0x6'));var config=require('../../config/environment');var attributes=require(_0x234f('0x7'));module[_0x234f('0x8')]=function(_0x1482c8,_0xfa89e9){return _0x1482c8[_0x234f('0x9')](_0x234f('0xa'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6646=['CmContactHasItem','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./cmContactHasItem.attributes'];(function(_0x3d1d2e,_0x295d13){var _0x35ac48=function(_0x12e1f4){while(--_0x12e1f4){_0x3d1d2e['push'](_0x3d1d2e['shift']());}};_0x35ac48(++_0x295d13);}(_0x6646,0x133));var _0x6664=function(_0x4c567a,_0x35b0f6){_0x4c567a=_0x4c567a-0x0;var _0x5d0f69=_0x6646[_0x4c567a];return _0x5d0f69;};'use strict';var _=require(_0x6664('0x0'));var util=require(_0x6664('0x1'));var logger=require('../../config/logger')(_0x6664('0x2'));var moment=require(_0x6664('0x3'));var BPromise=require(_0x6664('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6664('0x5'));var config=require(_0x6664('0x6'));var attributes=require(_0x6664('0x7'));module['exports']=function(_0x369d0c,_0x111816){return _0x369d0c['define'](_0x6664('0x8'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 7907092..764087a 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 _0x6527=['error','code','message','result','catch','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3bef2c,_0x5a86fd){var _0x331503=function(_0x463430){while(--_0x463430){_0x3bef2c['push'](_0x3bef2c['shift']());}};_0x331503(++_0x5a86fd);}(_0x6527,0xf7));var _0x7652=function(_0x18e1b4,_0x5d35a7){_0x18e1b4=_0x18e1b4-0x0;var _0x218642=_0x6527[_0x18e1b4];return _0x218642;};'use strict';var _=require('lodash');var util=require(_0x7652('0x0'));var moment=require(_0x7652('0x1'));var BPromise=require('bluebird');var rs=require(_0x7652('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7652('0x3'));var logger=require(_0x7652('0x4'))(_0x7652('0x5'));var config=require(_0x7652('0x6'));var jayson=require(_0x7652('0x7'));var client=jayson['client'][_0x7652('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5b06ed,_0x4694d6,_0x39065f){return new BPromise(function(_0x1f0ec4,_0x1b9b00){return client[_0x7652('0x9')](_0x5b06ed,_0x39065f)[_0x7652('0xa')](function(_0x2e9e9a){logger[_0x7652('0xb')](_0x7652('0xc'),_0x4694d6,_0x7652('0xd'));logger[_0x7652('0xe')](_0x7652('0xf'),_0x4694d6,_0x7652('0xd'),JSON[_0x7652('0x10')](_0x2e9e9a));if(_0x2e9e9a['error']){if(_0x2e9e9a[_0x7652('0x11')][_0x7652('0x12')]===0x1f4){logger[_0x7652('0x11')]('CmContactHasItem,\x20%s,\x20%s',_0x4694d6,_0x2e9e9a[_0x7652('0x11')][_0x7652('0x13')]);return _0x1b9b00(_0x2e9e9a[_0x7652('0x11')][_0x7652('0x13')]);}logger[_0x7652('0x11')]('CmContactHasItem,\x20%s,\x20%s',_0x4694d6,_0x2e9e9a[_0x7652('0x11')][_0x7652('0x13')]);return _0x1f0ec4(_0x2e9e9a[_0x7652('0x11')][_0x7652('0x13')]);}else{logger[_0x7652('0xb')](_0x7652('0xc'),_0x4694d6,'request\x20sent');_0x1f0ec4(_0x2e9e9a[_0x7652('0x14')][_0x7652('0x13')]);}})[_0x7652('0x15')](function(_0x4f546d){logger['error'](_0x7652('0xc'),_0x4694d6,_0x4f546d);_0x1b9b00(_0x4f546d);});});} \ No newline at end of file +var _0x4d55=['moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','error','CmContactHasItem,\x20%s,\x20%s','message','result','lodash','util'];(function(_0x58965a,_0x2e71db){var _0x254efc=function(_0xf14fb4){while(--_0xf14fb4){_0x58965a['push'](_0x58965a['shift']());}};_0x254efc(++_0x2e71db);}(_0x4d55,0xfa));var _0x54d5=function(_0x72193d,_0x330a80){_0x72193d=_0x72193d-0x0;var _0x455d4f=_0x4d55[_0x72193d];return _0x455d4f;};'use strict';var _=require(_0x54d5('0x0'));var util=require(_0x54d5('0x1'));var moment=require(_0x54d5('0x2'));var BPromise=require('bluebird');var rs=require(_0x54d5('0x3'));var fs=require('fs');var Redis=require(_0x54d5('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x54d5('0x5'))(_0x54d5('0x6'));var config=require(_0x54d5('0x7'));var jayson=require(_0x54d5('0x8'));var client=jayson[_0x54d5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35f31f,_0x39e986,_0x3a0e36){return new BPromise(function(_0x54eb23,_0x39595d){return client[_0x54d5('0xa')](_0x35f31f,_0x3a0e36)[_0x54d5('0xb')](function(_0x2a1b38){logger[_0x54d5('0xc')]('CmContactHasItem,\x20%s,\x20%s',_0x39e986,_0x54d5('0xd'));logger['debug']('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x39e986,'request\x20sent',JSON['stringify'](_0x2a1b38));if(_0x2a1b38['error']){if(_0x2a1b38[_0x54d5('0xe')]['code']===0x1f4){logger['error'](_0x54d5('0xf'),_0x39e986,_0x2a1b38[_0x54d5('0xe')][_0x54d5('0x10')]);return _0x39595d(_0x2a1b38[_0x54d5('0xe')][_0x54d5('0x10')]);}logger[_0x54d5('0xe')](_0x54d5('0xf'),_0x39e986,_0x2a1b38[_0x54d5('0xe')][_0x54d5('0x10')]);return _0x54eb23(_0x2a1b38[_0x54d5('0xe')][_0x54d5('0x10')]);}else{logger['info'](_0x54d5('0xf'),_0x39e986,_0x54d5('0xd'));_0x54eb23(_0x2a1b38[_0x54d5('0x11')]['message']);}})['catch'](function(_0x195239){logger[_0x54d5('0xe')](_0x54d5('0xf'),_0x39e986,_0x195239);_0x39595d(_0x195239);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 4646210..e249780 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 _0xdd76=['put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmContactHasItem.controller','get','isAuthenticated','index','show','post','create'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xdd76,0x102));var _0x6dd7=function(_0x5c22b5,_0x26fad1){_0x5c22b5=_0x5c22b5-0x0;var _0x11913a=_0xdd76[_0x5c22b5];return _0x11913a;};'use strict';var multer=require(_0x6dd7('0x0'));var util=require(_0x6dd7('0x1'));var path=require('path');var timeout=require(_0x6dd7('0x2'));var express=require(_0x6dd7('0x3'));var router=express[_0x6dd7('0x4')]();var fs_extra=require(_0x6dd7('0x5'));var auth=require(_0x6dd7('0x6'));var interaction=require(_0x6dd7('0x7'));var config=require('../../config/environment');var controller=require(_0x6dd7('0x8'));router[_0x6dd7('0x9')]('/',auth[_0x6dd7('0xa')](),controller[_0x6dd7('0xb')]);router[_0x6dd7('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x6dd7('0xc')]);router[_0x6dd7('0xd')]('/',auth[_0x6dd7('0xa')](),controller[_0x6dd7('0xe')]);router[_0x6dd7('0xf')](_0x6dd7('0x10'),auth[_0x6dd7('0xa')](),controller[_0x6dd7('0x11')]);router[_0x6dd7('0x12')](_0x6dd7('0x10'),auth[_0x6dd7('0xa')](),controller[_0x6dd7('0x13')]);module[_0x6dd7('0x14')]=router; \ No newline at end of file +var _0x0fee=['destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmContactHasItem.controller','get','show','post','isAuthenticated','create','put','/:id','update'];(function(_0x465a0c,_0x5d84e0){var _0x1f92c5=function(_0x168248){while(--_0x168248){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1f92c5(++_0x5d84e0);}(_0x0fee,0x1c4));var _0xe0fe=function(_0xb9da3c,_0x4264a4){_0xb9da3c=_0xb9da3c-0x0;var _0x1e2d30=_0x0fee[_0xb9da3c];return _0x1e2d30;};'use strict';var multer=require(_0xe0fe('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe0fe('0x1'));var express=require(_0xe0fe('0x2'));var router=express[_0xe0fe('0x3')]();var fs_extra=require(_0xe0fe('0x4'));var auth=require(_0xe0fe('0x5'));var interaction=require(_0xe0fe('0x6'));var config=require('../../config/environment');var controller=require(_0xe0fe('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xe0fe('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xe0fe('0x9')]);router[_0xe0fe('0xa')]('/',auth[_0xe0fe('0xb')](),controller[_0xe0fe('0xc')]);router[_0xe0fe('0xd')](_0xe0fe('0xe'),auth[_0xe0fe('0xb')](),controller[_0xe0fe('0xf')]);router['delete']('/:id',auth[_0xe0fe('0xb')](),controller[_0xe0fe('0x10')]);module[_0xe0fe('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 572aa94..3bcdd2a 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 _0xfcd6=['values','setDataValue','stringify','BOOLEAN','ENUM','voice','lodash','exports','VIRTUAL','alias','STRING','name','TEXT','getDataValue','type','select','parse'];(function(_0x5d6cdc,_0x2f6a9a){var _0xcef9d9=function(_0x1e4b0a){while(--_0x1e4b0a){_0x5d6cdc['push'](_0x5d6cdc['shift']());}};_0xcef9d9(++_0x2f6a9a);}(_0xfcd6,0xb0));var _0x6fcd=function(_0x1d1d34,_0x49c0ec){_0x1d1d34=_0x1d1d34-0x0;var _0x4d8023=_0xfcd6[_0x1d1d34];return _0x4d8023;};'use strict';var Sequelize=require('sequelize');var _=require(_0x6fcd('0x0'));module[_0x6fcd('0x1')]={'name':{'type':Sequelize[_0x6fcd('0x2')],'get':function(_0x27b069){return this['getDataValue'](_0x6fcd('0x3'));}},'alias':{'type':Sequelize[_0x6fcd('0x4')],'allowNull':![],'set':function(_0x1b99c9){this['setDataValue'](_0x6fcd('0x3'),_0x1b99c9?_0x1b99c9:this['getDataValue'](_0x6fcd('0x5')));}},'type':{'type':Sequelize[_0x6fcd('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0x6fcd('0x6')]('long'),'get':function(){if(this[_0x6fcd('0x7')](_0x6fcd('0x8'))===_0x6fcd('0x9')){return JSON[_0x6fcd('0xa')](this['getDataValue'](_0x6fcd('0xb')));}else{return this[_0x6fcd('0x7')](_0x6fcd('0xb'));}},'set':function(_0x36e3e3){if(Array['isArray'](_0x36e3e3)){this[_0x6fcd('0xc')](_0x6fcd('0xb'),JSON[_0x6fcd('0xd')](_0x36e3e3));}else{this[_0x6fcd('0xc')](_0x6fcd('0xb'),_0x36e3e3);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x6fcd('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x6fcd('0xf')](_0x6fcd('0x10'))}}; \ No newline at end of file +var _0x16e7=['sequelize','getDataValue','alias','STRING','setDataValue','name','TEXT','long','type','select','parse','values','BOOLEAN','ENUM','voice'];(function(_0x597258,_0x293d8b){var _0x1f1142=function(_0x300a61){while(--_0x300a61){_0x597258['push'](_0x597258['shift']());}};_0x1f1142(++_0x293d8b);}(_0x16e7,0x1b3));var _0x716e=function(_0xefd992,_0x3aa307){_0xefd992=_0xefd992-0x0;var _0x3b11d6=_0x16e7[_0xefd992];return _0x3b11d6;};'use strict';var Sequelize=require(_0x716e('0x0'));var _=require('lodash');module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x15393b){return this[_0x716e('0x1')](_0x716e('0x2'));}},'alias':{'type':Sequelize[_0x716e('0x3')],'allowNull':![],'set':function(_0x1cd808){this[_0x716e('0x4')](_0x716e('0x2'),_0x1cd808?_0x1cd808:this[_0x716e('0x1')](_0x716e('0x5')));}},'type':{'type':Sequelize[_0x716e('0x3')],'allowNull':![]},'values':{'type':Sequelize[_0x716e('0x6')](_0x716e('0x7')),'get':function(){if(this[_0x716e('0x1')](_0x716e('0x8'))===_0x716e('0x9')){return JSON[_0x716e('0xa')](this['getDataValue'](_0x716e('0xb')));}else{return this[_0x716e('0x1')](_0x716e('0xb'));}},'set':function(_0x4e4495){if(Array['isArray'](_0x4e4495)){this[_0x716e('0x4')](_0x716e('0xb'),JSON['stringify'](_0x4e4495));}else{this['setDataValue'](_0x716e('0xb'),_0x4e4495);}}},'required':{'type':Sequelize[_0x716e('0xc')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x716e('0xc')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x716e('0xd')](_0x716e('0xe'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index a3a6796..6175b63 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 _0xe6d7=['Content-Range','reject','update','then','destroy','error','stack','name','index','map','CmCustomField','rawAttributes','key','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','keys','include','find','body','create','sequelize','transaction','TEXT','type','text','Sequelize','INTEGER','switch','defaultValue','queryInterface','cm_contacts','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','set'];(function(_0x2626d1,_0x47c26e){var _0x2bf392=function(_0x4acc0d){while(--_0x4acc0d){_0x2626d1['push'](_0x2626d1['shift']());}};_0x2bf392(++_0x47c26e);}(_0xe6d7,0xd4));var _0x7e6d=function(_0xc99620,_0x28d9c1){_0xc99620=_0xc99620-0x0;var _0x21cd2f=_0xe6d7[_0xc99620];return _0x21cd2f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7e6d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7e6d('0x1'));var rp=require(_0x7e6d('0x2'));var moment=require(_0x7e6d('0x3'));var BPromise=require(_0x7e6d('0x4'));var Mustache=require('mustache');var util=require(_0x7e6d('0x5'));var path=require(_0x7e6d('0x6'));var sox=require(_0x7e6d('0x7'));var csv=require(_0x7e6d('0x8'));var ejs=require(_0x7e6d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7e6d('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7e6d('0xb'));var deskjs=require(_0x7e6d('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7e6d('0xd'));var Papa=require(_0x7e6d('0xe'));var Redis=require(_0x7e6d('0xf'));var authService=require(_0x7e6d('0x10'));var qs=require(_0x7e6d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7e6d('0x12'));var logger=require(_0x7e6d('0x13'))(_0x7e6d('0x14'));var utils=require('../../config/utils');var config=require(_0x7e6d('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7e6d('0x16'))['db'];function respondWithStatusCode(_0x2cdca3,_0x22b0da){_0x22b0da=_0x22b0da||0xcc;return function(_0x2b778a){if(_0x2b778a){return _0x2cdca3[_0x7e6d('0x17')](_0x22b0da);}return _0x2cdca3[_0x7e6d('0x18')](_0x22b0da)[_0x7e6d('0x19')]();};}function respondWithResult(_0x4f65f3,_0x40de72){_0x40de72=_0x40de72||0xc8;return function(_0x555982){if(_0x555982){return _0x4f65f3[_0x7e6d('0x18')](_0x40de72)['json'](_0x555982);}};}function respondWithFilteredResult(_0x1dd9fe,_0x6d4550){return function(_0x4b00fb){if(_0x4b00fb){var _0x5eb49d=typeof _0x6d4550['offset']===_0x7e6d('0x1a')&&typeof _0x6d4550[_0x7e6d('0x1b')]===_0x7e6d('0x1a');var _0x1f9b9d=_0x4b00fb['count'];var _0x5b4313=_0x5eb49d?0x0:_0x6d4550[_0x7e6d('0x1c')];var _0x4b07af=_0x5eb49d?_0x4b00fb[_0x7e6d('0x1d')]:_0x6d4550[_0x7e6d('0x1c')]+_0x6d4550[_0x7e6d('0x1b')];var _0x2f37da;if(_0x4b07af>=_0x1f9b9d){_0x4b07af=_0x1f9b9d;_0x2f37da=0xc8;}else{_0x2f37da=0xce;}_0x1dd9fe[_0x7e6d('0x18')](_0x2f37da);return _0x1dd9fe[_0x7e6d('0x1e')](_0x7e6d('0x1f'),_0x5b4313+'-'+_0x4b07af+'/'+_0x1f9b9d)['json'](_0x4b00fb);}return null;};}function patchUpdates(_0x37369c){return function(_0x16369d){try{jsonpatch['apply'](_0x16369d,_0x37369c,!![]);}catch(_0x2deec2){return BPromise[_0x7e6d('0x20')](_0x2deec2);}return _0x16369d['save']();};}function saveUpdates(_0x505038,_0xfe4ec6){return function(_0x37f30a){if(_0x37f30a){return _0x37f30a[_0x7e6d('0x21')](_0x505038)[_0x7e6d('0x22')](function(_0x3029bc){return _0x3029bc;});}return null;};}function removeEntity(_0x5667c6,_0x2d4b2a){return function(_0x5ebcd0){if(_0x5ebcd0){return _0x5ebcd0[_0x7e6d('0x23')]()['then'](function(){_0x5667c6[_0x7e6d('0x18')](0xcc)[_0x7e6d('0x19')]();});}};}function handleEntityNotFound(_0x513de9,_0x1a1864){return function(_0xa4ce30){if(!_0xa4ce30){_0x513de9[_0x7e6d('0x17')](0x194);}return _0xa4ce30;};}function handleError(_0x2ab933,_0x563a96){_0x563a96=_0x563a96||0x1f4;return function(_0x50ec71){logger[_0x7e6d('0x24')](_0x50ec71[_0x7e6d('0x25')]);if(_0x50ec71['name']){delete _0x50ec71[_0x7e6d('0x26')];}_0x2ab933['status'](_0x563a96)['send'](_0x50ec71);};}exports[_0x7e6d('0x27')]=function(_0x58a602,_0xeea8fd){var _0x4e3c74={},_0x490857={},_0x4ad8f3={'count':0x0,'rows':[]};var _0x31687f=_[_0x7e6d('0x28')](db[_0x7e6d('0x29')][_0x7e6d('0x2a')],function(_0x3a037c){return{'name':_0x3a037c['fieldName'],'type':_0x3a037c['type'][_0x7e6d('0x2b')]};});_0x490857['model']=_['differenceBy'](_[_0x7e6d('0x28')](_0x31687f,'name'),[_0x7e6d('0x26')]);_0x490857[_0x7e6d('0x2c')]=_['keys'](_0x58a602[_0x7e6d('0x2c')]);_0x490857['filters']=_[_0x7e6d('0x2d')](_0x490857[_0x7e6d('0x2e')],_0x490857[_0x7e6d('0x2c')]);_0x4e3c74['attributes']=_['intersection'](_0x490857[_0x7e6d('0x2e')],qs[_0x7e6d('0x2f')](_0x58a602['query'][_0x7e6d('0x2f')]));_0x4e3c74[_0x7e6d('0x30')]=_0x4e3c74[_0x7e6d('0x30')][_0x7e6d('0x31')]?_0x4e3c74[_0x7e6d('0x30')]:_0x490857[_0x7e6d('0x2e')];if(!_0x58a602[_0x7e6d('0x2c')][_0x7e6d('0x32')](_0x7e6d('0x33'))){_0x4e3c74[_0x7e6d('0x1b')]=qs[_0x7e6d('0x1b')](_0x58a602['query'][_0x7e6d('0x1b')]);_0x4e3c74[_0x7e6d('0x1c')]=qs[_0x7e6d('0x1c')](_0x58a602['query'][_0x7e6d('0x1c')]);}_0x4e3c74['order']=qs[_0x7e6d('0x34')](_0x58a602[_0x7e6d('0x2c')][_0x7e6d('0x34')]);_0x4e3c74[_0x7e6d('0x35')]=qs[_0x7e6d('0x36')](_[_0x7e6d('0x37')](_0x58a602[_0x7e6d('0x2c')],_0x490857[_0x7e6d('0x36')]),_0x31687f);if(_0x58a602[_0x7e6d('0x2c')][_0x7e6d('0x38')]){_0x4e3c74[_0x7e6d('0x35')]=_[_0x7e6d('0x39')](_0x4e3c74[_0x7e6d('0x35')],{'$or':_[_0x7e6d('0x28')](_0x31687f,function(_0x3d8720){if(_0x3d8720['type']!==_0x7e6d('0x3a')){var _0x2b76b6={};_0x2b76b6[_0x3d8720[_0x7e6d('0x26')]]={'$like':'%'+_0x58a602['query'][_0x7e6d('0x38')]+'%'};return _0x2b76b6;}})});}_0x4e3c74=_[_0x7e6d('0x39')]({},_0x4e3c74,_0x58a602[_0x7e6d('0x3b')]);var _0xc1a1c3={'where':_0x4e3c74[_0x7e6d('0x35')]};return db[_0x7e6d('0x29')][_0x7e6d('0x1d')](_0xc1a1c3)[_0x7e6d('0x22')](function(_0x35fe0c){_0x4ad8f3['count']=_0x35fe0c;if(_0x58a602['query'][_0x7e6d('0x3c')]){_0x4e3c74['include']=[{'all':!![]}];}return db[_0x7e6d('0x29')][_0x7e6d('0x3d')](_0x4e3c74);})[_0x7e6d('0x22')](function(_0x4f5b7e){_0x4ad8f3['rows']=_0x4f5b7e;return _0x4ad8f3;})[_0x7e6d('0x22')](respondWithFilteredResult(_0xeea8fd,_0x4e3c74))[_0x7e6d('0x3e')](handleError(_0xeea8fd,null));};exports[_0x7e6d('0x3f')]=function(_0xd70e25,_0x566028){var _0x40f3ab={'raw':!![],'where':{'id':_0xd70e25[_0x7e6d('0x40')]['id']}},_0x344cd3={};_0x344cd3['model']=_[_0x7e6d('0x41')](db[_0x7e6d('0x29')][_0x7e6d('0x2a')]);_0x344cd3[_0x7e6d('0x2c')]=_[_0x7e6d('0x41')](_0xd70e25[_0x7e6d('0x2c')]);_0x344cd3['filters']=_[_0x7e6d('0x2d')](_0x344cd3['model'],_0x344cd3[_0x7e6d('0x2c')]);_0x40f3ab[_0x7e6d('0x30')]=_['intersection'](_0x344cd3['model'],qs[_0x7e6d('0x2f')](_0xd70e25[_0x7e6d('0x2c')][_0x7e6d('0x2f')]));_0x40f3ab['attributes']=_0x40f3ab['attributes'][_0x7e6d('0x31')]?_0x40f3ab[_0x7e6d('0x30')]:_0x344cd3[_0x7e6d('0x2e')];if(_0xd70e25[_0x7e6d('0x2c')][_0x7e6d('0x3c')]){_0x40f3ab[_0x7e6d('0x42')]=[{'all':!![]}];}_0x40f3ab=_[_0x7e6d('0x39')]({},_0x40f3ab,_0xd70e25['options']);return db[_0x7e6d('0x29')][_0x7e6d('0x43')](_0x40f3ab)[_0x7e6d('0x22')](handleEntityNotFound(_0x566028,null))[_0x7e6d('0x22')](respondWithResult(_0x566028,null))['catch'](handleError(_0x566028,null));};exports[_0x7e6d('0x21')]=function(_0x4a4c78,_0x14966e){if(_0x4a4c78[_0x7e6d('0x44')]['id']){delete _0x4a4c78[_0x7e6d('0x44')]['id'];}return db[_0x7e6d('0x29')][_0x7e6d('0x43')]({'where':{'id':_0x4a4c78['params']['id']}})[_0x7e6d('0x22')](handleEntityNotFound(_0x14966e,null))[_0x7e6d('0x22')](saveUpdates(_0x4a4c78['body'],null))['then'](respondWithResult(_0x14966e,null))[_0x7e6d('0x3e')](handleError(_0x14966e,null));};exports[_0x7e6d('0x23')]=function(_0x3f6873,_0x4b01f1){return db[_0x7e6d('0x29')][_0x7e6d('0x43')]({'where':{'id':_0x3f6873[_0x7e6d('0x40')]['id']}})[_0x7e6d('0x22')](handleEntityNotFound(_0x4b01f1,null))[_0x7e6d('0x22')](removeEntity(_0x4b01f1,null))[_0x7e6d('0x3e')](handleError(_0x4b01f1,null));};exports[_0x7e6d('0x45')]=function(_0x5ac798,_0x2885d5){var _0x42de51;return db[_0x7e6d('0x46')][_0x7e6d('0x47')](function(_0x5a3f53){return db[_0x7e6d('0x29')][_0x7e6d('0x45')](_0x5ac798[_0x7e6d('0x44')],{'transaction':_0x5a3f53})[_0x7e6d('0x22')](function(_0x50d812){_0x42de51=_0x50d812;var _0xa23d2f={'type':db['Sequelize'][_0x7e6d('0x48')],'transaction':_0x5a3f53};switch(_0x5ac798['body'][_0x7e6d('0x49')]){case _0x7e6d('0x4a'):_0xa23d2f['type']=db[_0x7e6d('0x4b')]['TEXT'];break;case'number':_0xa23d2f[_0x7e6d('0x49')]=db['Sequelize'][_0x7e6d('0x4c')];break;case _0x7e6d('0x4d'):_0xa23d2f[_0x7e6d('0x49')]=db[_0x7e6d('0x4b')]['BOOLEAN'];_0xa23d2f[_0x7e6d('0x4e')]=![];break;default:}return db[_0x7e6d('0x46')][_0x7e6d('0x4f')]['addColumn'](_0x7e6d('0x50'),util['format']('cf_%d',_0x42de51['id']),_0xa23d2f);})['then'](function(){return _0x42de51;});})[_0x7e6d('0x22')](respondWithResult(_0x2885d5,0xc9))[_0x7e6d('0x3e')](handleError(_0x2885d5,null));}; \ No newline at end of file +var _0x0560=['options','includeAll','include','catch','show','body','find','params','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','map','CmCustomField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL'];(function(_0x421196,_0x1cbd94){var _0x2738af=function(_0xc956ff){while(--_0xc956ff){_0x421196['push'](_0x421196['shift']());}};_0x2738af(++_0x1cbd94);}(_0x0560,0x120));var _0x0056=function(_0xad6236,_0x489ebc){_0xad6236=_0xad6236-0x0;var _0x47cdcd=_0x0560[_0xad6236];return _0x47cdcd;};'use strict';var emlformat=require(_0x0056('0x0'));var rimraf=require(_0x0056('0x1'));var zipdir=require(_0x0056('0x2'));var jsonpatch=require(_0x0056('0x3'));var rp=require(_0x0056('0x4'));var moment=require(_0x0056('0x5'));var BPromise=require(_0x0056('0x6'));var Mustache=require('mustache');var util=require(_0x0056('0x7'));var path=require('path');var sox=require(_0x0056('0x8'));var csv=require(_0x0056('0x9'));var ejs=require(_0x0056('0xa'));var fs=require('fs');var fs_extra=require(_0x0056('0xb'));var _=require(_0x0056('0xc'));var squel=require(_0x0056('0xd'));var crypto=require('crypto');var jsforce=require(_0x0056('0xe'));var deskjs=require(_0x0056('0xf'));var toCsv=require(_0x0056('0x9'));var querystring=require(_0x0056('0x10'));var Papa=require(_0x0056('0x11'));var Redis=require(_0x0056('0x12'));var authService=require(_0x0056('0x13'));var qs=require(_0x0056('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0056('0x15'));var logger=require('../../config/logger')(_0x0056('0x16'));var utils=require(_0x0056('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x0056('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x575d23,_0x5b753b){_0x5b753b=_0x5b753b||0xcc;return function(_0x460226){if(_0x460226){return _0x575d23['sendStatus'](_0x5b753b);}return _0x575d23[_0x0056('0x19')](_0x5b753b)[_0x0056('0x1a')]();};}function respondWithResult(_0x5860ee,_0x152c5a){_0x152c5a=_0x152c5a||0xc8;return function(_0x59a743){if(_0x59a743){return _0x5860ee[_0x0056('0x19')](_0x152c5a)[_0x0056('0x1b')](_0x59a743);}};}function respondWithFilteredResult(_0x2ca2ee,_0x10cc92){return function(_0x5a87f3){if(_0x5a87f3){var _0x5dbd28=typeof _0x10cc92[_0x0056('0x1c')]==='undefined'&&typeof _0x10cc92['limit']===_0x0056('0x1d');var _0x29af51=_0x5a87f3[_0x0056('0x1e')];var _0x8ce165=_0x5dbd28?0x0:_0x10cc92[_0x0056('0x1c')];var _0x42a2b7=_0x5dbd28?_0x5a87f3['count']:_0x10cc92[_0x0056('0x1c')]+_0x10cc92[_0x0056('0x1f')];var _0x2ad318;if(_0x42a2b7>=_0x29af51){_0x42a2b7=_0x29af51;_0x2ad318=0xc8;}else{_0x2ad318=0xce;}_0x2ca2ee['status'](_0x2ad318);return _0x2ca2ee[_0x0056('0x20')](_0x0056('0x21'),_0x8ce165+'-'+_0x42a2b7+'/'+_0x29af51)[_0x0056('0x1b')](_0x5a87f3);}return null;};}function patchUpdates(_0x2b9423){return function(_0x1b66ed){try{jsonpatch[_0x0056('0x22')](_0x1b66ed,_0x2b9423,!![]);}catch(_0x532663){return BPromise[_0x0056('0x23')](_0x532663);}return _0x1b66ed['save']();};}function saveUpdates(_0x199ace,_0x1523a0){return function(_0x37848a){if(_0x37848a){return _0x37848a[_0x0056('0x24')](_0x199ace)[_0x0056('0x25')](function(_0x581f3c){return _0x581f3c;});}return null;};}function removeEntity(_0x433739,_0x3259cf){return function(_0x2f35a){if(_0x2f35a){return _0x2f35a[_0x0056('0x26')]()[_0x0056('0x25')](function(){_0x433739[_0x0056('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x107c10,_0x2e84da){return function(_0x51eefd){if(!_0x51eefd){_0x107c10[_0x0056('0x27')](0x194);}return _0x51eefd;};}function handleError(_0x481ea4,_0x13d94b){_0x13d94b=_0x13d94b||0x1f4;return function(_0xa7da86){logger[_0x0056('0x28')](_0xa7da86[_0x0056('0x29')]);if(_0xa7da86[_0x0056('0x2a')]){delete _0xa7da86[_0x0056('0x2a')];}_0x481ea4[_0x0056('0x19')](_0x13d94b)[_0x0056('0x2b')](_0xa7da86);};}exports['index']=function(_0x523266,_0x514ef7){var _0x3702a4={},_0x5cd7ab={},_0x5b27a0={'count':0x0,'rows':[]};var _0x4861a9=_[_0x0056('0x2c')](db[_0x0056('0x2d')][_0x0056('0x2e')],function(_0x497d73){return{'name':_0x497d73[_0x0056('0x2f')],'type':_0x497d73[_0x0056('0x30')][_0x0056('0x31')]};});_0x5cd7ab[_0x0056('0x32')]=_['differenceBy'](_['map'](_0x4861a9,'name'),[_0x0056('0x2a')]);_0x5cd7ab[_0x0056('0x33')]=_[_0x0056('0x34')](_0x523266[_0x0056('0x33')]);_0x5cd7ab[_0x0056('0x35')]=_['intersection'](_0x5cd7ab['model'],_0x5cd7ab['query']);_0x3702a4[_0x0056('0x36')]=_[_0x0056('0x37')](_0x5cd7ab[_0x0056('0x32')],qs[_0x0056('0x38')](_0x523266[_0x0056('0x33')][_0x0056('0x38')]));_0x3702a4[_0x0056('0x36')]=_0x3702a4['attributes']['length']?_0x3702a4[_0x0056('0x36')]:_0x5cd7ab[_0x0056('0x32')];if(!_0x523266[_0x0056('0x33')][_0x0056('0x39')]('nolimit')){_0x3702a4[_0x0056('0x1f')]=qs[_0x0056('0x1f')](_0x523266[_0x0056('0x33')][_0x0056('0x1f')]);_0x3702a4[_0x0056('0x1c')]=qs[_0x0056('0x1c')](_0x523266[_0x0056('0x33')][_0x0056('0x1c')]);}_0x3702a4[_0x0056('0x3a')]=qs[_0x0056('0x3b')](_0x523266['query'][_0x0056('0x3b')]);_0x3702a4[_0x0056('0x3c')]=qs[_0x0056('0x35')](_['pick'](_0x523266['query'],_0x5cd7ab[_0x0056('0x35')]),_0x4861a9);if(_0x523266[_0x0056('0x33')][_0x0056('0x3d')]){_0x3702a4[_0x0056('0x3c')]=_[_0x0056('0x3e')](_0x3702a4['where'],{'$or':_[_0x0056('0x2c')](_0x4861a9,function(_0x221f02){if(_0x221f02[_0x0056('0x30')]!==_0x0056('0x3f')){var _0x47dac2={};_0x47dac2[_0x221f02[_0x0056('0x2a')]]={'$like':'%'+_0x523266['query'][_0x0056('0x3d')]+'%'};return _0x47dac2;}})});}_0x3702a4=_[_0x0056('0x3e')]({},_0x3702a4,_0x523266[_0x0056('0x40')]);var _0xfd07e6={'where':_0x3702a4[_0x0056('0x3c')]};return db[_0x0056('0x2d')][_0x0056('0x1e')](_0xfd07e6)[_0x0056('0x25')](function(_0x2d5524){_0x5b27a0['count']=_0x2d5524;if(_0x523266[_0x0056('0x33')][_0x0056('0x41')]){_0x3702a4[_0x0056('0x42')]=[{'all':!![]}];}return db[_0x0056('0x2d')]['findAll'](_0x3702a4);})['then'](function(_0x459136){_0x5b27a0['rows']=_0x459136;return _0x5b27a0;})[_0x0056('0x25')](respondWithFilteredResult(_0x514ef7,_0x3702a4))[_0x0056('0x43')](handleError(_0x514ef7,null));};exports[_0x0056('0x44')]=function(_0x289fcd,_0xd0fbc5){var _0x32d012={'raw':!![],'where':{'id':_0x289fcd['params']['id']}},_0x340a91={};_0x340a91['model']=_[_0x0056('0x34')](db[_0x0056('0x2d')][_0x0056('0x2e')]);_0x340a91['query']=_[_0x0056('0x34')](_0x289fcd[_0x0056('0x33')]);_0x340a91[_0x0056('0x35')]=_[_0x0056('0x37')](_0x340a91[_0x0056('0x32')],_0x340a91['query']);_0x32d012[_0x0056('0x36')]=_[_0x0056('0x37')](_0x340a91[_0x0056('0x32')],qs[_0x0056('0x38')](_0x289fcd['query'][_0x0056('0x38')]));_0x32d012[_0x0056('0x36')]=_0x32d012[_0x0056('0x36')]['length']?_0x32d012[_0x0056('0x36')]:_0x340a91['model'];if(_0x289fcd[_0x0056('0x33')]['includeAll']){_0x32d012[_0x0056('0x42')]=[{'all':!![]}];}_0x32d012=_[_0x0056('0x3e')]({},_0x32d012,_0x289fcd[_0x0056('0x40')]);return db['CmCustomField']['find'](_0x32d012)[_0x0056('0x25')](handleEntityNotFound(_0xd0fbc5,null))[_0x0056('0x25')](respondWithResult(_0xd0fbc5,null))['catch'](handleError(_0xd0fbc5,null));};exports[_0x0056('0x24')]=function(_0x5116e1,_0xb94015){if(_0x5116e1[_0x0056('0x45')]['id']){delete _0x5116e1[_0x0056('0x45')]['id'];}return db[_0x0056('0x2d')][_0x0056('0x46')]({'where':{'id':_0x5116e1[_0x0056('0x47')]['id']}})[_0x0056('0x25')](handleEntityNotFound(_0xb94015,null))[_0x0056('0x25')](saveUpdates(_0x5116e1[_0x0056('0x45')],null))[_0x0056('0x25')](respondWithResult(_0xb94015,null))[_0x0056('0x43')](handleError(_0xb94015,null));};exports[_0x0056('0x26')]=function(_0x21ec17,_0x508fac){return db[_0x0056('0x2d')][_0x0056('0x46')]({'where':{'id':_0x21ec17[_0x0056('0x47')]['id']}})[_0x0056('0x25')](handleEntityNotFound(_0x508fac,null))[_0x0056('0x25')](removeEntity(_0x508fac,null))[_0x0056('0x43')](handleError(_0x508fac,null));};exports[_0x0056('0x48')]=function(_0x26324c,_0x48519b){var _0x2ef6ac;return db[_0x0056('0x49')][_0x0056('0x4a')](function(_0x3bd31e){return db[_0x0056('0x2d')]['create'](_0x26324c[_0x0056('0x45')],{'transaction':_0x3bd31e})[_0x0056('0x25')](function(_0x1ec54a){_0x2ef6ac=_0x1ec54a;var _0x2f5562={'type':db[_0x0056('0x4b')][_0x0056('0x4c')],'transaction':_0x3bd31e};switch(_0x26324c[_0x0056('0x45')][_0x0056('0x30')]){case _0x0056('0x4d'):_0x2f5562[_0x0056('0x30')]=db[_0x0056('0x4b')]['TEXT'];break;case _0x0056('0x4e'):_0x2f5562[_0x0056('0x30')]=db[_0x0056('0x4b')][_0x0056('0x4f')];break;case _0x0056('0x50'):_0x2f5562[_0x0056('0x30')]=db['Sequelize'][_0x0056('0x51')];_0x2f5562[_0x0056('0x52')]=![];break;default:}return db[_0x0056('0x49')][_0x0056('0x53')][_0x0056('0x54')](_0x0056('0x55'),util[_0x0056('0x56')](_0x0056('0x57'),_0x2ef6ac['id']),_0x2f5562);})['then'](function(){return _0x2ef6ac;});})['then'](respondWithResult(_0x48519b,0xc9))['catch'](handleError(_0x48519b,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 58bdf4f..c88ef37 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 _0xd3ef=['exports','CmCustomField','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes'];(function(_0x188c90,_0x59c793){var _0x23850f=function(_0x47b75b){while(--_0x47b75b){_0x188c90['push'](_0x188c90['shift']());}};_0x23850f(++_0x59c793);}(_0xd3ef,0x7a));var _0xfd3e=function(_0x5a8c89,_0xc5bd76){_0x5a8c89=_0x5a8c89-0x0;var _0x115fb3=_0xd3ef[_0x5a8c89];return _0x115fb3;};'use strict';var _=require(_0xfd3e('0x0'));var util=require(_0xfd3e('0x1'));var logger=require(_0xfd3e('0x2'))(_0xfd3e('0x3'));var moment=require('moment');var BPromise=require(_0xfd3e('0x4'));var rp=require(_0xfd3e('0x5'));var fs=require('fs');var path=require(_0xfd3e('0x6'));var rimraf=require(_0xfd3e('0x7'));var config=require(_0xfd3e('0x8'));var attributes=require(_0xfd3e('0x9'));module[_0xfd3e('0xa')]=function(_0x24b59f,_0x3f6101){return _0x24b59f['define'](_0xfd3e('0xb'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf48b=['rimraf','./cmCustomField.attributes','define','cm_custom_fields','util','api','bluebird','request-promise','path'];(function(_0x72da61,_0x4d30b5){var _0x2cc185=function(_0x26e383){while(--_0x26e383){_0x72da61['push'](_0x72da61['shift']());}};_0x2cc185(++_0x4d30b5);}(_0xf48b,0x1ab));var _0xbf48=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf48b[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xbf48('0x0'));var logger=require('../../config/logger')(_0xbf48('0x1'));var moment=require('moment');var BPromise=require(_0xbf48('0x2'));var rp=require(_0xbf48('0x3'));var fs=require('fs');var path=require(_0xbf48('0x4'));var rimraf=require(_0xbf48('0x5'));var config=require('../../config/environment');var attributes=require(_0xbf48('0x6'));module['exports']=function(_0x2408af,_0x5f1796){return _0x2408af[_0xbf48('0x7')]('CmCustomField',attributes,{'tableName':_0xbf48('0x8'),'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 9bb3ac0..d09fbc8 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 _0x1e1e=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x35b9d3,_0x1babcf){var _0x1d80b8=function(_0xb4c327){while(--_0xb4c327){_0x35b9d3['push'](_0x35b9d3['shift']());}};_0x1d80b8(++_0x1babcf);}(_0x1e1e,0x161));var _0xe1e1=function(_0x5d8018,_0x588592){_0x5d8018=_0x5d8018-0x0;var _0x151ac4=_0x1e1e[_0x5d8018];return _0x151ac4;};'use strict';var _=require('lodash');var util=require(_0xe1e1('0x0'));var moment=require('moment');var BPromise=require(_0xe1e1('0x1'));var rs=require(_0xe1e1('0x2'));var fs=require('fs');var Redis=require(_0xe1e1('0x3'));var db=require(_0xe1e1('0x4'))['db'];var utils=require(_0xe1e1('0x5'));var logger=require(_0xe1e1('0x6'))(_0xe1e1('0x7'));var config=require(_0xe1e1('0x8'));var jayson=require(_0xe1e1('0x9'));var client=jayson[_0xe1e1('0xa')][_0xe1e1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x116068,_0x4055cc,_0x241b1b){return new BPromise(function(_0x1a02fe,_0x5c62ed){return client[_0xe1e1('0xc')](_0x116068,_0x241b1b)[_0xe1e1('0xd')](function(_0x18c38c){logger[_0xe1e1('0xe')](_0xe1e1('0xf'),_0x4055cc,_0xe1e1('0x10'));logger[_0xe1e1('0x11')](_0xe1e1('0x12'),_0x4055cc,_0xe1e1('0x10'),JSON[_0xe1e1('0x13')](_0x18c38c));if(_0x18c38c[_0xe1e1('0x14')]){if(_0x18c38c[_0xe1e1('0x14')][_0xe1e1('0x15')]===0x1f4){logger[_0xe1e1('0x14')]('CmCustomField,\x20%s,\x20%s',_0x4055cc,_0x18c38c[_0xe1e1('0x14')][_0xe1e1('0x16')]);return _0x5c62ed(_0x18c38c[_0xe1e1('0x14')][_0xe1e1('0x16')]);}logger[_0xe1e1('0x14')]('CmCustomField,\x20%s,\x20%s',_0x4055cc,_0x18c38c[_0xe1e1('0x14')]['message']);return _0x1a02fe(_0x18c38c[_0xe1e1('0x14')][_0xe1e1('0x16')]);}else{logger[_0xe1e1('0xe')]('CmCustomField,\x20%s,\x20%s',_0x4055cc,_0xe1e1('0x10'));_0x1a02fe(_0x18c38c[_0xe1e1('0x17')][_0xe1e1('0x16')]);}})['catch'](function(_0x16aff8){logger[_0xe1e1('0x14')](_0xe1e1('0xf'),_0x4055cc,_0x16aff8);_0x5c62ed(_0x16aff8);});});} \ No newline at end of file +var _0x106e=['request','then','info','request\x20sent','debug','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x106e,0x182));var _0xe106=function(_0x2016ff,_0x364a39){_0x2016ff=_0x2016ff-0x0;var _0x1d3f02=_0x106e[_0x2016ff];return _0x1d3f02;};'use strict';var _=require(_0xe106('0x0'));var util=require(_0xe106('0x1'));var moment=require(_0xe106('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe106('0x3'));var db=require(_0xe106('0x4'))['db'];var utils=require(_0xe106('0x5'));var logger=require(_0xe106('0x6'))('rpc');var config=require(_0xe106('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe106('0x8')][_0xe106('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x118699,_0x26a846,_0xb32567){return new BPromise(function(_0xa614b5,_0x5475e0){return client[_0xe106('0xa')](_0x118699,_0xb32567)[_0xe106('0xb')](function(_0xe54c88){logger[_0xe106('0xc')]('CmCustomField,\x20%s,\x20%s',_0x26a846,_0xe106('0xd'));logger[_0xe106('0xe')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x26a846,_0xe106('0xd'),JSON[_0xe106('0xf')](_0xe54c88));if(_0xe54c88[_0xe106('0x10')]){if(_0xe54c88['error'][_0xe106('0x11')]===0x1f4){logger['error'](_0xe106('0x12'),_0x26a846,_0xe54c88['error'][_0xe106('0x13')]);return _0x5475e0(_0xe54c88[_0xe106('0x10')]['message']);}logger[_0xe106('0x10')]('CmCustomField,\x20%s,\x20%s',_0x26a846,_0xe54c88[_0xe106('0x10')]['message']);return _0xa614b5(_0xe54c88['error'][_0xe106('0x13')]);}else{logger[_0xe106('0xc')](_0xe106('0x12'),_0x26a846,_0xe106('0xd'));_0xa614b5(_0xe54c88[_0xe106('0x14')][_0xe106('0x13')]);}})[_0xe106('0x15')](function(_0x126a4b){logger[_0xe106('0x10')]('CmCustomField,\x20%s,\x20%s',_0x26a846,_0x126a4b);_0x5475e0(_0x126a4b);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index b02d61e..9a71e19 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 _0xbcbb=['express','../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','put','update','delete','destroy','multer','util','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbcbb,0x14d));var _0xbbcb=function(_0x1486e5,_0x39684f){_0x1486e5=_0x1486e5-0x0;var _0x29d89b=_0xbcbb[_0x1486e5];return _0x29d89b;};'use strict';var multer=require(_0xbbcb('0x0'));var util=require(_0xbbcb('0x1'));var path=require(_0xbbcb('0x2'));var timeout=require('connect-timeout');var express=require(_0xbbcb('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbbcb('0x4'));var interaction=require(_0xbbcb('0x5'));var config=require('../../config/environment');var controller=require(_0xbbcb('0x6'));router[_0xbbcb('0x7')]('/',auth[_0xbbcb('0x8')](),controller[_0xbbcb('0x9')]);router[_0xbbcb('0x7')](_0xbbcb('0xa'),auth[_0xbbcb('0x8')](),controller[_0xbbcb('0xb')]);router['post']('/',auth[_0xbbcb('0x8')](),controller['create']);router[_0xbbcb('0xc')](_0xbbcb('0xa'),auth[_0xbbcb('0x8')](),controller[_0xbbcb('0xd')]);router[_0xbbcb('0xe')]('/:id',auth[_0xbbcb('0x8')](),controller[_0xbbcb('0xf')]);module['exports']=router; \ No newline at end of file +var _0x5379=['../../config/environment','isAuthenticated','get','/:id','show','create','put','update','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1263cc,_0x34b0a6){var _0x4132a0=function(_0x5ddd32){while(--_0x5ddd32){_0x1263cc['push'](_0x1263cc['shift']());}};_0x4132a0(++_0x34b0a6);}(_0x5379,0x1a2));var _0x9537=function(_0x5c4ab0,_0x548cac){_0x5c4ab0=_0x5c4ab0-0x0;var _0x435151=_0x5379[_0x5c4ab0];return _0x435151;};'use strict';var multer=require(_0x9537('0x0'));var util=require(_0x9537('0x1'));var path=require(_0x9537('0x2'));var timeout=require('connect-timeout');var express=require(_0x9537('0x3'));var router=express['Router']();var fs_extra=require(_0x9537('0x4'));var auth=require(_0x9537('0x5'));var interaction=require(_0x9537('0x6'));var config=require(_0x9537('0x7'));var controller=require('./cmCustomField.controller');router['get']('/',auth[_0x9537('0x8')](),controller['index']);router[_0x9537('0x9')](_0x9537('0xa'),auth[_0x9537('0x8')](),controller[_0x9537('0xb')]);router['post']('/',auth[_0x9537('0x8')](),controller[_0x9537('0xc')]);router[_0x9537('0xd')](_0x9537('0xa'),auth['isAuthenticated'](),controller[_0x9537('0xe')]);router['delete']('/:id',auth[_0x9537('0x8')](),controller[_0x9537('0xf')]);module[_0x9537('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index b8f0dce..e8e7df9 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 _0x9ef3=['UNSIGNED','contactListQueue','exports','STRING','BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x31b5a5,_0x44376a){var _0x364cc9=function(_0x4e5f95){while(--_0x4e5f95){_0x31b5a5['push'](_0x31b5a5['shift']());}};_0x364cc9(++_0x44376a);}(_0x9ef3,0x1ba));var _0x39ef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ef3[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x39ef('0x0')]={'phone':{'type':Sequelize[_0x39ef('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0x39ef('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x39ef('0x3')],'defaultValue':moment()['format'](_0x39ef('0x4'))},'countbusyretry':{'type':Sequelize[_0x39ef('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x39ef('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x39ef('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x39ef('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x39ef('0x5')](0x2)[_0x39ef('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x39ef('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x39ef('0x5')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x39ef('0x5')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x39ef('0x5')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x39ef('0x7')},'CampaignId':{'type':Sequelize[_0x39ef('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x39ef('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x39ef('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x39ef('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x39ef('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0x39ef('0x3')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x7b61=['exports','STRING','BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','DATE','contactListQueue','sequelize'];(function(_0x1581f5,_0x235d79){var _0x2b26f0=function(_0x51bc79){while(--_0x51bc79){_0x1581f5['push'](_0x1581f5['shift']());}};_0x2b26f0(++_0x235d79);}(_0x7b61,0x131));var _0x17b6=function(_0x19bb5c,_0xcc7eaa){_0x19bb5c=_0x19bb5c-0x0;var _0x2efbaa=_0x7b61[_0x19bb5c];return _0x2efbaa;};'use strict';var moment=require('moment');var Sequelize=require(_0x17b6('0x0'));module[_0x17b6('0x1')]={'phone':{'type':Sequelize[_0x17b6('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x17b6('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x17b6('0x4')](_0x17b6('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x17b6('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x17b6('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x17b6('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x17b6('0x7')]},'priority':{'type':Sequelize[_0x17b6('0x6')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x17b6('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x17b6('0x6')],'unique':_0x17b6('0x8')},'ListId':{'type':Sequelize[_0x17b6('0x6')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x17b6('0x6')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x17b6('0x8')},'CampaignId':{'type':Sequelize[_0x17b6('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0x17b6('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x17b6('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x17b6('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x17b6('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0x17b6('0x7')],'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 bc6d56e..cd1de6e 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 _0xa1f6=['Contact','CmCompany','Company','CmList','List','VoiceQueue','Queue','dialActive','getPreviewRecall','findOne','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','getTimezones','push','utcOffset','getTimezone','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','json','offset','undefined','count','limit','set','update','then','sendStatus','error','stack','name','status','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','$and','$lte','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$overlap','$contains','$any','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','CmHopper','find','create','body','describe','destroy','VoiceQueueId','CampaignId','Campaign','omit','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','format','calleridnum','phone','campaigntype','queue','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','dialPreviewAutoRecallMe','sequelize','transaction','YYYY-MM-DD\x20HH:mm:ss','direction','prev','hopperIds','priority','ASC','scheduledAt','DESC','literal','isEmpty','dialOrderByScheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','recallme','LOCK','UPDATE'];(function(_0x320d18,_0x7a06d9){var _0x18166f=function(_0x15c016){while(--_0x15c016){_0x320d18['push'](_0x320d18['shift']());}};_0x18166f(++_0x7a06d9);}(_0xa1f6,0x19d));var _0x6a1f=function(_0x52ea08,_0x15d935){_0x52ea08=_0x52ea08-0x0;var _0x28d546=_0xa1f6[_0x52ea08];return _0x28d546;};'use strict';var moment=require(_0x6a1f('0x0'));var _=require(_0x6a1f('0x1'));var qs=require(_0x6a1f('0x2'));var logger=require(_0x6a1f('0x3'))(_0x6a1f('0x4'));var shared=require(_0x6a1f('0x5'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x52b77b,_0x521944){_0x521944=_0x521944||0xc8;return function(_0x5d4ad7){if(_0x5d4ad7){return _0x52b77b['status'](_0x521944)[_0x6a1f('0x6')](_0x5d4ad7);}};}function respondWithFilteredResult(_0x426ae1,_0xa1c928){return function(_0x3a772b){if(_0x3a772b){var _0x328033=typeof _0xa1c928[_0x6a1f('0x7')]===_0x6a1f('0x8')&&typeof _0xa1c928['limit']===_0x6a1f('0x8');var _0x2950ff=_0x3a772b[_0x6a1f('0x9')];var _0x287e54=_0x328033?0x0:_0xa1c928[_0x6a1f('0x7')];var _0x5aafd2=_0x328033?_0x3a772b[_0x6a1f('0x9')]:_0xa1c928[_0x6a1f('0x7')]+_0xa1c928[_0x6a1f('0xa')];var _0x3151f9;if(_0x5aafd2>=_0x2950ff){_0x5aafd2=_0x2950ff;_0x3151f9=0xc8;}else{_0x3151f9=0xce;}_0x426ae1['status'](_0x3151f9);return _0x426ae1[_0x6a1f('0xb')]('Content-Range',_0x287e54+'-'+_0x5aafd2+'/'+_0x2950ff)[_0x6a1f('0x6')](_0x3a772b);}return null;};}function saveUpdates(_0x17edb6,_0x2a4e94){return function(_0x442576){if(_0x442576){return _0x442576[_0x6a1f('0xc')](_0x17edb6)[_0x6a1f('0xd')](function(_0x3b3adb){return _0x3b3adb;});}return null;};}function handleEntityNotFound(_0x8c3a36,_0x1918c6){return function(_0x27d8f8){if(!_0x27d8f8){_0x8c3a36[_0x6a1f('0xe')](0x194);}return _0x27d8f8;};}function handleError(_0x1c8b26,_0x253305){_0x253305=_0x253305||0x1f4;return function(_0x2677c1){logger[_0x6a1f('0xf')](_0x2677c1[_0x6a1f('0x10')]);if(_0x2677c1[_0x6a1f('0x11')]){delete _0x2677c1[_0x6a1f('0x11')];}_0x1c8b26[_0x6a1f('0x12')](_0x253305)['send'](_0x2677c1);};}exports[_0x6a1f('0x13')]=function(_0x45e6f0,_0x1ccbed){var _0x9ff231={},_0x21d268={},_0x42b4c7={'count':0x0,'rows':[]};var _0x19562a=_[_0x6a1f('0x14')](db['CmHopper'][_0x6a1f('0x15')],function(_0x5100f2){return{'name':_0x5100f2[_0x6a1f('0x16')],'type':_0x5100f2[_0x6a1f('0x17')][_0x6a1f('0x18')]};});_0x21d268[_0x6a1f('0x19')]=_[_0x6a1f('0x14')](_0x19562a,'name');_0x21d268[_0x6a1f('0x1a')]=_[_0x6a1f('0x1b')](_0x45e6f0[_0x6a1f('0x1a')]);_0x21d268[_0x6a1f('0x1c')]=_[_0x6a1f('0x1d')](_0x21d268[_0x6a1f('0x19')],_0x21d268[_0x6a1f('0x1a')]);_0x21d268[_0x6a1f('0x1c')]=_['concat'](_0x21d268[_0x6a1f('0x1c')],[_0x6a1f('0x1e'),'$or','$gt','$gte','$lt',_0x6a1f('0x1f'),'$ne','$eq',_0x6a1f('0x20'),_0x6a1f('0x21'),_0x6a1f('0x22'),_0x6a1f('0x23'),_0x6a1f('0x24'),_0x6a1f('0x25'),_0x6a1f('0x26'),_0x6a1f('0x27'),'$notILike',_0x6a1f('0x25'),_0x6a1f('0x28'),_0x6a1f('0x29'),'$contained',_0x6a1f('0x2a')]);_0x9ff231[_0x6a1f('0x2b')]=_[_0x6a1f('0x1d')](_0x21d268[_0x6a1f('0x19')],qs[_0x6a1f('0x2c')](_0x45e6f0[_0x6a1f('0x1a')][_0x6a1f('0x2c')]));_0x9ff231['attributes']=_0x9ff231['attributes'][_0x6a1f('0x2d')]?_0x9ff231[_0x6a1f('0x2b')]:_0x21d268[_0x6a1f('0x19')];if(!_0x45e6f0[_0x6a1f('0x1a')][_0x6a1f('0x2e')](_0x6a1f('0x2f'))){_0x9ff231[_0x6a1f('0xa')]=qs['limit'](_0x45e6f0[_0x6a1f('0x1a')][_0x6a1f('0xa')]);_0x9ff231['offset']=qs[_0x6a1f('0x7')](_0x45e6f0[_0x6a1f('0x1a')][_0x6a1f('0x7')]);}_0x9ff231['order']=qs['sort'](_0x45e6f0[_0x6a1f('0x1a')][_0x6a1f('0x30')]);_0x9ff231[_0x6a1f('0x31')]=qs['filters'](_['pick'](_0x45e6f0[_0x6a1f('0x1a')],_0x21d268[_0x6a1f('0x1c')]),_0x19562a);if(_0x45e6f0[_0x6a1f('0x1a')][_0x6a1f('0x32')]){_0x9ff231[_0x6a1f('0x31')]=_[_0x6a1f('0x33')](_0x9ff231[_0x6a1f('0x31')],{'$or':_['map'](_0x19562a,function(_0xebc872){if(_0xebc872['type']!==_0x6a1f('0x34')){var _0x13057b={};_0x13057b[_0xebc872['name']]={'$like':'%'+_0x45e6f0[_0x6a1f('0x1a')][_0x6a1f('0x32')]+'%'};return _0x13057b;}})});}_0x9ff231=_['merge']({},_0x9ff231,_0x45e6f0[_0x6a1f('0x35')]);var _0x48c033={'where':_0x9ff231[_0x6a1f('0x31')]};return db['CmHopper'][_0x6a1f('0x9')](_0x48c033)['then'](function(_0x248305){_0x42b4c7[_0x6a1f('0x9')]=_0x248305;if(_0x45e6f0['query'][_0x6a1f('0x36')]){_0x9ff231[_0x6a1f('0x37')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x9ff231);})[_0x6a1f('0xd')](function(_0x4019e9){_0x42b4c7[_0x6a1f('0x38')]=_0x4019e9;return _0x42b4c7;})[_0x6a1f('0xd')](respondWithFilteredResult(_0x1ccbed,_0x9ff231))[_0x6a1f('0x39')](handleError(_0x1ccbed,null));};exports[_0x6a1f('0x3a')]=function(_0x4aa2b1,_0x31b672){var _0x2da23a={'raw':!![],'where':{'id':_0x4aa2b1[_0x6a1f('0x3b')]['id']}},_0x3169ef={};_0x3169ef[_0x6a1f('0x19')]=_[_0x6a1f('0x1b')](db[_0x6a1f('0x3c')][_0x6a1f('0x15')]);_0x3169ef[_0x6a1f('0x1a')]=_[_0x6a1f('0x1b')](_0x4aa2b1[_0x6a1f('0x1a')]);_0x3169ef['filters']=_[_0x6a1f('0x1d')](_0x3169ef[_0x6a1f('0x19')],_0x3169ef[_0x6a1f('0x1a')]);_0x2da23a[_0x6a1f('0x2b')]=_[_0x6a1f('0x1d')](_0x3169ef[_0x6a1f('0x19')],qs['fields'](_0x4aa2b1[_0x6a1f('0x1a')]['fields']));_0x2da23a[_0x6a1f('0x2b')]=_0x2da23a[_0x6a1f('0x2b')][_0x6a1f('0x2d')]?_0x2da23a[_0x6a1f('0x2b')]:_0x3169ef[_0x6a1f('0x19')];if(_0x4aa2b1[_0x6a1f('0x1a')]['includeAll']){_0x2da23a[_0x6a1f('0x37')]=[{'all':!![]}];}_0x2da23a=_[_0x6a1f('0x33')]({},_0x2da23a,_0x4aa2b1[_0x6a1f('0x35')]);return db[_0x6a1f('0x3c')][_0x6a1f('0x3d')](_0x2da23a)[_0x6a1f('0xd')](handleEntityNotFound(_0x31b672,null))[_0x6a1f('0xd')](respondWithResult(_0x31b672,null))[_0x6a1f('0x39')](handleError(_0x31b672,null));};exports[_0x6a1f('0x3e')]=function(_0x292844,_0x58786d){return db['CmHopper']['create'](_0x292844[_0x6a1f('0x3f')],{})[_0x6a1f('0xd')](respondWithResult(_0x58786d,0xc9))[_0x6a1f('0x39')](handleError(_0x58786d,null));};exports[_0x6a1f('0xc')]=function(_0x143aaa,_0xcc7a21){if(_0x143aaa['body']['id']){delete _0x143aaa[_0x6a1f('0x3f')]['id'];}return db['CmHopper'][_0x6a1f('0x3d')]({'where':{'id':_0x143aaa[_0x6a1f('0x3b')]['id']}})['then'](handleEntityNotFound(_0xcc7a21,null))[_0x6a1f('0xd')](saveUpdates(_0x143aaa['body'],null))[_0x6a1f('0xd')](respondWithResult(_0xcc7a21,null))[_0x6a1f('0x39')](handleError(_0xcc7a21,null));};exports[_0x6a1f('0x40')]=function(_0x4318fd,_0x10c713){return db[_0x6a1f('0x3c')]['describe']()[_0x6a1f('0xd')](respondWithResult(_0x10c713,null))[_0x6a1f('0x39')](handleError(_0x10c713,null));};exports[_0x6a1f('0x41')]=function(_0x2bea1a,_0x34fa17){var _0x2bbd38;var _0x4657ec=_0x2bea1a[_0x6a1f('0x3b')]['id'];return db['CmHopper'][_0x6a1f('0x3d')]({'where':{'id':_0x2bea1a[_0x6a1f('0x3b')]['id']}})[_0x6a1f('0xd')](handleEntityNotFound(_0x34fa17,null))['then'](function(_0x140421){if(_0x140421){return _0x140421['destroy']()[_0x6a1f('0xd')](function(_0x52c262){return _0x52c262;});}})[_0x6a1f('0xd')](function(_0x4b2c30){_0x2bbd38=_0x4b2c30;if(_0x4b2c30){if(_0x4b2c30[_0x6a1f('0x42')]||_0x4b2c30[_0x6a1f('0x43')]){return db[_0x4b2c30[_0x6a1f('0x42')]?'VoiceQueue':_0x6a1f('0x44')]['find']({'where':{'id':_0x4b2c30[_0x6a1f('0x42')]?_0x4b2c30['VoiceQueueId']:_0x4b2c30['CampaignId']},'attributes':['id',_0x6a1f('0x11')],'raw':!![]});}}})[_0x6a1f('0xd')](function(_0x4d9667){var _0xcbe5f6={};if(_0x4d9667){_[_0x6a1f('0x33')](_0xcbe5f6,_[_0x6a1f('0x45')](_0x2bbd38['dataValues'],[_0x6a1f('0x46'),_0x6a1f('0x47'),'id']));_0xcbe5f6[_0x6a1f('0x48')]=0x15;_0xcbe5f6[_0x6a1f('0x49')]=_0x6a1f('0x4a');_0xcbe5f6[_0x6a1f('0x4b')]=_0x4d9667['name'];_0xcbe5f6[_0x6a1f('0x4c')]=_0x2bea1a[_0x6a1f('0x4d')][_0x6a1f('0x11')];_0xcbe5f6[_0x6a1f('0x4e')]=_0x2bea1a[_0x6a1f('0x4d')]['id'];_0xcbe5f6['deleted']=!![];_0xcbe5f6['deletedat']=moment()[_0x6a1f('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0xcbe5f6[_0x6a1f('0x50')]=_0x2bbd38[_0x6a1f('0x51')];_0xcbe5f6[_0x6a1f('0x52')]=_0x2bbd38[_0x6a1f('0x42')]?_0x6a1f('0x53'):'ivr';return db[_0x6a1f('0x54')]['find']({'where':{'id':_0xcbe5f6[_0x6a1f('0x55')]},'attributes':[_0x6a1f('0x56'),_0x6a1f('0x57')]})[_0x6a1f('0xd')](function(_0xdba6af){if(!_[_0x6a1f('0x58')](_0x34fa17)&&!_['isNil'](_0xdba6af[_0x6a1f('0x56')])){_0xcbe5f6['calleridname']=_0xdba6af['firstName'];if(!_['isNil'](_0xdba6af[_0x6a1f('0x57')])){_0xcbe5f6[_0x6a1f('0x59')]+='\x20'+_0xdba6af['lastName'];}}})[_0x6a1f('0x5a')](function(){return db[_0x6a1f('0x5b')][_0x6a1f('0x3e')](_0xcbe5f6);});}})['then'](function(_0x2c2bf7){return db['CmHopperAdditionalPhone'][_0x6a1f('0x41')]({'where':{'CmHopperId':_0x4657ec}});})[_0x6a1f('0xd')](function(){return _0x34fa17[_0x6a1f('0x12')](0xcc)['end']();})[_0x6a1f('0x39')](handleError(_0x34fa17,null));};exports[_0x6a1f('0x5c')]=function(_0x3e66af,_0x11ab69){var _0x1a313e=[];return db[_0x6a1f('0x54')][_0x6a1f('0x40')]()[_0x6a1f('0xd')](function(_0x1adf00){_0x1a313e=_[_0x6a1f('0x1b')](_0x1adf00);return _0x3e66af[_0x6a1f('0x4d')][_0x6a1f('0x5d')]({'where':{'type':_0x6a1f('0x5e'),'dialActive':!![],'dialMethod':_0x6a1f('0x5f')},'attributes':['id','dialOrderByScheduledAt',_0x6a1f('0x60')],'raw':!![]});})[_0x6a1f('0xd')](function(_0x4b2211){if(_0x4b2211&&_0x4b2211[_0x6a1f('0x2d')]){return db[_0x6a1f('0x61')][_0x6a1f('0x62')](function(_0x1b9a07){var _0x4322a4={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x6a1f('0x4f')](_0x6a1f('0x63'))},'VoiceQueueId':{'$in':_[_0x6a1f('0x14')](_0x4b2211,'id')},'$or':[{'UserId':null},{'UserId':_0x3e66af[_0x6a1f('0x4d')]['id']}]};var _0x547684={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x4b2211)[_0x6a1f('0x32')]([_0x6a1f('0x60'),0x0])['map']('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x3e66af[_0x6a1f('0x4d')]['id']}]};var _0x416e40={'$or':[_0x4322a4,_0x547684]};var _0x9b83af=[];if(_0x3e66af[_0x6a1f('0x3f')][_0x6a1f('0x64')]&&_0x3e66af[_0x6a1f('0x3f')][_0x6a1f('0x64')]===_0x6a1f('0x65')){if(!_['isEmpty'](_0x3e66af[_0x6a1f('0x3f')][_0x6a1f('0x66')])){_0x416e40['id']={'$in':_0x3e66af['body'][_0x6a1f('0x66')]};}_0x9b83af=[[_0x6a1f('0x67'),_0x6a1f('0x68')],[_0x6a1f('0x69'),_0x4b2211[0x0]['dialOrderByScheduledAt']===_0x6a1f('0x68')?_0x6a1f('0x6a'):'ASC'],db[_0x6a1f('0x61')][_0x6a1f('0x6b')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id','DESC']];}else{if(!_[_0x6a1f('0x6c')](_0x3e66af[_0x6a1f('0x3f')][_0x6a1f('0x66')])){_0x416e40['id']={'$notIn':_0x3e66af[_0x6a1f('0x3f')][_0x6a1f('0x66')]};}_0x9b83af=[[_0x6a1f('0x67'),_0x6a1f('0x6a')],['scheduledAt',_0x4b2211[0x0][_0x6a1f('0x6d')]],db[_0x6a1f('0x61')][_0x6a1f('0x6b')](_0x6a1f('0x6e')),['id',_0x6a1f('0x68')]];}return db[_0x6a1f('0x3c')]['findOne']({'attributes':['id',_0x6a1f('0x6f'),_0x6a1f('0x51'),_0x6a1f('0x70')],'where':_0x416e40,'order':_0x9b83af,'transaction':_0x1b9a07,'lock':_0x1b9a07[_0x6a1f('0x71')][_0x6a1f('0x72')],'include':[{'model':db[_0x6a1f('0x54')],'as':_0x6a1f('0x73'),'attributes':_0x1a313e,'include':[{'model':db[_0x6a1f('0x74')],'as':_0x6a1f('0x75'),'attributes':['id',_0x6a1f('0x11')]}]},{'model':db[_0x6a1f('0x76')],'as':_0x6a1f('0x77'),'attributes':['id','name']},{'model':db[_0x6a1f('0x78')],'as':_0x6a1f('0x79'),'attributes':['id',_0x6a1f('0x11'),_0x6a1f('0x7a')]}]})[_0x6a1f('0xd')](function(_0x3af935){if(_0x3af935){return _0x3af935[_0x6a1f('0xc')]({'UserId':_0x3e66af[_0x6a1f('0x4d')]['id']},{'transaction':_0x1b9a07});}});});}})[_0x6a1f('0xd')](handleEntityNotFound(_0x11ab69,null))[_0x6a1f('0xd')](respondWithResult(_0x11ab69,null))[_0x6a1f('0x39')](handleError(_0x11ab69,null));};exports[_0x6a1f('0x7b')]=function(_0x280f9a,_0x2ef531,_0x514e06){var _0x2b661a=[];var _0x5759ee=_0x280f9a['params']['id'];var _0x90aff7=_0x280f9a['user']['id'];return db['CmContact']['describe']()['then'](function(_0xa50b90){_0x2b661a=_[_0x6a1f('0x1b')](_0xa50b90);return db[_0x6a1f('0x61')][_0x6a1f('0x62')](function(_0x311e61){const _0xdef032={'id':_0x5759ee};return db[_0x6a1f('0x3c')][_0x6a1f('0x7c')]({'attributes':['id',_0x6a1f('0x6f'),_0x6a1f('0x70')],'where':_0xdef032,'transaction':_0x311e61,'lock':_0x311e61[_0x6a1f('0x71')][_0x6a1f('0x72')],'include':[{'model':db['CmContact'],'as':_0x6a1f('0x73'),'attributes':_0x2b661a,'include':[{'model':db['CmCompany'],'as':_0x6a1f('0x75'),'attributes':['id','name']}]},{'model':db[_0x6a1f('0x76')],'as':_0x6a1f('0x77'),'attributes':['id','name']},{'model':db[_0x6a1f('0x78')],'as':_0x6a1f('0x79'),'attributes':['id','name','dialActive']}]})[_0x6a1f('0xd')](function(_0x170005){if(_0x170005){return _0x170005[_0x6a1f('0xc')]({'UserId':_0x90aff7},{'transaction':_0x311e61});}});});})[_0x6a1f('0xd')](handleEntityNotFound(_0x2ef531,null))[_0x6a1f('0xd')](respondWithResult(_0x2ef531,null))[_0x6a1f('0x39')](handleError(_0x2ef531,null));};exports['getOpenContacts']=function(_0x555acd,_0x4e6815){return _0x555acd['user']['getVoiceQueues']({'where':{'type':_0x6a1f('0x5e'),'dialActive':!![],'dialMethod':_0x6a1f('0x5f')},'attributes':['id'],'raw':!![]})[_0x6a1f('0xd')](function(_0x266d36){if(_0x266d36&&_0x266d36[_0x6a1f('0x2d')]){return db[_0x6a1f('0x3c')][_0x6a1f('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x6a1f('0x4f')](_0x6a1f('0x63'))},'VoiceQueueId':{'$in':_[_0x6a1f('0x14')](_0x266d36,'id')},'$or':[{'UserId':null},{'UserId':_0x555acd['user']['id']}]}});}return 0x0;})['then'](function(_0x1275f7){if(!_[_0x6a1f('0x58')](_0x1275f7)&&_['isNumber'](_0x1275f7)){return _0x4e6815[_0x6a1f('0x12')](0xc8)['json']({'contacts':_0x1275f7});}else{logger['error'](_0x6a1f('0x7d'),_0x6a1f('0x7e'),0x194,_0x6a1f('0x7f'));_0x4e6815[_0x6a1f('0xe')](0x194);}})[_0x6a1f('0x39')](handleError(_0x4e6815,null));};exports[_0x6a1f('0x80')]=function(_0x3e0978,_0x19a821){var _0x52ae3f=shared['timezones'];var _0x969c9d=[];_[_0x6a1f('0x14')](_0x52ae3f,function(_0x482b93){_0x969c9d[_0x6a1f('0x81')]({'id':_0x482b93[_0x6a1f('0x11')],'name':_0x482b93['name'],'utcOffset':_0x482b93[_0x6a1f('0x82')]});});return _0x19a821[_0x6a1f('0x12')](0xc8)[_0x6a1f('0x6')]({'tz':_0x969c9d});};exports[_0x6a1f('0x83')]=function(_0xd2fe96,_0x23c662){var _0x5e088c=shared['timezones'];var _0x2f09e6={};if(!_[_0x6a1f('0x58')](_0x5e088c[_0xd2fe96[_0x6a1f('0x3f')]['id']]))_0x2f09e6=_0x5e088c[_0xd2fe96[_0x6a1f('0x3f')]['id']];return _0x23c662[_0x6a1f('0x12')](0xc8)['json'](_0x2f09e6);}; \ No newline at end of file +var _0xf006=['where','filter','merge','VIRTUAL','options','then','include','findAll','rows','catch','params','length','includeAll','find','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','deletedat','format','calleridnum','phone','campaigntype','queue','CmContact','firstName','lastName','isNil','calleridname','CmHopperAdditionalPhone','getPreview','outbound','dialOrderByScheduledAt','dialPreviewAutoRecallMe','transaction','direction','hopperIds','priority','ASC','scheduledAt','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','isEmpty','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','recallme','LOCK','UPDATE','CmCompany','Company','CmList','List','Queue','dialActive','getPreviewRecall','scheduledat','preview','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','../../components/parsers/qs','../../config/logger','../../config/environment','status','json','offset','undefined','limit','count','set','Content-Range','update','sendStatus','error','stack','name','map','CmHopper','rawAttributes','fieldName','type','query','keys','filters','intersection','model','concat','$and','$gt','$gte','$lt','$ne','$not','$notBetween','$in','$notIn','$like','$notLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','sort'];(function(_0x4a782b,_0x55584a){var _0x5cb5a0=function(_0x3010ed){while(--_0x3010ed){_0x4a782b['push'](_0x4a782b['shift']());}};_0x5cb5a0(++_0x55584a);}(_0xf006,0x146));var _0x6f00=function(_0x47811d,_0x943776){_0x47811d=_0x47811d-0x0;var _0x5750df=_0xf006[_0x47811d];return _0x5750df;};'use strict';var moment=require('moment');var _=require('lodash');var qs=require(_0x6f00('0x0'));var logger=require(_0x6f00('0x1'))('api');var shared=require(_0x6f00('0x2'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x1c7a9e,_0x4f4466){_0x4f4466=_0x4f4466||0xc8;return function(_0x5039fb){if(_0x5039fb){return _0x1c7a9e[_0x6f00('0x3')](_0x4f4466)[_0x6f00('0x4')](_0x5039fb);}};}function respondWithFilteredResult(_0x141e71,_0x52c9a2){return function(_0x3c29ff){if(_0x3c29ff){var _0x4f918f=typeof _0x52c9a2[_0x6f00('0x5')]===_0x6f00('0x6')&&typeof _0x52c9a2[_0x6f00('0x7')]===_0x6f00('0x6');var _0x286d32=_0x3c29ff[_0x6f00('0x8')];var _0x44b63c=_0x4f918f?0x0:_0x52c9a2[_0x6f00('0x5')];var _0x2aa181=_0x4f918f?_0x3c29ff[_0x6f00('0x8')]:_0x52c9a2[_0x6f00('0x5')]+_0x52c9a2[_0x6f00('0x7')];var _0x723e6e;if(_0x2aa181>=_0x286d32){_0x2aa181=_0x286d32;_0x723e6e=0xc8;}else{_0x723e6e=0xce;}_0x141e71['status'](_0x723e6e);return _0x141e71[_0x6f00('0x9')](_0x6f00('0xa'),_0x44b63c+'-'+_0x2aa181+'/'+_0x286d32)[_0x6f00('0x4')](_0x3c29ff);}return null;};}function saveUpdates(_0x36a2ec,_0x289fe9){return function(_0x5e3264){if(_0x5e3264){return _0x5e3264[_0x6f00('0xb')](_0x36a2ec)['then'](function(_0x30b10e){return _0x30b10e;});}return null;};}function handleEntityNotFound(_0x5047f5,_0x324e67){return function(_0x220e68){if(!_0x220e68){_0x5047f5[_0x6f00('0xc')](0x194);}return _0x220e68;};}function handleError(_0x33f3a2,_0xa6e7a1){_0xa6e7a1=_0xa6e7a1||0x1f4;return function(_0x411203){logger[_0x6f00('0xd')](_0x411203[_0x6f00('0xe')]);if(_0x411203[_0x6f00('0xf')]){delete _0x411203['name'];}_0x33f3a2[_0x6f00('0x3')](_0xa6e7a1)['send'](_0x411203);};}exports['index']=function(_0x7c047e,_0x6cf83f){var _0x466c7c={},_0x340f78={},_0x13f09f={'count':0x0,'rows':[]};var _0x27e466=_[_0x6f00('0x10')](db[_0x6f00('0x11')][_0x6f00('0x12')],function(_0x198cc7){return{'name':_0x198cc7[_0x6f00('0x13')],'type':_0x198cc7[_0x6f00('0x14')]['key']};});_0x340f78['model']=_['map'](_0x27e466,_0x6f00('0xf'));_0x340f78[_0x6f00('0x15')]=_[_0x6f00('0x16')](_0x7c047e['query']);_0x340f78[_0x6f00('0x17')]=_[_0x6f00('0x18')](_0x340f78[_0x6f00('0x19')],_0x340f78[_0x6f00('0x15')]);_0x340f78[_0x6f00('0x17')]=_[_0x6f00('0x1a')](_0x340f78[_0x6f00('0x17')],[_0x6f00('0x1b'),'$or',_0x6f00('0x1c'),_0x6f00('0x1d'),_0x6f00('0x1e'),'$lte',_0x6f00('0x1f'),'$eq',_0x6f00('0x20'),'$between',_0x6f00('0x21'),_0x6f00('0x22'),_0x6f00('0x23'),_0x6f00('0x24'),_0x6f00('0x25'),'$iLike',_0x6f00('0x26'),_0x6f00('0x24'),_0x6f00('0x27'),_0x6f00('0x28'),_0x6f00('0x29'),_0x6f00('0x2a')]);_0x466c7c[_0x6f00('0x2b')]=_[_0x6f00('0x18')](_0x340f78[_0x6f00('0x19')],qs[_0x6f00('0x2c')](_0x7c047e[_0x6f00('0x15')][_0x6f00('0x2c')]));_0x466c7c[_0x6f00('0x2b')]=_0x466c7c[_0x6f00('0x2b')]['length']?_0x466c7c['attributes']:_0x340f78['model'];if(!_0x7c047e['query']['hasOwnProperty']('nolimit')){_0x466c7c[_0x6f00('0x7')]=qs['limit'](_0x7c047e[_0x6f00('0x15')][_0x6f00('0x7')]);_0x466c7c[_0x6f00('0x5')]=qs[_0x6f00('0x5')](_0x7c047e[_0x6f00('0x15')][_0x6f00('0x5')]);}_0x466c7c['order']=qs[_0x6f00('0x2d')](_0x7c047e[_0x6f00('0x15')][_0x6f00('0x2d')]);_0x466c7c[_0x6f00('0x2e')]=qs[_0x6f00('0x17')](_['pick'](_0x7c047e['query'],_0x340f78['filters']),_0x27e466);if(_0x7c047e[_0x6f00('0x15')][_0x6f00('0x2f')]){_0x466c7c[_0x6f00('0x2e')]=_[_0x6f00('0x30')](_0x466c7c[_0x6f00('0x2e')],{'$or':_['map'](_0x27e466,function(_0xf6f5e9){if(_0xf6f5e9[_0x6f00('0x14')]!==_0x6f00('0x31')){var _0x4646dc={};_0x4646dc[_0xf6f5e9[_0x6f00('0xf')]]={'$like':'%'+_0x7c047e[_0x6f00('0x15')][_0x6f00('0x2f')]+'%'};return _0x4646dc;}})});}_0x466c7c=_['merge']({},_0x466c7c,_0x7c047e[_0x6f00('0x32')]);var _0x1dee52={'where':_0x466c7c[_0x6f00('0x2e')]};return db['CmHopper'][_0x6f00('0x8')](_0x1dee52)[_0x6f00('0x33')](function(_0x2da2e7){_0x13f09f['count']=_0x2da2e7;if(_0x7c047e[_0x6f00('0x15')]['includeAll']){_0x466c7c[_0x6f00('0x34')]=[{'all':!![]}];}return db['CmHopper'][_0x6f00('0x35')](_0x466c7c);})[_0x6f00('0x33')](function(_0x37c791){_0x13f09f[_0x6f00('0x36')]=_0x37c791;return _0x13f09f;})['then'](respondWithFilteredResult(_0x6cf83f,_0x466c7c))[_0x6f00('0x37')](handleError(_0x6cf83f,null));};exports['show']=function(_0x231bd6,_0x5bc755){var _0x7785e1={'raw':!![],'where':{'id':_0x231bd6[_0x6f00('0x38')]['id']}},_0x2f1ef1={};_0x2f1ef1[_0x6f00('0x19')]=_['keys'](db['CmHopper'][_0x6f00('0x12')]);_0x2f1ef1['query']=_[_0x6f00('0x16')](_0x231bd6[_0x6f00('0x15')]);_0x2f1ef1['filters']=_[_0x6f00('0x18')](_0x2f1ef1['model'],_0x2f1ef1['query']);_0x7785e1[_0x6f00('0x2b')]=_[_0x6f00('0x18')](_0x2f1ef1[_0x6f00('0x19')],qs[_0x6f00('0x2c')](_0x231bd6['query'][_0x6f00('0x2c')]));_0x7785e1[_0x6f00('0x2b')]=_0x7785e1[_0x6f00('0x2b')][_0x6f00('0x39')]?_0x7785e1[_0x6f00('0x2b')]:_0x2f1ef1[_0x6f00('0x19')];if(_0x231bd6['query'][_0x6f00('0x3a')]){_0x7785e1[_0x6f00('0x34')]=[{'all':!![]}];}_0x7785e1=_[_0x6f00('0x30')]({},_0x7785e1,_0x231bd6[_0x6f00('0x32')]);return db[_0x6f00('0x11')][_0x6f00('0x3b')](_0x7785e1)['then'](handleEntityNotFound(_0x5bc755,null))[_0x6f00('0x33')](respondWithResult(_0x5bc755,null))[_0x6f00('0x37')](handleError(_0x5bc755,null));};exports[_0x6f00('0x3c')]=function(_0x56b7e6,_0x2e6cc6){return db['CmHopper'][_0x6f00('0x3c')](_0x56b7e6[_0x6f00('0x3d')],{})['then'](respondWithResult(_0x2e6cc6,0xc9))[_0x6f00('0x37')](handleError(_0x2e6cc6,null));};exports['update']=function(_0xadd6d8,_0x3d4158){if(_0xadd6d8[_0x6f00('0x3d')]['id']){delete _0xadd6d8[_0x6f00('0x3d')]['id'];}return db['CmHopper'][_0x6f00('0x3b')]({'where':{'id':_0xadd6d8['params']['id']}})[_0x6f00('0x33')](handleEntityNotFound(_0x3d4158,null))['then'](saveUpdates(_0xadd6d8[_0x6f00('0x3d')],null))[_0x6f00('0x33')](respondWithResult(_0x3d4158,null))[_0x6f00('0x37')](handleError(_0x3d4158,null));};exports[_0x6f00('0x3e')]=function(_0x470ff3,_0x3472f0){return db[_0x6f00('0x11')][_0x6f00('0x3e')]()['then'](respondWithResult(_0x3472f0,null))[_0x6f00('0x37')](handleError(_0x3472f0,null));};exports['destroy']=function(_0x265666,_0x31fb17){var _0x27f38b;var _0x5eec08=_0x265666['params']['id'];return db[_0x6f00('0x11')][_0x6f00('0x3b')]({'where':{'id':_0x265666['params']['id']}})[_0x6f00('0x33')](handleEntityNotFound(_0x31fb17,null))['then'](function(_0x28130d){if(_0x28130d){return _0x28130d['destroy']()[_0x6f00('0x33')](function(_0x222b4c){return _0x222b4c;});}})['then'](function(_0x52ee5a){_0x27f38b=_0x52ee5a;if(_0x52ee5a){if(_0x52ee5a[_0x6f00('0x3f')]||_0x52ee5a[_0x6f00('0x40')]){return db[_0x52ee5a['VoiceQueueId']?_0x6f00('0x41'):'Campaign'][_0x6f00('0x3b')]({'where':{'id':_0x52ee5a[_0x6f00('0x3f')]?_0x52ee5a[_0x6f00('0x3f')]:_0x52ee5a[_0x6f00('0x40')]},'attributes':['id',_0x6f00('0xf')],'raw':!![]});}}})[_0x6f00('0x33')](function(_0x25b284){var _0x9933be={};if(_0x25b284){_[_0x6f00('0x30')](_0x9933be,_[_0x6f00('0x42')](_0x27f38b[_0x6f00('0x43')],[_0x6f00('0x44'),_0x6f00('0x45'),'id']));_0x9933be[_0x6f00('0x46')]=0x15;_0x9933be[_0x6f00('0x47')]=_0x6f00('0x48');_0x9933be[_0x6f00('0x49')]=_0x25b284[_0x6f00('0xf')];_0x9933be[_0x6f00('0x4a')]=_0x265666[_0x6f00('0x4b')]['name'];_0x9933be['UserId']=_0x265666[_0x6f00('0x4b')]['id'];_0x9933be['deleted']=!![];_0x9933be[_0x6f00('0x4c')]=moment()[_0x6f00('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x9933be[_0x6f00('0x4e')]=_0x27f38b[_0x6f00('0x4f')];_0x9933be[_0x6f00('0x50')]=_0x27f38b['VoiceQueueId']?_0x6f00('0x51'):'ivr';return db[_0x6f00('0x52')][_0x6f00('0x3b')]({'where':{'id':_0x9933be['ContactId']},'attributes':[_0x6f00('0x53'),_0x6f00('0x54')]})[_0x6f00('0x33')](function(_0x111fd4){if(!_[_0x6f00('0x55')](_0x31fb17)&&!_[_0x6f00('0x55')](_0x111fd4[_0x6f00('0x53')])){_0x9933be['calleridname']=_0x111fd4['firstName'];if(!_['isNil'](_0x111fd4['lastName'])){_0x9933be[_0x6f00('0x56')]+='\x20'+_0x111fd4[_0x6f00('0x54')];}}})['finally'](function(){return db['CmHopperFinal'][_0x6f00('0x3c')](_0x9933be);});}})[_0x6f00('0x33')](function(_0x33bee1){return db[_0x6f00('0x57')]['destroy']({'where':{'CmHopperId':_0x5eec08}});})[_0x6f00('0x33')](function(){return _0x31fb17['status'](0xcc)['end']();})[_0x6f00('0x37')](handleError(_0x31fb17,null));};exports[_0x6f00('0x58')]=function(_0x754f94,_0x11082f){var _0x24c6c4=[];return db['CmContact'][_0x6f00('0x3e')]()[_0x6f00('0x33')](function(_0x41a9b9){_0x24c6c4=_[_0x6f00('0x16')](_0x41a9b9);return _0x754f94['user']['getVoiceQueues']({'where':{'type':_0x6f00('0x59'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x6f00('0x5a'),_0x6f00('0x5b')],'raw':!![]});})[_0x6f00('0x33')](function(_0x13de6a){if(_0x13de6a&&_0x13de6a['length']){return db['sequelize'][_0x6f00('0x5c')](function(_0x2fcee0){var _0x4ff6dc={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x6f00('0x4d')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x6f00('0x10')](_0x13de6a,'id')},'$or':[{'UserId':null},{'UserId':_0x754f94[_0x6f00('0x4b')]['id']}]};var _0x2b2334={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x13de6a)[_0x6f00('0x2f')]([_0x6f00('0x5b'),0x0])['map']('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x754f94['user']['id']}]};var _0x1e4ae3={'$or':[_0x4ff6dc,_0x2b2334]};var _0x3ca0af=[];if(_0x754f94['body']['direction']&&_0x754f94[_0x6f00('0x3d')][_0x6f00('0x5d')]==='prev'){if(!_['isEmpty'](_0x754f94[_0x6f00('0x3d')][_0x6f00('0x5e')])){_0x1e4ae3['id']={'$in':_0x754f94[_0x6f00('0x3d')][_0x6f00('0x5e')]};}_0x3ca0af=[[_0x6f00('0x5f'),_0x6f00('0x60')],[_0x6f00('0x61'),_0x13de6a[0x0][_0x6f00('0x5a')]==='ASC'?'DESC':_0x6f00('0x60')],db[_0x6f00('0x62')][_0x6f00('0x63')](_0x6f00('0x64')),['id',_0x6f00('0x65')]];}else{if(!_[_0x6f00('0x66')](_0x754f94[_0x6f00('0x3d')][_0x6f00('0x5e')])){_0x1e4ae3['id']={'$notIn':_0x754f94[_0x6f00('0x3d')][_0x6f00('0x5e')]};}_0x3ca0af=[[_0x6f00('0x5f'),_0x6f00('0x65')],[_0x6f00('0x61'),_0x13de6a[0x0][_0x6f00('0x5a')]],db[_0x6f00('0x62')][_0x6f00('0x63')](_0x6f00('0x67')),['id','ASC']];}return db['CmHopper'][_0x6f00('0x68')]({'attributes':['id','scheduledat',_0x6f00('0x4f'),_0x6f00('0x69')],'where':_0x1e4ae3,'order':_0x3ca0af,'transaction':_0x2fcee0,'lock':_0x2fcee0[_0x6f00('0x6a')][_0x6f00('0x6b')],'include':[{'model':db[_0x6f00('0x52')],'as':'Contact','attributes':_0x24c6c4,'include':[{'model':db[_0x6f00('0x6c')],'as':_0x6f00('0x6d'),'attributes':['id',_0x6f00('0xf')]}]},{'model':db[_0x6f00('0x6e')],'as':_0x6f00('0x6f'),'attributes':['id',_0x6f00('0xf')]},{'model':db[_0x6f00('0x41')],'as':_0x6f00('0x70'),'attributes':['id',_0x6f00('0xf'),_0x6f00('0x71')]}]})[_0x6f00('0x33')](function(_0x58a7b8){if(_0x58a7b8){return _0x58a7b8[_0x6f00('0xb')]({'UserId':_0x754f94[_0x6f00('0x4b')]['id']},{'transaction':_0x2fcee0});}});});}})[_0x6f00('0x33')](handleEntityNotFound(_0x11082f,null))['then'](respondWithResult(_0x11082f,null))['catch'](handleError(_0x11082f,null));};exports[_0x6f00('0x72')]=function(_0x23c20f,_0x1e5182,_0x1d24d0){var _0x5a9b42=[];var _0x564625=_0x23c20f['params']['id'];var _0x5089a5=_0x23c20f[_0x6f00('0x4b')]['id'];return db[_0x6f00('0x52')][_0x6f00('0x3e')]()[_0x6f00('0x33')](function(_0x3ba557){_0x5a9b42=_['keys'](_0x3ba557);return db[_0x6f00('0x62')][_0x6f00('0x5c')](function(_0x538143){const _0xf8a1b6={'id':_0x564625};return db[_0x6f00('0x11')][_0x6f00('0x68')]({'attributes':['id',_0x6f00('0x73'),_0x6f00('0x69')],'where':_0xf8a1b6,'transaction':_0x538143,'lock':_0x538143[_0x6f00('0x6a')][_0x6f00('0x6b')],'include':[{'model':db[_0x6f00('0x52')],'as':'Contact','attributes':_0x5a9b42,'include':[{'model':db[_0x6f00('0x6c')],'as':'Company','attributes':['id',_0x6f00('0xf')]}]},{'model':db[_0x6f00('0x6e')],'as':_0x6f00('0x6f'),'attributes':['id',_0x6f00('0xf')]},{'model':db[_0x6f00('0x41')],'as':_0x6f00('0x70'),'attributes':['id',_0x6f00('0xf'),_0x6f00('0x71')]}]})[_0x6f00('0x33')](function(_0x1c2685){if(_0x1c2685){return _0x1c2685[_0x6f00('0xb')]({'UserId':_0x5089a5},{'transaction':_0x538143});}});});})[_0x6f00('0x33')](handleEntityNotFound(_0x1e5182,null))[_0x6f00('0x33')](respondWithResult(_0x1e5182,null))[_0x6f00('0x37')](handleError(_0x1e5182,null));};exports['getOpenContacts']=function(_0x3ba021,_0xdfa8ff){return _0x3ba021[_0x6f00('0x4b')]['getVoiceQueues']({'where':{'type':_0x6f00('0x59'),'dialActive':!![],'dialMethod':_0x6f00('0x74')},'attributes':['id'],'raw':!![]})['then'](function(_0x30f620){if(_0x30f620&&_0x30f620[_0x6f00('0x39')]){return db[_0x6f00('0x11')][_0x6f00('0x8')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x30f620,'id')},'$or':[{'UserId':null},{'UserId':_0x3ba021[_0x6f00('0x4b')]['id']}]}});}return 0x0;})[_0x6f00('0x33')](function(_0x26fd77){if(!_[_0x6f00('0x55')](_0x26fd77)&&_['isNumber'](_0x26fd77)){return _0xdfa8ff[_0x6f00('0x3')](0xc8)[_0x6f00('0x4')]({'contacts':_0x26fd77});}else{logger[_0x6f00('0xd')](_0x6f00('0x75'),_0x6f00('0x76'),0x194,_0x6f00('0x77'));_0xdfa8ff['sendStatus'](0x194);}})['catch'](handleError(_0xdfa8ff,null));};exports[_0x6f00('0x78')]=function(_0x179fb7,_0x2f97cd){var _0x1abd35=shared[_0x6f00('0x79')];var _0x4c9db7=[];_[_0x6f00('0x10')](_0x1abd35,function(_0x5e4928){_0x4c9db7[_0x6f00('0x7a')]({'id':_0x5e4928[_0x6f00('0xf')],'name':_0x5e4928['name'],'utcOffset':_0x5e4928[_0x6f00('0x7b')]});});return _0x2f97cd[_0x6f00('0x3')](0xc8)['json']({'tz':_0x4c9db7});};exports['getTimezone']=function(_0x340f76,_0x422649){var _0x25d7da=shared[_0x6f00('0x79')];var _0x1fb213={};if(!_[_0x6f00('0x55')](_0x25d7da[_0x340f76[_0x6f00('0x3d')]['id']]))_0x1fb213=_0x25d7da[_0x340f76['body']['id']];return _0x422649[_0x6f00('0x3')](0xc8)[_0x6f00('0x4')](_0x1fb213);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 9844328..9832322 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 _0xc4aa=['define','CmHopper','cm_hopper','phone','priority','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./cmHopper.attributes','exports'];(function(_0x5841c2,_0x950a5a){var _0xbdf541=function(_0x2ba293){while(--_0x2ba293){_0x5841c2['push'](_0x5841c2['shift']());}};_0xbdf541(++_0x950a5a);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xc4aa[_0x2070da];return _0x4f9fe1;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':['scheduledat']},{'name':_0xac4a('0xc'),'fields':[_0xac4a('0xc')]},{'name':_0xac4a('0xd'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2eb2=['request-promise','rimraf','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','util','../../config/logger','api','moment','bluebird'];(function(_0x1bc6a3,_0x471120){var _0x4484e0=function(_0x4b5e36){while(--_0x4b5e36){_0x1bc6a3['push'](_0x1bc6a3['shift']());}};_0x4484e0(++_0x471120);}(_0x2eb2,0x19f));var _0x22eb=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x2eb2[_0x311c35];return _0x5cc50c;};'use strict';var _=require('lodash');var util=require(_0x22eb('0x0'));var logger=require(_0x22eb('0x1'))(_0x22eb('0x2'));var moment=require(_0x22eb('0x3'));var BPromise=require(_0x22eb('0x4'));var rp=require(_0x22eb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x22eb('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopper.attributes');module[_0x22eb('0x7')]=function(_0x10e116,_0x35dd5b){return _0x10e116[_0x22eb('0x8')](_0x22eb('0x9'),attributes,{'tableName':_0x22eb('0xa'),'paranoid':![],'indexes':[{'name':_0x22eb('0xb'),'fields':[_0x22eb('0xb')]},{'name':_0x22eb('0xc'),'fields':[_0x22eb('0xc')]},{'name':_0x22eb('0xd'),'fields':[_0x22eb('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index afb60c1..dfaa33a 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 _0x2032=['ShowCmHopper','find','where','debug','catch','CreateCmHopper','body','active','UpdateCmHopper','destroy','DestroyCmHopper','GetContactDialer','describe','sequelize','transaction','order','LOCK','UPDATE','keys','User','Agent','name','voicePause','length','UserId','includes','push','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','update','CmContact','Contact','GetContactByPhone','findOne','phone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','\x20MINUTE','List','NOW()','util','moment','bluebird','../../config/logger','rpc','CmHopper','findAll','options','raw','limit','map','include','model','attributes','then','info','GetCmHopper','stringify','error','message'];(function(_0x513047,_0x2199c5){var _0x15b779=function(_0x412fd5){while(--_0x412fd5){_0x513047['push'](_0x513047['shift']());}};_0x15b779(++_0x2199c5);}(_0x2032,0xd9));var _0x2203=function(_0x234563,_0x5945da){_0x234563=_0x234563-0x0;var _0x28bb6a=_0x2032[_0x234563];return _0x28bb6a;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var BPromise=require(_0x2203('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x2203('0x3'))(_0x2203('0x4'));exports['GetCmHopper']=function(_0x46c49a){var _0x880dcd=this;return new Promise(function(_0x44ccfd,_0x201796){return db[_0x2203('0x5')][_0x2203('0x6')]({'raw':_0x46c49a[_0x2203('0x7')]?_0x46c49a[_0x2203('0x7')][_0x2203('0x8')]===undefined?!![]:![]:!![],'where':_0x46c49a[_0x2203('0x7')]?_0x46c49a[_0x2203('0x7')]['where']||null:null,'attributes':_0x46c49a['options']?_0x46c49a[_0x2203('0x7')]['attributes']||null:null,'limit':_0x46c49a[_0x2203('0x7')]?_0x46c49a[_0x2203('0x7')][_0x2203('0x9')]||null:null,'include':_0x46c49a['options']?_0x46c49a[_0x2203('0x7')]['include']?_[_0x2203('0xa')](_0x46c49a['options'][_0x2203('0xb')],function(_0x1abb51){return{'model':db[_0x1abb51['model']],'as':_0x1abb51['as'],'attributes':_0x1abb51['attributes'],'include':_0x1abb51['include']?_['map'](_0x1abb51['include'],function(_0x238772){return{'model':db[_0x238772['model']],'as':_0x238772['as'],'attributes':_0x238772['attributes'],'include':_0x238772[_0x2203('0xb')]?_[_0x2203('0xa')](_0x238772[_0x2203('0xb')],function(_0x41af85){return{'model':db[_0x41af85[_0x2203('0xc')]],'as':_0x41af85['as'],'attributes':_0x41af85[_0x2203('0xd')]};}):[]};}):[]};}):[]:[]})[_0x2203('0xe')](function(_0x2c085c){logger[_0x2203('0xf')](_0x2203('0x10'),_0x46c49a);logger['debug'](_0x2203('0x10'),_0x46c49a,JSON[_0x2203('0x11')](_0x2c085c));_0x44ccfd(_0x2c085c);})['catch'](function(_0x3f9ef6){logger[_0x2203('0x12')]('GetCmHopper',_0x3f9ef6[_0x2203('0x13')],_0x46c49a);_0x201796(_0x880dcd['error'](0x1f4,_0x3f9ef6[_0x2203('0x13')]));});});};exports[_0x2203('0x14')]=function(_0x3c8c34){var _0x3b4034=this;return new Promise(function(_0x15cb1a,_0x449039){return db['CmHopper'][_0x2203('0x15')]({'raw':_0x3c8c34['options']?_0x3c8c34['options'][_0x2203('0x8')]===undefined?!![]:![]:!![],'where':_0x3c8c34['options']?_0x3c8c34[_0x2203('0x7')][_0x2203('0x16')]||null:null,'attributes':_0x3c8c34['options']?_0x3c8c34[_0x2203('0x7')]['attributes']||null:null,'include':_0x3c8c34['options']?_0x3c8c34[_0x2203('0x7')][_0x2203('0xb')]?_[_0x2203('0xa')](_0x3c8c34[_0x2203('0x7')][_0x2203('0xb')],function(_0x3114ef){return{'model':db[_0x3114ef[_0x2203('0xc')]],'as':_0x3114ef['as'],'attributes':_0x3114ef[_0x2203('0xd')],'include':_0x3114ef['include']?_[_0x2203('0xa')](_0x3114ef[_0x2203('0xb')],function(_0x39a11a){return{'model':db[_0x39a11a['model']],'as':_0x39a11a['as'],'attributes':_0x39a11a[_0x2203('0xd')],'include':_0x39a11a[_0x2203('0xb')]?_['map'](_0x39a11a[_0x2203('0xb')],function(_0xd91f5d){return{'model':db[_0xd91f5d[_0x2203('0xc')]],'as':_0xd91f5d['as'],'attributes':_0xd91f5d[_0x2203('0xd')]};}):[]};}):[]};}):[]:[]})[_0x2203('0xe')](function(_0x1df508){logger[_0x2203('0xf')]('ShowCmHopper',_0x3c8c34);logger[_0x2203('0x17')](_0x2203('0x14'),_0x3c8c34,JSON[_0x2203('0x11')](_0x1df508));_0x15cb1a(_0x1df508);})[_0x2203('0x18')](function(_0x52a426){logger[_0x2203('0x12')](_0x2203('0x14'),_0x52a426[_0x2203('0x13')],_0x3c8c34);_0x449039(_0x3b4034[_0x2203('0x12')](0x1f4,_0x52a426['message']));});});};exports[_0x2203('0x19')]=function(_0x50aa17){var _0x5e6560=this;return new Promise(function(_0x5c0157,_0x1d5f74){return db['CmHopper']['create'](_0x50aa17[_0x2203('0x1a')],{'raw':_0x50aa17[_0x2203('0x7')]?_0x50aa17[_0x2203('0x7')][_0x2203('0x8')]===undefined?!![]:![]:!![]})[_0x2203('0xe')](function(_0x5ac74b){logger[_0x2203('0xf')](_0x2203('0x19'),_0x50aa17);logger['debug'](_0x2203('0x19'),_0x50aa17,JSON[_0x2203('0x11')](_0x5ac74b));_0x5c0157(_0x5ac74b);})[_0x2203('0x18')](function(_0x4187b4){logger[_0x2203('0x12')](_0x2203('0x19'),_0x4187b4[_0x2203('0x13')],_0x50aa17);_0x1d5f74(_0x5e6560[_0x2203('0x12')](0x1f4,_0x4187b4[_0x2203('0x13')]));});});};exports['UpdateCmHopper']=function(_0x15c0ad){var _0x347d3e=this;return new Promise(function(_0x56f9b2,_0x54b90b){return db[_0x2203('0x5')]['update'](_0x15c0ad[_0x2203('0x1a')],{'raw':_0x15c0ad[_0x2203('0x7')]?_0x15c0ad[_0x2203('0x7')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15c0ad['options']?_0x15c0ad[_0x2203('0x7')]['where']||null:null,'attributes':_0x15c0ad[_0x2203('0x7')]?_0x15c0ad['options'][_0x2203('0xd')]||null:null,'limit':_0x15c0ad['options']?_0x15c0ad[_0x2203('0x7')][_0x2203('0x9')]||null:null})[_0x2203('0xe')](function(_0x40a793){logger[_0x2203('0xf')]('UpdateCmHopper',_0x15c0ad);logger['info']('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x2203('0x11')](_0x15c0ad[_0x2203('0x7')][_0x2203('0x16')]),_0x15c0ad[_0x2203('0x1a')][_0x2203('0x1b')]);logger[_0x2203('0x17')](_0x2203('0x1c'),_0x15c0ad,JSON['stringify'](_0x40a793));_0x56f9b2(_0x40a793);})[_0x2203('0x18')](function(_0x1b12c3){logger[_0x2203('0x12')](_0x2203('0x1c'),_0x1b12c3['message'],_0x15c0ad);_0x54b90b(_0x347d3e['error'](0x1f4,_0x1b12c3[_0x2203('0x13')]));});});};exports['DestroyCmHopper']=function(_0x330303){var _0x446209=this;return new Promise(function(_0x132091,_0x548e06){return db['CmHopper'][_0x2203('0x1d')]({'where':_0x330303[_0x2203('0x7')]?_0x330303[_0x2203('0x7')][_0x2203('0x16')]||null:null})[_0x2203('0xe')](function(_0x1fa734){logger['info'](_0x2203('0x1e'),_0x330303);logger[_0x2203('0x17')](_0x2203('0x1e'),_0x330303,JSON[_0x2203('0x11')](_0x1fa734));_0x132091(_0x1fa734);})[_0x2203('0x18')](function(_0x36b99f){logger[_0x2203('0x12')](_0x2203('0x1e'),_0x36b99f[_0x2203('0x13')],_0x330303);_0x548e06(_0x446209[_0x2203('0x12')](0x1f4,_0x36b99f['message']));});});};exports[_0x2203('0x1f')]=function(_0x24e773){var _0x4aab80=this;return new Promise(function(_0x3b9981,_0x4c3259){return db['CmContact'][_0x2203('0x20')]()['then'](function(_0x273e5f){return db[_0x2203('0x21')][_0x2203('0x22')](function(_0x35dba9){return db['CmHopper'][_0x2203('0x6')]({'where':_0x24e773[_0x2203('0x7')]?_0x24e773['options'][_0x2203('0x16')]||null:null,'attributes':_0x24e773[_0x2203('0x7')]?_0x24e773[_0x2203('0x7')][_0x2203('0xd')]||null:null,'limit':_0x24e773['options']?_0x24e773['options'][_0x2203('0x9')]||null:null,'order':_0x24e773['options']?_0x24e773['options'][_0x2203('0x23')]||null:null,'transaction':_0x35dba9,'lock':_0x35dba9[_0x2203('0x24')][_0x2203('0x25')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_[_0x2203('0x26')](_0x273e5f)},{'model':db[_0x2203('0x27')],'as':_0x2203('0x28'),'attributes':['id',_0x2203('0x29'),_0x2203('0x2a')]}]})[_0x2203('0xe')](function(_0x4a7f4e){var _0x747dce=[];var _0x557659=[];for(var _0x3f7685=0x0;_0x3f7685<_0x4a7f4e[_0x2203('0x2b')];_0x3f7685+=0x1){var _0x246aff=_0x4a7f4e[_0x3f7685][_0x2203('0x2c')];if(_0x246aff===null){_0x747dce['push'](_0x4a7f4e[_0x3f7685]['update'](_0x24e773[_0x2203('0x1a')],{'transaction':_0x35dba9}));}else if(!_0x557659[_0x2203('0x2d')](_0x246aff)){_0x557659[_0x2203('0x2e')](_0x246aff);_0x747dce[_0x2203('0x2e')](_0x4a7f4e[_0x3f7685]['update'](_0x24e773['body'],{'transaction':_0x35dba9}));}}return BPromise['all'](_0x747dce);});})[_0x2203('0xe')](function(_0x1c2734){logger['info'](_0x2203('0x1f'),_0x24e773);if(_0x1c2734[_0x2203('0x2b')]>0x0){logger['info'](_0x2203('0x2f'),_0x1c2734[0x0][_0x2203('0x30')]['id'],_0x1c2734[0x0][_0x2203('0x30')][_0x2203('0x31')],_0x1c2734[0x0]['dataValues'][_0x2203('0x1b')]);}logger['debug'](_0x2203('0x1f'),_0x24e773,JSON[_0x2203('0x11')](_0x1c2734));_0x3b9981(_0x1c2734);})['catch'](function(_0x428b18){logger[_0x2203('0x12')](_0x2203('0x1f'),_0x428b18[_0x2203('0x13')],_0x24e773);_0x4c3259(_0x4aab80[_0x2203('0x12')](0x1f4,_0x428b18[_0x2203('0x13')]));});});});};exports['MoveContactManagedDialer']=function(_0x562a3d){var _0x2f2537=this;return new Promise(function(_0x524356,_0x56e881){return db[_0x2203('0x21')][_0x2203('0x22')](function(_0x14e5d9){return db['CmHopperFinal'][_0x2203('0x32')](_0x562a3d['body'],{'raw':_0x562a3d['options']?_0x562a3d[_0x2203('0x7')]['raw']===undefined?!![]:![]:!![],'transaction':_0x14e5d9})['then'](function(){logger['info'](_0x2203('0x33'),JSON[_0x2203('0x11')](_0x562a3d[_0x2203('0x7')][_0x2203('0x16')]),_0x562a3d[_0x2203('0x7')][_0x2203('0x16')][_0x2203('0x1b')]);return db[_0x2203('0x5')][_0x2203('0x1d')]({'where':_0x562a3d[_0x2203('0x7')]?_0x562a3d[_0x2203('0x7')][_0x2203('0x16')]||null:null,'transaction':_0x14e5d9});});})['then'](function(_0x585bde){logger[_0x2203('0xf')](_0x2203('0x34'),_0x562a3d);logger[_0x2203('0x17')](_0x2203('0x34'),_0x562a3d,JSON[_0x2203('0x11')](_0x585bde));_0x524356(_0x585bde);})[_0x2203('0x18')](function(_0x4f8b8e){logger['error'](_0x2203('0x34'),_0x4f8b8e[_0x2203('0x13')],_0x562a3d);_0x56e881(_0x2f2537[_0x2203('0x12')](0x1f4,_0x4f8b8e[_0x2203('0x13')]));});});};exports[_0x2203('0x35')]=function(_0x7b0b9c){var _0x133d22=this;return new Promise(function(_0x191b67,_0x2c6bcc){return db[_0x2203('0x5')][_0x2203('0x6')]({'raw':_0x7b0b9c['options']?_0x7b0b9c[_0x2203('0x7')][_0x2203('0x8')]===undefined?!![]:![]:!![],'where':_0x7b0b9c[_0x2203('0x7')]?_0x7b0b9c[_0x2203('0x7')][_0x2203('0x16')]||null:null,'attributes':[[db[_0x2203('0x21')]['fn'](_0x2203('0x36'),db[_0x2203('0x21')]['fn']('IF',db[_0x2203('0x21')][_0x2203('0x37')](_0x2203('0x38')+util[_0x2203('0x39')](_0x2203('0x3a'),moment()[_0x2203('0x39')](_0x2203('0x3b')))+_0x2203('0x3c')))),_0x2203('0x3d')]]})[_0x2203('0xe')](function(_0x8a9282){logger[_0x2203('0xf')]('CountReScheduled',_0x7b0b9c);logger[_0x2203('0x17')](_0x2203('0x35'),_0x7b0b9c,JSON[_0x2203('0x11')](_0x8a9282));_0x191b67(_0x8a9282);})['catch'](function(_0x68855d){logger[_0x2203('0x12')](_0x2203('0x35'),_0x68855d[_0x2203('0x13')],_0x7b0b9c);_0x2c6bcc(_0x133d22[_0x2203('0x12')](0x1f4,_0x68855d['message']));});});};exports[_0x2203('0x3e')]=function(_0x11243d){var _0x1c63bf=this;return new Promise(function(_0x4dde80,_0x5507b6){return db['CmContact']['describe']()['then'](function(){return db[_0x2203('0x21')][_0x2203('0x22')](function(_0x27dd95){return db[_0x2203('0x5')][_0x2203('0x6')]({'where':_0x11243d[_0x2203('0x7')]?_0x11243d[_0x2203('0x7')][_0x2203('0x16')]||null:null,'attributes':_0x11243d['options']?_0x11243d['options'][_0x2203('0xd')]||null:null,'limit':0x1,'order':_0x11243d[_0x2203('0x7')]?_0x11243d[_0x2203('0x7')][_0x2203('0x23')]||null:null,'group':db[_0x2203('0x5')][_0x2203('0x2c')],'transaction':_0x27dd95,'lock':_0x27dd95[_0x2203('0x24')][_0x2203('0x25')],'include':_0x11243d[_0x2203('0x7')]?_0x11243d[_0x2203('0x7')][_0x2203('0xb')]?_[_0x2203('0xa')](_0x11243d[_0x2203('0x7')][_0x2203('0xb')],function(_0x288786){return{'model':db[_0x288786[_0x2203('0xc')]],'as':_0x288786['as'],'attributes':_0x288786[_0x2203('0xd')],'include':_0x288786[_0x2203('0xb')]?_[_0x2203('0xa')](_0x288786['include'],function(_0x4232c5){return{'model':db[_0x4232c5['model']],'as':_0x4232c5['as'],'attributes':_0x4232c5[_0x2203('0xd')],'include':_0x4232c5['include']?_[_0x2203('0xa')](_0x4232c5[_0x2203('0xb')],function(_0x269649){return{'model':db[_0x269649[_0x2203('0xc')]],'as':_0x269649['as'],'attributes':_0x269649[_0x2203('0xd')]};}):[]};}):[]};}):[]:[]})[_0x2203('0xe')](function(_0x3e1583){var _0x2eab08=[];for(var _0x4e9a01=0x0;_0x4e9a01<_0x3e1583['length'];_0x4e9a01+=0x1){_0x2eab08[_0x2203('0x2e')](_0x3e1583[_0x4e9a01][_0x2203('0x3f')](_0x11243d[_0x2203('0x1a')],{'transaction':_0x27dd95}));}return BPromise['all'](_0x2eab08);});})['then'](function(_0x54878d){logger[_0x2203('0xf')](_0x2203('0x3e'),_0x11243d);logger[_0x2203('0x17')](_0x2203('0x3e'),_0x11243d,JSON['stringify'](_0x54878d));_0x4dde80(_0x54878d);})[_0x2203('0x18')](function(_0x47a2c7){logger[_0x2203('0x12')](_0x2203('0x3e'),_0x47a2c7[_0x2203('0x13')],_0x11243d);_0x5507b6(_0x1c63bf[_0x2203('0x12')](0x1f4,_0x47a2c7[_0x2203('0x13')]));});});});};exports['GetCmHopperPreview']=function(_0x4592fa){var _0x247f26=this;return new Promise(function(_0x18663f,_0x4a5f15){db[_0x2203('0x40')][_0x2203('0x20')]()[_0x2203('0xe')](function(_0xd76624){return db[_0x2203('0x5')][_0x2203('0x6')]({'raw':_0x4592fa[_0x2203('0x7')]?_0x4592fa[_0x2203('0x7')][_0x2203('0x8')]===undefined?!![]:![]:!![],'where':_0x4592fa[_0x2203('0x7')]?_0x4592fa[_0x2203('0x7')]['where']||null:null,'attributes':_0x4592fa[_0x2203('0x7')]?_0x4592fa[_0x2203('0x7')][_0x2203('0xd')]||null:null,'limit':_0x4592fa[_0x2203('0x7')]?_0x4592fa[_0x2203('0x7')][_0x2203('0x9')]||null:null,'include':_0x4592fa[_0x2203('0x7')]?_0x4592fa[_0x2203('0x7')][_0x2203('0xb')]?_[_0x2203('0xa')](_0x4592fa[_0x2203('0x7')][_0x2203('0xb')],function(_0x4c332f){return{'model':db[_0x4c332f['model']],'as':_0x4c332f['as'],'attributes':_0x4c332f['as']===_0x2203('0x41')?_[_0x2203('0x26')](_0xd76624):_0x4c332f[_0x2203('0xd')],'include':_0x4c332f[_0x2203('0xb')]?_[_0x2203('0xa')](_0x4c332f['include'],function(_0x16e518){return{'model':db[_0x16e518[_0x2203('0xc')]],'as':_0x16e518['as'],'attributes':_0x16e518['attributes'],'include':_0x16e518['include']?_['map'](_0x16e518['include'],function(_0x5e07d7){return{'model':db[_0x5e07d7[_0x2203('0xc')]],'as':_0x5e07d7['as'],'attributes':_0x5e07d7[_0x2203('0xd')]};}):[]};}):[]};}):[]:[]})[_0x2203('0xe')](function(_0x49fd02){logger['info']('GetCmHopper',_0x4592fa);logger[_0x2203('0x17')](_0x2203('0x10'),_0x4592fa,JSON[_0x2203('0x11')](_0x49fd02));_0x18663f(_0x49fd02);})[_0x2203('0x18')](function(_0x369728){logger[_0x2203('0x12')](_0x2203('0x10'),_0x369728['message'],_0x4592fa);_0x4a5f15(_0x247f26[_0x2203('0x12')](0x1f4,_0x369728[_0x2203('0x13')]));});});});};exports[_0x2203('0x42')]=function(_0x3c3bb4){var _0x35ff6b=this;return new Promise(function(_0x35d508,_0x13e11f){return db['CmContact'][_0x2203('0x43')]({'raw':!![],'where':{'phone':_0x3c3bb4['options']['where'][_0x2203('0x44')]},'attributes':['id','dialTimezone'],'order':[['id',_0x2203('0x45')]]})[_0x2203('0xe')](function(_0x4c7ea2){logger[_0x2203('0xf')](_0x2203('0x46'),_0x3c3bb4);logger[_0x2203('0x17')](_0x2203('0x46'),_0x3c3bb4,JSON[_0x2203('0x11')](_0x4c7ea2));_0x35d508(_0x4c7ea2);})[_0x2203('0x18')](function(_0x4cca59){logger[_0x2203('0x12')](_0x2203('0x46'),_0x4cca59['message'],_0x3c3bb4);_0x13e11f(_0x35ff6b['error'](0x1f4,_0x4cca59[_0x2203('0x13')]));});});};exports[_0x2203('0x47')]=function(_0x383d3e){var _0xa88b4f=this;return new Promise(function(_0x416b38,_0x29d9de){return db[_0x2203('0x21')][_0x2203('0x22')](function(_0x4749df){var _0x2bfa45=_0x383d3e[_0x2203('0x7')]&&_0x383d3e[_0x2203('0x7')][_0x2203('0x16')]?_0x383d3e[_0x2203('0x7')][_0x2203('0x16')]:{};return db[_0x2203('0x5')]['update'](_0x383d3e['body'],{'where':_0x2bfa45,'transaction':_0x4749df})[_0x2203('0xe')](function(_0x1295a3){logger['info'](_0x2203('0x47'),_0x383d3e);logger[_0x2203('0x17')]('ResetActiveCalls',_0x383d3e,JSON[_0x2203('0x11')](_0x1295a3));_0x416b38(_0x1295a3);})[_0x2203('0x18')](function(_0x57ccf8){logger[_0x2203('0x12')](_0x2203('0x47'),_0x57ccf8['message'],_0x383d3e);_0x29d9de(_0xa88b4f[_0x2203('0x12')](0x1f4,_0x57ccf8[_0x2203('0x13')]));});});});};exports[_0x2203('0x48')]=function(_0x1596f7){var _0x4c735c=this;var _0x511c66=_0x1596f7[_0x2203('0x1a')][_0x2203('0x16')][_0x2203('0x49')];var _0x4ff77f=_0x1596f7['body'][_0x2203('0x16')][_0x2203('0x4a')];var _0x22cafb=_0x1596f7['body']['where'][_0x2203('0x4b')];return new Promise(function(_0x348ce6,_0x54fe33){return db[_0x2203('0x5')][_0x2203('0x6')]({'where':{'voiceQueueId':{'$in':_0x511c66},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize'][_0x2203('0x37')]('NOW()\x20+\x20INTERVAL\x20'+_0x4ff77f+_0x2203('0x4c')),'$gt':db['sequelize']['literal']('NOW()')}},'UserId':{'$in':_0x22cafb}},'include':[{'model':db[_0x2203('0x40')],'as':_0x2203('0x41')},{'model':db['User'],'as':_0x2203('0x28'),'attributes':['id',_0x2203('0x29'),_0x2203('0x2a')]},{'model':db['CmList'],'as':_0x2203('0x4d')}]})['then'](function(_0x3f31e0){if(_0x3f31e0[_0x2203('0x2b')]>0x0){return db['sequelize'][_0x2203('0x22')](function(_0x4096f4){return db['CmHopper'][_0x2203('0x3f')]({'recallmeNotifiedDate':db[_0x2203('0x21')][_0x2203('0x37')](_0x2203('0x4e'))},{'where':{'id':{'$in':_[_0x2203('0xa')](_0x3f31e0,'id')}},'transaction':_0x4096f4})['then'](function(){_0x348ce6(_0x3f31e0);})[_0x2203('0x18')](function(_0x1b5185){logger[_0x2203('0x12')](_0x2203('0x48'),_0x1b5185[_0x2203('0x13')],_0x1596f7);_0x54fe33(_0x4c735c[_0x2203('0x12')](0x1f4,_0x1b5185['message']));});})[_0x2203('0x18')](function(_0x2cb9a4){logger['error'](_0x2203('0x48'),_0x2cb9a4['message'],_0x1596f7);_0x54fe33(_0x4c735c[_0x2203('0x12')](0x1f4,_0x2cb9a4[_0x2203('0x13')]));});}else{_0x348ce6(_0x3f31e0);}});});}; \ No newline at end of file +var _0x1b1d=['ContactId','GetContactDialer','MoveContactManagedDialer','sequelize','CmHopperFinal','create','CountReScheduled','format','\x22%s\x22','contactsRescheduled','GetContactRecallMe','describe','order','LOCK','length','GetCmHopperPreview','keys','GetContactByPhone','findOne','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','voiceQueueIds','availableAgentsIds','literal','\x20MINUTE','voicePause','CmList','List','NOW()','CmHopperHandlePreviewRecallNotifications','lodash','util','moment','bluebird','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','attributes','limit','map','include','model','then','info','debug','stringify','catch','error','ShowCmHopper','find','raw','where','message','CreateCmHopper','body','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','CmContact','transaction','UPDATE','Contact','User','Agent','name','includes','push','all','dataValues'];(function(_0x493ce8,_0xac6510){var _0x5d7cb7=function(_0x10b3a8){while(--_0x10b3a8){_0x493ce8['push'](_0x493ce8['shift']());}};_0x5d7cb7(++_0xac6510);}(_0x1b1d,0x19c));var _0xd1b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1b1d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd1b1('0x0'));var util=require(_0xd1b1('0x1'));var moment=require(_0xd1b1('0x2'));var BPromise=require(_0xd1b1('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xd1b1('0x4'))(_0xd1b1('0x5'));exports[_0xd1b1('0x6')]=function(_0x98c138){var _0xf717a1=this;return new Promise(function(_0x246c9c,_0x546d7e){return db[_0xd1b1('0x7')][_0xd1b1('0x8')]({'raw':_0x98c138[_0xd1b1('0x9')]?_0x98c138['options']['raw']===undefined?!![]:![]:!![],'where':_0x98c138['options']?_0x98c138[_0xd1b1('0x9')]['where']||null:null,'attributes':_0x98c138[_0xd1b1('0x9')]?_0x98c138['options'][_0xd1b1('0xa')]||null:null,'limit':_0x98c138[_0xd1b1('0x9')]?_0x98c138['options'][_0xd1b1('0xb')]||null:null,'include':_0x98c138['options']?_0x98c138[_0xd1b1('0x9')]['include']?_[_0xd1b1('0xc')](_0x98c138[_0xd1b1('0x9')][_0xd1b1('0xd')],function(_0x488af8){return{'model':db[_0x488af8[_0xd1b1('0xe')]],'as':_0x488af8['as'],'attributes':_0x488af8[_0xd1b1('0xa')],'include':_0x488af8['include']?_['map'](_0x488af8[_0xd1b1('0xd')],function(_0x744b9f){return{'model':db[_0x744b9f['model']],'as':_0x744b9f['as'],'attributes':_0x744b9f[_0xd1b1('0xa')],'include':_0x744b9f[_0xd1b1('0xd')]?_[_0xd1b1('0xc')](_0x744b9f[_0xd1b1('0xd')],function(_0x4a4455){return{'model':db[_0x4a4455[_0xd1b1('0xe')]],'as':_0x4a4455['as'],'attributes':_0x4a4455[_0xd1b1('0xa')]};}):[]};}):[]};}):[]:[]})[_0xd1b1('0xf')](function(_0x1f366a){logger[_0xd1b1('0x10')](_0xd1b1('0x6'),_0x98c138);logger[_0xd1b1('0x11')](_0xd1b1('0x6'),_0x98c138,JSON[_0xd1b1('0x12')](_0x1f366a));_0x246c9c(_0x1f366a);})[_0xd1b1('0x13')](function(_0x171b1f){logger[_0xd1b1('0x14')](_0xd1b1('0x6'),_0x171b1f['message'],_0x98c138);_0x546d7e(_0xf717a1['error'](0x1f4,_0x171b1f['message']));});});};exports[_0xd1b1('0x15')]=function(_0x1ba1e7){var _0x3b4704=this;return new Promise(function(_0x54517f,_0x3e2d95){return db[_0xd1b1('0x7')][_0xd1b1('0x16')]({'raw':_0x1ba1e7['options']?_0x1ba1e7[_0xd1b1('0x9')][_0xd1b1('0x17')]===undefined?!![]:![]:!![],'where':_0x1ba1e7['options']?_0x1ba1e7[_0xd1b1('0x9')][_0xd1b1('0x18')]||null:null,'attributes':_0x1ba1e7[_0xd1b1('0x9')]?_0x1ba1e7[_0xd1b1('0x9')]['attributes']||null:null,'include':_0x1ba1e7[_0xd1b1('0x9')]?_0x1ba1e7[_0xd1b1('0x9')][_0xd1b1('0xd')]?_[_0xd1b1('0xc')](_0x1ba1e7[_0xd1b1('0x9')]['include'],function(_0x5990be){return{'model':db[_0x5990be[_0xd1b1('0xe')]],'as':_0x5990be['as'],'attributes':_0x5990be[_0xd1b1('0xa')],'include':_0x5990be[_0xd1b1('0xd')]?_[_0xd1b1('0xc')](_0x5990be[_0xd1b1('0xd')],function(_0x339a8e){return{'model':db[_0x339a8e[_0xd1b1('0xe')]],'as':_0x339a8e['as'],'attributes':_0x339a8e[_0xd1b1('0xa')],'include':_0x339a8e['include']?_['map'](_0x339a8e[_0xd1b1('0xd')],function(_0x213225){return{'model':db[_0x213225[_0xd1b1('0xe')]],'as':_0x213225['as'],'attributes':_0x213225[_0xd1b1('0xa')]};}):[]};}):[]};}):[]:[]})[_0xd1b1('0xf')](function(_0x5e64d8){logger['info'](_0xd1b1('0x15'),_0x1ba1e7);logger[_0xd1b1('0x11')](_0xd1b1('0x15'),_0x1ba1e7,JSON[_0xd1b1('0x12')](_0x5e64d8));_0x54517f(_0x5e64d8);})['catch'](function(_0x4a4f4b){logger[_0xd1b1('0x14')](_0xd1b1('0x15'),_0x4a4f4b[_0xd1b1('0x19')],_0x1ba1e7);_0x3e2d95(_0x3b4704[_0xd1b1('0x14')](0x1f4,_0x4a4f4b[_0xd1b1('0x19')]));});});};exports[_0xd1b1('0x1a')]=function(_0x1caeb2){var _0x9ccc59=this;return new Promise(function(_0x2eaab6,_0x35815d){return db['CmHopper']['create'](_0x1caeb2[_0xd1b1('0x1b')],{'raw':_0x1caeb2[_0xd1b1('0x9')]?_0x1caeb2['options'][_0xd1b1('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x1c06df){logger[_0xd1b1('0x10')]('CreateCmHopper',_0x1caeb2);logger[_0xd1b1('0x11')](_0xd1b1('0x1a'),_0x1caeb2,JSON['stringify'](_0x1c06df));_0x2eaab6(_0x1c06df);})[_0xd1b1('0x13')](function(_0x3b98c4){logger[_0xd1b1('0x14')](_0xd1b1('0x1a'),_0x3b98c4[_0xd1b1('0x19')],_0x1caeb2);_0x35815d(_0x9ccc59[_0xd1b1('0x14')](0x1f4,_0x3b98c4['message']));});});};exports[_0xd1b1('0x1c')]=function(_0x319325){var _0x9f53c4=this;return new Promise(function(_0x19a99e,_0x5d314e){return db[_0xd1b1('0x7')][_0xd1b1('0x1d')](_0x319325[_0xd1b1('0x1b')],{'raw':_0x319325[_0xd1b1('0x9')]?_0x319325[_0xd1b1('0x9')][_0xd1b1('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x319325['options']?_0x319325[_0xd1b1('0x9')][_0xd1b1('0x18')]||null:null,'attributes':_0x319325[_0xd1b1('0x9')]?_0x319325[_0xd1b1('0x9')][_0xd1b1('0xa')]||null:null,'limit':_0x319325[_0xd1b1('0x9')]?_0x319325[_0xd1b1('0x9')][_0xd1b1('0xb')]||null:null})[_0xd1b1('0xf')](function(_0x5e21a7){logger[_0xd1b1('0x10')](_0xd1b1('0x1c'),_0x319325);logger['info'](_0xd1b1('0x1e'),JSON[_0xd1b1('0x12')](_0x319325['options'][_0xd1b1('0x18')]),_0x319325[_0xd1b1('0x1b')][_0xd1b1('0x1f')]);logger[_0xd1b1('0x11')](_0xd1b1('0x1c'),_0x319325,JSON[_0xd1b1('0x12')](_0x5e21a7));_0x19a99e(_0x5e21a7);})['catch'](function(_0x34b873){logger[_0xd1b1('0x14')](_0xd1b1('0x1c'),_0x34b873['message'],_0x319325);_0x5d314e(_0x9f53c4[_0xd1b1('0x14')](0x1f4,_0x34b873[_0xd1b1('0x19')]));});});};exports[_0xd1b1('0x20')]=function(_0x740022){var _0x4e067b=this;return new Promise(function(_0x341073,_0x40602a){return db['CmHopper']['destroy']({'where':_0x740022[_0xd1b1('0x9')]?_0x740022[_0xd1b1('0x9')][_0xd1b1('0x18')]||null:null})[_0xd1b1('0xf')](function(_0x575f25){logger[_0xd1b1('0x10')]('DestroyCmHopper',_0x740022);logger['debug'](_0xd1b1('0x20'),_0x740022,JSON[_0xd1b1('0x12')](_0x575f25));_0x341073(_0x575f25);})[_0xd1b1('0x13')](function(_0x319020){logger[_0xd1b1('0x14')]('DestroyCmHopper',_0x319020[_0xd1b1('0x19')],_0x740022);_0x40602a(_0x4e067b[_0xd1b1('0x14')](0x1f4,_0x319020[_0xd1b1('0x19')]));});});};exports['GetContactDialer']=function(_0x32e95f){var _0x7338bc=this;return new Promise(function(_0x7e86a5,_0x2ab772){return db[_0xd1b1('0x21')]['describe']()[_0xd1b1('0xf')](function(_0x41eeb7){return db['sequelize'][_0xd1b1('0x22')](function(_0x12fbd0){return db[_0xd1b1('0x7')][_0xd1b1('0x8')]({'where':_0x32e95f[_0xd1b1('0x9')]?_0x32e95f[_0xd1b1('0x9')]['where']||null:null,'attributes':_0x32e95f[_0xd1b1('0x9')]?_0x32e95f[_0xd1b1('0x9')][_0xd1b1('0xa')]||null:null,'limit':_0x32e95f[_0xd1b1('0x9')]?_0x32e95f[_0xd1b1('0x9')][_0xd1b1('0xb')]||null:null,'order':_0x32e95f[_0xd1b1('0x9')]?_0x32e95f['options']['order']||null:null,'transaction':_0x12fbd0,'lock':_0x12fbd0['LOCK'][_0xd1b1('0x23')],'include':[{'model':db[_0xd1b1('0x21')],'as':_0xd1b1('0x24'),'attributes':_['keys'](_0x41eeb7)},{'model':db[_0xd1b1('0x25')],'as':_0xd1b1('0x26'),'attributes':['id',_0xd1b1('0x27'),'voicePause']}]})[_0xd1b1('0xf')](function(_0x3b404c){var _0x2e16d6=[];var _0xb21b04=[];for(var _0x2473ad=0x0;_0x2473ad<_0x3b404c['length'];_0x2473ad+=0x1){var _0xdb1bc8=_0x3b404c[_0x2473ad]['UserId'];if(_0xdb1bc8===null){_0x2e16d6['push'](_0x3b404c[_0x2473ad][_0xd1b1('0x1d')](_0x32e95f[_0xd1b1('0x1b')],{'transaction':_0x12fbd0}));}else if(!_0xb21b04[_0xd1b1('0x28')](_0xdb1bc8)){_0xb21b04[_0xd1b1('0x29')](_0xdb1bc8);_0x2e16d6[_0xd1b1('0x29')](_0x3b404c[_0x2473ad]['update'](_0x32e95f[_0xd1b1('0x1b')],{'transaction':_0x12fbd0}));}}return BPromise[_0xd1b1('0x2a')](_0x2e16d6);});})[_0xd1b1('0xf')](function(_0x21f2dc){logger['info']('GetContactDialer',_0x32e95f);if(_0x21f2dc['length']>0x0){logger[_0xd1b1('0x10')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x21f2dc[0x0][_0xd1b1('0x2b')]['id'],_0x21f2dc[0x0]['dataValues'][_0xd1b1('0x2c')],_0x21f2dc[0x0][_0xd1b1('0x2b')][_0xd1b1('0x1f')]);}logger['debug'](_0xd1b1('0x2d'),_0x32e95f,JSON[_0xd1b1('0x12')](_0x21f2dc));_0x7e86a5(_0x21f2dc);})[_0xd1b1('0x13')](function(_0x17c614){logger[_0xd1b1('0x14')](_0xd1b1('0x2d'),_0x17c614[_0xd1b1('0x19')],_0x32e95f);_0x2ab772(_0x7338bc['error'](0x1f4,_0x17c614[_0xd1b1('0x19')]));});});});};exports[_0xd1b1('0x2e')]=function(_0x1f1b8d){var _0x306ea2=this;return new Promise(function(_0x5e8a66,_0xc76a1d){return db[_0xd1b1('0x2f')][_0xd1b1('0x22')](function(_0x2e4845){return db[_0xd1b1('0x30')][_0xd1b1('0x31')](_0x1f1b8d[_0xd1b1('0x1b')],{'raw':_0x1f1b8d['options']?_0x1f1b8d['options'][_0xd1b1('0x17')]===undefined?!![]:![]:!![],'transaction':_0x2e4845})[_0xd1b1('0xf')](function(){logger[_0xd1b1('0x10')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xd1b1('0x12')](_0x1f1b8d['options']['where']),_0x1f1b8d[_0xd1b1('0x9')][_0xd1b1('0x18')][_0xd1b1('0x1f')]);return db[_0xd1b1('0x7')]['destroy']({'where':_0x1f1b8d[_0xd1b1('0x9')]?_0x1f1b8d[_0xd1b1('0x9')][_0xd1b1('0x18')]||null:null,'transaction':_0x2e4845});});})[_0xd1b1('0xf')](function(_0x3bfbd1){logger[_0xd1b1('0x10')](_0xd1b1('0x2e'),_0x1f1b8d);logger[_0xd1b1('0x11')]('MoveContactManagedDialer',_0x1f1b8d,JSON[_0xd1b1('0x12')](_0x3bfbd1));_0x5e8a66(_0x3bfbd1);})[_0xd1b1('0x13')](function(_0x1d7bcc){logger[_0xd1b1('0x14')](_0xd1b1('0x2e'),_0x1d7bcc[_0xd1b1('0x19')],_0x1f1b8d);_0xc76a1d(_0x306ea2[_0xd1b1('0x14')](0x1f4,_0x1d7bcc[_0xd1b1('0x19')]));});});};exports[_0xd1b1('0x32')]=function(_0x3000c0){var _0x5e0a82=this;return new Promise(function(_0x5f1841,_0x470203){return db[_0xd1b1('0x7')][_0xd1b1('0x8')]({'raw':_0x3000c0[_0xd1b1('0x9')]?_0x3000c0[_0xd1b1('0x9')][_0xd1b1('0x17')]===undefined?!![]:![]:!![],'where':_0x3000c0[_0xd1b1('0x9')]?_0x3000c0['options'][_0xd1b1('0x18')]||null:null,'attributes':[[db[_0xd1b1('0x2f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xd1b1('0x2f')]['literal']('`scheduledat`\x20>=\x20'+util[_0xd1b1('0x33')](_0xd1b1('0x34'),moment()[_0xd1b1('0x33')]('YYYY-MM-DD\x20HH:mm:ss'))+'\x20,\x201,\x20null'))),_0xd1b1('0x35')]]})[_0xd1b1('0xf')](function(_0x572d35){logger[_0xd1b1('0x10')](_0xd1b1('0x32'),_0x3000c0);logger[_0xd1b1('0x11')](_0xd1b1('0x32'),_0x3000c0,JSON[_0xd1b1('0x12')](_0x572d35));_0x5f1841(_0x572d35);})[_0xd1b1('0x13')](function(_0x275e1a){logger[_0xd1b1('0x14')](_0xd1b1('0x32'),_0x275e1a[_0xd1b1('0x19')],_0x3000c0);_0x470203(_0x5e0a82['error'](0x1f4,_0x275e1a['message']));});});};exports[_0xd1b1('0x36')]=function(_0x1d92ab){var _0x3623d1=this;return new Promise(function(_0x4a83c4,_0x2bd3f4){return db[_0xd1b1('0x21')][_0xd1b1('0x37')]()['then'](function(){return db[_0xd1b1('0x2f')][_0xd1b1('0x22')](function(_0x3866f2){return db[_0xd1b1('0x7')][_0xd1b1('0x8')]({'where':_0x1d92ab[_0xd1b1('0x9')]?_0x1d92ab['options'][_0xd1b1('0x18')]||null:null,'attributes':_0x1d92ab[_0xd1b1('0x9')]?_0x1d92ab['options'][_0xd1b1('0xa')]||null:null,'limit':0x1,'order':_0x1d92ab[_0xd1b1('0x9')]?_0x1d92ab[_0xd1b1('0x9')][_0xd1b1('0x38')]||null:null,'group':db[_0xd1b1('0x7')]['UserId'],'transaction':_0x3866f2,'lock':_0x3866f2[_0xd1b1('0x39')]['UPDATE'],'include':_0x1d92ab[_0xd1b1('0x9')]?_0x1d92ab['options'][_0xd1b1('0xd')]?_['map'](_0x1d92ab['options'][_0xd1b1('0xd')],function(_0x106bfd){return{'model':db[_0x106bfd['model']],'as':_0x106bfd['as'],'attributes':_0x106bfd['attributes'],'include':_0x106bfd['include']?_[_0xd1b1('0xc')](_0x106bfd[_0xd1b1('0xd')],function(_0x1fbafb){return{'model':db[_0x1fbafb[_0xd1b1('0xe')]],'as':_0x1fbafb['as'],'attributes':_0x1fbafb[_0xd1b1('0xa')],'include':_0x1fbafb['include']?_[_0xd1b1('0xc')](_0x1fbafb[_0xd1b1('0xd')],function(_0x3bfe94){return{'model':db[_0x3bfe94[_0xd1b1('0xe')]],'as':_0x3bfe94['as'],'attributes':_0x3bfe94[_0xd1b1('0xa')]};}):[]};}):[]};}):[]:[]})[_0xd1b1('0xf')](function(_0x36da23){var _0x1b0338=[];for(var _0x295851=0x0;_0x295851<_0x36da23[_0xd1b1('0x3a')];_0x295851+=0x1){_0x1b0338[_0xd1b1('0x29')](_0x36da23[_0x295851][_0xd1b1('0x1d')](_0x1d92ab[_0xd1b1('0x1b')],{'transaction':_0x3866f2}));}return BPromise[_0xd1b1('0x2a')](_0x1b0338);});})[_0xd1b1('0xf')](function(_0x504124){logger[_0xd1b1('0x10')](_0xd1b1('0x36'),_0x1d92ab);logger[_0xd1b1('0x11')]('GetContactRecallMe',_0x1d92ab,JSON[_0xd1b1('0x12')](_0x504124));_0x4a83c4(_0x504124);})['catch'](function(_0x301f0d){logger['error'](_0xd1b1('0x36'),_0x301f0d['message'],_0x1d92ab);_0x2bd3f4(_0x3623d1[_0xd1b1('0x14')](0x1f4,_0x301f0d[_0xd1b1('0x19')]));});});});};exports[_0xd1b1('0x3b')]=function(_0x12df81){var _0x483a7a=this;return new Promise(function(_0x2cfc9f,_0x56c63c){db[_0xd1b1('0x21')][_0xd1b1('0x37')]()['then'](function(_0x2a304b){return db['CmHopper'][_0xd1b1('0x8')]({'raw':_0x12df81[_0xd1b1('0x9')]?_0x12df81[_0xd1b1('0x9')][_0xd1b1('0x17')]===undefined?!![]:![]:!![],'where':_0x12df81['options']?_0x12df81[_0xd1b1('0x9')]['where']||null:null,'attributes':_0x12df81[_0xd1b1('0x9')]?_0x12df81[_0xd1b1('0x9')][_0xd1b1('0xa')]||null:null,'limit':_0x12df81[_0xd1b1('0x9')]?_0x12df81[_0xd1b1('0x9')]['limit']||null:null,'include':_0x12df81['options']?_0x12df81[_0xd1b1('0x9')][_0xd1b1('0xd')]?_['map'](_0x12df81['options'][_0xd1b1('0xd')],function(_0x567877){return{'model':db[_0x567877['model']],'as':_0x567877['as'],'attributes':_0x567877['as']===_0xd1b1('0x24')?_[_0xd1b1('0x3c')](_0x2a304b):_0x567877['attributes'],'include':_0x567877['include']?_[_0xd1b1('0xc')](_0x567877['include'],function(_0x3d968d){return{'model':db[_0x3d968d[_0xd1b1('0xe')]],'as':_0x3d968d['as'],'attributes':_0x3d968d[_0xd1b1('0xa')],'include':_0x3d968d[_0xd1b1('0xd')]?_[_0xd1b1('0xc')](_0x3d968d[_0xd1b1('0xd')],function(_0x2f1823){return{'model':db[_0x2f1823['model']],'as':_0x2f1823['as'],'attributes':_0x2f1823[_0xd1b1('0xa')]};}):[]};}):[]};}):[]:[]})[_0xd1b1('0xf')](function(_0x27694f){logger[_0xd1b1('0x10')]('GetCmHopper',_0x12df81);logger[_0xd1b1('0x11')](_0xd1b1('0x6'),_0x12df81,JSON['stringify'](_0x27694f));_0x2cfc9f(_0x27694f);})[_0xd1b1('0x13')](function(_0x2f908d){logger[_0xd1b1('0x14')](_0xd1b1('0x6'),_0x2f908d['message'],_0x12df81);_0x56c63c(_0x483a7a[_0xd1b1('0x14')](0x1f4,_0x2f908d[_0xd1b1('0x19')]));});});});};exports[_0xd1b1('0x3d')]=function(_0x53e314){var _0x5873d4=this;return new Promise(function(_0x230990,_0x125b66){return db[_0xd1b1('0x21')][_0xd1b1('0x3e')]({'raw':!![],'where':{'phone':_0x53e314['options'][_0xd1b1('0x18')]['phone']},'attributes':['id',_0xd1b1('0x3f')],'order':[['id',_0xd1b1('0x40')]]})['then'](function(_0x3454cd){logger[_0xd1b1('0x10')]('getContactByPhone',_0x53e314);logger[_0xd1b1('0x11')](_0xd1b1('0x41'),_0x53e314,JSON['stringify'](_0x3454cd));_0x230990(_0x3454cd);})[_0xd1b1('0x13')](function(_0x3b119f){logger['error']('getContactByPhone',_0x3b119f[_0xd1b1('0x19')],_0x53e314);_0x125b66(_0x5873d4[_0xd1b1('0x14')](0x1f4,_0x3b119f['message']));});});};exports[_0xd1b1('0x42')]=function(_0x35f008){var _0x165a5c=this;return new Promise(function(_0x5bc477,_0x236e33){return db[_0xd1b1('0x2f')][_0xd1b1('0x22')](function(_0x2d9dd5){var _0x3f6ae4=_0x35f008['options']&&_0x35f008[_0xd1b1('0x9')][_0xd1b1('0x18')]?_0x35f008[_0xd1b1('0x9')][_0xd1b1('0x18')]:{};return db[_0xd1b1('0x7')][_0xd1b1('0x1d')](_0x35f008[_0xd1b1('0x1b')],{'where':_0x3f6ae4,'transaction':_0x2d9dd5})['then'](function(_0xec0821){logger[_0xd1b1('0x10')]('ResetActiveCalls',_0x35f008);logger[_0xd1b1('0x11')](_0xd1b1('0x42'),_0x35f008,JSON[_0xd1b1('0x12')](_0xec0821));_0x5bc477(_0xec0821);})['catch'](function(_0x599286){logger[_0xd1b1('0x14')](_0xd1b1('0x42'),_0x599286[_0xd1b1('0x19')],_0x35f008);_0x236e33(_0x165a5c['error'](0x1f4,_0x599286[_0xd1b1('0x19')]));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x1e0287){var _0x203c3=this;var _0x1d50dd=_0x1e0287['body'][_0xd1b1('0x18')][_0xd1b1('0x43')];var _0x1c9b62=_0x1e0287[_0xd1b1('0x1b')]['where']['interval'];var _0x845121=_0x1e0287[_0xd1b1('0x1b')][_0xd1b1('0x18')][_0xd1b1('0x44')];return new Promise(function(_0x57264d,_0x28477c){return db[_0xd1b1('0x7')][_0xd1b1('0x8')]({'where':{'voiceQueueId':{'$in':_0x1d50dd},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xd1b1('0x2f')][_0xd1b1('0x45')]('NOW()\x20+\x20INTERVAL\x20'+_0x1c9b62+_0xd1b1('0x46')),'$gt':db['sequelize'][_0xd1b1('0x45')]('NOW()')}},'UserId':{'$in':_0x845121}},'include':[{'model':db[_0xd1b1('0x21')],'as':'Contact'},{'model':db[_0xd1b1('0x25')],'as':_0xd1b1('0x26'),'attributes':['id',_0xd1b1('0x27'),_0xd1b1('0x47')]},{'model':db[_0xd1b1('0x48')],'as':_0xd1b1('0x49')}]})[_0xd1b1('0xf')](function(_0x425723){if(_0x425723[_0xd1b1('0x3a')]>0x0){return db[_0xd1b1('0x2f')][_0xd1b1('0x22')](function(_0x556de5){return db[_0xd1b1('0x7')]['update']({'recallmeNotifiedDate':db[_0xd1b1('0x2f')][_0xd1b1('0x45')](_0xd1b1('0x4a'))},{'where':{'id':{'$in':_[_0xd1b1('0xc')](_0x425723,'id')}},'transaction':_0x556de5})[_0xd1b1('0xf')](function(){_0x57264d(_0x425723);})[_0xd1b1('0x13')](function(_0x23a688){logger[_0xd1b1('0x14')](_0xd1b1('0x4b'),_0x23a688[_0xd1b1('0x19')],_0x1e0287);_0x28477c(_0x203c3[_0xd1b1('0x14')](0x1f4,_0x23a688[_0xd1b1('0x19')]));});})[_0xd1b1('0x13')](function(_0x3318e6){logger[_0xd1b1('0x14')](_0xd1b1('0x4b'),_0x3318e6[_0xd1b1('0x19')],_0x1e0287);_0x28477c(_0x203c3['error'](0x1f4,_0x3318e6[_0xd1b1('0x19')]));});}else{_0x57264d(_0x425723);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index d9f5098..b5dc919 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 _0x1d45=['update','delete','destroy','exports','Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','index','describe','/opencontacts','getOpenContacts','getTimezones','/:id','show','/:id/previewrecall','getPreviewRecall','post','create','getPreview','/timezone','put'];(function(_0x5d7e60,_0x29d85d){var _0x4eeff6=function(_0x490364){while(--_0x490364){_0x5d7e60['push'](_0x5d7e60['shift']());}};_0x4eeff6(++_0x29d85d);}(_0x1d45,0x12f));var _0x51d4=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x1d45[_0x36884e];return _0x1cc367;};'use strict';var express=require('express');var router=express[_0x51d4('0x0')]();var auth=require(_0x51d4('0x1'));var controller=require(_0x51d4('0x2'));router[_0x51d4('0x3')]('/',auth[_0x51d4('0x4')](),controller[_0x51d4('0x5')]);router[_0x51d4('0x3')]('/describe',auth[_0x51d4('0x4')](),controller[_0x51d4('0x6')]);router[_0x51d4('0x3')](_0x51d4('0x7'),auth['isAuthenticated'](),controller[_0x51d4('0x8')]);router[_0x51d4('0x3')]('/timezones',auth[_0x51d4('0x4')](),controller[_0x51d4('0x9')]);router['get'](_0x51d4('0xa'),auth['isAuthenticated'](),controller[_0x51d4('0xb')]);router[_0x51d4('0x3')](_0x51d4('0xc'),auth[_0x51d4('0x4')](),controller[_0x51d4('0xd')]);router[_0x51d4('0xe')]('/',auth['isAuthenticated'](),controller[_0x51d4('0xf')]);router['post']('/preview',auth[_0x51d4('0x4')](),controller[_0x51d4('0x10')]);router[_0x51d4('0xe')](_0x51d4('0x11'),auth[_0x51d4('0x4')](),controller['getTimezone']);router[_0x51d4('0x12')](_0x51d4('0xa'),auth[_0x51d4('0x4')](),controller[_0x51d4('0x13')]);router[_0x51d4('0x14')](_0x51d4('0xa'),auth[_0x51d4('0x4')](),controller[_0x51d4('0x15')]);module[_0x51d4('0x16')]=router; \ No newline at end of file +var _0x6374=['/:id','show','/:id/previewrecall','getPreviewRecall','create','/preview','getPreview','post','put','update','delete','destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller','isAuthenticated','index','get','/describe','describe','getOpenContacts'];(function(_0x2e771f,_0x20438f){var _0x2b3a90=function(_0x58658e){while(--_0x58658e){_0x2e771f['push'](_0x2e771f['shift']());}};_0x2b3a90(++_0x20438f);}(_0x6374,0xdc));var _0x4637=function(_0x4574e9,_0x307978){_0x4574e9=_0x4574e9-0x0;var _0x42533c=_0x6374[_0x4574e9];return _0x42533c;};'use strict';var express=require(_0x4637('0x0'));var router=express[_0x4637('0x1')]();var auth=require(_0x4637('0x2'));var controller=require(_0x4637('0x3'));router['get']('/',auth[_0x4637('0x4')](),controller[_0x4637('0x5')]);router[_0x4637('0x6')](_0x4637('0x7'),auth[_0x4637('0x4')](),controller[_0x4637('0x8')]);router[_0x4637('0x6')]('/opencontacts',auth[_0x4637('0x4')](),controller[_0x4637('0x9')]);router['get']('/timezones',auth['isAuthenticated'](),controller['getTimezones']);router[_0x4637('0x6')](_0x4637('0xa'),auth[_0x4637('0x4')](),controller[_0x4637('0xb')]);router[_0x4637('0x6')](_0x4637('0xc'),auth['isAuthenticated'](),controller[_0x4637('0xd')]);router['post']('/',auth[_0x4637('0x4')](),controller[_0x4637('0xe')]);router['post'](_0x4637('0xf'),auth[_0x4637('0x4')](),controller[_0x4637('0x10')]);router[_0x4637('0x11')]('/timezone',auth[_0x4637('0x4')](),controller['getTimezone']);router[_0x4637('0x12')](_0x4637('0xa'),auth[_0x4637('0x4')](),controller[_0x4637('0x13')]);router[_0x4637('0x14')](_0x4637('0xa'),auth['isAuthenticated'](),controller[_0x4637('0x15')]);module[_0x4637('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index b4d01a7..7140a4c 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 _0x7558=['DATE','moment','sequelize','exports','STRING','INTEGER'];(function(_0x48ac58,_0x27efe2){var _0x560abc=function(_0x5e21fa){while(--_0x5e21fa){_0x48ac58['push'](_0x48ac58['shift']());}};_0x560abc(++_0x27efe2);}(_0x7558,0x15d));var _0x8755=function(_0x2fe993,_0x50d0c6){_0x2fe993=_0x2fe993-0x0;var _0x55a182=_0x7558[_0x2fe993];return _0x55a182;};'use strict';var moment=require(_0x8755('0x0'));var Sequelize=require(_0x8755('0x1'));module[_0x8755('0x2')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x8755('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x8755('0x4')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x8755('0x5')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x8755('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8755('0x4')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x8755('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8755('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8755('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8755('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8755('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1c7e=['moment','sequelize','INTEGER','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xeb80e,_0x337608){var _0x68e9d7=function(_0x50c896){while(--_0x50c896){_0xeb80e['push'](_0xeb80e['shift']());}};_0x68e9d7(++_0x337608);}(_0x1c7e,0x69));var _0xe1c7=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x1c7e[_0x122ef9];return _0x42fba0;};'use strict';var moment=require(_0xe1c7('0x0'));var Sequelize=require(_0xe1c7('0x1'));module['exports']={'CmHopperId':{'type':Sequelize[_0xe1c7('0x2')]},'phone':{'type':Sequelize[_0xe1c7('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xe1c7('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xe1c7('0x4')],'defaultValue':moment()[_0xe1c7('0x5')](_0xe1c7('0x6'))},'countbusyretry':{'type':Sequelize[_0xe1c7('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe1c7('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe1c7('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xe1c7('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe1c7('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe1c7('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe1c7('0x2')],'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 470f44d..15f7872 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 _0x92e9=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','CmHopperAdditionalPhones','then','error','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x4ca43b,_0xa6e25b){var _0x545dcd=function(_0x4de21b){while(--_0x4de21b){_0x4ca43b['push'](_0x4ca43b['shift']());}};_0x545dcd(++_0xa6e25b);}(_0x92e9,0x153));var _0x992e=function(_0x290f02,_0x398a69){_0x290f02=_0x290f02-0x0;var _0xa2773a=_0x92e9[_0x290f02];return _0xa2773a;};'use strict';var emlformat=require(_0x992e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x992e('0x1'));var rp=require(_0x992e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x992e('0x3'));var util=require(_0x992e('0x4'));var path=require(_0x992e('0x5'));var sox=require(_0x992e('0x6'));var csv=require(_0x992e('0x7'));var ejs=require(_0x992e('0x8'));var fs=require('fs');var fs_extra=require(_0x992e('0x9'));var _=require(_0x992e('0xa'));var squel=require(_0x992e('0xb'));var crypto=require(_0x992e('0xc'));var jsforce=require(_0x992e('0xd'));var deskjs=require(_0x992e('0xe'));var toCsv=require(_0x992e('0x7'));var querystring=require(_0x992e('0xf'));var Papa=require(_0x992e('0x10'));var Redis=require(_0x992e('0x11'));var authService=require(_0x992e('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x992e('0x13'));var logger=require(_0x992e('0x14'))(_0x992e('0x15'));var utils=require('../../config/utils');var config=require(_0x992e('0x16'));var licenseUtil=require(_0x992e('0x17'));var db=require(_0x992e('0x18'))['db'];function respondWithStatusCode(_0x380c24,_0x22167f){_0x22167f=_0x22167f||0xcc;return function(_0x3984a7){if(_0x3984a7){return _0x380c24[_0x992e('0x19')](_0x22167f);}return _0x380c24[_0x992e('0x1a')](_0x22167f)[_0x992e('0x1b')]();};}function respondWithResult(_0x2472e0,_0x20cce4){_0x20cce4=_0x20cce4||0xc8;return function(_0x317f8a){if(_0x317f8a){return _0x2472e0[_0x992e('0x1a')](_0x20cce4)[_0x992e('0x1c')](_0x317f8a);}};}function respondWithFilteredResult(_0x1baf04,_0x4557c0){return function(_0x2fa388){if(_0x2fa388){var _0xbf4f0a=typeof _0x4557c0['offset']==='undefined'&&typeof _0x4557c0[_0x992e('0x1d')]===_0x992e('0x1e');var _0x701185=_0x2fa388[_0x992e('0x1f')];var _0x1dbc21=_0xbf4f0a?0x0:_0x4557c0[_0x992e('0x20')];var _0x4f801a=_0xbf4f0a?_0x2fa388['count']:_0x4557c0['offset']+_0x4557c0[_0x992e('0x1d')];var _0x1b58c8;if(_0x4f801a>=_0x701185){_0x4f801a=_0x701185;_0x1b58c8=0xc8;}else{_0x1b58c8=0xce;}_0x1baf04[_0x992e('0x1a')](_0x1b58c8);return _0x1baf04[_0x992e('0x21')](_0x992e('0x22'),_0x1dbc21+'-'+_0x4f801a+'/'+_0x701185)[_0x992e('0x1c')](_0x2fa388);}return null;};}function patchUpdates(_0x124a7b){return function(_0x594290){try{jsonpatch[_0x992e('0x23')](_0x594290,_0x124a7b,!![]);}catch(_0x448109){return BPromise[_0x992e('0x24')](_0x448109);}return _0x594290[_0x992e('0x25')]();};}function saveUpdates(_0x3e61f0,_0x419943){return function(_0x337d9f){if(_0x337d9f){return _0x337d9f[_0x992e('0x26')](_0x3e61f0)['then'](function(_0x50fc01){return _0x50fc01;});}return null;};}function removeEntity(_0x1618ac,_0x300f0a){return function(_0x19e761){if(_0x19e761){return _0x19e761[_0x992e('0x27')]()['then'](function(){var _0x3c7c61=_0x19e761[_0x992e('0x28')]({'plain':!![]});var _0x1c31f4=_0x992e('0x29');return db['UserProfileResource'][_0x992e('0x27')]({'where':{'type':_0x1c31f4,'resourceId':_0x3c7c61['id']}})[_0x992e('0x2a')](function(){return _0x19e761;});})[_0x992e('0x2a')](function(){_0x1618ac['status'](0xcc)[_0x992e('0x1b')]();});}};}function handleEntityNotFound(_0x5990b7,_0x2b8d22){return function(_0x294918){if(!_0x294918){_0x5990b7[_0x992e('0x19')](0x194);}return _0x294918;};}function handleError(_0x39e892,_0x174bc3){_0x174bc3=_0x174bc3||0x1f4;return function(_0x1ebab4){logger[_0x992e('0x2b')](_0x1ebab4[_0x992e('0x2c')]);if(_0x1ebab4['name']){delete _0x1ebab4[_0x992e('0x2d')];}_0x39e892[_0x992e('0x1a')](_0x174bc3)[_0x992e('0x2e')](_0x1ebab4);};}exports[_0x992e('0x2f')]=function(_0x32f0ad,_0x260b08){var _0x356e61={},_0x4a1c71={},_0x1d79fb={'count':0x0,'rows':[]};var _0x40a56b=_[_0x992e('0x30')](db[_0x992e('0x31')][_0x992e('0x32')],function(_0x12d2a8){return{'name':_0x12d2a8['fieldName'],'type':_0x12d2a8[_0x992e('0x33')][_0x992e('0x34')]};});_0x4a1c71['model']=_[_0x992e('0x30')](_0x40a56b,_0x992e('0x2d'));_0x4a1c71[_0x992e('0x35')]=_[_0x992e('0x36')](_0x32f0ad[_0x992e('0x35')]);_0x4a1c71[_0x992e('0x37')]=_['intersection'](_0x4a1c71[_0x992e('0x38')],_0x4a1c71[_0x992e('0x35')]);_0x356e61[_0x992e('0x39')]=_[_0x992e('0x3a')](_0x4a1c71['model'],qs[_0x992e('0x3b')](_0x32f0ad['query'][_0x992e('0x3b')]));_0x356e61[_0x992e('0x39')]=_0x356e61[_0x992e('0x39')][_0x992e('0x3c')]?_0x356e61[_0x992e('0x39')]:_0x4a1c71[_0x992e('0x38')];if(!_0x32f0ad[_0x992e('0x35')][_0x992e('0x3d')](_0x992e('0x3e'))){_0x356e61[_0x992e('0x1d')]=qs['limit'](_0x32f0ad[_0x992e('0x35')][_0x992e('0x1d')]);_0x356e61['offset']=qs[_0x992e('0x20')](_0x32f0ad['query'][_0x992e('0x20')]);}_0x356e61[_0x992e('0x3f')]=qs['sort'](_0x32f0ad[_0x992e('0x35')][_0x992e('0x40')]);_0x356e61[_0x992e('0x41')]=qs[_0x992e('0x37')](_['pick'](_0x32f0ad[_0x992e('0x35')],_0x4a1c71['filters']),_0x40a56b);if(_0x32f0ad[_0x992e('0x35')][_0x992e('0x42')]){_0x356e61[_0x992e('0x41')]=_[_0x992e('0x43')](_0x356e61[_0x992e('0x41')],{'$or':_[_0x992e('0x30')](_0x40a56b,function(_0x183cae){if(_0x183cae[_0x992e('0x33')]!==_0x992e('0x44')){var _0x9b0e5e={};_0x9b0e5e[_0x183cae[_0x992e('0x2d')]]={'$like':'%'+_0x32f0ad[_0x992e('0x35')][_0x992e('0x42')]+'%'};return _0x9b0e5e;}})});}_0x356e61=_['merge']({},_0x356e61,_0x32f0ad[_0x992e('0x45')]);var _0x1f9831={'where':_0x356e61[_0x992e('0x41')]};return db[_0x992e('0x31')][_0x992e('0x1f')](_0x1f9831)[_0x992e('0x2a')](function(_0x2635e8){_0x1d79fb['count']=_0x2635e8;if(_0x32f0ad[_0x992e('0x35')][_0x992e('0x46')]){_0x356e61['include']=[{'all':!![]}];}return db[_0x992e('0x31')][_0x992e('0x47')](_0x356e61);})['then'](function(_0x1b393a){_0x1d79fb[_0x992e('0x48')]=_0x1b393a;return _0x1d79fb;})[_0x992e('0x2a')](respondWithFilteredResult(_0x260b08,_0x356e61))[_0x992e('0x49')](handleError(_0x260b08,null));};exports[_0x992e('0x4a')]=function(_0x2584d5,_0x4ef473){var _0x2293ad={'raw':!![],'where':{'id':_0x2584d5[_0x992e('0x4b')]['id']}},_0x259533={};_0x259533[_0x992e('0x38')]=_[_0x992e('0x36')](db[_0x992e('0x31')]['rawAttributes']);_0x259533['query']=_['keys'](_0x2584d5['query']);_0x259533[_0x992e('0x37')]=_[_0x992e('0x3a')](_0x259533[_0x992e('0x38')],_0x259533[_0x992e('0x35')]);_0x2293ad['attributes']=_['intersection'](_0x259533['model'],qs[_0x992e('0x3b')](_0x2584d5['query']['fields']));_0x2293ad['attributes']=_0x2293ad[_0x992e('0x39')][_0x992e('0x3c')]?_0x2293ad['attributes']:_0x259533[_0x992e('0x38')];if(_0x2584d5[_0x992e('0x35')]['includeAll']){_0x2293ad[_0x992e('0x4c')]=[{'all':!![]}];}_0x2293ad=_[_0x992e('0x43')]({},_0x2293ad,_0x2584d5[_0x992e('0x45')]);return db[_0x992e('0x31')][_0x992e('0x4d')](_0x2293ad)[_0x992e('0x2a')](handleEntityNotFound(_0x4ef473,null))[_0x992e('0x2a')](respondWithResult(_0x4ef473,null))[_0x992e('0x49')](handleError(_0x4ef473,null));};exports[_0x992e('0x4e')]=function(_0x4cd412,_0x16fc99){return db['CmHopperAdditionalPhone'][_0x992e('0x4e')](_0x4cd412[_0x992e('0x4f')],{})[_0x992e('0x2a')](function(_0x24fd11){var _0x197adc=_0x4cd412['user'][_0x992e('0x28')]({'plain':!![]});if(!_0x197adc)throw new Error(_0x992e('0x50'));if(_0x197adc[_0x992e('0x51')]===_0x992e('0x52')){var _0x5468ed=_0x24fd11[_0x992e('0x28')]({'plain':!![]});var _0x1c440f='CmHopperAdditionalPhones';return db[_0x992e('0x53')][_0x992e('0x4d')]({'where':{'name':_0x1c440f,'userProfileId':_0x197adc[_0x992e('0x54')]},'raw':!![]})[_0x992e('0x2a')](function(_0x2476b3){if(_0x2476b3&&_0x2476b3[_0x992e('0x55')]===0x0){return db[_0x992e('0x56')][_0x992e('0x4e')]({'name':_0x5468ed['name'],'resourceId':_0x5468ed['id'],'type':_0x2476b3[_0x992e('0x2d')],'sectionId':_0x2476b3['id']},{})[_0x992e('0x2a')](function(){return _0x24fd11;});}else{return _0x24fd11;}})['catch'](function(_0x2c3653){logger[_0x992e('0x2b')](_0x992e('0x57'),_0x2c3653);throw _0x2c3653;});}return _0x24fd11;})[_0x992e('0x2a')](respondWithResult(_0x16fc99,0xc9))[_0x992e('0x49')](handleError(_0x16fc99,null));};exports[_0x992e('0x26')]=function(_0x308c31,_0x344cbd){if(_0x308c31['body']['id']){delete _0x308c31['body']['id'];}return db['CmHopperAdditionalPhone'][_0x992e('0x4d')]({'where':{'id':_0x308c31['params']['id']}})[_0x992e('0x2a')](handleEntityNotFound(_0x344cbd,null))[_0x992e('0x2a')](saveUpdates(_0x308c31[_0x992e('0x4f')],null))[_0x992e('0x2a')](respondWithResult(_0x344cbd,null))[_0x992e('0x49')](handleError(_0x344cbd,null));};exports['destroy']=function(_0x48113d,_0x43075d){return db['CmHopperAdditionalPhone']['find']({'where':{'id':_0x48113d[_0x992e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x43075d,null))[_0x992e('0x2a')](removeEntity(_0x43075d,null))[_0x992e('0x49')](handleError(_0x43075d,null));}; \ No newline at end of file +var _0x0e5a=['fields','length','attributes','hasOwnProperty','nolimit','sort','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','get','CmHopperAdditionalPhones','UserProfileResource','destroy','error','send','index','map','CmHopperAdditionalPhone','fieldName','type','model','name','query','intersection'];(function(_0x32d4b3,_0xcb2a1c){var _0x2fc502=function(_0x2c2eb4){while(--_0x2c2eb4){_0x32d4b3['push'](_0x32d4b3['shift']());}};_0x2fc502(++_0xcb2a1c);}(_0x0e5a,0x110));var _0xa0e5=function(_0x522660,_0x2d2b72){_0x522660=_0x522660-0x0;var _0x5e47dd=_0x0e5a[_0x522660];return _0x5e47dd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa0e5('0x0'));var rp=require('request-promise');var moment=require(_0xa0e5('0x1'));var BPromise=require(_0xa0e5('0x2'));var Mustache=require(_0xa0e5('0x3'));var util=require('util');var path=require(_0xa0e5('0x4'));var sox=require(_0xa0e5('0x5'));var csv=require('to-csv');var ejs=require(_0xa0e5('0x6'));var fs=require('fs');var fs_extra=require(_0xa0e5('0x7'));var _=require(_0xa0e5('0x8'));var squel=require('squel');var crypto=require(_0xa0e5('0x9'));var jsforce=require(_0xa0e5('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xa0e5('0xb'));var querystring=require(_0xa0e5('0xc'));var Papa=require(_0xa0e5('0xd'));var Redis=require('ioredis');var authService=require(_0xa0e5('0xe'));var qs=require(_0xa0e5('0xf'));var as=require(_0xa0e5('0x10'));var hardwareService=require(_0xa0e5('0x11'));var logger=require(_0xa0e5('0x12'))(_0xa0e5('0x13'));var utils=require(_0xa0e5('0x14'));var config=require(_0xa0e5('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa0e5('0x16'))['db'];function respondWithStatusCode(_0x8acb5c,_0x22d1be){_0x22d1be=_0x22d1be||0xcc;return function(_0x4f20d0){if(_0x4f20d0){return _0x8acb5c[_0xa0e5('0x17')](_0x22d1be);}return _0x8acb5c[_0xa0e5('0x18')](_0x22d1be)[_0xa0e5('0x19')]();};}function respondWithResult(_0x17b197,_0x14f287){_0x14f287=_0x14f287||0xc8;return function(_0x187169){if(_0x187169){return _0x17b197[_0xa0e5('0x18')](_0x14f287)[_0xa0e5('0x1a')](_0x187169);}};}function respondWithFilteredResult(_0x70c3ad,_0x2276ba){return function(_0x503b9c){if(_0x503b9c){var _0x11cbe0=typeof _0x2276ba['offset']===_0xa0e5('0x1b')&&typeof _0x2276ba[_0xa0e5('0x1c')]==='undefined';var _0x932bbc=_0x503b9c[_0xa0e5('0x1d')];var _0x5ed593=_0x11cbe0?0x0:_0x2276ba['offset'];var _0x4a6103=_0x11cbe0?_0x503b9c[_0xa0e5('0x1d')]:_0x2276ba[_0xa0e5('0x1e')]+_0x2276ba[_0xa0e5('0x1c')];var _0x33c7d4;if(_0x4a6103>=_0x932bbc){_0x4a6103=_0x932bbc;_0x33c7d4=0xc8;}else{_0x33c7d4=0xce;}_0x70c3ad[_0xa0e5('0x18')](_0x33c7d4);return _0x70c3ad[_0xa0e5('0x1f')]('Content-Range',_0x5ed593+'-'+_0x4a6103+'/'+_0x932bbc)[_0xa0e5('0x1a')](_0x503b9c);}return null;};}function patchUpdates(_0x396ccf){return function(_0x2a6cde){try{jsonpatch[_0xa0e5('0x20')](_0x2a6cde,_0x396ccf,!![]);}catch(_0x2c4c21){return BPromise[_0xa0e5('0x21')](_0x2c4c21);}return _0x2a6cde[_0xa0e5('0x22')]();};}function saveUpdates(_0x2c41e1,_0x1002b3){return function(_0x2524c9){if(_0x2524c9){return _0x2524c9[_0xa0e5('0x23')](_0x2c41e1)[_0xa0e5('0x24')](function(_0x1d5c77){return _0x1d5c77;});}return null;};}function removeEntity(_0x232903,_0x284549){return function(_0x391736){if(_0x391736){return _0x391736['destroy']()[_0xa0e5('0x24')](function(){var _0x6a08d5=_0x391736[_0xa0e5('0x25')]({'plain':!![]});var _0x3f704b=_0xa0e5('0x26');return db[_0xa0e5('0x27')][_0xa0e5('0x28')]({'where':{'type':_0x3f704b,'resourceId':_0x6a08d5['id']}})[_0xa0e5('0x24')](function(){return _0x391736;});})[_0xa0e5('0x24')](function(){_0x232903[_0xa0e5('0x18')](0xcc)[_0xa0e5('0x19')]();});}};}function handleEntityNotFound(_0x55fa33,_0x26aca0){return function(_0x1a370b){if(!_0x1a370b){_0x55fa33['sendStatus'](0x194);}return _0x1a370b;};}function handleError(_0x4748e3,_0x57623e){_0x57623e=_0x57623e||0x1f4;return function(_0x2ea545){logger[_0xa0e5('0x29')](_0x2ea545['stack']);if(_0x2ea545['name']){delete _0x2ea545['name'];}_0x4748e3[_0xa0e5('0x18')](_0x57623e)[_0xa0e5('0x2a')](_0x2ea545);};}exports[_0xa0e5('0x2b')]=function(_0x170121,_0x56bb92){var _0x26b316={},_0x5d9f7={},_0x93c0ac={'count':0x0,'rows':[]};var _0x46cf77=_[_0xa0e5('0x2c')](db[_0xa0e5('0x2d')]['rawAttributes'],function(_0x57c34f){return{'name':_0x57c34f[_0xa0e5('0x2e')],'type':_0x57c34f[_0xa0e5('0x2f')]['key']};});_0x5d9f7[_0xa0e5('0x30')]=_[_0xa0e5('0x2c')](_0x46cf77,_0xa0e5('0x31'));_0x5d9f7[_0xa0e5('0x32')]=_['keys'](_0x170121[_0xa0e5('0x32')]);_0x5d9f7['filters']=_[_0xa0e5('0x33')](_0x5d9f7[_0xa0e5('0x30')],_0x5d9f7['query']);_0x26b316['attributes']=_[_0xa0e5('0x33')](_0x5d9f7['model'],qs[_0xa0e5('0x34')](_0x170121[_0xa0e5('0x32')][_0xa0e5('0x34')]));_0x26b316['attributes']=_0x26b316['attributes'][_0xa0e5('0x35')]?_0x26b316[_0xa0e5('0x36')]:_0x5d9f7['model'];if(!_0x170121[_0xa0e5('0x32')][_0xa0e5('0x37')](_0xa0e5('0x38'))){_0x26b316['limit']=qs[_0xa0e5('0x1c')](_0x170121[_0xa0e5('0x32')][_0xa0e5('0x1c')]);_0x26b316[_0xa0e5('0x1e')]=qs[_0xa0e5('0x1e')](_0x170121[_0xa0e5('0x32')][_0xa0e5('0x1e')]);}_0x26b316['order']=qs[_0xa0e5('0x39')](_0x170121[_0xa0e5('0x32')][_0xa0e5('0x39')]);_0x26b316['where']=qs[_0xa0e5('0x3a')](_[_0xa0e5('0x3b')](_0x170121[_0xa0e5('0x32')],_0x5d9f7['filters']),_0x46cf77);if(_0x170121[_0xa0e5('0x32')][_0xa0e5('0x3c')]){_0x26b316['where']=_[_0xa0e5('0x3d')](_0x26b316['where'],{'$or':_['map'](_0x46cf77,function(_0x4de955){if(_0x4de955[_0xa0e5('0x2f')]!==_0xa0e5('0x3e')){var _0x1c448a={};_0x1c448a[_0x4de955[_0xa0e5('0x31')]]={'$like':'%'+_0x170121[_0xa0e5('0x32')]['filter']+'%'};return _0x1c448a;}})});}_0x26b316=_[_0xa0e5('0x3d')]({},_0x26b316,_0x170121[_0xa0e5('0x3f')]);var _0x216b95={'where':_0x26b316['where']};return db[_0xa0e5('0x2d')][_0xa0e5('0x1d')](_0x216b95)[_0xa0e5('0x24')](function(_0x38dc94){_0x93c0ac[_0xa0e5('0x1d')]=_0x38dc94;if(_0x170121['query'][_0xa0e5('0x40')]){_0x26b316[_0xa0e5('0x41')]=[{'all':!![]}];}return db[_0xa0e5('0x2d')][_0xa0e5('0x42')](_0x26b316);})[_0xa0e5('0x24')](function(_0x44321b){_0x93c0ac[_0xa0e5('0x43')]=_0x44321b;return _0x93c0ac;})['then'](respondWithFilteredResult(_0x56bb92,_0x26b316))[_0xa0e5('0x44')](handleError(_0x56bb92,null));};exports[_0xa0e5('0x45')]=function(_0x8472cc,_0x35d4d6){var _0x2749e6={'raw':!![],'where':{'id':_0x8472cc[_0xa0e5('0x46')]['id']}},_0x199e96={};_0x199e96[_0xa0e5('0x30')]=_[_0xa0e5('0x47')](db[_0xa0e5('0x2d')][_0xa0e5('0x48')]);_0x199e96[_0xa0e5('0x32')]=_['keys'](_0x8472cc['query']);_0x199e96['filters']=_[_0xa0e5('0x33')](_0x199e96['model'],_0x199e96[_0xa0e5('0x32')]);_0x2749e6[_0xa0e5('0x36')]=_[_0xa0e5('0x33')](_0x199e96[_0xa0e5('0x30')],qs['fields'](_0x8472cc['query'][_0xa0e5('0x34')]));_0x2749e6[_0xa0e5('0x36')]=_0x2749e6[_0xa0e5('0x36')][_0xa0e5('0x35')]?_0x2749e6[_0xa0e5('0x36')]:_0x199e96[_0xa0e5('0x30')];if(_0x8472cc[_0xa0e5('0x32')][_0xa0e5('0x40')]){_0x2749e6[_0xa0e5('0x41')]=[{'all':!![]}];}_0x2749e6=_['merge']({},_0x2749e6,_0x8472cc[_0xa0e5('0x3f')]);return db['CmHopperAdditionalPhone'][_0xa0e5('0x49')](_0x2749e6)[_0xa0e5('0x24')](handleEntityNotFound(_0x35d4d6,null))[_0xa0e5('0x24')](respondWithResult(_0x35d4d6,null))[_0xa0e5('0x44')](handleError(_0x35d4d6,null));};exports[_0xa0e5('0x4a')]=function(_0x1710d2,_0x2b543e){return db[_0xa0e5('0x2d')][_0xa0e5('0x4a')](_0x1710d2[_0xa0e5('0x4b')],{})[_0xa0e5('0x24')](function(_0x55d3aa){var _0xa3c3a=_0x1710d2[_0xa0e5('0x4c')][_0xa0e5('0x25')]({'plain':!![]});if(!_0xa3c3a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa3c3a[_0xa0e5('0x4d')]===_0xa0e5('0x4c')){var _0x572f97=_0x55d3aa[_0xa0e5('0x25')]({'plain':!![]});var _0x25bc68='CmHopperAdditionalPhones';return db[_0xa0e5('0x4e')][_0xa0e5('0x49')]({'where':{'name':_0x25bc68,'userProfileId':_0xa3c3a[_0xa0e5('0x4f')]},'raw':!![]})[_0xa0e5('0x24')](function(_0x582e2e){if(_0x582e2e&&_0x582e2e[_0xa0e5('0x50')]===0x0){return db[_0xa0e5('0x27')]['create']({'name':_0x572f97['name'],'resourceId':_0x572f97['id'],'type':_0x582e2e[_0xa0e5('0x31')],'sectionId':_0x582e2e['id']},{})[_0xa0e5('0x24')](function(){return _0x55d3aa;});}else{return _0x55d3aa;}})[_0xa0e5('0x44')](function(_0x4577ef){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4577ef);throw _0x4577ef;});}return _0x55d3aa;})[_0xa0e5('0x24')](respondWithResult(_0x2b543e,0xc9))[_0xa0e5('0x44')](handleError(_0x2b543e,null));};exports[_0xa0e5('0x23')]=function(_0x2b3db9,_0x3678f9){if(_0x2b3db9[_0xa0e5('0x4b')]['id']){delete _0x2b3db9[_0xa0e5('0x4b')]['id'];}return db['CmHopperAdditionalPhone'][_0xa0e5('0x49')]({'where':{'id':_0x2b3db9[_0xa0e5('0x46')]['id']}})[_0xa0e5('0x24')](handleEntityNotFound(_0x3678f9,null))[_0xa0e5('0x24')](saveUpdates(_0x2b3db9[_0xa0e5('0x4b')],null))[_0xa0e5('0x24')](respondWithResult(_0x3678f9,null))[_0xa0e5('0x44')](handleError(_0x3678f9,null));};exports[_0xa0e5('0x28')]=function(_0x197861,_0x13cdf0){return db[_0xa0e5('0x2d')][_0xa0e5('0x49')]({'where':{'id':_0x197861['params']['id']}})[_0xa0e5('0x24')](handleEntityNotFound(_0x13cdf0,null))['then'](removeEntity(_0x13cdf0,null))[_0xa0e5('0x44')](handleError(_0x13cdf0,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 5579704..b2470ff 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 _0x0c1c=['./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x58df44,_0x5643cc){var _0x47271c=function(_0x1c07f6){while(--_0x1c07f6){_0x58df44['push'](_0x58df44['shift']());}};_0x47271c(++_0x5643cc);}(_0x0c1c,0x10d));var _0xc0c1=function(_0x3337b6,_0x42c7f9){_0x3337b6=_0x3337b6-0x0;var _0x568270=_0x0c1c[_0x3337b6];return _0x568270;};'use strict';var _=require(_0xc0c1('0x0'));var util=require(_0xc0c1('0x1'));var logger=require('../../config/logger')(_0xc0c1('0x2'));var moment=require(_0xc0c1('0x3'));var BPromise=require(_0xc0c1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc0c1('0x5'));var config=require(_0xc0c1('0x6'));var attributes=require(_0xc0c1('0x7'));module[_0xc0c1('0x8')]=function(_0x39c4fc,_0x538533){return _0x39c4fc[_0xc0c1('0x9')](_0xc0c1('0xa'),attributes,{'tableName':_0xc0c1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe4e3=['../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util'];(function(_0x1dcb61,_0x533143){var _0x275729=function(_0x1987eb){while(--_0x1987eb){_0x1dcb61['push'](_0x1dcb61['shift']());}};_0x275729(++_0x533143);}(_0xe4e3,0x196));var _0x3e4e=function(_0x3f45b6,_0x4acdc3){_0x3f45b6=_0x3f45b6-0x0;var _0x1cacec=_0xe4e3[_0x3f45b6];return _0x1cacec;};'use strict';var _=require(_0x3e4e('0x0'));var util=require(_0x3e4e('0x1'));var logger=require(_0x3e4e('0x2'))(_0x3e4e('0x3'));var moment=require(_0x3e4e('0x4'));var BPromise=require(_0x3e4e('0x5'));var rp=require(_0x3e4e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3e4e('0x7'));var config=require('../../config/environment');var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0x3e4e('0x8')]=function(_0x256c33,_0x1bd467){return _0x256c33[_0x3e4e('0x9')](_0x3e4e('0xa'),attributes,{'tableName':_0x3e4e('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 696a13b..3a35a35 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 _0xd523=['message','result','catch','VerifyAdditionalPhones','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','countabandonedretry','SwapAdditionalPhones','duration','waitTime','isNil','scheduledat','add','minutes','phone','createdAt','updatedAt','transaction','update','CmHopper','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0xb65e77,_0x238c3d){var _0x38134b=function(_0x39da21){while(--_0x39da21){_0xb65e77['push'](_0xb65e77['shift']());}};_0x38134b(++_0x238c3d);}(_0xd523,0x153));var _0x3d52=function(_0x30ef91,_0x51df94){_0x30ef91=_0x30ef91-0x0;var _0x4ac10a=_0xd523[_0x30ef91];return _0x4ac10a;};'use strict';var _=require(_0x3d52('0x0'));var util=require(_0x3d52('0x1'));var moment=require(_0x3d52('0x2'));var BPromise=require(_0x3d52('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d52('0x4'));var db=require(_0x3d52('0x5'))['db'];var utils=require(_0x3d52('0x6'));var logger=require('../../config/logger')(_0x3d52('0x7'));var config=require(_0x3d52('0x8'));var jayson=require(_0x3d52('0x9'));var client=jayson[_0x3d52('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fcc92,_0x189147,_0x2f3ebc){return new BPromise(function(_0x232bd4,_0x2e03c0){return client[_0x3d52('0xb')](_0x4fcc92,_0x2f3ebc)[_0x3d52('0xc')](function(_0x34c184){logger[_0x3d52('0xd')](_0x3d52('0xe'),_0x189147,'request\x20sent');logger[_0x3d52('0xf')](_0x3d52('0x10'),_0x189147,_0x3d52('0x11'),JSON[_0x3d52('0x12')](_0x34c184));if(_0x34c184[_0x3d52('0x13')]){if(_0x34c184['error'][_0x3d52('0x14')]===0x1f4){logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x189147,_0x34c184[_0x3d52('0x13')][_0x3d52('0x15')]);return _0x2e03c0(_0x34c184['error']['message']);}logger['error'](_0x3d52('0xe'),_0x189147,_0x34c184[_0x3d52('0x13')][_0x3d52('0x15')]);return _0x232bd4(_0x34c184[_0x3d52('0x13')][_0x3d52('0x15')]);}else{logger[_0x3d52('0xd')](_0x3d52('0xe'),_0x189147,_0x3d52('0x11'));_0x232bd4(_0x34c184[_0x3d52('0x16')][_0x3d52('0x15')]);}})[_0x3d52('0x17')](function(_0x15cc02){logger[_0x3d52('0x13')](_0x3d52('0xe'),_0x189147,_0x15cc02);_0x2e03c0(_0x15cc02);});});}exports[_0x3d52('0x18')]=function(_0x5bce9a){var _0x163d88=this;return new Promise(function(_0x3b3451,_0x386cdb){return db['CmHopper'][_0x3d52('0x19')]({'raw':!![],'where':{'ContactId':_0x5bce9a[_0x3d52('0x1a')][_0x3d52('0x1b')],'ListId':_0x5bce9a['body'][_0x3d52('0x1c')],'VoiceQueueId':_0x5bce9a[_0x3d52('0x1a')][_0x3d52('0x1d')]===undefined?null:_0x5bce9a[_0x3d52('0x1a')][_0x3d52('0x1d')],'CampaignId':_0x5bce9a[_0x3d52('0x1a')][_0x3d52('0x1e')]===undefined?null:_0x5bce9a[_0x3d52('0x1a')]['CampaignId']}})[_0x3d52('0xc')](function(_0x10f432){if(_0x10f432!=null){return db[_0x3d52('0x1f')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x10f432['id'],'OrderBy':{'$gt':_0x10f432[_0x3d52('0x20')]}},'order':[[_0x3d52('0x20'),_0x3d52('0x21')]]})[_0x3d52('0xc')](function(_0x3816bc){var _0x349b30=0x0;if(_0x3816bc){if(_0x3816bc[_0x3d52('0x22')]+_0x3816bc[_0x3d52('0x23')]+_0x3816bc[_0x3d52('0x24')]+_0x3816bc[_0x3d52('0x25')]+_0x3816bc[_0x3d52('0x26')]+_0x3816bc['countabandonedretry']+_0x3816bc[_0x3d52('0x27')]+_0x3816bc[_0x3d52('0x28')]<_0x5bce9a[_0x3d52('0x29')][_0x3d52('0x2a')])_0x349b30=0x1;_0x3b3451({'additional':_0x349b30});}else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x10f432['id']},'order':[[_0x3d52('0x20'),_0x3d52('0x21')]]})[_0x3d52('0xc')](function(_0x5adddf){var _0x209cca=0x0;if(_0x5adddf){if(_0x5adddf[_0x3d52('0x22')]+_0x5adddf[_0x3d52('0x23')]+_0x5adddf[_0x3d52('0x24')]+_0x5adddf['countnosuchnumberretry']+_0x5adddf[_0x3d52('0x26')]+_0x5adddf[_0x3d52('0x2b')]+_0x5adddf[_0x3d52('0x27')]+_0x5adddf[_0x3d52('0x28')]<_0x5bce9a['entity'][_0x3d52('0x2a')])_0x209cca=0x1;_0x3b3451({'additional':_0x209cca});}else{_0x3b3451({'additional':0x0});}})['catch'](function(_0x5f006b){logger[_0x3d52('0x13')](_0x3d52('0x18'),_0x5f006b['message']);_0x386cdb(_0x163d88[_0x3d52('0x13')](0x1f4,_0x5f006b['message']));});}})[_0x3d52('0x17')](function(_0x4c0273){logger['error'](_0x3d52('0x18'),_0x4c0273[_0x3d52('0x15')]);_0x386cdb(_0x163d88[_0x3d52('0x13')](0x1f4,_0x4c0273[_0x3d52('0x15')]));});}else _0x3b3451({'additional':0x0});});});};exports[_0x3d52('0x2c')]=function(_0x453f96){var _0x32ed74=this;return new Promise(function(_0x203c3c,_0x26d1d8){return db['CmHopper'][_0x3d52('0x19')]({'raw':!![],'where':{'ContactId':_0x453f96[_0x3d52('0x1a')][_0x3d52('0x1b')],'ListId':_0x453f96[_0x3d52('0x1a')]['ListId'],'VoiceQueueId':_0x453f96[_0x3d52('0x1a')][_0x3d52('0x1d')]===undefined?null:_0x453f96['body'][_0x3d52('0x1d')],'CampaignId':_0x453f96['body'][_0x3d52('0x1e')]===undefined?null:_0x453f96[_0x3d52('0x1a')][_0x3d52('0x1e')]}})['then'](function(_0x2798a7){if(_0x2798a7!=null){return db['CmHopperAdditionalPhone'][_0x3d52('0x19')]({'raw':!![],'where':{'CmHopperId':_0x2798a7['id'],'OrderBy':{'$gte':_0x2798a7[_0x3d52('0x20')]}},'order':[[_0x3d52('0x20'),'ASC']]})['then'](function(_0x2eab67){if(_0x2eab67)return activateAdditionalPhone(_0x2798a7,_0x453f96[_0x3d52('0x1a')],_0x2eab67,_0x453f96[_0x3d52('0x2d')],_0x453f96['waitTime'])[_0x3d52('0xc')](function(_0x22262c){_0x203c3c(_0x22262c);});else{return db[_0x3d52('0x1f')][_0x3d52('0x19')]({'raw':!![],'where':{'CmHopperId':_0x2798a7['id']},'order':[['OrderBy',_0x3d52('0x21')]]})['then'](function(_0x563fe5){if(_0x563fe5)return activateAdditionalPhone(_0x2798a7,_0x453f96[_0x3d52('0x1a')],_0x563fe5,_0x453f96['duration'],_0x453f96[_0x3d52('0x2e')])['then'](function(_0x2099d3){_0x203c3c(_0x2099d3);});else{_0x203c3c({'id':_0x2798a7['id'],'phone':''});}})['catch'](function(_0x576562){logger[_0x3d52('0x13')](_0x3d52('0x18'),_0x576562['message']);_0x26d1d8(_0x32ed74[_0x3d52('0x13')](0x1f4,_0x576562[_0x3d52('0x15')]));});}})['catch'](function(_0xb8a0b2){logger[_0x3d52('0x13')](_0x3d52('0x18'),_0xb8a0b2[_0x3d52('0x15')]);_0x26d1d8(_0x32ed74[_0x3d52('0x13')](0x1f4,_0xb8a0b2[_0x3d52('0x15')]));});}else _0x203c3c(0x1);});});};function activateAdditionalPhone(_0x317a53,_0x5cf4b9,_0x5dfc8c,_0x4cfdeb,_0x4f2edd){return new Promise(function(_0x57a037,_0x4188cc){var _0x552e30;if(_[_0x3d52('0x2f')](_0x5dfc8c['scheduledat'])){_0x5dfc8c[_0x3d52('0x30')]=moment();}if(moment()>moment(_0x5dfc8c[_0x3d52('0x30')])){_0x552e30=moment()[_0x3d52('0x31')](_0x4f2edd||0x3,_0x3d52('0x32'));}else{if(_0x5dfc8c['OrderBy']==0x0){_0x552e30=moment(_0x5dfc8c[_0x3d52('0x30')]);}else{_0x552e30=moment()[_0x3d52('0x31')](_0x4f2edd||0x3,'minutes');}}if(_[_0x3d52('0x2f')](_0x552e30)){_0x552e30=moment()[_0x3d52('0x31')](_0x4f2edd||0x3,_0x3d52('0x32'));}var _0x54c279={'phone':_0x317a53[_0x3d52('0x33')],'active':0x0,'OrderBy':_['isNil'](_0x317a53['OrderBy'])?0x0:_0x317a53['OrderBy'],'scheduledat':moment()['add'](_0x4cfdeb||0x1,_0x3d52('0x32')),'countbusyretry':_0x5cf4b9[_0x3d52('0x22')],'countcongestionretry':_0x5cf4b9[_0x3d52('0x23')],'countnoanswerretry':_0x5cf4b9['countnoanswerretry'],'countnosuchnumberretry':_0x5cf4b9[_0x3d52('0x25')],'countdropretry':_0x5cf4b9['countdropretry'],'countabandonedretry':_0x5cf4b9[_0x3d52('0x2b')],'countmachineretry':_0x5cf4b9[_0x3d52('0x27')],'countagentrejectretry':_0x5cf4b9['countagentrejectretry'],'createdAt':_0x5cf4b9[_0x3d52('0x34')],'updatedAt':_0x5cf4b9[_0x3d52('0x35')]};var _0x405a90={'CmHopperId':_0x317a53['id'],'phone':_0x5dfc8c[_0x3d52('0x33')],'active':0x0,'OrderBy':_['isNil'](_0x5dfc8c['OrderBy'])?0x0:_0x5dfc8c[_0x3d52('0x20')],'scheduledat':_0x552e30,'countbusyretry':_0x5dfc8c['countbusyretry'],'countcongestionretry':_0x5dfc8c[_0x3d52('0x23')],'countnoanswerretry':_0x5dfc8c[_0x3d52('0x24')],'countnosuchnumberretry':_0x5dfc8c[_0x3d52('0x25')],'countdropretry':_0x5dfc8c[_0x3d52('0x26')],'countabandonedretry':_0x5dfc8c['countabandonedretry'],'countmachineretry':_0x5dfc8c[_0x3d52('0x27')],'countagentrejectretry':_0x5dfc8c['countagentrejectretry'],'createdAt':_0x5dfc8c[_0x3d52('0x34')],'updatedAt':_0x5dfc8c[_0x3d52('0x35')]};return db['sequelize'][_0x3d52('0x36')](function(_0x2c633c){return db[_0x3d52('0x1f')][_0x3d52('0x37')](_0x54c279,{'where':{'id':_0x5dfc8c['id']}},{'transaction':_0x2c633c})[_0x3d52('0xc')](function(){return db[_0x3d52('0x38')][_0x3d52('0x37')](_0x405a90,{'where':{'id':_0x317a53['id']}},{'transaction':_0x2c633c});});})[_0x3d52('0xc')](function(_0x3a01d9){_0x57a037({'id':_0x317a53['id'],'phone':_0x5dfc8c['phone']});})[_0x3d52('0x17')](function(_0x380699){logger['error'](_0x3d52('0x39'),_0x380699['message']);_0x4188cc({'error':_0x380699[_0x3d52('0x15')]});});});}exports[_0x3d52('0x3a')]=function(_0x3e53a5){var _0x47daa2=this;return new Promise(function(_0x2cb287,_0x1fd49c){return db['CmHopper']['update'](_0x3e53a5[_0x3d52('0x1a')][_0x3d52('0x3b')],{'where':{'id':_0x3e53a5['body']['id']}})[_0x3d52('0xc')](function(_0x146a5b){_0x2cb287(_0x146a5b);})[_0x3d52('0x17')](function(_0x376cb3){logger[_0x3d52('0x13')](_0x3d52('0x3a'),_0x376cb3['message']);_0x1fd49c(_0x47daa2[_0x3d52('0x13')](0x1f4,_0x376cb3[_0x3d52('0x15')]));});});}; \ No newline at end of file +var _0xc2dc=['randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','VerifyAdditionalPhones','CmHopper','findOne','body','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','entity','dialGlobalMaxRetry','countbusyretry','ContactId','ListId','duration','isNil','scheduledat','add','minutes','createdAt','updatedAt','phone','countagentrejectretry','sequelize','transaction','update','IncrementPreviewCounters','field','lodash','util','bluebird'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xc2dc,0x106));var _0xcc2d=function(_0x4df17c,_0x2d2b61){_0x4df17c=_0x4df17c-0x0;var _0x4e79b5=_0xc2dc[_0x4df17c];return _0x4e79b5;};'use strict';var _=require(_0xcc2d('0x0'));var util=require(_0xcc2d('0x1'));var moment=require('moment');var BPromise=require(_0xcc2d('0x2'));var rs=require(_0xcc2d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcc2d('0x4'));var logger=require(_0xcc2d('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcc2d('0x6'));var client=jayson[_0xcc2d('0x7')][_0xcc2d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x564a61,_0x5473b0,_0x85f68a){return new BPromise(function(_0x4263f8,_0x592631){return client[_0xcc2d('0x9')](_0x564a61,_0x85f68a)[_0xcc2d('0xa')](function(_0x86b31e){logger['info'](_0xcc2d('0xb'),_0x5473b0,_0xcc2d('0xc'));logger[_0xcc2d('0xd')](_0xcc2d('0xe'),_0x5473b0,'request\x20sent',JSON[_0xcc2d('0xf')](_0x86b31e));if(_0x86b31e[_0xcc2d('0x10')]){if(_0x86b31e[_0xcc2d('0x10')]['code']===0x1f4){logger[_0xcc2d('0x10')](_0xcc2d('0xb'),_0x5473b0,_0x86b31e[_0xcc2d('0x10')]['message']);return _0x592631(_0x86b31e['error']['message']);}logger[_0xcc2d('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x5473b0,_0x86b31e[_0xcc2d('0x10')]['message']);return _0x4263f8(_0x86b31e[_0xcc2d('0x10')][_0xcc2d('0x11')]);}else{logger['info'](_0xcc2d('0xb'),_0x5473b0,_0xcc2d('0xc'));_0x4263f8(_0x86b31e['result']['message']);}})[_0xcc2d('0x12')](function(_0x2511b3){logger['error'](_0xcc2d('0xb'),_0x5473b0,_0x2511b3);_0x592631(_0x2511b3);});});}exports[_0xcc2d('0x13')]=function(_0x24a1d7){var _0x2e9bb1=this;return new Promise(function(_0x19b156,_0xb3e88){return db[_0xcc2d('0x14')][_0xcc2d('0x15')]({'raw':!![],'where':{'ContactId':_0x24a1d7[_0xcc2d('0x16')]['ContactId'],'ListId':_0x24a1d7[_0xcc2d('0x16')]['ListId'],'VoiceQueueId':_0x24a1d7['body'][_0xcc2d('0x17')]===undefined?null:_0x24a1d7[_0xcc2d('0x16')][_0xcc2d('0x17')],'CampaignId':_0x24a1d7['body']['CampaignId']===undefined?null:_0x24a1d7[_0xcc2d('0x16')][_0xcc2d('0x18')]}})[_0xcc2d('0xa')](function(_0x5ef3c0){if(_0x5ef3c0!=null){return db[_0xcc2d('0x19')][_0xcc2d('0x15')]({'raw':!![],'where':{'CmHopperId':_0x5ef3c0['id'],'OrderBy':{'$gt':_0x5ef3c0[_0xcc2d('0x1a')]}},'order':[[_0xcc2d('0x1a'),_0xcc2d('0x1b')]]})['then'](function(_0xdcf904){var _0xe84c06=0x0;if(_0xdcf904){if(_0xdcf904['countbusyretry']+_0xdcf904[_0xcc2d('0x1c')]+_0xdcf904[_0xcc2d('0x1d')]+_0xdcf904[_0xcc2d('0x1e')]+_0xdcf904[_0xcc2d('0x1f')]+_0xdcf904[_0xcc2d('0x20')]+_0xdcf904[_0xcc2d('0x21')]+_0xdcf904['countagentrejectretry']<_0x24a1d7[_0xcc2d('0x22')][_0xcc2d('0x23')])_0xe84c06=0x1;_0x19b156({'additional':_0xe84c06});}else{return db[_0xcc2d('0x19')][_0xcc2d('0x15')]({'raw':!![],'where':{'CmHopperId':_0x5ef3c0['id']},'order':[['OrderBy','ASC']]})[_0xcc2d('0xa')](function(_0x1d826d){var _0x52ac51=0x0;if(_0x1d826d){if(_0x1d826d[_0xcc2d('0x24')]+_0x1d826d[_0xcc2d('0x1c')]+_0x1d826d['countnoanswerretry']+_0x1d826d[_0xcc2d('0x1e')]+_0x1d826d[_0xcc2d('0x1f')]+_0x1d826d[_0xcc2d('0x20')]+_0x1d826d[_0xcc2d('0x21')]+_0x1d826d['countagentrejectretry']<_0x24a1d7['entity'][_0xcc2d('0x23')])_0x52ac51=0x1;_0x19b156({'additional':_0x52ac51});}else{_0x19b156({'additional':0x0});}})['catch'](function(_0x38713f){logger[_0xcc2d('0x10')](_0xcc2d('0x13'),_0x38713f['message']);_0xb3e88(_0x2e9bb1[_0xcc2d('0x10')](0x1f4,_0x38713f['message']));});}})['catch'](function(_0x25e24a){logger[_0xcc2d('0x10')](_0xcc2d('0x13'),_0x25e24a[_0xcc2d('0x11')]);_0xb3e88(_0x2e9bb1['error'](0x1f4,_0x25e24a['message']));});}else _0x19b156({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x438e0d){var _0x164f20=this;return new Promise(function(_0x2588c7,_0x4485b1){return db[_0xcc2d('0x14')]['findOne']({'raw':!![],'where':{'ContactId':_0x438e0d['body'][_0xcc2d('0x25')],'ListId':_0x438e0d[_0xcc2d('0x16')][_0xcc2d('0x26')],'VoiceQueueId':_0x438e0d['body'][_0xcc2d('0x17')]===undefined?null:_0x438e0d[_0xcc2d('0x16')][_0xcc2d('0x17')],'CampaignId':_0x438e0d[_0xcc2d('0x16')][_0xcc2d('0x18')]===undefined?null:_0x438e0d[_0xcc2d('0x16')][_0xcc2d('0x18')]}})[_0xcc2d('0xa')](function(_0x3252b1){if(_0x3252b1!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x3252b1['id'],'OrderBy':{'$gte':_0x3252b1['OrderBy']}},'order':[['OrderBy',_0xcc2d('0x1b')]]})[_0xcc2d('0xa')](function(_0x4221f1){if(_0x4221f1)return activateAdditionalPhone(_0x3252b1,_0x438e0d[_0xcc2d('0x16')],_0x4221f1,_0x438e0d[_0xcc2d('0x27')],_0x438e0d['waitTime'])['then'](function(_0x1c364e){_0x2588c7(_0x1c364e);});else{return db[_0xcc2d('0x19')][_0xcc2d('0x15')]({'raw':!![],'where':{'CmHopperId':_0x3252b1['id']},'order':[[_0xcc2d('0x1a'),'ASC']]})[_0xcc2d('0xa')](function(_0x12b2fa){if(_0x12b2fa)return activateAdditionalPhone(_0x3252b1,_0x438e0d['body'],_0x12b2fa,_0x438e0d[_0xcc2d('0x27')],_0x438e0d['waitTime'])[_0xcc2d('0xa')](function(_0x1679d0){_0x2588c7(_0x1679d0);});else{_0x2588c7({'id':_0x3252b1['id'],'phone':''});}})[_0xcc2d('0x12')](function(_0x5246c2){logger[_0xcc2d('0x10')]('VerifyAdditionalPhones',_0x5246c2[_0xcc2d('0x11')]);_0x4485b1(_0x164f20[_0xcc2d('0x10')](0x1f4,_0x5246c2['message']));});}})[_0xcc2d('0x12')](function(_0x1dfb26){logger['error'](_0xcc2d('0x13'),_0x1dfb26[_0xcc2d('0x11')]);_0x4485b1(_0x164f20[_0xcc2d('0x10')](0x1f4,_0x1dfb26[_0xcc2d('0x11')]));});}else _0x2588c7(0x1);});});};function activateAdditionalPhone(_0x113d1b,_0x109d8d,_0x4a92b8,_0x103629,_0x3bc492){return new Promise(function(_0x5da8c0,_0x38819b){var _0x393929;if(_[_0xcc2d('0x28')](_0x4a92b8[_0xcc2d('0x29')])){_0x4a92b8[_0xcc2d('0x29')]=moment();}if(moment()>moment(_0x4a92b8['scheduledat'])){_0x393929=moment()[_0xcc2d('0x2a')](_0x3bc492||0x3,_0xcc2d('0x2b'));}else{if(_0x4a92b8[_0xcc2d('0x1a')]==0x0){_0x393929=moment(_0x4a92b8[_0xcc2d('0x29')]);}else{_0x393929=moment()[_0xcc2d('0x2a')](_0x3bc492||0x3,_0xcc2d('0x2b'));}}if(_[_0xcc2d('0x28')](_0x393929)){_0x393929=moment()['add'](_0x3bc492||0x3,'minutes');}var _0x432aaa={'phone':_0x113d1b['phone'],'active':0x0,'OrderBy':_[_0xcc2d('0x28')](_0x113d1b['OrderBy'])?0x0:_0x113d1b['OrderBy'],'scheduledat':moment()[_0xcc2d('0x2a')](_0x103629||0x1,'minutes'),'countbusyretry':_0x109d8d['countbusyretry'],'countcongestionretry':_0x109d8d['countcongestionretry'],'countnoanswerretry':_0x109d8d[_0xcc2d('0x1d')],'countnosuchnumberretry':_0x109d8d[_0xcc2d('0x1e')],'countdropretry':_0x109d8d[_0xcc2d('0x1f')],'countabandonedretry':_0x109d8d['countabandonedretry'],'countmachineretry':_0x109d8d[_0xcc2d('0x21')],'countagentrejectretry':_0x109d8d['countagentrejectretry'],'createdAt':_0x109d8d[_0xcc2d('0x2c')],'updatedAt':_0x109d8d[_0xcc2d('0x2d')]};var _0x1eb8d7={'CmHopperId':_0x113d1b['id'],'phone':_0x4a92b8[_0xcc2d('0x2e')],'active':0x0,'OrderBy':_[_0xcc2d('0x28')](_0x4a92b8[_0xcc2d('0x1a')])?0x0:_0x4a92b8[_0xcc2d('0x1a')],'scheduledat':_0x393929,'countbusyretry':_0x4a92b8['countbusyretry'],'countcongestionretry':_0x4a92b8[_0xcc2d('0x1c')],'countnoanswerretry':_0x4a92b8[_0xcc2d('0x1d')],'countnosuchnumberretry':_0x4a92b8[_0xcc2d('0x1e')],'countdropretry':_0x4a92b8[_0xcc2d('0x1f')],'countabandonedretry':_0x4a92b8['countabandonedretry'],'countmachineretry':_0x4a92b8[_0xcc2d('0x21')],'countagentrejectretry':_0x4a92b8[_0xcc2d('0x2f')],'createdAt':_0x4a92b8[_0xcc2d('0x2c')],'updatedAt':_0x4a92b8[_0xcc2d('0x2d')]};return db[_0xcc2d('0x30')][_0xcc2d('0x31')](function(_0x493072){return db[_0xcc2d('0x19')][_0xcc2d('0x32')](_0x432aaa,{'where':{'id':_0x4a92b8['id']}},{'transaction':_0x493072})[_0xcc2d('0xa')](function(){return db['CmHopper'][_0xcc2d('0x32')](_0x1eb8d7,{'where':{'id':_0x113d1b['id']}},{'transaction':_0x493072});});})[_0xcc2d('0xa')](function(_0x1e6c8e){_0x5da8c0({'id':_0x113d1b['id'],'phone':_0x4a92b8[_0xcc2d('0x2e')]});})[_0xcc2d('0x12')](function(_0x101b83){logger[_0xcc2d('0x10')]('activateAdditionalPhone',_0x101b83[_0xcc2d('0x11')]);_0x38819b({'error':_0x101b83[_0xcc2d('0x11')]});});});}exports[_0xcc2d('0x33')]=function(_0x529913){var _0x4bffa0=this;return new Promise(function(_0x17de67,_0x50f728){return db[_0xcc2d('0x14')][_0xcc2d('0x32')](_0x529913[_0xcc2d('0x16')][_0xcc2d('0x34')],{'where':{'id':_0x529913[_0xcc2d('0x16')]['id']}})[_0xcc2d('0xa')](function(_0x4a7350){_0x17de67(_0x4a7350);})[_0xcc2d('0x12')](function(_0x1324cf){logger['error'](_0xcc2d('0x33'),_0x1324cf[_0xcc2d('0x11')]);_0x50f728(_0x4bffa0[_0xcc2d('0x10')](0x1f4,_0x1324cf[_0xcc2d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index fe8a85a..c1edc2d 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 _0xad1b=['../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xad1b,0x1b0));var _0xbad1=function(_0x4d366b,_0x3b6ea1){_0x4d366b=_0x4d366b-0x0;var _0x113e2e=_0xad1b[_0x4d366b];return _0x113e2e;};'use strict';var multer=require(_0xbad1('0x0'));var util=require(_0xbad1('0x1'));var path=require(_0xbad1('0x2'));var timeout=require(_0xbad1('0x3'));var express=require(_0xbad1('0x4'));var router=express[_0xbad1('0x5')]();var fs_extra=require(_0xbad1('0x6'));var auth=require(_0xbad1('0x7'));var interaction=require(_0xbad1('0x8'));var config=require(_0xbad1('0x9'));var controller=require(_0xbad1('0xa'));router[_0xbad1('0xb')]('/',auth[_0xbad1('0xc')](),controller[_0xbad1('0xd')]);router[_0xbad1('0xb')](_0xbad1('0xe'),auth[_0xbad1('0xc')](),controller[_0xbad1('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbad1('0x10')]);router[_0xbad1('0x11')]('/:id',auth[_0xbad1('0xc')](),controller[_0xbad1('0x12')]);router[_0xbad1('0x13')](_0xbad1('0xe'),auth[_0xbad1('0xc')](),controller[_0xbad1('0x14')]);module[_0xbad1('0x15')]=router; \ No newline at end of file +var _0x42cd=['post','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','/:id'];(function(_0x79a20c,_0x3172c5){var _0xc50dc1=function(_0x36280f){while(--_0x36280f){_0x79a20c['push'](_0x79a20c['shift']());}};_0xc50dc1(++_0x3172c5);}(_0x42cd,0x17f));var _0xd42c=function(_0x5b3c90,_0x45b28c){_0x5b3c90=_0x5b3c90-0x0;var _0xd1ae5e=_0x42cd[_0x5b3c90];return _0xd1ae5e;};'use strict';var multer=require(_0xd42c('0x0'));var util=require('util');var path=require(_0xd42c('0x1'));var timeout=require(_0xd42c('0x2'));var express=require(_0xd42c('0x3'));var router=express[_0xd42c('0x4')]();var fs_extra=require(_0xd42c('0x5'));var auth=require(_0xd42c('0x6'));var interaction=require(_0xd42c('0x7'));var config=require(_0xd42c('0x8'));var controller=require(_0xd42c('0x9'));router[_0xd42c('0xa')]('/',auth[_0xd42c('0xb')](),controller['index']);router[_0xd42c('0xa')](_0xd42c('0xc'),auth[_0xd42c('0xb')](),controller['show']);router[_0xd42c('0xd')]('/',auth[_0xd42c('0xb')](),controller['create']);router['put'](_0xd42c('0xc'),auth[_0xd42c('0xb')](),controller[_0xd42c('0xe')]);router[_0xd42c('0xf')](_0xd42c('0xc'),auth[_0xd42c('0xb')](),controller[_0xd42c('0x10')]);module[_0xd42c('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index a6ccd00..666edf6 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 _0x2755=['moment','exports','STRING','INTEGER','contactListQueue'];(function(_0xf89475,_0x5a94d7){var _0x3e4bb0=function(_0x19772e){while(--_0x19772e){_0xf89475['push'](_0xf89475['shift']());}};_0x3e4bb0(++_0x5a94d7);}(_0x2755,0x19a));var _0x5275=function(_0x3e9582,_0x5ef882){_0x3e9582=_0x3e9582-0x0;var _0xdf59d7=_0x2755[_0x3e9582];return _0xdf59d7;};'use strict';var moment=require(_0x5275('0x0'));var Sequelize=require('sequelize');module[_0x5275('0x1')]={'phone':{'type':Sequelize[_0x5275('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x5275('0x3')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x5275('0x3')],'unique':_0x5275('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x5275('0x4')}}; \ No newline at end of file +var _0x746f=['moment','sequelize','exports','STRING','INTEGER','contactListQueue'];(function(_0x398ce1,_0x5caa9f){var _0x56ba21=function(_0x23cea0){while(--_0x23cea0){_0x398ce1['push'](_0x398ce1['shift']());}};_0x56ba21(++_0x5caa9f);}(_0x746f,0x9c));var _0xf746=function(_0x58342f,_0x1b929f){_0x58342f=_0x58342f-0x0;var _0x4656ee=_0x746f[_0x58342f];return _0x4656ee;};'use strict';var moment=require(_0xf746('0x0'));var Sequelize=require(_0xf746('0x1'));module[_0xf746('0x2')]={'phone':{'type':Sequelize[_0xf746('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xf746('0x4')],'unique':_0xf746('0x5')},'ListId':{'type':Sequelize[_0xf746('0x4')],'unique':_0xf746('0x5')},'VoiceQueueId':{'type':Sequelize[_0xf746('0x4')],'unique':_0xf746('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 2b9bba3..aa277f5 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 _0xb072=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','undefined','offset','limit','set','save','update','then','error','stack','name','send','index','CmHopperBlack','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','find','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce'];(function(_0x1088e1,_0x7b90bf){var _0x463449=function(_0x252a93){while(--_0x252a93){_0x1088e1['push'](_0x1088e1['shift']());}};_0x463449(++_0x7b90bf);}(_0xb072,0x1a7));var _0x2b07=function(_0x3050ab,_0x3f2b58){_0x3050ab=_0x3050ab-0x0;var _0x4dba35=_0xb072[_0x3050ab];return _0x4dba35;};'use strict';var emlformat=require(_0x2b07('0x0'));var rimraf=require(_0x2b07('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2b07('0x2'));var rp=require(_0x2b07('0x3'));var moment=require(_0x2b07('0x4'));var BPromise=require(_0x2b07('0x5'));var Mustache=require(_0x2b07('0x6'));var util=require(_0x2b07('0x7'));var path=require(_0x2b07('0x8'));var sox=require(_0x2b07('0x9'));var csv=require(_0x2b07('0xa'));var ejs=require(_0x2b07('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2b07('0xc'));var squel=require(_0x2b07('0xd'));var crypto=require('crypto');var jsforce=require(_0x2b07('0xe'));var deskjs=require(_0x2b07('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2b07('0x10'));var Papa=require(_0x2b07('0x11'));var Redis=require(_0x2b07('0x12'));var authService=require(_0x2b07('0x13'));var qs=require(_0x2b07('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2b07('0x15'))(_0x2b07('0x16'));var utils=require(_0x2b07('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2b07('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x276354,_0x3c0126){_0x3c0126=_0x3c0126||0xcc;return function(_0xa11cde){if(_0xa11cde){return _0x276354[_0x2b07('0x19')](_0x3c0126);}return _0x276354[_0x2b07('0x1a')](_0x3c0126)['end']();};}function respondWithResult(_0x592a8d,_0x212ab1){_0x212ab1=_0x212ab1||0xc8;return function(_0x474a63){if(_0x474a63){return _0x592a8d[_0x2b07('0x1a')](_0x212ab1)[_0x2b07('0x1b')](_0x474a63);}};}function respondWithFilteredResult(_0x17d911,_0x1fec24){return function(_0x2fd99e){if(_0x2fd99e){var _0x4df5d5=typeof _0x1fec24['offset']===_0x2b07('0x1c')&&typeof _0x1fec24['limit']==='undefined';var _0x362140=_0x2fd99e['count'];var _0x518d2d=_0x4df5d5?0x0:_0x1fec24[_0x2b07('0x1d')];var _0x2904ff=_0x4df5d5?_0x2fd99e['count']:_0x1fec24[_0x2b07('0x1d')]+_0x1fec24[_0x2b07('0x1e')];var _0x477077;if(_0x2904ff>=_0x362140){_0x2904ff=_0x362140;_0x477077=0xc8;}else{_0x477077=0xce;}_0x17d911[_0x2b07('0x1a')](_0x477077);return _0x17d911[_0x2b07('0x1f')]('Content-Range',_0x518d2d+'-'+_0x2904ff+'/'+_0x362140)[_0x2b07('0x1b')](_0x2fd99e);}return null;};}function patchUpdates(_0x184cae){return function(_0xb0fa34){try{jsonpatch['apply'](_0xb0fa34,_0x184cae,!![]);}catch(_0x329e66){return BPromise['reject'](_0x329e66);}return _0xb0fa34[_0x2b07('0x20')]();};}function saveUpdates(_0x5a10f0,_0x27936f){return function(_0xd46102){if(_0xd46102){return _0xd46102[_0x2b07('0x21')](_0x5a10f0)[_0x2b07('0x22')](function(_0x10cd2){return _0x10cd2;});}return null;};}function removeEntity(_0x1c0c47,_0x4e8cd9){return function(_0x14ee3d){if(_0x14ee3d){return _0x14ee3d['destroy']()['then'](function(){_0x1c0c47[_0x2b07('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34d9a2,_0x3b1f3f){return function(_0x41e761){if(!_0x41e761){_0x34d9a2[_0x2b07('0x19')](0x194);}return _0x41e761;};}function handleError(_0x4e9362,_0x2647e7){_0x2647e7=_0x2647e7||0x1f4;return function(_0x3944fa){logger[_0x2b07('0x23')](_0x3944fa[_0x2b07('0x24')]);if(_0x3944fa[_0x2b07('0x25')]){delete _0x3944fa[_0x2b07('0x25')];}_0x4e9362['status'](_0x2647e7)[_0x2b07('0x26')](_0x3944fa);};}exports[_0x2b07('0x27')]=function(_0xfa9491,_0x401327){var _0x549c4e={},_0x33d312={},_0x154054={'count':0x0,'rows':[]};var _0x54d08a=_['map'](db[_0x2b07('0x28')][_0x2b07('0x29')],function(_0x43f1e6){return{'name':_0x43f1e6[_0x2b07('0x2a')],'type':_0x43f1e6[_0x2b07('0x2b')][_0x2b07('0x2c')]};});_0x33d312[_0x2b07('0x2d')]=_[_0x2b07('0x2e')](_0x54d08a,_0x2b07('0x25'));_0x33d312[_0x2b07('0x2f')]=_[_0x2b07('0x30')](_0xfa9491[_0x2b07('0x2f')]);_0x33d312['filters']=_[_0x2b07('0x31')](_0x33d312[_0x2b07('0x2d')],_0x33d312[_0x2b07('0x2f')]);_0x549c4e[_0x2b07('0x32')]=_[_0x2b07('0x31')](_0x33d312['model'],qs['fields'](_0xfa9491[_0x2b07('0x2f')][_0x2b07('0x33')]));_0x549c4e['attributes']=_0x549c4e[_0x2b07('0x32')][_0x2b07('0x34')]?_0x549c4e[_0x2b07('0x32')]:_0x33d312[_0x2b07('0x2d')];if(!_0xfa9491[_0x2b07('0x2f')][_0x2b07('0x35')](_0x2b07('0x36'))){_0x549c4e[_0x2b07('0x1e')]=qs[_0x2b07('0x1e')](_0xfa9491['query']['limit']);_0x549c4e[_0x2b07('0x1d')]=qs[_0x2b07('0x1d')](_0xfa9491['query'][_0x2b07('0x1d')]);}_0x549c4e[_0x2b07('0x37')]=qs[_0x2b07('0x38')](_0xfa9491[_0x2b07('0x2f')][_0x2b07('0x38')]);_0x549c4e[_0x2b07('0x39')]=qs[_0x2b07('0x3a')](_['pick'](_0xfa9491['query'],_0x33d312['filters']),_0x54d08a);if(_0xfa9491[_0x2b07('0x2f')][_0x2b07('0x3b')]){_0x549c4e['where']=_[_0x2b07('0x3c')](_0x549c4e['where'],{'$or':_[_0x2b07('0x2e')](_0x54d08a,function(_0x4f80a8){if(_0x4f80a8[_0x2b07('0x2b')]!==_0x2b07('0x3d')){var _0x415786={};_0x415786[_0x4f80a8['name']]={'$like':'%'+_0xfa9491[_0x2b07('0x2f')]['filter']+'%'};return _0x415786;}})});}_0x549c4e=_['merge']({},_0x549c4e,_0xfa9491[_0x2b07('0x3e')]);var _0x42dab1={'where':_0x549c4e[_0x2b07('0x39')]};return db['CmHopperBlack'][_0x2b07('0x3f')](_0x42dab1)[_0x2b07('0x22')](function(_0x4e81ac){_0x154054['count']=_0x4e81ac;if(_0xfa9491[_0x2b07('0x2f')][_0x2b07('0x40')]){_0x549c4e[_0x2b07('0x41')]=[{'all':!![]}];}return db[_0x2b07('0x28')]['findAll'](_0x549c4e);})[_0x2b07('0x22')](function(_0x3eca51){_0x154054[_0x2b07('0x42')]=_0x3eca51;return _0x154054;})[_0x2b07('0x22')](respondWithFilteredResult(_0x401327,_0x549c4e))[_0x2b07('0x43')](handleError(_0x401327,null));};exports[_0x2b07('0x44')]=function(_0xed80a9,_0x3b0613){var _0x17df96={'raw':!![],'where':{'id':_0xed80a9[_0x2b07('0x45')]['id']}},_0x564aa6={};_0x564aa6[_0x2b07('0x2d')]=_[_0x2b07('0x30')](db[_0x2b07('0x28')]['rawAttributes']);_0x564aa6['query']=_['keys'](_0xed80a9['query']);_0x564aa6['filters']=_['intersection'](_0x564aa6[_0x2b07('0x2d')],_0x564aa6[_0x2b07('0x2f')]);_0x17df96[_0x2b07('0x32')]=_[_0x2b07('0x31')](_0x564aa6[_0x2b07('0x2d')],qs[_0x2b07('0x33')](_0xed80a9[_0x2b07('0x2f')]['fields']));_0x17df96[_0x2b07('0x32')]=_0x17df96[_0x2b07('0x32')]['length']?_0x17df96[_0x2b07('0x32')]:_0x564aa6[_0x2b07('0x2d')];if(_0xed80a9[_0x2b07('0x2f')]['includeAll']){_0x17df96[_0x2b07('0x41')]=[{'all':!![]}];}_0x17df96=_[_0x2b07('0x3c')]({},_0x17df96,_0xed80a9[_0x2b07('0x3e')]);return db[_0x2b07('0x28')][_0x2b07('0x46')](_0x17df96)[_0x2b07('0x22')](handleEntityNotFound(_0x3b0613,null))[_0x2b07('0x22')](respondWithResult(_0x3b0613,null))[_0x2b07('0x43')](handleError(_0x3b0613,null));};exports[_0x2b07('0x21')]=function(_0x4928b8,_0x712c89){if(_0x4928b8['body']['id']){delete _0x4928b8['body']['id'];}return db['CmHopperBlack'][_0x2b07('0x46')]({'where':{'id':_0x4928b8[_0x2b07('0x45')]['id']}})[_0x2b07('0x22')](handleEntityNotFound(_0x712c89,null))[_0x2b07('0x22')](saveUpdates(_0x4928b8['body'],null))[_0x2b07('0x22')](respondWithResult(_0x712c89,null))[_0x2b07('0x43')](handleError(_0x712c89,null));};exports[_0x2b07('0x47')]=function(_0xc1aa27,_0xfb8564){return db[_0x2b07('0x28')]['find']({'where':{'id':_0xc1aa27['params']['id']}})[_0x2b07('0x22')](handleEntityNotFound(_0xfb8564,null))[_0x2b07('0x22')](removeEntity(_0xfb8564,null))[_0x2b07('0x43')](handleError(_0xfb8564,null));};exports[_0x2b07('0x48')]=function(_0x122793,_0x524782){return db[_0x2b07('0x28')][_0x2b07('0x48')]()[_0x2b07('0x22')](respondWithResult(_0x524782,null))[_0x2b07('0x43')](handleError(_0x524782,null));}; \ No newline at end of file +var _0xf033=['json','offset','limit','undefined','count','reject','update','destroy','then','end','stack','name','send','map','CmHopperBlack','fieldName','type','model','query','filters','intersection','attributes','length','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','fields','options','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','status'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xf033,0x6e));var _0x3f03=function(_0x35c86f,_0x399bc4){_0x35c86f=_0x35c86f-0x0;var _0x28c841=_0xf033[_0x35c86f];return _0x28c841;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3f03('0x0'));var zipdir=require(_0x3f03('0x1'));var jsonpatch=require(_0x3f03('0x2'));var rp=require(_0x3f03('0x3'));var moment=require(_0x3f03('0x4'));var BPromise=require(_0x3f03('0x5'));var Mustache=require(_0x3f03('0x6'));var util=require(_0x3f03('0x7'));var path=require('path');var sox=require(_0x3f03('0x8'));var csv=require(_0x3f03('0x9'));var ejs=require(_0x3f03('0xa'));var fs=require('fs');var fs_extra=require(_0x3f03('0xb'));var _=require(_0x3f03('0xc'));var squel=require(_0x3f03('0xd'));var crypto=require(_0x3f03('0xe'));var jsforce=require(_0x3f03('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3f03('0x9'));var querystring=require(_0x3f03('0x10'));var Papa=require(_0x3f03('0x11'));var Redis=require(_0x3f03('0x12'));var authService=require(_0x3f03('0x13'));var qs=require(_0x3f03('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3f03('0x15'));var logger=require(_0x3f03('0x16'))(_0x3f03('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3f03('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd2b580,_0x13935d){_0x13935d=_0x13935d||0xcc;return function(_0x27b9ff){if(_0x27b9ff){return _0xd2b580['sendStatus'](_0x13935d);}return _0xd2b580[_0x3f03('0x19')](_0x13935d)['end']();};}function respondWithResult(_0x2333dc,_0x3f9297){_0x3f9297=_0x3f9297||0xc8;return function(_0x2675ab){if(_0x2675ab){return _0x2333dc[_0x3f03('0x19')](_0x3f9297)[_0x3f03('0x1a')](_0x2675ab);}};}function respondWithFilteredResult(_0x447586,_0x28a073){return function(_0x19e916){if(_0x19e916){var _0x561850=typeof _0x28a073[_0x3f03('0x1b')]==='undefined'&&typeof _0x28a073[_0x3f03('0x1c')]===_0x3f03('0x1d');var _0x4c6739=_0x19e916[_0x3f03('0x1e')];var _0x2b14fc=_0x561850?0x0:_0x28a073[_0x3f03('0x1b')];var _0x47ae5b=_0x561850?_0x19e916[_0x3f03('0x1e')]:_0x28a073[_0x3f03('0x1b')]+_0x28a073[_0x3f03('0x1c')];var _0x2a0ab7;if(_0x47ae5b>=_0x4c6739){_0x47ae5b=_0x4c6739;_0x2a0ab7=0xc8;}else{_0x2a0ab7=0xce;}_0x447586['status'](_0x2a0ab7);return _0x447586['set']('Content-Range',_0x2b14fc+'-'+_0x47ae5b+'/'+_0x4c6739)['json'](_0x19e916);}return null;};}function patchUpdates(_0x123635){return function(_0x52e243){try{jsonpatch['apply'](_0x52e243,_0x123635,!![]);}catch(_0x17b310){return BPromise[_0x3f03('0x1f')](_0x17b310);}return _0x52e243['save']();};}function saveUpdates(_0x55a761,_0x5b051b){return function(_0x583f6b){if(_0x583f6b){return _0x583f6b[_0x3f03('0x20')](_0x55a761)['then'](function(_0x58c382){return _0x58c382;});}return null;};}function removeEntity(_0x2563ae,_0x53b864){return function(_0xd39319){if(_0xd39319){return _0xd39319[_0x3f03('0x21')]()[_0x3f03('0x22')](function(){_0x2563ae[_0x3f03('0x19')](0xcc)[_0x3f03('0x23')]();});}};}function handleEntityNotFound(_0x2d6c20,_0x1e0395){return function(_0x2a966d){if(!_0x2a966d){_0x2d6c20['sendStatus'](0x194);}return _0x2a966d;};}function handleError(_0xf4ee6b,_0xb8b2da){_0xb8b2da=_0xb8b2da||0x1f4;return function(_0x4a2135){logger['error'](_0x4a2135[_0x3f03('0x24')]);if(_0x4a2135[_0x3f03('0x25')]){delete _0x4a2135[_0x3f03('0x25')];}_0xf4ee6b['status'](_0xb8b2da)[_0x3f03('0x26')](_0x4a2135);};}exports['index']=function(_0x564d11,_0x1bd7dd){var _0x5022a4={},_0x43c793={},_0x3fd57c={'count':0x0,'rows':[]};var _0x2f59ee=_[_0x3f03('0x27')](db[_0x3f03('0x28')]['rawAttributes'],function(_0x369223){return{'name':_0x369223[_0x3f03('0x29')],'type':_0x369223[_0x3f03('0x2a')]['key']};});_0x43c793[_0x3f03('0x2b')]=_[_0x3f03('0x27')](_0x2f59ee,_0x3f03('0x25'));_0x43c793['query']=_['keys'](_0x564d11[_0x3f03('0x2c')]);_0x43c793[_0x3f03('0x2d')]=_[_0x3f03('0x2e')](_0x43c793['model'],_0x43c793[_0x3f03('0x2c')]);_0x5022a4[_0x3f03('0x2f')]=_['intersection'](_0x43c793[_0x3f03('0x2b')],qs['fields'](_0x564d11[_0x3f03('0x2c')]['fields']));_0x5022a4['attributes']=_0x5022a4[_0x3f03('0x2f')][_0x3f03('0x30')]?_0x5022a4[_0x3f03('0x2f')]:_0x43c793[_0x3f03('0x2b')];if(!_0x564d11[_0x3f03('0x2c')]['hasOwnProperty']('nolimit')){_0x5022a4[_0x3f03('0x1c')]=qs[_0x3f03('0x1c')](_0x564d11[_0x3f03('0x2c')][_0x3f03('0x1c')]);_0x5022a4['offset']=qs[_0x3f03('0x1b')](_0x564d11[_0x3f03('0x2c')][_0x3f03('0x1b')]);}_0x5022a4['order']=qs[_0x3f03('0x31')](_0x564d11[_0x3f03('0x2c')][_0x3f03('0x31')]);_0x5022a4[_0x3f03('0x32')]=qs[_0x3f03('0x2d')](_[_0x3f03('0x33')](_0x564d11[_0x3f03('0x2c')],_0x43c793[_0x3f03('0x2d')]),_0x2f59ee);if(_0x564d11[_0x3f03('0x2c')][_0x3f03('0x34')]){_0x5022a4['where']=_['merge'](_0x5022a4[_0x3f03('0x32')],{'$or':_[_0x3f03('0x27')](_0x2f59ee,function(_0x20e275){if(_0x20e275[_0x3f03('0x2a')]!==_0x3f03('0x35')){var _0x4d2609={};_0x4d2609[_0x20e275[_0x3f03('0x25')]]={'$like':'%'+_0x564d11[_0x3f03('0x2c')][_0x3f03('0x34')]+'%'};return _0x4d2609;}})});}_0x5022a4=_[_0x3f03('0x36')]({},_0x5022a4,_0x564d11['options']);var _0x1a1d8d={'where':_0x5022a4[_0x3f03('0x32')]};return db[_0x3f03('0x28')][_0x3f03('0x1e')](_0x1a1d8d)[_0x3f03('0x22')](function(_0x34bf57){_0x3fd57c[_0x3f03('0x1e')]=_0x34bf57;if(_0x564d11[_0x3f03('0x2c')][_0x3f03('0x37')]){_0x5022a4[_0x3f03('0x38')]=[{'all':!![]}];}return db[_0x3f03('0x28')][_0x3f03('0x39')](_0x5022a4);})[_0x3f03('0x22')](function(_0xbcc9a5){_0x3fd57c[_0x3f03('0x3a')]=_0xbcc9a5;return _0x3fd57c;})['then'](respondWithFilteredResult(_0x1bd7dd,_0x5022a4))[_0x3f03('0x3b')](handleError(_0x1bd7dd,null));};exports['show']=function(_0x526899,_0x948301){var _0x69de84={'raw':!![],'where':{'id':_0x526899[_0x3f03('0x3c')]['id']}},_0x35b6a4={};_0x35b6a4[_0x3f03('0x2b')]=_[_0x3f03('0x3d')](db[_0x3f03('0x28')][_0x3f03('0x3e')]);_0x35b6a4[_0x3f03('0x2c')]=_[_0x3f03('0x3d')](_0x526899[_0x3f03('0x2c')]);_0x35b6a4[_0x3f03('0x2d')]=_[_0x3f03('0x2e')](_0x35b6a4['model'],_0x35b6a4[_0x3f03('0x2c')]);_0x69de84[_0x3f03('0x2f')]=_[_0x3f03('0x2e')](_0x35b6a4[_0x3f03('0x2b')],qs['fields'](_0x526899[_0x3f03('0x2c')][_0x3f03('0x3f')]));_0x69de84[_0x3f03('0x2f')]=_0x69de84[_0x3f03('0x2f')][_0x3f03('0x30')]?_0x69de84[_0x3f03('0x2f')]:_0x35b6a4[_0x3f03('0x2b')];if(_0x526899[_0x3f03('0x2c')][_0x3f03('0x37')]){_0x69de84[_0x3f03('0x38')]=[{'all':!![]}];}_0x69de84=_[_0x3f03('0x36')]({},_0x69de84,_0x526899[_0x3f03('0x40')]);return db[_0x3f03('0x28')]['find'](_0x69de84)[_0x3f03('0x22')](handleEntityNotFound(_0x948301,null))[_0x3f03('0x22')](respondWithResult(_0x948301,null))['catch'](handleError(_0x948301,null));};exports[_0x3f03('0x20')]=function(_0x4a42a0,_0x110188){if(_0x4a42a0[_0x3f03('0x41')]['id']){delete _0x4a42a0[_0x3f03('0x41')]['id'];}return db[_0x3f03('0x28')][_0x3f03('0x42')]({'where':{'id':_0x4a42a0[_0x3f03('0x3c')]['id']}})[_0x3f03('0x22')](handleEntityNotFound(_0x110188,null))['then'](saveUpdates(_0x4a42a0[_0x3f03('0x41')],null))[_0x3f03('0x22')](respondWithResult(_0x110188,null))['catch'](handleError(_0x110188,null));};exports['destroy']=function(_0x38ef61,_0x29ecde){return db['CmHopperBlack'][_0x3f03('0x42')]({'where':{'id':_0x38ef61[_0x3f03('0x3c')]['id']}})[_0x3f03('0x22')](handleEntityNotFound(_0x29ecde,null))[_0x3f03('0x22')](removeEntity(_0x29ecde,null))['catch'](handleError(_0x29ecde,null));};exports[_0x3f03('0x43')]=function(_0x269814,_0xf2b002){return db[_0x3f03('0x28')]['describe']()['then'](respondWithResult(_0xf2b002,null))[_0x3f03('0x3b')](handleError(_0xf2b002,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index d81d7b5..cc07fc2 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 _0xcf03=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','define','CmHopperBlack','lodash'];(function(_0x24d3ea,_0x171385){var _0x538e6c=function(_0x4a50ca){while(--_0x4a50ca){_0x24d3ea['push'](_0x24d3ea['shift']());}};_0x538e6c(++_0x171385);}(_0xcf03,0xaf));var _0x3cf0=function(_0x2826d7,_0x14209e){_0x2826d7=_0x2826d7-0x0;var _0x1547f0=_0xcf03[_0x2826d7];return _0x1547f0;};'use strict';var _=require(_0x3cf0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3cf0('0x1'));var moment=require(_0x3cf0('0x2'));var BPromise=require(_0x3cf0('0x3'));var rp=require(_0x3cf0('0x4'));var fs=require('fs');var path=require(_0x3cf0('0x5'));var rimraf=require(_0x3cf0('0x6'));var config=require(_0x3cf0('0x7'));var attributes=require(_0x3cf0('0x8'));module['exports']=function(_0x4c7537,_0xfad628){return _0x4c7537[_0x3cf0('0x9')](_0x3cf0('0xa'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x71dd=['request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','CmHopperBlack','lodash','../../config/logger','moment','bluebird'];(function(_0x540511,_0x201e3b){var _0x5c1ac6=function(_0xdacf37){while(--_0xdacf37){_0x540511['push'](_0x540511['shift']());}};_0x5c1ac6(++_0x201e3b);}(_0x71dd,0x130));var _0xd71d=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0x71dd[_0x58e469];return _0x4c01c5;};'use strict';var _=require(_0xd71d('0x0'));var util=require('util');var logger=require(_0xd71d('0x1'))('api');var moment=require(_0xd71d('0x2'));var BPromise=require(_0xd71d('0x3'));var rp=require(_0xd71d('0x4'));var fs=require('fs');var path=require(_0xd71d('0x5'));var rimraf=require(_0xd71d('0x6'));var config=require(_0xd71d('0x7'));var attributes=require(_0xd71d('0x8'));module[_0xd71d('0x9')]=function(_0x590080,_0x3eea45){return _0x590080['define'](_0xd71d('0xa'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index a2957f0..4a23d63 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 _0x8853=['map','model','include','info','GetCmHopperBlack','stringify','catch','UpdateCmHopperBlack','update','limit','DestroyCmHopperBlack','destroy','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','code','message','result','CmHopperBlack','findAll','options','raw','where','attributes'];(function(_0x389b08,_0x137a7f){var _0x597a85=function(_0x591968){while(--_0x591968){_0x389b08['push'](_0x389b08['shift']());}};_0x597a85(++_0x137a7f);}(_0x8853,0xac));var _0x3885=function(_0x3ca524,_0x4d689b){_0x3ca524=_0x3ca524-0x0;var _0x360631=_0x8853[_0x3ca524];return _0x360631;};'use strict';var _=require(_0x3885('0x0'));var util=require(_0x3885('0x1'));var moment=require(_0x3885('0x2'));var BPromise=require('bluebird');var rs=require(_0x3885('0x3'));var fs=require('fs');var Redis=require(_0x3885('0x4'));var db=require(_0x3885('0x5'))['db'];var utils=require(_0x3885('0x6'));var logger=require(_0x3885('0x7'))(_0x3885('0x8'));var config=require(_0x3885('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3885('0xa')][_0x3885('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x532790,_0x37a703,_0x2f193d){return new BPromise(function(_0x2ec9a6,_0x32b50a){return client[_0x3885('0xc')](_0x532790,_0x2f193d)[_0x3885('0xd')](function(_0x1f52d0){logger['info'](_0x3885('0xe'),_0x37a703,_0x3885('0xf'));logger[_0x3885('0x10')](_0x3885('0x11'),_0x37a703,'request\x20sent',JSON['stringify'](_0x1f52d0));if(_0x1f52d0[_0x3885('0x12')]){if(_0x1f52d0[_0x3885('0x12')][_0x3885('0x13')]===0x1f4){logger[_0x3885('0x12')](_0x3885('0xe'),_0x37a703,_0x1f52d0[_0x3885('0x12')][_0x3885('0x14')]);return _0x32b50a(_0x1f52d0[_0x3885('0x12')][_0x3885('0x14')]);}logger[_0x3885('0x12')](_0x3885('0xe'),_0x37a703,_0x1f52d0['error']['message']);return _0x2ec9a6(_0x1f52d0['error'][_0x3885('0x14')]);}else{logger['info'](_0x3885('0xe'),_0x37a703,_0x3885('0xf'));_0x2ec9a6(_0x1f52d0[_0x3885('0x15')][_0x3885('0x14')]);}})['catch'](function(_0x562a02){logger[_0x3885('0x12')](_0x3885('0xe'),_0x37a703,_0x562a02);_0x32b50a(_0x562a02);});});}exports['GetCmHopperBlack']=function(_0x277140){var _0x341608=this;return new Promise(function(_0x3d71a9,_0x47ab0f){return db[_0x3885('0x16')][_0x3885('0x17')]({'raw':_0x277140[_0x3885('0x18')]?_0x277140['options'][_0x3885('0x19')]===undefined?!![]:![]:!![],'where':_0x277140[_0x3885('0x18')]?_0x277140[_0x3885('0x18')][_0x3885('0x1a')]||null:null,'attributes':_0x277140[_0x3885('0x18')]?_0x277140['options'][_0x3885('0x1b')]||null:null,'limit':_0x277140[_0x3885('0x18')]?_0x277140['options']['limit']||null:null,'include':_0x277140[_0x3885('0x18')]?_0x277140['options']['include']?_[_0x3885('0x1c')](_0x277140[_0x3885('0x18')]['include'],function(_0x4100c1){return{'model':db[_0x4100c1['model']],'as':_0x4100c1['as'],'attributes':_0x4100c1['attributes'],'include':_0x4100c1['include']?_[_0x3885('0x1c')](_0x4100c1['include'],function(_0x36b413){return{'model':db[_0x36b413[_0x3885('0x1d')]],'as':_0x36b413['as'],'attributes':_0x36b413['attributes'],'include':_0x36b413[_0x3885('0x1e')]?_[_0x3885('0x1c')](_0x36b413[_0x3885('0x1e')],function(_0x90376b){return{'model':db[_0x90376b[_0x3885('0x1d')]],'as':_0x90376b['as'],'attributes':_0x90376b[_0x3885('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ae7b2){logger[_0x3885('0x1f')](_0x3885('0x20'),_0x277140);logger[_0x3885('0x10')](_0x3885('0x20'),_0x277140,JSON[_0x3885('0x21')](_0x2ae7b2));_0x3d71a9(_0x2ae7b2);})[_0x3885('0x22')](function(_0x391d98){logger[_0x3885('0x12')](_0x3885('0x20'),_0x391d98[_0x3885('0x14')],_0x277140);_0x47ab0f(_0x341608[_0x3885('0x12')](0x1f4,_0x391d98['message']));});});};exports[_0x3885('0x23')]=function(_0x18eb50){var _0x15ae4c=this;return new Promise(function(_0x31be74,_0x36e554){return db[_0x3885('0x16')][_0x3885('0x24')](_0x18eb50['body'],{'raw':_0x18eb50[_0x3885('0x18')]?_0x18eb50[_0x3885('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18eb50[_0x3885('0x18')]?_0x18eb50['options']['where']||null:null,'attributes':_0x18eb50[_0x3885('0x18')]?_0x18eb50['options']['attributes']||null:null,'limit':_0x18eb50[_0x3885('0x18')]?_0x18eb50[_0x3885('0x18')][_0x3885('0x25')]||null:null})['then'](function(_0x2c8269){logger[_0x3885('0x1f')](_0x3885('0x23'),_0x18eb50);logger[_0x3885('0x10')](_0x3885('0x23'),_0x18eb50,JSON[_0x3885('0x21')](_0x2c8269));_0x31be74(_0x2c8269);})['catch'](function(_0x348e41){logger[_0x3885('0x12')]('UpdateCmHopperBlack',_0x348e41[_0x3885('0x14')],_0x18eb50);_0x36e554(_0x15ae4c[_0x3885('0x12')](0x1f4,_0x348e41['message']));});});};exports[_0x3885('0x26')]=function(_0x1e4cba){var _0x2cbcba=this;return new Promise(function(_0x33bdbf,_0x4e27d7){return db['CmHopperBlack'][_0x3885('0x27')]({'where':_0x1e4cba[_0x3885('0x18')]?_0x1e4cba[_0x3885('0x18')]['where']||null:null})[_0x3885('0xd')](function(_0x50c9d3){logger[_0x3885('0x1f')]('DestroyCmHopperBlack',_0x1e4cba);logger[_0x3885('0x10')](_0x3885('0x26'),_0x1e4cba,JSON[_0x3885('0x21')](_0x50c9d3));_0x33bdbf(_0x50c9d3);})[_0x3885('0x22')](function(_0x15ad22){logger[_0x3885('0x12')](_0x3885('0x26'),_0x15ad22[_0x3885('0x14')],_0x1e4cba);_0x4e27d7(_0x2cbcba[_0x3885('0x12')](0x1f4,_0x15ad22[_0x3885('0x14')]));});});}; \ No newline at end of file +var _0x2cc1=['update','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','result','GetCmHopperBlack','CmHopperBlack','options','raw','where','attributes','limit','include','map','model','info','catch','UpdateCmHopperBlack'];(function(_0x29bc4c,_0x5b943d){var _0x4e74bc=function(_0x3050aa){while(--_0x3050aa){_0x29bc4c['push'](_0x29bc4c['shift']());}};_0x4e74bc(++_0x5b943d);}(_0x2cc1,0x75));var _0x12cc=function(_0x57120e,_0x427d2d){_0x57120e=_0x57120e-0x0;var _0x1539f5=_0x2cc1[_0x57120e];return _0x1539f5;};'use strict';var _=require(_0x12cc('0x0'));var util=require(_0x12cc('0x1'));var moment=require(_0x12cc('0x2'));var BPromise=require(_0x12cc('0x3'));var rs=require(_0x12cc('0x4'));var fs=require('fs');var Redis=require(_0x12cc('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x12cc('0x6'))(_0x12cc('0x7'));var config=require(_0x12cc('0x8'));var jayson=require(_0x12cc('0x9'));var client=jayson[_0x12cc('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48360f,_0x3c102f,_0x163363){return new BPromise(function(_0x11e5b7,_0x1f8b99){return client[_0x12cc('0xb')](_0x48360f,_0x163363)[_0x12cc('0xc')](function(_0x249dd7){logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x3c102f,_0x12cc('0xd'));logger[_0x12cc('0xe')](_0x12cc('0xf'),_0x3c102f,'request\x20sent',JSON[_0x12cc('0x10')](_0x249dd7));if(_0x249dd7['error']){if(_0x249dd7[_0x12cc('0x11')][_0x12cc('0x12')]===0x1f4){logger[_0x12cc('0x11')](_0x12cc('0x13'),_0x3c102f,_0x249dd7[_0x12cc('0x11')][_0x12cc('0x14')]);return _0x1f8b99(_0x249dd7['error'][_0x12cc('0x14')]);}logger[_0x12cc('0x11')](_0x12cc('0x13'),_0x3c102f,_0x249dd7['error'][_0x12cc('0x14')]);return _0x11e5b7(_0x249dd7[_0x12cc('0x11')][_0x12cc('0x14')]);}else{logger['info'](_0x12cc('0x13'),_0x3c102f,'request\x20sent');_0x11e5b7(_0x249dd7[_0x12cc('0x15')]['message']);}})['catch'](function(_0x38f340){logger[_0x12cc('0x11')](_0x12cc('0x13'),_0x3c102f,_0x38f340);_0x1f8b99(_0x38f340);});});}exports[_0x12cc('0x16')]=function(_0x35bb23){var _0x29ba06=this;return new Promise(function(_0x4c5205,_0x58a926){return db[_0x12cc('0x17')]['findAll']({'raw':_0x35bb23[_0x12cc('0x18')]?_0x35bb23[_0x12cc('0x18')][_0x12cc('0x19')]===undefined?!![]:![]:!![],'where':_0x35bb23[_0x12cc('0x18')]?_0x35bb23['options'][_0x12cc('0x1a')]||null:null,'attributes':_0x35bb23['options']?_0x35bb23[_0x12cc('0x18')][_0x12cc('0x1b')]||null:null,'limit':_0x35bb23[_0x12cc('0x18')]?_0x35bb23[_0x12cc('0x18')][_0x12cc('0x1c')]||null:null,'include':_0x35bb23[_0x12cc('0x18')]?_0x35bb23[_0x12cc('0x18')][_0x12cc('0x1d')]?_[_0x12cc('0x1e')](_0x35bb23['options'][_0x12cc('0x1d')],function(_0x29c75e){return{'model':db[_0x29c75e[_0x12cc('0x1f')]],'as':_0x29c75e['as'],'attributes':_0x29c75e[_0x12cc('0x1b')],'include':_0x29c75e['include']?_[_0x12cc('0x1e')](_0x29c75e[_0x12cc('0x1d')],function(_0x1eb81b){return{'model':db[_0x1eb81b[_0x12cc('0x1f')]],'as':_0x1eb81b['as'],'attributes':_0x1eb81b[_0x12cc('0x1b')],'include':_0x1eb81b[_0x12cc('0x1d')]?_[_0x12cc('0x1e')](_0x1eb81b[_0x12cc('0x1d')],function(_0x28228f){return{'model':db[_0x28228f['model']],'as':_0x28228f['as'],'attributes':_0x28228f[_0x12cc('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x12cc('0xc')](function(_0x1cb95a){logger[_0x12cc('0x20')](_0x12cc('0x16'),_0x35bb23);logger['debug']('GetCmHopperBlack',_0x35bb23,JSON[_0x12cc('0x10')](_0x1cb95a));_0x4c5205(_0x1cb95a);})[_0x12cc('0x21')](function(_0x1c13b2){logger[_0x12cc('0x11')](_0x12cc('0x16'),_0x1c13b2[_0x12cc('0x14')],_0x35bb23);_0x58a926(_0x29ba06[_0x12cc('0x11')](0x1f4,_0x1c13b2[_0x12cc('0x14')]));});});};exports[_0x12cc('0x22')]=function(_0x4fe744){var _0x507099=this;return new Promise(function(_0x168358,_0xee8a05){return db[_0x12cc('0x17')][_0x12cc('0x23')](_0x4fe744['body'],{'raw':_0x4fe744[_0x12cc('0x18')]?_0x4fe744['options'][_0x12cc('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4fe744[_0x12cc('0x18')]?_0x4fe744['options'][_0x12cc('0x1a')]||null:null,'attributes':_0x4fe744[_0x12cc('0x18')]?_0x4fe744[_0x12cc('0x18')][_0x12cc('0x1b')]||null:null,'limit':_0x4fe744['options']?_0x4fe744[_0x12cc('0x18')][_0x12cc('0x1c')]||null:null})[_0x12cc('0xc')](function(_0x48597a){logger[_0x12cc('0x20')](_0x12cc('0x22'),_0x4fe744);logger[_0x12cc('0xe')](_0x12cc('0x22'),_0x4fe744,JSON['stringify'](_0x48597a));_0x168358(_0x48597a);})['catch'](function(_0x125885){logger[_0x12cc('0x11')]('UpdateCmHopperBlack',_0x125885[_0x12cc('0x14')],_0x4fe744);_0xee8a05(_0x507099[_0x12cc('0x11')](0x1f4,_0x125885['message']));});});};exports[_0x12cc('0x24')]=function(_0x55086d){var _0xadec51=this;return new Promise(function(_0x2ade3b,_0x3505fa){return db['CmHopperBlack'][_0x12cc('0x25')]({'where':_0x55086d[_0x12cc('0x18')]?_0x55086d[_0x12cc('0x18')][_0x12cc('0x1a')]||null:null})[_0x12cc('0xc')](function(_0x2a07df){logger['info'](_0x12cc('0x24'),_0x55086d);logger[_0x12cc('0xe')](_0x12cc('0x24'),_0x55086d,JSON[_0x12cc('0x10')](_0x2a07df));_0x2ade3b(_0x2a07df);})['catch'](function(_0x122846){logger[_0x12cc('0x11')]('DestroyCmHopperBlack',_0x122846[_0x12cc('0x14')],_0x55086d);_0x3505fa(_0xadec51[_0x12cc('0x11')](0x1f4,_0x122846[_0x12cc('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 6b6c4b5..55e2c4d 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 _0x3d04=['show','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','describe','/:id'];(function(_0xcd90ac,_0x5ae6f6){var _0x4d92f9=function(_0x20069c){while(--_0x20069c){_0xcd90ac['push'](_0xcd90ac['shift']());}};_0x4d92f9(++_0x5ae6f6);}(_0x3d04,0xbe));var _0x43d0=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x3d04[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x43d0('0x0'));var util=require(_0x43d0('0x1'));var path=require(_0x43d0('0x2'));var timeout=require(_0x43d0('0x3'));var express=require(_0x43d0('0x4'));var router=express[_0x43d0('0x5')]();var fs_extra=require(_0x43d0('0x6'));var auth=require(_0x43d0('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x43d0('0x8'));var controller=require(_0x43d0('0x9'));router[_0x43d0('0xa')]('/',auth[_0x43d0('0xb')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x43d0('0xc')]);router[_0x43d0('0xa')](_0x43d0('0xd'),auth[_0x43d0('0xb')](),controller[_0x43d0('0xe')]);router['put']('/:id',auth[_0x43d0('0xb')](),controller['update']);router['delete'](_0x43d0('0xd'),auth[_0x43d0('0xb')](),controller[_0x43d0('0xf')]);module[_0x43d0('0x10')]=router; \ No newline at end of file +var _0xf61e=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','index','isAuthenticated','describe','show','put'];(function(_0x21bd8b,_0x541616){var _0x5a0eae=function(_0x279e37){while(--_0x279e37){_0x21bd8b['push'](_0x21bd8b['shift']());}};_0x5a0eae(++_0x541616);}(_0xf61e,0x191));var _0xef61=function(_0x3ebec9,_0x5594dc){_0x3ebec9=_0x3ebec9-0x0;var _0x202a9c=_0xf61e[_0x3ebec9];return _0x202a9c;};'use strict';var multer=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var path=require(_0xef61('0x2'));var timeout=require(_0xef61('0x3'));var express=require(_0xef61('0x4'));var router=express[_0xef61('0x5')]();var fs_extra=require(_0xef61('0x6'));var auth=require(_0xef61('0x7'));var interaction=require(_0xef61('0x8'));var config=require(_0xef61('0x9'));var controller=require(_0xef61('0xa'));router[_0xef61('0xb')]('/',auth['isAuthenticated'](),controller[_0xef61('0xc')]);router[_0xef61('0xb')]('/describe',auth[_0xef61('0xd')](),controller[_0xef61('0xe')]);router[_0xef61('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xef61('0xf')]);router[_0xef61('0x10')](_0xef61('0x11'),auth[_0xef61('0xd')](),controller[_0xef61('0x12')]);router[_0xef61('0x13')](_0xef61('0x11'),auth[_0xef61('0xd')](),controller[_0xef61('0x14')]);module[_0xef61('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 2a6f14e..105ca9c 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 _0x9841=['diff','seconds','BOOLEAN','exports','INTEGER','STRING','DATE','getDataValue','setDataValue'];(function(_0x5afd87,_0x4d71c8){var _0x576fb2=function(_0x287bd7){while(--_0x287bd7){_0x5afd87['push'](_0x5afd87['shift']());}};_0x576fb2(++_0x4d71c8);}(_0x9841,0x1b3));var _0x1984=function(_0x2f637e,_0x5a6751){_0x2f637e=_0x2f637e-0x0;var _0x367ba0=_0x9841[_0x2f637e];return _0x367ba0;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x1984('0x0')]={'state':{'type':Sequelize[_0x1984('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x1984('0x2')]},'scheduledat':{'type':Sequelize[_0x1984('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1984('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x1984('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x1984('0x2')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x1984('0x2')]},'calleridname':{'type':Sequelize[_0x1984('0x2')]},'starttime':{'type':Sequelize[_0x1984('0x3')]},'responsetime':{'type':Sequelize[_0x1984('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x1984('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x1984('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x1984('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x1984('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x1984('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x1984('0x2')]},'campaign':{'type':Sequelize[_0x1984('0x2')]},'campaigntype':{'type':Sequelize[_0x1984('0x2')]},'membername':{'type':Sequelize[_0x1984('0x2')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x1984('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x1984('0x2')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x1d33eb){var _0x592034=this[_0x1984('0x4')]('endtime');if(_0x592034&&_0x1d33eb){this[_0x1984('0x5')]('followuptime',moment(_0x1d33eb)[_0x1984('0x6')](moment(_0x592034),_0x1984('0x7')));}}},'amd':{'type':Sequelize[_0x1984('0x8')],'defaultValue':![]},'fax':{'type':Sequelize[_0x1984('0x8')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x1984('0x8')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x1984('0x3')]},'callback':{'type':Sequelize[_0x1984('0x8')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1984('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1984('0x3')]},'deleted':{'type':Sequelize[_0x1984('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x1984('0x3')]},'recallme':{'type':Sequelize[_0x1984('0x8')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x1984('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0x1984('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1984('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1984('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1984('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1984('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x99d0=['DATE','INTEGER','endtime','followuptime','diff','seconds','BOOLEAN','moment','exports','STRING'];(function(_0x19576f,_0x169212){var _0x4041bf=function(_0x1eb1b7){while(--_0x1eb1b7){_0x19576f['push'](_0x19576f['shift']());}};_0x4041bf(++_0x169212);}(_0x99d0,0x13d));var _0x099d=function(_0x5a6de2,_0x5c8b10){_0x5a6de2=_0x5a6de2-0x0;var _0x2c0525=_0x99d0[_0x5a6de2];return _0x2c0525;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x099d('0x0'));module[_0x099d('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x099d('0x2')]},'scheduledat':{'type':Sequelize[_0x099d('0x3')]},'countbusyretry':{'type':Sequelize[_0x099d('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x099d('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x099d('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x099d('0x2')]},'calleridname':{'type':Sequelize[_0x099d('0x2')]},'starttime':{'type':Sequelize[_0x099d('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x099d('0x3')]},'droptime':{'type':Sequelize[_0x099d('0x3')]},'endtime':{'type':Sequelize[_0x099d('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x099d('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x099d('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x099d('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x099d('0x2')]},'reason':{'type':Sequelize[_0x099d('0x2')]},'disposition':{'type':Sequelize[_0x099d('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x099d('0x2')]},'dispositionat':{'type':Sequelize[_0x099d('0x3')],'set':function(_0x4ea29e){var _0x508574=this['getDataValue'](_0x099d('0x5'));if(_0x508574&&_0x4ea29e){this['setDataValue'](_0x099d('0x6'),moment(_0x4ea29e)[_0x099d('0x7')](moment(_0x508574),_0x099d('0x8')));}}},'amd':{'type':Sequelize[_0x099d('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0x099d('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x099d('0x3')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x099d('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x099d('0x3')]},'deleted':{'type':Sequelize[_0x099d('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x099d('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x099d('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0x099d('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x099d('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x099d('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x099d('0x4')],'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 10ba139..9324ff3 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 _0x326f=['type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','merge','VIRTUAL','options','CmHopperFinal','includeAll','include','rows','catch','show','params','find','describe','uniqueid','body','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','noSuchContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','scheduledAt','ContactId','createdAt','select','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','VoiceQueueId','updatedAt','from','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','toString','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','fromQuery','phone','CampaignId','ANY_VALUE(CampaignId)','cm_hopper_final','calleridnum\x20IS\x20NOT\x20NULL','CampaignId\x20=\x20?','checkContactHopper','CmHopper','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','stack','name','send','map','rawAttributes','fieldName'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x326f,0xd1));var _0xf326=function(_0x249271,_0x65b87d){_0x249271=_0x249271-0x0;var _0x3ce184=_0x326f[_0x249271];return _0x3ce184;};'use strict';var emlformat=require(_0xf326('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf326('0x1'));var rp=require(_0xf326('0x2'));var moment=require(_0xf326('0x3'));var BPromise=require(_0xf326('0x4'));var Mustache=require(_0xf326('0x5'));var util=require(_0xf326('0x6'));var path=require(_0xf326('0x7'));var sox=require(_0xf326('0x8'));var csv=require(_0xf326('0x9'));var ejs=require(_0xf326('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf326('0xb'));var squel=require(_0xf326('0xc'));var crypto=require(_0xf326('0xd'));var jsforce=require(_0xf326('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf326('0xf'));var Redis=require(_0xf326('0x10'));var authService=require(_0xf326('0x11'));var qs=require(_0xf326('0x12'));var as=require(_0xf326('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf326('0x14'))('api');var utils=require(_0xf326('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf326('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3162f9,_0x9ed463){_0x9ed463=_0x9ed463||0xcc;return function(_0x4b3966){if(_0x4b3966){return _0x3162f9[_0xf326('0x17')](_0x9ed463);}return _0x3162f9[_0xf326('0x18')](_0x9ed463)[_0xf326('0x19')]();};}function respondWithResult(_0x17a098,_0x5c8483){_0x5c8483=_0x5c8483||0xc8;return function(_0x45c1b6){if(_0x45c1b6){return _0x17a098['status'](_0x5c8483)['json'](_0x45c1b6);}};}function respondWithFilteredResult(_0xdf21d9,_0x11f6d2){return function(_0x1f2e5a){if(_0x1f2e5a){var _0xa63d1a=typeof _0x11f6d2[_0xf326('0x1a')]===_0xf326('0x1b')&&typeof _0x11f6d2[_0xf326('0x1c')]===_0xf326('0x1b');var _0x5a682a=_0x1f2e5a[_0xf326('0x1d')];var _0x453100=_0xa63d1a?0x0:_0x11f6d2[_0xf326('0x1a')];var _0x31ffb9=_0xa63d1a?_0x1f2e5a[_0xf326('0x1d')]:_0x11f6d2[_0xf326('0x1a')]+_0x11f6d2['limit'];var _0x4a5b6c;if(_0x31ffb9>=_0x5a682a){_0x31ffb9=_0x5a682a;_0x4a5b6c=0xc8;}else{_0x4a5b6c=0xce;}_0xdf21d9['status'](_0x4a5b6c);return _0xdf21d9[_0xf326('0x1e')](_0xf326('0x1f'),_0x453100+'-'+_0x31ffb9+'/'+_0x5a682a)['json'](_0x1f2e5a);}return null;};}function patchUpdates(_0x4cabce){return function(_0x128c68){try{jsonpatch['apply'](_0x128c68,_0x4cabce,!![]);}catch(_0x5b6d3c){return BPromise[_0xf326('0x20')](_0x5b6d3c);}return _0x128c68[_0xf326('0x21')]();};}function saveUpdates(_0x549b46,_0x5aa184){return function(_0x19b8ba){if(_0x19b8ba){return _0x19b8ba[_0xf326('0x22')](_0x549b46)['then'](function(_0x337ed5){return _0x337ed5;});}return null;};}function removeEntity(_0x1b9039,_0x43c53e){return function(_0x295752){if(_0x295752){return _0x295752[_0xf326('0x23')]()[_0xf326('0x24')](function(){_0x1b9039['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f31f6,_0x520d85){return function(_0x1a2c4e){if(!_0x1a2c4e){_0x4f31f6[_0xf326('0x17')](0x194);}return _0x1a2c4e;};}function handleError(_0x1ff2b5,_0x148953){_0x148953=_0x148953||0x1f4;return function(_0x410237){logger['error'](_0x410237[_0xf326('0x25')]);if(_0x410237[_0xf326('0x26')]){delete _0x410237[_0xf326('0x26')];}_0x1ff2b5['status'](_0x148953)[_0xf326('0x27')](_0x410237);};}exports['index']=function(_0x4a9abf,_0x6a8e89){var _0x1ae23a={},_0x2fa28e={},_0x5dbe63={'count':0x0,'rows':[]};var _0xc115d9=_[_0xf326('0x28')](db['CmHopperFinal'][_0xf326('0x29')],function(_0x119ab8){return{'name':_0x119ab8[_0xf326('0x2a')],'type':_0x119ab8[_0xf326('0x2b')][_0xf326('0x2c')]};});_0x2fa28e[_0xf326('0x2d')]=_[_0xf326('0x28')](_0xc115d9,_0xf326('0x26'));_0x2fa28e[_0xf326('0x2e')]=_[_0xf326('0x2f')](_0x4a9abf['query']);_0x2fa28e[_0xf326('0x30')]=_[_0xf326('0x31')](_0x2fa28e[_0xf326('0x2d')],_0x2fa28e['query']);_0x1ae23a[_0xf326('0x32')]=_[_0xf326('0x31')](_0x2fa28e[_0xf326('0x2d')],qs['fields'](_0x4a9abf['query'][_0xf326('0x33')]));_0x1ae23a[_0xf326('0x32')]=_0x1ae23a[_0xf326('0x32')][_0xf326('0x34')]?_0x1ae23a[_0xf326('0x32')]:_0x2fa28e[_0xf326('0x2d')];if(!_0x4a9abf[_0xf326('0x2e')][_0xf326('0x35')]('nolimit')){_0x1ae23a[_0xf326('0x1c')]=qs[_0xf326('0x1c')](_0x4a9abf['query'][_0xf326('0x1c')]);_0x1ae23a['offset']=qs[_0xf326('0x1a')](_0x4a9abf['query']['offset']);}_0x1ae23a[_0xf326('0x36')]=qs['sort'](_0x4a9abf[_0xf326('0x2e')]['sort']);_0x1ae23a[_0xf326('0x37')]=qs[_0xf326('0x30')](_[_0xf326('0x38')](_0x4a9abf['query'],_0x2fa28e[_0xf326('0x30')]),_0xc115d9);if(_0x4a9abf[_0xf326('0x2e')]['filter']){_0x1ae23a[_0xf326('0x37')]=_[_0xf326('0x39')](_0x1ae23a[_0xf326('0x37')],{'$or':_[_0xf326('0x28')](_0xc115d9,function(_0x51076c){if(_0x51076c[_0xf326('0x2b')]!==_0xf326('0x3a')){var _0x1e69b1={};_0x1e69b1[_0x51076c[_0xf326('0x26')]]={'$like':'%'+_0x4a9abf[_0xf326('0x2e')]['filter']+'%'};return _0x1e69b1;}})});}_0x1ae23a=_[_0xf326('0x39')]({},_0x1ae23a,_0x4a9abf[_0xf326('0x3b')]);var _0x5cfb97={'where':_0x1ae23a['where']};return db[_0xf326('0x3c')]['count'](_0x5cfb97)['then'](function(_0x22d462){_0x5dbe63['count']=_0x22d462;if(_0x4a9abf[_0xf326('0x2e')][_0xf326('0x3d')]){_0x1ae23a[_0xf326('0x3e')]=[{'all':!![]}];}return db[_0xf326('0x3c')]['findAll'](_0x1ae23a);})[_0xf326('0x24')](function(_0x45d344){_0x5dbe63[_0xf326('0x3f')]=_0x45d344;return _0x5dbe63;})[_0xf326('0x24')](respondWithFilteredResult(_0x6a8e89,_0x1ae23a))[_0xf326('0x40')](handleError(_0x6a8e89,null));};exports[_0xf326('0x41')]=function(_0x2ad841,_0x224a32){var _0x31283b={'raw':!![],'where':{'id':_0x2ad841[_0xf326('0x42')]['id']}},_0x1227d3={};_0x1227d3[_0xf326('0x2d')]=_['keys'](db[_0xf326('0x3c')][_0xf326('0x29')]);_0x1227d3[_0xf326('0x2e')]=_[_0xf326('0x2f')](_0x2ad841[_0xf326('0x2e')]);_0x1227d3[_0xf326('0x30')]=_['intersection'](_0x1227d3[_0xf326('0x2d')],_0x1227d3[_0xf326('0x2e')]);_0x31283b['attributes']=_[_0xf326('0x31')](_0x1227d3[_0xf326('0x2d')],qs[_0xf326('0x33')](_0x2ad841[_0xf326('0x2e')][_0xf326('0x33')]));_0x31283b['attributes']=_0x31283b['attributes'][_0xf326('0x34')]?_0x31283b[_0xf326('0x32')]:_0x1227d3['model'];if(_0x2ad841['query'][_0xf326('0x3d')]){_0x31283b[_0xf326('0x3e')]=[{'all':!![]}];}_0x31283b=_[_0xf326('0x39')]({},_0x31283b,_0x2ad841['options']);return db[_0xf326('0x3c')][_0xf326('0x43')](_0x31283b)[_0xf326('0x24')](handleEntityNotFound(_0x224a32,null))[_0xf326('0x24')](respondWithResult(_0x224a32,null))[_0xf326('0x40')](handleError(_0x224a32,null));};exports[_0xf326('0x44')]=function(_0x12792c,_0x3b90dc){return db[_0xf326('0x3c')][_0xf326('0x44')]()[_0xf326('0x24')](respondWithResult(_0x3b90dc,null))[_0xf326('0x40')](handleError(_0x3b90dc,null));};exports[_0xf326('0x22')]=function(_0x395b1e,_0xeac1a1){if(_0x395b1e['body'][_0xf326('0x45')]){delete _0x395b1e[_0xf326('0x46')][_0xf326('0x45')];}return db[_0xf326('0x3c')]['find']({'where':{'uniqueid':_0x395b1e[_0xf326('0x42')]['id']}})[_0xf326('0x24')](handleEntityNotFound(_0xeac1a1,null))[_0xf326('0x24')](saveUpdates(_0x395b1e[_0xf326('0x46')],null))['then'](respondWithResult(_0xeac1a1,null))[_0xf326('0x40')](handleError(_0xeac1a1,null));};exports[_0xf326('0x47')]=function(_0x145a77,_0x451ac7,_0x39ba25){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'VoiceQueueId':_0x145a77[_0xf326('0x42')]['id']},'attributes':[[db[_0xf326('0x48')]['fn'](_0xf326('0x49'),db['sequelize']['fn']('IF',db[_0xf326('0x48')][_0xf326('0x4a')](_0xf326('0x4b')))),'noSuchContacts'],[db['sequelize']['fn'](_0xf326('0x49'),db['sequelize']['fn']('IF',db[_0xf326('0x48')]['literal'](_0xf326('0x4c')))),_0xf326('0x4d')],[db[_0xf326('0x48')]['fn'](_0xf326('0x49'),db[_0xf326('0x48')]['fn']('IF',db[_0xf326('0x48')][_0xf326('0x4a')]('`state`\x20=\x205,\x201,\x20null'))),_0xf326('0x4e')],[db[_0xf326('0x48')]['fn'](_0xf326('0x49'),db['sequelize']['fn']('IF',db[_0xf326('0x48')][_0xf326('0x4a')](_0xf326('0x4f')))),_0xf326('0x50')],[db[_0xf326('0x48')]['fn']('COUNT',db[_0xf326('0x48')]['fn']('IF',db[_0xf326('0x48')][_0xf326('0x4a')](_0xf326('0x51')))),'dropContacts'],[db[_0xf326('0x48')]['fn'](_0xf326('0x49'),db[_0xf326('0x48')]['fn']('IF',db[_0xf326('0x48')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xf326('0x52')],[db[_0xf326('0x48')]['fn']('COUNT',db[_0xf326('0x48')]['fn']('IF',db[_0xf326('0x48')][_0xf326('0x4a')](_0xf326('0x53')))),'reCallContacts'],[db[_0xf326('0x48')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xf326('0x48')]['literal'](_0xf326('0x54')))),_0xf326('0x55')]]})[_0xf326('0x24')](handleEntityNotFound(_0x451ac7,null))['then'](respondWithResult(_0x451ac7,null))['catch'](handleError(_0x451ac7,null));};exports[_0xf326('0x56')]=function(_0xa85a42,_0x33b259,_0x5d0177){return db[_0xf326('0x3c')]['findAll']({'raw':![],'where':{'CampaignId':_0xa85a42[_0xf326('0x42')]['id']},'attributes':[[db[_0xf326('0x48')]['fn'](_0xf326('0x49'),db[_0xf326('0x48')]['fn']('IF',db[_0xf326('0x48')][_0xf326('0x4a')](_0xf326('0x4b')))),_0xf326('0x57')],[db[_0xf326('0x48')]['fn'](_0xf326('0x49'),db[_0xf326('0x48')]['fn']('IF',db[_0xf326('0x48')][_0xf326('0x4a')]('`state`\x20=\x203,\x201,\x20null'))),_0xf326('0x4d')],[db['sequelize']['fn'](_0xf326('0x49'),db[_0xf326('0x48')]['fn']('IF',db['sequelize'][_0xf326('0x4a')]('`state`\x20=\x205,\x201,\x20null'))),_0xf326('0x4e')],[db[_0xf326('0x48')]['fn'](_0xf326('0x49'),db[_0xf326('0x48')]['fn']('IF',db[_0xf326('0x48')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0xf326('0x50')],[db[_0xf326('0x48')]['fn'](_0xf326('0x49'),db[_0xf326('0x48')]['fn']('IF',db[_0xf326('0x48')]['literal'](_0xf326('0x51')))),_0xf326('0x58')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xf326('0x48')][_0xf326('0x4a')](_0xf326('0x59')))),_0xf326('0x52')],[db[_0xf326('0x48')]['fn'](_0xf326('0x49'),db[_0xf326('0x48')]['fn']('IF',db['sequelize'][_0xf326('0x4a')](_0xf326('0x53')))),_0xf326('0x5a')],[db[_0xf326('0x48')]['fn']('COUNT',db[_0xf326('0x48')]['fn']('IF',db['sequelize']['literal'](_0xf326('0x54')))),'answeringMachine']]})[_0xf326('0x24')](handleEntityNotFound(_0x33b259,null))[_0xf326('0x24')](respondWithResult(_0x33b259,null))[_0xf326('0x40')](handleError(_0x33b259,null));};exports[_0xf326('0x5b')]=function(_0x17cd36,_0x541491,_0x4a053c){return db['VoiceQueue'][_0xf326('0x43')]({'where':{'id':_0x17cd36[_0xf326('0x42')]['id']}})[_0xf326('0x24')](handleEntityNotFound(_0x541491,null))[_0xf326('0x24')](function(_0xec5857){var _0x5e874b;if(_0xec5857){_0x5e874b=squel[_0xf326('0x5c')]()[_0xf326('0x5d')](_0xf326('0x5e'))['fromQuery'](['phone',_0xf326('0x5f'),_0xf326('0x60'),'ListId','VoiceQueueId',_0xf326('0x61'),'updatedAt'],squel[_0xf326('0x62')]()['field']('ANY_VALUE(calleridnum)','phone')[_0xf326('0x63')](_0xf326('0x64'),_0xf326('0x5f'))['field'](_0xf326('0x65'),_0xf326('0x60'))[_0xf326('0x63')](_0xf326('0x66'),_0xf326('0x67'))[_0xf326('0x63')](_0xf326('0x68'),_0xf326('0x69'))[_0xf326('0x63')]('NOW()',_0xf326('0x61'))['field'](_0xf326('0x64'),_0xf326('0x6a'))[_0xf326('0x6b')]('cm_hopper_final')[_0xf326('0x37')](_0xf326('0x6c'),_0x17cd36[_0xf326('0x42')]['id']['toString']())[_0xf326('0x37')](_0xf326('0x6d'),_0x17cd36[_0xf326('0x46')][_0xf326('0x6e')]['toString']())[_0xf326('0x37')]('calleridnum\x20IS\x20NOT\x20NULL')['where'](_0xf326('0x6f'),squel[_0xf326('0x62')]()['field']('phone')['from'](_0xf326('0x5e'))['where'](_0xf326('0x6c'),_0x17cd36[_0xf326('0x42')]['id'][_0xf326('0x70')]()))[_0xf326('0x37')](_0xf326('0x6f'),squel[_0xf326('0x62')]()['field'](_0xf326('0x71'))[_0xf326('0x6b')]('cm_hopper_final')['where'](_0xf326('0x6c'),_0x17cd36['params']['id'][_0xf326('0x70')]())[_0xf326('0x37')](_0xf326('0x72')))[_0xf326('0x73')](_0xf326('0x60')))[_0xf326('0x70')]();return db[_0xf326('0x48')][_0xf326('0x2e')](_0x5e874b);}return[];})[_0xf326('0x24')](respondWithResult(_0x541491,null))['catch'](handleError(_0x541491,null));};exports[_0xf326('0x74')]=function(_0x26bbb1,_0x4ac90e,_0x3c82cf){return db['Campaign'][_0xf326('0x43')]({'where':{'id':_0x26bbb1[_0xf326('0x42')]['id']}})[_0xf326('0x24')](handleEntityNotFound(_0x4ac90e,null))['then'](function(_0x2b4414){var _0x1c86c8;if(_0x2b4414){_0x1c86c8=squel[_0xf326('0x5c')]()[_0xf326('0x5d')](_0xf326('0x5e'))[_0xf326('0x75')]([_0xf326('0x76'),_0xf326('0x5f'),_0xf326('0x60'),_0xf326('0x67'),_0xf326('0x77'),_0xf326('0x61'),_0xf326('0x6a')],squel[_0xf326('0x62')]()[_0xf326('0x63')]('ANY_VALUE(calleridnum)',_0xf326('0x76'))[_0xf326('0x63')]('NOW()',_0xf326('0x5f'))[_0xf326('0x63')]('ANY_VALUE(ContactId)',_0xf326('0x60'))[_0xf326('0x63')](_0xf326('0x66'),_0xf326('0x67'))[_0xf326('0x63')](_0xf326('0x78'),_0xf326('0x77'))['field'](_0xf326('0x64'),_0xf326('0x61'))[_0xf326('0x63')](_0xf326('0x64'),_0xf326('0x6a'))[_0xf326('0x6b')](_0xf326('0x79'))[_0xf326('0x37')]('CampaignId\x20=\x20?',_0x26bbb1[_0xf326('0x42')]['id'][_0xf326('0x70')]())['where'](_0xf326('0x6d'),_0x26bbb1['body'][_0xf326('0x6e')][_0xf326('0x70')]())[_0xf326('0x37')](_0xf326('0x7a'))[_0xf326('0x37')](_0xf326('0x6f'),squel[_0xf326('0x62')]()[_0xf326('0x63')](_0xf326('0x76'))[_0xf326('0x6b')](_0xf326('0x5e'))[_0xf326('0x37')](_0xf326('0x7b'),_0x26bbb1[_0xf326('0x42')]['id']['toString']()))[_0xf326('0x37')](_0xf326('0x6f'),squel[_0xf326('0x62')]()[_0xf326('0x63')](_0xf326('0x71'))['from'](_0xf326('0x79'))[_0xf326('0x37')](_0xf326('0x7b'),_0x26bbb1[_0xf326('0x42')]['id'][_0xf326('0x70')]())['where']('state\x20=\x204'))[_0xf326('0x73')]('ContactId'))[_0xf326('0x70')]();return db[_0xf326('0x48')][_0xf326('0x2e')](_0x1c86c8);}return[];})['then'](respondWithResult(_0x4ac90e,null))['catch'](handleError(_0x4ac90e,null));};exports[_0xf326('0x7c')]=function(_0x2d92e4,_0x167ac9,_0x34870c){return db[_0xf326('0x7d')]['findOne']({'where':{'VoiceQueueId':_0x2d92e4[_0xf326('0x46')][_0xf326('0x69')],'CampaignId':_0x2d92e4[_0xf326('0x46')]['CampaignId'],'ContactId':_0x2d92e4['body']['ContactId']}})[_0xf326('0x24')](handleEntityNotFound(_0x167ac9,null))[_0xf326('0x24')](function(_0x2d275d){if(_0x2d275d){return _0x2d275d;}return null;})[_0xf326('0x24')](respondWithResult(_0x167ac9,null))[_0xf326('0x40')](handleError(_0x167ac9,null));}; \ No newline at end of file +var _0x0295=['ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','CmHopperFinal','includeAll','rows','catch','show','params','intersection','include','find','describe','body','uniqueid','findAll','sequelize','literal','noSuchContacts','COUNT','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','cm_hopper','fromQuery','phone','scheduledAt','ListId','VoiceQueueId','updatedAt','select','field','NOW()','ANY_VALUE(ContactId)','ContactId','ANY_VALUE(ListId)','createdAt','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','from','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','into','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','CmHopper','findOne','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv'];(function(_0x3672a1,_0x271af9){var _0x4024a9=function(_0x44501b){while(--_0x44501b){_0x3672a1['push'](_0x3672a1['shift']());}};_0x4024a9(++_0x271af9);}(_0x0295,0x1f0));var _0x5029=function(_0x533676,_0x2be01c){_0x533676=_0x533676-0x0;var _0x32f7bd=_0x0295[_0x533676];return _0x32f7bd;};'use strict';var emlformat=require(_0x5029('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5029('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5029('0x2'));var Mustache=require(_0x5029('0x3'));var util=require(_0x5029('0x4'));var path=require(_0x5029('0x5'));var sox=require(_0x5029('0x6'));var csv=require(_0x5029('0x7'));var ejs=require(_0x5029('0x8'));var fs=require('fs');var fs_extra=require(_0x5029('0x9'));var _=require(_0x5029('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5029('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5029('0xc'));var Papa=require('papaparse');var Redis=require(_0x5029('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5029('0xe'));var as=require(_0x5029('0xf'));var hardwareService=require(_0x5029('0x10'));var logger=require('../../config/logger')(_0x5029('0x11'));var utils=require(_0x5029('0x12'));var config=require(_0x5029('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5029('0x14'))['db'];function respondWithStatusCode(_0x2442b2,_0x4cced9){_0x4cced9=_0x4cced9||0xcc;return function(_0x4fa22d){if(_0x4fa22d){return _0x2442b2['sendStatus'](_0x4cced9);}return _0x2442b2['status'](_0x4cced9)[_0x5029('0x15')]();};}function respondWithResult(_0x2e0369,_0x12c237){_0x12c237=_0x12c237||0xc8;return function(_0x434630){if(_0x434630){return _0x2e0369[_0x5029('0x16')](_0x12c237)[_0x5029('0x17')](_0x434630);}};}function respondWithFilteredResult(_0xe278b7,_0x317c20){return function(_0x10bf55){if(_0x10bf55){var _0x326923=typeof _0x317c20[_0x5029('0x18')]===_0x5029('0x19')&&typeof _0x317c20[_0x5029('0x1a')]===_0x5029('0x19');var _0x343918=_0x10bf55['count'];var _0x1ed567=_0x326923?0x0:_0x317c20[_0x5029('0x18')];var _0x35de81=_0x326923?_0x10bf55[_0x5029('0x1b')]:_0x317c20[_0x5029('0x18')]+_0x317c20[_0x5029('0x1a')];var _0xaba461;if(_0x35de81>=_0x343918){_0x35de81=_0x343918;_0xaba461=0xc8;}else{_0xaba461=0xce;}_0xe278b7['status'](_0xaba461);return _0xe278b7[_0x5029('0x1c')]('Content-Range',_0x1ed567+'-'+_0x35de81+'/'+_0x343918)[_0x5029('0x17')](_0x10bf55);}return null;};}function patchUpdates(_0x8a414c){return function(_0x2710aa){try{jsonpatch[_0x5029('0x1d')](_0x2710aa,_0x8a414c,!![]);}catch(_0x4b5854){return BPromise['reject'](_0x4b5854);}return _0x2710aa[_0x5029('0x1e')]();};}function saveUpdates(_0x4a49b6,_0x3f657d){return function(_0x853a34){if(_0x853a34){return _0x853a34[_0x5029('0x1f')](_0x4a49b6)[_0x5029('0x20')](function(_0x16bd22){return _0x16bd22;});}return null;};}function removeEntity(_0x3a3e52,_0x125c26){return function(_0x356dac){if(_0x356dac){return _0x356dac[_0x5029('0x21')]()['then'](function(){_0x3a3e52['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x588d90,_0x45666c){return function(_0x51093c){if(!_0x51093c){_0x588d90['sendStatus'](0x194);}return _0x51093c;};}function handleError(_0x181da0,_0x1e7e61){_0x1e7e61=_0x1e7e61||0x1f4;return function(_0x36d810){logger['error'](_0x36d810[_0x5029('0x22')]);if(_0x36d810[_0x5029('0x23')]){delete _0x36d810['name'];}_0x181da0[_0x5029('0x16')](_0x1e7e61)[_0x5029('0x24')](_0x36d810);};}exports[_0x5029('0x25')]=function(_0x4a24b9,_0x32da06){var _0x251f99={},_0xe5313e={},_0x4b6f92={'count':0x0,'rows':[]};var _0x2cedf6=_[_0x5029('0x26')](db['CmHopperFinal'][_0x5029('0x27')],function(_0x25032b){return{'name':_0x25032b[_0x5029('0x28')],'type':_0x25032b[_0x5029('0x29')][_0x5029('0x2a')]};});_0xe5313e[_0x5029('0x2b')]=_[_0x5029('0x26')](_0x2cedf6,_0x5029('0x23'));_0xe5313e[_0x5029('0x2c')]=_[_0x5029('0x2d')](_0x4a24b9[_0x5029('0x2c')]);_0xe5313e[_0x5029('0x2e')]=_['intersection'](_0xe5313e[_0x5029('0x2b')],_0xe5313e['query']);_0x251f99[_0x5029('0x2f')]=_['intersection'](_0xe5313e['model'],qs[_0x5029('0x30')](_0x4a24b9[_0x5029('0x2c')][_0x5029('0x30')]));_0x251f99['attributes']=_0x251f99[_0x5029('0x2f')][_0x5029('0x31')]?_0x251f99[_0x5029('0x2f')]:_0xe5313e[_0x5029('0x2b')];if(!_0x4a24b9[_0x5029('0x2c')][_0x5029('0x32')](_0x5029('0x33'))){_0x251f99[_0x5029('0x1a')]=qs[_0x5029('0x1a')](_0x4a24b9['query'][_0x5029('0x1a')]);_0x251f99[_0x5029('0x18')]=qs[_0x5029('0x18')](_0x4a24b9[_0x5029('0x2c')]['offset']);}_0x251f99[_0x5029('0x34')]=qs[_0x5029('0x35')](_0x4a24b9[_0x5029('0x2c')]['sort']);_0x251f99['where']=qs[_0x5029('0x2e')](_[_0x5029('0x36')](_0x4a24b9['query'],_0xe5313e['filters']),_0x2cedf6);if(_0x4a24b9[_0x5029('0x2c')][_0x5029('0x37')]){_0x251f99[_0x5029('0x38')]=_[_0x5029('0x39')](_0x251f99[_0x5029('0x38')],{'$or':_[_0x5029('0x26')](_0x2cedf6,function(_0x3cb84e){if(_0x3cb84e[_0x5029('0x29')]!==_0x5029('0x3a')){var _0x3effa4={};_0x3effa4[_0x3cb84e[_0x5029('0x23')]]={'$like':'%'+_0x4a24b9[_0x5029('0x2c')][_0x5029('0x37')]+'%'};return _0x3effa4;}})});}_0x251f99=_[_0x5029('0x39')]({},_0x251f99,_0x4a24b9['options']);var _0x57c2b5={'where':_0x251f99[_0x5029('0x38')]};return db[_0x5029('0x3b')][_0x5029('0x1b')](_0x57c2b5)['then'](function(_0x32d8a3){_0x4b6f92[_0x5029('0x1b')]=_0x32d8a3;if(_0x4a24b9['query'][_0x5029('0x3c')]){_0x251f99['include']=[{'all':!![]}];}return db[_0x5029('0x3b')]['findAll'](_0x251f99);})[_0x5029('0x20')](function(_0x359838){_0x4b6f92[_0x5029('0x3d')]=_0x359838;return _0x4b6f92;})[_0x5029('0x20')](respondWithFilteredResult(_0x32da06,_0x251f99))[_0x5029('0x3e')](handleError(_0x32da06,null));};exports[_0x5029('0x3f')]=function(_0x4b2219,_0x1021ea){var _0x2ae047={'raw':!![],'where':{'id':_0x4b2219[_0x5029('0x40')]['id']}},_0x5a3e4d={};_0x5a3e4d[_0x5029('0x2b')]=_[_0x5029('0x2d')](db[_0x5029('0x3b')][_0x5029('0x27')]);_0x5a3e4d[_0x5029('0x2c')]=_['keys'](_0x4b2219[_0x5029('0x2c')]);_0x5a3e4d[_0x5029('0x2e')]=_[_0x5029('0x41')](_0x5a3e4d[_0x5029('0x2b')],_0x5a3e4d[_0x5029('0x2c')]);_0x2ae047['attributes']=_[_0x5029('0x41')](_0x5a3e4d[_0x5029('0x2b')],qs[_0x5029('0x30')](_0x4b2219[_0x5029('0x2c')][_0x5029('0x30')]));_0x2ae047[_0x5029('0x2f')]=_0x2ae047[_0x5029('0x2f')][_0x5029('0x31')]?_0x2ae047[_0x5029('0x2f')]:_0x5a3e4d['model'];if(_0x4b2219[_0x5029('0x2c')][_0x5029('0x3c')]){_0x2ae047[_0x5029('0x42')]=[{'all':!![]}];}_0x2ae047=_[_0x5029('0x39')]({},_0x2ae047,_0x4b2219['options']);return db['CmHopperFinal'][_0x5029('0x43')](_0x2ae047)[_0x5029('0x20')](handleEntityNotFound(_0x1021ea,null))[_0x5029('0x20')](respondWithResult(_0x1021ea,null))[_0x5029('0x3e')](handleError(_0x1021ea,null));};exports[_0x5029('0x44')]=function(_0x3dfc08,_0x2bb7fc){return db[_0x5029('0x3b')][_0x5029('0x44')]()[_0x5029('0x20')](respondWithResult(_0x2bb7fc,null))[_0x5029('0x3e')](handleError(_0x2bb7fc,null));};exports[_0x5029('0x1f')]=function(_0x449ef5,_0x18f1f5){if(_0x449ef5[_0x5029('0x45')][_0x5029('0x46')]){delete _0x449ef5[_0x5029('0x45')][_0x5029('0x46')];}return db[_0x5029('0x3b')][_0x5029('0x43')]({'where':{'uniqueid':_0x449ef5[_0x5029('0x40')]['id']}})['then'](handleEntityNotFound(_0x18f1f5,null))[_0x5029('0x20')](saveUpdates(_0x449ef5['body'],null))[_0x5029('0x20')](respondWithResult(_0x18f1f5,null))[_0x5029('0x3e')](handleError(_0x18f1f5,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x5343c6,_0x319bff,_0x5e739d){return db['CmHopperFinal'][_0x5029('0x47')]({'raw':![],'where':{'VoiceQueueId':_0x5343c6[_0x5029('0x40')]['id']},'attributes':[[db[_0x5029('0x48')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')]('`state`\x20=\x200,\x201,\x20null'))),_0x5029('0x4a')],[db['sequelize']['fn'](_0x5029('0x4b'),db['sequelize']['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')](_0x5029('0x4c')))),_0x5029('0x4d')],[db[_0x5029('0x48')]['fn'](_0x5029('0x4b'),db[_0x5029('0x48')]['fn']('IF',db[_0x5029('0x48')]['literal'](_0x5029('0x4e')))),'busyContacts'],[db[_0x5029('0x48')]['fn'](_0x5029('0x4b'),db['sequelize']['fn']('IF',db[_0x5029('0x48')]['literal']('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db[_0x5029('0x48')]['fn']('COUNT',db[_0x5029('0x48')]['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x5029('0x4f')],[db['sequelize']['fn']('COUNT',db[_0x5029('0x48')]['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')](_0x5029('0x50')))),_0x5029('0x51')],[db['sequelize']['fn'](_0x5029('0x4b'),db[_0x5029('0x48')]['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')]('`state`\x20=\x2022,\x201,\x20null'))),_0x5029('0x52')],[db[_0x5029('0x48')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')](_0x5029('0x53')))),_0x5029('0x54')]]})['then'](handleEntityNotFound(_0x319bff,null))[_0x5029('0x20')](respondWithResult(_0x319bff,null))[_0x5029('0x3e')](handleError(_0x319bff,null));};exports[_0x5029('0x55')]=function(_0x2aebb3,_0x3a82f7,_0x26f56f){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x2aebb3[_0x5029('0x40')]['id']},'attributes':[[db[_0x5029('0x48')]['fn'](_0x5029('0x4b'),db['sequelize']['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')](_0x5029('0x56')))),_0x5029('0x4a')],[db[_0x5029('0x48')]['fn']('COUNT',db[_0x5029('0x48')]['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')]('`state`\x20=\x203,\x201,\x20null'))),_0x5029('0x4d')],[db['sequelize']['fn'](_0x5029('0x4b'),db['sequelize']['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')](_0x5029('0x4e')))),_0x5029('0x57')],[db[_0x5029('0x48')]['fn'](_0x5029('0x4b'),db['sequelize']['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')](_0x5029('0x58')))),_0x5029('0x59')],[db[_0x5029('0x48')]['fn']('COUNT',db[_0x5029('0x48')]['fn']('IF',db['sequelize'][_0x5029('0x49')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x5029('0x4f')],[db['sequelize']['fn'](_0x5029('0x4b'),db['sequelize']['fn']('IF',db['sequelize'][_0x5029('0x49')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x5029('0x51')],[db[_0x5029('0x48')]['fn'](_0x5029('0x4b'),db['sequelize']['fn']('IF',db[_0x5029('0x48')]['literal'](_0x5029('0x5a')))),_0x5029('0x52')],[db[_0x5029('0x48')]['fn'](_0x5029('0x4b'),db[_0x5029('0x48')]['fn']('IF',db['sequelize'][_0x5029('0x49')](_0x5029('0x53')))),'answeringMachine']]})[_0x5029('0x20')](handleEntityNotFound(_0x3a82f7,null))[_0x5029('0x20')](respondWithResult(_0x3a82f7,null))[_0x5029('0x3e')](handleError(_0x3a82f7,null));};exports[_0x5029('0x5b')]=function(_0x9b1c13,_0x1bd1c6,_0x5bd84e){return db['VoiceQueue'][_0x5029('0x43')]({'where':{'id':_0x9b1c13['params']['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x1bd1c6,null))[_0x5029('0x20')](function(_0x58db57){var _0x181956;if(_0x58db57){_0x181956=squel['insert']()['into'](_0x5029('0x5c'))[_0x5029('0x5d')]([_0x5029('0x5e'),_0x5029('0x5f'),'ContactId',_0x5029('0x60'),_0x5029('0x61'),'createdAt',_0x5029('0x62')],squel[_0x5029('0x63')]()['field']('ANY_VALUE(calleridnum)','phone')[_0x5029('0x64')](_0x5029('0x65'),_0x5029('0x5f'))[_0x5029('0x64')](_0x5029('0x66'),_0x5029('0x67'))[_0x5029('0x64')](_0x5029('0x68'),_0x5029('0x60'))['field']('ANY_VALUE(VoiceQueueId)',_0x5029('0x61'))[_0x5029('0x64')](_0x5029('0x65'),_0x5029('0x69'))[_0x5029('0x64')](_0x5029('0x65'),_0x5029('0x62'))['from'](_0x5029('0x6a'))[_0x5029('0x38')](_0x5029('0x6b'),_0x9b1c13['params']['id'][_0x5029('0x6c')]())[_0x5029('0x38')](_0x5029('0x6d'),_0x9b1c13['body'][_0x5029('0x6e')][_0x5029('0x6c')]())[_0x5029('0x38')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x5029('0x38')](_0x5029('0x6f'),squel['select']()[_0x5029('0x64')](_0x5029('0x5e'))[_0x5029('0x70')](_0x5029('0x5c'))[_0x5029('0x38')]('VoiceQueueId\x20=\x20?',_0x9b1c13[_0x5029('0x40')]['id'][_0x5029('0x6c')]()))[_0x5029('0x38')](_0x5029('0x6f'),squel[_0x5029('0x63')]()['field'](_0x5029('0x71'))[_0x5029('0x70')](_0x5029('0x6a'))['where'](_0x5029('0x6b'),_0x9b1c13[_0x5029('0x40')]['id'][_0x5029('0x6c')]())[_0x5029('0x38')](_0x5029('0x72')))[_0x5029('0x73')](_0x5029('0x67')))['toString']();return db[_0x5029('0x48')][_0x5029('0x2c')](_0x181956);}return[];})[_0x5029('0x20')](respondWithResult(_0x1bd1c6,null))[_0x5029('0x3e')](handleError(_0x1bd1c6,null));};exports[_0x5029('0x74')]=function(_0x4c40d1,_0x209c83,_0x443070){return db[_0x5029('0x75')]['find']({'where':{'id':_0x4c40d1[_0x5029('0x40')]['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x209c83,null))['then'](function(_0x5c8bd4){var _0x524825;if(_0x5c8bd4){_0x524825=squel[_0x5029('0x76')]()[_0x5029('0x77')](_0x5029('0x5c'))[_0x5029('0x5d')]([_0x5029('0x5e'),'scheduledAt',_0x5029('0x67'),_0x5029('0x60'),_0x5029('0x78'),'createdAt','updatedAt'],squel[_0x5029('0x63')]()[_0x5029('0x64')](_0x5029('0x79'),_0x5029('0x5e'))['field'](_0x5029('0x65'),_0x5029('0x5f'))[_0x5029('0x64')](_0x5029('0x66'),_0x5029('0x67'))[_0x5029('0x64')](_0x5029('0x68'),_0x5029('0x60'))['field'](_0x5029('0x7a'),'CampaignId')['field'](_0x5029('0x65'),'createdAt')[_0x5029('0x64')](_0x5029('0x65'),_0x5029('0x62'))[_0x5029('0x70')](_0x5029('0x6a'))[_0x5029('0x38')](_0x5029('0x7b'),_0x4c40d1[_0x5029('0x40')]['id']['toString']())['where'](_0x5029('0x6d'),_0x4c40d1['body']['state'][_0x5029('0x6c')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')[_0x5029('0x38')](_0x5029('0x6f'),squel[_0x5029('0x63')]()[_0x5029('0x64')](_0x5029('0x5e'))['from'](_0x5029('0x5c'))[_0x5029('0x38')](_0x5029('0x7b'),_0x4c40d1['params']['id'][_0x5029('0x6c')]()))[_0x5029('0x38')](_0x5029('0x6f'),squel[_0x5029('0x63')]()[_0x5029('0x64')]('calleridnum')['from'](_0x5029('0x6a'))[_0x5029('0x38')]('CampaignId\x20=\x20?',_0x4c40d1[_0x5029('0x40')]['id'][_0x5029('0x6c')]())[_0x5029('0x38')](_0x5029('0x72')))[_0x5029('0x73')](_0x5029('0x67')))[_0x5029('0x6c')]();return db[_0x5029('0x48')]['query'](_0x524825);}return[];})['then'](respondWithResult(_0x209c83,null))[_0x5029('0x3e')](handleError(_0x209c83,null));};exports['checkContactHopper']=function(_0x20a259,_0x5e5f88,_0x36fdce){return db[_0x5029('0x7c')][_0x5029('0x7d')]({'where':{'VoiceQueueId':_0x20a259['body'][_0x5029('0x61')],'CampaignId':_0x20a259[_0x5029('0x45')][_0x5029('0x78')],'ContactId':_0x20a259['body'][_0x5029('0x67')]}})[_0x5029('0x20')](handleEntityNotFound(_0x5e5f88,null))[_0x5029('0x20')](function(_0x4421bd){if(_0x4421bd){return _0x4421bd;}return null;})[_0x5029('0x20')](respondWithResult(_0x5e5f88,null))[_0x5029('0x3e')](handleError(_0x5e5f88,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index aaf2b41..9f0ad23 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 _0x021c=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperFinal.attributes','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid'];(function(_0x48c212,_0x51a505){var _0x1fdce7=function(_0x129893){while(--_0x129893){_0x48c212['push'](_0x48c212['shift']());}};_0x1fdce7(++_0x51a505);}(_0x021c,0xe1));var _0xc021=function(_0x40b6db,_0x2a1fbb){_0x40b6db=_0x40b6db-0x0;var _0x3eaa81=_0x021c[_0x40b6db];return _0x3eaa81;};'use strict';var _=require(_0xc021('0x0'));var util=require(_0xc021('0x1'));var logger=require(_0xc021('0x2'))(_0xc021('0x3'));var moment=require(_0xc021('0x4'));var BPromise=require(_0xc021('0x5'));var rp=require(_0xc021('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc021('0x7'));var config=require(_0xc021('0x8'));var attributes=require(_0xc021('0x9'));module['exports']=function(_0x84626f,_0x34a83d){return _0x84626f[_0xc021('0xa')](_0xc021('0xb'),attributes,{'tableName':_0xc021('0xc'),'paranoid':![],'indexes':[{'name':_0xc021('0xd'),'fields':[_0xc021('0xd')]},{'name':'uniqueid','fields':[_0xc021('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2d57=['../../config/environment','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x2f87c2,_0x5b1e5c){var _0x2aaa28=function(_0x56c151){while(--_0x56c151){_0x2f87c2['push'](_0x2f87c2['shift']());}};_0x2aaa28(++_0x5b1e5c);}(_0x2d57,0x77));var _0x72d5=function(_0x55cc58,_0x5ce0af){_0x55cc58=_0x55cc58-0x0;var _0x26062e=_0x2d57[_0x55cc58];return _0x26062e;};'use strict';var _=require(_0x72d5('0x0'));var util=require(_0x72d5('0x1'));var logger=require('../../config/logger')(_0x72d5('0x2'));var moment=require('moment');var BPromise=require(_0x72d5('0x3'));var rp=require(_0x72d5('0x4'));var fs=require('fs');var path=require(_0x72d5('0x5'));var rimraf=require(_0x72d5('0x6'));var config=require(_0x72d5('0x7'));var attributes=require('./cmHopperFinal.attributes');module[_0x72d5('0x8')]=function(_0x52fae2,_0x28bf56){return _0x52fae2[_0x72d5('0x9')](_0x72d5('0xa'),attributes,{'tableName':_0x72d5('0xb'),'paranoid':![],'indexes':[{'name':_0x72d5('0xc'),'fields':[_0x72d5('0xc')]},{'name':'uniqueid','fields':[_0x72d5('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index ed5e1e9..52f224c 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(_0x2a9250,_0x263508){var _0x1839fe=function(_0x49bd3e){while(--_0x49bd3e){_0x2a9250['push'](_0x2a9250['shift']());}};_0x1839fe(++_0x263508);}(_0xb10b,0x12a));var _0xbb10=function(_0x490014,_0x519ad6){_0x490014=_0x490014-0x0;var _0x289bee=_0xb10b[_0x490014];return _0x289bee;};'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(_0x59a8e8,_0x9399a6){var _0x33936b=function(_0x4ff75b){while(--_0x4ff75b){_0x59a8e8['push'](_0x59a8e8['shift']());}};_0x33936b(++_0x9399a6);}(_0xb10b,0x12a));var _0xbb10=function(_0x4f431d,_0xd51a3b){_0x4f431d=_0x4f431d-0x0;var _0x4f31e1=_0xb10b[_0x4f431d];return _0x4f31e1;};'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 4f81f3b..d888777 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 _0xfd11=['put','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper'];(function(_0x112486,_0x36ee43){var _0x407584=function(_0x154963){while(--_0x154963){_0x112486['push'](_0x112486['shift']());}};_0x407584(++_0x36ee43);}(_0xfd11,0x13a));var _0x1fd1=function(_0x29d6e6,_0x264220){_0x29d6e6=_0x29d6e6-0x0;var _0xc75ff0=_0xfd11[_0x29d6e6];return _0xc75ff0;};'use strict';var multer=require('multer');var util=require(_0x1fd1('0x0'));var path=require(_0x1fd1('0x1'));var timeout=require(_0x1fd1('0x2'));var express=require(_0x1fd1('0x3'));var router=express[_0x1fd1('0x4')]();var fs_extra=require(_0x1fd1('0x5'));var auth=require(_0x1fd1('0x6'));var interaction=require(_0x1fd1('0x7'));var config=require(_0x1fd1('0x8'));var controller=require('./cmHopperFinal.controller');router[_0x1fd1('0x9')]('/',auth[_0x1fd1('0xa')](),controller[_0x1fd1('0xb')]);router['get'](_0x1fd1('0xc'),auth[_0x1fd1('0xa')](),controller[_0x1fd1('0xd')]);router[_0x1fd1('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x1fd1('0xe'),auth[_0x1fd1('0xa')](),controller[_0x1fd1('0xf')]);router['get']('/campaign/countAttributes/:id',auth['isAuthenticated'](),controller['countContactsIvrCampaignHopperFinal']);router[_0x1fd1('0x10')]('/voice/queue/moveContacts/:id',auth['isAuthenticated'](),controller[_0x1fd1('0x11')]);router[_0x1fd1('0x10')](_0x1fd1('0x12'),auth[_0x1fd1('0xa')](),controller[_0x1fd1('0x13')]);router['post'](_0x1fd1('0x14'),auth[_0x1fd1('0xa')](),controller[_0x1fd1('0x15')]);router[_0x1fd1('0x16')]('/:id',auth[_0x1fd1('0xa')](),controller['update']);module[_0x1fd1('0x17')]=router; \ No newline at end of file +var _0xb749=['/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','checkContactHopper','put','update','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','describe','/:id'];(function(_0x22342c,_0x218835){var _0xd3b434=function(_0x45b259){while(--_0x45b259){_0x22342c['push'](_0x22342c['shift']());}};_0xd3b434(++_0x218835);}(_0xb749,0xac));var _0x9b74=function(_0x3e8c4d,_0x18d01a){_0x3e8c4d=_0x3e8c4d-0x0;var _0x205fb5=_0xb749[_0x3e8c4d];return _0x205fb5;};'use strict';var multer=require(_0x9b74('0x0'));var util=require('util');var path=require(_0x9b74('0x1'));var timeout=require(_0x9b74('0x2'));var express=require('express');var router=express[_0x9b74('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9b74('0x4'));var interaction=require(_0x9b74('0x5'));var config=require(_0x9b74('0x6'));var controller=require(_0x9b74('0x7'));router[_0x9b74('0x8')]('/',auth[_0x9b74('0x9')](),controller['index']);router[_0x9b74('0x8')]('/describe',auth[_0x9b74('0x9')](),controller[_0x9b74('0xa')]);router[_0x9b74('0x8')](_0x9b74('0xb'),auth[_0x9b74('0x9')](),controller['show']);router[_0x9b74('0x8')](_0x9b74('0xc'),auth['isAuthenticated'](),controller[_0x9b74('0xd')]);router[_0x9b74('0x8')](_0x9b74('0xe'),auth['isAuthenticated'](),controller[_0x9b74('0xf')]);router[_0x9b74('0x10')](_0x9b74('0x11'),auth[_0x9b74('0x9')](),controller['moveContactsQueueCampaignHopperFinal']);router['post'](_0x9b74('0x12'),auth[_0x9b74('0x9')](),controller[_0x9b74('0x13')]);router[_0x9b74('0x10')]('/checkContactHopper',auth[_0x9b74('0x9')](),controller[_0x9b74('0x14')]);router[_0x9b74('0x15')](_0x9b74('0xb'),auth[_0x9b74('0x9')](),controller[_0x9b74('0x16')]);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 2fcb1cd..7a93a8c 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 _0x229d=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x229d,0x1b0));var _0xd229=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x229d[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require(_0xd229('0x0'));module[_0xd229('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xd229('0x2')]},'scheduledat':{'type':Sequelize[_0xd229('0x3')]},'countbusyretry':{'type':Sequelize[_0xd229('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd229('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xd229('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd229('0x2')]},'calleridname':{'type':Sequelize[_0xd229('0x2')]},'starttime':{'type':Sequelize[_0xd229('0x3')]},'responsetime':{'type':Sequelize[_0xd229('0x3')]},'answertime':{'type':Sequelize[_0xd229('0x3')]},'droptime':{'type':Sequelize[_0xd229('0x3')]},'endtime':{'type':Sequelize[_0xd229('0x3')]},'ringtime':{'type':Sequelize[_0xd229('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xd229('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xd229('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xd229('0x2')]},'campaign':{'type':Sequelize[_0xd229('0x2')]},'campaigntype':{'type':Sequelize[_0xd229('0x2')]},'membername':{'type':Sequelize[_0xd229('0x2')]},'reason':{'type':Sequelize[_0xd229('0x2')]},'amd':{'type':Sequelize[_0xd229('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xd229('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xd229('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd229('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xd229('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xd229('0x3')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xd229('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd229('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd229('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd229('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd229('0x4')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xd229('0x2')]}}; \ No newline at end of file +var _0x56c0=['STRING','INTEGER','DATE','BOOLEAN','exports'];(function(_0x2cffa7,_0x27c829){var _0x37634f=function(_0x240f68){while(--_0x240f68){_0x2cffa7['push'](_0x2cffa7['shift']());}};_0x37634f(++_0x27c829);}(_0x56c0,0x68));var _0x056c=function(_0x19b6f5,_0x367239){_0x19b6f5=_0x19b6f5-0x0;var _0x5f429f=_0x56c0[_0x19b6f5];return _0x5f429f;};'use strict';var Sequelize=require('sequelize');module[_0x056c('0x0')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x056c('0x1')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x056c('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x056c('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x056c('0x1')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x056c('0x1')]},'calleridname':{'type':Sequelize[_0x056c('0x1')]},'starttime':{'type':Sequelize[_0x056c('0x3')]},'responsetime':{'type':Sequelize[_0x056c('0x3')]},'answertime':{'type':Sequelize[_0x056c('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x056c('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x056c('0x1')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x056c('0x1')]},'reason':{'type':Sequelize[_0x056c('0x1')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x056c('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x056c('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x056c('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x056c('0x3')]},'recallme':{'type':Sequelize[_0x056c('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x056c('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x056c('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x056c('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x056c('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x056c('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x056c('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x056c('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 9da81b1..5d6cb00 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 _0x8b33=['querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','CmHopperHistory','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show','params','rawAttributes','include','find','catch','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv'];(function(_0x2e41e2,_0x4e7250){var _0x2844d6=function(_0x28ce24){while(--_0x28ce24){_0x2e41e2['push'](_0x2e41e2['shift']());}};_0x2844d6(++_0x4e7250);}(_0x8b33,0x87));var _0x38b3=function(_0x4e142b,_0x402f7b){_0x4e142b=_0x4e142b-0x0;var _0x28789d=_0x8b33[_0x4e142b];return _0x28789d;};'use strict';var emlformat=require(_0x38b3('0x0'));var rimraf=require(_0x38b3('0x1'));var zipdir=require(_0x38b3('0x2'));var jsonpatch=require(_0x38b3('0x3'));var rp=require('request-promise');var moment=require(_0x38b3('0x4'));var BPromise=require(_0x38b3('0x5'));var Mustache=require('mustache');var util=require(_0x38b3('0x6'));var path=require(_0x38b3('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x38b3('0x8'));var fs=require('fs');var fs_extra=require(_0x38b3('0x9'));var _=require(_0x38b3('0xa'));var squel=require(_0x38b3('0xb'));var crypto=require(_0x38b3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x38b3('0xd'));var toCsv=require(_0x38b3('0xe'));var querystring=require(_0x38b3('0xf'));var Papa=require('papaparse');var Redis=require(_0x38b3('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x38b3('0x11'));var logger=require(_0x38b3('0x12'))(_0x38b3('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x38b3('0x14'));var db=require(_0x38b3('0x15'))['db'];function respondWithStatusCode(_0x2f498d,_0x16d8ce){_0x16d8ce=_0x16d8ce||0xcc;return function(_0x280507){if(_0x280507){return _0x2f498d['sendStatus'](_0x16d8ce);}return _0x2f498d[_0x38b3('0x16')](_0x16d8ce)[_0x38b3('0x17')]();};}function respondWithResult(_0x148323,_0x27ffa7){_0x27ffa7=_0x27ffa7||0xc8;return function(_0x312a24){if(_0x312a24){return _0x148323['status'](_0x27ffa7)[_0x38b3('0x18')](_0x312a24);}};}function respondWithFilteredResult(_0xdc88ff,_0x4fba31){return function(_0x4c9735){if(_0x4c9735){var _0x428020=typeof _0x4fba31[_0x38b3('0x19')]===_0x38b3('0x1a')&&typeof _0x4fba31[_0x38b3('0x1b')]===_0x38b3('0x1a');var _0xbfe9d8=_0x4c9735[_0x38b3('0x1c')];var _0x5c9d70=_0x428020?0x0:_0x4fba31[_0x38b3('0x19')];var _0x28946d=_0x428020?_0x4c9735[_0x38b3('0x1c')]:_0x4fba31[_0x38b3('0x19')]+_0x4fba31[_0x38b3('0x1b')];var _0x5df2c9;if(_0x28946d>=_0xbfe9d8){_0x28946d=_0xbfe9d8;_0x5df2c9=0xc8;}else{_0x5df2c9=0xce;}_0xdc88ff[_0x38b3('0x16')](_0x5df2c9);return _0xdc88ff['set']('Content-Range',_0x5c9d70+'-'+_0x28946d+'/'+_0xbfe9d8)['json'](_0x4c9735);}return null;};}function patchUpdates(_0x5dc341){return function(_0x22555f){try{jsonpatch[_0x38b3('0x1d')](_0x22555f,_0x5dc341,!![]);}catch(_0x437575){return BPromise[_0x38b3('0x1e')](_0x437575);}return _0x22555f[_0x38b3('0x1f')]();};}function saveUpdates(_0x2ef225,_0x44a379){return function(_0x45ac90){if(_0x45ac90){return _0x45ac90[_0x38b3('0x20')](_0x2ef225)['then'](function(_0x3c7b2f){return _0x3c7b2f;});}return null;};}function removeEntity(_0x56831e,_0x127714){return function(_0x3a8f7e){if(_0x3a8f7e){return _0x3a8f7e[_0x38b3('0x21')]()[_0x38b3('0x22')](function(){_0x56831e[_0x38b3('0x16')](0xcc)[_0x38b3('0x17')]();});}};}function handleEntityNotFound(_0x244d56,_0x267778){return function(_0x206050){if(!_0x206050){_0x244d56[_0x38b3('0x23')](0x194);}return _0x206050;};}function handleError(_0x509b63,_0xd9fae1){_0xd9fae1=_0xd9fae1||0x1f4;return function(_0x3d09d3){logger[_0x38b3('0x24')](_0x3d09d3[_0x38b3('0x25')]);if(_0x3d09d3[_0x38b3('0x26')]){delete _0x3d09d3[_0x38b3('0x26')];}_0x509b63['status'](_0xd9fae1)[_0x38b3('0x27')](_0x3d09d3);};}exports[_0x38b3('0x28')]=function(_0x1265f3,_0xa096f2){var _0x3c9898={},_0x3b8b90={},_0x193838={'count':0x0,'rows':[]};var _0x236c1c=_[_0x38b3('0x29')](db[_0x38b3('0x2a')]['rawAttributes'],function(_0xc2214d){return{'name':_0xc2214d['fieldName'],'type':_0xc2214d[_0x38b3('0x2b')][_0x38b3('0x2c')]};});_0x3b8b90['model']=_['map'](_0x236c1c,_0x38b3('0x26'));_0x3b8b90[_0x38b3('0x2d')]=_[_0x38b3('0x2e')](_0x1265f3['query']);_0x3b8b90['filters']=_[_0x38b3('0x2f')](_0x3b8b90[_0x38b3('0x30')],_0x3b8b90['query']);_0x3c9898[_0x38b3('0x31')]=_[_0x38b3('0x2f')](_0x3b8b90[_0x38b3('0x30')],qs[_0x38b3('0x32')](_0x1265f3['query']['fields']));_0x3c9898[_0x38b3('0x31')]=_0x3c9898[_0x38b3('0x31')][_0x38b3('0x33')]?_0x3c9898[_0x38b3('0x31')]:_0x3b8b90[_0x38b3('0x30')];if(!_0x1265f3[_0x38b3('0x2d')][_0x38b3('0x34')](_0x38b3('0x35'))){_0x3c9898[_0x38b3('0x1b')]=qs[_0x38b3('0x1b')](_0x1265f3['query'][_0x38b3('0x1b')]);_0x3c9898['offset']=qs[_0x38b3('0x19')](_0x1265f3['query'][_0x38b3('0x19')]);}_0x3c9898[_0x38b3('0x36')]=qs['sort'](_0x1265f3['query'][_0x38b3('0x37')]);_0x3c9898[_0x38b3('0x38')]=qs[_0x38b3('0x39')](_[_0x38b3('0x3a')](_0x1265f3['query'],_0x3b8b90[_0x38b3('0x39')]),_0x236c1c);if(_0x1265f3[_0x38b3('0x2d')][_0x38b3('0x3b')]){_0x3c9898[_0x38b3('0x38')]=_[_0x38b3('0x3c')](_0x3c9898[_0x38b3('0x38')],{'$or':_['map'](_0x236c1c,function(_0x40b486){if(_0x40b486[_0x38b3('0x2b')]!==_0x38b3('0x3d')){var _0x3a4d2e={};_0x3a4d2e[_0x40b486[_0x38b3('0x26')]]={'$like':'%'+_0x1265f3[_0x38b3('0x2d')][_0x38b3('0x3b')]+'%'};return _0x3a4d2e;}})});}_0x3c9898=_[_0x38b3('0x3c')]({},_0x3c9898,_0x1265f3['options']);var _0x37c618={'where':_0x3c9898[_0x38b3('0x38')]};return db['CmHopperHistory'][_0x38b3('0x1c')](_0x37c618)['then'](function(_0x464f1d){_0x193838['count']=_0x464f1d;if(_0x1265f3['query'][_0x38b3('0x3e')]){_0x3c9898['include']=[{'all':!![]}];}return db[_0x38b3('0x2a')][_0x38b3('0x3f')](_0x3c9898);})[_0x38b3('0x22')](function(_0x3c3e60){_0x193838[_0x38b3('0x40')]=_0x3c3e60;return _0x193838;})[_0x38b3('0x22')](respondWithFilteredResult(_0xa096f2,_0x3c9898))['catch'](handleError(_0xa096f2,null));};exports[_0x38b3('0x41')]=function(_0x5c117a,_0x3b3faa){var _0x5d30ae={'raw':!![],'where':{'id':_0x5c117a[_0x38b3('0x42')]['id']}},_0x5edb9a={};_0x5edb9a['model']=_['keys'](db[_0x38b3('0x2a')][_0x38b3('0x43')]);_0x5edb9a[_0x38b3('0x2d')]=_[_0x38b3('0x2e')](_0x5c117a[_0x38b3('0x2d')]);_0x5edb9a[_0x38b3('0x39')]=_[_0x38b3('0x2f')](_0x5edb9a[_0x38b3('0x30')],_0x5edb9a[_0x38b3('0x2d')]);_0x5d30ae[_0x38b3('0x31')]=_[_0x38b3('0x2f')](_0x5edb9a[_0x38b3('0x30')],qs[_0x38b3('0x32')](_0x5c117a[_0x38b3('0x2d')][_0x38b3('0x32')]));_0x5d30ae['attributes']=_0x5d30ae[_0x38b3('0x31')][_0x38b3('0x33')]?_0x5d30ae[_0x38b3('0x31')]:_0x5edb9a[_0x38b3('0x30')];if(_0x5c117a['query'][_0x38b3('0x3e')]){_0x5d30ae[_0x38b3('0x44')]=[{'all':!![]}];}_0x5d30ae=_[_0x38b3('0x3c')]({},_0x5d30ae,_0x5c117a['options']);return db[_0x38b3('0x2a')][_0x38b3('0x45')](_0x5d30ae)['then'](handleEntityNotFound(_0x3b3faa,null))['then'](respondWithResult(_0x3b3faa,null))[_0x38b3('0x46')](handleError(_0x3b3faa,null));};exports[_0x38b3('0x47')]=function(_0x35345b,_0xbf3c03){return db[_0x38b3('0x2a')][_0x38b3('0x47')](_0x35345b[_0x38b3('0x48')],{})[_0x38b3('0x22')](respondWithResult(_0xbf3c03,0xc9))[_0x38b3('0x46')](handleError(_0xbf3c03,null));};exports[_0x38b3('0x49')]=function(_0x4750cd,_0x4662cc){return db[_0x38b3('0x2a')][_0x38b3('0x49')]()['then'](respondWithResult(_0x4662cc,null))['catch'](handleError(_0x4662cc,null));};exports[_0x38b3('0x20')]=function(_0x32ba46,_0xff02a0){if(_0x32ba46[_0x38b3('0x48')][_0x38b3('0x4a')]){delete _0x32ba46[_0x38b3('0x48')][_0x38b3('0x4a')];}return db[_0x38b3('0x2a')][_0x38b3('0x45')]({'where':{'uniqueid':_0x32ba46[_0x38b3('0x42')]['id']}})['then'](handleEntityNotFound(_0xff02a0,null))[_0x38b3('0x22')](saveUpdates(_0x32ba46[_0x38b3('0x48')],null))['then'](respondWithResult(_0xff02a0,null))['catch'](handleError(_0xff02a0,null));}; \ No newline at end of file +var _0x0f21=['where','merge','type','VIRTUAL','filter','options','includeAll','include','rows','show','params','keys','length','find','create','body','describe','catch','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','key','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','filters'];(function(_0xc76644,_0x2c0f9a){var _0x366481=function(_0x1800b7){while(--_0x1800b7){_0xc76644['push'](_0xc76644['shift']());}};_0x366481(++_0x2c0f9a);}(_0x0f21,0xa5));var _0x10f2=function(_0xbafa32,_0x2c216b){_0xbafa32=_0xbafa32-0x0;var _0x16bb35=_0x0f21[_0xbafa32];return _0x16bb35;};'use strict';var emlformat=require(_0x10f2('0x0'));var rimraf=require(_0x10f2('0x1'));var zipdir=require(_0x10f2('0x2'));var jsonpatch=require(_0x10f2('0x3'));var rp=require('request-promise');var moment=require(_0x10f2('0x4'));var BPromise=require(_0x10f2('0x5'));var Mustache=require(_0x10f2('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x10f2('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x10f2('0x8'));var _=require(_0x10f2('0x9'));var squel=require(_0x10f2('0xa'));var crypto=require('crypto');var jsforce=require(_0x10f2('0xb'));var deskjs=require(_0x10f2('0xc'));var toCsv=require(_0x10f2('0x7'));var querystring=require(_0x10f2('0xd'));var Papa=require('papaparse');var Redis=require(_0x10f2('0xe'));var authService=require(_0x10f2('0xf'));var qs=require(_0x10f2('0x10'));var as=require(_0x10f2('0x11'));var hardwareService=require(_0x10f2('0x12'));var logger=require(_0x10f2('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x10f2('0x14'))['db'];function respondWithStatusCode(_0x22ace0,_0x427598){_0x427598=_0x427598||0xcc;return function(_0x2200f9){if(_0x2200f9){return _0x22ace0[_0x10f2('0x15')](_0x427598);}return _0x22ace0[_0x10f2('0x16')](_0x427598)[_0x10f2('0x17')]();};}function respondWithResult(_0x55770c,_0x22ce03){_0x22ce03=_0x22ce03||0xc8;return function(_0x3f84f7){if(_0x3f84f7){return _0x55770c[_0x10f2('0x16')](_0x22ce03)[_0x10f2('0x18')](_0x3f84f7);}};}function respondWithFilteredResult(_0x427797,_0x2ed001){return function(_0x4115d4){if(_0x4115d4){var _0x47ea42=typeof _0x2ed001[_0x10f2('0x19')]===_0x10f2('0x1a')&&typeof _0x2ed001['limit']==='undefined';var _0x271461=_0x4115d4[_0x10f2('0x1b')];var _0x5bb4ec=_0x47ea42?0x0:_0x2ed001[_0x10f2('0x19')];var _0x51692c=_0x47ea42?_0x4115d4[_0x10f2('0x1b')]:_0x2ed001[_0x10f2('0x19')]+_0x2ed001['limit'];var _0x119f29;if(_0x51692c>=_0x271461){_0x51692c=_0x271461;_0x119f29=0xc8;}else{_0x119f29=0xce;}_0x427797[_0x10f2('0x16')](_0x119f29);return _0x427797[_0x10f2('0x1c')](_0x10f2('0x1d'),_0x5bb4ec+'-'+_0x51692c+'/'+_0x271461)[_0x10f2('0x18')](_0x4115d4);}return null;};}function patchUpdates(_0x38d96e){return function(_0x4f57d5){try{jsonpatch[_0x10f2('0x1e')](_0x4f57d5,_0x38d96e,!![]);}catch(_0x59f0d8){return BPromise[_0x10f2('0x1f')](_0x59f0d8);}return _0x4f57d5['save']();};}function saveUpdates(_0x3d3b54,_0x11eb67){return function(_0x21d71b){if(_0x21d71b){return _0x21d71b[_0x10f2('0x20')](_0x3d3b54)['then'](function(_0x4d5452){return _0x4d5452;});}return null;};}function removeEntity(_0x297c13,_0xf34a85){return function(_0x38b335){if(_0x38b335){return _0x38b335['destroy']()[_0x10f2('0x21')](function(){_0x297c13['status'](0xcc)[_0x10f2('0x17')]();});}};}function handleEntityNotFound(_0x55c8d1,_0x4189d3){return function(_0x38f451){if(!_0x38f451){_0x55c8d1[_0x10f2('0x15')](0x194);}return _0x38f451;};}function handleError(_0x451cb0,_0x447bbf){_0x447bbf=_0x447bbf||0x1f4;return function(_0x176f0b){logger['error'](_0x176f0b[_0x10f2('0x22')]);if(_0x176f0b['name']){delete _0x176f0b[_0x10f2('0x23')];}_0x451cb0[_0x10f2('0x16')](_0x447bbf)[_0x10f2('0x24')](_0x176f0b);};}exports[_0x10f2('0x25')]=function(_0x21a7d2,_0x4f3d67){var _0x1e7c52={},_0xbe6943={},_0x267be7={'count':0x0,'rows':[]};var _0x136aa9=_[_0x10f2('0x26')](db[_0x10f2('0x27')][_0x10f2('0x28')],function(_0x3e1276){return{'name':_0x3e1276[_0x10f2('0x29')],'type':_0x3e1276['type'][_0x10f2('0x2a')]};});_0xbe6943[_0x10f2('0x2b')]=_['map'](_0x136aa9,_0x10f2('0x23'));_0xbe6943[_0x10f2('0x2c')]=_['keys'](_0x21a7d2[_0x10f2('0x2c')]);_0xbe6943['filters']=_['intersection'](_0xbe6943[_0x10f2('0x2b')],_0xbe6943[_0x10f2('0x2c')]);_0x1e7c52[_0x10f2('0x2d')]=_[_0x10f2('0x2e')](_0xbe6943[_0x10f2('0x2b')],qs['fields'](_0x21a7d2[_0x10f2('0x2c')][_0x10f2('0x2f')]));_0x1e7c52[_0x10f2('0x2d')]=_0x1e7c52['attributes']['length']?_0x1e7c52['attributes']:_0xbe6943[_0x10f2('0x2b')];if(!_0x21a7d2[_0x10f2('0x2c')][_0x10f2('0x30')](_0x10f2('0x31'))){_0x1e7c52[_0x10f2('0x32')]=qs['limit'](_0x21a7d2[_0x10f2('0x2c')][_0x10f2('0x32')]);_0x1e7c52[_0x10f2('0x19')]=qs[_0x10f2('0x19')](_0x21a7d2[_0x10f2('0x2c')][_0x10f2('0x19')]);}_0x1e7c52[_0x10f2('0x33')]=qs['sort'](_0x21a7d2[_0x10f2('0x2c')][_0x10f2('0x34')]);_0x1e7c52['where']=qs[_0x10f2('0x35')](_['pick'](_0x21a7d2['query'],_0xbe6943[_0x10f2('0x35')]),_0x136aa9);if(_0x21a7d2[_0x10f2('0x2c')]['filter']){_0x1e7c52[_0x10f2('0x36')]=_[_0x10f2('0x37')](_0x1e7c52[_0x10f2('0x36')],{'$or':_[_0x10f2('0x26')](_0x136aa9,function(_0xbe26e4){if(_0xbe26e4[_0x10f2('0x38')]!==_0x10f2('0x39')){var _0x487be4={};_0x487be4[_0xbe26e4[_0x10f2('0x23')]]={'$like':'%'+_0x21a7d2[_0x10f2('0x2c')][_0x10f2('0x3a')]+'%'};return _0x487be4;}})});}_0x1e7c52=_[_0x10f2('0x37')]({},_0x1e7c52,_0x21a7d2[_0x10f2('0x3b')]);var _0x147a15={'where':_0x1e7c52[_0x10f2('0x36')]};return db[_0x10f2('0x27')][_0x10f2('0x1b')](_0x147a15)['then'](function(_0x2a2e6a){_0x267be7[_0x10f2('0x1b')]=_0x2a2e6a;if(_0x21a7d2['query'][_0x10f2('0x3c')]){_0x1e7c52[_0x10f2('0x3d')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x1e7c52);})[_0x10f2('0x21')](function(_0x65afbc){_0x267be7[_0x10f2('0x3e')]=_0x65afbc;return _0x267be7;})[_0x10f2('0x21')](respondWithFilteredResult(_0x4f3d67,_0x1e7c52))['catch'](handleError(_0x4f3d67,null));};exports[_0x10f2('0x3f')]=function(_0x138277,_0x33e415){var _0x3d0df0={'raw':!![],'where':{'id':_0x138277[_0x10f2('0x40')]['id']}},_0x4d74f9={};_0x4d74f9['model']=_['keys'](db['CmHopperHistory']['rawAttributes']);_0x4d74f9[_0x10f2('0x2c')]=_[_0x10f2('0x41')](_0x138277['query']);_0x4d74f9[_0x10f2('0x35')]=_['intersection'](_0x4d74f9[_0x10f2('0x2b')],_0x4d74f9[_0x10f2('0x2c')]);_0x3d0df0[_0x10f2('0x2d')]=_[_0x10f2('0x2e')](_0x4d74f9[_0x10f2('0x2b')],qs['fields'](_0x138277[_0x10f2('0x2c')]['fields']));_0x3d0df0[_0x10f2('0x2d')]=_0x3d0df0[_0x10f2('0x2d')][_0x10f2('0x42')]?_0x3d0df0['attributes']:_0x4d74f9['model'];if(_0x138277['query'][_0x10f2('0x3c')]){_0x3d0df0[_0x10f2('0x3d')]=[{'all':!![]}];}_0x3d0df0=_[_0x10f2('0x37')]({},_0x3d0df0,_0x138277[_0x10f2('0x3b')]);return db[_0x10f2('0x27')][_0x10f2('0x43')](_0x3d0df0)['then'](handleEntityNotFound(_0x33e415,null))[_0x10f2('0x21')](respondWithResult(_0x33e415,null))['catch'](handleError(_0x33e415,null));};exports[_0x10f2('0x44')]=function(_0x154e99,_0x13d86c){return db[_0x10f2('0x27')]['create'](_0x154e99[_0x10f2('0x45')],{})[_0x10f2('0x21')](respondWithResult(_0x13d86c,0xc9))['catch'](handleError(_0x13d86c,null));};exports[_0x10f2('0x46')]=function(_0xe51d1c,_0x56050a){return db[_0x10f2('0x27')][_0x10f2('0x46')]()[_0x10f2('0x21')](respondWithResult(_0x56050a,null))[_0x10f2('0x47')](handleError(_0x56050a,null));};exports[_0x10f2('0x20')]=function(_0x5cc503,_0x1aa463){if(_0x5cc503['body'][_0x10f2('0x48')]){delete _0x5cc503[_0x10f2('0x45')][_0x10f2('0x48')];}return db[_0x10f2('0x27')][_0x10f2('0x43')]({'where':{'uniqueid':_0x5cc503['params']['id']}})[_0x10f2('0x21')](handleEntityNotFound(_0x1aa463,null))[_0x10f2('0x21')](saveUpdates(_0x5cc503[_0x10f2('0x45')],null))[_0x10f2('0x21')](respondWithResult(_0x1aa463,null))['catch'](handleError(_0x1aa463,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index a803f7c..da4080f 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 _0x38b8=['uniqueid','lodash','../../config/logger','api','bluebird','rimraf','../../config/environment','CmHopperHistory','cm_hopper_history'];(function(_0x2acd5c,_0x3c78d0){var _0x4ee361=function(_0x5391d9){while(--_0x5391d9){_0x2acd5c['push'](_0x2acd5c['shift']());}};_0x4ee361(++_0x3c78d0);}(_0x38b8,0x7f));var _0x838b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x38b8[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x838b('0x0'));var util=require('util');var logger=require(_0x838b('0x1'))(_0x838b('0x2'));var moment=require('moment');var BPromise=require(_0x838b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x838b('0x4'));var config=require(_0x838b('0x5'));var attributes=require('./cmHopperHistory.attributes');module['exports']=function(_0x43fd53,_0x4299dc){return _0x43fd53['define'](_0x838b('0x6'),attributes,{'tableName':_0x838b('0x7'),'paranoid':![],'indexes':[{'name':'endtime','fields':['endtime']},{'name':_0x838b('0x8'),'fields':[_0x838b('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6343=['../../config/logger','api','rimraf','../../config/environment','exports','define','CmHopperHistory','endtime','uniqueid'];(function(_0x4099ee,_0x38495a){var _0x1b7bfc=function(_0x5f5388){while(--_0x5f5388){_0x4099ee['push'](_0x4099ee['shift']());}};_0x1b7bfc(++_0x38495a);}(_0x6343,0x168));var _0x3634=function(_0x5ec1ed,_0x97292c){_0x5ec1ed=_0x5ec1ed-0x0;var _0x471c1a=_0x6343[_0x5ec1ed];return _0x471c1a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3634('0x0'))(_0x3634('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3634('0x2'));var config=require(_0x3634('0x3'));var attributes=require('./cmHopperHistory.attributes');module[_0x3634('0x4')]=function(_0x388c18,_0x4bb496){return _0x388c18[_0x3634('0x5')](_0x3634('0x6'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':'endtime','fields':[_0x3634('0x7')]},{'name':_0x3634('0x8'),'fields':[_0x3634('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 3ec59dc..3f79da3 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 _0x5ab4=['outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateCmHopperHistory','create','body','options','CmHopperHistory','where','sequelize','COUNT','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','AvgHandleTime','catch','GetVoiceQueueHopperHistory','findAll','raw','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null'];(function(_0x1d6a82,_0x37c315){var _0x5834ac=function(_0x2402ba){while(--_0x2402ba){_0x1d6a82['push'](_0x1d6a82['shift']());}};_0x5834ac(++_0x37c315);}(_0x5ab4,0x9f));var _0x45ab=function(_0x1ecbbb,_0x761a71){_0x1ecbbb=_0x1ecbbb-0x0;var _0x5c7880=_0x5ab4[_0x1ecbbb];return _0x5c7880;};'use strict';var _=require(_0x45ab('0x0'));var util=require(_0x45ab('0x1'));var moment=require(_0x45ab('0x2'));var BPromise=require(_0x45ab('0x3'));var rs=require(_0x45ab('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x45ab('0x5'))['db'];var utils=require(_0x45ab('0x6'));var logger=require(_0x45ab('0x7'))(_0x45ab('0x8'));var config=require(_0x45ab('0x9'));var jayson=require(_0x45ab('0xa'));var client=jayson['client'][_0x45ab('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22a033,_0x2941e8,_0x4250ec){return new BPromise(function(_0x2beb3a,_0x2b7264){return client[_0x45ab('0xc')](_0x22a033,_0x4250ec)[_0x45ab('0xd')](function(_0x292720){logger[_0x45ab('0xe')](_0x45ab('0xf'),_0x2941e8,_0x45ab('0x10'));logger[_0x45ab('0x11')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x2941e8,_0x45ab('0x10'),JSON[_0x45ab('0x12')](_0x292720));if(_0x292720[_0x45ab('0x13')]){if(_0x292720[_0x45ab('0x13')][_0x45ab('0x14')]===0x1f4){logger[_0x45ab('0x13')](_0x45ab('0xf'),_0x2941e8,_0x292720[_0x45ab('0x13')][_0x45ab('0x15')]);return _0x2b7264(_0x292720['error']['message']);}logger[_0x45ab('0x13')](_0x45ab('0xf'),_0x2941e8,_0x292720[_0x45ab('0x13')][_0x45ab('0x15')]);return _0x2beb3a(_0x292720[_0x45ab('0x13')][_0x45ab('0x15')]);}else{logger[_0x45ab('0xe')](_0x45ab('0xf'),_0x2941e8,'request\x20sent');_0x2beb3a(_0x292720[_0x45ab('0x16')][_0x45ab('0x15')]);}})['catch'](function(_0x3a9e8b){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x2941e8,_0x3a9e8b);_0x2b7264(_0x3a9e8b);});});}exports[_0x45ab('0x17')]=function(_0x46ef46){var _0x40e4d1=this;return new Promise(function(_0xac7ce0,_0x277352){return db['CmHopperHistory'][_0x45ab('0x18')](_0x46ef46[_0x45ab('0x19')],{'raw':_0x46ef46[_0x45ab('0x1a')]?_0x46ef46[_0x45ab('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x45ab('0xd')](function(_0x54fdab){logger[_0x45ab('0xe')](_0x45ab('0x17'),_0x46ef46);logger[_0x45ab('0x11')](_0x45ab('0x17'),_0x46ef46,JSON[_0x45ab('0x12')](_0x54fdab));_0xac7ce0(_0x54fdab);})['catch'](function(_0x16549e){logger[_0x45ab('0x13')]('CreateCmHopperHistory',_0x16549e[_0x45ab('0x15')],_0x46ef46);_0x277352(_0x40e4d1[_0x45ab('0x13')](0x1f4,_0x16549e[_0x45ab('0x15')]));});});};exports['AvgHandleTime']=function(_0x229ead){var _0x559a00=this;return new Promise(function(_0x577a3a,_0x4d5fac){return db[_0x45ab('0x1b')]['findAll']({'raw':_0x229ead['options']?_0x229ead[_0x45ab('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x229ead[_0x45ab('0x1a')]?_0x229ead[_0x45ab('0x1a')][_0x45ab('0x1c')]||null:null,'attributes':[[db[_0x45ab('0x1d')]['fn'](_0x45ab('0x1e'),db[_0x45ab('0x1d')]['col']('id')),'predictiveIntervalTotalCalls'],[db[_0x45ab('0x1d')]['fn'](_0x45ab('0x1e'),db[_0x45ab('0x1d')]['fn']('IF',db[_0x45ab('0x1d')]['literal']('`state`\x20=\x204,\x201,\x20null'))),'predictiveIntervalAnsweredCalls'],[db[_0x45ab('0x1d')]['fn'](_0x45ab('0x1e'),db[_0x45ab('0x1d')]['fn']('IF',db[_0x45ab('0x1d')][_0x45ab('0x1f')](_0x45ab('0x20')))),_0x45ab('0x21')],[db[_0x45ab('0x1d')]['fn'](_0x45ab('0x1e'),db['sequelize']['fn']('IF',db[_0x45ab('0x1d')][_0x45ab('0x1f')]('`state`\x20=\x2011,\x201,\x20null'))),_0x45ab('0x22')],[db[_0x45ab('0x1d')]['fn'](_0x45ab('0x23'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x45ab('0x24')))),'predictiveIntervalAvgHoldtime'],[db[_0x45ab('0x1d')]['fn'](_0x45ab('0x23'),db['sequelize']['fn']('IF',db[_0x45ab('0x1d')][_0x45ab('0x1f')](_0x45ab('0x25')))),'predictiveIntervalAvgTalktime']]})[_0x45ab('0xd')](function(_0x2b0158){logger[_0x45ab('0xe')](_0x45ab('0x26'),_0x229ead);logger[_0x45ab('0x11')]('AvgHandleTime',_0x229ead,JSON[_0x45ab('0x12')](_0x2b0158));_0x577a3a(_0x2b0158);})[_0x45ab('0x27')](function(_0x58bd17){logger[_0x45ab('0x13')]('AvgHandleTime',_0x58bd17[_0x45ab('0x15')],_0x229ead);_0x4d5fac(_0x559a00[_0x45ab('0x13')](0x1f4,_0x58bd17[_0x45ab('0x15')]));});});};exports[_0x45ab('0x28')]=function(_0x5e5379){var _0x3d3694=this;return new Promise(function(_0x5e2fa9,_0x5aeff1){return db[_0x45ab('0x1b')][_0x45ab('0x29')]({'raw':_0x5e5379[_0x45ab('0x1a')]?_0x5e5379[_0x45ab('0x1a')][_0x45ab('0x2a')]===undefined?!![]:![]:!![],'where':_0x5e5379[_0x45ab('0x1a')]?_0x5e5379['options'][_0x45ab('0x1c')]||null:null,'attributes':[[_0x45ab('0x2b'),_0x45ab('0x2c')],[db[_0x45ab('0x1d')]['fn'](_0x45ab('0x1e'),db[_0x45ab('0x1d')]['fn']('IF',db['sequelize'][_0x45ab('0x1f')](_0x45ab('0x2d')))),_0x45ab('0x2e')],[db['sequelize']['fn'](_0x45ab('0x1e'),db[_0x45ab('0x1d')]['fn']('IF',db['sequelize'][_0x45ab('0x1f')](_0x45ab('0x2f')))),_0x45ab('0x30')],[db[_0x45ab('0x1d')]['fn'](_0x45ab('0x1e'),db[_0x45ab('0x1d')]['fn']('IF',db[_0x45ab('0x1d')][_0x45ab('0x1f')]('`state`\x20=\x204,\x201,\x20null'))),_0x45ab('0x31')],[db[_0x45ab('0x1d')]['fn'](_0x45ab('0x1e'),db[_0x45ab('0x1d')]['fn']('IF',db['sequelize'][_0x45ab('0x1f')](_0x45ab('0x32')))),'outboundBusyCallsDay'],[db[_0x45ab('0x1d')]['fn'](_0x45ab('0x1e'),db[_0x45ab('0x1d')]['fn']('IF',db['sequelize'][_0x45ab('0x1f')]('`state`\x20=\x208,\x201,\x20null'))),_0x45ab('0x33')],[db[_0x45ab('0x1d')]['fn'](_0x45ab('0x1e'),db['sequelize']['fn']('IF',db['sequelize'][_0x45ab('0x1f')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x45ab('0x34')],[db[_0x45ab('0x1d')]['fn'](_0x45ab('0x1e'),db['sequelize']['fn']('IF',db[_0x45ab('0x1d')][_0x45ab('0x1f')](_0x45ab('0x35')))),_0x45ab('0x36')],[db[_0x45ab('0x1d')]['fn'](_0x45ab('0x1e'),db[_0x45ab('0x1d')]['fn']('IF',db['sequelize'][_0x45ab('0x1f')]('`state`\x20=\x2012,\x201,\x20null'))),_0x45ab('0x37')],[db[_0x45ab('0x1d')]['fn'](_0x45ab('0x1e'),db[_0x45ab('0x1d')]['fn']('IF',db[_0x45ab('0x1d')][_0x45ab('0x1f')](_0x45ab('0x38')))),'outboundBlacklistCallsDay'],[db[_0x45ab('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x45ab('0x1d')]['literal'](_0x45ab('0x39')))),_0x45ab('0x3a')],[db['sequelize']['fn'](_0x45ab('0x1e'),db[_0x45ab('0x1d')]['fn']('IF',db[_0x45ab('0x1d')][_0x45ab('0x1f')](_0x45ab('0x3b')))),_0x45ab('0x3c')],[db[_0x45ab('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x45ab('0x1d')][_0x45ab('0x1f')](_0x45ab('0x3d')))),_0x45ab('0x3e')],[db[_0x45ab('0x1d')]['fn'](_0x45ab('0x1e'),db[_0x45ab('0x1d')]['fn']('IF',db[_0x45ab('0x1d')][_0x45ab('0x1f')](_0x45ab('0x3f')))),_0x45ab('0x3c')],[db[_0x45ab('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x45ab('0x1d')]['literal'](_0x45ab('0x40')))),_0x45ab('0x41')]],'group':['campaign']})['then'](function(_0x26f423){logger[_0x45ab('0xe')](_0x45ab('0x28'),_0x5e5379);logger[_0x45ab('0x11')](_0x45ab('0x28'),_0x5e5379,JSON[_0x45ab('0x12')](_0x26f423));_0x5e2fa9(_0x26f423);})[_0x45ab('0x27')](function(_0x2ee47c){logger[_0x45ab('0x13')]('GetVoiceQueueHopperHistory',_0x2ee47c[_0x45ab('0x15')],_0x5e5379);_0x5aeff1(_0x3d3694[_0x45ab('0x13')](0x1f4,_0x2ee47c[_0x45ab('0x15')]));});});};exports['GetCampaignHopperHistory']=function(_0x45c6dd){var _0x189280=this;return new Promise(function(_0xaf5bd4,_0x5505a3){return db[_0x45ab('0x1b')][_0x45ab('0x29')]({'raw':_0x45c6dd['options']?_0x45c6dd[_0x45ab('0x1a')][_0x45ab('0x2a')]===undefined?!![]:![]:!![],'where':_0x45c6dd[_0x45ab('0x1a')]?_0x45c6dd[_0x45ab('0x1a')][_0x45ab('0x1c')]||null:null,'attributes':[[_0x45ab('0x2b'),_0x45ab('0x2c')],[db[_0x45ab('0x1d')]['fn'](_0x45ab('0x1e'),db[_0x45ab('0x1d')]['col']('id')),_0x45ab('0x42')],[db['sequelize']['fn'](_0x45ab('0x1e'),db[_0x45ab('0x1d')]['fn']('IF',db['sequelize'][_0x45ab('0x1f')]('`state`\x20=\x204,\x201,\x20null'))),_0x45ab('0x43')]],'group':[_0x45ab('0x2b')]})['then'](function(_0x31e8e1){logger['info'](_0x45ab('0x44'),_0x45c6dd);logger['debug'](_0x45ab('0x44'),_0x45c6dd,JSON[_0x45ab('0x12')](_0x31e8e1));_0xaf5bd4(_0x31e8e1);})[_0x45ab('0x27')](function(_0x50d837){logger[_0x45ab('0x13')](_0x45ab('0x44'),_0x50d837[_0x45ab('0x15')],_0x45c6dd);_0x5505a3(_0x189280[_0x45ab('0x13')](0x1f4,_0x50d837['message']));});});}; \ No newline at end of file +var _0xcc19=['AvgHandleTime','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','findAll','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrAnswerCallsDay','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','then','debug'];(function(_0x21aa5b,_0x2c808f){var _0x2ca4c8=function(_0x5819e5){while(--_0x5819e5){_0x21aa5b['push'](_0x21aa5b['shift']());}};_0x2ca4c8(++_0x2c808f);}(_0xcc19,0xbd));var _0x9cc1=function(_0x32a2cf,_0x20b153){_0x32a2cf=_0x32a2cf-0x0;var _0x250e9d=_0xcc19[_0x32a2cf];return _0x250e9d;};'use strict';var _=require(_0x9cc1('0x0'));var util=require(_0x9cc1('0x1'));var moment=require('moment');var BPromise=require(_0x9cc1('0x2'));var rs=require(_0x9cc1('0x3'));var fs=require('fs');var Redis=require(_0x9cc1('0x4'));var db=require(_0x9cc1('0x5'))['db'];var utils=require(_0x9cc1('0x6'));var logger=require(_0x9cc1('0x7'))(_0x9cc1('0x8'));var config=require(_0x9cc1('0x9'));var jayson=require(_0x9cc1('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x29eebc,_0x1b6b0f,_0x3b8efc){return new BPromise(function(_0x3050ca,_0x17d405){return client[_0x9cc1('0xb')](_0x29eebc,_0x3b8efc)['then'](function(_0xc994dd){logger[_0x9cc1('0xc')](_0x9cc1('0xd'),_0x1b6b0f,_0x9cc1('0xe'));logger['debug'](_0x9cc1('0xf'),_0x1b6b0f,_0x9cc1('0xe'),JSON[_0x9cc1('0x10')](_0xc994dd));if(_0xc994dd[_0x9cc1('0x11')]){if(_0xc994dd[_0x9cc1('0x11')][_0x9cc1('0x12')]===0x1f4){logger[_0x9cc1('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x1b6b0f,_0xc994dd[_0x9cc1('0x11')][_0x9cc1('0x13')]);return _0x17d405(_0xc994dd[_0x9cc1('0x11')][_0x9cc1('0x13')]);}logger[_0x9cc1('0x11')](_0x9cc1('0xd'),_0x1b6b0f,_0xc994dd[_0x9cc1('0x11')][_0x9cc1('0x13')]);return _0x3050ca(_0xc994dd[_0x9cc1('0x11')]['message']);}else{logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x1b6b0f,'request\x20sent');_0x3050ca(_0xc994dd[_0x9cc1('0x14')][_0x9cc1('0x13')]);}})[_0x9cc1('0x15')](function(_0x6ae4e3){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x1b6b0f,_0x6ae4e3);_0x17d405(_0x6ae4e3);});});}exports[_0x9cc1('0x16')]=function(_0x3ca08d){var _0x32b27b=this;return new Promise(function(_0x31e625,_0x5908cd){return db[_0x9cc1('0x17')][_0x9cc1('0x18')](_0x3ca08d[_0x9cc1('0x19')],{'raw':_0x3ca08d[_0x9cc1('0x1a')]?_0x3ca08d['options'][_0x9cc1('0x1b')]===undefined?!![]:![]:!![]})[_0x9cc1('0x1c')](function(_0x358d26){logger[_0x9cc1('0xc')](_0x9cc1('0x16'),_0x3ca08d);logger[_0x9cc1('0x1d')](_0x9cc1('0x16'),_0x3ca08d,JSON['stringify'](_0x358d26));_0x31e625(_0x358d26);})[_0x9cc1('0x15')](function(_0x7dec83){logger['error']('CreateCmHopperHistory',_0x7dec83[_0x9cc1('0x13')],_0x3ca08d);_0x5908cd(_0x32b27b[_0x9cc1('0x11')](0x1f4,_0x7dec83['message']));});});};exports[_0x9cc1('0x1e')]=function(_0x1ef313){var _0x59bf61=this;return new Promise(function(_0x340527,_0x560198){return db[_0x9cc1('0x17')]['findAll']({'raw':_0x1ef313['options']?_0x1ef313[_0x9cc1('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1ef313['options']?_0x1ef313[_0x9cc1('0x1a')][_0x9cc1('0x1f')]||null:null,'attributes':[[db[_0x9cc1('0x20')]['fn']('COUNT',db[_0x9cc1('0x20')][_0x9cc1('0x21')]('id')),_0x9cc1('0x22')],[db[_0x9cc1('0x20')]['fn'](_0x9cc1('0x23'),db['sequelize']['fn']('IF',db[_0x9cc1('0x20')][_0x9cc1('0x24')]('`state`\x20=\x204,\x201,\x20null'))),_0x9cc1('0x25')],[db[_0x9cc1('0x20')]['fn'](_0x9cc1('0x23'),db[_0x9cc1('0x20')]['fn']('IF',db[_0x9cc1('0x20')][_0x9cc1('0x24')](_0x9cc1('0x26')))),_0x9cc1('0x27')],[db[_0x9cc1('0x20')]['fn']('COUNT',db[_0x9cc1('0x20')]['fn']('IF',db[_0x9cc1('0x20')][_0x9cc1('0x24')](_0x9cc1('0x28')))),_0x9cc1('0x29')],[db[_0x9cc1('0x20')]['fn'](_0x9cc1('0x2a'),db[_0x9cc1('0x20')]['fn']('IF',db[_0x9cc1('0x20')][_0x9cc1('0x24')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x9cc1('0x2b')],[db[_0x9cc1('0x20')]['fn'](_0x9cc1('0x2a'),db[_0x9cc1('0x20')]['fn']('IF',db[_0x9cc1('0x20')][_0x9cc1('0x24')](_0x9cc1('0x2c')))),_0x9cc1('0x2d')]]})['then'](function(_0xb5def6){logger[_0x9cc1('0xc')]('AvgHandleTime',_0x1ef313);logger[_0x9cc1('0x1d')]('AvgHandleTime',_0x1ef313,JSON[_0x9cc1('0x10')](_0xb5def6));_0x340527(_0xb5def6);})['catch'](function(_0x4ae6ec){logger[_0x9cc1('0x11')](_0x9cc1('0x1e'),_0x4ae6ec['message'],_0x1ef313);_0x560198(_0x59bf61[_0x9cc1('0x11')](0x1f4,_0x4ae6ec['message']));});});};exports[_0x9cc1('0x2e')]=function(_0x5bb65f){var _0x446bfe=this;return new Promise(function(_0x55a085,_0xe4d126){return db['CmHopperHistory'][_0x9cc1('0x2f')]({'raw':_0x5bb65f[_0x9cc1('0x1a')]?_0x5bb65f[_0x9cc1('0x1a')][_0x9cc1('0x1b')]===undefined?!![]:![]:!![],'where':_0x5bb65f['options']?_0x5bb65f[_0x9cc1('0x1a')]['where']||null:null,'attributes':[[_0x9cc1('0x30'),_0x9cc1('0x31')],[db[_0x9cc1('0x20')]['fn'](_0x9cc1('0x23'),db[_0x9cc1('0x20')]['fn']('IF',db['sequelize']['literal'](_0x9cc1('0x32')))),_0x9cc1('0x33')],[db[_0x9cc1('0x20')]['fn'](_0x9cc1('0x23'),db[_0x9cc1('0x20')]['fn']('IF',db[_0x9cc1('0x20')][_0x9cc1('0x24')](_0x9cc1('0x34')))),_0x9cc1('0x35')],[db['sequelize']['fn']('COUNT',db[_0x9cc1('0x20')]['fn']('IF',db[_0x9cc1('0x20')][_0x9cc1('0x24')]('`state`\x20=\x204,\x201,\x20null'))),_0x9cc1('0x36')],[db['sequelize']['fn'](_0x9cc1('0x23'),db[_0x9cc1('0x20')]['fn']('IF',db[_0x9cc1('0x20')][_0x9cc1('0x24')](_0x9cc1('0x37')))),'outboundBusyCallsDay'],[db[_0x9cc1('0x20')]['fn'](_0x9cc1('0x23'),db[_0x9cc1('0x20')]['fn']('IF',db[_0x9cc1('0x20')][_0x9cc1('0x24')](_0x9cc1('0x38')))),_0x9cc1('0x39')],[db[_0x9cc1('0x20')]['fn'](_0x9cc1('0x23'),db[_0x9cc1('0x20')]['fn']('IF',db[_0x9cc1('0x20')][_0x9cc1('0x24')](_0x9cc1('0x3a')))),_0x9cc1('0x3b')],[db['sequelize']['fn'](_0x9cc1('0x23'),db[_0x9cc1('0x20')]['fn']('IF',db[_0x9cc1('0x20')][_0x9cc1('0x24')](_0x9cc1('0x3c')))),_0x9cc1('0x3d')],[db['sequelize']['fn']('COUNT',db[_0x9cc1('0x20')]['fn']('IF',db[_0x9cc1('0x20')][_0x9cc1('0x24')](_0x9cc1('0x3e')))),'outboundUnknownCallsDay'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x9cc1('0x3f')))),_0x9cc1('0x40')],[db[_0x9cc1('0x20')]['fn'](_0x9cc1('0x23'),db[_0x9cc1('0x20')]['fn']('IF',db[_0x9cc1('0x20')][_0x9cc1('0x24')](_0x9cc1('0x41')))),'outboundOriginateFailureCallsDay'],[db[_0x9cc1('0x20')]['fn'](_0x9cc1('0x23'),db['sequelize']['fn']('IF',db[_0x9cc1('0x20')][_0x9cc1('0x24')](_0x9cc1('0x42')))),_0x9cc1('0x43')],[db[_0x9cc1('0x20')]['fn'](_0x9cc1('0x23'),db['sequelize']['fn']('IF',db['sequelize'][_0x9cc1('0x24')]('`state`\x20=\x2016,\x201,\x20null'))),_0x9cc1('0x44')],[db[_0x9cc1('0x20')]['fn'](_0x9cc1('0x23'),db[_0x9cc1('0x20')]['fn']('IF',db[_0x9cc1('0x20')][_0x9cc1('0x24')](_0x9cc1('0x45')))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0x9cc1('0x23'),db[_0x9cc1('0x20')]['fn']('IF',db['sequelize'][_0x9cc1('0x24')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x9cc1('0x46')]],'group':['campaign']})['then'](function(_0x5121d3){logger[_0x9cc1('0xc')](_0x9cc1('0x2e'),_0x5bb65f);logger[_0x9cc1('0x1d')](_0x9cc1('0x2e'),_0x5bb65f,JSON['stringify'](_0x5121d3));_0x55a085(_0x5121d3);})[_0x9cc1('0x15')](function(_0x1863c2){logger[_0x9cc1('0x11')]('GetVoiceQueueHopperHistory',_0x1863c2[_0x9cc1('0x13')],_0x5bb65f);_0xe4d126(_0x446bfe[_0x9cc1('0x11')](0x1f4,_0x1863c2[_0x9cc1('0x13')]));});});};exports[_0x9cc1('0x47')]=function(_0xcfb12e){var _0x1fed55=this;return new Promise(function(_0x38b125,_0x451df6){return db[_0x9cc1('0x17')][_0x9cc1('0x2f')]({'raw':_0xcfb12e['options']?_0xcfb12e[_0x9cc1('0x1a')][_0x9cc1('0x1b')]===undefined?!![]:![]:!![],'where':_0xcfb12e[_0x9cc1('0x1a')]?_0xcfb12e[_0x9cc1('0x1a')][_0x9cc1('0x1f')]||null:null,'attributes':[['campaign','name'],[db[_0x9cc1('0x20')]['fn']('COUNT',db['sequelize'][_0x9cc1('0x21')]('id')),'ivrTotalCallsDays'],[db[_0x9cc1('0x20')]['fn']('COUNT',db[_0x9cc1('0x20')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x9cc1('0x48')]],'group':['campaign']})[_0x9cc1('0x1c')](function(_0x230ccb){logger[_0x9cc1('0xc')](_0x9cc1('0x47'),_0xcfb12e);logger[_0x9cc1('0x1d')](_0x9cc1('0x47'),_0xcfb12e,JSON[_0x9cc1('0x10')](_0x230ccb));_0x38b125(_0x230ccb);})[_0x9cc1('0x15')](function(_0x32b614){logger['error'](_0x9cc1('0x47'),_0x32b614[_0x9cc1('0x13')],_0xcfb12e);_0x451df6(_0x1fed55[_0x9cc1('0x11')](0x1f4,_0x32b614[_0x9cc1('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index a5ff0f0..8b1a494 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 _0x21a3=['index','get','/describe','/:id','show','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','isAuthenticated'];(function(_0x754ab4,_0x56daa7){var _0x34079a=function(_0x295ec1){while(--_0x295ec1){_0x754ab4['push'](_0x754ab4['shift']());}};_0x34079a(++_0x56daa7);}(_0x21a3,0xd2));var _0x321a=function(_0x3712e2,_0x32d752){_0x3712e2=_0x3712e2-0x0;var _0x1faff4=_0x21a3[_0x3712e2];return _0x1faff4;};'use strict';var multer=require(_0x321a('0x0'));var util=require(_0x321a('0x1'));var path=require(_0x321a('0x2'));var timeout=require(_0x321a('0x3'));var express=require(_0x321a('0x4'));var router=express[_0x321a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x321a('0x6'));var config=require(_0x321a('0x7'));var controller=require(_0x321a('0x8'));router['get']('/',auth[_0x321a('0x9')](),controller[_0x321a('0xa')]);router[_0x321a('0xb')](_0x321a('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x321a('0xb')](_0x321a('0xd'),auth[_0x321a('0x9')](),controller[_0x321a('0xe')]);router[_0x321a('0xf')]('/',auth[_0x321a('0x9')](),controller[_0x321a('0x10')]);router[_0x321a('0x11')](_0x321a('0xd'),auth[_0x321a('0x9')](),controller[_0x321a('0x12')]);module[_0x321a('0x13')]=router; \ No newline at end of file +var _0xe083=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','exports'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xe083,0xdc));var _0x3e08=function(_0xb2ec74,_0x1934f8){_0xb2ec74=_0xb2ec74-0x0;var _0x2a74e6=_0xe083[_0xb2ec74];return _0x2a74e6;};'use strict';var multer=require(_0x3e08('0x0'));var util=require(_0x3e08('0x1'));var path=require(_0x3e08('0x2'));var timeout=require('connect-timeout');var express=require(_0x3e08('0x3'));var router=express[_0x3e08('0x4')]();var fs_extra=require(_0x3e08('0x5'));var auth=require(_0x3e08('0x6'));var interaction=require(_0x3e08('0x7'));var config=require(_0x3e08('0x8'));var controller=require(_0x3e08('0x9'));router['get']('/',auth[_0x3e08('0xa')](),controller[_0x3e08('0xb')]);router[_0x3e08('0xc')](_0x3e08('0xd'),auth[_0x3e08('0xa')](),controller[_0x3e08('0xe')]);router[_0x3e08('0xc')](_0x3e08('0xf'),auth[_0x3e08('0xa')](),controller[_0x3e08('0x10')]);router[_0x3e08('0x11')]('/',auth['isAuthenticated'](),controller[_0x3e08('0x12')]);router['put'](_0x3e08('0xf'),auth[_0x3e08('0xa')](),controller['update']);module[_0x3e08('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index e2b0839..ef08903 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 _0xe5e0=['exports','STRING','name','sequelize'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xe5e0,0x123));var _0x0e5e=function(_0xf405af,_0x19319e){_0xf405af=_0xf405af-0x0;var _0x2c74dd=_0xe5e0[_0xf405af];return _0x2c74dd;};'use strict';var Sequelize=require(_0x0e5e('0x0'));module[_0x0e5e('0x1')]={'name':{'type':Sequelize[_0x0e5e('0x2')],'unique':_0x0e5e('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0e5e('0x2')]},'dialPrefix':{'type':Sequelize[_0x0e5e('0x2')]}}; \ No newline at end of file +var _0x6347=['STRING','sequelize','exports','name'];(function(_0x35c98d,_0x1ef0ea){var _0xd9cd77=function(_0xd94da1){while(--_0xd94da1){_0x35c98d['push'](_0x35c98d['shift']());}};_0xd9cd77(++_0x1ef0ea);}(_0x6347,0x1c9));var _0x7634=function(_0x1a0052,_0x554647){_0x1a0052=_0x1a0052-0x0;var _0x15fe78=_0x6347[_0x1a0052];return _0x15fe78;};'use strict';var Sequelize=require(_0x7634('0x0'));module[_0x7634('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x7634('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7634('0x3')]},'dialPrefix':{'type':Sequelize[_0x7634('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index a824c85..a3f8cdb 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 _0x72f0=['info','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','offset','undefined','count','Content-Range','json','apply','update','destroy','then','get','Lists','UserProfileResource','error','stack','name','map','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','options','CmList','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','ListId','Disposition','getDispositions','filter','removeDispositions','ids','addContacts','CmContact','tags','isArray','push','each','omit','success','dataValues','errors','message','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','hasOwnProperty','getContactsCsv','ContactItemType','OrderBy','select','from','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','customField_','alias','field','cm_contact_has_items','CmContactId\x20=\x20c.id','additionalPhone_','description','ItemTypeId\x20=\x20?','toString','isEmpty','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','findOne','sequelize','addCustomFields','Sequelize','text','TEXT','number','INTEGER','defaultValue','cm_contacts','cf_%s','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User'];(function(_0xf9eb3,_0x3ac70d){var _0x25776c=function(_0x29b656){while(--_0x29b656){_0xf9eb3['push'](_0xf9eb3['shift']());}};_0x25776c(++_0x3ac70d);}(_0x72f0,0x143));var _0x072f=function(_0x308374,_0x550e85){_0x308374=_0x308374-0x0;var _0x1f71e0=_0x72f0[_0x308374];return _0x1f71e0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x072f('0x0'));var zipdir=require(_0x072f('0x1'));var jsonpatch=require(_0x072f('0x2'));var rp=require(_0x072f('0x3'));var moment=require(_0x072f('0x4'));var BPromise=require(_0x072f('0x5'));var Mustache=require(_0x072f('0x6'));var util=require('util');var path=require(_0x072f('0x7'));var sox=require(_0x072f('0x8'));var csv=require(_0x072f('0x9'));var ejs=require(_0x072f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x072f('0xb'));var squel=require('squel');var crypto=require(_0x072f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x072f('0xd'));var toCsv=require(_0x072f('0x9'));var querystring=require(_0x072f('0xe'));var Papa=require('papaparse');var Redis=require(_0x072f('0xf'));var authService=require(_0x072f('0x10'));var qs=require(_0x072f('0x11'));var as=require(_0x072f('0x12'));var hardwareService=require(_0x072f('0x13'));var logger=require(_0x072f('0x14'))(_0x072f('0x15'));var utils=require(_0x072f('0x16'));var config=require(_0x072f('0x17'));var licenseUtil=require(_0x072f('0x18'));var db=require('../../mysqldb')['db'];var csv_results;config[_0x072f('0x19')]=_[_0x072f('0x1a')](config[_0x072f('0x19')],{'host':_0x072f('0x1b'),'port':0x18eb});var socket=require(_0x072f('0x1c'))(new Redis(config[_0x072f('0x19')]));require(_0x072f('0x1d'))[_0x072f('0x1e')](socket);function respondWithStatusCode(_0x350792,_0x534ab6){_0x534ab6=_0x534ab6||0xcc;return function(_0x28a236){if(_0x28a236){return _0x350792[_0x072f('0x1f')](_0x534ab6);}return _0x350792[_0x072f('0x20')](_0x534ab6)[_0x072f('0x21')]();};}function respondWithResult(_0x356223,_0x1bc059){_0x1bc059=_0x1bc059||0xc8;return function(_0x238918){if(_0x238918){return _0x356223[_0x072f('0x20')](_0x1bc059)['json'](_0x238918);}};}function respondWithFilteredResult(_0x4bc24e,_0x2d835f){return function(_0x376375){if(_0x376375){var _0xa7f40d=typeof _0x2d835f[_0x072f('0x22')]===_0x072f('0x23')&&typeof _0x2d835f['limit']==='undefined';var _0x1cf53a=_0x376375[_0x072f('0x24')];var _0x4b4c5b=_0xa7f40d?0x0:_0x2d835f[_0x072f('0x22')];var _0x57bc98=_0xa7f40d?_0x376375[_0x072f('0x24')]:_0x2d835f['offset']+_0x2d835f['limit'];var _0x5368ee;if(_0x57bc98>=_0x1cf53a){_0x57bc98=_0x1cf53a;_0x5368ee=0xc8;}else{_0x5368ee=0xce;}_0x4bc24e[_0x072f('0x20')](_0x5368ee);return _0x4bc24e['set'](_0x072f('0x25'),_0x4b4c5b+'-'+_0x57bc98+'/'+_0x1cf53a)[_0x072f('0x26')](_0x376375);}return null;};}function patchUpdates(_0x28e8a2){return function(_0x1fc30c){try{jsonpatch[_0x072f('0x27')](_0x1fc30c,_0x28e8a2,!![]);}catch(_0x4d9960){return BPromise['reject'](_0x4d9960);}return _0x1fc30c['save']();};}function saveUpdates(_0xf5c038,_0x1e3ed8){return function(_0x41411a){if(_0x41411a){return _0x41411a[_0x072f('0x28')](_0xf5c038)['then'](function(_0x17a384){return _0x17a384;});}return null;};}function removeEntity(_0x465982,_0x1b3d1c){return function(_0x40ac2a){if(_0x40ac2a){return _0x40ac2a[_0x072f('0x29')]()[_0x072f('0x2a')](function(){var _0x2c2141=_0x40ac2a[_0x072f('0x2b')]({'plain':!![]});var _0x3451be=_0x072f('0x2c');return db[_0x072f('0x2d')]['destroy']({'where':{'type':_0x3451be,'resourceId':_0x2c2141['id']}})[_0x072f('0x2a')](function(){return _0x40ac2a;});})[_0x072f('0x2a')](function(){_0x465982[_0x072f('0x20')](0xcc)[_0x072f('0x21')]();});}};}function handleEntityNotFound(_0x577e31,_0x1eb4de){return function(_0x5f5d43){if(!_0x5f5d43){_0x577e31[_0x072f('0x1f')](0x194);}return _0x5f5d43;};}function handleError(_0x1630e6,_0x32e650){_0x32e650=_0x32e650||0x1f4;return function(_0x136238){logger[_0x072f('0x2e')](_0x136238[_0x072f('0x2f')]);if(_0x136238[_0x072f('0x30')]){delete _0x136238[_0x072f('0x30')];}_0x1630e6[_0x072f('0x20')](_0x32e650)['send'](_0x136238);};}exports['index']=function(_0x67144,_0x2ad9ee){var _0x218016={},_0x2c7279={},_0x371e62={'count':0x0,'rows':[]};var _0x5cc6b8=_[_0x072f('0x31')](db['CmList']['rawAttributes'],function(_0x23c05a){return{'name':_0x23c05a[_0x072f('0x32')],'type':_0x23c05a[_0x072f('0x33')]['key']};});_0x2c7279['model']=_[_0x072f('0x31')](_0x5cc6b8,_0x072f('0x30'));_0x2c7279[_0x072f('0x34')]=_[_0x072f('0x35')](_0x67144['query']);_0x2c7279[_0x072f('0x36')]=_[_0x072f('0x37')](_0x2c7279[_0x072f('0x38')],_0x2c7279[_0x072f('0x34')]);_0x218016[_0x072f('0x39')]=_[_0x072f('0x37')](_0x2c7279[_0x072f('0x38')],qs[_0x072f('0x3a')](_0x67144[_0x072f('0x34')][_0x072f('0x3a')]));_0x218016['attributes']=_0x218016[_0x072f('0x39')][_0x072f('0x3b')]?_0x218016[_0x072f('0x39')]:_0x2c7279[_0x072f('0x38')];if(!_0x67144[_0x072f('0x34')]['hasOwnProperty'](_0x072f('0x3c'))){_0x218016[_0x072f('0x3d')]=qs[_0x072f('0x3d')](_0x67144[_0x072f('0x34')]['limit']);_0x218016['offset']=qs['offset'](_0x67144[_0x072f('0x34')]['offset']);}_0x218016[_0x072f('0x3e')]=qs[_0x072f('0x3f')](_0x67144[_0x072f('0x34')][_0x072f('0x3f')]);_0x218016[_0x072f('0x40')]=qs['filters'](_[_0x072f('0x41')](_0x67144[_0x072f('0x34')],_0x2c7279[_0x072f('0x36')]),_0x5cc6b8);if(_0x67144[_0x072f('0x34')]['filter']){_0x218016[_0x072f('0x40')]=_[_0x072f('0x42')](_0x218016[_0x072f('0x40')],{'$or':_[_0x072f('0x31')](_0x5cc6b8,function(_0x145138){if(_0x145138['type']!==_0x072f('0x43')){var _0x9e26d9={};_0x9e26d9[_0x145138['name']]={'$like':'%'+_0x67144[_0x072f('0x34')]['filter']+'%'};return _0x9e26d9;}})});}_0x218016=_[_0x072f('0x42')]({},_0x218016,_0x67144[_0x072f('0x44')]);var _0x5c7ba9={'where':_0x218016['where']};return db[_0x072f('0x45')][_0x072f('0x24')](_0x5c7ba9)['then'](function(_0x597e23){_0x371e62[_0x072f('0x24')]=_0x597e23;if(_0x67144['query'][_0x072f('0x46')]){_0x218016[_0x072f('0x47')]=[{'all':!![]}];}return db['CmList'][_0x072f('0x48')](_0x218016);})['then'](function(_0x169949){_0x371e62[_0x072f('0x49')]=_0x169949;return _0x371e62;})['then'](respondWithFilteredResult(_0x2ad9ee,_0x218016))[_0x072f('0x4a')](handleError(_0x2ad9ee,null));};exports[_0x072f('0x4b')]=function(_0x580213,_0x1d7e8c){var _0x94352e={'raw':![],'where':{'id':_0x580213[_0x072f('0x4c')]['id']}},_0x40e770={};_0x40e770[_0x072f('0x38')]=_[_0x072f('0x35')](db[_0x072f('0x45')][_0x072f('0x4d')]);_0x40e770[_0x072f('0x34')]=_[_0x072f('0x35')](_0x580213[_0x072f('0x34')]);_0x40e770[_0x072f('0x36')]=_['intersection'](_0x40e770[_0x072f('0x38')],_0x40e770['query']);_0x94352e['attributes']=_['intersection'](_0x40e770['model'],qs['fields'](_0x580213[_0x072f('0x34')][_0x072f('0x3a')]));_0x94352e['attributes']=_0x94352e[_0x072f('0x39')]['length']?_0x94352e[_0x072f('0x39')]:_0x40e770[_0x072f('0x38')];if(_0x580213[_0x072f('0x34')][_0x072f('0x46')]){_0x94352e[_0x072f('0x47')]=[{'all':!![]}];}_0x94352e=_[_0x072f('0x42')]({},_0x94352e,_0x580213[_0x072f('0x44')]);return db[_0x072f('0x45')]['find'](_0x94352e)[_0x072f('0x2a')](handleEntityNotFound(_0x1d7e8c,null))[_0x072f('0x2a')](respondWithResult(_0x1d7e8c,null))['catch'](handleError(_0x1d7e8c,null));};exports['create']=function(_0x47cf60,_0x456980){return db[_0x072f('0x45')][_0x072f('0x4e')](_0x47cf60[_0x072f('0x4f')],{})[_0x072f('0x2a')](function(_0x13a3aa){var _0x25f91f=_0x47cf60['user'][_0x072f('0x2b')]({'plain':!![]});if(!_0x25f91f)throw new Error(_0x072f('0x50'));if(_0x25f91f[_0x072f('0x51')]===_0x072f('0x52')){var _0x4be3ad=_0x13a3aa[_0x072f('0x2b')]({'plain':!![]});var _0x4a4eda=_0x072f('0x2c');return db[_0x072f('0x53')]['find']({'where':{'name':_0x4a4eda,'userProfileId':_0x25f91f[_0x072f('0x54')]},'raw':!![]})[_0x072f('0x2a')](function(_0x2f08f1){if(_0x2f08f1&&_0x2f08f1['autoAssociation']===0x0){return db[_0x072f('0x2d')]['create']({'name':_0x4be3ad[_0x072f('0x30')],'resourceId':_0x4be3ad['id'],'type':_0x2f08f1[_0x072f('0x30')],'sectionId':_0x2f08f1['id']},{})[_0x072f('0x2a')](function(){return _0x13a3aa;});}else{return _0x13a3aa;}})['catch'](function(_0x474cc3){logger[_0x072f('0x2e')](_0x072f('0x55'),_0x474cc3);throw _0x474cc3;});}return _0x13a3aa;})[_0x072f('0x2a')](respondWithResult(_0x456980,0xc9))[_0x072f('0x4a')](handleError(_0x456980,null));};exports[_0x072f('0x28')]=function(_0x2a0f43,_0x5c29b9){if(_0x2a0f43[_0x072f('0x4f')]['id']){delete _0x2a0f43['body']['id'];}return db[_0x072f('0x45')][_0x072f('0x56')]({'where':{'id':_0x2a0f43[_0x072f('0x4c')]['id']}})[_0x072f('0x2a')](handleEntityNotFound(_0x5c29b9,null))['then'](saveUpdates(_0x2a0f43[_0x072f('0x4f')],null))[_0x072f('0x2a')](respondWithResult(_0x5c29b9,null))['catch'](handleError(_0x5c29b9,null));};exports[_0x072f('0x29')]=function(_0x9c6490,_0x3fab24){return db['CmList'][_0x072f('0x56')]({'where':{'id':_0x9c6490[_0x072f('0x4c')]['id']}})[_0x072f('0x2a')](handleEntityNotFound(_0x3fab24,null))[_0x072f('0x2a')](removeEntity(_0x3fab24,null))[_0x072f('0x4a')](handleError(_0x3fab24,null));};exports[_0x072f('0x57')]=function(_0x33ce0d,_0x546324){return db[_0x072f('0x45')][_0x072f('0x57')]()['then'](respondWithResult(_0x546324,null))[_0x072f('0x4a')](handleError(_0x546324,null));};exports['addDisposition']=function(_0x5ac7a8,_0x4e73be,_0x50f045){if(_0x5ac7a8[_0x072f('0x4f')]['id']){delete _0x5ac7a8[_0x072f('0x4f')]['id'];}return db[_0x072f('0x45')]['find']({'where':{'id':_0x5ac7a8[_0x072f('0x4c')]['id']}})[_0x072f('0x2a')](handleEntityNotFound(_0x4e73be,null))['then'](function(_0x2ae642){if(_0x2ae642){_0x5ac7a8[_0x072f('0x4f')][_0x072f('0x58')]=_0x2ae642['id'];return db[_0x072f('0x59')][_0x072f('0x4e')](_0x5ac7a8[_0x072f('0x4f')]);}})['then'](respondWithResult(_0x4e73be,null))[_0x072f('0x4a')](handleError(_0x4e73be,null));};exports[_0x072f('0x5a')]=function(_0x37a02f,_0xf7123f,_0x3a3855){var _0x14b962={'raw':![],'where':{}};var _0x355e3c={};var _0x2dd7e5={'count':0x0,'rows':[]};return db[_0x072f('0x45')]['findOne']({'where':{'id':_0x37a02f[_0x072f('0x4c')]['id']}})['then'](handleEntityNotFound(_0xf7123f,null))[_0x072f('0x2a')](function(_0x4350b1){if(_0x4350b1){_0x355e3c[_0x072f('0x38')]=_[_0x072f('0x35')](db['Disposition']['rawAttributes']);_0x355e3c[_0x072f('0x34')]=_['keys'](_0x37a02f['query']);_0x355e3c[_0x072f('0x36')]=_[_0x072f('0x37')](_0x355e3c[_0x072f('0x38')],_0x355e3c[_0x072f('0x34')]);_0x14b962[_0x072f('0x39')]=_[_0x072f('0x37')](_0x355e3c[_0x072f('0x38')],qs['fields'](_0x37a02f['query'][_0x072f('0x3a')]));_0x14b962['attributes']=_0x14b962['attributes']['length']?_0x14b962[_0x072f('0x39')]:_0x355e3c['model'];if(!_0x37a02f[_0x072f('0x34')]['hasOwnProperty']('nolimit')){_0x14b962[_0x072f('0x3d')]=qs[_0x072f('0x3d')](_0x37a02f['query']['limit']);_0x14b962['offset']=qs['offset'](_0x37a02f[_0x072f('0x34')][_0x072f('0x22')]);}_0x14b962[_0x072f('0x3e')]=qs[_0x072f('0x3f')](_0x37a02f[_0x072f('0x34')][_0x072f('0x3f')]);_0x14b962['where']=qs[_0x072f('0x36')](_[_0x072f('0x41')](_0x37a02f[_0x072f('0x34')],_0x355e3c[_0x072f('0x36')]));_0x14b962['where'][_0x072f('0x58')]=_0x4350b1['id'];if(_0x37a02f[_0x072f('0x34')][_0x072f('0x5b')]){_0x14b962[_0x072f('0x40')]=_[_0x072f('0x42')](_0x14b962[_0x072f('0x40')],{'$or':_[_0x072f('0x31')](_0x14b962[_0x072f('0x39')],function(_0x15f547){var _0x1d80cb={};_0x1d80cb[_0x15f547]={'$like':'%'+_0x37a02f[_0x072f('0x34')][_0x072f('0x5b')]+'%'};return _0x1d80cb;})});}_0x14b962=_[_0x072f('0x42')]({},_0x14b962,_0x37a02f[_0x072f('0x44')]);return db[_0x072f('0x59')]['count']({'where':_0x14b962[_0x072f('0x40')]})[_0x072f('0x2a')](function(_0x25903d){_0x2dd7e5[_0x072f('0x24')]=_0x25903d;if(_0x37a02f[_0x072f('0x34')][_0x072f('0x46')]){_0x14b962[_0x072f('0x47')]=[{'all':!![]}];}return db[_0x072f('0x59')][_0x072f('0x48')](_0x14b962);})[_0x072f('0x2a')](function(_0x3ae49b){_0x2dd7e5[_0x072f('0x49')]=_0x3ae49b;return _0x2dd7e5;});}})['then'](respondWithFilteredResult(_0xf7123f,_0x14b962))[_0x072f('0x4a')](handleError(_0xf7123f,null));};exports[_0x072f('0x5c')]=function(_0x201360,_0x2b9ee6,_0x119ebb){return db['CmList'][_0x072f('0x56')]({'where':{'id':_0x201360[_0x072f('0x4c')]['id']}})[_0x072f('0x2a')](handleEntityNotFound(_0x2b9ee6,null))[_0x072f('0x2a')](function(_0x2ad84e){if(_0x2ad84e){return _0x2ad84e['removeDispositions'](_0x201360[_0x072f('0x34')][_0x072f('0x5d')]);}})['then'](respondWithStatusCode(_0x2b9ee6,null))[_0x072f('0x4a')](handleError(_0x2b9ee6,null));};exports[_0x072f('0x5e')]=function(_0x560c40,_0x26b60d,_0x199dc2){return db[_0x072f('0x45')][_0x072f('0x56')]({'where':{'id':_0x560c40[_0x072f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x26b60d,null))[_0x072f('0x2a')](function(_0x19292a){if(_0x19292a){var _0x5e553d=[];var _0x3e5608={'success':[],'errors':[]};return db[_0x072f('0x5f')][_0x072f('0x57')]()[_0x072f('0x2a')](function(_0x29b662){if(_0x560c40['body'][_0x072f('0x60')]&&_['isArray'](_0x560c40[_0x072f('0x4f')][_0x072f('0x60')])){if(_0x560c40[_0x072f('0x4f')][_0x072f('0x60')][_0x072f('0x3b')]){_0x560c40[_0x072f('0x4f')][_0x072f('0x60')]=_0x560c40[_0x072f('0x4f')][_0x072f('0x60')]['join'](';')+';';}else{_0x560c40[_0x072f('0x4f')][_0x072f('0x60')]=null;}}else{_0x560c40['body'][_0x072f('0x60')]=null;}if(_0x560c40['body']&&_[_0x072f('0x61')](_0x560c40['body'])){for(var _0x1249c9=0x0;_0x1249c9<_0x560c40['body'][_0x072f('0x3b')];_0x1249c9+=0x1){_0x560c40[_0x072f('0x4f')][_0x1249c9]['ListId']=_0x560c40[_0x072f('0x4c')]['id'];_0x5e553d[_0x072f('0x62')](_0x560c40[_0x072f('0x4f')][_0x1249c9]);}return BPromise[_0x072f('0x63')](_0x5e553d,function(_0x3227c0){return db[_0x072f('0x5f')][_0x072f('0x4e')](_[_0x072f('0x64')](_0x3227c0,['ids','id'])||{},{'fields':_[_0x072f('0x35')](_0x29b662),'raw':!![]})['then'](function(_0x2f6a1c){_0x3e5608[_0x072f('0x65')][_0x072f('0x62')](_0x2f6a1c[_0x072f('0x66')]);})[_0x072f('0x4a')](function(_0x4242fa){_0x3e5608[_0x072f('0x67')][_0x072f('0x62')]({'data':_0x3227c0,'error':_0x4242fa[_0x072f('0x68')]});});})['then'](function(_0x561c67){return _0x3e5608;})['catch'](function(_0x2af3a6){return _0x2af3a6;});}else{_0x26b60d[_0x072f('0x20')](0x190)[_0x072f('0x26')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x072f('0x2a')](respondWithResult(_0x26b60d,null))[_0x072f('0x4a')](handleError(_0x26b60d,null));};exports[_0x072f('0x69')]=function(_0x1597b2,_0x24639b,_0x123c55){var _0x5b24f3;return db[_0x072f('0x45')]['find']({'where':{'id':_0x1597b2[_0x072f('0x4c')]['id']},'include':[{'model':db[_0x072f('0x6a')],'as':_0x072f('0x6b')}]})['then'](handleEntityNotFound(_0x24639b,null))[_0x072f('0x2a')](function(_0x295886){if(_0x295886){_0x5b24f3=_0x295886;return db['CmContact']['rawAttributes'];}})[_0x072f('0x2a')](function(_0x5708cb){if(_0x5708cb){var _0xdf0ab={};var _0x302545={};_0x302545[_0x072f('0x38')]=_[_0x072f('0x6c')](_[_0x072f('0x35')](_0x5708cb),_[_0x072f('0x31')](_0x5b24f3[_0x072f('0x6b')],function(_0x5444c6){return util[_0x072f('0x6d')](_0x072f('0x6e'),_0x5444c6['id']);}));_0x302545['query']=_[_0x072f('0x35')](_0x1597b2['query']);_0x302545[_0x072f('0x36')]=_[_0x072f('0x37')](_0x302545[_0x072f('0x38')],_0x302545[_0x072f('0x34')]);_0xdf0ab[_0x072f('0x39')]=_['intersection'](_0x302545[_0x072f('0x38')],qs[_0x072f('0x3a')](_0x1597b2['query']['fields']));_0xdf0ab[_0x072f('0x39')]=_0xdf0ab[_0x072f('0x39')][_0x072f('0x3b')]?_0xdf0ab['attributes']:_0x302545[_0x072f('0x38')];if(!_0x1597b2[_0x072f('0x34')][_0x072f('0x6f')]('nolimit')){_0xdf0ab[_0x072f('0x3d')]=qs[_0x072f('0x3d')](_0x1597b2['query'][_0x072f('0x3d')]);_0xdf0ab['offset']=qs['offset'](_0x1597b2[_0x072f('0x34')][_0x072f('0x22')]);}_0xdf0ab[_0x072f('0x3e')]=qs[_0x072f('0x3f')](_0x1597b2[_0x072f('0x34')][_0x072f('0x3f')]);_0xdf0ab[_0x072f('0x40')]=qs[_0x072f('0x36')](_['pick'](_0x1597b2[_0x072f('0x34')],_0x302545[_0x072f('0x36')]));_0xdf0ab['raw']=!![];if(_0x1597b2['query'][_0x072f('0x5b')]){_0xdf0ab[_0x072f('0x40')]=_[_0x072f('0x42')](_0xdf0ab[_0x072f('0x40')],{'$or':_[_0x072f('0x31')](_0xdf0ab['attributes'],function(_0x116c29){var _0x222678={};_0x222678[_0x116c29]={'$like':'%'+_0x1597b2[_0x072f('0x34')]['filter']+'%'};return _0x222678;})});}_0xdf0ab=_[_0x072f('0x42')]({},_0xdf0ab,_0x1597b2[_0x072f('0x44')]);return _0x5b24f3[_0x072f('0x69')](_0xdf0ab);}})['then'](respondWithResult(_0x24639b,null))['catch'](handleError(_0x24639b,null));};exports[_0x072f('0x70')]=function(_0x239460,_0x1ecb1b,_0x29c140){var _0x29783e;var _0x351bd4;var _0x54e769;var _0x481061=_0x239460[_0x072f('0x4c')]['id'];csv_results=[];return db[_0x072f('0x71')][_0x072f('0x48')]({'attributes':['id',_0x072f('0x30')],'raw':!![],'order':[_0x072f('0x72')]})['then'](function(_0x380d93){_0x29783e=_0x380d93;var _0x189775=_[_0x072f('0x35')](db[_0x072f('0x5f')][_0x072f('0x4d')]);return db[_0x072f('0x6a')][_0x072f('0x48')]({'raw':!![],'attributes':['id','alias']})[_0x072f('0x2a')](function(_0x46b246){_0x351bd4=_0x46b246;var _0x5db538=squel[_0x072f('0x73')]()[_0x072f('0x3a')](_0x189775)[_0x072f('0x74')]('cm_contacts','c')[_0x072f('0x40')](_0x072f('0x75'),_0x481061)[_0x072f('0x40')](_0x072f('0x76'))['distinct']();for(var _0x838614=0x0;_0x838614<_0x351bd4[_0x072f('0x3b')];_0x838614++){_0x5db538['field']('c.cf_'+_0x351bd4[_0x838614]['id'],_0x072f('0x77')+_0x351bd4[_0x838614][_0x072f('0x78')]);}for(var _0x838614=0x0;_0x838614<_0x29783e[_0x072f('0x3b')];_0x838614++){_0x5db538[_0x072f('0x79')](squel[_0x072f('0x73')]()[_0x072f('0x79')]('item')[_0x072f('0x74')](_0x072f('0x7a'))['where']('ItemTypeId\x20=\x20?',_0x29783e[_0x838614]['id'])[_0x072f('0x40')](_0x072f('0x7b')),_0x072f('0x7c')+_0x29783e[_0x838614][_0x072f('0x30')]);_0x5db538[_0x072f('0x79')](squel[_0x072f('0x73')]()['field'](_0x072f('0x7d'))[_0x072f('0x74')](_0x072f('0x7a'))[_0x072f('0x40')](_0x072f('0x7e'),_0x29783e[_0x838614]['id'])[_0x072f('0x40')]('CmContactId\x20=\x20c.id'),'description_additionalPhone_'+_0x29783e[_0x838614][_0x072f('0x30')]);}var _0x13e42c=[];_0x13e42c['push'](_0x5db538[_0x072f('0x7f')]());BPromise['each'](_0x13e42c,handleQuery)[_0x072f('0x2a')](function(_0x1f04d4){handleQuery(_0x5db538[_0x072f('0x7f')]());var _0x55b6a7=csv_results[0x0];if(!_[_0x072f('0x80')](_0x55b6a7)){var _0x543362=toCsv(_0x55b6a7);var _0x3ba3dd=Date['now']();fs[_0x072f('0x81')](util[_0x072f('0x6d')]('/tmp/list_%d_%s.csv',_0x481061,_0x3ba3dd),_0x543362);_0x1ecb1b[_0x072f('0x82')](_0x072f('0x83'),_0x072f('0x84')+util[_0x072f('0x6d')](_0x072f('0x85'),_0x481061,_0x3ba3dd));_0x1ecb1b[_0x072f('0x82')](_0x072f('0x86'),_0x072f('0x87'));return _0x1ecb1b[_0x072f('0x88')](util[_0x072f('0x6d')](_0x072f('0x89'),_0x481061,_0x3ba3dd));}else{return _0x1ecb1b['sendStatus'](0xcc);}});});});};exports[_0x072f('0x8a')]=function(_0x426a11,_0x44c35c,_0xa187d7){var _0x54280c;delete _0x426a11[_0x072f('0x4f')]['id'];return db[_0x072f('0x45')][_0x072f('0x8b')]({'where':{'id':_0x426a11[_0x072f('0x4c')]['id']}})[_0x072f('0x2a')](handleEntityNotFound(_0x44c35c,null))[_0x072f('0x2a')](function(_0x13d757){if(_0x13d757){return db[_0x072f('0x8c')]['transaction'](function(_0x8e93a2){return db[_0x072f('0x6a')][_0x072f('0x4e')](_0x426a11[_0x072f('0x4f')],{'transaction':_0x8e93a2})[_0x072f('0x2a')](function(_0x134bb6){_0x54280c=_0x134bb6;return _0x13d757[_0x072f('0x8d')](_0x134bb6,{'transaction':_0x8e93a2});})[_0x072f('0x2a')](function(){var _0x25d095={'type':db[_0x072f('0x8e')]['TEXT'],'transaction':_0x8e93a2};switch(_0x426a11[_0x072f('0x4f')][_0x072f('0x33')]){case _0x072f('0x8f'):_0x25d095['type']=db[_0x072f('0x8e')][_0x072f('0x90')];break;case _0x072f('0x91'):_0x25d095['type']=db['Sequelize'][_0x072f('0x92')];break;case'switch':_0x25d095[_0x072f('0x33')]=db[_0x072f('0x8e')]['BOOLEAN'];_0x25d095[_0x072f('0x93')]=![];break;default:}return db['sequelize']['queryInterface']['addColumn'](_0x072f('0x94'),util[_0x072f('0x6d')](_0x072f('0x95'),_0x54280c['id']),_0x25d095);})['then'](function(){return _0x54280c;});});}})[_0x072f('0x2a')](respondWithResult(_0x44c35c,null))[_0x072f('0x4a')](handleError(_0x44c35c,null));};exports['getCustomFields']=function(_0x49e5a3,_0x171aa3,_0x2c62ea){var _0x9aed84={};var _0x1a045e={};var _0x236033;var _0x3b4979;return db[_0x072f('0x45')][_0x072f('0x8b')]({'where':{'id':_0x49e5a3['params']['id']}})[_0x072f('0x2a')](handleEntityNotFound(_0x171aa3,null))['then'](function(_0x31f929){if(_0x31f929){_0x236033=_0x31f929;_0x1a045e[_0x072f('0x38')]=_[_0x072f('0x35')](db['CmCustomField']['rawAttributes']);_0x1a045e[_0x072f('0x34')]=_[_0x072f('0x35')](_0x49e5a3[_0x072f('0x34')]);_0x1a045e[_0x072f('0x36')]=_[_0x072f('0x37')](_0x1a045e['model'],_0x1a045e[_0x072f('0x34')]);_0x9aed84['attributes']=_['intersection'](_0x1a045e[_0x072f('0x38')],qs[_0x072f('0x3a')](_0x49e5a3[_0x072f('0x34')]['fields']));_0x9aed84[_0x072f('0x39')]=_0x9aed84[_0x072f('0x39')][_0x072f('0x3b')]?_0x9aed84[_0x072f('0x39')]:_0x1a045e[_0x072f('0x38')];_0x9aed84[_0x072f('0x3e')]=qs['sort'](_0x49e5a3[_0x072f('0x34')][_0x072f('0x3f')]);_0x9aed84[_0x072f('0x40')]=qs[_0x072f('0x36')](_[_0x072f('0x41')](_0x49e5a3[_0x072f('0x34')],_0x1a045e[_0x072f('0x36')]));_0x9aed84['where']=_['merge'](_0x9aed84[_0x072f('0x40')],{'$or':[{'ListId':_0x31f929['id']},{'ListId':null}]});if(_0x49e5a3[_0x072f('0x34')][_0x072f('0x5b')]){_0x9aed84[_0x072f('0x40')]=_[_0x072f('0x42')](_0x9aed84[_0x072f('0x40')],{'$or':_['map'](_0x9aed84[_0x072f('0x39')],function(_0x25bd07){var _0xd537f1={};_0xd537f1[_0x25bd07]={'$like':'%'+_0x49e5a3[_0x072f('0x34')][_0x072f('0x5b')]+'%'};return _0xd537f1;})});}_0x9aed84=_[_0x072f('0x42')]({},_0x9aed84,_0x49e5a3['options']);return db['CmCustomField'][_0x072f('0x96')](_0x9aed84);}})[_0x072f('0x2a')](respondWithResult(_0x171aa3,null))['catch'](handleError(_0x171aa3,null));};exports[_0x072f('0x97')]=function(_0x35406e,_0x49c1ac){return db[_0x072f('0x6a')][_0x072f('0x96')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x49c1ac,null))['then'](function(_0xb517db){return _0xb517db;})[_0x072f('0x2a')](respondWithResult(_0x49c1ac,null))[_0x072f('0x4a')](handleError(_0x49c1ac,null));};exports['addAgents']=function(_0x5dc3db,_0x4647cf,_0x4ef3bc){return db['CmList'][_0x072f('0x56')]({'where':{'id':_0x5dc3db[_0x072f('0x4c')]['id']}})[_0x072f('0x2a')](handleEntityNotFound(_0x4647cf,null))['then'](function(_0x350996){if(_0x350996){return _0x350996[_0x072f('0x98')](_0x5dc3db['body'][_0x072f('0x5d')],_[_0x072f('0x64')](_0x5dc3db[_0x072f('0x4f')],['ids','id'])||{})[_0x072f('0x99')](function(_0xdb902e){for(var _0x469c97=0x0;_0x469c97<_0x5dc3db[_0x072f('0x4f')]['ids'][_0x072f('0x3b')];_0x469c97+=0x1){socket[_0x072f('0x9a')](_0x072f('0x9b'),{'UserId':Number(_0x5dc3db[_0x072f('0x4f')]['ids'][_0x469c97]),'CmListId':Number(_0x5dc3db[_0x072f('0x4c')]['id'])});}return _0xdb902e;});}})[_0x072f('0x2a')](respondWithResult(_0x4647cf,null))['catch'](handleError(_0x4647cf,null));};exports['removeAgents']=function(_0x80983f,_0x2288b1,_0x5ef0fd){return db[_0x072f('0x45')][_0x072f('0x56')]({'where':{'id':_0x80983f[_0x072f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2288b1,null))[_0x072f('0x2a')](function(_0x2ec7a1){if(_0x2ec7a1){return _0x2ec7a1[_0x072f('0x9c')](_0x80983f[_0x072f('0x34')][_0x072f('0x5d')])[_0x072f('0x2a')](function(){if(_[_0x072f('0x61')](_0x80983f[_0x072f('0x34')][_0x072f('0x5d')])){for(var _0x5ebb78=0x0;_0x5ebb78<_0x80983f[_0x072f('0x34')][_0x072f('0x5d')][_0x072f('0x3b')];_0x5ebb78+=0x1){socket['emit'](_0x072f('0x9d'),{'UserId':Number(_0x80983f[_0x072f('0x34')][_0x072f('0x5d')][_0x5ebb78]),'CmListId':Number(_0x80983f['params']['id'])});}}else{socket[_0x072f('0x9a')](_0x072f('0x9d'),{'UserId':Number(_0x80983f[_0x072f('0x34')][_0x072f('0x5d')]),'CmListId':Number(_0x80983f[_0x072f('0x4c')]['id'])});}});}})[_0x072f('0x2a')](respondWithStatusCode(_0x2288b1,null))[_0x072f('0x4a')](handleError(_0x2288b1,null));};exports[_0x072f('0x9e')]=function(_0x1c2960,_0x1b9104,_0x5bc3f8){var _0x5c155e={};var _0x19ff0d={};var _0x464790;var _0x3c92a1;return db[_0x072f('0x45')][_0x072f('0x8b')]({'where':{'id':_0x1c2960[_0x072f('0x4c')]['id']}})[_0x072f('0x2a')](handleEntityNotFound(_0x1b9104,null))[_0x072f('0x2a')](function(_0xa19426){if(_0xa19426){_0x464790=_0xa19426;_0x19ff0d[_0x072f('0x38')]=_['keys'](db[_0x072f('0x9f')][_0x072f('0x4d')]);_0x19ff0d[_0x072f('0x34')]=_[_0x072f('0x35')](_0x1c2960[_0x072f('0x34')]);_0x19ff0d['filters']=_[_0x072f('0x37')](_0x19ff0d[_0x072f('0x38')],_0x19ff0d[_0x072f('0x34')]);_0x5c155e[_0x072f('0x39')]=_['intersection'](_0x19ff0d[_0x072f('0x38')],qs[_0x072f('0x3a')](_0x1c2960[_0x072f('0x34')][_0x072f('0x3a')]));_0x5c155e[_0x072f('0x39')]=_0x5c155e[_0x072f('0x39')][_0x072f('0x3b')]?_0x5c155e[_0x072f('0x39')]:_0x19ff0d['model'];_0x5c155e[_0x072f('0x3e')]=qs['sort'](_0x1c2960[_0x072f('0x34')]['sort']);_0x5c155e['where']=qs['filters'](_[_0x072f('0x41')](_0x1c2960['query'],_0x19ff0d[_0x072f('0x36')]));if(_0x1c2960[_0x072f('0x34')][_0x072f('0x5b')]){_0x5c155e[_0x072f('0x40')]=_[_0x072f('0x42')](_0x5c155e[_0x072f('0x40')],{'$or':_[_0x072f('0x31')](_0x5c155e['attributes'],function(_0x5406ba){var _0xecf337={};_0xecf337[_0x5406ba]={'$like':'%'+_0x1c2960[_0x072f('0x34')][_0x072f('0x5b')]+'%'};return _0xecf337;})});}_0x5c155e=_[_0x072f('0x42')]({},_0x5c155e,_0x1c2960[_0x072f('0x44')]);return _0x464790[_0x072f('0x9e')](_0x5c155e);}})[_0x072f('0x2a')](function(_0x19dad7){if(_0x19dad7){_0x3c92a1=_0x19dad7[_0x072f('0x3b')];if(!_0x1c2960[_0x072f('0x34')][_0x072f('0x6f')](_0x072f('0x3c'))){_0x5c155e[_0x072f('0x3d')]=qs[_0x072f('0x3d')](_0x1c2960[_0x072f('0x34')][_0x072f('0x3d')]);_0x5c155e[_0x072f('0x22')]=qs[_0x072f('0x22')](_0x1c2960['query'][_0x072f('0x22')]);}return _0x464790['getAgents'](_0x5c155e);}})[_0x072f('0x2a')](function(_0x24ddb6){if(_0x24ddb6){return _0x24ddb6?{'count':_0x3c92a1,'rows':_0x24ddb6}:null;}})[_0x072f('0x2a')](respondWithResult(_0x1b9104,null))[_0x072f('0x4a')](handleError(_0x1b9104,null));};function handleQuery(_0x1552a7){logger[_0x072f('0xa0')](_0x1552a7);return db['sequelize']['query'](_0x1552a7)[_0x072f('0x99')](function(_0x3acfef){csv_results['push'](_0x3acfef);})[_0x072f('0x4a')](function(_0x5cb397){logger['error'](_0x5cb397[_0x072f('0x68')]);});} \ No newline at end of file +var _0xf066=['cm_contact_has_items','ItemTypeId\x20=\x20?','additionalPhone_','description','CmContactId\x20=\x20c.id','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','format','list_%d_%s.csv','Content-type','text/csv','addCustomField','findOne','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','switch','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','error','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/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','./cmList.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','get','Lists','UserProfileResource','stack','name','send','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','length','nolimit','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','CmList','includeAll','include','findAll','rows','catch','params','fields','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','Disposition','getDispositions','hasOwnProperty','order','ListId','removeDispositions','ids','CmContact','tags','isArray','join','push','each','omit','success','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','concat','CustomFields','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy','alias','select','from','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','customField_','item'];(function(_0x24f08a,_0x4d5b51){var _0x405dcf=function(_0x7918cc){while(--_0x7918cc){_0x24f08a['push'](_0x24f08a['shift']());}};_0x405dcf(++_0x4d5b51);}(_0xf066,0x17c));var _0x6f06=function(_0x59cdd0,_0x56af37){_0x59cdd0=_0x59cdd0-0x0;var _0x41bf3d=_0xf066[_0x59cdd0];return _0x41bf3d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6f06('0x0'));var zipdir=require(_0x6f06('0x1'));var jsonpatch=require(_0x6f06('0x2'));var rp=require('request-promise');var moment=require(_0x6f06('0x3'));var BPromise=require(_0x6f06('0x4'));var Mustache=require(_0x6f06('0x5'));var util=require(_0x6f06('0x6'));var path=require(_0x6f06('0x7'));var sox=require(_0x6f06('0x8'));var csv=require(_0x6f06('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6f06('0xa'));var _=require('lodash');var squel=require(_0x6f06('0xb'));var crypto=require(_0x6f06('0xc'));var jsforce=require(_0x6f06('0xd'));var deskjs=require(_0x6f06('0xe'));var toCsv=require(_0x6f06('0x9'));var querystring=require(_0x6f06('0xf'));var Papa=require(_0x6f06('0x10'));var Redis=require(_0x6f06('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6f06('0x12'));var as=require(_0x6f06('0x13'));var hardwareService=require(_0x6f06('0x14'));var logger=require(_0x6f06('0x15'))(_0x6f06('0x16'));var utils=require(_0x6f06('0x17'));var config=require(_0x6f06('0x18'));var licenseUtil=require(_0x6f06('0x19'));var db=require(_0x6f06('0x1a'))['db'];var csv_results;config[_0x6f06('0x1b')]=_[_0x6f06('0x1c')](config[_0x6f06('0x1b')],{'host':_0x6f06('0x1d'),'port':0x18eb});var socket=require(_0x6f06('0x1e'))(new Redis(config[_0x6f06('0x1b')]));require(_0x6f06('0x1f'))[_0x6f06('0x20')](socket);function respondWithStatusCode(_0x145035,_0x4bd99c){_0x4bd99c=_0x4bd99c||0xcc;return function(_0x4d1a3b){if(_0x4d1a3b){return _0x145035[_0x6f06('0x21')](_0x4bd99c);}return _0x145035[_0x6f06('0x22')](_0x4bd99c)[_0x6f06('0x23')]();};}function respondWithResult(_0x5df4b1,_0x11db86){_0x11db86=_0x11db86||0xc8;return function(_0x51471f){if(_0x51471f){return _0x5df4b1[_0x6f06('0x22')](_0x11db86)[_0x6f06('0x24')](_0x51471f);}};}function respondWithFilteredResult(_0x9b8b0a,_0x1fef88){return function(_0x47da06){if(_0x47da06){var _0x15dcec=typeof _0x1fef88[_0x6f06('0x25')]===_0x6f06('0x26')&&typeof _0x1fef88[_0x6f06('0x27')]===_0x6f06('0x26');var _0x26b959=_0x47da06[_0x6f06('0x28')];var _0x475d9f=_0x15dcec?0x0:_0x1fef88['offset'];var _0x409dbd=_0x15dcec?_0x47da06[_0x6f06('0x28')]:_0x1fef88[_0x6f06('0x25')]+_0x1fef88[_0x6f06('0x27')];var _0x2ba4eb;if(_0x409dbd>=_0x26b959){_0x409dbd=_0x26b959;_0x2ba4eb=0xc8;}else{_0x2ba4eb=0xce;}_0x9b8b0a['status'](_0x2ba4eb);return _0x9b8b0a[_0x6f06('0x29')]('Content-Range',_0x475d9f+'-'+_0x409dbd+'/'+_0x26b959)[_0x6f06('0x24')](_0x47da06);}return null;};}function patchUpdates(_0x5aa867){return function(_0x5271c2){try{jsonpatch['apply'](_0x5271c2,_0x5aa867,!![]);}catch(_0x5a7f6c){return BPromise[_0x6f06('0x2a')](_0x5a7f6c);}return _0x5271c2[_0x6f06('0x2b')]();};}function saveUpdates(_0x38b02c,_0x47e524){return function(_0x3be45f){if(_0x3be45f){return _0x3be45f[_0x6f06('0x2c')](_0x38b02c)[_0x6f06('0x2d')](function(_0x4fc4de){return _0x4fc4de;});}return null;};}function removeEntity(_0x56ad70,_0x2af76e){return function(_0x5a5f52){if(_0x5a5f52){return _0x5a5f52[_0x6f06('0x2e')]()[_0x6f06('0x2d')](function(){var _0x46dd4c=_0x5a5f52[_0x6f06('0x2f')]({'plain':!![]});var _0x4ba778=_0x6f06('0x30');return db[_0x6f06('0x31')][_0x6f06('0x2e')]({'where':{'type':_0x4ba778,'resourceId':_0x46dd4c['id']}})[_0x6f06('0x2d')](function(){return _0x5a5f52;});})['then'](function(){_0x56ad70[_0x6f06('0x22')](0xcc)[_0x6f06('0x23')]();});}};}function handleEntityNotFound(_0x5b4b94,_0x53337e){return function(_0x4c903b){if(!_0x4c903b){_0x5b4b94[_0x6f06('0x21')](0x194);}return _0x4c903b;};}function handleError(_0x48a376,_0x1e3598){_0x1e3598=_0x1e3598||0x1f4;return function(_0x31e4e0){logger['error'](_0x31e4e0[_0x6f06('0x32')]);if(_0x31e4e0[_0x6f06('0x33')]){delete _0x31e4e0[_0x6f06('0x33')];}_0x48a376['status'](_0x1e3598)[_0x6f06('0x34')](_0x31e4e0);};}exports['index']=function(_0x5494b1,_0x5f3bf4){var _0x1465c6={},_0x28597c={},_0x5eb0ae={'count':0x0,'rows':[]};var _0x806c63=_['map'](db['CmList'][_0x6f06('0x35')],function(_0x4e0bd5){return{'name':_0x4e0bd5[_0x6f06('0x36')],'type':_0x4e0bd5[_0x6f06('0x37')][_0x6f06('0x38')]};});_0x28597c[_0x6f06('0x39')]=_['map'](_0x806c63,'name');_0x28597c['query']=_[_0x6f06('0x3a')](_0x5494b1[_0x6f06('0x3b')]);_0x28597c['filters']=_[_0x6f06('0x3c')](_0x28597c[_0x6f06('0x39')],_0x28597c['query']);_0x1465c6[_0x6f06('0x3d')]=_[_0x6f06('0x3c')](_0x28597c[_0x6f06('0x39')],qs['fields'](_0x5494b1['query']['fields']));_0x1465c6[_0x6f06('0x3d')]=_0x1465c6[_0x6f06('0x3d')][_0x6f06('0x3e')]?_0x1465c6[_0x6f06('0x3d')]:_0x28597c['model'];if(!_0x5494b1[_0x6f06('0x3b')]['hasOwnProperty'](_0x6f06('0x3f'))){_0x1465c6['limit']=qs[_0x6f06('0x27')](_0x5494b1[_0x6f06('0x3b')][_0x6f06('0x27')]);_0x1465c6['offset']=qs[_0x6f06('0x25')](_0x5494b1['query']['offset']);}_0x1465c6['order']=qs[_0x6f06('0x40')](_0x5494b1[_0x6f06('0x3b')][_0x6f06('0x40')]);_0x1465c6[_0x6f06('0x41')]=qs[_0x6f06('0x42')](_[_0x6f06('0x43')](_0x5494b1['query'],_0x28597c['filters']),_0x806c63);if(_0x5494b1[_0x6f06('0x3b')][_0x6f06('0x44')]){_0x1465c6['where']=_[_0x6f06('0x45')](_0x1465c6['where'],{'$or':_[_0x6f06('0x46')](_0x806c63,function(_0x9c523f){if(_0x9c523f[_0x6f06('0x37')]!==_0x6f06('0x47')){var _0x275e3d={};_0x275e3d[_0x9c523f['name']]={'$like':'%'+_0x5494b1[_0x6f06('0x3b')][_0x6f06('0x44')]+'%'};return _0x275e3d;}})});}_0x1465c6=_[_0x6f06('0x45')]({},_0x1465c6,_0x5494b1[_0x6f06('0x48')]);var _0x29c596={'where':_0x1465c6[_0x6f06('0x41')]};return db[_0x6f06('0x49')][_0x6f06('0x28')](_0x29c596)['then'](function(_0x50c455){_0x5eb0ae[_0x6f06('0x28')]=_0x50c455;if(_0x5494b1[_0x6f06('0x3b')][_0x6f06('0x4a')]){_0x1465c6[_0x6f06('0x4b')]=[{'all':!![]}];}return db[_0x6f06('0x49')][_0x6f06('0x4c')](_0x1465c6);})[_0x6f06('0x2d')](function(_0x12141c){_0x5eb0ae[_0x6f06('0x4d')]=_0x12141c;return _0x5eb0ae;})[_0x6f06('0x2d')](respondWithFilteredResult(_0x5f3bf4,_0x1465c6))[_0x6f06('0x4e')](handleError(_0x5f3bf4,null));};exports['show']=function(_0x106451,_0x1c735a){var _0x1949e6={'raw':![],'where':{'id':_0x106451[_0x6f06('0x4f')]['id']}},_0x5cd7ee={};_0x5cd7ee[_0x6f06('0x39')]=_[_0x6f06('0x3a')](db['CmList']['rawAttributes']);_0x5cd7ee[_0x6f06('0x3b')]=_[_0x6f06('0x3a')](_0x106451['query']);_0x5cd7ee['filters']=_[_0x6f06('0x3c')](_0x5cd7ee[_0x6f06('0x39')],_0x5cd7ee['query']);_0x1949e6[_0x6f06('0x3d')]=_[_0x6f06('0x3c')](_0x5cd7ee[_0x6f06('0x39')],qs[_0x6f06('0x50')](_0x106451[_0x6f06('0x3b')][_0x6f06('0x50')]));_0x1949e6[_0x6f06('0x3d')]=_0x1949e6['attributes']['length']?_0x1949e6[_0x6f06('0x3d')]:_0x5cd7ee[_0x6f06('0x39')];if(_0x106451['query'][_0x6f06('0x4a')]){_0x1949e6[_0x6f06('0x4b')]=[{'all':!![]}];}_0x1949e6=_[_0x6f06('0x45')]({},_0x1949e6,_0x106451[_0x6f06('0x48')]);return db[_0x6f06('0x49')][_0x6f06('0x51')](_0x1949e6)[_0x6f06('0x2d')](handleEntityNotFound(_0x1c735a,null))[_0x6f06('0x2d')](respondWithResult(_0x1c735a,null))[_0x6f06('0x4e')](handleError(_0x1c735a,null));};exports[_0x6f06('0x52')]=function(_0xc5843d,_0x1126a7){return db[_0x6f06('0x49')][_0x6f06('0x52')](_0xc5843d['body'],{})['then'](function(_0x36f0d6){var _0x1498ce=_0xc5843d['user']['get']({'plain':!![]});if(!_0x1498ce)throw new Error(_0x6f06('0x53'));if(_0x1498ce[_0x6f06('0x54')]===_0x6f06('0x55')){var _0x1a6000=_0x36f0d6[_0x6f06('0x2f')]({'plain':!![]});var _0x83d821=_0x6f06('0x30');return db['UserProfileSection'][_0x6f06('0x51')]({'where':{'name':_0x83d821,'userProfileId':_0x1498ce[_0x6f06('0x56')]},'raw':!![]})['then'](function(_0x5c7073){if(_0x5c7073&&_0x5c7073['autoAssociation']===0x0){return db[_0x6f06('0x31')]['create']({'name':_0x1a6000[_0x6f06('0x33')],'resourceId':_0x1a6000['id'],'type':_0x5c7073['name'],'sectionId':_0x5c7073['id']},{})[_0x6f06('0x2d')](function(){return _0x36f0d6;});}else{return _0x36f0d6;}})[_0x6f06('0x4e')](function(_0x43170a){logger['error'](_0x6f06('0x57'),_0x43170a);throw _0x43170a;});}return _0x36f0d6;})[_0x6f06('0x2d')](respondWithResult(_0x1126a7,0xc9))[_0x6f06('0x4e')](handleError(_0x1126a7,null));};exports['update']=function(_0x2ed2d5,_0x4c7193){if(_0x2ed2d5['body']['id']){delete _0x2ed2d5[_0x6f06('0x58')]['id'];}return db[_0x6f06('0x49')][_0x6f06('0x51')]({'where':{'id':_0x2ed2d5[_0x6f06('0x4f')]['id']}})[_0x6f06('0x2d')](handleEntityNotFound(_0x4c7193,null))[_0x6f06('0x2d')](saveUpdates(_0x2ed2d5[_0x6f06('0x58')],null))[_0x6f06('0x2d')](respondWithResult(_0x4c7193,null))['catch'](handleError(_0x4c7193,null));};exports['destroy']=function(_0x54d7e1,_0x233653){return db['CmList'][_0x6f06('0x51')]({'where':{'id':_0x54d7e1['params']['id']}})[_0x6f06('0x2d')](handleEntityNotFound(_0x233653,null))[_0x6f06('0x2d')](removeEntity(_0x233653,null))[_0x6f06('0x4e')](handleError(_0x233653,null));};exports[_0x6f06('0x59')]=function(_0x25f116,_0x302e73){return db[_0x6f06('0x49')][_0x6f06('0x59')]()[_0x6f06('0x2d')](respondWithResult(_0x302e73,null))[_0x6f06('0x4e')](handleError(_0x302e73,null));};exports[_0x6f06('0x5a')]=function(_0x159831,_0x3c6a2c,_0x4426e2){if(_0x159831['body']['id']){delete _0x159831[_0x6f06('0x58')]['id'];}return db[_0x6f06('0x49')][_0x6f06('0x51')]({'where':{'id':_0x159831[_0x6f06('0x4f')]['id']}})[_0x6f06('0x2d')](handleEntityNotFound(_0x3c6a2c,null))[_0x6f06('0x2d')](function(_0x5080a2){if(_0x5080a2){_0x159831['body']['ListId']=_0x5080a2['id'];return db[_0x6f06('0x5b')][_0x6f06('0x52')](_0x159831[_0x6f06('0x58')]);}})[_0x6f06('0x2d')](respondWithResult(_0x3c6a2c,null))[_0x6f06('0x4e')](handleError(_0x3c6a2c,null));};exports[_0x6f06('0x5c')]=function(_0x5724e6,_0x18d66f,_0x202de1){var _0x449a67={'raw':![],'where':{}};var _0x13af35={};var _0x639e83={'count':0x0,'rows':[]};return db[_0x6f06('0x49')]['findOne']({'where':{'id':_0x5724e6[_0x6f06('0x4f')]['id']}})[_0x6f06('0x2d')](handleEntityNotFound(_0x18d66f,null))[_0x6f06('0x2d')](function(_0x20e0b8){if(_0x20e0b8){_0x13af35['model']=_['keys'](db[_0x6f06('0x5b')][_0x6f06('0x35')]);_0x13af35[_0x6f06('0x3b')]=_[_0x6f06('0x3a')](_0x5724e6[_0x6f06('0x3b')]);_0x13af35[_0x6f06('0x42')]=_[_0x6f06('0x3c')](_0x13af35[_0x6f06('0x39')],_0x13af35[_0x6f06('0x3b')]);_0x449a67[_0x6f06('0x3d')]=_[_0x6f06('0x3c')](_0x13af35['model'],qs['fields'](_0x5724e6[_0x6f06('0x3b')][_0x6f06('0x50')]));_0x449a67[_0x6f06('0x3d')]=_0x449a67[_0x6f06('0x3d')]['length']?_0x449a67[_0x6f06('0x3d')]:_0x13af35[_0x6f06('0x39')];if(!_0x5724e6['query'][_0x6f06('0x5d')](_0x6f06('0x3f'))){_0x449a67[_0x6f06('0x27')]=qs['limit'](_0x5724e6[_0x6f06('0x3b')][_0x6f06('0x27')]);_0x449a67['offset']=qs[_0x6f06('0x25')](_0x5724e6[_0x6f06('0x3b')][_0x6f06('0x25')]);}_0x449a67[_0x6f06('0x5e')]=qs['sort'](_0x5724e6[_0x6f06('0x3b')][_0x6f06('0x40')]);_0x449a67[_0x6f06('0x41')]=qs[_0x6f06('0x42')](_[_0x6f06('0x43')](_0x5724e6['query'],_0x13af35[_0x6f06('0x42')]));_0x449a67['where'][_0x6f06('0x5f')]=_0x20e0b8['id'];if(_0x5724e6[_0x6f06('0x3b')][_0x6f06('0x44')]){_0x449a67[_0x6f06('0x41')]=_[_0x6f06('0x45')](_0x449a67[_0x6f06('0x41')],{'$or':_['map'](_0x449a67[_0x6f06('0x3d')],function(_0x33f1f5){var _0x503a57={};_0x503a57[_0x33f1f5]={'$like':'%'+_0x5724e6[_0x6f06('0x3b')][_0x6f06('0x44')]+'%'};return _0x503a57;})});}_0x449a67=_[_0x6f06('0x45')]({},_0x449a67,_0x5724e6[_0x6f06('0x48')]);return db[_0x6f06('0x5b')]['count']({'where':_0x449a67[_0x6f06('0x41')]})[_0x6f06('0x2d')](function(_0x332b0e){_0x639e83[_0x6f06('0x28')]=_0x332b0e;if(_0x5724e6[_0x6f06('0x3b')][_0x6f06('0x4a')]){_0x449a67[_0x6f06('0x4b')]=[{'all':!![]}];}return db[_0x6f06('0x5b')]['findAll'](_0x449a67);})[_0x6f06('0x2d')](function(_0x165cd5){_0x639e83[_0x6f06('0x4d')]=_0x165cd5;return _0x639e83;});}})[_0x6f06('0x2d')](respondWithFilteredResult(_0x18d66f,_0x449a67))[_0x6f06('0x4e')](handleError(_0x18d66f,null));};exports[_0x6f06('0x60')]=function(_0x3ff0f6,_0x344f0e,_0x1191c0){return db[_0x6f06('0x49')][_0x6f06('0x51')]({'where':{'id':_0x3ff0f6['params']['id']}})[_0x6f06('0x2d')](handleEntityNotFound(_0x344f0e,null))[_0x6f06('0x2d')](function(_0x32a54f){if(_0x32a54f){return _0x32a54f['removeDispositions'](_0x3ff0f6[_0x6f06('0x3b')][_0x6f06('0x61')]);}})[_0x6f06('0x2d')](respondWithStatusCode(_0x344f0e,null))[_0x6f06('0x4e')](handleError(_0x344f0e,null));};exports['addContacts']=function(_0x566027,_0x14b161,_0x41a750){return db[_0x6f06('0x49')]['find']({'where':{'id':_0x566027[_0x6f06('0x4f')]['id']}})[_0x6f06('0x2d')](handleEntityNotFound(_0x14b161,null))[_0x6f06('0x2d')](function(_0x42cbe8){if(_0x42cbe8){var _0x10bbaa=[];var _0x13fa39={'success':[],'errors':[]};return db[_0x6f06('0x62')][_0x6f06('0x59')]()['then'](function(_0x29a4ec){if(_0x566027[_0x6f06('0x58')][_0x6f06('0x63')]&&_[_0x6f06('0x64')](_0x566027['body'][_0x6f06('0x63')])){if(_0x566027[_0x6f06('0x58')][_0x6f06('0x63')][_0x6f06('0x3e')]){_0x566027[_0x6f06('0x58')]['tags']=_0x566027[_0x6f06('0x58')][_0x6f06('0x63')][_0x6f06('0x65')](';')+';';}else{_0x566027['body'][_0x6f06('0x63')]=null;}}else{_0x566027['body'][_0x6f06('0x63')]=null;}if(_0x566027[_0x6f06('0x58')]&&_[_0x6f06('0x64')](_0x566027[_0x6f06('0x58')])){for(var _0x77ba37=0x0;_0x77ba37<_0x566027[_0x6f06('0x58')]['length'];_0x77ba37+=0x1){_0x566027[_0x6f06('0x58')][_0x77ba37][_0x6f06('0x5f')]=_0x566027['params']['id'];_0x10bbaa[_0x6f06('0x66')](_0x566027[_0x6f06('0x58')][_0x77ba37]);}return BPromise[_0x6f06('0x67')](_0x10bbaa,function(_0x25c3af){return db[_0x6f06('0x62')]['create'](_[_0x6f06('0x68')](_0x25c3af,[_0x6f06('0x61'),'id'])||{},{'fields':_['keys'](_0x29a4ec),'raw':!![]})['then'](function(_0x3369c7){_0x13fa39[_0x6f06('0x69')][_0x6f06('0x66')](_0x3369c7['dataValues']);})[_0x6f06('0x4e')](function(_0x996d4e){_0x13fa39[_0x6f06('0x6a')][_0x6f06('0x66')]({'data':_0x25c3af,'error':_0x996d4e[_0x6f06('0x6b')]});});})['then'](function(_0xcef0cc){return _0x13fa39;})[_0x6f06('0x4e')](function(_0x303f7c){return _0x303f7c;});}else{_0x14b161[_0x6f06('0x22')](0x190)[_0x6f06('0x24')]({'message':_0x6f06('0x6c')});}});}})['then'](respondWithResult(_0x14b161,null))[_0x6f06('0x4e')](handleError(_0x14b161,null));};exports[_0x6f06('0x6d')]=function(_0x5179f3,_0x13e72a,_0x8d614f){var _0x900410;return db[_0x6f06('0x49')][_0x6f06('0x51')]({'where':{'id':_0x5179f3[_0x6f06('0x4f')]['id']},'include':[{'model':db[_0x6f06('0x6e')],'as':'CustomFields'}]})[_0x6f06('0x2d')](handleEntityNotFound(_0x13e72a,null))[_0x6f06('0x2d')](function(_0x599818){if(_0x599818){_0x900410=_0x599818;return db[_0x6f06('0x62')][_0x6f06('0x35')];}})['then'](function(_0x339c60){if(_0x339c60){var _0x239a4a={};var _0x1bba8d={};_0x1bba8d[_0x6f06('0x39')]=_[_0x6f06('0x6f')](_['keys'](_0x339c60),_[_0x6f06('0x46')](_0x900410[_0x6f06('0x70')],function(_0xe3ab21){return util['format'](_0x6f06('0x71'),_0xe3ab21['id']);}));_0x1bba8d[_0x6f06('0x3b')]=_[_0x6f06('0x3a')](_0x5179f3[_0x6f06('0x3b')]);_0x1bba8d[_0x6f06('0x42')]=_['intersection'](_0x1bba8d['model'],_0x1bba8d['query']);_0x239a4a[_0x6f06('0x3d')]=_[_0x6f06('0x3c')](_0x1bba8d[_0x6f06('0x39')],qs[_0x6f06('0x50')](_0x5179f3[_0x6f06('0x3b')]['fields']));_0x239a4a[_0x6f06('0x3d')]=_0x239a4a[_0x6f06('0x3d')][_0x6f06('0x3e')]?_0x239a4a[_0x6f06('0x3d')]:_0x1bba8d[_0x6f06('0x39')];if(!_0x5179f3[_0x6f06('0x3b')][_0x6f06('0x5d')](_0x6f06('0x3f'))){_0x239a4a[_0x6f06('0x27')]=qs['limit'](_0x5179f3[_0x6f06('0x3b')][_0x6f06('0x27')]);_0x239a4a[_0x6f06('0x25')]=qs['offset'](_0x5179f3[_0x6f06('0x3b')][_0x6f06('0x25')]);}_0x239a4a[_0x6f06('0x5e')]=qs[_0x6f06('0x40')](_0x5179f3[_0x6f06('0x3b')]['sort']);_0x239a4a['where']=qs['filters'](_['pick'](_0x5179f3[_0x6f06('0x3b')],_0x1bba8d[_0x6f06('0x42')]));_0x239a4a[_0x6f06('0x72')]=!![];if(_0x5179f3[_0x6f06('0x3b')][_0x6f06('0x44')]){_0x239a4a[_0x6f06('0x41')]=_[_0x6f06('0x45')](_0x239a4a[_0x6f06('0x41')],{'$or':_[_0x6f06('0x46')](_0x239a4a[_0x6f06('0x3d')],function(_0x202e05){var _0x3b0851={};_0x3b0851[_0x202e05]={'$like':'%'+_0x5179f3[_0x6f06('0x3b')][_0x6f06('0x44')]+'%'};return _0x3b0851;})});}_0x239a4a=_['merge']({},_0x239a4a,_0x5179f3[_0x6f06('0x48')]);return _0x900410[_0x6f06('0x6d')](_0x239a4a);}})['then'](respondWithResult(_0x13e72a,null))[_0x6f06('0x4e')](handleError(_0x13e72a,null));};exports[_0x6f06('0x73')]=function(_0x4c95f4,_0x3b5319,_0x315cb3){var _0x5a13c8;var _0x192514;var _0x3f7150;var _0x68909=_0x4c95f4[_0x6f06('0x4f')]['id'];csv_results=[];return db[_0x6f06('0x74')][_0x6f06('0x4c')]({'attributes':['id','name'],'raw':!![],'order':[_0x6f06('0x75')]})[_0x6f06('0x2d')](function(_0xa8db06){_0x5a13c8=_0xa8db06;var _0x4c44d8=_[_0x6f06('0x3a')](db['CmContact'][_0x6f06('0x35')]);return db[_0x6f06('0x6e')][_0x6f06('0x4c')]({'raw':!![],'attributes':['id',_0x6f06('0x76')]})[_0x6f06('0x2d')](function(_0x462a78){_0x192514=_0x462a78;var _0x5e1474=squel[_0x6f06('0x77')]()[_0x6f06('0x50')](_0x4c44d8)[_0x6f06('0x78')]('cm_contacts','c')[_0x6f06('0x41')](_0x6f06('0x79'),_0x68909)[_0x6f06('0x41')](_0x6f06('0x7a'))[_0x6f06('0x7b')]();for(var _0xa98456=0x0;_0xa98456<_0x192514[_0x6f06('0x3e')];_0xa98456++){_0x5e1474[_0x6f06('0x7c')]('c.cf_'+_0x192514[_0xa98456]['id'],_0x6f06('0x7d')+_0x192514[_0xa98456][_0x6f06('0x76')]);}for(var _0xa98456=0x0;_0xa98456<_0x5a13c8['length'];_0xa98456++){_0x5e1474[_0x6f06('0x7c')](squel['select']()[_0x6f06('0x7c')](_0x6f06('0x7e'))['from'](_0x6f06('0x7f'))[_0x6f06('0x41')](_0x6f06('0x80'),_0x5a13c8[_0xa98456]['id'])[_0x6f06('0x41')]('CmContactId\x20=\x20c.id'),_0x6f06('0x81')+_0x5a13c8[_0xa98456][_0x6f06('0x33')]);_0x5e1474['field'](squel[_0x6f06('0x77')]()[_0x6f06('0x7c')](_0x6f06('0x82'))[_0x6f06('0x78')](_0x6f06('0x7f'))[_0x6f06('0x41')](_0x6f06('0x80'),_0x5a13c8[_0xa98456]['id'])[_0x6f06('0x41')](_0x6f06('0x83')),'description_additionalPhone_'+_0x5a13c8[_0xa98456]['name']);}var _0xe70e9f=[];_0xe70e9f[_0x6f06('0x66')](_0x5e1474[_0x6f06('0x84')]());BPromise[_0x6f06('0x67')](_0xe70e9f,handleQuery)['then'](function(_0x3ff025){handleQuery(_0x5e1474['toString']());var _0x2e82fb=csv_results[0x0];if(!_[_0x6f06('0x85')](_0x2e82fb)){var _0x5246a4=toCsv(_0x2e82fb);var _0x27e3ba=Date[_0x6f06('0x86')]();fs[_0x6f06('0x87')](util['format'](_0x6f06('0x88'),_0x68909,_0x27e3ba),_0x5246a4);_0x3b5319[_0x6f06('0x89')](_0x6f06('0x8a'),_0x6f06('0x8b')+util[_0x6f06('0x8c')](_0x6f06('0x8d'),_0x68909,_0x27e3ba));_0x3b5319[_0x6f06('0x89')](_0x6f06('0x8e'),_0x6f06('0x8f'));return _0x3b5319['download'](util['format'](_0x6f06('0x88'),_0x68909,_0x27e3ba));}else{return _0x3b5319[_0x6f06('0x21')](0xcc);}});});});};exports[_0x6f06('0x90')]=function(_0x456794,_0x490c2c,_0x291ffb){var _0x575267;delete _0x456794['body']['id'];return db[_0x6f06('0x49')][_0x6f06('0x91')]({'where':{'id':_0x456794[_0x6f06('0x4f')]['id']}})['then'](handleEntityNotFound(_0x490c2c,null))[_0x6f06('0x2d')](function(_0x4aa001){if(_0x4aa001){return db[_0x6f06('0x92')][_0x6f06('0x93')](function(_0x134e65){return db['CmCustomField'][_0x6f06('0x52')](_0x456794[_0x6f06('0x58')],{'transaction':_0x134e65})[_0x6f06('0x2d')](function(_0x418059){_0x575267=_0x418059;return _0x4aa001[_0x6f06('0x94')](_0x418059,{'transaction':_0x134e65});})[_0x6f06('0x2d')](function(){var _0x45b729={'type':db[_0x6f06('0x95')][_0x6f06('0x96')],'transaction':_0x134e65};switch(_0x456794[_0x6f06('0x58')][_0x6f06('0x37')]){case _0x6f06('0x97'):_0x45b729[_0x6f06('0x37')]=db[_0x6f06('0x95')]['TEXT'];break;case'number':_0x45b729['type']=db[_0x6f06('0x95')]['INTEGER'];break;case _0x6f06('0x98'):_0x45b729['type']=db[_0x6f06('0x95')]['BOOLEAN'];_0x45b729['defaultValue']=![];break;default:}return db[_0x6f06('0x92')][_0x6f06('0x99')][_0x6f06('0x9a')](_0x6f06('0x9b'),util['format'](_0x6f06('0x9c'),_0x575267['id']),_0x45b729);})[_0x6f06('0x2d')](function(){return _0x575267;});});}})[_0x6f06('0x2d')](respondWithResult(_0x490c2c,null))[_0x6f06('0x4e')](handleError(_0x490c2c,null));};exports[_0x6f06('0x9d')]=function(_0x5f246b,_0x1d4bb2,_0x3af8b0){var _0x3d02f5={};var _0x18c680={};var _0x1b9ac3;var _0x536866;return db[_0x6f06('0x49')]['findOne']({'where':{'id':_0x5f246b[_0x6f06('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1d4bb2,null))[_0x6f06('0x2d')](function(_0x1c330f){if(_0x1c330f){_0x1b9ac3=_0x1c330f;_0x18c680[_0x6f06('0x39')]=_[_0x6f06('0x3a')](db['CmCustomField'][_0x6f06('0x35')]);_0x18c680[_0x6f06('0x3b')]=_[_0x6f06('0x3a')](_0x5f246b[_0x6f06('0x3b')]);_0x18c680[_0x6f06('0x42')]=_[_0x6f06('0x3c')](_0x18c680['model'],_0x18c680[_0x6f06('0x3b')]);_0x3d02f5[_0x6f06('0x3d')]=_[_0x6f06('0x3c')](_0x18c680[_0x6f06('0x39')],qs[_0x6f06('0x50')](_0x5f246b['query']['fields']));_0x3d02f5[_0x6f06('0x3d')]=_0x3d02f5[_0x6f06('0x3d')][_0x6f06('0x3e')]?_0x3d02f5[_0x6f06('0x3d')]:_0x18c680['model'];_0x3d02f5[_0x6f06('0x5e')]=qs[_0x6f06('0x40')](_0x5f246b[_0x6f06('0x3b')][_0x6f06('0x40')]);_0x3d02f5[_0x6f06('0x41')]=qs['filters'](_['pick'](_0x5f246b[_0x6f06('0x3b')],_0x18c680['filters']));_0x3d02f5['where']=_['merge'](_0x3d02f5[_0x6f06('0x41')],{'$or':[{'ListId':_0x1c330f['id']},{'ListId':null}]});if(_0x5f246b[_0x6f06('0x3b')][_0x6f06('0x44')]){_0x3d02f5[_0x6f06('0x41')]=_[_0x6f06('0x45')](_0x3d02f5[_0x6f06('0x41')],{'$or':_['map'](_0x3d02f5[_0x6f06('0x3d')],function(_0x1af313){var _0x9d389c={};_0x9d389c[_0x1af313]={'$like':'%'+_0x5f246b['query'][_0x6f06('0x44')]+'%'};return _0x9d389c;})});}_0x3d02f5=_['merge']({},_0x3d02f5,_0x5f246b[_0x6f06('0x48')]);return db[_0x6f06('0x6e')][_0x6f06('0x9e')](_0x3d02f5);}})['then'](respondWithResult(_0x1d4bb2,null))[_0x6f06('0x4e')](handleError(_0x1d4bb2,null));};exports[_0x6f06('0x9f')]=function(_0x312221,_0x2a1984){return db[_0x6f06('0x6e')][_0x6f06('0x9e')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x2a1984,null))[_0x6f06('0x2d')](function(_0x476346){return _0x476346;})['then'](respondWithResult(_0x2a1984,null))['catch'](handleError(_0x2a1984,null));};exports['addAgents']=function(_0xf0b554,_0x182e34,_0x578797){return db[_0x6f06('0x49')]['find']({'where':{'id':_0xf0b554[_0x6f06('0x4f')]['id']}})[_0x6f06('0x2d')](handleEntityNotFound(_0x182e34,null))[_0x6f06('0x2d')](function(_0x61731a){if(_0x61731a){return _0x61731a[_0x6f06('0xa0')](_0xf0b554[_0x6f06('0x58')][_0x6f06('0x61')],_[_0x6f06('0x68')](_0xf0b554['body'],['ids','id'])||{})[_0x6f06('0xa1')](function(_0x26435c){for(var _0x20ad79=0x0;_0x20ad79<_0xf0b554[_0x6f06('0x58')][_0x6f06('0x61')][_0x6f06('0x3e')];_0x20ad79+=0x1){socket[_0x6f06('0xa2')](_0x6f06('0xa3'),{'UserId':Number(_0xf0b554[_0x6f06('0x58')][_0x6f06('0x61')][_0x20ad79]),'CmListId':Number(_0xf0b554['params']['id'])});}return _0x26435c;});}})[_0x6f06('0x2d')](respondWithResult(_0x182e34,null))['catch'](handleError(_0x182e34,null));};exports[_0x6f06('0xa4')]=function(_0x31c157,_0x4e2380,_0x463632){return db[_0x6f06('0x49')][_0x6f06('0x51')]({'where':{'id':_0x31c157[_0x6f06('0x4f')]['id']}})[_0x6f06('0x2d')](handleEntityNotFound(_0x4e2380,null))[_0x6f06('0x2d')](function(_0x434268){if(_0x434268){return _0x434268[_0x6f06('0xa4')](_0x31c157[_0x6f06('0x3b')][_0x6f06('0x61')])[_0x6f06('0x2d')](function(){if(_[_0x6f06('0x64')](_0x31c157['query'][_0x6f06('0x61')])){for(var _0x112966=0x0;_0x112966<_0x31c157[_0x6f06('0x3b')][_0x6f06('0x61')][_0x6f06('0x3e')];_0x112966+=0x1){socket[_0x6f06('0xa2')](_0x6f06('0xa5'),{'UserId':Number(_0x31c157[_0x6f06('0x3b')][_0x6f06('0x61')][_0x112966]),'CmListId':Number(_0x31c157[_0x6f06('0x4f')]['id'])});}}else{socket['emit'](_0x6f06('0xa5'),{'UserId':Number(_0x31c157['query'][_0x6f06('0x61')]),'CmListId':Number(_0x31c157['params']['id'])});}});}})[_0x6f06('0x2d')](respondWithStatusCode(_0x4e2380,null))[_0x6f06('0x4e')](handleError(_0x4e2380,null));};exports[_0x6f06('0xa6')]=function(_0x25b996,_0x2395b9,_0x1c56ad){var _0x30d62f={};var _0x39c396={};var _0x3b3a12;var _0x45ead6;return db['CmList'][_0x6f06('0x91')]({'where':{'id':_0x25b996[_0x6f06('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2395b9,null))['then'](function(_0x513bf4){if(_0x513bf4){_0x3b3a12=_0x513bf4;_0x39c396['model']=_[_0x6f06('0x3a')](db[_0x6f06('0xa7')]['rawAttributes']);_0x39c396[_0x6f06('0x3b')]=_[_0x6f06('0x3a')](_0x25b996['query']);_0x39c396[_0x6f06('0x42')]=_[_0x6f06('0x3c')](_0x39c396[_0x6f06('0x39')],_0x39c396['query']);_0x30d62f[_0x6f06('0x3d')]=_[_0x6f06('0x3c')](_0x39c396[_0x6f06('0x39')],qs[_0x6f06('0x50')](_0x25b996[_0x6f06('0x3b')]['fields']));_0x30d62f[_0x6f06('0x3d')]=_0x30d62f[_0x6f06('0x3d')][_0x6f06('0x3e')]?_0x30d62f[_0x6f06('0x3d')]:_0x39c396[_0x6f06('0x39')];_0x30d62f[_0x6f06('0x5e')]=qs[_0x6f06('0x40')](_0x25b996[_0x6f06('0x3b')][_0x6f06('0x40')]);_0x30d62f[_0x6f06('0x41')]=qs[_0x6f06('0x42')](_['pick'](_0x25b996[_0x6f06('0x3b')],_0x39c396['filters']));if(_0x25b996[_0x6f06('0x3b')]['filter']){_0x30d62f[_0x6f06('0x41')]=_['merge'](_0x30d62f['where'],{'$or':_[_0x6f06('0x46')](_0x30d62f[_0x6f06('0x3d')],function(_0x4230d3){var _0x7956bf={};_0x7956bf[_0x4230d3]={'$like':'%'+_0x25b996[_0x6f06('0x3b')][_0x6f06('0x44')]+'%'};return _0x7956bf;})});}_0x30d62f=_[_0x6f06('0x45')]({},_0x30d62f,_0x25b996[_0x6f06('0x48')]);return _0x3b3a12[_0x6f06('0xa6')](_0x30d62f);}})['then'](function(_0x180e0f){if(_0x180e0f){_0x45ead6=_0x180e0f[_0x6f06('0x3e')];if(!_0x25b996[_0x6f06('0x3b')][_0x6f06('0x5d')](_0x6f06('0x3f'))){_0x30d62f[_0x6f06('0x27')]=qs[_0x6f06('0x27')](_0x25b996[_0x6f06('0x3b')][_0x6f06('0x27')]);_0x30d62f[_0x6f06('0x25')]=qs[_0x6f06('0x25')](_0x25b996['query']['offset']);}return _0x3b3a12['getAgents'](_0x30d62f);}})['then'](function(_0x11e4a7){if(_0x11e4a7){return _0x11e4a7?{'count':_0x45ead6,'rows':_0x11e4a7}:null;}})[_0x6f06('0x2d')](respondWithResult(_0x2395b9,null))[_0x6f06('0x4e')](handleError(_0x2395b9,null));};function handleQuery(_0x430f71){logger['info'](_0x430f71);return db[_0x6f06('0x92')][_0x6f06('0x3b')](_0x430f71)[_0x6f06('0xa1')](function(_0x10b92c){csv_results[_0x6f06('0x66')](_0x10b92c);})[_0x6f06('0x4e')](function(_0x10febf){logger[_0x6f06('0xa8')](_0x10febf[_0x6f06('0x6b')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index a859b01..205f8d5 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 _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x27dba4,_0x419253){var _0x35ec9d=function(_0x2d13b2){while(--_0x2d13b2){_0x27dba4['push'](_0x27dba4['shift']());}};_0x35ec9d(++_0x419253);}(_0x5fc3,0xa8));var _0x35fc=function(_0x57e00e,_0x36e79a){_0x57e00e=_0x57e00e-0x0;var _0x415e60=_0x5fc3[_0x57e00e];return _0x415e60;};'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 +var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x1cc04f,_0x2e0725){var _0x37a36a=function(_0xc74d33){while(--_0xc74d33){_0x1cc04f['push'](_0x1cc04f['shift']());}};_0x37a36a(++_0x2e0725);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 02c766d..380a037 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 _0xdace=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','CmList','cm_lists','lodash'];(function(_0x554be5,_0x177df1){var _0x2ec936=function(_0x5a2071){while(--_0x5a2071){_0x554be5['push'](_0x554be5['shift']());}};_0x2ec936(++_0x177df1);}(_0xdace,0xc5));var _0xedac=function(_0xba1760,_0x191969){_0xba1760=_0xba1760-0x0;var _0x1f3143=_0xdace[_0xba1760];return _0x1f3143;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var logger=require(_0xedac('0x1'))(_0xedac('0x2'));var moment=require(_0xedac('0x3'));var BPromise=require('bluebird');var rp=require(_0xedac('0x4'));var fs=require('fs');var path=require(_0xedac('0x5'));var rimraf=require(_0xedac('0x6'));var config=require(_0xedac('0x7'));var attributes=require('./cmList.attributes');module[_0xedac('0x8')]=function(_0x1cba89,_0x39328a){return _0x1cba89['define'](_0xedac('0x9'),attributes,{'tableName':_0xedac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['moment','bluebird','request-promise','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','../../config/logger','api'];(function(_0x48588e,_0x523e4f){var _0x1285f7=function(_0x32c01e){while(--_0x32c01e){_0x48588e['push'](_0x48588e['shift']());}};_0x1285f7(++_0x523e4f);}(_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':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 7874323..bdbb516 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 _0x96fb=['rpc','../../config/environment','jayson/promise','client','redis','localhost','./cmList.socket','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment','randomstring','ioredis'];(function(_0x73f519,_0x15fa15){var _0x410358=function(_0x7d7b48){while(--_0x7d7b48){_0x73f519['push'](_0x73f519['shift']());}};_0x410358(++_0x15fa15);}(_0x96fb,0x1ca));var _0xb96f=function(_0x2890e0,_0xb13a29){_0x2890e0=_0x2890e0-0x0;var _0x267dfe=_0x96fb[_0x2890e0];return _0x267dfe;};'use strict';var _=require(_0xb96f('0x0'));var util=require('util');var moment=require(_0xb96f('0x1'));var BPromise=require('bluebird');var rs=require(_0xb96f('0x2'));var fs=require('fs');var Redis=require(_0xb96f('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb96f('0x4'));var config=require(_0xb96f('0x5'));var jayson=require(_0xb96f('0x6'));var client=jayson[_0xb96f('0x7')]['http']({'port':0x232a});config[_0xb96f('0x8')]=_['defaults'](config[_0xb96f('0x8')],{'host':_0xb96f('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb96f('0x8')]));require(_0xb96f('0xa'))['register'](socket);function respondWithRpcPromise(_0x234bad,_0x3e18a4,_0x114e9f){return new BPromise(function(_0x4a86fb,_0x18b321){return client[_0xb96f('0xb')](_0x234bad,_0x114e9f)[_0xb96f('0xc')](function(_0x43b2d7){logger[_0xb96f('0xd')](_0xb96f('0xe'),_0x3e18a4,_0xb96f('0xf'));logger['debug'](_0xb96f('0x10'),_0x3e18a4,_0xb96f('0xf'),JSON['stringify'](_0x43b2d7));if(_0x43b2d7[_0xb96f('0x11')]){if(_0x43b2d7['error']['code']===0x1f4){logger[_0xb96f('0x11')](_0xb96f('0xe'),_0x3e18a4,_0x43b2d7[_0xb96f('0x11')][_0xb96f('0x12')]);return _0x18b321(_0x43b2d7[_0xb96f('0x11')][_0xb96f('0x12')]);}logger[_0xb96f('0x11')](_0xb96f('0xe'),_0x3e18a4,_0x43b2d7['error'][_0xb96f('0x12')]);return _0x4a86fb(_0x43b2d7[_0xb96f('0x11')][_0xb96f('0x12')]);}else{logger[_0xb96f('0xd')](_0xb96f('0xe'),_0x3e18a4,_0xb96f('0xf'));_0x4a86fb(_0x43b2d7[_0xb96f('0x13')]['message']);}})[_0xb96f('0x14')](function(_0x54bb04){logger[_0xb96f('0x11')](_0xb96f('0xe'),_0x3e18a4,_0x54bb04);_0x18b321(_0x54bb04);});});} \ No newline at end of file +var _0xa8b4=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','./cmList.socket','register','request','info','CmList,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0x1461f8,_0x338d0f){var _0x47d1eb=function(_0x4e5d2d){while(--_0x4e5d2d){_0x1461f8['push'](_0x1461f8['shift']());}};_0x47d1eb(++_0x338d0f);}(_0xa8b4,0x17b));var _0x4a8b=function(_0xec10c5,_0x131431){_0xec10c5=_0xec10c5-0x0;var _0x51bbb5=_0xa8b4[_0xec10c5];return _0x51bbb5;};'use strict';var _=require(_0x4a8b('0x0'));var util=require(_0x4a8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4a8b('0x2'));var fs=require('fs');var Redis=require(_0x4a8b('0x3'));var db=require(_0x4a8b('0x4'))['db'];var utils=require(_0x4a8b('0x5'));var logger=require(_0x4a8b('0x6'))(_0x4a8b('0x7'));var config=require(_0x4a8b('0x8'));var jayson=require(_0x4a8b('0x9'));var client=jayson[_0x4a8b('0xa')]['http']({'port':0x232a});config['redis']=_[_0x4a8b('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4a8b('0xc')]));require(_0x4a8b('0xd'))[_0x4a8b('0xe')](socket);function respondWithRpcPromise(_0x5c0bcf,_0xe9825b,_0x2c219c){return new BPromise(function(_0x2ca31f,_0x5a43dd){return client[_0x4a8b('0xf')](_0x5c0bcf,_0x2c219c)['then'](function(_0x59322b){logger[_0x4a8b('0x10')](_0x4a8b('0x11'),_0xe9825b,_0x4a8b('0x12'));logger[_0x4a8b('0x13')]('CmList,\x20%s,\x20%s,\x20%s',_0xe9825b,_0x4a8b('0x12'),JSON[_0x4a8b('0x14')](_0x59322b));if(_0x59322b[_0x4a8b('0x15')]){if(_0x59322b[_0x4a8b('0x15')][_0x4a8b('0x16')]===0x1f4){logger[_0x4a8b('0x15')]('CmList,\x20%s,\x20%s',_0xe9825b,_0x59322b['error'][_0x4a8b('0x17')]);return _0x5a43dd(_0x59322b[_0x4a8b('0x15')]['message']);}logger[_0x4a8b('0x15')](_0x4a8b('0x11'),_0xe9825b,_0x59322b[_0x4a8b('0x15')][_0x4a8b('0x17')]);return _0x2ca31f(_0x59322b['error']['message']);}else{logger[_0x4a8b('0x10')](_0x4a8b('0x11'),_0xe9825b,_0x4a8b('0x12'));_0x2ca31f(_0x59322b['result'][_0x4a8b('0x17')]);}})['catch'](function(_0x5c8a20){logger[_0x4a8b('0x15')](_0x4a8b('0x11'),_0xe9825b,_0x5c8a20);_0x5a43dd(_0x5c8a20);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 4d67ab9..bbb2912 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 _0x0897=['./cmList.events','save','remove','update','emit','register','length'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x0897,0xaf));var _0x7089=function(_0x2c26d6,_0x2beadf){_0x2c26d6=_0x2c26d6-0x0;var _0x13aa70=_0x0897[_0x2c26d6];return _0x13aa70;};'use strict';var CmListEvents=require(_0x7089('0x0'));var events=[_0x7089('0x1'),_0x7089('0x2'),_0x7089('0x3')];function createListener(_0x29fbb5,_0x26b4b0){return function(_0x5d3460){_0x26b4b0[_0x7089('0x4')](_0x29fbb5,_0x5d3460);};}function removeListener(_0x35e606,_0x1f8e40){return function(){CmListEvents['removeListener'](_0x35e606,_0x1f8e40);};}exports[_0x7089('0x5')]=function(_0x2648b0){for(var _0x3d1f28=0x0,_0x242f03=events[_0x7089('0x6')];_0x3d1f28<_0x242f03;_0x3d1f28++){var _0x260bd4=events[_0x3d1f28];var _0x34b078=createListener('cmList:'+_0x260bd4,_0x2648b0);CmListEvents['on'](_0x260bd4,_0x34b078);}}; \ No newline at end of file +var _0x0891=['./cmList.events','save','remove','update','emit','removeListener','register','cmList:'];(function(_0x31e584,_0x4d9f7f){var _0x5686d0=function(_0x1f9e99){while(--_0x1f9e99){_0x31e584['push'](_0x31e584['shift']());}};_0x5686d0(++_0x4d9f7f);}(_0x0891,0x78));var _0x1089=function(_0x3ded1b,_0x56de41){_0x3ded1b=_0x3ded1b-0x0;var _0x2fb179=_0x0891[_0x3ded1b];return _0x2fb179;};'use strict';var CmListEvents=require(_0x1089('0x0'));var events=[_0x1089('0x1'),_0x1089('0x2'),_0x1089('0x3')];function createListener(_0x2c7133,_0x193adf){return function(_0x5d9935){_0x193adf[_0x1089('0x4')](_0x2c7133,_0x5d9935);};}function removeListener(_0x487f28,_0x425512){return function(){CmListEvents[_0x1089('0x5')](_0x487f28,_0x425512);};}exports[_0x1089('0x6')]=function(_0x35e965){for(var _0x3e6823=0x0,_0x338add=events['length'];_0x3e6823<_0x338add;_0x3e6823++){var _0x50fa84=events[_0x3e6823];var _0x11148b=createListener(_0x1089('0x7')+_0x50fa84,_0x35e965);CmListEvents['on'](_0x50fa84,_0x11148b);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index f9d136d..405fd66 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 _0x3045=['Router','fs-extra','../../components/auth/service','isAuthenticated','index','/describe','describe','get','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addContacts','addCustomField','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','express'];(function(_0x3ba753,_0x2f3216){var _0x2f469a=function(_0x3c0c23){while(--_0x3c0c23){_0x3ba753['push'](_0x3ba753['shift']());}};_0x2f469a(++_0x2f3216);}(_0x3045,0x134));var _0x5304=function(_0x776660,_0x1d1885){_0x776660=_0x776660-0x0;var _0x1359b9=_0x3045[_0x776660];return _0x1359b9;};'use strict';var multer=require(_0x5304('0x0'));var util=require(_0x5304('0x1'));var path=require(_0x5304('0x2'));var timeout=require('connect-timeout');var express=require(_0x5304('0x3'));var router=express[_0x5304('0x4')]();var fs_extra=require(_0x5304('0x5'));var auth=require(_0x5304('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmList.controller');router['get']('/',auth[_0x5304('0x7')](),controller[_0x5304('0x8')]);router['get'](_0x5304('0x9'),auth['isAuthenticated'](),controller[_0x5304('0xa')]);router[_0x5304('0xb')](_0x5304('0xc'),auth[_0x5304('0x7')](),controller[_0x5304('0xd')]);router[_0x5304('0xb')](_0x5304('0xe'),auth[_0x5304('0x7')](),controller[_0x5304('0xf')]);router['get'](_0x5304('0x10'),auth['isAuthenticated'](),controller[_0x5304('0x11')]);router[_0x5304('0xb')](_0x5304('0x12'),auth[_0x5304('0x7')](),controller[_0x5304('0x13')]);router[_0x5304('0xb')](_0x5304('0x14'),auth[_0x5304('0x7')](),controller[_0x5304('0x15')]);router[_0x5304('0xb')](_0x5304('0x16'),auth[_0x5304('0x7')](),controller[_0x5304('0x17')]);router[_0x5304('0xb')](_0x5304('0x18'),auth[_0x5304('0x7')](),controller[_0x5304('0x19')]);router[_0x5304('0x1a')]('/',auth[_0x5304('0x7')](),controller[_0x5304('0x1b')]);router[_0x5304('0x1a')](_0x5304('0x10'),auth[_0x5304('0x7')](),controller[_0x5304('0x1c')]);router[_0x5304('0x1a')](_0x5304('0x12'),auth[_0x5304('0x7')](),controller[_0x5304('0x1d')]);router[_0x5304('0x1a')](_0x5304('0x16'),auth[_0x5304('0x7')](),controller[_0x5304('0x1e')]);router[_0x5304('0x1a')](_0x5304('0x18'),auth[_0x5304('0x7')](),controller[_0x5304('0x1f')]);router[_0x5304('0x20')]('/:id',auth[_0x5304('0x7')](),controller[_0x5304('0x21')]);router[_0x5304('0x22')](_0x5304('0xe'),auth['isAuthenticated'](),controller[_0x5304('0x23')]);router[_0x5304('0x22')](_0x5304('0x10'),auth[_0x5304('0x7')](),controller[_0x5304('0x24')]);router[_0x5304('0x22')](_0x5304('0x18'),auth[_0x5304('0x7')](),controller[_0x5304('0x25')]);module[_0x5304('0x26')]=router; \ No newline at end of file +var _0x7429=['create','addDisposition','/:id/fields','addCustomField','addAgents','/:id','update','delete','destroy','removeDispositions','removeAgents','exports','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','/describe','describe','isAuthenticated','getGlobalCustomFields','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','getCustomFields','/:id/users','post'];(function(_0x51aae9,_0x4095fc){var _0x28a5a9=function(_0x26f05c){while(--_0x26f05c){_0x51aae9['push'](_0x51aae9['shift']());}};_0x28a5a9(++_0x4095fc);}(_0x7429,0x6f));var _0x9742=function(_0x30699a,_0x422940){_0x30699a=_0x30699a-0x0;var _0x107091=_0x7429[_0x30699a];return _0x107091;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9742('0x0'));var timeout=require('connect-timeout');var express=require(_0x9742('0x1'));var router=express[_0x9742('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x9742('0x3'));var interaction=require(_0x9742('0x4'));var config=require(_0x9742('0x5'));var controller=require(_0x9742('0x6'));router[_0x9742('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9742('0x7')](_0x9742('0x8'),auth['isAuthenticated'](),controller[_0x9742('0x9')]);router[_0x9742('0x7')]('/global_fields',auth[_0x9742('0xa')](),controller[_0x9742('0xb')]);router[_0x9742('0x7')]('/:id',auth[_0x9742('0xa')](),controller['show']);router[_0x9742('0x7')](_0x9742('0xc'),auth['isAuthenticated'](),controller[_0x9742('0xd')]);router[_0x9742('0x7')](_0x9742('0xe'),auth['isAuthenticated'](),controller[_0x9742('0xf')]);router[_0x9742('0x7')](_0x9742('0x10'),auth['isAuthenticated'](),controller[_0x9742('0x11')]);router[_0x9742('0x7')]('/:id/fields',auth[_0x9742('0xa')](),controller[_0x9742('0x12')]);router[_0x9742('0x7')](_0x9742('0x13'),auth[_0x9742('0xa')](),controller['getAgents']);router[_0x9742('0x14')]('/',auth['isAuthenticated'](),controller[_0x9742('0x15')]);router[_0x9742('0x14')](_0x9742('0xc'),auth[_0x9742('0xa')](),controller[_0x9742('0x16')]);router['post']('/:id/contacts',auth[_0x9742('0xa')](),controller['addContacts']);router[_0x9742('0x14')](_0x9742('0x17'),auth[_0x9742('0xa')](),controller[_0x9742('0x18')]);router[_0x9742('0x14')](_0x9742('0x13'),auth[_0x9742('0xa')](),controller[_0x9742('0x19')]);router['put'](_0x9742('0x1a'),auth[_0x9742('0xa')](),controller[_0x9742('0x1b')]);router[_0x9742('0x1c')]('/:id',auth[_0x9742('0xa')](),controller[_0x9742('0x1d')]);router['delete'](_0x9742('0xc'),auth[_0x9742('0xa')](),controller[_0x9742('0x1e')]);router['delete'](_0x9742('0x13'),auth['isAuthenticated'](),controller[_0x9742('0x1f')]);module[_0x9742('0x20')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 3b1f0e4..9a70aac 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 _0xd39b=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x3a97b5,_0x4fdaad){var _0x39a0c6=function(_0x6b92ea){while(--_0x6b92ea){_0x3a97b5['push'](_0x3a97b5['shift']());}};_0x39a0c6(++_0x4fdaad);}(_0xd39b,0xe7));var _0xbd39=function(_0x272e71,_0x3aeff4){_0x272e71=_0x272e71-0x0;var _0x2f1ff3=_0xd39b[_0x272e71];return _0x2f1ff3;};'use strict';var Sequelize=require(_0xbd39('0x0'));module[_0xbd39('0x1')]={'name':{'type':Sequelize[_0xbd39('0x2')],'get':function(_0x491f7e){return this['getDataValue'](_0xbd39('0x3'));}},'field':{'type':Sequelize[_0xbd39('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0xbd39('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0xbd39('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x4653=['VIRTUAL','field','STRING','sequelize','exports'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x4653,0xc6));var _0x3465=function(_0x44ec71,_0x302bf5){_0x44ec71=_0x44ec71-0x0;var _0x288903=_0x4653[_0x44ec71];return _0x288903;};'use strict';var Sequelize=require(_0x3465('0x0'));module[_0x3465('0x1')]={'name':{'type':Sequelize[_0x3465('0x2')],'get':function(_0x22c04f){return this['getDataValue'](_0x3465('0x3'));}},'field':{'type':Sequelize[_0x3465('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x3465('0x4')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 0dfe279..d8d2c9b 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x17126c,_0x5ed1e7){var _0x3d3140=function(_0x5efc53){while(--_0x5efc53){_0x17126c['push'](_0x17126c['shift']());}};_0x3d3140(++_0x5ed1e7);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0xda5dc6,_0x365b1e){var _0x2a6a96=function(_0x13a79e){while(--_0x13a79e){_0xda5dc6['push'](_0xda5dc6['shift']());}};_0x2a6a96(++_0x365b1e);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index a068172..d884a09 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 _0x43cc=['./condition.attributes','define','tools_conditions','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x43cc,0xb7));var _0xc43c=function(_0x1e48d3,_0x5d8c43){_0x1e48d3=_0x1e48d3-0x0;var _0x2852b1=_0x43cc[_0x1e48d3];return _0x2852b1;};'use strict';var _=require(_0xc43c('0x0'));var util=require(_0xc43c('0x1'));var logger=require(_0xc43c('0x2'))(_0xc43c('0x3'));var moment=require(_0xc43c('0x4'));var BPromise=require(_0xc43c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc43c('0x6'));var rimraf=require(_0xc43c('0x7'));var config=require(_0xc43c('0x8'));var attributes=require(_0xc43c('0x9'));module['exports']=function(_0x59a7b0,_0x73c0b8){return _0x59a7b0[_0xc43c('0xa')]('Condition',attributes,{'tableName':_0xc43c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x68f0=['request-promise','rimraf','./condition.attributes','Condition','lodash','../../config/logger','api','bluebird'];(function(_0x54a229,_0x479dd1){var _0x36232e=function(_0x48a4d3){while(--_0x48a4d3){_0x54a229['push'](_0x54a229['shift']());}};_0x36232e(++_0x479dd1);}(_0x68f0,0x15c));var _0x068f=function(_0x3e182f,_0x380ec7){_0x3e182f=_0x3e182f-0x0;var _0x23edc9=_0x68f0[_0x3e182f];return _0x23edc9;};'use strict';var _=require(_0x068f('0x0'));var util=require('util');var logger=require(_0x068f('0x1'))(_0x068f('0x2'));var moment=require('moment');var BPromise=require(_0x068f('0x3'));var rp=require(_0x068f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x068f('0x5'));var config=require('../../config/environment');var attributes=require(_0x068f('0x6'));module['exports']=function(_0x2ea592,_0x206f42){return _0x2ea592['define'](_0x068f('0x7'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 289ec7e..df08dd0 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 _0x4e26=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0x4e26,0x109));var _0x64e2=function(_0x29e479,_0x4d2b3f){_0x29e479=_0x29e479-0x0;var _0x174485=_0x4e26[_0x29e479];return _0x174485;};'use strict';var _=require(_0x64e2('0x0'));var util=require('util');var moment=require(_0x64e2('0x1'));var BPromise=require(_0x64e2('0x2'));var rs=require(_0x64e2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x64e2('0x4'))['db'];var utils=require(_0x64e2('0x5'));var logger=require('../../config/logger')(_0x64e2('0x6'));var config=require(_0x64e2('0x7'));var jayson=require(_0x64e2('0x8'));var client=jayson[_0x64e2('0x9')][_0x64e2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14b414,_0x515803,_0x142fe5){return new BPromise(function(_0x556832,_0x1ddb50){return client[_0x64e2('0xb')](_0x14b414,_0x142fe5)[_0x64e2('0xc')](function(_0x2000c0){logger[_0x64e2('0xd')](_0x64e2('0xe'),_0x515803,'request\x20sent');logger[_0x64e2('0xf')](_0x64e2('0x10'),_0x515803,'request\x20sent',JSON[_0x64e2('0x11')](_0x2000c0));if(_0x2000c0[_0x64e2('0x12')]){if(_0x2000c0['error'][_0x64e2('0x13')]===0x1f4){logger[_0x64e2('0x12')](_0x64e2('0xe'),_0x515803,_0x2000c0[_0x64e2('0x12')]['message']);return _0x1ddb50(_0x2000c0[_0x64e2('0x12')][_0x64e2('0x14')]);}logger[_0x64e2('0x12')](_0x64e2('0xe'),_0x515803,_0x2000c0[_0x64e2('0x12')][_0x64e2('0x14')]);return _0x556832(_0x2000c0['error'][_0x64e2('0x14')]);}else{logger[_0x64e2('0xd')](_0x64e2('0xe'),_0x515803,_0x64e2('0x15'));_0x556832(_0x2000c0[_0x64e2('0x16')][_0x64e2('0x14')]);}})[_0x64e2('0x17')](function(_0x4fdd0b){logger['error'](_0x64e2('0xe'),_0x515803,_0x4fdd0b);_0x1ddb50(_0x4fdd0b);});});} \ No newline at end of file +var _0xe270=['catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','client','http','request','info','Condition,\x20%s,\x20%s','Condition,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent'];(function(_0x12be2a,_0x61e503){var _0x23841f=function(_0x76a277){while(--_0x76a277){_0x12be2a['push'](_0x12be2a['shift']());}};_0x23841f(++_0x61e503);}(_0xe270,0x1cc));var _0x0e27=function(_0x4b8d4f,_0x36e5f6){_0x4b8d4f=_0x4b8d4f-0x0;var _0x59979e=_0xe270[_0x4b8d4f];return _0x59979e;};'use strict';var _=require(_0x0e27('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0e27('0x1'));var rs=require(_0x0e27('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0e27('0x3'))['db'];var utils=require(_0x0e27('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x0e27('0x5'));var client=jayson[_0x0e27('0x6')][_0x0e27('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x293315,_0x34d4ac,_0x294708){return new BPromise(function(_0x3b6493,_0x3f9a49){return client[_0x0e27('0x8')](_0x293315,_0x294708)['then'](function(_0x18ec9e){logger[_0x0e27('0x9')](_0x0e27('0xa'),_0x34d4ac,'request\x20sent');logger['debug'](_0x0e27('0xb'),_0x34d4ac,'request\x20sent',JSON[_0x0e27('0xc')](_0x18ec9e));if(_0x18ec9e[_0x0e27('0xd')]){if(_0x18ec9e[_0x0e27('0xd')]['code']===0x1f4){logger[_0x0e27('0xd')](_0x0e27('0xa'),_0x34d4ac,_0x18ec9e[_0x0e27('0xd')][_0x0e27('0xe')]);return _0x3f9a49(_0x18ec9e[_0x0e27('0xd')][_0x0e27('0xe')]);}logger[_0x0e27('0xd')]('Condition,\x20%s,\x20%s',_0x34d4ac,_0x18ec9e[_0x0e27('0xd')][_0x0e27('0xe')]);return _0x3b6493(_0x18ec9e['error'][_0x0e27('0xe')]);}else{logger[_0x0e27('0x9')]('Condition,\x20%s,\x20%s',_0x34d4ac,_0x0e27('0xf'));_0x3b6493(_0x18ec9e['result'][_0x0e27('0xe')]);}})[_0x0e27('0x10')](function(_0x385c4f){logger['error'](_0x0e27('0xa'),_0x34d4ac,_0x385c4f);_0x3f9a49(_0x385c4f);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 19f8838..485c66a 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 _0xf760=['put','/:id','isAuthenticated','destroy','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x46f9bc,_0x1b4da0){var _0x2cda76=function(_0x56df2a){while(--_0x56df2a){_0x46f9bc['push'](_0x46f9bc['shift']());}};_0x2cda76(++_0x1b4da0);}(_0xf760,0x19b));var _0x0f76=function(_0x2896e2,_0x546984){_0x2896e2=_0x2896e2-0x0;var _0x1fcb56=_0xf760[_0x2896e2];return _0x1fcb56;};'use strict';var multer=require(_0x0f76('0x0'));var util=require(_0x0f76('0x1'));var path=require(_0x0f76('0x2'));var timeout=require('connect-timeout');var express=require(_0x0f76('0x3'));var router=express['Router']();var fs_extra=require(_0x0f76('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0f76('0x5'));var config=require(_0x0f76('0x6'));var controller=require('./condition.controller');router[_0x0f76('0x7')](_0x0f76('0x8'),auth[_0x0f76('0x9')](),controller['update']);router['delete'](_0x0f76('0x8'),auth[_0x0f76('0x9')](),controller[_0x0f76('0xa')]);module['exports']=router; \ No newline at end of file +var _0x5f05=['isAuthenticated','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','update','delete'];(function(_0x52c76f,_0x4da30d){var _0x4d1483=function(_0x8426e7){while(--_0x8426e7){_0x52c76f['push'](_0x52c76f['shift']());}};_0x4d1483(++_0x4da30d);}(_0x5f05,0x1bc));var _0x55f0=function(_0x5097f5,_0x377cd6){_0x5097f5=_0x5097f5-0x0;var _0x3bb333=_0x5f05[_0x5097f5];return _0x3bb333;};'use strict';var multer=require(_0x55f0('0x0'));var util=require(_0x55f0('0x1'));var path=require(_0x55f0('0x2'));var timeout=require(_0x55f0('0x3'));var express=require(_0x55f0('0x4'));var router=express[_0x55f0('0x5')]();var fs_extra=require(_0x55f0('0x6'));var auth=require(_0x55f0('0x7'));var interaction=require(_0x55f0('0x8'));var config=require(_0x55f0('0x9'));var controller=require(_0x55f0('0xa'));router[_0x55f0('0xb')](_0x55f0('0xc'),auth['isAuthenticated'](),controller[_0x55f0('0xd')]);router[_0x55f0('0xe')]('/:id',auth[_0x55f0('0xf')](),controller['destroy']);module[_0x55f0('0x10')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index b0d1976..5b78545 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 _0x1177=['exports','STRING','name'];(function(_0x36df70,_0x258d78){var _0x2d0ce6=function(_0x1b3e7b){while(--_0x1b3e7b){_0x36df70['push'](_0x36df70['shift']());}};_0x2d0ce6(++_0x258d78);}(_0x1177,0x10b));var _0x7117=function(_0xb4a2e9,_0x40a752){_0xb4a2e9=_0xb4a2e9-0x0;var _0x10dd8b=_0x1177[_0xb4a2e9];return _0x10dd8b;};'use strict';var Sequelize=require('sequelize');module[_0x7117('0x0')]={'name':{'type':Sequelize[_0x7117('0x1')],'allowNull':![],'unique':_0x7117('0x2')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x7117('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x16f2=['INTEGER','sequelize','exports','STRING','name'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x16f2,0x150));var _0x216f=function(_0x1c6efd,_0xb2f3cd){_0x1c6efd=_0x1c6efd-0x0;var _0x53a918=_0x16f2[_0x1c6efd];return _0x53a918;};'use strict';var Sequelize=require(_0x216f('0x0'));module[_0x216f('0x1')]={'name':{'type':Sequelize[_0x216f('0x2')],'allowNull':![],'unique':_0x216f('0x3')},'OrderBy':{'type':Sequelize[_0x216f('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x216f('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 d5cdcc5..677ff72 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 _0x14a0=['undefined','limit','count','offset','set','apply','reject','save','update','destroy','then','get','UserProfileResource','error','stack','send','index','map','ContactItemType','rawAttributes','fieldName','type','key','name','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ContactItemTypes','userProfileId','autoAssociation','params','CmContactHasItem','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','querystring','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x4f5fbc,_0x74cb4e){var _0x486e0e=function(_0x306829){while(--_0x306829){_0x4f5fbc['push'](_0x4f5fbc['shift']());}};_0x486e0e(++_0x74cb4e);}(_0x14a0,0x8e));var _0x014a=function(_0x20c27e,_0x44dbaa){_0x20c27e=_0x20c27e-0x0;var _0x380560=_0x14a0[_0x20c27e];return _0x380560;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x014a('0x0'));var zipdir=require(_0x014a('0x1'));var jsonpatch=require(_0x014a('0x2'));var rp=require(_0x014a('0x3'));var moment=require(_0x014a('0x4'));var BPromise=require(_0x014a('0x5'));var Mustache=require(_0x014a('0x6'));var util=require('util');var path=require('path');var sox=require(_0x014a('0x7'));var csv=require(_0x014a('0x8'));var ejs=require(_0x014a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x014a('0xa'));var crypto=require(_0x014a('0xb'));var jsforce=require(_0x014a('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x014a('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x014a('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x014a('0xf'))(_0x014a('0x10'));var utils=require('../../config/utils');var config=require(_0x014a('0x11'));var licenseUtil=require(_0x014a('0x12'));var db=require(_0x014a('0x13'))['db'];function respondWithStatusCode(_0x43bfeb,_0x1bcd1){_0x1bcd1=_0x1bcd1||0xcc;return function(_0x20cb56){if(_0x20cb56){return _0x43bfeb[_0x014a('0x14')](_0x1bcd1);}return _0x43bfeb[_0x014a('0x15')](_0x1bcd1)[_0x014a('0x16')]();};}function respondWithResult(_0x71535d,_0x45cd80){_0x45cd80=_0x45cd80||0xc8;return function(_0x3c54c8){if(_0x3c54c8){return _0x71535d['status'](_0x45cd80)[_0x014a('0x17')](_0x3c54c8);}};}function respondWithFilteredResult(_0x3cf92f,_0x59f207){return function(_0x3a836f){if(_0x3a836f){var _0x128c46=typeof _0x59f207['offset']===_0x014a('0x18')&&typeof _0x59f207[_0x014a('0x19')]===_0x014a('0x18');var _0x12da95=_0x3a836f[_0x014a('0x1a')];var _0x12d339=_0x128c46?0x0:_0x59f207[_0x014a('0x1b')];var _0x263b07=_0x128c46?_0x3a836f[_0x014a('0x1a')]:_0x59f207[_0x014a('0x1b')]+_0x59f207[_0x014a('0x19')];var _0x89e132;if(_0x263b07>=_0x12da95){_0x263b07=_0x12da95;_0x89e132=0xc8;}else{_0x89e132=0xce;}_0x3cf92f[_0x014a('0x15')](_0x89e132);return _0x3cf92f[_0x014a('0x1c')]('Content-Range',_0x12d339+'-'+_0x263b07+'/'+_0x12da95)[_0x014a('0x17')](_0x3a836f);}return null;};}function patchUpdates(_0x109a9c){return function(_0x11065f){try{jsonpatch[_0x014a('0x1d')](_0x11065f,_0x109a9c,!![]);}catch(_0xc9a563){return BPromise[_0x014a('0x1e')](_0xc9a563);}return _0x11065f[_0x014a('0x1f')]();};}function saveUpdates(_0x3dd2d0,_0x290b86){return function(_0x486e66){if(_0x486e66){return _0x486e66[_0x014a('0x20')](_0x3dd2d0)['then'](function(_0x1a1318){return _0x1a1318;});}return null;};}function removeEntity(_0x26718b,_0x44d921){return function(_0x36d52b){if(_0x36d52b){return _0x36d52b[_0x014a('0x21')]()[_0x014a('0x22')](function(){var _0x3fec9f=_0x36d52b[_0x014a('0x23')]({'plain':!![]});var _0x165a42='ContactItemTypes';return db[_0x014a('0x24')]['destroy']({'where':{'type':_0x165a42,'resourceId':_0x3fec9f['id']}})[_0x014a('0x22')](function(){return _0x36d52b;});})[_0x014a('0x22')](function(){_0x26718b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x9a901f,_0x3f9719){return function(_0x143346){if(!_0x143346){_0x9a901f['sendStatus'](0x194);}return _0x143346;};}function handleError(_0x183f19,_0x3c1fa4){_0x3c1fa4=_0x3c1fa4||0x1f4;return function(_0x598179){logger[_0x014a('0x25')](_0x598179[_0x014a('0x26')]);if(_0x598179['name']){delete _0x598179['name'];}_0x183f19[_0x014a('0x15')](_0x3c1fa4)[_0x014a('0x27')](_0x598179);};}exports[_0x014a('0x28')]=function(_0x29fce5,_0x4ea00c){var _0x434038={},_0x147e7e={},_0x15af07={'count':0x0,'rows':[]};var _0x402d3b=_[_0x014a('0x29')](db[_0x014a('0x2a')][_0x014a('0x2b')],function(_0x1dae8e){return{'name':_0x1dae8e[_0x014a('0x2c')],'type':_0x1dae8e[_0x014a('0x2d')][_0x014a('0x2e')]};});_0x147e7e['model']=_[_0x014a('0x29')](_0x402d3b,_0x014a('0x2f'));_0x147e7e[_0x014a('0x30')]=_[_0x014a('0x31')](_0x29fce5[_0x014a('0x30')]);_0x147e7e[_0x014a('0x32')]=_[_0x014a('0x33')](_0x147e7e['model'],_0x147e7e[_0x014a('0x30')]);_0x434038[_0x014a('0x34')]=_['intersection'](_0x147e7e[_0x014a('0x35')],qs[_0x014a('0x36')](_0x29fce5[_0x014a('0x30')][_0x014a('0x36')]));_0x434038[_0x014a('0x34')]=_0x434038[_0x014a('0x34')][_0x014a('0x37')]?_0x434038[_0x014a('0x34')]:_0x147e7e['model'];if(!_0x29fce5[_0x014a('0x30')][_0x014a('0x38')](_0x014a('0x39'))){_0x434038[_0x014a('0x19')]=qs['limit'](_0x29fce5[_0x014a('0x30')][_0x014a('0x19')]);_0x434038[_0x014a('0x1b')]=qs[_0x014a('0x1b')](_0x29fce5[_0x014a('0x30')][_0x014a('0x1b')]);}_0x434038[_0x014a('0x3a')]=qs[_0x014a('0x3b')](_0x29fce5[_0x014a('0x30')]['sort']);_0x434038[_0x014a('0x3c')]=qs['filters'](_[_0x014a('0x3d')](_0x29fce5[_0x014a('0x30')],_0x147e7e[_0x014a('0x32')]),_0x402d3b);if(_0x29fce5[_0x014a('0x30')][_0x014a('0x3e')]){_0x434038['where']=_[_0x014a('0x3f')](_0x434038[_0x014a('0x3c')],{'$or':_['map'](_0x402d3b,function(_0x9227b8){if(_0x9227b8[_0x014a('0x2d')]!==_0x014a('0x40')){var _0x2e7a14={};_0x2e7a14[_0x9227b8[_0x014a('0x2f')]]={'$like':'%'+_0x29fce5[_0x014a('0x30')][_0x014a('0x3e')]+'%'};return _0x2e7a14;}})});}_0x434038=_[_0x014a('0x3f')]({},_0x434038,_0x29fce5[_0x014a('0x41')]);var _0x537bde={'where':_0x434038[_0x014a('0x3c')]};return db[_0x014a('0x2a')][_0x014a('0x1a')](_0x537bde)[_0x014a('0x22')](function(_0x5f1a91){_0x15af07[_0x014a('0x1a')]=_0x5f1a91;if(_0x29fce5[_0x014a('0x30')][_0x014a('0x42')]){_0x434038[_0x014a('0x43')]=[{'all':!![]}];}return db[_0x014a('0x2a')][_0x014a('0x44')](_0x434038);})['then'](function(_0x361866){_0x15af07[_0x014a('0x45')]=_0x361866;return _0x15af07;})['then'](respondWithFilteredResult(_0x4ea00c,_0x434038))[_0x014a('0x46')](handleError(_0x4ea00c,null));};exports[_0x014a('0x47')]=function(_0x2c45f1,_0x5dc092){var _0x5bcf8={'raw':!![],'where':{'id':_0x2c45f1['params']['id']}},_0x50a8f0={};_0x50a8f0[_0x014a('0x35')]=_[_0x014a('0x31')](db['ContactItemType'][_0x014a('0x2b')]);_0x50a8f0[_0x014a('0x30')]=_[_0x014a('0x31')](_0x2c45f1[_0x014a('0x30')]);_0x50a8f0[_0x014a('0x32')]=_[_0x014a('0x33')](_0x50a8f0['model'],_0x50a8f0[_0x014a('0x30')]);_0x5bcf8[_0x014a('0x34')]=_[_0x014a('0x33')](_0x50a8f0['model'],qs['fields'](_0x2c45f1[_0x014a('0x30')]['fields']));_0x5bcf8['attributes']=_0x5bcf8[_0x014a('0x34')]['length']?_0x5bcf8[_0x014a('0x34')]:_0x50a8f0[_0x014a('0x35')];if(_0x2c45f1[_0x014a('0x30')]['includeAll']){_0x5bcf8[_0x014a('0x43')]=[{'all':!![]}];}_0x5bcf8=_[_0x014a('0x3f')]({},_0x5bcf8,_0x2c45f1[_0x014a('0x41')]);return db[_0x014a('0x2a')][_0x014a('0x48')](_0x5bcf8)[_0x014a('0x22')](handleEntityNotFound(_0x5dc092,null))['then'](respondWithResult(_0x5dc092,null))[_0x014a('0x46')](handleError(_0x5dc092,null));};exports[_0x014a('0x49')]=function(_0x5a861c,_0x1a4df9){return db[_0x014a('0x2a')][_0x014a('0x49')](_0x5a861c[_0x014a('0x4a')],{})[_0x014a('0x22')](function(_0x357ca1){var _0x437f23=_0x5a861c[_0x014a('0x4b')]['get']({'plain':!![]});if(!_0x437f23)throw new Error(_0x014a('0x4c'));if(_0x437f23[_0x014a('0x4d')]===_0x014a('0x4b')){var _0x135e7e=_0x357ca1[_0x014a('0x23')]({'plain':!![]});var _0x4b2fdb=_0x014a('0x4e');return db['UserProfileSection'][_0x014a('0x48')]({'where':{'name':_0x4b2fdb,'userProfileId':_0x437f23[_0x014a('0x4f')]},'raw':!![]})[_0x014a('0x22')](function(_0x479dc0){if(_0x479dc0&&_0x479dc0[_0x014a('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x135e7e['name'],'resourceId':_0x135e7e['id'],'type':_0x479dc0['name'],'sectionId':_0x479dc0['id']},{})[_0x014a('0x22')](function(){return _0x357ca1;});}else{return _0x357ca1;}})['catch'](function(_0x1fe253){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1fe253);throw _0x1fe253;});}return _0x357ca1;})[_0x014a('0x22')](respondWithResult(_0x1a4df9,0xc9))['catch'](handleError(_0x1a4df9,null));};exports[_0x014a('0x20')]=function(_0x1e778d,_0x400633){if(_0x1e778d[_0x014a('0x4a')]['id']){delete _0x1e778d[_0x014a('0x4a')]['id'];}return db[_0x014a('0x2a')][_0x014a('0x48')]({'where':{'id':_0x1e778d[_0x014a('0x51')]['id']}})[_0x014a('0x22')](handleEntityNotFound(_0x400633,null))[_0x014a('0x22')](saveUpdates(_0x1e778d['body'],null))['then'](respondWithResult(_0x400633,null))[_0x014a('0x46')](handleError(_0x400633,null));};exports[_0x014a('0x21')]=function(_0x237345,_0x4cc246){return db['ContactItemType'][_0x014a('0x48')]({'where':{'id':_0x237345['params']['id']}})[_0x014a('0x22')](handleEntityNotFound(_0x4cc246,null))[_0x014a('0x22')](db[_0x014a('0x52')][_0x014a('0x20')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x237345['params']['id']}}))[_0x014a('0x22')](removeEntity(_0x4cc246,null))[_0x014a('0x46')](handleError(_0x4cc246,null));}; \ No newline at end of file +var _0x63a5=['end','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','destroy','get','ContactItemTypes','UserProfileResource','error','stack','name','send','index','map','ContactItemType','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','options','includeAll','rows','catch','show','params','keys','rawAttributes','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','CmContactHasItem','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x63a5,0x18e));var _0x563a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x63a5[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0x563a('0x0'));var rimraf=require(_0x563a('0x1'));var zipdir=require(_0x563a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x563a('0x3'));var moment=require('moment');var BPromise=require(_0x563a('0x4'));var Mustache=require(_0x563a('0x5'));var util=require(_0x563a('0x6'));var path=require(_0x563a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x563a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x563a('0x9'));var squel=require(_0x563a('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x563a('0xb'));var toCsv=require(_0x563a('0xc'));var querystring=require(_0x563a('0xd'));var Papa=require(_0x563a('0xe'));var Redis=require(_0x563a('0xf'));var authService=require(_0x563a('0x10'));var qs=require(_0x563a('0x11'));var as=require(_0x563a('0x12'));var hardwareService=require(_0x563a('0x13'));var logger=require(_0x563a('0x14'))(_0x563a('0x15'));var utils=require(_0x563a('0x16'));var config=require(_0x563a('0x17'));var licenseUtil=require(_0x563a('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x61d5b2,_0x214f42){_0x214f42=_0x214f42||0xcc;return function(_0x10de2e){if(_0x10de2e){return _0x61d5b2[_0x563a('0x19')](_0x214f42);}return _0x61d5b2[_0x563a('0x1a')](_0x214f42)[_0x563a('0x1b')]();};}function respondWithResult(_0x50396b,_0x2cf052){_0x2cf052=_0x2cf052||0xc8;return function(_0x3045ac){if(_0x3045ac){return _0x50396b[_0x563a('0x1a')](_0x2cf052)[_0x563a('0x1c')](_0x3045ac);}};}function respondWithFilteredResult(_0x5a2980,_0x504cb7){return function(_0x414535){if(_0x414535){var _0x2ad667=typeof _0x504cb7['offset']===_0x563a('0x1d')&&typeof _0x504cb7[_0x563a('0x1e')]===_0x563a('0x1d');var _0x9c2f77=_0x414535['count'];var _0x598693=_0x2ad667?0x0:_0x504cb7[_0x563a('0x1f')];var _0x422aaf=_0x2ad667?_0x414535[_0x563a('0x20')]:_0x504cb7['offset']+_0x504cb7['limit'];var _0x52b99a;if(_0x422aaf>=_0x9c2f77){_0x422aaf=_0x9c2f77;_0x52b99a=0xc8;}else{_0x52b99a=0xce;}_0x5a2980['status'](_0x52b99a);return _0x5a2980[_0x563a('0x21')](_0x563a('0x22'),_0x598693+'-'+_0x422aaf+'/'+_0x9c2f77)[_0x563a('0x1c')](_0x414535);}return null;};}function patchUpdates(_0x43b7a8){return function(_0x562fce){try{jsonpatch['apply'](_0x562fce,_0x43b7a8,!![]);}catch(_0x3930f0){return BPromise[_0x563a('0x23')](_0x3930f0);}return _0x562fce[_0x563a('0x24')]();};}function saveUpdates(_0x2beccb,_0x1bf502){return function(_0x2dc7e2){if(_0x2dc7e2){return _0x2dc7e2[_0x563a('0x25')](_0x2beccb)[_0x563a('0x26')](function(_0x506491){return _0x506491;});}return null;};}function removeEntity(_0xd59ba8,_0x5422f6){return function(_0x44e2c1){if(_0x44e2c1){return _0x44e2c1[_0x563a('0x27')]()[_0x563a('0x26')](function(){var _0x1250e6=_0x44e2c1[_0x563a('0x28')]({'plain':!![]});var _0x1682ee=_0x563a('0x29');return db[_0x563a('0x2a')]['destroy']({'where':{'type':_0x1682ee,'resourceId':_0x1250e6['id']}})[_0x563a('0x26')](function(){return _0x44e2c1;});})[_0x563a('0x26')](function(){_0xd59ba8[_0x563a('0x1a')](0xcc)[_0x563a('0x1b')]();});}};}function handleEntityNotFound(_0xce8165,_0x1898f9){return function(_0x1afdff){if(!_0x1afdff){_0xce8165[_0x563a('0x19')](0x194);}return _0x1afdff;};}function handleError(_0x249db8,_0x8f3429){_0x8f3429=_0x8f3429||0x1f4;return function(_0x1a69d5){logger[_0x563a('0x2b')](_0x1a69d5[_0x563a('0x2c')]);if(_0x1a69d5[_0x563a('0x2d')]){delete _0x1a69d5['name'];}_0x249db8[_0x563a('0x1a')](_0x8f3429)[_0x563a('0x2e')](_0x1a69d5);};}exports[_0x563a('0x2f')]=function(_0x4aaa3d,_0x1e8d43){var _0x2e5c4b={},_0x3a59cb={},_0x28a8f6={'count':0x0,'rows':[]};var _0x166f89=_[_0x563a('0x30')](db[_0x563a('0x31')]['rawAttributes'],function(_0x2418ae){return{'name':_0x2418ae[_0x563a('0x32')],'type':_0x2418ae[_0x563a('0x33')][_0x563a('0x34')]};});_0x3a59cb[_0x563a('0x35')]=_['map'](_0x166f89,'name');_0x3a59cb['query']=_['keys'](_0x4aaa3d[_0x563a('0x36')]);_0x3a59cb[_0x563a('0x37')]=_[_0x563a('0x38')](_0x3a59cb[_0x563a('0x35')],_0x3a59cb[_0x563a('0x36')]);_0x2e5c4b[_0x563a('0x39')]=_['intersection'](_0x3a59cb['model'],qs[_0x563a('0x3a')](_0x4aaa3d[_0x563a('0x36')][_0x563a('0x3a')]));_0x2e5c4b[_0x563a('0x39')]=_0x2e5c4b[_0x563a('0x39')][_0x563a('0x3b')]?_0x2e5c4b[_0x563a('0x39')]:_0x3a59cb[_0x563a('0x35')];if(!_0x4aaa3d[_0x563a('0x36')][_0x563a('0x3c')](_0x563a('0x3d'))){_0x2e5c4b[_0x563a('0x1e')]=qs[_0x563a('0x1e')](_0x4aaa3d[_0x563a('0x36')][_0x563a('0x1e')]);_0x2e5c4b[_0x563a('0x1f')]=qs['offset'](_0x4aaa3d[_0x563a('0x36')][_0x563a('0x1f')]);}_0x2e5c4b[_0x563a('0x3e')]=qs['sort'](_0x4aaa3d[_0x563a('0x36')]['sort']);_0x2e5c4b[_0x563a('0x3f')]=qs[_0x563a('0x37')](_['pick'](_0x4aaa3d['query'],_0x3a59cb[_0x563a('0x37')]),_0x166f89);if(_0x4aaa3d['query'][_0x563a('0x40')]){_0x2e5c4b[_0x563a('0x3f')]=_[_0x563a('0x41')](_0x2e5c4b[_0x563a('0x3f')],{'$or':_['map'](_0x166f89,function(_0x47d37a){if(_0x47d37a[_0x563a('0x33')]!=='VIRTUAL'){var _0x46d471={};_0x46d471[_0x47d37a[_0x563a('0x2d')]]={'$like':'%'+_0x4aaa3d[_0x563a('0x36')][_0x563a('0x40')]+'%'};return _0x46d471;}})});}_0x2e5c4b=_[_0x563a('0x41')]({},_0x2e5c4b,_0x4aaa3d[_0x563a('0x42')]);var _0x4bf555={'where':_0x2e5c4b[_0x563a('0x3f')]};return db['ContactItemType'][_0x563a('0x20')](_0x4bf555)['then'](function(_0x20c142){_0x28a8f6[_0x563a('0x20')]=_0x20c142;if(_0x4aaa3d[_0x563a('0x36')][_0x563a('0x43')]){_0x2e5c4b['include']=[{'all':!![]}];}return db['ContactItemType']['findAll'](_0x2e5c4b);})[_0x563a('0x26')](function(_0x1255da){_0x28a8f6[_0x563a('0x44')]=_0x1255da;return _0x28a8f6;})[_0x563a('0x26')](respondWithFilteredResult(_0x1e8d43,_0x2e5c4b))[_0x563a('0x45')](handleError(_0x1e8d43,null));};exports[_0x563a('0x46')]=function(_0x29a1c0,_0x2ca0f4){var _0x19c2cc={'raw':!![],'where':{'id':_0x29a1c0[_0x563a('0x47')]['id']}},_0x433353={};_0x433353[_0x563a('0x35')]=_[_0x563a('0x48')](db[_0x563a('0x31')][_0x563a('0x49')]);_0x433353[_0x563a('0x36')]=_[_0x563a('0x48')](_0x29a1c0[_0x563a('0x36')]);_0x433353[_0x563a('0x37')]=_['intersection'](_0x433353['model'],_0x433353[_0x563a('0x36')]);_0x19c2cc[_0x563a('0x39')]=_[_0x563a('0x38')](_0x433353[_0x563a('0x35')],qs[_0x563a('0x3a')](_0x29a1c0[_0x563a('0x36')][_0x563a('0x3a')]));_0x19c2cc[_0x563a('0x39')]=_0x19c2cc['attributes']['length']?_0x19c2cc[_0x563a('0x39')]:_0x433353[_0x563a('0x35')];if(_0x29a1c0[_0x563a('0x36')][_0x563a('0x43')]){_0x19c2cc[_0x563a('0x4a')]=[{'all':!![]}];}_0x19c2cc=_[_0x563a('0x41')]({},_0x19c2cc,_0x29a1c0[_0x563a('0x42')]);return db[_0x563a('0x31')]['find'](_0x19c2cc)[_0x563a('0x26')](handleEntityNotFound(_0x2ca0f4,null))[_0x563a('0x26')](respondWithResult(_0x2ca0f4,null))['catch'](handleError(_0x2ca0f4,null));};exports[_0x563a('0x4b')]=function(_0x5a063a,_0x3ea787){return db[_0x563a('0x31')][_0x563a('0x4b')](_0x5a063a['body'],{})[_0x563a('0x26')](function(_0x23efcf){var _0xb1dbc8=_0x5a063a[_0x563a('0x4c')][_0x563a('0x28')]({'plain':!![]});if(!_0xb1dbc8)throw new Error(_0x563a('0x4d'));if(_0xb1dbc8[_0x563a('0x4e')]===_0x563a('0x4c')){var _0x277d54=_0x23efcf[_0x563a('0x28')]({'plain':!![]});var _0x3c98d5=_0x563a('0x29');return db[_0x563a('0x4f')]['find']({'where':{'name':_0x3c98d5,'userProfileId':_0xb1dbc8['userProfileId']},'raw':!![]})[_0x563a('0x26')](function(_0xaae9fd){if(_0xaae9fd&&_0xaae9fd[_0x563a('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x277d54[_0x563a('0x2d')],'resourceId':_0x277d54['id'],'type':_0xaae9fd[_0x563a('0x2d')],'sectionId':_0xaae9fd['id']},{})['then'](function(){return _0x23efcf;});}else{return _0x23efcf;}})['catch'](function(_0x51e142){logger[_0x563a('0x2b')](_0x563a('0x51'),_0x51e142);throw _0x51e142;});}return _0x23efcf;})[_0x563a('0x26')](respondWithResult(_0x3ea787,0xc9))[_0x563a('0x45')](handleError(_0x3ea787,null));};exports[_0x563a('0x25')]=function(_0x2805eb,_0x4dd257){if(_0x2805eb['body']['id']){delete _0x2805eb[_0x563a('0x52')]['id'];}return db['ContactItemType'][_0x563a('0x53')]({'where':{'id':_0x2805eb[_0x563a('0x47')]['id']}})[_0x563a('0x26')](handleEntityNotFound(_0x4dd257,null))[_0x563a('0x26')](saveUpdates(_0x2805eb[_0x563a('0x52')],null))[_0x563a('0x26')](respondWithResult(_0x4dd257,null))[_0x563a('0x45')](handleError(_0x4dd257,null));};exports['destroy']=function(_0x22cc91,_0x227372){return db['ContactItemType'][_0x563a('0x53')]({'where':{'id':_0x22cc91[_0x563a('0x47')]['id']}})[_0x563a('0x26')](handleEntityNotFound(_0x227372,null))[_0x563a('0x26')](db[_0x563a('0x54')][_0x563a('0x25')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x22cc91[_0x563a('0x47')]['id']}}))[_0x563a('0x26')](removeEntity(_0x227372,null))[_0x563a('0x45')](handleError(_0x227372,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 6137662..4434719 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 _0xe611=['./contactItemType.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x19ab6a,_0x11383d){var _0x3d5fdf=function(_0x4e64e8){while(--_0x4e64e8){_0x19ab6a['push'](_0x19ab6a['shift']());}};_0x3d5fdf(++_0x11383d);}(_0xe611,0x153));var _0x1e61=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xe611[_0x45d55e];return _0x29812a;};'use strict';var _=require(_0x1e61('0x0'));var util=require(_0x1e61('0x1'));var logger=require(_0x1e61('0x2'))(_0x1e61('0x3'));var moment=require(_0x1e61('0x4'));var BPromise=require(_0x1e61('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1e61('0x6'));var rimraf=require(_0x1e61('0x7'));var config=require(_0x1e61('0x8'));var attributes=require(_0x1e61('0x9'));module[_0x1e61('0xa')]=function(_0x27959e,_0x25ad42){return _0x27959e[_0x1e61('0xb')]('ContactItemType',attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba77=['define','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','exports'];(function(_0x59819e,_0x1b3f74){var _0x4f1ab2=function(_0x1c479f){while(--_0x1c479f){_0x59819e['push'](_0x59819e['shift']());}};_0x4f1ab2(++_0x1b3f74);}(_0xba77,0x121));var _0x7ba7=function(_0x284807,_0x4be925){_0x284807=_0x284807-0x0;var _0x50c774=_0xba77[_0x284807];return _0x50c774;};'use strict';var _=require(_0x7ba7('0x0'));var util=require(_0x7ba7('0x1'));var logger=require(_0x7ba7('0x2'))(_0x7ba7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7ba7('0x4'));var fs=require('fs');var path=require(_0x7ba7('0x5'));var rimraf=require(_0x7ba7('0x6'));var config=require(_0x7ba7('0x7'));var attributes=require(_0x7ba7('0x8'));module[_0x7ba7('0x9')]=function(_0x24fdde,_0x5eecfb){return _0x24fdde[_0x7ba7('0xa')](_0x7ba7('0xb'),attributes,{'tableName':_0x7ba7('0xc'),'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 bc48855..6f2fb6f 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 _0xb770=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','error','ContactItemType,\x20%s,\x20%s','message','info','result','util'];(function(_0x170bba,_0x2be92f){var _0xa7c249=function(_0x2b6505){while(--_0x2b6505){_0x170bba['push'](_0x170bba['shift']());}};_0xa7c249(++_0x2be92f);}(_0xb770,0x1e2));var _0x0b77=function(_0x3824f2,_0x197ec3){_0x3824f2=_0x3824f2-0x0;var _0x99d941=_0xb770[_0x3824f2];return _0x99d941;};'use strict';var _=require('lodash');var util=require(_0x0b77('0x0'));var moment=require(_0x0b77('0x1'));var BPromise=require(_0x0b77('0x2'));var rs=require(_0x0b77('0x3'));var fs=require('fs');var Redis=require(_0x0b77('0x4'));var db=require(_0x0b77('0x5'))['db'];var utils=require(_0x0b77('0x6'));var logger=require(_0x0b77('0x7'))(_0x0b77('0x8'));var config=require(_0x0b77('0x9'));var jayson=require(_0x0b77('0xa'));var client=jayson[_0x0b77('0xb')][_0x0b77('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x55e9b6,_0x176698,_0x5bed15){return new BPromise(function(_0x1b802a,_0x32ff80){return client[_0x0b77('0xd')](_0x55e9b6,_0x5bed15)[_0x0b77('0xe')](function(_0x2bcb59){logger['info']('ContactItemType,\x20%s,\x20%s',_0x176698,_0x0b77('0xf'));logger[_0x0b77('0x10')](_0x0b77('0x11'),_0x176698,_0x0b77('0xf'),JSON['stringify'](_0x2bcb59));if(_0x2bcb59['error']){if(_0x2bcb59[_0x0b77('0x12')]['code']===0x1f4){logger[_0x0b77('0x12')](_0x0b77('0x13'),_0x176698,_0x2bcb59[_0x0b77('0x12')][_0x0b77('0x14')]);return _0x32ff80(_0x2bcb59['error'][_0x0b77('0x14')]);}logger[_0x0b77('0x12')](_0x0b77('0x13'),_0x176698,_0x2bcb59[_0x0b77('0x12')]['message']);return _0x1b802a(_0x2bcb59['error']['message']);}else{logger[_0x0b77('0x15')]('ContactItemType,\x20%s,\x20%s',_0x176698,_0x0b77('0xf'));_0x1b802a(_0x2bcb59[_0x0b77('0x16')][_0x0b77('0x14')]);}})['catch'](function(_0x4265e9){logger[_0x0b77('0x12')](_0x0b77('0x13'),_0x176698,_0x4265e9);_0x32ff80(_0x4265e9);});});} \ No newline at end of file +var _0xebd3=['code','message','result','catch','lodash','moment','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4076bf,_0x104e12){var _0x5390ef=function(_0x5aa3c7){while(--_0x5aa3c7){_0x4076bf['push'](_0x4076bf['shift']());}};_0x5390ef(++_0x104e12);}(_0xebd3,0x194));var _0x3ebd=function(_0x49aa7d,_0x5d46d8){_0x49aa7d=_0x49aa7d-0x0;var _0xdd0d26=_0xebd3[_0x49aa7d];return _0xdd0d26;};'use strict';var _=require(_0x3ebd('0x0'));var util=require('util');var moment=require(_0x3ebd('0x1'));var BPromise=require('bluebird');var rs=require(_0x3ebd('0x2'));var fs=require('fs');var Redis=require(_0x3ebd('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3ebd('0x4'));var config=require(_0x3ebd('0x5'));var jayson=require(_0x3ebd('0x6'));var client=jayson[_0x3ebd('0x7')][_0x3ebd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xaf0f66,_0x3c1c3f,_0x163009){return new BPromise(function(_0x3981ab,_0x11034e){return client['request'](_0xaf0f66,_0x163009)[_0x3ebd('0x9')](function(_0x527525){logger[_0x3ebd('0xa')](_0x3ebd('0xb'),_0x3c1c3f,_0x3ebd('0xc'));logger['debug'](_0x3ebd('0xd'),_0x3c1c3f,'request\x20sent',JSON[_0x3ebd('0xe')](_0x527525));if(_0x527525['error']){if(_0x527525[_0x3ebd('0xf')][_0x3ebd('0x10')]===0x1f4){logger[_0x3ebd('0xf')](_0x3ebd('0xb'),_0x3c1c3f,_0x527525[_0x3ebd('0xf')]['message']);return _0x11034e(_0x527525[_0x3ebd('0xf')][_0x3ebd('0x11')]);}logger['error'](_0x3ebd('0xb'),_0x3c1c3f,_0x527525[_0x3ebd('0xf')][_0x3ebd('0x11')]);return _0x3981ab(_0x527525['error']['message']);}else{logger[_0x3ebd('0xa')]('ContactItemType,\x20%s,\x20%s',_0x3c1c3f,_0x3ebd('0xc'));_0x3981ab(_0x527525[_0x3ebd('0x12')][_0x3ebd('0x11')]);}})[_0x3ebd('0x13')](function(_0x3f6278){logger[_0x3ebd('0xf')](_0x3ebd('0xb'),_0x3c1c3f,_0x3f6278);_0x11034e(_0x3f6278);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 552c95c..f2ae4a5 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 _0x4ded=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','show','isAuthenticated','create','put','delete','/:id','destroy','exports','util'];(function(_0xf7e9df,_0x536ce1){var _0x946ab=function(_0x4a70df){while(--_0x4a70df){_0xf7e9df['push'](_0xf7e9df['shift']());}};_0x946ab(++_0x536ce1);}(_0x4ded,0x167));var _0xd4de=function(_0x2d9959,_0x51e526){_0x2d9959=_0x2d9959-0x0;var _0x23c717=_0x4ded[_0x2d9959];return _0x23c717;};'use strict';var multer=require('multer');var util=require(_0xd4de('0x0'));var path=require('path');var timeout=require(_0xd4de('0x1'));var express=require(_0xd4de('0x2'));var router=express[_0xd4de('0x3')]();var fs_extra=require(_0xd4de('0x4'));var auth=require(_0xd4de('0x5'));var interaction=require(_0xd4de('0x6'));var config=require(_0xd4de('0x7'));var controller=require(_0xd4de('0x8'));router[_0xd4de('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd4de('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xd4de('0xa')]);router['post']('/',auth[_0xd4de('0xb')](),controller[_0xd4de('0xc')]);router[_0xd4de('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd4de('0xe')](_0xd4de('0xf'),auth[_0xd4de('0xb')](),controller[_0xd4de('0x10')]);module[_0xd4de('0x11')]=router; \ No newline at end of file +var _0xe39b=['put','update','delete','destroy','exports','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./contactItemType.controller','isAuthenticated','get','/:id','create'];(function(_0x563505,_0x188901){var _0x19d7c1=function(_0x472aa0){while(--_0x472aa0){_0x563505['push'](_0x563505['shift']());}};_0x19d7c1(++_0x188901);}(_0xe39b,0xe5));var _0xbe39=function(_0x1bb100,_0x561aa7){_0x1bb100=_0x1bb100-0x0;var _0x52860d=_0xe39b[_0x1bb100];return _0x52860d;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbe39('0x0')]();var fs_extra=require(_0xbe39('0x1'));var auth=require(_0xbe39('0x2'));var interaction=require(_0xbe39('0x3'));var config=require('../../config/environment');var controller=require(_0xbe39('0x4'));router['get']('/',auth[_0xbe39('0x5')](),controller['index']);router[_0xbe39('0x6')](_0xbe39('0x7'),auth[_0xbe39('0x5')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xbe39('0x8')]);router[_0xbe39('0x9')]('/:id',auth[_0xbe39('0x5')](),controller[_0xbe39('0xa')]);router[_0xbe39('0xb')](_0xbe39('0x7'),auth[_0xbe39('0x5')](),controller[_0xbe39('0xc')]);module[_0xbe39('0xd')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 5e572c0..e7d91a1 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 _0xb10b=['name','sequelize','STRING'];(function(_0x57c8f8,_0x23bb28){var _0x3e9cde=function(_0x4bd8ba){while(--_0x4bd8ba){_0x57c8f8['push'](_0x57c8f8['shift']());}};_0x3e9cde(++_0x23bb28);}(_0xb10b,0x12a));var _0xbb10=function(_0x1d3b9d,_0xdd459c){_0x1d3b9d=_0x1d3b9d-0x0;var _0x5caef6=_0xb10b[_0x1d3b9d];return _0x5caef6;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0x42692b,_0x1bfaa8){var _0x431fbc=function(_0xc7436a){while(--_0xc7436a){_0x42692b['push'](_0x42692b['shift']());}};_0x431fbc(++_0x1bfaa8);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index f422a9b..70e7e3a 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 _0x75cd=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','index','map','Dashboard','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','UserProfileSection','type','iframe','attrUrl','value','https://','custom','attrPath','attrs','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','voice','web-report','attrReport','attrRefresh','stringify','DashboardId','DashboardItem','getItems','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x75cd,0x78));var _0xd75c=function(_0x40d3d2,_0x34a0f7){_0x40d3d2=_0x40d3d2-0x0;var _0x369e8e=_0x75cd[_0x40d3d2];return _0x369e8e;};'use strict';var emlformat=require(_0xd75c('0x0'));var rimraf=require(_0xd75c('0x1'));var zipdir=require(_0xd75c('0x2'));var jsonpatch=require(_0xd75c('0x3'));var rp=require(_0xd75c('0x4'));var moment=require(_0xd75c('0x5'));var BPromise=require(_0xd75c('0x6'));var Mustache=require(_0xd75c('0x7'));var util=require(_0xd75c('0x8'));var path=require(_0xd75c('0x9'));var sox=require(_0xd75c('0xa'));var csv=require(_0xd75c('0xb'));var ejs=require(_0xd75c('0xc'));var fs=require('fs');var fs_extra=require(_0xd75c('0xd'));var _=require(_0xd75c('0xe'));var squel=require(_0xd75c('0xf'));var crypto=require(_0xd75c('0x10'));var jsforce=require(_0xd75c('0x11'));var deskjs=require(_0xd75c('0x12'));var toCsv=require('to-csv');var querystring=require(_0xd75c('0x13'));var Papa=require(_0xd75c('0x14'));var Redis=require(_0xd75c('0x15'));var authService=require('../../components/auth/service');var qs=require(_0xd75c('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd75c('0x17'))(_0xd75c('0x18'));var utils=require('../../config/utils');var config=require(_0xd75c('0x19'));var licenseUtil=require(_0xd75c('0x1a'));var db=require(_0xd75c('0x1b'))['db'];config[_0xd75c('0x1c')]=_['defaults'](config[_0xd75c('0x1c')],{'host':_0xd75c('0x1d'),'port':0x18eb});var socket=require(_0xd75c('0x1e'))(new Redis(config[_0xd75c('0x1c')]));require(_0xd75c('0x1f'))[_0xd75c('0x20')](socket);function respondWithStatusCode(_0x21db96,_0x359d66){_0x359d66=_0x359d66||0xcc;return function(_0x251e6b){if(_0x251e6b){return _0x21db96[_0xd75c('0x21')](_0x359d66);}return _0x21db96[_0xd75c('0x22')](_0x359d66)[_0xd75c('0x23')]();};}function respondWithResult(_0x59fb4b,_0x5d1e86){_0x5d1e86=_0x5d1e86||0xc8;return function(_0x4cd6d4){if(_0x4cd6d4){return _0x59fb4b[_0xd75c('0x22')](_0x5d1e86)[_0xd75c('0x24')](_0x4cd6d4);}};}function respondWithFilteredResult(_0x370eed,_0x1e8631){return function(_0x2ac815){if(_0x2ac815){var _0x296ad8=typeof _0x1e8631[_0xd75c('0x25')]===_0xd75c('0x26')&&typeof _0x1e8631[_0xd75c('0x27')]==='undefined';var _0x1777a0=_0x2ac815[_0xd75c('0x28')];var _0x424553=_0x296ad8?0x0:_0x1e8631[_0xd75c('0x25')];var _0x363297=_0x296ad8?_0x2ac815[_0xd75c('0x28')]:_0x1e8631[_0xd75c('0x25')]+_0x1e8631[_0xd75c('0x27')];var _0x31be4b;if(_0x363297>=_0x1777a0){_0x363297=_0x1777a0;_0x31be4b=0xc8;}else{_0x31be4b=0xce;}_0x370eed[_0xd75c('0x22')](_0x31be4b);return _0x370eed[_0xd75c('0x29')](_0xd75c('0x2a'),_0x424553+'-'+_0x363297+'/'+_0x1777a0)[_0xd75c('0x24')](_0x2ac815);}return null;};}function patchUpdates(_0x26471f){return function(_0x3393d2){try{jsonpatch[_0xd75c('0x2b')](_0x3393d2,_0x26471f,!![]);}catch(_0x3ad245){return BPromise[_0xd75c('0x2c')](_0x3ad245);}return _0x3393d2[_0xd75c('0x2d')]();};}function saveUpdates(_0x42ce2e,_0x504330){return function(_0x1b7185){if(_0x1b7185){return _0x1b7185[_0xd75c('0x2e')](_0x42ce2e)[_0xd75c('0x2f')](function(_0x1f89a2){return _0x1f89a2;});}return null;};}function removeEntity(_0x446132,_0x3a4b1e){return function(_0x1bf39e){if(_0x1bf39e){return _0x1bf39e[_0xd75c('0x30')]()[_0xd75c('0x2f')](function(){var _0x20b91f=_0x1bf39e[_0xd75c('0x31')]({'plain':!![]});var _0x16a803=_0xd75c('0x32');return db[_0xd75c('0x33')]['destroy']({'where':{'type':_0x16a803,'resourceId':_0x20b91f['id']}})[_0xd75c('0x2f')](function(){return _0x1bf39e;});})[_0xd75c('0x2f')](function(){_0x446132[_0xd75c('0x22')](0xcc)[_0xd75c('0x23')]();});}};}function handleEntityNotFound(_0x258045,_0x564a74){return function(_0x1e7d54){if(!_0x1e7d54){_0x258045[_0xd75c('0x21')](0x194);}return _0x1e7d54;};}function handleError(_0xc52303,_0x18e7ff){_0x18e7ff=_0x18e7ff||0x1f4;return function(_0x52eb68){logger[_0xd75c('0x34')](_0x52eb68[_0xd75c('0x35')]);if(_0x52eb68['name']){delete _0x52eb68[_0xd75c('0x36')];}_0xc52303[_0xd75c('0x22')](_0x18e7ff)['send'](_0x52eb68);};}exports[_0xd75c('0x37')]=function(_0x53fbfa,_0x483a77){var _0x48b831={},_0x3ae868={},_0x2dcc29={'count':0x0,'rows':[]};var _0x283593=_[_0xd75c('0x38')](db[_0xd75c('0x39')][_0xd75c('0x3a')],function(_0x48608b){return{'name':_0x48608b[_0xd75c('0x3b')],'type':_0x48608b['type']['key']};});_0x3ae868[_0xd75c('0x3c')]=_[_0xd75c('0x38')](_0x283593,'name');_0x3ae868[_0xd75c('0x3d')]=_[_0xd75c('0x3e')](_0x53fbfa['query']);_0x3ae868[_0xd75c('0x3f')]=_[_0xd75c('0x40')](_0x3ae868[_0xd75c('0x3c')],_0x3ae868[_0xd75c('0x3d')]);_0x48b831[_0xd75c('0x41')]=_[_0xd75c('0x40')](_0x3ae868[_0xd75c('0x3c')],qs['fields'](_0x53fbfa[_0xd75c('0x3d')][_0xd75c('0x42')]));_0x48b831[_0xd75c('0x41')]=_0x48b831['attributes'][_0xd75c('0x43')]?_0x48b831['attributes']:_0x3ae868[_0xd75c('0x3c')];if(!_0x53fbfa[_0xd75c('0x3d')]['hasOwnProperty'](_0xd75c('0x44'))){_0x48b831[_0xd75c('0x27')]=qs[_0xd75c('0x27')](_0x53fbfa[_0xd75c('0x3d')][_0xd75c('0x27')]);_0x48b831[_0xd75c('0x25')]=qs[_0xd75c('0x25')](_0x53fbfa[_0xd75c('0x3d')][_0xd75c('0x25')]);}_0x48b831[_0xd75c('0x45')]=qs[_0xd75c('0x46')](_0x53fbfa[_0xd75c('0x3d')][_0xd75c('0x46')]);_0x48b831[_0xd75c('0x47')]=qs[_0xd75c('0x3f')](_[_0xd75c('0x48')](_0x53fbfa['query'],_0x3ae868[_0xd75c('0x3f')]),_0x283593);if(_0x53fbfa[_0xd75c('0x3d')][_0xd75c('0x49')]){_0x48b831[_0xd75c('0x47')]=_['merge'](_0x48b831[_0xd75c('0x47')],{'$or':_[_0xd75c('0x38')](_0x283593,function(_0x4c154f){if(_0x4c154f['type']!==_0xd75c('0x4a')){var _0x26be79={};_0x26be79[_0x4c154f[_0xd75c('0x36')]]={'$like':'%'+_0x53fbfa[_0xd75c('0x3d')][_0xd75c('0x49')]+'%'};return _0x26be79;}})});}_0x48b831=_[_0xd75c('0x4b')]({},_0x48b831,_0x53fbfa[_0xd75c('0x4c')]);var _0x40b8a1={'where':_0x48b831[_0xd75c('0x47')]};return db[_0xd75c('0x39')][_0xd75c('0x28')](_0x40b8a1)['then'](function(_0x5aa863){_0x2dcc29['count']=_0x5aa863;if(_0x53fbfa[_0xd75c('0x3d')][_0xd75c('0x4d')]){_0x48b831[_0xd75c('0x4e')]=[{'all':!![]}];}return db[_0xd75c('0x39')][_0xd75c('0x4f')](_0x48b831);})[_0xd75c('0x2f')](function(_0x221fc8){_0x2dcc29[_0xd75c('0x50')]=_0x221fc8;return _0x2dcc29;})['then'](respondWithFilteredResult(_0x483a77,_0x48b831))[_0xd75c('0x51')](handleError(_0x483a77,null));};exports[_0xd75c('0x52')]=function(_0x91374d,_0xcb1ca5){var _0x94a021={'raw':![],'where':{'id':_0x91374d[_0xd75c('0x53')]['id']}},_0x5ab5db={};_0x5ab5db[_0xd75c('0x3c')]=_['keys'](db[_0xd75c('0x39')]['rawAttributes']);_0x5ab5db[_0xd75c('0x3d')]=_[_0xd75c('0x3e')](_0x91374d[_0xd75c('0x3d')]);_0x5ab5db['filters']=_[_0xd75c('0x40')](_0x5ab5db['model'],_0x5ab5db[_0xd75c('0x3d')]);_0x94a021['attributes']=_[_0xd75c('0x40')](_0x5ab5db[_0xd75c('0x3c')],qs[_0xd75c('0x42')](_0x91374d['query']['fields']));_0x94a021[_0xd75c('0x41')]=_0x94a021[_0xd75c('0x41')][_0xd75c('0x43')]?_0x94a021[_0xd75c('0x41')]:_0x5ab5db[_0xd75c('0x3c')];if(_0x91374d['query']['includeAll']){_0x94a021[_0xd75c('0x4e')]=[{'all':!![]}];}_0x94a021=_['merge']({},_0x94a021,_0x91374d['options']);return db[_0xd75c('0x39')][_0xd75c('0x54')](_0x94a021)[_0xd75c('0x2f')](handleEntityNotFound(_0xcb1ca5,null))[_0xd75c('0x2f')](respondWithResult(_0xcb1ca5,null))['catch'](handleError(_0xcb1ca5,null));};exports['create']=function(_0x2a3d1a,_0x102724){return db[_0xd75c('0x39')][_0xd75c('0x55')](_0x2a3d1a[_0xd75c('0x56')],{})[_0xd75c('0x2f')](function(_0x38b964){var _0x29e7b0=_0x2a3d1a[_0xd75c('0x57')][_0xd75c('0x31')]({'plain':!![]});if(!_0x29e7b0)throw new Error(_0xd75c('0x58'));if(_0x29e7b0[_0xd75c('0x59')]==='user'){var _0x271318=_0x38b964[_0xd75c('0x31')]({'plain':!![]});var _0x2dc14e='CustomDashboards';return db['UserProfileSection']['find']({'where':{'name':_0x2dc14e,'userProfileId':_0x29e7b0[_0xd75c('0x5a')]},'raw':!![]})[_0xd75c('0x2f')](function(_0x2da900){if(_0x2da900&&_0x2da900[_0xd75c('0x5b')]===0x0){return db[_0xd75c('0x33')]['create']({'name':_0x271318[_0xd75c('0x36')],'resourceId':_0x271318['id'],'type':_0x2da900['name'],'sectionId':_0x2da900['id']},{})['then'](function(){return _0x38b964;});}else{return _0x38b964;}})[_0xd75c('0x51')](function(_0x304a69){logger[_0xd75c('0x34')](_0xd75c('0x5c'),_0x304a69);throw _0x304a69;});}return _0x38b964;})['then'](respondWithResult(_0x102724,0xc9))[_0xd75c('0x51')](handleError(_0x102724,null));};exports[_0xd75c('0x5d')]=function(_0x12ea9c,_0x554380){var _0x3af3c1={'where':{'id':_0x12ea9c['params']['id']}},_0x263951={};_0x263951[_0xd75c('0x3c')]=_[_0xd75c('0x3e')](db[_0xd75c('0x39')][_0xd75c('0x3a')]);_0x3af3c1['attributes']=_[_0xd75c('0x40')](_0x263951[_0xd75c('0x3c')],qs['fields'](_0x12ea9c[_0xd75c('0x3d')][_0xd75c('0x42')]));_0x3af3c1['attributes']=_0x3af3c1[_0xd75c('0x41')][_0xd75c('0x43')]?_0x3af3c1[_0xd75c('0x41')]:_0x263951[_0xd75c('0x3c')];if(_0x12ea9c[_0xd75c('0x3d')]['includeAll']){_0x3af3c1[_0xd75c('0x4e')]=[{'all':!![]}];}_0x3af3c1=_[_0xd75c('0x4b')]({},_0x3af3c1,_0x12ea9c[_0xd75c('0x4c')]);return db[_0xd75c('0x39')][_0xd75c('0x54')](_0x3af3c1)[_0xd75c('0x2f')](handleEntityNotFound(_0x554380,null))[_0xd75c('0x2f')](function(_0x16f165){if(_0x16f165){var _0x2a1427=_0x16f165['get']({'plain':!![]});_0x2a1427=qs[_0xd75c('0x5e')](_0x2a1427,['id',_0xd75c('0x5f'),_0xd75c('0x60')]);_0x12ea9c[_0xd75c('0x56')]=_[_0xd75c('0x5e')](_0x12ea9c[_0xd75c('0x56')],['id',_0xd75c('0x5f'),_0xd75c('0x60')]);return db[_0xd75c('0x39')][_0xd75c('0x55')](_[_0xd75c('0x4b')](_0x2a1427,_0x12ea9c[_0xd75c('0x56')]),{'include':_0x12ea9c['query'][_0xd75c('0x4d')]?[{'all':!![]}]:undefined})[_0xd75c('0x2f')](function(_0x27cc2c){var _0xba8917=_0x12ea9c[_0xd75c('0x57')]['get']({'plain':!![]});if(!_0xba8917)throw new Error(_0xd75c('0x58'));if(_0xba8917[_0xd75c('0x59')]===_0xd75c('0x57')){var _0x55ba31=_0x27cc2c['get']({'plain':!![]});var _0x25ed0e=_0xd75c('0x32');return db[_0xd75c('0x61')][_0xd75c('0x54')]({'where':{'name':_0x25ed0e,'userProfileId':_0xba8917['userProfileId']},'raw':!![]})[_0xd75c('0x2f')](function(_0x20baf9){if(_0x20baf9&&_0x20baf9[_0xd75c('0x5b')]===0x0){return db['UserProfileResource'][_0xd75c('0x55')]({'name':_0x55ba31[_0xd75c('0x36')],'resourceId':_0x55ba31['id'],'type':_0x20baf9[_0xd75c('0x36')],'sectionId':_0x20baf9['id']},{})[_0xd75c('0x2f')](function(){return _0x27cc2c;});}else{return _0x27cc2c;}})[_0xd75c('0x51')](function(_0x3fd774){logger['error'](_0xd75c('0x5c'),_0x3fd774);throw _0x3fd774;});}return _0x27cc2c;});}})[_0xd75c('0x2f')](respondWithResult(_0x554380,0xc9))[_0xd75c('0x51')](handleError(_0x554380,null));};exports['update']=function(_0x291152,_0x282d84){if(_0x291152[_0xd75c('0x56')]['id']){delete _0x291152['body']['id'];}return db[_0xd75c('0x39')]['find']({'where':{'id':_0x291152['params']['id']}})[_0xd75c('0x2f')](handleEntityNotFound(_0x282d84,null))[_0xd75c('0x2f')](saveUpdates(_0x291152[_0xd75c('0x56')],null))[_0xd75c('0x2f')](respondWithResult(_0x282d84,null))[_0xd75c('0x51')](handleError(_0x282d84,null));};exports[_0xd75c('0x30')]=function(_0x590ed0,_0x376b0f){return db['Dashboard'][_0xd75c('0x54')]({'where':{'id':_0x590ed0['params']['id']}})[_0xd75c('0x2f')](handleEntityNotFound(_0x376b0f,null))[_0xd75c('0x2f')](removeEntity(_0x376b0f,null))['catch'](handleError(_0x376b0f,null));};function widgetAttributes(_0x477c7b){try{switch(_0x477c7b[_0xd75c('0x62')]){case _0xd75c('0x63'):return[{'name':_0xd75c('0x64'),'value':_0x477c7b['attrUrl']||(_0x477c7b['attrs']&&_0x477c7b['attrs'][0x0]?_0x477c7b['attrs'][0x0][_0xd75c('0x65')]:undefined)||_0xd75c('0x66')}];case _0xd75c('0x67'):return[{'name':_0xd75c('0x68'),'value':_0x477c7b[_0xd75c('0x68')]||(_0x477c7b[_0xd75c('0x69')]&&_0x477c7b[_0xd75c('0x69')][0x0]?_0x477c7b[_0xd75c('0x69')][0x0]['value']:undefined)||''}];case _0xd75c('0x6a'):return[{'name':_0xd75c('0x6b'),'value':_0x477c7b['attrHourFormat']||(_0x477c7b[_0xd75c('0x69')]&&_0x477c7b[_0xd75c('0x69')][0x0]?_0x477c7b[_0xd75c('0x69')][0x0][_0xd75c('0x65')]:undefined)||'HH:mm:ss'},{'name':_0xd75c('0x6c'),'value':_0x477c7b[_0xd75c('0x6c')]||(_0x477c7b[_0xd75c('0x69')]&&_0x477c7b[_0xd75c('0x69')][0x1]?_0x477c7b['attrs'][0x1]['value']:undefined)||_0xd75c('0x6d')},{'name':'attrFontSize','value':_0x477c7b[_0xd75c('0x6e')]||(_0x477c7b[_0xd75c('0x69')]&&_0x477c7b[_0xd75c('0x69')][0x2]?_0x477c7b[_0xd75c('0x69')][0x2][_0xd75c('0x65')]:undefined)||0xc}];case _0xd75c('0x6f'):return[{'name':_0xd75c('0x70'),'value':_0x477c7b[_0xd75c('0x70')]||(_0x477c7b[_0xd75c('0x69')]&&_0x477c7b[_0xd75c('0x69')][0x0]?_0x477c7b[_0xd75c('0x69')][0x0][_0xd75c('0x65')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x477c7b[_0xd75c('0x71')]||(_0x477c7b['attrs']&&_0x477c7b[_0xd75c('0x69')][0x1]?_0x477c7b['attrs'][0x1][_0xd75c('0x65')]:undefined)||[]},{'name':_0xd75c('0x6e'),'value':_0x477c7b[_0xd75c('0x6e')]||(_0x477c7b[_0xd75c('0x69')]&&_0x477c7b[_0xd75c('0x69')][0x2]?_0x477c7b[_0xd75c('0x69')][0x2][_0xd75c('0x65')]:undefined)||0x14},{'name':_0xd75c('0x72'),'value':_0x477c7b['attrChannel']||(_0x477c7b[_0xd75c('0x69')]&&_0x477c7b[_0xd75c('0x69')][0x3]?_0x477c7b[_0xd75c('0x69')][0x3][_0xd75c('0x65')]:undefined)||'voice'},{'name':_0xd75c('0x73'),'value':_0x477c7b[_0xd75c('0x73')]||(_0x477c7b[_0xd75c('0x69')]&&_0x477c7b[_0xd75c('0x69')][0x4]?_0x477c7b[_0xd75c('0x69')][0x4]['value']:undefined)||''},{'name':_0xd75c('0x74'),'value':_0x477c7b[_0xd75c('0x74')]||(_0x477c7b[_0xd75c('0x69')]&&_0x477c7b[_0xd75c('0x69')][0x5]?_0x477c7b[_0xd75c('0x69')][0x5]['value']:undefined)||''},{'name':_0xd75c('0x75'),'value':_0x477c7b[_0xd75c('0x75')]||(_0x477c7b[_0xd75c('0x69')]&&_0x477c7b['attrs'][0x6]?_0x477c7b[_0xd75c('0x69')][0x6][_0xd75c('0x65')]:undefined)||''},{'name':_0xd75c('0x76'),'value':_0x477c7b[_0xd75c('0x76')]||(_0x477c7b[_0xd75c('0x69')]&&_0x477c7b[_0xd75c('0x69')][0x7]?_0x477c7b[_0xd75c('0x69')][0x7][_0xd75c('0x65')]:undefined)||''},{'name':_0xd75c('0x77'),'value':_0x477c7b[_0xd75c('0x77')]||(_0x477c7b[_0xd75c('0x69')]&&_0x477c7b['attrs'][0x8]?_0x477c7b[_0xd75c('0x69')][0x8][_0xd75c('0x65')]:undefined)||''},{'name':'attrChatWebsites','value':_0x477c7b[_0xd75c('0x78')]||(_0x477c7b[_0xd75c('0x69')]&&_0x477c7b['attrs'][0x9]?_0x477c7b[_0xd75c('0x69')][0x9][_0xd75c('0x65')]:undefined)||''}];case'multibar-chart':case _0xd75c('0x79'):return[{'name':_0xd75c('0x7a'),'value':_0x477c7b[_0xd75c('0x7a')]||(_0x477c7b['attrs']&&_0x477c7b[_0xd75c('0x69')][0x0]?_0x477c7b['attrs'][0x0][_0xd75c('0x65')]:undefined)||_0xd75c('0x7b')},{'name':'attrSerie2','value':_0x477c7b[_0xd75c('0x7c')]||(_0x477c7b[_0xd75c('0x69')]&&_0x477c7b[_0xd75c('0x69')][0x1]?_0x477c7b[_0xd75c('0x69')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x477c7b[_0xd75c('0x7d')]||(_0x477c7b[_0xd75c('0x69')]&&_0x477c7b[_0xd75c('0x69')][0x2]?_0x477c7b[_0xd75c('0x69')][0x2][_0xd75c('0x65')]:undefined)||null},{'name':_0xd75c('0x71'),'value':_0x477c7b[_0xd75c('0x71')]||(_0x477c7b['attrs']&&_0x477c7b['attrs'][0x3]?_0x477c7b[_0xd75c('0x69')][0x3][_0xd75c('0x65')]:undefined)||[]},{'name':'attrChannel','value':_0x477c7b[_0xd75c('0x72')]||(_0x477c7b['attrs']&&_0x477c7b[_0xd75c('0x69')][0x4]?_0x477c7b[_0xd75c('0x69')][0x4][_0xd75c('0x65')]:undefined)||_0xd75c('0x7e')},{'name':_0xd75c('0x73'),'value':_0x477c7b[_0xd75c('0x73')]||(_0x477c7b[_0xd75c('0x69')]&&_0x477c7b['attrs'][0x5]?_0x477c7b[_0xd75c('0x69')][0x5][_0xd75c('0x65')]:undefined)||''},{'name':_0xd75c('0x74'),'value':_0x477c7b[_0xd75c('0x74')]||(_0x477c7b[_0xd75c('0x69')]&&_0x477c7b['attrs'][0x6]?_0x477c7b[_0xd75c('0x69')][0x6][_0xd75c('0x65')]:undefined)||''},{'name':_0xd75c('0x75'),'value':_0x477c7b[_0xd75c('0x75')]||(_0x477c7b[_0xd75c('0x69')]&&_0x477c7b['attrs'][0x7]?_0x477c7b[_0xd75c('0x69')][0x7]['value']:undefined)||''},{'name':_0xd75c('0x76'),'value':_0x477c7b[_0xd75c('0x76')]||(_0x477c7b[_0xd75c('0x69')]&&_0x477c7b[_0xd75c('0x69')][0x8]?_0x477c7b[_0xd75c('0x69')][0x8]['value']:undefined)||''},{'name':_0xd75c('0x77'),'value':_0x477c7b[_0xd75c('0x77')]||(_0x477c7b['attrs']&&_0x477c7b[_0xd75c('0x69')][0x9]?_0x477c7b[_0xd75c('0x69')][0x9]['value']:undefined)||''},{'name':_0xd75c('0x78'),'value':_0x477c7b[_0xd75c('0x78')]||(_0x477c7b['attrs']&&_0x477c7b[_0xd75c('0x69')][0xa]?_0x477c7b[_0xd75c('0x69')][0xa][_0xd75c('0x65')]:undefined)||''}];case _0xd75c('0x7f'):return[{'name':'attrReport','type':_0x477c7b['reportType']||(_0x477c7b[_0xd75c('0x69')]&&_0x477c7b[_0xd75c('0x69')][0x0]?_0x477c7b[_0xd75c('0x69')][0x0]['type']:undefined)||null,'value':_0x477c7b[_0xd75c('0x80')]||(_0x477c7b['attrs']&&_0x477c7b[_0xd75c('0x69')][0x0]?_0x477c7b[_0xd75c('0x69')][0x0][_0xd75c('0x65')]:undefined)||null},{'name':_0xd75c('0x81'),'value':_0x477c7b['attrRefresh']||(_0x477c7b[_0xd75c('0x69')]&&_0x477c7b[_0xd75c('0x69')][0x1]?_0x477c7b[_0xd75c('0x69')][0x1][_0xd75c('0x65')]:undefined)||0x0}];default:return[];}}catch(_0x4bb22d){logger[_0xd75c('0x34')]('widgetAttributes:\x20%s',JSON[_0xd75c('0x82')](_0x4bb22d));return[];}}exports['addItem']=function(_0x321224,_0x451f1c,_0x5c2bff){if(_0x321224[_0xd75c('0x56')]['id']){delete _0x321224[_0xd75c('0x56')]['id'];}return db['Dashboard'][_0xd75c('0x54')]({'where':{'id':_0x321224[_0xd75c('0x53')]['id']}})[_0xd75c('0x2f')](handleEntityNotFound(_0x451f1c,null))['then'](function(_0x59a984){if(_0x59a984){_0x321224[_0xd75c('0x56')][_0xd75c('0x83')]=_0x59a984['id'];_0x321224[_0xd75c('0x56')][_0xd75c('0x69')]=widgetAttributes(_0x321224[_0xd75c('0x56')]);return db[_0xd75c('0x84')]['create'](_0x321224['body']);}})['then'](respondWithResult(_0x451f1c,null))[_0xd75c('0x51')](handleError(_0x451f1c,null));};exports[_0xd75c('0x85')]=function(_0x54388c,_0x1c5738,_0x1e2c93){var _0x5c5ecd={};var _0x5018ae={};var _0x247102;var _0x300b0f;return db[_0xd75c('0x39')][_0xd75c('0x86')]({'where':{'id':_0x54388c['params']['id']}})[_0xd75c('0x2f')](handleEntityNotFound(_0x1c5738,null))[_0xd75c('0x2f')](function(_0x5c0c80){if(_0x5c0c80){_0x247102=_0x5c0c80;_0x5018ae[_0xd75c('0x3c')]=_[_0xd75c('0x3e')](db[_0xd75c('0x84')]['rawAttributes']);_0x5018ae[_0xd75c('0x3d')]=_['keys'](_0x54388c[_0xd75c('0x3d')]);_0x5018ae[_0xd75c('0x3f')]=_[_0xd75c('0x40')](_0x5018ae[_0xd75c('0x3c')],_0x5018ae[_0xd75c('0x3d')]);_0x5c5ecd['attributes']=_['intersection'](_0x5018ae[_0xd75c('0x3c')],qs[_0xd75c('0x42')](_0x54388c['query'][_0xd75c('0x42')]));_0x5c5ecd['attributes']=_0x5c5ecd[_0xd75c('0x41')][_0xd75c('0x43')]?_0x5c5ecd[_0xd75c('0x41')]:_0x5018ae[_0xd75c('0x3c')];_0x5c5ecd[_0xd75c('0x45')]=qs['sort'](_0x54388c[_0xd75c('0x3d')][_0xd75c('0x46')]);_0x5c5ecd[_0xd75c('0x47')]=qs[_0xd75c('0x3f')](_[_0xd75c('0x48')](_0x54388c[_0xd75c('0x3d')],_0x5018ae['filters']));if(_0x54388c[_0xd75c('0x3d')][_0xd75c('0x49')]){_0x5c5ecd[_0xd75c('0x47')]=_[_0xd75c('0x4b')](_0x5c5ecd[_0xd75c('0x47')],{'$or':_[_0xd75c('0x38')](_0x5c5ecd[_0xd75c('0x41')],function(_0x579301){var _0x2dde34={};_0x2dde34[_0x579301]={'$like':'%'+_0x54388c[_0xd75c('0x3d')][_0xd75c('0x49')]+'%'};return _0x2dde34;})});}_0x5c5ecd=_[_0xd75c('0x4b')]({},_0x5c5ecd,_0x54388c[_0xd75c('0x4c')]);return _0x247102[_0xd75c('0x85')](_0x5c5ecd);}})['then'](function(_0x45f81e){if(_0x45f81e){_0x300b0f=_0x45f81e[_0xd75c('0x43')];if(!_0x54388c[_0xd75c('0x3d')]['hasOwnProperty']('nolimit')){_0x5c5ecd[_0xd75c('0x27')]=qs[_0xd75c('0x27')](_0x54388c['query']['limit']);_0x5c5ecd[_0xd75c('0x25')]=qs[_0xd75c('0x25')](_0x54388c[_0xd75c('0x3d')]['offset']);}return _0x247102[_0xd75c('0x85')](_0x5c5ecd);}})[_0xd75c('0x2f')](function(_0x46060d){if(_0x46060d){return _0x46060d?{'count':_0x300b0f,'rows':_0x46060d}:null;}})[_0xd75c('0x2f')](respondWithResult(_0x1c5738,null))[_0xd75c('0x51')](handleError(_0x1c5738,null));}; \ No newline at end of file +var _0x41e4=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','then','get','UserProfileResource','destroy','error','name','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','Dashboard','includeAll','include','findAll','rows','catch','show','params','keys','length','find','body','user','role','CustomDashboards','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','update','attrUrl','attrs','value','https://','attrPath','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrOpenchannelAccounts','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','limit','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x41e4,0x6d));var _0x441e=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x41e4[_0x4d613c];return _0x301fe3;};'use strict';var emlformat=require(_0x441e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x441e('0x1'));var jsonpatch=require(_0x441e('0x2'));var rp=require(_0x441e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x441e('0x4'));var util=require(_0x441e('0x5'));var path=require('path');var sox=require(_0x441e('0x6'));var csv=require(_0x441e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x441e('0x8'));var _=require(_0x441e('0x9'));var squel=require(_0x441e('0xa'));var crypto=require(_0x441e('0xb'));var jsforce=require(_0x441e('0xc'));var deskjs=require(_0x441e('0xd'));var toCsv=require('to-csv');var querystring=require(_0x441e('0xe'));var Papa=require(_0x441e('0xf'));var Redis=require(_0x441e('0x10'));var authService=require(_0x441e('0x11'));var qs=require(_0x441e('0x12'));var as=require(_0x441e('0x13'));var hardwareService=require(_0x441e('0x14'));var logger=require('../../config/logger')(_0x441e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x441e('0x16'))['db'];config[_0x441e('0x17')]=_[_0x441e('0x18')](config[_0x441e('0x17')],{'host':_0x441e('0x19'),'port':0x18eb});var socket=require(_0x441e('0x1a'))(new Redis(config['redis']));require('./dashboard.socket')[_0x441e('0x1b')](socket);function respondWithStatusCode(_0x2d06a3,_0x1ab430){_0x1ab430=_0x1ab430||0xcc;return function(_0x430005){if(_0x430005){return _0x2d06a3[_0x441e('0x1c')](_0x1ab430);}return _0x2d06a3[_0x441e('0x1d')](_0x1ab430)[_0x441e('0x1e')]();};}function respondWithResult(_0x558481,_0x447848){_0x447848=_0x447848||0xc8;return function(_0x319a71){if(_0x319a71){return _0x558481[_0x441e('0x1d')](_0x447848)[_0x441e('0x1f')](_0x319a71);}};}function respondWithFilteredResult(_0x3e7671,_0x5196bd){return function(_0x4cc3ee){if(_0x4cc3ee){var _0x11e31c=typeof _0x5196bd[_0x441e('0x20')]===_0x441e('0x21')&&typeof _0x5196bd['limit']===_0x441e('0x21');var _0xf978dd=_0x4cc3ee[_0x441e('0x22')];var _0xe1fac8=_0x11e31c?0x0:_0x5196bd[_0x441e('0x20')];var _0x436659=_0x11e31c?_0x4cc3ee[_0x441e('0x22')]:_0x5196bd[_0x441e('0x20')]+_0x5196bd['limit'];var _0x5e875c;if(_0x436659>=_0xf978dd){_0x436659=_0xf978dd;_0x5e875c=0xc8;}else{_0x5e875c=0xce;}_0x3e7671[_0x441e('0x1d')](_0x5e875c);return _0x3e7671[_0x441e('0x23')](_0x441e('0x24'),_0xe1fac8+'-'+_0x436659+'/'+_0xf978dd)['json'](_0x4cc3ee);}return null;};}function patchUpdates(_0x26b77a){return function(_0xc7e021){try{jsonpatch[_0x441e('0x25')](_0xc7e021,_0x26b77a,!![]);}catch(_0x2d8127){return BPromise[_0x441e('0x26')](_0x2d8127);}return _0xc7e021['save']();};}function saveUpdates(_0x4df6d5,_0x3a133a){return function(_0x45ee57){if(_0x45ee57){return _0x45ee57['update'](_0x4df6d5)[_0x441e('0x27')](function(_0x189926){return _0x189926;});}return null;};}function removeEntity(_0x206789,_0xc74c8){return function(_0x54c838){if(_0x54c838){return _0x54c838['destroy']()[_0x441e('0x27')](function(){var _0x38021f=_0x54c838[_0x441e('0x28')]({'plain':!![]});var _0x20739b='CustomDashboards';return db[_0x441e('0x29')][_0x441e('0x2a')]({'where':{'type':_0x20739b,'resourceId':_0x38021f['id']}})['then'](function(){return _0x54c838;});})[_0x441e('0x27')](function(){_0x206789[_0x441e('0x1d')](0xcc)[_0x441e('0x1e')]();});}};}function handleEntityNotFound(_0x51726d,_0x4ce6cf){return function(_0x44af82){if(!_0x44af82){_0x51726d[_0x441e('0x1c')](0x194);}return _0x44af82;};}function handleError(_0x53e9ea,_0x19ad8c){_0x19ad8c=_0x19ad8c||0x1f4;return function(_0x21ea5a){logger[_0x441e('0x2b')](_0x21ea5a['stack']);if(_0x21ea5a[_0x441e('0x2c')]){delete _0x21ea5a[_0x441e('0x2c')];}_0x53e9ea[_0x441e('0x1d')](_0x19ad8c)['send'](_0x21ea5a);};}exports['index']=function(_0x3fa884,_0x3ee7d3){var _0x3f0ee3={},_0xfc9b75={},_0x5df72c={'count':0x0,'rows':[]};var _0x4149af=_[_0x441e('0x2d')](db['Dashboard'][_0x441e('0x2e')],function(_0x42155c){return{'name':_0x42155c[_0x441e('0x2f')],'type':_0x42155c[_0x441e('0x30')][_0x441e('0x31')]};});_0xfc9b75[_0x441e('0x32')]=_['map'](_0x4149af,'name');_0xfc9b75[_0x441e('0x33')]=_['keys'](_0x3fa884['query']);_0xfc9b75[_0x441e('0x34')]=_['intersection'](_0xfc9b75['model'],_0xfc9b75[_0x441e('0x33')]);_0x3f0ee3[_0x441e('0x35')]=_[_0x441e('0x36')](_0xfc9b75[_0x441e('0x32')],qs[_0x441e('0x37')](_0x3fa884[_0x441e('0x33')][_0x441e('0x37')]));_0x3f0ee3[_0x441e('0x35')]=_0x3f0ee3[_0x441e('0x35')]['length']?_0x3f0ee3[_0x441e('0x35')]:_0xfc9b75['model'];if(!_0x3fa884['query'][_0x441e('0x38')](_0x441e('0x39'))){_0x3f0ee3['limit']=qs['limit'](_0x3fa884['query']['limit']);_0x3f0ee3[_0x441e('0x20')]=qs[_0x441e('0x20')](_0x3fa884[_0x441e('0x33')]['offset']);}_0x3f0ee3[_0x441e('0x3a')]=qs['sort'](_0x3fa884['query'][_0x441e('0x3b')]);_0x3f0ee3[_0x441e('0x3c')]=qs[_0x441e('0x34')](_[_0x441e('0x3d')](_0x3fa884[_0x441e('0x33')],_0xfc9b75[_0x441e('0x34')]),_0x4149af);if(_0x3fa884['query']['filter']){_0x3f0ee3[_0x441e('0x3c')]=_['merge'](_0x3f0ee3['where'],{'$or':_[_0x441e('0x2d')](_0x4149af,function(_0x154303){if(_0x154303[_0x441e('0x30')]!==_0x441e('0x3e')){var _0x4ab2ba={};_0x4ab2ba[_0x154303[_0x441e('0x2c')]]={'$like':'%'+_0x3fa884[_0x441e('0x33')][_0x441e('0x3f')]+'%'};return _0x4ab2ba;}})});}_0x3f0ee3=_[_0x441e('0x40')]({},_0x3f0ee3,_0x3fa884[_0x441e('0x41')]);var _0x2f18b0={'where':_0x3f0ee3[_0x441e('0x3c')]};return db[_0x441e('0x42')][_0x441e('0x22')](_0x2f18b0)[_0x441e('0x27')](function(_0x1d6b86){_0x5df72c[_0x441e('0x22')]=_0x1d6b86;if(_0x3fa884[_0x441e('0x33')][_0x441e('0x43')]){_0x3f0ee3[_0x441e('0x44')]=[{'all':!![]}];}return db[_0x441e('0x42')][_0x441e('0x45')](_0x3f0ee3);})[_0x441e('0x27')](function(_0x2e73fa){_0x5df72c[_0x441e('0x46')]=_0x2e73fa;return _0x5df72c;})[_0x441e('0x27')](respondWithFilteredResult(_0x3ee7d3,_0x3f0ee3))[_0x441e('0x47')](handleError(_0x3ee7d3,null));};exports[_0x441e('0x48')]=function(_0x24641e,_0x2a6d2a){var _0x294578={'raw':![],'where':{'id':_0x24641e[_0x441e('0x49')]['id']}},_0x10cd03={};_0x10cd03[_0x441e('0x32')]=_[_0x441e('0x4a')](db['Dashboard'][_0x441e('0x2e')]);_0x10cd03[_0x441e('0x33')]=_[_0x441e('0x4a')](_0x24641e[_0x441e('0x33')]);_0x10cd03[_0x441e('0x34')]=_[_0x441e('0x36')](_0x10cd03[_0x441e('0x32')],_0x10cd03['query']);_0x294578['attributes']=_[_0x441e('0x36')](_0x10cd03['model'],qs[_0x441e('0x37')](_0x24641e[_0x441e('0x33')][_0x441e('0x37')]));_0x294578[_0x441e('0x35')]=_0x294578[_0x441e('0x35')][_0x441e('0x4b')]?_0x294578[_0x441e('0x35')]:_0x10cd03[_0x441e('0x32')];if(_0x24641e['query'][_0x441e('0x43')]){_0x294578['include']=[{'all':!![]}];}_0x294578=_['merge']({},_0x294578,_0x24641e[_0x441e('0x41')]);return db['Dashboard'][_0x441e('0x4c')](_0x294578)[_0x441e('0x27')](handleEntityNotFound(_0x2a6d2a,null))[_0x441e('0x27')](respondWithResult(_0x2a6d2a,null))[_0x441e('0x47')](handleError(_0x2a6d2a,null));};exports['create']=function(_0x23eb8f,_0x4adb4a){return db[_0x441e('0x42')]['create'](_0x23eb8f[_0x441e('0x4d')],{})[_0x441e('0x27')](function(_0x416d57){var _0x3f650d=_0x23eb8f[_0x441e('0x4e')][_0x441e('0x28')]({'plain':!![]});if(!_0x3f650d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f650d[_0x441e('0x4f')]===_0x441e('0x4e')){var _0x3873f6=_0x416d57[_0x441e('0x28')]({'plain':!![]});var _0x300b4e=_0x441e('0x50');return db[_0x441e('0x51')][_0x441e('0x4c')]({'where':{'name':_0x300b4e,'userProfileId':_0x3f650d[_0x441e('0x52')]},'raw':!![]})[_0x441e('0x27')](function(_0x1f16a6){if(_0x1f16a6&&_0x1f16a6['autoAssociation']===0x0){return db[_0x441e('0x29')]['create']({'name':_0x3873f6[_0x441e('0x2c')],'resourceId':_0x3873f6['id'],'type':_0x1f16a6['name'],'sectionId':_0x1f16a6['id']},{})[_0x441e('0x27')](function(){return _0x416d57;});}else{return _0x416d57;}})['catch'](function(_0x471280){logger[_0x441e('0x2b')](_0x441e('0x53'),_0x471280);throw _0x471280;});}return _0x416d57;})[_0x441e('0x27')](respondWithResult(_0x4adb4a,0xc9))['catch'](handleError(_0x4adb4a,null));};exports['clone']=function(_0x187221,_0x5d194a){var _0x5c8d11={'where':{'id':_0x187221[_0x441e('0x49')]['id']}},_0x5bb384={};_0x5bb384[_0x441e('0x32')]=_[_0x441e('0x4a')](db[_0x441e('0x42')][_0x441e('0x2e')]);_0x5c8d11[_0x441e('0x35')]=_[_0x441e('0x36')](_0x5bb384[_0x441e('0x32')],qs[_0x441e('0x37')](_0x187221['query'][_0x441e('0x37')]));_0x5c8d11[_0x441e('0x35')]=_0x5c8d11[_0x441e('0x35')][_0x441e('0x4b')]?_0x5c8d11[_0x441e('0x35')]:_0x5bb384[_0x441e('0x32')];if(_0x187221[_0x441e('0x33')]['includeAll']){_0x5c8d11[_0x441e('0x44')]=[{'all':!![]}];}_0x5c8d11=_[_0x441e('0x40')]({},_0x5c8d11,_0x187221[_0x441e('0x41')]);return db[_0x441e('0x42')][_0x441e('0x4c')](_0x5c8d11)[_0x441e('0x27')](handleEntityNotFound(_0x5d194a,null))[_0x441e('0x27')](function(_0x26892c){if(_0x26892c){var _0x52f90f=_0x26892c[_0x441e('0x28')]({'plain':!![]});_0x52f90f=qs['omit'](_0x52f90f,['id','createdAt','updatedAt']);_0x187221[_0x441e('0x4d')]=_['omit'](_0x187221[_0x441e('0x4d')],['id',_0x441e('0x54'),'updatedAt']);return db[_0x441e('0x42')][_0x441e('0x55')](_[_0x441e('0x40')](_0x52f90f,_0x187221[_0x441e('0x4d')]),{'include':_0x187221[_0x441e('0x33')][_0x441e('0x43')]?[{'all':!![]}]:undefined})['then'](function(_0x574824){var _0xee6d9f=_0x187221['user']['get']({'plain':!![]});if(!_0xee6d9f)throw new Error(_0x441e('0x56'));if(_0xee6d9f[_0x441e('0x4f')]==='user'){var _0x4547f2=_0x574824[_0x441e('0x28')]({'plain':!![]});var _0x46072e=_0x441e('0x50');return db[_0x441e('0x51')][_0x441e('0x4c')]({'where':{'name':_0x46072e,'userProfileId':_0xee6d9f[_0x441e('0x52')]},'raw':!![]})[_0x441e('0x27')](function(_0x5d5652){if(_0x5d5652&&_0x5d5652[_0x441e('0x57')]===0x0){return db[_0x441e('0x29')]['create']({'name':_0x4547f2[_0x441e('0x2c')],'resourceId':_0x4547f2['id'],'type':_0x5d5652['name'],'sectionId':_0x5d5652['id']},{})[_0x441e('0x27')](function(){return _0x574824;});}else{return _0x574824;}})['catch'](function(_0x213775){logger[_0x441e('0x2b')](_0x441e('0x53'),_0x213775);throw _0x213775;});}return _0x574824;});}})['then'](respondWithResult(_0x5d194a,0xc9))['catch'](handleError(_0x5d194a,null));};exports[_0x441e('0x58')]=function(_0x3ba8eb,_0x5c4ba1){if(_0x3ba8eb[_0x441e('0x4d')]['id']){delete _0x3ba8eb[_0x441e('0x4d')]['id'];}return db['Dashboard'][_0x441e('0x4c')]({'where':{'id':_0x3ba8eb['params']['id']}})['then'](handleEntityNotFound(_0x5c4ba1,null))[_0x441e('0x27')](saveUpdates(_0x3ba8eb[_0x441e('0x4d')],null))[_0x441e('0x27')](respondWithResult(_0x5c4ba1,null))[_0x441e('0x47')](handleError(_0x5c4ba1,null));};exports[_0x441e('0x2a')]=function(_0x24ab87,_0x40ebe1){return db[_0x441e('0x42')][_0x441e('0x4c')]({'where':{'id':_0x24ab87[_0x441e('0x49')]['id']}})[_0x441e('0x27')](handleEntityNotFound(_0x40ebe1,null))['then'](removeEntity(_0x40ebe1,null))[_0x441e('0x47')](handleError(_0x40ebe1,null));};function widgetAttributes(_0x44ec0d){try{switch(_0x44ec0d[_0x441e('0x30')]){case'iframe':return[{'name':_0x441e('0x59'),'value':_0x44ec0d[_0x441e('0x59')]||(_0x44ec0d[_0x441e('0x5a')]&&_0x44ec0d['attrs'][0x0]?_0x44ec0d[_0x441e('0x5a')][0x0][_0x441e('0x5b')]:undefined)||_0x441e('0x5c')}];case'custom':return[{'name':'attrPath','value':_0x44ec0d[_0x441e('0x5d')]||(_0x44ec0d[_0x441e('0x5a')]&&_0x44ec0d[_0x441e('0x5a')][0x0]?_0x44ec0d[_0x441e('0x5a')][0x0][_0x441e('0x5b')]:undefined)||''}];case'clock':return[{'name':_0x441e('0x5e'),'value':_0x44ec0d[_0x441e('0x5e')]||(_0x44ec0d[_0x441e('0x5a')]&&_0x44ec0d[_0x441e('0x5a')][0x0]?_0x44ec0d[_0x441e('0x5a')][0x0][_0x441e('0x5b')]:undefined)||'HH:mm:ss'},{'name':_0x441e('0x5f'),'value':_0x44ec0d[_0x441e('0x5f')]||(_0x44ec0d[_0x441e('0x5a')]&&_0x44ec0d['attrs'][0x1]?_0x44ec0d[_0x441e('0x5a')][0x1][_0x441e('0x5b')]:undefined)||_0x441e('0x60')},{'name':_0x441e('0x61'),'value':_0x44ec0d[_0x441e('0x61')]||(_0x44ec0d[_0x441e('0x5a')]&&_0x44ec0d[_0x441e('0x5a')][0x2]?_0x44ec0d['attrs'][0x2][_0x441e('0x5b')]:undefined)||0xc}];case _0x441e('0x62'):return[{'name':_0x441e('0x63'),'value':_0x44ec0d[_0x441e('0x63')]||(_0x44ec0d[_0x441e('0x5a')]&&_0x44ec0d['attrs'][0x0]?_0x44ec0d[_0x441e('0x5a')][0x0][_0x441e('0x5b')]:undefined)||_0x441e('0x64')},{'name':_0x441e('0x65'),'value':_0x44ec0d[_0x441e('0x65')]||(_0x44ec0d[_0x441e('0x5a')]&&_0x44ec0d['attrs'][0x1]?_0x44ec0d['attrs'][0x1][_0x441e('0x5b')]:undefined)||[]},{'name':_0x441e('0x61'),'value':_0x44ec0d['attrFontSize']||(_0x44ec0d[_0x441e('0x5a')]&&_0x44ec0d[_0x441e('0x5a')][0x2]?_0x44ec0d[_0x441e('0x5a')][0x2][_0x441e('0x5b')]:undefined)||0x14},{'name':_0x441e('0x66'),'value':_0x44ec0d['attrChannel']||(_0x44ec0d[_0x441e('0x5a')]&&_0x44ec0d[_0x441e('0x5a')][0x3]?_0x44ec0d['attrs'][0x3][_0x441e('0x5b')]:undefined)||_0x441e('0x67')},{'name':'attrEmailAccounts','value':_0x44ec0d[_0x441e('0x68')]||(_0x44ec0d['attrs']&&_0x44ec0d[_0x441e('0x5a')][0x4]?_0x44ec0d[_0x441e('0x5a')][0x4][_0x441e('0x5b')]:undefined)||''},{'name':_0x441e('0x69'),'value':_0x44ec0d[_0x441e('0x69')]||(_0x44ec0d[_0x441e('0x5a')]&&_0x44ec0d['attrs'][0x5]?_0x44ec0d[_0x441e('0x5a')][0x5][_0x441e('0x5b')]:undefined)||''},{'name':_0x441e('0x6a'),'value':_0x44ec0d[_0x441e('0x6a')]||(_0x44ec0d[_0x441e('0x5a')]&&_0x44ec0d[_0x441e('0x5a')][0x6]?_0x44ec0d[_0x441e('0x5a')][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x44ec0d['attrOpenchannelAccounts']||(_0x44ec0d[_0x441e('0x5a')]&&_0x44ec0d[_0x441e('0x5a')][0x7]?_0x44ec0d[_0x441e('0x5a')][0x7][_0x441e('0x5b')]:undefined)||''},{'name':_0x441e('0x6b'),'value':_0x44ec0d[_0x441e('0x6b')]||(_0x44ec0d['attrs']&&_0x44ec0d[_0x441e('0x5a')][0x8]?_0x44ec0d[_0x441e('0x5a')][0x8][_0x441e('0x5b')]:undefined)||''},{'name':_0x441e('0x6c'),'value':_0x44ec0d['attrChatWebsites']||(_0x44ec0d[_0x441e('0x5a')]&&_0x44ec0d['attrs'][0x9]?_0x44ec0d['attrs'][0x9][_0x441e('0x5b')]:undefined)||''}];case _0x441e('0x6d'):case _0x441e('0x6e'):return[{'name':'attrSerie1','value':_0x44ec0d[_0x441e('0x6f')]||(_0x44ec0d[_0x441e('0x5a')]&&_0x44ec0d[_0x441e('0x5a')][0x0]?_0x44ec0d[_0x441e('0x5a')][0x0][_0x441e('0x5b')]:undefined)||_0x441e('0x64')},{'name':_0x441e('0x70'),'value':_0x44ec0d[_0x441e('0x70')]||(_0x44ec0d[_0x441e('0x5a')]&&_0x44ec0d[_0x441e('0x5a')][0x1]?_0x44ec0d[_0x441e('0x5a')][0x1]['value']:undefined)||null},{'name':_0x441e('0x71'),'value':_0x44ec0d[_0x441e('0x71')]||(_0x44ec0d['attrs']&&_0x44ec0d['attrs'][0x2]?_0x44ec0d[_0x441e('0x5a')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x44ec0d['attrVoiceQueues']||(_0x44ec0d[_0x441e('0x5a')]&&_0x44ec0d[_0x441e('0x5a')][0x3]?_0x44ec0d[_0x441e('0x5a')][0x3]['value']:undefined)||[]},{'name':_0x441e('0x66'),'value':_0x44ec0d[_0x441e('0x66')]||(_0x44ec0d[_0x441e('0x5a')]&&_0x44ec0d[_0x441e('0x5a')][0x4]?_0x44ec0d[_0x441e('0x5a')][0x4][_0x441e('0x5b')]:undefined)||_0x441e('0x67')},{'name':_0x441e('0x68'),'value':_0x44ec0d[_0x441e('0x68')]||(_0x44ec0d['attrs']&&_0x44ec0d['attrs'][0x5]?_0x44ec0d[_0x441e('0x5a')][0x5][_0x441e('0x5b')]:undefined)||''},{'name':_0x441e('0x69'),'value':_0x44ec0d[_0x441e('0x69')]||(_0x44ec0d[_0x441e('0x5a')]&&_0x44ec0d['attrs'][0x6]?_0x44ec0d[_0x441e('0x5a')][0x6]['value']:undefined)||''},{'name':_0x441e('0x6a'),'value':_0x44ec0d[_0x441e('0x6a')]||(_0x44ec0d['attrs']&&_0x44ec0d[_0x441e('0x5a')][0x7]?_0x44ec0d[_0x441e('0x5a')][0x7][_0x441e('0x5b')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x44ec0d[_0x441e('0x72')]||(_0x44ec0d['attrs']&&_0x44ec0d[_0x441e('0x5a')][0x8]?_0x44ec0d[_0x441e('0x5a')][0x8][_0x441e('0x5b')]:undefined)||''},{'name':_0x441e('0x6b'),'value':_0x44ec0d[_0x441e('0x6b')]||(_0x44ec0d['attrs']&&_0x44ec0d[_0x441e('0x5a')][0x9]?_0x44ec0d[_0x441e('0x5a')][0x9][_0x441e('0x5b')]:undefined)||''},{'name':_0x441e('0x6c'),'value':_0x44ec0d['attrChatWebsites']||(_0x44ec0d['attrs']&&_0x44ec0d['attrs'][0xa]?_0x44ec0d['attrs'][0xa]['value']:undefined)||''}];case _0x441e('0x73'):return[{'name':'attrReport','type':_0x44ec0d[_0x441e('0x74')]||(_0x44ec0d[_0x441e('0x5a')]&&_0x44ec0d[_0x441e('0x5a')][0x0]?_0x44ec0d[_0x441e('0x5a')][0x0][_0x441e('0x30')]:undefined)||null,'value':_0x44ec0d[_0x441e('0x75')]||(_0x44ec0d[_0x441e('0x5a')]&&_0x44ec0d[_0x441e('0x5a')][0x0]?_0x44ec0d[_0x441e('0x5a')][0x0][_0x441e('0x5b')]:undefined)||null},{'name':_0x441e('0x76'),'value':_0x44ec0d[_0x441e('0x76')]||(_0x44ec0d[_0x441e('0x5a')]&&_0x44ec0d[_0x441e('0x5a')][0x1]?_0x44ec0d['attrs'][0x1][_0x441e('0x5b')]:undefined)||0x0}];default:return[];}}catch(_0x712ae6){logger[_0x441e('0x2b')](_0x441e('0x77'),JSON[_0x441e('0x78')](_0x712ae6));return[];}}exports[_0x441e('0x79')]=function(_0x2ace89,_0x4c28c4,_0x2feeba){if(_0x2ace89[_0x441e('0x4d')]['id']){delete _0x2ace89[_0x441e('0x4d')]['id'];}return db[_0x441e('0x42')][_0x441e('0x4c')]({'where':{'id':_0x2ace89['params']['id']}})[_0x441e('0x27')](handleEntityNotFound(_0x4c28c4,null))['then'](function(_0x8f07c2){if(_0x8f07c2){_0x2ace89[_0x441e('0x4d')][_0x441e('0x7a')]=_0x8f07c2['id'];_0x2ace89['body'][_0x441e('0x5a')]=widgetAttributes(_0x2ace89[_0x441e('0x4d')]);return db[_0x441e('0x7b')][_0x441e('0x55')](_0x2ace89[_0x441e('0x4d')]);}})['then'](respondWithResult(_0x4c28c4,null))['catch'](handleError(_0x4c28c4,null));};exports[_0x441e('0x7c')]=function(_0x28064c,_0x3e83db,_0x1a030e){var _0x1d3df8={};var _0x33ead3={};var _0xdfc888;var _0x3fd2cb;return db[_0x441e('0x42')]['findOne']({'where':{'id':_0x28064c[_0x441e('0x49')]['id']}})[_0x441e('0x27')](handleEntityNotFound(_0x3e83db,null))[_0x441e('0x27')](function(_0x2e6ba1){if(_0x2e6ba1){_0xdfc888=_0x2e6ba1;_0x33ead3[_0x441e('0x32')]=_[_0x441e('0x4a')](db[_0x441e('0x7b')][_0x441e('0x2e')]);_0x33ead3[_0x441e('0x33')]=_[_0x441e('0x4a')](_0x28064c[_0x441e('0x33')]);_0x33ead3['filters']=_[_0x441e('0x36')](_0x33ead3['model'],_0x33ead3[_0x441e('0x33')]);_0x1d3df8[_0x441e('0x35')]=_[_0x441e('0x36')](_0x33ead3['model'],qs[_0x441e('0x37')](_0x28064c['query'][_0x441e('0x37')]));_0x1d3df8[_0x441e('0x35')]=_0x1d3df8[_0x441e('0x35')]['length']?_0x1d3df8[_0x441e('0x35')]:_0x33ead3[_0x441e('0x32')];_0x1d3df8[_0x441e('0x3a')]=qs['sort'](_0x28064c[_0x441e('0x33')][_0x441e('0x3b')]);_0x1d3df8['where']=qs[_0x441e('0x34')](_[_0x441e('0x3d')](_0x28064c[_0x441e('0x33')],_0x33ead3['filters']));if(_0x28064c[_0x441e('0x33')][_0x441e('0x3f')]){_0x1d3df8[_0x441e('0x3c')]=_[_0x441e('0x40')](_0x1d3df8['where'],{'$or':_[_0x441e('0x2d')](_0x1d3df8[_0x441e('0x35')],function(_0x7fb813){var _0xd0606e={};_0xd0606e[_0x7fb813]={'$like':'%'+_0x28064c['query'][_0x441e('0x3f')]+'%'};return _0xd0606e;})});}_0x1d3df8=_[_0x441e('0x40')]({},_0x1d3df8,_0x28064c['options']);return _0xdfc888[_0x441e('0x7c')](_0x1d3df8);}})[_0x441e('0x27')](function(_0x241faf){if(_0x241faf){_0x3fd2cb=_0x241faf[_0x441e('0x4b')];if(!_0x28064c[_0x441e('0x33')]['hasOwnProperty']('nolimit')){_0x1d3df8[_0x441e('0x7d')]=qs['limit'](_0x28064c[_0x441e('0x33')][_0x441e('0x7d')]);_0x1d3df8[_0x441e('0x20')]=qs[_0x441e('0x20')](_0x28064c[_0x441e('0x33')]['offset']);}return _0xdfc888[_0x441e('0x7c')](_0x1d3df8);}})[_0x441e('0x27')](function(_0x486a8f){if(_0x486a8f){return _0x486a8f?{'count':_0x3fd2cb,'rows':_0x486a8f}:null;}})[_0x441e('0x27')](respondWithResult(_0x3e83db,null))['catch'](handleError(_0x3e83db,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index fd233fc..5bc9597 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 _0xc04a=['emit','hasOwnProperty','exports','events','setMaxListeners','update','remove'];(function(_0x19b4be,_0xd53155){var _0x563084=function(_0x39c260){while(--_0x39c260){_0x19b4be['push'](_0x19b4be['shift']());}};_0x563084(++_0xd53155);}(_0xc04a,0x184));var _0xac04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc04a[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xac04('0x0'));var Dashboard=require('../../mysqldb')['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0xac04('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xac04('0x2'),'afterDestroy':_0xac04('0x3')};function emitEvent(_0x2383ec){return function(_0x18436f,_0x504856,_0x32392e){DashboardEvents[_0xac04('0x4')](_0x2383ec+':'+_0x18436f['id'],_0x18436f);DashboardEvents[_0xac04('0x4')](_0x2383ec,_0x18436f);_0x32392e(null);};}for(var e in events){if(events[_0xac04('0x5')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0xac04('0x6')]=DashboardEvents; \ No newline at end of file +var _0xe1fc=['exports','events','Dashboard','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x1be7b7,_0x182b3e){var _0x1aed09=function(_0x46e1d7){while(--_0x46e1d7){_0x1be7b7['push'](_0x1be7b7['shift']());}};_0x1aed09(++_0x182b3e);}(_0xe1fc,0x155));var _0xce1f=function(_0x4b03c9,_0x17ce03){_0x4b03c9=_0x4b03c9-0x0;var _0x161ba2=_0xe1fc[_0x4b03c9];return _0x161ba2;};'use strict';var EventEmitter=require(_0xce1f('0x0'));var Dashboard=require('../../mysqldb')['db'][_0xce1f('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xce1f('0x2')](0x0);var events={'afterCreate':_0xce1f('0x3'),'afterUpdate':_0xce1f('0x4'),'afterDestroy':_0xce1f('0x5')};function emitEvent(_0x41450f){return function(_0x2e242d,_0x5dbdd0,_0x1422c0){DashboardEvents[_0xce1f('0x6')](_0x41450f+':'+_0x2e242d['id'],_0x2e242d);DashboardEvents[_0xce1f('0x6')](_0x41450f,_0x2e242d);_0x1422c0(null);};}for(var e in events){if(events[_0xce1f('0x7')](e)){var event=events[e];Dashboard[_0xce1f('0x8')](e,emitEvent(event));}}module[_0xce1f('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 d5b2084..077eea5 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 _0x9cee=['dashboards','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./dashboard.attributes','define','Dashboard'];(function(_0x46ddaa,_0xa62155){var _0x525693=function(_0x5c1860){while(--_0x5c1860){_0x46ddaa['push'](_0x46ddaa['shift']());}};_0x525693(++_0xa62155);}(_0x9cee,0x1f0));var _0xe9ce=function(_0x3c2882,_0x5c5ab0){_0x3c2882=_0x3c2882-0x0;var _0x20de69=_0x9cee[_0x3c2882];return _0x20de69;};'use strict';var _=require(_0xe9ce('0x0'));var util=require(_0xe9ce('0x1'));var logger=require(_0xe9ce('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe9ce('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe9ce('0x4'));var rimraf=require(_0xe9ce('0x5'));var config=require(_0xe9ce('0x6'));var attributes=require(_0xe9ce('0x7'));module['exports']=function(_0x4737e7,_0x429d7b){return _0x4737e7[_0xe9ce('0x8')](_0xe9ce('0x9'),attributes,{'tableName':_0xe9ce('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f7c=['request-promise','path','rimraf','exports','define','Dashboard','dashboards','lodash','util','moment'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0x8f7c,0x133));var _0xc8f7=function(_0x382dcc,_0x3eba4d){_0x382dcc=_0x382dcc-0x0;var _0x744637=_0x8f7c[_0x382dcc];return _0x744637;};'use strict';var _=require(_0xc8f7('0x0'));var util=require(_0xc8f7('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc8f7('0x2'));var BPromise=require('bluebird');var rp=require(_0xc8f7('0x3'));var fs=require('fs');var path=require(_0xc8f7('0x4'));var rimraf=require(_0xc8f7('0x5'));var config=require('../../config/environment');var attributes=require('./dashboard.attributes');module[_0xc8f7('0x6')]=function(_0x5359e2,_0x208459){return _0x5359e2[_0xc8f7('0x7')](_0xc8f7('0x8'),attributes,{'tableName':_0xc8f7('0x9'),'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 c4e4d5a..f936f0b 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 _0xd581=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','request','Dashboard,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xd581,0xe8));var _0x1d58=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xd581[_0x3070dc];return _0x431489;};'use strict';var _=require(_0x1d58('0x0'));var util=require(_0x1d58('0x1'));var moment=require(_0x1d58('0x2'));var BPromise=require(_0x1d58('0x3'));var rs=require(_0x1d58('0x4'));var fs=require('fs');var Redis=require(_0x1d58('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1d58('0x6'));var logger=require(_0x1d58('0x7'))(_0x1d58('0x8'));var config=require('../../config/environment');var jayson=require(_0x1d58('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x1d58('0xa')]=_[_0x1d58('0xb')](config[_0x1d58('0xa')],{'host':_0x1d58('0xc'),'port':0x18eb});var socket=require(_0x1d58('0xd'))(new Redis(config[_0x1d58('0xa')]));require(_0x1d58('0xe'))['register'](socket);function respondWithRpcPromise(_0x3bbab1,_0x167ddb,_0x22da91){return new BPromise(function(_0x157eb0,_0x587051){return client[_0x1d58('0xf')](_0x3bbab1,_0x22da91)['then'](function(_0x2f1809){logger['info'](_0x1d58('0x10'),_0x167ddb,_0x1d58('0x11'));logger[_0x1d58('0x12')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x167ddb,_0x1d58('0x11'),JSON[_0x1d58('0x13')](_0x2f1809));if(_0x2f1809[_0x1d58('0x14')]){if(_0x2f1809['error'][_0x1d58('0x15')]===0x1f4){logger['error']('Dashboard,\x20%s,\x20%s',_0x167ddb,_0x2f1809[_0x1d58('0x14')][_0x1d58('0x16')]);return _0x587051(_0x2f1809[_0x1d58('0x14')][_0x1d58('0x16')]);}logger['error'](_0x1d58('0x10'),_0x167ddb,_0x2f1809[_0x1d58('0x14')][_0x1d58('0x16')]);return _0x157eb0(_0x2f1809['error'][_0x1d58('0x16')]);}else{logger[_0x1d58('0x17')]('Dashboard,\x20%s,\x20%s',_0x167ddb,_0x1d58('0x11'));_0x157eb0(_0x2f1809[_0x1d58('0x18')][_0x1d58('0x16')]);}})[_0x1d58('0x19')](function(_0x2edb97){logger[_0x1d58('0x14')]('Dashboard,\x20%s,\x20%s',_0x167ddb,_0x2edb97);_0x587051(_0x2edb97);});});} \ No newline at end of file +var _0xaa3e=['util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','redis','defaults','socket.io-emitter','./dashboard.socket','register','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x122b3d,_0x4b12e8){var _0x2c7c43=function(_0x2e7662){while(--_0x2e7662){_0x122b3d['push'](_0x122b3d['shift']());}};_0x2c7c43(++_0x4b12e8);}(_0xaa3e,0x1b4));var _0xeaa3=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0xaa3e[_0x5a95fa];return _0x1a61b8;};'use strict';var _=require(_0xeaa3('0x0'));var util=require(_0xeaa3('0x1'));var moment=require(_0xeaa3('0x2'));var BPromise=require('bluebird');var rs=require(_0xeaa3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeaa3('0x4'))['db'];var utils=require(_0xeaa3('0x5'));var logger=require(_0xeaa3('0x6'))(_0xeaa3('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xeaa3('0x8')]=_[_0xeaa3('0x9')](config[_0xeaa3('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xeaa3('0xa'))(new Redis(config[_0xeaa3('0x8')]));require(_0xeaa3('0xb'))[_0xeaa3('0xc')](socket);function respondWithRpcPromise(_0x4a7a8d,_0x580f3b,_0x42a1cb){return new BPromise(function(_0x18ca69,_0x5d1df4){return client['request'](_0x4a7a8d,_0x42a1cb)[_0xeaa3('0xd')](function(_0x5b6ad6){logger[_0xeaa3('0xe')](_0xeaa3('0xf'),_0x580f3b,_0xeaa3('0x10'));logger['debug'](_0xeaa3('0x11'),_0x580f3b,'request\x20sent',JSON[_0xeaa3('0x12')](_0x5b6ad6));if(_0x5b6ad6[_0xeaa3('0x13')]){if(_0x5b6ad6[_0xeaa3('0x13')][_0xeaa3('0x14')]===0x1f4){logger['error'](_0xeaa3('0xf'),_0x580f3b,_0x5b6ad6['error'][_0xeaa3('0x15')]);return _0x5d1df4(_0x5b6ad6[_0xeaa3('0x13')][_0xeaa3('0x15')]);}logger['error'](_0xeaa3('0xf'),_0x580f3b,_0x5b6ad6['error'][_0xeaa3('0x15')]);return _0x18ca69(_0x5b6ad6['error'][_0xeaa3('0x15')]);}else{logger[_0xeaa3('0xe')](_0xeaa3('0xf'),_0x580f3b,_0xeaa3('0x10'));_0x18ca69(_0x5b6ad6[_0xeaa3('0x16')]['message']);}})['catch'](function(_0x1d55d1){logger[_0xeaa3('0x13')](_0xeaa3('0xf'),_0x580f3b,_0x1d55d1);_0x5d1df4(_0x1d55d1);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 57aff6b..4c8e1b3 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 _0xa5c5=['removeListener','register','length','dashboard:','./dashboard.events','save','update','emit'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa5c5,0x10c));var _0x5a5c=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa5c5[_0x19e35c];return _0x3e1fe8;};'use strict';var DashboardEvents=require(_0x5a5c('0x0'));var events=[_0x5a5c('0x1'),'remove',_0x5a5c('0x2')];function createListener(_0x478edc,_0x56b9ff){return function(_0x2e66d8){_0x56b9ff[_0x5a5c('0x3')](_0x478edc,_0x2e66d8);};}function removeListener(_0x3db287,_0xa3aa46){return function(){DashboardEvents[_0x5a5c('0x4')](_0x3db287,_0xa3aa46);};}exports[_0x5a5c('0x5')]=function(_0x534511){for(var _0x259f12=0x0,_0x20ec8a=events[_0x5a5c('0x6')];_0x259f12<_0x20ec8a;_0x259f12++){var _0x5e8da9=events[_0x259f12];var _0x1f261d=createListener(_0x5a5c('0x7')+_0x5e8da9,_0x534511);DashboardEvents['on'](_0x5e8da9,_0x1f261d);}}; \ No newline at end of file +var _0x4887=['./dashboard.events','save','remove','update','emit','register'];(function(_0x287f0d,_0x5670e9){var _0x1e3b79=function(_0x56f14a){while(--_0x56f14a){_0x287f0d['push'](_0x287f0d['shift']());}};_0x1e3b79(++_0x5670e9);}(_0x4887,0x120));var _0x7488=function(_0x33812b,_0x500033){_0x33812b=_0x33812b-0x0;var _0x3531df=_0x4887[_0x33812b];return _0x3531df;};'use strict';var DashboardEvents=require(_0x7488('0x0'));var events=[_0x7488('0x1'),_0x7488('0x2'),_0x7488('0x3')];function createListener(_0x3d8a6b,_0x48eaaf){return function(_0x521cdb){_0x48eaaf[_0x7488('0x4')](_0x3d8a6b,_0x521cdb);};}function removeListener(_0x576ae7,_0x46b94f){return function(){DashboardEvents['removeListener'](_0x576ae7,_0x46b94f);};}exports[_0x7488('0x5')]=function(_0x556100){for(var _0x4ffa6c=0x0,_0x1a5b84=events['length'];_0x4ffa6c<_0x1a5b84;_0x4ffa6c++){var _0x373ce2=events[_0x4ffa6c];var _0xfec8c8=createListener('dashboard:'+_0x373ce2,_0x556100);DashboardEvents['on'](_0x373ce2,_0xfec8c8);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index df8a2e2..15e266f 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 _0x153f=['addItem','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','post','clone'];(function(_0x23b85e,_0x39b209){var _0x329756=function(_0x3418e1){while(--_0x3418e1){_0x23b85e['push'](_0x23b85e['shift']());}};_0x329756(++_0x39b209);}(_0x153f,0x17d));var _0xf153=function(_0x204349,_0x28cbde){_0x204349=_0x204349-0x0;var _0x5deea3=_0x153f[_0x204349];return _0x5deea3;};'use strict';var multer=require('multer');var util=require(_0xf153('0x0'));var path=require(_0xf153('0x1'));var timeout=require(_0xf153('0x2'));var express=require(_0xf153('0x3'));var router=express[_0xf153('0x4')]();var fs_extra=require(_0xf153('0x5'));var auth=require(_0xf153('0x6'));var interaction=require(_0xf153('0x7'));var config=require(_0xf153('0x8'));var controller=require(_0xf153('0x9'));router[_0xf153('0xa')]('/',auth[_0xf153('0xb')](),controller[_0xf153('0xc')]);router['get'](_0xf153('0xd'),auth[_0xf153('0xb')](),controller[_0xf153('0xe')]);router['get'](_0xf153('0xf'),auth[_0xf153('0xb')](),controller['getItems']);router[_0xf153('0x10')]('/',auth[_0xf153('0xb')](),controller['create']);router[_0xf153('0x10')]('/:id/clone',auth[_0xf153('0xb')](),controller[_0xf153('0x11')]);router[_0xf153('0x10')]('/:id/items',auth[_0xf153('0xb')](),controller[_0xf153('0x12')]);router['put'](_0xf153('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xf153('0x13')](_0xf153('0xd'),auth[_0xf153('0xb')](),controller['destroy']);module[_0xf153('0x14')]=router; \ No newline at end of file +var _0x0155=['../../config/environment','isAuthenticated','/:id','get','/:id/items','getItems','post','create','/:id/clone','clone','put','destroy','exports','util','path','express','Router','../../components/auth/service'];(function(_0x221b8c,_0x2c7afc){var _0x3fab9f=function(_0x28bab0){while(--_0x28bab0){_0x221b8c['push'](_0x221b8c['shift']());}};_0x3fab9f(++_0x2c7afc);}(_0x0155,0x175));var _0x5015=function(_0x4747e4,_0x2276b7){_0x4747e4=_0x4747e4-0x0;var _0x5cb40f=_0x0155[_0x4747e4];return _0x5cb40f;};'use strict';var multer=require('multer');var util=require(_0x5015('0x0'));var path=require(_0x5015('0x1'));var timeout=require('connect-timeout');var express=require(_0x5015('0x2'));var router=express[_0x5015('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5015('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5015('0x5'));var controller=require('./dashboard.controller');router['get']('/',auth[_0x5015('0x6')](),controller['index']);router['get'](_0x5015('0x7'),auth[_0x5015('0x6')](),controller['show']);router[_0x5015('0x8')](_0x5015('0x9'),auth[_0x5015('0x6')](),controller[_0x5015('0xa')]);router[_0x5015('0xb')]('/',auth[_0x5015('0x6')](),controller[_0x5015('0xc')]);router[_0x5015('0xb')](_0x5015('0xd'),auth[_0x5015('0x6')](),controller[_0x5015('0xe')]);router['post'](_0x5015('0x9'),auth['isAuthenticated'](),controller['addItem']);router[_0x5015('0xf')]('/:id',auth[_0x5015('0x6')](),controller['update']);router['delete']('/:id',auth[_0x5015('0x6')](),controller[_0x5015('0x10')]);module[_0x5015('0x11')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 0628b02..05ed76e 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(_0x22541c,_0x5e7c24){var _0x2c5667=function(_0x45db16){while(--_0x45db16){_0x22541c['push'](_0x22541c['shift']());}};_0x2c5667(++_0x5e7c24);}(_0xd8fb,0x99));var _0xbd8f=function(_0xa79bad,_0x1ab0b5){_0xa79bad=_0xa79bad-0x0;var _0x4a23db=_0xd8fb[_0xa79bad];return _0x4a23db;};'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 _0x2ef3=['parse','attrs','stringify','setDataValue','INTEGER','#2196f3','sequelize','squel','lodash','exports','STRING','long'];(function(_0x54408c,_0x50f71a){var _0x5acf60=function(_0x5b03de){while(--_0x5b03de){_0x54408c['push'](_0x54408c['shift']());}};_0x5acf60(++_0x50f71a);}(_0x2ef3,0xba));var _0x32ef=function(_0x3261a3,_0x49e883){_0x3261a3=_0x3261a3-0x0;var _0x34142f=_0x2ef3[_0x3261a3];return _0x34142f;};'use strict';var Sequelize=require(_0x32ef('0x0'));var squel=require(_0x32ef('0x1'));var _=require(_0x32ef('0x2'));module[_0x32ef('0x3')]={'title':{'type':Sequelize[_0x32ef('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0x32ef('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x32ef('0x5')),'get':function(){try{return JSON[_0x32ef('0x6')](this['getDataValue'](_0x32ef('0x7')));}catch(_0x37dd1d){return[];}},'set':function(_0x4c8104){try{this['setDataValue'](_0x32ef('0x7'),JSON[_0x32ef('0x8')](_0x4c8104));}catch(_0x367c39){this[_0x32ef('0x9')](_0x32ef('0x7'),JSON[_0x32ef('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x32ef('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x32ef('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x32ef('0xa')]},'col':{'type':Sequelize[_0x32ef('0xa')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x32ef('0x4')],'allowNull':![],'defaultValue':_0x32ef('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x32ef('0x4')]},'titleFontSize':{'type':Sequelize[_0x32ef('0xa')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index ecf7d55..26df110 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 _0x1134=['value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','attrMetric','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','voice','web-report','attrReport','reportType','type','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','fs-extra','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','socket.io-emitter','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','show','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','length','include','options','find','catch','iframe','attrUrl','attrs'];(function(_0x4f5257,_0xaa3675){var _0x2bf596=function(_0x95afbf){while(--_0x95afbf){_0x4f5257['push'](_0x4f5257['shift']());}};_0x2bf596(++_0xaa3675);}(_0x1134,0x19c));var _0x4113=function(_0x4e5bb9,_0x5e1cb0){_0x4e5bb9=_0x4e5bb9-0x0;var _0x5d20ef=_0x1134[_0x4e5bb9];return _0x5d20ef;};'use strict';var emlformat=require(_0x4113('0x0'));var rimraf=require(_0x4113('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4113('0x2'));var rp=require(_0x4113('0x3'));var moment=require('moment');var BPromise=require(_0x4113('0x4'));var Mustache=require(_0x4113('0x5'));var util=require('util');var path=require(_0x4113('0x6'));var sox=require('sox');var csv=require(_0x4113('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4113('0x8'));var _=require('lodash');var squel=require(_0x4113('0x9'));var crypto=require(_0x4113('0xa'));var jsforce=require(_0x4113('0xb'));var deskjs=require(_0x4113('0xc'));var toCsv=require(_0x4113('0x7'));var querystring=require(_0x4113('0xd'));var Papa=require(_0x4113('0xe'));var Redis=require(_0x4113('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4113('0x10'));var as=require(_0x4113('0x11'));var hardwareService=require(_0x4113('0x12'));var logger=require(_0x4113('0x13'))(_0x4113('0x14'));var utils=require(_0x4113('0x15'));var config=require(_0x4113('0x16'));var licenseUtil=require(_0x4113('0x17'));var db=require(_0x4113('0x18'))['db'];config[_0x4113('0x19')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4113('0x1a'))(new Redis(config[_0x4113('0x19')]));require('./dashboardItem.socket')['register'](socket);function respondWithStatusCode(_0x40f01e,_0x5d9801){_0x5d9801=_0x5d9801||0xcc;return function(_0x34123d){if(_0x34123d){return _0x40f01e['sendStatus'](_0x5d9801);}return _0x40f01e['status'](_0x5d9801)[_0x4113('0x1b')]();};}function respondWithResult(_0xe88992,_0x2f8952){_0x2f8952=_0x2f8952||0xc8;return function(_0x3de530){if(_0x3de530){return _0xe88992[_0x4113('0x1c')](_0x2f8952)[_0x4113('0x1d')](_0x3de530);}};}function respondWithFilteredResult(_0x405849,_0xa7f33d){return function(_0x1051d4){if(_0x1051d4){var _0x1cd9ae=typeof _0xa7f33d['offset']===_0x4113('0x1e')&&typeof _0xa7f33d[_0x4113('0x1f')]===_0x4113('0x1e');var _0x1d40ba=_0x1051d4[_0x4113('0x20')];var _0x9608c3=_0x1cd9ae?0x0:_0xa7f33d[_0x4113('0x21')];var _0x4cdffc=_0x1cd9ae?_0x1051d4[_0x4113('0x20')]:_0xa7f33d['offset']+_0xa7f33d[_0x4113('0x1f')];var _0x2776a6;if(_0x4cdffc>=_0x1d40ba){_0x4cdffc=_0x1d40ba;_0x2776a6=0xc8;}else{_0x2776a6=0xce;}_0x405849['status'](_0x2776a6);return _0x405849['set'](_0x4113('0x22'),_0x9608c3+'-'+_0x4cdffc+'/'+_0x1d40ba)['json'](_0x1051d4);}return null;};}function patchUpdates(_0x149d1a){return function(_0x1a9167){try{jsonpatch[_0x4113('0x23')](_0x1a9167,_0x149d1a,!![]);}catch(_0x5a85be){return BPromise[_0x4113('0x24')](_0x5a85be);}return _0x1a9167[_0x4113('0x25')]();};}function saveUpdates(_0x349b33,_0x1f095c){return function(_0x34ee93){if(_0x34ee93){return _0x34ee93[_0x4113('0x26')](_0x349b33)[_0x4113('0x27')](function(_0x1c498a){return _0x1c498a;});}return null;};}function removeEntity(_0x122102,_0xc73743){return function(_0x22f1ce){if(_0x22f1ce){return _0x22f1ce[_0x4113('0x28')]()['then'](function(){_0x122102[_0x4113('0x1c')](0xcc)[_0x4113('0x1b')]();});}};}function handleEntityNotFound(_0x54cf93,_0x34d8b4){return function(_0x98d652){if(!_0x98d652){_0x54cf93[_0x4113('0x29')](0x194);}return _0x98d652;};}function handleError(_0x177a6a,_0x2d9cc6){_0x2d9cc6=_0x2d9cc6||0x1f4;return function(_0x180fed){logger[_0x4113('0x2a')](_0x180fed[_0x4113('0x2b')]);if(_0x180fed[_0x4113('0x2c')]){delete _0x180fed[_0x4113('0x2c')];}_0x177a6a[_0x4113('0x1c')](_0x2d9cc6)[_0x4113('0x2d')](_0x180fed);};}exports[_0x4113('0x2e')]=function(_0x24a487,_0x515526){var _0x1607a6={'raw':![],'where':{'id':_0x24a487['params']['id']}},_0xfeabfd={};_0xfeabfd[_0x4113('0x2f')]=_[_0x4113('0x30')](db[_0x4113('0x31')][_0x4113('0x32')]);_0xfeabfd['query']=_[_0x4113('0x30')](_0x24a487[_0x4113('0x33')]);_0xfeabfd[_0x4113('0x34')]=_[_0x4113('0x35')](_0xfeabfd[_0x4113('0x2f')],_0xfeabfd[_0x4113('0x33')]);_0x1607a6[_0x4113('0x36')]=_[_0x4113('0x35')](_0xfeabfd[_0x4113('0x2f')],qs['fields'](_0x24a487[_0x4113('0x33')]['fields']));_0x1607a6[_0x4113('0x36')]=_0x1607a6[_0x4113('0x36')][_0x4113('0x37')]?_0x1607a6[_0x4113('0x36')]:_0xfeabfd[_0x4113('0x2f')];if(_0x24a487[_0x4113('0x33')]['includeAll']){_0x1607a6[_0x4113('0x38')]=[{'all':!![]}];}_0x1607a6=_['merge']({},_0x1607a6,_0x24a487[_0x4113('0x39')]);return db[_0x4113('0x31')][_0x4113('0x3a')](_0x1607a6)['then'](handleEntityNotFound(_0x515526,null))[_0x4113('0x27')](respondWithResult(_0x515526,null))['catch'](handleError(_0x515526,null));};exports[_0x4113('0x28')]=function(_0x580434,_0x13d161){return db[_0x4113('0x31')]['find']({'where':{'id':_0x580434['params']['id']}})[_0x4113('0x27')](handleEntityNotFound(_0x13d161,null))[_0x4113('0x27')](removeEntity(_0x13d161,null))[_0x4113('0x3b')](handleError(_0x13d161,null));};function widgetAttributes(_0x4b2739){try{switch(_0x4b2739['type']){case _0x4113('0x3c'):return[{'name':_0x4113('0x3d'),'value':_0x4b2739[_0x4113('0x3d')]||(_0x4b2739[_0x4113('0x3e')]&&_0x4b2739[_0x4113('0x3e')][0x0]?_0x4b2739['attrs'][0x0][_0x4113('0x3f')]:undefined)||_0x4113('0x40')}];case _0x4113('0x41'):return[{'name':'attrPath','value':_0x4b2739[_0x4113('0x42')]||(_0x4b2739[_0x4113('0x3e')]&&_0x4b2739[_0x4113('0x3e')][0x0]?_0x4b2739['attrs'][0x0][_0x4113('0x3f')]:undefined)||''}];case'clock':return[{'name':_0x4113('0x43'),'value':_0x4b2739['attrHourFormat']||(_0x4b2739[_0x4113('0x3e')]&&_0x4b2739[_0x4113('0x3e')][0x0]?_0x4b2739[_0x4113('0x3e')][0x0][_0x4113('0x3f')]:undefined)||_0x4113('0x44')},{'name':_0x4113('0x45'),'value':_0x4b2739[_0x4113('0x45')]||(_0x4b2739[_0x4113('0x3e')]&&_0x4b2739['attrs'][0x1]?_0x4b2739[_0x4113('0x3e')][0x1][_0x4113('0x3f')]:undefined)||'0.00'},{'name':_0x4113('0x46'),'value':_0x4b2739['attrFontSize']||(_0x4b2739['attrs']&&_0x4b2739[_0x4113('0x3e')][0x2]?_0x4b2739['attrs'][0x2][_0x4113('0x3f')]:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x4b2739[_0x4113('0x47')]||(_0x4b2739['attrs']&&_0x4b2739[_0x4113('0x3e')][0x0]?_0x4b2739[_0x4113('0x3e')][0x0]['value']:undefined)||'total'},{'name':_0x4113('0x48'),'value':_0x4b2739[_0x4113('0x48')]||(_0x4b2739[_0x4113('0x3e')]&&_0x4b2739[_0x4113('0x3e')][0x1]?_0x4b2739['attrs'][0x1][_0x4113('0x3f')]:undefined)||[]},{'name':_0x4113('0x46'),'value':_0x4b2739['attrFontSize']||(_0x4b2739['attrs']&&_0x4b2739[_0x4113('0x3e')][0x2]?_0x4b2739['attrs'][0x2][_0x4113('0x3f')]:undefined)||0x14},{'name':_0x4113('0x49'),'value':_0x4b2739[_0x4113('0x49')]||(_0x4b2739[_0x4113('0x3e')]&&_0x4b2739['attrs'][0x3]?_0x4b2739[_0x4113('0x3e')][0x3]['value']:undefined)||'voice'},{'name':_0x4113('0x4a'),'value':_0x4b2739[_0x4113('0x4a')]||(_0x4b2739['attrs']&&_0x4b2739[_0x4113('0x3e')][0x4]?_0x4b2739['attrs'][0x4][_0x4113('0x3f')]:undefined)||''},{'name':_0x4113('0x4b'),'value':_0x4b2739[_0x4113('0x4b')]||(_0x4b2739['attrs']&&_0x4b2739[_0x4113('0x3e')][0x5]?_0x4b2739[_0x4113('0x3e')][0x5][_0x4113('0x3f')]:undefined)||''},{'name':_0x4113('0x4c'),'value':_0x4b2739[_0x4113('0x4c')]||(_0x4b2739[_0x4113('0x3e')]&&_0x4b2739[_0x4113('0x3e')][0x6]?_0x4b2739[_0x4113('0x3e')][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x4b2739[_0x4113('0x4d')]||(_0x4b2739['attrs']&&_0x4b2739['attrs'][0x7]?_0x4b2739['attrs'][0x7][_0x4113('0x3f')]:undefined)||''},{'name':_0x4113('0x4e'),'value':_0x4b2739[_0x4113('0x4e')]||(_0x4b2739['attrs']&&_0x4b2739[_0x4113('0x3e')][0x8]?_0x4b2739[_0x4113('0x3e')][0x8][_0x4113('0x3f')]:undefined)||''},{'name':'attrChatWebsites','value':_0x4b2739[_0x4113('0x4f')]||(_0x4b2739[_0x4113('0x3e')]&&_0x4b2739[_0x4113('0x3e')][0x9]?_0x4b2739[_0x4113('0x3e')][0x9][_0x4113('0x3f')]:undefined)||''}];case'multibar-chart':case _0x4113('0x50'):return[{'name':_0x4113('0x51'),'value':_0x4b2739['attrSerie1']||(_0x4b2739['attrs']&&_0x4b2739['attrs'][0x0]?_0x4b2739['attrs'][0x0]['value']:undefined)||_0x4113('0x52')},{'name':_0x4113('0x53'),'value':_0x4b2739[_0x4113('0x53')]||(_0x4b2739['attrs']&&_0x4b2739['attrs'][0x1]?_0x4b2739['attrs'][0x1]['value']:undefined)||null},{'name':_0x4113('0x54'),'value':_0x4b2739[_0x4113('0x54')]||(_0x4b2739[_0x4113('0x3e')]&&_0x4b2739['attrs'][0x2]?_0x4b2739[_0x4113('0x3e')][0x2][_0x4113('0x3f')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x4b2739[_0x4113('0x48')]||(_0x4b2739[_0x4113('0x3e')]&&_0x4b2739[_0x4113('0x3e')][0x3]?_0x4b2739['attrs'][0x3][_0x4113('0x3f')]:undefined)||[]},{'name':_0x4113('0x49'),'value':_0x4b2739[_0x4113('0x49')]||(_0x4b2739[_0x4113('0x3e')]&&_0x4b2739[_0x4113('0x3e')][0x4]?_0x4b2739[_0x4113('0x3e')][0x4][_0x4113('0x3f')]:undefined)||_0x4113('0x55')},{'name':'attrEmailAccounts','value':_0x4b2739[_0x4113('0x4a')]||(_0x4b2739[_0x4113('0x3e')]&&_0x4b2739['attrs'][0x5]?_0x4b2739[_0x4113('0x3e')][0x5]['value']:undefined)||''},{'name':_0x4113('0x4b'),'value':_0x4b2739['attrFaxAccounts']||(_0x4b2739[_0x4113('0x3e')]&&_0x4b2739[_0x4113('0x3e')][0x6]?_0x4b2739['attrs'][0x6][_0x4113('0x3f')]:undefined)||''},{'name':_0x4113('0x4c'),'value':_0x4b2739[_0x4113('0x4c')]||(_0x4b2739['attrs']&&_0x4b2739['attrs'][0x7]?_0x4b2739['attrs'][0x7][_0x4113('0x3f')]:undefined)||''},{'name':_0x4113('0x4d'),'value':_0x4b2739[_0x4113('0x4d')]||(_0x4b2739[_0x4113('0x3e')]&&_0x4b2739[_0x4113('0x3e')][0x8]?_0x4b2739[_0x4113('0x3e')][0x8]['value']:undefined)||''},{'name':_0x4113('0x4e'),'value':_0x4b2739['attrWhatsappAccounts']||(_0x4b2739[_0x4113('0x3e')]&&_0x4b2739[_0x4113('0x3e')][0x9]?_0x4b2739[_0x4113('0x3e')][0x9][_0x4113('0x3f')]:undefined)||''},{'name':_0x4113('0x4f'),'value':_0x4b2739[_0x4113('0x4f')]||(_0x4b2739['attrs']&&_0x4b2739[_0x4113('0x3e')][0xa]?_0x4b2739['attrs'][0xa][_0x4113('0x3f')]:undefined)||''}];case _0x4113('0x56'):return[{'name':_0x4113('0x57'),'type':_0x4b2739[_0x4113('0x58')]||(_0x4b2739[_0x4113('0x3e')]&&_0x4b2739['attrs'][0x0]?_0x4b2739[_0x4113('0x3e')][0x0][_0x4113('0x59')]:undefined)||null,'value':_0x4b2739[_0x4113('0x57')]||(_0x4b2739[_0x4113('0x3e')]&&_0x4b2739[_0x4113('0x3e')][0x0]?_0x4b2739['attrs'][0x0][_0x4113('0x3f')]:undefined)||null},{'name':_0x4113('0x5a'),'value':_0x4b2739[_0x4113('0x5a')]||(_0x4b2739['attrs']&&_0x4b2739[_0x4113('0x3e')][0x1]?_0x4b2739['attrs'][0x1][_0x4113('0x3f')]:undefined)||0x0}];default:return[];}}catch(_0x41c0d2){logger['error'](_0x4113('0x5b'),JSON[_0x4113('0x5c')](_0x41c0d2));return[];}}exports[_0x4113('0x5d')]=function(_0x370984,_0x573bd5){if(_0x370984[_0x4113('0x5e')]){_0x370984[_0x4113('0x5e')][_0x4113('0x3e')]=widgetAttributes(_0x370984[_0x4113('0x5e')]);}return db[_0x4113('0x31')][_0x4113('0x5d')](_0x370984[_0x4113('0x5e')],{})[_0x4113('0x27')](respondWithResult(_0x573bd5,0xc9))[_0x4113('0x3b')](handleError(_0x573bd5,null));};exports['update']=function(_0x53a52f,_0x58843f){if(_0x53a52f[_0x4113('0x5e')]['id']){delete _0x53a52f[_0x4113('0x5e')]['id'];}_0x53a52f[_0x4113('0x5e')][_0x4113('0x3e')]=widgetAttributes(_0x53a52f[_0x4113('0x5e')]);return db[_0x4113('0x31')]['find']({'where':{'id':_0x53a52f['params']['id']}})[_0x4113('0x27')](handleEntityNotFound(_0x58843f,null))['then'](saveUpdates(_0x53a52f[_0x4113('0x5e')],null))['then'](respondWithResult(_0x58843f,null))['catch'](handleError(_0x58843f,null));}; \ No newline at end of file +var _0x9485=['catch','type','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','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','./dashboardItem.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','error','stack','name','send','keys','DashboardItem','rawAttributes','query','filters','model','attributes','intersection','fields','length','includeAll','merge','find','destroy','params'];(function(_0x787d44,_0x36fea9){var _0x1c1430=function(_0x18bcd6){while(--_0x18bcd6){_0x787d44['push'](_0x787d44['shift']());}};_0x1c1430(++_0x36fea9);}(_0x9485,0x8b));var _0x5948=function(_0x13fbd6,_0x33957e){_0x13fbd6=_0x13fbd6-0x0;var _0x5a9d7d=_0x9485[_0x13fbd6];return _0x5a9d7d;};'use strict';var emlformat=require(_0x5948('0x0'));var rimraf=require(_0x5948('0x1'));var zipdir=require(_0x5948('0x2'));var jsonpatch=require(_0x5948('0x3'));var rp=require('request-promise');var moment=require(_0x5948('0x4'));var BPromise=require(_0x5948('0x5'));var Mustache=require(_0x5948('0x6'));var util=require('util');var path=require(_0x5948('0x7'));var sox=require(_0x5948('0x8'));var csv=require(_0x5948('0x9'));var ejs=require(_0x5948('0xa'));var fs=require('fs');var fs_extra=require(_0x5948('0xb'));var _=require(_0x5948('0xc'));var squel=require('squel');var crypto=require(_0x5948('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5948('0xe'));var toCsv=require(_0x5948('0x9'));var querystring=require('querystring');var Papa=require(_0x5948('0xf'));var Redis=require(_0x5948('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5948('0x11'));var as=require(_0x5948('0x12'));var hardwareService=require(_0x5948('0x13'));var logger=require(_0x5948('0x14'))(_0x5948('0x15'));var utils=require(_0x5948('0x16'));var config=require(_0x5948('0x17'));var licenseUtil=require(_0x5948('0x18'));var db=require(_0x5948('0x19'))['db'];config[_0x5948('0x1a')]=_[_0x5948('0x1b')](config['redis'],{'host':_0x5948('0x1c'),'port':0x18eb});var socket=require(_0x5948('0x1d'))(new Redis(config[_0x5948('0x1a')]));require(_0x5948('0x1e'))[_0x5948('0x1f')](socket);function respondWithStatusCode(_0x2fdc7d,_0x28b4f3){_0x28b4f3=_0x28b4f3||0xcc;return function(_0x36fd89){if(_0x36fd89){return _0x2fdc7d[_0x5948('0x20')](_0x28b4f3);}return _0x2fdc7d[_0x5948('0x21')](_0x28b4f3)[_0x5948('0x22')]();};}function respondWithResult(_0x203968,_0x1cc566){_0x1cc566=_0x1cc566||0xc8;return function(_0xf46ff8){if(_0xf46ff8){return _0x203968[_0x5948('0x21')](_0x1cc566)['json'](_0xf46ff8);}};}function respondWithFilteredResult(_0x4d711a,_0x5f42db){return function(_0xbdd336){if(_0xbdd336){var _0x284c1a=typeof _0x5f42db[_0x5948('0x23')]===_0x5948('0x24')&&typeof _0x5f42db[_0x5948('0x25')]===_0x5948('0x24');var _0x4d64ea=_0xbdd336[_0x5948('0x26')];var _0x1c7419=_0x284c1a?0x0:_0x5f42db[_0x5948('0x23')];var _0x392397=_0x284c1a?_0xbdd336['count']:_0x5f42db[_0x5948('0x23')]+_0x5f42db[_0x5948('0x25')];var _0xfd26da;if(_0x392397>=_0x4d64ea){_0x392397=_0x4d64ea;_0xfd26da=0xc8;}else{_0xfd26da=0xce;}_0x4d711a[_0x5948('0x21')](_0xfd26da);return _0x4d711a[_0x5948('0x27')](_0x5948('0x28'),_0x1c7419+'-'+_0x392397+'/'+_0x4d64ea)[_0x5948('0x29')](_0xbdd336);}return null;};}function patchUpdates(_0x319876){return function(_0x2cb132){try{jsonpatch[_0x5948('0x2a')](_0x2cb132,_0x319876,!![]);}catch(_0x5b5061){return BPromise[_0x5948('0x2b')](_0x5b5061);}return _0x2cb132['save']();};}function saveUpdates(_0x255228,_0x15b8da){return function(_0x47374f){if(_0x47374f){return _0x47374f[_0x5948('0x2c')](_0x255228)[_0x5948('0x2d')](function(_0x4164bf){return _0x4164bf;});}return null;};}function removeEntity(_0x1db063,_0xcfc1d7){return function(_0x5a3a68){if(_0x5a3a68){return _0x5a3a68['destroy']()['then'](function(){_0x1db063[_0x5948('0x21')](0xcc)[_0x5948('0x22')]();});}};}function handleEntityNotFound(_0xe4629a,_0x499c35){return function(_0x4a9630){if(!_0x4a9630){_0xe4629a[_0x5948('0x20')](0x194);}return _0x4a9630;};}function handleError(_0x47b55e,_0xc03d2c){_0xc03d2c=_0xc03d2c||0x1f4;return function(_0x5e5ef3){logger[_0x5948('0x2e')](_0x5e5ef3[_0x5948('0x2f')]);if(_0x5e5ef3[_0x5948('0x30')]){delete _0x5e5ef3[_0x5948('0x30')];}_0x47b55e[_0x5948('0x21')](_0xc03d2c)[_0x5948('0x31')](_0x5e5ef3);};}exports['show']=function(_0x47e0b6,_0x2c9219){var _0x67d341={'raw':![],'where':{'id':_0x47e0b6['params']['id']}},_0x4a6740={};_0x4a6740['model']=_[_0x5948('0x32')](db[_0x5948('0x33')][_0x5948('0x34')]);_0x4a6740[_0x5948('0x35')]=_['keys'](_0x47e0b6['query']);_0x4a6740[_0x5948('0x36')]=_['intersection'](_0x4a6740[_0x5948('0x37')],_0x4a6740['query']);_0x67d341[_0x5948('0x38')]=_[_0x5948('0x39')](_0x4a6740[_0x5948('0x37')],qs[_0x5948('0x3a')](_0x47e0b6[_0x5948('0x35')][_0x5948('0x3a')]));_0x67d341[_0x5948('0x38')]=_0x67d341[_0x5948('0x38')][_0x5948('0x3b')]?_0x67d341[_0x5948('0x38')]:_0x4a6740['model'];if(_0x47e0b6[_0x5948('0x35')][_0x5948('0x3c')]){_0x67d341['include']=[{'all':!![]}];}_0x67d341=_[_0x5948('0x3d')]({},_0x67d341,_0x47e0b6['options']);return db[_0x5948('0x33')][_0x5948('0x3e')](_0x67d341)['then'](handleEntityNotFound(_0x2c9219,null))[_0x5948('0x2d')](respondWithResult(_0x2c9219,null))['catch'](handleError(_0x2c9219,null));};exports[_0x5948('0x3f')]=function(_0x4293dc,_0x112a03){return db[_0x5948('0x33')][_0x5948('0x3e')]({'where':{'id':_0x4293dc[_0x5948('0x40')]['id']}})[_0x5948('0x2d')](handleEntityNotFound(_0x112a03,null))[_0x5948('0x2d')](removeEntity(_0x112a03,null))[_0x5948('0x41')](handleError(_0x112a03,null));};function widgetAttributes(_0x85f427){try{switch(_0x85f427[_0x5948('0x42')]){case'iframe':return[{'name':'attrUrl','value':_0x85f427['attrUrl']||(_0x85f427['attrs']&&_0x85f427['attrs'][0x0]?_0x85f427[_0x5948('0x43')][0x0][_0x5948('0x44')]:undefined)||_0x5948('0x45')}];case'custom':return[{'name':_0x5948('0x46'),'value':_0x85f427[_0x5948('0x46')]||(_0x85f427['attrs']&&_0x85f427[_0x5948('0x43')][0x0]?_0x85f427['attrs'][0x0][_0x5948('0x44')]:undefined)||''}];case _0x5948('0x47'):return[{'name':_0x5948('0x48'),'value':_0x85f427[_0x5948('0x48')]||(_0x85f427['attrs']&&_0x85f427[_0x5948('0x43')][0x0]?_0x85f427['attrs'][0x0][_0x5948('0x44')]:undefined)||_0x5948('0x49')},{'name':_0x5948('0x4a'),'value':_0x85f427[_0x5948('0x4a')]||(_0x85f427[_0x5948('0x43')]&&_0x85f427[_0x5948('0x43')][0x1]?_0x85f427[_0x5948('0x43')][0x1][_0x5948('0x44')]:undefined)||_0x5948('0x4b')},{'name':_0x5948('0x4c'),'value':_0x85f427[_0x5948('0x4c')]||(_0x85f427['attrs']&&_0x85f427[_0x5948('0x43')][0x2]?_0x85f427[_0x5948('0x43')][0x2][_0x5948('0x44')]:undefined)||0xc}];case _0x5948('0x4d'):return[{'name':_0x5948('0x4e'),'value':_0x85f427[_0x5948('0x4e')]||(_0x85f427[_0x5948('0x43')]&&_0x85f427[_0x5948('0x43')][0x0]?_0x85f427[_0x5948('0x43')][0x0][_0x5948('0x44')]:undefined)||_0x5948('0x4f')},{'name':'attrVoiceQueues','value':_0x85f427[_0x5948('0x50')]||(_0x85f427[_0x5948('0x43')]&&_0x85f427[_0x5948('0x43')][0x1]?_0x85f427[_0x5948('0x43')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x85f427[_0x5948('0x4c')]||(_0x85f427[_0x5948('0x43')]&&_0x85f427['attrs'][0x2]?_0x85f427[_0x5948('0x43')][0x2]['value']:undefined)||0x14},{'name':_0x5948('0x51'),'value':_0x85f427[_0x5948('0x51')]||(_0x85f427[_0x5948('0x43')]&&_0x85f427[_0x5948('0x43')][0x3]?_0x85f427['attrs'][0x3][_0x5948('0x44')]:undefined)||_0x5948('0x52')},{'name':_0x5948('0x53'),'value':_0x85f427['attrEmailAccounts']||(_0x85f427[_0x5948('0x43')]&&_0x85f427[_0x5948('0x43')][0x4]?_0x85f427['attrs'][0x4][_0x5948('0x44')]:undefined)||''},{'name':_0x5948('0x54'),'value':_0x85f427[_0x5948('0x54')]||(_0x85f427[_0x5948('0x43')]&&_0x85f427[_0x5948('0x43')][0x5]?_0x85f427['attrs'][0x5][_0x5948('0x44')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x85f427[_0x5948('0x55')]||(_0x85f427['attrs']&&_0x85f427[_0x5948('0x43')][0x6]?_0x85f427[_0x5948('0x43')][0x6][_0x5948('0x44')]:undefined)||''},{'name':_0x5948('0x56'),'value':_0x85f427[_0x5948('0x56')]||(_0x85f427[_0x5948('0x43')]&&_0x85f427[_0x5948('0x43')][0x7]?_0x85f427[_0x5948('0x43')][0x7][_0x5948('0x44')]:undefined)||''},{'name':_0x5948('0x57'),'value':_0x85f427[_0x5948('0x57')]||(_0x85f427[_0x5948('0x43')]&&_0x85f427[_0x5948('0x43')][0x8]?_0x85f427[_0x5948('0x43')][0x8][_0x5948('0x44')]:undefined)||''},{'name':_0x5948('0x58'),'value':_0x85f427[_0x5948('0x58')]||(_0x85f427[_0x5948('0x43')]&&_0x85f427[_0x5948('0x43')][0x9]?_0x85f427[_0x5948('0x43')][0x9][_0x5948('0x44')]:undefined)||''}];case _0x5948('0x59'):case _0x5948('0x5a'):return[{'name':_0x5948('0x5b'),'value':_0x85f427['attrSerie1']||(_0x85f427[_0x5948('0x43')]&&_0x85f427[_0x5948('0x43')][0x0]?_0x85f427['attrs'][0x0][_0x5948('0x44')]:undefined)||'total'},{'name':_0x5948('0x5c'),'value':_0x85f427[_0x5948('0x5c')]||(_0x85f427['attrs']&&_0x85f427[_0x5948('0x43')][0x1]?_0x85f427[_0x5948('0x43')][0x1]['value']:undefined)||null},{'name':_0x5948('0x5d'),'value':_0x85f427[_0x5948('0x5d')]||(_0x85f427[_0x5948('0x43')]&&_0x85f427[_0x5948('0x43')][0x2]?_0x85f427[_0x5948('0x43')][0x2][_0x5948('0x44')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x85f427['attrVoiceQueues']||(_0x85f427[_0x5948('0x43')]&&_0x85f427[_0x5948('0x43')][0x3]?_0x85f427['attrs'][0x3][_0x5948('0x44')]:undefined)||[]},{'name':_0x5948('0x51'),'value':_0x85f427['attrChannel']||(_0x85f427[_0x5948('0x43')]&&_0x85f427[_0x5948('0x43')][0x4]?_0x85f427[_0x5948('0x43')][0x4][_0x5948('0x44')]:undefined)||'voice'},{'name':_0x5948('0x53'),'value':_0x85f427[_0x5948('0x53')]||(_0x85f427[_0x5948('0x43')]&&_0x85f427[_0x5948('0x43')][0x5]?_0x85f427[_0x5948('0x43')][0x5]['value']:undefined)||''},{'name':_0x5948('0x54'),'value':_0x85f427[_0x5948('0x54')]||(_0x85f427[_0x5948('0x43')]&&_0x85f427[_0x5948('0x43')][0x6]?_0x85f427[_0x5948('0x43')][0x6][_0x5948('0x44')]:undefined)||''},{'name':_0x5948('0x55'),'value':_0x85f427[_0x5948('0x55')]||(_0x85f427['attrs']&&_0x85f427['attrs'][0x7]?_0x85f427[_0x5948('0x43')][0x7]['value']:undefined)||''},{'name':_0x5948('0x56'),'value':_0x85f427['attrOpenchannelAccounts']||(_0x85f427[_0x5948('0x43')]&&_0x85f427[_0x5948('0x43')][0x8]?_0x85f427[_0x5948('0x43')][0x8]['value']:undefined)||''},{'name':_0x5948('0x57'),'value':_0x85f427[_0x5948('0x57')]||(_0x85f427[_0x5948('0x43')]&&_0x85f427['attrs'][0x9]?_0x85f427[_0x5948('0x43')][0x9][_0x5948('0x44')]:undefined)||''},{'name':'attrChatWebsites','value':_0x85f427[_0x5948('0x58')]||(_0x85f427[_0x5948('0x43')]&&_0x85f427['attrs'][0xa]?_0x85f427[_0x5948('0x43')][0xa][_0x5948('0x44')]:undefined)||''}];case _0x5948('0x5e'):return[{'name':_0x5948('0x5f'),'type':_0x85f427[_0x5948('0x60')]||(_0x85f427[_0x5948('0x43')]&&_0x85f427['attrs'][0x0]?_0x85f427[_0x5948('0x43')][0x0]['type']:undefined)||null,'value':_0x85f427[_0x5948('0x5f')]||(_0x85f427[_0x5948('0x43')]&&_0x85f427['attrs'][0x0]?_0x85f427['attrs'][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x85f427[_0x5948('0x61')]||(_0x85f427[_0x5948('0x43')]&&_0x85f427['attrs'][0x1]?_0x85f427[_0x5948('0x43')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x47a5de){logger[_0x5948('0x2e')](_0x5948('0x62'),JSON[_0x5948('0x63')](_0x47a5de));return[];}}exports[_0x5948('0x64')]=function(_0x34bc6a,_0x3910b6){if(_0x34bc6a[_0x5948('0x65')]){_0x34bc6a[_0x5948('0x65')]['attrs']=widgetAttributes(_0x34bc6a[_0x5948('0x65')]);}return db[_0x5948('0x33')]['create'](_0x34bc6a['body'],{})[_0x5948('0x2d')](respondWithResult(_0x3910b6,0xc9))['catch'](handleError(_0x3910b6,null));};exports[_0x5948('0x2c')]=function(_0x585989,_0x18ac87){if(_0x585989[_0x5948('0x65')]['id']){delete _0x585989['body']['id'];}_0x585989['body']['attrs']=widgetAttributes(_0x585989[_0x5948('0x65')]);return db[_0x5948('0x33')][_0x5948('0x3e')]({'where':{'id':_0x585989[_0x5948('0x40')]['id']}})[_0x5948('0x2d')](handleEntityNotFound(_0x18ac87,null))[_0x5948('0x2d')](saveUpdates(_0x585989[_0x5948('0x65')],null))[_0x5948('0x2d')](respondWithResult(_0x18ac87,null))[_0x5948('0x41')](handleError(_0x18ac87,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 25bfba4..d03f550 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 _0x14ec=['remove','emit','hasOwnProperty','hook','exports','events','DashboardItem','setMaxListeners','save','update'];(function(_0x162939,_0x56203f){var _0x5bb0d8=function(_0x17d6d1){while(--_0x17d6d1){_0x162939['push'](_0x162939['shift']());}};_0x5bb0d8(++_0x56203f);}(_0x14ec,0x127));var _0xc14e=function(_0x2d1c98,_0x3a2c95){_0x2d1c98=_0x2d1c98-0x0;var _0x4063ae=_0x14ec[_0x2d1c98];return _0x4063ae;};'use strict';var EventEmitter=require(_0xc14e('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0xc14e('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xc14e('0x2')](0x0);var events={'afterCreate':_0xc14e('0x3'),'afterUpdate':_0xc14e('0x4'),'afterDestroy':_0xc14e('0x5')};function emitEvent(_0x2ddcc4){return function(_0x515956,_0x5f2682,_0x582857){DashboardItemEvents['emit'](_0x2ddcc4+':'+_0x515956['id'],_0x515956);DashboardItemEvents[_0xc14e('0x6')](_0x2ddcc4,_0x515956);_0x582857(null);};}for(var e in events){if(events[_0xc14e('0x7')](e)){var event=events[e];DashboardItem[_0xc14e('0x8')](e,emitEvent(event));}}module[_0xc14e('0x9')]=DashboardItemEvents; \ No newline at end of file +var _0x45a4=['remove','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x2e8418,_0x58c529){var _0x548fe6=function(_0x2b2877){while(--_0x2b2877){_0x2e8418['push'](_0x2e8418['shift']());}};_0x548fe6(++_0x58c529);}(_0x45a4,0xf3));var _0x445a=function(_0x15b2ff,_0x530d13){_0x15b2ff=_0x15b2ff-0x0;var _0x20b32a=_0x45a4[_0x15b2ff];return _0x20b32a;};'use strict';var EventEmitter=require(_0x445a('0x0'));var DashboardItem=require(_0x445a('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x445a('0x2')](0x0);var events={'afterCreate':_0x445a('0x3'),'afterUpdate':_0x445a('0x4'),'afterDestroy':_0x445a('0x5')};function emitEvent(_0x8956e2){return function(_0x4c8b6c,_0x29892d,_0x5dcce2){DashboardItemEvents['emit'](_0x8956e2+':'+_0x4c8b6c['id'],_0x4c8b6c);DashboardItemEvents['emit'](_0x8956e2,_0x4c8b6c);_0x5dcce2(null);};}for(var e in events){if(events[_0x445a('0x6')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x445a('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 a02b12b..34469dc 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 _0x48a9=['rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','util','../../config/logger','api','moment','path'];(function(_0x4ffb23,_0x174f2b){var _0x1b9def=function(_0x314599){while(--_0x314599){_0x4ffb23['push'](_0x4ffb23['shift']());}};_0x1b9def(++_0x174f2b);}(_0x48a9,0x8a));var _0x948a=function(_0x51ec61,_0xf9d1e3){_0x51ec61=_0x51ec61-0x0;var _0x223200=_0x48a9[_0x51ec61];return _0x223200;};'use strict';var _=require('lodash');var util=require(_0x948a('0x0'));var logger=require(_0x948a('0x1'))(_0x948a('0x2'));var moment=require(_0x948a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x948a('0x4'));var rimraf=require(_0x948a('0x5'));var config=require(_0x948a('0x6'));var attributes=require(_0x948a('0x7'));module[_0x948a('0x8')]=function(_0x165416,_0x53583c){return _0x165416[_0x948a('0x9')](_0x948a('0xa'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4703=['api','moment','bluebird','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash','util','../../config/logger'];(function(_0x75076e,_0x336899){var _0xd90ee4=function(_0x1b58f8){while(--_0x1b58f8){_0x75076e['push'](_0x75076e['shift']());}};_0xd90ee4(++_0x336899);}(_0x4703,0xda));var _0x3470=function(_0x16f73d,_0x574564){_0x16f73d=_0x16f73d-0x0;var _0x39bbcf=_0x4703[_0x16f73d];return _0x39bbcf;};'use strict';var _=require(_0x3470('0x0'));var util=require(_0x3470('0x1'));var logger=require(_0x3470('0x2'))(_0x3470('0x3'));var moment=require(_0x3470('0x4'));var BPromise=require(_0x3470('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3470('0x6'));var config=require(_0x3470('0x7'));var attributes=require(_0x3470('0x8'));module[_0x3470('0x9')]=function(_0x184fac,_0x55a269){return _0x184fac[_0x3470('0xa')](_0x3470('0xb'),attributes,{'tableName':_0x3470('0xc'),'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 a7832a2..2c29668 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 _0x9c51=['stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','./dashboardItem.socket','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s'];(function(_0x436d1f,_0x7c4d8b){var _0x2e8011=function(_0x879bbf){while(--_0x879bbf){_0x436d1f['push'](_0x436d1f['shift']());}};_0x2e8011(++_0x7c4d8b);}(_0x9c51,0xbc));var _0x19c5=function(_0xe44a3c,_0x5e86c9){_0xe44a3c=_0xe44a3c-0x0;var _0xafd907=_0x9c51[_0xe44a3c];return _0xafd907;};'use strict';var _=require(_0x19c5('0x0'));var util=require(_0x19c5('0x1'));var moment=require('moment');var BPromise=require(_0x19c5('0x2'));var rs=require(_0x19c5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x19c5('0x4'));var logger=require(_0x19c5('0x5'))(_0x19c5('0x6'));var config=require(_0x19c5('0x7'));var jayson=require(_0x19c5('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x19c5('0x9')]=_[_0x19c5('0xa')](config[_0x19c5('0x9')],{'host':_0x19c5('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x19c5('0x9')]));require(_0x19c5('0xc'))['register'](socket);function respondWithRpcPromise(_0x112786,_0x481141,_0x132cbd){return new BPromise(function(_0x12fdc7,_0x7bed38){return client[_0x19c5('0xd')](_0x112786,_0x132cbd)[_0x19c5('0xe')](function(_0x3d6d2c){logger[_0x19c5('0xf')](_0x19c5('0x10'),_0x481141,_0x19c5('0x11'));logger[_0x19c5('0x12')](_0x19c5('0x13'),_0x481141,_0x19c5('0x11'),JSON[_0x19c5('0x14')](_0x3d6d2c));if(_0x3d6d2c[_0x19c5('0x15')]){if(_0x3d6d2c[_0x19c5('0x15')][_0x19c5('0x16')]===0x1f4){logger[_0x19c5('0x15')](_0x19c5('0x10'),_0x481141,_0x3d6d2c[_0x19c5('0x15')][_0x19c5('0x17')]);return _0x7bed38(_0x3d6d2c['error'][_0x19c5('0x17')]);}logger[_0x19c5('0x15')](_0x19c5('0x10'),_0x481141,_0x3d6d2c[_0x19c5('0x15')][_0x19c5('0x17')]);return _0x12fdc7(_0x3d6d2c['error'][_0x19c5('0x17')]);}else{logger[_0x19c5('0xf')](_0x19c5('0x10'),_0x481141,_0x19c5('0x11'));_0x12fdc7(_0x3d6d2c[_0x19c5('0x18')][_0x19c5('0x17')]);}})[_0x19c5('0x19')](function(_0x46ad21){logger[_0x19c5('0x15')]('DashboardItem,\x20%s,\x20%s',_0x481141,_0x46ad21);_0x7bed38(_0x46ad21);});});} \ No newline at end of file +var _0x8392=['debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','then','info','request\x20sent'];(function(_0x10fc46,_0x3f47f1){var _0x4abc85=function(_0x189883){while(--_0x189883){_0x10fc46['push'](_0x10fc46['shift']());}};_0x4abc85(++_0x3f47f1);}(_0x8392,0xe9));var _0x2839=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x8392[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x2839('0x0'));var util=require(_0x2839('0x1'));var moment=require(_0x2839('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2839('0x3'));var db=require(_0x2839('0x4'))['db'];var utils=require(_0x2839('0x5'));var logger=require('../../config/logger')(_0x2839('0x6'));var config=require('../../config/environment');var jayson=require(_0x2839('0x7'));var client=jayson[_0x2839('0x8')][_0x2839('0x9')]({'port':0x232a});config[_0x2839('0xa')]=_[_0x2839('0xb')](config['redis'],{'host':_0x2839('0xc'),'port':0x18eb});var socket=require(_0x2839('0xd'))(new Redis(config[_0x2839('0xa')]));require(_0x2839('0xe'))[_0x2839('0xf')](socket);function respondWithRpcPromise(_0x511482,_0x19196d,_0xb658e5){return new BPromise(function(_0x4d1c32,_0x471975){return client['request'](_0x511482,_0xb658e5)[_0x2839('0x10')](function(_0x148638){logger[_0x2839('0x11')]('DashboardItem,\x20%s,\x20%s',_0x19196d,_0x2839('0x12'));logger[_0x2839('0x13')](_0x2839('0x14'),_0x19196d,_0x2839('0x12'),JSON[_0x2839('0x15')](_0x148638));if(_0x148638[_0x2839('0x16')]){if(_0x148638[_0x2839('0x16')][_0x2839('0x17')]===0x1f4){logger[_0x2839('0x16')](_0x2839('0x18'),_0x19196d,_0x148638[_0x2839('0x16')][_0x2839('0x19')]);return _0x471975(_0x148638[_0x2839('0x16')][_0x2839('0x19')]);}logger['error'](_0x2839('0x18'),_0x19196d,_0x148638['error'][_0x2839('0x19')]);return _0x4d1c32(_0x148638[_0x2839('0x16')]['message']);}else{logger[_0x2839('0x11')](_0x2839('0x18'),_0x19196d,'request\x20sent');_0x4d1c32(_0x148638[_0x2839('0x1a')][_0x2839('0x19')]);}})[_0x2839('0x1b')](function(_0x377e0d){logger['error']('DashboardItem,\x20%s,\x20%s',_0x19196d,_0x377e0d);_0x471975(_0x377e0d);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index aef4952..4cf0258 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 _0x5b65=['removeListener','register','length','./dashboardItem.events','remove','emit'];(function(_0x3ba2d8,_0x31a858){var _0x1af3fb=function(_0x424c5f){while(--_0x424c5f){_0x3ba2d8['push'](_0x3ba2d8['shift']());}};_0x1af3fb(++_0x31a858);}(_0x5b65,0x177));var _0x55b6=function(_0x5ee7ee,_0x4c3b18){_0x5ee7ee=_0x5ee7ee-0x0;var _0x578956=_0x5b65[_0x5ee7ee];return _0x578956;};'use strict';var DashboardItemEvents=require(_0x55b6('0x0'));var events=['save',_0x55b6('0x1'),'update'];function createListener(_0x2b2ca9,_0x45f850){return function(_0x6e2c30){_0x45f850[_0x55b6('0x2')](_0x2b2ca9,_0x6e2c30);};}function removeListener(_0x53959a,_0x36e136){return function(){DashboardItemEvents[_0x55b6('0x3')](_0x53959a,_0x36e136);};}exports[_0x55b6('0x4')]=function(_0x378135){for(var _0x104be4=0x0,_0x9def68=events[_0x55b6('0x5')];_0x104be4<_0x9def68;_0x104be4++){var _0x22e47c=events[_0x104be4];var _0x4a0911=createListener('dashboardItem:'+_0x22e47c,_0x378135);DashboardItemEvents['on'](_0x22e47c,_0x4a0911);}}; \ No newline at end of file +var _0x767b=['remove','removeListener','register','length','./dashboardItem.events','save'];(function(_0x175efd,_0x15bc06){var _0x3dd106=function(_0x1ca800){while(--_0x1ca800){_0x175efd['push'](_0x175efd['shift']());}};_0x3dd106(++_0x15bc06);}(_0x767b,0x136));var _0xb767=function(_0x1c1fda,_0x1b076d){_0x1c1fda=_0x1c1fda-0x0;var _0xd76da7=_0x767b[_0x1c1fda];return _0xd76da7;};'use strict';var DashboardItemEvents=require(_0xb767('0x0'));var events=[_0xb767('0x1'),_0xb767('0x2'),'update'];function createListener(_0x376c72,_0x34a815){return function(_0x2c8fee){_0x34a815['emit'](_0x376c72,_0x2c8fee);};}function removeListener(_0x1676ac,_0x35c336){return function(){DashboardItemEvents[_0xb767('0x3')](_0x1676ac,_0x35c336);};}exports[_0xb767('0x4')]=function(_0x2840a4){for(var _0x2161e2=0x0,_0x12efd7=events[_0xb767('0x5')];_0x2161e2<_0x12efd7;_0x2161e2++){var _0x3af8cc=events[_0x2161e2];var _0xdb6bcb=createListener('dashboardItem:'+_0x3af8cc,_0x2840a4);DashboardItemEvents['on'](_0x3af8cc,_0xdb6bcb);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 74b5583..e990e1f 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 _0xfc29=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','get','/:id','isAuthenticated','post','create','put','update','exports','multer','path'];(function(_0x43a954,_0x1d73d7){var _0x1973f6=function(_0x3de96c){while(--_0x3de96c){_0x43a954['push'](_0x43a954['shift']());}};_0x1973f6(++_0x1d73d7);}(_0xfc29,0x64));var _0x9fc2=function(_0x2e9c98,_0x53310c){_0x2e9c98=_0x2e9c98-0x0;var _0x1be665=_0xfc29[_0x2e9c98];return _0x1be665;};'use strict';var multer=require(_0x9fc2('0x0'));var util=require('util');var path=require(_0x9fc2('0x1'));var timeout=require(_0x9fc2('0x2'));var express=require(_0x9fc2('0x3'));var router=express[_0x9fc2('0x4')]();var fs_extra=require(_0x9fc2('0x5'));var auth=require(_0x9fc2('0x6'));var interaction=require(_0x9fc2('0x7'));var config=require('../../config/environment');var controller=require(_0x9fc2('0x8'));router[_0x9fc2('0x9')](_0x9fc2('0xa'),auth[_0x9fc2('0xb')](),controller['show']);router[_0x9fc2('0xc')]('/',auth[_0x9fc2('0xb')](),controller[_0x9fc2('0xd')]);router[_0x9fc2('0xe')]('/:id',auth[_0x9fc2('0xb')](),controller[_0x9fc2('0xf')]);router['delete'](_0x9fc2('0xa'),auth[_0x9fc2('0xb')](),controller['destroy']);module[_0x9fc2('0x10')]=router; \ No newline at end of file +var _0xea41=['/:id','post','isAuthenticated','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get'];(function(_0x4ad849,_0x57716e){var _0x3fba93=function(_0x499c5d){while(--_0x499c5d){_0x4ad849['push'](_0x4ad849['shift']());}};_0x3fba93(++_0x57716e);}(_0xea41,0x112));var _0x1ea4=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0xea41[_0x54d4a8];return _0x3b321b;};'use strict';var multer=require(_0x1ea4('0x0'));var util=require('util');var path=require(_0x1ea4('0x1'));var timeout=require(_0x1ea4('0x2'));var express=require(_0x1ea4('0x3'));var router=express[_0x1ea4('0x4')]();var fs_extra=require(_0x1ea4('0x5'));var auth=require(_0x1ea4('0x6'));var interaction=require(_0x1ea4('0x7'));var config=require(_0x1ea4('0x8'));var controller=require(_0x1ea4('0x9'));router[_0x1ea4('0xa')](_0x1ea4('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1ea4('0xc')]('/',auth[_0x1ea4('0xd')](),controller[_0x1ea4('0xe')]);router[_0x1ea4('0xf')](_0x1ea4('0xb'),auth[_0x1ea4('0xd')](),controller[_0x1ea4('0x10')]);router[_0x1ea4('0x11')](_0x1ea4('0xb'),auth[_0x1ea4('0xd')](),controller[_0x1ea4('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 03ecab3..fc631b0 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 _0x29e1=['exports','ENUM','first','second','third'];(function(_0x41dfaf,_0x57cb30){var _0x48e117=function(_0x546459){while(--_0x546459){_0x41dfaf['push'](_0x41dfaf['shift']());}};_0x48e117(++_0x57cb30);}(_0x29e1,0xeb));var _0x129e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x29e1[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x129e('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x129e('0x1')](_0x129e('0x2'),_0x129e('0x3'),_0x129e('0x4')),'allowNull':![],'defaultValue':_0x129e('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xae9b=['third','exports','ENUM','second'];(function(_0x48bfcd,_0x270283){var _0xa9c013=function(_0x53ba70){while(--_0x53ba70){_0x48bfcd['push'](_0x48bfcd['shift']());}};_0xa9c013(++_0x270283);}(_0xae9b,0x69));var _0xbae9=function(_0x4ee193,_0x9751ac){_0x4ee193=_0x4ee193-0x0;var _0x40fce1=_0xae9b[_0x4ee193];return _0x40fce1;};'use strict';var Sequelize=require('sequelize');module[_0xbae9('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0xbae9('0x1')]('first',_0xbae9('0x2'),_0xbae9('0x3')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index b735402..c262720 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 _0x0736=['pick','filter','merge','where','VIRTUAL','options','Disposition','includeAll','include','rows','show','catch','create','body','user','get','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','then','destroy','Dispositions','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x2af8f3,_0x128153){var _0x5a04d8=function(_0x29999e){while(--_0x29999e){_0x2af8f3['push'](_0x2af8f3['shift']());}};_0x5a04d8(++_0x128153);}(_0x0736,0x1c0));var _0x6073=function(_0x5e0dfe,_0x1fb095){_0x5e0dfe=_0x5e0dfe-0x0;var _0x41b5a2=_0x0736[_0x5e0dfe];return _0x41b5a2;};'use strict';var emlformat=require(_0x6073('0x0'));var rimraf=require(_0x6073('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6073('0x2'));var rp=require(_0x6073('0x3'));var moment=require(_0x6073('0x4'));var BPromise=require(_0x6073('0x5'));var Mustache=require(_0x6073('0x6'));var util=require(_0x6073('0x7'));var path=require(_0x6073('0x8'));var sox=require(_0x6073('0x9'));var csv=require(_0x6073('0xa'));var ejs=require(_0x6073('0xb'));var fs=require('fs');var fs_extra=require(_0x6073('0xc'));var _=require(_0x6073('0xd'));var squel=require(_0x6073('0xe'));var crypto=require(_0x6073('0xf'));var jsforce=require(_0x6073('0x10'));var deskjs=require(_0x6073('0x11'));var toCsv=require(_0x6073('0xa'));var querystring=require('querystring');var Papa=require(_0x6073('0x12'));var Redis=require(_0x6073('0x13'));var authService=require(_0x6073('0x14'));var qs=require(_0x6073('0x15'));var as=require(_0x6073('0x16'));var hardwareService=require(_0x6073('0x17'));var logger=require(_0x6073('0x18'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6073('0x19'))['db'];function respondWithStatusCode(_0xbb20d4,_0x4ceaa8){_0x4ceaa8=_0x4ceaa8||0xcc;return function(_0x305dd0){if(_0x305dd0){return _0xbb20d4[_0x6073('0x1a')](_0x4ceaa8);}return _0xbb20d4[_0x6073('0x1b')](_0x4ceaa8)[_0x6073('0x1c')]();};}function respondWithResult(_0x109dc5,_0x32fb98){_0x32fb98=_0x32fb98||0xc8;return function(_0x2f1baa){if(_0x2f1baa){return _0x109dc5[_0x6073('0x1b')](_0x32fb98)[_0x6073('0x1d')](_0x2f1baa);}};}function respondWithFilteredResult(_0xcb3c36,_0x5a6ae0){return function(_0x43a2fe){if(_0x43a2fe){var _0x45637e=typeof _0x5a6ae0['offset']===_0x6073('0x1e')&&typeof _0x5a6ae0[_0x6073('0x1f')]===_0x6073('0x1e');var _0x50d889=_0x43a2fe[_0x6073('0x20')];var _0x43b234=_0x45637e?0x0:_0x5a6ae0[_0x6073('0x21')];var _0x6ebd7a=_0x45637e?_0x43a2fe['count']:_0x5a6ae0['offset']+_0x5a6ae0[_0x6073('0x1f')];var _0x4a6299;if(_0x6ebd7a>=_0x50d889){_0x6ebd7a=_0x50d889;_0x4a6299=0xc8;}else{_0x4a6299=0xce;}_0xcb3c36['status'](_0x4a6299);return _0xcb3c36[_0x6073('0x22')](_0x6073('0x23'),_0x43b234+'-'+_0x6ebd7a+'/'+_0x50d889)[_0x6073('0x1d')](_0x43a2fe);}return null;};}function patchUpdates(_0x16ee59){return function(_0x1a95b1){try{jsonpatch['apply'](_0x1a95b1,_0x16ee59,!![]);}catch(_0x1794cf){return BPromise['reject'](_0x1794cf);}return _0x1a95b1['save']();};}function saveUpdates(_0x12a6d9,_0x2defaf){return function(_0x2228ca){if(_0x2228ca){return _0x2228ca['update'](_0x12a6d9)[_0x6073('0x24')](function(_0x3db8c8){return _0x3db8c8;});}return null;};}function removeEntity(_0x10589d,_0x3d454f){return function(_0x21dd44){if(_0x21dd44){return _0x21dd44[_0x6073('0x25')]()['then'](function(){var _0x321f4d=_0x21dd44['get']({'plain':!![]});var _0xd58a15=_0x6073('0x26');return db[_0x6073('0x27')][_0x6073('0x25')]({'where':{'type':_0xd58a15,'resourceId':_0x321f4d['id']}})[_0x6073('0x24')](function(){return _0x21dd44;});})[_0x6073('0x24')](function(){_0x10589d[_0x6073('0x1b')](0xcc)[_0x6073('0x1c')]();});}};}function handleEntityNotFound(_0x205492,_0x4def74){return function(_0x1d3d35){if(!_0x1d3d35){_0x205492['sendStatus'](0x194);}return _0x1d3d35;};}function handleError(_0x5a8564,_0x2bb3ec){_0x2bb3ec=_0x2bb3ec||0x1f4;return function(_0x3dd707){logger[_0x6073('0x28')](_0x3dd707[_0x6073('0x29')]);if(_0x3dd707[_0x6073('0x2a')]){delete _0x3dd707[_0x6073('0x2a')];}_0x5a8564[_0x6073('0x1b')](_0x2bb3ec)[_0x6073('0x2b')](_0x3dd707);};}exports[_0x6073('0x2c')]=function(_0x5ad864,_0x5c01c1){var _0x1fade1={},_0x20cbfe={},_0x34fe56={'count':0x0,'rows':[]};var _0x348bad=_[_0x6073('0x2d')](db['Disposition'][_0x6073('0x2e')],function(_0x200fad){return{'name':_0x200fad[_0x6073('0x2f')],'type':_0x200fad[_0x6073('0x30')][_0x6073('0x31')]};});_0x20cbfe['model']=_[_0x6073('0x2d')](_0x348bad,_0x6073('0x2a'));_0x20cbfe[_0x6073('0x32')]=_[_0x6073('0x33')](_0x5ad864[_0x6073('0x32')]);_0x20cbfe[_0x6073('0x34')]=_['intersection'](_0x20cbfe['model'],_0x20cbfe['query']);_0x1fade1[_0x6073('0x35')]=_[_0x6073('0x36')](_0x20cbfe[_0x6073('0x37')],qs['fields'](_0x5ad864['query'][_0x6073('0x38')]));_0x1fade1['attributes']=_0x1fade1['attributes'][_0x6073('0x39')]?_0x1fade1[_0x6073('0x35')]:_0x20cbfe[_0x6073('0x37')];if(!_0x5ad864['query'][_0x6073('0x3a')](_0x6073('0x3b'))){_0x1fade1[_0x6073('0x1f')]=qs[_0x6073('0x1f')](_0x5ad864[_0x6073('0x32')]['limit']);_0x1fade1[_0x6073('0x21')]=qs['offset'](_0x5ad864['query'][_0x6073('0x21')]);}_0x1fade1[_0x6073('0x3c')]=qs[_0x6073('0x3d')](_0x5ad864[_0x6073('0x32')][_0x6073('0x3d')]);_0x1fade1['where']=qs['filters'](_[_0x6073('0x3e')](_0x5ad864[_0x6073('0x32')],_0x20cbfe[_0x6073('0x34')]),_0x348bad);if(_0x5ad864[_0x6073('0x32')][_0x6073('0x3f')]){_0x1fade1['where']=_[_0x6073('0x40')](_0x1fade1[_0x6073('0x41')],{'$or':_[_0x6073('0x2d')](_0x348bad,function(_0x3b3f25){if(_0x3b3f25[_0x6073('0x30')]!==_0x6073('0x42')){var _0x55026d={};_0x55026d[_0x3b3f25[_0x6073('0x2a')]]={'$like':'%'+_0x5ad864[_0x6073('0x32')][_0x6073('0x3f')]+'%'};return _0x55026d;}})});}_0x1fade1=_[_0x6073('0x40')]({},_0x1fade1,_0x5ad864[_0x6073('0x43')]);var _0x3b38ee={'where':_0x1fade1[_0x6073('0x41')]};return db[_0x6073('0x44')][_0x6073('0x20')](_0x3b38ee)[_0x6073('0x24')](function(_0x277ce0){_0x34fe56[_0x6073('0x20')]=_0x277ce0;if(_0x5ad864[_0x6073('0x32')][_0x6073('0x45')]){_0x1fade1[_0x6073('0x46')]=[{'all':!![]}];}return db[_0x6073('0x44')]['findAll'](_0x1fade1);})['then'](function(_0x22952c){_0x34fe56[_0x6073('0x47')]=_0x22952c;return _0x34fe56;})[_0x6073('0x24')](respondWithFilteredResult(_0x5c01c1,_0x1fade1))['catch'](handleError(_0x5c01c1,null));};exports[_0x6073('0x48')]=function(_0x4870e4,_0x1b14d3){var _0x14e3a7={'raw':!![],'where':{'id':_0x4870e4['params']['id']}},_0x3d1a8d={};_0x3d1a8d[_0x6073('0x37')]=_[_0x6073('0x33')](db[_0x6073('0x44')][_0x6073('0x2e')]);_0x3d1a8d[_0x6073('0x32')]=_[_0x6073('0x33')](_0x4870e4['query']);_0x3d1a8d[_0x6073('0x34')]=_[_0x6073('0x36')](_0x3d1a8d[_0x6073('0x37')],_0x3d1a8d[_0x6073('0x32')]);_0x14e3a7[_0x6073('0x35')]=_[_0x6073('0x36')](_0x3d1a8d['model'],qs[_0x6073('0x38')](_0x4870e4[_0x6073('0x32')]['fields']));_0x14e3a7[_0x6073('0x35')]=_0x14e3a7[_0x6073('0x35')][_0x6073('0x39')]?_0x14e3a7[_0x6073('0x35')]:_0x3d1a8d['model'];if(_0x4870e4[_0x6073('0x32')][_0x6073('0x45')]){_0x14e3a7[_0x6073('0x46')]=[{'all':!![]}];}_0x14e3a7=_[_0x6073('0x40')]({},_0x14e3a7,_0x4870e4[_0x6073('0x43')]);return db[_0x6073('0x44')]['find'](_0x14e3a7)[_0x6073('0x24')](handleEntityNotFound(_0x1b14d3,null))['then'](respondWithResult(_0x1b14d3,null))[_0x6073('0x49')](handleError(_0x1b14d3,null));};exports[_0x6073('0x4a')]=function(_0x3c5af9,_0x5a5270){return db[_0x6073('0x44')][_0x6073('0x4a')](_0x3c5af9[_0x6073('0x4b')],{})[_0x6073('0x24')](function(_0x320c8e){var _0x16f9c0=_0x3c5af9[_0x6073('0x4c')][_0x6073('0x4d')]({'plain':!![]});if(!_0x16f9c0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x16f9c0[_0x6073('0x4e')]===_0x6073('0x4c')){var _0x5c67a1=_0x320c8e[_0x6073('0x4d')]({'plain':!![]});var _0xc6cf2f='Dispositions';return db[_0x6073('0x4f')]['find']({'where':{'name':_0xc6cf2f,'userProfileId':_0x16f9c0['userProfileId']},'raw':!![]})[_0x6073('0x24')](function(_0x22a5a6){if(_0x22a5a6&&_0x22a5a6[_0x6073('0x50')]===0x0){return db[_0x6073('0x27')][_0x6073('0x4a')]({'name':_0x5c67a1[_0x6073('0x2a')],'resourceId':_0x5c67a1['id'],'type':_0x22a5a6[_0x6073('0x2a')],'sectionId':_0x22a5a6['id']},{})[_0x6073('0x24')](function(){return _0x320c8e;});}else{return _0x320c8e;}})[_0x6073('0x49')](function(_0x575d81){logger[_0x6073('0x28')](_0x6073('0x51'),_0x575d81);throw _0x575d81;});}return _0x320c8e;})[_0x6073('0x24')](respondWithResult(_0x5a5270,0xc9))['catch'](handleError(_0x5a5270,null));};exports[_0x6073('0x52')]=function(_0x53853d,_0x9c3577){if(_0x53853d[_0x6073('0x4b')]['id']){delete _0x53853d['body']['id'];}return db[_0x6073('0x44')][_0x6073('0x53')]({'where':{'id':_0x53853d[_0x6073('0x54')]['id']}})['then'](handleEntityNotFound(_0x9c3577,null))[_0x6073('0x24')](saveUpdates(_0x53853d['body'],null))[_0x6073('0x24')](respondWithResult(_0x9c3577,null))[_0x6073('0x49')](handleError(_0x9c3577,null));};exports[_0x6073('0x25')]=function(_0xf39498,_0x461045){return db[_0x6073('0x44')][_0x6073('0x53')]({'where':{'id':_0xf39498['params']['id']}})[_0x6073('0x24')](handleEntityNotFound(_0x461045,null))[_0x6073('0x24')](removeEntity(_0x461045,null))[_0x6073('0x49')](handleError(_0x461045,null));}; \ No newline at end of file +var _0x9a8b=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','rows','catch','show','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','destroy','then','get','Dispositions','UserProfileResource','error','name','send','index','map','Disposition','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x31ae86,_0x5ecc15){var _0x193c45=function(_0x455fb1){while(--_0x455fb1){_0x31ae86['push'](_0x31ae86['shift']());}};_0x193c45(++_0x5ecc15);}(_0x9a8b,0x1ba));var _0xb9a8=function(_0x5d492b,_0x208784){_0x5d492b=_0x5d492b-0x0;var _0x323012=_0x9a8b[_0x5d492b];return _0x323012;};'use strict';var emlformat=require(_0xb9a8('0x0'));var rimraf=require(_0xb9a8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb9a8('0x2'));var rp=require(_0xb9a8('0x3'));var moment=require(_0xb9a8('0x4'));var BPromise=require(_0xb9a8('0x5'));var Mustache=require(_0xb9a8('0x6'));var util=require(_0xb9a8('0x7'));var path=require(_0xb9a8('0x8'));var sox=require(_0xb9a8('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb9a8('0xa'));var _=require(_0xb9a8('0xb'));var squel=require(_0xb9a8('0xc'));var crypto=require(_0xb9a8('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb9a8('0xe'));var Papa=require(_0xb9a8('0xf'));var Redis=require(_0xb9a8('0x10'));var authService=require(_0xb9a8('0x11'));var qs=require(_0xb9a8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb9a8('0x13'));var logger=require(_0xb9a8('0x14'))(_0xb9a8('0x15'));var utils=require(_0xb9a8('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb9a8('0x17'));var db=require(_0xb9a8('0x18'))['db'];function respondWithStatusCode(_0x12e9bb,_0xd32cb){_0xd32cb=_0xd32cb||0xcc;return function(_0x62dbfb){if(_0x62dbfb){return _0x12e9bb[_0xb9a8('0x19')](_0xd32cb);}return _0x12e9bb[_0xb9a8('0x1a')](_0xd32cb)[_0xb9a8('0x1b')]();};}function respondWithResult(_0x1c882a,_0x3ad966){_0x3ad966=_0x3ad966||0xc8;return function(_0x3459bb){if(_0x3459bb){return _0x1c882a[_0xb9a8('0x1a')](_0x3ad966)[_0xb9a8('0x1c')](_0x3459bb);}};}function respondWithFilteredResult(_0x93f5a2,_0x51558b){return function(_0x290eb8){if(_0x290eb8){var _0x478395=typeof _0x51558b[_0xb9a8('0x1d')]===_0xb9a8('0x1e')&&typeof _0x51558b[_0xb9a8('0x1f')]==='undefined';var _0x5d6efe=_0x290eb8[_0xb9a8('0x20')];var _0x5c38ea=_0x478395?0x0:_0x51558b[_0xb9a8('0x1d')];var _0x4bf1a8=_0x478395?_0x290eb8[_0xb9a8('0x20')]:_0x51558b['offset']+_0x51558b[_0xb9a8('0x1f')];var _0x2b9cfd;if(_0x4bf1a8>=_0x5d6efe){_0x4bf1a8=_0x5d6efe;_0x2b9cfd=0xc8;}else{_0x2b9cfd=0xce;}_0x93f5a2[_0xb9a8('0x1a')](_0x2b9cfd);return _0x93f5a2[_0xb9a8('0x21')]('Content-Range',_0x5c38ea+'-'+_0x4bf1a8+'/'+_0x5d6efe)[_0xb9a8('0x1c')](_0x290eb8);}return null;};}function patchUpdates(_0x4a5365){return function(_0x1856ed){try{jsonpatch['apply'](_0x1856ed,_0x4a5365,!![]);}catch(_0x433db4){return BPromise[_0xb9a8('0x22')](_0x433db4);}return _0x1856ed[_0xb9a8('0x23')]();};}function saveUpdates(_0x44e8d8,_0x4da881){return function(_0x296210){if(_0x296210){return _0x296210[_0xb9a8('0x24')](_0x44e8d8)['then'](function(_0x5f4388){return _0x5f4388;});}return null;};}function removeEntity(_0x261cac,_0x3fab8d){return function(_0x5ae6a5){if(_0x5ae6a5){return _0x5ae6a5[_0xb9a8('0x25')]()[_0xb9a8('0x26')](function(){var _0xbc1134=_0x5ae6a5[_0xb9a8('0x27')]({'plain':!![]});var _0x11c390=_0xb9a8('0x28');return db[_0xb9a8('0x29')][_0xb9a8('0x25')]({'where':{'type':_0x11c390,'resourceId':_0xbc1134['id']}})[_0xb9a8('0x26')](function(){return _0x5ae6a5;});})[_0xb9a8('0x26')](function(){_0x261cac[_0xb9a8('0x1a')](0xcc)[_0xb9a8('0x1b')]();});}};}function handleEntityNotFound(_0xffac1b,_0x58c25e){return function(_0x42352b){if(!_0x42352b){_0xffac1b[_0xb9a8('0x19')](0x194);}return _0x42352b;};}function handleError(_0x30f001,_0xf303ae){_0xf303ae=_0xf303ae||0x1f4;return function(_0x1adabb){logger[_0xb9a8('0x2a')](_0x1adabb['stack']);if(_0x1adabb[_0xb9a8('0x2b')]){delete _0x1adabb[_0xb9a8('0x2b')];}_0x30f001[_0xb9a8('0x1a')](_0xf303ae)[_0xb9a8('0x2c')](_0x1adabb);};}exports[_0xb9a8('0x2d')]=function(_0x33744b,_0x53f9ad){var _0x566912={},_0x174e2a={},_0x2b5201={'count':0x0,'rows':[]};var _0x166d69=_[_0xb9a8('0x2e')](db[_0xb9a8('0x2f')][_0xb9a8('0x30')],function(_0x2708d0){return{'name':_0x2708d0[_0xb9a8('0x31')],'type':_0x2708d0[_0xb9a8('0x32')][_0xb9a8('0x33')]};});_0x174e2a[_0xb9a8('0x34')]=_[_0xb9a8('0x2e')](_0x166d69,'name');_0x174e2a[_0xb9a8('0x35')]=_[_0xb9a8('0x36')](_0x33744b[_0xb9a8('0x35')]);_0x174e2a[_0xb9a8('0x37')]=_[_0xb9a8('0x38')](_0x174e2a[_0xb9a8('0x34')],_0x174e2a['query']);_0x566912[_0xb9a8('0x39')]=_['intersection'](_0x174e2a[_0xb9a8('0x34')],qs[_0xb9a8('0x3a')](_0x33744b['query']['fields']));_0x566912['attributes']=_0x566912['attributes'][_0xb9a8('0x3b')]?_0x566912[_0xb9a8('0x39')]:_0x174e2a[_0xb9a8('0x34')];if(!_0x33744b[_0xb9a8('0x35')][_0xb9a8('0x3c')](_0xb9a8('0x3d'))){_0x566912[_0xb9a8('0x1f')]=qs['limit'](_0x33744b[_0xb9a8('0x35')][_0xb9a8('0x1f')]);_0x566912[_0xb9a8('0x1d')]=qs['offset'](_0x33744b[_0xb9a8('0x35')][_0xb9a8('0x1d')]);}_0x566912[_0xb9a8('0x3e')]=qs['sort'](_0x33744b[_0xb9a8('0x35')][_0xb9a8('0x3f')]);_0x566912[_0xb9a8('0x40')]=qs[_0xb9a8('0x37')](_[_0xb9a8('0x41')](_0x33744b[_0xb9a8('0x35')],_0x174e2a['filters']),_0x166d69);if(_0x33744b[_0xb9a8('0x35')]['filter']){_0x566912['where']=_['merge'](_0x566912[_0xb9a8('0x40')],{'$or':_[_0xb9a8('0x2e')](_0x166d69,function(_0x5c5925){if(_0x5c5925[_0xb9a8('0x32')]!==_0xb9a8('0x42')){var _0x4d4401={};_0x4d4401[_0x5c5925[_0xb9a8('0x2b')]]={'$like':'%'+_0x33744b['query'][_0xb9a8('0x43')]+'%'};return _0x4d4401;}})});}_0x566912=_[_0xb9a8('0x44')]({},_0x566912,_0x33744b[_0xb9a8('0x45')]);var _0x5d2304={'where':_0x566912['where']};return db[_0xb9a8('0x2f')][_0xb9a8('0x20')](_0x5d2304)[_0xb9a8('0x26')](function(_0x18d3be){_0x2b5201['count']=_0x18d3be;if(_0x33744b['query']['includeAll']){_0x566912[_0xb9a8('0x46')]=[{'all':!![]}];}return db[_0xb9a8('0x2f')][_0xb9a8('0x47')](_0x566912);})[_0xb9a8('0x26')](function(_0x5e7427){_0x2b5201[_0xb9a8('0x48')]=_0x5e7427;return _0x2b5201;})[_0xb9a8('0x26')](respondWithFilteredResult(_0x53f9ad,_0x566912))[_0xb9a8('0x49')](handleError(_0x53f9ad,null));};exports[_0xb9a8('0x4a')]=function(_0x52dd7a,_0x424882){var _0xde376d={'raw':!![],'where':{'id':_0x52dd7a['params']['id']}},_0x55431e={};_0x55431e[_0xb9a8('0x34')]=_[_0xb9a8('0x36')](db[_0xb9a8('0x2f')]['rawAttributes']);_0x55431e['query']=_[_0xb9a8('0x36')](_0x52dd7a[_0xb9a8('0x35')]);_0x55431e[_0xb9a8('0x37')]=_[_0xb9a8('0x38')](_0x55431e['model'],_0x55431e['query']);_0xde376d[_0xb9a8('0x39')]=_[_0xb9a8('0x38')](_0x55431e['model'],qs['fields'](_0x52dd7a[_0xb9a8('0x35')]['fields']));_0xde376d['attributes']=_0xde376d[_0xb9a8('0x39')][_0xb9a8('0x3b')]?_0xde376d[_0xb9a8('0x39')]:_0x55431e['model'];if(_0x52dd7a[_0xb9a8('0x35')]['includeAll']){_0xde376d[_0xb9a8('0x46')]=[{'all':!![]}];}_0xde376d=_[_0xb9a8('0x44')]({},_0xde376d,_0x52dd7a[_0xb9a8('0x45')]);return db[_0xb9a8('0x2f')][_0xb9a8('0x4b')](_0xde376d)['then'](handleEntityNotFound(_0x424882,null))['then'](respondWithResult(_0x424882,null))[_0xb9a8('0x49')](handleError(_0x424882,null));};exports['create']=function(_0x38a619,_0x25b298){return db[_0xb9a8('0x2f')]['create'](_0x38a619['body'],{})[_0xb9a8('0x26')](function(_0x427923){var _0x1180e7=_0x38a619[_0xb9a8('0x4c')][_0xb9a8('0x27')]({'plain':!![]});if(!_0x1180e7)throw new Error(_0xb9a8('0x4d'));if(_0x1180e7['role']===_0xb9a8('0x4c')){var _0x59e766=_0x427923[_0xb9a8('0x27')]({'plain':!![]});var _0x4be882=_0xb9a8('0x28');return db[_0xb9a8('0x4e')][_0xb9a8('0x4b')]({'where':{'name':_0x4be882,'userProfileId':_0x1180e7['userProfileId']},'raw':!![]})[_0xb9a8('0x26')](function(_0x22a930){if(_0x22a930&&_0x22a930[_0xb9a8('0x4f')]===0x0){return db[_0xb9a8('0x29')]['create']({'name':_0x59e766['name'],'resourceId':_0x59e766['id'],'type':_0x22a930[_0xb9a8('0x2b')],'sectionId':_0x22a930['id']},{})['then'](function(){return _0x427923;});}else{return _0x427923;}})[_0xb9a8('0x49')](function(_0x578cd5){logger[_0xb9a8('0x2a')](_0xb9a8('0x50'),_0x578cd5);throw _0x578cd5;});}return _0x427923;})['then'](respondWithResult(_0x25b298,0xc9))['catch'](handleError(_0x25b298,null));};exports[_0xb9a8('0x24')]=function(_0x43b08a,_0x21bece){if(_0x43b08a[_0xb9a8('0x51')]['id']){delete _0x43b08a['body']['id'];}return db[_0xb9a8('0x2f')]['find']({'where':{'id':_0x43b08a[_0xb9a8('0x52')]['id']}})['then'](handleEntityNotFound(_0x21bece,null))['then'](saveUpdates(_0x43b08a[_0xb9a8('0x51')],null))[_0xb9a8('0x26')](respondWithResult(_0x21bece,null))[_0xb9a8('0x49')](handleError(_0x21bece,null));};exports['destroy']=function(_0xd14782,_0xc17bf4){return db[_0xb9a8('0x2f')][_0xb9a8('0x4b')]({'where':{'id':_0xd14782[_0xb9a8('0x52')]['id']}})['then'](handleEntityNotFound(_0xc17bf4,null))['then'](removeEntity(_0xc17bf4,null))[_0xb9a8('0x49')](handleError(_0xc17bf4,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 3db26d5..3c57bab 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 _0x4242=['name_mail','name_sms','SmsAccountId','name_fax','name_openchannel','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','define','tools_dispositions','name_voice','name','name_chat','ChatWebsiteId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4242,0xcb));var _0x2424=function(_0x3806b0,_0x26b634){_0x3806b0=_0x3806b0-0x0;var _0x5e898e=_0x4242[_0x3806b0];return _0x5e898e;};'use strict';var _=require(_0x2424('0x0'));var util=require('util');var logger=require(_0x2424('0x1'))(_0x2424('0x2'));var moment=require(_0x2424('0x3'));var BPromise=require(_0x2424('0x4'));var rp=require(_0x2424('0x5'));var fs=require('fs');var path=require(_0x2424('0x6'));var rimraf=require(_0x2424('0x7'));var config=require(_0x2424('0x8'));var attributes=require(_0x2424('0x9'));module[_0x2424('0xa')]=function(_0x59d949,_0x474397){return _0x59d949[_0x2424('0xb')]('Disposition',attributes,{'tableName':_0x2424('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x2424('0xd'),'fields':[_0x2424('0xe'),'ListId']},{'unique':!![],'name':_0x2424('0xf'),'fields':['name',_0x2424('0x10')]},{'unique':!![],'name':_0x2424('0x11'),'fields':[_0x2424('0xe'),'MailAccountId']},{'unique':!![],'name':_0x2424('0x12'),'fields':[_0x2424('0xe'),_0x2424('0x13')]},{'unique':!![],'name':_0x2424('0x14'),'fields':[_0x2424('0xe'),'FaxAccountId']},{'unique':!![],'name':_0x2424('0x15'),'fields':['name','OpenchannelAccountId']},{'unique':!![],'name':'name_whatsapp','fields':[_0x2424('0xe'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8bc9=['api','moment','bluebird','path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','ListId','name_chat','ChatWebsiteId','name_mail','name','SmsAccountId','name_fax','FaxAccountId','WhatsappAccountId','lodash','util','../../config/logger'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x8bc9,0x189));var _0x98bc=function(_0x239fde,_0x23afac){_0x239fde=_0x239fde-0x0;var _0x48d053=_0x8bc9[_0x239fde];return _0x48d053;};'use strict';var _=require(_0x98bc('0x0'));var util=require(_0x98bc('0x1'));var logger=require(_0x98bc('0x2'))(_0x98bc('0x3'));var moment=require(_0x98bc('0x4'));var BPromise=require(_0x98bc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x98bc('0x6'));var rimraf=require(_0x98bc('0x7'));var config=require(_0x98bc('0x8'));var attributes=require(_0x98bc('0x9'));module[_0x98bc('0xa')]=function(_0x2c83dc,_0x127016){return _0x2c83dc[_0x98bc('0xb')](_0x98bc('0xc'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':['name',_0x98bc('0xd')]},{'unique':!![],'name':_0x98bc('0xe'),'fields':['name',_0x98bc('0xf')]},{'unique':!![],'name':_0x98bc('0x10'),'fields':[_0x98bc('0x11'),'MailAccountId']},{'unique':!![],'name':'name_sms','fields':[_0x98bc('0x11'),_0x98bc('0x12')]},{'unique':!![],'name':_0x98bc('0x13'),'fields':[_0x98bc('0x11'),_0x98bc('0x14')]},{'unique':!![],'name':'name_openchannel','fields':[_0x98bc('0x11'),'OpenchannelAccountId']},{'unique':!![],'name':'name_whatsapp','fields':[_0x98bc('0x11'),_0x98bc('0x15')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 426c8b4..5be9a87 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(_0x4b5bca,_0x3b57cf){var _0x1ade3e=function(_0x4cd2e3){while(--_0x4cd2e3){_0x4b5bca['push'](_0x4b5bca['shift']());}};_0x1ade3e(++_0x3b57cf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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(_0x33a300,_0x243ba8){var _0x4e8427=function(_0x3c2f37){while(--_0x3c2f37){_0x33a300['push'](_0x33a300['shift']());}};_0x4e8427(++_0x243ba8);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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 a4b17c2..2f77220 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 _0x26f7=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','multer','util','path','express','Router'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0x26f7,0x1c7));var _0x726f=function(_0xc31d8a,_0x123995){_0xc31d8a=_0xc31d8a-0x0;var _0x11c548=_0x26f7[_0xc31d8a];return _0x11c548;};'use strict';var multer=require(_0x726f('0x0'));var util=require(_0x726f('0x1'));var path=require(_0x726f('0x2'));var timeout=require('connect-timeout');var express=require(_0x726f('0x3'));var router=express[_0x726f('0x4')]();var fs_extra=require(_0x726f('0x5'));var auth=require(_0x726f('0x6'));var interaction=require(_0x726f('0x7'));var config=require(_0x726f('0x8'));var controller=require(_0x726f('0x9'));router[_0x726f('0xa')]('/',auth[_0x726f('0xb')](),controller[_0x726f('0xc')]);router[_0x726f('0xa')](_0x726f('0xd'),auth['isAuthenticated'](),controller[_0x726f('0xe')]);router[_0x726f('0xf')]('/',auth[_0x726f('0xb')](),controller[_0x726f('0x10')]);router['put'](_0x726f('0xd'),auth['isAuthenticated'](),controller[_0x726f('0x11')]);router[_0x726f('0x12')](_0x726f('0xd'),auth[_0x726f('0xb')](),controller[_0x726f('0x13')]);module['exports']=router; \ No newline at end of file +var _0x37a2=['/:id','show','put','update','delete','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index'];(function(_0x45f224,_0x36c582){var _0x76b7c5=function(_0x15732e){while(--_0x15732e){_0x45f224['push'](_0x45f224['shift']());}};_0x76b7c5(++_0x36c582);}(_0x37a2,0xe3));var _0x237a=function(_0x401db7,_0x130dc2){_0x401db7=_0x401db7-0x0;var _0x33d498=_0x37a2[_0x401db7];return _0x33d498;};'use strict';var multer=require(_0x237a('0x0'));var util=require(_0x237a('0x1'));var path=require('path');var timeout=require(_0x237a('0x2'));var express=require(_0x237a('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x237a('0x4'));var interaction=require(_0x237a('0x5'));var config=require(_0x237a('0x6'));var controller=require(_0x237a('0x7'));router[_0x237a('0x8')]('/',auth[_0x237a('0x9')](),controller[_0x237a('0xa')]);router[_0x237a('0x8')](_0x237a('0xb'),auth[_0x237a('0x9')](),controller[_0x237a('0xc')]);router['post']('/',auth[_0x237a('0x9')](),controller['create']);router[_0x237a('0xd')](_0x237a('0xb'),auth['isAuthenticated'](),controller[_0x237a('0xe')]);router[_0x237a('0xf')](_0x237a('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x237a('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 303bc0a..9d6aabe 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 _0x4819=['localstationid','2400','9600','12000','14400','4800','v17,v27,v29','INTEGER','SIP','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','mandatoryDispositionPauseId','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x4819,0xcd));var _0x9481=function(_0x211f68,_0x47a58a){_0x211f68=_0x211f68-0x0;var _0x13604e=_0x4819[_0x211f68];return _0x13604e;};'use strict';var Sequelize=require('sequelize');module[_0x9481('0x0')]={'name':{'type':Sequelize[_0x9481('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9481('0x1')]},'ecm':{'type':Sequelize[_0x9481('0x2')](_0x9481('0x3'),'no'),'defaultValue':_0x9481('0x3')},'headerinfo':{'type':Sequelize[_0x9481('0x1')],'defaultValue':_0x9481('0x4')},'localstationid':{'type':Sequelize[_0x9481('0x1')],'unique':_0x9481('0x5')},'minrate':{'type':Sequelize['ENUM'](_0x9481('0x6'),'4800','7200',_0x9481('0x7'),_0x9481('0x8'),_0x9481('0x9')),'defaultValue':_0x9481('0xa')},'maxrate':{'type':Sequelize[_0x9481('0x2')]('2400',_0x9481('0xa'),'7200',_0x9481('0x7'),'12000',_0x9481('0x9')),'defaultValue':_0x9481('0x9')},'modem':{'type':Sequelize[_0x9481('0x1')],'defaultValue':_0x9481('0xb')},'gateway':{'type':Sequelize[_0x9481('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x9481('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x9481('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x9481('0x2')](_0x9481('0xd'),'IAX','DADHI',_0x9481('0xe')),'defaultValue':_0x9481('0xd')},'key':{'type':Sequelize[_0x9481('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x9481('0xf')],'defaultValue':function(){return _0x9481('0x10');}},'notificationSound':{'type':Sequelize[_0x9481('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9481('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x9481('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9481('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9481('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9481('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x9481('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x9481('0x11')],'defaultValue':![],'comment':_0x9481('0x13'),'set':function(_0x546fce){if(!_0x546fce)this['setDataValue'](_0x9481('0x14'),null);this['setDataValue']('mandatoryDisposition',_0x546fce);}}}; \ No newline at end of file +var _0x5fc3=['sequelize','exports','STRING','ENUM','yes','localstationid','7200','12000','14400','4800','2400','v17,v27,v29','INTEGER','IAX','KHOMP','SIP','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','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition'];(function(_0x51d22e,_0x276640){var _0x275be3=function(_0x52d368){while(--_0x52d368){_0x51d22e['push'](_0x51d22e['shift']());}};_0x275be3(++_0x276640);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1a8f86,_0x5ed9c4){_0x1a8f86=_0x1a8f86-0x0;var _0x20d876=_0x5fc3[_0x1a8f86];return _0x20d876;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x35fc('0x2')]},'ecm':{'type':Sequelize[_0x35fc('0x3')](_0x35fc('0x4'),'no'),'defaultValue':_0x35fc('0x4')},'headerinfo':{'type':Sequelize[_0x35fc('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x35fc('0x2')],'unique':_0x35fc('0x5')},'minrate':{'type':Sequelize[_0x35fc('0x3')]('2400','4800',_0x35fc('0x6'),'9600',_0x35fc('0x7'),_0x35fc('0x8')),'defaultValue':_0x35fc('0x9')},'maxrate':{'type':Sequelize[_0x35fc('0x3')](_0x35fc('0xa'),_0x35fc('0x9'),_0x35fc('0x6'),'9600',_0x35fc('0x7'),_0x35fc('0x8')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x35fc('0x2')],'defaultValue':_0x35fc('0xb')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x35fc('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x35fc('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM']('SIP',_0x35fc('0xd'),'DADHI',_0x35fc('0xe')),'defaultValue':_0x35fc('0xf')},'key':{'type':Sequelize[_0x35fc('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x35fc('0x10')],'defaultValue':function(){return _0x35fc('0x11');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'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[_0x35fc('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x35fc('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x35fc('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x35fc('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x35fc('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x35fc('0x13')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x35fc('0x14'),'set':function(_0x45c8b7){if(!_0x45c8b7)this['setDataValue'](_0x35fc('0x15'),null);this[_0x35fc('0x16')](_0x35fc('0x17'),_0x45c8b7);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 9fd65a1..d081793 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 _0x884c=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','options','FaxAccount','includeAll','include','findAll','rows','catch','params','rawAttributes','merge','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','FaxInteraction','addInteraction','omit','getInteractions','Contact','internal','Tag','color','tag','addApplications','sequelize','transaction','READ_COMMITTED','FaxApplication','bulkCreate','priority','finally','getApplications','exten','localstationid','app','system','Fax\x20Extension','appdata','push','Answer','gateway','faxdetect','maxrate','modem','t38timeout','FAXOPT(','Set','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','findById','FaxMessage','$gte','split','format','CmList','CmContact','Contacts','DESC','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List','ListId','out','Messages','Contact\x20not\x20found','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','offset','count','limit','set','Content-Range','reject','save','update','destroy','FaxAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','fieldName','key','model','map','query','keys','filters','intersection'];(function(_0x100415,_0x4c109b){var _0x508f5c=function(_0x397d08){while(--_0x397d08){_0x100415['push'](_0x100415['shift']());}};_0x508f5c(++_0x4c109b);}(_0x884c,0x77));var _0xc884=function(_0x4951e4,_0x17641d){_0x4951e4=_0x4951e4-0x0;var _0xb1cc7e=_0x884c[_0x4951e4];return _0xb1cc7e;};'use strict';var emlformat=require(_0xc884('0x0'));var rimraf=require(_0xc884('0x1'));var zipdir=require(_0xc884('0x2'));var jsonpatch=require(_0xc884('0x3'));var rp=require('request-promise');var moment=require(_0xc884('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xc884('0x5'));var sox=require(_0xc884('0x6'));var csv=require(_0xc884('0x7'));var ejs=require(_0xc884('0x8'));var fs=require('fs');var fs_extra=require(_0xc884('0x9'));var _=require('lodash');var squel=require(_0xc884('0xa'));var crypto=require(_0xc884('0xb'));var jsforce=require(_0xc884('0xc'));var deskjs=require(_0xc884('0xd'));var toCsv=require(_0xc884('0x7'));var querystring=require(_0xc884('0xe'));var Papa=require(_0xc884('0xf'));var Redis=require('ioredis');var authService=require(_0xc884('0x10'));var qs=require(_0xc884('0x11'));var as=require(_0xc884('0x12'));var hardwareService=require(_0xc884('0x13'));var logger=require(_0xc884('0x14'))(_0xc884('0x15'));var utils=require('../../config/utils');var config=require(_0xc884('0x16'));var licenseUtil=require(_0xc884('0x17'));var db=require('../../mysqldb')['db'];config[_0xc884('0x18')]=_[_0xc884('0x19')](config[_0xc884('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xc884('0x1a'))(new Redis(config[_0xc884('0x18')]));require('./faxAccount.socket')[_0xc884('0x1b')](socket);var jayson=require(_0xc884('0x1c'));var client=jayson[_0xc884('0x1d')][_0xc884('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0xc884('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x3edccf,_0x1cddf2,_0x931036,_0x26ff11){return new BPromise(function(_0x559000,_0x2f5c15){var _0x3da5f5=_0x26ff11||client;return _0x3da5f5[_0xc884('0x1f')](_0x3edccf,_0x931036)[_0xc884('0x20')](function(_0x11bbcb){logger[_0xc884('0x21')](_0xc884('0x22'),_0x1cddf2,_0xc884('0x23'));logger[_0xc884('0x24')](_0xc884('0x25'),_0x1cddf2,'request\x20sent',JSON[_0xc884('0x26')](_0x11bbcb));if(_0x11bbcb[_0xc884('0x27')]){if(_0x11bbcb[_0xc884('0x27')][_0xc884('0x28')]===0x1f4){logger['error'](_0xc884('0x22'),_0x1cddf2,_0x11bbcb[_0xc884('0x27')][_0xc884('0x29')]);return _0x2f5c15(_0x11bbcb[_0xc884('0x27')][_0xc884('0x29')]);}logger[_0xc884('0x27')]('FaxAccount,\x20%s,\x20%s',_0x1cddf2,_0x11bbcb[_0xc884('0x27')][_0xc884('0x29')]);return _0x559000(_0x11bbcb[_0xc884('0x27')][_0xc884('0x29')]);}else{logger[_0xc884('0x21')](_0xc884('0x22'),_0x1cddf2,_0xc884('0x23'));_0x559000(_0x11bbcb['result'][_0xc884('0x29')]);}})['catch'](function(_0x453009){logger[_0xc884('0x27')]('FaxAccount,\x20%s,\x20%s',_0x1cddf2,_0x453009);_0x2f5c15(_0x453009);});});}function respondWithStatusCode(_0x3baaf0,_0xa641b2){_0xa641b2=_0xa641b2||0xcc;return function(_0x1ee00f){if(_0x1ee00f){return _0x3baaf0[_0xc884('0x2a')](_0xa641b2);}return _0x3baaf0[_0xc884('0x2b')](_0xa641b2)[_0xc884('0x2c')]();};}function respondWithResult(_0x15db86,_0x4a29d4){_0x4a29d4=_0x4a29d4||0xc8;return function(_0x376682){if(_0x376682){return _0x15db86[_0xc884('0x2b')](_0x4a29d4)[_0xc884('0x2d')](_0x376682);}};}function respondWithFilteredResult(_0x5f3d0e,_0x254c88){return function(_0x4e6f17){if(_0x4e6f17){var _0x1dc111=typeof _0x254c88[_0xc884('0x2e')]==='undefined'&&typeof _0x254c88['limit']==='undefined';var _0x27ac24=_0x4e6f17[_0xc884('0x2f')];var _0xe3ab6a=_0x1dc111?0x0:_0x254c88[_0xc884('0x2e')];var _0x3bdfb5=_0x1dc111?_0x4e6f17[_0xc884('0x2f')]:_0x254c88[_0xc884('0x2e')]+_0x254c88[_0xc884('0x30')];var _0x4eeda5;if(_0x3bdfb5>=_0x27ac24){_0x3bdfb5=_0x27ac24;_0x4eeda5=0xc8;}else{_0x4eeda5=0xce;}_0x5f3d0e[_0xc884('0x2b')](_0x4eeda5);return _0x5f3d0e[_0xc884('0x31')](_0xc884('0x32'),_0xe3ab6a+'-'+_0x3bdfb5+'/'+_0x27ac24)[_0xc884('0x2d')](_0x4e6f17);}return null;};}function patchUpdates(_0x56f8d2){return function(_0x3b0553){try{jsonpatch['apply'](_0x3b0553,_0x56f8d2,!![]);}catch(_0x48beec){return BPromise[_0xc884('0x33')](_0x48beec);}return _0x3b0553[_0xc884('0x34')]();};}function saveUpdates(_0x3c7acd,_0x33a81f){return function(_0x720d1f){if(_0x720d1f){return _0x720d1f[_0xc884('0x35')](_0x3c7acd)[_0xc884('0x20')](function(_0x42e38a){return _0x42e38a;});}return null;};}function removeEntity(_0x27a21d,_0x1f5822){return function(_0x183936){if(_0x183936){return _0x183936[_0xc884('0x36')]()[_0xc884('0x20')](function(){var _0x236f42=_0x183936['get']({'plain':!![]});var _0x3e6690=_0xc884('0x37');return db[_0xc884('0x38')][_0xc884('0x36')]({'where':{'type':_0x3e6690,'resourceId':_0x236f42['id']}})[_0xc884('0x20')](function(){return _0x183936;});})['then'](function(){_0x27a21d[_0xc884('0x2b')](0xcc)[_0xc884('0x2c')]();});}};}function handleEntityNotFound(_0x2ca9b4,_0x30339d){return function(_0x24bef8){if(!_0x24bef8){_0x2ca9b4[_0xc884('0x2a')](0x194);}return _0x24bef8;};}function handleError(_0x352a9e,_0x16ed73){_0x16ed73=_0x16ed73||0x1f4;return function(_0x1d1643){logger['error'](_0x1d1643[_0xc884('0x39')]);if(_0x1d1643[_0xc884('0x3a')]){delete _0x1d1643['name'];}_0x352a9e['status'](_0x16ed73)[_0xc884('0x3b')](_0x1d1643);};}exports[_0xc884('0x3c')]=function(_0x4f88e4,_0x51f30f){var _0x40f06d={'include':[{'model':db[_0xc884('0x3d')],'as':_0xc884('0x3e')}]},_0x111d3b={},_0x59ec93={'count':0x0,'rows':[]};var _0x1e6b06=_['map'](db['FaxAccount']['rawAttributes'],function(_0x366343){return{'name':_0x366343[_0xc884('0x3f')],'type':_0x366343['type'][_0xc884('0x40')]};});_0x111d3b[_0xc884('0x41')]=_[_0xc884('0x42')](_0x1e6b06,_0xc884('0x3a'));_0x111d3b[_0xc884('0x43')]=_[_0xc884('0x44')](_0x4f88e4[_0xc884('0x43')]);_0x111d3b[_0xc884('0x45')]=_[_0xc884('0x46')](_0x111d3b[_0xc884('0x41')],_0x111d3b['query']);_0x40f06d[_0xc884('0x47')]=_[_0xc884('0x46')](_0x111d3b[_0xc884('0x41')],qs[_0xc884('0x48')](_0x4f88e4[_0xc884('0x43')][_0xc884('0x48')]));_0x40f06d[_0xc884('0x47')]=_0x40f06d[_0xc884('0x47')][_0xc884('0x49')]?_0x40f06d[_0xc884('0x47')]:_0x111d3b['model'];if(!_0x4f88e4[_0xc884('0x43')][_0xc884('0x4a')](_0xc884('0x4b'))){_0x40f06d[_0xc884('0x30')]=qs[_0xc884('0x30')](_0x4f88e4[_0xc884('0x43')][_0xc884('0x30')]);_0x40f06d['offset']=qs[_0xc884('0x2e')](_0x4f88e4[_0xc884('0x43')][_0xc884('0x2e')]);}_0x40f06d[_0xc884('0x4c')]=qs[_0xc884('0x4d')](_0x4f88e4[_0xc884('0x43')][_0xc884('0x4d')]);_0x40f06d['where']=qs[_0xc884('0x45')](_[_0xc884('0x4e')](_0x4f88e4['query'],_0x111d3b['filters']),_0x1e6b06);if(_0x4f88e4[_0xc884('0x43')][_0xc884('0x4f')]){_0x40f06d[_0xc884('0x50')]=_['merge'](_0x40f06d[_0xc884('0x50')],{'$or':_[_0xc884('0x42')](_0x1e6b06,function(_0x116553){if(_0x116553[_0xc884('0x51')]!=='VIRTUAL'){var _0xc50653={};_0xc50653[_0x116553[_0xc884('0x3a')]]={'$like':'%'+_0x4f88e4['query']['filter']+'%'};return _0xc50653;}})});}_0x40f06d=_['merge']({},_0x40f06d,_0x4f88e4[_0xc884('0x52')]);var _0x1d2ade={'where':_0x40f06d['where']};return db[_0xc884('0x53')][_0xc884('0x2f')](_0x1d2ade)[_0xc884('0x20')](function(_0x149c0e){_0x59ec93[_0xc884('0x2f')]=_0x149c0e;if(_0x4f88e4['query'][_0xc884('0x54')]){_0x40f06d[_0xc884('0x55')]=[{'all':!![]}];}return db[_0xc884('0x53')][_0xc884('0x56')](_0x40f06d);})['then'](function(_0x59b1ec){_0x59ec93[_0xc884('0x57')]=_0x59b1ec;return _0x59ec93;})[_0xc884('0x20')](respondWithFilteredResult(_0x51f30f,_0x40f06d))[_0xc884('0x58')](handleError(_0x51f30f,null));};exports['show']=function(_0xfce5be,_0x3a3ff2){var _0x23d134={'raw':![],'where':{'id':_0xfce5be[_0xc884('0x59')]['id']},'include':[{'model':db[_0xc884('0x3d')],'as':_0xc884('0x3e')}]},_0x2ba95e={};_0x2ba95e[_0xc884('0x41')]=_[_0xc884('0x44')](db['FaxAccount'][_0xc884('0x5a')]);_0x2ba95e[_0xc884('0x43')]=_[_0xc884('0x44')](_0xfce5be[_0xc884('0x43')]);_0x2ba95e[_0xc884('0x45')]=_[_0xc884('0x46')](_0x2ba95e[_0xc884('0x41')],_0x2ba95e[_0xc884('0x43')]);_0x23d134[_0xc884('0x47')]=_[_0xc884('0x46')](_0x2ba95e['model'],qs['fields'](_0xfce5be['query'][_0xc884('0x48')]));_0x23d134[_0xc884('0x47')]=_0x23d134[_0xc884('0x47')][_0xc884('0x49')]?_0x23d134[_0xc884('0x47')]:_0x2ba95e[_0xc884('0x41')];if(_0xfce5be[_0xc884('0x43')][_0xc884('0x54')]){_0x23d134['include']=[{'all':!![]}];}_0x23d134=_[_0xc884('0x5b')]({},_0x23d134,_0xfce5be['options']);return db[_0xc884('0x53')][_0xc884('0x5c')](_0x23d134)[_0xc884('0x20')](handleEntityNotFound(_0x3a3ff2,null))['then'](respondWithResult(_0x3a3ff2,null))['catch'](handleError(_0x3a3ff2,null));};exports['create']=function(_0x2a400f,_0x21c20e){return db[_0xc884('0x53')][_0xc884('0x5d')](_0x2a400f['body'],{})['then'](function(_0x84bc55){var _0x1dac62=_0x2a400f['user'][_0xc884('0x5e')]({'plain':!![]});if(!_0x1dac62)throw new Error(_0xc884('0x5f'));if(_0x1dac62['role']===_0xc884('0x60')){var _0xebe2bb=_0x84bc55[_0xc884('0x5e')]({'plain':!![]});var _0x433e32=_0xc884('0x37');return db[_0xc884('0x61')]['find']({'where':{'name':_0x433e32,'userProfileId':_0x1dac62[_0xc884('0x62')]},'raw':!![]})[_0xc884('0x20')](function(_0x5156ea){if(_0x5156ea&&_0x5156ea[_0xc884('0x63')]===0x0){return db[_0xc884('0x38')][_0xc884('0x5d')]({'name':_0xebe2bb[_0xc884('0x3a')],'resourceId':_0xebe2bb['id'],'type':_0x5156ea['name'],'sectionId':_0x5156ea['id']},{})[_0xc884('0x20')](function(){return _0x84bc55;});}else{return _0x84bc55;}})['catch'](function(_0x5343c5){logger['error'](_0xc884('0x64'),_0x5343c5);throw _0x5343c5;});}return _0x84bc55;})['then'](respondWithResult(_0x21c20e,0xc9))['catch'](handleError(_0x21c20e,null));};exports[_0xc884('0x35')]=function(_0x475925,_0x39ed36){if(_0x475925[_0xc884('0x65')]['id']){delete _0x475925[_0xc884('0x65')]['id'];}return db[_0xc884('0x53')]['find']({'where':{'id':_0x475925[_0xc884('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0xc884('0x3e')}]})['then'](handleEntityNotFound(_0x39ed36,null))['then'](saveUpdates(_0x475925[_0xc884('0x65')],null))['then'](respondWithResult(_0x39ed36,null))[_0xc884('0x58')](handleError(_0x39ed36,null));};exports['destroy']=function(_0x336e71,_0x289bf4){return db[_0xc884('0x53')]['find']({'where':{'id':_0x336e71[_0xc884('0x59')]['id']}})['then'](handleEntityNotFound(_0x289bf4,null))[_0xc884('0x20')](removeEntity(_0x289bf4,null))[_0xc884('0x58')](handleError(_0x289bf4,null));};exports[_0xc884('0x66')]=function(_0x4b88f7,_0x1ced8c){return db[_0xc884('0x53')][_0xc884('0x66')]()['then'](respondWithResult(_0x1ced8c,null))[_0xc884('0x58')](handleError(_0x1ced8c,null));};exports[_0xc884('0x67')]=function(_0x1675df,_0x2c48e1,_0x34d54d){if(_0x1675df['body']['id']){delete _0x1675df['body']['id'];}return db[_0xc884('0x53')][_0xc884('0x5c')]({'where':{'id':_0x1675df[_0xc884('0x59')]['id']}})[_0xc884('0x20')](handleEntityNotFound(_0x2c48e1,null))['then'](function(_0x381908){if(_0x381908){_0x1675df[_0xc884('0x65')][_0xc884('0x68')]=_0x381908['id'];return db[_0xc884('0x69')][_0xc884('0x5d')](_0x1675df[_0xc884('0x65')]);}})[_0xc884('0x20')](respondWithResult(_0x2c48e1,null))['catch'](handleError(_0x2c48e1,null));};exports[_0xc884('0x6a')]=function(_0x370c62,_0x4a2023,_0x11f5b5){var _0xd3bc15={'raw':![],'where':{}};var _0x1daaff={};var _0x47b862={'count':0x0,'rows':[]};return db[_0xc884('0x53')][_0xc884('0x6b')]({'where':{'id':_0x370c62[_0xc884('0x59')]['id']}})[_0xc884('0x20')](handleEntityNotFound(_0x4a2023,null))[_0xc884('0x20')](function(_0x31af11){if(_0x31af11){_0x1daaff[_0xc884('0x41')]=_[_0xc884('0x44')](db[_0xc884('0x69')][_0xc884('0x5a')]);_0x1daaff['query']=_[_0xc884('0x44')](_0x370c62[_0xc884('0x43')]);_0x1daaff[_0xc884('0x45')]=_[_0xc884('0x46')](_0x1daaff[_0xc884('0x41')],_0x1daaff[_0xc884('0x43')]);_0xd3bc15[_0xc884('0x47')]=_[_0xc884('0x46')](_0x1daaff['model'],qs[_0xc884('0x48')](_0x370c62['query']['fields']));_0xd3bc15['attributes']=_0xd3bc15[_0xc884('0x47')][_0xc884('0x49')]?_0xd3bc15[_0xc884('0x47')]:_0x1daaff[_0xc884('0x41')];if(!_0x370c62[_0xc884('0x43')]['hasOwnProperty']('nolimit')){_0xd3bc15[_0xc884('0x30')]=qs[_0xc884('0x30')](_0x370c62[_0xc884('0x43')][_0xc884('0x30')]);_0xd3bc15[_0xc884('0x2e')]=qs[_0xc884('0x2e')](_0x370c62[_0xc884('0x43')]['offset']);}_0xd3bc15['order']=qs[_0xc884('0x4d')](_0x370c62[_0xc884('0x43')][_0xc884('0x4d')]);_0xd3bc15[_0xc884('0x50')]=qs['filters'](_[_0xc884('0x4e')](_0x370c62[_0xc884('0x43')],_0x1daaff[_0xc884('0x45')]));_0xd3bc15['where'][_0xc884('0x68')]=_0x31af11['id'];if(_0x370c62[_0xc884('0x43')][_0xc884('0x4f')]){_0xd3bc15[_0xc884('0x50')]=_[_0xc884('0x5b')](_0xd3bc15[_0xc884('0x50')],{'$or':_['map'](_0xd3bc15[_0xc884('0x47')],function(_0x57cc4d){var _0x3b7a49={};_0x3b7a49[_0x57cc4d]={'$like':'%'+_0x370c62[_0xc884('0x43')][_0xc884('0x4f')]+'%'};return _0x3b7a49;})});}_0xd3bc15=_[_0xc884('0x5b')]({},_0xd3bc15,_0x370c62[_0xc884('0x52')]);return db[_0xc884('0x69')][_0xc884('0x2f')]({'where':_0xd3bc15[_0xc884('0x50')]})['then'](function(_0x1ad228){_0x47b862[_0xc884('0x2f')]=_0x1ad228;if(_0x370c62['query']['includeAll']){_0xd3bc15[_0xc884('0x55')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0xd3bc15);})[_0xc884('0x20')](function(_0x3f78a7){_0x47b862[_0xc884('0x57')]=_0x3f78a7;return _0x47b862;});}})[_0xc884('0x20')](respondWithFilteredResult(_0x4a2023,_0xd3bc15))[_0xc884('0x58')](handleError(_0x4a2023,null));};exports[_0xc884('0x6c')]=function(_0x410b00,_0x51144b,_0x388138){return db[_0xc884('0x53')][_0xc884('0x5c')]({'where':{'id':_0x410b00[_0xc884('0x59')]['id']}})[_0xc884('0x20')](handleEntityNotFound(_0x51144b,null))['then'](function(_0x39b6b0){if(_0x39b6b0){return _0x39b6b0[_0xc884('0x6c')](_0x410b00[_0xc884('0x43')][_0xc884('0x6d')]);}})['then'](respondWithStatusCode(_0x51144b,null))[_0xc884('0x58')](handleError(_0x51144b,null));};exports[_0xc884('0x6e')]=function(_0x309528,_0x3a3894,_0x4e64aa){if(_0x309528[_0xc884('0x65')]['id']){delete _0x309528[_0xc884('0x65')]['id'];}return db[_0xc884('0x53')][_0xc884('0x5c')]({'where':{'id':_0x309528[_0xc884('0x59')]['id']}})['then'](handleEntityNotFound(_0x3a3894,null))[_0xc884('0x20')](function(_0xb10eb){if(_0xb10eb){_0x309528[_0xc884('0x65')][_0xc884('0x68')]=_0xb10eb['id'];return db[_0xc884('0x6f')]['create'](_0x309528[_0xc884('0x65')]);}})['then'](respondWithResult(_0x3a3894,null))[_0xc884('0x58')](handleError(_0x3a3894,null));};exports[_0xc884('0x70')]=function(_0x195033,_0x28c299,_0x1f9788){var _0x3bc2b1={'raw':![],'where':{}};var _0xb9f9a4={};var _0x218ee4={'count':0x0,'rows':[]};return db[_0xc884('0x53')][_0xc884('0x6b')]({'where':{'id':_0x195033[_0xc884('0x59')]['id']}})[_0xc884('0x20')](handleEntityNotFound(_0x28c299,null))[_0xc884('0x20')](function(_0x3b5274){if(_0x3b5274){_0xb9f9a4['model']=_['keys'](db['CannedAnswer'][_0xc884('0x5a')]);_0xb9f9a4[_0xc884('0x43')]=_[_0xc884('0x44')](_0x195033[_0xc884('0x43')]);_0xb9f9a4[_0xc884('0x45')]=_[_0xc884('0x46')](_0xb9f9a4[_0xc884('0x41')],_0xb9f9a4['query']);_0x3bc2b1[_0xc884('0x47')]=_['intersection'](_0xb9f9a4[_0xc884('0x41')],qs[_0xc884('0x48')](_0x195033['query']['fields']));_0x3bc2b1[_0xc884('0x47')]=_0x3bc2b1[_0xc884('0x47')][_0xc884('0x49')]?_0x3bc2b1[_0xc884('0x47')]:_0xb9f9a4[_0xc884('0x41')];if(!_0x195033['query'][_0xc884('0x4a')](_0xc884('0x4b'))){_0x3bc2b1[_0xc884('0x30')]=qs['limit'](_0x195033[_0xc884('0x43')][_0xc884('0x30')]);_0x3bc2b1[_0xc884('0x2e')]=qs[_0xc884('0x2e')](_0x195033[_0xc884('0x43')][_0xc884('0x2e')]);}_0x3bc2b1[_0xc884('0x4c')]=qs[_0xc884('0x4d')](_0x195033[_0xc884('0x43')]['sort']);_0x3bc2b1[_0xc884('0x50')]=qs[_0xc884('0x45')](_[_0xc884('0x4e')](_0x195033[_0xc884('0x43')],_0xb9f9a4[_0xc884('0x45')]));_0x3bc2b1[_0xc884('0x50')]['FaxAccountId']=_0x3b5274['id'];if(_0x195033[_0xc884('0x43')][_0xc884('0x4f')]){_0x3bc2b1[_0xc884('0x50')]=_[_0xc884('0x5b')](_0x3bc2b1['where'],{'$or':_['map'](_0x3bc2b1[_0xc884('0x47')],function(_0x4a4fd6){var _0x43e017={};_0x43e017[_0x4a4fd6]={'$like':'%'+_0x195033['query'][_0xc884('0x4f')]+'%'};return _0x43e017;})});}_0x3bc2b1=_['merge']({},_0x3bc2b1,_0x195033[_0xc884('0x52')]);return db['CannedAnswer'][_0xc884('0x2f')]({'where':_0x3bc2b1[_0xc884('0x50')]})[_0xc884('0x20')](function(_0xbeccab){_0x218ee4[_0xc884('0x2f')]=_0xbeccab;if(_0x195033[_0xc884('0x43')]['includeAll']){_0x3bc2b1[_0xc884('0x55')]=[{'all':!![]}];}return db[_0xc884('0x6f')][_0xc884('0x56')](_0x3bc2b1);})[_0xc884('0x20')](function(_0x5dbd4c){_0x218ee4[_0xc884('0x57')]=_0x5dbd4c;return _0x218ee4;});}})[_0xc884('0x20')](respondWithFilteredResult(_0x28c299,_0x3bc2b1))[_0xc884('0x58')](handleError(_0x28c299,null));};exports[_0xc884('0x71')]=function(_0x1b7514,_0x478df1,_0x19a68a){return db[_0xc884('0x53')][_0xc884('0x5c')]({'where':{'id':_0x1b7514['params']['id']}})[_0xc884('0x20')](handleEntityNotFound(_0x478df1,null))[_0xc884('0x20')](function(_0x56ea5a){if(_0x56ea5a){return _0x56ea5a['removeAnswers'](_0x1b7514[_0xc884('0x43')]['ids']);}})[_0xc884('0x20')](respondWithStatusCode(_0x478df1,null))[_0xc884('0x58')](handleError(_0x478df1,null));};exports['addInteraction']=function(_0x29929c,_0x1f5ebe,_0x4f1921){return db[_0xc884('0x72')][_0xc884('0x5c')]({'where':{'id':_0x29929c[_0xc884('0x59')]['id']}})[_0xc884('0x20')](handleEntityNotFound(_0x1f5ebe,null))[_0xc884('0x20')](function(_0x3e5f75){if(_0x3e5f75){return _0x3e5f75[_0xc884('0x73')](_0x29929c[_0xc884('0x65')][_0xc884('0x6d')],_[_0xc884('0x74')](_0x29929c[_0xc884('0x65')],['ids','id'])||{});}})[_0xc884('0x20')](respondWithResult(_0x1f5ebe,null))['catch'](handleError(_0x1f5ebe,null));};exports[_0xc884('0x75')]=function(_0x2122ac,_0x341cdf,_0x289671){var _0x604c4e={'raw':![],'where':{}};var _0x1c4046={};var _0x202e7b={'count':0x0,'rows':[]};return db[_0xc884('0x53')][_0xc884('0x6b')]({'where':{'id':_0x2122ac[_0xc884('0x59')]['id']}})[_0xc884('0x20')](handleEntityNotFound(_0x341cdf,null))[_0xc884('0x20')](function(_0x2f7ebb){if(_0x2f7ebb){_0x1c4046[_0xc884('0x41')]=_['keys'](db[_0xc884('0x72')][_0xc884('0x5a')]);_0x1c4046['query']=_[_0xc884('0x44')](_0x2122ac['query']);_0x1c4046['filters']=_[_0xc884('0x46')](_0x1c4046[_0xc884('0x41')],_0x1c4046[_0xc884('0x43')]);_0x604c4e[_0xc884('0x47')]=_['intersection'](_0x1c4046[_0xc884('0x41')],qs[_0xc884('0x48')](_0x2122ac[_0xc884('0x43')][_0xc884('0x48')]));_0x604c4e['attributes']=_0x604c4e[_0xc884('0x47')][_0xc884('0x49')]?_0x604c4e[_0xc884('0x47')]:_0x1c4046[_0xc884('0x41')];if(!_0x2122ac[_0xc884('0x43')][_0xc884('0x4a')](_0xc884('0x4b'))){_0x604c4e[_0xc884('0x30')]=qs['limit'](_0x2122ac[_0xc884('0x43')][_0xc884('0x30')]);_0x604c4e[_0xc884('0x2e')]=qs[_0xc884('0x2e')](_0x2122ac[_0xc884('0x43')]['offset']);}_0x604c4e[_0xc884('0x4c')]=qs[_0xc884('0x4d')](_0x2122ac['query'][_0xc884('0x4d')]);_0x604c4e[_0xc884('0x50')]=qs[_0xc884('0x45')](_['pick'](_0x2122ac[_0xc884('0x43')],_0x1c4046[_0xc884('0x45')]));_0x604c4e['where'][_0xc884('0x68')]=_0x2f7ebb['id'];if(_0x2122ac[_0xc884('0x43')]['filter']){_0x604c4e[_0xc884('0x50')]=_[_0xc884('0x5b')](_0x604c4e[_0xc884('0x50')],{'$or':_[_0xc884('0x42')](_0x604c4e[_0xc884('0x47')],function(_0xa1f527){var _0x350369={};_0x350369[_0xa1f527]={'$like':'%'+_0x2122ac[_0xc884('0x43')]['filter']+'%'};return _0x350369;})});}_0x604c4e=_[_0xc884('0x5b')]({},_0x604c4e,_0x2122ac[_0xc884('0x52')]);return db[_0xc884('0x72')]['count']({'where':_0x604c4e[_0xc884('0x50')]})[_0xc884('0x20')](function(_0x6ea773){_0x202e7b[_0xc884('0x2f')]=_0x6ea773;if(_0x2122ac[_0xc884('0x43')]['includeAll']){_0x604c4e[_0xc884('0x55')]=[{'model':db['CmContact'],'as':_0xc884('0x76'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0xc884('0x3a'),'fullname',_0xc884('0x77')],'required':![]},{'model':db[_0xc884('0x78')],'as':'Tags','attributes':['id',_0xc884('0x3a'),_0xc884('0x79')],'where':_0x2122ac[_0xc884('0x43')][_0xc884('0x7a')]?{'id':_0x2122ac['query']['tag']}:undefined,'required':_0x2122ac[_0xc884('0x43')][_0xc884('0x7a')]?!![]:![]}];}return db[_0xc884('0x72')]['findAll'](_0x604c4e);})[_0xc884('0x20')](function(_0x2a16de){_0x202e7b['rows']=_0x2a16de;return _0x202e7b;});}})['then'](respondWithFilteredResult(_0x341cdf,_0x604c4e))[_0xc884('0x58')](handleError(_0x341cdf,null));};exports[_0xc884('0x7b')]=function(_0x6c00cf,_0x85707a){var _0x5ab22a=_0x6c00cf[_0xc884('0x59')]['id'];var _0x5bfa50=_0x6c00cf[_0xc884('0x65')];var _0x45256d=0xc8;var _0x4041fc=null;return db[_0xc884('0x7c')][_0xc884('0x7d')]({'isolationLevel':db[_0xc884('0x7c')]['Transaction']['ISOLATION_LEVELS'][_0xc884('0x7e')]},function(_0xddfd30){return db['FaxAccount']['findOne']({'where':{'id':_0x5ab22a},'transaction':_0xddfd30})['then'](function(_0x2e4564){if(_0x2e4564){return db[_0xc884('0x7f')][_0xc884('0x36')]({'where':{'FaxAccountId':_0x5ab22a},'transaction':_0xddfd30})[_0xc884('0x20')](function(){var _0x1488d4=_['map'](_0x5bfa50,function(_0x1d7ca2){_0x1d7ca2[_0xc884('0x68')]=_0x5ab22a;return _0x1d7ca2;});return db[_0xc884('0x7f')][_0xc884('0x80')](_0x1488d4,{'transaction':_0xddfd30});});}else{_0x45256d=0x194;_0x4041fc=[];}});})[_0xc884('0x20')](function(){if(_0x45256d!==0x194){return db[_0xc884('0x7f')]['findAndCountAll']({'where':{'FaxAccountId':_0x5ab22a},'order':_0xc884('0x81')})['then'](function(_0x391621){_0x4041fc=_0x391621;});}})[_0xc884('0x58')](function(_0x38d3ac){_0x45256d=0x1f4;logger[_0xc884('0x27')](_0x38d3ac[_0xc884('0x39')]);if(_0x38d3ac['name']){delete _0x38d3ac['name'];}_0x4041fc=_0x38d3ac;})[_0xc884('0x82')](function(){if(_0x4041fc===null){_0x85707a['sendStatus'](_0x45256d);}else{if(_0x45256d===0x1f4){_0x85707a[_0xc884('0x2b')](_0x45256d)[_0xc884('0x3b')](_0x4041fc);}else{_0x85707a[_0xc884('0x2b')](_0x45256d)[_0xc884('0x2d')](_0x4041fc);}}});};exports[_0xc884('0x83')]=function(_0x326554,_0x5aba1d,_0xadc5f6){var _0x4c699c={};var _0x3d2840={};var _0x103aa9;var _0x48d251;return db[_0xc884('0x53')][_0xc884('0x6b')]({'where':{'id':_0x326554[_0xc884('0x59')]['id']}})[_0xc884('0x20')](handleEntityNotFound(_0x5aba1d,null))[_0xc884('0x20')](function(_0x32c02b){if(_0x32c02b){_0x103aa9=_0x32c02b;_0x3d2840[_0xc884('0x41')]=_['keys'](db[_0xc884('0x7f')][_0xc884('0x5a')]);_0x3d2840[_0xc884('0x43')]=_[_0xc884('0x44')](_0x326554[_0xc884('0x43')]);_0x3d2840['filters']=_[_0xc884('0x46')](_0x3d2840[_0xc884('0x41')],_0x3d2840['query']);_0x4c699c[_0xc884('0x47')]=_[_0xc884('0x46')](_0x3d2840['model'],qs[_0xc884('0x48')](_0x326554['query']['fields']));_0x4c699c[_0xc884('0x47')]=_0x4c699c[_0xc884('0x47')][_0xc884('0x49')]?_0x4c699c['attributes']:_0x3d2840[_0xc884('0x41')];_0x4c699c[_0xc884('0x4c')]=qs['sort'](_0x326554[_0xc884('0x43')][_0xc884('0x4d')]);_0x4c699c[_0xc884('0x50')]=qs['filters'](_[_0xc884('0x4e')](_0x326554[_0xc884('0x43')],_0x3d2840[_0xc884('0x45')]));if(_0x326554[_0xc884('0x43')][_0xc884('0x4f')]){_0x4c699c[_0xc884('0x50')]=_[_0xc884('0x5b')](_0x4c699c[_0xc884('0x50')],{'$or':_[_0xc884('0x42')](_0x4c699c[_0xc884('0x47')],function(_0x566363){var _0x4e768b={};_0x4e768b[_0x566363]={'$like':'%'+_0x326554[_0xc884('0x43')][_0xc884('0x4f')]+'%'};return _0x4e768b;})});}_0x4c699c=_[_0xc884('0x5b')]({},_0x4c699c,_0x326554['options']);return _0x103aa9[_0xc884('0x83')](_0x4c699c);}})[_0xc884('0x20')](function(_0x2c7fb1){if(_0x2c7fb1){_0x48d251=_0x2c7fb1['length'];if(!_0x326554['query'][_0xc884('0x4a')]('nolimit')){_0x4c699c[_0xc884('0x30')]=qs[_0xc884('0x30')](_0x326554[_0xc884('0x43')][_0xc884('0x30')]);_0x4c699c['offset']=qs[_0xc884('0x2e')](_0x326554['query'][_0xc884('0x2e')]);}return _0x103aa9['getApplications'](_0x4c699c);}})['then'](function(_0x2ee6a3){if(_0x2ee6a3){return _0x2ee6a3?{'count':_0x48d251,'rows':_0x2ee6a3}:null;}})[_0xc884('0x20')](respondWithResult(_0x5aba1d,null))[_0xc884('0x58')](handleError(_0x5aba1d,null));};function Extension(_0x1cb2b2,_0x243e0b,_0x86b24e,_0x383849){this['context']='from-voip-provider';this[_0xc884('0x84')]=_0x1cb2b2[_0xc884('0x85')];this[_0xc884('0x86')]=_0x383849;this[_0xc884('0x51')]=_0xc884('0x87');this['description']=_0xc884('0x88');this[_0xc884('0x68')]=_0x1cb2b2['id'];this[_0xc884('0x81')]=_0x243e0b;this[_0xc884('0x89')]=_0x86b24e;}function createExtensionsReciveFax(_0x1bf2ff){var _0x279686=0x1;var _0x36f984=[];_0x36f984[_0xc884('0x8a')](new Extension(_0x1bf2ff,_0x279686,'',_0xc884('0x8b')));_0x279686+=0x1;_0x36f984[_0xc884('0x8a')](new Extension(_0x1bf2ff,_0x279686,'CDR(type)=inbound-fax','Set'));_0x279686+=0x1;for(var _0x1d5d15 in _0x1bf2ff){if(_0x1bf2ff[_0xc884('0x4a')](_0x1d5d15)&&(_0x1d5d15==='ecm'||_0x1d5d15===_0xc884('0x85')||_0x1d5d15===_0xc884('0x8c')||_0x1d5d15===_0xc884('0x8d')||_0x1d5d15==='headerinfo'||_0x1d5d15===_0xc884('0x8e')||_0x1d5d15==='minrate'||_0x1d5d15===_0xc884('0x8f')||_0x1d5d15===_0xc884('0x90'))){_0x36f984['push'](new Extension(_0x1bf2ff,_0x279686,_0xc884('0x91')+_0x1d5d15+')='+_0x1bf2ff[_0x1d5d15],_0xc884('0x92')));_0x279686+=0x1;}}_0x36f984['push'](new Extension(_0x1bf2ff,_0x279686,'6','Wait'));_0x279686+=0x1;_0x36f984['push'](new Extension(_0x1bf2ff,_0x279686,'/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',_0xc884('0x93')));_0x279686=0x0;return _0x36f984;}exports[_0xc884('0x94')]=function(_0x53757d,_0x3425e5,_0x5108a7){var _0x3c6a2b;return db[_0xc884('0x7c')][_0xc884('0x7d')](function(_0x43a0a4){return db[_0xc884('0x53')][_0xc884('0x5d')](_0x53757d[_0xc884('0x65')],{'transaction':_0x43a0a4})['then'](function(_0x1be8b4){_0x3c6a2b=_0x1be8b4[_0xc884('0x5e')]({'plain':!![]});return db[_0xc884('0x95')][_0xc884('0x80')](createExtensionsReciveFax(_0x3c6a2b),{'transaction':_0x43a0a4});});})['then'](function(){return _0x3c6a2b;})['then'](respondWithResult(_0x3425e5,null))[_0xc884('0x58')](handleError(_0x3425e5,null));};exports[_0xc884('0x96')]=function(_0x4b2b1e,_0x3e397a,_0x75aae2){var _0x371906;return db[_0xc884('0x7c')][_0xc884('0x7d')](function(_0xc408d){return db['FaxAccount'][_0xc884('0x35')](_0x4b2b1e[_0xc884('0x65')],{'where':{'id':_0x4b2b1e[_0xc884('0x65')]['id']},'transaction':_0xc408d})[_0xc884('0x20')](function(_0x2e41b3){return db['VoiceExtension'][_0xc884('0x36')]({'where':{'FaxAccountId':_0x4b2b1e[_0xc884('0x65')]['id']},'transaction':_0xc408d})[_0xc884('0x20')](function(_0xbce56d){return db[_0xc884('0x95')][_0xc884('0x80')](createExtensionsReciveFax(_[_0xc884('0x74')](_0x4b2b1e[_0xc884('0x65')],[_0xc884('0x97'),_0xc884('0x40'),_0xc884('0x98'),_0xc884('0x99'),_0xc884('0x9a'),'ListId'])),{'transaction':_0xc408d});});});})['then'](function(){return db[_0xc884('0x53')][_0xc884('0x9b')](_0x4b2b1e[_0xc884('0x65')]['id']);})[_0xc884('0x20')](respondWithResult(_0x3e397a,null))[_0xc884('0x58')](handleError(_0x3e397a,null));};exports['getMessages']=function(_0x1f9a3d,_0x5d968a,_0xb4f36b){var _0x10f3e6={'raw':!![],'where':{}};var _0x29ddb1={};var _0x269327={'count':0x0,'rows':[]};return db[_0xc884('0x53')][_0xc884('0x6b')]({'where':{'id':_0x1f9a3d[_0xc884('0x59')]['id']}})[_0xc884('0x20')](handleEntityNotFound(_0x5d968a,null))[_0xc884('0x20')](function(_0x7d95fa){if(_0x7d95fa){_0x29ddb1[_0xc884('0x41')]=_['keys'](db[_0xc884('0x9c')][_0xc884('0x5a')]);_0x29ddb1[_0xc884('0x43')]=_[_0xc884('0x44')](_0x1f9a3d[_0xc884('0x43')]);_0x29ddb1['filters']=_[_0xc884('0x46')](_0x29ddb1['model'],_0x29ddb1[_0xc884('0x43')]);_0x10f3e6[_0xc884('0x47')]=_[_0xc884('0x46')](_0x29ddb1[_0xc884('0x41')],qs[_0xc884('0x48')](_0x1f9a3d[_0xc884('0x43')]['fields']));_0x10f3e6[_0xc884('0x47')]=_0x10f3e6['attributes']['length']?_0x10f3e6[_0xc884('0x47')]:_0x29ddb1[_0xc884('0x41')];if(!_0x1f9a3d[_0xc884('0x43')][_0xc884('0x4a')](_0xc884('0x4b'))){_0x10f3e6[_0xc884('0x30')]=qs[_0xc884('0x30')](_0x1f9a3d[_0xc884('0x43')][_0xc884('0x30')]);_0x10f3e6[_0xc884('0x2e')]=qs[_0xc884('0x2e')](_0x1f9a3d[_0xc884('0x43')][_0xc884('0x2e')]);}_0x10f3e6[_0xc884('0x4c')]=qs[_0xc884('0x4d')](_0x1f9a3d[_0xc884('0x43')][_0xc884('0x4d')]);_0x10f3e6[_0xc884('0x50')]=qs['filters'](_['pick'](_0x1f9a3d['query'],_0x29ddb1[_0xc884('0x45')]));_0x10f3e6[_0xc884('0x50')][_0xc884('0x68')]=_0x7d95fa['id'];if(_0x1f9a3d['query'][_0xc884('0x4f')]){_0x10f3e6[_0xc884('0x50')]=_['merge'](_0x10f3e6[_0xc884('0x50')],{'$or':_[_0xc884('0x42')](_0x10f3e6['attributes'],function(_0x22e518){var _0x228442={};_0x228442[_0x22e518]={'$like':'%'+_0x1f9a3d[_0xc884('0x43')][_0xc884('0x4f')]+'%'};return _0x228442;})});}if(_0x1f9a3d[_0xc884('0x43')][_0xc884('0x9d')]){var _0x335627=_0x1f9a3d['query'][_0xc884('0x9d')][_0xc884('0x9e')](',');var _0x554d53={};_0x554d53[_0x335627[0x0]]={'$gte':moment(_0x335627[0x1])[_0xc884('0x9f')]('YYYY-MM-DD\x20HH:mm:ss')};_0x10f3e6[_0xc884('0x50')]=_[_0xc884('0x5b')](_0x10f3e6[_0xc884('0x50')],_0x554d53);}_0x10f3e6=_[_0xc884('0x5b')]({},_0x10f3e6,_0x1f9a3d[_0xc884('0x52')]);return db['FaxMessage'][_0xc884('0x2f')]({'where':_0x10f3e6['where']})['then'](function(_0x2629ef){_0x269327[_0xc884('0x2f')]=_0x2629ef;if(_0x1f9a3d[_0xc884('0x43')][_0xc884('0x54')]){_0x10f3e6[_0xc884('0x55')]=[{'all':!![]}];}return db['FaxMessage'][_0xc884('0x56')](_0x10f3e6);})['then'](function(_0xd30e9d){_0x269327[_0xc884('0x57')]=_0xd30e9d;return _0x269327;});}})[_0xc884('0x20')](respondWithFilteredResult(_0x5d968a,_0x10f3e6))[_0xc884('0x58')](handleError(_0x5d968a,null));};exports['send']=function(_0x4213a6,_0x1aa5e4,_0xf46002){var _0x29713a,_0x4fae73={},_0x18897a;if(_0x4213a6[_0xc884('0x65')]['to']){_0x18897a=_0x4213a6[_0xc884('0x65')]['to'][0x0];}return db[_0xc884('0x53')][_0xc884('0x5c')]({'where':{'id':_0x4213a6[_0xc884('0x59')]['id']},'include':[{'model':db[_0xc884('0xa0')],'as':'List','include':[{'model':db[_0xc884('0xa1')],'as':_0xc884('0xa2'),'where':{'fax':_0x18897a},'limit':0x1,'order':[[_0xc884('0x99'),_0xc884('0xa3')]]}]}]})[_0xc884('0x20')](handleEntityNotFound(_0x1aa5e4,null))[_0xc884('0x20')](function(_0x5f028b){_0x29713a=_0x5f028b;if(_0x4213a6[_0xc884('0x65')][_0xc884('0xa4')]&&_0x4213a6['body'][_0xc884('0xa4')][_0xc884('0x49')]){for(var _0x361e41=0x0;_0x361e41<_0x4213a6['body'][_0xc884('0xa4')][_0xc884('0x49')];_0x361e41+=0x1){_0x4213a6[_0xc884('0x65')]['attachments'][_0x361e41]={'filename':_0x4213a6['body'][_0xc884('0xa4')][_0x361e41][_0xc884('0x3a')],'id':_0x4213a6['body'][_0xc884('0xa4')][_0x361e41]['id'],'path':path[_0xc884('0xa5')](config[_0xc884('0xa6')],_0xc884('0xa7'),_0x4213a6[_0xc884('0x65')][_0xc884('0xa4')][_0x361e41]['basename'])};}}return respondWithRpcPromise(_0xc884('0xa8'),_0xc884('0xa8'),{'FaxAccountId':_[_0xc884('0xa9')](_0x4213a6[_0xc884('0x59')]['id'])?undefined:_0x4213a6[_0xc884('0x59')]['id'],'path':_[_0xc884('0xa9')](_0x4213a6['body'][_0xc884('0xa4')][0x0][_0xc884('0x5')])?undefined:_0x4213a6[_0xc884('0x65')]['attachments'][0x0][_0xc884('0x5')],'fax':_['isNil'](_0x4213a6[_0xc884('0x65')]['to'][0x0])?undefined:_0x4213a6['body']['to'][0x0]},client9002);})[_0xc884('0x20')](function(){if(_0x29713a){if(_[_0xc884('0xa9')](_0x4213a6['body'][_0xc884('0xaa')])){_0x4213a6[_0xc884('0x65')][_0xc884('0xaa')]=util['format'](_0xc884('0xab'),_0x29713a[_0xc884('0x3a')],_0x29713a[_0xc884('0xac')]);}if(_0x29713a[_0xc884('0xad')]){if(_0x29713a[_0xc884('0xad')][_0xc884('0xa2')]['length']){return _0x29713a[_0xc884('0xad')][_0xc884('0xa2')][0x0];}else{return db[_0xc884('0xa1')][_0xc884('0x5d')](_[_0xc884('0x19')](_0x4213a6[_0xc884('0x65')],{'firstName':_0x4213a6[_0xc884('0x65')]['to'][0x0],'phone':_0x4213a6['body']['to'][0x0],'fax':_0x4213a6[_0xc884('0x65')]['to'][0x0],'ListId':_0x29713a[_0xc884('0xae')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error('Send\x20Fax\x20failed');}})[_0xc884('0x20')](function(_0x538612){if(_0x538612){return db['FaxInteraction'][_0xc884('0x5c')]({'where':{'ContactId':_0x538612['id'],'closed':![],'FaxAccountId':_0x29713a['id']}})[_0xc884('0x20')](function(_0x1aade6){if(_0x1aade6){return[_0x1aade6,![]];}return db[_0xc884('0x72')][_0xc884('0x5d')]({'UserId':_0x4213a6[_0xc884('0x60')]['id'],'ContactId':_0x538612['id'],'FaxAccountId':_0x29713a['id'],'fax':_0x4213a6[_0xc884('0x65')]['to'][0x0],'firstMsgDirection':_0xc884('0xaf'),'Messages':[_[_0xc884('0x5b')](_0x4213a6[_0xc884('0x65')],{'read':![],'body':_0x4213a6['body'][_0xc884('0xa4')][0x0]['filename'],'FaxAccountId':_0x29713a['id'],'UserId':_0x4213a6[_0xc884('0x60')]['id'],'ContactId':_0x538612['id'],'AttachmentId':_0x4213a6[_0xc884('0x65')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0xc884('0x9c')],'as':_0xc884('0xb0')}]})[_0xc884('0x20')](function(_0x4fffaa){return[_0x4fffaa,!![]];});});}else{throw new Error(_0xc884('0xb1'));}})['spread'](function(_0x2d827b,_0x4644ab){if(_0x4644ab){return _0x2d827b;}return db[_0xc884('0x9c')][_0xc884('0x5d')]({'direction':_0xc884('0xaf'),'read':![],'body':_0x4213a6[_0xc884('0x65')][_0xc884('0xa4')][0x0][_0xc884('0xb2')],'FaxAccountId':_0x29713a['id'],'FaxInteractionId':_0x2d827b['id'],'UserId':_0x4213a6[_0xc884('0x60')]['id'],'ContactId':_0x2d827b[_0xc884('0xb3')],'AttachmentId':_0x4213a6[_0xc884('0x65')]['attachments'][0x0]['id']})[_0xc884('0x20')](function(_0x422f65){_0x2d827b['dataValues']['Messages']=[];_0x2d827b[_0xc884('0xb4')][_0xc884('0xb0')][_0xc884('0x8a')](_0x422f65[_0xc884('0xb4')]);return _0x2d827b;});})['then'](function(_0xc106c5){respondWithRpcPromise(_0xc884('0xb5'),_0xc884('0xb5'),{'FaxAccountId':_[_0xc884('0xa9')](_0x4213a6[_0xc884('0x59')]['id'])?undefined:_0x4213a6[_0xc884('0x59')]['id'],'path':_[_0xc884('0xa9')](_0x4213a6[_0xc884('0x65')][_0xc884('0xa4')][0x0]['path'])?undefined:_0x4213a6[_0xc884('0x65')][_0xc884('0xa4')][0x0][_0xc884('0x5')],'fax':_[_0xc884('0xa9')](_0x4213a6[_0xc884('0x65')]['to'][0x0])?undefined:_0x4213a6[_0xc884('0x65')]['to'][0x0],'AttachmentId':_0x4213a6[_0xc884('0x65')]['attachments'][0x0]['id']},client9002)[_0xc884('0x20')](function(_0x2bb722){logger['info'](_0xc884('0xb6'),_0x2bb722);})[_0xc884('0x58')](function(_0x22aeeb){logger[_0xc884('0x21')](_0xc884('0xb6'),_0x22aeeb);});return _0xc106c5;})['then'](respondWithResult(_0x1aa5e4,null))[_0xc884('0x58')](handleError(_0x1aa5e4,null));};exports[_0xc884('0xb7')]=function(_0x4d45a2,_0x40aa82,_0x27baf5){return db[_0xc884('0x53')]['find']({'where':{'id':_0x4d45a2[_0xc884('0x59')]['id']}})[_0xc884('0x20')](handleEntityNotFound(_0x40aa82,null))[_0xc884('0x20')](function(_0x38a601){if(_0x38a601){return _0x38a601[_0xc884('0xb7')](_0x4d45a2[_0xc884('0x65')][_0xc884('0x6d')],_['omit'](_0x4d45a2['body'],[_0xc884('0x6d'),'id'])||{})[_0xc884('0xb8')](function(_0x37cee4){for(var _0x13f5bd=0x0;_0x13f5bd<_0x4d45a2[_0xc884('0x65')]['ids'][_0xc884('0x49')];_0x13f5bd+=0x1){socket[_0xc884('0xb9')]('userFaxAccount:save',{'UserId':Number(_0x4d45a2[_0xc884('0x65')]['ids'][_0x13f5bd]),'FaxAccountId':Number(_0x4d45a2[_0xc884('0x59')]['id'])});}return _0x37cee4;});}})['then'](respondWithResult(_0x40aa82,null))[_0xc884('0x58')](handleError(_0x40aa82,null));};exports['removeAgents']=function(_0x50e930,_0x3f6197,_0x4d1478){return db[_0xc884('0x53')][_0xc884('0x5c')]({'where':{'id':_0x50e930[_0xc884('0x59')]['id']}})['then'](handleEntityNotFound(_0x3f6197,null))['then'](function(_0x2e6a59){if(_0x2e6a59){return _0x2e6a59[_0xc884('0xba')](_0x50e930['query']['ids'])[_0xc884('0x20')](function(){if(_[_0xc884('0xbb')](_0x50e930[_0xc884('0x43')]['ids'])){for(var _0x530040=0x0;_0x530040<_0x50e930[_0xc884('0x43')][_0xc884('0x6d')]['length'];_0x530040+=0x1){socket[_0xc884('0xb9')]('userFaxAccount:remove',{'UserId':Number(_0x50e930[_0xc884('0x43')]['ids'][_0x530040]),'FaxAccountId':Number(_0x50e930[_0xc884('0x59')]['id'])});}}else{socket[_0xc884('0xb9')](_0xc884('0xbc'),{'UserId':Number(_0x50e930[_0xc884('0x43')][_0xc884('0x6d')]),'FaxAccountId':Number(_0x50e930[_0xc884('0x59')]['id'])});}});}})[_0xc884('0x20')](respondWithStatusCode(_0x3f6197,null))['catch'](handleError(_0x3f6197,null));};exports[_0xc884('0xbd')]=function(_0x105582,_0x35ee03,_0x4ebccc){var _0x19dc5c={};var _0x507391={};var _0x45cfdf;var _0x5e6f52;return db[_0xc884('0x53')][_0xc884('0x6b')]({'where':{'id':_0x105582[_0xc884('0x59')]['id']}})['then'](handleEntityNotFound(_0x35ee03,null))[_0xc884('0x20')](function(_0x321208){if(_0x321208){_0x45cfdf=_0x321208;_0x507391[_0xc884('0x41')]=_[_0xc884('0x44')](db['User']['rawAttributes']);_0x507391['query']=_[_0xc884('0x44')](_0x105582['query']);_0x507391[_0xc884('0x45')]=_[_0xc884('0x46')](_0x507391[_0xc884('0x41')],_0x507391['query']);_0x19dc5c[_0xc884('0x47')]=_[_0xc884('0x46')](_0x507391['model'],qs[_0xc884('0x48')](_0x105582[_0xc884('0x43')][_0xc884('0x48')]));_0x19dc5c[_0xc884('0x47')]=_0x19dc5c[_0xc884('0x47')][_0xc884('0x49')]?_0x19dc5c['attributes']:_0x507391[_0xc884('0x41')];_0x19dc5c[_0xc884('0x4c')]=qs[_0xc884('0x4d')](_0x105582['query']['sort']);_0x19dc5c['where']=qs[_0xc884('0x45')](_[_0xc884('0x4e')](_0x105582[_0xc884('0x43')],_0x507391['filters']));if(_0x105582[_0xc884('0x43')][_0xc884('0x4f')]){_0x19dc5c[_0xc884('0x50')]=_[_0xc884('0x5b')](_0x19dc5c['where'],{'$or':_[_0xc884('0x42')](_0x19dc5c[_0xc884('0x47')],function(_0x4e7c10){var _0x29acf5={};_0x29acf5[_0x4e7c10]={'$like':'%'+_0x105582[_0xc884('0x43')]['filter']+'%'};return _0x29acf5;})});}_0x19dc5c=_['merge']({},_0x19dc5c,_0x105582[_0xc884('0x52')]);return _0x45cfdf[_0xc884('0xbd')](_0x19dc5c);}})[_0xc884('0x20')](function(_0xe50258){if(_0xe50258){_0x5e6f52=_0xe50258[_0xc884('0x49')];if(!_0x105582[_0xc884('0x43')][_0xc884('0x4a')](_0xc884('0x4b'))){_0x19dc5c[_0xc884('0x30')]=qs[_0xc884('0x30')](_0x105582['query']['limit']);_0x19dc5c[_0xc884('0x2e')]=qs[_0xc884('0x2e')](_0x105582[_0xc884('0x43')][_0xc884('0x2e')]);}return _0x45cfdf[_0xc884('0xbd')](_0x19dc5c);}})['then'](function(_0x531b3f){if(_0x531b3f){return _0x531b3f?{'count':_0x5e6f52,'rows':_0x531b3f}:null;}})[_0xc884('0x20')](respondWithResult(_0x35ee03,null))[_0xc884('0x58')](handleError(_0x35ee03,null));}; \ No newline at end of file +var _0xddb1=['Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','priority','finally','getApplications','FaxApplication','context','localstationid','app','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','headerinfo','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','key','createdAt','updatedAt','TrunkId','ListId','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','List\x20not\x20found','filename','Messages','Contact\x20not\x20found','out','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','User','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxAccount.socket','register','jayson/promise','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','destroy','get','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','map','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','FaxAccountId','getDispositions','Disposition','order','pick','removeDispositions','ids','addAnswer','findOne','CannedAnswer','removeAnswers','addInteraction','omit','FaxInteraction','CmContact','Contact','fullname','internal'];(function(_0x135ad6,_0x55a72c){var _0x210f5a=function(_0x3b08e6){while(--_0x3b08e6){_0x135ad6['push'](_0x135ad6['shift']());}};_0x210f5a(++_0x55a72c);}(_0xddb1,0x119));var _0x1ddb=function(_0x221122,_0x33548a){_0x221122=_0x221122-0x0;var _0x17d260=_0xddb1[_0x221122];return _0x17d260;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1ddb('0x0'));var zipdir=require(_0x1ddb('0x1'));var jsonpatch=require(_0x1ddb('0x2'));var rp=require(_0x1ddb('0x3'));var moment=require(_0x1ddb('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1ddb('0x5'));var path=require(_0x1ddb('0x6'));var sox=require(_0x1ddb('0x7'));var csv=require(_0x1ddb('0x8'));var ejs=require(_0x1ddb('0x9'));var fs=require('fs');var fs_extra=require(_0x1ddb('0xa'));var _=require(_0x1ddb('0xb'));var squel=require(_0x1ddb('0xc'));var crypto=require(_0x1ddb('0xd'));var jsforce=require(_0x1ddb('0xe'));var deskjs=require(_0x1ddb('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1ddb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1ddb('0x11'));var qs=require(_0x1ddb('0x12'));var as=require(_0x1ddb('0x13'));var hardwareService=require(_0x1ddb('0x14'));var logger=require('../../config/logger')(_0x1ddb('0x15'));var utils=require(_0x1ddb('0x16'));var config=require(_0x1ddb('0x17'));var licenseUtil=require(_0x1ddb('0x18'));var db=require(_0x1ddb('0x19'))['db'];config[_0x1ddb('0x1a')]=_[_0x1ddb('0x1b')](config[_0x1ddb('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x1ddb('0x1c'))(new Redis(config[_0x1ddb('0x1a')]));require(_0x1ddb('0x1d'))[_0x1ddb('0x1e')](socket);var jayson=require(_0x1ddb('0x1f'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client'][_0x1ddb('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x583e8a,_0x5d1191,_0x118a7b,_0x231fc0){return new BPromise(function(_0x2d5433,_0x27f218){var _0x28f9e1=_0x231fc0||client;return _0x28f9e1[_0x1ddb('0x21')](_0x583e8a,_0x118a7b)[_0x1ddb('0x22')](function(_0x256bc5){logger[_0x1ddb('0x23')](_0x1ddb('0x24'),_0x5d1191,_0x1ddb('0x25'));logger[_0x1ddb('0x26')](_0x1ddb('0x27'),_0x5d1191,'request\x20sent',JSON[_0x1ddb('0x28')](_0x256bc5));if(_0x256bc5[_0x1ddb('0x29')]){if(_0x256bc5[_0x1ddb('0x29')][_0x1ddb('0x2a')]===0x1f4){logger[_0x1ddb('0x29')](_0x1ddb('0x24'),_0x5d1191,_0x256bc5[_0x1ddb('0x29')]['message']);return _0x27f218(_0x256bc5[_0x1ddb('0x29')][_0x1ddb('0x2b')]);}logger['error'](_0x1ddb('0x24'),_0x5d1191,_0x256bc5[_0x1ddb('0x29')][_0x1ddb('0x2b')]);return _0x2d5433(_0x256bc5['error'][_0x1ddb('0x2b')]);}else{logger['info'](_0x1ddb('0x24'),_0x5d1191,_0x1ddb('0x25'));_0x2d5433(_0x256bc5[_0x1ddb('0x2c')]['message']);}})[_0x1ddb('0x2d')](function(_0xf70536){logger[_0x1ddb('0x29')](_0x1ddb('0x24'),_0x5d1191,_0xf70536);_0x27f218(_0xf70536);});});}function respondWithStatusCode(_0x1d8080,_0x20fc18){_0x20fc18=_0x20fc18||0xcc;return function(_0x1bf153){if(_0x1bf153){return _0x1d8080[_0x1ddb('0x2e')](_0x20fc18);}return _0x1d8080['status'](_0x20fc18)[_0x1ddb('0x2f')]();};}function respondWithResult(_0x17ab58,_0x5dd3cd){_0x5dd3cd=_0x5dd3cd||0xc8;return function(_0x21e323){if(_0x21e323){return _0x17ab58[_0x1ddb('0x30')](_0x5dd3cd)[_0x1ddb('0x31')](_0x21e323);}};}function respondWithFilteredResult(_0x3b17f2,_0x42d800){return function(_0x43a2b6){if(_0x43a2b6){var _0x27f494=typeof _0x42d800[_0x1ddb('0x32')]===_0x1ddb('0x33')&&typeof _0x42d800[_0x1ddb('0x34')]===_0x1ddb('0x33');var _0x4e352d=_0x43a2b6[_0x1ddb('0x35')];var _0x1aa5a4=_0x27f494?0x0:_0x42d800[_0x1ddb('0x32')];var _0x2f3b76=_0x27f494?_0x43a2b6[_0x1ddb('0x35')]:_0x42d800[_0x1ddb('0x32')]+_0x42d800[_0x1ddb('0x34')];var _0x48f393;if(_0x2f3b76>=_0x4e352d){_0x2f3b76=_0x4e352d;_0x48f393=0xc8;}else{_0x48f393=0xce;}_0x3b17f2[_0x1ddb('0x30')](_0x48f393);return _0x3b17f2[_0x1ddb('0x36')]('Content-Range',_0x1aa5a4+'-'+_0x2f3b76+'/'+_0x4e352d)['json'](_0x43a2b6);}return null;};}function patchUpdates(_0x19849f){return function(_0x5afa71){try{jsonpatch[_0x1ddb('0x37')](_0x5afa71,_0x19849f,!![]);}catch(_0xccbd24){return BPromise[_0x1ddb('0x38')](_0xccbd24);}return _0x5afa71[_0x1ddb('0x39')]();};}function saveUpdates(_0xf23fbf,_0x426f56){return function(_0x3a6fa1){if(_0x3a6fa1){return _0x3a6fa1['update'](_0xf23fbf)['then'](function(_0x584d08){return _0x584d08;});}return null;};}function removeEntity(_0x733a36,_0x270778){return function(_0x4ff908){if(_0x4ff908){return _0x4ff908[_0x1ddb('0x3a')]()['then'](function(){var _0x23740f=_0x4ff908[_0x1ddb('0x3b')]({'plain':!![]});var _0x30c2d7='FaxAccounts';return db[_0x1ddb('0x3c')]['destroy']({'where':{'type':_0x30c2d7,'resourceId':_0x23740f['id']}})[_0x1ddb('0x22')](function(){return _0x4ff908;});})[_0x1ddb('0x22')](function(){_0x733a36['status'](0xcc)[_0x1ddb('0x2f')]();});}};}function handleEntityNotFound(_0x52921b,_0xbfbd58){return function(_0x4a58e7){if(!_0x4a58e7){_0x52921b[_0x1ddb('0x2e')](0x194);}return _0x4a58e7;};}function handleError(_0x11fe5b,_0x34cb4d){_0x34cb4d=_0x34cb4d||0x1f4;return function(_0x461ee1){logger[_0x1ddb('0x29')](_0x461ee1[_0x1ddb('0x3d')]);if(_0x461ee1[_0x1ddb('0x3e')]){delete _0x461ee1[_0x1ddb('0x3e')];}_0x11fe5b[_0x1ddb('0x30')](_0x34cb4d)[_0x1ddb('0x3f')](_0x461ee1);};}exports[_0x1ddb('0x40')]=function(_0x3e2322,_0x1afc01){var _0x37f30c={'include':[{'model':db[_0x1ddb('0x41')],'as':_0x1ddb('0x42')}]},_0x50f589={},_0xb352e5={'count':0x0,'rows':[]};var _0x5e23d8=_['map'](db[_0x1ddb('0x43')][_0x1ddb('0x44')],function(_0x36cd36){return{'name':_0x36cd36[_0x1ddb('0x45')],'type':_0x36cd36[_0x1ddb('0x46')]['key']};});_0x50f589[_0x1ddb('0x47')]=_['map'](_0x5e23d8,'name');_0x50f589[_0x1ddb('0x48')]=_[_0x1ddb('0x49')](_0x3e2322[_0x1ddb('0x48')]);_0x50f589['filters']=_['intersection'](_0x50f589[_0x1ddb('0x47')],_0x50f589[_0x1ddb('0x48')]);_0x37f30c[_0x1ddb('0x4a')]=_[_0x1ddb('0x4b')](_0x50f589[_0x1ddb('0x47')],qs[_0x1ddb('0x4c')](_0x3e2322['query']['fields']));_0x37f30c[_0x1ddb('0x4a')]=_0x37f30c[_0x1ddb('0x4a')][_0x1ddb('0x4d')]?_0x37f30c[_0x1ddb('0x4a')]:_0x50f589[_0x1ddb('0x47')];if(!_0x3e2322['query'][_0x1ddb('0x4e')](_0x1ddb('0x4f'))){_0x37f30c[_0x1ddb('0x34')]=qs[_0x1ddb('0x34')](_0x3e2322[_0x1ddb('0x48')]['limit']);_0x37f30c[_0x1ddb('0x32')]=qs['offset'](_0x3e2322[_0x1ddb('0x48')][_0x1ddb('0x32')]);}_0x37f30c['order']=qs[_0x1ddb('0x50')](_0x3e2322['query']['sort']);_0x37f30c[_0x1ddb('0x51')]=qs[_0x1ddb('0x52')](_['pick'](_0x3e2322['query'],_0x50f589[_0x1ddb('0x52')]),_0x5e23d8);if(_0x3e2322['query'][_0x1ddb('0x53')]){_0x37f30c['where']=_['merge'](_0x37f30c[_0x1ddb('0x51')],{'$or':_[_0x1ddb('0x54')](_0x5e23d8,function(_0x42d0b1){if(_0x42d0b1[_0x1ddb('0x46')]!=='VIRTUAL'){var _0x5eb9c0={};_0x5eb9c0[_0x42d0b1[_0x1ddb('0x3e')]]={'$like':'%'+_0x3e2322[_0x1ddb('0x48')]['filter']+'%'};return _0x5eb9c0;}})});}_0x37f30c=_[_0x1ddb('0x55')]({},_0x37f30c,_0x3e2322[_0x1ddb('0x56')]);var _0x51bb50={'where':_0x37f30c['where']};return db[_0x1ddb('0x43')][_0x1ddb('0x35')](_0x51bb50)[_0x1ddb('0x22')](function(_0x12fa01){_0xb352e5[_0x1ddb('0x35')]=_0x12fa01;if(_0x3e2322['query'][_0x1ddb('0x57')]){_0x37f30c[_0x1ddb('0x58')]=[{'all':!![]}];}return db[_0x1ddb('0x43')][_0x1ddb('0x59')](_0x37f30c);})[_0x1ddb('0x22')](function(_0x11240b){_0xb352e5[_0x1ddb('0x5a')]=_0x11240b;return _0xb352e5;})[_0x1ddb('0x22')](respondWithFilteredResult(_0x1afc01,_0x37f30c))[_0x1ddb('0x2d')](handleError(_0x1afc01,null));};exports[_0x1ddb('0x5b')]=function(_0x2f1abd,_0x12e2de){var _0x16ae18={'raw':![],'where':{'id':_0x2f1abd[_0x1ddb('0x5c')]['id']},'include':[{'model':db['Pause'],'as':_0x1ddb('0x42')}]},_0x4635bf={};_0x4635bf[_0x1ddb('0x47')]=_[_0x1ddb('0x49')](db[_0x1ddb('0x43')]['rawAttributes']);_0x4635bf[_0x1ddb('0x48')]=_[_0x1ddb('0x49')](_0x2f1abd[_0x1ddb('0x48')]);_0x4635bf[_0x1ddb('0x52')]=_['intersection'](_0x4635bf[_0x1ddb('0x47')],_0x4635bf['query']);_0x16ae18[_0x1ddb('0x4a')]=_[_0x1ddb('0x4b')](_0x4635bf[_0x1ddb('0x47')],qs['fields'](_0x2f1abd[_0x1ddb('0x48')][_0x1ddb('0x4c')]));_0x16ae18['attributes']=_0x16ae18['attributes'][_0x1ddb('0x4d')]?_0x16ae18[_0x1ddb('0x4a')]:_0x4635bf['model'];if(_0x2f1abd[_0x1ddb('0x48')][_0x1ddb('0x57')]){_0x16ae18[_0x1ddb('0x58')]=[{'all':!![]}];}_0x16ae18=_[_0x1ddb('0x55')]({},_0x16ae18,_0x2f1abd[_0x1ddb('0x56')]);return db['FaxAccount'][_0x1ddb('0x5d')](_0x16ae18)[_0x1ddb('0x22')](handleEntityNotFound(_0x12e2de,null))['then'](respondWithResult(_0x12e2de,null))[_0x1ddb('0x2d')](handleError(_0x12e2de,null));};exports[_0x1ddb('0x5e')]=function(_0x16361d,_0x2b015e){return db['FaxAccount'][_0x1ddb('0x5e')](_0x16361d[_0x1ddb('0x5f')],{})['then'](function(_0x121b4a){var _0x3f071b=_0x16361d[_0x1ddb('0x60')][_0x1ddb('0x3b')]({'plain':!![]});if(!_0x3f071b)throw new Error(_0x1ddb('0x61'));if(_0x3f071b[_0x1ddb('0x62')]===_0x1ddb('0x60')){var _0x128d12=_0x121b4a[_0x1ddb('0x3b')]({'plain':!![]});var _0x1c96a4=_0x1ddb('0x63');return db[_0x1ddb('0x64')][_0x1ddb('0x5d')]({'where':{'name':_0x1c96a4,'userProfileId':_0x3f071b['userProfileId']},'raw':!![]})[_0x1ddb('0x22')](function(_0x29c2de){if(_0x29c2de&&_0x29c2de[_0x1ddb('0x65')]===0x0){return db[_0x1ddb('0x3c')][_0x1ddb('0x5e')]({'name':_0x128d12[_0x1ddb('0x3e')],'resourceId':_0x128d12['id'],'type':_0x29c2de[_0x1ddb('0x3e')],'sectionId':_0x29c2de['id']},{})[_0x1ddb('0x22')](function(){return _0x121b4a;});}else{return _0x121b4a;}})[_0x1ddb('0x2d')](function(_0xc63ff){logger['error'](_0x1ddb('0x66'),_0xc63ff);throw _0xc63ff;});}return _0x121b4a;})[_0x1ddb('0x22')](respondWithResult(_0x2b015e,0xc9))[_0x1ddb('0x2d')](handleError(_0x2b015e,null));};exports[_0x1ddb('0x67')]=function(_0x51e0b1,_0x4f3626){if(_0x51e0b1[_0x1ddb('0x5f')]['id']){delete _0x51e0b1[_0x1ddb('0x5f')]['id'];}return db['FaxAccount'][_0x1ddb('0x5d')]({'where':{'id':_0x51e0b1['params']['id']},'include':[{'model':db[_0x1ddb('0x41')],'as':_0x1ddb('0x42')}]})['then'](handleEntityNotFound(_0x4f3626,null))['then'](saveUpdates(_0x51e0b1[_0x1ddb('0x5f')],null))[_0x1ddb('0x22')](respondWithResult(_0x4f3626,null))['catch'](handleError(_0x4f3626,null));};exports[_0x1ddb('0x3a')]=function(_0x3c221a,_0x1641ba){return db[_0x1ddb('0x43')][_0x1ddb('0x5d')]({'where':{'id':_0x3c221a[_0x1ddb('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1641ba,null))[_0x1ddb('0x22')](removeEntity(_0x1641ba,null))[_0x1ddb('0x2d')](handleError(_0x1641ba,null));};exports[_0x1ddb('0x68')]=function(_0x1064f1,_0x230136){return db[_0x1ddb('0x43')]['describe']()[_0x1ddb('0x22')](respondWithResult(_0x230136,null))['catch'](handleError(_0x230136,null));};exports['addDisposition']=function(_0x3ac892,_0x33bc08,_0x1deac2){if(_0x3ac892['body']['id']){delete _0x3ac892['body']['id'];}return db[_0x1ddb('0x43')]['find']({'where':{'id':_0x3ac892[_0x1ddb('0x5c')]['id']}})[_0x1ddb('0x22')](handleEntityNotFound(_0x33bc08,null))['then'](function(_0x5cd86f){if(_0x5cd86f){_0x3ac892['body'][_0x1ddb('0x69')]=_0x5cd86f['id'];return db['Disposition']['create'](_0x3ac892[_0x1ddb('0x5f')]);}})['then'](respondWithResult(_0x33bc08,null))[_0x1ddb('0x2d')](handleError(_0x33bc08,null));};exports[_0x1ddb('0x6a')]=function(_0x2fb8f4,_0x31ed29,_0x22a7d1){var _0x5f3f52={'raw':![],'where':{}};var _0x2eaf21={};var _0x374bba={'count':0x0,'rows':[]};return db[_0x1ddb('0x43')]['findOne']({'where':{'id':_0x2fb8f4[_0x1ddb('0x5c')]['id']}})['then'](handleEntityNotFound(_0x31ed29,null))['then'](function(_0x29b2b2){if(_0x29b2b2){_0x2eaf21[_0x1ddb('0x47')]=_[_0x1ddb('0x49')](db[_0x1ddb('0x6b')][_0x1ddb('0x44')]);_0x2eaf21['query']=_[_0x1ddb('0x49')](_0x2fb8f4[_0x1ddb('0x48')]);_0x2eaf21[_0x1ddb('0x52')]=_['intersection'](_0x2eaf21[_0x1ddb('0x47')],_0x2eaf21[_0x1ddb('0x48')]);_0x5f3f52[_0x1ddb('0x4a')]=_[_0x1ddb('0x4b')](_0x2eaf21[_0x1ddb('0x47')],qs[_0x1ddb('0x4c')](_0x2fb8f4[_0x1ddb('0x48')]['fields']));_0x5f3f52[_0x1ddb('0x4a')]=_0x5f3f52[_0x1ddb('0x4a')][_0x1ddb('0x4d')]?_0x5f3f52[_0x1ddb('0x4a')]:_0x2eaf21[_0x1ddb('0x47')];if(!_0x2fb8f4['query'][_0x1ddb('0x4e')]('nolimit')){_0x5f3f52[_0x1ddb('0x34')]=qs[_0x1ddb('0x34')](_0x2fb8f4[_0x1ddb('0x48')]['limit']);_0x5f3f52[_0x1ddb('0x32')]=qs['offset'](_0x2fb8f4[_0x1ddb('0x48')][_0x1ddb('0x32')]);}_0x5f3f52[_0x1ddb('0x6c')]=qs[_0x1ddb('0x50')](_0x2fb8f4[_0x1ddb('0x48')][_0x1ddb('0x50')]);_0x5f3f52[_0x1ddb('0x51')]=qs['filters'](_[_0x1ddb('0x6d')](_0x2fb8f4['query'],_0x2eaf21[_0x1ddb('0x52')]));_0x5f3f52[_0x1ddb('0x51')][_0x1ddb('0x69')]=_0x29b2b2['id'];if(_0x2fb8f4[_0x1ddb('0x48')][_0x1ddb('0x53')]){_0x5f3f52[_0x1ddb('0x51')]=_[_0x1ddb('0x55')](_0x5f3f52['where'],{'$or':_[_0x1ddb('0x54')](_0x5f3f52[_0x1ddb('0x4a')],function(_0x16143d){var _0x3aad32={};_0x3aad32[_0x16143d]={'$like':'%'+_0x2fb8f4[_0x1ddb('0x48')][_0x1ddb('0x53')]+'%'};return _0x3aad32;})});}_0x5f3f52=_['merge']({},_0x5f3f52,_0x2fb8f4[_0x1ddb('0x56')]);return db[_0x1ddb('0x6b')][_0x1ddb('0x35')]({'where':_0x5f3f52[_0x1ddb('0x51')]})[_0x1ddb('0x22')](function(_0x106ae3){_0x374bba[_0x1ddb('0x35')]=_0x106ae3;if(_0x2fb8f4[_0x1ddb('0x48')]['includeAll']){_0x5f3f52[_0x1ddb('0x58')]=[{'all':!![]}];}return db[_0x1ddb('0x6b')][_0x1ddb('0x59')](_0x5f3f52);})[_0x1ddb('0x22')](function(_0x2a31ef){_0x374bba[_0x1ddb('0x5a')]=_0x2a31ef;return _0x374bba;});}})[_0x1ddb('0x22')](respondWithFilteredResult(_0x31ed29,_0x5f3f52))[_0x1ddb('0x2d')](handleError(_0x31ed29,null));};exports[_0x1ddb('0x6e')]=function(_0x1935f5,_0x17f65d,_0x553f67){return db[_0x1ddb('0x43')][_0x1ddb('0x5d')]({'where':{'id':_0x1935f5['params']['id']}})[_0x1ddb('0x22')](handleEntityNotFound(_0x17f65d,null))[_0x1ddb('0x22')](function(_0x235f10){if(_0x235f10){return _0x235f10[_0x1ddb('0x6e')](_0x1935f5[_0x1ddb('0x48')][_0x1ddb('0x6f')]);}})['then'](respondWithStatusCode(_0x17f65d,null))['catch'](handleError(_0x17f65d,null));};exports[_0x1ddb('0x70')]=function(_0x11c082,_0x424a35,_0x3a4e32){if(_0x11c082[_0x1ddb('0x5f')]['id']){delete _0x11c082[_0x1ddb('0x5f')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x11c082[_0x1ddb('0x5c')]['id']}})[_0x1ddb('0x22')](handleEntityNotFound(_0x424a35,null))[_0x1ddb('0x22')](function(_0x132be7){if(_0x132be7){_0x11c082[_0x1ddb('0x5f')][_0x1ddb('0x69')]=_0x132be7['id'];return db['CannedAnswer'][_0x1ddb('0x5e')](_0x11c082[_0x1ddb('0x5f')]);}})[_0x1ddb('0x22')](respondWithResult(_0x424a35,null))[_0x1ddb('0x2d')](handleError(_0x424a35,null));};exports['getAnswers']=function(_0x4c4fb3,_0x4a46ee,_0x5ea06e){var _0x3b1783={'raw':![],'where':{}};var _0xaaf759={};var _0x430a93={'count':0x0,'rows':[]};return db[_0x1ddb('0x43')][_0x1ddb('0x71')]({'where':{'id':_0x4c4fb3[_0x1ddb('0x5c')]['id']}})[_0x1ddb('0x22')](handleEntityNotFound(_0x4a46ee,null))['then'](function(_0x4ebb0f){if(_0x4ebb0f){_0xaaf759[_0x1ddb('0x47')]=_[_0x1ddb('0x49')](db[_0x1ddb('0x72')][_0x1ddb('0x44')]);_0xaaf759['query']=_[_0x1ddb('0x49')](_0x4c4fb3['query']);_0xaaf759['filters']=_[_0x1ddb('0x4b')](_0xaaf759[_0x1ddb('0x47')],_0xaaf759[_0x1ddb('0x48')]);_0x3b1783['attributes']=_[_0x1ddb('0x4b')](_0xaaf759[_0x1ddb('0x47')],qs[_0x1ddb('0x4c')](_0x4c4fb3[_0x1ddb('0x48')][_0x1ddb('0x4c')]));_0x3b1783[_0x1ddb('0x4a')]=_0x3b1783[_0x1ddb('0x4a')][_0x1ddb('0x4d')]?_0x3b1783['attributes']:_0xaaf759[_0x1ddb('0x47')];if(!_0x4c4fb3[_0x1ddb('0x48')]['hasOwnProperty'](_0x1ddb('0x4f'))){_0x3b1783[_0x1ddb('0x34')]=qs[_0x1ddb('0x34')](_0x4c4fb3[_0x1ddb('0x48')][_0x1ddb('0x34')]);_0x3b1783[_0x1ddb('0x32')]=qs[_0x1ddb('0x32')](_0x4c4fb3['query'][_0x1ddb('0x32')]);}_0x3b1783[_0x1ddb('0x6c')]=qs[_0x1ddb('0x50')](_0x4c4fb3['query'][_0x1ddb('0x50')]);_0x3b1783[_0x1ddb('0x51')]=qs['filters'](_[_0x1ddb('0x6d')](_0x4c4fb3[_0x1ddb('0x48')],_0xaaf759[_0x1ddb('0x52')]));_0x3b1783[_0x1ddb('0x51')]['FaxAccountId']=_0x4ebb0f['id'];if(_0x4c4fb3[_0x1ddb('0x48')][_0x1ddb('0x53')]){_0x3b1783['where']=_['merge'](_0x3b1783[_0x1ddb('0x51')],{'$or':_[_0x1ddb('0x54')](_0x3b1783['attributes'],function(_0x16f431){var _0x17f238={};_0x17f238[_0x16f431]={'$like':'%'+_0x4c4fb3['query'][_0x1ddb('0x53')]+'%'};return _0x17f238;})});}_0x3b1783=_[_0x1ddb('0x55')]({},_0x3b1783,_0x4c4fb3[_0x1ddb('0x56')]);return db[_0x1ddb('0x72')]['count']({'where':_0x3b1783[_0x1ddb('0x51')]})[_0x1ddb('0x22')](function(_0xf73385){_0x430a93[_0x1ddb('0x35')]=_0xf73385;if(_0x4c4fb3[_0x1ddb('0x48')][_0x1ddb('0x57')]){_0x3b1783['include']=[{'all':!![]}];}return db[_0x1ddb('0x72')][_0x1ddb('0x59')](_0x3b1783);})[_0x1ddb('0x22')](function(_0x15aef0){_0x430a93[_0x1ddb('0x5a')]=_0x15aef0;return _0x430a93;});}})[_0x1ddb('0x22')](respondWithFilteredResult(_0x4a46ee,_0x3b1783))[_0x1ddb('0x2d')](handleError(_0x4a46ee,null));};exports[_0x1ddb('0x73')]=function(_0x21c9df,_0x48794c,_0x84de8){return db['FaxAccount'][_0x1ddb('0x5d')]({'where':{'id':_0x21c9df['params']['id']}})[_0x1ddb('0x22')](handleEntityNotFound(_0x48794c,null))['then'](function(_0x1326ac){if(_0x1326ac){return _0x1326ac[_0x1ddb('0x73')](_0x21c9df[_0x1ddb('0x48')][_0x1ddb('0x6f')]);}})[_0x1ddb('0x22')](respondWithStatusCode(_0x48794c,null))[_0x1ddb('0x2d')](handleError(_0x48794c,null));};exports[_0x1ddb('0x74')]=function(_0x47e60c,_0x534e14,_0x4824fb){return db['FaxInteraction']['find']({'where':{'id':_0x47e60c[_0x1ddb('0x5c')]['id']}})[_0x1ddb('0x22')](handleEntityNotFound(_0x534e14,null))['then'](function(_0xc427b1){if(_0xc427b1){return _0xc427b1['addInteraction'](_0x47e60c[_0x1ddb('0x5f')][_0x1ddb('0x6f')],_[_0x1ddb('0x75')](_0x47e60c[_0x1ddb('0x5f')],[_0x1ddb('0x6f'),'id'])||{});}})[_0x1ddb('0x22')](respondWithResult(_0x534e14,null))[_0x1ddb('0x2d')](handleError(_0x534e14,null));};exports['getInteractions']=function(_0x5213ce,_0x5d6457,_0x49c92d){var _0x2be54e={'raw':![],'where':{}};var _0x1ff977={};var _0x1b8eaf={'count':0x0,'rows':[]};return db[_0x1ddb('0x43')][_0x1ddb('0x71')]({'where':{'id':_0x5213ce[_0x1ddb('0x5c')]['id']}})['then'](handleEntityNotFound(_0x5d6457,null))['then'](function(_0x32d4f3){if(_0x32d4f3){_0x1ff977[_0x1ddb('0x47')]=_[_0x1ddb('0x49')](db[_0x1ddb('0x76')][_0x1ddb('0x44')]);_0x1ff977[_0x1ddb('0x48')]=_[_0x1ddb('0x49')](_0x5213ce[_0x1ddb('0x48')]);_0x1ff977[_0x1ddb('0x52')]=_[_0x1ddb('0x4b')](_0x1ff977[_0x1ddb('0x47')],_0x1ff977[_0x1ddb('0x48')]);_0x2be54e['attributes']=_[_0x1ddb('0x4b')](_0x1ff977[_0x1ddb('0x47')],qs[_0x1ddb('0x4c')](_0x5213ce[_0x1ddb('0x48')][_0x1ddb('0x4c')]));_0x2be54e[_0x1ddb('0x4a')]=_0x2be54e[_0x1ddb('0x4a')][_0x1ddb('0x4d')]?_0x2be54e['attributes']:_0x1ff977['model'];if(!_0x5213ce[_0x1ddb('0x48')]['hasOwnProperty'](_0x1ddb('0x4f'))){_0x2be54e[_0x1ddb('0x34')]=qs[_0x1ddb('0x34')](_0x5213ce[_0x1ddb('0x48')][_0x1ddb('0x34')]);_0x2be54e[_0x1ddb('0x32')]=qs[_0x1ddb('0x32')](_0x5213ce['query'][_0x1ddb('0x32')]);}_0x2be54e[_0x1ddb('0x6c')]=qs['sort'](_0x5213ce[_0x1ddb('0x48')][_0x1ddb('0x50')]);_0x2be54e[_0x1ddb('0x51')]=qs['filters'](_[_0x1ddb('0x6d')](_0x5213ce[_0x1ddb('0x48')],_0x1ff977[_0x1ddb('0x52')]));_0x2be54e[_0x1ddb('0x51')][_0x1ddb('0x69')]=_0x32d4f3['id'];if(_0x5213ce[_0x1ddb('0x48')][_0x1ddb('0x53')]){_0x2be54e['where']=_[_0x1ddb('0x55')](_0x2be54e[_0x1ddb('0x51')],{'$or':_[_0x1ddb('0x54')](_0x2be54e[_0x1ddb('0x4a')],function(_0x4d0fbd){var _0x2e220c={};_0x2e220c[_0x4d0fbd]={'$like':'%'+_0x5213ce[_0x1ddb('0x48')][_0x1ddb('0x53')]+'%'};return _0x2e220c;})});}_0x2be54e=_[_0x1ddb('0x55')]({},_0x2be54e,_0x5213ce['options']);return db[_0x1ddb('0x76')]['count']({'where':_0x2be54e[_0x1ddb('0x51')]})['then'](function(_0x418efe){_0x1b8eaf[_0x1ddb('0x35')]=_0x418efe;if(_0x5213ce[_0x1ddb('0x48')][_0x1ddb('0x57')]){_0x2be54e['include']=[{'model':db[_0x1ddb('0x77')],'as':_0x1ddb('0x78'),'required':![]},{'model':db['User'],'as':'Owner','attributes':['name',_0x1ddb('0x79'),_0x1ddb('0x7a')],'required':![]},{'model':db[_0x1ddb('0x7b')],'as':_0x1ddb('0x7c'),'attributes':['id','name',_0x1ddb('0x7d')],'where':_0x5213ce[_0x1ddb('0x48')][_0x1ddb('0x7e')]?{'id':_0x5213ce[_0x1ddb('0x48')][_0x1ddb('0x7e')]}:undefined,'required':_0x5213ce[_0x1ddb('0x48')][_0x1ddb('0x7e')]?!![]:![]}];}return db['FaxInteraction']['findAll'](_0x2be54e);})['then'](function(_0x44cd04){_0x1b8eaf[_0x1ddb('0x5a')]=_0x44cd04;return _0x1b8eaf;});}})[_0x1ddb('0x22')](respondWithFilteredResult(_0x5d6457,_0x2be54e))[_0x1ddb('0x2d')](handleError(_0x5d6457,null));};exports[_0x1ddb('0x7f')]=function(_0x2d3e86,_0x4845f3){var _0x457081=_0x2d3e86[_0x1ddb('0x5c')]['id'];var _0x477fcc=_0x2d3e86[_0x1ddb('0x5f')];var _0x4a0190=0xc8;var _0x2651a4=null;return db[_0x1ddb('0x80')][_0x1ddb('0x81')]({'isolationLevel':db[_0x1ddb('0x80')][_0x1ddb('0x82')][_0x1ddb('0x83')][_0x1ddb('0x84')]},function(_0x5c737f){return db[_0x1ddb('0x43')]['findOne']({'where':{'id':_0x457081},'transaction':_0x5c737f})[_0x1ddb('0x22')](function(_0x31b7bc){if(_0x31b7bc){return db['FaxApplication'][_0x1ddb('0x3a')]({'where':{'FaxAccountId':_0x457081},'transaction':_0x5c737f})[_0x1ddb('0x22')](function(){var _0x5cf8a8=_[_0x1ddb('0x54')](_0x477fcc,function(_0x26b8e9){_0x26b8e9['FaxAccountId']=_0x457081;return _0x26b8e9;});return db['FaxApplication'][_0x1ddb('0x85')](_0x5cf8a8,{'transaction':_0x5c737f});});}else{_0x4a0190=0x194;_0x2651a4=[];}});})['then'](function(){if(_0x4a0190!==0x194){return db['FaxApplication'][_0x1ddb('0x86')]({'where':{'FaxAccountId':_0x457081},'order':_0x1ddb('0x87')})[_0x1ddb('0x22')](function(_0x4482d8){_0x2651a4=_0x4482d8;});}})[_0x1ddb('0x2d')](function(_0x3d03a7){_0x4a0190=0x1f4;logger[_0x1ddb('0x29')](_0x3d03a7['stack']);if(_0x3d03a7['name']){delete _0x3d03a7[_0x1ddb('0x3e')];}_0x2651a4=_0x3d03a7;})[_0x1ddb('0x88')](function(){if(_0x2651a4===null){_0x4845f3[_0x1ddb('0x2e')](_0x4a0190);}else{if(_0x4a0190===0x1f4){_0x4845f3[_0x1ddb('0x30')](_0x4a0190)[_0x1ddb('0x3f')](_0x2651a4);}else{_0x4845f3[_0x1ddb('0x30')](_0x4a0190)[_0x1ddb('0x31')](_0x2651a4);}}});};exports[_0x1ddb('0x89')]=function(_0x24c9c3,_0x4ca6df,_0x4fdf5a){var _0x10ae72={};var _0x2a39ea={};var _0x39ce82;var _0x311116;return db[_0x1ddb('0x43')][_0x1ddb('0x71')]({'where':{'id':_0x24c9c3[_0x1ddb('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4ca6df,null))[_0x1ddb('0x22')](function(_0x516c99){if(_0x516c99){_0x39ce82=_0x516c99;_0x2a39ea['model']=_[_0x1ddb('0x49')](db[_0x1ddb('0x8a')]['rawAttributes']);_0x2a39ea[_0x1ddb('0x48')]=_[_0x1ddb('0x49')](_0x24c9c3['query']);_0x2a39ea[_0x1ddb('0x52')]=_[_0x1ddb('0x4b')](_0x2a39ea[_0x1ddb('0x47')],_0x2a39ea[_0x1ddb('0x48')]);_0x10ae72[_0x1ddb('0x4a')]=_[_0x1ddb('0x4b')](_0x2a39ea['model'],qs[_0x1ddb('0x4c')](_0x24c9c3[_0x1ddb('0x48')][_0x1ddb('0x4c')]));_0x10ae72['attributes']=_0x10ae72[_0x1ddb('0x4a')][_0x1ddb('0x4d')]?_0x10ae72[_0x1ddb('0x4a')]:_0x2a39ea[_0x1ddb('0x47')];_0x10ae72[_0x1ddb('0x6c')]=qs['sort'](_0x24c9c3['query'][_0x1ddb('0x50')]);_0x10ae72[_0x1ddb('0x51')]=qs[_0x1ddb('0x52')](_[_0x1ddb('0x6d')](_0x24c9c3[_0x1ddb('0x48')],_0x2a39ea[_0x1ddb('0x52')]));if(_0x24c9c3[_0x1ddb('0x48')]['filter']){_0x10ae72[_0x1ddb('0x51')]=_[_0x1ddb('0x55')](_0x10ae72[_0x1ddb('0x51')],{'$or':_[_0x1ddb('0x54')](_0x10ae72[_0x1ddb('0x4a')],function(_0x5bb9ca){var _0x53c2e7={};_0x53c2e7[_0x5bb9ca]={'$like':'%'+_0x24c9c3[_0x1ddb('0x48')][_0x1ddb('0x53')]+'%'};return _0x53c2e7;})});}_0x10ae72=_[_0x1ddb('0x55')]({},_0x10ae72,_0x24c9c3['options']);return _0x39ce82[_0x1ddb('0x89')](_0x10ae72);}})[_0x1ddb('0x22')](function(_0x4ba2c9){if(_0x4ba2c9){_0x311116=_0x4ba2c9[_0x1ddb('0x4d')];if(!_0x24c9c3[_0x1ddb('0x48')]['hasOwnProperty']('nolimit')){_0x10ae72[_0x1ddb('0x34')]=qs['limit'](_0x24c9c3[_0x1ddb('0x48')][_0x1ddb('0x34')]);_0x10ae72[_0x1ddb('0x32')]=qs[_0x1ddb('0x32')](_0x24c9c3['query'][_0x1ddb('0x32')]);}return _0x39ce82[_0x1ddb('0x89')](_0x10ae72);}})['then'](function(_0x4052ac){if(_0x4052ac){return _0x4052ac?{'count':_0x311116,'rows':_0x4052ac}:null;}})['then'](respondWithResult(_0x4ca6df,null))[_0x1ddb('0x2d')](handleError(_0x4ca6df,null));};function Extension(_0x25320e,_0x2ffeb5,_0x3416e7,_0x10f70f){this[_0x1ddb('0x8b')]='from-voip-provider';this['exten']=_0x25320e[_0x1ddb('0x8c')];this[_0x1ddb('0x8d')]=_0x10f70f;this[_0x1ddb('0x46')]='system';this[_0x1ddb('0x8e')]=_0x1ddb('0x8f');this[_0x1ddb('0x69')]=_0x25320e['id'];this[_0x1ddb('0x87')]=_0x2ffeb5;this[_0x1ddb('0x90')]=_0x3416e7;}function createExtensionsReciveFax(_0x16dc16){var _0x55b417=0x1;var _0x24ff83=[];_0x24ff83[_0x1ddb('0x91')](new Extension(_0x16dc16,_0x55b417,'',_0x1ddb('0x92')));_0x55b417+=0x1;_0x24ff83['push'](new Extension(_0x16dc16,_0x55b417,_0x1ddb('0x93'),_0x1ddb('0x94')));_0x55b417+=0x1;for(var _0x324dab in _0x16dc16){if(_0x16dc16[_0x1ddb('0x4e')](_0x324dab)&&(_0x324dab===_0x1ddb('0x95')||_0x324dab===_0x1ddb('0x8c')||_0x324dab===_0x1ddb('0x96')||_0x324dab==='faxdetect'||_0x324dab===_0x1ddb('0x97')||_0x324dab==='maxrate'||_0x324dab===_0x1ddb('0x98')||_0x324dab===_0x1ddb('0x99')||_0x324dab===_0x1ddb('0x9a'))){_0x24ff83['push'](new Extension(_0x16dc16,_0x55b417,_0x1ddb('0x9b')+_0x324dab+')='+_0x16dc16[_0x324dab],_0x1ddb('0x94')));_0x55b417+=0x1;}}_0x24ff83['push'](new Extension(_0x16dc16,_0x55b417,'6',_0x1ddb('0x9c')));_0x55b417+=0x1;_0x24ff83[_0x1ddb('0x91')](new Extension(_0x16dc16,_0x55b417,_0x1ddb('0x9d'),_0x1ddb('0x9e')));_0x55b417=0x0;return _0x24ff83;}exports[_0x1ddb('0x9f')]=function(_0x49aaef,_0x2e786b,_0x2469af){var _0x359e35;return db['sequelize'][_0x1ddb('0x81')](function(_0x21bbf7){return db['FaxAccount'][_0x1ddb('0x5e')](_0x49aaef['body'],{'transaction':_0x21bbf7})['then'](function(_0x11e75f){_0x359e35=_0x11e75f[_0x1ddb('0x3b')]({'plain':!![]});return db['VoiceExtension'][_0x1ddb('0x85')](createExtensionsReciveFax(_0x359e35),{'transaction':_0x21bbf7});});})[_0x1ddb('0x22')](function(){return _0x359e35;})[_0x1ddb('0x22')](respondWithResult(_0x2e786b,null))[_0x1ddb('0x2d')](handleError(_0x2e786b,null));};exports[_0x1ddb('0xa0')]=function(_0x4277f7,_0x2fc527,_0xbb6943){var _0x42ba0c;return db[_0x1ddb('0x80')][_0x1ddb('0x81')](function(_0x5f1fd8){return db[_0x1ddb('0x43')][_0x1ddb('0x67')](_0x4277f7[_0x1ddb('0x5f')],{'where':{'id':_0x4277f7['body']['id']},'transaction':_0x5f1fd8})[_0x1ddb('0x22')](function(_0xc85ef8){return db[_0x1ddb('0xa1')][_0x1ddb('0x3a')]({'where':{'FaxAccountId':_0x4277f7[_0x1ddb('0x5f')]['id']},'transaction':_0x5f1fd8})[_0x1ddb('0x22')](function(_0x24155b){return db[_0x1ddb('0xa1')][_0x1ddb('0x85')](createExtensionsReciveFax(_['omit'](_0x4277f7[_0x1ddb('0x5f')],[_0x1ddb('0xa2'),_0x1ddb('0xa3'),_0x1ddb('0xa4'),_0x1ddb('0xa5'),_0x1ddb('0xa6'),_0x1ddb('0xa7')])),{'transaction':_0x5f1fd8});});});})['then'](function(){return db['FaxAccount']['findById'](_0x4277f7[_0x1ddb('0x5f')]['id']);})[_0x1ddb('0x22')](respondWithResult(_0x2fc527,null))[_0x1ddb('0x2d')](handleError(_0x2fc527,null));};exports['getMessages']=function(_0x5e4f41,_0x585711,_0x12aea3){var _0x4373ae={'raw':!![],'where':{}};var _0x3ca871={};var _0x4a9225={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x5e4f41[_0x1ddb('0x5c')]['id']}})['then'](handleEntityNotFound(_0x585711,null))[_0x1ddb('0x22')](function(_0x265c29){if(_0x265c29){_0x3ca871['model']=_[_0x1ddb('0x49')](db[_0x1ddb('0xa8')][_0x1ddb('0x44')]);_0x3ca871[_0x1ddb('0x48')]=_[_0x1ddb('0x49')](_0x5e4f41[_0x1ddb('0x48')]);_0x3ca871[_0x1ddb('0x52')]=_['intersection'](_0x3ca871[_0x1ddb('0x47')],_0x3ca871[_0x1ddb('0x48')]);_0x4373ae[_0x1ddb('0x4a')]=_[_0x1ddb('0x4b')](_0x3ca871[_0x1ddb('0x47')],qs[_0x1ddb('0x4c')](_0x5e4f41['query'][_0x1ddb('0x4c')]));_0x4373ae[_0x1ddb('0x4a')]=_0x4373ae[_0x1ddb('0x4a')][_0x1ddb('0x4d')]?_0x4373ae['attributes']:_0x3ca871[_0x1ddb('0x47')];if(!_0x5e4f41[_0x1ddb('0x48')]['hasOwnProperty']('nolimit')){_0x4373ae[_0x1ddb('0x34')]=qs['limit'](_0x5e4f41[_0x1ddb('0x48')]['limit']);_0x4373ae['offset']=qs[_0x1ddb('0x32')](_0x5e4f41[_0x1ddb('0x48')][_0x1ddb('0x32')]);}_0x4373ae[_0x1ddb('0x6c')]=qs[_0x1ddb('0x50')](_0x5e4f41['query']['sort']);_0x4373ae[_0x1ddb('0x51')]=qs[_0x1ddb('0x52')](_[_0x1ddb('0x6d')](_0x5e4f41[_0x1ddb('0x48')],_0x3ca871['filters']));_0x4373ae[_0x1ddb('0x51')][_0x1ddb('0x69')]=_0x265c29['id'];if(_0x5e4f41['query'][_0x1ddb('0x53')]){_0x4373ae['where']=_[_0x1ddb('0x55')](_0x4373ae['where'],{'$or':_[_0x1ddb('0x54')](_0x4373ae[_0x1ddb('0x4a')],function(_0x857e3f){var _0x3f7001={};_0x3f7001[_0x857e3f]={'$like':'%'+_0x5e4f41['query']['filter']+'%'};return _0x3f7001;})});}if(_0x5e4f41['query'][_0x1ddb('0xa9')]){var _0x17795a=_0x5e4f41['query']['$gte'][_0x1ddb('0xaa')](',');var _0x4febbf={};_0x4febbf[_0x17795a[0x0]]={'$gte':moment(_0x17795a[0x1])['format'](_0x1ddb('0xab'))};_0x4373ae[_0x1ddb('0x51')]=_[_0x1ddb('0x55')](_0x4373ae[_0x1ddb('0x51')],_0x4febbf);}_0x4373ae=_[_0x1ddb('0x55')]({},_0x4373ae,_0x5e4f41[_0x1ddb('0x56')]);return db['FaxMessage'][_0x1ddb('0x35')]({'where':_0x4373ae[_0x1ddb('0x51')]})[_0x1ddb('0x22')](function(_0x3c133b){_0x4a9225[_0x1ddb('0x35')]=_0x3c133b;if(_0x5e4f41[_0x1ddb('0x48')][_0x1ddb('0x57')]){_0x4373ae[_0x1ddb('0x58')]=[{'all':!![]}];}return db['FaxMessage'][_0x1ddb('0x59')](_0x4373ae);})[_0x1ddb('0x22')](function(_0x1f8029){_0x4a9225[_0x1ddb('0x5a')]=_0x1f8029;return _0x4a9225;});}})[_0x1ddb('0x22')](respondWithFilteredResult(_0x585711,_0x4373ae))['catch'](handleError(_0x585711,null));};exports[_0x1ddb('0x3f')]=function(_0x18eedb,_0x380914,_0x56a8f2){var _0x42aeca,_0x481b9a={},_0x1b1936;if(_0x18eedb[_0x1ddb('0x5f')]['to']){_0x1b1936=_0x18eedb[_0x1ddb('0x5f')]['to'][0x0];}return db[_0x1ddb('0x43')][_0x1ddb('0x5d')]({'where':{'id':_0x18eedb[_0x1ddb('0x5c')]['id']},'include':[{'model':db[_0x1ddb('0xac')],'as':_0x1ddb('0xad'),'include':[{'model':db[_0x1ddb('0x77')],'as':_0x1ddb('0xae'),'where':{'fax':_0x1b1936},'limit':0x1,'order':[['updatedAt',_0x1ddb('0xaf')]]}]}]})[_0x1ddb('0x22')](handleEntityNotFound(_0x380914,null))[_0x1ddb('0x22')](function(_0x568bf9){_0x42aeca=_0x568bf9;if(_0x18eedb[_0x1ddb('0x5f')]['attachments']&&_0x18eedb['body']['attachments'][_0x1ddb('0x4d')]){for(var _0x562bdc=0x0;_0x562bdc<_0x18eedb[_0x1ddb('0x5f')][_0x1ddb('0xb0')][_0x1ddb('0x4d')];_0x562bdc+=0x1){_0x18eedb[_0x1ddb('0x5f')][_0x1ddb('0xb0')][_0x562bdc]={'filename':_0x18eedb[_0x1ddb('0x5f')][_0x1ddb('0xb0')][_0x562bdc]['name'],'id':_0x18eedb[_0x1ddb('0x5f')][_0x1ddb('0xb0')][_0x562bdc]['id'],'path':path[_0x1ddb('0xb1')](config[_0x1ddb('0xb2')],_0x1ddb('0xb3'),_0x18eedb['body'][_0x1ddb('0xb0')][_0x562bdc][_0x1ddb('0xb4')])};}}return respondWithRpcPromise('CheckAfterSend',_0x1ddb('0xb5'),{'FaxAccountId':_[_0x1ddb('0xb6')](_0x18eedb[_0x1ddb('0x5c')]['id'])?undefined:_0x18eedb[_0x1ddb('0x5c')]['id'],'path':_['isNil'](_0x18eedb['body'][_0x1ddb('0xb0')][0x0][_0x1ddb('0x6')])?undefined:_0x18eedb[_0x1ddb('0x5f')]['attachments'][0x0]['path'],'fax':_['isNil'](_0x18eedb[_0x1ddb('0x5f')]['to'][0x0])?undefined:_0x18eedb[_0x1ddb('0x5f')]['to'][0x0]},client9002);})[_0x1ddb('0x22')](function(){if(_0x42aeca){if(_[_0x1ddb('0xb6')](_0x18eedb[_0x1ddb('0x5f')][_0x1ddb('0xb7')])){_0x18eedb['body'][_0x1ddb('0xb7')]=util['format'](_0x1ddb('0xb8'),_0x42aeca[_0x1ddb('0x3e')],_0x42aeca['fax']);}if(_0x42aeca[_0x1ddb('0xad')]){if(_0x42aeca[_0x1ddb('0xad')]['Contacts'][_0x1ddb('0x4d')]){return _0x42aeca['List'][_0x1ddb('0xae')][0x0];}else{return db[_0x1ddb('0x77')][_0x1ddb('0x5e')](_[_0x1ddb('0x1b')](_0x18eedb[_0x1ddb('0x5f')],{'firstName':_0x18eedb[_0x1ddb('0x5f')]['to'][0x0],'phone':_0x18eedb['body']['to'][0x0],'fax':_0x18eedb['body']['to'][0x0],'ListId':_0x42aeca[_0x1ddb('0xa7')]}));}}else{throw new Error(_0x1ddb('0xb9'));}}else{throw new Error('Send\x20Fax\x20failed');}})['then'](function(_0x2c64a5){if(_0x2c64a5){return db[_0x1ddb('0x76')][_0x1ddb('0x5d')]({'where':{'ContactId':_0x2c64a5['id'],'closed':![],'FaxAccountId':_0x42aeca['id']}})['then'](function(_0x6cd43c){if(_0x6cd43c){return[_0x6cd43c,![]];}return db[_0x1ddb('0x76')][_0x1ddb('0x5e')]({'UserId':_0x18eedb[_0x1ddb('0x60')]['id'],'ContactId':_0x2c64a5['id'],'FaxAccountId':_0x42aeca['id'],'fax':_0x18eedb['body']['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x1ddb('0x55')](_0x18eedb[_0x1ddb('0x5f')],{'read':![],'body':_0x18eedb[_0x1ddb('0x5f')]['attachments'][0x0][_0x1ddb('0xba')],'FaxAccountId':_0x42aeca['id'],'UserId':_0x18eedb[_0x1ddb('0x60')]['id'],'ContactId':_0x2c64a5['id'],'AttachmentId':_0x18eedb[_0x1ddb('0x5f')][_0x1ddb('0xb0')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x1ddb('0xbb')}]})['then'](function(_0x4a98b2){return[_0x4a98b2,!![]];});});}else{throw new Error(_0x1ddb('0xbc'));}})['spread'](function(_0x3d358a,_0x8bb6e1){if(_0x8bb6e1){return _0x3d358a;}return db[_0x1ddb('0xa8')][_0x1ddb('0x5e')]({'direction':_0x1ddb('0xbd'),'read':![],'body':_0x18eedb[_0x1ddb('0x5f')][_0x1ddb('0xb0')][0x0][_0x1ddb('0xba')],'FaxAccountId':_0x42aeca['id'],'FaxInteractionId':_0x3d358a['id'],'UserId':_0x18eedb[_0x1ddb('0x60')]['id'],'ContactId':_0x3d358a[_0x1ddb('0xbe')],'AttachmentId':_0x18eedb[_0x1ddb('0x5f')][_0x1ddb('0xb0')][0x0]['id']})[_0x1ddb('0x22')](function(_0x1b6755){_0x3d358a[_0x1ddb('0xbf')][_0x1ddb('0xbb')]=[];_0x3d358a[_0x1ddb('0xbf')]['Messages'][_0x1ddb('0x91')](_0x1b6755[_0x1ddb('0xbf')]);return _0x3d358a;});})[_0x1ddb('0x22')](function(_0x41cc20){respondWithRpcPromise(_0x1ddb('0xc0'),_0x1ddb('0xc0'),{'FaxAccountId':_[_0x1ddb('0xb6')](_0x18eedb['params']['id'])?undefined:_0x18eedb['params']['id'],'path':_[_0x1ddb('0xb6')](_0x18eedb[_0x1ddb('0x5f')][_0x1ddb('0xb0')][0x0][_0x1ddb('0x6')])?undefined:_0x18eedb[_0x1ddb('0x5f')][_0x1ddb('0xb0')][0x0][_0x1ddb('0x6')],'fax':_['isNil'](_0x18eedb[_0x1ddb('0x5f')]['to'][0x0])?undefined:_0x18eedb[_0x1ddb('0x5f')]['to'][0x0],'AttachmentId':_0x18eedb[_0x1ddb('0x5f')][_0x1ddb('0xb0')][0x0]['id']},client9002)[_0x1ddb('0x22')](function(_0x212eb7){logger[_0x1ddb('0x23')](_0x1ddb('0xc1'),_0x212eb7);})[_0x1ddb('0x2d')](function(_0x241295){logger['info'](_0x1ddb('0xc1'),_0x241295);});return _0x41cc20;})[_0x1ddb('0x22')](respondWithResult(_0x380914,null))['catch'](handleError(_0x380914,null));};exports[_0x1ddb('0xc2')]=function(_0x487b06,_0x5574e0,_0x575842){return db['FaxAccount'][_0x1ddb('0x5d')]({'where':{'id':_0x487b06[_0x1ddb('0x5c')]['id']}})[_0x1ddb('0x22')](handleEntityNotFound(_0x5574e0,null))[_0x1ddb('0x22')](function(_0x17291f){if(_0x17291f){return _0x17291f['addAgents'](_0x487b06[_0x1ddb('0x5f')][_0x1ddb('0x6f')],_[_0x1ddb('0x75')](_0x487b06['body'],[_0x1ddb('0x6f'),'id'])||{})[_0x1ddb('0xc3')](function(_0xfe000b){for(var _0x3466b3=0x0;_0x3466b3<_0x487b06['body'][_0x1ddb('0x6f')]['length'];_0x3466b3+=0x1){socket['emit']('userFaxAccount:save',{'UserId':Number(_0x487b06['body']['ids'][_0x3466b3]),'FaxAccountId':Number(_0x487b06[_0x1ddb('0x5c')]['id'])});}return _0xfe000b;});}})[_0x1ddb('0x22')](respondWithResult(_0x5574e0,null))[_0x1ddb('0x2d')](handleError(_0x5574e0,null));};exports[_0x1ddb('0xc4')]=function(_0x357faf,_0x107ca4,_0x58d749){return db[_0x1ddb('0x43')][_0x1ddb('0x5d')]({'where':{'id':_0x357faf[_0x1ddb('0x5c')]['id']}})[_0x1ddb('0x22')](handleEntityNotFound(_0x107ca4,null))[_0x1ddb('0x22')](function(_0x90a629){if(_0x90a629){return _0x90a629['removeAgents'](_0x357faf['query'][_0x1ddb('0x6f')])['then'](function(){if(_[_0x1ddb('0xc5')](_0x357faf[_0x1ddb('0x48')][_0x1ddb('0x6f')])){for(var _0x5b9e2b=0x0;_0x5b9e2b<_0x357faf[_0x1ddb('0x48')][_0x1ddb('0x6f')][_0x1ddb('0x4d')];_0x5b9e2b+=0x1){socket[_0x1ddb('0xc6')](_0x1ddb('0xc7'),{'UserId':Number(_0x357faf['query'][_0x1ddb('0x6f')][_0x5b9e2b]),'FaxAccountId':Number(_0x357faf[_0x1ddb('0x5c')]['id'])});}}else{socket[_0x1ddb('0xc6')](_0x1ddb('0xc7'),{'UserId':Number(_0x357faf['query'][_0x1ddb('0x6f')]),'FaxAccountId':Number(_0x357faf[_0x1ddb('0x5c')]['id'])});}});}})[_0x1ddb('0x22')](respondWithStatusCode(_0x107ca4,null))[_0x1ddb('0x2d')](handleError(_0x107ca4,null));};exports[_0x1ddb('0xc8')]=function(_0x4c6d0c,_0x264c11,_0x5c2438){var _0x5dba97={};var _0x2cfdae={};var _0x4066d1;var _0x3b5d11;return db[_0x1ddb('0x43')][_0x1ddb('0x71')]({'where':{'id':_0x4c6d0c[_0x1ddb('0x5c')]['id']}})['then'](handleEntityNotFound(_0x264c11,null))[_0x1ddb('0x22')](function(_0x3f1f10){if(_0x3f1f10){_0x4066d1=_0x3f1f10;_0x2cfdae[_0x1ddb('0x47')]=_[_0x1ddb('0x49')](db[_0x1ddb('0xc9')][_0x1ddb('0x44')]);_0x2cfdae['query']=_[_0x1ddb('0x49')](_0x4c6d0c[_0x1ddb('0x48')]);_0x2cfdae['filters']=_[_0x1ddb('0x4b')](_0x2cfdae['model'],_0x2cfdae[_0x1ddb('0x48')]);_0x5dba97[_0x1ddb('0x4a')]=_['intersection'](_0x2cfdae['model'],qs[_0x1ddb('0x4c')](_0x4c6d0c['query'][_0x1ddb('0x4c')]));_0x5dba97[_0x1ddb('0x4a')]=_0x5dba97[_0x1ddb('0x4a')][_0x1ddb('0x4d')]?_0x5dba97[_0x1ddb('0x4a')]:_0x2cfdae[_0x1ddb('0x47')];_0x5dba97[_0x1ddb('0x6c')]=qs[_0x1ddb('0x50')](_0x4c6d0c[_0x1ddb('0x48')][_0x1ddb('0x50')]);_0x5dba97[_0x1ddb('0x51')]=qs[_0x1ddb('0x52')](_[_0x1ddb('0x6d')](_0x4c6d0c[_0x1ddb('0x48')],_0x2cfdae[_0x1ddb('0x52')]));if(_0x4c6d0c[_0x1ddb('0x48')][_0x1ddb('0x53')]){_0x5dba97[_0x1ddb('0x51')]=_[_0x1ddb('0x55')](_0x5dba97[_0x1ddb('0x51')],{'$or':_[_0x1ddb('0x54')](_0x5dba97['attributes'],function(_0x5e29c4){var _0x15a125={};_0x15a125[_0x5e29c4]={'$like':'%'+_0x4c6d0c[_0x1ddb('0x48')]['filter']+'%'};return _0x15a125;})});}_0x5dba97=_[_0x1ddb('0x55')]({},_0x5dba97,_0x4c6d0c[_0x1ddb('0x56')]);return _0x4066d1['getAgents'](_0x5dba97);}})['then'](function(_0x23cccf){if(_0x23cccf){_0x3b5d11=_0x23cccf[_0x1ddb('0x4d')];if(!_0x4c6d0c[_0x1ddb('0x48')][_0x1ddb('0x4e')](_0x1ddb('0x4f'))){_0x5dba97[_0x1ddb('0x34')]=qs['limit'](_0x4c6d0c['query'][_0x1ddb('0x34')]);_0x5dba97[_0x1ddb('0x32')]=qs[_0x1ddb('0x32')](_0x4c6d0c[_0x1ddb('0x48')][_0x1ddb('0x32')]);}return _0x4066d1[_0x1ddb('0xc8')](_0x5dba97);}})['then'](function(_0x19ad26){if(_0x19ad26){return _0x19ad26?{'count':_0x3b5d11,'rows':_0x19ad26}:null;}})[_0x1ddb('0x22')](respondWithResult(_0x264c11,null))[_0x1ddb('0x2d')](handleError(_0x264c11,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 7c49b16..3481020 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 _0x0c2a=['exports','events','FaxAccount','setMaxListeners','save','update','remove','emit','hook'];(function(_0x56690b,_0x4d8b5c){var _0x35709d=function(_0x4651cf){while(--_0x4651cf){_0x56690b['push'](_0x56690b['shift']());}};_0x35709d(++_0x4d8b5c);}(_0x0c2a,0x1d5));var _0xa0c2=function(_0x3db7be,_0xbb5e16){_0x3db7be=_0x3db7be-0x0;var _0x4474f8=_0x0c2a[_0x3db7be];return _0x4474f8;};'use strict';var EventEmitter=require(_0xa0c2('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0xa0c2('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xa0c2('0x2')](0x0);var events={'afterCreate':_0xa0c2('0x3'),'afterUpdate':_0xa0c2('0x4'),'afterDestroy':_0xa0c2('0x5')};function emitEvent(_0x5bf39d){return function(_0x4c35be,_0x41c2ac,_0x138945){FaxAccountEvents[_0xa0c2('0x6')](_0x5bf39d+':'+_0x4c35be['id'],_0x4c35be);FaxAccountEvents['emit'](_0x5bf39d,_0x4c35be);_0x138945(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0xa0c2('0x7')](e,emitEvent(event));}}module[_0xa0c2('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0x8f41=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x280acf,_0x4e4830){var _0x2bbcaa=function(_0x485ec0){while(--_0x485ec0){_0x280acf['push'](_0x280acf['shift']());}};_0x2bbcaa(++_0x4e4830);}(_0x8f41,0x1c3));var _0x18f4=function(_0x1c6dcf,_0x2018b2){_0x1c6dcf=_0x1c6dcf-0x0;var _0x4990ae=_0x8f41[_0x1c6dcf];return _0x4990ae;};'use strict';var EventEmitter=require(_0x18f4('0x0'));var FaxAccount=require(_0x18f4('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x18f4('0x2')](0x0);var events={'afterCreate':_0x18f4('0x3'),'afterUpdate':_0x18f4('0x4'),'afterDestroy':_0x18f4('0x5')};function emitEvent(_0x1e5fac){return function(_0x4c1260,_0x2b1e57,_0x23faaa){FaxAccountEvents[_0x18f4('0x6')](_0x1e5fac+':'+_0x4c1260['id'],_0x4c1260);FaxAccountEvents[_0x18f4('0x6')](_0x1e5fac,_0x4c1260);_0x23faaa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x18f4('0x7')](e,emitEvent(event));}}module[_0x18f4('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 7cca4c8..6581118 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 _0xc6a3=['bluebird','path','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','lodash','../../config/logger','api'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xc6a3,0x133));var _0x3c6a=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xc6a3[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x3c6a('0x0'));var util=require('util');var logger=require(_0x3c6a('0x1'))(_0x3c6a('0x2'));var moment=require('moment');var BPromise=require(_0x3c6a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3c6a('0x4'));var rimraf=require('rimraf');var config=require(_0x3c6a('0x5'));var attributes=require(_0x3c6a('0x6'));module[_0x3c6a('0x7')]=function(_0x420803,_0x3e3e72){return _0x420803[_0x3c6a('0x8')](_0x3c6a('0x9'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x02ca=['FaxAccount','fax_accounts','moment','bluebird','rimraf','./faxAccount.attributes','define'];(function(_0x2412b4,_0xbcd013){var _0x3a08dd=function(_0xa342a6){while(--_0xa342a6){_0x2412b4['push'](_0x2412b4['shift']());}};_0x3a08dd(++_0xbcd013);}(_0x02ca,0x1ec));var _0xa02c=function(_0x4ccd64,_0x470788){_0x4ccd64=_0x4ccd64-0x0;var _0x3fd69e=_0x02ca[_0x4ccd64];return _0x3fd69e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xa02c('0x0'));var BPromise=require(_0xa02c('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa02c('0x2'));var config=require('../../config/environment');var attributes=require(_0xa02c('0x3'));module['exports']=function(_0x4610a8,_0x597f40){return _0x4610a8[_0xa02c('0x4')](_0xa02c('0x5'),attributes,{'tableName':_0xa02c('0x6'),'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 371f5e0..8d83efa 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 _0x145b=['error','code','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','limit','map','include','attributes','then','NotifyFaxAccount','body','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','keys','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','updatedAt','FaxApplication','Applications','account','applications','list','orderBy','asc','Contacts','create','contact','find','FaxInteraction','Contact\x20not\x20found','spread','get','autoclose','push','length','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','name','agent','waitForTheAssignedAgent','FaxQueue','queueId','unshift','queue','waitForTheAssignedQueue','startRouting','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','redis','./faxAccount.socket','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5077ed,_0x4467b2){var _0x236dbc=function(_0x2afa62){while(--_0x2afa62){_0x5077ed['push'](_0x5077ed['shift']());}};_0x236dbc(++_0x4467b2);}(_0x145b,0x1c0));var _0xb145=function(_0x2e1612,_0x44512f){_0x2e1612=_0x2e1612-0x0;var _0x3c2e2e=_0x145b[_0x2e1612];return _0x3c2e2e;};'use strict';var _=require('lodash');var util=require(_0xb145('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb145('0x1'));var fs=require('fs');var Redis=require(_0xb145('0x2'));var db=require(_0xb145('0x3'))['db'];var utils=require(_0xb145('0x4'));var logger=require(_0xb145('0x5'))(_0xb145('0x6'));var config=require(_0xb145('0x7'));var jayson=require(_0xb145('0x8'));var client=jayson['client'][_0xb145('0x9')]({'port':0x232c});config['redis']=_[_0xb145('0xa')](config['redis'],{'host':_0xb145('0xb'),'port':0x18eb});var socket=require(_0xb145('0xc'))(new Redis(config[_0xb145('0xd')]));require(_0xb145('0xe'))['register'](socket);function respondWithRpcPromise(_0x3c6b22,_0x1e7151,_0x52004b){return new BPromise(function(_0x142789,_0x4f3a20){return client[_0xb145('0xf')](_0x3c6b22,_0x52004b)['then'](function(_0x1cd7cc){logger[_0xb145('0x10')](_0xb145('0x11'),_0x1e7151,_0xb145('0x12'));logger[_0xb145('0x13')](_0xb145('0x14'),_0x1e7151,'request\x20sent',JSON[_0xb145('0x15')](_0x1cd7cc));if(_0x1cd7cc['error']){if(_0x1cd7cc[_0xb145('0x16')][_0xb145('0x17')]===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x1e7151,_0x1cd7cc[_0xb145('0x16')]['message']);return _0x4f3a20(_0x1cd7cc['error'][_0xb145('0x18')]);}logger[_0xb145('0x16')]('FaxAccount,\x20%s,\x20%s',_0x1e7151,_0x1cd7cc[_0xb145('0x16')][_0xb145('0x18')]);return _0x142789(_0x1cd7cc['error'][_0xb145('0x18')]);}else{logger[_0xb145('0x10')](_0xb145('0x11'),_0x1e7151,_0xb145('0x12'));_0x142789(_0x1cd7cc[_0xb145('0x19')][_0xb145('0x18')]);}})[_0xb145('0x1a')](function(_0x14f86){logger[_0xb145('0x16')](_0xb145('0x11'),_0x1e7151,_0x14f86);_0x4f3a20(_0x14f86);});});}exports[_0xb145('0x1b')]=function(_0x5d1790){var _0x55a7b9=this;return new Promise(function(_0x56b708,_0x3bdd71){return db[_0xb145('0x1c')][_0xb145('0x1d')]({'raw':_0x5d1790[_0xb145('0x1e')]?_0x5d1790[_0xb145('0x1e')][_0xb145('0x1f')]===undefined?!![]:![]:!![],'where':_0x5d1790['options']?_0x5d1790[_0xb145('0x1e')][_0xb145('0x20')]||null:null,'attributes':_0x5d1790['options']?_0x5d1790['options']['attributes']||null:null,'limit':_0x5d1790[_0xb145('0x1e')]?_0x5d1790['options'][_0xb145('0x21')]||null:null,'include':_0x5d1790[_0xb145('0x1e')]?_0x5d1790[_0xb145('0x1e')]['include']?_[_0xb145('0x22')](_0x5d1790['options'][_0xb145('0x23')],function(_0x591ac9){return{'model':db[_0x591ac9['model']],'as':_0x591ac9['as'],'attributes':_0x591ac9[_0xb145('0x24')],'include':_0x591ac9[_0xb145('0x23')]?_[_0xb145('0x22')](_0x591ac9['include'],function(_0x50f469){return{'model':db[_0x50f469['model']],'as':_0x50f469['as'],'attributes':_0x50f469['attributes'],'include':_0x50f469[_0xb145('0x23')]?_[_0xb145('0x22')](_0x50f469[_0xb145('0x23')],function(_0x4a5ae3){return{'model':db[_0x4a5ae3['model']],'as':_0x4a5ae3['as'],'attributes':_0x4a5ae3[_0xb145('0x24')]};}):[]};}):[]};}):[]:[]})[_0xb145('0x25')](function(_0x23f094){logger['info'](_0xb145('0x1b'),_0x5d1790);logger['debug'](_0xb145('0x1b'),_0x5d1790,JSON['stringify'](_0x23f094));_0x56b708(_0x23f094);})[_0xb145('0x1a')](function(_0x1759a8){logger[_0xb145('0x16')](_0xb145('0x1b'),_0x1759a8[_0xb145('0x18')],_0x5d1790);_0x3bdd71(_0x55a7b9['error'](0x1f4,_0x1759a8['message']));});});};exports[_0xb145('0x26')]=function(_0x421c46,_0x5e961a,_0x11ec04){var _0x1106de=this;return new Promise(function(_0x46321b,_0x40dc4b){var _0x6168aa={'body':_0x421c46[_0xb145('0x27')],'channel':'fax'};var _0x486264=[];var _0x2e3905=[];var _0x2d0403={};return db['CmContact'][_0xb145('0x28')]()['then'](function(_0x20638b){if(!_0x20638b){throw new db[(_0xb145('0x29'))][(_0xb145('0x2a'))](_0xb145('0x2b'));}_0x486264=_[_0xb145('0x2c')](_['keys'](_0x20638b),[_0xb145('0x2d'),'updatedAt']);_0x2e3905=_[_0xb145('0x2c')](_[_0xb145('0x2e')](_0x20638b),[_0xb145('0x2d'),'updatedAt','CompanyId',_0xb145('0x2f')]);if(_0x421c46[_0xb145('0x27')]['id']){delete _0x421c46[_0xb145('0x27')]['id'];}if(_[_0xb145('0x30')](_0x421c46[_0xb145('0x27')][_0xb145('0x31')])){throw new db['Sequelize']['ValidationError'](_0xb145('0x32'));}if(_[_0xb145('0x30')](_0x421c46[_0xb145('0x27')][_0xb145('0x27')])||_0x421c46['body'][_0xb145('0x27')]===''){throw new db[(_0xb145('0x29'))][(_0xb145('0x2a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x421c46[_0xb145('0x27')][_0xb145('0x33')])){throw new db[(_0xb145('0x29'))][(_0xb145('0x2a'))](_0xb145('0x34')+_0x2e3905);}if(!_['includes'](_0x2e3905,_0x421c46[_0xb145('0x27')][_0xb145('0x33')])){throw new db[(_0xb145('0x29'))]['ValidationError'](_0xb145('0x35')+_0x2e3905);}_0x2d0403[_0x421c46[_0xb145('0x27')][_0xb145('0x33')]]=_0x421c46[_0xb145('0x27')][_0xb145('0x31')];})[_0xb145('0x25')](function(){return db['FaxAccount']['find']({'where':{'id':_0x421c46['account']['id']},'include':[{'model':db[_0xb145('0x36')],'as':_0xb145('0x37'),'include':[{'model':db[_0xb145('0x38')],'as':'Contacts','where':_0x2d0403,'limit':0x1,'order':[[_0xb145('0x39'),'DESC']]}]},{'model':db[_0xb145('0x3a')],'as':_0xb145('0x3b')}]});})[_0xb145('0x25')](function(_0x3637b7){if(_0x3637b7&&_0x3637b7[_0xb145('0x37')]){var _0x4d591d=_0x3637b7['get']({'plain':!![]});_0x6168aa[_0xb145('0x3c')]=_0x4d591d;_0x6168aa[_0xb145('0x3d')]=_0x4d591d[_0xb145('0x3b')];_0x6168aa[_0xb145('0x3e')]=_0x4d591d['List'];_0x6168aa[_0xb145('0x3d')]=_[_0xb145('0x3f')](_0x6168aa[_0xb145('0x3d')],['priority'],[_0xb145('0x40')]);if(_0x6168aa[_0xb145('0x3c')]['Applications']){delete _0x6168aa['account'][_0xb145('0x3b')];}if(_0x6168aa['account'][_0xb145('0x37')]&&_0x6168aa['account']['List']['Contacts']['length']){return _0x6168aa[_0xb145('0x3c')]['List'][_0xb145('0x41')][0x0];}var _0x4d2f9b=_[_0xb145('0xa')](_0x421c46[_0xb145('0x27')],{'firstName':_0x421c46[_0xb145('0x27')][_0xb145('0x31')],'ListId':_0x4d591d['ListId']});_0x4d2f9b[_0x421c46[_0xb145('0x27')]['mapKey']]=_0x421c46[_0xb145('0x27')][_0xb145('0x31')];return db[_0xb145('0x38')][_0xb145('0x42')](_0x4d2f9b,{'fields':_0x486264,'raw':!![]});}})[_0xb145('0x25')](function(_0x4b06c8){_0x6168aa[_0xb145('0x43')]=_0x4b06c8;if(_0x4b06c8){var _0x570db1={'ContactId':_0x4b06c8['id'],'FaxAccountId':_0x421c46[_0xb145('0x3c')]['id'],'fax':_0x4b06c8['fax']};return db['FaxInteraction'][_0xb145('0x44')]({'where':{'ContactId':_0x4b06c8['id'],'closed':![],'FaxAccountId':_0x421c46[_0xb145('0x3c')]['id']}})[_0xb145('0x25')](function(_0x236ac5){if(_0x236ac5){return[_0x236ac5,![]];}return db[_0xb145('0x45')][_0xb145('0x42')](_0x570db1)[_0xb145('0x25')](function(_0x30290f){return[_0x30290f,!![]];});});}else{throw new Error(_0xb145('0x46'));}})[_0xb145('0x47')](function(_0x4d00de,_0x12fefa){var _0x3c7e0b=_0x4d00de[_0xb145('0x48')]({'plain':!![]});if(_0x12fefa){if(_0x6168aa['account'][_0xb145('0x49')]){_0x6168aa[_0xb145('0x3d')][_0xb145('0x4a')]({'id':0x0,'priority':_0x6168aa[_0xb145('0x3d')][_0xb145('0x4b')]+0x1,'app':_0xb145('0x4c'),'appdata':_0xb145('0x4d'),'interval':_0xb145('0x4e')});}_0x3c7e0b[_0xb145('0x4f')]=!![];}else{_0x3c7e0b[_0xb145('0x4f')]=![];}_0x6168aa[_0xb145('0x50')]=_0x3c7e0b;return db[_0xb145('0x51')][_0xb145('0x42')]({'body':_0x421c46[_0xb145('0x27')]['body'],'FaxAccountId':_0x421c46[_0xb145('0x3c')]['id'],'FaxInteractionId':_0x4d00de['id'],'direction':'in','ContactId':_0x4d00de[_0xb145('0x52')],'AttachmentId':_0x421c46[_0xb145('0x27')][_0xb145('0x53')]});})[_0xb145('0x25')](function(_0x4ff93f){_0x6168aa['message']=_0x4ff93f;if(!_0x6168aa[_0xb145('0x50')][_0xb145('0x54')])return;return db['User'][_0xb145('0x44')]({'attributes':['id',_0xb145('0x55')],'where':{'id':_0x6168aa[_0xb145('0x50')]['UserId']}});})[_0xb145('0x25')](function(_0x3f3eab){if(_0x3f3eab){_0x6168aa['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xb145('0x56'),'appdata':_0x3f3eab[_0xb145('0x55')]+','+(_0x6168aa[_0xb145('0x3c')][_0xb145('0x57')]||0xa),'interval':_0xb145('0x4e')});}if(!_0x6168aa[_0xb145('0x50')]['queueId'])return;return db[_0xb145('0x58')]['find']({'attributes':['id',_0xb145('0x55')],'where':{'id':_0x6168aa[_0xb145('0x50')][_0xb145('0x59')]}});})[_0xb145('0x25')](function(_0x55eaca){if(_0x55eaca){_0x6168aa[_0xb145('0x3d')][_0xb145('0x5a')]({'id':0x0,'priority':0x1,'app':_0xb145('0x5b'),'appdata':_0x55eaca[_0xb145('0x55')]+','+(_0x6168aa[_0xb145('0x3c')][_0xb145('0x5c')]||0x12c),'interval':_0xb145('0x4e')});}return respondWithRpcPromise('Start',_0xb145('0x5d'),_0x6168aa);})[_0xb145('0x25')](function(_0x187921){_0x46321b(_0x187921);})[_0xb145('0x1a')](function(_0x4a12d7){_0x40dc4b(_0x1106de[_0xb145('0x16')](0x1f4,_0x4a12d7['message']));});});}; \ No newline at end of file +var _0x4e8e=['spread','autoclose','push','close','*,*,*,*','created','interaction','FaxMessage','ContactId','UserId','name','unshift','waitForTheAssignedAgent','FaxQueue','queueId','waitForTheAssignedQueue','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./faxAccount.socket','request','then','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','FaxAccount,\x20%s,\x20%s','message','info','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','attributes','limit','include','map','NotifyFaxAccount','body','fax','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','CmList','CmContact','Contacts','FaxApplication','Applications','List','account','applications','orderBy','priority','asc','length','create','contact','FaxInteraction','Contact\x20not\x20found'];(function(_0x461ea3,_0x5bcc4b){var _0x3c7b09=function(_0x5c9cc4){while(--_0x5c9cc4){_0x461ea3['push'](_0x461ea3['shift']());}};_0x3c7b09(++_0x5bcc4b);}(_0x4e8e,0xc6));var _0xe4e8=function(_0x4e9280,_0x3d8cf9){_0x4e9280=_0x4e9280-0x0;var _0x12ae48=_0x4e8e[_0x4e9280];return _0x12ae48;};'use strict';var _=require(_0xe4e8('0x0'));var util=require('util');var moment=require(_0xe4e8('0x1'));var BPromise=require(_0xe4e8('0x2'));var rs=require(_0xe4e8('0x3'));var fs=require('fs');var Redis=require(_0xe4e8('0x4'));var db=require(_0xe4e8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe4e8('0x6'))('rpc');var config=require(_0xe4e8('0x7'));var jayson=require(_0xe4e8('0x8'));var client=jayson[_0xe4e8('0x9')][_0xe4e8('0xa')]({'port':0x232c});config[_0xe4e8('0xb')]=_[_0xe4e8('0xc')](config['redis'],{'host':_0xe4e8('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe4e8('0xb')]));require(_0xe4e8('0xe'))['register'](socket);function respondWithRpcPromise(_0x36840a,_0x3f2e25,_0x42e60a){return new BPromise(function(_0x13558e,_0x703edf){return client[_0xe4e8('0xf')](_0x36840a,_0x42e60a)[_0xe4e8('0x10')](function(_0xca451b){logger['info']('FaxAccount,\x20%s,\x20%s',_0x3f2e25,'request\x20sent');logger[_0xe4e8('0x11')](_0xe4e8('0x12'),_0x3f2e25,_0xe4e8('0x13'),JSON['stringify'](_0xca451b));if(_0xca451b[_0xe4e8('0x14')]){if(_0xca451b[_0xe4e8('0x14')][_0xe4e8('0x15')]===0x1f4){logger['error'](_0xe4e8('0x16'),_0x3f2e25,_0xca451b[_0xe4e8('0x14')][_0xe4e8('0x17')]);return _0x703edf(_0xca451b[_0xe4e8('0x14')][_0xe4e8('0x17')]);}logger['error'](_0xe4e8('0x16'),_0x3f2e25,_0xca451b[_0xe4e8('0x14')]['message']);return _0x13558e(_0xca451b[_0xe4e8('0x14')][_0xe4e8('0x17')]);}else{logger[_0xe4e8('0x18')](_0xe4e8('0x16'),_0x3f2e25,_0xe4e8('0x13'));_0x13558e(_0xca451b[_0xe4e8('0x19')][_0xe4e8('0x17')]);}})[_0xe4e8('0x1a')](function(_0x10fff2){logger[_0xe4e8('0x14')](_0xe4e8('0x16'),_0x3f2e25,_0x10fff2);_0x703edf(_0x10fff2);});});}exports[_0xe4e8('0x1b')]=function(_0x432f3f){var _0x5239be=this;return new Promise(function(_0x3aa17a,_0x1024f8){return db[_0xe4e8('0x1c')][_0xe4e8('0x1d')]({'raw':_0x432f3f[_0xe4e8('0x1e')]?_0x432f3f[_0xe4e8('0x1e')][_0xe4e8('0x1f')]===undefined?!![]:![]:!![],'where':_0x432f3f['options']?_0x432f3f[_0xe4e8('0x1e')]['where']||null:null,'attributes':_0x432f3f[_0xe4e8('0x1e')]?_0x432f3f['options'][_0xe4e8('0x20')]||null:null,'limit':_0x432f3f[_0xe4e8('0x1e')]?_0x432f3f[_0xe4e8('0x1e')][_0xe4e8('0x21')]||null:null,'include':_0x432f3f['options']?_0x432f3f[_0xe4e8('0x1e')][_0xe4e8('0x22')]?_[_0xe4e8('0x23')](_0x432f3f[_0xe4e8('0x1e')]['include'],function(_0x1654c4){return{'model':db[_0x1654c4['model']],'as':_0x1654c4['as'],'attributes':_0x1654c4['attributes'],'include':_0x1654c4['include']?_[_0xe4e8('0x23')](_0x1654c4[_0xe4e8('0x22')],function(_0xd83f60){return{'model':db[_0xd83f60['model']],'as':_0xd83f60['as'],'attributes':_0xd83f60[_0xe4e8('0x20')],'include':_0xd83f60[_0xe4e8('0x22')]?_[_0xe4e8('0x23')](_0xd83f60['include'],function(_0x1803ad){return{'model':db[_0x1803ad['model']],'as':_0x1803ad['as'],'attributes':_0x1803ad['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x21c910){logger['info'](_0xe4e8('0x1b'),_0x432f3f);logger[_0xe4e8('0x11')]('GetFaxAccount',_0x432f3f,JSON['stringify'](_0x21c910));_0x3aa17a(_0x21c910);})['catch'](function(_0x1333c4){logger[_0xe4e8('0x14')]('GetFaxAccount',_0x1333c4[_0xe4e8('0x17')],_0x432f3f);_0x1024f8(_0x5239be['error'](0x1f4,_0x1333c4[_0xe4e8('0x17')]));});});};exports[_0xe4e8('0x24')]=function(_0x320450,_0x10c405,_0x253dce){var _0x38dcfe=this;return new Promise(function(_0x247f1d,_0x4d1144){var _0x1685e0={'body':_0x320450[_0xe4e8('0x25')],'channel':_0xe4e8('0x26')};var _0x2d0265=[];var _0x17c62d=[];var _0x37c617={};return db['CmContact'][_0xe4e8('0x27')]()[_0xe4e8('0x10')](function(_0x1b1187){if(!_0x1b1187){throw new db[(_0xe4e8('0x28'))][(_0xe4e8('0x29'))](_0xe4e8('0x2a'));}_0x2d0265=_[_0xe4e8('0x2b')](_[_0xe4e8('0x2c')](_0x1b1187),['createdAt','updatedAt']);_0x17c62d=_[_0xe4e8('0x2b')](_[_0xe4e8('0x2c')](_0x1b1187),[_0xe4e8('0x2d'),_0xe4e8('0x2e'),_0xe4e8('0x2f'),_0xe4e8('0x30')]);if(_0x320450['body']['id']){delete _0x320450[_0xe4e8('0x25')]['id'];}if(_[_0xe4e8('0x31')](_0x320450[_0xe4e8('0x25')][_0xe4e8('0x32')])){throw new db[(_0xe4e8('0x28'))]['ValidationError'](_0xe4e8('0x33'));}if(_['isNil'](_0x320450[_0xe4e8('0x25')][_0xe4e8('0x25')])||_0x320450['body'][_0xe4e8('0x25')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xe4e8('0x31')](_0x320450[_0xe4e8('0x25')]['mapKey'])){throw new db[(_0xe4e8('0x28'))][(_0xe4e8('0x29'))](_0xe4e8('0x34')+_0x17c62d);}if(!_['includes'](_0x17c62d,_0x320450[_0xe4e8('0x25')][_0xe4e8('0x35')])){throw new db['Sequelize'][(_0xe4e8('0x29'))](_0xe4e8('0x36')+_0x17c62d);}_0x37c617[_0x320450['body'][_0xe4e8('0x35')]]=_0x320450[_0xe4e8('0x25')]['from'];})[_0xe4e8('0x10')](function(){return db[_0xe4e8('0x1c')][_0xe4e8('0x37')]({'where':{'id':_0x320450['account']['id']},'include':[{'model':db[_0xe4e8('0x38')],'as':'List','include':[{'model':db[_0xe4e8('0x39')],'as':_0xe4e8('0x3a'),'where':_0x37c617,'limit':0x1,'order':[[_0xe4e8('0x2e'),'DESC']]}]},{'model':db[_0xe4e8('0x3b')],'as':_0xe4e8('0x3c')}]});})[_0xe4e8('0x10')](function(_0x5ad0df){if(_0x5ad0df&&_0x5ad0df[_0xe4e8('0x3d')]){var _0xdaef81=_0x5ad0df['get']({'plain':!![]});_0x1685e0[_0xe4e8('0x3e')]=_0xdaef81;_0x1685e0[_0xe4e8('0x3f')]=_0xdaef81[_0xe4e8('0x3c')];_0x1685e0['list']=_0xdaef81['List'];_0x1685e0['applications']=_[_0xe4e8('0x40')](_0x1685e0[_0xe4e8('0x3f')],[_0xe4e8('0x41')],[_0xe4e8('0x42')]);if(_0x1685e0[_0xe4e8('0x3e')][_0xe4e8('0x3c')]){delete _0x1685e0[_0xe4e8('0x3e')]['Applications'];}if(_0x1685e0[_0xe4e8('0x3e')][_0xe4e8('0x3d')]&&_0x1685e0['account'][_0xe4e8('0x3d')][_0xe4e8('0x3a')][_0xe4e8('0x43')]){return _0x1685e0[_0xe4e8('0x3e')][_0xe4e8('0x3d')][_0xe4e8('0x3a')][0x0];}var _0x1a99a8=_[_0xe4e8('0xc')](_0x320450[_0xe4e8('0x25')],{'firstName':_0x320450[_0xe4e8('0x25')][_0xe4e8('0x32')],'ListId':_0xdaef81[_0xe4e8('0x30')]});_0x1a99a8[_0x320450[_0xe4e8('0x25')][_0xe4e8('0x35')]]=_0x320450[_0xe4e8('0x25')][_0xe4e8('0x32')];return db[_0xe4e8('0x39')][_0xe4e8('0x44')](_0x1a99a8,{'fields':_0x2d0265,'raw':!![]});}})['then'](function(_0x4d8797){_0x1685e0[_0xe4e8('0x45')]=_0x4d8797;if(_0x4d8797){var _0x13a6bb={'ContactId':_0x4d8797['id'],'FaxAccountId':_0x320450[_0xe4e8('0x3e')]['id'],'fax':_0x4d8797[_0xe4e8('0x26')]};return db[_0xe4e8('0x46')][_0xe4e8('0x37')]({'where':{'ContactId':_0x4d8797['id'],'closed':![],'FaxAccountId':_0x320450[_0xe4e8('0x3e')]['id']}})[_0xe4e8('0x10')](function(_0x5235f7){if(_0x5235f7){return[_0x5235f7,![]];}return db[_0xe4e8('0x46')]['create'](_0x13a6bb)[_0xe4e8('0x10')](function(_0x5f356a){return[_0x5f356a,!![]];});});}else{throw new Error(_0xe4e8('0x47'));}})[_0xe4e8('0x48')](function(_0x5121d4,_0x253f65){var _0x5439dc=_0x5121d4['get']({'plain':!![]});if(_0x253f65){if(_0x1685e0[_0xe4e8('0x3e')][_0xe4e8('0x49')]){_0x1685e0['applications'][_0xe4e8('0x4a')]({'id':0x0,'priority':_0x1685e0[_0xe4e8('0x3f')][_0xe4e8('0x43')]+0x1,'app':_0xe4e8('0x4b'),'appdata':'unmanaged','interval':_0xe4e8('0x4c')});}_0x5439dc[_0xe4e8('0x4d')]=!![];}else{_0x5439dc['created']=![];}_0x1685e0[_0xe4e8('0x4e')]=_0x5439dc;return db[_0xe4e8('0x4f')]['create']({'body':_0x320450[_0xe4e8('0x25')][_0xe4e8('0x25')],'FaxAccountId':_0x320450[_0xe4e8('0x3e')]['id'],'FaxInteractionId':_0x5121d4['id'],'direction':'in','ContactId':_0x5121d4[_0xe4e8('0x50')],'AttachmentId':_0x320450['body']['AttachmentId']});})[_0xe4e8('0x10')](function(_0x21a1c7){_0x1685e0[_0xe4e8('0x17')]=_0x21a1c7;if(!_0x1685e0[_0xe4e8('0x4e')][_0xe4e8('0x51')])return;return db['User'][_0xe4e8('0x37')]({'attributes':['id',_0xe4e8('0x52')],'where':{'id':_0x1685e0[_0xe4e8('0x4e')][_0xe4e8('0x51')]}});})[_0xe4e8('0x10')](function(_0x25b0a9){if(_0x25b0a9){_0x1685e0[_0xe4e8('0x3f')][_0xe4e8('0x53')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x25b0a9['name']+','+(_0x1685e0[_0xe4e8('0x3e')][_0xe4e8('0x54')]||0xa),'interval':_0xe4e8('0x4c')});}if(!_0x1685e0['interaction']['queueId'])return;return db[_0xe4e8('0x55')][_0xe4e8('0x37')]({'attributes':['id','name'],'where':{'id':_0x1685e0['interaction'][_0xe4e8('0x56')]}});})[_0xe4e8('0x10')](function(_0x374ce7){if(_0x374ce7){_0x1685e0[_0xe4e8('0x3f')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x374ce7[_0xe4e8('0x52')]+','+(_0x1685e0[_0xe4e8('0x3e')][_0xe4e8('0x57')]||0x12c),'interval':_0xe4e8('0x4c')});}return respondWithRpcPromise(_0xe4e8('0x58'),_0xe4e8('0x59'),_0x1685e0);})[_0xe4e8('0x10')](function(_0x841476){_0x247f1d(_0x841476);})['catch'](function(_0x29b132){_0x4d1144(_0x38dcfe[_0xe4e8('0x14')](0x1f4,_0x29b132['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index fc117df..879b4a0 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 _0xa18a=['length','faxAccount:','./faxAccount.events','save','remove','update','emit','removeListener','register'];(function(_0x35a140,_0x3aeac6){var _0x30ab82=function(_0x15a7c3){while(--_0x15a7c3){_0x35a140['push'](_0x35a140['shift']());}};_0x30ab82(++_0x3aeac6);}(_0xa18a,0xfe));var _0xaa18=function(_0x43d20a,_0x343dad){_0x43d20a=_0x43d20a-0x0;var _0x4e2420=_0xa18a[_0x43d20a];return _0x4e2420;};'use strict';var FaxAccountEvents=require(_0xaa18('0x0'));var events=[_0xaa18('0x1'),_0xaa18('0x2'),_0xaa18('0x3')];function createListener(_0x3644ac,_0x3c5151){return function(_0x26de74){_0x3c5151[_0xaa18('0x4')](_0x3644ac,_0x26de74);};}function removeListener(_0x56e0f3,_0x5b68ad){return function(){FaxAccountEvents[_0xaa18('0x5')](_0x56e0f3,_0x5b68ad);};}exports[_0xaa18('0x6')]=function(_0x4c4608){for(var _0x33c881=0x0,_0x5524c0=events[_0xaa18('0x7')];_0x33c881<_0x5524c0;_0x33c881++){var _0x5b3422=events[_0x33c881];var _0x5de3ed=createListener(_0xaa18('0x8')+_0x5b3422,_0x4c4608);FaxAccountEvents['on'](_0x5b3422,_0x5de3ed);}}; \ No newline at end of file +var _0x7267=['register','length','faxAccount:','./faxAccount.events','save','removeListener'];(function(_0x489078,_0x32b836){var _0x3910cc=function(_0x178e3b){while(--_0x178e3b){_0x489078['push'](_0x489078['shift']());}};_0x3910cc(++_0x32b836);}(_0x7267,0x6f));var _0x7726=function(_0x1a62de,_0x28259a){_0x1a62de=_0x1a62de-0x0;var _0x48fcfe=_0x7267[_0x1a62de];return _0x48fcfe;};'use strict';var FaxAccountEvents=require(_0x7726('0x0'));var events=[_0x7726('0x1'),'remove','update'];function createListener(_0x10b3f9,_0x2a3c6e){return function(_0x21b2bc){_0x2a3c6e['emit'](_0x10b3f9,_0x21b2bc);};}function removeListener(_0x2d97ce,_0x2f93c4){return function(){FaxAccountEvents[_0x7726('0x2')](_0x2d97ce,_0x2f93c4);};}exports[_0x7726('0x3')]=function(_0x1acebb){for(var _0xba524=0x0,_0xd2f035=events[_0x7726('0x4')];_0xba524<_0xd2f035;_0xba524++){var _0x3b2b06=events[_0xba524];var _0x2c032a=createListener(_0x7726('0x5')+_0x3b2b06,_0x1acebb);FaxAccountEvents['on'](_0x3b2b06,_0x2c032a);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 9067a85..16a4d9b 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 _0x0c84=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','/:id/users','getAgents','create','post','addDisposition','addAnswer','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','send','update','delete','destroy','removeDispositions','multer'];(function(_0x5e7199,_0x878944){var _0x218f5d=function(_0x4e4b){while(--_0x4e4b){_0x5e7199['push'](_0x5e7199['shift']());}};_0x218f5d(++_0x878944);}(_0x0c84,0x185));var _0x40c8=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x0c84[_0x413feb];return _0x40ee88;};'use strict';var multer=require(_0x40c8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x40c8('0x1'));var express=require('express');var router=express[_0x40c8('0x2')]();var fs_extra=require(_0x40c8('0x3'));var auth=require(_0x40c8('0x4'));var interaction=require(_0x40c8('0x5'));var config=require(_0x40c8('0x6'));var controller=require('./faxAccount.controller');router[_0x40c8('0x7')]('/',auth['isAuthenticated'](),controller[_0x40c8('0x8')]);router[_0x40c8('0x7')](_0x40c8('0x9'),auth[_0x40c8('0xa')](),controller[_0x40c8('0xb')]);router['get'](_0x40c8('0xc'),auth[_0x40c8('0xa')](),controller[_0x40c8('0xd')]);router[_0x40c8('0x7')](_0x40c8('0xe'),auth[_0x40c8('0xa')](),controller['getDispositions']);router['get'](_0x40c8('0xf'),auth[_0x40c8('0xa')](),controller[_0x40c8('0x10')]);router[_0x40c8('0x7')](_0x40c8('0x11'),auth[_0x40c8('0xa')](),controller[_0x40c8('0x12')]);router[_0x40c8('0x7')](_0x40c8('0x13'),auth[_0x40c8('0xa')](),controller[_0x40c8('0x14')]);router[_0x40c8('0x7')]('/:id/messages',auth[_0x40c8('0xa')](),controller[_0x40c8('0x15')]);router[_0x40c8('0x7')](_0x40c8('0x16'),auth[_0x40c8('0xa')](),controller[_0x40c8('0x17')]);router['post']('/',auth['isAuthenticated'](),controller[_0x40c8('0x18')]);router[_0x40c8('0x19')]('/:id/dispositions',auth[_0x40c8('0xa')](),controller[_0x40c8('0x1a')]);router[_0x40c8('0x19')](_0x40c8('0xf'),auth[_0x40c8('0xa')](),controller[_0x40c8('0x1b')]);router[_0x40c8('0x19')]('/:id/interactions',auth[_0x40c8('0xa')](),controller[_0x40c8('0x1c')]);router['post'](_0x40c8('0x13'),auth['isAuthenticated'](),controller[_0x40c8('0x1d')]);router[_0x40c8('0x19')](_0x40c8('0x1e'),auth[_0x40c8('0xa')](),controller[_0x40c8('0x1f')]);router[_0x40c8('0x19')](_0x40c8('0x20'),auth[_0x40c8('0xa')](),controller[_0x40c8('0x21')]);router[_0x40c8('0x19')]('/:id/send',auth[_0x40c8('0xa')](),controller[_0x40c8('0x22')]);router[_0x40c8('0x19')](_0x40c8('0x16'),auth[_0x40c8('0xa')](),controller['addAgents']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x40c8('0x23')]);router[_0x40c8('0x24')](_0x40c8('0xc'),auth[_0x40c8('0xa')](),controller[_0x40c8('0x25')]);router['delete'](_0x40c8('0xe'),auth[_0x40c8('0xa')](),controller[_0x40c8('0x26')]);router[_0x40c8('0x24')](_0x40c8('0xf'),auth[_0x40c8('0xa')](),controller['removeAnswers']);router[_0x40c8('0x24')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xd6eb=['updateAccountApplications','send','addAgents','/:id','update','delete','removeAnswers','removeAgents','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','isAuthenticated','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','create','addAnswer','addInteraction','/addaccountapplications','addAccountApplications','/updateaccountapplications'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xd6eb,0x83));var _0xbd6e=function(_0x1332bc,_0x63af04){_0x1332bc=_0x1332bc-0x0;var _0x427301=_0xd6eb[_0x1332bc];return _0x427301;};'use strict';var multer=require('multer');var util=require(_0xbd6e('0x0'));var path=require(_0xbd6e('0x1'));var timeout=require(_0xbd6e('0x2'));var express=require('express');var router=express[_0xbd6e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbd6e('0x4'));var interaction=require(_0xbd6e('0x5'));var config=require(_0xbd6e('0x6'));var controller=require(_0xbd6e('0x7'));router[_0xbd6e('0x8')]('/',auth['isAuthenticated'](),controller[_0xbd6e('0x9')]);router['get'](_0xbd6e('0xa'),auth[_0xbd6e('0xb')](),controller[_0xbd6e('0xc')]);router[_0xbd6e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xbd6e('0xd')]);router['get'](_0xbd6e('0xe'),auth[_0xbd6e('0xb')](),controller[_0xbd6e('0xf')]);router[_0xbd6e('0x8')](_0xbd6e('0x10'),auth[_0xbd6e('0xb')](),controller[_0xbd6e('0x11')]);router[_0xbd6e('0x8')](_0xbd6e('0x12'),auth[_0xbd6e('0xb')](),controller[_0xbd6e('0x13')]);router['get'](_0xbd6e('0x14'),auth[_0xbd6e('0xb')](),controller[_0xbd6e('0x15')]);router['get'](_0xbd6e('0x16'),auth[_0xbd6e('0xb')](),controller[_0xbd6e('0x17')]);router[_0xbd6e('0x8')](_0xbd6e('0x18'),auth[_0xbd6e('0xb')](),controller[_0xbd6e('0x19')]);router[_0xbd6e('0x1a')]('/',auth['isAuthenticated'](),controller[_0xbd6e('0x1b')]);router[_0xbd6e('0x1a')](_0xbd6e('0xe'),auth[_0xbd6e('0xb')](),controller['addDisposition']);router[_0xbd6e('0x1a')](_0xbd6e('0x10'),auth[_0xbd6e('0xb')](),controller[_0xbd6e('0x1c')]);router[_0xbd6e('0x1a')](_0xbd6e('0x12'),auth[_0xbd6e('0xb')](),controller[_0xbd6e('0x1d')]);router[_0xbd6e('0x1a')](_0xbd6e('0x14'),auth['isAuthenticated'](),controller['addApplications']);router['post'](_0xbd6e('0x1e'),auth[_0xbd6e('0xb')](),controller[_0xbd6e('0x1f')]);router['post'](_0xbd6e('0x20'),auth[_0xbd6e('0xb')](),controller[_0xbd6e('0x21')]);router['post']('/:id/send',auth['isAuthenticated'](),controller[_0xbd6e('0x22')]);router[_0xbd6e('0x1a')](_0xbd6e('0x18'),auth[_0xbd6e('0xb')](),controller[_0xbd6e('0x23')]);router['put'](_0xbd6e('0x24'),auth[_0xbd6e('0xb')](),controller[_0xbd6e('0x25')]);router['delete'](_0xbd6e('0x24'),auth[_0xbd6e('0xb')](),controller['destroy']);router['delete'](_0xbd6e('0xe'),auth[_0xbd6e('0xb')](),controller['removeDispositions']);router[_0xbd6e('0x26')](_0xbd6e('0x10'),auth['isAuthenticated'](),controller[_0xbd6e('0x27')]);router[_0xbd6e('0x26')](_0xbd6e('0x18'),auth[_0xbd6e('0xb')](),controller[_0xbd6e('0x28')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index d5f99b9..6b95edb 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 _0x0f56=['sequelize','exports','INTEGER','STRING','*,*,*,*'];(function(_0x8866c,_0x4396f3){var _0x2f52a2=function(_0x33d1f5){while(--_0x33d1f5){_0x8866c['push'](_0x8866c['shift']());}};_0x2f52a2(++_0x4396f3);}(_0x0f56,0xe1));var _0x60f5=function(_0x47c025,_0x59b5d3){_0x47c025=_0x47c025-0x0;var _0x217e2c=_0x0f56[_0x47c025];return _0x217e2c;};'use strict';var Sequelize=require(_0x60f5('0x0'));module[_0x60f5('0x1')]={'priority':{'type':Sequelize[_0x60f5('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x60f5('0x3')],'defaultValue':_0x60f5('0x4')}}; \ No newline at end of file +var _0x0b1e=['*,*,*,*','sequelize','INTEGER','STRING','noop'];(function(_0x24267b,_0x3bed91){var _0x19824a=function(_0x5d6c6f){while(--_0x5d6c6f){_0x24267b['push'](_0x24267b['shift']());}};_0x19824a(++_0x3bed91);}(_0x0b1e,0x132));var _0xe0b1=function(_0xf858e,_0x51b0f1){_0xf858e=_0xf858e-0x0;var _0x5344d8=_0x0b1e[_0xf858e];return _0x5344d8;};'use strict';var Sequelize=require(_0xe0b1('0x0'));module['exports']={'priority':{'type':Sequelize[_0xe0b1('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xe0b1('0x2')],'allowNull':![],'defaultValue':_0xe0b1('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xe0b1('0x2')]},'interval':{'type':Sequelize[_0xe0b1('0x2')],'defaultValue':_0xe0b1('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index f543bc7..6d825a4 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 _0xc0f0=['length','include','merge','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','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','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','stack','name','send','map','FaxApplication','type','key','query','keys','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','rows','catch','show','params','rawAttributes'];(function(_0x4db641,_0x4b34a8){var _0x21144a=function(_0x56c54a){while(--_0x56c54a){_0x4db641['push'](_0x4db641['shift']());}};_0x21144a(++_0x4b34a8);}(_0xc0f0,0x1c2));var _0x0c0f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc0f0[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x0c0f('0x0'));var rimraf=require(_0x0c0f('0x1'));var zipdir=require(_0x0c0f('0x2'));var jsonpatch=require(_0x0c0f('0x3'));var rp=require(_0x0c0f('0x4'));var moment=require(_0x0c0f('0x5'));var BPromise=require(_0x0c0f('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x0c0f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0c0f('0x8'));var _=require(_0x0c0f('0x9'));var squel=require(_0x0c0f('0xa'));var crypto=require(_0x0c0f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0c0f('0xc'));var toCsv=require(_0x0c0f('0xd'));var querystring=require(_0x0c0f('0xe'));var Papa=require(_0x0c0f('0xf'));var Redis=require(_0x0c0f('0x10'));var authService=require(_0x0c0f('0x11'));var qs=require(_0x0c0f('0x12'));var as=require(_0x0c0f('0x13'));var hardwareService=require(_0x0c0f('0x14'));var logger=require(_0x0c0f('0x15'))(_0x0c0f('0x16'));var utils=require(_0x0c0f('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23348e,_0x24be7f){_0x24be7f=_0x24be7f||0xcc;return function(_0x1a08bd){if(_0x1a08bd){return _0x23348e[_0x0c0f('0x18')](_0x24be7f);}return _0x23348e['status'](_0x24be7f)[_0x0c0f('0x19')]();};}function respondWithResult(_0xd55930,_0x4e1036){_0x4e1036=_0x4e1036||0xc8;return function(_0x3f4dfe){if(_0x3f4dfe){return _0xd55930[_0x0c0f('0x1a')](_0x4e1036)[_0x0c0f('0x1b')](_0x3f4dfe);}};}function respondWithFilteredResult(_0x54bd89,_0x359a8c){return function(_0x1c3906){if(_0x1c3906){var _0x43a52c=typeof _0x359a8c[_0x0c0f('0x1c')]===_0x0c0f('0x1d')&&typeof _0x359a8c[_0x0c0f('0x1e')]===_0x0c0f('0x1d');var _0x31d45a=_0x1c3906['count'];var _0x6d8063=_0x43a52c?0x0:_0x359a8c[_0x0c0f('0x1c')];var _0x10a7dd=_0x43a52c?_0x1c3906[_0x0c0f('0x1f')]:_0x359a8c[_0x0c0f('0x1c')]+_0x359a8c[_0x0c0f('0x1e')];var _0x3d2329;if(_0x10a7dd>=_0x31d45a){_0x10a7dd=_0x31d45a;_0x3d2329=0xc8;}else{_0x3d2329=0xce;}_0x54bd89[_0x0c0f('0x1a')](_0x3d2329);return _0x54bd89[_0x0c0f('0x20')]('Content-Range',_0x6d8063+'-'+_0x10a7dd+'/'+_0x31d45a)['json'](_0x1c3906);}return null;};}function patchUpdates(_0x4dbe30){return function(_0x170504){try{jsonpatch[_0x0c0f('0x21')](_0x170504,_0x4dbe30,!![]);}catch(_0x158ee5){return BPromise[_0x0c0f('0x22')](_0x158ee5);}return _0x170504[_0x0c0f('0x23')]();};}function saveUpdates(_0x24f4cd,_0x3ca629){return function(_0x55e4f2){if(_0x55e4f2){return _0x55e4f2[_0x0c0f('0x24')](_0x24f4cd)[_0x0c0f('0x25')](function(_0x51ee4e){return _0x51ee4e;});}return null;};}function removeEntity(_0x177cfa,_0x244fc4){return function(_0x21039f){if(_0x21039f){return _0x21039f[_0x0c0f('0x26')]()[_0x0c0f('0x25')](function(){_0x177cfa[_0x0c0f('0x1a')](0xcc)[_0x0c0f('0x19')]();});}};}function handleEntityNotFound(_0x3dba57,_0x2fc3a2){return function(_0x2bcbf3){if(!_0x2bcbf3){_0x3dba57[_0x0c0f('0x18')](0x194);}return _0x2bcbf3;};}function handleError(_0x230f15,_0x2b443e){_0x2b443e=_0x2b443e||0x1f4;return function(_0x3f5d5a){logger['error'](_0x3f5d5a[_0x0c0f('0x27')]);if(_0x3f5d5a['name']){delete _0x3f5d5a[_0x0c0f('0x28')];}_0x230f15[_0x0c0f('0x1a')](_0x2b443e)[_0x0c0f('0x29')](_0x3f5d5a);};}exports['index']=function(_0x7b4093,_0x4fccf6){var _0x8d046a={},_0x504cd8={},_0x30868c={'count':0x0,'rows':[]};var _0x538dcd=_[_0x0c0f('0x2a')](db[_0x0c0f('0x2b')]['rawAttributes'],function(_0x2c51fc){return{'name':_0x2c51fc['fieldName'],'type':_0x2c51fc[_0x0c0f('0x2c')][_0x0c0f('0x2d')]};});_0x504cd8['model']=_[_0x0c0f('0x2a')](_0x538dcd,'name');_0x504cd8[_0x0c0f('0x2e')]=_[_0x0c0f('0x2f')](_0x7b4093[_0x0c0f('0x2e')]);_0x504cd8['filters']=_['intersection'](_0x504cd8[_0x0c0f('0x30')],_0x504cd8['query']);_0x8d046a[_0x0c0f('0x31')]=_[_0x0c0f('0x32')](_0x504cd8['model'],qs['fields'](_0x7b4093['query'][_0x0c0f('0x33')]));_0x8d046a['attributes']=_0x8d046a['attributes']['length']?_0x8d046a[_0x0c0f('0x31')]:_0x504cd8[_0x0c0f('0x30')];if(!_0x7b4093['query'][_0x0c0f('0x34')](_0x0c0f('0x35'))){_0x8d046a[_0x0c0f('0x1e')]=qs[_0x0c0f('0x1e')](_0x7b4093[_0x0c0f('0x2e')]['limit']);_0x8d046a[_0x0c0f('0x1c')]=qs['offset'](_0x7b4093[_0x0c0f('0x2e')][_0x0c0f('0x1c')]);}_0x8d046a[_0x0c0f('0x36')]=qs[_0x0c0f('0x37')](_0x7b4093[_0x0c0f('0x2e')][_0x0c0f('0x37')]);_0x8d046a[_0x0c0f('0x38')]=qs[_0x0c0f('0x39')](_[_0x0c0f('0x3a')](_0x7b4093[_0x0c0f('0x2e')],_0x504cd8[_0x0c0f('0x39')]),_0x538dcd);if(_0x7b4093[_0x0c0f('0x2e')][_0x0c0f('0x3b')]){_0x8d046a[_0x0c0f('0x38')]=_['merge'](_0x8d046a[_0x0c0f('0x38')],{'$or':_['map'](_0x538dcd,function(_0x4157ff){if(_0x4157ff[_0x0c0f('0x2c')]!==_0x0c0f('0x3c')){var _0x66aef1={};_0x66aef1[_0x4157ff['name']]={'$like':'%'+_0x7b4093['query'][_0x0c0f('0x3b')]+'%'};return _0x66aef1;}})});}_0x8d046a=_['merge']({},_0x8d046a,_0x7b4093[_0x0c0f('0x3d')]);var _0x140dc2={'where':_0x8d046a['where']};return db[_0x0c0f('0x2b')]['count'](_0x140dc2)['then'](function(_0x54f380){_0x30868c[_0x0c0f('0x1f')]=_0x54f380;if(_0x7b4093[_0x0c0f('0x2e')][_0x0c0f('0x3e')]){_0x8d046a['include']=[{'all':!![]}];}return db[_0x0c0f('0x2b')]['findAll'](_0x8d046a);})[_0x0c0f('0x25')](function(_0x4335eb){_0x30868c[_0x0c0f('0x3f')]=_0x4335eb;return _0x30868c;})['then'](respondWithFilteredResult(_0x4fccf6,_0x8d046a))[_0x0c0f('0x40')](handleError(_0x4fccf6,null));};exports[_0x0c0f('0x41')]=function(_0x46051c,_0x501498){var _0x3bc396={'raw':!![],'where':{'id':_0x46051c[_0x0c0f('0x42')]['id']}},_0x38e344={};_0x38e344[_0x0c0f('0x30')]=_[_0x0c0f('0x2f')](db['FaxApplication'][_0x0c0f('0x43')]);_0x38e344[_0x0c0f('0x2e')]=_[_0x0c0f('0x2f')](_0x46051c[_0x0c0f('0x2e')]);_0x38e344[_0x0c0f('0x39')]=_[_0x0c0f('0x32')](_0x38e344[_0x0c0f('0x30')],_0x38e344[_0x0c0f('0x2e')]);_0x3bc396[_0x0c0f('0x31')]=_[_0x0c0f('0x32')](_0x38e344[_0x0c0f('0x30')],qs[_0x0c0f('0x33')](_0x46051c['query'][_0x0c0f('0x33')]));_0x3bc396[_0x0c0f('0x31')]=_0x3bc396[_0x0c0f('0x31')][_0x0c0f('0x44')]?_0x3bc396[_0x0c0f('0x31')]:_0x38e344[_0x0c0f('0x30')];if(_0x46051c[_0x0c0f('0x2e')][_0x0c0f('0x3e')]){_0x3bc396[_0x0c0f('0x45')]=[{'all':!![]}];}_0x3bc396=_[_0x0c0f('0x46')]({},_0x3bc396,_0x46051c[_0x0c0f('0x3d')]);return db['FaxApplication'][_0x0c0f('0x47')](_0x3bc396)[_0x0c0f('0x25')](handleEntityNotFound(_0x501498,null))['then'](respondWithResult(_0x501498,null))[_0x0c0f('0x40')](handleError(_0x501498,null));};exports[_0x0c0f('0x48')]=function(_0x231556,_0x4ef6c6){return db[_0x0c0f('0x2b')][_0x0c0f('0x48')](_0x231556['body'],{})[_0x0c0f('0x25')](respondWithResult(_0x4ef6c6,0xc9))[_0x0c0f('0x40')](handleError(_0x4ef6c6,null));};exports[_0x0c0f('0x24')]=function(_0x1df7ab,_0x45e75a){if(_0x1df7ab[_0x0c0f('0x49')]['id']){delete _0x1df7ab[_0x0c0f('0x49')]['id'];}return db[_0x0c0f('0x2b')][_0x0c0f('0x47')]({'where':{'id':_0x1df7ab[_0x0c0f('0x42')]['id']}})[_0x0c0f('0x25')](handleEntityNotFound(_0x45e75a,null))[_0x0c0f('0x25')](saveUpdates(_0x1df7ab[_0x0c0f('0x49')],null))[_0x0c0f('0x25')](respondWithResult(_0x45e75a,null))['catch'](handleError(_0x45e75a,null));};exports['destroy']=function(_0x18047c,_0x63ac60){return db[_0x0c0f('0x2b')][_0x0c0f('0x47')]({'where':{'id':_0x18047c['params']['id']}})[_0x0c0f('0x25')](handleEntityNotFound(_0x63ac60,null))['then'](removeEntity(_0x63ac60,null))[_0x0c0f('0x40')](handleError(_0x63ac60,null));}; \ No newline at end of file +var _0x2333=['path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','error','name','send','index','FaxApplication','fieldName','key','map','query','intersection','model','attributes','fields','hasOwnProperty','order','sort','filters','pick','filter','merge','type','VIRTUAL','include','findAll','rows','catch','show','params','rawAttributes','keys','length','includeAll','find','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x216c84,_0x2842b7){var _0x48e85d=function(_0x17ba2f){while(--_0x17ba2f){_0x216c84['push'](_0x216c84['shift']());}};_0x48e85d(++_0x2842b7);}(_0x2333,0x1cd));var _0x3233=function(_0x167427,_0x2b3af5){_0x167427=_0x167427-0x0;var _0x140569=_0x2333[_0x167427];return _0x140569;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3233('0x0'));var zipdir=require(_0x3233('0x1'));var jsonpatch=require(_0x3233('0x2'));var rp=require(_0x3233('0x3'));var moment=require('moment');var BPromise=require(_0x3233('0x4'));var Mustache=require(_0x3233('0x5'));var util=require(_0x3233('0x6'));var path=require(_0x3233('0x7'));var sox=require(_0x3233('0x8'));var csv=require('to-csv');var ejs=require(_0x3233('0x9'));var fs=require('fs');var fs_extra=require(_0x3233('0xa'));var _=require('lodash');var squel=require(_0x3233('0xb'));var crypto=require(_0x3233('0xc'));var jsforce=require(_0x3233('0xd'));var deskjs=require(_0x3233('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3233('0xf'));var Papa=require(_0x3233('0x10'));var Redis=require(_0x3233('0x11'));var authService=require(_0x3233('0x12'));var qs=require(_0x3233('0x13'));var as=require(_0x3233('0x14'));var hardwareService=require(_0x3233('0x15'));var logger=require(_0x3233('0x16'))(_0x3233('0x17'));var utils=require(_0x3233('0x18'));var config=require(_0x3233('0x19'));var licenseUtil=require(_0x3233('0x1a'));var db=require(_0x3233('0x1b'))['db'];function respondWithStatusCode(_0x5c0be5,_0x1e1f22){_0x1e1f22=_0x1e1f22||0xcc;return function(_0x522be9){if(_0x522be9){return _0x5c0be5[_0x3233('0x1c')](_0x1e1f22);}return _0x5c0be5[_0x3233('0x1d')](_0x1e1f22)[_0x3233('0x1e')]();};}function respondWithResult(_0x632fbe,_0x164c49){_0x164c49=_0x164c49||0xc8;return function(_0x6c231f){if(_0x6c231f){return _0x632fbe['status'](_0x164c49)[_0x3233('0x1f')](_0x6c231f);}};}function respondWithFilteredResult(_0xf79f3b,_0x80a42b){return function(_0x412fb7){if(_0x412fb7){var _0x2eaa05=typeof _0x80a42b[_0x3233('0x20')]===_0x3233('0x21')&&typeof _0x80a42b[_0x3233('0x22')]===_0x3233('0x21');var _0x3f736f=_0x412fb7[_0x3233('0x23')];var _0x2e8cd1=_0x2eaa05?0x0:_0x80a42b['offset'];var _0x212c74=_0x2eaa05?_0x412fb7['count']:_0x80a42b[_0x3233('0x20')]+_0x80a42b[_0x3233('0x22')];var _0x159b74;if(_0x212c74>=_0x3f736f){_0x212c74=_0x3f736f;_0x159b74=0xc8;}else{_0x159b74=0xce;}_0xf79f3b[_0x3233('0x1d')](_0x159b74);return _0xf79f3b[_0x3233('0x24')]('Content-Range',_0x2e8cd1+'-'+_0x212c74+'/'+_0x3f736f)[_0x3233('0x1f')](_0x412fb7);}return null;};}function patchUpdates(_0x43bfd8){return function(_0x5b718f){try{jsonpatch[_0x3233('0x25')](_0x5b718f,_0x43bfd8,!![]);}catch(_0x464b99){return BPromise[_0x3233('0x26')](_0x464b99);}return _0x5b718f[_0x3233('0x27')]();};}function saveUpdates(_0x5a9b81,_0x3ac9c9){return function(_0x504916){if(_0x504916){return _0x504916['update'](_0x5a9b81)[_0x3233('0x28')](function(_0x3d1bf7){return _0x3d1bf7;});}return null;};}function removeEntity(_0x48535e,_0x1288ec){return function(_0x36b8cc){if(_0x36b8cc){return _0x36b8cc[_0x3233('0x29')]()[_0x3233('0x28')](function(){_0x48535e[_0x3233('0x1d')](0xcc)[_0x3233('0x1e')]();});}};}function handleEntityNotFound(_0x3795a8,_0x2681bd){return function(_0x293069){if(!_0x293069){_0x3795a8['sendStatus'](0x194);}return _0x293069;};}function handleError(_0x418bdc,_0x37ec1c){_0x37ec1c=_0x37ec1c||0x1f4;return function(_0x186b29){logger[_0x3233('0x2a')](_0x186b29['stack']);if(_0x186b29['name']){delete _0x186b29[_0x3233('0x2b')];}_0x418bdc[_0x3233('0x1d')](_0x37ec1c)[_0x3233('0x2c')](_0x186b29);};}exports[_0x3233('0x2d')]=function(_0x5bf321,_0x32ff01){var _0x2c69e4={},_0x4395ac={},_0x4c80ca={'count':0x0,'rows':[]};var _0x24d8e7=_['map'](db[_0x3233('0x2e')]['rawAttributes'],function(_0x5540f0){return{'name':_0x5540f0[_0x3233('0x2f')],'type':_0x5540f0['type'][_0x3233('0x30')]};});_0x4395ac['model']=_[_0x3233('0x31')](_0x24d8e7,_0x3233('0x2b'));_0x4395ac[_0x3233('0x32')]=_['keys'](_0x5bf321[_0x3233('0x32')]);_0x4395ac['filters']=_[_0x3233('0x33')](_0x4395ac[_0x3233('0x34')],_0x4395ac[_0x3233('0x32')]);_0x2c69e4[_0x3233('0x35')]=_[_0x3233('0x33')](_0x4395ac[_0x3233('0x34')],qs[_0x3233('0x36')](_0x5bf321[_0x3233('0x32')][_0x3233('0x36')]));_0x2c69e4[_0x3233('0x35')]=_0x2c69e4[_0x3233('0x35')]['length']?_0x2c69e4[_0x3233('0x35')]:_0x4395ac['model'];if(!_0x5bf321[_0x3233('0x32')][_0x3233('0x37')]('nolimit')){_0x2c69e4['limit']=qs[_0x3233('0x22')](_0x5bf321[_0x3233('0x32')]['limit']);_0x2c69e4['offset']=qs[_0x3233('0x20')](_0x5bf321[_0x3233('0x32')][_0x3233('0x20')]);}_0x2c69e4[_0x3233('0x38')]=qs[_0x3233('0x39')](_0x5bf321[_0x3233('0x32')][_0x3233('0x39')]);_0x2c69e4['where']=qs[_0x3233('0x3a')](_[_0x3233('0x3b')](_0x5bf321['query'],_0x4395ac[_0x3233('0x3a')]),_0x24d8e7);if(_0x5bf321[_0x3233('0x32')][_0x3233('0x3c')]){_0x2c69e4['where']=_[_0x3233('0x3d')](_0x2c69e4['where'],{'$or':_[_0x3233('0x31')](_0x24d8e7,function(_0x1a1f1b){if(_0x1a1f1b[_0x3233('0x3e')]!==_0x3233('0x3f')){var _0x3c7fee={};_0x3c7fee[_0x1a1f1b[_0x3233('0x2b')]]={'$like':'%'+_0x5bf321[_0x3233('0x32')][_0x3233('0x3c')]+'%'};return _0x3c7fee;}})});}_0x2c69e4=_[_0x3233('0x3d')]({},_0x2c69e4,_0x5bf321['options']);var _0x5c0086={'where':_0x2c69e4['where']};return db[_0x3233('0x2e')][_0x3233('0x23')](_0x5c0086)[_0x3233('0x28')](function(_0x2a228b){_0x4c80ca['count']=_0x2a228b;if(_0x5bf321[_0x3233('0x32')]['includeAll']){_0x2c69e4[_0x3233('0x40')]=[{'all':!![]}];}return db[_0x3233('0x2e')][_0x3233('0x41')](_0x2c69e4);})[_0x3233('0x28')](function(_0x109883){_0x4c80ca[_0x3233('0x42')]=_0x109883;return _0x4c80ca;})[_0x3233('0x28')](respondWithFilteredResult(_0x32ff01,_0x2c69e4))[_0x3233('0x43')](handleError(_0x32ff01,null));};exports[_0x3233('0x44')]=function(_0x4d8790,_0x9b5dae){var _0x327f3c={'raw':!![],'where':{'id':_0x4d8790[_0x3233('0x45')]['id']}},_0x3e9d58={};_0x3e9d58[_0x3233('0x34')]=_['keys'](db[_0x3233('0x2e')][_0x3233('0x46')]);_0x3e9d58[_0x3233('0x32')]=_[_0x3233('0x47')](_0x4d8790[_0x3233('0x32')]);_0x3e9d58[_0x3233('0x3a')]=_[_0x3233('0x33')](_0x3e9d58[_0x3233('0x34')],_0x3e9d58[_0x3233('0x32')]);_0x327f3c[_0x3233('0x35')]=_[_0x3233('0x33')](_0x3e9d58[_0x3233('0x34')],qs[_0x3233('0x36')](_0x4d8790[_0x3233('0x32')][_0x3233('0x36')]));_0x327f3c[_0x3233('0x35')]=_0x327f3c[_0x3233('0x35')][_0x3233('0x48')]?_0x327f3c[_0x3233('0x35')]:_0x3e9d58[_0x3233('0x34')];if(_0x4d8790['query'][_0x3233('0x49')]){_0x327f3c[_0x3233('0x40')]=[{'all':!![]}];}_0x327f3c=_['merge']({},_0x327f3c,_0x4d8790['options']);return db[_0x3233('0x2e')][_0x3233('0x4a')](_0x327f3c)['then'](handleEntityNotFound(_0x9b5dae,null))['then'](respondWithResult(_0x9b5dae,null))['catch'](handleError(_0x9b5dae,null));};exports[_0x3233('0x4b')]=function(_0x14b0a7,_0x2d8f22){return db[_0x3233('0x2e')][_0x3233('0x4b')](_0x14b0a7[_0x3233('0x4c')],{})[_0x3233('0x28')](respondWithResult(_0x2d8f22,0xc9))[_0x3233('0x43')](handleError(_0x2d8f22,null));};exports[_0x3233('0x4d')]=function(_0x4c79ed,_0x15bb74){if(_0x4c79ed[_0x3233('0x4c')]['id']){delete _0x4c79ed[_0x3233('0x4c')]['id'];}return db[_0x3233('0x2e')][_0x3233('0x4a')]({'where':{'id':_0x4c79ed[_0x3233('0x45')]['id']}})[_0x3233('0x28')](handleEntityNotFound(_0x15bb74,null))[_0x3233('0x28')](saveUpdates(_0x4c79ed[_0x3233('0x4c')],null))[_0x3233('0x28')](respondWithResult(_0x15bb74,null))[_0x3233('0x43')](handleError(_0x15bb74,null));};exports[_0x3233('0x29')]=function(_0x210a4a,_0x5e8dba){return db[_0x3233('0x2e')][_0x3233('0x4a')]({'where':{'id':_0x210a4a[_0x3233('0x45')]['id']}})[_0x3233('0x28')](handleEntityNotFound(_0x5e8dba,null))[_0x3233('0x28')](removeEntity(_0x5e8dba,null))[_0x3233('0x43')](handleError(_0x5e8dba,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 8f4c4a1..89b9208 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 _0x15e4=['FaxApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxApplication.attributes','exports','define'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x15e4,0xb8));var _0x415e=function(_0x6880e6,_0x4964d8){_0x6880e6=_0x6880e6-0x0;var _0x4c3672=_0x15e4[_0x6880e6];return _0x4c3672;};'use strict';var _=require(_0x415e('0x0'));var util=require(_0x415e('0x1'));var logger=require(_0x415e('0x2'))(_0x415e('0x3'));var moment=require(_0x415e('0x4'));var BPromise=require(_0x415e('0x5'));var rp=require(_0x415e('0x6'));var fs=require('fs');var path=require(_0x415e('0x7'));var rimraf=require('rimraf');var config=require(_0x415e('0x8'));var attributes=require(_0x415e('0x9'));module[_0x415e('0xa')]=function(_0x24ae13,_0x41850d){return _0x24ae13[_0x415e('0xb')](_0x415e('0xc'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x415e('0xd')});}; \ No newline at end of file +var _0x0cb7=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4'];(function(_0x28a7a9,_0xf7681d){var _0x5d77ed=function(_0x2d3913){while(--_0x2d3913){_0x28a7a9['push'](_0x28a7a9['shift']());}};_0x5d77ed(++_0xf7681d);}(_0x0cb7,0x1dd));var _0x70cb=function(_0x5c1c99,_0x47c1a5){_0x5c1c99=_0x5c1c99-0x0;var _0x5fa09f=_0x0cb7[_0x5c1c99];return _0x5fa09f;};'use strict';var _=require(_0x70cb('0x0'));var util=require(_0x70cb('0x1'));var logger=require(_0x70cb('0x2'))(_0x70cb('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x70cb('0x4'));var fs=require('fs');var path=require(_0x70cb('0x5'));var rimraf=require('rimraf');var config=require(_0x70cb('0x6'));var attributes=require(_0x70cb('0x7'));module[_0x70cb('0x8')]=function(_0x1d3b71,_0x5a4a74){return _0x1d3b71[_0x70cb('0x9')](_0x70cb('0xa'),attributes,{'tableName':_0x70cb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x70cb('0xc'),'collate':_0x70cb('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 4547243..ac87e3a 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 _0xfb0b=['FaxApplication','update','body','options','raw','where','attributes','UpdateFaxApplication','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','message','FaxApplication,\x20%s,\x20%s','result'];(function(_0x457092,_0x109dff){var _0xb2d7a2=function(_0x483e39){while(--_0x483e39){_0x457092['push'](_0x457092['shift']());}};_0xb2d7a2(++_0x109dff);}(_0xfb0b,0x1d8));var _0xbfb0=function(_0x5b8f9a,_0x6079fd){_0x5b8f9a=_0x5b8f9a-0x0;var _0x2c1d4c=_0xfb0b[_0x5b8f9a];return _0x2c1d4c;};'use strict';var _=require(_0xbfb0('0x0'));var util=require('util');var moment=require(_0xbfb0('0x1'));var BPromise=require('bluebird');var rs=require(_0xbfb0('0x2'));var fs=require('fs');var Redis=require(_0xbfb0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbfb0('0x4'));var logger=require(_0xbfb0('0x5'))('rpc');var config=require(_0xbfb0('0x6'));var jayson=require(_0xbfb0('0x7'));var client=jayson[_0xbfb0('0x8')][_0xbfb0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x224c2a,_0x527964,_0x3e15e5){return new BPromise(function(_0x573298,_0xdd2f1a){return client[_0xbfb0('0xa')](_0x224c2a,_0x3e15e5)[_0xbfb0('0xb')](function(_0x3d318d){logger[_0xbfb0('0xc')]('FaxApplication,\x20%s,\x20%s',_0x527964,_0xbfb0('0xd'));logger[_0xbfb0('0xe')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x527964,_0xbfb0('0xd'),JSON[_0xbfb0('0xf')](_0x3d318d));if(_0x3d318d[_0xbfb0('0x10')]){if(_0x3d318d[_0xbfb0('0x10')][_0xbfb0('0x11')]===0x1f4){logger[_0xbfb0('0x10')]('FaxApplication,\x20%s,\x20%s',_0x527964,_0x3d318d['error'][_0xbfb0('0x12')]);return _0xdd2f1a(_0x3d318d['error'][_0xbfb0('0x12')]);}logger[_0xbfb0('0x10')](_0xbfb0('0x13'),_0x527964,_0x3d318d['error'][_0xbfb0('0x12')]);return _0x573298(_0x3d318d[_0xbfb0('0x10')][_0xbfb0('0x12')]);}else{logger[_0xbfb0('0xc')]('FaxApplication,\x20%s,\x20%s',_0x527964,'request\x20sent');_0x573298(_0x3d318d[_0xbfb0('0x14')][_0xbfb0('0x12')]);}})['catch'](function(_0x214929){logger[_0xbfb0('0x10')](_0xbfb0('0x13'),_0x527964,_0x214929);_0xdd2f1a(_0x214929);});});}exports['UpdateFaxApplication']=function(_0x2ea46f){var _0x1ffc8a=this;return new Promise(function(_0x1ca868,_0x2f7fab){return db[_0xbfb0('0x15')][_0xbfb0('0x16')](_0x2ea46f[_0xbfb0('0x17')],{'raw':_0x2ea46f[_0xbfb0('0x18')]?_0x2ea46f[_0xbfb0('0x18')][_0xbfb0('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ea46f['options']?_0x2ea46f['options'][_0xbfb0('0x1a')]||null:null,'attributes':_0x2ea46f['options']?_0x2ea46f['options'][_0xbfb0('0x1b')]||null:null,'limit':_0x2ea46f[_0xbfb0('0x18')]?_0x2ea46f[_0xbfb0('0x18')]['limit']||null:null})[_0xbfb0('0xb')](function(_0x2467ce){logger[_0xbfb0('0xc')](_0xbfb0('0x1c'),_0x2ea46f);logger[_0xbfb0('0xe')](_0xbfb0('0x1c'),_0x2ea46f,JSON[_0xbfb0('0xf')](_0x2467ce));_0x1ca868(_0x2467ce);})['catch'](function(_0x251980){logger[_0xbfb0('0x10')](_0xbfb0('0x1c'),_0x251980[_0xbfb0('0x12')],_0x2ea46f);_0x2f7fab(_0x1ffc8a[_0xbfb0('0x10')](0x1f4,_0x251980[_0xbfb0('0x12')]));});});}; \ No newline at end of file +var _0xd3f1=['body','options','where','attributes','limit','UpdateFaxApplication','stringify','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','client','http','request','then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','FaxApplication','update'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xd3f1,0x1ba));var _0x1d3f=function(_0x5ba273,_0x5227e2){_0x5ba273=_0x5ba273-0x0;var _0x237f6c=_0xd3f1[_0x5ba273];return _0x237f6c;};'use strict';var _=require('lodash');var util=require(_0x1d3f('0x0'));var moment=require(_0x1d3f('0x1'));var BPromise=require(_0x1d3f('0x2'));var rs=require(_0x1d3f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1d3f('0x4'));var logger=require('../../config/logger')(_0x1d3f('0x5'));var config=require(_0x1d3f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1d3f('0x7')][_0x1d3f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3391bf,_0x13bd67,_0x4803e4){return new BPromise(function(_0xcc5ec0,_0x16f792){return client[_0x1d3f('0x9')](_0x3391bf,_0x4803e4)[_0x1d3f('0xa')](function(_0x3fea13){logger['info'](_0x1d3f('0xb'),_0x13bd67,_0x1d3f('0xc'));logger[_0x1d3f('0xd')](_0x1d3f('0xe'),_0x13bd67,_0x1d3f('0xc'),JSON['stringify'](_0x3fea13));if(_0x3fea13[_0x1d3f('0xf')]){if(_0x3fea13[_0x1d3f('0xf')]['code']===0x1f4){logger['error'](_0x1d3f('0xb'),_0x13bd67,_0x3fea13['error'][_0x1d3f('0x10')]);return _0x16f792(_0x3fea13[_0x1d3f('0xf')]['message']);}logger[_0x1d3f('0xf')](_0x1d3f('0xb'),_0x13bd67,_0x3fea13[_0x1d3f('0xf')][_0x1d3f('0x10')]);return _0xcc5ec0(_0x3fea13[_0x1d3f('0xf')][_0x1d3f('0x10')]);}else{logger[_0x1d3f('0x11')](_0x1d3f('0xb'),_0x13bd67,_0x1d3f('0xc'));_0xcc5ec0(_0x3fea13[_0x1d3f('0x12')]['message']);}})[_0x1d3f('0x13')](function(_0x105000){logger[_0x1d3f('0xf')](_0x1d3f('0xb'),_0x13bd67,_0x105000);_0x16f792(_0x105000);});});}exports['UpdateFaxApplication']=function(_0x63e609){var _0x4a3179=this;return new Promise(function(_0xd0b2ab,_0x17d706){return db[_0x1d3f('0x14')][_0x1d3f('0x15')](_0x63e609[_0x1d3f('0x16')],{'raw':_0x63e609[_0x1d3f('0x17')]?_0x63e609[_0x1d3f('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x63e609[_0x1d3f('0x17')]?_0x63e609['options'][_0x1d3f('0x18')]||null:null,'attributes':_0x63e609[_0x1d3f('0x17')]?_0x63e609['options'][_0x1d3f('0x19')]||null:null,'limit':_0x63e609[_0x1d3f('0x17')]?_0x63e609[_0x1d3f('0x17')][_0x1d3f('0x1a')]||null:null})[_0x1d3f('0xa')](function(_0x2dce2d){logger[_0x1d3f('0x11')]('UpdateFaxApplication',_0x63e609);logger[_0x1d3f('0xd')](_0x1d3f('0x1b'),_0x63e609,JSON[_0x1d3f('0x1c')](_0x2dce2d));_0xd0b2ab(_0x2dce2d);})[_0x1d3f('0x13')](function(_0x3cf2ff){logger[_0x1d3f('0xf')](_0x1d3f('0x1b'),_0x3cf2ff[_0x1d3f('0x10')],_0x63e609);_0x17d706(_0x4a3179['error'](0x1f4,_0x3cf2ff[_0x1d3f('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 86bff26..4b29106 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 _0xe5b5=['../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2d3485,_0x4af469){var _0x1d209b=function(_0x15a041){while(--_0x15a041){_0x2d3485['push'](_0x2d3485['shift']());}};_0x1d209b(++_0x4af469);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x26b80e,_0x5c9333){_0x26b80e=_0x26b80e-0x0;var _0x84a8a8=_0xe5b5[_0x26b80e];return _0x84a8a8;};'use strict';var multer=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var path=require(_0x5e5b('0x2'));var timeout=require(_0x5e5b('0x3'));var express=require(_0x5e5b('0x4'));var router=express[_0x5e5b('0x5')]();var fs_extra=require(_0x5e5b('0x6'));var auth=require(_0x5e5b('0x7'));var interaction=require(_0x5e5b('0x8'));var config=require(_0x5e5b('0x9'));var controller=require(_0x5e5b('0xa'));router[_0x5e5b('0xb')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xd')]);router[_0x5e5b('0xb')](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xf')]);router[_0x5e5b('0x10')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x11')]);router[_0x5e5b('0x12')](_0x5e5b('0xe'),auth['isAuthenticated'](),controller[_0x5e5b('0x13')]);router['delete'](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x14')]);module[_0x5e5b('0x15')]=router; \ No newline at end of file +var _0x8603=['../../components/interaction/service','./faxApplication.controller','isAuthenticated','index','get','/:id','create','put','update','exports','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x2fbf2c,_0xb5a8f9){var _0x132005=function(_0xaa95bb){while(--_0xaa95bb){_0x2fbf2c['push'](_0x2fbf2c['shift']());}};_0x132005(++_0xb5a8f9);}(_0x8603,0x190));var _0x3860=function(_0x20c942,_0x1d2f4d){_0x20c942=_0x20c942-0x0;var _0x49b605=_0x8603[_0x20c942];return _0x49b605;};'use strict';var multer=require('multer');var util=require(_0x3860('0x0'));var path=require(_0x3860('0x1'));var timeout=require(_0x3860('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3860('0x3'));var auth=require(_0x3860('0x4'));var interaction=require(_0x3860('0x5'));var config=require('../../config/environment');var controller=require(_0x3860('0x6'));router['get']('/',auth[_0x3860('0x7')](),controller[_0x3860('0x8')]);router[_0x3860('0x9')](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x3860('0xb')]);router[_0x3860('0xc')]('/:id',auth[_0x3860('0x7')](),controller[_0x3860('0xd')]);router['delete'](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['destroy']);module[_0x3860('0xe')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 60fd39d..d8c179b 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 _0xa6b0=['sequelize','exports','STRING','DATE','ENUM','out','INTEGER'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x5c53fd,_0x3db1ea){_0x5c53fd=_0x5c53fd-0x0;var _0x22c3f0=_0xa6b0[_0x5c53fd];return _0x22c3f0;};'use strict';var Sequelize=require(_0x0a6b('0x0'));module[_0x0a6b('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x0a6b('0x2')]},'secondDisposition':{'type':Sequelize[_0x0a6b('0x2')]},'thirdDisposition':{'type':Sequelize[_0x0a6b('0x2')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x0a6b('0x3')]},'fax':{'type':Sequelize[_0x0a6b('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x0a6b('0x4')]('in',_0x0a6b('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0a6b('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x0a6b('0x4')]('in',_0x0a6b('0x5')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x0a6b('0x6')]}}; \ No newline at end of file +var _0x5c3c=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','exports'];(function(_0x83d08e,_0x228942){var _0x404d4f=function(_0x161ce){while(--_0x161ce){_0x83d08e['push'](_0x83d08e['shift']());}};_0x404d4f(++_0x228942);}(_0x5c3c,0x132));var _0xc5c3=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x5c3c[_0x1d24eb];return _0x1dc576;};'use strict';var Sequelize=require(_0xc5c3('0x0'));module[_0xc5c3('0x1')]={'closed':{'type':Sequelize[_0xc5c3('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc5c3('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xc5c3('0x4')]},'thirdDisposition':{'type':Sequelize[_0xc5c3('0x4')]},'note':{'type':Sequelize[_0xc5c3('0x4')]},'read1stAt':{'type':Sequelize[_0xc5c3('0x3')]},'fax':{'type':Sequelize[_0xc5c3('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xc5c3('0x5')]('in',_0xc5c3('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc5c3('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xc5c3('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 8660acd..580507c 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 _0x2b4a=['removeTags','download','unix','toString','root','server','files','tmp','join','attachments','push','Attachment','createdAt','Messages','mkdirSync','pipe','createWriteStream','basename','resolve','log','err','rimraf','zip-dir','moment','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','map','FaxInteraction','fieldName','getOptions','findAll','fax','query','params','model','keys','filters','intersection','fields','attributes','length','includeAll','include','merge','options','catch','body','find','describe','addMessage','FaxMessage','ids','omit','rawAttributes','hasOwnProperty','order','sort','pick','FaxInteractionId','filter','where','$gte','split','format','rows','addTags','setTags','spread','Tag','emit'];(function(_0x7d80c1,_0x20b039){var _0x20a123=function(_0x3a63fb){while(--_0x3a63fb){_0x7d80c1['push'](_0x7d80c1['shift']());}};_0x20a123(++_0x20b039);}(_0x2b4a,0x13e));var _0xa2b4=function(_0x2b81be,_0x544bdf){_0x2b81be=_0x2b81be-0x0;var _0x8ed4a7=_0x2b4a[_0x2b81be];return _0x8ed4a7;};'use strict';var rimraf=require(_0xa2b4('0x0'));var zipdir=require(_0xa2b4('0x1'));var moment=require(_0xa2b4('0x2'));var BPromise=require(_0xa2b4('0x3'));var util=require(_0xa2b4('0x4'));var path=require(_0xa2b4('0x5'));var fs=require('fs');var _=require(_0xa2b4('0x6'));var Redis=require(_0xa2b4('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0xa2b4('0x8'));var logger=require(_0xa2b4('0x9'))(_0xa2b4('0xa'));var config=require(_0xa2b4('0xb'));var db=require('../../mysqldb')['db'];config[_0xa2b4('0xc')]=_[_0xa2b4('0xd')](config['redis'],{'host':_0xa2b4('0xe'),'port':0x18eb});var socket=require(_0xa2b4('0xf'))(new Redis(config[_0xa2b4('0xc')]));require(_0xa2b4('0x10'))[_0xa2b4('0x11')](socket);function respondWithStatusCode(_0x20619e,_0x5e5cb0){_0x5e5cb0=_0x5e5cb0||0xcc;return function(_0x5f5abc){if(_0x5f5abc){return _0x20619e[_0xa2b4('0x12')](_0x5e5cb0);}return _0x20619e['status'](_0x5e5cb0)[_0xa2b4('0x13')]();};}function respondWithResult(_0x2975b1,_0x2913ce){_0x2913ce=_0x2913ce||0xc8;return function(_0x39e30e){if(_0x39e30e){return _0x2975b1[_0xa2b4('0x14')](_0x2913ce)[_0xa2b4('0x15')](_0x39e30e);}};}function respondWithFilteredResult(_0x1ee212,_0x337d97){return function(_0x2dc151){if(_0x2dc151){var _0x22a14=typeof _0x337d97[_0xa2b4('0x16')]===_0xa2b4('0x17')&&typeof _0x337d97[_0xa2b4('0x18')]===_0xa2b4('0x17');var _0x56c444=_0x2dc151[_0xa2b4('0x19')];var _0x2ab39b=_0x22a14?0x0:_0x337d97[_0xa2b4('0x16')];var _0x296249=_0x22a14?_0x2dc151[_0xa2b4('0x19')]:_0x337d97[_0xa2b4('0x16')]+_0x337d97['limit'];var _0x326491;if(_0x296249>=_0x56c444){_0x296249=_0x56c444;_0x326491=0xc8;}else{_0x326491=0xce;}_0x1ee212[_0xa2b4('0x14')](_0x326491);return _0x1ee212[_0xa2b4('0x1a')](_0xa2b4('0x1b'),_0x2ab39b+'-'+_0x296249+'/'+_0x56c444)['json'](_0x2dc151);}return null;};}function saveUpdates(_0x50ca0c){return function(_0x3083ea){if(_0x3083ea){return _0x3083ea[_0xa2b4('0x1c')](_0x50ca0c)[_0xa2b4('0x1d')](function(_0x6ed641){return _0x6ed641;});}return null;};}function removeEntity(_0x5d6ce3){return function(_0x66db7f){if(_0x66db7f){return _0x66db7f[_0xa2b4('0x1e')]()[_0xa2b4('0x1d')](function(){_0x5d6ce3[_0xa2b4('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57b56e){return function(_0x538eda){if(!_0x538eda){_0x57b56e[_0xa2b4('0x12')](0x194);}return _0x538eda;};}function handleError(_0x47c22b,_0x46aa5c){_0x46aa5c=_0x46aa5c||0x1f4;return function(_0x389a42){logger[_0xa2b4('0x1f')](_0x389a42[_0xa2b4('0x20')]);if(_0x389a42[_0xa2b4('0x21')]){delete _0x389a42['name'];}_0x47c22b[_0xa2b4('0x14')](_0x46aa5c)['send'](_0x389a42);};}exports['index']=function(_0x54b35a,_0x1fc4ba){var _0xa407de={};var _0x3e824b=_[_0xa2b4('0x22')](db[_0xa2b4('0x23')]['rawAttributes'],function(_0x272dcb){return{'name':_0x272dcb[_0xa2b4('0x24')],'type':_0x272dcb['type']['key']};});_0xa407de=qs[_0xa2b4('0x25')](_0x3e824b,_0x54b35a);return interaction[_0xa2b4('0x26')](_0xa2b4('0x27'),_0x54b35a[_0xa2b4('0x28')],_0x54b35a['user'],_0xa407de,_0x3e824b)[_0xa2b4('0x1d')](respondWithFilteredResult(_0x1fc4ba,_0xa407de))['catch'](handleError(_0x1fc4ba,null));};exports['show']=function(_0x33e0f9,_0x5cabc4){var _0x24310c={'raw':![],'where':{'id':_0x33e0f9[_0xa2b4('0x29')]['id']}},_0x4dd746={};_0x4dd746[_0xa2b4('0x2a')]=_[_0xa2b4('0x2b')](db['FaxInteraction']['rawAttributes']);_0x4dd746[_0xa2b4('0x28')]=_[_0xa2b4('0x2b')](_0x33e0f9[_0xa2b4('0x28')]);_0x4dd746[_0xa2b4('0x2c')]=_[_0xa2b4('0x2d')](_0x4dd746['model'],_0x4dd746[_0xa2b4('0x28')]);_0x24310c['attributes']=_[_0xa2b4('0x2d')](_0x4dd746['model'],qs['fields'](_0x33e0f9[_0xa2b4('0x28')][_0xa2b4('0x2e')]));_0x24310c[_0xa2b4('0x2f')]=_0x24310c[_0xa2b4('0x2f')][_0xa2b4('0x30')]?_0x24310c['attributes']:_0x4dd746[_0xa2b4('0x2a')];if(_0x33e0f9[_0xa2b4('0x28')][_0xa2b4('0x31')]){_0x24310c[_0xa2b4('0x32')]=[{'all':!![]}];}_0x24310c=_[_0xa2b4('0x33')]({},_0x24310c,_0x33e0f9[_0xa2b4('0x34')]);return db['FaxInteraction']['find'](_0x24310c)[_0xa2b4('0x1d')](handleEntityNotFound(_0x5cabc4,null))['then'](respondWithResult(_0x5cabc4,null))['catch'](handleError(_0x5cabc4,null));};exports['create']=function(_0x5e293e,_0x50a1e9){return db[_0xa2b4('0x23')]['create'](_0x5e293e['body'],{})[_0xa2b4('0x1d')](respondWithResult(_0x50a1e9,0xc9))[_0xa2b4('0x35')](handleError(_0x50a1e9,null));};exports[_0xa2b4('0x1c')]=function(_0x50a0fa,_0x3bdbec){if(_0x50a0fa['body']['id']){delete _0x50a0fa[_0xa2b4('0x36')]['id'];}return db[_0xa2b4('0x23')]['find']({'where':{'id':_0x50a0fa['params']['id']}})['then'](handleEntityNotFound(_0x3bdbec,null))[_0xa2b4('0x1d')](saveUpdates(_0x50a0fa[_0xa2b4('0x36')],null))[_0xa2b4('0x1d')](respondWithResult(_0x3bdbec,null))[_0xa2b4('0x35')](handleError(_0x3bdbec,null));};exports[_0xa2b4('0x1e')]=function(_0x4b5452,_0x768393){return db[_0xa2b4('0x23')][_0xa2b4('0x37')]({'where':{'id':_0x4b5452[_0xa2b4('0x29')]['id']}})['then'](handleEntityNotFound(_0x768393,null))[_0xa2b4('0x1d')](removeEntity(_0x768393,null))['catch'](handleError(_0x768393,null));};exports['describe']=function(_0x474a5f,_0x4c1870){return db['FaxInteraction'][_0xa2b4('0x38')]()[_0xa2b4('0x1d')](respondWithResult(_0x4c1870,null))[_0xa2b4('0x35')](handleError(_0x4c1870,null));};exports[_0xa2b4('0x39')]=function(_0x120608,_0x39c766){return db[_0xa2b4('0x3a')]['find']({'where':{'id':_0x120608[_0xa2b4('0x29')]['id']}})[_0xa2b4('0x1d')](handleEntityNotFound(_0x39c766,null))['then'](function(_0x52dda2){if(_0x52dda2){return _0x52dda2[_0xa2b4('0x39')](_0x120608[_0xa2b4('0x36')][_0xa2b4('0x3b')],_[_0xa2b4('0x3c')](_0x120608[_0xa2b4('0x36')],['ids','id'])||{});}})['then'](respondWithResult(_0x39c766,null))['catch'](handleError(_0x39c766,null));};exports['getMessages']=function(_0x28e21c,_0x58b485){var _0x11e9fe={'raw':![],'where':{}};var _0x191d77={};var _0x2ff7bd={'count':0x0,'rows':[]};return db['FaxInteraction']['findOne']({'where':{'id':_0x28e21c['params']['id']}})['then'](handleEntityNotFound(_0x58b485,null))[_0xa2b4('0x1d')](function(_0x4c6842){if(_0x4c6842){_0x191d77[_0xa2b4('0x2a')]=_[_0xa2b4('0x2b')](db[_0xa2b4('0x3a')][_0xa2b4('0x3d')]);_0x191d77[_0xa2b4('0x28')]=_[_0xa2b4('0x2b')](_0x28e21c['query']);_0x191d77[_0xa2b4('0x2c')]=_[_0xa2b4('0x2d')](_0x191d77[_0xa2b4('0x2a')],_0x191d77[_0xa2b4('0x28')]);_0x11e9fe[_0xa2b4('0x2f')]=_[_0xa2b4('0x2d')](_0x191d77[_0xa2b4('0x2a')],qs[_0xa2b4('0x2e')](_0x28e21c[_0xa2b4('0x28')]['fields']));_0x11e9fe[_0xa2b4('0x2f')]=_0x11e9fe[_0xa2b4('0x2f')]['length']?_0x11e9fe[_0xa2b4('0x2f')]:_0x191d77[_0xa2b4('0x2a')];if(!_0x28e21c[_0xa2b4('0x28')][_0xa2b4('0x3e')]('nolimit')){_0x11e9fe[_0xa2b4('0x18')]=qs[_0xa2b4('0x18')](_0x28e21c[_0xa2b4('0x28')][_0xa2b4('0x18')]);_0x11e9fe['offset']=qs[_0xa2b4('0x16')](_0x28e21c[_0xa2b4('0x28')][_0xa2b4('0x16')]);}_0x11e9fe[_0xa2b4('0x3f')]=qs[_0xa2b4('0x40')](_0x28e21c[_0xa2b4('0x28')][_0xa2b4('0x40')]);_0x11e9fe['where']=qs[_0xa2b4('0x2c')](_[_0xa2b4('0x41')](_0x28e21c[_0xa2b4('0x28')],_0x191d77[_0xa2b4('0x2c')]));_0x11e9fe['where'][_0xa2b4('0x42')]=_0x4c6842['id'];if(_0x28e21c[_0xa2b4('0x28')][_0xa2b4('0x43')]){_0x11e9fe[_0xa2b4('0x44')]=_['merge'](_0x11e9fe[_0xa2b4('0x44')],{'$or':_[_0xa2b4('0x22')](_0x11e9fe[_0xa2b4('0x2f')],function(_0xd9625d){var _0x254ba3={};_0x254ba3[_0xd9625d]={'$like':'%'+_0x28e21c[_0xa2b4('0x28')][_0xa2b4('0x43')]+'%'};return _0x254ba3;})});}if(_0x28e21c[_0xa2b4('0x28')]['$gte']){var _0x11486d=_0x28e21c[_0xa2b4('0x28')][_0xa2b4('0x45')][_0xa2b4('0x46')](',');var _0x35c010={};_0x35c010[_0x11486d[0x0]]={'$gte':moment(_0x11486d[0x1])[_0xa2b4('0x47')]('YYYY-MM-DD\x20HH:mm:ss')};_0x11e9fe['where']=_['merge'](_0x11e9fe[_0xa2b4('0x44')],_0x35c010);}_0x11e9fe=_[_0xa2b4('0x33')]({},_0x11e9fe,_0x28e21c[_0xa2b4('0x34')]);return db[_0xa2b4('0x3a')][_0xa2b4('0x19')]({'where':_0x11e9fe[_0xa2b4('0x44')]})[_0xa2b4('0x1d')](function(_0x4b584c){_0x2ff7bd['count']=_0x4b584c;if(_0x28e21c[_0xa2b4('0x28')]['includeAll']){_0x11e9fe[_0xa2b4('0x32')]=[{'all':!![]}];}return db[_0xa2b4('0x3a')][_0xa2b4('0x26')](_0x11e9fe);})[_0xa2b4('0x1d')](function(_0x5c68cb){_0x2ff7bd[_0xa2b4('0x48')]=_0x5c68cb;return _0x2ff7bd;});}})[_0xa2b4('0x1d')](respondWithFilteredResult(_0x58b485,_0x11e9fe))[_0xa2b4('0x35')](handleError(_0x58b485,null));};exports[_0xa2b4('0x49')]=function(_0x11ca0f,_0x35b53b){return db[_0xa2b4('0x23')][_0xa2b4('0x37')]({'where':{'id':_0x11ca0f[_0xa2b4('0x29')]['id']}})[_0xa2b4('0x1d')](handleEntityNotFound(_0x35b53b,null))[_0xa2b4('0x1d')](function(_0x409014){if(_0x409014){return _0x409014[_0xa2b4('0x4a')](_0x11ca0f[_0xa2b4('0x36')][_0xa2b4('0x3b')],_['omit'](_0x11ca0f[_0xa2b4('0x36')],[_0xa2b4('0x3b'),'id'])||{})[_0xa2b4('0x4b')](function(){return db[_0xa2b4('0x4c')][_0xa2b4('0x26')]({'attributes':['id',_0xa2b4('0x21'),'color'],'where':{'id':_0x11ca0f[_0xa2b4('0x36')][_0xa2b4('0x3b')]}});})['then'](function(_0x446439){socket[_0xa2b4('0x4d')]('faxInteractionTags:save',{'id':Number(_0x11ca0f[_0xa2b4('0x29')]['id']),'tags':_0x446439||[]});return{'id':Number(_0x11ca0f[_0xa2b4('0x29')]['id']),'tags':_0x446439||[]};});}})['then'](respondWithResult(_0x35b53b,null))[_0xa2b4('0x35')](handleError(_0x35b53b,null));};exports[_0xa2b4('0x4e')]=function(_0x3964c5,_0x54d280){return db[_0xa2b4('0x23')][_0xa2b4('0x37')]({'where':{'id':_0x3964c5[_0xa2b4('0x29')]['id']}})['then'](handleEntityNotFound(_0x54d280,null))[_0xa2b4('0x1d')](function(_0x52457a){if(_0x52457a){return _0x52457a[_0xa2b4('0x4e')](_0x3964c5[_0xa2b4('0x28')][_0xa2b4('0x3b')]);}})[_0xa2b4('0x1d')](respondWithStatusCode(_0x54d280,null))[_0xa2b4('0x35')](handleError(_0x54d280,null));};exports[_0xa2b4('0x4f')]=function(_0x382fc9,_0x7a03d5){var _0x532900=moment()[_0xa2b4('0x50')]()[_0xa2b4('0x51')]();var _0x1e5b10=path['join'](config[_0xa2b4('0x52')],_0xa2b4('0x53'),_0xa2b4('0x54'),_0xa2b4('0x55'));var _0x5ee592=path[_0xa2b4('0x56')](config['root'],_0xa2b4('0x53'),_0xa2b4('0x54'),_0xa2b4('0x57'));var _0x5cf6d5=path[_0xa2b4('0x56')](_0x1e5b10,_0x532900);var _0x2df037=util['format']('transcript-%d-%s.zip',_0x382fc9['params']['id'],_0x532900);var _0x4dfa69=path[_0xa2b4('0x56')](_0x1e5b10,_0x2df037);var _0x348e1a=[];_0x348e1a[_0xa2b4('0x58')]({'model':db[_0xa2b4('0x59')],'as':_0xa2b4('0x59'),'raw':!![]});var _0x58ab6f=[{'model':db[_0xa2b4('0x3a')],'as':'Messages','attributes':['id',_0xa2b4('0x36'),_0xa2b4('0x5a')],'include':_0x348e1a}];return db[_0xa2b4('0x23')][_0xa2b4('0x37')]({'where':{'id':_0x382fc9[_0xa2b4('0x29')]['id']},'include':_0x58ab6f})[_0xa2b4('0x1d')](handleEntityNotFound(_0x7a03d5,null))['then'](function(_0x5811b3){if(_0x5811b3&&_0x5811b3[_0xa2b4('0x5b')]){var _0x27f621=_0x5811b3['get']({'plain':!![]});fs[_0xa2b4('0x5c')](_0x5cf6d5);for(var _0x3c9760=0x0;_0x3c9760<_0x27f621[_0xa2b4('0x5b')]['length'];_0x3c9760++){var _0xabb02b=_0x27f621[_0xa2b4('0x5b')][_0x3c9760][_0xa2b4('0x59')];if(_0xabb02b){var _0x4b5b79=path[_0xa2b4('0x56')](_0x5ee592,_0xabb02b['basename']);if(fs['existsSync'](_0x4b5b79)){fs['createReadStream'](_0x4b5b79)[_0xa2b4('0x5d')](fs[_0xa2b4('0x5e')](path[_0xa2b4('0x56')](_0x5cf6d5,_0xabb02b[_0xa2b4('0x5f')])));}}}return BPromise[_0xa2b4('0x60')]()['then'](function(){return new BPromise(function(_0x5bc854,_0x4c79cf){zipdir(_0x5cf6d5,{'saveTo':_0x4dfa69},function(_0x3bf3a0,_0x3f637a){if(_0x3bf3a0)return _0x4c79cf(_0x3bf3a0);return _0x5bc854(_0x3f637a);});})['then'](function(){return new BPromise(function(_0x461238,_0x36fab4){rimraf(_0x5cf6d5,function(_0x9621f3){if(_0x9621f3)_0x36fab4(_0x9621f3);return _0x461238();});});})[_0xa2b4('0x1d')](function(){return _0x7a03d5['download'](_0x4dfa69,_0x2df037,function(_0x5d07a0){if(_0x5d07a0){console[_0xa2b4('0x61')](_0xa2b4('0x62'),_0x5d07a0);}else{fs['unlinkSync'](_0x4dfa69);}});});});}else{return _0x7a03d5[_0xa2b4('0x12')](0xc8);}})[_0xa2b4('0x35')](handleError(_0x7a03d5,null));}; \ No newline at end of file +var _0x681c=['catch','params','model','keys','rawAttributes','filters','attributes','intersection','fields','include','merge','find','create','body','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','length','hasOwnProperty','nolimit','where','pick','FaxInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','addTags','setTags','spread','color','emit','removeTags','unix','toString','root','server','tmp','join','attachments','transcript-%d-%s.zip','push','Attachment','Messages','get','mkdirSync','basename','existsSync','createWriteStream','err','rimraf','zip-dir','bluebird','util','path','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','error','stack','name','index','map','FaxInteraction','fieldName','key','findAll','fax','query','user'];(function(_0x33ebf5,_0x258ec6){var _0x66957b=function(_0x49739a){while(--_0x49739a){_0x33ebf5['push'](_0x33ebf5['shift']());}};_0x66957b(++_0x258ec6);}(_0x681c,0x9c));var _0xc681=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x681c[_0xd1d19a];return _0x52a79d;};'use strict';var rimraf=require(_0xc681('0x0'));var zipdir=require(_0xc681('0x1'));var moment=require('moment');var BPromise=require(_0xc681('0x2'));var util=require(_0xc681('0x3'));var path=require(_0xc681('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xc681('0x5'));var interaction=require('../../components/interaction/service');var qs=require(_0xc681('0x6'));var logger=require(_0xc681('0x7'))(_0xc681('0x8'));var config=require(_0xc681('0x9'));var db=require(_0xc681('0xa'))['db'];config[_0xc681('0xb')]=_[_0xc681('0xc')](config[_0xc681('0xb')],{'host':_0xc681('0xd'),'port':0x18eb});var socket=require(_0xc681('0xe'))(new Redis(config[_0xc681('0xb')]));require(_0xc681('0xf'))[_0xc681('0x10')](socket);function respondWithStatusCode(_0x3eb01a,_0x2b4df2){_0x2b4df2=_0x2b4df2||0xcc;return function(_0xfd6387){if(_0xfd6387){return _0x3eb01a[_0xc681('0x11')](_0x2b4df2);}return _0x3eb01a[_0xc681('0x12')](_0x2b4df2)[_0xc681('0x13')]();};}function respondWithResult(_0x1c5929,_0xb74c03){_0xb74c03=_0xb74c03||0xc8;return function(_0x1922d4){if(_0x1922d4){return _0x1c5929[_0xc681('0x12')](_0xb74c03)[_0xc681('0x14')](_0x1922d4);}};}function respondWithFilteredResult(_0x49bd9c,_0x4ae3e8){return function(_0x52f418){if(_0x52f418){var _0x24d12e=typeof _0x4ae3e8['offset']===_0xc681('0x15')&&typeof _0x4ae3e8[_0xc681('0x16')]==='undefined';var _0xfd8237=_0x52f418[_0xc681('0x17')];var _0x25b549=_0x24d12e?0x0:_0x4ae3e8['offset'];var _0x65dfc8=_0x24d12e?_0x52f418['count']:_0x4ae3e8[_0xc681('0x18')]+_0x4ae3e8[_0xc681('0x16')];var _0x1d72a9;if(_0x65dfc8>=_0xfd8237){_0x65dfc8=_0xfd8237;_0x1d72a9=0xc8;}else{_0x1d72a9=0xce;}_0x49bd9c[_0xc681('0x12')](_0x1d72a9);return _0x49bd9c[_0xc681('0x19')](_0xc681('0x1a'),_0x25b549+'-'+_0x65dfc8+'/'+_0xfd8237)[_0xc681('0x14')](_0x52f418);}return null;};}function saveUpdates(_0x57e42b){return function(_0x39a9eb){if(_0x39a9eb){return _0x39a9eb[_0xc681('0x1b')](_0x57e42b)[_0xc681('0x1c')](function(_0x242dc9){return _0x242dc9;});}return null;};}function removeEntity(_0x606d24){return function(_0x51f6f7){if(_0x51f6f7){return _0x51f6f7[_0xc681('0x1d')]()[_0xc681('0x1c')](function(){_0x606d24['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x48b31b){return function(_0x35fbe2){if(!_0x35fbe2){_0x48b31b[_0xc681('0x11')](0x194);}return _0x35fbe2;};}function handleError(_0x3d4e4d,_0x493892){_0x493892=_0x493892||0x1f4;return function(_0x526a3d){logger[_0xc681('0x1e')](_0x526a3d[_0xc681('0x1f')]);if(_0x526a3d['name']){delete _0x526a3d[_0xc681('0x20')];}_0x3d4e4d[_0xc681('0x12')](_0x493892)['send'](_0x526a3d);};}exports[_0xc681('0x21')]=function(_0x55997d,_0x50ae52){var _0x178269={};var _0x4dae98=_[_0xc681('0x22')](db[_0xc681('0x23')]['rawAttributes'],function(_0x253604){return{'name':_0x253604[_0xc681('0x24')],'type':_0x253604['type'][_0xc681('0x25')]};});_0x178269=qs['getOptions'](_0x4dae98,_0x55997d);return interaction[_0xc681('0x26')](_0xc681('0x27'),_0x55997d[_0xc681('0x28')],_0x55997d[_0xc681('0x29')],_0x178269,_0x4dae98)['then'](respondWithFilteredResult(_0x50ae52,_0x178269))[_0xc681('0x2a')](handleError(_0x50ae52,null));};exports['show']=function(_0xd0795c,_0x1893b1){var _0x451cf7={'raw':![],'where':{'id':_0xd0795c[_0xc681('0x2b')]['id']}},_0x3b7989={};_0x3b7989[_0xc681('0x2c')]=_[_0xc681('0x2d')](db[_0xc681('0x23')][_0xc681('0x2e')]);_0x3b7989[_0xc681('0x28')]=_[_0xc681('0x2d')](_0xd0795c[_0xc681('0x28')]);_0x3b7989[_0xc681('0x2f')]=_['intersection'](_0x3b7989['model'],_0x3b7989[_0xc681('0x28')]);_0x451cf7[_0xc681('0x30')]=_[_0xc681('0x31')](_0x3b7989[_0xc681('0x2c')],qs[_0xc681('0x32')](_0xd0795c[_0xc681('0x28')]['fields']));_0x451cf7[_0xc681('0x30')]=_0x451cf7[_0xc681('0x30')]['length']?_0x451cf7[_0xc681('0x30')]:_0x3b7989[_0xc681('0x2c')];if(_0xd0795c[_0xc681('0x28')]['includeAll']){_0x451cf7[_0xc681('0x33')]=[{'all':!![]}];}_0x451cf7=_[_0xc681('0x34')]({},_0x451cf7,_0xd0795c['options']);return db['FaxInteraction'][_0xc681('0x35')](_0x451cf7)[_0xc681('0x1c')](handleEntityNotFound(_0x1893b1,null))['then'](respondWithResult(_0x1893b1,null))[_0xc681('0x2a')](handleError(_0x1893b1,null));};exports[_0xc681('0x36')]=function(_0x16f706,_0x51fa8e){return db[_0xc681('0x23')][_0xc681('0x36')](_0x16f706[_0xc681('0x37')],{})[_0xc681('0x1c')](respondWithResult(_0x51fa8e,0xc9))[_0xc681('0x2a')](handleError(_0x51fa8e,null));};exports[_0xc681('0x1b')]=function(_0x1992f5,_0x5ceac5){if(_0x1992f5[_0xc681('0x37')]['id']){delete _0x1992f5[_0xc681('0x37')]['id'];}return db['FaxInteraction'][_0xc681('0x35')]({'where':{'id':_0x1992f5['params']['id']}})[_0xc681('0x1c')](handleEntityNotFound(_0x5ceac5,null))[_0xc681('0x1c')](saveUpdates(_0x1992f5[_0xc681('0x37')],null))[_0xc681('0x1c')](respondWithResult(_0x5ceac5,null))['catch'](handleError(_0x5ceac5,null));};exports['destroy']=function(_0x3e7f17,_0x6454f1){return db[_0xc681('0x23')][_0xc681('0x35')]({'where':{'id':_0x3e7f17['params']['id']}})[_0xc681('0x1c')](handleEntityNotFound(_0x6454f1,null))[_0xc681('0x1c')](removeEntity(_0x6454f1,null))[_0xc681('0x2a')](handleError(_0x6454f1,null));};exports[_0xc681('0x38')]=function(_0x4a77da,_0x51612a){return db[_0xc681('0x23')][_0xc681('0x38')]()[_0xc681('0x1c')](respondWithResult(_0x51612a,null))[_0xc681('0x2a')](handleError(_0x51612a,null));};exports[_0xc681('0x39')]=function(_0x1cfd7b,_0x34010a){return db[_0xc681('0x3a')][_0xc681('0x35')]({'where':{'id':_0x1cfd7b[_0xc681('0x2b')]['id']}})[_0xc681('0x1c')](handleEntityNotFound(_0x34010a,null))[_0xc681('0x1c')](function(_0x5e1b7b){if(_0x5e1b7b){return _0x5e1b7b['addMessage'](_0x1cfd7b[_0xc681('0x37')][_0xc681('0x3b')],_[_0xc681('0x3c')](_0x1cfd7b[_0xc681('0x37')],['ids','id'])||{});}})['then'](respondWithResult(_0x34010a,null))[_0xc681('0x2a')](handleError(_0x34010a,null));};exports[_0xc681('0x3d')]=function(_0x4fefee,_0x58973c){var _0x52a029={'raw':![],'where':{}};var _0x328b74={};var _0x5aad8e={'count':0x0,'rows':[]};return db[_0xc681('0x23')][_0xc681('0x3e')]({'where':{'id':_0x4fefee[_0xc681('0x2b')]['id']}})[_0xc681('0x1c')](handleEntityNotFound(_0x58973c,null))[_0xc681('0x1c')](function(_0x4b08c1){if(_0x4b08c1){_0x328b74[_0xc681('0x2c')]=_[_0xc681('0x2d')](db['FaxMessage'][_0xc681('0x2e')]);_0x328b74['query']=_[_0xc681('0x2d')](_0x4fefee[_0xc681('0x28')]);_0x328b74[_0xc681('0x2f')]=_[_0xc681('0x31')](_0x328b74[_0xc681('0x2c')],_0x328b74[_0xc681('0x28')]);_0x52a029[_0xc681('0x30')]=_[_0xc681('0x31')](_0x328b74[_0xc681('0x2c')],qs['fields'](_0x4fefee[_0xc681('0x28')][_0xc681('0x32')]));_0x52a029[_0xc681('0x30')]=_0x52a029['attributes'][_0xc681('0x3f')]?_0x52a029['attributes']:_0x328b74['model'];if(!_0x4fefee[_0xc681('0x28')][_0xc681('0x40')](_0xc681('0x41'))){_0x52a029[_0xc681('0x16')]=qs['limit'](_0x4fefee['query'][_0xc681('0x16')]);_0x52a029['offset']=qs[_0xc681('0x18')](_0x4fefee['query'][_0xc681('0x18')]);}_0x52a029['order']=qs['sort'](_0x4fefee[_0xc681('0x28')]['sort']);_0x52a029[_0xc681('0x42')]=qs[_0xc681('0x2f')](_[_0xc681('0x43')](_0x4fefee[_0xc681('0x28')],_0x328b74[_0xc681('0x2f')]));_0x52a029['where'][_0xc681('0x44')]=_0x4b08c1['id'];if(_0x4fefee[_0xc681('0x28')]['filter']){_0x52a029[_0xc681('0x42')]=_[_0xc681('0x34')](_0x52a029[_0xc681('0x42')],{'$or':_[_0xc681('0x22')](_0x52a029['attributes'],function(_0x43acaf){var _0x2d61bd={};_0x2d61bd[_0x43acaf]={'$like':'%'+_0x4fefee[_0xc681('0x28')][_0xc681('0x45')]+'%'};return _0x2d61bd;})});}if(_0x4fefee[_0xc681('0x28')][_0xc681('0x46')]){var _0x2cbe20=_0x4fefee[_0xc681('0x28')][_0xc681('0x46')][_0xc681('0x47')](',');var _0x4a3dc6={};_0x4a3dc6[_0x2cbe20[0x0]]={'$gte':moment(_0x2cbe20[0x1])[_0xc681('0x48')](_0xc681('0x49'))};_0x52a029[_0xc681('0x42')]=_[_0xc681('0x34')](_0x52a029[_0xc681('0x42')],_0x4a3dc6);}_0x52a029=_[_0xc681('0x34')]({},_0x52a029,_0x4fefee[_0xc681('0x4a')]);return db[_0xc681('0x3a')][_0xc681('0x17')]({'where':_0x52a029[_0xc681('0x42')]})[_0xc681('0x1c')](function(_0x1aeaef){_0x5aad8e[_0xc681('0x17')]=_0x1aeaef;if(_0x4fefee[_0xc681('0x28')][_0xc681('0x4b')]){_0x52a029['include']=[{'all':!![]}];}return db[_0xc681('0x3a')][_0xc681('0x26')](_0x52a029);})[_0xc681('0x1c')](function(_0x1efb34){_0x5aad8e['rows']=_0x1efb34;return _0x5aad8e;});}})[_0xc681('0x1c')](respondWithFilteredResult(_0x58973c,_0x52a029))[_0xc681('0x2a')](handleError(_0x58973c,null));};exports[_0xc681('0x4c')]=function(_0x324f85,_0x56b6cc){return db['FaxInteraction']['find']({'where':{'id':_0x324f85['params']['id']}})[_0xc681('0x1c')](handleEntityNotFound(_0x56b6cc,null))[_0xc681('0x1c')](function(_0x1711e0){if(_0x1711e0){return _0x1711e0[_0xc681('0x4d')](_0x324f85[_0xc681('0x37')][_0xc681('0x3b')],_[_0xc681('0x3c')](_0x324f85[_0xc681('0x37')],[_0xc681('0x3b'),'id'])||{})[_0xc681('0x4e')](function(){return db['Tag'][_0xc681('0x26')]({'attributes':['id',_0xc681('0x20'),_0xc681('0x4f')],'where':{'id':_0x324f85[_0xc681('0x37')]['ids']}});})['then'](function(_0x54ba0e){socket[_0xc681('0x50')]('faxInteractionTags:save',{'id':Number(_0x324f85[_0xc681('0x2b')]['id']),'tags':_0x54ba0e||[]});return{'id':Number(_0x324f85['params']['id']),'tags':_0x54ba0e||[]};});}})[_0xc681('0x1c')](respondWithResult(_0x56b6cc,null))[_0xc681('0x2a')](handleError(_0x56b6cc,null));};exports[_0xc681('0x51')]=function(_0x8985c2,_0x369be8){return db[_0xc681('0x23')][_0xc681('0x35')]({'where':{'id':_0x8985c2[_0xc681('0x2b')]['id']}})[_0xc681('0x1c')](handleEntityNotFound(_0x369be8,null))['then'](function(_0x15026d){if(_0x15026d){return _0x15026d['removeTags'](_0x8985c2[_0xc681('0x28')][_0xc681('0x3b')]);}})['then'](respondWithStatusCode(_0x369be8,null))['catch'](handleError(_0x369be8,null));};exports['download']=function(_0x133bd5,_0x4f7636){var _0x22568c=moment()[_0xc681('0x52')]()[_0xc681('0x53')]();var _0x1a3afc=path['join'](config[_0xc681('0x54')],_0xc681('0x55'),'files',_0xc681('0x56'));var _0x5694ed=path[_0xc681('0x57')](config[_0xc681('0x54')],_0xc681('0x55'),'files',_0xc681('0x58'));var _0x496599=path['join'](_0x1a3afc,_0x22568c);var _0x156b93=util['format'](_0xc681('0x59'),_0x133bd5[_0xc681('0x2b')]['id'],_0x22568c);var _0xdcf4a4=path[_0xc681('0x57')](_0x1a3afc,_0x156b93);var _0x4dd951=[];_0x4dd951[_0xc681('0x5a')]({'model':db[_0xc681('0x5b')],'as':_0xc681('0x5b'),'raw':!![]});var _0x1d203d=[{'model':db[_0xc681('0x3a')],'as':_0xc681('0x5c'),'attributes':['id',_0xc681('0x37'),'createdAt'],'include':_0x4dd951}];return db[_0xc681('0x23')]['find']({'where':{'id':_0x133bd5[_0xc681('0x2b')]['id']},'include':_0x1d203d})['then'](handleEntityNotFound(_0x4f7636,null))[_0xc681('0x1c')](function(_0x3e7140){if(_0x3e7140&&_0x3e7140[_0xc681('0x5c')]){var _0x1c4bc6=_0x3e7140[_0xc681('0x5d')]({'plain':!![]});fs[_0xc681('0x5e')](_0x496599);for(var _0x2c0a82=0x0;_0x2c0a82<_0x1c4bc6['Messages'][_0xc681('0x3f')];_0x2c0a82++){var _0x53b17a=_0x1c4bc6[_0xc681('0x5c')][_0x2c0a82][_0xc681('0x5b')];if(_0x53b17a){var _0x2df677=path[_0xc681('0x57')](_0x5694ed,_0x53b17a[_0xc681('0x5f')]);if(fs[_0xc681('0x60')](_0x2df677)){fs['createReadStream'](_0x2df677)['pipe'](fs[_0xc681('0x61')](path[_0xc681('0x57')](_0x496599,_0x53b17a[_0xc681('0x5f')])));}}}return BPromise['resolve']()['then'](function(){return new BPromise(function(_0x4baa1a,_0x580c82){zipdir(_0x496599,{'saveTo':_0xdcf4a4},function(_0x3fcc65,_0x550415){if(_0x3fcc65)return _0x580c82(_0x3fcc65);return _0x4baa1a(_0x550415);});})[_0xc681('0x1c')](function(){return new BPromise(function(_0x8dc12,_0x318fb1){rimraf(_0x496599,function(_0x454c70){if(_0x454c70)_0x318fb1(_0x454c70);return _0x8dc12();});});})[_0xc681('0x1c')](function(){return _0x4f7636['download'](_0xdcf4a4,_0x156b93,function(_0x2516ec){if(_0x2516ec){console['log'](_0xc681('0x62'),_0x2516ec);}else{fs['unlinkSync'](_0xdcf4a4);}});});});}else{return _0x4f7636[_0xc681('0x11')](0xc8);}})[_0xc681('0x2a')](handleError(_0x4f7636,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 90cf048..1f99974 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 _0x7cb8=['FaxMessage','save','update','remove','getUsers','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','hook','exports','events','FaxInteraction','../../mysqldb'];(function(_0x1d6f1a,_0x13ba63){var _0x5e13ea=function(_0xd7dbd6){while(--_0xd7dbd6){_0x1d6f1a['push'](_0x1d6f1a['shift']());}};_0x5e13ea(++_0x13ba63);}(_0x7cb8,0x7b));var _0x87cb=function(_0x2f928f,_0x3f7715){_0x2f928f=_0x2f928f-0x0;var _0x113814=_0x7cb8[_0x2f928f];return _0x113814;};'use strict';var EventEmitter=require(_0x87cb('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0x87cb('0x1')];var FaxMessage=require(_0x87cb('0x2'))['db'][_0x87cb('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x87cb('0x4'),'afterUpdate':_0x87cb('0x5'),'afterDestroy':_0x87cb('0x6')};function emitEvent(_0x4d7658){return function(_0x11e79b,_0x1e58fc,_0x20615b){_0x11e79b[_0x87cb('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x31a7b1){_0x11e79b[_0x87cb('0x8')](_0x87cb('0x9'),_0x31a7b1[_0x87cb('0xa')](function(_0x1b2915){return{'id':_0x1b2915['id']};}));return FaxMessage[_0x87cb('0xb')]({'where':{'FaxInteractionId':_0x11e79b['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3a401d){_0x11e79b[_0x87cb('0x8')]('unreadMessages',_0x3a401d[_0x87cb('0xc')]);FaxInteractionEvents[_0x87cb('0xd')](_0x4d7658+':'+_0x11e79b['id'],_0x11e79b);FaxInteractionEvents['emit'](_0x4d7658,_0x11e79b);_0x20615b(null);})[_0x87cb('0xe')](_0x20615b(null));};}for(var e in events){if(events[_0x87cb('0xf')](e)){var event=events[e];FaxInteraction[_0x87cb('0x10')](e,emitEvent(event));}}module[_0x87cb('0x11')]=FaxInteractionEvents; \ No newline at end of file +var _0x4663=['catch','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','then','setDataValue','map','unreadMessages','length','emit'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x4663,0xe4));var _0x3466=function(_0x340638,_0x3ab432){_0x340638=_0x340638-0x0;var _0x5b4e39=_0x4663[_0x340638];return _0x5b4e39;};'use strict';var EventEmitter=require(_0x3466('0x0'));var FaxInteraction=require(_0x3466('0x1'))['db'][_0x3466('0x2')];var FaxMessage=require(_0x3466('0x1'))['db'][_0x3466('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x3466('0x4')](0x0);var events={'afterCreate':_0x3466('0x5'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5136a4){return function(_0x136b47,_0x4b4b11,_0x108445){_0x136b47['getUsers']({'attributes':['id'],'raw':!![]})[_0x3466('0x6')](function(_0x1675e3){_0x136b47[_0x3466('0x7')]('Users',_0x1675e3[_0x3466('0x8')](function(_0xd4d306){return{'id':_0xd4d306['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x136b47['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3466('0x6')](function(_0xf01c55){_0x136b47[_0x3466('0x7')](_0x3466('0x9'),_0xf01c55[_0x3466('0xa')]);FaxInteractionEvents[_0x3466('0xb')](_0x5136a4+':'+_0x136b47['id'],_0x136b47);FaxInteractionEvents[_0x3466('0xb')](_0x5136a4,_0x136b47);_0x108445(null);})[_0x3466('0xc')](_0x108445(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x3466('0xd')](e,emitEvent(event));}}module[_0x3466('0xe')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 5db9a70..a5b643c 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 _0x3185=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','closed','closedAt','format'];(function(_0x47752d,_0x43212e){var _0x3f5d59=function(_0x1a83c7){while(--_0x1a83c7){_0x47752d['push'](_0x47752d['shift']());}};_0x3f5d59(++_0x43212e);}(_0x3185,0x177));var _0x5318=function(_0x58ac52,_0xa5d7fa){_0x58ac52=_0x58ac52-0x0;var _0x45590e=_0x3185[_0x58ac52];return _0x45590e;};'use strict';var _=require(_0x5318('0x0'));var util=require(_0x5318('0x1'));var logger=require(_0x5318('0x2'))(_0x5318('0x3'));var moment=require(_0x5318('0x4'));var BPromise=require(_0x5318('0x5'));var rp=require(_0x5318('0x6'));var fs=require('fs');var path=require(_0x5318('0x7'));var rimraf=require('rimraf');var config=require(_0x5318('0x8'));var attributes=require(_0x5318('0x9'));module[_0x5318('0xa')]=function(_0xd07d91,_0x5c8d7d){return _0xd07d91[_0x5318('0xb')](_0x5318('0xc'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x8da5c3,_0x31dedf,_0x5c42b1){if(_0x8da5c3['changed'](_0x5318('0xd'))){_0x8da5c3[_0x5318('0xe')]=moment()[_0x5318('0xf')](_0x5318('0x10'));}_0x5c42b1(null,_0x8da5c3);}}});}; \ No newline at end of file +var _0x6b21=['changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./faxInteraction.attributes','exports','FaxInteraction'];(function(_0x73a3f0,_0x2cf8bd){var _0x3a2785=function(_0x4ccca2){while(--_0x4ccca2){_0x73a3f0['push'](_0x73a3f0['shift']());}};_0x3a2785(++_0x2cf8bd);}(_0x6b21,0x75));var _0x16b2=function(_0x22bcbd,_0x3c3399){_0x22bcbd=_0x22bcbd-0x0;var _0xed9e6f=_0x6b21[_0x22bcbd];return _0xed9e6f;};'use strict';var _=require(_0x16b2('0x0'));var util=require(_0x16b2('0x1'));var logger=require(_0x16b2('0x2'))(_0x16b2('0x3'));var moment=require('moment');var BPromise=require(_0x16b2('0x4'));var rp=require(_0x16b2('0x5'));var fs=require('fs');var path=require(_0x16b2('0x6'));var rimraf=require('rimraf');var config=require(_0x16b2('0x7'));var attributes=require(_0x16b2('0x8'));module[_0x16b2('0x9')]=function(_0x560d96,_0x5ac94b){return _0x560d96['define'](_0x16b2('0xa'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x403d5b,_0x500eaf,_0x4b4a72){if(_0x403d5b[_0x16b2('0xb')](_0x16b2('0xc'))){_0x403d5b[_0x16b2('0xd')]=moment()[_0x16b2('0xe')](_0x16b2('0xf'));}_0x4b4a72(null,_0x403d5b);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 5d0c048..1a6a5ff 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 _0x45fd=['FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','AddTagsToFaxInteraction','find','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info'];(function(_0x1a0016,_0x3d80e1){var _0x2945df=function(_0x2e82b2){while(--_0x2e82b2){_0x1a0016['push'](_0x1a0016['shift']());}};_0x2945df(++_0x3d80e1);}(_0x45fd,0x179));var _0xd45f=function(_0x492a11,_0x32bdbe){_0x492a11=_0x492a11-0x0;var _0x36c3e6=_0x45fd[_0x492a11];return _0x36c3e6;};'use strict';var _=require(_0xd45f('0x0'));var util=require(_0xd45f('0x1'));var moment=require(_0xd45f('0x2'));var BPromise=require(_0xd45f('0x3'));var rs=require(_0xd45f('0x4'));var fs=require('fs');var Redis=require(_0xd45f('0x5'));var db=require(_0xd45f('0x6'))['db'];var utils=require(_0xd45f('0x7'));var logger=require(_0xd45f('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd45f('0x9'));var client=jayson['client'][_0xd45f('0xa')]({'port':0x232a});config[_0xd45f('0xb')]=_['defaults'](config[_0xd45f('0xb')],{'host':_0xd45f('0xc'),'port':0x18eb});var socket=require(_0xd45f('0xd'))(new Redis(config[_0xd45f('0xb')]));require(_0xd45f('0xe'))[_0xd45f('0xf')](socket);function respondWithRpcPromise(_0x35a928,_0x175269,_0x150bbe){return new BPromise(function(_0x57ecad,_0x1c6d66){return client[_0xd45f('0x10')](_0x35a928,_0x150bbe)[_0xd45f('0x11')](function(_0x1147b2){logger[_0xd45f('0x12')](_0xd45f('0x13'),_0x175269,_0xd45f('0x14'));logger[_0xd45f('0x15')](_0xd45f('0x16'),_0x175269,_0xd45f('0x14'),JSON[_0xd45f('0x17')](_0x1147b2));if(_0x1147b2[_0xd45f('0x18')]){if(_0x1147b2[_0xd45f('0x18')][_0xd45f('0x19')]===0x1f4){logger[_0xd45f('0x18')]('FaxInteraction,\x20%s,\x20%s',_0x175269,_0x1147b2['error']['message']);return _0x1c6d66(_0x1147b2[_0xd45f('0x18')][_0xd45f('0x1a')]);}logger[_0xd45f('0x18')](_0xd45f('0x13'),_0x175269,_0x1147b2[_0xd45f('0x18')]['message']);return _0x57ecad(_0x1147b2[_0xd45f('0x18')][_0xd45f('0x1a')]);}else{logger[_0xd45f('0x12')](_0xd45f('0x13'),_0x175269,_0xd45f('0x14'));_0x57ecad(_0x1147b2[_0xd45f('0x1b')][_0xd45f('0x1a')]);}})[_0xd45f('0x1c')](function(_0x18e62c){logger[_0xd45f('0x18')](_0xd45f('0x13'),_0x175269,_0x18e62c);_0x1c6d66(_0x18e62c);});});}exports[_0xd45f('0x1d')]=function(_0x119063){var _0xec0899=this;return new Promise(function(_0x165318,_0x3432cf){return db[_0xd45f('0x1e')][_0xd45f('0x1f')](_0x119063[_0xd45f('0x20')],{'raw':_0x119063[_0xd45f('0x21')]?_0x119063[_0xd45f('0x21')][_0xd45f('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x119063[_0xd45f('0x21')]?_0x119063[_0xd45f('0x21')][_0xd45f('0x23')]||null:null,'attributes':_0x119063[_0xd45f('0x21')]?_0x119063['options'][_0xd45f('0x24')]||null:null,'limit':_0x119063['options']?_0x119063[_0xd45f('0x21')][_0xd45f('0x25')]||null:null})[_0xd45f('0x11')](function(_0x40366f){logger[_0xd45f('0x12')](_0xd45f('0x1d'),_0x119063);logger[_0xd45f('0x15')](_0xd45f('0x1d'),_0x119063,JSON['stringify'](_0x40366f));_0x165318(_0x40366f);})[_0xd45f('0x1c')](function(_0x3b9a02){logger['error']('UpdateFaxInteraction',_0x3b9a02[_0xd45f('0x1a')],_0x119063);_0x3432cf(_0xec0899['error'](0x1f4,_0x3b9a02[_0xd45f('0x1a')]));});});};exports[_0xd45f('0x26')]=function(_0xf97699){return new Promise(function(_0x51b84e,_0x48f2a7){return db[_0xd45f('0x1e')][_0xd45f('0x27')]({'where':_0xf97699[_0xd45f('0x21')]?_0xf97699[_0xd45f('0x21')]['where']||null:null})[_0xd45f('0x11')](function(_0x31e1c5){if(_0x31e1c5){return _0x31e1c5[_0xd45f('0x28')](_0xf97699[_0xd45f('0x20')][_0xd45f('0x29')],_[_0xd45f('0x2a')](_0xf97699[_0xd45f('0x20')],[_0xd45f('0x29'),'id'])||{});}})['spread'](function(_0x314403){logger[_0xd45f('0x12')](_0xd45f('0x2b'),_0xf97699);logger['debug'](_0xd45f('0x2b'),_0xf97699,JSON[_0xd45f('0x17')](_0x314403));_0x51b84e(_0x314403);})['catch'](function(_0x2ab9d5){logger['error']('AddTags',_0x2ab9d5['message'],_0xf97699);_0x48f2a7(_this[_0xd45f('0x18')](0x1f4,_0x2ab9d5[_0xd45f('0x1a')]));});});}; \ No newline at end of file +var _0xe0c9=['catch','AddTagsToFaxInteraction','find','addTags','ids','omit','spread','AddTags','stringify','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','message','result','FaxInteraction','update','body','options','raw','where','attributes','limit','UpdateFaxInteraction'];(function(_0x9496fd,_0x2d4539){var _0x28d8d6=function(_0x14539a){while(--_0x14539a){_0x9496fd['push'](_0x9496fd['shift']());}};_0x28d8d6(++_0x2d4539);}(_0xe0c9,0x105));var _0x9e0c=function(_0x58892d,_0x538a4c){_0x58892d=_0x58892d-0x0;var _0x52cc69=_0xe0c9[_0x58892d];return _0x52cc69;};'use strict';var _=require('lodash');var util=require(_0x9e0c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9e0c('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x9e0c('0x2'));var logger=require(_0x9e0c('0x3'))(_0x9e0c('0x4'));var config=require(_0x9e0c('0x5'));var jayson=require(_0x9e0c('0x6'));var client=jayson[_0x9e0c('0x7')]['http']({'port':0x232a});config[_0x9e0c('0x8')]=_[_0x9e0c('0x9')](config[_0x9e0c('0x8')],{'host':_0x9e0c('0xa'),'port':0x18eb});var socket=require(_0x9e0c('0xb'))(new Redis(config[_0x9e0c('0x8')]));require(_0x9e0c('0xc'))[_0x9e0c('0xd')](socket);function respondWithRpcPromise(_0x391f79,_0x1606b4,_0x4c2e15){return new BPromise(function(_0xd0259d,_0x22537d){return client[_0x9e0c('0xe')](_0x391f79,_0x4c2e15)[_0x9e0c('0xf')](function(_0x19ef55){logger[_0x9e0c('0x10')](_0x9e0c('0x11'),_0x1606b4,_0x9e0c('0x12'));logger[_0x9e0c('0x13')](_0x9e0c('0x14'),_0x1606b4,_0x9e0c('0x12'),JSON['stringify'](_0x19ef55));if(_0x19ef55[_0x9e0c('0x15')]){if(_0x19ef55[_0x9e0c('0x15')]['code']===0x1f4){logger[_0x9e0c('0x15')](_0x9e0c('0x11'),_0x1606b4,_0x19ef55[_0x9e0c('0x15')][_0x9e0c('0x16')]);return _0x22537d(_0x19ef55[_0x9e0c('0x15')][_0x9e0c('0x16')]);}logger['error']('FaxInteraction,\x20%s,\x20%s',_0x1606b4,_0x19ef55[_0x9e0c('0x15')][_0x9e0c('0x16')]);return _0xd0259d(_0x19ef55[_0x9e0c('0x15')]['message']);}else{logger[_0x9e0c('0x10')](_0x9e0c('0x11'),_0x1606b4,_0x9e0c('0x12'));_0xd0259d(_0x19ef55[_0x9e0c('0x17')][_0x9e0c('0x16')]);}})['catch'](function(_0x1bb8a2){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x1606b4,_0x1bb8a2);_0x22537d(_0x1bb8a2);});});}exports['UpdateFaxInteraction']=function(_0x571f16){var _0x20a2f7=this;return new Promise(function(_0x5624a5,_0x40a0a){return db[_0x9e0c('0x18')][_0x9e0c('0x19')](_0x571f16[_0x9e0c('0x1a')],{'raw':_0x571f16[_0x9e0c('0x1b')]?_0x571f16['options'][_0x9e0c('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x571f16[_0x9e0c('0x1b')]?_0x571f16['options'][_0x9e0c('0x1d')]||null:null,'attributes':_0x571f16[_0x9e0c('0x1b')]?_0x571f16[_0x9e0c('0x1b')][_0x9e0c('0x1e')]||null:null,'limit':_0x571f16[_0x9e0c('0x1b')]?_0x571f16[_0x9e0c('0x1b')][_0x9e0c('0x1f')]||null:null})[_0x9e0c('0xf')](function(_0x10a8ba){logger['info']('UpdateFaxInteraction',_0x571f16);logger[_0x9e0c('0x13')](_0x9e0c('0x20'),_0x571f16,JSON['stringify'](_0x10a8ba));_0x5624a5(_0x10a8ba);})[_0x9e0c('0x21')](function(_0x3a79cf){logger[_0x9e0c('0x15')](_0x9e0c('0x20'),_0x3a79cf[_0x9e0c('0x16')],_0x571f16);_0x40a0a(_0x20a2f7[_0x9e0c('0x15')](0x1f4,_0x3a79cf[_0x9e0c('0x16')]));});});};exports[_0x9e0c('0x22')]=function(_0x5499a4){return new Promise(function(_0xedd14c,_0x28998c){return db[_0x9e0c('0x18')][_0x9e0c('0x23')]({'where':_0x5499a4['options']?_0x5499a4[_0x9e0c('0x1b')][_0x9e0c('0x1d')]||null:null})[_0x9e0c('0xf')](function(_0x57ef5b){if(_0x57ef5b){return _0x57ef5b[_0x9e0c('0x24')](_0x5499a4[_0x9e0c('0x1a')][_0x9e0c('0x25')],_[_0x9e0c('0x26')](_0x5499a4['body'],['ids','id'])||{});}})[_0x9e0c('0x27')](function(_0x28f9b5){logger[_0x9e0c('0x10')](_0x9e0c('0x28'),_0x5499a4);logger['debug'](_0x9e0c('0x28'),_0x5499a4,JSON[_0x9e0c('0x29')](_0x28f9b5));_0xedd14c(_0x28f9b5);})['catch'](function(_0x42f658){logger[_0x9e0c('0x15')]('AddTags',_0x42f658[_0x9e0c('0x16')],_0x5499a4);_0x28998c(_this[_0x9e0c('0x15')](0x1f4,_0x42f658[_0x9e0c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 6834fa7..827b551 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 _0x94fc=['update','emit','removeListener','register','length','./faxInteraction.events'];(function(_0x3c22e0,_0x1dc6ea){var _0x215811=function(_0x1b453c){while(--_0x1b453c){_0x3c22e0['push'](_0x3c22e0['shift']());}};_0x215811(++_0x1dc6ea);}(_0x94fc,0xcb));var _0xc94f=function(_0x30a30c,_0x5597c4){_0x30a30c=_0x30a30c-0x0;var _0x2455df=_0x94fc[_0x30a30c];return _0x2455df;};'use strict';var FaxInteractionEvents=require(_0xc94f('0x0'));var events=['save','remove',_0xc94f('0x1')];function createListener(_0x2fa117,_0x201b63){return function(_0x110157){_0x201b63[_0xc94f('0x2')](_0x2fa117,_0x110157);};}function removeListener(_0x118772,_0x3eec30){return function(){FaxInteractionEvents[_0xc94f('0x3')](_0x118772,_0x3eec30);};}exports[_0xc94f('0x4')]=function(_0x20586f){for(var _0x269280=0x0,_0x160d77=events[_0xc94f('0x5')];_0x269280<_0x160d77;_0x269280++){var _0x28518c=events[_0x269280];var _0x432cbd=createListener('faxInteraction:'+_0x28518c,_0x20586f);FaxInteractionEvents['on'](_0x28518c,_0x432cbd);}}; \ No newline at end of file +var _0x94a3=['register','length','./faxInteraction.events','update','emit','removeListener'];(function(_0x21595a,_0x155422){var _0x32d3ed=function(_0x1ee3df){while(--_0x1ee3df){_0x21595a['push'](_0x21595a['shift']());}};_0x32d3ed(++_0x155422);}(_0x94a3,0x92));var _0x394a=function(_0x2a0bf8,_0xb184c9){_0x2a0bf8=_0x2a0bf8-0x0;var _0x1556f4=_0x94a3[_0x2a0bf8];return _0x1556f4;};'use strict';var FaxInteractionEvents=require(_0x394a('0x0'));var events=['save','remove',_0x394a('0x1')];function createListener(_0x3d4984,_0x2db38b){return function(_0x3d1cf3){_0x2db38b[_0x394a('0x2')](_0x3d4984,_0x3d1cf3);};}function removeListener(_0x4b57c2,_0x27344a){return function(){FaxInteractionEvents[_0x394a('0x3')](_0x4b57c2,_0x27344a);};}exports[_0x394a('0x4')]=function(_0x5b898d){for(var _0x566ca5=0x0,_0xfa32f7=events[_0x394a('0x5')];_0x566ca5<_0xfa32f7;_0x566ca5++){var _0x42be01=events[_0x566ca5];var _0x281285=createListener('faxInteraction:'+_0x42be01,_0x5b898d);FaxInteractionEvents['on'](_0x42be01,_0x281285);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 80a7609..189ffb6 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 _0xc794=['/:id/download','post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','put','/:id','faxinteraction:update','delete','faxinteraction:destroy','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','isAuthenticated','get','show','/:id/messages','getMessages'];(function(_0xe51964,_0x433b90){var _0x2c2366=function(_0x1bc95c){while(--_0x1bc95c){_0xe51964['push'](_0xe51964['shift']());}};_0x2c2366(++_0x433b90);}(_0xc794,0x17b));var _0x4c79=function(_0x2eb256,_0x28d4b7){_0x2eb256=_0x2eb256-0x0;var _0x44d134=_0xc794[_0x2eb256];return _0x44d134;};'use strict';var multer=require('multer');var util=require(_0x4c79('0x0'));var path=require(_0x4c79('0x1'));var timeout=require(_0x4c79('0x2'));var express=require('express');var router=express[_0x4c79('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4c79('0x4'));var interaction=require(_0x4c79('0x5'));var config=require(_0x4c79('0x6'));var controller=require(_0x4c79('0x7'));router['get']('/',auth[_0x4c79('0x8')](),controller['index']);router['get']('/describe',auth[_0x4c79('0x8')](),controller['describe']);router[_0x4c79('0x9')]('/:id',auth[_0x4c79('0x8')](),controller[_0x4c79('0xa')]);router[_0x4c79('0x9')](_0x4c79('0xb'),auth[_0x4c79('0x8')](),controller[_0x4c79('0xc')]);router[_0x4c79('0x9')](_0x4c79('0xd'),auth[_0x4c79('0x8')](),controller['download']);router[_0x4c79('0xe')]('/',auth['isAuthenticated'](),controller[_0x4c79('0xf')]);router['post']('/:id/messages',auth[_0x4c79('0x8')](),controller[_0x4c79('0x10')]);router[_0x4c79('0xe')](_0x4c79('0x11'),auth['isAuthenticated'](),interaction[_0x4c79('0x12')](_0x4c79('0x13'),_0x4c79('0x14')),controller['addTags']);router[_0x4c79('0x15')](_0x4c79('0x16'),auth[_0x4c79('0x8')](),interaction[_0x4c79('0x12')](_0x4c79('0x13'),_0x4c79('0x17')),controller['update']);router[_0x4c79('0x18')](_0x4c79('0x16'),auth['isAuthenticated'](),interaction[_0x4c79('0x12')](_0x4c79('0x13'),_0x4c79('0x19')),controller[_0x4c79('0x1a')]);router[_0x4c79('0x18')](_0x4c79('0x11'),auth[_0x4c79('0x8')](),controller['removeTags']);module[_0x4c79('0x1b')]=router; \ No newline at end of file +var _0x7096=['index','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','/:id/tags','fax','faxinteraction:addtags','put','tracked','update','faxinteraction:destroy','delete','removeTags','exports','multer','util','path','express','Router','../../config/environment','./faxInteraction.controller','get','isAuthenticated'];(function(_0x5e08e2,_0x4929a7){var _0x13db9f=function(_0x2ee068){while(--_0x2ee068){_0x5e08e2['push'](_0x5e08e2['shift']());}};_0x13db9f(++_0x4929a7);}(_0x7096,0x1c7));var _0x6709=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x7096[_0x311c35];return _0x5cc50c;};'use strict';var multer=require(_0x6709('0x0'));var util=require(_0x6709('0x1'));var path=require(_0x6709('0x2'));var timeout=require('connect-timeout');var express=require(_0x6709('0x3'));var router=express[_0x6709('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6709('0x5'));var controller=require(_0x6709('0x6'));router[_0x6709('0x7')]('/',auth[_0x6709('0x8')](),controller[_0x6709('0x9')]);router[_0x6709('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x6709('0xa')]);router[_0x6709('0x7')](_0x6709('0xb'),auth[_0x6709('0x8')](),controller[_0x6709('0xc')]);router['get']('/:id/messages',auth[_0x6709('0x8')](),controller[_0x6709('0xd')]);router['get'](_0x6709('0xe'),auth[_0x6709('0x8')](),controller[_0x6709('0xf')]);router[_0x6709('0x10')]('/',auth['isAuthenticated'](),controller[_0x6709('0x11')]);router[_0x6709('0x10')](_0x6709('0x12'),auth[_0x6709('0x8')](),controller['addMessage']);router[_0x6709('0x10')](_0x6709('0x13'),auth[_0x6709('0x8')](),interaction['tracked'](_0x6709('0x14'),_0x6709('0x15')),controller['addTags']);router[_0x6709('0x16')](_0x6709('0xb'),auth[_0x6709('0x8')](),interaction[_0x6709('0x17')](_0x6709('0x14'),'faxinteraction:update'),controller[_0x6709('0x18')]);router['delete'](_0x6709('0xb'),auth[_0x6709('0x8')](),interaction[_0x6709('0x17')](_0x6709('0x14'),_0x6709('0x19')),controller['destroy']);router[_0x6709('0x1a')](_0x6709('0x13'),auth[_0x6709('0x8')](),controller[_0x6709('0x1b')]);module[_0x6709('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 67c9a31..0de5721 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 _0x644a=['out','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x20714a,_0x7de591){var _0x15e877=function(_0x3f9f8d){while(--_0x3f9f8d){_0x20714a['push'](_0x20714a['shift']());}};_0x15e877(++_0x7de591);}(_0x644a,0xfd));var _0xa644=function(_0x9d39e9,_0x3aebc9){_0x9d39e9=_0x9d39e9-0x0;var _0x4ac75b=_0x644a[_0x9d39e9];return _0x4ac75b;};'use strict';var Sequelize=require(_0xa644('0x0'));module[_0xa644('0x1')]={'body':{'type':Sequelize[_0xa644('0x2')](_0xa644('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xa644('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xa644('0x5')),'defaultValue':_0xa644('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xcea2=['BOOLEAN','ENUM','out','DATE','sequelize','TEXT'];(function(_0xf4b742,_0x1b62d6){var _0x53cba1=function(_0xc28d1b){while(--_0xc28d1b){_0xf4b742['push'](_0xf4b742['shift']());}};_0x53cba1(++_0x1b62d6);}(_0xcea2,0x15a));var _0x2cea=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xcea2[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require(_0x2cea('0x0'));module['exports']={'body':{'type':Sequelize[_0x2cea('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x2cea('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2cea('0x3')]('in',_0x2cea('0x4')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x2cea('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x2cea('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index e0f6397..f312f7c 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 _0xffad=['../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','stack','name','send','index','map','FaxMessage','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','params','find','catch','update','body','destroy','describe','fax-interactions','accept','fax','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','format','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','ContactId','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','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','contact','interface','SIP/%s','event','create','CmContact','findOne','Attachment','SendFax','FaxAccountId','AttachmentId','join','root','attachments','download','basename','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x2c6c8a,_0x149625){var _0x1dcb2b=function(_0x352fd8){while(--_0x352fd8){_0x2c6c8a['push'](_0x2c6c8a['shift']());}};_0x1dcb2b(++_0x149625);}(_0xffad,0x19b));var _0xdffa=function(_0x4d8673,_0x50b542){_0x4d8673=_0x4d8673-0x0;var _0xf35faa=_0xffad[_0x4d8673];return _0xf35faa;};'use strict';var emlformat=require(_0xdffa('0x0'));var rimraf=require(_0xdffa('0x1'));var zipdir=require(_0xdffa('0x2'));var jsonpatch=require(_0xdffa('0x3'));var rp=require(_0xdffa('0x4'));var moment=require(_0xdffa('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdffa('0x6'));var util=require(_0xdffa('0x7'));var path=require(_0xdffa('0x8'));var sox=require('sox');var csv=require(_0xdffa('0x9'));var ejs=require(_0xdffa('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdffa('0xb'));var squel=require('squel');var crypto=require(_0xdffa('0xc'));var jsforce=require(_0xdffa('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdffa('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdffa('0xf'));var as=require(_0xdffa('0x10'));var hardwareService=require(_0xdffa('0x11'));var logger=require(_0xdffa('0x12'))(_0xdffa('0x13'));var utils=require(_0xdffa('0x14'));var config=require(_0xdffa('0x15'));var licenseUtil=require(_0xdffa('0x16'));var db=require('../../mysqldb')['db'];config[_0xdffa('0x17')]=_[_0xdffa('0x18')](config[_0xdffa('0x17')],{'host':_0xdffa('0x19'),'port':0x18eb});var socket=require(_0xdffa('0x1a'))(new Redis(config[_0xdffa('0x17')]));require(_0xdffa('0x1b'))[_0xdffa('0x1c')](socket);var jayson=require(_0xdffa('0x1d'));var client=jayson[_0xdffa('0x1e')][_0xdffa('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0xdffa('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x529073,_0x14ae8f,_0x2ee747,_0x421a92){return new BPromise(function(_0x5cbd42,_0x205eac){var _0x412c89=_0x421a92||client;return _0x412c89[_0xdffa('0x20')](_0x529073,_0x2ee747)[_0xdffa('0x21')](function(_0x565cc5){logger[_0xdffa('0x22')]('FaxMessage,\x20%s,\x20%s',_0x14ae8f,_0xdffa('0x23'));logger[_0xdffa('0x24')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x14ae8f,_0xdffa('0x23'),JSON[_0xdffa('0x25')](_0x565cc5));if(_0x565cc5[_0xdffa('0x26')]){if(_0x565cc5[_0xdffa('0x26')][_0xdffa('0x27')]===0x1f4){logger[_0xdffa('0x26')](_0xdffa('0x28'),_0x14ae8f,_0x565cc5['error'][_0xdffa('0x29')]);return _0x205eac(_0x565cc5[_0xdffa('0x26')][_0xdffa('0x29')]);}logger[_0xdffa('0x26')](_0xdffa('0x28'),_0x14ae8f,_0x565cc5[_0xdffa('0x26')][_0xdffa('0x29')]);return _0x5cbd42(_0x565cc5[_0xdffa('0x26')]['message']);}else{logger['info'](_0xdffa('0x28'),_0x14ae8f,_0xdffa('0x23'));_0x5cbd42(_0x565cc5[_0xdffa('0x2a')][_0xdffa('0x29')]);}})['catch'](function(_0x5c8c18){logger[_0xdffa('0x26')](_0xdffa('0x28'),_0x14ae8f,_0x5c8c18);_0x205eac(_0x5c8c18);});});}function respondWithStatusCode(_0x4fc807,_0x4d396d){_0x4d396d=_0x4d396d||0xcc;return function(_0x48d02d){if(_0x48d02d){return _0x4fc807[_0xdffa('0x2b')](_0x4d396d);}return _0x4fc807[_0xdffa('0x2c')](_0x4d396d)[_0xdffa('0x2d')]();};}function respondWithResult(_0x2ab674,_0x425c14){_0x425c14=_0x425c14||0xc8;return function(_0x4fba6e){if(_0x4fba6e){return _0x2ab674['status'](_0x425c14)[_0xdffa('0x2e')](_0x4fba6e);}};}function respondWithFilteredResult(_0x28a486,_0x5f108a){return function(_0x463d4d){if(_0x463d4d){var _0x56cd70=typeof _0x5f108a[_0xdffa('0x2f')]==='undefined'&&typeof _0x5f108a['limit']===_0xdffa('0x30');var _0x1b7f07=_0x463d4d[_0xdffa('0x31')];var _0x2f7164=_0x56cd70?0x0:_0x5f108a[_0xdffa('0x2f')];var _0x1358a2=_0x56cd70?_0x463d4d['count']:_0x5f108a[_0xdffa('0x2f')]+_0x5f108a[_0xdffa('0x32')];var _0x400ffd;if(_0x1358a2>=_0x1b7f07){_0x1358a2=_0x1b7f07;_0x400ffd=0xc8;}else{_0x400ffd=0xce;}_0x28a486[_0xdffa('0x2c')](_0x400ffd);return _0x28a486[_0xdffa('0x33')]('Content-Range',_0x2f7164+'-'+_0x1358a2+'/'+_0x1b7f07)['json'](_0x463d4d);}return null;};}function patchUpdates(_0x9ec65f){return function(_0x17b5ec){try{jsonpatch[_0xdffa('0x34')](_0x17b5ec,_0x9ec65f,!![]);}catch(_0x50d8ce){return BPromise[_0xdffa('0x35')](_0x50d8ce);}return _0x17b5ec[_0xdffa('0x36')]();};}function saveUpdates(_0x242650,_0x636c53){return function(_0x14c20e){if(_0x14c20e){return _0x14c20e['update'](_0x242650)[_0xdffa('0x21')](function(_0x5f0461){return _0x5f0461;});}return null;};}function removeEntity(_0x4ac616,_0x576ed0){return function(_0xd8a023){if(_0xd8a023){return _0xd8a023['destroy']()[_0xdffa('0x21')](function(){_0x4ac616[_0xdffa('0x2c')](0xcc)[_0xdffa('0x2d')]();});}};}function handleEntityNotFound(_0x43fe36,_0x5a3a5e){return function(_0x23b6d3){if(!_0x23b6d3){_0x43fe36['sendStatus'](0x194);}return _0x23b6d3;};}function handleError(_0x44d561,_0xd2903){_0xd2903=_0xd2903||0x1f4;return function(_0xb84bf4){logger['error'](_0xb84bf4[_0xdffa('0x37')]);if(_0xb84bf4['name']){delete _0xb84bf4[_0xdffa('0x38')];}_0x44d561[_0xdffa('0x2c')](_0xd2903)[_0xdffa('0x39')](_0xb84bf4);};}exports[_0xdffa('0x3a')]=function(_0x5e3570,_0x58a834){var _0x39d286={},_0x2401ad={},_0x5cd781={'count':0x0,'rows':[]};var _0x5ced5e=_[_0xdffa('0x3b')](db[_0xdffa('0x3c')]['rawAttributes'],function(_0x567cd9){return{'name':_0x567cd9[_0xdffa('0x3d')],'type':_0x567cd9['type'][_0xdffa('0x3e')]};});_0x2401ad['model']=_[_0xdffa('0x3b')](_0x5ced5e,_0xdffa('0x38'));_0x2401ad[_0xdffa('0x3f')]=_[_0xdffa('0x40')](_0x5e3570['query']);_0x2401ad[_0xdffa('0x41')]=_[_0xdffa('0x42')](_0x2401ad[_0xdffa('0x43')],_0x2401ad[_0xdffa('0x3f')]);_0x39d286['attributes']=_[_0xdffa('0x42')](_0x2401ad[_0xdffa('0x43')],qs['fields'](_0x5e3570[_0xdffa('0x3f')][_0xdffa('0x44')]));_0x39d286[_0xdffa('0x45')]=_0x39d286['attributes'][_0xdffa('0x46')]?_0x39d286[_0xdffa('0x45')]:_0x2401ad[_0xdffa('0x43')];if(!_0x5e3570['query']['hasOwnProperty'](_0xdffa('0x47'))){_0x39d286[_0xdffa('0x32')]=qs[_0xdffa('0x32')](_0x5e3570[_0xdffa('0x3f')]['limit']);_0x39d286['offset']=qs[_0xdffa('0x2f')](_0x5e3570['query']['offset']);}_0x39d286[_0xdffa('0x48')]=qs[_0xdffa('0x49')](_0x5e3570[_0xdffa('0x3f')][_0xdffa('0x49')]);_0x39d286[_0xdffa('0x4a')]=qs[_0xdffa('0x41')](_[_0xdffa('0x4b')](_0x5e3570[_0xdffa('0x3f')],_0x2401ad[_0xdffa('0x41')]),_0x5ced5e);if(_0x5e3570['query']['filter']){_0x39d286[_0xdffa('0x4a')]=_['merge'](_0x39d286[_0xdffa('0x4a')],{'$or':_[_0xdffa('0x3b')](_0x5ced5e,function(_0x1e0167){if(_0x1e0167['type']!=='VIRTUAL'){var _0x1859a5={};_0x1859a5[_0x1e0167[_0xdffa('0x38')]]={'$like':'%'+_0x5e3570[_0xdffa('0x3f')][_0xdffa('0x4c')]+'%'};return _0x1859a5;}})});}_0x39d286=_[_0xdffa('0x4d')]({},_0x39d286,_0x5e3570[_0xdffa('0x4e')]);var _0x250260={'where':_0x39d286[_0xdffa('0x4a')]};return db[_0xdffa('0x3c')]['count'](_0x250260)[_0xdffa('0x21')](function(_0xe28b6c){_0x5cd781['count']=_0xe28b6c;if(_0x5e3570[_0xdffa('0x3f')][_0xdffa('0x4f')]){_0x39d286[_0xdffa('0x50')]=[{'all':!![]}];}return db[_0xdffa('0x3c')][_0xdffa('0x51')](_0x39d286);})['then'](function(_0xe5b60f){_0x5cd781[_0xdffa('0x52')]=_0xe5b60f;return _0x5cd781;})[_0xdffa('0x21')](respondWithFilteredResult(_0x58a834,_0x39d286))['catch'](handleError(_0x58a834,null));};exports['show']=function(_0x1bba74,_0x45599b){var _0x262faa={'raw':!![],'where':{'id':_0x1bba74[_0xdffa('0x53')]['id']}},_0x6a97e5={};_0x6a97e5[_0xdffa('0x43')]=_[_0xdffa('0x40')](db[_0xdffa('0x3c')]['rawAttributes']);_0x6a97e5[_0xdffa('0x3f')]=_[_0xdffa('0x40')](_0x1bba74[_0xdffa('0x3f')]);_0x6a97e5[_0xdffa('0x41')]=_['intersection'](_0x6a97e5[_0xdffa('0x43')],_0x6a97e5[_0xdffa('0x3f')]);_0x262faa['attributes']=_[_0xdffa('0x42')](_0x6a97e5[_0xdffa('0x43')],qs['fields'](_0x1bba74[_0xdffa('0x3f')][_0xdffa('0x44')]));_0x262faa['attributes']=_0x262faa['attributes'][_0xdffa('0x46')]?_0x262faa[_0xdffa('0x45')]:_0x6a97e5[_0xdffa('0x43')];if(_0x1bba74['query']['includeAll']){_0x262faa['include']=[{'all':!![]}];}_0x262faa=_[_0xdffa('0x4d')]({},_0x262faa,_0x1bba74[_0xdffa('0x4e')]);return db[_0xdffa('0x3c')][_0xdffa('0x54')](_0x262faa)[_0xdffa('0x21')](handleEntityNotFound(_0x45599b,null))['then'](respondWithResult(_0x45599b,null))[_0xdffa('0x55')](handleError(_0x45599b,null));};exports[_0xdffa('0x56')]=function(_0x3f0b3a,_0x4209e){if(_0x3f0b3a[_0xdffa('0x57')]['id']){delete _0x3f0b3a['body']['id'];}return db[_0xdffa('0x3c')]['find']({'where':{'id':_0x3f0b3a[_0xdffa('0x53')]['id']}})['then'](handleEntityNotFound(_0x4209e,null))[_0xdffa('0x21')](saveUpdates(_0x3f0b3a['body'],null))[_0xdffa('0x21')](respondWithResult(_0x4209e,null))[_0xdffa('0x55')](handleError(_0x4209e,null));};exports[_0xdffa('0x58')]=function(_0x4caac4,_0x8bb6fd){return db['FaxMessage'][_0xdffa('0x54')]({'where':{'id':_0x4caac4[_0xdffa('0x53')]['id']}})['then'](handleEntityNotFound(_0x8bb6fd,null))[_0xdffa('0x21')](removeEntity(_0x8bb6fd,null))['catch'](handleError(_0x8bb6fd,null));};exports[_0xdffa('0x59')]=function(_0x233744,_0x31442e){return db[_0xdffa('0x3c')][_0xdffa('0x59')]()['then'](respondWithResult(_0x31442e,null))[_0xdffa('0x55')](handleError(_0x31442e,null));};var interaction_log=require(_0xdffa('0x12'))(_0xdffa('0x5a'));exports[_0xdffa('0x5b')]=function(_0x288465,_0x36f995,_0x182061){var _0x497308={'agent':{},'channel':_0xdffa('0x5c')};if(_0x288465[_0xdffa('0x57')]['id']){delete _0x288465[_0xdffa('0x57')]['id'];}_0x288465['body'][_0xdffa('0x5d')]=!![];_0x288465[_0xdffa('0x57')][_0xdffa('0x5e')]=moment()['format'](_0xdffa('0x5f'));_0x288465[_0xdffa('0x57')]['UserId']=_0x288465[_0xdffa('0x57')][_0xdffa('0x60')]||_0x288465[_0xdffa('0x61')]['id'];_0x497308[_0xdffa('0x62')]['id']=_0x288465['body'][_0xdffa('0x60')];return db[_0xdffa('0x3c')][_0xdffa('0x54')]({'where':{'id':_0x288465[_0xdffa('0x53')]['id'],'UserId':null}})[_0xdffa('0x21')](handleEntityNotFound(_0x36f995,null))[_0xdffa('0x21')](saveUpdates(_0x288465['body'],null))[_0xdffa('0x21')](function(_0x3bcc01){if(_0x3bcc01){_0x497308[_0xdffa('0x29')]=_0x3bcc01[_0xdffa('0x63')]({'plain':!![]});return db[_0xdffa('0x64')][_0xdffa('0x54')]({'where':{'id':_0x3bcc01[_0xdffa('0x65')]}});}return null;})[_0xdffa('0x21')](handleEntityNotFound(_0x36f995,null))[_0xdffa('0x21')](function(_0x55a8a4){if(_0x55a8a4){return _0x55a8a4['update']({'UserId':_0x288465['body'][_0xdffa('0x60')],'read1stAt':_[_0xdffa('0x66')](_0x55a8a4[_0xdffa('0x67')])?moment()[_0xdffa('0x68')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xdffa('0x21')](function(_0x28af66){if(_0x28af66){_0x497308[_0xdffa('0x69')]=_0x28af66['get']({'plain':!![]});interaction_log[_0xdffa('0x22')](_0xdffa('0x6a'),_0x288465[_0xdffa('0x61')]['id'],_0x288465['user'][_0xdffa('0x38')],_0x288465[_0xdffa('0x61')][_0xdffa('0x6b')],_0x497308['interaction']['id'],_0x288465['body']?JSON[_0xdffa('0x25')](_0x288465[_0xdffa('0x57')]):_0xdffa('0x6c'));return respondWithRpcPromise(_0xdffa('0x6d'),_0xdffa('0x6e'),_0x497308);}return null;})[_0xdffa('0x21')](function(_0xd268ca){var _0x4d7994='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xd268ca[_0xdffa('0x29')][_0xdffa('0x6f')];return db['sequelize']['query'](_0x4d7994,{'type':db[_0xdffa('0x70')][_0xdffa('0x71')][_0xdffa('0x72')],'raw':!![]})[_0xdffa('0x21')](function(_0x27a8bf){return _0x27a8bf;});})[_0xdffa('0x21')](function(_0x366fe4){if(_0x366fe4){_0x497308['message']['contact']=_0x366fe4[0x0];if(!_0x288465[_0xdffa('0x57')][_0xdffa('0x60')])return;return db[_0xdffa('0x73')][_0xdffa('0x54')]({'where':{'id':_0x288465[_0xdffa('0x57')][_0xdffa('0x60')],'role':_0xdffa('0x62')},'attributes':['id','name',_0xdffa('0x74'),_0xdffa('0x75'),_0xdffa('0x76')],'raw':!![]});}return null;})['then'](function(_0x10eb5c){if(!_0x10eb5c)return null;_0x497308[_0xdffa('0x29')][_0xdffa('0x62')]=_0x10eb5c;return _0x497308;})['then'](function(_0xd47c2f){if(_0xd47c2f){if(_0x288465[_0xdffa('0x57')][_0xdffa('0x77')]){_0x497308[_0xdffa('0x29')]['interface']=util[_0xdffa('0x68')]('SIP/%s',_0x288465['user'][_0xdffa('0x38')]);_0x497308['message'][_0xdffa('0x78')]=_0x497308[_0xdffa('0x78')];_0x497308['message'][_0xdffa('0x79')]=_0x497308[_0xdffa('0x78')];_0x497308['message']['event']=_0xdffa('0x5b');return respondWithRpcPromise(_0xdffa('0x7a'),_0xdffa('0x7a'),{'event':'acceptmessage','message':_0x497308[_0xdffa('0x29')]},client9002)[_0xdffa('0x21')](function(){return _0x497308;});}return _0x497308;}return null;})[_0xdffa('0x21')](respondWithResult(_0x36f995,null))[_0xdffa('0x55')](handleError(_0x36f995,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports['reject']=function(_0x44d058,_0x4ea379,_0x49d38b){var _0x7c12f4={'agent':{},'channel':_0xdffa('0x5c')};if(_0x44d058[_0xdffa('0x57')]['id']){delete _0x44d058[_0xdffa('0x57')]['id'];}_0x44d058[_0xdffa('0x57')][_0xdffa('0x60')]=_0x44d058[_0xdffa('0x57')][_0xdffa('0x60')]||_0x44d058[_0xdffa('0x61')]['id'];_0x7c12f4[_0xdffa('0x62')]['id']=_0x44d058[_0xdffa('0x57')][_0xdffa('0x60')];return db[_0xdffa('0x3c')][_0xdffa('0x54')]({'where':{'id':_0x44d058[_0xdffa('0x53')]['id'],'UserId':null}})[_0xdffa('0x21')](handleEntityNotFound(_0x4ea379,null))[_0xdffa('0x21')](function(_0x123c26){if(_0x123c26){_0x7c12f4[_0xdffa('0x29')]=_0x123c26[_0xdffa('0x63')]({'plain':!![]});return db[_0xdffa('0x64')]['find']({'where':{'id':_0x123c26[_0xdffa('0x65')]}});}return null;})[_0xdffa('0x21')](handleEntityNotFound(_0x4ea379,null))['then'](function(_0x3bcb3e){if(_0x3bcb3e){_0x7c12f4['interaction']=_0x3bcb3e[_0xdffa('0x63')]({'plain':!![]});interaction_log[_0xdffa('0x22')](_0xdffa('0x7b'),_0x44d058[_0xdffa('0x61')]['id'],_0x44d058[_0xdffa('0x61')][_0xdffa('0x38')],_0x44d058[_0xdffa('0x61')][_0xdffa('0x6b')],_0x7c12f4[_0xdffa('0x69')]['id'],_0x44d058[_0xdffa('0x57')]?JSON[_0xdffa('0x25')](_0x44d058['body']):_0xdffa('0x6c'));return respondWithRpcPromise(_0xdffa('0x7c'),_0xdffa('0x7d'),_0x7c12f4);}return null;})[_0xdffa('0x21')](function(_0xbf71c4){var _0x58c38a=_0xdffa('0x7e')+_0xbf71c4['message'][_0xdffa('0x6f')];return db[_0xdffa('0x7f')]['query'](_0x58c38a,{'type':db['Sequelize'][_0xdffa('0x71')][_0xdffa('0x72')],'raw':!![]})[_0xdffa('0x21')](function(_0x2f3aac){return _0x2f3aac;});})[_0xdffa('0x21')](function(_0x31c62d){if(_0x31c62d){_0x7c12f4[_0xdffa('0x29')][_0xdffa('0x80')]=_0x31c62d[0x0];if(!_0x44d058[_0xdffa('0x57')][_0xdffa('0x60')])return;return db[_0xdffa('0x73')][_0xdffa('0x54')]({'where':{'id':_0x44d058[_0xdffa('0x57')][_0xdffa('0x60')],'role':_0xdffa('0x62')},'attributes':['id','name','fullname',_0xdffa('0x75'),'internal'],'raw':!![]});}return null;})['then'](function(_0x3ce235){if(!_0x3ce235)return null;_0x7c12f4[_0xdffa('0x29')][_0xdffa('0x62')]=_0x3ce235;return _0x7c12f4;})[_0xdffa('0x21')](function(_0x504afa){if(_0x504afa){_0x504afa[_0xdffa('0x29')][_0xdffa('0x81')]=util[_0xdffa('0x68')](_0xdffa('0x82'),_0x44d058[_0xdffa('0x61')][_0xdffa('0x38')]);_0x504afa[_0xdffa('0x29')][_0xdffa('0x78')]=_0x7c12f4[_0xdffa('0x78')];_0x504afa['message']['motionChannel']=_0x7c12f4[_0xdffa('0x78')];_0x504afa['message'][_0xdffa('0x83')]=_0xdffa('0x35');respondWithRpcPromise('EventManager',_0xdffa('0x7a'),{'event':'rejectmessage','message':_0x504afa[_0xdffa('0x29')]},client9002);return _0x7c12f4;}return null;})[_0xdffa('0x21')](respondWithResult(_0x4ea379,null))['catch'](handleError(_0x4ea379,null));};exports['create']=function(_0x5a9bc5,_0x2ddb88){var _0x59ccf8;return db['FaxMessage'][_0xdffa('0x84')](_0x5a9bc5[_0xdffa('0x57')],{})['then'](function(_0xd430e7){_0x59ccf8=_0xd430e7;return db[_0xdffa('0x85')][_0xdffa('0x86')]({'where':{'id':_0x59ccf8['ContactId']}});})['then'](function(_0x2d0a86){if(_['isNil'](_0x2d0a86)){return;}else{_0x59ccf8[_0xdffa('0x5c')]=_0x2d0a86[_0xdffa('0x5c')];return db[_0xdffa('0x87')][_0xdffa('0x86')]({'where':{'id':_0x59ccf8['AttachmentId']}});}})[_0xdffa('0x21')](function(_0x20ca13){return respondWithRpcPromise(_0xdffa('0x88'),_0xdffa('0x88'),{'FaxAccountId':_[_0xdffa('0x66')](_0x5a9bc5[_0xdffa('0x57')])?undefined:_0x5a9bc5[_0xdffa('0x57')][_0xdffa('0x89')],'path':_[_0xdffa('0x66')](_0x20ca13)?undefined:util[_0xdffa('0x68')]('/var/opt/motion2/server/files/attachments/%s',_0x20ca13['basename']),'fax':_[_0xdffa('0x66')](_0x59ccf8[_0xdffa('0x5c')])?undefined:_0x59ccf8[_0xdffa('0x5c')],'AttachmentId':_0x59ccf8[_0xdffa('0x8a')]},client9002);})[_0xdffa('0x21')](respondWithResult(_0x2ddb88,0xc9))['catch'](handleError(_0x2ddb88,null));};exports['download']=function(_0x476f52,_0x32ea1b){var _0x186d8f=path[_0xdffa('0x8b')](config[_0xdffa('0x8c')],'server','files',_0xdffa('0x8d'));return db['FaxMessage'][_0xdffa('0x54')]({'where':{'id':_0x476f52['params']['id']},'include':[{'model':db['Attachment'],'as':_0xdffa('0x87')}]})['then'](handleEntityNotFound(_0x32ea1b,null))['then'](function(_0x3cf392){if(_0x3cf392){return _0x32ea1b[_0xdffa('0x8e')](path[_0xdffa('0x8b')](_0x186d8f,_0x3cf392[_0xdffa('0x87')][_0xdffa('0x8f')]));}})[_0xdffa('0x55')](handleError(_0x32ea1b,null));}; \ No newline at end of file +var _0x0558=['channel','motionChannel','event','accept','EventManager','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','sequelize','User','internal','interface','SIP/%s','create','findOne','fax','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','attachments','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','./faxMessage.socket','client','http','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','name','index','map','FaxMessage','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','rows','show','keys','find','update','body','destroy','params','describe','fax-interactions','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','format','interaction','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','contact','fullname','email','manual'];(function(_0x4191bc,_0x3096c5){var _0x1ffd4e=function(_0x36faed){while(--_0x36faed){_0x4191bc['push'](_0x4191bc['shift']());}};_0x1ffd4e(++_0x3096c5);}(_0x0558,0x1c4));var _0x8055=function(_0x536068,_0x3de52c){_0x536068=_0x536068-0x0;var _0x4a5db2=_0x0558[_0x536068];return _0x4a5db2;};'use strict';var emlformat=require(_0x8055('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8055('0x1'));var jsonpatch=require(_0x8055('0x2'));var rp=require('request-promise');var moment=require(_0x8055('0x3'));var BPromise=require(_0x8055('0x4'));var Mustache=require(_0x8055('0x5'));var util=require(_0x8055('0x6'));var path=require(_0x8055('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8055('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8055('0x9'));var squel=require(_0x8055('0xa'));var crypto=require(_0x8055('0xb'));var jsforce=require(_0x8055('0xc'));var deskjs=require(_0x8055('0xd'));var toCsv=require(_0x8055('0xe'));var querystring=require('querystring');var Papa=require(_0x8055('0xf'));var Redis=require(_0x8055('0x10'));var authService=require(_0x8055('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8055('0x12'));var hardwareService=require(_0x8055('0x13'));var logger=require(_0x8055('0x14'))(_0x8055('0x15'));var utils=require(_0x8055('0x16'));var config=require(_0x8055('0x17'));var licenseUtil=require(_0x8055('0x18'));var db=require('../../mysqldb')['db'];config[_0x8055('0x19')]=_['defaults'](config[_0x8055('0x19')],{'host':_0x8055('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8055('0x19')]));require(_0x8055('0x1b'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x8055('0x1c')][_0x8055('0x1d')]({'port':0x232c});var client9002=jayson[_0x8055('0x1c')][_0x8055('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x1cefc4,_0x492271,_0x1392f0,_0x1475c4){return new BPromise(function(_0x3e3072,_0x475d35){var _0x42c8bd=_0x1475c4||client;return _0x42c8bd[_0x8055('0x1e')](_0x1cefc4,_0x1392f0)[_0x8055('0x1f')](function(_0x788ae0){logger['info'](_0x8055('0x20'),_0x492271,_0x8055('0x21'));logger[_0x8055('0x22')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x492271,_0x8055('0x21'),JSON[_0x8055('0x23')](_0x788ae0));if(_0x788ae0['error']){if(_0x788ae0[_0x8055('0x24')][_0x8055('0x25')]===0x1f4){logger[_0x8055('0x24')]('FaxMessage,\x20%s,\x20%s',_0x492271,_0x788ae0[_0x8055('0x24')][_0x8055('0x26')]);return _0x475d35(_0x788ae0[_0x8055('0x24')][_0x8055('0x26')]);}logger['error'](_0x8055('0x20'),_0x492271,_0x788ae0[_0x8055('0x24')][_0x8055('0x26')]);return _0x3e3072(_0x788ae0['error'][_0x8055('0x26')]);}else{logger[_0x8055('0x27')](_0x8055('0x20'),_0x492271,_0x8055('0x21'));_0x3e3072(_0x788ae0[_0x8055('0x28')][_0x8055('0x26')]);}})[_0x8055('0x29')](function(_0x41f09d){logger[_0x8055('0x24')]('FaxMessage,\x20%s,\x20%s',_0x492271,_0x41f09d);_0x475d35(_0x41f09d);});});}function respondWithStatusCode(_0x112096,_0x17fb98){_0x17fb98=_0x17fb98||0xcc;return function(_0x12db51){if(_0x12db51){return _0x112096[_0x8055('0x2a')](_0x17fb98);}return _0x112096[_0x8055('0x2b')](_0x17fb98)[_0x8055('0x2c')]();};}function respondWithResult(_0x4e1abc,_0x2bdfab){_0x2bdfab=_0x2bdfab||0xc8;return function(_0x2f502c){if(_0x2f502c){return _0x4e1abc[_0x8055('0x2b')](_0x2bdfab)[_0x8055('0x2d')](_0x2f502c);}};}function respondWithFilteredResult(_0x53ccaf,_0x377de5){return function(_0x376f69){if(_0x376f69){var _0x58306c=typeof _0x377de5['offset']===_0x8055('0x2e')&&typeof _0x377de5[_0x8055('0x2f')]==='undefined';var _0x126ea1=_0x376f69[_0x8055('0x30')];var _0x46b871=_0x58306c?0x0:_0x377de5[_0x8055('0x31')];var _0x5176b7=_0x58306c?_0x376f69[_0x8055('0x30')]:_0x377de5[_0x8055('0x31')]+_0x377de5[_0x8055('0x2f')];var _0x319b32;if(_0x5176b7>=_0x126ea1){_0x5176b7=_0x126ea1;_0x319b32=0xc8;}else{_0x319b32=0xce;}_0x53ccaf[_0x8055('0x2b')](_0x319b32);return _0x53ccaf['set']('Content-Range',_0x46b871+'-'+_0x5176b7+'/'+_0x126ea1)[_0x8055('0x2d')](_0x376f69);}return null;};}function patchUpdates(_0x18fda0){return function(_0x21c347){try{jsonpatch[_0x8055('0x32')](_0x21c347,_0x18fda0,!![]);}catch(_0x4bc092){return BPromise[_0x8055('0x33')](_0x4bc092);}return _0x21c347[_0x8055('0x34')]();};}function saveUpdates(_0x2a4295,_0x484464){return function(_0x330ac4){if(_0x330ac4){return _0x330ac4['update'](_0x2a4295)[_0x8055('0x1f')](function(_0x5697e2){return _0x5697e2;});}return null;};}function removeEntity(_0x4b48f0,_0xb744fd){return function(_0x266cf8){if(_0x266cf8){return _0x266cf8['destroy']()['then'](function(){_0x4b48f0[_0x8055('0x2b')](0xcc)[_0x8055('0x2c')]();});}};}function handleEntityNotFound(_0x2920b7,_0x42f589){return function(_0x3ec7e8){if(!_0x3ec7e8){_0x2920b7['sendStatus'](0x194);}return _0x3ec7e8;};}function handleError(_0x197ab0,_0xa11ee8){_0xa11ee8=_0xa11ee8||0x1f4;return function(_0x25090b){logger['error'](_0x25090b['stack']);if(_0x25090b[_0x8055('0x35')]){delete _0x25090b[_0x8055('0x35')];}_0x197ab0['status'](_0xa11ee8)['send'](_0x25090b);};}exports[_0x8055('0x36')]=function(_0x3b0bb0,_0x4edda9){var _0x20a697={},_0x5a32c6={},_0x5bbd29={'count':0x0,'rows':[]};var _0x265629=_[_0x8055('0x37')](db[_0x8055('0x38')][_0x8055('0x39')],function(_0x222796){return{'name':_0x222796[_0x8055('0x3a')],'type':_0x222796['type'][_0x8055('0x3b')]};});_0x5a32c6[_0x8055('0x3c')]=_[_0x8055('0x37')](_0x265629,_0x8055('0x35'));_0x5a32c6[_0x8055('0x3d')]=_['keys'](_0x3b0bb0[_0x8055('0x3d')]);_0x5a32c6[_0x8055('0x3e')]=_[_0x8055('0x3f')](_0x5a32c6['model'],_0x5a32c6[_0x8055('0x3d')]);_0x20a697['attributes']=_['intersection'](_0x5a32c6['model'],qs[_0x8055('0x40')](_0x3b0bb0[_0x8055('0x3d')][_0x8055('0x40')]));_0x20a697['attributes']=_0x20a697[_0x8055('0x41')][_0x8055('0x42')]?_0x20a697[_0x8055('0x41')]:_0x5a32c6[_0x8055('0x3c')];if(!_0x3b0bb0['query'][_0x8055('0x43')](_0x8055('0x44'))){_0x20a697[_0x8055('0x2f')]=qs[_0x8055('0x2f')](_0x3b0bb0[_0x8055('0x3d')]['limit']);_0x20a697['offset']=qs[_0x8055('0x31')](_0x3b0bb0[_0x8055('0x3d')][_0x8055('0x31')]);}_0x20a697['order']=qs[_0x8055('0x45')](_0x3b0bb0['query'][_0x8055('0x45')]);_0x20a697[_0x8055('0x46')]=qs['filters'](_[_0x8055('0x47')](_0x3b0bb0[_0x8055('0x3d')],_0x5a32c6['filters']),_0x265629);if(_0x3b0bb0[_0x8055('0x3d')][_0x8055('0x48')]){_0x20a697['where']=_['merge'](_0x20a697['where'],{'$or':_[_0x8055('0x37')](_0x265629,function(_0x59e243){if(_0x59e243[_0x8055('0x49')]!==_0x8055('0x4a')){var _0x3b5c19={};_0x3b5c19[_0x59e243[_0x8055('0x35')]]={'$like':'%'+_0x3b0bb0['query']['filter']+'%'};return _0x3b5c19;}})});}_0x20a697=_[_0x8055('0x4b')]({},_0x20a697,_0x3b0bb0[_0x8055('0x4c')]);var _0x515895={'where':_0x20a697[_0x8055('0x46')]};return db['FaxMessage']['count'](_0x515895)[_0x8055('0x1f')](function(_0x380510){_0x5bbd29[_0x8055('0x30')]=_0x380510;if(_0x3b0bb0[_0x8055('0x3d')][_0x8055('0x4d')]){_0x20a697[_0x8055('0x4e')]=[{'all':!![]}];}return db[_0x8055('0x38')]['findAll'](_0x20a697);})[_0x8055('0x1f')](function(_0x53001b){_0x5bbd29[_0x8055('0x4f')]=_0x53001b;return _0x5bbd29;})[_0x8055('0x1f')](respondWithFilteredResult(_0x4edda9,_0x20a697))['catch'](handleError(_0x4edda9,null));};exports[_0x8055('0x50')]=function(_0x565a9c,_0x462a34){var _0x52d2e8={'raw':!![],'where':{'id':_0x565a9c['params']['id']}},_0x5cb3d2={};_0x5cb3d2[_0x8055('0x3c')]=_[_0x8055('0x51')](db[_0x8055('0x38')][_0x8055('0x39')]);_0x5cb3d2[_0x8055('0x3d')]=_[_0x8055('0x51')](_0x565a9c[_0x8055('0x3d')]);_0x5cb3d2[_0x8055('0x3e')]=_['intersection'](_0x5cb3d2['model'],_0x5cb3d2[_0x8055('0x3d')]);_0x52d2e8[_0x8055('0x41')]=_[_0x8055('0x3f')](_0x5cb3d2[_0x8055('0x3c')],qs[_0x8055('0x40')](_0x565a9c['query']['fields']));_0x52d2e8[_0x8055('0x41')]=_0x52d2e8['attributes']['length']?_0x52d2e8[_0x8055('0x41')]:_0x5cb3d2['model'];if(_0x565a9c[_0x8055('0x3d')][_0x8055('0x4d')]){_0x52d2e8[_0x8055('0x4e')]=[{'all':!![]}];}_0x52d2e8=_['merge']({},_0x52d2e8,_0x565a9c[_0x8055('0x4c')]);return db['FaxMessage'][_0x8055('0x52')](_0x52d2e8)['then'](handleEntityNotFound(_0x462a34,null))[_0x8055('0x1f')](respondWithResult(_0x462a34,null))[_0x8055('0x29')](handleError(_0x462a34,null));};exports[_0x8055('0x53')]=function(_0x180185,_0xf8c148){if(_0x180185[_0x8055('0x54')]['id']){delete _0x180185[_0x8055('0x54')]['id'];}return db['FaxMessage'][_0x8055('0x52')]({'where':{'id':_0x180185['params']['id']}})[_0x8055('0x1f')](handleEntityNotFound(_0xf8c148,null))[_0x8055('0x1f')](saveUpdates(_0x180185[_0x8055('0x54')],null))[_0x8055('0x1f')](respondWithResult(_0xf8c148,null))[_0x8055('0x29')](handleError(_0xf8c148,null));};exports[_0x8055('0x55')]=function(_0x46133b,_0x219c21){return db[_0x8055('0x38')][_0x8055('0x52')]({'where':{'id':_0x46133b[_0x8055('0x56')]['id']}})[_0x8055('0x1f')](handleEntityNotFound(_0x219c21,null))[_0x8055('0x1f')](removeEntity(_0x219c21,null))['catch'](handleError(_0x219c21,null));};exports[_0x8055('0x57')]=function(_0x56778a,_0x52f8bf){return db[_0x8055('0x38')][_0x8055('0x57')]()[_0x8055('0x1f')](respondWithResult(_0x52f8bf,null))[_0x8055('0x29')](handleError(_0x52f8bf,null));};var interaction_log=require(_0x8055('0x14'))(_0x8055('0x58'));exports['accept']=function(_0x3d43a1,_0x2c68f5,_0x439b5d){var _0x3e5dec={'agent':{},'channel':'fax'};if(_0x3d43a1['body']['id']){delete _0x3d43a1[_0x8055('0x54')]['id'];}_0x3d43a1[_0x8055('0x54')][_0x8055('0x59')]=!![];_0x3d43a1[_0x8055('0x54')]['readAt']=moment()['format'](_0x8055('0x5a'));_0x3d43a1[_0x8055('0x54')][_0x8055('0x5b')]=_0x3d43a1[_0x8055('0x54')][_0x8055('0x5b')]||_0x3d43a1[_0x8055('0x5c')]['id'];_0x3e5dec[_0x8055('0x5d')]['id']=_0x3d43a1[_0x8055('0x54')]['UserId'];return db[_0x8055('0x38')]['find']({'where':{'id':_0x3d43a1[_0x8055('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2c68f5,null))['then'](saveUpdates(_0x3d43a1[_0x8055('0x54')],null))[_0x8055('0x1f')](function(_0x48998e){if(_0x48998e){_0x3e5dec['message']=_0x48998e[_0x8055('0x5e')]({'plain':!![]});return db[_0x8055('0x5f')]['find']({'where':{'id':_0x48998e[_0x8055('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x2c68f5,null))[_0x8055('0x1f')](function(_0x2636b7){if(_0x2636b7){return _0x2636b7[_0x8055('0x53')]({'UserId':_0x3d43a1[_0x8055('0x54')][_0x8055('0x5b')],'read1stAt':_[_0x8055('0x61')](_0x2636b7[_0x8055('0x62')])?moment()[_0x8055('0x63')](_0x8055('0x5a')):undefined});}return null;})[_0x8055('0x1f')](function(_0x1adaf2){if(_0x1adaf2){_0x3e5dec[_0x8055('0x64')]=_0x1adaf2[_0x8055('0x5e')]({'plain':!![]});interaction_log[_0x8055('0x27')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3d43a1['user']['id'],_0x3d43a1[_0x8055('0x5c')]['name'],_0x3d43a1[_0x8055('0x5c')][_0x8055('0x65')],_0x3e5dec['interaction']['id'],_0x3d43a1[_0x8055('0x54')]?JSON[_0x8055('0x23')](_0x3d43a1[_0x8055('0x54')]):_0x8055('0x66'));return respondWithRpcPromise('AcceptMessage',_0x8055('0x67'),_0x3e5dec);}return null;})[_0x8055('0x1f')](function(_0x12fc2b){var _0x15b616=_0x8055('0x68')+_0x12fc2b['message']['ContactId'];return db['sequelize']['query'](_0x15b616,{'type':db[_0x8055('0x69')][_0x8055('0x6a')][_0x8055('0x6b')],'raw':!![]})[_0x8055('0x1f')](function(_0x3f67dc){return _0x3f67dc;});})[_0x8055('0x1f')](function(_0x5220fc){if(_0x5220fc){_0x3e5dec[_0x8055('0x26')][_0x8055('0x6c')]=_0x5220fc[0x0];if(!_0x3d43a1[_0x8055('0x54')]['UserId'])return;return db['User']['find']({'where':{'id':_0x3d43a1[_0x8055('0x54')][_0x8055('0x5b')],'role':_0x8055('0x5d')},'attributes':['id',_0x8055('0x35'),_0x8055('0x6d'),_0x8055('0x6e'),'internal'],'raw':!![]});}return null;})[_0x8055('0x1f')](function(_0x525bc7){if(!_0x525bc7)return null;_0x3e5dec[_0x8055('0x26')][_0x8055('0x5d')]=_0x525bc7;return _0x3e5dec;})[_0x8055('0x1f')](function(_0x381e68){if(_0x381e68){if(_0x3d43a1[_0x8055('0x54')][_0x8055('0x6f')]){_0x3e5dec[_0x8055('0x26')]['interface']=util[_0x8055('0x63')]('SIP/%s',_0x3d43a1[_0x8055('0x5c')][_0x8055('0x35')]);_0x3e5dec[_0x8055('0x26')]['channel']=_0x3e5dec[_0x8055('0x70')];_0x3e5dec['message'][_0x8055('0x71')]=_0x3e5dec[_0x8055('0x70')];_0x3e5dec[_0x8055('0x26')][_0x8055('0x72')]=_0x8055('0x73');return respondWithRpcPromise(_0x8055('0x74'),_0x8055('0x74'),{'event':'acceptmessage','message':_0x3e5dec['message']},client9002)[_0x8055('0x1f')](function(){return _0x3e5dec;});}return _0x3e5dec;}return null;})[_0x8055('0x1f')](respondWithResult(_0x2c68f5,null))[_0x8055('0x29')](handleError(_0x2c68f5,null));};var interaction_log=require(_0x8055('0x14'))(_0x8055('0x58'));exports[_0x8055('0x33')]=function(_0x531d4a,_0x40f03f,_0x33797f){var _0x1a749e={'agent':{},'channel':'fax'};if(_0x531d4a[_0x8055('0x54')]['id']){delete _0x531d4a[_0x8055('0x54')]['id'];}_0x531d4a[_0x8055('0x54')][_0x8055('0x5b')]=_0x531d4a['body'][_0x8055('0x5b')]||_0x531d4a[_0x8055('0x5c')]['id'];_0x1a749e[_0x8055('0x5d')]['id']=_0x531d4a[_0x8055('0x54')][_0x8055('0x5b')];return db['FaxMessage'][_0x8055('0x52')]({'where':{'id':_0x531d4a[_0x8055('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x40f03f,null))[_0x8055('0x1f')](function(_0x95b0c1){if(_0x95b0c1){_0x1a749e[_0x8055('0x26')]=_0x95b0c1[_0x8055('0x5e')]({'plain':!![]});return db[_0x8055('0x5f')][_0x8055('0x52')]({'where':{'id':_0x95b0c1[_0x8055('0x60')]}});}return null;})[_0x8055('0x1f')](handleEntityNotFound(_0x40f03f,null))['then'](function(_0x561bf7){if(_0x561bf7){_0x1a749e['interaction']=_0x561bf7[_0x8055('0x5e')]({'plain':!![]});interaction_log['info'](_0x8055('0x75'),_0x531d4a[_0x8055('0x5c')]['id'],_0x531d4a['user'][_0x8055('0x35')],_0x531d4a[_0x8055('0x5c')][_0x8055('0x65')],_0x1a749e['interaction']['id'],_0x531d4a[_0x8055('0x54')]?JSON[_0x8055('0x23')](_0x531d4a['body']):_0x8055('0x66'));return respondWithRpcPromise(_0x8055('0x76'),_0x8055('0x77'),_0x1a749e);}return null;})[_0x8055('0x1f')](function(_0x5b9791){var _0x60f196='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5b9791[_0x8055('0x26')][_0x8055('0x78')];return db[_0x8055('0x79')][_0x8055('0x3d')](_0x60f196,{'type':db[_0x8055('0x69')][_0x8055('0x6a')][_0x8055('0x6b')],'raw':!![]})[_0x8055('0x1f')](function(_0x82d81a){return _0x82d81a;});})[_0x8055('0x1f')](function(_0x2f1df8){if(_0x2f1df8){_0x1a749e[_0x8055('0x26')][_0x8055('0x6c')]=_0x2f1df8[0x0];if(!_0x531d4a['body'][_0x8055('0x5b')])return;return db[_0x8055('0x7a')][_0x8055('0x52')]({'where':{'id':_0x531d4a['body'][_0x8055('0x5b')],'role':_0x8055('0x5d')},'attributes':['id',_0x8055('0x35'),_0x8055('0x6d'),_0x8055('0x6e'),_0x8055('0x7b')],'raw':!![]});}return null;})['then'](function(_0x5676e6){if(!_0x5676e6)return null;_0x1a749e['message'][_0x8055('0x5d')]=_0x5676e6;return _0x1a749e;})[_0x8055('0x1f')](function(_0x45df20){if(_0x45df20){_0x45df20[_0x8055('0x26')][_0x8055('0x7c')]=util[_0x8055('0x63')](_0x8055('0x7d'),_0x531d4a[_0x8055('0x5c')][_0x8055('0x35')]);_0x45df20[_0x8055('0x26')][_0x8055('0x70')]=_0x1a749e[_0x8055('0x70')];_0x45df20[_0x8055('0x26')][_0x8055('0x71')]=_0x1a749e[_0x8055('0x70')];_0x45df20[_0x8055('0x26')][_0x8055('0x72')]=_0x8055('0x33');respondWithRpcPromise(_0x8055('0x74'),_0x8055('0x74'),{'event':'rejectmessage','message':_0x45df20[_0x8055('0x26')]},client9002);return _0x1a749e;}return null;})[_0x8055('0x1f')](respondWithResult(_0x40f03f,null))[_0x8055('0x29')](handleError(_0x40f03f,null));};exports[_0x8055('0x7e')]=function(_0x1f3973,_0x4a020b){var _0xd68df9;return db['FaxMessage']['create'](_0x1f3973['body'],{})['then'](function(_0x1c7263){_0xd68df9=_0x1c7263;return db['CmContact'][_0x8055('0x7f')]({'where':{'id':_0xd68df9[_0x8055('0x78')]}});})[_0x8055('0x1f')](function(_0x47f2cc){if(_[_0x8055('0x61')](_0x47f2cc)){return;}else{_0xd68df9['fax']=_0x47f2cc[_0x8055('0x80')];return db[_0x8055('0x81')][_0x8055('0x7f')]({'where':{'id':_0xd68df9[_0x8055('0x82')]}});}})['then'](function(_0x54ef0b){return respondWithRpcPromise(_0x8055('0x83'),'SendFax',{'FaxAccountId':_['isNil'](_0x1f3973[_0x8055('0x54')])?undefined:_0x1f3973[_0x8055('0x54')][_0x8055('0x84')],'path':_['isNil'](_0x54ef0b)?undefined:util[_0x8055('0x63')](_0x8055('0x85'),_0x54ef0b[_0x8055('0x86')]),'fax':_[_0x8055('0x61')](_0xd68df9[_0x8055('0x80')])?undefined:_0xd68df9[_0x8055('0x80')],'AttachmentId':_0xd68df9['AttachmentId']},client9002);})[_0x8055('0x1f')](respondWithResult(_0x4a020b,0xc9))[_0x8055('0x29')](handleError(_0x4a020b,null));};exports[_0x8055('0x87')]=function(_0x3e0932,_0xca35a1){var _0x3b2c97=path[_0x8055('0x88')](config[_0x8055('0x89')],_0x8055('0x8a'),_0x8055('0x8b'),_0x8055('0x8c'));return db[_0x8055('0x38')][_0x8055('0x52')]({'where':{'id':_0x3e0932[_0x8055('0x56')]['id']},'include':[{'model':db[_0x8055('0x81')],'as':'Attachment'}]})[_0x8055('0x1f')](handleEntityNotFound(_0xca35a1,null))['then'](function(_0x666255){if(_0x666255){return _0xca35a1[_0x8055('0x87')](path[_0x8055('0x88')](_0x3b2c97,_0x666255[_0x8055('0x81')][_0x8055('0x86')]));}})[_0x8055('0x29')](handleError(_0xca35a1,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 97d3783..c57d4dd 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 _0x1623=['emit','hasOwnProperty','exports','events','setMaxListeners','save','update','remove'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x1623,0xab));var _0x3162=function(_0x47a0f2,_0x37abcb){_0x47a0f2=_0x47a0f2-0x0;var _0x4098a9=_0x1623[_0x47a0f2];return _0x4098a9;};'use strict';var EventEmitter=require(_0x3162('0x0'));var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x3162('0x1')](0x0);var events={'afterCreate':_0x3162('0x2'),'afterUpdate':_0x3162('0x3'),'afterDestroy':_0x3162('0x4')};function emitEvent(_0x428dd7){return function(_0x4ce2bd,_0x5d49d0,_0x7a4559){FaxMessageEvents['emit'](_0x428dd7+':'+_0x4ce2bd['id'],_0x4ce2bd);FaxMessageEvents[_0x3162('0x5')](_0x428dd7,_0x4ce2bd);_0x7a4559(null);};}for(var e in events){if(events[_0x3162('0x6')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x3162('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0x1410=['FaxMessage','setMaxListeners','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x1410,0x130));var _0x0141=function(_0x9472f6,_0x46fbaa){_0x9472f6=_0x9472f6-0x0;var _0x32802d=_0x1410[_0x9472f6];return _0x32802d;};'use strict';var EventEmitter=require(_0x0141('0x0'));var FaxMessage=require(_0x0141('0x1'))['db'][_0x0141('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x0141('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0141('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3c3422){return function(_0x5d2855,_0x194c72,_0x454af1){FaxMessageEvents[_0x0141('0x5')](_0x3c3422+':'+_0x5d2855['id'],_0x5d2855);FaxMessageEvents[_0x0141('0x5')](_0x3c3422,_0x5d2855);_0x454af1(null);};}for(var e in events){if(events[_0x0141('0x6')](e)){var event=events[e];FaxMessage[_0x0141('0x7')](e,emitEvent(event));}}module[_0x0141('0x8')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index e314f46..aa7f81c 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 _0x0486=['FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','models','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','findOne'];(function(_0x4b185e,_0x31c299){var _0x558b84=function(_0x5aa4d5){while(--_0x5aa4d5){_0x4b185e['push'](_0x4b185e['shift']());}};_0x558b84(++_0x31c299);}(_0x0486,0x131));var _0x6048=function(_0x56c70f,_0x4e4493){_0x56c70f=_0x56c70f-0x0;var _0x3812ed=_0x0486[_0x56c70f];return _0x3812ed;};'use strict';var _=require(_0x6048('0x0'));var util=require('util');var logger=require(_0x6048('0x1'))(_0x6048('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6048('0x3'));var rimraf=require(_0x6048('0x4'));var config=require(_0x6048('0x5'));var attributes=require(_0x6048('0x6'));module[_0x6048('0x7')]=function(_0x57e919,_0x41e5a0){return _0x57e919[_0x6048('0x8')](_0x6048('0x9'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4167c3,_0x56b248,_0x32c207){var _0x3d6462=_0x57e919[_0x6048('0xa')];var _0x26d28a=_0x4167c3['get']({'plain':!![]});if(_0x26d28a['direction']['toLowerCase']()==='in'||_0x26d28a[_0x6048('0xb')][_0x6048('0xc')]()===_0x6048('0xd')&&!_0x26d28a[_0x6048('0xe')]&&!_[_0x6048('0xf')](_0x26d28a[_0x6048('0x10')])){_0x3d6462[_0x6048('0x11')][_0x6048('0x12')]({'where':{'id':_0x26d28a[_0x6048('0x13')]}})[_0x6048('0x14')](function(_0x4da44c){if(_0x4da44c){_0x4da44c[_0x6048('0x15')]({'lastMsgAt':_0x26d28a[_0x6048('0x16')],'lastMsgDirection':_0x26d28a[_0x6048('0xb')][_0x6048('0xc')]()});}})[_0x6048('0x17')](function(_0x1c6320){console[_0x6048('0x18')](_0x1c6320);});}_0x32c207();}},'charset':_0x6048('0x19'),'collate':_0x6048('0x1a')});}; \ No newline at end of file +var _0x0a86=['out','isNil','UserId','findOne','then','update','createdAt','catch','error','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./faxMessage.attributes','define','FaxMessage','fax_messages','fti_fax_messages','body','models','get','direction','toLowerCase'];(function(_0x425c80,_0x5399c4){var _0x33e9b3=function(_0x256ad5){while(--_0x256ad5){_0x425c80['push'](_0x425c80['shift']());}};_0x33e9b3(++_0x5399c4);}(_0x0a86,0x175));var _0x60a8=function(_0x2330c5,_0x5ddb84){_0x2330c5=_0x2330c5-0x0;var _0x48133d=_0x0a86[_0x2330c5];return _0x48133d;};'use strict';var _=require(_0x60a8('0x0'));var util=require('util');var logger=require(_0x60a8('0x1'))('api');var moment=require(_0x60a8('0x2'));var BPromise=require(_0x60a8('0x3'));var rp=require(_0x60a8('0x4'));var fs=require('fs');var path=require(_0x60a8('0x5'));var rimraf=require('rimraf');var config=require(_0x60a8('0x6'));var attributes=require(_0x60a8('0x7'));module['exports']=function(_0x5a512a,_0x90efaf){return _0x5a512a[_0x60a8('0x8')](_0x60a8('0x9'),attributes,{'tableName':_0x60a8('0xa'),'paranoid':![],'indexes':[{'name':_0x60a8('0xb'),'fields':[_0x60a8('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x387963,_0x40a4d9,_0x4b8f2a){var _0x10f345=_0x5a512a[_0x60a8('0xd')];var _0x48f986=_0x387963[_0x60a8('0xe')]({'plain':!![]});if(_0x48f986[_0x60a8('0xf')][_0x60a8('0x10')]()==='in'||_0x48f986['direction'][_0x60a8('0x10')]()===_0x60a8('0x11')&&!_0x48f986['secret']&&!_[_0x60a8('0x12')](_0x48f986[_0x60a8('0x13')])){_0x10f345['FaxInteraction'][_0x60a8('0x14')]({'where':{'id':_0x48f986['FaxInteractionId']}})[_0x60a8('0x15')](function(_0x2d4821){if(_0x2d4821){_0x2d4821[_0x60a8('0x16')]({'lastMsgAt':_0x48f986[_0x60a8('0x17')],'lastMsgDirection':_0x48f986[_0x60a8('0xf')][_0x60a8('0x10')]()});}})[_0x60a8('0x18')](function(_0x4ef1d){console[_0x60a8('0x19')](_0x4ef1d);});}_0x4b8f2a();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index f3f4bb3..3108a1e 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 _0x22fb=['request','FaxMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateFaxMessage','FaxMessage','create','options','raw','then','debug','UpdateFaxMessage','update','body','attributes','limit','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x22fb,0x192));var _0xb22f=function(_0x4412c7,_0x4c8c88){_0x4412c7=_0x4412c7-0x0;var _0x139311=_0x22fb[_0x4412c7];return _0x139311;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb22f('0x0'));var BPromise=require('bluebird');var rs=require(_0xb22f('0x1'));var fs=require('fs');var Redis=require(_0xb22f('0x2'));var db=require(_0xb22f('0x3'))['db'];var utils=require(_0xb22f('0x4'));var logger=require(_0xb22f('0x5'))('rpc');var config=require(_0xb22f('0x6'));var jayson=require(_0xb22f('0x7'));var client=jayson[_0xb22f('0x8')][_0xb22f('0x9')]({'port':0x232a});config[_0xb22f('0xa')]=_[_0xb22f('0xb')](config['redis'],{'host':_0xb22f('0xc'),'port':0x18eb});var socket=require(_0xb22f('0xd'))(new Redis(config[_0xb22f('0xa')]));require(_0xb22f('0xe'))[_0xb22f('0xf')](socket);function respondWithRpcPromise(_0x3593fb,_0x188cea,_0x2ca6dd){return new BPromise(function(_0x26cf79,_0x2676f3){return client[_0xb22f('0x10')](_0x3593fb,_0x2ca6dd)['then'](function(_0x4b9e56){logger['info'](_0xb22f('0x11'),_0x188cea,'request\x20sent');logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x188cea,_0xb22f('0x12'),JSON[_0xb22f('0x13')](_0x4b9e56));if(_0x4b9e56[_0xb22f('0x14')]){if(_0x4b9e56[_0xb22f('0x14')][_0xb22f('0x15')]===0x1f4){logger[_0xb22f('0x14')]('FaxMessage,\x20%s,\x20%s',_0x188cea,_0x4b9e56[_0xb22f('0x14')]['message']);return _0x2676f3(_0x4b9e56[_0xb22f('0x14')]['message']);}logger[_0xb22f('0x14')](_0xb22f('0x11'),_0x188cea,_0x4b9e56[_0xb22f('0x14')][_0xb22f('0x16')]);return _0x26cf79(_0x4b9e56[_0xb22f('0x14')]['message']);}else{logger[_0xb22f('0x17')]('FaxMessage,\x20%s,\x20%s',_0x188cea,_0xb22f('0x12'));_0x26cf79(_0x4b9e56[_0xb22f('0x18')][_0xb22f('0x16')]);}})[_0xb22f('0x19')](function(_0x139bb6){logger[_0xb22f('0x14')]('FaxMessage,\x20%s,\x20%s',_0x188cea,_0x139bb6);_0x2676f3(_0x139bb6);});});}exports[_0xb22f('0x1a')]=function(_0x4b4510){var _0x3e05ce=this;return new Promise(function(_0x3878d8,_0x316f11){return db[_0xb22f('0x1b')][_0xb22f('0x1c')](_0x4b4510['body'],{'raw':_0x4b4510['options']?_0x4b4510[_0xb22f('0x1d')][_0xb22f('0x1e')]===undefined?!![]:![]:!![]})[_0xb22f('0x1f')](function(_0x16e465){logger[_0xb22f('0x17')](_0xb22f('0x1a'),_0x4b4510);logger[_0xb22f('0x20')](_0xb22f('0x1a'),_0x4b4510,JSON['stringify'](_0x16e465));_0x3878d8(_0x16e465);})['catch'](function(_0x3ab1d8){logger[_0xb22f('0x14')]('CreateFaxMessage',_0x3ab1d8[_0xb22f('0x16')],_0x4b4510);_0x316f11(_0x3e05ce[_0xb22f('0x14')](0x1f4,_0x3ab1d8['message']));});});};exports[_0xb22f('0x21')]=function(_0x2918be){var _0x4dfb62=this;return new Promise(function(_0x3e471f,_0x2c4a9e){return db[_0xb22f('0x1b')][_0xb22f('0x22')](_0x2918be[_0xb22f('0x23')],{'raw':_0x2918be[_0xb22f('0x1d')]?_0x2918be[_0xb22f('0x1d')][_0xb22f('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2918be['options']?_0x2918be['options']['where']||null:null,'attributes':_0x2918be[_0xb22f('0x1d')]?_0x2918be['options'][_0xb22f('0x24')]||null:null,'limit':_0x2918be[_0xb22f('0x1d')]?_0x2918be[_0xb22f('0x1d')][_0xb22f('0x25')]||null:null})[_0xb22f('0x1f')](function(_0x5b2a42){logger['info'](_0xb22f('0x21'),_0x2918be);logger[_0xb22f('0x20')](_0xb22f('0x21'),_0x2918be,JSON[_0xb22f('0x13')](_0x5b2a42));_0x3e471f(_0x5b2a42);})['catch'](function(_0x176133){logger[_0xb22f('0x14')]('UpdateFaxMessage',_0x176133[_0xb22f('0x16')],_0x2918be);_0x2c4a9e(_0x4dfb62[_0xb22f('0x14')](0x1f4,_0x176133[_0xb22f('0x16')]));});});}; \ No newline at end of file +var _0x5c12=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','FaxMessage,\x20%s,\x20%s','message','catch','CreateFaxMessage','FaxMessage','create','body','options','then','stringify','UpdateFaxMessage','raw','attributes','limit','util','moment','randomstring','ioredis'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x5c12,0x188));var _0x25c1=function(_0x4d40dd,_0x39592b){_0x4d40dd=_0x4d40dd-0x0;var _0x1c51f2=_0x5c12[_0x4d40dd];return _0x1c51f2;};'use strict';var _=require('lodash');var util=require(_0x25c1('0x0'));var moment=require(_0x25c1('0x1'));var BPromise=require('bluebird');var rs=require(_0x25c1('0x2'));var fs=require('fs');var Redis=require(_0x25c1('0x3'));var db=require(_0x25c1('0x4'))['db'];var utils=require(_0x25c1('0x5'));var logger=require(_0x25c1('0x6'))(_0x25c1('0x7'));var config=require(_0x25c1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x25c1('0x9')][_0x25c1('0xa')]({'port':0x232a});config[_0x25c1('0xb')]=_['defaults'](config['redis'],{'host':_0x25c1('0xc'),'port':0x18eb});var socket=require(_0x25c1('0xd'))(new Redis(config[_0x25c1('0xb')]));require(_0x25c1('0xe'))[_0x25c1('0xf')](socket);function respondWithRpcPromise(_0x588f30,_0x3e062e,_0x41c89d){return new BPromise(function(_0x11a223,_0x81f0f4){return client[_0x25c1('0x10')](_0x588f30,_0x41c89d)['then'](function(_0x196e2f){logger[_0x25c1('0x11')]('FaxMessage,\x20%s,\x20%s',_0x3e062e,_0x25c1('0x12'));logger[_0x25c1('0x13')](_0x25c1('0x14'),_0x3e062e,_0x25c1('0x12'),JSON['stringify'](_0x196e2f));if(_0x196e2f['error']){if(_0x196e2f['error']['code']===0x1f4){logger[_0x25c1('0x15')](_0x25c1('0x16'),_0x3e062e,_0x196e2f[_0x25c1('0x15')][_0x25c1('0x17')]);return _0x81f0f4(_0x196e2f[_0x25c1('0x15')]['message']);}logger[_0x25c1('0x15')]('FaxMessage,\x20%s,\x20%s',_0x3e062e,_0x196e2f['error']['message']);return _0x11a223(_0x196e2f[_0x25c1('0x15')][_0x25c1('0x17')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x3e062e,_0x25c1('0x12'));_0x11a223(_0x196e2f['result'][_0x25c1('0x17')]);}})[_0x25c1('0x18')](function(_0x5c3c5d){logger['error']('FaxMessage,\x20%s,\x20%s',_0x3e062e,_0x5c3c5d);_0x81f0f4(_0x5c3c5d);});});}exports[_0x25c1('0x19')]=function(_0x3d3149){var _0x22a36e=this;return new Promise(function(_0x1bf95d,_0x481c12){return db[_0x25c1('0x1a')][_0x25c1('0x1b')](_0x3d3149[_0x25c1('0x1c')],{'raw':_0x3d3149[_0x25c1('0x1d')]?_0x3d3149['options']['raw']===undefined?!![]:![]:!![]})[_0x25c1('0x1e')](function(_0xac3335){logger[_0x25c1('0x11')](_0x25c1('0x19'),_0x3d3149);logger[_0x25c1('0x13')](_0x25c1('0x19'),_0x3d3149,JSON[_0x25c1('0x1f')](_0xac3335));_0x1bf95d(_0xac3335);})[_0x25c1('0x18')](function(_0x14ffd9){logger[_0x25c1('0x15')](_0x25c1('0x19'),_0x14ffd9[_0x25c1('0x17')],_0x3d3149);_0x481c12(_0x22a36e[_0x25c1('0x15')](0x1f4,_0x14ffd9['message']));});});};exports[_0x25c1('0x20')]=function(_0x20dbb9){var _0x1b1c96=this;return new Promise(function(_0x1fb59f,_0x21fdb8){return db[_0x25c1('0x1a')]['update'](_0x20dbb9[_0x25c1('0x1c')],{'raw':_0x20dbb9[_0x25c1('0x1d')]?_0x20dbb9[_0x25c1('0x1d')][_0x25c1('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20dbb9[_0x25c1('0x1d')]?_0x20dbb9[_0x25c1('0x1d')]['where']||null:null,'attributes':_0x20dbb9[_0x25c1('0x1d')]?_0x20dbb9['options'][_0x25c1('0x22')]||null:null,'limit':_0x20dbb9[_0x25c1('0x1d')]?_0x20dbb9[_0x25c1('0x1d')][_0x25c1('0x23')]||null:null})[_0x25c1('0x1e')](function(_0x21069c){logger[_0x25c1('0x11')](_0x25c1('0x20'),_0x20dbb9);logger[_0x25c1('0x13')]('UpdateFaxMessage',_0x20dbb9,JSON[_0x25c1('0x1f')](_0x21069c));_0x1fb59f(_0x21069c);})['catch'](function(_0x492715){logger[_0x25c1('0x15')](_0x25c1('0x20'),_0x492715['message'],_0x20dbb9);_0x21fdb8(_0x1b1c96[_0x25c1('0x15')](0x1f4,_0x492715['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index e9ea646..b846810 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 _0x777f=['./faxMessage.events','save','remove','emit','removeListener','register','faxMessage:'];(function(_0x6eca42,_0x2810b1){var _0x39cba2=function(_0x1a28db){while(--_0x1a28db){_0x6eca42['push'](_0x6eca42['shift']());}};_0x39cba2(++_0x2810b1);}(_0x777f,0xbd));var _0xf777=function(_0x3a7634,_0x2db384){_0x3a7634=_0x3a7634-0x0;var _0x23bbe9=_0x777f[_0x3a7634];return _0x23bbe9;};'use strict';var FaxMessageEvents=require(_0xf777('0x0'));var events=[_0xf777('0x1'),_0xf777('0x2'),'update'];function createListener(_0x4957cb,_0x299896){return function(_0xa20463){_0x299896[_0xf777('0x3')](_0x4957cb,_0xa20463);};}function removeListener(_0x554f5f,_0x571be5){return function(){FaxMessageEvents[_0xf777('0x4')](_0x554f5f,_0x571be5);};}exports[_0xf777('0x5')]=function(_0xf6ccc7){for(var _0x299be4=0x0,_0x340a1c=events['length'];_0x299be4<_0x340a1c;_0x299be4++){var _0x3aeed6=events[_0x299be4];var _0x5b76ea=createListener(_0xf777('0x6')+_0x3aeed6,_0xf6ccc7);FaxMessageEvents['on'](_0x3aeed6,_0x5b76ea);}}; \ No newline at end of file +var _0x37b0=['update','emit','removeListener','register','length','faxMessage:','./faxMessage.events','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x37b0,0x14a));var _0x037b=function(_0x11746d,_0x9e53a6){_0x11746d=_0x11746d-0x0;var _0xc0044c=_0x37b0[_0x11746d];return _0xc0044c;};'use strict';var FaxMessageEvents=require(_0x037b('0x0'));var events=[_0x037b('0x1'),_0x037b('0x2'),_0x037b('0x3')];function createListener(_0x3e7d34,_0x325a98){return function(_0x146465){_0x325a98[_0x037b('0x4')](_0x3e7d34,_0x146465);};}function removeListener(_0x2afd6a,_0x5d6878){return function(){FaxMessageEvents[_0x037b('0x5')](_0x2afd6a,_0x5d6878);};}exports[_0x037b('0x6')]=function(_0x2254d0){for(var _0x393e2d=0x0,_0x55a5d9=events[_0x037b('0x7')];_0x393e2d<_0x55a5d9;_0x393e2d++){var _0x565f6d=events[_0x393e2d];var _0x40c01b=createListener(_0x037b('0x8')+_0x565f6d,_0x2254d0);FaxMessageEvents['on'](_0x565f6d,_0x40c01b);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 5b3f950..a77cec5 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 _0x55e0=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','describe','/:id','/:id/download','download','post','fax','create','put','update','/:id/accept','accept','/:id/reject','reject','destroy','multer','util','path','connect-timeout','fs-extra'];(function(_0x1b3044,_0x24fe5d){var _0x4a7bb1=function(_0x41713e){while(--_0x41713e){_0x1b3044['push'](_0x1b3044['shift']());}};_0x4a7bb1(++_0x24fe5d);}(_0x55e0,0xdc));var _0x055e=function(_0x5f48d4,_0x1bedc6){_0x5f48d4=_0x5f48d4-0x0;var _0x463662=_0x55e0[_0x5f48d4];return _0x463662;};'use strict';var multer=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var path=require(_0x055e('0x2'));var timeout=require(_0x055e('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x055e('0x4'));var auth=require(_0x055e('0x5'));var interaction=require(_0x055e('0x6'));var config=require(_0x055e('0x7'));var controller=require(_0x055e('0x8'));router[_0x055e('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x055e('0x9')]('/describe',auth[_0x055e('0xa')](),controller[_0x055e('0xb')]);router[_0x055e('0x9')](_0x055e('0xc'),auth[_0x055e('0xa')](),controller['show']);router[_0x055e('0x9')](_0x055e('0xd'),auth[_0x055e('0xa')](),controller[_0x055e('0xe')]);router[_0x055e('0xf')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x055e('0x10'),'faxmessage:create'),controller[_0x055e('0x11')]);router[_0x055e('0x12')](_0x055e('0xc'),auth[_0x055e('0xa')](),controller[_0x055e('0x13')]);router[_0x055e('0x12')](_0x055e('0x14'),auth['isAuthenticated'](),controller[_0x055e('0x15')]);router[_0x055e('0x12')](_0x055e('0x16'),auth[_0x055e('0xa')](),controller[_0x055e('0x17')]);router['delete'](_0x055e('0xc'),auth[_0x055e('0xa')](),controller[_0x055e('0x18')]);module['exports']=router; \ No newline at end of file +var _0x5b02=['put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','/describe','describe','show','download','post','tracked','fax','faxmessage:create','create'];(function(_0xd69f4e,_0x23cc9c){var _0xe0340b=function(_0xa2d58a){while(--_0xa2d58a){_0xd69f4e['push'](_0xd69f4e['shift']());}};_0xe0340b(++_0x23cc9c);}(_0x5b02,0xe9));var _0x25b0=function(_0x1378da,_0x1b3687){_0x1378da=_0x1378da-0x0;var _0x308112=_0x5b02[_0x1378da];return _0x308112;};'use strict';var multer=require(_0x25b0('0x0'));var util=require(_0x25b0('0x1'));var path=require(_0x25b0('0x2'));var timeout=require(_0x25b0('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x25b0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x25b0('0x5'));var config=require(_0x25b0('0x6'));var controller=require(_0x25b0('0x7'));router[_0x25b0('0x8')]('/',auth[_0x25b0('0x9')](),controller['index']);router[_0x25b0('0x8')](_0x25b0('0xa'),auth['isAuthenticated'](),controller[_0x25b0('0xb')]);router['get']('/:id',auth[_0x25b0('0x9')](),controller[_0x25b0('0xc')]);router[_0x25b0('0x8')]('/:id/download',auth[_0x25b0('0x9')](),controller[_0x25b0('0xd')]);router[_0x25b0('0xe')]('/',auth[_0x25b0('0x9')](),interaction[_0x25b0('0xf')](_0x25b0('0x10'),_0x25b0('0x11')),controller[_0x25b0('0x12')]);router[_0x25b0('0x13')](_0x25b0('0x14'),auth[_0x25b0('0x9')](),controller[_0x25b0('0x15')]);router[_0x25b0('0x13')](_0x25b0('0x16'),auth[_0x25b0('0x9')](),controller[_0x25b0('0x17')]);router[_0x25b0('0x13')](_0x25b0('0x18'),auth[_0x25b0('0x9')](),controller[_0x25b0('0x19')]);router[_0x25b0('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0x25b0('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 1d9ee47..9d60b09 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 _0xbba1=['STRING','rrmemory','INTEGER','sequelize','name'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xbba1,0x17f));var _0x1bba=function(_0x8fa2fb,_0x2d380e){_0x8fa2fb=_0x8fa2fb-0x0;var _0x277a43=_0xbba1[_0x8fa2fb];return _0x277a43;};'use strict';var Sequelize=require(_0x1bba('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x1bba('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1bba('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x1bba('0x3'),'beepall','roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x1bba('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb8cb=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','beepall'];(function(_0x2cb09e,_0x2d47f1){var _0x25dd7f=function(_0x7414a8){while(--_0x7414a8){_0x2cb09e['push'](_0x2cb09e['shift']());}};_0x25dd7f(++_0x2d47f1);}(_0xb8cb,0xd9));var _0xbb8c=function(_0x4efaf9,_0x917df6){_0x4efaf9=_0x4efaf9-0x0;var _0x2fb2d1=_0xb8cb[_0x4efaf9];return _0x2fb2d1;};'use strict';var Sequelize=require(_0xbb8c('0x0'));module[_0xbb8c('0x1')]={'name':{'type':Sequelize[_0xbb8c('0x2')],'unique':_0xbb8c('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xbb8c('0x2')]},'timeout':{'type':Sequelize[_0xbb8c('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbb8c('0x5')]('rrmemory',_0xbb8c('0x6'),_0xbb8c('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 8385325..c89f9ab 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 _0xb242=['ids','Agents','online','voicePause','interface','flatMap','sequelize','findOrCreate','forEach','emit','field','tq.TeamId','from','team_has_fax_queues','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','union','value','transaction','removeTeams','isEmpty','removeAgents','userFaxQueue:remove','addAgents','spread','getAgents','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','register','status','json','offset','undefined','count','Content-Range','then','destroy','FaxQueues','UserProfileResource','end','name','send','index','map','FaxQueue','fieldName','type','include','findAll','rows','catch','show','params','keys','rawAttributes','query','filters','model','attributes','fields','length','includeAll','options','find','create','user','get','role','UserProfileSection','userProfileId','autoAssociation','update','body','describe','findOne','UserFaxQueue','intersection','hasOwnProperty','nolimit','limit','sort','where','pick','FaxQueueId','filter','merge','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','getTeams','Team','order','addTeams'];(function(_0xc3bdb8,_0x523f31){var _0x1c879e=function(_0x22ada7){while(--_0x22ada7){_0xc3bdb8['push'](_0xc3bdb8['shift']());}};_0x1c879e(++_0x523f31);}(_0xb242,0x1f3));var _0x2b24=function(_0xad57ee,_0x2823a6){_0xad57ee=_0xad57ee-0x0;var _0x3eaea9=_0xb242[_0xad57ee];return _0x3eaea9;};'use strict';var BPromise=require('bluebird');var util=require(_0x2b24('0x0'));var _=require(_0x2b24('0x1'));var squel=require(_0x2b24('0x2'));var Redis=require(_0x2b24('0x3'));var qs=require(_0x2b24('0x4'));var logger=require(_0x2b24('0x5'))(_0x2b24('0x6'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x2b24('0x7')]=_[_0x2b24('0x8')](config['redis'],{'host':_0x2b24('0x9'),'port':0x18eb});var socket=require(_0x2b24('0xa'))(new Redis(config[_0x2b24('0x7')]));require('./faxQueue.socket')[_0x2b24('0xb')](socket);function respondWithStatusCode(_0x56c14a,_0x20d5f6){_0x20d5f6=_0x20d5f6||0xcc;return function(_0x82681f){if(_0x82681f){return _0x56c14a['sendStatus'](_0x20d5f6);}return _0x56c14a[_0x2b24('0xc')](_0x20d5f6)['end']();};}function respondWithResult(_0x24efd2,_0x12a5cb){_0x12a5cb=_0x12a5cb||0xc8;return function(_0x5e219d){if(_0x5e219d){return _0x24efd2['status'](_0x12a5cb)[_0x2b24('0xd')](_0x5e219d);}};}function respondWithFilteredResult(_0x4ab047,_0x3bb441){return function(_0x2a23b6){if(_0x2a23b6){var _0x2aed32=typeof _0x3bb441[_0x2b24('0xe')]==='undefined'&&typeof _0x3bb441['limit']===_0x2b24('0xf');var _0x42ff81=_0x2a23b6[_0x2b24('0x10')];var _0x1e44db=_0x2aed32?0x0:_0x3bb441[_0x2b24('0xe')];var _0x5f5b96=_0x2aed32?_0x2a23b6[_0x2b24('0x10')]:_0x3bb441[_0x2b24('0xe')]+_0x3bb441['limit'];var _0x38cd5d;if(_0x5f5b96>=_0x42ff81){_0x5f5b96=_0x42ff81;_0x38cd5d=0xc8;}else{_0x38cd5d=0xce;}_0x4ab047[_0x2b24('0xc')](_0x38cd5d);return _0x4ab047['set'](_0x2b24('0x11'),_0x1e44db+'-'+_0x5f5b96+'/'+_0x42ff81)[_0x2b24('0xd')](_0x2a23b6);}return null;};}function saveUpdates(_0x2fdc73){return function(_0x2f5c76){if(_0x2f5c76){return _0x2f5c76['update'](_0x2fdc73)[_0x2b24('0x12')](function(_0x2815dc){return _0x2815dc;});}return null;};}function removeEntity(_0x135261){return function(_0x4951af){if(_0x4951af){return _0x4951af[_0x2b24('0x13')]()[_0x2b24('0x12')](function(){var _0x2e1fa2=_0x4951af['get']({'plain':!![]});var _0x58bff6=_0x2b24('0x14');return db[_0x2b24('0x15')][_0x2b24('0x13')]({'where':{'type':_0x58bff6,'resourceId':_0x2e1fa2['id']}})[_0x2b24('0x12')](function(){return _0x4951af;});})['then'](function(){_0x135261[_0x2b24('0xc')](0xcc)[_0x2b24('0x16')]();});}};}function handleEntityNotFound(_0x1cac48){return function(_0x2b94d3){if(!_0x2b94d3){_0x1cac48['sendStatus'](0x194);}return _0x2b94d3;};}function handleError(_0x504ecf,_0x22c8c5){_0x22c8c5=_0x22c8c5||0x1f4;return function(_0x5d97e1){logger['error'](_0x5d97e1['stack']);if(_0x5d97e1['name']){delete _0x5d97e1[_0x2b24('0x17')];}_0x504ecf[_0x2b24('0xc')](_0x22c8c5)[_0x2b24('0x18')](_0x5d97e1);};}exports[_0x2b24('0x19')]=function(_0x5cd375,_0x5042bf){var _0x4d25e4={};var _0x1fde97={'count':0x0,'rows':[]};var _0x20801c=_[_0x2b24('0x1a')](db[_0x2b24('0x1b')]['rawAttributes'],function(_0x5c9efb){return{'name':_0x5c9efb[_0x2b24('0x1c')],'type':_0x5c9efb[_0x2b24('0x1d')]['key']};});_0x4d25e4=qs['getOptions'](_0x20801c,_0x5cd375);var _0x2a0aea={'where':_0x4d25e4['where']};return db['FaxQueue'][_0x2b24('0x10')](_0x2a0aea)[_0x2b24('0x12')](function(_0x12604d){_0x1fde97[_0x2b24('0x10')]=_0x12604d;_0x4d25e4['include']=qs[_0x2b24('0x1e')](_0x5cd375['query']);return db[_0x2b24('0x1b')][_0x2b24('0x1f')](_0x4d25e4);})[_0x2b24('0x12')](function(_0x12c529){_0x1fde97[_0x2b24('0x20')]=_0x12c529;return _0x1fde97;})[_0x2b24('0x12')](respondWithFilteredResult(_0x5042bf,_0x4d25e4))[_0x2b24('0x21')](handleError(_0x5042bf,null));};exports[_0x2b24('0x22')]=function(_0x1cb530,_0x1ab4fe){var _0x42be50={'raw':!![],'where':{'id':_0x1cb530[_0x2b24('0x23')]['id']}},_0x562838={};_0x562838['model']=_[_0x2b24('0x24')](db['FaxQueue'][_0x2b24('0x25')]);_0x562838[_0x2b24('0x26')]=_['keys'](_0x1cb530[_0x2b24('0x26')]);_0x562838[_0x2b24('0x27')]=_['intersection'](_0x562838[_0x2b24('0x28')],_0x562838[_0x2b24('0x26')]);_0x42be50[_0x2b24('0x29')]=_['intersection'](_0x562838[_0x2b24('0x28')],qs[_0x2b24('0x2a')](_0x1cb530['query'][_0x2b24('0x2a')]));_0x42be50[_0x2b24('0x29')]=_0x42be50['attributes'][_0x2b24('0x2b')]?_0x42be50[_0x2b24('0x29')]:_0x562838['model'];if(_0x1cb530[_0x2b24('0x26')][_0x2b24('0x2c')]){_0x42be50[_0x2b24('0x1e')]=[{'all':!![]}];}_0x42be50=_['merge']({},_0x42be50,_0x1cb530[_0x2b24('0x2d')]);return db[_0x2b24('0x1b')][_0x2b24('0x2e')](_0x42be50)[_0x2b24('0x12')](handleEntityNotFound(_0x1ab4fe,null))['then'](respondWithResult(_0x1ab4fe,null))[_0x2b24('0x21')](handleError(_0x1ab4fe,null));};exports[_0x2b24('0x2f')]=function(_0x217eac,_0x1810b4){return db[_0x2b24('0x1b')][_0x2b24('0x2f')](_0x217eac['body'],{})[_0x2b24('0x12')](function(_0x258ca6){var _0x181da8=_0x217eac[_0x2b24('0x30')][_0x2b24('0x31')]({'plain':!![]});if(!_0x181da8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x181da8[_0x2b24('0x32')]===_0x2b24('0x30')){var _0x4c9182=_0x258ca6[_0x2b24('0x31')]({'plain':!![]});var _0x36d5c0='FaxQueues';return db[_0x2b24('0x33')][_0x2b24('0x2e')]({'where':{'name':_0x36d5c0,'userProfileId':_0x181da8[_0x2b24('0x34')]},'raw':!![]})[_0x2b24('0x12')](function(_0x1ff337){if(_0x1ff337&&_0x1ff337[_0x2b24('0x35')]===0x0){return db['UserProfileResource'][_0x2b24('0x2f')]({'name':_0x4c9182[_0x2b24('0x17')],'resourceId':_0x4c9182['id'],'type':_0x1ff337['name'],'sectionId':_0x1ff337['id']},{})['then'](function(){return _0x258ca6;});}else{return _0x258ca6;}})[_0x2b24('0x21')](function(_0x32c29b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32c29b);throw _0x32c29b;});}return _0x258ca6;})['then'](respondWithResult(_0x1810b4,0xc9))['catch'](handleError(_0x1810b4,null));};exports[_0x2b24('0x36')]=function(_0x30e8f8,_0x4672e6){if(_0x30e8f8[_0x2b24('0x37')]['id']){delete _0x30e8f8[_0x2b24('0x37')]['id'];}return db[_0x2b24('0x1b')]['find']({'where':{'id':_0x30e8f8['params']['id']}})['then'](handleEntityNotFound(_0x4672e6,null))[_0x2b24('0x12')](saveUpdates(_0x30e8f8[_0x2b24('0x37')],null))[_0x2b24('0x12')](respondWithResult(_0x4672e6,null))['catch'](handleError(_0x4672e6,null));};exports[_0x2b24('0x13')]=function(_0x4a6c67,_0x2ac49f){return db[_0x2b24('0x1b')][_0x2b24('0x2e')]({'where':{'id':_0x4a6c67[_0x2b24('0x23')]['id']}})[_0x2b24('0x12')](handleEntityNotFound(_0x2ac49f,null))[_0x2b24('0x12')](removeEntity(_0x2ac49f,null))['catch'](handleError(_0x2ac49f,null));};exports[_0x2b24('0x38')]=function(_0x37a538,_0x1f30cc){return db['FaxQueue'][_0x2b24('0x38')]()['then'](respondWithResult(_0x1f30cc,null))[_0x2b24('0x21')](handleError(_0x1f30cc,null));};exports['getMembers']=function(_0x19d816,_0x12dafe){var _0x18d504={'raw':!![],'where':{}},_0x30b123={},_0x3c7a9d;return db[_0x2b24('0x1b')][_0x2b24('0x39')]({'where':{'id':_0x19d816[_0x2b24('0x23')]['id']}})['then'](handleEntityNotFound(_0x12dafe,null))[_0x2b24('0x12')](function(_0xb2ebe5){if(_0xb2ebe5){_0x3c7a9d=_0xb2ebe5[_0x2b24('0x31')]({'plain':!![]});_0x30b123[_0x2b24('0x28')]=_['keys'](db[_0x2b24('0x3a')][_0x2b24('0x25')]);_0x30b123[_0x2b24('0x26')]=_[_0x2b24('0x24')](_0x19d816[_0x2b24('0x26')]);_0x30b123[_0x2b24('0x27')]=_['intersection'](_0x30b123[_0x2b24('0x28')],_0x30b123[_0x2b24('0x26')]);_0x18d504['attributes']=_[_0x2b24('0x3b')](_0x30b123['model'],qs[_0x2b24('0x2a')](_0x19d816[_0x2b24('0x26')][_0x2b24('0x2a')]));_0x18d504[_0x2b24('0x29')]=_0x18d504[_0x2b24('0x29')][_0x2b24('0x2b')]?_0x18d504[_0x2b24('0x29')]:_0x30b123['model'];if(!_0x19d816[_0x2b24('0x26')][_0x2b24('0x3c')](_0x2b24('0x3d'))){_0x18d504[_0x2b24('0x3e')]=qs[_0x2b24('0x3e')](_0x19d816[_0x2b24('0x26')]['limit']);_0x18d504[_0x2b24('0xe')]=qs[_0x2b24('0xe')](_0x19d816['query'][_0x2b24('0xe')]);}_0x18d504['order']=qs[_0x2b24('0x3f')](_0x19d816['query'][_0x2b24('0x3f')]);_0x18d504[_0x2b24('0x40')]=qs[_0x2b24('0x27')](_[_0x2b24('0x41')](_0x19d816['query'],_0x30b123['filters']));_0x18d504[_0x2b24('0x40')][_0x2b24('0x42')]=_0xb2ebe5['id'];if(_0x19d816[_0x2b24('0x26')][_0x2b24('0x43')]){_0x18d504[_0x2b24('0x40')]=_[_0x2b24('0x44')](_0x18d504[_0x2b24('0x40')],{'$or':_[_0x2b24('0x1a')](_0x18d504[_0x2b24('0x29')],function(_0x22b0af){var _0x38b199={};_0x38b199[_0x22b0af]={'$like':'%'+_0x19d816['query'][_0x2b24('0x43')]+'%'};return _0x38b199;})});}_0x18d504=_[_0x2b24('0x44')]({},_0x18d504,_0x19d816[_0x2b24('0x2d')]);return db[_0x2b24('0x3a')]['findAll'](_0x18d504);}})['then'](function(_0x37410c){if(_0x37410c){return db[_0x2b24('0x45')][_0x2b24('0x46')]({'where':{'id':_['map'](_0x37410c,_0x2b24('0x47')),'role':_0x2b24('0x48')},'attributes':['id',_0x2b24('0x17'),_0x2b24('0x49'),_0x2b24('0x4a'),_0x2b24('0x4b')]});}})[_0x2b24('0x12')](function(_0x212fa6){if(_0x212fa6){return{'count':_0x212fa6['count'],'rows':_['map'](_0x212fa6[_0x2b24('0x20')],function(_0x2b418f){return{'membername':_0x2b418f['name'],'UserId':_0x2b418f['id'],'queue_name':_0x3c7a9d['name'],'FaxQueueId':_0x3c7a9d['id'],'interface':util[_0x2b24('0x4c')]('%s/%s','SIP',_0x2b418f[_0x2b24('0x17')]),'penalty':0x0,'paused':_0x2b418f[_0x2b24('0x49')],'createdAt':_0x2b418f['createdAt'],'updatedAt':_0x2b418f[_0x2b24('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2b24('0x12')](respondWithFilteredResult(_0x12dafe,_0x18d504))[_0x2b24('0x21')](handleError(_0x12dafe,null));};exports[_0x2b24('0x4d')]=function(_0x455def,_0x21d137){var _0x429ef3={};var _0x174157={};var _0x3054de;var _0x54782e;return db['FaxQueue'][_0x2b24('0x39')]({'where':{'id':_0x455def[_0x2b24('0x23')]['id']}})['then'](handleEntityNotFound(_0x21d137,null))[_0x2b24('0x12')](function(_0x112546){if(_0x112546){_0x3054de=_0x112546;_0x174157[_0x2b24('0x28')]=_[_0x2b24('0x24')](db[_0x2b24('0x4e')][_0x2b24('0x25')]);_0x174157[_0x2b24('0x26')]=_['keys'](_0x455def[_0x2b24('0x26')]);_0x174157[_0x2b24('0x27')]=_[_0x2b24('0x3b')](_0x174157[_0x2b24('0x28')],_0x174157[_0x2b24('0x26')]);_0x429ef3[_0x2b24('0x29')]=_[_0x2b24('0x3b')](_0x174157['model'],qs[_0x2b24('0x2a')](_0x455def[_0x2b24('0x26')][_0x2b24('0x2a')]));_0x429ef3['attributes']=_0x429ef3[_0x2b24('0x29')]['length']?_0x429ef3[_0x2b24('0x29')]:_0x174157['model'];_0x429ef3[_0x2b24('0x4f')]=qs['sort'](_0x455def[_0x2b24('0x26')][_0x2b24('0x3f')]);_0x429ef3[_0x2b24('0x40')]=qs[_0x2b24('0x27')](_[_0x2b24('0x41')](_0x455def[_0x2b24('0x26')],_0x174157[_0x2b24('0x27')]));if(_0x455def[_0x2b24('0x26')][_0x2b24('0x43')]){_0x429ef3[_0x2b24('0x40')]=_['merge'](_0x429ef3[_0x2b24('0x40')],{'$or':_[_0x2b24('0x1a')](_0x429ef3[_0x2b24('0x29')],function(_0x19da15){var _0x3f08d7={};_0x3f08d7[_0x19da15]={'$like':'%'+_0x455def[_0x2b24('0x26')][_0x2b24('0x43')]+'%'};return _0x3f08d7;})});}_0x429ef3=_['merge']({},_0x429ef3,_0x455def['options']);return _0x3054de[_0x2b24('0x4d')](_0x429ef3);}})['then'](function(_0x402403){if(_0x402403){_0x54782e=_0x402403[_0x2b24('0x2b')];if(!_0x455def[_0x2b24('0x26')][_0x2b24('0x3c')](_0x2b24('0x3d'))){_0x429ef3[_0x2b24('0x3e')]=qs['limit'](_0x455def['query'][_0x2b24('0x3e')]);_0x429ef3[_0x2b24('0xe')]=qs[_0x2b24('0xe')](_0x455def[_0x2b24('0x26')][_0x2b24('0xe')]);}return _0x3054de[_0x2b24('0x4d')](_0x429ef3);}})[_0x2b24('0x12')](function(_0x22b054){if(_0x22b054){return _0x22b054?{'count':_0x54782e,'rows':_0x22b054}:null;}})[_0x2b24('0x12')](respondWithResult(_0x21d137,null))[_0x2b24('0x21')](handleError(_0x21d137,null));};exports[_0x2b24('0x50')]=function(_0x277098,_0x5d70db){var _0x39be27=_0x277098[_0x2b24('0x37')][_0x2b24('0x51')];return db[_0x2b24('0x4e')][_0x2b24('0x1f')]({'where':{'id':_0x39be27},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2b24('0x52'),'attributes':['id',_0x2b24('0x17'),_0x2b24('0x53'),_0x2b24('0x54'),_0x2b24('0x55')],'raw':!![]}]})[_0x2b24('0x12')](function(_0xae7950){if(_0xae7950){var _0x19d422=_[_0x2b24('0x56')](_0xae7950,function(_0x229dd0){var _0x39b340=_0x229dd0[_0x2b24('0x31')]({'plain':!![]});return _0x39b340[_0x2b24('0x52')];});return db[_0x2b24('0x1b')]['find']({'where':{'id':_0x277098[_0x2b24('0x23')]['id']}})[_0x2b24('0x12')](function(_0x578eeb){return db[_0x2b24('0x57')]['transaction'](function(_0x419f02){return _0x578eeb[_0x2b24('0x50')](_0x39be27,{'transaction':_0x419f02})[_0x2b24('0x12')](function(){return BPromise['each'](_0x19d422,function(_0x2c3460){return db[_0x2b24('0x3a')][_0x2b24('0x58')]({'where':{'UserId':_0x2c3460['id'],'FaxQueueId':_0x277098[_0x2b24('0x23')]['id']},'transaction':_0x419f02});});})[_0x2b24('0x12')](function(){_0x19d422[_0x2b24('0x59')](function(_0x2829d5){socket[_0x2b24('0x5a')]('userFaxQueue:save',{'UserId':_0x2829d5['id'],'FaxQueueId':_0x578eeb['id']});});});});});}})[_0x2b24('0x12')](respondWithStatusCode(_0x5d70db,null))['catch'](handleError(_0x5d70db,null));};exports['removeTeams']=function(_0x51eeae,_0x24cfca){return db['Team']['findAll']({'where':{'id':_0x51eeae[_0x2b24('0x26')][_0x2b24('0x51')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2b24('0x52'),'attributes':['id'],'raw':!![]}]})[_0x2b24('0x12')](handleEntityNotFound(_0x24cfca,null))['then'](function(_0x3d2dc6){var _0x2bb50d=_['map'](_0x3d2dc6,'id');var _0x367b47=[];var _0x3db907=[];var _0x3e4537=squel['select']();_0x3e4537[_0x2b24('0x5b')](_0x2b24('0x5c'))[_0x2b24('0x5d')](_0x2b24('0x5e'),'tq')['join']('user_has_teams','ut',_0x2b24('0x5f'))[_0x2b24('0x40')](_0x2b24('0x60'),_0x51eeae[_0x2b24('0x23')]['id']);for(var _0x565c3e=0x0;_0x565c3e<_0x3d2dc6[_0x2b24('0x2b')];_0x565c3e+=0x1){let _0x2309f5=_0x3d2dc6[_0x565c3e];for(var _0x2e9157=0x0;_0x2e9157<_0x2309f5[_0x2b24('0x52')]['length'];_0x2e9157+=0x1){let _0x220fe3=_0x2309f5[_0x2b24('0x52')][_0x2e9157];var _0x276a90=_0x3e4537[_0x2b24('0x61')]();_0x276a90[_0x2b24('0x40')](_0x2b24('0x62'),_0x220fe3['id']);_0x3db907[_0x2b24('0x63')](db[_0x2b24('0x57')][_0x2b24('0x26')](_0x276a90[_0x2b24('0x64')](),{'type':db[_0x2b24('0x57')][_0x2b24('0x65')][_0x2b24('0x66')]})['then'](function(_0x18e73f){if(_0x18e73f[_0x2b24('0x2b')]===0x1){return _0x220fe3['id'];}else{var _0x3d413b=_[_0x2b24('0x67')](_['map'](_0x18e73f,_0x2b24('0x68')),function(_0x14e9de){return _[_0x2b24('0x69')](_0x2bb50d,_0x14e9de);});if(_0x3d413b){return _0x220fe3['id'];}}}));}}return BPromise['all'](_0x3db907)['then'](function(_0x1483aa){_0x367b47=_(_0x367b47)[_0x2b24('0x6a')](_0x1483aa)['compact']()[_0x2b24('0x6b')]();return db[_0x2b24('0x1b')]['find']({'where':{'id':_0x51eeae[_0x2b24('0x23')]['id']}})['then'](function(_0x71cbc7){return db[_0x2b24('0x57')][_0x2b24('0x6c')](function(_0x43d2e8){return _0x71cbc7[_0x2b24('0x6d')](_0x51eeae['query'][_0x2b24('0x51')],{'transaction':_0x43d2e8})[_0x2b24('0x12')](function(){if(!_[_0x2b24('0x6e')](_0x367b47)){return _0x71cbc7[_0x2b24('0x6f')](_0x367b47,{'transaction':_0x43d2e8});}})[_0x2b24('0x12')](function(){_0x367b47['forEach'](function(_0xe832c7){socket[_0x2b24('0x5a')](_0x2b24('0x70'),{'UserId':_0xe832c7,'FaxQueueId':_0x71cbc7['id']});});});});});});})[_0x2b24('0x12')](respondWithStatusCode(_0x24cfca,null))[_0x2b24('0x21')](handleError(_0x24cfca,null));};exports[_0x2b24('0x71')]=function(_0x5852af,_0x52aa02){return db[_0x2b24('0x1b')]['find']({'where':{'id':_0x5852af[_0x2b24('0x23')]['id']}})['then'](handleEntityNotFound(_0x52aa02,null))[_0x2b24('0x12')](function(_0x182094){if(_0x182094){return _0x182094[_0x2b24('0x71')](_0x5852af[_0x2b24('0x37')][_0x2b24('0x51')],_['omit'](_0x5852af[_0x2b24('0x37')],['ids','id'])||{})[_0x2b24('0x72')](function(_0x2d6294){for(var _0x8ef4d4=0x0;_0x8ef4d4<_0x5852af['body'][_0x2b24('0x51')][_0x2b24('0x2b')];_0x8ef4d4+=0x1){socket[_0x2b24('0x5a')]('userFaxQueue:save',{'UserId':Number(_0x5852af[_0x2b24('0x37')][_0x2b24('0x51')][_0x8ef4d4]),'FaxQueueId':Number(_0x5852af[_0x2b24('0x23')]['id'])});}return _0x2d6294;});}})[_0x2b24('0x12')](respondWithResult(_0x52aa02,null))[_0x2b24('0x21')](handleError(_0x52aa02,null));};exports['removeAgents']=function(_0x2104b5,_0x30bfd7){return db[_0x2b24('0x1b')][_0x2b24('0x2e')]({'where':{'id':_0x2104b5[_0x2b24('0x23')]['id']}})[_0x2b24('0x12')](handleEntityNotFound(_0x30bfd7,null))['then'](function(_0x49610e){if(_0x49610e){return _0x49610e['removeAgents'](_0x2104b5[_0x2b24('0x26')]['ids'])[_0x2b24('0x12')](function(){if(_['isArray'](_0x2104b5[_0x2b24('0x26')][_0x2b24('0x51')])){for(var _0x17404b=0x0;_0x17404b<_0x2104b5['query'][_0x2b24('0x51')][_0x2b24('0x2b')];_0x17404b+=0x1){socket[_0x2b24('0x5a')](_0x2b24('0x70'),{'UserId':Number(_0x2104b5[_0x2b24('0x26')][_0x2b24('0x51')][_0x17404b]),'FaxQueueId':Number(_0x2104b5['params']['id'])});}}else{socket[_0x2b24('0x5a')](_0x2b24('0x70'),{'UserId':Number(_0x2104b5[_0x2b24('0x26')][_0x2b24('0x51')]),'FaxQueueId':Number(_0x2104b5[_0x2b24('0x23')]['id'])});}});}})[_0x2b24('0x12')](respondWithStatusCode(_0x30bfd7,null))[_0x2b24('0x21')](handleError(_0x30bfd7,null));};exports[_0x2b24('0x73')]=function(_0x5707bd,_0x2a34da){var _0x118288={};var _0x491f2e={};var _0x2f70d7;var _0x266990;return db['FaxQueue']['findOne']({'where':{'id':_0x5707bd[_0x2b24('0x23')]['id']}})['then'](handleEntityNotFound(_0x2a34da,null))[_0x2b24('0x12')](function(_0x8cbaba){if(_0x8cbaba){_0x2f70d7=_0x8cbaba;_0x491f2e[_0x2b24('0x28')]=_[_0x2b24('0x24')](db[_0x2b24('0x45')][_0x2b24('0x25')]);_0x491f2e[_0x2b24('0x26')]=_[_0x2b24('0x24')](_0x5707bd[_0x2b24('0x26')]);_0x491f2e[_0x2b24('0x27')]=_[_0x2b24('0x3b')](_0x491f2e['model'],_0x491f2e[_0x2b24('0x26')]);_0x118288[_0x2b24('0x29')]=_['intersection'](_0x491f2e[_0x2b24('0x28')],qs[_0x2b24('0x2a')](_0x5707bd[_0x2b24('0x26')][_0x2b24('0x2a')]));_0x118288[_0x2b24('0x29')]=_0x118288[_0x2b24('0x29')]['length']?_0x118288[_0x2b24('0x29')]:_0x491f2e[_0x2b24('0x28')];_0x118288[_0x2b24('0x4f')]=qs[_0x2b24('0x3f')](_0x5707bd[_0x2b24('0x26')][_0x2b24('0x3f')]);_0x118288[_0x2b24('0x40')]=qs['filters'](_[_0x2b24('0x41')](_0x5707bd[_0x2b24('0x26')],_0x491f2e[_0x2b24('0x27')]));if(_0x5707bd['query'][_0x2b24('0x43')]){_0x118288[_0x2b24('0x40')]=_['merge'](_0x118288[_0x2b24('0x40')],{'$or':_['map'](_0x118288[_0x2b24('0x29')],function(_0x708c97){var _0x1feedb={};_0x1feedb[_0x708c97]={'$like':'%'+_0x5707bd[_0x2b24('0x26')][_0x2b24('0x43')]+'%'};return _0x1feedb;})});}_0x118288=_[_0x2b24('0x44')]({},_0x118288,_0x5707bd[_0x2b24('0x2d')]);return _0x2f70d7[_0x2b24('0x73')](_0x118288);}})[_0x2b24('0x12')](function(_0x242371){if(_0x242371){_0x266990=_0x242371[_0x2b24('0x2b')];if(!_0x5707bd['query'][_0x2b24('0x3c')](_0x2b24('0x3d'))){_0x118288[_0x2b24('0x3e')]=qs[_0x2b24('0x3e')](_0x5707bd[_0x2b24('0x26')][_0x2b24('0x3e')]);_0x118288[_0x2b24('0xe')]=qs[_0x2b24('0xe')](_0x5707bd[_0x2b24('0x26')][_0x2b24('0xe')]);}return _0x2f70d7[_0x2b24('0x73')](_0x118288);}})[_0x2b24('0x12')](function(_0x35d1ba){if(_0x35d1ba){return _0x35d1ba?{'count':_0x266990,'rows':_0x35d1ba}:null;}})[_0x2b24('0x12')](respondWithResult(_0x2a34da,null))[_0x2b24('0x21')](handleError(_0x2a34da,null));}; \ No newline at end of file +var _0xa751=['SELECT','TeamId','includes','compact','value','isEmpty','userFaxQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','FaxQueue','fieldName','type','key','where','include','findAll','rows','catch','show','params','model','keys','query','attributes','intersection','fields','length','includeAll','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','describe','getMembers','findOne','UserFaxQueue','rawAttributes','filters','hasOwnProperty','order','sort','pick','FaxQueueId','filter','findAndCountAll','agent','faxPause','createdAt','%s/%s','SIP','updatedAt','getTeams','Team','nolimit','addTeams','ids','User','Agents','interface','flatMap','sequelize','transaction','each','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push'];(function(_0xdca6d3,_0x1ce89a){var _0x2cfd0e=function(_0x5be7e1){while(--_0x5be7e1){_0xdca6d3['push'](_0xdca6d3['shift']());}};_0x2cfd0e(++_0x1ce89a);}(_0xa751,0x175));var _0x1a75=function(_0x3b544b,_0x337b61){_0x3b544b=_0x3b544b-0x0;var _0x2d3d2b=_0xa751[_0x3b544b];return _0x2d3d2b;};'use strict';var BPromise=require(_0x1a75('0x0'));var util=require(_0x1a75('0x1'));var _=require(_0x1a75('0x2'));var squel=require(_0x1a75('0x3'));var Redis=require('ioredis');var qs=require(_0x1a75('0x4'));var logger=require('../../config/logger')(_0x1a75('0x5'));var config=require(_0x1a75('0x6'));var db=require(_0x1a75('0x7'))['db'];config['redis']=_[_0x1a75('0x8')](config[_0x1a75('0x9')],{'host':_0x1a75('0xa'),'port':0x18eb});var socket=require(_0x1a75('0xb'))(new Redis(config[_0x1a75('0x9')]));require(_0x1a75('0xc'))[_0x1a75('0xd')](socket);function respondWithStatusCode(_0x5d6faa,_0x4c7f62){_0x4c7f62=_0x4c7f62||0xcc;return function(_0x4f77c2){if(_0x4f77c2){return _0x5d6faa[_0x1a75('0xe')](_0x4c7f62);}return _0x5d6faa[_0x1a75('0xf')](_0x4c7f62)[_0x1a75('0x10')]();};}function respondWithResult(_0x271286,_0x15b4cc){_0x15b4cc=_0x15b4cc||0xc8;return function(_0xd150fc){if(_0xd150fc){return _0x271286[_0x1a75('0xf')](_0x15b4cc)[_0x1a75('0x11')](_0xd150fc);}};}function respondWithFilteredResult(_0x5b615f,_0x5f1ff8){return function(_0x5a63c0){if(_0x5a63c0){var _0x6333ba=typeof _0x5f1ff8[_0x1a75('0x12')]===_0x1a75('0x13')&&typeof _0x5f1ff8[_0x1a75('0x14')]==='undefined';var _0x5ed24b=_0x5a63c0[_0x1a75('0x15')];var _0xf4a616=_0x6333ba?0x0:_0x5f1ff8['offset'];var _0x1c84d3=_0x6333ba?_0x5a63c0[_0x1a75('0x15')]:_0x5f1ff8['offset']+_0x5f1ff8[_0x1a75('0x14')];var _0xb4a245;if(_0x1c84d3>=_0x5ed24b){_0x1c84d3=_0x5ed24b;_0xb4a245=0xc8;}else{_0xb4a245=0xce;}_0x5b615f[_0x1a75('0xf')](_0xb4a245);return _0x5b615f['set']('Content-Range',_0xf4a616+'-'+_0x1c84d3+'/'+_0x5ed24b)['json'](_0x5a63c0);}return null;};}function saveUpdates(_0x471b90){return function(_0x41b894){if(_0x41b894){return _0x41b894[_0x1a75('0x16')](_0x471b90)[_0x1a75('0x17')](function(_0x1b1af2){return _0x1b1af2;});}return null;};}function removeEntity(_0x1d11dc){return function(_0x47f384){if(_0x47f384){return _0x47f384[_0x1a75('0x18')]()['then'](function(){var _0x486cd8=_0x47f384[_0x1a75('0x19')]({'plain':!![]});var _0x3928b7='FaxQueues';return db[_0x1a75('0x1a')]['destroy']({'where':{'type':_0x3928b7,'resourceId':_0x486cd8['id']}})[_0x1a75('0x17')](function(){return _0x47f384;});})[_0x1a75('0x17')](function(){_0x1d11dc[_0x1a75('0xf')](0xcc)[_0x1a75('0x10')]();});}};}function handleEntityNotFound(_0x1643ea){return function(_0x3f0bf4){if(!_0x3f0bf4){_0x1643ea['sendStatus'](0x194);}return _0x3f0bf4;};}function handleError(_0x3ed5e9,_0x4dc595){_0x4dc595=_0x4dc595||0x1f4;return function(_0x32edee){logger[_0x1a75('0x1b')](_0x32edee[_0x1a75('0x1c')]);if(_0x32edee['name']){delete _0x32edee[_0x1a75('0x1d')];}_0x3ed5e9['status'](_0x4dc595)[_0x1a75('0x1e')](_0x32edee);};}exports[_0x1a75('0x1f')]=function(_0x3dd52d,_0x4ed6f8){var _0x9fe9fe={};var _0x126f40={'count':0x0,'rows':[]};var _0x4dec82=_[_0x1a75('0x20')](db[_0x1a75('0x21')]['rawAttributes'],function(_0x168e06){return{'name':_0x168e06[_0x1a75('0x22')],'type':_0x168e06[_0x1a75('0x23')][_0x1a75('0x24')]};});_0x9fe9fe=qs['getOptions'](_0x4dec82,_0x3dd52d);var _0x2e16b7={'where':_0x9fe9fe[_0x1a75('0x25')]};return db[_0x1a75('0x21')][_0x1a75('0x15')](_0x2e16b7)[_0x1a75('0x17')](function(_0x9e66b9){_0x126f40[_0x1a75('0x15')]=_0x9e66b9;_0x9fe9fe[_0x1a75('0x26')]=qs['include'](_0x3dd52d['query']);return db[_0x1a75('0x21')][_0x1a75('0x27')](_0x9fe9fe);})[_0x1a75('0x17')](function(_0x11f25b){_0x126f40[_0x1a75('0x28')]=_0x11f25b;return _0x126f40;})[_0x1a75('0x17')](respondWithFilteredResult(_0x4ed6f8,_0x9fe9fe))[_0x1a75('0x29')](handleError(_0x4ed6f8,null));};exports[_0x1a75('0x2a')]=function(_0x531c2e,_0x4d6f8d){var _0x4c30d5={'raw':!![],'where':{'id':_0x531c2e[_0x1a75('0x2b')]['id']}},_0xdef8cb={};_0xdef8cb[_0x1a75('0x2c')]=_[_0x1a75('0x2d')](db['FaxQueue']['rawAttributes']);_0xdef8cb['query']=_[_0x1a75('0x2d')](_0x531c2e[_0x1a75('0x2e')]);_0xdef8cb['filters']=_['intersection'](_0xdef8cb[_0x1a75('0x2c')],_0xdef8cb['query']);_0x4c30d5[_0x1a75('0x2f')]=_[_0x1a75('0x30')](_0xdef8cb[_0x1a75('0x2c')],qs['fields'](_0x531c2e['query'][_0x1a75('0x31')]));_0x4c30d5[_0x1a75('0x2f')]=_0x4c30d5[_0x1a75('0x2f')][_0x1a75('0x32')]?_0x4c30d5[_0x1a75('0x2f')]:_0xdef8cb[_0x1a75('0x2c')];if(_0x531c2e[_0x1a75('0x2e')][_0x1a75('0x33')]){_0x4c30d5[_0x1a75('0x26')]=[{'all':!![]}];}_0x4c30d5=_[_0x1a75('0x34')]({},_0x4c30d5,_0x531c2e[_0x1a75('0x35')]);return db[_0x1a75('0x21')][_0x1a75('0x36')](_0x4c30d5)[_0x1a75('0x17')](handleEntityNotFound(_0x4d6f8d,null))[_0x1a75('0x17')](respondWithResult(_0x4d6f8d,null))[_0x1a75('0x29')](handleError(_0x4d6f8d,null));};exports['create']=function(_0xc203ad,_0x54bbce){return db['FaxQueue'][_0x1a75('0x37')](_0xc203ad[_0x1a75('0x38')],{})[_0x1a75('0x17')](function(_0x109140){var _0x2842d4=_0xc203ad['user'][_0x1a75('0x19')]({'plain':!![]});if(!_0x2842d4)throw new Error(_0x1a75('0x39'));if(_0x2842d4[_0x1a75('0x3a')]===_0x1a75('0x3b')){var _0x4372b5=_0x109140['get']({'plain':!![]});var _0x3cf3f2='FaxQueues';return db[_0x1a75('0x3c')][_0x1a75('0x36')]({'where':{'name':_0x3cf3f2,'userProfileId':_0x2842d4[_0x1a75('0x3d')]},'raw':!![]})[_0x1a75('0x17')](function(_0x269ed6){if(_0x269ed6&&_0x269ed6[_0x1a75('0x3e')]===0x0){return db[_0x1a75('0x1a')]['create']({'name':_0x4372b5['name'],'resourceId':_0x4372b5['id'],'type':_0x269ed6[_0x1a75('0x1d')],'sectionId':_0x269ed6['id']},{})['then'](function(){return _0x109140;});}else{return _0x109140;}})[_0x1a75('0x29')](function(_0x14abcf){logger[_0x1a75('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x14abcf);throw _0x14abcf;});}return _0x109140;})[_0x1a75('0x17')](respondWithResult(_0x54bbce,0xc9))[_0x1a75('0x29')](handleError(_0x54bbce,null));};exports[_0x1a75('0x16')]=function(_0x5a2c51,_0x292cbc){if(_0x5a2c51[_0x1a75('0x38')]['id']){delete _0x5a2c51[_0x1a75('0x38')]['id'];}return db[_0x1a75('0x21')][_0x1a75('0x36')]({'where':{'id':_0x5a2c51[_0x1a75('0x2b')]['id']}})[_0x1a75('0x17')](handleEntityNotFound(_0x292cbc,null))['then'](saveUpdates(_0x5a2c51[_0x1a75('0x38')],null))[_0x1a75('0x17')](respondWithResult(_0x292cbc,null))[_0x1a75('0x29')](handleError(_0x292cbc,null));};exports[_0x1a75('0x18')]=function(_0x40605a,_0x4d7072){return db[_0x1a75('0x21')][_0x1a75('0x36')]({'where':{'id':_0x40605a['params']['id']}})[_0x1a75('0x17')](handleEntityNotFound(_0x4d7072,null))['then'](removeEntity(_0x4d7072,null))[_0x1a75('0x29')](handleError(_0x4d7072,null));};exports['describe']=function(_0x65f4ca,_0x39d0a9){return db[_0x1a75('0x21')][_0x1a75('0x3f')]()[_0x1a75('0x17')](respondWithResult(_0x39d0a9,null))[_0x1a75('0x29')](handleError(_0x39d0a9,null));};exports[_0x1a75('0x40')]=function(_0x496bc3,_0x40c02d){var _0x5e188b={'raw':!![],'where':{}},_0x2c2be0={},_0x36ec71;return db[_0x1a75('0x21')][_0x1a75('0x41')]({'where':{'id':_0x496bc3[_0x1a75('0x2b')]['id']}})[_0x1a75('0x17')](handleEntityNotFound(_0x40c02d,null))[_0x1a75('0x17')](function(_0xd0557f){if(_0xd0557f){_0x36ec71=_0xd0557f['get']({'plain':!![]});_0x2c2be0[_0x1a75('0x2c')]=_[_0x1a75('0x2d')](db[_0x1a75('0x42')][_0x1a75('0x43')]);_0x2c2be0[_0x1a75('0x2e')]=_[_0x1a75('0x2d')](_0x496bc3[_0x1a75('0x2e')]);_0x2c2be0[_0x1a75('0x44')]=_[_0x1a75('0x30')](_0x2c2be0[_0x1a75('0x2c')],_0x2c2be0[_0x1a75('0x2e')]);_0x5e188b[_0x1a75('0x2f')]=_[_0x1a75('0x30')](_0x2c2be0[_0x1a75('0x2c')],qs[_0x1a75('0x31')](_0x496bc3['query'][_0x1a75('0x31')]));_0x5e188b[_0x1a75('0x2f')]=_0x5e188b[_0x1a75('0x2f')][_0x1a75('0x32')]?_0x5e188b[_0x1a75('0x2f')]:_0x2c2be0[_0x1a75('0x2c')];if(!_0x496bc3[_0x1a75('0x2e')][_0x1a75('0x45')]('nolimit')){_0x5e188b[_0x1a75('0x14')]=qs['limit'](_0x496bc3[_0x1a75('0x2e')][_0x1a75('0x14')]);_0x5e188b[_0x1a75('0x12')]=qs['offset'](_0x496bc3['query']['offset']);}_0x5e188b[_0x1a75('0x46')]=qs[_0x1a75('0x47')](_0x496bc3[_0x1a75('0x2e')][_0x1a75('0x47')]);_0x5e188b[_0x1a75('0x25')]=qs['filters'](_[_0x1a75('0x48')](_0x496bc3[_0x1a75('0x2e')],_0x2c2be0[_0x1a75('0x44')]));_0x5e188b[_0x1a75('0x25')][_0x1a75('0x49')]=_0xd0557f['id'];if(_0x496bc3[_0x1a75('0x2e')]['filter']){_0x5e188b['where']=_['merge'](_0x5e188b[_0x1a75('0x25')],{'$or':_[_0x1a75('0x20')](_0x5e188b[_0x1a75('0x2f')],function(_0x5b067f){var _0x50982d={};_0x50982d[_0x5b067f]={'$like':'%'+_0x496bc3[_0x1a75('0x2e')][_0x1a75('0x4a')]+'%'};return _0x50982d;})});}_0x5e188b=_['merge']({},_0x5e188b,_0x496bc3[_0x1a75('0x35')]);return db['UserFaxQueue']['findAll'](_0x5e188b);}})[_0x1a75('0x17')](function(_0x5a4502){if(_0x5a4502){return db['User'][_0x1a75('0x4b')]({'where':{'id':_[_0x1a75('0x20')](_0x5a4502,'UserId'),'role':_0x1a75('0x4c')},'attributes':['id',_0x1a75('0x1d'),_0x1a75('0x4d'),'updatedAt',_0x1a75('0x4e')]});}})['then'](function(_0x336b34){if(_0x336b34){return{'count':_0x336b34[_0x1a75('0x15')],'rows':_['map'](_0x336b34[_0x1a75('0x28')],function(_0x66b16d){return{'membername':_0x66b16d[_0x1a75('0x1d')],'UserId':_0x66b16d['id'],'queue_name':_0x36ec71[_0x1a75('0x1d')],'FaxQueueId':_0x36ec71['id'],'interface':util['format'](_0x1a75('0x4f'),_0x1a75('0x50'),_0x66b16d['name']),'penalty':0x0,'paused':_0x66b16d[_0x1a75('0x4d')],'createdAt':_0x66b16d['createdAt'],'updatedAt':_0x66b16d[_0x1a75('0x51')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1a75('0x17')](respondWithFilteredResult(_0x40c02d,_0x5e188b))['catch'](handleError(_0x40c02d,null));};exports[_0x1a75('0x52')]=function(_0x47674d,_0x33b59b){var _0x225609={};var _0x1060d1={};var _0x1ff8d0;var _0x5389f9;return db[_0x1a75('0x21')][_0x1a75('0x41')]({'where':{'id':_0x47674d[_0x1a75('0x2b')]['id']}})[_0x1a75('0x17')](handleEntityNotFound(_0x33b59b,null))[_0x1a75('0x17')](function(_0x338472){if(_0x338472){_0x1ff8d0=_0x338472;_0x1060d1[_0x1a75('0x2c')]=_['keys'](db[_0x1a75('0x53')]['rawAttributes']);_0x1060d1[_0x1a75('0x2e')]=_[_0x1a75('0x2d')](_0x47674d['query']);_0x1060d1['filters']=_['intersection'](_0x1060d1[_0x1a75('0x2c')],_0x1060d1[_0x1a75('0x2e')]);_0x225609[_0x1a75('0x2f')]=_[_0x1a75('0x30')](_0x1060d1[_0x1a75('0x2c')],qs[_0x1a75('0x31')](_0x47674d[_0x1a75('0x2e')][_0x1a75('0x31')]));_0x225609[_0x1a75('0x2f')]=_0x225609[_0x1a75('0x2f')]['length']?_0x225609[_0x1a75('0x2f')]:_0x1060d1[_0x1a75('0x2c')];_0x225609[_0x1a75('0x46')]=qs[_0x1a75('0x47')](_0x47674d[_0x1a75('0x2e')][_0x1a75('0x47')]);_0x225609[_0x1a75('0x25')]=qs[_0x1a75('0x44')](_[_0x1a75('0x48')](_0x47674d[_0x1a75('0x2e')],_0x1060d1[_0x1a75('0x44')]));if(_0x47674d['query']['filter']){_0x225609['where']=_['merge'](_0x225609[_0x1a75('0x25')],{'$or':_[_0x1a75('0x20')](_0x225609[_0x1a75('0x2f')],function(_0xd62f37){var _0x14b070={};_0x14b070[_0xd62f37]={'$like':'%'+_0x47674d[_0x1a75('0x2e')]['filter']+'%'};return _0x14b070;})});}_0x225609=_[_0x1a75('0x34')]({},_0x225609,_0x47674d[_0x1a75('0x35')]);return _0x1ff8d0[_0x1a75('0x52')](_0x225609);}})[_0x1a75('0x17')](function(_0x51639a){if(_0x51639a){_0x5389f9=_0x51639a[_0x1a75('0x32')];if(!_0x47674d[_0x1a75('0x2e')][_0x1a75('0x45')](_0x1a75('0x54'))){_0x225609[_0x1a75('0x14')]=qs[_0x1a75('0x14')](_0x47674d['query'][_0x1a75('0x14')]);_0x225609[_0x1a75('0x12')]=qs['offset'](_0x47674d[_0x1a75('0x2e')][_0x1a75('0x12')]);}return _0x1ff8d0['getTeams'](_0x225609);}})[_0x1a75('0x17')](function(_0x2bbe57){if(_0x2bbe57){return _0x2bbe57?{'count':_0x5389f9,'rows':_0x2bbe57}:null;}})[_0x1a75('0x17')](respondWithResult(_0x33b59b,null))[_0x1a75('0x29')](handleError(_0x33b59b,null));};exports[_0x1a75('0x55')]=function(_0x399f29,_0x27dd93){var _0x5eddef=_0x399f29[_0x1a75('0x38')][_0x1a75('0x56')];return db[_0x1a75('0x53')][_0x1a75('0x27')]({'where':{'id':_0x5eddef},'attributes':['id'],'include':[{'model':db[_0x1a75('0x57')],'as':_0x1a75('0x58'),'attributes':['id','name','online','voicePause',_0x1a75('0x59')],'raw':!![]}]})['then'](function(_0x3b27fc){if(_0x3b27fc){var _0x548cff=_[_0x1a75('0x5a')](_0x3b27fc,function(_0x493a26){var _0x456b7f=_0x493a26[_0x1a75('0x19')]({'plain':!![]});return _0x456b7f['Agents'];});return db[_0x1a75('0x21')][_0x1a75('0x36')]({'where':{'id':_0x399f29[_0x1a75('0x2b')]['id']}})[_0x1a75('0x17')](function(_0xbccc48){return db[_0x1a75('0x5b')][_0x1a75('0x5c')](function(_0x10dbee){return _0xbccc48[_0x1a75('0x55')](_0x5eddef,{'transaction':_0x10dbee})[_0x1a75('0x17')](function(){return BPromise[_0x1a75('0x5d')](_0x548cff,function(_0x26c0fb){return db[_0x1a75('0x42')]['findOrCreate']({'where':{'UserId':_0x26c0fb['id'],'FaxQueueId':_0x399f29[_0x1a75('0x2b')]['id']},'transaction':_0x10dbee});});})['then'](function(){_0x548cff[_0x1a75('0x5e')](function(_0x1b784e){socket[_0x1a75('0x5f')](_0x1a75('0x60'),{'UserId':_0x1b784e['id'],'FaxQueueId':_0xbccc48['id']});});});});});}})[_0x1a75('0x17')](respondWithStatusCode(_0x27dd93,null))[_0x1a75('0x29')](handleError(_0x27dd93,null));};exports[_0x1a75('0x61')]=function(_0x2618a6,_0xca99ad){return db[_0x1a75('0x53')]['findAll']({'where':{'id':_0x2618a6[_0x1a75('0x2e')][_0x1a75('0x56')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1a75('0x58'),'attributes':['id'],'raw':!![]}]})[_0x1a75('0x17')](handleEntityNotFound(_0xca99ad,null))['then'](function(_0x262ece){var _0x28bf77=_[_0x1a75('0x20')](_0x262ece,'id');var _0x53c8eb=[];var _0x32cb9f=[];var _0xd063a8=squel[_0x1a75('0x62')]();_0xd063a8[_0x1a75('0x63')](_0x1a75('0x64'))[_0x1a75('0x65')]('team_has_fax_queues','tq')['join'](_0x1a75('0x66'),'ut',_0x1a75('0x67'))[_0x1a75('0x25')](_0x1a75('0x68'),_0x2618a6[_0x1a75('0x2b')]['id']);for(var _0x3bfabd=0x0;_0x3bfabd<_0x262ece[_0x1a75('0x32')];_0x3bfabd+=0x1){let _0x14ba03=_0x262ece[_0x3bfabd];for(var _0x2bbfb3=0x0;_0x2bbfb3<_0x14ba03[_0x1a75('0x58')][_0x1a75('0x32')];_0x2bbfb3+=0x1){let _0xb21db1=_0x14ba03[_0x1a75('0x58')][_0x2bbfb3];var _0x798e64=_0xd063a8['clone']();_0x798e64[_0x1a75('0x25')](_0x1a75('0x69'),_0xb21db1['id']);_0x32cb9f[_0x1a75('0x6a')](db[_0x1a75('0x5b')][_0x1a75('0x2e')](_0x798e64['toString'](),{'type':db['sequelize']['QueryTypes'][_0x1a75('0x6b')]})['then'](function(_0x16bf89){if(_0x16bf89[_0x1a75('0x32')]===0x1){return _0xb21db1['id'];}else{var _0x2d19cf=_['every'](_[_0x1a75('0x20')](_0x16bf89,_0x1a75('0x6c')),function(_0x59c148){return _[_0x1a75('0x6d')](_0x28bf77,_0x59c148);});if(_0x2d19cf){return _0xb21db1['id'];}}}));}}return BPromise['all'](_0x32cb9f)[_0x1a75('0x17')](function(_0x529e19){_0x53c8eb=_(_0x53c8eb)['union'](_0x529e19)[_0x1a75('0x6e')]()[_0x1a75('0x6f')]();return db[_0x1a75('0x21')][_0x1a75('0x36')]({'where':{'id':_0x2618a6[_0x1a75('0x2b')]['id']}})['then'](function(_0x13413b){return db[_0x1a75('0x5b')][_0x1a75('0x5c')](function(_0x24bdc1){return _0x13413b[_0x1a75('0x61')](_0x2618a6[_0x1a75('0x2e')][_0x1a75('0x56')],{'transaction':_0x24bdc1})[_0x1a75('0x17')](function(){if(!_[_0x1a75('0x70')](_0x53c8eb)){return _0x13413b['removeAgents'](_0x53c8eb,{'transaction':_0x24bdc1});}})['then'](function(){_0x53c8eb['forEach'](function(_0x1cef54){socket[_0x1a75('0x5f')](_0x1a75('0x71'),{'UserId':_0x1cef54,'FaxQueueId':_0x13413b['id']});});});});});});})[_0x1a75('0x17')](respondWithStatusCode(_0xca99ad,null))['catch'](handleError(_0xca99ad,null));};exports[_0x1a75('0x72')]=function(_0x3f3142,_0x4e11a8){return db[_0x1a75('0x21')][_0x1a75('0x36')]({'where':{'id':_0x3f3142[_0x1a75('0x2b')]['id']}})[_0x1a75('0x17')](handleEntityNotFound(_0x4e11a8,null))[_0x1a75('0x17')](function(_0x4d5753){if(_0x4d5753){return _0x4d5753[_0x1a75('0x72')](_0x3f3142[_0x1a75('0x38')]['ids'],_[_0x1a75('0x73')](_0x3f3142[_0x1a75('0x38')],[_0x1a75('0x56'),'id'])||{})[_0x1a75('0x74')](function(_0x103084){for(var _0x426735=0x0;_0x426735<_0x3f3142[_0x1a75('0x38')][_0x1a75('0x56')][_0x1a75('0x32')];_0x426735+=0x1){socket['emit'](_0x1a75('0x60'),{'UserId':Number(_0x3f3142[_0x1a75('0x38')][_0x1a75('0x56')][_0x426735]),'FaxQueueId':Number(_0x3f3142[_0x1a75('0x2b')]['id'])});}return _0x103084;});}})[_0x1a75('0x17')](respondWithResult(_0x4e11a8,null))[_0x1a75('0x29')](handleError(_0x4e11a8,null));};exports['removeAgents']=function(_0x16906d,_0x2f5468){return db[_0x1a75('0x21')][_0x1a75('0x36')]({'where':{'id':_0x16906d['params']['id']}})[_0x1a75('0x17')](handleEntityNotFound(_0x2f5468,null))[_0x1a75('0x17')](function(_0x34c7c4){if(_0x34c7c4){return _0x34c7c4[_0x1a75('0x75')](_0x16906d[_0x1a75('0x2e')][_0x1a75('0x56')])[_0x1a75('0x17')](function(){if(_[_0x1a75('0x76')](_0x16906d[_0x1a75('0x2e')]['ids'])){for(var _0x5e8518=0x0;_0x5e8518<_0x16906d[_0x1a75('0x2e')][_0x1a75('0x56')][_0x1a75('0x32')];_0x5e8518+=0x1){socket[_0x1a75('0x5f')]('userFaxQueue:remove',{'UserId':Number(_0x16906d[_0x1a75('0x2e')][_0x1a75('0x56')][_0x5e8518]),'FaxQueueId':Number(_0x16906d[_0x1a75('0x2b')]['id'])});}}else{socket[_0x1a75('0x5f')](_0x1a75('0x71'),{'UserId':Number(_0x16906d[_0x1a75('0x2e')][_0x1a75('0x56')]),'FaxQueueId':Number(_0x16906d[_0x1a75('0x2b')]['id'])});}});}})[_0x1a75('0x17')](respondWithStatusCode(_0x2f5468,null))[_0x1a75('0x29')](handleError(_0x2f5468,null));};exports[_0x1a75('0x77')]=function(_0x437baa,_0x103d85){var _0x39ddec={};var _0x34c8c8={};var _0x4dd4f4;var _0x55cce1;return db[_0x1a75('0x21')][_0x1a75('0x41')]({'where':{'id':_0x437baa['params']['id']}})[_0x1a75('0x17')](handleEntityNotFound(_0x103d85,null))[_0x1a75('0x17')](function(_0x4a9bf8){if(_0x4a9bf8){_0x4dd4f4=_0x4a9bf8;_0x34c8c8[_0x1a75('0x2c')]=_[_0x1a75('0x2d')](db[_0x1a75('0x57')]['rawAttributes']);_0x34c8c8[_0x1a75('0x2e')]=_['keys'](_0x437baa[_0x1a75('0x2e')]);_0x34c8c8[_0x1a75('0x44')]=_[_0x1a75('0x30')](_0x34c8c8[_0x1a75('0x2c')],_0x34c8c8[_0x1a75('0x2e')]);_0x39ddec[_0x1a75('0x2f')]=_[_0x1a75('0x30')](_0x34c8c8[_0x1a75('0x2c')],qs[_0x1a75('0x31')](_0x437baa[_0x1a75('0x2e')][_0x1a75('0x31')]));_0x39ddec[_0x1a75('0x2f')]=_0x39ddec[_0x1a75('0x2f')][_0x1a75('0x32')]?_0x39ddec[_0x1a75('0x2f')]:_0x34c8c8['model'];_0x39ddec[_0x1a75('0x46')]=qs[_0x1a75('0x47')](_0x437baa[_0x1a75('0x2e')]['sort']);_0x39ddec['where']=qs['filters'](_[_0x1a75('0x48')](_0x437baa[_0x1a75('0x2e')],_0x34c8c8[_0x1a75('0x44')]));if(_0x437baa[_0x1a75('0x2e')][_0x1a75('0x4a')]){_0x39ddec[_0x1a75('0x25')]=_['merge'](_0x39ddec['where'],{'$or':_[_0x1a75('0x20')](_0x39ddec[_0x1a75('0x2f')],function(_0x2e76a8){var _0xa03fc9={};_0xa03fc9[_0x2e76a8]={'$like':'%'+_0x437baa[_0x1a75('0x2e')][_0x1a75('0x4a')]+'%'};return _0xa03fc9;})});}_0x39ddec=_['merge']({},_0x39ddec,_0x437baa['options']);return _0x4dd4f4[_0x1a75('0x77')](_0x39ddec);}})[_0x1a75('0x17')](function(_0x56c2d8){if(_0x56c2d8){_0x55cce1=_0x56c2d8['length'];if(!_0x437baa['query'][_0x1a75('0x45')](_0x1a75('0x54'))){_0x39ddec['limit']=qs['limit'](_0x437baa[_0x1a75('0x2e')][_0x1a75('0x14')]);_0x39ddec[_0x1a75('0x12')]=qs['offset'](_0x437baa[_0x1a75('0x2e')]['offset']);}return _0x4dd4f4[_0x1a75('0x77')](_0x39ddec);}})[_0x1a75('0x17')](function(_0x446016){if(_0x446016){return _0x446016?{'count':_0x55cce1,'rows':_0x446016}:null;}})[_0x1a75('0x17')](respondWithResult(_0x103d85,null))['catch'](handleError(_0x103d85,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 2ea9f22..def0cc4 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 _0x9352=['setMaxListeners','remove','emit','events','FaxQueue'];(function(_0x4d5dfc,_0xd5042b){var _0x2c29f0=function(_0x2ae258){while(--_0x2ae258){_0x4d5dfc['push'](_0x4d5dfc['shift']());}};_0x2c29f0(++_0xd5042b);}(_0x9352,0x148));var _0x2935=function(_0x40ee3a,_0xe56a66){_0x40ee3a=_0x40ee3a-0x0;var _0x38b782=_0x9352[_0x40ee3a];return _0x38b782;};'use strict';var EventEmitter=require(_0x2935('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x2935('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x2935('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x2935('0x3')};function emitEvent(_0x55258a){return function(_0x40d06f,_0x375bce,_0x41d476){FaxQueueEvents[_0x2935('0x4')](_0x55258a+':'+_0x40d06f['id'],_0x40d06f);FaxQueueEvents[_0x2935('0x4')](_0x55258a,_0x40d06f);_0x41d476(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0x2203=['emit','hasOwnProperty','exports','../../mysqldb','remove'];(function(_0xb0fe92,_0x147e42){var _0x41787f=function(_0x42ae35){while(--_0x42ae35){_0xb0fe92['push'](_0xb0fe92['shift']());}};_0x41787f(++_0x147e42);}(_0x2203,0x139));var _0x3220=function(_0x5bc95c,_0xfed759){_0x5bc95c=_0x5bc95c-0x0;var _0x3721fc=_0x2203[_0x5bc95c];return _0x3721fc;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x3220('0x0'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x3220('0x1')};function emitEvent(_0x350d9f){return function(_0xb083e5,_0x361174,_0x2adc7e){FaxQueueEvents['emit'](_0x350d9f+':'+_0xb083e5['id'],_0xb083e5);FaxQueueEvents[_0x3220('0x2')](_0x350d9f,_0xb083e5);_0x2adc7e(null);};}for(var e in events){if(events[_0x3220('0x3')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x3220('0x4')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 91300f2..9ddc1d3 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 _0x5cc5=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','exports','FaxQueue','fax_queues'];(function(_0x11c331,_0x523ccf){var _0x1b89e1=function(_0x33d7b6){while(--_0x33d7b6){_0x11c331['push'](_0x11c331['shift']());}};_0x1b89e1(++_0x523ccf);}(_0x5cc5,0xb6));var _0x55cc=function(_0x3e3bee,_0x4f91fe){_0x3e3bee=_0x3e3bee-0x0;var _0x3ae14c=_0x5cc5[_0x3e3bee];return _0x3ae14c;};'use strict';var _=require('lodash');var util=require(_0x55cc('0x0'));var logger=require(_0x55cc('0x1'))(_0x55cc('0x2'));var moment=require(_0x55cc('0x3'));var BPromise=require(_0x55cc('0x4'));var rp=require(_0x55cc('0x5'));var fs=require('fs');var path=require(_0x55cc('0x6'));var rimraf=require(_0x55cc('0x7'));var config=require(_0x55cc('0x8'));var attributes=require(_0x55cc('0x9'));module[_0x55cc('0xa')]=function(_0x57668a,_0x554f05){return _0x57668a['define'](_0x55cc('0xb'),attributes,{'tableName':_0x55cc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x12c5=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','fax_queues','lodash','util','../../config/logger'];(function(_0x24a03e,_0x69f19d){var _0x13f38f=function(_0x183407){while(--_0x183407){_0x24a03e['push'](_0x24a03e['shift']());}};_0x13f38f(++_0x69f19d);}(_0x12c5,0xc1));var _0x512c=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x12c5[_0x13b02f];return _0x12e9a6;};'use strict';var _=require(_0x512c('0x0'));var util=require(_0x512c('0x1'));var logger=require(_0x512c('0x2'))(_0x512c('0x3'));var moment=require(_0x512c('0x4'));var BPromise=require(_0x512c('0x5'));var rp=require(_0x512c('0x6'));var fs=require('fs');var path=require(_0x512c('0x7'));var rimraf=require(_0x512c('0x8'));var config=require(_0x512c('0x9'));var attributes=require(_0x512c('0xa'));module[_0x512c('0xb')]=function(_0x417eae,_0xcf9965){return _0x417eae[_0x512c('0xc')]('FaxQueue',attributes,{'tableName':_0x512c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index ac3c7e8..ff8024a 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 _0xa568=['localhost','./faxQueue.socket','register','request','info','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','catch','GetFaxQueue','FaxQueue','findAll','options','attributes','limit','include','map','model','debug','ShowFaxQueue','find','raw','where','then','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x513b34,_0x5e150e){var _0x48a6d4=function(_0x2b9ae2){while(--_0x2b9ae2){_0x513b34['push'](_0x513b34['shift']());}};_0x48a6d4(++_0x5e150e);}(_0xa568,0xc0));var _0x8a56=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xa568[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x8a56('0x0'));var util=require(_0x8a56('0x1'));var moment=require('moment');var BPromise=require(_0x8a56('0x2'));var rs=require(_0x8a56('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8a56('0x4'))['db'];var utils=require(_0x8a56('0x5'));var logger=require(_0x8a56('0x6'))('rpc');var config=require(_0x8a56('0x7'));var jayson=require(_0x8a56('0x8'));var client=jayson[_0x8a56('0x9')][_0x8a56('0xa')]({'port':0x232a});config[_0x8a56('0xb')]=_[_0x8a56('0xc')](config[_0x8a56('0xb')],{'host':_0x8a56('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8a56('0xe'))[_0x8a56('0xf')](socket);function respondWithRpcPromise(_0x10a00c,_0x4b85ce,_0xe5eb4b){return new BPromise(function(_0x4d2ed0,_0x469f52){return client[_0x8a56('0x10')](_0x10a00c,_0xe5eb4b)['then'](function(_0x3cd3a6){logger[_0x8a56('0x11')]('FaxQueue,\x20%s,\x20%s',_0x4b85ce,_0x8a56('0x12'));logger['debug'](_0x8a56('0x13'),_0x4b85ce,'request\x20sent',JSON[_0x8a56('0x14')](_0x3cd3a6));if(_0x3cd3a6['error']){if(_0x3cd3a6[_0x8a56('0x15')][_0x8a56('0x16')]===0x1f4){logger[_0x8a56('0x15')](_0x8a56('0x17'),_0x4b85ce,_0x3cd3a6[_0x8a56('0x15')][_0x8a56('0x18')]);return _0x469f52(_0x3cd3a6['error']['message']);}logger[_0x8a56('0x15')](_0x8a56('0x17'),_0x4b85ce,_0x3cd3a6[_0x8a56('0x15')][_0x8a56('0x18')]);return _0x4d2ed0(_0x3cd3a6[_0x8a56('0x15')][_0x8a56('0x18')]);}else{logger[_0x8a56('0x11')]('FaxQueue,\x20%s,\x20%s',_0x4b85ce,_0x8a56('0x12'));_0x4d2ed0(_0x3cd3a6['result']['message']);}})[_0x8a56('0x19')](function(_0x25d449){logger[_0x8a56('0x15')](_0x8a56('0x17'),_0x4b85ce,_0x25d449);_0x469f52(_0x25d449);});});}exports[_0x8a56('0x1a')]=function(_0x49a7d3){var _0x13b5d8=this;return new Promise(function(_0x20c66f,_0x4a4c8f){return db[_0x8a56('0x1b')][_0x8a56('0x1c')]({'raw':_0x49a7d3[_0x8a56('0x1d')]?_0x49a7d3[_0x8a56('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x49a7d3['options']?_0x49a7d3[_0x8a56('0x1d')]['where']||null:null,'attributes':_0x49a7d3[_0x8a56('0x1d')]?_0x49a7d3['options'][_0x8a56('0x1e')]||null:null,'limit':_0x49a7d3[_0x8a56('0x1d')]?_0x49a7d3['options'][_0x8a56('0x1f')]||null:null,'include':_0x49a7d3[_0x8a56('0x1d')]?_0x49a7d3[_0x8a56('0x1d')][_0x8a56('0x20')]?_[_0x8a56('0x21')](_0x49a7d3[_0x8a56('0x1d')][_0x8a56('0x20')],function(_0x1943f7){return{'model':db[_0x1943f7['model']],'as':_0x1943f7['as'],'attributes':_0x1943f7[_0x8a56('0x1e')],'include':_0x1943f7[_0x8a56('0x20')]?_[_0x8a56('0x21')](_0x1943f7[_0x8a56('0x20')],function(_0x3630bf){return{'model':db[_0x3630bf[_0x8a56('0x22')]],'as':_0x3630bf['as'],'attributes':_0x3630bf[_0x8a56('0x1e')],'include':_0x3630bf[_0x8a56('0x20')]?_['map'](_0x3630bf[_0x8a56('0x20')],function(_0x16f040){return{'model':db[_0x16f040[_0x8a56('0x22')]],'as':_0x16f040['as'],'attributes':_0x16f040[_0x8a56('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e10e6){logger['info'](_0x8a56('0x1a'),_0x49a7d3);logger[_0x8a56('0x23')](_0x8a56('0x1a'),_0x49a7d3,JSON['stringify'](_0x3e10e6));_0x20c66f(_0x3e10e6);})[_0x8a56('0x19')](function(_0x1e7c28){logger[_0x8a56('0x15')](_0x8a56('0x1a'),_0x1e7c28[_0x8a56('0x18')],_0x49a7d3);_0x4a4c8f(_0x13b5d8[_0x8a56('0x15')](0x1f4,_0x1e7c28[_0x8a56('0x18')]));});});};exports[_0x8a56('0x24')]=function(_0x2b88cd){var _0x2b852e=this;return new Promise(function(_0x5c1d9f,_0xefc806){return db[_0x8a56('0x1b')][_0x8a56('0x25')]({'raw':_0x2b88cd[_0x8a56('0x1d')]?_0x2b88cd[_0x8a56('0x1d')][_0x8a56('0x26')]===undefined?!![]:![]:!![],'where':_0x2b88cd[_0x8a56('0x1d')]?_0x2b88cd[_0x8a56('0x1d')][_0x8a56('0x27')]||null:null,'attributes':_0x2b88cd[_0x8a56('0x1d')]?_0x2b88cd[_0x8a56('0x1d')][_0x8a56('0x1e')]||null:null,'include':_0x2b88cd['options']?_0x2b88cd[_0x8a56('0x1d')]['include']?_['map'](_0x2b88cd['options'][_0x8a56('0x20')],function(_0x2a08bc){return{'model':db[_0x2a08bc[_0x8a56('0x22')]],'as':_0x2a08bc['as'],'attributes':_0x2a08bc[_0x8a56('0x1e')],'include':_0x2a08bc[_0x8a56('0x20')]?_['map'](_0x2a08bc['include'],function(_0x341f59){return{'model':db[_0x341f59[_0x8a56('0x22')]],'as':_0x341f59['as'],'attributes':_0x341f59[_0x8a56('0x1e')],'include':_0x341f59[_0x8a56('0x20')]?_[_0x8a56('0x21')](_0x341f59[_0x8a56('0x20')],function(_0xfd48a){return{'model':db[_0xfd48a[_0x8a56('0x22')]],'as':_0xfd48a['as'],'attributes':_0xfd48a[_0x8a56('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8a56('0x28')](function(_0x3b230e){logger['info'](_0x8a56('0x24'),_0x2b88cd);logger['debug'](_0x8a56('0x24'),_0x2b88cd,JSON[_0x8a56('0x14')](_0x3b230e));_0x5c1d9f(_0x3b230e);})['catch'](function(_0x51ebbc){logger[_0x8a56('0x15')](_0x8a56('0x24'),_0x51ebbc[_0x8a56('0x18')],_0x2b88cd);_0xefc806(_0x2b852e[_0x8a56('0x15')](0x1f4,_0x51ebbc[_0x8a56('0x18')]));});});}; \ No newline at end of file +var _0x7b51=['localhost','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','limit','map','include','model','attributes','find','ShowFaxQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults'];(function(_0x317935,_0x2ce30c){var _0x297a24=function(_0x304a24){while(--_0x304a24){_0x317935['push'](_0x317935['shift']());}};_0x297a24(++_0x2ce30c);}(_0x7b51,0x196));var _0x17b5=function(_0x47f7f5,_0xa5caf){_0x47f7f5=_0x47f7f5-0x0;var _0x52fe6b=_0x7b51[_0x47f7f5];return _0x52fe6b;};'use strict';var _=require(_0x17b5('0x0'));var util=require(_0x17b5('0x1'));var moment=require(_0x17b5('0x2'));var BPromise=require(_0x17b5('0x3'));var rs=require(_0x17b5('0x4'));var fs=require('fs');var Redis=require(_0x17b5('0x5'));var db=require(_0x17b5('0x6'))['db'];var utils=require(_0x17b5('0x7'));var logger=require('../../config/logger')(_0x17b5('0x8'));var config=require(_0x17b5('0x9'));var jayson=require(_0x17b5('0xa'));var client=jayson['client'][_0x17b5('0xb')]({'port':0x232a});config[_0x17b5('0xc')]=_[_0x17b5('0xd')](config[_0x17b5('0xc')],{'host':_0x17b5('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x17b5('0xc')]));require(_0x17b5('0xf'))[_0x17b5('0x10')](socket);function respondWithRpcPromise(_0x227896,_0x375df5,_0x1c63da){return new BPromise(function(_0x141e02,_0x16a8c9){return client[_0x17b5('0x11')](_0x227896,_0x1c63da)[_0x17b5('0x12')](function(_0x54b9b3){logger[_0x17b5('0x13')](_0x17b5('0x14'),_0x375df5,'request\x20sent');logger['debug'](_0x17b5('0x15'),_0x375df5,_0x17b5('0x16'),JSON[_0x17b5('0x17')](_0x54b9b3));if(_0x54b9b3[_0x17b5('0x18')]){if(_0x54b9b3[_0x17b5('0x18')][_0x17b5('0x19')]===0x1f4){logger['error']('FaxQueue,\x20%s,\x20%s',_0x375df5,_0x54b9b3['error']['message']);return _0x16a8c9(_0x54b9b3['error'][_0x17b5('0x1a')]);}logger[_0x17b5('0x18')](_0x17b5('0x14'),_0x375df5,_0x54b9b3[_0x17b5('0x18')][_0x17b5('0x1a')]);return _0x141e02(_0x54b9b3['error'][_0x17b5('0x1a')]);}else{logger[_0x17b5('0x13')](_0x17b5('0x14'),_0x375df5,'request\x20sent');_0x141e02(_0x54b9b3[_0x17b5('0x1b')]['message']);}})[_0x17b5('0x1c')](function(_0x10e88c){logger['error'](_0x17b5('0x14'),_0x375df5,_0x10e88c);_0x16a8c9(_0x10e88c);});});}exports[_0x17b5('0x1d')]=function(_0x6e6ecf){var _0x5c454b=this;return new Promise(function(_0x4f69e9,_0x399825){return db[_0x17b5('0x1e')][_0x17b5('0x1f')]({'raw':_0x6e6ecf[_0x17b5('0x20')]?_0x6e6ecf['options'][_0x17b5('0x21')]===undefined?!![]:![]:!![],'where':_0x6e6ecf[_0x17b5('0x20')]?_0x6e6ecf[_0x17b5('0x20')][_0x17b5('0x22')]||null:null,'attributes':_0x6e6ecf['options']?_0x6e6ecf['options']['attributes']||null:null,'limit':_0x6e6ecf[_0x17b5('0x20')]?_0x6e6ecf[_0x17b5('0x20')][_0x17b5('0x23')]||null:null,'include':_0x6e6ecf[_0x17b5('0x20')]?_0x6e6ecf['options']['include']?_[_0x17b5('0x24')](_0x6e6ecf[_0x17b5('0x20')][_0x17b5('0x25')],function(_0x54405c){return{'model':db[_0x54405c[_0x17b5('0x26')]],'as':_0x54405c['as'],'attributes':_0x54405c[_0x17b5('0x27')],'include':_0x54405c[_0x17b5('0x25')]?_['map'](_0x54405c[_0x17b5('0x25')],function(_0x27f345){return{'model':db[_0x27f345['model']],'as':_0x27f345['as'],'attributes':_0x27f345[_0x17b5('0x27')],'include':_0x27f345['include']?_[_0x17b5('0x24')](_0x27f345['include'],function(_0x53c788){return{'model':db[_0x53c788[_0x17b5('0x26')]],'as':_0x53c788['as'],'attributes':_0x53c788['attributes']};}):[]};}):[]};}):[]:[]})[_0x17b5('0x12')](function(_0x414e52){logger[_0x17b5('0x13')](_0x17b5('0x1d'),_0x6e6ecf);logger['debug'](_0x17b5('0x1d'),_0x6e6ecf,JSON[_0x17b5('0x17')](_0x414e52));_0x4f69e9(_0x414e52);})['catch'](function(_0x3970d3){logger[_0x17b5('0x18')](_0x17b5('0x1d'),_0x3970d3['message'],_0x6e6ecf);_0x399825(_0x5c454b[_0x17b5('0x18')](0x1f4,_0x3970d3[_0x17b5('0x1a')]));});});};exports['ShowFaxQueue']=function(_0x160286){var _0x3408bf=this;return new Promise(function(_0x5ef980,_0x34bffb){return db[_0x17b5('0x1e')][_0x17b5('0x28')]({'raw':_0x160286['options']?_0x160286[_0x17b5('0x20')][_0x17b5('0x21')]===undefined?!![]:![]:!![],'where':_0x160286[_0x17b5('0x20')]?_0x160286[_0x17b5('0x20')]['where']||null:null,'attributes':_0x160286[_0x17b5('0x20')]?_0x160286[_0x17b5('0x20')][_0x17b5('0x27')]||null:null,'include':_0x160286[_0x17b5('0x20')]?_0x160286['options'][_0x17b5('0x25')]?_[_0x17b5('0x24')](_0x160286[_0x17b5('0x20')]['include'],function(_0x4df6b2){return{'model':db[_0x4df6b2[_0x17b5('0x26')]],'as':_0x4df6b2['as'],'attributes':_0x4df6b2[_0x17b5('0x27')],'include':_0x4df6b2[_0x17b5('0x25')]?_['map'](_0x4df6b2[_0x17b5('0x25')],function(_0x49db73){return{'model':db[_0x49db73[_0x17b5('0x26')]],'as':_0x49db73['as'],'attributes':_0x49db73['attributes'],'include':_0x49db73[_0x17b5('0x25')]?_[_0x17b5('0x24')](_0x49db73['include'],function(_0x5549ee){return{'model':db[_0x5549ee['model']],'as':_0x5549ee['as'],'attributes':_0x5549ee['attributes']};}):[]};}):[]};}):[]:[]})[_0x17b5('0x12')](function(_0x4bf40b){logger[_0x17b5('0x13')](_0x17b5('0x29'),_0x160286);logger['debug'](_0x17b5('0x29'),_0x160286,JSON[_0x17b5('0x17')](_0x4bf40b));_0x5ef980(_0x4bf40b);})[_0x17b5('0x1c')](function(_0x4c1d2e){logger['error']('ShowFaxQueue',_0x4c1d2e['message'],_0x160286);_0x34bffb(_0x3408bf[_0x17b5('0x18')](0x1f4,_0x4c1d2e[_0x17b5('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index cbcb10c..069e169 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 _0xc164=['remove','update','emit','removeListener','register','faxQueue:','save'];(function(_0x579420,_0xe6de69){var _0x56c4b4=function(_0x2987f8){while(--_0x2987f8){_0x579420['push'](_0x579420['shift']());}};_0x56c4b4(++_0xe6de69);}(_0xc164,0x18e));var _0x4c16=function(_0x185aa6,_0x53c49e){_0x185aa6=_0x185aa6-0x0;var _0x2f786f=_0xc164[_0x185aa6];return _0x2f786f;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x4c16('0x0'),_0x4c16('0x1'),_0x4c16('0x2')];function createListener(_0x1cb967,_0x6e91f0){return function(_0x3edc2a){_0x6e91f0[_0x4c16('0x3')](_0x1cb967,_0x3edc2a);};}function removeListener(_0x3c12e5,_0x51f207){return function(){FaxQueueEvents[_0x4c16('0x4')](_0x3c12e5,_0x51f207);};}exports[_0x4c16('0x5')]=function(_0x37810f){for(var _0x45bcd5=0x0,_0x10525f=events['length'];_0x45bcd5<_0x10525f;_0x45bcd5++){var _0xa6488e=events[_0x45bcd5];var _0x236aa7=createListener(_0x4c16('0x6')+_0xa6488e,_0x37810f);FaxQueueEvents['on'](_0xa6488e,_0x236aa7);}}; \ No newline at end of file +var _0x8d19=['./faxQueue.events','save','update','emit','removeListener','length','faxQueue:'];(function(_0x419061,_0x163dea){var _0x407329=function(_0x52f29d){while(--_0x52f29d){_0x419061['push'](_0x419061['shift']());}};_0x407329(++_0x163dea);}(_0x8d19,0x142));var _0x98d1=function(_0x210718,_0x247b55){_0x210718=_0x210718-0x0;var _0x541bfc=_0x8d19[_0x210718];return _0x541bfc;};'use strict';var FaxQueueEvents=require(_0x98d1('0x0'));var events=[_0x98d1('0x1'),'remove',_0x98d1('0x2')];function createListener(_0x3e5d36,_0x1ff67a){return function(_0x428e7e){_0x1ff67a[_0x98d1('0x3')](_0x3e5d36,_0x428e7e);};}function removeListener(_0xfcfe7b,_0x1f0517){return function(){FaxQueueEvents[_0x98d1('0x4')](_0xfcfe7b,_0x1f0517);};}exports['register']=function(_0x5be1df){for(var _0x497392=0x0,_0x3acff4=events[_0x98d1('0x5')];_0x497392<_0x3acff4;_0x497392++){var _0x159547=events[_0x497392];var _0x462f5f=createListener(_0x98d1('0x6')+_0x159547,_0x5be1df);FaxQueueEvents['on'](_0x159547,_0x462f5f);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index cf98e03..04c84b5 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 _0x1a37=['/describe','isAuthenticated','show','/:id/members','getMembers','/:id/teams','getAgents','post','create','addTeams','/:id/users','addAgents','put','update','delete','/:id','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0xc37e08,_0x274141){var _0x457aff=function(_0x301551){while(--_0x301551){_0xc37e08['push'](_0xc37e08['shift']());}};_0x457aff(++_0x274141);}(_0x1a37,0xb4));var _0x71a3=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1a37[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var path=require(_0x71a3('0x2'));var timeout=require(_0x71a3('0x3'));var express=require(_0x71a3('0x4'));var router=express[_0x71a3('0x5')]();var fs_extra=require(_0x71a3('0x6'));var auth=require(_0x71a3('0x7'));var interaction=require(_0x71a3('0x8'));var config=require(_0x71a3('0x9'));var controller=require('./faxQueue.controller');router[_0x71a3('0xa')]('/',auth['isAuthenticated'](),controller[_0x71a3('0xb')]);router[_0x71a3('0xa')](_0x71a3('0xc'),auth[_0x71a3('0xd')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x71a3('0xe')]);router[_0x71a3('0xa')](_0x71a3('0xf'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x10')]);router[_0x71a3('0xa')](_0x71a3('0x11'),auth[_0x71a3('0xd')](),controller['getTeams']);router['get']('/:id/users',auth[_0x71a3('0xd')](),controller[_0x71a3('0x12')]);router[_0x71a3('0x13')]('/',auth[_0x71a3('0xd')](),controller[_0x71a3('0x14')]);router[_0x71a3('0x13')](_0x71a3('0x11'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x15')]);router[_0x71a3('0x13')](_0x71a3('0x16'),auth['isAuthenticated'](),controller[_0x71a3('0x17')]);router[_0x71a3('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x71a3('0x19')]);router[_0x71a3('0x1a')](_0x71a3('0x1b'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x1c')]);router[_0x71a3('0x1a')]('/:id/teams',auth[_0x71a3('0xd')](),controller[_0x71a3('0x1d')]);router['delete']('/:id/users',auth[_0x71a3('0xd')](),controller[_0x71a3('0x1e')]);module[_0x71a3('0x1f')]=router; \ No newline at end of file +var _0x4745=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','index','isAuthenticated','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','update','delete','destroy','removeTeams','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x35233f,_0x409b6b){var _0xc482ff=function(_0xc2e8e4){while(--_0xc2e8e4){_0x35233f['push'](_0x35233f['shift']());}};_0xc482ff(++_0x409b6b);}(_0x4745,0x1e7));var _0x5474=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0x4745[_0x102e37];return _0x35a07c;};'use strict';var multer=require(_0x5474('0x0'));var util=require(_0x5474('0x1'));var path=require(_0x5474('0x2'));var timeout=require(_0x5474('0x3'));var express=require(_0x5474('0x4'));var router=express[_0x5474('0x5')]();var fs_extra=require(_0x5474('0x6'));var auth=require(_0x5474('0x7'));var interaction=require(_0x5474('0x8'));var config=require(_0x5474('0x9'));var controller=require(_0x5474('0xa'));router[_0x5474('0xb')]('/',auth['isAuthenticated'](),controller[_0x5474('0xc')]);router[_0x5474('0xb')]('/describe',auth[_0x5474('0xd')](),controller['describe']);router[_0x5474('0xb')](_0x5474('0xe'),auth['isAuthenticated'](),controller[_0x5474('0xf')]);router[_0x5474('0xb')](_0x5474('0x10'),auth[_0x5474('0xd')](),controller[_0x5474('0x11')]);router[_0x5474('0xb')](_0x5474('0x12'),auth[_0x5474('0xd')](),controller['getTeams']);router[_0x5474('0xb')](_0x5474('0x13'),auth[_0x5474('0xd')](),controller[_0x5474('0x14')]);router[_0x5474('0x15')]('/',auth[_0x5474('0xd')](),controller[_0x5474('0x16')]);router[_0x5474('0x15')](_0x5474('0x12'),auth['isAuthenticated'](),controller[_0x5474('0x17')]);router[_0x5474('0x15')](_0x5474('0x13'),auth[_0x5474('0xd')](),controller['addAgents']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x5474('0x18')]);router[_0x5474('0x19')](_0x5474('0xe'),auth['isAuthenticated'](),controller[_0x5474('0x1a')]);router[_0x5474('0x19')]('/:id/teams',auth[_0x5474('0xd')](),controller[_0x5474('0x1b')]);router[_0x5474('0x19')](_0x5474('0x13'),auth[_0x5474('0xd')](),controller['removeAgents']);module[_0x5474('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index a2438f8..e80f61d 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 _0x3a16=['moment','STRING','DATE'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3a16,0x192));var _0x63a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3a16[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x63a1('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x63a1('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x63a1('0x1')]},'joinAt':{'type':Sequelize[_0x63a1('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x63a1('0x2')]},'exitAt':{'type':Sequelize[_0x63a1('0x2')]},'reason':{'type':Sequelize[_0x63a1('0x1')]}}; \ No newline at end of file +var _0xbac0=['exports','STRING','DATE','moment'];(function(_0x108a83,_0x4bab1d){var _0x1c1785=function(_0x4c227e){while(--_0x4c227e){_0x108a83['push'](_0x108a83['shift']());}};_0x1c1785(++_0x4bab1d);}(_0xbac0,0x12b));var _0x0bac=function(_0xb1b616,_0x3b9023){_0xb1b616=_0xb1b616-0x0;var _0x1259b0=_0xbac0[_0xb1b616];return _0x1259b0;};'use strict';var moment=require(_0x0bac('0x0'));var Sequelize=require('sequelize');module[_0x0bac('0x1')]={'uniqueid':{'type':Sequelize[_0x0bac('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x0bac('0x2')]},'joinAt':{'type':Sequelize[_0x0bac('0x3')]},'leaveAt':{'type':Sequelize[_0x0bac('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x0bac('0x3')]},'reason':{'type':Sequelize[_0x0bac('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 247a158..6dc960f 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 _0x195e=['includeAll','include','findAll','catch','show','keys','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','FaxQueueReport','rawAttributes','fieldName','type','key','map','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','options'];(function(_0x1d2064,_0x47aef1){var _0x269138=function(_0xe10ada){while(--_0xe10ada){_0x1d2064['push'](_0x1d2064['shift']());}};_0x269138(++_0x47aef1);}(_0x195e,0xfb));var _0xe195=function(_0x276403,_0x4c37ed){_0x276403=_0x276403-0x0;var _0x3958d9=_0x195e[_0x276403];return _0x3958d9;};'use strict';var emlformat=require(_0xe195('0x0'));var rimraf=require(_0xe195('0x1'));var zipdir=require(_0xe195('0x2'));var jsonpatch=require(_0xe195('0x3'));var rp=require(_0xe195('0x4'));var moment=require(_0xe195('0x5'));var BPromise=require(_0xe195('0x6'));var Mustache=require(_0xe195('0x7'));var util=require(_0xe195('0x8'));var path=require(_0xe195('0x9'));var sox=require(_0xe195('0xa'));var csv=require(_0xe195('0xb'));var ejs=require(_0xe195('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe195('0xd'));var squel=require(_0xe195('0xe'));var crypto=require(_0xe195('0xf'));var jsforce=require(_0xe195('0x10'));var deskjs=require(_0xe195('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe195('0x12'));var authService=require(_0xe195('0x13'));var qs=require(_0xe195('0x14'));var as=require(_0xe195('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe195('0x16'))(_0xe195('0x17'));var utils=require(_0xe195('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xe195('0x19'));var db=require(_0xe195('0x1a'))['db'];function respondWithStatusCode(_0x5ae615,_0x3da7d9){_0x3da7d9=_0x3da7d9||0xcc;return function(_0x12fa0f){if(_0x12fa0f){return _0x5ae615[_0xe195('0x1b')](_0x3da7d9);}return _0x5ae615[_0xe195('0x1c')](_0x3da7d9)['end']();};}function respondWithResult(_0x52217d,_0x2e82d1){_0x2e82d1=_0x2e82d1||0xc8;return function(_0x555a6a){if(_0x555a6a){return _0x52217d['status'](_0x2e82d1)[_0xe195('0x1d')](_0x555a6a);}};}function respondWithFilteredResult(_0x5c444f,_0x232c57){return function(_0x542ac7){if(_0x542ac7){var _0x534879=typeof _0x232c57[_0xe195('0x1e')]===_0xe195('0x1f')&&typeof _0x232c57[_0xe195('0x20')]===_0xe195('0x1f');var _0x3a042f=_0x542ac7[_0xe195('0x21')];var _0x4784b1=_0x534879?0x0:_0x232c57[_0xe195('0x1e')];var _0x9c8ba5=_0x534879?_0x542ac7[_0xe195('0x21')]:_0x232c57['offset']+_0x232c57[_0xe195('0x20')];var _0x317d8b;if(_0x9c8ba5>=_0x3a042f){_0x9c8ba5=_0x3a042f;_0x317d8b=0xc8;}else{_0x317d8b=0xce;}_0x5c444f[_0xe195('0x1c')](_0x317d8b);return _0x5c444f[_0xe195('0x22')](_0xe195('0x23'),_0x4784b1+'-'+_0x9c8ba5+'/'+_0x3a042f)[_0xe195('0x1d')](_0x542ac7);}return null;};}function patchUpdates(_0x496722){return function(_0x1c5ac8){try{jsonpatch[_0xe195('0x24')](_0x1c5ac8,_0x496722,!![]);}catch(_0x334b4a){return BPromise[_0xe195('0x25')](_0x334b4a);}return _0x1c5ac8['save']();};}function saveUpdates(_0x4dab1a,_0x4e5f13){return function(_0x57ee33){if(_0x57ee33){return _0x57ee33[_0xe195('0x26')](_0x4dab1a)[_0xe195('0x27')](function(_0x2cb019){return _0x2cb019;});}return null;};}function removeEntity(_0x199148,_0x46b15b){return function(_0x40c6a2){if(_0x40c6a2){return _0x40c6a2[_0xe195('0x28')]()[_0xe195('0x27')](function(){_0x199148[_0xe195('0x1c')](0xcc)[_0xe195('0x29')]();});}};}function handleEntityNotFound(_0x55be2d,_0x36a566){return function(_0x58ea75){if(!_0x58ea75){_0x55be2d[_0xe195('0x1b')](0x194);}return _0x58ea75;};}function handleError(_0x334cb8,_0x147563){_0x147563=_0x147563||0x1f4;return function(_0x2a0504){logger[_0xe195('0x2a')](_0x2a0504[_0xe195('0x2b')]);if(_0x2a0504[_0xe195('0x2c')]){delete _0x2a0504[_0xe195('0x2c')];}_0x334cb8[_0xe195('0x1c')](_0x147563)[_0xe195('0x2d')](_0x2a0504);};}exports['index']=function(_0x33a08d,_0x3e228f){var _0x3199d0={},_0x1f72a2={},_0x283516={'count':0x0,'rows':[]};var _0x4e4d30=_['map'](db[_0xe195('0x2e')][_0xe195('0x2f')],function(_0x46b6f2){return{'name':_0x46b6f2[_0xe195('0x30')],'type':_0x46b6f2[_0xe195('0x31')][_0xe195('0x32')]};});_0x1f72a2['model']=_[_0xe195('0x33')](_0x4e4d30,_0xe195('0x2c'));_0x1f72a2[_0xe195('0x34')]=_['keys'](_0x33a08d[_0xe195('0x34')]);_0x1f72a2['filters']=_[_0xe195('0x35')](_0x1f72a2[_0xe195('0x36')],_0x1f72a2['query']);_0x3199d0[_0xe195('0x37')]=_[_0xe195('0x35')](_0x1f72a2[_0xe195('0x36')],qs['fields'](_0x33a08d[_0xe195('0x34')][_0xe195('0x38')]));_0x3199d0[_0xe195('0x37')]=_0x3199d0[_0xe195('0x37')][_0xe195('0x39')]?_0x3199d0[_0xe195('0x37')]:_0x1f72a2['model'];if(!_0x33a08d[_0xe195('0x34')][_0xe195('0x3a')](_0xe195('0x3b'))){_0x3199d0[_0xe195('0x20')]=qs[_0xe195('0x20')](_0x33a08d[_0xe195('0x34')][_0xe195('0x20')]);_0x3199d0['offset']=qs[_0xe195('0x1e')](_0x33a08d[_0xe195('0x34')]['offset']);}_0x3199d0[_0xe195('0x3c')]=qs[_0xe195('0x3d')](_0x33a08d['query'][_0xe195('0x3d')]);_0x3199d0['where']=qs[_0xe195('0x3e')](_[_0xe195('0x3f')](_0x33a08d[_0xe195('0x34')],_0x1f72a2[_0xe195('0x3e')]),_0x4e4d30);if(_0x33a08d[_0xe195('0x34')][_0xe195('0x40')]){_0x3199d0['where']=_[_0xe195('0x41')](_0x3199d0[_0xe195('0x42')],{'$or':_[_0xe195('0x33')](_0x4e4d30,function(_0x4d5b04){if(_0x4d5b04[_0xe195('0x31')]!==_0xe195('0x43')){var _0x5207e3={};_0x5207e3[_0x4d5b04[_0xe195('0x2c')]]={'$like':'%'+_0x33a08d[_0xe195('0x34')]['filter']+'%'};return _0x5207e3;}})});}_0x3199d0=_[_0xe195('0x41')]({},_0x3199d0,_0x33a08d[_0xe195('0x44')]);var _0x28ac42={'where':_0x3199d0['where']};return db[_0xe195('0x2e')][_0xe195('0x21')](_0x28ac42)[_0xe195('0x27')](function(_0x2ce54e){_0x283516[_0xe195('0x21')]=_0x2ce54e;if(_0x33a08d[_0xe195('0x34')][_0xe195('0x45')]){_0x3199d0[_0xe195('0x46')]=[{'all':!![]}];}return db[_0xe195('0x2e')][_0xe195('0x47')](_0x3199d0);})[_0xe195('0x27')](function(_0xff05fc){_0x283516['rows']=_0xff05fc;return _0x283516;})[_0xe195('0x27')](respondWithFilteredResult(_0x3e228f,_0x3199d0))[_0xe195('0x48')](handleError(_0x3e228f,null));};exports[_0xe195('0x49')]=function(_0x42a856,_0x15293a){var _0x4f66cd={'raw':!![],'where':{'id':_0x42a856['params']['id']}},_0x5d1059={};_0x5d1059['model']=_[_0xe195('0x4a')](db['FaxQueueReport'][_0xe195('0x2f')]);_0x5d1059['query']=_['keys'](_0x42a856[_0xe195('0x34')]);_0x5d1059[_0xe195('0x3e')]=_[_0xe195('0x35')](_0x5d1059[_0xe195('0x36')],_0x5d1059[_0xe195('0x34')]);_0x4f66cd[_0xe195('0x37')]=_[_0xe195('0x35')](_0x5d1059[_0xe195('0x36')],qs['fields'](_0x42a856['query'][_0xe195('0x38')]));_0x4f66cd[_0xe195('0x37')]=_0x4f66cd['attributes'][_0xe195('0x39')]?_0x4f66cd[_0xe195('0x37')]:_0x5d1059[_0xe195('0x36')];if(_0x42a856[_0xe195('0x34')][_0xe195('0x45')]){_0x4f66cd[_0xe195('0x46')]=[{'all':!![]}];}_0x4f66cd=_[_0xe195('0x41')]({},_0x4f66cd,_0x42a856[_0xe195('0x44')]);return db[_0xe195('0x2e')][_0xe195('0x4b')](_0x4f66cd)[_0xe195('0x27')](handleEntityNotFound(_0x15293a,null))[_0xe195('0x27')](respondWithResult(_0x15293a,null))['catch'](handleError(_0x15293a,null));};exports[_0xe195('0x4c')]=function(_0x3dc748,_0x1ebb32){return db[_0xe195('0x2e')][_0xe195('0x4c')](_0x3dc748[_0xe195('0x4d')],{})[_0xe195('0x27')](respondWithResult(_0x1ebb32,0xc9))[_0xe195('0x48')](handleError(_0x1ebb32,null));};exports[_0xe195('0x26')]=function(_0x19e744,_0x2b3d9b){if(_0x19e744['body']['id']){delete _0x19e744[_0xe195('0x4d')]['id'];}return db['FaxQueueReport'][_0xe195('0x4b')]({'where':{'id':_0x19e744[_0xe195('0x4e')]['id']}})[_0xe195('0x27')](handleEntityNotFound(_0x2b3d9b,null))['then'](saveUpdates(_0x19e744['body'],null))[_0xe195('0x27')](respondWithResult(_0x2b3d9b,null))[_0xe195('0x48')](handleError(_0x2b3d9b,null));};exports[_0xe195('0x28')]=function(_0x11aec8,_0x332126){return db[_0xe195('0x2e')][_0xe195('0x4b')]({'where':{'id':_0x11aec8[_0xe195('0x4e')]['id']}})[_0xe195('0x27')](handleEntityNotFound(_0x332126,null))[_0xe195('0x27')](removeEntity(_0x332126,null))[_0xe195('0x48')](handleError(_0x332126,null));};exports[_0xe195('0x4f')]=function(_0x68355f,_0x1b500e){return db[_0xe195('0x2e')][_0xe195('0x4f')]()[_0xe195('0x27')](respondWithResult(_0x1b500e,null))[_0xe195('0x48')](handleError(_0x1b500e,null));}; \ No newline at end of file +var _0x4517=['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/license/util','sendStatus','status','undefined','limit','count','offset','Content-Range','json','apply','reject','update','then','destroy','end','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','nolimit','sort','filters','filter','where','merge','options','include','show','params','catch','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0x4517,0x112));var _0x7451=function(_0x2a2b03,_0x5f56cd){_0x2a2b03=_0x2a2b03-0x0;var _0x24a88e=_0x4517[_0x2a2b03];return _0x24a88e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7451('0x0'));var zipdir=require(_0x7451('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7451('0x2'));var moment=require(_0x7451('0x3'));var BPromise=require(_0x7451('0x4'));var Mustache=require(_0x7451('0x5'));var util=require(_0x7451('0x6'));var path=require(_0x7451('0x7'));var sox=require(_0x7451('0x8'));var csv=require(_0x7451('0x9'));var ejs=require(_0x7451('0xa'));var fs=require('fs');var fs_extra=require(_0x7451('0xb'));var _=require(_0x7451('0xc'));var squel=require(_0x7451('0xd'));var crypto=require(_0x7451('0xe'));var jsforce=require(_0x7451('0xf'));var deskjs=require(_0x7451('0x10'));var toCsv=require(_0x7451('0x9'));var querystring=require(_0x7451('0x11'));var Papa=require('papaparse');var Redis=require(_0x7451('0x12'));var authService=require(_0x7451('0x13'));var qs=require(_0x7451('0x14'));var as=require(_0x7451('0x15'));var hardwareService=require(_0x7451('0x16'));var logger=require(_0x7451('0x17'))(_0x7451('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7451('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x450463,_0x2cb40b){_0x2cb40b=_0x2cb40b||0xcc;return function(_0x4a14dc){if(_0x4a14dc){return _0x450463[_0x7451('0x1a')](_0x2cb40b);}return _0x450463[_0x7451('0x1b')](_0x2cb40b)['end']();};}function respondWithResult(_0x46811e,_0x282128){_0x282128=_0x282128||0xc8;return function(_0x110ed6){if(_0x110ed6){return _0x46811e[_0x7451('0x1b')](_0x282128)['json'](_0x110ed6);}};}function respondWithFilteredResult(_0x357ea9,_0x313385){return function(_0x408336){if(_0x408336){var _0x58c0cd=typeof _0x313385['offset']===_0x7451('0x1c')&&typeof _0x313385[_0x7451('0x1d')]===_0x7451('0x1c');var _0xa8a121=_0x408336[_0x7451('0x1e')];var _0xd47ee4=_0x58c0cd?0x0:_0x313385[_0x7451('0x1f')];var _0x1120b1=_0x58c0cd?_0x408336[_0x7451('0x1e')]:_0x313385['offset']+_0x313385[_0x7451('0x1d')];var _0x32e250;if(_0x1120b1>=_0xa8a121){_0x1120b1=_0xa8a121;_0x32e250=0xc8;}else{_0x32e250=0xce;}_0x357ea9[_0x7451('0x1b')](_0x32e250);return _0x357ea9['set'](_0x7451('0x20'),_0xd47ee4+'-'+_0x1120b1+'/'+_0xa8a121)[_0x7451('0x21')](_0x408336);}return null;};}function patchUpdates(_0x3ffb08){return function(_0x3b5d59){try{jsonpatch[_0x7451('0x22')](_0x3b5d59,_0x3ffb08,!![]);}catch(_0x293e29){return BPromise[_0x7451('0x23')](_0x293e29);}return _0x3b5d59['save']();};}function saveUpdates(_0x3a0c1e,_0x309be0){return function(_0x561e12){if(_0x561e12){return _0x561e12[_0x7451('0x24')](_0x3a0c1e)[_0x7451('0x25')](function(_0x2962f8){return _0x2962f8;});}return null;};}function removeEntity(_0x57cc15,_0x19e33b){return function(_0x21dd67){if(_0x21dd67){return _0x21dd67[_0x7451('0x26')]()[_0x7451('0x25')](function(){_0x57cc15[_0x7451('0x1b')](0xcc)[_0x7451('0x27')]();});}};}function handleEntityNotFound(_0x3c56f1,_0xdfc7d1){return function(_0x3c4eae){if(!_0x3c4eae){_0x3c56f1['sendStatus'](0x194);}return _0x3c4eae;};}function handleError(_0x328d0b,_0x2b8a8b){_0x2b8a8b=_0x2b8a8b||0x1f4;return function(_0x5df311){logger['error'](_0x5df311[_0x7451('0x28')]);if(_0x5df311[_0x7451('0x29')]){delete _0x5df311[_0x7451('0x29')];}_0x328d0b[_0x7451('0x1b')](_0x2b8a8b)[_0x7451('0x2a')](_0x5df311);};}exports[_0x7451('0x2b')]=function(_0x4b5b26,_0x3827c9){var _0x4c3ac4={},_0x1b960f={},_0x6c10ee={'count':0x0,'rows':[]};var _0x4d99f3=_[_0x7451('0x2c')](db[_0x7451('0x2d')][_0x7451('0x2e')],function(_0x3a397e){return{'name':_0x3a397e[_0x7451('0x2f')],'type':_0x3a397e['type'][_0x7451('0x30')]};});_0x1b960f[_0x7451('0x31')]=_[_0x7451('0x2c')](_0x4d99f3,'name');_0x1b960f[_0x7451('0x32')]=_[_0x7451('0x33')](_0x4b5b26['query']);_0x1b960f['filters']=_[_0x7451('0x34')](_0x1b960f[_0x7451('0x31')],_0x1b960f['query']);_0x4c3ac4['attributes']=_[_0x7451('0x34')](_0x1b960f[_0x7451('0x31')],qs[_0x7451('0x35')](_0x4b5b26[_0x7451('0x32')][_0x7451('0x35')]));_0x4c3ac4[_0x7451('0x36')]=_0x4c3ac4[_0x7451('0x36')][_0x7451('0x37')]?_0x4c3ac4['attributes']:_0x1b960f[_0x7451('0x31')];if(!_0x4b5b26[_0x7451('0x32')]['hasOwnProperty'](_0x7451('0x38'))){_0x4c3ac4[_0x7451('0x1d')]=qs[_0x7451('0x1d')](_0x4b5b26[_0x7451('0x32')][_0x7451('0x1d')]);_0x4c3ac4[_0x7451('0x1f')]=qs['offset'](_0x4b5b26[_0x7451('0x32')][_0x7451('0x1f')]);}_0x4c3ac4['order']=qs[_0x7451('0x39')](_0x4b5b26[_0x7451('0x32')]['sort']);_0x4c3ac4['where']=qs['filters'](_['pick'](_0x4b5b26['query'],_0x1b960f[_0x7451('0x3a')]),_0x4d99f3);if(_0x4b5b26[_0x7451('0x32')][_0x7451('0x3b')]){_0x4c3ac4[_0x7451('0x3c')]=_[_0x7451('0x3d')](_0x4c3ac4['where'],{'$or':_['map'](_0x4d99f3,function(_0x597eb1){if(_0x597eb1['type']!=='VIRTUAL'){var _0x35b102={};_0x35b102[_0x597eb1[_0x7451('0x29')]]={'$like':'%'+_0x4b5b26[_0x7451('0x32')][_0x7451('0x3b')]+'%'};return _0x35b102;}})});}_0x4c3ac4=_[_0x7451('0x3d')]({},_0x4c3ac4,_0x4b5b26[_0x7451('0x3e')]);var _0xdbbc08={'where':_0x4c3ac4[_0x7451('0x3c')]};return db[_0x7451('0x2d')][_0x7451('0x1e')](_0xdbbc08)[_0x7451('0x25')](function(_0x52cd2d){_0x6c10ee['count']=_0x52cd2d;if(_0x4b5b26[_0x7451('0x32')]['includeAll']){_0x4c3ac4[_0x7451('0x3f')]=[{'all':!![]}];}return db[_0x7451('0x2d')]['findAll'](_0x4c3ac4);})['then'](function(_0x1f5bf3){_0x6c10ee['rows']=_0x1f5bf3;return _0x6c10ee;})[_0x7451('0x25')](respondWithFilteredResult(_0x3827c9,_0x4c3ac4))['catch'](handleError(_0x3827c9,null));};exports[_0x7451('0x40')]=function(_0x2042c5,_0x543d08){var _0x853e14={'raw':!![],'where':{'id':_0x2042c5[_0x7451('0x41')]['id']}},_0x4c326d={};_0x4c326d[_0x7451('0x31')]=_[_0x7451('0x33')](db[_0x7451('0x2d')][_0x7451('0x2e')]);_0x4c326d[_0x7451('0x32')]=_[_0x7451('0x33')](_0x2042c5[_0x7451('0x32')]);_0x4c326d[_0x7451('0x3a')]=_[_0x7451('0x34')](_0x4c326d[_0x7451('0x31')],_0x4c326d[_0x7451('0x32')]);_0x853e14[_0x7451('0x36')]=_[_0x7451('0x34')](_0x4c326d['model'],qs[_0x7451('0x35')](_0x2042c5[_0x7451('0x32')][_0x7451('0x35')]));_0x853e14[_0x7451('0x36')]=_0x853e14['attributes'][_0x7451('0x37')]?_0x853e14['attributes']:_0x4c326d['model'];if(_0x2042c5['query']['includeAll']){_0x853e14['include']=[{'all':!![]}];}_0x853e14=_[_0x7451('0x3d')]({},_0x853e14,_0x2042c5[_0x7451('0x3e')]);return db[_0x7451('0x2d')]['find'](_0x853e14)[_0x7451('0x25')](handleEntityNotFound(_0x543d08,null))[_0x7451('0x25')](respondWithResult(_0x543d08,null))[_0x7451('0x42')](handleError(_0x543d08,null));};exports[_0x7451('0x43')]=function(_0x32ce4a,_0x2441b5){return db[_0x7451('0x2d')][_0x7451('0x43')](_0x32ce4a[_0x7451('0x44')],{})['then'](respondWithResult(_0x2441b5,0xc9))['catch'](handleError(_0x2441b5,null));};exports['update']=function(_0xd26beb,_0x3acf1d){if(_0xd26beb[_0x7451('0x44')]['id']){delete _0xd26beb['body']['id'];}return db['FaxQueueReport']['find']({'where':{'id':_0xd26beb[_0x7451('0x41')]['id']}})['then'](handleEntityNotFound(_0x3acf1d,null))['then'](saveUpdates(_0xd26beb[_0x7451('0x44')],null))[_0x7451('0x25')](respondWithResult(_0x3acf1d,null))[_0x7451('0x42')](handleError(_0x3acf1d,null));};exports[_0x7451('0x26')]=function(_0x24e028,_0x4a9690){return db[_0x7451('0x2d')]['find']({'where':{'id':_0x24e028[_0x7451('0x41')]['id']}})[_0x7451('0x25')](handleEntityNotFound(_0x4a9690,null))[_0x7451('0x25')](removeEntity(_0x4a9690,null))[_0x7451('0x42')](handleError(_0x4a9690,null));};exports[_0x7451('0x45')]=function(_0xcf0d2a,_0x42a8e1){return db[_0x7451('0x2d')][_0x7451('0x45')]()['then'](respondWithResult(_0x42a8e1,null))['catch'](handleError(_0x42a8e1,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index d20d9b4..d7e08f1 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(_0x1e7159,_0x15e3ed){var _0x2e0dd8=function(_0x7b088f){while(--_0x7b088f){_0x1e7159['push'](_0x1e7159['shift']());}};_0x2e0dd8(++_0x15e3ed);}(_0xe14b,0x93));var _0xbe14=function(_0x5000f8,_0x142d82){_0x5000f8=_0x5000f8-0x0;var _0xab04e7=_0xe14b[_0x5000f8];return _0xab04e7;};'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 _0x5fab=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','util','api'];(function(_0x47b337,_0xcca95b){var _0x2294e0=function(_0x25f8b0){while(--_0x25f8b0){_0x47b337['push'](_0x47b337['shift']());}};_0x2294e0(++_0xcca95b);}(_0x5fab,0x177));var _0xb5fa=function(_0x4c4664,_0x506a85){_0x4c4664=_0x4c4664-0x0;var _0x2920cf=_0x5fab[_0x4c4664];return _0x2920cf;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));module[_0xb5fa('0xa')]=function(_0x44df89,_0x4a0249){return _0x44df89['define'](_0xb5fa('0xb'),attributes,{'tableName':_0xb5fa('0xc'),'paranoid':![],'indexes':[{'name':_0xb5fa('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 3981d61..58b07e4 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 _0x4645=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxQueueReport','create','body','options','raw','info','UpdateFaxQueueReport','FaxQueueReport','where','attributes','limit','lodash'];(function(_0x181707,_0x47d753){var _0x1d2b7a=function(_0x508991){while(--_0x508991){_0x181707['push'](_0x181707['shift']());}};_0x1d2b7a(++_0x47d753);}(_0x4645,0xbf));var _0x5464=function(_0x166172,_0x42a171){_0x166172=_0x166172-0x0;var _0x312ea5=_0x4645[_0x166172];return _0x312ea5;};'use strict';var _=require(_0x5464('0x0'));var util=require('util');var moment=require(_0x5464('0x1'));var BPromise=require('bluebird');var rs=require(_0x5464('0x2'));var fs=require('fs');var Redis=require(_0x5464('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5464('0x4'));var logger=require(_0x5464('0x5'))(_0x5464('0x6'));var config=require(_0x5464('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5464('0x8')][_0x5464('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x694fb9,_0x59de7d,_0x194547){return new BPromise(function(_0x495057,_0x370f12){return client['request'](_0x694fb9,_0x194547)[_0x5464('0xa')](function(_0x4cb91a){logger['info'](_0x5464('0xb'),_0x59de7d,_0x5464('0xc'));logger[_0x5464('0xd')](_0x5464('0xe'),_0x59de7d,_0x5464('0xc'),JSON[_0x5464('0xf')](_0x4cb91a));if(_0x4cb91a[_0x5464('0x10')]){if(_0x4cb91a[_0x5464('0x10')][_0x5464('0x11')]===0x1f4){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x59de7d,_0x4cb91a['error'][_0x5464('0x12')]);return _0x370f12(_0x4cb91a[_0x5464('0x10')]['message']);}logger[_0x5464('0x10')](_0x5464('0xb'),_0x59de7d,_0x4cb91a[_0x5464('0x10')][_0x5464('0x12')]);return _0x495057(_0x4cb91a[_0x5464('0x10')][_0x5464('0x12')]);}else{logger['info'](_0x5464('0xb'),_0x59de7d,'request\x20sent');_0x495057(_0x4cb91a[_0x5464('0x13')]['message']);}})[_0x5464('0x14')](function(_0x1d45a5){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x59de7d,_0x1d45a5);_0x370f12(_0x1d45a5);});});}exports[_0x5464('0x15')]=function(_0x13245d){var _0x50824a=this;return new Promise(function(_0x4b1885,_0x14840b){return db['FaxQueueReport'][_0x5464('0x16')](_0x13245d[_0x5464('0x17')],{'raw':_0x13245d[_0x5464('0x18')]?_0x13245d[_0x5464('0x18')][_0x5464('0x19')]===undefined?!![]:![]:!![]})[_0x5464('0xa')](function(_0x1d94f1){logger[_0x5464('0x1a')](_0x5464('0x15'),_0x13245d);logger[_0x5464('0xd')](_0x5464('0x15'),_0x13245d,JSON[_0x5464('0xf')](_0x1d94f1));_0x4b1885(_0x1d94f1);})[_0x5464('0x14')](function(_0x4d9db3){logger[_0x5464('0x10')](_0x5464('0x15'),_0x4d9db3[_0x5464('0x12')],_0x13245d);_0x14840b(_0x50824a[_0x5464('0x10')](0x1f4,_0x4d9db3[_0x5464('0x12')]));});});};exports[_0x5464('0x1b')]=function(_0x529bea){var _0x4da2b0=this;return new Promise(function(_0x214127,_0x104fa5){return db[_0x5464('0x1c')]['update'](_0x529bea[_0x5464('0x17')],{'raw':_0x529bea[_0x5464('0x18')]?_0x529bea['options'][_0x5464('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x529bea['options']?_0x529bea[_0x5464('0x18')][_0x5464('0x1d')]||null:null,'attributes':_0x529bea[_0x5464('0x18')]?_0x529bea[_0x5464('0x18')][_0x5464('0x1e')]||null:null,'limit':_0x529bea['options']?_0x529bea[_0x5464('0x18')][_0x5464('0x1f')]||null:null})[_0x5464('0xa')](function(_0x425e17){logger['info'](_0x5464('0x1b'),_0x529bea);logger['debug'](_0x5464('0x1b'),_0x529bea,JSON[_0x5464('0xf')](_0x425e17));_0x214127(_0x425e17);})[_0x5464('0x14')](function(_0x5c13fb){logger[_0x5464('0x10')]('UpdateFaxQueueReport',_0x5c13fb[_0x5464('0x12')],_0x529bea);_0x104fa5(_0x4da2b0[_0x5464('0x10')](0x1f4,_0x5c13fb['message']));});});}; \ No newline at end of file +var _0x5a83=['body','options','raw','info','UpdateFaxQueueReport','FaxQueueReport','update','attributes','limit','lodash','util','randomstring','ioredis','../../config/utils','rpc','client','request','then','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','result','catch','CreateFaxQueueReport'];(function(_0x59ba1e,_0xf5d9af){var _0x23a081=function(_0x5f33a5){while(--_0x5f33a5){_0x59ba1e['push'](_0x59ba1e['shift']());}};_0x23a081(++_0xf5d9af);}(_0x5a83,0x1d9));var _0x35a8=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x5a83[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x35a8('0x0'));var util=require(_0x35a8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x35a8('0x2'));var fs=require('fs');var Redis=require(_0x35a8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x35a8('0x4'));var logger=require('../../config/logger')(_0x35a8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x35a8('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c828e,_0xdb745c,_0x5b54cc){return new BPromise(function(_0x4ddb92,_0x30b118){return client[_0x35a8('0x7')](_0x3c828e,_0x5b54cc)[_0x35a8('0x8')](function(_0xd93879){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0xdb745c,'request\x20sent');logger[_0x35a8('0x9')](_0x35a8('0xa'),_0xdb745c,_0x35a8('0xb'),JSON[_0x35a8('0xc')](_0xd93879));if(_0xd93879[_0x35a8('0xd')]){if(_0xd93879['error'][_0x35a8('0xe')]===0x1f4){logger[_0x35a8('0xd')](_0x35a8('0xf'),_0xdb745c,_0xd93879[_0x35a8('0xd')][_0x35a8('0x10')]);return _0x30b118(_0xd93879['error'][_0x35a8('0x10')]);}logger[_0x35a8('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0xdb745c,_0xd93879[_0x35a8('0xd')][_0x35a8('0x10')]);return _0x4ddb92(_0xd93879[_0x35a8('0xd')]['message']);}else{logger['info'](_0x35a8('0xf'),_0xdb745c,_0x35a8('0xb'));_0x4ddb92(_0xd93879[_0x35a8('0x11')][_0x35a8('0x10')]);}})[_0x35a8('0x12')](function(_0x579943){logger[_0x35a8('0xd')](_0x35a8('0xf'),_0xdb745c,_0x579943);_0x30b118(_0x579943);});});}exports[_0x35a8('0x13')]=function(_0x24e6a5){var _0x1ada8d=this;return new Promise(function(_0x22fbf0,_0x330be5){return db['FaxQueueReport']['create'](_0x24e6a5[_0x35a8('0x14')],{'raw':_0x24e6a5[_0x35a8('0x15')]?_0x24e6a5[_0x35a8('0x15')][_0x35a8('0x16')]===undefined?!![]:![]:!![]})[_0x35a8('0x8')](function(_0xb5d75c){logger[_0x35a8('0x17')](_0x35a8('0x13'),_0x24e6a5);logger[_0x35a8('0x9')]('CreateFaxQueueReport',_0x24e6a5,JSON[_0x35a8('0xc')](_0xb5d75c));_0x22fbf0(_0xb5d75c);})[_0x35a8('0x12')](function(_0xbe6953){logger[_0x35a8('0xd')](_0x35a8('0x13'),_0xbe6953[_0x35a8('0x10')],_0x24e6a5);_0x330be5(_0x1ada8d[_0x35a8('0xd')](0x1f4,_0xbe6953[_0x35a8('0x10')]));});});};exports[_0x35a8('0x18')]=function(_0x78fa4a){var _0x26ab9c=this;return new Promise(function(_0x17ffec,_0x29fbb4){return db[_0x35a8('0x19')][_0x35a8('0x1a')](_0x78fa4a[_0x35a8('0x14')],{'raw':_0x78fa4a[_0x35a8('0x15')]?_0x78fa4a[_0x35a8('0x15')][_0x35a8('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x78fa4a['options']?_0x78fa4a['options']['where']||null:null,'attributes':_0x78fa4a['options']?_0x78fa4a['options'][_0x35a8('0x1b')]||null:null,'limit':_0x78fa4a[_0x35a8('0x15')]?_0x78fa4a['options'][_0x35a8('0x1c')]||null:null})[_0x35a8('0x8')](function(_0x2c6cc8){logger['info'](_0x35a8('0x18'),_0x78fa4a);logger[_0x35a8('0x9')](_0x35a8('0x18'),_0x78fa4a,JSON[_0x35a8('0xc')](_0x2c6cc8));_0x17ffec(_0x2c6cc8);})['catch'](function(_0x3e66e1){logger[_0x35a8('0xd')](_0x35a8('0x18'),_0x3e66e1[_0x35a8('0x10')],_0x78fa4a);_0x29fbb4(_0x26ab9c[_0x35a8('0xd')](0x1f4,_0x3e66e1[_0x35a8('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index eb1ec5e..6acec65 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 _0x421a=['isAuthenticated','get','/describe','describe','/:id','show','post','update','delete','destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0xc5bd25,_0x25bd59){var _0x5862b9=function(_0x3d4563){while(--_0x3d4563){_0xc5bd25['push'](_0xc5bd25['shift']());}};_0x5862b9(++_0x25bd59);}(_0x421a,0xc6));var _0xa421=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x421a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xa421('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa421('0x1'));var router=express[_0xa421('0x2')]();var fs_extra=require(_0xa421('0x3'));var auth=require(_0xa421('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa421('0x5'));var controller=require('./faxQueueReport.controller');router['get']('/',auth[_0xa421('0x6')](),controller['index']);router[_0xa421('0x7')](_0xa421('0x8'),auth[_0xa421('0x6')](),controller[_0xa421('0x9')]);router['get'](_0xa421('0xa'),auth[_0xa421('0x6')](),controller[_0xa421('0xb')]);router[_0xa421('0xc')]('/',auth[_0xa421('0x6')](),controller['create']);router['put'](_0xa421('0xa'),auth['isAuthenticated'](),controller[_0xa421('0xd')]);router[_0xa421('0xe')](_0xa421('0xa'),auth[_0xa421('0x6')](),controller[_0xa421('0xf')]);module[_0xa421('0x10')]=router; \ No newline at end of file +var _0x2146=['create','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get','show','post'];(function(_0x3db5e5,_0x37a48e){var _0x432a63=function(_0x134362){while(--_0x134362){_0x3db5e5['push'](_0x3db5e5['shift']());}};_0x432a63(++_0x37a48e);}(_0x2146,0x101));var _0x6214=function(_0x30cf82,_0x2bbc90){_0x30cf82=_0x30cf82-0x0;var _0x248b9d=_0x2146[_0x30cf82];return _0x248b9d;};'use strict';var multer=require(_0x6214('0x0'));var util=require(_0x6214('0x1'));var path=require(_0x6214('0x2'));var timeout=require(_0x6214('0x3'));var express=require(_0x6214('0x4'));var router=express[_0x6214('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x6214('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6214('0x7'));var controller=require('./faxQueueReport.controller');router['get']('/',auth[_0x6214('0x8')](),controller[_0x6214('0x9')]);router[_0x6214('0xa')]('/describe',auth[_0x6214('0x8')](),controller['describe']);router[_0x6214('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x6214('0xb')]);router[_0x6214('0xc')]('/',auth[_0x6214('0x8')](),controller[_0x6214('0xd')]);router['put'](_0x6214('0xe'),auth[_0x6214('0x8')](),controller[_0x6214('0xf')]);router[_0x6214('0x10')](_0x6214('0xe'),auth[_0x6214('0x8')](),controller[_0x6214('0x11')]);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 4935ae8..dbba7e5 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x4d135a,_0x39610a){var _0x456ac2=function(_0x4606a1){while(--_0x4606a1){_0x4d135a['push'](_0x4d135a['shift']());}};_0x456ac2(++_0x39610a);}(_0x70e0,0x17b));var _0x070e=function(_0x35664d,_0x1239a2){_0x35664d=_0x35664d-0x0;var _0x5d89fc=_0x70e0[_0x35664d];return _0x5d89fc;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x4b5044,_0x2f4636){var _0x4f6d77=function(_0x290dd5){while(--_0x290dd5){_0x4b5044['push'](_0x4b5044['shift']());}};_0x4f6d77(++_0x2f4636);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x7185f7,_0x37065){_0x7185f7=_0x7185f7-0x0;var _0x182e45=_0xf3cd[_0x7185f7];return _0x182e45;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 0fac6de..2b0b401 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 _0xc91d=['filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','fields','options','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','end','offset','limit','undefined','count','set','json','reject','save','then','destroy','status','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','model','keys','query'];(function(_0x3e2489,_0x41d9dd){var _0x2254ce=function(_0x227e46){while(--_0x227e46){_0x3e2489['push'](_0x3e2489['shift']());}};_0x2254ce(++_0x41d9dd);}(_0xc91d,0x195));var _0xdc91=function(_0x2787e3,_0x5311b2){_0x2787e3=_0x2787e3-0x0;var _0x4002fa=_0xc91d[_0x2787e3];return _0x4002fa;};'use strict';var emlformat=require(_0xdc91('0x0'));var rimraf=require(_0xdc91('0x1'));var zipdir=require(_0xdc91('0x2'));var jsonpatch=require(_0xdc91('0x3'));var rp=require('request-promise');var moment=require(_0xdc91('0x4'));var BPromise=require(_0xdc91('0x5'));var Mustache=require(_0xdc91('0x6'));var util=require(_0xdc91('0x7'));var path=require(_0xdc91('0x8'));var sox=require(_0xdc91('0x9'));var csv=require('to-csv');var ejs=require(_0xdc91('0xa'));var fs=require('fs');var fs_extra=require(_0xdc91('0xb'));var _=require(_0xdc91('0xc'));var squel=require(_0xdc91('0xd'));var crypto=require(_0xdc91('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdc91('0xf'));var querystring=require(_0xdc91('0x10'));var Papa=require(_0xdc91('0x11'));var Redis=require(_0xdc91('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xdc91('0x13'));var as=require(_0xdc91('0x14'));var hardwareService=require(_0xdc91('0x15'));var logger=require(_0xdc91('0x16'))(_0xdc91('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xdc91('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3019da,_0x38bf29){_0x38bf29=_0x38bf29||0xcc;return function(_0x3037fd){if(_0x3037fd){return _0x3019da[_0xdc91('0x19')](_0x38bf29);}return _0x3019da['status'](_0x38bf29)[_0xdc91('0x1a')]();};}function respondWithResult(_0x22e9e1,_0x420615){_0x420615=_0x420615||0xc8;return function(_0x29bc36){if(_0x29bc36){return _0x22e9e1['status'](_0x420615)['json'](_0x29bc36);}};}function respondWithFilteredResult(_0x44df4b,_0x176c8e){return function(_0x440046){if(_0x440046){var _0x513987=typeof _0x176c8e[_0xdc91('0x1b')]==='undefined'&&typeof _0x176c8e[_0xdc91('0x1c')]===_0xdc91('0x1d');var _0x104c7c=_0x440046[_0xdc91('0x1e')];var _0x5b4a76=_0x513987?0x0:_0x176c8e[_0xdc91('0x1b')];var _0xc13298=_0x513987?_0x440046[_0xdc91('0x1e')]:_0x176c8e[_0xdc91('0x1b')]+_0x176c8e[_0xdc91('0x1c')];var _0x2dc411;if(_0xc13298>=_0x104c7c){_0xc13298=_0x104c7c;_0x2dc411=0xc8;}else{_0x2dc411=0xce;}_0x44df4b['status'](_0x2dc411);return _0x44df4b[_0xdc91('0x1f')]('Content-Range',_0x5b4a76+'-'+_0xc13298+'/'+_0x104c7c)[_0xdc91('0x20')](_0x440046);}return null;};}function patchUpdates(_0x5a0595){return function(_0x3ac956){try{jsonpatch['apply'](_0x3ac956,_0x5a0595,!![]);}catch(_0x35803c){return BPromise[_0xdc91('0x21')](_0x35803c);}return _0x3ac956[_0xdc91('0x22')]();};}function saveUpdates(_0x2ccced,_0x2d7e89){return function(_0x2a94fe){if(_0x2a94fe){return _0x2a94fe['update'](_0x2ccced)[_0xdc91('0x23')](function(_0x57ea77){return _0x57ea77;});}return null;};}function removeEntity(_0x5ef673,_0x50720a){return function(_0x338869){if(_0x338869){return _0x338869[_0xdc91('0x24')]()['then'](function(){_0x5ef673[_0xdc91('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x482543,_0x7ca771){return function(_0x546733){if(!_0x546733){_0x482543[_0xdc91('0x19')](0x194);}return _0x546733;};}function handleError(_0x5e10f1,_0x475220){_0x475220=_0x475220||0x1f4;return function(_0x6db4e){logger[_0xdc91('0x26')](_0x6db4e[_0xdc91('0x27')]);if(_0x6db4e[_0xdc91('0x28')]){delete _0x6db4e['name'];}_0x5e10f1[_0xdc91('0x25')](_0x475220)[_0xdc91('0x29')](_0x6db4e);};}exports[_0xdc91('0x2a')]=function(_0x2ae24a,_0xea5a3e){var _0x500068={},_0x349d97={},_0x5a8ff4={'count':0x0,'rows':[]};var _0x4adbb3=_[_0xdc91('0x2b')](db[_0xdc91('0x2c')][_0xdc91('0x2d')],function(_0x25ae1e){return{'name':_0x25ae1e[_0xdc91('0x2e')],'type':_0x25ae1e[_0xdc91('0x2f')]['key']};});_0x349d97[_0xdc91('0x30')]=_[_0xdc91('0x2b')](_0x4adbb3,_0xdc91('0x28'));_0x349d97['query']=_[_0xdc91('0x31')](_0x2ae24a[_0xdc91('0x32')]);_0x349d97[_0xdc91('0x33')]=_[_0xdc91('0x34')](_0x349d97[_0xdc91('0x30')],_0x349d97['query']);_0x500068['attributes']=_[_0xdc91('0x34')](_0x349d97['model'],qs['fields'](_0x2ae24a[_0xdc91('0x32')]['fields']));_0x500068[_0xdc91('0x35')]=_0x500068['attributes'][_0xdc91('0x36')]?_0x500068[_0xdc91('0x35')]:_0x349d97[_0xdc91('0x30')];if(!_0x2ae24a['query'][_0xdc91('0x37')](_0xdc91('0x38'))){_0x500068[_0xdc91('0x1c')]=qs[_0xdc91('0x1c')](_0x2ae24a[_0xdc91('0x32')][_0xdc91('0x1c')]);_0x500068['offset']=qs['offset'](_0x2ae24a[_0xdc91('0x32')][_0xdc91('0x1b')]);}_0x500068[_0xdc91('0x39')]=qs[_0xdc91('0x3a')](_0x2ae24a[_0xdc91('0x32')][_0xdc91('0x3a')]);_0x500068[_0xdc91('0x3b')]=qs['filters'](_['pick'](_0x2ae24a['query'],_0x349d97[_0xdc91('0x33')]),_0x4adbb3);if(_0x2ae24a[_0xdc91('0x32')][_0xdc91('0x3c')]){_0x500068[_0xdc91('0x3b')]=_[_0xdc91('0x3d')](_0x500068[_0xdc91('0x3b')],{'$or':_['map'](_0x4adbb3,function(_0xe5c076){if(_0xe5c076[_0xdc91('0x2f')]!==_0xdc91('0x3e')){var _0x3278b1={};_0x3278b1[_0xe5c076[_0xdc91('0x28')]]={'$like':'%'+_0x2ae24a[_0xdc91('0x32')][_0xdc91('0x3c')]+'%'};return _0x3278b1;}})});}_0x500068=_['merge']({},_0x500068,_0x2ae24a['options']);var _0x2032c1={'where':_0x500068[_0xdc91('0x3b')]};return db['FaxTransferReport'][_0xdc91('0x1e')](_0x2032c1)[_0xdc91('0x23')](function(_0x2ca8c6){_0x5a8ff4[_0xdc91('0x1e')]=_0x2ca8c6;if(_0x2ae24a['query'][_0xdc91('0x3f')]){_0x500068[_0xdc91('0x40')]=[{'all':!![]}];}return db[_0xdc91('0x2c')]['findAll'](_0x500068);})[_0xdc91('0x23')](function(_0x270fa2){_0x5a8ff4[_0xdc91('0x41')]=_0x270fa2;return _0x5a8ff4;})['then'](respondWithFilteredResult(_0xea5a3e,_0x500068))[_0xdc91('0x42')](handleError(_0xea5a3e,null));};exports[_0xdc91('0x43')]=function(_0x1d6f4d,_0x39212f){var _0xb6b988={'raw':!![],'where':{'id':_0x1d6f4d[_0xdc91('0x44')]['id']}},_0x9c4fff={};_0x9c4fff['model']=_['keys'](db['FaxTransferReport'][_0xdc91('0x2d')]);_0x9c4fff['query']=_[_0xdc91('0x31')](_0x1d6f4d[_0xdc91('0x32')]);_0x9c4fff['filters']=_[_0xdc91('0x34')](_0x9c4fff['model'],_0x9c4fff[_0xdc91('0x32')]);_0xb6b988[_0xdc91('0x35')]=_[_0xdc91('0x34')](_0x9c4fff[_0xdc91('0x30')],qs[_0xdc91('0x45')](_0x1d6f4d[_0xdc91('0x32')][_0xdc91('0x45')]));_0xb6b988[_0xdc91('0x35')]=_0xb6b988[_0xdc91('0x35')][_0xdc91('0x36')]?_0xb6b988[_0xdc91('0x35')]:_0x9c4fff[_0xdc91('0x30')];if(_0x1d6f4d[_0xdc91('0x32')][_0xdc91('0x3f')]){_0xb6b988[_0xdc91('0x40')]=[{'all':!![]}];}_0xb6b988=_[_0xdc91('0x3d')]({},_0xb6b988,_0x1d6f4d[_0xdc91('0x46')]);return db[_0xdc91('0x2c')][_0xdc91('0x47')](_0xb6b988)[_0xdc91('0x23')](handleEntityNotFound(_0x39212f,null))[_0xdc91('0x23')](respondWithResult(_0x39212f,null))[_0xdc91('0x42')](handleError(_0x39212f,null));};exports[_0xdc91('0x48')]=function(_0x382f41,_0x1031db){return db[_0xdc91('0x2c')][_0xdc91('0x48')](_0x382f41[_0xdc91('0x49')],{})[_0xdc91('0x23')](respondWithResult(_0x1031db,0xc9))[_0xdc91('0x42')](handleError(_0x1031db,null));};exports[_0xdc91('0x4a')]=function(_0x8dd741,_0x388cb3){if(_0x8dd741[_0xdc91('0x49')]['id']){delete _0x8dd741[_0xdc91('0x49')]['id'];}return db[_0xdc91('0x2c')][_0xdc91('0x47')]({'where':{'id':_0x8dd741['params']['id']}})[_0xdc91('0x23')](handleEntityNotFound(_0x388cb3,null))[_0xdc91('0x23')](saveUpdates(_0x8dd741[_0xdc91('0x49')],null))[_0xdc91('0x23')](respondWithResult(_0x388cb3,null))['catch'](handleError(_0x388cb3,null));};exports[_0xdc91('0x24')]=function(_0x1a91b0,_0x284119){return db[_0xdc91('0x2c')]['find']({'where':{'id':_0x1a91b0[_0xdc91('0x44')]['id']}})['then'](handleEntityNotFound(_0x284119,null))[_0xdc91('0x23')](removeEntity(_0x284119,null))[_0xdc91('0x42')](handleError(_0x284119,null));};exports[_0xdc91('0x4b')]=function(_0x24c9d3,_0x20f5e5){return db['FaxTransferReport'][_0xdc91('0x4b')]()['then'](respondWithResult(_0x20f5e5,null))[_0xdc91('0x42')](handleError(_0x20f5e5,null));}; \ No newline at end of file +var _0xc3ec=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','set','apply','reject','save','update','then','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse'];(function(_0x52822f,_0x162c3f){var _0x37f3da=function(_0x490298){while(--_0x490298){_0x52822f['push'](_0x52822f['shift']());}};_0x37f3da(++_0x162c3f);}(_0xc3ec,0x1f0));var _0xcc3e=function(_0x90d71e,_0x214e52){_0x90d71e=_0x90d71e-0x0;var _0x34b6f6=_0xc3ec[_0x90d71e];return _0x34b6f6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcc3e('0x0'));var zipdir=require(_0xcc3e('0x1'));var jsonpatch=require(_0xcc3e('0x2'));var rp=require(_0xcc3e('0x3'));var moment=require(_0xcc3e('0x4'));var BPromise=require(_0xcc3e('0x5'));var Mustache=require(_0xcc3e('0x6'));var util=require('util');var path=require('path');var sox=require(_0xcc3e('0x7'));var csv=require(_0xcc3e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcc3e('0x9'));var squel=require(_0xcc3e('0xa'));var crypto=require(_0xcc3e('0xb'));var jsforce=require(_0xcc3e('0xc'));var deskjs=require(_0xcc3e('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcc3e('0xe'));var Redis=require(_0xcc3e('0xf'));var authService=require(_0xcc3e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xcc3e('0x11'));var hardwareService=require(_0xcc3e('0x12'));var logger=require(_0xcc3e('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xcc3e('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xcc3e('0x15'))['db'];function respondWithStatusCode(_0x5507d4,_0x12f804){_0x12f804=_0x12f804||0xcc;return function(_0x183a5c){if(_0x183a5c){return _0x5507d4['sendStatus'](_0x12f804);}return _0x5507d4[_0xcc3e('0x16')](_0x12f804)[_0xcc3e('0x17')]();};}function respondWithResult(_0x41ea93,_0x289279){_0x289279=_0x289279||0xc8;return function(_0x397ea7){if(_0x397ea7){return _0x41ea93[_0xcc3e('0x16')](_0x289279)[_0xcc3e('0x18')](_0x397ea7);}};}function respondWithFilteredResult(_0x170b14,_0x205308){return function(_0x3ac40b){if(_0x3ac40b){var _0x558a8e=typeof _0x205308[_0xcc3e('0x19')]===_0xcc3e('0x1a')&&typeof _0x205308['limit']==='undefined';var _0x18f4a2=_0x3ac40b['count'];var _0x3f754a=_0x558a8e?0x0:_0x205308[_0xcc3e('0x19')];var _0x57e17a=_0x558a8e?_0x3ac40b[_0xcc3e('0x1b')]:_0x205308[_0xcc3e('0x19')]+_0x205308['limit'];var _0x34295d;if(_0x57e17a>=_0x18f4a2){_0x57e17a=_0x18f4a2;_0x34295d=0xc8;}else{_0x34295d=0xce;}_0x170b14[_0xcc3e('0x16')](_0x34295d);return _0x170b14[_0xcc3e('0x1c')]('Content-Range',_0x3f754a+'-'+_0x57e17a+'/'+_0x18f4a2)[_0xcc3e('0x18')](_0x3ac40b);}return null;};}function patchUpdates(_0x1d9e54){return function(_0x35520e){try{jsonpatch[_0xcc3e('0x1d')](_0x35520e,_0x1d9e54,!![]);}catch(_0x5a422a){return BPromise[_0xcc3e('0x1e')](_0x5a422a);}return _0x35520e[_0xcc3e('0x1f')]();};}function saveUpdates(_0x22fdc5,_0x579a81){return function(_0x1a3ec0){if(_0x1a3ec0){return _0x1a3ec0[_0xcc3e('0x20')](_0x22fdc5)['then'](function(_0x18604f){return _0x18604f;});}return null;};}function removeEntity(_0x49aa40,_0x4077bb){return function(_0x33242e){if(_0x33242e){return _0x33242e['destroy']()[_0xcc3e('0x21')](function(){_0x49aa40[_0xcc3e('0x16')](0xcc)[_0xcc3e('0x17')]();});}};}function handleEntityNotFound(_0x166c2f,_0x2f4fe0){return function(_0x57ed0d){if(!_0x57ed0d){_0x166c2f['sendStatus'](0x194);}return _0x57ed0d;};}function handleError(_0x445813,_0xf6c00e){_0xf6c00e=_0xf6c00e||0x1f4;return function(_0x4fa0b8){logger[_0xcc3e('0x22')](_0x4fa0b8[_0xcc3e('0x23')]);if(_0x4fa0b8['name']){delete _0x4fa0b8[_0xcc3e('0x24')];}_0x445813['status'](_0xf6c00e)[_0xcc3e('0x25')](_0x4fa0b8);};}exports[_0xcc3e('0x26')]=function(_0x50a010,_0x55ae65){var _0x591877={},_0xdfafb7={},_0x25ea8f={'count':0x0,'rows':[]};var _0x1f4c3e=_[_0xcc3e('0x27')](db[_0xcc3e('0x28')][_0xcc3e('0x29')],function(_0x29ae02){return{'name':_0x29ae02['fieldName'],'type':_0x29ae02[_0xcc3e('0x2a')][_0xcc3e('0x2b')]};});_0xdfafb7[_0xcc3e('0x2c')]=_[_0xcc3e('0x27')](_0x1f4c3e,_0xcc3e('0x24'));_0xdfafb7[_0xcc3e('0x2d')]=_[_0xcc3e('0x2e')](_0x50a010['query']);_0xdfafb7['filters']=_[_0xcc3e('0x2f')](_0xdfafb7['model'],_0xdfafb7[_0xcc3e('0x2d')]);_0x591877['attributes']=_['intersection'](_0xdfafb7[_0xcc3e('0x2c')],qs[_0xcc3e('0x30')](_0x50a010[_0xcc3e('0x2d')]['fields']));_0x591877[_0xcc3e('0x31')]=_0x591877[_0xcc3e('0x31')][_0xcc3e('0x32')]?_0x591877['attributes']:_0xdfafb7['model'];if(!_0x50a010['query'][_0xcc3e('0x33')](_0xcc3e('0x34'))){_0x591877['limit']=qs['limit'](_0x50a010[_0xcc3e('0x2d')][_0xcc3e('0x35')]);_0x591877[_0xcc3e('0x19')]=qs[_0xcc3e('0x19')](_0x50a010[_0xcc3e('0x2d')][_0xcc3e('0x19')]);}_0x591877[_0xcc3e('0x36')]=qs[_0xcc3e('0x37')](_0x50a010[_0xcc3e('0x2d')][_0xcc3e('0x37')]);_0x591877['where']=qs[_0xcc3e('0x38')](_[_0xcc3e('0x39')](_0x50a010[_0xcc3e('0x2d')],_0xdfafb7[_0xcc3e('0x38')]),_0x1f4c3e);if(_0x50a010[_0xcc3e('0x2d')][_0xcc3e('0x3a')]){_0x591877[_0xcc3e('0x3b')]=_[_0xcc3e('0x3c')](_0x591877[_0xcc3e('0x3b')],{'$or':_[_0xcc3e('0x27')](_0x1f4c3e,function(_0x44b7b1){if(_0x44b7b1[_0xcc3e('0x2a')]!==_0xcc3e('0x3d')){var _0x3384c7={};_0x3384c7[_0x44b7b1[_0xcc3e('0x24')]]={'$like':'%'+_0x50a010[_0xcc3e('0x2d')]['filter']+'%'};return _0x3384c7;}})});}_0x591877=_[_0xcc3e('0x3c')]({},_0x591877,_0x50a010[_0xcc3e('0x3e')]);var _0x3e32d9={'where':_0x591877[_0xcc3e('0x3b')]};return db[_0xcc3e('0x28')][_0xcc3e('0x1b')](_0x3e32d9)['then'](function(_0x46be88){_0x25ea8f['count']=_0x46be88;if(_0x50a010['query'][_0xcc3e('0x3f')]){_0x591877['include']=[{'all':!![]}];}return db[_0xcc3e('0x28')][_0xcc3e('0x40')](_0x591877);})[_0xcc3e('0x21')](function(_0x12524c){_0x25ea8f[_0xcc3e('0x41')]=_0x12524c;return _0x25ea8f;})['then'](respondWithFilteredResult(_0x55ae65,_0x591877))[_0xcc3e('0x42')](handleError(_0x55ae65,null));};exports['show']=function(_0x442efc,_0x5e5fec){var _0x24590d={'raw':!![],'where':{'id':_0x442efc[_0xcc3e('0x43')]['id']}},_0x28ed01={};_0x28ed01[_0xcc3e('0x2c')]=_[_0xcc3e('0x2e')](db['FaxTransferReport'][_0xcc3e('0x29')]);_0x28ed01[_0xcc3e('0x2d')]=_[_0xcc3e('0x2e')](_0x442efc[_0xcc3e('0x2d')]);_0x28ed01[_0xcc3e('0x38')]=_[_0xcc3e('0x2f')](_0x28ed01[_0xcc3e('0x2c')],_0x28ed01['query']);_0x24590d[_0xcc3e('0x31')]=_[_0xcc3e('0x2f')](_0x28ed01[_0xcc3e('0x2c')],qs[_0xcc3e('0x30')](_0x442efc[_0xcc3e('0x2d')][_0xcc3e('0x30')]));_0x24590d[_0xcc3e('0x31')]=_0x24590d[_0xcc3e('0x31')][_0xcc3e('0x32')]?_0x24590d[_0xcc3e('0x31')]:_0x28ed01['model'];if(_0x442efc['query'][_0xcc3e('0x3f')]){_0x24590d[_0xcc3e('0x44')]=[{'all':!![]}];}_0x24590d=_[_0xcc3e('0x3c')]({},_0x24590d,_0x442efc['options']);return db[_0xcc3e('0x28')][_0xcc3e('0x45')](_0x24590d)[_0xcc3e('0x21')](handleEntityNotFound(_0x5e5fec,null))[_0xcc3e('0x21')](respondWithResult(_0x5e5fec,null))[_0xcc3e('0x42')](handleError(_0x5e5fec,null));};exports['create']=function(_0x595979,_0x5b20a6){return db[_0xcc3e('0x28')][_0xcc3e('0x46')](_0x595979['body'],{})[_0xcc3e('0x21')](respondWithResult(_0x5b20a6,0xc9))[_0xcc3e('0x42')](handleError(_0x5b20a6,null));};exports['update']=function(_0x4bc6d0,_0x4cfca8){if(_0x4bc6d0['body']['id']){delete _0x4bc6d0[_0xcc3e('0x47')]['id'];}return db['FaxTransferReport'][_0xcc3e('0x45')]({'where':{'id':_0x4bc6d0[_0xcc3e('0x43')]['id']}})[_0xcc3e('0x21')](handleEntityNotFound(_0x4cfca8,null))[_0xcc3e('0x21')](saveUpdates(_0x4bc6d0['body'],null))[_0xcc3e('0x21')](respondWithResult(_0x4cfca8,null))[_0xcc3e('0x42')](handleError(_0x4cfca8,null));};exports['destroy']=function(_0x3794f1,_0x28ac7b){return db['FaxTransferReport'][_0xcc3e('0x45')]({'where':{'id':_0x3794f1[_0xcc3e('0x43')]['id']}})['then'](handleEntityNotFound(_0x28ac7b,null))[_0xcc3e('0x21')](removeEntity(_0x28ac7b,null))[_0xcc3e('0x42')](handleError(_0x28ac7b,null));};exports[_0xcc3e('0x48')]=function(_0x56d87a,_0x15dd1b){return db[_0xcc3e('0x28')][_0xcc3e('0x48')]()[_0xcc3e('0x21')](respondWithResult(_0x15dd1b,null))['catch'](handleError(_0x15dd1b,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 4eb1728..add4e36 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 _0xd3b0=['./faxTransferReport.attributes','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4db8d9,_0x100e73){var _0x1e1a49=function(_0x292d49){while(--_0x292d49){_0x4db8d9['push'](_0x4db8d9['shift']());}};_0x1e1a49(++_0x100e73);}(_0xd3b0,0x1f4));var _0x0d3b=function(_0xa938c8,_0x32c04f){_0xa938c8=_0xa938c8-0x0;var _0x2c9cdd=_0xd3b0[_0xa938c8];return _0x2c9cdd;};'use strict';var _=require(_0x0d3b('0x0'));var util=require(_0x0d3b('0x1'));var logger=require(_0x0d3b('0x2'))(_0x0d3b('0x3'));var moment=require(_0x0d3b('0x4'));var BPromise=require(_0x0d3b('0x5'));var rp=require(_0x0d3b('0x6'));var fs=require('fs');var path=require(_0x0d3b('0x7'));var rimraf=require(_0x0d3b('0x8'));var config=require(_0x0d3b('0x9'));var attributes=require(_0x0d3b('0xa'));module['exports']=function(_0x4bea5c,_0x192adf){return _0x4bea5c[_0x0d3b('0xb')](_0x0d3b('0xc'),attributes,{'tableName':_0x0d3b('0xd'),'paranoid':![],'indexes':[{'name':_0x0d3b('0xe'),'fields':[_0x0d3b('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x23b6=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','FaxTransferReport','uniqueid','lodash'];(function(_0x514260,_0x1891e1){var _0x4ac81b=function(_0x53cab1){while(--_0x53cab1){_0x514260['push'](_0x514260['shift']());}};_0x4ac81b(++_0x1891e1);}(_0x23b6,0xd7));var _0x623b=function(_0x2cd1fb,_0x291f55){_0x2cd1fb=_0x2cd1fb-0x0;var _0x48fd2b=_0x23b6[_0x2cd1fb];return _0x48fd2b;};'use strict';var _=require(_0x623b('0x0'));var util=require(_0x623b('0x1'));var logger=require('../../config/logger')(_0x623b('0x2'));var moment=require(_0x623b('0x3'));var BPromise=require(_0x623b('0x4'));var rp=require(_0x623b('0x5'));var fs=require('fs');var path=require(_0x623b('0x6'));var rimraf=require(_0x623b('0x7'));var config=require(_0x623b('0x8'));var attributes=require(_0x623b('0x9'));module['exports']=function(_0x5d077b,_0x5cb588){return _0x5d077b['define'](_0x623b('0xa'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x623b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index da4c3a8..fb0ce13 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 _0x2034=['rpc','../../config/environment','jayson/promise','client','request','then','info','FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x5a8d2c,_0x725a3){var _0x2086dc=function(_0x58d9ab){while(--_0x58d9ab){_0x5a8d2c['push'](_0x5a8d2c['shift']());}};_0x2086dc(++_0x725a3);}(_0x2034,0x83));var _0x4203=function(_0x378bca,_0x2533ca){_0x378bca=_0x378bca-0x0;var _0x290216=_0x2034[_0x378bca];return _0x290216;};'use strict';var _=require('lodash');var util=require(_0x4203('0x0'));var moment=require(_0x4203('0x1'));var BPromise=require(_0x4203('0x2'));var rs=require(_0x4203('0x3'));var fs=require('fs');var Redis=require(_0x4203('0x4'));var db=require(_0x4203('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4203('0x6'))(_0x4203('0x7'));var config=require(_0x4203('0x8'));var jayson=require(_0x4203('0x9'));var client=jayson[_0x4203('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1dba7d,_0x2f9de8,_0x2c40cf){return new BPromise(function(_0x5eaf82,_0x21d401){return client[_0x4203('0xb')](_0x1dba7d,_0x2c40cf)[_0x4203('0xc')](function(_0x357bba){logger[_0x4203('0xd')](_0x4203('0xe'),_0x2f9de8,'request\x20sent');logger[_0x4203('0xf')](_0x4203('0x10'),_0x2f9de8,_0x4203('0x11'),JSON[_0x4203('0x12')](_0x357bba));if(_0x357bba['error']){if(_0x357bba[_0x4203('0x13')][_0x4203('0x14')]===0x1f4){logger[_0x4203('0x13')]('FaxTransferReport,\x20%s,\x20%s',_0x2f9de8,_0x357bba[_0x4203('0x13')][_0x4203('0x15')]);return _0x21d401(_0x357bba[_0x4203('0x13')][_0x4203('0x15')]);}logger[_0x4203('0x13')](_0x4203('0xe'),_0x2f9de8,_0x357bba['error'][_0x4203('0x15')]);return _0x5eaf82(_0x357bba[_0x4203('0x13')]['message']);}else{logger[_0x4203('0xd')](_0x4203('0xe'),_0x2f9de8,_0x4203('0x11'));_0x5eaf82(_0x357bba['result'][_0x4203('0x15')]);}})[_0x4203('0x16')](function(_0x3b68d6){logger[_0x4203('0x13')](_0x4203('0xe'),_0x2f9de8,_0x3b68d6);_0x21d401(_0x3b68d6);});});} \ No newline at end of file +var _0xd92b=['then','info','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','FaxTransferReport,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x14477e,_0x44d4da){var _0x5d4a05=function(_0x5e0fa3){while(--_0x5e0fa3){_0x14477e['push'](_0x14477e['shift']());}};_0x5d4a05(++_0x44d4da);}(_0xd92b,0x11a));var _0xbd92=function(_0x202bde,_0x2d4b47){_0x202bde=_0x202bde-0x0;var _0x3ef2b7=_0xd92b[_0x202bde];return _0x3ef2b7;};'use strict';var _=require(_0xbd92('0x0'));var util=require(_0xbd92('0x1'));var moment=require(_0xbd92('0x2'));var BPromise=require(_0xbd92('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbd92('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbd92('0x5'));var logger=require(_0xbd92('0x6'))(_0xbd92('0x7'));var config=require(_0xbd92('0x8'));var jayson=require(_0xbd92('0x9'));var client=jayson['client'][_0xbd92('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x476230,_0x2e173d,_0x4bd724){return new BPromise(function(_0x3897e0,_0x824c52){return client[_0xbd92('0xb')](_0x476230,_0x4bd724)[_0xbd92('0xc')](function(_0x5d7ee0){logger[_0xbd92('0xd')]('FaxTransferReport,\x20%s,\x20%s',_0x2e173d,'request\x20sent');logger[_0xbd92('0xe')](_0xbd92('0xf'),_0x2e173d,_0xbd92('0x10'),JSON['stringify'](_0x5d7ee0));if(_0x5d7ee0['error']){if(_0x5d7ee0[_0xbd92('0x11')]['code']===0x1f4){logger[_0xbd92('0x11')](_0xbd92('0x12'),_0x2e173d,_0x5d7ee0[_0xbd92('0x11')]['message']);return _0x824c52(_0x5d7ee0[_0xbd92('0x11')]['message']);}logger[_0xbd92('0x11')](_0xbd92('0x12'),_0x2e173d,_0x5d7ee0[_0xbd92('0x11')][_0xbd92('0x13')]);return _0x3897e0(_0x5d7ee0[_0xbd92('0x11')][_0xbd92('0x13')]);}else{logger[_0xbd92('0xd')](_0xbd92('0x12'),_0x2e173d,_0xbd92('0x10'));_0x3897e0(_0x5d7ee0['result'][_0xbd92('0x13')]);}})[_0xbd92('0x14')](function(_0x5f290e){logger[_0xbd92('0x11')](_0xbd92('0x12'),_0x2e173d,_0x5f290e);_0x824c52(_0x5f290e);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 14d1454..5e71270 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 _0x8afc=['index','/describe','describe','/:id','show','post','create','put','update','delete','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxTransferReport.controller','get','isAuthenticated'];(function(_0xc6b649,_0x4f7b62){var _0x9f2212=function(_0x10c0f4){while(--_0x10c0f4){_0xc6b649['push'](_0xc6b649['shift']());}};_0x9f2212(++_0x4f7b62);}(_0x8afc,0x7c));var _0xc8af=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8afc[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc8af('0x0'));var timeout=require('connect-timeout');var express=require(_0xc8af('0x1'));var router=express[_0xc8af('0x2')]();var fs_extra=require(_0xc8af('0x3'));var auth=require(_0xc8af('0x4'));var interaction=require(_0xc8af('0x5'));var config=require('../../config/environment');var controller=require(_0xc8af('0x6'));router[_0xc8af('0x7')]('/',auth[_0xc8af('0x8')](),controller[_0xc8af('0x9')]);router[_0xc8af('0x7')](_0xc8af('0xa'),auth[_0xc8af('0x8')](),controller[_0xc8af('0xb')]);router[_0xc8af('0x7')](_0xc8af('0xc'),auth[_0xc8af('0x8')](),controller[_0xc8af('0xd')]);router[_0xc8af('0xe')]('/',auth[_0xc8af('0x8')](),controller[_0xc8af('0xf')]);router[_0xc8af('0x10')](_0xc8af('0xc'),auth[_0xc8af('0x8')](),controller[_0xc8af('0x11')]);router[_0xc8af('0x12')](_0xc8af('0xc'),auth[_0xc8af('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc4fd=['create','put','update','delete','exports','path','express','Router','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','get','/describe','describe','/:id','show'];(function(_0x5937eb,_0x3c35cf){var _0x535a99=function(_0x42a511){while(--_0x42a511){_0x5937eb['push'](_0x5937eb['shift']());}};_0x535a99(++_0x3c35cf);}(_0xc4fd,0x7c));var _0xdc4f=function(_0x231dda,_0x5b04cc){_0x231dda=_0x231dda-0x0;var _0x3f88cb=_0xc4fd[_0x231dda];return _0x3f88cb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdc4f('0x0'));var timeout=require('connect-timeout');var express=require(_0xdc4f('0x1'));var router=express[_0xdc4f('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdc4f('0x3'));var config=require(_0xdc4f('0x4'));var controller=require(_0xdc4f('0x5'));router['get']('/',auth[_0xdc4f('0x6')](),controller['index']);router[_0xdc4f('0x7')](_0xdc4f('0x8'),auth['isAuthenticated'](),controller[_0xdc4f('0x9')]);router[_0xdc4f('0x7')](_0xdc4f('0xa'),auth[_0xdc4f('0x6')](),controller[_0xdc4f('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xdc4f('0xc')]);router[_0xdc4f('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xdc4f('0xe')]);router[_0xdc4f('0xf')](_0xdc4f('0xa'),auth[_0xdc4f('0x6')](),controller['destroy']);module[_0xdc4f('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index c8fea5b..a6299cb 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 _0xff3f=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller','get','index','/:id','isAuthenticated','show','getConfigurations','getFields','post','create','/:id/configurations','put','update','destroy'];(function(_0xdc0968,_0x5f39f3){var _0x556838=function(_0x264db2){while(--_0x264db2){_0xdc0968['push'](_0xdc0968['shift']());}};_0x556838(++_0x5f39f3);}(_0xff3f,0xdd));var _0xfff3=function(_0x2d126e,_0x1e8257){_0x2d126e=_0x2d126e-0x0;var _0xcb04d3=_0xff3f[_0x2d126e];return _0xcb04d3;};'use strict';var multer=require(_0xfff3('0x0'));var util=require('util');var path=require(_0xfff3('0x1'));var timeout=require(_0xfff3('0x2'));var express=require(_0xfff3('0x3'));var router=express[_0xfff3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xfff3('0x5'));var interaction=require(_0xfff3('0x6'));var config=require('../../config/environment');var controller=require(_0xfff3('0x7'));router[_0xfff3('0x8')]('/',auth['isAuthenticated'](),controller[_0xfff3('0x9')]);router[_0xfff3('0x8')](_0xfff3('0xa'),auth[_0xfff3('0xb')](),controller[_0xfff3('0xc')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0xfff3('0xd')]);router[_0xfff3('0x8')]('/:id/fields',auth[_0xfff3('0xb')](),controller[_0xfff3('0xe')]);router[_0xfff3('0xf')]('/',auth[_0xfff3('0xb')](),controller[_0xfff3('0x10')]);router[_0xfff3('0xf')](_0xfff3('0x11'),auth[_0xfff3('0xb')](),controller['addConfiguration']);router[_0xfff3('0x12')]('/:id',auth[_0xfff3('0xb')](),controller[_0xfff3('0x13')]);router['delete']('/:id',auth[_0xfff3('0xb')](),controller[_0xfff3('0x14')]);module[_0xfff3('0x15')]=router; \ No newline at end of file +var _0x73ea=['/:id/fields','getFields','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','index','/:id','get','/:id/configurations','getConfigurations'];(function(_0x4c3c7f,_0x5d6651){var _0x5f1d7b=function(_0x2c53b6){while(--_0x2c53b6){_0x4c3c7f['push'](_0x4c3c7f['shift']());}};_0x5f1d7b(++_0x5d6651);}(_0x73ea,0x110));var _0xa73e=function(_0x4b9f06,_0x770bcd){_0x4b9f06=_0x4b9f06-0x0;var _0xacc734=_0x73ea[_0x4b9f06];return _0xacc734;};'use strict';var multer=require(_0xa73e('0x0'));var util=require(_0xa73e('0x1'));var path=require('path');var timeout=require(_0xa73e('0x2'));var express=require(_0xa73e('0x3'));var router=express[_0xa73e('0x4')]();var fs_extra=require(_0xa73e('0x5'));var auth=require(_0xa73e('0x6'));var interaction=require(_0xa73e('0x7'));var config=require(_0xa73e('0x8'));var controller=require(_0xa73e('0x9'));router['get']('/',auth[_0xa73e('0xa')](),controller[_0xa73e('0xb')]);router['get'](_0xa73e('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xa73e('0xd')](_0xa73e('0xe'),auth[_0xa73e('0xa')](),controller[_0xa73e('0xf')]);router['get'](_0xa73e('0x10'),auth[_0xa73e('0xa')](),controller[_0xa73e('0x11')]);router[_0xa73e('0x12')]('/',auth['isAuthenticated'](),controller[_0xa73e('0x13')]);router[_0xa73e('0x12')]('/:id/configurations',auth[_0xa73e('0xa')](),controller['addConfiguration']);router[_0xa73e('0x14')](_0xa73e('0xc'),auth[_0xa73e('0xa')](),controller[_0xa73e('0x15')]);router[_0xa73e('0x16')](_0xa73e('0xc'),auth[_0xa73e('0xa')](),controller[_0xa73e('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index e5ce2b8..f62276d 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 _0xbc10=['integrationTab','newTab','sequelize','exports','STRING','ENUM','basic'];(function(_0x51ad45,_0x16860a){var _0x179af2=function(_0x1e48c3){while(--_0x1e48c3){_0x51ad45['push'](_0x51ad45['shift']());}};_0x179af2(++_0x16860a);}(_0xbc10,0x17c));var _0x0bc1=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xbc10[_0x8de54f];return _0x14cba4;};'use strict';var Sequelize=require(_0x0bc1('0x0'));module[_0x0bc1('0x1')]={'name':{'type':Sequelize[_0x0bc1('0x2')]},'description':{'type':Sequelize[_0x0bc1('0x2')]},'username':{'type':Sequelize[_0x0bc1('0x2')]},'remoteUri':{'type':Sequelize[_0x0bc1('0x2')]},'authType':{'type':Sequelize[_0x0bc1('0x3')](_0x0bc1('0x4')),'defaultValue':_0x0bc1('0x4')},'password':{'type':Sequelize[_0x0bc1('0x2')]},'consumerKey':{'type':Sequelize[_0x0bc1('0x2')]},'consumerSecret':{'type':Sequelize[_0x0bc1('0x2')]},'token':{'type':Sequelize[_0x0bc1('0x2')]},'tokenSecret':{'type':Sequelize[_0x0bc1('0x2')]},'serverUrl':{'type':Sequelize[_0x0bc1('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0bc1('0x5'),_0x0bc1('0x6')),'defaultValue':_0x0bc1('0x5')}}; \ No newline at end of file +var _0x89fb=['sequelize','exports','STRING','basic','ENUM','integrationTab','newTab'];(function(_0x5b2a15,_0xd200ec){var _0x33038d=function(_0x4150a2){while(--_0x4150a2){_0x5b2a15['push'](_0x5b2a15['shift']());}};_0x33038d(++_0xd200ec);}(_0x89fb,0xfc));var _0xb89f=function(_0x21f996,_0x37ef0e){_0x21f996=_0x21f996-0x0;var _0x2e3a1f=_0x89fb[_0x21f996];return _0x2e3a1f;};'use strict';var Sequelize=require(_0xb89f('0x0'));module[_0xb89f('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb89f('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xb89f('0x2')]},'authType':{'type':Sequelize['ENUM'](_0xb89f('0x3')),'defaultValue':'basic'},'password':{'type':Sequelize[_0xb89f('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0xb89f('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xb89f('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xb89f('0x4')](_0xb89f('0x5'),_0xb89f('0x6')),'defaultValue':_0xb89f('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index a5adaa8..bacefcd 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 _0x3f58=['getConfigurations','findOne','DeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','type','getFields','priority','username','password','consumerKey','consumerSecret','tokenSecret','remoteUri','lastIndexOf','format','application/json','authType','basic','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','active','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','then','destroy','stack','name','send','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','map','VIRTUAL','merge','options','DeskAccount','includeAll','include','findAll','rows','catch','show','params','find','create','update','body'];(function(_0x322296,_0x57eb19){var _0x432ea7=function(_0x4bd2b3){while(--_0x4bd2b3){_0x322296['push'](_0x322296['shift']());}};_0x432ea7(++_0x57eb19);}(_0x3f58,0x107));var _0x83f5=function(_0x5bb240,_0x4c49c4){_0x5bb240=_0x5bb240-0x0;var _0x1573ec=_0x3f58[_0x5bb240];return _0x1573ec;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x83f5('0x0'));var zipdir=require(_0x83f5('0x1'));var jsonpatch=require(_0x83f5('0x2'));var rp=require('request-promise');var moment=require(_0x83f5('0x3'));var BPromise=require(_0x83f5('0x4'));var Mustache=require(_0x83f5('0x5'));var util=require(_0x83f5('0x6'));var path=require(_0x83f5('0x7'));var sox=require(_0x83f5('0x8'));var csv=require(_0x83f5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x83f5('0xa'));var _=require('lodash');var squel=require(_0x83f5('0xb'));var crypto=require(_0x83f5('0xc'));var jsforce=require(_0x83f5('0xd'));var deskjs=require(_0x83f5('0xe'));var toCsv=require('to-csv');var querystring=require(_0x83f5('0xf'));var Papa=require('papaparse');var Redis=require(_0x83f5('0x10'));var authService=require(_0x83f5('0x11'));var qs=require(_0x83f5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x83f5('0x13'))(_0x83f5('0x14'));var utils=require(_0x83f5('0x15'));var config=require(_0x83f5('0x16'));var licenseUtil=require(_0x83f5('0x17'));var db=require(_0x83f5('0x18'))['db'];var integrations=require(_0x83f5('0x19'));function respondWithStatusCode(_0x1fa0b7,_0x2d6277){_0x2d6277=_0x2d6277||0xcc;return function(_0x12729a){if(_0x12729a){return _0x1fa0b7[_0x83f5('0x1a')](_0x2d6277);}return _0x1fa0b7[_0x83f5('0x1b')](_0x2d6277)[_0x83f5('0x1c')]();};}function respondWithResult(_0x47a272,_0x3004a9){_0x3004a9=_0x3004a9||0xc8;return function(_0x8c6c00){if(_0x8c6c00){return _0x47a272['status'](_0x3004a9)[_0x83f5('0x1d')](_0x8c6c00);}};}function respondWithFilteredResult(_0x22690f,_0x2378aa){return function(_0xd72e10){if(_0xd72e10){var _0x9b17a1=typeof _0x2378aa['offset']===_0x83f5('0x1e')&&typeof _0x2378aa[_0x83f5('0x1f')]==='undefined';var _0x42d337=_0xd72e10['count'];var _0xb6cc72=_0x9b17a1?0x0:_0x2378aa['offset'];var _0x35af78=_0x9b17a1?_0xd72e10[_0x83f5('0x20')]:_0x2378aa[_0x83f5('0x21')]+_0x2378aa['limit'];var _0x28a819;if(_0x35af78>=_0x42d337){_0x35af78=_0x42d337;_0x28a819=0xc8;}else{_0x28a819=0xce;}_0x22690f[_0x83f5('0x1b')](_0x28a819);return _0x22690f[_0x83f5('0x22')]('Content-Range',_0xb6cc72+'-'+_0x35af78+'/'+_0x42d337)[_0x83f5('0x1d')](_0xd72e10);}return null;};}function patchUpdates(_0x53247a){return function(_0x2a83cd){try{jsonpatch[_0x83f5('0x23')](_0x2a83cd,_0x53247a,!![]);}catch(_0x1dd3b0){return BPromise[_0x83f5('0x24')](_0x1dd3b0);}return _0x2a83cd[_0x83f5('0x25')]();};}function saveUpdates(_0x1ba80d,_0x3adf2a){return function(_0x55309c){if(_0x55309c){return _0x55309c['update'](_0x1ba80d)[_0x83f5('0x26')](function(_0x94cc74){return _0x94cc74;});}return null;};}function removeEntity(_0x2a6cfc,_0x50f042){return function(_0xf49b19){if(_0xf49b19){return _0xf49b19[_0x83f5('0x27')]()[_0x83f5('0x26')](function(){_0x2a6cfc[_0x83f5('0x1b')](0xcc)[_0x83f5('0x1c')]();});}};}function handleEntityNotFound(_0x49add2,_0x46b13b){return function(_0x3f0065){if(!_0x3f0065){_0x49add2[_0x83f5('0x1a')](0x194);}return _0x3f0065;};}function handleError(_0x2412ea,_0x155e1f){_0x155e1f=_0x155e1f||0x1f4;return function(_0x3252d7){logger['error'](_0x3252d7[_0x83f5('0x28')]);if(_0x3252d7[_0x83f5('0x29')]){delete _0x3252d7['name'];}_0x2412ea[_0x83f5('0x1b')](_0x155e1f)[_0x83f5('0x2a')](_0x3252d7);};}exports['index']=function(_0x3414ba,_0x182296){var _0x24558a={},_0x4854ea={},_0x39eec6={'count':0x0,'rows':[]};var _0x347f2b=_['map'](db['DeskAccount'][_0x83f5('0x2b')],function(_0x34504d){return{'name':_0x34504d[_0x83f5('0x2c')],'type':_0x34504d['type'][_0x83f5('0x2d')]};});_0x4854ea[_0x83f5('0x2e')]=_['map'](_0x347f2b,_0x83f5('0x29'));_0x4854ea['query']=_[_0x83f5('0x2f')](_0x3414ba[_0x83f5('0x30')]);_0x4854ea[_0x83f5('0x31')]=_[_0x83f5('0x32')](_0x4854ea[_0x83f5('0x2e')],_0x4854ea[_0x83f5('0x30')]);_0x24558a[_0x83f5('0x33')]=_[_0x83f5('0x32')](_0x4854ea['model'],qs[_0x83f5('0x34')](_0x3414ba[_0x83f5('0x30')][_0x83f5('0x34')]));_0x24558a[_0x83f5('0x33')]=_0x24558a['attributes'][_0x83f5('0x35')]?_0x24558a[_0x83f5('0x33')]:_0x4854ea[_0x83f5('0x2e')];if(!_0x3414ba[_0x83f5('0x30')][_0x83f5('0x36')](_0x83f5('0x37'))){_0x24558a['limit']=qs[_0x83f5('0x1f')](_0x3414ba[_0x83f5('0x30')]['limit']);_0x24558a['offset']=qs[_0x83f5('0x21')](_0x3414ba['query']['offset']);}_0x24558a[_0x83f5('0x38')]=qs[_0x83f5('0x39')](_0x3414ba['query']['sort']);_0x24558a[_0x83f5('0x3a')]=qs[_0x83f5('0x31')](_['pick'](_0x3414ba[_0x83f5('0x30')],_0x4854ea['filters']),_0x347f2b);if(_0x3414ba['query'][_0x83f5('0x3b')]){_0x24558a[_0x83f5('0x3a')]=_['merge'](_0x24558a[_0x83f5('0x3a')],{'$or':_[_0x83f5('0x3c')](_0x347f2b,function(_0xf8fdee){if(_0xf8fdee['type']!==_0x83f5('0x3d')){var _0x37723d={};_0x37723d[_0xf8fdee[_0x83f5('0x29')]]={'$like':'%'+_0x3414ba[_0x83f5('0x30')][_0x83f5('0x3b')]+'%'};return _0x37723d;}})});}_0x24558a=_[_0x83f5('0x3e')]({},_0x24558a,_0x3414ba[_0x83f5('0x3f')]);var _0x5535e6={'where':_0x24558a['where']};return db[_0x83f5('0x40')][_0x83f5('0x20')](_0x5535e6)[_0x83f5('0x26')](function(_0x1d4f68){_0x39eec6[_0x83f5('0x20')]=_0x1d4f68;if(_0x3414ba[_0x83f5('0x30')][_0x83f5('0x41')]){_0x24558a[_0x83f5('0x42')]=[{'all':!![]}];}return db[_0x83f5('0x40')][_0x83f5('0x43')](_0x24558a);})[_0x83f5('0x26')](function(_0x437556){_0x39eec6[_0x83f5('0x44')]=_0x437556;return _0x39eec6;})[_0x83f5('0x26')](respondWithFilteredResult(_0x182296,_0x24558a))[_0x83f5('0x45')](handleError(_0x182296,null));};exports[_0x83f5('0x46')]=function(_0xe5ef8,_0x3e7f9d){var _0x12c745={'raw':![],'where':{'id':_0xe5ef8[_0x83f5('0x47')]['id']}},_0x2838ed={};_0x2838ed['model']=_[_0x83f5('0x2f')](db[_0x83f5('0x40')][_0x83f5('0x2b')]);_0x2838ed['query']=_[_0x83f5('0x2f')](_0xe5ef8['query']);_0x2838ed[_0x83f5('0x31')]=_[_0x83f5('0x32')](_0x2838ed[_0x83f5('0x2e')],_0x2838ed[_0x83f5('0x30')]);_0x12c745[_0x83f5('0x33')]=_['intersection'](_0x2838ed[_0x83f5('0x2e')],qs[_0x83f5('0x34')](_0xe5ef8['query'][_0x83f5('0x34')]));_0x12c745[_0x83f5('0x33')]=_0x12c745['attributes'][_0x83f5('0x35')]?_0x12c745[_0x83f5('0x33')]:_0x2838ed['model'];if(_0xe5ef8['query'][_0x83f5('0x41')]){_0x12c745['include']=[{'all':!![]}];}_0x12c745=_[_0x83f5('0x3e')]({},_0x12c745,_0xe5ef8[_0x83f5('0x3f')]);return db[_0x83f5('0x40')][_0x83f5('0x48')](_0x12c745)[_0x83f5('0x26')](handleEntityNotFound(_0x3e7f9d,null))['then'](respondWithResult(_0x3e7f9d,null))[_0x83f5('0x45')](handleError(_0x3e7f9d,null));};exports['create']=function(_0x413f08,_0x3932ee){return db[_0x83f5('0x40')][_0x83f5('0x49')](_0x413f08['body'],{})[_0x83f5('0x26')](respondWithResult(_0x3932ee,0xc9))[_0x83f5('0x45')](handleError(_0x3932ee,null));};exports[_0x83f5('0x4a')]=function(_0x3ca056,_0x1a931f){if(_0x3ca056[_0x83f5('0x4b')]['id']){delete _0x3ca056[_0x83f5('0x4b')]['id'];}return db[_0x83f5('0x40')]['find']({'where':{'id':_0x3ca056[_0x83f5('0x47')]['id']}})[_0x83f5('0x26')](handleEntityNotFound(_0x1a931f,null))['then'](saveUpdates(_0x3ca056[_0x83f5('0x4b')],null))[_0x83f5('0x26')](respondWithResult(_0x1a931f,null))['catch'](handleError(_0x1a931f,null));};exports[_0x83f5('0x27')]=function(_0x4d4dd2,_0x5b2f4b){return db[_0x83f5('0x40')][_0x83f5('0x48')]({'where':{'id':_0x4d4dd2[_0x83f5('0x47')]['id']}})['then'](handleEntityNotFound(_0x5b2f4b,null))[_0x83f5('0x26')](removeEntity(_0x5b2f4b,null))[_0x83f5('0x45')](handleError(_0x5b2f4b,null));};exports[_0x83f5('0x4c')]=function(_0xbbce5f,_0x16d60e,_0x31b393){var _0x4eef2b={};var _0x302070={};var _0x33d96e;var _0x3c652b;return db['DeskAccount'][_0x83f5('0x4d')]({'where':{'id':_0xbbce5f[_0x83f5('0x47')]['id']}})[_0x83f5('0x26')](handleEntityNotFound(_0x16d60e,null))[_0x83f5('0x26')](function(_0x40d67c){if(_0x40d67c){_0x33d96e=_0x40d67c;_0x302070[_0x83f5('0x2e')]=_['keys'](db[_0x83f5('0x4e')][_0x83f5('0x2b')]);_0x302070[_0x83f5('0x30')]=_[_0x83f5('0x2f')](_0xbbce5f['query']);_0x302070[_0x83f5('0x31')]=_[_0x83f5('0x32')](_0x302070[_0x83f5('0x2e')],_0x302070['query']);_0x4eef2b[_0x83f5('0x33')]=_[_0x83f5('0x32')](_0x302070[_0x83f5('0x2e')],qs['fields'](_0xbbce5f['query'][_0x83f5('0x34')]));_0x4eef2b[_0x83f5('0x33')]=_0x4eef2b['attributes'][_0x83f5('0x35')]?_0x4eef2b[_0x83f5('0x33')]:_0x302070[_0x83f5('0x2e')];_0x4eef2b['order']=qs[_0x83f5('0x39')](_0xbbce5f[_0x83f5('0x30')][_0x83f5('0x39')]);_0x4eef2b[_0x83f5('0x3a')]=qs['filters'](_['pick'](_0xbbce5f['query'],_0x302070[_0x83f5('0x31')]));if(_0xbbce5f['query'][_0x83f5('0x3b')]){_0x4eef2b[_0x83f5('0x3a')]=_[_0x83f5('0x3e')](_0x4eef2b[_0x83f5('0x3a')],{'$or':_[_0x83f5('0x3c')](_0x4eef2b['attributes'],function(_0x5b4def){var _0x20c9a4={};_0x20c9a4[_0x5b4def]={'$like':'%'+_0xbbce5f[_0x83f5('0x30')][_0x83f5('0x3b')]+'%'};return _0x20c9a4;})});}_0x4eef2b=_[_0x83f5('0x3e')]({},_0x4eef2b,_0xbbce5f[_0x83f5('0x3f')]);return _0x33d96e[_0x83f5('0x4c')](_0x4eef2b);}})[_0x83f5('0x26')](function(_0x4bfd12){if(_0x4bfd12){_0x3c652b=_0x4bfd12[_0x83f5('0x35')];if(!_0xbbce5f['query'][_0x83f5('0x36')](_0x83f5('0x37'))){_0x4eef2b[_0x83f5('0x1f')]=qs[_0x83f5('0x1f')](_0xbbce5f[_0x83f5('0x30')]['limit']);_0x4eef2b['offset']=qs[_0x83f5('0x21')](_0xbbce5f['query'][_0x83f5('0x21')]);}return _0x33d96e[_0x83f5('0x4c')](_0x4eef2b);}})['then'](function(_0x7ff2be){if(_0x7ff2be){return _0x7ff2be?{'count':_0x3c652b,'rows':_0x7ff2be}:null;}})[_0x83f5('0x26')](respondWithResult(_0x16d60e,null))['catch'](handleError(_0x16d60e,null));};exports[_0x83f5('0x4f')]=function(_0x46eb0d,_0x13eb56,_0x306b66){if(_0x46eb0d[_0x83f5('0x4b')]['id']){delete _0x46eb0d[_0x83f5('0x4b')]['id'];}return db[_0x83f5('0x40')][_0x83f5('0x4d')]({'where':{'id':_0x46eb0d[_0x83f5('0x47')]['id']}})[_0x83f5('0x26')](handleEntityNotFound(_0x13eb56,null))[_0x83f5('0x26')](function(_0x23a3fb){if(_0x23a3fb){_0x46eb0d[_0x83f5('0x4b')][_0x83f5('0x50')]=_0x23a3fb['id'];_0x46eb0d['body'][_0x83f5('0x51')]=integrations[_0x83f5('0x52')](_0x46eb0d[_0x83f5('0x4b')][_0x83f5('0x53')],_0x46eb0d[_0x83f5('0x4b')]['type']);_0x46eb0d[_0x83f5('0x4b')][_0x83f5('0x54')]=integrations[_0x83f5('0x55')](_0x46eb0d[_0x83f5('0x4b')][_0x83f5('0x53')],_0x46eb0d[_0x83f5('0x4b')][_0x83f5('0x56')]);return db[_0x83f5('0x4e')][_0x83f5('0x49')](_0x46eb0d[_0x83f5('0x4b')],{'include':[{'model':db['DeskField'],'as':'Subjects'},{'model':db['DeskField'],'as':_0x83f5('0x54')}]});}return null;})['then'](respondWithResult(_0x13eb56,null))[_0x83f5('0x45')](handleError(_0x13eb56,null));};exports[_0x83f5('0x57')]=function(_0x36bfab,_0x22776a,_0x4b3e69){var _0x5c3742=[{'name':'priority','label':_0x83f5('0x58'),'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 _0x1b7897='';return db['DeskAccount'][_0x83f5('0x4d')]({'where':{'id':_0x36bfab['params']['id']},'attributes':['id','remoteUri','authType',_0x83f5('0x59'),_0x83f5('0x5a'),_0x83f5('0x5b'),_0x83f5('0x5c'),'token',_0x83f5('0x5d')]})[_0x83f5('0x26')](handleEntityNotFound(_0x22776a,null))[_0x83f5('0x26')](function(_0xba5cb2){if(_0xba5cb2){_0x1b7897=_0xba5cb2[_0x83f5('0x5e')];var _0x3f1d74=_0x1b7897['slice'](-0x1);if(_0x3f1d74==='/'){_0x1b7897=_0x1b7897['substring'](0x0,_0x1b7897[_0x83f5('0x5f')](_0x3f1d74));}var _0x1dd6d6={'method':'GET','uri':util[_0x83f5('0x60')]('%s/custom_fields',_0x1b7897),'headers':{'Content-Type':_0x83f5('0x61'),'Accept':_0x83f5('0x61')},'json':!![]};if(_0xba5cb2[_0x83f5('0x62')]===_0x83f5('0x63')){_0x1dd6d6['headers']['Authorization']=util[_0x83f5('0x60')](_0x83f5('0x64'),new Buffer(util['format'](_0x83f5('0x65'),_0xba5cb2[_0x83f5('0x59')],_0xba5cb2[_0x83f5('0x5a')]))[_0x83f5('0x66')](_0x83f5('0x67')));}return rp(_0x1dd6d6)['then'](function(_0x2e266c){return _0x5c3742[_0x83f5('0x68')](_[_0x83f5('0x3c')](_0x2e266c[_0x83f5('0x69')][_0x83f5('0x6a')],function(_0x4fc187){return{'id':_0x4fc187[_0x83f5('0x29')],'name':_0x4fc187[_0x83f5('0x29')],'type':_0x4fc187[_0x83f5('0x56')],'active':_0x4fc187[_0x83f5('0x6b')],'label':_0x4fc187['label'],'custom':!![]};}));});}})[_0x83f5('0x26')](function(_0x5770d6){return{'count':_0x5770d6[_0x83f5('0x35')],'rows':_0x5770d6};})[_0x83f5('0x26')](respondWithResult(_0x22776a,null))[_0x83f5('0x45')](function(_0x1bf01b){var _0x2c2890=_0x36bfab[_0x83f5('0x30')][_0x83f5('0x6c')]?0x1f4:_0x1bf01b[_0x83f5('0x6d')]||0x1f4;logger[_0x83f5('0x6e')](_0x83f5('0x6f'),_0x83f5('0x57'),_0x2c2890,JSON['stringify'](_0x1bf01b));delete _0x1bf01b[_0x83f5('0x29')];if(_0x2c2890===0x191){_0x2c2890=0x190;}_0x22776a[_0x83f5('0x1b')](_0x2c2890)[_0x83f5('0x2a')](_0x36bfab[_0x83f5('0x30')][_0x83f5('0x6c')]?{'message':_0x83f5('0x70'),'statusCode':_0x1bf01b[_0x83f5('0x6d')]}:_0x1bf01b);});}; \ No newline at end of file +var _0x9cc9=['findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','getConfigurations','findOne','DeskConfiguration','order','pick','hasOwnProperty','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','tokenSecret','substring','lastIndexOf','GET','%s/custom_fields','application/json','Authorization','format','Basic\x20%s','%s:%s','toString','base64','concat','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','DeskAccount','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','type','VIRTUAL','options'];(function(_0xca098c,_0x286c62){var _0x20bfe8=function(_0x147153){while(--_0x147153){_0xca098c['push'](_0xca098c['shift']());}};_0x20bfe8(++_0x286c62);}(_0x9cc9,0x1e7));var _0x99cc=function(_0xfb7b54,_0x1294f6){_0xfb7b54=_0xfb7b54-0x0;var _0x504458=_0x9cc9[_0xfb7b54];return _0x504458;};'use strict';var emlformat=require(_0x99cc('0x0'));var rimraf=require(_0x99cc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x99cc('0x2'));var rp=require(_0x99cc('0x3'));var moment=require('moment');var BPromise=require(_0x99cc('0x4'));var Mustache=require(_0x99cc('0x5'));var util=require(_0x99cc('0x6'));var path=require('path');var sox=require(_0x99cc('0x7'));var csv=require(_0x99cc('0x8'));var ejs=require(_0x99cc('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x99cc('0xa'));var squel=require(_0x99cc('0xb'));var crypto=require(_0x99cc('0xc'));var jsforce=require(_0x99cc('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x99cc('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x99cc('0xf'));var qs=require(_0x99cc('0x10'));var as=require(_0x99cc('0x11'));var hardwareService=require(_0x99cc('0x12'));var logger=require(_0x99cc('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x99cc('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x42acff,_0x1703a0){_0x1703a0=_0x1703a0||0xcc;return function(_0x4f6f88){if(_0x4f6f88){return _0x42acff[_0x99cc('0x15')](_0x1703a0);}return _0x42acff[_0x99cc('0x16')](_0x1703a0)[_0x99cc('0x17')]();};}function respondWithResult(_0x751f24,_0x5d8fab){_0x5d8fab=_0x5d8fab||0xc8;return function(_0x271822){if(_0x271822){return _0x751f24['status'](_0x5d8fab)['json'](_0x271822);}};}function respondWithFilteredResult(_0x2ecbac,_0x33e74c){return function(_0x3c8b80){if(_0x3c8b80){var _0x294376=typeof _0x33e74c[_0x99cc('0x18')]===_0x99cc('0x19')&&typeof _0x33e74c[_0x99cc('0x1a')]===_0x99cc('0x19');var _0x5b7b88=_0x3c8b80[_0x99cc('0x1b')];var _0x189a6d=_0x294376?0x0:_0x33e74c[_0x99cc('0x18')];var _0x141bc8=_0x294376?_0x3c8b80[_0x99cc('0x1b')]:_0x33e74c[_0x99cc('0x18')]+_0x33e74c[_0x99cc('0x1a')];var _0x58e719;if(_0x141bc8>=_0x5b7b88){_0x141bc8=_0x5b7b88;_0x58e719=0xc8;}else{_0x58e719=0xce;}_0x2ecbac[_0x99cc('0x16')](_0x58e719);return _0x2ecbac['set'](_0x99cc('0x1c'),_0x189a6d+'-'+_0x141bc8+'/'+_0x5b7b88)['json'](_0x3c8b80);}return null;};}function patchUpdates(_0x2d5d52){return function(_0xffdccf){try{jsonpatch[_0x99cc('0x1d')](_0xffdccf,_0x2d5d52,!![]);}catch(_0x4b1853){return BPromise[_0x99cc('0x1e')](_0x4b1853);}return _0xffdccf['save']();};}function saveUpdates(_0x5185c7,_0x57ece0){return function(_0x4fbb53){if(_0x4fbb53){return _0x4fbb53[_0x99cc('0x1f')](_0x5185c7)[_0x99cc('0x20')](function(_0x17d5e0){return _0x17d5e0;});}return null;};}function removeEntity(_0x5e2ae8,_0x5acad0){return function(_0x41721f){if(_0x41721f){return _0x41721f[_0x99cc('0x21')]()[_0x99cc('0x20')](function(){_0x5e2ae8['status'](0xcc)[_0x99cc('0x17')]();});}};}function handleEntityNotFound(_0x5def3f,_0x5317af){return function(_0xbcadb3){if(!_0xbcadb3){_0x5def3f[_0x99cc('0x15')](0x194);}return _0xbcadb3;};}function handleError(_0x29e333,_0x8f1115){_0x8f1115=_0x8f1115||0x1f4;return function(_0x1fb550){logger[_0x99cc('0x22')](_0x1fb550[_0x99cc('0x23')]);if(_0x1fb550[_0x99cc('0x24')]){delete _0x1fb550[_0x99cc('0x24')];}_0x29e333[_0x99cc('0x16')](_0x8f1115)[_0x99cc('0x25')](_0x1fb550);};}exports[_0x99cc('0x26')]=function(_0x5e83f6,_0x344e70){var _0x41ec89={},_0x67650c={},_0x5bfcd3={'count':0x0,'rows':[]};var _0x5885f9=_[_0x99cc('0x27')](db[_0x99cc('0x28')]['rawAttributes'],function(_0x3e1cb1){return{'name':_0x3e1cb1['fieldName'],'type':_0x3e1cb1['type'][_0x99cc('0x29')]};});_0x67650c[_0x99cc('0x2a')]=_[_0x99cc('0x27')](_0x5885f9,_0x99cc('0x24'));_0x67650c[_0x99cc('0x2b')]=_[_0x99cc('0x2c')](_0x5e83f6[_0x99cc('0x2b')]);_0x67650c[_0x99cc('0x2d')]=_[_0x99cc('0x2e')](_0x67650c[_0x99cc('0x2a')],_0x67650c['query']);_0x41ec89[_0x99cc('0x2f')]=_[_0x99cc('0x2e')](_0x67650c['model'],qs[_0x99cc('0x30')](_0x5e83f6[_0x99cc('0x2b')][_0x99cc('0x30')]));_0x41ec89[_0x99cc('0x2f')]=_0x41ec89[_0x99cc('0x2f')][_0x99cc('0x31')]?_0x41ec89[_0x99cc('0x2f')]:_0x67650c[_0x99cc('0x2a')];if(!_0x5e83f6[_0x99cc('0x2b')]['hasOwnProperty'](_0x99cc('0x32'))){_0x41ec89['limit']=qs['limit'](_0x5e83f6['query'][_0x99cc('0x1a')]);_0x41ec89[_0x99cc('0x18')]=qs[_0x99cc('0x18')](_0x5e83f6[_0x99cc('0x2b')][_0x99cc('0x18')]);}_0x41ec89['order']=qs['sort'](_0x5e83f6['query'][_0x99cc('0x33')]);_0x41ec89[_0x99cc('0x34')]=qs[_0x99cc('0x2d')](_['pick'](_0x5e83f6[_0x99cc('0x2b')],_0x67650c['filters']),_0x5885f9);if(_0x5e83f6['query'][_0x99cc('0x35')]){_0x41ec89[_0x99cc('0x34')]=_[_0x99cc('0x36')](_0x41ec89[_0x99cc('0x34')],{'$or':_[_0x99cc('0x27')](_0x5885f9,function(_0x1ded35){if(_0x1ded35[_0x99cc('0x37')]!==_0x99cc('0x38')){var _0x3ee38b={};_0x3ee38b[_0x1ded35[_0x99cc('0x24')]]={'$like':'%'+_0x5e83f6[_0x99cc('0x2b')][_0x99cc('0x35')]+'%'};return _0x3ee38b;}})});}_0x41ec89=_[_0x99cc('0x36')]({},_0x41ec89,_0x5e83f6[_0x99cc('0x39')]);var _0x65e7b={'where':_0x41ec89['where']};return db['DeskAccount'][_0x99cc('0x1b')](_0x65e7b)[_0x99cc('0x20')](function(_0x2a4250){_0x5bfcd3[_0x99cc('0x1b')]=_0x2a4250;if(_0x5e83f6[_0x99cc('0x2b')]['includeAll']){_0x41ec89['include']=[{'all':!![]}];}return db['DeskAccount'][_0x99cc('0x3a')](_0x41ec89);})[_0x99cc('0x20')](function(_0x3f7273){_0x5bfcd3[_0x99cc('0x3b')]=_0x3f7273;return _0x5bfcd3;})[_0x99cc('0x20')](respondWithFilteredResult(_0x344e70,_0x41ec89))[_0x99cc('0x3c')](handleError(_0x344e70,null));};exports[_0x99cc('0x3d')]=function(_0x472bb9,_0x274825){var _0x24b512={'raw':![],'where':{'id':_0x472bb9[_0x99cc('0x3e')]['id']}},_0x2f2c61={};_0x2f2c61[_0x99cc('0x2a')]=_['keys'](db[_0x99cc('0x28')][_0x99cc('0x3f')]);_0x2f2c61[_0x99cc('0x2b')]=_[_0x99cc('0x2c')](_0x472bb9[_0x99cc('0x2b')]);_0x2f2c61['filters']=_[_0x99cc('0x2e')](_0x2f2c61['model'],_0x2f2c61[_0x99cc('0x2b')]);_0x24b512[_0x99cc('0x2f')]=_[_0x99cc('0x2e')](_0x2f2c61[_0x99cc('0x2a')],qs[_0x99cc('0x30')](_0x472bb9['query'][_0x99cc('0x30')]));_0x24b512[_0x99cc('0x2f')]=_0x24b512[_0x99cc('0x2f')][_0x99cc('0x31')]?_0x24b512[_0x99cc('0x2f')]:_0x2f2c61[_0x99cc('0x2a')];if(_0x472bb9[_0x99cc('0x2b')][_0x99cc('0x40')]){_0x24b512['include']=[{'all':!![]}];}_0x24b512=_[_0x99cc('0x36')]({},_0x24b512,_0x472bb9[_0x99cc('0x39')]);return db[_0x99cc('0x28')][_0x99cc('0x41')](_0x24b512)[_0x99cc('0x20')](handleEntityNotFound(_0x274825,null))[_0x99cc('0x20')](respondWithResult(_0x274825,null))[_0x99cc('0x3c')](handleError(_0x274825,null));};exports['create']=function(_0x309d95,_0x1e9962){return db[_0x99cc('0x28')][_0x99cc('0x42')](_0x309d95[_0x99cc('0x43')],{})[_0x99cc('0x20')](respondWithResult(_0x1e9962,0xc9))[_0x99cc('0x3c')](handleError(_0x1e9962,null));};exports[_0x99cc('0x1f')]=function(_0x3e8d38,_0x3d275d){if(_0x3e8d38[_0x99cc('0x43')]['id']){delete _0x3e8d38[_0x99cc('0x43')]['id'];}return db[_0x99cc('0x28')][_0x99cc('0x41')]({'where':{'id':_0x3e8d38[_0x99cc('0x3e')]['id']}})[_0x99cc('0x20')](handleEntityNotFound(_0x3d275d,null))[_0x99cc('0x20')](saveUpdates(_0x3e8d38[_0x99cc('0x43')],null))[_0x99cc('0x20')](respondWithResult(_0x3d275d,null))['catch'](handleError(_0x3d275d,null));};exports[_0x99cc('0x21')]=function(_0x5c632d,_0x42fe9a){return db[_0x99cc('0x28')][_0x99cc('0x41')]({'where':{'id':_0x5c632d[_0x99cc('0x3e')]['id']}})[_0x99cc('0x20')](handleEntityNotFound(_0x42fe9a,null))[_0x99cc('0x20')](removeEntity(_0x42fe9a,null))['catch'](handleError(_0x42fe9a,null));};exports[_0x99cc('0x44')]=function(_0x4076f9,_0x3eed23,_0xd117bf){var _0x5dade2={};var _0x360bee={};var _0xe19c7b;var _0x227881;return db[_0x99cc('0x28')][_0x99cc('0x45')]({'where':{'id':_0x4076f9[_0x99cc('0x3e')]['id']}})[_0x99cc('0x20')](handleEntityNotFound(_0x3eed23,null))[_0x99cc('0x20')](function(_0x224b58){if(_0x224b58){_0xe19c7b=_0x224b58;_0x360bee['model']=_[_0x99cc('0x2c')](db[_0x99cc('0x46')][_0x99cc('0x3f')]);_0x360bee[_0x99cc('0x2b')]=_['keys'](_0x4076f9[_0x99cc('0x2b')]);_0x360bee[_0x99cc('0x2d')]=_[_0x99cc('0x2e')](_0x360bee[_0x99cc('0x2a')],_0x360bee[_0x99cc('0x2b')]);_0x5dade2[_0x99cc('0x2f')]=_['intersection'](_0x360bee[_0x99cc('0x2a')],qs[_0x99cc('0x30')](_0x4076f9['query']['fields']));_0x5dade2[_0x99cc('0x2f')]=_0x5dade2[_0x99cc('0x2f')][_0x99cc('0x31')]?_0x5dade2[_0x99cc('0x2f')]:_0x360bee['model'];_0x5dade2[_0x99cc('0x47')]=qs['sort'](_0x4076f9['query'][_0x99cc('0x33')]);_0x5dade2['where']=qs[_0x99cc('0x2d')](_[_0x99cc('0x48')](_0x4076f9[_0x99cc('0x2b')],_0x360bee[_0x99cc('0x2d')]));if(_0x4076f9[_0x99cc('0x2b')]['filter']){_0x5dade2[_0x99cc('0x34')]=_[_0x99cc('0x36')](_0x5dade2[_0x99cc('0x34')],{'$or':_[_0x99cc('0x27')](_0x5dade2['attributes'],function(_0x4a5975){var _0x5782ca={};_0x5782ca[_0x4a5975]={'$like':'%'+_0x4076f9[_0x99cc('0x2b')][_0x99cc('0x35')]+'%'};return _0x5782ca;})});}_0x5dade2=_[_0x99cc('0x36')]({},_0x5dade2,_0x4076f9[_0x99cc('0x39')]);return _0xe19c7b['getConfigurations'](_0x5dade2);}})['then'](function(_0x4c28a2){if(_0x4c28a2){_0x227881=_0x4c28a2[_0x99cc('0x31')];if(!_0x4076f9[_0x99cc('0x2b')][_0x99cc('0x49')](_0x99cc('0x32'))){_0x5dade2['limit']=qs[_0x99cc('0x1a')](_0x4076f9[_0x99cc('0x2b')][_0x99cc('0x1a')]);_0x5dade2['offset']=qs[_0x99cc('0x18')](_0x4076f9[_0x99cc('0x2b')][_0x99cc('0x18')]);}return _0xe19c7b[_0x99cc('0x44')](_0x5dade2);}})['then'](function(_0x17f052){if(_0x17f052){return _0x17f052?{'count':_0x227881,'rows':_0x17f052}:null;}})[_0x99cc('0x20')](respondWithResult(_0x3eed23,null))[_0x99cc('0x3c')](handleError(_0x3eed23,null));};exports[_0x99cc('0x4a')]=function(_0x52f0a6,_0x2fe9c6,_0x489c1b){if(_0x52f0a6[_0x99cc('0x43')]['id']){delete _0x52f0a6[_0x99cc('0x43')]['id'];}return db[_0x99cc('0x28')][_0x99cc('0x45')]({'where':{'id':_0x52f0a6[_0x99cc('0x3e')]['id']}})[_0x99cc('0x20')](handleEntityNotFound(_0x2fe9c6,null))['then'](function(_0x16cbf7){if(_0x16cbf7){_0x52f0a6['body'][_0x99cc('0x4b')]=_0x16cbf7['id'];_0x52f0a6['body'][_0x99cc('0x4c')]=integrations['getSubjects'](_0x52f0a6[_0x99cc('0x43')]['channel'],_0x52f0a6[_0x99cc('0x43')][_0x99cc('0x37')]);_0x52f0a6['body'][_0x99cc('0x4d')]=integrations[_0x99cc('0x4e')](_0x52f0a6[_0x99cc('0x43')][_0x99cc('0x4f')],_0x52f0a6[_0x99cc('0x43')][_0x99cc('0x37')]);return db[_0x99cc('0x46')][_0x99cc('0x42')](_0x52f0a6['body'],{'include':[{'model':db[_0x99cc('0x50')],'as':'Subjects'},{'model':db[_0x99cc('0x50')],'as':_0x99cc('0x4d')}]});}return null;})[_0x99cc('0x20')](respondWithResult(_0x2fe9c6,null))['catch'](handleError(_0x2fe9c6,null));};exports[_0x99cc('0x51')]=function(_0x4cba63,_0x26e242,_0x21ab1e){var _0x1417ce=[{'name':_0x99cc('0x52'),'label':_0x99cc('0x52'),'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 _0xd3ab34='';return db[_0x99cc('0x28')][_0x99cc('0x45')]({'where':{'id':_0x4cba63[_0x99cc('0x3e')]['id']},'attributes':['id',_0x99cc('0x53'),_0x99cc('0x54'),_0x99cc('0x55'),_0x99cc('0x56'),_0x99cc('0x57'),_0x99cc('0x58'),'token',_0x99cc('0x59')]})[_0x99cc('0x20')](handleEntityNotFound(_0x26e242,null))['then'](function(_0x22054f){if(_0x22054f){_0xd3ab34=_0x22054f[_0x99cc('0x53')];var _0x3f746d=_0xd3ab34['slice'](-0x1);if(_0x3f746d==='/'){_0xd3ab34=_0xd3ab34[_0x99cc('0x5a')](0x0,_0xd3ab34[_0x99cc('0x5b')](_0x3f746d));}var _0x5f05bc={'method':_0x99cc('0x5c'),'uri':util['format'](_0x99cc('0x5d'),_0xd3ab34),'headers':{'Content-Type':_0x99cc('0x5e'),'Accept':_0x99cc('0x5e')},'json':!![]};if(_0x22054f[_0x99cc('0x54')]==='basic'){_0x5f05bc['headers'][_0x99cc('0x5f')]=util[_0x99cc('0x60')](_0x99cc('0x61'),new Buffer(util[_0x99cc('0x60')](_0x99cc('0x62'),_0x22054f[_0x99cc('0x55')],_0x22054f[_0x99cc('0x56')]))[_0x99cc('0x63')](_0x99cc('0x64')));}return rp(_0x5f05bc)[_0x99cc('0x20')](function(_0x4c0259){return _0x1417ce[_0x99cc('0x65')](_[_0x99cc('0x27')](_0x4c0259['_embedded'][_0x99cc('0x66')],function(_0x54872b){return{'id':_0x54872b[_0x99cc('0x24')],'name':_0x54872b[_0x99cc('0x24')],'type':_0x54872b['type'],'active':_0x54872b[_0x99cc('0x67')],'label':_0x54872b[_0x99cc('0x68')],'custom':!![]};}));});}})['then'](function(_0x4fa0eb){return{'count':_0x4fa0eb[_0x99cc('0x31')],'rows':_0x4fa0eb};})[_0x99cc('0x20')](respondWithResult(_0x26e242,null))[_0x99cc('0x3c')](function(_0x34aded){var _0xbe562=_0x4cba63[_0x99cc('0x2b')][_0x99cc('0x69')]?0x1f4:_0x34aded[_0x99cc('0x6a')]||0x1f4;logger[_0x99cc('0x22')](_0x99cc('0x6b'),_0x99cc('0x51'),_0xbe562,JSON[_0x99cc('0x6c')](_0x34aded));delete _0x34aded[_0x99cc('0x24')];if(_0xbe562===0x191){_0xbe562=0x190;}_0x26e242[_0x99cc('0x16')](_0xbe562)[_0x99cc('0x25')](_0x4cba63['query'][_0x99cc('0x69')]?{'message':'Wrong\x20credentials','statusCode':_0x34aded['statusCode']}:_0x34aded);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 008fd0a..d4e9289 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 _0xe380=['bluebird','request-promise','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','moment'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0xe380,0x64));var _0x0e38=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xe380[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x0e38('0x0'));var util=require(_0x0e38('0x1'));var logger=require(_0x0e38('0x2'))('api');var moment=require(_0x0e38('0x3'));var BPromise=require(_0x0e38('0x4'));var rp=require(_0x0e38('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0e38('0x6'));var attributes=require(_0x0e38('0x7'));var integrations=require(_0x0e38('0x8'));module[_0x0e38('0x9')]=function(_0x5bb58d,_0x2d59a6){return _0x5bb58d[_0x0e38('0xa')](_0x0e38('0xb'),attributes,{'tableName':_0x0e38('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd458=['int_desk_accounts','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','DeskAccount'];(function(_0x5ec454,_0xfcd77e){var _0x5ebf50=function(_0x29de85){while(--_0x29de85){_0x5ec454['push'](_0x5ec454['shift']());}};_0x5ebf50(++_0xfcd77e);}(_0xd458,0x1bd));var _0x8d45=function(_0x1bbd8a,_0x2435ec){_0x1bbd8a=_0x1bbd8a-0x0;var _0x526447=_0xd458[_0x1bbd8a];return _0x526447;};'use strict';var _=require(_0x8d45('0x0'));var util=require(_0x8d45('0x1'));var logger=require(_0x8d45('0x2'))(_0x8d45('0x3'));var moment=require(_0x8d45('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8d45('0x5'));var rimraf=require(_0x8d45('0x6'));var config=require(_0x8d45('0x7'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x8d45('0x8'));module[_0x8d45('0x9')]=function(_0xcc82b4,_0x20422a){return _0xcc82b4['define'](_0x8d45('0xa'),attributes,{'tableName':_0x8d45('0xb'),'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 53579f9..94a35c9 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 _0xb871=['limit','include','map','model','attributes','catch','ShowDeskAccount','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','DeskAccount','findAll','options','where'];(function(_0x39e5af,_0x410a3d){var _0xad9774=function(_0x2d69be){while(--_0x2d69be){_0x39e5af['push'](_0x39e5af['shift']());}};_0xad9774(++_0x410a3d);}(_0xb871,0x1ab));var _0x1b87=function(_0x15362c,_0x92bcd7){_0x15362c=_0x15362c-0x0;var _0x4a65ab=_0xb871[_0x15362c];return _0x4a65ab;};'use strict';var _=require(_0x1b87('0x0'));var util=require(_0x1b87('0x1'));var moment=require(_0x1b87('0x2'));var BPromise=require(_0x1b87('0x3'));var rs=require(_0x1b87('0x4'));var fs=require('fs');var Redis=require(_0x1b87('0x5'));var db=require(_0x1b87('0x6'))['db'];var utils=require(_0x1b87('0x7'));var logger=require('../../config/logger')(_0x1b87('0x8'));var config=require(_0x1b87('0x9'));var jayson=require(_0x1b87('0xa'));var client=jayson[_0x1b87('0xb')][_0x1b87('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x65c380,_0x2fc6e8,_0x27dcb8){return new BPromise(function(_0x83b98e,_0x1da454){return client[_0x1b87('0xd')](_0x65c380,_0x27dcb8)[_0x1b87('0xe')](function(_0x14734b){logger['info'](_0x1b87('0xf'),_0x2fc6e8,'request\x20sent');logger[_0x1b87('0x10')](_0x1b87('0x11'),_0x2fc6e8,_0x1b87('0x12'),JSON[_0x1b87('0x13')](_0x14734b));if(_0x14734b[_0x1b87('0x14')]){if(_0x14734b[_0x1b87('0x14')][_0x1b87('0x15')]===0x1f4){logger[_0x1b87('0x14')](_0x1b87('0xf'),_0x2fc6e8,_0x14734b[_0x1b87('0x14')][_0x1b87('0x16')]);return _0x1da454(_0x14734b[_0x1b87('0x14')][_0x1b87('0x16')]);}logger[_0x1b87('0x14')](_0x1b87('0xf'),_0x2fc6e8,_0x14734b[_0x1b87('0x14')][_0x1b87('0x16')]);return _0x83b98e(_0x14734b[_0x1b87('0x14')][_0x1b87('0x16')]);}else{logger[_0x1b87('0x17')](_0x1b87('0xf'),_0x2fc6e8,_0x1b87('0x12'));_0x83b98e(_0x14734b[_0x1b87('0x18')][_0x1b87('0x16')]);}})['catch'](function(_0x296162){logger['error'](_0x1b87('0xf'),_0x2fc6e8,_0x296162);_0x1da454(_0x296162);});});}exports['GetDeskAccount']=function(_0x2f81e8){var _0x1feb5c=this;return new Promise(function(_0x4b0801,_0x59009b){return db[_0x1b87('0x19')][_0x1b87('0x1a')]({'raw':_0x2f81e8[_0x1b87('0x1b')]?_0x2f81e8['options']['raw']===undefined?!![]:![]:!![],'where':_0x2f81e8[_0x1b87('0x1b')]?_0x2f81e8[_0x1b87('0x1b')][_0x1b87('0x1c')]||null:null,'attributes':_0x2f81e8[_0x1b87('0x1b')]?_0x2f81e8[_0x1b87('0x1b')]['attributes']||null:null,'limit':_0x2f81e8[_0x1b87('0x1b')]?_0x2f81e8['options'][_0x1b87('0x1d')]||null:null,'include':_0x2f81e8[_0x1b87('0x1b')]?_0x2f81e8[_0x1b87('0x1b')][_0x1b87('0x1e')]?_[_0x1b87('0x1f')](_0x2f81e8[_0x1b87('0x1b')]['include'],function(_0x3135d6){return{'model':db[_0x3135d6[_0x1b87('0x20')]],'as':_0x3135d6['as'],'attributes':_0x3135d6[_0x1b87('0x21')],'include':_0x3135d6['include']?_[_0x1b87('0x1f')](_0x3135d6[_0x1b87('0x1e')],function(_0x57a386){return{'model':db[_0x57a386[_0x1b87('0x20')]],'as':_0x57a386['as'],'attributes':_0x57a386['attributes'],'include':_0x57a386['include']?_['map'](_0x57a386['include'],function(_0x576b2c){return{'model':db[_0x576b2c[_0x1b87('0x20')]],'as':_0x576b2c['as'],'attributes':_0x576b2c[_0x1b87('0x21')]};}):[]};}):[]};}):[]:[]})[_0x1b87('0xe')](function(_0x4b144b){logger['info']('GetDeskAccount',_0x2f81e8);logger['debug']('GetDeskAccount',_0x2f81e8,JSON['stringify'](_0x4b144b));_0x4b0801(_0x4b144b);})[_0x1b87('0x22')](function(_0x1ccbc0){logger[_0x1b87('0x14')]('GetDeskAccount',_0x1ccbc0[_0x1b87('0x16')],_0x2f81e8);_0x59009b(_0x1feb5c['error'](0x1f4,_0x1ccbc0[_0x1b87('0x16')]));});});};exports[_0x1b87('0x23')]=function(_0x5ad20c){var _0x54315a=this;return new Promise(function(_0x218cfa,_0x273120){return db['DeskAccount'][_0x1b87('0x24')]({'raw':_0x5ad20c[_0x1b87('0x1b')]?_0x5ad20c[_0x1b87('0x1b')][_0x1b87('0x25')]===undefined?!![]:![]:!![],'where':_0x5ad20c[_0x1b87('0x1b')]?_0x5ad20c['options'][_0x1b87('0x1c')]||null:null,'attributes':_0x5ad20c[_0x1b87('0x1b')]?_0x5ad20c['options']['attributes']||null:null,'include':_0x5ad20c[_0x1b87('0x1b')]?_0x5ad20c[_0x1b87('0x1b')][_0x1b87('0x1e')]?_[_0x1b87('0x1f')](_0x5ad20c['options'][_0x1b87('0x1e')],function(_0x265db2){return{'model':db[_0x265db2[_0x1b87('0x20')]],'as':_0x265db2['as'],'attributes':_0x265db2[_0x1b87('0x21')],'include':_0x265db2[_0x1b87('0x1e')]?_[_0x1b87('0x1f')](_0x265db2[_0x1b87('0x1e')],function(_0x5ff2b8){return{'model':db[_0x5ff2b8[_0x1b87('0x20')]],'as':_0x5ff2b8['as'],'attributes':_0x5ff2b8['attributes'],'include':_0x5ff2b8[_0x1b87('0x1e')]?_[_0x1b87('0x1f')](_0x5ff2b8['include'],function(_0x4a4bde){return{'model':db[_0x4a4bde[_0x1b87('0x20')]],'as':_0x4a4bde['as'],'attributes':_0x4a4bde[_0x1b87('0x21')]};}):[]};}):[]};}):[]:[]})[_0x1b87('0xe')](function(_0x5e7a86){logger[_0x1b87('0x17')]('ShowDeskAccount',_0x5ad20c);logger[_0x1b87('0x10')](_0x1b87('0x23'),_0x5ad20c,JSON[_0x1b87('0x13')](_0x5e7a86));_0x218cfa(_0x5e7a86);})['catch'](function(_0x4589b8){logger[_0x1b87('0x14')](_0x1b87('0x23'),_0x4589b8[_0x1b87('0x16')],_0x5ad20c);_0x273120(_0x54315a[_0x1b87('0x14')](0x1f4,_0x4589b8[_0x1b87('0x16')]));});});}; \ No newline at end of file +var _0x7393=['find','lodash','moment','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','map','include','model','attributes','debug','ShowDeskAccount'];(function(_0x5185cf,_0x18e620){var _0x53a6b5=function(_0x414d58){while(--_0x414d58){_0x5185cf['push'](_0x5185cf['shift']());}};_0x53a6b5(++_0x18e620);}(_0x7393,0x194));var _0x3739=function(_0x2dd109,_0xc87d91){_0x2dd109=_0x2dd109-0x0;var _0x919b9=_0x7393[_0x2dd109];return _0x919b9;};'use strict';var _=require(_0x3739('0x0'));var util=require('util');var moment=require(_0x3739('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3739('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3739('0x3'))(_0x3739('0x4'));var config=require(_0x3739('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x3739('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x456341,_0x444e0b,_0x4dc42f){return new BPromise(function(_0x1d4148,_0x4cff08){return client['request'](_0x456341,_0x4dc42f)[_0x3739('0x7')](function(_0x30d17e){logger[_0x3739('0x8')](_0x3739('0x9'),_0x444e0b,_0x3739('0xa'));logger['debug'](_0x3739('0xb'),_0x444e0b,_0x3739('0xa'),JSON[_0x3739('0xc')](_0x30d17e));if(_0x30d17e['error']){if(_0x30d17e[_0x3739('0xd')][_0x3739('0xe')]===0x1f4){logger[_0x3739('0xd')](_0x3739('0x9'),_0x444e0b,_0x30d17e[_0x3739('0xd')]['message']);return _0x4cff08(_0x30d17e[_0x3739('0xd')][_0x3739('0xf')]);}logger[_0x3739('0xd')](_0x3739('0x9'),_0x444e0b,_0x30d17e['error'][_0x3739('0xf')]);return _0x1d4148(_0x30d17e['error'][_0x3739('0xf')]);}else{logger[_0x3739('0x8')](_0x3739('0x9'),_0x444e0b,'request\x20sent');_0x1d4148(_0x30d17e[_0x3739('0x10')][_0x3739('0xf')]);}})[_0x3739('0x11')](function(_0x14df88){logger[_0x3739('0xd')](_0x3739('0x9'),_0x444e0b,_0x14df88);_0x4cff08(_0x14df88);});});}exports[_0x3739('0x12')]=function(_0x4808f8){var _0x1a2ac=this;return new Promise(function(_0x8f098f,_0x502356){return db[_0x3739('0x13')][_0x3739('0x14')]({'raw':_0x4808f8[_0x3739('0x15')]?_0x4808f8[_0x3739('0x15')][_0x3739('0x16')]===undefined?!![]:![]:!![],'where':_0x4808f8[_0x3739('0x15')]?_0x4808f8['options'][_0x3739('0x17')]||null:null,'attributes':_0x4808f8[_0x3739('0x15')]?_0x4808f8['options']['attributes']||null:null,'limit':_0x4808f8[_0x3739('0x15')]?_0x4808f8[_0x3739('0x15')]['limit']||null:null,'include':_0x4808f8[_0x3739('0x15')]?_0x4808f8[_0x3739('0x15')]['include']?_[_0x3739('0x18')](_0x4808f8['options'][_0x3739('0x19')],function(_0x400576){return{'model':db[_0x400576[_0x3739('0x1a')]],'as':_0x400576['as'],'attributes':_0x400576['attributes'],'include':_0x400576[_0x3739('0x19')]?_[_0x3739('0x18')](_0x400576[_0x3739('0x19')],function(_0x2a127f){return{'model':db[_0x2a127f['model']],'as':_0x2a127f['as'],'attributes':_0x2a127f['attributes'],'include':_0x2a127f['include']?_[_0x3739('0x18')](_0x2a127f[_0x3739('0x19')],function(_0xb5c4cc){return{'model':db[_0xb5c4cc[_0x3739('0x1a')]],'as':_0xb5c4cc['as'],'attributes':_0xb5c4cc[_0x3739('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4e5f6d){logger[_0x3739('0x8')](_0x3739('0x12'),_0x4808f8);logger[_0x3739('0x1c')](_0x3739('0x12'),_0x4808f8,JSON[_0x3739('0xc')](_0x4e5f6d));_0x8f098f(_0x4e5f6d);})[_0x3739('0x11')](function(_0x20193e){logger[_0x3739('0xd')]('GetDeskAccount',_0x20193e[_0x3739('0xf')],_0x4808f8);_0x502356(_0x1a2ac[_0x3739('0xd')](0x1f4,_0x20193e[_0x3739('0xf')]));});});};exports[_0x3739('0x1d')]=function(_0x193c7d){var _0x5dcda0=this;return new Promise(function(_0x2952d1,_0xbfbdc2){return db[_0x3739('0x13')][_0x3739('0x1e')]({'raw':_0x193c7d[_0x3739('0x15')]?_0x193c7d[_0x3739('0x15')][_0x3739('0x16')]===undefined?!![]:![]:!![],'where':_0x193c7d['options']?_0x193c7d[_0x3739('0x15')][_0x3739('0x17')]||null:null,'attributes':_0x193c7d[_0x3739('0x15')]?_0x193c7d[_0x3739('0x15')][_0x3739('0x1b')]||null:null,'include':_0x193c7d[_0x3739('0x15')]?_0x193c7d[_0x3739('0x15')]['include']?_[_0x3739('0x18')](_0x193c7d[_0x3739('0x15')][_0x3739('0x19')],function(_0x25a1f3){return{'model':db[_0x25a1f3[_0x3739('0x1a')]],'as':_0x25a1f3['as'],'attributes':_0x25a1f3[_0x3739('0x1b')],'include':_0x25a1f3[_0x3739('0x19')]?_[_0x3739('0x18')](_0x25a1f3['include'],function(_0x2a8f51){return{'model':db[_0x2a8f51[_0x3739('0x1a')]],'as':_0x2a8f51['as'],'attributes':_0x2a8f51[_0x3739('0x1b')],'include':_0x2a8f51[_0x3739('0x19')]?_[_0x3739('0x18')](_0x2a8f51[_0x3739('0x19')],function(_0x89d343){return{'model':db[_0x89d343[_0x3739('0x1a')]],'as':_0x89d343['as'],'attributes':_0x89d343[_0x3739('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3739('0x7')](function(_0x522386){logger[_0x3739('0x8')](_0x3739('0x1d'),_0x193c7d);logger[_0x3739('0x1c')](_0x3739('0x1d'),_0x193c7d,JSON[_0x3739('0xc')](_0x522386));_0x2952d1(_0x522386);})[_0x3739('0x11')](function(_0x58b453){logger['error'](_0x3739('0x1d'),_0x58b453[_0x3739('0xf')],_0x193c7d);_0xbfbdc2(_0x5dcda0[_0x3739('0xd')](0x1f4,_0x58b453[_0x3739('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index cd06f7a..bd93a5a 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x18f64a,_0x1c8248){var _0x44687f=function(_0x1234ad){while(--_0x1234ad){_0x18f64a['push'](_0x18f64a['shift']());}};_0x44687f(++_0x1c8248);}(_0x55ca,0x126));var _0xa55c=function(_0xb65e77,_0x238c3d){_0xb65e77=_0xb65e77-0x0;var _0x38134b=_0x55ca[_0xb65e77];return _0x38134b;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file +var _0x3e74=['show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','getTags','post','/:id/tags','setTags','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x2af506,_0x18ede1){var _0x43bcae=function(_0x16112c){while(--_0x16112c){_0x2af506['push'](_0x2af506['shift']());}};_0x43bcae(++_0x18ede1);}(_0x3e74,0x175));var _0x43e7=function(_0x307b3c,_0x110404){_0x307b3c=_0x307b3c-0x0;var _0x3bacc4=_0x3e74[_0x307b3c];return _0x3bacc4;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/subjects',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/tags',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0x13'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router['put']('/:id',auth[_0x43e7('0x8')](),controller[_0x43e7('0x15')]);router[_0x43e7('0x16')](_0x43e7('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x43e7('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index e455f7e..08307c4 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 _0x5da4=['STRING'];(function(_0x5ef161,_0x27d16c){var _0x1c6e9e=function(_0x8fc2a6){while(--_0x8fc2a6){_0x5ef161['push'](_0x5ef161['shift']());}};_0x1c6e9e(++_0x27d16c);}(_0x5da4,0x13e));var _0x45da=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x5da4[_0x13e741];return _0x3f8bb3;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x45da('0x0')]},'description':{'type':Sequelize[_0x45da('0x0')]}}; \ No newline at end of file +var _0xe75e=['STRING'];(function(_0x757fa,_0x4aa665){var _0x4028c2=function(_0x5d52e1){while(--_0x5d52e1){_0x757fa['push'](_0x757fa['shift']());}};_0x4028c2(++_0x4aa665);}(_0xe75e,0xb2));var _0xee75=function(_0x30182f,_0x30ce41){_0x30182f=_0x30182f-0x0;var _0x5207db=_0xe75e[_0x30182f];return _0x5207db;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xee75('0x0')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index ab719a0..1847ffe 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 _0xaa5c=['show','create','body','find','params','findOne','DeskField','length','pick','merge','getFields','getSubjects','getDescriptions','Tag','getTags','setTags','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','name','index','DeskConfiguration','rawAttributes','fieldName','map','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','filter','where','type','VIRTUAL','options','includeAll','include','findAll','rows','catch'];(function(_0x2e26d0,_0x10115c){var _0x5e2915=function(_0xa592ab){while(--_0xa592ab){_0x2e26d0['push'](_0x2e26d0['shift']());}};_0x5e2915(++_0x10115c);}(_0xaa5c,0x65));var _0xcaa5=function(_0x5bdc76,_0x3981b9){_0x5bdc76=_0x5bdc76-0x0;var _0x55a116=_0xaa5c[_0x5bdc76];return _0x55a116;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcaa5('0x0'));var zipdir=require(_0xcaa5('0x1'));var jsonpatch=require(_0xcaa5('0x2'));var rp=require('request-promise');var moment=require(_0xcaa5('0x3'));var BPromise=require(_0xcaa5('0x4'));var Mustache=require(_0xcaa5('0x5'));var util=require(_0xcaa5('0x6'));var path=require(_0xcaa5('0x7'));var sox=require(_0xcaa5('0x8'));var csv=require(_0xcaa5('0x9'));var ejs=require(_0xcaa5('0xa'));var fs=require('fs');var fs_extra=require(_0xcaa5('0xb'));var _=require(_0xcaa5('0xc'));var squel=require(_0xcaa5('0xd'));var crypto=require('crypto');var jsforce=require(_0xcaa5('0xe'));var deskjs=require(_0xcaa5('0xf'));var toCsv=require(_0xcaa5('0x9'));var querystring=require(_0xcaa5('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xcaa5('0x11'));var qs=require(_0xcaa5('0x12'));var as=require(_0xcaa5('0x13'));var hardwareService=require(_0xcaa5('0x14'));var logger=require(_0xcaa5('0x15'))('api');var utils=require(_0xcaa5('0x16'));var config=require(_0xcaa5('0x17'));var licenseUtil=require(_0xcaa5('0x18'));var db=require(_0xcaa5('0x19'))['db'];function respondWithStatusCode(_0x35f894,_0x185960){_0x185960=_0x185960||0xcc;return function(_0x531687){if(_0x531687){return _0x35f894[_0xcaa5('0x1a')](_0x185960);}return _0x35f894[_0xcaa5('0x1b')](_0x185960)[_0xcaa5('0x1c')]();};}function respondWithResult(_0x2f0d3c,_0x465c59){_0x465c59=_0x465c59||0xc8;return function(_0x3c6d39){if(_0x3c6d39){return _0x2f0d3c[_0xcaa5('0x1b')](_0x465c59)[_0xcaa5('0x1d')](_0x3c6d39);}};}function respondWithFilteredResult(_0x1bd74a,_0x238758){return function(_0x3c3de2){if(_0x3c3de2){var _0x4597ad=typeof _0x238758[_0xcaa5('0x1e')]===_0xcaa5('0x1f')&&typeof _0x238758[_0xcaa5('0x20')]===_0xcaa5('0x1f');var _0x330603=_0x3c3de2[_0xcaa5('0x21')];var _0xb1be10=_0x4597ad?0x0:_0x238758[_0xcaa5('0x1e')];var _0x3653cc=_0x4597ad?_0x3c3de2['count']:_0x238758[_0xcaa5('0x1e')]+_0x238758[_0xcaa5('0x20')];var _0x3d670c;if(_0x3653cc>=_0x330603){_0x3653cc=_0x330603;_0x3d670c=0xc8;}else{_0x3d670c=0xce;}_0x1bd74a[_0xcaa5('0x1b')](_0x3d670c);return _0x1bd74a[_0xcaa5('0x22')](_0xcaa5('0x23'),_0xb1be10+'-'+_0x3653cc+'/'+_0x330603)[_0xcaa5('0x1d')](_0x3c3de2);}return null;};}function patchUpdates(_0x427f43){return function(_0xd324fe){try{jsonpatch[_0xcaa5('0x24')](_0xd324fe,_0x427f43,!![]);}catch(_0x4d363a){return BPromise['reject'](_0x4d363a);}return _0xd324fe[_0xcaa5('0x25')]();};}function saveUpdates(_0x167ba4,_0x5f588f){return function(_0x1a0448){if(_0x1a0448){return _0x1a0448[_0xcaa5('0x26')](_0x167ba4)[_0xcaa5('0x27')](function(_0x214125){return _0x214125;});}return null;};}function removeEntity(_0x2f47be,_0x556c00){return function(_0x5dcbfc){if(_0x5dcbfc){return _0x5dcbfc[_0xcaa5('0x28')]()[_0xcaa5('0x27')](function(){_0x2f47be[_0xcaa5('0x1b')](0xcc)[_0xcaa5('0x1c')]();});}};}function handleEntityNotFound(_0x33ac45,_0x5d4053){return function(_0x5aa005){if(!_0x5aa005){_0x33ac45[_0xcaa5('0x1a')](0x194);}return _0x5aa005;};}function handleError(_0x412361,_0x4cee60){_0x4cee60=_0x4cee60||0x1f4;return function(_0x34cf4b){logger[_0xcaa5('0x29')](_0x34cf4b['stack']);if(_0x34cf4b[_0xcaa5('0x2a')]){delete _0x34cf4b[_0xcaa5('0x2a')];}_0x412361[_0xcaa5('0x1b')](_0x4cee60)['send'](_0x34cf4b);};}exports[_0xcaa5('0x2b')]=function(_0x1c8c85,_0x4ae277){var _0x17a231={},_0x2012f3={},_0x410a58={'count':0x0,'rows':[]};var _0x3e23ed=_['map'](db[_0xcaa5('0x2c')][_0xcaa5('0x2d')],function(_0x4b8a83){return{'name':_0x4b8a83[_0xcaa5('0x2e')],'type':_0x4b8a83['type']['key']};});_0x2012f3['model']=_[_0xcaa5('0x2f')](_0x3e23ed,_0xcaa5('0x2a'));_0x2012f3[_0xcaa5('0x30')]=_[_0xcaa5('0x31')](_0x1c8c85[_0xcaa5('0x30')]);_0x2012f3['filters']=_[_0xcaa5('0x32')](_0x2012f3[_0xcaa5('0x33')],_0x2012f3[_0xcaa5('0x30')]);_0x17a231[_0xcaa5('0x34')]=_[_0xcaa5('0x32')](_0x2012f3['model'],qs[_0xcaa5('0x35')](_0x1c8c85['query'][_0xcaa5('0x35')]));_0x17a231[_0xcaa5('0x34')]=_0x17a231['attributes']['length']?_0x17a231[_0xcaa5('0x34')]:_0x2012f3['model'];if(!_0x1c8c85[_0xcaa5('0x30')][_0xcaa5('0x36')](_0xcaa5('0x37'))){_0x17a231[_0xcaa5('0x20')]=qs[_0xcaa5('0x20')](_0x1c8c85[_0xcaa5('0x30')]['limit']);_0x17a231[_0xcaa5('0x1e')]=qs[_0xcaa5('0x1e')](_0x1c8c85[_0xcaa5('0x30')][_0xcaa5('0x1e')]);}_0x17a231[_0xcaa5('0x38')]=qs[_0xcaa5('0x39')](_0x1c8c85['query']['sort']);_0x17a231['where']=qs[_0xcaa5('0x3a')](_['pick'](_0x1c8c85[_0xcaa5('0x30')],_0x2012f3['filters']),_0x3e23ed);if(_0x1c8c85[_0xcaa5('0x30')][_0xcaa5('0x3b')]){_0x17a231[_0xcaa5('0x3c')]=_['merge'](_0x17a231[_0xcaa5('0x3c')],{'$or':_[_0xcaa5('0x2f')](_0x3e23ed,function(_0x1db19f){if(_0x1db19f[_0xcaa5('0x3d')]!==_0xcaa5('0x3e')){var _0x222286={};_0x222286[_0x1db19f['name']]={'$like':'%'+_0x1c8c85[_0xcaa5('0x30')][_0xcaa5('0x3b')]+'%'};return _0x222286;}})});}_0x17a231=_['merge']({},_0x17a231,_0x1c8c85[_0xcaa5('0x3f')]);var _0x31ac45={'where':_0x17a231['where']};return db[_0xcaa5('0x2c')][_0xcaa5('0x21')](_0x31ac45)['then'](function(_0x43452e){_0x410a58[_0xcaa5('0x21')]=_0x43452e;if(_0x1c8c85[_0xcaa5('0x30')][_0xcaa5('0x40')]){_0x17a231[_0xcaa5('0x41')]=[{'all':!![]}];}return db['DeskConfiguration'][_0xcaa5('0x42')](_0x17a231);})[_0xcaa5('0x27')](function(_0x5746db){_0x410a58[_0xcaa5('0x43')]=_0x5746db;return _0x410a58;})[_0xcaa5('0x27')](respondWithFilteredResult(_0x4ae277,_0x17a231))[_0xcaa5('0x44')](handleError(_0x4ae277,null));};exports[_0xcaa5('0x45')]=function(_0x35265b,_0x33cc6e){var _0x4e0814={'raw':![],'where':{'id':_0x35265b['params']['id']}},_0x523dfb={};_0x523dfb['model']=_['keys'](db[_0xcaa5('0x2c')][_0xcaa5('0x2d')]);_0x523dfb['query']=_[_0xcaa5('0x31')](_0x35265b[_0xcaa5('0x30')]);_0x523dfb[_0xcaa5('0x3a')]=_[_0xcaa5('0x32')](_0x523dfb[_0xcaa5('0x33')],_0x523dfb[_0xcaa5('0x30')]);_0x4e0814['attributes']=_['intersection'](_0x523dfb[_0xcaa5('0x33')],qs['fields'](_0x35265b[_0xcaa5('0x30')][_0xcaa5('0x35')]));_0x4e0814[_0xcaa5('0x34')]=_0x4e0814[_0xcaa5('0x34')]['length']?_0x4e0814[_0xcaa5('0x34')]:_0x523dfb[_0xcaa5('0x33')];if(_0x35265b[_0xcaa5('0x30')][_0xcaa5('0x40')]){_0x4e0814['include']=[{'all':!![]}];}_0x4e0814=_['merge']({},_0x4e0814,_0x35265b[_0xcaa5('0x3f')]);return db[_0xcaa5('0x2c')]['find'](_0x4e0814)[_0xcaa5('0x27')](handleEntityNotFound(_0x33cc6e,null))[_0xcaa5('0x27')](respondWithResult(_0x33cc6e,null))['catch'](handleError(_0x33cc6e,null));};exports[_0xcaa5('0x46')]=function(_0x1ad289,_0x12166b){return db['DeskConfiguration']['create'](_0x1ad289[_0xcaa5('0x47')],{})[_0xcaa5('0x27')](respondWithResult(_0x12166b,0xc9))['catch'](handleError(_0x12166b,null));};exports['update']=function(_0x23c096,_0x537424){if(_0x23c096['body']['id']){delete _0x23c096['body']['id'];}return db[_0xcaa5('0x2c')][_0xcaa5('0x48')]({'where':{'id':_0x23c096[_0xcaa5('0x49')]['id']}})['then'](handleEntityNotFound(_0x537424,null))[_0xcaa5('0x27')](saveUpdates(_0x23c096['body'],null))[_0xcaa5('0x27')](respondWithResult(_0x537424,null))[_0xcaa5('0x44')](handleError(_0x537424,null));};exports[_0xcaa5('0x28')]=function(_0x16d8b7,_0x4379f8){return db[_0xcaa5('0x2c')]['find']({'where':{'id':_0x16d8b7['params']['id']}})['then'](handleEntityNotFound(_0x4379f8,null))[_0xcaa5('0x27')](removeEntity(_0x4379f8,null))[_0xcaa5('0x44')](handleError(_0x4379f8,null));};exports['getFields']=function(_0x41aa9e,_0x4dc8ba,_0x4e04c){var _0x4ed9c9={};var _0x1abf1d={};var _0x3420f6;var _0x5d0936;return db[_0xcaa5('0x2c')][_0xcaa5('0x4a')]({'where':{'id':_0x41aa9e[_0xcaa5('0x49')]['id']}})[_0xcaa5('0x27')](handleEntityNotFound(_0x4dc8ba,null))[_0xcaa5('0x27')](function(_0x15bbfe){if(_0x15bbfe){_0x3420f6=_0x15bbfe;_0x1abf1d[_0xcaa5('0x33')]=_[_0xcaa5('0x31')](db[_0xcaa5('0x4b')]['rawAttributes']);_0x1abf1d[_0xcaa5('0x30')]=_[_0xcaa5('0x31')](_0x41aa9e[_0xcaa5('0x30')]);_0x1abf1d[_0xcaa5('0x3a')]=_[_0xcaa5('0x32')](_0x1abf1d['model'],_0x1abf1d[_0xcaa5('0x30')]);_0x4ed9c9[_0xcaa5('0x34')]=_[_0xcaa5('0x32')](_0x1abf1d[_0xcaa5('0x33')],qs['fields'](_0x41aa9e['query'][_0xcaa5('0x35')]));_0x4ed9c9[_0xcaa5('0x34')]=_0x4ed9c9['attributes'][_0xcaa5('0x4c')]?_0x4ed9c9['attributes']:_0x1abf1d[_0xcaa5('0x33')];_0x4ed9c9['order']=qs[_0xcaa5('0x39')](_0x41aa9e[_0xcaa5('0x30')]['sort']);_0x4ed9c9[_0xcaa5('0x3c')]=qs[_0xcaa5('0x3a')](_[_0xcaa5('0x4d')](_0x41aa9e['query'],_0x1abf1d[_0xcaa5('0x3a')]));if(_0x41aa9e[_0xcaa5('0x30')][_0xcaa5('0x3b')]){_0x4ed9c9[_0xcaa5('0x3c')]=_[_0xcaa5('0x4e')](_0x4ed9c9[_0xcaa5('0x3c')],{'$or':_['map'](_0x4ed9c9[_0xcaa5('0x34')],function(_0x4aee87){var _0x339cad={};_0x339cad[_0x4aee87]={'$like':'%'+_0x41aa9e['query'][_0xcaa5('0x3b')]+'%'};return _0x339cad;})});}_0x4ed9c9=_[_0xcaa5('0x4e')]({},_0x4ed9c9,_0x41aa9e[_0xcaa5('0x3f')]);return _0x3420f6[_0xcaa5('0x4f')](_0x4ed9c9);}})['then'](function(_0x4055f3){if(_0x4055f3){_0x5d0936=_0x4055f3[_0xcaa5('0x4c')];if(!_0x41aa9e[_0xcaa5('0x30')][_0xcaa5('0x36')]('nolimit')){_0x4ed9c9[_0xcaa5('0x20')]=qs[_0xcaa5('0x20')](_0x41aa9e[_0xcaa5('0x30')][_0xcaa5('0x20')]);_0x4ed9c9[_0xcaa5('0x1e')]=qs[_0xcaa5('0x1e')](_0x41aa9e['query']['offset']);}return _0x3420f6[_0xcaa5('0x4f')](_0x4ed9c9);}})[_0xcaa5('0x27')](function(_0x362767){if(_0x362767){return _0x362767?{'count':_0x5d0936,'rows':_0x362767}:null;}})[_0xcaa5('0x27')](respondWithResult(_0x4dc8ba,null))[_0xcaa5('0x44')](handleError(_0x4dc8ba,null));};exports[_0xcaa5('0x50')]=function(_0x388973,_0x3c9e7c,_0x4a2054){var _0xa6312d={};var _0x543fa9={};var _0x32530a;var _0x2859ff;return db['DeskConfiguration'][_0xcaa5('0x4a')]({'where':{'id':_0x388973['params']['id']}})['then'](handleEntityNotFound(_0x3c9e7c,null))[_0xcaa5('0x27')](function(_0x3ff115){if(_0x3ff115){_0x32530a=_0x3ff115;_0x543fa9[_0xcaa5('0x33')]=_['keys'](db[_0xcaa5('0x4b')][_0xcaa5('0x2d')]);_0x543fa9[_0xcaa5('0x30')]=_['keys'](_0x388973[_0xcaa5('0x30')]);_0x543fa9['filters']=_[_0xcaa5('0x32')](_0x543fa9[_0xcaa5('0x33')],_0x543fa9[_0xcaa5('0x30')]);_0xa6312d[_0xcaa5('0x34')]=_[_0xcaa5('0x32')](_0x543fa9[_0xcaa5('0x33')],qs[_0xcaa5('0x35')](_0x388973[_0xcaa5('0x30')]['fields']));_0xa6312d[_0xcaa5('0x34')]=_0xa6312d[_0xcaa5('0x34')][_0xcaa5('0x4c')]?_0xa6312d[_0xcaa5('0x34')]:_0x543fa9[_0xcaa5('0x33')];_0xa6312d[_0xcaa5('0x38')]=qs['sort'](_0x388973[_0xcaa5('0x30')][_0xcaa5('0x39')]);_0xa6312d[_0xcaa5('0x3c')]=qs['filters'](_['pick'](_0x388973[_0xcaa5('0x30')],_0x543fa9['filters']));if(_0x388973[_0xcaa5('0x30')]['filter']){_0xa6312d[_0xcaa5('0x3c')]=_[_0xcaa5('0x4e')](_0xa6312d[_0xcaa5('0x3c')],{'$or':_[_0xcaa5('0x2f')](_0xa6312d[_0xcaa5('0x34')],function(_0x59b555){var _0x37c421={};_0x37c421[_0x59b555]={'$like':'%'+_0x388973[_0xcaa5('0x30')][_0xcaa5('0x3b')]+'%'};return _0x37c421;})});}_0xa6312d=_[_0xcaa5('0x4e')]({},_0xa6312d,_0x388973[_0xcaa5('0x3f')]);return _0x32530a[_0xcaa5('0x50')](_0xa6312d);}})[_0xcaa5('0x27')](function(_0x3e209a){if(_0x3e209a){_0x2859ff=_0x3e209a[_0xcaa5('0x4c')];if(!_0x388973[_0xcaa5('0x30')][_0xcaa5('0x36')](_0xcaa5('0x37'))){_0xa6312d[_0xcaa5('0x20')]=qs[_0xcaa5('0x20')](_0x388973['query']['limit']);_0xa6312d[_0xcaa5('0x1e')]=qs[_0xcaa5('0x1e')](_0x388973['query'][_0xcaa5('0x1e')]);}return _0x32530a[_0xcaa5('0x50')](_0xa6312d);}})[_0xcaa5('0x27')](function(_0x480add){if(_0x480add){return _0x480add?{'count':_0x2859ff,'rows':_0x480add}:null;}})['then'](respondWithResult(_0x3c9e7c,null))[_0xcaa5('0x44')](handleError(_0x3c9e7c,null));};exports[_0xcaa5('0x51')]=function(_0x111291,_0x379df2,_0x375c61){var _0x1e31db={};var _0x4b0c95={};var _0x45a7ce;var _0x227e94;return db[_0xcaa5('0x2c')][_0xcaa5('0x4a')]({'where':{'id':_0x111291[_0xcaa5('0x49')]['id']}})['then'](handleEntityNotFound(_0x379df2,null))[_0xcaa5('0x27')](function(_0x35899c){if(_0x35899c){_0x45a7ce=_0x35899c;_0x4b0c95[_0xcaa5('0x33')]=_['keys'](db[_0xcaa5('0x4b')][_0xcaa5('0x2d')]);_0x4b0c95[_0xcaa5('0x30')]=_['keys'](_0x111291[_0xcaa5('0x30')]);_0x4b0c95[_0xcaa5('0x3a')]=_[_0xcaa5('0x32')](_0x4b0c95[_0xcaa5('0x33')],_0x4b0c95[_0xcaa5('0x30')]);_0x1e31db['attributes']=_['intersection'](_0x4b0c95[_0xcaa5('0x33')],qs['fields'](_0x111291[_0xcaa5('0x30')]['fields']));_0x1e31db[_0xcaa5('0x34')]=_0x1e31db[_0xcaa5('0x34')][_0xcaa5('0x4c')]?_0x1e31db[_0xcaa5('0x34')]:_0x4b0c95[_0xcaa5('0x33')];_0x1e31db[_0xcaa5('0x38')]=qs[_0xcaa5('0x39')](_0x111291['query']['sort']);_0x1e31db[_0xcaa5('0x3c')]=qs[_0xcaa5('0x3a')](_[_0xcaa5('0x4d')](_0x111291['query'],_0x4b0c95[_0xcaa5('0x3a')]));if(_0x111291[_0xcaa5('0x30')][_0xcaa5('0x3b')]){_0x1e31db[_0xcaa5('0x3c')]=_[_0xcaa5('0x4e')](_0x1e31db['where'],{'$or':_['map'](_0x1e31db[_0xcaa5('0x34')],function(_0x2c921b){var _0x4bc5ea={};_0x4bc5ea[_0x2c921b]={'$like':'%'+_0x111291[_0xcaa5('0x30')][_0xcaa5('0x3b')]+'%'};return _0x4bc5ea;})});}_0x1e31db=_[_0xcaa5('0x4e')]({},_0x1e31db,_0x111291[_0xcaa5('0x3f')]);return _0x45a7ce['getDescriptions'](_0x1e31db);}})[_0xcaa5('0x27')](function(_0x5d0a5c){if(_0x5d0a5c){_0x227e94=_0x5d0a5c['length'];if(!_0x111291[_0xcaa5('0x30')]['hasOwnProperty'](_0xcaa5('0x37'))){_0x1e31db[_0xcaa5('0x20')]=qs['limit'](_0x111291[_0xcaa5('0x30')][_0xcaa5('0x20')]);_0x1e31db['offset']=qs[_0xcaa5('0x1e')](_0x111291[_0xcaa5('0x30')][_0xcaa5('0x1e')]);}return _0x45a7ce['getDescriptions'](_0x1e31db);}})[_0xcaa5('0x27')](function(_0x5df159){if(_0x5df159){return _0x5df159?{'count':_0x227e94,'rows':_0x5df159}:null;}})[_0xcaa5('0x27')](respondWithResult(_0x379df2,null))['catch'](handleError(_0x379df2,null));};exports['getTags']=function(_0x33bab5,_0x1a7bff,_0x321532){var _0x5760cc={};var _0x4cfff9={};var _0x2b8a9a;var _0x405424;return db[_0xcaa5('0x2c')][_0xcaa5('0x4a')]({'where':{'id':_0x33bab5[_0xcaa5('0x49')]['id']}})[_0xcaa5('0x27')](handleEntityNotFound(_0x1a7bff,null))[_0xcaa5('0x27')](function(_0x1fa2e6){if(_0x1fa2e6){_0x2b8a9a=_0x1fa2e6;_0x4cfff9[_0xcaa5('0x33')]=_[_0xcaa5('0x31')](db[_0xcaa5('0x52')][_0xcaa5('0x2d')]);_0x4cfff9['query']=_[_0xcaa5('0x31')](_0x33bab5[_0xcaa5('0x30')]);_0x4cfff9[_0xcaa5('0x3a')]=_[_0xcaa5('0x32')](_0x4cfff9[_0xcaa5('0x33')],_0x4cfff9[_0xcaa5('0x30')]);_0x5760cc[_0xcaa5('0x34')]=_[_0xcaa5('0x32')](_0x4cfff9[_0xcaa5('0x33')],qs[_0xcaa5('0x35')](_0x33bab5[_0xcaa5('0x30')][_0xcaa5('0x35')]));_0x5760cc[_0xcaa5('0x34')]=_0x5760cc[_0xcaa5('0x34')][_0xcaa5('0x4c')]?_0x5760cc[_0xcaa5('0x34')]:_0x4cfff9['model'];_0x5760cc['order']=qs['sort'](_0x33bab5[_0xcaa5('0x30')][_0xcaa5('0x39')]);_0x5760cc[_0xcaa5('0x3c')]=qs['filters'](_[_0xcaa5('0x4d')](_0x33bab5[_0xcaa5('0x30')],_0x4cfff9[_0xcaa5('0x3a')]));if(_0x33bab5[_0xcaa5('0x30')][_0xcaa5('0x3b')]){_0x5760cc[_0xcaa5('0x3c')]=_[_0xcaa5('0x4e')](_0x5760cc[_0xcaa5('0x3c')],{'$or':_[_0xcaa5('0x2f')](_0x5760cc[_0xcaa5('0x34')],function(_0x220062){var _0x8b453d={};_0x8b453d[_0x220062]={'$like':'%'+_0x33bab5['query'][_0xcaa5('0x3b')]+'%'};return _0x8b453d;})});}_0x5760cc=_['merge']({},_0x5760cc,_0x33bab5[_0xcaa5('0x3f')]);return _0x2b8a9a[_0xcaa5('0x53')](_0x5760cc);}})['then'](function(_0x4eb4cd){if(_0x4eb4cd){_0x405424=_0x4eb4cd['length'];if(!_0x33bab5[_0xcaa5('0x30')][_0xcaa5('0x36')]('nolimit')){_0x5760cc['limit']=qs[_0xcaa5('0x20')](_0x33bab5['query']['limit']);_0x5760cc[_0xcaa5('0x1e')]=qs[_0xcaa5('0x1e')](_0x33bab5[_0xcaa5('0x30')]['offset']);}return _0x2b8a9a[_0xcaa5('0x53')](_0x5760cc);}})[_0xcaa5('0x27')](function(_0x34046d){if(_0x34046d){return _0x34046d?{'count':_0x405424,'rows':_0x34046d}:null;}})[_0xcaa5('0x27')](respondWithResult(_0x1a7bff,null))[_0xcaa5('0x44')](handleError(_0x1a7bff,null));};exports['setTags']=function(_0x47d75a,_0x4ef088,_0x43693d){if(_0x47d75a[_0xcaa5('0x47')]['id']){delete _0x47d75a[_0xcaa5('0x47')]['id'];}return db[_0xcaa5('0x2c')][_0xcaa5('0x4a')]({'where':{'id':_0x47d75a[_0xcaa5('0x49')]['id']}})[_0xcaa5('0x27')](handleEntityNotFound(_0x4ef088,null))[_0xcaa5('0x27')](function(_0x362e49){if(_0x362e49){return _0x362e49[_0xcaa5('0x54')](_0x47d75a[_0xcaa5('0x47')]['ids']||[]);}return null;})[_0xcaa5('0x27')](respondWithResult(_0x4ef088,null))[_0xcaa5('0x44')](handleError(_0x4ef088,null));}; \ No newline at end of file +var _0x06cf=['to-csv','lodash','squel','crypto','desk.js','papaparse','ioredis','../../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','reject','save','update','then','destroy','error','name','send','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','find','create','body','DeskField','getFields','nolimit','getSubjects','findOne','options','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox'];(function(_0x3f59b1,_0x25cdbe){var _0x11d2e8=function(_0x37b3fc){while(--_0x37b3fc){_0x3f59b1['push'](_0x3f59b1['shift']());}};_0x11d2e8(++_0x25cdbe);}(_0x06cf,0x1ef));var _0xf06c=function(_0x3c4bfc,_0x56a8be){_0x3c4bfc=_0x3c4bfc-0x0;var _0x10387f=_0x06cf[_0x3c4bfc];return _0x10387f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf06c('0x0'));var zipdir=require(_0xf06c('0x1'));var jsonpatch=require(_0xf06c('0x2'));var rp=require(_0xf06c('0x3'));var moment=require('moment');var BPromise=require(_0xf06c('0x4'));var Mustache=require(_0xf06c('0x5'));var util=require(_0xf06c('0x6'));var path=require(_0xf06c('0x7'));var sox=require(_0xf06c('0x8'));var csv=require(_0xf06c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf06c('0xa'));var squel=require(_0xf06c('0xb'));var crypto=require(_0xf06c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf06c('0xd'));var toCsv=require(_0xf06c('0x9'));var querystring=require('querystring');var Papa=require(_0xf06c('0xe'));var Redis=require(_0xf06c('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf06c('0x10'));var hardwareService=require(_0xf06c('0x11'));var logger=require(_0xf06c('0x12'))(_0xf06c('0x13'));var utils=require(_0xf06c('0x14'));var config=require(_0xf06c('0x15'));var licenseUtil=require(_0xf06c('0x16'));var db=require(_0xf06c('0x17'))['db'];function respondWithStatusCode(_0x442681,_0x4b6530){_0x4b6530=_0x4b6530||0xcc;return function(_0x275829){if(_0x275829){return _0x442681[_0xf06c('0x18')](_0x4b6530);}return _0x442681[_0xf06c('0x19')](_0x4b6530)[_0xf06c('0x1a')]();};}function respondWithResult(_0x2bf3b0,_0x287da6){_0x287da6=_0x287da6||0xc8;return function(_0x4eb2c7){if(_0x4eb2c7){return _0x2bf3b0[_0xf06c('0x19')](_0x287da6)[_0xf06c('0x1b')](_0x4eb2c7);}};}function respondWithFilteredResult(_0x5550ab,_0x185a04){return function(_0x472c73){if(_0x472c73){var _0x2c12c0=typeof _0x185a04[_0xf06c('0x1c')]===_0xf06c('0x1d')&&typeof _0x185a04['limit']===_0xf06c('0x1d');var _0x2d5a5b=_0x472c73[_0xf06c('0x1e')];var _0x1061da=_0x2c12c0?0x0:_0x185a04[_0xf06c('0x1c')];var _0x5fbce2=_0x2c12c0?_0x472c73['count']:_0x185a04['offset']+_0x185a04[_0xf06c('0x1f')];var _0x310d82;if(_0x5fbce2>=_0x2d5a5b){_0x5fbce2=_0x2d5a5b;_0x310d82=0xc8;}else{_0x310d82=0xce;}_0x5550ab['status'](_0x310d82);return _0x5550ab[_0xf06c('0x20')](_0xf06c('0x21'),_0x1061da+'-'+_0x5fbce2+'/'+_0x2d5a5b)['json'](_0x472c73);}return null;};}function patchUpdates(_0x55dc30){return function(_0x5bdd21){try{jsonpatch['apply'](_0x5bdd21,_0x55dc30,!![]);}catch(_0x321286){return BPromise[_0xf06c('0x22')](_0x321286);}return _0x5bdd21[_0xf06c('0x23')]();};}function saveUpdates(_0x3e4add,_0x330923){return function(_0x520137){if(_0x520137){return _0x520137[_0xf06c('0x24')](_0x3e4add)[_0xf06c('0x25')](function(_0x1eb44e){return _0x1eb44e;});}return null;};}function removeEntity(_0xfd24de,_0x5d1f49){return function(_0x13e4e1){if(_0x13e4e1){return _0x13e4e1[_0xf06c('0x26')]()[_0xf06c('0x25')](function(){_0xfd24de['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b37ca,_0x426dae){return function(_0x24177f){if(!_0x24177f){_0x5b37ca[_0xf06c('0x18')](0x194);}return _0x24177f;};}function handleError(_0x4a57fc,_0x2f8765){_0x2f8765=_0x2f8765||0x1f4;return function(_0x11f12c){logger[_0xf06c('0x27')](_0x11f12c['stack']);if(_0x11f12c[_0xf06c('0x28')]){delete _0x11f12c['name'];}_0x4a57fc[_0xf06c('0x19')](_0x2f8765)[_0xf06c('0x29')](_0x11f12c);};}exports['index']=function(_0x231f6c,_0x482c3e){var _0x20756d={},_0x3f56f9={},_0x5d2091={'count':0x0,'rows':[]};var _0x5d74d8=_[_0xf06c('0x2a')](db[_0xf06c('0x2b')][_0xf06c('0x2c')],function(_0x49fc41){return{'name':_0x49fc41[_0xf06c('0x2d')],'type':_0x49fc41[_0xf06c('0x2e')][_0xf06c('0x2f')]};});_0x3f56f9[_0xf06c('0x30')]=_['map'](_0x5d74d8,_0xf06c('0x28'));_0x3f56f9[_0xf06c('0x31')]=_[_0xf06c('0x32')](_0x231f6c[_0xf06c('0x31')]);_0x3f56f9[_0xf06c('0x33')]=_[_0xf06c('0x34')](_0x3f56f9[_0xf06c('0x30')],_0x3f56f9[_0xf06c('0x31')]);_0x20756d[_0xf06c('0x35')]=_[_0xf06c('0x34')](_0x3f56f9[_0xf06c('0x30')],qs[_0xf06c('0x36')](_0x231f6c[_0xf06c('0x31')][_0xf06c('0x36')]));_0x20756d[_0xf06c('0x35')]=_0x20756d[_0xf06c('0x35')][_0xf06c('0x37')]?_0x20756d['attributes']:_0x3f56f9['model'];if(!_0x231f6c[_0xf06c('0x31')][_0xf06c('0x38')]('nolimit')){_0x20756d[_0xf06c('0x1f')]=qs[_0xf06c('0x1f')](_0x231f6c['query'][_0xf06c('0x1f')]);_0x20756d['offset']=qs[_0xf06c('0x1c')](_0x231f6c[_0xf06c('0x31')][_0xf06c('0x1c')]);}_0x20756d[_0xf06c('0x39')]=qs[_0xf06c('0x3a')](_0x231f6c[_0xf06c('0x31')][_0xf06c('0x3a')]);_0x20756d[_0xf06c('0x3b')]=qs[_0xf06c('0x33')](_[_0xf06c('0x3c')](_0x231f6c[_0xf06c('0x31')],_0x3f56f9[_0xf06c('0x33')]),_0x5d74d8);if(_0x231f6c[_0xf06c('0x31')][_0xf06c('0x3d')]){_0x20756d[_0xf06c('0x3b')]=_[_0xf06c('0x3e')](_0x20756d[_0xf06c('0x3b')],{'$or':_['map'](_0x5d74d8,function(_0x149a5c){if(_0x149a5c['type']!==_0xf06c('0x3f')){var _0x19a2c9={};_0x19a2c9[_0x149a5c[_0xf06c('0x28')]]={'$like':'%'+_0x231f6c[_0xf06c('0x31')][_0xf06c('0x3d')]+'%'};return _0x19a2c9;}})});}_0x20756d=_['merge']({},_0x20756d,_0x231f6c['options']);var _0x5003db={'where':_0x20756d[_0xf06c('0x3b')]};return db[_0xf06c('0x2b')][_0xf06c('0x1e')](_0x5003db)[_0xf06c('0x25')](function(_0x2bb6e7){_0x5d2091[_0xf06c('0x1e')]=_0x2bb6e7;if(_0x231f6c[_0xf06c('0x31')][_0xf06c('0x40')]){_0x20756d[_0xf06c('0x41')]=[{'all':!![]}];}return db['DeskConfiguration']['findAll'](_0x20756d);})[_0xf06c('0x25')](function(_0x574bdf){_0x5d2091[_0xf06c('0x42')]=_0x574bdf;return _0x5d2091;})[_0xf06c('0x25')](respondWithFilteredResult(_0x482c3e,_0x20756d))[_0xf06c('0x43')](handleError(_0x482c3e,null));};exports[_0xf06c('0x44')]=function(_0x5e8c91,_0x567d30){var _0xc3ce45={'raw':![],'where':{'id':_0x5e8c91[_0xf06c('0x45')]['id']}},_0x18de8e={};_0x18de8e['model']=_['keys'](db['DeskConfiguration']['rawAttributes']);_0x18de8e[_0xf06c('0x31')]=_[_0xf06c('0x32')](_0x5e8c91[_0xf06c('0x31')]);_0x18de8e[_0xf06c('0x33')]=_[_0xf06c('0x34')](_0x18de8e[_0xf06c('0x30')],_0x18de8e['query']);_0xc3ce45[_0xf06c('0x35')]=_[_0xf06c('0x34')](_0x18de8e[_0xf06c('0x30')],qs[_0xf06c('0x36')](_0x5e8c91[_0xf06c('0x31')][_0xf06c('0x36')]));_0xc3ce45['attributes']=_0xc3ce45[_0xf06c('0x35')][_0xf06c('0x37')]?_0xc3ce45['attributes']:_0x18de8e[_0xf06c('0x30')];if(_0x5e8c91[_0xf06c('0x31')][_0xf06c('0x40')]){_0xc3ce45[_0xf06c('0x41')]=[{'all':!![]}];}_0xc3ce45=_[_0xf06c('0x3e')]({},_0xc3ce45,_0x5e8c91['options']);return db[_0xf06c('0x2b')][_0xf06c('0x46')](_0xc3ce45)[_0xf06c('0x25')](handleEntityNotFound(_0x567d30,null))['then'](respondWithResult(_0x567d30,null))[_0xf06c('0x43')](handleError(_0x567d30,null));};exports[_0xf06c('0x47')]=function(_0x35087a,_0x1264a8){return db[_0xf06c('0x2b')]['create'](_0x35087a[_0xf06c('0x48')],{})[_0xf06c('0x25')](respondWithResult(_0x1264a8,0xc9))[_0xf06c('0x43')](handleError(_0x1264a8,null));};exports[_0xf06c('0x24')]=function(_0x5bb65e,_0x39caaf){if(_0x5bb65e[_0xf06c('0x48')]['id']){delete _0x5bb65e[_0xf06c('0x48')]['id'];}return db[_0xf06c('0x2b')]['find']({'where':{'id':_0x5bb65e[_0xf06c('0x45')]['id']}})[_0xf06c('0x25')](handleEntityNotFound(_0x39caaf,null))[_0xf06c('0x25')](saveUpdates(_0x5bb65e[_0xf06c('0x48')],null))['then'](respondWithResult(_0x39caaf,null))[_0xf06c('0x43')](handleError(_0x39caaf,null));};exports[_0xf06c('0x26')]=function(_0x36e38e,_0xe939a3){return db[_0xf06c('0x2b')][_0xf06c('0x46')]({'where':{'id':_0x36e38e['params']['id']}})[_0xf06c('0x25')](handleEntityNotFound(_0xe939a3,null))[_0xf06c('0x25')](removeEntity(_0xe939a3,null))[_0xf06c('0x43')](handleError(_0xe939a3,null));};exports['getFields']=function(_0x3c81e4,_0x242004,_0x1a91a8){var _0x5c9d56={};var _0x25a943={};var _0x542457;var _0x499fca;return db[_0xf06c('0x2b')]['findOne']({'where':{'id':_0x3c81e4[_0xf06c('0x45')]['id']}})[_0xf06c('0x25')](handleEntityNotFound(_0x242004,null))[_0xf06c('0x25')](function(_0x285855){if(_0x285855){_0x542457=_0x285855;_0x25a943[_0xf06c('0x30')]=_[_0xf06c('0x32')](db[_0xf06c('0x49')]['rawAttributes']);_0x25a943['query']=_[_0xf06c('0x32')](_0x3c81e4[_0xf06c('0x31')]);_0x25a943[_0xf06c('0x33')]=_[_0xf06c('0x34')](_0x25a943[_0xf06c('0x30')],_0x25a943[_0xf06c('0x31')]);_0x5c9d56[_0xf06c('0x35')]=_[_0xf06c('0x34')](_0x25a943['model'],qs['fields'](_0x3c81e4[_0xf06c('0x31')][_0xf06c('0x36')]));_0x5c9d56[_0xf06c('0x35')]=_0x5c9d56[_0xf06c('0x35')]['length']?_0x5c9d56[_0xf06c('0x35')]:_0x25a943[_0xf06c('0x30')];_0x5c9d56['order']=qs['sort'](_0x3c81e4[_0xf06c('0x31')][_0xf06c('0x3a')]);_0x5c9d56['where']=qs[_0xf06c('0x33')](_[_0xf06c('0x3c')](_0x3c81e4[_0xf06c('0x31')],_0x25a943[_0xf06c('0x33')]));if(_0x3c81e4[_0xf06c('0x31')][_0xf06c('0x3d')]){_0x5c9d56[_0xf06c('0x3b')]=_['merge'](_0x5c9d56[_0xf06c('0x3b')],{'$or':_[_0xf06c('0x2a')](_0x5c9d56[_0xf06c('0x35')],function(_0x39f372){var _0x1d2e3f={};_0x1d2e3f[_0x39f372]={'$like':'%'+_0x3c81e4[_0xf06c('0x31')]['filter']+'%'};return _0x1d2e3f;})});}_0x5c9d56=_['merge']({},_0x5c9d56,_0x3c81e4['options']);return _0x542457[_0xf06c('0x4a')](_0x5c9d56);}})[_0xf06c('0x25')](function(_0x3dd9fe){if(_0x3dd9fe){_0x499fca=_0x3dd9fe['length'];if(!_0x3c81e4[_0xf06c('0x31')][_0xf06c('0x38')](_0xf06c('0x4b'))){_0x5c9d56[_0xf06c('0x1f')]=qs[_0xf06c('0x1f')](_0x3c81e4['query']['limit']);_0x5c9d56['offset']=qs[_0xf06c('0x1c')](_0x3c81e4[_0xf06c('0x31')][_0xf06c('0x1c')]);}return _0x542457[_0xf06c('0x4a')](_0x5c9d56);}})[_0xf06c('0x25')](function(_0x3d07e1){if(_0x3d07e1){return _0x3d07e1?{'count':_0x499fca,'rows':_0x3d07e1}:null;}})[_0xf06c('0x25')](respondWithResult(_0x242004,null))['catch'](handleError(_0x242004,null));};exports[_0xf06c('0x4c')]=function(_0x13a74b,_0x2f2255,_0x59cc3d){var _0x15aef0={};var _0x4587d9={};var _0x196d97;var _0x530d03;return db['DeskConfiguration'][_0xf06c('0x4d')]({'where':{'id':_0x13a74b[_0xf06c('0x45')]['id']}})[_0xf06c('0x25')](handleEntityNotFound(_0x2f2255,null))[_0xf06c('0x25')](function(_0x32b654){if(_0x32b654){_0x196d97=_0x32b654;_0x4587d9['model']=_[_0xf06c('0x32')](db['DeskField'][_0xf06c('0x2c')]);_0x4587d9[_0xf06c('0x31')]=_[_0xf06c('0x32')](_0x13a74b['query']);_0x4587d9[_0xf06c('0x33')]=_['intersection'](_0x4587d9['model'],_0x4587d9[_0xf06c('0x31')]);_0x15aef0['attributes']=_[_0xf06c('0x34')](_0x4587d9[_0xf06c('0x30')],qs[_0xf06c('0x36')](_0x13a74b['query']['fields']));_0x15aef0['attributes']=_0x15aef0[_0xf06c('0x35')][_0xf06c('0x37')]?_0x15aef0[_0xf06c('0x35')]:_0x4587d9[_0xf06c('0x30')];_0x15aef0[_0xf06c('0x39')]=qs[_0xf06c('0x3a')](_0x13a74b['query'][_0xf06c('0x3a')]);_0x15aef0[_0xf06c('0x3b')]=qs[_0xf06c('0x33')](_['pick'](_0x13a74b['query'],_0x4587d9[_0xf06c('0x33')]));if(_0x13a74b[_0xf06c('0x31')][_0xf06c('0x3d')]){_0x15aef0[_0xf06c('0x3b')]=_[_0xf06c('0x3e')](_0x15aef0['where'],{'$or':_[_0xf06c('0x2a')](_0x15aef0['attributes'],function(_0x11b44e){var _0x24632f={};_0x24632f[_0x11b44e]={'$like':'%'+_0x13a74b[_0xf06c('0x31')][_0xf06c('0x3d')]+'%'};return _0x24632f;})});}_0x15aef0=_[_0xf06c('0x3e')]({},_0x15aef0,_0x13a74b[_0xf06c('0x4e')]);return _0x196d97[_0xf06c('0x4c')](_0x15aef0);}})[_0xf06c('0x25')](function(_0x4fb9a4){if(_0x4fb9a4){_0x530d03=_0x4fb9a4[_0xf06c('0x37')];if(!_0x13a74b[_0xf06c('0x31')][_0xf06c('0x38')](_0xf06c('0x4b'))){_0x15aef0[_0xf06c('0x1f')]=qs['limit'](_0x13a74b['query'][_0xf06c('0x1f')]);_0x15aef0[_0xf06c('0x1c')]=qs[_0xf06c('0x1c')](_0x13a74b[_0xf06c('0x31')][_0xf06c('0x1c')]);}return _0x196d97[_0xf06c('0x4c')](_0x15aef0);}})[_0xf06c('0x25')](function(_0x1db114){if(_0x1db114){return _0x1db114?{'count':_0x530d03,'rows':_0x1db114}:null;}})['then'](respondWithResult(_0x2f2255,null))[_0xf06c('0x43')](handleError(_0x2f2255,null));};exports['getDescriptions']=function(_0x493b36,_0x42b3ea,_0x59d60a){var _0x4f32dd={};var _0x366491={};var _0x41506e;var _0x588247;return db[_0xf06c('0x2b')][_0xf06c('0x4d')]({'where':{'id':_0x493b36['params']['id']}})['then'](handleEntityNotFound(_0x42b3ea,null))[_0xf06c('0x25')](function(_0x1bdd38){if(_0x1bdd38){_0x41506e=_0x1bdd38;_0x366491[_0xf06c('0x30')]=_[_0xf06c('0x32')](db[_0xf06c('0x49')]['rawAttributes']);_0x366491[_0xf06c('0x31')]=_[_0xf06c('0x32')](_0x493b36[_0xf06c('0x31')]);_0x366491[_0xf06c('0x33')]=_[_0xf06c('0x34')](_0x366491[_0xf06c('0x30')],_0x366491[_0xf06c('0x31')]);_0x4f32dd[_0xf06c('0x35')]=_[_0xf06c('0x34')](_0x366491[_0xf06c('0x30')],qs['fields'](_0x493b36[_0xf06c('0x31')]['fields']));_0x4f32dd[_0xf06c('0x35')]=_0x4f32dd[_0xf06c('0x35')][_0xf06c('0x37')]?_0x4f32dd['attributes']:_0x366491['model'];_0x4f32dd[_0xf06c('0x39')]=qs['sort'](_0x493b36[_0xf06c('0x31')][_0xf06c('0x3a')]);_0x4f32dd[_0xf06c('0x3b')]=qs[_0xf06c('0x33')](_[_0xf06c('0x3c')](_0x493b36[_0xf06c('0x31')],_0x366491[_0xf06c('0x33')]));if(_0x493b36[_0xf06c('0x31')][_0xf06c('0x3d')]){_0x4f32dd[_0xf06c('0x3b')]=_[_0xf06c('0x3e')](_0x4f32dd[_0xf06c('0x3b')],{'$or':_[_0xf06c('0x2a')](_0x4f32dd[_0xf06c('0x35')],function(_0x4c724e){var _0x43e588={};_0x43e588[_0x4c724e]={'$like':'%'+_0x493b36[_0xf06c('0x31')]['filter']+'%'};return _0x43e588;})});}_0x4f32dd=_[_0xf06c('0x3e')]({},_0x4f32dd,_0x493b36[_0xf06c('0x4e')]);return _0x41506e[_0xf06c('0x4f')](_0x4f32dd);}})['then'](function(_0x5063c3){if(_0x5063c3){_0x588247=_0x5063c3['length'];if(!_0x493b36['query'][_0xf06c('0x38')](_0xf06c('0x4b'))){_0x4f32dd['limit']=qs['limit'](_0x493b36['query']['limit']);_0x4f32dd['offset']=qs[_0xf06c('0x1c')](_0x493b36[_0xf06c('0x31')][_0xf06c('0x1c')]);}return _0x41506e[_0xf06c('0x4f')](_0x4f32dd);}})[_0xf06c('0x25')](function(_0x17a413){if(_0x17a413){return _0x17a413?{'count':_0x588247,'rows':_0x17a413}:null;}})[_0xf06c('0x25')](respondWithResult(_0x42b3ea,null))[_0xf06c('0x43')](handleError(_0x42b3ea,null));};exports[_0xf06c('0x50')]=function(_0x289d1d,_0x4ac33f,_0x1ef299){var _0x2b6541={};var _0x3d2642={};var _0xde04b8;var _0x13aca3;return db[_0xf06c('0x2b')]['findOne']({'where':{'id':_0x289d1d['params']['id']}})['then'](handleEntityNotFound(_0x4ac33f,null))[_0xf06c('0x25')](function(_0x82cc36){if(_0x82cc36){_0xde04b8=_0x82cc36;_0x3d2642[_0xf06c('0x30')]=_['keys'](db[_0xf06c('0x51')][_0xf06c('0x2c')]);_0x3d2642[_0xf06c('0x31')]=_[_0xf06c('0x32')](_0x289d1d['query']);_0x3d2642[_0xf06c('0x33')]=_[_0xf06c('0x34')](_0x3d2642[_0xf06c('0x30')],_0x3d2642[_0xf06c('0x31')]);_0x2b6541[_0xf06c('0x35')]=_[_0xf06c('0x34')](_0x3d2642[_0xf06c('0x30')],qs['fields'](_0x289d1d[_0xf06c('0x31')]['fields']));_0x2b6541[_0xf06c('0x35')]=_0x2b6541[_0xf06c('0x35')]['length']?_0x2b6541[_0xf06c('0x35')]:_0x3d2642[_0xf06c('0x30')];_0x2b6541[_0xf06c('0x39')]=qs[_0xf06c('0x3a')](_0x289d1d[_0xf06c('0x31')][_0xf06c('0x3a')]);_0x2b6541[_0xf06c('0x3b')]=qs[_0xf06c('0x33')](_['pick'](_0x289d1d[_0xf06c('0x31')],_0x3d2642[_0xf06c('0x33')]));if(_0x289d1d['query'][_0xf06c('0x3d')]){_0x2b6541['where']=_[_0xf06c('0x3e')](_0x2b6541['where'],{'$or':_[_0xf06c('0x2a')](_0x2b6541[_0xf06c('0x35')],function(_0x53b9c5){var _0x2ce377={};_0x2ce377[_0x53b9c5]={'$like':'%'+_0x289d1d[_0xf06c('0x31')][_0xf06c('0x3d')]+'%'};return _0x2ce377;})});}_0x2b6541=_[_0xf06c('0x3e')]({},_0x2b6541,_0x289d1d[_0xf06c('0x4e')]);return _0xde04b8[_0xf06c('0x50')](_0x2b6541);}})['then'](function(_0x1f3702){if(_0x1f3702){_0x13aca3=_0x1f3702[_0xf06c('0x37')];if(!_0x289d1d[_0xf06c('0x31')]['hasOwnProperty'](_0xf06c('0x4b'))){_0x2b6541[_0xf06c('0x1f')]=qs[_0xf06c('0x1f')](_0x289d1d[_0xf06c('0x31')][_0xf06c('0x1f')]);_0x2b6541[_0xf06c('0x1c')]=qs[_0xf06c('0x1c')](_0x289d1d[_0xf06c('0x31')]['offset']);}return _0xde04b8[_0xf06c('0x50')](_0x2b6541);}})[_0xf06c('0x25')](function(_0x271299){if(_0x271299){return _0x271299?{'count':_0x13aca3,'rows':_0x271299}:null;}})['then'](respondWithResult(_0x4ac33f,null))[_0xf06c('0x43')](handleError(_0x4ac33f,null));};exports['setTags']=function(_0x4dde8d,_0x20e4f3,_0x371a83){if(_0x4dde8d[_0xf06c('0x48')]['id']){delete _0x4dde8d[_0xf06c('0x48')]['id'];}return db['DeskConfiguration'][_0xf06c('0x4d')]({'where':{'id':_0x4dde8d[_0xf06c('0x45')]['id']}})[_0xf06c('0x25')](handleEntityNotFound(_0x20e4f3,null))[_0xf06c('0x25')](function(_0x28aeb1){if(_0x28aeb1){return _0x28aeb1[_0xf06c('0x52')](_0x4dde8d[_0xf06c('0x48')][_0xf06c('0x53')]||[]);}return null;})[_0xf06c('0x25')](respondWithResult(_0x20e4f3,null))[_0xf06c('0x43')](handleError(_0x20e4f3,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 4913f72..84352c4 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 _0x0727=['bluebird','request-promise','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','int_desk_configurations','util','../../config/logger','api','moment'];(function(_0x1c06f4,_0x2feba6){var _0x1a727e=function(_0x2e83af){while(--_0x2e83af){_0x1c06f4['push'](_0x1c06f4['shift']());}};_0x1a727e(++_0x2feba6);}(_0x0727,0x110));var _0x7072=function(_0xf0bc07,_0x510ebf){_0xf0bc07=_0xf0bc07-0x0;var _0x1c50c2=_0x0727[_0xf0bc07];return _0x1c50c2;};'use strict';var _=require('lodash');var util=require(_0x7072('0x0'));var logger=require(_0x7072('0x1'))(_0x7072('0x2'));var moment=require(_0x7072('0x3'));var BPromise=require(_0x7072('0x4'));var rp=require(_0x7072('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7072('0x6'));var config=require(_0x7072('0x7'));var attributes=require(_0x7072('0x8'));module[_0x7072('0x9')]=function(_0xc02184,_0x58f17a){return _0xc02184[_0x7072('0xa')]('DeskConfiguration',attributes,{'tableName':_0x7072('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x94f9=['define','DeskConfiguration','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x5d506b,_0x41b1ca){var _0x2a8f24=function(_0x12821c){while(--_0x12821c){_0x5d506b['push'](_0x5d506b['shift']());}};_0x2a8f24(++_0x41b1ca);}(_0x94f9,0x19a));var _0x994f=function(_0x74895e,_0x298c35){_0x74895e=_0x74895e-0x0;var _0x40bc2a=_0x94f9[_0x74895e];return _0x40bc2a;};'use strict';var _=require(_0x994f('0x0'));var util=require(_0x994f('0x1'));var logger=require('../../config/logger')(_0x994f('0x2'));var moment=require(_0x994f('0x3'));var BPromise=require(_0x994f('0x4'));var rp=require(_0x994f('0x5'));var fs=require('fs');var path=require(_0x994f('0x6'));var rimraf=require(_0x994f('0x7'));var config=require(_0x994f('0x8'));var attributes=require('./intDeskConfiguration.attributes');module[_0x994f('0x9')]=function(_0x4b50a3,_0x577d78){return _0x4b50a3[_0x994f('0xa')](_0x994f('0xb'),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 273ab6e..ad5d412 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 _0xc74c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x324012,_0x23f45f){var _0x435cf2=function(_0x378a82){while(--_0x378a82){_0x324012['push'](_0x324012['shift']());}};_0x435cf2(++_0x23f45f);}(_0xc74c,0x163));var _0xcc74=function(_0x236323,_0x4cd264){_0x236323=_0x236323-0x0;var _0x18d49d=_0xc74c[_0x236323];return _0x18d49d;};'use strict';var _=require(_0xcc74('0x0'));var util=require(_0xcc74('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcc74('0x2'));var fs=require('fs');var Redis=require(_0xcc74('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcc74('0x4'));var logger=require(_0xcc74('0x5'))(_0xcc74('0x6'));var config=require(_0xcc74('0x7'));var jayson=require(_0xcc74('0x8'));var client=jayson[_0xcc74('0x9')][_0xcc74('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d46a6,_0x15248f,_0x86f429){return new BPromise(function(_0x1eb886,_0x473308){return client[_0xcc74('0xb')](_0x5d46a6,_0x86f429)['then'](function(_0x4b4534){logger[_0xcc74('0xc')](_0xcc74('0xd'),_0x15248f,_0xcc74('0xe'));logger['debug'](_0xcc74('0xf'),_0x15248f,_0xcc74('0xe'),JSON[_0xcc74('0x10')](_0x4b4534));if(_0x4b4534['error']){if(_0x4b4534[_0xcc74('0x11')]['code']===0x1f4){logger[_0xcc74('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x15248f,_0x4b4534['error']['message']);return _0x473308(_0x4b4534[_0xcc74('0x11')][_0xcc74('0x12')]);}logger[_0xcc74('0x11')](_0xcc74('0xd'),_0x15248f,_0x4b4534[_0xcc74('0x11')]['message']);return _0x1eb886(_0x4b4534[_0xcc74('0x11')][_0xcc74('0x12')]);}else{logger[_0xcc74('0xc')](_0xcc74('0xd'),_0x15248f,_0xcc74('0xe'));_0x1eb886(_0x4b4534['result'][_0xcc74('0x12')]);}})[_0xcc74('0x13')](function(_0xe44014){logger[_0xcc74('0x11')](_0xcc74('0xd'),_0x15248f,_0xe44014);_0x473308(_0xe44014);});});} \ No newline at end of file +var _0xb16f=['http','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','client'];(function(_0x2caf63,_0x220384){var _0x87f3b4=function(_0x542396){while(--_0x542396){_0x2caf63['push'](_0x2caf63['shift']());}};_0x87f3b4(++_0x220384);}(_0xb16f,0x1c4));var _0xfb16=function(_0x53f3ad,_0x39163e){_0x53f3ad=_0x53f3ad-0x0;var _0x48b203=_0xb16f[_0x53f3ad];return _0x48b203;};'use strict';var _=require('lodash');var util=require(_0xfb16('0x0'));var moment=require(_0xfb16('0x1'));var BPromise=require(_0xfb16('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb16('0x3'));var db=require(_0xfb16('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfb16('0x5'))('rpc');var config=require(_0xfb16('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xfb16('0x7')][_0xfb16('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x423ffd,_0x30ac0e,_0x496033){return new BPromise(function(_0x362b89,_0x375f48){return client[_0xfb16('0x9')](_0x423ffd,_0x496033)['then'](function(_0x1d7dcc){logger[_0xfb16('0xa')](_0xfb16('0xb'),_0x30ac0e,_0xfb16('0xc'));logger[_0xfb16('0xd')](_0xfb16('0xe'),_0x30ac0e,_0xfb16('0xc'),JSON[_0xfb16('0xf')](_0x1d7dcc));if(_0x1d7dcc[_0xfb16('0x10')]){if(_0x1d7dcc[_0xfb16('0x10')][_0xfb16('0x11')]===0x1f4){logger[_0xfb16('0x10')](_0xfb16('0xb'),_0x30ac0e,_0x1d7dcc[_0xfb16('0x10')][_0xfb16('0x12')]);return _0x375f48(_0x1d7dcc[_0xfb16('0x10')]['message']);}logger[_0xfb16('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x30ac0e,_0x1d7dcc[_0xfb16('0x10')]['message']);return _0x362b89(_0x1d7dcc[_0xfb16('0x10')][_0xfb16('0x12')]);}else{logger[_0xfb16('0xa')](_0xfb16('0xb'),_0x30ac0e,_0xfb16('0xc'));_0x362b89(_0x1d7dcc[_0xfb16('0x13')][_0xfb16('0x12')]);}})['catch'](function(_0x4e2371){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x30ac0e,_0x4e2371);_0x375f48(_0x4e2371);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 2ab90dc..95e317a 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 _0x8777=['delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','post','put','/:id','update'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x8777,0xdb));var _0x7877=function(_0x225cb8,_0x5a5807){_0x225cb8=_0x225cb8-0x0;var _0x6dc37d=_0x8777[_0x225cb8];return _0x6dc37d;};'use strict';var multer=require(_0x7877('0x0'));var util=require(_0x7877('0x1'));var path=require('path');var timeout=require(_0x7877('0x2'));var express=require(_0x7877('0x3'));var router=express['Router']();var fs_extra=require(_0x7877('0x4'));var auth=require(_0x7877('0x5'));var interaction=require(_0x7877('0x6'));var config=require(_0x7877('0x7'));var controller=require(_0x7877('0x8'));router[_0x7877('0x9')]('/',auth[_0x7877('0xa')](),controller['index']);router[_0x7877('0x9')]('/:id',auth[_0x7877('0xa')](),controller['show']);router[_0x7877('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7877('0xc')](_0x7877('0xd'),auth[_0x7877('0xa')](),controller[_0x7877('0xe')]);router[_0x7877('0xf')]('/:id',auth[_0x7877('0xa')](),controller[_0x7877('0x10')]);module[_0x7877('0x11')]=router; \ No newline at end of file +var _0x9ad9=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','index','/:id','isAuthenticated','show','post','create','put','destroy','exports','multer','path'];(function(_0x31edc1,_0x2bab06){var _0x5c7ca9=function(_0x4b530c){while(--_0x4b530c){_0x31edc1['push'](_0x31edc1['shift']());}};_0x5c7ca9(++_0x2bab06);}(_0x9ad9,0xbc));var _0x99ad=function(_0x1d2c4a,_0x54c283){_0x1d2c4a=_0x1d2c4a-0x0;var _0x23e15d=_0x9ad9[_0x1d2c4a];return _0x23e15d;};'use strict';var multer=require(_0x99ad('0x0'));var util=require('util');var path=require(_0x99ad('0x1'));var timeout=require(_0x99ad('0x2'));var express=require(_0x99ad('0x3'));var router=express[_0x99ad('0x4')]();var fs_extra=require(_0x99ad('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x99ad('0x6'));var config=require(_0x99ad('0x7'));var controller=require(_0x99ad('0x8'));router[_0x99ad('0x9')]('/',auth['isAuthenticated'](),controller[_0x99ad('0xa')]);router[_0x99ad('0x9')](_0x99ad('0xb'),auth[_0x99ad('0xc')](),controller[_0x99ad('0xd')]);router[_0x99ad('0xe')]('/',auth[_0x99ad('0xc')](),controller[_0x99ad('0xf')]);router[_0x99ad('0x10')](_0x99ad('0xb'),auth[_0x99ad('0xc')](),controller['update']);router['delete'](_0x99ad('0xb'),auth['isAuthenticated'](),controller[_0x99ad('0x11')]);module[_0x99ad('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index c4866c4..9581e6c 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 _0x7bd4=['keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x105e18,_0x3a85c2){var _0x30a4b=function(_0x30d93f){while(--_0x30d93f){_0x105e18['push'](_0x105e18['shift']());}};_0x30a4b(++_0x3a85c2);}(_0x7bd4,0x16b));var _0x47bd=function(_0x23d78a,_0x44c08a){_0x23d78a=_0x23d78a-0x0;var _0x4bb7e7=_0x7bd4[_0x23d78a];return _0x4bb7e7;};'use strict';var Sequelize=require(_0x47bd('0x0'));module[_0x47bd('0x1')]={'type':{'type':Sequelize[_0x47bd('0x2')](_0x47bd('0x3'),_0x47bd('0x4'),_0x47bd('0x5'),_0x47bd('0x6'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x47bd('0x7')]},'keyType':{'type':Sequelize[_0x47bd('0x2')](_0x47bd('0x3'),_0x47bd('0x4'),_0x47bd('0x5'))},'keyContent':{'type':Sequelize[_0x47bd('0x7')]},'idField':{'type':Sequelize[_0x47bd('0x7')]},'nameField':{'type':Sequelize[_0x47bd('0x7')]},'customField':{'type':Sequelize[_0x47bd('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9422=['sequelize','exports','string','variable','keyValue','ENUM','customVariable','STRING'];(function(_0xeb80e,_0x337608){var _0x68e9d7=function(_0x50c896){while(--_0x50c896){_0xeb80e['push'](_0xeb80e['shift']());}};_0x68e9d7(++_0x337608);}(_0x9422,0x160));var _0x2942=function(_0x59c472,_0x82b732){_0x59c472=_0x59c472-0x0;var _0x1c782c=_0x9422[_0x59c472];return _0x1c782c;};'use strict';var Sequelize=require(_0x2942('0x0'));module[_0x2942('0x1')]={'type':{'type':Sequelize['ENUM'](_0x2942('0x2'),_0x2942('0x3'),'customVariable',_0x2942('0x4'),'picklist'),'defaultValue':_0x2942('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x2942('0x5')](_0x2942('0x2'),_0x2942('0x3'),_0x2942('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x2942('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 02d8a55..9112691 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 _0x15c6=['set','Content-Range','save','update','then','destroy','stack','name','index','map','DeskField','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','fields','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','count'];(function(_0x221a1f,_0x4eafa4){var _0x3d383e=function(_0x3e645f){while(--_0x3e645f){_0x221a1f['push'](_0x221a1f['shift']());}};_0x3d383e(++_0x4eafa4);}(_0x15c6,0x1cd));var _0x615c=function(_0x5cf3c0,_0x4363c1){_0x5cf3c0=_0x5cf3c0-0x0;var _0x39a680=_0x15c6[_0x5cf3c0];return _0x39a680;};'use strict';var emlformat=require(_0x615c('0x0'));var rimraf=require(_0x615c('0x1'));var zipdir=require(_0x615c('0x2'));var jsonpatch=require(_0x615c('0x3'));var rp=require(_0x615c('0x4'));var moment=require(_0x615c('0x5'));var BPromise=require(_0x615c('0x6'));var Mustache=require(_0x615c('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x615c('0x8'));var ejs=require(_0x615c('0x9'));var fs=require('fs');var fs_extra=require(_0x615c('0xa'));var _=require('lodash');var squel=require(_0x615c('0xb'));var crypto=require(_0x615c('0xc'));var jsforce=require(_0x615c('0xd'));var deskjs=require(_0x615c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x615c('0xf'));var Papa=require('papaparse');var Redis=require(_0x615c('0x10'));var authService=require(_0x615c('0x11'));var qs=require(_0x615c('0x12'));var as=require(_0x615c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x615c('0x14'));var utils=require(_0x615c('0x15'));var config=require(_0x615c('0x16'));var licenseUtil=require(_0x615c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x497ecb,_0x1c029d){_0x1c029d=_0x1c029d||0xcc;return function(_0x1b6e92){if(_0x1b6e92){return _0x497ecb['sendStatus'](_0x1c029d);}return _0x497ecb[_0x615c('0x18')](_0x1c029d)['end']();};}function respondWithResult(_0x525708,_0x31dca1){_0x31dca1=_0x31dca1||0xc8;return function(_0x11d751){if(_0x11d751){return _0x525708[_0x615c('0x18')](_0x31dca1)[_0x615c('0x19')](_0x11d751);}};}function respondWithFilteredResult(_0x146659,_0x1ab157){return function(_0x55ec9e){if(_0x55ec9e){var _0x2d10d2=typeof _0x1ab157[_0x615c('0x1a')]===_0x615c('0x1b')&&typeof _0x1ab157['limit']===_0x615c('0x1b');var _0x3953aa=_0x55ec9e[_0x615c('0x1c')];var _0x1e0d18=_0x2d10d2?0x0:_0x1ab157[_0x615c('0x1a')];var _0x374516=_0x2d10d2?_0x55ec9e[_0x615c('0x1c')]:_0x1ab157[_0x615c('0x1a')]+_0x1ab157['limit'];var _0x504e63;if(_0x374516>=_0x3953aa){_0x374516=_0x3953aa;_0x504e63=0xc8;}else{_0x504e63=0xce;}_0x146659['status'](_0x504e63);return _0x146659[_0x615c('0x1d')](_0x615c('0x1e'),_0x1e0d18+'-'+_0x374516+'/'+_0x3953aa)[_0x615c('0x19')](_0x55ec9e);}return null;};}function patchUpdates(_0x146c58){return function(_0x5c6e16){try{jsonpatch['apply'](_0x5c6e16,_0x146c58,!![]);}catch(_0x2f77cc){return BPromise['reject'](_0x2f77cc);}return _0x5c6e16[_0x615c('0x1f')]();};}function saveUpdates(_0x53638f,_0x23e4c5){return function(_0x508ea5){if(_0x508ea5){return _0x508ea5[_0x615c('0x20')](_0x53638f)[_0x615c('0x21')](function(_0x5d148b){return _0x5d148b;});}return null;};}function removeEntity(_0x4cca36,_0x5bba2f){return function(_0x4117f5){if(_0x4117f5){return _0x4117f5[_0x615c('0x22')]()[_0x615c('0x21')](function(){_0x4cca36[_0x615c('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32635f,_0x2f1959){return function(_0x5968aa){if(!_0x5968aa){_0x32635f['sendStatus'](0x194);}return _0x5968aa;};}function handleError(_0x35ccef,_0x3bcff0){_0x3bcff0=_0x3bcff0||0x1f4;return function(_0x8671eb){logger['error'](_0x8671eb[_0x615c('0x23')]);if(_0x8671eb[_0x615c('0x24')]){delete _0x8671eb[_0x615c('0x24')];}_0x35ccef[_0x615c('0x18')](_0x3bcff0)['send'](_0x8671eb);};}exports[_0x615c('0x25')]=function(_0x174259,_0x2a4d37){var _0x263f90={},_0x41866b={},_0x266e46={'count':0x0,'rows':[]};var _0x2da5bb=_[_0x615c('0x26')](db[_0x615c('0x27')][_0x615c('0x28')],function(_0x1985a7){return{'name':_0x1985a7[_0x615c('0x29')],'type':_0x1985a7[_0x615c('0x2a')][_0x615c('0x2b')]};});_0x41866b['model']=_[_0x615c('0x26')](_0x2da5bb,_0x615c('0x24'));_0x41866b[_0x615c('0x2c')]=_[_0x615c('0x2d')](_0x174259[_0x615c('0x2c')]);_0x41866b[_0x615c('0x2e')]=_['intersection'](_0x41866b[_0x615c('0x2f')],_0x41866b[_0x615c('0x2c')]);_0x263f90[_0x615c('0x30')]=_[_0x615c('0x31')](_0x41866b[_0x615c('0x2f')],qs['fields'](_0x174259[_0x615c('0x2c')]['fields']));_0x263f90[_0x615c('0x30')]=_0x263f90[_0x615c('0x30')][_0x615c('0x32')]?_0x263f90[_0x615c('0x30')]:_0x41866b[_0x615c('0x2f')];if(!_0x174259[_0x615c('0x2c')]['hasOwnProperty'](_0x615c('0x33'))){_0x263f90[_0x615c('0x34')]=qs[_0x615c('0x34')](_0x174259[_0x615c('0x2c')][_0x615c('0x34')]);_0x263f90[_0x615c('0x1a')]=qs[_0x615c('0x1a')](_0x174259['query'][_0x615c('0x1a')]);}_0x263f90[_0x615c('0x35')]=qs[_0x615c('0x36')](_0x174259[_0x615c('0x2c')]['sort']);_0x263f90[_0x615c('0x37')]=qs[_0x615c('0x2e')](_[_0x615c('0x38')](_0x174259[_0x615c('0x2c')],_0x41866b['filters']),_0x2da5bb);if(_0x174259['query'][_0x615c('0x39')]){_0x263f90[_0x615c('0x37')]=_[_0x615c('0x3a')](_0x263f90['where'],{'$or':_[_0x615c('0x26')](_0x2da5bb,function(_0x3a6ced){if(_0x3a6ced[_0x615c('0x2a')]!==_0x615c('0x3b')){var _0x57b921={};_0x57b921[_0x3a6ced['name']]={'$like':'%'+_0x174259[_0x615c('0x2c')]['filter']+'%'};return _0x57b921;}})});}_0x263f90=_[_0x615c('0x3a')]({},_0x263f90,_0x174259[_0x615c('0x3c')]);var _0xa59935={'where':_0x263f90['where']};return db[_0x615c('0x27')][_0x615c('0x1c')](_0xa59935)[_0x615c('0x21')](function(_0x93e864){_0x266e46[_0x615c('0x1c')]=_0x93e864;if(_0x174259['query'][_0x615c('0x3d')]){_0x263f90[_0x615c('0x3e')]=[{'all':!![]}];}return db['DeskField']['findAll'](_0x263f90);})['then'](function(_0x1b8ce0){_0x266e46[_0x615c('0x3f')]=_0x1b8ce0;return _0x266e46;})['then'](respondWithFilteredResult(_0x2a4d37,_0x263f90))['catch'](handleError(_0x2a4d37,null));};exports[_0x615c('0x40')]=function(_0x210774,_0x46afa9){var _0x23ea59={'raw':!![],'where':{'id':_0x210774[_0x615c('0x41')]['id']}},_0x1f1d55={};_0x1f1d55[_0x615c('0x2f')]=_[_0x615c('0x2d')](db[_0x615c('0x27')][_0x615c('0x28')]);_0x1f1d55['query']=_[_0x615c('0x2d')](_0x210774[_0x615c('0x2c')]);_0x1f1d55[_0x615c('0x2e')]=_[_0x615c('0x31')](_0x1f1d55['model'],_0x1f1d55[_0x615c('0x2c')]);_0x23ea59[_0x615c('0x30')]=_[_0x615c('0x31')](_0x1f1d55[_0x615c('0x2f')],qs[_0x615c('0x42')](_0x210774[_0x615c('0x2c')]['fields']));_0x23ea59[_0x615c('0x30')]=_0x23ea59['attributes']['length']?_0x23ea59[_0x615c('0x30')]:_0x1f1d55['model'];if(_0x210774[_0x615c('0x2c')][_0x615c('0x3d')]){_0x23ea59[_0x615c('0x3e')]=[{'all':!![]}];}_0x23ea59=_[_0x615c('0x3a')]({},_0x23ea59,_0x210774[_0x615c('0x3c')]);return db[_0x615c('0x27')][_0x615c('0x43')](_0x23ea59)['then'](handleEntityNotFound(_0x46afa9,null))[_0x615c('0x21')](respondWithResult(_0x46afa9,null))[_0x615c('0x44')](handleError(_0x46afa9,null));};exports['create']=function(_0x38c3de,_0x343626){return db[_0x615c('0x27')]['create'](_0x38c3de[_0x615c('0x45')],{})[_0x615c('0x21')](respondWithResult(_0x343626,0xc9))[_0x615c('0x44')](handleError(_0x343626,null));};exports['update']=function(_0x1bd4f1,_0x546124){if(_0x1bd4f1[_0x615c('0x45')]['id']){delete _0x1bd4f1[_0x615c('0x45')]['id'];}return db[_0x615c('0x27')][_0x615c('0x43')]({'where':{'id':_0x1bd4f1[_0x615c('0x41')]['id']}})['then'](handleEntityNotFound(_0x546124,null))[_0x615c('0x21')](saveUpdates(_0x1bd4f1[_0x615c('0x45')],null))['then'](respondWithResult(_0x546124,null))[_0x615c('0x44')](handleError(_0x546124,null));};exports['destroy']=function(_0x25b4e7,_0x2800e2){return db[_0x615c('0x27')][_0x615c('0x43')]({'where':{'id':_0x25b4e7[_0x615c('0x41')]['id']}})[_0x615c('0x21')](handleEntityNotFound(_0x2800e2,null))[_0x615c('0x21')](removeEntity(_0x2800e2,null))[_0x615c('0x44')](handleError(_0x2800e2,null));}; \ No newline at end of file +var _0xb7ae=['include','find','create','catch','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','set','Content-Range','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','DeskField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','findAll','rows','show'];(function(_0x2ed730,_0x1f47bc){var _0x500490=function(_0x379a26){while(--_0x379a26){_0x2ed730['push'](_0x2ed730['shift']());}};_0x500490(++_0x1f47bc);}(_0xb7ae,0xf3));var _0xeb7a=function(_0x52e759,_0x3ec44e){_0x52e759=_0x52e759-0x0;var _0x25b646=_0xb7ae[_0x52e759];return _0x25b646;};'use strict';var emlformat=require(_0xeb7a('0x0'));var rimraf=require(_0xeb7a('0x1'));var zipdir=require(_0xeb7a('0x2'));var jsonpatch=require(_0xeb7a('0x3'));var rp=require(_0xeb7a('0x4'));var moment=require('moment');var BPromise=require(_0xeb7a('0x5'));var Mustache=require(_0xeb7a('0x6'));var util=require(_0xeb7a('0x7'));var path=require('path');var sox=require(_0xeb7a('0x8'));var csv=require(_0xeb7a('0x9'));var ejs=require(_0xeb7a('0xa'));var fs=require('fs');var fs_extra=require(_0xeb7a('0xb'));var _=require(_0xeb7a('0xc'));var squel=require('squel');var crypto=require(_0xeb7a('0xd'));var jsforce=require(_0xeb7a('0xe'));var deskjs=require(_0xeb7a('0xf'));var toCsv=require('to-csv');var querystring=require(_0xeb7a('0x10'));var Papa=require(_0xeb7a('0x11'));var Redis=require(_0xeb7a('0x12'));var authService=require(_0xeb7a('0x13'));var qs=require(_0xeb7a('0x14'));var as=require(_0xeb7a('0x15'));var hardwareService=require(_0xeb7a('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xeb7a('0x17'));var config=require(_0xeb7a('0x18'));var licenseUtil=require(_0xeb7a('0x19'));var db=require(_0xeb7a('0x1a'))['db'];function respondWithStatusCode(_0x13bcf4,_0x203723){_0x203723=_0x203723||0xcc;return function(_0x166e4d){if(_0x166e4d){return _0x13bcf4['sendStatus'](_0x203723);}return _0x13bcf4[_0xeb7a('0x1b')](_0x203723)[_0xeb7a('0x1c')]();};}function respondWithResult(_0x4e86a7,_0x110acb){_0x110acb=_0x110acb||0xc8;return function(_0x186ea3){if(_0x186ea3){return _0x4e86a7['status'](_0x110acb)[_0xeb7a('0x1d')](_0x186ea3);}};}function respondWithFilteredResult(_0x5db84f,_0x5d953f){return function(_0x388666){if(_0x388666){var _0x5e6256=typeof _0x5d953f['offset']===_0xeb7a('0x1e')&&typeof _0x5d953f[_0xeb7a('0x1f')]===_0xeb7a('0x1e');var _0x2d92c7=_0x388666['count'];var _0x4be13e=_0x5e6256?0x0:_0x5d953f[_0xeb7a('0x20')];var _0x26bd85=_0x5e6256?_0x388666['count']:_0x5d953f['offset']+_0x5d953f[_0xeb7a('0x1f')];var _0x25a399;if(_0x26bd85>=_0x2d92c7){_0x26bd85=_0x2d92c7;_0x25a399=0xc8;}else{_0x25a399=0xce;}_0x5db84f[_0xeb7a('0x1b')](_0x25a399);return _0x5db84f[_0xeb7a('0x21')](_0xeb7a('0x22'),_0x4be13e+'-'+_0x26bd85+'/'+_0x2d92c7)[_0xeb7a('0x1d')](_0x388666);}return null;};}function patchUpdates(_0x29fa3f){return function(_0x120128){try{jsonpatch['apply'](_0x120128,_0x29fa3f,!![]);}catch(_0x431d4a){return BPromise[_0xeb7a('0x23')](_0x431d4a);}return _0x120128['save']();};}function saveUpdates(_0x5af915,_0xeab362){return function(_0x434aac){if(_0x434aac){return _0x434aac[_0xeb7a('0x24')](_0x5af915)[_0xeb7a('0x25')](function(_0x29db91){return _0x29db91;});}return null;};}function removeEntity(_0x44cefc,_0xfb62a5){return function(_0x4c4816){if(_0x4c4816){return _0x4c4816[_0xeb7a('0x26')]()[_0xeb7a('0x25')](function(){_0x44cefc[_0xeb7a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10b7d3,_0x1cf8f6){return function(_0x182335){if(!_0x182335){_0x10b7d3[_0xeb7a('0x27')](0x194);}return _0x182335;};}function handleError(_0x53ade4,_0x15199a){_0x15199a=_0x15199a||0x1f4;return function(_0x52e882){logger[_0xeb7a('0x28')](_0x52e882[_0xeb7a('0x29')]);if(_0x52e882[_0xeb7a('0x2a')]){delete _0x52e882[_0xeb7a('0x2a')];}_0x53ade4[_0xeb7a('0x1b')](_0x15199a)[_0xeb7a('0x2b')](_0x52e882);};}exports[_0xeb7a('0x2c')]=function(_0x3917eb,_0x2a492f){var _0x20a197={},_0x2d2f9f={},_0x567bbe={'count':0x0,'rows':[]};var _0x34b88b=_[_0xeb7a('0x2d')](db[_0xeb7a('0x2e')][_0xeb7a('0x2f')],function(_0x14e2e1){return{'name':_0x14e2e1[_0xeb7a('0x30')],'type':_0x14e2e1[_0xeb7a('0x31')][_0xeb7a('0x32')]};});_0x2d2f9f[_0xeb7a('0x33')]=_[_0xeb7a('0x2d')](_0x34b88b,_0xeb7a('0x2a'));_0x2d2f9f['query']=_[_0xeb7a('0x34')](_0x3917eb[_0xeb7a('0x35')]);_0x2d2f9f[_0xeb7a('0x36')]=_[_0xeb7a('0x37')](_0x2d2f9f['model'],_0x2d2f9f[_0xeb7a('0x35')]);_0x20a197[_0xeb7a('0x38')]=_[_0xeb7a('0x37')](_0x2d2f9f[_0xeb7a('0x33')],qs[_0xeb7a('0x39')](_0x3917eb[_0xeb7a('0x35')]['fields']));_0x20a197[_0xeb7a('0x38')]=_0x20a197[_0xeb7a('0x38')][_0xeb7a('0x3a')]?_0x20a197[_0xeb7a('0x38')]:_0x2d2f9f[_0xeb7a('0x33')];if(!_0x3917eb[_0xeb7a('0x35')]['hasOwnProperty'](_0xeb7a('0x3b'))){_0x20a197['limit']=qs[_0xeb7a('0x1f')](_0x3917eb[_0xeb7a('0x35')]['limit']);_0x20a197[_0xeb7a('0x20')]=qs[_0xeb7a('0x20')](_0x3917eb[_0xeb7a('0x35')][_0xeb7a('0x20')]);}_0x20a197[_0xeb7a('0x3c')]=qs[_0xeb7a('0x3d')](_0x3917eb[_0xeb7a('0x35')][_0xeb7a('0x3d')]);_0x20a197['where']=qs[_0xeb7a('0x36')](_[_0xeb7a('0x3e')](_0x3917eb['query'],_0x2d2f9f[_0xeb7a('0x36')]),_0x34b88b);if(_0x3917eb[_0xeb7a('0x35')][_0xeb7a('0x3f')]){_0x20a197[_0xeb7a('0x40')]=_[_0xeb7a('0x41')](_0x20a197[_0xeb7a('0x40')],{'$or':_[_0xeb7a('0x2d')](_0x34b88b,function(_0x573e30){if(_0x573e30[_0xeb7a('0x31')]!==_0xeb7a('0x42')){var _0x308a2e={};_0x308a2e[_0x573e30[_0xeb7a('0x2a')]]={'$like':'%'+_0x3917eb[_0xeb7a('0x35')][_0xeb7a('0x3f')]+'%'};return _0x308a2e;}})});}_0x20a197=_[_0xeb7a('0x41')]({},_0x20a197,_0x3917eb[_0xeb7a('0x43')]);var _0x414580={'where':_0x20a197[_0xeb7a('0x40')]};return db[_0xeb7a('0x2e')][_0xeb7a('0x44')](_0x414580)['then'](function(_0x2d3d4d){_0x567bbe[_0xeb7a('0x44')]=_0x2d3d4d;if(_0x3917eb[_0xeb7a('0x35')][_0xeb7a('0x45')]){_0x20a197['include']=[{'all':!![]}];}return db[_0xeb7a('0x2e')][_0xeb7a('0x46')](_0x20a197);})[_0xeb7a('0x25')](function(_0x1803d6){_0x567bbe[_0xeb7a('0x47')]=_0x1803d6;return _0x567bbe;})[_0xeb7a('0x25')](respondWithFilteredResult(_0x2a492f,_0x20a197))['catch'](handleError(_0x2a492f,null));};exports[_0xeb7a('0x48')]=function(_0x1b1575,_0x48d620){var _0x436346={'raw':!![],'where':{'id':_0x1b1575['params']['id']}},_0x58c004={};_0x58c004['model']=_[_0xeb7a('0x34')](db[_0xeb7a('0x2e')][_0xeb7a('0x2f')]);_0x58c004[_0xeb7a('0x35')]=_[_0xeb7a('0x34')](_0x1b1575[_0xeb7a('0x35')]);_0x58c004['filters']=_['intersection'](_0x58c004[_0xeb7a('0x33')],_0x58c004['query']);_0x436346[_0xeb7a('0x38')]=_[_0xeb7a('0x37')](_0x58c004[_0xeb7a('0x33')],qs[_0xeb7a('0x39')](_0x1b1575['query'][_0xeb7a('0x39')]));_0x436346[_0xeb7a('0x38')]=_0x436346[_0xeb7a('0x38')][_0xeb7a('0x3a')]?_0x436346['attributes']:_0x58c004[_0xeb7a('0x33')];if(_0x1b1575['query'][_0xeb7a('0x45')]){_0x436346[_0xeb7a('0x49')]=[{'all':!![]}];}_0x436346=_[_0xeb7a('0x41')]({},_0x436346,_0x1b1575[_0xeb7a('0x43')]);return db[_0xeb7a('0x2e')][_0xeb7a('0x4a')](_0x436346)[_0xeb7a('0x25')](handleEntityNotFound(_0x48d620,null))['then'](respondWithResult(_0x48d620,null))['catch'](handleError(_0x48d620,null));};exports[_0xeb7a('0x4b')]=function(_0x3d48c8,_0x18c60f){return db[_0xeb7a('0x2e')][_0xeb7a('0x4b')](_0x3d48c8['body'],{})['then'](respondWithResult(_0x18c60f,0xc9))[_0xeb7a('0x4c')](handleError(_0x18c60f,null));};exports['update']=function(_0x202753,_0x5846bc){if(_0x202753[_0xeb7a('0x4d')]['id']){delete _0x202753[_0xeb7a('0x4d')]['id'];}return db[_0xeb7a('0x2e')][_0xeb7a('0x4a')]({'where':{'id':_0x202753[_0xeb7a('0x4e')]['id']}})[_0xeb7a('0x25')](handleEntityNotFound(_0x5846bc,null))[_0xeb7a('0x25')](saveUpdates(_0x202753[_0xeb7a('0x4d')],null))[_0xeb7a('0x25')](respondWithResult(_0x5846bc,null))[_0xeb7a('0x4c')](handleError(_0x5846bc,null));};exports[_0xeb7a('0x26')]=function(_0x466a2f,_0x55eb50){return db[_0xeb7a('0x2e')][_0xeb7a('0x4a')]({'where':{'id':_0x466a2f[_0xeb7a('0x4e')]['id']}})[_0xeb7a('0x25')](handleEntityNotFound(_0x55eb50,null))[_0xeb7a('0x25')](removeEntity(_0x55eb50,null))[_0xeb7a('0x4c')](handleError(_0x55eb50,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index b7c15fc..93e7b20 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 _0x86c5=['desk_unique_index','idField','FieldId','lodash','util','api','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','define','DeskField','int_desk_fields'];(function(_0x1e59e9,_0x2083d0){var _0x468dd2=function(_0x41e4ba){while(--_0x41e4ba){_0x1e59e9['push'](_0x1e59e9['shift']());}};_0x468dd2(++_0x2083d0);}(_0x86c5,0x8f));var _0x586c=function(_0x331a5e,_0x557064){_0x331a5e=_0x331a5e-0x0;var _0x5629c0=_0x86c5[_0x331a5e];return _0x5629c0;};'use strict';var _=require(_0x586c('0x0'));var util=require(_0x586c('0x1'));var logger=require('../../config/logger')(_0x586c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x586c('0x3'));var fs=require('fs');var path=require(_0x586c('0x4'));var rimraf=require(_0x586c('0x5'));var config=require(_0x586c('0x6'));var attributes=require(_0x586c('0x7'));module['exports']=function(_0x30f4ba,_0x51aac3){return _0x30f4ba[_0x586c('0x8')](_0x586c('0x9'),attributes,{'tableName':_0x586c('0xa'),'paranoid':![],'indexes':[{'name':_0x586c('0xb'),'fields':[_0x586c('0xc'),_0x586c('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2b24=['path','../../config/environment','exports','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2b24,0x1c9));var _0x42b2=function(_0x3c8fa5,_0x1ac10f){_0x3c8fa5=_0x3c8fa5-0x0;var _0x3fa63a=_0x2b24[_0x3c8fa5];return _0x3fa63a;};'use strict';var _=require(_0x42b2('0x0'));var util=require(_0x42b2('0x1'));var logger=require(_0x42b2('0x2'))('api');var moment=require(_0x42b2('0x3'));var BPromise=require(_0x42b2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x42b2('0x5'));var rimraf=require('rimraf');var config=require(_0x42b2('0x6'));var attributes=require('./intDeskField.attributes');module[_0x42b2('0x7')]=function(_0x1e952a,_0x332087){return _0x1e952a['define']('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x42b2('0x8'),'fields':[_0x42b2('0x9'),_0x42b2('0xa')],'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 382761c..09af354 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 _0xbb88=['request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskField,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','randomstring','../../config/utils','rpc','../../config/environment','client','http','request'];(function(_0x5942f1,_0x306515){var _0x34379a=function(_0x1827eb){while(--_0x1827eb){_0x5942f1['push'](_0x5942f1['shift']());}};_0x34379a(++_0x306515);}(_0xbb88,0xdd));var _0x8bb8=function(_0x7ee046,_0x248eb5){_0x7ee046=_0x7ee046-0x0;var _0x512015=_0xbb88[_0x7ee046];return _0x512015;};'use strict';var _=require(_0x8bb8('0x0'));var util=require(_0x8bb8('0x1'));var moment=require('moment');var BPromise=require(_0x8bb8('0x2'));var rs=require(_0x8bb8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8bb8('0x4'));var logger=require('../../config/logger')(_0x8bb8('0x5'));var config=require(_0x8bb8('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8bb8('0x7')][_0x8bb8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xc10c82,_0x8defb1,_0x1c1c97){return new BPromise(function(_0x4e45de,_0x2ca91b){return client[_0x8bb8('0x9')](_0xc10c82,_0x1c1c97)['then'](function(_0x389e3c){logger['info']('DeskField,\x20%s,\x20%s',_0x8defb1,_0x8bb8('0xa'));logger[_0x8bb8('0xb')](_0x8bb8('0xc'),_0x8defb1,_0x8bb8('0xa'),JSON[_0x8bb8('0xd')](_0x389e3c));if(_0x389e3c[_0x8bb8('0xe')]){if(_0x389e3c['error'][_0x8bb8('0xf')]===0x1f4){logger[_0x8bb8('0xe')](_0x8bb8('0x10'),_0x8defb1,_0x389e3c['error'][_0x8bb8('0x11')]);return _0x2ca91b(_0x389e3c[_0x8bb8('0xe')][_0x8bb8('0x11')]);}logger[_0x8bb8('0xe')](_0x8bb8('0x10'),_0x8defb1,_0x389e3c[_0x8bb8('0xe')][_0x8bb8('0x11')]);return _0x4e45de(_0x389e3c[_0x8bb8('0xe')][_0x8bb8('0x11')]);}else{logger[_0x8bb8('0x12')](_0x8bb8('0x10'),_0x8defb1,'request\x20sent');_0x4e45de(_0x389e3c[_0x8bb8('0x13')][_0x8bb8('0x11')]);}})[_0x8bb8('0x14')](function(_0x23f681){logger['error'](_0x8bb8('0x10'),_0x8defb1,_0x23f681);_0x2ca91b(_0x23f681);});});} \ No newline at end of file +var _0xe1ac=['info','DeskField,\x20%s,\x20%s','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then'];(function(_0x2efb82,_0x433a08){var _0x6e953e=function(_0x10f039){while(--_0x10f039){_0x2efb82['push'](_0x2efb82['shift']());}};_0x6e953e(++_0x433a08);}(_0xe1ac,0x1c2));var _0xce1a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xe1ac[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xce1a('0x0'));var util=require(_0xce1a('0x1'));var moment=require(_0xce1a('0x2'));var BPromise=require('bluebird');var rs=require(_0xce1a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xce1a('0x4'))['db'];var utils=require(_0xce1a('0x5'));var logger=require(_0xce1a('0x6'))(_0xce1a('0x7'));var config=require(_0xce1a('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xce1a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a8ed5,_0x40beca,_0x5a7141){return new BPromise(function(_0x861c45,_0xe60ad2){return client[_0xce1a('0xa')](_0x3a8ed5,_0x5a7141)[_0xce1a('0xb')](function(_0x48f41d){logger[_0xce1a('0xc')](_0xce1a('0xd'),_0x40beca,'request\x20sent');logger['debug'](_0xce1a('0xe'),_0x40beca,_0xce1a('0xf'),JSON[_0xce1a('0x10')](_0x48f41d));if(_0x48f41d[_0xce1a('0x11')]){if(_0x48f41d[_0xce1a('0x11')][_0xce1a('0x12')]===0x1f4){logger[_0xce1a('0x11')](_0xce1a('0xd'),_0x40beca,_0x48f41d['error'][_0xce1a('0x13')]);return _0xe60ad2(_0x48f41d[_0xce1a('0x11')][_0xce1a('0x13')]);}logger[_0xce1a('0x11')](_0xce1a('0xd'),_0x40beca,_0x48f41d['error'][_0xce1a('0x13')]);return _0x861c45(_0x48f41d[_0xce1a('0x11')][_0xce1a('0x13')]);}else{logger[_0xce1a('0xc')](_0xce1a('0xd'),_0x40beca,_0xce1a('0xf'));_0x861c45(_0x48f41d[_0xce1a('0x14')]['message']);}})[_0xce1a('0x15')](function(_0x142cd9){logger['error'](_0xce1a('0xd'),_0x40beca,_0x142cd9);_0xe60ad2(_0x142cd9);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 65345e7..0352458 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 _0xcab6=['isAuthenticated','show','/:id/configurations','getConfigurations','getFields','post','addConfiguration','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','index','get','/:id'];(function(_0x593f13,_0x4301b0){var _0x5e702c=function(_0x4b16c7){while(--_0x4b16c7){_0x593f13['push'](_0x593f13['shift']());}};_0x5e702c(++_0x4301b0);}(_0xcab6,0x186));var _0x6cab=function(_0x50d75e,_0x22eac6){_0x50d75e=_0x50d75e-0x0;var _0x9879ca=_0xcab6[_0x50d75e];return _0x9879ca;};'use strict';var multer=require(_0x6cab('0x0'));var util=require(_0x6cab('0x1'));var path=require(_0x6cab('0x2'));var timeout=require(_0x6cab('0x3'));var express=require(_0x6cab('0x4'));var router=express[_0x6cab('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x6cab('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intDynamics365Account.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x6cab('0x7')]);router[_0x6cab('0x8')](_0x6cab('0x9'),auth[_0x6cab('0xa')](),controller[_0x6cab('0xb')]);router['get'](_0x6cab('0xc'),auth['isAuthenticated'](),controller[_0x6cab('0xd')]);router[_0x6cab('0x8')]('/:id/fields',auth[_0x6cab('0xa')](),controller[_0x6cab('0xe')]);router[_0x6cab('0xf')]('/',auth[_0x6cab('0xa')](),controller['create']);router[_0x6cab('0xf')](_0x6cab('0xc'),auth[_0x6cab('0xa')](),controller[_0x6cab('0x10')]);router['put']('/:id',auth[_0x6cab('0xa')](),controller[_0x6cab('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x6cab('0x12')]);module[_0x6cab('0x13')]=router; \ No newline at end of file +var _0xe007=['../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','util','path','connect-timeout','express','fs-extra'];(function(_0x7457ce,_0x211dc0){var _0x3dd385=function(_0x160387){while(--_0x160387){_0x7457ce['push'](_0x7457ce['shift']());}};_0x3dd385(++_0x211dc0);}(_0xe007,0x199));var _0x7e00=function(_0x18436e,_0x126461){_0x18436e=_0x18436e-0x0;var _0x4cfba1=_0xe007[_0x18436e];return _0x4cfba1;};'use strict';var multer=require('multer');var util=require(_0x7e00('0x0'));var path=require(_0x7e00('0x1'));var timeout=require(_0x7e00('0x2'));var express=require(_0x7e00('0x3'));var router=express['Router']();var fs_extra=require(_0x7e00('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7e00('0x5'));var config=require(_0x7e00('0x6'));var controller=require(_0x7e00('0x7'));router[_0x7e00('0x8')]('/',auth[_0x7e00('0x9')](),controller[_0x7e00('0xa')]);router[_0x7e00('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x7e00('0xb')]);router[_0x7e00('0x8')](_0x7e00('0xc'),auth[_0x7e00('0x9')](),controller[_0x7e00('0xd')]);router[_0x7e00('0x8')](_0x7e00('0xe'),auth[_0x7e00('0x9')](),controller[_0x7e00('0xf')]);router[_0x7e00('0x10')]('/',auth[_0x7e00('0x9')](),controller[_0x7e00('0x11')]);router[_0x7e00('0x10')](_0x7e00('0xc'),auth['isAuthenticated'](),controller[_0x7e00('0x12')]);router[_0x7e00('0x13')](_0x7e00('0x14'),auth[_0x7e00('0x9')](),controller[_0x7e00('0x15')]);router[_0x7e00('0x16')]('/:id',auth[_0x7e00('0x9')](),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 5d7ecbc..00af071 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 _0x5e11=['BOOLEAN','sequelize','STRING'];(function(_0x2bf790,_0x420554){var _0x55c4b9=function(_0x5e803){while(--_0x5e803){_0x2bf790['push'](_0x2bf790['shift']());}};_0x55c4b9(++_0x420554);}(_0x5e11,0x1c3));var _0x15e1=function(_0x1602fb,_0x20b6b3){_0x1602fb=_0x1602fb-0x0;var _0x461831=_0x5e11[_0x1602fb];return _0x461831;};'use strict';var Sequelize=require(_0x15e1('0x0'));module['exports']={'name':{'type':Sequelize[_0x15e1('0x1')]},'username':{'type':Sequelize[_0x15e1('0x1')]},'password':{'type':Sequelize[_0x15e1('0x1')]},'remoteUri':{'type':Sequelize[_0x15e1('0x1')]},'tenantId':{'type':Sequelize[_0x15e1('0x1')]},'clientId':{'type':Sequelize[_0x15e1('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x15e1('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x15e1('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x2cd0=['STRING','BOOLEAN','sequelize','exports'];(function(_0x496c30,_0x32d7e2){var _0x2abdfc=function(_0xd132e1){while(--_0xd132e1){_0x496c30['push'](_0x496c30['shift']());}};_0x2abdfc(++_0x32d7e2);}(_0x2cd0,0x8a));var _0x02cd=function(_0x3e0a0e,_0x1ecf6d){_0x3e0a0e=_0x3e0a0e-0x0;var _0x8e0d0a=_0x2cd0[_0x3e0a0e];return _0x8e0d0a;};'use strict';var Sequelize=require(_0x02cd('0x0'));module[_0x02cd('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x02cd('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x02cd('0x2')]},'clientSecret':{'type':Sequelize[_0x02cd('0x2')]},'serverUrl':{'type':Sequelize[_0x02cd('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x02cd('0x2')]},'modernAuthentication':{'type':Sequelize[_0x02cd('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 4708ff6..c3ccb49 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 _0x832e=['MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials','GET',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','util','lodash','../../components/parsers/qs','api','../../components/integrations/configuration','json','offset','undefined','limit','count','status','set','update','destroy','then','sendStatus','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','type','query','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','findOne','getConfigurations','addConfiguration','AccountId','Subjects','channel','getDescriptions','Dynamics365Configuration','Dynamics365Field','slice','format','%s/api/data/v9.0/','ticketType','incident','Incident','title','description','customerid','ownerid','subject','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','billedserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','customeridname','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','followupby','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridtype','owneridyominame','primarycontactidyominame','productidname','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slaname','socialprofileidname','transactioncurrencyidname','versionnumber','concat','password','clientId','clientSecret','modernAuthentication','CloudProvider','data5','access_token','data7','remoteUri','POST','https://login.microsoftonline.com/','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(','Attributes','includes','LogicalName','forEach','@odata.type','substring','push','all','isNil','BooleanAttributeMetadata','lastIndexOf','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata'];(function(_0x355a5f,_0x4f3ac5){var _0x23e51d=function(_0x31b06c){while(--_0x31b06c){_0x355a5f['push'](_0x355a5f['shift']());}};_0x23e51d(++_0x4f3ac5);}(_0x832e,0x17b));var _0xe832=function(_0x5eb810,_0x353060){_0x5eb810=_0x5eb810-0x0;var _0x247643=_0x832e[_0x5eb810];return _0x247643;};'use strict';var rp=require('request-promise');var util=require(_0xe832('0x0'));var _=require(_0xe832('0x1'));var qs=require(_0xe832('0x2'));var logger=require('../../config/logger')(_0xe832('0x3'));var db=require('../../mysqldb')['db'];var integrations=require(_0xe832('0x4'));function respondWithResult(_0x123513,_0x479100){_0x479100=_0x479100||0xc8;return function(_0x55b417){if(_0x55b417){return _0x123513['status'](_0x479100)[_0xe832('0x5')](_0x55b417);}};}function respondWithFilteredResult(_0x460b13,_0x5c4c66){return function(_0x157f49){if(_0x157f49){var _0x34ac0d=typeof _0x5c4c66[_0xe832('0x6')]===_0xe832('0x7')&&typeof _0x5c4c66[_0xe832('0x8')]==='undefined';var _0x209759=_0x157f49['count'];var _0x481ce6=_0x34ac0d?0x0:_0x5c4c66[_0xe832('0x6')];var _0x5807a6=_0x34ac0d?_0x157f49[_0xe832('0x9')]:_0x5c4c66[_0xe832('0x6')]+_0x5c4c66[_0xe832('0x8')];var _0x174d80;if(_0x5807a6>=_0x209759){_0x5807a6=_0x209759;_0x174d80=0xc8;}else{_0x174d80=0xce;}_0x460b13[_0xe832('0xa')](_0x174d80);return _0x460b13[_0xe832('0xb')]('Content-Range',_0x481ce6+'-'+_0x5807a6+'/'+_0x209759)[_0xe832('0x5')](_0x157f49);}return null;};}function saveUpdates(_0x142d63){return function(_0xcbf4d9){if(_0xcbf4d9){return _0xcbf4d9[_0xe832('0xc')](_0x142d63)['then'](function(_0x283d03){return _0x283d03;});}return null;};}function removeEntity(_0x4c046e){return function(_0x4984ea){if(_0x4984ea){return _0x4984ea[_0xe832('0xd')]()[_0xe832('0xe')](function(){_0x4c046e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d5ee6){return function(_0x1c2cfa){if(!_0x1c2cfa){_0x3d5ee6[_0xe832('0xf')](0x194);}return _0x1c2cfa;};}function handleError(_0x25c0d3,_0x2d15bc){_0x2d15bc=_0x2d15bc||0x1f4;return function(_0x1bc4ab){logger[_0xe832('0x10')](_0x1bc4ab[_0xe832('0x11')]);if(_0x1bc4ab[_0xe832('0x12')]){delete _0x1bc4ab[_0xe832('0x12')];}_0x25c0d3['status'](_0x2d15bc)[_0xe832('0x13')](_0x1bc4ab);};}exports[_0xe832('0x14')]=function(_0x320bbd,_0x3748cf){var _0x20c935={},_0x533cd4={},_0x34a6ad={'count':0x0,'rows':[]};var _0x50a04a=_[_0xe832('0x15')](db[_0xe832('0x16')][_0xe832('0x17')],function(_0x7ace35){return{'name':_0x7ace35['fieldName'],'type':_0x7ace35[_0xe832('0x18')]['key']};});_0x533cd4['model']=_[_0xe832('0x15')](_0x50a04a,_0xe832('0x12'));_0x533cd4[_0xe832('0x19')]=_['keys'](_0x320bbd[_0xe832('0x19')]);_0x533cd4[_0xe832('0x1a')]=_['intersection'](_0x533cd4[_0xe832('0x1b')],_0x533cd4[_0xe832('0x19')]);_0x20c935['attributes']=_[_0xe832('0x1c')](_0x533cd4[_0xe832('0x1b')],qs[_0xe832('0x1d')](_0x320bbd[_0xe832('0x19')][_0xe832('0x1d')]));_0x20c935[_0xe832('0x1e')]=_0x20c935[_0xe832('0x1e')]['length']?_0x20c935[_0xe832('0x1e')]:_0x533cd4[_0xe832('0x1b')];if(!_0x320bbd[_0xe832('0x19')][_0xe832('0x1f')](_0xe832('0x20'))){_0x20c935[_0xe832('0x8')]=qs[_0xe832('0x8')](_0x320bbd[_0xe832('0x19')]['limit']);_0x20c935[_0xe832('0x6')]=qs[_0xe832('0x6')](_0x320bbd[_0xe832('0x19')][_0xe832('0x6')]);}_0x20c935[_0xe832('0x21')]=qs[_0xe832('0x22')](_0x320bbd[_0xe832('0x19')]['sort']);_0x20c935[_0xe832('0x23')]=qs[_0xe832('0x1a')](_[_0xe832('0x24')](_0x320bbd[_0xe832('0x19')],_0x533cd4[_0xe832('0x1a')]),_0x50a04a);if(_0x320bbd[_0xe832('0x19')][_0xe832('0x25')]){_0x20c935['where']=_[_0xe832('0x26')](_0x20c935[_0xe832('0x23')],{'$or':_[_0xe832('0x15')](_0x50a04a,function(_0x5ceec6){if(_0x5ceec6[_0xe832('0x18')]!==_0xe832('0x27')){var _0x32a1a0={};_0x32a1a0[_0x5ceec6['name']]={'$like':'%'+_0x320bbd['query']['filter']+'%'};return _0x32a1a0;}})});}_0x20c935=_[_0xe832('0x26')]({},_0x20c935,_0x320bbd[_0xe832('0x28')]);var _0x15d511={'where':_0x20c935['where']};return db[_0xe832('0x16')][_0xe832('0x9')](_0x15d511)[_0xe832('0xe')](function(_0x1ea9d6){_0x34a6ad[_0xe832('0x9')]=_0x1ea9d6;if(_0x320bbd[_0xe832('0x19')][_0xe832('0x29')]){_0x20c935[_0xe832('0x2a')]=[{'all':!![]}];}return db[_0xe832('0x16')][_0xe832('0x2b')](_0x20c935);})[_0xe832('0xe')](function(_0x36beb3){_0x34a6ad[_0xe832('0x2c')]=_0x36beb3;return _0x34a6ad;})['then'](respondWithFilteredResult(_0x3748cf,_0x20c935))[_0xe832('0x2d')](handleError(_0x3748cf,null));};exports[_0xe832('0x2e')]=function(_0xadcc0b,_0xec3b04){var _0x16b974={'raw':![],'where':{'id':_0xadcc0b[_0xe832('0x2f')]['id']}},_0x2c8a5e={};_0x2c8a5e[_0xe832('0x1b')]=_['keys'](db[_0xe832('0x16')][_0xe832('0x17')]);_0x2c8a5e[_0xe832('0x19')]=_[_0xe832('0x30')](_0xadcc0b[_0xe832('0x19')]);_0x2c8a5e[_0xe832('0x1a')]=_[_0xe832('0x1c')](_0x2c8a5e[_0xe832('0x1b')],_0x2c8a5e[_0xe832('0x19')]);_0x16b974['attributes']=_[_0xe832('0x1c')](_0x2c8a5e['model'],qs[_0xe832('0x1d')](_0xadcc0b[_0xe832('0x19')][_0xe832('0x1d')]));_0x16b974[_0xe832('0x1e')]=_0x16b974[_0xe832('0x1e')][_0xe832('0x31')]?_0x16b974[_0xe832('0x1e')]:_0x2c8a5e[_0xe832('0x1b')];if(_0xadcc0b[_0xe832('0x19')][_0xe832('0x29')]){_0x16b974['include']=[{'all':!![]}];}_0x16b974=_[_0xe832('0x26')]({},_0x16b974,_0xadcc0b[_0xe832('0x28')]);return db[_0xe832('0x16')][_0xe832('0x32')](_0x16b974)[_0xe832('0xe')](handleEntityNotFound(_0xec3b04,null))['then'](respondWithResult(_0xec3b04,null))['catch'](handleError(_0xec3b04,null));};exports[_0xe832('0x33')]=function(_0x41129a,_0x599850){return db[_0xe832('0x16')][_0xe832('0x33')](_0x41129a[_0xe832('0x34')],{})[_0xe832('0xe')](respondWithResult(_0x599850,0xc9))[_0xe832('0x2d')](handleError(_0x599850,null));};exports[_0xe832('0xc')]=function(_0x2bb3fe,_0x3b024d){if(_0x2bb3fe[_0xe832('0x34')]['id']){delete _0x2bb3fe[_0xe832('0x34')]['id'];}return db['Dynamics365Account'][_0xe832('0x32')]({'where':{'id':_0x2bb3fe[_0xe832('0x2f')]['id']}})[_0xe832('0xe')](handleEntityNotFound(_0x3b024d,null))[_0xe832('0xe')](saveUpdates(_0x2bb3fe[_0xe832('0x34')],null))[_0xe832('0xe')](respondWithResult(_0x3b024d,null))[_0xe832('0x2d')](handleError(_0x3b024d,null));};exports['destroy']=function(_0x14274b,_0x220616){return db['Dynamics365Account']['find']({'where':{'id':_0x14274b['params']['id']}})[_0xe832('0xe')](handleEntityNotFound(_0x220616,null))[_0xe832('0xe')](removeEntity(_0x220616,null))[_0xe832('0x2d')](handleError(_0x220616,null));};exports['getConfigurations']=function(_0x56c145,_0xb6a86){var _0x1d1f41={};var _0x23d41a={};var _0x69b4fb;var _0x2faef1;return db[_0xe832('0x16')][_0xe832('0x35')]({'where':{'id':_0x56c145[_0xe832('0x2f')]['id']}})[_0xe832('0xe')](handleEntityNotFound(_0xb6a86,null))['then'](function(_0x615537){if(_0x615537){_0x69b4fb=_0x615537;_0x23d41a['model']=_[_0xe832('0x30')](db['Dynamics365Configuration'][_0xe832('0x17')]);_0x23d41a[_0xe832('0x19')]=_['keys'](_0x56c145[_0xe832('0x19')]);_0x23d41a[_0xe832('0x1a')]=_[_0xe832('0x1c')](_0x23d41a[_0xe832('0x1b')],_0x23d41a['query']);_0x1d1f41['attributes']=_[_0xe832('0x1c')](_0x23d41a[_0xe832('0x1b')],qs['fields'](_0x56c145[_0xe832('0x19')][_0xe832('0x1d')]));_0x1d1f41[_0xe832('0x1e')]=_0x1d1f41[_0xe832('0x1e')][_0xe832('0x31')]?_0x1d1f41[_0xe832('0x1e')]:_0x23d41a[_0xe832('0x1b')];_0x1d1f41[_0xe832('0x21')]=qs[_0xe832('0x22')](_0x56c145[_0xe832('0x19')][_0xe832('0x22')]);_0x1d1f41[_0xe832('0x23')]=qs[_0xe832('0x1a')](_[_0xe832('0x24')](_0x56c145['query'],_0x23d41a[_0xe832('0x1a')]));if(_0x56c145[_0xe832('0x19')][_0xe832('0x25')]){_0x1d1f41[_0xe832('0x23')]=_[_0xe832('0x26')](_0x1d1f41[_0xe832('0x23')],{'$or':_['map'](_0x1d1f41['attributes'],function(_0x4b3054){var _0x108749={};_0x108749[_0x4b3054]={'$like':'%'+_0x56c145[_0xe832('0x19')][_0xe832('0x25')]+'%'};return _0x108749;})});}_0x1d1f41=_[_0xe832('0x26')]({},_0x1d1f41,_0x56c145[_0xe832('0x28')]);return _0x69b4fb[_0xe832('0x36')](_0x1d1f41);}})[_0xe832('0xe')](function(_0x1a8507){if(_0x1a8507){_0x2faef1=_0x1a8507['length'];if(!_0x56c145[_0xe832('0x19')]['hasOwnProperty'](_0xe832('0x20'))){_0x1d1f41['limit']=qs['limit'](_0x56c145[_0xe832('0x19')][_0xe832('0x8')]);_0x1d1f41[_0xe832('0x6')]=qs[_0xe832('0x6')](_0x56c145[_0xe832('0x19')][_0xe832('0x6')]);}return _0x69b4fb['getConfigurations'](_0x1d1f41);}})[_0xe832('0xe')](function(_0x1189c2){if(_0x1189c2){return _0x1189c2?{'count':_0x2faef1,'rows':_0x1189c2}:null;}})[_0xe832('0xe')](respondWithResult(_0xb6a86,null))['catch'](handleError(_0xb6a86,null));};exports[_0xe832('0x37')]=function(_0x31415c,_0x5bbafb){if(_0x31415c[_0xe832('0x34')]['id']){delete _0x31415c[_0xe832('0x34')]['id'];}return db[_0xe832('0x16')][_0xe832('0x35')]({'where':{'id':_0x31415c['params']['id']}})[_0xe832('0xe')](handleEntityNotFound(_0x5bbafb,null))[_0xe832('0xe')](function(_0x55fda4){if(_0x55fda4){_0x31415c[_0xe832('0x34')][_0xe832('0x38')]=_0x55fda4['id'];_0x31415c[_0xe832('0x34')][_0xe832('0x39')]=integrations['getSubjects'](_0x31415c[_0xe832('0x34')][_0xe832('0x3a')],_0x31415c[_0xe832('0x34')][_0xe832('0x18')]);_0x31415c[_0xe832('0x34')]['Descriptions']=integrations[_0xe832('0x3b')](_0x31415c[_0xe832('0x34')]['channel'],_0x31415c['body'][_0xe832('0x18')]);return db[_0xe832('0x3c')][_0xe832('0x33')](_0x31415c['body'],{'include':[{'model':db[_0xe832('0x3d')],'as':_0xe832('0x39')},{'model':db[_0xe832('0x3d')],'as':'Descriptions'}]});}return null;})[_0xe832('0xe')](respondWithResult(_0x5bbafb,null))[_0xe832('0x2d')](handleError(_0x5bbafb,null));};function sanitizeRemoteUri(_0x222dab){var _0x56236a=_0x222dab[_0xe832('0x3e')](-0x1);if(_0x56236a==='/')return _0x222dab['substring'](0x0,_0x222dab['lastIndexOf'](_0x56236a));return _0x222dab;}function getWebApiUrl(_0x3a8271){return util[_0xe832('0x3f')](_0xe832('0x40'),_0x3a8271);}exports['getFields']=function(_0x253cab,_0x1330c2){var _0x165b21=_0x253cab[_0xe832('0x19')][_0xe832('0x41')];var _0x20a262=_0x165b21===_0xe832('0x42')?_0xe832('0x43'):'PhoneCall';var _0x180730='';var _0x31437f='';var _0x2f01b2='';var _0x5083a7='';var _0x1309af='';var _0x3fac7c='';var _0x318585='';var _0x470771='';var _0x1d43b0=[_0xe832('0x44'),_0xe832('0x45'),_0xe832('0x46'),_0xe832('0x47'),'caseorigincode',_0xe832('0x48'),'phonenumber',_0xe832('0x49'),_0xe832('0x4a'),_0xe832('0x4b')];var _0x1aa8b8=[_0xe832('0x4c'),_0xe832('0x4d'),'actualserviceunits',_0xe832('0x4e'),_0xe832('0x4f'),_0xe832('0x50'),_0xe832('0x51'),'contractidname',_0xe832('0x52'),'createdbyexternalpartyyominame',_0xe832('0x53'),_0xe832('0x54'),_0xe832('0x55'),_0xe832('0x56'),'createdonbehalfbyyominame',_0xe832('0x57'),'customeridtype',_0xe832('0x58'),_0xe832('0x59'),_0xe832('0x5a'),_0xe832('0x5b'),_0xe832('0x5c'),_0xe832('0x5d'),_0xe832('0x5e'),'firstresponsebykpiidname',_0xe832('0x5f'),'importsequencenumber',_0xe832('0x60'),_0xe832('0x61'),_0xe832('0x62'),_0xe832('0x63'),_0xe832('0x64'),_0xe832('0x65'),'modifiedbyname',_0xe832('0x66'),_0xe832('0x67'),'modifiedonbehalfbyname',_0xe832('0x68'),'msdyn_incidenttypename',_0xe832('0x69'),_0xe832('0x6a'),'onholdtime',_0xe832('0x6b'),_0xe832('0x6c'),_0xe832('0x6d'),_0xe832('0x6e'),'parentcaseidname','primarycontactidname',_0xe832('0x6f'),'prioritycodename',_0xe832('0x70'),'productserialnumber',_0xe832('0x71'),_0xe832('0x72'),_0xe832('0x73'),_0xe832('0x74'),_0xe832('0x75'),_0xe832('0x76'),'slainvokedidname',_0xe832('0x77'),_0xe832('0x78'),'statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber',_0xe832('0x79'),'traversedpath','utcconversiontimezonecode',_0xe832('0x7a')];var _0x434665=_0x1d43b0[_0xe832('0x7b')](_0x1aa8b8);return db[_0xe832('0x16')][_0xe832('0x35')]({'where':{'id':_0x253cab[_0xe832('0x2f')]['id']},'attributes':['id','username',_0xe832('0x7c'),'remoteUri','tenantId',_0xe832('0x7d'),_0xe832('0x7e'),_0xe832('0x7f')],'include':[{'model':db[_0xe832('0x80')],'as':'CloudProvider','attributes':['id',_0xe832('0x81'),'data7']}]})['then'](handleEntityNotFound(_0x1330c2,null))[_0xe832('0xe')](function(_0x24462f){if(_0x24462f){if(_0x24462f['modernAuthentication']){_0x24462f[_0xe832('0x82')]=_0x24462f[_0xe832('0x80')][_0xe832('0x81')];_0x470771=sanitizeRemoteUri(_0x24462f[_0xe832('0x80')][_0xe832('0x83')]);_0x318585=getWebApiUrl(_0x470771);return _0x24462f;}_0x470771=sanitizeRemoteUri(_0x24462f[_0xe832('0x84')]);_0x318585=getWebApiUrl(_0x470771);var _0x281fe9={'method':_0xe832('0x85'),'uri':_0xe832('0x86')+_0x24462f['tenantId']+'/oauth2/token','form':{'client_id':_0x24462f[_0xe832('0x7d')],'resource':_0x470771,'username':_0x24462f['username'],'password':_0x24462f['password'],'grant_type':_0xe832('0x7c'),'client_secret':_0x24462f['clientSecret']},'json':!![]};return rp(_0x281fe9);}})[_0xe832('0xe')](function(_0x21acbd){_0x3fac7c=_0x21acbd[_0xe832('0x82')];var _0x18e189={'method':'GET','uri':encodeURI(_0x318585+_0xe832('0x87')+_0x20a262+'\x27'),'headers':{'Authorization':_0xe832('0x88')+_0x3fac7c,'If-None-Match':null,'OData-Version':_0xe832('0x89')},'json':!![]};return rp(_0x18e189);})[_0xe832('0xe')](function(_0x315dd5){var _0x58d978=_0x315dd5[_0xe832('0x8a')][0x0];var _0xad79a9=_0x58d978[_0xe832('0x8b')];var _0x24b462={'method':'GET','uri':_0x318585+_0xe832('0x8c')+_0xad79a9+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xe832('0x88')+_0x3fac7c,'If-None-Match':null,'OData-Version':_0xe832('0x89')},'json':!![]};return rp(_0x24b462);})['then'](function(_0x7d1afa){_0x180730=_0x7d1afa;_0x31437f=_0x180730[_0xe832('0x8d')];_0x31437f=_['remove'](_0x31437f,function(_0x4d62c6){return!_0x434665[_0xe832('0x8e')](_0x4d62c6[_0xe832('0x8f')]);});var _0x457d2e=[];var _0x42c88a=[];_0x31437f[_0xe832('0x90')](function(_0x160841){if(_0x160841[_0xe832('0x91')]){var _0x55d729=_0x160841[_0xe832('0x91')][_0xe832('0x92')](_0x160841[_0xe832('0x91')]['lastIndexOf']('.')+0x1);if(_0x55d729==='PicklistAttributeMetadata'){_0x457d2e[_0xe832('0x93')](getSelectList(_0x318585,_0x165b21,_0x42c88a,_0x180730['MetadataId'],_0x160841['MetadataId'],_0x3fac7c));}}});return Promise[_0xe832('0x94')](_0x457d2e);})[_0xe832('0xe')](function(_0x14dd2b){_0x2f01b2=_0x14dd2b[0x0];var _0x4b3d7a=[];var _0x8cd579=[];_0x31437f[_0xe832('0x90')](function(_0x53138a){if(!_[_0xe832('0x95')](_0x53138a[_0xe832('0x91')])){var _0x4a923b=_0x53138a[_0xe832('0x91')][_0xe832('0x92')](_0x53138a[_0xe832('0x91')]['lastIndexOf']('.')+0x1);if(_0x4a923b===_0xe832('0x96')){_0x4b3d7a[_0xe832('0x93')](getBooleanList(_0x318585,_0x165b21,_0x8cd579,_0x180730[_0xe832('0x8b')],_0x53138a['MetadataId'],_0x3fac7c));}}});return Promise[_0xe832('0x94')](_0x4b3d7a);})[_0xe832('0xe')](function(_0x3844b4){_0x5083a7=_0x3844b4[0x0];var _0x15b119=[];var _0x23aacc=[];_0x31437f['forEach'](function(_0x147a07){if(_0x147a07[_0xe832('0x91')]){var _0x117a50=_0x147a07['@odata.type'][_0xe832('0x92')](_0x147a07['@odata.type'][_0xe832('0x97')]('.')+0x1);if(_0x117a50===_0xe832('0x98')||_0x117a50===_0xe832('0x99')||_0x117a50==='BigIntAttributeMetadata'||_0x117a50===_0xe832('0x9a')||_0x117a50===_0xe832('0x9b')||_0x117a50===_0xe832('0x9c')||_0x117a50===_0xe832('0x9d')||_0x117a50===_0xe832('0x9e')||_0x117a50==='StateAttributeMetadata'||_0x117a50===_0xe832('0x9f')){_0x15b119[_0xe832('0x93')](getInputList(_0x318585,_0x165b21,_0x117a50,_0x23aacc,_0x180730[_0xe832('0x8b')],_0x147a07['MetadataId'],_0x3fac7c));}}});return Promise[_0xe832('0x94')](_0x15b119);})[_0xe832('0xe')](function(_0x1e3311){_0x1309af=_0x1e3311[0x0];var _0xe313fe=_0x2f01b2[_0xe832('0x7b')](_0x5083a7)[_0xe832('0x7b')](_0x1309af);var _0x549c8a={'count':_0xe313fe[_0xe832('0x31')],'rows':_0xe313fe};return _0x549c8a;})[_0xe832('0xe')](respondWithResult(_0x1330c2,null))[_0xe832('0x2d')](function(_0x3ad141){var _0x2597a9=_0x253cab[_0xe832('0x19')][_0xe832('0xa0')]?0x1f4:_0x3ad141[_0xe832('0xa1')]||0x1f4;logger[_0xe832('0x10')](_0x3ad141['stack']);delete _0x3ad141[_0xe832('0x12')];if(_0x2597a9===0x191){_0x2597a9=0x190;}_0x1330c2['status'](_0x2597a9)[_0xe832('0x13')](_0x253cab[_0xe832('0x19')][_0xe832('0xa0')]?{'message':_0xe832('0xa2'),'statusCode':_0x3ad141[_0xe832('0xa1')]}:_0x3ad141);});};function getSelectList(_0x63c36e,_0x589104,_0x206604,_0x2a304c,_0x37dce4,_0x446fbb){var _0x4c4397={'method':_0xe832('0xa3'),'uri':_0x63c36e+_0xe832('0x8c')+_0x2a304c+_0xe832('0xa4')+_0x37dce4+_0xe832('0xa5')+_0xe832('0xa6'),'headers':{'Authorization':'Bearer\x20'+_0x446fbb,'If-None-Match':null,'OData-Version':_0xe832('0x89')},'json':!![]};return rp(_0x4c4397)[_0xe832('0xe')](function(_0x50f09a){var _0x27601e=[];var _0x20c4e0=_0x50f09a[_0xe832('0xa7')]['Options'];_0x20c4e0['forEach'](function(_0x595408){_0x27601e[_0xe832('0x93')]({'name':_0x595408[_0xe832('0xa8')][_0xe832('0xa9')]['Label'],'value':String(_0x595408[_0xe832('0xaa')])});});var _0x55bb1a={'id':_0x589104+'_'+_0x50f09a[_0xe832('0x8f')],'name':_0x50f09a[_0xe832('0xab')][_0xe832('0xa9')][_0xe832('0xa8')],'custom':![],'options':_0x27601e};_0x206604[_0xe832('0x93')](_0x55bb1a);return _0x206604;});}function getBooleanList(_0x3baebe,_0x4d6985,_0xf544e9,_0x248ab4,_0x142a78,_0x359964){var _0x56911d={'method':_0xe832('0xa3'),'uri':_0x3baebe+_0xe832('0x8c')+_0x248ab4+_0xe832('0xa4')+_0x142a78+_0xe832('0xac'),'headers':{'Authorization':'Bearer\x20'+_0x359964,'If-None-Match':null,'OData-Version':_0xe832('0x89')},'json':!![]};return rp(_0x56911d)['then'](function(_0x2d34c7){var _0x316d95=[];_0x316d95[_0xe832('0x93')]({'name':_0x2d34c7[_0xe832('0xa7')][_0xe832('0xad')][_0xe832('0xa8')][_0xe832('0xa9')][_0xe832('0xa8')],'value':_0xe832('0xae')},{'name':_0x2d34c7[_0xe832('0xa7')][_0xe832('0xaf')]['Label'][_0xe832('0xa9')][_0xe832('0xa8')],'value':'false'});var _0xdc41c5={'id':_0x4d6985+'_'+_0x2d34c7[_0xe832('0x8f')],'name':_0x2d34c7['DisplayName'][_0xe832('0xa9')][_0xe832('0xa8')],'custom':![],'options':_0x316d95};_0xf544e9[_0xe832('0x93')](_0xdc41c5);return _0xf544e9;});}function getInputList(_0x494e1b,_0x440ac9,_0x2ba657,_0x4854d9,_0x260571,_0x19e9c1,_0x3fa4d2){var _0x268daf={'method':_0xe832('0xa3'),'uri':_0x494e1b+'EntityDefinitions('+_0x260571+_0xe832('0xa4')+_0x19e9c1+_0xe832('0xb0')+_0x2ba657+_0xe832('0xb1'),'headers':{'Authorization':_0xe832('0x88')+_0x3fa4d2,'If-None-Match':null,'OData-Version':_0xe832('0x89')},'json':!![]};return rp(_0x268daf)['then'](function(_0x3f1b49){var _0x356450={'id':_0x440ac9+'_'+_0x3f1b49['LogicalName'],'name':_0x3f1b49[_0xe832('0xab')][_0xe832('0xa9')]?_0x3f1b49['DisplayName'][_0xe832('0xa9')]['Label']:_0x3f1b49['LogicalName'],'custom':![],'options':[]};_0x4854d9['push'](_0x356450);return _0x4854d9;});} \ No newline at end of file +var _0x4a83=['actualserviceunits','contactidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolveby','responsiblecontactidyominame','sentimentvalue','slaname','statecode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','concat','password','remoteUri','clientId','modernAuthentication','CloudProvider','data7','access_token','data5','POST','https://login.microsoftonline.com/','tenantId','username','clientSecret','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','isNil','BooleanAttributeMetadata','push','all','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','Label','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','true','FalseOption','false','DisplayName','util','lodash','../../components/parsers/qs','../../config/logger','../../components/integrations/configuration','status','json','undefined','limit','count','offset','set','Content-Range','update','destroy','then','end','sendStatus','error','stack','name','send','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','rows','catch','show','intersection','find','create','body','params','findOne','options','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','substring','lastIndexOf','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','title','description','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname'];(function(_0x38d499,_0x1cbb6b){var _0x274b18=function(_0x488d64){while(--_0x488d64){_0x38d499['push'](_0x38d499['shift']());}};_0x274b18(++_0x1cbb6b);}(_0x4a83,0x125));var _0x34a8=function(_0x25834f,_0x2dac58){_0x25834f=_0x25834f-0x0;var _0x3af0dd=_0x4a83[_0x25834f];return _0x3af0dd;};'use strict';var rp=require('request-promise');var util=require(_0x34a8('0x0'));var _=require(_0x34a8('0x1'));var qs=require(_0x34a8('0x2'));var logger=require(_0x34a8('0x3'))('api');var db=require('../../mysqldb')['db'];var integrations=require(_0x34a8('0x4'));function respondWithResult(_0xb811f8,_0xb6b7cc){_0xb6b7cc=_0xb6b7cc||0xc8;return function(_0x502858){if(_0x502858){return _0xb811f8[_0x34a8('0x5')](_0xb6b7cc)[_0x34a8('0x6')](_0x502858);}};}function respondWithFilteredResult(_0xa51ac4,_0x2405a6){return function(_0x54950c){if(_0x54950c){var _0x47b304=typeof _0x2405a6['offset']===_0x34a8('0x7')&&typeof _0x2405a6[_0x34a8('0x8')]===_0x34a8('0x7');var _0x124c2b=_0x54950c[_0x34a8('0x9')];var _0x3e446b=_0x47b304?0x0:_0x2405a6[_0x34a8('0xa')];var _0x5dc41b=_0x47b304?_0x54950c[_0x34a8('0x9')]:_0x2405a6[_0x34a8('0xa')]+_0x2405a6[_0x34a8('0x8')];var _0xf22231;if(_0x5dc41b>=_0x124c2b){_0x5dc41b=_0x124c2b;_0xf22231=0xc8;}else{_0xf22231=0xce;}_0xa51ac4['status'](_0xf22231);return _0xa51ac4[_0x34a8('0xb')](_0x34a8('0xc'),_0x3e446b+'-'+_0x5dc41b+'/'+_0x124c2b)['json'](_0x54950c);}return null;};}function saveUpdates(_0x315c8a){return function(_0x2ffaba){if(_0x2ffaba){return _0x2ffaba[_0x34a8('0xd')](_0x315c8a)['then'](function(_0x15bf27){return _0x15bf27;});}return null;};}function removeEntity(_0x128594){return function(_0x5b5e2e){if(_0x5b5e2e){return _0x5b5e2e[_0x34a8('0xe')]()[_0x34a8('0xf')](function(){_0x128594[_0x34a8('0x5')](0xcc)[_0x34a8('0x10')]();});}};}function handleEntityNotFound(_0x4c4bed){return function(_0x148ae5){if(!_0x148ae5){_0x4c4bed[_0x34a8('0x11')](0x194);}return _0x148ae5;};}function handleError(_0x1ac52c,_0x1830ca){_0x1830ca=_0x1830ca||0x1f4;return function(_0x4b0113){logger[_0x34a8('0x12')](_0x4b0113[_0x34a8('0x13')]);if(_0x4b0113[_0x34a8('0x14')]){delete _0x4b0113['name'];}_0x1ac52c['status'](_0x1830ca)[_0x34a8('0x15')](_0x4b0113);};}exports['index']=function(_0x3e32c5,_0x1cf245){var _0x6cd129={},_0x4849cd={},_0x520713={'count':0x0,'rows':[]};var _0x3d8d20=_[_0x34a8('0x16')](db[_0x34a8('0x17')][_0x34a8('0x18')],function(_0x53915b){return{'name':_0x53915b[_0x34a8('0x19')],'type':_0x53915b[_0x34a8('0x1a')][_0x34a8('0x1b')]};});_0x4849cd[_0x34a8('0x1c')]=_[_0x34a8('0x16')](_0x3d8d20,_0x34a8('0x14'));_0x4849cd[_0x34a8('0x1d')]=_[_0x34a8('0x1e')](_0x3e32c5[_0x34a8('0x1d')]);_0x4849cd[_0x34a8('0x1f')]=_['intersection'](_0x4849cd[_0x34a8('0x1c')],_0x4849cd['query']);_0x6cd129[_0x34a8('0x20')]=_['intersection'](_0x4849cd[_0x34a8('0x1c')],qs[_0x34a8('0x21')](_0x3e32c5[_0x34a8('0x1d')][_0x34a8('0x21')]));_0x6cd129['attributes']=_0x6cd129['attributes'][_0x34a8('0x22')]?_0x6cd129['attributes']:_0x4849cd[_0x34a8('0x1c')];if(!_0x3e32c5[_0x34a8('0x1d')][_0x34a8('0x23')](_0x34a8('0x24'))){_0x6cd129[_0x34a8('0x8')]=qs[_0x34a8('0x8')](_0x3e32c5[_0x34a8('0x1d')]['limit']);_0x6cd129[_0x34a8('0xa')]=qs[_0x34a8('0xa')](_0x3e32c5['query'][_0x34a8('0xa')]);}_0x6cd129[_0x34a8('0x25')]=qs[_0x34a8('0x26')](_0x3e32c5[_0x34a8('0x1d')][_0x34a8('0x26')]);_0x6cd129[_0x34a8('0x27')]=qs[_0x34a8('0x1f')](_[_0x34a8('0x28')](_0x3e32c5['query'],_0x4849cd['filters']),_0x3d8d20);if(_0x3e32c5[_0x34a8('0x1d')][_0x34a8('0x29')]){_0x6cd129['where']=_['merge'](_0x6cd129[_0x34a8('0x27')],{'$or':_[_0x34a8('0x16')](_0x3d8d20,function(_0x18a20a){if(_0x18a20a[_0x34a8('0x1a')]!==_0x34a8('0x2a')){var _0x53dba2={};_0x53dba2[_0x18a20a[_0x34a8('0x14')]]={'$like':'%'+_0x3e32c5['query'][_0x34a8('0x29')]+'%'};return _0x53dba2;}})});}_0x6cd129=_[_0x34a8('0x2b')]({},_0x6cd129,_0x3e32c5['options']);var _0xa9aa50={'where':_0x6cd129[_0x34a8('0x27')]};return db['Dynamics365Account'][_0x34a8('0x9')](_0xa9aa50)[_0x34a8('0xf')](function(_0x30e281){_0x520713[_0x34a8('0x9')]=_0x30e281;if(_0x3e32c5[_0x34a8('0x1d')][_0x34a8('0x2c')]){_0x6cd129[_0x34a8('0x2d')]=[{'all':!![]}];}return db[_0x34a8('0x17')]['findAll'](_0x6cd129);})[_0x34a8('0xf')](function(_0xaeb827){_0x520713[_0x34a8('0x2e')]=_0xaeb827;return _0x520713;})['then'](respondWithFilteredResult(_0x1cf245,_0x6cd129))[_0x34a8('0x2f')](handleError(_0x1cf245,null));};exports[_0x34a8('0x30')]=function(_0x9baa96,_0x47de83){var _0x497e7b={'raw':![],'where':{'id':_0x9baa96['params']['id']}},_0xd028a6={};_0xd028a6[_0x34a8('0x1c')]=_[_0x34a8('0x1e')](db['Dynamics365Account'][_0x34a8('0x18')]);_0xd028a6[_0x34a8('0x1d')]=_[_0x34a8('0x1e')](_0x9baa96['query']);_0xd028a6[_0x34a8('0x1f')]=_[_0x34a8('0x31')](_0xd028a6[_0x34a8('0x1c')],_0xd028a6['query']);_0x497e7b[_0x34a8('0x20')]=_[_0x34a8('0x31')](_0xd028a6[_0x34a8('0x1c')],qs[_0x34a8('0x21')](_0x9baa96[_0x34a8('0x1d')][_0x34a8('0x21')]));_0x497e7b['attributes']=_0x497e7b['attributes']['length']?_0x497e7b[_0x34a8('0x20')]:_0xd028a6[_0x34a8('0x1c')];if(_0x9baa96[_0x34a8('0x1d')]['includeAll']){_0x497e7b[_0x34a8('0x2d')]=[{'all':!![]}];}_0x497e7b=_[_0x34a8('0x2b')]({},_0x497e7b,_0x9baa96['options']);return db[_0x34a8('0x17')][_0x34a8('0x32')](_0x497e7b)[_0x34a8('0xf')](handleEntityNotFound(_0x47de83,null))[_0x34a8('0xf')](respondWithResult(_0x47de83,null))[_0x34a8('0x2f')](handleError(_0x47de83,null));};exports[_0x34a8('0x33')]=function(_0x40333b,_0x5b132b){return db[_0x34a8('0x17')]['create'](_0x40333b[_0x34a8('0x34')],{})['then'](respondWithResult(_0x5b132b,0xc9))[_0x34a8('0x2f')](handleError(_0x5b132b,null));};exports[_0x34a8('0xd')]=function(_0x25a89b,_0x27208e){if(_0x25a89b[_0x34a8('0x34')]['id']){delete _0x25a89b['body']['id'];}return db[_0x34a8('0x17')][_0x34a8('0x32')]({'where':{'id':_0x25a89b[_0x34a8('0x35')]['id']}})[_0x34a8('0xf')](handleEntityNotFound(_0x27208e,null))[_0x34a8('0xf')](saveUpdates(_0x25a89b['body'],null))[_0x34a8('0xf')](respondWithResult(_0x27208e,null))['catch'](handleError(_0x27208e,null));};exports[_0x34a8('0xe')]=function(_0x20f5f7,_0x122f50){return db[_0x34a8('0x17')][_0x34a8('0x32')]({'where':{'id':_0x20f5f7[_0x34a8('0x35')]['id']}})[_0x34a8('0xf')](handleEntityNotFound(_0x122f50,null))[_0x34a8('0xf')](removeEntity(_0x122f50,null))[_0x34a8('0x2f')](handleError(_0x122f50,null));};exports['getConfigurations']=function(_0x4e3228,_0x308cdc){var _0xbcef93={};var _0x8fef24={};var _0x290ae6;var _0x260105;return db[_0x34a8('0x17')][_0x34a8('0x36')]({'where':{'id':_0x4e3228['params']['id']}})['then'](handleEntityNotFound(_0x308cdc,null))[_0x34a8('0xf')](function(_0x58ade2){if(_0x58ade2){_0x290ae6=_0x58ade2;_0x8fef24[_0x34a8('0x1c')]=_['keys'](db['Dynamics365Configuration'][_0x34a8('0x18')]);_0x8fef24['query']=_[_0x34a8('0x1e')](_0x4e3228[_0x34a8('0x1d')]);_0x8fef24[_0x34a8('0x1f')]=_[_0x34a8('0x31')](_0x8fef24[_0x34a8('0x1c')],_0x8fef24[_0x34a8('0x1d')]);_0xbcef93[_0x34a8('0x20')]=_[_0x34a8('0x31')](_0x8fef24[_0x34a8('0x1c')],qs[_0x34a8('0x21')](_0x4e3228['query'][_0x34a8('0x21')]));_0xbcef93['attributes']=_0xbcef93[_0x34a8('0x20')]['length']?_0xbcef93[_0x34a8('0x20')]:_0x8fef24[_0x34a8('0x1c')];_0xbcef93[_0x34a8('0x25')]=qs[_0x34a8('0x26')](_0x4e3228[_0x34a8('0x1d')][_0x34a8('0x26')]);_0xbcef93[_0x34a8('0x27')]=qs[_0x34a8('0x1f')](_[_0x34a8('0x28')](_0x4e3228[_0x34a8('0x1d')],_0x8fef24[_0x34a8('0x1f')]));if(_0x4e3228[_0x34a8('0x1d')]['filter']){_0xbcef93['where']=_[_0x34a8('0x2b')](_0xbcef93[_0x34a8('0x27')],{'$or':_[_0x34a8('0x16')](_0xbcef93['attributes'],function(_0x19bed6){var _0x384525={};_0x384525[_0x19bed6]={'$like':'%'+_0x4e3228[_0x34a8('0x1d')][_0x34a8('0x29')]+'%'};return _0x384525;})});}_0xbcef93=_['merge']({},_0xbcef93,_0x4e3228[_0x34a8('0x37')]);return _0x290ae6[_0x34a8('0x38')](_0xbcef93);}})[_0x34a8('0xf')](function(_0x15e9e5){if(_0x15e9e5){_0x260105=_0x15e9e5[_0x34a8('0x22')];if(!_0x4e3228['query']['hasOwnProperty'](_0x34a8('0x24'))){_0xbcef93[_0x34a8('0x8')]=qs[_0x34a8('0x8')](_0x4e3228[_0x34a8('0x1d')][_0x34a8('0x8')]);_0xbcef93['offset']=qs[_0x34a8('0xa')](_0x4e3228[_0x34a8('0x1d')][_0x34a8('0xa')]);}return _0x290ae6[_0x34a8('0x38')](_0xbcef93);}})[_0x34a8('0xf')](function(_0x5a0fba){if(_0x5a0fba){return _0x5a0fba?{'count':_0x260105,'rows':_0x5a0fba}:null;}})[_0x34a8('0xf')](respondWithResult(_0x308cdc,null))['catch'](handleError(_0x308cdc,null));};exports[_0x34a8('0x39')]=function(_0x44b1f1,_0xe5dadd){if(_0x44b1f1[_0x34a8('0x34')]['id']){delete _0x44b1f1[_0x34a8('0x34')]['id'];}return db[_0x34a8('0x17')]['findOne']({'where':{'id':_0x44b1f1['params']['id']}})['then'](handleEntityNotFound(_0xe5dadd,null))[_0x34a8('0xf')](function(_0xe42465){if(_0xe42465){_0x44b1f1[_0x34a8('0x34')][_0x34a8('0x3a')]=_0xe42465['id'];_0x44b1f1['body'][_0x34a8('0x3b')]=integrations[_0x34a8('0x3c')](_0x44b1f1[_0x34a8('0x34')][_0x34a8('0x3d')],_0x44b1f1['body']['type']);_0x44b1f1[_0x34a8('0x34')][_0x34a8('0x3e')]=integrations[_0x34a8('0x3f')](_0x44b1f1[_0x34a8('0x34')]['channel'],_0x44b1f1[_0x34a8('0x34')][_0x34a8('0x1a')]);return db['Dynamics365Configuration']['create'](_0x44b1f1['body'],{'include':[{'model':db[_0x34a8('0x40')],'as':_0x34a8('0x3b')},{'model':db[_0x34a8('0x40')],'as':_0x34a8('0x3e')}]});}return null;})['then'](respondWithResult(_0xe5dadd,null))[_0x34a8('0x2f')](handleError(_0xe5dadd,null));};function sanitizeRemoteUri(_0x4e3c33){var _0x174dad=_0x4e3c33[_0x34a8('0x41')](-0x1);if(_0x174dad==='/')return _0x4e3c33[_0x34a8('0x42')](0x0,_0x4e3c33[_0x34a8('0x43')](_0x174dad));return _0x4e3c33;}function getWebApiUrl(_0x46ebe0){return util['format'](_0x34a8('0x44'),_0x46ebe0);}exports[_0x34a8('0x45')]=function(_0x5a6655,_0x51dc5c){var _0x561365=_0x5a6655[_0x34a8('0x1d')][_0x34a8('0x46')];var _0x383c83=_0x561365===_0x34a8('0x47')?_0x34a8('0x48'):_0x34a8('0x49');var _0x21ca6d='';var _0x1f8c9e='';var _0x27b5b8='';var _0x585eb2='';var _0x30c295='';var _0x2dc7ff='';var _0x1da3f1='';var _0xbda619='';var _0x11009c=[_0x34a8('0x4a'),_0x34a8('0x4b'),'customerid','ownerid',_0x34a8('0x4c'),_0x34a8('0x4d'),_0x34a8('0x4e'),_0x34a8('0x4f'),_0x34a8('0x50'),_0x34a8('0x51')];var _0x3f9f3c=[_0x34a8('0x52'),'accountidyominame',_0x34a8('0x53'),'billedserviceunits',_0x34a8('0x54'),'contactidyominame','contractdetailidname','contractidname',_0x34a8('0x55'),_0x34a8('0x56'),_0x34a8('0x57'),_0x34a8('0x58'),_0x34a8('0x59'),_0x34a8('0x5a'),_0x34a8('0x5b'),_0x34a8('0x5c'),'customeridtype','customeridyominame',_0x34a8('0x5d'),'entitlementidname',_0x34a8('0x5e'),_0x34a8('0x5f'),_0x34a8('0x60'),_0x34a8('0x61'),_0x34a8('0x62'),'followupby',_0x34a8('0x63'),_0x34a8('0x64'),_0x34a8('0x65'),_0x34a8('0x66'),_0x34a8('0x67'),_0x34a8('0x68'),_0x34a8('0x69'),_0x34a8('0x6a'),'modifiedbyyominame','modifiedon',_0x34a8('0x6b'),_0x34a8('0x6c'),_0x34a8('0x6d'),_0x34a8('0x6e'),_0x34a8('0x6f'),_0x34a8('0x70'),_0x34a8('0x71'),_0x34a8('0x72'),'owneridtype',_0x34a8('0x73'),_0x34a8('0x74'),_0x34a8('0x75'),_0x34a8('0x76'),'prioritycodename',_0x34a8('0x77'),_0x34a8('0x78'),_0x34a8('0x79'),'resolvebykpiidname','responseby','responsiblecontactidname',_0x34a8('0x7a'),_0x34a8('0x7b'),'slainvokedidname',_0x34a8('0x7c'),'socialprofileidname',_0x34a8('0x7d'),'statuscode','subjectidname',_0x34a8('0x7e'),_0x34a8('0x7f'),_0x34a8('0x80'),'traversedpath',_0x34a8('0x81'),_0x34a8('0x82')];var _0x5be400=_0x11009c[_0x34a8('0x83')](_0x3f9f3c);return db[_0x34a8('0x17')][_0x34a8('0x36')]({'where':{'id':_0x5a6655['params']['id']},'attributes':['id','username',_0x34a8('0x84'),_0x34a8('0x85'),'tenantId',_0x34a8('0x86'),'clientSecret',_0x34a8('0x87')],'include':[{'model':db[_0x34a8('0x88')],'as':_0x34a8('0x88'),'attributes':['id','data5',_0x34a8('0x89')]}]})[_0x34a8('0xf')](handleEntityNotFound(_0x51dc5c,null))['then'](function(_0x1ab01b){if(_0x1ab01b){if(_0x1ab01b[_0x34a8('0x87')]){_0x1ab01b[_0x34a8('0x8a')]=_0x1ab01b[_0x34a8('0x88')][_0x34a8('0x8b')];_0xbda619=sanitizeRemoteUri(_0x1ab01b[_0x34a8('0x88')][_0x34a8('0x89')]);_0x1da3f1=getWebApiUrl(_0xbda619);return _0x1ab01b;}_0xbda619=sanitizeRemoteUri(_0x1ab01b[_0x34a8('0x85')]);_0x1da3f1=getWebApiUrl(_0xbda619);var _0x327402={'method':_0x34a8('0x8c'),'uri':_0x34a8('0x8d')+_0x1ab01b[_0x34a8('0x8e')]+'/oauth2/token','form':{'client_id':_0x1ab01b[_0x34a8('0x86')],'resource':_0xbda619,'username':_0x1ab01b[_0x34a8('0x8f')],'password':_0x1ab01b[_0x34a8('0x84')],'grant_type':_0x34a8('0x84'),'client_secret':_0x1ab01b[_0x34a8('0x90')]},'json':!![]};return rp(_0x327402);}})[_0x34a8('0xf')](function(_0x3b10e3){_0x2dc7ff=_0x3b10e3[_0x34a8('0x8a')];var _0x4b0deb={'method':_0x34a8('0x91'),'uri':encodeURI(_0x1da3f1+_0x34a8('0x92')+_0x383c83+'\x27'),'headers':{'Authorization':_0x34a8('0x93')+_0x2dc7ff,'If-None-Match':null,'OData-Version':_0x34a8('0x94')},'json':!![]};return rp(_0x4b0deb);})[_0x34a8('0xf')](function(_0x8d7a9a){var _0x143f63=_0x8d7a9a[_0x34a8('0x95')][0x0];var _0x5bde82=_0x143f63[_0x34a8('0x96')];var _0x28f478={'method':_0x34a8('0x91'),'uri':_0x1da3f1+'EntityDefinitions('+_0x5bde82+_0x34a8('0x97'),'headers':{'Authorization':'Bearer\x20'+_0x2dc7ff,'If-None-Match':null,'OData-Version':_0x34a8('0x94')},'json':!![]};return rp(_0x28f478);})[_0x34a8('0xf')](function(_0x1f79d9){_0x21ca6d=_0x1f79d9;_0x1f8c9e=_0x21ca6d[_0x34a8('0x98')];_0x1f8c9e=_[_0x34a8('0x99')](_0x1f8c9e,function(_0xc4d8ed){return!_0x5be400[_0x34a8('0x9a')](_0xc4d8ed[_0x34a8('0x9b')]);});var _0x79ca37=[];var _0x4d8512=[];_0x1f8c9e[_0x34a8('0x9c')](function(_0x3afd9a){if(_0x3afd9a[_0x34a8('0x9d')]){var _0x1b7383=_0x3afd9a[_0x34a8('0x9d')][_0x34a8('0x42')](_0x3afd9a[_0x34a8('0x9d')][_0x34a8('0x43')]('.')+0x1);if(_0x1b7383===_0x34a8('0x9e')){_0x79ca37['push'](getSelectList(_0x1da3f1,_0x561365,_0x4d8512,_0x21ca6d[_0x34a8('0x96')],_0x3afd9a[_0x34a8('0x96')],_0x2dc7ff));}}});return Promise['all'](_0x79ca37);})['then'](function(_0x493309){_0x27b5b8=_0x493309[0x0];var _0x3a71d4=[];var _0x3f3e4d=[];_0x1f8c9e[_0x34a8('0x9c')](function(_0x26cdb5){if(!_[_0x34a8('0x9f')](_0x26cdb5[_0x34a8('0x9d')])){var _0x42b194=_0x26cdb5['@odata.type'][_0x34a8('0x42')](_0x26cdb5[_0x34a8('0x9d')][_0x34a8('0x43')]('.')+0x1);if(_0x42b194===_0x34a8('0xa0')){_0x3a71d4[_0x34a8('0xa1')](getBooleanList(_0x1da3f1,_0x561365,_0x3f3e4d,_0x21ca6d['MetadataId'],_0x26cdb5[_0x34a8('0x96')],_0x2dc7ff));}}});return Promise[_0x34a8('0xa2')](_0x3a71d4);})[_0x34a8('0xf')](function(_0x2ebb94){_0x585eb2=_0x2ebb94[0x0];var _0x3bb814=[];var _0x19fc6d=[];_0x1f8c9e[_0x34a8('0x9c')](function(_0x24e3dd){if(_0x24e3dd[_0x34a8('0x9d')]){var _0x4ceac9=_0x24e3dd[_0x34a8('0x9d')]['substring'](_0x24e3dd[_0x34a8('0x9d')]['lastIndexOf']('.')+0x1);if(_0x4ceac9==='StringAttributeMetadata'||_0x4ceac9===_0x34a8('0xa3')||_0x4ceac9===_0x34a8('0xa4')||_0x4ceac9===_0x34a8('0xa5')||_0x4ceac9===_0x34a8('0xa6')||_0x4ceac9===_0x34a8('0xa7')||_0x4ceac9==='StatusAttributeMetadata'||_0x4ceac9===_0x34a8('0xa8')||_0x4ceac9===_0x34a8('0xa9')||_0x4ceac9===_0x34a8('0xaa')){_0x3bb814[_0x34a8('0xa1')](getInputList(_0x1da3f1,_0x561365,_0x4ceac9,_0x19fc6d,_0x21ca6d['MetadataId'],_0x24e3dd['MetadataId'],_0x2dc7ff));}}});return Promise['all'](_0x3bb814);})[_0x34a8('0xf')](function(_0x42499f){_0x30c295=_0x42499f[0x0];var _0x55ef62=_0x27b5b8[_0x34a8('0x83')](_0x585eb2)[_0x34a8('0x83')](_0x30c295);var _0x4f9310={'count':_0x55ef62['length'],'rows':_0x55ef62};return _0x4f9310;})[_0x34a8('0xf')](respondWithResult(_0x51dc5c,null))['catch'](function(_0x53d562){var _0x5c954e=_0x5a6655[_0x34a8('0x1d')][_0x34a8('0xab')]?0x1f4:_0x53d562[_0x34a8('0xac')]||0x1f4;logger[_0x34a8('0x12')](_0x53d562[_0x34a8('0x13')]);delete _0x53d562[_0x34a8('0x14')];if(_0x5c954e===0x191){_0x5c954e=0x190;}_0x51dc5c['status'](_0x5c954e)[_0x34a8('0x15')](_0x5a6655['query'][_0x34a8('0xab')]?{'message':_0x34a8('0xad'),'statusCode':_0x53d562[_0x34a8('0xac')]}:_0x53d562);});};function getSelectList(_0x2a4621,_0x1f0189,_0x1ca96a,_0xd32af0,_0x3d8db2,_0x1a2e1b){var _0xa74f2={'method':_0x34a8('0x91'),'uri':_0x2a4621+_0x34a8('0xae')+_0xd32af0+_0x34a8('0xaf')+_0x3d8db2+_0x34a8('0xb0')+_0x34a8('0xb1'),'headers':{'Authorization':_0x34a8('0x93')+_0x1a2e1b,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xa74f2)[_0x34a8('0xf')](function(_0x5e9132){var _0x5c5a8c=[];var _0x3166d1=_0x5e9132['OptionSet'][_0x34a8('0xb2')];_0x3166d1[_0x34a8('0x9c')](function(_0x12808c){_0x5c5a8c[_0x34a8('0xa1')]({'name':_0x12808c[_0x34a8('0xb3')][_0x34a8('0xb4')]['Label'],'value':String(_0x12808c['Value'])});});var _0x3a2102={'id':_0x1f0189+'_'+_0x5e9132[_0x34a8('0x9b')],'name':_0x5e9132['DisplayName'][_0x34a8('0xb4')][_0x34a8('0xb3')],'custom':![],'options':_0x5c5a8c};_0x1ca96a[_0x34a8('0xa1')](_0x3a2102);return _0x1ca96a;});}function getBooleanList(_0x1057bf,_0x32e8ef,_0x5a3d15,_0x2924d3,_0x3f0084,_0x2d2ee8){var _0x5288c0={'method':_0x34a8('0x91'),'uri':_0x1057bf+'EntityDefinitions('+_0x2924d3+_0x34a8('0xaf')+_0x3f0084+_0x34a8('0xb5'),'headers':{'Authorization':'Bearer\x20'+_0x2d2ee8,'If-None-Match':null,'OData-Version':_0x34a8('0x94')},'json':!![]};return rp(_0x5288c0)[_0x34a8('0xf')](function(_0x4db6ff){var _0x856b5d=[];_0x856b5d[_0x34a8('0xa1')]({'name':_0x4db6ff[_0x34a8('0xb6')][_0x34a8('0xb7')]['Label'][_0x34a8('0xb4')]['Label'],'value':_0x34a8('0xb8')},{'name':_0x4db6ff[_0x34a8('0xb6')][_0x34a8('0xb9')]['Label'][_0x34a8('0xb4')]['Label'],'value':_0x34a8('0xba')});var _0xf7e71e={'id':_0x32e8ef+'_'+_0x4db6ff[_0x34a8('0x9b')],'name':_0x4db6ff['DisplayName']['UserLocalizedLabel'][_0x34a8('0xb3')],'custom':![],'options':_0x856b5d};_0x5a3d15[_0x34a8('0xa1')](_0xf7e71e);return _0x5a3d15;});}function getInputList(_0x234f49,_0x4df97c,_0x5a8e39,_0x215cd3,_0x325c54,_0x2d0682,_0x32117f){var _0x62c467={'method':'GET','uri':_0x234f49+'EntityDefinitions('+_0x325c54+_0x34a8('0xaf')+_0x2d0682+')/Microsoft.Dynamics.CRM.'+_0x5a8e39+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x34a8('0x93')+_0x32117f,'If-None-Match':null,'OData-Version':_0x34a8('0x94')},'json':!![]};return rp(_0x62c467)[_0x34a8('0xf')](function(_0x5e6120){var _0x2970ab={'id':_0x4df97c+'_'+_0x5e6120['LogicalName'],'name':_0x5e6120['DisplayName'][_0x34a8('0xb4')]?_0x5e6120[_0x34a8('0xbb')][_0x34a8('0xb4')]['Label']:_0x5e6120[_0x34a8('0x9b')],'custom':![],'options':[]};_0x215cd3[_0x34a8('0xa1')](_0x2970ab);return _0x215cd3;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index b8e5040..745f53e 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(_0x3e5d78,_0x7b823f){var _0x22ced5=function(_0x283b15){while(--_0x283b15){_0x3e5d78['push'](_0x3e5d78['shift']());}};_0x22ced5(++_0x7b823f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));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 _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x28ec9a,_0x556c05){var _0x454b7c=function(_0x5b5bb7){while(--_0x5b5bb7){_0x28ec9a['push'](_0x28ec9a['shift']());}};_0x454b7c(++_0x556c05);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xb7e7[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x333fa4,_0x372bde){return _0x333fa4[_0x7b7e('0x7')]('Dynamics365Account',attributes,{'tableName':_0x7b7e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 1521307..3063eb5 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 _0x80f8=['message','info','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','map','include','model','then','ShowDynamics365Account','find','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s'];(function(_0x550dc1,_0x354d20){var _0x1bed6c=function(_0x4d9980){while(--_0x4d9980){_0x550dc1['push'](_0x550dc1['shift']());}};_0x1bed6c(++_0x354d20);}(_0x80f8,0x1aa));var _0x880f=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x80f8[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require(_0x880f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x880f('0x1'));var db=require(_0x880f('0x2'))['db'];var utils=require(_0x880f('0x3'));var logger=require(_0x880f('0x4'))(_0x880f('0x5'));var config=require('../../config/environment');var jayson=require(_0x880f('0x6'));var client=jayson[_0x880f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf8db0a,_0x83cc4c,_0x406704){return new BPromise(function(_0x4c081e,_0x202c38){return client[_0x880f('0x8')](_0xf8db0a,_0x406704)['then'](function(_0x31357f){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x83cc4c,_0x880f('0x9'));logger[_0x880f('0xa')](_0x880f('0xb'),_0x83cc4c,_0x880f('0x9'),JSON[_0x880f('0xc')](_0x31357f));if(_0x31357f['error']){if(_0x31357f[_0x880f('0xd')][_0x880f('0xe')]===0x1f4){logger[_0x880f('0xd')](_0x880f('0xf'),_0x83cc4c,_0x31357f[_0x880f('0xd')][_0x880f('0x10')]);return _0x202c38(_0x31357f[_0x880f('0xd')][_0x880f('0x10')]);}logger[_0x880f('0xd')](_0x880f('0xf'),_0x83cc4c,_0x31357f[_0x880f('0xd')]['message']);return _0x4c081e(_0x31357f[_0x880f('0xd')]['message']);}else{logger[_0x880f('0x11')](_0x880f('0xf'),_0x83cc4c,'request\x20sent');_0x4c081e(_0x31357f[_0x880f('0x12')][_0x880f('0x10')]);}})[_0x880f('0x13')](function(_0x9e23ab){logger[_0x880f('0xd')](_0x880f('0xf'),_0x83cc4c,_0x9e23ab);_0x202c38(_0x9e23ab);});});}exports[_0x880f('0x14')]=function(_0x32c4cf){var _0x5cb260=this;return new Promise(function(_0x5a00a6,_0xd82912){return db[_0x880f('0x15')][_0x880f('0x16')]({'raw':_0x32c4cf[_0x880f('0x17')]?_0x32c4cf[_0x880f('0x17')][_0x880f('0x18')]===undefined?!![]:![]:!![],'where':_0x32c4cf[_0x880f('0x17')]?_0x32c4cf['options'][_0x880f('0x19')]||null:null,'attributes':_0x32c4cf[_0x880f('0x17')]?_0x32c4cf[_0x880f('0x17')][_0x880f('0x1a')]||null:null,'limit':_0x32c4cf['options']?_0x32c4cf[_0x880f('0x17')][_0x880f('0x1b')]||null:null,'include':_0x32c4cf[_0x880f('0x17')]?_0x32c4cf['options']['include']?_[_0x880f('0x1c')](_0x32c4cf[_0x880f('0x17')][_0x880f('0x1d')],function(_0xbb70c7){return{'model':db[_0xbb70c7['model']],'as':_0xbb70c7['as'],'attributes':_0xbb70c7[_0x880f('0x1a')],'include':_0xbb70c7[_0x880f('0x1d')]?_['map'](_0xbb70c7[_0x880f('0x1d')],function(_0x535ca3){return{'model':db[_0x535ca3['model']],'as':_0x535ca3['as'],'attributes':_0x535ca3['attributes'],'include':_0x535ca3['include']?_[_0x880f('0x1c')](_0x535ca3['include'],function(_0x138a01){return{'model':db[_0x138a01[_0x880f('0x1e')]],'as':_0x138a01['as'],'attributes':_0x138a01[_0x880f('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x880f('0x1f')](function(_0x2321f2){logger[_0x880f('0x11')](_0x880f('0x14'),_0x32c4cf);logger[_0x880f('0xa')](_0x880f('0x14'),_0x32c4cf,JSON['stringify'](_0x2321f2));_0x5a00a6(_0x2321f2);})[_0x880f('0x13')](function(_0x10238b){logger[_0x880f('0xd')](_0x880f('0x14'),_0x10238b[_0x880f('0x10')],_0x32c4cf);_0xd82912(_0x5cb260[_0x880f('0xd')](0x1f4,_0x10238b[_0x880f('0x10')]));});});};exports[_0x880f('0x20')]=function(_0x1abf6b){var _0x54645e=this;return new Promise(function(_0x494d61,_0x465455){return db[_0x880f('0x15')][_0x880f('0x21')]({'raw':_0x1abf6b[_0x880f('0x17')]?_0x1abf6b[_0x880f('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1abf6b['options']?_0x1abf6b[_0x880f('0x17')][_0x880f('0x19')]||null:null,'attributes':_0x1abf6b['options']?_0x1abf6b[_0x880f('0x17')][_0x880f('0x1a')]||null:null,'include':_0x1abf6b[_0x880f('0x17')]?_0x1abf6b['options'][_0x880f('0x1d')]?_[_0x880f('0x1c')](_0x1abf6b['options'][_0x880f('0x1d')],function(_0xaf907){return{'model':db[_0xaf907['model']],'as':_0xaf907['as'],'attributes':_0xaf907[_0x880f('0x1a')],'include':_0xaf907[_0x880f('0x1d')]?_[_0x880f('0x1c')](_0xaf907['include'],function(_0x42d4e6){return{'model':db[_0x42d4e6[_0x880f('0x1e')]],'as':_0x42d4e6['as'],'attributes':_0x42d4e6['attributes'],'include':_0x42d4e6[_0x880f('0x1d')]?_[_0x880f('0x1c')](_0x42d4e6['include'],function(_0x4e8ab7){return{'model':db[_0x4e8ab7[_0x880f('0x1e')]],'as':_0x4e8ab7['as'],'attributes':_0x4e8ab7[_0x880f('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x880f('0x1f')](function(_0x5f1e8d){logger[_0x880f('0x11')](_0x880f('0x20'),_0x1abf6b);logger[_0x880f('0xa')](_0x880f('0x20'),_0x1abf6b,JSON[_0x880f('0xc')](_0x5f1e8d));_0x494d61(_0x5f1e8d);})[_0x880f('0x13')](function(_0x1ee05e){logger[_0x880f('0xd')]('ShowDynamics365Account',_0x1ee05e[_0x880f('0x10')],_0x1abf6b);_0x465455(_0x54645e[_0x880f('0xd')](0x1f4,_0x1ee05e['message']));});});}; \ No newline at end of file +var _0x587f=['attributes','map','info','ShowDynamics365Account','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','limit','include','model'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x587f,0xca));var _0xf587=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x587f[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0xf587('0x0'));var util=require(_0xf587('0x1'));var moment=require(_0xf587('0x2'));var BPromise=require(_0xf587('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf587('0x4'));var db=require(_0xf587('0x5'))['db'];var utils=require(_0xf587('0x6'));var logger=require('../../config/logger')(_0xf587('0x7'));var config=require(_0xf587('0x8'));var jayson=require(_0xf587('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x25799c,_0x4984ba,_0x1c0f9f){return new BPromise(function(_0x59344b,_0x295211){return client[_0xf587('0xa')](_0x25799c,_0x1c0f9f)[_0xf587('0xb')](function(_0x13dfd1){logger['info'](_0xf587('0xc'),_0x4984ba,_0xf587('0xd'));logger[_0xf587('0xe')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x4984ba,_0xf587('0xd'),JSON[_0xf587('0xf')](_0x13dfd1));if(_0x13dfd1[_0xf587('0x10')]){if(_0x13dfd1[_0xf587('0x10')][_0xf587('0x11')]===0x1f4){logger['error'](_0xf587('0xc'),_0x4984ba,_0x13dfd1[_0xf587('0x10')][_0xf587('0x12')]);return _0x295211(_0x13dfd1[_0xf587('0x10')][_0xf587('0x12')]);}logger[_0xf587('0x10')](_0xf587('0xc'),_0x4984ba,_0x13dfd1[_0xf587('0x10')][_0xf587('0x12')]);return _0x59344b(_0x13dfd1['error'][_0xf587('0x12')]);}else{logger['info'](_0xf587('0xc'),_0x4984ba,_0xf587('0xd'));_0x59344b(_0x13dfd1['result'][_0xf587('0x12')]);}})[_0xf587('0x13')](function(_0x336010){logger[_0xf587('0x10')](_0xf587('0xc'),_0x4984ba,_0x336010);_0x295211(_0x336010);});});}exports[_0xf587('0x14')]=function(_0x3d87b5){var _0x51475a=this;return new Promise(function(_0x15b0dc,_0x2879b6){return db[_0xf587('0x15')][_0xf587('0x16')]({'raw':_0x3d87b5[_0xf587('0x17')]?_0x3d87b5[_0xf587('0x17')][_0xf587('0x18')]===undefined?!![]:![]:!![],'where':_0x3d87b5[_0xf587('0x17')]?_0x3d87b5[_0xf587('0x17')][_0xf587('0x19')]||null:null,'attributes':_0x3d87b5[_0xf587('0x17')]?_0x3d87b5['options']['attributes']||null:null,'limit':_0x3d87b5['options']?_0x3d87b5['options'][_0xf587('0x1a')]||null:null,'include':_0x3d87b5['options']?_0x3d87b5[_0xf587('0x17')][_0xf587('0x1b')]?_['map'](_0x3d87b5[_0xf587('0x17')][_0xf587('0x1b')],function(_0x2c296f){return{'model':db[_0x2c296f[_0xf587('0x1c')]],'as':_0x2c296f['as'],'attributes':_0x2c296f[_0xf587('0x1d')],'include':_0x2c296f[_0xf587('0x1b')]?_[_0xf587('0x1e')](_0x2c296f['include'],function(_0x1023a6){return{'model':db[_0x1023a6[_0xf587('0x1c')]],'as':_0x1023a6['as'],'attributes':_0x1023a6['attributes'],'include':_0x1023a6[_0xf587('0x1b')]?_[_0xf587('0x1e')](_0x1023a6['include'],function(_0x67cb5d){return{'model':db[_0x67cb5d[_0xf587('0x1c')]],'as':_0x67cb5d['as'],'attributes':_0x67cb5d[_0xf587('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf587('0xb')](function(_0x21e151){logger[_0xf587('0x1f')]('GetDynamics365Account',_0x3d87b5);logger[_0xf587('0xe')]('GetDynamics365Account',_0x3d87b5,JSON['stringify'](_0x21e151));_0x15b0dc(_0x21e151);})[_0xf587('0x13')](function(_0x469328){logger['error'](_0xf587('0x14'),_0x469328['message'],_0x3d87b5);_0x2879b6(_0x51475a[_0xf587('0x10')](0x1f4,_0x469328[_0xf587('0x12')]));});});};exports['ShowDynamics365Account']=function(_0x5196c1){var _0x606935=this;return new Promise(function(_0x93ca06,_0xec762c){return db[_0xf587('0x15')]['find']({'raw':_0x5196c1['options']?_0x5196c1[_0xf587('0x17')][_0xf587('0x18')]===undefined?!![]:![]:!![],'where':_0x5196c1[_0xf587('0x17')]?_0x5196c1[_0xf587('0x17')][_0xf587('0x19')]||null:null,'attributes':_0x5196c1[_0xf587('0x17')]?_0x5196c1['options'][_0xf587('0x1d')]||null:null,'include':_0x5196c1[_0xf587('0x17')]?_0x5196c1[_0xf587('0x17')][_0xf587('0x1b')]?_[_0xf587('0x1e')](_0x5196c1[_0xf587('0x17')]['include'],function(_0x223c65){return{'model':db[_0x223c65[_0xf587('0x1c')]],'as':_0x223c65['as'],'attributes':_0x223c65[_0xf587('0x1d')],'include':_0x223c65['include']?_[_0xf587('0x1e')](_0x223c65[_0xf587('0x1b')],function(_0x263212){return{'model':db[_0x263212['model']],'as':_0x263212['as'],'attributes':_0x263212[_0xf587('0x1d')],'include':_0x263212[_0xf587('0x1b')]?_['map'](_0x263212[_0xf587('0x1b')],function(_0x564d83){return{'model':db[_0x564d83[_0xf587('0x1c')]],'as':_0x564d83['as'],'attributes':_0x564d83['attributes']};}):[]};}):[]};}):[]:[]})[_0xf587('0xb')](function(_0x5c96a3){logger['info']('ShowDynamics365Account',_0x5196c1);logger[_0xf587('0xe')](_0xf587('0x20'),_0x5196c1,JSON[_0xf587('0xf')](_0x5c96a3));_0x93ca06(_0x5c96a3);})[_0xf587('0x13')](function(_0x6d5014){logger[_0xf587('0x10')](_0xf587('0x20'),_0x6d5014['message'],_0x5196c1);_0xec762c(_0x606935['error'](0x1f4,_0x6d5014[_0xf587('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 209117f..64555d0 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 _0x8b09=['getFields','/:id/subjects','getDescriptions','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id'];(function(_0x4f3e4a,_0x6d741d){var _0x2e9202=function(_0xe380){while(--_0xe380){_0x4f3e4a['push'](_0x4f3e4a['shift']());}};_0x2e9202(++_0x6d741d);}(_0x8b09,0x153));var _0x98b0=function(_0x67fda8,_0x3a15c0){_0x67fda8=_0x67fda8-0x0;var _0x46569b=_0x8b09[_0x67fda8];return _0x46569b;};'use strict';var multer=require(_0x98b0('0x0'));var util=require(_0x98b0('0x1'));var path=require(_0x98b0('0x2'));var timeout=require(_0x98b0('0x3'));var express=require(_0x98b0('0x4'));var router=express[_0x98b0('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x98b0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x98b0('0x7'));var controller=require(_0x98b0('0x8'));router[_0x98b0('0x9')]('/',auth[_0x98b0('0xa')](),controller[_0x98b0('0xb')]);router[_0x98b0('0x9')](_0x98b0('0xc'),auth[_0x98b0('0xa')](),controller['show']);router[_0x98b0('0x9')]('/:id/fields',auth[_0x98b0('0xa')](),controller[_0x98b0('0xd')]);router[_0x98b0('0x9')](_0x98b0('0xe'),auth[_0x98b0('0xa')](),controller['getSubjects']);router[_0x98b0('0x9')]('/:id/descriptions',auth[_0x98b0('0xa')](),controller[_0x98b0('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x98b0('0x10')]);router[_0x98b0('0x11')](_0x98b0('0xc'),auth[_0x98b0('0xa')](),controller[_0x98b0('0x12')]);router[_0x98b0('0x13')](_0x98b0('0xc'),auth[_0x98b0('0xa')](),controller[_0x98b0('0x14')]);module[_0x98b0('0x15')]=router; \ No newline at end of file +var _0x33b4=['show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','/:id','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index'];(function(_0x4b01de,_0x58cd37){var _0x35b191=function(_0x5046ae){while(--_0x5046ae){_0x4b01de['push'](_0x4b01de['shift']());}};_0x35b191(++_0x58cd37);}(_0x33b4,0x160));var _0x433b=function(_0x46a137,_0x3be24d){_0x46a137=_0x46a137-0x0;var _0xbcba75=_0x33b4[_0x46a137];return _0xbcba75;};'use strict';var multer=require('multer');var util=require(_0x433b('0x0'));var path=require('path');var timeout=require(_0x433b('0x1'));var express=require(_0x433b('0x2'));var router=express[_0x433b('0x3')]();var fs_extra=require(_0x433b('0x4'));var auth=require(_0x433b('0x5'));var interaction=require(_0x433b('0x6'));var config=require(_0x433b('0x7'));var controller=require(_0x433b('0x8'));router[_0x433b('0x9')]('/',auth[_0x433b('0xa')](),controller[_0x433b('0xb')]);router[_0x433b('0x9')]('/:id',auth[_0x433b('0xa')](),controller[_0x433b('0xc')]);router['get'](_0x433b('0xd'),auth['isAuthenticated'](),controller[_0x433b('0xe')]);router[_0x433b('0x9')](_0x433b('0xf'),auth[_0x433b('0xa')](),controller[_0x433b('0x10')]);router[_0x433b('0x9')](_0x433b('0x11'),auth[_0x433b('0xa')](),controller[_0x433b('0x12')]);router[_0x433b('0x13')]('/',auth[_0x433b('0xa')](),controller['create']);router[_0x433b('0x14')](_0x433b('0x15'),auth['isAuthenticated'](),controller[_0x433b('0x16')]);router[_0x433b('0x17')](_0x433b('0x15'),auth[_0x433b('0xa')](),controller[_0x433b('0x18')]);module[_0x433b('0x19')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 3e37e8d..cc3dc18 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 _0xc288=['nothing','sequelize','exports','STRING','ENUM','incident','phonecall','contact'];(function(_0x36a94f,_0x3fcc6c){var _0x4ba69f=function(_0x362371){while(--_0x362371){_0x36a94f['push'](_0x36a94f['shift']());}};_0x4ba69f(++_0x3fcc6c);}(_0xc288,0xa9));var _0x8c28=function(_0x4d6739,_0x1457da){_0x4d6739=_0x4d6739-0x0;var _0x1d8aa2=_0xc288[_0x4d6739];return _0x1d8aa2;};'use strict';var Sequelize=require(_0x8c28('0x0'));module[_0x8c28('0x1')]={'name':{'type':Sequelize[_0x8c28('0x2')]},'description':{'type':Sequelize[_0x8c28('0x2')]},'ticketType':{'type':Sequelize[_0x8c28('0x3')](_0x8c28('0x4'),_0x8c28('0x5')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0x8c28('0x3')](_0x8c28('0x6'),_0x8c28('0x7')),'defaultValue':_0x8c28('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x8c28('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x6792=['BOOLEAN','STRING','phonecall','ENUM','contact'];(function(_0x4c65d4,_0x5cc7ae){var _0x5341b9=function(_0x2c5e18){while(--_0x2c5e18){_0x4c65d4['push'](_0x4c65d4['shift']());}};_0x5341b9(++_0x5cc7ae);}(_0x6792,0x1a0));var _0x2679=function(_0x5e37f5,_0xf1f51f){_0x5e37f5=_0x5e37f5-0x0;var _0x14d059=_0x6792[_0x5e37f5];return _0x14d059;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2679('0x0')]},'ticketType':{'type':Sequelize['ENUM']('incident',_0x2679('0x1')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0x2679('0x2')](_0x2679('0x3'),'nothing'),'defaultValue':_0x2679('0x3'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x2679('0x0')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x2679('0x4')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 892a809..dee5318 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 _0x4188=['filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','includeAll','catch','params','rawAttributes','keys','include','find','create','body','getFields','Dynamics365Field','findOne','options','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','moment','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','update','then','destroy','error','stack','name','index','map','Dynamics365Configuration','fieldName','type','key','query'];(function(_0xd2c4f9,_0xd778c2){var _0xbb64eb=function(_0x31613f){while(--_0x31613f){_0xd2c4f9['push'](_0xd2c4f9['shift']());}};_0xbb64eb(++_0xd778c2);}(_0x4188,0xf5));var _0x8418=function(_0x3772a3,_0x56ba91){_0x3772a3=_0x3772a3-0x0;var _0x370e49=_0x4188[_0x3772a3];return _0x370e49;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8418('0x0'));var zipdir=require(_0x8418('0x1'));var jsonpatch=require(_0x8418('0x2'));var rp=require('request-promise');var moment=require(_0x8418('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x8418('0x4'));var csv=require(_0x8418('0x5'));var ejs=require(_0x8418('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8418('0x7'));var squel=require(_0x8418('0x8'));var crypto=require(_0x8418('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x8418('0xa'));var toCsv=require(_0x8418('0x5'));var querystring=require('querystring');var Papa=require(_0x8418('0xb'));var Redis=require(_0x8418('0xc'));var authService=require(_0x8418('0xd'));var qs=require(_0x8418('0xe'));var as=require(_0x8418('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8418('0x10'))('api');var utils=require(_0x8418('0x11'));var config=require(_0x8418('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52b280,_0x23b283){_0x23b283=_0x23b283||0xcc;return function(_0x2627b2){if(_0x2627b2){return _0x52b280[_0x8418('0x13')](_0x23b283);}return _0x52b280[_0x8418('0x14')](_0x23b283)[_0x8418('0x15')]();};}function respondWithResult(_0x381f83,_0x43d772){_0x43d772=_0x43d772||0xc8;return function(_0x45b3da){if(_0x45b3da){return _0x381f83['status'](_0x43d772)['json'](_0x45b3da);}};}function respondWithFilteredResult(_0x261789,_0x37fb96){return function(_0xdccc91){if(_0xdccc91){var _0xdc2501=typeof _0x37fb96[_0x8418('0x16')]===_0x8418('0x17')&&typeof _0x37fb96[_0x8418('0x18')]==='undefined';var _0x36fbec=_0xdccc91[_0x8418('0x19')];var _0x39e7dc=_0xdc2501?0x0:_0x37fb96[_0x8418('0x16')];var _0x12289a=_0xdc2501?_0xdccc91[_0x8418('0x19')]:_0x37fb96[_0x8418('0x16')]+_0x37fb96[_0x8418('0x18')];var _0x1a8ded;if(_0x12289a>=_0x36fbec){_0x12289a=_0x36fbec;_0x1a8ded=0xc8;}else{_0x1a8ded=0xce;}_0x261789[_0x8418('0x14')](_0x1a8ded);return _0x261789[_0x8418('0x1a')]('Content-Range',_0x39e7dc+'-'+_0x12289a+'/'+_0x36fbec)[_0x8418('0x1b')](_0xdccc91);}return null;};}function patchUpdates(_0x52e613){return function(_0x3e6fcc){try{jsonpatch[_0x8418('0x1c')](_0x3e6fcc,_0x52e613,!![]);}catch(_0x3e6118){return BPromise[_0x8418('0x1d')](_0x3e6118);}return _0x3e6fcc['save']();};}function saveUpdates(_0x36450b,_0x4fe521){return function(_0x26a195){if(_0x26a195){return _0x26a195[_0x8418('0x1e')](_0x36450b)[_0x8418('0x1f')](function(_0x56f0ad){return _0x56f0ad;});}return null;};}function removeEntity(_0x5b139a,_0x1e2aed){return function(_0x4239de){if(_0x4239de){return _0x4239de[_0x8418('0x20')]()[_0x8418('0x1f')](function(){_0x5b139a['status'](0xcc)[_0x8418('0x15')]();});}};}function handleEntityNotFound(_0xde7f0c,_0x2674ec){return function(_0x12b550){if(!_0x12b550){_0xde7f0c[_0x8418('0x13')](0x194);}return _0x12b550;};}function handleError(_0x5016e3,_0x5e9e41){_0x5e9e41=_0x5e9e41||0x1f4;return function(_0x11bfa9){logger[_0x8418('0x21')](_0x11bfa9[_0x8418('0x22')]);if(_0x11bfa9[_0x8418('0x23')]){delete _0x11bfa9[_0x8418('0x23')];}_0x5016e3[_0x8418('0x14')](_0x5e9e41)['send'](_0x11bfa9);};}exports[_0x8418('0x24')]=function(_0x2f9b41,_0x5995e3){var _0x7f0a4f={},_0x48ef31={},_0x2e3110={'count':0x0,'rows':[]};var _0x195e06=_[_0x8418('0x25')](db[_0x8418('0x26')]['rawAttributes'],function(_0x45244e){return{'name':_0x45244e[_0x8418('0x27')],'type':_0x45244e[_0x8418('0x28')][_0x8418('0x29')]};});_0x48ef31['model']=_[_0x8418('0x25')](_0x195e06,_0x8418('0x23'));_0x48ef31[_0x8418('0x2a')]=_['keys'](_0x2f9b41[_0x8418('0x2a')]);_0x48ef31[_0x8418('0x2b')]=_['intersection'](_0x48ef31[_0x8418('0x2c')],_0x48ef31[_0x8418('0x2a')]);_0x7f0a4f[_0x8418('0x2d')]=_[_0x8418('0x2e')](_0x48ef31['model'],qs[_0x8418('0x2f')](_0x2f9b41[_0x8418('0x2a')][_0x8418('0x2f')]));_0x7f0a4f[_0x8418('0x2d')]=_0x7f0a4f[_0x8418('0x2d')][_0x8418('0x30')]?_0x7f0a4f['attributes']:_0x48ef31[_0x8418('0x2c')];if(!_0x2f9b41[_0x8418('0x2a')][_0x8418('0x31')](_0x8418('0x32'))){_0x7f0a4f[_0x8418('0x18')]=qs[_0x8418('0x18')](_0x2f9b41[_0x8418('0x2a')]['limit']);_0x7f0a4f[_0x8418('0x16')]=qs[_0x8418('0x16')](_0x2f9b41[_0x8418('0x2a')][_0x8418('0x16')]);}_0x7f0a4f[_0x8418('0x33')]=qs[_0x8418('0x34')](_0x2f9b41[_0x8418('0x2a')]['sort']);_0x7f0a4f['where']=qs[_0x8418('0x2b')](_[_0x8418('0x35')](_0x2f9b41['query'],_0x48ef31[_0x8418('0x2b')]),_0x195e06);if(_0x2f9b41['query'][_0x8418('0x36')]){_0x7f0a4f[_0x8418('0x37')]=_[_0x8418('0x38')](_0x7f0a4f['where'],{'$or':_['map'](_0x195e06,function(_0x442283){if(_0x442283[_0x8418('0x28')]!=='VIRTUAL'){var _0x11564d={};_0x11564d[_0x442283[_0x8418('0x23')]]={'$like':'%'+_0x2f9b41[_0x8418('0x2a')][_0x8418('0x36')]+'%'};return _0x11564d;}})});}_0x7f0a4f=_[_0x8418('0x38')]({},_0x7f0a4f,_0x2f9b41['options']);var _0x4d06a9={'where':_0x7f0a4f[_0x8418('0x37')]};return db[_0x8418('0x26')][_0x8418('0x19')](_0x4d06a9)[_0x8418('0x1f')](function(_0x4a51f8){_0x2e3110[_0x8418('0x19')]=_0x4a51f8;if(_0x2f9b41[_0x8418('0x2a')][_0x8418('0x39')]){_0x7f0a4f['include']=[{'all':!![]}];}return db[_0x8418('0x26')]['findAll'](_0x7f0a4f);})[_0x8418('0x1f')](function(_0x3f6639){_0x2e3110['rows']=_0x3f6639;return _0x2e3110;})['then'](respondWithFilteredResult(_0x5995e3,_0x7f0a4f))[_0x8418('0x3a')](handleError(_0x5995e3,null));};exports['show']=function(_0x583e85,_0x582013){var _0x3ec25a={'raw':![],'where':{'id':_0x583e85[_0x8418('0x3b')]['id']}},_0x57f23d={};_0x57f23d[_0x8418('0x2c')]=_['keys'](db[_0x8418('0x26')][_0x8418('0x3c')]);_0x57f23d[_0x8418('0x2a')]=_[_0x8418('0x3d')](_0x583e85[_0x8418('0x2a')]);_0x57f23d[_0x8418('0x2b')]=_[_0x8418('0x2e')](_0x57f23d[_0x8418('0x2c')],_0x57f23d['query']);_0x3ec25a[_0x8418('0x2d')]=_[_0x8418('0x2e')](_0x57f23d['model'],qs['fields'](_0x583e85['query'][_0x8418('0x2f')]));_0x3ec25a[_0x8418('0x2d')]=_0x3ec25a[_0x8418('0x2d')][_0x8418('0x30')]?_0x3ec25a[_0x8418('0x2d')]:_0x57f23d['model'];if(_0x583e85[_0x8418('0x2a')][_0x8418('0x39')]){_0x3ec25a[_0x8418('0x3e')]=[{'all':!![]}];}_0x3ec25a=_[_0x8418('0x38')]({},_0x3ec25a,_0x583e85['options']);return db[_0x8418('0x26')][_0x8418('0x3f')](_0x3ec25a)[_0x8418('0x1f')](handleEntityNotFound(_0x582013,null))[_0x8418('0x1f')](respondWithResult(_0x582013,null))[_0x8418('0x3a')](handleError(_0x582013,null));};exports[_0x8418('0x40')]=function(_0x255472,_0x143b1d){return db['Dynamics365Configuration']['create'](_0x255472[_0x8418('0x41')],{})['then'](respondWithResult(_0x143b1d,0xc9))[_0x8418('0x3a')](handleError(_0x143b1d,null));};exports[_0x8418('0x1e')]=function(_0x11e961,_0x44e7ba){if(_0x11e961['body']['id']){delete _0x11e961[_0x8418('0x41')]['id'];}return db[_0x8418('0x26')][_0x8418('0x3f')]({'where':{'id':_0x11e961[_0x8418('0x3b')]['id']}})[_0x8418('0x1f')](handleEntityNotFound(_0x44e7ba,null))[_0x8418('0x1f')](saveUpdates(_0x11e961[_0x8418('0x41')],null))['then'](respondWithResult(_0x44e7ba,null))['catch'](handleError(_0x44e7ba,null));};exports[_0x8418('0x20')]=function(_0x210831,_0x3c0e9a){return db['Dynamics365Configuration']['find']({'where':{'id':_0x210831['params']['id']}})[_0x8418('0x1f')](handleEntityNotFound(_0x3c0e9a,null))['then'](removeEntity(_0x3c0e9a,null))[_0x8418('0x3a')](handleError(_0x3c0e9a,null));};exports[_0x8418('0x42')]=function(_0x4fd0fe,_0x16c748,_0x5141e9){var _0x56ceac={};var _0x507e5e={};var _0x434921;var _0x48c8e4;return db[_0x8418('0x26')]['findOne']({'where':{'id':_0x4fd0fe[_0x8418('0x3b')]['id']}})[_0x8418('0x1f')](handleEntityNotFound(_0x16c748,null))['then'](function(_0x24f18f){if(_0x24f18f){_0x434921=_0x24f18f;_0x507e5e[_0x8418('0x2c')]=_[_0x8418('0x3d')](db[_0x8418('0x43')]['rawAttributes']);_0x507e5e[_0x8418('0x2a')]=_[_0x8418('0x3d')](_0x4fd0fe[_0x8418('0x2a')]);_0x507e5e[_0x8418('0x2b')]=_[_0x8418('0x2e')](_0x507e5e[_0x8418('0x2c')],_0x507e5e[_0x8418('0x2a')]);_0x56ceac[_0x8418('0x2d')]=_['intersection'](_0x507e5e[_0x8418('0x2c')],qs[_0x8418('0x2f')](_0x4fd0fe[_0x8418('0x2a')][_0x8418('0x2f')]));_0x56ceac[_0x8418('0x2d')]=_0x56ceac['attributes'][_0x8418('0x30')]?_0x56ceac[_0x8418('0x2d')]:_0x507e5e[_0x8418('0x2c')];_0x56ceac['order']=qs[_0x8418('0x34')](_0x4fd0fe[_0x8418('0x2a')][_0x8418('0x34')]);_0x56ceac['where']=qs[_0x8418('0x2b')](_[_0x8418('0x35')](_0x4fd0fe[_0x8418('0x2a')],_0x507e5e['filters']));if(_0x4fd0fe[_0x8418('0x2a')][_0x8418('0x36')]){_0x56ceac[_0x8418('0x37')]=_[_0x8418('0x38')](_0x56ceac[_0x8418('0x37')],{'$or':_[_0x8418('0x25')](_0x56ceac['attributes'],function(_0x4d3a34){var _0x233515={};_0x233515[_0x4d3a34]={'$like':'%'+_0x4fd0fe['query'][_0x8418('0x36')]+'%'};return _0x233515;})});}_0x56ceac=_[_0x8418('0x38')]({},_0x56ceac,_0x4fd0fe['options']);return _0x434921['getFields'](_0x56ceac);}})[_0x8418('0x1f')](function(_0x5671de){if(_0x5671de){_0x48c8e4=_0x5671de[_0x8418('0x30')];if(!_0x4fd0fe['query'][_0x8418('0x31')]('nolimit')){_0x56ceac['limit']=qs[_0x8418('0x18')](_0x4fd0fe['query'][_0x8418('0x18')]);_0x56ceac['offset']=qs[_0x8418('0x16')](_0x4fd0fe[_0x8418('0x2a')][_0x8418('0x16')]);}return _0x434921['getFields'](_0x56ceac);}})[_0x8418('0x1f')](function(_0xbd2836){if(_0xbd2836){return _0xbd2836?{'count':_0x48c8e4,'rows':_0xbd2836}:null;}})['then'](respondWithResult(_0x16c748,null))['catch'](handleError(_0x16c748,null));};exports['getSubjects']=function(_0xb567ff,_0xbaa26,_0x2ba2ad){var _0x4a5580={};var _0x5cf75d={};var _0x23c37d;var _0x21da58;return db[_0x8418('0x26')][_0x8418('0x44')]({'where':{'id':_0xb567ff[_0x8418('0x3b')]['id']}})[_0x8418('0x1f')](handleEntityNotFound(_0xbaa26,null))[_0x8418('0x1f')](function(_0x5a7ee6){if(_0x5a7ee6){_0x23c37d=_0x5a7ee6;_0x5cf75d[_0x8418('0x2c')]=_[_0x8418('0x3d')](db[_0x8418('0x43')]['rawAttributes']);_0x5cf75d[_0x8418('0x2a')]=_[_0x8418('0x3d')](_0xb567ff[_0x8418('0x2a')]);_0x5cf75d[_0x8418('0x2b')]=_['intersection'](_0x5cf75d[_0x8418('0x2c')],_0x5cf75d[_0x8418('0x2a')]);_0x4a5580[_0x8418('0x2d')]=_['intersection'](_0x5cf75d['model'],qs[_0x8418('0x2f')](_0xb567ff[_0x8418('0x2a')]['fields']));_0x4a5580[_0x8418('0x2d')]=_0x4a5580['attributes']['length']?_0x4a5580[_0x8418('0x2d')]:_0x5cf75d[_0x8418('0x2c')];_0x4a5580[_0x8418('0x33')]=qs[_0x8418('0x34')](_0xb567ff[_0x8418('0x2a')][_0x8418('0x34')]);_0x4a5580[_0x8418('0x37')]=qs['filters'](_[_0x8418('0x35')](_0xb567ff[_0x8418('0x2a')],_0x5cf75d[_0x8418('0x2b')]));if(_0xb567ff['query'][_0x8418('0x36')]){_0x4a5580[_0x8418('0x37')]=_[_0x8418('0x38')](_0x4a5580[_0x8418('0x37')],{'$or':_['map'](_0x4a5580[_0x8418('0x2d')],function(_0x4fc8d8){var _0x8565a3={};_0x8565a3[_0x4fc8d8]={'$like':'%'+_0xb567ff[_0x8418('0x2a')]['filter']+'%'};return _0x8565a3;})});}_0x4a5580=_[_0x8418('0x38')]({},_0x4a5580,_0xb567ff[_0x8418('0x45')]);return _0x23c37d[_0x8418('0x46')](_0x4a5580);}})[_0x8418('0x1f')](function(_0xd38d82){if(_0xd38d82){_0x21da58=_0xd38d82[_0x8418('0x30')];if(!_0xb567ff[_0x8418('0x2a')][_0x8418('0x31')](_0x8418('0x32'))){_0x4a5580[_0x8418('0x18')]=qs[_0x8418('0x18')](_0xb567ff[_0x8418('0x2a')]['limit']);_0x4a5580[_0x8418('0x16')]=qs[_0x8418('0x16')](_0xb567ff[_0x8418('0x2a')][_0x8418('0x16')]);}return _0x23c37d[_0x8418('0x46')](_0x4a5580);}})[_0x8418('0x1f')](function(_0x43b918){if(_0x43b918){return _0x43b918?{'count':_0x21da58,'rows':_0x43b918}:null;}})[_0x8418('0x1f')](respondWithResult(_0xbaa26,null))[_0x8418('0x3a')](handleError(_0xbaa26,null));};exports[_0x8418('0x47')]=function(_0x317a9f,_0x273b93,_0x5993b3){var _0x195952={};var _0x125a96={};var _0x5b386a;var _0x272c0c;return db[_0x8418('0x26')][_0x8418('0x44')]({'where':{'id':_0x317a9f['params']['id']}})[_0x8418('0x1f')](handleEntityNotFound(_0x273b93,null))[_0x8418('0x1f')](function(_0xb0b0a2){if(_0xb0b0a2){_0x5b386a=_0xb0b0a2;_0x125a96['model']=_[_0x8418('0x3d')](db[_0x8418('0x43')]['rawAttributes']);_0x125a96[_0x8418('0x2a')]=_[_0x8418('0x3d')](_0x317a9f[_0x8418('0x2a')]);_0x125a96[_0x8418('0x2b')]=_[_0x8418('0x2e')](_0x125a96['model'],_0x125a96[_0x8418('0x2a')]);_0x195952[_0x8418('0x2d')]=_[_0x8418('0x2e')](_0x125a96[_0x8418('0x2c')],qs[_0x8418('0x2f')](_0x317a9f[_0x8418('0x2a')][_0x8418('0x2f')]));_0x195952[_0x8418('0x2d')]=_0x195952[_0x8418('0x2d')][_0x8418('0x30')]?_0x195952[_0x8418('0x2d')]:_0x125a96[_0x8418('0x2c')];_0x195952[_0x8418('0x33')]=qs[_0x8418('0x34')](_0x317a9f['query'][_0x8418('0x34')]);_0x195952[_0x8418('0x37')]=qs[_0x8418('0x2b')](_[_0x8418('0x35')](_0x317a9f[_0x8418('0x2a')],_0x125a96[_0x8418('0x2b')]));if(_0x317a9f[_0x8418('0x2a')][_0x8418('0x36')]){_0x195952[_0x8418('0x37')]=_['merge'](_0x195952[_0x8418('0x37')],{'$or':_[_0x8418('0x25')](_0x195952[_0x8418('0x2d')],function(_0x11a4bf){var _0x2db67c={};_0x2db67c[_0x11a4bf]={'$like':'%'+_0x317a9f[_0x8418('0x2a')][_0x8418('0x36')]+'%'};return _0x2db67c;})});}_0x195952=_[_0x8418('0x38')]({},_0x195952,_0x317a9f[_0x8418('0x45')]);return _0x5b386a[_0x8418('0x47')](_0x195952);}})[_0x8418('0x1f')](function(_0xdb9347){if(_0xdb9347){_0x272c0c=_0xdb9347['length'];if(!_0x317a9f[_0x8418('0x2a')]['hasOwnProperty'](_0x8418('0x32'))){_0x195952[_0x8418('0x18')]=qs[_0x8418('0x18')](_0x317a9f[_0x8418('0x2a')][_0x8418('0x18')]);_0x195952['offset']=qs[_0x8418('0x16')](_0x317a9f[_0x8418('0x2a')]['offset']);}return _0x5b386a[_0x8418('0x47')](_0x195952);}})[_0x8418('0x1f')](function(_0x32cd10){if(_0x32cd10){return _0x32cd10?{'count':_0x272c0c,'rows':_0x32cd10}:null;}})[_0x8418('0x1f')](respondWithResult(_0x273b93,null))[_0x8418('0x3a')](handleError(_0x273b93,null));}; \ No newline at end of file +var _0xbd3d=['fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','reject','update','then','sendStatus','error','name','send','index','map','Dynamics365Configuration','fieldName','key','filters','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','rows','show','keys','rawAttributes','length','find','catch','create','body','params','destroy','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','eml-format','rimraf','zip-dir'];(function(_0x48e185,_0x231e34){var _0x9888fb=function(_0x294ceb){while(--_0x294ceb){_0x48e185['push'](_0x48e185['shift']());}};_0x9888fb(++_0x231e34);}(_0xbd3d,0x18d));var _0xdbd3=function(_0x46db8f,_0x16f8a4){_0x46db8f=_0x46db8f-0x0;var _0x2e5bde=_0xbd3d[_0x46db8f];return _0x2e5bde;};'use strict';var emlformat=require(_0xdbd3('0x0'));var rimraf=require(_0xdbd3('0x1'));var zipdir=require(_0xdbd3('0x2'));var jsonpatch=require(_0xdbd3('0x3'));var rp=require('request-promise');var moment=require(_0xdbd3('0x4'));var BPromise=require(_0xdbd3('0x5'));var Mustache=require(_0xdbd3('0x6'));var util=require('util');var path=require(_0xdbd3('0x7'));var sox=require(_0xdbd3('0x8'));var csv=require(_0xdbd3('0x9'));var ejs=require(_0xdbd3('0xa'));var fs=require('fs');var fs_extra=require(_0xdbd3('0xb'));var _=require(_0xdbd3('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdbd3('0xd'));var deskjs=require(_0xdbd3('0xe'));var toCsv=require(_0xdbd3('0x9'));var querystring=require(_0xdbd3('0xf'));var Papa=require(_0xdbd3('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdbd3('0x11'));var as=require(_0xdbd3('0x12'));var hardwareService=require(_0xdbd3('0x13'));var logger=require('../../config/logger')(_0xdbd3('0x14'));var utils=require('../../config/utils');var config=require(_0xdbd3('0x15'));var licenseUtil=require(_0xdbd3('0x16'));var db=require(_0xdbd3('0x17'))['db'];function respondWithStatusCode(_0x43ea07,_0x53c6e4){_0x53c6e4=_0x53c6e4||0xcc;return function(_0x3eed79){if(_0x3eed79){return _0x43ea07['sendStatus'](_0x53c6e4);}return _0x43ea07['status'](_0x53c6e4)[_0xdbd3('0x18')]();};}function respondWithResult(_0x3fb422,_0x5f5dd9){_0x5f5dd9=_0x5f5dd9||0xc8;return function(_0x2d1d2c){if(_0x2d1d2c){return _0x3fb422[_0xdbd3('0x19')](_0x5f5dd9)[_0xdbd3('0x1a')](_0x2d1d2c);}};}function respondWithFilteredResult(_0x11e5b2,_0x4d9bab){return function(_0x30ffd6){if(_0x30ffd6){var _0x2ceca5=typeof _0x4d9bab[_0xdbd3('0x1b')]===_0xdbd3('0x1c')&&typeof _0x4d9bab[_0xdbd3('0x1d')]===_0xdbd3('0x1c');var _0x1aa988=_0x30ffd6[_0xdbd3('0x1e')];var _0x39d164=_0x2ceca5?0x0:_0x4d9bab['offset'];var _0x1ac9ac=_0x2ceca5?_0x30ffd6['count']:_0x4d9bab['offset']+_0x4d9bab[_0xdbd3('0x1d')];var _0x203ee9;if(_0x1ac9ac>=_0x1aa988){_0x1ac9ac=_0x1aa988;_0x203ee9=0xc8;}else{_0x203ee9=0xce;}_0x11e5b2[_0xdbd3('0x19')](_0x203ee9);return _0x11e5b2[_0xdbd3('0x1f')]('Content-Range',_0x39d164+'-'+_0x1ac9ac+'/'+_0x1aa988)[_0xdbd3('0x1a')](_0x30ffd6);}return null;};}function patchUpdates(_0x3b0711){return function(_0xda0e30){try{jsonpatch[_0xdbd3('0x20')](_0xda0e30,_0x3b0711,!![]);}catch(_0x7a6e59){return BPromise[_0xdbd3('0x21')](_0x7a6e59);}return _0xda0e30['save']();};}function saveUpdates(_0x38d86f,_0x375adc){return function(_0x1a9acb){if(_0x1a9acb){return _0x1a9acb[_0xdbd3('0x22')](_0x38d86f)['then'](function(_0x23b6d3){return _0x23b6d3;});}return null;};}function removeEntity(_0x5d56d8,_0x596c38){return function(_0x56b662){if(_0x56b662){return _0x56b662['destroy']()[_0xdbd3('0x23')](function(){_0x5d56d8[_0xdbd3('0x19')](0xcc)[_0xdbd3('0x18')]();});}};}function handleEntityNotFound(_0xb2692b,_0x518bad){return function(_0x27a515){if(!_0x27a515){_0xb2692b[_0xdbd3('0x24')](0x194);}return _0x27a515;};}function handleError(_0x458e3a,_0x1079a8){_0x1079a8=_0x1079a8||0x1f4;return function(_0xf650f7){logger[_0xdbd3('0x25')](_0xf650f7['stack']);if(_0xf650f7[_0xdbd3('0x26')]){delete _0xf650f7[_0xdbd3('0x26')];}_0x458e3a[_0xdbd3('0x19')](_0x1079a8)[_0xdbd3('0x27')](_0xf650f7);};}exports[_0xdbd3('0x28')]=function(_0x1a4449,_0x34d244){var _0x47cbf8={},_0x5a4915={},_0x34ae6a={'count':0x0,'rows':[]};var _0x150bf4=_[_0xdbd3('0x29')](db[_0xdbd3('0x2a')]['rawAttributes'],function(_0x78c717){return{'name':_0x78c717[_0xdbd3('0x2b')],'type':_0x78c717['type'][_0xdbd3('0x2c')]};});_0x5a4915['model']=_[_0xdbd3('0x29')](_0x150bf4,_0xdbd3('0x26'));_0x5a4915['query']=_['keys'](_0x1a4449['query']);_0x5a4915[_0xdbd3('0x2d')]=_['intersection'](_0x5a4915[_0xdbd3('0x2e')],_0x5a4915[_0xdbd3('0x2f')]);_0x47cbf8[_0xdbd3('0x30')]=_[_0xdbd3('0x31')](_0x5a4915['model'],qs[_0xdbd3('0x32')](_0x1a4449[_0xdbd3('0x2f')][_0xdbd3('0x32')]));_0x47cbf8[_0xdbd3('0x30')]=_0x47cbf8[_0xdbd3('0x30')]['length']?_0x47cbf8[_0xdbd3('0x30')]:_0x5a4915[_0xdbd3('0x2e')];if(!_0x1a4449[_0xdbd3('0x2f')][_0xdbd3('0x33')](_0xdbd3('0x34'))){_0x47cbf8[_0xdbd3('0x1d')]=qs[_0xdbd3('0x1d')](_0x1a4449['query'][_0xdbd3('0x1d')]);_0x47cbf8[_0xdbd3('0x1b')]=qs['offset'](_0x1a4449[_0xdbd3('0x2f')]['offset']);}_0x47cbf8[_0xdbd3('0x35')]=qs[_0xdbd3('0x36')](_0x1a4449[_0xdbd3('0x2f')]['sort']);_0x47cbf8['where']=qs[_0xdbd3('0x2d')](_[_0xdbd3('0x37')](_0x1a4449['query'],_0x5a4915[_0xdbd3('0x2d')]),_0x150bf4);if(_0x1a4449[_0xdbd3('0x2f')][_0xdbd3('0x38')]){_0x47cbf8['where']=_['merge'](_0x47cbf8[_0xdbd3('0x39')],{'$or':_[_0xdbd3('0x29')](_0x150bf4,function(_0x2b809f){if(_0x2b809f[_0xdbd3('0x3a')]!==_0xdbd3('0x3b')){var _0x544532={};_0x544532[_0x2b809f[_0xdbd3('0x26')]]={'$like':'%'+_0x1a4449['query'][_0xdbd3('0x38')]+'%'};return _0x544532;}})});}_0x47cbf8=_[_0xdbd3('0x3c')]({},_0x47cbf8,_0x1a4449[_0xdbd3('0x3d')]);var _0x33d409={'where':_0x47cbf8[_0xdbd3('0x39')]};return db['Dynamics365Configuration'][_0xdbd3('0x1e')](_0x33d409)[_0xdbd3('0x23')](function(_0x105f0d){_0x34ae6a[_0xdbd3('0x1e')]=_0x105f0d;if(_0x1a4449[_0xdbd3('0x2f')][_0xdbd3('0x3e')]){_0x47cbf8[_0xdbd3('0x3f')]=[{'all':!![]}];}return db[_0xdbd3('0x2a')]['findAll'](_0x47cbf8);})[_0xdbd3('0x23')](function(_0x4f2dca){_0x34ae6a[_0xdbd3('0x40')]=_0x4f2dca;return _0x34ae6a;})[_0xdbd3('0x23')](respondWithFilteredResult(_0x34d244,_0x47cbf8))['catch'](handleError(_0x34d244,null));};exports[_0xdbd3('0x41')]=function(_0x4c1ede,_0x585ab9){var _0x40176e={'raw':![],'where':{'id':_0x4c1ede['params']['id']}},_0x224c8d={};_0x224c8d['model']=_[_0xdbd3('0x42')](db['Dynamics365Configuration'][_0xdbd3('0x43')]);_0x224c8d[_0xdbd3('0x2f')]=_[_0xdbd3('0x42')](_0x4c1ede[_0xdbd3('0x2f')]);_0x224c8d[_0xdbd3('0x2d')]=_[_0xdbd3('0x31')](_0x224c8d[_0xdbd3('0x2e')],_0x224c8d[_0xdbd3('0x2f')]);_0x40176e[_0xdbd3('0x30')]=_['intersection'](_0x224c8d[_0xdbd3('0x2e')],qs[_0xdbd3('0x32')](_0x4c1ede[_0xdbd3('0x2f')][_0xdbd3('0x32')]));_0x40176e[_0xdbd3('0x30')]=_0x40176e[_0xdbd3('0x30')][_0xdbd3('0x44')]?_0x40176e[_0xdbd3('0x30')]:_0x224c8d[_0xdbd3('0x2e')];if(_0x4c1ede[_0xdbd3('0x2f')][_0xdbd3('0x3e')]){_0x40176e[_0xdbd3('0x3f')]=[{'all':!![]}];}_0x40176e=_[_0xdbd3('0x3c')]({},_0x40176e,_0x4c1ede['options']);return db['Dynamics365Configuration'][_0xdbd3('0x45')](_0x40176e)['then'](handleEntityNotFound(_0x585ab9,null))[_0xdbd3('0x23')](respondWithResult(_0x585ab9,null))[_0xdbd3('0x46')](handleError(_0x585ab9,null));};exports[_0xdbd3('0x47')]=function(_0x5c239c,_0x44215){return db[_0xdbd3('0x2a')]['create'](_0x5c239c[_0xdbd3('0x48')],{})['then'](respondWithResult(_0x44215,0xc9))['catch'](handleError(_0x44215,null));};exports['update']=function(_0x2b2fb5,_0x1b42d7){if(_0x2b2fb5[_0xdbd3('0x48')]['id']){delete _0x2b2fb5[_0xdbd3('0x48')]['id'];}return db[_0xdbd3('0x2a')][_0xdbd3('0x45')]({'where':{'id':_0x2b2fb5[_0xdbd3('0x49')]['id']}})[_0xdbd3('0x23')](handleEntityNotFound(_0x1b42d7,null))[_0xdbd3('0x23')](saveUpdates(_0x2b2fb5['body'],null))[_0xdbd3('0x23')](respondWithResult(_0x1b42d7,null))['catch'](handleError(_0x1b42d7,null));};exports[_0xdbd3('0x4a')]=function(_0x4d5117,_0x1b8e49){return db[_0xdbd3('0x2a')][_0xdbd3('0x45')]({'where':{'id':_0x4d5117[_0xdbd3('0x49')]['id']}})[_0xdbd3('0x23')](handleEntityNotFound(_0x1b8e49,null))[_0xdbd3('0x23')](removeEntity(_0x1b8e49,null))[_0xdbd3('0x46')](handleError(_0x1b8e49,null));};exports[_0xdbd3('0x4b')]=function(_0x4cc38e,_0x2cc92d,_0x2ded5f){var _0x4746e9={};var _0x4dab78={};var _0x5cc46a;var _0x448523;return db[_0xdbd3('0x2a')]['findOne']({'where':{'id':_0x4cc38e[_0xdbd3('0x49')]['id']}})['then'](handleEntityNotFound(_0x2cc92d,null))[_0xdbd3('0x23')](function(_0x5436d9){if(_0x5436d9){_0x5cc46a=_0x5436d9;_0x4dab78[_0xdbd3('0x2e')]=_[_0xdbd3('0x42')](db['Dynamics365Field']['rawAttributes']);_0x4dab78['query']=_['keys'](_0x4cc38e[_0xdbd3('0x2f')]);_0x4dab78[_0xdbd3('0x2d')]=_[_0xdbd3('0x31')](_0x4dab78['model'],_0x4dab78['query']);_0x4746e9[_0xdbd3('0x30')]=_['intersection'](_0x4dab78[_0xdbd3('0x2e')],qs[_0xdbd3('0x32')](_0x4cc38e[_0xdbd3('0x2f')][_0xdbd3('0x32')]));_0x4746e9[_0xdbd3('0x30')]=_0x4746e9[_0xdbd3('0x30')]['length']?_0x4746e9[_0xdbd3('0x30')]:_0x4dab78[_0xdbd3('0x2e')];_0x4746e9['order']=qs[_0xdbd3('0x36')](_0x4cc38e[_0xdbd3('0x2f')][_0xdbd3('0x36')]);_0x4746e9[_0xdbd3('0x39')]=qs[_0xdbd3('0x2d')](_[_0xdbd3('0x37')](_0x4cc38e[_0xdbd3('0x2f')],_0x4dab78[_0xdbd3('0x2d')]));if(_0x4cc38e[_0xdbd3('0x2f')][_0xdbd3('0x38')]){_0x4746e9[_0xdbd3('0x39')]=_[_0xdbd3('0x3c')](_0x4746e9[_0xdbd3('0x39')],{'$or':_[_0xdbd3('0x29')](_0x4746e9[_0xdbd3('0x30')],function(_0xccd4c3){var _0x1dfc95={};_0x1dfc95[_0xccd4c3]={'$like':'%'+_0x4cc38e[_0xdbd3('0x2f')]['filter']+'%'};return _0x1dfc95;})});}_0x4746e9=_[_0xdbd3('0x3c')]({},_0x4746e9,_0x4cc38e[_0xdbd3('0x3d')]);return _0x5cc46a[_0xdbd3('0x4b')](_0x4746e9);}})[_0xdbd3('0x23')](function(_0x20dfe5){if(_0x20dfe5){_0x448523=_0x20dfe5['length'];if(!_0x4cc38e['query'][_0xdbd3('0x33')](_0xdbd3('0x34'))){_0x4746e9[_0xdbd3('0x1d')]=qs[_0xdbd3('0x1d')](_0x4cc38e[_0xdbd3('0x2f')][_0xdbd3('0x1d')]);_0x4746e9['offset']=qs[_0xdbd3('0x1b')](_0x4cc38e[_0xdbd3('0x2f')][_0xdbd3('0x1b')]);}return _0x5cc46a[_0xdbd3('0x4b')](_0x4746e9);}})[_0xdbd3('0x23')](function(_0x2bacb0){if(_0x2bacb0){return _0x2bacb0?{'count':_0x448523,'rows':_0x2bacb0}:null;}})[_0xdbd3('0x23')](respondWithResult(_0x2cc92d,null))[_0xdbd3('0x46')](handleError(_0x2cc92d,null));};exports['getSubjects']=function(_0x20e255,_0x4c2394,_0x3fd7ca){var _0x434fbc={};var _0x2e1dd2={};var _0x389de5;var _0x59c841;return db['Dynamics365Configuration'][_0xdbd3('0x4c')]({'where':{'id':_0x20e255[_0xdbd3('0x49')]['id']}})[_0xdbd3('0x23')](handleEntityNotFound(_0x4c2394,null))[_0xdbd3('0x23')](function(_0x14e219){if(_0x14e219){_0x389de5=_0x14e219;_0x2e1dd2[_0xdbd3('0x2e')]=_[_0xdbd3('0x42')](db[_0xdbd3('0x4d')][_0xdbd3('0x43')]);_0x2e1dd2[_0xdbd3('0x2f')]=_['keys'](_0x20e255[_0xdbd3('0x2f')]);_0x2e1dd2['filters']=_[_0xdbd3('0x31')](_0x2e1dd2[_0xdbd3('0x2e')],_0x2e1dd2['query']);_0x434fbc['attributes']=_['intersection'](_0x2e1dd2[_0xdbd3('0x2e')],qs[_0xdbd3('0x32')](_0x20e255[_0xdbd3('0x2f')][_0xdbd3('0x32')]));_0x434fbc['attributes']=_0x434fbc[_0xdbd3('0x30')]['length']?_0x434fbc[_0xdbd3('0x30')]:_0x2e1dd2['model'];_0x434fbc['order']=qs[_0xdbd3('0x36')](_0x20e255[_0xdbd3('0x2f')][_0xdbd3('0x36')]);_0x434fbc[_0xdbd3('0x39')]=qs['filters'](_['pick'](_0x20e255[_0xdbd3('0x2f')],_0x2e1dd2[_0xdbd3('0x2d')]));if(_0x20e255[_0xdbd3('0x2f')][_0xdbd3('0x38')]){_0x434fbc[_0xdbd3('0x39')]=_[_0xdbd3('0x3c')](_0x434fbc[_0xdbd3('0x39')],{'$or':_[_0xdbd3('0x29')](_0x434fbc[_0xdbd3('0x30')],function(_0x254e08){var _0x3d2a0f={};_0x3d2a0f[_0x254e08]={'$like':'%'+_0x20e255['query'][_0xdbd3('0x38')]+'%'};return _0x3d2a0f;})});}_0x434fbc=_['merge']({},_0x434fbc,_0x20e255[_0xdbd3('0x3d')]);return _0x389de5[_0xdbd3('0x4e')](_0x434fbc);}})['then'](function(_0x4cbc87){if(_0x4cbc87){_0x59c841=_0x4cbc87[_0xdbd3('0x44')];if(!_0x20e255[_0xdbd3('0x2f')][_0xdbd3('0x33')](_0xdbd3('0x34'))){_0x434fbc['limit']=qs['limit'](_0x20e255[_0xdbd3('0x2f')][_0xdbd3('0x1d')]);_0x434fbc[_0xdbd3('0x1b')]=qs['offset'](_0x20e255[_0xdbd3('0x2f')]['offset']);}return _0x389de5['getSubjects'](_0x434fbc);}})['then'](function(_0xf6b73b){if(_0xf6b73b){return _0xf6b73b?{'count':_0x59c841,'rows':_0xf6b73b}:null;}})[_0xdbd3('0x23')](respondWithResult(_0x4c2394,null))[_0xdbd3('0x46')](handleError(_0x4c2394,null));};exports[_0xdbd3('0x4f')]=function(_0x4d4d87,_0x304fd3,_0x36f1f8){var _0x21c01b={};var _0x42ae5b={};var _0x3b067b;var _0x515e66;return db[_0xdbd3('0x2a')][_0xdbd3('0x4c')]({'where':{'id':_0x4d4d87[_0xdbd3('0x49')]['id']}})['then'](handleEntityNotFound(_0x304fd3,null))[_0xdbd3('0x23')](function(_0x39d66b){if(_0x39d66b){_0x3b067b=_0x39d66b;_0x42ae5b[_0xdbd3('0x2e')]=_[_0xdbd3('0x42')](db[_0xdbd3('0x4d')][_0xdbd3('0x43')]);_0x42ae5b[_0xdbd3('0x2f')]=_['keys'](_0x4d4d87[_0xdbd3('0x2f')]);_0x42ae5b[_0xdbd3('0x2d')]=_[_0xdbd3('0x31')](_0x42ae5b[_0xdbd3('0x2e')],_0x42ae5b['query']);_0x21c01b['attributes']=_[_0xdbd3('0x31')](_0x42ae5b[_0xdbd3('0x2e')],qs[_0xdbd3('0x32')](_0x4d4d87[_0xdbd3('0x2f')][_0xdbd3('0x32')]));_0x21c01b['attributes']=_0x21c01b['attributes'][_0xdbd3('0x44')]?_0x21c01b[_0xdbd3('0x30')]:_0x42ae5b[_0xdbd3('0x2e')];_0x21c01b['order']=qs[_0xdbd3('0x36')](_0x4d4d87['query'][_0xdbd3('0x36')]);_0x21c01b[_0xdbd3('0x39')]=qs[_0xdbd3('0x2d')](_[_0xdbd3('0x37')](_0x4d4d87[_0xdbd3('0x2f')],_0x42ae5b[_0xdbd3('0x2d')]));if(_0x4d4d87[_0xdbd3('0x2f')][_0xdbd3('0x38')]){_0x21c01b[_0xdbd3('0x39')]=_[_0xdbd3('0x3c')](_0x21c01b[_0xdbd3('0x39')],{'$or':_['map'](_0x21c01b[_0xdbd3('0x30')],function(_0x2ac03d){var _0x216db6={};_0x216db6[_0x2ac03d]={'$like':'%'+_0x4d4d87['query'][_0xdbd3('0x38')]+'%'};return _0x216db6;})});}_0x21c01b=_[_0xdbd3('0x3c')]({},_0x21c01b,_0x4d4d87[_0xdbd3('0x3d')]);return _0x3b067b['getDescriptions'](_0x21c01b);}})[_0xdbd3('0x23')](function(_0x169a5f){if(_0x169a5f){_0x515e66=_0x169a5f[_0xdbd3('0x44')];if(!_0x4d4d87['query'][_0xdbd3('0x33')](_0xdbd3('0x34'))){_0x21c01b[_0xdbd3('0x1d')]=qs[_0xdbd3('0x1d')](_0x4d4d87[_0xdbd3('0x2f')][_0xdbd3('0x1d')]);_0x21c01b[_0xdbd3('0x1b')]=qs[_0xdbd3('0x1b')](_0x4d4d87[_0xdbd3('0x2f')][_0xdbd3('0x1b')]);}return _0x3b067b[_0xdbd3('0x4f')](_0x21c01b);}})[_0xdbd3('0x23')](function(_0xd237cd){if(_0xd237cd){return _0xd237cd?{'count':_0x515e66,'rows':_0xd237cd}:null;}})[_0xdbd3('0x23')](respondWithResult(_0x304fd3,null))[_0xdbd3('0x46')](handleError(_0x304fd3,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 0067515..ccd5ff8 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb43b=['rimraf','../../config/environment','./intDynamics365Configuration.attributes','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','api','moment','bluebird','path'];(function(_0x14db04,_0x39df19){var _0x95efdd=function(_0x7ad392){while(--_0x7ad392){_0x14db04['push'](_0x14db04['shift']());}};_0x95efdd(++_0x39df19);}(_0xb43b,0x1b2));var _0xbb43=function(_0x58a4be,_0x38e4ac){_0x58a4be=_0x58a4be-0x0;var _0x4cf072=_0xb43b[_0x58a4be];return _0x4cf072;};'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 _0xdace=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','Dynamics365Configuration','int_dynamics365_configurations','lodash'];(function(_0x485d05,_0x3c1118){var _0x32685b=function(_0x54a4f3){while(--_0x54a4f3){_0x485d05['push'](_0x485d05['shift']());}};_0x32685b(++_0x3c1118);}(_0xdace,0xc5));var _0xedac=function(_0x34a8c8,_0x31e259){_0x34a8c8=_0x34a8c8-0x0;var _0x1fe6e5=_0xdace[_0x34a8c8];return _0x1fe6e5;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var logger=require(_0xedac('0x1'))(_0xedac('0x2'));var moment=require(_0xedac('0x3'));var BPromise=require('bluebird');var rp=require(_0xedac('0x4'));var fs=require('fs');var path=require(_0xedac('0x5'));var rimraf=require(_0xedac('0x6'));var config=require(_0xedac('0x7'));var attributes=require('./intDynamics365Configuration.attributes');module[_0xedac('0x8')]=function(_0x1cba89,_0x39328a){return _0x1cba89['define'](_0xedac('0x9'),attributes,{'tableName':_0xedac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index b02d782..1fe078a 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 _0x0ad4=['request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x13348a,_0x37af64){var _0x26e7f9=function(_0x70aba6){while(--_0x70aba6){_0x13348a['push'](_0x13348a['shift']());}};_0x26e7f9(++_0x37af64);}(_0x0ad4,0xc3));var _0x40ad=function(_0x4dd673,_0x8000b){_0x4dd673=_0x4dd673-0x0;var _0x523713=_0x0ad4[_0x4dd673];return _0x523713;};'use strict';var _=require(_0x40ad('0x0'));var util=require(_0x40ad('0x1'));var moment=require(_0x40ad('0x2'));var BPromise=require(_0x40ad('0x3'));var rs=require(_0x40ad('0x4'));var fs=require('fs');var Redis=require(_0x40ad('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x40ad('0x6'))(_0x40ad('0x7'));var config=require(_0x40ad('0x8'));var jayson=require(_0x40ad('0x9'));var client=jayson[_0x40ad('0xa')][_0x40ad('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x568fbb,_0x724009,_0x123f29){return new BPromise(function(_0x324c15,_0x5a6c2f){return client[_0x40ad('0xc')](_0x568fbb,_0x123f29)[_0x40ad('0xd')](function(_0x2c8c2a){logger['info'](_0x40ad('0xe'),_0x724009,_0x40ad('0xf'));logger['debug'](_0x40ad('0x10'),_0x724009,'request\x20sent',JSON[_0x40ad('0x11')](_0x2c8c2a));if(_0x2c8c2a['error']){if(_0x2c8c2a['error'][_0x40ad('0x12')]===0x1f4){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x724009,_0x2c8c2a[_0x40ad('0x13')][_0x40ad('0x14')]);return _0x5a6c2f(_0x2c8c2a[_0x40ad('0x13')][_0x40ad('0x14')]);}logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x724009,_0x2c8c2a[_0x40ad('0x13')]['message']);return _0x324c15(_0x2c8c2a[_0x40ad('0x13')][_0x40ad('0x14')]);}else{logger[_0x40ad('0x15')](_0x40ad('0xe'),_0x724009,'request\x20sent');_0x324c15(_0x2c8c2a['result'][_0x40ad('0x14')]);}})[_0x40ad('0x16')](function(_0x2291f8){logger['error'](_0x40ad('0xe'),_0x724009,_0x2291f8);_0x5a6c2f(_0x2291f8);});});} \ No newline at end of file +var _0x2f79=['info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x29e857,_0x21d294){var _0x4e6b23=function(_0x4995e0){while(--_0x4995e0){_0x29e857['push'](_0x29e857['shift']());}};_0x4e6b23(++_0x21d294);}(_0x2f79,0x1c2));var _0x92f7=function(_0xa15bd9,_0x17b25c){_0xa15bd9=_0xa15bd9-0x0;var _0x5d17eb=_0x2f79[_0xa15bd9];return _0x5d17eb;};'use strict';var _=require(_0x92f7('0x0'));var util=require(_0x92f7('0x1'));var moment=require(_0x92f7('0x2'));var BPromise=require('bluebird');var rs=require(_0x92f7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x92f7('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x92f7('0x5'));var config=require(_0x92f7('0x6'));var jayson=require(_0x92f7('0x7'));var client=jayson[_0x92f7('0x8')][_0x92f7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x485ba7,_0xfe86c4,_0x3ac7dc){return new BPromise(function(_0x3e927e,_0x54f69c){return client[_0x92f7('0xa')](_0x485ba7,_0x3ac7dc)[_0x92f7('0xb')](function(_0x3555a3){logger[_0x92f7('0xc')](_0x92f7('0xd'),_0xfe86c4,_0x92f7('0xe'));logger[_0x92f7('0xf')](_0x92f7('0x10'),_0xfe86c4,'request\x20sent',JSON['stringify'](_0x3555a3));if(_0x3555a3[_0x92f7('0x11')]){if(_0x3555a3[_0x92f7('0x11')][_0x92f7('0x12')]===0x1f4){logger['error'](_0x92f7('0xd'),_0xfe86c4,_0x3555a3['error'][_0x92f7('0x13')]);return _0x54f69c(_0x3555a3[_0x92f7('0x11')][_0x92f7('0x13')]);}logger[_0x92f7('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0xfe86c4,_0x3555a3[_0x92f7('0x11')]['message']);return _0x3e927e(_0x3555a3[_0x92f7('0x11')][_0x92f7('0x13')]);}else{logger['info'](_0x92f7('0xd'),_0xfe86c4,_0x92f7('0xe'));_0x3e927e(_0x3555a3['result']['message']);}})[_0x92f7('0x14')](function(_0x1ca4d5){logger[_0x92f7('0x11')](_0x92f7('0xd'),_0xfe86c4,_0x1ca4d5);_0x54f69c(_0x1ca4d5);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 57d6141..a23763e 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 _0xbd4f=['Router','fs-extra','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','create','put','update','/:id','destroy','exports','multer','connect-timeout','express'];(function(_0x73e491,_0x83d943){var _0x44240b=function(_0x5571cc){while(--_0x5571cc){_0x73e491['push'](_0x73e491['shift']());}};_0x44240b(++_0x83d943);}(_0xbd4f,0x16d));var _0xfbd4=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xbd4f[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0xfbd4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xfbd4('0x1'));var express=require(_0xfbd4('0x2'));var router=express[_0xfbd4('0x3')]();var fs_extra=require(_0xfbd4('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfbd4('0x5'));var controller=require(_0xfbd4('0x6'));router[_0xfbd4('0x7')]('/',auth[_0xfbd4('0x8')](),controller[_0xfbd4('0x9')]);router[_0xfbd4('0x7')]('/:id',auth[_0xfbd4('0x8')](),controller['show']);router['post']('/',auth[_0xfbd4('0x8')](),controller[_0xfbd4('0xa')]);router[_0xfbd4('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xfbd4('0xc')]);router['delete'](_0xfbd4('0xd'),auth[_0xfbd4('0x8')](),controller[_0xfbd4('0xe')]);module[_0xfbd4('0xf')]=router; \ No newline at end of file +var _0x03b3=['exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','isAuthenticated','index','get','show','post','put','/:id','update','delete','destroy'];(function(_0x15d3e8,_0x4fe61d){var _0x414ed0=function(_0x472dd4){while(--_0x472dd4){_0x15d3e8['push'](_0x15d3e8['shift']());}};_0x414ed0(++_0x4fe61d);}(_0x03b3,0x17d));var _0x303b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x03b3[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x303b('0x0'));var util=require(_0x303b('0x1'));var path=require(_0x303b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x303b('0x3'));var auth=require(_0x303b('0x4'));var interaction=require(_0x303b('0x5'));var config=require(_0x303b('0x6'));var controller=require(_0x303b('0x7'));router['get']('/',auth[_0x303b('0x8')](),controller[_0x303b('0x9')]);router[_0x303b('0xa')]('/:id',auth[_0x303b('0x8')](),controller[_0x303b('0xb')]);router[_0x303b('0xc')]('/',auth[_0x303b('0x8')](),controller['create']);router[_0x303b('0xd')](_0x303b('0xe'),auth[_0x303b('0x8')](),controller[_0x303b('0xf')]);router[_0x303b('0x10')](_0x303b('0xe'),auth[_0x303b('0x8')](),controller[_0x303b('0x11')]);module[_0x303b('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 ad6f50e..769be2a 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 _0x4cfe=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x4cfe,0x1ac));var _0xe4cf=function(_0xab9c97,_0x10e4dc){_0xab9c97=_0xab9c97-0x0;var _0x1301a5=_0x4cfe[_0xab9c97];return _0x1301a5;};'use strict';var Sequelize=require(_0xe4cf('0x0'));module[_0xe4cf('0x1')]={'type':{'type':Sequelize[_0xe4cf('0x2')](_0xe4cf('0x3'),_0xe4cf('0x4'),_0xe4cf('0x5'),_0xe4cf('0x6'),_0xe4cf('0x7')),'defaultValue':_0xe4cf('0x3')},'content':{'type':Sequelize[_0xe4cf('0x8')]},'key':{'type':Sequelize[_0xe4cf('0x8')]},'keyType':{'type':Sequelize[_0xe4cf('0x2')]('string',_0xe4cf('0x4'),_0xe4cf('0x5'))},'keyContent':{'type':Sequelize[_0xe4cf('0x8')]},'idField':{'type':Sequelize[_0xe4cf('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xe4cf('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe4cf('0x8')]}}; \ No newline at end of file +var _0xb640=['BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue','picklist','STRING'];(function(_0x26dafd,_0x51f371){var _0x1e251d=function(_0x419c7c){while(--_0x419c7c){_0x26dafd['push'](_0x26dafd['shift']());}};_0x1e251d(++_0x51f371);}(_0xb640,0x10f));var _0x0b64=function(_0x1597b7,_0x167e43){_0x1597b7=_0x1597b7-0x0;var _0x56c0ed=_0xb640[_0x1597b7];return _0x56c0ed;};'use strict';var Sequelize=require(_0x0b64('0x0'));module[_0x0b64('0x1')]={'type':{'type':Sequelize[_0x0b64('0x2')](_0x0b64('0x3'),'variable',_0x0b64('0x4'),_0x0b64('0x5'),_0x0b64('0x6')),'defaultValue':_0x0b64('0x3')},'content':{'type':Sequelize[_0x0b64('0x7')]},'key':{'type':Sequelize[_0x0b64('0x7')]},'keyType':{'type':Sequelize[_0x0b64('0x2')](_0x0b64('0x3'),'variable',_0x0b64('0x4'))},'keyContent':{'type':Sequelize[_0x0b64('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x0b64('0x7')]},'customField':{'type':Sequelize[_0x0b64('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0b64('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 5dc4cea..78b5cc3 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 _0x0e9d=['VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../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','save','update','then','destroy','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x4bbfeb,_0x2bd851){var _0x2df4a3=function(_0x445864){while(--_0x445864){_0x4bbfeb['push'](_0x4bbfeb['shift']());}};_0x2df4a3(++_0x2bd851);}(_0x0e9d,0x193));var _0xd0e9=function(_0x53a3e6,_0x20d262){_0x53a3e6=_0x53a3e6-0x0;var _0x4a56e2=_0x0e9d[_0x53a3e6];return _0x4a56e2;};'use strict';var emlformat=require(_0xd0e9('0x0'));var rimraf=require(_0xd0e9('0x1'));var zipdir=require(_0xd0e9('0x2'));var jsonpatch=require(_0xd0e9('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd0e9('0x4'));var Mustache=require(_0xd0e9('0x5'));var util=require('util');var path=require(_0xd0e9('0x6'));var sox=require(_0xd0e9('0x7'));var csv=require('to-csv');var ejs=require(_0xd0e9('0x8'));var fs=require('fs');var fs_extra=require(_0xd0e9('0x9'));var _=require(_0xd0e9('0xa'));var squel=require('squel');var crypto=require(_0xd0e9('0xb'));var jsforce=require(_0xd0e9('0xc'));var deskjs=require(_0xd0e9('0xd'));var toCsv=require(_0xd0e9('0xe'));var querystring=require(_0xd0e9('0xf'));var Papa=require('papaparse');var Redis=require(_0xd0e9('0x10'));var authService=require(_0xd0e9('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd0e9('0x12'));var hardwareService=require(_0xd0e9('0x13'));var logger=require('../../config/logger')(_0xd0e9('0x14'));var utils=require(_0xd0e9('0x15'));var config=require(_0xd0e9('0x16'));var licenseUtil=require(_0xd0e9('0x17'));var db=require(_0xd0e9('0x18'))['db'];function respondWithStatusCode(_0x2867b6,_0x143cfe){_0x143cfe=_0x143cfe||0xcc;return function(_0x5d8a02){if(_0x5d8a02){return _0x2867b6[_0xd0e9('0x19')](_0x143cfe);}return _0x2867b6[_0xd0e9('0x1a')](_0x143cfe)[_0xd0e9('0x1b')]();};}function respondWithResult(_0x5484ad,_0x57b4f4){_0x57b4f4=_0x57b4f4||0xc8;return function(_0x3487b8){if(_0x3487b8){return _0x5484ad['status'](_0x57b4f4)[_0xd0e9('0x1c')](_0x3487b8);}};}function respondWithFilteredResult(_0x396083,_0x2af622){return function(_0x5eb4a9){if(_0x5eb4a9){var _0xaf1f12=typeof _0x2af622[_0xd0e9('0x1d')]==='undefined'&&typeof _0x2af622[_0xd0e9('0x1e')]===_0xd0e9('0x1f');var _0x235d51=_0x5eb4a9[_0xd0e9('0x20')];var _0x1888bb=_0xaf1f12?0x0:_0x2af622[_0xd0e9('0x1d')];var _0x475b0b=_0xaf1f12?_0x5eb4a9[_0xd0e9('0x20')]:_0x2af622[_0xd0e9('0x1d')]+_0x2af622[_0xd0e9('0x1e')];var _0x403eb9;if(_0x475b0b>=_0x235d51){_0x475b0b=_0x235d51;_0x403eb9=0xc8;}else{_0x403eb9=0xce;}_0x396083[_0xd0e9('0x1a')](_0x403eb9);return _0x396083[_0xd0e9('0x21')](_0xd0e9('0x22'),_0x1888bb+'-'+_0x475b0b+'/'+_0x235d51)['json'](_0x5eb4a9);}return null;};}function patchUpdates(_0x213ec7){return function(_0x316ec){try{jsonpatch[_0xd0e9('0x23')](_0x316ec,_0x213ec7,!![]);}catch(_0x112010){return BPromise[_0xd0e9('0x24')](_0x112010);}return _0x316ec[_0xd0e9('0x25')]();};}function saveUpdates(_0x4af6dc,_0x1ddfc2){return function(_0xa9b6e7){if(_0xa9b6e7){return _0xa9b6e7[_0xd0e9('0x26')](_0x4af6dc)[_0xd0e9('0x27')](function(_0x346098){return _0x346098;});}return null;};}function removeEntity(_0x22778b,_0x97c169){return function(_0x41803b){if(_0x41803b){return _0x41803b[_0xd0e9('0x28')]()['then'](function(){_0x22778b[_0xd0e9('0x1a')](0xcc)[_0xd0e9('0x1b')]();});}};}function handleEntityNotFound(_0xc57183,_0x1c27f8){return function(_0x4ddd61){if(!_0x4ddd61){_0xc57183['sendStatus'](0x194);}return _0x4ddd61;};}function handleError(_0xf4f333,_0x5c54d5){_0x5c54d5=_0x5c54d5||0x1f4;return function(_0x22ec7e){logger['error'](_0x22ec7e[_0xd0e9('0x29')]);if(_0x22ec7e[_0xd0e9('0x2a')]){delete _0x22ec7e[_0xd0e9('0x2a')];}_0xf4f333['status'](_0x5c54d5)[_0xd0e9('0x2b')](_0x22ec7e);};}exports[_0xd0e9('0x2c')]=function(_0x2255fb,_0x380ba1){var _0xf56a56={},_0x222b7f={},_0x3a3c22={'count':0x0,'rows':[]};var _0x1ec88e=_[_0xd0e9('0x2d')](db[_0xd0e9('0x2e')][_0xd0e9('0x2f')],function(_0x1347ec){return{'name':_0x1347ec[_0xd0e9('0x30')],'type':_0x1347ec[_0xd0e9('0x31')]['key']};});_0x222b7f[_0xd0e9('0x32')]=_[_0xd0e9('0x2d')](_0x1ec88e,'name');_0x222b7f[_0xd0e9('0x33')]=_[_0xd0e9('0x34')](_0x2255fb[_0xd0e9('0x33')]);_0x222b7f[_0xd0e9('0x35')]=_['intersection'](_0x222b7f['model'],_0x222b7f[_0xd0e9('0x33')]);_0xf56a56[_0xd0e9('0x36')]=_[_0xd0e9('0x37')](_0x222b7f[_0xd0e9('0x32')],qs[_0xd0e9('0x38')](_0x2255fb[_0xd0e9('0x33')][_0xd0e9('0x38')]));_0xf56a56['attributes']=_0xf56a56[_0xd0e9('0x36')]['length']?_0xf56a56['attributes']:_0x222b7f[_0xd0e9('0x32')];if(!_0x2255fb['query'][_0xd0e9('0x39')](_0xd0e9('0x3a'))){_0xf56a56[_0xd0e9('0x1e')]=qs[_0xd0e9('0x1e')](_0x2255fb[_0xd0e9('0x33')][_0xd0e9('0x1e')]);_0xf56a56[_0xd0e9('0x1d')]=qs[_0xd0e9('0x1d')](_0x2255fb[_0xd0e9('0x33')]['offset']);}_0xf56a56[_0xd0e9('0x3b')]=qs[_0xd0e9('0x3c')](_0x2255fb[_0xd0e9('0x33')][_0xd0e9('0x3c')]);_0xf56a56[_0xd0e9('0x3d')]=qs[_0xd0e9('0x35')](_[_0xd0e9('0x3e')](_0x2255fb[_0xd0e9('0x33')],_0x222b7f[_0xd0e9('0x35')]),_0x1ec88e);if(_0x2255fb[_0xd0e9('0x33')][_0xd0e9('0x3f')]){_0xf56a56['where']=_[_0xd0e9('0x40')](_0xf56a56[_0xd0e9('0x3d')],{'$or':_['map'](_0x1ec88e,function(_0x191a83){if(_0x191a83[_0xd0e9('0x31')]!==_0xd0e9('0x41')){var _0x53f054={};_0x53f054[_0x191a83[_0xd0e9('0x2a')]]={'$like':'%'+_0x2255fb[_0xd0e9('0x33')]['filter']+'%'};return _0x53f054;}})});}_0xf56a56=_['merge']({},_0xf56a56,_0x2255fb[_0xd0e9('0x42')]);var _0x335ae3={'where':_0xf56a56[_0xd0e9('0x3d')]};return db[_0xd0e9('0x2e')][_0xd0e9('0x20')](_0x335ae3)[_0xd0e9('0x27')](function(_0x14b942){_0x3a3c22[_0xd0e9('0x20')]=_0x14b942;if(_0x2255fb[_0xd0e9('0x33')][_0xd0e9('0x43')]){_0xf56a56[_0xd0e9('0x44')]=[{'all':!![]}];}return db[_0xd0e9('0x2e')][_0xd0e9('0x45')](_0xf56a56);})['then'](function(_0x30fa38){_0x3a3c22[_0xd0e9('0x46')]=_0x30fa38;return _0x3a3c22;})[_0xd0e9('0x27')](respondWithFilteredResult(_0x380ba1,_0xf56a56))[_0xd0e9('0x47')](handleError(_0x380ba1,null));};exports[_0xd0e9('0x48')]=function(_0x15493c,_0x1f09db){var _0x4bfaab={'raw':!![],'where':{'id':_0x15493c[_0xd0e9('0x49')]['id']}},_0x1b78c8={};_0x1b78c8[_0xd0e9('0x32')]=_[_0xd0e9('0x34')](db[_0xd0e9('0x2e')]['rawAttributes']);_0x1b78c8[_0xd0e9('0x33')]=_[_0xd0e9('0x34')](_0x15493c['query']);_0x1b78c8[_0xd0e9('0x35')]=_[_0xd0e9('0x37')](_0x1b78c8[_0xd0e9('0x32')],_0x1b78c8[_0xd0e9('0x33')]);_0x4bfaab['attributes']=_[_0xd0e9('0x37')](_0x1b78c8[_0xd0e9('0x32')],qs[_0xd0e9('0x38')](_0x15493c[_0xd0e9('0x33')][_0xd0e9('0x38')]));_0x4bfaab[_0xd0e9('0x36')]=_0x4bfaab[_0xd0e9('0x36')][_0xd0e9('0x4a')]?_0x4bfaab[_0xd0e9('0x36')]:_0x1b78c8[_0xd0e9('0x32')];if(_0x15493c['query']['includeAll']){_0x4bfaab[_0xd0e9('0x44')]=[{'all':!![]}];}_0x4bfaab=_[_0xd0e9('0x40')]({},_0x4bfaab,_0x15493c[_0xd0e9('0x42')]);return db['Dynamics365Field'][_0xd0e9('0x4b')](_0x4bfaab)[_0xd0e9('0x27')](handleEntityNotFound(_0x1f09db,null))[_0xd0e9('0x27')](respondWithResult(_0x1f09db,null))[_0xd0e9('0x47')](handleError(_0x1f09db,null));};exports[_0xd0e9('0x4c')]=function(_0x39cb6c,_0x5cc441){return db['Dynamics365Field'][_0xd0e9('0x4c')](_0x39cb6c[_0xd0e9('0x4d')],{})[_0xd0e9('0x27')](respondWithResult(_0x5cc441,0xc9))[_0xd0e9('0x47')](handleError(_0x5cc441,null));};exports[_0xd0e9('0x26')]=function(_0x450ec9,_0x37a7d1){if(_0x450ec9[_0xd0e9('0x4d')]['id']){delete _0x450ec9[_0xd0e9('0x4d')]['id'];}return db[_0xd0e9('0x2e')]['find']({'where':{'id':_0x450ec9['params']['id']}})[_0xd0e9('0x27')](handleEntityNotFound(_0x37a7d1,null))[_0xd0e9('0x27')](saveUpdates(_0x450ec9[_0xd0e9('0x4d')],null))[_0xd0e9('0x27')](respondWithResult(_0x37a7d1,null))[_0xd0e9('0x47')](handleError(_0x37a7d1,null));};exports['destroy']=function(_0x1558fc,_0x4377df){return db[_0xd0e9('0x2e')][_0xd0e9('0x4b')]({'where':{'id':_0x1558fc[_0xd0e9('0x49')]['id']}})[_0xd0e9('0x27')](handleEntityNotFound(_0x4377df,null))[_0xd0e9('0x27')](removeEntity(_0x4377df,null))[_0xd0e9('0x47')](handleError(_0x4377df,null));}; \ No newline at end of file +var _0xa79b=['offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json'];(function(_0x136cbb,_0x2a97f9){var _0x333a69=function(_0x5dc5bb){while(--_0x5dc5bb){_0x136cbb['push'](_0x136cbb['shift']());}};_0x333a69(++_0x2a97f9);}(_0xa79b,0x1e5));var _0xba79=function(_0x4983ce,_0x13f756){_0x4983ce=_0x4983ce-0x0;var _0x2ad4c4=_0xa79b[_0x4983ce];return _0x2ad4c4;};'use strict';var emlformat=require(_0xba79('0x0'));var rimraf=require(_0xba79('0x1'));var zipdir=require(_0xba79('0x2'));var jsonpatch=require(_0xba79('0x3'));var rp=require(_0xba79('0x4'));var moment=require(_0xba79('0x5'));var BPromise=require(_0xba79('0x6'));var Mustache=require('mustache');var util=require(_0xba79('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xba79('0x8'));var ejs=require(_0xba79('0x9'));var fs=require('fs');var fs_extra=require(_0xba79('0xa'));var _=require(_0xba79('0xb'));var squel=require(_0xba79('0xc'));var crypto=require(_0xba79('0xd'));var jsforce=require(_0xba79('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xba79('0xf'));var Papa=require('papaparse');var Redis=require(_0xba79('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xba79('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xba79('0x12'));var logger=require(_0xba79('0x13'))(_0xba79('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xba79('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5cd2e1,_0x294b29){_0x294b29=_0x294b29||0xcc;return function(_0x190498){if(_0x190498){return _0x5cd2e1[_0xba79('0x16')](_0x294b29);}return _0x5cd2e1[_0xba79('0x17')](_0x294b29)[_0xba79('0x18')]();};}function respondWithResult(_0x14293f,_0x2f48a4){_0x2f48a4=_0x2f48a4||0xc8;return function(_0x4e97c5){if(_0x4e97c5){return _0x14293f[_0xba79('0x17')](_0x2f48a4)[_0xba79('0x19')](_0x4e97c5);}};}function respondWithFilteredResult(_0x553e4c,_0x212f3d){return function(_0xa8cf8b){if(_0xa8cf8b){var _0x20f9d8=typeof _0x212f3d[_0xba79('0x1a')]===_0xba79('0x1b')&&typeof _0x212f3d[_0xba79('0x1c')]===_0xba79('0x1b');var _0x20ec70=_0xa8cf8b[_0xba79('0x1d')];var _0x16c97a=_0x20f9d8?0x0:_0x212f3d[_0xba79('0x1a')];var _0x1f328d=_0x20f9d8?_0xa8cf8b[_0xba79('0x1d')]:_0x212f3d[_0xba79('0x1a')]+_0x212f3d[_0xba79('0x1c')];var _0x54bba3;if(_0x1f328d>=_0x20ec70){_0x1f328d=_0x20ec70;_0x54bba3=0xc8;}else{_0x54bba3=0xce;}_0x553e4c[_0xba79('0x17')](_0x54bba3);return _0x553e4c[_0xba79('0x1e')](_0xba79('0x1f'),_0x16c97a+'-'+_0x1f328d+'/'+_0x20ec70)[_0xba79('0x19')](_0xa8cf8b);}return null;};}function patchUpdates(_0x1e20db){return function(_0x506821){try{jsonpatch['apply'](_0x506821,_0x1e20db,!![]);}catch(_0x3c73a2){return BPromise[_0xba79('0x20')](_0x3c73a2);}return _0x506821[_0xba79('0x21')]();};}function saveUpdates(_0x23ab10,_0x315fdf){return function(_0x3391a9){if(_0x3391a9){return _0x3391a9[_0xba79('0x22')](_0x23ab10)['then'](function(_0x5e3977){return _0x5e3977;});}return null;};}function removeEntity(_0x3cad89,_0x509d2f){return function(_0x316292){if(_0x316292){return _0x316292[_0xba79('0x23')]()[_0xba79('0x24')](function(){_0x3cad89[_0xba79('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x477757,_0x34d2fa){return function(_0x47dab7){if(!_0x47dab7){_0x477757[_0xba79('0x16')](0x194);}return _0x47dab7;};}function handleError(_0x25102d,_0xfd758b){_0xfd758b=_0xfd758b||0x1f4;return function(_0x4fc0c4){logger[_0xba79('0x25')](_0x4fc0c4[_0xba79('0x26')]);if(_0x4fc0c4[_0xba79('0x27')]){delete _0x4fc0c4[_0xba79('0x27')];}_0x25102d[_0xba79('0x17')](_0xfd758b)[_0xba79('0x28')](_0x4fc0c4);};}exports[_0xba79('0x29')]=function(_0x38d643,_0x13936d){var _0x4c3bec={},_0x23d068={},_0x45a3d8={'count':0x0,'rows':[]};var _0xc80e28=_[_0xba79('0x2a')](db[_0xba79('0x2b')][_0xba79('0x2c')],function(_0x594f93){return{'name':_0x594f93[_0xba79('0x2d')],'type':_0x594f93[_0xba79('0x2e')][_0xba79('0x2f')]};});_0x23d068['model']=_['map'](_0xc80e28,_0xba79('0x27'));_0x23d068[_0xba79('0x30')]=_['keys'](_0x38d643[_0xba79('0x30')]);_0x23d068[_0xba79('0x31')]=_[_0xba79('0x32')](_0x23d068[_0xba79('0x33')],_0x23d068[_0xba79('0x30')]);_0x4c3bec[_0xba79('0x34')]=_['intersection'](_0x23d068['model'],qs[_0xba79('0x35')](_0x38d643['query'][_0xba79('0x35')]));_0x4c3bec['attributes']=_0x4c3bec[_0xba79('0x34')][_0xba79('0x36')]?_0x4c3bec[_0xba79('0x34')]:_0x23d068[_0xba79('0x33')];if(!_0x38d643[_0xba79('0x30')][_0xba79('0x37')](_0xba79('0x38'))){_0x4c3bec['limit']=qs['limit'](_0x38d643['query']['limit']);_0x4c3bec[_0xba79('0x1a')]=qs[_0xba79('0x1a')](_0x38d643[_0xba79('0x30')]['offset']);}_0x4c3bec[_0xba79('0x39')]=qs[_0xba79('0x3a')](_0x38d643[_0xba79('0x30')][_0xba79('0x3a')]);_0x4c3bec[_0xba79('0x3b')]=qs['filters'](_['pick'](_0x38d643[_0xba79('0x30')],_0x23d068[_0xba79('0x31')]),_0xc80e28);if(_0x38d643['query'][_0xba79('0x3c')]){_0x4c3bec[_0xba79('0x3b')]=_[_0xba79('0x3d')](_0x4c3bec[_0xba79('0x3b')],{'$or':_[_0xba79('0x2a')](_0xc80e28,function(_0x4534bc){if(_0x4534bc[_0xba79('0x2e')]!==_0xba79('0x3e')){var _0x5b4d28={};_0x5b4d28[_0x4534bc['name']]={'$like':'%'+_0x38d643[_0xba79('0x30')][_0xba79('0x3c')]+'%'};return _0x5b4d28;}})});}_0x4c3bec=_[_0xba79('0x3d')]({},_0x4c3bec,_0x38d643[_0xba79('0x3f')]);var _0x2afb7f={'where':_0x4c3bec[_0xba79('0x3b')]};return db['Dynamics365Field'][_0xba79('0x1d')](_0x2afb7f)['then'](function(_0x4eff0a){_0x45a3d8[_0xba79('0x1d')]=_0x4eff0a;if(_0x38d643[_0xba79('0x30')][_0xba79('0x40')]){_0x4c3bec[_0xba79('0x41')]=[{'all':!![]}];}return db[_0xba79('0x2b')]['findAll'](_0x4c3bec);})[_0xba79('0x24')](function(_0xb5265c){_0x45a3d8[_0xba79('0x42')]=_0xb5265c;return _0x45a3d8;})[_0xba79('0x24')](respondWithFilteredResult(_0x13936d,_0x4c3bec))[_0xba79('0x43')](handleError(_0x13936d,null));};exports[_0xba79('0x44')]=function(_0x45ecdd,_0xd6109c){var _0x45350a={'raw':!![],'where':{'id':_0x45ecdd[_0xba79('0x45')]['id']}},_0x1678de={};_0x1678de['model']=_[_0xba79('0x46')](db[_0xba79('0x2b')][_0xba79('0x2c')]);_0x1678de['query']=_[_0xba79('0x46')](_0x45ecdd[_0xba79('0x30')]);_0x1678de[_0xba79('0x31')]=_['intersection'](_0x1678de[_0xba79('0x33')],_0x1678de['query']);_0x45350a[_0xba79('0x34')]=_['intersection'](_0x1678de['model'],qs[_0xba79('0x35')](_0x45ecdd[_0xba79('0x30')][_0xba79('0x35')]));_0x45350a[_0xba79('0x34')]=_0x45350a[_0xba79('0x34')]['length']?_0x45350a[_0xba79('0x34')]:_0x1678de['model'];if(_0x45ecdd[_0xba79('0x30')]['includeAll']){_0x45350a[_0xba79('0x41')]=[{'all':!![]}];}_0x45350a=_['merge']({},_0x45350a,_0x45ecdd[_0xba79('0x3f')]);return db['Dynamics365Field'][_0xba79('0x47')](_0x45350a)['then'](handleEntityNotFound(_0xd6109c,null))[_0xba79('0x24')](respondWithResult(_0xd6109c,null))[_0xba79('0x43')](handleError(_0xd6109c,null));};exports['create']=function(_0x4e70d7,_0x358b0d){return db[_0xba79('0x2b')][_0xba79('0x48')](_0x4e70d7['body'],{})[_0xba79('0x24')](respondWithResult(_0x358b0d,0xc9))[_0xba79('0x43')](handleError(_0x358b0d,null));};exports[_0xba79('0x22')]=function(_0x2fcf58,_0xb26337){if(_0x2fcf58['body']['id']){delete _0x2fcf58['body']['id'];}return db['Dynamics365Field'][_0xba79('0x47')]({'where':{'id':_0x2fcf58[_0xba79('0x45')]['id']}})[_0xba79('0x24')](handleEntityNotFound(_0xb26337,null))[_0xba79('0x24')](saveUpdates(_0x2fcf58['body'],null))['then'](respondWithResult(_0xb26337,null))['catch'](handleError(_0xb26337,null));};exports[_0xba79('0x23')]=function(_0x5f52b6,_0x11e3b7){return db[_0xba79('0x2b')][_0xba79('0x47')]({'where':{'id':_0x5f52b6[_0xba79('0x45')]['id']}})[_0xba79('0x24')](handleEntityNotFound(_0x11e3b7,null))['then'](removeEntity(_0x11e3b7,null))[_0xba79('0x43')](handleError(_0x11e3b7,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index d3cc0c3..41bfea9 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 _0x5ff7=['./intDynamics365Field.attributes','exports','define','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1bba25,_0x17b3ee){var _0x3a58af=function(_0x2deabd){while(--_0x2deabd){_0x1bba25['push'](_0x1bba25['shift']());}};_0x3a58af(++_0x17b3ee);}(_0x5ff7,0x1e1));var _0x75ff=function(_0x50e40c,_0x2689c8){_0x50e40c=_0x50e40c-0x0;var _0x201c44=_0x5ff7[_0x50e40c];return _0x201c44;};'use strict';var _=require(_0x75ff('0x0'));var util=require(_0x75ff('0x1'));var logger=require(_0x75ff('0x2'))(_0x75ff('0x3'));var moment=require(_0x75ff('0x4'));var BPromise=require(_0x75ff('0x5'));var rp=require(_0x75ff('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x75ff('0x7'));var config=require(_0x75ff('0x8'));var attributes=require(_0x75ff('0x9'));module[_0x75ff('0xa')]=function(_0x124f11,_0x4ed69b){return _0x124f11[_0x75ff('0xb')]('Dynamics365Field',attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x75ff('0xc'),_0x75ff('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x83fe=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId'];(function(_0x53c552,_0x129587){var _0x599000=function(_0x519b95){while(--_0x519b95){_0x53c552['push'](_0x53c552['shift']());}};_0x599000(++_0x129587);}(_0x83fe,0x1c2));var _0xe83f=function(_0x1a910b,_0x1d0c67){_0x1a910b=_0x1a910b-0x0;var _0x58b72b=_0x83fe[_0x1a910b];return _0x58b72b;};'use strict';var _=require(_0xe83f('0x0'));var util=require(_0xe83f('0x1'));var logger=require(_0xe83f('0x2'))(_0xe83f('0x3'));var moment=require('moment');var BPromise=require(_0xe83f('0x4'));var rp=require(_0xe83f('0x5'));var fs=require('fs');var path=require(_0xe83f('0x6'));var rimraf=require(_0xe83f('0x7'));var config=require(_0xe83f('0x8'));var attributes=require(_0xe83f('0x9'));module[_0xe83f('0xa')]=function(_0xc6bfb2,_0x26071a){return _0xc6bfb2['define']('Dynamics365Field',attributes,{'tableName':_0xe83f('0xb'),'paranoid':![],'indexes':[{'name':_0xe83f('0xc'),'fields':[_0xe83f('0xd'),_0xe83f('0xe')],'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 ede9343..a262997 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 _0x63c6=['http','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x4fd1c1,_0x31e0b4){var _0x22fe21=function(_0x1d3f8a){while(--_0x1d3f8a){_0x4fd1c1['push'](_0x4fd1c1['shift']());}};_0x22fe21(++_0x31e0b4);}(_0x63c6,0x1c4));var _0x663c=function(_0x1b8223,_0x4b0bbd){_0x1b8223=_0x1b8223-0x0;var _0xee0c9=_0x63c6[_0x1b8223];return _0xee0c9;};'use strict';var _=require(_0x663c('0x0'));var util=require(_0x663c('0x1'));var moment=require(_0x663c('0x2'));var BPromise=require('bluebird');var rs=require(_0x663c('0x3'));var fs=require('fs');var Redis=require(_0x663c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x663c('0x5'));var logger=require('../../config/logger')(_0x663c('0x6'));var config=require(_0x663c('0x7'));var jayson=require(_0x663c('0x8'));var client=jayson[_0x663c('0x9')][_0x663c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3484e4,_0x296955,_0x253464){return new BPromise(function(_0x2bbf1a,_0xf7b490){return client['request'](_0x3484e4,_0x253464)[_0x663c('0xb')](function(_0x2132c3){logger['info'](_0x663c('0xc'),_0x296955,_0x663c('0xd'));logger['debug'](_0x663c('0xe'),_0x296955,_0x663c('0xd'),JSON[_0x663c('0xf')](_0x2132c3));if(_0x2132c3['error']){if(_0x2132c3['error'][_0x663c('0x10')]===0x1f4){logger['error'](_0x663c('0xc'),_0x296955,_0x2132c3[_0x663c('0x11')][_0x663c('0x12')]);return _0xf7b490(_0x2132c3['error'][_0x663c('0x12')]);}logger[_0x663c('0x11')](_0x663c('0xc'),_0x296955,_0x2132c3['error'][_0x663c('0x12')]);return _0x2bbf1a(_0x2132c3['error']['message']);}else{logger[_0x663c('0x13')]('Dynamics365Field,\x20%s,\x20%s',_0x296955,_0x663c('0xd'));_0x2bbf1a(_0x2132c3[_0x663c('0x14')][_0x663c('0x12')]);}})['catch'](function(_0x2472fa){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x296955,_0x2472fa);_0xf7b490(_0x2472fa);});});} \ No newline at end of file +var _0x29d6=['request\x20sent','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x29d6,0x10b));var _0x629d=function(_0x325eab,_0x20ea37){_0x325eab=_0x325eab-0x0;var _0x2c46dd=_0x29d6[_0x325eab];return _0x2c46dd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x629d('0x0'));var BPromise=require(_0x629d('0x1'));var rs=require(_0x629d('0x2'));var fs=require('fs');var Redis=require(_0x629d('0x3'));var db=require(_0x629d('0x4'))['db'];var utils=require(_0x629d('0x5'));var logger=require(_0x629d('0x6'))('rpc');var config=require(_0x629d('0x7'));var jayson=require(_0x629d('0x8'));var client=jayson[_0x629d('0x9')][_0x629d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4bc542,_0x5a4eb8,_0x39ff4b){return new BPromise(function(_0x42e0c5,_0x467459){return client[_0x629d('0xb')](_0x4bc542,_0x39ff4b)[_0x629d('0xc')](function(_0x36c34a){logger[_0x629d('0xd')](_0x629d('0xe'),_0x5a4eb8,'request\x20sent');logger[_0x629d('0xf')](_0x629d('0x10'),_0x5a4eb8,'request\x20sent',JSON[_0x629d('0x11')](_0x36c34a));if(_0x36c34a[_0x629d('0x12')]){if(_0x36c34a[_0x629d('0x12')][_0x629d('0x13')]===0x1f4){logger[_0x629d('0x12')](_0x629d('0xe'),_0x5a4eb8,_0x36c34a[_0x629d('0x12')]['message']);return _0x467459(_0x36c34a[_0x629d('0x12')][_0x629d('0x14')]);}logger[_0x629d('0x12')](_0x629d('0xe'),_0x5a4eb8,_0x36c34a['error'][_0x629d('0x14')]);return _0x42e0c5(_0x36c34a[_0x629d('0x12')][_0x629d('0x14')]);}else{logger[_0x629d('0xd')](_0x629d('0xe'),_0x5a4eb8,_0x629d('0x15'));_0x42e0c5(_0x36c34a[_0x629d('0x16')][_0x629d('0x14')]);}})[_0x629d('0x17')](function(_0x78dc24){logger[_0x629d('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0x5a4eb8,_0x78dc24);_0x467459(_0x78dc24);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 4db5a83..a7aa3d4 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 _0xbe0d=['connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','/:id','show','getConfigurations','get','getFields','post','addConfiguration','put','delete','destroy','exports','multer','util','path'];(function(_0x3a6b24,_0x517a93){var _0x5c075c=function(_0x22da97){while(--_0x22da97){_0x3a6b24['push'](_0x3a6b24['shift']());}};_0x5c075c(++_0x517a93);}(_0xbe0d,0x97));var _0xdbe0=function(_0x36fc99,_0xe2ad98){_0x36fc99=_0x36fc99-0x0;var _0xbabbab=_0xbe0d[_0x36fc99];return _0xbabbab;};'use strict';var multer=require(_0xdbe0('0x0'));var util=require(_0xdbe0('0x1'));var path=require(_0xdbe0('0x2'));var timeout=require(_0xdbe0('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xdbe0('0x4'));var auth=require(_0xdbe0('0x5'));var interaction=require(_0xdbe0('0x6'));var config=require(_0xdbe0('0x7'));var controller=require(_0xdbe0('0x8'));router['get']('/',auth[_0xdbe0('0x9')](),controller[_0xdbe0('0xa')]);router['get'](_0xdbe0('0xb'),auth[_0xdbe0('0x9')](),controller[_0xdbe0('0xc')]);router['get']('/:id/configurations',auth[_0xdbe0('0x9')](),controller[_0xdbe0('0xd')]);router[_0xdbe0('0xe')]('/:id/fields',auth[_0xdbe0('0x9')](),controller[_0xdbe0('0xf')]);router[_0xdbe0('0x10')]('/',auth[_0xdbe0('0x9')](),controller['create']);router[_0xdbe0('0x10')]('/:id/configurations',auth[_0xdbe0('0x9')](),controller[_0xdbe0('0x11')]);router[_0xdbe0('0x12')](_0xdbe0('0xb'),auth[_0xdbe0('0x9')](),controller['update']);router[_0xdbe0('0x13')]('/:id',auth[_0xdbe0('0x9')](),controller[_0xdbe0('0x14')]);module[_0xdbe0('0x15')]=router; \ No newline at end of file +var _0x6c3a=['../../config/environment','get','index','/:id','isAuthenticated','show','getConfigurations','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','../../components/interaction/service'];(function(_0x675708,_0x2a9a4e){var _0x1ac7e5=function(_0x15ce7f){while(--_0x15ce7f){_0x675708['push'](_0x675708['shift']());}};_0x1ac7e5(++_0x2a9a4e);}(_0x6c3a,0x1f4));var _0xa6c3=function(_0x5a27e8,_0x492a2f){_0x5a27e8=_0x5a27e8-0x0;var _0x4e38f7=_0x6c3a[_0x5a27e8];return _0x4e38f7;};'use strict';var multer=require(_0xa6c3('0x0'));var util=require(_0xa6c3('0x1'));var path=require(_0xa6c3('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa6c3('0x3'));var config=require(_0xa6c3('0x4'));var controller=require('./intFreshdeskAccount.controller');router[_0xa6c3('0x5')]('/',auth['isAuthenticated'](),controller[_0xa6c3('0x6')]);router[_0xa6c3('0x5')](_0xa6c3('0x7'),auth[_0xa6c3('0x8')](),controller[_0xa6c3('0x9')]);router[_0xa6c3('0x5')]('/:id/configurations',auth[_0xa6c3('0x8')](),controller[_0xa6c3('0xa')]);router[_0xa6c3('0x5')]('/:id/fields',auth[_0xa6c3('0x8')](),controller['getFields']);router[_0xa6c3('0xb')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0xa6c3('0x8')](),controller[_0xa6c3('0xc')]);router[_0xa6c3('0xd')]('/:id',auth[_0xa6c3('0x8')](),controller[_0xa6c3('0xe')]);router[_0xa6c3('0xf')](_0xa6c3('0x7'),auth[_0xa6c3('0x8')](),controller[_0xa6c3('0x10')]);module[_0xa6c3('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 4a34058..0537a3c 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 _0xc2c7=['exports','STRING','username','remoteUri'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xc2c7,0x134));var _0x7c2c=function(_0x239731,_0xdd2d54){_0x239731=_0x239731-0x0;var _0x1143cc=_0xc2c7[_0x239731];return _0x1143cc;};'use strict';var Sequelize=require('sequelize');module[_0x7c2c('0x0')]={'name':{'type':Sequelize[_0x7c2c('0x1')]},'description':{'type':Sequelize[_0x7c2c('0x1')]},'username':{'type':Sequelize[_0x7c2c('0x1')],'unique':_0x7c2c('0x2')},'apiKey':{'type':Sequelize[_0x7c2c('0x1')]},'remoteUri':{'type':Sequelize[_0x7c2c('0x1')],'unique':_0x7c2c('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xda2d=['exports','STRING','username'];(function(_0x53597f,_0x3156fd){var _0x535f67=function(_0x3df7ce){while(--_0x3df7ce){_0x53597f['push'](_0x53597f['shift']());}};_0x535f67(++_0x3156fd);}(_0xda2d,0x102));var _0xdda2=function(_0x10622e,_0x50121c){_0x10622e=_0x10622e-0x0;var _0x10840=_0xda2d[_0x10622e];return _0x10840;};'use strict';var Sequelize=require('sequelize');module[_0xdda2('0x0')]={'name':{'type':Sequelize[_0xdda2('0x1')]},'description':{'type':Sequelize[_0xdda2('0x1')]},'username':{'type':Sequelize[_0xdda2('0x1')],'unique':_0xdda2('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xdda2('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index ec931f5..a7b1a01 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 _0x2572=['getDescriptions','FreshdeskConfiguration','FreshdeskField','Subjects','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','toString','subject','description','priority','group','source','remove','includes','default','custom_text','custom_dropdown','choices','capitalize','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','index','map','FreshdeskAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','body','find','getConfigurations','findOne','order','pick','addConfiguration','AccountId','channel','Descriptions'];(function(_0x2518c6,_0x44d911){var _0x3eed9c=function(_0x34e950){while(--_0x34e950){_0x2518c6['push'](_0x2518c6['shift']());}};_0x3eed9c(++_0x44d911);}(_0x2572,0x110));var _0x2257=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x2572[_0x2b4411];return _0x8e41ef;};'use strict';var emlformat=require(_0x2257('0x0'));var rimraf=require(_0x2257('0x1'));var zipdir=require(_0x2257('0x2'));var jsonpatch=require(_0x2257('0x3'));var rp=require(_0x2257('0x4'));var moment=require(_0x2257('0x5'));var BPromise=require(_0x2257('0x6'));var Mustache=require(_0x2257('0x7'));var util=require(_0x2257('0x8'));var path=require('path');var sox=require(_0x2257('0x9'));var csv=require(_0x2257('0xa'));var ejs=require(_0x2257('0xb'));var fs=require('fs');var fs_extra=require(_0x2257('0xc'));var _=require(_0x2257('0xd'));var squel=require(_0x2257('0xe'));var crypto=require(_0x2257('0xf'));var jsforce=require(_0x2257('0x10'));var deskjs=require(_0x2257('0x11'));var toCsv=require('to-csv');var querystring=require(_0x2257('0x12'));var Papa=require(_0x2257('0x13'));var Redis=require('ioredis');var authService=require(_0x2257('0x14'));var qs=require(_0x2257('0x15'));var as=require(_0x2257('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2257('0x17'))(_0x2257('0x18'));var utils=require(_0x2257('0x19'));var config=require(_0x2257('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x2257('0x1b'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x578d2f,_0x7f8b71){_0x7f8b71=_0x7f8b71||0xcc;return function(_0x4537d2){if(_0x4537d2){return _0x578d2f[_0x2257('0x1c')](_0x7f8b71);}return _0x578d2f[_0x2257('0x1d')](_0x7f8b71)[_0x2257('0x1e')]();};}function respondWithResult(_0x32fdfe,_0x1738a3){_0x1738a3=_0x1738a3||0xc8;return function(_0x4c13fe){if(_0x4c13fe){return _0x32fdfe['status'](_0x1738a3)[_0x2257('0x1f')](_0x4c13fe);}};}function respondWithFilteredResult(_0x45efee,_0x2b4102){return function(_0x156d68){if(_0x156d68){var _0x591021=typeof _0x2b4102['offset']===_0x2257('0x20')&&typeof _0x2b4102['limit']==='undefined';var _0x5c8153=_0x156d68[_0x2257('0x21')];var _0x2d51e7=_0x591021?0x0:_0x2b4102[_0x2257('0x22')];var _0x2c3c79=_0x591021?_0x156d68[_0x2257('0x21')]:_0x2b4102[_0x2257('0x22')]+_0x2b4102[_0x2257('0x23')];var _0x3f3c83;if(_0x2c3c79>=_0x5c8153){_0x2c3c79=_0x5c8153;_0x3f3c83=0xc8;}else{_0x3f3c83=0xce;}_0x45efee[_0x2257('0x1d')](_0x3f3c83);return _0x45efee[_0x2257('0x24')](_0x2257('0x25'),_0x2d51e7+'-'+_0x2c3c79+'/'+_0x5c8153)[_0x2257('0x1f')](_0x156d68);}return null;};}function patchUpdates(_0x482240){return function(_0xe08b33){try{jsonpatch[_0x2257('0x26')](_0xe08b33,_0x482240,!![]);}catch(_0x5a62a3){return BPromise['reject'](_0x5a62a3);}return _0xe08b33[_0x2257('0x27')]();};}function saveUpdates(_0x5ae577,_0x31cd98){return function(_0x44a2da){if(_0x44a2da){return _0x44a2da[_0x2257('0x28')](_0x5ae577)[_0x2257('0x29')](function(_0x137d53){return _0x137d53;});}return null;};}function removeEntity(_0x1e220c,_0x1549aa){return function(_0x18fec2){if(_0x18fec2){return _0x18fec2[_0x2257('0x2a')]()[_0x2257('0x29')](function(){_0x1e220c['status'](0xcc)[_0x2257('0x1e')]();});}};}function handleEntityNotFound(_0x227155,_0x58e30d){return function(_0x37caa6){if(!_0x37caa6){_0x227155[_0x2257('0x1c')](0x194);}return _0x37caa6;};}function handleError(_0x4e0eaf,_0x1c1a76){_0x1c1a76=_0x1c1a76||0x1f4;return function(_0x1fdd82){logger['error'](_0x1fdd82[_0x2257('0x2b')]);if(_0x1fdd82[_0x2257('0x2c')]){delete _0x1fdd82[_0x2257('0x2c')];}_0x4e0eaf[_0x2257('0x1d')](_0x1c1a76)['send'](_0x1fdd82);};}exports[_0x2257('0x2d')]=function(_0x8952ad,_0x508cad){var _0x38e581={},_0x1c19c6={},_0x28403e={'count':0x0,'rows':[]};var _0x21931d=_[_0x2257('0x2e')](db[_0x2257('0x2f')][_0x2257('0x30')],function(_0x43f0b2){return{'name':_0x43f0b2[_0x2257('0x31')],'type':_0x43f0b2['type'][_0x2257('0x32')]};});_0x1c19c6[_0x2257('0x33')]=_['map'](_0x21931d,'name');_0x1c19c6[_0x2257('0x34')]=_[_0x2257('0x35')](_0x8952ad[_0x2257('0x34')]);_0x1c19c6[_0x2257('0x36')]=_[_0x2257('0x37')](_0x1c19c6[_0x2257('0x33')],_0x1c19c6['query']);_0x38e581[_0x2257('0x38')]=_[_0x2257('0x37')](_0x1c19c6[_0x2257('0x33')],qs[_0x2257('0x39')](_0x8952ad['query'][_0x2257('0x39')]));_0x38e581['attributes']=_0x38e581['attributes'][_0x2257('0x3a')]?_0x38e581[_0x2257('0x38')]:_0x1c19c6[_0x2257('0x33')];if(!_0x8952ad[_0x2257('0x34')][_0x2257('0x3b')](_0x2257('0x3c'))){_0x38e581[_0x2257('0x23')]=qs[_0x2257('0x23')](_0x8952ad[_0x2257('0x34')][_0x2257('0x23')]);_0x38e581[_0x2257('0x22')]=qs[_0x2257('0x22')](_0x8952ad[_0x2257('0x34')][_0x2257('0x22')]);}_0x38e581['order']=qs[_0x2257('0x3d')](_0x8952ad[_0x2257('0x34')][_0x2257('0x3d')]);_0x38e581[_0x2257('0x3e')]=qs[_0x2257('0x36')](_['pick'](_0x8952ad[_0x2257('0x34')],_0x1c19c6[_0x2257('0x36')]),_0x21931d);if(_0x8952ad[_0x2257('0x34')][_0x2257('0x3f')]){_0x38e581[_0x2257('0x3e')]=_[_0x2257('0x40')](_0x38e581[_0x2257('0x3e')],{'$or':_[_0x2257('0x2e')](_0x21931d,function(_0x33adbf){if(_0x33adbf[_0x2257('0x41')]!==_0x2257('0x42')){var _0x392104={};_0x392104[_0x33adbf[_0x2257('0x2c')]]={'$like':'%'+_0x8952ad['query'][_0x2257('0x3f')]+'%'};return _0x392104;}})});}_0x38e581=_[_0x2257('0x40')]({},_0x38e581,_0x8952ad[_0x2257('0x43')]);var _0x1e4541={'where':_0x38e581[_0x2257('0x3e')]};return db[_0x2257('0x2f')][_0x2257('0x21')](_0x1e4541)[_0x2257('0x29')](function(_0x41db20){_0x28403e[_0x2257('0x21')]=_0x41db20;if(_0x8952ad['query'][_0x2257('0x44')]){_0x38e581[_0x2257('0x45')]=[{'all':!![]}];}return db[_0x2257('0x2f')]['findAll'](_0x38e581);})[_0x2257('0x29')](function(_0x907312){_0x28403e[_0x2257('0x46')]=_0x907312;return _0x28403e;})[_0x2257('0x29')](respondWithFilteredResult(_0x508cad,_0x38e581))[_0x2257('0x47')](handleError(_0x508cad,null));};exports[_0x2257('0x48')]=function(_0x5d010c,_0x2fc24b){var _0x2be2ee={'raw':![],'where':{'id':_0x5d010c[_0x2257('0x49')]['id']}},_0x3ef686={};_0x3ef686['model']=_['keys'](db['FreshdeskAccount']['rawAttributes']);_0x3ef686[_0x2257('0x34')]=_['keys'](_0x5d010c['query']);_0x3ef686[_0x2257('0x36')]=_['intersection'](_0x3ef686['model'],_0x3ef686['query']);_0x2be2ee[_0x2257('0x38')]=_[_0x2257('0x37')](_0x3ef686[_0x2257('0x33')],qs[_0x2257('0x39')](_0x5d010c[_0x2257('0x34')][_0x2257('0x39')]));_0x2be2ee[_0x2257('0x38')]=_0x2be2ee['attributes'][_0x2257('0x3a')]?_0x2be2ee['attributes']:_0x3ef686[_0x2257('0x33')];if(_0x5d010c[_0x2257('0x34')][_0x2257('0x44')]){_0x2be2ee[_0x2257('0x45')]=[{'all':!![]}];}_0x2be2ee=_[_0x2257('0x40')]({},_0x2be2ee,_0x5d010c[_0x2257('0x43')]);return db[_0x2257('0x2f')]['find'](_0x2be2ee)[_0x2257('0x29')](handleEntityNotFound(_0x2fc24b,null))[_0x2257('0x29')](respondWithResult(_0x2fc24b,null))['catch'](handleError(_0x2fc24b,null));};exports[_0x2257('0x4a')]=function(_0x496696,_0x10d8b2){return db[_0x2257('0x2f')][_0x2257('0x4a')](_0x496696[_0x2257('0x4b')],{})[_0x2257('0x29')](respondWithResult(_0x10d8b2,0xc9))[_0x2257('0x47')](handleError(_0x10d8b2,null));};exports[_0x2257('0x28')]=function(_0x50c5cb,_0x404e8c){if(_0x50c5cb[_0x2257('0x4b')]['id']){delete _0x50c5cb['body']['id'];}return db[_0x2257('0x2f')]['find']({'where':{'id':_0x50c5cb[_0x2257('0x49')]['id']}})[_0x2257('0x29')](handleEntityNotFound(_0x404e8c,null))[_0x2257('0x29')](saveUpdates(_0x50c5cb[_0x2257('0x4b')],null))['then'](respondWithResult(_0x404e8c,null))[_0x2257('0x47')](handleError(_0x404e8c,null));};exports['destroy']=function(_0x456020,_0x53644a){return db[_0x2257('0x2f')][_0x2257('0x4c')]({'where':{'id':_0x456020[_0x2257('0x49')]['id']}})[_0x2257('0x29')](handleEntityNotFound(_0x53644a,null))[_0x2257('0x29')](removeEntity(_0x53644a,null))[_0x2257('0x47')](handleError(_0x53644a,null));};exports[_0x2257('0x4d')]=function(_0x3cd031,_0x5e8a15,_0x17343c){var _0x117a8c={};var _0x3a8600={};var _0x333638;var _0x3ae279;return db[_0x2257('0x2f')][_0x2257('0x4e')]({'where':{'id':_0x3cd031[_0x2257('0x49')]['id']}})[_0x2257('0x29')](handleEntityNotFound(_0x5e8a15,null))[_0x2257('0x29')](function(_0x194d90){if(_0x194d90){_0x333638=_0x194d90;_0x3a8600[_0x2257('0x33')]=_[_0x2257('0x35')](db['FreshdeskConfiguration'][_0x2257('0x30')]);_0x3a8600[_0x2257('0x34')]=_[_0x2257('0x35')](_0x3cd031['query']);_0x3a8600[_0x2257('0x36')]=_[_0x2257('0x37')](_0x3a8600[_0x2257('0x33')],_0x3a8600['query']);_0x117a8c[_0x2257('0x38')]=_[_0x2257('0x37')](_0x3a8600[_0x2257('0x33')],qs[_0x2257('0x39')](_0x3cd031[_0x2257('0x34')][_0x2257('0x39')]));_0x117a8c['attributes']=_0x117a8c['attributes'][_0x2257('0x3a')]?_0x117a8c[_0x2257('0x38')]:_0x3a8600[_0x2257('0x33')];_0x117a8c[_0x2257('0x4f')]=qs[_0x2257('0x3d')](_0x3cd031[_0x2257('0x34')][_0x2257('0x3d')]);_0x117a8c[_0x2257('0x3e')]=qs[_0x2257('0x36')](_[_0x2257('0x50')](_0x3cd031[_0x2257('0x34')],_0x3a8600[_0x2257('0x36')]));if(_0x3cd031[_0x2257('0x34')][_0x2257('0x3f')]){_0x117a8c[_0x2257('0x3e')]=_[_0x2257('0x40')](_0x117a8c[_0x2257('0x3e')],{'$or':_[_0x2257('0x2e')](_0x117a8c[_0x2257('0x38')],function(_0x4bf731){var _0x5f4965={};_0x5f4965[_0x4bf731]={'$like':'%'+_0x3cd031['query'][_0x2257('0x3f')]+'%'};return _0x5f4965;})});}_0x117a8c=_[_0x2257('0x40')]({},_0x117a8c,_0x3cd031[_0x2257('0x43')]);return _0x333638[_0x2257('0x4d')](_0x117a8c);}})[_0x2257('0x29')](function(_0x412efa){if(_0x412efa){_0x3ae279=_0x412efa[_0x2257('0x3a')];if(!_0x3cd031[_0x2257('0x34')]['hasOwnProperty']('nolimit')){_0x117a8c[_0x2257('0x23')]=qs['limit'](_0x3cd031[_0x2257('0x34')]['limit']);_0x117a8c[_0x2257('0x22')]=qs['offset'](_0x3cd031[_0x2257('0x34')][_0x2257('0x22')]);}return _0x333638[_0x2257('0x4d')](_0x117a8c);}})[_0x2257('0x29')](function(_0x22c4ea){if(_0x22c4ea){return _0x22c4ea?{'count':_0x3ae279,'rows':_0x22c4ea}:null;}})[_0x2257('0x29')](respondWithResult(_0x5e8a15,null))[_0x2257('0x47')](handleError(_0x5e8a15,null));};exports[_0x2257('0x51')]=function(_0x553947,_0x3b2da6,_0x28f948){if(_0x553947[_0x2257('0x4b')]['id']){delete _0x553947[_0x2257('0x4b')]['id'];}return db[_0x2257('0x2f')][_0x2257('0x4e')]({'where':{'id':_0x553947[_0x2257('0x49')]['id']}})['then'](handleEntityNotFound(_0x3b2da6,null))[_0x2257('0x29')](function(_0xa07de9){if(_0xa07de9){_0x553947[_0x2257('0x4b')][_0x2257('0x52')]=_0xa07de9['id'];_0x553947[_0x2257('0x4b')]['Subjects']=integrations['getSubjects'](_0x553947['body'][_0x2257('0x53')],_0x553947[_0x2257('0x4b')][_0x2257('0x41')]);_0x553947[_0x2257('0x4b')][_0x2257('0x54')]=integrations[_0x2257('0x55')](_0x553947[_0x2257('0x4b')][_0x2257('0x53')],_0x553947['body'][_0x2257('0x41')]);return db[_0x2257('0x56')]['create'](_0x553947[_0x2257('0x4b')],{'include':[{'model':db[_0x2257('0x57')],'as':_0x2257('0x58')},{'model':db[_0x2257('0x57')],'as':_0x2257('0x54')}]});}return null;})[_0x2257('0x29')](respondWithResult(_0x3b2da6,null))[_0x2257('0x47')](handleError(_0x3b2da6,null));};exports[_0x2257('0x59')]=function(_0x5b1972,_0x46c88e,_0x375a2b){var _0x56b1d0='';return db[_0x2257('0x2f')]['findOne']({'where':{'id':_0x5b1972[_0x2257('0x49')]['id']},'attributes':['id',_0x2257('0x5a'),_0x2257('0x5b')]})[_0x2257('0x29')](handleEntityNotFound(_0x46c88e,null))[_0x2257('0x29')](function(_0x2005e1){if(_0x2005e1){_0x56b1d0=_0x2005e1['remoteUri'];var _0x498f1f=_0x56b1d0[_0x2257('0x5c')](-0x1);if(_0x498f1f==='/'){_0x56b1d0=_0x56b1d0[_0x2257('0x5d')](0x0,_0x56b1d0[_0x2257('0x5e')](_0x498f1f));}return rp({'method':_0x2257('0x5f'),'uri':util[_0x2257('0x60')](_0x2257('0x61'),_0x56b1d0,_0x2257('0x62')),'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(util['format']('%s:X',_0x2005e1[_0x2257('0x5b')]))[_0x2257('0x63')]('base64'))},'json':!![]});}})[_0x2257('0x29')](function(_0x1dd412){if(_0x1dd412){var _0x3aafa1=['requester',_0x2257('0x64'),'agent',_0x2257('0x65'),_0x2257('0x1d'),_0x2257('0x66'),_0x2257('0x67'),_0x2257('0x68'),'ticket_type',_0x2257('0x67'),'company'];_[_0x2257('0x69')](_0x1dd412,function(_0x4c5ad0){return _0x3aafa1[_0x2257('0x6a')](_0x4c5ad0[_0x2257('0x2c')])||!_0x4c5ad0[_0x2257('0x6b')]&&_0x4c5ad0[_0x2257('0x41')]!==_0x2257('0x6c')&&_0x4c5ad0[_0x2257('0x41')]!==_0x2257('0x6d');});return{'count':_0x1dd412[_0x2257('0x3a')],'rows':_[_0x2257('0x2e')](_0x1dd412,function(_0x495705){return{'id':_0x495705[_0x2257('0x2c')],'name':_0x495705['label'],'custom':!_0x495705[_0x2257('0x6b')],'options':_0x495705[_0x2257('0x6e')]?_[_0x2257('0x2e')](_0x495705[_0x2257('0x6e')],function(_0x45cb75){return{'name':_[_0x2257('0x6f')](_0x45cb75),'value':_0x45cb75};}):[]};})};}})[_0x2257('0x29')](respondWithResult(_0x46c88e,null))['catch'](function(_0x4b26ba){var _0x4684a0=_0x5b1972[_0x2257('0x34')][_0x2257('0x70')]?0x1f4:_0x4b26ba['statusCode']||0x1f4;logger[_0x2257('0x71')](_0x2257('0x72'),_0x2257('0x59'),_0x4684a0,JSON[_0x2257('0x73')](_0x4b26ba));delete _0x4b26ba['name'];if(_0x4684a0===0x191){_0x4684a0=0x190;}_0x46c88e[_0x2257('0x1d')](_0x4684a0)[_0x2257('0x74')](_0x5b1972[_0x2257('0x34')][_0x2257('0x70')]?{'message':_0x2257('0x75'),'statusCode':_0x4b26ba[_0x2257('0x76')]}:_0x4b26ba);});}; \ No newline at end of file +var _0x5668=['%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','requester','subject','agent','priority','source','group','company','remove','includes','default','custom_text','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','filter','include','FreshdeskAccount','findAll','rows','show','params','includeAll','options','catch','create','body','find','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format'];(function(_0xf88e85,_0x1b3355){var _0x5b6d3c=function(_0x1242f1){while(--_0x1242f1){_0xf88e85['push'](_0xf88e85['shift']());}};_0x5b6d3c(++_0x1b3355);}(_0x5668,0x8b));var _0x8566=function(_0x1c35f0,_0x1e3177){_0x1c35f0=_0x1c35f0-0x0;var _0x3b71e1=_0x5668[_0x1c35f0];return _0x3b71e1;};'use strict';var emlformat=require(_0x8566('0x0'));var rimraf=require(_0x8566('0x1'));var zipdir=require(_0x8566('0x2'));var jsonpatch=require(_0x8566('0x3'));var rp=require(_0x8566('0x4'));var moment=require(_0x8566('0x5'));var BPromise=require(_0x8566('0x6'));var Mustache=require(_0x8566('0x7'));var util=require(_0x8566('0x8'));var path=require(_0x8566('0x9'));var sox=require(_0x8566('0xa'));var csv=require(_0x8566('0xb'));var ejs=require(_0x8566('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8566('0xd'));var squel=require(_0x8566('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8566('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8566('0x10'));var Redis=require('ioredis');var authService=require(_0x8566('0x11'));var qs=require(_0x8566('0x12'));var as=require(_0x8566('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8566('0x14'))(_0x8566('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x8566('0x16'));function respondWithStatusCode(_0x3318a3,_0x2025a2){_0x2025a2=_0x2025a2||0xcc;return function(_0x2cb841){if(_0x2cb841){return _0x3318a3[_0x8566('0x17')](_0x2025a2);}return _0x3318a3['status'](_0x2025a2)['end']();};}function respondWithResult(_0x47bef1,_0x489470){_0x489470=_0x489470||0xc8;return function(_0x56ebd9){if(_0x56ebd9){return _0x47bef1[_0x8566('0x18')](_0x489470)[_0x8566('0x19')](_0x56ebd9);}};}function respondWithFilteredResult(_0x3076df,_0x396f1b){return function(_0x39faee){if(_0x39faee){var _0x4b777d=typeof _0x396f1b[_0x8566('0x1a')]===_0x8566('0x1b')&&typeof _0x396f1b[_0x8566('0x1c')]==='undefined';var _0xba1367=_0x39faee[_0x8566('0x1d')];var _0x2eed85=_0x4b777d?0x0:_0x396f1b['offset'];var _0x41cb27=_0x4b777d?_0x39faee['count']:_0x396f1b['offset']+_0x396f1b[_0x8566('0x1c')];var _0x5e9ca7;if(_0x41cb27>=_0xba1367){_0x41cb27=_0xba1367;_0x5e9ca7=0xc8;}else{_0x5e9ca7=0xce;}_0x3076df[_0x8566('0x18')](_0x5e9ca7);return _0x3076df['set'](_0x8566('0x1e'),_0x2eed85+'-'+_0x41cb27+'/'+_0xba1367)[_0x8566('0x19')](_0x39faee);}return null;};}function patchUpdates(_0x43fc7c){return function(_0x17fdb4){try{jsonpatch[_0x8566('0x1f')](_0x17fdb4,_0x43fc7c,!![]);}catch(_0x440d2d){return BPromise[_0x8566('0x20')](_0x440d2d);}return _0x17fdb4['save']();};}function saveUpdates(_0x5b06e6,_0x3d2cf8){return function(_0x1ccc60){if(_0x1ccc60){return _0x1ccc60[_0x8566('0x21')](_0x5b06e6)[_0x8566('0x22')](function(_0x4e19cf){return _0x4e19cf;});}return null;};}function removeEntity(_0x183435,_0x64127b){return function(_0x57cc9d){if(_0x57cc9d){return _0x57cc9d[_0x8566('0x23')]()[_0x8566('0x22')](function(){_0x183435['status'](0xcc)[_0x8566('0x24')]();});}};}function handleEntityNotFound(_0xf4a090,_0x18ee17){return function(_0x4d0e60){if(!_0x4d0e60){_0xf4a090[_0x8566('0x17')](0x194);}return _0x4d0e60;};}function handleError(_0x451bbf,_0x327f7d){_0x327f7d=_0x327f7d||0x1f4;return function(_0x3e90af){logger[_0x8566('0x25')](_0x3e90af[_0x8566('0x26')]);if(_0x3e90af[_0x8566('0x27')]){delete _0x3e90af['name'];}_0x451bbf[_0x8566('0x18')](_0x327f7d)[_0x8566('0x28')](_0x3e90af);};}exports[_0x8566('0x29')]=function(_0x8a1dff,_0xea61c9){var _0x3a3106={},_0x1e4e05={},_0x8637b3={'count':0x0,'rows':[]};var _0x504722=_[_0x8566('0x2a')](db['FreshdeskAccount']['rawAttributes'],function(_0xae691c){return{'name':_0xae691c[_0x8566('0x2b')],'type':_0xae691c['type'][_0x8566('0x2c')]};});_0x1e4e05[_0x8566('0x2d')]=_[_0x8566('0x2a')](_0x504722,_0x8566('0x27'));_0x1e4e05[_0x8566('0x2e')]=_[_0x8566('0x2f')](_0x8a1dff['query']);_0x1e4e05['filters']=_[_0x8566('0x30')](_0x1e4e05[_0x8566('0x2d')],_0x1e4e05['query']);_0x3a3106[_0x8566('0x31')]=_['intersection'](_0x1e4e05[_0x8566('0x2d')],qs['fields'](_0x8a1dff[_0x8566('0x2e')][_0x8566('0x32')]));_0x3a3106['attributes']=_0x3a3106[_0x8566('0x31')][_0x8566('0x33')]?_0x3a3106[_0x8566('0x31')]:_0x1e4e05[_0x8566('0x2d')];if(!_0x8a1dff[_0x8566('0x2e')][_0x8566('0x34')](_0x8566('0x35'))){_0x3a3106[_0x8566('0x1c')]=qs['limit'](_0x8a1dff[_0x8566('0x2e')][_0x8566('0x1c')]);_0x3a3106[_0x8566('0x1a')]=qs['offset'](_0x8a1dff[_0x8566('0x2e')]['offset']);}_0x3a3106[_0x8566('0x36')]=qs[_0x8566('0x37')](_0x8a1dff[_0x8566('0x2e')][_0x8566('0x37')]);_0x3a3106[_0x8566('0x38')]=qs[_0x8566('0x39')](_[_0x8566('0x3a')](_0x8a1dff['query'],_0x1e4e05['filters']),_0x504722);if(_0x8a1dff[_0x8566('0x2e')]['filter']){_0x3a3106[_0x8566('0x38')]=_[_0x8566('0x3b')](_0x3a3106['where'],{'$or':_[_0x8566('0x2a')](_0x504722,function(_0x5a77b9){if(_0x5a77b9[_0x8566('0x3c')]!=='VIRTUAL'){var _0x2eb047={};_0x2eb047[_0x5a77b9[_0x8566('0x27')]]={'$like':'%'+_0x8a1dff['query'][_0x8566('0x3d')]+'%'};return _0x2eb047;}})});}_0x3a3106=_['merge']({},_0x3a3106,_0x8a1dff['options']);var _0x5a11d0={'where':_0x3a3106[_0x8566('0x38')]};return db['FreshdeskAccount'][_0x8566('0x1d')](_0x5a11d0)[_0x8566('0x22')](function(_0x2d84fa){_0x8637b3[_0x8566('0x1d')]=_0x2d84fa;if(_0x8a1dff[_0x8566('0x2e')]['includeAll']){_0x3a3106[_0x8566('0x3e')]=[{'all':!![]}];}return db[_0x8566('0x3f')][_0x8566('0x40')](_0x3a3106);})[_0x8566('0x22')](function(_0x10c77d){_0x8637b3[_0x8566('0x41')]=_0x10c77d;return _0x8637b3;})[_0x8566('0x22')](respondWithFilteredResult(_0xea61c9,_0x3a3106))['catch'](handleError(_0xea61c9,null));};exports[_0x8566('0x42')]=function(_0x1eb745,_0xd6e7fc){var _0x34336b={'raw':![],'where':{'id':_0x1eb745[_0x8566('0x43')]['id']}},_0x518c66={};_0x518c66['model']=_[_0x8566('0x2f')](db[_0x8566('0x3f')]['rawAttributes']);_0x518c66[_0x8566('0x2e')]=_['keys'](_0x1eb745[_0x8566('0x2e')]);_0x518c66['filters']=_[_0x8566('0x30')](_0x518c66[_0x8566('0x2d')],_0x518c66[_0x8566('0x2e')]);_0x34336b[_0x8566('0x31')]=_['intersection'](_0x518c66['model'],qs[_0x8566('0x32')](_0x1eb745[_0x8566('0x2e')][_0x8566('0x32')]));_0x34336b['attributes']=_0x34336b[_0x8566('0x31')][_0x8566('0x33')]?_0x34336b['attributes']:_0x518c66[_0x8566('0x2d')];if(_0x1eb745[_0x8566('0x2e')][_0x8566('0x44')]){_0x34336b[_0x8566('0x3e')]=[{'all':!![]}];}_0x34336b=_[_0x8566('0x3b')]({},_0x34336b,_0x1eb745[_0x8566('0x45')]);return db[_0x8566('0x3f')]['find'](_0x34336b)[_0x8566('0x22')](handleEntityNotFound(_0xd6e7fc,null))[_0x8566('0x22')](respondWithResult(_0xd6e7fc,null))[_0x8566('0x46')](handleError(_0xd6e7fc,null));};exports[_0x8566('0x47')]=function(_0x4a1ea1,_0x2bb7db){return db['FreshdeskAccount'][_0x8566('0x47')](_0x4a1ea1[_0x8566('0x48')],{})[_0x8566('0x22')](respondWithResult(_0x2bb7db,0xc9))[_0x8566('0x46')](handleError(_0x2bb7db,null));};exports[_0x8566('0x21')]=function(_0x58e580,_0x208a65){if(_0x58e580['body']['id']){delete _0x58e580['body']['id'];}return db[_0x8566('0x3f')][_0x8566('0x49')]({'where':{'id':_0x58e580[_0x8566('0x43')]['id']}})[_0x8566('0x22')](handleEntityNotFound(_0x208a65,null))[_0x8566('0x22')](saveUpdates(_0x58e580[_0x8566('0x48')],null))['then'](respondWithResult(_0x208a65,null))[_0x8566('0x46')](handleError(_0x208a65,null));};exports[_0x8566('0x23')]=function(_0x19b679,_0x3e53b4){return db[_0x8566('0x3f')][_0x8566('0x49')]({'where':{'id':_0x19b679[_0x8566('0x43')]['id']}})[_0x8566('0x22')](handleEntityNotFound(_0x3e53b4,null))[_0x8566('0x22')](removeEntity(_0x3e53b4,null))[_0x8566('0x46')](handleError(_0x3e53b4,null));};exports[_0x8566('0x4a')]=function(_0x4eb953,_0x3ed73e,_0x13ce7d){var _0x1f5f34={};var _0x707c01={};var _0x2e380a;var _0x4e771c;return db[_0x8566('0x3f')][_0x8566('0x4b')]({'where':{'id':_0x4eb953['params']['id']}})[_0x8566('0x22')](handleEntityNotFound(_0x3ed73e,null))[_0x8566('0x22')](function(_0x21ca63){if(_0x21ca63){_0x2e380a=_0x21ca63;_0x707c01[_0x8566('0x2d')]=_[_0x8566('0x2f')](db[_0x8566('0x4c')]['rawAttributes']);_0x707c01[_0x8566('0x2e')]=_[_0x8566('0x2f')](_0x4eb953[_0x8566('0x2e')]);_0x707c01['filters']=_[_0x8566('0x30')](_0x707c01[_0x8566('0x2d')],_0x707c01[_0x8566('0x2e')]);_0x1f5f34['attributes']=_['intersection'](_0x707c01[_0x8566('0x2d')],qs[_0x8566('0x32')](_0x4eb953[_0x8566('0x2e')][_0x8566('0x32')]));_0x1f5f34['attributes']=_0x1f5f34[_0x8566('0x31')][_0x8566('0x33')]?_0x1f5f34['attributes']:_0x707c01['model'];_0x1f5f34[_0x8566('0x36')]=qs[_0x8566('0x37')](_0x4eb953[_0x8566('0x2e')][_0x8566('0x37')]);_0x1f5f34[_0x8566('0x38')]=qs[_0x8566('0x39')](_[_0x8566('0x3a')](_0x4eb953[_0x8566('0x2e')],_0x707c01[_0x8566('0x39')]));if(_0x4eb953[_0x8566('0x2e')][_0x8566('0x3d')]){_0x1f5f34[_0x8566('0x38')]=_['merge'](_0x1f5f34[_0x8566('0x38')],{'$or':_[_0x8566('0x2a')](_0x1f5f34['attributes'],function(_0x3f9bf2){var _0x240665={};_0x240665[_0x3f9bf2]={'$like':'%'+_0x4eb953[_0x8566('0x2e')][_0x8566('0x3d')]+'%'};return _0x240665;})});}_0x1f5f34=_['merge']({},_0x1f5f34,_0x4eb953[_0x8566('0x45')]);return _0x2e380a['getConfigurations'](_0x1f5f34);}})['then'](function(_0x3f75f3){if(_0x3f75f3){_0x4e771c=_0x3f75f3['length'];if(!_0x4eb953['query'][_0x8566('0x34')]('nolimit')){_0x1f5f34[_0x8566('0x1c')]=qs[_0x8566('0x1c')](_0x4eb953[_0x8566('0x2e')]['limit']);_0x1f5f34[_0x8566('0x1a')]=qs[_0x8566('0x1a')](_0x4eb953[_0x8566('0x2e')][_0x8566('0x1a')]);}return _0x2e380a[_0x8566('0x4a')](_0x1f5f34);}})[_0x8566('0x22')](function(_0x52bbf9){if(_0x52bbf9){return _0x52bbf9?{'count':_0x4e771c,'rows':_0x52bbf9}:null;}})[_0x8566('0x22')](respondWithResult(_0x3ed73e,null))['catch'](handleError(_0x3ed73e,null));};exports[_0x8566('0x4d')]=function(_0x5405b3,_0x3c5bfc,_0x41a453){if(_0x5405b3['body']['id']){delete _0x5405b3[_0x8566('0x48')]['id'];}return db[_0x8566('0x3f')][_0x8566('0x4b')]({'where':{'id':_0x5405b3[_0x8566('0x43')]['id']}})[_0x8566('0x22')](handleEntityNotFound(_0x3c5bfc,null))['then'](function(_0x1f373b){if(_0x1f373b){_0x5405b3['body'][_0x8566('0x4e')]=_0x1f373b['id'];_0x5405b3['body'][_0x8566('0x4f')]=integrations[_0x8566('0x50')](_0x5405b3[_0x8566('0x48')][_0x8566('0x51')],_0x5405b3[_0x8566('0x48')][_0x8566('0x3c')]);_0x5405b3[_0x8566('0x48')][_0x8566('0x52')]=integrations[_0x8566('0x53')](_0x5405b3['body'][_0x8566('0x51')],_0x5405b3[_0x8566('0x48')][_0x8566('0x3c')]);return db[_0x8566('0x4c')]['create'](_0x5405b3[_0x8566('0x48')],{'include':[{'model':db[_0x8566('0x54')],'as':_0x8566('0x4f')},{'model':db[_0x8566('0x54')],'as':'Descriptions'}]});}return null;})[_0x8566('0x22')](respondWithResult(_0x3c5bfc,null))[_0x8566('0x46')](handleError(_0x3c5bfc,null));};exports[_0x8566('0x55')]=function(_0x310955,_0x3a4821,_0x3775db){var _0x32c5b7='';return db[_0x8566('0x3f')][_0x8566('0x4b')]({'where':{'id':_0x310955[_0x8566('0x43')]['id']},'attributes':['id',_0x8566('0x56'),_0x8566('0x57')]})[_0x8566('0x22')](handleEntityNotFound(_0x3a4821,null))[_0x8566('0x22')](function(_0x495bb8){if(_0x495bb8){_0x32c5b7=_0x495bb8[_0x8566('0x56')];var _0x3e538c=_0x32c5b7[_0x8566('0x58')](-0x1);if(_0x3e538c==='/'){_0x32c5b7=_0x32c5b7[_0x8566('0x59')](0x0,_0x32c5b7[_0x8566('0x5a')](_0x3e538c));}return rp({'method':_0x8566('0x5b'),'uri':util[_0x8566('0x5c')](_0x8566('0x5d'),_0x32c5b7,_0x8566('0x5e')),'headers':{'Authorization':util[_0x8566('0x5c')](_0x8566('0x5f'),new Buffer(util[_0x8566('0x5c')](_0x8566('0x60'),_0x495bb8[_0x8566('0x57')]))[_0x8566('0x61')]('base64'))},'json':!![]});}})['then'](function(_0x1e8773){if(_0x1e8773){var _0x1d4a3f=[_0x8566('0x62'),_0x8566('0x63'),_0x8566('0x64'),'description',_0x8566('0x18'),_0x8566('0x65'),'group',_0x8566('0x66'),'ticket_type',_0x8566('0x67'),_0x8566('0x68')];_[_0x8566('0x69')](_0x1e8773,function(_0x996cdd){return _0x1d4a3f[_0x8566('0x6a')](_0x996cdd['name'])||!_0x996cdd[_0x8566('0x6b')]&&_0x996cdd[_0x8566('0x3c')]!==_0x8566('0x6c')&&_0x996cdd[_0x8566('0x3c')]!=='custom_dropdown';});return{'count':_0x1e8773['length'],'rows':_[_0x8566('0x2a')](_0x1e8773,function(_0x5c0d16){return{'id':_0x5c0d16['name'],'name':_0x5c0d16[_0x8566('0x6d')],'custom':!_0x5c0d16['default'],'options':_0x5c0d16[_0x8566('0x6e')]?_[_0x8566('0x2a')](_0x5c0d16[_0x8566('0x6e')],function(_0x4f6ef4){return{'name':_[_0x8566('0x6f')](_0x4f6ef4),'value':_0x4f6ef4};}):[]};})};}})['then'](respondWithResult(_0x3a4821,null))['catch'](function(_0x594a83){var _0x7558db=_0x310955[_0x8566('0x2e')][_0x8566('0x70')]?0x1f4:_0x594a83[_0x8566('0x71')]||0x1f4;logger[_0x8566('0x25')](_0x8566('0x72'),_0x8566('0x55'),_0x7558db,JSON[_0x8566('0x73')](_0x594a83));delete _0x594a83['name'];if(_0x7558db===0x191){_0x7558db=0x190;}_0x3a4821[_0x8566('0x18')](_0x7558db)['send'](_0x310955[_0x8566('0x2e')][_0x8566('0x70')]?{'message':'Wrong\x20credentials','statusCode':_0x594a83[_0x8566('0x71')]}:_0x594a83);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index e45ebe1..9fa777b 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 _0xdcc5=['define','int_freshdesk_accounts','util','../../config/logger','api','moment','bluebird','path','../../config/environment','../../components/integrations/configuration'];(function(_0x19b140,_0x2d11aa){var _0x1f32ac=function(_0x3df05c){while(--_0x3df05c){_0x19b140['push'](_0x19b140['shift']());}};_0x1f32ac(++_0x2d11aa);}(_0xdcc5,0x12e));var _0x5dcc=function(_0x10d93c,_0x6b081a){_0x10d93c=_0x10d93c-0x0;var _0x3a1ae5=_0xdcc5[_0x10d93c];return _0x3a1ae5;};'use strict';var _=require('lodash');var util=require(_0x5dcc('0x0'));var logger=require(_0x5dcc('0x1'))(_0x5dcc('0x2'));var moment=require(_0x5dcc('0x3'));var BPromise=require(_0x5dcc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5dcc('0x5'));var rimraf=require('rimraf');var config=require(_0x5dcc('0x6'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x5dcc('0x7'));module['exports']=function(_0xf500fd,_0x474bed){return _0xf500fd[_0x5dcc('0x8')]('FreshdeskAccount',attributes,{'tableName':_0x5dcc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef1f=['./intFreshdeskAccount.attributes','exports','define','int_freshdesk_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1790b1,_0xad90b9){var _0x5f3de5=function(_0x303011){while(--_0x303011){_0x1790b1['push'](_0x1790b1['shift']());}};_0x5f3de5(++_0xad90b9);}(_0xef1f,0xfb));var _0xfef1=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xef1f[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xfef1('0x0'));var util=require('util');var logger=require(_0xfef1('0x1'))(_0xfef1('0x2'));var moment=require(_0xfef1('0x3'));var BPromise=require(_0xfef1('0x4'));var rp=require(_0xfef1('0x5'));var fs=require('fs');var path=require(_0xfef1('0x6'));var rimraf=require(_0xfef1('0x7'));var config=require(_0xfef1('0x8'));var attributes=require(_0xfef1('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xfef1('0xa')]=function(_0x20d8ec,_0x11ba6d){return _0x20d8ec[_0xfef1('0xb')]('FreshdeskAccount',attributes,{'tableName':_0xfef1('0xc'),'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 0e27c07..ef1f7ee 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 _0x5a24=['where','attributes','limit','map','include','model','GetFreshdeskAccount','ShowFreshdeskAccount','then','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','FreshdeskAccount','findAll','options','raw'];(function(_0x25983c,_0x3aabc8){var _0x4814e2=function(_0xdb069e){while(--_0xdb069e){_0x25983c['push'](_0x25983c['shift']());}};_0x4814e2(++_0x3aabc8);}(_0x5a24,0x6f));var _0x45a2=function(_0x565e8e,_0xd87e30){_0x565e8e=_0x565e8e-0x0;var _0x4eac87=_0x5a24[_0x565e8e];return _0x4eac87;};'use strict';var _=require(_0x45a2('0x0'));var util=require(_0x45a2('0x1'));var moment=require(_0x45a2('0x2'));var BPromise=require(_0x45a2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x45a2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x45a2('0x5'));var logger=require(_0x45a2('0x6'))('rpc');var config=require(_0x45a2('0x7'));var jayson=require(_0x45a2('0x8'));var client=jayson[_0x45a2('0x9')][_0x45a2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2454cf,_0x177058,_0x2349ad){return new BPromise(function(_0x50d383,_0x28174a){return client['request'](_0x2454cf,_0x2349ad)['then'](function(_0x5f4d0c){logger[_0x45a2('0xb')](_0x45a2('0xc'),_0x177058,_0x45a2('0xd'));logger[_0x45a2('0xe')](_0x45a2('0xf'),_0x177058,_0x45a2('0xd'),JSON[_0x45a2('0x10')](_0x5f4d0c));if(_0x5f4d0c[_0x45a2('0x11')]){if(_0x5f4d0c['error']['code']===0x1f4){logger[_0x45a2('0x11')](_0x45a2('0xc'),_0x177058,_0x5f4d0c[_0x45a2('0x11')][_0x45a2('0x12')]);return _0x28174a(_0x5f4d0c[_0x45a2('0x11')]['message']);}logger[_0x45a2('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x177058,_0x5f4d0c[_0x45a2('0x11')][_0x45a2('0x12')]);return _0x50d383(_0x5f4d0c[_0x45a2('0x11')]['message']);}else{logger[_0x45a2('0xb')]('FreshdeskAccount,\x20%s,\x20%s',_0x177058,_0x45a2('0xd'));_0x50d383(_0x5f4d0c[_0x45a2('0x13')][_0x45a2('0x12')]);}})[_0x45a2('0x14')](function(_0x5ab45d){logger[_0x45a2('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x177058,_0x5ab45d);_0x28174a(_0x5ab45d);});});}exports['GetFreshdeskAccount']=function(_0x5f522b){var _0x26a31b=this;return new Promise(function(_0x47518e,_0xcb86d5){return db[_0x45a2('0x15')][_0x45a2('0x16')]({'raw':_0x5f522b[_0x45a2('0x17')]?_0x5f522b[_0x45a2('0x17')][_0x45a2('0x18')]===undefined?!![]:![]:!![],'where':_0x5f522b['options']?_0x5f522b[_0x45a2('0x17')][_0x45a2('0x19')]||null:null,'attributes':_0x5f522b[_0x45a2('0x17')]?_0x5f522b['options'][_0x45a2('0x1a')]||null:null,'limit':_0x5f522b['options']?_0x5f522b[_0x45a2('0x17')][_0x45a2('0x1b')]||null:null,'include':_0x5f522b['options']?_0x5f522b[_0x45a2('0x17')]['include']?_[_0x45a2('0x1c')](_0x5f522b[_0x45a2('0x17')][_0x45a2('0x1d')],function(_0x1682d7){return{'model':db[_0x1682d7['model']],'as':_0x1682d7['as'],'attributes':_0x1682d7[_0x45a2('0x1a')],'include':_0x1682d7[_0x45a2('0x1d')]?_[_0x45a2('0x1c')](_0x1682d7['include'],function(_0x59c285){return{'model':db[_0x59c285[_0x45a2('0x1e')]],'as':_0x59c285['as'],'attributes':_0x59c285[_0x45a2('0x1a')],'include':_0x59c285[_0x45a2('0x1d')]?_[_0x45a2('0x1c')](_0x59c285[_0x45a2('0x1d')],function(_0x4401d4){return{'model':db[_0x4401d4[_0x45a2('0x1e')]],'as':_0x4401d4['as'],'attributes':_0x4401d4['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x68c797){logger[_0x45a2('0xb')](_0x45a2('0x1f'),_0x5f522b);logger['debug'](_0x45a2('0x1f'),_0x5f522b,JSON['stringify'](_0x68c797));_0x47518e(_0x68c797);})[_0x45a2('0x14')](function(_0x1aad56){logger[_0x45a2('0x11')](_0x45a2('0x1f'),_0x1aad56[_0x45a2('0x12')],_0x5f522b);_0xcb86d5(_0x26a31b[_0x45a2('0x11')](0x1f4,_0x1aad56[_0x45a2('0x12')]));});});};exports[_0x45a2('0x20')]=function(_0xddc56b){var _0x3086da=this;return new Promise(function(_0x4e3188,_0x360c5e){return db[_0x45a2('0x15')]['find']({'raw':_0xddc56b['options']?_0xddc56b[_0x45a2('0x17')][_0x45a2('0x18')]===undefined?!![]:![]:!![],'where':_0xddc56b[_0x45a2('0x17')]?_0xddc56b[_0x45a2('0x17')][_0x45a2('0x19')]||null:null,'attributes':_0xddc56b['options']?_0xddc56b[_0x45a2('0x17')][_0x45a2('0x1a')]||null:null,'include':_0xddc56b[_0x45a2('0x17')]?_0xddc56b['options'][_0x45a2('0x1d')]?_[_0x45a2('0x1c')](_0xddc56b[_0x45a2('0x17')][_0x45a2('0x1d')],function(_0x2511cb){return{'model':db[_0x2511cb[_0x45a2('0x1e')]],'as':_0x2511cb['as'],'attributes':_0x2511cb['attributes'],'include':_0x2511cb[_0x45a2('0x1d')]?_['map'](_0x2511cb['include'],function(_0x3f050d){return{'model':db[_0x3f050d['model']],'as':_0x3f050d['as'],'attributes':_0x3f050d[_0x45a2('0x1a')],'include':_0x3f050d[_0x45a2('0x1d')]?_['map'](_0x3f050d[_0x45a2('0x1d')],function(_0x487aae){return{'model':db[_0x487aae[_0x45a2('0x1e')]],'as':_0x487aae['as'],'attributes':_0x487aae[_0x45a2('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x45a2('0x21')](function(_0x4e9af2){logger[_0x45a2('0xb')](_0x45a2('0x20'),_0xddc56b);logger[_0x45a2('0xe')](_0x45a2('0x20'),_0xddc56b,JSON['stringify'](_0x4e9af2));_0x4e3188(_0x4e9af2);})[_0x45a2('0x14')](function(_0xb02ef0){logger[_0x45a2('0x11')](_0x45a2('0x20'),_0xb02ef0['message'],_0xddc56b);_0x360c5e(_0x3086da[_0x45a2('0x11')](0x1f4,_0xb02ef0[_0x45a2('0x12')]));});});}; \ No newline at end of file +var _0xe5c9=['http','request','then','info','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','attributes','include','model','map','stringify','ShowFreshdeskAccount','find','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x1b49fa,_0x1de635){var _0xac5745=function(_0x1d8d06){while(--_0x1d8d06){_0x1b49fa['push'](_0x1b49fa['shift']());}};_0xac5745(++_0x1de635);}(_0xe5c9,0x139));var _0x9e5c=function(_0x14fd11,_0x10b282){_0x14fd11=_0x14fd11-0x0;var _0x18fc60=_0xe5c9[_0x14fd11];return _0x18fc60;};'use strict';var _=require(_0x9e5c('0x0'));var util=require(_0x9e5c('0x1'));var moment=require(_0x9e5c('0x2'));var BPromise=require(_0x9e5c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9e5c('0x4'));var db=require(_0x9e5c('0x5'))['db'];var utils=require(_0x9e5c('0x6'));var logger=require(_0x9e5c('0x7'))('rpc');var config=require(_0x9e5c('0x8'));var jayson=require(_0x9e5c('0x9'));var client=jayson[_0x9e5c('0xa')][_0x9e5c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ffaed,_0x592269,_0x193a03){return new BPromise(function(_0x4154cc,_0x442762){return client[_0x9e5c('0xc')](_0x4ffaed,_0x193a03)[_0x9e5c('0xd')](function(_0xde3c34){logger[_0x9e5c('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0x592269,'request\x20sent');logger[_0x9e5c('0xf')](_0x9e5c('0x10'),_0x592269,_0x9e5c('0x11'),JSON['stringify'](_0xde3c34));if(_0xde3c34[_0x9e5c('0x12')]){if(_0xde3c34[_0x9e5c('0x12')][_0x9e5c('0x13')]===0x1f4){logger[_0x9e5c('0x12')](_0x9e5c('0x14'),_0x592269,_0xde3c34[_0x9e5c('0x12')][_0x9e5c('0x15')]);return _0x442762(_0xde3c34['error'][_0x9e5c('0x15')]);}logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x592269,_0xde3c34[_0x9e5c('0x12')][_0x9e5c('0x15')]);return _0x4154cc(_0xde3c34['error']['message']);}else{logger[_0x9e5c('0xe')](_0x9e5c('0x14'),_0x592269,_0x9e5c('0x11'));_0x4154cc(_0xde3c34[_0x9e5c('0x16')][_0x9e5c('0x15')]);}})[_0x9e5c('0x17')](function(_0x133018){logger[_0x9e5c('0x12')](_0x9e5c('0x14'),_0x592269,_0x133018);_0x442762(_0x133018);});});}exports[_0x9e5c('0x18')]=function(_0x3331b9){var _0x113edc=this;return new Promise(function(_0xa545f0,_0x3aa31a){return db[_0x9e5c('0x19')][_0x9e5c('0x1a')]({'raw':_0x3331b9[_0x9e5c('0x1b')]?_0x3331b9[_0x9e5c('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3331b9[_0x9e5c('0x1b')]?_0x3331b9[_0x9e5c('0x1b')]['where']||null:null,'attributes':_0x3331b9['options']?_0x3331b9['options'][_0x9e5c('0x1c')]||null:null,'limit':_0x3331b9[_0x9e5c('0x1b')]?_0x3331b9[_0x9e5c('0x1b')]['limit']||null:null,'include':_0x3331b9[_0x9e5c('0x1b')]?_0x3331b9['options'][_0x9e5c('0x1d')]?_['map'](_0x3331b9[_0x9e5c('0x1b')][_0x9e5c('0x1d')],function(_0x42938e){return{'model':db[_0x42938e[_0x9e5c('0x1e')]],'as':_0x42938e['as'],'attributes':_0x42938e['attributes'],'include':_0x42938e[_0x9e5c('0x1d')]?_['map'](_0x42938e[_0x9e5c('0x1d')],function(_0x25280c){return{'model':db[_0x25280c[_0x9e5c('0x1e')]],'as':_0x25280c['as'],'attributes':_0x25280c[_0x9e5c('0x1c')],'include':_0x25280c[_0x9e5c('0x1d')]?_[_0x9e5c('0x1f')](_0x25280c['include'],function(_0x26d703){return{'model':db[_0x26d703[_0x9e5c('0x1e')]],'as':_0x26d703['as'],'attributes':_0x26d703[_0x9e5c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9e5c('0xd')](function(_0x905ceb){logger['info'](_0x9e5c('0x18'),_0x3331b9);logger['debug'](_0x9e5c('0x18'),_0x3331b9,JSON[_0x9e5c('0x20')](_0x905ceb));_0xa545f0(_0x905ceb);})[_0x9e5c('0x17')](function(_0x558257){logger['error'](_0x9e5c('0x18'),_0x558257[_0x9e5c('0x15')],_0x3331b9);_0x3aa31a(_0x113edc['error'](0x1f4,_0x558257[_0x9e5c('0x15')]));});});};exports[_0x9e5c('0x21')]=function(_0x3149f4){var _0x416ec7=this;return new Promise(function(_0xb7717c,_0x1e14fd){return db[_0x9e5c('0x19')][_0x9e5c('0x22')]({'raw':_0x3149f4['options']?_0x3149f4[_0x9e5c('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3149f4[_0x9e5c('0x1b')]?_0x3149f4[_0x9e5c('0x1b')][_0x9e5c('0x23')]||null:null,'attributes':_0x3149f4[_0x9e5c('0x1b')]?_0x3149f4[_0x9e5c('0x1b')]['attributes']||null:null,'include':_0x3149f4[_0x9e5c('0x1b')]?_0x3149f4[_0x9e5c('0x1b')][_0x9e5c('0x1d')]?_[_0x9e5c('0x1f')](_0x3149f4[_0x9e5c('0x1b')][_0x9e5c('0x1d')],function(_0xcbc4d7){return{'model':db[_0xcbc4d7[_0x9e5c('0x1e')]],'as':_0xcbc4d7['as'],'attributes':_0xcbc4d7[_0x9e5c('0x1c')],'include':_0xcbc4d7[_0x9e5c('0x1d')]?_['map'](_0xcbc4d7[_0x9e5c('0x1d')],function(_0x47efdf){return{'model':db[_0x47efdf[_0x9e5c('0x1e')]],'as':_0x47efdf['as'],'attributes':_0x47efdf[_0x9e5c('0x1c')],'include':_0x47efdf[_0x9e5c('0x1d')]?_['map'](_0x47efdf[_0x9e5c('0x1d')],function(_0x9feb96){return{'model':db[_0x9feb96[_0x9e5c('0x1e')]],'as':_0x9feb96['as'],'attributes':_0x9feb96[_0x9e5c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9e5c('0xd')](function(_0x830ecf){logger[_0x9e5c('0xe')]('ShowFreshdeskAccount',_0x3149f4);logger['debug'](_0x9e5c('0x21'),_0x3149f4,JSON['stringify'](_0x830ecf));_0xb7717c(_0x830ecf);})['catch'](function(_0x3a905c){logger[_0x9e5c('0x12')](_0x9e5c('0x21'),_0x3a905c[_0x9e5c('0x15')],_0x3149f4);_0x1e14fd(_0x416ec7[_0x9e5c('0x12')](0x1f4,_0x3a905c[_0x9e5c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 6a6cdb8..02b2436 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 _0xfba0=['fs-extra','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','show','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xfba0,0x1c3));var _0x0fba=function(_0x58c9a6,_0x2df332){_0x58c9a6=_0x58c9a6-0x0;var _0x3ceb24=_0xfba0[_0x58c9a6];return _0x3ceb24;};'use strict';var multer=require(_0x0fba('0x0'));var util=require(_0x0fba('0x1'));var path=require(_0x0fba('0x2'));var timeout=require(_0x0fba('0x3'));var express=require(_0x0fba('0x4'));var router=express['Router']();var fs_extra=require(_0x0fba('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0fba('0x6'));var controller=require(_0x0fba('0x7'));router[_0x0fba('0x8')]('/',auth[_0x0fba('0x9')](),controller['index']);router[_0x0fba('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0fba('0xa')]);router[_0x0fba('0x8')](_0x0fba('0xb'),auth[_0x0fba('0x9')](),controller['getFields']);router[_0x0fba('0x8')](_0x0fba('0xc'),auth[_0x0fba('0x9')](),controller['getSubjects']);router[_0x0fba('0x8')](_0x0fba('0xd'),auth[_0x0fba('0x9')](),controller[_0x0fba('0xe')]);router['get'](_0x0fba('0xf'),auth[_0x0fba('0x9')](),controller[_0x0fba('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0fba('0x11')]);router[_0x0fba('0x12')](_0x0fba('0xf'),auth[_0x0fba('0x9')](),controller['setTags']);router[_0x0fba('0x13')](_0x0fba('0x14'),auth['isAuthenticated'](),controller[_0x0fba('0x15')]);router[_0x0fba('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x0fba('0x17')]);module['exports']=router; \ No newline at end of file +var _0x378d=['./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','/:id/tags','setTags','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x705b98,_0x1c345b){var _0x47b72f=function(_0x44f02a){while(--_0x44f02a){_0x705b98['push'](_0x705b98['shift']());}};_0x47b72f(++_0x1c345b);}(_0x378d,0xd9));var _0xd378=function(_0x7c93da,_0x27ae80){_0x7c93da=_0x7c93da-0x0;var _0x48508e=_0x378d[_0x7c93da];return _0x48508e;};'use strict';var multer=require(_0xd378('0x0'));var util=require(_0xd378('0x1'));var path=require(_0xd378('0x2'));var timeout=require('connect-timeout');var express=require(_0xd378('0x3'));var router=express[_0xd378('0x4')]();var fs_extra=require(_0xd378('0x5'));var auth=require(_0xd378('0x6'));var interaction=require(_0xd378('0x7'));var config=require('../../config/environment');var controller=require(_0xd378('0x8'));router[_0xd378('0x9')]('/',auth[_0xd378('0xa')](),controller[_0xd378('0xb')]);router['get'](_0xd378('0xc'),auth[_0xd378('0xa')](),controller[_0xd378('0xd')]);router[_0xd378('0x9')]('/:id/fields',auth[_0xd378('0xa')](),controller[_0xd378('0xe')]);router[_0xd378('0x9')](_0xd378('0xf'),auth['isAuthenticated'](),controller[_0xd378('0x10')]);router[_0xd378('0x9')](_0xd378('0x11'),auth[_0xd378('0xa')](),controller[_0xd378('0x12')]);router[_0xd378('0x9')]('/:id/tags',auth[_0xd378('0xa')](),controller[_0xd378('0x13')]);router[_0xd378('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd378('0x14')](_0xd378('0x15'),auth[_0xd378('0xa')](),controller[_0xd378('0x16')]);router['put'](_0xd378('0xc'),auth[_0xd378('0xa')](),controller['update']);router[_0xd378('0x17')](_0xd378('0xc'),auth[_0xd378('0xa')](),controller[_0xd378('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index ce1a278..1a699e8 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 _0xb9e0=['exports','STRING','sequelize'];(function(_0x27b938,_0x4a7743){var _0x27788d=function(_0x353764){while(--_0x353764){_0x27b938['push'](_0x27b938['shift']());}};_0x27788d(++_0x4a7743);}(_0xb9e0,0x1b8));var _0x0b9e=function(_0x587125,_0x30ba05){_0x587125=_0x587125-0x0;var _0xb037dc=_0xb9e0[_0x587125];return _0xb037dc;};'use strict';var Sequelize=require(_0x0b9e('0x0'));module[_0x0b9e('0x1')]={'name':{'type':Sequelize[_0x0b9e('0x2')]},'description':{'type':Sequelize[_0x0b9e('0x2')]}}; \ No newline at end of file +var _0x4368=['exports','STRING'];(function(_0x2e6c17,_0x3a850f){var _0x18d1f6=function(_0x5eb2ae){while(--_0x5eb2ae){_0x2e6c17['push'](_0x2e6c17['shift']());}};_0x18d1f6(++_0x3a850f);}(_0x4368,0x126));var _0x8436=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0x4368[_0x266618];return _0x54dbf5;};'use strict';var Sequelize=require('sequelize');module[_0x8436('0x0')]={'name':{'type':Sequelize[_0x8436('0x1')]},'description':{'type':Sequelize[_0x8436('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 7634bf9..43e0b74 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 _0xd12a=['to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','status','end','undefined','limit','count','offset','set','json','apply','save','update','then','destroy','sendStatus','error','stack','name','map','FreshdeskConfiguration','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','rows','catch','show','params','keys','include','find','create','body','getFields','findOne','pick','getSubjects','FreshdeskField','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js'];(function(_0x106d12,_0x3ae8c5){var _0x7912da=function(_0x6c0c9c){while(--_0x6c0c9c){_0x106d12['push'](_0x106d12['shift']());}};_0x7912da(++_0x3ae8c5);}(_0xd12a,0x180));var _0xad12=function(_0x4ab42f,_0x437617){_0x4ab42f=_0x4ab42f-0x0;var _0xbdf43=_0xd12a[_0x4ab42f];return _0xbdf43;};'use strict';var emlformat=require(_0xad12('0x0'));var rimraf=require(_0xad12('0x1'));var zipdir=require(_0xad12('0x2'));var jsonpatch=require(_0xad12('0x3'));var rp=require(_0xad12('0x4'));var moment=require(_0xad12('0x5'));var BPromise=require(_0xad12('0x6'));var Mustache=require(_0xad12('0x7'));var util=require(_0xad12('0x8'));var path=require('path');var sox=require(_0xad12('0x9'));var csv=require('to-csv');var ejs=require(_0xad12('0xa'));var fs=require('fs');var fs_extra=require(_0xad12('0xb'));var _=require(_0xad12('0xc'));var squel=require(_0xad12('0xd'));var crypto=require('crypto');var jsforce=require(_0xad12('0xe'));var deskjs=require(_0xad12('0xf'));var toCsv=require(_0xad12('0x10'));var querystring=require(_0xad12('0x11'));var Papa=require(_0xad12('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xad12('0x13'));var as=require(_0xad12('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xad12('0x15'))(_0xad12('0x16'));var utils=require('../../config/utils');var config=require(_0xad12('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8ce070,_0x288a1d){_0x288a1d=_0x288a1d||0xcc;return function(_0x5afbe7){if(_0x5afbe7){return _0x8ce070['sendStatus'](_0x288a1d);}return _0x8ce070[_0xad12('0x18')](_0x288a1d)[_0xad12('0x19')]();};}function respondWithResult(_0x511075,_0x5da78b){_0x5da78b=_0x5da78b||0xc8;return function(_0x32e24f){if(_0x32e24f){return _0x511075[_0xad12('0x18')](_0x5da78b)['json'](_0x32e24f);}};}function respondWithFilteredResult(_0x561afc,_0x48f383){return function(_0x19bd15){if(_0x19bd15){var _0x4d199f=typeof _0x48f383['offset']===_0xad12('0x1a')&&typeof _0x48f383[_0xad12('0x1b')]===_0xad12('0x1a');var _0x1dc31c=_0x19bd15[_0xad12('0x1c')];var _0x494e8b=_0x4d199f?0x0:_0x48f383[_0xad12('0x1d')];var _0x4587db=_0x4d199f?_0x19bd15[_0xad12('0x1c')]:_0x48f383['offset']+_0x48f383[_0xad12('0x1b')];var _0x3bedf8;if(_0x4587db>=_0x1dc31c){_0x4587db=_0x1dc31c;_0x3bedf8=0xc8;}else{_0x3bedf8=0xce;}_0x561afc['status'](_0x3bedf8);return _0x561afc[_0xad12('0x1e')]('Content-Range',_0x494e8b+'-'+_0x4587db+'/'+_0x1dc31c)[_0xad12('0x1f')](_0x19bd15);}return null;};}function patchUpdates(_0x13180a){return function(_0x2dfd05){try{jsonpatch[_0xad12('0x20')](_0x2dfd05,_0x13180a,!![]);}catch(_0x2d69fa){return BPromise['reject'](_0x2d69fa);}return _0x2dfd05[_0xad12('0x21')]();};}function saveUpdates(_0x18ad76,_0x31d5ad){return function(_0xbe07d3){if(_0xbe07d3){return _0xbe07d3[_0xad12('0x22')](_0x18ad76)[_0xad12('0x23')](function(_0x331a46){return _0x331a46;});}return null;};}function removeEntity(_0x1318e1,_0x594458){return function(_0x1f0eb2){if(_0x1f0eb2){return _0x1f0eb2[_0xad12('0x24')]()[_0xad12('0x23')](function(){_0x1318e1['status'](0xcc)[_0xad12('0x19')]();});}};}function handleEntityNotFound(_0x590d77,_0x58ea48){return function(_0xd595a){if(!_0xd595a){_0x590d77[_0xad12('0x25')](0x194);}return _0xd595a;};}function handleError(_0x477fdb,_0x436c8a){_0x436c8a=_0x436c8a||0x1f4;return function(_0x4238a4){logger[_0xad12('0x26')](_0x4238a4[_0xad12('0x27')]);if(_0x4238a4[_0xad12('0x28')]){delete _0x4238a4[_0xad12('0x28')];}_0x477fdb[_0xad12('0x18')](_0x436c8a)['send'](_0x4238a4);};}exports['index']=function(_0x2623ce,_0x1c9b78){var _0x250fd9={},_0x1fcc78={},_0x18e43f={'count':0x0,'rows':[]};var _0x42f4e8=_[_0xad12('0x29')](db[_0xad12('0x2a')][_0xad12('0x2b')],function(_0x55ebd9){return{'name':_0x55ebd9[_0xad12('0x2c')],'type':_0x55ebd9[_0xad12('0x2d')]['key']};});_0x1fcc78[_0xad12('0x2e')]=_[_0xad12('0x29')](_0x42f4e8,_0xad12('0x28'));_0x1fcc78[_0xad12('0x2f')]=_['keys'](_0x2623ce[_0xad12('0x2f')]);_0x1fcc78['filters']=_[_0xad12('0x30')](_0x1fcc78[_0xad12('0x2e')],_0x1fcc78[_0xad12('0x2f')]);_0x250fd9['attributes']=_[_0xad12('0x30')](_0x1fcc78[_0xad12('0x2e')],qs[_0xad12('0x31')](_0x2623ce[_0xad12('0x2f')][_0xad12('0x31')]));_0x250fd9['attributes']=_0x250fd9[_0xad12('0x32')][_0xad12('0x33')]?_0x250fd9[_0xad12('0x32')]:_0x1fcc78[_0xad12('0x2e')];if(!_0x2623ce[_0xad12('0x2f')][_0xad12('0x34')](_0xad12('0x35'))){_0x250fd9[_0xad12('0x1b')]=qs['limit'](_0x2623ce['query'][_0xad12('0x1b')]);_0x250fd9[_0xad12('0x1d')]=qs[_0xad12('0x1d')](_0x2623ce[_0xad12('0x2f')][_0xad12('0x1d')]);}_0x250fd9[_0xad12('0x36')]=qs[_0xad12('0x37')](_0x2623ce[_0xad12('0x2f')][_0xad12('0x37')]);_0x250fd9[_0xad12('0x38')]=qs[_0xad12('0x39')](_['pick'](_0x2623ce['query'],_0x1fcc78[_0xad12('0x39')]),_0x42f4e8);if(_0x2623ce[_0xad12('0x2f')]['filter']){_0x250fd9[_0xad12('0x38')]=_[_0xad12('0x3a')](_0x250fd9[_0xad12('0x38')],{'$or':_[_0xad12('0x29')](_0x42f4e8,function(_0x2d40a5){if(_0x2d40a5[_0xad12('0x2d')]!==_0xad12('0x3b')){var _0x415aae={};_0x415aae[_0x2d40a5[_0xad12('0x28')]]={'$like':'%'+_0x2623ce[_0xad12('0x2f')][_0xad12('0x3c')]+'%'};return _0x415aae;}})});}_0x250fd9=_['merge']({},_0x250fd9,_0x2623ce[_0xad12('0x3d')]);var _0x129709={'where':_0x250fd9['where']};return db[_0xad12('0x2a')][_0xad12('0x1c')](_0x129709)['then'](function(_0x55a8ad){_0x18e43f[_0xad12('0x1c')]=_0x55a8ad;if(_0x2623ce[_0xad12('0x2f')]['includeAll']){_0x250fd9['include']=[{'all':!![]}];}return db[_0xad12('0x2a')]['findAll'](_0x250fd9);})[_0xad12('0x23')](function(_0x4fc098){_0x18e43f[_0xad12('0x3e')]=_0x4fc098;return _0x18e43f;})[_0xad12('0x23')](respondWithFilteredResult(_0x1c9b78,_0x250fd9))[_0xad12('0x3f')](handleError(_0x1c9b78,null));};exports[_0xad12('0x40')]=function(_0x3a0b1e,_0x262cba){var _0x14c0fb={'raw':![],'where':{'id':_0x3a0b1e[_0xad12('0x41')]['id']}},_0x590ad2={};_0x590ad2[_0xad12('0x2e')]=_[_0xad12('0x42')](db[_0xad12('0x2a')][_0xad12('0x2b')]);_0x590ad2['query']=_[_0xad12('0x42')](_0x3a0b1e[_0xad12('0x2f')]);_0x590ad2['filters']=_[_0xad12('0x30')](_0x590ad2['model'],_0x590ad2['query']);_0x14c0fb[_0xad12('0x32')]=_[_0xad12('0x30')](_0x590ad2[_0xad12('0x2e')],qs['fields'](_0x3a0b1e[_0xad12('0x2f')][_0xad12('0x31')]));_0x14c0fb[_0xad12('0x32')]=_0x14c0fb[_0xad12('0x32')][_0xad12('0x33')]?_0x14c0fb[_0xad12('0x32')]:_0x590ad2[_0xad12('0x2e')];if(_0x3a0b1e['query']['includeAll']){_0x14c0fb[_0xad12('0x43')]=[{'all':!![]}];}_0x14c0fb=_[_0xad12('0x3a')]({},_0x14c0fb,_0x3a0b1e[_0xad12('0x3d')]);return db[_0xad12('0x2a')][_0xad12('0x44')](_0x14c0fb)['then'](handleEntityNotFound(_0x262cba,null))[_0xad12('0x23')](respondWithResult(_0x262cba,null))[_0xad12('0x3f')](handleError(_0x262cba,null));};exports[_0xad12('0x45')]=function(_0x195ae8,_0x2f39c4){return db[_0xad12('0x2a')][_0xad12('0x45')](_0x195ae8['body'],{})[_0xad12('0x23')](respondWithResult(_0x2f39c4,0xc9))[_0xad12('0x3f')](handleError(_0x2f39c4,null));};exports['update']=function(_0x4e6e60,_0x257729){if(_0x4e6e60[_0xad12('0x46')]['id']){delete _0x4e6e60[_0xad12('0x46')]['id'];}return db[_0xad12('0x2a')][_0xad12('0x44')]({'where':{'id':_0x4e6e60[_0xad12('0x41')]['id']}})[_0xad12('0x23')](handleEntityNotFound(_0x257729,null))[_0xad12('0x23')](saveUpdates(_0x4e6e60[_0xad12('0x46')],null))[_0xad12('0x23')](respondWithResult(_0x257729,null))[_0xad12('0x3f')](handleError(_0x257729,null));};exports['destroy']=function(_0x2f90b3,_0x303254){return db[_0xad12('0x2a')][_0xad12('0x44')]({'where':{'id':_0x2f90b3['params']['id']}})[_0xad12('0x23')](handleEntityNotFound(_0x303254,null))[_0xad12('0x23')](removeEntity(_0x303254,null))[_0xad12('0x3f')](handleError(_0x303254,null));};exports[_0xad12('0x47')]=function(_0x3d185a,_0x15ce78,_0x24bffd){var _0x55a414={};var _0x1bf39b={};var _0x324e40;var _0x15c393;return db[_0xad12('0x2a')][_0xad12('0x48')]({'where':{'id':_0x3d185a[_0xad12('0x41')]['id']}})[_0xad12('0x23')](handleEntityNotFound(_0x15ce78,null))[_0xad12('0x23')](function(_0x5e3f89){if(_0x5e3f89){_0x324e40=_0x5e3f89;_0x1bf39b['model']=_[_0xad12('0x42')](db['FreshdeskField']['rawAttributes']);_0x1bf39b[_0xad12('0x2f')]=_[_0xad12('0x42')](_0x3d185a[_0xad12('0x2f')]);_0x1bf39b[_0xad12('0x39')]=_[_0xad12('0x30')](_0x1bf39b[_0xad12('0x2e')],_0x1bf39b[_0xad12('0x2f')]);_0x55a414[_0xad12('0x32')]=_['intersection'](_0x1bf39b[_0xad12('0x2e')],qs['fields'](_0x3d185a[_0xad12('0x2f')][_0xad12('0x31')]));_0x55a414['attributes']=_0x55a414[_0xad12('0x32')][_0xad12('0x33')]?_0x55a414[_0xad12('0x32')]:_0x1bf39b[_0xad12('0x2e')];_0x55a414[_0xad12('0x36')]=qs[_0xad12('0x37')](_0x3d185a['query']['sort']);_0x55a414[_0xad12('0x38')]=qs['filters'](_[_0xad12('0x49')](_0x3d185a[_0xad12('0x2f')],_0x1bf39b[_0xad12('0x39')]));if(_0x3d185a[_0xad12('0x2f')][_0xad12('0x3c')]){_0x55a414[_0xad12('0x38')]=_[_0xad12('0x3a')](_0x55a414[_0xad12('0x38')],{'$or':_[_0xad12('0x29')](_0x55a414[_0xad12('0x32')],function(_0x92aa93){var _0x4e5126={};_0x4e5126[_0x92aa93]={'$like':'%'+_0x3d185a[_0xad12('0x2f')][_0xad12('0x3c')]+'%'};return _0x4e5126;})});}_0x55a414=_[_0xad12('0x3a')]({},_0x55a414,_0x3d185a[_0xad12('0x3d')]);return _0x324e40[_0xad12('0x47')](_0x55a414);}})[_0xad12('0x23')](function(_0x2268cb){if(_0x2268cb){_0x15c393=_0x2268cb[_0xad12('0x33')];if(!_0x3d185a[_0xad12('0x2f')][_0xad12('0x34')](_0xad12('0x35'))){_0x55a414[_0xad12('0x1b')]=qs[_0xad12('0x1b')](_0x3d185a[_0xad12('0x2f')][_0xad12('0x1b')]);_0x55a414[_0xad12('0x1d')]=qs[_0xad12('0x1d')](_0x3d185a['query'][_0xad12('0x1d')]);}return _0x324e40[_0xad12('0x47')](_0x55a414);}})[_0xad12('0x23')](function(_0x221086){if(_0x221086){return _0x221086?{'count':_0x15c393,'rows':_0x221086}:null;}})[_0xad12('0x23')](respondWithResult(_0x15ce78,null))['catch'](handleError(_0x15ce78,null));};exports['getSubjects']=function(_0x494438,_0x3b24d5,_0x3010f7){var _0x3c1da9={};var _0x37fe3d={};var _0x4f1ad1;var _0x2e5429;return db[_0xad12('0x2a')]['findOne']({'where':{'id':_0x494438[_0xad12('0x41')]['id']}})[_0xad12('0x23')](handleEntityNotFound(_0x3b24d5,null))[_0xad12('0x23')](function(_0x512ea3){if(_0x512ea3){_0x4f1ad1=_0x512ea3;_0x37fe3d[_0xad12('0x2e')]=_[_0xad12('0x42')](db['FreshdeskField']['rawAttributes']);_0x37fe3d[_0xad12('0x2f')]=_[_0xad12('0x42')](_0x494438[_0xad12('0x2f')]);_0x37fe3d[_0xad12('0x39')]=_[_0xad12('0x30')](_0x37fe3d[_0xad12('0x2e')],_0x37fe3d[_0xad12('0x2f')]);_0x3c1da9[_0xad12('0x32')]=_[_0xad12('0x30')](_0x37fe3d[_0xad12('0x2e')],qs['fields'](_0x494438[_0xad12('0x2f')]['fields']));_0x3c1da9['attributes']=_0x3c1da9[_0xad12('0x32')][_0xad12('0x33')]?_0x3c1da9[_0xad12('0x32')]:_0x37fe3d[_0xad12('0x2e')];_0x3c1da9['order']=qs[_0xad12('0x37')](_0x494438[_0xad12('0x2f')]['sort']);_0x3c1da9[_0xad12('0x38')]=qs[_0xad12('0x39')](_['pick'](_0x494438[_0xad12('0x2f')],_0x37fe3d['filters']));if(_0x494438['query'][_0xad12('0x3c')]){_0x3c1da9['where']=_['merge'](_0x3c1da9[_0xad12('0x38')],{'$or':_[_0xad12('0x29')](_0x3c1da9[_0xad12('0x32')],function(_0x56e43b){var _0x55b3be={};_0x55b3be[_0x56e43b]={'$like':'%'+_0x494438[_0xad12('0x2f')][_0xad12('0x3c')]+'%'};return _0x55b3be;})});}_0x3c1da9=_[_0xad12('0x3a')]({},_0x3c1da9,_0x494438['options']);return _0x4f1ad1[_0xad12('0x4a')](_0x3c1da9);}})[_0xad12('0x23')](function(_0x1d7ef6){if(_0x1d7ef6){_0x2e5429=_0x1d7ef6[_0xad12('0x33')];if(!_0x494438[_0xad12('0x2f')][_0xad12('0x34')]('nolimit')){_0x3c1da9[_0xad12('0x1b')]=qs[_0xad12('0x1b')](_0x494438[_0xad12('0x2f')]['limit']);_0x3c1da9[_0xad12('0x1d')]=qs[_0xad12('0x1d')](_0x494438[_0xad12('0x2f')][_0xad12('0x1d')]);}return _0x4f1ad1['getSubjects'](_0x3c1da9);}})[_0xad12('0x23')](function(_0x1a49f9){if(_0x1a49f9){return _0x1a49f9?{'count':_0x2e5429,'rows':_0x1a49f9}:null;}})['then'](respondWithResult(_0x3b24d5,null))[_0xad12('0x3f')](handleError(_0x3b24d5,null));};exports['getDescriptions']=function(_0x3bd8e6,_0x4a0201,_0x3acba5){var _0x64cbb9={};var _0x544b17={};var _0x16c3f2;var _0x6ffb95;return db[_0xad12('0x2a')][_0xad12('0x48')]({'where':{'id':_0x3bd8e6[_0xad12('0x41')]['id']}})[_0xad12('0x23')](handleEntityNotFound(_0x4a0201,null))[_0xad12('0x23')](function(_0x14699b){if(_0x14699b){_0x16c3f2=_0x14699b;_0x544b17[_0xad12('0x2e')]=_[_0xad12('0x42')](db[_0xad12('0x4b')][_0xad12('0x2b')]);_0x544b17[_0xad12('0x2f')]=_['keys'](_0x3bd8e6['query']);_0x544b17['filters']=_[_0xad12('0x30')](_0x544b17['model'],_0x544b17['query']);_0x64cbb9[_0xad12('0x32')]=_[_0xad12('0x30')](_0x544b17[_0xad12('0x2e')],qs[_0xad12('0x31')](_0x3bd8e6[_0xad12('0x2f')][_0xad12('0x31')]));_0x64cbb9[_0xad12('0x32')]=_0x64cbb9[_0xad12('0x32')][_0xad12('0x33')]?_0x64cbb9[_0xad12('0x32')]:_0x544b17[_0xad12('0x2e')];_0x64cbb9[_0xad12('0x36')]=qs[_0xad12('0x37')](_0x3bd8e6[_0xad12('0x2f')][_0xad12('0x37')]);_0x64cbb9[_0xad12('0x38')]=qs[_0xad12('0x39')](_[_0xad12('0x49')](_0x3bd8e6[_0xad12('0x2f')],_0x544b17[_0xad12('0x39')]));if(_0x3bd8e6[_0xad12('0x2f')][_0xad12('0x3c')]){_0x64cbb9[_0xad12('0x38')]=_[_0xad12('0x3a')](_0x64cbb9[_0xad12('0x38')],{'$or':_[_0xad12('0x29')](_0x64cbb9[_0xad12('0x32')],function(_0x3d3372){var _0x454432={};_0x454432[_0x3d3372]={'$like':'%'+_0x3bd8e6[_0xad12('0x2f')]['filter']+'%'};return _0x454432;})});}_0x64cbb9=_[_0xad12('0x3a')]({},_0x64cbb9,_0x3bd8e6[_0xad12('0x3d')]);return _0x16c3f2[_0xad12('0x4c')](_0x64cbb9);}})['then'](function(_0x1b0e08){if(_0x1b0e08){_0x6ffb95=_0x1b0e08[_0xad12('0x33')];if(!_0x3bd8e6[_0xad12('0x2f')]['hasOwnProperty'](_0xad12('0x35'))){_0x64cbb9[_0xad12('0x1b')]=qs[_0xad12('0x1b')](_0x3bd8e6[_0xad12('0x2f')][_0xad12('0x1b')]);_0x64cbb9[_0xad12('0x1d')]=qs['offset'](_0x3bd8e6[_0xad12('0x2f')]['offset']);}return _0x16c3f2[_0xad12('0x4c')](_0x64cbb9);}})[_0xad12('0x23')](function(_0x4820cc){if(_0x4820cc){return _0x4820cc?{'count':_0x6ffb95,'rows':_0x4820cc}:null;}})[_0xad12('0x23')](respondWithResult(_0x4a0201,null))[_0xad12('0x3f')](handleError(_0x4a0201,null));};exports[_0xad12('0x4d')]=function(_0x4d0404,_0x5da5a8,_0x448a72){var _0x3a8e81={};var _0x44bfed={};var _0x35ca79;var _0x23144b;return db['FreshdeskConfiguration'][_0xad12('0x48')]({'where':{'id':_0x4d0404[_0xad12('0x41')]['id']}})[_0xad12('0x23')](handleEntityNotFound(_0x5da5a8,null))['then'](function(_0x275aaa){if(_0x275aaa){_0x35ca79=_0x275aaa;_0x44bfed['model']=_[_0xad12('0x42')](db['Tag'][_0xad12('0x2b')]);_0x44bfed[_0xad12('0x2f')]=_['keys'](_0x4d0404[_0xad12('0x2f')]);_0x44bfed[_0xad12('0x39')]=_[_0xad12('0x30')](_0x44bfed['model'],_0x44bfed[_0xad12('0x2f')]);_0x3a8e81[_0xad12('0x32')]=_['intersection'](_0x44bfed[_0xad12('0x2e')],qs[_0xad12('0x31')](_0x4d0404[_0xad12('0x2f')][_0xad12('0x31')]));_0x3a8e81[_0xad12('0x32')]=_0x3a8e81['attributes'][_0xad12('0x33')]?_0x3a8e81[_0xad12('0x32')]:_0x44bfed[_0xad12('0x2e')];_0x3a8e81[_0xad12('0x36')]=qs[_0xad12('0x37')](_0x4d0404['query'][_0xad12('0x37')]);_0x3a8e81[_0xad12('0x38')]=qs['filters'](_['pick'](_0x4d0404[_0xad12('0x2f')],_0x44bfed[_0xad12('0x39')]));if(_0x4d0404[_0xad12('0x2f')][_0xad12('0x3c')]){_0x3a8e81[_0xad12('0x38')]=_[_0xad12('0x3a')](_0x3a8e81['where'],{'$or':_['map'](_0x3a8e81[_0xad12('0x32')],function(_0x17ccde){var _0x44186e={};_0x44186e[_0x17ccde]={'$like':'%'+_0x4d0404[_0xad12('0x2f')][_0xad12('0x3c')]+'%'};return _0x44186e;})});}_0x3a8e81=_[_0xad12('0x3a')]({},_0x3a8e81,_0x4d0404[_0xad12('0x3d')]);return _0x35ca79[_0xad12('0x4d')](_0x3a8e81);}})[_0xad12('0x23')](function(_0x5b49e8){if(_0x5b49e8){_0x23144b=_0x5b49e8[_0xad12('0x33')];if(!_0x4d0404['query'][_0xad12('0x34')](_0xad12('0x35'))){_0x3a8e81[_0xad12('0x1b')]=qs[_0xad12('0x1b')](_0x4d0404[_0xad12('0x2f')]['limit']);_0x3a8e81['offset']=qs[_0xad12('0x1d')](_0x4d0404[_0xad12('0x2f')]['offset']);}return _0x35ca79[_0xad12('0x4d')](_0x3a8e81);}})['then'](function(_0x2f12ee){if(_0x2f12ee){return _0x2f12ee?{'count':_0x23144b,'rows':_0x2f12ee}:null;}})[_0xad12('0x23')](respondWithResult(_0x5da5a8,null))[_0xad12('0x3f')](handleError(_0x5da5a8,null));};exports[_0xad12('0x4e')]=function(_0x3af396,_0x27d2b3,_0xe5d175){if(_0x3af396['body']['id']){delete _0x3af396[_0xad12('0x46')]['id'];}return db['FreshdeskConfiguration'][_0xad12('0x48')]({'where':{'id':_0x3af396[_0xad12('0x41')]['id']}})['then'](handleEntityNotFound(_0x27d2b3,null))[_0xad12('0x23')](function(_0x453364){if(_0x453364){return _0x453364[_0xad12('0x4e')](_0x3af396[_0xad12('0x46')][_0xad12('0x4f')]||[]);}return null;})[_0xad12('0x23')](respondWithResult(_0x27d2b3,null))[_0xad12('0x3f')](handleError(_0x27d2b3,null));}; \ No newline at end of file +var _0xcefc=['count','status','set','Content-Range','json','save','update','then','end','error','name','send','index','map','FreshdeskConfiguration','fieldName','type','model','query','keys','intersection','attributes','length','nolimit','order','sort','where','filters','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','fields','includeAll','create','body','catch','find','findOne','FreshdeskField','pick','filter','getFields','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','offset','limit','undefined'];(function(_0xaa5e2b,_0x4213ec){var _0x5758d2=function(_0x1a1d1f){while(--_0x1a1d1f){_0xaa5e2b['push'](_0xaa5e2b['shift']());}};_0x5758d2(++_0x4213ec);}(_0xcefc,0x183));var _0xccef=function(_0x12232d,_0xc01239){_0x12232d=_0x12232d-0x0;var _0x140bd7=_0xcefc[_0x12232d];return _0x140bd7;};'use strict';var emlformat=require(_0xccef('0x0'));var rimraf=require(_0xccef('0x1'));var zipdir=require(_0xccef('0x2'));var jsonpatch=require(_0xccef('0x3'));var rp=require(_0xccef('0x4'));var moment=require('moment');var BPromise=require(_0xccef('0x5'));var Mustache=require('mustache');var util=require(_0xccef('0x6'));var path=require(_0xccef('0x7'));var sox=require(_0xccef('0x8'));var csv=require(_0xccef('0x9'));var ejs=require(_0xccef('0xa'));var fs=require('fs');var fs_extra=require(_0xccef('0xb'));var _=require(_0xccef('0xc'));var squel=require(_0xccef('0xd'));var crypto=require(_0xccef('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xccef('0x9'));var querystring=require(_0xccef('0xf'));var Papa=require(_0xccef('0x10'));var Redis=require('ioredis');var authService=require(_0xccef('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xccef('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xccef('0x13'))(_0xccef('0x14'));var utils=require(_0xccef('0x15'));var config=require(_0xccef('0x16'));var licenseUtil=require(_0xccef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd4c8d5,_0xe6cdb0){_0xe6cdb0=_0xe6cdb0||0xcc;return function(_0x11c507){if(_0x11c507){return _0xd4c8d5[_0xccef('0x18')](_0xe6cdb0);}return _0xd4c8d5['status'](_0xe6cdb0)['end']();};}function respondWithResult(_0x5eeac7,_0x5a203c){_0x5a203c=_0x5a203c||0xc8;return function(_0x30bb32){if(_0x30bb32){return _0x5eeac7['status'](_0x5a203c)['json'](_0x30bb32);}};}function respondWithFilteredResult(_0x582b9f,_0x8e89c7){return function(_0x2d04af){if(_0x2d04af){var _0x534063=typeof _0x8e89c7[_0xccef('0x19')]==='undefined'&&typeof _0x8e89c7[_0xccef('0x1a')]===_0xccef('0x1b');var _0x5a0e3f=_0x2d04af[_0xccef('0x1c')];var _0x5e6dfd=_0x534063?0x0:_0x8e89c7[_0xccef('0x19')];var _0x31baab=_0x534063?_0x2d04af[_0xccef('0x1c')]:_0x8e89c7[_0xccef('0x19')]+_0x8e89c7[_0xccef('0x1a')];var _0x2ec26b;if(_0x31baab>=_0x5a0e3f){_0x31baab=_0x5a0e3f;_0x2ec26b=0xc8;}else{_0x2ec26b=0xce;}_0x582b9f[_0xccef('0x1d')](_0x2ec26b);return _0x582b9f[_0xccef('0x1e')](_0xccef('0x1f'),_0x5e6dfd+'-'+_0x31baab+'/'+_0x5a0e3f)[_0xccef('0x20')](_0x2d04af);}return null;};}function patchUpdates(_0x32080d){return function(_0x1ee088){try{jsonpatch['apply'](_0x1ee088,_0x32080d,!![]);}catch(_0x2880f5){return BPromise['reject'](_0x2880f5);}return _0x1ee088[_0xccef('0x21')]();};}function saveUpdates(_0xc8515d,_0x5aafcd){return function(_0x166c30){if(_0x166c30){return _0x166c30[_0xccef('0x22')](_0xc8515d)['then'](function(_0x53cf51){return _0x53cf51;});}return null;};}function removeEntity(_0x31d559,_0x274185){return function(_0x62446b){if(_0x62446b){return _0x62446b['destroy']()[_0xccef('0x23')](function(){_0x31d559[_0xccef('0x1d')](0xcc)[_0xccef('0x24')]();});}};}function handleEntityNotFound(_0x20af9e,_0x368fd2){return function(_0x207936){if(!_0x207936){_0x20af9e[_0xccef('0x18')](0x194);}return _0x207936;};}function handleError(_0x20aec5,_0x1fff89){_0x1fff89=_0x1fff89||0x1f4;return function(_0x4a9959){logger[_0xccef('0x25')](_0x4a9959['stack']);if(_0x4a9959['name']){delete _0x4a9959[_0xccef('0x26')];}_0x20aec5[_0xccef('0x1d')](_0x1fff89)[_0xccef('0x27')](_0x4a9959);};}exports[_0xccef('0x28')]=function(_0x323ac9,_0x358da7){var _0x5bc2e9={},_0xe60195={},_0x5ce3a6={'count':0x0,'rows':[]};var _0x58fa4c=_[_0xccef('0x29')](db[_0xccef('0x2a')]['rawAttributes'],function(_0x227bd2){return{'name':_0x227bd2[_0xccef('0x2b')],'type':_0x227bd2[_0xccef('0x2c')]['key']};});_0xe60195[_0xccef('0x2d')]=_[_0xccef('0x29')](_0x58fa4c,_0xccef('0x26'));_0xe60195[_0xccef('0x2e')]=_[_0xccef('0x2f')](_0x323ac9['query']);_0xe60195['filters']=_[_0xccef('0x30')](_0xe60195[_0xccef('0x2d')],_0xe60195[_0xccef('0x2e')]);_0x5bc2e9[_0xccef('0x31')]=_['intersection'](_0xe60195[_0xccef('0x2d')],qs['fields'](_0x323ac9[_0xccef('0x2e')]['fields']));_0x5bc2e9[_0xccef('0x31')]=_0x5bc2e9[_0xccef('0x31')][_0xccef('0x32')]?_0x5bc2e9[_0xccef('0x31')]:_0xe60195[_0xccef('0x2d')];if(!_0x323ac9[_0xccef('0x2e')]['hasOwnProperty'](_0xccef('0x33'))){_0x5bc2e9['limit']=qs[_0xccef('0x1a')](_0x323ac9[_0xccef('0x2e')][_0xccef('0x1a')]);_0x5bc2e9[_0xccef('0x19')]=qs['offset'](_0x323ac9[_0xccef('0x2e')][_0xccef('0x19')]);}_0x5bc2e9[_0xccef('0x34')]=qs[_0xccef('0x35')](_0x323ac9[_0xccef('0x2e')][_0xccef('0x35')]);_0x5bc2e9[_0xccef('0x36')]=qs[_0xccef('0x37')](_['pick'](_0x323ac9[_0xccef('0x2e')],_0xe60195[_0xccef('0x37')]),_0x58fa4c);if(_0x323ac9[_0xccef('0x2e')]['filter']){_0x5bc2e9['where']=_[_0xccef('0x38')](_0x5bc2e9[_0xccef('0x36')],{'$or':_[_0xccef('0x29')](_0x58fa4c,function(_0x31961e){if(_0x31961e['type']!==_0xccef('0x39')){var _0xa08c5a={};_0xa08c5a[_0x31961e['name']]={'$like':'%'+_0x323ac9[_0xccef('0x2e')]['filter']+'%'};return _0xa08c5a;}})});}_0x5bc2e9=_[_0xccef('0x38')]({},_0x5bc2e9,_0x323ac9[_0xccef('0x3a')]);var _0x50d464={'where':_0x5bc2e9[_0xccef('0x36')]};return db[_0xccef('0x2a')]['count'](_0x50d464)[_0xccef('0x23')](function(_0x57f537){_0x5ce3a6['count']=_0x57f537;if(_0x323ac9['query']['includeAll']){_0x5bc2e9[_0xccef('0x3b')]=[{'all':!![]}];}return db[_0xccef('0x2a')][_0xccef('0x3c')](_0x5bc2e9);})['then'](function(_0x54fa72){_0x5ce3a6[_0xccef('0x3d')]=_0x54fa72;return _0x5ce3a6;})['then'](respondWithFilteredResult(_0x358da7,_0x5bc2e9))['catch'](handleError(_0x358da7,null));};exports[_0xccef('0x3e')]=function(_0x1a8277,_0x3523f9){var _0x23928e={'raw':![],'where':{'id':_0x1a8277[_0xccef('0x3f')]['id']}},_0x576490={};_0x576490[_0xccef('0x2d')]=_[_0xccef('0x2f')](db['FreshdeskConfiguration'][_0xccef('0x40')]);_0x576490[_0xccef('0x2e')]=_[_0xccef('0x2f')](_0x1a8277['query']);_0x576490['filters']=_[_0xccef('0x30')](_0x576490[_0xccef('0x2d')],_0x576490[_0xccef('0x2e')]);_0x23928e[_0xccef('0x31')]=_[_0xccef('0x30')](_0x576490[_0xccef('0x2d')],qs[_0xccef('0x41')](_0x1a8277['query']['fields']));_0x23928e[_0xccef('0x31')]=_0x23928e['attributes']['length']?_0x23928e[_0xccef('0x31')]:_0x576490[_0xccef('0x2d')];if(_0x1a8277['query'][_0xccef('0x42')]){_0x23928e[_0xccef('0x3b')]=[{'all':!![]}];}_0x23928e=_[_0xccef('0x38')]({},_0x23928e,_0x1a8277[_0xccef('0x3a')]);return db[_0xccef('0x2a')]['find'](_0x23928e)[_0xccef('0x23')](handleEntityNotFound(_0x3523f9,null))[_0xccef('0x23')](respondWithResult(_0x3523f9,null))['catch'](handleError(_0x3523f9,null));};exports[_0xccef('0x43')]=function(_0x27c363,_0x58ab15){return db['FreshdeskConfiguration']['create'](_0x27c363[_0xccef('0x44')],{})[_0xccef('0x23')](respondWithResult(_0x58ab15,0xc9))[_0xccef('0x45')](handleError(_0x58ab15,null));};exports[_0xccef('0x22')]=function(_0x68369,_0x19f482){if(_0x68369['body']['id']){delete _0x68369['body']['id'];}return db[_0xccef('0x2a')][_0xccef('0x46')]({'where':{'id':_0x68369[_0xccef('0x3f')]['id']}})['then'](handleEntityNotFound(_0x19f482,null))['then'](saveUpdates(_0x68369[_0xccef('0x44')],null))[_0xccef('0x23')](respondWithResult(_0x19f482,null))[_0xccef('0x45')](handleError(_0x19f482,null));};exports['destroy']=function(_0x24098e,_0x1bcc27){return db[_0xccef('0x2a')][_0xccef('0x46')]({'where':{'id':_0x24098e[_0xccef('0x3f')]['id']}})[_0xccef('0x23')](handleEntityNotFound(_0x1bcc27,null))[_0xccef('0x23')](removeEntity(_0x1bcc27,null))['catch'](handleError(_0x1bcc27,null));};exports['getFields']=function(_0x25bc28,_0x3d2d61,_0x4588cb){var _0x3720c2={};var _0x2206c0={};var _0x2fcdfc;var _0xdd4a44;return db['FreshdeskConfiguration'][_0xccef('0x47')]({'where':{'id':_0x25bc28[_0xccef('0x3f')]['id']}})[_0xccef('0x23')](handleEntityNotFound(_0x3d2d61,null))['then'](function(_0x5e9e40){if(_0x5e9e40){_0x2fcdfc=_0x5e9e40;_0x2206c0[_0xccef('0x2d')]=_[_0xccef('0x2f')](db[_0xccef('0x48')]['rawAttributes']);_0x2206c0[_0xccef('0x2e')]=_['keys'](_0x25bc28[_0xccef('0x2e')]);_0x2206c0[_0xccef('0x37')]=_[_0xccef('0x30')](_0x2206c0[_0xccef('0x2d')],_0x2206c0[_0xccef('0x2e')]);_0x3720c2[_0xccef('0x31')]=_[_0xccef('0x30')](_0x2206c0['model'],qs[_0xccef('0x41')](_0x25bc28[_0xccef('0x2e')][_0xccef('0x41')]));_0x3720c2['attributes']=_0x3720c2[_0xccef('0x31')]['length']?_0x3720c2[_0xccef('0x31')]:_0x2206c0[_0xccef('0x2d')];_0x3720c2[_0xccef('0x34')]=qs['sort'](_0x25bc28[_0xccef('0x2e')][_0xccef('0x35')]);_0x3720c2[_0xccef('0x36')]=qs[_0xccef('0x37')](_[_0xccef('0x49')](_0x25bc28[_0xccef('0x2e')],_0x2206c0[_0xccef('0x37')]));if(_0x25bc28['query'][_0xccef('0x4a')]){_0x3720c2[_0xccef('0x36')]=_['merge'](_0x3720c2[_0xccef('0x36')],{'$or':_['map'](_0x3720c2[_0xccef('0x31')],function(_0x503db9){var _0x44c2d4={};_0x44c2d4[_0x503db9]={'$like':'%'+_0x25bc28['query'][_0xccef('0x4a')]+'%'};return _0x44c2d4;})});}_0x3720c2=_[_0xccef('0x38')]({},_0x3720c2,_0x25bc28[_0xccef('0x3a')]);return _0x2fcdfc[_0xccef('0x4b')](_0x3720c2);}})[_0xccef('0x23')](function(_0x422daa){if(_0x422daa){_0xdd4a44=_0x422daa[_0xccef('0x32')];if(!_0x25bc28[_0xccef('0x2e')][_0xccef('0x4c')](_0xccef('0x33'))){_0x3720c2[_0xccef('0x1a')]=qs[_0xccef('0x1a')](_0x25bc28[_0xccef('0x2e')][_0xccef('0x1a')]);_0x3720c2[_0xccef('0x19')]=qs[_0xccef('0x19')](_0x25bc28['query']['offset']);}return _0x2fcdfc[_0xccef('0x4b')](_0x3720c2);}})[_0xccef('0x23')](function(_0x31781d){if(_0x31781d){return _0x31781d?{'count':_0xdd4a44,'rows':_0x31781d}:null;}})[_0xccef('0x23')](respondWithResult(_0x3d2d61,null))[_0xccef('0x45')](handleError(_0x3d2d61,null));};exports[_0xccef('0x4d')]=function(_0x46443f,_0x3166e1,_0x420f4a){var _0xf13c0a={};var _0x7c7250={};var _0x3dcfc6;var _0x425067;return db['FreshdeskConfiguration'][_0xccef('0x47')]({'where':{'id':_0x46443f[_0xccef('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3166e1,null))[_0xccef('0x23')](function(_0x136ada){if(_0x136ada){_0x3dcfc6=_0x136ada;_0x7c7250[_0xccef('0x2d')]=_[_0xccef('0x2f')](db[_0xccef('0x48')][_0xccef('0x40')]);_0x7c7250[_0xccef('0x2e')]=_[_0xccef('0x2f')](_0x46443f['query']);_0x7c7250[_0xccef('0x37')]=_['intersection'](_0x7c7250['model'],_0x7c7250[_0xccef('0x2e')]);_0xf13c0a[_0xccef('0x31')]=_[_0xccef('0x30')](_0x7c7250[_0xccef('0x2d')],qs[_0xccef('0x41')](_0x46443f[_0xccef('0x2e')][_0xccef('0x41')]));_0xf13c0a[_0xccef('0x31')]=_0xf13c0a[_0xccef('0x31')][_0xccef('0x32')]?_0xf13c0a[_0xccef('0x31')]:_0x7c7250['model'];_0xf13c0a['order']=qs[_0xccef('0x35')](_0x46443f[_0xccef('0x2e')]['sort']);_0xf13c0a['where']=qs[_0xccef('0x37')](_['pick'](_0x46443f[_0xccef('0x2e')],_0x7c7250[_0xccef('0x37')]));if(_0x46443f[_0xccef('0x2e')][_0xccef('0x4a')]){_0xf13c0a[_0xccef('0x36')]=_[_0xccef('0x38')](_0xf13c0a[_0xccef('0x36')],{'$or':_[_0xccef('0x29')](_0xf13c0a[_0xccef('0x31')],function(_0x3f93c3){var _0x3ad2d6={};_0x3ad2d6[_0x3f93c3]={'$like':'%'+_0x46443f['query'][_0xccef('0x4a')]+'%'};return _0x3ad2d6;})});}_0xf13c0a=_[_0xccef('0x38')]({},_0xf13c0a,_0x46443f['options']);return _0x3dcfc6[_0xccef('0x4d')](_0xf13c0a);}})['then'](function(_0x595b97){if(_0x595b97){_0x425067=_0x595b97[_0xccef('0x32')];if(!_0x46443f[_0xccef('0x2e')][_0xccef('0x4c')](_0xccef('0x33'))){_0xf13c0a[_0xccef('0x1a')]=qs[_0xccef('0x1a')](_0x46443f[_0xccef('0x2e')][_0xccef('0x1a')]);_0xf13c0a[_0xccef('0x19')]=qs[_0xccef('0x19')](_0x46443f[_0xccef('0x2e')][_0xccef('0x19')]);}return _0x3dcfc6[_0xccef('0x4d')](_0xf13c0a);}})[_0xccef('0x23')](function(_0x4eb957){if(_0x4eb957){return _0x4eb957?{'count':_0x425067,'rows':_0x4eb957}:null;}})[_0xccef('0x23')](respondWithResult(_0x3166e1,null))[_0xccef('0x45')](handleError(_0x3166e1,null));};exports[_0xccef('0x4e')]=function(_0xea679e,_0x4157f7,_0x31b0f3){var _0x51e314={};var _0x3dd37a={};var _0x31ae85;var _0x4365dc;return db[_0xccef('0x2a')]['findOne']({'where':{'id':_0xea679e['params']['id']}})[_0xccef('0x23')](handleEntityNotFound(_0x4157f7,null))[_0xccef('0x23')](function(_0x5d393f){if(_0x5d393f){_0x31ae85=_0x5d393f;_0x3dd37a[_0xccef('0x2d')]=_[_0xccef('0x2f')](db[_0xccef('0x48')][_0xccef('0x40')]);_0x3dd37a[_0xccef('0x2e')]=_[_0xccef('0x2f')](_0xea679e[_0xccef('0x2e')]);_0x3dd37a['filters']=_[_0xccef('0x30')](_0x3dd37a['model'],_0x3dd37a[_0xccef('0x2e')]);_0x51e314[_0xccef('0x31')]=_[_0xccef('0x30')](_0x3dd37a['model'],qs[_0xccef('0x41')](_0xea679e[_0xccef('0x2e')][_0xccef('0x41')]));_0x51e314['attributes']=_0x51e314[_0xccef('0x31')][_0xccef('0x32')]?_0x51e314['attributes']:_0x3dd37a[_0xccef('0x2d')];_0x51e314[_0xccef('0x34')]=qs[_0xccef('0x35')](_0xea679e[_0xccef('0x2e')][_0xccef('0x35')]);_0x51e314[_0xccef('0x36')]=qs[_0xccef('0x37')](_[_0xccef('0x49')](_0xea679e[_0xccef('0x2e')],_0x3dd37a[_0xccef('0x37')]));if(_0xea679e[_0xccef('0x2e')][_0xccef('0x4a')]){_0x51e314['where']=_[_0xccef('0x38')](_0x51e314[_0xccef('0x36')],{'$or':_[_0xccef('0x29')](_0x51e314[_0xccef('0x31')],function(_0x4cb9d0){var _0x3f905a={};_0x3f905a[_0x4cb9d0]={'$like':'%'+_0xea679e['query'][_0xccef('0x4a')]+'%'};return _0x3f905a;})});}_0x51e314=_[_0xccef('0x38')]({},_0x51e314,_0xea679e['options']);return _0x31ae85[_0xccef('0x4e')](_0x51e314);}})[_0xccef('0x23')](function(_0x36a18a){if(_0x36a18a){_0x4365dc=_0x36a18a['length'];if(!_0xea679e[_0xccef('0x2e')][_0xccef('0x4c')]('nolimit')){_0x51e314['limit']=qs['limit'](_0xea679e[_0xccef('0x2e')][_0xccef('0x1a')]);_0x51e314['offset']=qs[_0xccef('0x19')](_0xea679e['query'][_0xccef('0x19')]);}return _0x31ae85['getDescriptions'](_0x51e314);}})[_0xccef('0x23')](function(_0x59a1f1){if(_0x59a1f1){return _0x59a1f1?{'count':_0x4365dc,'rows':_0x59a1f1}:null;}})[_0xccef('0x23')](respondWithResult(_0x4157f7,null))['catch'](handleError(_0x4157f7,null));};exports[_0xccef('0x4f')]=function(_0x1bccda,_0x18b3d6,_0x2d5e9b){var _0x4ec674={};var _0x7159df={};var _0x2a853e;var _0x51b85a;return db[_0xccef('0x2a')]['findOne']({'where':{'id':_0x1bccda['params']['id']}})[_0xccef('0x23')](handleEntityNotFound(_0x18b3d6,null))[_0xccef('0x23')](function(_0x4d14ae){if(_0x4d14ae){_0x2a853e=_0x4d14ae;_0x7159df[_0xccef('0x2d')]=_[_0xccef('0x2f')](db[_0xccef('0x50')][_0xccef('0x40')]);_0x7159df[_0xccef('0x2e')]=_[_0xccef('0x2f')](_0x1bccda[_0xccef('0x2e')]);_0x7159df[_0xccef('0x37')]=_[_0xccef('0x30')](_0x7159df[_0xccef('0x2d')],_0x7159df[_0xccef('0x2e')]);_0x4ec674[_0xccef('0x31')]=_[_0xccef('0x30')](_0x7159df[_0xccef('0x2d')],qs[_0xccef('0x41')](_0x1bccda[_0xccef('0x2e')][_0xccef('0x41')]));_0x4ec674[_0xccef('0x31')]=_0x4ec674[_0xccef('0x31')][_0xccef('0x32')]?_0x4ec674[_0xccef('0x31')]:_0x7159df[_0xccef('0x2d')];_0x4ec674[_0xccef('0x34')]=qs['sort'](_0x1bccda[_0xccef('0x2e')][_0xccef('0x35')]);_0x4ec674[_0xccef('0x36')]=qs['filters'](_[_0xccef('0x49')](_0x1bccda[_0xccef('0x2e')],_0x7159df['filters']));if(_0x1bccda['query']['filter']){_0x4ec674['where']=_['merge'](_0x4ec674[_0xccef('0x36')],{'$or':_[_0xccef('0x29')](_0x4ec674[_0xccef('0x31')],function(_0x5785b5){var _0x3a9ef0={};_0x3a9ef0[_0x5785b5]={'$like':'%'+_0x1bccda[_0xccef('0x2e')][_0xccef('0x4a')]+'%'};return _0x3a9ef0;})});}_0x4ec674=_[_0xccef('0x38')]({},_0x4ec674,_0x1bccda[_0xccef('0x3a')]);return _0x2a853e['getTags'](_0x4ec674);}})['then'](function(_0x7802ae){if(_0x7802ae){_0x51b85a=_0x7802ae[_0xccef('0x32')];if(!_0x1bccda[_0xccef('0x2e')][_0xccef('0x4c')]('nolimit')){_0x4ec674[_0xccef('0x1a')]=qs[_0xccef('0x1a')](_0x1bccda['query'][_0xccef('0x1a')]);_0x4ec674['offset']=qs[_0xccef('0x19')](_0x1bccda[_0xccef('0x2e')][_0xccef('0x19')]);}return _0x2a853e['getTags'](_0x4ec674);}})[_0xccef('0x23')](function(_0x3c1daa){if(_0x3c1daa){return _0x3c1daa?{'count':_0x51b85a,'rows':_0x3c1daa}:null;}})[_0xccef('0x23')](respondWithResult(_0x18b3d6,null))[_0xccef('0x45')](handleError(_0x18b3d6,null));};exports[_0xccef('0x51')]=function(_0x3f6b12,_0x55109a,_0x77c423){if(_0x3f6b12[_0xccef('0x44')]['id']){delete _0x3f6b12['body']['id'];}return db['FreshdeskConfiguration'][_0xccef('0x47')]({'where':{'id':_0x3f6b12[_0xccef('0x3f')]['id']}})[_0xccef('0x23')](handleEntityNotFound(_0x55109a,null))[_0xccef('0x23')](function(_0x28fe61){if(_0x28fe61){return _0x28fe61[_0xccef('0x51')](_0x3f6b12[_0xccef('0x44')][_0xccef('0x52')]||[]);}return null;})[_0xccef('0x23')](respondWithResult(_0x55109a,null))[_0xccef('0x45')](handleError(_0x55109a,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 7bea4f8..4f30489 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 _0x2564=['define','FreshdeskConfiguration','lodash','util','api','moment','bluebird','path','exports'];(function(_0x4b26a2,_0x3c86e3){var _0x2675cb=function(_0x2be9df){while(--_0x2be9df){_0x4b26a2['push'](_0x4b26a2['shift']());}};_0x2675cb(++_0x3c86e3);}(_0x2564,0x65));var _0x4256=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2564[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x4256('0x0'));var util=require(_0x4256('0x1'));var logger=require('../../config/logger')(_0x4256('0x2'));var moment=require(_0x4256('0x3'));var BPromise=require(_0x4256('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4256('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x4256('0x6')]=function(_0x3dd77c,_0x1d76fe){return _0x3dd77c[_0x4256('0x7')](_0x4256('0x8'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x633f=['./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x633f,0x64));var _0xf633=function(_0x1649e0,_0x493347){_0x1649e0=_0x1649e0-0x0;var _0x5c8f79=_0x633f[_0x1649e0];return _0x5c8f79;};'use strict';var _=require(_0xf633('0x0'));var util=require(_0xf633('0x1'));var logger=require('../../config/logger')(_0xf633('0x2'));var moment=require(_0xf633('0x3'));var BPromise=require(_0xf633('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf633('0x5'));var rimraf=require(_0xf633('0x6'));var config=require(_0xf633('0x7'));var attributes=require(_0xf633('0x8'));module['exports']=function(_0x17be35,_0x485806){return _0x17be35[_0xf633('0x9')](_0xf633('0xa'),attributes,{'tableName':_0xf633('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 0f87f0f..aa8249b 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 _0x632b=['client','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1c019b,_0x5f048d){var _0x4031fe=function(_0x188bbd){while(--_0x188bbd){_0x1c019b['push'](_0x1c019b['shift']());}};_0x4031fe(++_0x5f048d);}(_0x632b,0x1c4));var _0xb632=function(_0x550303,_0x5ad944){_0x550303=_0x550303-0x0;var _0x21c6b0=_0x632b[_0x550303];return _0x21c6b0;};'use strict';var _=require(_0xb632('0x0'));var util=require(_0xb632('0x1'));var moment=require(_0xb632('0x2'));var BPromise=require('bluebird');var rs=require(_0xb632('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb632('0x4'))['db'];var utils=require(_0xb632('0x5'));var logger=require(_0xb632('0x6'))(_0xb632('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb632('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e213f,_0x35b89d,_0x4e9c6f){return new BPromise(function(_0x1685b1,_0x5cb575){return client[_0xb632('0x9')](_0x1e213f,_0x4e9c6f)[_0xb632('0xa')](function(_0x48719f){logger[_0xb632('0xb')](_0xb632('0xc'),_0x35b89d,'request\x20sent');logger[_0xb632('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x35b89d,_0xb632('0xe'),JSON[_0xb632('0xf')](_0x48719f));if(_0x48719f[_0xb632('0x10')]){if(_0x48719f[_0xb632('0x10')][_0xb632('0x11')]===0x1f4){logger['error'](_0xb632('0xc'),_0x35b89d,_0x48719f['error'][_0xb632('0x12')]);return _0x5cb575(_0x48719f[_0xb632('0x10')]['message']);}logger[_0xb632('0x10')](_0xb632('0xc'),_0x35b89d,_0x48719f[_0xb632('0x10')][_0xb632('0x12')]);return _0x1685b1(_0x48719f[_0xb632('0x10')][_0xb632('0x12')]);}else{logger[_0xb632('0xb')](_0xb632('0xc'),_0x35b89d,'request\x20sent');_0x1685b1(_0x48719f['result'][_0xb632('0x12')]);}})[_0xb632('0x13')](function(_0x4f8bdc){logger[_0xb632('0x10')](_0xb632('0xc'),_0x35b89d,_0x4f8bdc);_0x5cb575(_0x4f8bdc);});});} \ No newline at end of file +var _0x8ed4=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','client','http','request','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch'];(function(_0x2d31b8,_0x242597){var _0x547be0=function(_0x281cc1){while(--_0x281cc1){_0x2d31b8['push'](_0x2d31b8['shift']());}};_0x547be0(++_0x242597);}(_0x8ed4,0x156));var _0x48ed=function(_0x1d0dc9,_0xe8d66c){_0x1d0dc9=_0x1d0dc9-0x0;var _0xba0072=_0x8ed4[_0x1d0dc9];return _0xba0072;};'use strict';var _=require(_0x48ed('0x0'));var util=require(_0x48ed('0x1'));var moment=require(_0x48ed('0x2'));var BPromise=require(_0x48ed('0x3'));var rs=require(_0x48ed('0x4'));var fs=require('fs');var Redis=require(_0x48ed('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x48ed('0x6'))('rpc');var config=require(_0x48ed('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x48ed('0x8')][_0x48ed('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3474df,_0x242d09,_0x3c5895){return new BPromise(function(_0x430611,_0x382bfd){return client[_0x48ed('0xa')](_0x3474df,_0x3c5895)['then'](function(_0x31a711){logger[_0x48ed('0xb')](_0x48ed('0xc'),_0x242d09,_0x48ed('0xd'));logger['debug'](_0x48ed('0xe'),_0x242d09,'request\x20sent',JSON['stringify'](_0x31a711));if(_0x31a711['error']){if(_0x31a711[_0x48ed('0xf')][_0x48ed('0x10')]===0x1f4){logger['error'](_0x48ed('0xc'),_0x242d09,_0x31a711[_0x48ed('0xf')][_0x48ed('0x11')]);return _0x382bfd(_0x31a711['error']['message']);}logger[_0x48ed('0xf')](_0x48ed('0xc'),_0x242d09,_0x31a711[_0x48ed('0xf')][_0x48ed('0x11')]);return _0x430611(_0x31a711[_0x48ed('0xf')]['message']);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x242d09,_0x48ed('0xd'));_0x430611(_0x31a711['result'][_0x48ed('0x11')]);}})[_0x48ed('0x12')](function(_0x54b70d){logger[_0x48ed('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x242d09,_0x54b70d);_0x382bfd(_0x54b70d);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 1dada8b..2699d36 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 _0xf5c3=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','put','update','destroy','exports','multer','path','express','Router','fs-extra'];(function(_0x3582de,_0x4cd6d1){var _0x202b18=function(_0x31e140){while(--_0x31e140){_0x3582de['push'](_0x3582de['shift']());}};_0x202b18(++_0x4cd6d1);}(_0xf5c3,0x12d));var _0x3f5c=function(_0x4d1c84,_0x58563a){_0x4d1c84=_0x4d1c84-0x0;var _0x238fa6=_0xf5c3[_0x4d1c84];return _0x238fa6;};'use strict';var multer=require(_0x3f5c('0x0'));var util=require('util');var path=require(_0x3f5c('0x1'));var timeout=require('connect-timeout');var express=require(_0x3f5c('0x2'));var router=express[_0x3f5c('0x3')]();var fs_extra=require(_0x3f5c('0x4'));var auth=require(_0x3f5c('0x5'));var interaction=require(_0x3f5c('0x6'));var config=require(_0x3f5c('0x7'));var controller=require('./intFreshdeskField.controller');router[_0x3f5c('0x8')]('/',auth[_0x3f5c('0x9')](),controller['index']);router[_0x3f5c('0x8')](_0x3f5c('0xa'),auth[_0x3f5c('0x9')](),controller[_0x3f5c('0xb')]);router[_0x3f5c('0xc')]('/',auth[_0x3f5c('0x9')](),controller['create']);router[_0x3f5c('0xd')](_0x3f5c('0xa'),auth[_0x3f5c('0x9')](),controller[_0x3f5c('0xe')]);router['delete']('/:id',auth[_0x3f5c('0x9')](),controller[_0x3f5c('0xf')]);module[_0x3f5c('0x10')]=router; \ No newline at end of file +var _0xdb2e=['/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','post','create'];(function(_0x35d59c,_0x341ef9){var _0x18cd27=function(_0x16a9c4){while(--_0x16a9c4){_0x35d59c['push'](_0x35d59c['shift']());}};_0x18cd27(++_0x341ef9);}(_0xdb2e,0x1c7));var _0xedb2=function(_0x1a08cc,_0x1ff763){_0x1a08cc=_0x1a08cc-0x0;var _0x2ce2ec=_0xdb2e[_0x1a08cc];return _0x2ce2ec;};'use strict';var multer=require(_0xedb2('0x0'));var util=require('util');var path=require(_0xedb2('0x1'));var timeout=require(_0xedb2('0x2'));var express=require(_0xedb2('0x3'));var router=express['Router']();var fs_extra=require(_0xedb2('0x4'));var auth=require(_0xedb2('0x5'));var interaction=require(_0xedb2('0x6'));var config=require(_0xedb2('0x7'));var controller=require('./intFreshdeskField.controller');router['get']('/',auth[_0xedb2('0x8')](),controller['index']);router[_0xedb2('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xedb2('0xa')]);router[_0xedb2('0xb')]('/',auth[_0xedb2('0x8')](),controller[_0xedb2('0xc')]);router['put'](_0xedb2('0xd'),auth[_0xedb2('0x8')](),controller[_0xedb2('0xe')]);router[_0xedb2('0xf')]('/:id',auth[_0xedb2('0x8')](),controller[_0xedb2('0x10')]);module[_0xedb2('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 1ba4f34..8a0b1d1 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 _0x0969=['customVariable','keyValue','picklist','STRING','variable','BOOLEAN','exports','ENUM','string'];(function(_0x548627,_0x4ec392){var _0x844a84=function(_0x2ffdd2){while(--_0x2ffdd2){_0x548627['push'](_0x548627['shift']());}};_0x844a84(++_0x4ec392);}(_0x0969,0x7b));var _0x9096=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x0969[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require('sequelize');module[_0x9096('0x0')]={'type':{'type':Sequelize[_0x9096('0x1')](_0x9096('0x2'),'variable',_0x9096('0x3'),_0x9096('0x4'),_0x9096('0x5')),'defaultValue':_0x9096('0x2')},'content':{'type':Sequelize[_0x9096('0x6')]},'key':{'type':Sequelize[_0x9096('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x9096('0x7'),_0x9096('0x3'))},'keyContent':{'type':Sequelize[_0x9096('0x6')]},'idField':{'type':Sequelize[_0x9096('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x9096('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9096('0x6')]}}; \ No newline at end of file +var _0xcbcd=['sequelize','exports','string','variable','customVariable','keyValue','STRING','ENUM','BOOLEAN'];(function(_0x20b58b,_0x329485){var _0xc10533=function(_0x1d2043){while(--_0x1d2043){_0x20b58b['push'](_0x20b58b['shift']());}};_0xc10533(++_0x329485);}(_0xcbcd,0x117));var _0xdcbc=function(_0x543242,_0xeac9fd){_0x543242=_0x543242-0x0;var _0x4c99b6=_0xcbcd[_0x543242];return _0x4c99b6;};'use strict';var Sequelize=require(_0xdcbc('0x0'));module[_0xdcbc('0x1')]={'type':{'type':Sequelize['ENUM'](_0xdcbc('0x2'),_0xdcbc('0x3'),_0xdcbc('0x4'),_0xdcbc('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xdcbc('0x6')]},'key':{'type':Sequelize[_0xdcbc('0x6')]},'keyType':{'type':Sequelize[_0xdcbc('0x7')](_0xdcbc('0x2'),_0xdcbc('0x3'),_0xdcbc('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xdcbc('0x6')]},'customField':{'type':Sequelize[_0xdcbc('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdcbc('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index f02817e..2cfa1cd 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 _0x6f2f=['Content-Range','json','reject','save','then','destroy','error','stack','name','send','index','map','FreshdeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','update','body','eml-format','rimraf','moment','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count'];(function(_0x4d770d,_0x5af4ce){var _0x11dc7a=function(_0x27d3f7){while(--_0x27d3f7){_0x4d770d['push'](_0x4d770d['shift']());}};_0x11dc7a(++_0x5af4ce);}(_0x6f2f,0xbe));var _0xf6f2=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x6f2f[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0xf6f2('0x0'));var rimraf=require(_0xf6f2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf6f2('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf6f2('0x3'));var path=require(_0xf6f2('0x4'));var sox=require(_0xf6f2('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf6f2('0x6'));var _=require(_0xf6f2('0x7'));var squel=require(_0xf6f2('0x8'));var crypto=require(_0xf6f2('0x9'));var jsforce=require(_0xf6f2('0xa'));var deskjs=require(_0xf6f2('0xb'));var toCsv=require(_0xf6f2('0xc'));var querystring=require(_0xf6f2('0xd'));var Papa=require(_0xf6f2('0xe'));var Redis=require(_0xf6f2('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf6f2('0x10'));var as=require(_0xf6f2('0x11'));var hardwareService=require(_0xf6f2('0x12'));var logger=require(_0xf6f2('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf6f2('0x14'));var db=require(_0xf6f2('0x15'))['db'];function respondWithStatusCode(_0x131a18,_0x4afa2){_0x4afa2=_0x4afa2||0xcc;return function(_0x1626ce){if(_0x1626ce){return _0x131a18[_0xf6f2('0x16')](_0x4afa2);}return _0x131a18['status'](_0x4afa2)[_0xf6f2('0x17')]();};}function respondWithResult(_0x5ef5ac,_0xccf687){_0xccf687=_0xccf687||0xc8;return function(_0x3cf95f){if(_0x3cf95f){return _0x5ef5ac[_0xf6f2('0x18')](_0xccf687)['json'](_0x3cf95f);}};}function respondWithFilteredResult(_0x2b28c1,_0x27c0dc){return function(_0x314f9a){if(_0x314f9a){var _0x26c176=typeof _0x27c0dc[_0xf6f2('0x19')]===_0xf6f2('0x1a')&&typeof _0x27c0dc[_0xf6f2('0x1b')]===_0xf6f2('0x1a');var _0x4115dd=_0x314f9a[_0xf6f2('0x1c')];var _0x400055=_0x26c176?0x0:_0x27c0dc[_0xf6f2('0x19')];var _0x42b93b=_0x26c176?_0x314f9a[_0xf6f2('0x1c')]:_0x27c0dc[_0xf6f2('0x19')]+_0x27c0dc['limit'];var _0x4de8bd;if(_0x42b93b>=_0x4115dd){_0x42b93b=_0x4115dd;_0x4de8bd=0xc8;}else{_0x4de8bd=0xce;}_0x2b28c1[_0xf6f2('0x18')](_0x4de8bd);return _0x2b28c1['set'](_0xf6f2('0x1d'),_0x400055+'-'+_0x42b93b+'/'+_0x4115dd)[_0xf6f2('0x1e')](_0x314f9a);}return null;};}function patchUpdates(_0x312429){return function(_0x1ad76b){try{jsonpatch['apply'](_0x1ad76b,_0x312429,!![]);}catch(_0xd020e6){return BPromise[_0xf6f2('0x1f')](_0xd020e6);}return _0x1ad76b[_0xf6f2('0x20')]();};}function saveUpdates(_0x3321a0,_0x5dce4f){return function(_0x19be8e){if(_0x19be8e){return _0x19be8e['update'](_0x3321a0)[_0xf6f2('0x21')](function(_0x56b97a){return _0x56b97a;});}return null;};}function removeEntity(_0x1e33c,_0x151905){return function(_0x582862){if(_0x582862){return _0x582862[_0xf6f2('0x22')]()[_0xf6f2('0x21')](function(){_0x1e33c[_0xf6f2('0x18')](0xcc)[_0xf6f2('0x17')]();});}};}function handleEntityNotFound(_0x219a12,_0x1f3500){return function(_0x3304ec){if(!_0x3304ec){_0x219a12[_0xf6f2('0x16')](0x194);}return _0x3304ec;};}function handleError(_0x5dac6a,_0x2b233f){_0x2b233f=_0x2b233f||0x1f4;return function(_0x2081f6){logger[_0xf6f2('0x23')](_0x2081f6[_0xf6f2('0x24')]);if(_0x2081f6[_0xf6f2('0x25')]){delete _0x2081f6[_0xf6f2('0x25')];}_0x5dac6a[_0xf6f2('0x18')](_0x2b233f)[_0xf6f2('0x26')](_0x2081f6);};}exports[_0xf6f2('0x27')]=function(_0x40243e,_0x2c643d){var _0x4accfe={},_0x2aa645={},_0x26c4dc={'count':0x0,'rows':[]};var _0x17c63f=_[_0xf6f2('0x28')](db[_0xf6f2('0x29')][_0xf6f2('0x2a')],function(_0x228b24){return{'name':_0x228b24[_0xf6f2('0x2b')],'type':_0x228b24[_0xf6f2('0x2c')][_0xf6f2('0x2d')]};});_0x2aa645[_0xf6f2('0x2e')]=_[_0xf6f2('0x28')](_0x17c63f,'name');_0x2aa645[_0xf6f2('0x2f')]=_[_0xf6f2('0x30')](_0x40243e[_0xf6f2('0x2f')]);_0x2aa645[_0xf6f2('0x31')]=_[_0xf6f2('0x32')](_0x2aa645[_0xf6f2('0x2e')],_0x2aa645[_0xf6f2('0x2f')]);_0x4accfe[_0xf6f2('0x33')]=_[_0xf6f2('0x32')](_0x2aa645[_0xf6f2('0x2e')],qs[_0xf6f2('0x34')](_0x40243e[_0xf6f2('0x2f')][_0xf6f2('0x34')]));_0x4accfe['attributes']=_0x4accfe['attributes']['length']?_0x4accfe[_0xf6f2('0x33')]:_0x2aa645[_0xf6f2('0x2e')];if(!_0x40243e['query']['hasOwnProperty'](_0xf6f2('0x35'))){_0x4accfe[_0xf6f2('0x1b')]=qs[_0xf6f2('0x1b')](_0x40243e[_0xf6f2('0x2f')][_0xf6f2('0x1b')]);_0x4accfe[_0xf6f2('0x19')]=qs['offset'](_0x40243e[_0xf6f2('0x2f')]['offset']);}_0x4accfe[_0xf6f2('0x36')]=qs[_0xf6f2('0x37')](_0x40243e[_0xf6f2('0x2f')][_0xf6f2('0x37')]);_0x4accfe['where']=qs[_0xf6f2('0x31')](_[_0xf6f2('0x38')](_0x40243e[_0xf6f2('0x2f')],_0x2aa645['filters']),_0x17c63f);if(_0x40243e[_0xf6f2('0x2f')][_0xf6f2('0x39')]){_0x4accfe[_0xf6f2('0x3a')]=_['merge'](_0x4accfe[_0xf6f2('0x3a')],{'$or':_['map'](_0x17c63f,function(_0x38b20d){if(_0x38b20d[_0xf6f2('0x2c')]!==_0xf6f2('0x3b')){var _0x55e44d={};_0x55e44d[_0x38b20d[_0xf6f2('0x25')]]={'$like':'%'+_0x40243e[_0xf6f2('0x2f')][_0xf6f2('0x39')]+'%'};return _0x55e44d;}})});}_0x4accfe=_[_0xf6f2('0x3c')]({},_0x4accfe,_0x40243e[_0xf6f2('0x3d')]);var _0x4ee53f={'where':_0x4accfe[_0xf6f2('0x3a')]};return db[_0xf6f2('0x29')][_0xf6f2('0x1c')](_0x4ee53f)[_0xf6f2('0x21')](function(_0x3986f1){_0x26c4dc[_0xf6f2('0x1c')]=_0x3986f1;if(_0x40243e[_0xf6f2('0x2f')]['includeAll']){_0x4accfe[_0xf6f2('0x3e')]=[{'all':!![]}];}return db[_0xf6f2('0x29')][_0xf6f2('0x3f')](_0x4accfe);})['then'](function(_0x244a8c){_0x26c4dc[_0xf6f2('0x40')]=_0x244a8c;return _0x26c4dc;})[_0xf6f2('0x21')](respondWithFilteredResult(_0x2c643d,_0x4accfe))[_0xf6f2('0x41')](handleError(_0x2c643d,null));};exports[_0xf6f2('0x42')]=function(_0x4c4f17,_0x47090b){var _0x31f367={'raw':!![],'where':{'id':_0x4c4f17[_0xf6f2('0x43')]['id']}},_0x34ba3a={};_0x34ba3a[_0xf6f2('0x2e')]=_['keys'](db[_0xf6f2('0x29')]['rawAttributes']);_0x34ba3a[_0xf6f2('0x2f')]=_[_0xf6f2('0x30')](_0x4c4f17[_0xf6f2('0x2f')]);_0x34ba3a[_0xf6f2('0x31')]=_[_0xf6f2('0x32')](_0x34ba3a[_0xf6f2('0x2e')],_0x34ba3a[_0xf6f2('0x2f')]);_0x31f367[_0xf6f2('0x33')]=_[_0xf6f2('0x32')](_0x34ba3a[_0xf6f2('0x2e')],qs[_0xf6f2('0x34')](_0x4c4f17['query'][_0xf6f2('0x34')]));_0x31f367[_0xf6f2('0x33')]=_0x31f367[_0xf6f2('0x33')]['length']?_0x31f367['attributes']:_0x34ba3a['model'];if(_0x4c4f17[_0xf6f2('0x2f')][_0xf6f2('0x44')]){_0x31f367['include']=[{'all':!![]}];}_0x31f367=_['merge']({},_0x31f367,_0x4c4f17[_0xf6f2('0x3d')]);return db[_0xf6f2('0x29')][_0xf6f2('0x45')](_0x31f367)[_0xf6f2('0x21')](handleEntityNotFound(_0x47090b,null))[_0xf6f2('0x21')](respondWithResult(_0x47090b,null))[_0xf6f2('0x41')](handleError(_0x47090b,null));};exports['create']=function(_0x5b4737,_0x5daa2c){return db['FreshdeskField'][_0xf6f2('0x46')](_0x5b4737['body'],{})[_0xf6f2('0x21')](respondWithResult(_0x5daa2c,0xc9))[_0xf6f2('0x41')](handleError(_0x5daa2c,null));};exports[_0xf6f2('0x47')]=function(_0x3b7d67,_0x28da53){if(_0x3b7d67['body']['id']){delete _0x3b7d67['body']['id'];}return db[_0xf6f2('0x29')]['find']({'where':{'id':_0x3b7d67['params']['id']}})[_0xf6f2('0x21')](handleEntityNotFound(_0x28da53,null))[_0xf6f2('0x21')](saveUpdates(_0x3b7d67[_0xf6f2('0x48')],null))[_0xf6f2('0x21')](respondWithResult(_0x28da53,null))[_0xf6f2('0x41')](handleError(_0x28da53,null));};exports[_0xf6f2('0x22')]=function(_0x5351f5,_0x443277){return db[_0xf6f2('0x29')]['find']({'where':{'id':_0x5351f5[_0xf6f2('0x43')]['id']}})[_0xf6f2('0x21')](handleEntityNotFound(_0x443277,null))[_0xf6f2('0x21')](removeEntity(_0x443277,null))['catch'](handleError(_0x443277,null));}; \ No newline at end of file +var _0x4483=['offset','undefined','limit','count','set','apply','reject','update','destroy','then','stack','name','send','index','FreshdeskField','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','includeAll','include','findAll','catch','show','params','filters','options','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','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','api','../../config/utils','../../config/environment','sendStatus','status','end','json'];(function(_0x5b805d,_0x259932){var _0x4ec9c1=function(_0x8a108e){while(--_0x8a108e){_0x5b805d['push'](_0x5b805d['shift']());}};_0x4ec9c1(++_0x259932);}(_0x4483,0x1a3));var _0x3448=function(_0x432ff5,_0x435cbf){_0x432ff5=_0x432ff5-0x0;var _0x336082=_0x4483[_0x432ff5];return _0x336082;};'use strict';var emlformat=require(_0x3448('0x0'));var rimraf=require(_0x3448('0x1'));var zipdir=require(_0x3448('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3448('0x3'));var moment=require(_0x3448('0x4'));var BPromise=require(_0x3448('0x5'));var Mustache=require(_0x3448('0x6'));var util=require(_0x3448('0x7'));var path=require('path');var sox=require(_0x3448('0x8'));var csv=require(_0x3448('0x9'));var ejs=require(_0x3448('0xa'));var fs=require('fs');var fs_extra=require(_0x3448('0xb'));var _=require(_0x3448('0xc'));var squel=require(_0x3448('0xd'));var crypto=require(_0x3448('0xe'));var jsforce=require(_0x3448('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3448('0x10'));var Papa=require(_0x3448('0x11'));var Redis=require(_0x3448('0x12'));var authService=require(_0x3448('0x13'));var qs=require(_0x3448('0x14'));var as=require(_0x3448('0x15'));var hardwareService=require(_0x3448('0x16'));var logger=require(_0x3448('0x17'))(_0x3448('0x18'));var utils=require(_0x3448('0x19'));var config=require(_0x3448('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x298ae6,_0x38fbb1){_0x38fbb1=_0x38fbb1||0xcc;return function(_0x5f52bd){if(_0x5f52bd){return _0x298ae6[_0x3448('0x1b')](_0x38fbb1);}return _0x298ae6[_0x3448('0x1c')](_0x38fbb1)[_0x3448('0x1d')]();};}function respondWithResult(_0x549306,_0x14104c){_0x14104c=_0x14104c||0xc8;return function(_0x2952a6){if(_0x2952a6){return _0x549306['status'](_0x14104c)[_0x3448('0x1e')](_0x2952a6);}};}function respondWithFilteredResult(_0x2c2da6,_0x46784f){return function(_0x4fc70f){if(_0x4fc70f){var _0x472518=typeof _0x46784f[_0x3448('0x1f')]===_0x3448('0x20')&&typeof _0x46784f[_0x3448('0x21')]===_0x3448('0x20');var _0x1b2081=_0x4fc70f[_0x3448('0x22')];var _0x425514=_0x472518?0x0:_0x46784f['offset'];var _0x1658cd=_0x472518?_0x4fc70f['count']:_0x46784f['offset']+_0x46784f['limit'];var _0x1e9774;if(_0x1658cd>=_0x1b2081){_0x1658cd=_0x1b2081;_0x1e9774=0xc8;}else{_0x1e9774=0xce;}_0x2c2da6[_0x3448('0x1c')](_0x1e9774);return _0x2c2da6[_0x3448('0x23')]('Content-Range',_0x425514+'-'+_0x1658cd+'/'+_0x1b2081)[_0x3448('0x1e')](_0x4fc70f);}return null;};}function patchUpdates(_0x392c8d){return function(_0x317de6){try{jsonpatch[_0x3448('0x24')](_0x317de6,_0x392c8d,!![]);}catch(_0x29a15a){return BPromise[_0x3448('0x25')](_0x29a15a);}return _0x317de6['save']();};}function saveUpdates(_0x54c7ee,_0x4e6716){return function(_0x1b3d5a){if(_0x1b3d5a){return _0x1b3d5a[_0x3448('0x26')](_0x54c7ee)['then'](function(_0x5b1f7c){return _0x5b1f7c;});}return null;};}function removeEntity(_0x2dcd40,_0x4371d6){return function(_0x22ad5c){if(_0x22ad5c){return _0x22ad5c[_0x3448('0x27')]()[_0x3448('0x28')](function(){_0x2dcd40['status'](0xcc)[_0x3448('0x1d')]();});}};}function handleEntityNotFound(_0x1b5c49,_0x114244){return function(_0x2088de){if(!_0x2088de){_0x1b5c49[_0x3448('0x1b')](0x194);}return _0x2088de;};}function handleError(_0x56b3ff,_0x329947){_0x329947=_0x329947||0x1f4;return function(_0x393081){logger['error'](_0x393081[_0x3448('0x29')]);if(_0x393081[_0x3448('0x2a')]){delete _0x393081[_0x3448('0x2a')];}_0x56b3ff[_0x3448('0x1c')](_0x329947)[_0x3448('0x2b')](_0x393081);};}exports[_0x3448('0x2c')]=function(_0x31be64,_0x95714e){var _0x5911b8={},_0x3307dc={},_0x450704={'count':0x0,'rows':[]};var _0xcfdc5=_['map'](db[_0x3448('0x2d')]['rawAttributes'],function(_0x486f2c){return{'name':_0x486f2c['fieldName'],'type':_0x486f2c[_0x3448('0x2e')][_0x3448('0x2f')]};});_0x3307dc['model']=_['map'](_0xcfdc5,_0x3448('0x2a'));_0x3307dc[_0x3448('0x30')]=_[_0x3448('0x31')](_0x31be64[_0x3448('0x30')]);_0x3307dc['filters']=_[_0x3448('0x32')](_0x3307dc[_0x3448('0x33')],_0x3307dc[_0x3448('0x30')]);_0x5911b8['attributes']=_[_0x3448('0x32')](_0x3307dc[_0x3448('0x33')],qs['fields'](_0x31be64['query'][_0x3448('0x34')]));_0x5911b8[_0x3448('0x35')]=_0x5911b8[_0x3448('0x35')][_0x3448('0x36')]?_0x5911b8['attributes']:_0x3307dc[_0x3448('0x33')];if(!_0x31be64[_0x3448('0x30')][_0x3448('0x37')](_0x3448('0x38'))){_0x5911b8['limit']=qs[_0x3448('0x21')](_0x31be64[_0x3448('0x30')]['limit']);_0x5911b8[_0x3448('0x1f')]=qs[_0x3448('0x1f')](_0x31be64[_0x3448('0x30')][_0x3448('0x1f')]);}_0x5911b8[_0x3448('0x39')]=qs[_0x3448('0x3a')](_0x31be64[_0x3448('0x30')][_0x3448('0x3a')]);_0x5911b8[_0x3448('0x3b')]=qs['filters'](_['pick'](_0x31be64[_0x3448('0x30')],_0x3307dc['filters']),_0xcfdc5);if(_0x31be64[_0x3448('0x30')][_0x3448('0x3c')]){_0x5911b8[_0x3448('0x3b')]=_[_0x3448('0x3d')](_0x5911b8['where'],{'$or':_[_0x3448('0x3e')](_0xcfdc5,function(_0x18fc16){if(_0x18fc16[_0x3448('0x2e')]!==_0x3448('0x3f')){var _0x2e83c6={};_0x2e83c6[_0x18fc16[_0x3448('0x2a')]]={'$like':'%'+_0x31be64[_0x3448('0x30')][_0x3448('0x3c')]+'%'};return _0x2e83c6;}})});}_0x5911b8=_[_0x3448('0x3d')]({},_0x5911b8,_0x31be64['options']);var _0x39b22e={'where':_0x5911b8[_0x3448('0x3b')]};return db[_0x3448('0x2d')][_0x3448('0x22')](_0x39b22e)[_0x3448('0x28')](function(_0x58963d){_0x450704[_0x3448('0x22')]=_0x58963d;if(_0x31be64[_0x3448('0x30')][_0x3448('0x40')]){_0x5911b8[_0x3448('0x41')]=[{'all':!![]}];}return db[_0x3448('0x2d')][_0x3448('0x42')](_0x5911b8);})[_0x3448('0x28')](function(_0x3db5f1){_0x450704['rows']=_0x3db5f1;return _0x450704;})[_0x3448('0x28')](respondWithFilteredResult(_0x95714e,_0x5911b8))[_0x3448('0x43')](handleError(_0x95714e,null));};exports[_0x3448('0x44')]=function(_0x4a04d0,_0x2465ff){var _0x1d2a7c={'raw':!![],'where':{'id':_0x4a04d0[_0x3448('0x45')]['id']}},_0x21f989={};_0x21f989[_0x3448('0x33')]=_[_0x3448('0x31')](db[_0x3448('0x2d')]['rawAttributes']);_0x21f989[_0x3448('0x30')]=_[_0x3448('0x31')](_0x4a04d0[_0x3448('0x30')]);_0x21f989[_0x3448('0x46')]=_[_0x3448('0x32')](_0x21f989[_0x3448('0x33')],_0x21f989['query']);_0x1d2a7c[_0x3448('0x35')]=_['intersection'](_0x21f989['model'],qs[_0x3448('0x34')](_0x4a04d0[_0x3448('0x30')]['fields']));_0x1d2a7c[_0x3448('0x35')]=_0x1d2a7c[_0x3448('0x35')]['length']?_0x1d2a7c[_0x3448('0x35')]:_0x21f989[_0x3448('0x33')];if(_0x4a04d0['query'][_0x3448('0x40')]){_0x1d2a7c[_0x3448('0x41')]=[{'all':!![]}];}_0x1d2a7c=_[_0x3448('0x3d')]({},_0x1d2a7c,_0x4a04d0[_0x3448('0x47')]);return db[_0x3448('0x2d')][_0x3448('0x48')](_0x1d2a7c)[_0x3448('0x28')](handleEntityNotFound(_0x2465ff,null))['then'](respondWithResult(_0x2465ff,null))['catch'](handleError(_0x2465ff,null));};exports[_0x3448('0x49')]=function(_0x3c9b82,_0x1b82e7){return db[_0x3448('0x2d')]['create'](_0x3c9b82[_0x3448('0x4a')],{})[_0x3448('0x28')](respondWithResult(_0x1b82e7,0xc9))[_0x3448('0x43')](handleError(_0x1b82e7,null));};exports[_0x3448('0x26')]=function(_0x363374,_0x5d942b){if(_0x363374[_0x3448('0x4a')]['id']){delete _0x363374['body']['id'];}return db[_0x3448('0x2d')][_0x3448('0x48')]({'where':{'id':_0x363374['params']['id']}})[_0x3448('0x28')](handleEntityNotFound(_0x5d942b,null))[_0x3448('0x28')](saveUpdates(_0x363374[_0x3448('0x4a')],null))[_0x3448('0x28')](respondWithResult(_0x5d942b,null))[_0x3448('0x43')](handleError(_0x5d942b,null));};exports[_0x3448('0x27')]=function(_0xc769e1,_0x53236c){return db[_0x3448('0x2d')][_0x3448('0x48')]({'where':{'id':_0xc769e1['params']['id']}})['then'](handleEntityNotFound(_0x53236c,null))[_0x3448('0x28')](removeEntity(_0x53236c,null))[_0x3448('0x43')](handleError(_0x53236c,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index bfca3b5..2c88bf4 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 _0x577e=['../../config/environment','./intFreshdeskField.attributes','exports','define','int_freshdesk_fields','idField','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x408130,_0x5e9764){var _0x305b96=function(_0x1abfbc){while(--_0x1abfbc){_0x408130['push'](_0x408130['shift']());}};_0x305b96(++_0x5e9764);}(_0x577e,0x1f2));var _0xe577=function(_0x27d8bc,_0x19e010){_0x27d8bc=_0x27d8bc-0x0;var _0x4b04cb=_0x577e[_0x27d8bc];return _0x4b04cb;};'use strict';var _=require('lodash');var util=require(_0xe577('0x0'));var logger=require(_0xe577('0x1'))('api');var moment=require(_0xe577('0x2'));var BPromise=require(_0xe577('0x3'));var rp=require(_0xe577('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe577('0x5'));var config=require(_0xe577('0x6'));var attributes=require(_0xe577('0x7'));module[_0xe577('0x8')]=function(_0x2e929e,_0x38856b){return _0x2e929e[_0xe577('0x9')]('FreshdeskField',attributes,{'tableName':_0xe577('0xa'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0xe577('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf2f5=['moment','bluebird','request-promise','path','rimraf','./intFreshdeskField.attributes','exports','freshdesk_unique_index','idField','FieldId','util','api'];(function(_0x7108f4,_0x506ab8){var _0x5828cb=function(_0x24ce0d){while(--_0x24ce0d){_0x7108f4['push'](_0x7108f4['shift']());}};_0x5828cb(++_0x506ab8);}(_0xf2f5,0x8e));var _0x5f2f=function(_0x1e865a,_0x3dfb7a){_0x1e865a=_0x1e865a-0x0;var _0x356815=_0xf2f5[_0x1e865a];return _0x356815;};'use strict';var _=require('lodash');var util=require(_0x5f2f('0x0'));var logger=require('../../config/logger')(_0x5f2f('0x1'));var moment=require(_0x5f2f('0x2'));var BPromise=require(_0x5f2f('0x3'));var rp=require(_0x5f2f('0x4'));var fs=require('fs');var path=require(_0x5f2f('0x5'));var rimraf=require(_0x5f2f('0x6'));var config=require('../../config/environment');var attributes=require(_0x5f2f('0x7'));module[_0x5f2f('0x8')]=function(_0x4fcddd,_0x4baf8b){return _0x4fcddd['define']('FreshdeskField',attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x5f2f('0x9'),'fields':[_0x5f2f('0xa'),_0x5f2f('0xb')],'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 92ad3a1..2fd6698 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 _0x852a=['FreshdeskField,\x20%s,\x20%s','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x4016c3,_0x196822){var _0xf2052d=function(_0x1db30c){while(--_0x1db30c){_0x4016c3['push'](_0x4016c3['shift']());}};_0xf2052d(++_0x196822);}(_0x852a,0x1b9));var _0xa852=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x852a[_0x2b5eae];return _0x5f3ac9;};'use strict';var _=require(_0xa852('0x0'));var util=require(_0xa852('0x1'));var moment=require(_0xa852('0x2'));var BPromise=require(_0xa852('0x3'));var rs=require(_0xa852('0x4'));var fs=require('fs');var Redis=require(_0xa852('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa852('0x6'));var logger=require(_0xa852('0x7'))(_0xa852('0x8'));var config=require(_0xa852('0x9'));var jayson=require(_0xa852('0xa'));var client=jayson[_0xa852('0xb')][_0xa852('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4e045d,_0x305a1a,_0x1bcb7b){return new BPromise(function(_0x5e6b1b,_0x3831bb){return client[_0xa852('0xd')](_0x4e045d,_0x1bcb7b)['then'](function(_0x3c6b75){logger[_0xa852('0xe')](_0xa852('0xf'),_0x305a1a,'request\x20sent');logger[_0xa852('0x10')](_0xa852('0x11'),_0x305a1a,'request\x20sent',JSON[_0xa852('0x12')](_0x3c6b75));if(_0x3c6b75[_0xa852('0x13')]){if(_0x3c6b75[_0xa852('0x13')][_0xa852('0x14')]===0x1f4){logger[_0xa852('0x13')]('FreshdeskField,\x20%s,\x20%s',_0x305a1a,_0x3c6b75[_0xa852('0x13')]['message']);return _0x3831bb(_0x3c6b75[_0xa852('0x13')][_0xa852('0x15')]);}logger[_0xa852('0x13')](_0xa852('0xf'),_0x305a1a,_0x3c6b75[_0xa852('0x13')][_0xa852('0x15')]);return _0x5e6b1b(_0x3c6b75[_0xa852('0x13')][_0xa852('0x15')]);}else{logger[_0xa852('0xe')](_0xa852('0xf'),_0x305a1a,'request\x20sent');_0x5e6b1b(_0x3c6b75[_0xa852('0x16')][_0xa852('0x15')]);}})[_0xa852('0x17')](function(_0x4cee10){logger[_0xa852('0x13')](_0xa852('0xf'),_0x305a1a,_0x4cee10);_0x3831bb(_0x4cee10);});});} \ No newline at end of file +var _0xcead=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskField,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcead,0x73));var _0xdcea=function(_0x5c8bb0,_0x213640){_0x5c8bb0=_0x5c8bb0-0x0;var _0x42e711=_0xcead[_0x5c8bb0];return _0x42e711;};'use strict';var _=require(_0xdcea('0x0'));var util=require('util');var moment=require(_0xdcea('0x1'));var BPromise=require(_0xdcea('0x2'));var rs=require(_0xdcea('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdcea('0x4'))['db'];var utils=require(_0xdcea('0x5'));var logger=require(_0xdcea('0x6'))(_0xdcea('0x7'));var config=require(_0xdcea('0x8'));var jayson=require(_0xdcea('0x9'));var client=jayson[_0xdcea('0xa')][_0xdcea('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f9381,_0x5a0c9c,_0x50b5cd){return new BPromise(function(_0x3cbe4f,_0x43694e){return client[_0xdcea('0xc')](_0x4f9381,_0x50b5cd)[_0xdcea('0xd')](function(_0x1b92c9){logger[_0xdcea('0xe')]('FreshdeskField,\x20%s,\x20%s',_0x5a0c9c,_0xdcea('0xf'));logger[_0xdcea('0x10')](_0xdcea('0x11'),_0x5a0c9c,_0xdcea('0xf'),JSON[_0xdcea('0x12')](_0x1b92c9));if(_0x1b92c9[_0xdcea('0x13')]){if(_0x1b92c9[_0xdcea('0x13')][_0xdcea('0x14')]===0x1f4){logger[_0xdcea('0x13')](_0xdcea('0x15'),_0x5a0c9c,_0x1b92c9[_0xdcea('0x13')][_0xdcea('0x16')]);return _0x43694e(_0x1b92c9['error'][_0xdcea('0x16')]);}logger[_0xdcea('0x13')]('FreshdeskField,\x20%s,\x20%s',_0x5a0c9c,_0x1b92c9['error'][_0xdcea('0x16')]);return _0x3cbe4f(_0x1b92c9[_0xdcea('0x13')][_0xdcea('0x16')]);}else{logger[_0xdcea('0xe')](_0xdcea('0x15'),_0x5a0c9c,_0xdcea('0xf'));_0x3cbe4f(_0x1b92c9['result'][_0xdcea('0x16')]);}})[_0xdcea('0x17')](function(_0x15d0f6){logger[_0xdcea('0x13')](_0xdcea('0x15'),_0x5a0c9c,_0x15d0f6);_0x43694e(_0x15d0f6);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 061db50..a997321 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 _0x5423=['create','post','addConfiguration','put','update','delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','getFields'];(function(_0x42c7d2,_0x536e9e){var _0x3f5a0f=function(_0x41db58){while(--_0x41db58){_0x42c7d2['push'](_0x42c7d2['shift']());}};_0x3f5a0f(++_0x536e9e);}(_0x5423,0xe3));var _0x3542=function(_0x1ed211,_0x3f5cb2){_0x1ed211=_0x1ed211-0x0;var _0x42a45d=_0x5423[_0x1ed211];return _0x42a45d;};'use strict';var multer=require(_0x3542('0x0'));var util=require(_0x3542('0x1'));var path=require('path');var timeout=require(_0x3542('0x2'));var express=require(_0x3542('0x3'));var router=express['Router']();var fs_extra=require(_0x3542('0x4'));var auth=require(_0x3542('0x5'));var interaction=require(_0x3542('0x6'));var config=require(_0x3542('0x7'));var controller=require('./intFreshsalesAccount.controller');router[_0x3542('0x8')]('/',auth[_0x3542('0x9')](),controller[_0x3542('0xa')]);router[_0x3542('0x8')](_0x3542('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x3542('0x8')](_0x3542('0xc'),auth['isAuthenticated'](),controller[_0x3542('0xd')]);router[_0x3542('0x8')]('/:id/fields',auth[_0x3542('0x9')](),controller[_0x3542('0xe')]);router['post']('/',auth[_0x3542('0x9')](),controller[_0x3542('0xf')]);router[_0x3542('0x10')](_0x3542('0xc'),auth[_0x3542('0x9')](),controller[_0x3542('0x11')]);router[_0x3542('0x12')](_0x3542('0xb'),auth[_0x3542('0x9')](),controller[_0x3542('0x13')]);router[_0x3542('0x14')](_0x3542('0xb'),auth[_0x3542('0x9')](),controller['destroy']);module[_0x3542('0x15')]=router; \ No newline at end of file +var _0xbee3=['isAuthenticated','/:id','show','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x11a303,_0x20cae6){var _0x2f2225=function(_0x5d5586){while(--_0x5d5586){_0x11a303['push'](_0x11a303['shift']());}};_0x2f2225(++_0x20cae6);}(_0xbee3,0xd5));var _0x3bee=function(_0x29341c,_0x1564e8){_0x29341c=_0x29341c-0x0;var _0x3c7172=_0xbee3[_0x29341c];return _0x3c7172;};'use strict';var multer=require('multer');var util=require(_0x3bee('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3bee('0x1'));var router=express[_0x3bee('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x3bee('0x3'));var interaction=require(_0x3bee('0x4'));var config=require(_0x3bee('0x5'));var controller=require('./intFreshsalesAccount.controller');router[_0x3bee('0x6')]('/',auth[_0x3bee('0x7')](),controller['index']);router[_0x3bee('0x6')](_0x3bee('0x8'),auth[_0x3bee('0x7')](),controller[_0x3bee('0x9')]);router[_0x3bee('0x6')](_0x3bee('0xa'),auth[_0x3bee('0x7')](),controller['getConfigurations']);router[_0x3bee('0x6')](_0x3bee('0xb'),auth[_0x3bee('0x7')](),controller[_0x3bee('0xc')]);router[_0x3bee('0xd')]('/',auth[_0x3bee('0x7')](),controller['create']);router[_0x3bee('0xd')]('/:id/configurations',auth[_0x3bee('0x7')](),controller[_0x3bee('0xe')]);router[_0x3bee('0xf')](_0x3bee('0x8'),auth[_0x3bee('0x7')](),controller[_0x3bee('0x10')]);router[_0x3bee('0x11')]('/:id',auth[_0x3bee('0x7')](),controller[_0x3bee('0x12')]);module[_0x3bee('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 279c002..d891f9b 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 _0x8e3f=['STRING','username','remoteUri','sequelize','exports'];(function(_0x80e5b5,_0x1a4219){var _0x36d3b1=function(_0x2d72cc){while(--_0x2d72cc){_0x80e5b5['push'](_0x80e5b5['shift']());}};_0x36d3b1(++_0x1a4219);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8e3f[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xf8e3('0x0'));module[_0xf8e3('0x1')]={'name':{'type':Sequelize[_0xf8e3('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf8e3('0x2')],'unique':_0xf8e3('0x3')},'apiKey':{'type':Sequelize[_0xf8e3('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xf8e3('0x4')},'serverUrl':{'type':Sequelize[_0xf8e3('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x5f2f=['exports','STRING','username','sequelize'];(function(_0x2cffa5,_0x41873d){var _0x41e2d1=function(_0x2e34bc){while(--_0x2e34bc){_0x2cffa5['push'](_0x2cffa5['shift']());}};_0x41e2d1(++_0x41873d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x133e05,_0x28eb8d){_0x133e05=_0x133e05-0x0;var _0x30d761=_0x5f2f[_0x133e05];return _0x30d761;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'name':{'type':Sequelize[_0xf5f2('0x2')]},'description':{'type':Sequelize[_0xf5f2('0x2')]},'username':{'type':Sequelize[_0xf5f2('0x2')],'unique':_0xf5f2('0x3')},'apiKey':{'type':Sequelize[_0xf5f2('0x2')]},'remoteUri':{'type':Sequelize[_0xf5f2('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index e51e95f..b7b1d63 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 _0xa712=['FreshsalesField','username','remoteUri','apiKey','lastIndexOf','GET','format','/api/selector/owners','Token\x20token=','users','test','statusCode','getFields','stringify','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','error','stack','send','index','map','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','merge','VIRTUAL','name','filter','options','then','includeAll','FreshsalesAccount','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','rawAttributes','where','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesConfiguration'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xa712,0x140));var _0x2a71=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa712[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2a71('0x0'));var zipdir=require(_0x2a71('0x1'));var jsonpatch=require(_0x2a71('0x2'));var rp=require('request-promise');var moment=require(_0x2a71('0x3'));var BPromise=require(_0x2a71('0x4'));var Mustache=require(_0x2a71('0x5'));var util=require(_0x2a71('0x6'));var path=require(_0x2a71('0x7'));var sox=require(_0x2a71('0x8'));var csv=require(_0x2a71('0x9'));var ejs=require(_0x2a71('0xa'));var fs=require('fs');var fs_extra=require(_0x2a71('0xb'));var _=require('lodash');var squel=require(_0x2a71('0xc'));var crypto=require('crypto');var jsforce=require(_0x2a71('0xd'));var deskjs=require(_0x2a71('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2a71('0xf'));var Papa=require(_0x2a71('0x10'));var Redis=require(_0x2a71('0x11'));var authService=require(_0x2a71('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2a71('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2a71('0x14'))(_0x2a71('0x15'));var utils=require(_0x2a71('0x16'));var config=require(_0x2a71('0x17'));var licenseUtil=require(_0x2a71('0x18'));var db=require(_0x2a71('0x19'))['db'];var integrations=require(_0x2a71('0x1a'));function respondWithStatusCode(_0x16a27b,_0x1facb8){_0x1facb8=_0x1facb8||0xcc;return function(_0x141f36){if(_0x141f36){return _0x16a27b[_0x2a71('0x1b')](_0x1facb8);}return _0x16a27b[_0x2a71('0x1c')](_0x1facb8)[_0x2a71('0x1d')]();};}function respondWithResult(_0x57e085,_0x4aab28){_0x4aab28=_0x4aab28||0xc8;return function(_0x15d499){if(_0x15d499){return _0x57e085[_0x2a71('0x1c')](_0x4aab28)[_0x2a71('0x1e')](_0x15d499);}};}function respondWithFilteredResult(_0x18215e,_0x2c2968){return function(_0x13b099){if(_0x13b099){var _0x1f4319=typeof _0x2c2968[_0x2a71('0x1f')]===_0x2a71('0x20')&&typeof _0x2c2968[_0x2a71('0x21')]==='undefined';var _0x5efa04=_0x13b099[_0x2a71('0x22')];var _0x2cc6ab=_0x1f4319?0x0:_0x2c2968[_0x2a71('0x1f')];var _0x10668a=_0x1f4319?_0x13b099[_0x2a71('0x22')]:_0x2c2968[_0x2a71('0x1f')]+_0x2c2968[_0x2a71('0x21')];var _0x59fd94;if(_0x10668a>=_0x5efa04){_0x10668a=_0x5efa04;_0x59fd94=0xc8;}else{_0x59fd94=0xce;}_0x18215e[_0x2a71('0x1c')](_0x59fd94);return _0x18215e[_0x2a71('0x23')](_0x2a71('0x24'),_0x2cc6ab+'-'+_0x10668a+'/'+_0x5efa04)[_0x2a71('0x1e')](_0x13b099);}return null;};}function patchUpdates(_0x5e8823){return function(_0x4b3056){try{jsonpatch[_0x2a71('0x25')](_0x4b3056,_0x5e8823,!![]);}catch(_0x51f65f){return BPromise[_0x2a71('0x26')](_0x51f65f);}return _0x4b3056[_0x2a71('0x27')]();};}function saveUpdates(_0x27255,_0x1437fc){return function(_0x22b000){if(_0x22b000){return _0x22b000['update'](_0x27255)['then'](function(_0x114059){return _0x114059;});}return null;};}function removeEntity(_0x963884,_0x24b781){return function(_0x230b40){if(_0x230b40){return _0x230b40[_0x2a71('0x28')]()['then'](function(){_0x963884['status'](0xcc)[_0x2a71('0x1d')]();});}};}function handleEntityNotFound(_0x45c2b9,_0x2f75f7){return function(_0xed60dd){if(!_0xed60dd){_0x45c2b9[_0x2a71('0x1b')](0x194);}return _0xed60dd;};}function handleError(_0x4298ed,_0x218a2){_0x218a2=_0x218a2||0x1f4;return function(_0xa5a643){logger[_0x2a71('0x29')](_0xa5a643[_0x2a71('0x2a')]);if(_0xa5a643['name']){delete _0xa5a643['name'];}_0x4298ed['status'](_0x218a2)[_0x2a71('0x2b')](_0xa5a643);};}exports[_0x2a71('0x2c')]=function(_0x11a3b5,_0x5ea84f){var _0x2e957a={},_0x3e8969={},_0x5c9402={'count':0x0,'rows':[]};var _0x5ed4bf=_[_0x2a71('0x2d')](db['FreshsalesAccount']['rawAttributes'],function(_0x459f03){return{'name':_0x459f03['fieldName'],'type':_0x459f03[_0x2a71('0x2e')][_0x2a71('0x2f')]};});_0x3e8969[_0x2a71('0x30')]=_[_0x2a71('0x2d')](_0x5ed4bf,'name');_0x3e8969[_0x2a71('0x31')]=_[_0x2a71('0x32')](_0x11a3b5[_0x2a71('0x31')]);_0x3e8969[_0x2a71('0x33')]=_[_0x2a71('0x34')](_0x3e8969[_0x2a71('0x30')],_0x3e8969[_0x2a71('0x31')]);_0x2e957a[_0x2a71('0x35')]=_[_0x2a71('0x34')](_0x3e8969['model'],qs['fields'](_0x11a3b5[_0x2a71('0x31')][_0x2a71('0x36')]));_0x2e957a['attributes']=_0x2e957a[_0x2a71('0x35')][_0x2a71('0x37')]?_0x2e957a[_0x2a71('0x35')]:_0x3e8969[_0x2a71('0x30')];if(!_0x11a3b5[_0x2a71('0x31')][_0x2a71('0x38')](_0x2a71('0x39'))){_0x2e957a[_0x2a71('0x21')]=qs[_0x2a71('0x21')](_0x11a3b5[_0x2a71('0x31')][_0x2a71('0x21')]);_0x2e957a['offset']=qs['offset'](_0x11a3b5[_0x2a71('0x31')][_0x2a71('0x1f')]);}_0x2e957a['order']=qs[_0x2a71('0x3a')](_0x11a3b5[_0x2a71('0x31')]['sort']);_0x2e957a['where']=qs[_0x2a71('0x33')](_[_0x2a71('0x3b')](_0x11a3b5[_0x2a71('0x31')],_0x3e8969[_0x2a71('0x33')]),_0x5ed4bf);if(_0x11a3b5[_0x2a71('0x31')]['filter']){_0x2e957a['where']=_[_0x2a71('0x3c')](_0x2e957a['where'],{'$or':_['map'](_0x5ed4bf,function(_0x1ddefa){if(_0x1ddefa[_0x2a71('0x2e')]!==_0x2a71('0x3d')){var _0x2651c7={};_0x2651c7[_0x1ddefa[_0x2a71('0x3e')]]={'$like':'%'+_0x11a3b5['query'][_0x2a71('0x3f')]+'%'};return _0x2651c7;}})});}_0x2e957a=_[_0x2a71('0x3c')]({},_0x2e957a,_0x11a3b5[_0x2a71('0x40')]);var _0x55cc44={'where':_0x2e957a['where']};return db['FreshsalesAccount'][_0x2a71('0x22')](_0x55cc44)[_0x2a71('0x41')](function(_0x1b1652){_0x5c9402[_0x2a71('0x22')]=_0x1b1652;if(_0x11a3b5[_0x2a71('0x31')][_0x2a71('0x42')]){_0x2e957a['include']=[{'all':!![]}];}return db[_0x2a71('0x43')][_0x2a71('0x44')](_0x2e957a);})[_0x2a71('0x41')](function(_0x19ee39){_0x5c9402[_0x2a71('0x45')]=_0x19ee39;return _0x5c9402;})[_0x2a71('0x41')](respondWithFilteredResult(_0x5ea84f,_0x2e957a))[_0x2a71('0x46')](handleError(_0x5ea84f,null));};exports[_0x2a71('0x47')]=function(_0x4d0b0d,_0x2f46b1){var _0x50f515={'raw':![],'where':{'id':_0x4d0b0d[_0x2a71('0x48')]['id']}},_0x60c513={};_0x60c513[_0x2a71('0x30')]=_[_0x2a71('0x32')](db[_0x2a71('0x43')]['rawAttributes']);_0x60c513['query']=_['keys'](_0x4d0b0d[_0x2a71('0x31')]);_0x60c513[_0x2a71('0x33')]=_[_0x2a71('0x34')](_0x60c513['model'],_0x60c513[_0x2a71('0x31')]);_0x50f515[_0x2a71('0x35')]=_[_0x2a71('0x34')](_0x60c513[_0x2a71('0x30')],qs['fields'](_0x4d0b0d[_0x2a71('0x31')][_0x2a71('0x36')]));_0x50f515[_0x2a71('0x35')]=_0x50f515[_0x2a71('0x35')][_0x2a71('0x37')]?_0x50f515[_0x2a71('0x35')]:_0x60c513[_0x2a71('0x30')];if(_0x4d0b0d[_0x2a71('0x31')][_0x2a71('0x42')]){_0x50f515['include']=[{'all':!![]}];}_0x50f515=_[_0x2a71('0x3c')]({},_0x50f515,_0x4d0b0d[_0x2a71('0x40')]);return db['FreshsalesAccount'][_0x2a71('0x49')](_0x50f515)['then'](handleEntityNotFound(_0x2f46b1,null))[_0x2a71('0x41')](respondWithResult(_0x2f46b1,null))[_0x2a71('0x46')](handleError(_0x2f46b1,null));};exports[_0x2a71('0x4a')]=function(_0x2042cd,_0x4a7c17){return db['FreshsalesAccount'][_0x2a71('0x4a')](_0x2042cd[_0x2a71('0x4b')],{})[_0x2a71('0x41')](respondWithResult(_0x4a7c17,0xc9))[_0x2a71('0x46')](handleError(_0x4a7c17,null));};exports['update']=function(_0x5532ff,_0xd29cd1){if(_0x5532ff['body']['id']){delete _0x5532ff[_0x2a71('0x4b')]['id'];}return db[_0x2a71('0x43')][_0x2a71('0x49')]({'where':{'id':_0x5532ff[_0x2a71('0x48')]['id']}})['then'](handleEntityNotFound(_0xd29cd1,null))[_0x2a71('0x41')](saveUpdates(_0x5532ff[_0x2a71('0x4b')],null))[_0x2a71('0x41')](respondWithResult(_0xd29cd1,null))[_0x2a71('0x46')](handleError(_0xd29cd1,null));};exports['destroy']=function(_0x522d61,_0x2691db){return db[_0x2a71('0x43')]['find']({'where':{'id':_0x522d61[_0x2a71('0x48')]['id']}})[_0x2a71('0x41')](handleEntityNotFound(_0x2691db,null))[_0x2a71('0x41')](removeEntity(_0x2691db,null))['catch'](handleError(_0x2691db,null));};exports[_0x2a71('0x4c')]=function(_0x53a50b,_0x16e9f6,_0x39f689){var _0xc8784d={};var _0x3218c3={};var _0xe1b667;var _0x5353b2;return db[_0x2a71('0x43')][_0x2a71('0x4d')]({'where':{'id':_0x53a50b['params']['id']}})['then'](handleEntityNotFound(_0x16e9f6,null))[_0x2a71('0x41')](function(_0x5d27b2){if(_0x5d27b2){_0xe1b667=_0x5d27b2;_0x3218c3[_0x2a71('0x30')]=_['keys'](db['FreshsalesConfiguration'][_0x2a71('0x4e')]);_0x3218c3[_0x2a71('0x31')]=_[_0x2a71('0x32')](_0x53a50b[_0x2a71('0x31')]);_0x3218c3[_0x2a71('0x33')]=_[_0x2a71('0x34')](_0x3218c3[_0x2a71('0x30')],_0x3218c3[_0x2a71('0x31')]);_0xc8784d[_0x2a71('0x35')]=_['intersection'](_0x3218c3[_0x2a71('0x30')],qs[_0x2a71('0x36')](_0x53a50b[_0x2a71('0x31')]['fields']));_0xc8784d[_0x2a71('0x35')]=_0xc8784d[_0x2a71('0x35')][_0x2a71('0x37')]?_0xc8784d[_0x2a71('0x35')]:_0x3218c3[_0x2a71('0x30')];_0xc8784d['order']=qs[_0x2a71('0x3a')](_0x53a50b['query'][_0x2a71('0x3a')]);_0xc8784d[_0x2a71('0x4f')]=qs[_0x2a71('0x33')](_['pick'](_0x53a50b['query'],_0x3218c3[_0x2a71('0x33')]));if(_0x53a50b[_0x2a71('0x31')]['filter']){_0xc8784d[_0x2a71('0x4f')]=_[_0x2a71('0x3c')](_0xc8784d[_0x2a71('0x4f')],{'$or':_[_0x2a71('0x2d')](_0xc8784d['attributes'],function(_0x1be9bb){var _0x4098d1={};_0x4098d1[_0x1be9bb]={'$like':'%'+_0x53a50b[_0x2a71('0x31')]['filter']+'%'};return _0x4098d1;})});}_0xc8784d=_['merge']({},_0xc8784d,_0x53a50b[_0x2a71('0x40')]);return _0xe1b667[_0x2a71('0x4c')](_0xc8784d);}})[_0x2a71('0x41')](function(_0x579ee5){if(_0x579ee5){_0x5353b2=_0x579ee5[_0x2a71('0x37')];if(!_0x53a50b[_0x2a71('0x31')][_0x2a71('0x38')](_0x2a71('0x39'))){_0xc8784d[_0x2a71('0x21')]=qs[_0x2a71('0x21')](_0x53a50b[_0x2a71('0x31')]['limit']);_0xc8784d['offset']=qs[_0x2a71('0x1f')](_0x53a50b[_0x2a71('0x31')][_0x2a71('0x1f')]);}return _0xe1b667['getConfigurations'](_0xc8784d);}})[_0x2a71('0x41')](function(_0x57ddf6){if(_0x57ddf6){return _0x57ddf6?{'count':_0x5353b2,'rows':_0x57ddf6}:null;}})[_0x2a71('0x41')](respondWithResult(_0x16e9f6,null))[_0x2a71('0x46')](handleError(_0x16e9f6,null));};exports[_0x2a71('0x50')]=function(_0x391add,_0x23731e,_0x3730dd){if(_0x391add[_0x2a71('0x4b')]['id']){delete _0x391add[_0x2a71('0x4b')]['id'];}return db[_0x2a71('0x43')]['findOne']({'where':{'id':_0x391add['params']['id']}})[_0x2a71('0x41')](handleEntityNotFound(_0x23731e,null))['then'](function(_0x53d78b){if(_0x53d78b){_0x391add[_0x2a71('0x4b')][_0x2a71('0x51')]=_0x53d78b['id'];_0x391add[_0x2a71('0x4b')][_0x2a71('0x52')]=integrations[_0x2a71('0x53')](_0x391add[_0x2a71('0x4b')][_0x2a71('0x54')],_0x391add[_0x2a71('0x4b')]['type']);_0x391add['body'][_0x2a71('0x55')]=integrations[_0x2a71('0x56')](_0x391add[_0x2a71('0x4b')][_0x2a71('0x54')],_0x391add[_0x2a71('0x4b')][_0x2a71('0x2e')]);return db[_0x2a71('0x57')][_0x2a71('0x4a')](_0x391add[_0x2a71('0x4b')],{'include':[{'model':db[_0x2a71('0x58')],'as':'Subjects'},{'model':db[_0x2a71('0x58')],'as':_0x2a71('0x55')}]});}return null;})[_0x2a71('0x41')](respondWithResult(_0x23731e,null))[_0x2a71('0x46')](handleError(_0x23731e,null));};exports['getFields']=function(_0x1ade01,_0xcdd2f5,_0x2d39b5){var _0x5ec06a='';var _0x22cde0='';return db[_0x2a71('0x43')][_0x2a71('0x4d')]({'where':{'id':_0x1ade01[_0x2a71('0x48')]['id']},'attributes':['id',_0x2a71('0x59'),_0x2a71('0x5a'),_0x2a71('0x5b')]})['then'](handleEntityNotFound(_0xcdd2f5,null))[_0x2a71('0x41')](function(_0x3ba76e){if(_0x3ba76e){_0x22cde0=_0x3ba76e[_0x2a71('0x59')];_0x5ec06a=_0x3ba76e['remoteUri'];var _0x2bb4a6=_0x3ba76e[_0x2a71('0x5a')]['slice'](-0x1);if(_0x2bb4a6==='/'){_0x5ec06a=_0x5ec06a['substring'](0x0,_0x5ec06a[_0x2a71('0x5c')](_0x2bb4a6));}return rp({'method':_0x2a71('0x5d'),'uri':util[_0x2a71('0x5e')]('%s%s',_0x5ec06a,_0x2a71('0x5f')),'headers':{'Authorization':_0x2a71('0x60')+_0x3ba76e[_0x2a71('0x5b')]},'json':!![]});}})[_0x2a71('0x41')](function(_0x20b81e){if(_0x20b81e){var _0x291871=_0x20b81e[_0x2a71('0x61')];var _0xad14f2=![];var _0xd91172=null;for(_0xd91172=0x0;_0xd91172<_0x291871[_0x2a71('0x37')];_0xd91172++){if(_0x291871[_0xd91172]['email']===_0x22cde0){_0xad14f2=!![];}}if(_0xad14f2){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x2a71('0x41')](respondWithResult(_0xcdd2f5,null))[_0x2a71('0x46')](function(_0x1ff532){var _0x12ce05=_0x1ade01[_0x2a71('0x31')][_0x2a71('0x62')]?0x1f4:_0x1ff532[_0x2a71('0x63')]||0x1f4;logger[_0x2a71('0x29')]('getFields,\x20%s,\x20%s,\x20%s',_0x2a71('0x64'),_0x12ce05,JSON[_0x2a71('0x65')](_0x1ff532));delete _0x1ff532[_0x2a71('0x3e')];if(_0x12ce05===0x191){_0x12ce05=0x190;}_0xcdd2f5[_0x2a71('0x1c')](_0x12ce05)['send'](_0x1ade01[_0x2a71('0x31')][_0x2a71('0x62')]?{'message':'Wrong\x20credentials','statusCode':_0x1ff532[_0x2a71('0x63')]}:_0x1ff532);});}; \ No newline at end of file +var _0x0be7=['offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','filters','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','FreshsalesAccount','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshsalesField','Descriptions','getFields','username','apiKey','remoteUri','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','users','email','Requested\x20Resource\x20not\x20Found','statusCode','error','stringify','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','sendStatus','status','end'];(function(_0x304b2f,_0x2321ae){var _0x14ad88=function(_0x8ccd25){while(--_0x8ccd25){_0x304b2f['push'](_0x304b2f['shift']());}};_0x14ad88(++_0x2321ae);}(_0x0be7,0x182));var _0x70be=function(_0xda00ba,_0x2d6958){_0xda00ba=_0xda00ba-0x0;var _0xab879d=_0x0be7[_0xda00ba];return _0xab879d;};'use strict';var emlformat=require(_0x70be('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x70be('0x1'));var jsonpatch=require(_0x70be('0x2'));var rp=require(_0x70be('0x3'));var moment=require(_0x70be('0x4'));var BPromise=require(_0x70be('0x5'));var Mustache=require(_0x70be('0x6'));var util=require(_0x70be('0x7'));var path=require(_0x70be('0x8'));var sox=require('sox');var csv=require(_0x70be('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x70be('0xa'));var crypto=require('crypto');var jsforce=require(_0x70be('0xb'));var deskjs=require(_0x70be('0xc'));var toCsv=require(_0x70be('0x9'));var querystring=require(_0x70be('0xd'));var Papa=require(_0x70be('0xe'));var Redis=require(_0x70be('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x70be('0x10'));var hardwareService=require(_0x70be('0x11'));var logger=require(_0x70be('0x12'))(_0x70be('0x13'));var utils=require(_0x70be('0x14'));var config=require(_0x70be('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x70be('0x16'));function respondWithStatusCode(_0x432293,_0x4d50d5){_0x4d50d5=_0x4d50d5||0xcc;return function(_0x1c88d1){if(_0x1c88d1){return _0x432293[_0x70be('0x17')](_0x4d50d5);}return _0x432293[_0x70be('0x18')](_0x4d50d5)[_0x70be('0x19')]();};}function respondWithResult(_0x430bb9,_0x2f53fe){_0x2f53fe=_0x2f53fe||0xc8;return function(_0x5675ad){if(_0x5675ad){return _0x430bb9['status'](_0x2f53fe)['json'](_0x5675ad);}};}function respondWithFilteredResult(_0x2f4221,_0x2a6d9f){return function(_0x4ec8cb){if(_0x4ec8cb){var _0x3ec214=typeof _0x2a6d9f[_0x70be('0x1a')]===_0x70be('0x1b')&&typeof _0x2a6d9f[_0x70be('0x1c')]===_0x70be('0x1b');var _0x27b794=_0x4ec8cb[_0x70be('0x1d')];var _0x1773a6=_0x3ec214?0x0:_0x2a6d9f[_0x70be('0x1a')];var _0x5bfed9=_0x3ec214?_0x4ec8cb['count']:_0x2a6d9f[_0x70be('0x1a')]+_0x2a6d9f['limit'];var _0x1a2e1f;if(_0x5bfed9>=_0x27b794){_0x5bfed9=_0x27b794;_0x1a2e1f=0xc8;}else{_0x1a2e1f=0xce;}_0x2f4221[_0x70be('0x18')](_0x1a2e1f);return _0x2f4221[_0x70be('0x1e')](_0x70be('0x1f'),_0x1773a6+'-'+_0x5bfed9+'/'+_0x27b794)[_0x70be('0x20')](_0x4ec8cb);}return null;};}function patchUpdates(_0x119bc2){return function(_0x4a6077){try{jsonpatch['apply'](_0x4a6077,_0x119bc2,!![]);}catch(_0x5afec8){return BPromise[_0x70be('0x21')](_0x5afec8);}return _0x4a6077[_0x70be('0x22')]();};}function saveUpdates(_0x5eeb88,_0x6df42b){return function(_0x4479b9){if(_0x4479b9){return _0x4479b9[_0x70be('0x23')](_0x5eeb88)[_0x70be('0x24')](function(_0x2ec0ef){return _0x2ec0ef;});}return null;};}function removeEntity(_0x7d31ea,_0x48017b){return function(_0x4677cb){if(_0x4677cb){return _0x4677cb[_0x70be('0x25')]()[_0x70be('0x24')](function(){_0x7d31ea[_0x70be('0x18')](0xcc)[_0x70be('0x19')]();});}};}function handleEntityNotFound(_0x4e384f,_0xf1024c){return function(_0x49a391){if(!_0x49a391){_0x4e384f[_0x70be('0x17')](0x194);}return _0x49a391;};}function handleError(_0x381e7d,_0x1c4790){_0x1c4790=_0x1c4790||0x1f4;return function(_0x3ae2c2){logger['error'](_0x3ae2c2[_0x70be('0x26')]);if(_0x3ae2c2[_0x70be('0x27')]){delete _0x3ae2c2[_0x70be('0x27')];}_0x381e7d['status'](_0x1c4790)[_0x70be('0x28')](_0x3ae2c2);};}exports[_0x70be('0x29')]=function(_0x1a1dd8,_0x3eecca){var _0x82cc6b={},_0x44dbb7={},_0x3e3560={'count':0x0,'rows':[]};var _0x2b1014=_[_0x70be('0x2a')](db['FreshsalesAccount'][_0x70be('0x2b')],function(_0x546021){return{'name':_0x546021[_0x70be('0x2c')],'type':_0x546021[_0x70be('0x2d')]['key']};});_0x44dbb7[_0x70be('0x2e')]=_[_0x70be('0x2a')](_0x2b1014,_0x70be('0x27'));_0x44dbb7['query']=_[_0x70be('0x2f')](_0x1a1dd8['query']);_0x44dbb7[_0x70be('0x30')]=_['intersection'](_0x44dbb7[_0x70be('0x2e')],_0x44dbb7[_0x70be('0x31')]);_0x82cc6b[_0x70be('0x32')]=_[_0x70be('0x33')](_0x44dbb7['model'],qs['fields'](_0x1a1dd8['query'][_0x70be('0x34')]));_0x82cc6b['attributes']=_0x82cc6b[_0x70be('0x32')]['length']?_0x82cc6b[_0x70be('0x32')]:_0x44dbb7[_0x70be('0x2e')];if(!_0x1a1dd8[_0x70be('0x31')][_0x70be('0x35')](_0x70be('0x36'))){_0x82cc6b[_0x70be('0x1c')]=qs[_0x70be('0x1c')](_0x1a1dd8[_0x70be('0x31')]['limit']);_0x82cc6b[_0x70be('0x1a')]=qs[_0x70be('0x1a')](_0x1a1dd8[_0x70be('0x31')][_0x70be('0x1a')]);}_0x82cc6b[_0x70be('0x37')]=qs['sort'](_0x1a1dd8[_0x70be('0x31')][_0x70be('0x38')]);_0x82cc6b['where']=qs[_0x70be('0x30')](_[_0x70be('0x39')](_0x1a1dd8[_0x70be('0x31')],_0x44dbb7[_0x70be('0x30')]),_0x2b1014);if(_0x1a1dd8[_0x70be('0x31')][_0x70be('0x3a')]){_0x82cc6b[_0x70be('0x3b')]=_[_0x70be('0x3c')](_0x82cc6b[_0x70be('0x3b')],{'$or':_[_0x70be('0x2a')](_0x2b1014,function(_0x55131c){if(_0x55131c[_0x70be('0x2d')]!==_0x70be('0x3d')){var _0x550196={};_0x550196[_0x55131c[_0x70be('0x27')]]={'$like':'%'+_0x1a1dd8[_0x70be('0x31')]['filter']+'%'};return _0x550196;}})});}_0x82cc6b=_['merge']({},_0x82cc6b,_0x1a1dd8[_0x70be('0x3e')]);var _0x15eb01={'where':_0x82cc6b[_0x70be('0x3b')]};return db[_0x70be('0x3f')][_0x70be('0x1d')](_0x15eb01)[_0x70be('0x24')](function(_0x1905a2){_0x3e3560[_0x70be('0x1d')]=_0x1905a2;if(_0x1a1dd8[_0x70be('0x31')]['includeAll']){_0x82cc6b[_0x70be('0x40')]=[{'all':!![]}];}return db[_0x70be('0x3f')][_0x70be('0x41')](_0x82cc6b);})[_0x70be('0x24')](function(_0x355aa4){_0x3e3560[_0x70be('0x42')]=_0x355aa4;return _0x3e3560;})[_0x70be('0x24')](respondWithFilteredResult(_0x3eecca,_0x82cc6b))[_0x70be('0x43')](handleError(_0x3eecca,null));};exports[_0x70be('0x44')]=function(_0x1e4504,_0x67a1e3){var _0x57cde4={'raw':![],'where':{'id':_0x1e4504[_0x70be('0x45')]['id']}},_0x53f72e={};_0x53f72e[_0x70be('0x2e')]=_[_0x70be('0x2f')](db['FreshsalesAccount'][_0x70be('0x2b')]);_0x53f72e['query']=_['keys'](_0x1e4504[_0x70be('0x31')]);_0x53f72e[_0x70be('0x30')]=_[_0x70be('0x33')](_0x53f72e['model'],_0x53f72e[_0x70be('0x31')]);_0x57cde4['attributes']=_[_0x70be('0x33')](_0x53f72e['model'],qs[_0x70be('0x34')](_0x1e4504['query'][_0x70be('0x34')]));_0x57cde4['attributes']=_0x57cde4[_0x70be('0x32')][_0x70be('0x46')]?_0x57cde4[_0x70be('0x32')]:_0x53f72e[_0x70be('0x2e')];if(_0x1e4504[_0x70be('0x31')][_0x70be('0x47')]){_0x57cde4[_0x70be('0x40')]=[{'all':!![]}];}_0x57cde4=_['merge']({},_0x57cde4,_0x1e4504[_0x70be('0x3e')]);return db['FreshsalesAccount'][_0x70be('0x48')](_0x57cde4)[_0x70be('0x24')](handleEntityNotFound(_0x67a1e3,null))['then'](respondWithResult(_0x67a1e3,null))[_0x70be('0x43')](handleError(_0x67a1e3,null));};exports[_0x70be('0x49')]=function(_0x3c0af1,_0x329e65){return db[_0x70be('0x3f')][_0x70be('0x49')](_0x3c0af1[_0x70be('0x4a')],{})[_0x70be('0x24')](respondWithResult(_0x329e65,0xc9))['catch'](handleError(_0x329e65,null));};exports[_0x70be('0x23')]=function(_0x5b5aaa,_0x287ded){if(_0x5b5aaa['body']['id']){delete _0x5b5aaa['body']['id'];}return db[_0x70be('0x3f')][_0x70be('0x48')]({'where':{'id':_0x5b5aaa[_0x70be('0x45')]['id']}})[_0x70be('0x24')](handleEntityNotFound(_0x287ded,null))[_0x70be('0x24')](saveUpdates(_0x5b5aaa[_0x70be('0x4a')],null))[_0x70be('0x24')](respondWithResult(_0x287ded,null))['catch'](handleError(_0x287ded,null));};exports[_0x70be('0x25')]=function(_0x221b8c,_0x27c984){return db['FreshsalesAccount'][_0x70be('0x48')]({'where':{'id':_0x221b8c['params']['id']}})[_0x70be('0x24')](handleEntityNotFound(_0x27c984,null))['then'](removeEntity(_0x27c984,null))[_0x70be('0x43')](handleError(_0x27c984,null));};exports[_0x70be('0x4b')]=function(_0x59f606,_0x5741e0,_0x2a20a6){var _0xef593b={};var _0x3caa52={};var _0x4ba15b;var _0x5dcb8e;return db[_0x70be('0x3f')][_0x70be('0x4c')]({'where':{'id':_0x59f606['params']['id']}})[_0x70be('0x24')](handleEntityNotFound(_0x5741e0,null))[_0x70be('0x24')](function(_0x3f7c7d){if(_0x3f7c7d){_0x4ba15b=_0x3f7c7d;_0x3caa52['model']=_[_0x70be('0x2f')](db[_0x70be('0x4d')][_0x70be('0x2b')]);_0x3caa52[_0x70be('0x31')]=_[_0x70be('0x2f')](_0x59f606[_0x70be('0x31')]);_0x3caa52[_0x70be('0x30')]=_[_0x70be('0x33')](_0x3caa52['model'],_0x3caa52[_0x70be('0x31')]);_0xef593b['attributes']=_['intersection'](_0x3caa52[_0x70be('0x2e')],qs['fields'](_0x59f606[_0x70be('0x31')][_0x70be('0x34')]));_0xef593b[_0x70be('0x32')]=_0xef593b[_0x70be('0x32')][_0x70be('0x46')]?_0xef593b['attributes']:_0x3caa52['model'];_0xef593b['order']=qs[_0x70be('0x38')](_0x59f606[_0x70be('0x31')][_0x70be('0x38')]);_0xef593b[_0x70be('0x3b')]=qs[_0x70be('0x30')](_[_0x70be('0x39')](_0x59f606[_0x70be('0x31')],_0x3caa52[_0x70be('0x30')]));if(_0x59f606[_0x70be('0x31')]['filter']){_0xef593b[_0x70be('0x3b')]=_[_0x70be('0x3c')](_0xef593b[_0x70be('0x3b')],{'$or':_[_0x70be('0x2a')](_0xef593b[_0x70be('0x32')],function(_0x25ce3d){var _0x2a2d5e={};_0x2a2d5e[_0x25ce3d]={'$like':'%'+_0x59f606['query']['filter']+'%'};return _0x2a2d5e;})});}_0xef593b=_[_0x70be('0x3c')]({},_0xef593b,_0x59f606['options']);return _0x4ba15b[_0x70be('0x4b')](_0xef593b);}})[_0x70be('0x24')](function(_0x876b43){if(_0x876b43){_0x5dcb8e=_0x876b43[_0x70be('0x46')];if(!_0x59f606['query']['hasOwnProperty'](_0x70be('0x36'))){_0xef593b[_0x70be('0x1c')]=qs[_0x70be('0x1c')](_0x59f606[_0x70be('0x31')][_0x70be('0x1c')]);_0xef593b[_0x70be('0x1a')]=qs[_0x70be('0x1a')](_0x59f606[_0x70be('0x31')][_0x70be('0x1a')]);}return _0x4ba15b['getConfigurations'](_0xef593b);}})['then'](function(_0x294a1e){if(_0x294a1e){return _0x294a1e?{'count':_0x5dcb8e,'rows':_0x294a1e}:null;}})[_0x70be('0x24')](respondWithResult(_0x5741e0,null))[_0x70be('0x43')](handleError(_0x5741e0,null));};exports[_0x70be('0x4e')]=function(_0xed4ee3,_0x2e028c,_0x4b7676){if(_0xed4ee3['body']['id']){delete _0xed4ee3[_0x70be('0x4a')]['id'];}return db[_0x70be('0x3f')]['findOne']({'where':{'id':_0xed4ee3[_0x70be('0x45')]['id']}})[_0x70be('0x24')](handleEntityNotFound(_0x2e028c,null))[_0x70be('0x24')](function(_0x131d2d){if(_0x131d2d){_0xed4ee3[_0x70be('0x4a')][_0x70be('0x4f')]=_0x131d2d['id'];_0xed4ee3[_0x70be('0x4a')][_0x70be('0x50')]=integrations[_0x70be('0x51')](_0xed4ee3[_0x70be('0x4a')][_0x70be('0x52')],_0xed4ee3[_0x70be('0x4a')]['type']);_0xed4ee3[_0x70be('0x4a')]['Descriptions']=integrations[_0x70be('0x53')](_0xed4ee3[_0x70be('0x4a')][_0x70be('0x52')],_0xed4ee3[_0x70be('0x4a')][_0x70be('0x2d')]);return db[_0x70be('0x4d')]['create'](_0xed4ee3[_0x70be('0x4a')],{'include':[{'model':db[_0x70be('0x54')],'as':_0x70be('0x50')},{'model':db['FreshsalesField'],'as':_0x70be('0x55')}]});}return null;})['then'](respondWithResult(_0x2e028c,null))['catch'](handleError(_0x2e028c,null));};exports[_0x70be('0x56')]=function(_0xd30dfa,_0xeaa8da,_0x22d5ea){var _0x360c02='';var _0xc78367='';return db[_0x70be('0x3f')]['findOne']({'where':{'id':_0xd30dfa[_0x70be('0x45')]['id']},'attributes':['id',_0x70be('0x57'),'remoteUri',_0x70be('0x58')]})[_0x70be('0x24')](handleEntityNotFound(_0xeaa8da,null))[_0x70be('0x24')](function(_0x24770c){if(_0x24770c){_0xc78367=_0x24770c[_0x70be('0x57')];_0x360c02=_0x24770c['remoteUri'];var _0x3372c0=_0x24770c[_0x70be('0x59')][_0x70be('0x5a')](-0x1);if(_0x3372c0==='/'){_0x360c02=_0x360c02[_0x70be('0x5b')](0x0,_0x360c02[_0x70be('0x5c')](_0x3372c0));}return rp({'method':_0x70be('0x5d'),'uri':util[_0x70be('0x5e')](_0x70be('0x5f'),_0x360c02,_0x70be('0x60')),'headers':{'Authorization':'Token\x20token='+_0x24770c['apiKey']},'json':!![]});}})[_0x70be('0x24')](function(_0x5099b1){if(_0x5099b1){var _0x110f63=_0x5099b1[_0x70be('0x61')];var _0xf66a2c=![];var _0x199552=null;for(_0x199552=0x0;_0x199552<_0x110f63['length'];_0x199552++){if(_0x110f63[_0x199552][_0x70be('0x62')]===_0xc78367){_0xf66a2c=!![];}}if(_0xf66a2c){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x70be('0x63')});}}})['then'](respondWithResult(_0xeaa8da,null))[_0x70be('0x43')](function(_0x2503c1){var _0x58a22a=_0xd30dfa['query']['test']?0x1f4:_0x2503c1[_0x70be('0x64')]||0x1f4;logger[_0x70be('0x65')]('getFields,\x20%s,\x20%s,\x20%s',_0x70be('0x56'),_0x58a22a,JSON[_0x70be('0x66')](_0x2503c1));delete _0x2503c1['name'];if(_0x58a22a===0x191){_0x58a22a=0x190;}_0xeaa8da[_0x70be('0x18')](_0x58a22a)[_0x70be('0x28')](_0xd30dfa['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x2503c1[_0x70be('0x64')]}:_0x2503c1);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 646cdb3..11f651c 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 _0x5496=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intFreshsalesAccount.attributes','FreshsalesAccount','int_freshsales_accounts','lodash'];(function(_0x59d0cc,_0xa7c52b){var _0x2ae79f=function(_0x33042e){while(--_0x33042e){_0x59d0cc['push'](_0x59d0cc['shift']());}};_0x2ae79f(++_0xa7c52b);}(_0x5496,0x175));var _0x6549=function(_0x543852,_0xe0aaec){_0x543852=_0x543852-0x0;var _0x40525b=_0x5496[_0x543852];return _0x40525b;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var logger=require(_0x6549('0x2'))(_0x6549('0x3'));var moment=require(_0x6549('0x4'));var BPromise=require('bluebird');var rp=require(_0x6549('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var attributes=require(_0x6549('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x43cb17,_0x1d8cea){return _0x43cb17['define'](_0x6549('0x9'),attributes,{'tableName':_0x6549('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0120=['../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5e9985,_0x1d4975){var _0xcb2ae3=function(_0x4c6cc8){while(--_0x4c6cc8){_0x5e9985['push'](_0x5e9985['shift']());}};_0xcb2ae3(++_0x1d4975);}(_0x0120,0x6f));var _0x0012=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x0120[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x0012('0x0'));var util=require(_0x0012('0x1'));var logger=require(_0x0012('0x2'))(_0x0012('0x3'));var moment=require(_0x0012('0x4'));var BPromise=require(_0x0012('0x5'));var rp=require(_0x0012('0x6'));var fs=require('fs');var path=require(_0x0012('0x7'));var rimraf=require(_0x0012('0x8'));var config=require(_0x0012('0x9'));var attributes=require(_0x0012('0xa'));var integrations=require(_0x0012('0xb'));module['exports']=function(_0x4b396c,_0x59980a){return _0x4b396c[_0x0012('0xc')](_0x0012('0xd'),attributes,{'tableName':_0x0012('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 9c7c67a..16f474e 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(_0x514bd1,_0x25ea3e){var _0x58a281=function(_0x25567a){while(--_0x25567a){_0x514bd1['push'](_0x514bd1['shift']());}};_0x58a281(++_0x25ea3e);}(_0x32f4,0x154));var _0x432f=function(_0x4a9cdc,_0x1a9aec){_0x4a9cdc=_0x4a9cdc-0x0;var _0x261ee2=_0x32f4[_0x4a9cdc];return _0x261ee2;};'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 _0x0a6b=['find','map','lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','model','then','debug','stringify','catch','ShowFreshsalesAccount'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x4de2c5,_0x21aeb7){_0x4de2c5=_0x4de2c5-0x0;var _0x4ef52b=_0x0a6b[_0x4de2c5];return _0x4ef52b;};'use strict';var _=require(_0xb0a6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb0a6('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb0a6('0x2'))['db'];var utils=require(_0xb0a6('0x3'));var logger=require(_0xb0a6('0x4'))('rpc');var config=require(_0xb0a6('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xb0a6('0x6')][_0xb0a6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5e2d2d,_0x11cd5b,_0x24515c){return new BPromise(function(_0x2a8516,_0x530c05){return client['request'](_0x5e2d2d,_0x24515c)['then'](function(_0x2ded05){logger[_0xb0a6('0x8')](_0xb0a6('0x9'),_0x11cd5b,_0xb0a6('0xa'));logger['debug'](_0xb0a6('0xb'),_0x11cd5b,_0xb0a6('0xa'),JSON['stringify'](_0x2ded05));if(_0x2ded05[_0xb0a6('0xc')]){if(_0x2ded05[_0xb0a6('0xc')][_0xb0a6('0xd')]===0x1f4){logger[_0xb0a6('0xc')](_0xb0a6('0x9'),_0x11cd5b,_0x2ded05[_0xb0a6('0xc')][_0xb0a6('0xe')]);return _0x530c05(_0x2ded05[_0xb0a6('0xc')][_0xb0a6('0xe')]);}logger[_0xb0a6('0xc')]('FreshsalesAccount,\x20%s,\x20%s',_0x11cd5b,_0x2ded05[_0xb0a6('0xc')]['message']);return _0x2a8516(_0x2ded05[_0xb0a6('0xc')]['message']);}else{logger[_0xb0a6('0x8')]('FreshsalesAccount,\x20%s,\x20%s',_0x11cd5b,_0xb0a6('0xa'));_0x2a8516(_0x2ded05[_0xb0a6('0xf')][_0xb0a6('0xe')]);}})['catch'](function(_0x56b594){logger[_0xb0a6('0xc')](_0xb0a6('0x9'),_0x11cd5b,_0x56b594);_0x530c05(_0x56b594);});});}exports[_0xb0a6('0x10')]=function(_0x18f994){var _0x10f504=this;return new Promise(function(_0x13a1c8,_0x567dd5){return db[_0xb0a6('0x11')][_0xb0a6('0x12')]({'raw':_0x18f994[_0xb0a6('0x13')]?_0x18f994[_0xb0a6('0x13')][_0xb0a6('0x14')]===undefined?!![]:![]:!![],'where':_0x18f994[_0xb0a6('0x13')]?_0x18f994['options'][_0xb0a6('0x15')]||null:null,'attributes':_0x18f994[_0xb0a6('0x13')]?_0x18f994[_0xb0a6('0x13')][_0xb0a6('0x16')]||null:null,'limit':_0x18f994[_0xb0a6('0x13')]?_0x18f994[_0xb0a6('0x13')][_0xb0a6('0x17')]||null:null,'include':_0x18f994[_0xb0a6('0x13')]?_0x18f994['options'][_0xb0a6('0x18')]?_['map'](_0x18f994[_0xb0a6('0x13')][_0xb0a6('0x18')],function(_0x4997df){return{'model':db[_0x4997df['model']],'as':_0x4997df['as'],'attributes':_0x4997df[_0xb0a6('0x16')],'include':_0x4997df[_0xb0a6('0x18')]?_['map'](_0x4997df[_0xb0a6('0x18')],function(_0x24574a){return{'model':db[_0x24574a[_0xb0a6('0x19')]],'as':_0x24574a['as'],'attributes':_0x24574a[_0xb0a6('0x16')],'include':_0x24574a['include']?_['map'](_0x24574a[_0xb0a6('0x18')],function(_0x1e9947){return{'model':db[_0x1e9947[_0xb0a6('0x19')]],'as':_0x1e9947['as'],'attributes':_0x1e9947['attributes']};}):[]};}):[]};}):[]:[]})[_0xb0a6('0x1a')](function(_0x3347ac){logger[_0xb0a6('0x8')](_0xb0a6('0x10'),_0x18f994);logger[_0xb0a6('0x1b')](_0xb0a6('0x10'),_0x18f994,JSON[_0xb0a6('0x1c')](_0x3347ac));_0x13a1c8(_0x3347ac);})[_0xb0a6('0x1d')](function(_0x4255b9){logger['error'](_0xb0a6('0x10'),_0x4255b9[_0xb0a6('0xe')],_0x18f994);_0x567dd5(_0x10f504[_0xb0a6('0xc')](0x1f4,_0x4255b9['message']));});});};exports[_0xb0a6('0x1e')]=function(_0x582fc2){var _0x131e46=this;return new Promise(function(_0x309a91,_0x114f91){return db[_0xb0a6('0x11')][_0xb0a6('0x1f')]({'raw':_0x582fc2[_0xb0a6('0x13')]?_0x582fc2[_0xb0a6('0x13')][_0xb0a6('0x14')]===undefined?!![]:![]:!![],'where':_0x582fc2[_0xb0a6('0x13')]?_0x582fc2[_0xb0a6('0x13')]['where']||null:null,'attributes':_0x582fc2['options']?_0x582fc2[_0xb0a6('0x13')][_0xb0a6('0x16')]||null:null,'include':_0x582fc2[_0xb0a6('0x13')]?_0x582fc2[_0xb0a6('0x13')][_0xb0a6('0x18')]?_[_0xb0a6('0x20')](_0x582fc2[_0xb0a6('0x13')][_0xb0a6('0x18')],function(_0x4b0479){return{'model':db[_0x4b0479[_0xb0a6('0x19')]],'as':_0x4b0479['as'],'attributes':_0x4b0479[_0xb0a6('0x16')],'include':_0x4b0479['include']?_[_0xb0a6('0x20')](_0x4b0479[_0xb0a6('0x18')],function(_0x52e397){return{'model':db[_0x52e397['model']],'as':_0x52e397['as'],'attributes':_0x52e397[_0xb0a6('0x16')],'include':_0x52e397[_0xb0a6('0x18')]?_[_0xb0a6('0x20')](_0x52e397[_0xb0a6('0x18')],function(_0x4310ae){return{'model':db[_0x4310ae[_0xb0a6('0x19')]],'as':_0x4310ae['as'],'attributes':_0x4310ae['attributes']};}):[]};}):[]};}):[]:[]})[_0xb0a6('0x1a')](function(_0x5c280e){logger[_0xb0a6('0x8')](_0xb0a6('0x1e'),_0x582fc2);logger['debug']('ShowFreshsalesAccount',_0x582fc2,JSON['stringify'](_0x5c280e));_0x309a91(_0x5c280e);})[_0xb0a6('0x1d')](function(_0xd484f){logger[_0xb0a6('0xc')](_0xb0a6('0x1e'),_0xd484f[_0xb0a6('0xe')],_0x582fc2);_0x114f91(_0x131e46['error'](0x1f4,_0xd484f[_0xb0a6('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index ef2cb91..0b0b34d 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 _0x444d=['connect-timeout','express','fs-extra','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','/:id/subjects','getSubjects','/:id/descriptions','getFields','post','create','put','update','destroy','exports','multer'];(function(_0x1d677f,_0x5a1cd8){var _0x343dd2=function(_0xfcce7d){while(--_0xfcce7d){_0x1d677f['push'](_0x1d677f['shift']());}};_0x343dd2(++_0x5a1cd8);}(_0x444d,0x1f3));var _0xd444=function(_0x125ddd,_0x2cd297){_0x125ddd=_0x125ddd-0x0;var _0x136ade=_0x444d[_0x125ddd];return _0x136ade;};'use strict';var multer=require(_0xd444('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd444('0x1'));var express=require(_0xd444('0x2'));var router=express['Router']();var fs_extra=require(_0xd444('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd444('0x4'));var controller=require(_0xd444('0x5'));router[_0xd444('0x6')]('/',auth[_0xd444('0x7')](),controller[_0xd444('0x8')]);router[_0xd444('0x6')](_0xd444('0x9'),auth[_0xd444('0x7')](),controller['show']);router[_0xd444('0x6')](_0xd444('0xa'),auth['isAuthenticated'](),controller[_0xd444('0xb')]);router[_0xd444('0x6')](_0xd444('0xc'),auth[_0xd444('0x7')](),controller['getDescriptions']);router[_0xd444('0x6')]('/:id/fields',auth[_0xd444('0x7')](),controller[_0xd444('0xd')]);router[_0xd444('0xe')]('/',auth[_0xd444('0x7')](),controller[_0xd444('0xf')]);router[_0xd444('0x10')]('/:id',auth[_0xd444('0x7')](),controller[_0xd444('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xd444('0x12')]);module[_0xd444('0x13')]=router; \ No newline at end of file +var _0xfad6=['isAuthenticated','index','/:id','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get'];(function(_0xe41f7b,_0x47c135){var _0x58bd2b=function(_0x4b08f7){while(--_0x4b08f7){_0xe41f7b['push'](_0xe41f7b['shift']());}};_0x58bd2b(++_0x47c135);}(_0xfad6,0xd6));var _0x6fad=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfad6[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x6fad('0x0'));var util=require(_0x6fad('0x1'));var path=require(_0x6fad('0x2'));var timeout=require(_0x6fad('0x3'));var express=require(_0x6fad('0x4'));var router=express[_0x6fad('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x6fad('0x6'));var interaction=require(_0x6fad('0x7'));var config=require(_0x6fad('0x8'));var controller=require(_0x6fad('0x9'));router[_0x6fad('0xa')]('/',auth[_0x6fad('0xb')](),controller[_0x6fad('0xc')]);router[_0x6fad('0xa')](_0x6fad('0xd'),auth[_0x6fad('0xb')](),controller['show']);router[_0x6fad('0xa')](_0x6fad('0xe'),auth[_0x6fad('0xb')](),controller[_0x6fad('0xf')]);router['get'](_0x6fad('0x10'),auth[_0x6fad('0xb')](),controller[_0x6fad('0x11')]);router[_0x6fad('0xa')](_0x6fad('0x12'),auth[_0x6fad('0xb')](),controller['getFields']);router[_0x6fad('0x13')]('/',auth[_0x6fad('0xb')](),controller[_0x6fad('0x14')]);router[_0x6fad('0x15')](_0x6fad('0xd'),auth[_0x6fad('0xb')](),controller[_0x6fad('0x16')]);router[_0x6fad('0x17')](_0x6fad('0xd'),auth['isAuthenticated'](),controller[_0x6fad('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 61e1454..969369b 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 _0x2de2=['sequelize','exports','STRING'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0x2de2,0x150));var _0x22de=function(_0x2f1e6c,_0x21a756){_0x2f1e6c=_0x2f1e6c-0x0;var _0x108121=_0x2de2[_0x2f1e6c];return _0x108121;};'use strict';var Sequelize=require(_0x22de('0x0'));module[_0x22de('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x22de('0x2')]}}; \ No newline at end of file +var _0xaf5b=['exports','STRING','sequelize'];(function(_0x3aa957,_0x5bf646){var _0x49aedb=function(_0x3e1cb0){while(--_0x3e1cb0){_0x3aa957['push'](_0x3aa957['shift']());}};_0x49aedb(++_0x5bf646);}(_0xaf5b,0xbf));var _0xbaf5=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xaf5b[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0xbaf5('0x0'));module[_0xbaf5('0x1')]={'name':{'type':Sequelize[_0xbaf5('0x2')]},'description':{'type':Sequelize[_0xbaf5('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 7916dd4..e558b02 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 _0x2d87=['stack','name','index','map','FreshsalesConfiguration','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','params','options','find','create','body','getSubjects','findOne','FreshsalesField','rawAttributes','getDescriptions','getFields','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','destroy','then'];(function(_0x2a73aa,_0x4f9349){var _0x45d561=function(_0x3b902a){while(--_0x3b902a){_0x2a73aa['push'](_0x2a73aa['shift']());}};_0x45d561(++_0x4f9349);}(_0x2d87,0xc6));var _0x72d8=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x2d87[_0x465028];return _0xb783d4;};'use strict';var emlformat=require(_0x72d8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x72d8('0x1'));var rp=require(_0x72d8('0x2'));var moment=require(_0x72d8('0x3'));var BPromise=require(_0x72d8('0x4'));var Mustache=require(_0x72d8('0x5'));var util=require('util');var path=require(_0x72d8('0x6'));var sox=require(_0x72d8('0x7'));var csv=require(_0x72d8('0x8'));var ejs=require(_0x72d8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x72d8('0xa'));var squel=require('squel');var crypto=require(_0x72d8('0xb'));var jsforce=require(_0x72d8('0xc'));var deskjs=require(_0x72d8('0xd'));var toCsv=require('to-csv');var querystring=require(_0x72d8('0xe'));var Papa=require('papaparse');var Redis=require(_0x72d8('0xf'));var authService=require(_0x72d8('0x10'));var qs=require(_0x72d8('0x11'));var as=require(_0x72d8('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x72d8('0x13'))(_0x72d8('0x14'));var utils=require('../../config/utils');var config=require(_0x72d8('0x15'));var licenseUtil=require(_0x72d8('0x16'));var db=require(_0x72d8('0x17'))['db'];function respondWithStatusCode(_0x199271,_0x2c278e){_0x2c278e=_0x2c278e||0xcc;return function(_0x5a0502){if(_0x5a0502){return _0x199271[_0x72d8('0x18')](_0x2c278e);}return _0x199271[_0x72d8('0x19')](_0x2c278e)[_0x72d8('0x1a')]();};}function respondWithResult(_0x43e721,_0x4eb132){_0x4eb132=_0x4eb132||0xc8;return function(_0x53171f){if(_0x53171f){return _0x43e721['status'](_0x4eb132)[_0x72d8('0x1b')](_0x53171f);}};}function respondWithFilteredResult(_0x3b54a6,_0x29fd63){return function(_0x217470){if(_0x217470){var _0xe41236=typeof _0x29fd63['offset']===_0x72d8('0x1c')&&typeof _0x29fd63[_0x72d8('0x1d')]===_0x72d8('0x1c');var _0x856551=_0x217470[_0x72d8('0x1e')];var _0x418098=_0xe41236?0x0:_0x29fd63[_0x72d8('0x1f')];var _0x49df1c=_0xe41236?_0x217470['count']:_0x29fd63['offset']+_0x29fd63[_0x72d8('0x1d')];var _0x23b8d2;if(_0x49df1c>=_0x856551){_0x49df1c=_0x856551;_0x23b8d2=0xc8;}else{_0x23b8d2=0xce;}_0x3b54a6[_0x72d8('0x19')](_0x23b8d2);return _0x3b54a6[_0x72d8('0x20')]('Content-Range',_0x418098+'-'+_0x49df1c+'/'+_0x856551)[_0x72d8('0x1b')](_0x217470);}return null;};}function patchUpdates(_0x181fe4){return function(_0x3f18f2){try{jsonpatch[_0x72d8('0x21')](_0x3f18f2,_0x181fe4,!![]);}catch(_0x14e1c6){return BPromise[_0x72d8('0x22')](_0x14e1c6);}return _0x3f18f2[_0x72d8('0x23')]();};}function saveUpdates(_0x11d321,_0x4c3d19){return function(_0xcc0e56){if(_0xcc0e56){return _0xcc0e56[_0x72d8('0x24')](_0x11d321)['then'](function(_0x3ed978){return _0x3ed978;});}return null;};}function removeEntity(_0x2f01f4,_0x3d8980){return function(_0x57c660){if(_0x57c660){return _0x57c660[_0x72d8('0x25')]()[_0x72d8('0x26')](function(){_0x2f01f4[_0x72d8('0x19')](0xcc)[_0x72d8('0x1a')]();});}};}function handleEntityNotFound(_0x2e2c93,_0x4fecd3){return function(_0x438a01){if(!_0x438a01){_0x2e2c93[_0x72d8('0x18')](0x194);}return _0x438a01;};}function handleError(_0xf367be,_0x3cea49){_0x3cea49=_0x3cea49||0x1f4;return function(_0x305018){logger['error'](_0x305018[_0x72d8('0x27')]);if(_0x305018[_0x72d8('0x28')]){delete _0x305018[_0x72d8('0x28')];}_0xf367be[_0x72d8('0x19')](_0x3cea49)['send'](_0x305018);};}exports[_0x72d8('0x29')]=function(_0x4262d0,_0x4479fe){var _0x3daa7b={},_0x51e8fa={},_0x3237aa={'count':0x0,'rows':[]};var _0x2bacde=_[_0x72d8('0x2a')](db[_0x72d8('0x2b')]['rawAttributes'],function(_0x4c761b){return{'name':_0x4c761b[_0x72d8('0x2c')],'type':_0x4c761b[_0x72d8('0x2d')][_0x72d8('0x2e')]};});_0x51e8fa['model']=_[_0x72d8('0x2a')](_0x2bacde,'name');_0x51e8fa[_0x72d8('0x2f')]=_[_0x72d8('0x30')](_0x4262d0[_0x72d8('0x2f')]);_0x51e8fa[_0x72d8('0x31')]=_[_0x72d8('0x32')](_0x51e8fa['model'],_0x51e8fa['query']);_0x3daa7b[_0x72d8('0x33')]=_['intersection'](_0x51e8fa[_0x72d8('0x34')],qs[_0x72d8('0x35')](_0x4262d0[_0x72d8('0x2f')][_0x72d8('0x35')]));_0x3daa7b['attributes']=_0x3daa7b['attributes'][_0x72d8('0x36')]?_0x3daa7b[_0x72d8('0x33')]:_0x51e8fa[_0x72d8('0x34')];if(!_0x4262d0[_0x72d8('0x2f')][_0x72d8('0x37')](_0x72d8('0x38'))){_0x3daa7b[_0x72d8('0x1d')]=qs[_0x72d8('0x1d')](_0x4262d0['query'][_0x72d8('0x1d')]);_0x3daa7b[_0x72d8('0x1f')]=qs['offset'](_0x4262d0[_0x72d8('0x2f')]['offset']);}_0x3daa7b[_0x72d8('0x39')]=qs[_0x72d8('0x3a')](_0x4262d0[_0x72d8('0x2f')][_0x72d8('0x3a')]);_0x3daa7b[_0x72d8('0x3b')]=qs[_0x72d8('0x31')](_[_0x72d8('0x3c')](_0x4262d0['query'],_0x51e8fa[_0x72d8('0x31')]),_0x2bacde);if(_0x4262d0[_0x72d8('0x2f')][_0x72d8('0x3d')]){_0x3daa7b[_0x72d8('0x3b')]=_[_0x72d8('0x3e')](_0x3daa7b[_0x72d8('0x3b')],{'$or':_[_0x72d8('0x2a')](_0x2bacde,function(_0x5c2770){if(_0x5c2770[_0x72d8('0x2d')]!=='VIRTUAL'){var _0x2bd2ca={};_0x2bd2ca[_0x5c2770['name']]={'$like':'%'+_0x4262d0[_0x72d8('0x2f')]['filter']+'%'};return _0x2bd2ca;}})});}_0x3daa7b=_[_0x72d8('0x3e')]({},_0x3daa7b,_0x4262d0['options']);var _0x483775={'where':_0x3daa7b['where']};return db[_0x72d8('0x2b')][_0x72d8('0x1e')](_0x483775)[_0x72d8('0x26')](function(_0x598a1a){_0x3237aa[_0x72d8('0x1e')]=_0x598a1a;if(_0x4262d0[_0x72d8('0x2f')][_0x72d8('0x3f')]){_0x3daa7b[_0x72d8('0x40')]=[{'all':!![]}];}return db[_0x72d8('0x2b')]['findAll'](_0x3daa7b);})[_0x72d8('0x26')](function(_0x3f35dc){_0x3237aa[_0x72d8('0x41')]=_0x3f35dc;return _0x3237aa;})[_0x72d8('0x26')](respondWithFilteredResult(_0x4479fe,_0x3daa7b))[_0x72d8('0x42')](handleError(_0x4479fe,null));};exports[_0x72d8('0x43')]=function(_0x66f735,_0x232b79){var _0x5044b0={'raw':![],'where':{'id':_0x66f735[_0x72d8('0x44')]['id']}},_0x2deae5={};_0x2deae5['model']=_[_0x72d8('0x30')](db[_0x72d8('0x2b')]['rawAttributes']);_0x2deae5['query']=_[_0x72d8('0x30')](_0x66f735[_0x72d8('0x2f')]);_0x2deae5[_0x72d8('0x31')]=_[_0x72d8('0x32')](_0x2deae5[_0x72d8('0x34')],_0x2deae5[_0x72d8('0x2f')]);_0x5044b0[_0x72d8('0x33')]=_[_0x72d8('0x32')](_0x2deae5[_0x72d8('0x34')],qs[_0x72d8('0x35')](_0x66f735['query'][_0x72d8('0x35')]));_0x5044b0[_0x72d8('0x33')]=_0x5044b0[_0x72d8('0x33')][_0x72d8('0x36')]?_0x5044b0[_0x72d8('0x33')]:_0x2deae5[_0x72d8('0x34')];if(_0x66f735[_0x72d8('0x2f')][_0x72d8('0x3f')]){_0x5044b0[_0x72d8('0x40')]=[{'all':!![]}];}_0x5044b0=_['merge']({},_0x5044b0,_0x66f735[_0x72d8('0x45')]);return db[_0x72d8('0x2b')][_0x72d8('0x46')](_0x5044b0)[_0x72d8('0x26')](handleEntityNotFound(_0x232b79,null))[_0x72d8('0x26')](respondWithResult(_0x232b79,null))[_0x72d8('0x42')](handleError(_0x232b79,null));};exports[_0x72d8('0x47')]=function(_0xc16473,_0xaf0114){return db[_0x72d8('0x2b')][_0x72d8('0x47')](_0xc16473['body'],{})['then'](respondWithResult(_0xaf0114,0xc9))[_0x72d8('0x42')](handleError(_0xaf0114,null));};exports[_0x72d8('0x24')]=function(_0x8786f9,_0x57c260){if(_0x8786f9[_0x72d8('0x48')]['id']){delete _0x8786f9['body']['id'];}return db[_0x72d8('0x2b')][_0x72d8('0x46')]({'where':{'id':_0x8786f9['params']['id']}})[_0x72d8('0x26')](handleEntityNotFound(_0x57c260,null))[_0x72d8('0x26')](saveUpdates(_0x8786f9[_0x72d8('0x48')],null))[_0x72d8('0x26')](respondWithResult(_0x57c260,null))[_0x72d8('0x42')](handleError(_0x57c260,null));};exports[_0x72d8('0x25')]=function(_0x8f91a1,_0x156c9b){return db[_0x72d8('0x2b')][_0x72d8('0x46')]({'where':{'id':_0x8f91a1[_0x72d8('0x44')]['id']}})[_0x72d8('0x26')](handleEntityNotFound(_0x156c9b,null))['then'](removeEntity(_0x156c9b,null))[_0x72d8('0x42')](handleError(_0x156c9b,null));};exports[_0x72d8('0x49')]=function(_0x184541,_0x4a2a4a,_0xbd5bd7){var _0x558ddb={};var _0x33b003={};var _0x15d03d;var _0x45cd15;return db[_0x72d8('0x2b')][_0x72d8('0x4a')]({'where':{'id':_0x184541[_0x72d8('0x44')]['id']}})['then'](handleEntityNotFound(_0x4a2a4a,null))[_0x72d8('0x26')](function(_0x11766c){if(_0x11766c){_0x15d03d=_0x11766c;_0x33b003[_0x72d8('0x34')]=_[_0x72d8('0x30')](db[_0x72d8('0x4b')][_0x72d8('0x4c')]);_0x33b003['query']=_[_0x72d8('0x30')](_0x184541[_0x72d8('0x2f')]);_0x33b003[_0x72d8('0x31')]=_['intersection'](_0x33b003[_0x72d8('0x34')],_0x33b003[_0x72d8('0x2f')]);_0x558ddb['attributes']=_['intersection'](_0x33b003[_0x72d8('0x34')],qs[_0x72d8('0x35')](_0x184541[_0x72d8('0x2f')][_0x72d8('0x35')]));_0x558ddb[_0x72d8('0x33')]=_0x558ddb[_0x72d8('0x33')][_0x72d8('0x36')]?_0x558ddb['attributes']:_0x33b003[_0x72d8('0x34')];_0x558ddb[_0x72d8('0x39')]=qs[_0x72d8('0x3a')](_0x184541[_0x72d8('0x2f')]['sort']);_0x558ddb[_0x72d8('0x3b')]=qs['filters'](_[_0x72d8('0x3c')](_0x184541['query'],_0x33b003[_0x72d8('0x31')]));if(_0x184541['query']['filter']){_0x558ddb[_0x72d8('0x3b')]=_[_0x72d8('0x3e')](_0x558ddb['where'],{'$or':_[_0x72d8('0x2a')](_0x558ddb[_0x72d8('0x33')],function(_0x3efad){var _0x916328={};_0x916328[_0x3efad]={'$like':'%'+_0x184541[_0x72d8('0x2f')]['filter']+'%'};return _0x916328;})});}_0x558ddb=_[_0x72d8('0x3e')]({},_0x558ddb,_0x184541['options']);return _0x15d03d[_0x72d8('0x49')](_0x558ddb);}})['then'](function(_0x1af25){if(_0x1af25){_0x45cd15=_0x1af25[_0x72d8('0x36')];if(!_0x184541['query'][_0x72d8('0x37')](_0x72d8('0x38'))){_0x558ddb[_0x72d8('0x1d')]=qs['limit'](_0x184541['query'][_0x72d8('0x1d')]);_0x558ddb[_0x72d8('0x1f')]=qs[_0x72d8('0x1f')](_0x184541[_0x72d8('0x2f')]['offset']);}return _0x15d03d[_0x72d8('0x49')](_0x558ddb);}})[_0x72d8('0x26')](function(_0x3bbe5c){if(_0x3bbe5c){return _0x3bbe5c?{'count':_0x45cd15,'rows':_0x3bbe5c}:null;}})[_0x72d8('0x26')](respondWithResult(_0x4a2a4a,null))[_0x72d8('0x42')](handleError(_0x4a2a4a,null));};exports['getDescriptions']=function(_0x39ddf5,_0xb45265,_0x5b3e71){var _0x3b9dfa={};var _0x54ae03={};var _0x262162;var _0x217893;return db[_0x72d8('0x2b')][_0x72d8('0x4a')]({'where':{'id':_0x39ddf5[_0x72d8('0x44')]['id']}})[_0x72d8('0x26')](handleEntityNotFound(_0xb45265,null))[_0x72d8('0x26')](function(_0xbadcf8){if(_0xbadcf8){_0x262162=_0xbadcf8;_0x54ae03['model']=_[_0x72d8('0x30')](db[_0x72d8('0x4b')]['rawAttributes']);_0x54ae03[_0x72d8('0x2f')]=_[_0x72d8('0x30')](_0x39ddf5[_0x72d8('0x2f')]);_0x54ae03[_0x72d8('0x31')]=_[_0x72d8('0x32')](_0x54ae03[_0x72d8('0x34')],_0x54ae03['query']);_0x3b9dfa[_0x72d8('0x33')]=_['intersection'](_0x54ae03[_0x72d8('0x34')],qs[_0x72d8('0x35')](_0x39ddf5[_0x72d8('0x2f')]['fields']));_0x3b9dfa['attributes']=_0x3b9dfa[_0x72d8('0x33')][_0x72d8('0x36')]?_0x3b9dfa[_0x72d8('0x33')]:_0x54ae03['model'];_0x3b9dfa[_0x72d8('0x39')]=qs['sort'](_0x39ddf5[_0x72d8('0x2f')][_0x72d8('0x3a')]);_0x3b9dfa[_0x72d8('0x3b')]=qs[_0x72d8('0x31')](_[_0x72d8('0x3c')](_0x39ddf5['query'],_0x54ae03['filters']));if(_0x39ddf5['query'][_0x72d8('0x3d')]){_0x3b9dfa['where']=_[_0x72d8('0x3e')](_0x3b9dfa[_0x72d8('0x3b')],{'$or':_['map'](_0x3b9dfa['attributes'],function(_0x4402c8){var _0x28b788={};_0x28b788[_0x4402c8]={'$like':'%'+_0x39ddf5[_0x72d8('0x2f')][_0x72d8('0x3d')]+'%'};return _0x28b788;})});}_0x3b9dfa=_['merge']({},_0x3b9dfa,_0x39ddf5[_0x72d8('0x45')]);return _0x262162['getDescriptions'](_0x3b9dfa);}})[_0x72d8('0x26')](function(_0x23cdc4){if(_0x23cdc4){_0x217893=_0x23cdc4['length'];if(!_0x39ddf5[_0x72d8('0x2f')][_0x72d8('0x37')]('nolimit')){_0x3b9dfa[_0x72d8('0x1d')]=qs[_0x72d8('0x1d')](_0x39ddf5[_0x72d8('0x2f')][_0x72d8('0x1d')]);_0x3b9dfa[_0x72d8('0x1f')]=qs['offset'](_0x39ddf5['query']['offset']);}return _0x262162[_0x72d8('0x4d')](_0x3b9dfa);}})[_0x72d8('0x26')](function(_0x4bce70){if(_0x4bce70){return _0x4bce70?{'count':_0x217893,'rows':_0x4bce70}:null;}})['then'](respondWithResult(_0xb45265,null))[_0x72d8('0x42')](handleError(_0xb45265,null));};exports[_0x72d8('0x4e')]=function(_0x5cd0c9,_0x43c75c,_0x4cef3c){var _0x5c1498={};var _0x112717={};var _0x46b5ad;var _0x3f74cf;return db['FreshsalesConfiguration'][_0x72d8('0x4a')]({'where':{'id':_0x5cd0c9[_0x72d8('0x44')]['id']}})['then'](handleEntityNotFound(_0x43c75c,null))[_0x72d8('0x26')](function(_0x5a3ae0){if(_0x5a3ae0){_0x46b5ad=_0x5a3ae0;_0x112717['model']=_[_0x72d8('0x30')](db[_0x72d8('0x4b')]['rawAttributes']);_0x112717['query']=_[_0x72d8('0x30')](_0x5cd0c9[_0x72d8('0x2f')]);_0x112717['filters']=_[_0x72d8('0x32')](_0x112717[_0x72d8('0x34')],_0x112717[_0x72d8('0x2f')]);_0x5c1498[_0x72d8('0x33')]=_['intersection'](_0x112717['model'],qs[_0x72d8('0x35')](_0x5cd0c9[_0x72d8('0x2f')][_0x72d8('0x35')]));_0x5c1498[_0x72d8('0x33')]=_0x5c1498[_0x72d8('0x33')]['length']?_0x5c1498[_0x72d8('0x33')]:_0x112717[_0x72d8('0x34')];_0x5c1498[_0x72d8('0x39')]=qs[_0x72d8('0x3a')](_0x5cd0c9[_0x72d8('0x2f')]['sort']);_0x5c1498[_0x72d8('0x3b')]=qs[_0x72d8('0x31')](_[_0x72d8('0x3c')](_0x5cd0c9['query'],_0x112717[_0x72d8('0x31')]));if(_0x5cd0c9[_0x72d8('0x2f')][_0x72d8('0x3d')]){_0x5c1498['where']=_[_0x72d8('0x3e')](_0x5c1498[_0x72d8('0x3b')],{'$or':_['map'](_0x5c1498[_0x72d8('0x33')],function(_0x3e7d2d){var _0x46d309={};_0x46d309[_0x3e7d2d]={'$like':'%'+_0x5cd0c9['query'][_0x72d8('0x3d')]+'%'};return _0x46d309;})});}_0x5c1498=_[_0x72d8('0x3e')]({},_0x5c1498,_0x5cd0c9[_0x72d8('0x45')]);return _0x46b5ad['getFields'](_0x5c1498);}})[_0x72d8('0x26')](function(_0x256784){if(_0x256784){_0x3f74cf=_0x256784[_0x72d8('0x36')];if(!_0x5cd0c9['query'][_0x72d8('0x37')](_0x72d8('0x38'))){_0x5c1498[_0x72d8('0x1d')]=qs['limit'](_0x5cd0c9['query']['limit']);_0x5c1498[_0x72d8('0x1f')]=qs[_0x72d8('0x1f')](_0x5cd0c9['query'][_0x72d8('0x1f')]);}return _0x46b5ad[_0x72d8('0x4e')](_0x5c1498);}})[_0x72d8('0x26')](function(_0x24132b){if(_0x24132b){return _0x24132b?{'count':_0x3f74cf,'rows':_0x24132b}:null;}})[_0x72d8('0x26')](respondWithResult(_0x43c75c,null))[_0x72d8('0x42')](handleError(_0x43c75c,null));}; \ No newline at end of file +var _0x3b0e=['VIRTUAL','FreshsalesConfiguration','include','findAll','rows','catch','show','params','fields','includeAll','options','find','create','body','findOne','order','filter','getSubjects','nolimit','getDescriptions','FreshsalesField','getFields','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','rawAttributes','type','key','map','query','keys','intersection','model','attributes','length','hasOwnProperty','sort','where','filters','pick','merge'];(function(_0x1bb3ee,_0x32ec65){var _0x3b2838=function(_0x487983){while(--_0x487983){_0x1bb3ee['push'](_0x1bb3ee['shift']());}};_0x3b2838(++_0x32ec65);}(_0x3b0e,0x67));var _0xe3b0=function(_0x264957,_0x5d5b0a){_0x264957=_0x264957-0x0;var _0x17dfde=_0x3b0e[_0x264957];return _0x17dfde;};'use strict';var emlformat=require(_0xe3b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe3b0('0x1'));var jsonpatch=require(_0xe3b0('0x2'));var rp=require(_0xe3b0('0x3'));var moment=require(_0xe3b0('0x4'));var BPromise=require(_0xe3b0('0x5'));var Mustache=require(_0xe3b0('0x6'));var util=require('util');var path=require('path');var sox=require(_0xe3b0('0x7'));var csv=require('to-csv');var ejs=require(_0xe3b0('0x8'));var fs=require('fs');var fs_extra=require(_0xe3b0('0x9'));var _=require('lodash');var squel=require(_0xe3b0('0xa'));var crypto=require(_0xe3b0('0xb'));var jsforce=require(_0xe3b0('0xc'));var deskjs=require(_0xe3b0('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe3b0('0xe'));var Redis=require(_0xe3b0('0xf'));var authService=require(_0xe3b0('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe3b0('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe3b0('0x12'))(_0xe3b0('0x13'));var utils=require(_0xe3b0('0x14'));var config=require(_0xe3b0('0x15'));var licenseUtil=require(_0xe3b0('0x16'));var db=require(_0xe3b0('0x17'))['db'];function respondWithStatusCode(_0x4b01f3,_0x3be40a){_0x3be40a=_0x3be40a||0xcc;return function(_0x55a1ba){if(_0x55a1ba){return _0x4b01f3[_0xe3b0('0x18')](_0x3be40a);}return _0x4b01f3[_0xe3b0('0x19')](_0x3be40a)[_0xe3b0('0x1a')]();};}function respondWithResult(_0x791d,_0x1d8167){_0x1d8167=_0x1d8167||0xc8;return function(_0x308468){if(_0x308468){return _0x791d[_0xe3b0('0x19')](_0x1d8167)[_0xe3b0('0x1b')](_0x308468);}};}function respondWithFilteredResult(_0x3bfab6,_0x3b16e0){return function(_0x45a1d4){if(_0x45a1d4){var _0x318f7a=typeof _0x3b16e0[_0xe3b0('0x1c')]==='undefined'&&typeof _0x3b16e0[_0xe3b0('0x1d')]===_0xe3b0('0x1e');var _0x3d70b7=_0x45a1d4['count'];var _0x24efe6=_0x318f7a?0x0:_0x3b16e0[_0xe3b0('0x1c')];var _0x44feee=_0x318f7a?_0x45a1d4['count']:_0x3b16e0[_0xe3b0('0x1c')]+_0x3b16e0[_0xe3b0('0x1d')];var _0x315f42;if(_0x44feee>=_0x3d70b7){_0x44feee=_0x3d70b7;_0x315f42=0xc8;}else{_0x315f42=0xce;}_0x3bfab6['status'](_0x315f42);return _0x3bfab6[_0xe3b0('0x1f')](_0xe3b0('0x20'),_0x24efe6+'-'+_0x44feee+'/'+_0x3d70b7)[_0xe3b0('0x1b')](_0x45a1d4);}return null;};}function patchUpdates(_0x1bc8aa){return function(_0x5043b1){try{jsonpatch[_0xe3b0('0x21')](_0x5043b1,_0x1bc8aa,!![]);}catch(_0x3eacbe){return BPromise[_0xe3b0('0x22')](_0x3eacbe);}return _0x5043b1['save']();};}function saveUpdates(_0xed8547,_0x25fbb2){return function(_0x445d98){if(_0x445d98){return _0x445d98[_0xe3b0('0x23')](_0xed8547)[_0xe3b0('0x24')](function(_0x5abcfd){return _0x5abcfd;});}return null;};}function removeEntity(_0x4f72ff,_0xdf6f9){return function(_0x51b1bd){if(_0x51b1bd){return _0x51b1bd[_0xe3b0('0x25')]()[_0xe3b0('0x24')](function(){_0x4f72ff[_0xe3b0('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43ffc4,_0x2ce3ee){return function(_0x3c8183){if(!_0x3c8183){_0x43ffc4[_0xe3b0('0x18')](0x194);}return _0x3c8183;};}function handleError(_0x181b56,_0x532267){_0x532267=_0x532267||0x1f4;return function(_0x548d86){logger[_0xe3b0('0x26')](_0x548d86[_0xe3b0('0x27')]);if(_0x548d86[_0xe3b0('0x28')]){delete _0x548d86['name'];}_0x181b56['status'](_0x532267)[_0xe3b0('0x29')](_0x548d86);};}exports[_0xe3b0('0x2a')]=function(_0x32f19e,_0x176a91){var _0x12e22b={},_0x123c04={},_0x40f002={'count':0x0,'rows':[]};var _0x4d4c4f=_['map'](db['FreshsalesConfiguration'][_0xe3b0('0x2b')],function(_0x193395){return{'name':_0x193395['fieldName'],'type':_0x193395[_0xe3b0('0x2c')][_0xe3b0('0x2d')]};});_0x123c04['model']=_[_0xe3b0('0x2e')](_0x4d4c4f,_0xe3b0('0x28'));_0x123c04[_0xe3b0('0x2f')]=_[_0xe3b0('0x30')](_0x32f19e[_0xe3b0('0x2f')]);_0x123c04['filters']=_[_0xe3b0('0x31')](_0x123c04[_0xe3b0('0x32')],_0x123c04[_0xe3b0('0x2f')]);_0x12e22b['attributes']=_[_0xe3b0('0x31')](_0x123c04[_0xe3b0('0x32')],qs['fields'](_0x32f19e[_0xe3b0('0x2f')]['fields']));_0x12e22b[_0xe3b0('0x33')]=_0x12e22b[_0xe3b0('0x33')][_0xe3b0('0x34')]?_0x12e22b[_0xe3b0('0x33')]:_0x123c04[_0xe3b0('0x32')];if(!_0x32f19e[_0xe3b0('0x2f')][_0xe3b0('0x35')]('nolimit')){_0x12e22b[_0xe3b0('0x1d')]=qs[_0xe3b0('0x1d')](_0x32f19e[_0xe3b0('0x2f')][_0xe3b0('0x1d')]);_0x12e22b['offset']=qs[_0xe3b0('0x1c')](_0x32f19e[_0xe3b0('0x2f')][_0xe3b0('0x1c')]);}_0x12e22b['order']=qs['sort'](_0x32f19e[_0xe3b0('0x2f')][_0xe3b0('0x36')]);_0x12e22b[_0xe3b0('0x37')]=qs[_0xe3b0('0x38')](_[_0xe3b0('0x39')](_0x32f19e['query'],_0x123c04[_0xe3b0('0x38')]),_0x4d4c4f);if(_0x32f19e[_0xe3b0('0x2f')]['filter']){_0x12e22b[_0xe3b0('0x37')]=_[_0xe3b0('0x3a')](_0x12e22b[_0xe3b0('0x37')],{'$or':_[_0xe3b0('0x2e')](_0x4d4c4f,function(_0x44e126){if(_0x44e126[_0xe3b0('0x2c')]!==_0xe3b0('0x3b')){var _0x598b9d={};_0x598b9d[_0x44e126[_0xe3b0('0x28')]]={'$like':'%'+_0x32f19e[_0xe3b0('0x2f')]['filter']+'%'};return _0x598b9d;}})});}_0x12e22b=_[_0xe3b0('0x3a')]({},_0x12e22b,_0x32f19e['options']);var _0x429afa={'where':_0x12e22b[_0xe3b0('0x37')]};return db[_0xe3b0('0x3c')]['count'](_0x429afa)[_0xe3b0('0x24')](function(_0x2fe321){_0x40f002['count']=_0x2fe321;if(_0x32f19e[_0xe3b0('0x2f')]['includeAll']){_0x12e22b[_0xe3b0('0x3d')]=[{'all':!![]}];}return db[_0xe3b0('0x3c')][_0xe3b0('0x3e')](_0x12e22b);})[_0xe3b0('0x24')](function(_0x38b224){_0x40f002[_0xe3b0('0x3f')]=_0x38b224;return _0x40f002;})[_0xe3b0('0x24')](respondWithFilteredResult(_0x176a91,_0x12e22b))[_0xe3b0('0x40')](handleError(_0x176a91,null));};exports[_0xe3b0('0x41')]=function(_0x4f45c4,_0x573c36){var _0x4b969a={'raw':![],'where':{'id':_0x4f45c4[_0xe3b0('0x42')]['id']}},_0x24edfc={};_0x24edfc[_0xe3b0('0x32')]=_['keys'](db[_0xe3b0('0x3c')]['rawAttributes']);_0x24edfc[_0xe3b0('0x2f')]=_[_0xe3b0('0x30')](_0x4f45c4[_0xe3b0('0x2f')]);_0x24edfc[_0xe3b0('0x38')]=_[_0xe3b0('0x31')](_0x24edfc[_0xe3b0('0x32')],_0x24edfc['query']);_0x4b969a[_0xe3b0('0x33')]=_['intersection'](_0x24edfc['model'],qs[_0xe3b0('0x43')](_0x4f45c4['query'][_0xe3b0('0x43')]));_0x4b969a[_0xe3b0('0x33')]=_0x4b969a[_0xe3b0('0x33')][_0xe3b0('0x34')]?_0x4b969a[_0xe3b0('0x33')]:_0x24edfc[_0xe3b0('0x32')];if(_0x4f45c4[_0xe3b0('0x2f')][_0xe3b0('0x44')]){_0x4b969a['include']=[{'all':!![]}];}_0x4b969a=_['merge']({},_0x4b969a,_0x4f45c4[_0xe3b0('0x45')]);return db[_0xe3b0('0x3c')][_0xe3b0('0x46')](_0x4b969a)[_0xe3b0('0x24')](handleEntityNotFound(_0x573c36,null))[_0xe3b0('0x24')](respondWithResult(_0x573c36,null))['catch'](handleError(_0x573c36,null));};exports[_0xe3b0('0x47')]=function(_0x17433a,_0x527f04){return db[_0xe3b0('0x3c')][_0xe3b0('0x47')](_0x17433a['body'],{})[_0xe3b0('0x24')](respondWithResult(_0x527f04,0xc9))[_0xe3b0('0x40')](handleError(_0x527f04,null));};exports[_0xe3b0('0x23')]=function(_0x46e917,_0x47f38f){if(_0x46e917[_0xe3b0('0x48')]['id']){delete _0x46e917['body']['id'];}return db[_0xe3b0('0x3c')][_0xe3b0('0x46')]({'where':{'id':_0x46e917[_0xe3b0('0x42')]['id']}})[_0xe3b0('0x24')](handleEntityNotFound(_0x47f38f,null))[_0xe3b0('0x24')](saveUpdates(_0x46e917[_0xe3b0('0x48')],null))[_0xe3b0('0x24')](respondWithResult(_0x47f38f,null))[_0xe3b0('0x40')](handleError(_0x47f38f,null));};exports[_0xe3b0('0x25')]=function(_0x338717,_0xbbf986){return db[_0xe3b0('0x3c')]['find']({'where':{'id':_0x338717[_0xe3b0('0x42')]['id']}})[_0xe3b0('0x24')](handleEntityNotFound(_0xbbf986,null))[_0xe3b0('0x24')](removeEntity(_0xbbf986,null))['catch'](handleError(_0xbbf986,null));};exports['getSubjects']=function(_0x1fe8bd,_0xb75260,_0x5f0ce5){var _0x177053={};var _0x29353d={};var _0x48a1b4;var _0x524b1f;return db[_0xe3b0('0x3c')][_0xe3b0('0x49')]({'where':{'id':_0x1fe8bd['params']['id']}})['then'](handleEntityNotFound(_0xb75260,null))[_0xe3b0('0x24')](function(_0x525fa0){if(_0x525fa0){_0x48a1b4=_0x525fa0;_0x29353d[_0xe3b0('0x32')]=_[_0xe3b0('0x30')](db['FreshsalesField'][_0xe3b0('0x2b')]);_0x29353d[_0xe3b0('0x2f')]=_[_0xe3b0('0x30')](_0x1fe8bd[_0xe3b0('0x2f')]);_0x29353d[_0xe3b0('0x38')]=_[_0xe3b0('0x31')](_0x29353d[_0xe3b0('0x32')],_0x29353d['query']);_0x177053[_0xe3b0('0x33')]=_['intersection'](_0x29353d[_0xe3b0('0x32')],qs[_0xe3b0('0x43')](_0x1fe8bd[_0xe3b0('0x2f')][_0xe3b0('0x43')]));_0x177053[_0xe3b0('0x33')]=_0x177053[_0xe3b0('0x33')][_0xe3b0('0x34')]?_0x177053['attributes']:_0x29353d[_0xe3b0('0x32')];_0x177053[_0xe3b0('0x4a')]=qs[_0xe3b0('0x36')](_0x1fe8bd[_0xe3b0('0x2f')][_0xe3b0('0x36')]);_0x177053[_0xe3b0('0x37')]=qs[_0xe3b0('0x38')](_[_0xe3b0('0x39')](_0x1fe8bd[_0xe3b0('0x2f')],_0x29353d[_0xe3b0('0x38')]));if(_0x1fe8bd[_0xe3b0('0x2f')][_0xe3b0('0x4b')]){_0x177053[_0xe3b0('0x37')]=_[_0xe3b0('0x3a')](_0x177053[_0xe3b0('0x37')],{'$or':_[_0xe3b0('0x2e')](_0x177053[_0xe3b0('0x33')],function(_0x45b549){var _0x33e05c={};_0x33e05c[_0x45b549]={'$like':'%'+_0x1fe8bd['query'][_0xe3b0('0x4b')]+'%'};return _0x33e05c;})});}_0x177053=_[_0xe3b0('0x3a')]({},_0x177053,_0x1fe8bd[_0xe3b0('0x45')]);return _0x48a1b4[_0xe3b0('0x4c')](_0x177053);}})[_0xe3b0('0x24')](function(_0x931883){if(_0x931883){_0x524b1f=_0x931883[_0xe3b0('0x34')];if(!_0x1fe8bd['query'][_0xe3b0('0x35')](_0xe3b0('0x4d'))){_0x177053[_0xe3b0('0x1d')]=qs[_0xe3b0('0x1d')](_0x1fe8bd[_0xe3b0('0x2f')][_0xe3b0('0x1d')]);_0x177053[_0xe3b0('0x1c')]=qs[_0xe3b0('0x1c')](_0x1fe8bd[_0xe3b0('0x2f')][_0xe3b0('0x1c')]);}return _0x48a1b4[_0xe3b0('0x4c')](_0x177053);}})['then'](function(_0x18f28f){if(_0x18f28f){return _0x18f28f?{'count':_0x524b1f,'rows':_0x18f28f}:null;}})[_0xe3b0('0x24')](respondWithResult(_0xb75260,null))[_0xe3b0('0x40')](handleError(_0xb75260,null));};exports[_0xe3b0('0x4e')]=function(_0x3df3cd,_0x309206,_0x1c82ec){var _0x569465={};var _0x2753ff={};var _0x193351;var _0x3bcc9e;return db[_0xe3b0('0x3c')][_0xe3b0('0x49')]({'where':{'id':_0x3df3cd[_0xe3b0('0x42')]['id']}})[_0xe3b0('0x24')](handleEntityNotFound(_0x309206,null))[_0xe3b0('0x24')](function(_0xb00c39){if(_0xb00c39){_0x193351=_0xb00c39;_0x2753ff[_0xe3b0('0x32')]=_[_0xe3b0('0x30')](db[_0xe3b0('0x4f')]['rawAttributes']);_0x2753ff['query']=_[_0xe3b0('0x30')](_0x3df3cd[_0xe3b0('0x2f')]);_0x2753ff[_0xe3b0('0x38')]=_[_0xe3b0('0x31')](_0x2753ff['model'],_0x2753ff[_0xe3b0('0x2f')]);_0x569465[_0xe3b0('0x33')]=_[_0xe3b0('0x31')](_0x2753ff[_0xe3b0('0x32')],qs['fields'](_0x3df3cd[_0xe3b0('0x2f')]['fields']));_0x569465[_0xe3b0('0x33')]=_0x569465[_0xe3b0('0x33')][_0xe3b0('0x34')]?_0x569465['attributes']:_0x2753ff[_0xe3b0('0x32')];_0x569465[_0xe3b0('0x4a')]=qs[_0xe3b0('0x36')](_0x3df3cd[_0xe3b0('0x2f')][_0xe3b0('0x36')]);_0x569465[_0xe3b0('0x37')]=qs['filters'](_[_0xe3b0('0x39')](_0x3df3cd[_0xe3b0('0x2f')],_0x2753ff[_0xe3b0('0x38')]));if(_0x3df3cd[_0xe3b0('0x2f')][_0xe3b0('0x4b')]){_0x569465[_0xe3b0('0x37')]=_[_0xe3b0('0x3a')](_0x569465[_0xe3b0('0x37')],{'$or':_[_0xe3b0('0x2e')](_0x569465['attributes'],function(_0x13990b){var _0x1a4c13={};_0x1a4c13[_0x13990b]={'$like':'%'+_0x3df3cd[_0xe3b0('0x2f')]['filter']+'%'};return _0x1a4c13;})});}_0x569465=_[_0xe3b0('0x3a')]({},_0x569465,_0x3df3cd[_0xe3b0('0x45')]);return _0x193351[_0xe3b0('0x4e')](_0x569465);}})[_0xe3b0('0x24')](function(_0x45c380){if(_0x45c380){_0x3bcc9e=_0x45c380[_0xe3b0('0x34')];if(!_0x3df3cd[_0xe3b0('0x2f')][_0xe3b0('0x35')](_0xe3b0('0x4d'))){_0x569465[_0xe3b0('0x1d')]=qs[_0xe3b0('0x1d')](_0x3df3cd[_0xe3b0('0x2f')][_0xe3b0('0x1d')]);_0x569465[_0xe3b0('0x1c')]=qs[_0xe3b0('0x1c')](_0x3df3cd[_0xe3b0('0x2f')][_0xe3b0('0x1c')]);}return _0x193351[_0xe3b0('0x4e')](_0x569465);}})[_0xe3b0('0x24')](function(_0x3551c4){if(_0x3551c4){return _0x3551c4?{'count':_0x3bcc9e,'rows':_0x3551c4}:null;}})['then'](respondWithResult(_0x309206,null))[_0xe3b0('0x40')](handleError(_0x309206,null));};exports[_0xe3b0('0x50')]=function(_0x1f0729,_0x2b8174,_0x17f56b){var _0xabc107={};var _0x1b57bc={};var _0x139b44;var _0x30ee49;return db[_0xe3b0('0x3c')][_0xe3b0('0x49')]({'where':{'id':_0x1f0729[_0xe3b0('0x42')]['id']}})[_0xe3b0('0x24')](handleEntityNotFound(_0x2b8174,null))[_0xe3b0('0x24')](function(_0x1b86c4){if(_0x1b86c4){_0x139b44=_0x1b86c4;_0x1b57bc[_0xe3b0('0x32')]=_[_0xe3b0('0x30')](db[_0xe3b0('0x4f')][_0xe3b0('0x2b')]);_0x1b57bc[_0xe3b0('0x2f')]=_[_0xe3b0('0x30')](_0x1f0729[_0xe3b0('0x2f')]);_0x1b57bc[_0xe3b0('0x38')]=_['intersection'](_0x1b57bc[_0xe3b0('0x32')],_0x1b57bc[_0xe3b0('0x2f')]);_0xabc107[_0xe3b0('0x33')]=_[_0xe3b0('0x31')](_0x1b57bc['model'],qs[_0xe3b0('0x43')](_0x1f0729[_0xe3b0('0x2f')][_0xe3b0('0x43')]));_0xabc107[_0xe3b0('0x33')]=_0xabc107[_0xe3b0('0x33')][_0xe3b0('0x34')]?_0xabc107[_0xe3b0('0x33')]:_0x1b57bc['model'];_0xabc107[_0xe3b0('0x4a')]=qs[_0xe3b0('0x36')](_0x1f0729[_0xe3b0('0x2f')][_0xe3b0('0x36')]);_0xabc107[_0xe3b0('0x37')]=qs[_0xe3b0('0x38')](_[_0xe3b0('0x39')](_0x1f0729['query'],_0x1b57bc['filters']));if(_0x1f0729[_0xe3b0('0x2f')][_0xe3b0('0x4b')]){_0xabc107[_0xe3b0('0x37')]=_[_0xe3b0('0x3a')](_0xabc107[_0xe3b0('0x37')],{'$or':_['map'](_0xabc107[_0xe3b0('0x33')],function(_0x1894e3){var _0xfbc0d3={};_0xfbc0d3[_0x1894e3]={'$like':'%'+_0x1f0729[_0xe3b0('0x2f')][_0xe3b0('0x4b')]+'%'};return _0xfbc0d3;})});}_0xabc107=_[_0xe3b0('0x3a')]({},_0xabc107,_0x1f0729[_0xe3b0('0x45')]);return _0x139b44[_0xe3b0('0x50')](_0xabc107);}})[_0xe3b0('0x24')](function(_0x22a71a){if(_0x22a71a){_0x30ee49=_0x22a71a[_0xe3b0('0x34')];if(!_0x1f0729[_0xe3b0('0x2f')]['hasOwnProperty'](_0xe3b0('0x4d'))){_0xabc107[_0xe3b0('0x1d')]=qs[_0xe3b0('0x1d')](_0x1f0729[_0xe3b0('0x2f')][_0xe3b0('0x1d')]);_0xabc107[_0xe3b0('0x1c')]=qs[_0xe3b0('0x1c')](_0x1f0729[_0xe3b0('0x2f')][_0xe3b0('0x1c')]);}return _0x139b44['getFields'](_0xabc107);}})[_0xe3b0('0x24')](function(_0x111038){if(_0x111038){return _0x111038?{'count':_0x30ee49,'rows':_0x111038}:null;}})[_0xe3b0('0x24')](respondWithResult(_0x2b8174,null))[_0xe3b0('0x40')](handleError(_0x2b8174,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 497bd0c..8f9e1ec 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 _0xb933=['bluebird','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x3b11cb,_0x4318b8){var _0x4fca32=function(_0x5d2b67){while(--_0x5d2b67){_0x3b11cb['push'](_0x3b11cb['shift']());}};_0x4fca32(++_0x4318b8);}(_0xb933,0x79));var _0x3b93=function(_0x4953da,_0x5adaca){_0x4953da=_0x4953da-0x0;var _0x2d3780=_0xb933[_0x4953da];return _0x2d3780;};'use strict';var _=require(_0x3b93('0x0'));var util=require(_0x3b93('0x1'));var logger=require(_0x3b93('0x2'))(_0x3b93('0x3'));var moment=require(_0x3b93('0x4'));var BPromise=require(_0x3b93('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3b93('0x6'));var rimraf=require(_0x3b93('0x7'));var config=require(_0x3b93('0x8'));var attributes=require(_0x3b93('0x9'));module[_0x3b93('0xa')]=function(_0xe800b9,_0x85a96b){return _0xe800b9[_0x3b93('0xb')](_0x3b93('0xc'),attributes,{'tableName':_0x3b93('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x807c=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations'];(function(_0x2e133f,_0x53cd82){var _0x17e85a=function(_0x181bf4){while(--_0x181bf4){_0x2e133f['push'](_0x2e133f['shift']());}};_0x17e85a(++_0x53cd82);}(_0x807c,0x10a));var _0xc807=function(_0x3c8a4b,_0x23fc4f){_0x3c8a4b=_0x3c8a4b-0x0;var _0x143e30=_0x807c[_0x3c8a4b];return _0x143e30;};'use strict';var _=require(_0xc807('0x0'));var util=require(_0xc807('0x1'));var logger=require(_0xc807('0x2'))(_0xc807('0x3'));var moment=require(_0xc807('0x4'));var BPromise=require(_0xc807('0x5'));var rp=require(_0xc807('0x6'));var fs=require('fs');var path=require(_0xc807('0x7'));var rimraf=require('rimraf');var config=require(_0xc807('0x8'));var attributes=require(_0xc807('0x9'));module[_0xc807('0xa')]=function(_0x5477e1,_0x42d3a5){return _0x5477e1[_0xc807('0xb')](_0xc807('0xc'),attributes,{'tableName':_0xc807('0xd'),'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 cc6b6f0..5addfc9 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 _0xa7ec=['info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','code','error','message'];(function(_0x5f58da,_0x1f9d4a){var _0x4f667c=function(_0x195c41){while(--_0x195c41){_0x5f58da['push'](_0x5f58da['shift']());}};_0x4f667c(++_0x1f9d4a);}(_0xa7ec,0x11f));var _0xca7e=function(_0x4d3a2b,_0x2f8e97){_0x4d3a2b=_0x4d3a2b-0x0;var _0x131a42=_0xa7ec[_0x4d3a2b];return _0x131a42;};'use strict';var _=require(_0xca7e('0x0'));var util=require(_0xca7e('0x1'));var moment=require(_0xca7e('0x2'));var BPromise=require(_0xca7e('0x3'));var rs=require(_0xca7e('0x4'));var fs=require('fs');var Redis=require(_0xca7e('0x5'));var db=require(_0xca7e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xca7e('0x7'))(_0xca7e('0x8'));var config=require(_0xca7e('0x9'));var jayson=require(_0xca7e('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x185e05,_0x1bf79e,_0x3812f0){return new BPromise(function(_0x51d057,_0x52e345){return client['request'](_0x185e05,_0x3812f0)['then'](function(_0x5212da){logger['info'](_0xca7e('0xb'),_0x1bf79e,_0xca7e('0xc'));logger['debug'](_0xca7e('0xd'),_0x1bf79e,_0xca7e('0xc'),JSON['stringify'](_0x5212da));if(_0x5212da['error']){if(_0x5212da['error'][_0xca7e('0xe')]===0x1f4){logger[_0xca7e('0xf')](_0xca7e('0xb'),_0x1bf79e,_0x5212da[_0xca7e('0xf')]['message']);return _0x52e345(_0x5212da['error'][_0xca7e('0x10')]);}logger[_0xca7e('0xf')](_0xca7e('0xb'),_0x1bf79e,_0x5212da[_0xca7e('0xf')][_0xca7e('0x10')]);return _0x51d057(_0x5212da['error'][_0xca7e('0x10')]);}else{logger[_0xca7e('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1bf79e,'request\x20sent');_0x51d057(_0x5212da['result'][_0xca7e('0x10')]);}})[_0xca7e('0x12')](function(_0x5644e8){logger['error'](_0xca7e('0xb'),_0x1bf79e,_0x5644e8);_0x52e345(_0x5644e8);});});} \ No newline at end of file +var _0x78db=['client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x78db,0xaf));var _0xb78d=function(_0x3632fa,_0x30c819){_0x3632fa=_0x3632fa-0x0;var _0x35c4cf=_0x78db[_0x3632fa];return _0x35c4cf;};'use strict';var _=require(_0xb78d('0x0'));var util=require(_0xb78d('0x1'));var moment=require(_0xb78d('0x2'));var BPromise=require(_0xb78d('0x3'));var rs=require(_0xb78d('0x4'));var fs=require('fs');var Redis=require(_0xb78d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb78d('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xb78d('0x7'));var jayson=require(_0xb78d('0x8'));var client=jayson[_0xb78d('0x9')][_0xb78d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58fb0d,_0x1125f9,_0x1da6dd){return new BPromise(function(_0x59b29d,_0x940c81){return client[_0xb78d('0xb')](_0x58fb0d,_0x1da6dd)[_0xb78d('0xc')](function(_0x11b6cd){logger[_0xb78d('0xd')](_0xb78d('0xe'),_0x1125f9,_0xb78d('0xf'));logger['debug'](_0xb78d('0x10'),_0x1125f9,'request\x20sent',JSON[_0xb78d('0x11')](_0x11b6cd));if(_0x11b6cd[_0xb78d('0x12')]){if(_0x11b6cd[_0xb78d('0x12')][_0xb78d('0x13')]===0x1f4){logger[_0xb78d('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1125f9,_0x11b6cd[_0xb78d('0x12')][_0xb78d('0x14')]);return _0x940c81(_0x11b6cd[_0xb78d('0x12')][_0xb78d('0x14')]);}logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x1125f9,_0x11b6cd[_0xb78d('0x12')]['message']);return _0x59b29d(_0x11b6cd[_0xb78d('0x12')][_0xb78d('0x14')]);}else{logger['info'](_0xb78d('0xe'),_0x1125f9,'request\x20sent');_0x59b29d(_0x11b6cd[_0xb78d('0x15')]['message']);}})[_0xb78d('0x16')](function(_0x385127){logger[_0xb78d('0x12')](_0xb78d('0xe'),_0x1125f9,_0x385127);_0x940c81(_0x385127);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 38d7272..73de154 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 _0x402f=['/:id','post','create','put','update','delete','multer','path','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x166352,_0x5168e0){var _0xf5e585=function(_0x1df256){while(--_0x1df256){_0x166352['push'](_0x166352['shift']());}};_0xf5e585(++_0x5168e0);}(_0x402f,0x6f));var _0xf402=function(_0x60746,_0x5d12e1){_0x60746=_0x60746-0x0;var _0x1113e4=_0x402f[_0x60746];return _0x1113e4;};'use strict';var multer=require(_0xf402('0x0'));var util=require('util');var path=require(_0xf402('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf402('0x2')]();var fs_extra=require(_0xf402('0x3'));var auth=require(_0xf402('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf402('0x5'));var controller=require('./intFreshsalesField.controller');router[_0xf402('0x6')]('/',auth[_0xf402('0x7')](),controller[_0xf402('0x8')]);router[_0xf402('0x6')](_0xf402('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xf402('0xa')]('/',auth[_0xf402('0x7')](),controller[_0xf402('0xb')]);router[_0xf402('0xc')](_0xf402('0x9'),auth[_0xf402('0x7')](),controller[_0xf402('0xd')]);router[_0xf402('0xe')]('/:id',auth[_0xf402('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb469=['Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','create','put','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x559854,_0x2056e1){var _0x5bf2b9=function(_0x5ed1a1){while(--_0x5ed1a1){_0x559854['push'](_0x559854['shift']());}};_0x5bf2b9(++_0x2056e1);}(_0xb469,0x13b));var _0x9b46=function(_0x108ac7,_0x4e4d){_0x108ac7=_0x108ac7-0x0;var _0x458059=_0xb469[_0x108ac7];return _0x458059;};'use strict';var multer=require(_0x9b46('0x0'));var util=require(_0x9b46('0x1'));var path=require(_0x9b46('0x2'));var timeout=require(_0x9b46('0x3'));var express=require(_0x9b46('0x4'));var router=express[_0x9b46('0x5')]();var fs_extra=require(_0x9b46('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9b46('0x7'));var config=require(_0x9b46('0x8'));var controller=require('./intFreshsalesField.controller');router[_0x9b46('0x9')]('/',auth[_0x9b46('0xa')](),controller['index']);router[_0x9b46('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x9b46('0xb')]);router['post']('/',auth[_0x9b46('0xa')](),controller[_0x9b46('0xc')]);router[_0x9b46('0xd')]('/:id',auth[_0x9b46('0xa')](),controller['update']);router[_0x9b46('0xe')]('/:id',auth[_0x9b46('0xa')](),controller['destroy']);module[_0x9b46('0xf')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 5d2eb45..ae0a8ce 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 _0xdfe6=['keyValue','picklist','string','STRING','variable','BOOLEAN','ENUM','customVariable'];(function(_0x51ff26,_0x1e3134){var _0x23304f=function(_0x1dd9dd){while(--_0x1dd9dd){_0x51ff26['push'](_0x51ff26['shift']());}};_0x23304f(++_0x1e3134);}(_0xdfe6,0x146));var _0x6dfe=function(_0x590be1,_0x1a3fbc){_0x590be1=_0x590be1-0x0;var _0x269f3f=_0xdfe6[_0x590be1];return _0x269f3f;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x6dfe('0x0')]('string','variable',_0x6dfe('0x1'),_0x6dfe('0x2'),_0x6dfe('0x3')),'defaultValue':_0x6dfe('0x4')},'content':{'type':Sequelize[_0x6dfe('0x5')]},'key':{'type':Sequelize[_0x6dfe('0x5')]},'keyType':{'type':Sequelize[_0x6dfe('0x0')](_0x6dfe('0x4'),_0x6dfe('0x6'),_0x6dfe('0x1'))},'keyContent':{'type':Sequelize[_0x6dfe('0x5')]},'idField':{'type':Sequelize[_0x6dfe('0x5')]},'nameField':{'type':Sequelize[_0x6dfe('0x5')]},'customField':{'type':Sequelize[_0x6dfe('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6dfe('0x5')]}}; \ No newline at end of file +var _0x9bca=['customVariable','keyValue','picklist','string','STRING','variable','sequelize','exports','ENUM'];(function(_0x455580,_0x5cd4dd){var _0x7aabc2=function(_0x10bf94){while(--_0x10bf94){_0x455580['push'](_0x455580['shift']());}};_0x7aabc2(++_0x5cd4dd);}(_0x9bca,0x72));var _0xa9bc=function(_0x42fe35,_0x2493f6){_0x42fe35=_0x42fe35-0x0;var _0x303e83=_0x9bca[_0x42fe35];return _0x303e83;};'use strict';var Sequelize=require(_0xa9bc('0x0'));module[_0xa9bc('0x1')]={'type':{'type':Sequelize[_0xa9bc('0x2')]('string','variable',_0xa9bc('0x3'),_0xa9bc('0x4'),_0xa9bc('0x5')),'defaultValue':_0xa9bc('0x6')},'content':{'type':Sequelize[_0xa9bc('0x7')]},'key':{'type':Sequelize[_0xa9bc('0x7')]},'keyType':{'type':Sequelize[_0xa9bc('0x2')](_0xa9bc('0x6'),_0xa9bc('0x8'),_0xa9bc('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xa9bc('0x7')]},'nameField':{'type':Sequelize[_0xa9bc('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa9bc('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 8c14eb1..2d15706 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 _0x375c=['catch','show','params','length','options','create','body','find','eml-format','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','json','apply','reject','update','destroy','then','sendStatus','error','stack','name','send','index','map','FreshsalesField','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','rows'];(function(_0x23b9ba,_0x453399){var _0x3ac207=function(_0x157b2a){while(--_0x157b2a){_0x23b9ba['push'](_0x23b9ba['shift']());}};_0x3ac207(++_0x453399);}(_0x375c,0xda));var _0xc375=function(_0x1e9c41,_0x2357b2){_0x1e9c41=_0x1e9c41-0x0;var _0xf0bb94=_0x375c[_0x1e9c41];return _0xf0bb94;};'use strict';var emlformat=require(_0xc375('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc375('0x1'));var rp=require('request-promise');var moment=require(_0xc375('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xc375('0x3'));var util=require(_0xc375('0x4'));var path=require(_0xc375('0x5'));var sox=require(_0xc375('0x6'));var csv=require(_0xc375('0x7'));var ejs=require(_0xc375('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc375('0x9'));var crypto=require('crypto');var jsforce=require(_0xc375('0xa'));var deskjs=require(_0xc375('0xb'));var toCsv=require('to-csv');var querystring=require(_0xc375('0xc'));var Papa=require('papaparse');var Redis=require(_0xc375('0xd'));var authService=require(_0xc375('0xe'));var qs=require(_0xc375('0xf'));var as=require(_0xc375('0x10'));var hardwareService=require(_0xc375('0x11'));var logger=require(_0xc375('0x12'))(_0xc375('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc375('0x14'));var db=require(_0xc375('0x15'))['db'];function respondWithStatusCode(_0x4c9bd5,_0xeae210){_0xeae210=_0xeae210||0xcc;return function(_0x51fd3c){if(_0x51fd3c){return _0x4c9bd5['sendStatus'](_0xeae210);}return _0x4c9bd5[_0xc375('0x16')](_0xeae210)[_0xc375('0x17')]();};}function respondWithResult(_0x5e611d,_0x238884){_0x238884=_0x238884||0xc8;return function(_0x17216a){if(_0x17216a){return _0x5e611d[_0xc375('0x16')](_0x238884)['json'](_0x17216a);}};}function respondWithFilteredResult(_0x54b930,_0x155862){return function(_0x40738e){if(_0x40738e){var _0x343216=typeof _0x155862[_0xc375('0x18')]===_0xc375('0x19')&&typeof _0x155862[_0xc375('0x1a')]==='undefined';var _0x584b58=_0x40738e[_0xc375('0x1b')];var _0x562376=_0x343216?0x0:_0x155862[_0xc375('0x18')];var _0x346aad=_0x343216?_0x40738e['count']:_0x155862[_0xc375('0x18')]+_0x155862[_0xc375('0x1a')];var _0x5c63a1;if(_0x346aad>=_0x584b58){_0x346aad=_0x584b58;_0x5c63a1=0xc8;}else{_0x5c63a1=0xce;}_0x54b930[_0xc375('0x16')](_0x5c63a1);return _0x54b930['set']('Content-Range',_0x562376+'-'+_0x346aad+'/'+_0x584b58)[_0xc375('0x1c')](_0x40738e);}return null;};}function patchUpdates(_0x5d222d){return function(_0x949afb){try{jsonpatch[_0xc375('0x1d')](_0x949afb,_0x5d222d,!![]);}catch(_0x3e8bf9){return BPromise[_0xc375('0x1e')](_0x3e8bf9);}return _0x949afb['save']();};}function saveUpdates(_0x2cb957,_0x231cf8){return function(_0x1b8784){if(_0x1b8784){return _0x1b8784[_0xc375('0x1f')](_0x2cb957)['then'](function(_0x44544c){return _0x44544c;});}return null;};}function removeEntity(_0x30cb73,_0x485d3e){return function(_0xff348c){if(_0xff348c){return _0xff348c[_0xc375('0x20')]()[_0xc375('0x21')](function(){_0x30cb73[_0xc375('0x16')](0xcc)[_0xc375('0x17')]();});}};}function handleEntityNotFound(_0x389fc9,_0x293fad){return function(_0x147f90){if(!_0x147f90){_0x389fc9[_0xc375('0x22')](0x194);}return _0x147f90;};}function handleError(_0x1adf0f,_0x9e650a){_0x9e650a=_0x9e650a||0x1f4;return function(_0x423546){logger[_0xc375('0x23')](_0x423546[_0xc375('0x24')]);if(_0x423546['name']){delete _0x423546[_0xc375('0x25')];}_0x1adf0f[_0xc375('0x16')](_0x9e650a)[_0xc375('0x26')](_0x423546);};}exports[_0xc375('0x27')]=function(_0x13c43a,_0x7a0fdb){var _0x224eaa={},_0x2bcd67={},_0x2b98c7={'count':0x0,'rows':[]};var _0x2d85c3=_[_0xc375('0x28')](db[_0xc375('0x29')][_0xc375('0x2a')],function(_0x23c18d){return{'name':_0x23c18d['fieldName'],'type':_0x23c18d[_0xc375('0x2b')][_0xc375('0x2c')]};});_0x2bcd67[_0xc375('0x2d')]=_[_0xc375('0x28')](_0x2d85c3,_0xc375('0x25'));_0x2bcd67[_0xc375('0x2e')]=_[_0xc375('0x2f')](_0x13c43a[_0xc375('0x2e')]);_0x2bcd67['filters']=_['intersection'](_0x2bcd67[_0xc375('0x2d')],_0x2bcd67[_0xc375('0x2e')]);_0x224eaa[_0xc375('0x30')]=_[_0xc375('0x31')](_0x2bcd67[_0xc375('0x2d')],qs[_0xc375('0x32')](_0x13c43a['query'][_0xc375('0x32')]));_0x224eaa[_0xc375('0x30')]=_0x224eaa[_0xc375('0x30')]['length']?_0x224eaa[_0xc375('0x30')]:_0x2bcd67[_0xc375('0x2d')];if(!_0x13c43a['query']['hasOwnProperty'](_0xc375('0x33'))){_0x224eaa[_0xc375('0x1a')]=qs[_0xc375('0x1a')](_0x13c43a[_0xc375('0x2e')]['limit']);_0x224eaa[_0xc375('0x18')]=qs[_0xc375('0x18')](_0x13c43a['query'][_0xc375('0x18')]);}_0x224eaa['order']=qs['sort'](_0x13c43a[_0xc375('0x2e')][_0xc375('0x34')]);_0x224eaa[_0xc375('0x35')]=qs[_0xc375('0x36')](_[_0xc375('0x37')](_0x13c43a[_0xc375('0x2e')],_0x2bcd67['filters']),_0x2d85c3);if(_0x13c43a[_0xc375('0x2e')][_0xc375('0x38')]){_0x224eaa[_0xc375('0x35')]=_[_0xc375('0x39')](_0x224eaa['where'],{'$or':_[_0xc375('0x28')](_0x2d85c3,function(_0x25c3af){if(_0x25c3af[_0xc375('0x2b')]!==_0xc375('0x3a')){var _0x50358b={};_0x50358b[_0x25c3af[_0xc375('0x25')]]={'$like':'%'+_0x13c43a[_0xc375('0x2e')][_0xc375('0x38')]+'%'};return _0x50358b;}})});}_0x224eaa=_[_0xc375('0x39')]({},_0x224eaa,_0x13c43a['options']);var _0x2a4624={'where':_0x224eaa['where']};return db[_0xc375('0x29')][_0xc375('0x1b')](_0x2a4624)[_0xc375('0x21')](function(_0x360e29){_0x2b98c7[_0xc375('0x1b')]=_0x360e29;if(_0x13c43a[_0xc375('0x2e')][_0xc375('0x3b')]){_0x224eaa[_0xc375('0x3c')]=[{'all':!![]}];}return db[_0xc375('0x29')]['findAll'](_0x224eaa);})[_0xc375('0x21')](function(_0x1fdb53){_0x2b98c7[_0xc375('0x3d')]=_0x1fdb53;return _0x2b98c7;})[_0xc375('0x21')](respondWithFilteredResult(_0x7a0fdb,_0x224eaa))[_0xc375('0x3e')](handleError(_0x7a0fdb,null));};exports[_0xc375('0x3f')]=function(_0x19a355,_0x2e91c2){var _0x28d5e6={'raw':!![],'where':{'id':_0x19a355[_0xc375('0x40')]['id']}},_0x4d4f2d={};_0x4d4f2d['model']=_[_0xc375('0x2f')](db[_0xc375('0x29')][_0xc375('0x2a')]);_0x4d4f2d['query']=_[_0xc375('0x2f')](_0x19a355[_0xc375('0x2e')]);_0x4d4f2d[_0xc375('0x36')]=_[_0xc375('0x31')](_0x4d4f2d[_0xc375('0x2d')],_0x4d4f2d[_0xc375('0x2e')]);_0x28d5e6[_0xc375('0x30')]=_['intersection'](_0x4d4f2d[_0xc375('0x2d')],qs[_0xc375('0x32')](_0x19a355[_0xc375('0x2e')]['fields']));_0x28d5e6[_0xc375('0x30')]=_0x28d5e6[_0xc375('0x30')][_0xc375('0x41')]?_0x28d5e6[_0xc375('0x30')]:_0x4d4f2d[_0xc375('0x2d')];if(_0x19a355[_0xc375('0x2e')][_0xc375('0x3b')]){_0x28d5e6[_0xc375('0x3c')]=[{'all':!![]}];}_0x28d5e6=_[_0xc375('0x39')]({},_0x28d5e6,_0x19a355[_0xc375('0x42')]);return db[_0xc375('0x29')]['find'](_0x28d5e6)[_0xc375('0x21')](handleEntityNotFound(_0x2e91c2,null))['then'](respondWithResult(_0x2e91c2,null))[_0xc375('0x3e')](handleError(_0x2e91c2,null));};exports[_0xc375('0x43')]=function(_0x41d2c7,_0x219cdc){return db[_0xc375('0x29')][_0xc375('0x43')](_0x41d2c7[_0xc375('0x44')],{})[_0xc375('0x21')](respondWithResult(_0x219cdc,0xc9))[_0xc375('0x3e')](handleError(_0x219cdc,null));};exports[_0xc375('0x1f')]=function(_0x4a91a9,_0x3c1984){if(_0x4a91a9['body']['id']){delete _0x4a91a9['body']['id'];}return db['FreshsalesField']['find']({'where':{'id':_0x4a91a9[_0xc375('0x40')]['id']}})[_0xc375('0x21')](handleEntityNotFound(_0x3c1984,null))[_0xc375('0x21')](saveUpdates(_0x4a91a9[_0xc375('0x44')],null))[_0xc375('0x21')](respondWithResult(_0x3c1984,null))[_0xc375('0x3e')](handleError(_0x3c1984,null));};exports[_0xc375('0x20')]=function(_0x2830db,_0x163e78){return db[_0xc375('0x29')][_0xc375('0x45')]({'where':{'id':_0x2830db[_0xc375('0x40')]['id']}})['then'](handleEntityNotFound(_0x163e78,null))['then'](removeEntity(_0x163e78,null))['catch'](handleError(_0x163e78,null));}; \ No newline at end of file +var _0x80a4=['length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','include','findAll','show','params','rawAttributes','includeAll','options','create','catch','body','find','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','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/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','set','update','then','destroy','error','name','send','map','FreshsalesField','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x2ddd5d,_0x35f964){var _0x24af97=function(_0x333e20){while(--_0x333e20){_0x2ddd5d['push'](_0x2ddd5d['shift']());}};_0x24af97(++_0x35f964);}(_0x80a4,0x177));var _0x480a=function(_0x451402,_0x561cb8){_0x451402=_0x451402-0x0;var _0x4ffb7f=_0x80a4[_0x451402];return _0x4ffb7f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x480a('0x0'));var zipdir=require(_0x480a('0x1'));var jsonpatch=require(_0x480a('0x2'));var rp=require(_0x480a('0x3'));var moment=require('moment');var BPromise=require(_0x480a('0x4'));var Mustache=require(_0x480a('0x5'));var util=require(_0x480a('0x6'));var path=require(_0x480a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x480a('0x8'));var fs=require('fs');var fs_extra=require(_0x480a('0x9'));var _=require(_0x480a('0xa'));var squel=require(_0x480a('0xb'));var crypto=require(_0x480a('0xc'));var jsforce=require(_0x480a('0xd'));var deskjs=require(_0x480a('0xe'));var toCsv=require('to-csv');var querystring=require(_0x480a('0xf'));var Papa=require(_0x480a('0x10'));var Redis=require(_0x480a('0x11'));var authService=require(_0x480a('0x12'));var qs=require(_0x480a('0x13'));var as=require(_0x480a('0x14'));var hardwareService=require(_0x480a('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x480a('0x16'));var config=require(_0x480a('0x17'));var licenseUtil=require(_0x480a('0x18'));var db=require(_0x480a('0x19'))['db'];function respondWithStatusCode(_0x2ba6f1,_0xc9f82a){_0xc9f82a=_0xc9f82a||0xcc;return function(_0x3dc609){if(_0x3dc609){return _0x2ba6f1['sendStatus'](_0xc9f82a);}return _0x2ba6f1[_0x480a('0x1a')](_0xc9f82a)[_0x480a('0x1b')]();};}function respondWithResult(_0x53b6d8,_0x29b518){_0x29b518=_0x29b518||0xc8;return function(_0x597645){if(_0x597645){return _0x53b6d8[_0x480a('0x1a')](_0x29b518)[_0x480a('0x1c')](_0x597645);}};}function respondWithFilteredResult(_0x107940,_0x43fa52){return function(_0x2cebb7){if(_0x2cebb7){var _0x4cf169=typeof _0x43fa52['offset']==='undefined'&&typeof _0x43fa52['limit']===_0x480a('0x1d');var _0x14723c=_0x2cebb7[_0x480a('0x1e')];var _0x13a7d6=_0x4cf169?0x0:_0x43fa52[_0x480a('0x1f')];var _0x30cae5=_0x4cf169?_0x2cebb7[_0x480a('0x1e')]:_0x43fa52[_0x480a('0x1f')]+_0x43fa52['limit'];var _0x34ba20;if(_0x30cae5>=_0x14723c){_0x30cae5=_0x14723c;_0x34ba20=0xc8;}else{_0x34ba20=0xce;}_0x107940[_0x480a('0x1a')](_0x34ba20);return _0x107940[_0x480a('0x20')]('Content-Range',_0x13a7d6+'-'+_0x30cae5+'/'+_0x14723c)[_0x480a('0x1c')](_0x2cebb7);}return null;};}function patchUpdates(_0x59a63e){return function(_0x50b7f2){try{jsonpatch['apply'](_0x50b7f2,_0x59a63e,!![]);}catch(_0x5670df){return BPromise['reject'](_0x5670df);}return _0x50b7f2['save']();};}function saveUpdates(_0x10edf3,_0x4fde04){return function(_0x46df4f){if(_0x46df4f){return _0x46df4f[_0x480a('0x21')](_0x10edf3)[_0x480a('0x22')](function(_0x4d4256){return _0x4d4256;});}return null;};}function removeEntity(_0xa383ef,_0x2598de){return function(_0x315c3c){if(_0x315c3c){return _0x315c3c[_0x480a('0x23')]()[_0x480a('0x22')](function(){_0xa383ef['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x53e395,_0x17d3b4){return function(_0x4f169b){if(!_0x4f169b){_0x53e395['sendStatus'](0x194);}return _0x4f169b;};}function handleError(_0x3fab95,_0x512737){_0x512737=_0x512737||0x1f4;return function(_0x5327a2){logger[_0x480a('0x24')](_0x5327a2['stack']);if(_0x5327a2[_0x480a('0x25')]){delete _0x5327a2['name'];}_0x3fab95[_0x480a('0x1a')](_0x512737)[_0x480a('0x26')](_0x5327a2);};}exports['index']=function(_0x1cfcbe,_0x2ffca8){var _0x5d5b90={},_0x2524b7={},_0x4501a8={'count':0x0,'rows':[]};var _0x3f9c96=_[_0x480a('0x27')](db[_0x480a('0x28')]['rawAttributes'],function(_0xdb17e7){return{'name':_0xdb17e7[_0x480a('0x29')],'type':_0xdb17e7[_0x480a('0x2a')][_0x480a('0x2b')]};});_0x2524b7[_0x480a('0x2c')]=_[_0x480a('0x27')](_0x3f9c96,'name');_0x2524b7[_0x480a('0x2d')]=_[_0x480a('0x2e')](_0x1cfcbe['query']);_0x2524b7[_0x480a('0x2f')]=_[_0x480a('0x30')](_0x2524b7[_0x480a('0x2c')],_0x2524b7[_0x480a('0x2d')]);_0x5d5b90[_0x480a('0x31')]=_['intersection'](_0x2524b7[_0x480a('0x2c')],qs[_0x480a('0x32')](_0x1cfcbe[_0x480a('0x2d')][_0x480a('0x32')]));_0x5d5b90[_0x480a('0x31')]=_0x5d5b90[_0x480a('0x31')][_0x480a('0x33')]?_0x5d5b90['attributes']:_0x2524b7[_0x480a('0x2c')];if(!_0x1cfcbe[_0x480a('0x2d')][_0x480a('0x34')](_0x480a('0x35'))){_0x5d5b90[_0x480a('0x36')]=qs[_0x480a('0x36')](_0x1cfcbe[_0x480a('0x2d')][_0x480a('0x36')]);_0x5d5b90[_0x480a('0x1f')]=qs[_0x480a('0x1f')](_0x1cfcbe[_0x480a('0x2d')][_0x480a('0x1f')]);}_0x5d5b90['order']=qs['sort'](_0x1cfcbe['query'][_0x480a('0x37')]);_0x5d5b90[_0x480a('0x38')]=qs[_0x480a('0x2f')](_['pick'](_0x1cfcbe[_0x480a('0x2d')],_0x2524b7[_0x480a('0x2f')]),_0x3f9c96);if(_0x1cfcbe[_0x480a('0x2d')][_0x480a('0x39')]){_0x5d5b90[_0x480a('0x38')]=_[_0x480a('0x3a')](_0x5d5b90[_0x480a('0x38')],{'$or':_['map'](_0x3f9c96,function(_0x26304c){if(_0x26304c[_0x480a('0x2a')]!==_0x480a('0x3b')){var _0x5acc91={};_0x5acc91[_0x26304c[_0x480a('0x25')]]={'$like':'%'+_0x1cfcbe[_0x480a('0x2d')][_0x480a('0x39')]+'%'};return _0x5acc91;}})});}_0x5d5b90=_[_0x480a('0x3a')]({},_0x5d5b90,_0x1cfcbe['options']);var _0x54a9f3={'where':_0x5d5b90[_0x480a('0x38')]};return db[_0x480a('0x28')][_0x480a('0x1e')](_0x54a9f3)[_0x480a('0x22')](function(_0x2fa5f4){_0x4501a8[_0x480a('0x1e')]=_0x2fa5f4;if(_0x1cfcbe[_0x480a('0x2d')]['includeAll']){_0x5d5b90[_0x480a('0x3c')]=[{'all':!![]}];}return db[_0x480a('0x28')][_0x480a('0x3d')](_0x5d5b90);})['then'](function(_0x19c59b){_0x4501a8['rows']=_0x19c59b;return _0x4501a8;})[_0x480a('0x22')](respondWithFilteredResult(_0x2ffca8,_0x5d5b90))['catch'](handleError(_0x2ffca8,null));};exports[_0x480a('0x3e')]=function(_0x892c37,_0x869e6a){var _0x15854f={'raw':!![],'where':{'id':_0x892c37[_0x480a('0x3f')]['id']}},_0x5ed97c={};_0x5ed97c['model']=_['keys'](db['FreshsalesField'][_0x480a('0x40')]);_0x5ed97c[_0x480a('0x2d')]=_[_0x480a('0x2e')](_0x892c37['query']);_0x5ed97c[_0x480a('0x2f')]=_[_0x480a('0x30')](_0x5ed97c[_0x480a('0x2c')],_0x5ed97c[_0x480a('0x2d')]);_0x15854f[_0x480a('0x31')]=_[_0x480a('0x30')](_0x5ed97c[_0x480a('0x2c')],qs[_0x480a('0x32')](_0x892c37[_0x480a('0x2d')]['fields']));_0x15854f[_0x480a('0x31')]=_0x15854f['attributes'][_0x480a('0x33')]?_0x15854f[_0x480a('0x31')]:_0x5ed97c[_0x480a('0x2c')];if(_0x892c37['query'][_0x480a('0x41')]){_0x15854f[_0x480a('0x3c')]=[{'all':!![]}];}_0x15854f=_[_0x480a('0x3a')]({},_0x15854f,_0x892c37[_0x480a('0x42')]);return db[_0x480a('0x28')]['find'](_0x15854f)['then'](handleEntityNotFound(_0x869e6a,null))[_0x480a('0x22')](respondWithResult(_0x869e6a,null))['catch'](handleError(_0x869e6a,null));};exports[_0x480a('0x43')]=function(_0x22c710,_0x20fd6d){return db['FreshsalesField'][_0x480a('0x43')](_0x22c710['body'],{})['then'](respondWithResult(_0x20fd6d,0xc9))[_0x480a('0x44')](handleError(_0x20fd6d,null));};exports[_0x480a('0x21')]=function(_0x21e9ce,_0x2efb0a){if(_0x21e9ce[_0x480a('0x45')]['id']){delete _0x21e9ce[_0x480a('0x45')]['id'];}return db[_0x480a('0x28')][_0x480a('0x46')]({'where':{'id':_0x21e9ce['params']['id']}})['then'](handleEntityNotFound(_0x2efb0a,null))[_0x480a('0x22')](saveUpdates(_0x21e9ce[_0x480a('0x45')],null))['then'](respondWithResult(_0x2efb0a,null))[_0x480a('0x44')](handleError(_0x2efb0a,null));};exports['destroy']=function(_0xe3567d,_0x30e374){return db['FreshsalesField'][_0x480a('0x46')]({'where':{'id':_0xe3567d[_0x480a('0x3f')]['id']}})['then'](handleEntityNotFound(_0x30e374,null))[_0x480a('0x22')](removeEntity(_0x30e374,null))[_0x480a('0x44')](handleError(_0x30e374,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 269cadf..b0eae9f 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 _0xde46=['request-promise','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','int_freshsales_fields','freshsales_unique_index','FieldId','lodash','util','../../config/logger','api'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0xde46,0x14e));var _0x6de4=function(_0x21eaf4,_0x55a046){_0x21eaf4=_0x21eaf4-0x0;var _0x1ad94d=_0xde46[_0x21eaf4];return _0x1ad94d;};'use strict';var _=require(_0x6de4('0x0'));var util=require(_0x6de4('0x1'));var logger=require(_0x6de4('0x2'))(_0x6de4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6de4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6de4('0x5'));var config=require(_0x6de4('0x6'));var attributes=require(_0x6de4('0x7'));module[_0x6de4('0x8')]=function(_0x525dcc,_0x47eb32){return _0x525dcc[_0x6de4('0x9')]('FreshsalesField',attributes,{'tableName':_0x6de4('0xa'),'paranoid':![],'indexes':[{'name':_0x6de4('0xb'),'fields':['idField',_0x6de4('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd1d3=['define','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./intFreshsalesField.attributes','exports'];(function(_0x451812,_0x1b5ad0){var _0x2c530c=function(_0x5e00b5){while(--_0x5e00b5){_0x451812['push'](_0x451812['shift']());}};_0x2c530c(++_0x1b5ad0);}(_0xd1d3,0xd7));var _0x3d1d=function(_0x202ad6,_0x780e10){_0x202ad6=_0x202ad6-0x0;var _0x462eef=_0xd1d3[_0x202ad6];return _0x462eef;};'use strict';var _=require(_0x3d1d('0x0'));var util=require('util');var logger=require(_0x3d1d('0x1'))('api');var moment=require(_0x3d1d('0x2'));var BPromise=require(_0x3d1d('0x3'));var rp=require(_0x3d1d('0x4'));var fs=require('fs');var path=require(_0x3d1d('0x5'));var rimraf=require(_0x3d1d('0x6'));var config=require('../../config/environment');var attributes=require(_0x3d1d('0x7'));module[_0x3d1d('0x8')]=function(_0x55c165,_0x2d3a52){return _0x55c165[_0x3d1d('0x9')]('FreshsalesField',attributes,{'tableName':_0x3d1d('0xa'),'paranoid':![],'indexes':[{'name':_0x3d1d('0xb'),'fields':[_0x3d1d('0xc'),_0x3d1d('0xd')],'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 b81962b..938c4ca 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 _0xbd51=['FreshsalesField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xbd51,0x1a8));var _0x1bd5=function(_0xd470ca,_0x537863){_0xd470ca=_0xd470ca-0x0;var _0xbe1376=_0xbd51[_0xd470ca];return _0xbe1376;};'use strict';var _=require(_0x1bd5('0x0'));var util=require('util');var moment=require(_0x1bd5('0x1'));var BPromise=require(_0x1bd5('0x2'));var rs=require(_0x1bd5('0x3'));var fs=require('fs');var Redis=require(_0x1bd5('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x1bd5('0x5'));var jayson=require(_0x1bd5('0x6'));var client=jayson[_0x1bd5('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29abea,_0x30a385,_0x19077c){return new BPromise(function(_0x27d58f,_0xd8418f){return client['request'](_0x29abea,_0x19077c)[_0x1bd5('0x8')](function(_0x5c8e0d){logger[_0x1bd5('0x9')](_0x1bd5('0xa'),_0x30a385,_0x1bd5('0xb'));logger[_0x1bd5('0xc')](_0x1bd5('0xd'),_0x30a385,_0x1bd5('0xb'),JSON['stringify'](_0x5c8e0d));if(_0x5c8e0d[_0x1bd5('0xe')]){if(_0x5c8e0d['error'][_0x1bd5('0xf')]===0x1f4){logger[_0x1bd5('0xe')](_0x1bd5('0xa'),_0x30a385,_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);return _0xd8418f(_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);}logger['error']('FreshsalesField,\x20%s,\x20%s',_0x30a385,_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);return _0x27d58f(_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0x30a385,_0x1bd5('0xb'));_0x27d58f(_0x5c8e0d[_0x1bd5('0x11')][_0x1bd5('0x10')]);}})[_0x1bd5('0x12')](function(_0x43ea3e){logger[_0x1bd5('0xe')](_0x1bd5('0xa'),_0x30a385,_0x43ea3e);_0xd8418f(_0x43ea3e);});});} \ No newline at end of file +var _0xafc4=['error','code','message','request\x20sent','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x33dfcb,_0x268c02){var _0x2c6da2=function(_0x4c211d){while(--_0x4c211d){_0x33dfcb['push'](_0x33dfcb['shift']());}};_0x2c6da2(++_0x268c02);}(_0xafc4,0x69));var _0x4afc=function(_0x65bed5,_0xb6bf6a){_0x65bed5=_0x65bed5-0x0;var _0x3fb9d0=_0xafc4[_0x65bed5];return _0x3fb9d0;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var moment=require(_0x4afc('0x1'));var BPromise=require('bluebird');var rs=require(_0x4afc('0x2'));var fs=require('fs');var Redis=require(_0x4afc('0x3'));var db=require(_0x4afc('0x4'))['db'];var utils=require(_0x4afc('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4afc('0x6'));var client=jayson[_0x4afc('0x7')][_0x4afc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1bb281,_0xc828d9,_0xaf053d){return new BPromise(function(_0x5e1e29,_0x31e165){return client[_0x4afc('0x9')](_0x1bb281,_0xaf053d)[_0x4afc('0xa')](function(_0x1e6bf5){logger[_0x4afc('0xb')](_0x4afc('0xc'),_0xc828d9,'request\x20sent');logger['debug'](_0x4afc('0xd'),_0xc828d9,'request\x20sent',JSON[_0x4afc('0xe')](_0x1e6bf5));if(_0x1e6bf5[_0x4afc('0xf')]){if(_0x1e6bf5['error'][_0x4afc('0x10')]===0x1f4){logger[_0x4afc('0xf')](_0x4afc('0xc'),_0xc828d9,_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);return _0x31e165(_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);}logger[_0x4afc('0xf')]('FreshsalesField,\x20%s,\x20%s',_0xc828d9,_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);return _0x5e1e29(_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0xc828d9,_0x4afc('0x12'));_0x5e1e29(_0x1e6bf5['result'][_0x4afc('0x11')]);}})[_0x4afc('0x13')](function(_0x2b928b){logger[_0x4afc('0xf')](_0x4afc('0xc'),_0xc828d9,_0x2b928b);_0x31e165(_0x2b928b);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index a0d2f4d..84ad3ee 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(_0x2fa0c6,_0x45fbeb){var _0x36ffb0=function(_0x3e82f1){while(--_0x3e82f1){_0x2fa0c6['push'](_0x2fa0c6['shift']());}};_0x36ffb0(++_0x45fbeb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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 _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(_0x27084a,_0x305325){var _0x52a8c2=function(_0x464bef){while(--_0x464bef){_0x27084a['push'](_0x27084a['shift']());}};_0x52a8c2(++_0x305325);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index fd57c59..86da82c 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 _0x0c2b=['STRING','username','ENUM','newTab','integrationTab','sequelize','exports'];(function(_0x58a18a,_0x1d948a){var _0x504330=function(_0x2be3d2){while(--_0x2be3d2){_0x58a18a['push'](_0x58a18a['shift']());}};_0x504330(++_0x1d948a);}(_0x0c2b,0x194));var _0xb0c2=function(_0x1fa1f0,_0x2d3bcf){_0x1fa1f0=_0x1fa1f0-0x0;var _0x4c9d80=_0x0c2b[_0x1fa1f0];return _0x4c9d80;};'use strict';var Sequelize=require(_0xb0c2('0x0'));module[_0xb0c2('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb0c2('0x2')]},'username':{'type':Sequelize[_0xb0c2('0x2')],'unique':_0xb0c2('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xb0c2('0x2')]},'clientSecret':{'type':Sequelize[_0xb0c2('0x2')]},'securityToken':{'type':Sequelize[_0xb0c2('0x2')]},'serverUrl':{'type':Sequelize[_0xb0c2('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xb0c2('0x4')]('integrationTab',_0xb0c2('0x5')),'defaultValue':_0xb0c2('0x6')}}; \ No newline at end of file +var _0x8163=['exports','STRING','integrationTab','sequelize'];(function(_0x5d61e8,_0x3ac08f){var _0x144c95=function(_0x424f1c){while(--_0x424f1c){_0x5d61e8['push'](_0x5d61e8['shift']());}};_0x144c95(++_0x3ac08f);}(_0x8163,0x11b));var _0x3816=function(_0x524244,_0x43dd56){_0x524244=_0x524244-0x0;var _0x5cfe13=_0x8163[_0x524244];return _0x5cfe13;};'use strict';var Sequelize=require(_0x3816('0x0'));module[_0x3816('0x1')]={'name':{'type':Sequelize[_0x3816('0x2')]},'description':{'type':Sequelize[_0x3816('0x2')]},'username':{'type':Sequelize[_0x3816('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x3816('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x3816('0x2')]},'securityToken':{'type':Sequelize[_0x3816('0x2')]},'serverUrl':{'type':Sequelize[_0x3816('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x3816('0x3'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index b4a426d..45470eb 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 _0xbea5=['length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','where','includeAll','include','rows','catch','show','params','find','create','body','getConfigurations','findOne','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceConfiguration','getFields','Task','securityToken','remoteUri','lastIndexOf','Connection','clientId','clientSecret','login','username','password','concat','isNil','ticketType','sobject','describe','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','email','textarea','phone','remove','includes','custom','picklistValues','label','value','boolean','true','False','false','test','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','error','stack','name','send','index','SalesforceAccount','rawAttributes','fieldName','type','key','model','map','keys','query','filters','attributes','intersection','fields'];(function(_0x19903c,_0x5192e4){var _0x222a6c=function(_0x2121ae){while(--_0x2121ae){_0x19903c['push'](_0x19903c['shift']());}};_0x222a6c(++_0x5192e4);}(_0xbea5,0x13c));var _0x5bea=function(_0x26f1b2,_0x33d843){_0x26f1b2=_0x26f1b2-0x0;var _0x1624a4=_0xbea5[_0x26f1b2];return _0x1624a4;};'use strict';var emlformat=require(_0x5bea('0x0'));var rimraf=require(_0x5bea('0x1'));var zipdir=require(_0x5bea('0x2'));var jsonpatch=require(_0x5bea('0x3'));var rp=require(_0x5bea('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5bea('0x5'));var path=require(_0x5bea('0x6'));var sox=require(_0x5bea('0x7'));var csv=require(_0x5bea('0x8'));var ejs=require(_0x5bea('0x9'));var fs=require('fs');var fs_extra=require(_0x5bea('0xa'));var _=require(_0x5bea('0xb'));var squel=require(_0x5bea('0xc'));var crypto=require(_0x5bea('0xd'));var jsforce=require(_0x5bea('0xe'));var deskjs=require(_0x5bea('0xf'));var toCsv=require(_0x5bea('0x8'));var querystring=require('querystring');var Papa=require(_0x5bea('0x10'));var Redis=require(_0x5bea('0x11'));var authService=require(_0x5bea('0x12'));var qs=require(_0x5bea('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5bea('0x14'));var logger=require('../../config/logger')(_0x5bea('0x15'));var utils=require(_0x5bea('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5bea('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3bbec9,_0x33822d){_0x33822d=_0x33822d||0xcc;return function(_0x5f1367){if(_0x5f1367){return _0x3bbec9[_0x5bea('0x18')](_0x33822d);}return _0x3bbec9['status'](_0x33822d)[_0x5bea('0x19')]();};}function respondWithResult(_0x3efedc,_0x455295){_0x455295=_0x455295||0xc8;return function(_0x3d0ed0){if(_0x3d0ed0){return _0x3efedc[_0x5bea('0x1a')](_0x455295)[_0x5bea('0x1b')](_0x3d0ed0);}};}function respondWithFilteredResult(_0x43279e,_0x31820a){return function(_0x5ab9b2){if(_0x5ab9b2){var _0x2cdecc=typeof _0x31820a[_0x5bea('0x1c')]===_0x5bea('0x1d')&&typeof _0x31820a[_0x5bea('0x1e')]===_0x5bea('0x1d');var _0xe17113=_0x5ab9b2[_0x5bea('0x1f')];var _0x151024=_0x2cdecc?0x0:_0x31820a[_0x5bea('0x1c')];var _0x21dae2=_0x2cdecc?_0x5ab9b2[_0x5bea('0x1f')]:_0x31820a['offset']+_0x31820a[_0x5bea('0x1e')];var _0x49cc10;if(_0x21dae2>=_0xe17113){_0x21dae2=_0xe17113;_0x49cc10=0xc8;}else{_0x49cc10=0xce;}_0x43279e['status'](_0x49cc10);return _0x43279e['set']('Content-Range',_0x151024+'-'+_0x21dae2+'/'+_0xe17113)['json'](_0x5ab9b2);}return null;};}function patchUpdates(_0x452d5c){return function(_0x4a6d18){try{jsonpatch[_0x5bea('0x20')](_0x4a6d18,_0x452d5c,!![]);}catch(_0x1de2a3){return BPromise[_0x5bea('0x21')](_0x1de2a3);}return _0x4a6d18[_0x5bea('0x22')]();};}function saveUpdates(_0x5c7629,_0x27410c){return function(_0x5e6eeb){if(_0x5e6eeb){return _0x5e6eeb[_0x5bea('0x23')](_0x5c7629)[_0x5bea('0x24')](function(_0x2889da){return _0x2889da;});}return null;};}function removeEntity(_0x4a7b1f,_0x453213){return function(_0x5c9ff6){if(_0x5c9ff6){return _0x5c9ff6[_0x5bea('0x25')]()[_0x5bea('0x24')](function(){_0x4a7b1f[_0x5bea('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a4fee,_0x522575){return function(_0x72aa91){if(!_0x72aa91){_0x4a4fee[_0x5bea('0x18')](0x194);}return _0x72aa91;};}function handleError(_0x4f9b98,_0x4d8995){_0x4d8995=_0x4d8995||0x1f4;return function(_0x5500ba){logger[_0x5bea('0x26')](_0x5500ba[_0x5bea('0x27')]);if(_0x5500ba['name']){delete _0x5500ba[_0x5bea('0x28')];}_0x4f9b98[_0x5bea('0x1a')](_0x4d8995)[_0x5bea('0x29')](_0x5500ba);};}exports[_0x5bea('0x2a')]=function(_0x11d2ee,_0x39a9ae){var _0x4bc790={},_0x52f805={},_0x16d085={'count':0x0,'rows':[]};var _0x933eb8=_['map'](db[_0x5bea('0x2b')][_0x5bea('0x2c')],function(_0x48a28e){return{'name':_0x48a28e[_0x5bea('0x2d')],'type':_0x48a28e[_0x5bea('0x2e')][_0x5bea('0x2f')]};});_0x52f805[_0x5bea('0x30')]=_[_0x5bea('0x31')](_0x933eb8,_0x5bea('0x28'));_0x52f805['query']=_[_0x5bea('0x32')](_0x11d2ee[_0x5bea('0x33')]);_0x52f805[_0x5bea('0x34')]=_['intersection'](_0x52f805[_0x5bea('0x30')],_0x52f805[_0x5bea('0x33')]);_0x4bc790[_0x5bea('0x35')]=_[_0x5bea('0x36')](_0x52f805['model'],qs[_0x5bea('0x37')](_0x11d2ee[_0x5bea('0x33')]['fields']));_0x4bc790[_0x5bea('0x35')]=_0x4bc790[_0x5bea('0x35')][_0x5bea('0x38')]?_0x4bc790[_0x5bea('0x35')]:_0x52f805[_0x5bea('0x30')];if(!_0x11d2ee[_0x5bea('0x33')][_0x5bea('0x39')](_0x5bea('0x3a'))){_0x4bc790[_0x5bea('0x1e')]=qs[_0x5bea('0x1e')](_0x11d2ee[_0x5bea('0x33')][_0x5bea('0x1e')]);_0x4bc790[_0x5bea('0x1c')]=qs['offset'](_0x11d2ee[_0x5bea('0x33')]['offset']);}_0x4bc790[_0x5bea('0x3b')]=qs[_0x5bea('0x3c')](_0x11d2ee[_0x5bea('0x33')][_0x5bea('0x3c')]);_0x4bc790['where']=qs[_0x5bea('0x34')](_[_0x5bea('0x3d')](_0x11d2ee['query'],_0x52f805[_0x5bea('0x34')]),_0x933eb8);if(_0x11d2ee[_0x5bea('0x33')][_0x5bea('0x3e')]){_0x4bc790['where']=_[_0x5bea('0x3f')](_0x4bc790['where'],{'$or':_[_0x5bea('0x31')](_0x933eb8,function(_0x40b01d){if(_0x40b01d['type']!==_0x5bea('0x40')){var _0x2be5bc={};_0x2be5bc[_0x40b01d[_0x5bea('0x28')]]={'$like':'%'+_0x11d2ee[_0x5bea('0x33')][_0x5bea('0x3e')]+'%'};return _0x2be5bc;}})});}_0x4bc790=_['merge']({},_0x4bc790,_0x11d2ee[_0x5bea('0x41')]);var _0x2d3070={'where':_0x4bc790[_0x5bea('0x42')]};return db[_0x5bea('0x2b')][_0x5bea('0x1f')](_0x2d3070)[_0x5bea('0x24')](function(_0x55bafe){_0x16d085['count']=_0x55bafe;if(_0x11d2ee[_0x5bea('0x33')][_0x5bea('0x43')]){_0x4bc790[_0x5bea('0x44')]=[{'all':!![]}];}return db[_0x5bea('0x2b')]['findAll'](_0x4bc790);})[_0x5bea('0x24')](function(_0x190f87){_0x16d085[_0x5bea('0x45')]=_0x190f87;return _0x16d085;})[_0x5bea('0x24')](respondWithFilteredResult(_0x39a9ae,_0x4bc790))[_0x5bea('0x46')](handleError(_0x39a9ae,null));};exports[_0x5bea('0x47')]=function(_0x1b5392,_0x2af8ec){var _0x586b25={'raw':![],'where':{'id':_0x1b5392[_0x5bea('0x48')]['id']}},_0x529501={};_0x529501[_0x5bea('0x30')]=_[_0x5bea('0x32')](db[_0x5bea('0x2b')]['rawAttributes']);_0x529501[_0x5bea('0x33')]=_[_0x5bea('0x32')](_0x1b5392[_0x5bea('0x33')]);_0x529501[_0x5bea('0x34')]=_[_0x5bea('0x36')](_0x529501[_0x5bea('0x30')],_0x529501[_0x5bea('0x33')]);_0x586b25[_0x5bea('0x35')]=_['intersection'](_0x529501[_0x5bea('0x30')],qs['fields'](_0x1b5392[_0x5bea('0x33')][_0x5bea('0x37')]));_0x586b25[_0x5bea('0x35')]=_0x586b25[_0x5bea('0x35')]['length']?_0x586b25[_0x5bea('0x35')]:_0x529501[_0x5bea('0x30')];if(_0x1b5392['query'][_0x5bea('0x43')]){_0x586b25['include']=[{'all':!![]}];}_0x586b25=_['merge']({},_0x586b25,_0x1b5392[_0x5bea('0x41')]);return db[_0x5bea('0x2b')][_0x5bea('0x49')](_0x586b25)[_0x5bea('0x24')](handleEntityNotFound(_0x2af8ec,null))[_0x5bea('0x24')](respondWithResult(_0x2af8ec,null))[_0x5bea('0x46')](handleError(_0x2af8ec,null));};exports[_0x5bea('0x4a')]=function(_0x447a5d,_0x506a70){return db['SalesforceAccount'][_0x5bea('0x4a')](_0x447a5d[_0x5bea('0x4b')],{})['then'](respondWithResult(_0x506a70,0xc9))['catch'](handleError(_0x506a70,null));};exports[_0x5bea('0x23')]=function(_0x73fccd,_0x62c74c){if(_0x73fccd[_0x5bea('0x4b')]['id']){delete _0x73fccd['body']['id'];}return db['SalesforceAccount'][_0x5bea('0x49')]({'where':{'id':_0x73fccd[_0x5bea('0x48')]['id']}})[_0x5bea('0x24')](handleEntityNotFound(_0x62c74c,null))[_0x5bea('0x24')](saveUpdates(_0x73fccd[_0x5bea('0x4b')],null))['then'](respondWithResult(_0x62c74c,null))[_0x5bea('0x46')](handleError(_0x62c74c,null));};exports[_0x5bea('0x25')]=function(_0x27746b,_0x9747ce){return db['SalesforceAccount']['find']({'where':{'id':_0x27746b[_0x5bea('0x48')]['id']}})[_0x5bea('0x24')](handleEntityNotFound(_0x9747ce,null))[_0x5bea('0x24')](removeEntity(_0x9747ce,null))[_0x5bea('0x46')](handleError(_0x9747ce,null));};exports[_0x5bea('0x4c')]=function(_0x1d7770,_0x4a2a17,_0x9047e0){var _0x5a660f={};var _0x36f4da={};var _0x26c866;var _0x3cec1d;return db[_0x5bea('0x2b')][_0x5bea('0x4d')]({'where':{'id':_0x1d7770[_0x5bea('0x48')]['id']}})[_0x5bea('0x24')](handleEntityNotFound(_0x4a2a17,null))[_0x5bea('0x24')](function(_0xd6494b){if(_0xd6494b){_0x26c866=_0xd6494b;_0x36f4da[_0x5bea('0x30')]=_['keys'](db['SalesforceConfiguration'][_0x5bea('0x2c')]);_0x36f4da[_0x5bea('0x33')]=_['keys'](_0x1d7770[_0x5bea('0x33')]);_0x36f4da['filters']=_[_0x5bea('0x36')](_0x36f4da[_0x5bea('0x30')],_0x36f4da[_0x5bea('0x33')]);_0x5a660f[_0x5bea('0x35')]=_[_0x5bea('0x36')](_0x36f4da[_0x5bea('0x30')],qs[_0x5bea('0x37')](_0x1d7770[_0x5bea('0x33')][_0x5bea('0x37')]));_0x5a660f[_0x5bea('0x35')]=_0x5a660f[_0x5bea('0x35')]['length']?_0x5a660f[_0x5bea('0x35')]:_0x36f4da[_0x5bea('0x30')];_0x5a660f[_0x5bea('0x3b')]=qs[_0x5bea('0x3c')](_0x1d7770[_0x5bea('0x33')][_0x5bea('0x3c')]);_0x5a660f[_0x5bea('0x42')]=qs[_0x5bea('0x34')](_['pick'](_0x1d7770[_0x5bea('0x33')],_0x36f4da[_0x5bea('0x34')]));if(_0x1d7770[_0x5bea('0x33')][_0x5bea('0x3e')]){_0x5a660f['where']=_[_0x5bea('0x3f')](_0x5a660f['where'],{'$or':_['map'](_0x5a660f[_0x5bea('0x35')],function(_0x23e603){var _0x47c349={};_0x47c349[_0x23e603]={'$like':'%'+_0x1d7770['query']['filter']+'%'};return _0x47c349;})});}_0x5a660f=_[_0x5bea('0x3f')]({},_0x5a660f,_0x1d7770[_0x5bea('0x41')]);return _0x26c866[_0x5bea('0x4c')](_0x5a660f);}})['then'](function(_0x7f4c12){if(_0x7f4c12){_0x3cec1d=_0x7f4c12[_0x5bea('0x38')];if(!_0x1d7770[_0x5bea('0x33')][_0x5bea('0x39')](_0x5bea('0x3a'))){_0x5a660f[_0x5bea('0x1e')]=qs['limit'](_0x1d7770[_0x5bea('0x33')][_0x5bea('0x1e')]);_0x5a660f[_0x5bea('0x1c')]=qs[_0x5bea('0x1c')](_0x1d7770['query']['offset']);}return _0x26c866[_0x5bea('0x4c')](_0x5a660f);}})[_0x5bea('0x24')](function(_0xbd2ddc){if(_0xbd2ddc){return _0xbd2ddc?{'count':_0x3cec1d,'rows':_0xbd2ddc}:null;}})['then'](respondWithResult(_0x4a2a17,null))[_0x5bea('0x46')](handleError(_0x4a2a17,null));};exports[_0x5bea('0x4e')]=function(_0x16e10c,_0x3f35c1,_0x15e220){if(_0x16e10c[_0x5bea('0x4b')]['id']){delete _0x16e10c[_0x5bea('0x4b')]['id'];}return db[_0x5bea('0x2b')]['findOne']({'where':{'id':_0x16e10c[_0x5bea('0x48')]['id']}})[_0x5bea('0x24')](handleEntityNotFound(_0x3f35c1,null))[_0x5bea('0x24')](function(_0x52b1c0){if(_0x52b1c0){_0x16e10c[_0x5bea('0x4b')]['AccountId']=_0x52b1c0['id'];_0x16e10c[_0x5bea('0x4b')][_0x5bea('0x4f')]=integrations[_0x5bea('0x50')](_0x16e10c[_0x5bea('0x4b')][_0x5bea('0x51')],_0x16e10c[_0x5bea('0x4b')][_0x5bea('0x2e')]);_0x16e10c[_0x5bea('0x4b')][_0x5bea('0x52')]=integrations[_0x5bea('0x53')](_0x16e10c[_0x5bea('0x4b')][_0x5bea('0x51')],_0x16e10c[_0x5bea('0x4b')][_0x5bea('0x2e')]);return db[_0x5bea('0x54')][_0x5bea('0x4a')](_0x16e10c['body'],{'include':[{'model':db['SalesforceField'],'as':_0x5bea('0x4f')},{'model':db['SalesforceField'],'as':_0x5bea('0x52')}]});}return null;})[_0x5bea('0x24')](respondWithResult(_0x3f35c1,null))['catch'](handleError(_0x3f35c1,null));};exports[_0x5bea('0x55')]=function(_0x118f06,_0x1c51f8,_0xd62e21){var _0x47c88c;var _0x1ac1ed='';var _0x4fcf51=_0x5bea('0x56');return db[_0x5bea('0x2b')][_0x5bea('0x4d')]({'where':{'id':_0x118f06['params']['id']},'attributes':['id','remoteUri','clientId','clientSecret','username','password',_0x5bea('0x57')]})[_0x5bea('0x24')](handleEntityNotFound(_0x1c51f8,null))['then'](function(_0x13ae6f){if(_0x13ae6f){_0x1ac1ed=_0x13ae6f[_0x5bea('0x58')];var _0x5d7d61=_0x1ac1ed['slice'](-0x1);if(_0x5d7d61==='/'){_0x1ac1ed=_0x1ac1ed['substring'](0x0,_0x1ac1ed[_0x5bea('0x59')](_0x5d7d61));}_0x47c88c=new jsforce[(_0x5bea('0x5a'))]({'oauth2':{'loginUrl':_0x1ac1ed,'clientId':_0x13ae6f[_0x5bea('0x5b')],'clientSecret':_0x13ae6f[_0x5bea('0x5c')]}});return _0x47c88c[_0x5bea('0x5d')](_0x13ae6f[_0x5bea('0x5e')],_0x13ae6f[_0x5bea('0x5f')][_0x5bea('0x60')](_0x13ae6f[_0x5bea('0x57')]));}})[_0x5bea('0x24')](function(_0x637a40){if(_0x637a40){if(!_[_0x5bea('0x61')](_0x118f06[_0x5bea('0x33')][_0x5bea('0x62')])){_0x4fcf51=_0x118f06[_0x5bea('0x33')][_0x5bea('0x62')];}return _0x47c88c[_0x5bea('0x63')](_0x4fcf51)[_0x5bea('0x64')]();}})[_0x5bea('0x24')](function(_0x415faa){var _0x4d2b19=['OwnerId',_0x5bea('0x65'),_0x5bea('0x66'),_0x5bea('0x67'),_0x5bea('0x68'),_0x5bea('0x69')];var _0x484037=[_0x5bea('0x6a'),_0x5bea('0x6b'),_0x5bea('0x6c'),'boolean',_0x5bea('0x6d'),_0x5bea('0x6e'),_0x5bea('0x6f')];if(_0x415faa){_[_0x5bea('0x70')](_0x415faa[_0x5bea('0x37')],function(_0x41666e){return _0x4d2b19[_0x5bea('0x71')](_0x41666e['name'])||!_0x484037[_0x5bea('0x71')](_0x41666e[_0x5bea('0x2e')]);});return{'count':_0x415faa[_0x5bea('0x37')][_0x5bea('0x38')],'rows':_['map'](_0x415faa[_0x5bea('0x37')],function(_0x109b48){return{'id':_0x109b48[_0x5bea('0x28')],'name':_0x109b48['label'],'custom':_0x109b48[_0x5bea('0x72')],'options':_0x109b48[_0x5bea('0x73')][_0x5bea('0x38')]>0x0?_['map'](_0x109b48[_0x5bea('0x73')],function(_0x21ea96){return{'name':_0x21ea96[_0x5bea('0x74')],'value':_0x21ea96[_0x5bea('0x75')]};}):_0x109b48[_0x5bea('0x2e')]==_0x5bea('0x76')?[{'name':'True','value':_0x5bea('0x77')},{'name':_0x5bea('0x78'),'value':_0x5bea('0x79')}]:[]};})};}})[_0x5bea('0x24')](respondWithResult(_0x1c51f8,null))[_0x5bea('0x46')](function(_0x447d0d){var _0x57e234=_0x118f06[_0x5bea('0x33')][_0x5bea('0x7a')]?0x1f4:_0x447d0d['statusCode']||0x1f4;logger[_0x5bea('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0x5bea('0x55'),_0x57e234,JSON['stringify'](_0x447d0d));delete _0x447d0d['name'];if(_0x57e234===0x191){_0x57e234=0x190;}_0x1c51f8[_0x5bea('0x1a')](_0x57e234)[_0x5bea('0x29')](_0x118f06[_0x5bea('0x33')][_0x5bea('0x7a')]?{'message':'Wrong\x20credentials','statusCode':_0x447d0d[_0x5bea('0x7b')]}:_0x447d0d);});}; \ No newline at end of file +var _0xaaa0=['false','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','papaparse','ioredis','../../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','end','json','offset','limit','undefined','count','Content-Range','reject','update','then','destroy','stack','name','index','map','rawAttributes','type','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','merge','VIRTUAL','SalesforceAccount','include','findAll','rows','show','params','includeAll','find','catch','create','body','getConfigurations','findOne','order','filter','options','hasOwnProperty','AccountId','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','Subjects','getFields','Task','remoteUri','clientId','clientSecret','username','securityToken','slice','substring','lastIndexOf','Connection','password','concat','isNil','ticketType','describe','OwnerId','ActivityDate','IsRecurrence','Subject','string','int','picklist','email','phone','remove','includes','label','custom','picklistValues','value','True','true','False'];(function(_0x172153,_0xa788dc){var _0x3bede0=function(_0x3028e6){while(--_0x3028e6){_0x172153['push'](_0x172153['shift']());}};_0x3bede0(++_0xa788dc);}(_0xaaa0,0x7f));var _0x0aaa=function(_0x1c6b18,_0x233b7c){_0x1c6b18=_0x1c6b18-0x0;var _0xbb8a48=_0xaaa0[_0x1c6b18];return _0xbb8a48;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0aaa('0x0'));var jsonpatch=require(_0x0aaa('0x1'));var rp=require(_0x0aaa('0x2'));var moment=require(_0x0aaa('0x3'));var BPromise=require(_0x0aaa('0x4'));var Mustache=require(_0x0aaa('0x5'));var util=require(_0x0aaa('0x6'));var path=require(_0x0aaa('0x7'));var sox=require(_0x0aaa('0x8'));var csv=require(_0x0aaa('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0aaa('0xa'));var squel=require('squel');var crypto=require(_0x0aaa('0xb'));var jsforce=require(_0x0aaa('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0aaa('0x9'));var querystring=require('querystring');var Papa=require(_0x0aaa('0xd'));var Redis=require(_0x0aaa('0xe'));var authService=require(_0x0aaa('0xf'));var qs=require(_0x0aaa('0x10'));var as=require(_0x0aaa('0x11'));var hardwareService=require(_0x0aaa('0x12'));var logger=require(_0x0aaa('0x13'))('api');var utils=require(_0x0aaa('0x14'));var config=require(_0x0aaa('0x15'));var licenseUtil=require(_0x0aaa('0x16'));var db=require(_0x0aaa('0x17'))['db'];var integrations=require(_0x0aaa('0x18'));function respondWithStatusCode(_0x4a6f7c,_0x4256c2){_0x4256c2=_0x4256c2||0xcc;return function(_0x22944d){if(_0x22944d){return _0x4a6f7c[_0x0aaa('0x19')](_0x4256c2);}return _0x4a6f7c[_0x0aaa('0x1a')](_0x4256c2)[_0x0aaa('0x1b')]();};}function respondWithResult(_0x503f09,_0x5b8eea){_0x5b8eea=_0x5b8eea||0xc8;return function(_0x222e72){if(_0x222e72){return _0x503f09['status'](_0x5b8eea)[_0x0aaa('0x1c')](_0x222e72);}};}function respondWithFilteredResult(_0x8ae6c9,_0x786b78){return function(_0x39c4fa){if(_0x39c4fa){var _0x1d1de3=typeof _0x786b78[_0x0aaa('0x1d')]==='undefined'&&typeof _0x786b78[_0x0aaa('0x1e')]===_0x0aaa('0x1f');var _0x124ac7=_0x39c4fa['count'];var _0x11a1f3=_0x1d1de3?0x0:_0x786b78[_0x0aaa('0x1d')];var _0x24c7dd=_0x1d1de3?_0x39c4fa[_0x0aaa('0x20')]:_0x786b78[_0x0aaa('0x1d')]+_0x786b78[_0x0aaa('0x1e')];var _0x2e03a0;if(_0x24c7dd>=_0x124ac7){_0x24c7dd=_0x124ac7;_0x2e03a0=0xc8;}else{_0x2e03a0=0xce;}_0x8ae6c9[_0x0aaa('0x1a')](_0x2e03a0);return _0x8ae6c9['set'](_0x0aaa('0x21'),_0x11a1f3+'-'+_0x24c7dd+'/'+_0x124ac7)[_0x0aaa('0x1c')](_0x39c4fa);}return null;};}function patchUpdates(_0x3256bc){return function(_0x4a200e){try{jsonpatch['apply'](_0x4a200e,_0x3256bc,!![]);}catch(_0x3da500){return BPromise[_0x0aaa('0x22')](_0x3da500);}return _0x4a200e['save']();};}function saveUpdates(_0x5257d0,_0x585d52){return function(_0x222605){if(_0x222605){return _0x222605[_0x0aaa('0x23')](_0x5257d0)[_0x0aaa('0x24')](function(_0x20051b){return _0x20051b;});}return null;};}function removeEntity(_0x5ec700,_0x23b047){return function(_0x35b094){if(_0x35b094){return _0x35b094[_0x0aaa('0x25')]()[_0x0aaa('0x24')](function(){_0x5ec700['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x37dfe0,_0x41ba44){return function(_0x11b196){if(!_0x11b196){_0x37dfe0[_0x0aaa('0x19')](0x194);}return _0x11b196;};}function handleError(_0x4f95ad,_0xfdee2c){_0xfdee2c=_0xfdee2c||0x1f4;return function(_0x56f5c2){logger['error'](_0x56f5c2[_0x0aaa('0x26')]);if(_0x56f5c2['name']){delete _0x56f5c2[_0x0aaa('0x27')];}_0x4f95ad['status'](_0xfdee2c)['send'](_0x56f5c2);};}exports[_0x0aaa('0x28')]=function(_0x31df1b,_0x1cc205){var _0x30a99f={},_0x30e169={},_0x2b8271={'count':0x0,'rows':[]};var _0x288d53=_[_0x0aaa('0x29')](db['SalesforceAccount'][_0x0aaa('0x2a')],function(_0x29399e){return{'name':_0x29399e['fieldName'],'type':_0x29399e[_0x0aaa('0x2b')]['key']};});_0x30e169['model']=_['map'](_0x288d53,_0x0aaa('0x27'));_0x30e169['query']=_[_0x0aaa('0x2c')](_0x31df1b[_0x0aaa('0x2d')]);_0x30e169[_0x0aaa('0x2e')]=_[_0x0aaa('0x2f')](_0x30e169[_0x0aaa('0x30')],_0x30e169[_0x0aaa('0x2d')]);_0x30a99f[_0x0aaa('0x31')]=_[_0x0aaa('0x2f')](_0x30e169[_0x0aaa('0x30')],qs[_0x0aaa('0x32')](_0x31df1b[_0x0aaa('0x2d')]['fields']));_0x30a99f['attributes']=_0x30a99f['attributes'][_0x0aaa('0x33')]?_0x30a99f['attributes']:_0x30e169[_0x0aaa('0x30')];if(!_0x31df1b[_0x0aaa('0x2d')]['hasOwnProperty'](_0x0aaa('0x34'))){_0x30a99f[_0x0aaa('0x1e')]=qs['limit'](_0x31df1b['query'][_0x0aaa('0x1e')]);_0x30a99f[_0x0aaa('0x1d')]=qs['offset'](_0x31df1b[_0x0aaa('0x2d')][_0x0aaa('0x1d')]);}_0x30a99f['order']=qs[_0x0aaa('0x35')](_0x31df1b[_0x0aaa('0x2d')][_0x0aaa('0x35')]);_0x30a99f[_0x0aaa('0x36')]=qs[_0x0aaa('0x2e')](_['pick'](_0x31df1b['query'],_0x30e169['filters']),_0x288d53);if(_0x31df1b['query']['filter']){_0x30a99f[_0x0aaa('0x36')]=_[_0x0aaa('0x37')](_0x30a99f[_0x0aaa('0x36')],{'$or':_[_0x0aaa('0x29')](_0x288d53,function(_0x189f9b){if(_0x189f9b['type']!==_0x0aaa('0x38')){var _0x8a031a={};_0x8a031a[_0x189f9b[_0x0aaa('0x27')]]={'$like':'%'+_0x31df1b['query']['filter']+'%'};return _0x8a031a;}})});}_0x30a99f=_['merge']({},_0x30a99f,_0x31df1b['options']);var _0x37bc40={'where':_0x30a99f[_0x0aaa('0x36')]};return db[_0x0aaa('0x39')]['count'](_0x37bc40)[_0x0aaa('0x24')](function(_0x86635f){_0x2b8271[_0x0aaa('0x20')]=_0x86635f;if(_0x31df1b['query']['includeAll']){_0x30a99f[_0x0aaa('0x3a')]=[{'all':!![]}];}return db[_0x0aaa('0x39')][_0x0aaa('0x3b')](_0x30a99f);})['then'](function(_0x37cac8){_0x2b8271[_0x0aaa('0x3c')]=_0x37cac8;return _0x2b8271;})[_0x0aaa('0x24')](respondWithFilteredResult(_0x1cc205,_0x30a99f))['catch'](handleError(_0x1cc205,null));};exports[_0x0aaa('0x3d')]=function(_0x359955,_0x12156f){var _0x1423bb={'raw':![],'where':{'id':_0x359955[_0x0aaa('0x3e')]['id']}},_0x18bd06={};_0x18bd06[_0x0aaa('0x30')]=_[_0x0aaa('0x2c')](db['SalesforceAccount'][_0x0aaa('0x2a')]);_0x18bd06[_0x0aaa('0x2d')]=_[_0x0aaa('0x2c')](_0x359955[_0x0aaa('0x2d')]);_0x18bd06[_0x0aaa('0x2e')]=_['intersection'](_0x18bd06[_0x0aaa('0x30')],_0x18bd06[_0x0aaa('0x2d')]);_0x1423bb[_0x0aaa('0x31')]=_[_0x0aaa('0x2f')](_0x18bd06[_0x0aaa('0x30')],qs[_0x0aaa('0x32')](_0x359955[_0x0aaa('0x2d')][_0x0aaa('0x32')]));_0x1423bb['attributes']=_0x1423bb['attributes'][_0x0aaa('0x33')]?_0x1423bb[_0x0aaa('0x31')]:_0x18bd06[_0x0aaa('0x30')];if(_0x359955['query'][_0x0aaa('0x3f')]){_0x1423bb[_0x0aaa('0x3a')]=[{'all':!![]}];}_0x1423bb=_[_0x0aaa('0x37')]({},_0x1423bb,_0x359955['options']);return db[_0x0aaa('0x39')][_0x0aaa('0x40')](_0x1423bb)[_0x0aaa('0x24')](handleEntityNotFound(_0x12156f,null))['then'](respondWithResult(_0x12156f,null))[_0x0aaa('0x41')](handleError(_0x12156f,null));};exports[_0x0aaa('0x42')]=function(_0x4ac54e,_0x4406ea){return db[_0x0aaa('0x39')]['create'](_0x4ac54e['body'],{})[_0x0aaa('0x24')](respondWithResult(_0x4406ea,0xc9))[_0x0aaa('0x41')](handleError(_0x4406ea,null));};exports['update']=function(_0x4ea6d5,_0x10782a){if(_0x4ea6d5[_0x0aaa('0x43')]['id']){delete _0x4ea6d5[_0x0aaa('0x43')]['id'];}return db[_0x0aaa('0x39')][_0x0aaa('0x40')]({'where':{'id':_0x4ea6d5['params']['id']}})[_0x0aaa('0x24')](handleEntityNotFound(_0x10782a,null))['then'](saveUpdates(_0x4ea6d5['body'],null))[_0x0aaa('0x24')](respondWithResult(_0x10782a,null))[_0x0aaa('0x41')](handleError(_0x10782a,null));};exports['destroy']=function(_0x33902b,_0x4335d8){return db[_0x0aaa('0x39')][_0x0aaa('0x40')]({'where':{'id':_0x33902b['params']['id']}})[_0x0aaa('0x24')](handleEntityNotFound(_0x4335d8,null))[_0x0aaa('0x24')](removeEntity(_0x4335d8,null))['catch'](handleError(_0x4335d8,null));};exports[_0x0aaa('0x44')]=function(_0x40c50d,_0x846d8f,_0x2dae0b){var _0x4e8b32={};var _0x58134f={};var _0x865985;var _0x3f6833;return db[_0x0aaa('0x39')][_0x0aaa('0x45')]({'where':{'id':_0x40c50d['params']['id']}})['then'](handleEntityNotFound(_0x846d8f,null))[_0x0aaa('0x24')](function(_0x175a51){if(_0x175a51){_0x865985=_0x175a51;_0x58134f['model']=_['keys'](db['SalesforceConfiguration'][_0x0aaa('0x2a')]);_0x58134f[_0x0aaa('0x2d')]=_[_0x0aaa('0x2c')](_0x40c50d['query']);_0x58134f[_0x0aaa('0x2e')]=_[_0x0aaa('0x2f')](_0x58134f[_0x0aaa('0x30')],_0x58134f[_0x0aaa('0x2d')]);_0x4e8b32[_0x0aaa('0x31')]=_[_0x0aaa('0x2f')](_0x58134f[_0x0aaa('0x30')],qs[_0x0aaa('0x32')](_0x40c50d[_0x0aaa('0x2d')][_0x0aaa('0x32')]));_0x4e8b32['attributes']=_0x4e8b32[_0x0aaa('0x31')][_0x0aaa('0x33')]?_0x4e8b32[_0x0aaa('0x31')]:_0x58134f[_0x0aaa('0x30')];_0x4e8b32[_0x0aaa('0x46')]=qs[_0x0aaa('0x35')](_0x40c50d[_0x0aaa('0x2d')][_0x0aaa('0x35')]);_0x4e8b32[_0x0aaa('0x36')]=qs[_0x0aaa('0x2e')](_['pick'](_0x40c50d['query'],_0x58134f[_0x0aaa('0x2e')]));if(_0x40c50d[_0x0aaa('0x2d')][_0x0aaa('0x47')]){_0x4e8b32[_0x0aaa('0x36')]=_[_0x0aaa('0x37')](_0x4e8b32[_0x0aaa('0x36')],{'$or':_[_0x0aaa('0x29')](_0x4e8b32['attributes'],function(_0x4e18be){var _0x3bf496={};_0x3bf496[_0x4e18be]={'$like':'%'+_0x40c50d[_0x0aaa('0x2d')][_0x0aaa('0x47')]+'%'};return _0x3bf496;})});}_0x4e8b32=_[_0x0aaa('0x37')]({},_0x4e8b32,_0x40c50d[_0x0aaa('0x48')]);return _0x865985[_0x0aaa('0x44')](_0x4e8b32);}})[_0x0aaa('0x24')](function(_0xb4d302){if(_0xb4d302){_0x3f6833=_0xb4d302['length'];if(!_0x40c50d[_0x0aaa('0x2d')][_0x0aaa('0x49')](_0x0aaa('0x34'))){_0x4e8b32[_0x0aaa('0x1e')]=qs['limit'](_0x40c50d[_0x0aaa('0x2d')][_0x0aaa('0x1e')]);_0x4e8b32[_0x0aaa('0x1d')]=qs['offset'](_0x40c50d[_0x0aaa('0x2d')][_0x0aaa('0x1d')]);}return _0x865985['getConfigurations'](_0x4e8b32);}})['then'](function(_0x369413){if(_0x369413){return _0x369413?{'count':_0x3f6833,'rows':_0x369413}:null;}})[_0x0aaa('0x24')](respondWithResult(_0x846d8f,null))[_0x0aaa('0x41')](handleError(_0x846d8f,null));};exports['addConfiguration']=function(_0x2be0d1,_0x4e0e12,_0x201271){if(_0x2be0d1[_0x0aaa('0x43')]['id']){delete _0x2be0d1[_0x0aaa('0x43')]['id'];}return db[_0x0aaa('0x39')][_0x0aaa('0x45')]({'where':{'id':_0x2be0d1[_0x0aaa('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4e0e12,null))[_0x0aaa('0x24')](function(_0x5ce61d){if(_0x5ce61d){_0x2be0d1[_0x0aaa('0x43')][_0x0aaa('0x4a')]=_0x5ce61d['id'];_0x2be0d1[_0x0aaa('0x43')]['Subjects']=integrations[_0x0aaa('0x4b')](_0x2be0d1[_0x0aaa('0x43')][_0x0aaa('0x4c')],_0x2be0d1[_0x0aaa('0x43')][_0x0aaa('0x2b')]);_0x2be0d1[_0x0aaa('0x43')][_0x0aaa('0x4d')]=integrations[_0x0aaa('0x4e')](_0x2be0d1['body']['channel'],_0x2be0d1[_0x0aaa('0x43')][_0x0aaa('0x2b')]);return db['SalesforceConfiguration']['create'](_0x2be0d1['body'],{'include':[{'model':db[_0x0aaa('0x4f')],'as':_0x0aaa('0x50')},{'model':db[_0x0aaa('0x4f')],'as':_0x0aaa('0x4d')}]});}return null;})['then'](respondWithResult(_0x4e0e12,null))[_0x0aaa('0x41')](handleError(_0x4e0e12,null));};exports[_0x0aaa('0x51')]=function(_0x14af94,_0x3511df,_0x3e847e){var _0x546e94;var _0x179dbd='';var _0x2c5c13=_0x0aaa('0x52');return db['SalesforceAccount'][_0x0aaa('0x45')]({'where':{'id':_0x14af94[_0x0aaa('0x3e')]['id']},'attributes':['id',_0x0aaa('0x53'),_0x0aaa('0x54'),_0x0aaa('0x55'),_0x0aaa('0x56'),'password',_0x0aaa('0x57')]})['then'](handleEntityNotFound(_0x3511df,null))['then'](function(_0x3ca954){if(_0x3ca954){_0x179dbd=_0x3ca954[_0x0aaa('0x53')];var _0x79021=_0x179dbd[_0x0aaa('0x58')](-0x1);if(_0x79021==='/'){_0x179dbd=_0x179dbd[_0x0aaa('0x59')](0x0,_0x179dbd[_0x0aaa('0x5a')](_0x79021));}_0x546e94=new jsforce[(_0x0aaa('0x5b'))]({'oauth2':{'loginUrl':_0x179dbd,'clientId':_0x3ca954[_0x0aaa('0x54')],'clientSecret':_0x3ca954[_0x0aaa('0x55')]}});return _0x546e94['login'](_0x3ca954['username'],_0x3ca954[_0x0aaa('0x5c')][_0x0aaa('0x5d')](_0x3ca954[_0x0aaa('0x57')]));}})[_0x0aaa('0x24')](function(_0xee6c3a){if(_0xee6c3a){if(!_[_0x0aaa('0x5e')](_0x14af94[_0x0aaa('0x2d')]['ticketType'])){_0x2c5c13=_0x14af94[_0x0aaa('0x2d')][_0x0aaa('0x5f')];}return _0x546e94['sobject'](_0x2c5c13)[_0x0aaa('0x60')]();}})[_0x0aaa('0x24')](function(_0x131db3){var _0x362083=[_0x0aaa('0x61'),_0x0aaa('0x62'),'IsReminderSet',_0x0aaa('0x63'),_0x0aaa('0x64'),'Description'];var _0x367a3b=[_0x0aaa('0x65'),_0x0aaa('0x66'),_0x0aaa('0x67'),'boolean',_0x0aaa('0x68'),'textarea',_0x0aaa('0x69')];if(_0x131db3){_[_0x0aaa('0x6a')](_0x131db3[_0x0aaa('0x32')],function(_0x5ab346){return _0x362083[_0x0aaa('0x6b')](_0x5ab346[_0x0aaa('0x27')])||!_0x367a3b['includes'](_0x5ab346['type']);});return{'count':_0x131db3[_0x0aaa('0x32')][_0x0aaa('0x33')],'rows':_[_0x0aaa('0x29')](_0x131db3[_0x0aaa('0x32')],function(_0xd1f4a9){return{'id':_0xd1f4a9['name'],'name':_0xd1f4a9[_0x0aaa('0x6c')],'custom':_0xd1f4a9[_0x0aaa('0x6d')],'options':_0xd1f4a9[_0x0aaa('0x6e')]['length']>0x0?_[_0x0aaa('0x29')](_0xd1f4a9[_0x0aaa('0x6e')],function(_0x521300){return{'name':_0x521300[_0x0aaa('0x6c')],'value':_0x521300[_0x0aaa('0x6f')]};}):_0xd1f4a9['type']=='boolean'?[{'name':_0x0aaa('0x70'),'value':_0x0aaa('0x71')},{'name':_0x0aaa('0x72'),'value':_0x0aaa('0x73')}]:[]};})};}})[_0x0aaa('0x24')](respondWithResult(_0x3511df,null))[_0x0aaa('0x41')](function(_0x5e86de){var _0x49dfca=_0x14af94[_0x0aaa('0x2d')]['test']?0x1f4:_0x5e86de[_0x0aaa('0x74')]||0x1f4;logger[_0x0aaa('0x75')](_0x0aaa('0x76'),_0x0aaa('0x51'),_0x49dfca,JSON['stringify'](_0x5e86de));delete _0x5e86de[_0x0aaa('0x27')];if(_0x49dfca===0x191){_0x49dfca=0x190;}_0x3511df[_0x0aaa('0x1a')](_0x49dfca)['send'](_0x14af94[_0x0aaa('0x2d')][_0x0aaa('0x77')]?{'message':_0x0aaa('0x78'),'statusCode':_0x5e86de[_0x0aaa('0x74')]}:_0x5e86de);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 164feff..3f8d7b0 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 _0x2953=['exports','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes'];(function(_0x4b8978,_0x5015da){var _0x1ee755=function(_0x254ec9){while(--_0x254ec9){_0x4b8978['push'](_0x4b8978['shift']());}};_0x1ee755(++_0x5015da);}(_0x2953,0x1cc));var _0x3295=function(_0x121195,_0x277af4){_0x121195=_0x121195-0x0;var _0xf0b9df=_0x2953[_0x121195];return _0xf0b9df;};'use strict';var _=require(_0x3295('0x0'));var util=require('util');var logger=require(_0x3295('0x1'))(_0x3295('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3295('0x3'));var fs=require('fs');var path=require(_0x3295('0x4'));var rimraf=require(_0x3295('0x5'));var config=require(_0x3295('0x6'));var attributes=require(_0x3295('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x3295('0x8')]=function(_0x37063b,_0x4d9f22){return _0x37063b['define']('SalesforceAccount',attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba76=['../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0xdefd11,_0x54f0b5){var _0x354389=function(_0x295f2f){while(--_0x295f2f){_0xdefd11['push'](_0xdefd11['shift']());}};_0x354389(++_0x54f0b5);}(_0xba76,0x17e));var _0x6ba7=function(_0x1cc372,_0x205ee3){_0x1cc372=_0x1cc372-0x0;var _0x48081d=_0xba76[_0x1cc372];return _0x48081d;};'use strict';var _=require(_0x6ba7('0x0'));var util=require(_0x6ba7('0x1'));var logger=require(_0x6ba7('0x2'))(_0x6ba7('0x3'));var moment=require(_0x6ba7('0x4'));var BPromise=require(_0x6ba7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6ba7('0x6'));var rimraf=require(_0x6ba7('0x7'));var config=require(_0x6ba7('0x8'));var attributes=require(_0x6ba7('0x9'));var integrations=require(_0x6ba7('0xa'));module[_0x6ba7('0xb')]=function(_0x3aa8c9,_0x3ab302){return _0x3aa8c9[_0x6ba7('0xc')](_0x6ba7('0xd'),attributes,{'tableName':_0x6ba7('0xe'),'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 65d9f8d..0bf6e58 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 _0x71d8=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','GetSalesforceAccount','SalesforceAccount','options','attributes','limit','include','map','model','ShowSalesforceAccount','find','raw','where'];(function(_0x2714ec,_0x36daa4){var _0x2608e5=function(_0x408468){while(--_0x408468){_0x2714ec['push'](_0x2714ec['shift']());}};_0x2608e5(++_0x36daa4);}(_0x71d8,0x8d));var _0x871d=function(_0x3e0c0f,_0x28f5f9){_0x3e0c0f=_0x3e0c0f-0x0;var _0x1b7ce9=_0x71d8[_0x3e0c0f];return _0x1b7ce9;};'use strict';var _=require(_0x871d('0x0'));var util=require(_0x871d('0x1'));var moment=require(_0x871d('0x2'));var BPromise=require(_0x871d('0x3'));var rs=require(_0x871d('0x4'));var fs=require('fs');var Redis=require(_0x871d('0x5'));var db=require(_0x871d('0x6'))['db'];var utils=require(_0x871d('0x7'));var logger=require(_0x871d('0x8'))(_0x871d('0x9'));var config=require('../../config/environment');var jayson=require(_0x871d('0xa'));var client=jayson[_0x871d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b9d4d,_0x28c81c,_0x352445){return new BPromise(function(_0x32f2be,_0x578d82){return client[_0x871d('0xc')](_0x4b9d4d,_0x352445)[_0x871d('0xd')](function(_0x4a505b){logger[_0x871d('0xe')](_0x871d('0xf'),_0x28c81c,_0x871d('0x10'));logger[_0x871d('0x11')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x28c81c,_0x871d('0x10'),JSON['stringify'](_0x4a505b));if(_0x4a505b[_0x871d('0x12')]){if(_0x4a505b[_0x871d('0x12')][_0x871d('0x13')]===0x1f4){logger[_0x871d('0x12')](_0x871d('0xf'),_0x28c81c,_0x4a505b[_0x871d('0x12')][_0x871d('0x14')]);return _0x578d82(_0x4a505b[_0x871d('0x12')][_0x871d('0x14')]);}logger['error'](_0x871d('0xf'),_0x28c81c,_0x4a505b[_0x871d('0x12')][_0x871d('0x14')]);return _0x32f2be(_0x4a505b[_0x871d('0x12')]['message']);}else{logger[_0x871d('0xe')](_0x871d('0xf'),_0x28c81c,_0x871d('0x10'));_0x32f2be(_0x4a505b[_0x871d('0x15')][_0x871d('0x14')]);}})['catch'](function(_0x4dc662){logger[_0x871d('0x12')](_0x871d('0xf'),_0x28c81c,_0x4dc662);_0x578d82(_0x4dc662);});});}exports[_0x871d('0x16')]=function(_0x5098a6){var _0x4c023e=this;return new Promise(function(_0x5b8cc6,_0x3f597c){return db[_0x871d('0x17')]['findAll']({'raw':_0x5098a6[_0x871d('0x18')]?_0x5098a6[_0x871d('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5098a6[_0x871d('0x18')]?_0x5098a6[_0x871d('0x18')]['where']||null:null,'attributes':_0x5098a6['options']?_0x5098a6[_0x871d('0x18')][_0x871d('0x19')]||null:null,'limit':_0x5098a6[_0x871d('0x18')]?_0x5098a6['options'][_0x871d('0x1a')]||null:null,'include':_0x5098a6[_0x871d('0x18')]?_0x5098a6[_0x871d('0x18')][_0x871d('0x1b')]?_[_0x871d('0x1c')](_0x5098a6[_0x871d('0x18')]['include'],function(_0x188851){return{'model':db[_0x188851[_0x871d('0x1d')]],'as':_0x188851['as'],'attributes':_0x188851['attributes'],'include':_0x188851[_0x871d('0x1b')]?_[_0x871d('0x1c')](_0x188851['include'],function(_0x36c5ff){return{'model':db[_0x36c5ff[_0x871d('0x1d')]],'as':_0x36c5ff['as'],'attributes':_0x36c5ff['attributes'],'include':_0x36c5ff[_0x871d('0x1b')]?_[_0x871d('0x1c')](_0x36c5ff[_0x871d('0x1b')],function(_0x3f361f){return{'model':db[_0x3f361f[_0x871d('0x1d')]],'as':_0x3f361f['as'],'attributes':_0x3f361f[_0x871d('0x19')]};}):[]};}):[]};}):[]:[]})[_0x871d('0xd')](function(_0x5250ab){logger['info'](_0x871d('0x16'),_0x5098a6);logger[_0x871d('0x11')](_0x871d('0x16'),_0x5098a6,JSON['stringify'](_0x5250ab));_0x5b8cc6(_0x5250ab);})['catch'](function(_0x29bab4){logger['error'](_0x871d('0x16'),_0x29bab4[_0x871d('0x14')],_0x5098a6);_0x3f597c(_0x4c023e[_0x871d('0x12')](0x1f4,_0x29bab4[_0x871d('0x14')]));});});};exports[_0x871d('0x1e')]=function(_0x585fc8){var _0x1d054e=this;return new Promise(function(_0x2242d5,_0x48e7d4){return db[_0x871d('0x17')][_0x871d('0x1f')]({'raw':_0x585fc8[_0x871d('0x18')]?_0x585fc8['options'][_0x871d('0x20')]===undefined?!![]:![]:!![],'where':_0x585fc8[_0x871d('0x18')]?_0x585fc8['options'][_0x871d('0x21')]||null:null,'attributes':_0x585fc8[_0x871d('0x18')]?_0x585fc8[_0x871d('0x18')][_0x871d('0x19')]||null:null,'include':_0x585fc8['options']?_0x585fc8[_0x871d('0x18')][_0x871d('0x1b')]?_[_0x871d('0x1c')](_0x585fc8[_0x871d('0x18')][_0x871d('0x1b')],function(_0x2fcaed){return{'model':db[_0x2fcaed['model']],'as':_0x2fcaed['as'],'attributes':_0x2fcaed[_0x871d('0x19')],'include':_0x2fcaed[_0x871d('0x1b')]?_['map'](_0x2fcaed['include'],function(_0xab40ff){return{'model':db[_0xab40ff[_0x871d('0x1d')]],'as':_0xab40ff['as'],'attributes':_0xab40ff['attributes'],'include':_0xab40ff[_0x871d('0x1b')]?_['map'](_0xab40ff[_0x871d('0x1b')],function(_0x4200aa){return{'model':db[_0x4200aa[_0x871d('0x1d')]],'as':_0x4200aa['as'],'attributes':_0x4200aa[_0x871d('0x19')]};}):[]};}):[]};}):[]:[]})[_0x871d('0xd')](function(_0x4d3f16){logger['info'](_0x871d('0x1e'),_0x585fc8);logger[_0x871d('0x11')]('ShowSalesforceAccount',_0x585fc8,JSON['stringify'](_0x4d3f16));_0x2242d5(_0x4d3f16);})[_0x871d('0x22')](function(_0x58ffe9){logger[_0x871d('0x12')](_0x871d('0x1e'),_0x58ffe9['message'],_0x585fc8);_0x48e7d4(_0x1d054e['error'](0x1f4,_0x58ffe9[_0x871d('0x14')]));});});}; \ No newline at end of file +var _0x4377=['GetSalesforceAccount','findAll','options','raw','where','attributes','limit','include','model','map','stringify','ShowSalesforceAccount','SalesforceAccount','debug','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','SalesforceAccount,\x20%s,\x20%s','message','info','result','catch'];(function(_0x680821,_0x23e67f){var _0x3f132c=function(_0x1bbcea){while(--_0x1bbcea){_0x680821['push'](_0x680821['shift']());}};_0x3f132c(++_0x23e67f);}(_0x4377,0xf5));var _0x7437=function(_0x244453,_0x3b736b){_0x244453=_0x244453-0x0;var _0xbb315f=_0x4377[_0x244453];return _0xbb315f;};'use strict';var _=require(_0x7437('0x0'));var util=require('util');var moment=require(_0x7437('0x1'));var BPromise=require(_0x7437('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7437('0x3'))['db'];var utils=require(_0x7437('0x4'));var logger=require(_0x7437('0x5'))(_0x7437('0x6'));var config=require('../../config/environment');var jayson=require(_0x7437('0x7'));var client=jayson['client'][_0x7437('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b3277,_0x208398,_0x46789){return new BPromise(function(_0x1714a4,_0x911f7a){return client['request'](_0x1b3277,_0x46789)[_0x7437('0x9')](function(_0x3cf8bd){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x208398,_0x7437('0xa'));logger['debug'](_0x7437('0xb'),_0x208398,_0x7437('0xa'),JSON['stringify'](_0x3cf8bd));if(_0x3cf8bd[_0x7437('0xc')]){if(_0x3cf8bd[_0x7437('0xc')][_0x7437('0xd')]===0x1f4){logger['error'](_0x7437('0xe'),_0x208398,_0x3cf8bd[_0x7437('0xc')][_0x7437('0xf')]);return _0x911f7a(_0x3cf8bd['error'][_0x7437('0xf')]);}logger[_0x7437('0xc')](_0x7437('0xe'),_0x208398,_0x3cf8bd[_0x7437('0xc')][_0x7437('0xf')]);return _0x1714a4(_0x3cf8bd['error'][_0x7437('0xf')]);}else{logger[_0x7437('0x10')](_0x7437('0xe'),_0x208398,_0x7437('0xa'));_0x1714a4(_0x3cf8bd[_0x7437('0x11')]['message']);}})[_0x7437('0x12')](function(_0x4ad9a2){logger[_0x7437('0xc')](_0x7437('0xe'),_0x208398,_0x4ad9a2);_0x911f7a(_0x4ad9a2);});});}exports[_0x7437('0x13')]=function(_0x1d0621){var _0x479feb=this;return new Promise(function(_0x35900c,_0x1a0cc4){return db['SalesforceAccount'][_0x7437('0x14')]({'raw':_0x1d0621[_0x7437('0x15')]?_0x1d0621[_0x7437('0x15')][_0x7437('0x16')]===undefined?!![]:![]:!![],'where':_0x1d0621['options']?_0x1d0621[_0x7437('0x15')][_0x7437('0x17')]||null:null,'attributes':_0x1d0621[_0x7437('0x15')]?_0x1d0621['options'][_0x7437('0x18')]||null:null,'limit':_0x1d0621[_0x7437('0x15')]?_0x1d0621['options'][_0x7437('0x19')]||null:null,'include':_0x1d0621[_0x7437('0x15')]?_0x1d0621[_0x7437('0x15')]['include']?_['map'](_0x1d0621[_0x7437('0x15')][_0x7437('0x1a')],function(_0x402f66){return{'model':db[_0x402f66[_0x7437('0x1b')]],'as':_0x402f66['as'],'attributes':_0x402f66[_0x7437('0x18')],'include':_0x402f66[_0x7437('0x1a')]?_[_0x7437('0x1c')](_0x402f66[_0x7437('0x1a')],function(_0x4cc825){return{'model':db[_0x4cc825[_0x7437('0x1b')]],'as':_0x4cc825['as'],'attributes':_0x4cc825[_0x7437('0x18')],'include':_0x4cc825[_0x7437('0x1a')]?_[_0x7437('0x1c')](_0x4cc825[_0x7437('0x1a')],function(_0x140d39){return{'model':db[_0x140d39[_0x7437('0x1b')]],'as':_0x140d39['as'],'attributes':_0x140d39['attributes']};}):[]};}):[]};}):[]:[]})[_0x7437('0x9')](function(_0xe70ba7){logger['info'](_0x7437('0x13'),_0x1d0621);logger['debug']('GetSalesforceAccount',_0x1d0621,JSON[_0x7437('0x1d')](_0xe70ba7));_0x35900c(_0xe70ba7);})[_0x7437('0x12')](function(_0x574b7e){logger[_0x7437('0xc')](_0x7437('0x13'),_0x574b7e['message'],_0x1d0621);_0x1a0cc4(_0x479feb[_0x7437('0xc')](0x1f4,_0x574b7e[_0x7437('0xf')]));});});};exports[_0x7437('0x1e')]=function(_0x2c04ed){var _0x2feeb3=this;return new Promise(function(_0x2071d5,_0x4cb3d1){return db[_0x7437('0x1f')]['find']({'raw':_0x2c04ed[_0x7437('0x15')]?_0x2c04ed[_0x7437('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x2c04ed[_0x7437('0x15')]?_0x2c04ed[_0x7437('0x15')][_0x7437('0x17')]||null:null,'attributes':_0x2c04ed['options']?_0x2c04ed['options'][_0x7437('0x18')]||null:null,'include':_0x2c04ed[_0x7437('0x15')]?_0x2c04ed[_0x7437('0x15')][_0x7437('0x1a')]?_[_0x7437('0x1c')](_0x2c04ed[_0x7437('0x15')]['include'],function(_0x25d12f){return{'model':db[_0x25d12f[_0x7437('0x1b')]],'as':_0x25d12f['as'],'attributes':_0x25d12f[_0x7437('0x18')],'include':_0x25d12f[_0x7437('0x1a')]?_['map'](_0x25d12f[_0x7437('0x1a')],function(_0xc7b2bd){return{'model':db[_0xc7b2bd['model']],'as':_0xc7b2bd['as'],'attributes':_0xc7b2bd[_0x7437('0x18')],'include':_0xc7b2bd[_0x7437('0x1a')]?_['map'](_0xc7b2bd['include'],function(_0x1c5298){return{'model':db[_0x1c5298[_0x7437('0x1b')]],'as':_0x1c5298['as'],'attributes':_0x1c5298['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3db0c3){logger[_0x7437('0x10')]('ShowSalesforceAccount',_0x2c04ed);logger[_0x7437('0x20')](_0x7437('0x1e'),_0x2c04ed,JSON[_0x7437('0x1d')](_0x3db0c3));_0x2071d5(_0x3db0c3);})[_0x7437('0x12')](function(_0x55fdfa){logger['error'](_0x7437('0x1e'),_0x55fdfa[_0x7437('0xf')],_0x2c04ed);_0x4cb3d1(_0x2feeb3[_0x7437('0xc')](0x1f4,_0x55fdfa[_0x7437('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index e9449a3..b58b337 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5e4b85,_0x6cf965){_0x5e4b85=_0x5e4b85-0x0;var _0x5cd3cb=_0x0b0e[_0x5e4b85];return _0x5cd3cb;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=router; \ No newline at end of file +var _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5e6ea3,_0x9addd2){_0x5e6ea3=_0x5e6ea3-0x0;var _0x4048b5=_0x0b0e[_0x5e6ea3];return _0x4048b5;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 7b05818..27f8677 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 _0x0da4=['Task','contact','lead','account_contact_lead','contact_lead','nothing','account','sequelize','exports','STRING','ENUM','Case'];(function(_0x1a06f4,_0x3ccf0b){var _0x466054=function(_0x50c67a){while(--_0x50c67a){_0x1a06f4['push'](_0x1a06f4['shift']());}};_0x466054(++_0x3ccf0b);}(_0x0da4,0x97));var _0x40da=function(_0x384fed,_0x23d7a9){_0x384fed=_0x384fed-0x0;var _0xe78323=_0x0da4[_0x384fed];return _0xe78323;};'use strict';var Sequelize=require(_0x40da('0x0'));module[_0x40da('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x40da('0x2')]},'ticketType':{'type':Sequelize[_0x40da('0x3')]('Task',_0x40da('0x4')),'defaultValue':_0x40da('0x5')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0x40da('0x6'),_0x40da('0x7'),_0x40da('0x8'),'account'),'defaultValue':_0x40da('0x9')},'moduleCreate':{'type':Sequelize[_0x40da('0x3')](_0x40da('0xa'),'contact','lead',_0x40da('0xb')),'defaultValue':_0x40da('0x7')},'leadId':{'type':Sequelize[_0x40da('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x40da('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x40da('0x2')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa6ea=['account_contact_lead','ENUM','lead','sequelize','STRING','Task','Case','contact_lead','contact'];(function(_0xc440aa,_0x3fc1af){var _0xf69ee9=function(_0x4db640){while(--_0x4db640){_0xc440aa['push'](_0xc440aa['shift']());}};_0xf69ee9(++_0x3fc1af);}(_0xa6ea,0x1ce));var _0xaa6e=function(_0x306698,_0x3920d0){_0x306698=_0x306698-0x0;var _0x113a2a=_0xa6ea[_0x306698];return _0x113a2a;};'use strict';var Sequelize=require(_0xaa6e('0x0'));module['exports']={'name':{'type':Sequelize[_0xaa6e('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0xaa6e('0x2'),_0xaa6e('0x3')),'defaultValue':_0xaa6e('0x2')},'moduleSearch':{'type':Sequelize['ENUM'](_0xaa6e('0x4'),_0xaa6e('0x5'),'lead',_0xaa6e('0x6'),'account'),'defaultValue':_0xaa6e('0x4')},'moduleCreate':{'type':Sequelize[_0xaa6e('0x7')]('nothing',_0xaa6e('0x5'),_0xaa6e('0x8'),'account'),'defaultValue':_0xaa6e('0x8')},'leadId':{'type':Sequelize[_0xaa6e('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0xaa6e('0x1')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 2a408ac..54e957c 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 _0x59bb=['status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','findAll','catch','show','params','keys','include','options','find','create','body','getFields','findOne','SalesforceField','nolimit','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x59bb,0x88));var _0xb59b=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x59bb[_0x138adb];return _0x1b27f2;};'use strict';var emlformat=require(_0xb59b('0x0'));var rimraf=require(_0xb59b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb59b('0x2'));var rp=require('request-promise');var moment=require(_0xb59b('0x3'));var BPromise=require(_0xb59b('0x4'));var Mustache=require(_0xb59b('0x5'));var util=require(_0xb59b('0x6'));var path=require('path');var sox=require(_0xb59b('0x7'));var csv=require(_0xb59b('0x8'));var ejs=require(_0xb59b('0x9'));var fs=require('fs');var fs_extra=require(_0xb59b('0xa'));var _=require(_0xb59b('0xb'));var squel=require(_0xb59b('0xc'));var crypto=require(_0xb59b('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb59b('0x8'));var querystring=require(_0xb59b('0xe'));var Papa=require('papaparse');var Redis=require(_0xb59b('0xf'));var authService=require(_0xb59b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb59b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb59b('0x12'))('api');var utils=require(_0xb59b('0x13'));var config=require(_0xb59b('0x14'));var licenseUtil=require(_0xb59b('0x15'));var db=require(_0xb59b('0x16'))['db'];function respondWithStatusCode(_0x29f227,_0x1deadd){_0x1deadd=_0x1deadd||0xcc;return function(_0xf7b557){if(_0xf7b557){return _0x29f227[_0xb59b('0x17')](_0x1deadd);}return _0x29f227[_0xb59b('0x18')](_0x1deadd)[_0xb59b('0x19')]();};}function respondWithResult(_0x4fa030,_0x5c7278){_0x5c7278=_0x5c7278||0xc8;return function(_0x4a5e6c){if(_0x4a5e6c){return _0x4fa030[_0xb59b('0x18')](_0x5c7278)[_0xb59b('0x1a')](_0x4a5e6c);}};}function respondWithFilteredResult(_0x4bdf8e,_0xefdf3){return function(_0x38c39c){if(_0x38c39c){var _0x303fb6=typeof _0xefdf3[_0xb59b('0x1b')]===_0xb59b('0x1c')&&typeof _0xefdf3['limit']==='undefined';var _0x50e139=_0x38c39c['count'];var _0x10a0a4=_0x303fb6?0x0:_0xefdf3[_0xb59b('0x1b')];var _0x40b253=_0x303fb6?_0x38c39c[_0xb59b('0x1d')]:_0xefdf3[_0xb59b('0x1b')]+_0xefdf3[_0xb59b('0x1e')];var _0x3d7ac8;if(_0x40b253>=_0x50e139){_0x40b253=_0x50e139;_0x3d7ac8=0xc8;}else{_0x3d7ac8=0xce;}_0x4bdf8e[_0xb59b('0x18')](_0x3d7ac8);return _0x4bdf8e[_0xb59b('0x1f')](_0xb59b('0x20'),_0x10a0a4+'-'+_0x40b253+'/'+_0x50e139)[_0xb59b('0x1a')](_0x38c39c);}return null;};}function patchUpdates(_0x1bbc8f){return function(_0x188bb1){try{jsonpatch[_0xb59b('0x21')](_0x188bb1,_0x1bbc8f,!![]);}catch(_0x1b4f64){return BPromise['reject'](_0x1b4f64);}return _0x188bb1[_0xb59b('0x22')]();};}function saveUpdates(_0x5f193e,_0x1fa3db){return function(_0x14f62a){if(_0x14f62a){return _0x14f62a[_0xb59b('0x23')](_0x5f193e)[_0xb59b('0x24')](function(_0x43a001){return _0x43a001;});}return null;};}function removeEntity(_0x4643dd,_0x46fd8e){return function(_0xf707b8){if(_0xf707b8){return _0xf707b8[_0xb59b('0x25')]()[_0xb59b('0x24')](function(){_0x4643dd[_0xb59b('0x18')](0xcc)[_0xb59b('0x19')]();});}};}function handleEntityNotFound(_0x4bae7c,_0x25199c){return function(_0x26891a){if(!_0x26891a){_0x4bae7c[_0xb59b('0x17')](0x194);}return _0x26891a;};}function handleError(_0x22bf9c,_0x28778a){_0x28778a=_0x28778a||0x1f4;return function(_0x103891){logger[_0xb59b('0x26')](_0x103891[_0xb59b('0x27')]);if(_0x103891[_0xb59b('0x28')]){delete _0x103891[_0xb59b('0x28')];}_0x22bf9c['status'](_0x28778a)[_0xb59b('0x29')](_0x103891);};}exports[_0xb59b('0x2a')]=function(_0x19672f,_0x379f86){var _0x21eeb6={},_0x196d1c={},_0x5aa9c2={'count':0x0,'rows':[]};var _0x2509ae=_[_0xb59b('0x2b')](db[_0xb59b('0x2c')][_0xb59b('0x2d')],function(_0x221a3f){return{'name':_0x221a3f[_0xb59b('0x2e')],'type':_0x221a3f[_0xb59b('0x2f')][_0xb59b('0x30')]};});_0x196d1c[_0xb59b('0x31')]=_['map'](_0x2509ae,_0xb59b('0x28'));_0x196d1c[_0xb59b('0x32')]=_['keys'](_0x19672f[_0xb59b('0x32')]);_0x196d1c[_0xb59b('0x33')]=_[_0xb59b('0x34')](_0x196d1c[_0xb59b('0x31')],_0x196d1c[_0xb59b('0x32')]);_0x21eeb6[_0xb59b('0x35')]=_['intersection'](_0x196d1c[_0xb59b('0x31')],qs[_0xb59b('0x36')](_0x19672f[_0xb59b('0x32')][_0xb59b('0x36')]));_0x21eeb6[_0xb59b('0x35')]=_0x21eeb6[_0xb59b('0x35')][_0xb59b('0x37')]?_0x21eeb6[_0xb59b('0x35')]:_0x196d1c['model'];if(!_0x19672f['query'][_0xb59b('0x38')]('nolimit')){_0x21eeb6[_0xb59b('0x1e')]=qs['limit'](_0x19672f[_0xb59b('0x32')][_0xb59b('0x1e')]);_0x21eeb6['offset']=qs[_0xb59b('0x1b')](_0x19672f[_0xb59b('0x32')]['offset']);}_0x21eeb6[_0xb59b('0x39')]=qs[_0xb59b('0x3a')](_0x19672f[_0xb59b('0x32')][_0xb59b('0x3a')]);_0x21eeb6[_0xb59b('0x3b')]=qs[_0xb59b('0x33')](_[_0xb59b('0x3c')](_0x19672f[_0xb59b('0x32')],_0x196d1c[_0xb59b('0x33')]),_0x2509ae);if(_0x19672f[_0xb59b('0x32')][_0xb59b('0x3d')]){_0x21eeb6[_0xb59b('0x3b')]=_[_0xb59b('0x3e')](_0x21eeb6['where'],{'$or':_[_0xb59b('0x2b')](_0x2509ae,function(_0x3aedc9){if(_0x3aedc9[_0xb59b('0x2f')]!=='VIRTUAL'){var _0x235959={};_0x235959[_0x3aedc9[_0xb59b('0x28')]]={'$like':'%'+_0x19672f[_0xb59b('0x32')][_0xb59b('0x3d')]+'%'};return _0x235959;}})});}_0x21eeb6=_['merge']({},_0x21eeb6,_0x19672f['options']);var _0x1cca69={'where':_0x21eeb6['where']};return db[_0xb59b('0x2c')][_0xb59b('0x1d')](_0x1cca69)[_0xb59b('0x24')](function(_0x3ddd24){_0x5aa9c2[_0xb59b('0x1d')]=_0x3ddd24;if(_0x19672f[_0xb59b('0x32')][_0xb59b('0x3f')]){_0x21eeb6['include']=[{'all':!![]}];}return db[_0xb59b('0x2c')][_0xb59b('0x40')](_0x21eeb6);})[_0xb59b('0x24')](function(_0x550fc1){_0x5aa9c2['rows']=_0x550fc1;return _0x5aa9c2;})['then'](respondWithFilteredResult(_0x379f86,_0x21eeb6))[_0xb59b('0x41')](handleError(_0x379f86,null));};exports[_0xb59b('0x42')]=function(_0x256416,_0x2d3abf){var _0x4bd0c3={'raw':![],'where':{'id':_0x256416[_0xb59b('0x43')]['id']}},_0x415fa0={};_0x415fa0[_0xb59b('0x31')]=_[_0xb59b('0x44')](db['SalesforceConfiguration'][_0xb59b('0x2d')]);_0x415fa0[_0xb59b('0x32')]=_[_0xb59b('0x44')](_0x256416['query']);_0x415fa0['filters']=_[_0xb59b('0x34')](_0x415fa0[_0xb59b('0x31')],_0x415fa0['query']);_0x4bd0c3[_0xb59b('0x35')]=_[_0xb59b('0x34')](_0x415fa0[_0xb59b('0x31')],qs[_0xb59b('0x36')](_0x256416[_0xb59b('0x32')][_0xb59b('0x36')]));_0x4bd0c3[_0xb59b('0x35')]=_0x4bd0c3['attributes'][_0xb59b('0x37')]?_0x4bd0c3[_0xb59b('0x35')]:_0x415fa0[_0xb59b('0x31')];if(_0x256416[_0xb59b('0x32')][_0xb59b('0x3f')]){_0x4bd0c3[_0xb59b('0x45')]=[{'all':!![]}];}_0x4bd0c3=_[_0xb59b('0x3e')]({},_0x4bd0c3,_0x256416[_0xb59b('0x46')]);return db[_0xb59b('0x2c')][_0xb59b('0x47')](_0x4bd0c3)[_0xb59b('0x24')](handleEntityNotFound(_0x2d3abf,null))['then'](respondWithResult(_0x2d3abf,null))[_0xb59b('0x41')](handleError(_0x2d3abf,null));};exports[_0xb59b('0x48')]=function(_0x13f67d,_0x5bfdfc){return db[_0xb59b('0x2c')][_0xb59b('0x48')](_0x13f67d['body'],{})[_0xb59b('0x24')](respondWithResult(_0x5bfdfc,0xc9))[_0xb59b('0x41')](handleError(_0x5bfdfc,null));};exports[_0xb59b('0x23')]=function(_0x429d0c,_0x4f686a){if(_0x429d0c[_0xb59b('0x49')]['id']){delete _0x429d0c[_0xb59b('0x49')]['id'];}return db['SalesforceConfiguration'][_0xb59b('0x47')]({'where':{'id':_0x429d0c[_0xb59b('0x43')]['id']}})[_0xb59b('0x24')](handleEntityNotFound(_0x4f686a,null))[_0xb59b('0x24')](saveUpdates(_0x429d0c[_0xb59b('0x49')],null))[_0xb59b('0x24')](respondWithResult(_0x4f686a,null))['catch'](handleError(_0x4f686a,null));};exports[_0xb59b('0x25')]=function(_0x3a835c,_0x4d99cc){return db[_0xb59b('0x2c')][_0xb59b('0x47')]({'where':{'id':_0x3a835c[_0xb59b('0x43')]['id']}})[_0xb59b('0x24')](handleEntityNotFound(_0x4d99cc,null))['then'](removeEntity(_0x4d99cc,null))[_0xb59b('0x41')](handleError(_0x4d99cc,null));};exports[_0xb59b('0x4a')]=function(_0x3506bf,_0x5f6182,_0x3368f1){var _0x3eb439={};var _0x18d0ba={};var _0x40294e;var _0x4c4bb4;return db[_0xb59b('0x2c')][_0xb59b('0x4b')]({'where':{'id':_0x3506bf[_0xb59b('0x43')]['id']}})[_0xb59b('0x24')](handleEntityNotFound(_0x5f6182,null))[_0xb59b('0x24')](function(_0x2cafa4){if(_0x2cafa4){_0x40294e=_0x2cafa4;_0x18d0ba[_0xb59b('0x31')]=_[_0xb59b('0x44')](db[_0xb59b('0x4c')][_0xb59b('0x2d')]);_0x18d0ba['query']=_[_0xb59b('0x44')](_0x3506bf[_0xb59b('0x32')]);_0x18d0ba[_0xb59b('0x33')]=_[_0xb59b('0x34')](_0x18d0ba[_0xb59b('0x31')],_0x18d0ba[_0xb59b('0x32')]);_0x3eb439[_0xb59b('0x35')]=_['intersection'](_0x18d0ba[_0xb59b('0x31')],qs[_0xb59b('0x36')](_0x3506bf[_0xb59b('0x32')]['fields']));_0x3eb439['attributes']=_0x3eb439['attributes'][_0xb59b('0x37')]?_0x3eb439['attributes']:_0x18d0ba['model'];_0x3eb439['order']=qs[_0xb59b('0x3a')](_0x3506bf[_0xb59b('0x32')]['sort']);_0x3eb439['where']=qs[_0xb59b('0x33')](_[_0xb59b('0x3c')](_0x3506bf[_0xb59b('0x32')],_0x18d0ba['filters']));if(_0x3506bf[_0xb59b('0x32')][_0xb59b('0x3d')]){_0x3eb439[_0xb59b('0x3b')]=_['merge'](_0x3eb439['where'],{'$or':_['map'](_0x3eb439[_0xb59b('0x35')],function(_0xe4d356){var _0x189c4a={};_0x189c4a[_0xe4d356]={'$like':'%'+_0x3506bf[_0xb59b('0x32')][_0xb59b('0x3d')]+'%'};return _0x189c4a;})});}_0x3eb439=_[_0xb59b('0x3e')]({},_0x3eb439,_0x3506bf[_0xb59b('0x46')]);return _0x40294e[_0xb59b('0x4a')](_0x3eb439);}})[_0xb59b('0x24')](function(_0x262074){if(_0x262074){_0x4c4bb4=_0x262074['length'];if(!_0x3506bf[_0xb59b('0x32')][_0xb59b('0x38')](_0xb59b('0x4d'))){_0x3eb439[_0xb59b('0x1e')]=qs['limit'](_0x3506bf['query'][_0xb59b('0x1e')]);_0x3eb439[_0xb59b('0x1b')]=qs[_0xb59b('0x1b')](_0x3506bf[_0xb59b('0x32')][_0xb59b('0x1b')]);}return _0x40294e[_0xb59b('0x4a')](_0x3eb439);}})['then'](function(_0x1fc71f){if(_0x1fc71f){return _0x1fc71f?{'count':_0x4c4bb4,'rows':_0x1fc71f}:null;}})['then'](respondWithResult(_0x5f6182,null))['catch'](handleError(_0x5f6182,null));};exports['getSubjects']=function(_0x4510fe,_0x4caf98,_0x50daca){var _0x29784f={};var _0x5091fc={};var _0x34af89;var _0x270f66;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x4510fe[_0xb59b('0x43')]['id']}})['then'](handleEntityNotFound(_0x4caf98,null))['then'](function(_0x15e8d4){if(_0x15e8d4){_0x34af89=_0x15e8d4;_0x5091fc[_0xb59b('0x31')]=_[_0xb59b('0x44')](db[_0xb59b('0x4c')][_0xb59b('0x2d')]);_0x5091fc['query']=_['keys'](_0x4510fe[_0xb59b('0x32')]);_0x5091fc[_0xb59b('0x33')]=_['intersection'](_0x5091fc[_0xb59b('0x31')],_0x5091fc[_0xb59b('0x32')]);_0x29784f[_0xb59b('0x35')]=_['intersection'](_0x5091fc[_0xb59b('0x31')],qs[_0xb59b('0x36')](_0x4510fe[_0xb59b('0x32')][_0xb59b('0x36')]));_0x29784f['attributes']=_0x29784f['attributes'][_0xb59b('0x37')]?_0x29784f[_0xb59b('0x35')]:_0x5091fc[_0xb59b('0x31')];_0x29784f[_0xb59b('0x39')]=qs[_0xb59b('0x3a')](_0x4510fe['query']['sort']);_0x29784f[_0xb59b('0x3b')]=qs['filters'](_[_0xb59b('0x3c')](_0x4510fe[_0xb59b('0x32')],_0x5091fc[_0xb59b('0x33')]));if(_0x4510fe[_0xb59b('0x32')]['filter']){_0x29784f[_0xb59b('0x3b')]=_[_0xb59b('0x3e')](_0x29784f[_0xb59b('0x3b')],{'$or':_['map'](_0x29784f[_0xb59b('0x35')],function(_0x452a29){var _0x2ee786={};_0x2ee786[_0x452a29]={'$like':'%'+_0x4510fe[_0xb59b('0x32')][_0xb59b('0x3d')]+'%'};return _0x2ee786;})});}_0x29784f=_[_0xb59b('0x3e')]({},_0x29784f,_0x4510fe[_0xb59b('0x46')]);return _0x34af89['getSubjects'](_0x29784f);}})['then'](function(_0x509e76){if(_0x509e76){_0x270f66=_0x509e76[_0xb59b('0x37')];if(!_0x4510fe['query'][_0xb59b('0x38')](_0xb59b('0x4d'))){_0x29784f[_0xb59b('0x1e')]=qs['limit'](_0x4510fe['query'][_0xb59b('0x1e')]);_0x29784f['offset']=qs[_0xb59b('0x1b')](_0x4510fe[_0xb59b('0x32')]['offset']);}return _0x34af89[_0xb59b('0x4e')](_0x29784f);}})[_0xb59b('0x24')](function(_0x89b4b1){if(_0x89b4b1){return _0x89b4b1?{'count':_0x270f66,'rows':_0x89b4b1}:null;}})[_0xb59b('0x24')](respondWithResult(_0x4caf98,null))[_0xb59b('0x41')](handleError(_0x4caf98,null));};exports[_0xb59b('0x4f')]=function(_0x3b9178,_0x2377a8,_0x489842){var _0x54ad8e={};var _0xe7df3a={};var _0x34f752;var _0x3f9bc8;return db[_0xb59b('0x2c')]['findOne']({'where':{'id':_0x3b9178[_0xb59b('0x43')]['id']}})[_0xb59b('0x24')](handleEntityNotFound(_0x2377a8,null))[_0xb59b('0x24')](function(_0x5d5ca9){if(_0x5d5ca9){_0x34f752=_0x5d5ca9;_0xe7df3a[_0xb59b('0x31')]=_['keys'](db[_0xb59b('0x4c')][_0xb59b('0x2d')]);_0xe7df3a[_0xb59b('0x32')]=_['keys'](_0x3b9178[_0xb59b('0x32')]);_0xe7df3a[_0xb59b('0x33')]=_['intersection'](_0xe7df3a['model'],_0xe7df3a[_0xb59b('0x32')]);_0x54ad8e[_0xb59b('0x35')]=_[_0xb59b('0x34')](_0xe7df3a[_0xb59b('0x31')],qs[_0xb59b('0x36')](_0x3b9178['query'][_0xb59b('0x36')]));_0x54ad8e[_0xb59b('0x35')]=_0x54ad8e[_0xb59b('0x35')]['length']?_0x54ad8e[_0xb59b('0x35')]:_0xe7df3a[_0xb59b('0x31')];_0x54ad8e[_0xb59b('0x39')]=qs[_0xb59b('0x3a')](_0x3b9178[_0xb59b('0x32')][_0xb59b('0x3a')]);_0x54ad8e[_0xb59b('0x3b')]=qs[_0xb59b('0x33')](_[_0xb59b('0x3c')](_0x3b9178['query'],_0xe7df3a['filters']));if(_0x3b9178['query'][_0xb59b('0x3d')]){_0x54ad8e[_0xb59b('0x3b')]=_[_0xb59b('0x3e')](_0x54ad8e[_0xb59b('0x3b')],{'$or':_[_0xb59b('0x2b')](_0x54ad8e['attributes'],function(_0x33694e){var _0x1aefe5={};_0x1aefe5[_0x33694e]={'$like':'%'+_0x3b9178[_0xb59b('0x32')][_0xb59b('0x3d')]+'%'};return _0x1aefe5;})});}_0x54ad8e=_[_0xb59b('0x3e')]({},_0x54ad8e,_0x3b9178['options']);return _0x34f752[_0xb59b('0x4f')](_0x54ad8e);}})['then'](function(_0x417907){if(_0x417907){_0x3f9bc8=_0x417907['length'];if(!_0x3b9178[_0xb59b('0x32')][_0xb59b('0x38')]('nolimit')){_0x54ad8e['limit']=qs[_0xb59b('0x1e')](_0x3b9178[_0xb59b('0x32')][_0xb59b('0x1e')]);_0x54ad8e[_0xb59b('0x1b')]=qs['offset'](_0x3b9178[_0xb59b('0x32')]['offset']);}return _0x34f752[_0xb59b('0x4f')](_0x54ad8e);}})[_0xb59b('0x24')](function(_0x4374a8){if(_0x4374a8){return _0x4374a8?{'count':_0x3f9bc8,'rows':_0x4374a8}:null;}})[_0xb59b('0x24')](respondWithResult(_0x2377a8,null))['catch'](handleError(_0x2377a8,null));}; \ No newline at end of file +var _0x32ef=['mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','sendStatus','error','stack','name','send','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','findOne','length','filter','getSubjects','SalesforceField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x441fa9,_0x4ee1f7){var _0x4ad04a=function(_0x4c6bd2){while(--_0x4c6bd2){_0x441fa9['push'](_0x441fa9['shift']());}};_0x4ad04a(++_0x4ee1f7);}(_0x32ef,0xf9));var _0xf32e=function(_0x508a6c,_0x2e41e8){_0x508a6c=_0x508a6c-0x0;var _0xa9214a=_0x32ef[_0x508a6c];return _0xa9214a;};'use strict';var emlformat=require(_0xf32e('0x0'));var rimraf=require(_0xf32e('0x1'));var zipdir=require(_0xf32e('0x2'));var jsonpatch=require(_0xf32e('0x3'));var rp=require(_0xf32e('0x4'));var moment=require(_0xf32e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf32e('0x6'));var util=require(_0xf32e('0x7'));var path=require('path');var sox=require(_0xf32e('0x8'));var csv=require(_0xf32e('0x9'));var ejs=require(_0xf32e('0xa'));var fs=require('fs');var fs_extra=require(_0xf32e('0xb'));var _=require(_0xf32e('0xc'));var squel=require(_0xf32e('0xd'));var crypto=require('crypto');var jsforce=require(_0xf32e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf32e('0x9'));var querystring=require(_0xf32e('0xf'));var Papa=require(_0xf32e('0x10'));var Redis=require(_0xf32e('0x11'));var authService=require(_0xf32e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf32e('0x13'));var hardwareService=require(_0xf32e('0x14'));var logger=require(_0xf32e('0x15'))(_0xf32e('0x16'));var utils=require(_0xf32e('0x17'));var config=require(_0xf32e('0x18'));var licenseUtil=require(_0xf32e('0x19'));var db=require(_0xf32e('0x1a'))['db'];function respondWithStatusCode(_0x319616,_0x1c1f52){_0x1c1f52=_0x1c1f52||0xcc;return function(_0xf7dc32){if(_0xf7dc32){return _0x319616['sendStatus'](_0x1c1f52);}return _0x319616[_0xf32e('0x1b')](_0x1c1f52)[_0xf32e('0x1c')]();};}function respondWithResult(_0x543072,_0x336e26){_0x336e26=_0x336e26||0xc8;return function(_0x35988d){if(_0x35988d){return _0x543072[_0xf32e('0x1b')](_0x336e26)['json'](_0x35988d);}};}function respondWithFilteredResult(_0xe324ad,_0x299efa){return function(_0x1dd008){if(_0x1dd008){var _0x400d25=typeof _0x299efa[_0xf32e('0x1d')]===_0xf32e('0x1e')&&typeof _0x299efa[_0xf32e('0x1f')]===_0xf32e('0x1e');var _0x21aa73=_0x1dd008['count'];var _0x3510ec=_0x400d25?0x0:_0x299efa[_0xf32e('0x1d')];var _0xb828b8=_0x400d25?_0x1dd008[_0xf32e('0x20')]:_0x299efa[_0xf32e('0x1d')]+_0x299efa[_0xf32e('0x1f')];var _0x2f909b;if(_0xb828b8>=_0x21aa73){_0xb828b8=_0x21aa73;_0x2f909b=0xc8;}else{_0x2f909b=0xce;}_0xe324ad[_0xf32e('0x1b')](_0x2f909b);return _0xe324ad[_0xf32e('0x21')](_0xf32e('0x22'),_0x3510ec+'-'+_0xb828b8+'/'+_0x21aa73)[_0xf32e('0x23')](_0x1dd008);}return null;};}function patchUpdates(_0x1b169e){return function(_0x3202e1){try{jsonpatch[_0xf32e('0x24')](_0x3202e1,_0x1b169e,!![]);}catch(_0x5f2e99){return BPromise['reject'](_0x5f2e99);}return _0x3202e1[_0xf32e('0x25')]();};}function saveUpdates(_0x57a8cb,_0x27b92c){return function(_0x2aaabf){if(_0x2aaabf){return _0x2aaabf[_0xf32e('0x26')](_0x57a8cb)[_0xf32e('0x27')](function(_0x35e34c){return _0x35e34c;});}return null;};}function removeEntity(_0x5409b4,_0x227405){return function(_0x4407f8){if(_0x4407f8){return _0x4407f8[_0xf32e('0x28')]()[_0xf32e('0x27')](function(){_0x5409b4['status'](0xcc)[_0xf32e('0x1c')]();});}};}function handleEntityNotFound(_0x1eb413,_0x2e8c34){return function(_0xe0a285){if(!_0xe0a285){_0x1eb413[_0xf32e('0x29')](0x194);}return _0xe0a285;};}function handleError(_0x15103f,_0x2f925b){_0x2f925b=_0x2f925b||0x1f4;return function(_0x1eb42e){logger[_0xf32e('0x2a')](_0x1eb42e[_0xf32e('0x2b')]);if(_0x1eb42e['name']){delete _0x1eb42e[_0xf32e('0x2c')];}_0x15103f[_0xf32e('0x1b')](_0x2f925b)[_0xf32e('0x2d')](_0x1eb42e);};}exports['index']=function(_0x419d13,_0x5bc6f2){var _0x1586d9={},_0x5c8779={},_0x439143={'count':0x0,'rows':[]};var _0x39965e=_[_0xf32e('0x2e')](db[_0xf32e('0x2f')][_0xf32e('0x30')],function(_0x4e64d4){return{'name':_0x4e64d4[_0xf32e('0x31')],'type':_0x4e64d4[_0xf32e('0x32')][_0xf32e('0x33')]};});_0x5c8779['model']=_[_0xf32e('0x2e')](_0x39965e,_0xf32e('0x2c'));_0x5c8779[_0xf32e('0x34')]=_[_0xf32e('0x35')](_0x419d13[_0xf32e('0x34')]);_0x5c8779[_0xf32e('0x36')]=_[_0xf32e('0x37')](_0x5c8779[_0xf32e('0x38')],_0x5c8779[_0xf32e('0x34')]);_0x1586d9[_0xf32e('0x39')]=_[_0xf32e('0x37')](_0x5c8779[_0xf32e('0x38')],qs[_0xf32e('0x3a')](_0x419d13['query'][_0xf32e('0x3a')]));_0x1586d9['attributes']=_0x1586d9[_0xf32e('0x39')]['length']?_0x1586d9['attributes']:_0x5c8779[_0xf32e('0x38')];if(!_0x419d13[_0xf32e('0x34')][_0xf32e('0x3b')](_0xf32e('0x3c'))){_0x1586d9[_0xf32e('0x1f')]=qs['limit'](_0x419d13[_0xf32e('0x34')][_0xf32e('0x1f')]);_0x1586d9[_0xf32e('0x1d')]=qs[_0xf32e('0x1d')](_0x419d13['query'][_0xf32e('0x1d')]);}_0x1586d9[_0xf32e('0x3d')]=qs[_0xf32e('0x3e')](_0x419d13[_0xf32e('0x34')][_0xf32e('0x3e')]);_0x1586d9['where']=qs[_0xf32e('0x36')](_[_0xf32e('0x3f')](_0x419d13[_0xf32e('0x34')],_0x5c8779['filters']),_0x39965e);if(_0x419d13[_0xf32e('0x34')]['filter']){_0x1586d9[_0xf32e('0x40')]=_[_0xf32e('0x41')](_0x1586d9[_0xf32e('0x40')],{'$or':_['map'](_0x39965e,function(_0x409701){if(_0x409701[_0xf32e('0x32')]!==_0xf32e('0x42')){var _0x4a623={};_0x4a623[_0x409701[_0xf32e('0x2c')]]={'$like':'%'+_0x419d13[_0xf32e('0x34')]['filter']+'%'};return _0x4a623;}})});}_0x1586d9=_[_0xf32e('0x41')]({},_0x1586d9,_0x419d13[_0xf32e('0x43')]);var _0x477a98={'where':_0x1586d9[_0xf32e('0x40')]};return db[_0xf32e('0x2f')][_0xf32e('0x20')](_0x477a98)[_0xf32e('0x27')](function(_0x56bf88){_0x439143[_0xf32e('0x20')]=_0x56bf88;if(_0x419d13[_0xf32e('0x34')][_0xf32e('0x44')]){_0x1586d9[_0xf32e('0x45')]=[{'all':!![]}];}return db[_0xf32e('0x2f')][_0xf32e('0x46')](_0x1586d9);})[_0xf32e('0x27')](function(_0x546b80){_0x439143[_0xf32e('0x47')]=_0x546b80;return _0x439143;})[_0xf32e('0x27')](respondWithFilteredResult(_0x5bc6f2,_0x1586d9))[_0xf32e('0x48')](handleError(_0x5bc6f2,null));};exports[_0xf32e('0x49')]=function(_0x417a90,_0x453e24){var _0x1bff7b={'raw':![],'where':{'id':_0x417a90[_0xf32e('0x4a')]['id']}},_0x3ce422={};_0x3ce422[_0xf32e('0x38')]=_['keys'](db[_0xf32e('0x2f')][_0xf32e('0x30')]);_0x3ce422[_0xf32e('0x34')]=_[_0xf32e('0x35')](_0x417a90[_0xf32e('0x34')]);_0x3ce422[_0xf32e('0x36')]=_['intersection'](_0x3ce422[_0xf32e('0x38')],_0x3ce422[_0xf32e('0x34')]);_0x1bff7b[_0xf32e('0x39')]=_[_0xf32e('0x37')](_0x3ce422[_0xf32e('0x38')],qs['fields'](_0x417a90[_0xf32e('0x34')]['fields']));_0x1bff7b[_0xf32e('0x39')]=_0x1bff7b[_0xf32e('0x39')]['length']?_0x1bff7b[_0xf32e('0x39')]:_0x3ce422['model'];if(_0x417a90['query']['includeAll']){_0x1bff7b[_0xf32e('0x45')]=[{'all':!![]}];}_0x1bff7b=_[_0xf32e('0x41')]({},_0x1bff7b,_0x417a90[_0xf32e('0x43')]);return db[_0xf32e('0x2f')][_0xf32e('0x4b')](_0x1bff7b)[_0xf32e('0x27')](handleEntityNotFound(_0x453e24,null))[_0xf32e('0x27')](respondWithResult(_0x453e24,null))[_0xf32e('0x48')](handleError(_0x453e24,null));};exports[_0xf32e('0x4c')]=function(_0x3c952c,_0x40f168){return db[_0xf32e('0x2f')][_0xf32e('0x4c')](_0x3c952c[_0xf32e('0x4d')],{})['then'](respondWithResult(_0x40f168,0xc9))[_0xf32e('0x48')](handleError(_0x40f168,null));};exports[_0xf32e('0x26')]=function(_0xc83c9f,_0x4b15be){if(_0xc83c9f['body']['id']){delete _0xc83c9f['body']['id'];}return db[_0xf32e('0x2f')][_0xf32e('0x4b')]({'where':{'id':_0xc83c9f['params']['id']}})[_0xf32e('0x27')](handleEntityNotFound(_0x4b15be,null))[_0xf32e('0x27')](saveUpdates(_0xc83c9f['body'],null))[_0xf32e('0x27')](respondWithResult(_0x4b15be,null))[_0xf32e('0x48')](handleError(_0x4b15be,null));};exports[_0xf32e('0x28')]=function(_0x36015b,_0x2db8bc){return db[_0xf32e('0x2f')]['find']({'where':{'id':_0x36015b[_0xf32e('0x4a')]['id']}})[_0xf32e('0x27')](handleEntityNotFound(_0x2db8bc,null))[_0xf32e('0x27')](removeEntity(_0x2db8bc,null))['catch'](handleError(_0x2db8bc,null));};exports[_0xf32e('0x4e')]=function(_0xfd3f05,_0x2dda15,_0x5a5347){var _0x5c022d={};var _0x4e8220={};var _0x3cb16b;var _0xb49f79;return db[_0xf32e('0x2f')][_0xf32e('0x4f')]({'where':{'id':_0xfd3f05['params']['id']}})[_0xf32e('0x27')](handleEntityNotFound(_0x2dda15,null))[_0xf32e('0x27')](function(_0x3312ae){if(_0x3312ae){_0x3cb16b=_0x3312ae;_0x4e8220[_0xf32e('0x38')]=_[_0xf32e('0x35')](db['SalesforceField'][_0xf32e('0x30')]);_0x4e8220[_0xf32e('0x34')]=_[_0xf32e('0x35')](_0xfd3f05[_0xf32e('0x34')]);_0x4e8220['filters']=_[_0xf32e('0x37')](_0x4e8220['model'],_0x4e8220['query']);_0x5c022d[_0xf32e('0x39')]=_[_0xf32e('0x37')](_0x4e8220[_0xf32e('0x38')],qs[_0xf32e('0x3a')](_0xfd3f05[_0xf32e('0x34')][_0xf32e('0x3a')]));_0x5c022d[_0xf32e('0x39')]=_0x5c022d[_0xf32e('0x39')][_0xf32e('0x50')]?_0x5c022d[_0xf32e('0x39')]:_0x4e8220[_0xf32e('0x38')];_0x5c022d[_0xf32e('0x3d')]=qs['sort'](_0xfd3f05[_0xf32e('0x34')]['sort']);_0x5c022d[_0xf32e('0x40')]=qs['filters'](_[_0xf32e('0x3f')](_0xfd3f05[_0xf32e('0x34')],_0x4e8220[_0xf32e('0x36')]));if(_0xfd3f05['query'][_0xf32e('0x51')]){_0x5c022d[_0xf32e('0x40')]=_['merge'](_0x5c022d['where'],{'$or':_['map'](_0x5c022d[_0xf32e('0x39')],function(_0x3666b8){var _0x3bfacd={};_0x3bfacd[_0x3666b8]={'$like':'%'+_0xfd3f05[_0xf32e('0x34')][_0xf32e('0x51')]+'%'};return _0x3bfacd;})});}_0x5c022d=_[_0xf32e('0x41')]({},_0x5c022d,_0xfd3f05['options']);return _0x3cb16b[_0xf32e('0x4e')](_0x5c022d);}})['then'](function(_0x58a332){if(_0x58a332){_0xb49f79=_0x58a332[_0xf32e('0x50')];if(!_0xfd3f05[_0xf32e('0x34')][_0xf32e('0x3b')]('nolimit')){_0x5c022d[_0xf32e('0x1f')]=qs[_0xf32e('0x1f')](_0xfd3f05['query'][_0xf32e('0x1f')]);_0x5c022d['offset']=qs[_0xf32e('0x1d')](_0xfd3f05[_0xf32e('0x34')][_0xf32e('0x1d')]);}return _0x3cb16b[_0xf32e('0x4e')](_0x5c022d);}})[_0xf32e('0x27')](function(_0x57bf56){if(_0x57bf56){return _0x57bf56?{'count':_0xb49f79,'rows':_0x57bf56}:null;}})[_0xf32e('0x27')](respondWithResult(_0x2dda15,null))[_0xf32e('0x48')](handleError(_0x2dda15,null));};exports[_0xf32e('0x52')]=function(_0x30bdbe,_0x4c035a,_0x41f247){var _0x20de62={};var _0x1eb100={};var _0x5daa21;var _0x1d6b59;return db['SalesforceConfiguration'][_0xf32e('0x4f')]({'where':{'id':_0x30bdbe[_0xf32e('0x4a')]['id']}})[_0xf32e('0x27')](handleEntityNotFound(_0x4c035a,null))[_0xf32e('0x27')](function(_0x22809c){if(_0x22809c){_0x5daa21=_0x22809c;_0x1eb100[_0xf32e('0x38')]=_[_0xf32e('0x35')](db[_0xf32e('0x53')][_0xf32e('0x30')]);_0x1eb100[_0xf32e('0x34')]=_[_0xf32e('0x35')](_0x30bdbe['query']);_0x1eb100[_0xf32e('0x36')]=_[_0xf32e('0x37')](_0x1eb100[_0xf32e('0x38')],_0x1eb100[_0xf32e('0x34')]);_0x20de62['attributes']=_['intersection'](_0x1eb100['model'],qs['fields'](_0x30bdbe[_0xf32e('0x34')][_0xf32e('0x3a')]));_0x20de62[_0xf32e('0x39')]=_0x20de62[_0xf32e('0x39')][_0xf32e('0x50')]?_0x20de62[_0xf32e('0x39')]:_0x1eb100['model'];_0x20de62[_0xf32e('0x3d')]=qs[_0xf32e('0x3e')](_0x30bdbe[_0xf32e('0x34')]['sort']);_0x20de62['where']=qs['filters'](_['pick'](_0x30bdbe[_0xf32e('0x34')],_0x1eb100[_0xf32e('0x36')]));if(_0x30bdbe[_0xf32e('0x34')][_0xf32e('0x51')]){_0x20de62['where']=_[_0xf32e('0x41')](_0x20de62[_0xf32e('0x40')],{'$or':_[_0xf32e('0x2e')](_0x20de62[_0xf32e('0x39')],function(_0x5b7e6f){var _0x1b1101={};_0x1b1101[_0x5b7e6f]={'$like':'%'+_0x30bdbe[_0xf32e('0x34')][_0xf32e('0x51')]+'%'};return _0x1b1101;})});}_0x20de62=_[_0xf32e('0x41')]({},_0x20de62,_0x30bdbe[_0xf32e('0x43')]);return _0x5daa21[_0xf32e('0x52')](_0x20de62);}})[_0xf32e('0x27')](function(_0x486424){if(_0x486424){_0x1d6b59=_0x486424['length'];if(!_0x30bdbe[_0xf32e('0x34')][_0xf32e('0x3b')](_0xf32e('0x3c'))){_0x20de62[_0xf32e('0x1f')]=qs[_0xf32e('0x1f')](_0x30bdbe[_0xf32e('0x34')][_0xf32e('0x1f')]);_0x20de62['offset']=qs[_0xf32e('0x1d')](_0x30bdbe[_0xf32e('0x34')][_0xf32e('0x1d')]);}return _0x5daa21[_0xf32e('0x52')](_0x20de62);}})['then'](function(_0x188df4){if(_0x188df4){return _0x188df4?{'count':_0x1d6b59,'rows':_0x188df4}:null;}})[_0xf32e('0x27')](respondWithResult(_0x4c035a,null))[_0xf32e('0x48')](handleError(_0x4c035a,null));};exports[_0xf32e('0x54')]=function(_0x5b1423,_0x39bed2,_0x37b93b){var _0x3bb3e8={};var _0xe67bf1={};var _0x417113;var _0x46786e;return db[_0xf32e('0x2f')]['findOne']({'where':{'id':_0x5b1423[_0xf32e('0x4a')]['id']}})[_0xf32e('0x27')](handleEntityNotFound(_0x39bed2,null))[_0xf32e('0x27')](function(_0x6176e9){if(_0x6176e9){_0x417113=_0x6176e9;_0xe67bf1['model']=_[_0xf32e('0x35')](db['SalesforceField'][_0xf32e('0x30')]);_0xe67bf1[_0xf32e('0x34')]=_[_0xf32e('0x35')](_0x5b1423[_0xf32e('0x34')]);_0xe67bf1[_0xf32e('0x36')]=_[_0xf32e('0x37')](_0xe67bf1[_0xf32e('0x38')],_0xe67bf1['query']);_0x3bb3e8[_0xf32e('0x39')]=_['intersection'](_0xe67bf1[_0xf32e('0x38')],qs[_0xf32e('0x3a')](_0x5b1423[_0xf32e('0x34')][_0xf32e('0x3a')]));_0x3bb3e8[_0xf32e('0x39')]=_0x3bb3e8[_0xf32e('0x39')][_0xf32e('0x50')]?_0x3bb3e8[_0xf32e('0x39')]:_0xe67bf1[_0xf32e('0x38')];_0x3bb3e8['order']=qs['sort'](_0x5b1423['query']['sort']);_0x3bb3e8[_0xf32e('0x40')]=qs[_0xf32e('0x36')](_[_0xf32e('0x3f')](_0x5b1423['query'],_0xe67bf1[_0xf32e('0x36')]));if(_0x5b1423[_0xf32e('0x34')][_0xf32e('0x51')]){_0x3bb3e8[_0xf32e('0x40')]=_[_0xf32e('0x41')](_0x3bb3e8['where'],{'$or':_['map'](_0x3bb3e8[_0xf32e('0x39')],function(_0xee8286){var _0x21455d={};_0x21455d[_0xee8286]={'$like':'%'+_0x5b1423[_0xf32e('0x34')]['filter']+'%'};return _0x21455d;})});}_0x3bb3e8=_[_0xf32e('0x41')]({},_0x3bb3e8,_0x5b1423['options']);return _0x417113[_0xf32e('0x54')](_0x3bb3e8);}})['then'](function(_0x38f77c){if(_0x38f77c){_0x46786e=_0x38f77c[_0xf32e('0x50')];if(!_0x5b1423[_0xf32e('0x34')][_0xf32e('0x3b')](_0xf32e('0x3c'))){_0x3bb3e8[_0xf32e('0x1f')]=qs[_0xf32e('0x1f')](_0x5b1423['query'][_0xf32e('0x1f')]);_0x3bb3e8[_0xf32e('0x1d')]=qs['offset'](_0x5b1423[_0xf32e('0x34')][_0xf32e('0x1d')]);}return _0x417113[_0xf32e('0x54')](_0x3bb3e8);}})[_0xf32e('0x27')](function(_0x5766ff){if(_0x5766ff){return _0x5766ff?{'count':_0x46786e,'rows':_0x5766ff}:null;}})['then'](respondWithResult(_0x39bed2,null))[_0xf32e('0x48')](handleError(_0x39bed2,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index db5bcdc..607555b 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 _0x7712=['./intSalesforceConfiguration.attributes','exports','define','int_salesforce_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x8c52f2,_0x23bfe4){var _0x549e0c=function(_0xe8e58e){while(--_0xe8e58e){_0x8c52f2['push'](_0x8c52f2['shift']());}};_0x549e0c(++_0x23bfe4);}(_0x7712,0xe1));var _0x2771=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7712[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x2771('0x0'));var util=require(_0x2771('0x1'));var logger=require(_0x2771('0x2'))('api');var moment=require(_0x2771('0x3'));var BPromise=require(_0x2771('0x4'));var rp=require(_0x2771('0x5'));var fs=require('fs');var path=require(_0x2771('0x6'));var rimraf=require(_0x2771('0x7'));var config=require(_0x2771('0x8'));var attributes=require(_0x2771('0x9'));module[_0x2771('0xa')]=function(_0x45cc8f,_0x34e121){return _0x45cc8f[_0x2771('0xb')]('SalesforceConfiguration',attributes,{'tableName':_0x2771('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f3f=['request-promise','path','rimraf','../../config/environment','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x10a3b1,_0x4c87f1){var _0x5547a0=function(_0x4bc478){while(--_0x4bc478){_0x10a3b1['push'](_0x10a3b1['shift']());}};_0x5547a0(++_0x4c87f1);}(_0x7f3f,0xa3));var _0xf7f3=function(_0x56c70f,_0x4e4493){_0x56c70f=_0x56c70f-0x0;var _0x3812ed=_0x7f3f[_0x56c70f];return _0x3812ed;};'use strict';var _=require(_0xf7f3('0x0'));var util=require(_0xf7f3('0x1'));var logger=require(_0xf7f3('0x2'))(_0xf7f3('0x3'));var moment=require(_0xf7f3('0x4'));var BPromise=require(_0xf7f3('0x5'));var rp=require(_0xf7f3('0x6'));var fs=require('fs');var path=require(_0xf7f3('0x7'));var rimraf=require(_0xf7f3('0x8'));var config=require(_0xf7f3('0x9'));var attributes=require('./intSalesforceConfiguration.attributes');module['exports']=function(_0x3721e3,_0xcc6e77){return _0x3721e3[_0xf7f3('0xa')](_0xf7f3('0xb'),attributes,{'tableName':_0xf7f3('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 5394498..0007ea4 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 _0x1ba1=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','SalesforceConfiguration,\x20%s,\x20%s','result','catch'];(function(_0x549803,_0xbe1be3){var _0x2af6ec=function(_0x3262ba){while(--_0x3262ba){_0x549803['push'](_0x549803['shift']());}};_0x2af6ec(++_0xbe1be3);}(_0x1ba1,0x1b0));var _0x11ba=function(_0x158982,_0x2633d1){_0x158982=_0x158982-0x0;var _0x133e0e=_0x1ba1[_0x158982];return _0x133e0e;};'use strict';var _=require(_0x11ba('0x0'));var util=require(_0x11ba('0x1'));var moment=require(_0x11ba('0x2'));var BPromise=require(_0x11ba('0x3'));var rs=require(_0x11ba('0x4'));var fs=require('fs');var Redis=require(_0x11ba('0x5'));var db=require(_0x11ba('0x6'))['db'];var utils=require(_0x11ba('0x7'));var logger=require(_0x11ba('0x8'))(_0x11ba('0x9'));var config=require('../../config/environment');var jayson=require(_0x11ba('0xa'));var client=jayson[_0x11ba('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34f198,_0x12b4d7,_0x434631){return new BPromise(function(_0x4868cb,_0x44c79c){return client[_0x11ba('0xc')](_0x34f198,_0x434631)[_0x11ba('0xd')](function(_0x229d1b){logger[_0x11ba('0xe')]('SalesforceConfiguration,\x20%s,\x20%s',_0x12b4d7,_0x11ba('0xf'));logger[_0x11ba('0x10')](_0x11ba('0x11'),_0x12b4d7,_0x11ba('0xf'),JSON[_0x11ba('0x12')](_0x229d1b));if(_0x229d1b['error']){if(_0x229d1b['error']['code']===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x12b4d7,_0x229d1b[_0x11ba('0x13')]['message']);return _0x44c79c(_0x229d1b['error'][_0x11ba('0x14')]);}logger[_0x11ba('0x13')](_0x11ba('0x15'),_0x12b4d7,_0x229d1b['error'][_0x11ba('0x14')]);return _0x4868cb(_0x229d1b[_0x11ba('0x13')][_0x11ba('0x14')]);}else{logger[_0x11ba('0xe')]('SalesforceConfiguration,\x20%s,\x20%s',_0x12b4d7,_0x11ba('0xf'));_0x4868cb(_0x229d1b[_0x11ba('0x16')][_0x11ba('0x14')]);}})[_0x11ba('0x17')](function(_0xdccaa4){logger[_0x11ba('0x13')]('SalesforceConfiguration,\x20%s,\x20%s',_0x12b4d7,_0xdccaa4);_0x44c79c(_0xdccaa4);});});} \ No newline at end of file +var _0xc67a=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','catch','moment','bluebird'];(function(_0x3c2863,_0x112b6f){var _0x136ab8=function(_0x1cfdf9){while(--_0x1cfdf9){_0x3c2863['push'](_0x3c2863['shift']());}};_0x136ab8(++_0x112b6f);}(_0xc67a,0x1cc));var _0xac67=function(_0x126a16,_0x545657){_0x126a16=_0x126a16-0x0;var _0x15ef5b=_0xc67a[_0x126a16];return _0x15ef5b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xac67('0x0'));var BPromise=require(_0xac67('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xac67('0x2'));var db=require(_0xac67('0x3'))['db'];var utils=require(_0xac67('0x4'));var logger=require('../../config/logger')(_0xac67('0x5'));var config=require(_0xac67('0x6'));var jayson=require(_0xac67('0x7'));var client=jayson[_0xac67('0x8')][_0xac67('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d2798,_0xdf1d47,_0xa91f23){return new BPromise(function(_0xe5f4df,_0x4d3711){return client[_0xac67('0xa')](_0x5d2798,_0xa91f23)[_0xac67('0xb')](function(_0x540a40){logger[_0xac67('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0xdf1d47,_0xac67('0xd'));logger[_0xac67('0xe')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0xdf1d47,_0xac67('0xd'),JSON[_0xac67('0xf')](_0x540a40));if(_0x540a40['error']){if(_0x540a40[_0xac67('0x10')][_0xac67('0x11')]===0x1f4){logger[_0xac67('0x10')](_0xac67('0x12'),_0xdf1d47,_0x540a40[_0xac67('0x10')]['message']);return _0x4d3711(_0x540a40[_0xac67('0x10')][_0xac67('0x13')]);}logger[_0xac67('0x10')](_0xac67('0x12'),_0xdf1d47,_0x540a40['error'][_0xac67('0x13')]);return _0xe5f4df(_0x540a40[_0xac67('0x10')][_0xac67('0x13')]);}else{logger[_0xac67('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0xdf1d47,_0xac67('0xd'));_0xe5f4df(_0x540a40['result'][_0xac67('0x13')]);}})[_0xac67('0x14')](function(_0x2f8409){logger[_0xac67('0x10')](_0xac67('0x12'),_0xdf1d47,_0x2f8409);_0x4d3711(_0x2f8409);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 2f3ffe7..adcf9df 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 _0x0233=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post','put','update','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0233,0x17a));var _0x3023=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0x0233[_0x2080a3];return _0x8d7d17;};'use strict';var multer=require(_0x3023('0x0'));var util=require(_0x3023('0x1'));var path=require(_0x3023('0x2'));var timeout=require(_0x3023('0x3'));var express=require(_0x3023('0x4'));var router=express[_0x3023('0x5')]();var fs_extra=require(_0x3023('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x3023('0x7'));var config=require('../../config/environment');var controller=require(_0x3023('0x8'));router[_0x3023('0x9')]('/',auth[_0x3023('0xa')](),controller[_0x3023('0xb')]);router[_0x3023('0x9')](_0x3023('0xc'),auth['isAuthenticated'](),controller[_0x3023('0xd')]);router[_0x3023('0xe')]('/',auth[_0x3023('0xa')](),controller['create']);router[_0x3023('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x3023('0x10')]);router['delete'](_0x3023('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x3023('0x11')]=router; \ No newline at end of file +var _0xeacc=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','isAuthenticated','index','get','show','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x5e4760,_0x16db56){var _0x3b1515=function(_0x493dab){while(--_0x493dab){_0x5e4760['push'](_0x5e4760['shift']());}};_0x3b1515(++_0x16db56);}(_0xeacc,0xe4));var _0xceac=function(_0x17a39b,_0x255da4){_0x17a39b=_0x17a39b-0x0;var _0x4e6603=_0xeacc[_0x17a39b];return _0x4e6603;};'use strict';var multer=require('multer');var util=require(_0xceac('0x0'));var path=require(_0xceac('0x1'));var timeout=require(_0xceac('0x2'));var express=require('express');var router=express[_0xceac('0x3')]();var fs_extra=require(_0xceac('0x4'));var auth=require(_0xceac('0x5'));var interaction=require(_0xceac('0x6'));var config=require(_0xceac('0x7'));var controller=require(_0xceac('0x8'));router['get']('/',auth[_0xceac('0x9')](),controller[_0xceac('0xa')]);router[_0xceac('0xb')]('/:id',auth[_0xceac('0x9')](),controller[_0xceac('0xc')]);router[_0xceac('0xd')]('/',auth['isAuthenticated'](),controller[_0xceac('0xe')]);router[_0xceac('0xf')](_0xceac('0x10'),auth[_0xceac('0x9')](),controller[_0xceac('0x11')]);router[_0xceac('0x12')](_0xceac('0x10'),auth[_0xceac('0x9')](),controller[_0xceac('0x13')]);module[_0xceac('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index bc605b3..7458e41 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 _0xeacf=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','sequelize'];(function(_0x5643cd,_0x59e5c3){var _0x34b0ae=function(_0x15c975){while(--_0x15c975){_0x5643cd['push'](_0x5643cd['shift']());}};_0x34b0ae(++_0x59e5c3);}(_0xeacf,0x127));var _0xfeac=function(_0x18a436,_0x1dbe06){_0x18a436=_0x18a436-0x0;var _0x5c2cf8=_0xeacf[_0x18a436];return _0x5c2cf8;};'use strict';var Sequelize=require(_0xfeac('0x0'));module['exports']={'type':{'type':Sequelize[_0xfeac('0x1')](_0xfeac('0x2'),_0xfeac('0x3'),_0xfeac('0x4'),_0xfeac('0x5'),_0xfeac('0x6')),'defaultValue':_0xfeac('0x2')},'content':{'type':Sequelize[_0xfeac('0x7')]},'key':{'type':Sequelize[_0xfeac('0x7')]},'keyType':{'type':Sequelize['ENUM']('string',_0xfeac('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xfeac('0x7')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0xfeac('0x7')]}}; \ No newline at end of file +var _0x773e=['STRING','ENUM','string','variable','keyValue','picklist'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x773e,0x16f));var _0xe773=function(_0x5e64f9,_0x13c61d){_0x5e64f9=_0x5e64f9-0x0;var _0x3e9b8a=_0x773e[_0x5e64f9];return _0x3e9b8a;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xe773('0x0')](_0xe773('0x1'),_0xe773('0x2'),'customVariable',_0xe773('0x3'),_0xe773('0x4')),'defaultValue':_0xe773('0x1')},'content':{'type':Sequelize[_0xe773('0x5')]},'key':{'type':Sequelize[_0xe773('0x5')]},'keyType':{'type':Sequelize['ENUM']('string',_0xe773('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0xe773('0x5')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0xe773('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 360cc74..f35575d 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 _0x43ee=['attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','Content-Range','apply','update','destroy','then','sendStatus','error','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','filters','intersection','query'];(function(_0x418321,_0x52b4f1){var _0x402cbd=function(_0x3f597a){while(--_0x3f597a){_0x418321['push'](_0x418321['shift']());}};_0x402cbd(++_0x52b4f1);}(_0x43ee,0x193));var _0xe43e=function(_0x5d6e30,_0xc21d51){_0x5d6e30=_0x5d6e30-0x0;var _0x3d3f3b=_0x43ee[_0x5d6e30];return _0x3d3f3b;};'use strict';var emlformat=require(_0xe43e('0x0'));var rimraf=require(_0xe43e('0x1'));var zipdir=require(_0xe43e('0x2'));var jsonpatch=require(_0xe43e('0x3'));var rp=require(_0xe43e('0x4'));var moment=require(_0xe43e('0x5'));var BPromise=require(_0xe43e('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe43e('0x7'));var sox=require(_0xe43e('0x8'));var csv=require('to-csv');var ejs=require(_0xe43e('0x9'));var fs=require('fs');var fs_extra=require(_0xe43e('0xa'));var _=require(_0xe43e('0xb'));var squel=require('squel');var crypto=require(_0xe43e('0xc'));var jsforce=require(_0xe43e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe43e('0xe'));var querystring=require(_0xe43e('0xf'));var Papa=require(_0xe43e('0x10'));var Redis=require('ioredis');var authService=require(_0xe43e('0x11'));var qs=require(_0xe43e('0x12'));var as=require(_0xe43e('0x13'));var hardwareService=require(_0xe43e('0x14'));var logger=require(_0xe43e('0x15'))(_0xe43e('0x16'));var utils=require(_0xe43e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xe43e('0x18'));var db=require(_0xe43e('0x19'))['db'];function respondWithStatusCode(_0x371dd5,_0x33e7fa){_0x33e7fa=_0x33e7fa||0xcc;return function(_0x248c19){if(_0x248c19){return _0x371dd5['sendStatus'](_0x33e7fa);}return _0x371dd5[_0xe43e('0x1a')](_0x33e7fa)[_0xe43e('0x1b')]();};}function respondWithResult(_0x94bbff,_0x422dee){_0x422dee=_0x422dee||0xc8;return function(_0x112221){if(_0x112221){return _0x94bbff[_0xe43e('0x1a')](_0x422dee)[_0xe43e('0x1c')](_0x112221);}};}function respondWithFilteredResult(_0x49d688,_0x9f563d){return function(_0x2b6452){if(_0x2b6452){var _0x402aea=typeof _0x9f563d[_0xe43e('0x1d')]==='undefined'&&typeof _0x9f563d[_0xe43e('0x1e')]===_0xe43e('0x1f');var _0x2dc23c=_0x2b6452[_0xe43e('0x20')];var _0x574dc6=_0x402aea?0x0:_0x9f563d[_0xe43e('0x1d')];var _0x34268d=_0x402aea?_0x2b6452[_0xe43e('0x20')]:_0x9f563d[_0xe43e('0x1d')]+_0x9f563d['limit'];var _0x555cac;if(_0x34268d>=_0x2dc23c){_0x34268d=_0x2dc23c;_0x555cac=0xc8;}else{_0x555cac=0xce;}_0x49d688[_0xe43e('0x1a')](_0x555cac);return _0x49d688['set'](_0xe43e('0x21'),_0x574dc6+'-'+_0x34268d+'/'+_0x2dc23c)[_0xe43e('0x1c')](_0x2b6452);}return null;};}function patchUpdates(_0x123ef9){return function(_0x24fb9d){try{jsonpatch[_0xe43e('0x22')](_0x24fb9d,_0x123ef9,!![]);}catch(_0x15cd56){return BPromise['reject'](_0x15cd56);}return _0x24fb9d['save']();};}function saveUpdates(_0x5dfc0e,_0x2a2961){return function(_0x298f69){if(_0x298f69){return _0x298f69[_0xe43e('0x23')](_0x5dfc0e)['then'](function(_0xdbf677){return _0xdbf677;});}return null;};}function removeEntity(_0x5f4469,_0xa25de9){return function(_0x42b440){if(_0x42b440){return _0x42b440[_0xe43e('0x24')]()[_0xe43e('0x25')](function(){_0x5f4469[_0xe43e('0x1a')](0xcc)[_0xe43e('0x1b')]();});}};}function handleEntityNotFound(_0x5edc66,_0x172a62){return function(_0x372072){if(!_0x372072){_0x5edc66[_0xe43e('0x26')](0x194);}return _0x372072;};}function handleError(_0x23a218,_0x5a8aa9){_0x5a8aa9=_0x5a8aa9||0x1f4;return function(_0x2f5e4d){logger[_0xe43e('0x27')](_0x2f5e4d['stack']);if(_0x2f5e4d[_0xe43e('0x28')]){delete _0x2f5e4d[_0xe43e('0x28')];}_0x23a218[_0xe43e('0x1a')](_0x5a8aa9)[_0xe43e('0x29')](_0x2f5e4d);};}exports[_0xe43e('0x2a')]=function(_0x4a8d79,_0x33b5f8){var _0x53d10c={},_0x4f5b6f={},_0x1f1ca1={'count':0x0,'rows':[]};var _0x47e42d=_[_0xe43e('0x2b')](db[_0xe43e('0x2c')][_0xe43e('0x2d')],function(_0x306184){return{'name':_0x306184[_0xe43e('0x2e')],'type':_0x306184[_0xe43e('0x2f')][_0xe43e('0x30')]};});_0x4f5b6f[_0xe43e('0x31')]=_[_0xe43e('0x2b')](_0x47e42d,_0xe43e('0x28'));_0x4f5b6f['query']=_['keys'](_0x4a8d79['query']);_0x4f5b6f[_0xe43e('0x32')]=_[_0xe43e('0x33')](_0x4f5b6f['model'],_0x4f5b6f[_0xe43e('0x34')]);_0x53d10c[_0xe43e('0x35')]=_[_0xe43e('0x33')](_0x4f5b6f[_0xe43e('0x31')],qs['fields'](_0x4a8d79['query'][_0xe43e('0x36')]));_0x53d10c[_0xe43e('0x35')]=_0x53d10c[_0xe43e('0x35')][_0xe43e('0x37')]?_0x53d10c[_0xe43e('0x35')]:_0x4f5b6f[_0xe43e('0x31')];if(!_0x4a8d79['query']['hasOwnProperty'](_0xe43e('0x38'))){_0x53d10c['limit']=qs[_0xe43e('0x1e')](_0x4a8d79[_0xe43e('0x34')][_0xe43e('0x1e')]);_0x53d10c[_0xe43e('0x1d')]=qs[_0xe43e('0x1d')](_0x4a8d79[_0xe43e('0x34')][_0xe43e('0x1d')]);}_0x53d10c[_0xe43e('0x39')]=qs[_0xe43e('0x3a')](_0x4a8d79[_0xe43e('0x34')][_0xe43e('0x3a')]);_0x53d10c[_0xe43e('0x3b')]=qs[_0xe43e('0x32')](_[_0xe43e('0x3c')](_0x4a8d79['query'],_0x4f5b6f[_0xe43e('0x32')]),_0x47e42d);if(_0x4a8d79[_0xe43e('0x34')][_0xe43e('0x3d')]){_0x53d10c[_0xe43e('0x3b')]=_[_0xe43e('0x3e')](_0x53d10c[_0xe43e('0x3b')],{'$or':_['map'](_0x47e42d,function(_0x140de6){if(_0x140de6['type']!==_0xe43e('0x3f')){var _0x53cdc6={};_0x53cdc6[_0x140de6['name']]={'$like':'%'+_0x4a8d79['query'][_0xe43e('0x3d')]+'%'};return _0x53cdc6;}})});}_0x53d10c=_[_0xe43e('0x3e')]({},_0x53d10c,_0x4a8d79[_0xe43e('0x40')]);var _0x4513ac={'where':_0x53d10c[_0xe43e('0x3b')]};return db[_0xe43e('0x2c')]['count'](_0x4513ac)[_0xe43e('0x25')](function(_0x915b2b){_0x1f1ca1[_0xe43e('0x20')]=_0x915b2b;if(_0x4a8d79['query'][_0xe43e('0x41')]){_0x53d10c['include']=[{'all':!![]}];}return db[_0xe43e('0x2c')][_0xe43e('0x42')](_0x53d10c);})[_0xe43e('0x25')](function(_0xa801f8){_0x1f1ca1[_0xe43e('0x43')]=_0xa801f8;return _0x1f1ca1;})['then'](respondWithFilteredResult(_0x33b5f8,_0x53d10c))[_0xe43e('0x44')](handleError(_0x33b5f8,null));};exports[_0xe43e('0x45')]=function(_0xf34341,_0xd1305c){var _0x2cd69a={'raw':!![],'where':{'id':_0xf34341[_0xe43e('0x46')]['id']}},_0x40315f={};_0x40315f[_0xe43e('0x31')]=_[_0xe43e('0x47')](db[_0xe43e('0x2c')][_0xe43e('0x2d')]);_0x40315f[_0xe43e('0x34')]=_[_0xe43e('0x47')](_0xf34341['query']);_0x40315f[_0xe43e('0x32')]=_[_0xe43e('0x33')](_0x40315f[_0xe43e('0x31')],_0x40315f['query']);_0x2cd69a[_0xe43e('0x35')]=_['intersection'](_0x40315f[_0xe43e('0x31')],qs[_0xe43e('0x36')](_0xf34341[_0xe43e('0x34')][_0xe43e('0x36')]));_0x2cd69a[_0xe43e('0x35')]=_0x2cd69a[_0xe43e('0x35')][_0xe43e('0x37')]?_0x2cd69a[_0xe43e('0x35')]:_0x40315f[_0xe43e('0x31')];if(_0xf34341[_0xe43e('0x34')][_0xe43e('0x41')]){_0x2cd69a[_0xe43e('0x48')]=[{'all':!![]}];}_0x2cd69a=_[_0xe43e('0x3e')]({},_0x2cd69a,_0xf34341['options']);return db[_0xe43e('0x2c')][_0xe43e('0x49')](_0x2cd69a)[_0xe43e('0x25')](handleEntityNotFound(_0xd1305c,null))[_0xe43e('0x25')](respondWithResult(_0xd1305c,null))[_0xe43e('0x44')](handleError(_0xd1305c,null));};exports[_0xe43e('0x4a')]=function(_0x8bd373,_0x25260f){return db[_0xe43e('0x2c')][_0xe43e('0x4a')](_0x8bd373['body'],{})[_0xe43e('0x25')](respondWithResult(_0x25260f,0xc9))[_0xe43e('0x44')](handleError(_0x25260f,null));};exports[_0xe43e('0x23')]=function(_0x2a5a04,_0x11c86c){if(_0x2a5a04[_0xe43e('0x4b')]['id']){delete _0x2a5a04[_0xe43e('0x4b')]['id'];}return db[_0xe43e('0x2c')]['find']({'where':{'id':_0x2a5a04[_0xe43e('0x46')]['id']}})[_0xe43e('0x25')](handleEntityNotFound(_0x11c86c,null))[_0xe43e('0x25')](saveUpdates(_0x2a5a04[_0xe43e('0x4b')],null))['then'](respondWithResult(_0x11c86c,null))[_0xe43e('0x44')](handleError(_0x11c86c,null));};exports['destroy']=function(_0x48b4,_0xdf007e){return db['SalesforceField']['find']({'where':{'id':_0x48b4['params']['id']}})[_0xe43e('0x25')](handleEntityNotFound(_0xdf007e,null))[_0xe43e('0x25')](removeEntity(_0xdf007e,null))[_0xe43e('0x44')](handleError(_0xdf007e,null));}; \ No newline at end of file +var _0xe4f9=['order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','find','create','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','status','json','offset','limit','count','set','Content-Range','apply','save','update','destroy','then','end','error','stack','name','send','index','SalesforceField','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty'];(function(_0x56e647,_0x167df8){var _0x54d7c9=function(_0x2d8a33){while(--_0x2d8a33){_0x56e647['push'](_0x56e647['shift']());}};_0x54d7c9(++_0x167df8);}(_0xe4f9,0x131));var _0x9e4f=function(_0x2187bb,_0x2c2e6c){_0x2187bb=_0x2187bb-0x0;var _0x9121bb=_0xe4f9[_0x2187bb];return _0x9121bb;};'use strict';var emlformat=require(_0x9e4f('0x0'));var rimraf=require(_0x9e4f('0x1'));var zipdir=require(_0x9e4f('0x2'));var jsonpatch=require(_0x9e4f('0x3'));var rp=require(_0x9e4f('0x4'));var moment=require('moment');var BPromise=require(_0x9e4f('0x5'));var Mustache=require('mustache');var util=require(_0x9e4f('0x6'));var path=require(_0x9e4f('0x7'));var sox=require(_0x9e4f('0x8'));var csv=require(_0x9e4f('0x9'));var ejs=require(_0x9e4f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9e4f('0xb'));var crypto=require(_0x9e4f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9e4f('0xd'));var toCsv=require(_0x9e4f('0x9'));var querystring=require('querystring');var Papa=require(_0x9e4f('0xe'));var Redis=require('ioredis');var authService=require(_0x9e4f('0xf'));var qs=require(_0x9e4f('0x10'));var as=require(_0x9e4f('0x11'));var hardwareService=require(_0x9e4f('0x12'));var logger=require(_0x9e4f('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9e4f('0x14'));var db=require(_0x9e4f('0x15'))['db'];function respondWithStatusCode(_0xcba209,_0x52172a){_0x52172a=_0x52172a||0xcc;return function(_0x420e6e){if(_0x420e6e){return _0xcba209['sendStatus'](_0x52172a);}return _0xcba209[_0x9e4f('0x16')](_0x52172a)['end']();};}function respondWithResult(_0x493d20,_0x4a9266){_0x4a9266=_0x4a9266||0xc8;return function(_0x17db5e){if(_0x17db5e){return _0x493d20[_0x9e4f('0x16')](_0x4a9266)[_0x9e4f('0x17')](_0x17db5e);}};}function respondWithFilteredResult(_0x3a37ea,_0x4a2b7c){return function(_0x5ee907){if(_0x5ee907){var _0x19f428=typeof _0x4a2b7c[_0x9e4f('0x18')]==='undefined'&&typeof _0x4a2b7c[_0x9e4f('0x19')]==='undefined';var _0x277e8e=_0x5ee907[_0x9e4f('0x1a')];var _0x570fee=_0x19f428?0x0:_0x4a2b7c[_0x9e4f('0x18')];var _0x10abff=_0x19f428?_0x5ee907['count']:_0x4a2b7c['offset']+_0x4a2b7c[_0x9e4f('0x19')];var _0x51a724;if(_0x10abff>=_0x277e8e){_0x10abff=_0x277e8e;_0x51a724=0xc8;}else{_0x51a724=0xce;}_0x3a37ea['status'](_0x51a724);return _0x3a37ea[_0x9e4f('0x1b')](_0x9e4f('0x1c'),_0x570fee+'-'+_0x10abff+'/'+_0x277e8e)[_0x9e4f('0x17')](_0x5ee907);}return null;};}function patchUpdates(_0x4ca767){return function(_0x54cfdc){try{jsonpatch[_0x9e4f('0x1d')](_0x54cfdc,_0x4ca767,!![]);}catch(_0x172603){return BPromise['reject'](_0x172603);}return _0x54cfdc[_0x9e4f('0x1e')]();};}function saveUpdates(_0x219402,_0x34c9d8){return function(_0x5a3335){if(_0x5a3335){return _0x5a3335[_0x9e4f('0x1f')](_0x219402)['then'](function(_0x1e3f05){return _0x1e3f05;});}return null;};}function removeEntity(_0x569902,_0x1c4b21){return function(_0x4acada){if(_0x4acada){return _0x4acada[_0x9e4f('0x20')]()[_0x9e4f('0x21')](function(){_0x569902['status'](0xcc)[_0x9e4f('0x22')]();});}};}function handleEntityNotFound(_0x39694c,_0xf5b373){return function(_0x28872d){if(!_0x28872d){_0x39694c['sendStatus'](0x194);}return _0x28872d;};}function handleError(_0x508405,_0x1fb884){_0x1fb884=_0x1fb884||0x1f4;return function(_0x20bd65){logger[_0x9e4f('0x23')](_0x20bd65[_0x9e4f('0x24')]);if(_0x20bd65[_0x9e4f('0x25')]){delete _0x20bd65[_0x9e4f('0x25')];}_0x508405[_0x9e4f('0x16')](_0x1fb884)[_0x9e4f('0x26')](_0x20bd65);};}exports[_0x9e4f('0x27')]=function(_0x5bbdd5,_0x2848c2){var _0x3bbb3b={},_0x50b44c={},_0x59fc53={'count':0x0,'rows':[]};var _0x2fcfb3=_['map'](db[_0x9e4f('0x28')][_0x9e4f('0x29')],function(_0x51401e){return{'name':_0x51401e[_0x9e4f('0x2a')],'type':_0x51401e[_0x9e4f('0x2b')][_0x9e4f('0x2c')]};});_0x50b44c['model']=_[_0x9e4f('0x2d')](_0x2fcfb3,'name');_0x50b44c[_0x9e4f('0x2e')]=_[_0x9e4f('0x2f')](_0x5bbdd5[_0x9e4f('0x2e')]);_0x50b44c[_0x9e4f('0x30')]=_[_0x9e4f('0x31')](_0x50b44c['model'],_0x50b44c[_0x9e4f('0x2e')]);_0x3bbb3b[_0x9e4f('0x32')]=_[_0x9e4f('0x31')](_0x50b44c[_0x9e4f('0x33')],qs['fields'](_0x5bbdd5[_0x9e4f('0x2e')][_0x9e4f('0x34')]));_0x3bbb3b[_0x9e4f('0x32')]=_0x3bbb3b[_0x9e4f('0x32')][_0x9e4f('0x35')]?_0x3bbb3b[_0x9e4f('0x32')]:_0x50b44c[_0x9e4f('0x33')];if(!_0x5bbdd5['query'][_0x9e4f('0x36')]('nolimit')){_0x3bbb3b[_0x9e4f('0x19')]=qs[_0x9e4f('0x19')](_0x5bbdd5[_0x9e4f('0x2e')][_0x9e4f('0x19')]);_0x3bbb3b[_0x9e4f('0x18')]=qs['offset'](_0x5bbdd5[_0x9e4f('0x2e')][_0x9e4f('0x18')]);}_0x3bbb3b[_0x9e4f('0x37')]=qs[_0x9e4f('0x38')](_0x5bbdd5[_0x9e4f('0x2e')]['sort']);_0x3bbb3b[_0x9e4f('0x39')]=qs[_0x9e4f('0x30')](_[_0x9e4f('0x3a')](_0x5bbdd5[_0x9e4f('0x2e')],_0x50b44c[_0x9e4f('0x30')]),_0x2fcfb3);if(_0x5bbdd5[_0x9e4f('0x2e')][_0x9e4f('0x3b')]){_0x3bbb3b[_0x9e4f('0x39')]=_['merge'](_0x3bbb3b[_0x9e4f('0x39')],{'$or':_[_0x9e4f('0x2d')](_0x2fcfb3,function(_0x3a16d6){if(_0x3a16d6['type']!==_0x9e4f('0x3c')){var _0x674b51={};_0x674b51[_0x3a16d6['name']]={'$like':'%'+_0x5bbdd5[_0x9e4f('0x2e')][_0x9e4f('0x3b')]+'%'};return _0x674b51;}})});}_0x3bbb3b=_[_0x9e4f('0x3d')]({},_0x3bbb3b,_0x5bbdd5[_0x9e4f('0x3e')]);var _0xd893a2={'where':_0x3bbb3b[_0x9e4f('0x39')]};return db['SalesforceField'][_0x9e4f('0x1a')](_0xd893a2)[_0x9e4f('0x21')](function(_0x2d6d32){_0x59fc53['count']=_0x2d6d32;if(_0x5bbdd5[_0x9e4f('0x2e')][_0x9e4f('0x3f')]){_0x3bbb3b['include']=[{'all':!![]}];}return db[_0x9e4f('0x28')][_0x9e4f('0x40')](_0x3bbb3b);})[_0x9e4f('0x21')](function(_0x3e26ed){_0x59fc53[_0x9e4f('0x41')]=_0x3e26ed;return _0x59fc53;})[_0x9e4f('0x21')](respondWithFilteredResult(_0x2848c2,_0x3bbb3b))['catch'](handleError(_0x2848c2,null));};exports[_0x9e4f('0x42')]=function(_0x55f0c4,_0x322232){var _0x4be6de={'raw':!![],'where':{'id':_0x55f0c4[_0x9e4f('0x43')]['id']}},_0x1a763f={};_0x1a763f[_0x9e4f('0x33')]=_[_0x9e4f('0x2f')](db['SalesforceField'][_0x9e4f('0x29')]);_0x1a763f[_0x9e4f('0x2e')]=_['keys'](_0x55f0c4[_0x9e4f('0x2e')]);_0x1a763f[_0x9e4f('0x30')]=_[_0x9e4f('0x31')](_0x1a763f[_0x9e4f('0x33')],_0x1a763f[_0x9e4f('0x2e')]);_0x4be6de[_0x9e4f('0x32')]=_[_0x9e4f('0x31')](_0x1a763f['model'],qs[_0x9e4f('0x34')](_0x55f0c4[_0x9e4f('0x2e')][_0x9e4f('0x34')]));_0x4be6de['attributes']=_0x4be6de[_0x9e4f('0x32')][_0x9e4f('0x35')]?_0x4be6de['attributes']:_0x1a763f[_0x9e4f('0x33')];if(_0x55f0c4['query']['includeAll']){_0x4be6de['include']=[{'all':!![]}];}_0x4be6de=_[_0x9e4f('0x3d')]({},_0x4be6de,_0x55f0c4['options']);return db['SalesforceField'][_0x9e4f('0x44')](_0x4be6de)[_0x9e4f('0x21')](handleEntityNotFound(_0x322232,null))['then'](respondWithResult(_0x322232,null))['catch'](handleError(_0x322232,null));};exports[_0x9e4f('0x45')]=function(_0x4924ad,_0x1499d8){return db[_0x9e4f('0x28')][_0x9e4f('0x45')](_0x4924ad[_0x9e4f('0x46')],{})[_0x9e4f('0x21')](respondWithResult(_0x1499d8,0xc9))['catch'](handleError(_0x1499d8,null));};exports[_0x9e4f('0x1f')]=function(_0x1788b1,_0x2d026a){if(_0x1788b1[_0x9e4f('0x46')]['id']){delete _0x1788b1[_0x9e4f('0x46')]['id'];}return db[_0x9e4f('0x28')][_0x9e4f('0x44')]({'where':{'id':_0x1788b1[_0x9e4f('0x43')]['id']}})[_0x9e4f('0x21')](handleEntityNotFound(_0x2d026a,null))[_0x9e4f('0x21')](saveUpdates(_0x1788b1[_0x9e4f('0x46')],null))[_0x9e4f('0x21')](respondWithResult(_0x2d026a,null))[_0x9e4f('0x47')](handleError(_0x2d026a,null));};exports[_0x9e4f('0x20')]=function(_0x4412e3,_0xbe3db9){return db[_0x9e4f('0x28')][_0x9e4f('0x44')]({'where':{'id':_0x4412e3[_0x9e4f('0x43')]['id']}})[_0x9e4f('0x21')](handleEntityNotFound(_0xbe3db9,null))[_0x9e4f('0x21')](removeEntity(_0xbe3db9,null))[_0x9e4f('0x47')](handleError(_0xbe3db9,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index d2d03c9..d8fdef5 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 _0x023c=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','lodash'];(function(_0x475ac6,_0x13c0d7){var _0x115432=function(_0x96b1cb){while(--_0x96b1cb){_0x475ac6['push'](_0x475ac6['shift']());}};_0x115432(++_0x13c0d7);}(_0x023c,0x109));var _0xc023=function(_0x2d458a,_0x234ba8){_0x2d458a=_0x2d458a-0x0;var _0xa64ff6=_0x023c[_0x2d458a];return _0xa64ff6;};'use strict';var _=require(_0xc023('0x0'));var util=require('util');var logger=require(_0xc023('0x1'))(_0xc023('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc023('0x3'));var fs=require('fs');var path=require(_0xc023('0x4'));var rimraf=require(_0xc023('0x5'));var config=require(_0xc023('0x6'));var attributes=require(_0xc023('0x7'));module[_0xc023('0x8')]=function(_0x5ed45c,_0x42e0a5){return _0x5ed45c[_0xc023('0x9')](_0xc023('0xa'),attributes,{'tableName':_0xc023('0xb'),'paranoid':![],'indexes':[{'name':_0xc023('0xc'),'fields':['idField',_0xc023('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9f6e=['../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','salesforce_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise'];(function(_0x1f10b4,_0x127b87){var _0x5c2375=function(_0x24f2c4){while(--_0x24f2c4){_0x1f10b4['push'](_0x1f10b4['shift']());}};_0x5c2375(++_0x127b87);}(_0x9f6e,0x94));var _0xe9f6=function(_0xfc75e4,_0x47f5f1){_0xfc75e4=_0xfc75e4-0x0;var _0x17f284=_0x9f6e[_0xfc75e4];return _0x17f284;};'use strict';var _=require(_0xe9f6('0x0'));var util=require(_0xe9f6('0x1'));var logger=require('../../config/logger')(_0xe9f6('0x2'));var moment=require(_0xe9f6('0x3'));var BPromise=require(_0xe9f6('0x4'));var rp=require(_0xe9f6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe9f6('0x6'));var attributes=require(_0xe9f6('0x7'));module[_0xe9f6('0x8')]=function(_0x31cf98,_0x2cfa88){return _0x31cf98[_0xe9f6('0x9')](_0xe9f6('0xa'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0xe9f6('0xb'),'fields':[_0xe9f6('0xc'),_0xe9f6('0xd')],'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 63b0ee2..3eb8d3c 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 _0x7b50=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment'];(function(_0x2cc594,_0x4d727b){var _0x4abff7=function(_0x22b01d){while(--_0x22b01d){_0x2cc594['push'](_0x2cc594['shift']());}};_0x4abff7(++_0x4d727b);}(_0x7b50,0x1a2));var _0x07b5=function(_0x16bb9b,_0x1ed28e){_0x16bb9b=_0x16bb9b-0x0;var _0x5767a8=_0x7b50[_0x16bb9b];return _0x5767a8;};'use strict';var _=require(_0x07b5('0x0'));var util=require('util');var moment=require(_0x07b5('0x1'));var BPromise=require('bluebird');var rs=require(_0x07b5('0x2'));var fs=require('fs');var Redis=require(_0x07b5('0x3'));var db=require(_0x07b5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x07b5('0x5'))(_0x07b5('0x6'));var config=require(_0x07b5('0x7'));var jayson=require(_0x07b5('0x8'));var client=jayson[_0x07b5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10825e,_0x39a53e,_0x1ce742){return new BPromise(function(_0xd7ead0,_0x519767){return client['request'](_0x10825e,_0x1ce742)[_0x07b5('0xa')](function(_0x4e636c){logger[_0x07b5('0xb')](_0x07b5('0xc'),_0x39a53e,_0x07b5('0xd'));logger[_0x07b5('0xe')](_0x07b5('0xf'),_0x39a53e,'request\x20sent',JSON[_0x07b5('0x10')](_0x4e636c));if(_0x4e636c[_0x07b5('0x11')]){if(_0x4e636c[_0x07b5('0x11')]['code']===0x1f4){logger['error'](_0x07b5('0xc'),_0x39a53e,_0x4e636c['error'][_0x07b5('0x12')]);return _0x519767(_0x4e636c['error'][_0x07b5('0x12')]);}logger[_0x07b5('0x11')]('SalesforceField,\x20%s,\x20%s',_0x39a53e,_0x4e636c[_0x07b5('0x11')]['message']);return _0xd7ead0(_0x4e636c[_0x07b5('0x11')][_0x07b5('0x12')]);}else{logger[_0x07b5('0xb')]('SalesforceField,\x20%s,\x20%s',_0x39a53e,_0x07b5('0xd'));_0xd7ead0(_0x4e636c[_0x07b5('0x13')][_0x07b5('0x12')]);}})[_0x07b5('0x14')](function(_0x551e65){logger['error'](_0x07b5('0xc'),_0x39a53e,_0x551e65);_0x519767(_0x551e65);});});} \ No newline at end of file +var _0x64b9=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x587922,_0x3f7b6d){var _0x23bc80=function(_0x5eabaf){while(--_0x5eabaf){_0x587922['push'](_0x587922['shift']());}};_0x23bc80(++_0x3f7b6d);}(_0x64b9,0x1f4));var _0x964b=function(_0x15f9e9,_0x5e8ff2){_0x15f9e9=_0x15f9e9-0x0;var _0x344f65=_0x64b9[_0x15f9e9];return _0x344f65;};'use strict';var _=require(_0x964b('0x0'));var util=require(_0x964b('0x1'));var moment=require(_0x964b('0x2'));var BPromise=require('bluebird');var rs=require(_0x964b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x964b('0x4'))['db'];var utils=require(_0x964b('0x5'));var logger=require(_0x964b('0x6'))('rpc');var config=require(_0x964b('0x7'));var jayson=require(_0x964b('0x8'));var client=jayson[_0x964b('0x9')][_0x964b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x352d81,_0x689209,_0x2cbfca){return new BPromise(function(_0x285f48,_0x11368e){return client[_0x964b('0xb')](_0x352d81,_0x2cbfca)[_0x964b('0xc')](function(_0x3e04d4){logger['info'](_0x964b('0xd'),_0x689209,_0x964b('0xe'));logger[_0x964b('0xf')](_0x964b('0x10'),_0x689209,_0x964b('0xe'),JSON['stringify'](_0x3e04d4));if(_0x3e04d4[_0x964b('0x11')]){if(_0x3e04d4[_0x964b('0x11')][_0x964b('0x12')]===0x1f4){logger[_0x964b('0x11')](_0x964b('0xd'),_0x689209,_0x3e04d4[_0x964b('0x11')][_0x964b('0x13')]);return _0x11368e(_0x3e04d4[_0x964b('0x11')][_0x964b('0x13')]);}logger['error'](_0x964b('0xd'),_0x689209,_0x3e04d4['error']['message']);return _0x285f48(_0x3e04d4[_0x964b('0x11')][_0x964b('0x13')]);}else{logger[_0x964b('0x14')](_0x964b('0xd'),_0x689209,_0x964b('0xe'));_0x285f48(_0x3e04d4[_0x964b('0x15')][_0x964b('0x13')]);}})[_0x964b('0x16')](function(_0x37ffad){logger[_0x964b('0x11')](_0x964b('0xd'),_0x689209,_0x37ffad);_0x11368e(_0x37ffad);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index bcf4214..085544d 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 _0xaf1d=['post','create','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','show','getConfigurations','/:id/fields','getFields'];(function(_0x2acdbb,_0x5bc1e6){var _0x167b0c=function(_0xc0a731){while(--_0xc0a731){_0x2acdbb['push'](_0x2acdbb['shift']());}};_0x167b0c(++_0x5bc1e6);}(_0xaf1d,0x9f));var _0xdaf1=function(_0x231412,_0x2ddbf4){_0x231412=_0x231412-0x0;var _0x491d72=_0xaf1d[_0x231412];return _0x491d72;};'use strict';var multer=require(_0xdaf1('0x0'));var util=require(_0xdaf1('0x1'));var path=require(_0xdaf1('0x2'));var timeout=require(_0xdaf1('0x3'));var express=require('express');var router=express[_0xdaf1('0x4')]();var fs_extra=require(_0xdaf1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdaf1('0x6'));var config=require(_0xdaf1('0x7'));var controller=require(_0xdaf1('0x8'));router[_0xdaf1('0x9')]('/',auth[_0xdaf1('0xa')](),controller[_0xdaf1('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xdaf1('0xc')]);router['get']('/:id/configurations',auth[_0xdaf1('0xa')](),controller[_0xdaf1('0xd')]);router[_0xdaf1('0x9')](_0xdaf1('0xe'),auth['isAuthenticated'](),controller[_0xdaf1('0xf')]);router[_0xdaf1('0x10')]('/',auth[_0xdaf1('0xa')](),controller[_0xdaf1('0x11')]);router[_0xdaf1('0x10')]('/:id/configurations',auth[_0xdaf1('0xa')](),controller[_0xdaf1('0x12')]);router[_0xdaf1('0x13')](_0xdaf1('0x14'),auth[_0xdaf1('0xa')](),controller[_0xdaf1('0x15')]);router[_0xdaf1('0x16')](_0xdaf1('0x14'),auth[_0xdaf1('0xa')](),controller[_0xdaf1('0x17')]);module[_0xdaf1('0x18')]=router; \ No newline at end of file +var _0x86f5=['post','create','/:id/configurations','addConfiguration','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields'];(function(_0x30bd4d,_0x50eb60){var _0x306915=function(_0x5ae782){while(--_0x5ae782){_0x30bd4d['push'](_0x30bd4d['shift']());}};_0x306915(++_0x50eb60);}(_0x86f5,0x178));var _0x586f=function(_0x5c468f,_0x2e5c25){_0x5c468f=_0x5c468f-0x0;var _0x2136b0=_0x86f5[_0x5c468f];return _0x2136b0;};'use strict';var multer=require(_0x586f('0x0'));var util=require('util');var path=require(_0x586f('0x1'));var timeout=require(_0x586f('0x2'));var express=require('express');var router=express[_0x586f('0x3')]();var fs_extra=require(_0x586f('0x4'));var auth=require(_0x586f('0x5'));var interaction=require(_0x586f('0x6'));var config=require('../../config/environment');var controller=require('./intServicenowAccount.controller');router[_0x586f('0x7')]('/',auth[_0x586f('0x8')](),controller[_0x586f('0x9')]);router['get'](_0x586f('0xa'),auth[_0x586f('0x8')](),controller[_0x586f('0xb')]);router['get']('/:id/configurations',auth[_0x586f('0x8')](),controller[_0x586f('0xc')]);router[_0x586f('0x7')](_0x586f('0xd'),auth[_0x586f('0x8')](),controller[_0x586f('0xe')]);router[_0x586f('0xf')]('/',auth['isAuthenticated'](),controller[_0x586f('0x10')]);router['post'](_0x586f('0x11'),auth['isAuthenticated'](),controller[_0x586f('0x12')]);router['put'](_0x586f('0xa'),auth['isAuthenticated'](),controller[_0x586f('0x13')]);router[_0x586f('0x14')](_0x586f('0xa'),auth[_0x586f('0x8')](),controller[_0x586f('0x15')]);module[_0x586f('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 1c07a0c..ea2a32c 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 _0x0e8d=['sequelize','exports','STRING','username','remoteUri'];(function(_0x3f89e6,_0x5304b7){var _0x312a05=function(_0x311c3b){while(--_0x311c3b){_0x3f89e6['push'](_0x3f89e6['shift']());}};_0x312a05(++_0x5304b7);}(_0x0e8d,0x1bd));var _0xd0e8=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x0e8d[_0xaa1b3e];return _0x454d7d;};'use strict';var Sequelize=require(_0xd0e8('0x0'));module[_0xd0e8('0x1')]={'name':{'type':Sequelize[_0xd0e8('0x2')]},'description':{'type':Sequelize[_0xd0e8('0x2')]},'username':{'type':Sequelize[_0xd0e8('0x2')],'unique':_0xd0e8('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xd0e8('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xd0e8('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x0dfb=['STRING','remoteUri','sequelize','exports'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0x0dfb,0x92));var _0xb0df=function(_0x49cfdb,_0x429954){_0x49cfdb=_0x49cfdb-0x0;var _0x28b31e=_0x0dfb[_0x49cfdb];return _0x28b31e;};'use strict';var Sequelize=require(_0xb0df('0x0'));module[_0xb0df('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb0df('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize[_0xb0df('0x2')]},'email':{'type':Sequelize[_0xb0df('0x2')]},'remoteUri':{'type':Sequelize[_0xb0df('0x2')],'unique':_0xb0df('0x3')},'serverUrl':{'type':Sequelize[_0xb0df('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index d647271..302fe0d 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 _0x9c78=['closed_by','parent_incident','sys_id','contact_type','urgency','problem_id','company','reassignment_count','comments','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','upon_approval','correlation_id','location','password','email','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','username','GET','result','log','incident\x20table\x20objects','assign','remove','includes','internalType','label','push','all','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','statusCode','stack','Wrong\x20credentials','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','sox','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','save','update','then','destroy','error','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','ServicenowAccount','include','findAll','catch','show','params','options','find','create','body','getConfigurations','findOne','AccountId','getSubjects','channel','getDescriptions','ServicenowConfiguration','Subjects','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','watch_list','sys_updated_on','child_incidents','approval_history','number','resolved_by','opened_by','user_input','sys_domain','state','sys_created_by','calendar_stc','delivery_plan','impact','active','work_notes_list','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','approval_set','work_notes','short_description','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration'];(function(_0x3c43f6,_0x429058){var _0x5677a4=function(_0x13b06b){while(--_0x13b06b){_0x3c43f6['push'](_0x3c43f6['shift']());}};_0x5677a4(++_0x429058);}(_0x9c78,0x191));var _0x89c7=function(_0x3018bb,_0x52f29a){_0x3018bb=_0x3018bb-0x0;var _0x5cd2e4=_0x9c78[_0x3018bb];return _0x5cd2e4;};'use strict';var emlformat=require(_0x89c7('0x0'));var rimraf=require(_0x89c7('0x1'));var zipdir=require(_0x89c7('0x2'));var jsonpatch=require(_0x89c7('0x3'));var rp=require('request-promise');var moment=require(_0x89c7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x89c7('0x5'));var util=require('util');var path=require('path');var sox=require(_0x89c7('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x89c7('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x89c7('0x8'));var jsforce=require(_0x89c7('0x9'));var deskjs=require(_0x89c7('0xa'));var toCsv=require(_0x89c7('0xb'));var querystring=require(_0x89c7('0xc'));var Papa=require(_0x89c7('0xd'));var Redis=require(_0x89c7('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x89c7('0xf'));var as=require(_0x89c7('0x10'));var hardwareService=require(_0x89c7('0x11'));var logger=require('../../config/logger')(_0x89c7('0x12'));var utils=require(_0x89c7('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x89c7('0x14'));var db=require(_0x89c7('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x14f732,_0x7119d1){_0x7119d1=_0x7119d1||0xcc;return function(_0x206d41){if(_0x206d41){return _0x14f732[_0x89c7('0x16')](_0x7119d1);}return _0x14f732[_0x89c7('0x17')](_0x7119d1)[_0x89c7('0x18')]();};}function respondWithResult(_0x460e87,_0xb86965){_0xb86965=_0xb86965||0xc8;return function(_0x6c26c2){if(_0x6c26c2){return _0x460e87[_0x89c7('0x17')](_0xb86965)['json'](_0x6c26c2);}};}function respondWithFilteredResult(_0x5b0f73,_0x20b1e3){return function(_0x251bec){if(_0x251bec){var _0xb70d07=typeof _0x20b1e3[_0x89c7('0x19')]===_0x89c7('0x1a')&&typeof _0x20b1e3[_0x89c7('0x1b')]==='undefined';var _0x4d2916=_0x251bec[_0x89c7('0x1c')];var _0x95a488=_0xb70d07?0x0:_0x20b1e3[_0x89c7('0x19')];var _0x5068b4=_0xb70d07?_0x251bec[_0x89c7('0x1c')]:_0x20b1e3[_0x89c7('0x19')]+_0x20b1e3[_0x89c7('0x1b')];var _0x344fee;if(_0x5068b4>=_0x4d2916){_0x5068b4=_0x4d2916;_0x344fee=0xc8;}else{_0x344fee=0xce;}_0x5b0f73[_0x89c7('0x17')](_0x344fee);return _0x5b0f73['set']('Content-Range',_0x95a488+'-'+_0x5068b4+'/'+_0x4d2916)['json'](_0x251bec);}return null;};}function patchUpdates(_0x3b806d){return function(_0x27bd85){try{jsonpatch['apply'](_0x27bd85,_0x3b806d,!![]);}catch(_0x2942ac){return BPromise['reject'](_0x2942ac);}return _0x27bd85[_0x89c7('0x1d')]();};}function saveUpdates(_0x20f42c,_0x5b2e07){return function(_0x17398f){if(_0x17398f){return _0x17398f[_0x89c7('0x1e')](_0x20f42c)[_0x89c7('0x1f')](function(_0x109b72){return _0x109b72;});}return null;};}function removeEntity(_0x5c30d9,_0x57bc59){return function(_0x56a7d8){if(_0x56a7d8){return _0x56a7d8[_0x89c7('0x20')]()[_0x89c7('0x1f')](function(){_0x5c30d9[_0x89c7('0x17')](0xcc)[_0x89c7('0x18')]();});}};}function handleEntityNotFound(_0x3b8cdb,_0x46ef8a){return function(_0x273f66){if(!_0x273f66){_0x3b8cdb[_0x89c7('0x16')](0x194);}return _0x273f66;};}function handleError(_0x3955b4,_0x5710aa){_0x5710aa=_0x5710aa||0x1f4;return function(_0x54a456){logger[_0x89c7('0x21')](_0x54a456['stack']);if(_0x54a456[_0x89c7('0x22')]){delete _0x54a456[_0x89c7('0x22')];}_0x3955b4[_0x89c7('0x17')](_0x5710aa)[_0x89c7('0x23')](_0x54a456);};}exports['index']=function(_0xb99dc4,_0x50c053){var _0x21214a={},_0x24e3a5={},_0x3d4056={'count':0x0,'rows':[]};var _0x31c5b7=_[_0x89c7('0x24')](db['ServicenowAccount'][_0x89c7('0x25')],function(_0x18fc02){return{'name':_0x18fc02[_0x89c7('0x26')],'type':_0x18fc02[_0x89c7('0x27')][_0x89c7('0x28')]};});_0x24e3a5['model']=_[_0x89c7('0x24')](_0x31c5b7,_0x89c7('0x22'));_0x24e3a5[_0x89c7('0x29')]=_[_0x89c7('0x2a')](_0xb99dc4['query']);_0x24e3a5[_0x89c7('0x2b')]=_[_0x89c7('0x2c')](_0x24e3a5[_0x89c7('0x2d')],_0x24e3a5[_0x89c7('0x29')]);_0x21214a[_0x89c7('0x2e')]=_['intersection'](_0x24e3a5[_0x89c7('0x2d')],qs['fields'](_0xb99dc4[_0x89c7('0x29')][_0x89c7('0x2f')]));_0x21214a[_0x89c7('0x2e')]=_0x21214a[_0x89c7('0x2e')][_0x89c7('0x30')]?_0x21214a[_0x89c7('0x2e')]:_0x24e3a5[_0x89c7('0x2d')];if(!_0xb99dc4[_0x89c7('0x29')][_0x89c7('0x31')](_0x89c7('0x32'))){_0x21214a[_0x89c7('0x1b')]=qs['limit'](_0xb99dc4[_0x89c7('0x29')][_0x89c7('0x1b')]);_0x21214a[_0x89c7('0x19')]=qs[_0x89c7('0x19')](_0xb99dc4[_0x89c7('0x29')][_0x89c7('0x19')]);}_0x21214a[_0x89c7('0x33')]=qs[_0x89c7('0x34')](_0xb99dc4[_0x89c7('0x29')][_0x89c7('0x34')]);_0x21214a[_0x89c7('0x35')]=qs[_0x89c7('0x2b')](_[_0x89c7('0x36')](_0xb99dc4[_0x89c7('0x29')],_0x24e3a5['filters']),_0x31c5b7);if(_0xb99dc4[_0x89c7('0x29')][_0x89c7('0x37')]){_0x21214a[_0x89c7('0x35')]=_[_0x89c7('0x38')](_0x21214a[_0x89c7('0x35')],{'$or':_[_0x89c7('0x24')](_0x31c5b7,function(_0xf12ae8){if(_0xf12ae8[_0x89c7('0x27')]!==_0x89c7('0x39')){var _0x42cc9c={};_0x42cc9c[_0xf12ae8[_0x89c7('0x22')]]={'$like':'%'+_0xb99dc4[_0x89c7('0x29')][_0x89c7('0x37')]+'%'};return _0x42cc9c;}})});}_0x21214a=_[_0x89c7('0x38')]({},_0x21214a,_0xb99dc4['options']);var _0x267c92={'where':_0x21214a['where']};return db[_0x89c7('0x3a')][_0x89c7('0x1c')](_0x267c92)[_0x89c7('0x1f')](function(_0x5851db){_0x3d4056[_0x89c7('0x1c')]=_0x5851db;if(_0xb99dc4['query']['includeAll']){_0x21214a[_0x89c7('0x3b')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x89c7('0x3c')](_0x21214a);})[_0x89c7('0x1f')](function(_0x4737f9){_0x3d4056['rows']=_0x4737f9;return _0x3d4056;})[_0x89c7('0x1f')](respondWithFilteredResult(_0x50c053,_0x21214a))[_0x89c7('0x3d')](handleError(_0x50c053,null));};exports[_0x89c7('0x3e')]=function(_0x5bc5ba,_0x214224){var _0x9c09ea={'raw':![],'where':{'id':_0x5bc5ba[_0x89c7('0x3f')]['id']}},_0x3052bf={};_0x3052bf[_0x89c7('0x2d')]=_[_0x89c7('0x2a')](db[_0x89c7('0x3a')][_0x89c7('0x25')]);_0x3052bf[_0x89c7('0x29')]=_['keys'](_0x5bc5ba['query']);_0x3052bf[_0x89c7('0x2b')]=_[_0x89c7('0x2c')](_0x3052bf[_0x89c7('0x2d')],_0x3052bf[_0x89c7('0x29')]);_0x9c09ea[_0x89c7('0x2e')]=_[_0x89c7('0x2c')](_0x3052bf['model'],qs[_0x89c7('0x2f')](_0x5bc5ba[_0x89c7('0x29')][_0x89c7('0x2f')]));_0x9c09ea[_0x89c7('0x2e')]=_0x9c09ea[_0x89c7('0x2e')]['length']?_0x9c09ea['attributes']:_0x3052bf[_0x89c7('0x2d')];if(_0x5bc5ba[_0x89c7('0x29')]['includeAll']){_0x9c09ea['include']=[{'all':!![]}];}_0x9c09ea=_[_0x89c7('0x38')]({},_0x9c09ea,_0x5bc5ba[_0x89c7('0x40')]);return db[_0x89c7('0x3a')][_0x89c7('0x41')](_0x9c09ea)[_0x89c7('0x1f')](handleEntityNotFound(_0x214224,null))['then'](respondWithResult(_0x214224,null))['catch'](handleError(_0x214224,null));};exports[_0x89c7('0x42')]=function(_0x56120e,_0x116e7b){return db[_0x89c7('0x3a')][_0x89c7('0x42')](_0x56120e[_0x89c7('0x43')],{})[_0x89c7('0x1f')](respondWithResult(_0x116e7b,0xc9))[_0x89c7('0x3d')](handleError(_0x116e7b,null));};exports[_0x89c7('0x1e')]=function(_0x1f08ff,_0x4338fc){if(_0x1f08ff[_0x89c7('0x43')]['id']){delete _0x1f08ff[_0x89c7('0x43')]['id'];}return db[_0x89c7('0x3a')][_0x89c7('0x41')]({'where':{'id':_0x1f08ff['params']['id']}})[_0x89c7('0x1f')](handleEntityNotFound(_0x4338fc,null))['then'](saveUpdates(_0x1f08ff['body'],null))[_0x89c7('0x1f')](respondWithResult(_0x4338fc,null))[_0x89c7('0x3d')](handleError(_0x4338fc,null));};exports[_0x89c7('0x20')]=function(_0x10d13b,_0x1bda0d){return db['ServicenowAccount'][_0x89c7('0x41')]({'where':{'id':_0x10d13b[_0x89c7('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1bda0d,null))[_0x89c7('0x1f')](removeEntity(_0x1bda0d,null))[_0x89c7('0x3d')](handleError(_0x1bda0d,null));};exports[_0x89c7('0x44')]=function(_0x256038,_0x198ed6,_0x2a72fd){var _0x34687f={};var _0xa5ed48={};var _0x16477e;var _0x4acd80;return db[_0x89c7('0x3a')][_0x89c7('0x45')]({'where':{'id':_0x256038[_0x89c7('0x3f')]['id']}})[_0x89c7('0x1f')](handleEntityNotFound(_0x198ed6,null))[_0x89c7('0x1f')](function(_0x4c7180){if(_0x4c7180){_0x16477e=_0x4c7180;_0xa5ed48[_0x89c7('0x2d')]=_['keys'](db['ServicenowConfiguration']['rawAttributes']);_0xa5ed48[_0x89c7('0x29')]=_[_0x89c7('0x2a')](_0x256038[_0x89c7('0x29')]);_0xa5ed48[_0x89c7('0x2b')]=_[_0x89c7('0x2c')](_0xa5ed48[_0x89c7('0x2d')],_0xa5ed48[_0x89c7('0x29')]);_0x34687f[_0x89c7('0x2e')]=_[_0x89c7('0x2c')](_0xa5ed48[_0x89c7('0x2d')],qs[_0x89c7('0x2f')](_0x256038[_0x89c7('0x29')][_0x89c7('0x2f')]));_0x34687f[_0x89c7('0x2e')]=_0x34687f[_0x89c7('0x2e')][_0x89c7('0x30')]?_0x34687f['attributes']:_0xa5ed48[_0x89c7('0x2d')];_0x34687f[_0x89c7('0x33')]=qs[_0x89c7('0x34')](_0x256038[_0x89c7('0x29')][_0x89c7('0x34')]);_0x34687f[_0x89c7('0x35')]=qs[_0x89c7('0x2b')](_['pick'](_0x256038[_0x89c7('0x29')],_0xa5ed48[_0x89c7('0x2b')]));if(_0x256038[_0x89c7('0x29')][_0x89c7('0x37')]){_0x34687f[_0x89c7('0x35')]=_[_0x89c7('0x38')](_0x34687f[_0x89c7('0x35')],{'$or':_[_0x89c7('0x24')](_0x34687f[_0x89c7('0x2e')],function(_0x4a4bb2){var _0xf72cc9={};_0xf72cc9[_0x4a4bb2]={'$like':'%'+_0x256038['query'][_0x89c7('0x37')]+'%'};return _0xf72cc9;})});}_0x34687f=_[_0x89c7('0x38')]({},_0x34687f,_0x256038['options']);return _0x16477e[_0x89c7('0x44')](_0x34687f);}})[_0x89c7('0x1f')](function(_0xc1b2c5){if(_0xc1b2c5){_0x4acd80=_0xc1b2c5[_0x89c7('0x30')];if(!_0x256038['query'][_0x89c7('0x31')](_0x89c7('0x32'))){_0x34687f[_0x89c7('0x1b')]=qs[_0x89c7('0x1b')](_0x256038[_0x89c7('0x29')][_0x89c7('0x1b')]);_0x34687f['offset']=qs[_0x89c7('0x19')](_0x256038[_0x89c7('0x29')][_0x89c7('0x19')]);}return _0x16477e[_0x89c7('0x44')](_0x34687f);}})[_0x89c7('0x1f')](function(_0x4e8b2d){if(_0x4e8b2d){return _0x4e8b2d?{'count':_0x4acd80,'rows':_0x4e8b2d}:null;}})[_0x89c7('0x1f')](respondWithResult(_0x198ed6,null))[_0x89c7('0x3d')](handleError(_0x198ed6,null));};exports['addConfiguration']=function(_0x5c7405,_0x37b6ce,_0x49571c){if(_0x5c7405[_0x89c7('0x43')]['id']){delete _0x5c7405[_0x89c7('0x43')]['id'];}return db['ServicenowAccount']['findOne']({'where':{'id':_0x5c7405[_0x89c7('0x3f')]['id']}})[_0x89c7('0x1f')](handleEntityNotFound(_0x37b6ce,null))[_0x89c7('0x1f')](function(_0x102ac2){if(_0x102ac2){_0x5c7405[_0x89c7('0x43')][_0x89c7('0x46')]=_0x102ac2['id'];_0x5c7405['body']['Subjects']=integrations[_0x89c7('0x47')](_0x5c7405[_0x89c7('0x43')][_0x89c7('0x48')],_0x5c7405['body'][_0x89c7('0x27')]);_0x5c7405[_0x89c7('0x43')]['Descriptions']=integrations[_0x89c7('0x49')](_0x5c7405[_0x89c7('0x43')]['channel'],_0x5c7405[_0x89c7('0x43')]['type']);return db[_0x89c7('0x4a')][_0x89c7('0x42')](_0x5c7405['body'],{'include':[{'model':db['ServicenowField'],'as':_0x89c7('0x4b')},{'model':db[_0x89c7('0x4c')],'as':'Descriptions'}]});}return null;})[_0x89c7('0x1f')](respondWithResult(_0x37b6ce,null))[_0x89c7('0x3d')](handleError(_0x37b6ce,null));};exports[_0x89c7('0x4d')]=function(_0x4f39b0,_0x293902,_0x633f72){var _0x16f76a=[_0x89c7('0x4e'),_0x89c7('0x4f'),_0x89c7('0x50'),_0x89c7('0x51'),_0x89c7('0x52'),_0x89c7('0x53'),_0x89c7('0x54'),_0x89c7('0x55'),_0x89c7('0x56')];var _0x1c521b=['parent',_0x89c7('0x4e'),'caused_by',_0x89c7('0x57'),'upon_reject',_0x89c7('0x58'),_0x89c7('0x59'),'hold_reason',_0x89c7('0x5a'),_0x89c7('0x5b'),_0x89c7('0x5c'),'sys_updated_by',_0x89c7('0x5d'),_0x89c7('0x5e'),'sys_created_on',_0x89c7('0x5f'),_0x89c7('0x60'),_0x89c7('0x61'),_0x89c7('0x50'),_0x89c7('0x33'),_0x89c7('0x62'),'closed_at','cmdb_ci',_0x89c7('0x63'),_0x89c7('0x64'),_0x89c7('0x65'),_0x89c7('0x66'),'business_service',_0x89c7('0x67'),_0x89c7('0x68'),_0x89c7('0x69'),_0x89c7('0x6a'),_0x89c7('0x6b'),_0x89c7('0x6c'),_0x89c7('0x6d'),_0x89c7('0x6e'),_0x89c7('0x6f'),_0x89c7('0x70'),_0x89c7('0x71'),'caller_id',_0x89c7('0x72'),_0x89c7('0x51'),_0x89c7('0x73'),_0x89c7('0x74'),'close_code','correlation_display',_0x89c7('0x75'),_0x89c7('0x76'),_0x89c7('0x77'),_0x89c7('0x78'),_0x89c7('0x79'),_0x89c7('0x7a'),_0x89c7('0x7b'),_0x89c7('0x53'),'sys_class_name','close_notes',_0x89c7('0x7c'),'follow_up',_0x89c7('0x7d'),_0x89c7('0x7e'),_0x89c7('0x7f'),'reopened_by',_0x89c7('0x54'),_0x89c7('0x80'),_0x89c7('0x81'),_0x89c7('0x82'),_0x89c7('0x83'),'activity_due','assigned_to','severity',_0x89c7('0x84'),'sla_due',_0x89c7('0x85'),_0x89c7('0x86'),_0x89c7('0x87'),_0x89c7('0x88'),_0x89c7('0x89'),'sys_tags',_0x89c7('0x8a'),_0x89c7('0x8b'),_0x89c7('0x8c'),_0x89c7('0x8d'),'category'];var _0x47a03b='';var _0x1c7aee='';var _0x994939=[];var _0x1f7add='';var _0xb67dd4='';var _0x25d0ef=[];var _0x6003ef='';var _0x257ff='';var _0x53e2aa={};var _0x1184d1='';return db['ServicenowAccount']['findOne']({'where':{'id':_0x4f39b0['params']['id']},'attributes':['id','username',_0x89c7('0x8e'),_0x89c7('0x8f'),'remoteUri','serverUrl']})[_0x89c7('0x1f')](handleEntityNotFound(_0x293902,null))[_0x89c7('0x1f')](function(_0x43f5b7){if(_0x43f5b7){_0x1184d1=_0x43f5b7[_0x89c7('0x90')];var _0x382719=_0x1184d1[_0x89c7('0x91')](-0x1);if(_0x382719==='/'){_0x1184d1=_0x1184d1[_0x89c7('0x92')](0x0,_0x1184d1[_0x89c7('0x93')](_0x382719));}_0x257ff=util[_0x89c7('0x94')](_0x89c7('0x95'),_0x1184d1);_0x6003ef=util[_0x89c7('0x94')]('%s/api/now/table/',_0x1184d1);_0x53e2aa={'user':_0x43f5b7[_0x89c7('0x96')],'pass':_0x43f5b7[_0x89c7('0x8e')]};var _0x263631={'method':_0x89c7('0x97'),'uri':_0x257ff+'incident?sysparm_display_value=all','auth':_0x53e2aa,'json':!![]};return rp(_0x263631);}})[_0x89c7('0x1f')](function(_0x5292cb){if(_0x5292cb[_0x89c7('0x98')][_0x89c7('0x30')]>0x0){_0x47a03b=_0x5292cb[_0x89c7('0x98')];}console[_0x89c7('0x99')](_0x89c7('0x9a'),_0x47a03b);_0x25d0ef=[];_0x1c7aee=Object[_0x89c7('0x9b')]([],_0x47a03b);_[_0x89c7('0x9c')](_0x1c7aee,function(_0x2d1fec){return!_0x16f76a[_0x89c7('0x9d')](_0x2d1fec[_0x89c7('0x22')]);});_0x1c7aee['forEach'](function(_0x3f0133){var _0x560b7c=createFieldObject(_0x6003ef,_0x53e2aa,_0x3f0133[_0x89c7('0x9e')],_0x3f0133['name'],_0x3f0133[_0x89c7('0x9f')],![]);_0x25d0ef[_0x89c7('0xa0')](_0x560b7c);});return Promise[_0x89c7('0xa1')](_0x25d0ef);})[_0x89c7('0x1f')](function(_0x3ad2f1){_0x994939=_0x3ad2f1;_0x1f7add=Object['assign']([],_0x47a03b);console['log']('TCL:\x20_object',_0x47a03b);_[_0x89c7('0x9c')](_0x1f7add,function(_0xb68c3b){return _0x1c521b[_0x89c7('0x9d')](_0xb68c3b['name']);});console['log'](_0x89c7('0xa2'),_0x1f7add);_0x25d0ef=[];_0x1f7add[_0x89c7('0xa3')](function(_0x299d5d){var _0x387e2b=createFieldObject(_0x6003ef,_0x53e2aa,_0x299d5d['internalType'],_0x299d5d[_0x89c7('0x22')],_0x299d5d['label'],!![]);_0x25d0ef[_0x89c7('0xa0')](_0x387e2b);});return Promise[_0x89c7('0xa1')](_0x25d0ef);})[_0x89c7('0x1f')](function(_0x542c39){_0xb67dd4=_0x542c39;var _0x1120b9=_0x994939['concat'](_0xb67dd4);return{'count':_0x1120b9[_0x89c7('0x30')],'rows':_0x1120b9};})[_0x89c7('0x1f')](respondWithResult(_0x293902,null))[_0x89c7('0x3d')](function(_0x19da36){console[_0x89c7('0x99')]('ServiceNow\x20error:\x20'+_0x19da36);var _0x5ddbf6=_0x4f39b0['query']['test']?0x1f4:_0x19da36[_0x89c7('0xa4')]||0x1f4;logger[_0x89c7('0x21')](_0x19da36[_0x89c7('0xa5')]);delete _0x19da36[_0x89c7('0x22')];if(_0x5ddbf6===0x191){_0x5ddbf6=0x190;}_0x293902['status'](_0x5ddbf6)[_0x89c7('0x23')](_0x4f39b0[_0x89c7('0x29')]['test']?{'message':_0x89c7('0xa6'),'statusCode':_0x19da36[_0x89c7('0xa4')]}:_0x19da36);});};function createFieldObject(_0x491a92,_0x4316b8,_0x48aa7e,_0x51d1cb,_0x395eb2,_0x1bc40c){return new Promise(function(_0x568e58,_0x23a5bb){var _0x28108e={'id':_0x51d1cb,'name':_0x395eb2,'custom':_0x1bc40c};if(_0x48aa7e===_0x89c7('0xa7')){_0x28108e[_0x89c7('0x40')]=[{'name':_0x89c7('0xa8'),'value':_0x89c7('0xa9')},{'name':_0x89c7('0xaa'),'value':_0x89c7('0xab')}];_0x568e58(_0x28108e);}else{var _0x27c789={'method':_0x89c7('0x97'),'uri':_0x491a92+_0x89c7('0xac')+_0x51d1cb,'auth':_0x4316b8,'json':!![]};return rp(_0x27c789)[_0x89c7('0x1f')](function(_0x884f37){var _0x463811=[];if(_0x884f37[_0x89c7('0x98')][_0x89c7('0x30')]>0x0){_0x884f37[_0x89c7('0x98')][_0x89c7('0xa3')](function(_0x55b1b1){if(_0x55b1b1[_0x89c7('0xad')]===_0x89c7('0xab')){var _0x56532f={'name':_0x55b1b1['label'],'value':_0x55b1b1[_0x89c7('0xae')]};_0x463811['push'](_0x56532f);}});}_0x28108e[_0x89c7('0x40')]=_0x463811;if(_0x28108e[_0x89c7('0x40')][_0x89c7('0x30')]>0x0){_0x568e58(_0x28108e);}else{if(_0x1bc40c==![]){_0x568e58();}else{_0x568e58(_0x28108e);}}});}});} \ No newline at end of file +var _0xec48=['status','json','offset','undefined','limit','count','set','apply','reject','then','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','include','findAll','rows','catch','params','ServicenowAccount','merge','find','body','destroy','findOne','ServicenowConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','create','ServicenowField','getFields','made_sla','hold_reason','subcategory','close_code','notify','incident_state','severity','category','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','knowledge','closed_at','cmdb_ci','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','opened_at','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','assignment_group','description','close_notes','follow_up','parent_incident','sys_id','contact_type','reopened_by','company','reassignment_count','activity_due','sla_due','approval','sys_mod_count','sys_tags','escalation','upon_approval','correlation_id','location','username','password','remoteUri','serverUrl','slice','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','forEach','internalType','label','push','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','all','concat','ServiceNow\x20error:\x20','test','statusCode','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus'];(function(_0x1e0e40,_0x29528e){var _0x6b882a=function(_0x5cb1ab){while(--_0x5cb1ab){_0x1e0e40['push'](_0x1e0e40['shift']());}};_0x6b882a(++_0x29528e);}(_0xec48,0x99));var _0x8ec4=function(_0x3a0ebd,_0x47f368){_0x3a0ebd=_0x3a0ebd-0x0;var _0x51a660=_0xec48[_0x3a0ebd];return _0x51a660;};'use strict';var emlformat=require(_0x8ec4('0x0'));var rimraf=require(_0x8ec4('0x1'));var zipdir=require(_0x8ec4('0x2'));var jsonpatch=require(_0x8ec4('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8ec4('0x4'));var Mustache=require(_0x8ec4('0x5'));var util=require('util');var path=require(_0x8ec4('0x6'));var sox=require(_0x8ec4('0x7'));var csv=require(_0x8ec4('0x8'));var ejs=require(_0x8ec4('0x9'));var fs=require('fs');var fs_extra=require(_0x8ec4('0xa'));var _=require(_0x8ec4('0xb'));var squel=require('squel');var crypto=require(_0x8ec4('0xc'));var jsforce=require(_0x8ec4('0xd'));var deskjs=require(_0x8ec4('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8ec4('0xf'));var Papa=require('papaparse');var Redis=require(_0x8ec4('0x10'));var authService=require(_0x8ec4('0x11'));var qs=require(_0x8ec4('0x12'));var as=require(_0x8ec4('0x13'));var hardwareService=require(_0x8ec4('0x14'));var logger=require('../../config/logger')(_0x8ec4('0x15'));var utils=require(_0x8ec4('0x16'));var config=require(_0x8ec4('0x17'));var licenseUtil=require(_0x8ec4('0x18'));var db=require(_0x8ec4('0x19'))['db'];var integrations=require(_0x8ec4('0x1a'));function respondWithStatusCode(_0x46eb36,_0x4ebc51){_0x4ebc51=_0x4ebc51||0xcc;return function(_0x4ffaa3){if(_0x4ffaa3){return _0x46eb36[_0x8ec4('0x1b')](_0x4ebc51);}return _0x46eb36['status'](_0x4ebc51)['end']();};}function respondWithResult(_0x3368bd,_0x51d988){_0x51d988=_0x51d988||0xc8;return function(_0x1d0567){if(_0x1d0567){return _0x3368bd[_0x8ec4('0x1c')](_0x51d988)[_0x8ec4('0x1d')](_0x1d0567);}};}function respondWithFilteredResult(_0x7a6f58,_0x15502a){return function(_0xb1e862){if(_0xb1e862){var _0x14464e=typeof _0x15502a[_0x8ec4('0x1e')]===_0x8ec4('0x1f')&&typeof _0x15502a[_0x8ec4('0x20')]===_0x8ec4('0x1f');var _0x3aa3e1=_0xb1e862['count'];var _0x135341=_0x14464e?0x0:_0x15502a[_0x8ec4('0x1e')];var _0x42a207=_0x14464e?_0xb1e862[_0x8ec4('0x21')]:_0x15502a[_0x8ec4('0x1e')]+_0x15502a[_0x8ec4('0x20')];var _0x845bfc;if(_0x42a207>=_0x3aa3e1){_0x42a207=_0x3aa3e1;_0x845bfc=0xc8;}else{_0x845bfc=0xce;}_0x7a6f58[_0x8ec4('0x1c')](_0x845bfc);return _0x7a6f58[_0x8ec4('0x22')]('Content-Range',_0x135341+'-'+_0x42a207+'/'+_0x3aa3e1)[_0x8ec4('0x1d')](_0xb1e862);}return null;};}function patchUpdates(_0x4f98e6){return function(_0x4adc58){try{jsonpatch[_0x8ec4('0x23')](_0x4adc58,_0x4f98e6,!![]);}catch(_0x31d7d0){return BPromise[_0x8ec4('0x24')](_0x31d7d0);}return _0x4adc58['save']();};}function saveUpdates(_0x11c7e3,_0x4fb324){return function(_0x347046){if(_0x347046){return _0x347046['update'](_0x11c7e3)['then'](function(_0x187c81){return _0x187c81;});}return null;};}function removeEntity(_0x410f1b,_0x2e2372){return function(_0x5a4ca3){if(_0x5a4ca3){return _0x5a4ca3['destroy']()[_0x8ec4('0x25')](function(){_0x410f1b[_0x8ec4('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31efbc,_0x3b59c9){return function(_0x3b4929){if(!_0x3b4929){_0x31efbc[_0x8ec4('0x1b')](0x194);}return _0x3b4929;};}function handleError(_0x37509b,_0xbfd908){_0xbfd908=_0xbfd908||0x1f4;return function(_0x9d27d5){logger[_0x8ec4('0x26')](_0x9d27d5[_0x8ec4('0x27')]);if(_0x9d27d5[_0x8ec4('0x28')]){delete _0x9d27d5[_0x8ec4('0x28')];}_0x37509b[_0x8ec4('0x1c')](_0xbfd908)[_0x8ec4('0x29')](_0x9d27d5);};}exports[_0x8ec4('0x2a')]=function(_0x135b65,_0x2b6437){var _0x50a03b={},_0x2b70dd={},_0x470800={'count':0x0,'rows':[]};var _0xd2cefb=_[_0x8ec4('0x2b')](db['ServicenowAccount'][_0x8ec4('0x2c')],function(_0x305929){return{'name':_0x305929['fieldName'],'type':_0x305929[_0x8ec4('0x2d')][_0x8ec4('0x2e')]};});_0x2b70dd[_0x8ec4('0x2f')]=_[_0x8ec4('0x2b')](_0xd2cefb,'name');_0x2b70dd[_0x8ec4('0x30')]=_[_0x8ec4('0x31')](_0x135b65['query']);_0x2b70dd[_0x8ec4('0x32')]=_[_0x8ec4('0x33')](_0x2b70dd[_0x8ec4('0x2f')],_0x2b70dd[_0x8ec4('0x30')]);_0x50a03b[_0x8ec4('0x34')]=_['intersection'](_0x2b70dd[_0x8ec4('0x2f')],qs[_0x8ec4('0x35')](_0x135b65['query'][_0x8ec4('0x35')]));_0x50a03b[_0x8ec4('0x34')]=_0x50a03b['attributes'][_0x8ec4('0x36')]?_0x50a03b['attributes']:_0x2b70dd[_0x8ec4('0x2f')];if(!_0x135b65[_0x8ec4('0x30')][_0x8ec4('0x37')](_0x8ec4('0x38'))){_0x50a03b['limit']=qs[_0x8ec4('0x20')](_0x135b65[_0x8ec4('0x30')][_0x8ec4('0x20')]);_0x50a03b[_0x8ec4('0x1e')]=qs[_0x8ec4('0x1e')](_0x135b65[_0x8ec4('0x30')][_0x8ec4('0x1e')]);}_0x50a03b[_0x8ec4('0x39')]=qs['sort'](_0x135b65[_0x8ec4('0x30')][_0x8ec4('0x3a')]);_0x50a03b[_0x8ec4('0x3b')]=qs['filters'](_[_0x8ec4('0x3c')](_0x135b65['query'],_0x2b70dd[_0x8ec4('0x32')]),_0xd2cefb);if(_0x135b65[_0x8ec4('0x30')][_0x8ec4('0x3d')]){_0x50a03b[_0x8ec4('0x3b')]=_['merge'](_0x50a03b[_0x8ec4('0x3b')],{'$or':_[_0x8ec4('0x2b')](_0xd2cefb,function(_0x386449){if(_0x386449[_0x8ec4('0x2d')]!=='VIRTUAL'){var _0x3699c3={};_0x3699c3[_0x386449[_0x8ec4('0x28')]]={'$like':'%'+_0x135b65[_0x8ec4('0x30')][_0x8ec4('0x3d')]+'%'};return _0x3699c3;}})});}_0x50a03b=_['merge']({},_0x50a03b,_0x135b65[_0x8ec4('0x3e')]);var _0x4c7b87={'where':_0x50a03b[_0x8ec4('0x3b')]};return db['ServicenowAccount']['count'](_0x4c7b87)[_0x8ec4('0x25')](function(_0x5d33ed){_0x470800[_0x8ec4('0x21')]=_0x5d33ed;if(_0x135b65['query'][_0x8ec4('0x3f')]){_0x50a03b[_0x8ec4('0x40')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x8ec4('0x41')](_0x50a03b);})[_0x8ec4('0x25')](function(_0x7ea59f){_0x470800[_0x8ec4('0x42')]=_0x7ea59f;return _0x470800;})[_0x8ec4('0x25')](respondWithFilteredResult(_0x2b6437,_0x50a03b))[_0x8ec4('0x43')](handleError(_0x2b6437,null));};exports['show']=function(_0x514cc2,_0x411b02){var _0x1057ed={'raw':![],'where':{'id':_0x514cc2[_0x8ec4('0x44')]['id']}},_0x47db6e={};_0x47db6e[_0x8ec4('0x2f')]=_[_0x8ec4('0x31')](db[_0x8ec4('0x45')][_0x8ec4('0x2c')]);_0x47db6e[_0x8ec4('0x30')]=_['keys'](_0x514cc2['query']);_0x47db6e[_0x8ec4('0x32')]=_[_0x8ec4('0x33')](_0x47db6e[_0x8ec4('0x2f')],_0x47db6e['query']);_0x1057ed[_0x8ec4('0x34')]=_[_0x8ec4('0x33')](_0x47db6e[_0x8ec4('0x2f')],qs['fields'](_0x514cc2[_0x8ec4('0x30')][_0x8ec4('0x35')]));_0x1057ed[_0x8ec4('0x34')]=_0x1057ed[_0x8ec4('0x34')][_0x8ec4('0x36')]?_0x1057ed[_0x8ec4('0x34')]:_0x47db6e[_0x8ec4('0x2f')];if(_0x514cc2['query'][_0x8ec4('0x3f')]){_0x1057ed[_0x8ec4('0x40')]=[{'all':!![]}];}_0x1057ed=_[_0x8ec4('0x46')]({},_0x1057ed,_0x514cc2[_0x8ec4('0x3e')]);return db[_0x8ec4('0x45')][_0x8ec4('0x47')](_0x1057ed)['then'](handleEntityNotFound(_0x411b02,null))['then'](respondWithResult(_0x411b02,null))[_0x8ec4('0x43')](handleError(_0x411b02,null));};exports['create']=function(_0x28af5b,_0x2b37ce){return db[_0x8ec4('0x45')]['create'](_0x28af5b[_0x8ec4('0x48')],{})[_0x8ec4('0x25')](respondWithResult(_0x2b37ce,0xc9))[_0x8ec4('0x43')](handleError(_0x2b37ce,null));};exports['update']=function(_0x1fc9f0,_0x136d0c){if(_0x1fc9f0[_0x8ec4('0x48')]['id']){delete _0x1fc9f0[_0x8ec4('0x48')]['id'];}return db[_0x8ec4('0x45')][_0x8ec4('0x47')]({'where':{'id':_0x1fc9f0['params']['id']}})[_0x8ec4('0x25')](handleEntityNotFound(_0x136d0c,null))[_0x8ec4('0x25')](saveUpdates(_0x1fc9f0['body'],null))[_0x8ec4('0x25')](respondWithResult(_0x136d0c,null))[_0x8ec4('0x43')](handleError(_0x136d0c,null));};exports[_0x8ec4('0x49')]=function(_0x59a057,_0xd3202d){return db['ServicenowAccount'][_0x8ec4('0x47')]({'where':{'id':_0x59a057[_0x8ec4('0x44')]['id']}})['then'](handleEntityNotFound(_0xd3202d,null))[_0x8ec4('0x25')](removeEntity(_0xd3202d,null))[_0x8ec4('0x43')](handleError(_0xd3202d,null));};exports['getConfigurations']=function(_0xd13e1a,_0xf08556,_0x5b9373){var _0x491f30={};var _0x26c0b5={};var _0x5518e9;var _0x286fa8;return db['ServicenowAccount'][_0x8ec4('0x4a')]({'where':{'id':_0xd13e1a[_0x8ec4('0x44')]['id']}})[_0x8ec4('0x25')](handleEntityNotFound(_0xf08556,null))['then'](function(_0x3705a3){if(_0x3705a3){_0x5518e9=_0x3705a3;_0x26c0b5['model']=_[_0x8ec4('0x31')](db[_0x8ec4('0x4b')][_0x8ec4('0x2c')]);_0x26c0b5[_0x8ec4('0x30')]=_[_0x8ec4('0x31')](_0xd13e1a[_0x8ec4('0x30')]);_0x26c0b5[_0x8ec4('0x32')]=_['intersection'](_0x26c0b5[_0x8ec4('0x2f')],_0x26c0b5[_0x8ec4('0x30')]);_0x491f30[_0x8ec4('0x34')]=_['intersection'](_0x26c0b5[_0x8ec4('0x2f')],qs['fields'](_0xd13e1a[_0x8ec4('0x30')][_0x8ec4('0x35')]));_0x491f30[_0x8ec4('0x34')]=_0x491f30['attributes'][_0x8ec4('0x36')]?_0x491f30[_0x8ec4('0x34')]:_0x26c0b5['model'];_0x491f30['order']=qs[_0x8ec4('0x3a')](_0xd13e1a[_0x8ec4('0x30')]['sort']);_0x491f30['where']=qs[_0x8ec4('0x32')](_[_0x8ec4('0x3c')](_0xd13e1a['query'],_0x26c0b5['filters']));if(_0xd13e1a[_0x8ec4('0x30')]['filter']){_0x491f30['where']=_[_0x8ec4('0x46')](_0x491f30[_0x8ec4('0x3b')],{'$or':_[_0x8ec4('0x2b')](_0x491f30['attributes'],function(_0x2c0c66){var _0x46d695={};_0x46d695[_0x2c0c66]={'$like':'%'+_0xd13e1a['query'][_0x8ec4('0x3d')]+'%'};return _0x46d695;})});}_0x491f30=_[_0x8ec4('0x46')]({},_0x491f30,_0xd13e1a[_0x8ec4('0x3e')]);return _0x5518e9['getConfigurations'](_0x491f30);}})[_0x8ec4('0x25')](function(_0x551a11){if(_0x551a11){_0x286fa8=_0x551a11[_0x8ec4('0x36')];if(!_0xd13e1a[_0x8ec4('0x30')]['hasOwnProperty'](_0x8ec4('0x38'))){_0x491f30[_0x8ec4('0x20')]=qs[_0x8ec4('0x20')](_0xd13e1a[_0x8ec4('0x30')][_0x8ec4('0x20')]);_0x491f30[_0x8ec4('0x1e')]=qs[_0x8ec4('0x1e')](_0xd13e1a[_0x8ec4('0x30')]['offset']);}return _0x5518e9[_0x8ec4('0x4c')](_0x491f30);}})[_0x8ec4('0x25')](function(_0x13ce50){if(_0x13ce50){return _0x13ce50?{'count':_0x286fa8,'rows':_0x13ce50}:null;}})[_0x8ec4('0x25')](respondWithResult(_0xf08556,null))['catch'](handleError(_0xf08556,null));};exports[_0x8ec4('0x4d')]=function(_0x3761ce,_0x4066ab,_0x2e5c3d){if(_0x3761ce[_0x8ec4('0x48')]['id']){delete _0x3761ce[_0x8ec4('0x48')]['id'];}return db[_0x8ec4('0x45')]['findOne']({'where':{'id':_0x3761ce['params']['id']}})[_0x8ec4('0x25')](handleEntityNotFound(_0x4066ab,null))[_0x8ec4('0x25')](function(_0x1a6c0a){if(_0x1a6c0a){_0x3761ce[_0x8ec4('0x48')][_0x8ec4('0x4e')]=_0x1a6c0a['id'];_0x3761ce[_0x8ec4('0x48')][_0x8ec4('0x4f')]=integrations[_0x8ec4('0x50')](_0x3761ce['body'][_0x8ec4('0x51')],_0x3761ce[_0x8ec4('0x48')]['type']);_0x3761ce[_0x8ec4('0x48')][_0x8ec4('0x52')]=integrations[_0x8ec4('0x53')](_0x3761ce['body'][_0x8ec4('0x51')],_0x3761ce['body'][_0x8ec4('0x2d')]);return db['ServicenowConfiguration'][_0x8ec4('0x54')](_0x3761ce[_0x8ec4('0x48')],{'include':[{'model':db[_0x8ec4('0x55')],'as':_0x8ec4('0x4f')},{'model':db['ServicenowField'],'as':_0x8ec4('0x52')}]});}return null;})[_0x8ec4('0x25')](respondWithResult(_0x4066ab,null))[_0x8ec4('0x43')](handleError(_0x4066ab,null));};exports[_0x8ec4('0x56')]=function(_0x503dbb,_0x36cb36,_0x4f4b88){var _0x588d44=[_0x8ec4('0x57'),_0x8ec4('0x58'),'knowledge',_0x8ec4('0x59'),_0x8ec4('0x5a'),_0x8ec4('0x5b'),_0x8ec4('0x5c'),_0x8ec4('0x5d'),_0x8ec4('0x5e')];var _0x1ce665=['parent',_0x8ec4('0x57'),_0x8ec4('0x5f'),_0x8ec4('0x60'),_0x8ec4('0x61'),_0x8ec4('0x62'),_0x8ec4('0x63'),_0x8ec4('0x58'),_0x8ec4('0x64'),_0x8ec4('0x65'),_0x8ec4('0x66'),_0x8ec4('0x67'),_0x8ec4('0x68'),_0x8ec4('0x69'),_0x8ec4('0x6a'),_0x8ec4('0x6b'),'state','sys_created_by',_0x8ec4('0x6c'),_0x8ec4('0x39'),'calendar_stc',_0x8ec4('0x6d'),_0x8ec4('0x6e'),'delivery_plan','impact','active',_0x8ec4('0x6f'),_0x8ec4('0x70'),_0x8ec4('0x71'),_0x8ec4('0x72'),_0x8ec4('0x73'),_0x8ec4('0x74'),'expected_start',_0x8ec4('0x75'),'business_duration',_0x8ec4('0x76'),_0x8ec4('0x77'),_0x8ec4('0x78'),_0x8ec4('0x79'),_0x8ec4('0x7a'),_0x8ec4('0x7b'),_0x8ec4('0x59'),_0x8ec4('0x7c'),_0x8ec4('0x7d'),'close_code',_0x8ec4('0x7e'),_0x8ec4('0x7f'),'work_start',_0x8ec4('0x80'),'business_stc','additional_assignee_list',_0x8ec4('0x81'),'calendar_duration',_0x8ec4('0x5b'),'sys_class_name',_0x8ec4('0x82'),'closed_by',_0x8ec4('0x83'),_0x8ec4('0x84'),_0x8ec4('0x85'),_0x8ec4('0x86'),_0x8ec4('0x87'),_0x8ec4('0x5c'),'urgency','problem_id',_0x8ec4('0x88'),_0x8ec4('0x89'),_0x8ec4('0x8a'),'assigned_to','severity','comments',_0x8ec4('0x8b'),_0x8ec4('0x8c'),'comments_and_work_notes','due_date',_0x8ec4('0x8d'),'reopen_count',_0x8ec4('0x8e'),_0x8ec4('0x8f'),_0x8ec4('0x90'),_0x8ec4('0x91'),_0x8ec4('0x92'),'category'];var _0x1b0ad0='';var _0x201b0f='';var _0xfc029d=[];var _0x559255='';var _0xc555a2='';var _0x44299e=[];var _0x3018ba='';var _0x1b5b4e='';var _0x54e16d={};var _0x30e6f0='';return db[_0x8ec4('0x45')][_0x8ec4('0x4a')]({'where':{'id':_0x503dbb[_0x8ec4('0x44')]['id']},'attributes':['id',_0x8ec4('0x93'),_0x8ec4('0x94'),'email',_0x8ec4('0x95'),_0x8ec4('0x96')]})[_0x8ec4('0x25')](handleEntityNotFound(_0x36cb36,null))[_0x8ec4('0x25')](function(_0x5249ca){if(_0x5249ca){_0x30e6f0=_0x5249ca['remoteUri'];var _0x1985e2=_0x30e6f0[_0x8ec4('0x97')](-0x1);if(_0x1985e2==='/'){_0x30e6f0=_0x30e6f0['substring'](0x0,_0x30e6f0[_0x8ec4('0x98')](_0x1985e2));}_0x1b5b4e=util[_0x8ec4('0x99')](_0x8ec4('0x9a'),_0x30e6f0);_0x3018ba=util['format'](_0x8ec4('0x9b'),_0x30e6f0);_0x54e16d={'user':_0x5249ca['username'],'pass':_0x5249ca[_0x8ec4('0x94')]};var _0xff9029={'method':_0x8ec4('0x9c'),'uri':_0x1b5b4e+_0x8ec4('0x9d'),'auth':_0x54e16d,'json':!![]};return rp(_0xff9029);}})[_0x8ec4('0x25')](function(_0x42083e){if(_0x42083e[_0x8ec4('0x9e')]['length']>0x0){_0x1b0ad0=_0x42083e['result'];}console[_0x8ec4('0x9f')](_0x8ec4('0xa0'),_0x1b0ad0);_0x44299e=[];_0x201b0f=Object[_0x8ec4('0xa1')]([],_0x1b0ad0);_[_0x8ec4('0xa2')](_0x201b0f,function(_0x3bc1bb){return!_0x588d44['includes'](_0x3bc1bb[_0x8ec4('0x28')]);});_0x201b0f[_0x8ec4('0xa3')](function(_0x3efc94){var _0x56923c=createFieldObject(_0x3018ba,_0x54e16d,_0x3efc94[_0x8ec4('0xa4')],_0x3efc94[_0x8ec4('0x28')],_0x3efc94[_0x8ec4('0xa5')],![]);_0x44299e[_0x8ec4('0xa6')](_0x56923c);});return Promise['all'](_0x44299e);})['then'](function(_0x59155e){_0xfc029d=_0x59155e;_0x559255=Object['assign']([],_0x1b0ad0);console[_0x8ec4('0x9f')](_0x8ec4('0xa7'),_0x1b0ad0);_[_0x8ec4('0xa2')](_0x559255,function(_0x42893e){return _0x1ce665['includes'](_0x42893e[_0x8ec4('0x28')]);});console[_0x8ec4('0x9f')](_0x8ec4('0xa8'),_0x559255);_0x44299e=[];_0x559255[_0x8ec4('0xa3')](function(_0x3ef3f4){var _0x5e4e5e=createFieldObject(_0x3018ba,_0x54e16d,_0x3ef3f4[_0x8ec4('0xa4')],_0x3ef3f4['name'],_0x3ef3f4[_0x8ec4('0xa5')],!![]);_0x44299e[_0x8ec4('0xa6')](_0x5e4e5e);});return Promise[_0x8ec4('0xa9')](_0x44299e);})[_0x8ec4('0x25')](function(_0x2b0cd9){_0xc555a2=_0x2b0cd9;var _0x2aeb69=_0xfc029d[_0x8ec4('0xaa')](_0xc555a2);return{'count':_0x2aeb69[_0x8ec4('0x36')],'rows':_0x2aeb69};})[_0x8ec4('0x25')](respondWithResult(_0x36cb36,null))['catch'](function(_0x5c1df5){console[_0x8ec4('0x9f')](_0x8ec4('0xab')+_0x5c1df5);var _0x2eddf5=_0x503dbb[_0x8ec4('0x30')][_0x8ec4('0xac')]?0x1f4:_0x5c1df5[_0x8ec4('0xad')]||0x1f4;logger[_0x8ec4('0x26')](_0x5c1df5[_0x8ec4('0x27')]);delete _0x5c1df5[_0x8ec4('0x28')];if(_0x2eddf5===0x191){_0x2eddf5=0x190;}_0x36cb36['status'](_0x2eddf5)[_0x8ec4('0x29')](_0x503dbb[_0x8ec4('0x30')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x5c1df5[_0x8ec4('0xad')]}:_0x5c1df5);});};function createFieldObject(_0x50dc24,_0x3c4cdf,_0x5617b1,_0x20f2ae,_0x2df8f6,_0xb49a61){return new Promise(function(_0x36d4a2,_0x367f66){var _0x224a49={'id':_0x20f2ae,'name':_0x2df8f6,'custom':_0xb49a61};if(_0x5617b1===_0x8ec4('0xae')){_0x224a49['options']=[{'name':_0x8ec4('0xaf'),'value':_0x8ec4('0xb0')},{'name':_0x8ec4('0xb1'),'value':_0x8ec4('0xb2')}];_0x36d4a2(_0x224a49);}else{var _0x2f37e8={'method':_0x8ec4('0x9c'),'uri':_0x50dc24+_0x8ec4('0xb3')+_0x20f2ae,'auth':_0x3c4cdf,'json':!![]};return rp(_0x2f37e8)['then'](function(_0x52c3ed){var _0x85ad6=[];if(_0x52c3ed['result'][_0x8ec4('0x36')]>0x0){_0x52c3ed[_0x8ec4('0x9e')][_0x8ec4('0xa3')](function(_0xd2c835){if(_0xd2c835[_0x8ec4('0xb4')]===_0x8ec4('0xb2')){var _0x4851a2={'name':_0xd2c835[_0x8ec4('0xa5')],'value':_0xd2c835['value']};_0x85ad6[_0x8ec4('0xa6')](_0x4851a2);}});}_0x224a49[_0x8ec4('0x3e')]=_0x85ad6;if(_0x224a49[_0x8ec4('0x3e')][_0x8ec4('0x36')]>0x0){_0x36d4a2(_0x224a49);}else{if(_0xb49a61==![]){_0x36d4a2();}else{_0x36d4a2(_0x224a49);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index b295c39..973f02a 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 _0xbd51=['./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','lodash','../../config/logger','api','moment','bluebird'];(function(_0x1d8f42,_0x246a11){var _0x31d7b3=function(_0x266690){while(--_0x266690){_0x1d8f42['push'](_0x1d8f42['shift']());}};_0x31d7b3(++_0x246a11);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x17bc32,_0x18b186){_0x17bc32=_0x17bc32-0x0;var _0x4b74f4=_0xbd51[_0x17bc32];return _0x4b74f4;};'use strict';var _=require(_0x1bd5('0x0'));var util=require('util');var logger=require(_0x1bd5('0x1'))(_0x1bd5('0x2'));var moment=require(_0x1bd5('0x3'));var BPromise=require(_0x1bd5('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(_0x1bd5('0x5'));var integrations=require(_0x1bd5('0x6'));module[_0x1bd5('0x7')]=function(_0x59ddfb,_0x29abea){return _0x59ddfb[_0x1bd5('0x8')](_0x1bd5('0x9'),attributes,{'tableName':_0x1bd5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4819=['request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','exports','define','ServicenowAccount','int_servicenow_accounts','util','../../config/logger','api','moment','bluebird'];(function(_0x39e845,_0x1ed12a){var _0x5ee79e=function(_0x2237b6){while(--_0x2237b6){_0x39e845['push'](_0x39e845['shift']());}};_0x5ee79e(++_0x1ed12a);}(_0x4819,0xcd));var _0x9481=function(_0x54bb04,_0x3aaec2){_0x54bb04=_0x54bb04-0x0;var _0xf7a4f4=_0x4819[_0x54bb04];return _0xf7a4f4;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var logger=require(_0x9481('0x1'))(_0x9481('0x2'));var moment=require(_0x9481('0x3'));var BPromise=require(_0x9481('0x4'));var rp=require(_0x9481('0x5'));var fs=require('fs');var path=require(_0x9481('0x6'));var rimraf=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var attributes=require(_0x9481('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x9481('0xa')]=function(_0x5def07,_0x54cc78){return _0x5def07[_0x9481('0xb')](_0x9481('0xc'),attributes,{'tableName':_0x9481('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 7fd905f..fe15737 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 _0x7c9f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowServicenowAccount','find','util'];(function(_0x40e28e,_0x49f458){var _0x40fcda=function(_0x288d8d){while(--_0x288d8d){_0x40e28e['push'](_0x40e28e['shift']());}};_0x40fcda(++_0x49f458);}(_0x7c9f,0x8f));var _0xf7c9=function(_0x594d9d,_0x264beb){_0x594d9d=_0x594d9d-0x0;var _0x483050=_0x7c9f[_0x594d9d];return _0x483050;};'use strict';var _=require('lodash');var util=require(_0xf7c9('0x0'));var moment=require('moment');var BPromise=require(_0xf7c9('0x1'));var rs=require(_0xf7c9('0x2'));var fs=require('fs');var Redis=require(_0xf7c9('0x3'));var db=require(_0xf7c9('0x4'))['db'];var utils=require(_0xf7c9('0x5'));var logger=require(_0xf7c9('0x6'))(_0xf7c9('0x7'));var config=require(_0xf7c9('0x8'));var jayson=require(_0xf7c9('0x9'));var client=jayson[_0xf7c9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x222f05,_0x2b8a7d,_0x54214f){return new BPromise(function(_0x3ae96e,_0x422dc3){return client[_0xf7c9('0xb')](_0x222f05,_0x54214f)[_0xf7c9('0xc')](function(_0x14ec92){logger[_0xf7c9('0xd')](_0xf7c9('0xe'),_0x2b8a7d,_0xf7c9('0xf'));logger[_0xf7c9('0x10')](_0xf7c9('0x11'),_0x2b8a7d,_0xf7c9('0xf'),JSON[_0xf7c9('0x12')](_0x14ec92));if(_0x14ec92[_0xf7c9('0x13')]){if(_0x14ec92['error']['code']===0x1f4){logger[_0xf7c9('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x2b8a7d,_0x14ec92[_0xf7c9('0x13')]['message']);return _0x422dc3(_0x14ec92[_0xf7c9('0x13')]['message']);}logger[_0xf7c9('0x13')](_0xf7c9('0xe'),_0x2b8a7d,_0x14ec92[_0xf7c9('0x13')][_0xf7c9('0x14')]);return _0x3ae96e(_0x14ec92['error'][_0xf7c9('0x14')]);}else{logger[_0xf7c9('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x2b8a7d,_0xf7c9('0xf'));_0x3ae96e(_0x14ec92[_0xf7c9('0x15')]['message']);}})['catch'](function(_0x376d00){logger[_0xf7c9('0x13')](_0xf7c9('0xe'),_0x2b8a7d,_0x376d00);_0x422dc3(_0x376d00);});});}exports[_0xf7c9('0x16')]=function(_0x335e58){var _0xf965d=this;return new Promise(function(_0x412df6,_0x158425){return db[_0xf7c9('0x17')][_0xf7c9('0x18')]({'raw':_0x335e58[_0xf7c9('0x19')]?_0x335e58['options'][_0xf7c9('0x1a')]===undefined?!![]:![]:!![],'where':_0x335e58['options']?_0x335e58[_0xf7c9('0x19')][_0xf7c9('0x1b')]||null:null,'attributes':_0x335e58[_0xf7c9('0x19')]?_0x335e58[_0xf7c9('0x19')][_0xf7c9('0x1c')]||null:null,'limit':_0x335e58[_0xf7c9('0x19')]?_0x335e58[_0xf7c9('0x19')][_0xf7c9('0x1d')]||null:null,'include':_0x335e58['options']?_0x335e58[_0xf7c9('0x19')][_0xf7c9('0x1e')]?_[_0xf7c9('0x1f')](_0x335e58[_0xf7c9('0x19')]['include'],function(_0xc49dd1){return{'model':db[_0xc49dd1['model']],'as':_0xc49dd1['as'],'attributes':_0xc49dd1[_0xf7c9('0x1c')],'include':_0xc49dd1[_0xf7c9('0x1e')]?_[_0xf7c9('0x1f')](_0xc49dd1['include'],function(_0x5e544a){return{'model':db[_0x5e544a['model']],'as':_0x5e544a['as'],'attributes':_0x5e544a[_0xf7c9('0x1c')],'include':_0x5e544a['include']?_[_0xf7c9('0x1f')](_0x5e544a[_0xf7c9('0x1e')],function(_0x270bab){return{'model':db[_0x270bab[_0xf7c9('0x20')]],'as':_0x270bab['as'],'attributes':_0x270bab[_0xf7c9('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x371c98){logger[_0xf7c9('0xd')](_0xf7c9('0x16'),_0x335e58);logger[_0xf7c9('0x10')](_0xf7c9('0x16'),_0x335e58,JSON[_0xf7c9('0x12')](_0x371c98));_0x412df6(_0x371c98);})[_0xf7c9('0x21')](function(_0x2793d3){logger['error'](_0xf7c9('0x16'),_0x2793d3[_0xf7c9('0x14')],_0x335e58);_0x158425(_0xf965d[_0xf7c9('0x13')](0x1f4,_0x2793d3[_0xf7c9('0x14')]));});});};exports[_0xf7c9('0x22')]=function(_0x3a30be){var _0x4cb4f4=this;return new Promise(function(_0x38d5d9,_0x1b3a60){return db[_0xf7c9('0x17')][_0xf7c9('0x23')]({'raw':_0x3a30be[_0xf7c9('0x19')]?_0x3a30be[_0xf7c9('0x19')][_0xf7c9('0x1a')]===undefined?!![]:![]:!![],'where':_0x3a30be['options']?_0x3a30be['options']['where']||null:null,'attributes':_0x3a30be['options']?_0x3a30be[_0xf7c9('0x19')][_0xf7c9('0x1c')]||null:null,'include':_0x3a30be[_0xf7c9('0x19')]?_0x3a30be[_0xf7c9('0x19')][_0xf7c9('0x1e')]?_[_0xf7c9('0x1f')](_0x3a30be[_0xf7c9('0x19')][_0xf7c9('0x1e')],function(_0x1f8ba0){return{'model':db[_0x1f8ba0[_0xf7c9('0x20')]],'as':_0x1f8ba0['as'],'attributes':_0x1f8ba0[_0xf7c9('0x1c')],'include':_0x1f8ba0[_0xf7c9('0x1e')]?_['map'](_0x1f8ba0['include'],function(_0x2a9e33){return{'model':db[_0x2a9e33[_0xf7c9('0x20')]],'as':_0x2a9e33['as'],'attributes':_0x2a9e33[_0xf7c9('0x1c')],'include':_0x2a9e33[_0xf7c9('0x1e')]?_[_0xf7c9('0x1f')](_0x2a9e33[_0xf7c9('0x1e')],function(_0x56226c){return{'model':db[_0x56226c['model']],'as':_0x56226c['as'],'attributes':_0x56226c[_0xf7c9('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x34318d){logger['info']('ShowServicenowAccount',_0x3a30be);logger[_0xf7c9('0x10')](_0xf7c9('0x22'),_0x3a30be,JSON['stringify'](_0x34318d));_0x38d5d9(_0x34318d);})[_0xf7c9('0x21')](function(_0x393019){logger[_0xf7c9('0x13')](_0xf7c9('0x22'),_0x393019['message'],_0x3a30be);_0x1b3a60(_0x4cb4f4[_0xf7c9('0x13')](0x1f4,_0x393019['message']));});});}; \ No newline at end of file +var _0xc236=['attributes','include','map','model','then','GetServicenowAccount','ShowServicenowAccount','stringify','lodash','util','moment','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','request','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','ServicenowAccount','findAll','options','where'];(function(_0x58f270,_0x218704){var _0x43d46f=function(_0x2a43f1){while(--_0x2a43f1){_0x58f270['push'](_0x58f270['shift']());}};_0x43d46f(++_0x218704);}(_0xc236,0x148));var _0x6c23=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc236[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6c23('0x0'));var util=require(_0x6c23('0x1'));var moment=require(_0x6c23('0x2'));var BPromise=require('bluebird');var rs=require(_0x6c23('0x3'));var fs=require('fs');var Redis=require(_0x6c23('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6c23('0x5'))('rpc');var config=require(_0x6c23('0x6'));var jayson=require(_0x6c23('0x7'));var client=jayson[_0x6c23('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e815d,_0x139ec4,_0x4108d6){return new BPromise(function(_0x4bedee,_0x761aba){return client[_0x6c23('0x9')](_0x1e815d,_0x4108d6)['then'](function(_0x2797eb){logger['info'](_0x6c23('0xa'),_0x139ec4,_0x6c23('0xb'));logger[_0x6c23('0xc')](_0x6c23('0xd'),_0x139ec4,_0x6c23('0xb'),JSON['stringify'](_0x2797eb));if(_0x2797eb[_0x6c23('0xe')]){if(_0x2797eb[_0x6c23('0xe')][_0x6c23('0xf')]===0x1f4){logger[_0x6c23('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x139ec4,_0x2797eb[_0x6c23('0xe')]['message']);return _0x761aba(_0x2797eb[_0x6c23('0xe')][_0x6c23('0x10')]);}logger[_0x6c23('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x139ec4,_0x2797eb['error'][_0x6c23('0x10')]);return _0x4bedee(_0x2797eb[_0x6c23('0xe')][_0x6c23('0x10')]);}else{logger[_0x6c23('0x11')](_0x6c23('0xa'),_0x139ec4,'request\x20sent');_0x4bedee(_0x2797eb[_0x6c23('0x12')][_0x6c23('0x10')]);}})[_0x6c23('0x13')](function(_0xac093d){logger[_0x6c23('0xe')](_0x6c23('0xa'),_0x139ec4,_0xac093d);_0x761aba(_0xac093d);});});}exports['GetServicenowAccount']=function(_0x2fb10d){var _0x84f181=this;return new Promise(function(_0xfa477,_0x2469c0){return db[_0x6c23('0x14')][_0x6c23('0x15')]({'raw':_0x2fb10d[_0x6c23('0x16')]?_0x2fb10d[_0x6c23('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x2fb10d[_0x6c23('0x16')]?_0x2fb10d[_0x6c23('0x16')][_0x6c23('0x17')]||null:null,'attributes':_0x2fb10d['options']?_0x2fb10d['options'][_0x6c23('0x18')]||null:null,'limit':_0x2fb10d['options']?_0x2fb10d[_0x6c23('0x16')]['limit']||null:null,'include':_0x2fb10d[_0x6c23('0x16')]?_0x2fb10d[_0x6c23('0x16')][_0x6c23('0x19')]?_[_0x6c23('0x1a')](_0x2fb10d['options'][_0x6c23('0x19')],function(_0x435a35){return{'model':db[_0x435a35['model']],'as':_0x435a35['as'],'attributes':_0x435a35[_0x6c23('0x18')],'include':_0x435a35[_0x6c23('0x19')]?_[_0x6c23('0x1a')](_0x435a35[_0x6c23('0x19')],function(_0x24cb2c){return{'model':db[_0x24cb2c[_0x6c23('0x1b')]],'as':_0x24cb2c['as'],'attributes':_0x24cb2c[_0x6c23('0x18')],'include':_0x24cb2c['include']?_['map'](_0x24cb2c[_0x6c23('0x19')],function(_0x5b59cd){return{'model':db[_0x5b59cd[_0x6c23('0x1b')]],'as':_0x5b59cd['as'],'attributes':_0x5b59cd[_0x6c23('0x18')]};}):[]};}):[]};}):[]:[]})[_0x6c23('0x1c')](function(_0x46356f){logger['info'](_0x6c23('0x1d'),_0x2fb10d);logger['debug'](_0x6c23('0x1d'),_0x2fb10d,JSON['stringify'](_0x46356f));_0xfa477(_0x46356f);})[_0x6c23('0x13')](function(_0x395936){logger[_0x6c23('0xe')](_0x6c23('0x1d'),_0x395936[_0x6c23('0x10')],_0x2fb10d);_0x2469c0(_0x84f181[_0x6c23('0xe')](0x1f4,_0x395936['message']));});});};exports[_0x6c23('0x1e')]=function(_0x522edc){var _0x12bf9a=this;return new Promise(function(_0x4080fc,_0x539379){return db[_0x6c23('0x14')]['find']({'raw':_0x522edc[_0x6c23('0x16')]?_0x522edc[_0x6c23('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x522edc[_0x6c23('0x16')]?_0x522edc[_0x6c23('0x16')][_0x6c23('0x17')]||null:null,'attributes':_0x522edc[_0x6c23('0x16')]?_0x522edc[_0x6c23('0x16')][_0x6c23('0x18')]||null:null,'include':_0x522edc[_0x6c23('0x16')]?_0x522edc[_0x6c23('0x16')][_0x6c23('0x19')]?_[_0x6c23('0x1a')](_0x522edc[_0x6c23('0x16')][_0x6c23('0x19')],function(_0x45d46f){return{'model':db[_0x45d46f[_0x6c23('0x1b')]],'as':_0x45d46f['as'],'attributes':_0x45d46f[_0x6c23('0x18')],'include':_0x45d46f['include']?_[_0x6c23('0x1a')](_0x45d46f['include'],function(_0x152069){return{'model':db[_0x152069['model']],'as':_0x152069['as'],'attributes':_0x152069[_0x6c23('0x18')],'include':_0x152069['include']?_[_0x6c23('0x1a')](_0x152069[_0x6c23('0x19')],function(_0x33d5e6){return{'model':db[_0x33d5e6['model']],'as':_0x33d5e6['as'],'attributes':_0x33d5e6[_0x6c23('0x18')]};}):[]};}):[]};}):[]:[]})[_0x6c23('0x1c')](function(_0x493f4e){logger['info'](_0x6c23('0x1e'),_0x522edc);logger['debug']('ShowServicenowAccount',_0x522edc,JSON[_0x6c23('0x1f')](_0x493f4e));_0x4080fc(_0x493f4e);})[_0x6c23('0x13')](function(_0x387bf0){logger[_0x6c23('0xe')](_0x6c23('0x1e'),_0x387bf0[_0x6c23('0x10')],_0x522edc);_0x539379(_0x12bf9a['error'](0x1f4,_0x387bf0[_0x6c23('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index e06fb43..cec5473 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 _0xbb9b=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/descriptions','getDescriptions','post'];(function(_0x53b555,_0x5edc73){var _0x275ef8=function(_0x4d9b69){while(--_0x4d9b69){_0x53b555['push'](_0x53b555['shift']());}};_0x275ef8(++_0x5edc73);}(_0xbb9b,0xad));var _0xbbb9=function(_0x1d52d3,_0x2a0df0){_0x1d52d3=_0x1d52d3-0x0;var _0x1ad74b=_0xbb9b[_0x1d52d3];return _0x1ad74b;};'use strict';var multer=require(_0xbbb9('0x0'));var util=require(_0xbbb9('0x1'));var path=require(_0xbbb9('0x2'));var timeout=require(_0xbbb9('0x3'));var express=require(_0xbbb9('0x4'));var router=express[_0xbbb9('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbbb9('0x6'));var interaction=require(_0xbbb9('0x7'));var config=require(_0xbbb9('0x8'));var controller=require('./intServicenowConfiguration.controller');router[_0xbbb9('0x9')]('/',auth['isAuthenticated'](),controller[_0xbbb9('0xa')]);router[_0xbbb9('0x9')](_0xbbb9('0xb'),auth[_0xbbb9('0xc')](),controller[_0xbbb9('0xd')]);router[_0xbbb9('0x9')](_0xbbb9('0xe'),auth['isAuthenticated'](),controller[_0xbbb9('0xf')]);router[_0xbbb9('0x9')]('/:id/subjects',auth[_0xbbb9('0xc')](),controller['getSubjects']);router[_0xbbb9('0x9')](_0xbbb9('0x10'),auth['isAuthenticated'](),controller[_0xbbb9('0x11')]);router[_0xbbb9('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xbbb9('0x13')](_0xbbb9('0xb'),auth[_0xbbb9('0xc')](),controller[_0xbbb9('0x14')]);router[_0xbbb9('0x15')](_0xbbb9('0xb'),auth[_0xbbb9('0xc')](),controller[_0xbbb9('0x16')]);module[_0xbbb9('0x17')]=router; \ No newline at end of file +var _0xe176=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','getSubjects','getDescriptions','post','put','update','delete','destroy','exports'];(function(_0x461fb2,_0x3d547f){var _0xce8b31=function(_0x35bc05){while(--_0x35bc05){_0x461fb2['push'](_0x461fb2['shift']());}};_0xce8b31(++_0x3d547f);}(_0xe176,0x93));var _0x6e17=function(_0x5ea60d,_0xf1b6f3){_0x5ea60d=_0x5ea60d-0x0;var _0x1d14eb=_0xe176[_0x5ea60d];return _0x1d14eb;};'use strict';var multer=require(_0x6e17('0x0'));var util=require(_0x6e17('0x1'));var path=require('path');var timeout=require(_0x6e17('0x2'));var express=require(_0x6e17('0x3'));var router=express[_0x6e17('0x4')]();var fs_extra=require(_0x6e17('0x5'));var auth=require(_0x6e17('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6e17('0x7'));var controller=require('./intServicenowConfiguration.controller');router[_0x6e17('0x8')]('/',auth[_0x6e17('0x9')](),controller[_0x6e17('0xa')]);router['get'](_0x6e17('0xb'),auth['isAuthenticated'](),controller[_0x6e17('0xc')]);router[_0x6e17('0x8')]('/:id/fields',auth[_0x6e17('0x9')](),controller['getFields']);router[_0x6e17('0x8')]('/:id/subjects',auth[_0x6e17('0x9')](),controller[_0x6e17('0xd')]);router[_0x6e17('0x8')]('/:id/descriptions',auth[_0x6e17('0x9')](),controller[_0x6e17('0xe')]);router[_0x6e17('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6e17('0x10')](_0x6e17('0xb'),auth[_0x6e17('0x9')](),controller[_0x6e17('0x11')]);router[_0x6e17('0x12')](_0x6e17('0xb'),auth[_0x6e17('0x9')](),controller[_0x6e17('0x13')]);module[_0x6e17('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 80180b0..d12dfa6 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 _0x4751=['sequelize','exports','STRING'];(function(_0x13036b,_0x3be86e){var _0x1dbde4=function(_0xbb03a8){while(--_0xbb03a8){_0x13036b['push'](_0x13036b['shift']());}};_0x1dbde4(++_0x3be86e);}(_0x4751,0xba));var _0x1475=function(_0x198f3d,_0x3f850c){_0x198f3d=_0x198f3d-0x0;var _0x320202=_0x4751[_0x198f3d];return _0x320202;};'use strict';var Sequelize=require(_0x1475('0x0'));module[_0x1475('0x1')]={'name':{'type':Sequelize[_0x1475('0x2')]},'description':{'type':Sequelize[_0x1475('0x2')]}}; \ No newline at end of file +var _0x5b73=['sequelize','exports','STRING'];(function(_0x4af85d,_0x165292){var _0x11a1ac=function(_0x3bf951){while(--_0x3bf951){_0x4af85d['push'](_0x4af85d['shift']());}};_0x11a1ac(++_0x165292);}(_0x5b73,0x16b));var _0x35b7=function(_0x183b97,_0x2d297c){_0x183b97=_0x183b97-0x0;var _0x629cf7=_0x5b73[_0x183b97];return _0x629cf7;};'use strict';var Sequelize=require(_0x35b7('0x0'));module[_0x35b7('0x1')]={'name':{'type':Sequelize[_0x35b7('0x2')]},'description':{'type':Sequelize[_0x35b7('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 58d649f..5166f4d 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 _0xc784=['destroy','end','stack','name','map','ServicenowConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','fields','attributes','create','body','find','findOne','ServicenowField','getFields','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','count','limit','Content-Range','apply','reject','update','then'];(function(_0x292bab,_0x18b725){var _0x3a1de1=function(_0x8d52cf){while(--_0x8d52cf){_0x292bab['push'](_0x292bab['shift']());}};_0x3a1de1(++_0x18b725);}(_0xc784,0x1ba));var _0x4c78=function(_0x18b2c6,_0x5c4ed6){_0x18b2c6=_0x18b2c6-0x0;var _0x1f3834=_0xc784[_0x18b2c6];return _0x1f3834;};'use strict';var emlformat=require(_0x4c78('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4c78('0x1'));var jsonpatch=require(_0x4c78('0x2'));var rp=require(_0x4c78('0x3'));var moment=require(_0x4c78('0x4'));var BPromise=require(_0x4c78('0x5'));var Mustache=require(_0x4c78('0x6'));var util=require(_0x4c78('0x7'));var path=require(_0x4c78('0x8'));var sox=require(_0x4c78('0x9'));var csv=require('to-csv');var ejs=require(_0x4c78('0xa'));var fs=require('fs');var fs_extra=require(_0x4c78('0xb'));var _=require(_0x4c78('0xc'));var squel=require(_0x4c78('0xd'));var crypto=require(_0x4c78('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x4c78('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4c78('0x10'));var Papa=require(_0x4c78('0x11'));var Redis=require('ioredis');var authService=require(_0x4c78('0x12'));var qs=require(_0x4c78('0x13'));var as=require(_0x4c78('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4c78('0x15'))(_0x4c78('0x16'));var utils=require(_0x4c78('0x17'));var config=require(_0x4c78('0x18'));var licenseUtil=require(_0x4c78('0x19'));var db=require(_0x4c78('0x1a'))['db'];function respondWithStatusCode(_0x57c1f4,_0x4bc2b9){_0x4bc2b9=_0x4bc2b9||0xcc;return function(_0xa27f17){if(_0xa27f17){return _0x57c1f4[_0x4c78('0x1b')](_0x4bc2b9);}return _0x57c1f4[_0x4c78('0x1c')](_0x4bc2b9)['end']();};}function respondWithResult(_0x386b6b,_0x3312d1){_0x3312d1=_0x3312d1||0xc8;return function(_0x158cfa){if(_0x158cfa){return _0x386b6b[_0x4c78('0x1c')](_0x3312d1)[_0x4c78('0x1d')](_0x158cfa);}};}function respondWithFilteredResult(_0x53b7c4,_0x317519){return function(_0x2ba64a){if(_0x2ba64a){var _0x44eb96=typeof _0x317519[_0x4c78('0x1e')]==='undefined'&&typeof _0x317519['limit']==='undefined';var _0x5cbbdd=_0x2ba64a[_0x4c78('0x1f')];var _0x3f6904=_0x44eb96?0x0:_0x317519['offset'];var _0x106803=_0x44eb96?_0x2ba64a[_0x4c78('0x1f')]:_0x317519[_0x4c78('0x1e')]+_0x317519[_0x4c78('0x20')];var _0x5672e4;if(_0x106803>=_0x5cbbdd){_0x106803=_0x5cbbdd;_0x5672e4=0xc8;}else{_0x5672e4=0xce;}_0x53b7c4[_0x4c78('0x1c')](_0x5672e4);return _0x53b7c4['set'](_0x4c78('0x21'),_0x3f6904+'-'+_0x106803+'/'+_0x5cbbdd)[_0x4c78('0x1d')](_0x2ba64a);}return null;};}function patchUpdates(_0x45692d){return function(_0x1eae2c){try{jsonpatch[_0x4c78('0x22')](_0x1eae2c,_0x45692d,!![]);}catch(_0x1544ad){return BPromise[_0x4c78('0x23')](_0x1544ad);}return _0x1eae2c['save']();};}function saveUpdates(_0x46a5fb,_0x7af435){return function(_0x12cdd6){if(_0x12cdd6){return _0x12cdd6[_0x4c78('0x24')](_0x46a5fb)[_0x4c78('0x25')](function(_0x389ef3){return _0x389ef3;});}return null;};}function removeEntity(_0x34224d,_0x1b1cdd){return function(_0xb79e8d){if(_0xb79e8d){return _0xb79e8d[_0x4c78('0x26')]()[_0x4c78('0x25')](function(){_0x34224d[_0x4c78('0x1c')](0xcc)[_0x4c78('0x27')]();});}};}function handleEntityNotFound(_0x26c183,_0x34d0b6){return function(_0x1b75f7){if(!_0x1b75f7){_0x26c183[_0x4c78('0x1b')](0x194);}return _0x1b75f7;};}function handleError(_0x3159cf,_0x4eca3c){_0x4eca3c=_0x4eca3c||0x1f4;return function(_0x112201){logger['error'](_0x112201[_0x4c78('0x28')]);if(_0x112201['name']){delete _0x112201[_0x4c78('0x29')];}_0x3159cf['status'](_0x4eca3c)['send'](_0x112201);};}exports['index']=function(_0x3b0c84,_0x3064e6){var _0x51fc1e={},_0x42c09b={},_0x3bfe9d={'count':0x0,'rows':[]};var _0x275881=_[_0x4c78('0x2a')](db[_0x4c78('0x2b')][_0x4c78('0x2c')],function(_0x3767d8){return{'name':_0x3767d8['fieldName'],'type':_0x3767d8[_0x4c78('0x2d')][_0x4c78('0x2e')]};});_0x42c09b[_0x4c78('0x2f')]=_[_0x4c78('0x2a')](_0x275881,'name');_0x42c09b[_0x4c78('0x30')]=_[_0x4c78('0x31')](_0x3b0c84[_0x4c78('0x30')]);_0x42c09b[_0x4c78('0x32')]=_[_0x4c78('0x33')](_0x42c09b[_0x4c78('0x2f')],_0x42c09b[_0x4c78('0x30')]);_0x51fc1e['attributes']=_[_0x4c78('0x33')](_0x42c09b['model'],qs['fields'](_0x3b0c84[_0x4c78('0x30')]['fields']));_0x51fc1e['attributes']=_0x51fc1e['attributes'][_0x4c78('0x34')]?_0x51fc1e['attributes']:_0x42c09b[_0x4c78('0x2f')];if(!_0x3b0c84[_0x4c78('0x30')][_0x4c78('0x35')](_0x4c78('0x36'))){_0x51fc1e[_0x4c78('0x20')]=qs[_0x4c78('0x20')](_0x3b0c84[_0x4c78('0x30')][_0x4c78('0x20')]);_0x51fc1e[_0x4c78('0x1e')]=qs[_0x4c78('0x1e')](_0x3b0c84[_0x4c78('0x30')][_0x4c78('0x1e')]);}_0x51fc1e[_0x4c78('0x37')]=qs[_0x4c78('0x38')](_0x3b0c84[_0x4c78('0x30')][_0x4c78('0x38')]);_0x51fc1e[_0x4c78('0x39')]=qs['filters'](_[_0x4c78('0x3a')](_0x3b0c84['query'],_0x42c09b[_0x4c78('0x32')]),_0x275881);if(_0x3b0c84[_0x4c78('0x30')][_0x4c78('0x3b')]){_0x51fc1e[_0x4c78('0x39')]=_['merge'](_0x51fc1e[_0x4c78('0x39')],{'$or':_[_0x4c78('0x2a')](_0x275881,function(_0x1ddb50){if(_0x1ddb50[_0x4c78('0x2d')]!==_0x4c78('0x3c')){var _0x58644a={};_0x58644a[_0x1ddb50[_0x4c78('0x29')]]={'$like':'%'+_0x3b0c84[_0x4c78('0x30')][_0x4c78('0x3b')]+'%'};return _0x58644a;}})});}_0x51fc1e=_[_0x4c78('0x3d')]({},_0x51fc1e,_0x3b0c84[_0x4c78('0x3e')]);var _0x35d02e={'where':_0x51fc1e[_0x4c78('0x39')]};return db[_0x4c78('0x2b')][_0x4c78('0x1f')](_0x35d02e)[_0x4c78('0x25')](function(_0x4e0c5f){_0x3bfe9d[_0x4c78('0x1f')]=_0x4e0c5f;if(_0x3b0c84[_0x4c78('0x30')][_0x4c78('0x3f')]){_0x51fc1e[_0x4c78('0x40')]=[{'all':!![]}];}return db[_0x4c78('0x2b')][_0x4c78('0x41')](_0x51fc1e);})[_0x4c78('0x25')](function(_0x23fab4){_0x3bfe9d[_0x4c78('0x42')]=_0x23fab4;return _0x3bfe9d;})[_0x4c78('0x25')](respondWithFilteredResult(_0x3064e6,_0x51fc1e))[_0x4c78('0x43')](handleError(_0x3064e6,null));};exports[_0x4c78('0x44')]=function(_0x57a60b,_0x4026cf){var _0x4a4e1d={'raw':![],'where':{'id':_0x57a60b[_0x4c78('0x45')]['id']}},_0x593db3={};_0x593db3[_0x4c78('0x2f')]=_[_0x4c78('0x31')](db[_0x4c78('0x2b')]['rawAttributes']);_0x593db3[_0x4c78('0x30')]=_[_0x4c78('0x31')](_0x57a60b[_0x4c78('0x30')]);_0x593db3[_0x4c78('0x32')]=_[_0x4c78('0x33')](_0x593db3[_0x4c78('0x2f')],_0x593db3[_0x4c78('0x30')]);_0x4a4e1d['attributes']=_['intersection'](_0x593db3['model'],qs[_0x4c78('0x46')](_0x57a60b[_0x4c78('0x30')][_0x4c78('0x46')]));_0x4a4e1d[_0x4c78('0x47')]=_0x4a4e1d[_0x4c78('0x47')][_0x4c78('0x34')]?_0x4a4e1d[_0x4c78('0x47')]:_0x593db3['model'];if(_0x57a60b['query'][_0x4c78('0x3f')]){_0x4a4e1d[_0x4c78('0x40')]=[{'all':!![]}];}_0x4a4e1d=_[_0x4c78('0x3d')]({},_0x4a4e1d,_0x57a60b['options']);return db[_0x4c78('0x2b')]['find'](_0x4a4e1d)[_0x4c78('0x25')](handleEntityNotFound(_0x4026cf,null))[_0x4c78('0x25')](respondWithResult(_0x4026cf,null))['catch'](handleError(_0x4026cf,null));};exports[_0x4c78('0x48')]=function(_0x26a2bf,_0x5ef701){return db[_0x4c78('0x2b')][_0x4c78('0x48')](_0x26a2bf[_0x4c78('0x49')],{})[_0x4c78('0x25')](respondWithResult(_0x5ef701,0xc9))[_0x4c78('0x43')](handleError(_0x5ef701,null));};exports[_0x4c78('0x24')]=function(_0x3a9a7f,_0x291b9d){if(_0x3a9a7f[_0x4c78('0x49')]['id']){delete _0x3a9a7f[_0x4c78('0x49')]['id'];}return db['ServicenowConfiguration'][_0x4c78('0x4a')]({'where':{'id':_0x3a9a7f[_0x4c78('0x45')]['id']}})['then'](handleEntityNotFound(_0x291b9d,null))['then'](saveUpdates(_0x3a9a7f[_0x4c78('0x49')],null))['then'](respondWithResult(_0x291b9d,null))[_0x4c78('0x43')](handleError(_0x291b9d,null));};exports[_0x4c78('0x26')]=function(_0x44f0d9,_0x366226){return db['ServicenowConfiguration'][_0x4c78('0x4a')]({'where':{'id':_0x44f0d9[_0x4c78('0x45')]['id']}})[_0x4c78('0x25')](handleEntityNotFound(_0x366226,null))[_0x4c78('0x25')](removeEntity(_0x366226,null))['catch'](handleError(_0x366226,null));};exports['getFields']=function(_0x10f4a4,_0x538155,_0xa5bd8d){var _0x3d3bf4={};var _0x1f57bc={};var _0x13b612;var _0x633515;return db[_0x4c78('0x2b')][_0x4c78('0x4b')]({'where':{'id':_0x10f4a4['params']['id']}})[_0x4c78('0x25')](handleEntityNotFound(_0x538155,null))[_0x4c78('0x25')](function(_0x4dffe7){if(_0x4dffe7){_0x13b612=_0x4dffe7;_0x1f57bc[_0x4c78('0x2f')]=_[_0x4c78('0x31')](db[_0x4c78('0x4c')][_0x4c78('0x2c')]);_0x1f57bc[_0x4c78('0x30')]=_[_0x4c78('0x31')](_0x10f4a4['query']);_0x1f57bc['filters']=_['intersection'](_0x1f57bc['model'],_0x1f57bc['query']);_0x3d3bf4[_0x4c78('0x47')]=_[_0x4c78('0x33')](_0x1f57bc['model'],qs['fields'](_0x10f4a4[_0x4c78('0x30')][_0x4c78('0x46')]));_0x3d3bf4['attributes']=_0x3d3bf4[_0x4c78('0x47')][_0x4c78('0x34')]?_0x3d3bf4['attributes']:_0x1f57bc['model'];_0x3d3bf4['order']=qs[_0x4c78('0x38')](_0x10f4a4[_0x4c78('0x30')][_0x4c78('0x38')]);_0x3d3bf4[_0x4c78('0x39')]=qs[_0x4c78('0x32')](_[_0x4c78('0x3a')](_0x10f4a4[_0x4c78('0x30')],_0x1f57bc[_0x4c78('0x32')]));if(_0x10f4a4[_0x4c78('0x30')][_0x4c78('0x3b')]){_0x3d3bf4[_0x4c78('0x39')]=_['merge'](_0x3d3bf4['where'],{'$or':_[_0x4c78('0x2a')](_0x3d3bf4[_0x4c78('0x47')],function(_0x478faf){var _0x16b300={};_0x16b300[_0x478faf]={'$like':'%'+_0x10f4a4[_0x4c78('0x30')][_0x4c78('0x3b')]+'%'};return _0x16b300;})});}_0x3d3bf4=_['merge']({},_0x3d3bf4,_0x10f4a4[_0x4c78('0x3e')]);return _0x13b612[_0x4c78('0x4d')](_0x3d3bf4);}})[_0x4c78('0x25')](function(_0x303047){if(_0x303047){_0x633515=_0x303047['length'];if(!_0x10f4a4[_0x4c78('0x30')]['hasOwnProperty'](_0x4c78('0x36'))){_0x3d3bf4['limit']=qs[_0x4c78('0x20')](_0x10f4a4['query'][_0x4c78('0x20')]);_0x3d3bf4['offset']=qs[_0x4c78('0x1e')](_0x10f4a4[_0x4c78('0x30')][_0x4c78('0x1e')]);}return _0x13b612[_0x4c78('0x4d')](_0x3d3bf4);}})[_0x4c78('0x25')](function(_0x344424){if(_0x344424){return _0x344424?{'count':_0x633515,'rows':_0x344424}:null;}})[_0x4c78('0x25')](respondWithResult(_0x538155,null))[_0x4c78('0x43')](handleError(_0x538155,null));};exports[_0x4c78('0x4e')]=function(_0x4f0e15,_0x4b3474,_0x292bb3){var _0x152334={};var _0x354aef={};var _0x52a024;var _0x3d8217;return db[_0x4c78('0x2b')][_0x4c78('0x4b')]({'where':{'id':_0x4f0e15['params']['id']}})[_0x4c78('0x25')](handleEntityNotFound(_0x4b3474,null))['then'](function(_0x6bf753){if(_0x6bf753){_0x52a024=_0x6bf753;_0x354aef['model']=_[_0x4c78('0x31')](db[_0x4c78('0x4c')][_0x4c78('0x2c')]);_0x354aef['query']=_['keys'](_0x4f0e15[_0x4c78('0x30')]);_0x354aef[_0x4c78('0x32')]=_[_0x4c78('0x33')](_0x354aef[_0x4c78('0x2f')],_0x354aef['query']);_0x152334[_0x4c78('0x47')]=_[_0x4c78('0x33')](_0x354aef[_0x4c78('0x2f')],qs['fields'](_0x4f0e15[_0x4c78('0x30')]['fields']));_0x152334[_0x4c78('0x47')]=_0x152334[_0x4c78('0x47')][_0x4c78('0x34')]?_0x152334['attributes']:_0x354aef[_0x4c78('0x2f')];_0x152334[_0x4c78('0x37')]=qs[_0x4c78('0x38')](_0x4f0e15[_0x4c78('0x30')][_0x4c78('0x38')]);_0x152334[_0x4c78('0x39')]=qs[_0x4c78('0x32')](_[_0x4c78('0x3a')](_0x4f0e15['query'],_0x354aef[_0x4c78('0x32')]));if(_0x4f0e15[_0x4c78('0x30')][_0x4c78('0x3b')]){_0x152334[_0x4c78('0x39')]=_[_0x4c78('0x3d')](_0x152334[_0x4c78('0x39')],{'$or':_['map'](_0x152334[_0x4c78('0x47')],function(_0x19202c){var _0x18c7a5={};_0x18c7a5[_0x19202c]={'$like':'%'+_0x4f0e15[_0x4c78('0x30')][_0x4c78('0x3b')]+'%'};return _0x18c7a5;})});}_0x152334=_[_0x4c78('0x3d')]({},_0x152334,_0x4f0e15[_0x4c78('0x3e')]);return _0x52a024[_0x4c78('0x4e')](_0x152334);}})[_0x4c78('0x25')](function(_0x3485e2){if(_0x3485e2){_0x3d8217=_0x3485e2[_0x4c78('0x34')];if(!_0x4f0e15['query'][_0x4c78('0x35')](_0x4c78('0x36'))){_0x152334[_0x4c78('0x20')]=qs[_0x4c78('0x20')](_0x4f0e15[_0x4c78('0x30')][_0x4c78('0x20')]);_0x152334[_0x4c78('0x1e')]=qs[_0x4c78('0x1e')](_0x4f0e15[_0x4c78('0x30')][_0x4c78('0x1e')]);}return _0x52a024[_0x4c78('0x4e')](_0x152334);}})[_0x4c78('0x25')](function(_0x2df667){if(_0x2df667){return _0x2df667?{'count':_0x3d8217,'rows':_0x2df667}:null;}})['then'](respondWithResult(_0x4b3474,null))[_0x4c78('0x43')](handleError(_0x4b3474,null));};exports[_0x4c78('0x4f')]=function(_0x116aa2,_0x364cda,_0x10c238){var _0x1f5ea5={};var _0x49f126={};var _0x5dedd0;var _0x480552;return db['ServicenowConfiguration'][_0x4c78('0x4b')]({'where':{'id':_0x116aa2[_0x4c78('0x45')]['id']}})[_0x4c78('0x25')](handleEntityNotFound(_0x364cda,null))['then'](function(_0x2deb19){if(_0x2deb19){_0x5dedd0=_0x2deb19;_0x49f126['model']=_[_0x4c78('0x31')](db[_0x4c78('0x4c')][_0x4c78('0x2c')]);_0x49f126['query']=_['keys'](_0x116aa2[_0x4c78('0x30')]);_0x49f126[_0x4c78('0x32')]=_['intersection'](_0x49f126['model'],_0x49f126[_0x4c78('0x30')]);_0x1f5ea5[_0x4c78('0x47')]=_[_0x4c78('0x33')](_0x49f126[_0x4c78('0x2f')],qs['fields'](_0x116aa2[_0x4c78('0x30')][_0x4c78('0x46')]));_0x1f5ea5[_0x4c78('0x47')]=_0x1f5ea5[_0x4c78('0x47')][_0x4c78('0x34')]?_0x1f5ea5['attributes']:_0x49f126[_0x4c78('0x2f')];_0x1f5ea5[_0x4c78('0x37')]=qs[_0x4c78('0x38')](_0x116aa2[_0x4c78('0x30')][_0x4c78('0x38')]);_0x1f5ea5[_0x4c78('0x39')]=qs[_0x4c78('0x32')](_['pick'](_0x116aa2[_0x4c78('0x30')],_0x49f126[_0x4c78('0x32')]));if(_0x116aa2['query'][_0x4c78('0x3b')]){_0x1f5ea5[_0x4c78('0x39')]=_['merge'](_0x1f5ea5['where'],{'$or':_[_0x4c78('0x2a')](_0x1f5ea5[_0x4c78('0x47')],function(_0x1f0605){var _0x312a16={};_0x312a16[_0x1f0605]={'$like':'%'+_0x116aa2['query'][_0x4c78('0x3b')]+'%'};return _0x312a16;})});}_0x1f5ea5=_[_0x4c78('0x3d')]({},_0x1f5ea5,_0x116aa2[_0x4c78('0x3e')]);return _0x5dedd0[_0x4c78('0x4f')](_0x1f5ea5);}})[_0x4c78('0x25')](function(_0x14cb3f){if(_0x14cb3f){_0x480552=_0x14cb3f[_0x4c78('0x34')];if(!_0x116aa2[_0x4c78('0x30')][_0x4c78('0x35')]('nolimit')){_0x1f5ea5[_0x4c78('0x20')]=qs[_0x4c78('0x20')](_0x116aa2['query'][_0x4c78('0x20')]);_0x1f5ea5[_0x4c78('0x1e')]=qs[_0x4c78('0x1e')](_0x116aa2[_0x4c78('0x30')]['offset']);}return _0x5dedd0['getDescriptions'](_0x1f5ea5);}})[_0x4c78('0x25')](function(_0x21763f){if(_0x21763f){return _0x21763f?{'count':_0x480552,'rows':_0x21763f}:null;}})[_0x4c78('0x25')](respondWithResult(_0x364cda,null))[_0x4c78('0x43')](handleError(_0x364cda,null));}; \ No newline at end of file +var _0x9646=['moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','sendStatus','name','send','index','ServicenowConfiguration','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','length','include','find','create','body','findOne','ServicenowField','getFields','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x5948c6,_0x4de8ac){var _0x30059e=function(_0x33a25d){while(--_0x33a25d){_0x5948c6['push'](_0x5948c6['shift']());}};_0x30059e(++_0x4de8ac);}(_0x9646,0x13c));var _0x6964=function(_0x549928,_0x363b7a){_0x549928=_0x549928-0x0;var _0x941e27=_0x9646[_0x549928];return _0x941e27;};'use strict';var emlformat=require(_0x6964('0x0'));var rimraf=require(_0x6964('0x1'));var zipdir=require(_0x6964('0x2'));var jsonpatch=require(_0x6964('0x3'));var rp=require('request-promise');var moment=require(_0x6964('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6964('0x5'));var util=require(_0x6964('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x6964('0x7'));var ejs=require(_0x6964('0x8'));var fs=require('fs');var fs_extra=require(_0x6964('0x9'));var _=require(_0x6964('0xa'));var squel=require(_0x6964('0xb'));var crypto=require('crypto');var jsforce=require(_0x6964('0xc'));var deskjs=require(_0x6964('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6964('0xe'));var Papa=require(_0x6964('0xf'));var Redis=require(_0x6964('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6964('0x11'));var as=require(_0x6964('0x12'));var hardwareService=require(_0x6964('0x13'));var logger=require('../../config/logger')(_0x6964('0x14'));var utils=require(_0x6964('0x15'));var config=require(_0x6964('0x16'));var licenseUtil=require(_0x6964('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e4d23,_0x1c1242){_0x1c1242=_0x1c1242||0xcc;return function(_0x2521f3){if(_0x2521f3){return _0x5e4d23['sendStatus'](_0x1c1242);}return _0x5e4d23[_0x6964('0x18')](_0x1c1242)[_0x6964('0x19')]();};}function respondWithResult(_0x19a0a7,_0x4c5516){_0x4c5516=_0x4c5516||0xc8;return function(_0x195a0d){if(_0x195a0d){return _0x19a0a7[_0x6964('0x18')](_0x4c5516)[_0x6964('0x1a')](_0x195a0d);}};}function respondWithFilteredResult(_0x231d88,_0x1b20c5){return function(_0x348eab){if(_0x348eab){var _0x8a60a4=typeof _0x1b20c5[_0x6964('0x1b')]===_0x6964('0x1c')&&typeof _0x1b20c5[_0x6964('0x1d')]==='undefined';var _0x517c58=_0x348eab[_0x6964('0x1e')];var _0x22d52a=_0x8a60a4?0x0:_0x1b20c5[_0x6964('0x1b')];var _0xe7e146=_0x8a60a4?_0x348eab['count']:_0x1b20c5[_0x6964('0x1b')]+_0x1b20c5[_0x6964('0x1d')];var _0x5c3ce6;if(_0xe7e146>=_0x517c58){_0xe7e146=_0x517c58;_0x5c3ce6=0xc8;}else{_0x5c3ce6=0xce;}_0x231d88[_0x6964('0x18')](_0x5c3ce6);return _0x231d88[_0x6964('0x1f')]('Content-Range',_0x22d52a+'-'+_0xe7e146+'/'+_0x517c58)['json'](_0x348eab);}return null;};}function patchUpdates(_0x5b0dcb){return function(_0x454f60){try{jsonpatch[_0x6964('0x20')](_0x454f60,_0x5b0dcb,!![]);}catch(_0x1f5d7b){return BPromise[_0x6964('0x21')](_0x1f5d7b);}return _0x454f60[_0x6964('0x22')]();};}function saveUpdates(_0x333f63,_0x4cd8e1){return function(_0x11c945){if(_0x11c945){return _0x11c945[_0x6964('0x23')](_0x333f63)[_0x6964('0x24')](function(_0x6a9133){return _0x6a9133;});}return null;};}function removeEntity(_0x39d910,_0x4e7815){return function(_0x358958){if(_0x358958){return _0x358958[_0x6964('0x25')]()[_0x6964('0x24')](function(){_0x39d910[_0x6964('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9209f8,_0x2e41d5){return function(_0x2811a2){if(!_0x2811a2){_0x9209f8[_0x6964('0x26')](0x194);}return _0x2811a2;};}function handleError(_0x555e36,_0x2b501b){_0x2b501b=_0x2b501b||0x1f4;return function(_0xa4853d){logger['error'](_0xa4853d['stack']);if(_0xa4853d[_0x6964('0x27')]){delete _0xa4853d['name'];}_0x555e36['status'](_0x2b501b)[_0x6964('0x28')](_0xa4853d);};}exports[_0x6964('0x29')]=function(_0x530ec5,_0x20a84f){var _0x53cfc4={},_0x331e6c={},_0x10ec6d={'count':0x0,'rows':[]};var _0x1f7d83=_['map'](db[_0x6964('0x2a')]['rawAttributes'],function(_0x5cfccf){return{'name':_0x5cfccf[_0x6964('0x2b')],'type':_0x5cfccf[_0x6964('0x2c')][_0x6964('0x2d')]};});_0x331e6c[_0x6964('0x2e')]=_[_0x6964('0x2f')](_0x1f7d83,_0x6964('0x27'));_0x331e6c[_0x6964('0x30')]=_['keys'](_0x530ec5[_0x6964('0x30')]);_0x331e6c[_0x6964('0x31')]=_[_0x6964('0x32')](_0x331e6c[_0x6964('0x2e')],_0x331e6c[_0x6964('0x30')]);_0x53cfc4[_0x6964('0x33')]=_[_0x6964('0x32')](_0x331e6c[_0x6964('0x2e')],qs[_0x6964('0x34')](_0x530ec5[_0x6964('0x30')][_0x6964('0x34')]));_0x53cfc4['attributes']=_0x53cfc4['attributes']['length']?_0x53cfc4['attributes']:_0x331e6c[_0x6964('0x2e')];if(!_0x530ec5['query'][_0x6964('0x35')]('nolimit')){_0x53cfc4['limit']=qs['limit'](_0x530ec5[_0x6964('0x30')]['limit']);_0x53cfc4[_0x6964('0x1b')]=qs[_0x6964('0x1b')](_0x530ec5[_0x6964('0x30')][_0x6964('0x1b')]);}_0x53cfc4[_0x6964('0x36')]=qs['sort'](_0x530ec5['query'][_0x6964('0x37')]);_0x53cfc4[_0x6964('0x38')]=qs[_0x6964('0x31')](_[_0x6964('0x39')](_0x530ec5[_0x6964('0x30')],_0x331e6c[_0x6964('0x31')]),_0x1f7d83);if(_0x530ec5['query'][_0x6964('0x3a')]){_0x53cfc4[_0x6964('0x38')]=_[_0x6964('0x3b')](_0x53cfc4[_0x6964('0x38')],{'$or':_[_0x6964('0x2f')](_0x1f7d83,function(_0x4bfca9){if(_0x4bfca9[_0x6964('0x2c')]!=='VIRTUAL'){var _0x4c0bfc={};_0x4c0bfc[_0x4bfca9[_0x6964('0x27')]]={'$like':'%'+_0x530ec5['query'][_0x6964('0x3a')]+'%'};return _0x4c0bfc;}})});}_0x53cfc4=_[_0x6964('0x3b')]({},_0x53cfc4,_0x530ec5[_0x6964('0x3c')]);var _0x4efb47={'where':_0x53cfc4[_0x6964('0x38')]};return db[_0x6964('0x2a')][_0x6964('0x1e')](_0x4efb47)['then'](function(_0xe4a160){_0x10ec6d[_0x6964('0x1e')]=_0xe4a160;if(_0x530ec5[_0x6964('0x30')][_0x6964('0x3d')]){_0x53cfc4['include']=[{'all':!![]}];}return db[_0x6964('0x2a')][_0x6964('0x3e')](_0x53cfc4);})[_0x6964('0x24')](function(_0x37c1b){_0x10ec6d[_0x6964('0x3f')]=_0x37c1b;return _0x10ec6d;})['then'](respondWithFilteredResult(_0x20a84f,_0x53cfc4))[_0x6964('0x40')](handleError(_0x20a84f,null));};exports[_0x6964('0x41')]=function(_0x238649,_0x70090e){var _0xf15c66={'raw':![],'where':{'id':_0x238649[_0x6964('0x42')]['id']}},_0x2d6271={};_0x2d6271[_0x6964('0x2e')]=_[_0x6964('0x43')](db[_0x6964('0x2a')][_0x6964('0x44')]);_0x2d6271['query']=_[_0x6964('0x43')](_0x238649[_0x6964('0x30')]);_0x2d6271['filters']=_[_0x6964('0x32')](_0x2d6271[_0x6964('0x2e')],_0x2d6271[_0x6964('0x30')]);_0xf15c66[_0x6964('0x33')]=_['intersection'](_0x2d6271[_0x6964('0x2e')],qs[_0x6964('0x34')](_0x238649[_0x6964('0x30')][_0x6964('0x34')]));_0xf15c66[_0x6964('0x33')]=_0xf15c66[_0x6964('0x33')][_0x6964('0x45')]?_0xf15c66[_0x6964('0x33')]:_0x2d6271[_0x6964('0x2e')];if(_0x238649[_0x6964('0x30')][_0x6964('0x3d')]){_0xf15c66[_0x6964('0x46')]=[{'all':!![]}];}_0xf15c66=_[_0x6964('0x3b')]({},_0xf15c66,_0x238649[_0x6964('0x3c')]);return db['ServicenowConfiguration'][_0x6964('0x47')](_0xf15c66)[_0x6964('0x24')](handleEntityNotFound(_0x70090e,null))[_0x6964('0x24')](respondWithResult(_0x70090e,null))['catch'](handleError(_0x70090e,null));};exports['create']=function(_0x5e93c1,_0xae90ec){return db[_0x6964('0x2a')][_0x6964('0x48')](_0x5e93c1[_0x6964('0x49')],{})['then'](respondWithResult(_0xae90ec,0xc9))[_0x6964('0x40')](handleError(_0xae90ec,null));};exports[_0x6964('0x23')]=function(_0x18f7ec,_0x4de55f){if(_0x18f7ec[_0x6964('0x49')]['id']){delete _0x18f7ec[_0x6964('0x49')]['id'];}return db[_0x6964('0x2a')]['find']({'where':{'id':_0x18f7ec[_0x6964('0x42')]['id']}})[_0x6964('0x24')](handleEntityNotFound(_0x4de55f,null))['then'](saveUpdates(_0x18f7ec['body'],null))[_0x6964('0x24')](respondWithResult(_0x4de55f,null))[_0x6964('0x40')](handleError(_0x4de55f,null));};exports['destroy']=function(_0x44ec2c,_0x510253){return db['ServicenowConfiguration'][_0x6964('0x47')]({'where':{'id':_0x44ec2c[_0x6964('0x42')]['id']}})[_0x6964('0x24')](handleEntityNotFound(_0x510253,null))[_0x6964('0x24')](removeEntity(_0x510253,null))[_0x6964('0x40')](handleError(_0x510253,null));};exports['getFields']=function(_0x3c6087,_0xe95d59,_0x2ada86){var _0x5127b1={};var _0x46a3b5={};var _0x35267f;var _0x4e35bb;return db['ServicenowConfiguration'][_0x6964('0x4a')]({'where':{'id':_0x3c6087['params']['id']}})['then'](handleEntityNotFound(_0xe95d59,null))[_0x6964('0x24')](function(_0xcfe149){if(_0xcfe149){_0x35267f=_0xcfe149;_0x46a3b5['model']=_[_0x6964('0x43')](db[_0x6964('0x4b')][_0x6964('0x44')]);_0x46a3b5[_0x6964('0x30')]=_[_0x6964('0x43')](_0x3c6087[_0x6964('0x30')]);_0x46a3b5['filters']=_['intersection'](_0x46a3b5[_0x6964('0x2e')],_0x46a3b5[_0x6964('0x30')]);_0x5127b1[_0x6964('0x33')]=_[_0x6964('0x32')](_0x46a3b5[_0x6964('0x2e')],qs[_0x6964('0x34')](_0x3c6087[_0x6964('0x30')][_0x6964('0x34')]));_0x5127b1[_0x6964('0x33')]=_0x5127b1['attributes'][_0x6964('0x45')]?_0x5127b1[_0x6964('0x33')]:_0x46a3b5['model'];_0x5127b1[_0x6964('0x36')]=qs['sort'](_0x3c6087[_0x6964('0x30')]['sort']);_0x5127b1['where']=qs[_0x6964('0x31')](_[_0x6964('0x39')](_0x3c6087['query'],_0x46a3b5[_0x6964('0x31')]));if(_0x3c6087[_0x6964('0x30')][_0x6964('0x3a')]){_0x5127b1['where']=_[_0x6964('0x3b')](_0x5127b1[_0x6964('0x38')],{'$or':_[_0x6964('0x2f')](_0x5127b1[_0x6964('0x33')],function(_0x17d158){var _0x701ffc={};_0x701ffc[_0x17d158]={'$like':'%'+_0x3c6087[_0x6964('0x30')]['filter']+'%'};return _0x701ffc;})});}_0x5127b1=_[_0x6964('0x3b')]({},_0x5127b1,_0x3c6087['options']);return _0x35267f[_0x6964('0x4c')](_0x5127b1);}})['then'](function(_0x296bb1){if(_0x296bb1){_0x4e35bb=_0x296bb1['length'];if(!_0x3c6087[_0x6964('0x30')]['hasOwnProperty'](_0x6964('0x4d'))){_0x5127b1['limit']=qs['limit'](_0x3c6087[_0x6964('0x30')][_0x6964('0x1d')]);_0x5127b1[_0x6964('0x1b')]=qs[_0x6964('0x1b')](_0x3c6087['query'][_0x6964('0x1b')]);}return _0x35267f['getFields'](_0x5127b1);}})[_0x6964('0x24')](function(_0x38adfd){if(_0x38adfd){return _0x38adfd?{'count':_0x4e35bb,'rows':_0x38adfd}:null;}})['then'](respondWithResult(_0xe95d59,null))[_0x6964('0x40')](handleError(_0xe95d59,null));};exports[_0x6964('0x4e')]=function(_0x2341b6,_0x4ee1f2,_0x1fc855){var _0x5f07bc={};var _0x25a389={};var _0x480dca;var _0x2eb3d4;return db['ServicenowConfiguration'][_0x6964('0x4a')]({'where':{'id':_0x2341b6['params']['id']}})[_0x6964('0x24')](handleEntityNotFound(_0x4ee1f2,null))[_0x6964('0x24')](function(_0x5783ba){if(_0x5783ba){_0x480dca=_0x5783ba;_0x25a389[_0x6964('0x2e')]=_['keys'](db[_0x6964('0x4b')][_0x6964('0x44')]);_0x25a389[_0x6964('0x30')]=_[_0x6964('0x43')](_0x2341b6[_0x6964('0x30')]);_0x25a389[_0x6964('0x31')]=_['intersection'](_0x25a389[_0x6964('0x2e')],_0x25a389[_0x6964('0x30')]);_0x5f07bc[_0x6964('0x33')]=_[_0x6964('0x32')](_0x25a389[_0x6964('0x2e')],qs[_0x6964('0x34')](_0x2341b6[_0x6964('0x30')]['fields']));_0x5f07bc[_0x6964('0x33')]=_0x5f07bc[_0x6964('0x33')]['length']?_0x5f07bc[_0x6964('0x33')]:_0x25a389[_0x6964('0x2e')];_0x5f07bc[_0x6964('0x36')]=qs[_0x6964('0x37')](_0x2341b6['query']['sort']);_0x5f07bc['where']=qs[_0x6964('0x31')](_[_0x6964('0x39')](_0x2341b6[_0x6964('0x30')],_0x25a389[_0x6964('0x31')]));if(_0x2341b6[_0x6964('0x30')][_0x6964('0x3a')]){_0x5f07bc[_0x6964('0x38')]=_[_0x6964('0x3b')](_0x5f07bc[_0x6964('0x38')],{'$or':_[_0x6964('0x2f')](_0x5f07bc[_0x6964('0x33')],function(_0x434ce9){var _0x186d21={};_0x186d21[_0x434ce9]={'$like':'%'+_0x2341b6[_0x6964('0x30')]['filter']+'%'};return _0x186d21;})});}_0x5f07bc=_[_0x6964('0x3b')]({},_0x5f07bc,_0x2341b6[_0x6964('0x3c')]);return _0x480dca[_0x6964('0x4e')](_0x5f07bc);}})[_0x6964('0x24')](function(_0x255036){if(_0x255036){_0x2eb3d4=_0x255036['length'];if(!_0x2341b6[_0x6964('0x30')][_0x6964('0x35')]('nolimit')){_0x5f07bc[_0x6964('0x1d')]=qs[_0x6964('0x1d')](_0x2341b6['query'][_0x6964('0x1d')]);_0x5f07bc[_0x6964('0x1b')]=qs[_0x6964('0x1b')](_0x2341b6[_0x6964('0x30')]['offset']);}return _0x480dca[_0x6964('0x4e')](_0x5f07bc);}})['then'](function(_0x36e416){if(_0x36e416){return _0x36e416?{'count':_0x2eb3d4,'rows':_0x36e416}:null;}})[_0x6964('0x24')](respondWithResult(_0x4ee1f2,null))[_0x6964('0x40')](handleError(_0x4ee1f2,null));};exports[_0x6964('0x4f')]=function(_0x8af531,_0x165761,_0x5b782f){var _0x489604={};var _0x27e1fb={};var _0x15f288;var _0x413a51;return db[_0x6964('0x2a')]['findOne']({'where':{'id':_0x8af531[_0x6964('0x42')]['id']}})[_0x6964('0x24')](handleEntityNotFound(_0x165761,null))['then'](function(_0x498db9){if(_0x498db9){_0x15f288=_0x498db9;_0x27e1fb['model']=_[_0x6964('0x43')](db[_0x6964('0x4b')]['rawAttributes']);_0x27e1fb['query']=_[_0x6964('0x43')](_0x8af531[_0x6964('0x30')]);_0x27e1fb[_0x6964('0x31')]=_[_0x6964('0x32')](_0x27e1fb[_0x6964('0x2e')],_0x27e1fb['query']);_0x489604[_0x6964('0x33')]=_['intersection'](_0x27e1fb[_0x6964('0x2e')],qs['fields'](_0x8af531['query'][_0x6964('0x34')]));_0x489604[_0x6964('0x33')]=_0x489604[_0x6964('0x33')]['length']?_0x489604[_0x6964('0x33')]:_0x27e1fb['model'];_0x489604[_0x6964('0x36')]=qs[_0x6964('0x37')](_0x8af531['query'][_0x6964('0x37')]);_0x489604[_0x6964('0x38')]=qs[_0x6964('0x31')](_[_0x6964('0x39')](_0x8af531[_0x6964('0x30')],_0x27e1fb[_0x6964('0x31')]));if(_0x8af531['query'][_0x6964('0x3a')]){_0x489604['where']=_[_0x6964('0x3b')](_0x489604[_0x6964('0x38')],{'$or':_[_0x6964('0x2f')](_0x489604[_0x6964('0x33')],function(_0xd441f6){var _0x125e82={};_0x125e82[_0xd441f6]={'$like':'%'+_0x8af531[_0x6964('0x30')][_0x6964('0x3a')]+'%'};return _0x125e82;})});}_0x489604=_[_0x6964('0x3b')]({},_0x489604,_0x8af531[_0x6964('0x3c')]);return _0x15f288['getDescriptions'](_0x489604);}})[_0x6964('0x24')](function(_0x24e39f){if(_0x24e39f){_0x413a51=_0x24e39f[_0x6964('0x45')];if(!_0x8af531[_0x6964('0x30')][_0x6964('0x35')]('nolimit')){_0x489604['limit']=qs[_0x6964('0x1d')](_0x8af531['query']['limit']);_0x489604[_0x6964('0x1b')]=qs[_0x6964('0x1b')](_0x8af531[_0x6964('0x30')]['offset']);}return _0x15f288['getDescriptions'](_0x489604);}})[_0x6964('0x24')](function(_0x48f781){if(_0x48f781){return _0x48f781?{'count':_0x413a51,'rows':_0x48f781}:null;}})['then'](respondWithResult(_0x165761,null))[_0x6964('0x40')](handleError(_0x165761,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 95ea74f..9f2531a 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 _0x4f2f=['request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','../../config/logger','api','bluebird'];(function(_0x1ac6e5,_0x40f47f){var _0x5877dc=function(_0x99caea){while(--_0x99caea){_0x1ac6e5['push'](_0x1ac6e5['shift']());}};_0x5877dc(++_0x40f47f);}(_0x4f2f,0x1cb));var _0xf4f2=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0x4f2f[_0xa6cc5c];return _0x44803d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf4f2('0x0'))(_0xf4f2('0x1'));var moment=require('moment');var BPromise=require(_0xf4f2('0x2'));var rp=require(_0xf4f2('0x3'));var fs=require('fs');var path=require(_0xf4f2('0x4'));var rimraf=require(_0xf4f2('0x5'));var config=require(_0xf4f2('0x6'));var attributes=require(_0xf4f2('0x7'));module[_0xf4f2('0x8')]=function(_0x2d7c29,_0x1e0ceb){return _0x2d7c29[_0xf4f2('0x9')](_0xf4f2('0xa'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d37=['int_servicenow_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration'];(function(_0x51630e,_0x50ff64){var _0xce886=function(_0x41b3f2){while(--_0x41b3f2){_0x51630e['push'](_0x51630e['shift']());}};_0xce886(++_0x50ff64);}(_0x8d37,0x1d5));var _0x78d3=function(_0x3015ae,_0x4340c2){_0x3015ae=_0x3015ae-0x0;var _0x217f9e=_0x8d37[_0x3015ae];return _0x217f9e;};'use strict';var _=require(_0x78d3('0x0'));var util=require(_0x78d3('0x1'));var logger=require(_0x78d3('0x2'))(_0x78d3('0x3'));var moment=require(_0x78d3('0x4'));var BPromise=require('bluebird');var rp=require(_0x78d3('0x5'));var fs=require('fs');var path=require(_0x78d3('0x6'));var rimraf=require(_0x78d3('0x7'));var config=require(_0x78d3('0x8'));var attributes=require(_0x78d3('0x9'));module[_0x78d3('0xa')]=function(_0xe9d481,_0x24f7b9){return _0xe9d481['define'](_0x78d3('0xb'),attributes,{'tableName':_0x78d3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 0ff5311..9783ca5 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 _0x5c91=['code','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x5c91,0x1e9));var _0x15c9=function(_0x3e7c63,_0x50abe9){_0x3e7c63=_0x3e7c63-0x0;var _0x156116=_0x5c91[_0x3e7c63];return _0x156116;};'use strict';var _=require(_0x15c9('0x0'));var util=require(_0x15c9('0x1'));var moment=require(_0x15c9('0x2'));var BPromise=require('bluebird');var rs=require(_0x15c9('0x3'));var fs=require('fs');var Redis=require(_0x15c9('0x4'));var db=require(_0x15c9('0x5'))['db'];var utils=require(_0x15c9('0x6'));var logger=require(_0x15c9('0x7'))(_0x15c9('0x8'));var config=require('../../config/environment');var jayson=require(_0x15c9('0x9'));var client=jayson[_0x15c9('0xa')][_0x15c9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x42bcb6,_0x2c213e,_0x51a779){return new BPromise(function(_0x191695,_0x114775){return client[_0x15c9('0xc')](_0x42bcb6,_0x51a779)['then'](function(_0x23adaf){logger[_0x15c9('0xd')](_0x15c9('0xe'),_0x2c213e,'request\x20sent');logger['debug'](_0x15c9('0xf'),_0x2c213e,_0x15c9('0x10'),JSON['stringify'](_0x23adaf));if(_0x23adaf['error']){if(_0x23adaf['error'][_0x15c9('0x11')]===0x1f4){logger[_0x15c9('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2c213e,_0x23adaf[_0x15c9('0x12')][_0x15c9('0x13')]);return _0x114775(_0x23adaf[_0x15c9('0x12')]['message']);}logger['error'](_0x15c9('0xe'),_0x2c213e,_0x23adaf[_0x15c9('0x12')]['message']);return _0x191695(_0x23adaf[_0x15c9('0x12')]['message']);}else{logger[_0x15c9('0xd')](_0x15c9('0xe'),_0x2c213e,_0x15c9('0x10'));_0x191695(_0x23adaf[_0x15c9('0x14')][_0x15c9('0x13')]);}})[_0x15c9('0x15')](function(_0x5eb50e){logger[_0x15c9('0x12')](_0x15c9('0xe'),_0x2c213e,_0x5eb50e);_0x114775(_0x5eb50e);});});} \ No newline at end of file +var _0xdf98=['lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x466acd,_0x5921fa){var _0x3ddb83=function(_0x32a40f){while(--_0x32a40f){_0x466acd['push'](_0x466acd['shift']());}};_0x3ddb83(++_0x5921fa);}(_0xdf98,0xcf));var _0x8df9=function(_0x509b2a,_0xf91802){_0x509b2a=_0x509b2a-0x0;var _0x59ff9e=_0xdf98[_0x509b2a];return _0x59ff9e;};'use strict';var _=require(_0x8df9('0x0'));var util=require('util');var moment=require(_0x8df9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8df9('0x2'));var db=require(_0x8df9('0x3'))['db'];var utils=require(_0x8df9('0x4'));var logger=require(_0x8df9('0x5'))(_0x8df9('0x6'));var config=require(_0x8df9('0x7'));var jayson=require(_0x8df9('0x8'));var client=jayson[_0x8df9('0x9')][_0x8df9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e79af,_0x1ffe3b,_0x393533){return new BPromise(function(_0x410568,_0x48bc8e){return client['request'](_0x5e79af,_0x393533)[_0x8df9('0xb')](function(_0x513b37){logger[_0x8df9('0xc')](_0x8df9('0xd'),_0x1ffe3b,_0x8df9('0xe'));logger[_0x8df9('0xf')](_0x8df9('0x10'),_0x1ffe3b,_0x8df9('0xe'),JSON[_0x8df9('0x11')](_0x513b37));if(_0x513b37[_0x8df9('0x12')]){if(_0x513b37['error'][_0x8df9('0x13')]===0x1f4){logger[_0x8df9('0x12')](_0x8df9('0xd'),_0x1ffe3b,_0x513b37['error'][_0x8df9('0x14')]);return _0x48bc8e(_0x513b37[_0x8df9('0x12')][_0x8df9('0x14')]);}logger[_0x8df9('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x1ffe3b,_0x513b37['error'][_0x8df9('0x14')]);return _0x410568(_0x513b37[_0x8df9('0x12')][_0x8df9('0x14')]);}else{logger['info'](_0x8df9('0xd'),_0x1ffe3b,'request\x20sent');_0x410568(_0x513b37[_0x8df9('0x15')]['message']);}})[_0x8df9('0x16')](function(_0x8e547d){logger[_0x8df9('0x12')](_0x8df9('0xd'),_0x1ffe3b,_0x8e547d);_0x48bc8e(_0x8e547d);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index a857cd2..4fb98d5 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 _0xea1b=['fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller','isAuthenticated','index','get','/:id','create','put','update','delete','destroy','multer','util','connect-timeout','Router'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xea1b,0x11d));var _0xbea1=function(_0x1b222a,_0x322af6){_0x1b222a=_0x1b222a-0x0;var _0x1ca16b=_0xea1b[_0x1b222a];return _0x1ca16b;};'use strict';var multer=require(_0xbea1('0x0'));var util=require(_0xbea1('0x1'));var path=require('path');var timeout=require(_0xbea1('0x2'));var express=require('express');var router=express[_0xbea1('0x3')]();var fs_extra=require(_0xbea1('0x4'));var auth=require(_0xbea1('0x5'));var interaction=require(_0xbea1('0x6'));var config=require('../../config/environment');var controller=require(_0xbea1('0x7'));router['get']('/',auth[_0xbea1('0x8')](),controller[_0xbea1('0x9')]);router[_0xbea1('0xa')](_0xbea1('0xb'),auth[_0xbea1('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xbea1('0xc')]);router[_0xbea1('0xd')]('/:id',auth[_0xbea1('0x8')](),controller[_0xbea1('0xe')]);router[_0xbea1('0xf')](_0xbea1('0xb'),auth[_0xbea1('0x8')](),controller[_0xbea1('0x10')]);module['exports']=router; \ No newline at end of file +var _0x659b=['../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post','create','put','update','exports','multer','path','Router','fs-extra','../../components/auth/service'];(function(_0x41f47f,_0x2f0746){var _0x3f801d=function(_0x4d6ea0){while(--_0x4d6ea0){_0x41f47f['push'](_0x41f47f['shift']());}};_0x3f801d(++_0x2f0746);}(_0x659b,0x10b));var _0xb659=function(_0x2c6cff,_0x49fba7){_0x2c6cff=_0x2c6cff-0x0;var _0x1acfc5=_0x659b[_0x2c6cff];return _0x1acfc5;};'use strict';var multer=require(_0xb659('0x0'));var util=require('util');var path=require(_0xb659('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb659('0x2')]();var fs_extra=require(_0xb659('0x3'));var auth=require(_0xb659('0x4'));var interaction=require(_0xb659('0x5'));var config=require(_0xb659('0x6'));var controller=require('./intServicenowField.controller');router[_0xb659('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xb659('0x8'),auth[_0xb659('0x9')](),controller[_0xb659('0xa')]);router[_0xb659('0xb')]('/',auth[_0xb659('0x9')](),controller[_0xb659('0xc')]);router[_0xb659('0xd')](_0xb659('0x8'),auth['isAuthenticated'](),controller[_0xb659('0xe')]);router['delete'](_0xb659('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0xb659('0xf')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 6c739d4..9bd4d82 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 _0xaa71=['customVariable','keyValue','picklist','STRING','BOOLEAN','ENUM','string','variable'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xaa71,0xc5));var _0x1aa7=function(_0x5271bf,_0x2b3a4a){_0x5271bf=_0x5271bf-0x0;var _0x376191=_0xaa71[_0x5271bf];return _0x376191;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x1aa7('0x0')](_0x1aa7('0x1'),_0x1aa7('0x2'),_0x1aa7('0x3'),_0x1aa7('0x4'),_0x1aa7('0x5')),'defaultValue':_0x1aa7('0x1')},'content':{'type':Sequelize[_0x1aa7('0x6')]},'key':{'type':Sequelize[_0x1aa7('0x6')]},'keyType':{'type':Sequelize[_0x1aa7('0x0')](_0x1aa7('0x1'),_0x1aa7('0x2'),_0x1aa7('0x3'))},'keyContent':{'type':Sequelize[_0x1aa7('0x6')]},'idField':{'type':Sequelize[_0x1aa7('0x6')]},'nameField':{'type':Sequelize[_0x1aa7('0x6')]},'customField':{'type':Sequelize[_0x1aa7('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1aa7('0x6')]}}; \ No newline at end of file +var _0x5bee=['keyValue','picklist','STRING','BOOLEAN','exports','string','variable','customVariable'];(function(_0x362d3d,_0x214629){var _0x5514fa=function(_0x1e88f0){while(--_0x1e88f0){_0x362d3d['push'](_0x362d3d['shift']());}};_0x5514fa(++_0x214629);}(_0x5bee,0x11c));var _0xe5be=function(_0x5f259a,_0x17d242){_0x5f259a=_0x5f259a-0x0;var _0x272c43=_0x5bee[_0x5f259a];return _0x272c43;};'use strict';var Sequelize=require('sequelize');module[_0xe5be('0x0')]={'type':{'type':Sequelize['ENUM'](_0xe5be('0x1'),_0xe5be('0x2'),_0xe5be('0x3'),_0xe5be('0x4'),_0xe5be('0x5')),'defaultValue':_0xe5be('0x1')},'content':{'type':Sequelize[_0xe5be('0x6')]},'key':{'type':Sequelize[_0xe5be('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xe5be('0x1'),_0xe5be('0x2'),_0xe5be('0x3'))},'keyContent':{'type':Sequelize[_0xe5be('0x6')]},'idField':{'type':Sequelize[_0xe5be('0x6')]},'nameField':{'type':Sequelize[_0xe5be('0x6')]},'customField':{'type':Sequelize[_0xe5be('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe5be('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 644329b..076f5e1 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 _0x864f=['status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','end','error','stack','name','map','ServicenowField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus'];(function(_0x57a0e2,_0x34d072){var _0xd9e589=function(_0xdd9aa5){while(--_0xdd9aa5){_0x57a0e2['push'](_0x57a0e2['shift']());}};_0xd9e589(++_0x34d072);}(_0x864f,0x1ab));var _0xf864=function(_0x2f522f,_0x57e8c){_0x2f522f=_0x2f522f-0x0;var _0x4f1daa=_0x864f[_0x2f522f];return _0x4f1daa;};'use strict';var emlformat=require(_0xf864('0x0'));var rimraf=require(_0xf864('0x1'));var zipdir=require(_0xf864('0x2'));var jsonpatch=require(_0xf864('0x3'));var rp=require(_0xf864('0x4'));var moment=require(_0xf864('0x5'));var BPromise=require(_0xf864('0x6'));var Mustache=require(_0xf864('0x7'));var util=require(_0xf864('0x8'));var path=require(_0xf864('0x9'));var sox=require(_0xf864('0xa'));var csv=require('to-csv');var ejs=require(_0xf864('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf864('0xc'));var squel=require(_0xf864('0xd'));var crypto=require(_0xf864('0xe'));var jsforce=require(_0xf864('0xf'));var deskjs=require(_0xf864('0x10'));var toCsv=require(_0xf864('0x11'));var querystring=require(_0xf864('0x12'));var Papa=require(_0xf864('0x13'));var Redis=require(_0xf864('0x14'));var authService=require(_0xf864('0x15'));var qs=require(_0xf864('0x16'));var as=require(_0xf864('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf864('0x18'))(_0xf864('0x19'));var utils=require('../../config/utils');var config=require(_0xf864('0x1a'));var licenseUtil=require(_0xf864('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38aedb,_0x357a7f){_0x357a7f=_0x357a7f||0xcc;return function(_0x715d6d){if(_0x715d6d){return _0x38aedb[_0xf864('0x1c')](_0x357a7f);}return _0x38aedb[_0xf864('0x1d')](_0x357a7f)['end']();};}function respondWithResult(_0x2205a4,_0x4b9f0e){_0x4b9f0e=_0x4b9f0e||0xc8;return function(_0x58bd20){if(_0x58bd20){return _0x2205a4[_0xf864('0x1d')](_0x4b9f0e)['json'](_0x58bd20);}};}function respondWithFilteredResult(_0x21e9b7,_0x534c2c){return function(_0x5d17d5){if(_0x5d17d5){var _0x435c19=typeof _0x534c2c[_0xf864('0x1e')]===_0xf864('0x1f')&&typeof _0x534c2c[_0xf864('0x20')]===_0xf864('0x1f');var _0x3a7534=_0x5d17d5[_0xf864('0x21')];var _0x1b82cf=_0x435c19?0x0:_0x534c2c[_0xf864('0x1e')];var _0x80e031=_0x435c19?_0x5d17d5[_0xf864('0x21')]:_0x534c2c['offset']+_0x534c2c[_0xf864('0x20')];var _0x33b7d8;if(_0x80e031>=_0x3a7534){_0x80e031=_0x3a7534;_0x33b7d8=0xc8;}else{_0x33b7d8=0xce;}_0x21e9b7[_0xf864('0x1d')](_0x33b7d8);return _0x21e9b7[_0xf864('0x22')]('Content-Range',_0x1b82cf+'-'+_0x80e031+'/'+_0x3a7534)[_0xf864('0x23')](_0x5d17d5);}return null;};}function patchUpdates(_0x11cbf2){return function(_0x140247){try{jsonpatch[_0xf864('0x24')](_0x140247,_0x11cbf2,!![]);}catch(_0x5ea840){return BPromise[_0xf864('0x25')](_0x5ea840);}return _0x140247[_0xf864('0x26')]();};}function saveUpdates(_0x18d447,_0x1831b9){return function(_0x3fc635){if(_0x3fc635){return _0x3fc635[_0xf864('0x27')](_0x18d447)[_0xf864('0x28')](function(_0x49e7a3){return _0x49e7a3;});}return null;};}function removeEntity(_0x45ef71,_0x3cd313){return function(_0x2e890b){if(_0x2e890b){return _0x2e890b['destroy']()['then'](function(){_0x45ef71[_0xf864('0x1d')](0xcc)[_0xf864('0x29')]();});}};}function handleEntityNotFound(_0x24c407,_0x1ec043){return function(_0x5a748c){if(!_0x5a748c){_0x24c407[_0xf864('0x1c')](0x194);}return _0x5a748c;};}function handleError(_0x30916f,_0x129324){_0x129324=_0x129324||0x1f4;return function(_0x40c9f4){logger[_0xf864('0x2a')](_0x40c9f4[_0xf864('0x2b')]);if(_0x40c9f4['name']){delete _0x40c9f4[_0xf864('0x2c')];}_0x30916f[_0xf864('0x1d')](_0x129324)['send'](_0x40c9f4);};}exports['index']=function(_0x157714,_0x1236f1){var _0x132c73={},_0x74574e={},_0x2847aa={'count':0x0,'rows':[]};var _0x176cdb=_[_0xf864('0x2d')](db[_0xf864('0x2e')][_0xf864('0x2f')],function(_0x15dd4f){return{'name':_0x15dd4f[_0xf864('0x30')],'type':_0x15dd4f[_0xf864('0x31')]['key']};});_0x74574e[_0xf864('0x32')]=_[_0xf864('0x2d')](_0x176cdb,_0xf864('0x2c'));_0x74574e[_0xf864('0x33')]=_[_0xf864('0x34')](_0x157714['query']);_0x74574e[_0xf864('0x35')]=_[_0xf864('0x36')](_0x74574e[_0xf864('0x32')],_0x74574e[_0xf864('0x33')]);_0x132c73['attributes']=_[_0xf864('0x36')](_0x74574e[_0xf864('0x32')],qs['fields'](_0x157714[_0xf864('0x33')][_0xf864('0x37')]));_0x132c73[_0xf864('0x38')]=_0x132c73['attributes'][_0xf864('0x39')]?_0x132c73[_0xf864('0x38')]:_0x74574e[_0xf864('0x32')];if(!_0x157714[_0xf864('0x33')][_0xf864('0x3a')](_0xf864('0x3b'))){_0x132c73[_0xf864('0x20')]=qs['limit'](_0x157714['query'][_0xf864('0x20')]);_0x132c73[_0xf864('0x1e')]=qs[_0xf864('0x1e')](_0x157714['query']['offset']);}_0x132c73['order']=qs[_0xf864('0x3c')](_0x157714['query'][_0xf864('0x3c')]);_0x132c73[_0xf864('0x3d')]=qs[_0xf864('0x35')](_[_0xf864('0x3e')](_0x157714[_0xf864('0x33')],_0x74574e[_0xf864('0x35')]),_0x176cdb);if(_0x157714[_0xf864('0x33')][_0xf864('0x3f')]){_0x132c73[_0xf864('0x3d')]=_[_0xf864('0x40')](_0x132c73[_0xf864('0x3d')],{'$or':_[_0xf864('0x2d')](_0x176cdb,function(_0x22a434){if(_0x22a434[_0xf864('0x31')]!==_0xf864('0x41')){var _0x4aaa0e={};_0x4aaa0e[_0x22a434[_0xf864('0x2c')]]={'$like':'%'+_0x157714[_0xf864('0x33')][_0xf864('0x3f')]+'%'};return _0x4aaa0e;}})});}_0x132c73=_[_0xf864('0x40')]({},_0x132c73,_0x157714['options']);var _0x4a54a2={'where':_0x132c73[_0xf864('0x3d')]};return db[_0xf864('0x2e')][_0xf864('0x21')](_0x4a54a2)[_0xf864('0x28')](function(_0x280adc){_0x2847aa[_0xf864('0x21')]=_0x280adc;if(_0x157714[_0xf864('0x33')][_0xf864('0x42')]){_0x132c73[_0xf864('0x43')]=[{'all':!![]}];}return db[_0xf864('0x2e')][_0xf864('0x44')](_0x132c73);})['then'](function(_0xcac0a4){_0x2847aa[_0xf864('0x45')]=_0xcac0a4;return _0x2847aa;})[_0xf864('0x28')](respondWithFilteredResult(_0x1236f1,_0x132c73))['catch'](handleError(_0x1236f1,null));};exports[_0xf864('0x46')]=function(_0x10079c,_0x9a0373){var _0x39f0cd={'raw':!![],'where':{'id':_0x10079c[_0xf864('0x47')]['id']}},_0x22e863={};_0x22e863[_0xf864('0x32')]=_[_0xf864('0x34')](db[_0xf864('0x2e')][_0xf864('0x2f')]);_0x22e863[_0xf864('0x33')]=_[_0xf864('0x34')](_0x10079c[_0xf864('0x33')]);_0x22e863['filters']=_[_0xf864('0x36')](_0x22e863[_0xf864('0x32')],_0x22e863[_0xf864('0x33')]);_0x39f0cd['attributes']=_[_0xf864('0x36')](_0x22e863[_0xf864('0x32')],qs[_0xf864('0x37')](_0x10079c['query'][_0xf864('0x37')]));_0x39f0cd['attributes']=_0x39f0cd[_0xf864('0x38')][_0xf864('0x39')]?_0x39f0cd[_0xf864('0x38')]:_0x22e863[_0xf864('0x32')];if(_0x10079c[_0xf864('0x33')][_0xf864('0x42')]){_0x39f0cd[_0xf864('0x43')]=[{'all':!![]}];}_0x39f0cd=_[_0xf864('0x40')]({},_0x39f0cd,_0x10079c[_0xf864('0x48')]);return db['ServicenowField'][_0xf864('0x49')](_0x39f0cd)['then'](handleEntityNotFound(_0x9a0373,null))[_0xf864('0x28')](respondWithResult(_0x9a0373,null))[_0xf864('0x4a')](handleError(_0x9a0373,null));};exports['create']=function(_0x39fcbf,_0x4c0faf){return db[_0xf864('0x2e')]['create'](_0x39fcbf[_0xf864('0x4b')],{})['then'](respondWithResult(_0x4c0faf,0xc9))[_0xf864('0x4a')](handleError(_0x4c0faf,null));};exports['update']=function(_0x5ca194,_0x3f0b53){if(_0x5ca194[_0xf864('0x4b')]['id']){delete _0x5ca194[_0xf864('0x4b')]['id'];}return db[_0xf864('0x2e')][_0xf864('0x49')]({'where':{'id':_0x5ca194[_0xf864('0x47')]['id']}})[_0xf864('0x28')](handleEntityNotFound(_0x3f0b53,null))[_0xf864('0x28')](saveUpdates(_0x5ca194['body'],null))[_0xf864('0x28')](respondWithResult(_0x3f0b53,null))[_0xf864('0x4a')](handleError(_0x3f0b53,null));};exports['destroy']=function(_0x56ecf5,_0x10108b){return db[_0xf864('0x2e')][_0xf864('0x49')]({'where':{'id':_0x56ecf5['params']['id']}})['then'](handleEntityNotFound(_0x10108b,null))['then'](removeEntity(_0x10108b,null))['catch'](handleError(_0x10108b,null));}; \ No newline at end of file +var _0x6a98=['eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','destroy','error','name','status','send','index','map','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','ServicenowField','then','includeAll','include','findAll','rows','catch','show','params','options','create','body','find'];(function(_0x33dfa7,_0x428ce6){var _0xc51144=function(_0x2f258a){while(--_0x2f258a){_0x33dfa7['push'](_0x33dfa7['shift']());}};_0xc51144(++_0x428ce6);}(_0x6a98,0x98));var _0x86a9=function(_0x3042c5,_0x36cb88){_0x3042c5=_0x3042c5-0x0;var _0x7cd140=_0x6a98[_0x3042c5];return _0x7cd140;};'use strict';var emlformat=require(_0x86a9('0x0'));var rimraf=require(_0x86a9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x86a9('0x2'));var moment=require(_0x86a9('0x3'));var BPromise=require(_0x86a9('0x4'));var Mustache=require(_0x86a9('0x5'));var util=require(_0x86a9('0x6'));var path=require(_0x86a9('0x7'));var sox=require('sox');var csv=require(_0x86a9('0x8'));var ejs=require(_0x86a9('0x9'));var fs=require('fs');var fs_extra=require(_0x86a9('0xa'));var _=require(_0x86a9('0xb'));var squel=require(_0x86a9('0xc'));var crypto=require(_0x86a9('0xd'));var jsforce=require(_0x86a9('0xe'));var deskjs=require(_0x86a9('0xf'));var toCsv=require('to-csv');var querystring=require(_0x86a9('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x86a9('0x11'));var as=require(_0x86a9('0x12'));var hardwareService=require(_0x86a9('0x13'));var logger=require(_0x86a9('0x14'))(_0x86a9('0x15'));var utils=require(_0x86a9('0x16'));var config=require(_0x86a9('0x17'));var licenseUtil=require(_0x86a9('0x18'));var db=require(_0x86a9('0x19'))['db'];function respondWithStatusCode(_0x4196f9,_0x18e5a1){_0x18e5a1=_0x18e5a1||0xcc;return function(_0x5e0b6e){if(_0x5e0b6e){return _0x4196f9[_0x86a9('0x1a')](_0x18e5a1);}return _0x4196f9['status'](_0x18e5a1)['end']();};}function respondWithResult(_0xa091aa,_0x1a2ad9){_0x1a2ad9=_0x1a2ad9||0xc8;return function(_0x1993b9){if(_0x1993b9){return _0xa091aa['status'](_0x1a2ad9)[_0x86a9('0x1b')](_0x1993b9);}};}function respondWithFilteredResult(_0x2035b5,_0x27dc5e){return function(_0x1ec0fc){if(_0x1ec0fc){var _0x27c015=typeof _0x27dc5e['offset']===_0x86a9('0x1c')&&typeof _0x27dc5e[_0x86a9('0x1d')]===_0x86a9('0x1c');var _0x260d09=_0x1ec0fc[_0x86a9('0x1e')];var _0x441202=_0x27c015?0x0:_0x27dc5e['offset'];var _0x172ee0=_0x27c015?_0x1ec0fc[_0x86a9('0x1e')]:_0x27dc5e[_0x86a9('0x1f')]+_0x27dc5e[_0x86a9('0x1d')];var _0x131c55;if(_0x172ee0>=_0x260d09){_0x172ee0=_0x260d09;_0x131c55=0xc8;}else{_0x131c55=0xce;}_0x2035b5['status'](_0x131c55);return _0x2035b5['set'](_0x86a9('0x20'),_0x441202+'-'+_0x172ee0+'/'+_0x260d09)['json'](_0x1ec0fc);}return null;};}function patchUpdates(_0x350fb7){return function(_0xa78cf5){try{jsonpatch[_0x86a9('0x21')](_0xa78cf5,_0x350fb7,!![]);}catch(_0x1e169f){return BPromise[_0x86a9('0x22')](_0x1e169f);}return _0xa78cf5[_0x86a9('0x23')]();};}function saveUpdates(_0x4ffd28,_0x5d43f1){return function(_0x10ea2d){if(_0x10ea2d){return _0x10ea2d[_0x86a9('0x24')](_0x4ffd28)['then'](function(_0x3446a4){return _0x3446a4;});}return null;};}function removeEntity(_0x4f4d9a,_0x257b76){return function(_0x3fbbfd){if(_0x3fbbfd){return _0x3fbbfd[_0x86a9('0x25')]()['then'](function(){_0x4f4d9a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ade66,_0x40167b){return function(_0xefc4bf){if(!_0xefc4bf){_0x3ade66[_0x86a9('0x1a')](0x194);}return _0xefc4bf;};}function handleError(_0x5ec81f,_0x458e54){_0x458e54=_0x458e54||0x1f4;return function(_0x413177){logger[_0x86a9('0x26')](_0x413177['stack']);if(_0x413177[_0x86a9('0x27')]){delete _0x413177[_0x86a9('0x27')];}_0x5ec81f[_0x86a9('0x28')](_0x458e54)[_0x86a9('0x29')](_0x413177);};}exports[_0x86a9('0x2a')]=function(_0x56c1be,_0x5dd4cc){var _0x315e29={},_0x6b648d={},_0x57af3a={'count':0x0,'rows':[]};var _0x1dcf2a=_[_0x86a9('0x2b')](db['ServicenowField']['rawAttributes'],function(_0x27b8b9){return{'name':_0x27b8b9[_0x86a9('0x2c')],'type':_0x27b8b9['type']['key']};});_0x6b648d[_0x86a9('0x2d')]=_[_0x86a9('0x2b')](_0x1dcf2a,_0x86a9('0x27'));_0x6b648d[_0x86a9('0x2e')]=_[_0x86a9('0x2f')](_0x56c1be[_0x86a9('0x2e')]);_0x6b648d[_0x86a9('0x30')]=_['intersection'](_0x6b648d[_0x86a9('0x2d')],_0x6b648d['query']);_0x315e29['attributes']=_[_0x86a9('0x31')](_0x6b648d[_0x86a9('0x2d')],qs[_0x86a9('0x32')](_0x56c1be['query'][_0x86a9('0x32')]));_0x315e29['attributes']=_0x315e29[_0x86a9('0x33')][_0x86a9('0x34')]?_0x315e29[_0x86a9('0x33')]:_0x6b648d['model'];if(!_0x56c1be['query'][_0x86a9('0x35')](_0x86a9('0x36'))){_0x315e29[_0x86a9('0x1d')]=qs['limit'](_0x56c1be[_0x86a9('0x2e')][_0x86a9('0x1d')]);_0x315e29['offset']=qs[_0x86a9('0x1f')](_0x56c1be[_0x86a9('0x2e')][_0x86a9('0x1f')]);}_0x315e29[_0x86a9('0x37')]=qs[_0x86a9('0x38')](_0x56c1be[_0x86a9('0x2e')]['sort']);_0x315e29[_0x86a9('0x39')]=qs[_0x86a9('0x30')](_[_0x86a9('0x3a')](_0x56c1be['query'],_0x6b648d[_0x86a9('0x30')]),_0x1dcf2a);if(_0x56c1be[_0x86a9('0x2e')][_0x86a9('0x3b')]){_0x315e29['where']=_['merge'](_0x315e29[_0x86a9('0x39')],{'$or':_[_0x86a9('0x2b')](_0x1dcf2a,function(_0x4f7f74){if(_0x4f7f74[_0x86a9('0x3c')]!==_0x86a9('0x3d')){var _0x1a1584={};_0x1a1584[_0x4f7f74['name']]={'$like':'%'+_0x56c1be['query'][_0x86a9('0x3b')]+'%'};return _0x1a1584;}})});}_0x315e29=_[_0x86a9('0x3e')]({},_0x315e29,_0x56c1be['options']);var _0x1df0b1={'where':_0x315e29[_0x86a9('0x39')]};return db[_0x86a9('0x3f')]['count'](_0x1df0b1)[_0x86a9('0x40')](function(_0x17215a){_0x57af3a['count']=_0x17215a;if(_0x56c1be[_0x86a9('0x2e')][_0x86a9('0x41')]){_0x315e29[_0x86a9('0x42')]=[{'all':!![]}];}return db[_0x86a9('0x3f')][_0x86a9('0x43')](_0x315e29);})[_0x86a9('0x40')](function(_0x173137){_0x57af3a[_0x86a9('0x44')]=_0x173137;return _0x57af3a;})['then'](respondWithFilteredResult(_0x5dd4cc,_0x315e29))[_0x86a9('0x45')](handleError(_0x5dd4cc,null));};exports[_0x86a9('0x46')]=function(_0x10e3f6,_0xb0762d){var _0x1657e2={'raw':!![],'where':{'id':_0x10e3f6[_0x86a9('0x47')]['id']}},_0x512368={};_0x512368[_0x86a9('0x2d')]=_[_0x86a9('0x2f')](db[_0x86a9('0x3f')]['rawAttributes']);_0x512368[_0x86a9('0x2e')]=_[_0x86a9('0x2f')](_0x10e3f6['query']);_0x512368['filters']=_[_0x86a9('0x31')](_0x512368[_0x86a9('0x2d')],_0x512368[_0x86a9('0x2e')]);_0x1657e2['attributes']=_['intersection'](_0x512368[_0x86a9('0x2d')],qs[_0x86a9('0x32')](_0x10e3f6[_0x86a9('0x2e')][_0x86a9('0x32')]));_0x1657e2['attributes']=_0x1657e2['attributes'][_0x86a9('0x34')]?_0x1657e2[_0x86a9('0x33')]:_0x512368[_0x86a9('0x2d')];if(_0x10e3f6[_0x86a9('0x2e')][_0x86a9('0x41')]){_0x1657e2[_0x86a9('0x42')]=[{'all':!![]}];}_0x1657e2=_['merge']({},_0x1657e2,_0x10e3f6[_0x86a9('0x48')]);return db[_0x86a9('0x3f')]['find'](_0x1657e2)[_0x86a9('0x40')](handleEntityNotFound(_0xb0762d,null))[_0x86a9('0x40')](respondWithResult(_0xb0762d,null))[_0x86a9('0x45')](handleError(_0xb0762d,null));};exports['create']=function(_0x13f64e,_0x1e2891){return db[_0x86a9('0x3f')][_0x86a9('0x49')](_0x13f64e[_0x86a9('0x4a')],{})['then'](respondWithResult(_0x1e2891,0xc9))[_0x86a9('0x45')](handleError(_0x1e2891,null));};exports[_0x86a9('0x24')]=function(_0x3684eb,_0x548f7e){if(_0x3684eb[_0x86a9('0x4a')]['id']){delete _0x3684eb[_0x86a9('0x4a')]['id'];}return db['ServicenowField'][_0x86a9('0x4b')]({'where':{'id':_0x3684eb[_0x86a9('0x47')]['id']}})[_0x86a9('0x40')](handleEntityNotFound(_0x548f7e,null))['then'](saveUpdates(_0x3684eb[_0x86a9('0x4a')],null))[_0x86a9('0x40')](respondWithResult(_0x548f7e,null))[_0x86a9('0x45')](handleError(_0x548f7e,null));};exports[_0x86a9('0x25')]=function(_0x492d52,_0x568af2){return db['ServicenowField'][_0x86a9('0x4b')]({'where':{'id':_0x492d52['params']['id']}})[_0x86a9('0x40')](handleEntityNotFound(_0x568af2,null))[_0x86a9('0x40')](removeEntity(_0x568af2,null))['catch'](handleError(_0x568af2,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 92752c4..98ebb30 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 _0x8d0c=['int_servicenow_fields','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x8d0c,0x169));var _0xc8d0=function(_0xfec94,_0xff75ca){_0xfec94=_0xfec94-0x0;var _0x4858cc=_0x8d0c[_0xfec94];return _0x4858cc;};'use strict';var _=require(_0xc8d0('0x0'));var util=require(_0xc8d0('0x1'));var logger=require(_0xc8d0('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc8d0('0x3'));var fs=require('fs');var path=require(_0xc8d0('0x4'));var rimraf=require(_0xc8d0('0x5'));var config=require(_0xc8d0('0x6'));var attributes=require(_0xc8d0('0x7'));module[_0xc8d0('0x8')]=function(_0x5a5d5c,_0x2d9168){return _0x5a5d5c[_0xc8d0('0x9')](_0xc8d0('0xa'),attributes,{'tableName':_0xc8d0('0xb'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1e6a=['rimraf','../../config/environment','./intServicenowField.attributes','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1e6a,0xe9));var _0xa1e6=function(_0x1f1827,_0x400a73){_0x1f1827=_0x1f1827-0x0;var _0x292e2b=_0x1e6a[_0x1f1827];return _0x292e2b;};'use strict';var _=require(_0xa1e6('0x0'));var util=require(_0xa1e6('0x1'));var logger=require(_0xa1e6('0x2'))(_0xa1e6('0x3'));var moment=require(_0xa1e6('0x4'));var BPromise=require(_0xa1e6('0x5'));var rp=require(_0xa1e6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa1e6('0x7'));var config=require(_0xa1e6('0x8'));var attributes=require(_0xa1e6('0x9'));module['exports']=function(_0x40a3ca,_0x22ddcd){return _0x40a3ca[_0xa1e6('0xa')](_0xa1e6('0xb'),attributes,{'tableName':_0xa1e6('0xc'),'paranoid':![],'indexes':[{'name':_0xa1e6('0xd'),'fields':[_0xa1e6('0xe'),'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 ced4433..0610883 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 _0x9bde=['code','message','ServicenowField,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x51b229,_0x3254a9){var _0x2726c2=function(_0x982c50){while(--_0x982c50){_0x51b229['push'](_0x51b229['shift']());}};_0x2726c2(++_0x3254a9);}(_0x9bde,0xe1));var _0xe9bd=function(_0x24a493,_0x4ce9ec){_0x24a493=_0x24a493-0x0;var _0x3c676d=_0x9bde[_0x24a493];return _0x3c676d;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f18fe,_0x22a438,_0xa66ae2){return new BPromise(function(_0x2d5c75,_0x3ef9e3){return client[_0xe9bd('0xa')](_0x5f18fe,_0xa66ae2)[_0xe9bd('0xb')](function(_0x439abc){logger[_0xe9bd('0xc')]('ServicenowField,\x20%s,\x20%s',_0x22a438,'request\x20sent');logger[_0xe9bd('0xd')](_0xe9bd('0xe'),_0x22a438,_0xe9bd('0xf'),JSON['stringify'](_0x439abc));if(_0x439abc[_0xe9bd('0x10')]){if(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x11')]===0x1f4){logger[_0xe9bd('0x10')]('ServicenowField,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('ServicenowField,\x20%s,\x20%s',_0x22a438,_0x439abc['error'][_0xe9bd('0x12')]);return _0x2d5c75(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}else{logger[_0xe9bd('0xc')](_0xe9bd('0x13'),_0x22a438,_0xe9bd('0xf'));_0x2d5c75(_0x439abc[_0xe9bd('0x14')]['message']);}})[_0xe9bd('0x15')](function(_0x464a1b){logger[_0xe9bd('0x10')]('ServicenowField,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});} \ No newline at end of file +var _0xb7e7=['ServicenowField,\x20%s,\x20%s','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x504513,_0xcf4f09){var _0x2f5703=function(_0x575b34){while(--_0x575b34){_0x504513['push'](_0x504513['shift']());}};_0x2f5703(++_0xcf4f09);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0xb7e7[_0x1abb09];return _0xea1c07;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('ServicenowField,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 9537457..3fdc0a3 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 _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(_0xa52dbd,_0x386625){var _0x3fa0a2=function(_0x392864){while(--_0x392864){_0xa52dbd['push'](_0xa52dbd['shift']());}};_0x3fa0a2(++_0x386625);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x2978fc,_0x4d6f05){var _0x985231=function(_0x3160f7){while(--_0x3160f7){_0x2978fc['push'](_0x2978fc['shift']());}};_0x985231(++_0x4d6f05);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 82a3774..885a48c 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(_0x32cd07,_0x431e6a){var _0x546bf7=function(_0x28c3bd){while(--_0x28c3bd){_0x32cd07['push'](_0x32cd07['shift']());}};_0x546bf7(++_0x431e6a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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(_0x4a1f69,_0x40c388){var _0x449108=function(_0xf66fa3){while(--_0xf66fa3){_0x4a1f69['push'](_0x4a1f69['shift']());}};_0x449108(++_0x40c388);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index c3e275a..b819a53 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 _0xe06c=['undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','SugarcrmAccount','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','map','VIRTUAL','options','where','includeAll','include','findAll','rows','catch','params','fields','create','body','find','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','channel','getDescriptions','SugarcrmField','Subjects','Descriptions','getFields','assigned_user_id','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','username','password','remoteUri','slice','substring','lastIndexOf','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','POST','get_module_fields','Calls','values','module_fields','remove','includes','label','endsWith','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','squel','crypto','to-csv','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset'];(function(_0x15d5af,_0x47e20f){var _0x94d2de=function(_0x42c802){while(--_0x42c802){_0x15d5af['push'](_0x15d5af['shift']());}};_0x94d2de(++_0x47e20f);}(_0xe06c,0xd2));var _0xce06=function(_0x22634f,_0x47120f){_0x22634f=_0x22634f-0x0;var _0x27a216=_0xe06c[_0x22634f];return _0x27a216;};'use strict';var emlformat=require(_0xce06('0x0'));var rimraf=require(_0xce06('0x1'));var zipdir=require(_0xce06('0x2'));var jsonpatch=require(_0xce06('0x3'));var rp=require('request-promise');var moment=require(_0xce06('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xce06('0x5'));var util=require(_0xce06('0x6'));var path=require(_0xce06('0x7'));var sox=require(_0xce06('0x8'));var csv=require('to-csv');var ejs=require(_0xce06('0x9'));var fs=require('fs');var fs_extra=require(_0xce06('0xa'));var _=require('lodash');var squel=require(_0xce06('0xb'));var crypto=require(_0xce06('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xce06('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xce06('0xe'));var qs=require(_0xce06('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xce06('0x10'))(_0xce06('0x11'));var utils=require(_0xce06('0x12'));var config=require(_0xce06('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2dc798,_0x4ccdbf){_0x4ccdbf=_0x4ccdbf||0xcc;return function(_0x227634){if(_0x227634){return _0x2dc798['sendStatus'](_0x4ccdbf);}return _0x2dc798[_0xce06('0x14')](_0x4ccdbf)[_0xce06('0x15')]();};}function respondWithResult(_0x57fd5a,_0x25299c){_0x25299c=_0x25299c||0xc8;return function(_0x5d5380){if(_0x5d5380){return _0x57fd5a[_0xce06('0x14')](_0x25299c)[_0xce06('0x16')](_0x5d5380);}};}function respondWithFilteredResult(_0x4bea5e,_0x5aaeb7){return function(_0x2bbf3b){if(_0x2bbf3b){var _0x7d8cde=typeof _0x5aaeb7[_0xce06('0x17')]===_0xce06('0x18')&&typeof _0x5aaeb7[_0xce06('0x19')]==='undefined';var _0x46558c=_0x2bbf3b[_0xce06('0x1a')];var _0x4e1d3d=_0x7d8cde?0x0:_0x5aaeb7['offset'];var _0x40d629=_0x7d8cde?_0x2bbf3b['count']:_0x5aaeb7[_0xce06('0x17')]+_0x5aaeb7[_0xce06('0x19')];var _0x1db89e;if(_0x40d629>=_0x46558c){_0x40d629=_0x46558c;_0x1db89e=0xc8;}else{_0x1db89e=0xce;}_0x4bea5e[_0xce06('0x14')](_0x1db89e);return _0x4bea5e[_0xce06('0x1b')](_0xce06('0x1c'),_0x4e1d3d+'-'+_0x40d629+'/'+_0x46558c)[_0xce06('0x16')](_0x2bbf3b);}return null;};}function patchUpdates(_0x55ba50){return function(_0x4f773d){try{jsonpatch[_0xce06('0x1d')](_0x4f773d,_0x55ba50,!![]);}catch(_0x564389){return BPromise[_0xce06('0x1e')](_0x564389);}return _0x4f773d[_0xce06('0x1f')]();};}function saveUpdates(_0x4511ad,_0x15bf5f){return function(_0x2c39f2){if(_0x2c39f2){return _0x2c39f2[_0xce06('0x20')](_0x4511ad)[_0xce06('0x21')](function(_0x37fe48){return _0x37fe48;});}return null;};}function removeEntity(_0x18e9ed,_0x4a6492){return function(_0x550e43){if(_0x550e43){return _0x550e43[_0xce06('0x22')]()[_0xce06('0x21')](function(){_0x18e9ed['status'](0xcc)[_0xce06('0x15')]();});}};}function handleEntityNotFound(_0x17658b,_0x4dcc8d){return function(_0x242501){if(!_0x242501){_0x17658b['sendStatus'](0x194);}return _0x242501;};}function handleError(_0x34add3,_0x4ac109){_0x4ac109=_0x4ac109||0x1f4;return function(_0x296a36){logger[_0xce06('0x23')](_0x296a36[_0xce06('0x24')]);if(_0x296a36['name']){delete _0x296a36[_0xce06('0x25')];}_0x34add3['status'](_0x4ac109)[_0xce06('0x26')](_0x296a36);};}exports['index']=function(_0x31ded8,_0x26cfe9){var _0x923a8d={},_0x2e22c5={},_0x3ab98c={'count':0x0,'rows':[]};var _0xcce945=_['map'](db[_0xce06('0x27')][_0xce06('0x28')],function(_0x5ee9b1){return{'name':_0x5ee9b1[_0xce06('0x29')],'type':_0x5ee9b1[_0xce06('0x2a')]['key']};});_0x2e22c5[_0xce06('0x2b')]=_['map'](_0xcce945,_0xce06('0x25'));_0x2e22c5[_0xce06('0x2c')]=_[_0xce06('0x2d')](_0x31ded8[_0xce06('0x2c')]);_0x2e22c5['filters']=_[_0xce06('0x2e')](_0x2e22c5[_0xce06('0x2b')],_0x2e22c5[_0xce06('0x2c')]);_0x923a8d[_0xce06('0x2f')]=_[_0xce06('0x2e')](_0x2e22c5['model'],qs['fields'](_0x31ded8['query']['fields']));_0x923a8d[_0xce06('0x2f')]=_0x923a8d[_0xce06('0x2f')][_0xce06('0x30')]?_0x923a8d[_0xce06('0x2f')]:_0x2e22c5[_0xce06('0x2b')];if(!_0x31ded8[_0xce06('0x2c')][_0xce06('0x31')](_0xce06('0x32'))){_0x923a8d[_0xce06('0x19')]=qs[_0xce06('0x19')](_0x31ded8[_0xce06('0x2c')][_0xce06('0x19')]);_0x923a8d['offset']=qs[_0xce06('0x17')](_0x31ded8[_0xce06('0x2c')]['offset']);}_0x923a8d[_0xce06('0x33')]=qs[_0xce06('0x34')](_0x31ded8[_0xce06('0x2c')][_0xce06('0x34')]);_0x923a8d['where']=qs[_0xce06('0x35')](_[_0xce06('0x36')](_0x31ded8['query'],_0x2e22c5[_0xce06('0x35')]),_0xcce945);if(_0x31ded8['query'][_0xce06('0x37')]){_0x923a8d['where']=_[_0xce06('0x38')](_0x923a8d['where'],{'$or':_[_0xce06('0x39')](_0xcce945,function(_0x1103f4){if(_0x1103f4[_0xce06('0x2a')]!==_0xce06('0x3a')){var _0x23f57b={};_0x23f57b[_0x1103f4[_0xce06('0x25')]]={'$like':'%'+_0x31ded8['query']['filter']+'%'};return _0x23f57b;}})});}_0x923a8d=_['merge']({},_0x923a8d,_0x31ded8[_0xce06('0x3b')]);var _0x341838={'where':_0x923a8d[_0xce06('0x3c')]};return db[_0xce06('0x27')][_0xce06('0x1a')](_0x341838)[_0xce06('0x21')](function(_0x5682b2){_0x3ab98c[_0xce06('0x1a')]=_0x5682b2;if(_0x31ded8[_0xce06('0x2c')][_0xce06('0x3d')]){_0x923a8d[_0xce06('0x3e')]=[{'all':!![]}];}return db[_0xce06('0x27')][_0xce06('0x3f')](_0x923a8d);})[_0xce06('0x21')](function(_0xe2b89a){_0x3ab98c[_0xce06('0x40')]=_0xe2b89a;return _0x3ab98c;})[_0xce06('0x21')](respondWithFilteredResult(_0x26cfe9,_0x923a8d))[_0xce06('0x41')](handleError(_0x26cfe9,null));};exports['show']=function(_0x3a3cf3,_0x428904){var _0x130717={'raw':![],'where':{'id':_0x3a3cf3[_0xce06('0x42')]['id']}},_0x55d7c={};_0x55d7c[_0xce06('0x2b')]=_['keys'](db['SugarcrmAccount'][_0xce06('0x28')]);_0x55d7c[_0xce06('0x2c')]=_['keys'](_0x3a3cf3[_0xce06('0x2c')]);_0x55d7c['filters']=_[_0xce06('0x2e')](_0x55d7c[_0xce06('0x2b')],_0x55d7c[_0xce06('0x2c')]);_0x130717[_0xce06('0x2f')]=_[_0xce06('0x2e')](_0x55d7c['model'],qs[_0xce06('0x43')](_0x3a3cf3[_0xce06('0x2c')][_0xce06('0x43')]));_0x130717[_0xce06('0x2f')]=_0x130717[_0xce06('0x2f')][_0xce06('0x30')]?_0x130717[_0xce06('0x2f')]:_0x55d7c['model'];if(_0x3a3cf3['query'][_0xce06('0x3d')]){_0x130717[_0xce06('0x3e')]=[{'all':!![]}];}_0x130717=_[_0xce06('0x38')]({},_0x130717,_0x3a3cf3['options']);return db[_0xce06('0x27')]['find'](_0x130717)[_0xce06('0x21')](handleEntityNotFound(_0x428904,null))[_0xce06('0x21')](respondWithResult(_0x428904,null))['catch'](handleError(_0x428904,null));};exports['create']=function(_0x31e0cf,_0x2c0630){return db[_0xce06('0x27')][_0xce06('0x44')](_0x31e0cf[_0xce06('0x45')],{})[_0xce06('0x21')](respondWithResult(_0x2c0630,0xc9))[_0xce06('0x41')](handleError(_0x2c0630,null));};exports[_0xce06('0x20')]=function(_0x1f63a0,_0x4a713e){if(_0x1f63a0[_0xce06('0x45')]['id']){delete _0x1f63a0[_0xce06('0x45')]['id'];}return db[_0xce06('0x27')]['find']({'where':{'id':_0x1f63a0[_0xce06('0x42')]['id']}})[_0xce06('0x21')](handleEntityNotFound(_0x4a713e,null))[_0xce06('0x21')](saveUpdates(_0x1f63a0['body'],null))[_0xce06('0x21')](respondWithResult(_0x4a713e,null))[_0xce06('0x41')](handleError(_0x4a713e,null));};exports[_0xce06('0x22')]=function(_0xc6457c,_0x321256){return db[_0xce06('0x27')][_0xce06('0x46')]({'where':{'id':_0xc6457c[_0xce06('0x42')]['id']}})[_0xce06('0x21')](handleEntityNotFound(_0x321256,null))[_0xce06('0x21')](removeEntity(_0x321256,null))[_0xce06('0x41')](handleError(_0x321256,null));};exports[_0xce06('0x47')]=function(_0x2b0445,_0x367d5a,_0x251206){var _0x3a2099={};var _0x242ae7={};var _0x3c14a4;var _0x179966;return db['SugarcrmAccount'][_0xce06('0x48')]({'where':{'id':_0x2b0445[_0xce06('0x42')]['id']}})['then'](handleEntityNotFound(_0x367d5a,null))['then'](function(_0x41ed50){if(_0x41ed50){_0x3c14a4=_0x41ed50;_0x242ae7[_0xce06('0x2b')]=_['keys'](db[_0xce06('0x49')][_0xce06('0x28')]);_0x242ae7[_0xce06('0x2c')]=_['keys'](_0x2b0445[_0xce06('0x2c')]);_0x242ae7[_0xce06('0x35')]=_[_0xce06('0x2e')](_0x242ae7[_0xce06('0x2b')],_0x242ae7[_0xce06('0x2c')]);_0x3a2099[_0xce06('0x2f')]=_[_0xce06('0x2e')](_0x242ae7[_0xce06('0x2b')],qs[_0xce06('0x43')](_0x2b0445[_0xce06('0x2c')]['fields']));_0x3a2099['attributes']=_0x3a2099[_0xce06('0x2f')][_0xce06('0x30')]?_0x3a2099[_0xce06('0x2f')]:_0x242ae7[_0xce06('0x2b')];_0x3a2099[_0xce06('0x33')]=qs['sort'](_0x2b0445[_0xce06('0x2c')]['sort']);_0x3a2099[_0xce06('0x3c')]=qs['filters'](_[_0xce06('0x36')](_0x2b0445[_0xce06('0x2c')],_0x242ae7['filters']));if(_0x2b0445[_0xce06('0x2c')][_0xce06('0x37')]){_0x3a2099[_0xce06('0x3c')]=_[_0xce06('0x38')](_0x3a2099['where'],{'$or':_[_0xce06('0x39')](_0x3a2099[_0xce06('0x2f')],function(_0x60441b){var _0x55d08f={};_0x55d08f[_0x60441b]={'$like':'%'+_0x2b0445['query']['filter']+'%'};return _0x55d08f;})});}_0x3a2099=_['merge']({},_0x3a2099,_0x2b0445['options']);return _0x3c14a4['getConfigurations'](_0x3a2099);}})['then'](function(_0x47dca7){if(_0x47dca7){_0x179966=_0x47dca7[_0xce06('0x30')];if(!_0x2b0445[_0xce06('0x2c')][_0xce06('0x31')](_0xce06('0x32'))){_0x3a2099[_0xce06('0x19')]=qs[_0xce06('0x19')](_0x2b0445[_0xce06('0x2c')][_0xce06('0x19')]);_0x3a2099[_0xce06('0x17')]=qs[_0xce06('0x17')](_0x2b0445['query'][_0xce06('0x17')]);}return _0x3c14a4['getConfigurations'](_0x3a2099);}})[_0xce06('0x21')](function(_0xc268d5){if(_0xc268d5){return _0xc268d5?{'count':_0x179966,'rows':_0xc268d5}:null;}})[_0xce06('0x21')](respondWithResult(_0x367d5a,null))['catch'](handleError(_0x367d5a,null));};exports[_0xce06('0x4a')]=function(_0x3c23f6,_0x469dde,_0x2bc3ff){if(_0x3c23f6[_0xce06('0x45')]['id']){delete _0x3c23f6[_0xce06('0x45')]['id'];}return db[_0xce06('0x27')][_0xce06('0x48')]({'where':{'id':_0x3c23f6[_0xce06('0x42')]['id']}})[_0xce06('0x21')](handleEntityNotFound(_0x469dde,null))[_0xce06('0x21')](function(_0x123608){if(_0x123608){_0x3c23f6[_0xce06('0x45')]['AccountId']=_0x123608['id'];_0x3c23f6[_0xce06('0x45')]['Subjects']=integrations['getSubjects'](_0x3c23f6[_0xce06('0x45')][_0xce06('0x4b')],_0x3c23f6['body']['type']);_0x3c23f6[_0xce06('0x45')]['Descriptions']=integrations[_0xce06('0x4c')](_0x3c23f6[_0xce06('0x45')][_0xce06('0x4b')],_0x3c23f6[_0xce06('0x45')]['type']);return db[_0xce06('0x49')][_0xce06('0x44')](_0x3c23f6[_0xce06('0x45')],{'include':[{'model':db[_0xce06('0x4d')],'as':_0xce06('0x4e')},{'model':db['SugarcrmField'],'as':_0xce06('0x4f')}]});}return null;})[_0xce06('0x21')](respondWithResult(_0x469dde,null))[_0xce06('0x41')](handleError(_0x469dde,null));};exports[_0xce06('0x50')]=function(_0x3045c8,_0x358396,_0x35f3dd){var _0x179e10='';var _0x37cb70=['id',_0xce06('0x25'),_0xce06('0x51'),'created_by','description',_0xce06('0x52'),_0xce06('0x53'),_0xce06('0x54'),_0xce06('0x55'),_0xce06('0x56'),_0xce06('0x57'),'direction'];return db[_0xce06('0x27')][_0xce06('0x48')]({'where':{'id':_0x3045c8['params']['id']},'attributes':['id',_0xce06('0x58'),_0xce06('0x59'),_0xce06('0x5a')]})[_0xce06('0x21')](handleEntityNotFound(_0x358396,null))[_0xce06('0x21')](function(_0x1967b3){if(_0x1967b3){_0x179e10=_0x1967b3['remoteUri'];var _0x2e7858=_0x179e10[_0xce06('0x5b')](-0x1);if(_0x2e7858==='/'){_0x179e10=_0x179e10[_0xce06('0x5c')](0x0,_0x179e10[_0xce06('0x5d')](_0x2e7858));}return rp({'method':'POST','uri':util[_0xce06('0x5e')](_0xce06('0x5f'),_0x179e10,_0xce06('0x60')),'json':!![],'form':{'method':_0xce06('0x61'),'input_type':_0xce06('0x62'),'response_type':_0xce06('0x62'),'rest_data':JSON[_0xce06('0x63')]({'user_auth':{'user_name':_0x1967b3[_0xce06('0x58')],'password':_0x1967b3[_0xce06('0x59')],'encryption':_0xce06('0x64')},'application':_0xce06('0x65')})}});}})[_0xce06('0x21')](function(_0x403e8d){if(_0x403e8d&&_0x403e8d[_0xce06('0x25')]!==_0xce06('0x66')&&_0x403e8d[_0xce06('0x25')]!==_0xce06('0x67')){return rp({'method':_0xce06('0x68'),'uri':util['format'](_0xce06('0x5f'),_0x179e10,_0xce06('0x60')),'json':!![],'form':{'method':_0xce06('0x69'),'input_type':_0xce06('0x62'),'response_type':_0xce06('0x62'),'rest_data':JSON[_0xce06('0x63')]({'session':_0x403e8d['id'],'module_name':_0xce06('0x6a')})}})[_0xce06('0x21')](function(_0x36e026){if(_0x36e026){var _0x59449c=_[_0xce06('0x6b')](_0x36e026[_0xce06('0x6c')]);_[_0xce06('0x6d')](_0x59449c,function(_0x5dbb97){return _0x37cb70[_0xce06('0x6e')](_0x5dbb97[_0xce06('0x25')]);});return{'count':_0x59449c[_0xce06('0x30')],'rows':_['map'](_0x59449c,function(_0x41b552){return{'id':_0x41b552[_0xce06('0x25')],'name':_0x41b552[_0xce06('0x6f')],'custom':_[_0xce06('0x70')](_0x41b552[_0xce06('0x25')],'_c')?!![]:![],'options':_0x41b552[_0xce06('0x3b')]?_[_0xce06('0x39')](_['values'](_0x41b552['options']),function(_0x2785b7){return{'name':_0x2785b7['value'],'value':_0x2785b7[_0xce06('0x25')]};}):[]};})};}})[_0xce06('0x21')](respondWithResult(_0x358396,null))[_0xce06('0x41')](function(_0x273e69){var _0x480971=_0x3045c8[_0xce06('0x2c')][_0xce06('0x71')]?0x1f4:_0x273e69['statusCode']||0x1f4;logger[_0xce06('0x23')](_0xce06('0x72'),_0xce06('0x50'),_0x480971,JSON[_0xce06('0x63')](_0x273e69));delete _0x273e69['name'];if(_0x480971===0x191){_0x480971=0x190;}_0x358396[_0xce06('0x14')](_0x480971)[_0xce06('0x26')](_0x3045c8['query'][_0xce06('0x71')]?{'message':_0xce06('0x73'),'statusCode':_0x273e69[_0xce06('0x74')]}:_0x273e69);});}else{var _0x4d8c39=0x1f4;_0x358396[_0xce06('0x14')](_0x4d8c39)[_0xce06('0x26')]({'message':_0xce06('0x73'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xfe3f=['model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','findAll','rows','show','params','includeAll','include','options','find','catch','create','update','body','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','description','date_start','duration_hours','parent_name','direction','username','password','remoteUri','slice','substring','POST','%s%s','/service/v4_1/rest.php','login','JSON','stringify','Invalid\x20Login','get_module_fields','Calls','values','includes','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','save','then','destroy','error','stack','name','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key'];(function(_0x59f93a,_0x2fe0fd){var _0x46e587=function(_0x494ff4){while(--_0x494ff4){_0x59f93a['push'](_0x59f93a['shift']());}};_0x46e587(++_0x2fe0fd);}(_0xfe3f,0x193));var _0xffe3=function(_0x45a16d,_0x150593){_0x45a16d=_0x45a16d-0x0;var _0x30212a=_0xfe3f[_0x45a16d];return _0x30212a;};'use strict';var emlformat=require(_0xffe3('0x0'));var rimraf=require(_0xffe3('0x1'));var zipdir=require(_0xffe3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xffe3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xffe3('0x4'));var util=require(_0xffe3('0x5'));var path=require(_0xffe3('0x6'));var sox=require(_0xffe3('0x7'));var csv=require(_0xffe3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xffe3('0x9'));var squel=require('squel');var crypto=require(_0xffe3('0xa'));var jsforce=require(_0xffe3('0xb'));var deskjs=require(_0xffe3('0xc'));var toCsv=require(_0xffe3('0x8'));var querystring=require(_0xffe3('0xd'));var Papa=require(_0xffe3('0xe'));var Redis=require(_0xffe3('0xf'));var authService=require(_0xffe3('0x10'));var qs=require(_0xffe3('0x11'));var as=require(_0xffe3('0x12'));var hardwareService=require(_0xffe3('0x13'));var logger=require('../../config/logger')(_0xffe3('0x14'));var utils=require(_0xffe3('0x15'));var config=require(_0xffe3('0x16'));var licenseUtil=require(_0xffe3('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x44a503,_0x2473b3){_0x2473b3=_0x2473b3||0xcc;return function(_0x438ced){if(_0x438ced){return _0x44a503['sendStatus'](_0x2473b3);}return _0x44a503[_0xffe3('0x18')](_0x2473b3)[_0xffe3('0x19')]();};}function respondWithResult(_0x25d472,_0x18c555){_0x18c555=_0x18c555||0xc8;return function(_0x8756a9){if(_0x8756a9){return _0x25d472[_0xffe3('0x18')](_0x18c555)[_0xffe3('0x1a')](_0x8756a9);}};}function respondWithFilteredResult(_0x155f3a,_0x4d865b){return function(_0x2d1b2f){if(_0x2d1b2f){var _0x2734de=typeof _0x4d865b[_0xffe3('0x1b')]===_0xffe3('0x1c')&&typeof _0x4d865b[_0xffe3('0x1d')]==='undefined';var _0x5bcfb8=_0x2d1b2f[_0xffe3('0x1e')];var _0x15cb32=_0x2734de?0x0:_0x4d865b['offset'];var _0x4fb43a=_0x2734de?_0x2d1b2f[_0xffe3('0x1e')]:_0x4d865b['offset']+_0x4d865b['limit'];var _0x4e1084;if(_0x4fb43a>=_0x5bcfb8){_0x4fb43a=_0x5bcfb8;_0x4e1084=0xc8;}else{_0x4e1084=0xce;}_0x155f3a['status'](_0x4e1084);return _0x155f3a['set'](_0xffe3('0x1f'),_0x15cb32+'-'+_0x4fb43a+'/'+_0x5bcfb8)['json'](_0x2d1b2f);}return null;};}function patchUpdates(_0x212826){return function(_0x1d1a86){try{jsonpatch['apply'](_0x1d1a86,_0x212826,!![]);}catch(_0x1ee4e8){return BPromise['reject'](_0x1ee4e8);}return _0x1d1a86[_0xffe3('0x20')]();};}function saveUpdates(_0x3c85f7,_0x1e4750){return function(_0x285661){if(_0x285661){return _0x285661['update'](_0x3c85f7)[_0xffe3('0x21')](function(_0x19e2e7){return _0x19e2e7;});}return null;};}function removeEntity(_0x490687,_0x3536b7){return function(_0x1b04c7){if(_0x1b04c7){return _0x1b04c7[_0xffe3('0x22')]()['then'](function(){_0x490687[_0xffe3('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c5ebc,_0xe27ec5){return function(_0x469d12){if(!_0x469d12){_0x2c5ebc['sendStatus'](0x194);}return _0x469d12;};}function handleError(_0x54b402,_0x570675){_0x570675=_0x570675||0x1f4;return function(_0x5f19c4){logger[_0xffe3('0x23')](_0x5f19c4[_0xffe3('0x24')]);if(_0x5f19c4[_0xffe3('0x25')]){delete _0x5f19c4[_0xffe3('0x25')];}_0x54b402[_0xffe3('0x18')](_0x570675)['send'](_0x5f19c4);};}exports[_0xffe3('0x26')]=function(_0x29851f,_0x22f5ed){var _0x13d1d9={},_0x2851d0={},_0x565d47={'count':0x0,'rows':[]};var _0x45a5f3=_[_0xffe3('0x27')](db[_0xffe3('0x28')][_0xffe3('0x29')],function(_0x297530){return{'name':_0x297530[_0xffe3('0x2a')],'type':_0x297530[_0xffe3('0x2b')][_0xffe3('0x2c')]};});_0x2851d0[_0xffe3('0x2d')]=_['map'](_0x45a5f3,_0xffe3('0x25'));_0x2851d0[_0xffe3('0x2e')]=_[_0xffe3('0x2f')](_0x29851f[_0xffe3('0x2e')]);_0x2851d0['filters']=_[_0xffe3('0x30')](_0x2851d0['model'],_0x2851d0[_0xffe3('0x2e')]);_0x13d1d9[_0xffe3('0x31')]=_['intersection'](_0x2851d0['model'],qs['fields'](_0x29851f['query'][_0xffe3('0x32')]));_0x13d1d9[_0xffe3('0x31')]=_0x13d1d9[_0xffe3('0x31')][_0xffe3('0x33')]?_0x13d1d9[_0xffe3('0x31')]:_0x2851d0[_0xffe3('0x2d')];if(!_0x29851f['query'][_0xffe3('0x34')](_0xffe3('0x35'))){_0x13d1d9[_0xffe3('0x1d')]=qs[_0xffe3('0x1d')](_0x29851f[_0xffe3('0x2e')]['limit']);_0x13d1d9['offset']=qs[_0xffe3('0x1b')](_0x29851f['query']['offset']);}_0x13d1d9[_0xffe3('0x36')]=qs[_0xffe3('0x37')](_0x29851f['query']['sort']);_0x13d1d9['where']=qs[_0xffe3('0x38')](_['pick'](_0x29851f['query'],_0x2851d0['filters']),_0x45a5f3);if(_0x29851f[_0xffe3('0x2e')][_0xffe3('0x39')]){_0x13d1d9[_0xffe3('0x3a')]=_[_0xffe3('0x3b')](_0x13d1d9[_0xffe3('0x3a')],{'$or':_[_0xffe3('0x27')](_0x45a5f3,function(_0x35b7d2){if(_0x35b7d2[_0xffe3('0x2b')]!==_0xffe3('0x3c')){var _0x1a3612={};_0x1a3612[_0x35b7d2[_0xffe3('0x25')]]={'$like':'%'+_0x29851f[_0xffe3('0x2e')][_0xffe3('0x39')]+'%'};return _0x1a3612;}})});}_0x13d1d9=_[_0xffe3('0x3b')]({},_0x13d1d9,_0x29851f['options']);var _0xecca2d={'where':_0x13d1d9[_0xffe3('0x3a')]};return db[_0xffe3('0x28')][_0xffe3('0x1e')](_0xecca2d)[_0xffe3('0x21')](function(_0x2428ec){_0x565d47[_0xffe3('0x1e')]=_0x2428ec;if(_0x29851f[_0xffe3('0x2e')]['includeAll']){_0x13d1d9['include']=[{'all':!![]}];}return db[_0xffe3('0x28')][_0xffe3('0x3d')](_0x13d1d9);})['then'](function(_0x1b5514){_0x565d47[_0xffe3('0x3e')]=_0x1b5514;return _0x565d47;})[_0xffe3('0x21')](respondWithFilteredResult(_0x22f5ed,_0x13d1d9))['catch'](handleError(_0x22f5ed,null));};exports[_0xffe3('0x3f')]=function(_0x45c956,_0x227633){var _0x95e2={'raw':![],'where':{'id':_0x45c956[_0xffe3('0x40')]['id']}},_0x18de62={};_0x18de62[_0xffe3('0x2d')]=_[_0xffe3('0x2f')](db[_0xffe3('0x28')]['rawAttributes']);_0x18de62[_0xffe3('0x2e')]=_[_0xffe3('0x2f')](_0x45c956['query']);_0x18de62['filters']=_[_0xffe3('0x30')](_0x18de62[_0xffe3('0x2d')],_0x18de62[_0xffe3('0x2e')]);_0x95e2[_0xffe3('0x31')]=_['intersection'](_0x18de62[_0xffe3('0x2d')],qs[_0xffe3('0x32')](_0x45c956[_0xffe3('0x2e')][_0xffe3('0x32')]));_0x95e2[_0xffe3('0x31')]=_0x95e2[_0xffe3('0x31')][_0xffe3('0x33')]?_0x95e2[_0xffe3('0x31')]:_0x18de62['model'];if(_0x45c956[_0xffe3('0x2e')][_0xffe3('0x41')]){_0x95e2[_0xffe3('0x42')]=[{'all':!![]}];}_0x95e2=_[_0xffe3('0x3b')]({},_0x95e2,_0x45c956[_0xffe3('0x43')]);return db[_0xffe3('0x28')][_0xffe3('0x44')](_0x95e2)[_0xffe3('0x21')](handleEntityNotFound(_0x227633,null))['then'](respondWithResult(_0x227633,null))[_0xffe3('0x45')](handleError(_0x227633,null));};exports[_0xffe3('0x46')]=function(_0x364924,_0x3c4910){return db[_0xffe3('0x28')][_0xffe3('0x46')](_0x364924['body'],{})[_0xffe3('0x21')](respondWithResult(_0x3c4910,0xc9))[_0xffe3('0x45')](handleError(_0x3c4910,null));};exports[_0xffe3('0x47')]=function(_0x335305,_0x488ab7){if(_0x335305[_0xffe3('0x48')]['id']){delete _0x335305[_0xffe3('0x48')]['id'];}return db[_0xffe3('0x28')][_0xffe3('0x44')]({'where':{'id':_0x335305['params']['id']}})[_0xffe3('0x21')](handleEntityNotFound(_0x488ab7,null))[_0xffe3('0x21')](saveUpdates(_0x335305[_0xffe3('0x48')],null))[_0xffe3('0x21')](respondWithResult(_0x488ab7,null))[_0xffe3('0x45')](handleError(_0x488ab7,null));};exports[_0xffe3('0x22')]=function(_0x2ef59f,_0x19a1fb){return db['SugarcrmAccount']['find']({'where':{'id':_0x2ef59f[_0xffe3('0x40')]['id']}})['then'](handleEntityNotFound(_0x19a1fb,null))[_0xffe3('0x21')](removeEntity(_0x19a1fb,null))['catch'](handleError(_0x19a1fb,null));};exports[_0xffe3('0x49')]=function(_0x5ae65e,_0x333393,_0x209d2f){var _0x1d506d={};var _0x27d85c={};var _0x3ea1a1;var _0x349dfe;return db[_0xffe3('0x28')][_0xffe3('0x4a')]({'where':{'id':_0x5ae65e['params']['id']}})['then'](handleEntityNotFound(_0x333393,null))[_0xffe3('0x21')](function(_0x29dfb6){if(_0x29dfb6){_0x3ea1a1=_0x29dfb6;_0x27d85c[_0xffe3('0x2d')]=_[_0xffe3('0x2f')](db[_0xffe3('0x4b')][_0xffe3('0x29')]);_0x27d85c[_0xffe3('0x2e')]=_[_0xffe3('0x2f')](_0x5ae65e['query']);_0x27d85c[_0xffe3('0x38')]=_[_0xffe3('0x30')](_0x27d85c['model'],_0x27d85c[_0xffe3('0x2e')]);_0x1d506d[_0xffe3('0x31')]=_['intersection'](_0x27d85c['model'],qs[_0xffe3('0x32')](_0x5ae65e[_0xffe3('0x2e')]['fields']));_0x1d506d[_0xffe3('0x31')]=_0x1d506d['attributes'][_0xffe3('0x33')]?_0x1d506d['attributes']:_0x27d85c[_0xffe3('0x2d')];_0x1d506d[_0xffe3('0x36')]=qs[_0xffe3('0x37')](_0x5ae65e[_0xffe3('0x2e')][_0xffe3('0x37')]);_0x1d506d[_0xffe3('0x3a')]=qs[_0xffe3('0x38')](_['pick'](_0x5ae65e[_0xffe3('0x2e')],_0x27d85c[_0xffe3('0x38')]));if(_0x5ae65e[_0xffe3('0x2e')]['filter']){_0x1d506d[_0xffe3('0x3a')]=_[_0xffe3('0x3b')](_0x1d506d[_0xffe3('0x3a')],{'$or':_[_0xffe3('0x27')](_0x1d506d['attributes'],function(_0x42219e){var _0x30e461={};_0x30e461[_0x42219e]={'$like':'%'+_0x5ae65e[_0xffe3('0x2e')][_0xffe3('0x39')]+'%'};return _0x30e461;})});}_0x1d506d=_['merge']({},_0x1d506d,_0x5ae65e['options']);return _0x3ea1a1[_0xffe3('0x49')](_0x1d506d);}})[_0xffe3('0x21')](function(_0x2a7a6e){if(_0x2a7a6e){_0x349dfe=_0x2a7a6e[_0xffe3('0x33')];if(!_0x5ae65e[_0xffe3('0x2e')][_0xffe3('0x34')](_0xffe3('0x35'))){_0x1d506d[_0xffe3('0x1d')]=qs['limit'](_0x5ae65e[_0xffe3('0x2e')]['limit']);_0x1d506d[_0xffe3('0x1b')]=qs['offset'](_0x5ae65e[_0xffe3('0x2e')]['offset']);}return _0x3ea1a1[_0xffe3('0x49')](_0x1d506d);}})['then'](function(_0x5abf58){if(_0x5abf58){return _0x5abf58?{'count':_0x349dfe,'rows':_0x5abf58}:null;}})[_0xffe3('0x21')](respondWithResult(_0x333393,null))['catch'](handleError(_0x333393,null));};exports[_0xffe3('0x4c')]=function(_0x47ef66,_0xe0b45c,_0x2644d1){if(_0x47ef66['body']['id']){delete _0x47ef66[_0xffe3('0x48')]['id'];}return db[_0xffe3('0x28')][_0xffe3('0x4a')]({'where':{'id':_0x47ef66[_0xffe3('0x40')]['id']}})['then'](handleEntityNotFound(_0xe0b45c,null))[_0xffe3('0x21')](function(_0x323029){if(_0x323029){_0x47ef66[_0xffe3('0x48')]['AccountId']=_0x323029['id'];_0x47ef66[_0xffe3('0x48')][_0xffe3('0x4d')]=integrations[_0xffe3('0x4e')](_0x47ef66[_0xffe3('0x48')][_0xffe3('0x4f')],_0x47ef66[_0xffe3('0x48')][_0xffe3('0x2b')]);_0x47ef66[_0xffe3('0x48')][_0xffe3('0x50')]=integrations[_0xffe3('0x51')](_0x47ef66[_0xffe3('0x48')]['channel'],_0x47ef66['body']['type']);return db[_0xffe3('0x4b')][_0xffe3('0x46')](_0x47ef66[_0xffe3('0x48')],{'include':[{'model':db[_0xffe3('0x52')],'as':_0xffe3('0x4d')},{'model':db[_0xffe3('0x52')],'as':_0xffe3('0x50')}]});}return null;})[_0xffe3('0x21')](respondWithResult(_0xe0b45c,null))[_0xffe3('0x45')](handleError(_0xe0b45c,null));};exports[_0xffe3('0x53')]=function(_0x42d743,_0x4a7c6f,_0x7cf6c){var _0x18b05f='';var _0x32040d=['id','name',_0xffe3('0x54'),'created_by',_0xffe3('0x55'),_0xffe3('0x56'),_0xffe3('0x57'),'duration_minutes','parent_id','parent_type',_0xffe3('0x58'),_0xffe3('0x59')];return db[_0xffe3('0x28')][_0xffe3('0x4a')]({'where':{'id':_0x42d743[_0xffe3('0x40')]['id']},'attributes':['id',_0xffe3('0x5a'),_0xffe3('0x5b'),_0xffe3('0x5c')]})['then'](handleEntityNotFound(_0x4a7c6f,null))[_0xffe3('0x21')](function(_0x3734eb){if(_0x3734eb){_0x18b05f=_0x3734eb['remoteUri'];var _0x4700a2=_0x18b05f[_0xffe3('0x5d')](-0x1);if(_0x4700a2==='/'){_0x18b05f=_0x18b05f[_0xffe3('0x5e')](0x0,_0x18b05f['lastIndexOf'](_0x4700a2));}return rp({'method':_0xffe3('0x5f'),'uri':util['format'](_0xffe3('0x60'),_0x18b05f,_0xffe3('0x61')),'json':!![],'form':{'method':_0xffe3('0x62'),'input_type':'JSON','response_type':_0xffe3('0x63'),'rest_data':JSON[_0xffe3('0x64')]({'user_auth':{'user_name':_0x3734eb[_0xffe3('0x5a')],'password':_0x3734eb[_0xffe3('0x5b')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0xffe3('0x21')](function(_0x30f9d7){if(_0x30f9d7&&_0x30f9d7[_0xffe3('0x25')]!==_0xffe3('0x65')&&_0x30f9d7[_0xffe3('0x25')]!=='Password\x20Expired'){return rp({'method':_0xffe3('0x5f'),'uri':util['format'](_0xffe3('0x60'),_0x18b05f,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xffe3('0x66'),'input_type':_0xffe3('0x63'),'response_type':_0xffe3('0x63'),'rest_data':JSON[_0xffe3('0x64')]({'session':_0x30f9d7['id'],'module_name':_0xffe3('0x67')})}})['then'](function(_0x539ae4){if(_0x539ae4){var _0x5d3732=_[_0xffe3('0x68')](_0x539ae4['module_fields']);_['remove'](_0x5d3732,function(_0x51f79b){return _0x32040d[_0xffe3('0x69')](_0x51f79b['name']);});return{'count':_0x5d3732['length'],'rows':_['map'](_0x5d3732,function(_0x226d48){return{'id':_0x226d48[_0xffe3('0x25')],'name':_0x226d48[_0xffe3('0x6a')],'custom':_['endsWith'](_0x226d48[_0xffe3('0x25')],'_c')?!![]:![],'options':_0x226d48[_0xffe3('0x43')]?_[_0xffe3('0x27')](_[_0xffe3('0x68')](_0x226d48['options']),function(_0x54ec4e){return{'name':_0x54ec4e['value'],'value':_0x54ec4e[_0xffe3('0x25')]};}):[]};})};}})[_0xffe3('0x21')](respondWithResult(_0x4a7c6f,null))[_0xffe3('0x45')](function(_0x294aca){var _0xdeaf1d=_0x42d743[_0xffe3('0x2e')]['test']?0x1f4:_0x294aca[_0xffe3('0x6b')]||0x1f4;logger['error'](_0xffe3('0x6c'),_0xffe3('0x53'),_0xdeaf1d,JSON[_0xffe3('0x64')](_0x294aca));delete _0x294aca['name'];if(_0xdeaf1d===0x191){_0xdeaf1d=0x190;}_0x4a7c6f[_0xffe3('0x18')](_0xdeaf1d)[_0xffe3('0x6d')](_0x42d743[_0xffe3('0x2e')][_0xffe3('0x6e')]?{'message':_0xffe3('0x6f'),'statusCode':_0x294aca[_0xffe3('0x6b')]}:_0x294aca);});}else{var _0x1e933c=0x1f4;_0x4a7c6f[_0xffe3('0x18')](_0x1e933c)[_0xffe3('0x6d')]({'message':_0xffe3('0x6f'),'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 6bb626d..69ce6f1 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 _0x6972=['../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x2d61b2,_0x142947){var _0x12df89=function(_0x31c717){while(--_0x31c717){_0x2d61b2['push'](_0x2d61b2['shift']());}};_0x12df89(++_0x142947);}(_0x6972,0x173));var _0x2697=function(_0x5352de,_0x439801){_0x5352de=_0x5352de-0x0;var _0x3e8541=_0x6972[_0x5352de];return _0x3e8541;};'use strict';var _=require(_0x2697('0x0'));var util=require('util');var logger=require(_0x2697('0x1'))(_0x2697('0x2'));var moment=require(_0x2697('0x3'));var BPromise=require('bluebird');var rp=require(_0x2697('0x4'));var fs=require('fs');var path=require(_0x2697('0x5'));var rimraf=require('rimraf');var config=require(_0x2697('0x6'));var attributes=require(_0x2697('0x7'));var integrations=require(_0x2697('0x8'));module[_0x2697('0x9')]=function(_0xce424b,_0x332e99){return _0xce424b[_0x2697('0xa')](_0x2697('0xb'),attributes,{'tableName':_0x2697('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd04=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','SugarcrmAccount'];(function(_0x5b4f16,_0x1a77e5){var _0x529d5b=function(_0xfac834){while(--_0xfac834){_0x5b4f16['push'](_0x5b4f16['shift']());}};_0x529d5b(++_0x1a77e5);}(_0xdd04,0x15f));var _0x4dd0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd04[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4dd0('0x0'));var util=require(_0x4dd0('0x1'));var logger=require('../../config/logger')(_0x4dd0('0x2'));var moment=require(_0x4dd0('0x3'));var BPromise=require(_0x4dd0('0x4'));var rp=require(_0x4dd0('0x5'));var fs=require('fs');var path=require(_0x4dd0('0x6'));var rimraf=require(_0x4dd0('0x7'));var config=require(_0x4dd0('0x8'));var attributes=require(_0x4dd0('0x9'));var integrations=require(_0x4dd0('0xa'));module['exports']=function(_0x215d82,_0x4fbeda){return _0x215d82[_0x4dd0('0xb')](_0x4dd0('0xc'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 66de700..8abdb68 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 _0xbddc=['message','info','catch','GetSugarcrmAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowSugarcrmAccount','SugarcrmAccount','find','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x497394,_0x2dcbd3){var _0x693d42=function(_0x3578f6){while(--_0x3578f6){_0x497394['push'](_0x497394['shift']());}};_0x693d42(++_0x2dcbd3);}(_0xbddc,0xb0));var _0xcbdd=function(_0xbaa6dd,_0x5c1913){_0xbaa6dd=_0xbaa6dd-0x0;var _0x2cd689=_0xbddc[_0xbaa6dd];return _0x2cd689;};'use strict';var _=require('lodash');var util=require(_0xcbdd('0x0'));var moment=require('moment');var BPromise=require(_0xcbdd('0x1'));var rs=require(_0xcbdd('0x2'));var fs=require('fs');var Redis=require(_0xcbdd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcbdd('0x4'));var logger=require(_0xcbdd('0x5'))(_0xcbdd('0x6'));var config=require(_0xcbdd('0x7'));var jayson=require(_0xcbdd('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x309294,_0x3c2a34,_0x5088cb){return new BPromise(function(_0x31a5cc,_0x3e639f){return client['request'](_0x309294,_0x5088cb)[_0xcbdd('0x9')](function(_0x35b90f){logger['info'](_0xcbdd('0xa'),_0x3c2a34,_0xcbdd('0xb'));logger[_0xcbdd('0xc')](_0xcbdd('0xd'),_0x3c2a34,'request\x20sent',JSON[_0xcbdd('0xe')](_0x35b90f));if(_0x35b90f[_0xcbdd('0xf')]){if(_0x35b90f['error']['code']===0x1f4){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x3c2a34,_0x35b90f[_0xcbdd('0xf')][_0xcbdd('0x10')]);return _0x3e639f(_0x35b90f[_0xcbdd('0xf')][_0xcbdd('0x10')]);}logger[_0xcbdd('0xf')](_0xcbdd('0xa'),_0x3c2a34,_0x35b90f[_0xcbdd('0xf')]['message']);return _0x31a5cc(_0x35b90f[_0xcbdd('0xf')][_0xcbdd('0x10')]);}else{logger[_0xcbdd('0x11')](_0xcbdd('0xa'),_0x3c2a34,_0xcbdd('0xb'));_0x31a5cc(_0x35b90f['result'][_0xcbdd('0x10')]);}})[_0xcbdd('0x12')](function(_0x5be12a){logger[_0xcbdd('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x3c2a34,_0x5be12a);_0x3e639f(_0x5be12a);});});}exports[_0xcbdd('0x13')]=function(_0x36a4b5){var _0x100666=this;return new Promise(function(_0x19b941,_0x46d64e){return db['SugarcrmAccount'][_0xcbdd('0x14')]({'raw':_0x36a4b5[_0xcbdd('0x15')]?_0x36a4b5['options'][_0xcbdd('0x16')]===undefined?!![]:![]:!![],'where':_0x36a4b5['options']?_0x36a4b5[_0xcbdd('0x15')][_0xcbdd('0x17')]||null:null,'attributes':_0x36a4b5[_0xcbdd('0x15')]?_0x36a4b5[_0xcbdd('0x15')][_0xcbdd('0x18')]||null:null,'limit':_0x36a4b5[_0xcbdd('0x15')]?_0x36a4b5['options'][_0xcbdd('0x19')]||null:null,'include':_0x36a4b5[_0xcbdd('0x15')]?_0x36a4b5[_0xcbdd('0x15')][_0xcbdd('0x1a')]?_[_0xcbdd('0x1b')](_0x36a4b5[_0xcbdd('0x15')][_0xcbdd('0x1a')],function(_0x1be662){return{'model':db[_0x1be662['model']],'as':_0x1be662['as'],'attributes':_0x1be662[_0xcbdd('0x18')],'include':_0x1be662[_0xcbdd('0x1a')]?_['map'](_0x1be662[_0xcbdd('0x1a')],function(_0x18fd46){return{'model':db[_0x18fd46[_0xcbdd('0x1c')]],'as':_0x18fd46['as'],'attributes':_0x18fd46['attributes'],'include':_0x18fd46['include']?_[_0xcbdd('0x1b')](_0x18fd46[_0xcbdd('0x1a')],function(_0x4cca5d){return{'model':db[_0x4cca5d[_0xcbdd('0x1c')]],'as':_0x4cca5d['as'],'attributes':_0x4cca5d[_0xcbdd('0x18')]};}):[]};}):[]};}):[]:[]})[_0xcbdd('0x9')](function(_0x44eeb8){logger[_0xcbdd('0x11')](_0xcbdd('0x13'),_0x36a4b5);logger[_0xcbdd('0xc')](_0xcbdd('0x13'),_0x36a4b5,JSON[_0xcbdd('0xe')](_0x44eeb8));_0x19b941(_0x44eeb8);})[_0xcbdd('0x12')](function(_0x9a3dfd){logger[_0xcbdd('0xf')](_0xcbdd('0x13'),_0x9a3dfd[_0xcbdd('0x10')],_0x36a4b5);_0x46d64e(_0x100666['error'](0x1f4,_0x9a3dfd[_0xcbdd('0x10')]));});});};exports[_0xcbdd('0x1d')]=function(_0x29f39c){var _0x5eebb6=this;return new Promise(function(_0x1982a5,_0xf81c7e){return db[_0xcbdd('0x1e')][_0xcbdd('0x1f')]({'raw':_0x29f39c[_0xcbdd('0x15')]?_0x29f39c[_0xcbdd('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x29f39c[_0xcbdd('0x15')]?_0x29f39c[_0xcbdd('0x15')][_0xcbdd('0x17')]||null:null,'attributes':_0x29f39c[_0xcbdd('0x15')]?_0x29f39c[_0xcbdd('0x15')][_0xcbdd('0x18')]||null:null,'include':_0x29f39c['options']?_0x29f39c[_0xcbdd('0x15')][_0xcbdd('0x1a')]?_[_0xcbdd('0x1b')](_0x29f39c[_0xcbdd('0x15')]['include'],function(_0x2ebc8f){return{'model':db[_0x2ebc8f[_0xcbdd('0x1c')]],'as':_0x2ebc8f['as'],'attributes':_0x2ebc8f[_0xcbdd('0x18')],'include':_0x2ebc8f[_0xcbdd('0x1a')]?_[_0xcbdd('0x1b')](_0x2ebc8f[_0xcbdd('0x1a')],function(_0x9fb2b4){return{'model':db[_0x9fb2b4[_0xcbdd('0x1c')]],'as':_0x9fb2b4['as'],'attributes':_0x9fb2b4['attributes'],'include':_0x9fb2b4[_0xcbdd('0x1a')]?_[_0xcbdd('0x1b')](_0x9fb2b4[_0xcbdd('0x1a')],function(_0x2a847c){return{'model':db[_0x2a847c[_0xcbdd('0x1c')]],'as':_0x2a847c['as'],'attributes':_0x2a847c[_0xcbdd('0x18')]};}):[]};}):[]};}):[]:[]})[_0xcbdd('0x9')](function(_0x32afd8){logger['info']('ShowSugarcrmAccount',_0x29f39c);logger[_0xcbdd('0xc')]('ShowSugarcrmAccount',_0x29f39c,JSON[_0xcbdd('0xe')](_0x32afd8));_0x1982a5(_0x32afd8);})[_0xcbdd('0x12')](function(_0x3598a9){logger[_0xcbdd('0xf')](_0xcbdd('0x1d'),_0x3598a9[_0xcbdd('0x10')],_0x29f39c);_0xf81c7e(_0x5eebb6[_0xcbdd('0xf')](0x1f4,_0x3598a9[_0xcbdd('0x10')]));});});}; \ No newline at end of file +var _0x79af=['then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetSugarcrmAccount','options','where','attributes','limit','include','map','model','ShowSugarcrmAccount','SugarcrmAccount','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x29efed,_0x4ef8d0){var _0x155f12=function(_0x542216){while(--_0x542216){_0x29efed['push'](_0x29efed['shift']());}};_0x155f12(++_0x4ef8d0);}(_0x79af,0x1a2));var _0xf79a=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x79af[_0x5d6456];return _0x4d66c1;};'use strict';var _=require('lodash');var util=require(_0xf79a('0x0'));var moment=require(_0xf79a('0x1'));var BPromise=require(_0xf79a('0x2'));var rs=require(_0xf79a('0x3'));var fs=require('fs');var Redis=require(_0xf79a('0x4'));var db=require(_0xf79a('0x5'))['db'];var utils=require(_0xf79a('0x6'));var logger=require(_0xf79a('0x7'))(_0xf79a('0x8'));var config=require(_0xf79a('0x9'));var jayson=require(_0xf79a('0xa'));var client=jayson[_0xf79a('0xb')][_0xf79a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4502f3,_0x25e403,_0x43832e){return new BPromise(function(_0x22dba3,_0xe0b4be){return client[_0xf79a('0xd')](_0x4502f3,_0x43832e)[_0xf79a('0xe')](function(_0x197ca9){logger[_0xf79a('0xf')](_0xf79a('0x10'),_0x25e403,_0xf79a('0x11'));logger[_0xf79a('0x12')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x25e403,'request\x20sent',JSON[_0xf79a('0x13')](_0x197ca9));if(_0x197ca9[_0xf79a('0x14')]){if(_0x197ca9['error'][_0xf79a('0x15')]===0x1f4){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x25e403,_0x197ca9['error']['message']);return _0xe0b4be(_0x197ca9[_0xf79a('0x14')][_0xf79a('0x16')]);}logger[_0xf79a('0x14')](_0xf79a('0x10'),_0x25e403,_0x197ca9[_0xf79a('0x14')][_0xf79a('0x16')]);return _0x22dba3(_0x197ca9[_0xf79a('0x14')][_0xf79a('0x16')]);}else{logger['info'](_0xf79a('0x10'),_0x25e403,_0xf79a('0x11'));_0x22dba3(_0x197ca9[_0xf79a('0x17')][_0xf79a('0x16')]);}})[_0xf79a('0x18')](function(_0x9c0de5){logger[_0xf79a('0x14')]('SugarcrmAccount,\x20%s,\x20%s',_0x25e403,_0x9c0de5);_0xe0b4be(_0x9c0de5);});});}exports[_0xf79a('0x19')]=function(_0x3b8c25){var _0x32c936=this;return new Promise(function(_0x3b687e,_0x3fee65){return db['SugarcrmAccount']['findAll']({'raw':_0x3b8c25[_0xf79a('0x1a')]?_0x3b8c25['options']['raw']===undefined?!![]:![]:!![],'where':_0x3b8c25[_0xf79a('0x1a')]?_0x3b8c25[_0xf79a('0x1a')][_0xf79a('0x1b')]||null:null,'attributes':_0x3b8c25['options']?_0x3b8c25['options'][_0xf79a('0x1c')]||null:null,'limit':_0x3b8c25[_0xf79a('0x1a')]?_0x3b8c25[_0xf79a('0x1a')][_0xf79a('0x1d')]||null:null,'include':_0x3b8c25['options']?_0x3b8c25[_0xf79a('0x1a')][_0xf79a('0x1e')]?_[_0xf79a('0x1f')](_0x3b8c25['options'][_0xf79a('0x1e')],function(_0xe30052){return{'model':db[_0xe30052['model']],'as':_0xe30052['as'],'attributes':_0xe30052['attributes'],'include':_0xe30052[_0xf79a('0x1e')]?_[_0xf79a('0x1f')](_0xe30052[_0xf79a('0x1e')],function(_0x29ea84){return{'model':db[_0x29ea84[_0xf79a('0x20')]],'as':_0x29ea84['as'],'attributes':_0x29ea84['attributes'],'include':_0x29ea84[_0xf79a('0x1e')]?_[_0xf79a('0x1f')](_0x29ea84[_0xf79a('0x1e')],function(_0xdc4eab){return{'model':db[_0xdc4eab[_0xf79a('0x20')]],'as':_0xdc4eab['as'],'attributes':_0xdc4eab[_0xf79a('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x49ccab){logger[_0xf79a('0xf')](_0xf79a('0x19'),_0x3b8c25);logger[_0xf79a('0x12')](_0xf79a('0x19'),_0x3b8c25,JSON[_0xf79a('0x13')](_0x49ccab));_0x3b687e(_0x49ccab);})[_0xf79a('0x18')](function(_0x2b33ab){logger[_0xf79a('0x14')]('GetSugarcrmAccount',_0x2b33ab[_0xf79a('0x16')],_0x3b8c25);_0x3fee65(_0x32c936['error'](0x1f4,_0x2b33ab[_0xf79a('0x16')]));});});};exports[_0xf79a('0x21')]=function(_0x83f535){var _0x15545f=this;return new Promise(function(_0x472ac6,_0x5706e1){return db[_0xf79a('0x22')]['find']({'raw':_0x83f535['options']?_0x83f535[_0xf79a('0x1a')][_0xf79a('0x23')]===undefined?!![]:![]:!![],'where':_0x83f535[_0xf79a('0x1a')]?_0x83f535[_0xf79a('0x1a')]['where']||null:null,'attributes':_0x83f535[_0xf79a('0x1a')]?_0x83f535['options'][_0xf79a('0x1c')]||null:null,'include':_0x83f535[_0xf79a('0x1a')]?_0x83f535[_0xf79a('0x1a')][_0xf79a('0x1e')]?_['map'](_0x83f535[_0xf79a('0x1a')]['include'],function(_0x51e02a){return{'model':db[_0x51e02a[_0xf79a('0x20')]],'as':_0x51e02a['as'],'attributes':_0x51e02a['attributes'],'include':_0x51e02a['include']?_[_0xf79a('0x1f')](_0x51e02a['include'],function(_0x2863a6){return{'model':db[_0x2863a6[_0xf79a('0x20')]],'as':_0x2863a6['as'],'attributes':_0x2863a6[_0xf79a('0x1c')],'include':_0x2863a6[_0xf79a('0x1e')]?_[_0xf79a('0x1f')](_0x2863a6[_0xf79a('0x1e')],function(_0x54a808){return{'model':db[_0x54a808[_0xf79a('0x20')]],'as':_0x54a808['as'],'attributes':_0x54a808[_0xf79a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf79a('0xe')](function(_0x186c31){logger[_0xf79a('0xf')](_0xf79a('0x21'),_0x83f535);logger[_0xf79a('0x12')](_0xf79a('0x21'),_0x83f535,JSON['stringify'](_0x186c31));_0x472ac6(_0x186c31);})['catch'](function(_0x531945){logger[_0xf79a('0x14')](_0xf79a('0x21'),_0x531945[_0xf79a('0x16')],_0x83f535);_0x5706e1(_0x15545f['error'](0x1f4,_0x531945[_0xf79a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 403785c..93aba82 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 _0x2bc3=['create','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x2bc3,0xff));var _0x32bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2bc3[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x32bc('0x0'));var util=require(_0x32bc('0x1'));var path=require(_0x32bc('0x2'));var timeout=require('connect-timeout');var express=require(_0x32bc('0x3'));var router=express[_0x32bc('0x4')]();var fs_extra=require(_0x32bc('0x5'));var auth=require(_0x32bc('0x6'));var interaction=require(_0x32bc('0x7'));var config=require(_0x32bc('0x8'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x32bc('0x9')]('/',auth[_0x32bc('0xa')](),controller[_0x32bc('0xb')]);router[_0x32bc('0x9')](_0x32bc('0xc'),auth['isAuthenticated'](),controller[_0x32bc('0xd')]);router[_0x32bc('0x9')](_0x32bc('0xe'),auth['isAuthenticated'](),controller[_0x32bc('0xf')]);router['get'](_0x32bc('0x10'),auth[_0x32bc('0xa')](),controller[_0x32bc('0x11')]);router['get'](_0x32bc('0x12'),auth[_0x32bc('0xa')](),controller[_0x32bc('0x13')]);router['post']('/',auth[_0x32bc('0xa')](),controller[_0x32bc('0x14')]);router['put']('/:id',auth[_0x32bc('0xa')](),controller[_0x32bc('0x15')]);router[_0x32bc('0x16')]('/:id',auth[_0x32bc('0xa')](),controller[_0x32bc('0x17')]);module[_0x32bc('0x18')]=router; \ No newline at end of file +var _0x7fac=['post','put','/:id','update','destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0xb375b0,_0x2f64bb){var _0x5ac0b8=function(_0x577655){while(--_0x577655){_0xb375b0['push'](_0xb375b0['shift']());}};_0x5ac0b8(++_0x2f64bb);}(_0x7fac,0xbd));var _0xc7fa=function(_0x179e11,_0xf65436){_0x179e11=_0x179e11-0x0;var _0x549f04=_0x7fac[_0x179e11];return _0x549f04;};'use strict';var multer=require(_0xc7fa('0x0'));var util=require(_0xc7fa('0x1'));var path=require('path');var timeout=require(_0xc7fa('0x2'));var express=require('express');var router=express[_0xc7fa('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc7fa('0x4'));var interaction=require(_0xc7fa('0x5'));var config=require(_0xc7fa('0x6'));var controller=require(_0xc7fa('0x7'));router[_0xc7fa('0x8')]('/',auth[_0xc7fa('0x9')](),controller[_0xc7fa('0xa')]);router[_0xc7fa('0x8')]('/:id',auth[_0xc7fa('0x9')](),controller[_0xc7fa('0xb')]);router['get'](_0xc7fa('0xc'),auth[_0xc7fa('0x9')](),controller[_0xc7fa('0xd')]);router['get'](_0xc7fa('0xe'),auth[_0xc7fa('0x9')](),controller[_0xc7fa('0xf')]);router['get'](_0xc7fa('0x10'),auth[_0xc7fa('0x9')](),controller[_0xc7fa('0x11')]);router[_0xc7fa('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc7fa('0x13')](_0xc7fa('0x14'),auth[_0xc7fa('0x9')](),controller[_0xc7fa('0x15')]);router['delete'](_0xc7fa('0x14'),auth[_0xc7fa('0x9')](),controller[_0xc7fa('0x16')]);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 c685076..87378f4 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 _0xe8ad=['exports','STRING','sequelize'];(function(_0xdecf55,_0x20eb8e){var _0x2aba83=function(_0x28a4de){while(--_0x28a4de){_0xdecf55['push'](_0xdecf55['shift']());}};_0x2aba83(++_0x20eb8e);}(_0xe8ad,0xc5));var _0xde8a=function(_0x43a41f,_0x12b084){_0x43a41f=_0x43a41f-0x0;var _0x11d515=_0xe8ad[_0x43a41f];return _0x11d515;};'use strict';var Sequelize=require(_0xde8a('0x0'));module[_0xde8a('0x1')]={'name':{'type':Sequelize[_0xde8a('0x2')]},'description':{'type':Sequelize[_0xde8a('0x2')]}}; \ No newline at end of file +var _0x76bd=['sequelize','exports','STRING'];(function(_0x2b2ef9,_0x3c2fe3){var _0x5062b5=function(_0x31d9aa){while(--_0x31d9aa){_0x2b2ef9['push'](_0x2b2ef9['shift']());}};_0x5062b5(++_0x3c2fe3);}(_0x76bd,0x1dd));var _0xd76b=function(_0x880cec,_0x493e9e){_0x880cec=_0x880cec-0x0;var _0x2aa5a7=_0x76bd[_0x880cec];return _0x2aa5a7;};'use strict';var Sequelize=require(_0xd76b('0x0'));module[_0xd76b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd76b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index dda9de1..9245e73 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 _0xe1d8=['body','getFields','findOne','SugarcrmField','hasOwnProperty','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','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/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','end','name','send','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','query','filters','model','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','keys','fields','include','find','create'];(function(_0x57c5cb,_0x5f3e10){var _0x58d7cf=function(_0x16b455){while(--_0x16b455){_0x57c5cb['push'](_0x57c5cb['shift']());}};_0x58d7cf(++_0x5f3e10);}(_0xe1d8,0x1a1));var _0x8e1d=function(_0x3c5fba,_0x2dd4df){_0x3c5fba=_0x3c5fba-0x0;var _0x1fc038=_0xe1d8[_0x3c5fba];return _0x1fc038;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8e1d('0x0'));var zipdir=require(_0x8e1d('0x1'));var jsonpatch=require(_0x8e1d('0x2'));var rp=require('request-promise');var moment=require(_0x8e1d('0x3'));var BPromise=require(_0x8e1d('0x4'));var Mustache=require(_0x8e1d('0x5'));var util=require('util');var path=require(_0x8e1d('0x6'));var sox=require(_0x8e1d('0x7'));var csv=require(_0x8e1d('0x8'));var ejs=require(_0x8e1d('0x9'));var fs=require('fs');var fs_extra=require(_0x8e1d('0xa'));var _=require(_0x8e1d('0xb'));var squel=require(_0x8e1d('0xc'));var crypto=require(_0x8e1d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8e1d('0xe'));var toCsv=require(_0x8e1d('0x8'));var querystring=require(_0x8e1d('0xf'));var Papa=require(_0x8e1d('0x10'));var Redis=require(_0x8e1d('0x11'));var authService=require(_0x8e1d('0x12'));var qs=require(_0x8e1d('0x13'));var as=require(_0x8e1d('0x14'));var hardwareService=require(_0x8e1d('0x15'));var logger=require(_0x8e1d('0x16'))(_0x8e1d('0x17'));var utils=require(_0x8e1d('0x18'));var config=require(_0x8e1d('0x19'));var licenseUtil=require(_0x8e1d('0x1a'));var db=require(_0x8e1d('0x1b'))['db'];function respondWithStatusCode(_0x490766,_0x3f8614){_0x3f8614=_0x3f8614||0xcc;return function(_0x4a03c6){if(_0x4a03c6){return _0x490766[_0x8e1d('0x1c')](_0x3f8614);}return _0x490766[_0x8e1d('0x1d')](_0x3f8614)['end']();};}function respondWithResult(_0x408895,_0x1ab3d5){_0x1ab3d5=_0x1ab3d5||0xc8;return function(_0x196f5b){if(_0x196f5b){return _0x408895[_0x8e1d('0x1d')](_0x1ab3d5)[_0x8e1d('0x1e')](_0x196f5b);}};}function respondWithFilteredResult(_0x2a336f,_0x3b68ba){return function(_0x2f01f2){if(_0x2f01f2){var _0x275ea8=typeof _0x3b68ba['offset']==='undefined'&&typeof _0x3b68ba[_0x8e1d('0x1f')]==='undefined';var _0x451271=_0x2f01f2[_0x8e1d('0x20')];var _0x43eba9=_0x275ea8?0x0:_0x3b68ba[_0x8e1d('0x21')];var _0x2597b5=_0x275ea8?_0x2f01f2[_0x8e1d('0x20')]:_0x3b68ba[_0x8e1d('0x21')]+_0x3b68ba[_0x8e1d('0x1f')];var _0x5bee93;if(_0x2597b5>=_0x451271){_0x2597b5=_0x451271;_0x5bee93=0xc8;}else{_0x5bee93=0xce;}_0x2a336f['status'](_0x5bee93);return _0x2a336f[_0x8e1d('0x22')](_0x8e1d('0x23'),_0x43eba9+'-'+_0x2597b5+'/'+_0x451271)[_0x8e1d('0x1e')](_0x2f01f2);}return null;};}function patchUpdates(_0x1d2ce2){return function(_0x430ec5){try{jsonpatch[_0x8e1d('0x24')](_0x430ec5,_0x1d2ce2,!![]);}catch(_0x2e68c6){return BPromise[_0x8e1d('0x25')](_0x2e68c6);}return _0x430ec5[_0x8e1d('0x26')]();};}function saveUpdates(_0x544c35,_0x524806){return function(_0x9d0166){if(_0x9d0166){return _0x9d0166['update'](_0x544c35)[_0x8e1d('0x27')](function(_0xfd377c){return _0xfd377c;});}return null;};}function removeEntity(_0x3cab0a,_0x46dfdf){return function(_0x569d19){if(_0x569d19){return _0x569d19[_0x8e1d('0x28')]()[_0x8e1d('0x27')](function(){_0x3cab0a[_0x8e1d('0x1d')](0xcc)[_0x8e1d('0x29')]();});}};}function handleEntityNotFound(_0x65c398,_0x2cc84e){return function(_0x3cbc75){if(!_0x3cbc75){_0x65c398[_0x8e1d('0x1c')](0x194);}return _0x3cbc75;};}function handleError(_0x375856,_0x9dc9d3){_0x9dc9d3=_0x9dc9d3||0x1f4;return function(_0x2cd73c){logger['error'](_0x2cd73c['stack']);if(_0x2cd73c['name']){delete _0x2cd73c[_0x8e1d('0x2a')];}_0x375856[_0x8e1d('0x1d')](_0x9dc9d3)[_0x8e1d('0x2b')](_0x2cd73c);};}exports['index']=function(_0x1ed794,_0xd674b){var _0x1ff0cb={},_0x1bbcff={},_0x208040={'count':0x0,'rows':[]};var _0x501fe8=_[_0x8e1d('0x2c')](db[_0x8e1d('0x2d')][_0x8e1d('0x2e')],function(_0x1c245e){return{'name':_0x1c245e[_0x8e1d('0x2f')],'type':_0x1c245e[_0x8e1d('0x30')][_0x8e1d('0x31')]};});_0x1bbcff['model']=_[_0x8e1d('0x2c')](_0x501fe8,_0x8e1d('0x2a'));_0x1bbcff[_0x8e1d('0x32')]=_['keys'](_0x1ed794[_0x8e1d('0x32')]);_0x1bbcff[_0x8e1d('0x33')]=_['intersection'](_0x1bbcff[_0x8e1d('0x34')],_0x1bbcff['query']);_0x1ff0cb['attributes']=_[_0x8e1d('0x35')](_0x1bbcff[_0x8e1d('0x34')],qs['fields'](_0x1ed794[_0x8e1d('0x32')]['fields']));_0x1ff0cb[_0x8e1d('0x36')]=_0x1ff0cb[_0x8e1d('0x36')][_0x8e1d('0x37')]?_0x1ff0cb[_0x8e1d('0x36')]:_0x1bbcff[_0x8e1d('0x34')];if(!_0x1ed794['query']['hasOwnProperty'](_0x8e1d('0x38'))){_0x1ff0cb[_0x8e1d('0x1f')]=qs[_0x8e1d('0x1f')](_0x1ed794[_0x8e1d('0x32')]['limit']);_0x1ff0cb[_0x8e1d('0x21')]=qs[_0x8e1d('0x21')](_0x1ed794[_0x8e1d('0x32')][_0x8e1d('0x21')]);}_0x1ff0cb[_0x8e1d('0x39')]=qs[_0x8e1d('0x3a')](_0x1ed794[_0x8e1d('0x32')]['sort']);_0x1ff0cb[_0x8e1d('0x3b')]=qs[_0x8e1d('0x33')](_[_0x8e1d('0x3c')](_0x1ed794[_0x8e1d('0x32')],_0x1bbcff['filters']),_0x501fe8);if(_0x1ed794['query'][_0x8e1d('0x3d')]){_0x1ff0cb['where']=_[_0x8e1d('0x3e')](_0x1ff0cb[_0x8e1d('0x3b')],{'$or':_[_0x8e1d('0x2c')](_0x501fe8,function(_0x439026){if(_0x439026[_0x8e1d('0x30')]!==_0x8e1d('0x3f')){var _0x3bb48f={};_0x3bb48f[_0x439026[_0x8e1d('0x2a')]]={'$like':'%'+_0x1ed794[_0x8e1d('0x32')]['filter']+'%'};return _0x3bb48f;}})});}_0x1ff0cb=_[_0x8e1d('0x3e')]({},_0x1ff0cb,_0x1ed794[_0x8e1d('0x40')]);var _0x40bbb5={'where':_0x1ff0cb[_0x8e1d('0x3b')]};return db[_0x8e1d('0x2d')]['count'](_0x40bbb5)['then'](function(_0x204efe){_0x208040[_0x8e1d('0x20')]=_0x204efe;if(_0x1ed794[_0x8e1d('0x32')]['includeAll']){_0x1ff0cb['include']=[{'all':!![]}];}return db[_0x8e1d('0x2d')][_0x8e1d('0x41')](_0x1ff0cb);})['then'](function(_0x2cc746){_0x208040[_0x8e1d('0x42')]=_0x2cc746;return _0x208040;})[_0x8e1d('0x27')](respondWithFilteredResult(_0xd674b,_0x1ff0cb))[_0x8e1d('0x43')](handleError(_0xd674b,null));};exports[_0x8e1d('0x44')]=function(_0x558c07,_0x4071f4){var _0x176a83={'raw':![],'where':{'id':_0x558c07[_0x8e1d('0x45')]['id']}},_0x1db130={};_0x1db130[_0x8e1d('0x34')]=_[_0x8e1d('0x46')](db[_0x8e1d('0x2d')][_0x8e1d('0x2e')]);_0x1db130['query']=_[_0x8e1d('0x46')](_0x558c07[_0x8e1d('0x32')]);_0x1db130[_0x8e1d('0x33')]=_[_0x8e1d('0x35')](_0x1db130[_0x8e1d('0x34')],_0x1db130[_0x8e1d('0x32')]);_0x176a83[_0x8e1d('0x36')]=_[_0x8e1d('0x35')](_0x1db130[_0x8e1d('0x34')],qs[_0x8e1d('0x47')](_0x558c07[_0x8e1d('0x32')][_0x8e1d('0x47')]));_0x176a83[_0x8e1d('0x36')]=_0x176a83[_0x8e1d('0x36')]['length']?_0x176a83['attributes']:_0x1db130[_0x8e1d('0x34')];if(_0x558c07[_0x8e1d('0x32')]['includeAll']){_0x176a83[_0x8e1d('0x48')]=[{'all':!![]}];}_0x176a83=_['merge']({},_0x176a83,_0x558c07[_0x8e1d('0x40')]);return db['SugarcrmConfiguration'][_0x8e1d('0x49')](_0x176a83)[_0x8e1d('0x27')](handleEntityNotFound(_0x4071f4,null))[_0x8e1d('0x27')](respondWithResult(_0x4071f4,null))[_0x8e1d('0x43')](handleError(_0x4071f4,null));};exports[_0x8e1d('0x4a')]=function(_0x4fc0e1,_0x1c07ca){return db[_0x8e1d('0x2d')]['create'](_0x4fc0e1[_0x8e1d('0x4b')],{})[_0x8e1d('0x27')](respondWithResult(_0x1c07ca,0xc9))[_0x8e1d('0x43')](handleError(_0x1c07ca,null));};exports['update']=function(_0x531ae8,_0x515949){if(_0x531ae8[_0x8e1d('0x4b')]['id']){delete _0x531ae8[_0x8e1d('0x4b')]['id'];}return db[_0x8e1d('0x2d')][_0x8e1d('0x49')]({'where':{'id':_0x531ae8[_0x8e1d('0x45')]['id']}})[_0x8e1d('0x27')](handleEntityNotFound(_0x515949,null))['then'](saveUpdates(_0x531ae8[_0x8e1d('0x4b')],null))[_0x8e1d('0x27')](respondWithResult(_0x515949,null))[_0x8e1d('0x43')](handleError(_0x515949,null));};exports['destroy']=function(_0x4d9bcb,_0x45a2f9){return db[_0x8e1d('0x2d')][_0x8e1d('0x49')]({'where':{'id':_0x4d9bcb[_0x8e1d('0x45')]['id']}})['then'](handleEntityNotFound(_0x45a2f9,null))[_0x8e1d('0x27')](removeEntity(_0x45a2f9,null))[_0x8e1d('0x43')](handleError(_0x45a2f9,null));};exports[_0x8e1d('0x4c')]=function(_0x2ead6b,_0x558d8c,_0x26f0ee){var _0x491ac8={};var _0x3108b6={};var _0x2b9abc;var _0x3e9ddd;return db[_0x8e1d('0x2d')][_0x8e1d('0x4d')]({'where':{'id':_0x2ead6b[_0x8e1d('0x45')]['id']}})[_0x8e1d('0x27')](handleEntityNotFound(_0x558d8c,null))[_0x8e1d('0x27')](function(_0x1bb9a2){if(_0x1bb9a2){_0x2b9abc=_0x1bb9a2;_0x3108b6[_0x8e1d('0x34')]=_[_0x8e1d('0x46')](db[_0x8e1d('0x4e')][_0x8e1d('0x2e')]);_0x3108b6[_0x8e1d('0x32')]=_[_0x8e1d('0x46')](_0x2ead6b['query']);_0x3108b6['filters']=_[_0x8e1d('0x35')](_0x3108b6['model'],_0x3108b6[_0x8e1d('0x32')]);_0x491ac8[_0x8e1d('0x36')]=_[_0x8e1d('0x35')](_0x3108b6[_0x8e1d('0x34')],qs[_0x8e1d('0x47')](_0x2ead6b[_0x8e1d('0x32')][_0x8e1d('0x47')]));_0x491ac8[_0x8e1d('0x36')]=_0x491ac8[_0x8e1d('0x36')][_0x8e1d('0x37')]?_0x491ac8[_0x8e1d('0x36')]:_0x3108b6['model'];_0x491ac8[_0x8e1d('0x39')]=qs[_0x8e1d('0x3a')](_0x2ead6b[_0x8e1d('0x32')][_0x8e1d('0x3a')]);_0x491ac8['where']=qs[_0x8e1d('0x33')](_[_0x8e1d('0x3c')](_0x2ead6b['query'],_0x3108b6[_0x8e1d('0x33')]));if(_0x2ead6b[_0x8e1d('0x32')][_0x8e1d('0x3d')]){_0x491ac8[_0x8e1d('0x3b')]=_[_0x8e1d('0x3e')](_0x491ac8[_0x8e1d('0x3b')],{'$or':_[_0x8e1d('0x2c')](_0x491ac8[_0x8e1d('0x36')],function(_0x2000c5){var _0x4c9aec={};_0x4c9aec[_0x2000c5]={'$like':'%'+_0x2ead6b[_0x8e1d('0x32')][_0x8e1d('0x3d')]+'%'};return _0x4c9aec;})});}_0x491ac8=_['merge']({},_0x491ac8,_0x2ead6b['options']);return _0x2b9abc[_0x8e1d('0x4c')](_0x491ac8);}})[_0x8e1d('0x27')](function(_0x2cbc04){if(_0x2cbc04){_0x3e9ddd=_0x2cbc04[_0x8e1d('0x37')];if(!_0x2ead6b[_0x8e1d('0x32')][_0x8e1d('0x4f')](_0x8e1d('0x38'))){_0x491ac8[_0x8e1d('0x1f')]=qs[_0x8e1d('0x1f')](_0x2ead6b[_0x8e1d('0x32')]['limit']);_0x491ac8[_0x8e1d('0x21')]=qs[_0x8e1d('0x21')](_0x2ead6b[_0x8e1d('0x32')]['offset']);}return _0x2b9abc[_0x8e1d('0x4c')](_0x491ac8);}})[_0x8e1d('0x27')](function(_0x475b50){if(_0x475b50){return _0x475b50?{'count':_0x3e9ddd,'rows':_0x475b50}:null;}})[_0x8e1d('0x27')](respondWithResult(_0x558d8c,null))[_0x8e1d('0x43')](handleError(_0x558d8c,null));};exports['getSubjects']=function(_0x56e61a,_0x45839e,_0x3e9841){var _0x1fba99={};var _0x43833e={};var _0x2d3b51;var _0x482532;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x56e61a[_0x8e1d('0x45')]['id']}})['then'](handleEntityNotFound(_0x45839e,null))[_0x8e1d('0x27')](function(_0x3a3ad6){if(_0x3a3ad6){_0x2d3b51=_0x3a3ad6;_0x43833e[_0x8e1d('0x34')]=_[_0x8e1d('0x46')](db['SugarcrmField']['rawAttributes']);_0x43833e['query']=_[_0x8e1d('0x46')](_0x56e61a[_0x8e1d('0x32')]);_0x43833e['filters']=_['intersection'](_0x43833e[_0x8e1d('0x34')],_0x43833e[_0x8e1d('0x32')]);_0x1fba99[_0x8e1d('0x36')]=_[_0x8e1d('0x35')](_0x43833e['model'],qs[_0x8e1d('0x47')](_0x56e61a[_0x8e1d('0x32')][_0x8e1d('0x47')]));_0x1fba99['attributes']=_0x1fba99[_0x8e1d('0x36')]['length']?_0x1fba99[_0x8e1d('0x36')]:_0x43833e['model'];_0x1fba99[_0x8e1d('0x39')]=qs[_0x8e1d('0x3a')](_0x56e61a[_0x8e1d('0x32')]['sort']);_0x1fba99['where']=qs['filters'](_['pick'](_0x56e61a['query'],_0x43833e[_0x8e1d('0x33')]));if(_0x56e61a[_0x8e1d('0x32')][_0x8e1d('0x3d')]){_0x1fba99[_0x8e1d('0x3b')]=_['merge'](_0x1fba99['where'],{'$or':_[_0x8e1d('0x2c')](_0x1fba99[_0x8e1d('0x36')],function(_0x221a90){var _0x5e1503={};_0x5e1503[_0x221a90]={'$like':'%'+_0x56e61a['query'][_0x8e1d('0x3d')]+'%'};return _0x5e1503;})});}_0x1fba99=_['merge']({},_0x1fba99,_0x56e61a[_0x8e1d('0x40')]);return _0x2d3b51[_0x8e1d('0x50')](_0x1fba99);}})[_0x8e1d('0x27')](function(_0x722e1f){if(_0x722e1f){_0x482532=_0x722e1f[_0x8e1d('0x37')];if(!_0x56e61a['query'][_0x8e1d('0x4f')]('nolimit')){_0x1fba99[_0x8e1d('0x1f')]=qs[_0x8e1d('0x1f')](_0x56e61a[_0x8e1d('0x32')][_0x8e1d('0x1f')]);_0x1fba99['offset']=qs[_0x8e1d('0x21')](_0x56e61a[_0x8e1d('0x32')][_0x8e1d('0x21')]);}return _0x2d3b51[_0x8e1d('0x50')](_0x1fba99);}})['then'](function(_0x299dab){if(_0x299dab){return _0x299dab?{'count':_0x482532,'rows':_0x299dab}:null;}})[_0x8e1d('0x27')](respondWithResult(_0x45839e,null))['catch'](handleError(_0x45839e,null));};exports[_0x8e1d('0x51')]=function(_0x164a40,_0x4f1be7,_0x32a2e4){var _0x2fbe68={};var _0x1ce92a={};var _0x36e62a;var _0x45b0a2;return db[_0x8e1d('0x2d')]['findOne']({'where':{'id':_0x164a40[_0x8e1d('0x45')]['id']}})[_0x8e1d('0x27')](handleEntityNotFound(_0x4f1be7,null))['then'](function(_0xc84a){if(_0xc84a){_0x36e62a=_0xc84a;_0x1ce92a['model']=_[_0x8e1d('0x46')](db[_0x8e1d('0x4e')][_0x8e1d('0x2e')]);_0x1ce92a[_0x8e1d('0x32')]=_['keys'](_0x164a40[_0x8e1d('0x32')]);_0x1ce92a[_0x8e1d('0x33')]=_[_0x8e1d('0x35')](_0x1ce92a[_0x8e1d('0x34')],_0x1ce92a[_0x8e1d('0x32')]);_0x2fbe68['attributes']=_[_0x8e1d('0x35')](_0x1ce92a[_0x8e1d('0x34')],qs['fields'](_0x164a40[_0x8e1d('0x32')]['fields']));_0x2fbe68[_0x8e1d('0x36')]=_0x2fbe68[_0x8e1d('0x36')][_0x8e1d('0x37')]?_0x2fbe68[_0x8e1d('0x36')]:_0x1ce92a[_0x8e1d('0x34')];_0x2fbe68[_0x8e1d('0x39')]=qs['sort'](_0x164a40[_0x8e1d('0x32')][_0x8e1d('0x3a')]);_0x2fbe68[_0x8e1d('0x3b')]=qs[_0x8e1d('0x33')](_[_0x8e1d('0x3c')](_0x164a40['query'],_0x1ce92a['filters']));if(_0x164a40[_0x8e1d('0x32')][_0x8e1d('0x3d')]){_0x2fbe68[_0x8e1d('0x3b')]=_['merge'](_0x2fbe68['where'],{'$or':_['map'](_0x2fbe68[_0x8e1d('0x36')],function(_0x42458e){var _0x2d6dc6={};_0x2d6dc6[_0x42458e]={'$like':'%'+_0x164a40['query'][_0x8e1d('0x3d')]+'%'};return _0x2d6dc6;})});}_0x2fbe68=_[_0x8e1d('0x3e')]({},_0x2fbe68,_0x164a40[_0x8e1d('0x40')]);return _0x36e62a[_0x8e1d('0x51')](_0x2fbe68);}})[_0x8e1d('0x27')](function(_0x2f9a13){if(_0x2f9a13){_0x45b0a2=_0x2f9a13['length'];if(!_0x164a40[_0x8e1d('0x32')][_0x8e1d('0x4f')](_0x8e1d('0x38'))){_0x2fbe68[_0x8e1d('0x1f')]=qs[_0x8e1d('0x1f')](_0x164a40[_0x8e1d('0x32')]['limit']);_0x2fbe68[_0x8e1d('0x21')]=qs['offset'](_0x164a40[_0x8e1d('0x32')]['offset']);}return _0x36e62a[_0x8e1d('0x51')](_0x2fbe68);}})[_0x8e1d('0x27')](function(_0x578d92){if(_0x578d92){return _0x578d92?{'count':_0x45b0a2,'rows':_0x578d92}:null;}})[_0x8e1d('0x27')](respondWithResult(_0x4f1be7,null))[_0x8e1d('0x43')](handleError(_0x4f1be7,null));}; \ No newline at end of file +var _0x3ded=['../../components/auth/service','../../components/parsers/advancedSearch','api','status','end','json','offset','undefined','limit','count','apply','reject','save','then','error','stack','rawAttributes','fieldName','type','key','model','name','query','filters','attributes','fields','length','nolimit','order','sort','where','filter','merge','map','options','SugarcrmConfiguration','includeAll','include','findAll','catch','show','params','keys','intersection','find','create','body','update','destroy','getFields','findOne','SugarcrmField','pick','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse'];(function(_0x2f3c6f,_0x4e7956){var _0x50e217=function(_0x5ecb51){while(--_0x5ecb51){_0x2f3c6f['push'](_0x2f3c6f['shift']());}};_0x50e217(++_0x4e7956);}(_0x3ded,0x113));var _0xd3de=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x3ded[_0x1cfa0d];return _0xe33279;};'use strict';var emlformat=require(_0xd3de('0x0'));var rimraf=require(_0xd3de('0x1'));var zipdir=require(_0xd3de('0x2'));var jsonpatch=require(_0xd3de('0x3'));var rp=require('request-promise');var moment=require(_0xd3de('0x4'));var BPromise=require(_0xd3de('0x5'));var Mustache=require(_0xd3de('0x6'));var util=require(_0xd3de('0x7'));var path=require('path');var sox=require(_0xd3de('0x8'));var csv=require('to-csv');var ejs=require(_0xd3de('0x9'));var fs=require('fs');var fs_extra=require(_0xd3de('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd3de('0xb'));var jsforce=require(_0xd3de('0xc'));var deskjs=require(_0xd3de('0xd'));var toCsv=require(_0xd3de('0xe'));var querystring=require(_0xd3de('0xf'));var Papa=require(_0xd3de('0x10'));var Redis=require('ioredis');var authService=require(_0xd3de('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd3de('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd3de('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e0b03,_0x34b42a){_0x34b42a=_0x34b42a||0xcc;return function(_0x22cefc){if(_0x22cefc){return _0x1e0b03['sendStatus'](_0x34b42a);}return _0x1e0b03[_0xd3de('0x14')](_0x34b42a)[_0xd3de('0x15')]();};}function respondWithResult(_0x265e6a,_0x14099c){_0x14099c=_0x14099c||0xc8;return function(_0x1a4b02){if(_0x1a4b02){return _0x265e6a['status'](_0x14099c)[_0xd3de('0x16')](_0x1a4b02);}};}function respondWithFilteredResult(_0x2c0c24,_0x17d193){return function(_0x2f557e){if(_0x2f557e){var _0xaa4a8=typeof _0x17d193[_0xd3de('0x17')]===_0xd3de('0x18')&&typeof _0x17d193[_0xd3de('0x19')]===_0xd3de('0x18');var _0x3c4341=_0x2f557e['count'];var _0x179b93=_0xaa4a8?0x0:_0x17d193[_0xd3de('0x17')];var _0x45e9eb=_0xaa4a8?_0x2f557e[_0xd3de('0x1a')]:_0x17d193['offset']+_0x17d193[_0xd3de('0x19')];var _0x425668;if(_0x45e9eb>=_0x3c4341){_0x45e9eb=_0x3c4341;_0x425668=0xc8;}else{_0x425668=0xce;}_0x2c0c24[_0xd3de('0x14')](_0x425668);return _0x2c0c24['set']('Content-Range',_0x179b93+'-'+_0x45e9eb+'/'+_0x3c4341)[_0xd3de('0x16')](_0x2f557e);}return null;};}function patchUpdates(_0x5a8e10){return function(_0x8a94ce){try{jsonpatch[_0xd3de('0x1b')](_0x8a94ce,_0x5a8e10,!![]);}catch(_0x3c2a74){return BPromise[_0xd3de('0x1c')](_0x3c2a74);}return _0x8a94ce[_0xd3de('0x1d')]();};}function saveUpdates(_0x48a82f,_0x276956){return function(_0x3f0dc6){if(_0x3f0dc6){return _0x3f0dc6['update'](_0x48a82f)[_0xd3de('0x1e')](function(_0x41e9c0){return _0x41e9c0;});}return null;};}function removeEntity(_0x4f3e2a,_0x519458){return function(_0x20c9ea){if(_0x20c9ea){return _0x20c9ea['destroy']()[_0xd3de('0x1e')](function(){_0x4f3e2a[_0xd3de('0x14')](0xcc)[_0xd3de('0x15')]();});}};}function handleEntityNotFound(_0x5a5718,_0x218ca8){return function(_0x12e95a){if(!_0x12e95a){_0x5a5718['sendStatus'](0x194);}return _0x12e95a;};}function handleError(_0x57ea3c,_0xb68e9f){_0xb68e9f=_0xb68e9f||0x1f4;return function(_0x56858c){logger[_0xd3de('0x1f')](_0x56858c[_0xd3de('0x20')]);if(_0x56858c['name']){delete _0x56858c['name'];}_0x57ea3c[_0xd3de('0x14')](_0xb68e9f)['send'](_0x56858c);};}exports['index']=function(_0x13add8,_0x3e6465){var _0x56311f={},_0x3c8d41={},_0x558a13={'count':0x0,'rows':[]};var _0xf194d9=_['map'](db['SugarcrmConfiguration'][_0xd3de('0x21')],function(_0x734e49){return{'name':_0x734e49[_0xd3de('0x22')],'type':_0x734e49[_0xd3de('0x23')][_0xd3de('0x24')]};});_0x3c8d41[_0xd3de('0x25')]=_['map'](_0xf194d9,_0xd3de('0x26'));_0x3c8d41[_0xd3de('0x27')]=_['keys'](_0x13add8[_0xd3de('0x27')]);_0x3c8d41[_0xd3de('0x28')]=_['intersection'](_0x3c8d41[_0xd3de('0x25')],_0x3c8d41[_0xd3de('0x27')]);_0x56311f[_0xd3de('0x29')]=_['intersection'](_0x3c8d41['model'],qs[_0xd3de('0x2a')](_0x13add8['query'][_0xd3de('0x2a')]));_0x56311f['attributes']=_0x56311f[_0xd3de('0x29')][_0xd3de('0x2b')]?_0x56311f[_0xd3de('0x29')]:_0x3c8d41[_0xd3de('0x25')];if(!_0x13add8[_0xd3de('0x27')]['hasOwnProperty'](_0xd3de('0x2c'))){_0x56311f[_0xd3de('0x19')]=qs[_0xd3de('0x19')](_0x13add8['query'][_0xd3de('0x19')]);_0x56311f['offset']=qs['offset'](_0x13add8[_0xd3de('0x27')][_0xd3de('0x17')]);}_0x56311f[_0xd3de('0x2d')]=qs[_0xd3de('0x2e')](_0x13add8['query']['sort']);_0x56311f[_0xd3de('0x2f')]=qs['filters'](_['pick'](_0x13add8[_0xd3de('0x27')],_0x3c8d41[_0xd3de('0x28')]),_0xf194d9);if(_0x13add8[_0xd3de('0x27')][_0xd3de('0x30')]){_0x56311f[_0xd3de('0x2f')]=_[_0xd3de('0x31')](_0x56311f[_0xd3de('0x2f')],{'$or':_[_0xd3de('0x32')](_0xf194d9,function(_0x5dbe6e){if(_0x5dbe6e[_0xd3de('0x23')]!=='VIRTUAL'){var _0x3aa28f={};_0x3aa28f[_0x5dbe6e[_0xd3de('0x26')]]={'$like':'%'+_0x13add8['query']['filter']+'%'};return _0x3aa28f;}})});}_0x56311f=_[_0xd3de('0x31')]({},_0x56311f,_0x13add8[_0xd3de('0x33')]);var _0x145658={'where':_0x56311f[_0xd3de('0x2f')]};return db[_0xd3de('0x34')][_0xd3de('0x1a')](_0x145658)[_0xd3de('0x1e')](function(_0x33afcb){_0x558a13[_0xd3de('0x1a')]=_0x33afcb;if(_0x13add8[_0xd3de('0x27')][_0xd3de('0x35')]){_0x56311f[_0xd3de('0x36')]=[{'all':!![]}];}return db[_0xd3de('0x34')][_0xd3de('0x37')](_0x56311f);})['then'](function(_0x5c0105){_0x558a13['rows']=_0x5c0105;return _0x558a13;})['then'](respondWithFilteredResult(_0x3e6465,_0x56311f))[_0xd3de('0x38')](handleError(_0x3e6465,null));};exports[_0xd3de('0x39')]=function(_0x46ce8e,_0x1188c7){var _0x237c4b={'raw':![],'where':{'id':_0x46ce8e[_0xd3de('0x3a')]['id']}},_0x2c9cac={};_0x2c9cac['model']=_[_0xd3de('0x3b')](db[_0xd3de('0x34')]['rawAttributes']);_0x2c9cac[_0xd3de('0x27')]=_[_0xd3de('0x3b')](_0x46ce8e['query']);_0x2c9cac[_0xd3de('0x28')]=_[_0xd3de('0x3c')](_0x2c9cac['model'],_0x2c9cac[_0xd3de('0x27')]);_0x237c4b[_0xd3de('0x29')]=_[_0xd3de('0x3c')](_0x2c9cac[_0xd3de('0x25')],qs['fields'](_0x46ce8e[_0xd3de('0x27')][_0xd3de('0x2a')]));_0x237c4b[_0xd3de('0x29')]=_0x237c4b[_0xd3de('0x29')]['length']?_0x237c4b['attributes']:_0x2c9cac['model'];if(_0x46ce8e[_0xd3de('0x27')]['includeAll']){_0x237c4b[_0xd3de('0x36')]=[{'all':!![]}];}_0x237c4b=_[_0xd3de('0x31')]({},_0x237c4b,_0x46ce8e[_0xd3de('0x33')]);return db[_0xd3de('0x34')][_0xd3de('0x3d')](_0x237c4b)['then'](handleEntityNotFound(_0x1188c7,null))[_0xd3de('0x1e')](respondWithResult(_0x1188c7,null))[_0xd3de('0x38')](handleError(_0x1188c7,null));};exports[_0xd3de('0x3e')]=function(_0x37db93,_0x450a29){return db[_0xd3de('0x34')][_0xd3de('0x3e')](_0x37db93[_0xd3de('0x3f')],{})[_0xd3de('0x1e')](respondWithResult(_0x450a29,0xc9))[_0xd3de('0x38')](handleError(_0x450a29,null));};exports[_0xd3de('0x40')]=function(_0x2f5c6b,_0x34cd3e){if(_0x2f5c6b[_0xd3de('0x3f')]['id']){delete _0x2f5c6b['body']['id'];}return db['SugarcrmConfiguration'][_0xd3de('0x3d')]({'where':{'id':_0x2f5c6b[_0xd3de('0x3a')]['id']}})[_0xd3de('0x1e')](handleEntityNotFound(_0x34cd3e,null))[_0xd3de('0x1e')](saveUpdates(_0x2f5c6b[_0xd3de('0x3f')],null))[_0xd3de('0x1e')](respondWithResult(_0x34cd3e,null))[_0xd3de('0x38')](handleError(_0x34cd3e,null));};exports[_0xd3de('0x41')]=function(_0x5f560c,_0x4bdbf5){return db[_0xd3de('0x34')][_0xd3de('0x3d')]({'where':{'id':_0x5f560c[_0xd3de('0x3a')]['id']}})['then'](handleEntityNotFound(_0x4bdbf5,null))[_0xd3de('0x1e')](removeEntity(_0x4bdbf5,null))[_0xd3de('0x38')](handleError(_0x4bdbf5,null));};exports[_0xd3de('0x42')]=function(_0x56d41,_0x21a458,_0x51cf81){var _0x5526d8={};var _0x35c66d={};var _0x19728f;var _0x58fee4;return db[_0xd3de('0x34')][_0xd3de('0x43')]({'where':{'id':_0x56d41[_0xd3de('0x3a')]['id']}})[_0xd3de('0x1e')](handleEntityNotFound(_0x21a458,null))[_0xd3de('0x1e')](function(_0x4f7c83){if(_0x4f7c83){_0x19728f=_0x4f7c83;_0x35c66d[_0xd3de('0x25')]=_[_0xd3de('0x3b')](db[_0xd3de('0x44')][_0xd3de('0x21')]);_0x35c66d['query']=_[_0xd3de('0x3b')](_0x56d41[_0xd3de('0x27')]);_0x35c66d['filters']=_[_0xd3de('0x3c')](_0x35c66d[_0xd3de('0x25')],_0x35c66d['query']);_0x5526d8[_0xd3de('0x29')]=_[_0xd3de('0x3c')](_0x35c66d[_0xd3de('0x25')],qs[_0xd3de('0x2a')](_0x56d41['query']['fields']));_0x5526d8[_0xd3de('0x29')]=_0x5526d8['attributes'][_0xd3de('0x2b')]?_0x5526d8[_0xd3de('0x29')]:_0x35c66d[_0xd3de('0x25')];_0x5526d8['order']=qs[_0xd3de('0x2e')](_0x56d41['query'][_0xd3de('0x2e')]);_0x5526d8[_0xd3de('0x2f')]=qs[_0xd3de('0x28')](_[_0xd3de('0x45')](_0x56d41['query'],_0x35c66d[_0xd3de('0x28')]));if(_0x56d41[_0xd3de('0x27')]['filter']){_0x5526d8[_0xd3de('0x2f')]=_[_0xd3de('0x31')](_0x5526d8[_0xd3de('0x2f')],{'$or':_[_0xd3de('0x32')](_0x5526d8[_0xd3de('0x29')],function(_0x3b43e5){var _0x7aff04={};_0x7aff04[_0x3b43e5]={'$like':'%'+_0x56d41['query'][_0xd3de('0x30')]+'%'};return _0x7aff04;})});}_0x5526d8=_[_0xd3de('0x31')]({},_0x5526d8,_0x56d41[_0xd3de('0x33')]);return _0x19728f[_0xd3de('0x42')](_0x5526d8);}})[_0xd3de('0x1e')](function(_0x220817){if(_0x220817){_0x58fee4=_0x220817[_0xd3de('0x2b')];if(!_0x56d41[_0xd3de('0x27')][_0xd3de('0x46')](_0xd3de('0x2c'))){_0x5526d8[_0xd3de('0x19')]=qs[_0xd3de('0x19')](_0x56d41['query'][_0xd3de('0x19')]);_0x5526d8[_0xd3de('0x17')]=qs['offset'](_0x56d41['query'][_0xd3de('0x17')]);}return _0x19728f[_0xd3de('0x42')](_0x5526d8);}})[_0xd3de('0x1e')](function(_0x2ece5b){if(_0x2ece5b){return _0x2ece5b?{'count':_0x58fee4,'rows':_0x2ece5b}:null;}})[_0xd3de('0x1e')](respondWithResult(_0x21a458,null))[_0xd3de('0x38')](handleError(_0x21a458,null));};exports[_0xd3de('0x47')]=function(_0x568ccd,_0xd05051,_0x4b0377){var _0x4c20d4={};var _0x22d24b={};var _0x4b4fa2;var _0xec47eb;return db['SugarcrmConfiguration'][_0xd3de('0x43')]({'where':{'id':_0x568ccd[_0xd3de('0x3a')]['id']}})[_0xd3de('0x1e')](handleEntityNotFound(_0xd05051,null))[_0xd3de('0x1e')](function(_0x22d9d3){if(_0x22d9d3){_0x4b4fa2=_0x22d9d3;_0x22d24b[_0xd3de('0x25')]=_['keys'](db[_0xd3de('0x44')]['rawAttributes']);_0x22d24b[_0xd3de('0x27')]=_[_0xd3de('0x3b')](_0x568ccd[_0xd3de('0x27')]);_0x22d24b[_0xd3de('0x28')]=_[_0xd3de('0x3c')](_0x22d24b[_0xd3de('0x25')],_0x22d24b[_0xd3de('0x27')]);_0x4c20d4[_0xd3de('0x29')]=_['intersection'](_0x22d24b[_0xd3de('0x25')],qs[_0xd3de('0x2a')](_0x568ccd['query'][_0xd3de('0x2a')]));_0x4c20d4['attributes']=_0x4c20d4[_0xd3de('0x29')][_0xd3de('0x2b')]?_0x4c20d4[_0xd3de('0x29')]:_0x22d24b[_0xd3de('0x25')];_0x4c20d4[_0xd3de('0x2d')]=qs['sort'](_0x568ccd[_0xd3de('0x27')][_0xd3de('0x2e')]);_0x4c20d4['where']=qs['filters'](_['pick'](_0x568ccd[_0xd3de('0x27')],_0x22d24b[_0xd3de('0x28')]));if(_0x568ccd[_0xd3de('0x27')][_0xd3de('0x30')]){_0x4c20d4[_0xd3de('0x2f')]=_[_0xd3de('0x31')](_0x4c20d4[_0xd3de('0x2f')],{'$or':_[_0xd3de('0x32')](_0x4c20d4[_0xd3de('0x29')],function(_0x9cffb0){var _0x56a766={};_0x56a766[_0x9cffb0]={'$like':'%'+_0x568ccd['query'][_0xd3de('0x30')]+'%'};return _0x56a766;})});}_0x4c20d4=_['merge']({},_0x4c20d4,_0x568ccd[_0xd3de('0x33')]);return _0x4b4fa2[_0xd3de('0x47')](_0x4c20d4);}})['then'](function(_0x32be00){if(_0x32be00){_0xec47eb=_0x32be00[_0xd3de('0x2b')];if(!_0x568ccd[_0xd3de('0x27')]['hasOwnProperty'](_0xd3de('0x2c'))){_0x4c20d4[_0xd3de('0x19')]=qs[_0xd3de('0x19')](_0x568ccd[_0xd3de('0x27')][_0xd3de('0x19')]);_0x4c20d4[_0xd3de('0x17')]=qs[_0xd3de('0x17')](_0x568ccd[_0xd3de('0x27')][_0xd3de('0x17')]);}return _0x4b4fa2[_0xd3de('0x47')](_0x4c20d4);}})[_0xd3de('0x1e')](function(_0x354ad3){if(_0x354ad3){return _0x354ad3?{'count':_0xec47eb,'rows':_0x354ad3}:null;}})[_0xd3de('0x1e')](respondWithResult(_0xd05051,null))[_0xd3de('0x38')](handleError(_0xd05051,null));};exports['getDescriptions']=function(_0xaa5bd,_0x562585,_0x33fd44){var _0x1b7ebc={};var _0x9645a0={};var _0x21c5e9;var _0x48d81f;return db['SugarcrmConfiguration'][_0xd3de('0x43')]({'where':{'id':_0xaa5bd['params']['id']}})[_0xd3de('0x1e')](handleEntityNotFound(_0x562585,null))['then'](function(_0x2a5f8d){if(_0x2a5f8d){_0x21c5e9=_0x2a5f8d;_0x9645a0[_0xd3de('0x25')]=_['keys'](db[_0xd3de('0x44')][_0xd3de('0x21')]);_0x9645a0[_0xd3de('0x27')]=_['keys'](_0xaa5bd['query']);_0x9645a0[_0xd3de('0x28')]=_[_0xd3de('0x3c')](_0x9645a0[_0xd3de('0x25')],_0x9645a0[_0xd3de('0x27')]);_0x1b7ebc[_0xd3de('0x29')]=_['intersection'](_0x9645a0[_0xd3de('0x25')],qs[_0xd3de('0x2a')](_0xaa5bd['query'][_0xd3de('0x2a')]));_0x1b7ebc[_0xd3de('0x29')]=_0x1b7ebc[_0xd3de('0x29')]['length']?_0x1b7ebc[_0xd3de('0x29')]:_0x9645a0[_0xd3de('0x25')];_0x1b7ebc[_0xd3de('0x2d')]=qs[_0xd3de('0x2e')](_0xaa5bd[_0xd3de('0x27')][_0xd3de('0x2e')]);_0x1b7ebc[_0xd3de('0x2f')]=qs[_0xd3de('0x28')](_[_0xd3de('0x45')](_0xaa5bd[_0xd3de('0x27')],_0x9645a0[_0xd3de('0x28')]));if(_0xaa5bd['query'][_0xd3de('0x30')]){_0x1b7ebc[_0xd3de('0x2f')]=_[_0xd3de('0x31')](_0x1b7ebc[_0xd3de('0x2f')],{'$or':_[_0xd3de('0x32')](_0x1b7ebc['attributes'],function(_0x17e2a8){var _0x49c36e={};_0x49c36e[_0x17e2a8]={'$like':'%'+_0xaa5bd[_0xd3de('0x27')][_0xd3de('0x30')]+'%'};return _0x49c36e;})});}_0x1b7ebc=_[_0xd3de('0x31')]({},_0x1b7ebc,_0xaa5bd[_0xd3de('0x33')]);return _0x21c5e9[_0xd3de('0x48')](_0x1b7ebc);}})[_0xd3de('0x1e')](function(_0x42413f){if(_0x42413f){_0x48d81f=_0x42413f[_0xd3de('0x2b')];if(!_0xaa5bd[_0xd3de('0x27')][_0xd3de('0x46')](_0xd3de('0x2c'))){_0x1b7ebc[_0xd3de('0x19')]=qs[_0xd3de('0x19')](_0xaa5bd[_0xd3de('0x27')][_0xd3de('0x19')]);_0x1b7ebc[_0xd3de('0x17')]=qs[_0xd3de('0x17')](_0xaa5bd['query'][_0xd3de('0x17')]);}return _0x21c5e9['getDescriptions'](_0x1b7ebc);}})[_0xd3de('0x1e')](function(_0x3de560){if(_0x3de560){return _0x3de560?{'count':_0x48d81f,'rows':_0x3de560}:null;}})[_0xd3de('0x1e')](respondWithResult(_0x562585,null))[_0xd3de('0x38')](handleError(_0x562585,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 2b12d33..9acfb1d 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 _0x3a4f=['util','moment','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash'];(function(_0x24b04e,_0x167740){var _0x1fe2ae=function(_0x1d57b4){while(--_0x1d57b4){_0x24b04e['push'](_0x24b04e['shift']());}};_0x1fe2ae(++_0x167740);}(_0x3a4f,0x107));var _0xf3a4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3a4f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf3a4('0x0'));var util=require(_0xf3a4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf3a4('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf3a4('0x3'));var rimraf=require(_0xf3a4('0x4'));var config=require(_0xf3a4('0x5'));var attributes=require(_0xf3a4('0x6'));module[_0xf3a4('0x7')]=function(_0x5147df,_0x15ed12){return _0x5147df[_0xf3a4('0x8')](_0xf3a4('0x9'),attributes,{'tableName':_0xf3a4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x54cc=['lodash','util','api','moment','request-promise','rimraf','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration'];(function(_0x1329e5,_0x13f0e7){var _0xdcfa40=function(_0x4d06c4){while(--_0x4d06c4){_0x1329e5['push'](_0x1329e5['shift']());}};_0xdcfa40(++_0x13f0e7);}(_0x54cc,0x1ef));var _0xc54c=function(_0x19e961,_0x48c161){_0x19e961=_0x19e961-0x0;var _0x556df3=_0x54cc[_0x19e961];return _0x556df3;};'use strict';var _=require(_0xc54c('0x0'));var util=require(_0xc54c('0x1'));var logger=require('../../config/logger')(_0xc54c('0x2'));var moment=require(_0xc54c('0x3'));var BPromise=require('bluebird');var rp=require(_0xc54c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc54c('0x5'));var config=require('../../config/environment');var attributes=require(_0xc54c('0x6'));module[_0xc54c('0x7')]=function(_0x1bf4ef,_0x1e795d){return _0x1bf4ef['define'](_0xc54c('0x8'),attributes,{'tableName':'int_sugarcrm_configurations','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 798d5b0..0f487dd 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 _0x7506=['SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x7506,0xc2));var _0x6750=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x7506[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x6750('0x0'));var util=require(_0x6750('0x1'));var moment=require('moment');var BPromise=require(_0x6750('0x2'));var rs=require(_0x6750('0x3'));var fs=require('fs');var Redis=require(_0x6750('0x4'));var db=require(_0x6750('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6750('0x6'))(_0x6750('0x7'));var config=require(_0x6750('0x8'));var jayson=require(_0x6750('0x9'));var client=jayson[_0x6750('0xa')][_0x6750('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4740b2,_0x1db728,_0x161ddc){return new BPromise(function(_0x223fbc,_0x484e68){return client['request'](_0x4740b2,_0x161ddc)[_0x6750('0xc')](function(_0x453983){logger['info'](_0x6750('0xd'),_0x1db728,_0x6750('0xe'));logger[_0x6750('0xf')](_0x6750('0x10'),_0x1db728,_0x6750('0xe'),JSON[_0x6750('0x11')](_0x453983));if(_0x453983['error']){if(_0x453983[_0x6750('0x12')][_0x6750('0x13')]===0x1f4){logger[_0x6750('0x12')](_0x6750('0xd'),_0x1db728,_0x453983['error'][_0x6750('0x14')]);return _0x484e68(_0x453983[_0x6750('0x12')][_0x6750('0x14')]);}logger[_0x6750('0x12')](_0x6750('0xd'),_0x1db728,_0x453983['error'][_0x6750('0x14')]);return _0x223fbc(_0x453983[_0x6750('0x12')]['message']);}else{logger[_0x6750('0x15')](_0x6750('0xd'),_0x1db728,_0x6750('0xe'));_0x223fbc(_0x453983[_0x6750('0x16')]['message']);}})['catch'](function(_0x1c3047){logger[_0x6750('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1db728,_0x1c3047);_0x484e68(_0x1c3047);});});} \ No newline at end of file +var _0x6178=['../../config/logger','rpc','jayson/promise','request','then','info','request\x20sent','debug','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0xb94089,_0x47608e){var _0x303a65=function(_0x2e9dbf){while(--_0x2e9dbf){_0xb94089['push'](_0xb94089['shift']());}};_0x303a65(++_0x47608e);}(_0x6178,0xa1));var _0x8617=function(_0x12171a,_0x3ace15){_0x12171a=_0x12171a-0x0;var _0x5a3f25=_0x6178[_0x12171a];return _0x5a3f25;};'use strict';var _=require(_0x8617('0x0'));var util=require(_0x8617('0x1'));var moment=require(_0x8617('0x2'));var BPromise=require(_0x8617('0x3'));var rs=require(_0x8617('0x4'));var fs=require('fs');var Redis=require(_0x8617('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8617('0x6'));var logger=require(_0x8617('0x7'))(_0x8617('0x8'));var config=require('../../config/environment');var jayson=require(_0x8617('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x220232,_0x3dfb2d,_0x5b69ba){return new BPromise(function(_0x3011cf,_0x33fd0d){return client[_0x8617('0xa')](_0x220232,_0x5b69ba)[_0x8617('0xb')](function(_0x4c99e7){logger[_0x8617('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x3dfb2d,_0x8617('0xd'));logger[_0x8617('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x3dfb2d,_0x8617('0xd'),JSON['stringify'](_0x4c99e7));if(_0x4c99e7[_0x8617('0xf')]){if(_0x4c99e7[_0x8617('0xf')][_0x8617('0x10')]===0x1f4){logger[_0x8617('0xf')](_0x8617('0x11'),_0x3dfb2d,_0x4c99e7[_0x8617('0xf')][_0x8617('0x12')]);return _0x33fd0d(_0x4c99e7[_0x8617('0xf')][_0x8617('0x12')]);}logger[_0x8617('0xf')](_0x8617('0x11'),_0x3dfb2d,_0x4c99e7['error'][_0x8617('0x12')]);return _0x3011cf(_0x4c99e7[_0x8617('0xf')][_0x8617('0x12')]);}else{logger[_0x8617('0xc')](_0x8617('0x11'),_0x3dfb2d,_0x8617('0xd'));_0x3011cf(_0x4c99e7[_0x8617('0x13')]['message']);}})[_0x8617('0x14')](function(_0x2db3b6){logger[_0x8617('0xf')](_0x8617('0x11'),_0x3dfb2d,_0x2db3b6);_0x33fd0d(_0x2db3b6);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 3f79aa8..2513b3b 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 _0xb2e1=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','/:id','isAuthenticated','create','update','delete','multer','util','path','connect-timeout','express','Router'];(function(_0x28e8b6,_0x1f97ea){var _0x2221da=function(_0x60ff6){while(--_0x60ff6){_0x28e8b6['push'](_0x28e8b6['shift']());}};_0x2221da(++_0x1f97ea);}(_0xb2e1,0x82));var _0x1b2e=function(_0x1b2763,_0x49e0b5){_0x1b2763=_0x1b2763-0x0;var _0x5a02a5=_0xb2e1[_0x1b2763];return _0x5a02a5;};'use strict';var multer=require(_0x1b2e('0x0'));var util=require(_0x1b2e('0x1'));var path=require(_0x1b2e('0x2'));var timeout=require(_0x1b2e('0x3'));var express=require(_0x1b2e('0x4'));var router=express[_0x1b2e('0x5')]();var fs_extra=require(_0x1b2e('0x6'));var auth=require(_0x1b2e('0x7'));var interaction=require(_0x1b2e('0x8'));var config=require(_0x1b2e('0x9'));var controller=require(_0x1b2e('0xa'));router[_0x1b2e('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1b2e('0xb')](_0x1b2e('0xc'),auth[_0x1b2e('0xd')](),controller['show']);router['post']('/',auth[_0x1b2e('0xd')](),controller[_0x1b2e('0xe')]);router['put']('/:id',auth[_0x1b2e('0xd')](),controller[_0x1b2e('0xf')]);router[_0x1b2e('0x10')](_0x1b2e('0xc'),auth[_0x1b2e('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x712d=['get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller'];(function(_0x3fd4b3,_0x17d3ef){var _0x2979a3=function(_0x4fa13c){while(--_0x4fa13c){_0x3fd4b3['push'](_0x3fd4b3['shift']());}};_0x2979a3(++_0x17d3ef);}(_0x712d,0x123));var _0xd712=function(_0x1aed89,_0x379525){_0x1aed89=_0x1aed89-0x0;var _0x42ce23=_0x712d[_0x1aed89];return _0x42ce23;};'use strict';var multer=require('multer');var util=require(_0xd712('0x0'));var path=require('path');var timeout=require(_0xd712('0x1'));var express=require(_0xd712('0x2'));var router=express[_0xd712('0x3')]();var fs_extra=require(_0xd712('0x4'));var auth=require(_0xd712('0x5'));var interaction=require(_0xd712('0x6'));var config=require(_0xd712('0x7'));var controller=require(_0xd712('0x8'));router[_0xd712('0x9')]('/',auth[_0xd712('0xa')](),controller['index']);router[_0xd712('0x9')]('/:id',auth[_0xd712('0xa')](),controller[_0xd712('0xb')]);router[_0xd712('0xc')]('/',auth[_0xd712('0xa')](),controller[_0xd712('0xd')]);router[_0xd712('0xe')](_0xd712('0xf'),auth[_0xd712('0xa')](),controller[_0xd712('0x10')]);router[_0xd712('0x11')](_0xd712('0xf'),auth[_0xd712('0xa')](),controller[_0xd712('0x12')]);module[_0xd712('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 8f13ba5..575f4a1 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 _0x7094=['sequelize','exports','ENUM','string','customVariable','keyValue','STRING','variable'];(function(_0x536322,_0x4a2545){var _0x4340de=function(_0x15bf34){while(--_0x15bf34){_0x536322['push'](_0x536322['shift']());}};_0x4340de(++_0x4a2545);}(_0x7094,0x68));var _0x4709=function(_0x3a5911,_0x53dbff){_0x3a5911=_0x3a5911-0x0;var _0x96fda5=_0x7094[_0x3a5911];return _0x96fda5;};'use strict';var Sequelize=require(_0x4709('0x0'));module[_0x4709('0x1')]={'type':{'type':Sequelize[_0x4709('0x2')](_0x4709('0x3'),'variable',_0x4709('0x4'),_0x4709('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x4709('0x6')]},'key':{'type':Sequelize[_0x4709('0x6')]},'keyType':{'type':Sequelize[_0x4709('0x2')](_0x4709('0x3'),_0x4709('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0x4709('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x4709('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4709('0x6')]}}; \ No newline at end of file +var _0xa55f=['sequelize','ENUM','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xa55f,0x158));var _0xfa55=function(_0x37b3ef,_0x49ccd8){_0x37b3ef=_0x37b3ef-0x0;var _0x200dbe=_0xa55f[_0x37b3ef];return _0x200dbe;};'use strict';var Sequelize=require(_0xfa55('0x0'));module['exports']={'type':{'type':Sequelize[_0xfa55('0x1')]('string',_0xfa55('0x2'),_0xfa55('0x3'),_0xfa55('0x4'),_0xfa55('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xfa55('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xfa55('0x1')]('string','variable',_0xfa55('0x3'))},'keyContent':{'type':Sequelize[_0xfa55('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xfa55('0x6')]},'customField':{'type':Sequelize[_0xfa55('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfa55('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 334a4ae..933e114 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 _0x9d9b=['zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','stack','name','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','eml-format'];(function(_0x580561,_0x7b608d){var _0x4d305a=function(_0x397202){while(--_0x397202){_0x580561['push'](_0x580561['shift']());}};_0x4d305a(++_0x7b608d);}(_0x9d9b,0xda));var _0xb9d9=function(_0x271cc8,_0xcc61d2){_0x271cc8=_0x271cc8-0x0;var _0x709721=_0x9d9b[_0x271cc8];return _0x709721;};'use strict';var emlformat=require(_0xb9d9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb9d9('0x1'));var jsonpatch=require(_0xb9d9('0x2'));var rp=require(_0xb9d9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb9d9('0x4'));var util=require(_0xb9d9('0x5'));var path=require(_0xb9d9('0x6'));var sox=require('sox');var csv=require(_0xb9d9('0x7'));var ejs=require(_0xb9d9('0x8'));var fs=require('fs');var fs_extra=require(_0xb9d9('0x9'));var _=require(_0xb9d9('0xa'));var squel=require('squel');var crypto=require(_0xb9d9('0xb'));var jsforce=require(_0xb9d9('0xc'));var deskjs=require(_0xb9d9('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb9d9('0xe'));var Papa=require(_0xb9d9('0xf'));var Redis=require(_0xb9d9('0x10'));var authService=require(_0xb9d9('0x11'));var qs=require(_0xb9d9('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb9d9('0x13'));var logger=require('../../config/logger')(_0xb9d9('0x14'));var utils=require('../../config/utils');var config=require(_0xb9d9('0x15'));var licenseUtil=require(_0xb9d9('0x16'));var db=require(_0xb9d9('0x17'))['db'];function respondWithStatusCode(_0x4c42a5,_0x4d25d7){_0x4d25d7=_0x4d25d7||0xcc;return function(_0x23c09b){if(_0x23c09b){return _0x4c42a5['sendStatus'](_0x4d25d7);}return _0x4c42a5[_0xb9d9('0x18')](_0x4d25d7)[_0xb9d9('0x19')]();};}function respondWithResult(_0x253746,_0x20bf44){_0x20bf44=_0x20bf44||0xc8;return function(_0x33d1b0){if(_0x33d1b0){return _0x253746[_0xb9d9('0x18')](_0x20bf44)[_0xb9d9('0x1a')](_0x33d1b0);}};}function respondWithFilteredResult(_0x5b8b11,_0x17e94d){return function(_0x39a689){if(_0x39a689){var _0x198cb4=typeof _0x17e94d[_0xb9d9('0x1b')]===_0xb9d9('0x1c')&&typeof _0x17e94d[_0xb9d9('0x1d')]===_0xb9d9('0x1c');var _0x552123=_0x39a689[_0xb9d9('0x1e')];var _0x24fa78=_0x198cb4?0x0:_0x17e94d[_0xb9d9('0x1b')];var _0xfdbdaf=_0x198cb4?_0x39a689[_0xb9d9('0x1e')]:_0x17e94d['offset']+_0x17e94d[_0xb9d9('0x1d')];var _0x1ff50c;if(_0xfdbdaf>=_0x552123){_0xfdbdaf=_0x552123;_0x1ff50c=0xc8;}else{_0x1ff50c=0xce;}_0x5b8b11[_0xb9d9('0x18')](_0x1ff50c);return _0x5b8b11[_0xb9d9('0x1f')](_0xb9d9('0x20'),_0x24fa78+'-'+_0xfdbdaf+'/'+_0x552123)[_0xb9d9('0x1a')](_0x39a689);}return null;};}function patchUpdates(_0x36c797){return function(_0x3293af){try{jsonpatch[_0xb9d9('0x21')](_0x3293af,_0x36c797,!![]);}catch(_0x188962){return BPromise['reject'](_0x188962);}return _0x3293af[_0xb9d9('0x22')]();};}function saveUpdates(_0x28f60b,_0xf3668c){return function(_0x17cd4f){if(_0x17cd4f){return _0x17cd4f[_0xb9d9('0x23')](_0x28f60b)[_0xb9d9('0x24')](function(_0x27acba){return _0x27acba;});}return null;};}function removeEntity(_0x796127,_0x267a4f){return function(_0x5a77aa){if(_0x5a77aa){return _0x5a77aa[_0xb9d9('0x25')]()[_0xb9d9('0x24')](function(){_0x796127[_0xb9d9('0x18')](0xcc)[_0xb9d9('0x19')]();});}};}function handleEntityNotFound(_0x4eb560,_0x576ab6){return function(_0x2e5ff7){if(!_0x2e5ff7){_0x4eb560[_0xb9d9('0x26')](0x194);}return _0x2e5ff7;};}function handleError(_0x375f33,_0x4b47c0){_0x4b47c0=_0x4b47c0||0x1f4;return function(_0xe05389){logger['error'](_0xe05389[_0xb9d9('0x27')]);if(_0xe05389[_0xb9d9('0x28')]){delete _0xe05389[_0xb9d9('0x28')];}_0x375f33[_0xb9d9('0x18')](_0x4b47c0)['send'](_0xe05389);};}exports[_0xb9d9('0x29')]=function(_0x1f4dc3,_0x2db7ec){var _0x1a925e={},_0x1bb84d={},_0x2abd68={'count':0x0,'rows':[]};var _0xd9c201=_[_0xb9d9('0x2a')](db[_0xb9d9('0x2b')][_0xb9d9('0x2c')],function(_0x85a4dc){return{'name':_0x85a4dc[_0xb9d9('0x2d')],'type':_0x85a4dc[_0xb9d9('0x2e')][_0xb9d9('0x2f')]};});_0x1bb84d[_0xb9d9('0x30')]=_[_0xb9d9('0x2a')](_0xd9c201,_0xb9d9('0x28'));_0x1bb84d['query']=_[_0xb9d9('0x31')](_0x1f4dc3[_0xb9d9('0x32')]);_0x1bb84d[_0xb9d9('0x33')]=_[_0xb9d9('0x34')](_0x1bb84d['model'],_0x1bb84d['query']);_0x1a925e[_0xb9d9('0x35')]=_[_0xb9d9('0x34')](_0x1bb84d[_0xb9d9('0x30')],qs[_0xb9d9('0x36')](_0x1f4dc3['query']['fields']));_0x1a925e[_0xb9d9('0x35')]=_0x1a925e['attributes'][_0xb9d9('0x37')]?_0x1a925e['attributes']:_0x1bb84d[_0xb9d9('0x30')];if(!_0x1f4dc3[_0xb9d9('0x32')]['hasOwnProperty'](_0xb9d9('0x38'))){_0x1a925e[_0xb9d9('0x1d')]=qs[_0xb9d9('0x1d')](_0x1f4dc3[_0xb9d9('0x32')][_0xb9d9('0x1d')]);_0x1a925e[_0xb9d9('0x1b')]=qs[_0xb9d9('0x1b')](_0x1f4dc3[_0xb9d9('0x32')][_0xb9d9('0x1b')]);}_0x1a925e[_0xb9d9('0x39')]=qs[_0xb9d9('0x3a')](_0x1f4dc3[_0xb9d9('0x32')]['sort']);_0x1a925e['where']=qs['filters'](_[_0xb9d9('0x3b')](_0x1f4dc3['query'],_0x1bb84d[_0xb9d9('0x33')]),_0xd9c201);if(_0x1f4dc3[_0xb9d9('0x32')][_0xb9d9('0x3c')]){_0x1a925e[_0xb9d9('0x3d')]=_[_0xb9d9('0x3e')](_0x1a925e[_0xb9d9('0x3d')],{'$or':_[_0xb9d9('0x2a')](_0xd9c201,function(_0x527ee5){if(_0x527ee5['type']!=='VIRTUAL'){var _0x579417={};_0x579417[_0x527ee5[_0xb9d9('0x28')]]={'$like':'%'+_0x1f4dc3[_0xb9d9('0x32')][_0xb9d9('0x3c')]+'%'};return _0x579417;}})});}_0x1a925e=_['merge']({},_0x1a925e,_0x1f4dc3[_0xb9d9('0x3f')]);var _0x2d2cc0={'where':_0x1a925e[_0xb9d9('0x3d')]};return db[_0xb9d9('0x2b')][_0xb9d9('0x1e')](_0x2d2cc0)['then'](function(_0xf0be45){_0x2abd68['count']=_0xf0be45;if(_0x1f4dc3['query'][_0xb9d9('0x40')]){_0x1a925e[_0xb9d9('0x41')]=[{'all':!![]}];}return db[_0xb9d9('0x2b')][_0xb9d9('0x42')](_0x1a925e);})['then'](function(_0x54e30a){_0x2abd68[_0xb9d9('0x43')]=_0x54e30a;return _0x2abd68;})[_0xb9d9('0x24')](respondWithFilteredResult(_0x2db7ec,_0x1a925e))[_0xb9d9('0x44')](handleError(_0x2db7ec,null));};exports['show']=function(_0x1fd64d,_0x22be03){var _0x56cd07={'raw':!![],'where':{'id':_0x1fd64d[_0xb9d9('0x45')]['id']}},_0x39b405={};_0x39b405[_0xb9d9('0x30')]=_[_0xb9d9('0x31')](db[_0xb9d9('0x2b')]['rawAttributes']);_0x39b405[_0xb9d9('0x32')]=_[_0xb9d9('0x31')](_0x1fd64d[_0xb9d9('0x32')]);_0x39b405[_0xb9d9('0x33')]=_['intersection'](_0x39b405['model'],_0x39b405[_0xb9d9('0x32')]);_0x56cd07[_0xb9d9('0x35')]=_[_0xb9d9('0x34')](_0x39b405[_0xb9d9('0x30')],qs[_0xb9d9('0x36')](_0x1fd64d['query']['fields']));_0x56cd07[_0xb9d9('0x35')]=_0x56cd07[_0xb9d9('0x35')][_0xb9d9('0x37')]?_0x56cd07[_0xb9d9('0x35')]:_0x39b405['model'];if(_0x1fd64d['query'][_0xb9d9('0x40')]){_0x56cd07[_0xb9d9('0x41')]=[{'all':!![]}];}_0x56cd07=_[_0xb9d9('0x3e')]({},_0x56cd07,_0x1fd64d['options']);return db[_0xb9d9('0x2b')][_0xb9d9('0x46')](_0x56cd07)['then'](handleEntityNotFound(_0x22be03,null))[_0xb9d9('0x24')](respondWithResult(_0x22be03,null))['catch'](handleError(_0x22be03,null));};exports[_0xb9d9('0x47')]=function(_0x4f62c5,_0x5c871f){return db['SugarcrmField']['create'](_0x4f62c5[_0xb9d9('0x48')],{})['then'](respondWithResult(_0x5c871f,0xc9))[_0xb9d9('0x44')](handleError(_0x5c871f,null));};exports['update']=function(_0x304823,_0x7fa599){if(_0x304823[_0xb9d9('0x48')]['id']){delete _0x304823[_0xb9d9('0x48')]['id'];}return db[_0xb9d9('0x2b')][_0xb9d9('0x46')]({'where':{'id':_0x304823[_0xb9d9('0x45')]['id']}})['then'](handleEntityNotFound(_0x7fa599,null))[_0xb9d9('0x24')](saveUpdates(_0x304823[_0xb9d9('0x48')],null))[_0xb9d9('0x24')](respondWithResult(_0x7fa599,null))[_0xb9d9('0x44')](handleError(_0x7fa599,null));};exports[_0xb9d9('0x25')]=function(_0x3e42aa,_0x3c767c){return db[_0xb9d9('0x2b')][_0xb9d9('0x46')]({'where':{'id':_0x3e42aa[_0xb9d9('0x45')]['id']}})['then'](handleEntityNotFound(_0x3c767c,null))[_0xb9d9('0x24')](removeEntity(_0x3c767c,null))[_0xb9d9('0x44')](handleError(_0x3c767c,null));}; \ No newline at end of file +var _0xa59c=['stack','name','send','index','map','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','sort','where','pick','filter','merge','options','SugarcrmField','rows','show','params','rawAttributes','includeAll','include','find','create','catch','destroy','eml-format','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','error'];(function(_0x3419e9,_0x44890c){var _0x409edd=function(_0xb15b6e){while(--_0xb15b6e){_0x3419e9['push'](_0x3419e9['shift']());}};_0x409edd(++_0x44890c);}(_0xa59c,0x17e));var _0xca59=function(_0x35ebae,_0x4f86c4){_0x35ebae=_0x35ebae-0x0;var _0x1924cf=_0xa59c[_0x35ebae];return _0x1924cf;};'use strict';var emlformat=require(_0xca59('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xca59('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xca59('0x2'));var moment=require(_0xca59('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xca59('0x4'));var util=require('util');var path=require(_0xca59('0x5'));var sox=require(_0xca59('0x6'));var csv=require(_0xca59('0x7'));var ejs=require(_0xca59('0x8'));var fs=require('fs');var fs_extra=require(_0xca59('0x9'));var _=require('lodash');var squel=require(_0xca59('0xa'));var crypto=require(_0xca59('0xb'));var jsforce=require(_0xca59('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xca59('0x7'));var querystring=require(_0xca59('0xd'));var Papa=require(_0xca59('0xe'));var Redis=require(_0xca59('0xf'));var authService=require(_0xca59('0x10'));var qs=require(_0xca59('0x11'));var as=require(_0xca59('0x12'));var hardwareService=require(_0xca59('0x13'));var logger=require('../../config/logger')(_0xca59('0x14'));var utils=require(_0xca59('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xca59('0x16'));var db=require(_0xca59('0x17'))['db'];function respondWithStatusCode(_0x5bb62b,_0x461136){_0x461136=_0x461136||0xcc;return function(_0x14292d){if(_0x14292d){return _0x5bb62b['sendStatus'](_0x461136);}return _0x5bb62b[_0xca59('0x18')](_0x461136)[_0xca59('0x19')]();};}function respondWithResult(_0x5324ed,_0x4b9c00){_0x4b9c00=_0x4b9c00||0xc8;return function(_0x597a1c){if(_0x597a1c){return _0x5324ed[_0xca59('0x18')](_0x4b9c00)[_0xca59('0x1a')](_0x597a1c);}};}function respondWithFilteredResult(_0x5476b8,_0x355dcd){return function(_0x3f2eb9){if(_0x3f2eb9){var _0x9b0155=typeof _0x355dcd[_0xca59('0x1b')]===_0xca59('0x1c')&&typeof _0x355dcd['limit']==='undefined';var _0x4fab2a=_0x3f2eb9[_0xca59('0x1d')];var _0x2b31e0=_0x9b0155?0x0:_0x355dcd[_0xca59('0x1b')];var _0x3ab1d6=_0x9b0155?_0x3f2eb9[_0xca59('0x1d')]:_0x355dcd['offset']+_0x355dcd[_0xca59('0x1e')];var _0xee7cff;if(_0x3ab1d6>=_0x4fab2a){_0x3ab1d6=_0x4fab2a;_0xee7cff=0xc8;}else{_0xee7cff=0xce;}_0x5476b8[_0xca59('0x18')](_0xee7cff);return _0x5476b8[_0xca59('0x1f')](_0xca59('0x20'),_0x2b31e0+'-'+_0x3ab1d6+'/'+_0x4fab2a)['json'](_0x3f2eb9);}return null;};}function patchUpdates(_0x20accd){return function(_0x1fbbd1){try{jsonpatch['apply'](_0x1fbbd1,_0x20accd,!![]);}catch(_0x1da745){return BPromise[_0xca59('0x21')](_0x1da745);}return _0x1fbbd1[_0xca59('0x22')]();};}function saveUpdates(_0x49a15a,_0x4e81af){return function(_0x2f653b){if(_0x2f653b){return _0x2f653b[_0xca59('0x23')](_0x49a15a)['then'](function(_0x534ccb){return _0x534ccb;});}return null;};}function removeEntity(_0x2dd6c2,_0x511158){return function(_0xaf90dd){if(_0xaf90dd){return _0xaf90dd['destroy']()[_0xca59('0x24')](function(){_0x2dd6c2[_0xca59('0x18')](0xcc)[_0xca59('0x19')]();});}};}function handleEntityNotFound(_0x4b2759,_0x492242){return function(_0x53310a){if(!_0x53310a){_0x4b2759['sendStatus'](0x194);}return _0x53310a;};}function handleError(_0x11205a,_0x2f541b){_0x2f541b=_0x2f541b||0x1f4;return function(_0x58cff2){logger[_0xca59('0x25')](_0x58cff2[_0xca59('0x26')]);if(_0x58cff2[_0xca59('0x27')]){delete _0x58cff2[_0xca59('0x27')];}_0x11205a[_0xca59('0x18')](_0x2f541b)[_0xca59('0x28')](_0x58cff2);};}exports[_0xca59('0x29')]=function(_0x4a355c,_0x5983f8){var _0x5a486b={},_0xb6256c={},_0x34fd54={'count':0x0,'rows':[]};var _0x51ec7b=_[_0xca59('0x2a')](db['SugarcrmField']['rawAttributes'],function(_0x4efcbf){return{'name':_0x4efcbf['fieldName'],'type':_0x4efcbf['type'][_0xca59('0x2b')]};});_0xb6256c['model']=_['map'](_0x51ec7b,'name');_0xb6256c[_0xca59('0x2c')]=_[_0xca59('0x2d')](_0x4a355c[_0xca59('0x2c')]);_0xb6256c[_0xca59('0x2e')]=_[_0xca59('0x2f')](_0xb6256c[_0xca59('0x30')],_0xb6256c[_0xca59('0x2c')]);_0x5a486b['attributes']=_[_0xca59('0x2f')](_0xb6256c['model'],qs[_0xca59('0x31')](_0x4a355c[_0xca59('0x2c')]['fields']));_0x5a486b['attributes']=_0x5a486b[_0xca59('0x32')][_0xca59('0x33')]?_0x5a486b[_0xca59('0x32')]:_0xb6256c[_0xca59('0x30')];if(!_0x4a355c[_0xca59('0x2c')]['hasOwnProperty'](_0xca59('0x34'))){_0x5a486b[_0xca59('0x1e')]=qs[_0xca59('0x1e')](_0x4a355c[_0xca59('0x2c')][_0xca59('0x1e')]);_0x5a486b[_0xca59('0x1b')]=qs[_0xca59('0x1b')](_0x4a355c['query'][_0xca59('0x1b')]);}_0x5a486b['order']=qs[_0xca59('0x35')](_0x4a355c[_0xca59('0x2c')][_0xca59('0x35')]);_0x5a486b[_0xca59('0x36')]=qs[_0xca59('0x2e')](_[_0xca59('0x37')](_0x4a355c[_0xca59('0x2c')],_0xb6256c[_0xca59('0x2e')]),_0x51ec7b);if(_0x4a355c[_0xca59('0x2c')][_0xca59('0x38')]){_0x5a486b[_0xca59('0x36')]=_[_0xca59('0x39')](_0x5a486b[_0xca59('0x36')],{'$or':_[_0xca59('0x2a')](_0x51ec7b,function(_0x9c67d3){if(_0x9c67d3['type']!=='VIRTUAL'){var _0x45e20f={};_0x45e20f[_0x9c67d3[_0xca59('0x27')]]={'$like':'%'+_0x4a355c[_0xca59('0x2c')][_0xca59('0x38')]+'%'};return _0x45e20f;}})});}_0x5a486b=_[_0xca59('0x39')]({},_0x5a486b,_0x4a355c[_0xca59('0x3a')]);var _0x379057={'where':_0x5a486b['where']};return db[_0xca59('0x3b')][_0xca59('0x1d')](_0x379057)[_0xca59('0x24')](function(_0x13c579){_0x34fd54[_0xca59('0x1d')]=_0x13c579;if(_0x4a355c[_0xca59('0x2c')]['includeAll']){_0x5a486b['include']=[{'all':!![]}];}return db[_0xca59('0x3b')]['findAll'](_0x5a486b);})[_0xca59('0x24')](function(_0x56cbb3){_0x34fd54[_0xca59('0x3c')]=_0x56cbb3;return _0x34fd54;})[_0xca59('0x24')](respondWithFilteredResult(_0x5983f8,_0x5a486b))['catch'](handleError(_0x5983f8,null));};exports[_0xca59('0x3d')]=function(_0x36d8ab,_0x4d1f59){var _0x15dc7c={'raw':!![],'where':{'id':_0x36d8ab[_0xca59('0x3e')]['id']}},_0x62683b={};_0x62683b['model']=_[_0xca59('0x2d')](db[_0xca59('0x3b')][_0xca59('0x3f')]);_0x62683b[_0xca59('0x2c')]=_[_0xca59('0x2d')](_0x36d8ab[_0xca59('0x2c')]);_0x62683b[_0xca59('0x2e')]=_[_0xca59('0x2f')](_0x62683b[_0xca59('0x30')],_0x62683b[_0xca59('0x2c')]);_0x15dc7c[_0xca59('0x32')]=_['intersection'](_0x62683b[_0xca59('0x30')],qs[_0xca59('0x31')](_0x36d8ab[_0xca59('0x2c')]['fields']));_0x15dc7c[_0xca59('0x32')]=_0x15dc7c['attributes'][_0xca59('0x33')]?_0x15dc7c[_0xca59('0x32')]:_0x62683b[_0xca59('0x30')];if(_0x36d8ab['query'][_0xca59('0x40')]){_0x15dc7c[_0xca59('0x41')]=[{'all':!![]}];}_0x15dc7c=_[_0xca59('0x39')]({},_0x15dc7c,_0x36d8ab[_0xca59('0x3a')]);return db[_0xca59('0x3b')][_0xca59('0x42')](_0x15dc7c)[_0xca59('0x24')](handleEntityNotFound(_0x4d1f59,null))['then'](respondWithResult(_0x4d1f59,null))['catch'](handleError(_0x4d1f59,null));};exports[_0xca59('0x43')]=function(_0xc6bb1b,_0x51fac7){return db[_0xca59('0x3b')][_0xca59('0x43')](_0xc6bb1b['body'],{})[_0xca59('0x24')](respondWithResult(_0x51fac7,0xc9))['catch'](handleError(_0x51fac7,null));};exports['update']=function(_0x3ded83,_0x57f217){if(_0x3ded83['body']['id']){delete _0x3ded83['body']['id'];}return db[_0xca59('0x3b')][_0xca59('0x42')]({'where':{'id':_0x3ded83[_0xca59('0x3e')]['id']}})[_0xca59('0x24')](handleEntityNotFound(_0x57f217,null))['then'](saveUpdates(_0x3ded83['body'],null))[_0xca59('0x24')](respondWithResult(_0x57f217,null))[_0xca59('0x44')](handleError(_0x57f217,null));};exports[_0xca59('0x45')]=function(_0x42680d,_0x5a4c65){return db[_0xca59('0x3b')][_0xca59('0x42')]({'where':{'id':_0x42680d['params']['id']}})[_0xca59('0x24')](handleEntityNotFound(_0x5a4c65,null))[_0xca59('0x24')](removeEntity(_0x5a4c65,null))[_0xca59('0x44')](handleError(_0x5a4c65,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index ae8eb96..4404533 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 _0x11ea=['moment','bluebird','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','util','../../config/logger','api'];(function(_0x35b0df,_0x35cf3e){var _0x2313f9=function(_0xa4085){while(--_0xa4085){_0x35b0df['push'](_0x35b0df['shift']());}};_0x2313f9(++_0x35cf3e);}(_0x11ea,0x11b));var _0xa11e=function(_0x10e79e,_0x251b14){_0x10e79e=_0x10e79e-0x0;var _0xe5c9ba=_0x11ea[_0x10e79e];return _0xe5c9ba;};'use strict';var _=require('lodash');var util=require(_0xa11e('0x0'));var logger=require(_0xa11e('0x1'))(_0xa11e('0x2'));var moment=require(_0xa11e('0x3'));var BPromise=require(_0xa11e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa11e('0x5'));var config=require(_0xa11e('0x6'));var attributes=require(_0xa11e('0x7'));module[_0xa11e('0x8')]=function(_0x2ea89c,_0x16905f){return _0x2ea89c['define'](_0xa11e('0x9'),attributes,{'tableName':_0xa11e('0xa'),'paranoid':![],'indexes':[{'name':_0xa11e('0xb'),'fields':[_0xa11e('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbd2a=['../../config/logger','api','moment','bluebird','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','lodash','util'];(function(_0x4ce7f2,_0x809306){var _0x5be312=function(_0x45183d){while(--_0x45183d){_0x4ce7f2['push'](_0x4ce7f2['shift']());}};_0x5be312(++_0x809306);}(_0xbd2a,0x8a));var _0xabd2=function(_0x13e45b,_0x46fe75){_0x13e45b=_0x13e45b-0x0;var _0x540b11=_0xbd2a[_0x13e45b];return _0x540b11;};'use strict';var _=require(_0xabd2('0x0'));var util=require(_0xabd2('0x1'));var logger=require(_0xabd2('0x2'))(_0xabd2('0x3'));var moment=require(_0xabd2('0x4'));var BPromise=require(_0xabd2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xabd2('0x6'));var attributes=require(_0xabd2('0x7'));module[_0xabd2('0x8')]=function(_0x117d1b,_0x2c8c68){return _0x117d1b[_0xabd2('0x9')](_0xabd2('0xa'),attributes,{'tableName':_0xabd2('0xb'),'paranoid':![],'indexes':[{'name':_0xabd2('0xc'),'fields':[_0xabd2('0xd'),'FieldId'],'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 36de914..55113ac 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 _0x5fdf=['info','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','client'];(function(_0x128602,_0x486a92){var _0x47ad26=function(_0x562249){while(--_0x562249){_0x128602['push'](_0x128602['shift']());}};_0x47ad26(++_0x486a92);}(_0x5fdf,0x152));var _0xf5fd=function(_0x102ff9,_0x907658){_0x102ff9=_0x102ff9-0x0;var _0x24fa97=_0x5fdf[_0x102ff9];return _0x24fa97;};'use strict';var _=require(_0xf5fd('0x0'));var util=require(_0xf5fd('0x1'));var moment=require('moment');var BPromise=require(_0xf5fd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf5fd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf5fd('0x4'));var logger=require(_0xf5fd('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf5fd('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c4b04,_0x33e2d2,_0x5beaf5){return new BPromise(function(_0x4c88cb,_0x3508b6){return client['request'](_0x5c4b04,_0x5beaf5)['then'](function(_0x569d41){logger[_0xf5fd('0x7')](_0xf5fd('0x8'),_0x33e2d2,_0xf5fd('0x9'));logger['debug'](_0xf5fd('0xa'),_0x33e2d2,_0xf5fd('0x9'),JSON['stringify'](_0x569d41));if(_0x569d41[_0xf5fd('0xb')]){if(_0x569d41[_0xf5fd('0xb')][_0xf5fd('0xc')]===0x1f4){logger[_0xf5fd('0xb')](_0xf5fd('0x8'),_0x33e2d2,_0x569d41[_0xf5fd('0xb')][_0xf5fd('0xd')]);return _0x3508b6(_0x569d41[_0xf5fd('0xb')][_0xf5fd('0xd')]);}logger[_0xf5fd('0xb')]('SugarcrmField,\x20%s,\x20%s',_0x33e2d2,_0x569d41['error']['message']);return _0x4c88cb(_0x569d41['error'][_0xf5fd('0xd')]);}else{logger[_0xf5fd('0x7')](_0xf5fd('0x8'),_0x33e2d2,'request\x20sent');_0x4c88cb(_0x569d41['result'][_0xf5fd('0xd')]);}})[_0xf5fd('0xe')](function(_0x17cb86){logger[_0xf5fd('0xb')](_0xf5fd('0x8'),_0x33e2d2,_0x17cb86);_0x3508b6(_0x17cb86);});});} \ No newline at end of file +var _0xcde5=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','error','message','result','lodash','util'];(function(_0x3b5141,_0x3ae9aa){var _0x2aeb4b=function(_0x3d9324){while(--_0x3d9324){_0x3b5141['push'](_0x3b5141['shift']());}};_0x2aeb4b(++_0x3ae9aa);}(_0xcde5,0x7c));var _0x5cde=function(_0x712cad,_0x37fe35){_0x712cad=_0x712cad-0x0;var _0x60d202=_0xcde5[_0x712cad];return _0x60d202;};'use strict';var _=require(_0x5cde('0x0'));var util=require(_0x5cde('0x1'));var moment=require(_0x5cde('0x2'));var BPromise=require(_0x5cde('0x3'));var rs=require(_0x5cde('0x4'));var fs=require('fs');var Redis=require(_0x5cde('0x5'));var db=require(_0x5cde('0x6'))['db'];var utils=require(_0x5cde('0x7'));var logger=require(_0x5cde('0x8'))(_0x5cde('0x9'));var config=require(_0x5cde('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5cde('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x113a61,_0x345903,_0x478250){return new BPromise(function(_0x284995,_0x44919b){return client[_0x5cde('0xc')](_0x113a61,_0x478250)[_0x5cde('0xd')](function(_0xb9cfb4){logger[_0x5cde('0xe')](_0x5cde('0xf'),_0x345903,_0x5cde('0x10'));logger[_0x5cde('0x11')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x345903,'request\x20sent',JSON['stringify'](_0xb9cfb4));if(_0xb9cfb4['error']){if(_0xb9cfb4[_0x5cde('0x12')]['code']===0x1f4){logger[_0x5cde('0x12')](_0x5cde('0xf'),_0x345903,_0xb9cfb4[_0x5cde('0x12')][_0x5cde('0x13')]);return _0x44919b(_0xb9cfb4['error']['message']);}logger[_0x5cde('0x12')](_0x5cde('0xf'),_0x345903,_0xb9cfb4[_0x5cde('0x12')][_0x5cde('0x13')]);return _0x284995(_0xb9cfb4[_0x5cde('0x12')][_0x5cde('0x13')]);}else{logger[_0x5cde('0xe')](_0x5cde('0xf'),_0x345903,'request\x20sent');_0x284995(_0xb9cfb4[_0x5cde('0x14')][_0x5cde('0x13')]);}})['catch'](function(_0x5c4404){logger[_0x5cde('0x12')](_0x5cde('0xf'),_0x345903,_0x5c4404);_0x44919b(_0x5c4404);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 26bc5f7..719ad74 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 _0xaf93=['get','isAuthenticated','index','/:id','show','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller'];(function(_0x20bd39,_0x518318){var _0xd81b3f=function(_0x588af3){while(--_0x588af3){_0x20bd39['push'](_0x20bd39['shift']());}};_0xd81b3f(++_0x518318);}(_0xaf93,0x151));var _0x3af9=function(_0x435f5c,_0x2826d5){_0x435f5c=_0x435f5c-0x0;var _0x3e2360=_0xaf93[_0x435f5c];return _0x3e2360;};'use strict';var multer=require(_0x3af9('0x0'));var util=require(_0x3af9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3af9('0x2'));var router=express[_0x3af9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3af9('0x4'));var interaction=require(_0x3af9('0x5'));var config=require(_0x3af9('0x6'));var controller=require(_0x3af9('0x7'));router[_0x3af9('0x8')]('/',auth[_0x3af9('0x9')](),controller[_0x3af9('0xa')]);router['get'](_0x3af9('0xb'),auth['isAuthenticated'](),controller[_0x3af9('0xc')]);router['get']('/:id/configurations',auth[_0x3af9('0x9')](),controller['getConfigurations']);router['get'](_0x3af9('0xd'),auth[_0x3af9('0x9')](),controller[_0x3af9('0xe')]);router[_0x3af9('0xf')]('/',auth['isAuthenticated'](),controller[_0x3af9('0x10')]);router[_0x3af9('0xf')](_0x3af9('0x11'),auth[_0x3af9('0x9')](),controller[_0x3af9('0x12')]);router[_0x3af9('0x13')](_0x3af9('0xb'),auth[_0x3af9('0x9')](),controller['update']);router[_0x3af9('0x14')]('/:id',auth[_0x3af9('0x9')](),controller[_0x3af9('0x15')]);module[_0x3af9('0x16')]=router; \ No newline at end of file +var _0xa37e=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','get','show','/:id/configurations','isAuthenticated','/:id/fields','create','post','addConfiguration','put','update','/:id','destroy','path'];(function(_0xf1226a,_0x29a250){var _0x1b8fe7=function(_0x7178a5){while(--_0x7178a5){_0xf1226a['push'](_0xf1226a['shift']());}};_0x1b8fe7(++_0x29a250);}(_0xa37e,0x97));var _0xea37=function(_0x2f6f71,_0x303573){_0x2f6f71=_0x2f6f71-0x0;var _0x55bf4a=_0xa37e[_0x2f6f71];return _0x55bf4a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xea37('0x0'));var timeout=require(_0xea37('0x1'));var express=require(_0xea37('0x2'));var router=express[_0xea37('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xea37('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xea37('0x5'));var controller=require(_0xea37('0x6'));router[_0xea37('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xea37('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xea37('0x8')]);router[_0xea37('0x7')](_0xea37('0x9'),auth[_0xea37('0xa')](),controller['getConfigurations']);router[_0xea37('0x7')](_0xea37('0xb'),auth[_0xea37('0xa')](),controller['getFields']);router['post']('/',auth[_0xea37('0xa')](),controller[_0xea37('0xc')]);router[_0xea37('0xd')]('/:id/configurations',auth[_0xea37('0xa')](),controller[_0xea37('0xe')]);router[_0xea37('0xf')]('/:id',auth[_0xea37('0xa')](),controller[_0xea37('0x10')]);router['delete'](_0xea37('0x11'),auth['isAuthenticated'](),controller[_0xea37('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 56061a1..bfddc3d 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 _0x6681=['STRING','HelpDesk','sequelize'];(function(_0x244837,_0xa6f454){var _0x3709df=function(_0x58fe69){while(--_0x58fe69){_0x244837['push'](_0x244837['shift']());}};_0x3709df(++_0xa6f454);}(_0x6681,0x12b));var _0x1668=function(_0x10b8af,_0x4878d7){_0x10b8af=_0x10b8af-0x0;var _0x550a0e=_0x6681[_0x10b8af];return _0x550a0e;};'use strict';var Sequelize=require(_0x1668('0x0'));module['exports']={'name':{'type':Sequelize[_0x1668('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x1668('0x1')],'allowNull':![],'defaultValue':_0x1668('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x1668('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x657f=['STRING','sequelize','exports'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x657f,0xb8));var _0xf657=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x657f[_0xac151d];return _0x111dba;};'use strict';var Sequelize=require(_0xf657('0x0'));module[_0xf657('0x1')]={'name':{'type':Sequelize[_0xf657('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf657('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xf657('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index bb5cb65..0304572 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 _0x0d9a=['create','body','getConfigurations','findOne','VtigerConfiguration','order','addConfiguration','AccountId','Subjects','channel','getDescriptions','VtigerField','Descriptions','getFields','username','description','moduleName','serverUrl','accessKey','remoteUri','slice','substring','lastIndexOf','%s/webservice.php','getchallenge','success','login','result','GET','sessionName','reference','owner','remove','false','label','startsWith','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','index','map','VtigerAccount','fieldName','type','keys','filters','intersection','model','attributes','fields','length','query','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','params','rawAttributes','includeAll','find'];(function(_0x4fd82a,_0x29d9d5){var _0x21d2a8=function(_0x11f85f){while(--_0x11f85f){_0x4fd82a['push'](_0x4fd82a['shift']());}};_0x21d2a8(++_0x29d9d5);}(_0x0d9a,0x11d));var _0xa0d9=function(_0x44979a,_0x57078e){_0x44979a=_0x44979a-0x0;var _0x2d6688=_0x0d9a[_0x44979a];return _0x2d6688;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa0d9('0x0'));var jsonpatch=require(_0xa0d9('0x1'));var rp=require(_0xa0d9('0x2'));var moment=require(_0xa0d9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa0d9('0x4'));var util=require(_0xa0d9('0x5'));var path=require(_0xa0d9('0x6'));var sox=require(_0xa0d9('0x7'));var csv=require(_0xa0d9('0x8'));var ejs=require(_0xa0d9('0x9'));var fs=require('fs');var fs_extra=require(_0xa0d9('0xa'));var _=require(_0xa0d9('0xb'));var squel=require(_0xa0d9('0xc'));var crypto=require(_0xa0d9('0xd'));var jsforce=require(_0xa0d9('0xe'));var deskjs=require(_0xa0d9('0xf'));var toCsv=require(_0xa0d9('0x8'));var querystring=require(_0xa0d9('0x10'));var Papa=require(_0xa0d9('0x11'));var Redis=require(_0xa0d9('0x12'));var authService=require(_0xa0d9('0x13'));var qs=require(_0xa0d9('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa0d9('0x15'));var logger=require('../../config/logger')(_0xa0d9('0x16'));var utils=require('../../config/utils');var config=require(_0xa0d9('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa0d9('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x57e788,_0x1dca3c){_0x1dca3c=_0x1dca3c||0xcc;return function(_0x596903){if(_0x596903){return _0x57e788[_0xa0d9('0x19')](_0x1dca3c);}return _0x57e788['status'](_0x1dca3c)['end']();};}function respondWithResult(_0x76cb6f,_0x1efef0){_0x1efef0=_0x1efef0||0xc8;return function(_0x4d6e74){if(_0x4d6e74){return _0x76cb6f['status'](_0x1efef0)[_0xa0d9('0x1a')](_0x4d6e74);}};}function respondWithFilteredResult(_0x4ce006,_0x3c0bfc){return function(_0x2286a4){if(_0x2286a4){var _0x377105=typeof _0x3c0bfc[_0xa0d9('0x1b')]===_0xa0d9('0x1c')&&typeof _0x3c0bfc[_0xa0d9('0x1d')]===_0xa0d9('0x1c');var _0x5e162b=_0x2286a4[_0xa0d9('0x1e')];var _0x2b6440=_0x377105?0x0:_0x3c0bfc[_0xa0d9('0x1b')];var _0x26b461=_0x377105?_0x2286a4[_0xa0d9('0x1e')]:_0x3c0bfc[_0xa0d9('0x1b')]+_0x3c0bfc[_0xa0d9('0x1d')];var _0x5b5a72;if(_0x26b461>=_0x5e162b){_0x26b461=_0x5e162b;_0x5b5a72=0xc8;}else{_0x5b5a72=0xce;}_0x4ce006[_0xa0d9('0x1f')](_0x5b5a72);return _0x4ce006[_0xa0d9('0x20')](_0xa0d9('0x21'),_0x2b6440+'-'+_0x26b461+'/'+_0x5e162b)[_0xa0d9('0x1a')](_0x2286a4);}return null;};}function patchUpdates(_0x474d5a){return function(_0x864d21){try{jsonpatch[_0xa0d9('0x22')](_0x864d21,_0x474d5a,!![]);}catch(_0x59f327){return BPromise[_0xa0d9('0x23')](_0x59f327);}return _0x864d21['save']();};}function saveUpdates(_0x5a0952,_0x16df6d){return function(_0x24a7bb){if(_0x24a7bb){return _0x24a7bb[_0xa0d9('0x24')](_0x5a0952)[_0xa0d9('0x25')](function(_0x4dbd16){return _0x4dbd16;});}return null;};}function removeEntity(_0x36b4b5,_0x880da3){return function(_0x4776f0){if(_0x4776f0){return _0x4776f0[_0xa0d9('0x26')]()[_0xa0d9('0x25')](function(){_0x36b4b5[_0xa0d9('0x1f')](0xcc)[_0xa0d9('0x27')]();});}};}function handleEntityNotFound(_0x28764c,_0x5bc37c){return function(_0x4d8e2){if(!_0x4d8e2){_0x28764c[_0xa0d9('0x19')](0x194);}return _0x4d8e2;};}function handleError(_0x3a7f66,_0x4f3795){_0x4f3795=_0x4f3795||0x1f4;return function(_0x5655cd){logger[_0xa0d9('0x28')](_0x5655cd[_0xa0d9('0x29')]);if(_0x5655cd[_0xa0d9('0x2a')]){delete _0x5655cd[_0xa0d9('0x2a')];}_0x3a7f66[_0xa0d9('0x1f')](_0x4f3795)['send'](_0x5655cd);};}exports[_0xa0d9('0x2b')]=function(_0x4aec79,_0x214ee4){var _0x450592={},_0x48aa69={},_0x847074={'count':0x0,'rows':[]};var _0x4561a5=_[_0xa0d9('0x2c')](db[_0xa0d9('0x2d')]['rawAttributes'],function(_0x5914fc){return{'name':_0x5914fc[_0xa0d9('0x2e')],'type':_0x5914fc[_0xa0d9('0x2f')]['key']};});_0x48aa69['model']=_[_0xa0d9('0x2c')](_0x4561a5,'name');_0x48aa69['query']=_[_0xa0d9('0x30')](_0x4aec79['query']);_0x48aa69[_0xa0d9('0x31')]=_[_0xa0d9('0x32')](_0x48aa69[_0xa0d9('0x33')],_0x48aa69['query']);_0x450592[_0xa0d9('0x34')]=_[_0xa0d9('0x32')](_0x48aa69[_0xa0d9('0x33')],qs[_0xa0d9('0x35')](_0x4aec79['query'][_0xa0d9('0x35')]));_0x450592[_0xa0d9('0x34')]=_0x450592['attributes'][_0xa0d9('0x36')]?_0x450592[_0xa0d9('0x34')]:_0x48aa69[_0xa0d9('0x33')];if(!_0x4aec79[_0xa0d9('0x37')][_0xa0d9('0x38')](_0xa0d9('0x39'))){_0x450592[_0xa0d9('0x1d')]=qs[_0xa0d9('0x1d')](_0x4aec79[_0xa0d9('0x37')][_0xa0d9('0x1d')]);_0x450592[_0xa0d9('0x1b')]=qs[_0xa0d9('0x1b')](_0x4aec79[_0xa0d9('0x37')][_0xa0d9('0x1b')]);}_0x450592['order']=qs[_0xa0d9('0x3a')](_0x4aec79[_0xa0d9('0x37')]['sort']);_0x450592[_0xa0d9('0x3b')]=qs['filters'](_[_0xa0d9('0x3c')](_0x4aec79[_0xa0d9('0x37')],_0x48aa69[_0xa0d9('0x31')]),_0x4561a5);if(_0x4aec79['query'][_0xa0d9('0x3d')]){_0x450592['where']=_[_0xa0d9('0x3e')](_0x450592['where'],{'$or':_[_0xa0d9('0x2c')](_0x4561a5,function(_0x369b9d){if(_0x369b9d[_0xa0d9('0x2f')]!==_0xa0d9('0x3f')){var _0x451b4c={};_0x451b4c[_0x369b9d['name']]={'$like':'%'+_0x4aec79[_0xa0d9('0x37')][_0xa0d9('0x3d')]+'%'};return _0x451b4c;}})});}_0x450592=_[_0xa0d9('0x3e')]({},_0x450592,_0x4aec79[_0xa0d9('0x40')]);var _0xe1f73a={'where':_0x450592[_0xa0d9('0x3b')]};return db[_0xa0d9('0x2d')][_0xa0d9('0x1e')](_0xe1f73a)[_0xa0d9('0x25')](function(_0x3cebd7){_0x847074[_0xa0d9('0x1e')]=_0x3cebd7;if(_0x4aec79[_0xa0d9('0x37')]['includeAll']){_0x450592['include']=[{'all':!![]}];}return db['VtigerAccount'][_0xa0d9('0x41')](_0x450592);})[_0xa0d9('0x25')](function(_0x3a3977){_0x847074[_0xa0d9('0x42')]=_0x3a3977;return _0x847074;})['then'](respondWithFilteredResult(_0x214ee4,_0x450592))[_0xa0d9('0x43')](handleError(_0x214ee4,null));};exports['show']=function(_0x4ba1c8,_0x4770db){var _0xead487={'raw':![],'where':{'id':_0x4ba1c8[_0xa0d9('0x44')]['id']}},_0x2077a6={};_0x2077a6['model']=_['keys'](db[_0xa0d9('0x2d')][_0xa0d9('0x45')]);_0x2077a6[_0xa0d9('0x37')]=_['keys'](_0x4ba1c8[_0xa0d9('0x37')]);_0x2077a6[_0xa0d9('0x31')]=_['intersection'](_0x2077a6['model'],_0x2077a6[_0xa0d9('0x37')]);_0xead487['attributes']=_['intersection'](_0x2077a6[_0xa0d9('0x33')],qs['fields'](_0x4ba1c8[_0xa0d9('0x37')][_0xa0d9('0x35')]));_0xead487[_0xa0d9('0x34')]=_0xead487[_0xa0d9('0x34')][_0xa0d9('0x36')]?_0xead487[_0xa0d9('0x34')]:_0x2077a6[_0xa0d9('0x33')];if(_0x4ba1c8[_0xa0d9('0x37')][_0xa0d9('0x46')]){_0xead487['include']=[{'all':!![]}];}_0xead487=_[_0xa0d9('0x3e')]({},_0xead487,_0x4ba1c8[_0xa0d9('0x40')]);return db[_0xa0d9('0x2d')][_0xa0d9('0x47')](_0xead487)[_0xa0d9('0x25')](handleEntityNotFound(_0x4770db,null))[_0xa0d9('0x25')](respondWithResult(_0x4770db,null))[_0xa0d9('0x43')](handleError(_0x4770db,null));};exports[_0xa0d9('0x48')]=function(_0x2372fd,_0x1d7c1a){return db[_0xa0d9('0x2d')]['create'](_0x2372fd[_0xa0d9('0x49')],{})[_0xa0d9('0x25')](respondWithResult(_0x1d7c1a,0xc9))[_0xa0d9('0x43')](handleError(_0x1d7c1a,null));};exports[_0xa0d9('0x24')]=function(_0x343fe5,_0x3356cf){if(_0x343fe5[_0xa0d9('0x49')]['id']){delete _0x343fe5[_0xa0d9('0x49')]['id'];}return db[_0xa0d9('0x2d')][_0xa0d9('0x47')]({'where':{'id':_0x343fe5[_0xa0d9('0x44')]['id']}})['then'](handleEntityNotFound(_0x3356cf,null))['then'](saveUpdates(_0x343fe5[_0xa0d9('0x49')],null))[_0xa0d9('0x25')](respondWithResult(_0x3356cf,null))['catch'](handleError(_0x3356cf,null));};exports[_0xa0d9('0x26')]=function(_0x14a538,_0x559a08){return db[_0xa0d9('0x2d')]['find']({'where':{'id':_0x14a538[_0xa0d9('0x44')]['id']}})[_0xa0d9('0x25')](handleEntityNotFound(_0x559a08,null))[_0xa0d9('0x25')](removeEntity(_0x559a08,null))[_0xa0d9('0x43')](handleError(_0x559a08,null));};exports[_0xa0d9('0x4a')]=function(_0x32f0f0,_0x5eb655,_0x435f82){var _0x252175={};var _0x2bd110={};var _0x4e89ef;var _0x146a79;return db[_0xa0d9('0x2d')][_0xa0d9('0x4b')]({'where':{'id':_0x32f0f0['params']['id']}})[_0xa0d9('0x25')](handleEntityNotFound(_0x5eb655,null))[_0xa0d9('0x25')](function(_0x47a4e9){if(_0x47a4e9){_0x4e89ef=_0x47a4e9;_0x2bd110[_0xa0d9('0x33')]=_[_0xa0d9('0x30')](db[_0xa0d9('0x4c')][_0xa0d9('0x45')]);_0x2bd110[_0xa0d9('0x37')]=_[_0xa0d9('0x30')](_0x32f0f0[_0xa0d9('0x37')]);_0x2bd110[_0xa0d9('0x31')]=_[_0xa0d9('0x32')](_0x2bd110[_0xa0d9('0x33')],_0x2bd110[_0xa0d9('0x37')]);_0x252175['attributes']=_['intersection'](_0x2bd110[_0xa0d9('0x33')],qs['fields'](_0x32f0f0['query'][_0xa0d9('0x35')]));_0x252175['attributes']=_0x252175['attributes']['length']?_0x252175[_0xa0d9('0x34')]:_0x2bd110['model'];_0x252175[_0xa0d9('0x4d')]=qs[_0xa0d9('0x3a')](_0x32f0f0[_0xa0d9('0x37')][_0xa0d9('0x3a')]);_0x252175[_0xa0d9('0x3b')]=qs[_0xa0d9('0x31')](_[_0xa0d9('0x3c')](_0x32f0f0[_0xa0d9('0x37')],_0x2bd110[_0xa0d9('0x31')]));if(_0x32f0f0['query'][_0xa0d9('0x3d')]){_0x252175[_0xa0d9('0x3b')]=_[_0xa0d9('0x3e')](_0x252175['where'],{'$or':_[_0xa0d9('0x2c')](_0x252175['attributes'],function(_0x16ce90){var _0x178099={};_0x178099[_0x16ce90]={'$like':'%'+_0x32f0f0[_0xa0d9('0x37')][_0xa0d9('0x3d')]+'%'};return _0x178099;})});}_0x252175=_[_0xa0d9('0x3e')]({},_0x252175,_0x32f0f0[_0xa0d9('0x40')]);return _0x4e89ef[_0xa0d9('0x4a')](_0x252175);}})[_0xa0d9('0x25')](function(_0x5a8c30){if(_0x5a8c30){_0x146a79=_0x5a8c30['length'];if(!_0x32f0f0['query']['hasOwnProperty'](_0xa0d9('0x39'))){_0x252175[_0xa0d9('0x1d')]=qs[_0xa0d9('0x1d')](_0x32f0f0[_0xa0d9('0x37')][_0xa0d9('0x1d')]);_0x252175[_0xa0d9('0x1b')]=qs['offset'](_0x32f0f0['query'][_0xa0d9('0x1b')]);}return _0x4e89ef['getConfigurations'](_0x252175);}})[_0xa0d9('0x25')](function(_0xbbcc2d){if(_0xbbcc2d){return _0xbbcc2d?{'count':_0x146a79,'rows':_0xbbcc2d}:null;}})[_0xa0d9('0x25')](respondWithResult(_0x5eb655,null))[_0xa0d9('0x43')](handleError(_0x5eb655,null));};exports[_0xa0d9('0x4e')]=function(_0x373af1,_0x592bfc,_0x3dc7e9){if(_0x373af1[_0xa0d9('0x49')]['id']){delete _0x373af1[_0xa0d9('0x49')]['id'];}return db[_0xa0d9('0x2d')][_0xa0d9('0x4b')]({'where':{'id':_0x373af1[_0xa0d9('0x44')]['id']}})['then'](handleEntityNotFound(_0x592bfc,null))[_0xa0d9('0x25')](function(_0x50ef13){if(_0x50ef13){_0x373af1['body'][_0xa0d9('0x4f')]=_0x50ef13['id'];_0x373af1[_0xa0d9('0x49')][_0xa0d9('0x50')]=integrations['getSubjects'](_0x373af1['body'][_0xa0d9('0x51')],_0x373af1[_0xa0d9('0x49')]['type']);_0x373af1[_0xa0d9('0x49')]['Descriptions']=integrations[_0xa0d9('0x52')](_0x373af1[_0xa0d9('0x49')][_0xa0d9('0x51')],_0x373af1[_0xa0d9('0x49')][_0xa0d9('0x2f')]);return db[_0xa0d9('0x4c')]['create'](_0x373af1['body'],{'include':[{'model':db[_0xa0d9('0x53')],'as':_0xa0d9('0x50')},{'model':db[_0xa0d9('0x53')],'as':_0xa0d9('0x54')}]});}return null;})['then'](respondWithResult(_0x592bfc,null))[_0xa0d9('0x43')](handleError(_0x592bfc,null));};var md5=require('md5');exports[_0xa0d9('0x55')]=function(_0x31fe81,_0x80c828,_0x3e73d7){var _0x50fe22=null;var _0x3b7f0b=null;var _0x37c04e=null;var _0x53936c=null;var _0x41ac11='';return db[_0xa0d9('0x2d')][_0xa0d9('0x4b')]({'where':{'id':_0x31fe81[_0xa0d9('0x44')]['id']},'attributes':['id',_0xa0d9('0x2a'),_0xa0d9('0x56'),_0xa0d9('0x57'),_0xa0d9('0x58'),'remoteUri',_0xa0d9('0x59'),_0xa0d9('0x5a')]})[_0xa0d9('0x25')](handleEntityNotFound(_0x80c828,null))[_0xa0d9('0x25')](function(_0x4312b6){if(_0x4312b6){_0x50fe22=_0x4312b6['username'];_0x3b7f0b=_0x4312b6[_0xa0d9('0x5a')];_0x37c04e=_0x4312b6[_0xa0d9('0x58')];_0x41ac11=_0x4312b6[_0xa0d9('0x5b')];var _0x1ddd2e=_0x41ac11[_0xa0d9('0x5c')](-0x1);if(_0x1ddd2e==='/'){_0x41ac11=_0x41ac11[_0xa0d9('0x5d')](0x0,_0x41ac11[_0xa0d9('0x5e')](_0x1ddd2e));}_0x53936c=util['format'](_0xa0d9('0x5f'),_0x41ac11);var _0x383a40={'method':'GET','uri':_0x53936c,'qs':{'operation':_0xa0d9('0x60'),'username':_0x4312b6[_0xa0d9('0x56')]},'json':!![]};return rp(_0x383a40);}})['then'](function(_0xdb653c){if(_0xdb653c[_0xa0d9('0x61')]){var _0x4d4515={'method':'POST','uri':_0x53936c,'form':{'operation':_0xa0d9('0x62'),'username':_0x50fe22,'accessKey':md5(_0xdb653c[_0xa0d9('0x63')]['token']+_0x3b7f0b)},'json':!![]};return rp(_0x4d4515);}})[_0xa0d9('0x25')](function(_0x4a7d12){if(_0x4a7d12['success']){var _0x75093e={'method':_0xa0d9('0x64'),'uri':_0x53936c,'qs':{'operation':'describe','username':_0x50fe22,'sessionName':_0x4a7d12[_0xa0d9('0x63')][_0xa0d9('0x65')],'elementType':_0x37c04e},'json':!![]};return rp(_0x75093e);}})[_0xa0d9('0x25')](function(_0x590a42){if(_0x590a42[_0xa0d9('0x61')]){var _0x440c44=['autogenerated',_0xa0d9('0x66'),_0xa0d9('0x67')];_[_0xa0d9('0x68')](_0x590a42['result']['fields'],function(_0x551e44){return _0x440c44['includes'](_0x551e44[_0xa0d9('0x2f')]['name']);});_[_0xa0d9('0x68')](_0x590a42['result'][_0xa0d9('0x35')],function(_0x1d024c){return _0x1d024c['editable']===_0xa0d9('0x69');});return{'count':_0x590a42[_0xa0d9('0x63')][_0xa0d9('0x35')][_0xa0d9('0x36')],'rows':_[_0xa0d9('0x2c')](_0x590a42[_0xa0d9('0x63')][_0xa0d9('0x35')],function(_0x51e754){return{'id':_0x51e754['name'],'name':_0x51e754[_0xa0d9('0x6a')],'custom':_[_0xa0d9('0x6b')](_0x51e754['name'],'cf_')?!![]:![],'options':_0x51e754[_0xa0d9('0x2f')]['name']===_0xa0d9('0x6c')&&_0x51e754['type'][_0xa0d9('0x6d')][_0xa0d9('0x36')]>0x0?_[_0xa0d9('0x2c')](_0x51e754[_0xa0d9('0x2f')][_0xa0d9('0x6d')],function(_0x1b9956){return{'name':_0x1b9956[_0xa0d9('0x6a')],'value':_0x1b9956[_0xa0d9('0x6e')]};}):[]};})};}})[_0xa0d9('0x25')](respondWithResult(_0x80c828,null))[_0xa0d9('0x43')](function(_0xb89c00){console[_0xa0d9('0x6f')](_0xa0d9('0x70')+_0xb89c00);var _0x13b7ba=_0x31fe81[_0xa0d9('0x37')][_0xa0d9('0x71')]?0x1f4:_0xb89c00[_0xa0d9('0x72')]||0x1f4;logger['error'](_0xa0d9('0x73'),_0xa0d9('0x55'),_0x13b7ba,JSON[_0xa0d9('0x74')](_0xb89c00));delete _0xb89c00[_0xa0d9('0x2a')];if(_0x13b7ba===0x191){_0x13b7ba=0x190;}_0x80c828[_0xa0d9('0x1f')](_0x13b7ba)[_0xa0d9('0x75')](_0x31fe81[_0xa0d9('0x37')][_0xa0d9('0x71')]?{'message':_0xa0d9('0x76'),'statusCode':_0xb89c00['statusCode']}:_0xb89c00);});}; \ No newline at end of file +var _0x33f5=['key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','includeAll','include','catch','show','params','merge','options','find','create','body','getConfigurations','addConfiguration','findOne','AccountId','getSubjects','channel','type','Descriptions','getDescriptions','VtigerConfiguration','VtigerField','Subjects','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','GET','getchallenge','success','token','describe','result','sessionName','autogenerated','reference','owner','remove','includes','false','label','startsWith','cf_','picklist','picklistValues','log','vTiger\x20error:\x20','statusCode','stringify','test','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName'];(function(_0x53fd32,_0x3ad1de){var _0x20514b=function(_0x333efe){while(--_0x333efe){_0x53fd32['push'](_0x53fd32['shift']());}};_0x20514b(++_0x3ad1de);}(_0x33f5,0x1b8));var _0x533f=function(_0x3684bd,_0x9f1f47){_0x3684bd=_0x3684bd-0x0;var _0x23b4de=_0x33f5[_0x3684bd];return _0x23b4de;};'use strict';var emlformat=require(_0x533f('0x0'));var rimraf=require(_0x533f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x533f('0x2'));var rp=require(_0x533f('0x3'));var moment=require(_0x533f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x533f('0x5'));var util=require(_0x533f('0x6'));var path=require(_0x533f('0x7'));var sox=require(_0x533f('0x8'));var csv=require(_0x533f('0x9'));var ejs=require(_0x533f('0xa'));var fs=require('fs');var fs_extra=require(_0x533f('0xb'));var _=require(_0x533f('0xc'));var squel=require(_0x533f('0xd'));var crypto=require(_0x533f('0xe'));var jsforce=require(_0x533f('0xf'));var deskjs=require(_0x533f('0x10'));var toCsv=require(_0x533f('0x9'));var querystring=require(_0x533f('0x11'));var Papa=require(_0x533f('0x12'));var Redis=require('ioredis');var authService=require(_0x533f('0x13'));var qs=require(_0x533f('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x533f('0x15'));var utils=require(_0x533f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x533f('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x533f('0x18'));function respondWithStatusCode(_0x203f96,_0x1eb97f){_0x1eb97f=_0x1eb97f||0xcc;return function(_0x261d99){if(_0x261d99){return _0x203f96[_0x533f('0x19')](_0x1eb97f);}return _0x203f96[_0x533f('0x1a')](_0x1eb97f)[_0x533f('0x1b')]();};}function respondWithResult(_0x4eee23,_0x4f2c34){_0x4f2c34=_0x4f2c34||0xc8;return function(_0x525e6b){if(_0x525e6b){return _0x4eee23[_0x533f('0x1a')](_0x4f2c34)[_0x533f('0x1c')](_0x525e6b);}};}function respondWithFilteredResult(_0x1b9dde,_0x4dfecd){return function(_0x2e5cff){if(_0x2e5cff){var _0x3fb71e=typeof _0x4dfecd[_0x533f('0x1d')]==='undefined'&&typeof _0x4dfecd[_0x533f('0x1e')]===_0x533f('0x1f');var _0x1b2d99=_0x2e5cff[_0x533f('0x20')];var _0x8ca430=_0x3fb71e?0x0:_0x4dfecd['offset'];var _0x49ade9=_0x3fb71e?_0x2e5cff['count']:_0x4dfecd[_0x533f('0x1d')]+_0x4dfecd['limit'];var _0x38f0a9;if(_0x49ade9>=_0x1b2d99){_0x49ade9=_0x1b2d99;_0x38f0a9=0xc8;}else{_0x38f0a9=0xce;}_0x1b9dde['status'](_0x38f0a9);return _0x1b9dde['set'](_0x533f('0x21'),_0x8ca430+'-'+_0x49ade9+'/'+_0x1b2d99)[_0x533f('0x1c')](_0x2e5cff);}return null;};}function patchUpdates(_0x1aee7d){return function(_0x45b1a7){try{jsonpatch[_0x533f('0x22')](_0x45b1a7,_0x1aee7d,!![]);}catch(_0x156de1){return BPromise[_0x533f('0x23')](_0x156de1);}return _0x45b1a7['save']();};}function saveUpdates(_0x2de428,_0x2dc653){return function(_0x258ca7){if(_0x258ca7){return _0x258ca7[_0x533f('0x24')](_0x2de428)[_0x533f('0x25')](function(_0x1d4b42){return _0x1d4b42;});}return null;};}function removeEntity(_0x362f17,_0x13ae58){return function(_0x24dbfb){if(_0x24dbfb){return _0x24dbfb[_0x533f('0x26')]()[_0x533f('0x25')](function(){_0x362f17[_0x533f('0x1a')](0xcc)[_0x533f('0x1b')]();});}};}function handleEntityNotFound(_0x2b5355,_0x3491b0){return function(_0x1b2b8f){if(!_0x1b2b8f){_0x2b5355[_0x533f('0x19')](0x194);}return _0x1b2b8f;};}function handleError(_0x50f8b2,_0xa262db){_0xa262db=_0xa262db||0x1f4;return function(_0x5a0bc5){logger[_0x533f('0x27')](_0x5a0bc5[_0x533f('0x28')]);if(_0x5a0bc5[_0x533f('0x29')]){delete _0x5a0bc5['name'];}_0x50f8b2[_0x533f('0x1a')](_0xa262db)[_0x533f('0x2a')](_0x5a0bc5);};}exports[_0x533f('0x2b')]=function(_0x296c6b,_0x5cc325){var _0x2bb7e4={},_0x1456b3={},_0x80c414={'count':0x0,'rows':[]};var _0x529177=_[_0x533f('0x2c')](db[_0x533f('0x2d')][_0x533f('0x2e')],function(_0x2ed15c){return{'name':_0x2ed15c[_0x533f('0x2f')],'type':_0x2ed15c['type'][_0x533f('0x30')]};});_0x1456b3[_0x533f('0x31')]=_['map'](_0x529177,_0x533f('0x29'));_0x1456b3['query']=_[_0x533f('0x32')](_0x296c6b[_0x533f('0x33')]);_0x1456b3[_0x533f('0x34')]=_[_0x533f('0x35')](_0x1456b3[_0x533f('0x31')],_0x1456b3[_0x533f('0x33')]);_0x2bb7e4[_0x533f('0x36')]=_[_0x533f('0x35')](_0x1456b3['model'],qs[_0x533f('0x37')](_0x296c6b[_0x533f('0x33')]['fields']));_0x2bb7e4['attributes']=_0x2bb7e4[_0x533f('0x36')][_0x533f('0x38')]?_0x2bb7e4[_0x533f('0x36')]:_0x1456b3[_0x533f('0x31')];if(!_0x296c6b[_0x533f('0x33')][_0x533f('0x39')](_0x533f('0x3a'))){_0x2bb7e4[_0x533f('0x1e')]=qs[_0x533f('0x1e')](_0x296c6b[_0x533f('0x33')]['limit']);_0x2bb7e4[_0x533f('0x1d')]=qs[_0x533f('0x1d')](_0x296c6b[_0x533f('0x33')][_0x533f('0x1d')]);}_0x2bb7e4[_0x533f('0x3b')]=qs[_0x533f('0x3c')](_0x296c6b[_0x533f('0x33')][_0x533f('0x3c')]);_0x2bb7e4[_0x533f('0x3d')]=qs['filters'](_[_0x533f('0x3e')](_0x296c6b[_0x533f('0x33')],_0x1456b3[_0x533f('0x34')]),_0x529177);if(_0x296c6b[_0x533f('0x33')]['filter']){_0x2bb7e4[_0x533f('0x3d')]=_['merge'](_0x2bb7e4[_0x533f('0x3d')],{'$or':_[_0x533f('0x2c')](_0x529177,function(_0x5ad575){if(_0x5ad575['type']!==_0x533f('0x3f')){var _0xd4c760={};_0xd4c760[_0x5ad575[_0x533f('0x29')]]={'$like':'%'+_0x296c6b[_0x533f('0x33')][_0x533f('0x40')]+'%'};return _0xd4c760;}})});}_0x2bb7e4=_['merge']({},_0x2bb7e4,_0x296c6b['options']);var _0x9f4c4a={'where':_0x2bb7e4[_0x533f('0x3d')]};return db[_0x533f('0x2d')][_0x533f('0x20')](_0x9f4c4a)[_0x533f('0x25')](function(_0x5ace43){_0x80c414[_0x533f('0x20')]=_0x5ace43;if(_0x296c6b[_0x533f('0x33')][_0x533f('0x41')]){_0x2bb7e4[_0x533f('0x42')]=[{'all':!![]}];}return db['VtigerAccount']['findAll'](_0x2bb7e4);})[_0x533f('0x25')](function(_0x311d1c){_0x80c414['rows']=_0x311d1c;return _0x80c414;})[_0x533f('0x25')](respondWithFilteredResult(_0x5cc325,_0x2bb7e4))[_0x533f('0x43')](handleError(_0x5cc325,null));};exports[_0x533f('0x44')]=function(_0x1fa800,_0x2ca6fa){var _0x5a3883={'raw':![],'where':{'id':_0x1fa800[_0x533f('0x45')]['id']}},_0x2c2ec3={};_0x2c2ec3[_0x533f('0x31')]=_[_0x533f('0x32')](db['VtigerAccount']['rawAttributes']);_0x2c2ec3[_0x533f('0x33')]=_[_0x533f('0x32')](_0x1fa800['query']);_0x2c2ec3['filters']=_[_0x533f('0x35')](_0x2c2ec3[_0x533f('0x31')],_0x2c2ec3['query']);_0x5a3883[_0x533f('0x36')]=_[_0x533f('0x35')](_0x2c2ec3['model'],qs[_0x533f('0x37')](_0x1fa800[_0x533f('0x33')][_0x533f('0x37')]));_0x5a3883[_0x533f('0x36')]=_0x5a3883[_0x533f('0x36')][_0x533f('0x38')]?_0x5a3883[_0x533f('0x36')]:_0x2c2ec3[_0x533f('0x31')];if(_0x1fa800[_0x533f('0x33')][_0x533f('0x41')]){_0x5a3883['include']=[{'all':!![]}];}_0x5a3883=_[_0x533f('0x46')]({},_0x5a3883,_0x1fa800[_0x533f('0x47')]);return db[_0x533f('0x2d')][_0x533f('0x48')](_0x5a3883)[_0x533f('0x25')](handleEntityNotFound(_0x2ca6fa,null))[_0x533f('0x25')](respondWithResult(_0x2ca6fa,null))['catch'](handleError(_0x2ca6fa,null));};exports[_0x533f('0x49')]=function(_0x23b6cf,_0x840aaa){return db['VtigerAccount'][_0x533f('0x49')](_0x23b6cf[_0x533f('0x4a')],{})['then'](respondWithResult(_0x840aaa,0xc9))[_0x533f('0x43')](handleError(_0x840aaa,null));};exports[_0x533f('0x24')]=function(_0x3b7575,_0xa8671e){if(_0x3b7575[_0x533f('0x4a')]['id']){delete _0x3b7575[_0x533f('0x4a')]['id'];}return db['VtigerAccount'][_0x533f('0x48')]({'where':{'id':_0x3b7575[_0x533f('0x45')]['id']}})[_0x533f('0x25')](handleEntityNotFound(_0xa8671e,null))[_0x533f('0x25')](saveUpdates(_0x3b7575[_0x533f('0x4a')],null))[_0x533f('0x25')](respondWithResult(_0xa8671e,null))[_0x533f('0x43')](handleError(_0xa8671e,null));};exports[_0x533f('0x26')]=function(_0x58b163,_0x3d3a24){return db['VtigerAccount'][_0x533f('0x48')]({'where':{'id':_0x58b163[_0x533f('0x45')]['id']}})[_0x533f('0x25')](handleEntityNotFound(_0x3d3a24,null))[_0x533f('0x25')](removeEntity(_0x3d3a24,null))[_0x533f('0x43')](handleError(_0x3d3a24,null));};exports['getConfigurations']=function(_0x3bc0be,_0x356a06,_0x317fa2){var _0x25cd95={};var _0x1ce9cd={};var _0x5284e9;var _0x2f5817;return db[_0x533f('0x2d')]['findOne']({'where':{'id':_0x3bc0be[_0x533f('0x45')]['id']}})[_0x533f('0x25')](handleEntityNotFound(_0x356a06,null))[_0x533f('0x25')](function(_0x59f628){if(_0x59f628){_0x5284e9=_0x59f628;_0x1ce9cd[_0x533f('0x31')]=_[_0x533f('0x32')](db['VtigerConfiguration'][_0x533f('0x2e')]);_0x1ce9cd[_0x533f('0x33')]=_[_0x533f('0x32')](_0x3bc0be[_0x533f('0x33')]);_0x1ce9cd[_0x533f('0x34')]=_[_0x533f('0x35')](_0x1ce9cd[_0x533f('0x31')],_0x1ce9cd[_0x533f('0x33')]);_0x25cd95[_0x533f('0x36')]=_[_0x533f('0x35')](_0x1ce9cd[_0x533f('0x31')],qs[_0x533f('0x37')](_0x3bc0be[_0x533f('0x33')]['fields']));_0x25cd95['attributes']=_0x25cd95[_0x533f('0x36')][_0x533f('0x38')]?_0x25cd95[_0x533f('0x36')]:_0x1ce9cd[_0x533f('0x31')];_0x25cd95[_0x533f('0x3b')]=qs['sort'](_0x3bc0be[_0x533f('0x33')][_0x533f('0x3c')]);_0x25cd95['where']=qs[_0x533f('0x34')](_[_0x533f('0x3e')](_0x3bc0be[_0x533f('0x33')],_0x1ce9cd[_0x533f('0x34')]));if(_0x3bc0be[_0x533f('0x33')][_0x533f('0x40')]){_0x25cd95[_0x533f('0x3d')]=_[_0x533f('0x46')](_0x25cd95[_0x533f('0x3d')],{'$or':_['map'](_0x25cd95[_0x533f('0x36')],function(_0x2ea4a5){var _0x1eb4b8={};_0x1eb4b8[_0x2ea4a5]={'$like':'%'+_0x3bc0be['query'][_0x533f('0x40')]+'%'};return _0x1eb4b8;})});}_0x25cd95=_[_0x533f('0x46')]({},_0x25cd95,_0x3bc0be[_0x533f('0x47')]);return _0x5284e9['getConfigurations'](_0x25cd95);}})['then'](function(_0x12a091){if(_0x12a091){_0x2f5817=_0x12a091[_0x533f('0x38')];if(!_0x3bc0be[_0x533f('0x33')]['hasOwnProperty']('nolimit')){_0x25cd95['limit']=qs[_0x533f('0x1e')](_0x3bc0be[_0x533f('0x33')][_0x533f('0x1e')]);_0x25cd95['offset']=qs['offset'](_0x3bc0be[_0x533f('0x33')]['offset']);}return _0x5284e9[_0x533f('0x4b')](_0x25cd95);}})[_0x533f('0x25')](function(_0x3a934c){if(_0x3a934c){return _0x3a934c?{'count':_0x2f5817,'rows':_0x3a934c}:null;}})[_0x533f('0x25')](respondWithResult(_0x356a06,null))[_0x533f('0x43')](handleError(_0x356a06,null));};exports[_0x533f('0x4c')]=function(_0x3106cb,_0x5df70d,_0x8250a0){if(_0x3106cb[_0x533f('0x4a')]['id']){delete _0x3106cb[_0x533f('0x4a')]['id'];}return db[_0x533f('0x2d')][_0x533f('0x4d')]({'where':{'id':_0x3106cb[_0x533f('0x45')]['id']}})['then'](handleEntityNotFound(_0x5df70d,null))[_0x533f('0x25')](function(_0x320fd4){if(_0x320fd4){_0x3106cb[_0x533f('0x4a')][_0x533f('0x4e')]=_0x320fd4['id'];_0x3106cb[_0x533f('0x4a')]['Subjects']=integrations[_0x533f('0x4f')](_0x3106cb[_0x533f('0x4a')][_0x533f('0x50')],_0x3106cb[_0x533f('0x4a')][_0x533f('0x51')]);_0x3106cb[_0x533f('0x4a')][_0x533f('0x52')]=integrations[_0x533f('0x53')](_0x3106cb['body'][_0x533f('0x50')],_0x3106cb[_0x533f('0x4a')]['type']);return db[_0x533f('0x54')][_0x533f('0x49')](_0x3106cb['body'],{'include':[{'model':db[_0x533f('0x55')],'as':_0x533f('0x56')},{'model':db[_0x533f('0x55')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x5df70d,null))[_0x533f('0x43')](handleError(_0x5df70d,null));};var md5=require(_0x533f('0x57'));exports[_0x533f('0x58')]=function(_0x36dfb1,_0x15c60c,_0x524727){var _0xd3b5db=null;var _0xc37763=null;var _0x37e7bc=null;var _0x15c16e=null;var _0x2765c1='';return db[_0x533f('0x2d')]['findOne']({'where':{'id':_0x36dfb1[_0x533f('0x45')]['id']},'attributes':['id',_0x533f('0x29'),_0x533f('0x59'),_0x533f('0x5a'),_0x533f('0x5b'),_0x533f('0x5c'),_0x533f('0x5d'),_0x533f('0x5e')]})[_0x533f('0x25')](handleEntityNotFound(_0x15c60c,null))['then'](function(_0x35485f){if(_0x35485f){_0xd3b5db=_0x35485f['username'];_0xc37763=_0x35485f[_0x533f('0x5e')];_0x37e7bc=_0x35485f[_0x533f('0x5b')];_0x2765c1=_0x35485f[_0x533f('0x5c')];var _0x356d90=_0x2765c1[_0x533f('0x5f')](-0x1);if(_0x356d90==='/'){_0x2765c1=_0x2765c1[_0x533f('0x60')](0x0,_0x2765c1[_0x533f('0x61')](_0x356d90));}_0x15c16e=util[_0x533f('0x62')]('%s/webservice.php',_0x2765c1);var _0x406f87={'method':_0x533f('0x63'),'uri':_0x15c16e,'qs':{'operation':_0x533f('0x64'),'username':_0x35485f['username']},'json':!![]};return rp(_0x406f87);}})[_0x533f('0x25')](function(_0x27fb7c){if(_0x27fb7c[_0x533f('0x65')]){var _0x1a43b4={'method':'POST','uri':_0x15c16e,'form':{'operation':'login','username':_0xd3b5db,'accessKey':md5(_0x27fb7c['result'][_0x533f('0x66')]+_0xc37763)},'json':!![]};return rp(_0x1a43b4);}})[_0x533f('0x25')](function(_0x1a5489){if(_0x1a5489['success']){var _0x19de03={'method':_0x533f('0x63'),'uri':_0x15c16e,'qs':{'operation':_0x533f('0x67'),'username':_0xd3b5db,'sessionName':_0x1a5489[_0x533f('0x68')][_0x533f('0x69')],'elementType':_0x37e7bc},'json':!![]};return rp(_0x19de03);}})['then'](function(_0x138e6b){if(_0x138e6b['success']){var _0x5f0a15=[_0x533f('0x6a'),_0x533f('0x6b'),_0x533f('0x6c')];_[_0x533f('0x6d')](_0x138e6b['result'][_0x533f('0x37')],function(_0x239c8c){return _0x5f0a15[_0x533f('0x6e')](_0x239c8c['type'][_0x533f('0x29')]);});_[_0x533f('0x6d')](_0x138e6b[_0x533f('0x68')][_0x533f('0x37')],function(_0x32577d){return _0x32577d['editable']===_0x533f('0x6f');});return{'count':_0x138e6b[_0x533f('0x68')]['fields']['length'],'rows':_[_0x533f('0x2c')](_0x138e6b['result'][_0x533f('0x37')],function(_0x40daca){return{'id':_0x40daca[_0x533f('0x29')],'name':_0x40daca[_0x533f('0x70')],'custom':_[_0x533f('0x71')](_0x40daca['name'],_0x533f('0x72'))?!![]:![],'options':_0x40daca[_0x533f('0x51')][_0x533f('0x29')]===_0x533f('0x73')&&_0x40daca['type'][_0x533f('0x74')][_0x533f('0x38')]>0x0?_[_0x533f('0x2c')](_0x40daca['type'][_0x533f('0x74')],function(_0x1e1692){return{'name':_0x1e1692[_0x533f('0x70')],'value':_0x1e1692['value']};}):[]};})};}})[_0x533f('0x25')](respondWithResult(_0x15c60c,null))[_0x533f('0x43')](function(_0x5bd8ed){console[_0x533f('0x75')](_0x533f('0x76')+_0x5bd8ed);var _0x293196=_0x36dfb1['query']['test']?0x1f4:_0x5bd8ed[_0x533f('0x77')]||0x1f4;logger[_0x533f('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0x533f('0x58'),_0x293196,JSON[_0x533f('0x78')](_0x5bd8ed));delete _0x5bd8ed[_0x533f('0x29')];if(_0x293196===0x191){_0x293196=0x190;}_0x15c60c[_0x533f('0x1a')](_0x293196)[_0x533f('0x2a')](_0x36dfb1['query'][_0x533f('0x79')]?{'message':'Wrong\x20credentials','statusCode':_0x5bd8ed[_0x533f('0x77')]}:_0x5bd8ed);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index b9d3819..cd882c9 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 _0x451e=['moment','bluebird','request-promise','path','../../components/integrations/configuration','define','int_vtiger_accounts','lodash','util','../../config/logger','api'];(function(_0x4695ba,_0x5a7f2a){var _0x524b7d=function(_0xfc9707){while(--_0xfc9707){_0x4695ba['push'](_0x4695ba['shift']());}};_0x524b7d(++_0x5a7f2a);}(_0x451e,0x11a));var _0xe451=function(_0x448930,_0x483327){_0x448930=_0x448930-0x0;var _0x20e03a=_0x451e[_0x448930];return _0x20e03a;};'use strict';var _=require(_0xe451('0x0'));var util=require(_0xe451('0x1'));var logger=require(_0xe451('0x2'))(_0xe451('0x3'));var moment=require(_0xe451('0x4'));var BPromise=require(_0xe451('0x5'));var rp=require(_0xe451('0x6'));var fs=require('fs');var path=require(_0xe451('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0xe451('0x8'));module['exports']=function(_0x5452f,_0x16bdbc){return _0x5452f[_0xe451('0x9')]('VtigerAccount',attributes,{'tableName':_0xe451('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8514=['moment','bluebird','path','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','define','int_vtiger_accounts','lodash','util','../../config/logger'];(function(_0x5d69e1,_0x745b0){var _0x57839c=function(_0x89ac42){while(--_0x89ac42){_0x5d69e1['push'](_0x5d69e1['shift']());}};_0x57839c(++_0x745b0);}(_0x8514,0x1b5));var _0x4851=function(_0x41d831,_0x1b0b64){_0x41d831=_0x41d831-0x0;var _0x121e51=_0x8514[_0x41d831];return _0x121e51;};'use strict';var _=require(_0x4851('0x0'));var util=require(_0x4851('0x1'));var logger=require(_0x4851('0x2'))('api');var moment=require(_0x4851('0x3'));var BPromise=require(_0x4851('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4851('0x5'));var rimraf=require('rimraf');var config=require(_0x4851('0x6'));var attributes=require(_0x4851('0x7'));var integrations=require(_0x4851('0x8'));module['exports']=function(_0x1a50b6,_0x4f7642){return _0x1a50b6[_0x4851('0x9')]('VtigerAccount',attributes,{'tableName':_0x4851('0xa'),'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 87de826..ce59511 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 _0xa478=['info','request\x20sent','debug','error','code','message','VtigerAccount,\x20%s,\x20%s','result','catch','GetVtigerAccount','findAll','options','raw','where','attributes','include','map','model','VtigerAccount','find','ShowVtigerAccount','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then'];(function(_0x5364a4,_0x16f25f){var _0x5bb9fc=function(_0x32531a){while(--_0x32531a){_0x5364a4['push'](_0x5364a4['shift']());}};_0x5bb9fc(++_0x16f25f);}(_0xa478,0x136));var _0x8a47=function(_0x50a463,_0x517a1a){_0x50a463=_0x50a463-0x0;var _0x2971df=_0xa478[_0x50a463];return _0x2971df;};'use strict';var _=require(_0x8a47('0x0'));var util=require(_0x8a47('0x1'));var moment=require(_0x8a47('0x2'));var BPromise=require(_0x8a47('0x3'));var rs=require(_0x8a47('0x4'));var fs=require('fs');var Redis=require(_0x8a47('0x5'));var db=require(_0x8a47('0x6'))['db'];var utils=require(_0x8a47('0x7'));var logger=require(_0x8a47('0x8'))(_0x8a47('0x9'));var config=require(_0x8a47('0xa'));var jayson=require(_0x8a47('0xb'));var client=jayson['client'][_0x8a47('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2d62a6,_0x3de815,_0x3cb340){return new BPromise(function(_0x56884b,_0x384886){return client['request'](_0x2d62a6,_0x3cb340)[_0x8a47('0xd')](function(_0x369fc9){logger[_0x8a47('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x3de815,_0x8a47('0xf'));logger[_0x8a47('0x10')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x3de815,_0x8a47('0xf'),JSON['stringify'](_0x369fc9));if(_0x369fc9[_0x8a47('0x11')]){if(_0x369fc9[_0x8a47('0x11')][_0x8a47('0x12')]===0x1f4){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x3de815,_0x369fc9['error'][_0x8a47('0x13')]);return _0x384886(_0x369fc9[_0x8a47('0x11')]['message']);}logger[_0x8a47('0x11')](_0x8a47('0x14'),_0x3de815,_0x369fc9[_0x8a47('0x11')][_0x8a47('0x13')]);return _0x56884b(_0x369fc9[_0x8a47('0x11')][_0x8a47('0x13')]);}else{logger[_0x8a47('0xe')](_0x8a47('0x14'),_0x3de815,_0x8a47('0xf'));_0x56884b(_0x369fc9[_0x8a47('0x15')][_0x8a47('0x13')]);}})[_0x8a47('0x16')](function(_0x2917d9){logger['error'](_0x8a47('0x14'),_0x3de815,_0x2917d9);_0x384886(_0x2917d9);});});}exports[_0x8a47('0x17')]=function(_0x3f9093){var _0x5f5884=this;return new Promise(function(_0x341089,_0x5c62eb){return db['VtigerAccount'][_0x8a47('0x18')]({'raw':_0x3f9093[_0x8a47('0x19')]?_0x3f9093[_0x8a47('0x19')][_0x8a47('0x1a')]===undefined?!![]:![]:!![],'where':_0x3f9093[_0x8a47('0x19')]?_0x3f9093[_0x8a47('0x19')][_0x8a47('0x1b')]||null:null,'attributes':_0x3f9093[_0x8a47('0x19')]?_0x3f9093[_0x8a47('0x19')][_0x8a47('0x1c')]||null:null,'limit':_0x3f9093['options']?_0x3f9093[_0x8a47('0x19')]['limit']||null:null,'include':_0x3f9093[_0x8a47('0x19')]?_0x3f9093[_0x8a47('0x19')][_0x8a47('0x1d')]?_[_0x8a47('0x1e')](_0x3f9093['options'][_0x8a47('0x1d')],function(_0x5ae186){return{'model':db[_0x5ae186['model']],'as':_0x5ae186['as'],'attributes':_0x5ae186['attributes'],'include':_0x5ae186['include']?_[_0x8a47('0x1e')](_0x5ae186[_0x8a47('0x1d')],function(_0x5bed3e){return{'model':db[_0x5bed3e[_0x8a47('0x1f')]],'as':_0x5bed3e['as'],'attributes':_0x5bed3e[_0x8a47('0x1c')],'include':_0x5bed3e[_0x8a47('0x1d')]?_[_0x8a47('0x1e')](_0x5bed3e[_0x8a47('0x1d')],function(_0xd06be6){return{'model':db[_0xd06be6[_0x8a47('0x1f')]],'as':_0xd06be6['as'],'attributes':_0xd06be6['attributes']};}):[]};}):[]};}):[]:[]})[_0x8a47('0xd')](function(_0x4a10c3){logger[_0x8a47('0xe')](_0x8a47('0x17'),_0x3f9093);logger['debug'](_0x8a47('0x17'),_0x3f9093,JSON['stringify'](_0x4a10c3));_0x341089(_0x4a10c3);})['catch'](function(_0x12470a){logger[_0x8a47('0x11')](_0x8a47('0x17'),_0x12470a[_0x8a47('0x13')],_0x3f9093);_0x5c62eb(_0x5f5884[_0x8a47('0x11')](0x1f4,_0x12470a[_0x8a47('0x13')]));});});};exports['ShowVtigerAccount']=function(_0x353576){var _0x4d78b5=this;return new Promise(function(_0x549913,_0x448459){return db[_0x8a47('0x20')][_0x8a47('0x21')]({'raw':_0x353576[_0x8a47('0x19')]?_0x353576[_0x8a47('0x19')][_0x8a47('0x1a')]===undefined?!![]:![]:!![],'where':_0x353576[_0x8a47('0x19')]?_0x353576[_0x8a47('0x19')][_0x8a47('0x1b')]||null:null,'attributes':_0x353576[_0x8a47('0x19')]?_0x353576['options'][_0x8a47('0x1c')]||null:null,'include':_0x353576[_0x8a47('0x19')]?_0x353576[_0x8a47('0x19')]['include']?_[_0x8a47('0x1e')](_0x353576[_0x8a47('0x19')]['include'],function(_0xa1a852){return{'model':db[_0xa1a852[_0x8a47('0x1f')]],'as':_0xa1a852['as'],'attributes':_0xa1a852[_0x8a47('0x1c')],'include':_0xa1a852[_0x8a47('0x1d')]?_['map'](_0xa1a852['include'],function(_0x145908){return{'model':db[_0x145908[_0x8a47('0x1f')]],'as':_0x145908['as'],'attributes':_0x145908[_0x8a47('0x1c')],'include':_0x145908[_0x8a47('0x1d')]?_[_0x8a47('0x1e')](_0x145908[_0x8a47('0x1d')],function(_0x1819ef){return{'model':db[_0x1819ef['model']],'as':_0x1819ef['as'],'attributes':_0x1819ef['attributes']};}):[]};}):[]};}):[]:[]})[_0x8a47('0xd')](function(_0x3636af){logger[_0x8a47('0xe')](_0x8a47('0x22'),_0x353576);logger[_0x8a47('0x10')](_0x8a47('0x22'),_0x353576,JSON[_0x8a47('0x23')](_0x3636af));_0x549913(_0x3636af);})[_0x8a47('0x16')](function(_0xe178f1){logger[_0x8a47('0x11')](_0x8a47('0x22'),_0xe178f1['message'],_0x353576);_0x448459(_0x4d78b5[_0x8a47('0x11')](0x1f4,_0xe178f1['message']));});});}; \ No newline at end of file +var _0x153f=['GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowVtigerAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x2e650a,_0x43c477){var _0xab7c2d=function(_0x4cc07d){while(--_0x4cc07d){_0x2e650a['push'](_0x2e650a['shift']());}};_0xab7c2d(++_0x43c477);}(_0x153f,0x15b));var _0xf153=function(_0x33b0c6,_0x5e14a7){_0x33b0c6=_0x33b0c6-0x0;var _0x2d39f3=_0x153f[_0x33b0c6];return _0x2d39f3;};'use strict';var _=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var moment=require(_0xf153('0x2'));var BPromise=require(_0xf153('0x3'));var rs=require(_0xf153('0x4'));var fs=require('fs');var Redis=require(_0xf153('0x5'));var db=require(_0xf153('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf153('0x7'))('rpc');var config=require(_0xf153('0x8'));var jayson=require(_0xf153('0x9'));var client=jayson[_0xf153('0xa')][_0xf153('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21f432,_0x4c8ae5,_0x17ba96){return new BPromise(function(_0x143497,_0x224f88){return client[_0xf153('0xc')](_0x21f432,_0x17ba96)[_0xf153('0xd')](function(_0x3e7a82){logger[_0xf153('0xe')](_0xf153('0xf'),_0x4c8ae5,_0xf153('0x10'));logger[_0xf153('0x11')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x4c8ae5,_0xf153('0x10'),JSON[_0xf153('0x12')](_0x3e7a82));if(_0x3e7a82[_0xf153('0x13')]){if(_0x3e7a82['error'][_0xf153('0x14')]===0x1f4){logger[_0xf153('0x13')](_0xf153('0xf'),_0x4c8ae5,_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);return _0x224f88(_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);}logger[_0xf153('0x13')](_0xf153('0xf'),_0x4c8ae5,_0x3e7a82['error'][_0xf153('0x15')]);return _0x143497(_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);}else{logger[_0xf153('0xe')](_0xf153('0xf'),_0x4c8ae5,_0xf153('0x10'));_0x143497(_0x3e7a82[_0xf153('0x16')][_0xf153('0x15')]);}})['catch'](function(_0x35f4e8){logger['error'](_0xf153('0xf'),_0x4c8ae5,_0x35f4e8);_0x224f88(_0x35f4e8);});});}exports[_0xf153('0x17')]=function(_0x138dbe){var _0x44272e=this;return new Promise(function(_0x4e790d,_0x357d57){return db[_0xf153('0x18')][_0xf153('0x19')]({'raw':_0x138dbe[_0xf153('0x1a')]?_0x138dbe[_0xf153('0x1a')][_0xf153('0x1b')]===undefined?!![]:![]:!![],'where':_0x138dbe[_0xf153('0x1a')]?_0x138dbe[_0xf153('0x1a')][_0xf153('0x1c')]||null:null,'attributes':_0x138dbe[_0xf153('0x1a')]?_0x138dbe[_0xf153('0x1a')][_0xf153('0x1d')]||null:null,'limit':_0x138dbe['options']?_0x138dbe[_0xf153('0x1a')][_0xf153('0x1e')]||null:null,'include':_0x138dbe[_0xf153('0x1a')]?_0x138dbe[_0xf153('0x1a')][_0xf153('0x1f')]?_[_0xf153('0x20')](_0x138dbe[_0xf153('0x1a')][_0xf153('0x1f')],function(_0xf67cde){return{'model':db[_0xf67cde[_0xf153('0x21')]],'as':_0xf67cde['as'],'attributes':_0xf67cde[_0xf153('0x1d')],'include':_0xf67cde[_0xf153('0x1f')]?_[_0xf153('0x20')](_0xf67cde[_0xf153('0x1f')],function(_0xe490f8){return{'model':db[_0xe490f8[_0xf153('0x21')]],'as':_0xe490f8['as'],'attributes':_0xe490f8[_0xf153('0x1d')],'include':_0xe490f8[_0xf153('0x1f')]?_[_0xf153('0x20')](_0xe490f8[_0xf153('0x1f')],function(_0x48ebdc){return{'model':db[_0x48ebdc[_0xf153('0x21')]],'as':_0x48ebdc['as'],'attributes':_0x48ebdc[_0xf153('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x16cdcd){logger[_0xf153('0xe')]('GetVtigerAccount',_0x138dbe);logger[_0xf153('0x11')](_0xf153('0x17'),_0x138dbe,JSON[_0xf153('0x12')](_0x16cdcd));_0x4e790d(_0x16cdcd);})[_0xf153('0x22')](function(_0x339e96){logger[_0xf153('0x13')](_0xf153('0x17'),_0x339e96[_0xf153('0x15')],_0x138dbe);_0x357d57(_0x44272e[_0xf153('0x13')](0x1f4,_0x339e96[_0xf153('0x15')]));});});};exports[_0xf153('0x23')]=function(_0x415a5f){var _0x5b5237=this;return new Promise(function(_0x258fb0,_0xbb3619){return db[_0xf153('0x18')][_0xf153('0x24')]({'raw':_0x415a5f['options']?_0x415a5f['options'][_0xf153('0x1b')]===undefined?!![]:![]:!![],'where':_0x415a5f['options']?_0x415a5f['options'][_0xf153('0x1c')]||null:null,'attributes':_0x415a5f['options']?_0x415a5f[_0xf153('0x1a')]['attributes']||null:null,'include':_0x415a5f[_0xf153('0x1a')]?_0x415a5f[_0xf153('0x1a')]['include']?_[_0xf153('0x20')](_0x415a5f[_0xf153('0x1a')][_0xf153('0x1f')],function(_0x40be52){return{'model':db[_0x40be52[_0xf153('0x21')]],'as':_0x40be52['as'],'attributes':_0x40be52[_0xf153('0x1d')],'include':_0x40be52['include']?_[_0xf153('0x20')](_0x40be52['include'],function(_0x40834b){return{'model':db[_0x40834b[_0xf153('0x21')]],'as':_0x40834b['as'],'attributes':_0x40834b[_0xf153('0x1d')],'include':_0x40834b[_0xf153('0x1f')]?_[_0xf153('0x20')](_0x40834b[_0xf153('0x1f')],function(_0x4becf3){return{'model':db[_0x4becf3[_0xf153('0x21')]],'as':_0x4becf3['as'],'attributes':_0x4becf3[_0xf153('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf153('0xd')](function(_0x4e0634){logger[_0xf153('0xe')](_0xf153('0x23'),_0x415a5f);logger[_0xf153('0x11')](_0xf153('0x23'),_0x415a5f,JSON[_0xf153('0x12')](_0x4e0634));_0x258fb0(_0x4e0634);})[_0xf153('0x22')](function(_0x4cc481){logger[_0xf153('0x13')](_0xf153('0x23'),_0x4cc481['message'],_0x415a5f);_0xbb3619(_0x5b5237[_0xf153('0x13')](0x1f4,_0x4cc481[_0xf153('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index ccc2a01..d485b92 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 _0x02e9=['./intVtigerConfiguration.controller','get','/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','update','delete','exports','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1afd2c,_0x3e27a1){var _0x5d685c=function(_0x4caa6f){while(--_0x4caa6f){_0x1afd2c['push'](_0x1afd2c['shift']());}};_0x5d685c(++_0x3e27a1);}(_0x02e9,0x162));var _0x902e=function(_0x10414e,_0x4ec9f4){_0x10414e=_0x10414e-0x0;var _0x155f8f=_0x02e9[_0x10414e];return _0x155f8f;};'use strict';var multer=require('multer');var util=require(_0x902e('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x902e('0x1'));var router=express['Router']();var fs_extra=require(_0x902e('0x2'));var auth=require(_0x902e('0x3'));var interaction=require(_0x902e('0x4'));var config=require(_0x902e('0x5'));var controller=require(_0x902e('0x6'));router[_0x902e('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x902e('0x7')](_0x902e('0x8'),auth[_0x902e('0x9')](),controller['show']);router[_0x902e('0x7')](_0x902e('0xa'),auth[_0x902e('0x9')](),controller[_0x902e('0xb')]);router[_0x902e('0x7')](_0x902e('0xc'),auth[_0x902e('0x9')](),controller[_0x902e('0xd')]);router['get']('/:id/descriptions',auth[_0x902e('0x9')](),controller[_0x902e('0xe')]);router[_0x902e('0xf')]('/',auth[_0x902e('0x9')](),controller[_0x902e('0x10')]);router['put'](_0x902e('0x8'),auth['isAuthenticated'](),controller[_0x902e('0x11')]);router[_0x902e('0x12')]('/:id',auth[_0x902e('0x9')](),controller['destroy']);module[_0x902e('0x13')]=router; \ No newline at end of file +var _0x54e9=['getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0x7af3a5,_0x23a349){var _0x3c1458=function(_0x39c153){while(--_0x39c153){_0x7af3a5['push'](_0x7af3a5['shift']());}};_0x3c1458(++_0x23a349);}(_0x54e9,0xb9));var _0x954e=function(_0x1ec12f,_0x38a321){_0x1ec12f=_0x1ec12f-0x0;var _0xa3c073=_0x54e9[_0x1ec12f];return _0xa3c073;};'use strict';var multer=require(_0x954e('0x0'));var util=require(_0x954e('0x1'));var path=require(_0x954e('0x2'));var timeout=require(_0x954e('0x3'));var express=require(_0x954e('0x4'));var router=express[_0x954e('0x5')]();var fs_extra=require(_0x954e('0x6'));var auth=require(_0x954e('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x954e('0x8'));var controller=require('./intVtigerConfiguration.controller');router[_0x954e('0x9')]('/',auth[_0x954e('0xa')](),controller[_0x954e('0xb')]);router[_0x954e('0x9')](_0x954e('0xc'),auth[_0x954e('0xa')](),controller[_0x954e('0xd')]);router['get'](_0x954e('0xe'),auth[_0x954e('0xa')](),controller[_0x954e('0xf')]);router['get'](_0x954e('0x10'),auth[_0x954e('0xa')](),controller['getSubjects']);router[_0x954e('0x9')](_0x954e('0x11'),auth['isAuthenticated'](),controller[_0x954e('0x12')]);router[_0x954e('0x13')]('/',auth[_0x954e('0xa')](),controller[_0x954e('0x14')]);router[_0x954e('0x15')](_0x954e('0xc'),auth[_0x954e('0xa')](),controller[_0x954e('0x16')]);router[_0x954e('0x17')]('/:id',auth[_0x954e('0xa')](),controller[_0x954e('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 8ed4149..a47781c 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 _0x0bc8=['STRING','sequelize','exports'];(function(_0x59c764,_0x4b4a51){var _0x4e3290=function(_0x3ac72f){while(--_0x3ac72f){_0x59c764['push'](_0x59c764['shift']());}};_0x4e3290(++_0x4b4a51);}(_0x0bc8,0x1a5));var _0x80bc=function(_0x5a27d7,_0x564f00){_0x5a27d7=_0x5a27d7-0x0;var _0xea57d8=_0x0bc8[_0x5a27d7];return _0xea57d8;};'use strict';var Sequelize=require(_0x80bc('0x0'));module[_0x80bc('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x80bc('0x2')]}}; \ No newline at end of file +var _0xb7f8=['sequelize','exports','STRING'];(function(_0x2ad941,_0xd0ce1f){var _0x34fbcb=function(_0x378669){while(--_0x378669){_0x2ad941['push'](_0x2ad941['shift']());}};_0x34fbcb(++_0xd0ce1f);}(_0xb7f8,0x189));var _0x8b7f=function(_0x335ed9,_0x36192c){_0x335ed9=_0x335ed9-0x0;var _0x5e400e=_0xb7f8[_0x335ed9];return _0x5e400e;};'use strict';var Sequelize=require(_0x8b7f('0x0'));module[_0x8b7f('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8b7f('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 38f76b1..7e12bea 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 _0xa15b=['order','sort','pick','where','merge','filter','VtigerConfiguration','includeAll','include','catch','show','params','keys','find','create','body','getFields','findOne','VtigerField','length','nolimit','getSubjects','options','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','destroy','then','end','sendStatus','name','send','index','rawAttributes','type','key','model','map','query','filters','intersection','fields','attributes','hasOwnProperty'];(function(_0x453bd0,_0x334575){var _0x422c87=function(_0x24e8e7){while(--_0x24e8e7){_0x453bd0['push'](_0x453bd0['shift']());}};_0x422c87(++_0x334575);}(_0xa15b,0x1e6));var _0xba15=function(_0x389fd7,_0x35a786){_0x389fd7=_0x389fd7-0x0;var _0x3d1f7e=_0xa15b[_0x389fd7];return _0x3d1f7e;};'use strict';var emlformat=require(_0xba15('0x0'));var rimraf=require(_0xba15('0x1'));var zipdir=require(_0xba15('0x2'));var jsonpatch=require(_0xba15('0x3'));var rp=require(_0xba15('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xba15('0x5'));var util=require(_0xba15('0x6'));var path=require(_0xba15('0x7'));var sox=require(_0xba15('0x8'));var csv=require(_0xba15('0x9'));var ejs=require(_0xba15('0xa'));var fs=require('fs');var fs_extra=require(_0xba15('0xb'));var _=require(_0xba15('0xc'));var squel=require(_0xba15('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xba15('0xe'));var toCsv=require(_0xba15('0x9'));var querystring=require(_0xba15('0xf'));var Papa=require(_0xba15('0x10'));var Redis=require(_0xba15('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xba15('0x12'));var logger=require(_0xba15('0x13'))(_0xba15('0x14'));var utils=require('../../config/utils');var config=require(_0xba15('0x15'));var licenseUtil=require(_0xba15('0x16'));var db=require(_0xba15('0x17'))['db'];function respondWithStatusCode(_0x112e51,_0x2bd012){_0x2bd012=_0x2bd012||0xcc;return function(_0x53d830){if(_0x53d830){return _0x112e51['sendStatus'](_0x2bd012);}return _0x112e51[_0xba15('0x18')](_0x2bd012)['end']();};}function respondWithResult(_0x2ab799,_0x31a23a){_0x31a23a=_0x31a23a||0xc8;return function(_0x4f5f61){if(_0x4f5f61){return _0x2ab799[_0xba15('0x18')](_0x31a23a)[_0xba15('0x19')](_0x4f5f61);}};}function respondWithFilteredResult(_0x224c5b,_0x231051){return function(_0x152a79){if(_0x152a79){var _0x556e1f=typeof _0x231051['offset']===_0xba15('0x1a')&&typeof _0x231051[_0xba15('0x1b')]===_0xba15('0x1a');var _0x640ade=_0x152a79[_0xba15('0x1c')];var _0x3bf15e=_0x556e1f?0x0:_0x231051[_0xba15('0x1d')];var _0x244347=_0x556e1f?_0x152a79[_0xba15('0x1c')]:_0x231051[_0xba15('0x1d')]+_0x231051[_0xba15('0x1b')];var _0x2e14b4;if(_0x244347>=_0x640ade){_0x244347=_0x640ade;_0x2e14b4=0xc8;}else{_0x2e14b4=0xce;}_0x224c5b['status'](_0x2e14b4);return _0x224c5b['set'](_0xba15('0x1e'),_0x3bf15e+'-'+_0x244347+'/'+_0x640ade)[_0xba15('0x19')](_0x152a79);}return null;};}function patchUpdates(_0x11f604){return function(_0x306965){try{jsonpatch[_0xba15('0x1f')](_0x306965,_0x11f604,!![]);}catch(_0x346b9a){return BPromise[_0xba15('0x20')](_0x346b9a);}return _0x306965[_0xba15('0x21')]();};}function saveUpdates(_0x6576e6,_0x557d63){return function(_0x22d06f){if(_0x22d06f){return _0x22d06f[_0xba15('0x22')](_0x6576e6)['then'](function(_0x26b713){return _0x26b713;});}return null;};}function removeEntity(_0xfe42f8,_0x19e86d){return function(_0x5f2d36){if(_0x5f2d36){return _0x5f2d36[_0xba15('0x23')]()[_0xba15('0x24')](function(){_0xfe42f8[_0xba15('0x18')](0xcc)[_0xba15('0x25')]();});}};}function handleEntityNotFound(_0x530383,_0x1ea440){return function(_0x55e038){if(!_0x55e038){_0x530383[_0xba15('0x26')](0x194);}return _0x55e038;};}function handleError(_0x17f653,_0x3aa75c){_0x3aa75c=_0x3aa75c||0x1f4;return function(_0x2adb25){logger['error'](_0x2adb25['stack']);if(_0x2adb25[_0xba15('0x27')]){delete _0x2adb25['name'];}_0x17f653[_0xba15('0x18')](_0x3aa75c)[_0xba15('0x28')](_0x2adb25);};}exports[_0xba15('0x29')]=function(_0xbda9e5,_0x3d3de4){var _0x3965e9={},_0x46ce0e={},_0x53fa05={'count':0x0,'rows':[]};var _0x12344b=_['map'](db['VtigerConfiguration'][_0xba15('0x2a')],function(_0x4b624a){return{'name':_0x4b624a['fieldName'],'type':_0x4b624a[_0xba15('0x2b')][_0xba15('0x2c')]};});_0x46ce0e[_0xba15('0x2d')]=_[_0xba15('0x2e')](_0x12344b,'name');_0x46ce0e['query']=_['keys'](_0xbda9e5[_0xba15('0x2f')]);_0x46ce0e[_0xba15('0x30')]=_[_0xba15('0x31')](_0x46ce0e['model'],_0x46ce0e[_0xba15('0x2f')]);_0x3965e9['attributes']=_['intersection'](_0x46ce0e[_0xba15('0x2d')],qs[_0xba15('0x32')](_0xbda9e5['query'][_0xba15('0x32')]));_0x3965e9[_0xba15('0x33')]=_0x3965e9[_0xba15('0x33')]['length']?_0x3965e9['attributes']:_0x46ce0e[_0xba15('0x2d')];if(!_0xbda9e5['query'][_0xba15('0x34')]('nolimit')){_0x3965e9['limit']=qs[_0xba15('0x1b')](_0xbda9e5['query'][_0xba15('0x1b')]);_0x3965e9[_0xba15('0x1d')]=qs[_0xba15('0x1d')](_0xbda9e5[_0xba15('0x2f')][_0xba15('0x1d')]);}_0x3965e9[_0xba15('0x35')]=qs[_0xba15('0x36')](_0xbda9e5[_0xba15('0x2f')][_0xba15('0x36')]);_0x3965e9['where']=qs[_0xba15('0x30')](_[_0xba15('0x37')](_0xbda9e5['query'],_0x46ce0e[_0xba15('0x30')]),_0x12344b);if(_0xbda9e5[_0xba15('0x2f')]['filter']){_0x3965e9[_0xba15('0x38')]=_[_0xba15('0x39')](_0x3965e9[_0xba15('0x38')],{'$or':_[_0xba15('0x2e')](_0x12344b,function(_0x29d560){if(_0x29d560[_0xba15('0x2b')]!=='VIRTUAL'){var _0x3ae369={};_0x3ae369[_0x29d560[_0xba15('0x27')]]={'$like':'%'+_0xbda9e5[_0xba15('0x2f')][_0xba15('0x3a')]+'%'};return _0x3ae369;}})});}_0x3965e9=_[_0xba15('0x39')]({},_0x3965e9,_0xbda9e5['options']);var _0x424451={'where':_0x3965e9[_0xba15('0x38')]};return db[_0xba15('0x3b')][_0xba15('0x1c')](_0x424451)[_0xba15('0x24')](function(_0x3ac4e2){_0x53fa05[_0xba15('0x1c')]=_0x3ac4e2;if(_0xbda9e5[_0xba15('0x2f')][_0xba15('0x3c')]){_0x3965e9[_0xba15('0x3d')]=[{'all':!![]}];}return db[_0xba15('0x3b')]['findAll'](_0x3965e9);})[_0xba15('0x24')](function(_0x9a9180){_0x53fa05['rows']=_0x9a9180;return _0x53fa05;})['then'](respondWithFilteredResult(_0x3d3de4,_0x3965e9))[_0xba15('0x3e')](handleError(_0x3d3de4,null));};exports[_0xba15('0x3f')]=function(_0x8b8482,_0x90261e){var _0x400314={'raw':![],'where':{'id':_0x8b8482[_0xba15('0x40')]['id']}},_0x4c36db={};_0x4c36db[_0xba15('0x2d')]=_[_0xba15('0x41')](db['VtigerConfiguration']['rawAttributes']);_0x4c36db[_0xba15('0x2f')]=_[_0xba15('0x41')](_0x8b8482[_0xba15('0x2f')]);_0x4c36db[_0xba15('0x30')]=_[_0xba15('0x31')](_0x4c36db[_0xba15('0x2d')],_0x4c36db[_0xba15('0x2f')]);_0x400314[_0xba15('0x33')]=_[_0xba15('0x31')](_0x4c36db['model'],qs[_0xba15('0x32')](_0x8b8482[_0xba15('0x2f')][_0xba15('0x32')]));_0x400314[_0xba15('0x33')]=_0x400314['attributes']['length']?_0x400314[_0xba15('0x33')]:_0x4c36db[_0xba15('0x2d')];if(_0x8b8482[_0xba15('0x2f')][_0xba15('0x3c')]){_0x400314[_0xba15('0x3d')]=[{'all':!![]}];}_0x400314=_[_0xba15('0x39')]({},_0x400314,_0x8b8482['options']);return db[_0xba15('0x3b')][_0xba15('0x42')](_0x400314)[_0xba15('0x24')](handleEntityNotFound(_0x90261e,null))[_0xba15('0x24')](respondWithResult(_0x90261e,null))[_0xba15('0x3e')](handleError(_0x90261e,null));};exports[_0xba15('0x43')]=function(_0x423b8e,_0x5ba399){return db[_0xba15('0x3b')][_0xba15('0x43')](_0x423b8e[_0xba15('0x44')],{})[_0xba15('0x24')](respondWithResult(_0x5ba399,0xc9))[_0xba15('0x3e')](handleError(_0x5ba399,null));};exports[_0xba15('0x22')]=function(_0x4e02a0,_0x335c26){if(_0x4e02a0['body']['id']){delete _0x4e02a0[_0xba15('0x44')]['id'];}return db[_0xba15('0x3b')][_0xba15('0x42')]({'where':{'id':_0x4e02a0[_0xba15('0x40')]['id']}})['then'](handleEntityNotFound(_0x335c26,null))[_0xba15('0x24')](saveUpdates(_0x4e02a0['body'],null))[_0xba15('0x24')](respondWithResult(_0x335c26,null))['catch'](handleError(_0x335c26,null));};exports['destroy']=function(_0x1e3920,_0x3354d2){return db[_0xba15('0x3b')][_0xba15('0x42')]({'where':{'id':_0x1e3920[_0xba15('0x40')]['id']}})[_0xba15('0x24')](handleEntityNotFound(_0x3354d2,null))[_0xba15('0x24')](removeEntity(_0x3354d2,null))[_0xba15('0x3e')](handleError(_0x3354d2,null));};exports[_0xba15('0x45')]=function(_0x271388,_0x117a7d,_0x34185a){var _0x25a37c={};var _0x28144b={};var _0x33b9a8;var _0x59397f;return db['VtigerConfiguration'][_0xba15('0x46')]({'where':{'id':_0x271388[_0xba15('0x40')]['id']}})[_0xba15('0x24')](handleEntityNotFound(_0x117a7d,null))[_0xba15('0x24')](function(_0x2e2b80){if(_0x2e2b80){_0x33b9a8=_0x2e2b80;_0x28144b[_0xba15('0x2d')]=_['keys'](db[_0xba15('0x47')][_0xba15('0x2a')]);_0x28144b[_0xba15('0x2f')]=_[_0xba15('0x41')](_0x271388['query']);_0x28144b[_0xba15('0x30')]=_[_0xba15('0x31')](_0x28144b[_0xba15('0x2d')],_0x28144b[_0xba15('0x2f')]);_0x25a37c['attributes']=_[_0xba15('0x31')](_0x28144b['model'],qs[_0xba15('0x32')](_0x271388[_0xba15('0x2f')][_0xba15('0x32')]));_0x25a37c[_0xba15('0x33')]=_0x25a37c['attributes'][_0xba15('0x48')]?_0x25a37c['attributes']:_0x28144b[_0xba15('0x2d')];_0x25a37c[_0xba15('0x35')]=qs[_0xba15('0x36')](_0x271388[_0xba15('0x2f')][_0xba15('0x36')]);_0x25a37c[_0xba15('0x38')]=qs[_0xba15('0x30')](_[_0xba15('0x37')](_0x271388['query'],_0x28144b[_0xba15('0x30')]));if(_0x271388[_0xba15('0x2f')][_0xba15('0x3a')]){_0x25a37c[_0xba15('0x38')]=_[_0xba15('0x39')](_0x25a37c['where'],{'$or':_[_0xba15('0x2e')](_0x25a37c[_0xba15('0x33')],function(_0x58592b){var _0x37c033={};_0x37c033[_0x58592b]={'$like':'%'+_0x271388[_0xba15('0x2f')]['filter']+'%'};return _0x37c033;})});}_0x25a37c=_[_0xba15('0x39')]({},_0x25a37c,_0x271388['options']);return _0x33b9a8[_0xba15('0x45')](_0x25a37c);}})[_0xba15('0x24')](function(_0x168924){if(_0x168924){_0x59397f=_0x168924[_0xba15('0x48')];if(!_0x271388[_0xba15('0x2f')][_0xba15('0x34')](_0xba15('0x49'))){_0x25a37c['limit']=qs[_0xba15('0x1b')](_0x271388[_0xba15('0x2f')][_0xba15('0x1b')]);_0x25a37c[_0xba15('0x1d')]=qs[_0xba15('0x1d')](_0x271388[_0xba15('0x2f')][_0xba15('0x1d')]);}return _0x33b9a8[_0xba15('0x45')](_0x25a37c);}})[_0xba15('0x24')](function(_0x33a2dd){if(_0x33a2dd){return _0x33a2dd?{'count':_0x59397f,'rows':_0x33a2dd}:null;}})['then'](respondWithResult(_0x117a7d,null))['catch'](handleError(_0x117a7d,null));};exports[_0xba15('0x4a')]=function(_0xe782dc,_0x1af3e8,_0x1e7865){var _0x42b9be={};var _0x20d947={};var _0x3480d2;var _0x30aa38;return db[_0xba15('0x3b')][_0xba15('0x46')]({'where':{'id':_0xe782dc[_0xba15('0x40')]['id']}})[_0xba15('0x24')](handleEntityNotFound(_0x1af3e8,null))[_0xba15('0x24')](function(_0x3b2dd2){if(_0x3b2dd2){_0x3480d2=_0x3b2dd2;_0x20d947[_0xba15('0x2d')]=_['keys'](db[_0xba15('0x47')][_0xba15('0x2a')]);_0x20d947['query']=_['keys'](_0xe782dc['query']);_0x20d947[_0xba15('0x30')]=_[_0xba15('0x31')](_0x20d947[_0xba15('0x2d')],_0x20d947[_0xba15('0x2f')]);_0x42b9be[_0xba15('0x33')]=_[_0xba15('0x31')](_0x20d947['model'],qs[_0xba15('0x32')](_0xe782dc[_0xba15('0x2f')][_0xba15('0x32')]));_0x42b9be[_0xba15('0x33')]=_0x42b9be[_0xba15('0x33')][_0xba15('0x48')]?_0x42b9be[_0xba15('0x33')]:_0x20d947[_0xba15('0x2d')];_0x42b9be['order']=qs[_0xba15('0x36')](_0xe782dc[_0xba15('0x2f')][_0xba15('0x36')]);_0x42b9be[_0xba15('0x38')]=qs[_0xba15('0x30')](_[_0xba15('0x37')](_0xe782dc[_0xba15('0x2f')],_0x20d947['filters']));if(_0xe782dc[_0xba15('0x2f')][_0xba15('0x3a')]){_0x42b9be[_0xba15('0x38')]=_[_0xba15('0x39')](_0x42b9be['where'],{'$or':_[_0xba15('0x2e')](_0x42b9be[_0xba15('0x33')],function(_0x5db8ae){var _0x29a986={};_0x29a986[_0x5db8ae]={'$like':'%'+_0xe782dc[_0xba15('0x2f')]['filter']+'%'};return _0x29a986;})});}_0x42b9be=_[_0xba15('0x39')]({},_0x42b9be,_0xe782dc[_0xba15('0x4b')]);return _0x3480d2['getSubjects'](_0x42b9be);}})[_0xba15('0x24')](function(_0x5a420a){if(_0x5a420a){_0x30aa38=_0x5a420a[_0xba15('0x48')];if(!_0xe782dc['query'][_0xba15('0x34')](_0xba15('0x49'))){_0x42b9be[_0xba15('0x1b')]=qs[_0xba15('0x1b')](_0xe782dc['query'][_0xba15('0x1b')]);_0x42b9be['offset']=qs[_0xba15('0x1d')](_0xe782dc[_0xba15('0x2f')][_0xba15('0x1d')]);}return _0x3480d2[_0xba15('0x4a')](_0x42b9be);}})[_0xba15('0x24')](function(_0x5510cc){if(_0x5510cc){return _0x5510cc?{'count':_0x30aa38,'rows':_0x5510cc}:null;}})['then'](respondWithResult(_0x1af3e8,null))[_0xba15('0x3e')](handleError(_0x1af3e8,null));};exports[_0xba15('0x4c')]=function(_0x3f789f,_0x1e8adc,_0x3e2fa2){var _0x3ed171={};var _0xcc42fb={};var _0x1e90f2;var _0x27f00c;return db[_0xba15('0x3b')]['findOne']({'where':{'id':_0x3f789f[_0xba15('0x40')]['id']}})[_0xba15('0x24')](handleEntityNotFound(_0x1e8adc,null))[_0xba15('0x24')](function(_0x5da4fd){if(_0x5da4fd){_0x1e90f2=_0x5da4fd;_0xcc42fb[_0xba15('0x2d')]=_['keys'](db[_0xba15('0x47')]['rawAttributes']);_0xcc42fb[_0xba15('0x2f')]=_['keys'](_0x3f789f[_0xba15('0x2f')]);_0xcc42fb[_0xba15('0x30')]=_[_0xba15('0x31')](_0xcc42fb['model'],_0xcc42fb[_0xba15('0x2f')]);_0x3ed171[_0xba15('0x33')]=_['intersection'](_0xcc42fb[_0xba15('0x2d')],qs['fields'](_0x3f789f[_0xba15('0x2f')][_0xba15('0x32')]));_0x3ed171['attributes']=_0x3ed171[_0xba15('0x33')][_0xba15('0x48')]?_0x3ed171[_0xba15('0x33')]:_0xcc42fb['model'];_0x3ed171[_0xba15('0x35')]=qs[_0xba15('0x36')](_0x3f789f['query'][_0xba15('0x36')]);_0x3ed171['where']=qs[_0xba15('0x30')](_[_0xba15('0x37')](_0x3f789f['query'],_0xcc42fb[_0xba15('0x30')]));if(_0x3f789f[_0xba15('0x2f')][_0xba15('0x3a')]){_0x3ed171[_0xba15('0x38')]=_[_0xba15('0x39')](_0x3ed171[_0xba15('0x38')],{'$or':_[_0xba15('0x2e')](_0x3ed171[_0xba15('0x33')],function(_0x2c4cb0){var _0x32dddc={};_0x32dddc[_0x2c4cb0]={'$like':'%'+_0x3f789f[_0xba15('0x2f')][_0xba15('0x3a')]+'%'};return _0x32dddc;})});}_0x3ed171=_[_0xba15('0x39')]({},_0x3ed171,_0x3f789f[_0xba15('0x4b')]);return _0x1e90f2['getDescriptions'](_0x3ed171);}})['then'](function(_0x38539e){if(_0x38539e){_0x27f00c=_0x38539e[_0xba15('0x48')];if(!_0x3f789f['query'][_0xba15('0x34')](_0xba15('0x49'))){_0x3ed171['limit']=qs[_0xba15('0x1b')](_0x3f789f[_0xba15('0x2f')][_0xba15('0x1b')]);_0x3ed171[_0xba15('0x1d')]=qs[_0xba15('0x1d')](_0x3f789f[_0xba15('0x2f')][_0xba15('0x1d')]);}return _0x1e90f2[_0xba15('0x4c')](_0x3ed171);}})[_0xba15('0x24')](function(_0x3b1b3f){if(_0x3b1b3f){return _0x3b1b3f?{'count':_0x27f00c,'rows':_0x3b1b3f}:null;}})[_0xba15('0x24')](respondWithResult(_0x1e8adc,null))[_0xba15('0x3e')](handleError(_0x1e8adc,null));}; \ No newline at end of file +var _0x9e6f=['stack','name','send','map','VtigerConfiguration','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','body','findOne','order','pick','hasOwnProperty','getFields','VtigerField','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../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','destroy','then','error'];(function(_0x246426,_0x505c21){var _0x320fcf=function(_0x5f50dc){while(--_0x5f50dc){_0x246426['push'](_0x246426['shift']());}};_0x320fcf(++_0x505c21);}(_0x9e6f,0x76));var _0xf9e6=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x9e6f[_0x5bd426];return _0x23a7eb;};'use strict';var emlformat=require(_0xf9e6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf9e6('0x1'));var jsonpatch=require(_0xf9e6('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf9e6('0x3'));var Mustache=require(_0xf9e6('0x4'));var util=require(_0xf9e6('0x5'));var path=require(_0xf9e6('0x6'));var sox=require(_0xf9e6('0x7'));var csv=require(_0xf9e6('0x8'));var ejs=require(_0xf9e6('0x9'));var fs=require('fs');var fs_extra=require(_0xf9e6('0xa'));var _=require('lodash');var squel=require(_0xf9e6('0xb'));var crypto=require(_0xf9e6('0xc'));var jsforce=require(_0xf9e6('0xd'));var deskjs=require(_0xf9e6('0xe'));var toCsv=require(_0xf9e6('0x8'));var querystring=require(_0xf9e6('0xf'));var Papa=require(_0xf9e6('0x10'));var Redis=require('ioredis');var authService=require(_0xf9e6('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf9e6('0x12'));var logger=require(_0xf9e6('0x13'))(_0xf9e6('0x14'));var utils=require(_0xf9e6('0x15'));var config=require(_0xf9e6('0x16'));var licenseUtil=require(_0xf9e6('0x17'));var db=require(_0xf9e6('0x18'))['db'];function respondWithStatusCode(_0x3632d4,_0x46ff63){_0x46ff63=_0x46ff63||0xcc;return function(_0x376f66){if(_0x376f66){return _0x3632d4['sendStatus'](_0x46ff63);}return _0x3632d4[_0xf9e6('0x19')](_0x46ff63)[_0xf9e6('0x1a')]();};}function respondWithResult(_0x5625b1,_0x151040){_0x151040=_0x151040||0xc8;return function(_0xc375cf){if(_0xc375cf){return _0x5625b1['status'](_0x151040)[_0xf9e6('0x1b')](_0xc375cf);}};}function respondWithFilteredResult(_0x4cb5a5,_0x277843){return function(_0x5a7090){if(_0x5a7090){var _0x28721c=typeof _0x277843[_0xf9e6('0x1c')]===_0xf9e6('0x1d')&&typeof _0x277843[_0xf9e6('0x1e')]==='undefined';var _0x3a683f=_0x5a7090[_0xf9e6('0x1f')];var _0x466631=_0x28721c?0x0:_0x277843[_0xf9e6('0x1c')];var _0xb13e62=_0x28721c?_0x5a7090[_0xf9e6('0x1f')]:_0x277843['offset']+_0x277843[_0xf9e6('0x1e')];var _0x53c89e;if(_0xb13e62>=_0x3a683f){_0xb13e62=_0x3a683f;_0x53c89e=0xc8;}else{_0x53c89e=0xce;}_0x4cb5a5[_0xf9e6('0x19')](_0x53c89e);return _0x4cb5a5[_0xf9e6('0x20')]('Content-Range',_0x466631+'-'+_0xb13e62+'/'+_0x3a683f)['json'](_0x5a7090);}return null;};}function patchUpdates(_0x63439){return function(_0x1beb37){try{jsonpatch[_0xf9e6('0x21')](_0x1beb37,_0x63439,!![]);}catch(_0x25b935){return BPromise[_0xf9e6('0x22')](_0x25b935);}return _0x1beb37[_0xf9e6('0x23')]();};}function saveUpdates(_0x31065b,_0x414215){return function(_0xb37f5f){if(_0xb37f5f){return _0xb37f5f[_0xf9e6('0x24')](_0x31065b)['then'](function(_0x51ec80){return _0x51ec80;});}return null;};}function removeEntity(_0x16ab76,_0x22bc83){return function(_0x1db708){if(_0x1db708){return _0x1db708[_0xf9e6('0x25')]()[_0xf9e6('0x26')](function(){_0x16ab76[_0xf9e6('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d3186,_0x2f02f8){return function(_0x144575){if(!_0x144575){_0x2d3186['sendStatus'](0x194);}return _0x144575;};}function handleError(_0x4d02c6,_0x7b83d7){_0x7b83d7=_0x7b83d7||0x1f4;return function(_0x3e43d5){logger[_0xf9e6('0x27')](_0x3e43d5[_0xf9e6('0x28')]);if(_0x3e43d5[_0xf9e6('0x29')]){delete _0x3e43d5['name'];}_0x4d02c6['status'](_0x7b83d7)[_0xf9e6('0x2a')](_0x3e43d5);};}exports['index']=function(_0x5a07c1,_0x1569c0){var _0xbf62bf={},_0x2fd16e={},_0x1d247d={'count':0x0,'rows':[]};var _0x45ea31=_[_0xf9e6('0x2b')](db[_0xf9e6('0x2c')][_0xf9e6('0x2d')],function(_0x3432e7){return{'name':_0x3432e7[_0xf9e6('0x2e')],'type':_0x3432e7['type'][_0xf9e6('0x2f')]};});_0x2fd16e[_0xf9e6('0x30')]=_[_0xf9e6('0x2b')](_0x45ea31,_0xf9e6('0x29'));_0x2fd16e[_0xf9e6('0x31')]=_['keys'](_0x5a07c1[_0xf9e6('0x31')]);_0x2fd16e[_0xf9e6('0x32')]=_['intersection'](_0x2fd16e[_0xf9e6('0x30')],_0x2fd16e[_0xf9e6('0x31')]);_0xbf62bf[_0xf9e6('0x33')]=_[_0xf9e6('0x34')](_0x2fd16e[_0xf9e6('0x30')],qs[_0xf9e6('0x35')](_0x5a07c1[_0xf9e6('0x31')][_0xf9e6('0x35')]));_0xbf62bf[_0xf9e6('0x33')]=_0xbf62bf['attributes'][_0xf9e6('0x36')]?_0xbf62bf[_0xf9e6('0x33')]:_0x2fd16e[_0xf9e6('0x30')];if(!_0x5a07c1[_0xf9e6('0x31')]['hasOwnProperty'](_0xf9e6('0x37'))){_0xbf62bf[_0xf9e6('0x1e')]=qs[_0xf9e6('0x1e')](_0x5a07c1['query'][_0xf9e6('0x1e')]);_0xbf62bf['offset']=qs[_0xf9e6('0x1c')](_0x5a07c1[_0xf9e6('0x31')]['offset']);}_0xbf62bf['order']=qs[_0xf9e6('0x38')](_0x5a07c1[_0xf9e6('0x31')][_0xf9e6('0x38')]);_0xbf62bf[_0xf9e6('0x39')]=qs['filters'](_['pick'](_0x5a07c1['query'],_0x2fd16e[_0xf9e6('0x32')]),_0x45ea31);if(_0x5a07c1[_0xf9e6('0x31')][_0xf9e6('0x3a')]){_0xbf62bf[_0xf9e6('0x39')]=_[_0xf9e6('0x3b')](_0xbf62bf[_0xf9e6('0x39')],{'$or':_['map'](_0x45ea31,function(_0x326e2b){if(_0x326e2b['type']!==_0xf9e6('0x3c')){var _0x387e8b={};_0x387e8b[_0x326e2b[_0xf9e6('0x29')]]={'$like':'%'+_0x5a07c1[_0xf9e6('0x31')][_0xf9e6('0x3a')]+'%'};return _0x387e8b;}})});}_0xbf62bf=_[_0xf9e6('0x3b')]({},_0xbf62bf,_0x5a07c1[_0xf9e6('0x3d')]);var _0x4e1310={'where':_0xbf62bf[_0xf9e6('0x39')]};return db[_0xf9e6('0x2c')][_0xf9e6('0x1f')](_0x4e1310)[_0xf9e6('0x26')](function(_0x190bae){_0x1d247d[_0xf9e6('0x1f')]=_0x190bae;if(_0x5a07c1[_0xf9e6('0x31')][_0xf9e6('0x3e')]){_0xbf62bf[_0xf9e6('0x3f')]=[{'all':!![]}];}return db[_0xf9e6('0x2c')]['findAll'](_0xbf62bf);})[_0xf9e6('0x26')](function(_0xcc6c00){_0x1d247d[_0xf9e6('0x40')]=_0xcc6c00;return _0x1d247d;})['then'](respondWithFilteredResult(_0x1569c0,_0xbf62bf))[_0xf9e6('0x41')](handleError(_0x1569c0,null));};exports[_0xf9e6('0x42')]=function(_0xa56189,_0x5ac137){var _0x52d049={'raw':![],'where':{'id':_0xa56189[_0xf9e6('0x43')]['id']}},_0x3ee6ca={};_0x3ee6ca['model']=_[_0xf9e6('0x44')](db[_0xf9e6('0x2c')][_0xf9e6('0x2d')]);_0x3ee6ca[_0xf9e6('0x31')]=_['keys'](_0xa56189[_0xf9e6('0x31')]);_0x3ee6ca[_0xf9e6('0x32')]=_['intersection'](_0x3ee6ca[_0xf9e6('0x30')],_0x3ee6ca[_0xf9e6('0x31')]);_0x52d049[_0xf9e6('0x33')]=_['intersection'](_0x3ee6ca[_0xf9e6('0x30')],qs[_0xf9e6('0x35')](_0xa56189[_0xf9e6('0x31')]['fields']));_0x52d049['attributes']=_0x52d049[_0xf9e6('0x33')][_0xf9e6('0x36')]?_0x52d049[_0xf9e6('0x33')]:_0x3ee6ca[_0xf9e6('0x30')];if(_0xa56189[_0xf9e6('0x31')][_0xf9e6('0x3e')]){_0x52d049[_0xf9e6('0x3f')]=[{'all':!![]}];}_0x52d049=_[_0xf9e6('0x3b')]({},_0x52d049,_0xa56189[_0xf9e6('0x3d')]);return db['VtigerConfiguration'][_0xf9e6('0x45')](_0x52d049)['then'](handleEntityNotFound(_0x5ac137,null))[_0xf9e6('0x26')](respondWithResult(_0x5ac137,null))['catch'](handleError(_0x5ac137,null));};exports['create']=function(_0x3d30b1,_0x1e2c64){return db['VtigerConfiguration']['create'](_0x3d30b1['body'],{})[_0xf9e6('0x26')](respondWithResult(_0x1e2c64,0xc9))[_0xf9e6('0x41')](handleError(_0x1e2c64,null));};exports['update']=function(_0x352ba5,_0x47f0d9){if(_0x352ba5[_0xf9e6('0x46')]['id']){delete _0x352ba5[_0xf9e6('0x46')]['id'];}return db[_0xf9e6('0x2c')][_0xf9e6('0x45')]({'where':{'id':_0x352ba5[_0xf9e6('0x43')]['id']}})[_0xf9e6('0x26')](handleEntityNotFound(_0x47f0d9,null))[_0xf9e6('0x26')](saveUpdates(_0x352ba5[_0xf9e6('0x46')],null))[_0xf9e6('0x26')](respondWithResult(_0x47f0d9,null))[_0xf9e6('0x41')](handleError(_0x47f0d9,null));};exports['destroy']=function(_0x242fe4,_0xa62ed5){return db[_0xf9e6('0x2c')]['find']({'where':{'id':_0x242fe4[_0xf9e6('0x43')]['id']}})[_0xf9e6('0x26')](handleEntityNotFound(_0xa62ed5,null))[_0xf9e6('0x26')](removeEntity(_0xa62ed5,null))['catch'](handleError(_0xa62ed5,null));};exports['getFields']=function(_0x2e8c08,_0x9fdcad,_0x22663e){var _0x254809={};var _0x3db882={};var _0x9fbbf;var _0x15fe8b;return db[_0xf9e6('0x2c')][_0xf9e6('0x47')]({'where':{'id':_0x2e8c08[_0xf9e6('0x43')]['id']}})[_0xf9e6('0x26')](handleEntityNotFound(_0x9fdcad,null))[_0xf9e6('0x26')](function(_0x2f72b4){if(_0x2f72b4){_0x9fbbf=_0x2f72b4;_0x3db882[_0xf9e6('0x30')]=_[_0xf9e6('0x44')](db['VtigerField'][_0xf9e6('0x2d')]);_0x3db882[_0xf9e6('0x31')]=_[_0xf9e6('0x44')](_0x2e8c08[_0xf9e6('0x31')]);_0x3db882[_0xf9e6('0x32')]=_['intersection'](_0x3db882['model'],_0x3db882[_0xf9e6('0x31')]);_0x254809[_0xf9e6('0x33')]=_[_0xf9e6('0x34')](_0x3db882[_0xf9e6('0x30')],qs[_0xf9e6('0x35')](_0x2e8c08[_0xf9e6('0x31')][_0xf9e6('0x35')]));_0x254809[_0xf9e6('0x33')]=_0x254809[_0xf9e6('0x33')][_0xf9e6('0x36')]?_0x254809[_0xf9e6('0x33')]:_0x3db882[_0xf9e6('0x30')];_0x254809[_0xf9e6('0x48')]=qs['sort'](_0x2e8c08[_0xf9e6('0x31')][_0xf9e6('0x38')]);_0x254809[_0xf9e6('0x39')]=qs[_0xf9e6('0x32')](_[_0xf9e6('0x49')](_0x2e8c08['query'],_0x3db882[_0xf9e6('0x32')]));if(_0x2e8c08[_0xf9e6('0x31')][_0xf9e6('0x3a')]){_0x254809[_0xf9e6('0x39')]=_[_0xf9e6('0x3b')](_0x254809[_0xf9e6('0x39')],{'$or':_['map'](_0x254809[_0xf9e6('0x33')],function(_0x5f0c7e){var _0x5a17e7={};_0x5a17e7[_0x5f0c7e]={'$like':'%'+_0x2e8c08[_0xf9e6('0x31')][_0xf9e6('0x3a')]+'%'};return _0x5a17e7;})});}_0x254809=_[_0xf9e6('0x3b')]({},_0x254809,_0x2e8c08[_0xf9e6('0x3d')]);return _0x9fbbf['getFields'](_0x254809);}})['then'](function(_0x425ef1){if(_0x425ef1){_0x15fe8b=_0x425ef1[_0xf9e6('0x36')];if(!_0x2e8c08['query'][_0xf9e6('0x4a')]('nolimit')){_0x254809[_0xf9e6('0x1e')]=qs[_0xf9e6('0x1e')](_0x2e8c08[_0xf9e6('0x31')]['limit']);_0x254809[_0xf9e6('0x1c')]=qs[_0xf9e6('0x1c')](_0x2e8c08[_0xf9e6('0x31')][_0xf9e6('0x1c')]);}return _0x9fbbf[_0xf9e6('0x4b')](_0x254809);}})['then'](function(_0x2dd135){if(_0x2dd135){return _0x2dd135?{'count':_0x15fe8b,'rows':_0x2dd135}:null;}})['then'](respondWithResult(_0x9fdcad,null))[_0xf9e6('0x41')](handleError(_0x9fdcad,null));};exports['getSubjects']=function(_0x3088c1,_0x46a6c2,_0x131df7){var _0x3dd673={};var _0xc2f718={};var _0x355298;var _0xbf4311;return db[_0xf9e6('0x2c')][_0xf9e6('0x47')]({'where':{'id':_0x3088c1[_0xf9e6('0x43')]['id']}})[_0xf9e6('0x26')](handleEntityNotFound(_0x46a6c2,null))[_0xf9e6('0x26')](function(_0x113874){if(_0x113874){_0x355298=_0x113874;_0xc2f718[_0xf9e6('0x30')]=_[_0xf9e6('0x44')](db[_0xf9e6('0x4c')][_0xf9e6('0x2d')]);_0xc2f718['query']=_[_0xf9e6('0x44')](_0x3088c1['query']);_0xc2f718[_0xf9e6('0x32')]=_[_0xf9e6('0x34')](_0xc2f718[_0xf9e6('0x30')],_0xc2f718[_0xf9e6('0x31')]);_0x3dd673['attributes']=_[_0xf9e6('0x34')](_0xc2f718[_0xf9e6('0x30')],qs['fields'](_0x3088c1[_0xf9e6('0x31')][_0xf9e6('0x35')]));_0x3dd673[_0xf9e6('0x33')]=_0x3dd673[_0xf9e6('0x33')][_0xf9e6('0x36')]?_0x3dd673[_0xf9e6('0x33')]:_0xc2f718[_0xf9e6('0x30')];_0x3dd673['order']=qs[_0xf9e6('0x38')](_0x3088c1[_0xf9e6('0x31')]['sort']);_0x3dd673[_0xf9e6('0x39')]=qs[_0xf9e6('0x32')](_[_0xf9e6('0x49')](_0x3088c1[_0xf9e6('0x31')],_0xc2f718[_0xf9e6('0x32')]));if(_0x3088c1[_0xf9e6('0x31')][_0xf9e6('0x3a')]){_0x3dd673['where']=_[_0xf9e6('0x3b')](_0x3dd673[_0xf9e6('0x39')],{'$or':_[_0xf9e6('0x2b')](_0x3dd673['attributes'],function(_0x2e2692){var _0x15d2ef={};_0x15d2ef[_0x2e2692]={'$like':'%'+_0x3088c1[_0xf9e6('0x31')][_0xf9e6('0x3a')]+'%'};return _0x15d2ef;})});}_0x3dd673=_[_0xf9e6('0x3b')]({},_0x3dd673,_0x3088c1['options']);return _0x355298[_0xf9e6('0x4d')](_0x3dd673);}})['then'](function(_0x5e5863){if(_0x5e5863){_0xbf4311=_0x5e5863[_0xf9e6('0x36')];if(!_0x3088c1[_0xf9e6('0x31')][_0xf9e6('0x4a')](_0xf9e6('0x37'))){_0x3dd673[_0xf9e6('0x1e')]=qs[_0xf9e6('0x1e')](_0x3088c1[_0xf9e6('0x31')][_0xf9e6('0x1e')]);_0x3dd673['offset']=qs[_0xf9e6('0x1c')](_0x3088c1[_0xf9e6('0x31')][_0xf9e6('0x1c')]);}return _0x355298[_0xf9e6('0x4d')](_0x3dd673);}})[_0xf9e6('0x26')](function(_0x5c6ff7){if(_0x5c6ff7){return _0x5c6ff7?{'count':_0xbf4311,'rows':_0x5c6ff7}:null;}})['then'](respondWithResult(_0x46a6c2,null))[_0xf9e6('0x41')](handleError(_0x46a6c2,null));};exports[_0xf9e6('0x4e')]=function(_0x1586c7,_0x3894a4,_0xccdf8a){var _0x3c0fe2={};var _0x5e6794={};var _0x3cde8e;var _0x5af7a6;return db[_0xf9e6('0x2c')][_0xf9e6('0x47')]({'where':{'id':_0x1586c7[_0xf9e6('0x43')]['id']}})['then'](handleEntityNotFound(_0x3894a4,null))[_0xf9e6('0x26')](function(_0x413af3){if(_0x413af3){_0x3cde8e=_0x413af3;_0x5e6794[_0xf9e6('0x30')]=_[_0xf9e6('0x44')](db[_0xf9e6('0x4c')]['rawAttributes']);_0x5e6794[_0xf9e6('0x31')]=_[_0xf9e6('0x44')](_0x1586c7[_0xf9e6('0x31')]);_0x5e6794[_0xf9e6('0x32')]=_[_0xf9e6('0x34')](_0x5e6794[_0xf9e6('0x30')],_0x5e6794[_0xf9e6('0x31')]);_0x3c0fe2['attributes']=_[_0xf9e6('0x34')](_0x5e6794[_0xf9e6('0x30')],qs[_0xf9e6('0x35')](_0x1586c7[_0xf9e6('0x31')]['fields']));_0x3c0fe2[_0xf9e6('0x33')]=_0x3c0fe2[_0xf9e6('0x33')][_0xf9e6('0x36')]?_0x3c0fe2[_0xf9e6('0x33')]:_0x5e6794[_0xf9e6('0x30')];_0x3c0fe2[_0xf9e6('0x48')]=qs[_0xf9e6('0x38')](_0x1586c7[_0xf9e6('0x31')][_0xf9e6('0x38')]);_0x3c0fe2['where']=qs['filters'](_[_0xf9e6('0x49')](_0x1586c7[_0xf9e6('0x31')],_0x5e6794[_0xf9e6('0x32')]));if(_0x1586c7[_0xf9e6('0x31')][_0xf9e6('0x3a')]){_0x3c0fe2[_0xf9e6('0x39')]=_[_0xf9e6('0x3b')](_0x3c0fe2['where'],{'$or':_['map'](_0x3c0fe2[_0xf9e6('0x33')],function(_0x2d6919){var _0x1cb1c9={};_0x1cb1c9[_0x2d6919]={'$like':'%'+_0x1586c7[_0xf9e6('0x31')]['filter']+'%'};return _0x1cb1c9;})});}_0x3c0fe2=_['merge']({},_0x3c0fe2,_0x1586c7[_0xf9e6('0x3d')]);return _0x3cde8e[_0xf9e6('0x4e')](_0x3c0fe2);}})['then'](function(_0x15f4f3){if(_0x15f4f3){_0x5af7a6=_0x15f4f3['length'];if(!_0x1586c7[_0xf9e6('0x31')][_0xf9e6('0x4a')]('nolimit')){_0x3c0fe2[_0xf9e6('0x1e')]=qs[_0xf9e6('0x1e')](_0x1586c7[_0xf9e6('0x31')][_0xf9e6('0x1e')]);_0x3c0fe2[_0xf9e6('0x1c')]=qs[_0xf9e6('0x1c')](_0x1586c7[_0xf9e6('0x31')]['offset']);}return _0x3cde8e[_0xf9e6('0x4e')](_0x3c0fe2);}})[_0xf9e6('0x26')](function(_0x7c44eb){if(_0x7c44eb){return _0x7c44eb?{'count':_0x5af7a6,'rows':_0x7c44eb}:null;}})[_0xf9e6('0x26')](respondWithResult(_0x3894a4,null))[_0xf9e6('0x41')](handleError(_0x3894a4,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 9d7d309..65669a8 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 _0xdcdb=['../../config/environment','./intVtigerConfiguration.attributes','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','request-promise','path','rimraf'];(function(_0x22abf4,_0x356ddd){var _0x324670=function(_0x5e70fa){while(--_0x5e70fa){_0x22abf4['push'](_0x22abf4['shift']());}};_0x324670(++_0x356ddd);}(_0xdcdb,0x1c8));var _0xbdcd=function(_0x227507,_0x437fbe){_0x227507=_0x227507-0x0;var _0x22db63=_0xdcdb[_0x227507];return _0x22db63;};'use strict';var _=require(_0xbdcd('0x0'));var util=require(_0xbdcd('0x1'));var logger=require(_0xbdcd('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbdcd('0x3'));var fs=require('fs');var path=require(_0xbdcd('0x4'));var rimraf=require(_0xbdcd('0x5'));var config=require(_0xbdcd('0x6'));var attributes=require(_0xbdcd('0x7'));module['exports']=function(_0x3b2d07,_0x58d624){return _0x3b2d07[_0xbdcd('0x8')](_0xbdcd('0x9'),attributes,{'tableName':_0xbdcd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef7d=['util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash'];(function(_0x3f4048,_0x17c163){var _0x150861=function(_0x5d0f44){while(--_0x5d0f44){_0x3f4048['push'](_0x3f4048['shift']());}};_0x150861(++_0x17c163);}(_0xef7d,0x12b));var _0xdef7=function(_0x236c67,_0x28b77e){_0x236c67=_0x236c67-0x0;var _0x19e4fb=_0xef7d[_0x236c67];return _0x19e4fb;};'use strict';var _=require(_0xdef7('0x0'));var util=require(_0xdef7('0x1'));var logger=require(_0xdef7('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdef7('0x3'));var fs=require('fs');var path=require(_0xdef7('0x4'));var rimraf=require(_0xdef7('0x5'));var config=require(_0xdef7('0x6'));var attributes=require(_0xdef7('0x7'));module[_0xdef7('0x8')]=function(_0x3601cb,_0x327dc4){return _0x3601cb[_0xdef7('0x9')](_0xdef7('0xa'),attributes,{'tableName':_0xdef7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 37a6526..40e9651 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 _0x132a=['stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','result','message','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','debug'];(function(_0x1a0d52,_0x236750){var _0x50094e=function(_0xaed630){while(--_0xaed630){_0x1a0d52['push'](_0x1a0d52['shift']());}};_0x50094e(++_0x236750);}(_0x132a,0xda));var _0xa132=function(_0x2e9c78,_0x16f7db){_0x2e9c78=_0x2e9c78-0x0;var _0x3b04b9=_0x132a[_0x2e9c78];return _0x3b04b9;};'use strict';var _=require('lodash');var util=require(_0xa132('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa132('0x1'));var fs=require('fs');var Redis=require(_0xa132('0x2'));var db=require(_0xa132('0x3'))['db'];var utils=require(_0xa132('0x4'));var logger=require(_0xa132('0x5'))(_0xa132('0x6'));var config=require('../../config/environment');var jayson=require(_0xa132('0x7'));var client=jayson[_0xa132('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41c653,_0x3aea79,_0x53c404){return new BPromise(function(_0x590517,_0x5d7523){return client[_0xa132('0x9')](_0x41c653,_0x53c404)[_0xa132('0xa')](function(_0x57b938){logger[_0xa132('0xb')]('VtigerConfiguration,\x20%s,\x20%s',_0x3aea79,'request\x20sent');logger[_0xa132('0xc')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x3aea79,'request\x20sent',JSON[_0xa132('0xd')](_0x57b938));if(_0x57b938[_0xa132('0xe')]){if(_0x57b938['error'][_0xa132('0xf')]===0x1f4){logger[_0xa132('0xe')](_0xa132('0x10'),_0x3aea79,_0x57b938['error']['message']);return _0x5d7523(_0x57b938['error']['message']);}logger[_0xa132('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x3aea79,_0x57b938[_0xa132('0xe')]['message']);return _0x590517(_0x57b938[_0xa132('0xe')]['message']);}else{logger[_0xa132('0xb')]('VtigerConfiguration,\x20%s,\x20%s',_0x3aea79,_0xa132('0x11'));_0x590517(_0x57b938[_0xa132('0x12')][_0xa132('0x13')]);}})[_0xa132('0x14')](function(_0x8d8d6d){logger['error'](_0xa132('0x10'),_0x3aea79,_0x8d8d6d);_0x5d7523(_0x8d8d6d);});});} \ No newline at end of file +var _0x8678=['lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x263b7d,_0x5c1008){var _0x21c2eb=function(_0x1fa4f3){while(--_0x1fa4f3){_0x263b7d['push'](_0x263b7d['shift']());}};_0x21c2eb(++_0x5c1008);}(_0x8678,0xf0));var _0x8867=function(_0x320c0f,_0x352f1c){_0x320c0f=_0x320c0f-0x0;var _0x266ff4=_0x8678[_0x320c0f];return _0x266ff4;};'use strict';var _=require(_0x8867('0x0'));var util=require(_0x8867('0x1'));var moment=require(_0x8867('0x2'));var BPromise=require('bluebird');var rs=require(_0x8867('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8867('0x4'))['db'];var utils=require(_0x8867('0x5'));var logger=require(_0x8867('0x6'))(_0x8867('0x7'));var config=require(_0x8867('0x8'));var jayson=require(_0x8867('0x9'));var client=jayson[_0x8867('0xa')][_0x8867('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47626e,_0x36085e,_0x2afc27){return new BPromise(function(_0x5b050c,_0x3a49ea){return client[_0x8867('0xc')](_0x47626e,_0x2afc27)[_0x8867('0xd')](function(_0xf1749d){logger[_0x8867('0xe')](_0x8867('0xf'),_0x36085e,_0x8867('0x10'));logger[_0x8867('0x11')](_0x8867('0x12'),_0x36085e,_0x8867('0x10'),JSON[_0x8867('0x13')](_0xf1749d));if(_0xf1749d[_0x8867('0x14')]){if(_0xf1749d[_0x8867('0x14')][_0x8867('0x15')]===0x1f4){logger[_0x8867('0x14')](_0x8867('0xf'),_0x36085e,_0xf1749d[_0x8867('0x14')]['message']);return _0x3a49ea(_0xf1749d[_0x8867('0x14')][_0x8867('0x16')]);}logger[_0x8867('0x14')](_0x8867('0xf'),_0x36085e,_0xf1749d['error'][_0x8867('0x16')]);return _0x5b050c(_0xf1749d['error'][_0x8867('0x16')]);}else{logger[_0x8867('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x36085e,_0x8867('0x10'));_0x5b050c(_0xf1749d['result']['message']);}})[_0x8867('0x17')](function(_0xd718c8){logger[_0x8867('0x14')](_0x8867('0xf'),_0x36085e,_0xd718c8);_0x3a49ea(_0xd718c8);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index ce43603..a69ea0b 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 _0x5e13=['../../components/interaction/service','get','/:id','isAuthenticated','show','post','create','put','update','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x153239,_0x3023da){var _0x4eb1a8=function(_0x462472){while(--_0x462472){_0x153239['push'](_0x153239['shift']());}};_0x4eb1a8(++_0x3023da);}(_0x5e13,0x1cc));var _0x35e1=function(_0x5a8e42,_0x1bdf90){_0x5a8e42=_0x5a8e42-0x0;var _0x3939ef=_0x5e13[_0x5a8e42];return _0x3939ef;};'use strict';var multer=require(_0x35e1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x35e1('0x1'));var express=require(_0x35e1('0x2'));var router=express['Router']();var fs_extra=require(_0x35e1('0x3'));var auth=require(_0x35e1('0x4'));var interaction=require(_0x35e1('0x5'));var config=require('../../config/environment');var controller=require('./intVtigerField.controller');router[_0x35e1('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35e1('0x6')](_0x35e1('0x7'),auth[_0x35e1('0x8')](),controller[_0x35e1('0x9')]);router[_0x35e1('0xa')]('/',auth['isAuthenticated'](),controller[_0x35e1('0xb')]);router[_0x35e1('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x35e1('0xd')]);router['delete'](_0x35e1('0x7'),auth[_0x35e1('0x8')](),controller['destroy']);module[_0x35e1('0xe')]=router; \ No newline at end of file +var _0xaa4d=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x34a8c8,_0x31e259){var _0x1fe6e5=function(_0x30f28d){while(--_0x30f28d){_0x34a8c8['push'](_0x34a8c8['shift']());}};_0x1fe6e5(++_0x31e259);}(_0xaa4d,0x14e));var _0xdaa4=function(_0x8f10f9,_0x44280b){_0x8f10f9=_0x8f10f9-0x0;var _0x32b6c1=_0xaa4d[_0x8f10f9];return _0x32b6c1;};'use strict';var multer=require(_0xdaa4('0x0'));var util=require(_0xdaa4('0x1'));var path=require(_0xdaa4('0x2'));var timeout=require(_0xdaa4('0x3'));var express=require(_0xdaa4('0x4'));var router=express['Router']();var fs_extra=require(_0xdaa4('0x5'));var auth=require(_0xdaa4('0x6'));var interaction=require(_0xdaa4('0x7'));var config=require(_0xdaa4('0x8'));var controller=require(_0xdaa4('0x9'));router[_0xdaa4('0xa')]('/',auth[_0xdaa4('0xb')](),controller['index']);router[_0xdaa4('0xa')](_0xdaa4('0xc'),auth[_0xdaa4('0xb')](),controller[_0xdaa4('0xd')]);router[_0xdaa4('0xe')]('/',auth[_0xdaa4('0xb')](),controller[_0xdaa4('0xf')]);router[_0xdaa4('0x10')](_0xdaa4('0xc'),auth[_0xdaa4('0xb')](),controller[_0xdaa4('0x11')]);router[_0xdaa4('0x12')](_0xdaa4('0xc'),auth[_0xdaa4('0xb')](),controller[_0xdaa4('0x13')]);module[_0xdaa4('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 2cecbc7..cc7fa94 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 _0x6799=['string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x45313d,_0x1abeb5){var _0x26706f=function(_0x381755){while(--_0x381755){_0x45313d['push'](_0x45313d['shift']());}};_0x26706f(++_0x1abeb5);}(_0x6799,0x102));var _0x9679=function(_0x357736,_0x10a37b){_0x357736=_0x357736-0x0;var _0x3ec752=_0x6799[_0x357736];return _0x3ec752;};'use strict';var Sequelize=require(_0x9679('0x0'));module[_0x9679('0x1')]={'type':{'type':Sequelize[_0x9679('0x2')](_0x9679('0x3'),_0x9679('0x4'),_0x9679('0x5'),_0x9679('0x6'),'picklist'),'defaultValue':_0x9679('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x9679('0x2')](_0x9679('0x3'),_0x9679('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x9679('0x7')]},'idField':{'type':Sequelize[_0x9679('0x7')]},'nameField':{'type':Sequelize[_0x9679('0x7')]},'customField':{'type':Sequelize[_0x9679('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9679('0x7')]}}; \ No newline at end of file +var _0xdd5c=['sequelize','string','variable','customVariable','keyValue','picklist','STRING','ENUM','BOOLEAN'];(function(_0x426f87,_0x459ff1){var _0xf2a7c9=function(_0x27c069){while(--_0x27c069){_0x426f87['push'](_0x426f87['shift']());}};_0xf2a7c9(++_0x459ff1);}(_0xdd5c,0xea));var _0xcdd5=function(_0x44b3f6,_0x2f0b79){_0x44b3f6=_0x44b3f6-0x0;var _0x4a6207=_0xdd5c[_0x44b3f6];return _0x4a6207;};'use strict';var Sequelize=require(_0xcdd5('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xcdd5('0x1'),_0xcdd5('0x2'),_0xcdd5('0x3'),_0xcdd5('0x4'),_0xcdd5('0x5')),'defaultValue':_0xcdd5('0x1')},'content':{'type':Sequelize[_0xcdd5('0x6')]},'key':{'type':Sequelize[_0xcdd5('0x6')]},'keyType':{'type':Sequelize[_0xcdd5('0x7')](_0xcdd5('0x1'),_0xcdd5('0x2'),_0xcdd5('0x3'))},'keyContent':{'type':Sequelize[_0xcdd5('0x6')]},'idField':{'type':Sequelize[_0xcdd5('0x6')]},'nameField':{'type':Sequelize[_0xcdd5('0x6')]},'customField':{'type':Sequelize[_0xcdd5('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcdd5('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index efb5e98..0ac3c32 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 _0x0ed3=['request-promise','moment','mustache','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','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','update','destroy','then','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','options','include','findAll','rows','show','includeAll','find','catch','create','body','eml-format','rimraf','zip-dir'];(function(_0x842858,_0x3a3ca0){var _0x46c2a2=function(_0x47f795){while(--_0x47f795){_0x842858['push'](_0x842858['shift']());}};_0x46c2a2(++_0x3a3ca0);}(_0x0ed3,0x91));var _0x30ed=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0ed3[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x30ed('0x0'));var rimraf=require(_0x30ed('0x1'));var zipdir=require(_0x30ed('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x30ed('0x3'));var moment=require(_0x30ed('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x30ed('0x5'));var util=require('util');var path=require(_0x30ed('0x6'));var sox=require(_0x30ed('0x7'));var csv=require(_0x30ed('0x8'));var ejs=require(_0x30ed('0x9'));var fs=require('fs');var fs_extra=require(_0x30ed('0xa'));var _=require(_0x30ed('0xb'));var squel=require(_0x30ed('0xc'));var crypto=require(_0x30ed('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x30ed('0x8'));var querystring=require(_0x30ed('0xe'));var Papa=require(_0x30ed('0xf'));var Redis=require(_0x30ed('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x30ed('0x11'));var as=require(_0x30ed('0x12'));var hardwareService=require(_0x30ed('0x13'));var logger=require('../../config/logger')(_0x30ed('0x14'));var utils=require(_0x30ed('0x15'));var config=require(_0x30ed('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x30ed('0x17'))['db'];function respondWithStatusCode(_0x2f0de4,_0x19d6df){_0x19d6df=_0x19d6df||0xcc;return function(_0x5e7df0){if(_0x5e7df0){return _0x2f0de4[_0x30ed('0x18')](_0x19d6df);}return _0x2f0de4['status'](_0x19d6df)[_0x30ed('0x19')]();};}function respondWithResult(_0x1fdcfd,_0x1d5d9f){_0x1d5d9f=_0x1d5d9f||0xc8;return function(_0x8b442a){if(_0x8b442a){return _0x1fdcfd[_0x30ed('0x1a')](_0x1d5d9f)['json'](_0x8b442a);}};}function respondWithFilteredResult(_0x5bbae2,_0x1a0de7){return function(_0xc68930){if(_0xc68930){var _0x389e98=typeof _0x1a0de7['offset']===_0x30ed('0x1b')&&typeof _0x1a0de7[_0x30ed('0x1c')]===_0x30ed('0x1b');var _0x15d67d=_0xc68930[_0x30ed('0x1d')];var _0x9a2246=_0x389e98?0x0:_0x1a0de7['offset'];var _0x46ab93=_0x389e98?_0xc68930['count']:_0x1a0de7[_0x30ed('0x1e')]+_0x1a0de7['limit'];var _0x24f4eb;if(_0x46ab93>=_0x15d67d){_0x46ab93=_0x15d67d;_0x24f4eb=0xc8;}else{_0x24f4eb=0xce;}_0x5bbae2[_0x30ed('0x1a')](_0x24f4eb);return _0x5bbae2[_0x30ed('0x1f')](_0x30ed('0x20'),_0x9a2246+'-'+_0x46ab93+'/'+_0x15d67d)[_0x30ed('0x21')](_0xc68930);}return null;};}function patchUpdates(_0x5bae86){return function(_0x3e62dc){try{jsonpatch[_0x30ed('0x22')](_0x3e62dc,_0x5bae86,!![]);}catch(_0x4959cf){return BPromise['reject'](_0x4959cf);}return _0x3e62dc['save']();};}function saveUpdates(_0x430c2a,_0x3bb9ff){return function(_0x499720){if(_0x499720){return _0x499720[_0x30ed('0x23')](_0x430c2a)['then'](function(_0x2f40e9){return _0x2f40e9;});}return null;};}function removeEntity(_0x4f9f92,_0x25cc5b){return function(_0x456684){if(_0x456684){return _0x456684[_0x30ed('0x24')]()[_0x30ed('0x25')](function(){_0x4f9f92['status'](0xcc)[_0x30ed('0x19')]();});}};}function handleEntityNotFound(_0x578ca0,_0x3c9138){return function(_0x5602df){if(!_0x5602df){_0x578ca0['sendStatus'](0x194);}return _0x5602df;};}function handleError(_0x288ccc,_0x412cc1){_0x412cc1=_0x412cc1||0x1f4;return function(_0x4b57ad){logger[_0x30ed('0x26')](_0x4b57ad[_0x30ed('0x27')]);if(_0x4b57ad[_0x30ed('0x28')]){delete _0x4b57ad[_0x30ed('0x28')];}_0x288ccc[_0x30ed('0x1a')](_0x412cc1)[_0x30ed('0x29')](_0x4b57ad);};}exports[_0x30ed('0x2a')]=function(_0x250aac,_0x51f867){var _0xdc81bd={},_0x238dc4={},_0x5463f6={'count':0x0,'rows':[]};var _0x46dd94=_[_0x30ed('0x2b')](db[_0x30ed('0x2c')][_0x30ed('0x2d')],function(_0x5c5b94){return{'name':_0x5c5b94[_0x30ed('0x2e')],'type':_0x5c5b94['type'][_0x30ed('0x2f')]};});_0x238dc4[_0x30ed('0x30')]=_['map'](_0x46dd94,'name');_0x238dc4[_0x30ed('0x31')]=_[_0x30ed('0x32')](_0x250aac[_0x30ed('0x31')]);_0x238dc4['filters']=_[_0x30ed('0x33')](_0x238dc4[_0x30ed('0x30')],_0x238dc4['query']);_0xdc81bd[_0x30ed('0x34')]=_[_0x30ed('0x33')](_0x238dc4[_0x30ed('0x30')],qs[_0x30ed('0x35')](_0x250aac[_0x30ed('0x31')][_0x30ed('0x35')]));_0xdc81bd[_0x30ed('0x34')]=_0xdc81bd[_0x30ed('0x34')]['length']?_0xdc81bd['attributes']:_0x238dc4[_0x30ed('0x30')];if(!_0x250aac[_0x30ed('0x31')][_0x30ed('0x36')](_0x30ed('0x37'))){_0xdc81bd[_0x30ed('0x1c')]=qs[_0x30ed('0x1c')](_0x250aac[_0x30ed('0x31')][_0x30ed('0x1c')]);_0xdc81bd[_0x30ed('0x1e')]=qs[_0x30ed('0x1e')](_0x250aac[_0x30ed('0x31')][_0x30ed('0x1e')]);}_0xdc81bd[_0x30ed('0x38')]=qs[_0x30ed('0x39')](_0x250aac[_0x30ed('0x31')]['sort']);_0xdc81bd[_0x30ed('0x3a')]=qs[_0x30ed('0x3b')](_[_0x30ed('0x3c')](_0x250aac[_0x30ed('0x31')],_0x238dc4['filters']),_0x46dd94);if(_0x250aac[_0x30ed('0x31')][_0x30ed('0x3d')]){_0xdc81bd['where']=_[_0x30ed('0x3e')](_0xdc81bd[_0x30ed('0x3a')],{'$or':_[_0x30ed('0x2b')](_0x46dd94,function(_0x7d3f71){if(_0x7d3f71[_0x30ed('0x3f')]!=='VIRTUAL'){var _0x5acbad={};_0x5acbad[_0x7d3f71[_0x30ed('0x28')]]={'$like':'%'+_0x250aac['query'][_0x30ed('0x3d')]+'%'};return _0x5acbad;}})});}_0xdc81bd=_[_0x30ed('0x3e')]({},_0xdc81bd,_0x250aac[_0x30ed('0x40')]);var _0x36a8ed={'where':_0xdc81bd[_0x30ed('0x3a')]};return db[_0x30ed('0x2c')]['count'](_0x36a8ed)[_0x30ed('0x25')](function(_0x35d294){_0x5463f6[_0x30ed('0x1d')]=_0x35d294;if(_0x250aac[_0x30ed('0x31')]['includeAll']){_0xdc81bd[_0x30ed('0x41')]=[{'all':!![]}];}return db[_0x30ed('0x2c')][_0x30ed('0x42')](_0xdc81bd);})['then'](function(_0x76df6d){_0x5463f6[_0x30ed('0x43')]=_0x76df6d;return _0x5463f6;})[_0x30ed('0x25')](respondWithFilteredResult(_0x51f867,_0xdc81bd))['catch'](handleError(_0x51f867,null));};exports[_0x30ed('0x44')]=function(_0x7604d6,_0x215f3a){var _0x2012fe={'raw':!![],'where':{'id':_0x7604d6['params']['id']}},_0x429374={};_0x429374['model']=_[_0x30ed('0x32')](db[_0x30ed('0x2c')][_0x30ed('0x2d')]);_0x429374[_0x30ed('0x31')]=_['keys'](_0x7604d6[_0x30ed('0x31')]);_0x429374[_0x30ed('0x3b')]=_[_0x30ed('0x33')](_0x429374[_0x30ed('0x30')],_0x429374[_0x30ed('0x31')]);_0x2012fe[_0x30ed('0x34')]=_[_0x30ed('0x33')](_0x429374[_0x30ed('0x30')],qs[_0x30ed('0x35')](_0x7604d6[_0x30ed('0x31')][_0x30ed('0x35')]));_0x2012fe[_0x30ed('0x34')]=_0x2012fe[_0x30ed('0x34')]['length']?_0x2012fe[_0x30ed('0x34')]:_0x429374['model'];if(_0x7604d6[_0x30ed('0x31')][_0x30ed('0x45')]){_0x2012fe[_0x30ed('0x41')]=[{'all':!![]}];}_0x2012fe=_['merge']({},_0x2012fe,_0x7604d6['options']);return db[_0x30ed('0x2c')][_0x30ed('0x46')](_0x2012fe)[_0x30ed('0x25')](handleEntityNotFound(_0x215f3a,null))['then'](respondWithResult(_0x215f3a,null))[_0x30ed('0x47')](handleError(_0x215f3a,null));};exports[_0x30ed('0x48')]=function(_0x1ac9c3,_0x66a9b5){return db[_0x30ed('0x2c')]['create'](_0x1ac9c3['body'],{})[_0x30ed('0x25')](respondWithResult(_0x66a9b5,0xc9))['catch'](handleError(_0x66a9b5,null));};exports[_0x30ed('0x23')]=function(_0x2732bd,_0x5ebf4d){if(_0x2732bd[_0x30ed('0x49')]['id']){delete _0x2732bd[_0x30ed('0x49')]['id'];}return db[_0x30ed('0x2c')]['find']({'where':{'id':_0x2732bd['params']['id']}})['then'](handleEntityNotFound(_0x5ebf4d,null))[_0x30ed('0x25')](saveUpdates(_0x2732bd[_0x30ed('0x49')],null))[_0x30ed('0x25')](respondWithResult(_0x5ebf4d,null))[_0x30ed('0x47')](handleError(_0x5ebf4d,null));};exports[_0x30ed('0x24')]=function(_0x2e16f7,_0x420ebb){return db[_0x30ed('0x2c')][_0x30ed('0x46')]({'where':{'id':_0x2e16f7['params']['id']}})[_0x30ed('0x25')](handleEntityNotFound(_0x420ebb,null))['then'](removeEntity(_0x420ebb,null))[_0x30ed('0x47')](handleError(_0x420ebb,null));}; \ No newline at end of file +var _0xbd90=['error','stack','name','send','index','map','VtigerField','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','keys','length','find','create','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','offset','set','json','apply','reject','save','update','then','end'];(function(_0x1135b1,_0x644ab2){var _0x387f6b=function(_0x515757){while(--_0x515757){_0x1135b1['push'](_0x1135b1['shift']());}};_0x387f6b(++_0x644ab2);}(_0xbd90,0x113));var _0x0bd9=function(_0x351ac1,_0x3b532c){_0x351ac1=_0x351ac1-0x0;var _0x5a1015=_0xbd90[_0x351ac1];return _0x5a1015;};'use strict';var emlformat=require(_0x0bd9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0bd9('0x1'));var jsonpatch=require(_0x0bd9('0x2'));var rp=require(_0x0bd9('0x3'));var moment=require(_0x0bd9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0bd9('0x5'));var util=require(_0x0bd9('0x6'));var path=require(_0x0bd9('0x7'));var sox=require(_0x0bd9('0x8'));var csv=require(_0x0bd9('0x9'));var ejs=require(_0x0bd9('0xa'));var fs=require('fs');var fs_extra=require(_0x0bd9('0xb'));var _=require(_0x0bd9('0xc'));var squel=require(_0x0bd9('0xd'));var crypto=require(_0x0bd9('0xe'));var jsforce=require(_0x0bd9('0xf'));var deskjs=require(_0x0bd9('0x10'));var toCsv=require('to-csv');var querystring=require(_0x0bd9('0x11'));var Papa=require(_0x0bd9('0x12'));var Redis=require(_0x0bd9('0x13'));var authService=require(_0x0bd9('0x14'));var qs=require(_0x0bd9('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0bd9('0x16'));var logger=require(_0x0bd9('0x17'))(_0x0bd9('0x18'));var utils=require('../../config/utils');var config=require(_0x0bd9('0x19'));var licenseUtil=require(_0x0bd9('0x1a'));var db=require(_0x0bd9('0x1b'))['db'];function respondWithStatusCode(_0x49d9aa,_0x3ff2d8){_0x3ff2d8=_0x3ff2d8||0xcc;return function(_0x105ae1){if(_0x105ae1){return _0x49d9aa[_0x0bd9('0x1c')](_0x3ff2d8);}return _0x49d9aa[_0x0bd9('0x1d')](_0x3ff2d8)['end']();};}function respondWithResult(_0x29f04a,_0x354240){_0x354240=_0x354240||0xc8;return function(_0x382781){if(_0x382781){return _0x29f04a[_0x0bd9('0x1d')](_0x354240)['json'](_0x382781);}};}function respondWithFilteredResult(_0x27f377,_0x2953fe){return function(_0x30157c){if(_0x30157c){var _0x412ee1=typeof _0x2953fe['offset']===_0x0bd9('0x1e')&&typeof _0x2953fe['limit']===_0x0bd9('0x1e');var _0x2d656f=_0x30157c[_0x0bd9('0x1f')];var _0x2ecd4f=_0x412ee1?0x0:_0x2953fe[_0x0bd9('0x20')];var _0x4b168f=_0x412ee1?_0x30157c['count']:_0x2953fe[_0x0bd9('0x20')]+_0x2953fe['limit'];var _0x35d8e7;if(_0x4b168f>=_0x2d656f){_0x4b168f=_0x2d656f;_0x35d8e7=0xc8;}else{_0x35d8e7=0xce;}_0x27f377['status'](_0x35d8e7);return _0x27f377[_0x0bd9('0x21')]('Content-Range',_0x2ecd4f+'-'+_0x4b168f+'/'+_0x2d656f)[_0x0bd9('0x22')](_0x30157c);}return null;};}function patchUpdates(_0x547e6e){return function(_0x21a200){try{jsonpatch[_0x0bd9('0x23')](_0x21a200,_0x547e6e,!![]);}catch(_0x5a2b57){return BPromise[_0x0bd9('0x24')](_0x5a2b57);}return _0x21a200[_0x0bd9('0x25')]();};}function saveUpdates(_0x30c715,_0x1bf9a5){return function(_0xc005c4){if(_0xc005c4){return _0xc005c4[_0x0bd9('0x26')](_0x30c715)['then'](function(_0x1b0522){return _0x1b0522;});}return null;};}function removeEntity(_0x375659,_0x178702){return function(_0xbdac14){if(_0xbdac14){return _0xbdac14['destroy']()[_0x0bd9('0x27')](function(){_0x375659[_0x0bd9('0x1d')](0xcc)[_0x0bd9('0x28')]();});}};}function handleEntityNotFound(_0x591fa3,_0x11ff09){return function(_0x57a7db){if(!_0x57a7db){_0x591fa3['sendStatus'](0x194);}return _0x57a7db;};}function handleError(_0x4950d6,_0x4c9895){_0x4c9895=_0x4c9895||0x1f4;return function(_0x86688c){logger[_0x0bd9('0x29')](_0x86688c[_0x0bd9('0x2a')]);if(_0x86688c[_0x0bd9('0x2b')]){delete _0x86688c['name'];}_0x4950d6[_0x0bd9('0x1d')](_0x4c9895)[_0x0bd9('0x2c')](_0x86688c);};}exports[_0x0bd9('0x2d')]=function(_0x4fd4a2,_0xde757d){var _0x2bc725={},_0x3e3115={},_0x3086c7={'count':0x0,'rows':[]};var _0x216844=_[_0x0bd9('0x2e')](db[_0x0bd9('0x2f')][_0x0bd9('0x30')],function(_0x5bb0d4){return{'name':_0x5bb0d4['fieldName'],'type':_0x5bb0d4[_0x0bd9('0x31')][_0x0bd9('0x32')]};});_0x3e3115[_0x0bd9('0x33')]=_['map'](_0x216844,_0x0bd9('0x2b'));_0x3e3115[_0x0bd9('0x34')]=_['keys'](_0x4fd4a2[_0x0bd9('0x34')]);_0x3e3115[_0x0bd9('0x35')]=_[_0x0bd9('0x36')](_0x3e3115['model'],_0x3e3115[_0x0bd9('0x34')]);_0x2bc725['attributes']=_[_0x0bd9('0x36')](_0x3e3115[_0x0bd9('0x33')],qs[_0x0bd9('0x37')](_0x4fd4a2[_0x0bd9('0x34')][_0x0bd9('0x37')]));_0x2bc725[_0x0bd9('0x38')]=_0x2bc725['attributes']['length']?_0x2bc725[_0x0bd9('0x38')]:_0x3e3115['model'];if(!_0x4fd4a2['query'][_0x0bd9('0x39')](_0x0bd9('0x3a'))){_0x2bc725['limit']=qs[_0x0bd9('0x3b')](_0x4fd4a2['query'][_0x0bd9('0x3b')]);_0x2bc725[_0x0bd9('0x20')]=qs[_0x0bd9('0x20')](_0x4fd4a2[_0x0bd9('0x34')]['offset']);}_0x2bc725['order']=qs[_0x0bd9('0x3c')](_0x4fd4a2[_0x0bd9('0x34')][_0x0bd9('0x3c')]);_0x2bc725[_0x0bd9('0x3d')]=qs['filters'](_[_0x0bd9('0x3e')](_0x4fd4a2[_0x0bd9('0x34')],_0x3e3115[_0x0bd9('0x35')]),_0x216844);if(_0x4fd4a2[_0x0bd9('0x34')][_0x0bd9('0x3f')]){_0x2bc725[_0x0bd9('0x3d')]=_['merge'](_0x2bc725['where'],{'$or':_[_0x0bd9('0x2e')](_0x216844,function(_0x432ca4){if(_0x432ca4[_0x0bd9('0x31')]!==_0x0bd9('0x40')){var _0x282175={};_0x282175[_0x432ca4[_0x0bd9('0x2b')]]={'$like':'%'+_0x4fd4a2[_0x0bd9('0x34')][_0x0bd9('0x3f')]+'%'};return _0x282175;}})});}_0x2bc725=_[_0x0bd9('0x41')]({},_0x2bc725,_0x4fd4a2[_0x0bd9('0x42')]);var _0x4a2ec3={'where':_0x2bc725['where']};return db['VtigerField']['count'](_0x4a2ec3)[_0x0bd9('0x27')](function(_0x3e35c1){_0x3086c7[_0x0bd9('0x1f')]=_0x3e35c1;if(_0x4fd4a2[_0x0bd9('0x34')][_0x0bd9('0x43')]){_0x2bc725[_0x0bd9('0x44')]=[{'all':!![]}];}return db[_0x0bd9('0x2f')][_0x0bd9('0x45')](_0x2bc725);})[_0x0bd9('0x27')](function(_0x2138cd){_0x3086c7[_0x0bd9('0x46')]=_0x2138cd;return _0x3086c7;})[_0x0bd9('0x27')](respondWithFilteredResult(_0xde757d,_0x2bc725))[_0x0bd9('0x47')](handleError(_0xde757d,null));};exports['show']=function(_0x44201f,_0x15caa2){var _0x11b8ca={'raw':!![],'where':{'id':_0x44201f[_0x0bd9('0x48')]['id']}},_0x4efb64={};_0x4efb64['model']=_['keys'](db[_0x0bd9('0x2f')][_0x0bd9('0x30')]);_0x4efb64[_0x0bd9('0x34')]=_[_0x0bd9('0x49')](_0x44201f[_0x0bd9('0x34')]);_0x4efb64[_0x0bd9('0x35')]=_[_0x0bd9('0x36')](_0x4efb64[_0x0bd9('0x33')],_0x4efb64[_0x0bd9('0x34')]);_0x11b8ca[_0x0bd9('0x38')]=_[_0x0bd9('0x36')](_0x4efb64['model'],qs[_0x0bd9('0x37')](_0x44201f[_0x0bd9('0x34')][_0x0bd9('0x37')]));_0x11b8ca[_0x0bd9('0x38')]=_0x11b8ca[_0x0bd9('0x38')][_0x0bd9('0x4a')]?_0x11b8ca[_0x0bd9('0x38')]:_0x4efb64[_0x0bd9('0x33')];if(_0x44201f[_0x0bd9('0x34')][_0x0bd9('0x43')]){_0x11b8ca[_0x0bd9('0x44')]=[{'all':!![]}];}_0x11b8ca=_[_0x0bd9('0x41')]({},_0x11b8ca,_0x44201f[_0x0bd9('0x42')]);return db[_0x0bd9('0x2f')][_0x0bd9('0x4b')](_0x11b8ca)[_0x0bd9('0x27')](handleEntityNotFound(_0x15caa2,null))[_0x0bd9('0x27')](respondWithResult(_0x15caa2,null))[_0x0bd9('0x47')](handleError(_0x15caa2,null));};exports[_0x0bd9('0x4c')]=function(_0x41bffd,_0x2ec3af){return db[_0x0bd9('0x2f')][_0x0bd9('0x4c')](_0x41bffd[_0x0bd9('0x4d')],{})[_0x0bd9('0x27')](respondWithResult(_0x2ec3af,0xc9))[_0x0bd9('0x47')](handleError(_0x2ec3af,null));};exports[_0x0bd9('0x26')]=function(_0x5b3661,_0x428af7){if(_0x5b3661[_0x0bd9('0x4d')]['id']){delete _0x5b3661[_0x0bd9('0x4d')]['id'];}return db[_0x0bd9('0x2f')]['find']({'where':{'id':_0x5b3661[_0x0bd9('0x48')]['id']}})[_0x0bd9('0x27')](handleEntityNotFound(_0x428af7,null))[_0x0bd9('0x27')](saveUpdates(_0x5b3661[_0x0bd9('0x4d')],null))['then'](respondWithResult(_0x428af7,null))[_0x0bd9('0x47')](handleError(_0x428af7,null));};exports[_0x0bd9('0x4e')]=function(_0x45ebd6,_0x511caa){return db['VtigerField'][_0x0bd9('0x4b')]({'where':{'id':_0x45ebd6[_0x0bd9('0x48')]['id']}})[_0x0bd9('0x27')](handleEntityNotFound(_0x511caa,null))[_0x0bd9('0x27')](removeEntity(_0x511caa,null))['catch'](handleError(_0x511caa,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index cfef8e8..5649da2 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 _0x4d44=['rimraf','../../config/environment','./intVtigerField.attributes','define','VtigerField','int_vtiger_fields','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x4d44,0x1e7));var _0x44d4=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x4d44[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0x44d4('0x0'));var util=require(_0x44d4('0x1'));var logger=require(_0x44d4('0x2'))(_0x44d4('0x3'));var moment=require(_0x44d4('0x4'));var BPromise=require(_0x44d4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x44d4('0x6'));var rimraf=require(_0x44d4('0x7'));var config=require(_0x44d4('0x8'));var attributes=require(_0x44d4('0x9'));module['exports']=function(_0x57cc8e,_0x4aff68){return _0x57cc8e[_0x44d4('0xa')](_0x44d4('0xb'),attributes,{'tableName':_0x44d4('0xc'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1e73=['vtiger_unique_index','idField','FieldId','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','VtigerField','int_vtiger_fields'];(function(_0x1a8c0b,_0x5a30fd){var _0x555ea5=function(_0x4d43eb){while(--_0x4d43eb){_0x1a8c0b['push'](_0x1a8c0b['shift']());}};_0x555ea5(++_0x5a30fd);}(_0x1e73,0x183));var _0x31e7=function(_0x38fb8b,_0x70dd0a){_0x38fb8b=_0x38fb8b-0x0;var _0x1ec681=_0x1e73[_0x38fb8b];return _0x1ec681;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x31e7('0x0'));var BPromise=require(_0x31e7('0x1'));var rp=require(_0x31e7('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x31e7('0x3'));var config=require(_0x31e7('0x4'));var attributes=require('./intVtigerField.attributes');module[_0x31e7('0x5')]=function(_0x1a3b82,_0xcf1599){return _0x1a3b82[_0x31e7('0x6')](_0x31e7('0x7'),attributes,{'tableName':_0x31e7('0x8'),'paranoid':![],'indexes':[{'name':_0x31e7('0x9'),'fields':[_0x31e7('0xa'),_0x31e7('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index fd802ac..a2ba9df 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 _0x09c9=['VtigerField,\x20%s,\x20%s','request\x20sent','stringify','error','code','result','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info'];(function(_0x2ac4b6,_0x4ae162){var _0xd09d13=function(_0x2e6fbf){while(--_0x2e6fbf){_0x2ac4b6['push'](_0x2ac4b6['shift']());}};_0xd09d13(++_0x4ae162);}(_0x09c9,0xda));var _0x909c=function(_0x365543,_0x570115){_0x365543=_0x365543-0x0;var _0x9b933c=_0x09c9[_0x365543];return _0x9b933c;};'use strict';var _=require(_0x909c('0x0'));var util=require(_0x909c('0x1'));var moment=require('moment');var BPromise=require(_0x909c('0x2'));var rs=require(_0x909c('0x3'));var fs=require('fs');var Redis=require(_0x909c('0x4'));var db=require(_0x909c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x909c('0x6'))(_0x909c('0x7'));var config=require('../../config/environment');var jayson=require(_0x909c('0x8'));var client=jayson['client'][_0x909c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x211576,_0x1e4f10,_0x950b21){return new BPromise(function(_0x5b1f03,_0x2ed604){return client[_0x909c('0xa')](_0x211576,_0x950b21)[_0x909c('0xb')](function(_0x22f119){logger[_0x909c('0xc')](_0x909c('0xd'),_0x1e4f10,_0x909c('0xe'));logger['debug']('VtigerField,\x20%s,\x20%s,\x20%s',_0x1e4f10,'request\x20sent',JSON[_0x909c('0xf')](_0x22f119));if(_0x22f119[_0x909c('0x10')]){if(_0x22f119['error'][_0x909c('0x11')]===0x1f4){logger[_0x909c('0x10')](_0x909c('0xd'),_0x1e4f10,_0x22f119[_0x909c('0x10')]['message']);return _0x2ed604(_0x22f119[_0x909c('0x10')]['message']);}logger['error'](_0x909c('0xd'),_0x1e4f10,_0x22f119[_0x909c('0x10')]['message']);return _0x5b1f03(_0x22f119['error']['message']);}else{logger[_0x909c('0xc')]('VtigerField,\x20%s,\x20%s',_0x1e4f10,'request\x20sent');_0x5b1f03(_0x22f119[_0x909c('0x12')][_0x909c('0x13')]);}})[_0x909c('0x14')](function(_0x57a207){logger['error']('VtigerField,\x20%s,\x20%s',_0x1e4f10,_0x57a207);_0x2ed604(_0x57a207);});});} \ No newline at end of file +var _0xf023=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xf79bae,_0x263b2a){var _0x5d2cb7=function(_0x27c86b){while(--_0x27c86b){_0xf79bae['push'](_0xf79bae['shift']());}};_0x5d2cb7(++_0x263b2a);}(_0xf023,0x90));var _0x3f02=function(_0x34941d,_0x18776e){_0x34941d=_0x34941d-0x0;var _0x592e6b=_0xf023[_0x34941d];return _0x592e6b;};'use strict';var _=require(_0x3f02('0x0'));var util=require('util');var moment=require(_0x3f02('0x1'));var BPromise=require(_0x3f02('0x2'));var rs=require(_0x3f02('0x3'));var fs=require('fs');var Redis=require(_0x3f02('0x4'));var db=require(_0x3f02('0x5'))['db'];var utils=require(_0x3f02('0x6'));var logger=require(_0x3f02('0x7'))(_0x3f02('0x8'));var config=require(_0x3f02('0x9'));var jayson=require(_0x3f02('0xa'));var client=jayson['client'][_0x3f02('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39bc43,_0x597354,_0x50e3d9){return new BPromise(function(_0x450337,_0x505dbd){return client[_0x3f02('0xc')](_0x39bc43,_0x50e3d9)[_0x3f02('0xd')](function(_0x2425bf){logger[_0x3f02('0xe')](_0x3f02('0xf'),_0x597354,_0x3f02('0x10'));logger[_0x3f02('0x11')](_0x3f02('0x12'),_0x597354,_0x3f02('0x10'),JSON[_0x3f02('0x13')](_0x2425bf));if(_0x2425bf['error']){if(_0x2425bf['error'][_0x3f02('0x14')]===0x1f4){logger[_0x3f02('0x15')](_0x3f02('0xf'),_0x597354,_0x2425bf[_0x3f02('0x15')]['message']);return _0x505dbd(_0x2425bf[_0x3f02('0x15')]['message']);}logger['error'](_0x3f02('0xf'),_0x597354,_0x2425bf[_0x3f02('0x15')]['message']);return _0x450337(_0x2425bf['error'][_0x3f02('0x16')]);}else{logger[_0x3f02('0xe')]('VtigerField,\x20%s,\x20%s',_0x597354,_0x3f02('0x10'));_0x450337(_0x2425bf[_0x3f02('0x17')][_0x3f02('0x16')]);}})[_0x3f02('0x18')](function(_0x1c0d6f){logger[_0x3f02('0x15')](_0x3f02('0xf'),_0x597354,_0x1c0d6f);_0x505dbd(_0x1c0d6f);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 3e380c9..d773ee1 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 _0x3ab9=['/:id/configurations','getConfigurations','getFields','create','post','put','update','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','/:id','show'];(function(_0x33411b,_0x6abe39){var _0x34e621=function(_0x3203f4){while(--_0x3203f4){_0x33411b['push'](_0x33411b['shift']());}};_0x34e621(++_0x6abe39);}(_0x3ab9,0x6d));var _0x93ab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ab9[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x93ab('0x0'));var util=require('util');var path=require(_0x93ab('0x1'));var timeout=require(_0x93ab('0x2'));var express=require(_0x93ab('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x93ab('0x4'));var config=require(_0x93ab('0x5'));var controller=require(_0x93ab('0x6'));router[_0x93ab('0x7')]('/',auth[_0x93ab('0x8')](),controller['index']);router[_0x93ab('0x7')](_0x93ab('0x9'),auth[_0x93ab('0x8')](),controller[_0x93ab('0xa')]);router[_0x93ab('0x7')](_0x93ab('0xb'),auth[_0x93ab('0x8')](),controller[_0x93ab('0xc')]);router[_0x93ab('0x7')]('/:id/fields',auth[_0x93ab('0x8')](),controller[_0x93ab('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x93ab('0xe')]);router[_0x93ab('0xf')]('/:id/configurations',auth[_0x93ab('0x8')](),controller['addConfiguration']);router[_0x93ab('0x10')](_0x93ab('0x9'),auth[_0x93ab('0x8')](),controller[_0x93ab('0x11')]);router['delete'](_0x93ab('0x9'),auth[_0x93ab('0x8')](),controller[_0x93ab('0x12')]);module[_0x93ab('0x13')]=router; \ No newline at end of file +var _0x9199=['addConfiguration','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','isAuthenticated','post'];(function(_0x41ac49,_0x4c53df){var _0x278f7c=function(_0x282bbe){while(--_0x282bbe){_0x41ac49['push'](_0x41ac49['shift']());}};_0x278f7c(++_0x4c53df);}(_0x9199,0x1e9));var _0x9919=function(_0x784d87,_0x4f0284){_0x784d87=_0x784d87-0x0;var _0x22e453=_0x9199[_0x784d87];return _0x22e453;};'use strict';var multer=require(_0x9919('0x0'));var util=require(_0x9919('0x1'));var path=require('path');var timeout=require(_0x9919('0x2'));var express=require('express');var router=express[_0x9919('0x3')]();var fs_extra=require(_0x9919('0x4'));var auth=require(_0x9919('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9919('0x6'));var controller=require(_0x9919('0x7'));router[_0x9919('0x8')]('/',auth['isAuthenticated'](),controller[_0x9919('0x9')]);router[_0x9919('0x8')](_0x9919('0xa'),auth['isAuthenticated'](),controller[_0x9919('0xb')]);router['get'](_0x9919('0xc'),auth['isAuthenticated'](),controller[_0x9919('0xd')]);router['get'](_0x9919('0xe'),auth[_0x9919('0xf')](),controller['getFields']);router[_0x9919('0x10')]('/',auth[_0x9919('0xf')](),controller['create']);router[_0x9919('0x10')](_0x9919('0xc'),auth['isAuthenticated'](),controller[_0x9919('0x11')]);router[_0x9919('0x12')]('/:id',auth[_0x9919('0xf')](),controller[_0x9919('0x13')]);router[_0x9919('0x14')](_0x9919('0xa'),auth[_0x9919('0xf')](),controller[_0x9919('0x15')]);module[_0x9919('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 389e343..d7a31b2 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 _0xaf1b=['password','token','newTab','sequelize','exports','STRING','username','remoteUri','ENUM'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0xaf1b,0x11a));var _0xbaf1=function(_0x208992,_0x55ba40){_0x208992=_0x208992-0x0;var _0x5b287e=_0xaf1b[_0x208992];return _0x5b287e;};'use strict';var Sequelize=require(_0xbaf1('0x0'));module[_0xbaf1('0x1')]={'name':{'type':Sequelize[_0xbaf1('0x2')]},'description':{'type':Sequelize[_0xbaf1('0x2')]},'username':{'type':Sequelize[_0xbaf1('0x2')],'unique':_0xbaf1('0x3')},'password':{'type':Sequelize[_0xbaf1('0x2')]},'token':{'type':Sequelize[_0xbaf1('0x2')]},'remoteUri':{'type':Sequelize[_0xbaf1('0x2')],'unique':_0xbaf1('0x4')},'authType':{'type':Sequelize[_0xbaf1('0x5')](_0xbaf1('0x6'),_0xbaf1('0x7')),'defaultValue':_0xbaf1('0x6')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xbaf1('0x5')]('integrationTab',_0xbaf1('0x8')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xcd05=['username','remoteUri','ENUM','integrationTab','newTab','sequelize','STRING'];(function(_0x163417,_0x396d13){var _0x4eedd8=function(_0x468edc){while(--_0x468edc){_0x163417['push'](_0x163417['shift']());}};_0x4eedd8(++_0x396d13);}(_0xcd05,0x163));var _0x5cd0=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xcd05[_0x3b0731];return _0x4204d7;};'use strict';var Sequelize=require(_0x5cd0('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x5cd0('0x1')],'unique':_0x5cd0('0x2')},'password':{'type':Sequelize[_0x5cd0('0x1')]},'token':{'type':Sequelize[_0x5cd0('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x5cd0('0x3')},'authType':{'type':Sequelize[_0x5cd0('0x4')]('password','token'),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x5cd0('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x5cd0('0x4')](_0x5cd0('0x5'),_0x5cd0('0x6')),'defaultValue':_0x5cd0('0x5')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index a5790c4..387fd32 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 _0x96cc=['includes','position','title','system_field_options','custom_field_options','test','statusCode','error','stringify','Wrong\x20credentials','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','end','stack','name','send','index','map','ZendeskAccount','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','rawAttributes','intersection','includeAll','options','find','create','body','ZendeskConfiguration','pick','getConfigurations','findOne','AccountId','Subjects','Descriptions','channel','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','format','%s/%s','ticket_fields','headers','%s:%s','base64','Basic\x20%s','%s/token:%s','Sequelize','Unknown\x20authentication\x20type','subject','group','assignee'];(function(_0xc69434,_0x55e9a8){var _0x5223d5=function(_0x4cb8de){while(--_0x4cb8de){_0xc69434['push'](_0xc69434['shift']());}};_0x5223d5(++_0x55e9a8);}(_0x96cc,0x16c));var _0xc96c=function(_0x2f7cc0,_0xa7ddc9){_0x2f7cc0=_0x2f7cc0-0x0;var _0x42ac73=_0x96cc[_0x2f7cc0];return _0x42ac73;};'use strict';var emlformat=require(_0xc96c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc96c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc96c('0x2'));var moment=require(_0xc96c('0x3'));var BPromise=require(_0xc96c('0x4'));var Mustache=require(_0xc96c('0x5'));var util=require(_0xc96c('0x6'));var path=require(_0xc96c('0x7'));var sox=require(_0xc96c('0x8'));var csv=require(_0xc96c('0x9'));var ejs=require(_0xc96c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc96c('0xb'));var squel=require(_0xc96c('0xc'));var crypto=require(_0xc96c('0xd'));var jsforce=require(_0xc96c('0xe'));var deskjs=require(_0xc96c('0xf'));var toCsv=require(_0xc96c('0x9'));var querystring=require(_0xc96c('0x10'));var Papa=require('papaparse');var Redis=require(_0xc96c('0x11'));var authService=require(_0xc96c('0x12'));var qs=require(_0xc96c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc96c('0x14'));var logger=require('../../config/logger')(_0xc96c('0x15'));var utils=require('../../config/utils');var config=require(_0xc96c('0x16'));var licenseUtil=require(_0xc96c('0x17'));var db=require(_0xc96c('0x18'))['db'];var integrations=require(_0xc96c('0x19'));function respondWithStatusCode(_0x5f27f3,_0x3fe3d5){_0x3fe3d5=_0x3fe3d5||0xcc;return function(_0x43fcaa){if(_0x43fcaa){return _0x5f27f3[_0xc96c('0x1a')](_0x3fe3d5);}return _0x5f27f3[_0xc96c('0x1b')](_0x3fe3d5)['end']();};}function respondWithResult(_0x35da94,_0xbed0c9){_0xbed0c9=_0xbed0c9||0xc8;return function(_0x399267){if(_0x399267){return _0x35da94[_0xc96c('0x1b')](_0xbed0c9)[_0xc96c('0x1c')](_0x399267);}};}function respondWithFilteredResult(_0x46455a,_0x1765d9){return function(_0x23e357){if(_0x23e357){var _0x174852=typeof _0x1765d9[_0xc96c('0x1d')]===_0xc96c('0x1e')&&typeof _0x1765d9['limit']==='undefined';var _0x406791=_0x23e357[_0xc96c('0x1f')];var _0x16b6ce=_0x174852?0x0:_0x1765d9[_0xc96c('0x1d')];var _0x4aa6a3=_0x174852?_0x23e357[_0xc96c('0x1f')]:_0x1765d9[_0xc96c('0x1d')]+_0x1765d9[_0xc96c('0x20')];var _0x3c0864;if(_0x4aa6a3>=_0x406791){_0x4aa6a3=_0x406791;_0x3c0864=0xc8;}else{_0x3c0864=0xce;}_0x46455a[_0xc96c('0x1b')](_0x3c0864);return _0x46455a[_0xc96c('0x21')](_0xc96c('0x22'),_0x16b6ce+'-'+_0x4aa6a3+'/'+_0x406791)[_0xc96c('0x1c')](_0x23e357);}return null;};}function patchUpdates(_0x28d762){return function(_0x2f25a3){try{jsonpatch[_0xc96c('0x23')](_0x2f25a3,_0x28d762,!![]);}catch(_0x1203a1){return BPromise[_0xc96c('0x24')](_0x1203a1);}return _0x2f25a3[_0xc96c('0x25')]();};}function saveUpdates(_0x325c54,_0x3b5c6c){return function(_0x3e2615){if(_0x3e2615){return _0x3e2615['update'](_0x325c54)[_0xc96c('0x26')](function(_0x4be783){return _0x4be783;});}return null;};}function removeEntity(_0x4456bf,_0x10ae21){return function(_0x2b1df9){if(_0x2b1df9){return _0x2b1df9[_0xc96c('0x27')]()[_0xc96c('0x26')](function(){_0x4456bf[_0xc96c('0x1b')](0xcc)[_0xc96c('0x28')]();});}};}function handleEntityNotFound(_0x14f171,_0x50fc07){return function(_0x3a23cb){if(!_0x3a23cb){_0x14f171[_0xc96c('0x1a')](0x194);}return _0x3a23cb;};}function handleError(_0x3f87cc,_0x294fee){_0x294fee=_0x294fee||0x1f4;return function(_0x58fab3){logger['error'](_0x58fab3[_0xc96c('0x29')]);if(_0x58fab3[_0xc96c('0x2a')]){delete _0x58fab3[_0xc96c('0x2a')];}_0x3f87cc[_0xc96c('0x1b')](_0x294fee)[_0xc96c('0x2b')](_0x58fab3);};}exports[_0xc96c('0x2c')]=function(_0x427cb2,_0x1c911b){var _0xa0efbc={},_0x27925f={},_0x325cda={'count':0x0,'rows':[]};var _0x40c72b=_[_0xc96c('0x2d')](db[_0xc96c('0x2e')]['rawAttributes'],function(_0x3aa436){return{'name':_0x3aa436['fieldName'],'type':_0x3aa436[_0xc96c('0x2f')][_0xc96c('0x30')]};});_0x27925f[_0xc96c('0x31')]=_['map'](_0x40c72b,_0xc96c('0x2a'));_0x27925f[_0xc96c('0x32')]=_[_0xc96c('0x33')](_0x427cb2[_0xc96c('0x32')]);_0x27925f['filters']=_['intersection'](_0x27925f[_0xc96c('0x31')],_0x27925f[_0xc96c('0x32')]);_0xa0efbc[_0xc96c('0x34')]=_['intersection'](_0x27925f[_0xc96c('0x31')],qs[_0xc96c('0x35')](_0x427cb2[_0xc96c('0x32')][_0xc96c('0x35')]));_0xa0efbc['attributes']=_0xa0efbc[_0xc96c('0x34')][_0xc96c('0x36')]?_0xa0efbc['attributes']:_0x27925f[_0xc96c('0x31')];if(!_0x427cb2[_0xc96c('0x32')][_0xc96c('0x37')](_0xc96c('0x38'))){_0xa0efbc[_0xc96c('0x20')]=qs[_0xc96c('0x20')](_0x427cb2['query'][_0xc96c('0x20')]);_0xa0efbc[_0xc96c('0x1d')]=qs[_0xc96c('0x1d')](_0x427cb2[_0xc96c('0x32')][_0xc96c('0x1d')]);}_0xa0efbc[_0xc96c('0x39')]=qs['sort'](_0x427cb2['query'][_0xc96c('0x3a')]);_0xa0efbc[_0xc96c('0x3b')]=qs['filters'](_['pick'](_0x427cb2[_0xc96c('0x32')],_0x27925f[_0xc96c('0x3c')]),_0x40c72b);if(_0x427cb2[_0xc96c('0x32')][_0xc96c('0x3d')]){_0xa0efbc[_0xc96c('0x3b')]=_[_0xc96c('0x3e')](_0xa0efbc[_0xc96c('0x3b')],{'$or':_[_0xc96c('0x2d')](_0x40c72b,function(_0x3fc40d){if(_0x3fc40d[_0xc96c('0x2f')]!==_0xc96c('0x3f')){var _0x5ed343={};_0x5ed343[_0x3fc40d[_0xc96c('0x2a')]]={'$like':'%'+_0x427cb2[_0xc96c('0x32')][_0xc96c('0x3d')]+'%'};return _0x5ed343;}})});}_0xa0efbc=_[_0xc96c('0x3e')]({},_0xa0efbc,_0x427cb2['options']);var _0x167671={'where':_0xa0efbc[_0xc96c('0x3b')]};return db[_0xc96c('0x2e')]['count'](_0x167671)['then'](function(_0x311a9e){_0x325cda[_0xc96c('0x1f')]=_0x311a9e;if(_0x427cb2[_0xc96c('0x32')]['includeAll']){_0xa0efbc[_0xc96c('0x40')]=[{'all':!![]}];}return db[_0xc96c('0x2e')][_0xc96c('0x41')](_0xa0efbc);})[_0xc96c('0x26')](function(_0x1790a8){_0x325cda[_0xc96c('0x42')]=_0x1790a8;return _0x325cda;})[_0xc96c('0x26')](respondWithFilteredResult(_0x1c911b,_0xa0efbc))[_0xc96c('0x43')](handleError(_0x1c911b,null));};exports[_0xc96c('0x44')]=function(_0x4d5a1b,_0x4c3088){var _0x30b3ac={'raw':![],'where':{'id':_0x4d5a1b[_0xc96c('0x45')]['id']}},_0x2199c4={};_0x2199c4[_0xc96c('0x31')]=_['keys'](db['ZendeskAccount'][_0xc96c('0x46')]);_0x2199c4[_0xc96c('0x32')]=_[_0xc96c('0x33')](_0x4d5a1b[_0xc96c('0x32')]);_0x2199c4[_0xc96c('0x3c')]=_[_0xc96c('0x47')](_0x2199c4[_0xc96c('0x31')],_0x2199c4['query']);_0x30b3ac[_0xc96c('0x34')]=_[_0xc96c('0x47')](_0x2199c4[_0xc96c('0x31')],qs[_0xc96c('0x35')](_0x4d5a1b['query']['fields']));_0x30b3ac[_0xc96c('0x34')]=_0x30b3ac[_0xc96c('0x34')][_0xc96c('0x36')]?_0x30b3ac[_0xc96c('0x34')]:_0x2199c4[_0xc96c('0x31')];if(_0x4d5a1b[_0xc96c('0x32')][_0xc96c('0x48')]){_0x30b3ac[_0xc96c('0x40')]=[{'all':!![]}];}_0x30b3ac=_[_0xc96c('0x3e')]({},_0x30b3ac,_0x4d5a1b[_0xc96c('0x49')]);return db[_0xc96c('0x2e')][_0xc96c('0x4a')](_0x30b3ac)[_0xc96c('0x26')](handleEntityNotFound(_0x4c3088,null))['then'](respondWithResult(_0x4c3088,null))[_0xc96c('0x43')](handleError(_0x4c3088,null));};exports[_0xc96c('0x4b')]=function(_0x307d58,_0x305ebd){return db['ZendeskAccount'][_0xc96c('0x4b')](_0x307d58['body'],{})[_0xc96c('0x26')](respondWithResult(_0x305ebd,0xc9))[_0xc96c('0x43')](handleError(_0x305ebd,null));};exports['update']=function(_0x2581ae,_0x400fe6){if(_0x2581ae[_0xc96c('0x4c')]['id']){delete _0x2581ae[_0xc96c('0x4c')]['id'];}return db[_0xc96c('0x2e')][_0xc96c('0x4a')]({'where':{'id':_0x2581ae['params']['id']}})['then'](handleEntityNotFound(_0x400fe6,null))['then'](saveUpdates(_0x2581ae[_0xc96c('0x4c')],null))['then'](respondWithResult(_0x400fe6,null))[_0xc96c('0x43')](handleError(_0x400fe6,null));};exports[_0xc96c('0x27')]=function(_0x65a0a7,_0x17c764){return db[_0xc96c('0x2e')][_0xc96c('0x4a')]({'where':{'id':_0x65a0a7[_0xc96c('0x45')]['id']}})[_0xc96c('0x26')](handleEntityNotFound(_0x17c764,null))[_0xc96c('0x26')](removeEntity(_0x17c764,null))[_0xc96c('0x43')](handleError(_0x17c764,null));};exports['getConfigurations']=function(_0x3adefb,_0x15367d,_0x2b58c1){var _0x215cad={};var _0x1c7ea7={};var _0xcde9;var _0xad88c3;return db[_0xc96c('0x2e')]['findOne']({'where':{'id':_0x3adefb['params']['id']}})['then'](handleEntityNotFound(_0x15367d,null))['then'](function(_0x356ef3){if(_0x356ef3){_0xcde9=_0x356ef3;_0x1c7ea7[_0xc96c('0x31')]=_[_0xc96c('0x33')](db[_0xc96c('0x4d')][_0xc96c('0x46')]);_0x1c7ea7[_0xc96c('0x32')]=_[_0xc96c('0x33')](_0x3adefb['query']);_0x1c7ea7[_0xc96c('0x3c')]=_[_0xc96c('0x47')](_0x1c7ea7[_0xc96c('0x31')],_0x1c7ea7[_0xc96c('0x32')]);_0x215cad[_0xc96c('0x34')]=_[_0xc96c('0x47')](_0x1c7ea7[_0xc96c('0x31')],qs['fields'](_0x3adefb[_0xc96c('0x32')][_0xc96c('0x35')]));_0x215cad[_0xc96c('0x34')]=_0x215cad[_0xc96c('0x34')][_0xc96c('0x36')]?_0x215cad[_0xc96c('0x34')]:_0x1c7ea7[_0xc96c('0x31')];_0x215cad[_0xc96c('0x39')]=qs[_0xc96c('0x3a')](_0x3adefb[_0xc96c('0x32')][_0xc96c('0x3a')]);_0x215cad[_0xc96c('0x3b')]=qs[_0xc96c('0x3c')](_[_0xc96c('0x4e')](_0x3adefb['query'],_0x1c7ea7[_0xc96c('0x3c')]));if(_0x3adefb[_0xc96c('0x32')][_0xc96c('0x3d')]){_0x215cad[_0xc96c('0x3b')]=_[_0xc96c('0x3e')](_0x215cad['where'],{'$or':_[_0xc96c('0x2d')](_0x215cad[_0xc96c('0x34')],function(_0x9cd1fd){var _0x12bf27={};_0x12bf27[_0x9cd1fd]={'$like':'%'+_0x3adefb['query'][_0xc96c('0x3d')]+'%'};return _0x12bf27;})});}_0x215cad=_[_0xc96c('0x3e')]({},_0x215cad,_0x3adefb['options']);return _0xcde9['getConfigurations'](_0x215cad);}})['then'](function(_0x46de63){if(_0x46de63){_0xad88c3=_0x46de63[_0xc96c('0x36')];if(!_0x3adefb[_0xc96c('0x32')][_0xc96c('0x37')](_0xc96c('0x38'))){_0x215cad['limit']=qs['limit'](_0x3adefb[_0xc96c('0x32')][_0xc96c('0x20')]);_0x215cad[_0xc96c('0x1d')]=qs[_0xc96c('0x1d')](_0x3adefb[_0xc96c('0x32')]['offset']);}return _0xcde9[_0xc96c('0x4f')](_0x215cad);}})[_0xc96c('0x26')](function(_0x3a31bd){if(_0x3a31bd){return _0x3a31bd?{'count':_0xad88c3,'rows':_0x3a31bd}:null;}})[_0xc96c('0x26')](respondWithResult(_0x15367d,null))['catch'](handleError(_0x15367d,null));};exports['addConfiguration']=function(_0x443ed5,_0x229fae,_0x55bab7){if(_0x443ed5[_0xc96c('0x4c')]['id']){delete _0x443ed5['body']['id'];}return db[_0xc96c('0x2e')][_0xc96c('0x50')]({'where':{'id':_0x443ed5[_0xc96c('0x45')]['id']}})[_0xc96c('0x26')](handleEntityNotFound(_0x229fae,null))[_0xc96c('0x26')](function(_0x296e7d){if(_0x296e7d){_0x443ed5[_0xc96c('0x4c')][_0xc96c('0x51')]=_0x296e7d['id'];_0x443ed5[_0xc96c('0x4c')][_0xc96c('0x52')]=integrations['getSubjects'](_0x443ed5[_0xc96c('0x4c')]['channel'],_0x443ed5[_0xc96c('0x4c')][_0xc96c('0x2f')]);_0x443ed5['body'][_0xc96c('0x53')]=integrations['getDescriptions'](_0x443ed5[_0xc96c('0x4c')][_0xc96c('0x54')],_0x443ed5[_0xc96c('0x4c')][_0xc96c('0x2f')]);return db[_0xc96c('0x4d')][_0xc96c('0x4b')](_0x443ed5[_0xc96c('0x4c')],{'include':[{'model':db[_0xc96c('0x55')],'as':_0xc96c('0x52')},{'model':db['ZendeskField'],'as':_0xc96c('0x53')}]});}return null;})[_0xc96c('0x26')](respondWithResult(_0x229fae,null))[_0xc96c('0x43')](handleError(_0x229fae,null));};exports[_0xc96c('0x56')]=function(_0x5282cb,_0x4667f6,_0x1e927d){var _0x54f3fe='';return db['ZendeskAccount'][_0xc96c('0x50')]({'where':{'id':_0x5282cb['params']['id']},'attributes':['id',_0xc96c('0x57'),_0xc96c('0x58'),_0xc96c('0x59'),_0xc96c('0x5a'),_0xc96c('0x5b')]})[_0xc96c('0x26')](handleEntityNotFound(_0x4667f6,null))[_0xc96c('0x26')](function(_0x3fb9b9){if(_0x3fb9b9){_0x54f3fe=_0x3fb9b9[_0xc96c('0x5b')];var _0x54e2d3=_0x54f3fe[_0xc96c('0x5c')](-0x1);if(_0x54e2d3==='/'){_0x54f3fe=_0x54f3fe[_0xc96c('0x5d')](0x0,_0x54f3fe[_0xc96c('0x5e')](_0x54e2d3));}var _0x4831d3={'method':'GET','uri':util[_0xc96c('0x5f')](_0xc96c('0x60'),_0x54f3fe,_0xc96c('0x61')),'json':!![]};switch(_0x3fb9b9[_0xc96c('0x5a')]){case _0xc96c('0x58'):_0x4831d3[_0xc96c('0x62')]={'Authorization':util[_0xc96c('0x5f')]('Basic\x20%s',new Buffer(util[_0xc96c('0x5f')](_0xc96c('0x63'),_0x3fb9b9['username'],_0x3fb9b9[_0xc96c('0x58')]))['toString'](_0xc96c('0x64')))};break;case _0xc96c('0x59'):_0x4831d3[_0xc96c('0x62')]={'Authorization':util[_0xc96c('0x5f')](_0xc96c('0x65'),new Buffer(util[_0xc96c('0x5f')](_0xc96c('0x66'),_0x3fb9b9[_0xc96c('0x57')],_0x3fb9b9[_0xc96c('0x59')]))['toString'](_0xc96c('0x64')))};break;default:throw new db[(_0xc96c('0x67'))]['ValidationError'](_0xc96c('0x68'));}return rp(_0x4831d3);}})['then'](function(_0x3c0363){if(_0x3c0363){var _0x669dec=[_0xc96c('0x69'),'description',_0xc96c('0x6a'),_0xc96c('0x6b')];_['remove'](_0x3c0363[_0xc96c('0x61')],function(_0x46bf83){return _0x669dec[_0xc96c('0x6c')](_0x46bf83['type']);});return{'count':_0x3c0363[_0xc96c('0x61')][_0xc96c('0x36')],'rows':_[_0xc96c('0x2d')](_0x3c0363[_0xc96c('0x61')],function(_0x2f4254){return{'id':_0x2f4254['id'],'name':_0x2f4254[_0xc96c('0x6d')]>0x7?_0x2f4254[_0xc96c('0x6e')]:_0x2f4254[_0xc96c('0x2f')],'custom':_0x2f4254[_0xc96c('0x6d')]>0x7?!![]:![],'options':_0x2f4254[_0xc96c('0x6f')]?_0x2f4254[_0xc96c('0x6f')]:_0x2f4254[_0xc96c('0x70')]?_0x2f4254[_0xc96c('0x70')]:[]};})};}})[_0xc96c('0x26')](respondWithResult(_0x4667f6,null))[_0xc96c('0x43')](function(_0x54c9ad){var _0x2c5134=_0x5282cb[_0xc96c('0x32')][_0xc96c('0x71')]?0x1f4:_0x54c9ad[_0xc96c('0x72')]||0x1f4;logger[_0xc96c('0x73')]('getFields,\x20%s,\x20%s,\x20%s',_0xc96c('0x56'),_0x2c5134,JSON[_0xc96c('0x74')](_0x54c9ad));delete _0x54c9ad[_0xc96c('0x2a')];if(_0x2c5134===0x191){_0x2c5134=0x190;}_0x4667f6[_0xc96c('0x1b')](_0x2c5134)[_0xc96c('0x2b')](_0x5282cb['query']['test']?{'message':_0xc96c('0x75'),'statusCode':_0x54c9ad[_0xc96c('0x72')]}:_0x54c9ad);});}; \ No newline at end of file +var _0x04b8=['lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','end','stack','name','send','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','includeAll','ZendeskAccount','findAll','rows','catch','keys','include','find','create','body','params','getConfigurations','findOne','ZendeskConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ZendeskField','Descriptions','getFields','username','password','token','remoteUri','slice','lastIndexOf','GET','format','%s/%s','ticket_fields','authType','headers','Basic\x20%s','%s:%s','toString','base64','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','custom_field_options','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra'];(function(_0xe95d0f,_0x4d126c){var _0x5eaf6f=function(_0x4e0f2d){while(--_0x4e0f2d){_0xe95d0f['push'](_0xe95d0f['shift']());}};_0x5eaf6f(++_0x4d126c);}(_0x04b8,0x159));var _0x804b=function(_0x276cf2,_0x55f712){_0x276cf2=_0x276cf2-0x0;var _0xbc2037=_0x04b8[_0x276cf2];return _0xbc2037;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x804b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x804b('0x1'));var rp=require(_0x804b('0x2'));var moment=require('moment');var BPromise=require(_0x804b('0x3'));var Mustache=require(_0x804b('0x4'));var util=require('util');var path=require(_0x804b('0x5'));var sox=require(_0x804b('0x6'));var csv=require(_0x804b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x804b('0x8'));var _=require(_0x804b('0x9'));var squel=require(_0x804b('0xa'));var crypto=require('crypto');var jsforce=require(_0x804b('0xb'));var deskjs=require(_0x804b('0xc'));var toCsv=require('to-csv');var querystring=require(_0x804b('0xd'));var Papa=require(_0x804b('0xe'));var Redis=require(_0x804b('0xf'));var authService=require(_0x804b('0x10'));var qs=require(_0x804b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x804b('0x12'));var logger=require(_0x804b('0x13'))(_0x804b('0x14'));var utils=require(_0x804b('0x15'));var config=require(_0x804b('0x16'));var licenseUtil=require(_0x804b('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x804b('0x18'));function respondWithStatusCode(_0x5303cc,_0x23ee57){_0x23ee57=_0x23ee57||0xcc;return function(_0x3a2702){if(_0x3a2702){return _0x5303cc[_0x804b('0x19')](_0x23ee57);}return _0x5303cc[_0x804b('0x1a')](_0x23ee57)['end']();};}function respondWithResult(_0x215825,_0x1b01a7){_0x1b01a7=_0x1b01a7||0xc8;return function(_0x274bb8){if(_0x274bb8){return _0x215825[_0x804b('0x1a')](_0x1b01a7)['json'](_0x274bb8);}};}function respondWithFilteredResult(_0x2fd593,_0x8ccbe0){return function(_0x5e1cfe){if(_0x5e1cfe){var _0x3c5986=typeof _0x8ccbe0['offset']===_0x804b('0x1b')&&typeof _0x8ccbe0[_0x804b('0x1c')]===_0x804b('0x1b');var _0x1760f8=_0x5e1cfe[_0x804b('0x1d')];var _0x5a0a82=_0x3c5986?0x0:_0x8ccbe0[_0x804b('0x1e')];var _0x50b4fe=_0x3c5986?_0x5e1cfe[_0x804b('0x1d')]:_0x8ccbe0[_0x804b('0x1e')]+_0x8ccbe0[_0x804b('0x1c')];var _0x469251;if(_0x50b4fe>=_0x1760f8){_0x50b4fe=_0x1760f8;_0x469251=0xc8;}else{_0x469251=0xce;}_0x2fd593['status'](_0x469251);return _0x2fd593[_0x804b('0x1f')](_0x804b('0x20'),_0x5a0a82+'-'+_0x50b4fe+'/'+_0x1760f8)[_0x804b('0x21')](_0x5e1cfe);}return null;};}function patchUpdates(_0x11eaf6){return function(_0x27844b){try{jsonpatch[_0x804b('0x22')](_0x27844b,_0x11eaf6,!![]);}catch(_0x3241a0){return BPromise[_0x804b('0x23')](_0x3241a0);}return _0x27844b[_0x804b('0x24')]();};}function saveUpdates(_0x2b7271,_0x1acc48){return function(_0x5a968b){if(_0x5a968b){return _0x5a968b[_0x804b('0x25')](_0x2b7271)[_0x804b('0x26')](function(_0x5585f8){return _0x5585f8;});}return null;};}function removeEntity(_0x44a921,_0x367024){return function(_0x115b8f){if(_0x115b8f){return _0x115b8f[_0x804b('0x27')]()[_0x804b('0x26')](function(){_0x44a921['status'](0xcc)[_0x804b('0x28')]();});}};}function handleEntityNotFound(_0x7d9c33,_0x4e7266){return function(_0x12b6a6){if(!_0x12b6a6){_0x7d9c33[_0x804b('0x19')](0x194);}return _0x12b6a6;};}function handleError(_0x1117a5,_0x27d5ec){_0x27d5ec=_0x27d5ec||0x1f4;return function(_0x2d88da){logger['error'](_0x2d88da[_0x804b('0x29')]);if(_0x2d88da[_0x804b('0x2a')]){delete _0x2d88da[_0x804b('0x2a')];}_0x1117a5[_0x804b('0x1a')](_0x27d5ec)[_0x804b('0x2b')](_0x2d88da);};}exports['index']=function(_0x3eb531,_0x2931ff){var _0x410871={},_0x5c7026={},_0x3dbd41={'count':0x0,'rows':[]};var _0x407357=_[_0x804b('0x2c')](db['ZendeskAccount'][_0x804b('0x2d')],function(_0x471c04){return{'name':_0x471c04['fieldName'],'type':_0x471c04[_0x804b('0x2e')][_0x804b('0x2f')]};});_0x5c7026[_0x804b('0x30')]=_[_0x804b('0x2c')](_0x407357,_0x804b('0x2a'));_0x5c7026[_0x804b('0x31')]=_['keys'](_0x3eb531[_0x804b('0x31')]);_0x5c7026[_0x804b('0x32')]=_[_0x804b('0x33')](_0x5c7026[_0x804b('0x30')],_0x5c7026[_0x804b('0x31')]);_0x410871[_0x804b('0x34')]=_[_0x804b('0x33')](_0x5c7026[_0x804b('0x30')],qs[_0x804b('0x35')](_0x3eb531[_0x804b('0x31')][_0x804b('0x35')]));_0x410871[_0x804b('0x34')]=_0x410871[_0x804b('0x34')][_0x804b('0x36')]?_0x410871[_0x804b('0x34')]:_0x5c7026[_0x804b('0x30')];if(!_0x3eb531[_0x804b('0x31')][_0x804b('0x37')](_0x804b('0x38'))){_0x410871[_0x804b('0x1c')]=qs[_0x804b('0x1c')](_0x3eb531[_0x804b('0x31')][_0x804b('0x1c')]);_0x410871[_0x804b('0x1e')]=qs[_0x804b('0x1e')](_0x3eb531['query']['offset']);}_0x410871['order']=qs[_0x804b('0x39')](_0x3eb531[_0x804b('0x31')][_0x804b('0x39')]);_0x410871['where']=qs['filters'](_['pick'](_0x3eb531[_0x804b('0x31')],_0x5c7026[_0x804b('0x32')]),_0x407357);if(_0x3eb531[_0x804b('0x31')][_0x804b('0x3a')]){_0x410871[_0x804b('0x3b')]=_[_0x804b('0x3c')](_0x410871[_0x804b('0x3b')],{'$or':_[_0x804b('0x2c')](_0x407357,function(_0x27ba88){if(_0x27ba88[_0x804b('0x2e')]!==_0x804b('0x3d')){var _0x22a3fa={};_0x22a3fa[_0x27ba88[_0x804b('0x2a')]]={'$like':'%'+_0x3eb531['query'][_0x804b('0x3a')]+'%'};return _0x22a3fa;}})});}_0x410871=_[_0x804b('0x3c')]({},_0x410871,_0x3eb531[_0x804b('0x3e')]);var _0x3d6d8a={'where':_0x410871[_0x804b('0x3b')]};return db['ZendeskAccount']['count'](_0x3d6d8a)[_0x804b('0x26')](function(_0x2afafd){_0x3dbd41[_0x804b('0x1d')]=_0x2afafd;if(_0x3eb531['query'][_0x804b('0x3f')]){_0x410871['include']=[{'all':!![]}];}return db[_0x804b('0x40')][_0x804b('0x41')](_0x410871);})[_0x804b('0x26')](function(_0x304710){_0x3dbd41[_0x804b('0x42')]=_0x304710;return _0x3dbd41;})[_0x804b('0x26')](respondWithFilteredResult(_0x2931ff,_0x410871))[_0x804b('0x43')](handleError(_0x2931ff,null));};exports['show']=function(_0x17972a,_0x1c0363){var _0x1dcec8={'raw':![],'where':{'id':_0x17972a['params']['id']}},_0x1d25f6={};_0x1d25f6[_0x804b('0x30')]=_[_0x804b('0x44')](db[_0x804b('0x40')][_0x804b('0x2d')]);_0x1d25f6[_0x804b('0x31')]=_[_0x804b('0x44')](_0x17972a[_0x804b('0x31')]);_0x1d25f6[_0x804b('0x32')]=_['intersection'](_0x1d25f6[_0x804b('0x30')],_0x1d25f6['query']);_0x1dcec8['attributes']=_['intersection'](_0x1d25f6[_0x804b('0x30')],qs['fields'](_0x17972a[_0x804b('0x31')][_0x804b('0x35')]));_0x1dcec8[_0x804b('0x34')]=_0x1dcec8[_0x804b('0x34')]['length']?_0x1dcec8[_0x804b('0x34')]:_0x1d25f6[_0x804b('0x30')];if(_0x17972a[_0x804b('0x31')]['includeAll']){_0x1dcec8[_0x804b('0x45')]=[{'all':!![]}];}_0x1dcec8=_[_0x804b('0x3c')]({},_0x1dcec8,_0x17972a[_0x804b('0x3e')]);return db['ZendeskAccount'][_0x804b('0x46')](_0x1dcec8)[_0x804b('0x26')](handleEntityNotFound(_0x1c0363,null))[_0x804b('0x26')](respondWithResult(_0x1c0363,null))[_0x804b('0x43')](handleError(_0x1c0363,null));};exports[_0x804b('0x47')]=function(_0x3a39f5,_0x392bc0){return db[_0x804b('0x40')][_0x804b('0x47')](_0x3a39f5[_0x804b('0x48')],{})[_0x804b('0x26')](respondWithResult(_0x392bc0,0xc9))[_0x804b('0x43')](handleError(_0x392bc0,null));};exports[_0x804b('0x25')]=function(_0x2c1796,_0x578e92){if(_0x2c1796['body']['id']){delete _0x2c1796[_0x804b('0x48')]['id'];}return db[_0x804b('0x40')][_0x804b('0x46')]({'where':{'id':_0x2c1796[_0x804b('0x49')]['id']}})[_0x804b('0x26')](handleEntityNotFound(_0x578e92,null))['then'](saveUpdates(_0x2c1796[_0x804b('0x48')],null))[_0x804b('0x26')](respondWithResult(_0x578e92,null))[_0x804b('0x43')](handleError(_0x578e92,null));};exports[_0x804b('0x27')]=function(_0x47247c,_0x111e3f){return db['ZendeskAccount']['find']({'where':{'id':_0x47247c[_0x804b('0x49')]['id']}})[_0x804b('0x26')](handleEntityNotFound(_0x111e3f,null))['then'](removeEntity(_0x111e3f,null))['catch'](handleError(_0x111e3f,null));};exports[_0x804b('0x4a')]=function(_0x3d56bb,_0x4a5068,_0x4efe2a){var _0x164c5d={};var _0x38c2c0={};var _0x54cc99;var _0x2756de;return db['ZendeskAccount'][_0x804b('0x4b')]({'where':{'id':_0x3d56bb['params']['id']}})[_0x804b('0x26')](handleEntityNotFound(_0x4a5068,null))[_0x804b('0x26')](function(_0x47c835){if(_0x47c835){_0x54cc99=_0x47c835;_0x38c2c0[_0x804b('0x30')]=_['keys'](db[_0x804b('0x4c')][_0x804b('0x2d')]);_0x38c2c0[_0x804b('0x31')]=_[_0x804b('0x44')](_0x3d56bb[_0x804b('0x31')]);_0x38c2c0[_0x804b('0x32')]=_[_0x804b('0x33')](_0x38c2c0[_0x804b('0x30')],_0x38c2c0[_0x804b('0x31')]);_0x164c5d[_0x804b('0x34')]=_['intersection'](_0x38c2c0['model'],qs[_0x804b('0x35')](_0x3d56bb['query']['fields']));_0x164c5d[_0x804b('0x34')]=_0x164c5d[_0x804b('0x34')][_0x804b('0x36')]?_0x164c5d[_0x804b('0x34')]:_0x38c2c0['model'];_0x164c5d['order']=qs[_0x804b('0x39')](_0x3d56bb[_0x804b('0x31')][_0x804b('0x39')]);_0x164c5d[_0x804b('0x3b')]=qs[_0x804b('0x32')](_[_0x804b('0x4d')](_0x3d56bb[_0x804b('0x31')],_0x38c2c0[_0x804b('0x32')]));if(_0x3d56bb[_0x804b('0x31')][_0x804b('0x3a')]){_0x164c5d[_0x804b('0x3b')]=_[_0x804b('0x3c')](_0x164c5d[_0x804b('0x3b')],{'$or':_[_0x804b('0x2c')](_0x164c5d[_0x804b('0x34')],function(_0x3d98a2){var _0x524291={};_0x524291[_0x3d98a2]={'$like':'%'+_0x3d56bb[_0x804b('0x31')][_0x804b('0x3a')]+'%'};return _0x524291;})});}_0x164c5d=_['merge']({},_0x164c5d,_0x3d56bb[_0x804b('0x3e')]);return _0x54cc99[_0x804b('0x4a')](_0x164c5d);}})[_0x804b('0x26')](function(_0x2576a4){if(_0x2576a4){_0x2756de=_0x2576a4['length'];if(!_0x3d56bb[_0x804b('0x31')][_0x804b('0x37')]('nolimit')){_0x164c5d[_0x804b('0x1c')]=qs[_0x804b('0x1c')](_0x3d56bb[_0x804b('0x31')]['limit']);_0x164c5d[_0x804b('0x1e')]=qs[_0x804b('0x1e')](_0x3d56bb[_0x804b('0x31')][_0x804b('0x1e')]);}return _0x54cc99[_0x804b('0x4a')](_0x164c5d);}})['then'](function(_0xb08c4e){if(_0xb08c4e){return _0xb08c4e?{'count':_0x2756de,'rows':_0xb08c4e}:null;}})[_0x804b('0x26')](respondWithResult(_0x4a5068,null))[_0x804b('0x43')](handleError(_0x4a5068,null));};exports[_0x804b('0x4e')]=function(_0x5dcc63,_0x4f8a81,_0x183796){if(_0x5dcc63['body']['id']){delete _0x5dcc63[_0x804b('0x48')]['id'];}return db[_0x804b('0x40')][_0x804b('0x4b')]({'where':{'id':_0x5dcc63[_0x804b('0x49')]['id']}})[_0x804b('0x26')](handleEntityNotFound(_0x4f8a81,null))['then'](function(_0x27f06c){if(_0x27f06c){_0x5dcc63[_0x804b('0x48')][_0x804b('0x4f')]=_0x27f06c['id'];_0x5dcc63['body'][_0x804b('0x50')]=integrations[_0x804b('0x51')](_0x5dcc63['body'][_0x804b('0x52')],_0x5dcc63['body'][_0x804b('0x2e')]);_0x5dcc63[_0x804b('0x48')]['Descriptions']=integrations[_0x804b('0x53')](_0x5dcc63[_0x804b('0x48')][_0x804b('0x52')],_0x5dcc63['body'][_0x804b('0x2e')]);return db['ZendeskConfiguration'][_0x804b('0x47')](_0x5dcc63[_0x804b('0x48')],{'include':[{'model':db[_0x804b('0x54')],'as':_0x804b('0x50')},{'model':db['ZendeskField'],'as':_0x804b('0x55')}]});}return null;})[_0x804b('0x26')](respondWithResult(_0x4f8a81,null))[_0x804b('0x43')](handleError(_0x4f8a81,null));};exports[_0x804b('0x56')]=function(_0x17e21c,_0x1bb4ec,_0x5b3b79){var _0x39ed3c='';return db[_0x804b('0x40')]['findOne']({'where':{'id':_0x17e21c[_0x804b('0x49')]['id']},'attributes':['id',_0x804b('0x57'),_0x804b('0x58'),_0x804b('0x59'),'authType',_0x804b('0x5a')]})[_0x804b('0x26')](handleEntityNotFound(_0x1bb4ec,null))['then'](function(_0x2541cd){if(_0x2541cd){_0x39ed3c=_0x2541cd[_0x804b('0x5a')];var _0x549504=_0x39ed3c[_0x804b('0x5b')](-0x1);if(_0x549504==='/'){_0x39ed3c=_0x39ed3c['substring'](0x0,_0x39ed3c[_0x804b('0x5c')](_0x549504));}var _0x3e2813={'method':_0x804b('0x5d'),'uri':util[_0x804b('0x5e')](_0x804b('0x5f'),_0x39ed3c,_0x804b('0x60')),'json':!![]};switch(_0x2541cd[_0x804b('0x61')]){case'password':_0x3e2813[_0x804b('0x62')]={'Authorization':util['format'](_0x804b('0x63'),new Buffer(util[_0x804b('0x5e')](_0x804b('0x64'),_0x2541cd[_0x804b('0x57')],_0x2541cd[_0x804b('0x58')]))[_0x804b('0x65')](_0x804b('0x66')))};break;case _0x804b('0x59'):_0x3e2813[_0x804b('0x62')]={'Authorization':util[_0x804b('0x5e')](_0x804b('0x63'),new Buffer(util['format']('%s/token:%s',_0x2541cd[_0x804b('0x57')],_0x2541cd[_0x804b('0x59')]))[_0x804b('0x65')](_0x804b('0x66')))};break;default:throw new db['Sequelize'][(_0x804b('0x67'))](_0x804b('0x68'));}return rp(_0x3e2813);}})[_0x804b('0x26')](function(_0x3dda89){if(_0x3dda89){var _0x260419=[_0x804b('0x69'),_0x804b('0x6a'),_0x804b('0x6b'),_0x804b('0x6c')];_[_0x804b('0x6d')](_0x3dda89['ticket_fields'],function(_0x5a6661){return _0x260419[_0x804b('0x6e')](_0x5a6661[_0x804b('0x2e')]);});return{'count':_0x3dda89['ticket_fields'][_0x804b('0x36')],'rows':_[_0x804b('0x2c')](_0x3dda89['ticket_fields'],function(_0x345bf7){return{'id':_0x345bf7['id'],'name':_0x345bf7['position']>0x7?_0x345bf7['title']:_0x345bf7[_0x804b('0x2e')],'custom':_0x345bf7[_0x804b('0x6f')]>0x7?!![]:![],'options':_0x345bf7['system_field_options']?_0x345bf7['system_field_options']:_0x345bf7[_0x804b('0x70')]?_0x345bf7[_0x804b('0x70')]:[]};})};}})['then'](respondWithResult(_0x1bb4ec,null))[_0x804b('0x43')](function(_0x5e2756){var _0x42dfc3=_0x17e21c[_0x804b('0x31')][_0x804b('0x71')]?0x1f4:_0x5e2756['statusCode']||0x1f4;logger[_0x804b('0x72')](_0x804b('0x73'),_0x804b('0x56'),_0x42dfc3,JSON[_0x804b('0x74')](_0x5e2756));delete _0x5e2756[_0x804b('0x2a')];if(_0x42dfc3===0x191){_0x42dfc3=0x190;}_0x1bb4ec[_0x804b('0x1a')](_0x42dfc3)[_0x804b('0x2b')](_0x17e21c[_0x804b('0x31')][_0x804b('0x71')]?{'message':_0x804b('0x75'),'statusCode':_0x5e2756['statusCode']}:_0x5e2756);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 0072b01..7509dad 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 _0x0c24=['../../components/integrations/configuration','define','int_zendesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intZendeskAccount.attributes'];(function(_0x409dc0,_0x2508e3){var _0x37a328=function(_0x4ff28d){while(--_0x4ff28d){_0x409dc0['push'](_0x409dc0['shift']());}};_0x37a328(++_0x2508e3);}(_0x0c24,0x107));var _0x40c2=function(_0x42fc3e,_0xdc5885){_0x42fc3e=_0x42fc3e-0x0;var _0x52e1fa=_0x0c24[_0x42fc3e];return _0x52e1fa;};'use strict';var _=require(_0x40c2('0x0'));var util=require(_0x40c2('0x1'));var logger=require(_0x40c2('0x2'))(_0x40c2('0x3'));var moment=require(_0x40c2('0x4'));var BPromise=require(_0x40c2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x40c2('0x6'));var rimraf=require(_0x40c2('0x7'));var config=require(_0x40c2('0x8'));var attributes=require(_0x40c2('0x9'));var integrations=require(_0x40c2('0xa'));module['exports']=function(_0x1baa38,_0x104954){return _0x1baa38[_0x40c2('0xb')]('ZendeskAccount',attributes,{'tableName':_0x40c2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc51=['rimraf','../../config/environment','./intZendeskAccount.attributes','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x541b6b,_0xe0402b){var _0x2cde60=function(_0x372e29){while(--_0x372e29){_0x541b6b['push'](_0x541b6b['shift']());}};_0x2cde60(++_0xe0402b);}(_0xbc51,0x13b));var _0x1bc5=function(_0x10dfdf,_0x36b623){_0x10dfdf=_0x10dfdf-0x0;var _0x4d857d=_0xbc51[_0x10dfdf];return _0x4d857d;};'use strict';var _=require(_0x1bc5('0x0'));var util=require(_0x1bc5('0x1'));var logger=require(_0x1bc5('0x2'))(_0x1bc5('0x3'));var moment=require(_0x1bc5('0x4'));var BPromise=require('bluebird');var rp=require(_0x1bc5('0x5'));var fs=require('fs');var path=require(_0x1bc5('0x6'));var rimraf=require(_0x1bc5('0x7'));var config=require(_0x1bc5('0x8'));var attributes=require(_0x1bc5('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x1bc5('0xa')]=function(_0x434150,_0x510d47){return _0x434150[_0x1bc5('0xb')](_0x1bc5('0xc'),attributes,{'tableName':_0x1bc5('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 89f8238..dd4d047 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 _0xc009=['debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZendeskAccount','findAll','options','raw','where','limit','include','map','model','attributes','ZendeskAccount','find','then','ShowZendeskAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x6b5ad3,_0x2d0827){var _0x1acb13=function(_0x2e9632){while(--_0x2e9632){_0x6b5ad3['push'](_0x6b5ad3['shift']());}};_0x1acb13(++_0x2d0827);}(_0xc009,0x1de));var _0x9c00=function(_0x5c4971,_0x343065){_0x5c4971=_0x5c4971-0x0;var _0x3e1a86=_0xc009[_0x5c4971];return _0x3e1a86;};'use strict';var _=require(_0x9c00('0x0'));var util=require(_0x9c00('0x1'));var moment=require(_0x9c00('0x2'));var BPromise=require('bluebird');var rs=require(_0x9c00('0x3'));var fs=require('fs');var Redis=require(_0x9c00('0x4'));var db=require(_0x9c00('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9c00('0x6'))(_0x9c00('0x7'));var config=require(_0x9c00('0x8'));var jayson=require(_0x9c00('0x9'));var client=jayson[_0x9c00('0xa')][_0x9c00('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x290084,_0x5f4406,_0x13b7a1){return new BPromise(function(_0x3fc589,_0x576f1b){return client[_0x9c00('0xc')](_0x290084,_0x13b7a1)['then'](function(_0x511c71){logger[_0x9c00('0xd')](_0x9c00('0xe'),_0x5f4406,_0x9c00('0xf'));logger[_0x9c00('0x10')](_0x9c00('0x11'),_0x5f4406,_0x9c00('0xf'),JSON[_0x9c00('0x12')](_0x511c71));if(_0x511c71[_0x9c00('0x13')]){if(_0x511c71[_0x9c00('0x13')][_0x9c00('0x14')]===0x1f4){logger[_0x9c00('0x13')](_0x9c00('0xe'),_0x5f4406,_0x511c71[_0x9c00('0x13')]['message']);return _0x576f1b(_0x511c71['error']['message']);}logger[_0x9c00('0x13')](_0x9c00('0xe'),_0x5f4406,_0x511c71[_0x9c00('0x13')][_0x9c00('0x15')]);return _0x3fc589(_0x511c71[_0x9c00('0x13')][_0x9c00('0x15')]);}else{logger[_0x9c00('0xd')](_0x9c00('0xe'),_0x5f4406,_0x9c00('0xf'));_0x3fc589(_0x511c71[_0x9c00('0x16')][_0x9c00('0x15')]);}})[_0x9c00('0x17')](function(_0x43bd26){logger[_0x9c00('0x13')](_0x9c00('0xe'),_0x5f4406,_0x43bd26);_0x576f1b(_0x43bd26);});});}exports[_0x9c00('0x18')]=function(_0x47c59d){var _0x2abf0e=this;return new Promise(function(_0xbb4db0,_0xad63e){return db['ZendeskAccount'][_0x9c00('0x19')]({'raw':_0x47c59d[_0x9c00('0x1a')]?_0x47c59d[_0x9c00('0x1a')][_0x9c00('0x1b')]===undefined?!![]:![]:!![],'where':_0x47c59d[_0x9c00('0x1a')]?_0x47c59d[_0x9c00('0x1a')][_0x9c00('0x1c')]||null:null,'attributes':_0x47c59d['options']?_0x47c59d[_0x9c00('0x1a')]['attributes']||null:null,'limit':_0x47c59d['options']?_0x47c59d[_0x9c00('0x1a')][_0x9c00('0x1d')]||null:null,'include':_0x47c59d[_0x9c00('0x1a')]?_0x47c59d['options'][_0x9c00('0x1e')]?_[_0x9c00('0x1f')](_0x47c59d[_0x9c00('0x1a')][_0x9c00('0x1e')],function(_0x45e03d){return{'model':db[_0x45e03d[_0x9c00('0x20')]],'as':_0x45e03d['as'],'attributes':_0x45e03d[_0x9c00('0x21')],'include':_0x45e03d[_0x9c00('0x1e')]?_[_0x9c00('0x1f')](_0x45e03d[_0x9c00('0x1e')],function(_0x495f92){return{'model':db[_0x495f92[_0x9c00('0x20')]],'as':_0x495f92['as'],'attributes':_0x495f92[_0x9c00('0x21')],'include':_0x495f92[_0x9c00('0x1e')]?_[_0x9c00('0x1f')](_0x495f92['include'],function(_0x56514d){return{'model':db[_0x56514d['model']],'as':_0x56514d['as'],'attributes':_0x56514d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x435a48){logger[_0x9c00('0xd')]('GetZendeskAccount',_0x47c59d);logger[_0x9c00('0x10')](_0x9c00('0x18'),_0x47c59d,JSON[_0x9c00('0x12')](_0x435a48));_0xbb4db0(_0x435a48);})[_0x9c00('0x17')](function(_0x197b28){logger[_0x9c00('0x13')](_0x9c00('0x18'),_0x197b28[_0x9c00('0x15')],_0x47c59d);_0xad63e(_0x2abf0e['error'](0x1f4,_0x197b28['message']));});});};exports['ShowZendeskAccount']=function(_0x94a275){var _0x242aa1=this;return new Promise(function(_0x55f2da,_0xdc087d){return db[_0x9c00('0x22')][_0x9c00('0x23')]({'raw':_0x94a275['options']?_0x94a275[_0x9c00('0x1a')][_0x9c00('0x1b')]===undefined?!![]:![]:!![],'where':_0x94a275[_0x9c00('0x1a')]?_0x94a275[_0x9c00('0x1a')][_0x9c00('0x1c')]||null:null,'attributes':_0x94a275[_0x9c00('0x1a')]?_0x94a275[_0x9c00('0x1a')][_0x9c00('0x21')]||null:null,'include':_0x94a275[_0x9c00('0x1a')]?_0x94a275[_0x9c00('0x1a')][_0x9c00('0x1e')]?_[_0x9c00('0x1f')](_0x94a275['options'][_0x9c00('0x1e')],function(_0x4d7098){return{'model':db[_0x4d7098['model']],'as':_0x4d7098['as'],'attributes':_0x4d7098[_0x9c00('0x21')],'include':_0x4d7098[_0x9c00('0x1e')]?_[_0x9c00('0x1f')](_0x4d7098[_0x9c00('0x1e')],function(_0x2fa0ae){return{'model':db[_0x2fa0ae['model']],'as':_0x2fa0ae['as'],'attributes':_0x2fa0ae[_0x9c00('0x21')],'include':_0x2fa0ae[_0x9c00('0x1e')]?_[_0x9c00('0x1f')](_0x2fa0ae[_0x9c00('0x1e')],function(_0x3e64da){return{'model':db[_0x3e64da[_0x9c00('0x20')]],'as':_0x3e64da['as'],'attributes':_0x3e64da['attributes']};}):[]};}):[]};}):[]:[]})[_0x9c00('0x24')](function(_0x259de9){logger['info'](_0x9c00('0x25'),_0x94a275);logger[_0x9c00('0x10')]('ShowZendeskAccount',_0x94a275,JSON[_0x9c00('0x12')](_0x259de9));_0x55f2da(_0x259de9);})[_0x9c00('0x17')](function(_0x9869a6){logger['error']('ShowZendeskAccount',_0x9869a6[_0x9c00('0x15')],_0x94a275);_0xdc087d(_0x242aa1['error'](0x1f4,_0x9869a6['message']));});});}; \ No newline at end of file +var _0xf794=['../../config/environment','jayson/promise','client','request','info','ZendeskAccount,\x20%s,\x20%s','error','code','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','include','model','map','then','ShowZendeskAccount','find','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x28e714,_0x1ca825){var _0x2c3bf2=function(_0x2e0af6){while(--_0x2e0af6){_0x28e714['push'](_0x28e714['shift']());}};_0x2c3bf2(++_0x1ca825);}(_0xf794,0x129));var _0x4f79=function(_0x3df46e,_0x329d78){_0x3df46e=_0x3df46e-0x0;var _0x45d47a=_0xf794[_0x3df46e];return _0x45d47a;};'use strict';var _=require(_0x4f79('0x0'));var util=require(_0x4f79('0x1'));var moment=require(_0x4f79('0x2'));var BPromise=require(_0x4f79('0x3'));var rs=require(_0x4f79('0x4'));var fs=require('fs');var Redis=require(_0x4f79('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f79('0x6'));var logger=require(_0x4f79('0x7'))(_0x4f79('0x8'));var config=require(_0x4f79('0x9'));var jayson=require(_0x4f79('0xa'));var client=jayson[_0x4f79('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b0dce,_0x31873b,_0x2a0fa8){return new BPromise(function(_0xdebb54,_0x48b369){return client[_0x4f79('0xc')](_0x4b0dce,_0x2a0fa8)['then'](function(_0x912d17){logger[_0x4f79('0xd')](_0x4f79('0xe'),_0x31873b,'request\x20sent');logger['debug']('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x31873b,'request\x20sent',JSON['stringify'](_0x912d17));if(_0x912d17['error']){if(_0x912d17[_0x4f79('0xf')][_0x4f79('0x10')]===0x1f4){logger['error'](_0x4f79('0xe'),_0x31873b,_0x912d17[_0x4f79('0xf')]['message']);return _0x48b369(_0x912d17[_0x4f79('0xf')][_0x4f79('0x11')]);}logger[_0x4f79('0xf')](_0x4f79('0xe'),_0x31873b,_0x912d17[_0x4f79('0xf')][_0x4f79('0x11')]);return _0xdebb54(_0x912d17[_0x4f79('0xf')][_0x4f79('0x11')]);}else{logger['info'](_0x4f79('0xe'),_0x31873b,'request\x20sent');_0xdebb54(_0x912d17['result']['message']);}})[_0x4f79('0x12')](function(_0x5beae3){logger[_0x4f79('0xf')](_0x4f79('0xe'),_0x31873b,_0x5beae3);_0x48b369(_0x5beae3);});});}exports[_0x4f79('0x13')]=function(_0x29a84d){var _0x20666e=this;return new Promise(function(_0x2de3a2,_0x358a53){return db[_0x4f79('0x14')][_0x4f79('0x15')]({'raw':_0x29a84d['options']?_0x29a84d[_0x4f79('0x16')][_0x4f79('0x17')]===undefined?!![]:![]:!![],'where':_0x29a84d[_0x4f79('0x16')]?_0x29a84d[_0x4f79('0x16')][_0x4f79('0x18')]||null:null,'attributes':_0x29a84d[_0x4f79('0x16')]?_0x29a84d[_0x4f79('0x16')][_0x4f79('0x19')]||null:null,'limit':_0x29a84d['options']?_0x29a84d['options']['limit']||null:null,'include':_0x29a84d['options']?_0x29a84d[_0x4f79('0x16')][_0x4f79('0x1a')]?_['map'](_0x29a84d[_0x4f79('0x16')][_0x4f79('0x1a')],function(_0x12952e){return{'model':db[_0x12952e[_0x4f79('0x1b')]],'as':_0x12952e['as'],'attributes':_0x12952e[_0x4f79('0x19')],'include':_0x12952e['include']?_[_0x4f79('0x1c')](_0x12952e[_0x4f79('0x1a')],function(_0x5d6a3d){return{'model':db[_0x5d6a3d[_0x4f79('0x1b')]],'as':_0x5d6a3d['as'],'attributes':_0x5d6a3d[_0x4f79('0x19')],'include':_0x5d6a3d['include']?_[_0x4f79('0x1c')](_0x5d6a3d[_0x4f79('0x1a')],function(_0x21c1c3){return{'model':db[_0x21c1c3[_0x4f79('0x1b')]],'as':_0x21c1c3['as'],'attributes':_0x21c1c3[_0x4f79('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4f79('0x1d')](function(_0x29475e){logger['info'](_0x4f79('0x13'),_0x29a84d);logger['debug'](_0x4f79('0x13'),_0x29a84d,JSON['stringify'](_0x29475e));_0x2de3a2(_0x29475e);})[_0x4f79('0x12')](function(_0x134f57){logger[_0x4f79('0xf')](_0x4f79('0x13'),_0x134f57['message'],_0x29a84d);_0x358a53(_0x20666e[_0x4f79('0xf')](0x1f4,_0x134f57[_0x4f79('0x11')]));});});};exports[_0x4f79('0x1e')]=function(_0x5a6ecb){var _0x24e527=this;return new Promise(function(_0x2608bb,_0x406206){return db['ZendeskAccount'][_0x4f79('0x1f')]({'raw':_0x5a6ecb[_0x4f79('0x16')]?_0x5a6ecb[_0x4f79('0x16')][_0x4f79('0x17')]===undefined?!![]:![]:!![],'where':_0x5a6ecb[_0x4f79('0x16')]?_0x5a6ecb[_0x4f79('0x16')][_0x4f79('0x18')]||null:null,'attributes':_0x5a6ecb['options']?_0x5a6ecb[_0x4f79('0x16')][_0x4f79('0x19')]||null:null,'include':_0x5a6ecb[_0x4f79('0x16')]?_0x5a6ecb[_0x4f79('0x16')][_0x4f79('0x1a')]?_[_0x4f79('0x1c')](_0x5a6ecb[_0x4f79('0x16')]['include'],function(_0x2fcfd0){return{'model':db[_0x2fcfd0[_0x4f79('0x1b')]],'as':_0x2fcfd0['as'],'attributes':_0x2fcfd0['attributes'],'include':_0x2fcfd0['include']?_[_0x4f79('0x1c')](_0x2fcfd0[_0x4f79('0x1a')],function(_0xdf59b0){return{'model':db[_0xdf59b0[_0x4f79('0x1b')]],'as':_0xdf59b0['as'],'attributes':_0xdf59b0[_0x4f79('0x19')],'include':_0xdf59b0[_0x4f79('0x1a')]?_[_0x4f79('0x1c')](_0xdf59b0[_0x4f79('0x1a')],function(_0xc1d986){return{'model':db[_0xc1d986[_0x4f79('0x1b')]],'as':_0xc1d986['as'],'attributes':_0xc1d986[_0x4f79('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4f79('0x1d')](function(_0x1a51ac){logger[_0x4f79('0xd')](_0x4f79('0x1e'),_0x5a6ecb);logger[_0x4f79('0x20')]('ShowZendeskAccount',_0x5a6ecb,JSON[_0x4f79('0x21')](_0x1a51ac));_0x2608bb(_0x1a51ac);})[_0x4f79('0x12')](function(_0x55814d){logger[_0x4f79('0xf')](_0x4f79('0x1e'),_0x55814d[_0x4f79('0x11')],_0x5a6ecb);_0x406206(_0x24e527[_0x4f79('0xf')](0x1f4,_0x55814d[_0x4f79('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 0f42bf2..aa82f48 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 _0x36ee=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','update','delete','destroy','exports','path','express'];(function(_0x4e93a9,_0x413f30){var _0x43013c=function(_0x3a0cf3){while(--_0x3a0cf3){_0x4e93a9['push'](_0x4e93a9['shift']());}};_0x43013c(++_0x413f30);}(_0x36ee,0xe8));var _0xe36e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x36ee[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe36e('0x0'));var timeout=require('connect-timeout');var express=require(_0xe36e('0x1'));var router=express[_0xe36e('0x2')]();var fs_extra=require(_0xe36e('0x3'));var auth=require(_0xe36e('0x4'));var interaction=require(_0xe36e('0x5'));var config=require(_0xe36e('0x6'));var controller=require(_0xe36e('0x7'));router[_0xe36e('0x8')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0xa')]);router[_0xe36e('0x8')](_0xe36e('0xb'),auth['isAuthenticated'](),controller[_0xe36e('0xc')]);router['get'](_0xe36e('0xd'),auth[_0xe36e('0x9')](),controller[_0xe36e('0xe')]);router['get'](_0xe36e('0xf'),auth['isAuthenticated'](),controller[_0xe36e('0x10')]);router[_0xe36e('0x8')](_0xe36e('0x11'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x12')]);router[_0xe36e('0x8')](_0xe36e('0x13'),auth[_0xe36e('0x9')](),controller['getTags']);router[_0xe36e('0x14')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0x15')]);router[_0xe36e('0x14')]('/:id/tags',auth[_0xe36e('0x9')](),controller['setTags']);router['put'](_0xe36e('0xb'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x16')]);router[_0xe36e('0x17')](_0xe36e('0xb'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x18')]);module[_0xe36e('0x19')]=router; \ No newline at end of file +var _0x087b=['getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields'];(function(_0xee9f81,_0x4b61f7){var _0x2c83f6=function(_0x5c6b56){while(--_0x5c6b56){_0xee9f81['push'](_0xee9f81['shift']());}};_0x2c83f6(++_0x4b61f7);}(_0x087b,0x11a));var _0xb087=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x087b[_0x4a53d];return _0x27410e;};'use strict';var multer=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb087('0x2'));var router=express['Router']();var fs_extra=require(_0xb087('0x3'));var auth=require(_0xb087('0x4'));var interaction=require(_0xb087('0x5'));var config=require(_0xb087('0x6'));var controller=require(_0xb087('0x7'));router[_0xb087('0x8')]('/',auth[_0xb087('0x9')](),controller[_0xb087('0xa')]);router[_0xb087('0x8')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0xc')]);router[_0xb087('0x8')](_0xb087('0xd'),auth[_0xb087('0x9')](),controller[_0xb087('0xe')]);router[_0xb087('0x8')]('/:id/subjects',auth[_0xb087('0x9')](),controller[_0xb087('0xf')]);router[_0xb087('0x8')](_0xb087('0x10'),auth[_0xb087('0x9')](),controller[_0xb087('0x11')]);router[_0xb087('0x8')]('/:id/tags',auth[_0xb087('0x9')](),controller[_0xb087('0x12')]);router[_0xb087('0x13')]('/',auth['isAuthenticated'](),controller[_0xb087('0x14')]);router[_0xb087('0x13')](_0xb087('0x15'),auth[_0xb087('0x9')](),controller[_0xb087('0x16')]);router[_0xb087('0x17')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0x18')]);router[_0xb087('0x19')]('/:id',auth[_0xb087('0x9')](),controller[_0xb087('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index a800f33..c6b366b 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 _0x8275=['sequelize','exports','STRING'];(function(_0x3216e9,_0x2c43d0){var _0x383e82=function(_0x510399){while(--_0x510399){_0x3216e9['push'](_0x3216e9['shift']());}};_0x383e82(++_0x2c43d0);}(_0x8275,0x93));var _0x5827=function(_0x56b254,_0x3306a8){_0x56b254=_0x56b254-0x0;var _0x364904=_0x8275[_0x56b254];return _0x364904;};'use strict';var Sequelize=require(_0x5827('0x0'));module[_0x5827('0x1')]={'name':{'type':Sequelize[_0x5827('0x2')]},'description':{'type':Sequelize[_0x5827('0x2')]}}; \ No newline at end of file +var _0x0f94=['exports','STRING','sequelize'];(function(_0x2341c6,_0x3af092){var _0x54c34d=function(_0x3091f9){while(--_0x3091f9){_0x2341c6['push'](_0x2341c6['shift']());}};_0x54c34d(++_0x3af092);}(_0x0f94,0x1cd));var _0x40f9=function(_0x35922a,_0x3fa047){_0x35922a=_0x35922a-0x0;var _0x55aa1a=_0x0f94[_0x35922a];return _0x55aa1a;};'use strict';var Sequelize=require(_0x40f9('0x0'));module[_0x40f9('0x1')]={'name':{'type':Sequelize[_0x40f9('0x2')]},'description':{'type':Sequelize[_0x40f9('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 19b7401..e47d358 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 _0x912b=['create','body','getFields','ZendeskField','length','hasOwnProperty','nolimit','findOne','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','crypto','desk.js','to-csv','papaparse','ioredis','../../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','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ZendeskConfiguration','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','order','sort','filters','pick','filter','where','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','find'];(function(_0x817d9b,_0x3c37e3){var _0x2752e1=function(_0x2b434e){while(--_0x2b434e){_0x817d9b['push'](_0x817d9b['shift']());}};_0x2752e1(++_0x3c37e3);}(_0x912b,0xb5));var _0xb912=function(_0x37b1d8,_0x614312){_0x37b1d8=_0x37b1d8-0x0;var _0x3739e7=_0x912b[_0x37b1d8];return _0x3739e7;};'use strict';var emlformat=require(_0xb912('0x0'));var rimraf=require(_0xb912('0x1'));var zipdir=require(_0xb912('0x2'));var jsonpatch=require(_0xb912('0x3'));var rp=require('request-promise');var moment=require(_0xb912('0x4'));var BPromise=require(_0xb912('0x5'));var Mustache=require('mustache');var util=require(_0xb912('0x6'));var path=require(_0xb912('0x7'));var sox=require(_0xb912('0x8'));var csv=require('to-csv');var ejs=require(_0xb912('0x9'));var fs=require('fs');var fs_extra=require(_0xb912('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb912('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb912('0xc'));var toCsv=require(_0xb912('0xd'));var querystring=require('querystring');var Papa=require(_0xb912('0xe'));var Redis=require(_0xb912('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb912('0x10'));var as=require(_0xb912('0x11'));var hardwareService=require(_0xb912('0x12'));var logger=require(_0xb912('0x13'))(_0xb912('0x14'));var utils=require('../../config/utils');var config=require(_0xb912('0x15'));var licenseUtil=require(_0xb912('0x16'));var db=require(_0xb912('0x17'))['db'];function respondWithStatusCode(_0x5688d1,_0x4ab7f9){_0x4ab7f9=_0x4ab7f9||0xcc;return function(_0x399770){if(_0x399770){return _0x5688d1[_0xb912('0x18')](_0x4ab7f9);}return _0x5688d1[_0xb912('0x19')](_0x4ab7f9)[_0xb912('0x1a')]();};}function respondWithResult(_0x1aa009,_0x3ec723){_0x3ec723=_0x3ec723||0xc8;return function(_0x3f8ae5){if(_0x3f8ae5){return _0x1aa009['status'](_0x3ec723)[_0xb912('0x1b')](_0x3f8ae5);}};}function respondWithFilteredResult(_0x2a09e1,_0x4cbad7){return function(_0x1a315d){if(_0x1a315d){var _0x4328b3=typeof _0x4cbad7[_0xb912('0x1c')]==='undefined'&&typeof _0x4cbad7[_0xb912('0x1d')]===_0xb912('0x1e');var _0x59193a=_0x1a315d[_0xb912('0x1f')];var _0x3a47f0=_0x4328b3?0x0:_0x4cbad7[_0xb912('0x1c')];var _0x15fac5=_0x4328b3?_0x1a315d[_0xb912('0x1f')]:_0x4cbad7[_0xb912('0x1c')]+_0x4cbad7[_0xb912('0x1d')];var _0x47b5b2;if(_0x15fac5>=_0x59193a){_0x15fac5=_0x59193a;_0x47b5b2=0xc8;}else{_0x47b5b2=0xce;}_0x2a09e1[_0xb912('0x19')](_0x47b5b2);return _0x2a09e1[_0xb912('0x20')](_0xb912('0x21'),_0x3a47f0+'-'+_0x15fac5+'/'+_0x59193a)[_0xb912('0x1b')](_0x1a315d);}return null;};}function patchUpdates(_0x37c942){return function(_0x81b020){try{jsonpatch['apply'](_0x81b020,_0x37c942,!![]);}catch(_0xe575f7){return BPromise[_0xb912('0x22')](_0xe575f7);}return _0x81b020[_0xb912('0x23')]();};}function saveUpdates(_0x3c065b,_0x105707){return function(_0x3a3498){if(_0x3a3498){return _0x3a3498[_0xb912('0x24')](_0x3c065b)[_0xb912('0x25')](function(_0x57a061){return _0x57a061;});}return null;};}function removeEntity(_0xab1166,_0xc0b271){return function(_0x49bef9){if(_0x49bef9){return _0x49bef9[_0xb912('0x26')]()['then'](function(){_0xab1166[_0xb912('0x19')](0xcc)[_0xb912('0x1a')]();});}};}function handleEntityNotFound(_0x2078bf,_0x16d205){return function(_0x3d97be){if(!_0x3d97be){_0x2078bf[_0xb912('0x18')](0x194);}return _0x3d97be;};}function handleError(_0x1c15c0,_0x1f5bba){_0x1f5bba=_0x1f5bba||0x1f4;return function(_0x1f4e17){logger[_0xb912('0x27')](_0x1f4e17[_0xb912('0x28')]);if(_0x1f4e17[_0xb912('0x29')]){delete _0x1f4e17['name'];}_0x1c15c0[_0xb912('0x19')](_0x1f5bba)[_0xb912('0x2a')](_0x1f4e17);};}exports[_0xb912('0x2b')]=function(_0x4b1e68,_0x2eb859){var _0xe26031={},_0x460d76={},_0x1b92dd={'count':0x0,'rows':[]};var _0x187b72=_['map'](db[_0xb912('0x2c')]['rawAttributes'],function(_0x55b58c){return{'name':_0x55b58c[_0xb912('0x2d')],'type':_0x55b58c[_0xb912('0x2e')][_0xb912('0x2f')]};});_0x460d76[_0xb912('0x30')]=_[_0xb912('0x31')](_0x187b72,_0xb912('0x29'));_0x460d76[_0xb912('0x32')]=_[_0xb912('0x33')](_0x4b1e68['query']);_0x460d76['filters']=_[_0xb912('0x34')](_0x460d76[_0xb912('0x30')],_0x460d76['query']);_0xe26031['attributes']=_[_0xb912('0x34')](_0x460d76[_0xb912('0x30')],qs[_0xb912('0x35')](_0x4b1e68[_0xb912('0x32')][_0xb912('0x35')]));_0xe26031['attributes']=_0xe26031[_0xb912('0x36')]['length']?_0xe26031[_0xb912('0x36')]:_0x460d76['model'];if(!_0x4b1e68[_0xb912('0x32')]['hasOwnProperty']('nolimit')){_0xe26031[_0xb912('0x1d')]=qs[_0xb912('0x1d')](_0x4b1e68[_0xb912('0x32')]['limit']);_0xe26031['offset']=qs[_0xb912('0x1c')](_0x4b1e68[_0xb912('0x32')][_0xb912('0x1c')]);}_0xe26031[_0xb912('0x37')]=qs[_0xb912('0x38')](_0x4b1e68[_0xb912('0x32')][_0xb912('0x38')]);_0xe26031['where']=qs[_0xb912('0x39')](_[_0xb912('0x3a')](_0x4b1e68[_0xb912('0x32')],_0x460d76[_0xb912('0x39')]),_0x187b72);if(_0x4b1e68[_0xb912('0x32')][_0xb912('0x3b')]){_0xe26031[_0xb912('0x3c')]=_[_0xb912('0x3d')](_0xe26031['where'],{'$or':_['map'](_0x187b72,function(_0x2d9d4e){if(_0x2d9d4e[_0xb912('0x2e')]!=='VIRTUAL'){var _0x561f2b={};_0x561f2b[_0x2d9d4e[_0xb912('0x29')]]={'$like':'%'+_0x4b1e68[_0xb912('0x32')][_0xb912('0x3b')]+'%'};return _0x561f2b;}})});}_0xe26031=_['merge']({},_0xe26031,_0x4b1e68[_0xb912('0x3e')]);var _0x3e2f37={'where':_0xe26031[_0xb912('0x3c')]};return db[_0xb912('0x2c')][_0xb912('0x1f')](_0x3e2f37)[_0xb912('0x25')](function(_0x1fd9fe){_0x1b92dd[_0xb912('0x1f')]=_0x1fd9fe;if(_0x4b1e68['query'][_0xb912('0x3f')]){_0xe26031[_0xb912('0x40')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xb912('0x41')](_0xe26031);})[_0xb912('0x25')](function(_0x4ad20f){_0x1b92dd['rows']=_0x4ad20f;return _0x1b92dd;})[_0xb912('0x25')](respondWithFilteredResult(_0x2eb859,_0xe26031))[_0xb912('0x42')](handleError(_0x2eb859,null));};exports[_0xb912('0x43')]=function(_0x1442b8,_0x14dc77){var _0xb242c9={'raw':![],'where':{'id':_0x1442b8[_0xb912('0x44')]['id']}},_0x398ebf={};_0x398ebf[_0xb912('0x30')]=_['keys'](db['ZendeskConfiguration'][_0xb912('0x45')]);_0x398ebf[_0xb912('0x32')]=_[_0xb912('0x33')](_0x1442b8[_0xb912('0x32')]);_0x398ebf['filters']=_[_0xb912('0x34')](_0x398ebf[_0xb912('0x30')],_0x398ebf[_0xb912('0x32')]);_0xb242c9[_0xb912('0x36')]=_[_0xb912('0x34')](_0x398ebf[_0xb912('0x30')],qs[_0xb912('0x35')](_0x1442b8[_0xb912('0x32')][_0xb912('0x35')]));_0xb242c9[_0xb912('0x36')]=_0xb242c9['attributes']['length']?_0xb242c9[_0xb912('0x36')]:_0x398ebf[_0xb912('0x30')];if(_0x1442b8[_0xb912('0x32')][_0xb912('0x3f')]){_0xb242c9[_0xb912('0x40')]=[{'all':!![]}];}_0xb242c9=_[_0xb912('0x3d')]({},_0xb242c9,_0x1442b8[_0xb912('0x3e')]);return db[_0xb912('0x2c')][_0xb912('0x46')](_0xb242c9)[_0xb912('0x25')](handleEntityNotFound(_0x14dc77,null))[_0xb912('0x25')](respondWithResult(_0x14dc77,null))[_0xb912('0x42')](handleError(_0x14dc77,null));};exports[_0xb912('0x47')]=function(_0xd85444,_0x3a70ab){return db[_0xb912('0x2c')][_0xb912('0x47')](_0xd85444[_0xb912('0x48')],{})[_0xb912('0x25')](respondWithResult(_0x3a70ab,0xc9))['catch'](handleError(_0x3a70ab,null));};exports[_0xb912('0x24')]=function(_0x33e6d3,_0x45f5e0){if(_0x33e6d3[_0xb912('0x48')]['id']){delete _0x33e6d3[_0xb912('0x48')]['id'];}return db[_0xb912('0x2c')]['find']({'where':{'id':_0x33e6d3[_0xb912('0x44')]['id']}})[_0xb912('0x25')](handleEntityNotFound(_0x45f5e0,null))['then'](saveUpdates(_0x33e6d3[_0xb912('0x48')],null))[_0xb912('0x25')](respondWithResult(_0x45f5e0,null))[_0xb912('0x42')](handleError(_0x45f5e0,null));};exports[_0xb912('0x26')]=function(_0x381ee2,_0x513e5d){return db[_0xb912('0x2c')][_0xb912('0x46')]({'where':{'id':_0x381ee2[_0xb912('0x44')]['id']}})['then'](handleEntityNotFound(_0x513e5d,null))[_0xb912('0x25')](removeEntity(_0x513e5d,null))['catch'](handleError(_0x513e5d,null));};exports[_0xb912('0x49')]=function(_0x46dcf7,_0x22af02,_0x4753d6){var _0x50489c={};var _0x19d7b3={};var _0x177043;var _0x10a46f;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x46dcf7['params']['id']}})['then'](handleEntityNotFound(_0x22af02,null))[_0xb912('0x25')](function(_0x439501){if(_0x439501){_0x177043=_0x439501;_0x19d7b3['model']=_[_0xb912('0x33')](db[_0xb912('0x4a')][_0xb912('0x45')]);_0x19d7b3['query']=_['keys'](_0x46dcf7[_0xb912('0x32')]);_0x19d7b3[_0xb912('0x39')]=_[_0xb912('0x34')](_0x19d7b3[_0xb912('0x30')],_0x19d7b3[_0xb912('0x32')]);_0x50489c[_0xb912('0x36')]=_['intersection'](_0x19d7b3[_0xb912('0x30')],qs['fields'](_0x46dcf7[_0xb912('0x32')][_0xb912('0x35')]));_0x50489c['attributes']=_0x50489c['attributes'][_0xb912('0x4b')]?_0x50489c[_0xb912('0x36')]:_0x19d7b3[_0xb912('0x30')];_0x50489c[_0xb912('0x37')]=qs[_0xb912('0x38')](_0x46dcf7['query'][_0xb912('0x38')]);_0x50489c[_0xb912('0x3c')]=qs[_0xb912('0x39')](_[_0xb912('0x3a')](_0x46dcf7['query'],_0x19d7b3[_0xb912('0x39')]));if(_0x46dcf7[_0xb912('0x32')]['filter']){_0x50489c[_0xb912('0x3c')]=_[_0xb912('0x3d')](_0x50489c['where'],{'$or':_[_0xb912('0x31')](_0x50489c[_0xb912('0x36')],function(_0x1949f5){var _0x432af0={};_0x432af0[_0x1949f5]={'$like':'%'+_0x46dcf7[_0xb912('0x32')][_0xb912('0x3b')]+'%'};return _0x432af0;})});}_0x50489c=_[_0xb912('0x3d')]({},_0x50489c,_0x46dcf7[_0xb912('0x3e')]);return _0x177043[_0xb912('0x49')](_0x50489c);}})[_0xb912('0x25')](function(_0x960fd6){if(_0x960fd6){_0x10a46f=_0x960fd6['length'];if(!_0x46dcf7[_0xb912('0x32')][_0xb912('0x4c')](_0xb912('0x4d'))){_0x50489c[_0xb912('0x1d')]=qs['limit'](_0x46dcf7['query'][_0xb912('0x1d')]);_0x50489c[_0xb912('0x1c')]=qs[_0xb912('0x1c')](_0x46dcf7[_0xb912('0x32')][_0xb912('0x1c')]);}return _0x177043['getFields'](_0x50489c);}})[_0xb912('0x25')](function(_0x154b08){if(_0x154b08){return _0x154b08?{'count':_0x10a46f,'rows':_0x154b08}:null;}})[_0xb912('0x25')](respondWithResult(_0x22af02,null))[_0xb912('0x42')](handleError(_0x22af02,null));};exports['getSubjects']=function(_0x35aecc,_0x31698b,_0x4d600c){var _0x19641b={};var _0x2a16c2={};var _0x2c3ee8;var _0x4781ba;return db['ZendeskConfiguration'][_0xb912('0x4e')]({'where':{'id':_0x35aecc[_0xb912('0x44')]['id']}})[_0xb912('0x25')](handleEntityNotFound(_0x31698b,null))['then'](function(_0x581d29){if(_0x581d29){_0x2c3ee8=_0x581d29;_0x2a16c2[_0xb912('0x30')]=_[_0xb912('0x33')](db[_0xb912('0x4a')]['rawAttributes']);_0x2a16c2[_0xb912('0x32')]=_[_0xb912('0x33')](_0x35aecc[_0xb912('0x32')]);_0x2a16c2[_0xb912('0x39')]=_['intersection'](_0x2a16c2[_0xb912('0x30')],_0x2a16c2[_0xb912('0x32')]);_0x19641b['attributes']=_[_0xb912('0x34')](_0x2a16c2['model'],qs[_0xb912('0x35')](_0x35aecc[_0xb912('0x32')][_0xb912('0x35')]));_0x19641b[_0xb912('0x36')]=_0x19641b[_0xb912('0x36')][_0xb912('0x4b')]?_0x19641b[_0xb912('0x36')]:_0x2a16c2[_0xb912('0x30')];_0x19641b[_0xb912('0x37')]=qs[_0xb912('0x38')](_0x35aecc[_0xb912('0x32')][_0xb912('0x38')]);_0x19641b[_0xb912('0x3c')]=qs[_0xb912('0x39')](_[_0xb912('0x3a')](_0x35aecc[_0xb912('0x32')],_0x2a16c2[_0xb912('0x39')]));if(_0x35aecc[_0xb912('0x32')][_0xb912('0x3b')]){_0x19641b[_0xb912('0x3c')]=_['merge'](_0x19641b['where'],{'$or':_[_0xb912('0x31')](_0x19641b['attributes'],function(_0x31ff71){var _0xbee0b5={};_0xbee0b5[_0x31ff71]={'$like':'%'+_0x35aecc[_0xb912('0x32')][_0xb912('0x3b')]+'%'};return _0xbee0b5;})});}_0x19641b=_['merge']({},_0x19641b,_0x35aecc[_0xb912('0x3e')]);return _0x2c3ee8[_0xb912('0x4f')](_0x19641b);}})[_0xb912('0x25')](function(_0x42f3cf){if(_0x42f3cf){_0x4781ba=_0x42f3cf['length'];if(!_0x35aecc[_0xb912('0x32')][_0xb912('0x4c')](_0xb912('0x4d'))){_0x19641b[_0xb912('0x1d')]=qs['limit'](_0x35aecc[_0xb912('0x32')][_0xb912('0x1d')]);_0x19641b[_0xb912('0x1c')]=qs[_0xb912('0x1c')](_0x35aecc[_0xb912('0x32')][_0xb912('0x1c')]);}return _0x2c3ee8[_0xb912('0x4f')](_0x19641b);}})[_0xb912('0x25')](function(_0x536247){if(_0x536247){return _0x536247?{'count':_0x4781ba,'rows':_0x536247}:null;}})[_0xb912('0x25')](respondWithResult(_0x31698b,null))[_0xb912('0x42')](handleError(_0x31698b,null));};exports[_0xb912('0x50')]=function(_0x16aaf6,_0x24f03c,_0x5b4575){var _0x50039f={};var _0xea7940={};var _0x2f266d;var _0x1c8da4;return db[_0xb912('0x2c')]['findOne']({'where':{'id':_0x16aaf6[_0xb912('0x44')]['id']}})[_0xb912('0x25')](handleEntityNotFound(_0x24f03c,null))[_0xb912('0x25')](function(_0x55d352){if(_0x55d352){_0x2f266d=_0x55d352;_0xea7940[_0xb912('0x30')]=_[_0xb912('0x33')](db['ZendeskField']['rawAttributes']);_0xea7940['query']=_[_0xb912('0x33')](_0x16aaf6[_0xb912('0x32')]);_0xea7940['filters']=_[_0xb912('0x34')](_0xea7940[_0xb912('0x30')],_0xea7940['query']);_0x50039f[_0xb912('0x36')]=_[_0xb912('0x34')](_0xea7940[_0xb912('0x30')],qs[_0xb912('0x35')](_0x16aaf6[_0xb912('0x32')]['fields']));_0x50039f[_0xb912('0x36')]=_0x50039f[_0xb912('0x36')][_0xb912('0x4b')]?_0x50039f[_0xb912('0x36')]:_0xea7940[_0xb912('0x30')];_0x50039f[_0xb912('0x37')]=qs['sort'](_0x16aaf6[_0xb912('0x32')]['sort']);_0x50039f[_0xb912('0x3c')]=qs['filters'](_[_0xb912('0x3a')](_0x16aaf6[_0xb912('0x32')],_0xea7940[_0xb912('0x39')]));if(_0x16aaf6[_0xb912('0x32')][_0xb912('0x3b')]){_0x50039f['where']=_[_0xb912('0x3d')](_0x50039f[_0xb912('0x3c')],{'$or':_[_0xb912('0x31')](_0x50039f[_0xb912('0x36')],function(_0x563274){var _0x307ef5={};_0x307ef5[_0x563274]={'$like':'%'+_0x16aaf6['query'][_0xb912('0x3b')]+'%'};return _0x307ef5;})});}_0x50039f=_[_0xb912('0x3d')]({},_0x50039f,_0x16aaf6['options']);return _0x2f266d[_0xb912('0x50')](_0x50039f);}})[_0xb912('0x25')](function(_0x1e04ff){if(_0x1e04ff){_0x1c8da4=_0x1e04ff[_0xb912('0x4b')];if(!_0x16aaf6[_0xb912('0x32')][_0xb912('0x4c')](_0xb912('0x4d'))){_0x50039f[_0xb912('0x1d')]=qs[_0xb912('0x1d')](_0x16aaf6[_0xb912('0x32')][_0xb912('0x1d')]);_0x50039f[_0xb912('0x1c')]=qs['offset'](_0x16aaf6[_0xb912('0x32')][_0xb912('0x1c')]);}return _0x2f266d[_0xb912('0x50')](_0x50039f);}})['then'](function(_0xd17c8f){if(_0xd17c8f){return _0xd17c8f?{'count':_0x1c8da4,'rows':_0xd17c8f}:null;}})[_0xb912('0x25')](respondWithResult(_0x24f03c,null))['catch'](handleError(_0x24f03c,null));};exports[_0xb912('0x51')]=function(_0x9af15a,_0x49b195,_0x4212cf){var _0x691a1c={};var _0x1607cc={};var _0x10c1a3;var _0x3ac8a3;return db[_0xb912('0x2c')][_0xb912('0x4e')]({'where':{'id':_0x9af15a[_0xb912('0x44')]['id']}})[_0xb912('0x25')](handleEntityNotFound(_0x49b195,null))[_0xb912('0x25')](function(_0x5739aa){if(_0x5739aa){_0x10c1a3=_0x5739aa;_0x1607cc['model']=_[_0xb912('0x33')](db[_0xb912('0x52')]['rawAttributes']);_0x1607cc['query']=_[_0xb912('0x33')](_0x9af15a['query']);_0x1607cc[_0xb912('0x39')]=_['intersection'](_0x1607cc['model'],_0x1607cc['query']);_0x691a1c['attributes']=_['intersection'](_0x1607cc['model'],qs[_0xb912('0x35')](_0x9af15a[_0xb912('0x32')]['fields']));_0x691a1c['attributes']=_0x691a1c['attributes'][_0xb912('0x4b')]?_0x691a1c[_0xb912('0x36')]:_0x1607cc[_0xb912('0x30')];_0x691a1c[_0xb912('0x37')]=qs['sort'](_0x9af15a['query'][_0xb912('0x38')]);_0x691a1c[_0xb912('0x3c')]=qs[_0xb912('0x39')](_[_0xb912('0x3a')](_0x9af15a[_0xb912('0x32')],_0x1607cc['filters']));if(_0x9af15a['query'][_0xb912('0x3b')]){_0x691a1c[_0xb912('0x3c')]=_['merge'](_0x691a1c[_0xb912('0x3c')],{'$or':_[_0xb912('0x31')](_0x691a1c[_0xb912('0x36')],function(_0x3a8f47){var _0x9fc0d6={};_0x9fc0d6[_0x3a8f47]={'$like':'%'+_0x9af15a[_0xb912('0x32')][_0xb912('0x3b')]+'%'};return _0x9fc0d6;})});}_0x691a1c=_['merge']({},_0x691a1c,_0x9af15a[_0xb912('0x3e')]);return _0x10c1a3[_0xb912('0x51')](_0x691a1c);}})[_0xb912('0x25')](function(_0x48b6f2){if(_0x48b6f2){_0x3ac8a3=_0x48b6f2[_0xb912('0x4b')];if(!_0x9af15a['query'][_0xb912('0x4c')](_0xb912('0x4d'))){_0x691a1c['limit']=qs[_0xb912('0x1d')](_0x9af15a[_0xb912('0x32')]['limit']);_0x691a1c['offset']=qs[_0xb912('0x1c')](_0x9af15a[_0xb912('0x32')][_0xb912('0x1c')]);}return _0x10c1a3[_0xb912('0x51')](_0x691a1c);}})[_0xb912('0x25')](function(_0x3e66fe){if(_0x3e66fe){return _0x3e66fe?{'count':_0x3ac8a3,'rows':_0x3e66fe}:null;}})[_0xb912('0x25')](respondWithResult(_0x49b195,null))[_0xb912('0x42')](handleError(_0x49b195,null));};exports[_0xb912('0x53')]=function(_0x49b22f,_0x193bc9,_0x1d2710){if(_0x49b22f[_0xb912('0x48')]['id']){delete _0x49b22f['body']['id'];}return db[_0xb912('0x2c')][_0xb912('0x4e')]({'where':{'id':_0x49b22f['params']['id']}})[_0xb912('0x25')](handleEntityNotFound(_0x193bc9,null))[_0xb912('0x25')](function(_0x47047e){if(_0x47047e){return _0x47047e[_0xb912('0x53')](_0x49b22f['body']['ids']||[]);}return null;})[_0xb912('0x25')](respondWithResult(_0x193bc9,null))[_0xb912('0x42')](handleError(_0x193bc9,null));}; \ No newline at end of file +var _0xff9a=['where','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','destroy','getFields','findOne','ZendeskField','getSubjects','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filters','filter'];(function(_0x49fac0,_0x1c6c82){var _0x59b597=function(_0x4ac46c){while(--_0x4ac46c){_0x49fac0['push'](_0x49fac0['shift']());}};_0x59b597(++_0x1c6c82);}(_0xff9a,0x6a));var _0xaff9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xff9a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xaff9('0x0'));var rimraf=require(_0xaff9('0x1'));var zipdir=require(_0xaff9('0x2'));var jsonpatch=require(_0xaff9('0x3'));var rp=require('request-promise');var moment=require(_0xaff9('0x4'));var BPromise=require(_0xaff9('0x5'));var Mustache=require(_0xaff9('0x6'));var util=require(_0xaff9('0x7'));var path=require(_0xaff9('0x8'));var sox=require(_0xaff9('0x9'));var csv=require(_0xaff9('0xa'));var ejs=require(_0xaff9('0xb'));var fs=require('fs');var fs_extra=require(_0xaff9('0xc'));var _=require(_0xaff9('0xd'));var squel=require(_0xaff9('0xe'));var crypto=require(_0xaff9('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xaff9('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xaff9('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaff9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaff9('0x12'))(_0xaff9('0x13'));var utils=require(_0xaff9('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xaff9('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5983a3,_0x1b11f6){_0x1b11f6=_0x1b11f6||0xcc;return function(_0x319215){if(_0x319215){return _0x5983a3[_0xaff9('0x16')](_0x1b11f6);}return _0x5983a3[_0xaff9('0x17')](_0x1b11f6)[_0xaff9('0x18')]();};}function respondWithResult(_0x2984c7,_0x31225f){_0x31225f=_0x31225f||0xc8;return function(_0x2a5e12){if(_0x2a5e12){return _0x2984c7[_0xaff9('0x17')](_0x31225f)[_0xaff9('0x19')](_0x2a5e12);}};}function respondWithFilteredResult(_0x444254,_0x469c72){return function(_0x72e925){if(_0x72e925){var _0xc8a7d0=typeof _0x469c72[_0xaff9('0x1a')]===_0xaff9('0x1b')&&typeof _0x469c72['limit']===_0xaff9('0x1b');var _0xb932cf=_0x72e925[_0xaff9('0x1c')];var _0x10e22e=_0xc8a7d0?0x0:_0x469c72[_0xaff9('0x1a')];var _0x447121=_0xc8a7d0?_0x72e925[_0xaff9('0x1c')]:_0x469c72[_0xaff9('0x1a')]+_0x469c72['limit'];var _0x32b0e1;if(_0x447121>=_0xb932cf){_0x447121=_0xb932cf;_0x32b0e1=0xc8;}else{_0x32b0e1=0xce;}_0x444254[_0xaff9('0x17')](_0x32b0e1);return _0x444254[_0xaff9('0x1d')](_0xaff9('0x1e'),_0x10e22e+'-'+_0x447121+'/'+_0xb932cf)['json'](_0x72e925);}return null;};}function patchUpdates(_0x57c357){return function(_0x1ea654){try{jsonpatch[_0xaff9('0x1f')](_0x1ea654,_0x57c357,!![]);}catch(_0x47a95d){return BPromise[_0xaff9('0x20')](_0x47a95d);}return _0x1ea654[_0xaff9('0x21')]();};}function saveUpdates(_0x10a651,_0x33b337){return function(_0x395abf){if(_0x395abf){return _0x395abf[_0xaff9('0x22')](_0x10a651)[_0xaff9('0x23')](function(_0x57f7e9){return _0x57f7e9;});}return null;};}function removeEntity(_0x2fa5,_0x38df32){return function(_0x1f9187){if(_0x1f9187){return _0x1f9187['destroy']()[_0xaff9('0x23')](function(){_0x2fa5[_0xaff9('0x17')](0xcc)[_0xaff9('0x18')]();});}};}function handleEntityNotFound(_0x5e3b94,_0x2e22ae){return function(_0x405e80){if(!_0x405e80){_0x5e3b94[_0xaff9('0x16')](0x194);}return _0x405e80;};}function handleError(_0x40a7f6,_0x34fc13){_0x34fc13=_0x34fc13||0x1f4;return function(_0x2dff13){logger[_0xaff9('0x24')](_0x2dff13[_0xaff9('0x25')]);if(_0x2dff13[_0xaff9('0x26')]){delete _0x2dff13[_0xaff9('0x26')];}_0x40a7f6[_0xaff9('0x17')](_0x34fc13)[_0xaff9('0x27')](_0x2dff13);};}exports[_0xaff9('0x28')]=function(_0x100465,_0x4457e1){var _0x11c3e9={},_0x5b81ea={},_0x5fe8b0={'count':0x0,'rows':[]};var _0x403f32=_[_0xaff9('0x29')](db[_0xaff9('0x2a')][_0xaff9('0x2b')],function(_0x1ae9fc){return{'name':_0x1ae9fc[_0xaff9('0x2c')],'type':_0x1ae9fc[_0xaff9('0x2d')][_0xaff9('0x2e')]};});_0x5b81ea[_0xaff9('0x2f')]=_[_0xaff9('0x29')](_0x403f32,_0xaff9('0x26'));_0x5b81ea['query']=_[_0xaff9('0x30')](_0x100465[_0xaff9('0x31')]);_0x5b81ea['filters']=_['intersection'](_0x5b81ea[_0xaff9('0x2f')],_0x5b81ea[_0xaff9('0x31')]);_0x11c3e9[_0xaff9('0x32')]=_[_0xaff9('0x33')](_0x5b81ea[_0xaff9('0x2f')],qs['fields'](_0x100465[_0xaff9('0x31')][_0xaff9('0x34')]));_0x11c3e9[_0xaff9('0x32')]=_0x11c3e9['attributes'][_0xaff9('0x35')]?_0x11c3e9[_0xaff9('0x32')]:_0x5b81ea['model'];if(!_0x100465[_0xaff9('0x31')][_0xaff9('0x36')](_0xaff9('0x37'))){_0x11c3e9[_0xaff9('0x38')]=qs['limit'](_0x100465['query']['limit']);_0x11c3e9[_0xaff9('0x1a')]=qs['offset'](_0x100465[_0xaff9('0x31')]['offset']);}_0x11c3e9[_0xaff9('0x39')]=qs[_0xaff9('0x3a')](_0x100465['query'][_0xaff9('0x3a')]);_0x11c3e9['where']=qs['filters'](_[_0xaff9('0x3b')](_0x100465[_0xaff9('0x31')],_0x5b81ea[_0xaff9('0x3c')]),_0x403f32);if(_0x100465['query'][_0xaff9('0x3d')]){_0x11c3e9[_0xaff9('0x3e')]=_['merge'](_0x11c3e9[_0xaff9('0x3e')],{'$or':_[_0xaff9('0x29')](_0x403f32,function(_0x230c58){if(_0x230c58[_0xaff9('0x2d')]!==_0xaff9('0x3f')){var _0x46bc15={};_0x46bc15[_0x230c58[_0xaff9('0x26')]]={'$like':'%'+_0x100465[_0xaff9('0x31')]['filter']+'%'};return _0x46bc15;}})});}_0x11c3e9=_[_0xaff9('0x40')]({},_0x11c3e9,_0x100465['options']);var _0x1ef38d={'where':_0x11c3e9[_0xaff9('0x3e')]};return db[_0xaff9('0x2a')][_0xaff9('0x1c')](_0x1ef38d)[_0xaff9('0x23')](function(_0xb9d58b){_0x5fe8b0[_0xaff9('0x1c')]=_0xb9d58b;if(_0x100465[_0xaff9('0x31')][_0xaff9('0x41')]){_0x11c3e9[_0xaff9('0x42')]=[{'all':!![]}];}return db[_0xaff9('0x2a')][_0xaff9('0x43')](_0x11c3e9);})[_0xaff9('0x23')](function(_0x2b00f4){_0x5fe8b0[_0xaff9('0x44')]=_0x2b00f4;return _0x5fe8b0;})[_0xaff9('0x23')](respondWithFilteredResult(_0x4457e1,_0x11c3e9))[_0xaff9('0x45')](handleError(_0x4457e1,null));};exports[_0xaff9('0x46')]=function(_0x56faed,_0x32b966){var _0x185e8d={'raw':![],'where':{'id':_0x56faed[_0xaff9('0x47')]['id']}},_0x35498e={};_0x35498e[_0xaff9('0x2f')]=_['keys'](db['ZendeskConfiguration'][_0xaff9('0x2b')]);_0x35498e['query']=_[_0xaff9('0x30')](_0x56faed[_0xaff9('0x31')]);_0x35498e[_0xaff9('0x3c')]=_['intersection'](_0x35498e[_0xaff9('0x2f')],_0x35498e['query']);_0x185e8d[_0xaff9('0x32')]=_[_0xaff9('0x33')](_0x35498e[_0xaff9('0x2f')],qs[_0xaff9('0x34')](_0x56faed[_0xaff9('0x31')]['fields']));_0x185e8d[_0xaff9('0x32')]=_0x185e8d[_0xaff9('0x32')][_0xaff9('0x35')]?_0x185e8d[_0xaff9('0x32')]:_0x35498e[_0xaff9('0x2f')];if(_0x56faed[_0xaff9('0x31')][_0xaff9('0x41')]){_0x185e8d[_0xaff9('0x42')]=[{'all':!![]}];}_0x185e8d=_['merge']({},_0x185e8d,_0x56faed[_0xaff9('0x48')]);return db[_0xaff9('0x2a')][_0xaff9('0x49')](_0x185e8d)[_0xaff9('0x23')](handleEntityNotFound(_0x32b966,null))['then'](respondWithResult(_0x32b966,null))[_0xaff9('0x45')](handleError(_0x32b966,null));};exports['create']=function(_0x1812c6,_0xf57278){return db['ZendeskConfiguration'][_0xaff9('0x4a')](_0x1812c6['body'],{})[_0xaff9('0x23')](respondWithResult(_0xf57278,0xc9))[_0xaff9('0x45')](handleError(_0xf57278,null));};exports[_0xaff9('0x22')]=function(_0x39c131,_0x5bcbe3){if(_0x39c131[_0xaff9('0x4b')]['id']){delete _0x39c131['body']['id'];}return db[_0xaff9('0x2a')]['find']({'where':{'id':_0x39c131[_0xaff9('0x47')]['id']}})[_0xaff9('0x23')](handleEntityNotFound(_0x5bcbe3,null))[_0xaff9('0x23')](saveUpdates(_0x39c131[_0xaff9('0x4b')],null))[_0xaff9('0x23')](respondWithResult(_0x5bcbe3,null))[_0xaff9('0x45')](handleError(_0x5bcbe3,null));};exports[_0xaff9('0x4c')]=function(_0x48e1bd,_0x5eb2b8){return db['ZendeskConfiguration'][_0xaff9('0x49')]({'where':{'id':_0x48e1bd[_0xaff9('0x47')]['id']}})[_0xaff9('0x23')](handleEntityNotFound(_0x5eb2b8,null))['then'](removeEntity(_0x5eb2b8,null))[_0xaff9('0x45')](handleError(_0x5eb2b8,null));};exports[_0xaff9('0x4d')]=function(_0x525281,_0x4e5afa,_0x38a96a){var _0x57c387={};var _0xf18bda={};var _0xf54f37;var _0x2ec789;return db[_0xaff9('0x2a')][_0xaff9('0x4e')]({'where':{'id':_0x525281[_0xaff9('0x47')]['id']}})[_0xaff9('0x23')](handleEntityNotFound(_0x4e5afa,null))[_0xaff9('0x23')](function(_0xcf8297){if(_0xcf8297){_0xf54f37=_0xcf8297;_0xf18bda[_0xaff9('0x2f')]=_[_0xaff9('0x30')](db[_0xaff9('0x4f')][_0xaff9('0x2b')]);_0xf18bda['query']=_[_0xaff9('0x30')](_0x525281[_0xaff9('0x31')]);_0xf18bda[_0xaff9('0x3c')]=_['intersection'](_0xf18bda[_0xaff9('0x2f')],_0xf18bda[_0xaff9('0x31')]);_0x57c387[_0xaff9('0x32')]=_['intersection'](_0xf18bda['model'],qs[_0xaff9('0x34')](_0x525281[_0xaff9('0x31')][_0xaff9('0x34')]));_0x57c387['attributes']=_0x57c387['attributes'][_0xaff9('0x35')]?_0x57c387[_0xaff9('0x32')]:_0xf18bda[_0xaff9('0x2f')];_0x57c387[_0xaff9('0x39')]=qs[_0xaff9('0x3a')](_0x525281[_0xaff9('0x31')][_0xaff9('0x3a')]);_0x57c387[_0xaff9('0x3e')]=qs[_0xaff9('0x3c')](_[_0xaff9('0x3b')](_0x525281[_0xaff9('0x31')],_0xf18bda[_0xaff9('0x3c')]));if(_0x525281[_0xaff9('0x31')][_0xaff9('0x3d')]){_0x57c387[_0xaff9('0x3e')]=_[_0xaff9('0x40')](_0x57c387[_0xaff9('0x3e')],{'$or':_[_0xaff9('0x29')](_0x57c387[_0xaff9('0x32')],function(_0x54c5fa){var _0x24b307={};_0x24b307[_0x54c5fa]={'$like':'%'+_0x525281[_0xaff9('0x31')][_0xaff9('0x3d')]+'%'};return _0x24b307;})});}_0x57c387=_[_0xaff9('0x40')]({},_0x57c387,_0x525281[_0xaff9('0x48')]);return _0xf54f37[_0xaff9('0x4d')](_0x57c387);}})[_0xaff9('0x23')](function(_0x202143){if(_0x202143){_0x2ec789=_0x202143['length'];if(!_0x525281[_0xaff9('0x31')][_0xaff9('0x36')]('nolimit')){_0x57c387[_0xaff9('0x38')]=qs['limit'](_0x525281[_0xaff9('0x31')][_0xaff9('0x38')]);_0x57c387[_0xaff9('0x1a')]=qs['offset'](_0x525281['query'][_0xaff9('0x1a')]);}return _0xf54f37[_0xaff9('0x4d')](_0x57c387);}})[_0xaff9('0x23')](function(_0x584087){if(_0x584087){return _0x584087?{'count':_0x2ec789,'rows':_0x584087}:null;}})[_0xaff9('0x23')](respondWithResult(_0x4e5afa,null))[_0xaff9('0x45')](handleError(_0x4e5afa,null));};exports[_0xaff9('0x50')]=function(_0xac3aca,_0x1788a6,_0x41b86f){var _0x29f472={};var _0x29c05f={};var _0x7dfb31;var _0x19d529;return db[_0xaff9('0x2a')][_0xaff9('0x4e')]({'where':{'id':_0xac3aca[_0xaff9('0x47')]['id']}})[_0xaff9('0x23')](handleEntityNotFound(_0x1788a6,null))[_0xaff9('0x23')](function(_0x5111ae){if(_0x5111ae){_0x7dfb31=_0x5111ae;_0x29c05f[_0xaff9('0x2f')]=_[_0xaff9('0x30')](db['ZendeskField'][_0xaff9('0x2b')]);_0x29c05f[_0xaff9('0x31')]=_['keys'](_0xac3aca['query']);_0x29c05f[_0xaff9('0x3c')]=_[_0xaff9('0x33')](_0x29c05f['model'],_0x29c05f[_0xaff9('0x31')]);_0x29f472[_0xaff9('0x32')]=_[_0xaff9('0x33')](_0x29c05f[_0xaff9('0x2f')],qs[_0xaff9('0x34')](_0xac3aca[_0xaff9('0x31')][_0xaff9('0x34')]));_0x29f472['attributes']=_0x29f472[_0xaff9('0x32')][_0xaff9('0x35')]?_0x29f472[_0xaff9('0x32')]:_0x29c05f[_0xaff9('0x2f')];_0x29f472[_0xaff9('0x39')]=qs[_0xaff9('0x3a')](_0xac3aca[_0xaff9('0x31')][_0xaff9('0x3a')]);_0x29f472[_0xaff9('0x3e')]=qs[_0xaff9('0x3c')](_[_0xaff9('0x3b')](_0xac3aca['query'],_0x29c05f['filters']));if(_0xac3aca[_0xaff9('0x31')][_0xaff9('0x3d')]){_0x29f472[_0xaff9('0x3e')]=_[_0xaff9('0x40')](_0x29f472[_0xaff9('0x3e')],{'$or':_[_0xaff9('0x29')](_0x29f472[_0xaff9('0x32')],function(_0x34e3de){var _0x45c141={};_0x45c141[_0x34e3de]={'$like':'%'+_0xac3aca['query'][_0xaff9('0x3d')]+'%'};return _0x45c141;})});}_0x29f472=_[_0xaff9('0x40')]({},_0x29f472,_0xac3aca[_0xaff9('0x48')]);return _0x7dfb31[_0xaff9('0x50')](_0x29f472);}})[_0xaff9('0x23')](function(_0x1734f0){if(_0x1734f0){_0x19d529=_0x1734f0[_0xaff9('0x35')];if(!_0xac3aca['query'][_0xaff9('0x36')](_0xaff9('0x37'))){_0x29f472[_0xaff9('0x38')]=qs[_0xaff9('0x38')](_0xac3aca[_0xaff9('0x31')][_0xaff9('0x38')]);_0x29f472[_0xaff9('0x1a')]=qs[_0xaff9('0x1a')](_0xac3aca['query']['offset']);}return _0x7dfb31[_0xaff9('0x50')](_0x29f472);}})[_0xaff9('0x23')](function(_0x2a315e){if(_0x2a315e){return _0x2a315e?{'count':_0x19d529,'rows':_0x2a315e}:null;}})['then'](respondWithResult(_0x1788a6,null))['catch'](handleError(_0x1788a6,null));};exports['getDescriptions']=function(_0x7e834b,_0x1bc62e,_0x3c7770){var _0xa48d19={};var _0xa57f10={};var _0xd3cca;var _0x5e11e6;return db[_0xaff9('0x2a')][_0xaff9('0x4e')]({'where':{'id':_0x7e834b[_0xaff9('0x47')]['id']}})[_0xaff9('0x23')](handleEntityNotFound(_0x1bc62e,null))[_0xaff9('0x23')](function(_0x3af016){if(_0x3af016){_0xd3cca=_0x3af016;_0xa57f10['model']=_['keys'](db['ZendeskField'][_0xaff9('0x2b')]);_0xa57f10['query']=_[_0xaff9('0x30')](_0x7e834b[_0xaff9('0x31')]);_0xa57f10[_0xaff9('0x3c')]=_[_0xaff9('0x33')](_0xa57f10[_0xaff9('0x2f')],_0xa57f10[_0xaff9('0x31')]);_0xa48d19[_0xaff9('0x32')]=_['intersection'](_0xa57f10[_0xaff9('0x2f')],qs[_0xaff9('0x34')](_0x7e834b['query'][_0xaff9('0x34')]));_0xa48d19[_0xaff9('0x32')]=_0xa48d19['attributes'][_0xaff9('0x35')]?_0xa48d19[_0xaff9('0x32')]:_0xa57f10[_0xaff9('0x2f')];_0xa48d19[_0xaff9('0x39')]=qs[_0xaff9('0x3a')](_0x7e834b[_0xaff9('0x31')]['sort']);_0xa48d19['where']=qs[_0xaff9('0x3c')](_[_0xaff9('0x3b')](_0x7e834b['query'],_0xa57f10[_0xaff9('0x3c')]));if(_0x7e834b['query'][_0xaff9('0x3d')]){_0xa48d19[_0xaff9('0x3e')]=_[_0xaff9('0x40')](_0xa48d19[_0xaff9('0x3e')],{'$or':_[_0xaff9('0x29')](_0xa48d19[_0xaff9('0x32')],function(_0x32e398){var _0x179062={};_0x179062[_0x32e398]={'$like':'%'+_0x7e834b[_0xaff9('0x31')][_0xaff9('0x3d')]+'%'};return _0x179062;})});}_0xa48d19=_[_0xaff9('0x40')]({},_0xa48d19,_0x7e834b[_0xaff9('0x48')]);return _0xd3cca['getDescriptions'](_0xa48d19);}})[_0xaff9('0x23')](function(_0x1c9d1d){if(_0x1c9d1d){_0x5e11e6=_0x1c9d1d[_0xaff9('0x35')];if(!_0x7e834b[_0xaff9('0x31')][_0xaff9('0x36')](_0xaff9('0x37'))){_0xa48d19[_0xaff9('0x38')]=qs[_0xaff9('0x38')](_0x7e834b[_0xaff9('0x31')]['limit']);_0xa48d19[_0xaff9('0x1a')]=qs[_0xaff9('0x1a')](_0x7e834b['query'][_0xaff9('0x1a')]);}return _0xd3cca['getDescriptions'](_0xa48d19);}})['then'](function(_0x2f9e7e){if(_0x2f9e7e){return _0x2f9e7e?{'count':_0x5e11e6,'rows':_0x2f9e7e}:null;}})[_0xaff9('0x23')](respondWithResult(_0x1bc62e,null))[_0xaff9('0x45')](handleError(_0x1bc62e,null));};exports[_0xaff9('0x51')]=function(_0x29f8ad,_0x875fe8,_0x3ba7a3){var _0x3f5612={};var _0x28759a={};var _0x20618c;var _0xe918f2;return db[_0xaff9('0x2a')][_0xaff9('0x4e')]({'where':{'id':_0x29f8ad[_0xaff9('0x47')]['id']}})[_0xaff9('0x23')](handleEntityNotFound(_0x875fe8,null))[_0xaff9('0x23')](function(_0x2b0258){if(_0x2b0258){_0x20618c=_0x2b0258;_0x28759a[_0xaff9('0x2f')]=_[_0xaff9('0x30')](db[_0xaff9('0x52')]['rawAttributes']);_0x28759a[_0xaff9('0x31')]=_[_0xaff9('0x30')](_0x29f8ad[_0xaff9('0x31')]);_0x28759a['filters']=_[_0xaff9('0x33')](_0x28759a[_0xaff9('0x2f')],_0x28759a[_0xaff9('0x31')]);_0x3f5612[_0xaff9('0x32')]=_[_0xaff9('0x33')](_0x28759a[_0xaff9('0x2f')],qs['fields'](_0x29f8ad['query']['fields']));_0x3f5612['attributes']=_0x3f5612[_0xaff9('0x32')]['length']?_0x3f5612[_0xaff9('0x32')]:_0x28759a[_0xaff9('0x2f')];_0x3f5612[_0xaff9('0x39')]=qs[_0xaff9('0x3a')](_0x29f8ad[_0xaff9('0x31')][_0xaff9('0x3a')]);_0x3f5612['where']=qs[_0xaff9('0x3c')](_[_0xaff9('0x3b')](_0x29f8ad[_0xaff9('0x31')],_0x28759a[_0xaff9('0x3c')]));if(_0x29f8ad['query'][_0xaff9('0x3d')]){_0x3f5612[_0xaff9('0x3e')]=_['merge'](_0x3f5612[_0xaff9('0x3e')],{'$or':_[_0xaff9('0x29')](_0x3f5612[_0xaff9('0x32')],function(_0x12361f){var _0x5ddcd7={};_0x5ddcd7[_0x12361f]={'$like':'%'+_0x29f8ad['query'][_0xaff9('0x3d')]+'%'};return _0x5ddcd7;})});}_0x3f5612=_['merge']({},_0x3f5612,_0x29f8ad['options']);return _0x20618c[_0xaff9('0x51')](_0x3f5612);}})[_0xaff9('0x23')](function(_0x2d31c7){if(_0x2d31c7){_0xe918f2=_0x2d31c7['length'];if(!_0x29f8ad[_0xaff9('0x31')][_0xaff9('0x36')]('nolimit')){_0x3f5612['limit']=qs[_0xaff9('0x38')](_0x29f8ad[_0xaff9('0x31')][_0xaff9('0x38')]);_0x3f5612[_0xaff9('0x1a')]=qs[_0xaff9('0x1a')](_0x29f8ad[_0xaff9('0x31')]['offset']);}return _0x20618c[_0xaff9('0x51')](_0x3f5612);}})[_0xaff9('0x23')](function(_0x45c3ea){if(_0x45c3ea){return _0x45c3ea?{'count':_0xe918f2,'rows':_0x45c3ea}:null;}})[_0xaff9('0x23')](respondWithResult(_0x875fe8,null))['catch'](handleError(_0x875fe8,null));};exports[_0xaff9('0x53')]=function(_0xce8b8e,_0x58d41a,_0x40fbde){if(_0xce8b8e['body']['id']){delete _0xce8b8e[_0xaff9('0x4b')]['id'];}return db[_0xaff9('0x2a')][_0xaff9('0x4e')]({'where':{'id':_0xce8b8e[_0xaff9('0x47')]['id']}})['then'](handleEntityNotFound(_0x58d41a,null))[_0xaff9('0x23')](function(_0x135ee2){if(_0x135ee2){return _0x135ee2[_0xaff9('0x53')](_0xce8b8e[_0xaff9('0x4b')]['ids']||[]);}return null;})[_0xaff9('0x23')](respondWithResult(_0x58d41a,null))[_0xaff9('0x45')](handleError(_0x58d41a,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index e4d6536..53166ba 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 _0xe2cf=['request-promise','path','rimraf','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','util','api','bluebird'];(function(_0x30e0b7,_0x41927){var _0x6eca1c=function(_0x1b2ed4){while(--_0x1b2ed4){_0x30e0b7['push'](_0x30e0b7['shift']());}};_0x6eca1c(++_0x41927);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x2b71da,_0x1a6441){_0x2b71da=_0x2b71da-0x0;var _0x314281=_0xe2cf[_0x2b71da];return _0x314281;};'use strict';var _=require('lodash');var util=require(_0xfe2c('0x0'));var logger=require('../../config/logger')(_0xfe2c('0x1'));var moment=require('moment');var BPromise=require(_0xfe2c('0x2'));var rp=require(_0xfe2c('0x3'));var fs=require('fs');var path=require(_0xfe2c('0x4'));var rimraf=require(_0xfe2c('0x5'));var config=require('../../config/environment');var attributes=require(_0xfe2c('0x6'));module[_0xfe2c('0x7')]=function(_0x55bb12,_0x4fa079){return _0x55bb12[_0xfe2c('0x8')](_0xfe2c('0x9'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c7c=['./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x53f402,_0x326920){var _0x45a76d=function(_0x51f590){while(--_0x51f590){_0x53f402['push'](_0x53f402['shift']());}};_0x45a76d(++_0x326920);}(_0x1c7c,0x164));var _0xc1c7=function(_0x53d025,_0x19cef4){_0x53d025=_0x53d025-0x0;var _0x4198a9=_0x1c7c[_0x53d025];return _0x4198a9;};'use strict';var _=require(_0xc1c7('0x0'));var util=require(_0xc1c7('0x1'));var logger=require(_0xc1c7('0x2'))(_0xc1c7('0x3'));var moment=require('moment');var BPromise=require(_0xc1c7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc1c7('0x5'));var rimraf=require(_0xc1c7('0x6'));var config=require(_0xc1c7('0x7'));var attributes=require(_0xc1c7('0x8'));module[_0xc1c7('0x9')]=function(_0x364dde,_0x1f3e21){return _0x364dde[_0xc1c7('0xa')](_0xc1c7('0xb'),attributes,{'tableName':_0xc1c7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 8969a1d..e56c736 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 _0x967b=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0x967b,0xb1));var _0xb967=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x967b[_0x7e2eb0];return _0xd92de4;};'use strict';var _=require(_0xb967('0x0'));var util=require(_0xb967('0x1'));var moment=require('moment');var BPromise=require(_0xb967('0x2'));var rs=require(_0xb967('0x3'));var fs=require('fs');var Redis=require(_0xb967('0x4'));var db=require(_0xb967('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb967('0x6'))(_0xb967('0x7'));var config=require(_0xb967('0x8'));var jayson=require(_0xb967('0x9'));var client=jayson[_0xb967('0xa')][_0xb967('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x318c55,_0xd9eda9,_0x4eed3b){return new BPromise(function(_0x548bf5,_0x1660fd){return client['request'](_0x318c55,_0x4eed3b)['then'](function(_0x311a9c){logger[_0xb967('0xc')](_0xb967('0xd'),_0xd9eda9,_0xb967('0xe'));logger[_0xb967('0xf')](_0xb967('0x10'),_0xd9eda9,_0xb967('0xe'),JSON['stringify'](_0x311a9c));if(_0x311a9c['error']){if(_0x311a9c[_0xb967('0x11')][_0xb967('0x12')]===0x1f4){logger[_0xb967('0x11')](_0xb967('0xd'),_0xd9eda9,_0x311a9c[_0xb967('0x11')][_0xb967('0x13')]);return _0x1660fd(_0x311a9c['error'][_0xb967('0x13')]);}logger[_0xb967('0x11')](_0xb967('0xd'),_0xd9eda9,_0x311a9c['error'][_0xb967('0x13')]);return _0x548bf5(_0x311a9c['error'][_0xb967('0x13')]);}else{logger[_0xb967('0xc')](_0xb967('0xd'),_0xd9eda9,_0xb967('0xe'));_0x548bf5(_0x311a9c[_0xb967('0x14')]['message']);}})[_0xb967('0x15')](function(_0x3d4a2e){logger[_0xb967('0x11')](_0xb967('0xd'),_0xd9eda9,_0x3d4a2e);_0x1660fd(_0x3d4a2e);});});} \ No newline at end of file +var _0x85b2=['client','request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x85b2,0xf3));var _0x285b=function(_0x55e4e2,_0x425598){_0x55e4e2=_0x55e4e2-0x0;var _0x576f02=_0x85b2[_0x55e4e2];return _0x576f02;};'use strict';var _=require(_0x285b('0x0'));var util=require(_0x285b('0x1'));var moment=require(_0x285b('0x2'));var BPromise=require(_0x285b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x285b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x285b('0x5'));var logger=require(_0x285b('0x6'))(_0x285b('0x7'));var config=require(_0x285b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x285b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10b6a3,_0x5bb7e1,_0x256673){return new BPromise(function(_0x1c80af,_0x49cbf1){return client[_0x285b('0xa')](_0x10b6a3,_0x256673)['then'](function(_0x562402){logger[_0x285b('0xb')](_0x285b('0xc'),_0x5bb7e1,_0x285b('0xd'));logger[_0x285b('0xe')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5bb7e1,_0x285b('0xd'),JSON[_0x285b('0xf')](_0x562402));if(_0x562402[_0x285b('0x10')]){if(_0x562402[_0x285b('0x10')][_0x285b('0x11')]===0x1f4){logger[_0x285b('0x10')](_0x285b('0xc'),_0x5bb7e1,_0x562402[_0x285b('0x10')][_0x285b('0x12')]);return _0x49cbf1(_0x562402[_0x285b('0x10')][_0x285b('0x12')]);}logger[_0x285b('0x10')](_0x285b('0xc'),_0x5bb7e1,_0x562402[_0x285b('0x10')][_0x285b('0x12')]);return _0x1c80af(_0x562402['error']['message']);}else{logger[_0x285b('0xb')](_0x285b('0xc'),_0x5bb7e1,_0x285b('0xd'));_0x1c80af(_0x562402[_0x285b('0x13')][_0x285b('0x12')]);}})[_0x285b('0x14')](function(_0x22b26a){logger[_0x285b('0x10')](_0x285b('0xc'),_0x5bb7e1,_0x22b26a);_0x49cbf1(_0x22b26a);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 1916d88..4b31f8f 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 _0xb13a=['show','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id'];(function(_0x264407,_0x107385){var _0x31793d=function(_0x1ae95b){while(--_0x1ae95b){_0x264407['push'](_0x264407['shift']());}};_0x31793d(++_0x107385);}(_0xb13a,0x1d2));var _0xab13=function(_0x1ff0d3,_0x38c63d){_0x1ff0d3=_0x1ff0d3-0x0;var _0x38a1a3=_0xb13a[_0x1ff0d3];return _0x38a1a3;};'use strict';var multer=require(_0xab13('0x0'));var util=require(_0xab13('0x1'));var path=require(_0xab13('0x2'));var timeout=require(_0xab13('0x3'));var express=require(_0xab13('0x4'));var router=express[_0xab13('0x5')]();var fs_extra=require(_0xab13('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xab13('0x7'));var config=require(_0xab13('0x8'));var controller=require(_0xab13('0x9'));router[_0xab13('0xa')]('/',auth[_0xab13('0xb')](),controller[_0xab13('0xc')]);router[_0xab13('0xa')](_0xab13('0xd'),auth[_0xab13('0xb')](),controller[_0xab13('0xe')]);router['post']('/',auth[_0xab13('0xb')](),controller[_0xab13('0xf')]);router[_0xab13('0x10')](_0xab13('0xd'),auth[_0xab13('0xb')](),controller[_0xab13('0x11')]);router['delete'](_0xab13('0xd'),auth[_0xab13('0xb')](),controller[_0xab13('0x12')]);module[_0xab13('0x13')]=router; \ No newline at end of file +var _0x57dd=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','exports','multer','util'];(function(_0x4570d5,_0x90c6e0){var _0x29557e=function(_0x390f7a){while(--_0x390f7a){_0x4570d5['push'](_0x4570d5['shift']());}};_0x29557e(++_0x90c6e0);}(_0x57dd,0x8a));var _0xd57d=function(_0x36a8dd,_0x18263b){_0x36a8dd=_0x36a8dd-0x0;var _0x306e43=_0x57dd[_0x36a8dd];return _0x306e43;};'use strict';var multer=require(_0xd57d('0x0'));var util=require(_0xd57d('0x1'));var path=require(_0xd57d('0x2'));var timeout=require(_0xd57d('0x3'));var express=require(_0xd57d('0x4'));var router=express[_0xd57d('0x5')]();var fs_extra=require(_0xd57d('0x6'));var auth=require(_0xd57d('0x7'));var interaction=require(_0xd57d('0x8'));var config=require('../../config/environment');var controller=require(_0xd57d('0x9'));router[_0xd57d('0xa')]('/',auth[_0xd57d('0xb')](),controller[_0xd57d('0xc')]);router[_0xd57d('0xa')]('/:id',auth[_0xd57d('0xb')](),controller[_0xd57d('0xd')]);router[_0xd57d('0xe')]('/',auth[_0xd57d('0xb')](),controller[_0xd57d('0xf')]);router['put'](_0xd57d('0x10'),auth[_0xd57d('0xb')](),controller['update']);router[_0xd57d('0x11')](_0xd57d('0x10'),auth[_0xd57d('0xb')](),controller[_0xd57d('0x12')]);module[_0xd57d('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index bd5b973..cea5cc8 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 _0x86eb=['string','variable','keyValue','picklist','STRING','ENUM','customVariable','sequelize','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x86eb,0xe8));var _0xb86e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x86eb[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xb86e('0x0'));module[_0xb86e('0x1')]={'type':{'type':Sequelize['ENUM'](_0xb86e('0x2'),_0xb86e('0x3'),'customVariable',_0xb86e('0x4'),_0xb86e('0x5')),'defaultValue':_0xb86e('0x2')},'content':{'type':Sequelize[_0xb86e('0x6')]},'key':{'type':Sequelize[_0xb86e('0x6')]},'keyType':{'type':Sequelize[_0xb86e('0x7')](_0xb86e('0x2'),'variable',_0xb86e('0x8'))},'keyContent':{'type':Sequelize[_0xb86e('0x6')]},'idField':{'type':Sequelize[_0xb86e('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb86e('0x6')]}}; \ No newline at end of file +var _0x7406=['STRING','sequelize','ENUM','string','customVariable','keyValue','picklist'];(function(_0x5a0bab,_0x168def){var _0x32b15a=function(_0x52f391){while(--_0x52f391){_0x5a0bab['push'](_0x5a0bab['shift']());}};_0x32b15a(++_0x168def);}(_0x7406,0xfd));var _0x6740=function(_0x3ab54a,_0xf327f1){_0x3ab54a=_0x3ab54a-0x0;var _0x2b8fcd=_0x7406[_0x3ab54a];return _0x2b8fcd;};'use strict';var Sequelize=require(_0x6740('0x0'));module['exports']={'type':{'type':Sequelize[_0x6740('0x1')](_0x6740('0x2'),'variable',_0x6740('0x3'),_0x6740('0x4'),_0x6740('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x6740('0x6')]},'key':{'type':Sequelize[_0x6740('0x6')]},'keyType':{'type':Sequelize[_0x6740('0x1')]('string','variable',_0x6740('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x6740('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'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 031d7aa..aef4d31 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 _0xb7ec=['options','includeAll','include','rows','params','merge','find','catch','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL'];(function(_0x79cd47,_0x16102d){var _0x3b9484=function(_0x23db95){while(--_0x23db95){_0x79cd47['push'](_0x79cd47['shift']());}};_0x3b9484(++_0x16102d);}(_0xb7ec,0x137));var _0xcb7e=function(_0x493713,_0x1aa41f){_0x493713=_0x493713-0x0;var _0x3f66e0=_0xb7ec[_0x493713];return _0x3f66e0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcb7e('0x0'));var zipdir=require(_0xcb7e('0x1'));var jsonpatch=require(_0xcb7e('0x2'));var rp=require(_0xcb7e('0x3'));var moment=require(_0xcb7e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcb7e('0x5'));var util=require(_0xcb7e('0x6'));var path=require(_0xcb7e('0x7'));var sox=require(_0xcb7e('0x8'));var csv=require(_0xcb7e('0x9'));var ejs=require(_0xcb7e('0xa'));var fs=require('fs');var fs_extra=require(_0xcb7e('0xb'));var _=require('lodash');var squel=require(_0xcb7e('0xc'));var crypto=require('crypto');var jsforce=require(_0xcb7e('0xd'));var deskjs=require(_0xcb7e('0xe'));var toCsv=require(_0xcb7e('0x9'));var querystring=require('querystring');var Papa=require(_0xcb7e('0xf'));var Redis=require(_0xcb7e('0x10'));var authService=require(_0xcb7e('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcb7e('0x12'))(_0xcb7e('0x13'));var utils=require(_0xcb7e('0x14'));var config=require(_0xcb7e('0x15'));var licenseUtil=require(_0xcb7e('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f7086,_0x5d1ffb){_0x5d1ffb=_0x5d1ffb||0xcc;return function(_0x330dfb){if(_0x330dfb){return _0x4f7086['sendStatus'](_0x5d1ffb);}return _0x4f7086[_0xcb7e('0x17')](_0x5d1ffb)[_0xcb7e('0x18')]();};}function respondWithResult(_0x523e56,_0x5746b5){_0x5746b5=_0x5746b5||0xc8;return function(_0x4b7857){if(_0x4b7857){return _0x523e56[_0xcb7e('0x17')](_0x5746b5)[_0xcb7e('0x19')](_0x4b7857);}};}function respondWithFilteredResult(_0x50bbef,_0x2c8e42){return function(_0x1e594b){if(_0x1e594b){var _0x50bbb2=typeof _0x2c8e42[_0xcb7e('0x1a')]===_0xcb7e('0x1b')&&typeof _0x2c8e42['limit']==='undefined';var _0x1b0fa2=_0x1e594b[_0xcb7e('0x1c')];var _0x40e87a=_0x50bbb2?0x0:_0x2c8e42[_0xcb7e('0x1a')];var _0x557386=_0x50bbb2?_0x1e594b[_0xcb7e('0x1c')]:_0x2c8e42[_0xcb7e('0x1a')]+_0x2c8e42[_0xcb7e('0x1d')];var _0x1c2892;if(_0x557386>=_0x1b0fa2){_0x557386=_0x1b0fa2;_0x1c2892=0xc8;}else{_0x1c2892=0xce;}_0x50bbef['status'](_0x1c2892);return _0x50bbef[_0xcb7e('0x1e')](_0xcb7e('0x1f'),_0x40e87a+'-'+_0x557386+'/'+_0x1b0fa2)[_0xcb7e('0x19')](_0x1e594b);}return null;};}function patchUpdates(_0x146661){return function(_0x3919af){try{jsonpatch[_0xcb7e('0x20')](_0x3919af,_0x146661,!![]);}catch(_0x597524){return BPromise[_0xcb7e('0x21')](_0x597524);}return _0x3919af[_0xcb7e('0x22')]();};}function saveUpdates(_0x4c441e,_0x370c49){return function(_0x2b243b){if(_0x2b243b){return _0x2b243b[_0xcb7e('0x23')](_0x4c441e)[_0xcb7e('0x24')](function(_0x5d6aab){return _0x5d6aab;});}return null;};}function removeEntity(_0x2aeed7,_0x3a7f7f){return function(_0x16c576){if(_0x16c576){return _0x16c576['destroy']()['then'](function(){_0x2aeed7[_0xcb7e('0x17')](0xcc)[_0xcb7e('0x18')]();});}};}function handleEntityNotFound(_0x5b3998,_0x56a1a6){return function(_0x2f4199){if(!_0x2f4199){_0x5b3998[_0xcb7e('0x25')](0x194);}return _0x2f4199;};}function handleError(_0x35f543,_0x322381){_0x322381=_0x322381||0x1f4;return function(_0x265a88){logger[_0xcb7e('0x26')](_0x265a88[_0xcb7e('0x27')]);if(_0x265a88[_0xcb7e('0x28')]){delete _0x265a88[_0xcb7e('0x28')];}_0x35f543[_0xcb7e('0x17')](_0x322381)[_0xcb7e('0x29')](_0x265a88);};}exports[_0xcb7e('0x2a')]=function(_0x264de2,_0x593864){var _0x49f318={},_0xc0102e={},_0x37fdc5={'count':0x0,'rows':[]};var _0x34d51c=_[_0xcb7e('0x2b')](db[_0xcb7e('0x2c')][_0xcb7e('0x2d')],function(_0x211aac){return{'name':_0x211aac[_0xcb7e('0x2e')],'type':_0x211aac[_0xcb7e('0x2f')][_0xcb7e('0x30')]};});_0xc0102e[_0xcb7e('0x31')]=_[_0xcb7e('0x2b')](_0x34d51c,_0xcb7e('0x28'));_0xc0102e[_0xcb7e('0x32')]=_[_0xcb7e('0x33')](_0x264de2['query']);_0xc0102e[_0xcb7e('0x34')]=_[_0xcb7e('0x35')](_0xc0102e[_0xcb7e('0x31')],_0xc0102e[_0xcb7e('0x32')]);_0x49f318['attributes']=_[_0xcb7e('0x35')](_0xc0102e[_0xcb7e('0x31')],qs[_0xcb7e('0x36')](_0x264de2[_0xcb7e('0x32')]['fields']));_0x49f318[_0xcb7e('0x37')]=_0x49f318[_0xcb7e('0x37')][_0xcb7e('0x38')]?_0x49f318[_0xcb7e('0x37')]:_0xc0102e[_0xcb7e('0x31')];if(!_0x264de2[_0xcb7e('0x32')][_0xcb7e('0x39')]('nolimit')){_0x49f318['limit']=qs[_0xcb7e('0x1d')](_0x264de2[_0xcb7e('0x32')]['limit']);_0x49f318['offset']=qs['offset'](_0x264de2[_0xcb7e('0x32')][_0xcb7e('0x1a')]);}_0x49f318[_0xcb7e('0x3a')]=qs['sort'](_0x264de2[_0xcb7e('0x32')][_0xcb7e('0x3b')]);_0x49f318[_0xcb7e('0x3c')]=qs['filters'](_[_0xcb7e('0x3d')](_0x264de2['query'],_0xc0102e[_0xcb7e('0x34')]),_0x34d51c);if(_0x264de2[_0xcb7e('0x32')][_0xcb7e('0x3e')]){_0x49f318[_0xcb7e('0x3c')]=_['merge'](_0x49f318[_0xcb7e('0x3c')],{'$or':_[_0xcb7e('0x2b')](_0x34d51c,function(_0x3c2eee){if(_0x3c2eee['type']!==_0xcb7e('0x3f')){var _0xdb318e={};_0xdb318e[_0x3c2eee[_0xcb7e('0x28')]]={'$like':'%'+_0x264de2[_0xcb7e('0x32')][_0xcb7e('0x3e')]+'%'};return _0xdb318e;}})});}_0x49f318=_['merge']({},_0x49f318,_0x264de2[_0xcb7e('0x40')]);var _0x4944ab={'where':_0x49f318[_0xcb7e('0x3c')]};return db[_0xcb7e('0x2c')][_0xcb7e('0x1c')](_0x4944ab)[_0xcb7e('0x24')](function(_0x28104a){_0x37fdc5[_0xcb7e('0x1c')]=_0x28104a;if(_0x264de2[_0xcb7e('0x32')][_0xcb7e('0x41')]){_0x49f318[_0xcb7e('0x42')]=[{'all':!![]}];}return db[_0xcb7e('0x2c')]['findAll'](_0x49f318);})[_0xcb7e('0x24')](function(_0x56d76a){_0x37fdc5[_0xcb7e('0x43')]=_0x56d76a;return _0x37fdc5;})[_0xcb7e('0x24')](respondWithFilteredResult(_0x593864,_0x49f318))['catch'](handleError(_0x593864,null));};exports['show']=function(_0x592eab,_0x3b971f){var _0x3d27ed={'raw':!![],'where':{'id':_0x592eab[_0xcb7e('0x44')]['id']}},_0x3e1f3c={};_0x3e1f3c['model']=_[_0xcb7e('0x33')](db['ZendeskField'][_0xcb7e('0x2d')]);_0x3e1f3c[_0xcb7e('0x32')]=_[_0xcb7e('0x33')](_0x592eab['query']);_0x3e1f3c['filters']=_[_0xcb7e('0x35')](_0x3e1f3c[_0xcb7e('0x31')],_0x3e1f3c[_0xcb7e('0x32')]);_0x3d27ed[_0xcb7e('0x37')]=_['intersection'](_0x3e1f3c[_0xcb7e('0x31')],qs[_0xcb7e('0x36')](_0x592eab[_0xcb7e('0x32')][_0xcb7e('0x36')]));_0x3d27ed[_0xcb7e('0x37')]=_0x3d27ed[_0xcb7e('0x37')][_0xcb7e('0x38')]?_0x3d27ed[_0xcb7e('0x37')]:_0x3e1f3c[_0xcb7e('0x31')];if(_0x592eab[_0xcb7e('0x32')][_0xcb7e('0x41')]){_0x3d27ed[_0xcb7e('0x42')]=[{'all':!![]}];}_0x3d27ed=_[_0xcb7e('0x45')]({},_0x3d27ed,_0x592eab[_0xcb7e('0x40')]);return db[_0xcb7e('0x2c')][_0xcb7e('0x46')](_0x3d27ed)[_0xcb7e('0x24')](handleEntityNotFound(_0x3b971f,null))[_0xcb7e('0x24')](respondWithResult(_0x3b971f,null))[_0xcb7e('0x47')](handleError(_0x3b971f,null));};exports['create']=function(_0x539ca5,_0x41f0c8){return db[_0xcb7e('0x2c')][_0xcb7e('0x48')](_0x539ca5['body'],{})[_0xcb7e('0x24')](respondWithResult(_0x41f0c8,0xc9))['catch'](handleError(_0x41f0c8,null));};exports['update']=function(_0x41c9e3,_0x595fcf){if(_0x41c9e3[_0xcb7e('0x49')]['id']){delete _0x41c9e3[_0xcb7e('0x49')]['id'];}return db['ZendeskField'][_0xcb7e('0x46')]({'where':{'id':_0x41c9e3[_0xcb7e('0x44')]['id']}})[_0xcb7e('0x24')](handleEntityNotFound(_0x595fcf,null))[_0xcb7e('0x24')](saveUpdates(_0x41c9e3['body'],null))['then'](respondWithResult(_0x595fcf,null))[_0xcb7e('0x47')](handleError(_0x595fcf,null));};exports[_0xcb7e('0x4a')]=function(_0x257c3c,_0x3d1cba){return db[_0xcb7e('0x2c')][_0xcb7e('0x46')]({'where':{'id':_0x257c3c[_0xcb7e('0x44')]['id']}})[_0xcb7e('0x24')](handleEntityNotFound(_0x3d1cba,null))[_0xcb7e('0x24')](removeEntity(_0x3d1cba,null))[_0xcb7e('0x47')](handleError(_0x3d1cba,null));}; \ No newline at end of file +var _0x5f3a=['offset','order','sort','where','pick','filter','merge','map','VIRTUAL','options','count','includeAll','include','rows','params','intersection','find','create','body','catch','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','set','reject','then','destroy','send','index','ZendeskField','rawAttributes','type','model','name','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f3a,0x16d));var _0xa5f3=function(_0x5eff69,_0x53808d){_0x5eff69=_0x5eff69-0x0;var _0x1307ea=_0x5f3a[_0x5eff69];return _0x1307ea;};'use strict';var emlformat=require(_0xa5f3('0x0'));var rimraf=require(_0xa5f3('0x1'));var zipdir=require(_0xa5f3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa5f3('0x3'));var BPromise=require(_0xa5f3('0x4'));var Mustache=require(_0xa5f3('0x5'));var util=require(_0xa5f3('0x6'));var path=require(_0xa5f3('0x7'));var sox=require(_0xa5f3('0x8'));var csv=require(_0xa5f3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa5f3('0xa'));var _=require(_0xa5f3('0xb'));var squel=require(_0xa5f3('0xc'));var crypto=require(_0xa5f3('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa5f3('0x9'));var querystring=require(_0xa5f3('0xe'));var Papa=require(_0xa5f3('0xf'));var Redis=require(_0xa5f3('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa5f3('0x11'));var hardwareService=require(_0xa5f3('0x12'));var logger=require(_0xa5f3('0x13'))(_0xa5f3('0x14'));var utils=require(_0xa5f3('0x15'));var config=require(_0xa5f3('0x16'));var licenseUtil=require(_0xa5f3('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d4c37,_0x59eb97){_0x59eb97=_0x59eb97||0xcc;return function(_0x2c8f0f){if(_0x2c8f0f){return _0x4d4c37[_0xa5f3('0x18')](_0x59eb97);}return _0x4d4c37[_0xa5f3('0x19')](_0x59eb97)[_0xa5f3('0x1a')]();};}function respondWithResult(_0x51bd94,_0x97b3f3){_0x97b3f3=_0x97b3f3||0xc8;return function(_0x3fb7c9){if(_0x3fb7c9){return _0x51bd94[_0xa5f3('0x19')](_0x97b3f3)[_0xa5f3('0x1b')](_0x3fb7c9);}};}function respondWithFilteredResult(_0x276c5b,_0x220abb){return function(_0x5c2437){if(_0x5c2437){var _0x27b521=typeof _0x220abb['offset']===_0xa5f3('0x1c')&&typeof _0x220abb['limit']===_0xa5f3('0x1c');var _0x39e822=_0x5c2437['count'];var _0x147cdd=_0x27b521?0x0:_0x220abb['offset'];var _0x24da0f=_0x27b521?_0x5c2437['count']:_0x220abb['offset']+_0x220abb[_0xa5f3('0x1d')];var _0x3320ca;if(_0x24da0f>=_0x39e822){_0x24da0f=_0x39e822;_0x3320ca=0xc8;}else{_0x3320ca=0xce;}_0x276c5b[_0xa5f3('0x19')](_0x3320ca);return _0x276c5b[_0xa5f3('0x1e')]('Content-Range',_0x147cdd+'-'+_0x24da0f+'/'+_0x39e822)['json'](_0x5c2437);}return null;};}function patchUpdates(_0x4664a7){return function(_0x11c96a){try{jsonpatch['apply'](_0x11c96a,_0x4664a7,!![]);}catch(_0x45611f){return BPromise[_0xa5f3('0x1f')](_0x45611f);}return _0x11c96a['save']();};}function saveUpdates(_0x4763e2,_0x59e32a){return function(_0x58c8e3){if(_0x58c8e3){return _0x58c8e3['update'](_0x4763e2)[_0xa5f3('0x20')](function(_0x2a0d19){return _0x2a0d19;});}return null;};}function removeEntity(_0x7af819,_0x59f805){return function(_0x555363){if(_0x555363){return _0x555363[_0xa5f3('0x21')]()[_0xa5f3('0x20')](function(){_0x7af819['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d5d8f,_0x5add9f){return function(_0x284c38){if(!_0x284c38){_0x4d5d8f[_0xa5f3('0x18')](0x194);}return _0x284c38;};}function handleError(_0x3da27d,_0x6ded35){_0x6ded35=_0x6ded35||0x1f4;return function(_0x386ccd){logger['error'](_0x386ccd['stack']);if(_0x386ccd['name']){delete _0x386ccd['name'];}_0x3da27d['status'](_0x6ded35)[_0xa5f3('0x22')](_0x386ccd);};}exports[_0xa5f3('0x23')]=function(_0x1fb7c5,_0x5baa5d){var _0x417a3a={},_0x54bae1={},_0x10e9ff={'count':0x0,'rows':[]};var _0x273049=_['map'](db[_0xa5f3('0x24')][_0xa5f3('0x25')],function(_0x38de6){return{'name':_0x38de6['fieldName'],'type':_0x38de6[_0xa5f3('0x26')]['key']};});_0x54bae1[_0xa5f3('0x27')]=_['map'](_0x273049,_0xa5f3('0x28'));_0x54bae1[_0xa5f3('0x29')]=_[_0xa5f3('0x2a')](_0x1fb7c5[_0xa5f3('0x29')]);_0x54bae1[_0xa5f3('0x2b')]=_['intersection'](_0x54bae1['model'],_0x54bae1[_0xa5f3('0x29')]);_0x417a3a[_0xa5f3('0x2c')]=_['intersection'](_0x54bae1[_0xa5f3('0x27')],qs[_0xa5f3('0x2d')](_0x1fb7c5[_0xa5f3('0x29')]['fields']));_0x417a3a[_0xa5f3('0x2c')]=_0x417a3a[_0xa5f3('0x2c')][_0xa5f3('0x2e')]?_0x417a3a[_0xa5f3('0x2c')]:_0x54bae1[_0xa5f3('0x27')];if(!_0x1fb7c5['query'][_0xa5f3('0x2f')](_0xa5f3('0x30'))){_0x417a3a[_0xa5f3('0x1d')]=qs[_0xa5f3('0x1d')](_0x1fb7c5[_0xa5f3('0x29')]['limit']);_0x417a3a[_0xa5f3('0x31')]=qs[_0xa5f3('0x31')](_0x1fb7c5[_0xa5f3('0x29')][_0xa5f3('0x31')]);}_0x417a3a[_0xa5f3('0x32')]=qs[_0xa5f3('0x33')](_0x1fb7c5[_0xa5f3('0x29')][_0xa5f3('0x33')]);_0x417a3a[_0xa5f3('0x34')]=qs[_0xa5f3('0x2b')](_[_0xa5f3('0x35')](_0x1fb7c5[_0xa5f3('0x29')],_0x54bae1[_0xa5f3('0x2b')]),_0x273049);if(_0x1fb7c5['query'][_0xa5f3('0x36')]){_0x417a3a[_0xa5f3('0x34')]=_[_0xa5f3('0x37')](_0x417a3a[_0xa5f3('0x34')],{'$or':_[_0xa5f3('0x38')](_0x273049,function(_0x1af838){if(_0x1af838['type']!==_0xa5f3('0x39')){var _0x1a6118={};_0x1a6118[_0x1af838[_0xa5f3('0x28')]]={'$like':'%'+_0x1fb7c5[_0xa5f3('0x29')][_0xa5f3('0x36')]+'%'};return _0x1a6118;}})});}_0x417a3a=_[_0xa5f3('0x37')]({},_0x417a3a,_0x1fb7c5[_0xa5f3('0x3a')]);var _0x232499={'where':_0x417a3a[_0xa5f3('0x34')]};return db['ZendeskField']['count'](_0x232499)[_0xa5f3('0x20')](function(_0x54024f){_0x10e9ff[_0xa5f3('0x3b')]=_0x54024f;if(_0x1fb7c5[_0xa5f3('0x29')][_0xa5f3('0x3c')]){_0x417a3a[_0xa5f3('0x3d')]=[{'all':!![]}];}return db[_0xa5f3('0x24')]['findAll'](_0x417a3a);})[_0xa5f3('0x20')](function(_0x103075){_0x10e9ff[_0xa5f3('0x3e')]=_0x103075;return _0x10e9ff;})[_0xa5f3('0x20')](respondWithFilteredResult(_0x5baa5d,_0x417a3a))['catch'](handleError(_0x5baa5d,null));};exports['show']=function(_0x4a723e,_0x15c17f){var _0x61a352={'raw':!![],'where':{'id':_0x4a723e[_0xa5f3('0x3f')]['id']}},_0x3fb904={};_0x3fb904[_0xa5f3('0x27')]=_[_0xa5f3('0x2a')](db[_0xa5f3('0x24')][_0xa5f3('0x25')]);_0x3fb904[_0xa5f3('0x29')]=_[_0xa5f3('0x2a')](_0x4a723e[_0xa5f3('0x29')]);_0x3fb904['filters']=_[_0xa5f3('0x40')](_0x3fb904[_0xa5f3('0x27')],_0x3fb904[_0xa5f3('0x29')]);_0x61a352[_0xa5f3('0x2c')]=_[_0xa5f3('0x40')](_0x3fb904[_0xa5f3('0x27')],qs[_0xa5f3('0x2d')](_0x4a723e[_0xa5f3('0x29')][_0xa5f3('0x2d')]));_0x61a352[_0xa5f3('0x2c')]=_0x61a352[_0xa5f3('0x2c')][_0xa5f3('0x2e')]?_0x61a352['attributes']:_0x3fb904[_0xa5f3('0x27')];if(_0x4a723e[_0xa5f3('0x29')][_0xa5f3('0x3c')]){_0x61a352[_0xa5f3('0x3d')]=[{'all':!![]}];}_0x61a352=_[_0xa5f3('0x37')]({},_0x61a352,_0x4a723e['options']);return db[_0xa5f3('0x24')][_0xa5f3('0x41')](_0x61a352)[_0xa5f3('0x20')](handleEntityNotFound(_0x15c17f,null))[_0xa5f3('0x20')](respondWithResult(_0x15c17f,null))['catch'](handleError(_0x15c17f,null));};exports['create']=function(_0x5bd45d,_0x45631b){return db[_0xa5f3('0x24')][_0xa5f3('0x42')](_0x5bd45d[_0xa5f3('0x43')],{})[_0xa5f3('0x20')](respondWithResult(_0x45631b,0xc9))[_0xa5f3('0x44')](handleError(_0x45631b,null));};exports['update']=function(_0x312f24,_0x41d376){if(_0x312f24[_0xa5f3('0x43')]['id']){delete _0x312f24[_0xa5f3('0x43')]['id'];}return db['ZendeskField'][_0xa5f3('0x41')]({'where':{'id':_0x312f24['params']['id']}})[_0xa5f3('0x20')](handleEntityNotFound(_0x41d376,null))[_0xa5f3('0x20')](saveUpdates(_0x312f24['body'],null))['then'](respondWithResult(_0x41d376,null))['catch'](handleError(_0x41d376,null));};exports['destroy']=function(_0x3fcd2e,_0x3b291b){return db[_0xa5f3('0x24')][_0xa5f3('0x41')]({'where':{'id':_0x3fcd2e[_0xa5f3('0x3f')]['id']}})[_0xa5f3('0x20')](handleEntityNotFound(_0x3b291b,null))[_0xa5f3('0x20')](removeEntity(_0x3b291b,null))['catch'](handleError(_0x3b291b,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 05179db..82a2d73 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 _0xa47b=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash'];(function(_0xe90170,_0x2b4c13){var _0x48d611=function(_0x2ca11a){while(--_0x2ca11a){_0xe90170['push'](_0xe90170['shift']());}};_0x48d611(++_0x2b4c13);}(_0xa47b,0x192));var _0xba47=function(_0x529f4e,_0xd8911a){_0x529f4e=_0x529f4e-0x0;var _0x1bb663=_0xa47b[_0x529f4e];return _0x1bb663;};'use strict';var _=require(_0xba47('0x0'));var util=require(_0xba47('0x1'));var logger=require(_0xba47('0x2'))(_0xba47('0x3'));var moment=require(_0xba47('0x4'));var BPromise=require('bluebird');var rp=require(_0xba47('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xba47('0x6'));var config=require(_0xba47('0x7'));var attributes=require('./intZendeskField.attributes');module['exports']=function(_0xb7b1f0,_0x3852a0){return _0xb7b1f0['define'](_0xba47('0x8'),attributes,{'tableName':_0xba47('0x9'),'paranoid':![],'indexes':[{'name':_0xba47('0xa'),'fields':[_0xba47('0xb'),_0xba47('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc3ec=['FieldId','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','define','ZendeskField','int_zendesk_fields'];(function(_0x5a997d,_0x530d0e){var _0x286394=function(_0x4a17cb){while(--_0x4a17cb){_0x5a997d['push'](_0x5a997d['shift']());}};_0x286394(++_0x530d0e);}(_0xc3ec,0x146));var _0xcc3e=function(_0x4dd4aa,_0x464b15){_0x4dd4aa=_0x4dd4aa-0x0;var _0x1ed429=_0xc3ec[_0x4dd4aa];return _0x1ed429;};'use strict';var _=require(_0xcc3e('0x0'));var util=require(_0xcc3e('0x1'));var logger=require(_0xcc3e('0x2'))('api');var moment=require(_0xcc3e('0x3'));var BPromise=require(_0xcc3e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc3e('0x5'));var rimraf=require(_0xcc3e('0x6'));var config=require(_0xcc3e('0x7'));var attributes=require('./intZendeskField.attributes');module[_0xcc3e('0x8')]=function(_0x4a47a8,_0x3732b7){return _0x4a47a8[_0xcc3e('0x9')](_0xcc3e('0xa'),attributes,{'tableName':_0xcc3e('0xb'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':['idField',_0xcc3e('0xc')],'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 80648a8..18dfc0d 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 _0x0707=['debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','info','ZendeskField,\x20%s,\x20%s','request\x20sent'];(function(_0x1e2459,_0x40e30c){var _0x30c2e0=function(_0x11e070){while(--_0x11e070){_0x1e2459['push'](_0x1e2459['shift']());}};_0x30c2e0(++_0x40e30c);}(_0x0707,0x1c1));var _0x7070=function(_0x4a6c43,_0x263a12){_0x4a6c43=_0x4a6c43-0x0;var _0x436709=_0x0707[_0x4a6c43];return _0x436709;};'use strict';var _=require(_0x7070('0x0'));var util=require('util');var moment=require(_0x7070('0x1'));var BPromise=require('bluebird');var rs=require(_0x7070('0x2'));var fs=require('fs');var Redis=require(_0x7070('0x3'));var db=require(_0x7070('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7070('0x5'));var config=require(_0x7070('0x6'));var jayson=require(_0x7070('0x7'));var client=jayson['client'][_0x7070('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x44cdf7,_0x42249c,_0x18f67f){return new BPromise(function(_0x3c9c95,_0x228a84){return client[_0x7070('0x9')](_0x44cdf7,_0x18f67f)['then'](function(_0x2a1040){logger[_0x7070('0xa')](_0x7070('0xb'),_0x42249c,_0x7070('0xc'));logger[_0x7070('0xd')](_0x7070('0xe'),_0x42249c,_0x7070('0xc'),JSON[_0x7070('0xf')](_0x2a1040));if(_0x2a1040['error']){if(_0x2a1040[_0x7070('0x10')][_0x7070('0x11')]===0x1f4){logger['error']('ZendeskField,\x20%s,\x20%s',_0x42249c,_0x2a1040['error'][_0x7070('0x12')]);return _0x228a84(_0x2a1040[_0x7070('0x10')][_0x7070('0x12')]);}logger[_0x7070('0x10')](_0x7070('0xb'),_0x42249c,_0x2a1040[_0x7070('0x10')][_0x7070('0x12')]);return _0x3c9c95(_0x2a1040[_0x7070('0x10')][_0x7070('0x12')]);}else{logger[_0x7070('0xa')](_0x7070('0xb'),_0x42249c,_0x7070('0xc'));_0x3c9c95(_0x2a1040[_0x7070('0x13')][_0x7070('0x12')]);}})[_0x7070('0x14')](function(_0x39fd5b){logger[_0x7070('0x10')]('ZendeskField,\x20%s,\x20%s',_0x42249c,_0x39fd5b);_0x228a84(_0x39fd5b);});});} \ No newline at end of file +var _0xb795=['ZendeskField,\x20%s,\x20%s','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x499f33,_0xc8c3d1){var _0x3c283a=function(_0x41c9e0){while(--_0x41c9e0){_0x499f33['push'](_0x499f33['shift']());}};_0x3c283a(++_0xc8c3d1);}(_0xb795,0x1e8));var _0x5b79=function(_0xc9e0a6,_0x5bfcd7){_0xc9e0a6=_0xc9e0a6-0x0;var _0x290884=_0xb795[_0xc9e0a6];return _0x290884;};'use strict';var _=require(_0x5b79('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5b79('0x1'));var rs=require(_0x5b79('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5b79('0x3'))['db'];var utils=require(_0x5b79('0x4'));var logger=require('../../config/logger')(_0x5b79('0x5'));var config=require(_0x5b79('0x6'));var jayson=require(_0x5b79('0x7'));var client=jayson[_0x5b79('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x257c63,_0x40cf13,_0x5d3d18){return new BPromise(function(_0x1a86ff,_0x1fd7ad){return client[_0x5b79('0x9')](_0x257c63,_0x5d3d18)[_0x5b79('0xa')](function(_0x5b6483){logger[_0x5b79('0xb')](_0x5b79('0xc'),_0x40cf13,_0x5b79('0xd'));logger['debug'](_0x5b79('0xe'),_0x40cf13,_0x5b79('0xd'),JSON['stringify'](_0x5b6483));if(_0x5b6483[_0x5b79('0xf')]){if(_0x5b6483[_0x5b79('0xf')][_0x5b79('0x10')]===0x1f4){logger[_0x5b79('0xf')](_0x5b79('0xc'),_0x40cf13,_0x5b6483['error'][_0x5b79('0x11')]);return _0x1fd7ad(_0x5b6483[_0x5b79('0xf')][_0x5b79('0x11')]);}logger[_0x5b79('0xf')](_0x5b79('0xc'),_0x40cf13,_0x5b6483[_0x5b79('0xf')][_0x5b79('0x11')]);return _0x1a86ff(_0x5b6483['error'][_0x5b79('0x11')]);}else{logger[_0x5b79('0xb')]('ZendeskField,\x20%s,\x20%s',_0x40cf13,_0x5b79('0xd'));_0x1a86ff(_0x5b6483[_0x5b79('0x12')][_0x5b79('0x11')]);}})[_0x5b79('0x13')](function(_0x335fd2){logger['error'](_0x5b79('0xc'),_0x40cf13,_0x335fd2);_0x1fd7ad(_0x335fd2);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 1bdda7f..22a1830 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 _0x6817=['addConfiguration','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intZohoAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','/:id/fields','post'];(function(_0x81e9da,_0x57c4de){var _0x3eef33=function(_0x246d9f){while(--_0x246d9f){_0x81e9da['push'](_0x81e9da['shift']());}};_0x3eef33(++_0x57c4de);}(_0x6817,0xcd));var _0x7681=function(_0x4dce23,_0x121525){_0x4dce23=_0x4dce23-0x0;var _0x338b71=_0x6817[_0x4dce23];return _0x338b71;};'use strict';var multer=require(_0x7681('0x0'));var util=require(_0x7681('0x1'));var path=require('path');var timeout=require(_0x7681('0x2'));var express=require(_0x7681('0x3'));var router=express[_0x7681('0x4')]();var fs_extra=require(_0x7681('0x5'));var auth=require(_0x7681('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7681('0x7'));router[_0x7681('0x8')]('/',auth[_0x7681('0x9')](),controller['index']);router[_0x7681('0x8')](_0x7681('0xa'),auth['isAuthenticated'](),controller[_0x7681('0xb')]);router['get'](_0x7681('0xc'),auth[_0x7681('0x9')](),controller['getConfigurations']);router['get'](_0x7681('0xd'),auth[_0x7681('0x9')](),controller['getFields']);router[_0x7681('0xe')]('/',auth[_0x7681('0x9')](),controller['create']);router[_0x7681('0xe')]('/:id/configurations',auth[_0x7681('0x9')](),controller[_0x7681('0xf')]);router[_0x7681('0x10')](_0x7681('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x7681('0x11')](_0x7681('0xa'),auth[_0x7681('0x9')](),controller[_0x7681('0x12')]);module[_0x7681('0x13')]=router; \ No newline at end of file +var _0x4e53=['../../components/interaction/service','../../config/environment','./intZohoAccount.controller','index','get','isAuthenticated','show','/:id/configurations','getConfigurations','post','addConfiguration','put','/:id','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x36ec7b,_0x24d7f2){var _0x26d823=function(_0x2a411b){while(--_0x2a411b){_0x36ec7b['push'](_0x36ec7b['shift']());}};_0x26d823(++_0x24d7f2);}(_0x4e53,0x9b));var _0x34e5=function(_0x59f7b8,_0xb2ac21){_0x59f7b8=_0x59f7b8-0x0;var _0x7b28c5=_0x4e53[_0x59f7b8];return _0x7b28c5;};'use strict';var multer=require('multer');var util=require(_0x34e5('0x0'));var path=require(_0x34e5('0x1'));var timeout=require('connect-timeout');var express=require(_0x34e5('0x2'));var router=express[_0x34e5('0x3')]();var fs_extra=require(_0x34e5('0x4'));var auth=require(_0x34e5('0x5'));var interaction=require(_0x34e5('0x6'));var config=require(_0x34e5('0x7'));var controller=require(_0x34e5('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x34e5('0x9')]);router[_0x34e5('0xa')]('/:id',auth[_0x34e5('0xb')](),controller[_0x34e5('0xc')]);router[_0x34e5('0xa')](_0x34e5('0xd'),auth[_0x34e5('0xb')](),controller[_0x34e5('0xe')]);router[_0x34e5('0xa')]('/:id/fields',auth[_0x34e5('0xb')](),controller['getFields']);router[_0x34e5('0xf')]('/',auth[_0x34e5('0xb')](),controller['create']);router[_0x34e5('0xf')](_0x34e5('0xd'),auth[_0x34e5('0xb')](),controller[_0x34e5('0x10')]);router[_0x34e5('0x11')](_0x34e5('0x12'),auth[_0x34e5('0xb')](),controller[_0x34e5('0x13')]);router[_0x34e5('0x14')](_0x34e5('0x12'),auth[_0x34e5('0xb')](),controller[_0x34e5('0x15')]);module[_0x34e5('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 9cf3806..e0d103d 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 _0xd64b=['STRING','sequelize'];(function(_0x1af575,_0x56cc06){var _0x1f2c36=function(_0x420c2e){while(--_0x420c2e){_0x1af575['push'](_0x1af575['shift']());}};_0x1f2c36(++_0x56cc06);}(_0xd64b,0xc1));var _0xbd64=function(_0x42880f,_0x4425a5){_0x42880f=_0x42880f-0x0;var _0x14054c=_0xd64b[_0x42880f];return _0x14054c;};'use strict';var Sequelize=require(_0xbd64('0x0'));module['exports']={'name':{'type':Sequelize[_0xbd64('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xbd64('0x1')]},'zone':{'type':Sequelize[_0xbd64('0x1')]},'clientId':{'type':Sequelize[_0xbd64('0x1')]},'clientSecret':{'type':Sequelize[_0xbd64('0x1')]},'serverUrl':{'type':Sequelize[_0xbd64('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf109=['exports','STRING','sequelize'];(function(_0x4ea2c7,_0x160b9d){var _0x44a24f=function(_0x19686e){while(--_0x19686e){_0x4ea2c7['push'](_0x4ea2c7['shift']());}};_0x44a24f(++_0x160b9d);}(_0xf109,0xce));var _0x9f10=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xf109[_0x2d2c16];return _0x53f2fb;};'use strict';var Sequelize=require(_0x9f10('0x0'));module[_0x9f10('0x1')]={'name':{'type':Sequelize[_0x9f10('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x9f10('0x2')]},'clientSecret':{'type':Sequelize[_0x9f10('0x2')]},'serverUrl':{'type':Sequelize[_0x9f10('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x9f10('0x2')]},'refreshToken':{'type':Sequelize[_0x9f10('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 93b8c0b..debaa49 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 _0x663a=['rows','catch','params','rawAttributes','fields','length','includeAll','include','find','create','body','getConfigurations','pick','filter','addConfiguration','AccountId','getSubjects','channel','getDescriptions','ZohoConfiguration','ZohoField','Descriptions','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','code','zoho.eu','com','serverUrl','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','Zoho-oauthtoken\x20','response','Owner','Description','WhoId','Call_Type','includes','api_name','system_mandatory','push','custom_field','data_type','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','save','update','then','destroy','end','error','name','send','index','map','fieldName','type','model','keys','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','merge','options','ZohoAccount'];(function(_0x13c91a,_0x58fa37){var _0x17f2e4=function(_0x1660e0){while(--_0x1660e0){_0x13c91a['push'](_0x13c91a['shift']());}};_0x17f2e4(++_0x58fa37);}(_0x663a,0xb7));var _0xa663=function(_0x42fd33,_0x36c178){_0x42fd33=_0x42fd33-0x0;var _0x1493fb=_0x663a[_0x42fd33];return _0x1493fb;};'use strict';var emlformat=require(_0xa663('0x0'));var rimraf=require(_0xa663('0x1'));var zipdir=require(_0xa663('0x2'));var jsonpatch=require(_0xa663('0x3'));var rp=require(_0xa663('0x4'));var moment=require('moment');var BPromise=require(_0xa663('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xa663('0x6'));var csv=require(_0xa663('0x7'));var ejs=require(_0xa663('0x8'));var fs=require('fs');var fs_extra=require(_0xa663('0x9'));var _=require('lodash');var squel=require(_0xa663('0xa'));var crypto=require(_0xa663('0xb'));var jsforce=require(_0xa663('0xc'));var deskjs=require(_0xa663('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa663('0xe'));var Papa=require(_0xa663('0xf'));var Redis=require(_0xa663('0x10'));var authService=require(_0xa663('0x11'));var qs=require(_0xa663('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa663('0x13'));var logger=require(_0xa663('0x14'))(_0xa663('0x15'));var utils=require(_0xa663('0x16'));var config=require(_0xa663('0x17'));var licenseUtil=require(_0xa663('0x18'));var db=require(_0xa663('0x19'))['db'];var integrations=require(_0xa663('0x1a'));function respondWithStatusCode(_0x2acfc9,_0x334b3f){_0x334b3f=_0x334b3f||0xcc;return function(_0x7146fe){if(_0x7146fe){return _0x2acfc9[_0xa663('0x1b')](_0x334b3f);}return _0x2acfc9['status'](_0x334b3f)['end']();};}function respondWithResult(_0x54f10b,_0x2ae364){_0x2ae364=_0x2ae364||0xc8;return function(_0x41513d){if(_0x41513d){return _0x54f10b[_0xa663('0x1c')](_0x2ae364)[_0xa663('0x1d')](_0x41513d);}};}function respondWithFilteredResult(_0x3be18c,_0x1dcc9c){return function(_0x2035ea){if(_0x2035ea){var _0x37a445=typeof _0x1dcc9c[_0xa663('0x1e')]==='undefined'&&typeof _0x1dcc9c[_0xa663('0x1f')]===_0xa663('0x20');var _0x257953=_0x2035ea[_0xa663('0x21')];var _0x7e3b28=_0x37a445?0x0:_0x1dcc9c[_0xa663('0x1e')];var _0x3c488e=_0x37a445?_0x2035ea[_0xa663('0x21')]:_0x1dcc9c[_0xa663('0x1e')]+_0x1dcc9c['limit'];var _0x4be5fe;if(_0x3c488e>=_0x257953){_0x3c488e=_0x257953;_0x4be5fe=0xc8;}else{_0x4be5fe=0xce;}_0x3be18c[_0xa663('0x1c')](_0x4be5fe);return _0x3be18c[_0xa663('0x22')](_0xa663('0x23'),_0x7e3b28+'-'+_0x3c488e+'/'+_0x257953)[_0xa663('0x1d')](_0x2035ea);}return null;};}function patchUpdates(_0x3531b0){return function(_0x266e8c){try{jsonpatch['apply'](_0x266e8c,_0x3531b0,!![]);}catch(_0xa44d2a){return BPromise['reject'](_0xa44d2a);}return _0x266e8c[_0xa663('0x24')]();};}function saveUpdates(_0x339de1,_0x2c9059){return function(_0x536b34){if(_0x536b34){return _0x536b34[_0xa663('0x25')](_0x339de1)[_0xa663('0x26')](function(_0x57cf3c){return _0x57cf3c;});}return null;};}function removeEntity(_0x2b93d7,_0x35b4ed){return function(_0x35eff8){if(_0x35eff8){return _0x35eff8[_0xa663('0x27')]()[_0xa663('0x26')](function(){_0x2b93d7[_0xa663('0x1c')](0xcc)[_0xa663('0x28')]();});}};}function handleEntityNotFound(_0x16793a,_0x4c8c14){return function(_0x19d13a){if(!_0x19d13a){_0x16793a[_0xa663('0x1b')](0x194);}return _0x19d13a;};}function handleError(_0x5c184a,_0x915bd9){_0x915bd9=_0x915bd9||0x1f4;return function(_0x4179bc){logger[_0xa663('0x29')](_0x4179bc['stack']);if(_0x4179bc[_0xa663('0x2a')]){delete _0x4179bc['name'];}_0x5c184a['status'](_0x915bd9)[_0xa663('0x2b')](_0x4179bc);};}exports[_0xa663('0x2c')]=function(_0x472dbc,_0x21e208){var _0x2814e4={},_0x3a9f21={},_0x4f36c4={'count':0x0,'rows':[]};var _0x38db05=_[_0xa663('0x2d')](db['ZohoAccount']['rawAttributes'],function(_0x494b68){return{'name':_0x494b68[_0xa663('0x2e')],'type':_0x494b68[_0xa663('0x2f')]['key']};});_0x3a9f21[_0xa663('0x30')]=_[_0xa663('0x2d')](_0x38db05,_0xa663('0x2a'));_0x3a9f21['query']=_[_0xa663('0x31')](_0x472dbc[_0xa663('0x32')]);_0x3a9f21[_0xa663('0x33')]=_['intersection'](_0x3a9f21[_0xa663('0x30')],_0x3a9f21['query']);_0x2814e4['attributes']=_[_0xa663('0x34')](_0x3a9f21['model'],qs['fields'](_0x472dbc[_0xa663('0x32')]['fields']));_0x2814e4[_0xa663('0x35')]=_0x2814e4[_0xa663('0x35')]['length']?_0x2814e4[_0xa663('0x35')]:_0x3a9f21['model'];if(!_0x472dbc[_0xa663('0x32')][_0xa663('0x36')](_0xa663('0x37'))){_0x2814e4[_0xa663('0x1f')]=qs[_0xa663('0x1f')](_0x472dbc[_0xa663('0x32')][_0xa663('0x1f')]);_0x2814e4[_0xa663('0x1e')]=qs[_0xa663('0x1e')](_0x472dbc[_0xa663('0x32')][_0xa663('0x1e')]);}_0x2814e4[_0xa663('0x38')]=qs[_0xa663('0x39')](_0x472dbc['query'][_0xa663('0x39')]);_0x2814e4[_0xa663('0x3a')]=qs['filters'](_['pick'](_0x472dbc['query'],_0x3a9f21[_0xa663('0x33')]),_0x38db05);if(_0x472dbc[_0xa663('0x32')]['filter']){_0x2814e4[_0xa663('0x3a')]=_['merge'](_0x2814e4[_0xa663('0x3a')],{'$or':_['map'](_0x38db05,function(_0x2bc7d8){if(_0x2bc7d8[_0xa663('0x2f')]!==_0xa663('0x3b')){var _0x11098b={};_0x11098b[_0x2bc7d8[_0xa663('0x2a')]]={'$like':'%'+_0x472dbc[_0xa663('0x32')]['filter']+'%'};return _0x11098b;}})});}_0x2814e4=_[_0xa663('0x3c')]({},_0x2814e4,_0x472dbc[_0xa663('0x3d')]);var _0x4d0265={'where':_0x2814e4['where']};return db[_0xa663('0x3e')][_0xa663('0x21')](_0x4d0265)[_0xa663('0x26')](function(_0x47fd3c){_0x4f36c4[_0xa663('0x21')]=_0x47fd3c;if(_0x472dbc[_0xa663('0x32')]['includeAll']){_0x2814e4['include']=[{'all':!![]}];}return db[_0xa663('0x3e')]['findAll'](_0x2814e4);})[_0xa663('0x26')](function(_0x26fedb){_0x4f36c4[_0xa663('0x3f')]=_0x26fedb;return _0x4f36c4;})[_0xa663('0x26')](respondWithFilteredResult(_0x21e208,_0x2814e4))[_0xa663('0x40')](handleError(_0x21e208,null));};exports['show']=function(_0x4467eb,_0x45012e){var _0xba16f8={'raw':![],'where':{'id':_0x4467eb[_0xa663('0x41')]['id']}},_0x248cea={};_0x248cea['model']=_[_0xa663('0x31')](db[_0xa663('0x3e')][_0xa663('0x42')]);_0x248cea[_0xa663('0x32')]=_['keys'](_0x4467eb[_0xa663('0x32')]);_0x248cea[_0xa663('0x33')]=_['intersection'](_0x248cea[_0xa663('0x30')],_0x248cea[_0xa663('0x32')]);_0xba16f8['attributes']=_['intersection'](_0x248cea[_0xa663('0x30')],qs[_0xa663('0x43')](_0x4467eb[_0xa663('0x32')][_0xa663('0x43')]));_0xba16f8['attributes']=_0xba16f8[_0xa663('0x35')][_0xa663('0x44')]?_0xba16f8['attributes']:_0x248cea[_0xa663('0x30')];if(_0x4467eb[_0xa663('0x32')][_0xa663('0x45')]){_0xba16f8[_0xa663('0x46')]=[{'all':!![]}];}_0xba16f8=_[_0xa663('0x3c')]({},_0xba16f8,_0x4467eb[_0xa663('0x3d')]);return db[_0xa663('0x3e')][_0xa663('0x47')](_0xba16f8)['then'](handleEntityNotFound(_0x45012e,null))[_0xa663('0x26')](respondWithResult(_0x45012e,null))[_0xa663('0x40')](handleError(_0x45012e,null));};exports[_0xa663('0x48')]=function(_0x4156a5,_0x44d8c1){return db[_0xa663('0x3e')][_0xa663('0x48')](_0x4156a5[_0xa663('0x49')],{})[_0xa663('0x26')](respondWithResult(_0x44d8c1,0xc9))['catch'](handleError(_0x44d8c1,null));};exports[_0xa663('0x25')]=function(_0x1556fc,_0x3ca52a){if(_0x1556fc[_0xa663('0x49')]['id']){delete _0x1556fc[_0xa663('0x49')]['id'];}return db[_0xa663('0x3e')]['find']({'where':{'id':_0x1556fc[_0xa663('0x41')]['id']}})[_0xa663('0x26')](handleEntityNotFound(_0x3ca52a,null))['then'](saveUpdates(_0x1556fc['body'],null))[_0xa663('0x26')](respondWithResult(_0x3ca52a,null))['catch'](handleError(_0x3ca52a,null));};exports[_0xa663('0x27')]=function(_0x51955a,_0x554d79){return db[_0xa663('0x3e')][_0xa663('0x47')]({'where':{'id':_0x51955a['params']['id']}})[_0xa663('0x26')](handleEntityNotFound(_0x554d79,null))[_0xa663('0x26')](removeEntity(_0x554d79,null))['catch'](handleError(_0x554d79,null));};exports[_0xa663('0x4a')]=function(_0xf708d2,_0x31ef2f,_0x2acc30){var _0x1eda8d={};var _0x5b6076={};var _0x161e17;var _0x1bbc22;return db[_0xa663('0x3e')]['findOne']({'where':{'id':_0xf708d2[_0xa663('0x41')]['id']}})[_0xa663('0x26')](handleEntityNotFound(_0x31ef2f,null))['then'](function(_0xc61047){if(_0xc61047){_0x161e17=_0xc61047;_0x5b6076[_0xa663('0x30')]=_[_0xa663('0x31')](db['ZohoConfiguration'][_0xa663('0x42')]);_0x5b6076[_0xa663('0x32')]=_[_0xa663('0x31')](_0xf708d2[_0xa663('0x32')]);_0x5b6076[_0xa663('0x33')]=_[_0xa663('0x34')](_0x5b6076[_0xa663('0x30')],_0x5b6076['query']);_0x1eda8d[_0xa663('0x35')]=_['intersection'](_0x5b6076[_0xa663('0x30')],qs['fields'](_0xf708d2[_0xa663('0x32')]['fields']));_0x1eda8d['attributes']=_0x1eda8d[_0xa663('0x35')][_0xa663('0x44')]?_0x1eda8d[_0xa663('0x35')]:_0x5b6076[_0xa663('0x30')];_0x1eda8d[_0xa663('0x38')]=qs['sort'](_0xf708d2['query'][_0xa663('0x39')]);_0x1eda8d[_0xa663('0x3a')]=qs[_0xa663('0x33')](_[_0xa663('0x4b')](_0xf708d2[_0xa663('0x32')],_0x5b6076[_0xa663('0x33')]));if(_0xf708d2[_0xa663('0x32')][_0xa663('0x4c')]){_0x1eda8d[_0xa663('0x3a')]=_[_0xa663('0x3c')](_0x1eda8d[_0xa663('0x3a')],{'$or':_[_0xa663('0x2d')](_0x1eda8d[_0xa663('0x35')],function(_0x444c78){var _0xcffcbc={};_0xcffcbc[_0x444c78]={'$like':'%'+_0xf708d2[_0xa663('0x32')][_0xa663('0x4c')]+'%'};return _0xcffcbc;})});}_0x1eda8d=_[_0xa663('0x3c')]({},_0x1eda8d,_0xf708d2[_0xa663('0x3d')]);return _0x161e17[_0xa663('0x4a')](_0x1eda8d);}})[_0xa663('0x26')](function(_0x163546){if(_0x163546){_0x1bbc22=_0x163546[_0xa663('0x44')];if(!_0xf708d2[_0xa663('0x32')][_0xa663('0x36')]('nolimit')){_0x1eda8d['limit']=qs[_0xa663('0x1f')](_0xf708d2[_0xa663('0x32')][_0xa663('0x1f')]);_0x1eda8d[_0xa663('0x1e')]=qs[_0xa663('0x1e')](_0xf708d2[_0xa663('0x32')][_0xa663('0x1e')]);}return _0x161e17['getConfigurations'](_0x1eda8d);}})[_0xa663('0x26')](function(_0x39b806){if(_0x39b806){return _0x39b806?{'count':_0x1bbc22,'rows':_0x39b806}:null;}})[_0xa663('0x26')](respondWithResult(_0x31ef2f,null))[_0xa663('0x40')](handleError(_0x31ef2f,null));};exports[_0xa663('0x4d')]=function(_0x550211,_0x2a19db,_0x447249){if(_0x550211[_0xa663('0x49')]['id']){delete _0x550211['body']['id'];}return db[_0xa663('0x3e')]['findOne']({'where':{'id':_0x550211[_0xa663('0x41')]['id']}})[_0xa663('0x26')](handleEntityNotFound(_0x2a19db,null))['then'](function(_0x189ede){if(_0x189ede){_0x550211[_0xa663('0x49')][_0xa663('0x4e')]=_0x189ede['id'];_0x550211[_0xa663('0x49')]['Subjects']=integrations[_0xa663('0x4f')](_0x550211[_0xa663('0x49')][_0xa663('0x50')],_0x550211[_0xa663('0x49')][_0xa663('0x2f')]);_0x550211[_0xa663('0x49')]['Descriptions']=integrations[_0xa663('0x51')](_0x550211['body'][_0xa663('0x50')],_0x550211[_0xa663('0x49')]['type']);return db[_0xa663('0x52')][_0xa663('0x48')](_0x550211[_0xa663('0x49')],{'include':[{'model':db[_0xa663('0x53')],'as':'Subjects'},{'model':db[_0xa663('0x53')],'as':_0xa663('0x54')}]});}return null;})[_0xa663('0x26')](respondWithResult(_0x2a19db,null))[_0xa663('0x40')](handleError(_0x2a19db,null));};function getAccessToken(_0x3de73e){return new Promise(function(_0xba899e,_0x13ce2a){var _0x3c1142;switch(_0x3de73e['zone']){case'US':_0x3c1142='https://accounts.zoho.com';break;case'AU':_0x3c1142=_0xa663('0x55');break;case'EU':_0x3c1142=_0xa663('0x56');break;case'IN':_0x3c1142='https://accounts.zoho.in';break;case'CN':_0x3c1142='https://accounts.zoho.com.cn';break;default:_0x3c1142='https://accounts.zoho.eu';break;}var _0x5e7804={'method':_0xa663('0x57'),'uri':_0x3c1142+_0xa663('0x58'),'qs':{'refresh_token':_0x3de73e[_0xa663('0x59')],'client_id':_0x3de73e[_0xa663('0x5a')],'client_secret':_0x3de73e[_0xa663('0x5b')],'grant_type':_0xa663('0x5c')},'json':!![]};return rp(_0x5e7804)[_0xa663('0x26')](function(_0x41abae){if(_0x41abae[_0xa663('0x5d')]){_0xba899e(_0x41abae[_0xa663('0x5d')]);}else{_0x13ce2a(_0xa663('0x5e'));}})[_0xa663('0x40')](function(_0x3c424d){_0x13ce2a(_0x3c424d);});});}exports[_0xa663('0x5f')]=function(_0x13668a,_0xe225f2,_0x3252a8){var _0x2e8ce9,_0x9397e9,_0x31c81a,_0x285f08,_0x5922c8;return db[_0xa663('0x3e')]['findOne']({'where':{'id':_0x13668a[_0xa663('0x41')]['id']},'attributes':['id',_0xa663('0x60'),'zone',_0xa663('0x5a'),_0xa663('0x5b'),'serverUrl',_0xa663('0x61'),_0xa663('0x59')]})[_0xa663('0x26')](handleEntityNotFound(_0xe225f2,null))[_0xa663('0x26')](function(_0x3ddef9){_0x5922c8=_0x3ddef9;_0x2e8ce9=_0x5922c8[_0xa663('0x60')];_0x9397e9=_0x2e8ce9===_0xa663('0x62')?'eu':_0xa663('0x63');_0x31c81a=_0x5922c8[_0xa663('0x64')];var _0x2c205b=_0x31c81a['slice'](-0x1);if(_0x2c205b==='/'||_0x2c205b==='\x5c'||_0x2c205b===':'){_0x31c81a=_0x31c81a['substring'](0x0,_0x31c81a['lastIndexOf'](_0x2c205b));}if(!_0x5922c8[_0xa663('0x59')]){throw new Error(_0xa663('0x65'));}return getAccessToken(_0x5922c8);})['then'](function(_0x278d13){if(_0x278d13){return rp({'method':_0xa663('0x66'),'uri':util[_0xa663('0x67')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x9397e9),'qs':{'module':_0xa663('0x68')},'headers':{'Authorization':_0xa663('0x69')+_0x278d13},'json':!![]});}})[_0xa663('0x26')](function(_0x1a6a77){if(_0x1a6a77){if(_0x1a6a77[_0xa663('0x6a')]&&_0x1a6a77[_0xa663('0x6a')][_0xa663('0x29')]){throw new Error(_0x1a6a77[_0xa663('0x6a')][_0xa663('0x29')]['message']);}var _0xde859=[];var _0x49b9bc=[];var _0x251c74=[_0xa663('0x6b'),'Subject',_0xa663('0x6c'),_0xa663('0x6d'),'Call_Duration','Call_Result','Call_Start_Time',_0xa663('0x6e')];_0x49b9bc=_['remove'](_0x1a6a77[_0xa663('0x43')],function(_0x1f46ac){return _0x251c74[_0xa663('0x6f')](_0x1f46ac[_0xa663('0x70')]);});for(var _0x5798c2=0x0;_0x5798c2<_0x49b9bc['length'];_0x5798c2++){if(_0x49b9bc[_0x5798c2][_0xa663('0x71')]===![]){_0xde859[_0xa663('0x72')]({'id':_0x49b9bc[_0x5798c2]['id'],'name':_0x49b9bc[_0x5798c2]['display_label'],'custom':_0x49b9bc[_0x5798c2][_0xa663('0x73')],'options':_0x49b9bc[_0x5798c2][_0xa663('0x74')]==='picklist'&&_0x49b9bc[_0x5798c2]['pick_list_values'][_0xa663('0x44')]>-0x1?_[_0xa663('0x2d')](_0x49b9bc[_0x5798c2][_0xa663('0x75')],function(_0x483609){return{'name':_0x483609,'value':_0x483609};}):[]});}}return{'count':_0xde859['length'],'rows':_0xde859};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0xe225f2,null))[_0xa663('0x40')](function(_0x41a8e4){var _0x42ec1a=_0x13668a[_0xa663('0x32')]['test']?0x1f4:_0x41a8e4[_0xa663('0x76')]||0x1f4;logger[_0xa663('0x29')](_0xa663('0x77'),_0xa663('0x5f'),_0x42ec1a,JSON[_0xa663('0x78')](_0x41a8e4));delete _0x41a8e4[_0xa663('0x2a')];if(_0x42ec1a===0x191){_0x42ec1a=0x190;}_0xe225f2[_0xa663('0x1c')](_0x42ec1a)[_0xa663('0x2b')](_0x13668a[_0xa663('0x32')][_0xa663('0x79')]?{'message':_0xa663('0x7a'),'statusCode':_0x41a8e4[_0xa663('0x76')]}:_0x41a8e4);});}; \ No newline at end of file +var _0xca62=['Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','limit','undefined','offset','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','fieldName','type','key','map','query','keys','filters','attributes','model','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','ZohoAccount','count','includeAll','include','findAll','catch','show','rawAttributes','intersection','length','find','create','body','params','getConfigurations','ZohoConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','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','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','zone','serverUrl','code','zoho.eu','com','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject'];(function(_0x39214a,_0x9f2e45){var _0x50a460=function(_0x3b02cf){while(--_0x3b02cf){_0x39214a['push'](_0x39214a['shift']());}};_0x50a460(++_0x9f2e45);}(_0xca62,0x11e));var _0x2ca6=function(_0x3865c7,_0x27a236){_0x3865c7=_0x3865c7-0x0;var _0x140e62=_0xca62[_0x3865c7];return _0x140e62;};'use strict';var emlformat=require(_0x2ca6('0x0'));var rimraf=require(_0x2ca6('0x1'));var zipdir=require(_0x2ca6('0x2'));var jsonpatch=require(_0x2ca6('0x3'));var rp=require(_0x2ca6('0x4'));var moment=require('moment');var BPromise=require(_0x2ca6('0x5'));var Mustache=require('mustache');var util=require(_0x2ca6('0x6'));var path=require(_0x2ca6('0x7'));var sox=require(_0x2ca6('0x8'));var csv=require(_0x2ca6('0x9'));var ejs=require(_0x2ca6('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2ca6('0xb'));var crypto=require(_0x2ca6('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2ca6('0x9'));var querystring=require(_0x2ca6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2ca6('0xe'));var qs=require(_0x2ca6('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2ca6('0x10'));var logger=require(_0x2ca6('0x11'))(_0x2ca6('0x12'));var utils=require(_0x2ca6('0x13'));var config=require(_0x2ca6('0x14'));var licenseUtil=require(_0x2ca6('0x15'));var db=require(_0x2ca6('0x16'))['db'];var integrations=require(_0x2ca6('0x17'));function respondWithStatusCode(_0x19df2d,_0x4825b6){_0x4825b6=_0x4825b6||0xcc;return function(_0x35c284){if(_0x35c284){return _0x19df2d[_0x2ca6('0x18')](_0x4825b6);}return _0x19df2d[_0x2ca6('0x19')](_0x4825b6)[_0x2ca6('0x1a')]();};}function respondWithResult(_0x208e07,_0x15184b){_0x15184b=_0x15184b||0xc8;return function(_0x3bdc84){if(_0x3bdc84){return _0x208e07[_0x2ca6('0x19')](_0x15184b)[_0x2ca6('0x1b')](_0x3bdc84);}};}function respondWithFilteredResult(_0xef7e04,_0x359ed2){return function(_0x125c29){if(_0x125c29){var _0x2cd206=typeof _0x359ed2['offset']==='undefined'&&typeof _0x359ed2[_0x2ca6('0x1c')]===_0x2ca6('0x1d');var _0x1d8a7d=_0x125c29['count'];var _0x502d99=_0x2cd206?0x0:_0x359ed2['offset'];var _0x3fadd7=_0x2cd206?_0x125c29['count']:_0x359ed2[_0x2ca6('0x1e')]+_0x359ed2[_0x2ca6('0x1c')];var _0x251a9e;if(_0x3fadd7>=_0x1d8a7d){_0x3fadd7=_0x1d8a7d;_0x251a9e=0xc8;}else{_0x251a9e=0xce;}_0xef7e04[_0x2ca6('0x19')](_0x251a9e);return _0xef7e04[_0x2ca6('0x1f')](_0x2ca6('0x20'),_0x502d99+'-'+_0x3fadd7+'/'+_0x1d8a7d)['json'](_0x125c29);}return null;};}function patchUpdates(_0x4ed5c4){return function(_0xc4da34){try{jsonpatch[_0x2ca6('0x21')](_0xc4da34,_0x4ed5c4,!![]);}catch(_0xdaee0d){return BPromise[_0x2ca6('0x22')](_0xdaee0d);}return _0xc4da34[_0x2ca6('0x23')]();};}function saveUpdates(_0x213801,_0x4e9268){return function(_0x72b65f){if(_0x72b65f){return _0x72b65f['update'](_0x213801)[_0x2ca6('0x24')](function(_0x381fea){return _0x381fea;});}return null;};}function removeEntity(_0x4dab1b,_0x488891){return function(_0x36600c){if(_0x36600c){return _0x36600c[_0x2ca6('0x25')]()[_0x2ca6('0x24')](function(){_0x4dab1b[_0x2ca6('0x19')](0xcc)[_0x2ca6('0x1a')]();});}};}function handleEntityNotFound(_0x4fae40,_0x46b0ab){return function(_0x2a1a44){if(!_0x2a1a44){_0x4fae40['sendStatus'](0x194);}return _0x2a1a44;};}function handleError(_0x8123f6,_0x2c2917){_0x2c2917=_0x2c2917||0x1f4;return function(_0x10748e){logger[_0x2ca6('0x26')](_0x10748e['stack']);if(_0x10748e[_0x2ca6('0x27')]){delete _0x10748e[_0x2ca6('0x27')];}_0x8123f6[_0x2ca6('0x19')](_0x2c2917)[_0x2ca6('0x28')](_0x10748e);};}exports[_0x2ca6('0x29')]=function(_0x576369,_0x13298d){var _0x26f206={},_0xc0131a={},_0x36ae13={'count':0x0,'rows':[]};var _0x591075=_['map'](db['ZohoAccount']['rawAttributes'],function(_0x1b1f5b){return{'name':_0x1b1f5b[_0x2ca6('0x2a')],'type':_0x1b1f5b[_0x2ca6('0x2b')][_0x2ca6('0x2c')]};});_0xc0131a['model']=_[_0x2ca6('0x2d')](_0x591075,_0x2ca6('0x27'));_0xc0131a[_0x2ca6('0x2e')]=_[_0x2ca6('0x2f')](_0x576369['query']);_0xc0131a[_0x2ca6('0x30')]=_['intersection'](_0xc0131a['model'],_0xc0131a['query']);_0x26f206[_0x2ca6('0x31')]=_['intersection'](_0xc0131a[_0x2ca6('0x32')],qs[_0x2ca6('0x33')](_0x576369[_0x2ca6('0x2e')][_0x2ca6('0x33')]));_0x26f206[_0x2ca6('0x31')]=_0x26f206[_0x2ca6('0x31')]['length']?_0x26f206[_0x2ca6('0x31')]:_0xc0131a[_0x2ca6('0x32')];if(!_0x576369[_0x2ca6('0x2e')][_0x2ca6('0x34')](_0x2ca6('0x35'))){_0x26f206[_0x2ca6('0x1c')]=qs[_0x2ca6('0x1c')](_0x576369[_0x2ca6('0x2e')]['limit']);_0x26f206[_0x2ca6('0x1e')]=qs[_0x2ca6('0x1e')](_0x576369[_0x2ca6('0x2e')][_0x2ca6('0x1e')]);}_0x26f206[_0x2ca6('0x36')]=qs[_0x2ca6('0x37')](_0x576369[_0x2ca6('0x2e')][_0x2ca6('0x37')]);_0x26f206['where']=qs[_0x2ca6('0x30')](_[_0x2ca6('0x38')](_0x576369['query'],_0xc0131a[_0x2ca6('0x30')]),_0x591075);if(_0x576369[_0x2ca6('0x2e')][_0x2ca6('0x39')]){_0x26f206[_0x2ca6('0x3a')]=_[_0x2ca6('0x3b')](_0x26f206[_0x2ca6('0x3a')],{'$or':_['map'](_0x591075,function(_0x5b39db){if(_0x5b39db[_0x2ca6('0x2b')]!==_0x2ca6('0x3c')){var _0x356fd2={};_0x356fd2[_0x5b39db[_0x2ca6('0x27')]]={'$like':'%'+_0x576369['query'][_0x2ca6('0x39')]+'%'};return _0x356fd2;}})});}_0x26f206=_['merge']({},_0x26f206,_0x576369[_0x2ca6('0x3d')]);var _0x197b6={'where':_0x26f206[_0x2ca6('0x3a')]};return db[_0x2ca6('0x3e')][_0x2ca6('0x3f')](_0x197b6)[_0x2ca6('0x24')](function(_0x44dbc0){_0x36ae13[_0x2ca6('0x3f')]=_0x44dbc0;if(_0x576369['query'][_0x2ca6('0x40')]){_0x26f206[_0x2ca6('0x41')]=[{'all':!![]}];}return db[_0x2ca6('0x3e')][_0x2ca6('0x42')](_0x26f206);})[_0x2ca6('0x24')](function(_0x285b0e){_0x36ae13['rows']=_0x285b0e;return _0x36ae13;})[_0x2ca6('0x24')](respondWithFilteredResult(_0x13298d,_0x26f206))[_0x2ca6('0x43')](handleError(_0x13298d,null));};exports[_0x2ca6('0x44')]=function(_0x289a23,_0x29ec06){var _0x4291cc={'raw':![],'where':{'id':_0x289a23['params']['id']}},_0xaaf3ab={};_0xaaf3ab[_0x2ca6('0x32')]=_[_0x2ca6('0x2f')](db[_0x2ca6('0x3e')][_0x2ca6('0x45')]);_0xaaf3ab[_0x2ca6('0x2e')]=_[_0x2ca6('0x2f')](_0x289a23[_0x2ca6('0x2e')]);_0xaaf3ab[_0x2ca6('0x30')]=_[_0x2ca6('0x46')](_0xaaf3ab[_0x2ca6('0x32')],_0xaaf3ab[_0x2ca6('0x2e')]);_0x4291cc[_0x2ca6('0x31')]=_[_0x2ca6('0x46')](_0xaaf3ab['model'],qs['fields'](_0x289a23['query'][_0x2ca6('0x33')]));_0x4291cc['attributes']=_0x4291cc[_0x2ca6('0x31')][_0x2ca6('0x47')]?_0x4291cc[_0x2ca6('0x31')]:_0xaaf3ab[_0x2ca6('0x32')];if(_0x289a23['query'][_0x2ca6('0x40')]){_0x4291cc[_0x2ca6('0x41')]=[{'all':!![]}];}_0x4291cc=_['merge']({},_0x4291cc,_0x289a23[_0x2ca6('0x3d')]);return db[_0x2ca6('0x3e')][_0x2ca6('0x48')](_0x4291cc)[_0x2ca6('0x24')](handleEntityNotFound(_0x29ec06,null))[_0x2ca6('0x24')](respondWithResult(_0x29ec06,null))[_0x2ca6('0x43')](handleError(_0x29ec06,null));};exports[_0x2ca6('0x49')]=function(_0x2051b2,_0x587477){return db['ZohoAccount'][_0x2ca6('0x49')](_0x2051b2['body'],{})[_0x2ca6('0x24')](respondWithResult(_0x587477,0xc9))[_0x2ca6('0x43')](handleError(_0x587477,null));};exports['update']=function(_0x31c44d,_0x18c0ee){if(_0x31c44d[_0x2ca6('0x4a')]['id']){delete _0x31c44d[_0x2ca6('0x4a')]['id'];}return db['ZohoAccount'][_0x2ca6('0x48')]({'where':{'id':_0x31c44d[_0x2ca6('0x4b')]['id']}})[_0x2ca6('0x24')](handleEntityNotFound(_0x18c0ee,null))['then'](saveUpdates(_0x31c44d['body'],null))['then'](respondWithResult(_0x18c0ee,null))[_0x2ca6('0x43')](handleError(_0x18c0ee,null));};exports[_0x2ca6('0x25')]=function(_0x11bfd7,_0x583188){return db[_0x2ca6('0x3e')]['find']({'where':{'id':_0x11bfd7[_0x2ca6('0x4b')]['id']}})[_0x2ca6('0x24')](handleEntityNotFound(_0x583188,null))['then'](removeEntity(_0x583188,null))[_0x2ca6('0x43')](handleError(_0x583188,null));};exports[_0x2ca6('0x4c')]=function(_0x4a7094,_0xaba4e4,_0xf34970){var _0x12a412={};var _0x705811={};var _0x1a1c01;var _0x2edb69;return db[_0x2ca6('0x3e')]['findOne']({'where':{'id':_0x4a7094[_0x2ca6('0x4b')]['id']}})['then'](handleEntityNotFound(_0xaba4e4,null))[_0x2ca6('0x24')](function(_0x5c811a){if(_0x5c811a){_0x1a1c01=_0x5c811a;_0x705811['model']=_['keys'](db[_0x2ca6('0x4d')][_0x2ca6('0x45')]);_0x705811[_0x2ca6('0x2e')]=_[_0x2ca6('0x2f')](_0x4a7094[_0x2ca6('0x2e')]);_0x705811['filters']=_[_0x2ca6('0x46')](_0x705811['model'],_0x705811[_0x2ca6('0x2e')]);_0x12a412[_0x2ca6('0x31')]=_[_0x2ca6('0x46')](_0x705811['model'],qs[_0x2ca6('0x33')](_0x4a7094[_0x2ca6('0x2e')]['fields']));_0x12a412[_0x2ca6('0x31')]=_0x12a412['attributes']['length']?_0x12a412['attributes']:_0x705811[_0x2ca6('0x32')];_0x12a412['order']=qs['sort'](_0x4a7094['query']['sort']);_0x12a412[_0x2ca6('0x3a')]=qs[_0x2ca6('0x30')](_[_0x2ca6('0x38')](_0x4a7094[_0x2ca6('0x2e')],_0x705811[_0x2ca6('0x30')]));if(_0x4a7094['query'][_0x2ca6('0x39')]){_0x12a412[_0x2ca6('0x3a')]=_[_0x2ca6('0x3b')](_0x12a412[_0x2ca6('0x3a')],{'$or':_[_0x2ca6('0x2d')](_0x12a412['attributes'],function(_0x26016f){var _0x455639={};_0x455639[_0x26016f]={'$like':'%'+_0x4a7094[_0x2ca6('0x2e')][_0x2ca6('0x39')]+'%'};return _0x455639;})});}_0x12a412=_[_0x2ca6('0x3b')]({},_0x12a412,_0x4a7094[_0x2ca6('0x3d')]);return _0x1a1c01['getConfigurations'](_0x12a412);}})[_0x2ca6('0x24')](function(_0x5cd536){if(_0x5cd536){_0x2edb69=_0x5cd536[_0x2ca6('0x47')];if(!_0x4a7094[_0x2ca6('0x2e')][_0x2ca6('0x34')](_0x2ca6('0x35'))){_0x12a412['limit']=qs['limit'](_0x4a7094[_0x2ca6('0x2e')][_0x2ca6('0x1c')]);_0x12a412[_0x2ca6('0x1e')]=qs[_0x2ca6('0x1e')](_0x4a7094[_0x2ca6('0x2e')][_0x2ca6('0x1e')]);}return _0x1a1c01[_0x2ca6('0x4c')](_0x12a412);}})[_0x2ca6('0x24')](function(_0x115fdc){if(_0x115fdc){return _0x115fdc?{'count':_0x2edb69,'rows':_0x115fdc}:null;}})['then'](respondWithResult(_0xaba4e4,null))[_0x2ca6('0x43')](handleError(_0xaba4e4,null));};exports[_0x2ca6('0x4e')]=function(_0x1dfc69,_0x3edde0,_0x34feee){if(_0x1dfc69[_0x2ca6('0x4a')]['id']){delete _0x1dfc69[_0x2ca6('0x4a')]['id'];}return db['ZohoAccount'][_0x2ca6('0x4f')]({'where':{'id':_0x1dfc69['params']['id']}})['then'](handleEntityNotFound(_0x3edde0,null))[_0x2ca6('0x24')](function(_0x5ef823){if(_0x5ef823){_0x1dfc69[_0x2ca6('0x4a')][_0x2ca6('0x50')]=_0x5ef823['id'];_0x1dfc69[_0x2ca6('0x4a')][_0x2ca6('0x51')]=integrations[_0x2ca6('0x52')](_0x1dfc69['body'][_0x2ca6('0x53')],_0x1dfc69[_0x2ca6('0x4a')][_0x2ca6('0x2b')]);_0x1dfc69[_0x2ca6('0x4a')][_0x2ca6('0x54')]=integrations[_0x2ca6('0x55')](_0x1dfc69[_0x2ca6('0x4a')]['channel'],_0x1dfc69[_0x2ca6('0x4a')]['type']);return db[_0x2ca6('0x4d')][_0x2ca6('0x49')](_0x1dfc69[_0x2ca6('0x4a')],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db['ZohoField'],'as':_0x2ca6('0x54')}]});}return null;})['then'](respondWithResult(_0x3edde0,null))[_0x2ca6('0x43')](handleError(_0x3edde0,null));};function getAccessToken(_0x45a5c2){return new Promise(function(_0x3aa8a4,_0x4483e0){var _0x3742b7;switch(_0x45a5c2['zone']){case'US':_0x3742b7='https://accounts.zoho.com';break;case'AU':_0x3742b7=_0x2ca6('0x56');break;case'EU':_0x3742b7=_0x2ca6('0x57');break;case'IN':_0x3742b7=_0x2ca6('0x58');break;case'CN':_0x3742b7=_0x2ca6('0x59');break;default:_0x3742b7=_0x2ca6('0x57');break;}var _0x37acad={'method':_0x2ca6('0x5a'),'uri':_0x3742b7+_0x2ca6('0x5b'),'qs':{'refresh_token':_0x45a5c2[_0x2ca6('0x5c')],'client_id':_0x45a5c2[_0x2ca6('0x5d')],'client_secret':_0x45a5c2[_0x2ca6('0x5e')],'grant_type':_0x2ca6('0x5f')},'json':!![]};return rp(_0x37acad)[_0x2ca6('0x24')](function(_0x413ce2){if(_0x413ce2[_0x2ca6('0x60')]){_0x3aa8a4(_0x413ce2[_0x2ca6('0x60')]);}else{_0x4483e0(_0x2ca6('0x61'));}})['catch'](function(_0x1704d8){_0x4483e0(_0x1704d8);});});}exports[_0x2ca6('0x62')]=function(_0x3d2f3e,_0x2f1cd2,_0x211b36){var _0x56dd1e,_0x5f0ccc,_0x20a49e,_0x36c629,_0x15ebdd;return db[_0x2ca6('0x3e')]['findOne']({'where':{'id':_0x3d2f3e['params']['id']},'attributes':['id',_0x2ca6('0x63'),_0x2ca6('0x64'),_0x2ca6('0x5d'),_0x2ca6('0x5e'),_0x2ca6('0x65'),_0x2ca6('0x66'),_0x2ca6('0x5c')]})[_0x2ca6('0x24')](handleEntityNotFound(_0x2f1cd2,null))[_0x2ca6('0x24')](function(_0x260de0){_0x15ebdd=_0x260de0;_0x56dd1e=_0x15ebdd[_0x2ca6('0x63')];_0x5f0ccc=_0x56dd1e===_0x2ca6('0x67')?'eu':_0x2ca6('0x68');_0x20a49e=_0x15ebdd[_0x2ca6('0x65')];var _0x413466=_0x20a49e[_0x2ca6('0x69')](-0x1);if(_0x413466==='/'||_0x413466==='\x5c'||_0x413466===':'){_0x20a49e=_0x20a49e['substring'](0x0,_0x20a49e[_0x2ca6('0x6a')](_0x413466));}if(!_0x15ebdd[_0x2ca6('0x5c')]){throw new Error(_0x2ca6('0x6b'));}return getAccessToken(_0x15ebdd);})[_0x2ca6('0x24')](function(_0x481238){if(_0x481238){return rp({'method':'GET','uri':util[_0x2ca6('0x6c')](_0x2ca6('0x6d'),_0x5f0ccc),'qs':{'module':_0x2ca6('0x6e')},'headers':{'Authorization':_0x2ca6('0x6f')+_0x481238},'json':!![]});}})[_0x2ca6('0x24')](function(_0x2af511){if(_0x2af511){if(_0x2af511[_0x2ca6('0x70')]&&_0x2af511['response'][_0x2ca6('0x26')]){throw new Error(_0x2af511[_0x2ca6('0x70')][_0x2ca6('0x26')][_0x2ca6('0x71')]);}var _0x1e976e=[];var _0x3a6147=[];var _0x28f6ff=[_0x2ca6('0x72'),_0x2ca6('0x73'),_0x2ca6('0x74'),_0x2ca6('0x75'),_0x2ca6('0x76'),_0x2ca6('0x77'),_0x2ca6('0x78'),_0x2ca6('0x79')];_0x3a6147=_[_0x2ca6('0x7a')](_0x2af511[_0x2ca6('0x33')],function(_0x57722e){return _0x28f6ff[_0x2ca6('0x7b')](_0x57722e[_0x2ca6('0x7c')]);});for(var _0x1f2ed0=0x0;_0x1f2ed0<_0x3a6147[_0x2ca6('0x47')];_0x1f2ed0++){if(_0x3a6147[_0x1f2ed0]['system_mandatory']===![]){_0x1e976e['push']({'id':_0x3a6147[_0x1f2ed0]['id'],'name':_0x3a6147[_0x1f2ed0][_0x2ca6('0x7d')],'custom':_0x3a6147[_0x1f2ed0][_0x2ca6('0x7e')],'options':_0x3a6147[_0x1f2ed0][_0x2ca6('0x7f')]===_0x2ca6('0x80')&&_0x3a6147[_0x1f2ed0]['pick_list_values'][_0x2ca6('0x47')]>-0x1?_['map'](_0x3a6147[_0x1f2ed0][_0x2ca6('0x81')],function(_0x20637d){return{'name':_0x20637d,'value':_0x20637d};}):[]});}}return{'count':_0x1e976e[_0x2ca6('0x47')],'rows':_0x1e976e};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x2f1cd2,null))[_0x2ca6('0x43')](function(_0x19fd3e){var _0x3525bb=_0x3d2f3e['query'][_0x2ca6('0x82')]?0x1f4:_0x19fd3e[_0x2ca6('0x83')]||0x1f4;logger[_0x2ca6('0x26')](_0x2ca6('0x84'),'getFields',_0x3525bb,JSON[_0x2ca6('0x85')](_0x19fd3e));delete _0x19fd3e[_0x2ca6('0x27')];if(_0x3525bb===0x191){_0x3525bb=0x190;}_0x2f1cd2[_0x2ca6('0x19')](_0x3525bb)[_0x2ca6('0x28')](_0x3d2f3e['query'][_0x2ca6('0x82')]?{'message':'Wrong\x20credentials','statusCode':_0x19fd3e[_0x2ca6('0x83')]}:_0x19fd3e);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 8b22f0d..5b88191 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 _0x61b4=['lastIndexOf','https://accounts.zoho.com.cn','authorization_code','then','info','catch','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts','zone','changed','serverUrl','clientId','clientSecret','slice','substring','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','code','application/x-www-form-urlencoded','parse','refresh_token','refreshToken','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','error','host'];(function(_0x33eca6,_0x891651){var _0x1ada39=function(_0x31ab8c){while(--_0x31ab8c){_0x33eca6['push'](_0x33eca6['shift']());}};_0x1ada39(++_0x891651);}(_0x61b4,0x13a));var _0x461b=function(_0x46aabc,_0x1b0b24){_0x46aabc=_0x46aabc-0x0;var _0x10c273=_0x61b4[_0x46aabc];return _0x10c273;};'use strict';var _=require(_0x461b('0x0'));var util=require(_0x461b('0x1'));var logger=require(_0x461b('0x2'))(_0x461b('0x3'));var moment=require(_0x461b('0x4'));var BPromise=require(_0x461b('0x5'));var rp=require(_0x461b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x461b('0x7'));var attributes=require(_0x461b('0x8'));var integrations=require(_0x461b('0x9'));module['exports']=function(_0x573d11,_0x42ef64){return _0x573d11[_0x461b('0xa')](_0x461b('0xb'),attributes,{'tableName':_0x461b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3def51,_0x490e74,_0x4930b1){if(_0x3def51['changed'](_0x461b('0xd'))||_0x3def51[_0x461b('0xe')](_0x461b('0xf'))||_0x3def51['changed'](_0x461b('0x10'))||_0x3def51['changed'](_0x461b('0x11'))||_0x3def51[_0x461b('0xe')]('code')||_0x3def51[_0x461b('0xe')]('host')){var _0x35be0d,_0x1a5c1a;_0x35be0d=_0x3def51['serverUrl'];var _0x3b483a=_0x35be0d[_0x461b('0x12')](-0x1);if(_0x3b483a==='/'||_0x3b483a==='\x5c'||_0x3b483a===':'){_0x35be0d=_0x35be0d[_0x461b('0x13')](0x0,_0x35be0d['lastIndexOf'](_0x3b483a));}switch(_0x3def51[_0x461b('0xd')]){case'US':_0x1a5c1a=_0x461b('0x14');break;case'AU':_0x1a5c1a=_0x461b('0x15');break;case'IN':_0x1a5c1a=_0x461b('0x16');break;case'CN':_0x1a5c1a='https://accounts.zoho.com.cn';break;default:_0x1a5c1a=_0x461b('0x17');break;}var _0xd42901={'method':_0x461b('0x18'),'uri':_0x1a5c1a+_0x461b('0x19'),'form':{'grant_type':'authorization_code','client_id':_0x3def51[_0x461b('0x10')],'client_secret':_0x3def51['clientSecret'],'redirect_uri':_0x3def51[_0x461b('0xf')],'code':_0x3def51[_0x461b('0x1a')]},'headers':{'Content-Type':_0x461b('0x1b')}};return rp(_0xd42901)['then'](function(_0x530f49){var _0xfaab96=JSON[_0x461b('0x1c')](_0x530f49);if(_0xfaab96[_0x461b('0x1d')]){_0x3def51[_0x461b('0x1e')]=_0xfaab96[_0x461b('0x1d')];logger['info'](util[_0x461b('0x1f')](_0x461b('0x20'),_0x3def51['name'],_0x3def51['id']));}else{logger['error'](util[_0x461b('0x1f')](_0x461b('0x21'),_0x3def51[_0x461b('0x22')],_0x3def51['id']),util[_0x461b('0x23')](_0xfaab96,{'showHidden':![],'depth':null}));}return _0x4930b1(null,_0x490e74);})['catch'](function(_0x2aafe6){logger[_0x461b('0x24')](util['format'](_0x461b('0x21'),_0x3def51[_0x461b('0x22')],_0x3def51['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x4930b1(_0x2aafe6);});}else{return _0x4930b1(null,_0x490e74);}},'beforeUpdate':function(_0x4dcf6c,_0x529f69,_0x281f87){if(_0x4dcf6c[_0x461b('0xe')]('zone')||_0x4dcf6c[_0x461b('0xe')]('serverUrl')||_0x4dcf6c[_0x461b('0xe')](_0x461b('0x10'))||_0x4dcf6c[_0x461b('0xe')](_0x461b('0x11'))||_0x4dcf6c[_0x461b('0xe')](_0x461b('0x1a'))||_0x4dcf6c[_0x461b('0xe')](_0x461b('0x25'))){var _0x4a0282,_0x5e7fe8;_0x4a0282=_0x4dcf6c[_0x461b('0xf')];var _0x401ad1=_0x4a0282[_0x461b('0x12')](-0x1);if(_0x401ad1==='/'||_0x401ad1==='\x5c'||_0x401ad1===':'){_0x4a0282=_0x4a0282[_0x461b('0x13')](0x0,_0x4a0282[_0x461b('0x26')](_0x401ad1));}switch(_0x4dcf6c[_0x461b('0xd')]){case'US':_0x5e7fe8=_0x461b('0x14');break;case'AU':_0x5e7fe8=_0x461b('0x15');break;case'IN':_0x5e7fe8=_0x461b('0x16');break;case'CN':_0x5e7fe8=_0x461b('0x27');break;default:_0x5e7fe8=_0x461b('0x17');break;}var _0x39bec4={'method':_0x461b('0x18'),'uri':_0x5e7fe8+_0x461b('0x19'),'form':{'grant_type':_0x461b('0x28'),'client_id':_0x4dcf6c[_0x461b('0x10')],'client_secret':_0x4dcf6c[_0x461b('0x11')],'redirect_uri':_0x4dcf6c[_0x461b('0xf')],'code':_0x4dcf6c[_0x461b('0x1a')]},'headers':{'Content-Type':_0x461b('0x1b')}};return rp(_0x39bec4)[_0x461b('0x29')](function(_0x30e35c){var _0x4ff998=JSON['parse'](_0x30e35c);if(_0x4ff998['refresh_token']){_0x4dcf6c[_0x461b('0x1e')]=_0x4ff998[_0x461b('0x1d')];logger[_0x461b('0x2a')](util[_0x461b('0x1f')](_0x461b('0x20'),_0x4dcf6c['name'],_0x4dcf6c['id']));}else{logger[_0x461b('0x24')](util['format'](_0x461b('0x21'),_0x4dcf6c[_0x461b('0x22')],_0x4dcf6c['id']),util[_0x461b('0x23')](_0x4ff998,{'showHidden':![],'depth':null}));}return _0x281f87(null,_0x529f69);})[_0x461b('0x2b')](function(_0x1c4b41){logger[_0x461b('0x24')](util['format'](_0x461b('0x21'),_0x4dcf6c[_0x461b('0x22')],_0x4dcf6c['id']),util[_0x461b('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x281f87(_0x1c4b41);});}else{return _0x281f87(null,_0x529f69);}}}});}; \ No newline at end of file +var _0x06a1=['host','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','code','then','parse','refresh_token','refreshToken','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','name','slice','https://accounts.zoho.com','info','util','moment','bluebird','path','../../config/environment','./intZohoAccount.attributes','exports','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret'];(function(_0x1c816e,_0xbd3af5){var _0x2e0234=function(_0x138c41){while(--_0x138c41){_0x1c816e['push'](_0x1c816e['shift']());}};_0x2e0234(++_0xbd3af5);}(_0x06a1,0x195));var _0x106a=function(_0x47428d,_0x15ae59){_0x47428d=_0x47428d-0x0;var _0x314fbc=_0x06a1[_0x47428d];return _0x314fbc;};'use strict';var _=require('lodash');var util=require(_0x106a('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x106a('0x1'));var BPromise=require(_0x106a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x106a('0x3'));var rimraf=require('rimraf');var config=require(_0x106a('0x4'));var attributes=require(_0x106a('0x5'));var integrations=require('../../components/integrations/configuration');module[_0x106a('0x6')]=function(_0x3da445,_0x1fae0f){return _0x3da445['define']('ZohoAccount',attributes,{'tableName':_0x106a('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3cbe61,_0x490871,_0x307251){if(_0x3cbe61[_0x106a('0x8')](_0x106a('0x9'))||_0x3cbe61[_0x106a('0x8')](_0x106a('0xa'))||_0x3cbe61['changed'](_0x106a('0xb'))||_0x3cbe61['changed'](_0x106a('0xc'))||_0x3cbe61[_0x106a('0x8')]('code')||_0x3cbe61[_0x106a('0x8')](_0x106a('0xd'))){var _0x185f95,_0x32c1a1;_0x185f95=_0x3cbe61[_0x106a('0xa')];var _0xb84a3c=_0x185f95['slice'](-0x1);if(_0xb84a3c==='/'||_0xb84a3c==='\x5c'||_0xb84a3c===':'){_0x185f95=_0x185f95[_0x106a('0xe')](0x0,_0x185f95[_0x106a('0xf')](_0xb84a3c));}switch(_0x3cbe61[_0x106a('0x9')]){case'US':_0x32c1a1='https://accounts.zoho.com';break;case'AU':_0x32c1a1=_0x106a('0x10');break;case'IN':_0x32c1a1=_0x106a('0x11');break;case'CN':_0x32c1a1=_0x106a('0x12');break;default:_0x32c1a1=_0x106a('0x13');break;}var _0x58e4bc={'method':_0x106a('0x14'),'uri':_0x32c1a1+_0x106a('0x15'),'form':{'grant_type':_0x106a('0x16'),'client_id':_0x3cbe61[_0x106a('0xb')],'client_secret':_0x3cbe61[_0x106a('0xc')],'redirect_uri':_0x3cbe61['serverUrl'],'code':_0x3cbe61[_0x106a('0x17')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x58e4bc)[_0x106a('0x18')](function(_0x103294){var _0x1ed8ac=JSON[_0x106a('0x19')](_0x103294);if(_0x1ed8ac[_0x106a('0x1a')]){_0x3cbe61[_0x106a('0x1b')]=_0x1ed8ac[_0x106a('0x1a')];logger['info'](util[_0x106a('0x1c')](_0x106a('0x1d'),_0x3cbe61['name'],_0x3cbe61['id']));}else{logger[_0x106a('0x1e')](util['format'](_0x106a('0x1f'),_0x3cbe61['name'],_0x3cbe61['id']),util[_0x106a('0x20')](_0x1ed8ac,{'showHidden':![],'depth':null}));}return _0x307251(null,_0x490871);})[_0x106a('0x21')](function(_0x450ace){logger[_0x106a('0x1e')](util[_0x106a('0x1c')](_0x106a('0x1f'),_0x3cbe61[_0x106a('0x22')],_0x3cbe61['id']),util[_0x106a('0x20')](parsedResult,{'showHidden':![],'depth':null}));return _0x307251(_0x450ace);});}else{return _0x307251(null,_0x490871);}},'beforeUpdate':function(_0x7ebe22,_0x10e0d7,_0x3f162c){if(_0x7ebe22[_0x106a('0x8')](_0x106a('0x9'))||_0x7ebe22[_0x106a('0x8')](_0x106a('0xa'))||_0x7ebe22['changed'](_0x106a('0xb'))||_0x7ebe22[_0x106a('0x8')](_0x106a('0xc'))||_0x7ebe22['changed']('code')||_0x7ebe22[_0x106a('0x8')](_0x106a('0xd'))){var _0x297a0b,_0x26b04d;_0x297a0b=_0x7ebe22['serverUrl'];var _0x48df3b=_0x297a0b[_0x106a('0x23')](-0x1);if(_0x48df3b==='/'||_0x48df3b==='\x5c'||_0x48df3b===':'){_0x297a0b=_0x297a0b['substring'](0x0,_0x297a0b[_0x106a('0xf')](_0x48df3b));}switch(_0x7ebe22[_0x106a('0x9')]){case'US':_0x26b04d=_0x106a('0x24');break;case'AU':_0x26b04d=_0x106a('0x10');break;case'IN':_0x26b04d='https://accounts.zoho.in';break;case'CN':_0x26b04d=_0x106a('0x12');break;default:_0x26b04d=_0x106a('0x13');break;}var _0x42f698={'method':_0x106a('0x14'),'uri':_0x26b04d+_0x106a('0x15'),'form':{'grant_type':_0x106a('0x16'),'client_id':_0x7ebe22[_0x106a('0xb')],'client_secret':_0x7ebe22[_0x106a('0xc')],'redirect_uri':_0x7ebe22[_0x106a('0xa')],'code':_0x7ebe22[_0x106a('0x17')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x42f698)[_0x106a('0x18')](function(_0x4f871c){var _0xd5775a=JSON[_0x106a('0x19')](_0x4f871c);if(_0xd5775a[_0x106a('0x1a')]){_0x7ebe22[_0x106a('0x1b')]=_0xd5775a['refresh_token'];logger[_0x106a('0x25')](util['format'](_0x106a('0x1d'),_0x7ebe22[_0x106a('0x22')],_0x7ebe22['id']));}else{logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x7ebe22[_0x106a('0x22')],_0x7ebe22['id']),util[_0x106a('0x20')](_0xd5775a,{'showHidden':![],'depth':null}));}return _0x3f162c(null,_0x10e0d7);})[_0x106a('0x21')](function(_0x4e624a){logger['error'](util[_0x106a('0x1c')](_0x106a('0x1f'),_0x7ebe22['name'],_0x7ebe22['id']),util[_0x106a('0x20')](parsedResult,{'showHidden':![],'depth':null}));return _0x3f162c(_0x4e624a);});}else{return _0x3f162c(null,_0x10e0d7);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 72359b2..a58296a 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 _0xce14=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','findAll','raw','options','where','attributes','limit','include','map','model','then','GetZohoAccount','debug','catch','ShowZohoAccount','find','util','bluebird'];(function(_0x366bd8,_0x34c564){var _0x32f6f3=function(_0x163bc3){while(--_0x163bc3){_0x366bd8['push'](_0x366bd8['shift']());}};_0x32f6f3(++_0x34c564);}(_0xce14,0x17f));var _0x4ce1=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xce14[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x4ce1('0x0'));var moment=require('moment');var BPromise=require(_0x4ce1('0x1'));var rs=require(_0x4ce1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ce1('0x3'))['db'];var utils=require(_0x4ce1('0x4'));var logger=require(_0x4ce1('0x5'))(_0x4ce1('0x6'));var config=require(_0x4ce1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4ce1('0x8')][_0x4ce1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f603d,_0x2b9923,_0x539c1d){return new BPromise(function(_0x256648,_0x2beed4){return client[_0x4ce1('0xa')](_0x1f603d,_0x539c1d)['then'](function(_0x1b5bd8){logger[_0x4ce1('0xb')](_0x4ce1('0xc'),_0x2b9923,_0x4ce1('0xd'));logger['debug'](_0x4ce1('0xe'),_0x2b9923,_0x4ce1('0xd'),JSON[_0x4ce1('0xf')](_0x1b5bd8));if(_0x1b5bd8[_0x4ce1('0x10')]){if(_0x1b5bd8['error'][_0x4ce1('0x11')]===0x1f4){logger[_0x4ce1('0x10')](_0x4ce1('0xc'),_0x2b9923,_0x1b5bd8[_0x4ce1('0x10')][_0x4ce1('0x12')]);return _0x2beed4(_0x1b5bd8[_0x4ce1('0x10')][_0x4ce1('0x12')]);}logger[_0x4ce1('0x10')](_0x4ce1('0xc'),_0x2b9923,_0x1b5bd8[_0x4ce1('0x10')][_0x4ce1('0x12')]);return _0x256648(_0x1b5bd8['error'][_0x4ce1('0x12')]);}else{logger['info'](_0x4ce1('0xc'),_0x2b9923,_0x4ce1('0xd'));_0x256648(_0x1b5bd8[_0x4ce1('0x13')][_0x4ce1('0x12')]);}})['catch'](function(_0x221306){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x2b9923,_0x221306);_0x2beed4(_0x221306);});});}exports['GetZohoAccount']=function(_0xafda9e){var _0x34295c=this;return new Promise(function(_0x3105a9,_0x37efef){return db['ZohoAccount'][_0x4ce1('0x14')]({'raw':_0xafda9e['options']?_0xafda9e['options'][_0x4ce1('0x15')]===undefined?!![]:![]:!![],'where':_0xafda9e[_0x4ce1('0x16')]?_0xafda9e[_0x4ce1('0x16')][_0x4ce1('0x17')]||null:null,'attributes':_0xafda9e[_0x4ce1('0x16')]?_0xafda9e[_0x4ce1('0x16')][_0x4ce1('0x18')]||null:null,'limit':_0xafda9e[_0x4ce1('0x16')]?_0xafda9e['options'][_0x4ce1('0x19')]||null:null,'include':_0xafda9e[_0x4ce1('0x16')]?_0xafda9e['options'][_0x4ce1('0x1a')]?_[_0x4ce1('0x1b')](_0xafda9e['options'][_0x4ce1('0x1a')],function(_0x2da360){return{'model':db[_0x2da360['model']],'as':_0x2da360['as'],'attributes':_0x2da360['attributes'],'include':_0x2da360['include']?_[_0x4ce1('0x1b')](_0x2da360['include'],function(_0x41f6ed){return{'model':db[_0x41f6ed[_0x4ce1('0x1c')]],'as':_0x41f6ed['as'],'attributes':_0x41f6ed['attributes'],'include':_0x41f6ed[_0x4ce1('0x1a')]?_[_0x4ce1('0x1b')](_0x41f6ed[_0x4ce1('0x1a')],function(_0x7bca8c){return{'model':db[_0x7bca8c[_0x4ce1('0x1c')]],'as':_0x7bca8c['as'],'attributes':_0x7bca8c[_0x4ce1('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4ce1('0x1d')](function(_0x1d5c0b){logger[_0x4ce1('0xb')](_0x4ce1('0x1e'),_0xafda9e);logger[_0x4ce1('0x1f')](_0x4ce1('0x1e'),_0xafda9e,JSON[_0x4ce1('0xf')](_0x1d5c0b));_0x3105a9(_0x1d5c0b);})[_0x4ce1('0x20')](function(_0x1ceb1e){logger[_0x4ce1('0x10')](_0x4ce1('0x1e'),_0x1ceb1e[_0x4ce1('0x12')],_0xafda9e);_0x37efef(_0x34295c['error'](0x1f4,_0x1ceb1e[_0x4ce1('0x12')]));});});};exports[_0x4ce1('0x21')]=function(_0x3241ca){var _0x1ae95b=this;return new Promise(function(_0x28f1fb,_0xd0a77f){return db['ZohoAccount'][_0x4ce1('0x22')]({'raw':_0x3241ca[_0x4ce1('0x16')]?_0x3241ca[_0x4ce1('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x3241ca['options']?_0x3241ca[_0x4ce1('0x16')][_0x4ce1('0x17')]||null:null,'attributes':_0x3241ca[_0x4ce1('0x16')]?_0x3241ca[_0x4ce1('0x16')][_0x4ce1('0x18')]||null:null,'include':_0x3241ca[_0x4ce1('0x16')]?_0x3241ca['options']['include']?_[_0x4ce1('0x1b')](_0x3241ca[_0x4ce1('0x16')]['include'],function(_0xaf067c){return{'model':db[_0xaf067c[_0x4ce1('0x1c')]],'as':_0xaf067c['as'],'attributes':_0xaf067c[_0x4ce1('0x18')],'include':_0xaf067c[_0x4ce1('0x1a')]?_[_0x4ce1('0x1b')](_0xaf067c[_0x4ce1('0x1a')],function(_0x3099e1){return{'model':db[_0x3099e1[_0x4ce1('0x1c')]],'as':_0x3099e1['as'],'attributes':_0x3099e1[_0x4ce1('0x18')],'include':_0x3099e1[_0x4ce1('0x1a')]?_[_0x4ce1('0x1b')](_0x3099e1['include'],function(_0x2825ee){return{'model':db[_0x2825ee[_0x4ce1('0x1c')]],'as':_0x2825ee['as'],'attributes':_0x2825ee[_0x4ce1('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x53048d){logger[_0x4ce1('0xb')]('ShowZohoAccount',_0x3241ca);logger[_0x4ce1('0x1f')](_0x4ce1('0x21'),_0x3241ca,JSON[_0x4ce1('0xf')](_0x53048d));_0x28f1fb(_0x53048d);})[_0x4ce1('0x20')](function(_0x13321e){logger[_0x4ce1('0x10')](_0x4ce1('0x21'),_0x13321e['message'],_0x3241ca);_0xd0a77f(_0x1ae95b['error'](0x1f4,_0x13321e[_0x4ce1('0x12')]));});});}; \ No newline at end of file +var _0xfe39=['GetZohoAccount','findAll','options','where','attributes','limit','include','map','model','debug','stringify','ZohoAccount','find','raw','ShowZohoAccount','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch'];(function(_0x30de61,_0x10a9b7){var _0x266cf5=function(_0x192d00){while(--_0x192d00){_0x30de61['push'](_0x30de61['shift']());}};_0x266cf5(++_0x10a9b7);}(_0xfe39,0x1b3));var _0x9fe3=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xfe39[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x9fe3('0x0'));var util=require(_0x9fe3('0x1'));var moment=require('moment');var BPromise=require(_0x9fe3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9fe3('0x3'))['db'];var utils=require(_0x9fe3('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x9fe3('0x5'));var jayson=require(_0x9fe3('0x6'));var client=jayson[_0x9fe3('0x7')][_0x9fe3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xc469b7,_0x4183ce,_0x25868f){return new BPromise(function(_0x5a3bd6,_0x211eb2){return client[_0x9fe3('0x9')](_0xc469b7,_0x25868f)[_0x9fe3('0xa')](function(_0x35c391){logger[_0x9fe3('0xb')](_0x9fe3('0xc'),_0x4183ce,'request\x20sent');logger['debug'](_0x9fe3('0xd'),_0x4183ce,_0x9fe3('0xe'),JSON['stringify'](_0x35c391));if(_0x35c391[_0x9fe3('0xf')]){if(_0x35c391[_0x9fe3('0xf')][_0x9fe3('0x10')]===0x1f4){logger[_0x9fe3('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x4183ce,_0x35c391[_0x9fe3('0xf')][_0x9fe3('0x11')]);return _0x211eb2(_0x35c391[_0x9fe3('0xf')][_0x9fe3('0x11')]);}logger['error']('ZohoAccount,\x20%s,\x20%s',_0x4183ce,_0x35c391[_0x9fe3('0xf')][_0x9fe3('0x11')]);return _0x5a3bd6(_0x35c391[_0x9fe3('0xf')][_0x9fe3('0x11')]);}else{logger[_0x9fe3('0xb')]('ZohoAccount,\x20%s,\x20%s',_0x4183ce,'request\x20sent');_0x5a3bd6(_0x35c391[_0x9fe3('0x12')][_0x9fe3('0x11')]);}})[_0x9fe3('0x13')](function(_0x2d28d4){logger['error'](_0x9fe3('0xc'),_0x4183ce,_0x2d28d4);_0x211eb2(_0x2d28d4);});});}exports[_0x9fe3('0x14')]=function(_0x15fcaa){var _0x592b8b=this;return new Promise(function(_0x35bbaf,_0x43854c){return db['ZohoAccount'][_0x9fe3('0x15')]({'raw':_0x15fcaa['options']?_0x15fcaa[_0x9fe3('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x15fcaa[_0x9fe3('0x16')]?_0x15fcaa[_0x9fe3('0x16')][_0x9fe3('0x17')]||null:null,'attributes':_0x15fcaa['options']?_0x15fcaa['options'][_0x9fe3('0x18')]||null:null,'limit':_0x15fcaa[_0x9fe3('0x16')]?_0x15fcaa['options'][_0x9fe3('0x19')]||null:null,'include':_0x15fcaa[_0x9fe3('0x16')]?_0x15fcaa['options'][_0x9fe3('0x1a')]?_[_0x9fe3('0x1b')](_0x15fcaa['options'][_0x9fe3('0x1a')],function(_0x2fb7a9){return{'model':db[_0x2fb7a9[_0x9fe3('0x1c')]],'as':_0x2fb7a9['as'],'attributes':_0x2fb7a9[_0x9fe3('0x18')],'include':_0x2fb7a9[_0x9fe3('0x1a')]?_[_0x9fe3('0x1b')](_0x2fb7a9[_0x9fe3('0x1a')],function(_0x4c1a30){return{'model':db[_0x4c1a30[_0x9fe3('0x1c')]],'as':_0x4c1a30['as'],'attributes':_0x4c1a30[_0x9fe3('0x18')],'include':_0x4c1a30[_0x9fe3('0x1a')]?_[_0x9fe3('0x1b')](_0x4c1a30['include'],function(_0x1a4a43){return{'model':db[_0x1a4a43[_0x9fe3('0x1c')]],'as':_0x1a4a43['as'],'attributes':_0x1a4a43[_0x9fe3('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x14ee5b){logger[_0x9fe3('0xb')](_0x9fe3('0x14'),_0x15fcaa);logger[_0x9fe3('0x1d')](_0x9fe3('0x14'),_0x15fcaa,JSON[_0x9fe3('0x1e')](_0x14ee5b));_0x35bbaf(_0x14ee5b);})['catch'](function(_0xa4d56e){logger[_0x9fe3('0xf')](_0x9fe3('0x14'),_0xa4d56e[_0x9fe3('0x11')],_0x15fcaa);_0x43854c(_0x592b8b[_0x9fe3('0xf')](0x1f4,_0xa4d56e[_0x9fe3('0x11')]));});});};exports['ShowZohoAccount']=function(_0x40a778){var _0x298318=this;return new Promise(function(_0x5e1620,_0x2a388d){return db[_0x9fe3('0x1f')][_0x9fe3('0x20')]({'raw':_0x40a778[_0x9fe3('0x16')]?_0x40a778[_0x9fe3('0x16')][_0x9fe3('0x21')]===undefined?!![]:![]:!![],'where':_0x40a778['options']?_0x40a778[_0x9fe3('0x16')][_0x9fe3('0x17')]||null:null,'attributes':_0x40a778[_0x9fe3('0x16')]?_0x40a778['options']['attributes']||null:null,'include':_0x40a778['options']?_0x40a778[_0x9fe3('0x16')]['include']?_[_0x9fe3('0x1b')](_0x40a778[_0x9fe3('0x16')][_0x9fe3('0x1a')],function(_0xa3f363){return{'model':db[_0xa3f363[_0x9fe3('0x1c')]],'as':_0xa3f363['as'],'attributes':_0xa3f363[_0x9fe3('0x18')],'include':_0xa3f363[_0x9fe3('0x1a')]?_[_0x9fe3('0x1b')](_0xa3f363[_0x9fe3('0x1a')],function(_0x49f95f){return{'model':db[_0x49f95f[_0x9fe3('0x1c')]],'as':_0x49f95f['as'],'attributes':_0x49f95f['attributes'],'include':_0x49f95f['include']?_[_0x9fe3('0x1b')](_0x49f95f[_0x9fe3('0x1a')],function(_0x12ae18){return{'model':db[_0x12ae18[_0x9fe3('0x1c')]],'as':_0x12ae18['as'],'attributes':_0x12ae18['attributes']};}):[]};}):[]};}):[]:[]})[_0x9fe3('0xa')](function(_0xa7aaf5){logger[_0x9fe3('0xb')]('ShowZohoAccount',_0x40a778);logger[_0x9fe3('0x1d')](_0x9fe3('0x22'),_0x40a778,JSON[_0x9fe3('0x1e')](_0xa7aaf5));_0x5e1620(_0xa7aaf5);})[_0x9fe3('0x13')](function(_0x52b828){logger[_0x9fe3('0xf')](_0x9fe3('0x22'),_0x52b828['message'],_0x40a778);_0x2a388d(_0x298318['error'](0x1f4,_0x52b828[_0x9fe3('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 529f997..4bafcc9 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 _0xdc57=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','post','put','/:id','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x34fe71,_0x326466){var _0x8807c2=function(_0x5cdcda){while(--_0x5cdcda){_0x34fe71['push'](_0x34fe71['shift']());}};_0x8807c2(++_0x326466);}(_0xdc57,0x11c));var _0x7dc5=function(_0x4f64f7,_0x4bd9cf){_0x4f64f7=_0x4f64f7-0x0;var _0x521a34=_0xdc57[_0x4f64f7];return _0x521a34;};'use strict';var multer=require(_0x7dc5('0x0'));var util=require('util');var path=require(_0x7dc5('0x1'));var timeout=require(_0x7dc5('0x2'));var express=require(_0x7dc5('0x3'));var router=express[_0x7dc5('0x4')]();var fs_extra=require(_0x7dc5('0x5'));var auth=require(_0x7dc5('0x6'));var interaction=require(_0x7dc5('0x7'));var config=require(_0x7dc5('0x8'));var controller=require(_0x7dc5('0x9'));router[_0x7dc5('0xa')]('/',auth[_0x7dc5('0xb')](),controller[_0x7dc5('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x7dc5('0xd')]);router[_0x7dc5('0xa')](_0x7dc5('0xe'),auth[_0x7dc5('0xb')](),controller[_0x7dc5('0xf')]);router['get'](_0x7dc5('0x10'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x7dc5('0xa')](_0x7dc5('0x11'),auth[_0x7dc5('0xb')](),controller['getDescriptions']);router[_0x7dc5('0x12')]('/',auth[_0x7dc5('0xb')](),controller['create']);router[_0x7dc5('0x13')](_0x7dc5('0x14'),auth[_0x7dc5('0xb')](),controller[_0x7dc5('0x15')]);router['delete'](_0x7dc5('0x14'),auth[_0x7dc5('0xb')](),controller[_0x7dc5('0x16')]);module[_0x7dc5('0x17')]=router; \ No newline at end of file +var _0x938f=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','isAuthenticated','show','get','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x938f,0xec));var _0xf938=function(_0x4b4844,_0x2f0dfb){_0x4b4844=_0x4b4844-0x0;var _0x575192=_0x938f[_0x4b4844];return _0x575192;};'use strict';var multer=require(_0xf938('0x0'));var util=require(_0xf938('0x1'));var path=require(_0xf938('0x2'));var timeout=require(_0xf938('0x3'));var express=require(_0xf938('0x4'));var router=express[_0xf938('0x5')]();var fs_extra=require(_0xf938('0x6'));var auth=require(_0xf938('0x7'));var interaction=require(_0xf938('0x8'));var config=require(_0xf938('0x9'));var controller=require(_0xf938('0xa'));router['get']('/',auth[_0xf938('0xb')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xf938('0xc')]);router[_0xf938('0xd')](_0xf938('0xe'),auth['isAuthenticated'](),controller[_0xf938('0xf')]);router[_0xf938('0xd')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xf938('0x10')]);router[_0xf938('0xd')](_0xf938('0x11'),auth[_0xf938('0xb')](),controller[_0xf938('0x12')]);router[_0xf938('0x13')]('/',auth[_0xf938('0xb')](),controller[_0xf938('0x14')]);router[_0xf938('0x15')](_0xf938('0x16'),auth[_0xf938('0xb')](),controller[_0xf938('0x17')]);router[_0xf938('0x18')](_0xf938('0x16'),auth[_0xf938('0xb')](),controller[_0xf938('0x19')]);module[_0xf938('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index e1c34fb..604fd51 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 _0x5989=['exports','ENUM','lead','nothing','contact_lead','STRING','sequelize'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0x5989,0xa0));var _0x9598=function(_0x22dae4,_0x51d7a4){_0x22dae4=_0x22dae4-0x0;var _0x5862ff=_0x5989[_0x22dae4];return _0x5862ff;};'use strict';var Sequelize=require(_0x9598('0x0'));module[_0x9598('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x9598('0x2')](_0x9598('0x3'),'contact',_0x9598('0x4')),'defaultValue':_0x9598('0x3')},'moduleSearch':{'type':Sequelize[_0x9598('0x2')](_0x9598('0x5'),'contact',_0x9598('0x3')),'defaultValue':_0x9598('0x5')},'description':{'type':Sequelize[_0x9598('0x6')]}}; \ No newline at end of file +var _0x5deb=['contact_lead','STRING','sequelize','exports','ENUM','contact','nothing','lead'];(function(_0x2bf5bd,_0x120787){var _0xc810c0=function(_0xba9dd3){while(--_0xba9dd3){_0x2bf5bd['push'](_0x2bf5bd['shift']());}};_0xc810c0(++_0x120787);}(_0x5deb,0x82));var _0xb5de=function(_0x3ea61c,_0x42150f){_0x3ea61c=_0x3ea61c-0x0;var _0x5a9497=_0x5deb[_0x3ea61c];return _0x5a9497;};'use strict';var Sequelize=require(_0xb5de('0x0'));module[_0xb5de('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0xb5de('0x2')]('lead',_0xb5de('0x3'),_0xb5de('0x4')),'defaultValue':_0xb5de('0x5')},'moduleSearch':{'type':Sequelize[_0xb5de('0x2')](_0xb5de('0x6'),'contact',_0xb5de('0x5')),'defaultValue':_0xb5de('0x6')},'description':{'type':Sequelize[_0xb5de('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 4ee3972..ba14881 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 _0xfd4e=['type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','options','include','findAll','rows','catch','show','params','create','body','find','ZohoField','getFields','getSubjects','getDescriptions','findOne','eml-format','rimraf','zip-dir','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','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','limit','status','set','apply','reject','save','update','then','destroy','stack','name','index','map','ZohoConfiguration','rawAttributes','fieldName'];(function(_0x256859,_0x599dd6){var _0x172fb3=function(_0x5284dc){while(--_0x5284dc){_0x256859['push'](_0x256859['shift']());}};_0x172fb3(++_0x599dd6);}(_0xfd4e,0x1f4));var _0xefd4=function(_0x1c3314,_0x58c88e){_0x1c3314=_0x1c3314-0x0;var _0x3e24f4=_0xfd4e[_0x1c3314];return _0x3e24f4;};'use strict';var emlformat=require(_0xefd4('0x0'));var rimraf=require(_0xefd4('0x1'));var zipdir=require(_0xefd4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xefd4('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xefd4('0x4'));var path=require(_0xefd4('0x5'));var sox=require(_0xefd4('0x6'));var csv=require(_0xefd4('0x7'));var ejs=require(_0xefd4('0x8'));var fs=require('fs');var fs_extra=require(_0xefd4('0x9'));var _=require(_0xefd4('0xa'));var squel=require('squel');var crypto=require(_0xefd4('0xb'));var jsforce=require(_0xefd4('0xc'));var deskjs=require(_0xefd4('0xd'));var toCsv=require(_0xefd4('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xefd4('0xe'));var authService=require(_0xefd4('0xf'));var qs=require(_0xefd4('0x10'));var as=require(_0xefd4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xefd4('0x12'))(_0xefd4('0x13'));var utils=require(_0xefd4('0x14'));var config=require(_0xefd4('0x15'));var licenseUtil=require(_0xefd4('0x16'));var db=require(_0xefd4('0x17'))['db'];function respondWithStatusCode(_0x18a23e,_0x34a59e){_0x34a59e=_0x34a59e||0xcc;return function(_0x42b746){if(_0x42b746){return _0x18a23e[_0xefd4('0x18')](_0x34a59e);}return _0x18a23e['status'](_0x34a59e)[_0xefd4('0x19')]();};}function respondWithResult(_0x43d562,_0x145fe4){_0x145fe4=_0x145fe4||0xc8;return function(_0x3af67c){if(_0x3af67c){return _0x43d562['status'](_0x145fe4)[_0xefd4('0x1a')](_0x3af67c);}};}function respondWithFilteredResult(_0x28497e,_0x11d961){return function(_0x6ce4cc){if(_0x6ce4cc){var _0x14b3fa=typeof _0x11d961[_0xefd4('0x1b')]===_0xefd4('0x1c')&&typeof _0x11d961['limit']==='undefined';var _0x3063df=_0x6ce4cc[_0xefd4('0x1d')];var _0x1de030=_0x14b3fa?0x0:_0x11d961[_0xefd4('0x1b')];var _0x547739=_0x14b3fa?_0x6ce4cc['count']:_0x11d961[_0xefd4('0x1b')]+_0x11d961[_0xefd4('0x1e')];var _0x2138f2;if(_0x547739>=_0x3063df){_0x547739=_0x3063df;_0x2138f2=0xc8;}else{_0x2138f2=0xce;}_0x28497e[_0xefd4('0x1f')](_0x2138f2);return _0x28497e[_0xefd4('0x20')]('Content-Range',_0x1de030+'-'+_0x547739+'/'+_0x3063df)[_0xefd4('0x1a')](_0x6ce4cc);}return null;};}function patchUpdates(_0x3a133c){return function(_0x1fe5d6){try{jsonpatch[_0xefd4('0x21')](_0x1fe5d6,_0x3a133c,!![]);}catch(_0x4e9789){return BPromise[_0xefd4('0x22')](_0x4e9789);}return _0x1fe5d6[_0xefd4('0x23')]();};}function saveUpdates(_0x515b1e,_0x8c2bcd){return function(_0xaf558a){if(_0xaf558a){return _0xaf558a[_0xefd4('0x24')](_0x515b1e)[_0xefd4('0x25')](function(_0xaa6451){return _0xaa6451;});}return null;};}function removeEntity(_0x244331,_0x358105){return function(_0x5a20de){if(_0x5a20de){return _0x5a20de[_0xefd4('0x26')]()[_0xefd4('0x25')](function(){_0x244331[_0xefd4('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12df6b,_0x3d6dfd){return function(_0x3545c7){if(!_0x3545c7){_0x12df6b[_0xefd4('0x18')](0x194);}return _0x3545c7;};}function handleError(_0x507ca2,_0x5daa5d){_0x5daa5d=_0x5daa5d||0x1f4;return function(_0x205f80){logger['error'](_0x205f80[_0xefd4('0x27')]);if(_0x205f80['name']){delete _0x205f80[_0xefd4('0x28')];}_0x507ca2[_0xefd4('0x1f')](_0x5daa5d)['send'](_0x205f80);};}exports[_0xefd4('0x29')]=function(_0x3e006d,_0x3b6494){var _0x2e8c74={},_0x4dcab={},_0x2f1fe7={'count':0x0,'rows':[]};var _0x2e8b10=_[_0xefd4('0x2a')](db[_0xefd4('0x2b')][_0xefd4('0x2c')],function(_0x531358){return{'name':_0x531358[_0xefd4('0x2d')],'type':_0x531358[_0xefd4('0x2e')][_0xefd4('0x2f')]};});_0x4dcab[_0xefd4('0x30')]=_['map'](_0x2e8b10,_0xefd4('0x28'));_0x4dcab[_0xefd4('0x31')]=_[_0xefd4('0x32')](_0x3e006d[_0xefd4('0x31')]);_0x4dcab[_0xefd4('0x33')]=_[_0xefd4('0x34')](_0x4dcab['model'],_0x4dcab[_0xefd4('0x31')]);_0x2e8c74[_0xefd4('0x35')]=_['intersection'](_0x4dcab['model'],qs[_0xefd4('0x36')](_0x3e006d[_0xefd4('0x31')][_0xefd4('0x36')]));_0x2e8c74[_0xefd4('0x35')]=_0x2e8c74[_0xefd4('0x35')][_0xefd4('0x37')]?_0x2e8c74['attributes']:_0x4dcab[_0xefd4('0x30')];if(!_0x3e006d[_0xefd4('0x31')][_0xefd4('0x38')](_0xefd4('0x39'))){_0x2e8c74['limit']=qs[_0xefd4('0x1e')](_0x3e006d['query']['limit']);_0x2e8c74[_0xefd4('0x1b')]=qs['offset'](_0x3e006d[_0xefd4('0x31')]['offset']);}_0x2e8c74['order']=qs[_0xefd4('0x3a')](_0x3e006d[_0xefd4('0x31')][_0xefd4('0x3a')]);_0x2e8c74['where']=qs[_0xefd4('0x33')](_[_0xefd4('0x3b')](_0x3e006d[_0xefd4('0x31')],_0x4dcab[_0xefd4('0x33')]),_0x2e8b10);if(_0x3e006d[_0xefd4('0x31')][_0xefd4('0x3c')]){_0x2e8c74['where']=_[_0xefd4('0x3d')](_0x2e8c74[_0xefd4('0x3e')],{'$or':_[_0xefd4('0x2a')](_0x2e8b10,function(_0x3ba167){if(_0x3ba167[_0xefd4('0x2e')]!=='VIRTUAL'){var _0x166da9={};_0x166da9[_0x3ba167[_0xefd4('0x28')]]={'$like':'%'+_0x3e006d[_0xefd4('0x31')][_0xefd4('0x3c')]+'%'};return _0x166da9;}})});}_0x2e8c74=_[_0xefd4('0x3d')]({},_0x2e8c74,_0x3e006d[_0xefd4('0x3f')]);var _0x565c19={'where':_0x2e8c74[_0xefd4('0x3e')]};return db[_0xefd4('0x2b')][_0xefd4('0x1d')](_0x565c19)[_0xefd4('0x25')](function(_0x31cb78){_0x2f1fe7['count']=_0x31cb78;if(_0x3e006d[_0xefd4('0x31')]['includeAll']){_0x2e8c74[_0xefd4('0x40')]=[{'all':!![]}];}return db[_0xefd4('0x2b')][_0xefd4('0x41')](_0x2e8c74);})[_0xefd4('0x25')](function(_0x369d35){_0x2f1fe7[_0xefd4('0x42')]=_0x369d35;return _0x2f1fe7;})[_0xefd4('0x25')](respondWithFilteredResult(_0x3b6494,_0x2e8c74))[_0xefd4('0x43')](handleError(_0x3b6494,null));};exports[_0xefd4('0x44')]=function(_0x1b6b1b,_0x120689){var _0x284a0a={'raw':![],'where':{'id':_0x1b6b1b[_0xefd4('0x45')]['id']}},_0x52eb43={};_0x52eb43[_0xefd4('0x30')]=_[_0xefd4('0x32')](db['ZohoConfiguration'][_0xefd4('0x2c')]);_0x52eb43[_0xefd4('0x31')]=_[_0xefd4('0x32')](_0x1b6b1b[_0xefd4('0x31')]);_0x52eb43[_0xefd4('0x33')]=_['intersection'](_0x52eb43[_0xefd4('0x30')],_0x52eb43['query']);_0x284a0a[_0xefd4('0x35')]=_['intersection'](_0x52eb43[_0xefd4('0x30')],qs[_0xefd4('0x36')](_0x1b6b1b[_0xefd4('0x31')]['fields']));_0x284a0a[_0xefd4('0x35')]=_0x284a0a[_0xefd4('0x35')]['length']?_0x284a0a[_0xefd4('0x35')]:_0x52eb43[_0xefd4('0x30')];if(_0x1b6b1b[_0xefd4('0x31')]['includeAll']){_0x284a0a['include']=[{'all':!![]}];}_0x284a0a=_[_0xefd4('0x3d')]({},_0x284a0a,_0x1b6b1b['options']);return db[_0xefd4('0x2b')]['find'](_0x284a0a)[_0xefd4('0x25')](handleEntityNotFound(_0x120689,null))[_0xefd4('0x25')](respondWithResult(_0x120689,null))[_0xefd4('0x43')](handleError(_0x120689,null));};exports[_0xefd4('0x46')]=function(_0x56cffe,_0xf9dcb3){return db[_0xefd4('0x2b')][_0xefd4('0x46')](_0x56cffe[_0xefd4('0x47')],{})['then'](respondWithResult(_0xf9dcb3,0xc9))[_0xefd4('0x43')](handleError(_0xf9dcb3,null));};exports[_0xefd4('0x24')]=function(_0x2731f3,_0x1f3477){if(_0x2731f3[_0xefd4('0x47')]['id']){delete _0x2731f3[_0xefd4('0x47')]['id'];}return db['ZohoConfiguration'][_0xefd4('0x48')]({'where':{'id':_0x2731f3['params']['id']}})[_0xefd4('0x25')](handleEntityNotFound(_0x1f3477,null))[_0xefd4('0x25')](saveUpdates(_0x2731f3[_0xefd4('0x47')],null))[_0xefd4('0x25')](respondWithResult(_0x1f3477,null))[_0xefd4('0x43')](handleError(_0x1f3477,null));};exports[_0xefd4('0x26')]=function(_0x33e589,_0x3420e0){return db['ZohoConfiguration'][_0xefd4('0x48')]({'where':{'id':_0x33e589[_0xefd4('0x45')]['id']}})['then'](handleEntityNotFound(_0x3420e0,null))[_0xefd4('0x25')](removeEntity(_0x3420e0,null))[_0xefd4('0x43')](handleError(_0x3420e0,null));};exports['getFields']=function(_0x59469b,_0x17ac31,_0x19eb3d){var _0x37897d={};var _0x1427ab={};var _0x260dc3;var _0x81ff08;return db[_0xefd4('0x2b')]['findOne']({'where':{'id':_0x59469b[_0xefd4('0x45')]['id']}})[_0xefd4('0x25')](handleEntityNotFound(_0x17ac31,null))[_0xefd4('0x25')](function(_0x4b3085){if(_0x4b3085){_0x260dc3=_0x4b3085;_0x1427ab[_0xefd4('0x30')]=_[_0xefd4('0x32')](db[_0xefd4('0x49')][_0xefd4('0x2c')]);_0x1427ab[_0xefd4('0x31')]=_[_0xefd4('0x32')](_0x59469b[_0xefd4('0x31')]);_0x1427ab[_0xefd4('0x33')]=_[_0xefd4('0x34')](_0x1427ab[_0xefd4('0x30')],_0x1427ab['query']);_0x37897d[_0xefd4('0x35')]=_[_0xefd4('0x34')](_0x1427ab['model'],qs[_0xefd4('0x36')](_0x59469b[_0xefd4('0x31')][_0xefd4('0x36')]));_0x37897d[_0xefd4('0x35')]=_0x37897d[_0xefd4('0x35')]['length']?_0x37897d['attributes']:_0x1427ab[_0xefd4('0x30')];_0x37897d['order']=qs[_0xefd4('0x3a')](_0x59469b[_0xefd4('0x31')][_0xefd4('0x3a')]);_0x37897d[_0xefd4('0x3e')]=qs[_0xefd4('0x33')](_[_0xefd4('0x3b')](_0x59469b[_0xefd4('0x31')],_0x1427ab[_0xefd4('0x33')]));if(_0x59469b[_0xefd4('0x31')][_0xefd4('0x3c')]){_0x37897d[_0xefd4('0x3e')]=_[_0xefd4('0x3d')](_0x37897d['where'],{'$or':_[_0xefd4('0x2a')](_0x37897d['attributes'],function(_0x3082af){var _0x50a35c={};_0x50a35c[_0x3082af]={'$like':'%'+_0x59469b[_0xefd4('0x31')][_0xefd4('0x3c')]+'%'};return _0x50a35c;})});}_0x37897d=_[_0xefd4('0x3d')]({},_0x37897d,_0x59469b[_0xefd4('0x3f')]);return _0x260dc3['getFields'](_0x37897d);}})[_0xefd4('0x25')](function(_0x5bfe1){if(_0x5bfe1){_0x81ff08=_0x5bfe1[_0xefd4('0x37')];if(!_0x59469b[_0xefd4('0x31')][_0xefd4('0x38')](_0xefd4('0x39'))){_0x37897d[_0xefd4('0x1e')]=qs['limit'](_0x59469b[_0xefd4('0x31')][_0xefd4('0x1e')]);_0x37897d[_0xefd4('0x1b')]=qs[_0xefd4('0x1b')](_0x59469b[_0xefd4('0x31')][_0xefd4('0x1b')]);}return _0x260dc3[_0xefd4('0x4a')](_0x37897d);}})['then'](function(_0x2890d4){if(_0x2890d4){return _0x2890d4?{'count':_0x81ff08,'rows':_0x2890d4}:null;}})['then'](respondWithResult(_0x17ac31,null))[_0xefd4('0x43')](handleError(_0x17ac31,null));};exports[_0xefd4('0x4b')]=function(_0x14806c,_0x36826a,_0x55ffcd){var _0x1a06c2={};var _0x471acf={};var _0x55cf11;var _0xc6ab63;return db[_0xefd4('0x2b')]['findOne']({'where':{'id':_0x14806c[_0xefd4('0x45')]['id']}})[_0xefd4('0x25')](handleEntityNotFound(_0x36826a,null))[_0xefd4('0x25')](function(_0x2c9c6b){if(_0x2c9c6b){_0x55cf11=_0x2c9c6b;_0x471acf[_0xefd4('0x30')]=_[_0xefd4('0x32')](db[_0xefd4('0x49')][_0xefd4('0x2c')]);_0x471acf['query']=_[_0xefd4('0x32')](_0x14806c[_0xefd4('0x31')]);_0x471acf[_0xefd4('0x33')]=_['intersection'](_0x471acf[_0xefd4('0x30')],_0x471acf[_0xefd4('0x31')]);_0x1a06c2['attributes']=_[_0xefd4('0x34')](_0x471acf[_0xefd4('0x30')],qs[_0xefd4('0x36')](_0x14806c[_0xefd4('0x31')][_0xefd4('0x36')]));_0x1a06c2[_0xefd4('0x35')]=_0x1a06c2['attributes'][_0xefd4('0x37')]?_0x1a06c2[_0xefd4('0x35')]:_0x471acf[_0xefd4('0x30')];_0x1a06c2['order']=qs['sort'](_0x14806c['query']['sort']);_0x1a06c2['where']=qs[_0xefd4('0x33')](_[_0xefd4('0x3b')](_0x14806c[_0xefd4('0x31')],_0x471acf['filters']));if(_0x14806c[_0xefd4('0x31')][_0xefd4('0x3c')]){_0x1a06c2[_0xefd4('0x3e')]=_[_0xefd4('0x3d')](_0x1a06c2[_0xefd4('0x3e')],{'$or':_[_0xefd4('0x2a')](_0x1a06c2['attributes'],function(_0x1355c3){var _0xff6586={};_0xff6586[_0x1355c3]={'$like':'%'+_0x14806c[_0xefd4('0x31')][_0xefd4('0x3c')]+'%'};return _0xff6586;})});}_0x1a06c2=_['merge']({},_0x1a06c2,_0x14806c[_0xefd4('0x3f')]);return _0x55cf11[_0xefd4('0x4b')](_0x1a06c2);}})[_0xefd4('0x25')](function(_0xfc61d6){if(_0xfc61d6){_0xc6ab63=_0xfc61d6['length'];if(!_0x14806c[_0xefd4('0x31')][_0xefd4('0x38')](_0xefd4('0x39'))){_0x1a06c2['limit']=qs['limit'](_0x14806c[_0xefd4('0x31')][_0xefd4('0x1e')]);_0x1a06c2['offset']=qs['offset'](_0x14806c[_0xefd4('0x31')][_0xefd4('0x1b')]);}return _0x55cf11['getSubjects'](_0x1a06c2);}})[_0xefd4('0x25')](function(_0x2ba9ab){if(_0x2ba9ab){return _0x2ba9ab?{'count':_0xc6ab63,'rows':_0x2ba9ab}:null;}})['then'](respondWithResult(_0x36826a,null))[_0xefd4('0x43')](handleError(_0x36826a,null));};exports[_0xefd4('0x4c')]=function(_0x7a1ce0,_0x36c82a,_0x1f657a){var _0x1f7745={};var _0x372099={};var _0x185c45;var _0x90f406;return db[_0xefd4('0x2b')][_0xefd4('0x4d')]({'where':{'id':_0x7a1ce0[_0xefd4('0x45')]['id']}})[_0xefd4('0x25')](handleEntityNotFound(_0x36c82a,null))[_0xefd4('0x25')](function(_0x432e7b){if(_0x432e7b){_0x185c45=_0x432e7b;_0x372099[_0xefd4('0x30')]=_[_0xefd4('0x32')](db[_0xefd4('0x49')][_0xefd4('0x2c')]);_0x372099[_0xefd4('0x31')]=_[_0xefd4('0x32')](_0x7a1ce0[_0xefd4('0x31')]);_0x372099[_0xefd4('0x33')]=_[_0xefd4('0x34')](_0x372099[_0xefd4('0x30')],_0x372099[_0xefd4('0x31')]);_0x1f7745[_0xefd4('0x35')]=_[_0xefd4('0x34')](_0x372099[_0xefd4('0x30')],qs[_0xefd4('0x36')](_0x7a1ce0['query'][_0xefd4('0x36')]));_0x1f7745[_0xefd4('0x35')]=_0x1f7745[_0xefd4('0x35')]['length']?_0x1f7745[_0xefd4('0x35')]:_0x372099[_0xefd4('0x30')];_0x1f7745['order']=qs[_0xefd4('0x3a')](_0x7a1ce0[_0xefd4('0x31')][_0xefd4('0x3a')]);_0x1f7745[_0xefd4('0x3e')]=qs['filters'](_[_0xefd4('0x3b')](_0x7a1ce0[_0xefd4('0x31')],_0x372099[_0xefd4('0x33')]));if(_0x7a1ce0[_0xefd4('0x31')][_0xefd4('0x3c')]){_0x1f7745[_0xefd4('0x3e')]=_[_0xefd4('0x3d')](_0x1f7745[_0xefd4('0x3e')],{'$or':_[_0xefd4('0x2a')](_0x1f7745['attributes'],function(_0x19748d){var _0x28267d={};_0x28267d[_0x19748d]={'$like':'%'+_0x7a1ce0['query']['filter']+'%'};return _0x28267d;})});}_0x1f7745=_[_0xefd4('0x3d')]({},_0x1f7745,_0x7a1ce0[_0xefd4('0x3f')]);return _0x185c45[_0xefd4('0x4c')](_0x1f7745);}})[_0xefd4('0x25')](function(_0x4a37ec){if(_0x4a37ec){_0x90f406=_0x4a37ec['length'];if(!_0x7a1ce0[_0xefd4('0x31')][_0xefd4('0x38')](_0xefd4('0x39'))){_0x1f7745[_0xefd4('0x1e')]=qs[_0xefd4('0x1e')](_0x7a1ce0[_0xefd4('0x31')][_0xefd4('0x1e')]);_0x1f7745[_0xefd4('0x1b')]=qs[_0xefd4('0x1b')](_0x7a1ce0['query']['offset']);}return _0x185c45[_0xefd4('0x4c')](_0x1f7745);}})[_0xefd4('0x25')](function(_0x58f3d9){if(_0x58f3d9){return _0x58f3d9?{'count':_0x90f406,'rows':_0x58f3d9}:null;}})[_0xefd4('0x25')](respondWithResult(_0x36c82a,null))[_0xefd4('0x43')](handleError(_0x36c82a,null));}; \ No newline at end of file +var _0x4223=['querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','update','then','end','error','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','show','fields','includeAll','options','find','catch','create','body','params','destroy','findOne','ZohoField','length','getFields','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x4223,0x8b));var _0x3422=function(_0x4e1f8e,_0x4fd7a5){_0x4e1f8e=_0x4e1f8e-0x0;var _0x1e5417=_0x4223[_0x4e1f8e];return _0x1e5417;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3422('0x0'));var zipdir=require(_0x3422('0x1'));var jsonpatch=require(_0x3422('0x2'));var rp=require(_0x3422('0x3'));var moment=require(_0x3422('0x4'));var BPromise=require(_0x3422('0x5'));var Mustache=require('mustache');var util=require(_0x3422('0x6'));var path=require('path');var sox=require(_0x3422('0x7'));var csv=require('to-csv');var ejs=require(_0x3422('0x8'));var fs=require('fs');var fs_extra=require(_0x3422('0x9'));var _=require(_0x3422('0xa'));var squel=require('squel');var crypto=require(_0x3422('0xb'));var jsforce=require(_0x3422('0xc'));var deskjs=require(_0x3422('0xd'));var toCsv=require(_0x3422('0xe'));var querystring=require(_0x3422('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3422('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3422('0x11'));var logger=require(_0x3422('0x12'))('api');var utils=require(_0x3422('0x13'));var config=require(_0x3422('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x283a31,_0x2a5e56){_0x2a5e56=_0x2a5e56||0xcc;return function(_0x384f93){if(_0x384f93){return _0x283a31[_0x3422('0x15')](_0x2a5e56);}return _0x283a31[_0x3422('0x16')](_0x2a5e56)['end']();};}function respondWithResult(_0x31991f,_0x4bace2){_0x4bace2=_0x4bace2||0xc8;return function(_0x3aec0a){if(_0x3aec0a){return _0x31991f[_0x3422('0x16')](_0x4bace2)[_0x3422('0x17')](_0x3aec0a);}};}function respondWithFilteredResult(_0x4b2262,_0x3e2c75){return function(_0x253be5){if(_0x253be5){var _0x168fa5=typeof _0x3e2c75['offset']===_0x3422('0x18')&&typeof _0x3e2c75[_0x3422('0x19')]===_0x3422('0x18');var _0x161747=_0x253be5[_0x3422('0x1a')];var _0x31c846=_0x168fa5?0x0:_0x3e2c75[_0x3422('0x1b')];var _0x3c4a20=_0x168fa5?_0x253be5[_0x3422('0x1a')]:_0x3e2c75[_0x3422('0x1b')]+_0x3e2c75['limit'];var _0x142d47;if(_0x3c4a20>=_0x161747){_0x3c4a20=_0x161747;_0x142d47=0xc8;}else{_0x142d47=0xce;}_0x4b2262['status'](_0x142d47);return _0x4b2262[_0x3422('0x1c')](_0x3422('0x1d'),_0x31c846+'-'+_0x3c4a20+'/'+_0x161747)[_0x3422('0x17')](_0x253be5);}return null;};}function patchUpdates(_0xd22330){return function(_0x364d57){try{jsonpatch['apply'](_0x364d57,_0xd22330,!![]);}catch(_0x30bf49){return BPromise[_0x3422('0x1e')](_0x30bf49);}return _0x364d57['save']();};}function saveUpdates(_0x54e4a6,_0x37b0d5){return function(_0x1f9166){if(_0x1f9166){return _0x1f9166[_0x3422('0x1f')](_0x54e4a6)[_0x3422('0x20')](function(_0x373f9b){return _0x373f9b;});}return null;};}function removeEntity(_0x2d50bc,_0x3db023){return function(_0x366772){if(_0x366772){return _0x366772['destroy']()[_0x3422('0x20')](function(){_0x2d50bc['status'](0xcc)[_0x3422('0x21')]();});}};}function handleEntityNotFound(_0x3f78aa,_0x1f5fde){return function(_0x1081e2){if(!_0x1081e2){_0x3f78aa['sendStatus'](0x194);}return _0x1081e2;};}function handleError(_0x50135d,_0x302c34){_0x302c34=_0x302c34||0x1f4;return function(_0x283a77){logger[_0x3422('0x22')](_0x283a77['stack']);if(_0x283a77[_0x3422('0x23')]){delete _0x283a77[_0x3422('0x23')];}_0x50135d['status'](_0x302c34)[_0x3422('0x24')](_0x283a77);};}exports[_0x3422('0x25')]=function(_0x5ae385,_0x3f816c){var _0xb2e5ca={},_0xf9649b={},_0x52ebc9={'count':0x0,'rows':[]};var _0x26a5b3=_[_0x3422('0x26')](db[_0x3422('0x27')][_0x3422('0x28')],function(_0x10c022){return{'name':_0x10c022[_0x3422('0x29')],'type':_0x10c022[_0x3422('0x2a')]['key']};});_0xf9649b[_0x3422('0x2b')]=_[_0x3422('0x26')](_0x26a5b3,_0x3422('0x23'));_0xf9649b['query']=_[_0x3422('0x2c')](_0x5ae385[_0x3422('0x2d')]);_0xf9649b[_0x3422('0x2e')]=_[_0x3422('0x2f')](_0xf9649b['model'],_0xf9649b['query']);_0xb2e5ca['attributes']=_[_0x3422('0x2f')](_0xf9649b[_0x3422('0x2b')],qs['fields'](_0x5ae385[_0x3422('0x2d')]['fields']));_0xb2e5ca[_0x3422('0x30')]=_0xb2e5ca['attributes']['length']?_0xb2e5ca[_0x3422('0x30')]:_0xf9649b[_0x3422('0x2b')];if(!_0x5ae385[_0x3422('0x2d')][_0x3422('0x31')](_0x3422('0x32'))){_0xb2e5ca[_0x3422('0x19')]=qs[_0x3422('0x19')](_0x5ae385[_0x3422('0x2d')]['limit']);_0xb2e5ca[_0x3422('0x1b')]=qs[_0x3422('0x1b')](_0x5ae385[_0x3422('0x2d')][_0x3422('0x1b')]);}_0xb2e5ca[_0x3422('0x33')]=qs['sort'](_0x5ae385['query'][_0x3422('0x34')]);_0xb2e5ca[_0x3422('0x35')]=qs['filters'](_[_0x3422('0x36')](_0x5ae385[_0x3422('0x2d')],_0xf9649b['filters']),_0x26a5b3);if(_0x5ae385['query'][_0x3422('0x37')]){_0xb2e5ca[_0x3422('0x35')]=_[_0x3422('0x38')](_0xb2e5ca[_0x3422('0x35')],{'$or':_[_0x3422('0x26')](_0x26a5b3,function(_0x4c9f88){if(_0x4c9f88[_0x3422('0x2a')]!==_0x3422('0x39')){var _0x537588={};_0x537588[_0x4c9f88['name']]={'$like':'%'+_0x5ae385[_0x3422('0x2d')]['filter']+'%'};return _0x537588;}})});}_0xb2e5ca=_[_0x3422('0x38')]({},_0xb2e5ca,_0x5ae385['options']);var _0x27cf9c={'where':_0xb2e5ca['where']};return db[_0x3422('0x27')][_0x3422('0x1a')](_0x27cf9c)[_0x3422('0x20')](function(_0x15f99b){_0x52ebc9['count']=_0x15f99b;if(_0x5ae385['query']['includeAll']){_0xb2e5ca[_0x3422('0x3a')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0x3422('0x3b')](_0xb2e5ca);})[_0x3422('0x20')](function(_0x53aff0){_0x52ebc9[_0x3422('0x3c')]=_0x53aff0;return _0x52ebc9;})[_0x3422('0x20')](respondWithFilteredResult(_0x3f816c,_0xb2e5ca))['catch'](handleError(_0x3f816c,null));};exports[_0x3422('0x3d')]=function(_0x33910e,_0x407064){var _0x13d54d={'raw':![],'where':{'id':_0x33910e['params']['id']}},_0x5f2417={};_0x5f2417[_0x3422('0x2b')]=_[_0x3422('0x2c')](db[_0x3422('0x27')][_0x3422('0x28')]);_0x5f2417['query']=_[_0x3422('0x2c')](_0x33910e['query']);_0x5f2417[_0x3422('0x2e')]=_[_0x3422('0x2f')](_0x5f2417[_0x3422('0x2b')],_0x5f2417['query']);_0x13d54d[_0x3422('0x30')]=_['intersection'](_0x5f2417[_0x3422('0x2b')],qs['fields'](_0x33910e['query'][_0x3422('0x3e')]));_0x13d54d['attributes']=_0x13d54d[_0x3422('0x30')]['length']?_0x13d54d[_0x3422('0x30')]:_0x5f2417['model'];if(_0x33910e[_0x3422('0x2d')][_0x3422('0x3f')]){_0x13d54d[_0x3422('0x3a')]=[{'all':!![]}];}_0x13d54d=_[_0x3422('0x38')]({},_0x13d54d,_0x33910e[_0x3422('0x40')]);return db['ZohoConfiguration'][_0x3422('0x41')](_0x13d54d)[_0x3422('0x20')](handleEntityNotFound(_0x407064,null))[_0x3422('0x20')](respondWithResult(_0x407064,null))[_0x3422('0x42')](handleError(_0x407064,null));};exports[_0x3422('0x43')]=function(_0x157996,_0x3f4e25){return db['ZohoConfiguration'][_0x3422('0x43')](_0x157996[_0x3422('0x44')],{})[_0x3422('0x20')](respondWithResult(_0x3f4e25,0xc9))[_0x3422('0x42')](handleError(_0x3f4e25,null));};exports['update']=function(_0x5f434a,_0x10a8e2){if(_0x5f434a[_0x3422('0x44')]['id']){delete _0x5f434a[_0x3422('0x44')]['id'];}return db[_0x3422('0x27')][_0x3422('0x41')]({'where':{'id':_0x5f434a[_0x3422('0x45')]['id']}})['then'](handleEntityNotFound(_0x10a8e2,null))[_0x3422('0x20')](saveUpdates(_0x5f434a[_0x3422('0x44')],null))[_0x3422('0x20')](respondWithResult(_0x10a8e2,null))[_0x3422('0x42')](handleError(_0x10a8e2,null));};exports[_0x3422('0x46')]=function(_0x1a440b,_0x5ead60){return db[_0x3422('0x27')]['find']({'where':{'id':_0x1a440b[_0x3422('0x45')]['id']}})[_0x3422('0x20')](handleEntityNotFound(_0x5ead60,null))['then'](removeEntity(_0x5ead60,null))[_0x3422('0x42')](handleError(_0x5ead60,null));};exports['getFields']=function(_0x45fa7d,_0x57f78a,_0x29b67d){var _0x4e8bf8={};var _0x5e09e2={};var _0x25389e;var _0x2c1bad;return db[_0x3422('0x27')][_0x3422('0x47')]({'where':{'id':_0x45fa7d[_0x3422('0x45')]['id']}})['then'](handleEntityNotFound(_0x57f78a,null))['then'](function(_0x2e60c0){if(_0x2e60c0){_0x25389e=_0x2e60c0;_0x5e09e2[_0x3422('0x2b')]=_[_0x3422('0x2c')](db[_0x3422('0x48')][_0x3422('0x28')]);_0x5e09e2[_0x3422('0x2d')]=_['keys'](_0x45fa7d[_0x3422('0x2d')]);_0x5e09e2[_0x3422('0x2e')]=_[_0x3422('0x2f')](_0x5e09e2[_0x3422('0x2b')],_0x5e09e2[_0x3422('0x2d')]);_0x4e8bf8[_0x3422('0x30')]=_[_0x3422('0x2f')](_0x5e09e2[_0x3422('0x2b')],qs['fields'](_0x45fa7d[_0x3422('0x2d')][_0x3422('0x3e')]));_0x4e8bf8['attributes']=_0x4e8bf8[_0x3422('0x30')][_0x3422('0x49')]?_0x4e8bf8['attributes']:_0x5e09e2[_0x3422('0x2b')];_0x4e8bf8[_0x3422('0x33')]=qs['sort'](_0x45fa7d[_0x3422('0x2d')][_0x3422('0x34')]);_0x4e8bf8[_0x3422('0x35')]=qs[_0x3422('0x2e')](_[_0x3422('0x36')](_0x45fa7d[_0x3422('0x2d')],_0x5e09e2['filters']));if(_0x45fa7d['query'][_0x3422('0x37')]){_0x4e8bf8['where']=_['merge'](_0x4e8bf8[_0x3422('0x35')],{'$or':_['map'](_0x4e8bf8['attributes'],function(_0x548a85){var _0x456a14={};_0x456a14[_0x548a85]={'$like':'%'+_0x45fa7d[_0x3422('0x2d')][_0x3422('0x37')]+'%'};return _0x456a14;})});}_0x4e8bf8=_[_0x3422('0x38')]({},_0x4e8bf8,_0x45fa7d[_0x3422('0x40')]);return _0x25389e[_0x3422('0x4a')](_0x4e8bf8);}})[_0x3422('0x20')](function(_0x5a2c11){if(_0x5a2c11){_0x2c1bad=_0x5a2c11[_0x3422('0x49')];if(!_0x45fa7d[_0x3422('0x2d')][_0x3422('0x31')](_0x3422('0x32'))){_0x4e8bf8[_0x3422('0x19')]=qs[_0x3422('0x19')](_0x45fa7d[_0x3422('0x2d')][_0x3422('0x19')]);_0x4e8bf8['offset']=qs[_0x3422('0x1b')](_0x45fa7d[_0x3422('0x2d')][_0x3422('0x1b')]);}return _0x25389e[_0x3422('0x4a')](_0x4e8bf8);}})[_0x3422('0x20')](function(_0x42916c){if(_0x42916c){return _0x42916c?{'count':_0x2c1bad,'rows':_0x42916c}:null;}})['then'](respondWithResult(_0x57f78a,null))[_0x3422('0x42')](handleError(_0x57f78a,null));};exports[_0x3422('0x4b')]=function(_0x2fe825,_0x403af7,_0x1fd3a2){var _0x2f614c={};var _0x46b9b5={};var _0x580ce4;var _0x518b06;return db[_0x3422('0x27')][_0x3422('0x47')]({'where':{'id':_0x2fe825['params']['id']}})[_0x3422('0x20')](handleEntityNotFound(_0x403af7,null))[_0x3422('0x20')](function(_0x33e926){if(_0x33e926){_0x580ce4=_0x33e926;_0x46b9b5[_0x3422('0x2b')]=_[_0x3422('0x2c')](db['ZohoField'][_0x3422('0x28')]);_0x46b9b5[_0x3422('0x2d')]=_[_0x3422('0x2c')](_0x2fe825[_0x3422('0x2d')]);_0x46b9b5[_0x3422('0x2e')]=_[_0x3422('0x2f')](_0x46b9b5[_0x3422('0x2b')],_0x46b9b5['query']);_0x2f614c[_0x3422('0x30')]=_['intersection'](_0x46b9b5[_0x3422('0x2b')],qs[_0x3422('0x3e')](_0x2fe825[_0x3422('0x2d')][_0x3422('0x3e')]));_0x2f614c['attributes']=_0x2f614c[_0x3422('0x30')][_0x3422('0x49')]?_0x2f614c[_0x3422('0x30')]:_0x46b9b5[_0x3422('0x2b')];_0x2f614c[_0x3422('0x33')]=qs['sort'](_0x2fe825[_0x3422('0x2d')][_0x3422('0x34')]);_0x2f614c[_0x3422('0x35')]=qs[_0x3422('0x2e')](_[_0x3422('0x36')](_0x2fe825[_0x3422('0x2d')],_0x46b9b5[_0x3422('0x2e')]));if(_0x2fe825[_0x3422('0x2d')][_0x3422('0x37')]){_0x2f614c[_0x3422('0x35')]=_[_0x3422('0x38')](_0x2f614c[_0x3422('0x35')],{'$or':_[_0x3422('0x26')](_0x2f614c['attributes'],function(_0x50049c){var _0x4cce17={};_0x4cce17[_0x50049c]={'$like':'%'+_0x2fe825['query'][_0x3422('0x37')]+'%'};return _0x4cce17;})});}_0x2f614c=_[_0x3422('0x38')]({},_0x2f614c,_0x2fe825[_0x3422('0x40')]);return _0x580ce4['getSubjects'](_0x2f614c);}})[_0x3422('0x20')](function(_0x4583ed){if(_0x4583ed){_0x518b06=_0x4583ed[_0x3422('0x49')];if(!_0x2fe825['query'][_0x3422('0x31')](_0x3422('0x32'))){_0x2f614c['limit']=qs[_0x3422('0x19')](_0x2fe825['query'][_0x3422('0x19')]);_0x2f614c[_0x3422('0x1b')]=qs[_0x3422('0x1b')](_0x2fe825[_0x3422('0x2d')][_0x3422('0x1b')]);}return _0x580ce4[_0x3422('0x4b')](_0x2f614c);}})['then'](function(_0x59b98c){if(_0x59b98c){return _0x59b98c?{'count':_0x518b06,'rows':_0x59b98c}:null;}})['then'](respondWithResult(_0x403af7,null))['catch'](handleError(_0x403af7,null));};exports[_0x3422('0x4c')]=function(_0x30aa2e,_0x57564b,_0x5982fc){var _0x219028={};var _0x3a093d={};var _0x197ee3;var _0xc5b467;return db['ZohoConfiguration'][_0x3422('0x47')]({'where':{'id':_0x30aa2e[_0x3422('0x45')]['id']}})[_0x3422('0x20')](handleEntityNotFound(_0x57564b,null))[_0x3422('0x20')](function(_0x5cf16b){if(_0x5cf16b){_0x197ee3=_0x5cf16b;_0x3a093d[_0x3422('0x2b')]=_[_0x3422('0x2c')](db['ZohoField'][_0x3422('0x28')]);_0x3a093d[_0x3422('0x2d')]=_['keys'](_0x30aa2e[_0x3422('0x2d')]);_0x3a093d[_0x3422('0x2e')]=_[_0x3422('0x2f')](_0x3a093d[_0x3422('0x2b')],_0x3a093d[_0x3422('0x2d')]);_0x219028[_0x3422('0x30')]=_['intersection'](_0x3a093d[_0x3422('0x2b')],qs[_0x3422('0x3e')](_0x30aa2e[_0x3422('0x2d')][_0x3422('0x3e')]));_0x219028[_0x3422('0x30')]=_0x219028['attributes'][_0x3422('0x49')]?_0x219028['attributes']:_0x3a093d[_0x3422('0x2b')];_0x219028[_0x3422('0x33')]=qs[_0x3422('0x34')](_0x30aa2e[_0x3422('0x2d')][_0x3422('0x34')]);_0x219028[_0x3422('0x35')]=qs['filters'](_[_0x3422('0x36')](_0x30aa2e[_0x3422('0x2d')],_0x3a093d[_0x3422('0x2e')]));if(_0x30aa2e[_0x3422('0x2d')][_0x3422('0x37')]){_0x219028['where']=_[_0x3422('0x38')](_0x219028[_0x3422('0x35')],{'$or':_[_0x3422('0x26')](_0x219028['attributes'],function(_0x21953a){var _0x4ce41c={};_0x4ce41c[_0x21953a]={'$like':'%'+_0x30aa2e[_0x3422('0x2d')]['filter']+'%'};return _0x4ce41c;})});}_0x219028=_[_0x3422('0x38')]({},_0x219028,_0x30aa2e['options']);return _0x197ee3[_0x3422('0x4c')](_0x219028);}})[_0x3422('0x20')](function(_0x38c91d){if(_0x38c91d){_0xc5b467=_0x38c91d[_0x3422('0x49')];if(!_0x30aa2e[_0x3422('0x2d')]['hasOwnProperty'](_0x3422('0x32'))){_0x219028['limit']=qs[_0x3422('0x19')](_0x30aa2e[_0x3422('0x2d')][_0x3422('0x19')]);_0x219028[_0x3422('0x1b')]=qs['offset'](_0x30aa2e[_0x3422('0x2d')][_0x3422('0x1b')]);}return _0x197ee3[_0x3422('0x4c')](_0x219028);}})[_0x3422('0x20')](function(_0x4451c0){if(_0x4451c0){return _0x4451c0?{'count':_0xc5b467,'rows':_0x4451c0}:null;}})[_0x3422('0x20')](respondWithResult(_0x57564b,null))[_0x3422('0x42')](handleError(_0x57564b,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 9dc7c01..c4eee30 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 _0x147b=['define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intZohoConfiguration.attributes'];(function(_0x4b9115,_0x3f6938){var _0x29c46d=function(_0x493aa9){while(--_0x493aa9){_0x4b9115['push'](_0x4b9115['shift']());}};_0x29c46d(++_0x3f6938);}(_0x147b,0x10b));var _0xb147=function(_0x3312a3,_0x3f9cdb){_0x3312a3=_0x3312a3-0x0;var _0x262560=_0x147b[_0x3312a3];return _0x262560;};'use strict';var _=require(_0xb147('0x0'));var util=require(_0xb147('0x1'));var logger=require(_0xb147('0x2'))(_0xb147('0x3'));var moment=require(_0xb147('0x4'));var BPromise=require('bluebird');var rp=require(_0xb147('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb147('0x6'));var config=require(_0xb147('0x7'));var attributes=require(_0xb147('0x8'));module['exports']=function(_0x1f88af,_0x28376a){return _0x1f88af[_0xb147('0x9')](_0xb147('0xa'),attributes,{'tableName':_0xb147('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7be1=['../../config/logger','api','moment','bluebird','path','rimraf','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','lodash','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7be1,0x8e));var _0x17be=function(_0x58a0bb,_0x3464b8){_0x58a0bb=_0x58a0bb-0x0;var _0x1f1146=_0x7be1[_0x58a0bb];return _0x1f1146;};'use strict';var _=require(_0x17be('0x0'));var util=require(_0x17be('0x1'));var logger=require(_0x17be('0x2'))(_0x17be('0x3'));var moment=require(_0x17be('0x4'));var BPromise=require(_0x17be('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x17be('0x6'));var rimraf=require(_0x17be('0x7'));var config=require('../../config/environment');var attributes=require(_0x17be('0x8'));module[_0x17be('0x9')]=function(_0xc0b2d7,_0x3ddc40){return _0xc0b2d7[_0x17be('0xa')](_0x17be('0xb'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index a73d2fb..fdad27b 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 _0xf35e=['code','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x15ece6,_0x51a965){var _0x3dc05c=function(_0x43e0c1){while(--_0x43e0c1){_0x15ece6['push'](_0x15ece6['shift']());}};_0x3dc05c(++_0x51a965);}(_0xf35e,0x1cf));var _0xef35=function(_0x327cc0,_0x407ee7){_0x327cc0=_0x327cc0-0x0;var _0x3fe343=_0xf35e[_0x327cc0];return _0x3fe343;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xef35('0x0'));var BPromise=require(_0xef35('0x1'));var rs=require(_0xef35('0x2'));var fs=require('fs');var Redis=require(_0xef35('0x3'));var db=require(_0xef35('0x4'))['db'];var utils=require(_0xef35('0x5'));var logger=require(_0xef35('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xef35('0x7'));var client=jayson[_0xef35('0x8')][_0xef35('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4be8a3,_0x4d3fc2,_0x24ecee){return new BPromise(function(_0x50014c,_0x31b462){return client[_0xef35('0xa')](_0x4be8a3,_0x24ecee)['then'](function(_0x371d3c){logger[_0xef35('0xb')](_0xef35('0xc'),_0x4d3fc2,_0xef35('0xd'));logger['debug'](_0xef35('0xe'),_0x4d3fc2,'request\x20sent',JSON[_0xef35('0xf')](_0x371d3c));if(_0x371d3c['error']){if(_0x371d3c[_0xef35('0x10')][_0xef35('0x11')]===0x1f4){logger[_0xef35('0x10')](_0xef35('0xc'),_0x4d3fc2,_0x371d3c[_0xef35('0x10')][_0xef35('0x12')]);return _0x31b462(_0x371d3c[_0xef35('0x10')][_0xef35('0x12')]);}logger[_0xef35('0x10')](_0xef35('0xc'),_0x4d3fc2,_0x371d3c[_0xef35('0x10')][_0xef35('0x12')]);return _0x50014c(_0x371d3c[_0xef35('0x10')][_0xef35('0x12')]);}else{logger[_0xef35('0xb')](_0xef35('0xc'),_0x4d3fc2,_0xef35('0xd'));_0x50014c(_0x371d3c[_0xef35('0x13')][_0xef35('0x12')]);}})['catch'](function(_0x27a084){logger[_0xef35('0x10')](_0xef35('0xc'),_0x4d3fc2,_0x27a084);_0x31b462(_0x27a084);});});} \ No newline at end of file +var _0xfa31=['http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x14bed3,_0xa2ff48){var _0x363a1d=function(_0x4c64ca){while(--_0x4c64ca){_0x14bed3['push'](_0x14bed3['shift']());}};_0x363a1d(++_0xa2ff48);}(_0xfa31,0x124));var _0x1fa3=function(_0x4c70a1,_0x38d5a0){_0x4c70a1=_0x4c70a1-0x0;var _0x58091d=_0xfa31[_0x4c70a1];return _0x58091d;};'use strict';var _=require(_0x1fa3('0x0'));var util=require(_0x1fa3('0x1'));var moment=require(_0x1fa3('0x2'));var BPromise=require('bluebird');var rs=require(_0x1fa3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1fa3('0x4'));var logger=require(_0x1fa3('0x5'))('rpc');var config=require(_0x1fa3('0x6'));var jayson=require(_0x1fa3('0x7'));var client=jayson['client'][_0x1fa3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x28e657,_0x5dadba,_0x501bca){return new BPromise(function(_0x24fdf9,_0x2cc5a1){return client[_0x1fa3('0x9')](_0x28e657,_0x501bca)[_0x1fa3('0xa')](function(_0x59c722){logger[_0x1fa3('0xb')](_0x1fa3('0xc'),_0x5dadba,_0x1fa3('0xd'));logger['debug'](_0x1fa3('0xe'),_0x5dadba,_0x1fa3('0xd'),JSON['stringify'](_0x59c722));if(_0x59c722[_0x1fa3('0xf')]){if(_0x59c722['error'][_0x1fa3('0x10')]===0x1f4){logger[_0x1fa3('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x5dadba,_0x59c722[_0x1fa3('0xf')][_0x1fa3('0x11')]);return _0x2cc5a1(_0x59c722['error'][_0x1fa3('0x11')]);}logger['error'](_0x1fa3('0xc'),_0x5dadba,_0x59c722[_0x1fa3('0xf')][_0x1fa3('0x11')]);return _0x24fdf9(_0x59c722[_0x1fa3('0xf')]['message']);}else{logger[_0x1fa3('0xb')](_0x1fa3('0xc'),_0x5dadba,_0x1fa3('0xd'));_0x24fdf9(_0x59c722[_0x1fa3('0x12')]['message']);}})[_0x1fa3('0x13')](function(_0x55a143){logger[_0x1fa3('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x5dadba,_0x55a143);_0x2cc5a1(_0x55a143);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index bca00d5..32d68c2 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 _0x8134=['isAuthenticated','show','post','create','put','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id'];(function(_0x717e65,_0x5c7caa){var _0x3b7f95=function(_0x587c5c){while(--_0x587c5c){_0x717e65['push'](_0x717e65['shift']());}};_0x3b7f95(++_0x5c7caa);}(_0x8134,0xf6));var _0x4813=function(_0x4b4c20,_0x44f51a){_0x4b4c20=_0x4b4c20-0x0;var _0x544117=_0x8134[_0x4b4c20];return _0x544117;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4813('0x0'));var timeout=require(_0x4813('0x1'));var express=require(_0x4813('0x2'));var router=express[_0x4813('0x3')]();var fs_extra=require(_0x4813('0x4'));var auth=require(_0x4813('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4813('0x6'));var controller=require('./intZohoField.controller');router[_0x4813('0x7')]('/',auth['isAuthenticated'](),controller[_0x4813('0x8')]);router[_0x4813('0x7')](_0x4813('0x9'),auth[_0x4813('0xa')](),controller[_0x4813('0xb')]);router[_0x4813('0xc')]('/',auth['isAuthenticated'](),controller[_0x4813('0xd')]);router[_0x4813('0xe')](_0x4813('0x9'),auth[_0x4813('0xa')](),controller['update']);router['delete'](_0x4813('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x4813('0xf')]=router; \ No newline at end of file +var _0x997a=['destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./intZohoField.controller','get','isAuthenticated','index','show','post','create','put','/:id','update'];(function(_0x4af0af,_0x5e16ae){var _0x139516=function(_0x313f54){while(--_0x313f54){_0x4af0af['push'](_0x4af0af['shift']());}};_0x139516(++_0x5e16ae);}(_0x997a,0x1e8));var _0xa997=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x997a[_0x21a9d9];return _0x46adce;};'use strict';var multer=require('multer');var util=require(_0xa997('0x0'));var path=require(_0xa997('0x1'));var timeout=require(_0xa997('0x2'));var express=require('express');var router=express[_0xa997('0x3')]();var fs_extra=require(_0xa997('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa997('0x5'));var config=require('../../config/environment');var controller=require(_0xa997('0x6'));router[_0xa997('0x7')]('/',auth[_0xa997('0x8')](),controller[_0xa997('0x9')]);router[_0xa997('0x7')]('/:id',auth[_0xa997('0x8')](),controller[_0xa997('0xa')]);router[_0xa997('0xb')]('/',auth[_0xa997('0x8')](),controller[_0xa997('0xc')]);router[_0xa997('0xd')](_0xa997('0xe'),auth[_0xa997('0x8')](),controller[_0xa997('0xf')]);router['delete'](_0xa997('0xe'),auth[_0xa997('0x8')](),controller[_0xa997('0x10')]);module[_0xa997('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 f954bc6..1bc4ecb 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 _0x1d4e=['exports','string','variable','keyValue','picklist','STRING','ENUM','customVariable','BOOLEAN'];(function(_0xcf307e,_0x2d7211){var _0x46f1a9=function(_0x19f338){while(--_0x19f338){_0xcf307e['push'](_0xcf307e['shift']());}};_0x46f1a9(++_0x2d7211);}(_0x1d4e,0x90));var _0xe1d4=function(_0x562164,_0x4dcfea){_0x562164=_0x562164-0x0;var _0x3dee44=_0x1d4e[_0x562164];return _0x3dee44;};'use strict';var Sequelize=require('sequelize');module[_0xe1d4('0x0')]={'type':{'type':Sequelize['ENUM'](_0xe1d4('0x1'),_0xe1d4('0x2'),'customVariable',_0xe1d4('0x3'),_0xe1d4('0x4')),'defaultValue':_0xe1d4('0x1')},'content':{'type':Sequelize[_0xe1d4('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xe1d4('0x6')](_0xe1d4('0x1'),'variable',_0xe1d4('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xe1d4('0x5')]},'nameField':{'type':Sequelize[_0xe1d4('0x5')]},'customField':{'type':Sequelize[_0xe1d4('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe1d4('0x5')]}}; \ No newline at end of file +var _0x313c=['keyValue','picklist','STRING','ENUM','BOOLEAN','exports','string','variable','customVariable'];(function(_0x2fd9a1,_0x38c5e8){var _0x44f219=function(_0x5acd77){while(--_0x5acd77){_0x2fd9a1['push'](_0x2fd9a1['shift']());}};_0x44f219(++_0x38c5e8);}(_0x313c,0x1b5));var _0xc313=function(_0x4f7b6a,_0x2d3458){_0x4f7b6a=_0x4f7b6a-0x0;var _0x17ee6b=_0x313c[_0x4f7b6a];return _0x17ee6b;};'use strict';var Sequelize=require('sequelize');module[_0xc313('0x0')]={'type':{'type':Sequelize['ENUM'](_0xc313('0x1'),_0xc313('0x2'),_0xc313('0x3'),_0xc313('0x4'),_0xc313('0x5')),'defaultValue':_0xc313('0x1')},'content':{'type':Sequelize[_0xc313('0x6')]},'key':{'type':Sequelize[_0xc313('0x6')]},'keyType':{'type':Sequelize[_0xc313('0x7')](_0xc313('0x1'),_0xc313('0x2'),_0xc313('0x3'))},'keyContent':{'type':Sequelize[_0xc313('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xc313('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 8d4ab5e..2ca3c14 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 _0xb69c=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','VIRTUAL','options','ZohoField','includeAll','include','show','params','merge','find','create','body','catch','destroy','eml-format','zip-dir','request-promise','moment','mustache','util','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0xb69c,0x1a6));var _0xcb69=function(_0x35c281,_0x2d02bb){_0x35c281=_0x35c281-0x0;var _0x57913f=_0xb69c[_0x35c281];return _0x57913f;};'use strict';var emlformat=require(_0xcb69('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcb69('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcb69('0x2'));var moment=require(_0xcb69('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcb69('0x4'));var util=require(_0xcb69('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xcb69('0x6'));var ejs=require(_0xcb69('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcb69('0x8'));var squel=require(_0xcb69('0x9'));var crypto=require(_0xcb69('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xcb69('0xb'));var toCsv=require(_0xcb69('0x6'));var querystring=require(_0xcb69('0xc'));var Papa=require(_0xcb69('0xd'));var Redis=require(_0xcb69('0xe'));var authService=require(_0xcb69('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xcb69('0x10'));var hardwareService=require(_0xcb69('0x11'));var logger=require(_0xcb69('0x12'))(_0xcb69('0x13'));var utils=require(_0xcb69('0x14'));var config=require(_0xcb69('0x15'));var licenseUtil=require(_0xcb69('0x16'));var db=require(_0xcb69('0x17'))['db'];function respondWithStatusCode(_0x3ab496,_0x3f00ae){_0x3f00ae=_0x3f00ae||0xcc;return function(_0x44f5c0){if(_0x44f5c0){return _0x3ab496[_0xcb69('0x18')](_0x3f00ae);}return _0x3ab496['status'](_0x3f00ae)[_0xcb69('0x19')]();};}function respondWithResult(_0x53617a,_0x134432){_0x134432=_0x134432||0xc8;return function(_0x5251f9){if(_0x5251f9){return _0x53617a[_0xcb69('0x1a')](_0x134432)[_0xcb69('0x1b')](_0x5251f9);}};}function respondWithFilteredResult(_0x57e60f,_0x10fcf4){return function(_0x995b38){if(_0x995b38){var _0x37811e=typeof _0x10fcf4[_0xcb69('0x1c')]===_0xcb69('0x1d')&&typeof _0x10fcf4[_0xcb69('0x1e')]===_0xcb69('0x1d');var _0x159ba1=_0x995b38[_0xcb69('0x1f')];var _0x50d380=_0x37811e?0x0:_0x10fcf4[_0xcb69('0x1c')];var _0x25b66c=_0x37811e?_0x995b38['count']:_0x10fcf4[_0xcb69('0x1c')]+_0x10fcf4[_0xcb69('0x1e')];var _0xd5c3fa;if(_0x25b66c>=_0x159ba1){_0x25b66c=_0x159ba1;_0xd5c3fa=0xc8;}else{_0xd5c3fa=0xce;}_0x57e60f['status'](_0xd5c3fa);return _0x57e60f[_0xcb69('0x20')](_0xcb69('0x21'),_0x50d380+'-'+_0x25b66c+'/'+_0x159ba1)[_0xcb69('0x1b')](_0x995b38);}return null;};}function patchUpdates(_0x2584fa){return function(_0x2c0a89){try{jsonpatch['apply'](_0x2c0a89,_0x2584fa,!![]);}catch(_0x33a6e0){return BPromise[_0xcb69('0x22')](_0x33a6e0);}return _0x2c0a89[_0xcb69('0x23')]();};}function saveUpdates(_0x5952b0,_0x71de81){return function(_0x410246){if(_0x410246){return _0x410246[_0xcb69('0x24')](_0x5952b0)['then'](function(_0xa9cc11){return _0xa9cc11;});}return null;};}function removeEntity(_0x3b1b0b,_0x2baf9c){return function(_0x2ae1ed){if(_0x2ae1ed){return _0x2ae1ed['destroy']()[_0xcb69('0x25')](function(){_0x3b1b0b[_0xcb69('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b2811,_0x557ab1){return function(_0x50f72a){if(!_0x50f72a){_0x1b2811[_0xcb69('0x18')](0x194);}return _0x50f72a;};}function handleError(_0x74fded,_0x41d7e4){_0x41d7e4=_0x41d7e4||0x1f4;return function(_0x4c27a4){logger[_0xcb69('0x26')](_0x4c27a4['stack']);if(_0x4c27a4[_0xcb69('0x27')]){delete _0x4c27a4['name'];}_0x74fded[_0xcb69('0x1a')](_0x41d7e4)[_0xcb69('0x28')](_0x4c27a4);};}exports[_0xcb69('0x29')]=function(_0xee3ac7,_0x5e046e){var _0x5d0ca5={},_0x4073b8={},_0x44ebd3={'count':0x0,'rows':[]};var _0x2bca8f=_[_0xcb69('0x2a')](db['ZohoField'][_0xcb69('0x2b')],function(_0x325a59){return{'name':_0x325a59[_0xcb69('0x2c')],'type':_0x325a59['type'][_0xcb69('0x2d')]};});_0x4073b8[_0xcb69('0x2e')]=_[_0xcb69('0x2a')](_0x2bca8f,_0xcb69('0x27'));_0x4073b8['query']=_[_0xcb69('0x2f')](_0xee3ac7[_0xcb69('0x30')]);_0x4073b8['filters']=_[_0xcb69('0x31')](_0x4073b8['model'],_0x4073b8[_0xcb69('0x30')]);_0x5d0ca5[_0xcb69('0x32')]=_[_0xcb69('0x31')](_0x4073b8[_0xcb69('0x2e')],qs['fields'](_0xee3ac7['query'][_0xcb69('0x33')]));_0x5d0ca5[_0xcb69('0x32')]=_0x5d0ca5[_0xcb69('0x32')][_0xcb69('0x34')]?_0x5d0ca5[_0xcb69('0x32')]:_0x4073b8[_0xcb69('0x2e')];if(!_0xee3ac7[_0xcb69('0x30')][_0xcb69('0x35')](_0xcb69('0x36'))){_0x5d0ca5[_0xcb69('0x1e')]=qs[_0xcb69('0x1e')](_0xee3ac7[_0xcb69('0x30')][_0xcb69('0x1e')]);_0x5d0ca5['offset']=qs['offset'](_0xee3ac7[_0xcb69('0x30')][_0xcb69('0x1c')]);}_0x5d0ca5['order']=qs[_0xcb69('0x37')](_0xee3ac7[_0xcb69('0x30')]['sort']);_0x5d0ca5['where']=qs[_0xcb69('0x38')](_[_0xcb69('0x39')](_0xee3ac7[_0xcb69('0x30')],_0x4073b8[_0xcb69('0x38')]),_0x2bca8f);if(_0xee3ac7[_0xcb69('0x30')][_0xcb69('0x3a')]){_0x5d0ca5['where']=_['merge'](_0x5d0ca5[_0xcb69('0x3b')],{'$or':_['map'](_0x2bca8f,function(_0x5b9e7a){if(_0x5b9e7a['type']!==_0xcb69('0x3c')){var _0x1d301a={};_0x1d301a[_0x5b9e7a[_0xcb69('0x27')]]={'$like':'%'+_0xee3ac7['query'][_0xcb69('0x3a')]+'%'};return _0x1d301a;}})});}_0x5d0ca5=_['merge']({},_0x5d0ca5,_0xee3ac7[_0xcb69('0x3d')]);var _0x3c8967={'where':_0x5d0ca5['where']};return db[_0xcb69('0x3e')]['count'](_0x3c8967)[_0xcb69('0x25')](function(_0x3bf158){_0x44ebd3['count']=_0x3bf158;if(_0xee3ac7[_0xcb69('0x30')][_0xcb69('0x3f')]){_0x5d0ca5[_0xcb69('0x40')]=[{'all':!![]}];}return db[_0xcb69('0x3e')]['findAll'](_0x5d0ca5);})['then'](function(_0x180fc9){_0x44ebd3['rows']=_0x180fc9;return _0x44ebd3;})[_0xcb69('0x25')](respondWithFilteredResult(_0x5e046e,_0x5d0ca5))['catch'](handleError(_0x5e046e,null));};exports[_0xcb69('0x41')]=function(_0x2752d6,_0x22d53b){var _0x1252fa={'raw':!![],'where':{'id':_0x2752d6[_0xcb69('0x42')]['id']}},_0x3e9114={};_0x3e9114[_0xcb69('0x2e')]=_[_0xcb69('0x2f')](db[_0xcb69('0x3e')][_0xcb69('0x2b')]);_0x3e9114[_0xcb69('0x30')]=_['keys'](_0x2752d6[_0xcb69('0x30')]);_0x3e9114[_0xcb69('0x38')]=_[_0xcb69('0x31')](_0x3e9114['model'],_0x3e9114['query']);_0x1252fa[_0xcb69('0x32')]=_[_0xcb69('0x31')](_0x3e9114[_0xcb69('0x2e')],qs[_0xcb69('0x33')](_0x2752d6[_0xcb69('0x30')]['fields']));_0x1252fa[_0xcb69('0x32')]=_0x1252fa[_0xcb69('0x32')][_0xcb69('0x34')]?_0x1252fa[_0xcb69('0x32')]:_0x3e9114[_0xcb69('0x2e')];if(_0x2752d6[_0xcb69('0x30')][_0xcb69('0x3f')]){_0x1252fa[_0xcb69('0x40')]=[{'all':!![]}];}_0x1252fa=_[_0xcb69('0x43')]({},_0x1252fa,_0x2752d6[_0xcb69('0x3d')]);return db[_0xcb69('0x3e')][_0xcb69('0x44')](_0x1252fa)[_0xcb69('0x25')](handleEntityNotFound(_0x22d53b,null))[_0xcb69('0x25')](respondWithResult(_0x22d53b,null))['catch'](handleError(_0x22d53b,null));};exports[_0xcb69('0x45')]=function(_0xb5af82,_0x21cd39){return db[_0xcb69('0x3e')]['create'](_0xb5af82[_0xcb69('0x46')],{})[_0xcb69('0x25')](respondWithResult(_0x21cd39,0xc9))['catch'](handleError(_0x21cd39,null));};exports[_0xcb69('0x24')]=function(_0x184fa7,_0x22ee8b){if(_0x184fa7[_0xcb69('0x46')]['id']){delete _0x184fa7[_0xcb69('0x46')]['id'];}return db[_0xcb69('0x3e')][_0xcb69('0x44')]({'where':{'id':_0x184fa7[_0xcb69('0x42')]['id']}})[_0xcb69('0x25')](handleEntityNotFound(_0x22ee8b,null))[_0xcb69('0x25')](saveUpdates(_0x184fa7[_0xcb69('0x46')],null))['then'](respondWithResult(_0x22ee8b,null))[_0xcb69('0x47')](handleError(_0x22ee8b,null));};exports[_0xcb69('0x48')]=function(_0x45ce13,_0x479530){return db[_0xcb69('0x3e')]['find']({'where':{'id':_0x45ce13[_0xcb69('0x42')]['id']}})['then'](handleEntityNotFound(_0x479530,null))[_0xcb69('0x25')](removeEntity(_0x479530,null))['catch'](handleError(_0x479530,null));}; \ No newline at end of file +var _0xe91c=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','error','stack','name','index','map','ZohoField','rawAttributes','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','sort','filters','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body'];(function(_0xf91841,_0x182ae3){var _0x4b9c44=function(_0x2e216e){while(--_0x2e216e){_0xf91841['push'](_0xf91841['shift']());}};_0x4b9c44(++_0x182ae3);}(_0xe91c,0xe1));var _0xce91=function(_0x5b243e,_0xe2455d){_0x5b243e=_0x5b243e-0x0;var _0x3517ab=_0xe91c[_0x5b243e];return _0x3517ab;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xce91('0x0'));var zipdir=require(_0xce91('0x1'));var jsonpatch=require(_0xce91('0x2'));var rp=require(_0xce91('0x3'));var moment=require(_0xce91('0x4'));var BPromise=require(_0xce91('0x5'));var Mustache=require(_0xce91('0x6'));var util=require('util');var path=require(_0xce91('0x7'));var sox=require(_0xce91('0x8'));var csv=require('to-csv');var ejs=require(_0xce91('0x9'));var fs=require('fs');var fs_extra=require(_0xce91('0xa'));var _=require(_0xce91('0xb'));var squel=require(_0xce91('0xc'));var crypto=require(_0xce91('0xd'));var jsforce=require(_0xce91('0xe'));var deskjs=require(_0xce91('0xf'));var toCsv=require(_0xce91('0x10'));var querystring=require(_0xce91('0x11'));var Papa=require(_0xce91('0x12'));var Redis=require(_0xce91('0x13'));var authService=require(_0xce91('0x14'));var qs=require(_0xce91('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xce91('0x16'));var logger=require(_0xce91('0x17'))(_0xce91('0x18'));var utils=require(_0xce91('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xce91('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x64b18,_0x28ff2d){_0x28ff2d=_0x28ff2d||0xcc;return function(_0x405ed8){if(_0x405ed8){return _0x64b18[_0xce91('0x1b')](_0x28ff2d);}return _0x64b18[_0xce91('0x1c')](_0x28ff2d)[_0xce91('0x1d')]();};}function respondWithResult(_0x422fb2,_0x4a1923){_0x4a1923=_0x4a1923||0xc8;return function(_0x342458){if(_0x342458){return _0x422fb2[_0xce91('0x1c')](_0x4a1923)[_0xce91('0x1e')](_0x342458);}};}function respondWithFilteredResult(_0x5ad489,_0x5362bb){return function(_0x3cb095){if(_0x3cb095){var _0x308d51=typeof _0x5362bb[_0xce91('0x1f')]===_0xce91('0x20')&&typeof _0x5362bb[_0xce91('0x21')]===_0xce91('0x20');var _0x53f0d7=_0x3cb095['count'];var _0x51d179=_0x308d51?0x0:_0x5362bb[_0xce91('0x1f')];var _0x2f1449=_0x308d51?_0x3cb095[_0xce91('0x22')]:_0x5362bb[_0xce91('0x1f')]+_0x5362bb[_0xce91('0x21')];var _0x3e8355;if(_0x2f1449>=_0x53f0d7){_0x2f1449=_0x53f0d7;_0x3e8355=0xc8;}else{_0x3e8355=0xce;}_0x5ad489[_0xce91('0x1c')](_0x3e8355);return _0x5ad489[_0xce91('0x23')]('Content-Range',_0x51d179+'-'+_0x2f1449+'/'+_0x53f0d7)[_0xce91('0x1e')](_0x3cb095);}return null;};}function patchUpdates(_0x33fe5b){return function(_0x5ee791){try{jsonpatch[_0xce91('0x24')](_0x5ee791,_0x33fe5b,!![]);}catch(_0x567f55){return BPromise[_0xce91('0x25')](_0x567f55);}return _0x5ee791[_0xce91('0x26')]();};}function saveUpdates(_0x435f2f,_0x2848b1){return function(_0x580d73){if(_0x580d73){return _0x580d73[_0xce91('0x27')](_0x435f2f)['then'](function(_0x122dcd){return _0x122dcd;});}return null;};}function removeEntity(_0x3fed30,_0x440f97){return function(_0x717d9b){if(_0x717d9b){return _0x717d9b[_0xce91('0x28')]()[_0xce91('0x29')](function(){_0x3fed30[_0xce91('0x1c')](0xcc)[_0xce91('0x1d')]();});}};}function handleEntityNotFound(_0x515f1f,_0x97895d){return function(_0x25786b){if(!_0x25786b){_0x515f1f['sendStatus'](0x194);}return _0x25786b;};}function handleError(_0x9fbfbd,_0x47fbf8){_0x47fbf8=_0x47fbf8||0x1f4;return function(_0x175453){logger[_0xce91('0x2a')](_0x175453[_0xce91('0x2b')]);if(_0x175453['name']){delete _0x175453[_0xce91('0x2c')];}_0x9fbfbd[_0xce91('0x1c')](_0x47fbf8)['send'](_0x175453);};}exports[_0xce91('0x2d')]=function(_0x920beb,_0x410366){var _0x1a6e20={},_0x55a651={},_0x556e09={'count':0x0,'rows':[]};var _0x290059=_[_0xce91('0x2e')](db[_0xce91('0x2f')][_0xce91('0x30')],function(_0x1fb858){return{'name':_0x1fb858['fieldName'],'type':_0x1fb858[_0xce91('0x31')]['key']};});_0x55a651[_0xce91('0x32')]=_['map'](_0x290059,_0xce91('0x2c'));_0x55a651[_0xce91('0x33')]=_[_0xce91('0x34')](_0x920beb[_0xce91('0x33')]);_0x55a651['filters']=_[_0xce91('0x35')](_0x55a651[_0xce91('0x32')],_0x55a651['query']);_0x1a6e20[_0xce91('0x36')]=_['intersection'](_0x55a651['model'],qs[_0xce91('0x37')](_0x920beb[_0xce91('0x33')][_0xce91('0x37')]));_0x1a6e20['attributes']=_0x1a6e20[_0xce91('0x36')]['length']?_0x1a6e20['attributes']:_0x55a651['model'];if(!_0x920beb[_0xce91('0x33')][_0xce91('0x38')]('nolimit')){_0x1a6e20[_0xce91('0x21')]=qs[_0xce91('0x21')](_0x920beb['query']['limit']);_0x1a6e20['offset']=qs[_0xce91('0x1f')](_0x920beb[_0xce91('0x33')][_0xce91('0x1f')]);}_0x1a6e20['order']=qs[_0xce91('0x39')](_0x920beb['query'][_0xce91('0x39')]);_0x1a6e20['where']=qs[_0xce91('0x3a')](_['pick'](_0x920beb['query'],_0x55a651[_0xce91('0x3a')]),_0x290059);if(_0x920beb[_0xce91('0x33')]['filter']){_0x1a6e20[_0xce91('0x3b')]=_[_0xce91('0x3c')](_0x1a6e20[_0xce91('0x3b')],{'$or':_['map'](_0x290059,function(_0x579e84){if(_0x579e84[_0xce91('0x31')]!==_0xce91('0x3d')){var _0x1800de={};_0x1800de[_0x579e84[_0xce91('0x2c')]]={'$like':'%'+_0x920beb[_0xce91('0x33')][_0xce91('0x3e')]+'%'};return _0x1800de;}})});}_0x1a6e20=_['merge']({},_0x1a6e20,_0x920beb[_0xce91('0x3f')]);var _0x10973f={'where':_0x1a6e20['where']};return db['ZohoField'][_0xce91('0x22')](_0x10973f)['then'](function(_0x419a13){_0x556e09[_0xce91('0x22')]=_0x419a13;if(_0x920beb[_0xce91('0x33')][_0xce91('0x40')]){_0x1a6e20[_0xce91('0x41')]=[{'all':!![]}];}return db[_0xce91('0x2f')][_0xce91('0x42')](_0x1a6e20);})['then'](function(_0x2ad962){_0x556e09[_0xce91('0x43')]=_0x2ad962;return _0x556e09;})['then'](respondWithFilteredResult(_0x410366,_0x1a6e20))[_0xce91('0x44')](handleError(_0x410366,null));};exports[_0xce91('0x45')]=function(_0x5c376e,_0x1b81f9){var _0x33a841={'raw':!![],'where':{'id':_0x5c376e[_0xce91('0x46')]['id']}},_0x295e3a={};_0x295e3a[_0xce91('0x32')]=_[_0xce91('0x34')](db[_0xce91('0x2f')][_0xce91('0x30')]);_0x295e3a['query']=_[_0xce91('0x34')](_0x5c376e[_0xce91('0x33')]);_0x295e3a[_0xce91('0x3a')]=_['intersection'](_0x295e3a['model'],_0x295e3a[_0xce91('0x33')]);_0x33a841[_0xce91('0x36')]=_[_0xce91('0x35')](_0x295e3a[_0xce91('0x32')],qs[_0xce91('0x37')](_0x5c376e[_0xce91('0x33')][_0xce91('0x37')]));_0x33a841[_0xce91('0x36')]=_0x33a841[_0xce91('0x36')][_0xce91('0x47')]?_0x33a841[_0xce91('0x36')]:_0x295e3a[_0xce91('0x32')];if(_0x5c376e[_0xce91('0x33')]['includeAll']){_0x33a841['include']=[{'all':!![]}];}_0x33a841=_[_0xce91('0x3c')]({},_0x33a841,_0x5c376e[_0xce91('0x3f')]);return db[_0xce91('0x2f')][_0xce91('0x48')](_0x33a841)[_0xce91('0x29')](handleEntityNotFound(_0x1b81f9,null))['then'](respondWithResult(_0x1b81f9,null))[_0xce91('0x44')](handleError(_0x1b81f9,null));};exports[_0xce91('0x49')]=function(_0x62eb73,_0x335354){return db[_0xce91('0x2f')][_0xce91('0x49')](_0x62eb73[_0xce91('0x4a')],{})[_0xce91('0x29')](respondWithResult(_0x335354,0xc9))[_0xce91('0x44')](handleError(_0x335354,null));};exports[_0xce91('0x27')]=function(_0x2ce23a,_0x5d630c){if(_0x2ce23a[_0xce91('0x4a')]['id']){delete _0x2ce23a['body']['id'];}return db['ZohoField'][_0xce91('0x48')]({'where':{'id':_0x2ce23a['params']['id']}})['then'](handleEntityNotFound(_0x5d630c,null))[_0xce91('0x29')](saveUpdates(_0x2ce23a['body'],null))[_0xce91('0x29')](respondWithResult(_0x5d630c,null))[_0xce91('0x44')](handleError(_0x5d630c,null));};exports['destroy']=function(_0x35f84b,_0x2f23ef){return db[_0xce91('0x2f')]['find']({'where':{'id':_0x35f84b['params']['id']}})['then'](handleEntityNotFound(_0x2f23ef,null))[_0xce91('0x29')](removeEntity(_0x2f23ef,null))['catch'](handleError(_0x2f23ef,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 72c276c..25d8b8e 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 _0xb145=['api','moment','bluebird','request-promise','path','rimraf','./intZohoField.attributes','exports','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','util','../../config/logger'];(function(_0x5333ba,_0x22e1bb){var _0x20f9dc=function(_0x1956af){while(--_0x1956af){_0x5333ba['push'](_0x5333ba['shift']());}};_0x20f9dc(++_0x22e1bb);}(_0xb145,0xa3));var _0x5b14=function(_0x53f3ad,_0x2b4ac6){_0x53f3ad=_0x53f3ad-0x0;var _0x1dd9ca=_0xb145[_0x53f3ad];return _0x1dd9ca;};'use strict';var _=require('lodash');var util=require(_0x5b14('0x0'));var logger=require(_0x5b14('0x1'))(_0x5b14('0x2'));var moment=require(_0x5b14('0x3'));var BPromise=require(_0x5b14('0x4'));var rp=require(_0x5b14('0x5'));var fs=require('fs');var path=require(_0x5b14('0x6'));var rimraf=require(_0x5b14('0x7'));var config=require('../../config/environment');var attributes=require(_0x5b14('0x8'));module[_0x5b14('0x9')]=function(_0x392425,_0x4d82ad){return _0x392425['define'](_0x5b14('0xa'),attributes,{'tableName':_0x5b14('0xb'),'paranoid':![],'indexes':[{'name':_0x5b14('0xc'),'fields':[_0x5b14('0xd'),_0x5b14('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x33af=['moment','bluebird','request-promise','path','rimraf','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','util','api'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x33af,0xec));var _0xf33a=function(_0x818500,_0xe7620c){_0x818500=_0x818500-0x0;var _0x342023=_0x33af[_0x818500];return _0x342023;};'use strict';var _=require('lodash');var util=require(_0xf33a('0x0'));var logger=require('../../config/logger')(_0xf33a('0x1'));var moment=require(_0xf33a('0x2'));var BPromise=require(_0xf33a('0x3'));var rp=require(_0xf33a('0x4'));var fs=require('fs');var path=require(_0xf33a('0x5'));var rimraf=require(_0xf33a('0x6'));var config=require('../../config/environment');var attributes=require(_0xf33a('0x7'));module[_0xf33a('0x8')]=function(_0x583e54,_0xc0dd13){return _0x583e54[_0xf33a('0x9')](_0xf33a('0xa'),attributes,{'tableName':_0xf33a('0xb'),'paranoid':![],'indexes':[{'name':_0xf33a('0xc'),'fields':[_0xf33a('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 6132f06..50984b8 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 _0xe4da=['request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','http','info','ZohoField,\x20%s,\x20%s'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xe4da,0x14b));var _0xae4d=function(_0x47b00d,_0x9195d4){_0x47b00d=_0x47b00d-0x0;var _0x25aa61=_0xe4da[_0x47b00d];return _0x25aa61;};'use strict';var _=require(_0xae4d('0x0'));var util=require(_0xae4d('0x1'));var moment=require(_0xae4d('0x2'));var BPromise=require(_0xae4d('0x3'));var rs=require(_0xae4d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xae4d('0x5'));var logger=require('../../config/logger')(_0xae4d('0x6'));var config=require('../../config/environment');var jayson=require(_0xae4d('0x7'));var client=jayson['client'][_0xae4d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x26e3d2,_0x43c7ac,_0x2c93f2){return new BPromise(function(_0x56c825,_0x3ed0c5){return client['request'](_0x26e3d2,_0x2c93f2)['then'](function(_0xc77f0a){logger[_0xae4d('0x9')](_0xae4d('0xa'),_0x43c7ac,_0xae4d('0xb'));logger[_0xae4d('0xc')](_0xae4d('0xd'),_0x43c7ac,_0xae4d('0xb'),JSON[_0xae4d('0xe')](_0xc77f0a));if(_0xc77f0a['error']){if(_0xc77f0a['error'][_0xae4d('0xf')]===0x1f4){logger[_0xae4d('0x10')](_0xae4d('0xa'),_0x43c7ac,_0xc77f0a['error'][_0xae4d('0x11')]);return _0x3ed0c5(_0xc77f0a[_0xae4d('0x10')][_0xae4d('0x11')]);}logger['error']('ZohoField,\x20%s,\x20%s',_0x43c7ac,_0xc77f0a['error'][_0xae4d('0x11')]);return _0x56c825(_0xc77f0a[_0xae4d('0x10')][_0xae4d('0x11')]);}else{logger[_0xae4d('0x9')](_0xae4d('0xa'),_0x43c7ac,'request\x20sent');_0x56c825(_0xc77f0a[_0xae4d('0x12')][_0xae4d('0x11')]);}})['catch'](function(_0x200875){logger[_0xae4d('0x10')]('ZohoField,\x20%s,\x20%s',_0x43c7ac,_0x200875);_0x3ed0c5(_0x200875);});});} \ No newline at end of file +var _0x96ee=['request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ZohoField,\x20%s,\x20%s'];(function(_0x279755,_0x42ad77){var _0x138178=function(_0x462033){while(--_0x462033){_0x279755['push'](_0x279755['shift']());}};_0x138178(++_0x42ad77);}(_0x96ee,0x1aa));var _0xe96e=function(_0x36940e,_0x11f338){_0x36940e=_0x36940e-0x0;var _0x3283f2=_0x96ee[_0x36940e];return _0x3283f2;};'use strict';var _=require('lodash');var util=require(_0xe96e('0x0'));var moment=require(_0xe96e('0x1'));var BPromise=require('bluebird');var rs=require(_0xe96e('0x2'));var fs=require('fs');var Redis=require(_0xe96e('0x3'));var db=require(_0xe96e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe96e('0x5'))(_0xe96e('0x6'));var config=require(_0xe96e('0x7'));var jayson=require(_0xe96e('0x8'));var client=jayson['client'][_0xe96e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19af3d,_0x54a6fa,_0x33e532){return new BPromise(function(_0x13df48,_0x2bf912){return client[_0xe96e('0xa')](_0x19af3d,_0x33e532)[_0xe96e('0xb')](function(_0x1cf0f9){logger[_0xe96e('0xc')](_0xe96e('0xd'),_0x54a6fa,_0xe96e('0xe'));logger[_0xe96e('0xf')](_0xe96e('0x10'),_0x54a6fa,'request\x20sent',JSON[_0xe96e('0x11')](_0x1cf0f9));if(_0x1cf0f9[_0xe96e('0x12')]){if(_0x1cf0f9[_0xe96e('0x12')][_0xe96e('0x13')]===0x1f4){logger[_0xe96e('0x12')](_0xe96e('0xd'),_0x54a6fa,_0x1cf0f9[_0xe96e('0x12')][_0xe96e('0x14')]);return _0x2bf912(_0x1cf0f9['error'][_0xe96e('0x14')]);}logger[_0xe96e('0x12')](_0xe96e('0xd'),_0x54a6fa,_0x1cf0f9[_0xe96e('0x12')][_0xe96e('0x14')]);return _0x13df48(_0x1cf0f9[_0xe96e('0x12')]['message']);}else{logger[_0xe96e('0xc')](_0xe96e('0xd'),_0x54a6fa,_0xe96e('0xe'));_0x13df48(_0x1cf0f9[_0xe96e('0x15')]['message']);}})['catch'](function(_0x544ffb){logger['error'](_0xe96e('0xd'),_0x54a6fa,_0x544ffb);_0x2bf912(_0x544ffb);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index f1e03fa..650b086 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x5f0c67,_0x2ed6d9){var _0x9de200=function(_0x32015e){while(--_0x32015e){_0x5f0c67['push'](_0x5f0c67['shift']());}};_0x9de200(++_0x2ed6d9);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3c4dad,_0x25ffd5){_0x3c4dad=_0x3c4dad-0x0;var _0x1a4f49=_0xcb91[_0x3c4dad];return _0x1a4f49;};'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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x53c09a,_0x33c42f){var _0x571762=function(_0x210205){while(--_0x210205){_0x53c09a['push'](_0x53c09a['shift']());}};_0x571762(++_0x33c42f);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index f6c6b62..5b2a576 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 _0xf36d=['BOOLEAN','state','sequelize','exports','unique_name_and_version','STRING','INTEGER'];(function(_0x285dda,_0x524369){var _0x8a97d5=function(_0x3da13b){while(--_0x3da13b){_0x285dda['push'](_0x285dda['shift']());}};_0x8a97d5(++_0x524369);}(_0xf36d,0x160));var _0xdf36=function(_0x26b8b5,_0xf5c2c1){_0x26b8b5=_0x26b8b5-0x0;var _0x2150a9=_0xf36d[_0x26b8b5];return _0x2150a9;};'use strict';var Sequelize=require(_0xdf36('0x0'));module[_0xdf36('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xdf36('0x2')},'version':{'type':Sequelize[_0xdf36('0x3')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0xdf36('0x3')],'defaultValue':'app.js'},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0xdf36('0x3')]},'type':{'type':Sequelize[_0xdf36('0x3')]},'size':{'type':Sequelize[_0xdf36('0x4')]},'active':{'type':Sequelize[_0xdf36('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0xdf36('0x3')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0xdf36('0x3')],'unique':_0xdf36('0x6')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0xdf36('0x3')],'defaultValue':'#'}}; \ No newline at end of file +var _0x057f=['BOOLEAN','state','sequelize','STRING','unique_name_and_version','app.js','INTEGER'];(function(_0x1b6c2a,_0x2f8147){var _0x49d1e8=function(_0x30f08c){while(--_0x30f08c){_0x1b6c2a['push'](_0x1b6c2a['shift']());}};_0x49d1e8(++_0x2f8147);}(_0x057f,0x1d7));var _0xf057=function(_0x1a9e76,_0x1514f2){_0x1a9e76=_0x1a9e76-0x0;var _0x48c822=_0x057f[_0x1a9e76];return _0x48c822;};'use strict';var Sequelize=require(_0xf057('0x0'));module['exports']={'name':{'type':Sequelize[_0xf057('0x1')],'allowNull':![],'unique':_0xf057('0x2')},'version':{'type':Sequelize[_0xf057('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0xf057('0x1')],'defaultValue':_0xf057('0x3')},'filename':{'type':Sequelize[_0xf057('0x1')]},'path':{'type':Sequelize[_0xf057('0x1')]},'type':{'type':Sequelize[_0xf057('0x1')]},'size':{'type':Sequelize[_0xf057('0x4')]},'active':{'type':Sequelize[_0xf057('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0xf057('0x1')]},'logo':{'type':Sequelize[_0xf057('0x1')]},'state':{'type':Sequelize[_0xf057('0x1')],'unique':_0xf057('0x6')},'description':{'type':Sequelize[_0xf057('0x1')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0xf057('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index b82c51e..605840a 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 _0xd943=['mustache','util','path','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','Integration','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','map','merge','includeAll','include','findAll','catch','show','params','options','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x2057cd,_0x2898f6){var _0x5545cb=function(_0x534a86){while(--_0x534a86){_0x2057cd['push'](_0x2057cd['shift']());}};_0x5545cb(++_0x2898f6);}(_0xd943,0x15d));var _0x3d94=function(_0x30bd89,_0x4543a1){_0x30bd89=_0x30bd89-0x0;var _0x52bf80=_0xd943[_0x30bd89];return _0x52bf80;};'use strict';var emlformat=require(_0x3d94('0x0'));var rimraf=require(_0x3d94('0x1'));var zipdir=require(_0x3d94('0x2'));var jsonpatch=require(_0x3d94('0x3'));var rp=require('request-promise');var moment=require(_0x3d94('0x4'));var BPromise=require(_0x3d94('0x5'));var Mustache=require(_0x3d94('0x6'));var util=require(_0x3d94('0x7'));var path=require(_0x3d94('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3d94('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3d94('0xa'));var jsforce=require(_0x3d94('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3d94('0xc'));var Papa=require(_0x3d94('0xd'));var Redis=require(_0x3d94('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3d94('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d94('0x10'));var logger=require(_0x3d94('0x11'))('api');var utils=require(_0x3d94('0x12'));var config=require(_0x3d94('0x13'));var licenseUtil=require(_0x3d94('0x14'));var db=require(_0x3d94('0x15'))['db'];function respondWithStatusCode(_0x15a392,_0x548b89){_0x548b89=_0x548b89||0xcc;return function(_0x96c54b){if(_0x96c54b){return _0x15a392[_0x3d94('0x16')](_0x548b89);}return _0x15a392[_0x3d94('0x17')](_0x548b89)['end']();};}function respondWithResult(_0x24e8b9,_0x29608d){_0x29608d=_0x29608d||0xc8;return function(_0x7d6969){if(_0x7d6969){return _0x24e8b9['status'](_0x29608d)[_0x3d94('0x18')](_0x7d6969);}};}function respondWithFilteredResult(_0x340818,_0x292419){return function(_0x34098e){if(_0x34098e){var _0xaf939a=typeof _0x292419[_0x3d94('0x19')]===_0x3d94('0x1a')&&typeof _0x292419[_0x3d94('0x1b')]==='undefined';var _0x22676a=_0x34098e[_0x3d94('0x1c')];var _0x2acee3=_0xaf939a?0x0:_0x292419[_0x3d94('0x19')];var _0x4afc92=_0xaf939a?_0x34098e[_0x3d94('0x1c')]:_0x292419[_0x3d94('0x19')]+_0x292419['limit'];var _0x9bca24;if(_0x4afc92>=_0x22676a){_0x4afc92=_0x22676a;_0x9bca24=0xc8;}else{_0x9bca24=0xce;}_0x340818['status'](_0x9bca24);return _0x340818[_0x3d94('0x1d')](_0x3d94('0x1e'),_0x2acee3+'-'+_0x4afc92+'/'+_0x22676a)[_0x3d94('0x18')](_0x34098e);}return null;};}function patchUpdates(_0x1e9ec2){return function(_0x35a3cc){try{jsonpatch['apply'](_0x35a3cc,_0x1e9ec2,!![]);}catch(_0x578002){return BPromise[_0x3d94('0x1f')](_0x578002);}return _0x35a3cc[_0x3d94('0x20')]();};}function saveUpdates(_0x9c2f2c,_0x4edee4){return function(_0x30af25){if(_0x30af25){return _0x30af25[_0x3d94('0x21')](_0x9c2f2c)[_0x3d94('0x22')](function(_0x384f76){return _0x384f76;});}return null;};}function removeEntity(_0x395133,_0x4093a4){return function(_0x295493){if(_0x295493){return _0x295493[_0x3d94('0x23')]()[_0x3d94('0x22')](function(){_0x395133[_0x3d94('0x17')](0xcc)[_0x3d94('0x24')]();});}};}function handleEntityNotFound(_0x192839,_0x292976){return function(_0x3496c3){if(!_0x3496c3){_0x192839[_0x3d94('0x16')](0x194);}return _0x3496c3;};}function handleError(_0x5b3b31,_0x123183){_0x123183=_0x123183||0x1f4;return function(_0x558fd2){logger[_0x3d94('0x25')](_0x558fd2[_0x3d94('0x26')]);if(_0x558fd2[_0x3d94('0x27')]){delete _0x558fd2[_0x3d94('0x27')];}_0x5b3b31[_0x3d94('0x17')](_0x123183)[_0x3d94('0x28')](_0x558fd2);};}exports[_0x3d94('0x29')]=function(_0x47d6ab,_0x584c4a){var _0x362642={},_0x4813e1={},_0x4dd410={'count':0x0,'rows':[]};var _0x23d20d=_['map'](db[_0x3d94('0x2a')][_0x3d94('0x2b')],function(_0x32403a){return{'name':_0x32403a['fieldName'],'type':_0x32403a[_0x3d94('0x2c')]['key']};});_0x4813e1[_0x3d94('0x2d')]=_['map'](_0x23d20d,_0x3d94('0x27'));_0x4813e1[_0x3d94('0x2e')]=_[_0x3d94('0x2f')](_0x47d6ab[_0x3d94('0x2e')]);_0x4813e1['filters']=_[_0x3d94('0x30')](_0x4813e1['model'],_0x4813e1[_0x3d94('0x2e')]);_0x362642[_0x3d94('0x31')]=_['intersection'](_0x4813e1['model'],qs[_0x3d94('0x32')](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x32')]));_0x362642['attributes']=_0x362642[_0x3d94('0x31')][_0x3d94('0x33')]?_0x362642['attributes']:_0x4813e1[_0x3d94('0x2d')];if(!_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x34')](_0x3d94('0x35'))){_0x362642[_0x3d94('0x1b')]=qs['limit'](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x1b')]);_0x362642[_0x3d94('0x19')]=qs[_0x3d94('0x19')](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x19')]);}_0x362642['order']=qs['sort'](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x36')]);_0x362642[_0x3d94('0x37')]=qs[_0x3d94('0x38')](_[_0x3d94('0x39')](_0x47d6ab[_0x3d94('0x2e')],_0x4813e1[_0x3d94('0x38')]),_0x23d20d);if(_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3a')]){_0x362642[_0x3d94('0x37')]=_['merge'](_0x362642[_0x3d94('0x37')],{'$or':_[_0x3d94('0x3b')](_0x23d20d,function(_0x361fbb){if(_0x361fbb[_0x3d94('0x2c')]!=='VIRTUAL'){var _0xcf7a73={};_0xcf7a73[_0x361fbb[_0x3d94('0x27')]]={'$like':'%'+_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3a')]+'%'};return _0xcf7a73;}})});}_0x362642=_[_0x3d94('0x3c')]({},_0x362642,_0x47d6ab['options']);var _0x217e5e={'where':_0x362642[_0x3d94('0x37')]};return db[_0x3d94('0x2a')]['count'](_0x217e5e)['then'](function(_0x4d8a8f){_0x4dd410['count']=_0x4d8a8f;if(_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3d')]){_0x362642[_0x3d94('0x3e')]=[{'all':!![]}];}return db[_0x3d94('0x2a')][_0x3d94('0x3f')](_0x362642);})[_0x3d94('0x22')](function(_0x3a3898){_0x4dd410['rows']=_0x3a3898;return _0x4dd410;})['then'](respondWithFilteredResult(_0x584c4a,_0x362642))[_0x3d94('0x40')](handleError(_0x584c4a,null));};exports[_0x3d94('0x41')]=function(_0x512cef,_0x2d0aa2){var _0x4af4b6={'raw':![],'where':{'id':_0x512cef[_0x3d94('0x42')]['id']}},_0x1361fb={};_0x1361fb[_0x3d94('0x2d')]=_[_0x3d94('0x2f')](db[_0x3d94('0x2a')]['rawAttributes']);_0x1361fb[_0x3d94('0x2e')]=_[_0x3d94('0x2f')](_0x512cef[_0x3d94('0x2e')]);_0x1361fb['filters']=_[_0x3d94('0x30')](_0x1361fb['model'],_0x1361fb['query']);_0x4af4b6[_0x3d94('0x31')]=_[_0x3d94('0x30')](_0x1361fb[_0x3d94('0x2d')],qs[_0x3d94('0x32')](_0x512cef['query'][_0x3d94('0x32')]));_0x4af4b6['attributes']=_0x4af4b6[_0x3d94('0x31')][_0x3d94('0x33')]?_0x4af4b6[_0x3d94('0x31')]:_0x1361fb[_0x3d94('0x2d')];if(_0x512cef[_0x3d94('0x2e')][_0x3d94('0x3d')]){_0x4af4b6[_0x3d94('0x3e')]=[{'all':!![]}];}_0x4af4b6=_['merge']({},_0x4af4b6,_0x512cef[_0x3d94('0x43')]);return db[_0x3d94('0x2a')]['find'](_0x4af4b6)['then'](handleEntityNotFound(_0x2d0aa2,null))[_0x3d94('0x22')](respondWithResult(_0x2d0aa2,null))[_0x3d94('0x40')](handleError(_0x2d0aa2,null));};exports['create']=function(_0x3c8571,_0x13fda9){return db[_0x3d94('0x2a')][_0x3d94('0x44')](_0x3c8571[_0x3d94('0x45')],{})[_0x3d94('0x22')](respondWithResult(_0x13fda9,0xc9))[_0x3d94('0x40')](handleError(_0x13fda9,null));};exports[_0x3d94('0x21')]=function(_0x60279f,_0x2429bc){if(_0x60279f[_0x3d94('0x45')]['id']){delete _0x60279f[_0x3d94('0x45')]['id'];}return db[_0x3d94('0x2a')][_0x3d94('0x46')]({'where':{'id':_0x60279f[_0x3d94('0x42')]['id']}})['then'](handleEntityNotFound(_0x2429bc,null))[_0x3d94('0x22')](saveUpdates(_0x60279f[_0x3d94('0x45')],null))[_0x3d94('0x22')](respondWithResult(_0x2429bc,null))[_0x3d94('0x40')](handleError(_0x2429bc,null));};exports[_0x3d94('0x23')]=function(_0x3ce0be,_0x129783){return db[_0x3d94('0x2a')][_0x3d94('0x46')]({'where':{'id':_0x3ce0be['params']['id']}})[_0x3d94('0x22')](handleEntityNotFound(_0x129783,null))['then'](removeEntity(_0x129783,null))[_0x3d94('0x40')](handleError(_0x129783,null));}; \ No newline at end of file +var _0x01d9=['map','Integration','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','name','send','index'];(function(_0x475b16,_0x38580c){var _0x574675=function(_0x2b890b){while(--_0x2b890b){_0x475b16['push'](_0x475b16['shift']());}};_0x574675(++_0x38580c);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x901d('0x0'));var rimraf=require(_0x901d('0x1'));var zipdir=require(_0x901d('0x2'));var jsonpatch=require(_0x901d('0x3'));var rp=require('request-promise');var moment=require(_0x901d('0x4'));var BPromise=require(_0x901d('0x5'));var Mustache=require(_0x901d('0x6'));var util=require(_0x901d('0x7'));var path=require(_0x901d('0x8'));var sox=require(_0x901d('0x9'));var csv=require(_0x901d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x901d('0xb'));var _=require(_0x901d('0xc'));var squel=require(_0x901d('0xd'));var crypto=require(_0x901d('0xe'));var jsforce=require(_0x901d('0xf'));var deskjs=require(_0x901d('0x10'));var toCsv=require(_0x901d('0xa'));var querystring=require(_0x901d('0x11'));var Papa=require(_0x901d('0x12'));var Redis=require(_0x901d('0x13'));var authService=require(_0x901d('0x14'));var qs=require(_0x901d('0x15'));var as=require(_0x901d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x901d('0x17'))('api');var utils=require(_0x901d('0x18'));var config=require(_0x901d('0x19'));var licenseUtil=require(_0x901d('0x1a'));var db=require(_0x901d('0x1b'))['db'];function respondWithStatusCode(_0x15ebaf,_0x5d2345){_0x5d2345=_0x5d2345||0xcc;return function(_0x1d8117){if(_0x1d8117){return _0x15ebaf[_0x901d('0x1c')](_0x5d2345);}return _0x15ebaf[_0x901d('0x1d')](_0x5d2345)[_0x901d('0x1e')]();};}function respondWithResult(_0xb8869a,_0x14d99b){_0x14d99b=_0x14d99b||0xc8;return function(_0x530a2b){if(_0x530a2b){return _0xb8869a[_0x901d('0x1d')](_0x14d99b)[_0x901d('0x1f')](_0x530a2b);}};}function respondWithFilteredResult(_0x11b0cc,_0x17d451){return function(_0x1aba97){if(_0x1aba97){var _0x7dd5f4=typeof _0x17d451[_0x901d('0x20')]===_0x901d('0x21')&&typeof _0x17d451[_0x901d('0x22')]===_0x901d('0x21');var _0x28caae=_0x1aba97[_0x901d('0x23')];var _0x285353=_0x7dd5f4?0x0:_0x17d451[_0x901d('0x20')];var _0x38f42b=_0x7dd5f4?_0x1aba97[_0x901d('0x23')]:_0x17d451[_0x901d('0x20')]+_0x17d451[_0x901d('0x22')];var _0x57d518;if(_0x38f42b>=_0x28caae){_0x38f42b=_0x28caae;_0x57d518=0xc8;}else{_0x57d518=0xce;}_0x11b0cc[_0x901d('0x1d')](_0x57d518);return _0x11b0cc[_0x901d('0x24')]('Content-Range',_0x285353+'-'+_0x38f42b+'/'+_0x28caae)['json'](_0x1aba97);}return null;};}function patchUpdates(_0x496a06){return function(_0x53f8ae){try{jsonpatch[_0x901d('0x25')](_0x53f8ae,_0x496a06,!![]);}catch(_0x44ea6f){return BPromise['reject'](_0x44ea6f);}return _0x53f8ae[_0x901d('0x26')]();};}function saveUpdates(_0x3ea3f6,_0x488e24){return function(_0x20778b){if(_0x20778b){return _0x20778b[_0x901d('0x27')](_0x3ea3f6)[_0x901d('0x28')](function(_0x3f80b9){return _0x3f80b9;});}return null;};}function removeEntity(_0x1e7d36,_0x1818d3){return function(_0x46e5c6){if(_0x46e5c6){return _0x46e5c6[_0x901d('0x29')]()['then'](function(){_0x1e7d36[_0x901d('0x1d')](0xcc)[_0x901d('0x1e')]();});}};}function handleEntityNotFound(_0xbc89a5,_0x1f0ee5){return function(_0x557809){if(!_0x557809){_0xbc89a5[_0x901d('0x1c')](0x194);}return _0x557809;};}function handleError(_0x23fd43,_0x27f4ca){_0x27f4ca=_0x27f4ca||0x1f4;return function(_0x3cbe43){logger[_0x901d('0x2a')](_0x3cbe43['stack']);if(_0x3cbe43[_0x901d('0x2b')]){delete _0x3cbe43[_0x901d('0x2b')];}_0x23fd43[_0x901d('0x1d')](_0x27f4ca)[_0x901d('0x2c')](_0x3cbe43);};}exports[_0x901d('0x2d')]=function(_0x3de9b9,_0x48e86e){var _0xae6dfe={},_0x533038={},_0x128830={'count':0x0,'rows':[]};var _0x389fd9=_[_0x901d('0x2e')](db[_0x901d('0x2f')][_0x901d('0x30')],function(_0x20df02){return{'name':_0x20df02[_0x901d('0x31')],'type':_0x20df02[_0x901d('0x32')][_0x901d('0x33')]};});_0x533038[_0x901d('0x34')]=_[_0x901d('0x2e')](_0x389fd9,_0x901d('0x2b'));_0x533038[_0x901d('0x35')]=_[_0x901d('0x36')](_0x3de9b9[_0x901d('0x35')]);_0x533038['filters']=_[_0x901d('0x37')](_0x533038[_0x901d('0x34')],_0x533038[_0x901d('0x35')]);_0xae6dfe['attributes']=_[_0x901d('0x37')](_0x533038[_0x901d('0x34')],qs[_0x901d('0x38')](_0x3de9b9[_0x901d('0x35')][_0x901d('0x38')]));_0xae6dfe[_0x901d('0x39')]=_0xae6dfe[_0x901d('0x39')][_0x901d('0x3a')]?_0xae6dfe[_0x901d('0x39')]:_0x533038[_0x901d('0x34')];if(!_0x3de9b9['query']['hasOwnProperty'](_0x901d('0x3b'))){_0xae6dfe['limit']=qs[_0x901d('0x22')](_0x3de9b9[_0x901d('0x35')]['limit']);_0xae6dfe[_0x901d('0x20')]=qs[_0x901d('0x20')](_0x3de9b9[_0x901d('0x35')]['offset']);}_0xae6dfe[_0x901d('0x3c')]=qs[_0x901d('0x3d')](_0x3de9b9[_0x901d('0x35')][_0x901d('0x3d')]);_0xae6dfe[_0x901d('0x3e')]=qs[_0x901d('0x3f')](_[_0x901d('0x40')](_0x3de9b9[_0x901d('0x35')],_0x533038[_0x901d('0x3f')]),_0x389fd9);if(_0x3de9b9[_0x901d('0x35')][_0x901d('0x41')]){_0xae6dfe[_0x901d('0x3e')]=_[_0x901d('0x42')](_0xae6dfe[_0x901d('0x3e')],{'$or':_[_0x901d('0x2e')](_0x389fd9,function(_0x1644d8){if(_0x1644d8['type']!==_0x901d('0x43')){var _0x423cab={};_0x423cab[_0x1644d8['name']]={'$like':'%'+_0x3de9b9['query'][_0x901d('0x41')]+'%'};return _0x423cab;}})});}_0xae6dfe=_['merge']({},_0xae6dfe,_0x3de9b9[_0x901d('0x44')]);var _0x3d0556={'where':_0xae6dfe[_0x901d('0x3e')]};return db[_0x901d('0x2f')][_0x901d('0x23')](_0x3d0556)[_0x901d('0x28')](function(_0x5df4cb){_0x128830['count']=_0x5df4cb;if(_0x3de9b9['query']['includeAll']){_0xae6dfe[_0x901d('0x45')]=[{'all':!![]}];}return db[_0x901d('0x2f')]['findAll'](_0xae6dfe);})[_0x901d('0x28')](function(_0x22fc44){_0x128830['rows']=_0x22fc44;return _0x128830;})[_0x901d('0x28')](respondWithFilteredResult(_0x48e86e,_0xae6dfe))[_0x901d('0x46')](handleError(_0x48e86e,null));};exports[_0x901d('0x47')]=function(_0x2c1895,_0x53663d){var _0x5aeb41={'raw':![],'where':{'id':_0x2c1895[_0x901d('0x48')]['id']}},_0xa9c008={};_0xa9c008[_0x901d('0x34')]=_[_0x901d('0x36')](db[_0x901d('0x2f')][_0x901d('0x30')]);_0xa9c008[_0x901d('0x35')]=_[_0x901d('0x36')](_0x2c1895[_0x901d('0x35')]);_0xa9c008[_0x901d('0x3f')]=_[_0x901d('0x37')](_0xa9c008['model'],_0xa9c008[_0x901d('0x35')]);_0x5aeb41['attributes']=_[_0x901d('0x37')](_0xa9c008['model'],qs[_0x901d('0x38')](_0x2c1895['query'][_0x901d('0x38')]));_0x5aeb41[_0x901d('0x39')]=_0x5aeb41[_0x901d('0x39')][_0x901d('0x3a')]?_0x5aeb41[_0x901d('0x39')]:_0xa9c008[_0x901d('0x34')];if(_0x2c1895[_0x901d('0x35')][_0x901d('0x49')]){_0x5aeb41[_0x901d('0x45')]=[{'all':!![]}];}_0x5aeb41=_[_0x901d('0x42')]({},_0x5aeb41,_0x2c1895[_0x901d('0x44')]);return db['Integration'][_0x901d('0x4a')](_0x5aeb41)[_0x901d('0x28')](handleEntityNotFound(_0x53663d,null))[_0x901d('0x28')](respondWithResult(_0x53663d,null))[_0x901d('0x46')](handleError(_0x53663d,null));};exports[_0x901d('0x4b')]=function(_0x24b6fa,_0x27459b){return db[_0x901d('0x2f')][_0x901d('0x4b')](_0x24b6fa[_0x901d('0x4c')],{})[_0x901d('0x28')](respondWithResult(_0x27459b,0xc9))[_0x901d('0x46')](handleError(_0x27459b,null));};exports[_0x901d('0x27')]=function(_0x23f2a9,_0x4888e8){if(_0x23f2a9['body']['id']){delete _0x23f2a9[_0x901d('0x4c')]['id'];}return db[_0x901d('0x2f')][_0x901d('0x4a')]({'where':{'id':_0x23f2a9[_0x901d('0x48')]['id']}})[_0x901d('0x28')](handleEntityNotFound(_0x4888e8,null))['then'](saveUpdates(_0x23f2a9['body'],null))[_0x901d('0x28')](respondWithResult(_0x4888e8,null))[_0x901d('0x46')](handleError(_0x4888e8,null));};exports['destroy']=function(_0x23673d,_0x165207){return db['Integration'][_0x901d('0x4a')]({'where':{'id':_0x23673d['params']['id']}})[_0x901d('0x28')](handleEntityNotFound(_0x165207,null))[_0x901d('0x28')](removeEntity(_0x165207,null))[_0x901d('0x46')](handleError(_0x165207,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index d2d0a93..fb9da9c 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 _0x07c0=['../../config/logger','moment','rimraf','exports','define','Integration','integrations','lodash'];(function(_0x1582f4,_0x180f2f){var _0x47ee8c=function(_0x29c46b){while(--_0x29c46b){_0x1582f4['push'](_0x1582f4['shift']());}};_0x47ee8c(++_0x180f2f);}(_0x07c0,0x137));var _0x007c=function(_0x2c0557,_0x4314fd){_0x2c0557=_0x2c0557-0x0;var _0x2878cd=_0x07c0[_0x2c0557];return _0x2878cd;};'use strict';var _=require(_0x007c('0x0'));var util=require('util');var logger=require(_0x007c('0x1'))('api');var moment=require(_0x007c('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x007c('0x3'));var config=require('../../config/environment');var attributes=require('./integration.attributes');module[_0x007c('0x4')]=function(_0x246bd9,_0x4c2895){return _0x246bd9[_0x007c('0x5')](_0x007c('0x6'),attributes,{'tableName':_0x007c('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7583=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','define','Integration','integrations','util','../../config/logger'];(function(_0x5e0fe4,_0x5c9645){var _0x4a8a44=function(_0x173ed5){while(--_0x173ed5){_0x5e0fe4['push'](_0x5e0fe4['shift']());}};_0x4a8a44(++_0x5c9645);}(_0x7583,0x140));var _0x3758=function(_0x51543d,_0x204989){_0x51543d=_0x51543d-0x0;var _0x4a62cb=_0x7583[_0x51543d];return _0x4a62cb;};'use strict';var _=require('lodash');var util=require(_0x3758('0x0'));var logger=require(_0x3758('0x1'))(_0x3758('0x2'));var moment=require(_0x3758('0x3'));var BPromise=require(_0x3758('0x4'));var rp=require(_0x3758('0x5'));var fs=require('fs');var path=require(_0x3758('0x6'));var rimraf=require(_0x3758('0x7'));var config=require(_0x3758('0x8'));var attributes=require(_0x3758('0x9'));module[_0x3758('0xa')]=function(_0x2cc703,_0x4b7f7f){return _0x2cc703[_0x3758('0xb')](_0x3758('0xc'),attributes,{'tableName':_0x3758('0xd'),'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 4493b53..89d8f26 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 _0xc6ac=['http','request','then','info','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5361c7,_0x4ca922){var _0x50e943=function(_0x389a7b){while(--_0x389a7b){_0x5361c7['push'](_0x5361c7['shift']());}};_0x50e943(++_0x4ca922);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x3d28af,_0x47547c){_0x3d28af=_0x3d28af-0x0;var _0x495b50=_0xc6ac[_0x3d28af];return _0x495b50;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var moment=require(_0xcc6a('0x2'));var BPromise=require(_0xcc6a('0x3'));var rs=require(_0xcc6a('0x4'));var fs=require('fs');var Redis=require(_0xcc6a('0x5'));var db=require(_0xcc6a('0x6'))['db'];var utils=require(_0xcc6a('0x7'));var logger=require(_0xcc6a('0x8'))(_0xcc6a('0x9'));var config=require(_0xcc6a('0xa'));var jayson=require(_0xcc6a('0xb'));var client=jayson[_0xcc6a('0xc')][_0xcc6a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5f3887,_0x3dd497,_0x11b919){return new BPromise(function(_0xf02261,_0x560cc4){return client[_0xcc6a('0xe')](_0x5f3887,_0x11b919)[_0xcc6a('0xf')](function(_0x7806a0){logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,'request\x20sent');logger[_0xcc6a('0x12')](_0xcc6a('0x13'),_0x3dd497,_0xcc6a('0x14'),JSON['stringify'](_0x7806a0));if(_0x7806a0[_0xcc6a('0x15')]){if(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x16')]===0x1f4){logger['error']('Integration,\x20%s,\x20%s',_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0x560cc4(_0x7806a0[_0xcc6a('0x15')]['message']);}logger['error'](_0xcc6a('0x11'),_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0xf02261(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);}else{logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,_0xcc6a('0x14'));_0xf02261(_0x7806a0['result']['message']);}})['catch'](function(_0x395a55){logger[_0xcc6a('0x15')](_0xcc6a('0x11'),_0x3dd497,_0x395a55);_0x560cc4(_0x395a55);});});} \ No newline at end of file +var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','Integration,\x20%s,\x20%s','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x365b01,_0x4d1cb4){var _0x4235f5=function(_0x5927db){while(--_0x5927db){_0x365b01['push'](_0x365b01['shift']());}};_0x4235f5(++_0x4d1cb4);}(_0x2ef3,0xba));var _0x32ef=function(_0x91d80a,_0x2df2a1){_0x91d80a=_0x91d80a-0x0;var _0x4741f1=_0x2ef3[_0x91d80a];return _0x4741f1;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('Integration,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('Integration,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 0f35632..5b0cc7f 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 _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(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5f66[_0x17d9e3];return _0x14192d;};'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 +var _0x4975=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x258feb,_0x59e01f){var _0x40fc52=function(_0x1304dc){while(--_0x1304dc){_0x258feb['push'](_0x258feb['shift']());}};_0x40fc52(++_0x59e01f);}(_0x4975,0x86));var _0x5497=function(_0xe7dcbd,_0x4d2736){_0xe7dcbd=_0xe7dcbd-0x0;var _0x465aec=_0x4975[_0xe7dcbd];return _0x465aec;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var fs_extra=require(_0x5497('0x5'));var auth=require(_0x5497('0x6'));var interaction=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var controller=require(_0x5497('0x9'));router[_0x5497('0xa')]('/',auth['isAuthenticated'](),controller[_0x5497('0xb')]);router['get'](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0xe')]);router['get'](_0x5497('0xf'),auth['isAuthenticated'](),controller[_0x5497('0x10')]);router[_0x5497('0x11')]('/',auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0x13')](_0x5497('0xf'),auth[_0x5497('0xd')](),controller[_0x5497('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5497('0x15')]);module[_0x5497('0x16')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 265993b..3f68410 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 _0xdfa4=['STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','FAILED','exports'];(function(_0x37bff4,_0x3a9a16){var _0x5b64e7=function(_0x112b20){while(--_0x112b20){_0x37bff4['push'](_0x37bff4['shift']());}};_0x5b64e7(++_0x3a9a16);}(_0xdfa4,0x1cb));var _0x4dfa=function(_0x51d658,_0x448dd9){_0x51d658=_0x51d658-0x0;var _0x337e99=_0xdfa4[_0x51d658];return _0x337e99;};'use strict';var Sequelize=require('sequelize');module[_0x4dfa('0x0')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x4dfa('0x1')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x4dfa('0x1')]},'integrationId':{'type':Sequelize[_0x4dfa('0x2')]},'contacts':{'type':Sequelize[_0x4dfa('0x1')]},'uniqueid':{'type':Sequelize[_0x4dfa('0x1')]},'calleridnum':{'type':Sequelize[_0x4dfa('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x4dfa('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x4dfa('0x1')]},'agentcalledAt':{'type':Sequelize[_0x4dfa('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x4dfa('0x2')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x4dfa('0x3')]},'talktime':{'type':Sequelize[_0x4dfa('0x2')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x4dfa('0x2')]},'reason':{'type':Sequelize[_0x4dfa('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x4dfa('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x4dfa('0x3')]},'lastevent':{'type':Sequelize[_0x4dfa('0x1')]},'channel':{'type':Sequelize[_0x4dfa('0x1')]},'channelstate':{'type':Sequelize[_0x4dfa('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x4dfa('0x1')]},'connectedlinename':{'type':Sequelize[_0x4dfa('0x1')]},'language':{'type':Sequelize[_0x4dfa('0x1')]},'accountcode':{'type':Sequelize[_0x4dfa('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x4dfa('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x4dfa('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x4dfa('0x1')]},'destcalleridnum':{'type':Sequelize[_0x4dfa('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x4dfa('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x4dfa('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x4dfa('0x1')]},'destcontext':{'type':Sequelize[_0x4dfa('0x1')]},'destexten':{'type':Sequelize[_0x4dfa('0x1')]},'destpriority':{'type':Sequelize[_0x4dfa('0x1')]},'destuniqueid':{'type':Sequelize[_0x4dfa('0x1')]},'messageId':{'type':Sequelize[_0x4dfa('0x1')]},'inReplyTo':{'type':Sequelize[_0x4dfa('0x1')]},'subject':{'type':Sequelize[_0x4dfa('0x1')]},'from':{'type':Sequelize[_0x4dfa('0x1')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x4dfa('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x4dfa('0x5')]},'text':{'type':Sequelize[_0x4dfa('0x5')]},'status':{'type':Sequelize[_0x4dfa('0x6')](_0x4dfa('0x7'),_0x4dfa('0x8'),'RECEIVED',_0x4dfa('0x9'))},'url':{'type':Sequelize[_0x4dfa('0x1')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x4dfa('0x1')]},'projectId':{'type':Sequelize[_0x4dfa('0x2')]}}; \ No newline at end of file +var _0x5146=['BOOLEAN','TEXT','ENUM','RECEIVED','FAILED','exports','STRING','INTEGER','DATE'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0x5146,0x7a));var _0x6514=function(_0x4b02a9,_0x543656){_0x4b02a9=_0x4b02a9-0x0;var _0x431b3b=_0x5146[_0x4b02a9];return _0x431b3b;};'use strict';var Sequelize=require('sequelize');module[_0x6514('0x0')]={'integration':{'type':Sequelize[_0x6514('0x1')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x6514('0x1')]},'ticketId':{'type':Sequelize[_0x6514('0x1')]},'integrationId':{'type':Sequelize[_0x6514('0x2')]},'contacts':{'type':Sequelize[_0x6514('0x1')]},'uniqueid':{'type':Sequelize[_0x6514('0x1')]},'calleridnum':{'type':Sequelize[_0x6514('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x6514('0x1')]},'interface':{'type':Sequelize[_0x6514('0x1')]},'membername':{'type':Sequelize[_0x6514('0x1')]},'agentcalledAt':{'type':Sequelize[_0x6514('0x3')]},'agentconnectAt':{'type':Sequelize[_0x6514('0x3')]},'holdtime':{'type':Sequelize[_0x6514('0x2')]},'agentcomplete':{'type':Sequelize[_0x6514('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x6514('0x3')]},'talktime':{'type':Sequelize[_0x6514('0x2')]},'agentacw':{'type':Sequelize[_0x6514('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x6514('0x2')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x6514('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x6514('0x3')]},'agentdump':{'type':Sequelize[_0x6514('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x6514('0x3')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x6514('0x1')]},'channelstate':{'type':Sequelize[_0x6514('0x2')]},'channelstatedesc':{'type':Sequelize[_0x6514('0x1')]},'connectedlinenum':{'type':Sequelize[_0x6514('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x6514('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x6514('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x6514('0x1')]},'destchannel':{'type':Sequelize[_0x6514('0x1')]},'destchannelstate':{'type':Sequelize[_0x6514('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x6514('0x1')]},'destcalleridnum':{'type':Sequelize[_0x6514('0x1')]},'destcalleridname':{'type':Sequelize[_0x6514('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x6514('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x6514('0x1')]},'destlanguage':{'type':Sequelize[_0x6514('0x1')]},'destaccountcode':{'type':Sequelize[_0x6514('0x1')]},'destcontext':{'type':Sequelize[_0x6514('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x6514('0x1')]},'destuniqueid':{'type':Sequelize[_0x6514('0x1')]},'messageId':{'type':Sequelize[_0x6514('0x1')]},'inReplyTo':{'type':Sequelize[_0x6514('0x1')]},'subject':{'type':Sequelize[_0x6514('0x1')]},'from':{'type':Sequelize[_0x6514('0x1')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x6514('0x1')]},'attachment':{'type':Sequelize[_0x6514('0x5')]},'html':{'type':Sequelize[_0x6514('0x5')]},'text':{'type':Sequelize[_0x6514('0x5')]},'status':{'type':Sequelize[_0x6514('0x6')]('SENT','SENDING',_0x6514('0x7'),_0x6514('0x8'))},'url':{'type':Sequelize[_0x6514('0x1')]},'app':{'type':Sequelize[_0x6514('0x1')]},'appdata':{'type':Sequelize[_0x6514('0x1')]},'projectId':{'type':Sequelize[_0x6514('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 2713a3c..e6a1ce6 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 _0x1cb0=['describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','index','IntegrationReport','type','key','query','keys','intersection','attributes','model','fields','hasOwnProperty','nolimit','sort','pick','filters','filter','where','merge','map','VIRTUAL','options','include','findAll','catch','params','rawAttributes','includeAll','find','create','body'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x1cb0,0x119));var _0x01cb=function(_0xec919c,_0x45c528){_0xec919c=_0xec919c-0x0;var _0x516869=_0x1cb0[_0xec919c];return _0x516869;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x01cb('0x0'));var zipdir=require(_0x01cb('0x1'));var jsonpatch=require(_0x01cb('0x2'));var rp=require(_0x01cb('0x3'));var moment=require(_0x01cb('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x01cb('0x5'));var sox=require(_0x01cb('0x6'));var csv=require(_0x01cb('0x7'));var ejs=require(_0x01cb('0x8'));var fs=require('fs');var fs_extra=require(_0x01cb('0x9'));var _=require('lodash');var squel=require(_0x01cb('0xa'));var crypto=require(_0x01cb('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x01cb('0x7'));var querystring=require(_0x01cb('0xc'));var Papa=require(_0x01cb('0xd'));var Redis=require(_0x01cb('0xe'));var authService=require(_0x01cb('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x01cb('0x10'));var logger=require(_0x01cb('0x11'))(_0x01cb('0x12'));var utils=require(_0x01cb('0x13'));var config=require(_0x01cb('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x454e2f,_0x114224){_0x114224=_0x114224||0xcc;return function(_0x141805){if(_0x141805){return _0x454e2f[_0x01cb('0x15')](_0x114224);}return _0x454e2f[_0x01cb('0x16')](_0x114224)[_0x01cb('0x17')]();};}function respondWithResult(_0x58967f,_0x1d58fd){_0x1d58fd=_0x1d58fd||0xc8;return function(_0x26a8ea){if(_0x26a8ea){return _0x58967f[_0x01cb('0x16')](_0x1d58fd)['json'](_0x26a8ea);}};}function respondWithFilteredResult(_0x414b0e,_0x26fea5){return function(_0x34ea57){if(_0x34ea57){var _0x128e27=typeof _0x26fea5[_0x01cb('0x18')]===_0x01cb('0x19')&&typeof _0x26fea5[_0x01cb('0x1a')]===_0x01cb('0x19');var _0x463fb1=_0x34ea57['count'];var _0x34f512=_0x128e27?0x0:_0x26fea5[_0x01cb('0x18')];var _0x207f2f=_0x128e27?_0x34ea57[_0x01cb('0x1b')]:_0x26fea5[_0x01cb('0x18')]+_0x26fea5[_0x01cb('0x1a')];var _0x3a2bf2;if(_0x207f2f>=_0x463fb1){_0x207f2f=_0x463fb1;_0x3a2bf2=0xc8;}else{_0x3a2bf2=0xce;}_0x414b0e[_0x01cb('0x16')](_0x3a2bf2);return _0x414b0e['set'](_0x01cb('0x1c'),_0x34f512+'-'+_0x207f2f+'/'+_0x463fb1)[_0x01cb('0x1d')](_0x34ea57);}return null;};}function patchUpdates(_0x6327af){return function(_0x1eeb15){try{jsonpatch[_0x01cb('0x1e')](_0x1eeb15,_0x6327af,!![]);}catch(_0xabdab1){return BPromise[_0x01cb('0x1f')](_0xabdab1);}return _0x1eeb15['save']();};}function saveUpdates(_0x3be001,_0xc8a7d8){return function(_0x7c6ded){if(_0x7c6ded){return _0x7c6ded[_0x01cb('0x20')](_0x3be001)[_0x01cb('0x21')](function(_0x40efb9){return _0x40efb9;});}return null;};}function removeEntity(_0x291cb1,_0x251f0d){return function(_0x23f0bd){if(_0x23f0bd){return _0x23f0bd[_0x01cb('0x22')]()[_0x01cb('0x21')](function(){_0x291cb1[_0x01cb('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x341866,_0x70f2f5){return function(_0x3475fb){if(!_0x3475fb){_0x341866[_0x01cb('0x15')](0x194);}return _0x3475fb;};}function handleError(_0x4a7644,_0x32c624){_0x32c624=_0x32c624||0x1f4;return function(_0x401877){logger[_0x01cb('0x23')](_0x401877[_0x01cb('0x24')]);if(_0x401877['name']){delete _0x401877[_0x01cb('0x25')];}_0x4a7644[_0x01cb('0x16')](_0x32c624)[_0x01cb('0x26')](_0x401877);};}exports[_0x01cb('0x27')]=function(_0x175844,_0x4b5079){var _0x251dff={},_0x22ae88={},_0x344c45={'count':0x0,'rows':[]};var _0x54c92a=_['map'](db[_0x01cb('0x28')]['rawAttributes'],function(_0x3c81b7){return{'name':_0x3c81b7['fieldName'],'type':_0x3c81b7[_0x01cb('0x29')][_0x01cb('0x2a')]};});_0x22ae88['model']=_['map'](_0x54c92a,_0x01cb('0x25'));_0x22ae88[_0x01cb('0x2b')]=_[_0x01cb('0x2c')](_0x175844[_0x01cb('0x2b')]);_0x22ae88['filters']=_[_0x01cb('0x2d')](_0x22ae88['model'],_0x22ae88[_0x01cb('0x2b')]);_0x251dff[_0x01cb('0x2e')]=_[_0x01cb('0x2d')](_0x22ae88[_0x01cb('0x2f')],qs[_0x01cb('0x30')](_0x175844['query'][_0x01cb('0x30')]));_0x251dff[_0x01cb('0x2e')]=_0x251dff[_0x01cb('0x2e')]['length']?_0x251dff[_0x01cb('0x2e')]:_0x22ae88[_0x01cb('0x2f')];if(!_0x175844[_0x01cb('0x2b')][_0x01cb('0x31')](_0x01cb('0x32'))){_0x251dff[_0x01cb('0x1a')]=qs[_0x01cb('0x1a')](_0x175844[_0x01cb('0x2b')][_0x01cb('0x1a')]);_0x251dff[_0x01cb('0x18')]=qs[_0x01cb('0x18')](_0x175844[_0x01cb('0x2b')][_0x01cb('0x18')]);}_0x251dff['order']=qs['sort'](_0x175844['query'][_0x01cb('0x33')]);_0x251dff['where']=qs['filters'](_[_0x01cb('0x34')](_0x175844[_0x01cb('0x2b')],_0x22ae88[_0x01cb('0x35')]),_0x54c92a);if(_0x175844['query'][_0x01cb('0x36')]){_0x251dff[_0x01cb('0x37')]=_[_0x01cb('0x38')](_0x251dff[_0x01cb('0x37')],{'$or':_[_0x01cb('0x39')](_0x54c92a,function(_0x38b14f){if(_0x38b14f[_0x01cb('0x29')]!==_0x01cb('0x3a')){var _0x504381={};_0x504381[_0x38b14f['name']]={'$like':'%'+_0x175844[_0x01cb('0x2b')][_0x01cb('0x36')]+'%'};return _0x504381;}})});}_0x251dff=_[_0x01cb('0x38')]({},_0x251dff,_0x175844[_0x01cb('0x3b')]);var _0x5a11dd={'where':_0x251dff['where']};return db[_0x01cb('0x28')]['count'](_0x5a11dd)[_0x01cb('0x21')](function(_0x15dfd2){_0x344c45[_0x01cb('0x1b')]=_0x15dfd2;if(_0x175844['query']['includeAll']){_0x251dff[_0x01cb('0x3c')]=[{'all':!![]}];}return db[_0x01cb('0x28')][_0x01cb('0x3d')](_0x251dff);})['then'](function(_0x40fd2e){_0x344c45['rows']=_0x40fd2e;return _0x344c45;})[_0x01cb('0x21')](respondWithFilteredResult(_0x4b5079,_0x251dff))[_0x01cb('0x3e')](handleError(_0x4b5079,null));};exports['show']=function(_0x5bea9e,_0x2c9267){var _0x13e377={'raw':![],'where':{'id':_0x5bea9e[_0x01cb('0x3f')]['id']}},_0x1b4727={};_0x1b4727['model']=_['keys'](db[_0x01cb('0x28')][_0x01cb('0x40')]);_0x1b4727[_0x01cb('0x2b')]=_[_0x01cb('0x2c')](_0x5bea9e[_0x01cb('0x2b')]);_0x1b4727[_0x01cb('0x35')]=_[_0x01cb('0x2d')](_0x1b4727['model'],_0x1b4727[_0x01cb('0x2b')]);_0x13e377['attributes']=_[_0x01cb('0x2d')](_0x1b4727[_0x01cb('0x2f')],qs['fields'](_0x5bea9e[_0x01cb('0x2b')][_0x01cb('0x30')]));_0x13e377[_0x01cb('0x2e')]=_0x13e377[_0x01cb('0x2e')]['length']?_0x13e377[_0x01cb('0x2e')]:_0x1b4727['model'];if(_0x5bea9e[_0x01cb('0x2b')][_0x01cb('0x41')]){_0x13e377[_0x01cb('0x3c')]=[{'all':!![]}];}_0x13e377=_['merge']({},_0x13e377,_0x5bea9e[_0x01cb('0x3b')]);return db[_0x01cb('0x28')][_0x01cb('0x42')](_0x13e377)[_0x01cb('0x21')](handleEntityNotFound(_0x2c9267,null))[_0x01cb('0x21')](respondWithResult(_0x2c9267,null))[_0x01cb('0x3e')](handleError(_0x2c9267,null));};exports[_0x01cb('0x43')]=function(_0x242ede,_0x2c7472){return db[_0x01cb('0x28')][_0x01cb('0x43')](_0x242ede['body'],{})['then'](respondWithResult(_0x2c7472,0xc9))[_0x01cb('0x3e')](handleError(_0x2c7472,null));};exports[_0x01cb('0x20')]=function(_0x48ecdc,_0x453f0d){if(_0x48ecdc[_0x01cb('0x44')]['id']){delete _0x48ecdc['body']['id'];}return db[_0x01cb('0x28')]['find']({'where':{'id':_0x48ecdc['params']['id']}})[_0x01cb('0x21')](handleEntityNotFound(_0x453f0d,null))[_0x01cb('0x21')](saveUpdates(_0x48ecdc[_0x01cb('0x44')],null))[_0x01cb('0x21')](respondWithResult(_0x453f0d,null))[_0x01cb('0x3e')](handleError(_0x453f0d,null));};exports[_0x01cb('0x22')]=function(_0x574408,_0x13ebb2){return db[_0x01cb('0x28')][_0x01cb('0x42')]({'where':{'id':_0x574408[_0x01cb('0x3f')]['id']}})[_0x01cb('0x21')](handleEntityNotFound(_0x13ebb2,null))[_0x01cb('0x21')](removeEntity(_0x13ebb2,null))[_0x01cb('0x3e')](handleError(_0x13ebb2,null));};exports[_0x01cb('0x45')]=function(_0x1af64b,_0x4a1439){return db[_0x01cb('0x28')][_0x01cb('0x45')]()[_0x01cb('0x21')](respondWithResult(_0x4a1439,null))['catch'](handleError(_0x4a1439,null));}; \ No newline at end of file +var _0x3a9e=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x502862,_0x1eb130){var _0x6db73=function(_0x1ebf72){while(--_0x1ebf72){_0x502862['push'](_0x502862['shift']());}};_0x6db73(++_0x1eb130);}(_0x3a9e,0x11f));var _0xe3a9=function(_0x4ef7bc,_0x1e8207){_0x4ef7bc=_0x4ef7bc-0x0;var _0x30a74f=_0x3a9e[_0x4ef7bc];return _0x30a74f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe3a9('0x0'));var zipdir=require(_0xe3a9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe3a9('0x2'));var moment=require(_0xe3a9('0x3'));var BPromise=require(_0xe3a9('0x4'));var Mustache=require(_0xe3a9('0x5'));var util=require(_0xe3a9('0x6'));var path=require('path');var sox=require(_0xe3a9('0x7'));var csv=require(_0xe3a9('0x8'));var ejs=require(_0xe3a9('0x9'));var fs=require('fs');var fs_extra=require(_0xe3a9('0xa'));var _=require(_0xe3a9('0xb'));var squel=require(_0xe3a9('0xc'));var crypto=require(_0xe3a9('0xd'));var jsforce=require(_0xe3a9('0xe'));var deskjs=require(_0xe3a9('0xf'));var toCsv=require(_0xe3a9('0x8'));var querystring=require(_0xe3a9('0x10'));var Papa=require(_0xe3a9('0x11'));var Redis=require(_0xe3a9('0x12'));var authService=require(_0xe3a9('0x13'));var qs=require(_0xe3a9('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe3a9('0x15'));var logger=require(_0xe3a9('0x16'))('api');var utils=require(_0xe3a9('0x17'));var config=require(_0xe3a9('0x18'));var licenseUtil=require(_0xe3a9('0x19'));var db=require(_0xe3a9('0x1a'))['db'];function respondWithStatusCode(_0x4eb051,_0x45bc61){_0x45bc61=_0x45bc61||0xcc;return function(_0x5a2ab){if(_0x5a2ab){return _0x4eb051[_0xe3a9('0x1b')](_0x45bc61);}return _0x4eb051['status'](_0x45bc61)[_0xe3a9('0x1c')]();};}function respondWithResult(_0x54f07b,_0x5ee049){_0x5ee049=_0x5ee049||0xc8;return function(_0x29b5b2){if(_0x29b5b2){return _0x54f07b[_0xe3a9('0x1d')](_0x5ee049)[_0xe3a9('0x1e')](_0x29b5b2);}};}function respondWithFilteredResult(_0x1c267e,_0x1c117b){return function(_0x162646){if(_0x162646){var _0x7c6256=typeof _0x1c117b[_0xe3a9('0x1f')]===_0xe3a9('0x20')&&typeof _0x1c117b[_0xe3a9('0x21')]==='undefined';var _0x30f4bd=_0x162646[_0xe3a9('0x22')];var _0x1dcc62=_0x7c6256?0x0:_0x1c117b[_0xe3a9('0x1f')];var _0x498532=_0x7c6256?_0x162646[_0xe3a9('0x22')]:_0x1c117b[_0xe3a9('0x1f')]+_0x1c117b[_0xe3a9('0x21')];var _0x16924a;if(_0x498532>=_0x30f4bd){_0x498532=_0x30f4bd;_0x16924a=0xc8;}else{_0x16924a=0xce;}_0x1c267e['status'](_0x16924a);return _0x1c267e[_0xe3a9('0x23')](_0xe3a9('0x24'),_0x1dcc62+'-'+_0x498532+'/'+_0x30f4bd)[_0xe3a9('0x1e')](_0x162646);}return null;};}function patchUpdates(_0x525376){return function(_0x480111){try{jsonpatch[_0xe3a9('0x25')](_0x480111,_0x525376,!![]);}catch(_0x2c5810){return BPromise[_0xe3a9('0x26')](_0x2c5810);}return _0x480111['save']();};}function saveUpdates(_0x89b047,_0x263be4){return function(_0x218a2a){if(_0x218a2a){return _0x218a2a[_0xe3a9('0x27')](_0x89b047)[_0xe3a9('0x28')](function(_0x498ca0){return _0x498ca0;});}return null;};}function removeEntity(_0x460d54,_0xbfdff2){return function(_0x1d0060){if(_0x1d0060){return _0x1d0060[_0xe3a9('0x29')]()[_0xe3a9('0x28')](function(){_0x460d54[_0xe3a9('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c4a55,_0xcae9ab){return function(_0x4591db){if(!_0x4591db){_0x5c4a55[_0xe3a9('0x1b')](0x194);}return _0x4591db;};}function handleError(_0x5374e6,_0xb56132){_0xb56132=_0xb56132||0x1f4;return function(_0x4ae1a9){logger['error'](_0x4ae1a9['stack']);if(_0x4ae1a9[_0xe3a9('0x2a')]){delete _0x4ae1a9['name'];}_0x5374e6[_0xe3a9('0x1d')](_0xb56132)[_0xe3a9('0x2b')](_0x4ae1a9);};}exports[_0xe3a9('0x2c')]=function(_0x215fb3,_0x25438c){var _0x1afa4d={},_0x3a080d={},_0x30e8dd={'count':0x0,'rows':[]};var _0x3d1f09=_[_0xe3a9('0x2d')](db[_0xe3a9('0x2e')][_0xe3a9('0x2f')],function(_0x4d0e04){return{'name':_0x4d0e04[_0xe3a9('0x30')],'type':_0x4d0e04[_0xe3a9('0x31')]['key']};});_0x3a080d[_0xe3a9('0x32')]=_[_0xe3a9('0x2d')](_0x3d1f09,_0xe3a9('0x2a'));_0x3a080d['query']=_[_0xe3a9('0x33')](_0x215fb3['query']);_0x3a080d['filters']=_[_0xe3a9('0x34')](_0x3a080d[_0xe3a9('0x32')],_0x3a080d[_0xe3a9('0x35')]);_0x1afa4d[_0xe3a9('0x36')]=_['intersection'](_0x3a080d[_0xe3a9('0x32')],qs[_0xe3a9('0x37')](_0x215fb3[_0xe3a9('0x35')][_0xe3a9('0x37')]));_0x1afa4d['attributes']=_0x1afa4d[_0xe3a9('0x36')][_0xe3a9('0x38')]?_0x1afa4d['attributes']:_0x3a080d[_0xe3a9('0x32')];if(!_0x215fb3[_0xe3a9('0x35')][_0xe3a9('0x39')]('nolimit')){_0x1afa4d[_0xe3a9('0x21')]=qs[_0xe3a9('0x21')](_0x215fb3['query'][_0xe3a9('0x21')]);_0x1afa4d[_0xe3a9('0x1f')]=qs['offset'](_0x215fb3['query'][_0xe3a9('0x1f')]);}_0x1afa4d[_0xe3a9('0x3a')]=qs[_0xe3a9('0x3b')](_0x215fb3['query'][_0xe3a9('0x3b')]);_0x1afa4d['where']=qs['filters'](_[_0xe3a9('0x3c')](_0x215fb3['query'],_0x3a080d[_0xe3a9('0x3d')]),_0x3d1f09);if(_0x215fb3[_0xe3a9('0x35')][_0xe3a9('0x3e')]){_0x1afa4d[_0xe3a9('0x3f')]=_[_0xe3a9('0x40')](_0x1afa4d['where'],{'$or':_[_0xe3a9('0x2d')](_0x3d1f09,function(_0x5909f7){if(_0x5909f7['type']!==_0xe3a9('0x41')){var _0x5a86d8={};_0x5a86d8[_0x5909f7[_0xe3a9('0x2a')]]={'$like':'%'+_0x215fb3[_0xe3a9('0x35')]['filter']+'%'};return _0x5a86d8;}})});}_0x1afa4d=_['merge']({},_0x1afa4d,_0x215fb3[_0xe3a9('0x42')]);var _0x36b962={'where':_0x1afa4d[_0xe3a9('0x3f')]};return db[_0xe3a9('0x2e')]['count'](_0x36b962)[_0xe3a9('0x28')](function(_0x333b49){_0x30e8dd['count']=_0x333b49;if(_0x215fb3[_0xe3a9('0x35')][_0xe3a9('0x43')]){_0x1afa4d[_0xe3a9('0x44')]=[{'all':!![]}];}return db['IntegrationReport'][_0xe3a9('0x45')](_0x1afa4d);})[_0xe3a9('0x28')](function(_0x230cb5){_0x30e8dd[_0xe3a9('0x46')]=_0x230cb5;return _0x30e8dd;})['then'](respondWithFilteredResult(_0x25438c,_0x1afa4d))[_0xe3a9('0x47')](handleError(_0x25438c,null));};exports['show']=function(_0x35def6,_0x5c2afc){var _0x95000c={'raw':![],'where':{'id':_0x35def6[_0xe3a9('0x48')]['id']}},_0x2832c5={};_0x2832c5[_0xe3a9('0x32')]=_[_0xe3a9('0x33')](db[_0xe3a9('0x2e')][_0xe3a9('0x2f')]);_0x2832c5[_0xe3a9('0x35')]=_[_0xe3a9('0x33')](_0x35def6['query']);_0x2832c5[_0xe3a9('0x3d')]=_[_0xe3a9('0x34')](_0x2832c5['model'],_0x2832c5[_0xe3a9('0x35')]);_0x95000c[_0xe3a9('0x36')]=_[_0xe3a9('0x34')](_0x2832c5['model'],qs[_0xe3a9('0x37')](_0x35def6[_0xe3a9('0x35')][_0xe3a9('0x37')]));_0x95000c[_0xe3a9('0x36')]=_0x95000c[_0xe3a9('0x36')][_0xe3a9('0x38')]?_0x95000c[_0xe3a9('0x36')]:_0x2832c5[_0xe3a9('0x32')];if(_0x35def6[_0xe3a9('0x35')][_0xe3a9('0x43')]){_0x95000c[_0xe3a9('0x44')]=[{'all':!![]}];}_0x95000c=_['merge']({},_0x95000c,_0x35def6[_0xe3a9('0x42')]);return db['IntegrationReport'][_0xe3a9('0x49')](_0x95000c)['then'](handleEntityNotFound(_0x5c2afc,null))[_0xe3a9('0x28')](respondWithResult(_0x5c2afc,null))[_0xe3a9('0x47')](handleError(_0x5c2afc,null));};exports[_0xe3a9('0x4a')]=function(_0x14e299,_0x2defb3){return db[_0xe3a9('0x2e')][_0xe3a9('0x4a')](_0x14e299['body'],{})[_0xe3a9('0x28')](respondWithResult(_0x2defb3,0xc9))['catch'](handleError(_0x2defb3,null));};exports['update']=function(_0x268b28,_0xe5e7bc){if(_0x268b28[_0xe3a9('0x4b')]['id']){delete _0x268b28[_0xe3a9('0x4b')]['id'];}return db[_0xe3a9('0x2e')][_0xe3a9('0x49')]({'where':{'id':_0x268b28[_0xe3a9('0x48')]['id']}})[_0xe3a9('0x28')](handleEntityNotFound(_0xe5e7bc,null))[_0xe3a9('0x28')](saveUpdates(_0x268b28[_0xe3a9('0x4b')],null))[_0xe3a9('0x28')](respondWithResult(_0xe5e7bc,null))[_0xe3a9('0x47')](handleError(_0xe5e7bc,null));};exports[_0xe3a9('0x29')]=function(_0x8824e6,_0x21e5e1){return db[_0xe3a9('0x2e')][_0xe3a9('0x49')]({'where':{'id':_0x8824e6[_0xe3a9('0x48')]['id']}})[_0xe3a9('0x28')](handleEntityNotFound(_0x21e5e1,null))[_0xe3a9('0x28')](removeEntity(_0x21e5e1,null))[_0xe3a9('0x47')](handleError(_0x21e5e1,null));};exports[_0xe3a9('0x4c')]=function(_0x230309,_0x35dbf0){return db[_0xe3a9('0x2e')][_0xe3a9('0x4c')]()[_0xe3a9('0x28')](respondWithResult(_0x35dbf0,null))[_0xe3a9('0x47')](handleError(_0x35dbf0,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 846ba79..5b9043d 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 _0x9b8a=['rimraf','../../config/environment','./integrationReport.attributes','exports','IntegrationReport','report_integration','util','moment','bluebird','request-promise','path'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0x9b8a,0x1df));var _0xa9b8=function(_0xb8e1f2,_0x4c06a6){_0xb8e1f2=_0xb8e1f2-0x0;var _0xc37396=_0x9b8a[_0xb8e1f2];return _0xc37396;};'use strict';var _=require('lodash');var util=require(_0xa9b8('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xa9b8('0x1'));var BPromise=require(_0xa9b8('0x2'));var rp=require(_0xa9b8('0x3'));var fs=require('fs');var path=require(_0xa9b8('0x4'));var rimraf=require(_0xa9b8('0x5'));var config=require(_0xa9b8('0x6'));var attributes=require(_0xa9b8('0x7'));module[_0xa9b8('0x8')]=function(_0x596b14,_0x365682){return _0x596b14['define'](_0xa9b8('0x9'),attributes,{'tableName':_0xa9b8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e5e=['api','request-promise','exports','IntegrationReport','report_integration','lodash','util'];(function(_0x301d94,_0x38da63){var _0x51f2db=function(_0x5477fe){while(--_0x5477fe){_0x301d94['push'](_0x301d94['shift']());}};_0x51f2db(++_0x38da63);}(_0x4e5e,0x140));var _0xe4e5=function(_0x162808,_0x458be2){_0x162808=_0x162808-0x0;var _0x10134c=_0x4e5e[_0x162808];return _0x10134c;};'use strict';var _=require(_0xe4e5('0x0'));var util=require(_0xe4e5('0x1'));var logger=require('../../config/logger')(_0xe4e5('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe4e5('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./integrationReport.attributes');module[_0xe4e5('0x4')]=function(_0x57c4ea,_0x121098){return _0x57c4ea['define'](_0xe4e5('0x5'),attributes,{'tableName':_0xe4e5('0x6'),'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 9348388..c4fbe12 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 _0x1967=['then','info','IntegrationReport,\x20%s,\x20%s','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x8dc04d,_0xaa7559){var _0x2f5f28=function(_0xdd2d1d){while(--_0xdd2d1d){_0x8dc04d['push'](_0x8dc04d['shift']());}};_0x2f5f28(++_0xaa7559);}(_0x1967,0x173));var _0x7196=function(_0x2579db,_0x5f5ce1){_0x2579db=_0x2579db-0x0;var _0x66b7cd=_0x1967[_0x2579db];return _0x66b7cd;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194746,_0x40e0af,_0x266a6e){return new BPromise(function(_0xad78a,_0x510c72){return client[_0x7196('0xc')](_0x194746,_0x266a6e)[_0x7196('0xd')](function(_0x3f846e){logger[_0x7196('0xe')](_0x7196('0xf'),_0x40e0af,'request\x20sent');logger['debug'](_0x7196('0x10'),_0x40e0af,_0x7196('0x11'),JSON[_0x7196('0x12')](_0x3f846e));if(_0x3f846e[_0x7196('0x13')]){if(_0x3f846e[_0x7196('0x13')][_0x7196('0x14')]===0x1f4){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0x510c72(_0x3f846e[_0x7196('0x13')]['message']);}logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0xad78a(_0x3f846e['error'][_0x7196('0x15')]);}else{logger['info'](_0x7196('0xf'),_0x40e0af,_0x7196('0x11'));_0xad78a(_0x3f846e[_0x7196('0x16')][_0x7196('0x15')]);}})[_0x7196('0x17')](function(_0x2e3e0e){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x2e3e0e);_0x510c72(_0x2e3e0e);});});} \ No newline at end of file +var _0xe2fe=['then','info','IntegrationReport,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x394516,_0x23363f){var _0x1b0b45=function(_0x466f1a){while(--_0x466f1a){_0x394516['push'](_0x394516['shift']());}};_0x1b0b45(++_0x23363f);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xee2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var utils=require(_0xee2f('0x4'));var logger=require(_0xee2f('0x5'))(_0xee2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee2f('0x7'));var client=jayson[_0xee2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1533a0,_0x2e1c8c,_0x5a7975){return new BPromise(function(_0x3c4095,_0x5ea796){return client[_0xee2f('0x9')](_0x1533a0,_0x5a7975)[_0xee2f('0xa')](function(_0x53f7dd){logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,'request\x20sent');logger['debug']('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x2e1c8c,'request\x20sent',JSON[_0xee2f('0xd')](_0x53f7dd));if(_0x53f7dd['error']){if(_0x53f7dd['error']['code']===0x1f4){logger[_0xee2f('0xe')](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);return _0x5ea796(_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);}logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd['error'][_0xee2f('0xf')]);return _0x3c4095(_0x53f7dd[_0xee2f('0xe')]['message']);}else{logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,_0xee2f('0x10'));_0x3c4095(_0x53f7dd[_0xee2f('0x11')][_0xee2f('0xf')]);}})['catch'](function(_0x3f6372){logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x3f6372);_0x5ea796(_0x3f6372);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 3ebdb33..3346aa7 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 _0x0b9b=['addIntervals','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many'];(function(_0x235f74,_0x5ac77f){var _0x4aa50f=function(_0x29b3dc){while(--_0x29b3dc){_0x235f74['push'](_0x235f74['shift']());}};_0x4aa50f(++_0x5ac77f);}(_0x0b9b,0x1b9));var _0xb0b9=function(_0x141c12,_0x419361){_0x141c12=_0x141c12-0x0;var _0x3de606=_0x0b9b[_0x141c12];return _0x3de606;};'use strict';var multer=require(_0xb0b9('0x0'));var util=require(_0xb0b9('0x1'));var path=require(_0xb0b9('0x2'));var timeout=require('connect-timeout');var express=require(_0xb0b9('0x3'));var router=express[_0xb0b9('0x4')]();var fs_extra=require(_0xb0b9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb0b9('0x6'));var config=require(_0xb0b9('0x7'));var controller=require(_0xb0b9('0x8'));router[_0xb0b9('0x9')]('/',auth[_0xb0b9('0xa')](),controller[_0xb0b9('0xb')]);router['get'](_0xb0b9('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xb0b9('0x9')](_0xb0b9('0xd'),auth['isAuthenticated'](),controller[_0xb0b9('0xe')]);router[_0xb0b9('0xf')]('/',auth['isAuthenticated'](),controller[_0xb0b9('0x10')]);router[_0xb0b9('0xf')](_0xb0b9('0xd'),auth['isAuthenticated'](),controller[_0xb0b9('0x11')]);router[_0xb0b9('0xf')](_0xb0b9('0x12'),auth['isAuthenticated'](),controller[_0xb0b9('0x13')]);router['put'](_0xb0b9('0xc'),auth[_0xb0b9('0xa')](),controller[_0xb0b9('0x14')]);router[_0xb0b9('0x15')](_0xb0b9('0xc'),auth[_0xb0b9('0xa')](),controller[_0xb0b9('0x16')]);module['exports']=router; \ No newline at end of file +var _0xb383=['destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../config/environment','./interval.controller','get','/:id','show','/:id/sub_intervals','isAuthenticated','post','create','addInterval','/:id/sub_intervals/create_many','update'];(function(_0x19b04f,_0x1887cc){var _0x49a6d5=function(_0x2dd19b){while(--_0x2dd19b){_0x19b04f['push'](_0x19b04f['shift']());}};_0x49a6d5(++_0x1887cc);}(_0xb383,0x87));var _0x3b38=function(_0x1a79cc,_0x4bf5cb){_0x1a79cc=_0x1a79cc-0x0;var _0x52e636=_0xb383[_0x1a79cc];return _0x52e636;};'use strict';var multer=require(_0x3b38('0x0'));var util=require(_0x3b38('0x1'));var path=require('path');var timeout=require(_0x3b38('0x2'));var express=require('express');var router=express[_0x3b38('0x3')]();var fs_extra=require(_0x3b38('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3b38('0x5'));var controller=require(_0x3b38('0x6'));router[_0x3b38('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3b38('0x7')](_0x3b38('0x8'),auth['isAuthenticated'](),controller[_0x3b38('0x9')]);router['get'](_0x3b38('0xa'),auth[_0x3b38('0xb')](),controller['getIntervals']);router[_0x3b38('0xc')]('/',auth['isAuthenticated'](),controller[_0x3b38('0xd')]);router[_0x3b38('0xc')](_0x3b38('0xa'),auth[_0x3b38('0xb')](),controller[_0x3b38('0xe')]);router[_0x3b38('0xc')](_0x3b38('0xf'),auth['isAuthenticated'](),controller['addIntervals']);router['put'](_0x3b38('0x8'),auth[_0x3b38('0xb')](),controller[_0x3b38('0x10')]);router['delete'](_0x3b38('0x8'),auth[_0x3b38('0xb')](),controller[_0x3b38('0x11')]);module[_0x3b38('0x12')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 92f9f08..7613f61 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 _0xf743=['STRING','sequelize','exports'];(function(_0x3483bc,_0x3b9d83){var _0x41ea1b=function(_0x4ca451){while(--_0x4ca451){_0x3483bc['push'](_0x3483bc['shift']());}};_0x41ea1b(++_0x3b9d83);}(_0xf743,0x1ab));var _0x3f74=function(_0x3e3854,_0x4d12ed){_0x3e3854=_0x3e3854-0x0;var _0x41bd24=_0xf743[_0x3e3854];return _0x41bd24;};'use strict';var Sequelize=require(_0x3f74('0x0'));module[_0x3f74('0x1')]={'name':{'type':Sequelize[_0x3f74('0x2')]},'description':{'type':Sequelize[_0x3f74('0x2')]},'interval':{'type':Sequelize[_0x3f74('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xa9c0=['exports','STRING','sequelize'];(function(_0x2021d6,_0x5bfcae){var _0x4ca6ab=function(_0x103f5b){while(--_0x103f5b){_0x2021d6['push'](_0x2021d6['shift']());}};_0x4ca6ab(++_0x5bfcae);}(_0xa9c0,0x89));var _0x0a9c=function(_0x4a08ff,_0x4c23dd){_0x4a08ff=_0x4a08ff-0x0;var _0x404d1=_0xa9c0[_0x4a08ff];return _0x404d1;};'use strict';var Sequelize=require(_0x0a9c('0x0'));module[_0x0a9c('0x1')]={'name':{'type':Sequelize[_0x0a9c('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9c('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 e3aed83..58bbf38 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 _0xa3af=['eml-format','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','destroy','then','get','Intervals','error','name','send','index','map','Interval','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','catch','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addInterval','IntervalId','getIntervals','addIntervals','sequelize','transaction','bulkCreate'];(function(_0x18dd15,_0x252692){var _0x46719e=function(_0x29eba7){while(--_0x29eba7){_0x18dd15['push'](_0x18dd15['shift']());}};_0x46719e(++_0x252692);}(_0xa3af,0x11a));var _0xfa3a=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa3af[_0x2b4411];return _0x8e41ef;};'use strict';var emlformat=require(_0xfa3a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfa3a('0x1'));var rp=require('request-promise');var moment=require(_0xfa3a('0x2'));var BPromise=require(_0xfa3a('0x3'));var Mustache=require(_0xfa3a('0x4'));var util=require('util');var path=require(_0xfa3a('0x5'));var sox=require('sox');var csv=require(_0xfa3a('0x6'));var ejs=require(_0xfa3a('0x7'));var fs=require('fs');var fs_extra=require(_0xfa3a('0x8'));var _=require(_0xfa3a('0x9'));var squel=require(_0xfa3a('0xa'));var crypto=require(_0xfa3a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xfa3a('0xc'));var toCsv=require(_0xfa3a('0x6'));var querystring=require('querystring');var Papa=require(_0xfa3a('0xd'));var Redis=require(_0xfa3a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xfa3a('0xf'));var as=require(_0xfa3a('0x10'));var hardwareService=require(_0xfa3a('0x11'));var logger=require(_0xfa3a('0x12'))(_0xfa3a('0x13'));var utils=require(_0xfa3a('0x14'));var config=require(_0xfa3a('0x15'));var licenseUtil=require(_0xfa3a('0x16'));var db=require(_0xfa3a('0x17'))['db'];var extensions=require(_0xfa3a('0x18'));function respondWithStatusCode(_0x3408f5,_0x555d72){_0x555d72=_0x555d72||0xcc;return function(_0x4280ef){if(_0x4280ef){return _0x3408f5[_0xfa3a('0x19')](_0x555d72);}return _0x3408f5[_0xfa3a('0x1a')](_0x555d72)[_0xfa3a('0x1b')]();};}function respondWithResult(_0xa7e52a,_0x2cc2df){_0x2cc2df=_0x2cc2df||0xc8;return function(_0x2500bb){if(_0x2500bb){return _0xa7e52a[_0xfa3a('0x1a')](_0x2cc2df)[_0xfa3a('0x1c')](_0x2500bb);}};}function respondWithFilteredResult(_0x4e3f8e,_0x2204da){return function(_0x523328){if(_0x523328){var _0x2b6bc9=typeof _0x2204da[_0xfa3a('0x1d')]===_0xfa3a('0x1e')&&typeof _0x2204da[_0xfa3a('0x1f')]===_0xfa3a('0x1e');var _0x5f300=_0x523328['count'];var _0x44dac2=_0x2b6bc9?0x0:_0x2204da[_0xfa3a('0x1d')];var _0x3e71d7=_0x2b6bc9?_0x523328['count']:_0x2204da[_0xfa3a('0x1d')]+_0x2204da['limit'];var _0x1415e7;if(_0x3e71d7>=_0x5f300){_0x3e71d7=_0x5f300;_0x1415e7=0xc8;}else{_0x1415e7=0xce;}_0x4e3f8e['status'](_0x1415e7);return _0x4e3f8e[_0xfa3a('0x20')](_0xfa3a('0x21'),_0x44dac2+'-'+_0x3e71d7+'/'+_0x5f300)[_0xfa3a('0x1c')](_0x523328);}return null;};}function patchUpdates(_0x166365){return function(_0x4b4f34){try{jsonpatch[_0xfa3a('0x22')](_0x4b4f34,_0x166365,!![]);}catch(_0x49e9f8){return BPromise[_0xfa3a('0x23')](_0x49e9f8);}return _0x4b4f34[_0xfa3a('0x24')]();};}function saveUpdates(_0x5bfe1f,_0x540c6b){return function(_0x2ef083){if(_0x2ef083){return _0x2ef083['update'](_0x5bfe1f)['then'](function(_0x323109){return _0x323109;});}return null;};}function removeEntity(_0x2b88f7,_0x520875){return function(_0x2250ad){if(_0x2250ad){return _0x2250ad[_0xfa3a('0x25')]()[_0xfa3a('0x26')](function(){var _0x5d4fa5=_0x2250ad[_0xfa3a('0x27')]({'plain':!![]});var _0x33052d=_0xfa3a('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x33052d,'resourceId':_0x5d4fa5['id']}})[_0xfa3a('0x26')](function(){return _0x2250ad;});})[_0xfa3a('0x26')](function(){_0x2b88f7[_0xfa3a('0x1a')](0xcc)[_0xfa3a('0x1b')]();});}};}function handleEntityNotFound(_0x1f5257,_0x5909b4){return function(_0x8d047){if(!_0x8d047){_0x1f5257[_0xfa3a('0x19')](0x194);}return _0x8d047;};}function handleError(_0x5470a2,_0x435376){_0x435376=_0x435376||0x1f4;return function(_0x4bc3a3){logger[_0xfa3a('0x29')](_0x4bc3a3['stack']);if(_0x4bc3a3[_0xfa3a('0x2a')]){delete _0x4bc3a3[_0xfa3a('0x2a')];}_0x5470a2[_0xfa3a('0x1a')](_0x435376)[_0xfa3a('0x2b')](_0x4bc3a3);};}exports[_0xfa3a('0x2c')]=function(_0x587738,_0x317ef8){var _0x4a2524={},_0x1b8453={},_0x4014fa={'count':0x0,'rows':[]};var _0x136034=_[_0xfa3a('0x2d')](db[_0xfa3a('0x2e')]['rawAttributes'],function(_0x282f94){return{'name':_0x282f94[_0xfa3a('0x2f')],'type':_0x282f94[_0xfa3a('0x30')][_0xfa3a('0x31')]};});_0x1b8453[_0xfa3a('0x32')]=_[_0xfa3a('0x2d')](_0x136034,_0xfa3a('0x2a'));_0x1b8453[_0xfa3a('0x33')]=_[_0xfa3a('0x34')](_0x587738['query']);_0x1b8453[_0xfa3a('0x35')]=_['intersection'](_0x1b8453[_0xfa3a('0x32')],_0x1b8453[_0xfa3a('0x33')]);_0x4a2524['attributes']=_[_0xfa3a('0x36')](_0x1b8453[_0xfa3a('0x32')],qs[_0xfa3a('0x37')](_0x587738[_0xfa3a('0x33')][_0xfa3a('0x37')]));_0x4a2524['attributes']=_0x4a2524[_0xfa3a('0x38')][_0xfa3a('0x39')]?_0x4a2524['attributes']:_0x1b8453[_0xfa3a('0x32')];if(!_0x587738[_0xfa3a('0x33')][_0xfa3a('0x3a')](_0xfa3a('0x3b'))){_0x4a2524[_0xfa3a('0x1f')]=qs[_0xfa3a('0x1f')](_0x587738[_0xfa3a('0x33')][_0xfa3a('0x1f')]);_0x4a2524[_0xfa3a('0x1d')]=qs[_0xfa3a('0x1d')](_0x587738['query'][_0xfa3a('0x1d')]);}_0x4a2524[_0xfa3a('0x3c')]=qs[_0xfa3a('0x3d')](_0x587738[_0xfa3a('0x33')][_0xfa3a('0x3d')]);_0x4a2524[_0xfa3a('0x3e')]=qs[_0xfa3a('0x35')](_[_0xfa3a('0x3f')](_0x587738[_0xfa3a('0x33')],_0x1b8453['filters']),_0x136034);if(_0x587738[_0xfa3a('0x33')]['filter']){_0x4a2524[_0xfa3a('0x3e')]=_[_0xfa3a('0x40')](_0x4a2524[_0xfa3a('0x3e')],{'$or':_[_0xfa3a('0x2d')](_0x136034,function(_0x96eac4){if(_0x96eac4[_0xfa3a('0x30')]!==_0xfa3a('0x41')){var _0x43af45={};_0x43af45[_0x96eac4[_0xfa3a('0x2a')]]={'$like':'%'+_0x587738[_0xfa3a('0x33')][_0xfa3a('0x42')]+'%'};return _0x43af45;}})});}_0x4a2524=_[_0xfa3a('0x40')]({},_0x4a2524,_0x587738[_0xfa3a('0x43')]);var _0x282a1a={'where':_0x4a2524['where']};return db[_0xfa3a('0x2e')]['count'](_0x282a1a)['then'](function(_0xa1ffb2){_0x4014fa[_0xfa3a('0x44')]=_0xa1ffb2;if(_0x587738[_0xfa3a('0x33')][_0xfa3a('0x45')]){_0x4a2524[_0xfa3a('0x46')]=[{'all':!![]}];}return db['Interval'][_0xfa3a('0x47')](_0x4a2524);})[_0xfa3a('0x26')](function(_0x567974){_0x4014fa['rows']=_0x567974;return _0x4014fa;})[_0xfa3a('0x26')](respondWithFilteredResult(_0x317ef8,_0x4a2524))[_0xfa3a('0x48')](handleError(_0x317ef8,null));};exports['show']=function(_0x3c18af,_0x1ffc37){var _0x2c6837={'raw':!![],'where':{'id':_0x3c18af[_0xfa3a('0x49')]['id']}},_0xadd14a={};_0xadd14a[_0xfa3a('0x32')]=_['keys'](db[_0xfa3a('0x2e')][_0xfa3a('0x4a')]);_0xadd14a[_0xfa3a('0x33')]=_[_0xfa3a('0x34')](_0x3c18af[_0xfa3a('0x33')]);_0xadd14a['filters']=_[_0xfa3a('0x36')](_0xadd14a[_0xfa3a('0x32')],_0xadd14a[_0xfa3a('0x33')]);_0x2c6837[_0xfa3a('0x38')]=_[_0xfa3a('0x36')](_0xadd14a[_0xfa3a('0x32')],qs['fields'](_0x3c18af[_0xfa3a('0x33')][_0xfa3a('0x37')]));_0x2c6837[_0xfa3a('0x38')]=_0x2c6837[_0xfa3a('0x38')]['length']?_0x2c6837[_0xfa3a('0x38')]:_0xadd14a[_0xfa3a('0x32')];if(_0x3c18af[_0xfa3a('0x33')][_0xfa3a('0x45')]){_0x2c6837[_0xfa3a('0x46')]=[{'all':!![]}];}_0x2c6837=_[_0xfa3a('0x40')]({},_0x2c6837,_0x3c18af[_0xfa3a('0x43')]);return db['Interval'][_0xfa3a('0x4b')](_0x2c6837)[_0xfa3a('0x26')](handleEntityNotFound(_0x1ffc37,null))[_0xfa3a('0x26')](respondWithResult(_0x1ffc37,null))[_0xfa3a('0x48')](handleError(_0x1ffc37,null));};exports[_0xfa3a('0x4c')]=function(_0x49d348,_0x5bb364){return db[_0xfa3a('0x2e')][_0xfa3a('0x4c')](_0x49d348[_0xfa3a('0x4d')],{})[_0xfa3a('0x26')](function(_0x3e1be8){var _0x463653=_0x49d348[_0xfa3a('0x4e')]['get']({'plain':!![]});if(!_0x463653)throw new Error(_0xfa3a('0x4f'));if(_0x463653[_0xfa3a('0x50')]===_0xfa3a('0x4e')){var _0x9a95e7=_0x3e1be8[_0xfa3a('0x27')]({'plain':!![]});var _0x1cd121=_0xfa3a('0x28');return db[_0xfa3a('0x51')][_0xfa3a('0x4b')]({'where':{'name':_0x1cd121,'userProfileId':_0x463653[_0xfa3a('0x52')]},'raw':!![]})[_0xfa3a('0x26')](function(_0x9a053b){if(_0x9a053b&&_0x9a053b[_0xfa3a('0x53')]===0x0){return db[_0xfa3a('0x54')]['create']({'name':_0x9a95e7[_0xfa3a('0x2a')],'resourceId':_0x9a95e7['id'],'type':_0x9a053b['name'],'sectionId':_0x9a053b['id']},{})[_0xfa3a('0x26')](function(){return _0x3e1be8;});}else{return _0x3e1be8;}})[_0xfa3a('0x48')](function(_0x25611e){logger[_0xfa3a('0x29')](_0xfa3a('0x55'),_0x25611e);throw _0x25611e;});}return _0x3e1be8;})[_0xfa3a('0x26')](respondWithResult(_0x5bb364,0xc9))['catch'](handleError(_0x5bb364,null));};exports[_0xfa3a('0x56')]=function(_0x575967,_0x5e6ff8){if(_0x575967[_0xfa3a('0x4d')]['id']){delete _0x575967[_0xfa3a('0x4d')]['id'];}return db[_0xfa3a('0x2e')]['find']({'where':{'id':_0x575967['params']['id']}})[_0xfa3a('0x26')](handleEntityNotFound(_0x5e6ff8,null))['then'](saveUpdates(_0x575967[_0xfa3a('0x4d')],null))[_0xfa3a('0x26')](respondWithResult(_0x5e6ff8,null))['catch'](handleError(_0x5e6ff8,null));};exports[_0xfa3a('0x25')]=function(_0x42f933,_0x552d72){return db[_0xfa3a('0x2e')][_0xfa3a('0x4b')]({'where':{'id':_0x42f933[_0xfa3a('0x49')]['id']}})[_0xfa3a('0x26')](handleEntityNotFound(_0x552d72,null))[_0xfa3a('0x26')](removeEntity(_0x552d72,null))[_0xfa3a('0x48')](handleError(_0x552d72,null));};exports[_0xfa3a('0x57')]=function(_0x328cc2,_0x496dd8,_0x4368d8){if(_0x328cc2[_0xfa3a('0x4d')]['id']){delete _0x328cc2[_0xfa3a('0x4d')]['id'];}return db[_0xfa3a('0x2e')][_0xfa3a('0x4b')]({'where':{'id':_0x328cc2[_0xfa3a('0x49')]['id']}})[_0xfa3a('0x26')](handleEntityNotFound(_0x496dd8,null))['then'](function(_0x18e410){if(_0x18e410){_0x328cc2[_0xfa3a('0x4d')][_0xfa3a('0x58')]=_0x18e410['id'];return db['Interval'][_0xfa3a('0x4c')](_0x328cc2[_0xfa3a('0x4d')]);}})[_0xfa3a('0x26')](respondWithResult(_0x496dd8,null))[_0xfa3a('0x48')](handleError(_0x496dd8,null));};exports[_0xfa3a('0x59')]=function(_0x43172a,_0x441358,_0x220199){var _0xedafef={};var _0x1fd182={};var _0x420224;var _0x106e1b;return db[_0xfa3a('0x2e')]['findOne']({'where':{'id':_0x43172a[_0xfa3a('0x49')]['id']}})[_0xfa3a('0x26')](handleEntityNotFound(_0x441358,null))['then'](function(_0x3a31a8){if(_0x3a31a8){_0x420224=_0x3a31a8;_0x1fd182[_0xfa3a('0x32')]=_[_0xfa3a('0x34')](db[_0xfa3a('0x2e')][_0xfa3a('0x4a')]);_0x1fd182['query']=_['keys'](_0x43172a[_0xfa3a('0x33')]);_0x1fd182['filters']=_[_0xfa3a('0x36')](_0x1fd182[_0xfa3a('0x32')],_0x1fd182['query']);_0xedafef[_0xfa3a('0x38')]=_[_0xfa3a('0x36')](_0x1fd182[_0xfa3a('0x32')],qs[_0xfa3a('0x37')](_0x43172a[_0xfa3a('0x33')][_0xfa3a('0x37')]));_0xedafef['attributes']=_0xedafef[_0xfa3a('0x38')][_0xfa3a('0x39')]?_0xedafef[_0xfa3a('0x38')]:_0x1fd182[_0xfa3a('0x32')];_0xedafef['order']=qs[_0xfa3a('0x3d')](_0x43172a[_0xfa3a('0x33')][_0xfa3a('0x3d')]);_0xedafef[_0xfa3a('0x3e')]=qs[_0xfa3a('0x35')](_[_0xfa3a('0x3f')](_0x43172a[_0xfa3a('0x33')],_0x1fd182['filters']));if(_0x43172a[_0xfa3a('0x33')]['filter']){_0xedafef[_0xfa3a('0x3e')]=_[_0xfa3a('0x40')](_0xedafef[_0xfa3a('0x3e')],{'$or':_[_0xfa3a('0x2d')](_0xedafef['attributes'],function(_0x5041a6){var _0x2d6922={};_0x2d6922[_0x5041a6]={'$like':'%'+_0x43172a[_0xfa3a('0x33')]['filter']+'%'};return _0x2d6922;})});}_0xedafef=_[_0xfa3a('0x40')]({},_0xedafef,_0x43172a[_0xfa3a('0x43')]);return _0x420224[_0xfa3a('0x59')](_0xedafef);}})[_0xfa3a('0x26')](function(_0x124085){if(_0x124085){_0x106e1b=_0x124085[_0xfa3a('0x39')];if(!_0x43172a['query'][_0xfa3a('0x3a')](_0xfa3a('0x3b'))){_0xedafef['limit']=qs['limit'](_0x43172a[_0xfa3a('0x33')]['limit']);_0xedafef[_0xfa3a('0x1d')]=qs[_0xfa3a('0x1d')](_0x43172a['query']['offset']);}return _0x420224[_0xfa3a('0x59')](_0xedafef);}})[_0xfa3a('0x26')](function(_0x55c328){if(_0x55c328){return _0x55c328?{'count':_0x106e1b,'rows':_0x55c328}:null;}})[_0xfa3a('0x26')](respondWithResult(_0x441358,null))['catch'](handleError(_0x441358,null));};exports[_0xfa3a('0x5a')]=function(_0x52ca81,_0x35d0aa,_0x5204c2){return db[_0xfa3a('0x2e')]['findOne']({'where':{'id':_0x52ca81['params']['id']}})[_0xfa3a('0x26')](handleEntityNotFound(_0x35d0aa,null))[_0xfa3a('0x26')](function(_0x24ac9e){if(_0x24ac9e){return db[_0xfa3a('0x5b')][_0xfa3a('0x5c')](function(_0x381cb0){return db[_0xfa3a('0x2e')]['destroy']({'where':{'IntervalId':_0x52ca81[_0xfa3a('0x49')]['id']},'transaction':_0x381cb0})[_0xfa3a('0x26')](function(_0x34a75d){var _0x20b7cb=_[_0xfa3a('0x2d')](_0x52ca81[_0xfa3a('0x4d')],function(_0x4e0171){delete _0x4e0171['id'];_0x4e0171[_0xfa3a('0x58')]=_0x52ca81[_0xfa3a('0x49')]['id'];return _0x4e0171;});return db['Interval'][_0xfa3a('0x5d')](_0x20b7cb,{'transaction':_0x381cb0});});})[_0xfa3a('0x26')](function(){return db['Interval'][_0xfa3a('0x47')]({'where':{'IntervalId':_0x52ca81['params']['id']}});});}})[_0xfa3a('0x26')](respondWithResult(_0x35d0aa,null))[_0xfa3a('0x48')](handleError(_0x35d0aa,null));}; \ No newline at end of file +var _0x5bf0=['end','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','get','Intervals','UserProfileResource','stack','name','index','map','Interval','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','include','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','update','params','IntervalId','getIntervals','findOne','addIntervals','sequelize','bulkCreate','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status'];(function(_0x38fe62,_0x2e614a){var _0x2e87ac=function(_0x3c8d52){while(--_0x3c8d52){_0x38fe62['push'](_0x38fe62['shift']());}};_0x2e87ac(++_0x2e614a);}(_0x5bf0,0x97));var _0x05bf=function(_0x2a7b8e,_0x5997d3){_0x2a7b8e=_0x2a7b8e-0x0;var _0x423cab=_0x5bf0[_0x2a7b8e];return _0x423cab;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x05bf('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x05bf('0x1'));var rp=require(_0x05bf('0x2'));var moment=require(_0x05bf('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x05bf('0x4'));var util=require('util');var path=require(_0x05bf('0x5'));var sox=require(_0x05bf('0x6'));var csv=require('to-csv');var ejs=require(_0x05bf('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x05bf('0x8'));var squel=require(_0x05bf('0x9'));var crypto=require(_0x05bf('0xa'));var jsforce=require(_0x05bf('0xb'));var deskjs=require(_0x05bf('0xc'));var toCsv=require(_0x05bf('0xd'));var querystring=require('querystring');var Papa=require(_0x05bf('0xe'));var Redis=require(_0x05bf('0xf'));var authService=require(_0x05bf('0x10'));var qs=require(_0x05bf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x05bf('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x05bf('0x13'));var config=require(_0x05bf('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x05bf('0x15'))['db'];var extensions=require(_0x05bf('0x16'));function respondWithStatusCode(_0x1a3d8b,_0x5ab6b5){_0x5ab6b5=_0x5ab6b5||0xcc;return function(_0x58d104){if(_0x58d104){return _0x1a3d8b[_0x05bf('0x17')](_0x5ab6b5);}return _0x1a3d8b[_0x05bf('0x18')](_0x5ab6b5)[_0x05bf('0x19')]();};}function respondWithResult(_0x4e25d2,_0x32bf90){_0x32bf90=_0x32bf90||0xc8;return function(_0x3b3533){if(_0x3b3533){return _0x4e25d2[_0x05bf('0x18')](_0x32bf90)[_0x05bf('0x1a')](_0x3b3533);}};}function respondWithFilteredResult(_0x15eb6e,_0x365654){return function(_0x35f73d){if(_0x35f73d){var _0x23fe99=typeof _0x365654[_0x05bf('0x1b')]===_0x05bf('0x1c')&&typeof _0x365654[_0x05bf('0x1d')]===_0x05bf('0x1c');var _0x3e1028=_0x35f73d[_0x05bf('0x1e')];var _0x527b8f=_0x23fe99?0x0:_0x365654['offset'];var _0x2594b4=_0x23fe99?_0x35f73d['count']:_0x365654[_0x05bf('0x1b')]+_0x365654[_0x05bf('0x1d')];var _0x437c73;if(_0x2594b4>=_0x3e1028){_0x2594b4=_0x3e1028;_0x437c73=0xc8;}else{_0x437c73=0xce;}_0x15eb6e[_0x05bf('0x18')](_0x437c73);return _0x15eb6e[_0x05bf('0x1f')](_0x05bf('0x20'),_0x527b8f+'-'+_0x2594b4+'/'+_0x3e1028)[_0x05bf('0x1a')](_0x35f73d);}return null;};}function patchUpdates(_0x262668){return function(_0x214e9c){try{jsonpatch['apply'](_0x214e9c,_0x262668,!![]);}catch(_0xeabde){return BPromise['reject'](_0xeabde);}return _0x214e9c[_0x05bf('0x21')]();};}function saveUpdates(_0x693545,_0x9b5d7c){return function(_0x12a42f){if(_0x12a42f){return _0x12a42f['update'](_0x693545)[_0x05bf('0x22')](function(_0x5c5a36){return _0x5c5a36;});}return null;};}function removeEntity(_0x20f78e,_0x1aae92){return function(_0x587b88){if(_0x587b88){return _0x587b88[_0x05bf('0x23')]()[_0x05bf('0x22')](function(){var _0x53d510=_0x587b88[_0x05bf('0x24')]({'plain':!![]});var _0x5b01c0=_0x05bf('0x25');return db[_0x05bf('0x26')][_0x05bf('0x23')]({'where':{'type':_0x5b01c0,'resourceId':_0x53d510['id']}})[_0x05bf('0x22')](function(){return _0x587b88;});})[_0x05bf('0x22')](function(){_0x20f78e[_0x05bf('0x18')](0xcc)[_0x05bf('0x19')]();});}};}function handleEntityNotFound(_0x1b52d8,_0x596b98){return function(_0x158530){if(!_0x158530){_0x1b52d8[_0x05bf('0x17')](0x194);}return _0x158530;};}function handleError(_0x144dcb,_0x3b83a7){_0x3b83a7=_0x3b83a7||0x1f4;return function(_0x305f47){logger['error'](_0x305f47[_0x05bf('0x27')]);if(_0x305f47[_0x05bf('0x28')]){delete _0x305f47[_0x05bf('0x28')];}_0x144dcb[_0x05bf('0x18')](_0x3b83a7)['send'](_0x305f47);};}exports[_0x05bf('0x29')]=function(_0x4236fc,_0x189935){var _0x52a071={},_0x541ca7={},_0x164d1c={'count':0x0,'rows':[]};var _0x1e2aa6=_[_0x05bf('0x2a')](db[_0x05bf('0x2b')][_0x05bf('0x2c')],function(_0x4f763e){return{'name':_0x4f763e[_0x05bf('0x2d')],'type':_0x4f763e[_0x05bf('0x2e')]['key']};});_0x541ca7['model']=_[_0x05bf('0x2a')](_0x1e2aa6,'name');_0x541ca7[_0x05bf('0x2f')]=_[_0x05bf('0x30')](_0x4236fc[_0x05bf('0x2f')]);_0x541ca7[_0x05bf('0x31')]=_[_0x05bf('0x32')](_0x541ca7['model'],_0x541ca7[_0x05bf('0x2f')]);_0x52a071[_0x05bf('0x33')]=_[_0x05bf('0x32')](_0x541ca7[_0x05bf('0x34')],qs[_0x05bf('0x35')](_0x4236fc[_0x05bf('0x2f')][_0x05bf('0x35')]));_0x52a071['attributes']=_0x52a071[_0x05bf('0x33')][_0x05bf('0x36')]?_0x52a071['attributes']:_0x541ca7[_0x05bf('0x34')];if(!_0x4236fc[_0x05bf('0x2f')][_0x05bf('0x37')]('nolimit')){_0x52a071[_0x05bf('0x1d')]=qs[_0x05bf('0x1d')](_0x4236fc[_0x05bf('0x2f')]['limit']);_0x52a071[_0x05bf('0x1b')]=qs['offset'](_0x4236fc[_0x05bf('0x2f')][_0x05bf('0x1b')]);}_0x52a071[_0x05bf('0x38')]=qs[_0x05bf('0x39')](_0x4236fc[_0x05bf('0x2f')][_0x05bf('0x39')]);_0x52a071[_0x05bf('0x3a')]=qs[_0x05bf('0x31')](_[_0x05bf('0x3b')](_0x4236fc[_0x05bf('0x2f')],_0x541ca7['filters']),_0x1e2aa6);if(_0x4236fc[_0x05bf('0x2f')][_0x05bf('0x3c')]){_0x52a071['where']=_[_0x05bf('0x3d')](_0x52a071[_0x05bf('0x3a')],{'$or':_[_0x05bf('0x2a')](_0x1e2aa6,function(_0x53422d){if(_0x53422d[_0x05bf('0x2e')]!==_0x05bf('0x3e')){var _0x501d69={};_0x501d69[_0x53422d[_0x05bf('0x28')]]={'$like':'%'+_0x4236fc[_0x05bf('0x2f')][_0x05bf('0x3c')]+'%'};return _0x501d69;}})});}_0x52a071=_[_0x05bf('0x3d')]({},_0x52a071,_0x4236fc['options']);var _0x1e1a40={'where':_0x52a071[_0x05bf('0x3a')]};return db[_0x05bf('0x2b')][_0x05bf('0x1e')](_0x1e1a40)[_0x05bf('0x22')](function(_0x7aefee){_0x164d1c['count']=_0x7aefee;if(_0x4236fc[_0x05bf('0x2f')][_0x05bf('0x3f')]){_0x52a071['include']=[{'all':!![]}];}return db[_0x05bf('0x2b')][_0x05bf('0x40')](_0x52a071);})[_0x05bf('0x22')](function(_0x534ddd){_0x164d1c[_0x05bf('0x41')]=_0x534ddd;return _0x164d1c;})['then'](respondWithFilteredResult(_0x189935,_0x52a071))[_0x05bf('0x42')](handleError(_0x189935,null));};exports[_0x05bf('0x43')]=function(_0x4a9bd3,_0x2d7c5e){var _0x40faa2={'raw':!![],'where':{'id':_0x4a9bd3['params']['id']}},_0x1a45c8={};_0x1a45c8['model']=_[_0x05bf('0x30')](db[_0x05bf('0x2b')][_0x05bf('0x2c')]);_0x1a45c8[_0x05bf('0x2f')]=_[_0x05bf('0x30')](_0x4a9bd3['query']);_0x1a45c8[_0x05bf('0x31')]=_[_0x05bf('0x32')](_0x1a45c8[_0x05bf('0x34')],_0x1a45c8['query']);_0x40faa2['attributes']=_['intersection'](_0x1a45c8[_0x05bf('0x34')],qs[_0x05bf('0x35')](_0x4a9bd3[_0x05bf('0x2f')][_0x05bf('0x35')]));_0x40faa2['attributes']=_0x40faa2[_0x05bf('0x33')][_0x05bf('0x36')]?_0x40faa2[_0x05bf('0x33')]:_0x1a45c8[_0x05bf('0x34')];if(_0x4a9bd3['query'][_0x05bf('0x3f')]){_0x40faa2[_0x05bf('0x44')]=[{'all':!![]}];}_0x40faa2=_[_0x05bf('0x3d')]({},_0x40faa2,_0x4a9bd3[_0x05bf('0x45')]);return db[_0x05bf('0x2b')][_0x05bf('0x46')](_0x40faa2)[_0x05bf('0x22')](handleEntityNotFound(_0x2d7c5e,null))[_0x05bf('0x22')](respondWithResult(_0x2d7c5e,null))[_0x05bf('0x42')](handleError(_0x2d7c5e,null));};exports[_0x05bf('0x47')]=function(_0x37adbe,_0x24e21a){return db[_0x05bf('0x2b')]['create'](_0x37adbe[_0x05bf('0x48')],{})['then'](function(_0x5bb5c1){var _0xc4fc8c=_0x37adbe['user']['get']({'plain':!![]});if(!_0xc4fc8c)throw new Error(_0x05bf('0x49'));if(_0xc4fc8c[_0x05bf('0x4a')]===_0x05bf('0x4b')){var _0x5bd113=_0x5bb5c1[_0x05bf('0x24')]({'plain':!![]});var _0x92c268='Intervals';return db[_0x05bf('0x4c')][_0x05bf('0x46')]({'where':{'name':_0x92c268,'userProfileId':_0xc4fc8c[_0x05bf('0x4d')]},'raw':!![]})[_0x05bf('0x22')](function(_0x3266d5){if(_0x3266d5&&_0x3266d5[_0x05bf('0x4e')]===0x0){return db[_0x05bf('0x26')][_0x05bf('0x47')]({'name':_0x5bd113[_0x05bf('0x28')],'resourceId':_0x5bd113['id'],'type':_0x3266d5[_0x05bf('0x28')],'sectionId':_0x3266d5['id']},{})[_0x05bf('0x22')](function(){return _0x5bb5c1;});}else{return _0x5bb5c1;}})[_0x05bf('0x42')](function(_0xf6c0f8){logger[_0x05bf('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf6c0f8);throw _0xf6c0f8;});}return _0x5bb5c1;})[_0x05bf('0x22')](respondWithResult(_0x24e21a,0xc9))[_0x05bf('0x42')](handleError(_0x24e21a,null));};exports[_0x05bf('0x50')]=function(_0x1a4ac1,_0x498a0d){if(_0x1a4ac1[_0x05bf('0x48')]['id']){delete _0x1a4ac1[_0x05bf('0x48')]['id'];}return db['Interval'][_0x05bf('0x46')]({'where':{'id':_0x1a4ac1[_0x05bf('0x51')]['id']}})[_0x05bf('0x22')](handleEntityNotFound(_0x498a0d,null))['then'](saveUpdates(_0x1a4ac1[_0x05bf('0x48')],null))[_0x05bf('0x22')](respondWithResult(_0x498a0d,null))[_0x05bf('0x42')](handleError(_0x498a0d,null));};exports['destroy']=function(_0x331c88,_0x5753c2){return db['Interval'][_0x05bf('0x46')]({'where':{'id':_0x331c88[_0x05bf('0x51')]['id']}})[_0x05bf('0x22')](handleEntityNotFound(_0x5753c2,null))[_0x05bf('0x22')](removeEntity(_0x5753c2,null))[_0x05bf('0x42')](handleError(_0x5753c2,null));};exports['addInterval']=function(_0x4048e0,_0x17dc59,_0x378932){if(_0x4048e0['body']['id']){delete _0x4048e0[_0x05bf('0x48')]['id'];}return db[_0x05bf('0x2b')][_0x05bf('0x46')]({'where':{'id':_0x4048e0['params']['id']}})[_0x05bf('0x22')](handleEntityNotFound(_0x17dc59,null))[_0x05bf('0x22')](function(_0x2dd43f){if(_0x2dd43f){_0x4048e0[_0x05bf('0x48')][_0x05bf('0x52')]=_0x2dd43f['id'];return db[_0x05bf('0x2b')][_0x05bf('0x47')](_0x4048e0['body']);}})[_0x05bf('0x22')](respondWithResult(_0x17dc59,null))[_0x05bf('0x42')](handleError(_0x17dc59,null));};exports[_0x05bf('0x53')]=function(_0x2ae2a3,_0x1641e5,_0x208759){var _0x578ebc={};var _0x37c8e4={};var _0x266164;var _0x4975d4;return db['Interval'][_0x05bf('0x54')]({'where':{'id':_0x2ae2a3[_0x05bf('0x51')]['id']}})[_0x05bf('0x22')](handleEntityNotFound(_0x1641e5,null))[_0x05bf('0x22')](function(_0x22690a){if(_0x22690a){_0x266164=_0x22690a;_0x37c8e4[_0x05bf('0x34')]=_[_0x05bf('0x30')](db['Interval'][_0x05bf('0x2c')]);_0x37c8e4[_0x05bf('0x2f')]=_[_0x05bf('0x30')](_0x2ae2a3[_0x05bf('0x2f')]);_0x37c8e4['filters']=_['intersection'](_0x37c8e4['model'],_0x37c8e4[_0x05bf('0x2f')]);_0x578ebc[_0x05bf('0x33')]=_[_0x05bf('0x32')](_0x37c8e4[_0x05bf('0x34')],qs[_0x05bf('0x35')](_0x2ae2a3['query']['fields']));_0x578ebc[_0x05bf('0x33')]=_0x578ebc['attributes'][_0x05bf('0x36')]?_0x578ebc[_0x05bf('0x33')]:_0x37c8e4[_0x05bf('0x34')];_0x578ebc['order']=qs['sort'](_0x2ae2a3[_0x05bf('0x2f')][_0x05bf('0x39')]);_0x578ebc[_0x05bf('0x3a')]=qs[_0x05bf('0x31')](_[_0x05bf('0x3b')](_0x2ae2a3[_0x05bf('0x2f')],_0x37c8e4[_0x05bf('0x31')]));if(_0x2ae2a3[_0x05bf('0x2f')][_0x05bf('0x3c')]){_0x578ebc['where']=_[_0x05bf('0x3d')](_0x578ebc['where'],{'$or':_[_0x05bf('0x2a')](_0x578ebc['attributes'],function(_0x421c45){var _0x53c89e={};_0x53c89e[_0x421c45]={'$like':'%'+_0x2ae2a3[_0x05bf('0x2f')][_0x05bf('0x3c')]+'%'};return _0x53c89e;})});}_0x578ebc=_[_0x05bf('0x3d')]({},_0x578ebc,_0x2ae2a3['options']);return _0x266164[_0x05bf('0x53')](_0x578ebc);}})[_0x05bf('0x22')](function(_0x55989d){if(_0x55989d){_0x4975d4=_0x55989d[_0x05bf('0x36')];if(!_0x2ae2a3[_0x05bf('0x2f')][_0x05bf('0x37')]('nolimit')){_0x578ebc['limit']=qs[_0x05bf('0x1d')](_0x2ae2a3[_0x05bf('0x2f')]['limit']);_0x578ebc[_0x05bf('0x1b')]=qs['offset'](_0x2ae2a3[_0x05bf('0x2f')][_0x05bf('0x1b')]);}return _0x266164['getIntervals'](_0x578ebc);}})[_0x05bf('0x22')](function(_0x3da5bb){if(_0x3da5bb){return _0x3da5bb?{'count':_0x4975d4,'rows':_0x3da5bb}:null;}})[_0x05bf('0x22')](respondWithResult(_0x1641e5,null))[_0x05bf('0x42')](handleError(_0x1641e5,null));};exports[_0x05bf('0x55')]=function(_0xb83ead,_0x1dd80c,_0x14cd3e){return db['Interval'][_0x05bf('0x54')]({'where':{'id':_0xb83ead[_0x05bf('0x51')]['id']}})['then'](handleEntityNotFound(_0x1dd80c,null))['then'](function(_0x1b8190){if(_0x1b8190){return db[_0x05bf('0x56')]['transaction'](function(_0x3fbd5b){return db[_0x05bf('0x2b')]['destroy']({'where':{'IntervalId':_0xb83ead[_0x05bf('0x51')]['id']},'transaction':_0x3fbd5b})[_0x05bf('0x22')](function(_0x5d3f81){var _0x1fc881=_[_0x05bf('0x2a')](_0xb83ead['body'],function(_0x98e135){delete _0x98e135['id'];_0x98e135['IntervalId']=_0xb83ead[_0x05bf('0x51')]['id'];return _0x98e135;});return db[_0x05bf('0x2b')][_0x05bf('0x57')](_0x1fc881,{'transaction':_0x3fbd5b});});})[_0x05bf('0x22')](function(){return db[_0x05bf('0x2b')][_0x05bf('0x40')]({'where':{'IntervalId':_0xb83ead[_0x05bf('0x51')]['id']}});});}})['then'](respondWithResult(_0x1dd80c,null))[_0x05bf('0x42')](handleError(_0x1dd80c,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 1dfc969..e72ddb1 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 _0xdfee=['exports','Interval','tools_intervals','rewrite','interval','all','map','ifTime','./interval.attributes','../../utils/iftime','iftime'];(function(_0x4a4f5b,_0x3dd9f8){var _0x1a3657=function(_0x37aa12){while(--_0x37aa12){_0x4a4f5b['push'](_0x4a4f5b['shift']());}};_0x1a3657(++_0x3dd9f8);}(_0xdfee,0x131));var _0xedfe=function(_0x2af6fd,_0x5032d3){_0x2af6fd=_0x2af6fd-0x0;var _0x53a335=_0xdfee[_0x2af6fd];return _0x53a335;};'use strict';var attributes=require(_0xedfe('0x0'));var extensions=require('../../components/extensions/rewrite');var iftime=require(_0xedfe('0x1'))[_0xedfe('0x2')];module[_0xedfe('0x3')]=function(_0x1a64ce){return _0x1a64ce['define'](_0xedfe('0x4'),attributes,{'tableName':_0xedfe('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2c0eb9){extensions[_0xedfe('0x6')](_0x1a64ce,_0x2c0eb9);},'afterBulkCreate':function(_0x555bd6,_0x4a1efd,_0xd170bf){_0xd170bf();extensions['rewrite'](_0x1a64ce,_0x555bd6[0x0]);},'afterUpdate':function(_0x4d9573){extensions[_0xedfe('0x6')](_0x1a64ce,_0x4d9573);},'afterDestroy':function(_0x1323ec){extensions[_0xedfe('0x6')](_0x1a64ce,_0x1323ec);}},'instanceMethods':{'ifTime':function(_0x296647=undefined,_0x77ab18=new Date()){if(typeof this[_0xedfe('0x7')]==='string'){return iftime(this[_0xedfe('0x7')],_0x296647,_0x77ab18);}else{return this['getIntervals']()['then'](function(_0x42a20a){return Promise[_0xedfe('0x8')](_0x42a20a[_0xedfe('0x9')](function(_0x564171){return _0x564171[_0xedfe('0xa')](_0x296647,_0x77ab18);}));})['then'](function(_0x10e3a0){return _0x10e3a0['reduce'](function(_0x333e4d,_0x55ca6e){return _0x333e4d||_0x55ca6e;},![]);});}}}});}; \ No newline at end of file +var _0x8d99=['then','map','ifTime','reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','Interval','tools_intervals','rewrite','interval','string','getIntervals'];(function(_0x5a905e,_0x31aa4a){var _0x4124d6=function(_0x37c28a){while(--_0x37c28a){_0x5a905e['push'](_0x5a905e['shift']());}};_0x4124d6(++_0x31aa4a);}(_0x8d99,0x18a));var _0x98d9=function(_0x48097d,_0x284f8b){_0x48097d=_0x48097d-0x0;var _0x13ff23=_0x8d99[_0x48097d];return _0x13ff23;};'use strict';var attributes=require(_0x98d9('0x0'));var extensions=require(_0x98d9('0x1'));var iftime=require(_0x98d9('0x2'))['iftime'];module['exports']=function(_0x30e9de){return _0x30e9de['define'](_0x98d9('0x3'),attributes,{'tableName':_0x98d9('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x47333f){extensions['rewrite'](_0x30e9de,_0x47333f);},'afterBulkCreate':function(_0x420029,_0x2ff167,_0x16b3cb){_0x16b3cb();extensions[_0x98d9('0x5')](_0x30e9de,_0x420029[0x0]);},'afterUpdate':function(_0x231365){extensions[_0x98d9('0x5')](_0x30e9de,_0x231365);},'afterDestroy':function(_0xe8af4c){extensions[_0x98d9('0x5')](_0x30e9de,_0xe8af4c);}},'instanceMethods':{'ifTime':function(_0x4cb2a1=undefined,_0x43f3a1=new Date()){if(typeof this[_0x98d9('0x6')]===_0x98d9('0x7')){return iftime(this[_0x98d9('0x6')],_0x4cb2a1,_0x43f3a1);}else{return this[_0x98d9('0x8')]()[_0x98d9('0x9')](function(_0x49cd1e){return Promise['all'](_0x49cd1e[_0x98d9('0xa')](function(_0x5b1bd0){return _0x5b1bd0[_0x98d9('0xb')](_0x4cb2a1,_0x43f3a1);}));})[_0x98d9('0x9')](function(_0x55dc84){return _0x55dc84[_0x98d9('0xc')](function(_0x5343ac,_0x9f1843){return _0x5343ac||_0x9f1843;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 100a2f0..b40c615 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 _0xf0b7=['attributes','limit','include','map','model','then','stringify','catch','error','message','info','ShowInterval','ifTime','format','name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','intervalIds','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','IntervalIftime','resolve','reduce','lodash','../../mysqldb','iftime','../../config/logger','rpc','GetInterval','Interval','findAll','options','raw','where'];(function(_0x2837cb,_0x4adb84){var _0x5368e0=function(_0x503554){while(--_0x503554){_0x2837cb['push'](_0x2837cb['shift']());}};_0x5368e0(++_0x4adb84);}(_0xf0b7,0x9d));var _0x7f0b=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xf0b7[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x7f0b('0x0'));var util=require('util');var db=require(_0x7f0b('0x1'))['db'];var iftime=require('../../utils/iftime')[_0x7f0b('0x2')];var logger=require(_0x7f0b('0x3'))(_0x7f0b('0x4'));exports[_0x7f0b('0x5')]=function(_0x10f80d){var _0x42d855=this;return new Promise(function(_0x3611b2,_0xc8fdfa){return db[_0x7f0b('0x6')][_0x7f0b('0x7')]({'raw':_0x10f80d['options']?_0x10f80d[_0x7f0b('0x8')][_0x7f0b('0x9')]===undefined?!![]:![]:!![],'where':_0x10f80d['options']?_0x10f80d['options'][_0x7f0b('0xa')]||null:null,'attributes':_0x10f80d[_0x7f0b('0x8')]?_0x10f80d[_0x7f0b('0x8')][_0x7f0b('0xb')]||null:null,'limit':_0x10f80d[_0x7f0b('0x8')]?_0x10f80d[_0x7f0b('0x8')][_0x7f0b('0xc')]||null:null,'include':_0x10f80d[_0x7f0b('0x8')]?_0x10f80d['options'][_0x7f0b('0xd')]?_[_0x7f0b('0xe')](_0x10f80d[_0x7f0b('0x8')][_0x7f0b('0xd')],function(_0x2a6792){return{'model':db[_0x2a6792[_0x7f0b('0xf')]],'as':_0x2a6792['as'],'attributes':_0x2a6792['attributes'],'include':_0x2a6792['include']?_[_0x7f0b('0xe')](_0x2a6792[_0x7f0b('0xd')],function(_0x5cee06){return{'model':db[_0x5cee06[_0x7f0b('0xf')]],'as':_0x5cee06['as'],'attributes':_0x5cee06['attributes'],'include':_0x5cee06['include']?_[_0x7f0b('0xe')](_0x5cee06[_0x7f0b('0xd')],function(_0xe5d84e){return{'model':db[_0xe5d84e[_0x7f0b('0xf')]],'as':_0xe5d84e['as'],'attributes':_0xe5d84e['attributes']};}):[]};}):[]};}):[]:[]})[_0x7f0b('0x10')](function(_0x491a87){logger['info'](_0x7f0b('0x5'),_0x10f80d);logger['debug']('GetInterval',_0x10f80d,JSON[_0x7f0b('0x11')](_0x491a87));_0x3611b2(_0x491a87);})[_0x7f0b('0x12')](function(_0xe0d328){logger[_0x7f0b('0x13')](_0x7f0b('0x5'),_0xe0d328[_0x7f0b('0x14')],_0x10f80d);_0xc8fdfa(_0x42d855[_0x7f0b('0x13')](0x1f4,_0xe0d328[_0x7f0b('0x14')]));});});};exports['ShowInterval']=function(_0x15ed1c){var _0x10c7cc=this;return new Promise(function(_0x8732c8,_0x4c8331){return db[_0x7f0b('0x6')]['find']({'raw':_0x15ed1c[_0x7f0b('0x8')]?_0x15ed1c[_0x7f0b('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x15ed1c['options']?_0x15ed1c[_0x7f0b('0x8')][_0x7f0b('0xa')]||null:null,'attributes':_0x15ed1c[_0x7f0b('0x8')]?_0x15ed1c[_0x7f0b('0x8')][_0x7f0b('0xb')]||null:null,'include':_0x15ed1c['options']?_0x15ed1c[_0x7f0b('0x8')]['include']?_[_0x7f0b('0xe')](_0x15ed1c['options'][_0x7f0b('0xd')],function(_0x15b3f7){return{'model':db[_0x15b3f7[_0x7f0b('0xf')]],'as':_0x15b3f7['as'],'attributes':_0x15b3f7[_0x7f0b('0xb')],'include':_0x15b3f7['include']?_[_0x7f0b('0xe')](_0x15b3f7['include'],function(_0x28b334){return{'model':db[_0x28b334[_0x7f0b('0xf')]],'as':_0x28b334['as'],'attributes':_0x28b334[_0x7f0b('0xb')],'include':_0x28b334[_0x7f0b('0xd')]?_[_0x7f0b('0xe')](_0x28b334[_0x7f0b('0xd')],function(_0x15f2aa){return{'model':db[_0x15f2aa['model']],'as':_0x15f2aa['as'],'attributes':_0x15f2aa[_0x7f0b('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5efc78){logger[_0x7f0b('0x15')](_0x7f0b('0x16'),_0x15ed1c);logger['debug']('ShowInterval',_0x15ed1c,JSON['stringify'](_0x5efc78));_0x8732c8(_0x5efc78);})[_0x7f0b('0x12')](function(_0x27f5a5){logger[_0x7f0b('0x13')](_0x7f0b('0x16'),_0x27f5a5[_0x7f0b('0x14')],_0x15ed1c);_0x4c8331(_0x10c7cc[_0x7f0b('0x13')](0x1f4,_0x27f5a5['message']));});});};function checkArrayOfIntervals(_0x5ddc18,_0x10fa14){var _0x25a2ab=[];return db[_0x7f0b('0x6')]['findAll']({'where':{'id':_0x5ddc18}})[_0x7f0b('0x10')](function(_0x5da704){_0x25a2ab=_0x5da704;return Promise['all'](_0x25a2ab[_0x7f0b('0xe')](function(_0x2a5888){return _0x2a5888[_0x7f0b('0x17')](_0x10fa14);}));})[_0x7f0b('0x10')](function(_0x372ca5){var _0x49141c=_0x372ca5['reduce'](function(_0x2dccb,_0xb0bdd4){return _0x2dccb||_0xb0bdd4;},![]);logger[_0x7f0b('0x15')](util[_0x7f0b('0x18')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x25a2ab[_0x7f0b('0xe')](function(_0x1249dd){return _0x1249dd[_0x7f0b('0x19')];})['join'](',\x20'),_0x25a2ab['map'](function(_0x4aa8c2){return _0x4aa8c2['id'];})[_0x7f0b('0x1a')](',\x20')));return _0x49141c;});}function checkSingleInterval(_0x566512,_0x28dd8c){return db['Interval'][_0x7f0b('0x1b')](_0x566512)['then'](function(_0x5ddca8){if(_0x5ddca8){logger[_0x7f0b('0x15')](util[_0x7f0b('0x18')](_0x7f0b('0x1c'),_0x5ddca8[_0x7f0b('0x19')],_0x5ddca8['id']));return _0x5ddca8[_0x7f0b('0x17')](_0x28dd8c);}});}exports['IntervalIftime']=function(_0x2cc65f){var _0x56f876=_0x2cc65f[_0x7f0b('0x1d')];var _0x7cd894=Array[_0x7f0b('0x1e')](_0x2cc65f[_0x7f0b('0x1f')])?_0x2cc65f[_0x7f0b('0x1f')]:typeof _0x2cc65f[_0x7f0b('0x1f')]===_0x7f0b('0x20')?[_0x2cc65f['intervals']]:[];var _0x1a285f=_0x2cc65f[_0x7f0b('0x21')]||undefined;var _0x3616fe=![];if(_0x7cd894[_0x7f0b('0x22')]){logger[_0x7f0b('0x15')](util[_0x7f0b('0x18')](_0x7f0b('0x23'),_0x7cd894[_0x7f0b('0x1a')](';\x20')));}if(_0x1a285f){logger[_0x7f0b('0x15')](util[_0x7f0b('0x18')](_0x7f0b('0x24'),_0x1a285f));}logger['debug'](_0x7f0b('0x25'),_0x3616fe);logger[_0x7f0b('0x26')](_0x7f0b('0x27'),_0x2cc65f);return Promise[_0x7f0b('0x28')]()['then'](function(){if(Array['isArray'](_0x56f876)){return checkArrayOfIntervals(_0x56f876,_0x1a285f);}else if(_0x56f876){return checkSingleInterval(_0x56f876,_0x1a285f);}})[_0x7f0b('0x10')](function(_0xa04bb0){var _0x11ec19=_0x7cd894[_0x7f0b('0x29')](function(_0x3c77ec,_0x113a6e){return _0x3c77ec||iftime(_0x113a6e,_0x1a285f);},![]);_0x3616fe=_0xa04bb0||_0x11ec19;return _0x3616fe;})['catch'](function(_0x4475f7){logger[_0x7f0b('0x13')](_0x7f0b('0x27'),_0x2cc65f,_0x4475f7);throw this[_0x7f0b('0x13')](0x1f4,_0x4475f7[_0x7f0b('0x14')]);});}; \ No newline at end of file +var _0xf931=['isArray','intervals','timezone','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','resolve','reduce','lodash','../../utils/iftime','iftime','../../config/logger','rpc','Interval','findAll','options','where','limit','include','map','model','attributes','then','info','GetInterval','stringify','catch','error','message','ShowInterval','raw','debug','all','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','format','ifTime','IntervalIftime','intervalIds'];(function(_0x4e4c11,_0x6f02ee){var _0x107766=function(_0x4928e1){while(--_0x4928e1){_0x4e4c11['push'](_0x4e4c11['shift']());}};_0x107766(++_0x6f02ee);}(_0xf931,0x1d7));var _0x1f93=function(_0x959591,_0x5aa72b){_0x959591=_0x959591-0x0;var _0xc85623=_0xf931[_0x959591];return _0xc85623;};'use strict';var _=require(_0x1f93('0x0'));var util=require('util');var db=require('../../mysqldb')['db'];var iftime=require(_0x1f93('0x1'))[_0x1f93('0x2')];var logger=require(_0x1f93('0x3'))(_0x1f93('0x4'));exports['GetInterval']=function(_0xf26902){var _0x5a2b28=this;return new Promise(function(_0x487735,_0x497113){return db[_0x1f93('0x5')][_0x1f93('0x6')]({'raw':_0xf26902[_0x1f93('0x7')]?_0xf26902[_0x1f93('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0xf26902[_0x1f93('0x7')]?_0xf26902[_0x1f93('0x7')][_0x1f93('0x8')]||null:null,'attributes':_0xf26902['options']?_0xf26902[_0x1f93('0x7')]['attributes']||null:null,'limit':_0xf26902['options']?_0xf26902['options'][_0x1f93('0x9')]||null:null,'include':_0xf26902[_0x1f93('0x7')]?_0xf26902[_0x1f93('0x7')][_0x1f93('0xa')]?_[_0x1f93('0xb')](_0xf26902[_0x1f93('0x7')]['include'],function(_0x5e9fe5){return{'model':db[_0x5e9fe5[_0x1f93('0xc')]],'as':_0x5e9fe5['as'],'attributes':_0x5e9fe5[_0x1f93('0xd')],'include':_0x5e9fe5[_0x1f93('0xa')]?_['map'](_0x5e9fe5[_0x1f93('0xa')],function(_0x958df5){return{'model':db[_0x958df5[_0x1f93('0xc')]],'as':_0x958df5['as'],'attributes':_0x958df5[_0x1f93('0xd')],'include':_0x958df5[_0x1f93('0xa')]?_[_0x1f93('0xb')](_0x958df5[_0x1f93('0xa')],function(_0x29b7e4){return{'model':db[_0x29b7e4['model']],'as':_0x29b7e4['as'],'attributes':_0x29b7e4[_0x1f93('0xd')]};}):[]};}):[]};}):[]:[]})[_0x1f93('0xe')](function(_0x148f39){logger[_0x1f93('0xf')](_0x1f93('0x10'),_0xf26902);logger['debug']('GetInterval',_0xf26902,JSON[_0x1f93('0x11')](_0x148f39));_0x487735(_0x148f39);})[_0x1f93('0x12')](function(_0x6d50c8){logger[_0x1f93('0x13')]('GetInterval',_0x6d50c8[_0x1f93('0x14')],_0xf26902);_0x497113(_0x5a2b28['error'](0x1f4,_0x6d50c8[_0x1f93('0x14')]));});});};exports[_0x1f93('0x15')]=function(_0x482a24){var _0x398352=this;return new Promise(function(_0x398902,_0x5dbbf2){return db['Interval']['find']({'raw':_0x482a24['options']?_0x482a24[_0x1f93('0x7')][_0x1f93('0x16')]===undefined?!![]:![]:!![],'where':_0x482a24[_0x1f93('0x7')]?_0x482a24[_0x1f93('0x7')][_0x1f93('0x8')]||null:null,'attributes':_0x482a24['options']?_0x482a24['options'][_0x1f93('0xd')]||null:null,'include':_0x482a24[_0x1f93('0x7')]?_0x482a24[_0x1f93('0x7')][_0x1f93('0xa')]?_[_0x1f93('0xb')](_0x482a24[_0x1f93('0x7')]['include'],function(_0x1f3a90){return{'model':db[_0x1f3a90[_0x1f93('0xc')]],'as':_0x1f3a90['as'],'attributes':_0x1f3a90[_0x1f93('0xd')],'include':_0x1f3a90['include']?_['map'](_0x1f3a90['include'],function(_0x2f5fe9){return{'model':db[_0x2f5fe9['model']],'as':_0x2f5fe9['as'],'attributes':_0x2f5fe9[_0x1f93('0xd')],'include':_0x2f5fe9['include']?_['map'](_0x2f5fe9[_0x1f93('0xa')],function(_0x5cd6e3){return{'model':db[_0x5cd6e3['model']],'as':_0x5cd6e3['as'],'attributes':_0x5cd6e3[_0x1f93('0xd')]};}):[]};}):[]};}):[]:[]})[_0x1f93('0xe')](function(_0x45c47a){logger[_0x1f93('0xf')]('ShowInterval',_0x482a24);logger[_0x1f93('0x17')]('ShowInterval',_0x482a24,JSON[_0x1f93('0x11')](_0x45c47a));_0x398902(_0x45c47a);})[_0x1f93('0x12')](function(_0x555206){logger[_0x1f93('0x13')]('ShowInterval',_0x555206[_0x1f93('0x14')],_0x482a24);_0x5dbbf2(_0x398352['error'](0x1f4,_0x555206['message']));});});};function checkArrayOfIntervals(_0x30da1e,_0x1096f3){var _0x25b03c=[];return db[_0x1f93('0x5')][_0x1f93('0x6')]({'where':{'id':_0x30da1e}})[_0x1f93('0xe')](function(_0x480452){_0x25b03c=_0x480452;return Promise[_0x1f93('0x18')](_0x25b03c[_0x1f93('0xb')](function(_0x52ee05){return _0x52ee05['ifTime'](_0x1096f3);}));})[_0x1f93('0xe')](function(_0x55cc97){var _0x42d42d=_0x55cc97['reduce'](function(_0x1f968c,_0x49d12c){return _0x1f968c||_0x49d12c;},![]);logger[_0x1f93('0xf')](util['format'](_0x1f93('0x19'),_0x25b03c['map'](function(_0x41602a){return _0x41602a[_0x1f93('0x1a')];})[_0x1f93('0x1b')](',\x20'),_0x25b03c[_0x1f93('0xb')](function(_0x41a831){return _0x41a831['id'];})[_0x1f93('0x1b')](',\x20')));return _0x42d42d;});}function checkSingleInterval(_0x23050d,_0x805968){return db['Interval'][_0x1f93('0x1c')](_0x23050d)[_0x1f93('0xe')](function(_0x3106a1){if(_0x3106a1){logger[_0x1f93('0xf')](util[_0x1f93('0x1d')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x3106a1[_0x1f93('0x1a')],_0x3106a1['id']));return _0x3106a1[_0x1f93('0x1e')](_0x805968);}});}exports[_0x1f93('0x1f')]=function(_0x1842d8){var _0x6e8d25=_0x1842d8[_0x1f93('0x20')];var _0x392f15=Array[_0x1f93('0x21')](_0x1842d8[_0x1f93('0x22')])?_0x1842d8[_0x1f93('0x22')]:typeof _0x1842d8[_0x1f93('0x22')]==='string'?[_0x1842d8['intervals']]:[];var _0x186391=_0x1842d8[_0x1f93('0x23')]||undefined;var _0x1df4b7=![];if(_0x392f15['length']){logger[_0x1f93('0xf')](util[_0x1f93('0x1d')](_0x1f93('0x24'),_0x392f15[_0x1f93('0x1b')](';\x20')));}if(_0x186391){logger[_0x1f93('0xf')](util[_0x1f93('0x1d')](_0x1f93('0x25'),_0x186391));}logger[_0x1f93('0x17')](_0x1f93('0x26'),_0x1df4b7);logger[_0x1f93('0x27')](_0x1f93('0x1f'),_0x1842d8);return Promise[_0x1f93('0x28')]()[_0x1f93('0xe')](function(){if(Array[_0x1f93('0x21')](_0x6e8d25)){return checkArrayOfIntervals(_0x6e8d25,_0x186391);}else if(_0x6e8d25){return checkSingleInterval(_0x6e8d25,_0x186391);}})[_0x1f93('0xe')](function(_0x44001){var _0x177d8a=_0x392f15[_0x1f93('0x29')](function(_0x241f10,_0x250919){return _0x241f10||iftime(_0x250919,_0x186391);},![]);_0x1df4b7=_0x44001||_0x177d8a;return _0x1df4b7;})[_0x1f93('0x12')](function(_0x5e6023){logger[_0x1f93('0x13')](_0x1f93('0x1f'),_0x1842d8,_0x5e6023);throw this[_0x1f93('0x13')](0x1f4,_0x5e6023['message']);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 3984c38..c1af0a2 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 _0x5f66=['send','exports','Router','./jira.controller','post','isAuthenticated'];(function(_0x4f0e62,_0x28e44f){var _0x117ab8=function(_0x1a74bb){while(--_0x1a74bb){_0x4f0e62['push'](_0x4f0e62['shift']());}};_0x117ab8(++_0x28e44f);}(_0x5f66,0x1a0));var _0x65f6=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x5f66[_0x13d07a];return _0x5ee0ee;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);module[_0x65f6('0x5')]=router; \ No newline at end of file +var _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2d4421,_0x15a84f){_0x2d4421=_0x2d4421-0x0;var _0x2d3b01=_0x0b0e[_0x2d4421];return _0x2d3b01;};'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 diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 5ae78ca..47a55ce 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 _0x7896=['error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','end','openIssue','body','headers','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','summary','Report','\x20from\x20','issuetype','Bug','fields','customfield_11500','email','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','application/json','Basic\x20','toString','base64','stringify','request','setEncoding','utf8','status','json'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x7896,0x1a0));var _0x6789=function(_0x97385e,_0x17e853){_0x97385e=_0x97385e-0x0;var _0x5d337e=_0x7896[_0x97385e];return _0x5d337e;};'use strict';var BPromise=require(_0x6789('0x0'));var https=require(_0x6789('0x1'));var logger=require(_0x6789('0x2'))(_0x6789('0x3'));var USERNAME=_0x6789('0x4');var PASSWORD=_0x6789('0x5');function openIssue(_0x3bba25,_0x15d0f1){var _0x1b91ff={'fields':{'project':{'key':_0x3bba25[_0x6789('0x6')]||'MOTGUI'},'summary':(_0x3bba25[_0x6789('0x7')]||_0x6789('0x8'))+_0x6789('0x9')+_0x3bba25['ip'],'description':_0x3bba25['description']||JSON['stringify'](_0x3bba25),'issuetype':{'name':_0x3bba25[_0x6789('0xa')]||_0x6789('0xb')}}};_0x1b91ff[_0x6789('0xc')][_0x6789('0xd')]=_0x3bba25[_0x6789('0xe')];_0x1b91ff[_0x6789('0xc')]['customfield_11501']=_0x3bba25[_0x6789('0xf')];_0x1b91ff[_0x6789('0xc')][_0x6789('0x10')]=_0x3bba25[_0x6789('0x11')];_0x1b91ff['fields'][_0x6789('0x12')]=_0x3bba25[_0x6789('0x13')];_0x1b91ff['fields'][_0x6789('0x14')]=_0x3bba25['reason'];_0x1b91ff[_0x6789('0xc')][_0x6789('0x15')]=_0x3bba25['ip'];var _0x5ba3f2={'host':_0x6789('0x16'),'port':0x1bb,'path':_0x6789('0x17'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x6789('0x18'),'Authorization':_0x6789('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0x6789('0x1a')](_0x6789('0x1b'))}};var _0x458d0a=JSON[_0x6789('0x1c')](_0x1b91ff);var _0x15c2e0=https[_0x6789('0x1d')](_0x5ba3f2,function(_0x245022){_0x245022[_0x6789('0x1e')](_0x6789('0x1f'));var _0x1092ed='';_0x245022['on']('data',function(_0x26f744){_0x1092ed+=_0x26f744;});_0x245022['on']('end',function(){if(_0x15d0f1){return _0x15d0f1[_0x6789('0x20')](_0x245022['statusCode'])[_0x6789('0x21')](JSON['parse'](_0x1092ed));}});});_0x15c2e0['on'](_0x6789('0x22'),function(_0x461600){if(_0x15d0f1){return _0x15d0f1[_0x6789('0x20')](0x1f4)[_0x6789('0x21')]({'errors':[{'message':_0x6789('0x23'),'type':_0x6789('0x24')}]});}});_0x15c2e0[_0x6789('0x25')](_0x458d0a);_0x15c2e0[_0x6789('0x26')]();}exports[_0x6789('0x27')]=openIssue;exports['send']=function(_0x336594,_0x18d990){_0x336594[_0x6789('0x28')]['ip']=_0x336594[_0x6789('0x29')]['x-forwarded-for']||_0x336594[_0x6789('0x2a')][_0x6789('0x2b')]||_0x336594[_0x6789('0x2c')]['remoteAddress']||_0x336594[_0x6789('0x2a')][_0x6789('0x2c')]['remoteAddress'];return openIssue(_0x336594[_0x6789('0x28')],_0x18d990);}; \ No newline at end of file +var _0xe039=['MOTGUI','summary','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','customfield_11504','track.xcallymotion.com','POST','Basic\x20','toString','base64','request','data','end','status','json','parse','error','write','send','body','headers','x-forwarded-for','socket','remoteAddress','connection','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key'];(function(_0x42d41d,_0x17b8ea){var _0x2e6184=function(_0x3104f0){while(--_0x3104f0){_0x42d41d['push'](_0x42d41d['shift']());}};_0x2e6184(++_0x17b8ea);}(_0xe039,0x19d));var _0x9e03=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xe039[_0x2a6809];return _0x11c371;};'use strict';var BPromise=require(_0x9e03('0x0'));var https=require(_0x9e03('0x1'));var logger=require(_0x9e03('0x2'))(_0x9e03('0x3'));var USERNAME=_0x9e03('0x4');var PASSWORD=_0x9e03('0x5');function openIssue(_0x515bd9,_0x2cf7c2){var _0x39b39a={'fields':{'project':{'key':_0x515bd9[_0x9e03('0x6')]||_0x9e03('0x7')},'summary':(_0x515bd9[_0x9e03('0x8')]||'Report')+_0x9e03('0x9')+_0x515bd9['ip'],'description':_0x515bd9[_0x9e03('0xa')]||JSON[_0x9e03('0xb')](_0x515bd9),'issuetype':{'name':_0x515bd9[_0x9e03('0xc')]||_0x9e03('0xd')}}};_0x39b39a[_0x9e03('0xe')][_0x9e03('0xf')]=_0x515bd9['email'];_0x39b39a[_0x9e03('0xe')][_0x9e03('0x10')]=_0x515bd9[_0x9e03('0x11')];_0x39b39a['fields'][_0x9e03('0x12')]=_0x515bd9[_0x9e03('0x13')];_0x39b39a[_0x9e03('0xe')][_0x9e03('0x14')]=_0x515bd9['name'];_0x39b39a[_0x9e03('0xe')][_0x9e03('0x15')]=_0x515bd9['reason'];_0x39b39a[_0x9e03('0xe')]['customfield_10102']=_0x515bd9['ip'];var _0x40b4fd={'host':_0x9e03('0x16'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x9e03('0x17'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x9e03('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x9e03('0x19')](_0x9e03('0x1a'))}};var _0x194dfb=JSON[_0x9e03('0xb')](_0x39b39a);var _0x30df49=https[_0x9e03('0x1b')](_0x40b4fd,function(_0x1a556f){_0x1a556f['setEncoding']('utf8');var _0x1750f2='';_0x1a556f['on'](_0x9e03('0x1c'),function(_0x40d949){_0x1750f2+=_0x40d949;});_0x1a556f['on'](_0x9e03('0x1d'),function(){if(_0x2cf7c2){return _0x2cf7c2[_0x9e03('0x1e')](_0x1a556f['statusCode'])[_0x9e03('0x1f')](JSON[_0x9e03('0x20')](_0x1750f2));}});});_0x30df49['on'](_0x9e03('0x21'),function(_0x20bb6d){if(_0x2cf7c2){return _0x2cf7c2[_0x9e03('0x1e')](0x1f4)[_0x9e03('0x1f')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':'api.jira'}]});}});_0x30df49[_0x9e03('0x22')](_0x194dfb);_0x30df49[_0x9e03('0x1d')]();}exports['openIssue']=openIssue;exports[_0x9e03('0x23')]=function(_0x2613ac,_0x4d0645){_0x2613ac[_0x9e03('0x24')]['ip']=_0x2613ac[_0x9e03('0x25')][_0x9e03('0x26')]||_0x2613ac['connection']['remoteAddress']||_0x2613ac[_0x9e03('0x27')][_0x9e03('0x28')]||_0x2613ac[_0x9e03('0x29')][_0x9e03('0x27')][_0x9e03('0x28')];return openIssue(_0x2613ac[_0x9e03('0x24')],_0x4d0645);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index f6af30d..8bfc881 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 _0x1339=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x189930,_0x42bdc0){var _0x52bb7b=function(_0x379833){while(--_0x379833){_0x189930['push'](_0x189930['shift']());}};_0x52bb7b(++_0x42bdc0);}(_0x1339,0x1ed));var _0x9133=function(_0x4aa28a,_0x269c64){_0x4aa28a=_0x4aa28a-0x0;var _0x18dfa2=_0x1339[_0x4aa28a];return _0x18dfa2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9133('0x0'));var timeout=require(_0x9133('0x1'));var express=require(_0x9133('0x2'));var router=express[_0x9133('0x3')]();var fs_extra=require(_0x9133('0x4'));var auth=require(_0x9133('0x5'));var interaction=require(_0x9133('0x6'));var config=require(_0x9133('0x7'));var controller=require('./jscriptyAnswerReport.controller');router[_0x9133('0x8')]('/',auth[_0x9133('0x9')](),controller[_0x9133('0xa')]);router['get'](_0x9133('0xb'),auth[_0x9133('0x9')](),controller[_0x9133('0xc')]);router[_0x9133('0x8')](_0x9133('0xd'),auth[_0x9133('0x9')](),controller[_0x9133('0xe')]);router[_0x9133('0xf')]('/',auth[_0x9133('0x9')](),controller[_0x9133('0x10')]);router['put'](_0x9133('0xd'),auth[_0x9133('0x9')](),controller[_0x9133('0x11')]);router[_0x9133('0x12')](_0x9133('0xd'),auth[_0x9133('0x9')](),controller['destroy']);module[_0x9133('0x13')]=router; \ No newline at end of file +var _0x5b02=['destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','/describe','describe','show','post','create','put','/:id','update','delete'];(function(_0x30190c,_0xfe91e7){var _0x2d687e=function(_0x2d46b9){while(--_0x2d46b9){_0x30190c['push'](_0x30190c['shift']());}};_0x2d687e(++_0xfe91e7);}(_0x5b02,0xe9));var _0x25b0=function(_0x42c732,_0x3a18dc){_0x42c732=_0x42c732-0x0;var _0x356074=_0x5b02[_0x42c732];return _0x356074;};'use strict';var multer=require(_0x25b0('0x0'));var util=require(_0x25b0('0x1'));var path=require(_0x25b0('0x2'));var timeout=require(_0x25b0('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x25b0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x25b0('0x5'));var config=require(_0x25b0('0x6'));var controller=require(_0x25b0('0x7'));router[_0x25b0('0x8')]('/',auth[_0x25b0('0x9')](),controller['index']);router[_0x25b0('0x8')](_0x25b0('0xa'),auth['isAuthenticated'](),controller[_0x25b0('0xb')]);router['get']('/:id',auth[_0x25b0('0x9')](),controller[_0x25b0('0xc')]);router[_0x25b0('0xd')]('/',auth['isAuthenticated'](),controller[_0x25b0('0xe')]);router[_0x25b0('0xf')](_0x25b0('0x10'),auth[_0x25b0('0x9')](),controller[_0x25b0('0x11')]);router[_0x25b0('0x12')](_0x25b0('0x10'),auth[_0x25b0('0x9')](),controller[_0x25b0('0x13')]);module[_0x25b0('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 8949263..6d873f0 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(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x7a54,0x106));var _0x47a5=function(_0x39c4fb,_0x565a04){_0x39c4fb=_0x39c4fb-0x0;var _0x49933a=_0x7a54[_0x39c4fb];return _0x49933a;};'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(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7a54,0x106));var _0x47a5=function(_0x3c82c1,_0x13c81a){_0x3c82c1=_0x3c82c1-0x0;var _0xe01442=_0x7a54[_0x3c82c1];return _0xe01442;};'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 657d6b4..8031d22 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 _0x423b=['options','includeAll','include','rows','catch','show','params','find','create','body','describe','rimraf','fast-json-patch','moment','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','stack','name','send','index','JscriptyAnswerReport','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','map','type','VIRTUAL'];(function(_0x2baebf,_0x292099){var _0x1161f9=function(_0x477775){while(--_0x477775){_0x2baebf['push'](_0x2baebf['shift']());}};_0x1161f9(++_0x292099);}(_0x423b,0x12b));var _0xb423=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0x423b[_0x5ddaac];return _0x2a9c58;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb423('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb423('0x1'));var rp=require('request-promise');var moment=require(_0xb423('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xb423('0x3'));var sox=require(_0xb423('0x4'));var csv=require('to-csv');var ejs=require(_0xb423('0x5'));var fs=require('fs');var fs_extra=require(_0xb423('0x6'));var _=require(_0xb423('0x7'));var squel=require(_0xb423('0x8'));var crypto=require('crypto');var jsforce=require(_0xb423('0x9'));var deskjs=require(_0xb423('0xa'));var toCsv=require(_0xb423('0xb'));var querystring=require(_0xb423('0xc'));var Papa=require(_0xb423('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb423('0xe'));var as=require(_0xb423('0xf'));var hardwareService=require(_0xb423('0x10'));var logger=require(_0xb423('0x11'))(_0xb423('0x12'));var utils=require('../../config/utils');var config=require(_0xb423('0x13'));var licenseUtil=require(_0xb423('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x26aea2,_0xe3016f){_0xe3016f=_0xe3016f||0xcc;return function(_0x40855a){if(_0x40855a){return _0x26aea2['sendStatus'](_0xe3016f);}return _0x26aea2[_0xb423('0x15')](_0xe3016f)['end']();};}function respondWithResult(_0x33aaf7,_0x582ae6){_0x582ae6=_0x582ae6||0xc8;return function(_0x4d7109){if(_0x4d7109){return _0x33aaf7['status'](_0x582ae6)[_0xb423('0x16')](_0x4d7109);}};}function respondWithFilteredResult(_0x4351e2,_0x222e41){return function(_0x5abab2){if(_0x5abab2){var _0x1b1586=typeof _0x222e41[_0xb423('0x17')]===_0xb423('0x18')&&typeof _0x222e41[_0xb423('0x19')]==='undefined';var _0x42b6fe=_0x5abab2[_0xb423('0x1a')];var _0x5d84a6=_0x1b1586?0x0:_0x222e41['offset'];var _0x340319=_0x1b1586?_0x5abab2['count']:_0x222e41[_0xb423('0x17')]+_0x222e41[_0xb423('0x19')];var _0x5e7ff5;if(_0x340319>=_0x42b6fe){_0x340319=_0x42b6fe;_0x5e7ff5=0xc8;}else{_0x5e7ff5=0xce;}_0x4351e2[_0xb423('0x15')](_0x5e7ff5);return _0x4351e2[_0xb423('0x1b')](_0xb423('0x1c'),_0x5d84a6+'-'+_0x340319+'/'+_0x42b6fe)[_0xb423('0x16')](_0x5abab2);}return null;};}function patchUpdates(_0x41b213){return function(_0x56ab9d){try{jsonpatch[_0xb423('0x1d')](_0x56ab9d,_0x41b213,!![]);}catch(_0x26f42f){return BPromise[_0xb423('0x1e')](_0x26f42f);}return _0x56ab9d['save']();};}function saveUpdates(_0x210cdb,_0x500eb6){return function(_0x5d4d21){if(_0x5d4d21){return _0x5d4d21[_0xb423('0x1f')](_0x210cdb)[_0xb423('0x20')](function(_0x10d8db){return _0x10d8db;});}return null;};}function removeEntity(_0x504a9d,_0x305232){return function(_0x4b6234){if(_0x4b6234){return _0x4b6234[_0xb423('0x21')]()['then'](function(){_0x504a9d[_0xb423('0x15')](0xcc)[_0xb423('0x22')]();});}};}function handleEntityNotFound(_0x56ed56,_0x2cdf54){return function(_0x1d3e39){if(!_0x1d3e39){_0x56ed56[_0xb423('0x23')](0x194);}return _0x1d3e39;};}function handleError(_0x4e361b,_0x5109a0){_0x5109a0=_0x5109a0||0x1f4;return function(_0x108f74){logger['error'](_0x108f74[_0xb423('0x24')]);if(_0x108f74['name']){delete _0x108f74[_0xb423('0x25')];}_0x4e361b[_0xb423('0x15')](_0x5109a0)[_0xb423('0x26')](_0x108f74);};}exports[_0xb423('0x27')]=function(_0x18e26a,_0x4a1adc){var _0x1de3ee={},_0x48a0ce={},_0x51da03={'count':0x0,'rows':[]};var _0x4a9c4e=_['map'](db[_0xb423('0x28')][_0xb423('0x29')],function(_0x1230d5){return{'name':_0x1230d5['fieldName'],'type':_0x1230d5['type'][_0xb423('0x2a')]};});_0x48a0ce[_0xb423('0x2b')]=_['map'](_0x4a9c4e,_0xb423('0x25'));_0x48a0ce[_0xb423('0x2c')]=_[_0xb423('0x2d')](_0x18e26a[_0xb423('0x2c')]);_0x48a0ce[_0xb423('0x2e')]=_['intersection'](_0x48a0ce[_0xb423('0x2b')],_0x48a0ce['query']);_0x1de3ee[_0xb423('0x2f')]=_[_0xb423('0x30')](_0x48a0ce[_0xb423('0x2b')],qs[_0xb423('0x31')](_0x18e26a[_0xb423('0x2c')][_0xb423('0x31')]));_0x1de3ee['attributes']=_0x1de3ee[_0xb423('0x2f')][_0xb423('0x32')]?_0x1de3ee['attributes']:_0x48a0ce[_0xb423('0x2b')];if(!_0x18e26a['query'][_0xb423('0x33')](_0xb423('0x34'))){_0x1de3ee['limit']=qs[_0xb423('0x19')](_0x18e26a['query'][_0xb423('0x19')]);_0x1de3ee[_0xb423('0x17')]=qs[_0xb423('0x17')](_0x18e26a[_0xb423('0x2c')][_0xb423('0x17')]);}_0x1de3ee['order']=qs['sort'](_0x18e26a[_0xb423('0x2c')][_0xb423('0x35')]);_0x1de3ee['where']=qs[_0xb423('0x2e')](_[_0xb423('0x36')](_0x18e26a['query'],_0x48a0ce[_0xb423('0x2e')]),_0x4a9c4e);if(_0x18e26a[_0xb423('0x2c')][_0xb423('0x37')]){_0x1de3ee[_0xb423('0x38')]=_[_0xb423('0x39')](_0x1de3ee[_0xb423('0x38')],{'$or':_[_0xb423('0x3a')](_0x4a9c4e,function(_0x19e207){if(_0x19e207[_0xb423('0x3b')]!==_0xb423('0x3c')){var _0x17eb60={};_0x17eb60[_0x19e207[_0xb423('0x25')]]={'$like':'%'+_0x18e26a[_0xb423('0x2c')][_0xb423('0x37')]+'%'};return _0x17eb60;}})});}_0x1de3ee=_['merge']({},_0x1de3ee,_0x18e26a[_0xb423('0x3d')]);var _0x5bd098={'where':_0x1de3ee['where']};return db['JscriptyAnswerReport']['count'](_0x5bd098)[_0xb423('0x20')](function(_0x162790){_0x51da03['count']=_0x162790;if(_0x18e26a[_0xb423('0x2c')][_0xb423('0x3e')]){_0x1de3ee[_0xb423('0x3f')]=[{'all':!![]}];}return db[_0xb423('0x28')]['findAll'](_0x1de3ee);})[_0xb423('0x20')](function(_0x18a80e){_0x51da03[_0xb423('0x40')]=_0x18a80e;return _0x51da03;})['then'](respondWithFilteredResult(_0x4a1adc,_0x1de3ee))[_0xb423('0x41')](handleError(_0x4a1adc,null));};exports[_0xb423('0x42')]=function(_0x555cdb,_0x590a92){var _0x41f7cd={'raw':!![],'where':{'id':_0x555cdb[_0xb423('0x43')]['id']}},_0x520744={};_0x520744[_0xb423('0x2b')]=_['keys'](db[_0xb423('0x28')]['rawAttributes']);_0x520744[_0xb423('0x2c')]=_[_0xb423('0x2d')](_0x555cdb[_0xb423('0x2c')]);_0x520744[_0xb423('0x2e')]=_[_0xb423('0x30')](_0x520744[_0xb423('0x2b')],_0x520744[_0xb423('0x2c')]);_0x41f7cd[_0xb423('0x2f')]=_[_0xb423('0x30')](_0x520744[_0xb423('0x2b')],qs[_0xb423('0x31')](_0x555cdb[_0xb423('0x2c')][_0xb423('0x31')]));_0x41f7cd[_0xb423('0x2f')]=_0x41f7cd[_0xb423('0x2f')][_0xb423('0x32')]?_0x41f7cd[_0xb423('0x2f')]:_0x520744[_0xb423('0x2b')];if(_0x555cdb[_0xb423('0x2c')]['includeAll']){_0x41f7cd[_0xb423('0x3f')]=[{'all':!![]}];}_0x41f7cd=_[_0xb423('0x39')]({},_0x41f7cd,_0x555cdb[_0xb423('0x3d')]);return db[_0xb423('0x28')][_0xb423('0x44')](_0x41f7cd)[_0xb423('0x20')](handleEntityNotFound(_0x590a92,null))['then'](respondWithResult(_0x590a92,null))['catch'](handleError(_0x590a92,null));};exports['create']=function(_0x2e3efa,_0x299bd9){return db[_0xb423('0x28')][_0xb423('0x45')](_0x2e3efa[_0xb423('0x46')],{})['then'](respondWithResult(_0x299bd9,0xc9))['catch'](handleError(_0x299bd9,null));};exports[_0xb423('0x1f')]=function(_0x4cbb9b,_0x52081f){if(_0x4cbb9b[_0xb423('0x46')]['id']){delete _0x4cbb9b[_0xb423('0x46')]['id'];}return db[_0xb423('0x28')]['find']({'where':{'id':_0x4cbb9b['params']['id']}})[_0xb423('0x20')](handleEntityNotFound(_0x52081f,null))[_0xb423('0x20')](saveUpdates(_0x4cbb9b[_0xb423('0x46')],null))[_0xb423('0x20')](respondWithResult(_0x52081f,null))[_0xb423('0x41')](handleError(_0x52081f,null));};exports['destroy']=function(_0x529046,_0xff5347){return db['JscriptyAnswerReport']['find']({'where':{'id':_0x529046[_0xb423('0x43')]['id']}})['then'](handleEntityNotFound(_0xff5347,null))['then'](removeEntity(_0xff5347,null))['catch'](handleError(_0xff5347,null));};exports[_0xb423('0x47')]=function(_0x457150,_0x32f6a6){return db['JscriptyAnswerReport']['describe']()[_0xb423('0x20')](respondWithResult(_0x32f6a6,null))[_0xb423('0x41')](handleError(_0x32f6a6,null));}; \ No newline at end of file +var _0x446c=['name','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x446c,0x156));var _0xc446=function(_0x4bf96c,_0x4d24fd){_0x4bf96c=_0x4bf96c-0x0;var _0x281d09=_0x446c[_0x4bf96c];return _0x281d09;};'use strict';var emlformat=require(_0xc446('0x0'));var rimraf=require(_0xc446('0x1'));var zipdir=require(_0xc446('0x2'));var jsonpatch=require(_0xc446('0x3'));var rp=require('request-promise');var moment=require(_0xc446('0x4'));var BPromise=require(_0xc446('0x5'));var Mustache=require(_0xc446('0x6'));var util=require('util');var path=require(_0xc446('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc446('0x8'));var fs=require('fs');var fs_extra=require(_0xc446('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc446('0xa'));var jsforce=require(_0xc446('0xb'));var deskjs=require(_0xc446('0xc'));var toCsv=require(_0xc446('0xd'));var querystring=require(_0xc446('0xe'));var Papa=require('papaparse');var Redis=require(_0xc446('0xf'));var authService=require(_0xc446('0x10'));var qs=require(_0xc446('0x11'));var as=require(_0xc446('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc446('0x13'))(_0xc446('0x14'));var utils=require(_0xc446('0x15'));var config=require(_0xc446('0x16'));var licenseUtil=require(_0xc446('0x17'));var db=require(_0xc446('0x18'))['db'];function respondWithStatusCode(_0x1a2099,_0x19083f){_0x19083f=_0x19083f||0xcc;return function(_0x22a70e){if(_0x22a70e){return _0x1a2099[_0xc446('0x19')](_0x19083f);}return _0x1a2099[_0xc446('0x1a')](_0x19083f)[_0xc446('0x1b')]();};}function respondWithResult(_0x1cfc0a,_0x72faac){_0x72faac=_0x72faac||0xc8;return function(_0x21d8e4){if(_0x21d8e4){return _0x1cfc0a[_0xc446('0x1a')](_0x72faac)[_0xc446('0x1c')](_0x21d8e4);}};}function respondWithFilteredResult(_0x20e51b,_0x2b09db){return function(_0x5d2701){if(_0x5d2701){var _0x3ba115=typeof _0x2b09db[_0xc446('0x1d')]===_0xc446('0x1e')&&typeof _0x2b09db[_0xc446('0x1f')]===_0xc446('0x1e');var _0x274040=_0x5d2701[_0xc446('0x20')];var _0x30038f=_0x3ba115?0x0:_0x2b09db[_0xc446('0x1d')];var _0x606af1=_0x3ba115?_0x5d2701['count']:_0x2b09db[_0xc446('0x1d')]+_0x2b09db[_0xc446('0x1f')];var _0x5cd0c1;if(_0x606af1>=_0x274040){_0x606af1=_0x274040;_0x5cd0c1=0xc8;}else{_0x5cd0c1=0xce;}_0x20e51b[_0xc446('0x1a')](_0x5cd0c1);return _0x20e51b[_0xc446('0x21')](_0xc446('0x22'),_0x30038f+'-'+_0x606af1+'/'+_0x274040)[_0xc446('0x1c')](_0x5d2701);}return null;};}function patchUpdates(_0x409a8e){return function(_0x37108c){try{jsonpatch[_0xc446('0x23')](_0x37108c,_0x409a8e,!![]);}catch(_0xc18765){return BPromise[_0xc446('0x24')](_0xc18765);}return _0x37108c[_0xc446('0x25')]();};}function saveUpdates(_0x5ce5f7,_0x35aedc){return function(_0x1ea08b){if(_0x1ea08b){return _0x1ea08b[_0xc446('0x26')](_0x5ce5f7)[_0xc446('0x27')](function(_0x3596f4){return _0x3596f4;});}return null;};}function removeEntity(_0xb696e,_0x36a6f5){return function(_0x1b785a){if(_0x1b785a){return _0x1b785a[_0xc446('0x28')]()[_0xc446('0x27')](function(){_0xb696e[_0xc446('0x1a')](0xcc)[_0xc446('0x1b')]();});}};}function handleEntityNotFound(_0x25f58d,_0x438410){return function(_0x16133b){if(!_0x16133b){_0x25f58d[_0xc446('0x19')](0x194);}return _0x16133b;};}function handleError(_0x465e18,_0x51933d){_0x51933d=_0x51933d||0x1f4;return function(_0xb3ab06){logger[_0xc446('0x29')](_0xb3ab06[_0xc446('0x2a')]);if(_0xb3ab06[_0xc446('0x2b')]){delete _0xb3ab06[_0xc446('0x2b')];}_0x465e18[_0xc446('0x1a')](_0x51933d)['send'](_0xb3ab06);};}exports['index']=function(_0x37532c,_0x1b2dc8){var _0x19f57f={},_0x865c07={},_0x4ea05e={'count':0x0,'rows':[]};var _0x420fcb=_[_0xc446('0x2c')](db[_0xc446('0x2d')][_0xc446('0x2e')],function(_0x1bd4e6){return{'name':_0x1bd4e6[_0xc446('0x2f')],'type':_0x1bd4e6[_0xc446('0x30')][_0xc446('0x31')]};});_0x865c07[_0xc446('0x32')]=_[_0xc446('0x2c')](_0x420fcb,'name');_0x865c07['query']=_['keys'](_0x37532c[_0xc446('0x33')]);_0x865c07[_0xc446('0x34')]=_[_0xc446('0x35')](_0x865c07[_0xc446('0x32')],_0x865c07[_0xc446('0x33')]);_0x19f57f[_0xc446('0x36')]=_[_0xc446('0x35')](_0x865c07['model'],qs[_0xc446('0x37')](_0x37532c[_0xc446('0x33')][_0xc446('0x37')]));_0x19f57f[_0xc446('0x36')]=_0x19f57f[_0xc446('0x36')]['length']?_0x19f57f[_0xc446('0x36')]:_0x865c07[_0xc446('0x32')];if(!_0x37532c[_0xc446('0x33')][_0xc446('0x38')](_0xc446('0x39'))){_0x19f57f[_0xc446('0x1f')]=qs[_0xc446('0x1f')](_0x37532c[_0xc446('0x33')]['limit']);_0x19f57f['offset']=qs[_0xc446('0x1d')](_0x37532c[_0xc446('0x33')][_0xc446('0x1d')]);}_0x19f57f['order']=qs[_0xc446('0x3a')](_0x37532c[_0xc446('0x33')][_0xc446('0x3a')]);_0x19f57f['where']=qs['filters'](_['pick'](_0x37532c[_0xc446('0x33')],_0x865c07['filters']),_0x420fcb);if(_0x37532c[_0xc446('0x33')][_0xc446('0x3b')]){_0x19f57f['where']=_[_0xc446('0x3c')](_0x19f57f[_0xc446('0x3d')],{'$or':_[_0xc446('0x2c')](_0x420fcb,function(_0x2beba1){if(_0x2beba1['type']!==_0xc446('0x3e')){var _0xb9c7e6={};_0xb9c7e6[_0x2beba1['name']]={'$like':'%'+_0x37532c[_0xc446('0x33')][_0xc446('0x3b')]+'%'};return _0xb9c7e6;}})});}_0x19f57f=_[_0xc446('0x3c')]({},_0x19f57f,_0x37532c[_0xc446('0x3f')]);var _0xf3400e={'where':_0x19f57f['where']};return db[_0xc446('0x2d')][_0xc446('0x20')](_0xf3400e)[_0xc446('0x27')](function(_0xf8c80c){_0x4ea05e[_0xc446('0x20')]=_0xf8c80c;if(_0x37532c['query'][_0xc446('0x40')]){_0x19f57f[_0xc446('0x41')]=[{'all':!![]}];}return db[_0xc446('0x2d')][_0xc446('0x42')](_0x19f57f);})[_0xc446('0x27')](function(_0x5e65d5){_0x4ea05e[_0xc446('0x43')]=_0x5e65d5;return _0x4ea05e;})['then'](respondWithFilteredResult(_0x1b2dc8,_0x19f57f))[_0xc446('0x44')](handleError(_0x1b2dc8,null));};exports[_0xc446('0x45')]=function(_0x520ffd,_0x3287ce){var _0x5e250b={'raw':!![],'where':{'id':_0x520ffd[_0xc446('0x46')]['id']}},_0x29f36f={};_0x29f36f[_0xc446('0x32')]=_[_0xc446('0x47')](db['JscriptyAnswerReport'][_0xc446('0x2e')]);_0x29f36f[_0xc446('0x33')]=_[_0xc446('0x47')](_0x520ffd['query']);_0x29f36f[_0xc446('0x34')]=_[_0xc446('0x35')](_0x29f36f[_0xc446('0x32')],_0x29f36f[_0xc446('0x33')]);_0x5e250b[_0xc446('0x36')]=_[_0xc446('0x35')](_0x29f36f[_0xc446('0x32')],qs[_0xc446('0x37')](_0x520ffd[_0xc446('0x33')][_0xc446('0x37')]));_0x5e250b[_0xc446('0x36')]=_0x5e250b[_0xc446('0x36')][_0xc446('0x48')]?_0x5e250b[_0xc446('0x36')]:_0x29f36f[_0xc446('0x32')];if(_0x520ffd['query']['includeAll']){_0x5e250b[_0xc446('0x41')]=[{'all':!![]}];}_0x5e250b=_[_0xc446('0x3c')]({},_0x5e250b,_0x520ffd['options']);return db['JscriptyAnswerReport']['find'](_0x5e250b)['then'](handleEntityNotFound(_0x3287ce,null))[_0xc446('0x27')](respondWithResult(_0x3287ce,null))[_0xc446('0x44')](handleError(_0x3287ce,null));};exports[_0xc446('0x49')]=function(_0x2fc1bf,_0x19ca3d){return db[_0xc446('0x2d')][_0xc446('0x49')](_0x2fc1bf[_0xc446('0x4a')],{})[_0xc446('0x27')](respondWithResult(_0x19ca3d,0xc9))[_0xc446('0x44')](handleError(_0x19ca3d,null));};exports['update']=function(_0x40aa4f,_0x317559){if(_0x40aa4f[_0xc446('0x4a')]['id']){delete _0x40aa4f['body']['id'];}return db[_0xc446('0x2d')]['find']({'where':{'id':_0x40aa4f[_0xc446('0x46')]['id']}})[_0xc446('0x27')](handleEntityNotFound(_0x317559,null))[_0xc446('0x27')](saveUpdates(_0x40aa4f[_0xc446('0x4a')],null))[_0xc446('0x27')](respondWithResult(_0x317559,null))['catch'](handleError(_0x317559,null));};exports[_0xc446('0x28')]=function(_0x5415e5,_0x26ec5f){return db['JscriptyAnswerReport'][_0xc446('0x4b')]({'where':{'id':_0x5415e5['params']['id']}})[_0xc446('0x27')](handleEntityNotFound(_0x26ec5f,null))[_0xc446('0x27')](removeEntity(_0x26ec5f,null))['catch'](handleError(_0x26ec5f,null));};exports['describe']=function(_0x1a66fd,_0x5759af){return db[_0xc446('0x2d')][_0xc446('0x4c')]()[_0xc446('0x27')](respondWithResult(_0x5759af,null))[_0xc446('0x44')](handleError(_0x5759af,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 651245c..dde12c1 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 _0x4fdb=['./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x208505,_0x241a77){var _0x1a985f=function(_0x4a5110){while(--_0x4a5110){_0x208505['push'](_0x208505['shift']());}};_0x1a985f(++_0x241a77);}(_0x4fdb,0xa1));var _0xb4fd=function(_0x5e3f02,_0x407aae){_0x5e3f02=_0x5e3f02-0x0;var _0x594f19=_0x4fdb[_0x5e3f02];return _0x594f19;};'use strict';var _=require(_0xb4fd('0x0'));var util=require('util');var logger=require(_0xb4fd('0x1'))('api');var moment=require(_0xb4fd('0x2'));var BPromise=require(_0xb4fd('0x3'));var rp=require(_0xb4fd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb4fd('0x5'));var config=require(_0xb4fd('0x6'));var attributes=require(_0xb4fd('0x7'));module[_0xb4fd('0x8')]=function(_0x189cec,_0x43be37){return _0x189cec[_0xb4fd('0x9')](_0xb4fd('0xa'),attributes,{'tableName':_0xb4fd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e0d=['../../config/environment','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport','report_jscripty_answers','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x51639a,_0x35f006){var _0x3abae4=function(_0x89b35e){while(--_0x89b35e){_0x51639a['push'](_0x51639a['shift']());}};_0x3abae4(++_0x35f006);}(_0x0e0d,0x68));var _0xd0e0=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x0e0d[_0x160c73];return _0xd9302;};'use strict';var _=require('lodash');var util=require(_0xd0e0('0x0'));var logger=require(_0xd0e0('0x1'))('api');var moment=require('moment');var BPromise=require(_0xd0e0('0x2'));var rp=require(_0xd0e0('0x3'));var fs=require('fs');var path=require(_0xd0e0('0x4'));var rimraf=require(_0xd0e0('0x5'));var config=require(_0xd0e0('0x6'));var attributes=require(_0xd0e0('0x7'));module[_0xd0e0('0x8')]=function(_0x3e507c,_0x204b65){return _0x3e507c['define'](_0xd0e0('0x9'),attributes,{'tableName':_0xd0e0('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 7e58184..b8db4b5 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 _0xe5a9=['message','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyAnswerReport,\x20%s,\x20%s'];(function(_0x43776a,_0x4eb74c){var _0x18eb8f=function(_0x319afb){while(--_0x319afb){_0x43776a['push'](_0x43776a['shift']());}};_0x18eb8f(++_0x4eb74c);}(_0xe5a9,0x135));var _0x9e5a=function(_0x1f15d4,_0x547ee1){_0x1f15d4=_0x1f15d4-0x0;var _0x407670=_0xe5a9[_0x1f15d4];return _0x407670;};'use strict';var _=require(_0x9e5a('0x0'));var util=require(_0x9e5a('0x1'));var moment=require(_0x9e5a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9e5a('0x3'));var db=require(_0x9e5a('0x4'))['db'];var utils=require(_0x9e5a('0x5'));var logger=require(_0x9e5a('0x6'))(_0x9e5a('0x7'));var config=require(_0x9e5a('0x8'));var jayson=require(_0x9e5a('0x9'));var client=jayson['client'][_0x9e5a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32d0e4,_0x4a07b8,_0x1c2c25){return new BPromise(function(_0x50e5a9,_0x48aea3){return client[_0x9e5a('0xb')](_0x32d0e4,_0x1c2c25)[_0x9e5a('0xc')](function(_0x1440d9){logger[_0x9e5a('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4a07b8,_0x9e5a('0xe'));logger[_0x9e5a('0xf')](_0x9e5a('0x10'),_0x4a07b8,_0x9e5a('0xe'),JSON[_0x9e5a('0x11')](_0x1440d9));if(_0x1440d9[_0x9e5a('0x12')]){if(_0x1440d9[_0x9e5a('0x12')][_0x9e5a('0x13')]===0x1f4){logger[_0x9e5a('0x12')](_0x9e5a('0x14'),_0x4a07b8,_0x1440d9['error'][_0x9e5a('0x15')]);return _0x48aea3(_0x1440d9[_0x9e5a('0x12')]['message']);}logger[_0x9e5a('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4a07b8,_0x1440d9[_0x9e5a('0x12')]['message']);return _0x50e5a9(_0x1440d9[_0x9e5a('0x12')][_0x9e5a('0x15')]);}else{logger[_0x9e5a('0xd')](_0x9e5a('0x14'),_0x4a07b8,_0x9e5a('0xe'));_0x50e5a9(_0x1440d9['result'][_0x9e5a('0x15')]);}})['catch'](function(_0x128fc7){logger['error'](_0x9e5a('0x14'),_0x4a07b8,_0x128fc7);_0x48aea3(_0x128fc7);});});} \ No newline at end of file +var _0xe600=['stringify','error','code','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent'];(function(_0x104884,_0x317705){var _0x1f6634=function(_0x4b2388){while(--_0x4b2388){_0x104884['push'](_0x104884['shift']());}};_0x1f6634(++_0x317705);}(_0xe600,0x116));var _0x0e60=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe600[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x0e60('0x0'));var util=require(_0x0e60('0x1'));var moment=require(_0x0e60('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0e60('0x3'));var db=require(_0x0e60('0x4'))['db'];var utils=require(_0x0e60('0x5'));var logger=require(_0x0e60('0x6'))(_0x0e60('0x7'));var config=require('../../config/environment');var jayson=require(_0x0e60('0x8'));var client=jayson[_0x0e60('0x9')][_0x0e60('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36c5f4,_0x5e33d9,_0x48ff78){return new BPromise(function(_0x2c132a,_0x54e42e){return client[_0x0e60('0xb')](_0x36c5f4,_0x48ff78)[_0x0e60('0xc')](function(_0x5bb339){logger[_0x0e60('0xd')](_0x0e60('0xe'),_0x5e33d9,_0x0e60('0xf'));logger['debug']('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x5e33d9,_0x0e60('0xf'),JSON[_0x0e60('0x10')](_0x5bb339));if(_0x5bb339[_0x0e60('0x11')]){if(_0x5bb339[_0x0e60('0x11')][_0x0e60('0x12')]===0x1f4){logger[_0x0e60('0x11')](_0x0e60('0xe'),_0x5e33d9,_0x5bb339['error'][_0x0e60('0x13')]);return _0x54e42e(_0x5bb339[_0x0e60('0x11')][_0x0e60('0x13')]);}logger['error'](_0x0e60('0xe'),_0x5e33d9,_0x5bb339['error'][_0x0e60('0x13')]);return _0x2c132a(_0x5bb339[_0x0e60('0x11')][_0x0e60('0x13')]);}else{logger[_0x0e60('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x5e33d9,_0x0e60('0xf'));_0x2c132a(_0x5bb339['result'][_0x0e60('0x13')]);}})[_0x0e60('0x14')](function(_0x67a295){logger['error'](_0x0e60('0xe'),_0x5e33d9,_0x67a295);_0x54e42e(_0x67a295);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 8fcddd6..39fa319 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 _0x6a01=['destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','get','isAuthenticated','/:id','show','getSessions','/:id/answers','getAnswers','30s','post','create','/:id/clone','clone','put','delete'];(function(_0x5e953b,_0x22b43c){var _0x4a149d=function(_0x48584e){while(--_0x48584e){_0x5e953b['push'](_0x5e953b['shift']());}};_0x4a149d(++_0x22b43c);}(_0x6a01,0x152));var _0x16a0=function(_0x1e50fc,_0x3d2684){_0x1e50fc=_0x1e50fc-0x0;var _0x497f51=_0x6a01[_0x1e50fc];return _0x497f51;};'use strict';var multer=require(_0x16a0('0x0'));var util=require(_0x16a0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x16a0('0x2'));var router=express[_0x16a0('0x3')]();var fs_extra=require(_0x16a0('0x4'));var auth=require(_0x16a0('0x5'));var interaction=require(_0x16a0('0x6'));var config=require('../../config/environment');var controller=require(_0x16a0('0x7'));router[_0x16a0('0x8')]('/',auth[_0x16a0('0x9')](),controller['index']);router[_0x16a0('0x8')](_0x16a0('0xa'),auth[_0x16a0('0x9')](),controller[_0x16a0('0xb')]);router[_0x16a0('0x8')]('/:id/sessions',auth['isAuthenticated'](),controller[_0x16a0('0xc')]);router[_0x16a0('0x8')](_0x16a0('0xd'),auth[_0x16a0('0x9')](),controller[_0x16a0('0xe')]);router['get']('/:id/summary',auth['isAuthenticated'](),timeout(_0x16a0('0xf')),controller['getSummary']);router[_0x16a0('0x10')]('/',auth['isAuthenticated'](),controller[_0x16a0('0x11')]);router[_0x16a0('0x10')](_0x16a0('0x12'),auth['isAuthenticated'](),controller[_0x16a0('0x13')]);router[_0x16a0('0x14')]('/:id',auth[_0x16a0('0x9')](),controller['update']);router[_0x16a0('0x15')]('/:id',auth[_0x16a0('0x9')](),controller[_0x16a0('0x16')]);module[_0x16a0('0x17')]=router; \ No newline at end of file +var _0x5385=['./jscriptyProject.controller','get','isAuthenticated','index','/:id','getSessions','/:id/answers','getAnswers','30s','post','create','clone','put','update','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x5385,0x10a));var _0x5538=function(_0x229612,_0xf55e16){_0x229612=_0x229612-0x0;var _0x4fafc7=_0x5385[_0x229612];return _0x4fafc7;};'use strict';var multer=require('multer');var util=require(_0x5538('0x0'));var path=require(_0x5538('0x1'));var timeout=require(_0x5538('0x2'));var express=require(_0x5538('0x3'));var router=express[_0x5538('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5538('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5538('0x6'));var controller=require(_0x5538('0x7'));router[_0x5538('0x8')]('/',auth[_0x5538('0x9')](),controller[_0x5538('0xa')]);router[_0x5538('0x8')](_0x5538('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x5538('0x8')]('/:id/sessions',auth['isAuthenticated'](),controller[_0x5538('0xc')]);router[_0x5538('0x8')](_0x5538('0xd'),auth['isAuthenticated'](),controller[_0x5538('0xe')]);router[_0x5538('0x8')]('/:id/summary',auth[_0x5538('0x9')](),timeout(_0x5538('0xf')),controller['getSummary']);router[_0x5538('0x10')]('/',auth['isAuthenticated'](),controller[_0x5538('0x11')]);router[_0x5538('0x10')]('/:id/clone',auth[_0x5538('0x9')](),controller[_0x5538('0x12')]);router[_0x5538('0x13')](_0x5538('0xb'),auth['isAuthenticated'](),controller[_0x5538('0x14')]);router['delete'](_0x5538('0xb'),auth[_0x5538('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index a9aab99..f26a854 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 _0x69c7=['exports','STRING','name','TEXT','long','isObjectLike','setDataValue','formData','stringify','isString','format','getDataValue','BOOLEAN','sequelize','lodash','util'];(function(_0x76517f,_0x325017){var _0x43cc3a=function(_0xd1b968){while(--_0xd1b968){_0x76517f['push'](_0x76517f['shift']());}};_0x43cc3a(++_0x325017);}(_0x69c7,0x8d));var _0x769c=function(_0x2d572b,_0x14d892){_0x2d572b=_0x2d572b-0x0;var _0xa2f78a=_0x69c7[_0x2d572b];return _0xa2f78a;};'use strict';var Sequelize=require(_0x769c('0x0'));var _=require(_0x769c('0x1'));var util=require(_0x769c('0x2'));module[_0x769c('0x3')]={'name':{'type':Sequelize[_0x769c('0x4')],'unique':_0x769c('0x5')},'description':{'type':Sequelize[_0x769c('0x4')]},'formData':{'type':Sequelize[_0x769c('0x6')](_0x769c('0x7')),'set':function(_0x42b789){if(_[_0x769c('0x8')](_0x42b789)){this[_0x769c('0x9')](_0x769c('0xa'),JSON[_0x769c('0xb')](_0x42b789));}else if(_[_0x769c('0xc')](_0x42b789)){this[_0x769c('0x9')](_0x769c('0xa'),_0x42b789);}else{this[_0x769c('0x9')]('formData',util[_0x769c('0xd')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this['getDataValue'](_0x769c('0x5'))||'',this[_0x769c('0xe')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x769c('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x769c('0xf')],'defaultValue':![]}}; \ No newline at end of file +var _0x83e5=['setDataValue','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','lodash','util','STRING','name','TEXT','long','isObjectLike','formData','stringify','isString'];(function(_0x4c038e,_0x188229){var _0x237ec4=function(_0x56bf64){while(--_0x56bf64){_0x4c038e['push'](_0x4c038e['shift']());}};_0x237ec4(++_0x188229);}(_0x83e5,0x1e5));var _0x583e=function(_0x36fbef,_0x4ffc84){_0x36fbef=_0x36fbef-0x0;var _0x45e270=_0x83e5[_0x36fbef];return _0x45e270;};'use strict';var Sequelize=require('sequelize');var _=require(_0x583e('0x0'));var util=require(_0x583e('0x1'));module['exports']={'name':{'type':Sequelize[_0x583e('0x2')],'unique':_0x583e('0x3')},'description':{'type':Sequelize[_0x583e('0x2')]},'formData':{'type':Sequelize[_0x583e('0x4')](_0x583e('0x5')),'set':function(_0x47746e){if(_[_0x583e('0x6')](_0x47746e)){this['setDataValue'](_0x583e('0x7'),JSON[_0x583e('0x8')](_0x47746e));}else if(_[_0x583e('0x9')](_0x47746e)){this[_0x583e('0xa')](_0x583e('0x7'),_0x47746e);}else{this[_0x583e('0xa')](_0x583e('0x7'),util['format'](_0x583e('0xb'),this['getDataValue'](_0x583e('0x3'))||'',this[_0x583e('0xc')](_0x583e('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x583e('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x583e('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 a224f7d..e3b6e06 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 _0xefd7=['catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','clone','options','omit','createdAt','updatedAt','params','getSessions','findOne','JscriptySessionReport','nolimit','getAnswers','JscriptyAnswerReport','order','ProjectId','number','toString','indexOf','replace','getSummary','starttime','parse','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','push','isEmpty','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','download','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','get','Projects','UserProfileResource','end','error','name','send','index','JscriptyProject','rawAttributes','model','query','keys','filters','intersection','attributes','hasOwnProperty','sort','where','pick','filter','map','merge','includeAll','include','findAll','rows','fields','length','find'];(function(_0x298dd7,_0x579273){var _0x995c4a=function(_0xccbb73){while(--_0xccbb73){_0x298dd7['push'](_0x298dd7['shift']());}};_0x995c4a(++_0x579273);}(_0xefd7,0x99));var _0x7efd=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xefd7[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x7efd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7efd('0x1'));var jsonpatch=require(_0x7efd('0x2'));var rp=require(_0x7efd('0x3'));var moment=require('moment');var BPromise=require(_0x7efd('0x4'));var Mustache=require(_0x7efd('0x5'));var util=require(_0x7efd('0x6'));var path=require(_0x7efd('0x7'));var sox=require('sox');var csv=require(_0x7efd('0x8'));var ejs=require(_0x7efd('0x9'));var fs=require('fs');var fs_extra=require(_0x7efd('0xa'));var _=require(_0x7efd('0xb'));var squel=require(_0x7efd('0xc'));var crypto=require(_0x7efd('0xd'));var jsforce=require(_0x7efd('0xe'));var deskjs=require(_0x7efd('0xf'));var toCsv=require(_0x7efd('0x8'));var querystring=require('querystring');var Papa=require(_0x7efd('0x10'));var Redis=require(_0x7efd('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7efd('0x12'));var as=require(_0x7efd('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7efd('0x14'))(_0x7efd('0x15'));var utils=require('../../config/utils');var config=require(_0x7efd('0x16'));var licenseUtil=require(_0x7efd('0x17'));var db=require(_0x7efd('0x18'))['db'];function respondWithStatusCode(_0x57269e,_0x5e017c){_0x5e017c=_0x5e017c||0xcc;return function(_0x424da9){if(_0x424da9){return _0x57269e[_0x7efd('0x19')](_0x5e017c);}return _0x57269e[_0x7efd('0x1a')](_0x5e017c)['end']();};}function respondWithResult(_0x17c1f4,_0x37e9f2){_0x37e9f2=_0x37e9f2||0xc8;return function(_0x237323){if(_0x237323){return _0x17c1f4['status'](_0x37e9f2)[_0x7efd('0x1b')](_0x237323);}};}function respondWithFilteredResult(_0x143cb2,_0x5280a2){return function(_0x196674){if(_0x196674){var _0x5affe3=typeof _0x5280a2[_0x7efd('0x1c')]===_0x7efd('0x1d')&&typeof _0x5280a2[_0x7efd('0x1e')]==='undefined';var _0x2a91e1=_0x196674[_0x7efd('0x1f')];var _0x3c0dc2=_0x5affe3?0x0:_0x5280a2[_0x7efd('0x1c')];var _0x47f98a=_0x5affe3?_0x196674['count']:_0x5280a2[_0x7efd('0x1c')]+_0x5280a2['limit'];var _0x58c994;if(_0x47f98a>=_0x2a91e1){_0x47f98a=_0x2a91e1;_0x58c994=0xc8;}else{_0x58c994=0xce;}_0x143cb2[_0x7efd('0x1a')](_0x58c994);return _0x143cb2[_0x7efd('0x20')](_0x7efd('0x21'),_0x3c0dc2+'-'+_0x47f98a+'/'+_0x2a91e1)[_0x7efd('0x1b')](_0x196674);}return null;};}function patchUpdates(_0x5db31e){return function(_0x4330dc){try{jsonpatch[_0x7efd('0x22')](_0x4330dc,_0x5db31e,!![]);}catch(_0x307568){return BPromise['reject'](_0x307568);}return _0x4330dc[_0x7efd('0x23')]();};}function saveUpdates(_0x45cc61,_0xbdd9f8){return function(_0x230714){if(_0x230714){return _0x230714[_0x7efd('0x24')](_0x45cc61)['then'](function(_0xd04f56){return _0xd04f56;});}return null;};}function removeEntity(_0x1dc48c,_0x127c86){return function(_0x35bdb6){if(_0x35bdb6){return _0x35bdb6[_0x7efd('0x25')]()[_0x7efd('0x26')](function(){var _0x3e3b74=_0x35bdb6[_0x7efd('0x27')]({'plain':!![]});var _0x4e604a=_0x7efd('0x28');return db[_0x7efd('0x29')][_0x7efd('0x25')]({'where':{'type':_0x4e604a,'resourceId':_0x3e3b74['id']}})['then'](function(){return _0x35bdb6;});})[_0x7efd('0x26')](function(){_0x1dc48c[_0x7efd('0x1a')](0xcc)[_0x7efd('0x2a')]();});}};}function handleEntityNotFound(_0x500b6e,_0x433588){return function(_0x563b1f){if(!_0x563b1f){_0x500b6e[_0x7efd('0x19')](0x194);}return _0x563b1f;};}function handleError(_0x81309e,_0x319feb){_0x319feb=_0x319feb||0x1f4;return function(_0x4d3c68){logger[_0x7efd('0x2b')](_0x4d3c68['stack']);if(_0x4d3c68['name']){delete _0x4d3c68[_0x7efd('0x2c')];}_0x81309e[_0x7efd('0x1a')](_0x319feb)[_0x7efd('0x2d')](_0x4d3c68);};}exports[_0x7efd('0x2e')]=function(_0x332967,_0x26cbee){var _0x38fa07={},_0x2fa66e={},_0x123c11={'count':0x0,'rows':[]};var _0x43aa5b=_['map'](db[_0x7efd('0x2f')][_0x7efd('0x30')],function(_0x13b057){return{'name':_0x13b057['fieldName'],'type':_0x13b057['type']['key']};});_0x2fa66e[_0x7efd('0x31')]=_['map'](_0x43aa5b,_0x7efd('0x2c'));_0x2fa66e[_0x7efd('0x32')]=_[_0x7efd('0x33')](_0x332967[_0x7efd('0x32')]);_0x2fa66e[_0x7efd('0x34')]=_[_0x7efd('0x35')](_0x2fa66e['model'],_0x2fa66e[_0x7efd('0x32')]);_0x38fa07['attributes']=_[_0x7efd('0x35')](_0x2fa66e[_0x7efd('0x31')],qs['fields'](_0x332967['query']['fields']));_0x38fa07['attributes']=_0x38fa07[_0x7efd('0x36')]['length']?_0x38fa07['attributes']:_0x2fa66e[_0x7efd('0x31')];if(!_0x332967[_0x7efd('0x32')][_0x7efd('0x37')]('nolimit')){_0x38fa07[_0x7efd('0x1e')]=qs[_0x7efd('0x1e')](_0x332967[_0x7efd('0x32')][_0x7efd('0x1e')]);_0x38fa07[_0x7efd('0x1c')]=qs[_0x7efd('0x1c')](_0x332967[_0x7efd('0x32')][_0x7efd('0x1c')]);}_0x38fa07['order']=qs[_0x7efd('0x38')](_0x332967[_0x7efd('0x32')]['sort']);_0x38fa07[_0x7efd('0x39')]=qs['filters'](_[_0x7efd('0x3a')](_0x332967[_0x7efd('0x32')],_0x2fa66e['filters']),_0x43aa5b);if(_0x332967['query'][_0x7efd('0x3b')]){_0x38fa07[_0x7efd('0x39')]=_['merge'](_0x38fa07[_0x7efd('0x39')],{'$or':_[_0x7efd('0x3c')](_0x43aa5b,function(_0x13481c){if(_0x13481c['type']!=='VIRTUAL'){var _0x57aa0b={};_0x57aa0b[_0x13481c[_0x7efd('0x2c')]]={'$like':'%'+_0x332967[_0x7efd('0x32')][_0x7efd('0x3b')]+'%'};return _0x57aa0b;}})});}_0x38fa07=_[_0x7efd('0x3d')]({},_0x38fa07,_0x332967['options']);var _0x53a63b={'where':_0x38fa07['where']};return db[_0x7efd('0x2f')][_0x7efd('0x1f')](_0x53a63b)['then'](function(_0x2ba456){_0x123c11['count']=_0x2ba456;if(_0x332967[_0x7efd('0x32')][_0x7efd('0x3e')]){_0x38fa07[_0x7efd('0x3f')]=[{'all':!![]}];}return db[_0x7efd('0x2f')][_0x7efd('0x40')](_0x38fa07);})[_0x7efd('0x26')](function(_0x34597a){_0x123c11[_0x7efd('0x41')]=_0x34597a;return _0x123c11;})[_0x7efd('0x26')](respondWithFilteredResult(_0x26cbee,_0x38fa07))['catch'](handleError(_0x26cbee,null));};exports['show']=function(_0x1fdd69,_0x13a533){var _0x5a47ac={'raw':![],'where':{'id':_0x1fdd69['params']['id']}},_0x47e86e={};_0x47e86e['model']=_[_0x7efd('0x33')](db['JscriptyProject']['rawAttributes']);_0x47e86e['query']=_[_0x7efd('0x33')](_0x1fdd69['query']);_0x47e86e['filters']=_[_0x7efd('0x35')](_0x47e86e[_0x7efd('0x31')],_0x47e86e['query']);_0x5a47ac[_0x7efd('0x36')]=_[_0x7efd('0x35')](_0x47e86e[_0x7efd('0x31')],qs[_0x7efd('0x42')](_0x1fdd69[_0x7efd('0x32')][_0x7efd('0x42')]));_0x5a47ac['attributes']=_0x5a47ac['attributes'][_0x7efd('0x43')]?_0x5a47ac[_0x7efd('0x36')]:_0x47e86e[_0x7efd('0x31')];if(_0x1fdd69['query'][_0x7efd('0x3e')]){_0x5a47ac[_0x7efd('0x3f')]=[{'all':!![]}];}_0x5a47ac=_[_0x7efd('0x3d')]({},_0x5a47ac,_0x1fdd69['options']);return db[_0x7efd('0x2f')][_0x7efd('0x44')](_0x5a47ac)[_0x7efd('0x26')](handleEntityNotFound(_0x13a533,null))[_0x7efd('0x26')](respondWithResult(_0x13a533,null))[_0x7efd('0x45')](handleError(_0x13a533,null));};exports[_0x7efd('0x46')]=function(_0x5b41dc,_0x320b6d){return db[_0x7efd('0x2f')][_0x7efd('0x46')](_0x5b41dc[_0x7efd('0x47')],{})[_0x7efd('0x26')](function(_0x306a44){var _0x2c1d24=_0x5b41dc[_0x7efd('0x48')]['get']({'plain':!![]});if(!_0x2c1d24)throw new Error(_0x7efd('0x49'));if(_0x2c1d24[_0x7efd('0x4a')]==='user'){var _0x42d37a=_0x306a44[_0x7efd('0x27')]({'plain':!![]});var _0x30706b=_0x7efd('0x28');return db[_0x7efd('0x4b')][_0x7efd('0x44')]({'where':{'name':_0x30706b,'userProfileId':_0x2c1d24['userProfileId']},'raw':!![]})[_0x7efd('0x26')](function(_0x25099e){if(_0x25099e&&_0x25099e[_0x7efd('0x4c')]===0x0){return db[_0x7efd('0x29')][_0x7efd('0x46')]({'name':_0x42d37a[_0x7efd('0x2c')],'resourceId':_0x42d37a['id'],'type':_0x25099e[_0x7efd('0x2c')],'sectionId':_0x25099e['id']},{})[_0x7efd('0x26')](function(){return _0x306a44;});}else{return _0x306a44;}})[_0x7efd('0x45')](function(_0x40773a){logger[_0x7efd('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x40773a);throw _0x40773a;});}return _0x306a44;})[_0x7efd('0x26')](respondWithResult(_0x320b6d,0xc9))['catch'](handleError(_0x320b6d,null));};exports[_0x7efd('0x4d')]=function(_0x53e3f9,_0x4b8e29){var _0x48e111={'where':{'id':_0x53e3f9['params']['id']}},_0x4d01b9={};_0x4d01b9['model']=_['keys'](db['JscriptyProject'][_0x7efd('0x30')]);_0x48e111[_0x7efd('0x36')]=_[_0x7efd('0x35')](_0x4d01b9[_0x7efd('0x31')],qs[_0x7efd('0x42')](_0x53e3f9[_0x7efd('0x32')][_0x7efd('0x42')]));_0x48e111[_0x7efd('0x36')]=_0x48e111[_0x7efd('0x36')][_0x7efd('0x43')]?_0x48e111['attributes']:_0x4d01b9[_0x7efd('0x31')];if(_0x53e3f9[_0x7efd('0x32')]['includeAll']){_0x48e111['include']=[{'all':!![]}];}_0x48e111=_[_0x7efd('0x3d')]({},_0x48e111,_0x53e3f9[_0x7efd('0x4e')]);return db['JscriptyProject']['find'](_0x48e111)['then'](handleEntityNotFound(_0x4b8e29,null))[_0x7efd('0x26')](function(_0x548aa1){if(_0x548aa1){var _0x4a31c7=_0x548aa1['get']({'plain':!![]});_0x4a31c7=qs[_0x7efd('0x4f')](_0x4a31c7,['id',_0x7efd('0x50'),_0x7efd('0x51')]);_0x53e3f9[_0x7efd('0x47')]=_[_0x7efd('0x4f')](_0x53e3f9[_0x7efd('0x47')],['id',_0x7efd('0x50'),_0x7efd('0x51')]);return db[_0x7efd('0x2f')]['create'](_['merge'](_0x4a31c7,_0x53e3f9['body']),{'include':_0x53e3f9['query'][_0x7efd('0x3e')]?[{'all':!![]}]:undefined})[_0x7efd('0x26')](function(_0x39961c){var _0x54ba4d=_0x53e3f9[_0x7efd('0x48')]['get']({'plain':!![]});if(!_0x54ba4d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x54ba4d[_0x7efd('0x4a')]==='user'){var _0x222b9e=_0x39961c[_0x7efd('0x27')]({'plain':!![]});var _0x5c126f=_0x7efd('0x28');return db['UserProfileSection'][_0x7efd('0x44')]({'where':{'name':_0x5c126f,'userProfileId':_0x54ba4d['userProfileId']},'raw':!![]})[_0x7efd('0x26')](function(_0x241709){if(_0x241709&&_0x241709[_0x7efd('0x4c')]===0x0){return db[_0x7efd('0x29')][_0x7efd('0x46')]({'name':_0x222b9e[_0x7efd('0x2c')],'resourceId':_0x222b9e['id'],'type':_0x241709['name'],'sectionId':_0x241709['id']},{})[_0x7efd('0x26')](function(){return _0x39961c;});}else{return _0x39961c;}})['catch'](function(_0x32e001){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32e001);throw _0x32e001;});}return _0x39961c;});}})[_0x7efd('0x26')](respondWithResult(_0x4b8e29,0xc9))[_0x7efd('0x45')](handleError(_0x4b8e29,null));};exports[_0x7efd('0x24')]=function(_0x162721,_0xc0fb5c){if(_0x162721['body']['id']){delete _0x162721[_0x7efd('0x47')]['id'];}return db['JscriptyProject']['find']({'where':{'id':_0x162721[_0x7efd('0x52')]['id']}})[_0x7efd('0x26')](handleEntityNotFound(_0xc0fb5c,null))[_0x7efd('0x26')](saveUpdates(_0x162721[_0x7efd('0x47')],null))['then'](respondWithResult(_0xc0fb5c,null))[_0x7efd('0x45')](handleError(_0xc0fb5c,null));};exports[_0x7efd('0x25')]=function(_0x260888,_0x16737c){return db[_0x7efd('0x2f')][_0x7efd('0x44')]({'where':{'id':_0x260888[_0x7efd('0x52')]['id']}})[_0x7efd('0x26')](handleEntityNotFound(_0x16737c,null))[_0x7efd('0x26')](removeEntity(_0x16737c,null))[_0x7efd('0x45')](handleError(_0x16737c,null));};exports[_0x7efd('0x53')]=function(_0x802460,_0x1a9232,_0x3fdbbc){var _0x5636dd={'raw':!![],'where':{}};var _0x58a6c2={};var _0x1175b2={'count':0x0,'rows':[]};return db[_0x7efd('0x2f')][_0x7efd('0x54')]({'where':{'id':_0x802460[_0x7efd('0x52')]['id']}})[_0x7efd('0x26')](handleEntityNotFound(_0x1a9232,null))[_0x7efd('0x26')](function(_0x513de5){if(_0x513de5){_0x58a6c2[_0x7efd('0x31')]=_[_0x7efd('0x33')](db[_0x7efd('0x55')]['rawAttributes']);_0x58a6c2[_0x7efd('0x32')]=_['keys'](_0x802460[_0x7efd('0x32')]);_0x58a6c2['filters']=_[_0x7efd('0x35')](_0x58a6c2[_0x7efd('0x31')],_0x58a6c2['query']);_0x5636dd[_0x7efd('0x36')]=_[_0x7efd('0x35')](_0x58a6c2['model'],qs['fields'](_0x802460['query'][_0x7efd('0x42')]));_0x5636dd['attributes']=_0x5636dd[_0x7efd('0x36')][_0x7efd('0x43')]?_0x5636dd['attributes']:_0x58a6c2[_0x7efd('0x31')];if(!_0x802460[_0x7efd('0x32')][_0x7efd('0x37')](_0x7efd('0x56'))){_0x5636dd[_0x7efd('0x1e')]=qs['limit'](_0x802460[_0x7efd('0x32')][_0x7efd('0x1e')]);_0x5636dd[_0x7efd('0x1c')]=qs[_0x7efd('0x1c')](_0x802460['query']['offset']);}_0x5636dd['order']=qs[_0x7efd('0x38')](_0x802460[_0x7efd('0x32')][_0x7efd('0x38')]);_0x5636dd['where']=qs[_0x7efd('0x34')](_[_0x7efd('0x3a')](_0x802460['query'],_0x58a6c2[_0x7efd('0x34')]));_0x5636dd['where']['ProjectId']=_0x513de5['id'];if(_0x802460[_0x7efd('0x32')]['filter']){_0x5636dd['where']=_[_0x7efd('0x3d')](_0x5636dd['where'],{'$or':_[_0x7efd('0x3c')](_0x5636dd[_0x7efd('0x36')],function(_0x1831d6){var _0x32d013={};_0x32d013[_0x1831d6]={'$like':'%'+_0x802460[_0x7efd('0x32')][_0x7efd('0x3b')]+'%'};return _0x32d013;})});}_0x5636dd=_[_0x7efd('0x3d')]({},_0x5636dd,_0x802460[_0x7efd('0x4e')]);return db[_0x7efd('0x55')][_0x7efd('0x1f')]({'where':_0x5636dd[_0x7efd('0x39')]})[_0x7efd('0x26')](function(_0x1281f7){_0x1175b2[_0x7efd('0x1f')]=_0x1281f7;if(_0x802460[_0x7efd('0x32')]['includeAll']){_0x5636dd[_0x7efd('0x3f')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x7efd('0x40')](_0x5636dd);})[_0x7efd('0x26')](function(_0x338df0){_0x1175b2[_0x7efd('0x41')]=_0x338df0;return _0x1175b2;});}})['then'](respondWithFilteredResult(_0x1a9232,_0x5636dd))[_0x7efd('0x45')](handleError(_0x1a9232,null));};exports[_0x7efd('0x57')]=function(_0x332383,_0xd864b,_0x3e7efb){var _0x1a541f={'raw':!![],'where':{}};var _0x5833a2={};var _0x46bf7f={'count':0x0,'rows':[]};return db[_0x7efd('0x2f')][_0x7efd('0x54')]({'where':{'id':_0x332383[_0x7efd('0x52')]['id']}})[_0x7efd('0x26')](handleEntityNotFound(_0xd864b,null))['then'](function(_0x453fef){if(_0x453fef){_0x5833a2[_0x7efd('0x31')]=_[_0x7efd('0x33')](db[_0x7efd('0x58')][_0x7efd('0x30')]);_0x5833a2[_0x7efd('0x32')]=_[_0x7efd('0x33')](_0x332383[_0x7efd('0x32')]);_0x5833a2[_0x7efd('0x34')]=_['intersection'](_0x5833a2[_0x7efd('0x31')],_0x5833a2['query']);_0x1a541f[_0x7efd('0x36')]=_[_0x7efd('0x35')](_0x5833a2['model'],qs[_0x7efd('0x42')](_0x332383['query'][_0x7efd('0x42')]));_0x1a541f['attributes']=_0x1a541f[_0x7efd('0x36')][_0x7efd('0x43')]?_0x1a541f[_0x7efd('0x36')]:_0x5833a2[_0x7efd('0x31')];if(!_0x332383[_0x7efd('0x32')]['hasOwnProperty'](_0x7efd('0x56'))){_0x1a541f[_0x7efd('0x1e')]=qs[_0x7efd('0x1e')](_0x332383[_0x7efd('0x32')][_0x7efd('0x1e')]);_0x1a541f[_0x7efd('0x1c')]=qs[_0x7efd('0x1c')](_0x332383[_0x7efd('0x32')][_0x7efd('0x1c')]);}_0x1a541f[_0x7efd('0x59')]=qs[_0x7efd('0x38')](_0x332383[_0x7efd('0x32')]['sort']);_0x1a541f[_0x7efd('0x39')]=qs[_0x7efd('0x34')](_['pick'](_0x332383['query'],_0x5833a2[_0x7efd('0x34')]));_0x1a541f[_0x7efd('0x39')][_0x7efd('0x5a')]=_0x453fef['id'];if(_0x332383['query'][_0x7efd('0x3b')]){_0x1a541f[_0x7efd('0x39')]=_[_0x7efd('0x3d')](_0x1a541f[_0x7efd('0x39')],{'$or':_[_0x7efd('0x3c')](_0x1a541f[_0x7efd('0x36')],function(_0x424d8d){var _0x5d5028={};_0x5d5028[_0x424d8d]={'$like':'%'+_0x332383[_0x7efd('0x32')][_0x7efd('0x3b')]+'%'};return _0x5d5028;})});}_0x1a541f=_[_0x7efd('0x3d')]({},_0x1a541f,_0x332383[_0x7efd('0x4e')]);return db['JscriptyAnswerReport'][_0x7efd('0x1f')]({'where':_0x1a541f['where']})[_0x7efd('0x26')](function(_0xbecabd){_0x46bf7f[_0x7efd('0x1f')]=_0xbecabd;if(_0x332383['query'][_0x7efd('0x3e')]){_0x1a541f[_0x7efd('0x3f')]=[{'all':!![]}];}return db[_0x7efd('0x58')][_0x7efd('0x40')](_0x1a541f);})[_0x7efd('0x26')](function(_0x4c31aa){_0x46bf7f['rows']=_0x4c31aa;return _0x46bf7f;});}})[_0x7efd('0x26')](respondWithFilteredResult(_0xd864b,_0x1a541f))[_0x7efd('0x45')](handleError(_0xd864b,null));};function char(_0x4b7a54){return _0x7efd('0x5b')===typeof _0x4b7a54?String['fromCharCode'][_0x7efd('0x22')](null,arguments):_0x4b7a54;}function needsEncapsulation(_0x1601a6){return!!_0x1601a6&&(_0x1601a6[_0x7efd('0x5c')]()[_0x7efd('0x5d')](char(0xd))>=0x0||_0x1601a6[_0x7efd('0x5c')]()[_0x7efd('0x5d')](char(0xa))>=0x0||_0x1601a6['toString']()[_0x7efd('0x5d')](char(0x2c))>=0x0||_0x1601a6[_0x7efd('0x5c')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x5ae229){var _0x23f820=char(0x22),_0x53b45a='\x5c'+char(0x22),_0x10667e=_0x5ae229[_0x7efd('0x5c')]()[_0x7efd('0x5e')](new RegExp(_0x23f820,'g'),_0x53b45a);return _0x23f820+_0x10667e+_0x23f820;}exports[_0x7efd('0x5f')]=function(_0x1397f5,_0x3361cd,_0x4c0809){var _0x50d98b,_0x20ec46;var _0x27fc3b={'where':{'ProjectId':_0x1397f5[_0x7efd('0x52')]['id']}};if(_0x1397f5[_0x7efd('0x32')]['startTime']){_0x27fc3b[_0x7efd('0x39')][_0x7efd('0x60')]=JSON[_0x7efd('0x61')](_0x1397f5[_0x7efd('0x32')]['startTime']);}return db[_0x7efd('0x55')][_0x7efd('0x40')](_0x27fc3b)[_0x7efd('0x26')](handleEntityNotFound(_0x3361cd,null))[_0x7efd('0x26')](function(_0x125a62){if(_0x125a62){_0x50d98b=_0x125a62;return db['JscriptyQuestionReport']['findAll']({'where':{'SessionId':{'$in':_[_0x7efd('0x3c')](_0x50d98b,'id')},'ProjectId':_0x1397f5[_0x7efd('0x52')]['id']},'order':_0x7efd('0x62')});}})[_0x7efd('0x26')](handleEntityNotFound(_0x3361cd,null))[_0x7efd('0x26')](function(_0x9cd2a){if(_0x9cd2a){_0x20ec46=_0x9cd2a;var _0x361016={};for(var _0x1c12b8=0x0,_0x5c384e=_0x20ec46[_0x7efd('0x43')];_0x1c12b8<_0x5c384e;_0x1c12b8++){if(!_0x361016[_0x7efd('0x37')](_0x20ec46[_0x1c12b8][_0x7efd('0x63')])){_0x361016[_0x20ec46[_0x1c12b8][_0x7efd('0x63')]]=needsEncapsulation(_0x20ec46[_0x1c12b8][_0x7efd('0x64')])?encapsulate(_0x20ec46[_0x1c12b8][_0x7efd('0x64')]):_0x20ec46[_0x1c12b8]['question'];}}var _0x4a7c7d=[],_0x21d200={};for(var _0x2b09b0=0x0,_0x263eb5=_0x50d98b[_0x7efd('0x43')];_0x2b09b0<_0x263eb5;_0x2b09b0++){_0x21d200={'ProjectId':_0x1397f5[_0x7efd('0x52')]['id'],'SessionId':_0x50d98b[_0x2b09b0]['id'],'StartTime':moment(_0x50d98b[_0x2b09b0][_0x7efd('0x60')])['format'](_0x7efd('0x65'))};for(var _0x1be505=0x0,_0x4308d5=_0x20ec46['length'];_0x1be505<_0x4308d5;_0x1be505++){if(_0x20ec46[_0x1be505][_0x7efd('0x66')]==_0x50d98b[_0x2b09b0]['id']&&_0x361016[_0x7efd('0x37')](_0x20ec46[_0x1be505][_0x7efd('0x63')])){_0x21d200[_0x361016[_0x20ec46[_0x1be505][_0x7efd('0x63')]]]=_0x20ec46[_0x1be505]['answer'];}}for(var _0x5ed761 in _0x361016){if(!_0x21d200[_0x7efd('0x37')](_0x361016[_0x5ed761])){_0x21d200[_0x361016[_0x5ed761]]=null;}}_0x4a7c7d[_0x7efd('0x67')](_0x21d200);}return _0x4a7c7d;}})[_0x7efd('0x26')](function(_0x3beb7a){if(!_[_0x7efd('0x68')](_0x3beb7a)){var _0x5ab0a5=toCsv(_0x3beb7a);var _0x1c1120=Date['now']();fs['writeFileSync'](util[_0x7efd('0x69')](_0x7efd('0x6a'),_0x1397f5[_0x7efd('0x52')]['id'],_0x1c1120),_0x5ab0a5);_0x3361cd[_0x7efd('0x6b')](_0x7efd('0x6c'),_0x7efd('0x6d')+util[_0x7efd('0x69')]('Jscripty_Project_%d_Summary_%s.csv',_0x1397f5[_0x7efd('0x52')]['id'],_0x1c1120));_0x3361cd[_0x7efd('0x6b')]('Content-type','text/csv');return _0x3361cd[_0x7efd('0x6e')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x1397f5[_0x7efd('0x52')]['id'],_0x1c1120));}else{return _0x3361cd[_0x7efd('0x19')](0xcc);}})[_0x7efd('0x45')](handleError(_0x3361cd,null));}; \ No newline at end of file +var _0xc87b=['JscriptyProject','findAll','catch','params','rawAttributes','includeAll','include','options','find','create','body','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','getSessions','findOne','JscriptySessionReport','order','ProjectId','rows','getAnswers','JscriptyAnswerReport','number','fromCharCode','indexOf','toString','replace','getSummary','startTime','JscriptyQuestionReport','questionId','question','starttime','YYYY-MM-DD\x20HH:mm:ss','SessionId','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','attachment;\x20filename=','format','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','get','Projects','UserProfileResource','error','stack','name','send','index','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xc87b,0xb2));var _0xbc87=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xc87b[_0x4fc9e6];return _0x551d28;};'use strict';var emlformat=require(_0xbc87('0x0'));var rimraf=require(_0xbc87('0x1'));var zipdir=require(_0xbc87('0x2'));var jsonpatch=require(_0xbc87('0x3'));var rp=require('request-promise');var moment=require(_0xbc87('0x4'));var BPromise=require(_0xbc87('0x5'));var Mustache=require(_0xbc87('0x6'));var util=require('util');var path=require(_0xbc87('0x7'));var sox=require(_0xbc87('0x8'));var csv=require(_0xbc87('0x9'));var ejs=require(_0xbc87('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbc87('0xb'));var squel=require(_0xbc87('0xc'));var crypto=require(_0xbc87('0xd'));var jsforce=require(_0xbc87('0xe'));var deskjs=require(_0xbc87('0xf'));var toCsv=require(_0xbc87('0x9'));var querystring=require(_0xbc87('0x10'));var Papa=require(_0xbc87('0x11'));var Redis=require(_0xbc87('0x12'));var authService=require(_0xbc87('0x13'));var qs=require(_0xbc87('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbc87('0x15'));var logger=require('../../config/logger')(_0xbc87('0x16'));var utils=require(_0xbc87('0x17'));var config=require(_0xbc87('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xbc87('0x19'))['db'];function respondWithStatusCode(_0x3b1906,_0x51a0f0){_0x51a0f0=_0x51a0f0||0xcc;return function(_0x9d0643){if(_0x9d0643){return _0x3b1906[_0xbc87('0x1a')](_0x51a0f0);}return _0x3b1906['status'](_0x51a0f0)[_0xbc87('0x1b')]();};}function respondWithResult(_0x1a8760,_0x4feea6){_0x4feea6=_0x4feea6||0xc8;return function(_0x2b4778){if(_0x2b4778){return _0x1a8760[_0xbc87('0x1c')](_0x4feea6)[_0xbc87('0x1d')](_0x2b4778);}};}function respondWithFilteredResult(_0x472dab,_0x3afc9f){return function(_0x2c3488){if(_0x2c3488){var _0x56c22c=typeof _0x3afc9f['offset']===_0xbc87('0x1e')&&typeof _0x3afc9f[_0xbc87('0x1f')]===_0xbc87('0x1e');var _0x5e6700=_0x2c3488[_0xbc87('0x20')];var _0x461031=_0x56c22c?0x0:_0x3afc9f[_0xbc87('0x21')];var _0x5beeb1=_0x56c22c?_0x2c3488[_0xbc87('0x20')]:_0x3afc9f[_0xbc87('0x21')]+_0x3afc9f[_0xbc87('0x1f')];var _0x46068d;if(_0x5beeb1>=_0x5e6700){_0x5beeb1=_0x5e6700;_0x46068d=0xc8;}else{_0x46068d=0xce;}_0x472dab[_0xbc87('0x1c')](_0x46068d);return _0x472dab[_0xbc87('0x22')](_0xbc87('0x23'),_0x461031+'-'+_0x5beeb1+'/'+_0x5e6700)[_0xbc87('0x1d')](_0x2c3488);}return null;};}function patchUpdates(_0x51d0a4){return function(_0x52e885){try{jsonpatch[_0xbc87('0x24')](_0x52e885,_0x51d0a4,!![]);}catch(_0x22cbd9){return BPromise[_0xbc87('0x25')](_0x22cbd9);}return _0x52e885[_0xbc87('0x26')]();};}function saveUpdates(_0x320102,_0x1bc01e){return function(_0x3edfd5){if(_0x3edfd5){return _0x3edfd5[_0xbc87('0x27')](_0x320102)['then'](function(_0x54036c){return _0x54036c;});}return null;};}function removeEntity(_0x41d595,_0x5860e4){return function(_0x1c6ef8){if(_0x1c6ef8){return _0x1c6ef8[_0xbc87('0x28')]()[_0xbc87('0x29')](function(){var _0x5aee55=_0x1c6ef8[_0xbc87('0x2a')]({'plain':!![]});var _0x3bf85d=_0xbc87('0x2b');return db[_0xbc87('0x2c')][_0xbc87('0x28')]({'where':{'type':_0x3bf85d,'resourceId':_0x5aee55['id']}})['then'](function(){return _0x1c6ef8;});})[_0xbc87('0x29')](function(){_0x41d595['status'](0xcc)[_0xbc87('0x1b')]();});}};}function handleEntityNotFound(_0x3c36f7,_0x59dc4b){return function(_0x96be38){if(!_0x96be38){_0x3c36f7[_0xbc87('0x1a')](0x194);}return _0x96be38;};}function handleError(_0x474215,_0x3155a1){_0x3155a1=_0x3155a1||0x1f4;return function(_0x1b5fd6){logger[_0xbc87('0x2d')](_0x1b5fd6[_0xbc87('0x2e')]);if(_0x1b5fd6['name']){delete _0x1b5fd6[_0xbc87('0x2f')];}_0x474215[_0xbc87('0x1c')](_0x3155a1)[_0xbc87('0x30')](_0x1b5fd6);};}exports[_0xbc87('0x31')]=function(_0x480d2e,_0x1fe23a){var _0x404dfb={},_0xfb3168={},_0x400769={'count':0x0,'rows':[]};var _0x312ebd=_['map'](db['JscriptyProject']['rawAttributes'],function(_0x5c6a0d){return{'name':_0x5c6a0d['fieldName'],'type':_0x5c6a0d['type'][_0xbc87('0x32')]};});_0xfb3168[_0xbc87('0x33')]=_[_0xbc87('0x34')](_0x312ebd,_0xbc87('0x2f'));_0xfb3168[_0xbc87('0x35')]=_[_0xbc87('0x36')](_0x480d2e['query']);_0xfb3168[_0xbc87('0x37')]=_[_0xbc87('0x38')](_0xfb3168['model'],_0xfb3168[_0xbc87('0x35')]);_0x404dfb[_0xbc87('0x39')]=_[_0xbc87('0x38')](_0xfb3168[_0xbc87('0x33')],qs[_0xbc87('0x3a')](_0x480d2e['query'][_0xbc87('0x3a')]));_0x404dfb[_0xbc87('0x39')]=_0x404dfb[_0xbc87('0x39')][_0xbc87('0x3b')]?_0x404dfb[_0xbc87('0x39')]:_0xfb3168['model'];if(!_0x480d2e[_0xbc87('0x35')][_0xbc87('0x3c')](_0xbc87('0x3d'))){_0x404dfb[_0xbc87('0x1f')]=qs[_0xbc87('0x1f')](_0x480d2e[_0xbc87('0x35')][_0xbc87('0x1f')]);_0x404dfb[_0xbc87('0x21')]=qs[_0xbc87('0x21')](_0x480d2e['query'][_0xbc87('0x21')]);}_0x404dfb['order']=qs[_0xbc87('0x3e')](_0x480d2e[_0xbc87('0x35')][_0xbc87('0x3e')]);_0x404dfb[_0xbc87('0x3f')]=qs[_0xbc87('0x37')](_[_0xbc87('0x40')](_0x480d2e[_0xbc87('0x35')],_0xfb3168[_0xbc87('0x37')]),_0x312ebd);if(_0x480d2e[_0xbc87('0x35')][_0xbc87('0x41')]){_0x404dfb[_0xbc87('0x3f')]=_[_0xbc87('0x42')](_0x404dfb['where'],{'$or':_[_0xbc87('0x34')](_0x312ebd,function(_0x455537){if(_0x455537[_0xbc87('0x43')]!=='VIRTUAL'){var _0xdfec35={};_0xdfec35[_0x455537[_0xbc87('0x2f')]]={'$like':'%'+_0x480d2e[_0xbc87('0x35')][_0xbc87('0x41')]+'%'};return _0xdfec35;}})});}_0x404dfb=_[_0xbc87('0x42')]({},_0x404dfb,_0x480d2e['options']);var _0xfd7e4d={'where':_0x404dfb[_0xbc87('0x3f')]};return db[_0xbc87('0x44')][_0xbc87('0x20')](_0xfd7e4d)[_0xbc87('0x29')](function(_0x427a3b){_0x400769[_0xbc87('0x20')]=_0x427a3b;if(_0x480d2e['query']['includeAll']){_0x404dfb['include']=[{'all':!![]}];}return db[_0xbc87('0x44')][_0xbc87('0x45')](_0x404dfb);})['then'](function(_0x1d73b0){_0x400769['rows']=_0x1d73b0;return _0x400769;})[_0xbc87('0x29')](respondWithFilteredResult(_0x1fe23a,_0x404dfb))[_0xbc87('0x46')](handleError(_0x1fe23a,null));};exports['show']=function(_0x45a0cb,_0x2121b1){var _0x3ac1f5={'raw':![],'where':{'id':_0x45a0cb[_0xbc87('0x47')]['id']}},_0xe1870a={};_0xe1870a[_0xbc87('0x33')]=_['keys'](db[_0xbc87('0x44')][_0xbc87('0x48')]);_0xe1870a[_0xbc87('0x35')]=_[_0xbc87('0x36')](_0x45a0cb[_0xbc87('0x35')]);_0xe1870a['filters']=_[_0xbc87('0x38')](_0xe1870a[_0xbc87('0x33')],_0xe1870a['query']);_0x3ac1f5['attributes']=_[_0xbc87('0x38')](_0xe1870a['model'],qs[_0xbc87('0x3a')](_0x45a0cb[_0xbc87('0x35')][_0xbc87('0x3a')]));_0x3ac1f5[_0xbc87('0x39')]=_0x3ac1f5[_0xbc87('0x39')]['length']?_0x3ac1f5[_0xbc87('0x39')]:_0xe1870a['model'];if(_0x45a0cb[_0xbc87('0x35')][_0xbc87('0x49')]){_0x3ac1f5[_0xbc87('0x4a')]=[{'all':!![]}];}_0x3ac1f5=_[_0xbc87('0x42')]({},_0x3ac1f5,_0x45a0cb[_0xbc87('0x4b')]);return db[_0xbc87('0x44')][_0xbc87('0x4c')](_0x3ac1f5)[_0xbc87('0x29')](handleEntityNotFound(_0x2121b1,null))[_0xbc87('0x29')](respondWithResult(_0x2121b1,null))[_0xbc87('0x46')](handleError(_0x2121b1,null));};exports[_0xbc87('0x4d')]=function(_0x2f66f1,_0x225fbe){return db[_0xbc87('0x44')][_0xbc87('0x4d')](_0x2f66f1[_0xbc87('0x4e')],{})[_0xbc87('0x29')](function(_0x530b9c){var _0x6497c1=_0x2f66f1['user'][_0xbc87('0x2a')]({'plain':!![]});if(!_0x6497c1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x6497c1[_0xbc87('0x4f')]===_0xbc87('0x50')){var _0x578d96=_0x530b9c[_0xbc87('0x2a')]({'plain':!![]});var _0x38ca58=_0xbc87('0x2b');return db[_0xbc87('0x51')][_0xbc87('0x4c')]({'where':{'name':_0x38ca58,'userProfileId':_0x6497c1['userProfileId']},'raw':!![]})[_0xbc87('0x29')](function(_0x40cdc1){if(_0x40cdc1&&_0x40cdc1[_0xbc87('0x52')]===0x0){return db[_0xbc87('0x2c')][_0xbc87('0x4d')]({'name':_0x578d96['name'],'resourceId':_0x578d96['id'],'type':_0x40cdc1[_0xbc87('0x2f')],'sectionId':_0x40cdc1['id']},{})['then'](function(){return _0x530b9c;});}else{return _0x530b9c;}})[_0xbc87('0x46')](function(_0x5f2a82){logger[_0xbc87('0x2d')](_0xbc87('0x53'),_0x5f2a82);throw _0x5f2a82;});}return _0x530b9c;})['then'](respondWithResult(_0x225fbe,0xc9))[_0xbc87('0x46')](handleError(_0x225fbe,null));};exports[_0xbc87('0x54')]=function(_0x112cc7,_0x12109e){var _0x12c4d1={'where':{'id':_0x112cc7['params']['id']}},_0x48294c={};_0x48294c[_0xbc87('0x33')]=_['keys'](db[_0xbc87('0x44')][_0xbc87('0x48')]);_0x12c4d1['attributes']=_[_0xbc87('0x38')](_0x48294c['model'],qs['fields'](_0x112cc7[_0xbc87('0x35')][_0xbc87('0x3a')]));_0x12c4d1[_0xbc87('0x39')]=_0x12c4d1[_0xbc87('0x39')][_0xbc87('0x3b')]?_0x12c4d1[_0xbc87('0x39')]:_0x48294c['model'];if(_0x112cc7['query'][_0xbc87('0x49')]){_0x12c4d1[_0xbc87('0x4a')]=[{'all':!![]}];}_0x12c4d1=_[_0xbc87('0x42')]({},_0x12c4d1,_0x112cc7[_0xbc87('0x4b')]);return db[_0xbc87('0x44')][_0xbc87('0x4c')](_0x12c4d1)[_0xbc87('0x29')](handleEntityNotFound(_0x12109e,null))[_0xbc87('0x29')](function(_0x397b93){if(_0x397b93){var _0x38e4c7=_0x397b93[_0xbc87('0x2a')]({'plain':!![]});_0x38e4c7=qs[_0xbc87('0x55')](_0x38e4c7,['id',_0xbc87('0x56'),_0xbc87('0x57')]);_0x112cc7[_0xbc87('0x4e')]=_[_0xbc87('0x55')](_0x112cc7[_0xbc87('0x4e')],['id',_0xbc87('0x56'),_0xbc87('0x57')]);return db[_0xbc87('0x44')][_0xbc87('0x4d')](_[_0xbc87('0x42')](_0x38e4c7,_0x112cc7[_0xbc87('0x4e')]),{'include':_0x112cc7[_0xbc87('0x35')][_0xbc87('0x49')]?[{'all':!![]}]:undefined})[_0xbc87('0x29')](function(_0x14b27c){var _0x289ad4=_0x112cc7[_0xbc87('0x50')][_0xbc87('0x2a')]({'plain':!![]});if(!_0x289ad4)throw new Error(_0xbc87('0x58'));if(_0x289ad4['role']==='user'){var _0x566414=_0x14b27c[_0xbc87('0x2a')]({'plain':!![]});var _0x257535=_0xbc87('0x2b');return db[_0xbc87('0x51')][_0xbc87('0x4c')]({'where':{'name':_0x257535,'userProfileId':_0x289ad4['userProfileId']},'raw':!![]})[_0xbc87('0x29')](function(_0x70600c){if(_0x70600c&&_0x70600c[_0xbc87('0x52')]===0x0){return db[_0xbc87('0x2c')][_0xbc87('0x4d')]({'name':_0x566414[_0xbc87('0x2f')],'resourceId':_0x566414['id'],'type':_0x70600c[_0xbc87('0x2f')],'sectionId':_0x70600c['id']},{})[_0xbc87('0x29')](function(){return _0x14b27c;});}else{return _0x14b27c;}})[_0xbc87('0x46')](function(_0x57e426){logger[_0xbc87('0x2d')](_0xbc87('0x53'),_0x57e426);throw _0x57e426;});}return _0x14b27c;});}})[_0xbc87('0x29')](respondWithResult(_0x12109e,0xc9))[_0xbc87('0x46')](handleError(_0x12109e,null));};exports[_0xbc87('0x27')]=function(_0xd8b455,_0x4c14cd){if(_0xd8b455['body']['id']){delete _0xd8b455['body']['id'];}return db[_0xbc87('0x44')]['find']({'where':{'id':_0xd8b455[_0xbc87('0x47')]['id']}})[_0xbc87('0x29')](handleEntityNotFound(_0x4c14cd,null))['then'](saveUpdates(_0xd8b455[_0xbc87('0x4e')],null))[_0xbc87('0x29')](respondWithResult(_0x4c14cd,null))[_0xbc87('0x46')](handleError(_0x4c14cd,null));};exports['destroy']=function(_0x5e4885,_0x332bcb){return db['JscriptyProject'][_0xbc87('0x4c')]({'where':{'id':_0x5e4885[_0xbc87('0x47')]['id']}})[_0xbc87('0x29')](handleEntityNotFound(_0x332bcb,null))[_0xbc87('0x29')](removeEntity(_0x332bcb,null))[_0xbc87('0x46')](handleError(_0x332bcb,null));};exports[_0xbc87('0x59')]=function(_0x2745c4,_0x3f666a,_0x421d1f){var _0x1659d7={'raw':!![],'where':{}};var _0x62bb40={};var _0x26e0f5={'count':0x0,'rows':[]};return db[_0xbc87('0x44')][_0xbc87('0x5a')]({'where':{'id':_0x2745c4[_0xbc87('0x47')]['id']}})[_0xbc87('0x29')](handleEntityNotFound(_0x3f666a,null))[_0xbc87('0x29')](function(_0x295b5c){if(_0x295b5c){_0x62bb40[_0xbc87('0x33')]=_[_0xbc87('0x36')](db[_0xbc87('0x5b')][_0xbc87('0x48')]);_0x62bb40[_0xbc87('0x35')]=_[_0xbc87('0x36')](_0x2745c4['query']);_0x62bb40[_0xbc87('0x37')]=_[_0xbc87('0x38')](_0x62bb40[_0xbc87('0x33')],_0x62bb40['query']);_0x1659d7[_0xbc87('0x39')]=_[_0xbc87('0x38')](_0x62bb40[_0xbc87('0x33')],qs[_0xbc87('0x3a')](_0x2745c4[_0xbc87('0x35')][_0xbc87('0x3a')]));_0x1659d7[_0xbc87('0x39')]=_0x1659d7[_0xbc87('0x39')][_0xbc87('0x3b')]?_0x1659d7[_0xbc87('0x39')]:_0x62bb40[_0xbc87('0x33')];if(!_0x2745c4[_0xbc87('0x35')][_0xbc87('0x3c')]('nolimit')){_0x1659d7[_0xbc87('0x1f')]=qs['limit'](_0x2745c4['query'][_0xbc87('0x1f')]);_0x1659d7[_0xbc87('0x21')]=qs[_0xbc87('0x21')](_0x2745c4[_0xbc87('0x35')][_0xbc87('0x21')]);}_0x1659d7[_0xbc87('0x5c')]=qs['sort'](_0x2745c4[_0xbc87('0x35')][_0xbc87('0x3e')]);_0x1659d7[_0xbc87('0x3f')]=qs[_0xbc87('0x37')](_[_0xbc87('0x40')](_0x2745c4[_0xbc87('0x35')],_0x62bb40[_0xbc87('0x37')]));_0x1659d7[_0xbc87('0x3f')][_0xbc87('0x5d')]=_0x295b5c['id'];if(_0x2745c4['query'][_0xbc87('0x41')]){_0x1659d7[_0xbc87('0x3f')]=_[_0xbc87('0x42')](_0x1659d7[_0xbc87('0x3f')],{'$or':_[_0xbc87('0x34')](_0x1659d7[_0xbc87('0x39')],function(_0x26891a){var _0x10d04a={};_0x10d04a[_0x26891a]={'$like':'%'+_0x2745c4[_0xbc87('0x35')][_0xbc87('0x41')]+'%'};return _0x10d04a;})});}_0x1659d7=_['merge']({},_0x1659d7,_0x2745c4[_0xbc87('0x4b')]);return db[_0xbc87('0x5b')][_0xbc87('0x20')]({'where':_0x1659d7[_0xbc87('0x3f')]})['then'](function(_0x3ebd6b){_0x26e0f5['count']=_0x3ebd6b;if(_0x2745c4[_0xbc87('0x35')][_0xbc87('0x49')]){_0x1659d7['include']=[{'all':!![]}];}return db[_0xbc87('0x5b')]['findAll'](_0x1659d7);})['then'](function(_0x4c912c){_0x26e0f5[_0xbc87('0x5e')]=_0x4c912c;return _0x26e0f5;});}})[_0xbc87('0x29')](respondWithFilteredResult(_0x3f666a,_0x1659d7))['catch'](handleError(_0x3f666a,null));};exports[_0xbc87('0x5f')]=function(_0xa2b9a4,_0x509623,_0x2a8171){var _0x40d9a8={'raw':!![],'where':{}};var _0xfdd155={};var _0x4a979e={'count':0x0,'rows':[]};return db[_0xbc87('0x44')][_0xbc87('0x5a')]({'where':{'id':_0xa2b9a4[_0xbc87('0x47')]['id']}})[_0xbc87('0x29')](handleEntityNotFound(_0x509623,null))['then'](function(_0x1d0d57){if(_0x1d0d57){_0xfdd155['model']=_[_0xbc87('0x36')](db[_0xbc87('0x60')][_0xbc87('0x48')]);_0xfdd155['query']=_[_0xbc87('0x36')](_0xa2b9a4['query']);_0xfdd155[_0xbc87('0x37')]=_[_0xbc87('0x38')](_0xfdd155[_0xbc87('0x33')],_0xfdd155[_0xbc87('0x35')]);_0x40d9a8[_0xbc87('0x39')]=_[_0xbc87('0x38')](_0xfdd155[_0xbc87('0x33')],qs['fields'](_0xa2b9a4['query'][_0xbc87('0x3a')]));_0x40d9a8[_0xbc87('0x39')]=_0x40d9a8[_0xbc87('0x39')][_0xbc87('0x3b')]?_0x40d9a8[_0xbc87('0x39')]:_0xfdd155[_0xbc87('0x33')];if(!_0xa2b9a4['query'][_0xbc87('0x3c')]('nolimit')){_0x40d9a8[_0xbc87('0x1f')]=qs[_0xbc87('0x1f')](_0xa2b9a4[_0xbc87('0x35')][_0xbc87('0x1f')]);_0x40d9a8[_0xbc87('0x21')]=qs[_0xbc87('0x21')](_0xa2b9a4[_0xbc87('0x35')]['offset']);}_0x40d9a8[_0xbc87('0x5c')]=qs['sort'](_0xa2b9a4[_0xbc87('0x35')][_0xbc87('0x3e')]);_0x40d9a8['where']=qs['filters'](_[_0xbc87('0x40')](_0xa2b9a4['query'],_0xfdd155[_0xbc87('0x37')]));_0x40d9a8['where']['ProjectId']=_0x1d0d57['id'];if(_0xa2b9a4[_0xbc87('0x35')][_0xbc87('0x41')]){_0x40d9a8[_0xbc87('0x3f')]=_[_0xbc87('0x42')](_0x40d9a8[_0xbc87('0x3f')],{'$or':_[_0xbc87('0x34')](_0x40d9a8[_0xbc87('0x39')],function(_0x8bce11){var _0xe8096d={};_0xe8096d[_0x8bce11]={'$like':'%'+_0xa2b9a4[_0xbc87('0x35')][_0xbc87('0x41')]+'%'};return _0xe8096d;})});}_0x40d9a8=_[_0xbc87('0x42')]({},_0x40d9a8,_0xa2b9a4[_0xbc87('0x4b')]);return db[_0xbc87('0x60')][_0xbc87('0x20')]({'where':_0x40d9a8['where']})['then'](function(_0x2c828f){_0x4a979e[_0xbc87('0x20')]=_0x2c828f;if(_0xa2b9a4[_0xbc87('0x35')][_0xbc87('0x49')]){_0x40d9a8['include']=[{'all':!![]}];}return db[_0xbc87('0x60')][_0xbc87('0x45')](_0x40d9a8);})[_0xbc87('0x29')](function(_0xb35e01){_0x4a979e[_0xbc87('0x5e')]=_0xb35e01;return _0x4a979e;});}})[_0xbc87('0x29')](respondWithFilteredResult(_0x509623,_0x40d9a8))['catch'](handleError(_0x509623,null));};function char(_0x37597f){return _0xbc87('0x61')===typeof _0x37597f?String[_0xbc87('0x62')]['apply'](null,arguments):_0x37597f;}function needsEncapsulation(_0x4e002e){return!!_0x4e002e&&(_0x4e002e['toString']()[_0xbc87('0x63')](char(0xd))>=0x0||_0x4e002e[_0xbc87('0x64')]()[_0xbc87('0x63')](char(0xa))>=0x0||_0x4e002e[_0xbc87('0x64')]()[_0xbc87('0x63')](char(0x2c))>=0x0||_0x4e002e[_0xbc87('0x64')]()[_0xbc87('0x63')](char(0x22))>=0x0);}function encapsulate(_0x15faf1){var _0x17043d=char(0x22),_0x30ae73='\x5c'+char(0x22),_0x4fd064=_0x15faf1[_0xbc87('0x64')]()[_0xbc87('0x65')](new RegExp(_0x17043d,'g'),_0x30ae73);return _0x17043d+_0x4fd064+_0x17043d;}exports[_0xbc87('0x66')]=function(_0x42f8c1,_0x48365f,_0x1313ff){var _0x40e4bc,_0x9c13dd;var _0x5e7a07={'where':{'ProjectId':_0x42f8c1[_0xbc87('0x47')]['id']}};if(_0x42f8c1[_0xbc87('0x35')]['startTime']){_0x5e7a07['where']['starttime']=JSON['parse'](_0x42f8c1[_0xbc87('0x35')][_0xbc87('0x67')]);}return db[_0xbc87('0x5b')][_0xbc87('0x45')](_0x5e7a07)['then'](handleEntityNotFound(_0x48365f,null))[_0xbc87('0x29')](function(_0x293421){if(_0x293421){_0x40e4bc=_0x293421;return db[_0xbc87('0x68')]['findAll']({'where':{'SessionId':{'$in':_[_0xbc87('0x34')](_0x40e4bc,'id')},'ProjectId':_0x42f8c1['params']['id']},'order':'-createdAt'});}})[_0xbc87('0x29')](handleEntityNotFound(_0x48365f,null))[_0xbc87('0x29')](function(_0x2517a4){if(_0x2517a4){_0x9c13dd=_0x2517a4;var _0x430eb4={};for(var _0x21dbb6=0x0,_0x424fbe=_0x9c13dd[_0xbc87('0x3b')];_0x21dbb6<_0x424fbe;_0x21dbb6++){if(!_0x430eb4[_0xbc87('0x3c')](_0x9c13dd[_0x21dbb6][_0xbc87('0x69')])){_0x430eb4[_0x9c13dd[_0x21dbb6][_0xbc87('0x69')]]=needsEncapsulation(_0x9c13dd[_0x21dbb6][_0xbc87('0x6a')])?encapsulate(_0x9c13dd[_0x21dbb6][_0xbc87('0x6a')]):_0x9c13dd[_0x21dbb6][_0xbc87('0x6a')];}}var _0x34fa7f=[],_0x275bb6={};for(var _0x3330f0=0x0,_0x106728=_0x40e4bc[_0xbc87('0x3b')];_0x3330f0<_0x106728;_0x3330f0++){_0x275bb6={'ProjectId':_0x42f8c1['params']['id'],'SessionId':_0x40e4bc[_0x3330f0]['id'],'StartTime':moment(_0x40e4bc[_0x3330f0][_0xbc87('0x6b')])['format'](_0xbc87('0x6c'))};for(var _0x4d6872=0x0,_0x496949=_0x9c13dd['length'];_0x4d6872<_0x496949;_0x4d6872++){if(_0x9c13dd[_0x4d6872][_0xbc87('0x6d')]==_0x40e4bc[_0x3330f0]['id']&&_0x430eb4[_0xbc87('0x3c')](_0x9c13dd[_0x4d6872][_0xbc87('0x69')])){_0x275bb6[_0x430eb4[_0x9c13dd[_0x4d6872][_0xbc87('0x69')]]]=_0x9c13dd[_0x4d6872]['answer'];}}for(var _0x3060e0 in _0x430eb4){if(!_0x275bb6[_0xbc87('0x3c')](_0x430eb4[_0x3060e0])){_0x275bb6[_0x430eb4[_0x3060e0]]=null;}}_0x34fa7f[_0xbc87('0x6e')](_0x275bb6);}return _0x34fa7f;}})['then'](function(_0x1ca4dc){if(!_[_0xbc87('0x6f')](_0x1ca4dc)){var _0x39feed=toCsv(_0x1ca4dc);var _0x347d85=Date[_0xbc87('0x70')]();fs[_0xbc87('0x71')](util['format'](_0xbc87('0x72'),_0x42f8c1[_0xbc87('0x47')]['id'],_0x347d85),_0x39feed);_0x48365f['setHeader'](_0xbc87('0x73'),_0xbc87('0x74')+util[_0xbc87('0x75')](_0xbc87('0x76'),_0x42f8c1[_0xbc87('0x47')]['id'],_0x347d85));_0x48365f[_0xbc87('0x77')](_0xbc87('0x78'),_0xbc87('0x79'));return _0x48365f[_0xbc87('0x7a')](util[_0xbc87('0x75')](_0xbc87('0x72'),_0x42f8c1['params']['id'],_0x347d85));}else{return _0x48365f[_0xbc87('0x1a')](0xcc);}})[_0xbc87('0x46')](handleError(_0x48365f,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 3c27bb4..068619e 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 _0x5292=['bluebird','request-promise','path','rimraf','./jscriptyProject.attributes','define','JscriptyProject','lodash','util','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5292,0xf7));var _0x2529=function(_0x2c4bc3,_0x34f08b){_0x2c4bc3=_0x2c4bc3-0x0;var _0x31ca59=_0x5292[_0x2c4bc3];return _0x31ca59;};'use strict';var _=require(_0x2529('0x0'));var util=require(_0x2529('0x1'));var logger=require('../../config/logger')(_0x2529('0x2'));var moment=require('moment');var BPromise=require(_0x2529('0x3'));var rp=require(_0x2529('0x4'));var fs=require('fs');var path=require(_0x2529('0x5'));var rimraf=require(_0x2529('0x6'));var config=require('../../config/environment');var attributes=require(_0x2529('0x7'));module['exports']=function(_0x4c9b4c,_0x4e7a9e){return _0x4c9b4c[_0x2529('0x8')](_0x2529('0x9'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe64a=['moment','bluebird','request-promise','path','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0xe64a,0x1e0));var _0xae64=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe64a[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xae64('0x0'));var util=require(_0xae64('0x1'));var logger=require(_0xae64('0x2'))(_0xae64('0x3'));var moment=require(_0xae64('0x4'));var BPromise=require(_0xae64('0x5'));var rp=require(_0xae64('0x6'));var fs=require('fs');var path=require(_0xae64('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./jscriptyProject.attributes');module['exports']=function(_0x2b1046,_0x896007){return _0x2b1046[_0xae64('0x8')](_0xae64('0x9'),attributes,{'tableName':_0xae64('0xa'),'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 b4433c4..38dd2d9 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 _0xac4a=['JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xac4a,0x13f));var _0xaac4=function(_0x113a59,_0x5d635e){_0x113a59=_0x113a59-0x0;var _0x1204ba=_0xac4a[_0x113a59];return _0x1204ba;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file +var _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x47b7c9,_0x3848b2){var _0x435aaf=function(_0x3befc4){while(--_0x3befc4){_0x47b7c9['push'](_0x47b7c9['shift']());}};_0x435aaf(++_0x3848b2);}(_0xaa88,0x137));var _0x8aa8=function(_0x15af0f,_0x5454ce){_0x15af0f=_0x15af0f-0x0;var _0x2bd1cb=_0xaa88[_0x15af0f];return _0x2bd1cb;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index efac821..d7afbd0 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 _0x4e52=['show','post','create','put','/:id','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe'];(function(_0x3b7b8a,_0x52c3b0){var _0x441206=function(_0x5d34d3){while(--_0x5d34d3){_0x3b7b8a['push'](_0x3b7b8a['shift']());}};_0x441206(++_0x52c3b0);}(_0x4e52,0xf0));var _0x24e5=function(_0x5417ca,_0x54e9ec){_0x5417ca=_0x5417ca-0x0;var _0x4c978d=_0x4e52[_0x5417ca];return _0x4c978d;};'use strict';var multer=require('multer');var util=require(_0x24e5('0x0'));var path=require(_0x24e5('0x1'));var timeout=require(_0x24e5('0x2'));var express=require(_0x24e5('0x3'));var router=express[_0x24e5('0x4')]();var fs_extra=require(_0x24e5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x24e5('0x6'));var config=require(_0x24e5('0x7'));var controller=require('./jscriptyQuestionReport.controller');router[_0x24e5('0x8')]('/',auth[_0x24e5('0x9')](),controller[_0x24e5('0xa')]);router['get']('/describe',auth[_0x24e5('0x9')](),controller[_0x24e5('0xb')]);router[_0x24e5('0x8')]('/:id',auth[_0x24e5('0x9')](),controller[_0x24e5('0xc')]);router[_0x24e5('0xd')]('/',auth[_0x24e5('0x9')](),controller[_0x24e5('0xe')]);router[_0x24e5('0xf')](_0x24e5('0x10'),auth[_0x24e5('0x9')](),controller['update']);router['delete'](_0x24e5('0x10'),auth[_0x24e5('0x9')](),controller[_0x24e5('0x11')]);module['exports']=router; \ No newline at end of file +var _0x291f=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy'];(function(_0x21a1e5,_0x105f2e){var _0x522496=function(_0x4b5e2e){while(--_0x4b5e2e){_0x21a1e5['push'](_0x21a1e5['shift']());}};_0x522496(++_0x105f2e);}(_0x291f,0xdd));var _0xf291=function(_0x246648,_0x38670f){_0x246648=_0x246648-0x0;var _0x364fea=_0x291f[_0x246648];return _0x364fea;};'use strict';var multer=require(_0xf291('0x0'));var util=require('util');var path=require(_0xf291('0x1'));var timeout=require(_0xf291('0x2'));var express=require(_0xf291('0x3'));var router=express[_0xf291('0x4')]();var fs_extra=require(_0xf291('0x5'));var auth=require(_0xf291('0x6'));var interaction=require(_0xf291('0x7'));var config=require('../../config/environment');var controller=require(_0xf291('0x8'));router[_0xf291('0x9')]('/',auth[_0xf291('0xa')](),controller[_0xf291('0xb')]);router[_0xf291('0x9')](_0xf291('0xc'),auth[_0xf291('0xa')](),controller[_0xf291('0xd')]);router[_0xf291('0x9')](_0xf291('0xe'),auth[_0xf291('0xa')](),controller['show']);router[_0xf291('0xf')]('/',auth[_0xf291('0xa')](),controller[_0xf291('0x10')]);router[_0xf291('0x11')](_0xf291('0xe'),auth[_0xf291('0xa')](),controller[_0xf291('0x12')]);router[_0xf291('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xf291('0x14')]);module[_0xf291('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index ea264c0..7eba134 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(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x7a54,0x106));var _0x47a5=function(_0x21ac85,_0x217c92){_0x21ac85=_0x21ac85-0x0;var _0x502142=_0x7a54[_0x21ac85];return _0x502142;};'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(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x7a54,0x106));var _0x47a5=function(_0x376bee,_0x39e52d){_0x376bee=_0x376bee-0x0;var _0x5e9cde=_0x7a54[_0x376bee];return _0x5e9cde;};'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 9ec5cab..7a9f154 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 _0x9d2b=['stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','key','query','filters','intersection','model','fields','length','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','catch','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x4b5cf4,_0x23a41d){var _0xed5b22=function(_0xdbb65){while(--_0xdbb65){_0x4b5cf4['push'](_0x4b5cf4['shift']());}};_0xed5b22(++_0x23a41d);}(_0x9d2b,0x15d));var _0xb9d2=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0x9d2b[_0x39c734];return _0xb2a2f9;};'use strict';var emlformat=require(_0xb9d2('0x0'));var rimraf=require(_0xb9d2('0x1'));var zipdir=require(_0xb9d2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb9d2('0x3'));var moment=require('moment');var BPromise=require(_0xb9d2('0x4'));var Mustache=require(_0xb9d2('0x5'));var util=require('util');var path=require(_0xb9d2('0x6'));var sox=require(_0xb9d2('0x7'));var csv=require(_0xb9d2('0x8'));var ejs=require(_0xb9d2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb9d2('0xa'));var squel=require(_0xb9d2('0xb'));var crypto=require(_0xb9d2('0xc'));var jsforce=require(_0xb9d2('0xd'));var deskjs=require(_0xb9d2('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb9d2('0xf'));var qs=require(_0xb9d2('0x10'));var as=require(_0xb9d2('0x11'));var hardwareService=require(_0xb9d2('0x12'));var logger=require(_0xb9d2('0x13'))(_0xb9d2('0x14'));var utils=require(_0xb9d2('0x15'));var config=require(_0xb9d2('0x16'));var licenseUtil=require(_0xb9d2('0x17'));var db=require(_0xb9d2('0x18'))['db'];function respondWithStatusCode(_0x1b4535,_0x381216){_0x381216=_0x381216||0xcc;return function(_0xfd625d){if(_0xfd625d){return _0x1b4535[_0xb9d2('0x19')](_0x381216);}return _0x1b4535[_0xb9d2('0x1a')](_0x381216)[_0xb9d2('0x1b')]();};}function respondWithResult(_0xbfe12,_0x215fe1){_0x215fe1=_0x215fe1||0xc8;return function(_0x3b0d4f){if(_0x3b0d4f){return _0xbfe12[_0xb9d2('0x1a')](_0x215fe1)[_0xb9d2('0x1c')](_0x3b0d4f);}};}function respondWithFilteredResult(_0xd2d92d,_0x4b7836){return function(_0x3e4ce5){if(_0x3e4ce5){var _0x21016a=typeof _0x4b7836[_0xb9d2('0x1d')]===_0xb9d2('0x1e')&&typeof _0x4b7836['limit']==='undefined';var _0x590c2b=_0x3e4ce5[_0xb9d2('0x1f')];var _0x6a8d68=_0x21016a?0x0:_0x4b7836[_0xb9d2('0x1d')];var _0x5cf558=_0x21016a?_0x3e4ce5[_0xb9d2('0x1f')]:_0x4b7836[_0xb9d2('0x1d')]+_0x4b7836[_0xb9d2('0x20')];var _0x360b31;if(_0x5cf558>=_0x590c2b){_0x5cf558=_0x590c2b;_0x360b31=0xc8;}else{_0x360b31=0xce;}_0xd2d92d['status'](_0x360b31);return _0xd2d92d[_0xb9d2('0x21')](_0xb9d2('0x22'),_0x6a8d68+'-'+_0x5cf558+'/'+_0x590c2b)['json'](_0x3e4ce5);}return null;};}function patchUpdates(_0x5e7e0a){return function(_0x490aab){try{jsonpatch[_0xb9d2('0x23')](_0x490aab,_0x5e7e0a,!![]);}catch(_0x120bf4){return BPromise[_0xb9d2('0x24')](_0x120bf4);}return _0x490aab[_0xb9d2('0x25')]();};}function saveUpdates(_0x59379d,_0x118c55){return function(_0x5e423a){if(_0x5e423a){return _0x5e423a[_0xb9d2('0x26')](_0x59379d)[_0xb9d2('0x27')](function(_0x5a46f6){return _0x5a46f6;});}return null;};}function removeEntity(_0x3c11b2,_0x225f84){return function(_0x1cfb3b){if(_0x1cfb3b){return _0x1cfb3b[_0xb9d2('0x28')]()[_0xb9d2('0x27')](function(){_0x3c11b2[_0xb9d2('0x1a')](0xcc)[_0xb9d2('0x1b')]();});}};}function handleEntityNotFound(_0xc7d770,_0x4fdb74){return function(_0x1ad5c7){if(!_0x1ad5c7){_0xc7d770[_0xb9d2('0x19')](0x194);}return _0x1ad5c7;};}function handleError(_0x44b52b,_0x6e9f9b){_0x6e9f9b=_0x6e9f9b||0x1f4;return function(_0x3695ae){logger['error'](_0x3695ae[_0xb9d2('0x29')]);if(_0x3695ae[_0xb9d2('0x2a')]){delete _0x3695ae['name'];}_0x44b52b[_0xb9d2('0x1a')](_0x6e9f9b)[_0xb9d2('0x2b')](_0x3695ae);};}exports[_0xb9d2('0x2c')]=function(_0x4bd696,_0x5d37e1){var _0x231ef2={},_0x3fed60={},_0x1a667e={'count':0x0,'rows':[]};var _0x509a5f=_[_0xb9d2('0x2d')](db[_0xb9d2('0x2e')][_0xb9d2('0x2f')],function(_0x2e8dfd){return{'name':_0x2e8dfd[_0xb9d2('0x30')],'type':_0x2e8dfd['type'][_0xb9d2('0x31')]};});_0x3fed60['model']=_['map'](_0x509a5f,'name');_0x3fed60[_0xb9d2('0x32')]=_['keys'](_0x4bd696['query']);_0x3fed60[_0xb9d2('0x33')]=_[_0xb9d2('0x34')](_0x3fed60[_0xb9d2('0x35')],_0x3fed60[_0xb9d2('0x32')]);_0x231ef2['attributes']=_['intersection'](_0x3fed60[_0xb9d2('0x35')],qs[_0xb9d2('0x36')](_0x4bd696[_0xb9d2('0x32')][_0xb9d2('0x36')]));_0x231ef2['attributes']=_0x231ef2['attributes'][_0xb9d2('0x37')]?_0x231ef2[_0xb9d2('0x38')]:_0x3fed60['model'];if(!_0x4bd696['query'][_0xb9d2('0x39')](_0xb9d2('0x3a'))){_0x231ef2[_0xb9d2('0x20')]=qs[_0xb9d2('0x20')](_0x4bd696[_0xb9d2('0x32')][_0xb9d2('0x20')]);_0x231ef2[_0xb9d2('0x1d')]=qs[_0xb9d2('0x1d')](_0x4bd696[_0xb9d2('0x32')]['offset']);}_0x231ef2['order']=qs[_0xb9d2('0x3b')](_0x4bd696[_0xb9d2('0x32')][_0xb9d2('0x3b')]);_0x231ef2[_0xb9d2('0x3c')]=qs[_0xb9d2('0x33')](_[_0xb9d2('0x3d')](_0x4bd696[_0xb9d2('0x32')],_0x3fed60[_0xb9d2('0x33')]),_0x509a5f);if(_0x4bd696[_0xb9d2('0x32')][_0xb9d2('0x3e')]){_0x231ef2[_0xb9d2('0x3c')]=_[_0xb9d2('0x3f')](_0x231ef2[_0xb9d2('0x3c')],{'$or':_[_0xb9d2('0x2d')](_0x509a5f,function(_0x532a09){if(_0x532a09['type']!==_0xb9d2('0x40')){var _0x458269={};_0x458269[_0x532a09['name']]={'$like':'%'+_0x4bd696[_0xb9d2('0x32')][_0xb9d2('0x3e')]+'%'};return _0x458269;}})});}_0x231ef2=_[_0xb9d2('0x3f')]({},_0x231ef2,_0x4bd696[_0xb9d2('0x41')]);var _0x399c36={'where':_0x231ef2[_0xb9d2('0x3c')]};return db[_0xb9d2('0x2e')][_0xb9d2('0x1f')](_0x399c36)[_0xb9d2('0x27')](function(_0x436ee1){_0x1a667e['count']=_0x436ee1;if(_0x4bd696[_0xb9d2('0x32')][_0xb9d2('0x42')]){_0x231ef2[_0xb9d2('0x43')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xb9d2('0x44')](_0x231ef2);})['then'](function(_0x5ce7b8){_0x1a667e[_0xb9d2('0x45')]=_0x5ce7b8;return _0x1a667e;})[_0xb9d2('0x27')](respondWithFilteredResult(_0x5d37e1,_0x231ef2))['catch'](handleError(_0x5d37e1,null));};exports[_0xb9d2('0x46')]=function(_0x2bf800,_0x1a83f9){var _0x28929e={'raw':!![],'where':{'id':_0x2bf800[_0xb9d2('0x47')]['id']}},_0x267d7c={};_0x267d7c[_0xb9d2('0x35')]=_['keys'](db[_0xb9d2('0x2e')]['rawAttributes']);_0x267d7c[_0xb9d2('0x32')]=_[_0xb9d2('0x48')](_0x2bf800[_0xb9d2('0x32')]);_0x267d7c[_0xb9d2('0x33')]=_['intersection'](_0x267d7c[_0xb9d2('0x35')],_0x267d7c[_0xb9d2('0x32')]);_0x28929e[_0xb9d2('0x38')]=_[_0xb9d2('0x34')](_0x267d7c[_0xb9d2('0x35')],qs[_0xb9d2('0x36')](_0x2bf800[_0xb9d2('0x32')][_0xb9d2('0x36')]));_0x28929e[_0xb9d2('0x38')]=_0x28929e[_0xb9d2('0x38')][_0xb9d2('0x37')]?_0x28929e[_0xb9d2('0x38')]:_0x267d7c['model'];if(_0x2bf800[_0xb9d2('0x32')][_0xb9d2('0x42')]){_0x28929e[_0xb9d2('0x43')]=[{'all':!![]}];}_0x28929e=_[_0xb9d2('0x3f')]({},_0x28929e,_0x2bf800[_0xb9d2('0x41')]);return db[_0xb9d2('0x2e')][_0xb9d2('0x49')](_0x28929e)[_0xb9d2('0x27')](handleEntityNotFound(_0x1a83f9,null))[_0xb9d2('0x27')](respondWithResult(_0x1a83f9,null))['catch'](handleError(_0x1a83f9,null));};exports[_0xb9d2('0x4a')]=function(_0x21e1b6,_0x704924){return db[_0xb9d2('0x2e')][_0xb9d2('0x4a')](_0x21e1b6[_0xb9d2('0x4b')],{})[_0xb9d2('0x27')](respondWithResult(_0x704924,0xc9))[_0xb9d2('0x4c')](handleError(_0x704924,null));};exports[_0xb9d2('0x26')]=function(_0x3bf264,_0xd13b87){if(_0x3bf264[_0xb9d2('0x4b')]['id']){delete _0x3bf264[_0xb9d2('0x4b')]['id'];}return db[_0xb9d2('0x2e')]['find']({'where':{'id':_0x3bf264[_0xb9d2('0x47')]['id']}})[_0xb9d2('0x27')](handleEntityNotFound(_0xd13b87,null))[_0xb9d2('0x27')](saveUpdates(_0x3bf264['body'],null))[_0xb9d2('0x27')](respondWithResult(_0xd13b87,null))['catch'](handleError(_0xd13b87,null));};exports['destroy']=function(_0x32cc54,_0x2fb812){return db[_0xb9d2('0x2e')][_0xb9d2('0x49')]({'where':{'id':_0x32cc54[_0xb9d2('0x47')]['id']}})['then'](handleEntityNotFound(_0x2fb812,null))['then'](removeEntity(_0x2fb812,null))[_0xb9d2('0x4c')](handleError(_0x2fb812,null));};exports[_0xb9d2('0x4d')]=function(_0x98baf5,_0x1f7023){return db[_0xb9d2('0x2e')][_0xb9d2('0x4d')]()['then'](respondWithResult(_0x1f7023,null))[_0xb9d2('0x4c')](handleError(_0x1f7023,null));}; \ No newline at end of file +var _0x1dc9=['limit','count','set','Content-Range','apply','reject','save','update','then','end','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','keys','catch','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','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','json','offset','undefined'];(function(_0x35ae12,_0x56ee1a){var _0x122a9d=function(_0x4e0bc8){while(--_0x4e0bc8){_0x35ae12['push'](_0x35ae12['shift']());}};_0x122a9d(++_0x56ee1a);}(_0x1dc9,0x7b));var _0x91dc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1dc9[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x91dc('0x0'));var rimraf=require(_0x91dc('0x1'));var zipdir=require(_0x91dc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x91dc('0x3'));var moment=require(_0x91dc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91dc('0x5'));var util=require(_0x91dc('0x6'));var path=require(_0x91dc('0x7'));var sox=require(_0x91dc('0x8'));var csv=require(_0x91dc('0x9'));var ejs=require(_0x91dc('0xa'));var fs=require('fs');var fs_extra=require(_0x91dc('0xb'));var _=require('lodash');var squel=require(_0x91dc('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x91dc('0xd'));var toCsv=require(_0x91dc('0x9'));var querystring=require(_0x91dc('0xe'));var Papa=require(_0x91dc('0xf'));var Redis=require(_0x91dc('0x10'));var authService=require(_0x91dc('0x11'));var qs=require(_0x91dc('0x12'));var as=require(_0x91dc('0x13'));var hardwareService=require(_0x91dc('0x14'));var logger=require(_0x91dc('0x15'))(_0x91dc('0x16'));var utils=require(_0x91dc('0x17'));var config=require(_0x91dc('0x18'));var licenseUtil=require(_0x91dc('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ba2a6,_0x23dd1d){_0x23dd1d=_0x23dd1d||0xcc;return function(_0x4f6989){if(_0x4f6989){return _0x1ba2a6[_0x91dc('0x1a')](_0x23dd1d);}return _0x1ba2a6[_0x91dc('0x1b')](_0x23dd1d)['end']();};}function respondWithResult(_0x2e6cde,_0x3c0811){_0x3c0811=_0x3c0811||0xc8;return function(_0x4343a8){if(_0x4343a8){return _0x2e6cde[_0x91dc('0x1b')](_0x3c0811)[_0x91dc('0x1c')](_0x4343a8);}};}function respondWithFilteredResult(_0x5cee61,_0xe40f45){return function(_0x1b6f3b){if(_0x1b6f3b){var _0x415509=typeof _0xe40f45[_0x91dc('0x1d')]===_0x91dc('0x1e')&&typeof _0xe40f45[_0x91dc('0x1f')]===_0x91dc('0x1e');var _0x311035=_0x1b6f3b[_0x91dc('0x20')];var _0x19e3de=_0x415509?0x0:_0xe40f45[_0x91dc('0x1d')];var _0x1efdc1=_0x415509?_0x1b6f3b[_0x91dc('0x20')]:_0xe40f45['offset']+_0xe40f45[_0x91dc('0x1f')];var _0x1e916a;if(_0x1efdc1>=_0x311035){_0x1efdc1=_0x311035;_0x1e916a=0xc8;}else{_0x1e916a=0xce;}_0x5cee61[_0x91dc('0x1b')](_0x1e916a);return _0x5cee61[_0x91dc('0x21')](_0x91dc('0x22'),_0x19e3de+'-'+_0x1efdc1+'/'+_0x311035)[_0x91dc('0x1c')](_0x1b6f3b);}return null;};}function patchUpdates(_0x1299fc){return function(_0x4372b2){try{jsonpatch[_0x91dc('0x23')](_0x4372b2,_0x1299fc,!![]);}catch(_0x99e9e8){return BPromise[_0x91dc('0x24')](_0x99e9e8);}return _0x4372b2[_0x91dc('0x25')]();};}function saveUpdates(_0x429dcb,_0x5a6c63){return function(_0xc8774e){if(_0xc8774e){return _0xc8774e[_0x91dc('0x26')](_0x429dcb)[_0x91dc('0x27')](function(_0x115422){return _0x115422;});}return null;};}function removeEntity(_0x496110,_0x529b2f){return function(_0x1d6474){if(_0x1d6474){return _0x1d6474['destroy']()[_0x91dc('0x27')](function(){_0x496110['status'](0xcc)[_0x91dc('0x28')]();});}};}function handleEntityNotFound(_0x4400b2,_0x4c89bf){return function(_0x19f2a2){if(!_0x19f2a2){_0x4400b2[_0x91dc('0x1a')](0x194);}return _0x19f2a2;};}function handleError(_0x50646a,_0x2cebae){_0x2cebae=_0x2cebae||0x1f4;return function(_0x3bf9d1){logger['error'](_0x3bf9d1[_0x91dc('0x29')]);if(_0x3bf9d1[_0x91dc('0x2a')]){delete _0x3bf9d1['name'];}_0x50646a[_0x91dc('0x1b')](_0x2cebae)[_0x91dc('0x2b')](_0x3bf9d1);};}exports[_0x91dc('0x2c')]=function(_0x5dd5d0,_0x3ae0ef){var _0x13e773={},_0x25806d={},_0x4ecfca={'count':0x0,'rows':[]};var _0xd2f0b7=_[_0x91dc('0x2d')](db[_0x91dc('0x2e')][_0x91dc('0x2f')],function(_0xe51e5d){return{'name':_0xe51e5d[_0x91dc('0x30')],'type':_0xe51e5d[_0x91dc('0x31')][_0x91dc('0x32')]};});_0x25806d['model']=_[_0x91dc('0x2d')](_0xd2f0b7,_0x91dc('0x2a'));_0x25806d[_0x91dc('0x33')]=_['keys'](_0x5dd5d0['query']);_0x25806d[_0x91dc('0x34')]=_[_0x91dc('0x35')](_0x25806d[_0x91dc('0x36')],_0x25806d['query']);_0x13e773['attributes']=_[_0x91dc('0x35')](_0x25806d[_0x91dc('0x36')],qs[_0x91dc('0x37')](_0x5dd5d0[_0x91dc('0x33')][_0x91dc('0x37')]));_0x13e773[_0x91dc('0x38')]=_0x13e773[_0x91dc('0x38')][_0x91dc('0x39')]?_0x13e773[_0x91dc('0x38')]:_0x25806d[_0x91dc('0x36')];if(!_0x5dd5d0[_0x91dc('0x33')]['hasOwnProperty']('nolimit')){_0x13e773[_0x91dc('0x1f')]=qs[_0x91dc('0x1f')](_0x5dd5d0[_0x91dc('0x33')][_0x91dc('0x1f')]);_0x13e773['offset']=qs[_0x91dc('0x1d')](_0x5dd5d0['query'][_0x91dc('0x1d')]);}_0x13e773[_0x91dc('0x3a')]=qs[_0x91dc('0x3b')](_0x5dd5d0[_0x91dc('0x33')]['sort']);_0x13e773[_0x91dc('0x3c')]=qs[_0x91dc('0x34')](_['pick'](_0x5dd5d0['query'],_0x25806d[_0x91dc('0x34')]),_0xd2f0b7);if(_0x5dd5d0[_0x91dc('0x33')][_0x91dc('0x3d')]){_0x13e773['where']=_[_0x91dc('0x3e')](_0x13e773[_0x91dc('0x3c')],{'$or':_[_0x91dc('0x2d')](_0xd2f0b7,function(_0x6d8e56){if(_0x6d8e56[_0x91dc('0x31')]!==_0x91dc('0x3f')){var _0x99e2c3={};_0x99e2c3[_0x6d8e56[_0x91dc('0x2a')]]={'$like':'%'+_0x5dd5d0[_0x91dc('0x33')][_0x91dc('0x3d')]+'%'};return _0x99e2c3;}})});}_0x13e773=_[_0x91dc('0x3e')]({},_0x13e773,_0x5dd5d0[_0x91dc('0x40')]);var _0x2666cb={'where':_0x13e773['where']};return db[_0x91dc('0x2e')]['count'](_0x2666cb)[_0x91dc('0x27')](function(_0x7e77a3){_0x4ecfca['count']=_0x7e77a3;if(_0x5dd5d0[_0x91dc('0x33')][_0x91dc('0x41')]){_0x13e773[_0x91dc('0x42')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x13e773);})[_0x91dc('0x27')](function(_0xa717b1){_0x4ecfca[_0x91dc('0x43')]=_0xa717b1;return _0x4ecfca;})[_0x91dc('0x27')](respondWithFilteredResult(_0x3ae0ef,_0x13e773))['catch'](handleError(_0x3ae0ef,null));};exports[_0x91dc('0x44')]=function(_0x42f1b7,_0x510aae){var _0x191496={'raw':!![],'where':{'id':_0x42f1b7[_0x91dc('0x45')]['id']}},_0x4cc004={};_0x4cc004[_0x91dc('0x36')]=_['keys'](db[_0x91dc('0x2e')][_0x91dc('0x2f')]);_0x4cc004['query']=_[_0x91dc('0x46')](_0x42f1b7[_0x91dc('0x33')]);_0x4cc004[_0x91dc('0x34')]=_[_0x91dc('0x35')](_0x4cc004[_0x91dc('0x36')],_0x4cc004[_0x91dc('0x33')]);_0x191496['attributes']=_[_0x91dc('0x35')](_0x4cc004[_0x91dc('0x36')],qs[_0x91dc('0x37')](_0x42f1b7[_0x91dc('0x33')][_0x91dc('0x37')]));_0x191496[_0x91dc('0x38')]=_0x191496['attributes']['length']?_0x191496['attributes']:_0x4cc004[_0x91dc('0x36')];if(_0x42f1b7[_0x91dc('0x33')][_0x91dc('0x41')]){_0x191496['include']=[{'all':!![]}];}_0x191496=_[_0x91dc('0x3e')]({},_0x191496,_0x42f1b7[_0x91dc('0x40')]);return db['JscriptyQuestionReport']['find'](_0x191496)[_0x91dc('0x27')](handleEntityNotFound(_0x510aae,null))[_0x91dc('0x27')](respondWithResult(_0x510aae,null))[_0x91dc('0x47')](handleError(_0x510aae,null));};exports[_0x91dc('0x48')]=function(_0x240670,_0x40f29a){return db[_0x91dc('0x2e')][_0x91dc('0x48')](_0x240670[_0x91dc('0x49')],{})[_0x91dc('0x27')](respondWithResult(_0x40f29a,0xc9))[_0x91dc('0x47')](handleError(_0x40f29a,null));};exports[_0x91dc('0x26')]=function(_0xa61a60,_0x2641d8){if(_0xa61a60[_0x91dc('0x49')]['id']){delete _0xa61a60[_0x91dc('0x49')]['id'];}return db[_0x91dc('0x2e')][_0x91dc('0x4a')]({'where':{'id':_0xa61a60['params']['id']}})[_0x91dc('0x27')](handleEntityNotFound(_0x2641d8,null))[_0x91dc('0x27')](saveUpdates(_0xa61a60[_0x91dc('0x49')],null))['then'](respondWithResult(_0x2641d8,null))[_0x91dc('0x47')](handleError(_0x2641d8,null));};exports[_0x91dc('0x4b')]=function(_0x2ab4cc,_0x5dceef){return db[_0x91dc('0x2e')][_0x91dc('0x4a')]({'where':{'id':_0x2ab4cc[_0x91dc('0x45')]['id']}})[_0x91dc('0x27')](handleEntityNotFound(_0x5dceef,null))[_0x91dc('0x27')](removeEntity(_0x5dceef,null))[_0x91dc('0x47')](handleError(_0x5dceef,null));};exports[_0x91dc('0x4c')]=function(_0x44ee6,_0xf8d341){return db[_0x91dc('0x2e')][_0x91dc('0x4c')]()[_0x91dc('0x27')](respondWithResult(_0xf8d341,null))[_0x91dc('0x47')](handleError(_0xf8d341,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index a364af7..cf3beb2 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 _0x77ff=['JscriptyQuestionReport','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x494fa2,_0x84b5d8){var _0xf013c7=function(_0x348859){while(--_0x348859){_0x494fa2['push'](_0x494fa2['shift']());}};_0xf013c7(++_0x84b5d8);}(_0x77ff,0x159));var _0xf77f=function(_0x259d51,_0x451716){_0x259d51=_0x259d51-0x0;var _0x5bd48b=_0x77ff[_0x259d51];return _0x5bd48b;};'use strict';var _=require(_0xf77f('0x0'));var util=require('util');var logger=require(_0xf77f('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf77f('0x2'));var rp=require(_0xf77f('0x3'));var fs=require('fs');var path=require(_0xf77f('0x4'));var rimraf=require(_0xf77f('0x5'));var config=require(_0xf77f('0x6'));var attributes=require('./jscriptyQuestionReport.attributes');module['exports']=function(_0x287b69,_0x52e0b6){return _0x287b69['define'](_0xf77f('0x7'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x39b1=['JscriptyQuestionReport','report_jscripty_questions','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x39b1,0x195));var _0x139b=function(_0x1bda53,_0xe18f3c){_0x1bda53=_0x1bda53-0x0;var _0x2a4536=_0x39b1[_0x1bda53];return _0x2a4536;};'use strict';var _=require(_0x139b('0x0'));var util=require('util');var logger=require(_0x139b('0x1'))(_0x139b('0x2'));var moment=require(_0x139b('0x3'));var BPromise=require(_0x139b('0x4'));var rp=require(_0x139b('0x5'));var fs=require('fs');var path=require(_0x139b('0x6'));var rimraf=require(_0x139b('0x7'));var config=require(_0x139b('0x8'));var attributes=require(_0x139b('0x9'));module['exports']=function(_0x54faa7,_0x49a3e0){return _0x54faa7[_0x139b('0xa')](_0x139b('0xb'),attributes,{'tableName':_0x139b('0xc'),'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 02ec7b8..f33f2ee 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 _0x7817=['code','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','jayson/promise','client','http','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1ee04b,_0x554b3d){var _0x412848=function(_0x11917a){while(--_0x11917a){_0x1ee04b['push'](_0x1ee04b['shift']());}};_0x412848(++_0x554b3d);}(_0x7817,0x1f1));var _0x7781=function(_0x3b13e2,_0x3cd43d){_0x3b13e2=_0x3b13e2-0x0;var _0x29dd1f=_0x7817[_0x3b13e2];return _0x29dd1f;};'use strict';var _=require(_0x7781('0x0'));var util=require(_0x7781('0x1'));var moment=require(_0x7781('0x2'));var BPromise=require('bluebird');var rs=require(_0x7781('0x3'));var fs=require('fs');var Redis=require(_0x7781('0x4'));var db=require(_0x7781('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x7781('0x6'));var client=jayson[_0x7781('0x7')][_0x7781('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2a21eb,_0x201e8d,_0x508e0b){return new BPromise(function(_0x5bb360,_0x44af52){return client['request'](_0x2a21eb,_0x508e0b)['then'](function(_0x1db810){logger[_0x7781('0x9')](_0x7781('0xa'),_0x201e8d,_0x7781('0xb'));logger[_0x7781('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x201e8d,_0x7781('0xb'),JSON['stringify'](_0x1db810));if(_0x1db810['error']){if(_0x1db810['error'][_0x7781('0xd')]===0x1f4){logger['error'](_0x7781('0xa'),_0x201e8d,_0x1db810[_0x7781('0xe')][_0x7781('0xf')]);return _0x44af52(_0x1db810[_0x7781('0xe')][_0x7781('0xf')]);}logger[_0x7781('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x201e8d,_0x1db810[_0x7781('0xe')][_0x7781('0xf')]);return _0x5bb360(_0x1db810['error'][_0x7781('0xf')]);}else{logger['info'](_0x7781('0xa'),_0x201e8d,_0x7781('0xb'));_0x5bb360(_0x1db810['result'][_0x7781('0xf')]);}})[_0x7781('0x10')](function(_0x3c3a09){logger[_0x7781('0xe')](_0x7781('0xa'),_0x201e8d,_0x3c3a09);_0x44af52(_0x3c3a09);});});} \ No newline at end of file +var _0xd70e=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment','randomstring'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0xd70e,0x15d));var _0xed70=function(_0x354151,_0x3f2fe1){_0x354151=_0x354151-0x0;var _0x2ecc93=_0xd70e[_0x354151];return _0x2ecc93;};'use strict';var _=require(_0xed70('0x0'));var util=require('util');var moment=require(_0xed70('0x1'));var BPromise=require('bluebird');var rs=require(_0xed70('0x2'));var fs=require('fs');var Redis=require(_0xed70('0x3'));var db=require(_0xed70('0x4'))['db'];var utils=require(_0xed70('0x5'));var logger=require('../../config/logger')(_0xed70('0x6'));var config=require(_0xed70('0x7'));var jayson=require(_0xed70('0x8'));var client=jayson[_0xed70('0x9')][_0xed70('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5cfd7a,_0x501e31,_0x261c16){return new BPromise(function(_0xc99d72,_0x34a5eb){return client[_0xed70('0xb')](_0x5cfd7a,_0x261c16)[_0xed70('0xc')](function(_0x1d995c){logger[_0xed70('0xd')](_0xed70('0xe'),_0x501e31,'request\x20sent');logger['debug'](_0xed70('0xf'),_0x501e31,_0xed70('0x10'),JSON['stringify'](_0x1d995c));if(_0x1d995c[_0xed70('0x11')]){if(_0x1d995c[_0xed70('0x11')][_0xed70('0x12')]===0x1f4){logger[_0xed70('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x501e31,_0x1d995c['error'][_0xed70('0x13')]);return _0x34a5eb(_0x1d995c['error']['message']);}logger['error'](_0xed70('0xe'),_0x501e31,_0x1d995c[_0xed70('0x11')][_0xed70('0x13')]);return _0xc99d72(_0x1d995c[_0xed70('0x11')][_0xed70('0x13')]);}else{logger[_0xed70('0xd')](_0xed70('0xe'),_0x501e31,_0xed70('0x10'));_0xc99d72(_0x1d995c[_0xed70('0x14')][_0xed70('0x13')]);}})[_0xed70('0x15')](function(_0xdc419d){logger[_0xed70('0x11')](_0xed70('0xe'),_0x501e31,_0xdc419d);_0x34a5eb(_0xdc419d);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 0022fc3..1e4223b 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 _0x613f=['put','util','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/questions','getQuestions','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x613f,0x1b1));var _0xf613=function(_0x590aa1,_0x338f24){_0x590aa1=_0x590aa1-0x0;var _0x4150de=_0x613f[_0x590aa1];return _0x4150de;};'use strict';var multer=require('multer');var util=require(_0xf613('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf613('0x1'));var router=express[_0xf613('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xf613('0x3'));var interaction=require(_0xf613('0x4'));var config=require('../../config/environment');var controller=require(_0xf613('0x5'));router['get']('/',auth[_0xf613('0x6')](),controller[_0xf613('0x7')]);router[_0xf613('0x8')](_0xf613('0x9'),auth['isAuthenticated'](),controller[_0xf613('0xa')]);router['get'](_0xf613('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0xf613('0xc'),auth['isAuthenticated'](),controller[_0xf613('0xd')]);router[_0xf613('0xe')]('/',auth[_0xf613('0x6')](),controller['create']);router[_0xf613('0xf')](_0xf613('0xb'),auth[_0xf613('0x6')](),controller['update']);router['delete'](_0xf613('0xb'),auth[_0xf613('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd48d=['update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/questions','getQuestions','create'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0xd48d,0xa3));var _0xdd48=function(_0x1d3671,_0x224f4f){_0x1d3671=_0x1d3671-0x0;var _0x42d63c=_0xd48d[_0x1d3671];return _0x42d63c;};'use strict';var multer=require(_0xdd48('0x0'));var util=require(_0xdd48('0x1'));var path=require(_0xdd48('0x2'));var timeout=require(_0xdd48('0x3'));var express=require(_0xdd48('0x4'));var router=express[_0xdd48('0x5')]();var fs_extra=require(_0xdd48('0x6'));var auth=require(_0xdd48('0x7'));var interaction=require(_0xdd48('0x8'));var config=require(_0xdd48('0x9'));var controller=require(_0xdd48('0xa'));router[_0xdd48('0xb')]('/',auth[_0xdd48('0xc')](),controller[_0xdd48('0xd')]);router[_0xdd48('0xb')](_0xdd48('0xe'),auth[_0xdd48('0xc')](),controller[_0xdd48('0xf')]);router[_0xdd48('0xb')](_0xdd48('0x10'),auth[_0xdd48('0xc')](),controller[_0xdd48('0x11')]);router[_0xdd48('0xb')](_0xdd48('0x12'),auth[_0xdd48('0xc')](),controller[_0xdd48('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0xdd48('0x14')]);router['put'](_0xdd48('0x10'),auth[_0xdd48('0xc')](),controller[_0xdd48('0x15')]);router['delete'](_0xdd48('0x10'),auth[_0xdd48('0xc')](),controller['destroy']);module[_0xdd48('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index c22e763..8bb5181 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 _0x3c55=['endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports','DATE','setDataValue'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x3c55,0x163));var _0x53c5=function(_0x2c45e9,_0x2ac84a){_0x2c45e9=_0x2c45e9-0x0;var _0x3c5afc=_0x3c55[_0x2c45e9];return _0x3c5afc;};'use strict';var moment=require(_0x53c5('0x0'));var Sequelize=require(_0x53c5('0x1'));module[_0x53c5('0x2')]={'starttime':{'type':Sequelize[_0x53c5('0x3')],'set':function(_0x49b30b){this['setDataValue']('starttime',_0x49b30b);this[_0x53c5('0x4')](_0x53c5('0x5'),moment()[_0x53c5('0x6')](_0x53c5('0x7')));}},'endtime':{'type':Sequelize[_0x53c5('0x3')]},'membername':{'type':Sequelize[_0x53c5('0x8')]},'projectname':{'type':Sequelize[_0x53c5('0x8')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x53c5('0x8')]},'calleridname':{'type':Sequelize[_0x53c5('0x8')]},'calleridnum':{'type':Sequelize[_0x53c5('0x8')]},'completed':{'type':Sequelize[_0x53c5('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0xb331=['DATE','starttime','setDataValue','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','moment','sequelize','exports'];(function(_0x2134b7,_0x1eb5e2){var _0x6c5914=function(_0x1da201){while(--_0x1da201){_0x2134b7['push'](_0x2134b7['shift']());}};_0x6c5914(++_0x1eb5e2);}(_0xb331,0xd9));var _0x1b33=function(_0x21734c,_0x40aadb){_0x21734c=_0x21734c-0x0;var _0x5e7da6=_0xb331[_0x21734c];return _0x5e7da6;};'use strict';var moment=require(_0x1b33('0x0'));var Sequelize=require(_0x1b33('0x1'));module[_0x1b33('0x2')]={'starttime':{'type':Sequelize[_0x1b33('0x3')],'set':function(_0x3e592c){this['setDataValue'](_0x1b33('0x4'),_0x3e592c);this[_0x1b33('0x5')](_0x1b33('0x6'),moment()[_0x1b33('0x7')](_0x1b33('0x8')));}},'endtime':{'type':Sequelize[_0x1b33('0x3')]},'membername':{'type':Sequelize[_0x1b33('0x9')]},'projectname':{'type':Sequelize[_0x1b33('0x9')]},'queue':{'type':Sequelize[_0x1b33('0x9')]},'uniqueid':{'type':Sequelize[_0x1b33('0x9')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x1b33('0x9')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index c4a3768..8d58bd6 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 _0xa5f8=['end','error','stack','name','send','index','map','JscriptySessionReport','fieldName','type','model','keys','filters','intersection','attributes','length','query','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','fields','include','find','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','then'];(function(_0x570afc,_0x3746d4){var _0x408c2f=function(_0x2c3910){while(--_0x2c3910){_0x570afc['push'](_0x570afc['shift']());}};_0x408c2f(++_0x3746d4);}(_0xa5f8,0x1ba));var _0x8a5f=function(_0x2f6168,_0x564bcc){_0x2f6168=_0x2f6168-0x0;var _0xe4f30d=_0xa5f8[_0x2f6168];return _0xe4f30d;};'use strict';var emlformat=require(_0x8a5f('0x0'));var rimraf=require(_0x8a5f('0x1'));var zipdir=require(_0x8a5f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8a5f('0x3'));var moment=require(_0x8a5f('0x4'));var BPromise=require(_0x8a5f('0x5'));var Mustache=require(_0x8a5f('0x6'));var util=require(_0x8a5f('0x7'));var path=require(_0x8a5f('0x8'));var sox=require(_0x8a5f('0x9'));var csv=require(_0x8a5f('0xa'));var ejs=require(_0x8a5f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8a5f('0xc'));var crypto=require(_0x8a5f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8a5f('0xe'));var toCsv=require(_0x8a5f('0xa'));var querystring=require(_0x8a5f('0xf'));var Papa=require('papaparse');var Redis=require(_0x8a5f('0x10'));var authService=require(_0x8a5f('0x11'));var qs=require(_0x8a5f('0x12'));var as=require(_0x8a5f('0x13'));var hardwareService=require(_0x8a5f('0x14'));var logger=require(_0x8a5f('0x15'))('api');var utils=require(_0x8a5f('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8a5f('0x17'))['db'];function respondWithStatusCode(_0x16b1c3,_0x1ea301){_0x1ea301=_0x1ea301||0xcc;return function(_0x1b2d35){if(_0x1b2d35){return _0x16b1c3[_0x8a5f('0x18')](_0x1ea301);}return _0x16b1c3[_0x8a5f('0x19')](_0x1ea301)['end']();};}function respondWithResult(_0x28117d,_0x2b715f){_0x2b715f=_0x2b715f||0xc8;return function(_0x214afd){if(_0x214afd){return _0x28117d[_0x8a5f('0x19')](_0x2b715f)[_0x8a5f('0x1a')](_0x214afd);}};}function respondWithFilteredResult(_0x55d316,_0x3e4a65){return function(_0x446529){if(_0x446529){var _0x354e1f=typeof _0x3e4a65['offset']===_0x8a5f('0x1b')&&typeof _0x3e4a65[_0x8a5f('0x1c')]===_0x8a5f('0x1b');var _0x3ff825=_0x446529[_0x8a5f('0x1d')];var _0x2047a4=_0x354e1f?0x0:_0x3e4a65[_0x8a5f('0x1e')];var _0x1dce98=_0x354e1f?_0x446529[_0x8a5f('0x1d')]:_0x3e4a65[_0x8a5f('0x1e')]+_0x3e4a65[_0x8a5f('0x1c')];var _0x38b6fc;if(_0x1dce98>=_0x3ff825){_0x1dce98=_0x3ff825;_0x38b6fc=0xc8;}else{_0x38b6fc=0xce;}_0x55d316[_0x8a5f('0x19')](_0x38b6fc);return _0x55d316[_0x8a5f('0x1f')](_0x8a5f('0x20'),_0x2047a4+'-'+_0x1dce98+'/'+_0x3ff825)['json'](_0x446529);}return null;};}function patchUpdates(_0x5311a9){return function(_0x5b4fb8){try{jsonpatch[_0x8a5f('0x21')](_0x5b4fb8,_0x5311a9,!![]);}catch(_0x1c77ae){return BPromise['reject'](_0x1c77ae);}return _0x5b4fb8[_0x8a5f('0x22')]();};}function saveUpdates(_0x4c1add,_0x586a36){return function(_0x3b402d){if(_0x3b402d){return _0x3b402d[_0x8a5f('0x23')](_0x4c1add)['then'](function(_0xfead9a){return _0xfead9a;});}return null;};}function removeEntity(_0x139a76,_0x33d573){return function(_0x3ce3c7){if(_0x3ce3c7){return _0x3ce3c7[_0x8a5f('0x24')]()[_0x8a5f('0x25')](function(){_0x139a76[_0x8a5f('0x19')](0xcc)[_0x8a5f('0x26')]();});}};}function handleEntityNotFound(_0x58beb8,_0x506b03){return function(_0xe03648){if(!_0xe03648){_0x58beb8[_0x8a5f('0x18')](0x194);}return _0xe03648;};}function handleError(_0x36f363,_0x5b0273){_0x5b0273=_0x5b0273||0x1f4;return function(_0x260d81){logger[_0x8a5f('0x27')](_0x260d81[_0x8a5f('0x28')]);if(_0x260d81[_0x8a5f('0x29')]){delete _0x260d81['name'];}_0x36f363[_0x8a5f('0x19')](_0x5b0273)[_0x8a5f('0x2a')](_0x260d81);};}exports[_0x8a5f('0x2b')]=function(_0x487545,_0x2a5f1f){var _0x4c1369={},_0xae4c87={},_0x2d5614={'count':0x0,'rows':[]};var _0x42b58b=_[_0x8a5f('0x2c')](db[_0x8a5f('0x2d')]['rawAttributes'],function(_0x31d192){return{'name':_0x31d192[_0x8a5f('0x2e')],'type':_0x31d192[_0x8a5f('0x2f')]['key']};});_0xae4c87[_0x8a5f('0x30')]=_['map'](_0x42b58b,_0x8a5f('0x29'));_0xae4c87['query']=_[_0x8a5f('0x31')](_0x487545['query']);_0xae4c87[_0x8a5f('0x32')]=_[_0x8a5f('0x33')](_0xae4c87['model'],_0xae4c87['query']);_0x4c1369['attributes']=_[_0x8a5f('0x33')](_0xae4c87['model'],qs['fields'](_0x487545['query']['fields']));_0x4c1369[_0x8a5f('0x34')]=_0x4c1369[_0x8a5f('0x34')][_0x8a5f('0x35')]?_0x4c1369[_0x8a5f('0x34')]:_0xae4c87[_0x8a5f('0x30')];if(!_0x487545[_0x8a5f('0x36')]['hasOwnProperty'](_0x8a5f('0x37'))){_0x4c1369[_0x8a5f('0x1c')]=qs[_0x8a5f('0x1c')](_0x487545[_0x8a5f('0x36')][_0x8a5f('0x1c')]);_0x4c1369[_0x8a5f('0x1e')]=qs[_0x8a5f('0x1e')](_0x487545[_0x8a5f('0x36')]['offset']);}_0x4c1369[_0x8a5f('0x38')]=qs[_0x8a5f('0x39')](_0x487545[_0x8a5f('0x36')][_0x8a5f('0x39')]);_0x4c1369[_0x8a5f('0x3a')]=qs['filters'](_[_0x8a5f('0x3b')](_0x487545[_0x8a5f('0x36')],_0xae4c87['filters']),_0x42b58b);if(_0x487545[_0x8a5f('0x36')][_0x8a5f('0x3c')]){_0x4c1369[_0x8a5f('0x3a')]=_[_0x8a5f('0x3d')](_0x4c1369['where'],{'$or':_['map'](_0x42b58b,function(_0x1716d3){if(_0x1716d3[_0x8a5f('0x2f')]!==_0x8a5f('0x3e')){var _0x1a7d22={};_0x1a7d22[_0x1716d3[_0x8a5f('0x29')]]={'$like':'%'+_0x487545[_0x8a5f('0x36')]['filter']+'%'};return _0x1a7d22;}})});}_0x4c1369=_['merge']({},_0x4c1369,_0x487545[_0x8a5f('0x3f')]);var _0xd2a388={'where':_0x4c1369[_0x8a5f('0x3a')]};return db['JscriptySessionReport'][_0x8a5f('0x1d')](_0xd2a388)['then'](function(_0x16d687){_0x2d5614[_0x8a5f('0x1d')]=_0x16d687;if(_0x487545[_0x8a5f('0x36')][_0x8a5f('0x40')]){_0x4c1369['include']=[{'all':!![]}];}return db[_0x8a5f('0x2d')][_0x8a5f('0x41')](_0x4c1369);})[_0x8a5f('0x25')](function(_0x5b5d76){_0x2d5614[_0x8a5f('0x42')]=_0x5b5d76;return _0x2d5614;})[_0x8a5f('0x25')](respondWithFilteredResult(_0x2a5f1f,_0x4c1369))[_0x8a5f('0x43')](handleError(_0x2a5f1f,null));};exports[_0x8a5f('0x44')]=function(_0x202123,_0x4083f3){var _0xc29bad={'raw':!![],'where':{'id':_0x202123[_0x8a5f('0x45')]['id']}},_0x429179={};_0x429179[_0x8a5f('0x30')]=_[_0x8a5f('0x31')](db['JscriptySessionReport'][_0x8a5f('0x46')]);_0x429179['query']=_[_0x8a5f('0x31')](_0x202123[_0x8a5f('0x36')]);_0x429179[_0x8a5f('0x32')]=_[_0x8a5f('0x33')](_0x429179['model'],_0x429179[_0x8a5f('0x36')]);_0xc29bad[_0x8a5f('0x34')]=_[_0x8a5f('0x33')](_0x429179[_0x8a5f('0x30')],qs['fields'](_0x202123[_0x8a5f('0x36')][_0x8a5f('0x47')]));_0xc29bad['attributes']=_0xc29bad[_0x8a5f('0x34')][_0x8a5f('0x35')]?_0xc29bad['attributes']:_0x429179['model'];if(_0x202123[_0x8a5f('0x36')][_0x8a5f('0x40')]){_0xc29bad[_0x8a5f('0x48')]=[{'all':!![]}];}_0xc29bad=_[_0x8a5f('0x3d')]({},_0xc29bad,_0x202123['options']);return db[_0x8a5f('0x2d')][_0x8a5f('0x49')](_0xc29bad)[_0x8a5f('0x25')](handleEntityNotFound(_0x4083f3,null))[_0x8a5f('0x25')](respondWithResult(_0x4083f3,null))[_0x8a5f('0x43')](handleError(_0x4083f3,null));};exports[_0x8a5f('0x4a')]=function(_0x4b7bec,_0xfb6f81){return db[_0x8a5f('0x2d')][_0x8a5f('0x4a')](_0x4b7bec['body'],{})[_0x8a5f('0x25')](respondWithResult(_0xfb6f81,0xc9))[_0x8a5f('0x43')](handleError(_0xfb6f81,null));};exports[_0x8a5f('0x23')]=function(_0x2ea6a9,_0x18cb1e){if(_0x2ea6a9[_0x8a5f('0x4b')]['id']){delete _0x2ea6a9[_0x8a5f('0x4b')]['id'];}return db[_0x8a5f('0x2d')][_0x8a5f('0x49')]({'where':{'id':_0x2ea6a9[_0x8a5f('0x45')]['id']}})[_0x8a5f('0x25')](handleEntityNotFound(_0x18cb1e,null))[_0x8a5f('0x25')](saveUpdates(_0x2ea6a9[_0x8a5f('0x4b')],null))[_0x8a5f('0x25')](respondWithResult(_0x18cb1e,null))[_0x8a5f('0x43')](handleError(_0x18cb1e,null));};exports[_0x8a5f('0x24')]=function(_0x1d9b39,_0x3d995b){return db[_0x8a5f('0x2d')][_0x8a5f('0x49')]({'where':{'id':_0x1d9b39[_0x8a5f('0x45')]['id']}})[_0x8a5f('0x25')](handleEntityNotFound(_0x3d995b,null))[_0x8a5f('0x25')](removeEntity(_0x3d995b,null))['catch'](handleError(_0x3d995b,null));};exports[_0x8a5f('0x4c')]=function(_0xe6cc3a,_0x489c45){return db['JscriptySessionReport'][_0x8a5f('0x4c')]()[_0x8a5f('0x25')](respondWithResult(_0x489c45,null))[_0x8a5f('0x43')](handleError(_0x489c45,null));};exports[_0x8a5f('0x4d')]=function(_0x17074b,_0x645fed,_0xb66762){var _0x5395de={'raw':!![],'where':{}};var _0x11437b={};var _0x1a6b41={'count':0x0,'rows':[]};return db[_0x8a5f('0x2d')][_0x8a5f('0x4e')]({'where':{'id':_0x17074b[_0x8a5f('0x45')]['id']}})['then'](handleEntityNotFound(_0x645fed,null))[_0x8a5f('0x25')](function(_0x2ae57c){if(_0x2ae57c){_0x11437b['model']=_[_0x8a5f('0x31')](db['JscriptyQuestionReport'][_0x8a5f('0x46')]);_0x11437b[_0x8a5f('0x36')]=_[_0x8a5f('0x31')](_0x17074b[_0x8a5f('0x36')]);_0x11437b[_0x8a5f('0x32')]=_['intersection'](_0x11437b[_0x8a5f('0x30')],_0x11437b[_0x8a5f('0x36')]);_0x5395de['attributes']=_[_0x8a5f('0x33')](_0x11437b[_0x8a5f('0x30')],qs[_0x8a5f('0x47')](_0x17074b[_0x8a5f('0x36')][_0x8a5f('0x47')]));_0x5395de['attributes']=_0x5395de[_0x8a5f('0x34')][_0x8a5f('0x35')]?_0x5395de['attributes']:_0x11437b['model'];if(!_0x17074b[_0x8a5f('0x36')]['hasOwnProperty'](_0x8a5f('0x37'))){_0x5395de[_0x8a5f('0x1c')]=qs[_0x8a5f('0x1c')](_0x17074b[_0x8a5f('0x36')][_0x8a5f('0x1c')]);_0x5395de['offset']=qs[_0x8a5f('0x1e')](_0x17074b[_0x8a5f('0x36')]['offset']);}_0x5395de[_0x8a5f('0x38')]=qs['sort'](_0x17074b[_0x8a5f('0x36')][_0x8a5f('0x39')]);_0x5395de[_0x8a5f('0x3a')]=qs['filters'](_[_0x8a5f('0x3b')](_0x17074b[_0x8a5f('0x36')],_0x11437b['filters']));_0x5395de[_0x8a5f('0x3a')]['SessionId']=_0x2ae57c['id'];if(_0x17074b[_0x8a5f('0x36')]['filter']){_0x5395de[_0x8a5f('0x3a')]=_['merge'](_0x5395de[_0x8a5f('0x3a')],{'$or':_['map'](_0x5395de[_0x8a5f('0x34')],function(_0x521df2){var _0x24c95e={};_0x24c95e[_0x521df2]={'$like':'%'+_0x17074b['query'][_0x8a5f('0x3c')]+'%'};return _0x24c95e;})});}_0x5395de=_[_0x8a5f('0x3d')]({},_0x5395de,_0x17074b['options']);return db[_0x8a5f('0x4f')]['count']({'where':_0x5395de[_0x8a5f('0x3a')]})[_0x8a5f('0x25')](function(_0x21eb1c){_0x1a6b41[_0x8a5f('0x1d')]=_0x21eb1c;if(_0x17074b[_0x8a5f('0x36')][_0x8a5f('0x40')]){_0x5395de[_0x8a5f('0x48')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x8a5f('0x41')](_0x5395de);})['then'](function(_0x1a66df){_0x1a6b41[_0x8a5f('0x42')]=_0x1a66df;return _0x1a6b41;});}})['then'](respondWithFilteredResult(_0x645fed,_0x5395de))[_0x8a5f('0x43')](handleError(_0x645fed,null));}; \ No newline at end of file +var _0x9df8=['status','json','offset','limit','undefined','count','set','apply','reject','save','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','type','key','model','intersection','query','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','merge','filter','includeAll','include','findAll','rows','catch','params','keys','options','find','create','body','describe','getQuestions','findOne','nolimit','SessionId','JscriptyQuestionReport','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../mysqldb'];(function(_0x431cde,_0x819072){var _0x1ea03c=function(_0x190c20){while(--_0x190c20){_0x431cde['push'](_0x431cde['shift']());}};_0x1ea03c(++_0x819072);}(_0x9df8,0xd8));var _0x89df=function(_0x27a8fc,_0x15bd0d){_0x27a8fc=_0x27a8fc-0x0;var _0x3802dd=_0x9df8[_0x27a8fc];return _0x3802dd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x89df('0x0'));var zipdir=require(_0x89df('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x89df('0x2'));var moment=require(_0x89df('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x89df('0x4'));var util=require(_0x89df('0x5'));var path=require(_0x89df('0x6'));var sox=require(_0x89df('0x7'));var csv=require(_0x89df('0x8'));var ejs=require(_0x89df('0x9'));var fs=require('fs');var fs_extra=require(_0x89df('0xa'));var _=require(_0x89df('0xb'));var squel=require(_0x89df('0xc'));var crypto=require(_0x89df('0xd'));var jsforce=require(_0x89df('0xe'));var deskjs=require(_0x89df('0xf'));var toCsv=require(_0x89df('0x8'));var querystring=require(_0x89df('0x10'));var Papa=require(_0x89df('0x11'));var Redis=require(_0x89df('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x89df('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x89df('0x14'))(_0x89df('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x89df('0x16'));var db=require(_0x89df('0x17'))['db'];function respondWithStatusCode(_0x419a42,_0x5a4723){_0x5a4723=_0x5a4723||0xcc;return function(_0x61a5fc){if(_0x61a5fc){return _0x419a42['sendStatus'](_0x5a4723);}return _0x419a42[_0x89df('0x18')](_0x5a4723)['end']();};}function respondWithResult(_0x1646c9,_0x39e0bd){_0x39e0bd=_0x39e0bd||0xc8;return function(_0x255e3d){if(_0x255e3d){return _0x1646c9[_0x89df('0x18')](_0x39e0bd)[_0x89df('0x19')](_0x255e3d);}};}function respondWithFilteredResult(_0x1a5d6e,_0x1fbac1){return function(_0x5e646c){if(_0x5e646c){var _0x5a104e=typeof _0x1fbac1[_0x89df('0x1a')]==='undefined'&&typeof _0x1fbac1[_0x89df('0x1b')]===_0x89df('0x1c');var _0x59e77a=_0x5e646c[_0x89df('0x1d')];var _0x5d1d6a=_0x5a104e?0x0:_0x1fbac1[_0x89df('0x1a')];var _0x58df79=_0x5a104e?_0x5e646c[_0x89df('0x1d')]:_0x1fbac1[_0x89df('0x1a')]+_0x1fbac1['limit'];var _0x372ae4;if(_0x58df79>=_0x59e77a){_0x58df79=_0x59e77a;_0x372ae4=0xc8;}else{_0x372ae4=0xce;}_0x1a5d6e[_0x89df('0x18')](_0x372ae4);return _0x1a5d6e[_0x89df('0x1e')]('Content-Range',_0x5d1d6a+'-'+_0x58df79+'/'+_0x59e77a)[_0x89df('0x19')](_0x5e646c);}return null;};}function patchUpdates(_0x253cb7){return function(_0x3aa603){try{jsonpatch[_0x89df('0x1f')](_0x3aa603,_0x253cb7,!![]);}catch(_0x466569){return BPromise[_0x89df('0x20')](_0x466569);}return _0x3aa603[_0x89df('0x21')]();};}function saveUpdates(_0x15b2a6,_0xb11c33){return function(_0x194c49){if(_0x194c49){return _0x194c49[_0x89df('0x22')](_0x15b2a6)['then'](function(_0x516bf9){return _0x516bf9;});}return null;};}function removeEntity(_0x43406b,_0x25a950){return function(_0x23c28d){if(_0x23c28d){return _0x23c28d[_0x89df('0x23')]()[_0x89df('0x24')](function(){_0x43406b[_0x89df('0x18')](0xcc)[_0x89df('0x25')]();});}};}function handleEntityNotFound(_0x11139f,_0x125880){return function(_0x5b1a4f){if(!_0x5b1a4f){_0x11139f[_0x89df('0x26')](0x194);}return _0x5b1a4f;};}function handleError(_0x387754,_0x1ca898){_0x1ca898=_0x1ca898||0x1f4;return function(_0x41f335){logger[_0x89df('0x27')](_0x41f335[_0x89df('0x28')]);if(_0x41f335[_0x89df('0x29')]){delete _0x41f335[_0x89df('0x29')];}_0x387754['status'](_0x1ca898)[_0x89df('0x2a')](_0x41f335);};}exports[_0x89df('0x2b')]=function(_0x386caf,_0x20a044){var _0x1ba85a={},_0x4b86aa={},_0x52b44d={'count':0x0,'rows':[]};var _0x2f34b1=_[_0x89df('0x2c')](db[_0x89df('0x2d')][_0x89df('0x2e')],function(_0xd1d540){return{'name':_0xd1d540['fieldName'],'type':_0xd1d540[_0x89df('0x2f')][_0x89df('0x30')]};});_0x4b86aa[_0x89df('0x31')]=_['map'](_0x2f34b1,_0x89df('0x29'));_0x4b86aa['query']=_['keys'](_0x386caf['query']);_0x4b86aa['filters']=_[_0x89df('0x32')](_0x4b86aa[_0x89df('0x31')],_0x4b86aa[_0x89df('0x33')]);_0x1ba85a['attributes']=_['intersection'](_0x4b86aa[_0x89df('0x31')],qs['fields'](_0x386caf['query'][_0x89df('0x34')]));_0x1ba85a['attributes']=_0x1ba85a[_0x89df('0x35')][_0x89df('0x36')]?_0x1ba85a[_0x89df('0x35')]:_0x4b86aa[_0x89df('0x31')];if(!_0x386caf['query'][_0x89df('0x37')]('nolimit')){_0x1ba85a['limit']=qs['limit'](_0x386caf[_0x89df('0x33')][_0x89df('0x1b')]);_0x1ba85a[_0x89df('0x1a')]=qs['offset'](_0x386caf[_0x89df('0x33')][_0x89df('0x1a')]);}_0x1ba85a[_0x89df('0x38')]=qs['sort'](_0x386caf[_0x89df('0x33')][_0x89df('0x39')]);_0x1ba85a[_0x89df('0x3a')]=qs[_0x89df('0x3b')](_[_0x89df('0x3c')](_0x386caf[_0x89df('0x33')],_0x4b86aa['filters']),_0x2f34b1);if(_0x386caf[_0x89df('0x33')]['filter']){_0x1ba85a[_0x89df('0x3a')]=_[_0x89df('0x3d')](_0x1ba85a[_0x89df('0x3a')],{'$or':_[_0x89df('0x2c')](_0x2f34b1,function(_0x2c1df5){if(_0x2c1df5[_0x89df('0x2f')]!=='VIRTUAL'){var _0x185e16={};_0x185e16[_0x2c1df5[_0x89df('0x29')]]={'$like':'%'+_0x386caf[_0x89df('0x33')][_0x89df('0x3e')]+'%'};return _0x185e16;}})});}_0x1ba85a=_['merge']({},_0x1ba85a,_0x386caf['options']);var _0x35061d={'where':_0x1ba85a[_0x89df('0x3a')]};return db[_0x89df('0x2d')][_0x89df('0x1d')](_0x35061d)[_0x89df('0x24')](function(_0x10523b){_0x52b44d[_0x89df('0x1d')]=_0x10523b;if(_0x386caf[_0x89df('0x33')][_0x89df('0x3f')]){_0x1ba85a[_0x89df('0x40')]=[{'all':!![]}];}return db[_0x89df('0x2d')][_0x89df('0x41')](_0x1ba85a);})['then'](function(_0x5e21da){_0x52b44d[_0x89df('0x42')]=_0x5e21da;return _0x52b44d;})[_0x89df('0x24')](respondWithFilteredResult(_0x20a044,_0x1ba85a))[_0x89df('0x43')](handleError(_0x20a044,null));};exports['show']=function(_0x523bf4,_0x479705){var _0x3a7f6b={'raw':!![],'where':{'id':_0x523bf4[_0x89df('0x44')]['id']}},_0x1a8736={};_0x1a8736[_0x89df('0x31')]=_['keys'](db[_0x89df('0x2d')][_0x89df('0x2e')]);_0x1a8736[_0x89df('0x33')]=_[_0x89df('0x45')](_0x523bf4[_0x89df('0x33')]);_0x1a8736['filters']=_[_0x89df('0x32')](_0x1a8736['model'],_0x1a8736['query']);_0x3a7f6b[_0x89df('0x35')]=_[_0x89df('0x32')](_0x1a8736[_0x89df('0x31')],qs[_0x89df('0x34')](_0x523bf4[_0x89df('0x33')][_0x89df('0x34')]));_0x3a7f6b[_0x89df('0x35')]=_0x3a7f6b['attributes'][_0x89df('0x36')]?_0x3a7f6b[_0x89df('0x35')]:_0x1a8736[_0x89df('0x31')];if(_0x523bf4[_0x89df('0x33')][_0x89df('0x3f')]){_0x3a7f6b[_0x89df('0x40')]=[{'all':!![]}];}_0x3a7f6b=_[_0x89df('0x3d')]({},_0x3a7f6b,_0x523bf4[_0x89df('0x46')]);return db[_0x89df('0x2d')][_0x89df('0x47')](_0x3a7f6b)[_0x89df('0x24')](handleEntityNotFound(_0x479705,null))[_0x89df('0x24')](respondWithResult(_0x479705,null))['catch'](handleError(_0x479705,null));};exports[_0x89df('0x48')]=function(_0x467370,_0x2988e5){return db[_0x89df('0x2d')]['create'](_0x467370[_0x89df('0x49')],{})[_0x89df('0x24')](respondWithResult(_0x2988e5,0xc9))[_0x89df('0x43')](handleError(_0x2988e5,null));};exports[_0x89df('0x22')]=function(_0x1cc36b,_0x5b3d01){if(_0x1cc36b['body']['id']){delete _0x1cc36b[_0x89df('0x49')]['id'];}return db[_0x89df('0x2d')]['find']({'where':{'id':_0x1cc36b[_0x89df('0x44')]['id']}})[_0x89df('0x24')](handleEntityNotFound(_0x5b3d01,null))[_0x89df('0x24')](saveUpdates(_0x1cc36b[_0x89df('0x49')],null))[_0x89df('0x24')](respondWithResult(_0x5b3d01,null))[_0x89df('0x43')](handleError(_0x5b3d01,null));};exports[_0x89df('0x23')]=function(_0xc35fc6,_0x4ce570){return db['JscriptySessionReport']['find']({'where':{'id':_0xc35fc6[_0x89df('0x44')]['id']}})[_0x89df('0x24')](handleEntityNotFound(_0x4ce570,null))[_0x89df('0x24')](removeEntity(_0x4ce570,null))[_0x89df('0x43')](handleError(_0x4ce570,null));};exports[_0x89df('0x4a')]=function(_0x379bac,_0x25741a){return db[_0x89df('0x2d')][_0x89df('0x4a')]()['then'](respondWithResult(_0x25741a,null))[_0x89df('0x43')](handleError(_0x25741a,null));};exports[_0x89df('0x4b')]=function(_0x14fe08,_0x1d4870,_0x1f6fff){var _0x4f5b80={'raw':!![],'where':{}};var _0x3dd3d3={};var _0x29433d={'count':0x0,'rows':[]};return db[_0x89df('0x2d')][_0x89df('0x4c')]({'where':{'id':_0x14fe08[_0x89df('0x44')]['id']}})['then'](handleEntityNotFound(_0x1d4870,null))[_0x89df('0x24')](function(_0x53ea21){if(_0x53ea21){_0x3dd3d3[_0x89df('0x31')]=_[_0x89df('0x45')](db['JscriptyQuestionReport']['rawAttributes']);_0x3dd3d3[_0x89df('0x33')]=_[_0x89df('0x45')](_0x14fe08['query']);_0x3dd3d3[_0x89df('0x3b')]=_[_0x89df('0x32')](_0x3dd3d3[_0x89df('0x31')],_0x3dd3d3[_0x89df('0x33')]);_0x4f5b80[_0x89df('0x35')]=_['intersection'](_0x3dd3d3[_0x89df('0x31')],qs['fields'](_0x14fe08[_0x89df('0x33')][_0x89df('0x34')]));_0x4f5b80[_0x89df('0x35')]=_0x4f5b80[_0x89df('0x35')]['length']?_0x4f5b80[_0x89df('0x35')]:_0x3dd3d3['model'];if(!_0x14fe08['query'][_0x89df('0x37')](_0x89df('0x4d'))){_0x4f5b80[_0x89df('0x1b')]=qs[_0x89df('0x1b')](_0x14fe08[_0x89df('0x33')]['limit']);_0x4f5b80[_0x89df('0x1a')]=qs[_0x89df('0x1a')](_0x14fe08[_0x89df('0x33')][_0x89df('0x1a')]);}_0x4f5b80['order']=qs['sort'](_0x14fe08[_0x89df('0x33')][_0x89df('0x39')]);_0x4f5b80[_0x89df('0x3a')]=qs[_0x89df('0x3b')](_[_0x89df('0x3c')](_0x14fe08[_0x89df('0x33')],_0x3dd3d3['filters']));_0x4f5b80['where'][_0x89df('0x4e')]=_0x53ea21['id'];if(_0x14fe08['query'][_0x89df('0x3e')]){_0x4f5b80[_0x89df('0x3a')]=_[_0x89df('0x3d')](_0x4f5b80[_0x89df('0x3a')],{'$or':_[_0x89df('0x2c')](_0x4f5b80[_0x89df('0x35')],function(_0x38963a){var _0x29f704={};_0x29f704[_0x38963a]={'$like':'%'+_0x14fe08['query'][_0x89df('0x3e')]+'%'};return _0x29f704;})});}_0x4f5b80=_[_0x89df('0x3d')]({},_0x4f5b80,_0x14fe08[_0x89df('0x46')]);return db[_0x89df('0x4f')]['count']({'where':_0x4f5b80[_0x89df('0x3a')]})[_0x89df('0x24')](function(_0x34b350){_0x29433d['count']=_0x34b350;if(_0x14fe08[_0x89df('0x33')]['includeAll']){_0x4f5b80[_0x89df('0x40')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x89df('0x41')](_0x4f5b80);})[_0x89df('0x24')](function(_0x146736){_0x29433d[_0x89df('0x42')]=_0x146736;return _0x29433d;});}})[_0x89df('0x24')](respondWithFilteredResult(_0x1d4870,_0x4f5b80))['catch'](handleError(_0x1d4870,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 35777ba..b8933b5 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 _0x5d17=['lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions'];(function(_0x45c08e,_0x522740){var _0xc85dbd=function(_0xb614bd){while(--_0xb614bd){_0x45c08e['push'](_0x45c08e['shift']());}};_0xc85dbd(++_0x522740);}(_0x5d17,0x114));var _0x75d1=function(_0x818500,_0xe7620c){_0x818500=_0x818500-0x0;var _0x342023=_0x5d17[_0x818500];return _0x342023;};'use strict';var _=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x75d1('0x2'));var BPromise=require(_0x75d1('0x3'));var rp=require(_0x75d1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x75d1('0x5'));var config=require(_0x75d1('0x6'));var attributes=require(_0x75d1('0x7'));module[_0x75d1('0x8')]=function(_0x56ac0a,_0x458681){return _0x56ac0a[_0x75d1('0x9')](_0x75d1('0xa'),attributes,{'tableName':_0x75d1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c60=['define','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','api','bluebird','./jscriptySessionReport.attributes','exports'];(function(_0xaa93c3,_0x831515){var _0x3ef263=function(_0x38702c){while(--_0x38702c){_0xaa93c3['push'](_0xaa93c3['shift']());}};_0x3ef263(++_0x831515);}(_0x4c60,0xc1));var _0x04c6=function(_0x66d089,_0x454d29){_0x66d089=_0x66d089-0x0;var _0x38caec=_0x4c60[_0x66d089];return _0x38caec;};'use strict';var _=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var logger=require(_0x04c6('0x2'))(_0x04c6('0x3'));var moment=require('moment');var BPromise=require(_0x04c6('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(_0x04c6('0x5'));module[_0x04c6('0x6')]=function(_0x2054da,_0x12bd5d){return _0x2054da[_0x04c6('0x7')](_0x04c6('0x8'),attributes,{'tableName':_0x04c6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index c11122a..23f043c 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 _0xe3da=['stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s'];(function(_0x148a81,_0x144e37){var _0x3d72dc=function(_0x1d5573){while(--_0x1d5573){_0x148a81['push'](_0x148a81['shift']());}};_0x3d72dc(++_0x144e37);}(_0xe3da,0x1cd));var _0xae3d=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe3da[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var moment=require(_0xae3d('0x2'));var BPromise=require(_0xae3d('0x3'));var rs=require(_0xae3d('0x4'));var fs=require('fs');var Redis=require(_0xae3d('0x5'));var db=require(_0xae3d('0x6'))['db'];var utils=require(_0xae3d('0x7'));var logger=require(_0xae3d('0x8'))(_0xae3d('0x9'));var config=require(_0xae3d('0xa'));var jayson=require(_0xae3d('0xb'));var client=jayson[_0xae3d('0xc')][_0xae3d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x476579,_0x33c089,_0x583b98){return new BPromise(function(_0x2a5c45,_0x3d6650){return client['request'](_0x476579,_0x583b98)['then'](function(_0x459592){logger[_0xae3d('0xe')](_0xae3d('0xf'),_0x33c089,_0xae3d('0x10'));logger[_0xae3d('0x11')](_0xae3d('0x12'),_0x33c089,'request\x20sent',JSON[_0xae3d('0x13')](_0x459592));if(_0x459592['error']){if(_0x459592[_0xae3d('0x14')][_0xae3d('0x15')]===0x1f4){logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0x459592['error'][_0xae3d('0x16')]);return _0x3d6650(_0x459592[_0xae3d('0x14')][_0xae3d('0x16')]);}logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0x459592[_0xae3d('0x14')][_0xae3d('0x16')]);return _0x2a5c45(_0x459592['error'][_0xae3d('0x16')]);}else{logger[_0xae3d('0xe')](_0xae3d('0xf'),_0x33c089,_0xae3d('0x10'));_0x2a5c45(_0x459592[_0xae3d('0x17')][_0xae3d('0x16')]);}})['catch'](function(_0xe925fd){logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0xe925fd);_0x3d6650(_0xe925fd);});});} \ No newline at end of file +var _0x8aad=['stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','rpc','client','http','request','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s'];(function(_0x10350e,_0x3b15c8){var _0x234946=function(_0x3d15a9){while(--_0x3d15a9){_0x10350e['push'](_0x10350e['shift']());}};_0x234946(++_0x3b15c8);}(_0x8aad,0x146));var _0xd8aa=function(_0x824451,_0x488ad0){_0x824451=_0x824451-0x0;var _0xdd7625=_0x8aad[_0x824451];return _0xdd7625;};'use strict';var _=require(_0xd8aa('0x0'));var util=require(_0xd8aa('0x1'));var moment=require('moment');var BPromise=require(_0xd8aa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd8aa('0x3'));var db=require(_0xd8aa('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd8aa('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd8aa('0x6')][_0xd8aa('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x16ea12,_0x4a4b10,_0x2a559d){return new BPromise(function(_0x1da411,_0x2a23b5){return client[_0xd8aa('0x8')](_0x16ea12,_0x2a559d)['then'](function(_0x5de228){logger[_0xd8aa('0x9')](_0xd8aa('0xa'),_0x4a4b10,_0xd8aa('0xb'));logger[_0xd8aa('0xc')](_0xd8aa('0xd'),_0x4a4b10,'request\x20sent',JSON[_0xd8aa('0xe')](_0x5de228));if(_0x5de228[_0xd8aa('0xf')]){if(_0x5de228[_0xd8aa('0xf')][_0xd8aa('0x10')]===0x1f4){logger[_0xd8aa('0xf')](_0xd8aa('0xa'),_0x4a4b10,_0x5de228[_0xd8aa('0xf')][_0xd8aa('0x11')]);return _0x2a23b5(_0x5de228[_0xd8aa('0xf')][_0xd8aa('0x11')]);}logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x4a4b10,_0x5de228[_0xd8aa('0xf')][_0xd8aa('0x11')]);return _0x1da411(_0x5de228[_0xd8aa('0xf')]['message']);}else{logger[_0xd8aa('0x9')](_0xd8aa('0xa'),_0x4a4b10,_0xd8aa('0xb'));_0x1da411(_0x5de228[_0xd8aa('0x12')]['message']);}})[_0xd8aa('0x13')](function(_0xa9ba1b){logger['error'](_0xd8aa('0xa'),_0x4a4b10,_0xa9ba1b);_0x2a23b5(_0xa9ba1b);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index c6b158e..84063e7 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 _0x660d=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','put','/:id','isAuthenticated','update','multer','util','path','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x660d,0xaf));var _0xd660=function(_0x35181c,_0x82694a){_0x35181c=_0x35181c-0x0;var _0xe14bf9=_0x660d[_0x35181c];return _0xe14bf9;};'use strict';var multer=require(_0xd660('0x0'));var util=require(_0xd660('0x1'));var path=require(_0xd660('0x2'));var timeout=require(_0xd660('0x3'));var express=require(_0xd660('0x4'));var router=express[_0xd660('0x5')]();var fs_extra=require(_0xd660('0x6'));var auth=require(_0xd660('0x7'));var interaction=require(_0xd660('0x8'));var config=require('../../config/environment');var controller=require('./license.controller');router[_0xd660('0x9')]('/',controller[_0xd660('0xa')]);router[_0xd660('0xb')](_0xd660('0xc'),auth[_0xd660('0xd')](),controller[_0xd660('0xe')]);router[_0xd660('0x9')]('/download_log_file',auth[_0xd660('0xd')](),controller['downloadLogFile']);module['exports']=router; \ No newline at end of file +var _0x6fd3=['/:id','update','/download_log_file','downloadLogFile','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','put'];(function(_0x57a4ba,_0x46f3c4){var _0x294cae=function(_0x11fa5a){while(--_0x11fa5a){_0x57a4ba['push'](_0x57a4ba['shift']());}};_0x294cae(++_0x46f3c4);}(_0x6fd3,0x104));var _0x36fd=function(_0x2e91cd,_0x40146a){_0x2e91cd=_0x2e91cd-0x0;var _0x2c6dbb=_0x6fd3[_0x2e91cd];return _0x2c6dbb;};'use strict';var multer=require(_0x36fd('0x0'));var util=require(_0x36fd('0x1'));var path=require(_0x36fd('0x2'));var timeout=require(_0x36fd('0x3'));var express=require(_0x36fd('0x4'));var router=express[_0x36fd('0x5')]();var fs_extra=require(_0x36fd('0x6'));var auth=require(_0x36fd('0x7'));var interaction=require(_0x36fd('0x8'));var config=require(_0x36fd('0x9'));var controller=require(_0x36fd('0xa'));router['get']('/',controller['index']);router[_0x36fd('0xb')](_0x36fd('0xc'),auth['isAuthenticated'](),controller[_0x36fd('0xd')]);router['get'](_0x36fd('0xe'),auth['isAuthenticated'](),controller[_0x36fd('0xf')]);module[_0x36fd('0x10')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index fddd914..f70c013 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 _0x76b4=['exports','TEXT','STRING','INTEGER','sequelize'];(function(_0xe5b349,_0x5f06e4){var _0x26b0ad=function(_0x1a97f1){while(--_0x1a97f1){_0xe5b349['push'](_0xe5b349['shift']());}};_0x26b0ad(++_0x5f06e4);}(_0x76b4,0x126));var _0x476b=function(_0x4a3378,_0x23bb06){_0x4a3378=_0x4a3378-0x0;var _0x359a26=_0x76b4[_0x4a3378];return _0x359a26;};'use strict';var Sequelize=require(_0x476b('0x0'));module[_0x476b('0x1')]={'license':{'type':Sequelize[_0x476b('0x2')]},'data1':{'type':Sequelize[_0x476b('0x3')]},'data2':{'type':Sequelize[_0x476b('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x476b('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xeb86=['exports','TEXT','STRING','sequelize'];(function(_0x3cf053,_0x7a9947){var _0x3b55a0=function(_0x2a99cc){while(--_0x2a99cc){_0x3cf053['push'](_0x3cf053['shift']());}};_0x3b55a0(++_0x7a9947);}(_0xeb86,0x173));var _0x6eb8=function(_0x153e7e,_0x50ab0f){_0x153e7e=_0x153e7e-0x0;var _0x5d3b20=_0xeb86[_0x153e7e];return _0x5d3b20;};'use strict';var Sequelize=require(_0x6eb8('0x0'));module[_0x6eb8('0x1')]={'license':{'type':Sequelize[_0x6eb8('0x2')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x6eb8('0x3')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 565da4d..96519bf 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 _0x8ea3=['fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','Content-Range','apply','reject','then','destroy','stack','name','send','index','model','keys','License','rawAttributes','query','intersection','fields','attributes','length','merge','getLicense','update','body','find','params','get','checkLicense','demo','catch','downloadLogFile','join','/var','xcally','attachment;\x20filename=','Content-Type','rimraf','zip-dir','mustache','util','path','to-csv','ejs'];(function(_0x46b5b6,_0x531dfd){var _0x2eed89=function(_0x4d7233){while(--_0x4d7233){_0x46b5b6['push'](_0x46b5b6['shift']());}};_0x2eed89(++_0x531dfd);}(_0x8ea3,0x12a));var _0x38ea=function(_0x33ff24,_0x587984){_0x33ff24=_0x33ff24-0x0;var _0x503f31=_0x8ea3[_0x33ff24];return _0x503f31;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x38ea('0x0'));var zipdir=require(_0x38ea('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x38ea('0x2'));var util=require(_0x38ea('0x3'));var path=require(_0x38ea('0x4'));var sox=require('sox');var csv=require(_0x38ea('0x5'));var ejs=require(_0x38ea('0x6'));var fs=require('fs');var fs_extra=require(_0x38ea('0x7'));var _=require('lodash');var squel=require(_0x38ea('0x8'));var crypto=require(_0x38ea('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x38ea('0xa'));var toCsv=require(_0x38ea('0x5'));var querystring=require(_0x38ea('0xb'));var Papa=require(_0x38ea('0xc'));var Redis=require(_0x38ea('0xd'));var authService=require(_0x38ea('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x38ea('0xf'));var hardwareService=require(_0x38ea('0x10'));var logger=require(_0x38ea('0x11'))(_0x38ea('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x38ea('0x13'))['db'];function respondWithStatusCode(_0x4c1c15,_0x2d8158){_0x2d8158=_0x2d8158||0xcc;return function(_0x41cd5d){if(_0x41cd5d){return _0x4c1c15[_0x38ea('0x14')](_0x2d8158);}return _0x4c1c15[_0x38ea('0x15')](_0x2d8158)[_0x38ea('0x16')]();};}function respondWithResult(_0x4ab115,_0x2fc35b){_0x2fc35b=_0x2fc35b||0xc8;return function(_0xcef40f){if(_0xcef40f){return _0x4ab115[_0x38ea('0x15')](_0x2fc35b)[_0x38ea('0x17')](_0xcef40f);}};}function respondWithFilteredResult(_0x23862c,_0x1761fe){return function(_0x49333c){if(_0x49333c){var _0x21f67f=typeof _0x1761fe['offset']===_0x38ea('0x18')&&typeof _0x1761fe['limit']===_0x38ea('0x18');var _0x40c992=_0x49333c[_0x38ea('0x19')];var _0x42b4d0=_0x21f67f?0x0:_0x1761fe[_0x38ea('0x1a')];var _0x3e3108=_0x21f67f?_0x49333c[_0x38ea('0x19')]:_0x1761fe[_0x38ea('0x1a')]+_0x1761fe['limit'];var _0x3d738b;if(_0x3e3108>=_0x40c992){_0x3e3108=_0x40c992;_0x3d738b=0xc8;}else{_0x3d738b=0xce;}_0x23862c['status'](_0x3d738b);return _0x23862c['set'](_0x38ea('0x1b'),_0x42b4d0+'-'+_0x3e3108+'/'+_0x40c992)[_0x38ea('0x17')](_0x49333c);}return null;};}function patchUpdates(_0x22ea7d){return function(_0x426ae4){try{jsonpatch[_0x38ea('0x1c')](_0x426ae4,_0x22ea7d,!![]);}catch(_0x5ba4fb){return BPromise[_0x38ea('0x1d')](_0x5ba4fb);}return _0x426ae4['save']();};}function saveUpdates(_0x1ed242,_0x5f0ad0){return function(_0x27ae7a){if(_0x27ae7a){return _0x27ae7a['update'](_0x1ed242)[_0x38ea('0x1e')](function(_0x1d33c7){return _0x1d33c7;});}return null;};}function removeEntity(_0x527e8f,_0x4829ee){return function(_0x25316f){if(_0x25316f){return _0x25316f[_0x38ea('0x1f')]()['then'](function(){_0x527e8f[_0x38ea('0x15')](0xcc)[_0x38ea('0x16')]();});}};}function handleEntityNotFound(_0x2e03d4,_0x5505ba){return function(_0xad8886){if(!_0xad8886){_0x2e03d4[_0x38ea('0x14')](0x194);}return _0xad8886;};}function handleError(_0x200e9b,_0x19b517){_0x19b517=_0x19b517||0x1f4;return function(_0xd9ef76){logger['error'](_0xd9ef76[_0x38ea('0x20')]);if(_0xd9ef76['name']){delete _0xd9ef76[_0x38ea('0x21')];}_0x200e9b[_0x38ea('0x15')](_0x19b517)[_0x38ea('0x22')](_0xd9ef76);};}var utilLicense=require('../../config/license/util');exports[_0x38ea('0x23')]=function(_0xa3d62,_0x47139e){var _0x17c2f4={'raw':!![],'where':{'id':0x1}},_0x302f24={};_0x302f24[_0x38ea('0x24')]=_[_0x38ea('0x25')](db[_0x38ea('0x26')][_0x38ea('0x27')]);_0x302f24[_0x38ea('0x28')]=_[_0x38ea('0x25')](_0xa3d62['query']);_0x302f24['filters']=_[_0x38ea('0x29')](_0x302f24['model'],_0x302f24[_0x38ea('0x28')]);_0x17c2f4['attributes']=_[_0x38ea('0x29')](_0x302f24[_0x38ea('0x24')],qs['fields'](_0xa3d62[_0x38ea('0x28')][_0x38ea('0x2a')]));_0x17c2f4[_0x38ea('0x2b')]=_0x17c2f4[_0x38ea('0x2b')][_0x38ea('0x2c')]?_0x17c2f4['attributes']:_0x302f24['model'];_0x17c2f4=_[_0x38ea('0x2d')]({},_0x17c2f4,_0xa3d62['options']);return utilLicense[_0x38ea('0x2e')](_0x17c2f4)['then'](respondWithResult(_0x47139e,null))['catch'](handleError(_0x47139e,null));};exports[_0x38ea('0x2f')]=function(_0x5cc162,_0x244c06){if(_0x5cc162[_0x38ea('0x30')]['id']){delete _0x5cc162[_0x38ea('0x30')]['id'];}return db['License'][_0x38ea('0x31')]({'where':{'id':_0x5cc162[_0x38ea('0x32')]['id']}})[_0x38ea('0x1e')](handleEntityNotFound(_0x244c06,null))[_0x38ea('0x1e')](function(_0x3bb283){var _0x20010c=_0x3bb283[_0x38ea('0x33')]({'plain':!![]});return utilLicense[_0x38ea('0x34')](_0x20010c,_0x5cc162[_0x38ea('0x30')]['key']);})['then'](function(_0x331f1c){if(!_0x331f1c[_0x38ea('0x35')]){return saveUpdates(_0x5cc162[_0x38ea('0x30')],null);}return _0x331f1c;})[_0x38ea('0x1e')](respondWithResult(_0x244c06,null))[_0x38ea('0x36')](handleError(_0x244c06,null));};exports[_0x38ea('0x37')]=function(_0x344c51,_0x1d7649){var _0x345186='license-info.log';var _0x2e7580=path[_0x38ea('0x38')](_0x38ea('0x39'),'log',_0x38ea('0x3a'),_0x345186);_0x1d7649['setHeader']('Content-disposition',_0x38ea('0x3b')+_0x345186);_0x1d7649['set'](_0x38ea('0x3c'),'text/plain');_0x1d7649['download'](_0x2e7580);}; \ No newline at end of file +var _0x845a=['join','/var','log','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','stack','name','send','index','keys','License','rawAttributes','query','filters','intersection','model','fields','attributes','merge','options','catch','body','get','demo','downloadLogFile','license-info.log'];(function(_0x4dc5de,_0x2ae308){var _0x30a07f=function(_0x32a54f){while(--_0x32a54f){_0x4dc5de['push'](_0x4dc5de['shift']());}};_0x30a07f(++_0x2ae308);}(_0x845a,0x115));var _0xa845=function(_0x4d93f4,_0x542242){_0x4d93f4=_0x4d93f4-0x0;var _0x48545d=_0x845a[_0x4d93f4];return _0x48545d;};'use strict';var emlformat=require(_0xa845('0x0'));var rimraf=require(_0xa845('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa845('0x2'));var rp=require('request-promise');var moment=require(_0xa845('0x3'));var BPromise=require(_0xa845('0x4'));var Mustache=require(_0xa845('0x5'));var util=require('util');var path=require(_0xa845('0x6'));var sox=require(_0xa845('0x7'));var csv=require(_0xa845('0x8'));var ejs=require(_0xa845('0x9'));var fs=require('fs');var fs_extra=require(_0xa845('0xa'));var _=require(_0xa845('0xb'));var squel=require(_0xa845('0xc'));var crypto=require(_0xa845('0xd'));var jsforce=require(_0xa845('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa845('0x8'));var querystring=require('querystring');var Papa=require(_0xa845('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa845('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa845('0x11'));var logger=require(_0xa845('0x12'))('api');var utils=require(_0xa845('0x13'));var config=require(_0xa845('0x14'));var licenseUtil=require(_0xa845('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59946c,_0x3dd3d4){_0x3dd3d4=_0x3dd3d4||0xcc;return function(_0x3bd051){if(_0x3bd051){return _0x59946c[_0xa845('0x16')](_0x3dd3d4);}return _0x59946c[_0xa845('0x17')](_0x3dd3d4)[_0xa845('0x18')]();};}function respondWithResult(_0x56ad02,_0x25a2cd){_0x25a2cd=_0x25a2cd||0xc8;return function(_0x232c16){if(_0x232c16){return _0x56ad02[_0xa845('0x17')](_0x25a2cd)['json'](_0x232c16);}};}function respondWithFilteredResult(_0x4fa8b0,_0x20e7d4){return function(_0x3ef403){if(_0x3ef403){var _0x4e31c4=typeof _0x20e7d4[_0xa845('0x19')]===_0xa845('0x1a')&&typeof _0x20e7d4[_0xa845('0x1b')]==='undefined';var _0x4a4a1f=_0x3ef403[_0xa845('0x1c')];var _0xb611f5=_0x4e31c4?0x0:_0x20e7d4['offset'];var _0x28b6b5=_0x4e31c4?_0x3ef403['count']:_0x20e7d4[_0xa845('0x19')]+_0x20e7d4[_0xa845('0x1b')];var _0x4ca180;if(_0x28b6b5>=_0x4a4a1f){_0x28b6b5=_0x4a4a1f;_0x4ca180=0xc8;}else{_0x4ca180=0xce;}_0x4fa8b0[_0xa845('0x17')](_0x4ca180);return _0x4fa8b0[_0xa845('0x1d')](_0xa845('0x1e'),_0xb611f5+'-'+_0x28b6b5+'/'+_0x4a4a1f)[_0xa845('0x1f')](_0x3ef403);}return null;};}function patchUpdates(_0x1e48df){return function(_0x359cba){try{jsonpatch['apply'](_0x359cba,_0x1e48df,!![]);}catch(_0x171c85){return BPromise[_0xa845('0x20')](_0x171c85);}return _0x359cba[_0xa845('0x21')]();};}function saveUpdates(_0x13f90c,_0x4ce832){return function(_0x5c5c62){if(_0x5c5c62){return _0x5c5c62[_0xa845('0x22')](_0x13f90c)[_0xa845('0x23')](function(_0x466336){return _0x466336;});}return null;};}function removeEntity(_0x2ec7c7,_0x4d036f){return function(_0x2de845){if(_0x2de845){return _0x2de845[_0xa845('0x24')]()['then'](function(){_0x2ec7c7['status'](0xcc)[_0xa845('0x18')]();});}};}function handleEntityNotFound(_0xe884df,_0x4fb865){return function(_0x3f518a){if(!_0x3f518a){_0xe884df[_0xa845('0x16')](0x194);}return _0x3f518a;};}function handleError(_0x126559,_0x2e28a9){_0x2e28a9=_0x2e28a9||0x1f4;return function(_0x24f3ab){logger['error'](_0x24f3ab[_0xa845('0x25')]);if(_0x24f3ab[_0xa845('0x26')]){delete _0x24f3ab['name'];}_0x126559[_0xa845('0x17')](_0x2e28a9)[_0xa845('0x27')](_0x24f3ab);};}var utilLicense=require('../../config/license/util');exports[_0xa845('0x28')]=function(_0x3b1d60,_0x3ded04){var _0x4f783f={'raw':!![],'where':{'id':0x1}},_0x5dab1b={};_0x5dab1b['model']=_[_0xa845('0x29')](db[_0xa845('0x2a')][_0xa845('0x2b')]);_0x5dab1b[_0xa845('0x2c')]=_[_0xa845('0x29')](_0x3b1d60[_0xa845('0x2c')]);_0x5dab1b[_0xa845('0x2d')]=_[_0xa845('0x2e')](_0x5dab1b[_0xa845('0x2f')],_0x5dab1b[_0xa845('0x2c')]);_0x4f783f['attributes']=_[_0xa845('0x2e')](_0x5dab1b[_0xa845('0x2f')],qs[_0xa845('0x30')](_0x3b1d60['query'][_0xa845('0x30')]));_0x4f783f[_0xa845('0x31')]=_0x4f783f['attributes']['length']?_0x4f783f['attributes']:_0x5dab1b[_0xa845('0x2f')];_0x4f783f=_[_0xa845('0x32')]({},_0x4f783f,_0x3b1d60[_0xa845('0x33')]);return utilLicense['getLicense'](_0x4f783f)['then'](respondWithResult(_0x3ded04,null))[_0xa845('0x34')](handleError(_0x3ded04,null));};exports[_0xa845('0x22')]=function(_0x180e41,_0x411aa3){if(_0x180e41[_0xa845('0x35')]['id']){delete _0x180e41[_0xa845('0x35')]['id'];}return db['License']['find']({'where':{'id':_0x180e41['params']['id']}})[_0xa845('0x23')](handleEntityNotFound(_0x411aa3,null))['then'](function(_0x33d8d6){var _0x25793a=_0x33d8d6[_0xa845('0x36')]({'plain':!![]});return utilLicense['checkLicense'](_0x25793a,_0x180e41[_0xa845('0x35')]['key']);})[_0xa845('0x23')](function(_0x3f29cd){if(!_0x3f29cd[_0xa845('0x37')]){return saveUpdates(_0x180e41[_0xa845('0x35')],null);}return _0x3f29cd;})[_0xa845('0x23')](respondWithResult(_0x411aa3,null))[_0xa845('0x34')](handleError(_0x411aa3,null));};exports[_0xa845('0x38')]=function(_0x573db5,_0xd7af04){var _0x2f1591=_0xa845('0x39');var _0x2cd4f7=path[_0xa845('0x3a')](_0xa845('0x3b'),_0xa845('0x3c'),'xcally',_0x2f1591);_0xd7af04[_0xa845('0x3d')](_0xa845('0x3e'),_0xa845('0x3f')+_0x2f1591);_0xd7af04[_0xa845('0x1d')](_0xa845('0x40'),_0xa845('0x41'));_0xd7af04[_0xa845('0x42')](_0x2cd4f7);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index b2296cb..46a600e 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 _0xb929=['api','moment','request-promise','path','rimraf','exports','define','License','license','lodash','util','../../config/logger'];(function(_0x40a708,_0x539153){var _0x1edd46=function(_0x4fcc79){while(--_0x4fcc79){_0x40a708['push'](_0x40a708['shift']());}};_0x1edd46(++_0x539153);}(_0xb929,0xbd));var _0x9b92=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb929[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x9b92('0x0'));var util=require(_0x9b92('0x1'));var logger=require(_0x9b92('0x2'))(_0x9b92('0x3'));var moment=require(_0x9b92('0x4'));var BPromise=require('bluebird');var rp=require(_0x9b92('0x5'));var fs=require('fs');var path=require(_0x9b92('0x6'));var rimraf=require(_0x9b92('0x7'));var config=require('../../config/environment');var attributes=require('./license.attributes');module[_0x9b92('0x8')]=function(_0x48dc16,_0x542799){return _0x48dc16[_0x9b92('0x9')](_0x9b92('0xa'),attributes,{'tableName':_0x9b92('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x81a0=['request-promise','rimraf','../../config/environment','./license.attributes','exports','define','License','license','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x497ea9,_0x52c36b){var _0x3564ad=function(_0x12a41d){while(--_0x12a41d){_0x497ea9['push'](_0x497ea9['shift']());}};_0x3564ad(++_0x52c36b);}(_0x81a0,0x104));var _0x081a=function(_0x40f0c2,_0x2cece7){_0x40f0c2=_0x40f0c2-0x0;var _0x480e92=_0x81a0[_0x40f0c2];return _0x480e92;};'use strict';var _=require(_0x081a('0x0'));var util=require(_0x081a('0x1'));var logger=require(_0x081a('0x2'))(_0x081a('0x3'));var moment=require(_0x081a('0x4'));var BPromise=require(_0x081a('0x5'));var rp=require(_0x081a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x081a('0x7'));var config=require(_0x081a('0x8'));var attributes=require(_0x081a('0x9'));module[_0x081a('0xa')]=function(_0x121c43,_0x9273b2){return _0x121c43[_0x081a('0xb')](_0x081a('0xc'),attributes,{'tableName':_0x081a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index a9a944a..071dbc8 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 _0x3e55=['License,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0xb52a30,_0x9b4336){var _0x160875=function(_0xd23d7a){while(--_0xd23d7a){_0xb52a30['push'](_0xb52a30['shift']());}};_0x160875(++_0x9b4336);}(_0x3e55,0xdb));var _0x53e5=function(_0x224ad9,_0x5d97a7){_0x224ad9=_0x224ad9-0x0;var _0x532997=_0x3e55[_0x224ad9];return _0x532997;};'use strict';var _=require('lodash');var util=require(_0x53e5('0x0'));var moment=require(_0x53e5('0x1'));var BPromise=require(_0x53e5('0x2'));var rs=require(_0x53e5('0x3'));var fs=require('fs');var Redis=require(_0x53e5('0x4'));var db=require(_0x53e5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x53e5('0x6'))(_0x53e5('0x7'));var config=require(_0x53e5('0x8'));var jayson=require(_0x53e5('0x9'));var client=jayson[_0x53e5('0xa')][_0x53e5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4384df,_0x41006b,_0x4eadf3){return new BPromise(function(_0x5c9d96,_0x29ea4e){return client[_0x53e5('0xc')](_0x4384df,_0x4eadf3)[_0x53e5('0xd')](function(_0x505c92){logger[_0x53e5('0xe')]('License,\x20%s,\x20%s',_0x41006b,_0x53e5('0xf'));logger[_0x53e5('0x10')](_0x53e5('0x11'),_0x41006b,_0x53e5('0xf'),JSON[_0x53e5('0x12')](_0x505c92));if(_0x505c92['error']){if(_0x505c92['error'][_0x53e5('0x13')]===0x1f4){logger[_0x53e5('0x14')](_0x53e5('0x15'),_0x41006b,_0x505c92[_0x53e5('0x14')][_0x53e5('0x16')]);return _0x29ea4e(_0x505c92[_0x53e5('0x14')][_0x53e5('0x16')]);}logger[_0x53e5('0x14')](_0x53e5('0x15'),_0x41006b,_0x505c92[_0x53e5('0x14')][_0x53e5('0x16')]);return _0x5c9d96(_0x505c92['error']['message']);}else{logger['info']('License,\x20%s,\x20%s',_0x41006b,_0x53e5('0xf'));_0x5c9d96(_0x505c92['result'][_0x53e5('0x16')]);}})[_0x53e5('0x17')](function(_0x39a096){logger[_0x53e5('0x14')](_0x53e5('0x15'),_0x41006b,_0x39a096);_0x29ea4e(_0x39a096);});});} \ No newline at end of file +var _0x409b=['../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error','code','message','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x2cb91f,_0x406af5){var _0x51c7e3=function(_0x5d2c67){while(--_0x5d2c67){_0x2cb91f['push'](_0x2cb91f['shift']());}};_0x51c7e3(++_0x406af5);}(_0x409b,0x19e));var _0xb409=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x409b[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require(_0xb409('0x0'));var moment=require(_0xb409('0x1'));var BPromise=require(_0xb409('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb409('0x3'));var db=require(_0xb409('0x4'))['db'];var utils=require(_0xb409('0x5'));var logger=require(_0xb409('0x6'))(_0xb409('0x7'));var config=require(_0xb409('0x8'));var jayson=require(_0xb409('0x9'));var client=jayson['client'][_0xb409('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x752435,_0x8a6bb1,_0xd5b7bb){return new BPromise(function(_0xc59931,_0xd065c7){return client['request'](_0x752435,_0xd5b7bb)[_0xb409('0xb')](function(_0x1d4f85){logger[_0xb409('0xc')](_0xb409('0xd'),_0x8a6bb1,_0xb409('0xe'));logger[_0xb409('0xf')](_0xb409('0x10'),_0x8a6bb1,_0xb409('0xe'),JSON['stringify'](_0x1d4f85));if(_0x1d4f85[_0xb409('0x11')]){if(_0x1d4f85[_0xb409('0x11')][_0xb409('0x12')]===0x1f4){logger[_0xb409('0x11')](_0xb409('0xd'),_0x8a6bb1,_0x1d4f85[_0xb409('0x11')][_0xb409('0x13')]);return _0xd065c7(_0x1d4f85[_0xb409('0x11')][_0xb409('0x13')]);}logger['error'](_0xb409('0xd'),_0x8a6bb1,_0x1d4f85[_0xb409('0x11')][_0xb409('0x13')]);return _0xc59931(_0x1d4f85[_0xb409('0x11')][_0xb409('0x13')]);}else{logger[_0xb409('0xc')](_0xb409('0xd'),_0x8a6bb1,_0xb409('0xe'));_0xc59931(_0x1d4f85['result'][_0xb409('0x13')]);}})['catch'](function(_0x45e5d3){logger['error'](_0xb409('0xd'),_0x8a6bb1,_0x45e5d3);_0xd065c7(_0x45e5d3);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 9b2430e..65457ff 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 _0x4351=['update','delete','removeDispositions','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/applications','getApplications','/:id/messages','getMessages','verifySmtp','/:id/users','post','/:id/dispositions','addDisposition','addAnswer','create','addImap','addSmtp','/:id/interactions','addInteraction','addApplications','send','addAgents'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4351,0x95));var _0x1435=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x4351[_0x1d9aa0];return _0x226868;};'use strict';var multer=require(_0x1435('0x0'));var util=require(_0x1435('0x1'));var path=require('path');var timeout=require(_0x1435('0x2'));var express=require(_0x1435('0x3'));var router=express[_0x1435('0x4')]();var fs_extra=require(_0x1435('0x5'));var auth=require(_0x1435('0x6'));var interaction=require(_0x1435('0x7'));var config=require('../../config/environment');var controller=require('./mailAccount.controller');router[_0x1435('0x8')]('/',auth[_0x1435('0x9')](),controller[_0x1435('0xa')]);router[_0x1435('0x8')]('/describe',auth[_0x1435('0x9')](),controller[_0x1435('0xb')]);router[_0x1435('0x8')](_0x1435('0xc'),auth[_0x1435('0x9')](),controller[_0x1435('0xd')]);router['get']('/:id/dispositions',auth[_0x1435('0x9')](),controller[_0x1435('0xe')]);router[_0x1435('0x8')](_0x1435('0xf'),auth[_0x1435('0x9')](),controller[_0x1435('0x10')]);router['get'](_0x1435('0x11'),auth['isAuthenticated'](),controller[_0x1435('0x12')]);router[_0x1435('0x8')](_0x1435('0x13'),auth[_0x1435('0x9')](),controller[_0x1435('0x14')]);router[_0x1435('0x8')]('/:id/interactions',auth[_0x1435('0x9')](),controller['getInteractions']);router[_0x1435('0x8')](_0x1435('0x15'),auth[_0x1435('0x9')](),controller[_0x1435('0x16')]);router['get'](_0x1435('0x17'),auth[_0x1435('0x9')](),controller[_0x1435('0x18')]);router[_0x1435('0x8')]('/:id/verify',auth[_0x1435('0x9')](),controller[_0x1435('0x19')]);router[_0x1435('0x8')](_0x1435('0x1a'),auth['isAuthenticated'](),controller['getAgents']);router[_0x1435('0x1b')](_0x1435('0x1c'),auth[_0x1435('0x9')](),controller[_0x1435('0x1d')]);router['post'](_0x1435('0xf'),auth['isAuthenticated'](),controller[_0x1435('0x1e')]);router[_0x1435('0x1b')]('/',auth['isAuthenticated'](),controller[_0x1435('0x1f')]);router[_0x1435('0x1b')](_0x1435('0x11'),auth[_0x1435('0x9')](),controller[_0x1435('0x20')]);router[_0x1435('0x1b')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0x1435('0x21')]);router[_0x1435('0x1b')](_0x1435('0x22'),auth[_0x1435('0x9')](),controller[_0x1435('0x23')]);router[_0x1435('0x1b')](_0x1435('0x15'),auth[_0x1435('0x9')](),controller[_0x1435('0x24')]);router[_0x1435('0x1b')]('/:id/send',auth[_0x1435('0x9')](),controller[_0x1435('0x25')]);router[_0x1435('0x1b')](_0x1435('0x1a'),auth['isAuthenticated'](),controller[_0x1435('0x26')]);router['put']('/:id',auth[_0x1435('0x9')](),controller[_0x1435('0x27')]);router[_0x1435('0x28')](_0x1435('0x1c'),auth['isAuthenticated'](),controller[_0x1435('0x29')]);router[_0x1435('0x28')](_0x1435('0xf'),auth[_0x1435('0x9')](),controller['removeAnswers']);router[_0x1435('0x28')](_0x1435('0x11'),auth[_0x1435('0x9')](),controller[_0x1435('0x2a')]);router['delete'](_0x1435('0x13'),auth[_0x1435('0x9')](),controller[_0x1435('0x2b')]);router[_0x1435('0x28')](_0x1435('0xc'),auth['isAuthenticated'](),controller[_0x1435('0x2c')]);router['delete'](_0x1435('0x1a'),auth[_0x1435('0x9')](),controller[_0x1435('0x2d')]);module[_0x1435('0x2e')]=router; \ No newline at end of file +var _0x4186=['show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/in_servers','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/verify','verifySmtp','/:id/users','getAgents','addDisposition','addAnswer','post','create','addSmtp','addApplications','send','addAgents','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x4e1280,_0x3b8e04){var _0x59c5f=function(_0x50a33e){while(--_0x50a33e){_0x4e1280['push'](_0x4e1280['shift']());}};_0x59c5f(++_0x3b8e04);}(_0x4186,0x121));var _0x6418=function(_0x2e58c7,_0x23d092){_0x2e58c7=_0x2e58c7-0x0;var _0x26eb00=_0x4186[_0x2e58c7];return _0x26eb00;};'use strict';var multer=require('multer');var util=require(_0x6418('0x0'));var path=require(_0x6418('0x1'));var timeout=require(_0x6418('0x2'));var express=require(_0x6418('0x3'));var router=express['Router']();var fs_extra=require(_0x6418('0x4'));var auth=require(_0x6418('0x5'));var interaction=require(_0x6418('0x6'));var config=require(_0x6418('0x7'));var controller=require('./mailAccount.controller');router[_0x6418('0x8')]('/',auth[_0x6418('0x9')](),controller[_0x6418('0xa')]);router[_0x6418('0x8')]('/describe',auth[_0x6418('0x9')](),controller['describe']);router['get'](_0x6418('0xb'),auth[_0x6418('0x9')](),controller[_0x6418('0xc')]);router[_0x6418('0x8')](_0x6418('0xd'),auth[_0x6418('0x9')](),controller[_0x6418('0xe')]);router[_0x6418('0x8')](_0x6418('0xf'),auth[_0x6418('0x9')](),controller['getAnswers']);router[_0x6418('0x8')](_0x6418('0x10'),auth[_0x6418('0x9')](),controller['getImap']);router[_0x6418('0x8')](_0x6418('0x11'),auth[_0x6418('0x9')](),controller[_0x6418('0x12')]);router['get'](_0x6418('0x13'),auth[_0x6418('0x9')](),controller[_0x6418('0x14')]);router['get'](_0x6418('0x15'),auth[_0x6418('0x9')](),controller[_0x6418('0x16')]);router[_0x6418('0x8')]('/:id/messages',auth[_0x6418('0x9')](),controller['getMessages']);router[_0x6418('0x8')](_0x6418('0x17'),auth['isAuthenticated'](),controller[_0x6418('0x18')]);router[_0x6418('0x8')](_0x6418('0x19'),auth['isAuthenticated'](),controller[_0x6418('0x1a')]);router['post'](_0x6418('0xd'),auth['isAuthenticated'](),controller[_0x6418('0x1b')]);router['post'](_0x6418('0xf'),auth[_0x6418('0x9')](),controller[_0x6418('0x1c')]);router[_0x6418('0x1d')]('/',auth[_0x6418('0x9')](),controller[_0x6418('0x1e')]);router[_0x6418('0x1d')](_0x6418('0x10'),auth[_0x6418('0x9')](),controller['addImap']);router['post'](_0x6418('0x11'),auth[_0x6418('0x9')](),controller[_0x6418('0x1f')]);router[_0x6418('0x1d')](_0x6418('0x13'),auth[_0x6418('0x9')](),controller['addInteraction']);router[_0x6418('0x1d')](_0x6418('0x15'),auth[_0x6418('0x9')](),controller[_0x6418('0x20')]);router[_0x6418('0x1d')]('/:id/send',auth[_0x6418('0x9')](),controller[_0x6418('0x21')]);router[_0x6418('0x1d')](_0x6418('0x19'),auth['isAuthenticated'](),controller[_0x6418('0x22')]);router['put']('/:id',auth[_0x6418('0x9')](),controller['update']);router[_0x6418('0x23')]('/:id/dispositions',auth[_0x6418('0x9')](),controller[_0x6418('0x24')]);router[_0x6418('0x23')]('/:id/canned_answers',auth[_0x6418('0x9')](),controller[_0x6418('0x25')]);router[_0x6418('0x23')](_0x6418('0x10'),auth['isAuthenticated'](),controller[_0x6418('0x26')]);router[_0x6418('0x23')](_0x6418('0x11'),auth[_0x6418('0x9')](),controller[_0x6418('0x27')]);router[_0x6418('0x23')](_0x6418('0xb'),auth[_0x6418('0x9')](),controller[_0x6418('0x28')]);router['delete'](_0x6418('0x19'),auth['isAuthenticated'](),controller[_0x6418('0x29')]);module[_0x6418('0x2a')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 5c4c5ab..e5a910d 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 _0x75c9=['TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','outlook365','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN'];(function(_0x5a9017,_0x4312fc){var _0x596e52=function(_0x35843d){while(--_0x35843d){_0x5a9017['push'](_0x5a9017['shift']());}};_0x596e52(++_0x4312fc);}(_0x75c9,0x9e));var _0x975c=function(_0x4394b6,_0x12357f){_0x4394b6=_0x4394b6-0x0;var _0x360244=_0x75c9[_0x4394b6];return _0x360244;};'use strict';var Sequelize=require(_0x975c('0x0'));module[_0x975c('0x1')]={'description':{'type':Sequelize[_0x975c('0x2')]},'name':{'type':Sequelize[_0x975c('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x975c('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x975c('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x975c('0x4')]},'markAsUnread':{'type':Sequelize[_0x975c('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x975c('0x5')},'fontSize':{'type':Sequelize[_0x975c('0x6')](0x2)[_0x975c('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x975c('0x4')],'defaultValue':function(){return _0x975c('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x975c('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x975c('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x975c('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x975c('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x975c('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x975c('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x975c('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x975c('0x6')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x975c('0x3')],'defaultValue':![],'comment':_0x975c('0x9'),'set':function(_0x46e152){if(!_0x46e152)this[_0x975c('0xa')](_0x975c('0xb'),null);this[_0x975c('0xa')](_0x975c('0xc'),_0x46e152);}},'provider':{'type':Sequelize[_0x975c('0xd')]('gmail','hotmail','yahoo',_0x975c('0xe')),'defaultValue':null,'get':function(){if(!this[_0x975c('0xf')](_0x975c('0x10')))return _0x975c('0x11');return this[_0x975c('0xf')](_0x975c('0x10'));},'set':function(_0x511bca){if(_0x511bca===_0x975c('0x11'))_0x511bca=null;return this['setDataValue'](_0x975c('0x10'),_0x511bca);}}}; \ No newline at end of file +var _0xc4bf=['STRING','BOOLEAN','TEXT','INTEGER','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','gmail','hotmail','outlook365','provider','custom','getDataValue','sequelize','exports'];(function(_0x6a2a94,_0x5cb27f){var _0x1f2e37=function(_0x17ffff){while(--_0x17ffff){_0x6a2a94['push'](_0x6a2a94['shift']());}};_0x1f2e37(++_0x5cb27f);}(_0xc4bf,0x196));var _0xfc4b=function(_0x489df9,_0x5d63b8){_0x489df9=_0x489df9-0x0;var _0x1f2679=_0xc4bf[_0x489df9];return _0x1f2679;};'use strict';var Sequelize=require(_0xfc4b('0x0'));module[_0xfc4b('0x1')]={'description':{'type':Sequelize[_0xfc4b('0x2')]},'name':{'type':Sequelize[_0xfc4b('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xfc4b('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xfc4b('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xfc4b('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xfc4b('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xfc4b('0x4')]},'markAsUnread':{'type':Sequelize[_0xfc4b('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xfc4b('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0xfc4b('0x5')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xfc4b('0x6');}},'notificationSound':{'type':Sequelize[_0xfc4b('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xfc4b('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xfc4b('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xfc4b('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xfc4b('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfc4b('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xfc4b('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xfc4b('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfc4b('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0xfc4b('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xfc4b('0x3')],'defaultValue':![],'comment':_0xfc4b('0x8'),'set':function(_0x6f9f91){if(!_0x6f9f91)this[_0xfc4b('0x9')](_0xfc4b('0xa'),null);this[_0xfc4b('0x9')]('mandatoryDisposition',_0x6f9f91);}},'provider':{'type':Sequelize['ENUM'](_0xfc4b('0xb'),_0xfc4b('0xc'),'yahoo',_0xfc4b('0xd')),'defaultValue':null,'get':function(){if(!this['getDataValue'](_0xfc4b('0xe')))return _0xfc4b('0xf');return this[_0xfc4b('0x10')](_0xfc4b('0xe'));},'set':function(_0x32c2af){if(_0x32c2af===_0xfc4b('0xf'))_0x32c2af=null;return this[_0xfc4b('0x9')]('provider',_0x32c2af);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 3788651..af8c087 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 _0xdb3f=['query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','keys','body','provider','custom','secure','Mail\x20Account\x20not\x20found','describe','Disposition','create','getDispositions','findOne','length','hasOwnProperty','findAll','removeDispositions','find','ids','addAnswer','CannedAnswer','MailAccountId','removeAnswers','key','email','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','getImap','removeImap','setImap','getSmtp','removeSmtp','addInteraction','omit','MailInteraction','Contact','Owner','internal','Tags','color','tag','addApplications','sequelize','transaction','Transaction','MailApplication','bulkCreate','priority','finally','getApplications','getMessages','MailMessage','$gte','split','format','inlineCss','true','CmContact','Contacts','updatedAt','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','List','ListId','messageId','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','Messages','verifySmtp','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','isArray','userMailAccount:remove','getAgents','moment','bluebird','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailAccount.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','MailAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','update','destroy','get','MailAccounts','UserProfileResource','stack','name','send','gmail','imap.gmail.com','yahoo','hotmail','imap-mail.outlook.com','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','outlook365','smtp.office365.com','username','password','modernAuthentication','CloudProviderId','pass','host','port','service','authentication','user','Imap','Smtp','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','model'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xdb3f,0x130));var _0xfdb3=function(_0x1c1566,_0x36b365){_0x1c1566=_0x1c1566-0x0;var _0x461fae=_0xdb3f[_0x1c1566];return _0x461fae;};'use strict';var moment=require(_0xfdb3('0x0'));var BPromise=require(_0xfdb3('0x1'));var util=require('util');var path=require('path');var _=require(_0xfdb3('0x2'));var juice=require(_0xfdb3('0x3'));var Redis=require(_0xfdb3('0x4'));var qs=require(_0xfdb3('0x5'));var logger=require(_0xfdb3('0x6'))(_0xfdb3('0x7'));var config=require(_0xfdb3('0x8'));var db=require(_0xfdb3('0x9'))['db'];config[_0xfdb3('0xa')]=_[_0xfdb3('0xb')](config[_0xfdb3('0xa')],{'host':_0xfdb3('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfdb3('0xa')]));require(_0xfdb3('0xd'))[_0xfdb3('0xe')](socket);var jayson=require(_0xfdb3('0xf'));var client=jayson[_0xfdb3('0x10')][_0xfdb3('0x11')]({'port':0x232b});function respondWithRpcPromise(_0x1c2f8c,_0x218d07,_0x58f259,_0x11c789){return new BPromise(function(_0x403028,_0x27cbed){var _0x1d078c=_0x11c789||client;return _0x1d078c[_0xfdb3('0x12')](_0x1c2f8c,_0x58f259)[_0xfdb3('0x13')](function(_0x2ed307){logger[_0xfdb3('0x14')]('MailAccount,\x20%s,\x20%s',_0x218d07,_0xfdb3('0x15'));logger[_0xfdb3('0x16')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x218d07,_0xfdb3('0x15'),JSON['stringify'](_0x2ed307));if(_0x2ed307[_0xfdb3('0x17')]){if(_0x2ed307[_0xfdb3('0x17')]['code']===0x1f4){logger[_0xfdb3('0x17')](_0xfdb3('0x18'),_0x218d07,_0x2ed307[_0xfdb3('0x17')]['message']);return _0x27cbed(_0x2ed307[_0xfdb3('0x17')][_0xfdb3('0x19')]);}logger['error'](_0xfdb3('0x18'),_0x218d07,_0x2ed307[_0xfdb3('0x17')][_0xfdb3('0x19')]);return _0x403028(_0x2ed307['error']['message']);}else{logger[_0xfdb3('0x14')](_0xfdb3('0x18'),_0x218d07,_0xfdb3('0x15'));_0x403028(_0x2ed307[_0xfdb3('0x1a')][_0xfdb3('0x19')]);}})[_0xfdb3('0x1b')](function(_0x43507e){logger[_0xfdb3('0x17')](_0xfdb3('0x18'),_0x218d07,_0x43507e);_0x27cbed(_0x43507e);});});}function respondWithStatusCode(_0xa06451,_0x300380){_0x300380=_0x300380||0xcc;return function(_0x39187b){if(_0x39187b){return _0xa06451[_0xfdb3('0x1c')](_0x300380);}return _0xa06451[_0xfdb3('0x1d')](_0x300380)[_0xfdb3('0x1e')]();};}function respondWithResult(_0x508fa0,_0x784d03){_0x784d03=_0x784d03||0xc8;return function(_0x313ba0){if(_0x313ba0){return _0x508fa0['status'](_0x784d03)[_0xfdb3('0x1f')](_0x313ba0);}};}function respondWithFilteredResult(_0x48ec8b,_0x57785d){return function(_0x28176c){if(_0x28176c){var _0x548d8f=typeof _0x57785d[_0xfdb3('0x20')]===_0xfdb3('0x21')&&typeof _0x57785d['limit']==='undefined';var _0x201c1c=_0x28176c['count'];var _0x236a6e=_0x548d8f?0x0:_0x57785d[_0xfdb3('0x20')];var _0x1d73b1=_0x548d8f?_0x28176c[_0xfdb3('0x22')]:_0x57785d[_0xfdb3('0x20')]+_0x57785d[_0xfdb3('0x23')];var _0x2c731a;if(_0x1d73b1>=_0x201c1c){_0x1d73b1=_0x201c1c;_0x2c731a=0xc8;}else{_0x2c731a=0xce;}_0x48ec8b['status'](_0x2c731a);return _0x48ec8b['set'](_0xfdb3('0x24'),_0x236a6e+'-'+_0x1d73b1+'/'+_0x201c1c)[_0xfdb3('0x1f')](_0x28176c);}return null;};}function saveUpdates(_0x58cfdc){return function(_0x18cf67){if(_0x18cf67){return _0x18cf67[_0xfdb3('0x25')](_0x58cfdc)['then'](function(_0x3d1008){return _0x3d1008;});}return null;};}function removeEntity(_0x4a82fe){return function(_0xec05a6){if(_0xec05a6){return _0xec05a6[_0xfdb3('0x26')]()[_0xfdb3('0x13')](function(){var _0x20ab23=_0xec05a6[_0xfdb3('0x27')]({'plain':!![]});var _0x46e8a3=_0xfdb3('0x28');return db[_0xfdb3('0x29')][_0xfdb3('0x26')]({'where':{'type':_0x46e8a3,'resourceId':_0x20ab23['id']}})[_0xfdb3('0x13')](function(){return _0xec05a6;});})[_0xfdb3('0x13')](function(){_0x4a82fe[_0xfdb3('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cb57c){return function(_0x592e95){if(!_0x592e95){_0x4cb57c[_0xfdb3('0x1c')](0x194);}return _0x592e95;};}function handleError(_0x406b46,_0x18a4d3){_0x18a4d3=_0x18a4d3||0x1f4;return function(_0x2f5985){logger[_0xfdb3('0x17')](_0x2f5985[_0xfdb3('0x2a')]);if(_0x2f5985[_0xfdb3('0x2b')]){delete _0x2f5985[_0xfdb3('0x2b')];}_0x406b46[_0xfdb3('0x1d')](_0x18a4d3)[_0xfdb3('0x2c')](_0x2f5985);};}function getImapHost(_0x4d819d){switch(_0x4d819d){case _0xfdb3('0x2d'):return _0xfdb3('0x2e');case _0xfdb3('0x2f'):return'imap.mail.yahoo.com';case _0xfdb3('0x30'):return _0xfdb3('0x31');case'outlook365':return _0xfdb3('0x32');}throw new Error(_0xfdb3('0x33'),_0x4d819d);}function getSmtpHost(_0x5ea9b4){switch(_0x5ea9b4){case _0xfdb3('0x2d'):return _0xfdb3('0x34');case'yahoo':return _0xfdb3('0x35');case _0xfdb3('0x30'):return _0xfdb3('0x36');case _0xfdb3('0x37'):return _0xfdb3('0x38');}throw new Error(_0xfdb3('0x33'),_0x5ea9b4);}function getAuthenticationOptions(_0x6e5f7e,_0x3788a4){var _0x557dec={};var _0x6244fc={};if(_0x6e5f7e){_0x557dec['user']=_0x6244fc['user']=_0x3788a4[_0xfdb3('0x39')];_0x557dec[_0xfdb3('0x3a')]=_0x6244fc['pass']=_0x3788a4[_0xfdb3('0x3a')];if(_0x3788a4['modernAuthentication']){_0x557dec[_0xfdb3('0x3b')]=_0x6244fc[_0xfdb3('0x3b')]=!![];_0x557dec[_0xfdb3('0x3c')]=_0x6244fc['CloudProviderId']=_0x3788a4['CloudProviderId'];_0x557dec['password']=_0x6244fc[_0xfdb3('0x3d')]=null;}else{_0x557dec[_0xfdb3('0x3c')]=_0x6244fc['CloudProviderId']=null;}_0x557dec[_0xfdb3('0x3e')]=getImapHost(_0x6e5f7e);_0x557dec[_0xfdb3('0x3f')]=0x3e1;_0x6244fc['host']=getSmtpHost(_0x6e5f7e);_0x6244fc[_0xfdb3('0x3f')]=0x24b;_0x6244fc['secure']=![];_0x557dec[_0xfdb3('0x40')]=_0x6244fc[_0xfdb3('0x40')]=null;}else{if(_0x3788a4[_0xfdb3('0x41')]){_0x557dec['user']=_0x6244fc['user']=_0x3788a4[_0xfdb3('0x39')];_0x557dec[_0xfdb3('0x3a')]=_0x6244fc[_0xfdb3('0x3d')]=_0x3788a4[_0xfdb3('0x3a')];}else{_0x557dec['authentication']=_0x6244fc[_0xfdb3('0x41')]=![];_0x557dec[_0xfdb3('0x42')]=_0x6244fc['user']=null;_0x557dec[_0xfdb3('0x3a')]=_0x6244fc[_0xfdb3('0x3d')]=null;}_0x557dec[_0xfdb3('0x3e')]=_0x3788a4[_0xfdb3('0x43')][_0xfdb3('0x3e')];_0x557dec[_0xfdb3('0x3f')]=_0x3788a4[_0xfdb3('0x43')][_0xfdb3('0x3f')];_0x6244fc[_0xfdb3('0x3e')]=_0x3788a4[_0xfdb3('0x44')][_0xfdb3('0x3e')];_0x6244fc[_0xfdb3('0x3f')]=_0x3788a4[_0xfdb3('0x44')][_0xfdb3('0x3f')];}return{'Imap':_0x557dec,'Smtp':_0x6244fc};}exports['index']=function(_0x34cc47,_0x48a42e){var _0x179e0f={'include':[{'model':db[_0xfdb3('0x45')],'as':'Imap'},{'model':db[_0xfdb3('0x46')],'as':_0xfdb3('0x44')},{'model':db[_0xfdb3('0x47')],'as':_0xfdb3('0x48')}]},_0x88ad70={},_0x535bb4={'count':0x0,'rows':[]};var _0x20a7c9=_[_0xfdb3('0x49')](db[_0xfdb3('0x4a')][_0xfdb3('0x4b')],function(_0x58a09f){return{'name':_0x58a09f[_0xfdb3('0x4c')],'type':_0x58a09f['type']['key']};});_0x88ad70[_0xfdb3('0x4d')]=_[_0xfdb3('0x49')](_0x20a7c9,_0xfdb3('0x2b'));_0x88ad70[_0xfdb3('0x4e')]=_['keys'](_0x34cc47[_0xfdb3('0x4e')]);_0x88ad70[_0xfdb3('0x4f')]=_[_0xfdb3('0x50')](_0x88ad70[_0xfdb3('0x4d')],_0x88ad70[_0xfdb3('0x4e')]);_0x179e0f[_0xfdb3('0x51')]=_[_0xfdb3('0x50')](_0x88ad70['model'],qs['fields'](_0x34cc47[_0xfdb3('0x4e')][_0xfdb3('0x52')]));_0x179e0f[_0xfdb3('0x51')]=_0x179e0f[_0xfdb3('0x51')]['length']?_0x179e0f[_0xfdb3('0x51')]:_0x88ad70['model'];if(!_0x34cc47[_0xfdb3('0x4e')]['hasOwnProperty'](_0xfdb3('0x53'))){_0x179e0f[_0xfdb3('0x23')]=qs[_0xfdb3('0x23')](_0x34cc47[_0xfdb3('0x4e')][_0xfdb3('0x23')]);_0x179e0f[_0xfdb3('0x20')]=qs['offset'](_0x34cc47[_0xfdb3('0x4e')][_0xfdb3('0x20')]);}_0x179e0f[_0xfdb3('0x54')]=qs[_0xfdb3('0x55')](_0x34cc47[_0xfdb3('0x4e')][_0xfdb3('0x55')]);_0x179e0f[_0xfdb3('0x56')]=qs['filters'](_[_0xfdb3('0x57')](_0x34cc47['query'],_0x88ad70[_0xfdb3('0x4f')]),_0x20a7c9);if(_0x34cc47[_0xfdb3('0x4e')][_0xfdb3('0x58')]){_0x179e0f['where']=_[_0xfdb3('0x59')](_0x179e0f[_0xfdb3('0x56')],{'$or':_[_0xfdb3('0x49')](_0x20a7c9,function(_0x275bb5){if(_0x275bb5[_0xfdb3('0x5a')]!==_0xfdb3('0x5b')){var _0xa3f4f6={};_0xa3f4f6[_0x275bb5[_0xfdb3('0x2b')]]={'$like':'%'+_0x34cc47[_0xfdb3('0x4e')]['filter']+'%'};return _0xa3f4f6;}})});}_0x179e0f=_[_0xfdb3('0x59')]({},_0x179e0f,_0x34cc47[_0xfdb3('0x5c')]);var _0x1c3f67={'where':_0x179e0f['where']};return db[_0xfdb3('0x4a')][_0xfdb3('0x22')](_0x1c3f67)[_0xfdb3('0x13')](function(_0x32c655){_0x535bb4['count']=_0x32c655;if(_0x34cc47['query'][_0xfdb3('0x5d')]){_0x179e0f[_0xfdb3('0x5e')]=[{'all':!![]}];}return db['MailAccount']['findAll'](_0x179e0f);})[_0xfdb3('0x13')](function(_0x1ac56e){_0x535bb4[_0xfdb3('0x5f')]=_0x1ac56e;return _0x535bb4;})[_0xfdb3('0x13')](respondWithFilteredResult(_0x48a42e,_0x179e0f))[_0xfdb3('0x1b')](handleError(_0x48a42e,null));};exports[_0xfdb3('0x60')]=function(_0x5dd631,_0x19eca7){var _0x57d084={'raw':![],'where':{'id':_0x5dd631[_0xfdb3('0x61')]['id']},'include':[{'model':db[_0xfdb3('0x45')],'as':_0xfdb3('0x43')},{'model':db[_0xfdb3('0x46')],'as':_0xfdb3('0x44')},{'model':db[_0xfdb3('0x47')],'as':_0xfdb3('0x48')}]},_0x2dc395={};_0x2dc395[_0xfdb3('0x4d')]=_[_0xfdb3('0x62')](db[_0xfdb3('0x4a')]['rawAttributes']);_0x2dc395[_0xfdb3('0x4e')]=_['keys'](_0x5dd631[_0xfdb3('0x4e')]);_0x2dc395[_0xfdb3('0x4f')]=_[_0xfdb3('0x50')](_0x2dc395[_0xfdb3('0x4d')],_0x2dc395[_0xfdb3('0x4e')]);_0x57d084['attributes']=_['intersection'](_0x2dc395[_0xfdb3('0x4d')],qs[_0xfdb3('0x52')](_0x5dd631[_0xfdb3('0x4e')][_0xfdb3('0x52')]));_0x57d084['attributes']=_0x57d084['attributes']['length']?_0x57d084[_0xfdb3('0x51')]:_0x2dc395[_0xfdb3('0x4d')];if(_0x5dd631[_0xfdb3('0x4e')][_0xfdb3('0x5d')]){_0x57d084[_0xfdb3('0x5e')]=[{'all':!![]}];}_0x57d084=_[_0xfdb3('0x59')]({},_0x57d084,_0x5dd631[_0xfdb3('0x5c')]);return db['MailAccount']['find'](_0x57d084)['then'](handleEntityNotFound(_0x19eca7,null))[_0xfdb3('0x13')](respondWithResult(_0x19eca7,null))[_0xfdb3('0x1b')](handleError(_0x19eca7,null));};exports[_0xfdb3('0x25')]=function(_0x14e44d,_0x131620){if(_0x14e44d[_0xfdb3('0x63')]['id']){delete _0x14e44d[_0xfdb3('0x63')]['id'];}var _0x12b2f8=_0x14e44d[_0xfdb3('0x63')][_0xfdb3('0x64')]===_0xfdb3('0x65')?null:_0x14e44d[_0xfdb3('0x63')][_0xfdb3('0x64')];var _0x14626b=_0x14e44d[_0xfdb3('0x63')]['Imap']||{};var _0x2ecf36=_0x14e44d[_0xfdb3('0x63')]['Smtp']||{};if(_0x12b2f8){_0x14626b[_0xfdb3('0x3e')]=getImapHost(_0x12b2f8);_0x14626b[_0xfdb3('0x3f')]=0x3e1;_0x2ecf36[_0xfdb3('0x3e')]=getSmtpHost(_0x12b2f8);_0x2ecf36[_0xfdb3('0x3f')]=0x24b;_0x2ecf36[_0xfdb3('0x66')]=![];}if(_0x2ecf36[_0xfdb3('0x3b')]){_0x2ecf36[_0xfdb3('0x66')]=![];}else{_0x2ecf36[_0xfdb3('0x3c')]=null;}if(!_0x14626b[_0xfdb3('0x3b')])_0x14626b[_0xfdb3('0x3c')]=null;_0x14e44d['body']['Imap']=_0x14626b;_0x14e44d[_0xfdb3('0x63')][_0xfdb3('0x44')]=_0x2ecf36;return db['MailAccount']['find']({'where':{'id':_0x14e44d[_0xfdb3('0x61')]['id']},'include':[{'model':db[_0xfdb3('0x45')],'as':_0xfdb3('0x43')},{'model':db[_0xfdb3('0x46')],'as':_0xfdb3('0x44')},{'model':db[_0xfdb3('0x47')],'as':_0xfdb3('0x48')}]})[_0xfdb3('0x13')](handleEntityNotFound(_0x131620,null))[_0xfdb3('0x13')](function(_0x13c6cf){if(!_0x13c6cf)throw new Error(_0xfdb3('0x67'));if(_0x13c6cf['service'])delete _0x14e44d[_0xfdb3('0x63')][_0xfdb3('0x43')];return _0x13c6cf;})['then'](saveUpdates(_0x14e44d[_0xfdb3('0x63')],null))[_0xfdb3('0x13')](function(_0x4e3dda){if(!_0x14e44d[_0xfdb3('0x63')][_0xfdb3('0x43')])return _0x4e3dda;return db['MailServerIn']['update'](_0x14e44d[_0xfdb3('0x63')][_0xfdb3('0x43')],{'where':{'MailAccountId':_0x4e3dda['id']}})[_0xfdb3('0x13')](function(){return _0x4e3dda;});})[_0xfdb3('0x13')](function(_0x412339){if(!_0x14e44d[_0xfdb3('0x63')][_0xfdb3('0x44')])return _0x412339;return db[_0xfdb3('0x46')][_0xfdb3('0x25')](_0x14e44d[_0xfdb3('0x63')][_0xfdb3('0x44')],{'where':{'MailAccountId':_0x412339['id']}})[_0xfdb3('0x13')](function(){return _0x412339;});})[_0xfdb3('0x13')](respondWithResult(_0x131620,null))['catch'](handleError(_0x131620,null));};exports[_0xfdb3('0x68')]=function(_0x2cb329,_0x13ed0d){return db[_0xfdb3('0x4a')][_0xfdb3('0x68')]()['then'](respondWithResult(_0x13ed0d,null))[_0xfdb3('0x1b')](handleError(_0x13ed0d,null));};exports['addDisposition']=function(_0xc6d6a7,_0x1b973f){if(_0xc6d6a7[_0xfdb3('0x63')]['id']){delete _0xc6d6a7[_0xfdb3('0x63')]['id'];}return db[_0xfdb3('0x4a')]['find']({'where':{'id':_0xc6d6a7['params']['id']}})[_0xfdb3('0x13')](handleEntityNotFound(_0x1b973f,null))[_0xfdb3('0x13')](function(_0x48606e){if(_0x48606e){_0xc6d6a7[_0xfdb3('0x63')]['MailAccountId']=_0x48606e['id'];return db[_0xfdb3('0x69')][_0xfdb3('0x6a')](_0xc6d6a7['body']);}})[_0xfdb3('0x13')](respondWithResult(_0x1b973f,null))[_0xfdb3('0x1b')](handleError(_0x1b973f,null));};exports[_0xfdb3('0x6b')]=function(_0xcf88c1,_0x46f729){var _0x41d290={'raw':![],'where':{}};var _0x1c9ff9={};var _0x49b5be={'count':0x0,'rows':[]};return db[_0xfdb3('0x4a')][_0xfdb3('0x6c')]({'where':{'id':_0xcf88c1[_0xfdb3('0x61')]['id']}})[_0xfdb3('0x13')](handleEntityNotFound(_0x46f729,null))[_0xfdb3('0x13')](function(_0xd8c298){if(_0xd8c298){_0x1c9ff9['model']=_[_0xfdb3('0x62')](db[_0xfdb3('0x69')]['rawAttributes']);_0x1c9ff9[_0xfdb3('0x4e')]=_[_0xfdb3('0x62')](_0xcf88c1[_0xfdb3('0x4e')]);_0x1c9ff9['filters']=_[_0xfdb3('0x50')](_0x1c9ff9[_0xfdb3('0x4d')],_0x1c9ff9['query']);_0x41d290[_0xfdb3('0x51')]=_[_0xfdb3('0x50')](_0x1c9ff9['model'],qs[_0xfdb3('0x52')](_0xcf88c1[_0xfdb3('0x4e')][_0xfdb3('0x52')]));_0x41d290[_0xfdb3('0x51')]=_0x41d290[_0xfdb3('0x51')][_0xfdb3('0x6d')]?_0x41d290[_0xfdb3('0x51')]:_0x1c9ff9[_0xfdb3('0x4d')];if(!_0xcf88c1[_0xfdb3('0x4e')][_0xfdb3('0x6e')](_0xfdb3('0x53'))){_0x41d290['limit']=qs[_0xfdb3('0x23')](_0xcf88c1[_0xfdb3('0x4e')][_0xfdb3('0x23')]);_0x41d290[_0xfdb3('0x20')]=qs[_0xfdb3('0x20')](_0xcf88c1['query'][_0xfdb3('0x20')]);}_0x41d290['order']=qs[_0xfdb3('0x55')](_0xcf88c1['query'][_0xfdb3('0x55')]);_0x41d290[_0xfdb3('0x56')]=qs[_0xfdb3('0x4f')](_[_0xfdb3('0x57')](_0xcf88c1['query'],_0x1c9ff9[_0xfdb3('0x4f')]));_0x41d290[_0xfdb3('0x56')]['MailAccountId']=_0xd8c298['id'];if(_0xcf88c1['query'][_0xfdb3('0x58')]){_0x41d290['where']=_[_0xfdb3('0x59')](_0x41d290['where'],{'$or':_['map'](_0x41d290[_0xfdb3('0x51')],function(_0x30a21c){var _0x56b315={};_0x56b315[_0x30a21c]={'$like':'%'+_0xcf88c1[_0xfdb3('0x4e')][_0xfdb3('0x58')]+'%'};return _0x56b315;})});}_0x41d290=_[_0xfdb3('0x59')]({},_0x41d290,_0xcf88c1['options']);return db[_0xfdb3('0x69')][_0xfdb3('0x22')]({'where':_0x41d290[_0xfdb3('0x56')]})['then'](function(_0x3bf8c5){_0x49b5be['count']=_0x3bf8c5;if(_0xcf88c1['query'][_0xfdb3('0x5d')]){_0x41d290[_0xfdb3('0x5e')]=[{'all':!![]}];}return db[_0xfdb3('0x69')][_0xfdb3('0x6f')](_0x41d290);})[_0xfdb3('0x13')](function(_0x1955db){_0x49b5be[_0xfdb3('0x5f')]=_0x1955db;return _0x49b5be;});}})[_0xfdb3('0x13')](respondWithFilteredResult(_0x46f729,_0x41d290))[_0xfdb3('0x1b')](handleError(_0x46f729,null));};exports[_0xfdb3('0x70')]=function(_0x122a6d,_0x5bb4e9){return db[_0xfdb3('0x4a')][_0xfdb3('0x71')]({'where':{'id':_0x122a6d[_0xfdb3('0x61')]['id']}})[_0xfdb3('0x13')](handleEntityNotFound(_0x5bb4e9,null))[_0xfdb3('0x13')](function(_0x2b6bcc){if(_0x2b6bcc){return _0x2b6bcc[_0xfdb3('0x70')](_0x122a6d['query'][_0xfdb3('0x72')]);}})[_0xfdb3('0x13')](respondWithStatusCode(_0x5bb4e9,null))[_0xfdb3('0x1b')](handleError(_0x5bb4e9,null));};exports[_0xfdb3('0x73')]=function(_0x178ff5,_0x5f01c6){if(_0x178ff5[_0xfdb3('0x63')]['id']){delete _0x178ff5[_0xfdb3('0x63')]['id'];}return db['MailAccount'][_0xfdb3('0x71')]({'where':{'id':_0x178ff5['params']['id']}})[_0xfdb3('0x13')](handleEntityNotFound(_0x5f01c6,null))[_0xfdb3('0x13')](function(_0x5900f4){if(_0x5900f4){_0x178ff5[_0xfdb3('0x63')]['MailAccountId']=_0x5900f4['id'];return db[_0xfdb3('0x74')][_0xfdb3('0x6a')](_0x178ff5[_0xfdb3('0x63')]);}})['then'](respondWithResult(_0x5f01c6,null))[_0xfdb3('0x1b')](handleError(_0x5f01c6,null));};exports['getAnswers']=function(_0x2b7fbf,_0xece09b){var _0x52a76c={'raw':![],'where':{}};var _0x3c98ad={};var _0x9d5256={'count':0x0,'rows':[]};return db[_0xfdb3('0x4a')]['findOne']({'where':{'id':_0x2b7fbf[_0xfdb3('0x61')]['id']}})['then'](handleEntityNotFound(_0xece09b,null))[_0xfdb3('0x13')](function(_0x906630){if(_0x906630){_0x3c98ad[_0xfdb3('0x4d')]=_[_0xfdb3('0x62')](db['CannedAnswer']['rawAttributes']);_0x3c98ad['query']=_[_0xfdb3('0x62')](_0x2b7fbf[_0xfdb3('0x4e')]);_0x3c98ad[_0xfdb3('0x4f')]=_[_0xfdb3('0x50')](_0x3c98ad[_0xfdb3('0x4d')],_0x3c98ad[_0xfdb3('0x4e')]);_0x52a76c[_0xfdb3('0x51')]=_[_0xfdb3('0x50')](_0x3c98ad[_0xfdb3('0x4d')],qs[_0xfdb3('0x52')](_0x2b7fbf['query']['fields']));_0x52a76c['attributes']=_0x52a76c['attributes'][_0xfdb3('0x6d')]?_0x52a76c['attributes']:_0x3c98ad[_0xfdb3('0x4d')];if(!_0x2b7fbf[_0xfdb3('0x4e')][_0xfdb3('0x6e')](_0xfdb3('0x53'))){_0x52a76c[_0xfdb3('0x23')]=qs[_0xfdb3('0x23')](_0x2b7fbf[_0xfdb3('0x4e')][_0xfdb3('0x23')]);_0x52a76c['offset']=qs[_0xfdb3('0x20')](_0x2b7fbf[_0xfdb3('0x4e')][_0xfdb3('0x20')]);}_0x52a76c[_0xfdb3('0x54')]=qs['sort'](_0x2b7fbf[_0xfdb3('0x4e')][_0xfdb3('0x55')]);_0x52a76c[_0xfdb3('0x56')]=qs[_0xfdb3('0x4f')](_['pick'](_0x2b7fbf[_0xfdb3('0x4e')],_0x3c98ad[_0xfdb3('0x4f')]));_0x52a76c[_0xfdb3('0x56')][_0xfdb3('0x75')]=_0x906630['id'];if(_0x2b7fbf['query']['filter']){_0x52a76c[_0xfdb3('0x56')]=_['merge'](_0x52a76c[_0xfdb3('0x56')],{'$or':_[_0xfdb3('0x49')](_0x52a76c[_0xfdb3('0x51')],function(_0x1fdc95){var _0x4f479a={};_0x4f479a[_0x1fdc95]={'$like':'%'+_0x2b7fbf[_0xfdb3('0x4e')][_0xfdb3('0x58')]+'%'};return _0x4f479a;})});}_0x52a76c=_['merge']({},_0x52a76c,_0x2b7fbf[_0xfdb3('0x5c')]);return db[_0xfdb3('0x74')][_0xfdb3('0x22')]({'where':_0x52a76c[_0xfdb3('0x56')]})['then'](function(_0x4f104e){_0x9d5256['count']=_0x4f104e;if(_0x2b7fbf[_0xfdb3('0x4e')][_0xfdb3('0x5d')]){_0x52a76c[_0xfdb3('0x5e')]=[{'all':!![]}];}return db['CannedAnswer'][_0xfdb3('0x6f')](_0x52a76c);})[_0xfdb3('0x13')](function(_0x167cd9){_0x9d5256[_0xfdb3('0x5f')]=_0x167cd9;return _0x9d5256;});}})[_0xfdb3('0x13')](respondWithFilteredResult(_0xece09b,_0x52a76c))[_0xfdb3('0x1b')](handleError(_0xece09b,null));};exports['removeAnswers']=function(_0x20719b,_0x368ef9){return db['MailAccount'][_0xfdb3('0x71')]({'where':{'id':_0x20719b['params']['id']}})['then'](handleEntityNotFound(_0x368ef9,null))[_0xfdb3('0x13')](function(_0x4a3f3e){if(_0x4a3f3e){return _0x4a3f3e[_0xfdb3('0x76')](_0x20719b[_0xfdb3('0x4e')][_0xfdb3('0x72')]);}})['then'](respondWithStatusCode(_0x368ef9,null))[_0xfdb3('0x1b')](handleError(_0x368ef9,null));};exports[_0xfdb3('0x6a')]=function(_0x152bb9,_0x163ea8){var _0x602709={'name':_0x152bb9[_0xfdb3('0x63')][_0xfdb3('0x2b')],'key':_0x152bb9[_0xfdb3('0x63')][_0xfdb3('0x77')],'provider':_0x152bb9['body'][_0xfdb3('0x64')]===_0xfdb3('0x65')?null:_0x152bb9['body'][_0xfdb3('0x64')],'email':_0x152bb9[_0xfdb3('0x63')][_0xfdb3('0x78')],'ListId':_0x152bb9[_0xfdb3('0x63')]['ListId'],'active':!_[_0xfdb3('0x79')](_0x152bb9[_0xfdb3('0x63')][_0xfdb3('0x7a')])?_0x152bb9[_0xfdb3('0x63')][_0xfdb3('0x7a')]:!![],'description':_0x152bb9['body'][_0xfdb3('0x7b')]||null};var _0xb71d03=getAuthenticationOptions(_0x602709['provider'],_0x152bb9[_0xfdb3('0x63')]);_0x602709[_0xfdb3('0x43')]=_0xb71d03[_0xfdb3('0x43')];_0x602709[_0xfdb3('0x44')]=_0xb71d03[_0xfdb3('0x44')];return db[_0xfdb3('0x4a')][_0xfdb3('0x6a')](_0x602709,{'include':[{'model':db[_0xfdb3('0x46')],'as':_0xfdb3('0x44')},{'model':db['MailServerIn'],'as':_0xfdb3('0x43')}]})[_0xfdb3('0x13')](function(_0x4e5e82){var _0x2b99ed=_0x152bb9[_0xfdb3('0x42')][_0xfdb3('0x27')]({'plain':!![]});if(!_0x2b99ed)throw new Error(_0xfdb3('0x7c'));if(_0x2b99ed[_0xfdb3('0x7d')]==='user'){var _0x50b55b=_0x4e5e82[_0xfdb3('0x27')]({'plain':!![]});return db[_0xfdb3('0x7e')][_0xfdb3('0x71')]({'where':{'name':_0xfdb3('0x28'),'userProfileId':_0x2b99ed[_0xfdb3('0x7f')]},'raw':!![]})[_0xfdb3('0x13')](function(_0x1d6b91){if(_0x1d6b91&&_0x1d6b91[_0xfdb3('0x80')]===0x0){return db[_0xfdb3('0x29')][_0xfdb3('0x6a')]({'name':_0x50b55b[_0xfdb3('0x2b')],'resourceId':_0x50b55b['id'],'type':_0x1d6b91['name'],'sectionId':_0x1d6b91['id']},{})['then'](function(){return _0x4e5e82;});}else{return _0x4e5e82;}})[_0xfdb3('0x1b')](function(_0x3fe8c8){logger[_0xfdb3('0x17')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3fe8c8);throw _0x3fe8c8;});}return _0x4e5e82;})[_0xfdb3('0x13')](respondWithResult(_0x163ea8,0xc9))[_0xfdb3('0x1b')](handleError(_0x163ea8,null));};exports[_0xfdb3('0x81')]=function(_0x3deab3,_0x56c324){return db['MailAccount'][_0xfdb3('0x6c')]({'where':{'id':_0x3deab3[_0xfdb3('0x61')]['id']}})[_0xfdb3('0x13')](handleEntityNotFound(_0x56c324,null))[_0xfdb3('0x13')](function(_0x1da094){if(_0x1da094){return _0x1da094[_0xfdb3('0x81')]();}return null;})['then'](respondWithResult(_0x56c324,null))[_0xfdb3('0x1b')](handleError(_0x56c324,null));};exports['addImap']=function(_0x4a5691,_0x23e639){if(_0x4a5691[_0xfdb3('0x63')]['id']){delete _0x4a5691[_0xfdb3('0x63')]['id'];}return db[_0xfdb3('0x4a')][_0xfdb3('0x71')]({'where':{'id':_0x4a5691[_0xfdb3('0x61')]['id']}})[_0xfdb3('0x13')](handleEntityNotFound(_0x23e639,null))[_0xfdb3('0x13')](function(_0x3f1a30){if(_0x3f1a30){_0x4a5691[_0xfdb3('0x63')][_0xfdb3('0x75')]=_0x3f1a30['id'];return db[_0xfdb3('0x45')]['create'](_0x4a5691[_0xfdb3('0x63')]);}})[_0xfdb3('0x13')](respondWithResult(_0x23e639,null))[_0xfdb3('0x1b')](handleError(_0x23e639,null));};exports[_0xfdb3('0x82')]=function(_0x116005,_0x32eecf){return db['MailAccount'][_0xfdb3('0x6c')]({'where':{'id':_0x116005[_0xfdb3('0x61')]['id']}})['then'](handleEntityNotFound(_0x32eecf,null))[_0xfdb3('0x13')](function(_0x18b3f2){if(_0x18b3f2){return _0x18b3f2[_0xfdb3('0x83')](null);}return null;})[_0xfdb3('0x13')](respondWithStatusCode(_0x32eecf,null))[_0xfdb3('0x1b')](handleError(_0x32eecf,null));};exports[_0xfdb3('0x84')]=function(_0x317b67,_0x48e90c){return db[_0xfdb3('0x4a')][_0xfdb3('0x6c')]({'where':{'id':_0x317b67[_0xfdb3('0x61')]['id']}})['then'](handleEntityNotFound(_0x48e90c,null))['then'](function(_0x11c6f8){if(_0x11c6f8){return _0x11c6f8[_0xfdb3('0x84')]();}return null;})['then'](respondWithResult(_0x48e90c,null))[_0xfdb3('0x1b')](handleError(_0x48e90c,null));};exports['addSmtp']=function(_0x541536,_0x7c3a91){if(_0x541536[_0xfdb3('0x63')]['id']){delete _0x541536[_0xfdb3('0x63')]['id'];}return db[_0xfdb3('0x4a')][_0xfdb3('0x71')]({'where':{'id':_0x541536[_0xfdb3('0x61')]['id']}})[_0xfdb3('0x13')](handleEntityNotFound(_0x7c3a91,null))[_0xfdb3('0x13')](function(_0x28a750){if(_0x28a750){_0x541536[_0xfdb3('0x63')][_0xfdb3('0x75')]=_0x28a750['id'];return db[_0xfdb3('0x46')]['create'](_0x541536[_0xfdb3('0x63')]);}})[_0xfdb3('0x13')](respondWithResult(_0x7c3a91,null))[_0xfdb3('0x1b')](handleError(_0x7c3a91,null));};exports[_0xfdb3('0x85')]=function(_0x18f36a,_0x482ad6){return db[_0xfdb3('0x4a')][_0xfdb3('0x6c')]({'where':{'id':_0x18f36a[_0xfdb3('0x61')]['id']}})[_0xfdb3('0x13')](handleEntityNotFound(_0x482ad6,null))[_0xfdb3('0x13')](function(_0x1c2135){if(_0x1c2135){return _0x1c2135['setSmtp'](null);}return null;})[_0xfdb3('0x13')](respondWithStatusCode(_0x482ad6,null))[_0xfdb3('0x1b')](handleError(_0x482ad6,null));};exports[_0xfdb3('0x86')]=function(_0x4e61df,_0x1eccca){return db['MailInteraction'][_0xfdb3('0x71')]({'where':{'id':_0x4e61df['params']['id']}})[_0xfdb3('0x13')](handleEntityNotFound(_0x1eccca,null))['then'](function(_0x20a160){if(_0x20a160){return _0x20a160[_0xfdb3('0x86')](_0x4e61df[_0xfdb3('0x63')][_0xfdb3('0x72')],_[_0xfdb3('0x87')](_0x4e61df[_0xfdb3('0x63')],[_0xfdb3('0x72'),'id'])||{});}})['then'](respondWithResult(_0x1eccca,null))['catch'](handleError(_0x1eccca,null));};exports['getInteractions']=function(_0x1aac5d,_0x461f21){var _0x5362f3={'raw':![],'where':{}};var _0x147b3d={};var _0x461408={'count':0x0,'rows':[]};return db['MailAccount'][_0xfdb3('0x6c')]({'where':{'id':_0x1aac5d[_0xfdb3('0x61')]['id']}})['then'](handleEntityNotFound(_0x461f21,null))['then'](function(_0x3af9cb){if(_0x3af9cb){_0x147b3d['model']=_[_0xfdb3('0x62')](db[_0xfdb3('0x88')][_0xfdb3('0x4b')]);_0x147b3d[_0xfdb3('0x4e')]=_[_0xfdb3('0x62')](_0x1aac5d[_0xfdb3('0x4e')]);_0x147b3d['filters']=_[_0xfdb3('0x50')](_0x147b3d[_0xfdb3('0x4d')],_0x147b3d[_0xfdb3('0x4e')]);_0x5362f3[_0xfdb3('0x51')]=_[_0xfdb3('0x50')](_0x147b3d[_0xfdb3('0x4d')],qs['fields'](_0x1aac5d['query'][_0xfdb3('0x52')]));_0x5362f3[_0xfdb3('0x51')]=_0x5362f3['attributes'][_0xfdb3('0x6d')]?_0x5362f3['attributes']:_0x147b3d[_0xfdb3('0x4d')];if(!_0x1aac5d[_0xfdb3('0x4e')][_0xfdb3('0x6e')]('nolimit')){_0x5362f3['limit']=qs[_0xfdb3('0x23')](_0x1aac5d['query'][_0xfdb3('0x23')]);_0x5362f3[_0xfdb3('0x20')]=qs['offset'](_0x1aac5d[_0xfdb3('0x4e')]['offset']);}_0x5362f3['order']=qs[_0xfdb3('0x55')](_0x1aac5d['query']['sort']);_0x5362f3['where']=qs[_0xfdb3('0x4f')](_[_0xfdb3('0x57')](_0x1aac5d[_0xfdb3('0x4e')],_0x147b3d[_0xfdb3('0x4f')]));_0x5362f3[_0xfdb3('0x56')][_0xfdb3('0x75')]=_0x3af9cb['id'];if(_0x1aac5d[_0xfdb3('0x4e')][_0xfdb3('0x58')]){_0x5362f3[_0xfdb3('0x56')]=_[_0xfdb3('0x59')](_0x5362f3[_0xfdb3('0x56')],{'$or':_[_0xfdb3('0x49')](_0x5362f3['attributes'],function(_0x31f7bd){var _0x298985={};_0x298985[_0x31f7bd]={'$like':'%'+_0x1aac5d['query'][_0xfdb3('0x58')]+'%'};return _0x298985;})});}_0x5362f3=_[_0xfdb3('0x59')]({},_0x5362f3,_0x1aac5d[_0xfdb3('0x5c')]);return db['MailInteraction'][_0xfdb3('0x22')]({'where':_0x5362f3[_0xfdb3('0x56')]})[_0xfdb3('0x13')](function(_0x52d8e){_0x461408[_0xfdb3('0x22')]=_0x52d8e;if(_0x1aac5d[_0xfdb3('0x4e')][_0xfdb3('0x5d')]){_0x5362f3[_0xfdb3('0x5e')]=[{'model':db['CmContact'],'as':_0xfdb3('0x89'),'required':![]},{'model':db['User'],'as':_0xfdb3('0x8a'),'attributes':[_0xfdb3('0x2b'),'fullname',_0xfdb3('0x8b')],'required':![]},{'model':db['Tag'],'as':_0xfdb3('0x8c'),'attributes':['id','name',_0xfdb3('0x8d')],'where':_0x1aac5d[_0xfdb3('0x4e')]['tag']?{'id':_0x1aac5d[_0xfdb3('0x4e')][_0xfdb3('0x8e')]}:undefined,'required':_0x1aac5d[_0xfdb3('0x4e')]['tag']?!![]:![]}];}return db[_0xfdb3('0x88')][_0xfdb3('0x6f')](_0x5362f3);})[_0xfdb3('0x13')](function(_0x2a07d3){_0x461408[_0xfdb3('0x5f')]=_0x2a07d3;return _0x461408;});}})['then'](respondWithFilteredResult(_0x461f21,_0x5362f3))[_0xfdb3('0x1b')](handleError(_0x461f21,null));};exports[_0xfdb3('0x8f')]=function addApplications(_0x127f25,_0x74ee5e){var _0x59d213=_0x127f25['params']['id'];var _0x18e2df=_0x127f25['body'];var _0x2d9f95=0xc8;var _0x10c756=null;return db[_0xfdb3('0x90')][_0xfdb3('0x91')]({'isolationLevel':db['sequelize'][_0xfdb3('0x92')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x16d216){return db[_0xfdb3('0x4a')][_0xfdb3('0x6c')]({'where':{'id':_0x59d213},'transaction':_0x16d216})[_0xfdb3('0x13')](function(_0x169e9c){if(_0x169e9c){return db[_0xfdb3('0x93')][_0xfdb3('0x26')]({'where':{'MailAccountId':_0x59d213},'transaction':_0x16d216})[_0xfdb3('0x13')](function(){var _0x13c9f5=_[_0xfdb3('0x49')](_0x18e2df,function(_0x165c79){_0x165c79[_0xfdb3('0x75')]=_0x59d213;return _0x165c79;});return db[_0xfdb3('0x93')][_0xfdb3('0x94')](_0x13c9f5,{'transaction':_0x16d216});});}else{_0x2d9f95=0x194;_0x10c756=[];}});})[_0xfdb3('0x13')](function(){if(_0x2d9f95!==0x194){return db['MailApplication']['findAndCountAll']({'where':{'MailAccountId':_0x59d213},'order':_0xfdb3('0x95')})['then'](function(_0x5e3afc){_0x10c756=_0x5e3afc;});}})[_0xfdb3('0x1b')](function(_0x14437b){_0x2d9f95=0x1f4;logger[_0xfdb3('0x17')](_0x14437b[_0xfdb3('0x2a')]);if(_0x14437b[_0xfdb3('0x2b')]){delete _0x14437b[_0xfdb3('0x2b')];}_0x10c756=_0x14437b;})[_0xfdb3('0x96')](function(){if(_0x10c756===null){_0x74ee5e['sendStatus'](_0x2d9f95);}else{if(_0x2d9f95===0x1f4){_0x74ee5e[_0xfdb3('0x1d')](_0x2d9f95)[_0xfdb3('0x2c')](_0x10c756);}else{_0x74ee5e[_0xfdb3('0x1d')](_0x2d9f95)[_0xfdb3('0x1f')](_0x10c756);}}});};exports['getApplications']=function(_0x356cfc,_0x2099a9){var _0x1b7af8={};var _0x519e83={};var _0x30cb8e;var _0x54b2a2;return db['MailAccount'][_0xfdb3('0x6c')]({'where':{'id':_0x356cfc[_0xfdb3('0x61')]['id']}})[_0xfdb3('0x13')](handleEntityNotFound(_0x2099a9,null))[_0xfdb3('0x13')](function(_0x293ab3){if(_0x293ab3){_0x30cb8e=_0x293ab3;_0x519e83['model']=_[_0xfdb3('0x62')](db[_0xfdb3('0x93')][_0xfdb3('0x4b')]);_0x519e83[_0xfdb3('0x4e')]=_[_0xfdb3('0x62')](_0x356cfc[_0xfdb3('0x4e')]);_0x519e83[_0xfdb3('0x4f')]=_[_0xfdb3('0x50')](_0x519e83[_0xfdb3('0x4d')],_0x519e83['query']);_0x1b7af8[_0xfdb3('0x51')]=_[_0xfdb3('0x50')](_0x519e83[_0xfdb3('0x4d')],qs[_0xfdb3('0x52')](_0x356cfc[_0xfdb3('0x4e')][_0xfdb3('0x52')]));_0x1b7af8[_0xfdb3('0x51')]=_0x1b7af8[_0xfdb3('0x51')]['length']?_0x1b7af8[_0xfdb3('0x51')]:_0x519e83[_0xfdb3('0x4d')];_0x1b7af8['order']=qs[_0xfdb3('0x55')](_0x356cfc[_0xfdb3('0x4e')][_0xfdb3('0x55')]);_0x1b7af8[_0xfdb3('0x56')]=qs[_0xfdb3('0x4f')](_[_0xfdb3('0x57')](_0x356cfc['query'],_0x519e83['filters']));if(_0x356cfc[_0xfdb3('0x4e')]['filter']){_0x1b7af8[_0xfdb3('0x56')]=_['merge'](_0x1b7af8[_0xfdb3('0x56')],{'$or':_[_0xfdb3('0x49')](_0x1b7af8[_0xfdb3('0x51')],function(_0x417466){var _0x9f4655={};_0x9f4655[_0x417466]={'$like':'%'+_0x356cfc['query'][_0xfdb3('0x58')]+'%'};return _0x9f4655;})});}_0x1b7af8=_[_0xfdb3('0x59')]({},_0x1b7af8,_0x356cfc[_0xfdb3('0x5c')]);return _0x30cb8e['getApplications'](_0x1b7af8);}})[_0xfdb3('0x13')](function(_0x27b4e3){if(_0x27b4e3){_0x54b2a2=_0x27b4e3['length'];if(!_0x356cfc[_0xfdb3('0x4e')][_0xfdb3('0x6e')](_0xfdb3('0x53'))){_0x1b7af8['limit']=qs[_0xfdb3('0x23')](_0x356cfc[_0xfdb3('0x4e')][_0xfdb3('0x23')]);_0x1b7af8[_0xfdb3('0x20')]=qs['offset'](_0x356cfc[_0xfdb3('0x4e')]['offset']);}return _0x30cb8e[_0xfdb3('0x97')](_0x1b7af8);}})[_0xfdb3('0x13')](function(_0x236e11){if(_0x236e11){return _0x236e11?{'count':_0x54b2a2,'rows':_0x236e11}:null;}})['then'](respondWithResult(_0x2099a9,null))[_0xfdb3('0x1b')](handleError(_0x2099a9,null));};exports[_0xfdb3('0x98')]=function(_0x215cb2,_0x479d48){var _0x43548a={'raw':!![],'where':{}};var _0x158cbf={};var _0x8cb801={'count':0x0,'rows':[]};return db[_0xfdb3('0x4a')][_0xfdb3('0x6c')]({'where':{'id':_0x215cb2[_0xfdb3('0x61')]['id']}})[_0xfdb3('0x13')](handleEntityNotFound(_0x479d48,null))[_0xfdb3('0x13')](function(_0x1642df){if(_0x1642df){_0x158cbf[_0xfdb3('0x4d')]=_[_0xfdb3('0x62')](db[_0xfdb3('0x99')][_0xfdb3('0x4b')]);_0x158cbf[_0xfdb3('0x4e')]=_[_0xfdb3('0x62')](_0x215cb2['query']);_0x158cbf[_0xfdb3('0x4f')]=_[_0xfdb3('0x50')](_0x158cbf[_0xfdb3('0x4d')],_0x158cbf[_0xfdb3('0x4e')]);_0x43548a[_0xfdb3('0x51')]=_['intersection'](_0x158cbf['model'],qs[_0xfdb3('0x52')](_0x215cb2['query']['fields']));_0x43548a[_0xfdb3('0x51')]=_0x43548a[_0xfdb3('0x51')][_0xfdb3('0x6d')]?_0x43548a[_0xfdb3('0x51')]:_0x158cbf[_0xfdb3('0x4d')];if(!_0x215cb2[_0xfdb3('0x4e')][_0xfdb3('0x6e')](_0xfdb3('0x53'))){_0x43548a[_0xfdb3('0x23')]=qs[_0xfdb3('0x23')](_0x215cb2[_0xfdb3('0x4e')]['limit']);_0x43548a['offset']=qs[_0xfdb3('0x20')](_0x215cb2[_0xfdb3('0x4e')][_0xfdb3('0x20')]);}_0x43548a['order']=qs[_0xfdb3('0x55')](_0x215cb2[_0xfdb3('0x4e')]['sort']);_0x43548a['where']=qs[_0xfdb3('0x4f')](_[_0xfdb3('0x57')](_0x215cb2['query'],_0x158cbf[_0xfdb3('0x4f')]));_0x43548a['where'][_0xfdb3('0x75')]=_0x1642df['id'];if(_0x215cb2['query'][_0xfdb3('0x58')]){_0x43548a['where']=_['merge'](_0x43548a[_0xfdb3('0x56')],{'$or':_[_0xfdb3('0x49')](_0x43548a['attributes'],function(_0x2caf09){var _0x44993e={};_0x44993e[_0x2caf09]={'$like':'%'+_0x215cb2[_0xfdb3('0x4e')][_0xfdb3('0x58')]+'%'};return _0x44993e;})});}if(_0x215cb2[_0xfdb3('0x4e')][_0xfdb3('0x9a')]){var _0x2bb602=_0x215cb2['query']['$gte'][_0xfdb3('0x9b')](',');var _0x4597f3={};_0x4597f3[_0x2bb602[0x0]]={'$gte':moment(_0x2bb602[0x1])[_0xfdb3('0x9c')]('YYYY-MM-DD\x20HH:mm:ss')};_0x43548a['where']=_['merge'](_0x43548a[_0xfdb3('0x56')],_0x4597f3);}_0x43548a=_[_0xfdb3('0x59')]({},_0x43548a,_0x215cb2['options']);return db[_0xfdb3('0x99')][_0xfdb3('0x22')]({'where':_0x43548a[_0xfdb3('0x56')]})[_0xfdb3('0x13')](function(_0x38d953){_0x8cb801['count']=_0x38d953;if(_0x215cb2['query'][_0xfdb3('0x5d')]){_0x43548a['include']=[{'all':!![]}];}return db[_0xfdb3('0x99')]['findAll'](_0x43548a);})[_0xfdb3('0x13')](function(_0x53373b){if(_0x215cb2[_0xfdb3('0x4e')][_0xfdb3('0x9d')]===_0xfdb3('0x9e')){for(var _0xb016b1=0x0;_0xb016b1<_0x53373b[_0xfdb3('0x6d')];_0xb016b1++){_0x53373b[_0xb016b1][_0xfdb3('0x63')]=juice(_0x53373b[_0xb016b1][_0xfdb3('0x63')]);}}_0x8cb801[_0xfdb3('0x5f')]=_0x53373b;return _0x8cb801;});}})[_0xfdb3('0x13')](respondWithFilteredResult(_0x479d48,_0x43548a))[_0xfdb3('0x1b')](handleError(_0x479d48,null));};exports[_0xfdb3('0x2c')]=function(_0x3d8e09,_0x287fec){var _0x710cd7,_0x579c1e={},_0x322cba;if(_0x3d8e09[_0xfdb3('0x63')]['to']){_0x322cba=_0x3d8e09[_0xfdb3('0x63')]['to'][_0xfdb3('0x9b')](',')[0x0];}return db[_0xfdb3('0x4a')][_0xfdb3('0x71')]({'where':{'id':_0x3d8e09[_0xfdb3('0x61')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xfdb3('0x9f')],'as':_0xfdb3('0xa0'),'where':{'email':_0x322cba},'limit':0x1,'order':[[_0xfdb3('0xa1'),'DESC']]}]},{'model':db[_0xfdb3('0x46')],'as':_0xfdb3('0x44'),'raw':!![],'include':[{'model':db[_0xfdb3('0xa2')],'as':'CloudProvider','raw':!![]}]}]})[_0xfdb3('0x13')](handleEntityNotFound(_0x287fec,null))[_0xfdb3('0x13')](function(_0x31eeb0){if(!_0x31eeb0)return;_0x710cd7=_0x31eeb0;if(!_0x31eeb0[_0xfdb3('0x44')])throw new Error(_0xfdb3('0xa3'));if(_[_0xfdb3('0x79')](_0x3d8e09['body'][_0xfdb3('0xa4')])){_0x3d8e09[_0xfdb3('0x63')][_0xfdb3('0xa4')]=util[_0xfdb3('0x9c')](_0xfdb3('0xa5'),_0x31eeb0['name'],_0x31eeb0[_0xfdb3('0x78')]||_0x31eeb0[_0xfdb3('0x44')][_0xfdb3('0x42')]);}if(_0x3d8e09['body'][_0xfdb3('0xa6')]&&_0x3d8e09['body'][_0xfdb3('0xa6')][_0xfdb3('0x6d')]){for(var _0xfe12f0=0x0;_0xfe12f0<_0x3d8e09[_0xfdb3('0x63')]['attachments']['length'];_0xfe12f0+=0x1){_0x3d8e09[_0xfdb3('0x63')][_0xfdb3('0xa6')][_0xfe12f0]={'filename':_0x3d8e09[_0xfdb3('0x63')][_0xfdb3('0xa6')][_0xfe12f0][_0xfdb3('0x2b')],'path':path[_0xfdb3('0xa7')](config[_0xfdb3('0xa8')],'server/files/attachments',_0x3d8e09[_0xfdb3('0x63')][_0xfdb3('0xa6')][_0xfe12f0][_0xfdb3('0xa9')])};}}var _0x20806b=_0x31eeb0[_0xfdb3('0xaa')]();return respondWithRpcPromise(_0xfdb3('0xab'),_0xfdb3('0xac'),{'account':_0x20806b,'message':_0x3d8e09[_0xfdb3('0x63')]});})[_0xfdb3('0x13')](function(_0x18c85e){if(!_0x18c85e)return;_0x579c1e=_0x18c85e;if(!_0x710cd7['List'])throw new Error(_0xfdb3('0xad'));if(_0x710cd7[_0xfdb3('0xae')][_0xfdb3('0xa0')][_0xfdb3('0x6d')])return _0x710cd7['List'][_0xfdb3('0xa0')][0x0];return db[_0xfdb3('0x9f')]['create'](_['defaults'](_0x3d8e09[_0xfdb3('0x63')],{'firstName':_0x3d8e09[_0xfdb3('0x63')]['to'],'email':_0x3d8e09[_0xfdb3('0x63')]['to'],'phone':_0x3d8e09[_0xfdb3('0x63')]['to'],'ListId':_0x710cd7[_0xfdb3('0xaf')]}));})[_0xfdb3('0x13')](function(_0x5edaf4){if(!_0x5edaf4)return;var _0x15434b={'UserId':_0x3d8e09[_0xfdb3('0x42')]['id'],'ContactId':_0x5edaf4['id'],'MailAccountId':_0x710cd7['id'],'inReplyTo':_0x579c1e[_0xfdb3('0xb0')],'to':_0x3d8e09[_0xfdb3('0x63')][_0xfdb3('0xa4')],'cc':_0x3d8e09[_0xfdb3('0x63')]['cc'],'subject':_0x3d8e09[_0xfdb3('0x63')][_0xfdb3('0xb1')],'attach':_0x3d8e09[_0xfdb3('0x63')][_0xfdb3('0xb2')],'firstMsgDirection':_0xfdb3('0xb3'),'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'out','Messages':[_['merge'](_0x3d8e09[_0xfdb3('0x63')],{'messageId':_0x579c1e['messageId'],'sentAt':moment()[_0xfdb3('0x9c')](_0xfdb3('0xb4')),'read':!![],'MailAccountId':_0x710cd7['id'],'UserId':_0x3d8e09[_0xfdb3('0x42')]['id'],'ContactId':_0x5edaf4['id']})]};if(_0x3d8e09['body']['Interaction']){_0x15434b=_[_0xfdb3('0x59')](_0x15434b,_0x3d8e09[_0xfdb3('0x63')]['Interaction']);}return db[_0xfdb3('0x88')][_0xfdb3('0x6a')](_0x15434b,{'include':[{'model':db[_0xfdb3('0x99')],'as':_0xfdb3('0xb5')}]});})['then'](respondWithResult(_0x287fec,null))[_0xfdb3('0x1b')](handleError(_0x287fec,null));};exports[_0xfdb3('0xb6')]=function(_0x31ded1,_0x238e9e){return db[_0xfdb3('0x4a')][_0xfdb3('0x71')]({'where':{'id':_0x31ded1[_0xfdb3('0x61')]['id']},'include':[{'model':db[_0xfdb3('0x46')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})[_0xfdb3('0x13')](handleEntityNotFound(_0x238e9e,null))[_0xfdb3('0x13')](function(_0x39e82b){if(!_0x39e82b[_0xfdb3('0x44')])return;var _0x2f0635=_0x39e82b['getSmtpOptions']();return respondWithRpcPromise(_0xfdb3('0xb7'),_0xfdb3('0xb6'),{'account':_0x2f0635});})['then'](respondWithResult(_0x238e9e,null))['catch'](handleError(_0x238e9e,null));};exports[_0xfdb3('0x26')]=function(_0x3ecd4f,_0x53b0f1){return db['MailAccount']['find']({'where':{'id':_0x3ecd4f[_0xfdb3('0x61')]['id']}})[_0xfdb3('0x13')](handleEntityNotFound(_0x53b0f1,null))[_0xfdb3('0x13')](function(_0x43f4ca){if(_0x43f4ca&&_0x43f4ca['service']){throw new db[(_0xfdb3('0xb8'))]['ValidationError'](_0xfdb3('0xb9'));}return _0x43f4ca;})['then'](removeEntity(_0x53b0f1,null))[_0xfdb3('0x1b')](handleError(_0x53b0f1,null));};exports[_0xfdb3('0xba')]=function(_0x3b4a5e,_0x29af31){return db['MailAccount'][_0xfdb3('0x71')]({'where':{'id':_0x3b4a5e[_0xfdb3('0x61')]['id']}})['then'](handleEntityNotFound(_0x29af31,null))['then'](function(_0x2894ea){if(_0x2894ea){return _0x2894ea[_0xfdb3('0xba')](_0x3b4a5e[_0xfdb3('0x63')][_0xfdb3('0x72')],_[_0xfdb3('0x87')](_0x3b4a5e['body'],['ids','id'])||{})[_0xfdb3('0xbb')](function(_0x20ce89){for(var _0x41f4c1=0x0;_0x41f4c1<_0x3b4a5e[_0xfdb3('0x63')]['ids']['length'];_0x41f4c1+=0x1){socket['emit']('userMailAccount:save',{'UserId':Number(_0x3b4a5e[_0xfdb3('0x63')][_0xfdb3('0x72')][_0x41f4c1]),'MailAccountId':Number(_0x3b4a5e['params']['id'])});}return _0x20ce89;});}})['then'](respondWithResult(_0x29af31,null))[_0xfdb3('0x1b')](handleError(_0x29af31,null));};exports['removeAgents']=function(_0x54cb31,_0x44d0a3){return db['MailAccount'][_0xfdb3('0x71')]({'where':{'id':_0x54cb31[_0xfdb3('0x61')]['id']}})[_0xfdb3('0x13')](handleEntityNotFound(_0x44d0a3,null))[_0xfdb3('0x13')](function(_0x93a986){if(_0x93a986){return _0x93a986['removeAgents'](_0x54cb31[_0xfdb3('0x4e')][_0xfdb3('0x72')])[_0xfdb3('0x13')](function(){if(_[_0xfdb3('0xbc')](_0x54cb31['query']['ids'])){for(var _0x2918f1=0x0;_0x2918f1<_0x54cb31[_0xfdb3('0x4e')][_0xfdb3('0x72')][_0xfdb3('0x6d')];_0x2918f1+=0x1){socket['emit'](_0xfdb3('0xbd'),{'UserId':Number(_0x54cb31[_0xfdb3('0x4e')][_0xfdb3('0x72')][_0x2918f1]),'MailAccountId':Number(_0x54cb31[_0xfdb3('0x61')]['id'])});}}else{socket['emit']('userMailAccount:remove',{'UserId':Number(_0x54cb31['query'][_0xfdb3('0x72')]),'MailAccountId':Number(_0x54cb31[_0xfdb3('0x61')]['id'])});}});}})['then'](respondWithStatusCode(_0x44d0a3,null))[_0xfdb3('0x1b')](handleError(_0x44d0a3,null));};exports[_0xfdb3('0xbe')]=function(_0x8b85c1,_0x3292fe){var _0xc4fd27={};var _0x1d6b28={};var _0x522b1b;var _0x27e5ce;return db[_0xfdb3('0x4a')]['findOne']({'where':{'id':_0x8b85c1['params']['id']}})[_0xfdb3('0x13')](handleEntityNotFound(_0x3292fe,null))[_0xfdb3('0x13')](function(_0x1efe48){if(_0x1efe48){_0x522b1b=_0x1efe48;_0x1d6b28['model']=_[_0xfdb3('0x62')](db['User'][_0xfdb3('0x4b')]);_0x1d6b28[_0xfdb3('0x4e')]=_[_0xfdb3('0x62')](_0x8b85c1[_0xfdb3('0x4e')]);_0x1d6b28[_0xfdb3('0x4f')]=_[_0xfdb3('0x50')](_0x1d6b28[_0xfdb3('0x4d')],_0x1d6b28[_0xfdb3('0x4e')]);_0xc4fd27['attributes']=_[_0xfdb3('0x50')](_0x1d6b28[_0xfdb3('0x4d')],qs[_0xfdb3('0x52')](_0x8b85c1[_0xfdb3('0x4e')][_0xfdb3('0x52')]));_0xc4fd27[_0xfdb3('0x51')]=_0xc4fd27[_0xfdb3('0x51')][_0xfdb3('0x6d')]?_0xc4fd27[_0xfdb3('0x51')]:_0x1d6b28[_0xfdb3('0x4d')];_0xc4fd27['order']=qs['sort'](_0x8b85c1[_0xfdb3('0x4e')]['sort']);_0xc4fd27[_0xfdb3('0x56')]=qs['filters'](_[_0xfdb3('0x57')](_0x8b85c1[_0xfdb3('0x4e')],_0x1d6b28[_0xfdb3('0x4f')]));if(_0x8b85c1[_0xfdb3('0x4e')][_0xfdb3('0x58')]){_0xc4fd27[_0xfdb3('0x56')]=_[_0xfdb3('0x59')](_0xc4fd27[_0xfdb3('0x56')],{'$or':_[_0xfdb3('0x49')](_0xc4fd27['attributes'],function(_0x1c4277){var _0x1181f5={};_0x1181f5[_0x1c4277]={'$like':'%'+_0x8b85c1[_0xfdb3('0x4e')][_0xfdb3('0x58')]+'%'};return _0x1181f5;})});}_0xc4fd27=_[_0xfdb3('0x59')]({},_0xc4fd27,_0x8b85c1[_0xfdb3('0x5c')]);return _0x522b1b['getAgents'](_0xc4fd27);}})['then'](function(_0xa7c3c){if(_0xa7c3c){_0x27e5ce=_0xa7c3c['length'];if(!_0x8b85c1[_0xfdb3('0x4e')]['hasOwnProperty'](_0xfdb3('0x53'))){_0xc4fd27[_0xfdb3('0x23')]=qs[_0xfdb3('0x23')](_0x8b85c1[_0xfdb3('0x4e')][_0xfdb3('0x23')]);_0xc4fd27['offset']=qs['offset'](_0x8b85c1['query'][_0xfdb3('0x20')]);}return _0x522b1b['getAgents'](_0xc4fd27);}})[_0xfdb3('0x13')](function(_0x5bf77c){if(_0x5bf77c){return _0x5bf77c?{'count':_0x27e5ce,'rows':_0x5bf77c}:null;}})[_0xfdb3('0x13')](respondWithResult(_0x3292fe,null))[_0xfdb3('0x1b')](handleError(_0x3292fe,null));}; \ No newline at end of file +var _0x212c=['MailAccounts','UserProfileResource','destroy','stack','name','send','gmail','imap.gmail.com','imap.mail.yahoo.com','hotmail','outlook365','Unknown\x20email\x20service\x20provider','smtp.gmail.com','yahoo','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','port','host','secure','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','VIRTUAL','merge','MailAccount','include','show','params','length','options','body','provider','custom','Mail\x20Account\x20not\x20found','describe','addDisposition','find','MailAccountId','Disposition','create','getDispositions','findOne','hasOwnProperty','findAll','rows','ids','addAnswer','CannedAnswer','getAnswers','pick','includeAll','removeAnswers','key','email','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tags','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','finally','getApplications','MailMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','true','updatedAt','DESC','CloudProvider','from','format','%s\x20<%s>','attachments','root','server/files/attachments','basename','SendMail','sendMail','List','List\x20not\x20found','Contacts','ListId','messageId','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','removeAgents','isArray','emit','userMailAccount:remove','getAgents','moment','bluebird','util','path','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','update','get'];(function(_0xe60ec0,_0x2ce97a){var _0x2e5e3c=function(_0xb321b4){while(--_0xb321b4){_0xe60ec0['push'](_0xe60ec0['shift']());}};_0x2e5e3c(++_0x2ce97a);}(_0x212c,0x15d));var _0xc212=function(_0x2d012f,_0x3ba679){_0x2d012f=_0x2d012f-0x0;var _0x3a9b9a=_0x212c[_0x2d012f];return _0x3a9b9a;};'use strict';var moment=require(_0xc212('0x0'));var BPromise=require(_0xc212('0x1'));var util=require(_0xc212('0x2'));var path=require(_0xc212('0x3'));var _=require('lodash');var juice=require('juice');var Redis=require(_0xc212('0x4'));var qs=require(_0xc212('0x5'));var logger=require(_0xc212('0x6'))(_0xc212('0x7'));var config=require(_0xc212('0x8'));var db=require('../../mysqldb')['db'];config[_0xc212('0x9')]=_[_0xc212('0xa')](config[_0xc212('0x9')],{'host':_0xc212('0xb'),'port':0x18eb});var socket=require(_0xc212('0xc'))(new Redis(config['redis']));require(_0xc212('0xd'))[_0xc212('0xe')](socket);var jayson=require(_0xc212('0xf'));var client=jayson[_0xc212('0x10')][_0xc212('0x11')]({'port':0x232b});function respondWithRpcPromise(_0x9124cb,_0x3e8ee9,_0xa6143e,_0x16cb47){return new BPromise(function(_0x3d21a4,_0xa764da){var _0x4fdacf=_0x16cb47||client;return _0x4fdacf[_0xc212('0x12')](_0x9124cb,_0xa6143e)[_0xc212('0x13')](function(_0x56e4d9){logger[_0xc212('0x14')](_0xc212('0x15'),_0x3e8ee9,_0xc212('0x16'));logger['debug'](_0xc212('0x17'),_0x3e8ee9,_0xc212('0x16'),JSON[_0xc212('0x18')](_0x56e4d9));if(_0x56e4d9[_0xc212('0x19')]){if(_0x56e4d9[_0xc212('0x19')][_0xc212('0x1a')]===0x1f4){logger[_0xc212('0x19')](_0xc212('0x15'),_0x3e8ee9,_0x56e4d9[_0xc212('0x19')]['message']);return _0xa764da(_0x56e4d9['error'][_0xc212('0x1b')]);}logger[_0xc212('0x19')](_0xc212('0x15'),_0x3e8ee9,_0x56e4d9[_0xc212('0x19')][_0xc212('0x1b')]);return _0x3d21a4(_0x56e4d9[_0xc212('0x19')][_0xc212('0x1b')]);}else{logger[_0xc212('0x14')](_0xc212('0x15'),_0x3e8ee9,_0xc212('0x16'));_0x3d21a4(_0x56e4d9['result']['message']);}})[_0xc212('0x1c')](function(_0x169015){logger[_0xc212('0x19')]('MailAccount,\x20%s,\x20%s',_0x3e8ee9,_0x169015);_0xa764da(_0x169015);});});}function respondWithStatusCode(_0x34a6cc,_0x558a80){_0x558a80=_0x558a80||0xcc;return function(_0x4286e8){if(_0x4286e8){return _0x34a6cc[_0xc212('0x1d')](_0x558a80);}return _0x34a6cc['status'](_0x558a80)[_0xc212('0x1e')]();};}function respondWithResult(_0x3c39dc,_0x7b232d){_0x7b232d=_0x7b232d||0xc8;return function(_0x320c7b){if(_0x320c7b){return _0x3c39dc[_0xc212('0x1f')](_0x7b232d)[_0xc212('0x20')](_0x320c7b);}};}function respondWithFilteredResult(_0xae799e,_0x5d913b){return function(_0x1a04fa){if(_0x1a04fa){var _0x1bd40c=typeof _0x5d913b[_0xc212('0x21')]===_0xc212('0x22')&&typeof _0x5d913b['limit']===_0xc212('0x22');var _0x4ed2f5=_0x1a04fa[_0xc212('0x23')];var _0x6c2c4=_0x1bd40c?0x0:_0x5d913b['offset'];var _0x526f79=_0x1bd40c?_0x1a04fa[_0xc212('0x23')]:_0x5d913b['offset']+_0x5d913b[_0xc212('0x24')];var _0x58463d;if(_0x526f79>=_0x4ed2f5){_0x526f79=_0x4ed2f5;_0x58463d=0xc8;}else{_0x58463d=0xce;}_0xae799e[_0xc212('0x1f')](_0x58463d);return _0xae799e[_0xc212('0x25')](_0xc212('0x26'),_0x6c2c4+'-'+_0x526f79+'/'+_0x4ed2f5)[_0xc212('0x20')](_0x1a04fa);}return null;};}function saveUpdates(_0x390a3e){return function(_0x54aba7){if(_0x54aba7){return _0x54aba7[_0xc212('0x27')](_0x390a3e)['then'](function(_0xc0773c){return _0xc0773c;});}return null;};}function removeEntity(_0x59e54f){return function(_0x5e861e){if(_0x5e861e){return _0x5e861e['destroy']()[_0xc212('0x13')](function(){var _0x1060c3=_0x5e861e[_0xc212('0x28')]({'plain':!![]});var _0x1384b2=_0xc212('0x29');return db[_0xc212('0x2a')][_0xc212('0x2b')]({'where':{'type':_0x1384b2,'resourceId':_0x1060c3['id']}})['then'](function(){return _0x5e861e;});})['then'](function(){_0x59e54f[_0xc212('0x1f')](0xcc)[_0xc212('0x1e')]();});}};}function handleEntityNotFound(_0x1c0a00){return function(_0x381ffb){if(!_0x381ffb){_0x1c0a00[_0xc212('0x1d')](0x194);}return _0x381ffb;};}function handleError(_0x61f088,_0x5aaae6){_0x5aaae6=_0x5aaae6||0x1f4;return function(_0x5435bb){logger[_0xc212('0x19')](_0x5435bb[_0xc212('0x2c')]);if(_0x5435bb[_0xc212('0x2d')]){delete _0x5435bb[_0xc212('0x2d')];}_0x61f088[_0xc212('0x1f')](_0x5aaae6)[_0xc212('0x2e')](_0x5435bb);};}function getImapHost(_0x424371){switch(_0x424371){case _0xc212('0x2f'):return _0xc212('0x30');case'yahoo':return _0xc212('0x31');case _0xc212('0x32'):return'imap-mail.outlook.com';case _0xc212('0x33'):return'outlook.office365.com';}throw new Error(_0xc212('0x34'),_0x424371);}function getSmtpHost(_0x1e6f2d){switch(_0x1e6f2d){case'gmail':return _0xc212('0x35');case _0xc212('0x36'):return'smtp.mail.yahoo.com';case'hotmail':return'smtp-mail.outlook.com';case _0xc212('0x33'):return _0xc212('0x37');}throw new Error(_0xc212('0x34'),_0x1e6f2d);}function getAuthenticationOptions(_0x5998aa,_0x730e5f){var _0x209d85={};var _0x416096={};if(_0x5998aa){_0x209d85['user']=_0x416096[_0xc212('0x38')]=_0x730e5f[_0xc212('0x39')];_0x209d85[_0xc212('0x3a')]=_0x416096[_0xc212('0x3b')]=_0x730e5f[_0xc212('0x3a')];if(_0x730e5f[_0xc212('0x3c')]){_0x209d85[_0xc212('0x3c')]=_0x416096['modernAuthentication']=!![];_0x209d85[_0xc212('0x3d')]=_0x416096[_0xc212('0x3d')]=_0x730e5f[_0xc212('0x3d')];_0x209d85[_0xc212('0x3a')]=_0x416096[_0xc212('0x3b')]=null;}else{_0x209d85[_0xc212('0x3d')]=_0x416096['CloudProviderId']=null;}_0x209d85['host']=getImapHost(_0x5998aa);_0x209d85[_0xc212('0x3e')]=0x3e1;_0x416096[_0xc212('0x3f')]=getSmtpHost(_0x5998aa);_0x416096[_0xc212('0x3e')]=0x24b;_0x416096[_0xc212('0x40')]=![];_0x209d85[_0xc212('0x41')]=_0x416096['service']=null;}else{if(_0x730e5f[_0xc212('0x42')]){_0x209d85['user']=_0x416096[_0xc212('0x38')]=_0x730e5f[_0xc212('0x39')];_0x209d85[_0xc212('0x3a')]=_0x416096[_0xc212('0x3b')]=_0x730e5f['password'];}else{_0x209d85[_0xc212('0x42')]=_0x416096[_0xc212('0x42')]=![];_0x209d85[_0xc212('0x38')]=_0x416096[_0xc212('0x38')]=null;_0x209d85['password']=_0x416096['pass']=null;}_0x209d85[_0xc212('0x3f')]=_0x730e5f['Imap'][_0xc212('0x3f')];_0x209d85['port']=_0x730e5f[_0xc212('0x43')]['port'];_0x416096[_0xc212('0x3f')]=_0x730e5f[_0xc212('0x44')][_0xc212('0x3f')];_0x416096['port']=_0x730e5f[_0xc212('0x44')]['port'];}return{'Imap':_0x209d85,'Smtp':_0x416096};}exports[_0xc212('0x45')]=function(_0x478b08,_0x102c0e){var _0x35d791={'include':[{'model':db[_0xc212('0x46')],'as':_0xc212('0x43')},{'model':db[_0xc212('0x47')],'as':_0xc212('0x44')},{'model':db[_0xc212('0x48')],'as':_0xc212('0x49')}]},_0x3b7e45={},_0x4d1f29={'count':0x0,'rows':[]};var _0x36d6d7=_[_0xc212('0x4a')](db['MailAccount'][_0xc212('0x4b')],function(_0x4ef3a0){return{'name':_0x4ef3a0[_0xc212('0x4c')],'type':_0x4ef3a0['type']['key']};});_0x3b7e45[_0xc212('0x4d')]=_[_0xc212('0x4a')](_0x36d6d7,_0xc212('0x2d'));_0x3b7e45[_0xc212('0x4e')]=_[_0xc212('0x4f')](_0x478b08['query']);_0x3b7e45[_0xc212('0x50')]=_[_0xc212('0x51')](_0x3b7e45['model'],_0x3b7e45[_0xc212('0x4e')]);_0x35d791[_0xc212('0x52')]=_[_0xc212('0x51')](_0x3b7e45[_0xc212('0x4d')],qs[_0xc212('0x53')](_0x478b08[_0xc212('0x4e')]['fields']));_0x35d791[_0xc212('0x52')]=_0x35d791[_0xc212('0x52')]['length']?_0x35d791[_0xc212('0x52')]:_0x3b7e45[_0xc212('0x4d')];if(!_0x478b08[_0xc212('0x4e')]['hasOwnProperty'](_0xc212('0x54'))){_0x35d791[_0xc212('0x24')]=qs[_0xc212('0x24')](_0x478b08[_0xc212('0x4e')][_0xc212('0x24')]);_0x35d791[_0xc212('0x21')]=qs['offset'](_0x478b08[_0xc212('0x4e')][_0xc212('0x21')]);}_0x35d791[_0xc212('0x55')]=qs[_0xc212('0x56')](_0x478b08[_0xc212('0x4e')][_0xc212('0x56')]);_0x35d791[_0xc212('0x57')]=qs[_0xc212('0x50')](_['pick'](_0x478b08[_0xc212('0x4e')],_0x3b7e45[_0xc212('0x50')]),_0x36d6d7);if(_0x478b08['query'][_0xc212('0x58')]){_0x35d791[_0xc212('0x57')]=_['merge'](_0x35d791[_0xc212('0x57')],{'$or':_[_0xc212('0x4a')](_0x36d6d7,function(_0x55f165){if(_0x55f165['type']!==_0xc212('0x59')){var _0x5b8c0a={};_0x5b8c0a[_0x55f165[_0xc212('0x2d')]]={'$like':'%'+_0x478b08[_0xc212('0x4e')][_0xc212('0x58')]+'%'};return _0x5b8c0a;}})});}_0x35d791=_[_0xc212('0x5a')]({},_0x35d791,_0x478b08['options']);var _0x462f34={'where':_0x35d791[_0xc212('0x57')]};return db[_0xc212('0x5b')]['count'](_0x462f34)[_0xc212('0x13')](function(_0x5b81ff){_0x4d1f29[_0xc212('0x23')]=_0x5b81ff;if(_0x478b08[_0xc212('0x4e')]['includeAll']){_0x35d791[_0xc212('0x5c')]=[{'all':!![]}];}return db['MailAccount']['findAll'](_0x35d791);})[_0xc212('0x13')](function(_0x4e38b8){_0x4d1f29['rows']=_0x4e38b8;return _0x4d1f29;})[_0xc212('0x13')](respondWithFilteredResult(_0x102c0e,_0x35d791))['catch'](handleError(_0x102c0e,null));};exports[_0xc212('0x5d')]=function(_0x2d00c8,_0xf085db){var _0x124397={'raw':![],'where':{'id':_0x2d00c8[_0xc212('0x5e')]['id']},'include':[{'model':db[_0xc212('0x46')],'as':'Imap'},{'model':db[_0xc212('0x47')],'as':'Smtp'},{'model':db[_0xc212('0x48')],'as':_0xc212('0x49')}]},_0x2ab0f9={};_0x2ab0f9[_0xc212('0x4d')]=_[_0xc212('0x4f')](db[_0xc212('0x5b')][_0xc212('0x4b')]);_0x2ab0f9[_0xc212('0x4e')]=_[_0xc212('0x4f')](_0x2d00c8['query']);_0x2ab0f9['filters']=_[_0xc212('0x51')](_0x2ab0f9[_0xc212('0x4d')],_0x2ab0f9['query']);_0x124397['attributes']=_['intersection'](_0x2ab0f9[_0xc212('0x4d')],qs[_0xc212('0x53')](_0x2d00c8[_0xc212('0x4e')]['fields']));_0x124397['attributes']=_0x124397[_0xc212('0x52')][_0xc212('0x5f')]?_0x124397[_0xc212('0x52')]:_0x2ab0f9[_0xc212('0x4d')];if(_0x2d00c8[_0xc212('0x4e')]['includeAll']){_0x124397['include']=[{'all':!![]}];}_0x124397=_[_0xc212('0x5a')]({},_0x124397,_0x2d00c8[_0xc212('0x60')]);return db[_0xc212('0x5b')]['find'](_0x124397)['then'](handleEntityNotFound(_0xf085db,null))[_0xc212('0x13')](respondWithResult(_0xf085db,null))[_0xc212('0x1c')](handleError(_0xf085db,null));};exports['update']=function(_0x557ac2,_0x4d4e01){if(_0x557ac2[_0xc212('0x61')]['id']){delete _0x557ac2[_0xc212('0x61')]['id'];}var _0x3836b4=_0x557ac2['body'][_0xc212('0x62')]===_0xc212('0x63')?null:_0x557ac2[_0xc212('0x61')][_0xc212('0x62')];var _0x508217=_0x557ac2[_0xc212('0x61')][_0xc212('0x43')]||{};var _0x583019=_0x557ac2[_0xc212('0x61')]['Smtp']||{};if(_0x3836b4){_0x508217[_0xc212('0x3f')]=getImapHost(_0x3836b4);_0x508217[_0xc212('0x3e')]=0x3e1;_0x583019[_0xc212('0x3f')]=getSmtpHost(_0x3836b4);_0x583019[_0xc212('0x3e')]=0x24b;_0x583019['secure']=![];}if(_0x583019[_0xc212('0x3c')]){_0x583019[_0xc212('0x40')]=![];}else{_0x583019[_0xc212('0x3d')]=null;}if(!_0x508217['modernAuthentication'])_0x508217['CloudProviderId']=null;_0x557ac2['body'][_0xc212('0x43')]=_0x508217;_0x557ac2[_0xc212('0x61')][_0xc212('0x44')]=_0x583019;return db[_0xc212('0x5b')]['find']({'where':{'id':_0x557ac2[_0xc212('0x5e')]['id']},'include':[{'model':db['MailServerIn'],'as':_0xc212('0x43')},{'model':db[_0xc212('0x47')],'as':_0xc212('0x44')},{'model':db[_0xc212('0x48')],'as':'mandatoryDispositionPause'}]})[_0xc212('0x13')](handleEntityNotFound(_0x4d4e01,null))[_0xc212('0x13')](function(_0x54ecdf){if(!_0x54ecdf)throw new Error(_0xc212('0x64'));if(_0x54ecdf[_0xc212('0x41')])delete _0x557ac2[_0xc212('0x61')]['Imap'];return _0x54ecdf;})['then'](saveUpdates(_0x557ac2[_0xc212('0x61')],null))[_0xc212('0x13')](function(_0x30ac5e){if(!_0x557ac2[_0xc212('0x61')][_0xc212('0x43')])return _0x30ac5e;return db['MailServerIn'][_0xc212('0x27')](_0x557ac2[_0xc212('0x61')]['Imap'],{'where':{'MailAccountId':_0x30ac5e['id']}})[_0xc212('0x13')](function(){return _0x30ac5e;});})[_0xc212('0x13')](function(_0x7444e5){if(!_0x557ac2['body'][_0xc212('0x44')])return _0x7444e5;return db[_0xc212('0x47')]['update'](_0x557ac2[_0xc212('0x61')][_0xc212('0x44')],{'where':{'MailAccountId':_0x7444e5['id']}})[_0xc212('0x13')](function(){return _0x7444e5;});})[_0xc212('0x13')](respondWithResult(_0x4d4e01,null))[_0xc212('0x1c')](handleError(_0x4d4e01,null));};exports[_0xc212('0x65')]=function(_0x5f293b,_0x4e8de8){return db[_0xc212('0x5b')]['describe']()[_0xc212('0x13')](respondWithResult(_0x4e8de8,null))[_0xc212('0x1c')](handleError(_0x4e8de8,null));};exports[_0xc212('0x66')]=function(_0x3e39be,_0x4a0304){if(_0x3e39be[_0xc212('0x61')]['id']){delete _0x3e39be[_0xc212('0x61')]['id'];}return db[_0xc212('0x5b')][_0xc212('0x67')]({'where':{'id':_0x3e39be['params']['id']}})[_0xc212('0x13')](handleEntityNotFound(_0x4a0304,null))[_0xc212('0x13')](function(_0x5d0b2d){if(_0x5d0b2d){_0x3e39be[_0xc212('0x61')][_0xc212('0x68')]=_0x5d0b2d['id'];return db[_0xc212('0x69')][_0xc212('0x6a')](_0x3e39be[_0xc212('0x61')]);}})[_0xc212('0x13')](respondWithResult(_0x4a0304,null))[_0xc212('0x1c')](handleError(_0x4a0304,null));};exports[_0xc212('0x6b')]=function(_0x468c99,_0x5efd1a){var _0x46f9c0={'raw':![],'where':{}};var _0x551d4f={};var _0x33e902={'count':0x0,'rows':[]};return db['MailAccount'][_0xc212('0x6c')]({'where':{'id':_0x468c99[_0xc212('0x5e')]['id']}})[_0xc212('0x13')](handleEntityNotFound(_0x5efd1a,null))[_0xc212('0x13')](function(_0x535756){if(_0x535756){_0x551d4f[_0xc212('0x4d')]=_['keys'](db[_0xc212('0x69')][_0xc212('0x4b')]);_0x551d4f['query']=_[_0xc212('0x4f')](_0x468c99[_0xc212('0x4e')]);_0x551d4f[_0xc212('0x50')]=_['intersection'](_0x551d4f[_0xc212('0x4d')],_0x551d4f[_0xc212('0x4e')]);_0x46f9c0[_0xc212('0x52')]=_['intersection'](_0x551d4f[_0xc212('0x4d')],qs[_0xc212('0x53')](_0x468c99[_0xc212('0x4e')][_0xc212('0x53')]));_0x46f9c0['attributes']=_0x46f9c0[_0xc212('0x52')][_0xc212('0x5f')]?_0x46f9c0[_0xc212('0x52')]:_0x551d4f[_0xc212('0x4d')];if(!_0x468c99[_0xc212('0x4e')][_0xc212('0x6d')]('nolimit')){_0x46f9c0[_0xc212('0x24')]=qs[_0xc212('0x24')](_0x468c99[_0xc212('0x4e')][_0xc212('0x24')]);_0x46f9c0[_0xc212('0x21')]=qs[_0xc212('0x21')](_0x468c99[_0xc212('0x4e')][_0xc212('0x21')]);}_0x46f9c0[_0xc212('0x55')]=qs['sort'](_0x468c99[_0xc212('0x4e')]['sort']);_0x46f9c0['where']=qs[_0xc212('0x50')](_['pick'](_0x468c99[_0xc212('0x4e')],_0x551d4f[_0xc212('0x50')]));_0x46f9c0['where']['MailAccountId']=_0x535756['id'];if(_0x468c99['query'][_0xc212('0x58')]){_0x46f9c0['where']=_[_0xc212('0x5a')](_0x46f9c0[_0xc212('0x57')],{'$or':_['map'](_0x46f9c0[_0xc212('0x52')],function(_0xde2a28){var _0x221d9d={};_0x221d9d[_0xde2a28]={'$like':'%'+_0x468c99[_0xc212('0x4e')][_0xc212('0x58')]+'%'};return _0x221d9d;})});}_0x46f9c0=_['merge']({},_0x46f9c0,_0x468c99['options']);return db[_0xc212('0x69')]['count']({'where':_0x46f9c0[_0xc212('0x57')]})[_0xc212('0x13')](function(_0x53124f){_0x33e902[_0xc212('0x23')]=_0x53124f;if(_0x468c99[_0xc212('0x4e')]['includeAll']){_0x46f9c0['include']=[{'all':!![]}];}return db[_0xc212('0x69')][_0xc212('0x6e')](_0x46f9c0);})[_0xc212('0x13')](function(_0x1f2232){_0x33e902[_0xc212('0x6f')]=_0x1f2232;return _0x33e902;});}})[_0xc212('0x13')](respondWithFilteredResult(_0x5efd1a,_0x46f9c0))['catch'](handleError(_0x5efd1a,null));};exports['removeDispositions']=function(_0x15bc38,_0x54a370){return db[_0xc212('0x5b')][_0xc212('0x67')]({'where':{'id':_0x15bc38[_0xc212('0x5e')]['id']}})[_0xc212('0x13')](handleEntityNotFound(_0x54a370,null))[_0xc212('0x13')](function(_0x4ca87e){if(_0x4ca87e){return _0x4ca87e['removeDispositions'](_0x15bc38[_0xc212('0x4e')][_0xc212('0x70')]);}})[_0xc212('0x13')](respondWithStatusCode(_0x54a370,null))['catch'](handleError(_0x54a370,null));};exports[_0xc212('0x71')]=function(_0x3b3c62,_0x2c385c){if(_0x3b3c62['body']['id']){delete _0x3b3c62[_0xc212('0x61')]['id'];}return db[_0xc212('0x5b')]['find']({'where':{'id':_0x3b3c62[_0xc212('0x5e')]['id']}})[_0xc212('0x13')](handleEntityNotFound(_0x2c385c,null))['then'](function(_0x4cd896){if(_0x4cd896){_0x3b3c62[_0xc212('0x61')][_0xc212('0x68')]=_0x4cd896['id'];return db[_0xc212('0x72')]['create'](_0x3b3c62[_0xc212('0x61')]);}})[_0xc212('0x13')](respondWithResult(_0x2c385c,null))[_0xc212('0x1c')](handleError(_0x2c385c,null));};exports[_0xc212('0x73')]=function(_0x255151,_0x24dc8a){var _0x2d59ae={'raw':![],'where':{}};var _0xa50037={};var _0x5677d3={'count':0x0,'rows':[]};return db[_0xc212('0x5b')][_0xc212('0x6c')]({'where':{'id':_0x255151['params']['id']}})[_0xc212('0x13')](handleEntityNotFound(_0x24dc8a,null))[_0xc212('0x13')](function(_0x22de70){if(_0x22de70){_0xa50037[_0xc212('0x4d')]=_['keys'](db[_0xc212('0x72')]['rawAttributes']);_0xa50037['query']=_[_0xc212('0x4f')](_0x255151[_0xc212('0x4e')]);_0xa50037[_0xc212('0x50')]=_[_0xc212('0x51')](_0xa50037[_0xc212('0x4d')],_0xa50037['query']);_0x2d59ae['attributes']=_[_0xc212('0x51')](_0xa50037[_0xc212('0x4d')],qs[_0xc212('0x53')](_0x255151[_0xc212('0x4e')]['fields']));_0x2d59ae['attributes']=_0x2d59ae['attributes'][_0xc212('0x5f')]?_0x2d59ae['attributes']:_0xa50037[_0xc212('0x4d')];if(!_0x255151[_0xc212('0x4e')]['hasOwnProperty']('nolimit')){_0x2d59ae[_0xc212('0x24')]=qs[_0xc212('0x24')](_0x255151[_0xc212('0x4e')][_0xc212('0x24')]);_0x2d59ae['offset']=qs[_0xc212('0x21')](_0x255151['query']['offset']);}_0x2d59ae['order']=qs['sort'](_0x255151[_0xc212('0x4e')][_0xc212('0x56')]);_0x2d59ae[_0xc212('0x57')]=qs[_0xc212('0x50')](_[_0xc212('0x74')](_0x255151[_0xc212('0x4e')],_0xa50037[_0xc212('0x50')]));_0x2d59ae[_0xc212('0x57')]['MailAccountId']=_0x22de70['id'];if(_0x255151[_0xc212('0x4e')]['filter']){_0x2d59ae[_0xc212('0x57')]=_[_0xc212('0x5a')](_0x2d59ae[_0xc212('0x57')],{'$or':_[_0xc212('0x4a')](_0x2d59ae[_0xc212('0x52')],function(_0x19e879){var _0x273725={};_0x273725[_0x19e879]={'$like':'%'+_0x255151['query'][_0xc212('0x58')]+'%'};return _0x273725;})});}_0x2d59ae=_[_0xc212('0x5a')]({},_0x2d59ae,_0x255151[_0xc212('0x60')]);return db[_0xc212('0x72')]['count']({'where':_0x2d59ae[_0xc212('0x57')]})[_0xc212('0x13')](function(_0x31c1b0){_0x5677d3[_0xc212('0x23')]=_0x31c1b0;if(_0x255151[_0xc212('0x4e')][_0xc212('0x75')]){_0x2d59ae[_0xc212('0x5c')]=[{'all':!![]}];}return db[_0xc212('0x72')][_0xc212('0x6e')](_0x2d59ae);})[_0xc212('0x13')](function(_0x5f6c92){_0x5677d3[_0xc212('0x6f')]=_0x5f6c92;return _0x5677d3;});}})[_0xc212('0x13')](respondWithFilteredResult(_0x24dc8a,_0x2d59ae))[_0xc212('0x1c')](handleError(_0x24dc8a,null));};exports[_0xc212('0x76')]=function(_0x22de73,_0x5b4b32){return db['MailAccount'][_0xc212('0x67')]({'where':{'id':_0x22de73['params']['id']}})[_0xc212('0x13')](handleEntityNotFound(_0x5b4b32,null))[_0xc212('0x13')](function(_0x5885d2){if(_0x5885d2){return _0x5885d2[_0xc212('0x76')](_0x22de73['query'][_0xc212('0x70')]);}})[_0xc212('0x13')](respondWithStatusCode(_0x5b4b32,null))[_0xc212('0x1c')](handleError(_0x5b4b32,null));};exports[_0xc212('0x6a')]=function(_0x5e6508,_0x2a49e8){var _0x4aa7cb={'name':_0x5e6508[_0xc212('0x61')][_0xc212('0x2d')],'key':_0x5e6508[_0xc212('0x61')][_0xc212('0x77')],'provider':_0x5e6508[_0xc212('0x61')][_0xc212('0x62')]==='custom'?null:_0x5e6508[_0xc212('0x61')][_0xc212('0x62')],'email':_0x5e6508[_0xc212('0x61')][_0xc212('0x78')],'ListId':_0x5e6508['body']['ListId'],'active':!_[_0xc212('0x79')](_0x5e6508[_0xc212('0x61')][_0xc212('0x7a')])?_0x5e6508[_0xc212('0x61')][_0xc212('0x7a')]:!![],'description':_0x5e6508[_0xc212('0x61')][_0xc212('0x7b')]||null};var _0x503b10=getAuthenticationOptions(_0x4aa7cb[_0xc212('0x62')],_0x5e6508[_0xc212('0x61')]);_0x4aa7cb[_0xc212('0x43')]=_0x503b10['Imap'];_0x4aa7cb['Smtp']=_0x503b10[_0xc212('0x44')];return db['MailAccount'][_0xc212('0x6a')](_0x4aa7cb,{'include':[{'model':db[_0xc212('0x47')],'as':_0xc212('0x44')},{'model':db['MailServerIn'],'as':_0xc212('0x43')}]})[_0xc212('0x13')](function(_0x56f50a){var _0x2e9b12=_0x5e6508[_0xc212('0x38')]['get']({'plain':!![]});if(!_0x2e9b12)throw new Error(_0xc212('0x7c'));if(_0x2e9b12[_0xc212('0x7d')]===_0xc212('0x38')){var _0x4d3ba6=_0x56f50a[_0xc212('0x28')]({'plain':!![]});return db['UserProfileSection'][_0xc212('0x67')]({'where':{'name':'MailAccounts','userProfileId':_0x2e9b12[_0xc212('0x7e')]},'raw':!![]})['then'](function(_0x2ed9df){if(_0x2ed9df&&_0x2ed9df[_0xc212('0x7f')]===0x0){return db[_0xc212('0x2a')][_0xc212('0x6a')]({'name':_0x4d3ba6['name'],'resourceId':_0x4d3ba6['id'],'type':_0x2ed9df[_0xc212('0x2d')],'sectionId':_0x2ed9df['id']},{})['then'](function(){return _0x56f50a;});}else{return _0x56f50a;}})['catch'](function(_0x891269){logger[_0xc212('0x19')](_0xc212('0x80'),_0x891269);throw _0x891269;});}return _0x56f50a;})[_0xc212('0x13')](respondWithResult(_0x2a49e8,0xc9))['catch'](handleError(_0x2a49e8,null));};exports[_0xc212('0x81')]=function(_0x204cb5,_0xae14ff){return db[_0xc212('0x5b')]['findOne']({'where':{'id':_0x204cb5['params']['id']}})[_0xc212('0x13')](handleEntityNotFound(_0xae14ff,null))[_0xc212('0x13')](function(_0x983673){if(_0x983673){return _0x983673[_0xc212('0x81')]();}return null;})[_0xc212('0x13')](respondWithResult(_0xae14ff,null))[_0xc212('0x1c')](handleError(_0xae14ff,null));};exports[_0xc212('0x82')]=function(_0x16bd1a,_0x4293f4){if(_0x16bd1a[_0xc212('0x61')]['id']){delete _0x16bd1a[_0xc212('0x61')]['id'];}return db[_0xc212('0x5b')][_0xc212('0x67')]({'where':{'id':_0x16bd1a['params']['id']}})[_0xc212('0x13')](handleEntityNotFound(_0x4293f4,null))['then'](function(_0x2cebe5){if(_0x2cebe5){_0x16bd1a['body'][_0xc212('0x68')]=_0x2cebe5['id'];return db['MailServerIn'][_0xc212('0x6a')](_0x16bd1a[_0xc212('0x61')]);}})[_0xc212('0x13')](respondWithResult(_0x4293f4,null))[_0xc212('0x1c')](handleError(_0x4293f4,null));};exports[_0xc212('0x83')]=function(_0x3ab3a1,_0x4fb4cf){return db[_0xc212('0x5b')][_0xc212('0x6c')]({'where':{'id':_0x3ab3a1[_0xc212('0x5e')]['id']}})[_0xc212('0x13')](handleEntityNotFound(_0x4fb4cf,null))[_0xc212('0x13')](function(_0x1d7d05){if(_0x1d7d05){return _0x1d7d05['setImap'](null);}return null;})['then'](respondWithStatusCode(_0x4fb4cf,null))[_0xc212('0x1c')](handleError(_0x4fb4cf,null));};exports[_0xc212('0x84')]=function(_0x3bffbb,_0x341894){return db[_0xc212('0x5b')]['findOne']({'where':{'id':_0x3bffbb[_0xc212('0x5e')]['id']}})['then'](handleEntityNotFound(_0x341894,null))[_0xc212('0x13')](function(_0x5f5044){if(_0x5f5044){return _0x5f5044[_0xc212('0x84')]();}return null;})['then'](respondWithResult(_0x341894,null))['catch'](handleError(_0x341894,null));};exports[_0xc212('0x85')]=function(_0x44a7e8,_0x5dead8){if(_0x44a7e8['body']['id']){delete _0x44a7e8['body']['id'];}return db[_0xc212('0x5b')]['find']({'where':{'id':_0x44a7e8['params']['id']}})[_0xc212('0x13')](handleEntityNotFound(_0x5dead8,null))['then'](function(_0x2ae51a){if(_0x2ae51a){_0x44a7e8[_0xc212('0x61')][_0xc212('0x68')]=_0x2ae51a['id'];return db[_0xc212('0x47')][_0xc212('0x6a')](_0x44a7e8[_0xc212('0x61')]);}})[_0xc212('0x13')](respondWithResult(_0x5dead8,null))['catch'](handleError(_0x5dead8,null));};exports[_0xc212('0x86')]=function(_0x1b8a65,_0x377257){return db['MailAccount'][_0xc212('0x6c')]({'where':{'id':_0x1b8a65[_0xc212('0x5e')]['id']}})[_0xc212('0x13')](handleEntityNotFound(_0x377257,null))[_0xc212('0x13')](function(_0x26cba7){if(_0x26cba7){return _0x26cba7[_0xc212('0x87')](null);}return null;})[_0xc212('0x13')](respondWithStatusCode(_0x377257,null))[_0xc212('0x1c')](handleError(_0x377257,null));};exports[_0xc212('0x88')]=function(_0x621b48,_0x2eb528){return db[_0xc212('0x89')]['find']({'where':{'id':_0x621b48[_0xc212('0x5e')]['id']}})[_0xc212('0x13')](handleEntityNotFound(_0x2eb528,null))[_0xc212('0x13')](function(_0x15d6e2){if(_0x15d6e2){return _0x15d6e2[_0xc212('0x88')](_0x621b48[_0xc212('0x61')][_0xc212('0x70')],_[_0xc212('0x8a')](_0x621b48['body'],['ids','id'])||{});}})[_0xc212('0x13')](respondWithResult(_0x2eb528,null))['catch'](handleError(_0x2eb528,null));};exports[_0xc212('0x8b')]=function(_0x198c07,_0x2d91c3){var _0x5135d4={'raw':![],'where':{}};var _0x10fffd={};var _0xc2f91={'count':0x0,'rows':[]};return db[_0xc212('0x5b')]['findOne']({'where':{'id':_0x198c07[_0xc212('0x5e')]['id']}})['then'](handleEntityNotFound(_0x2d91c3,null))['then'](function(_0x3d6894){if(_0x3d6894){_0x10fffd[_0xc212('0x4d')]=_[_0xc212('0x4f')](db[_0xc212('0x89')][_0xc212('0x4b')]);_0x10fffd[_0xc212('0x4e')]=_['keys'](_0x198c07[_0xc212('0x4e')]);_0x10fffd['filters']=_[_0xc212('0x51')](_0x10fffd[_0xc212('0x4d')],_0x10fffd[_0xc212('0x4e')]);_0x5135d4['attributes']=_['intersection'](_0x10fffd[_0xc212('0x4d')],qs[_0xc212('0x53')](_0x198c07[_0xc212('0x4e')][_0xc212('0x53')]));_0x5135d4[_0xc212('0x52')]=_0x5135d4[_0xc212('0x52')][_0xc212('0x5f')]?_0x5135d4[_0xc212('0x52')]:_0x10fffd[_0xc212('0x4d')];if(!_0x198c07[_0xc212('0x4e')][_0xc212('0x6d')](_0xc212('0x54'))){_0x5135d4['limit']=qs[_0xc212('0x24')](_0x198c07[_0xc212('0x4e')][_0xc212('0x24')]);_0x5135d4[_0xc212('0x21')]=qs[_0xc212('0x21')](_0x198c07['query']['offset']);}_0x5135d4[_0xc212('0x55')]=qs[_0xc212('0x56')](_0x198c07[_0xc212('0x4e')][_0xc212('0x56')]);_0x5135d4[_0xc212('0x57')]=qs['filters'](_[_0xc212('0x74')](_0x198c07[_0xc212('0x4e')],_0x10fffd[_0xc212('0x50')]));_0x5135d4[_0xc212('0x57')][_0xc212('0x68')]=_0x3d6894['id'];if(_0x198c07[_0xc212('0x4e')][_0xc212('0x58')]){_0x5135d4[_0xc212('0x57')]=_[_0xc212('0x5a')](_0x5135d4[_0xc212('0x57')],{'$or':_[_0xc212('0x4a')](_0x5135d4['attributes'],function(_0x546827){var _0x1a448a={};_0x1a448a[_0x546827]={'$like':'%'+_0x198c07[_0xc212('0x4e')]['filter']+'%'};return _0x1a448a;})});}_0x5135d4=_[_0xc212('0x5a')]({},_0x5135d4,_0x198c07[_0xc212('0x60')]);return db[_0xc212('0x89')][_0xc212('0x23')]({'where':_0x5135d4[_0xc212('0x57')]})[_0xc212('0x13')](function(_0xe8072b){_0xc2f91[_0xc212('0x23')]=_0xe8072b;if(_0x198c07[_0xc212('0x4e')][_0xc212('0x75')]){_0x5135d4[_0xc212('0x5c')]=[{'model':db[_0xc212('0x8c')],'as':_0xc212('0x8d'),'required':![]},{'model':db[_0xc212('0x8e')],'as':_0xc212('0x8f'),'attributes':['name',_0xc212('0x90'),_0xc212('0x91')],'required':![]},{'model':db['Tag'],'as':_0xc212('0x92'),'attributes':['id','name',_0xc212('0x93')],'where':_0x198c07['query'][_0xc212('0x94')]?{'id':_0x198c07[_0xc212('0x4e')]['tag']}:undefined,'required':_0x198c07['query'][_0xc212('0x94')]?!![]:![]}];}return db[_0xc212('0x89')][_0xc212('0x6e')](_0x5135d4);})['then'](function(_0x19b163){_0xc2f91[_0xc212('0x6f')]=_0x19b163;return _0xc2f91;});}})[_0xc212('0x13')](respondWithFilteredResult(_0x2d91c3,_0x5135d4))[_0xc212('0x1c')](handleError(_0x2d91c3,null));};exports[_0xc212('0x95')]=function addApplications(_0x5dbe37,_0x38837f){var _0x182bc8=_0x5dbe37[_0xc212('0x5e')]['id'];var _0x1f0e2f=_0x5dbe37[_0xc212('0x61')];var _0x5e2542=0xc8;var _0x1c4a85=null;return db[_0xc212('0x96')]['transaction']({'isolationLevel':db[_0xc212('0x96')][_0xc212('0x97')][_0xc212('0x98')][_0xc212('0x99')]},function(_0x484b04){return db[_0xc212('0x5b')][_0xc212('0x6c')]({'where':{'id':_0x182bc8},'transaction':_0x484b04})[_0xc212('0x13')](function(_0x99484b){if(_0x99484b){return db[_0xc212('0x9a')][_0xc212('0x2b')]({'where':{'MailAccountId':_0x182bc8},'transaction':_0x484b04})['then'](function(){var _0x2ca2df=_[_0xc212('0x4a')](_0x1f0e2f,function(_0x34ea51){_0x34ea51['MailAccountId']=_0x182bc8;return _0x34ea51;});return db['MailApplication'][_0xc212('0x9b')](_0x2ca2df,{'transaction':_0x484b04});});}else{_0x5e2542=0x194;_0x1c4a85=[];}});})[_0xc212('0x13')](function(){if(_0x5e2542!==0x194){return db[_0xc212('0x9a')]['findAndCountAll']({'where':{'MailAccountId':_0x182bc8},'order':'priority'})['then'](function(_0x4d1310){_0x1c4a85=_0x4d1310;});}})[_0xc212('0x1c')](function(_0x11c3d4){_0x5e2542=0x1f4;logger[_0xc212('0x19')](_0x11c3d4['stack']);if(_0x11c3d4['name']){delete _0x11c3d4[_0xc212('0x2d')];}_0x1c4a85=_0x11c3d4;})[_0xc212('0x9c')](function(){if(_0x1c4a85===null){_0x38837f['sendStatus'](_0x5e2542);}else{if(_0x5e2542===0x1f4){_0x38837f[_0xc212('0x1f')](_0x5e2542)[_0xc212('0x2e')](_0x1c4a85);}else{_0x38837f[_0xc212('0x1f')](_0x5e2542)[_0xc212('0x20')](_0x1c4a85);}}});};exports[_0xc212('0x9d')]=function(_0x3ff5b4,_0x1edcfc){var _0x2f84ab={};var _0x3eeda9={};var _0x1f09f1;var _0x34d08a;return db['MailAccount']['findOne']({'where':{'id':_0x3ff5b4[_0xc212('0x5e')]['id']}})[_0xc212('0x13')](handleEntityNotFound(_0x1edcfc,null))[_0xc212('0x13')](function(_0x237884){if(_0x237884){_0x1f09f1=_0x237884;_0x3eeda9['model']=_['keys'](db['MailApplication'][_0xc212('0x4b')]);_0x3eeda9[_0xc212('0x4e')]=_['keys'](_0x3ff5b4[_0xc212('0x4e')]);_0x3eeda9[_0xc212('0x50')]=_['intersection'](_0x3eeda9['model'],_0x3eeda9[_0xc212('0x4e')]);_0x2f84ab[_0xc212('0x52')]=_['intersection'](_0x3eeda9[_0xc212('0x4d')],qs[_0xc212('0x53')](_0x3ff5b4[_0xc212('0x4e')][_0xc212('0x53')]));_0x2f84ab[_0xc212('0x52')]=_0x2f84ab[_0xc212('0x52')]['length']?_0x2f84ab[_0xc212('0x52')]:_0x3eeda9['model'];_0x2f84ab[_0xc212('0x55')]=qs[_0xc212('0x56')](_0x3ff5b4[_0xc212('0x4e')][_0xc212('0x56')]);_0x2f84ab[_0xc212('0x57')]=qs[_0xc212('0x50')](_[_0xc212('0x74')](_0x3ff5b4[_0xc212('0x4e')],_0x3eeda9[_0xc212('0x50')]));if(_0x3ff5b4[_0xc212('0x4e')][_0xc212('0x58')]){_0x2f84ab[_0xc212('0x57')]=_[_0xc212('0x5a')](_0x2f84ab[_0xc212('0x57')],{'$or':_['map'](_0x2f84ab[_0xc212('0x52')],function(_0xd78dd1){var _0x329662={};_0x329662[_0xd78dd1]={'$like':'%'+_0x3ff5b4[_0xc212('0x4e')][_0xc212('0x58')]+'%'};return _0x329662;})});}_0x2f84ab=_[_0xc212('0x5a')]({},_0x2f84ab,_0x3ff5b4['options']);return _0x1f09f1['getApplications'](_0x2f84ab);}})['then'](function(_0xa93056){if(_0xa93056){_0x34d08a=_0xa93056['length'];if(!_0x3ff5b4['query']['hasOwnProperty'](_0xc212('0x54'))){_0x2f84ab[_0xc212('0x24')]=qs[_0xc212('0x24')](_0x3ff5b4[_0xc212('0x4e')]['limit']);_0x2f84ab[_0xc212('0x21')]=qs['offset'](_0x3ff5b4[_0xc212('0x4e')][_0xc212('0x21')]);}return _0x1f09f1[_0xc212('0x9d')](_0x2f84ab);}})[_0xc212('0x13')](function(_0x1cd657){if(_0x1cd657){return _0x1cd657?{'count':_0x34d08a,'rows':_0x1cd657}:null;}})[_0xc212('0x13')](respondWithResult(_0x1edcfc,null))[_0xc212('0x1c')](handleError(_0x1edcfc,null));};exports['getMessages']=function(_0x324852,_0x13e530){var _0xf356f={'raw':!![],'where':{}};var _0x4266b7={};var _0x24c49b={'count':0x0,'rows':[]};return db[_0xc212('0x5b')][_0xc212('0x6c')]({'where':{'id':_0x324852[_0xc212('0x5e')]['id']}})['then'](handleEntityNotFound(_0x13e530,null))['then'](function(_0x35daca){if(_0x35daca){_0x4266b7[_0xc212('0x4d')]=_[_0xc212('0x4f')](db[_0xc212('0x9e')][_0xc212('0x4b')]);_0x4266b7['query']=_[_0xc212('0x4f')](_0x324852['query']);_0x4266b7[_0xc212('0x50')]=_[_0xc212('0x51')](_0x4266b7[_0xc212('0x4d')],_0x4266b7[_0xc212('0x4e')]);_0xf356f[_0xc212('0x52')]=_[_0xc212('0x51')](_0x4266b7[_0xc212('0x4d')],qs['fields'](_0x324852[_0xc212('0x4e')][_0xc212('0x53')]));_0xf356f[_0xc212('0x52')]=_0xf356f[_0xc212('0x52')][_0xc212('0x5f')]?_0xf356f[_0xc212('0x52')]:_0x4266b7[_0xc212('0x4d')];if(!_0x324852['query']['hasOwnProperty'](_0xc212('0x54'))){_0xf356f[_0xc212('0x24')]=qs[_0xc212('0x24')](_0x324852['query'][_0xc212('0x24')]);_0xf356f['offset']=qs[_0xc212('0x21')](_0x324852[_0xc212('0x4e')]['offset']);}_0xf356f[_0xc212('0x55')]=qs['sort'](_0x324852[_0xc212('0x4e')][_0xc212('0x56')]);_0xf356f[_0xc212('0x57')]=qs[_0xc212('0x50')](_[_0xc212('0x74')](_0x324852[_0xc212('0x4e')],_0x4266b7[_0xc212('0x50')]));_0xf356f[_0xc212('0x57')][_0xc212('0x68')]=_0x35daca['id'];if(_0x324852[_0xc212('0x4e')][_0xc212('0x58')]){_0xf356f[_0xc212('0x57')]=_[_0xc212('0x5a')](_0xf356f[_0xc212('0x57')],{'$or':_[_0xc212('0x4a')](_0xf356f['attributes'],function(_0x509839){var _0x3c5ef1={};_0x3c5ef1[_0x509839]={'$like':'%'+_0x324852[_0xc212('0x4e')][_0xc212('0x58')]+'%'};return _0x3c5ef1;})});}if(_0x324852[_0xc212('0x4e')][_0xc212('0x9f')]){var _0x167de4=_0x324852[_0xc212('0x4e')][_0xc212('0x9f')][_0xc212('0xa0')](',');var _0x38574f={};_0x38574f[_0x167de4[0x0]]={'$gte':moment(_0x167de4[0x1])['format'](_0xc212('0xa1'))};_0xf356f[_0xc212('0x57')]=_[_0xc212('0x5a')](_0xf356f[_0xc212('0x57')],_0x38574f);}_0xf356f=_[_0xc212('0x5a')]({},_0xf356f,_0x324852[_0xc212('0x60')]);return db[_0xc212('0x9e')]['count']({'where':_0xf356f['where']})[_0xc212('0x13')](function(_0x31c8c8){_0x24c49b[_0xc212('0x23')]=_0x31c8c8;if(_0x324852[_0xc212('0x4e')][_0xc212('0x75')]){_0xf356f['include']=[{'all':!![]}];}return db[_0xc212('0x9e')][_0xc212('0x6e')](_0xf356f);})[_0xc212('0x13')](function(_0x5a3edf){if(_0x324852[_0xc212('0x4e')]['inlineCss']===_0xc212('0xa2')){for(var _0x5c7922=0x0;_0x5c7922<_0x5a3edf[_0xc212('0x5f')];_0x5c7922++){_0x5a3edf[_0x5c7922][_0xc212('0x61')]=juice(_0x5a3edf[_0x5c7922][_0xc212('0x61')]);}}_0x24c49b[_0xc212('0x6f')]=_0x5a3edf;return _0x24c49b;});}})[_0xc212('0x13')](respondWithFilteredResult(_0x13e530,_0xf356f))[_0xc212('0x1c')](handleError(_0x13e530,null));};exports[_0xc212('0x2e')]=function(_0x42a13b,_0x469b4a){var _0x1b5927,_0x41c054={},_0x5a5acf;if(_0x42a13b['body']['to']){_0x5a5acf=_0x42a13b[_0xc212('0x61')]['to'][_0xc212('0xa0')](',')[0x0];}return db[_0xc212('0x5b')][_0xc212('0x67')]({'where':{'id':_0x42a13b[_0xc212('0x5e')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x5a5acf},'limit':0x1,'order':[[_0xc212('0xa3'),_0xc212('0xa4')]]}]},{'model':db[_0xc212('0x47')],'as':_0xc212('0x44'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xc212('0xa5'),'raw':!![]}]}]})[_0xc212('0x13')](handleEntityNotFound(_0x469b4a,null))[_0xc212('0x13')](function(_0x2d8646){if(!_0x2d8646)return;_0x1b5927=_0x2d8646;if(!_0x2d8646[_0xc212('0x44')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0xc212('0x79')](_0x42a13b['body'][_0xc212('0xa6')])){_0x42a13b[_0xc212('0x61')]['from']=util[_0xc212('0xa7')](_0xc212('0xa8'),_0x2d8646[_0xc212('0x2d')],_0x2d8646['email']||_0x2d8646[_0xc212('0x44')][_0xc212('0x38')]);}if(_0x42a13b[_0xc212('0x61')][_0xc212('0xa9')]&&_0x42a13b[_0xc212('0x61')]['attachments']['length']){for(var _0x5b033e=0x0;_0x5b033e<_0x42a13b[_0xc212('0x61')][_0xc212('0xa9')][_0xc212('0x5f')];_0x5b033e+=0x1){_0x42a13b[_0xc212('0x61')][_0xc212('0xa9')][_0x5b033e]={'filename':_0x42a13b[_0xc212('0x61')][_0xc212('0xa9')][_0x5b033e][_0xc212('0x2d')],'path':path['join'](config[_0xc212('0xaa')],_0xc212('0xab'),_0x42a13b[_0xc212('0x61')][_0xc212('0xa9')][_0x5b033e][_0xc212('0xac')])};}}var _0x5c1075=_0x2d8646['getSmtpOptions']();return respondWithRpcPromise(_0xc212('0xad'),_0xc212('0xae'),{'account':_0x5c1075,'message':_0x42a13b['body']});})[_0xc212('0x13')](function(_0x2a3444){if(!_0x2a3444)return;_0x41c054=_0x2a3444;if(!_0x1b5927[_0xc212('0xaf')])throw new Error(_0xc212('0xb0'));if(_0x1b5927[_0xc212('0xaf')][_0xc212('0xb1')][_0xc212('0x5f')])return _0x1b5927['List'][_0xc212('0xb1')][0x0];return db[_0xc212('0x8c')][_0xc212('0x6a')](_[_0xc212('0xa')](_0x42a13b[_0xc212('0x61')],{'firstName':_0x42a13b[_0xc212('0x61')]['to'],'email':_0x42a13b[_0xc212('0x61')]['to'],'phone':_0x42a13b[_0xc212('0x61')]['to'],'ListId':_0x1b5927[_0xc212('0xb2')]}));})[_0xc212('0x13')](function(_0x1e55a1){if(!_0x1e55a1)return;var _0x53961a={'UserId':_0x42a13b[_0xc212('0x38')]['id'],'ContactId':_0x1e55a1['id'],'MailAccountId':_0x1b5927['id'],'inReplyTo':_0x41c054[_0xc212('0xb3')],'to':_0x42a13b['body'][_0xc212('0xa6')],'cc':_0x42a13b['body']['cc'],'subject':_0x42a13b[_0xc212('0x61')][_0xc212('0xb4')],'attach':_0x42a13b[_0xc212('0x61')][_0xc212('0xb5')],'firstMsgDirection':_0xc212('0xb6'),'lastMsgAt':moment()[_0xc212('0xa7')](_0xc212('0xa1')),'lastMsgDirection':_0xc212('0xb6'),'Messages':[_[_0xc212('0x5a')](_0x42a13b['body'],{'messageId':_0x41c054['messageId'],'sentAt':moment()[_0xc212('0xa7')](_0xc212('0xa1')),'read':!![],'MailAccountId':_0x1b5927['id'],'UserId':_0x42a13b['user']['id'],'ContactId':_0x1e55a1['id']})]};if(_0x42a13b[_0xc212('0x61')][_0xc212('0xb7')]){_0x53961a=_['merge'](_0x53961a,_0x42a13b[_0xc212('0x61')][_0xc212('0xb7')]);}return db[_0xc212('0x89')]['create'](_0x53961a,{'include':[{'model':db[_0xc212('0x9e')],'as':_0xc212('0xb8')}]});})[_0xc212('0x13')](respondWithResult(_0x469b4a,null))[_0xc212('0x1c')](handleError(_0x469b4a,null));};exports[_0xc212('0xb9')]=function(_0xff15af,_0x2106bf){return db[_0xc212('0x5b')][_0xc212('0x67')]({'where':{'id':_0xff15af[_0xc212('0x5e')]['id']},'include':[{'model':db['MailServerOut'],'as':_0xc212('0x44'),'raw':!![],'include':[{'model':db[_0xc212('0xa5')],'as':_0xc212('0xa5'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x2106bf,null))['then'](function(_0x424af9){if(!_0x424af9[_0xc212('0x44')])return;var _0x224f64=_0x424af9['getSmtpOptions']();return respondWithRpcPromise(_0xc212('0xba'),'verifySmtp',{'account':_0x224f64});})['then'](respondWithResult(_0x2106bf,null))[_0xc212('0x1c')](handleError(_0x2106bf,null));};exports['destroy']=function(_0x122662,_0x1d9d59){return db['MailAccount'][_0xc212('0x67')]({'where':{'id':_0x122662[_0xc212('0x5e')]['id']}})[_0xc212('0x13')](handleEntityNotFound(_0x1d9d59,null))[_0xc212('0x13')](function(_0x23b916){if(_0x23b916&&_0x23b916[_0xc212('0x41')]){throw new db[(_0xc212('0xbb'))]['ValidationError'](_0xc212('0xbc'));}return _0x23b916;})[_0xc212('0x13')](removeEntity(_0x1d9d59,null))[_0xc212('0x1c')](handleError(_0x1d9d59,null));};exports[_0xc212('0xbd')]=function(_0x4664d1,_0x33b796){return db[_0xc212('0x5b')]['find']({'where':{'id':_0x4664d1[_0xc212('0x5e')]['id']}})['then'](handleEntityNotFound(_0x33b796,null))[_0xc212('0x13')](function(_0x59fe72){if(_0x59fe72){return _0x59fe72[_0xc212('0xbd')](_0x4664d1[_0xc212('0x61')][_0xc212('0x70')],_[_0xc212('0x8a')](_0x4664d1[_0xc212('0x61')],[_0xc212('0x70'),'id'])||{})['spread'](function(_0x515b09){for(var _0x71c744=0x0;_0x71c744<_0x4664d1[_0xc212('0x61')][_0xc212('0x70')][_0xc212('0x5f')];_0x71c744+=0x1){socket['emit']('userMailAccount:save',{'UserId':Number(_0x4664d1[_0xc212('0x61')][_0xc212('0x70')][_0x71c744]),'MailAccountId':Number(_0x4664d1['params']['id'])});}return _0x515b09;});}})['then'](respondWithResult(_0x33b796,null))[_0xc212('0x1c')](handleError(_0x33b796,null));};exports[_0xc212('0xbe')]=function(_0x67d848,_0x4a077d){return db[_0xc212('0x5b')][_0xc212('0x67')]({'where':{'id':_0x67d848[_0xc212('0x5e')]['id']}})[_0xc212('0x13')](handleEntityNotFound(_0x4a077d,null))[_0xc212('0x13')](function(_0x159812){if(_0x159812){return _0x159812[_0xc212('0xbe')](_0x67d848[_0xc212('0x4e')][_0xc212('0x70')])['then'](function(){if(_[_0xc212('0xbf')](_0x67d848[_0xc212('0x4e')][_0xc212('0x70')])){for(var _0x42a6de=0x0;_0x42a6de<_0x67d848['query']['ids']['length'];_0x42a6de+=0x1){socket[_0xc212('0xc0')]('userMailAccount:remove',{'UserId':Number(_0x67d848[_0xc212('0x4e')]['ids'][_0x42a6de]),'MailAccountId':Number(_0x67d848[_0xc212('0x5e')]['id'])});}}else{socket[_0xc212('0xc0')](_0xc212('0xc1'),{'UserId':Number(_0x67d848[_0xc212('0x4e')][_0xc212('0x70')]),'MailAccountId':Number(_0x67d848[_0xc212('0x5e')]['id'])});}});}})[_0xc212('0x13')](respondWithStatusCode(_0x4a077d,null))['catch'](handleError(_0x4a077d,null));};exports['getAgents']=function(_0x3c6aad,_0x236cce){var _0x8ff998={};var _0x137206={};var _0x59babf;var _0x5760bd;return db['MailAccount']['findOne']({'where':{'id':_0x3c6aad[_0xc212('0x5e')]['id']}})[_0xc212('0x13')](handleEntityNotFound(_0x236cce,null))[_0xc212('0x13')](function(_0x434f04){if(_0x434f04){_0x59babf=_0x434f04;_0x137206[_0xc212('0x4d')]=_['keys'](db[_0xc212('0x8e')][_0xc212('0x4b')]);_0x137206[_0xc212('0x4e')]=_[_0xc212('0x4f')](_0x3c6aad['query']);_0x137206['filters']=_[_0xc212('0x51')](_0x137206[_0xc212('0x4d')],_0x137206[_0xc212('0x4e')]);_0x8ff998['attributes']=_['intersection'](_0x137206[_0xc212('0x4d')],qs[_0xc212('0x53')](_0x3c6aad[_0xc212('0x4e')]['fields']));_0x8ff998['attributes']=_0x8ff998[_0xc212('0x52')][_0xc212('0x5f')]?_0x8ff998[_0xc212('0x52')]:_0x137206[_0xc212('0x4d')];_0x8ff998[_0xc212('0x55')]=qs[_0xc212('0x56')](_0x3c6aad[_0xc212('0x4e')][_0xc212('0x56')]);_0x8ff998[_0xc212('0x57')]=qs[_0xc212('0x50')](_[_0xc212('0x74')](_0x3c6aad[_0xc212('0x4e')],_0x137206[_0xc212('0x50')]));if(_0x3c6aad[_0xc212('0x4e')][_0xc212('0x58')]){_0x8ff998[_0xc212('0x57')]=_[_0xc212('0x5a')](_0x8ff998[_0xc212('0x57')],{'$or':_[_0xc212('0x4a')](_0x8ff998['attributes'],function(_0x2f9c0c){var _0x1ba60f={};_0x1ba60f[_0x2f9c0c]={'$like':'%'+_0x3c6aad[_0xc212('0x4e')][_0xc212('0x58')]+'%'};return _0x1ba60f;})});}_0x8ff998=_['merge']({},_0x8ff998,_0x3c6aad['options']);return _0x59babf[_0xc212('0xc2')](_0x8ff998);}})['then'](function(_0x594ebe){if(_0x594ebe){_0x5760bd=_0x594ebe['length'];if(!_0x3c6aad[_0xc212('0x4e')][_0xc212('0x6d')](_0xc212('0x54'))){_0x8ff998[_0xc212('0x24')]=qs[_0xc212('0x24')](_0x3c6aad[_0xc212('0x4e')][_0xc212('0x24')]);_0x8ff998[_0xc212('0x21')]=qs[_0xc212('0x21')](_0x3c6aad[_0xc212('0x4e')][_0xc212('0x21')]);}return _0x59babf[_0xc212('0xc2')](_0x8ff998);}})[_0xc212('0x13')](function(_0x2c9395){if(_0x2c9395){return _0x2c9395?{'count':_0x5760bd,'rows':_0x2c9395}:null;}})[_0xc212('0x13')](respondWithResult(_0x236cce,null))[_0xc212('0x1c')](handleError(_0x236cce,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 2c400a3..80c41cc 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 _0xca84=['hook','exports','events','../../mysqldb','MailAccount','save','update','emit','hasOwnProperty'];(function(_0x8a41e7,_0x1227c1){var _0x2ba973=function(_0x5a9b4b){while(--_0x5a9b4b){_0x8a41e7['push'](_0x8a41e7['shift']());}};_0x2ba973(++_0x1227c1);}(_0xca84,0xf5));var _0x4ca8=function(_0x108b03,_0x2a183a){_0x108b03=_0x108b03-0x0;var _0x5a3f97=_0xca84[_0x108b03];return _0x5a3f97;};'use strict';var EventEmitter=require(_0x4ca8('0x0'));var MailAccount=require(_0x4ca8('0x1'))['db'][_0x4ca8('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4ca8('0x3'),'afterUpdate':_0x4ca8('0x4'),'afterDestroy':'remove'};function emitEvent(_0x356f27){return function(_0x45236d,_0x2bc818,_0x6f7a23){MailAccountEvents[_0x4ca8('0x5')](_0x356f27+':'+_0x45236d['id'],_0x45236d);MailAccountEvents[_0x4ca8('0x5')](_0x356f27,_0x45236d);_0x6f7a23(null);};}for(var e in events){if(events[_0x4ca8('0x6')](e)){var event=events[e];MailAccount[_0x4ca8('0x7')](e,emitEvent(event));}}module[_0x4ca8('0x8')]=MailAccountEvents; \ No newline at end of file +var _0x0a93=['hasOwnProperty','hook','events','../../mysqldb','MailAccount','save','update','remove'];(function(_0x4f8942,_0x586651){var _0x6310b9=function(_0x2d429d){while(--_0x2d429d){_0x4f8942['push'](_0x4f8942['shift']());}};_0x6310b9(++_0x586651);}(_0x0a93,0x6a));var _0x30a9=function(_0x4960dc,_0xcc7f8e){_0x4960dc=_0x4960dc-0x0;var _0xcd4caa=_0x0a93[_0x4960dc];return _0xcd4caa;};'use strict';var EventEmitter=require(_0x30a9('0x0'));var MailAccount=require(_0x30a9('0x1'))['db'][_0x30a9('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x30a9('0x3'),'afterUpdate':_0x30a9('0x4'),'afterDestroy':_0x30a9('0x5')};function emitEvent(_0x2bdf19){return function(_0x556c5e,_0x53e03b,_0x54321d){MailAccountEvents['emit'](_0x2bdf19+':'+_0x556c5e['id'],_0x556c5e);MailAccountEvents['emit'](_0x2bdf19,_0x556c5e);_0x54321d(null);};}for(var e in events){if(events[_0x30a9('0x6')](e)){var event=events[e];MailAccount[_0x30a9('0x7')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index d1e4c6d..0bbbbbf 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 _0x6f4f=['OAuth2','user','pass','./mailAccount.attributes','exports','define','provider','custom','service','host','port','Smtp','secure','authentication','modernAuthentication','CloudProvider','auth'];(function(_0x407c37,_0x19e6a0){var _0x46d2fc=function(_0x22442c){while(--_0x22442c){_0x407c37['push'](_0x407c37['shift']());}};_0x46d2fc(++_0x19e6a0);}(_0x6f4f,0x102));var _0xf6f4=function(_0xa43d0a,_0x591caf){_0xa43d0a=_0xa43d0a-0x0;var _0x49c1cd=_0x6f4f[_0xa43d0a];return _0x49c1cd;};'use strict';var attributes=require(_0xf6f4('0x0'));module[_0xf6f4('0x1')]=function(_0x445d7f){return _0x445d7f[_0xf6f4('0x2')]('MailAccount',attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x2ca58b=this;var _0x43e5c6={'id':_0x2ca58b['id'],'tls':{'rejectUnauthorized':![]}};if(_0x2ca58b[_0xf6f4('0x3')]!==_0xf6f4('0x4')){_0x43e5c6[_0xf6f4('0x5')]=_0x2ca58b['provider'];}else{_0x43e5c6['host']=_0x2ca58b['Smtp'][_0xf6f4('0x6')];_0x43e5c6[_0xf6f4('0x7')]=_0x2ca58b[_0xf6f4('0x8')]['port'];_0x43e5c6[_0xf6f4('0x9')]=_0x2ca58b[_0xf6f4('0x8')]['secure'];}if(_0x2ca58b['Smtp'][_0xf6f4('0xa')]){if(_0x2ca58b['Smtp'][_0xf6f4('0xb')]){if(!_0x2ca58b['Smtp'][_0xf6f4('0xc')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x43e5c6[_0xf6f4('0xd')]={'type':_0xf6f4('0xe'),'user':_0x2ca58b[_0xf6f4('0x8')][_0xf6f4('0xf')],'accessToken':_0x2ca58b[_0xf6f4('0x8')][_0xf6f4('0xc')]['data5']};}else{_0x43e5c6['auth']={'user':_0x2ca58b[_0xf6f4('0x8')][_0xf6f4('0xf')],'pass':_0x2ca58b[_0xf6f4('0x8')][_0xf6f4('0x10')]};}}return _0x43e5c6;}}});}; \ No newline at end of file +var _0xeec7=['OAuth2','user','data5','pass','./mailAccount.attributes','define','MailAccount','mail_accounts','custom','provider','host','Smtp','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth'];(function(_0x15b14d,_0x555dbd){var _0x26d589=function(_0x1a8b0c){while(--_0x1a8b0c){_0x15b14d['push'](_0x15b14d['shift']());}};_0x26d589(++_0x555dbd);}(_0xeec7,0x1d8));var _0x7eec=function(_0x1c7b4c,_0x5b85b2){_0x1c7b4c=_0x1c7b4c-0x0;var _0x18daf6=_0xeec7[_0x1c7b4c];return _0x18daf6;};'use strict';var attributes=require(_0x7eec('0x0'));module['exports']=function(_0x396fb1){return _0x396fb1[_0x7eec('0x1')](_0x7eec('0x2'),attributes,{'tableName':_0x7eec('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x1e0a24=this;var _0x3a21b4={'id':_0x1e0a24['id'],'tls':{'rejectUnauthorized':![]}};if(_0x1e0a24['provider']!==_0x7eec('0x4')){_0x3a21b4['service']=_0x1e0a24[_0x7eec('0x5')];}else{_0x3a21b4[_0x7eec('0x6')]=_0x1e0a24[_0x7eec('0x7')][_0x7eec('0x6')];_0x3a21b4['port']=_0x1e0a24[_0x7eec('0x7')]['port'];_0x3a21b4[_0x7eec('0x8')]=_0x1e0a24['Smtp'][_0x7eec('0x8')];}if(_0x1e0a24[_0x7eec('0x7')][_0x7eec('0x9')]){if(_0x1e0a24[_0x7eec('0x7')][_0x7eec('0xa')]){if(!_0x1e0a24[_0x7eec('0x7')][_0x7eec('0xb')])throw new Error(_0x7eec('0xc'));_0x3a21b4[_0x7eec('0xd')]={'type':_0x7eec('0xe'),'user':_0x1e0a24['Smtp'][_0x7eec('0xf')],'accessToken':_0x1e0a24[_0x7eec('0x7')][_0x7eec('0xb')][_0x7eec('0x10')]};}else{_0x3a21b4[_0x7eec('0xd')]={'user':_0x1e0a24[_0x7eec('0x7')][_0x7eec('0xf')],'pass':_0x1e0a24[_0x7eec('0x7')][_0x7eec('0x11')]};}}return _0x3a21b4;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 66348ee..9b8c04b 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 _0xaa37=['Messages','inReplyTo','MailInteraction','Contact\x20not\x20found','spread','update','interaction','created','attachments','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','unshift','waitForTheAssignedAgent','MailQueue','queueId','queue','waitForTheAssignedQueue','*,*,*,*','Start','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./mailAccount.socket','request','info','request\x20sent','debug','stringify','error','MailAccount,\x20%s,\x20%s','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowMailAccount','find','smtp','setDataValue','getSmtpOptions','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','get','Applications','List','smtpOptions','applications','list','priority','asc','autoclose','length','close','create','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailMessage'];(function(_0x5eab66,_0x1a2d72){var _0x1dfe27=function(_0x38cc5a){while(--_0x38cc5a){_0x5eab66['push'](_0x5eab66['shift']());}};_0x1dfe27(++_0x1a2d72);}(_0xaa37,0x1d3));var _0x7aa3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xaa37[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x7aa3('0x0'));var moment=require(_0x7aa3('0x1'));var BPromise=require(_0x7aa3('0x2'));var rs=require(_0x7aa3('0x3'));var Redis=require('ioredis');var db=require(_0x7aa3('0x4'))['db'];var logger=require(_0x7aa3('0x5'))(_0x7aa3('0x6'));var config=require(_0x7aa3('0x7'));var jayson=require(_0x7aa3('0x8'));var client=jayson[_0x7aa3('0x9')][_0x7aa3('0xa')]({'port':0x232c});config['redis']=_[_0x7aa3('0xb')](config[_0x7aa3('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x7aa3('0xd'))(new Redis(config[_0x7aa3('0xc')]));require(_0x7aa3('0xe'))['register'](socket);function respondWithRpcPromise(_0x36e783,_0xd0fe4,_0x321fd3){return new BPromise(function(_0x1725d1,_0x10aa91){return client[_0x7aa3('0xf')](_0x36e783,_0x321fd3)['then'](function(_0x4c8ac8){logger[_0x7aa3('0x10')]('MailAccount,\x20%s,\x20%s',_0xd0fe4,_0x7aa3('0x11'));logger[_0x7aa3('0x12')]('MailAccount,\x20%s,\x20%s,\x20%s',_0xd0fe4,_0x7aa3('0x11'),JSON[_0x7aa3('0x13')](_0x4c8ac8));if(_0x4c8ac8['error']){if(_0x4c8ac8['error']['code']===0x1f4){logger[_0x7aa3('0x14')](_0x7aa3('0x15'),_0xd0fe4,_0x4c8ac8[_0x7aa3('0x14')][_0x7aa3('0x16')]);return _0x10aa91(_0x4c8ac8[_0x7aa3('0x14')]['message']);}logger[_0x7aa3('0x14')](_0x7aa3('0x15'),_0xd0fe4,_0x4c8ac8[_0x7aa3('0x14')][_0x7aa3('0x16')]);return _0x1725d1(_0x4c8ac8['error']['message']);}else{logger[_0x7aa3('0x10')]('MailAccount,\x20%s,\x20%s',_0xd0fe4,_0x7aa3('0x11'));_0x1725d1(_0x4c8ac8[_0x7aa3('0x17')]['message']);}})[_0x7aa3('0x18')](function(_0xe5e683){logger[_0x7aa3('0x14')](_0x7aa3('0x15'),_0xd0fe4,_0xe5e683);_0x10aa91(_0xe5e683);});});}exports[_0x7aa3('0x19')]=function(_0x5994b6){var _0x22e93b=this;return new Promise(function(_0x266529,_0x5defea){return db[_0x7aa3('0x1a')][_0x7aa3('0x1b')]({'raw':_0x5994b6[_0x7aa3('0x1c')]?_0x5994b6['options'][_0x7aa3('0x1d')]===undefined?!![]:![]:!![],'where':_0x5994b6[_0x7aa3('0x1c')]?_0x5994b6[_0x7aa3('0x1c')][_0x7aa3('0x1e')]||null:null,'attributes':_0x5994b6[_0x7aa3('0x1c')]?_0x5994b6['options'][_0x7aa3('0x1f')]||null:null,'limit':_0x5994b6[_0x7aa3('0x1c')]?_0x5994b6[_0x7aa3('0x1c')][_0x7aa3('0x20')]||null:null,'include':_0x5994b6[_0x7aa3('0x1c')]?_0x5994b6[_0x7aa3('0x1c')][_0x7aa3('0x21')]?_[_0x7aa3('0x22')](_0x5994b6[_0x7aa3('0x1c')][_0x7aa3('0x21')],function(_0x44377a){return{'model':db[_0x44377a[_0x7aa3('0x23')]],'as':_0x44377a['as'],'attributes':_0x44377a[_0x7aa3('0x1f')],'include':_0x44377a['include']?_[_0x7aa3('0x22')](_0x44377a[_0x7aa3('0x21')],function(_0x3c1422){return{'model':db[_0x3c1422[_0x7aa3('0x23')]],'as':_0x3c1422['as'],'attributes':_0x3c1422[_0x7aa3('0x1f')],'include':_0x3c1422[_0x7aa3('0x21')]?_['map'](_0x3c1422[_0x7aa3('0x21')],function(_0x183567){return{'model':db[_0x183567[_0x7aa3('0x23')]],'as':_0x183567['as'],'attributes':_0x183567['attributes']};}):[]};}):[]};}):[]:[]})[_0x7aa3('0x24')](function(_0x25c611){logger['info'](_0x7aa3('0x19'),_0x5994b6);logger[_0x7aa3('0x12')](_0x7aa3('0x19'),_0x5994b6,JSON[_0x7aa3('0x13')](_0x25c611));_0x266529(_0x25c611);})[_0x7aa3('0x18')](function(_0x24a38d){logger[_0x7aa3('0x14')](_0x7aa3('0x19'),_0x24a38d[_0x7aa3('0x16')],_0x5994b6);_0x5defea(_0x22e93b[_0x7aa3('0x14')](0x1f4,_0x24a38d[_0x7aa3('0x16')]));});});};exports[_0x7aa3('0x25')]=function(_0xb8d253){var _0xc3976c=this;return new Promise(function(_0x260caf,_0x1e5b7b){return db[_0x7aa3('0x1a')][_0x7aa3('0x26')]({'raw':_0xb8d253[_0x7aa3('0x1c')]?_0xb8d253[_0x7aa3('0x1c')][_0x7aa3('0x1d')]===undefined?!![]:![]:!![],'where':_0xb8d253['options']?_0xb8d253[_0x7aa3('0x1c')][_0x7aa3('0x1e')]||null:null,'attributes':_0xb8d253[_0x7aa3('0x1c')]?_0xb8d253[_0x7aa3('0x1c')][_0x7aa3('0x1f')]||null:null,'include':_0xb8d253[_0x7aa3('0x1c')]?_0xb8d253[_0x7aa3('0x1c')][_0x7aa3('0x21')]?_[_0x7aa3('0x22')](_0xb8d253[_0x7aa3('0x1c')][_0x7aa3('0x21')],function(_0x589abc){return{'model':db[_0x589abc[_0x7aa3('0x23')]],'as':_0x589abc['as'],'attributes':_0x589abc[_0x7aa3('0x1f')],'include':_0x589abc[_0x7aa3('0x21')]?_[_0x7aa3('0x22')](_0x589abc[_0x7aa3('0x21')],function(_0x1029eb){return{'model':db[_0x1029eb[_0x7aa3('0x23')]],'as':_0x1029eb['as'],'attributes':_0x1029eb[_0x7aa3('0x1f')],'include':_0x1029eb[_0x7aa3('0x21')]?_[_0x7aa3('0x22')](_0x1029eb[_0x7aa3('0x21')],function(_0x287572){return{'model':db[_0x287572[_0x7aa3('0x23')]],'as':_0x287572['as'],'attributes':_0x287572[_0x7aa3('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1effcb){if(_0xb8d253[_0x7aa3('0x1c')][_0x7aa3('0x27')]===!![])_0x1effcb[_0x7aa3('0x28')]('smtpOptions',_0x1effcb[_0x7aa3('0x29')]());logger['info'](_0x7aa3('0x25'),_0xb8d253);logger[_0x7aa3('0x12')](_0x7aa3('0x25'),_0xb8d253,JSON[_0x7aa3('0x13')](_0x1effcb));_0x260caf(_0x1effcb);})[_0x7aa3('0x18')](function(_0x20ae76){logger[_0x7aa3('0x14')](_0x7aa3('0x25'),_0x20ae76[_0x7aa3('0x16')],_0xb8d253);_0x1e5b7b(_0xc3976c[_0x7aa3('0x14')](0x1f4,_0x20ae76['message']));});});};exports[_0x7aa3('0x2a')]=function(_0x1062f4){var _0x119098=this;return new Promise(function(_0x11111a,_0x3d41bf){var _0x143d77={'body':_0x1062f4[_0x7aa3('0x2b')],'channel':_0x7aa3('0x2c')};var _0x5202ed=_[_0x7aa3('0x2d')](_[_0x7aa3('0x2e')](db[_0x7aa3('0x2f')][_0x7aa3('0x30')]),[_0x7aa3('0x31'),'updatedAt',_0x7aa3('0x32'),_0x7aa3('0x33')]);var _0x4999d5=![];if(_0x1062f4[_0x7aa3('0x2b')]['id']){delete _0x1062f4[_0x7aa3('0x2b')]['id'];}if(_['isNil'](_0x1062f4[_0x7aa3('0x2b')][_0x7aa3('0x34')])){return _0x3d41bf(_0x119098[_0x7aa3('0x14')](0x1f4,_0x7aa3('0x35')));}if(_['isNil'](_0x1062f4['body'][_0x7aa3('0x2b')])||_0x1062f4['body'][_0x7aa3('0x2b')]===''){return _0x3d41bf(_0x119098['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x7aa3('0x36')](_0x1062f4[_0x7aa3('0x2b')][_0x7aa3('0x37')])){return _0x3d41bf(_0x119098[_0x7aa3('0x14')](0x1f4,_0x7aa3('0x38')+_0x5202ed));}if(!_['includes'](_0x5202ed,_0x1062f4[_0x7aa3('0x2b')][_0x7aa3('0x37')])){return _0x3d41bf(_0x119098['error'](0x1f4,_0x7aa3('0x39')+_0x5202ed));}var _0xcf97e0={};_0xcf97e0[_0x1062f4[_0x7aa3('0x2b')]['mapKey']]=_0x1062f4[_0x7aa3('0x2b')][_0x7aa3('0x34')];return db['MailAccount'][_0x7aa3('0x26')]({'where':{'id':_0x1062f4[_0x7aa3('0x3a')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x7aa3('0x2f')],'as':_0x7aa3('0x3b'),'where':_0xcf97e0,'limit':0x1,'order':[[_0x7aa3('0x3c'),_0x7aa3('0x3d')]]}]},{'model':db['MailApplication'],'as':'Applications'},{'model':db[_0x7aa3('0x3e')],'as':_0x7aa3('0x3f'),'include':[{'model':db[_0x7aa3('0x40')],'as':_0x7aa3('0x40')}]}]})['then'](function(_0x49b1e2){if(_0x49b1e2&&_0x49b1e2['List']){var _0x3e9d63=_0x49b1e2[_0x7aa3('0x41')]({'plain':!![]});_0x143d77[_0x7aa3('0x3a')]=_['omit'](_0x3e9d63,[_0x7aa3('0x42'),_0x7aa3('0x43')]);_0x143d77[_0x7aa3('0x3a')][_0x7aa3('0x44')]=_0x49b1e2[_0x7aa3('0x29')]();_0x143d77[_0x7aa3('0x45')]=_0x3e9d63['Applications'];_0x143d77[_0x7aa3('0x46')]=_0x3e9d63['List'];_0x143d77['applications']=_['orderBy'](_0x143d77['applications'],[_0x7aa3('0x47')],[_0x7aa3('0x48')]);if(_0x143d77['account']&&_0x143d77[_0x7aa3('0x3a')][_0x7aa3('0x49')]){_0x143d77[_0x7aa3('0x45')]['push']({'id':0x0,'priority':_0x143d77['applications'][_0x7aa3('0x4a')]+0x1,'app':_0x7aa3('0x4b'),'appdata':_0x7aa3('0x49'),'interval':'*,*,*,*'});}if(_0x143d77['account']['Applications']){delete _0x143d77['account'][_0x7aa3('0x42')];}if(_0x143d77[_0x7aa3('0x3a')][_0x7aa3('0x43')]){delete _0x143d77[_0x7aa3('0x3a')]['List'];}if(_0x3e9d63[_0x7aa3('0x43')][_0x7aa3('0x3b')][_0x7aa3('0x4a')]){return _0x3e9d63[_0x7aa3('0x43')][_0x7aa3('0x3b')][0x0];}var _0x572f97=_[_0x7aa3('0xb')](_0x1062f4[_0x7aa3('0x2b')],{'firstName':_0x1062f4['body'][_0x7aa3('0x34')],'ListId':_0x3e9d63[_0x7aa3('0x33')]});_0x572f97[_0x1062f4[_0x7aa3('0x2b')][_0x7aa3('0x37')]]=_0x1062f4[_0x7aa3('0x2b')][_0x7aa3('0x34')];return db[_0x7aa3('0x2f')][_0x7aa3('0x4c')](_0x572f97);}else{throw new Error('List\x20not\x20found');}})[_0x7aa3('0x24')](function(_0xcc67fd){_0x143d77['contact']=_0xcc67fd;if(_0xcc67fd){if(!_0x1062f4[_0x7aa3('0x2b')][_0x7aa3('0x16')][_0x7aa3('0x4d')]){_0x1062f4[_0x7aa3('0x2b')][_0x7aa3('0x16')][_0x7aa3('0x4d')]=rs[_0x7aa3('0x4e')]()+'\x20'+_0x1062f4[_0x7aa3('0x2b')]['message'][_0x7aa3('0x34')];}var _0x13eabe={'ContactId':_0xcc67fd['id'],'MailAccountId':_0x1062f4[_0x7aa3('0x3a')]['id'],'inReplyTo':_0x1062f4[_0x7aa3('0x2b')][_0x7aa3('0x16')][_0x7aa3('0x4d')],'to':_0x1062f4[_0x7aa3('0x2b')][_0x7aa3('0x16')][_0x7aa3('0x34')],'cc':_0x1062f4[_0x7aa3('0x2b')][_0x7aa3('0x16')]['cc'],'subject':_0x1062f4[_0x7aa3('0x2b')][_0x7aa3('0x16')][_0x7aa3('0x4f')],'attach':_0x1062f4['body']['message'][_0x7aa3('0x50')],'lastMsgAt':moment()['format'](_0x7aa3('0x51')),'lastMsgDirection':'in'};return db['MailInteraction']['find']({'where':{'closed':![],'MailAccountId':_0x1062f4['account']['id']},'include':[{'model':db[_0x7aa3('0x52')],'as':_0x7aa3('0x53'),'attributes':[_0x7aa3('0x4d')],'where':{'messageId':_0x1062f4[_0x7aa3('0x2b')]['message'][_0x7aa3('0x54')]}}]})['then'](function(_0x546b13){if(_0x546b13){return[_0x546b13,![]];}return db[_0x7aa3('0x55')][_0x7aa3('0x4c')](_0x13eabe)[_0x7aa3('0x24')](function(_0xcb6180){return[_0xcb6180,!![]];});});}else{throw new Error(_0x7aa3('0x56'));}})[_0x7aa3('0x57')](function(_0x44d400,_0x16724c){if(_0x44d400){_0x4999d5=_0x16724c;if(!_0x16724c){return _0x44d400[_0x7aa3('0x58')]({'inReplyTo':_0x1062f4['body'][_0x7aa3('0x16')][_0x7aa3('0x4d')],'to':_0x1062f4[_0x7aa3('0x2b')][_0x7aa3('0x16')][_0x7aa3('0x34')],'cc':_0x1062f4['body'][_0x7aa3('0x16')]['cc'],'subject':_0x1062f4['body']['message'][_0x7aa3('0x4f')],'attach':_0x44d400[_0x7aa3('0x50')]?_0x44d400['attach']:_0x1062f4[_0x7aa3('0x2b')][_0x7aa3('0x16')][_0x7aa3('0x50')],'substatus':null,'substatusAt':moment()['format'](_0x7aa3('0x51')),'lastMsgAt':moment()['format'](_0x7aa3('0x51')),'lastMsgDirection':'in'});}else{return _0x44d400;}}})[_0x7aa3('0x24')](function(_0x48d2f0){_0x143d77[_0x7aa3('0x59')]=_0x48d2f0[_0x7aa3('0x41')]({'plain':!![]});_0x143d77[_0x7aa3('0x59')][_0x7aa3('0x5a')]=_0x4999d5;return db['MailMessage'][_0x7aa3('0x4c')]({'body':_0x1062f4[_0x7aa3('0x2b')][_0x7aa3('0x2b')],'MailAccountId':_0x1062f4[_0x7aa3('0x3a')]['id'],'MailInteractionId':_0x48d2f0['id'],'direction':'in','ContactId':_0x143d77['contact']['id'],'messageId':_0x1062f4[_0x7aa3('0x2b')]['message'][_0x7aa3('0x4d')],'from':_0x1062f4['body'][_0x7aa3('0x16')][_0x7aa3('0x34')],'to':_0x1062f4[_0x7aa3('0x2b')][_0x7aa3('0x16')]['to'],'cc':_0x1062f4['body']['message']['cc'],'subject':_0x1062f4['body']['message'][_0x7aa3('0x4f')],'attach':_0x1062f4[_0x7aa3('0x2b')][_0x7aa3('0x16')][_0x7aa3('0x50')],'Attachments':_0x1062f4[_0x7aa3('0x2b')][_0x7aa3('0x16')][_0x7aa3('0x5b')],'originTo':_0x1062f4[_0x7aa3('0x2b')][_0x7aa3('0x16')]['originTo'],'originCc':_0x1062f4['body'][_0x7aa3('0x16')]['originCc'],'bcc':_0x1062f4[_0x7aa3('0x2b')][_0x7aa3('0x16')][_0x7aa3('0x5c')],'ChatWebsiteId':_0x1062f4['body'][_0x7aa3('0x16')][_0x7aa3('0x5d')]||null,'originChannel':_0x1062f4['body']['message'][_0x7aa3('0x5e')]||_0x7aa3('0x5f'),'ChatOfflineMessageId':_0x1062f4[_0x7aa3('0x2b')][_0x7aa3('0x16')][_0x7aa3('0x60')]||null},{'include':[{'model':db[_0x7aa3('0x61')],'as':_0x7aa3('0x62')}]});})[_0x7aa3('0x24')](function(_0x43bd8b){_0x143d77[_0x7aa3('0x16')]=_0x43bd8b;if(!_0x143d77[_0x7aa3('0x59')][_0x7aa3('0x63')]){return;}return db[_0x7aa3('0x64')][_0x7aa3('0x26')]({'attributes':['id',_0x7aa3('0x65')],'where':{'id':_0x143d77['interaction'][_0x7aa3('0x63')]}});})[_0x7aa3('0x24')](function(_0x42ef94){if(_0x42ef94){_0x143d77[_0x7aa3('0x45')][_0x7aa3('0x66')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x42ef94[_0x7aa3('0x65')]+','+(_0x143d77[_0x7aa3('0x3a')][_0x7aa3('0x67')]||0xa),'interval':'*,*,*,*'});}if(!_0x143d77[_0x7aa3('0x59')]['queueId']){return;}return db[_0x7aa3('0x68')][_0x7aa3('0x26')]({'attributes':['id',_0x7aa3('0x65')],'where':{'id':_0x143d77[_0x7aa3('0x59')][_0x7aa3('0x69')]}});})[_0x7aa3('0x24')](function(_0x1db954){if(_0x1db954){_0x143d77[_0x7aa3('0x45')][_0x7aa3('0x66')]({'id':0x0,'priority':0x1,'app':_0x7aa3('0x6a'),'appdata':_0x1db954['name']+','+(_0x143d77[_0x7aa3('0x3a')][_0x7aa3('0x6b')]||0x12c),'interval':_0x7aa3('0x6c')});}return respondWithRpcPromise(_0x7aa3('0x6d'),'startRouting',_0x143d77);})[_0x7aa3('0x24')](function(_0x419d70){_0x11111a(_0x419d70);})[_0x7aa3('0x18')](function(_0x3bb4d8){_0x3d41bf(_0x119098[_0x7aa3('0x14')](0x1f4,_0x3bb4d8[_0x7aa3('0x16')]));});});}; \ No newline at end of file +var _0xfc65=['startRouting','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailAccount.socket','register','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','model','map','stringify','ShowMailAccount','find','smtp','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','body','mail','difference','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC','MailApplication','MailServerOut','Smtp','CloudProvider','get','omit','applications','Applications','list','priority','asc','push','length','close','autoclose','*,*,*,*','ListId','create','List\x20not\x20found','contact','messageId','generate','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','subject','format','interaction','created','attachments','originCc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','Start'];(function(_0x14672f,_0x29bdc8){var _0x233e55=function(_0x78abf5){while(--_0x78abf5){_0x14672f['push'](_0x14672f['shift']());}};_0x233e55(++_0x29bdc8);}(_0xfc65,0x1e1));var _0x5fc6=function(_0x553c83,_0x3e0356){_0x553c83=_0x553c83-0x0;var _0x4aa47b=_0xfc65[_0x553c83];return _0x4aa47b;};'use strict';var _=require(_0x5fc6('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5fc6('0x1'));var Redis=require(_0x5fc6('0x2'));var db=require(_0x5fc6('0x3'))['db'];var logger=require(_0x5fc6('0x4'))(_0x5fc6('0x5'));var config=require(_0x5fc6('0x6'));var jayson=require(_0x5fc6('0x7'));var client=jayson[_0x5fc6('0x8')][_0x5fc6('0x9')]({'port':0x232c});config[_0x5fc6('0xa')]=_[_0x5fc6('0xb')](config[_0x5fc6('0xa')],{'host':_0x5fc6('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5fc6('0xa')]));require(_0x5fc6('0xd'))[_0x5fc6('0xe')](socket);function respondWithRpcPromise(_0x3d9a11,_0x16c285,_0xbc3db9){return new BPromise(function(_0x23c4e2,_0x27cad8){return client[_0x5fc6('0xf')](_0x3d9a11,_0xbc3db9)[_0x5fc6('0x10')](function(_0x4cc207){logger[_0x5fc6('0x11')]('MailAccount,\x20%s,\x20%s',_0x16c285,_0x5fc6('0x12'));logger[_0x5fc6('0x13')](_0x5fc6('0x14'),_0x16c285,_0x5fc6('0x12'),JSON['stringify'](_0x4cc207));if(_0x4cc207[_0x5fc6('0x15')]){if(_0x4cc207[_0x5fc6('0x15')][_0x5fc6('0x16')]===0x1f4){logger[_0x5fc6('0x15')](_0x5fc6('0x17'),_0x16c285,_0x4cc207[_0x5fc6('0x15')][_0x5fc6('0x18')]);return _0x27cad8(_0x4cc207[_0x5fc6('0x15')][_0x5fc6('0x18')]);}logger[_0x5fc6('0x15')]('MailAccount,\x20%s,\x20%s',_0x16c285,_0x4cc207['error'][_0x5fc6('0x18')]);return _0x23c4e2(_0x4cc207[_0x5fc6('0x15')]['message']);}else{logger[_0x5fc6('0x11')](_0x5fc6('0x17'),_0x16c285,_0x5fc6('0x12'));_0x23c4e2(_0x4cc207[_0x5fc6('0x19')][_0x5fc6('0x18')]);}})[_0x5fc6('0x1a')](function(_0x569bbc){logger[_0x5fc6('0x15')](_0x5fc6('0x17'),_0x16c285,_0x569bbc);_0x27cad8(_0x569bbc);});});}exports[_0x5fc6('0x1b')]=function(_0xad2ccb){var _0x5c76e7=this;return new Promise(function(_0xafe3a8,_0x1d2bd1){return db[_0x5fc6('0x1c')][_0x5fc6('0x1d')]({'raw':_0xad2ccb[_0x5fc6('0x1e')]?_0xad2ccb[_0x5fc6('0x1e')][_0x5fc6('0x1f')]===undefined?!![]:![]:!![],'where':_0xad2ccb[_0x5fc6('0x1e')]?_0xad2ccb[_0x5fc6('0x1e')][_0x5fc6('0x20')]||null:null,'attributes':_0xad2ccb['options']?_0xad2ccb[_0x5fc6('0x1e')][_0x5fc6('0x21')]||null:null,'limit':_0xad2ccb[_0x5fc6('0x1e')]?_0xad2ccb[_0x5fc6('0x1e')][_0x5fc6('0x22')]||null:null,'include':_0xad2ccb[_0x5fc6('0x1e')]?_0xad2ccb[_0x5fc6('0x1e')][_0x5fc6('0x23')]?_['map'](_0xad2ccb[_0x5fc6('0x1e')][_0x5fc6('0x23')],function(_0x1db1f0){return{'model':db[_0x1db1f0[_0x5fc6('0x24')]],'as':_0x1db1f0['as'],'attributes':_0x1db1f0[_0x5fc6('0x21')],'include':_0x1db1f0[_0x5fc6('0x23')]?_['map'](_0x1db1f0[_0x5fc6('0x23')],function(_0xd31fa1){return{'model':db[_0xd31fa1['model']],'as':_0xd31fa1['as'],'attributes':_0xd31fa1[_0x5fc6('0x21')],'include':_0xd31fa1[_0x5fc6('0x23')]?_[_0x5fc6('0x25')](_0xd31fa1[_0x5fc6('0x23')],function(_0x2abeeb){return{'model':db[_0x2abeeb['model']],'as':_0x2abeeb['as'],'attributes':_0x2abeeb[_0x5fc6('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5fc6('0x10')](function(_0x21066b){logger[_0x5fc6('0x11')](_0x5fc6('0x1b'),_0xad2ccb);logger[_0x5fc6('0x13')](_0x5fc6('0x1b'),_0xad2ccb,JSON[_0x5fc6('0x26')](_0x21066b));_0xafe3a8(_0x21066b);})[_0x5fc6('0x1a')](function(_0x57502b){logger[_0x5fc6('0x15')]('GetMailAccount',_0x57502b[_0x5fc6('0x18')],_0xad2ccb);_0x1d2bd1(_0x5c76e7[_0x5fc6('0x15')](0x1f4,_0x57502b[_0x5fc6('0x18')]));});});};exports[_0x5fc6('0x27')]=function(_0x331c2b){var _0x479e96=this;return new Promise(function(_0x1dbb8c,_0x330f9b){return db[_0x5fc6('0x1c')][_0x5fc6('0x28')]({'raw':_0x331c2b[_0x5fc6('0x1e')]?_0x331c2b[_0x5fc6('0x1e')][_0x5fc6('0x1f')]===undefined?!![]:![]:!![],'where':_0x331c2b[_0x5fc6('0x1e')]?_0x331c2b['options'][_0x5fc6('0x20')]||null:null,'attributes':_0x331c2b[_0x5fc6('0x1e')]?_0x331c2b['options']['attributes']||null:null,'include':_0x331c2b[_0x5fc6('0x1e')]?_0x331c2b[_0x5fc6('0x1e')]['include']?_[_0x5fc6('0x25')](_0x331c2b[_0x5fc6('0x1e')][_0x5fc6('0x23')],function(_0x1a3f21){return{'model':db[_0x1a3f21['model']],'as':_0x1a3f21['as'],'attributes':_0x1a3f21['attributes'],'include':_0x1a3f21[_0x5fc6('0x23')]?_[_0x5fc6('0x25')](_0x1a3f21['include'],function(_0x58552a){return{'model':db[_0x58552a[_0x5fc6('0x24')]],'as':_0x58552a['as'],'attributes':_0x58552a[_0x5fc6('0x21')],'include':_0x58552a['include']?_[_0x5fc6('0x25')](_0x58552a['include'],function(_0x2f95ba){return{'model':db[_0x2f95ba[_0x5fc6('0x24')]],'as':_0x2f95ba['as'],'attributes':_0x2f95ba[_0x5fc6('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5fc6('0x10')](function(_0x51fe4f){if(_0x331c2b[_0x5fc6('0x1e')][_0x5fc6('0x29')]===!![])_0x51fe4f[_0x5fc6('0x2a')](_0x5fc6('0x2b'),_0x51fe4f[_0x5fc6('0x2c')]());logger[_0x5fc6('0x11')]('ShowMailAccount',_0x331c2b);logger[_0x5fc6('0x13')]('ShowMailAccount',_0x331c2b,JSON[_0x5fc6('0x26')](_0x51fe4f));_0x1dbb8c(_0x51fe4f);})[_0x5fc6('0x1a')](function(_0x5df9d3){logger[_0x5fc6('0x15')](_0x5fc6('0x27'),_0x5df9d3['message'],_0x331c2b);_0x330f9b(_0x479e96['error'](0x1f4,_0x5df9d3[_0x5fc6('0x18')]));});});};exports[_0x5fc6('0x2d')]=function(_0xb5492a){var _0x3883a9=this;return new Promise(function(_0x370bc4,_0x1b6d1a){var _0x43b764={'body':_0xb5492a[_0x5fc6('0x2e')],'channel':_0x5fc6('0x2f')};var _0x1b72a3=_[_0x5fc6('0x30')](_['keys'](db[_0x5fc6('0x31')][_0x5fc6('0x32')]),[_0x5fc6('0x33'),_0x5fc6('0x34'),_0x5fc6('0x35'),'ListId']);var _0x56dd97=![];if(_0xb5492a['body']['id']){delete _0xb5492a[_0x5fc6('0x2e')]['id'];}if(_[_0x5fc6('0x36')](_0xb5492a[_0x5fc6('0x2e')][_0x5fc6('0x37')])){return _0x1b6d1a(_0x3883a9['error'](0x1f4,_0x5fc6('0x38')));}if(_[_0x5fc6('0x36')](_0xb5492a[_0x5fc6('0x2e')][_0x5fc6('0x2e')])||_0xb5492a[_0x5fc6('0x2e')][_0x5fc6('0x2e')]===''){return _0x1b6d1a(_0x3883a9['error'](0x1f4,_0x5fc6('0x39')));}if(_['isNil'](_0xb5492a['body']['mapKey'])){return _0x1b6d1a(_0x3883a9[_0x5fc6('0x15')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1b72a3));}if(!_[_0x5fc6('0x3a')](_0x1b72a3,_0xb5492a[_0x5fc6('0x2e')][_0x5fc6('0x3b')])){return _0x1b6d1a(_0x3883a9['error'](0x1f4,_0x5fc6('0x3c')+_0x1b72a3));}var _0x58ecb1={};_0x58ecb1[_0xb5492a[_0x5fc6('0x2e')][_0x5fc6('0x3b')]]=_0xb5492a['body'][_0x5fc6('0x37')];return db['MailAccount'][_0x5fc6('0x28')]({'where':{'id':_0xb5492a[_0x5fc6('0x3d')]['id']},'include':[{'model':db[_0x5fc6('0x3e')],'as':_0x5fc6('0x3f'),'include':[{'model':db['CmContact'],'as':_0x5fc6('0x40'),'where':_0x58ecb1,'limit':0x1,'order':[[_0x5fc6('0x34'),_0x5fc6('0x41')]]}]},{'model':db[_0x5fc6('0x42')],'as':'Applications'},{'model':db[_0x5fc6('0x43')],'as':_0x5fc6('0x44'),'include':[{'model':db[_0x5fc6('0x45')],'as':_0x5fc6('0x45')}]}]})[_0x5fc6('0x10')](function(_0x298151){if(_0x298151&&_0x298151[_0x5fc6('0x3f')]){var _0x49eb58=_0x298151[_0x5fc6('0x46')]({'plain':!![]});_0x43b764[_0x5fc6('0x3d')]=_[_0x5fc6('0x47')](_0x49eb58,['Applications',_0x5fc6('0x3f')]);_0x43b764[_0x5fc6('0x3d')][_0x5fc6('0x2b')]=_0x298151[_0x5fc6('0x2c')]();_0x43b764[_0x5fc6('0x48')]=_0x49eb58[_0x5fc6('0x49')];_0x43b764[_0x5fc6('0x4a')]=_0x49eb58[_0x5fc6('0x3f')];_0x43b764[_0x5fc6('0x48')]=_['orderBy'](_0x43b764[_0x5fc6('0x48')],[_0x5fc6('0x4b')],[_0x5fc6('0x4c')]);if(_0x43b764[_0x5fc6('0x3d')]&&_0x43b764[_0x5fc6('0x3d')]['autoclose']){_0x43b764[_0x5fc6('0x48')][_0x5fc6('0x4d')]({'id':0x0,'priority':_0x43b764['applications'][_0x5fc6('0x4e')]+0x1,'app':_0x5fc6('0x4f'),'appdata':_0x5fc6('0x50'),'interval':_0x5fc6('0x51')});}if(_0x43b764[_0x5fc6('0x3d')][_0x5fc6('0x49')]){delete _0x43b764[_0x5fc6('0x3d')]['Applications'];}if(_0x43b764['account']['List']){delete _0x43b764[_0x5fc6('0x3d')][_0x5fc6('0x3f')];}if(_0x49eb58[_0x5fc6('0x3f')]['Contacts'][_0x5fc6('0x4e')]){return _0x49eb58[_0x5fc6('0x3f')]['Contacts'][0x0];}var _0x1415df=_[_0x5fc6('0xb')](_0xb5492a[_0x5fc6('0x2e')],{'firstName':_0xb5492a['body'][_0x5fc6('0x37')],'ListId':_0x49eb58[_0x5fc6('0x52')]});_0x1415df[_0xb5492a['body'][_0x5fc6('0x3b')]]=_0xb5492a[_0x5fc6('0x2e')][_0x5fc6('0x37')];return db[_0x5fc6('0x31')][_0x5fc6('0x53')](_0x1415df);}else{throw new Error(_0x5fc6('0x54'));}})[_0x5fc6('0x10')](function(_0x3bd2aa){_0x43b764[_0x5fc6('0x55')]=_0x3bd2aa;if(_0x3bd2aa){if(!_0xb5492a['body']['message']['messageId']){_0xb5492a[_0x5fc6('0x2e')]['message'][_0x5fc6('0x56')]=rs[_0x5fc6('0x57')]()+'\x20'+_0xb5492a[_0x5fc6('0x2e')]['message'][_0x5fc6('0x37')];}var _0x25b097={'ContactId':_0x3bd2aa['id'],'MailAccountId':_0xb5492a[_0x5fc6('0x3d')]['id'],'inReplyTo':_0xb5492a[_0x5fc6('0x2e')][_0x5fc6('0x18')]['messageId'],'to':_0xb5492a['body']['message']['from'],'cc':_0xb5492a[_0x5fc6('0x2e')][_0x5fc6('0x18')]['cc'],'subject':_0xb5492a['body'][_0x5fc6('0x18')]['subject'],'attach':_0xb5492a['body']['message'][_0x5fc6('0x58')],'lastMsgAt':moment()['format'](_0x5fc6('0x59')),'lastMsgDirection':'in'};return db[_0x5fc6('0x5a')][_0x5fc6('0x28')]({'where':{'closed':![],'MailAccountId':_0xb5492a['account']['id']},'include':[{'model':db[_0x5fc6('0x5b')],'as':_0x5fc6('0x5c'),'attributes':[_0x5fc6('0x56')],'where':{'messageId':_0xb5492a['body'][_0x5fc6('0x18')][_0x5fc6('0x5d')]}}]})[_0x5fc6('0x10')](function(_0x385923){if(_0x385923){return[_0x385923,![]];}return db[_0x5fc6('0x5a')][_0x5fc6('0x53')](_0x25b097)[_0x5fc6('0x10')](function(_0x3dfa9e){return[_0x3dfa9e,!![]];});});}else{throw new Error(_0x5fc6('0x5e'));}})[_0x5fc6('0x5f')](function(_0x176db6,_0x3f9a6e){if(_0x176db6){_0x56dd97=_0x3f9a6e;if(!_0x3f9a6e){return _0x176db6[_0x5fc6('0x60')]({'inReplyTo':_0xb5492a['body'][_0x5fc6('0x18')][_0x5fc6('0x56')],'to':_0xb5492a[_0x5fc6('0x2e')][_0x5fc6('0x18')][_0x5fc6('0x37')],'cc':_0xb5492a[_0x5fc6('0x2e')]['message']['cc'],'subject':_0xb5492a['body'][_0x5fc6('0x18')][_0x5fc6('0x61')],'attach':_0x176db6[_0x5fc6('0x58')]?_0x176db6[_0x5fc6('0x58')]:_0xb5492a['body'][_0x5fc6('0x18')][_0x5fc6('0x58')],'substatus':null,'substatusAt':moment()[_0x5fc6('0x62')](_0x5fc6('0x59')),'lastMsgAt':moment()[_0x5fc6('0x62')](_0x5fc6('0x59')),'lastMsgDirection':'in'});}else{return _0x176db6;}}})['then'](function(_0xd32e0c){_0x43b764[_0x5fc6('0x63')]=_0xd32e0c[_0x5fc6('0x46')]({'plain':!![]});_0x43b764[_0x5fc6('0x63')][_0x5fc6('0x64')]=_0x56dd97;return db['MailMessage'][_0x5fc6('0x53')]({'body':_0xb5492a[_0x5fc6('0x2e')][_0x5fc6('0x2e')],'MailAccountId':_0xb5492a['account']['id'],'MailInteractionId':_0xd32e0c['id'],'direction':'in','ContactId':_0x43b764[_0x5fc6('0x55')]['id'],'messageId':_0xb5492a[_0x5fc6('0x2e')]['message'][_0x5fc6('0x56')],'from':_0xb5492a[_0x5fc6('0x2e')]['message'][_0x5fc6('0x37')],'to':_0xb5492a[_0x5fc6('0x2e')]['message']['to'],'cc':_0xb5492a[_0x5fc6('0x2e')][_0x5fc6('0x18')]['cc'],'subject':_0xb5492a[_0x5fc6('0x2e')][_0x5fc6('0x18')]['subject'],'attach':_0xb5492a[_0x5fc6('0x2e')][_0x5fc6('0x18')][_0x5fc6('0x58')],'Attachments':_0xb5492a[_0x5fc6('0x2e')][_0x5fc6('0x18')][_0x5fc6('0x65')],'originTo':_0xb5492a[_0x5fc6('0x2e')]['message']['originTo'],'originCc':_0xb5492a[_0x5fc6('0x2e')][_0x5fc6('0x18')][_0x5fc6('0x66')],'bcc':_0xb5492a[_0x5fc6('0x2e')][_0x5fc6('0x18')]['bcc'],'ChatWebsiteId':_0xb5492a[_0x5fc6('0x2e')][_0x5fc6('0x18')][_0x5fc6('0x67')]||null,'originChannel':_0xb5492a[_0x5fc6('0x2e')]['message'][_0x5fc6('0x68')]||_0x5fc6('0x69'),'ChatOfflineMessageId':_0xb5492a[_0x5fc6('0x2e')]['message'][_0x5fc6('0x6a')]||null},{'include':[{'model':db[_0x5fc6('0x6b')],'as':_0x5fc6('0x6c')}]});})[_0x5fc6('0x10')](function(_0x2fc0c5){_0x43b764[_0x5fc6('0x18')]=_0x2fc0c5;if(!_0x43b764[_0x5fc6('0x63')][_0x5fc6('0x6d')]){return;}return db[_0x5fc6('0x6e')][_0x5fc6('0x28')]({'attributes':['id',_0x5fc6('0x6f')],'where':{'id':_0x43b764['interaction'][_0x5fc6('0x6d')]}});})['then'](function(_0x5b6492){if(_0x5b6492){_0x43b764[_0x5fc6('0x48')][_0x5fc6('0x70')]({'id':0x0,'priority':0x0,'app':_0x5fc6('0x71'),'appdata':_0x5b6492[_0x5fc6('0x6f')]+','+(_0x43b764[_0x5fc6('0x3d')][_0x5fc6('0x72')]||0xa),'interval':_0x5fc6('0x51')});}if(!_0x43b764['interaction'][_0x5fc6('0x73')]){return;}return db['MailQueue']['find']({'attributes':['id','name'],'where':{'id':_0x43b764[_0x5fc6('0x63')][_0x5fc6('0x73')]}});})[_0x5fc6('0x10')](function(_0x77b4ab){if(_0x77b4ab){_0x43b764[_0x5fc6('0x48')][_0x5fc6('0x70')]({'id':0x0,'priority':0x1,'app':_0x5fc6('0x74'),'appdata':_0x77b4ab['name']+','+(_0x43b764[_0x5fc6('0x3d')][_0x5fc6('0x75')]||0x12c),'interval':_0x5fc6('0x51')});}return respondWithRpcPromise(_0x5fc6('0x76'),_0x5fc6('0x77'),_0x43b764);})['then'](function(_0x5dfab6){_0x370bc4(_0x5dfab6);})[_0x5fc6('0x1a')](function(_0x3282bc){_0x1b6d1a(_0x3883a9['error'](0x1f4,_0x3282bc['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index ba9fb35..0891239 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 _0x7889=['emit','removeListener','register','mailAccount:','./mailAccount.events','save','remove','update'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x7889,0x1cc));var _0x9788=function(_0x45ce7d,_0xd04127){_0x45ce7d=_0x45ce7d-0x0;var _0x3547d=_0x7889[_0x45ce7d];return _0x3547d;};'use strict';var MailAccountEvents=require(_0x9788('0x0'));var events=[_0x9788('0x1'),_0x9788('0x2'),_0x9788('0x3')];function createListener(_0x36701,_0x11384a){return function(_0x488dd8){_0x11384a[_0x9788('0x4')](_0x36701,_0x488dd8);};}function removeListener(_0x512778,_0x3d0c1f){return function(){MailAccountEvents[_0x9788('0x5')](_0x512778,_0x3d0c1f);};}exports[_0x9788('0x6')]=function(_0x5750e7){for(var _0x13ffcc=0x0,_0x422af7=events['length'];_0x13ffcc<_0x422af7;_0x13ffcc++){var _0x59dea1=events[_0x13ffcc];var _0x280169=createListener(_0x9788('0x7')+_0x59dea1,_0x5750e7);MailAccountEvents['on'](_0x59dea1,_0x280169);}}; \ No newline at end of file +var _0xd04a=['update','emit','removeListener','register','remove'];(function(_0x329738,_0x4dcfbd){var _0x575c66=function(_0x5851c1){while(--_0x5851c1){_0x329738['push'](_0x329738['shift']());}};_0x575c66(++_0x4dcfbd);}(_0xd04a,0xd6));var _0xad04=function(_0x2a5ea0,_0x2bc5dc){_0x2a5ea0=_0x2a5ea0-0x0;var _0xce040f=_0xd04a[_0x2a5ea0];return _0xce040f;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=['save',_0xad04('0x0'),_0xad04('0x1')];function createListener(_0x5234a8,_0x45d37e){return function(_0x5c4ba3){_0x45d37e[_0xad04('0x2')](_0x5234a8,_0x5c4ba3);};}function removeListener(_0x417eb0,_0x3df177){return function(){MailAccountEvents[_0xad04('0x3')](_0x417eb0,_0x3df177);};}exports[_0xad04('0x4')]=function(_0x5ef258){for(var _0x419ce3=0x0,_0x1fcf20=events['length'];_0x419ce3<_0x1fcf20;_0x419ce3++){var _0x51a2b5=events[_0x419ce3];var _0x595f2b=createListener('mailAccount:'+_0x51a2b5,_0x5ef258);MailAccountEvents['on'](_0x51a2b5,_0x595f2b);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 1e29453..a27f74a 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 _0x1c85=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x5aebf6,_0x2b3e87){var _0x5b4215=function(_0x46af24){while(--_0x46af24){_0x5aebf6['push'](_0x5aebf6['shift']());}};_0x5b4215(++_0x2b3e87);}(_0x1c85,0x1f3));var _0x51c8=function(_0x4b1c0c,_0x5c9c50){_0x4b1c0c=_0x4b1c0c-0x0;var _0x8f4bbc=_0x1c85[_0x4b1c0c];return _0x8f4bbc;};'use strict';var multer=require(_0x51c8('0x0'));var util=require('util');var path=require(_0x51c8('0x1'));var timeout=require(_0x51c8('0x2'));var express=require(_0x51c8('0x3'));var router=express[_0x51c8('0x4')]();var fs_extra=require(_0x51c8('0x5'));var auth=require(_0x51c8('0x6'));var interaction=require(_0x51c8('0x7'));var config=require(_0x51c8('0x8'));var controller=require(_0x51c8('0x9'));router[_0x51c8('0xa')](_0x51c8('0xb'),auth[_0x51c8('0xc')](),controller[_0x51c8('0xd')]);router[_0x51c8('0xe')](_0x51c8('0xb'),auth[_0x51c8('0xc')](),controller[_0x51c8('0xf')]);router['delete']('/:id',auth[_0x51c8('0xc')](),controller[_0x51c8('0x10')]);module[_0x51c8('0x11')]=router; \ No newline at end of file +var _0x0d32=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','isAuthenticated','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5cb97e,_0x132a39){var _0x1714b4=function(_0x384210){while(--_0x384210){_0x5cb97e['push'](_0x5cb97e['shift']());}};_0x1714b4(++_0x132a39);}(_0x0d32,0x7c));var _0x20d3=function(_0x3f09ed,_0x16f3dd){_0x3f09ed=_0x3f09ed-0x0;var _0x4412a2=_0x0d32[_0x3f09ed];return _0x4412a2;};'use strict';var multer=require(_0x20d3('0x0'));var util=require(_0x20d3('0x1'));var path=require(_0x20d3('0x2'));var timeout=require(_0x20d3('0x3'));var express=require(_0x20d3('0x4'));var router=express[_0x20d3('0x5')]();var fs_extra=require(_0x20d3('0x6'));var auth=require(_0x20d3('0x7'));var interaction=require(_0x20d3('0x8'));var config=require(_0x20d3('0x9'));var controller=require('./mailApplication.controller');router['get'](_0x20d3('0xa'),auth[_0x20d3('0xb')](),controller['show']);router[_0x20d3('0xc')](_0x20d3('0xa'),auth[_0x20d3('0xb')](),controller[_0x20d3('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x20d3('0xe')]);module[_0x20d3('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 51ea175..eb93033 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 _0x8858=['TEXT','STRING','*,*,*,*','sequelize','exports','INTEGER','noop'];(function(_0x538a93,_0x236bc1){var _0x11127c=function(_0x2fa3d8){while(--_0x2fa3d8){_0x538a93['push'](_0x538a93['shift']());}};_0x11127c(++_0x236bc1);}(_0x8858,0xea));var _0x8885=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x8858[_0x2a6809];return _0x11c371;};'use strict';var Sequelize=require(_0x8885('0x0'));module[_0x8885('0x1')]={'priority':{'type':Sequelize[_0x8885('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8885('0x3')},'appdata':{'type':Sequelize[_0x8885('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x8885('0x5')],'defaultValue':_0x8885('0x6')}}; \ No newline at end of file +var _0x3a59=['TEXT','sequelize','STRING'];(function(_0x47d551,_0x6d3f96){var _0x27ec22=function(_0x3ef836){while(--_0x3ef836){_0x47d551['push'](_0x47d551['shift']());}};_0x27ec22(++_0x6d3f96);}(_0x3a59,0x136));var _0x93a5=function(_0x286bfb,_0x46ac3c){_0x286bfb=_0x286bfb-0x0;var _0x52b683=_0x3a59[_0x286bfb];return _0x52b683;};'use strict';var Sequelize=require(_0x93a5('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x93a5('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x93a5('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x93a5('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index f6465a7..7d25d6a 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 _0xbdb7=['update','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','attributes','length','includeAll','merge','find','then','body','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save'];(function(_0xc87d08,_0x59c9be){var _0x30a714=function(_0x437c0d){while(--_0x437c0d){_0xc87d08['push'](_0xc87d08['shift']());}};_0x30a714(++_0x59c9be);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x3a0633,_0x120c59){_0x3a0633=_0x3a0633-0x0;var _0x58341e=_0xbdb7[_0x3a0633];return _0x58341e;};'use strict';var emlformat=require(_0x7bdb('0x0'));var rimraf=require(_0x7bdb('0x1'));var zipdir=require(_0x7bdb('0x2'));var jsonpatch=require(_0x7bdb('0x3'));var rp=require(_0x7bdb('0x4'));var moment=require(_0x7bdb('0x5'));var BPromise=require(_0x7bdb('0x6'));var Mustache=require(_0x7bdb('0x7'));var util=require(_0x7bdb('0x8'));var path=require('path');var sox=require(_0x7bdb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7bdb('0xa'));var _=require(_0x7bdb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bdb('0xc'));var deskjs=require(_0x7bdb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bdb('0xe'));var Redis=require(_0x7bdb('0xf'));var authService=require(_0x7bdb('0x10'));var qs=require(_0x7bdb('0x11'));var as=require(_0x7bdb('0x12'));var hardwareService=require(_0x7bdb('0x13'));var logger=require(_0x7bdb('0x14'))(_0x7bdb('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7bdb('0x16'))['db'];function respondWithStatusCode(_0x25e3cb,_0x496613){_0x496613=_0x496613||0xcc;return function(_0x8d74ff){if(_0x8d74ff){return _0x25e3cb['sendStatus'](_0x496613);}return _0x25e3cb['status'](_0x496613)[_0x7bdb('0x17')]();};}function respondWithResult(_0x46dd4a,_0x4fd91a){_0x4fd91a=_0x4fd91a||0xc8;return function(_0x50eeca){if(_0x50eeca){return _0x46dd4a['status'](_0x4fd91a)[_0x7bdb('0x18')](_0x50eeca);}};}function respondWithFilteredResult(_0x195b2e,_0xe9919f){return function(_0x25d417){if(_0x25d417){var _0x31c909=typeof _0xe9919f[_0x7bdb('0x19')]===_0x7bdb('0x1a')&&typeof _0xe9919f[_0x7bdb('0x1b')]==='undefined';var _0x1c5750=_0x25d417[_0x7bdb('0x1c')];var _0x5723f4=_0x31c909?0x0:_0xe9919f[_0x7bdb('0x19')];var _0x4ffd4b=_0x31c909?_0x25d417[_0x7bdb('0x1c')]:_0xe9919f[_0x7bdb('0x19')]+_0xe9919f['limit'];var _0x3e5f8e;if(_0x4ffd4b>=_0x1c5750){_0x4ffd4b=_0x1c5750;_0x3e5f8e=0xc8;}else{_0x3e5f8e=0xce;}_0x195b2e[_0x7bdb('0x1d')](_0x3e5f8e);return _0x195b2e[_0x7bdb('0x1e')](_0x7bdb('0x1f'),_0x5723f4+'-'+_0x4ffd4b+'/'+_0x1c5750)[_0x7bdb('0x18')](_0x25d417);}return null;};}function patchUpdates(_0x5bfc35){return function(_0x49f353){try{jsonpatch[_0x7bdb('0x20')](_0x49f353,_0x5bfc35,!![]);}catch(_0xcb25f2){return BPromise['reject'](_0xcb25f2);}return _0x49f353[_0x7bdb('0x21')]();};}function saveUpdates(_0x118ea1,_0x346c72){return function(_0x3f53e7){if(_0x3f53e7){return _0x3f53e7[_0x7bdb('0x22')](_0x118ea1)['then'](function(_0x1d37ac){return _0x1d37ac;});}return null;};}function removeEntity(_0xdad53d,_0x40c447){return function(_0x3a456f){if(_0x3a456f){return _0x3a456f['destroy']()['then'](function(){_0xdad53d[_0x7bdb('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47abaf,_0x4a9e02){return function(_0x2abef6){if(!_0x2abef6){_0x47abaf['sendStatus'](0x194);}return _0x2abef6;};}function handleError(_0x2b14bc,_0x72ba69){_0x72ba69=_0x72ba69||0x1f4;return function(_0x3ec129){logger[_0x7bdb('0x23')](_0x3ec129[_0x7bdb('0x24')]);if(_0x3ec129['name']){delete _0x3ec129[_0x7bdb('0x25')];}_0x2b14bc[_0x7bdb('0x1d')](_0x72ba69)[_0x7bdb('0x26')](_0x3ec129);};}exports[_0x7bdb('0x27')]=function(_0x371e8a,_0x2e8e65){var _0x1e9996={'raw':!![],'where':{'id':_0x371e8a[_0x7bdb('0x28')]['id']}},_0xd2d7be={};_0xd2d7be[_0x7bdb('0x29')]=_[_0x7bdb('0x2a')](db[_0x7bdb('0x2b')]['rawAttributes']);_0xd2d7be[_0x7bdb('0x2c')]=_[_0x7bdb('0x2a')](_0x371e8a[_0x7bdb('0x2c')]);_0xd2d7be[_0x7bdb('0x2d')]=_[_0x7bdb('0x2e')](_0xd2d7be['model'],_0xd2d7be[_0x7bdb('0x2c')]);_0x1e9996[_0x7bdb('0x2f')]=_[_0x7bdb('0x2e')](_0xd2d7be[_0x7bdb('0x29')],qs['fields'](_0x371e8a['query']['fields']));_0x1e9996[_0x7bdb('0x2f')]=_0x1e9996['attributes'][_0x7bdb('0x30')]?_0x1e9996['attributes']:_0xd2d7be[_0x7bdb('0x29')];if(_0x371e8a[_0x7bdb('0x2c')][_0x7bdb('0x31')]){_0x1e9996['include']=[{'all':!![]}];}_0x1e9996=_[_0x7bdb('0x32')]({},_0x1e9996,_0x371e8a['options']);return db['MailApplication'][_0x7bdb('0x33')](_0x1e9996)['then'](handleEntityNotFound(_0x2e8e65,null))[_0x7bdb('0x34')](respondWithResult(_0x2e8e65,null))['catch'](handleError(_0x2e8e65,null));};exports['update']=function(_0x206c26,_0x353b26){if(_0x206c26[_0x7bdb('0x35')]['id']){delete _0x206c26[_0x7bdb('0x35')]['id'];}return db[_0x7bdb('0x2b')][_0x7bdb('0x33')]({'where':{'id':_0x206c26['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x353b26,null))[_0x7bdb('0x34')](saveUpdates(_0x206c26[_0x7bdb('0x35')],null))[_0x7bdb('0x34')](respondWithResult(_0x353b26,null))[_0x7bdb('0x36')](handleError(_0x353b26,null));};exports[_0x7bdb('0x37')]=function(_0x228340,_0x2587af){return db[_0x7bdb('0x2b')]['find']({'where':{'id':_0x228340['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x2587af,null))[_0x7bdb('0x34')](removeEntity(_0x2587af,null))[_0x7bdb('0x36')](handleError(_0x2587af,null));}; \ No newline at end of file +var _0xf4eb=['limit','count','Content-Range','json','apply','reject','save','then','destroy','error','name','send','params','keys','MailApplication','rawAttributes','query','filters','intersection','model','fields','attributes','includeAll','include','options','find','catch','body','eml-format','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined'];(function(_0xa6b937,_0x2306d0){var _0x507b33=function(_0x52afa8){while(--_0x52afa8){_0xa6b937['push'](_0xa6b937['shift']());}};_0x507b33(++_0x2306d0);}(_0xf4eb,0xec));var _0xbf4e=function(_0xd2e043,_0x5321d5){_0xd2e043=_0xd2e043-0x0;var _0x19dd53=_0xf4eb[_0xd2e043];return _0x19dd53;};'use strict';var emlformat=require(_0xbf4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf4e('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbf4e('0x2'));var path=require(_0xbf4e('0x3'));var sox=require(_0xbf4e('0x4'));var csv=require(_0xbf4e('0x5'));var ejs=require(_0xbf4e('0x6'));var fs=require('fs');var fs_extra=require(_0xbf4e('0x7'));var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x5'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var licenseUtil=require(_0xbf4e('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17fd01,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x56d185){if(_0x56d185){return _0x17fd01[_0xbf4e('0x13')](_0x5a3035);}return _0x17fd01[_0xbf4e('0x14')](_0x5a3035)[_0xbf4e('0x15')]();};}function respondWithResult(_0x302841,_0x3b74bd){_0x3b74bd=_0x3b74bd||0xc8;return function(_0x61bd54){if(_0x61bd54){return _0x302841['status'](_0x3b74bd)['json'](_0x61bd54);}};}function respondWithFilteredResult(_0x180432,_0x1735ae){return function(_0x28fc6b){if(_0x28fc6b){var _0x542909=typeof _0x1735ae[_0xbf4e('0x16')]===_0xbf4e('0x17')&&typeof _0x1735ae[_0xbf4e('0x18')]===_0xbf4e('0x17');var _0x5a631e=_0x28fc6b[_0xbf4e('0x19')];var _0x577c27=_0x542909?0x0:_0x1735ae['offset'];var _0x566ec3=_0x542909?_0x28fc6b['count']:_0x1735ae[_0xbf4e('0x16')]+_0x1735ae[_0xbf4e('0x18')];var _0x1fc800;if(_0x566ec3>=_0x5a631e){_0x566ec3=_0x5a631e;_0x1fc800=0xc8;}else{_0x1fc800=0xce;}_0x180432['status'](_0x1fc800);return _0x180432['set'](_0xbf4e('0x1a'),_0x577c27+'-'+_0x566ec3+'/'+_0x5a631e)[_0xbf4e('0x1b')](_0x28fc6b);}return null;};}function patchUpdates(_0x3be138){return function(_0x3a875b){try{jsonpatch[_0xbf4e('0x1c')](_0x3a875b,_0x3be138,!![]);}catch(_0x1e2a68){return BPromise[_0xbf4e('0x1d')](_0x1e2a68);}return _0x3a875b[_0xbf4e('0x1e')]();};}function saveUpdates(_0xd09e12,_0x376832){return function(_0x30539b){if(_0x30539b){return _0x30539b['update'](_0xd09e12)[_0xbf4e('0x1f')](function(_0x2e7673){return _0x2e7673;});}return null;};}function removeEntity(_0x51648c,_0x31e3f5){return function(_0x30994d){if(_0x30994d){return _0x30994d[_0xbf4e('0x20')]()[_0xbf4e('0x1f')](function(){_0x51648c[_0xbf4e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x90635e,_0x36688a){return function(_0x3d6863){if(!_0x3d6863){_0x90635e['sendStatus'](0x194);}return _0x3d6863;};}function handleError(_0x2fb490,_0x5e08b1){_0x5e08b1=_0x5e08b1||0x1f4;return function(_0x5bcf71){logger[_0xbf4e('0x21')](_0x5bcf71['stack']);if(_0x5bcf71[_0xbf4e('0x22')]){delete _0x5bcf71[_0xbf4e('0x22')];}_0x2fb490[_0xbf4e('0x14')](_0x5e08b1)[_0xbf4e('0x23')](_0x5bcf71);};}exports['show']=function(_0x2d4686,_0x8e0ab5){var _0x43879d={'raw':!![],'where':{'id':_0x2d4686[_0xbf4e('0x24')]['id']}},_0x4cd4a1={};_0x4cd4a1['model']=_[_0xbf4e('0x25')](db[_0xbf4e('0x26')][_0xbf4e('0x27')]);_0x4cd4a1['query']=_[_0xbf4e('0x25')](_0x2d4686[_0xbf4e('0x28')]);_0x4cd4a1[_0xbf4e('0x29')]=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],_0x4cd4a1[_0xbf4e('0x28')]);_0x43879d['attributes']=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],qs['fields'](_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2c')]));_0x43879d['attributes']=_0x43879d[_0xbf4e('0x2d')]['length']?_0x43879d[_0xbf4e('0x2d')]:_0x4cd4a1['model'];if(_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2e')]){_0x43879d[_0xbf4e('0x2f')]=[{'all':!![]}];}_0x43879d=_['merge']({},_0x43879d,_0x2d4686[_0xbf4e('0x30')]);return db[_0xbf4e('0x26')][_0xbf4e('0x31')](_0x43879d)[_0xbf4e('0x1f')](handleEntityNotFound(_0x8e0ab5,null))[_0xbf4e('0x1f')](respondWithResult(_0x8e0ab5,null))[_0xbf4e('0x32')](handleError(_0x8e0ab5,null));};exports['update']=function(_0x99b320,_0x3dbb2b){if(_0x99b320[_0xbf4e('0x33')]['id']){delete _0x99b320[_0xbf4e('0x33')]['id'];}return db[_0xbf4e('0x26')]['find']({'where':{'id':_0x99b320['params']['id']}})['then'](handleEntityNotFound(_0x3dbb2b,null))['then'](saveUpdates(_0x99b320[_0xbf4e('0x33')],null))[_0xbf4e('0x1f')](respondWithResult(_0x3dbb2b,null))[_0xbf4e('0x32')](handleError(_0x3dbb2b,null));};exports[_0xbf4e('0x20')]=function(_0x22ddde,_0x257b74){return db[_0xbf4e('0x26')][_0xbf4e('0x31')]({'where':{'id':_0x22ddde[_0xbf4e('0x24')]['id']}})['then'](handleEntityNotFound(_0x257b74,null))['then'](removeEntity(_0x257b74,null))[_0xbf4e('0x32')](handleError(_0x257b74,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 0f87c56..f6cc074 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 _0x4fc1=['api','moment','bluebird','rimraf','../../config/environment','./mailApplication.attributes','MailApplication','mail_applications','utf8mb4','lodash','../../config/logger'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x4fc1,0x15e));var _0x14fc=function(_0x2c2f29,_0x2a1c3b){_0x2c2f29=_0x2c2f29-0x0;var _0x1cc345=_0x4fc1[_0x2c2f29];return _0x1cc345;};'use strict';var _=require(_0x14fc('0x0'));var util=require('util');var logger=require(_0x14fc('0x1'))(_0x14fc('0x2'));var moment=require(_0x14fc('0x3'));var BPromise=require(_0x14fc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x14fc('0x5'));var config=require(_0x14fc('0x6'));var attributes=require(_0x14fc('0x7'));module['exports']=function(_0x7a8403,_0x3faa91){return _0x7a8403['define'](_0x14fc('0x8'),attributes,{'tableName':_0x14fc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x14fc('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xae0d=['bluebird','path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x5db99b,_0xdee23a){var _0x4b2d0e=function(_0x4deee1){while(--_0x4deee1){_0x5db99b['push'](_0x5db99b['shift']());}};_0x4b2d0e(++_0xdee23a);}(_0xae0d,0x15b));var _0xdae0=function(_0x3140ed,_0x1112c9){_0x3140ed=_0x3140ed-0x0;var _0xdeb47f=_0xae0d[_0x3140ed];return _0xdeb47f;};'use strict';var _=require(_0xdae0('0x0'));var util=require(_0xdae0('0x1'));var logger=require(_0xdae0('0x2'))('api');var moment=require('moment');var BPromise=require(_0xdae0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdae0('0x4'));var rimraf=require(_0xdae0('0x5'));var config=require(_0xdae0('0x6'));var attributes=require(_0xdae0('0x7'));module[_0xdae0('0x8')]=function(_0x4009d9,_0x12f163){return _0x4009d9[_0xdae0('0x9')](_0xdae0('0xa'),attributes,{'tableName':_0xdae0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdae0('0xc'),'collate':_0xdae0('0xd')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 4426a7d..6923cbb 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 _0xfb32=['request','then','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateMailApplication','update','options','raw','attributes','limit','info','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1b8300,_0x472f39){var _0x49deb2=function(_0x150f25){while(--_0x150f25){_0x1b8300['push'](_0x1b8300['shift']());}};_0x49deb2(++_0x472f39);}(_0xfb32,0x118));var _0x2fb3=function(_0x57975f,_0x388556){_0x57975f=_0x57975f-0x0;var _0x4793b8=_0xfb32[_0x57975f];return _0x4793b8;};'use strict';var _=require('lodash');var util=require(_0x2fb3('0x0'));var moment=require(_0x2fb3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2fb3('0x2'))['db'];var utils=require(_0x2fb3('0x3'));var logger=require(_0x2fb3('0x4'))(_0x2fb3('0x5'));var config=require(_0x2fb3('0x6'));var jayson=require(_0x2fb3('0x7'));var client=jayson[_0x2fb3('0x8')][_0x2fb3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc81297,_0x4b3c9f,_0x29474a){return new BPromise(function(_0xf59d90,_0x1d437c){return client[_0x2fb3('0xa')](_0xc81297,_0x29474a)[_0x2fb3('0xb')](function(_0x2e3d7d){logger['info'](_0x2fb3('0xc'),_0x4b3c9f,'request\x20sent');logger[_0x2fb3('0xd')](_0x2fb3('0xe'),_0x4b3c9f,_0x2fb3('0xf'),JSON[_0x2fb3('0x10')](_0x2e3d7d));if(_0x2e3d7d[_0x2fb3('0x11')]){if(_0x2e3d7d[_0x2fb3('0x11')][_0x2fb3('0x12')]===0x1f4){logger[_0x2fb3('0x11')](_0x2fb3('0xc'),_0x4b3c9f,_0x2e3d7d['error'][_0x2fb3('0x13')]);return _0x1d437c(_0x2e3d7d[_0x2fb3('0x11')][_0x2fb3('0x13')]);}logger['error'](_0x2fb3('0xc'),_0x4b3c9f,_0x2e3d7d['error'][_0x2fb3('0x13')]);return _0xf59d90(_0x2e3d7d[_0x2fb3('0x11')][_0x2fb3('0x13')]);}else{logger['info'](_0x2fb3('0xc'),_0x4b3c9f,_0x2fb3('0xf'));_0xf59d90(_0x2e3d7d[_0x2fb3('0x14')]['message']);}})[_0x2fb3('0x15')](function(_0x83fa9c){logger[_0x2fb3('0x11')]('MailApplication,\x20%s,\x20%s',_0x4b3c9f,_0x83fa9c);_0x1d437c(_0x83fa9c);});});}exports[_0x2fb3('0x16')]=function(_0x1fec14){var _0x25726d=this;return new Promise(function(_0x51197f,_0x5d557f){return db['MailApplication'][_0x2fb3('0x17')](_0x1fec14['body'],{'raw':_0x1fec14[_0x2fb3('0x18')]?_0x1fec14[_0x2fb3('0x18')][_0x2fb3('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fec14['options']?_0x1fec14[_0x2fb3('0x18')]['where']||null:null,'attributes':_0x1fec14[_0x2fb3('0x18')]?_0x1fec14[_0x2fb3('0x18')][_0x2fb3('0x1a')]||null:null,'limit':_0x1fec14[_0x2fb3('0x18')]?_0x1fec14['options'][_0x2fb3('0x1b')]||null:null})[_0x2fb3('0xb')](function(_0x19fe52){logger[_0x2fb3('0x1c')](_0x2fb3('0x16'),_0x1fec14);logger[_0x2fb3('0xd')]('UpdateMailApplication',_0x1fec14,JSON[_0x2fb3('0x10')](_0x19fe52));_0x51197f(_0x19fe52);})[_0x2fb3('0x15')](function(_0x275b71){logger[_0x2fb3('0x11')](_0x2fb3('0x16'),_0x275b71[_0x2fb3('0x13')],_0x1fec14);_0x5d557f(_0x25726d['error'](0x1f4,_0x275b71[_0x2fb3('0x13')]));});});}; \ No newline at end of file +var _0xafc1=['request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','code','message','catch','UpdateMailApplication','update','options','raw','where','attributes','limit','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x159f91,_0xe8a30f){var _0x26bd65=function(_0x5680d1){while(--_0x5680d1){_0x159f91['push'](_0x159f91['shift']());}};_0x26bd65(++_0xe8a30f);}(_0xafc1,0xae));var _0x1afc=function(_0x59b65c,_0x2e1472){_0x59b65c=_0x59b65c-0x0;var _0x1179b1=_0xafc1[_0x59b65c];return _0x1179b1;};'use strict';var _=require(_0x1afc('0x0'));var util=require('util');var moment=require(_0x1afc('0x1'));var BPromise=require(_0x1afc('0x2'));var rs=require(_0x1afc('0x3'));var fs=require('fs');var Redis=require(_0x1afc('0x4'));var db=require(_0x1afc('0x5'))['db'];var utils=require(_0x1afc('0x6'));var logger=require(_0x1afc('0x7'))(_0x1afc('0x8'));var config=require('../../config/environment');var jayson=require(_0x1afc('0x9'));var client=jayson[_0x1afc('0xa')][_0x1afc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16c988,_0x239ee3,_0x2caf8d){return new BPromise(function(_0x18e4c5,_0x437bb6){return client[_0x1afc('0xc')](_0x16c988,_0x2caf8d)[_0x1afc('0xd')](function(_0x311ac9){logger[_0x1afc('0xe')](_0x1afc('0xf'),_0x239ee3,_0x1afc('0x10'));logger[_0x1afc('0x11')](_0x1afc('0x12'),_0x239ee3,_0x1afc('0x10'),JSON['stringify'](_0x311ac9));if(_0x311ac9[_0x1afc('0x13')]){if(_0x311ac9[_0x1afc('0x13')][_0x1afc('0x14')]===0x1f4){logger['error'](_0x1afc('0xf'),_0x239ee3,_0x311ac9[_0x1afc('0x13')][_0x1afc('0x15')]);return _0x437bb6(_0x311ac9[_0x1afc('0x13')][_0x1afc('0x15')]);}logger[_0x1afc('0x13')](_0x1afc('0xf'),_0x239ee3,_0x311ac9[_0x1afc('0x13')][_0x1afc('0x15')]);return _0x18e4c5(_0x311ac9['error'][_0x1afc('0x15')]);}else{logger[_0x1afc('0xe')](_0x1afc('0xf'),_0x239ee3,_0x1afc('0x10'));_0x18e4c5(_0x311ac9['result'][_0x1afc('0x15')]);}})[_0x1afc('0x16')](function(_0x4ddd00){logger[_0x1afc('0x13')](_0x1afc('0xf'),_0x239ee3,_0x4ddd00);_0x437bb6(_0x4ddd00);});});}exports[_0x1afc('0x17')]=function(_0x2fd76c){var _0x5c3a97=this;return new Promise(function(_0x45fe7e,_0x3c4529){return db['MailApplication'][_0x1afc('0x18')](_0x2fd76c['body'],{'raw':_0x2fd76c[_0x1afc('0x19')]?_0x2fd76c[_0x1afc('0x19')][_0x1afc('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fd76c[_0x1afc('0x19')]?_0x2fd76c['options'][_0x1afc('0x1b')]||null:null,'attributes':_0x2fd76c[_0x1afc('0x19')]?_0x2fd76c['options'][_0x1afc('0x1c')]||null:null,'limit':_0x2fd76c['options']?_0x2fd76c['options'][_0x1afc('0x1d')]||null:null})[_0x1afc('0xd')](function(_0x3a5412){logger[_0x1afc('0xe')](_0x1afc('0x17'),_0x2fd76c);logger[_0x1afc('0x11')](_0x1afc('0x17'),_0x2fd76c,JSON[_0x1afc('0x1e')](_0x3a5412));_0x45fe7e(_0x3a5412);})['catch'](function(_0x45ace4){logger[_0x1afc('0x13')]('UpdateMailApplication',_0x45ace4[_0x1afc('0x15')],_0x2fd76c);_0x3c4529(_0x5c3a97[_0x1afc('0x13')](0x1f4,_0x45ace4[_0x1afc('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 8af0e86..7e152e0 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 _0x5c95=['./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','mailinteraction:update','delete','destroy','removeTags','Router','../../components/interaction/service'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x5c95,0x76));var _0x55c9=function(_0x6e672e,_0x9ac198){_0x6e672e=_0x6e672e-0x0;var _0x117627=_0x5c95[_0x6e672e];return _0x117627;};'use strict';var express=require('express');var router=express[_0x55c9('0x0')]();var auth=require('../../components/auth/service');var interaction=require(_0x55c9('0x1'));var controller=require(_0x55c9('0x2'));router[_0x55c9('0x3')]('/',auth[_0x55c9('0x4')](),controller[_0x55c9('0x5')]);router[_0x55c9('0x3')](_0x55c9('0x6'),auth[_0x55c9('0x4')](),controller[_0x55c9('0x7')]);router[_0x55c9('0x3')](_0x55c9('0x8'),auth['isAuthenticated'](),controller[_0x55c9('0x9')]);router[_0x55c9('0x3')](_0x55c9('0xa'),auth[_0x55c9('0x4')](),controller[_0x55c9('0xb')]);router['get']('/:id/download',auth[_0x55c9('0x4')](),controller[_0x55c9('0xc')]);router[_0x55c9('0xd')]('/',auth['isAuthenticated'](),controller[_0x55c9('0xe')]);router[_0x55c9('0xd')]('/:id/messages',auth[_0x55c9('0x4')](),controller[_0x55c9('0xf')]);router[_0x55c9('0xd')](_0x55c9('0x10'),auth['isAuthenticated'](),interaction[_0x55c9('0x11')](_0x55c9('0x12'),_0x55c9('0x13')),controller['addTags']);router['put']('/:id',auth[_0x55c9('0x4')](),interaction['tracked'](_0x55c9('0x12'),_0x55c9('0x14')),controller['update']);router[_0x55c9('0x15')]('/:id',auth['isAuthenticated'](),interaction[_0x55c9('0x11')](_0x55c9('0x12'),'mailinteraction:destroy'),controller[_0x55c9('0x16')]);router[_0x55c9('0x15')](_0x55c9('0x10'),auth[_0x55c9('0x4')](),controller[_0x55c9('0x17')]);module['exports']=router; \ No newline at end of file +var _0xf055=['mail','mailinteraction:addtags','addTags','update','delete','destroy','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','describe','/:id','/:id/messages','/:id/download','download','post','create','/:id/tags','tracked'];(function(_0x29e7a1,_0x379ef6){var _0xe2a3b9=function(_0x1e90ca){while(--_0x1e90ca){_0x29e7a1['push'](_0x29e7a1['shift']());}};_0xe2a3b9(++_0x379ef6);}(_0xf055,0x1a0));var _0x5f05=function(_0x134c79,_0x2136d3){_0x134c79=_0x134c79-0x0;var _0x2c2142=_0xf055[_0x134c79];return _0x2c2142;};'use strict';var express=require(_0x5f05('0x0'));var router=express[_0x5f05('0x1')]();var auth=require(_0x5f05('0x2'));var interaction=require(_0x5f05('0x3'));var controller=require(_0x5f05('0x4'));router[_0x5f05('0x5')]('/',auth[_0x5f05('0x6')](),controller['index']);router[_0x5f05('0x5')]('/describe',auth[_0x5f05('0x6')](),controller[_0x5f05('0x7')]);router[_0x5f05('0x5')](_0x5f05('0x8'),auth[_0x5f05('0x6')](),controller['show']);router['get'](_0x5f05('0x9'),auth[_0x5f05('0x6')](),controller['getMessages']);router[_0x5f05('0x5')](_0x5f05('0xa'),auth[_0x5f05('0x6')](),controller[_0x5f05('0xb')]);router[_0x5f05('0xc')]('/',auth[_0x5f05('0x6')](),controller[_0x5f05('0xd')]);router['post'](_0x5f05('0x9'),auth[_0x5f05('0x6')](),controller['addMessage']);router['post'](_0x5f05('0xe'),auth[_0x5f05('0x6')](),interaction[_0x5f05('0xf')](_0x5f05('0x10'),_0x5f05('0x11')),controller[_0x5f05('0x12')]);router['put'](_0x5f05('0x8'),auth[_0x5f05('0x6')](),interaction[_0x5f05('0xf')](_0x5f05('0x10'),'mailinteraction:update'),controller[_0x5f05('0x13')]);router[_0x5f05('0x14')]('/:id',auth[_0x5f05('0x6')](),interaction[_0x5f05('0xf')](_0x5f05('0x10'),'mailinteraction:destroy'),controller[_0x5f05('0x15')]);router['delete']('/:id/tags',auth['isAuthenticated'](),controller[_0x5f05('0x16')]);module[_0x5f05('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 ea3230c..ac1153f 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 _0xa4b8=['ENUM','INTEGER','sequelize','iconv','exports','BOOLEAN','STRING','TEXT','DATE'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0xa4b8,0x89));var _0x8a4b=function(_0x531980,_0x5c9867){_0x531980=_0x531980-0x0;var _0x35963e=_0xa4b8[_0x531980];return _0x35963e;};'use strict';var Sequelize=require(_0x8a4b('0x0'));var iconv=require(_0x8a4b('0x1'));module[_0x8a4b('0x2')]={'closed':{'type':Sequelize[_0x8a4b('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x8a4b('0x4')]},'secondDisposition':{'type':Sequelize[_0x8a4b('0x4')]},'thirdDisposition':{'type':Sequelize[_0x8a4b('0x4')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x8a4b('0x4')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x8a4b('0x5')]('long')},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x8a4b('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x8a4b('0x6')]},'firstMsgDirection':{'type':Sequelize[_0x8a4b('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8a4b('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x8a4b('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x8a4b('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x8a4b('0x8')]}}; \ No newline at end of file +var _0x1000=['sequelize','BOOLEAN','DATE','STRING','TEXT','long','ENUM','out','INTEGER'];(function(_0x5986d5,_0x1421fd){var _0x2204f4=function(_0x3bfabe){while(--_0x3bfabe){_0x5986d5['push'](_0x5986d5['shift']());}};_0x2204f4(++_0x1421fd);}(_0x1000,0x6c));var _0x0100=function(_0x3f7120,_0x6e32c4){_0x3f7120=_0x3f7120-0x0;var _0x2e29c3=_0x1000[_0x3f7120];return _0x2e29c3;};'use strict';var Sequelize=require(_0x0100('0x0'));var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize[_0x0100('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0100('0x2')]},'disposition':{'type':Sequelize[_0x0100('0x3')]},'secondDisposition':{'type':Sequelize[_0x0100('0x3')]},'thirdDisposition':{'type':Sequelize[_0x0100('0x3')]},'note':{'type':Sequelize[_0x0100('0x3')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x0100('0x3')]},'cc':{'type':Sequelize[_0x0100('0x4')](_0x0100('0x5'))},'subject':{'type':Sequelize[_0x0100('0x4')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x0100('0x2')]},'substatus':{'type':Sequelize[_0x0100('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x0100('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x0100('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0100('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x0100('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x0100('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x0100('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index a9a28ee..8a42ac8 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 _0xfc2b=['get','mkdirSync','each','missing.recipient@your.company.com','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','existsSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','update','then','destroy','error','stack','name','index','map','MailInteraction','rawAttributes','fieldName','type','getOptions','findAll','query','params','model','keys','filters','attributes','intersection','fields','includeAll','include','merge','catch','create','body','describe','addMessage','MailMessage','find','ids','omit','getMessages','findOne','length','hasOwnProperty','nolimit','sort','where','MailInteractionId','filter','$gte','split','format','count','inlineCss','true','addTags','setTags','Tag','color','emit','mailInteractionTags:save','removeTags','download','toString','join','root','files','tmp','server','attachments','push','Attachment','Attachments','Messages','from','bcc'];(function(_0x5ddedc,_0x4f6e32){var _0x3d5fc8=function(_0x3c9ed7){while(--_0x3c9ed7){_0x5ddedc['push'](_0x5ddedc['shift']());}};_0x3d5fc8(++_0x4f6e32);}(_0xfc2b,0x155));var _0xbfc2=function(_0x952282,_0x51a614){_0x952282=_0x952282-0x0;var _0x613507=_0xfc2b[_0x952282];return _0x613507;};'use strict';var emlformat=require(_0xbfc2('0x0'));var rimraf=require(_0xbfc2('0x1'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xbfc2('0x2'));var path=require('path');var fs=require('fs');var _=require(_0xbfc2('0x3'));var juice=require('juice');var Redis=require(_0xbfc2('0x4'));var interaction=require(_0xbfc2('0x5'));var qs=require(_0xbfc2('0x6'));var logger=require('../../config/logger')(_0xbfc2('0x7'));var config=require(_0xbfc2('0x8'));var db=require(_0xbfc2('0x9'))['db'];var htmlEntities=require(_0xbfc2('0xa'));config[_0xbfc2('0xb')]=_[_0xbfc2('0xc')](config[_0xbfc2('0xb')],{'host':_0xbfc2('0xd'),'port':0x18eb});var socket=require(_0xbfc2('0xe'))(new Redis(config['redis']));require('./mailInteraction.socket')[_0xbfc2('0xf')](socket);function respondWithStatusCode(_0x33a70a,_0x5270d6){_0x5270d6=_0x5270d6||0xcc;return function(_0x349963){if(_0x349963){return _0x33a70a[_0xbfc2('0x10')](_0x5270d6);}return _0x33a70a[_0xbfc2('0x11')](_0x5270d6)[_0xbfc2('0x12')]();};}function respondWithResult(_0x22261f,_0x2aea17){_0x2aea17=_0x2aea17||0xc8;return function(_0xbdb150){if(_0xbdb150){return _0x22261f[_0xbfc2('0x11')](_0x2aea17)[_0xbfc2('0x13')](_0xbdb150);}};}function respondWithFilteredResult(_0x331677,_0x46a287){return function(_0x39abb1){if(_0x39abb1){var _0x2bf784=typeof _0x46a287[_0xbfc2('0x14')]===_0xbfc2('0x15')&&typeof _0x46a287[_0xbfc2('0x16')]==='undefined';var _0x1b7272=_0x39abb1['count'];var _0x53f1ae=_0x2bf784?0x0:_0x46a287['offset'];var _0x12380b=_0x2bf784?_0x39abb1['count']:_0x46a287[_0xbfc2('0x14')]+_0x46a287[_0xbfc2('0x16')];var _0x43d319;if(_0x12380b>=_0x1b7272){_0x12380b=_0x1b7272;_0x43d319=0xc8;}else{_0x43d319=0xce;}_0x331677[_0xbfc2('0x11')](_0x43d319);return _0x331677[_0xbfc2('0x17')](_0xbfc2('0x18'),_0x53f1ae+'-'+_0x12380b+'/'+_0x1b7272)[_0xbfc2('0x13')](_0x39abb1);}return null;};}function saveUpdates(_0x5e5954){return function(_0x4d543a){if(_0x4d543a){return _0x4d543a[_0xbfc2('0x19')](_0x5e5954)[_0xbfc2('0x1a')](function(_0x3f57db){return _0x3f57db;});}return null;};}function removeEntity(_0x469b7c){return function(_0x2e156d){if(_0x2e156d){return _0x2e156d[_0xbfc2('0x1b')]()[_0xbfc2('0x1a')](function(){_0x469b7c['status'](0xcc)[_0xbfc2('0x12')]();});}};}function handleEntityNotFound(_0x303b73){return function(_0x1876c6){if(!_0x1876c6){_0x303b73[_0xbfc2('0x10')](0x194);}return _0x1876c6;};}function handleError(_0x10e1a4,_0x3bcd46){_0x3bcd46=_0x3bcd46||0x1f4;return function(_0x1c18cf){logger[_0xbfc2('0x1c')](_0x1c18cf[_0xbfc2('0x1d')]);if(_0x1c18cf[_0xbfc2('0x1e')]){delete _0x1c18cf[_0xbfc2('0x1e')];}_0x10e1a4[_0xbfc2('0x11')](_0x3bcd46)['send'](_0x1c18cf);};}exports[_0xbfc2('0x1f')]=function(_0xd2c395,_0x1ca408){var _0x4431a5={};var _0x4f623a=_[_0xbfc2('0x20')](db[_0xbfc2('0x21')][_0xbfc2('0x22')],function(_0x3dd747){return{'name':_0x3dd747[_0xbfc2('0x23')],'type':_0x3dd747[_0xbfc2('0x24')]['key']};});_0x4431a5=qs[_0xbfc2('0x25')](_0x4f623a,_0xd2c395);return interaction[_0xbfc2('0x26')]('mail',_0xd2c395[_0xbfc2('0x27')],_0xd2c395['user'],_0x4431a5,_0x4f623a)['then'](respondWithFilteredResult(_0x1ca408,_0x4431a5))['catch'](handleError(_0x1ca408,null));};exports['show']=function(_0x581de4,_0x5060c9){var _0x91454e={'raw':![],'where':{'id':_0x581de4[_0xbfc2('0x28')]['id']}},_0x865a9={};_0x865a9[_0xbfc2('0x29')]=_[_0xbfc2('0x2a')](db[_0xbfc2('0x21')][_0xbfc2('0x22')]);_0x865a9[_0xbfc2('0x27')]=_[_0xbfc2('0x2a')](_0x581de4['query']);_0x865a9[_0xbfc2('0x2b')]=_['intersection'](_0x865a9[_0xbfc2('0x29')],_0x865a9['query']);_0x91454e[_0xbfc2('0x2c')]=_[_0xbfc2('0x2d')](_0x865a9[_0xbfc2('0x29')],qs['fields'](_0x581de4[_0xbfc2('0x27')][_0xbfc2('0x2e')]));_0x91454e[_0xbfc2('0x2c')]=_0x91454e[_0xbfc2('0x2c')]['length']?_0x91454e[_0xbfc2('0x2c')]:_0x865a9['model'];if(_0x581de4[_0xbfc2('0x27')][_0xbfc2('0x2f')]){_0x91454e[_0xbfc2('0x30')]=[{'all':!![]}];}_0x91454e=_[_0xbfc2('0x31')]({},_0x91454e,_0x581de4['options']);return db[_0xbfc2('0x21')]['find'](_0x91454e)[_0xbfc2('0x1a')](handleEntityNotFound(_0x5060c9,null))['then'](respondWithResult(_0x5060c9,null))[_0xbfc2('0x32')](handleError(_0x5060c9,null));};exports[_0xbfc2('0x33')]=function(_0x5cf5cf,_0x3b62cb){return db[_0xbfc2('0x21')][_0xbfc2('0x33')](_0x5cf5cf['body'],{})[_0xbfc2('0x1a')](respondWithResult(_0x3b62cb,0xc9))[_0xbfc2('0x32')](handleError(_0x3b62cb,null));};exports[_0xbfc2('0x19')]=function(_0x4a003b,_0x11c693){if(_0x4a003b[_0xbfc2('0x34')]['id']){delete _0x4a003b[_0xbfc2('0x34')]['id'];}return db['MailInteraction']['find']({'where':{'id':_0x4a003b[_0xbfc2('0x28')]['id']}})['then'](handleEntityNotFound(_0x11c693,null))[_0xbfc2('0x1a')](saveUpdates(_0x4a003b[_0xbfc2('0x34')],null))[_0xbfc2('0x1a')](respondWithResult(_0x11c693,null))[_0xbfc2('0x32')](handleError(_0x11c693,null));};exports['destroy']=function(_0x3223a6,_0x1fc4f2){return db['MailInteraction']['find']({'where':{'id':_0x3223a6['params']['id']}})[_0xbfc2('0x1a')](handleEntityNotFound(_0x1fc4f2,null))[_0xbfc2('0x1a')](removeEntity(_0x1fc4f2,null))[_0xbfc2('0x32')](handleError(_0x1fc4f2,null));};exports['describe']=function(_0x501095,_0x4a6b90){return db[_0xbfc2('0x21')][_0xbfc2('0x35')]()[_0xbfc2('0x1a')](respondWithResult(_0x4a6b90,null))[_0xbfc2('0x32')](handleError(_0x4a6b90,null));};exports[_0xbfc2('0x36')]=function(_0x468dfe,_0x580693){return db[_0xbfc2('0x37')][_0xbfc2('0x38')]({'where':{'id':_0x468dfe[_0xbfc2('0x28')]['id']}})['then'](handleEntityNotFound(_0x580693,null))[_0xbfc2('0x1a')](function(_0x14e4b4){if(_0x14e4b4){return _0x14e4b4[_0xbfc2('0x36')](_0x468dfe[_0xbfc2('0x34')][_0xbfc2('0x39')],_[_0xbfc2('0x3a')](_0x468dfe[_0xbfc2('0x34')],['ids','id'])||{});}})[_0xbfc2('0x1a')](respondWithResult(_0x580693,null))[_0xbfc2('0x32')](handleError(_0x580693,null));};exports[_0xbfc2('0x3b')]=function(_0x30a405,_0x64ae1f){var _0x14ad72={'raw':![],'where':{}};var _0xb48c29={};var _0x30e603={'count':0x0,'rows':[]};return db['MailInteraction'][_0xbfc2('0x3c')]({'where':{'id':_0x30a405[_0xbfc2('0x28')]['id']}})[_0xbfc2('0x1a')](handleEntityNotFound(_0x64ae1f,null))[_0xbfc2('0x1a')](function(_0x37b04a){if(_0x37b04a){_0xb48c29[_0xbfc2('0x29')]=_[_0xbfc2('0x2a')](db['MailMessage'][_0xbfc2('0x22')]);_0xb48c29[_0xbfc2('0x27')]=_['keys'](_0x30a405[_0xbfc2('0x27')]);_0xb48c29[_0xbfc2('0x2b')]=_[_0xbfc2('0x2d')](_0xb48c29[_0xbfc2('0x29')],_0xb48c29['query']);_0x14ad72['attributes']=_[_0xbfc2('0x2d')](_0xb48c29[_0xbfc2('0x29')],qs['fields'](_0x30a405[_0xbfc2('0x27')][_0xbfc2('0x2e')]));_0x14ad72['attributes']=_0x14ad72[_0xbfc2('0x2c')][_0xbfc2('0x3d')]?_0x14ad72[_0xbfc2('0x2c')]:_0xb48c29[_0xbfc2('0x29')];if(!_0x30a405['query'][_0xbfc2('0x3e')](_0xbfc2('0x3f'))){_0x14ad72['limit']=qs['limit'](_0x30a405[_0xbfc2('0x27')][_0xbfc2('0x16')]);_0x14ad72['offset']=qs['offset'](_0x30a405['query'][_0xbfc2('0x14')]);}_0x14ad72['order']=qs[_0xbfc2('0x40')](_0x30a405[_0xbfc2('0x27')]['sort']);_0x14ad72[_0xbfc2('0x41')]=qs[_0xbfc2('0x2b')](_['pick'](_0x30a405[_0xbfc2('0x27')],_0xb48c29[_0xbfc2('0x2b')]));_0x14ad72[_0xbfc2('0x41')][_0xbfc2('0x42')]=_0x37b04a['id'];if(_0x30a405[_0xbfc2('0x27')][_0xbfc2('0x43')]){_0x14ad72[_0xbfc2('0x41')]=_[_0xbfc2('0x31')](_0x14ad72[_0xbfc2('0x41')],{'$or':_[_0xbfc2('0x20')](_0x14ad72[_0xbfc2('0x2c')],function(_0x43ae40){var _0x5bcf1d={};_0x5bcf1d[_0x43ae40]={'$like':'%'+_0x30a405[_0xbfc2('0x27')]['filter']+'%'};return _0x5bcf1d;})});}if(_0x30a405[_0xbfc2('0x27')][_0xbfc2('0x44')]){var _0x4d48ab=_0x30a405[_0xbfc2('0x27')]['$gte'][_0xbfc2('0x45')](',');var _0x327991={};_0x327991[_0x4d48ab[0x0]]={'$gte':moment(_0x4d48ab[0x1])[_0xbfc2('0x46')]('YYYY-MM-DD\x20HH:mm:ss')};_0x14ad72['where']=_['merge'](_0x14ad72['where'],_0x327991);}_0x14ad72=_['merge']({},_0x14ad72,_0x30a405['options']);return db[_0xbfc2('0x37')][_0xbfc2('0x47')]({'where':_0x14ad72[_0xbfc2('0x41')]})[_0xbfc2('0x1a')](function(_0x1dfc30){_0x30e603['count']=_0x1dfc30;if(_0x30a405[_0xbfc2('0x27')][_0xbfc2('0x2f')]){_0x14ad72[_0xbfc2('0x30')]=[{'all':!![]}];}return db[_0xbfc2('0x37')][_0xbfc2('0x26')](_0x14ad72);})[_0xbfc2('0x1a')](function(_0xcb990c){if(_0x30a405[_0xbfc2('0x27')][_0xbfc2('0x48')]===_0xbfc2('0x49')){for(var _0xcdd0a4=0x0;_0xcdd0a4<_0xcb990c['length'];_0xcdd0a4++){_0xcb990c[_0xcdd0a4][_0xbfc2('0x34')]=juice(_0xcb990c[_0xcdd0a4]['body']);}}_0x30e603['rows']=_0xcb990c;return _0x30e603;});}})['then'](respondWithFilteredResult(_0x64ae1f,_0x14ad72))[_0xbfc2('0x32')](handleError(_0x64ae1f,null));};exports[_0xbfc2('0x4a')]=function(_0x5bec7a,_0x15e109){return db['MailInteraction'][_0xbfc2('0x38')]({'where':{'id':_0x5bec7a['params']['id']}})[_0xbfc2('0x1a')](handleEntityNotFound(_0x15e109,null))[_0xbfc2('0x1a')](function(_0x3954f2){if(_0x3954f2){return _0x3954f2[_0xbfc2('0x4b')](_0x5bec7a[_0xbfc2('0x34')][_0xbfc2('0x39')],_[_0xbfc2('0x3a')](_0x5bec7a[_0xbfc2('0x34')],[_0xbfc2('0x39'),'id'])||{})['spread'](function(){return db[_0xbfc2('0x4c')][_0xbfc2('0x26')]({'attributes':['id','name',_0xbfc2('0x4d')],'where':{'id':_0x5bec7a['body'][_0xbfc2('0x39')]}});})[_0xbfc2('0x1a')](function(_0x2c338a){socket[_0xbfc2('0x4e')](_0xbfc2('0x4f'),{'id':Number(_0x5bec7a[_0xbfc2('0x28')]['id']),'tags':_0x2c338a||[]});return{'id':Number(_0x5bec7a['params']['id']),'tags':_0x2c338a||[]};});}})[_0xbfc2('0x1a')](respondWithResult(_0x15e109,null))[_0xbfc2('0x32')](handleError(_0x15e109,null));};exports[_0xbfc2('0x50')]=function(_0x5ac5d3,_0x105f8e){return db[_0xbfc2('0x21')][_0xbfc2('0x38')]({'where':{'id':_0x5ac5d3['params']['id']}})[_0xbfc2('0x1a')](handleEntityNotFound(_0x105f8e,null))[_0xbfc2('0x1a')](function(_0x5dbcf6){if(_0x5dbcf6){return _0x5dbcf6[_0xbfc2('0x50')](_0x5ac5d3[_0xbfc2('0x27')][_0xbfc2('0x39')]);}})[_0xbfc2('0x1a')](respondWithStatusCode(_0x105f8e,null))[_0xbfc2('0x32')](handleError(_0x105f8e,null));};exports[_0xbfc2('0x51')]=function(_0x15a93f,_0x14da5e){var _0x2589a5=moment()['unix']()[_0xbfc2('0x52')]();var _0x57fc9b=path[_0xbfc2('0x53')](config[_0xbfc2('0x54')],'server',_0xbfc2('0x55'),_0xbfc2('0x56'));var _0x11eadd=path['join'](config[_0xbfc2('0x54')],_0xbfc2('0x57'),_0xbfc2('0x55'),_0xbfc2('0x58'));var _0x678b54=path[_0xbfc2('0x53')](_0x57fc9b,_0x2589a5);var _0x189386=util[_0xbfc2('0x46')]('transcript-%d-%s.zip',_0x15a93f[_0xbfc2('0x28')]['id'],_0x2589a5);var _0x3af586=path[_0xbfc2('0x53')](_0x57fc9b,_0x189386);var _0x205369=[];if(_0x15a93f[_0xbfc2('0x27')][_0xbfc2('0x58')]){_0x205369[_0xbfc2('0x59')]({'model':db[_0xbfc2('0x5a')],'as':_0xbfc2('0x5b'),'raw':!![]});}var _0x2121bb=[{'model':db[_0xbfc2('0x37')],'as':_0xbfc2('0x5c'),'attributes':['id',_0xbfc2('0x34'),_0xbfc2('0x5d'),'to','cc',_0xbfc2('0x5e'),'subject','createdAt'],'where':{'secret':![]},'order':qs[_0xbfc2('0x40')]('id'),'include':_0x205369}];return db['MailInteraction']['find']({'where':{'id':_0x15a93f[_0xbfc2('0x28')]['id']},'include':_0x2121bb})['then'](handleEntityNotFound(_0x14da5e,null))['then'](function(_0x1c9055){if(_0x1c9055&&_0x1c9055['Messages']){var _0x53a6ab=_0x1c9055[_0xbfc2('0x5f')]({'plain':!![]});fs[_0xbfc2('0x60')](_0x678b54);return BPromise[_0xbfc2('0x61')](_0x53a6ab[_0xbfc2('0x5c')],function(_0x3c481f,_0x3b59db){var _0x41629f={'from':_0x3c481f[_0xbfc2('0x5d')],'to':_0x3c481f['to']||_0xbfc2('0x62'),'subject':_0x3c481f[_0xbfc2('0x63')],'html':htmlEntities[_0xbfc2('0x64')](_0x3c481f[_0xbfc2('0x34')]),'headers':{'Date':moment(_0x3c481f['createdAt'])[_0xbfc2('0x46')](_0xbfc2('0x65'))},'attachments':[]};if(_0x3c481f['cc']){_0x41629f[_0xbfc2('0x66')]['Cc']=_0x3c481f['cc'];}if(_0x3c481f[_0xbfc2('0x5e')]){_0x41629f[_0xbfc2('0x66')]['Bcc']=_0x3c481f[_0xbfc2('0x5e')];}return new BPromise(function(_0x476fb5,_0x1f22b8){if(_0x3c481f[_0xbfc2('0x5b')]){for(var _0x14da55=0x0;_0x14da55<_0x3c481f[_0xbfc2('0x5b')][_0xbfc2('0x3d')];_0x14da55++){var _0x57cf40=_0x3c481f[_0xbfc2('0x5b')][_0x14da55];var _0x111f9c=path[_0xbfc2('0x53')](_0x11eadd,_0x57cf40[_0xbfc2('0x67')]);if(fs[_0xbfc2('0x68')](_0x111f9c)){_0x41629f[_0xbfc2('0x58')][_0xbfc2('0x59')]({'name':_0x57cf40[_0xbfc2('0x1e')],'contentType':_0x57cf40[_0xbfc2('0x24')],'data':fs['readFileSync'](_0x111f9c)});}}}emlformat[_0xbfc2('0x69')](_0x41629f,function(_0x33da93,_0x2dd7af){if(_0x33da93)return _0x1f22b8(_0x33da93);fs[_0xbfc2('0x6a')](path['join'](_0x678b54,util[_0xbfc2('0x46')](_0xbfc2('0x6b'),_0x3b59db)),_0x2dd7af);return _0x476fb5(_0x2dd7af);});});})[_0xbfc2('0x1a')](function(){return new BPromise(function(_0x22888b,_0x5ba9bc){zipdir(_0x678b54,{'saveTo':_0x3af586},function(_0xc8626b,_0x14ba5c){if(_0xc8626b)return _0x5ba9bc(_0xc8626b);return _0x22888b(_0x14ba5c);});})['then'](function(){return new BPromise(function(_0x5f5020,_0x53f749){rimraf(_0x678b54,function(_0x72607f){if(_0x72607f)_0x53f749(_0x72607f);return _0x5f5020();});});})[_0xbfc2('0x1a')](function(){return _0x14da5e[_0xbfc2('0x51')](_0x3af586,_0x189386,function(_0x3cbc46){if(!_0x3cbc46)fs[_0xbfc2('0x6c')](_0x3af586);});});});}else{return _0x14da5e[_0xbfc2('0x10')](0xc8);}})[_0xbfc2('0x32')](handleError(_0x14da5e,null));}; \ No newline at end of file +var _0xe3c0=['juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','update','then','destroy','error','stack','name','send','index','MailInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','mail','query','catch','show','params','model','keys','intersection','attributes','length','merge','find','create','body','describe','MailMessage','addMessage','omit','ids','findOne','filters','fields','hasOwnProperty','nolimit','order','sort','where','pick','MailInteractionId','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','inlineCss','addTags','Tag','color','emit','mailInteractionTags:save','removeTags','download','root','files','join','attachments','Attachment','from','bcc','createdAt','Messages','get','mkdirSync','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','push','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','moment','util','path','lodash'];(function(_0x4e0359,_0x205155){var _0x450f0a=function(_0x2056c6){while(--_0x2056c6){_0x4e0359['push'](_0x4e0359['shift']());}};_0x450f0a(++_0x205155);}(_0xe3c0,0x1b5));var _0x0e3c=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xe3c0[_0xbe200f];return _0x192597;};'use strict';var emlformat=require(_0x0e3c('0x0'));var rimraf=require(_0x0e3c('0x1'));var zipdir=require(_0x0e3c('0x2'));var moment=require(_0x0e3c('0x3'));var BPromise=require('bluebird');var util=require(_0x0e3c('0x4'));var path=require(_0x0e3c('0x5'));var fs=require('fs');var _=require(_0x0e3c('0x6'));var juice=require(_0x0e3c('0x7'));var Redis=require(_0x0e3c('0x8'));var interaction=require('../../components/interaction/service');var qs=require(_0x0e3c('0x9'));var logger=require(_0x0e3c('0xa'))(_0x0e3c('0xb'));var config=require(_0x0e3c('0xc'));var db=require(_0x0e3c('0xd'))['db'];var htmlEntities=require(_0x0e3c('0xe'));config[_0x0e3c('0xf')]=_[_0x0e3c('0x10')](config[_0x0e3c('0xf')],{'host':'localhost','port':0x18eb});var socket=require(_0x0e3c('0x11'))(new Redis(config['redis']));require(_0x0e3c('0x12'))[_0x0e3c('0x13')](socket);function respondWithStatusCode(_0x529580,_0x1b47b4){_0x1b47b4=_0x1b47b4||0xcc;return function(_0x2fcd9a){if(_0x2fcd9a){return _0x529580[_0x0e3c('0x14')](_0x1b47b4);}return _0x529580[_0x0e3c('0x15')](_0x1b47b4)[_0x0e3c('0x16')]();};}function respondWithResult(_0x547383,_0x3c710e){_0x3c710e=_0x3c710e||0xc8;return function(_0x1d8070){if(_0x1d8070){return _0x547383[_0x0e3c('0x15')](_0x3c710e)['json'](_0x1d8070);}};}function respondWithFilteredResult(_0x10e511,_0x16ddd7){return function(_0x5dab40){if(_0x5dab40){var _0x128eed=typeof _0x16ddd7[_0x0e3c('0x17')]===_0x0e3c('0x18')&&typeof _0x16ddd7[_0x0e3c('0x19')]===_0x0e3c('0x18');var _0xe3f157=_0x5dab40[_0x0e3c('0x1a')];var _0x10e283=_0x128eed?0x0:_0x16ddd7[_0x0e3c('0x17')];var _0x338deb=_0x128eed?_0x5dab40[_0x0e3c('0x1a')]:_0x16ddd7['offset']+_0x16ddd7[_0x0e3c('0x19')];var _0x535a93;if(_0x338deb>=_0xe3f157){_0x338deb=_0xe3f157;_0x535a93=0xc8;}else{_0x535a93=0xce;}_0x10e511['status'](_0x535a93);return _0x10e511[_0x0e3c('0x1b')]('Content-Range',_0x10e283+'-'+_0x338deb+'/'+_0xe3f157)[_0x0e3c('0x1c')](_0x5dab40);}return null;};}function saveUpdates(_0x34303b){return function(_0x1618c9){if(_0x1618c9){return _0x1618c9[_0x0e3c('0x1d')](_0x34303b)[_0x0e3c('0x1e')](function(_0x1c6ed8){return _0x1c6ed8;});}return null;};}function removeEntity(_0x235c42){return function(_0xf53937){if(_0xf53937){return _0xf53937[_0x0e3c('0x1f')]()[_0x0e3c('0x1e')](function(){_0x235c42[_0x0e3c('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x277d49){return function(_0x368cae){if(!_0x368cae){_0x277d49[_0x0e3c('0x14')](0x194);}return _0x368cae;};}function handleError(_0x737e7,_0x18a908){_0x18a908=_0x18a908||0x1f4;return function(_0x48a7d9){logger[_0x0e3c('0x20')](_0x48a7d9[_0x0e3c('0x21')]);if(_0x48a7d9[_0x0e3c('0x22')]){delete _0x48a7d9[_0x0e3c('0x22')];}_0x737e7[_0x0e3c('0x15')](_0x18a908)[_0x0e3c('0x23')](_0x48a7d9);};}exports[_0x0e3c('0x24')]=function(_0x56b152,_0x114ed4){var _0x49763e={};var _0x14a0e4=_['map'](db[_0x0e3c('0x25')][_0x0e3c('0x26')],function(_0x8f346){return{'name':_0x8f346[_0x0e3c('0x27')],'type':_0x8f346[_0x0e3c('0x28')][_0x0e3c('0x29')]};});_0x49763e=qs[_0x0e3c('0x2a')](_0x14a0e4,_0x56b152);return interaction[_0x0e3c('0x2b')](_0x0e3c('0x2c'),_0x56b152[_0x0e3c('0x2d')],_0x56b152['user'],_0x49763e,_0x14a0e4)[_0x0e3c('0x1e')](respondWithFilteredResult(_0x114ed4,_0x49763e))[_0x0e3c('0x2e')](handleError(_0x114ed4,null));};exports[_0x0e3c('0x2f')]=function(_0x5c40ec,_0x2f50ae){var _0x3cba7a={'raw':![],'where':{'id':_0x5c40ec[_0x0e3c('0x30')]['id']}},_0x344d84={};_0x344d84[_0x0e3c('0x31')]=_[_0x0e3c('0x32')](db[_0x0e3c('0x25')]['rawAttributes']);_0x344d84[_0x0e3c('0x2d')]=_[_0x0e3c('0x32')](_0x5c40ec[_0x0e3c('0x2d')]);_0x344d84['filters']=_[_0x0e3c('0x33')](_0x344d84[_0x0e3c('0x31')],_0x344d84[_0x0e3c('0x2d')]);_0x3cba7a['attributes']=_[_0x0e3c('0x33')](_0x344d84[_0x0e3c('0x31')],qs['fields'](_0x5c40ec['query']['fields']));_0x3cba7a[_0x0e3c('0x34')]=_0x3cba7a[_0x0e3c('0x34')][_0x0e3c('0x35')]?_0x3cba7a[_0x0e3c('0x34')]:_0x344d84[_0x0e3c('0x31')];if(_0x5c40ec[_0x0e3c('0x2d')]['includeAll']){_0x3cba7a['include']=[{'all':!![]}];}_0x3cba7a=_[_0x0e3c('0x36')]({},_0x3cba7a,_0x5c40ec['options']);return db['MailInteraction'][_0x0e3c('0x37')](_0x3cba7a)['then'](handleEntityNotFound(_0x2f50ae,null))[_0x0e3c('0x1e')](respondWithResult(_0x2f50ae,null))['catch'](handleError(_0x2f50ae,null));};exports[_0x0e3c('0x38')]=function(_0x446815,_0x1d861a){return db[_0x0e3c('0x25')][_0x0e3c('0x38')](_0x446815[_0x0e3c('0x39')],{})[_0x0e3c('0x1e')](respondWithResult(_0x1d861a,0xc9))['catch'](handleError(_0x1d861a,null));};exports[_0x0e3c('0x1d')]=function(_0x306921,_0x1ab1bd){if(_0x306921[_0x0e3c('0x39')]['id']){delete _0x306921[_0x0e3c('0x39')]['id'];}return db['MailInteraction']['find']({'where':{'id':_0x306921[_0x0e3c('0x30')]['id']}})[_0x0e3c('0x1e')](handleEntityNotFound(_0x1ab1bd,null))[_0x0e3c('0x1e')](saveUpdates(_0x306921[_0x0e3c('0x39')],null))['then'](respondWithResult(_0x1ab1bd,null))['catch'](handleError(_0x1ab1bd,null));};exports[_0x0e3c('0x1f')]=function(_0x41e8a4,_0x4e4e08){return db['MailInteraction'][_0x0e3c('0x37')]({'where':{'id':_0x41e8a4[_0x0e3c('0x30')]['id']}})['then'](handleEntityNotFound(_0x4e4e08,null))['then'](removeEntity(_0x4e4e08,null))[_0x0e3c('0x2e')](handleError(_0x4e4e08,null));};exports[_0x0e3c('0x3a')]=function(_0x29c12a,_0x193f29){return db[_0x0e3c('0x25')][_0x0e3c('0x3a')]()[_0x0e3c('0x1e')](respondWithResult(_0x193f29,null))[_0x0e3c('0x2e')](handleError(_0x193f29,null));};exports['addMessage']=function(_0x587cbb,_0x405132){return db[_0x0e3c('0x3b')][_0x0e3c('0x37')]({'where':{'id':_0x587cbb[_0x0e3c('0x30')]['id']}})[_0x0e3c('0x1e')](handleEntityNotFound(_0x405132,null))[_0x0e3c('0x1e')](function(_0x652e9f){if(_0x652e9f){return _0x652e9f[_0x0e3c('0x3c')](_0x587cbb['body']['ids'],_[_0x0e3c('0x3d')](_0x587cbb[_0x0e3c('0x39')],[_0x0e3c('0x3e'),'id'])||{});}})[_0x0e3c('0x1e')](respondWithResult(_0x405132,null))[_0x0e3c('0x2e')](handleError(_0x405132,null));};exports['getMessages']=function(_0x57a021,_0x350896){var _0x28a994={'raw':![],'where':{}};var _0x4fab80={};var _0x40a8e1={'count':0x0,'rows':[]};return db[_0x0e3c('0x25')][_0x0e3c('0x3f')]({'where':{'id':_0x57a021[_0x0e3c('0x30')]['id']}})[_0x0e3c('0x1e')](handleEntityNotFound(_0x350896,null))[_0x0e3c('0x1e')](function(_0x25276a){if(_0x25276a){_0x4fab80[_0x0e3c('0x31')]=_[_0x0e3c('0x32')](db[_0x0e3c('0x3b')]['rawAttributes']);_0x4fab80[_0x0e3c('0x2d')]=_[_0x0e3c('0x32')](_0x57a021[_0x0e3c('0x2d')]);_0x4fab80[_0x0e3c('0x40')]=_['intersection'](_0x4fab80[_0x0e3c('0x31')],_0x4fab80[_0x0e3c('0x2d')]);_0x28a994['attributes']=_[_0x0e3c('0x33')](_0x4fab80[_0x0e3c('0x31')],qs[_0x0e3c('0x41')](_0x57a021[_0x0e3c('0x2d')][_0x0e3c('0x41')]));_0x28a994[_0x0e3c('0x34')]=_0x28a994[_0x0e3c('0x34')][_0x0e3c('0x35')]?_0x28a994[_0x0e3c('0x34')]:_0x4fab80[_0x0e3c('0x31')];if(!_0x57a021[_0x0e3c('0x2d')][_0x0e3c('0x42')](_0x0e3c('0x43'))){_0x28a994[_0x0e3c('0x19')]=qs['limit'](_0x57a021[_0x0e3c('0x2d')][_0x0e3c('0x19')]);_0x28a994[_0x0e3c('0x17')]=qs['offset'](_0x57a021[_0x0e3c('0x2d')][_0x0e3c('0x17')]);}_0x28a994[_0x0e3c('0x44')]=qs['sort'](_0x57a021[_0x0e3c('0x2d')][_0x0e3c('0x45')]);_0x28a994[_0x0e3c('0x46')]=qs[_0x0e3c('0x40')](_[_0x0e3c('0x47')](_0x57a021['query'],_0x4fab80[_0x0e3c('0x40')]));_0x28a994[_0x0e3c('0x46')][_0x0e3c('0x48')]=_0x25276a['id'];if(_0x57a021[_0x0e3c('0x2d')][_0x0e3c('0x49')]){_0x28a994[_0x0e3c('0x46')]=_[_0x0e3c('0x36')](_0x28a994[_0x0e3c('0x46')],{'$or':_[_0x0e3c('0x4a')](_0x28a994['attributes'],function(_0x2375e3){var _0x5d0a2c={};_0x5d0a2c[_0x2375e3]={'$like':'%'+_0x57a021[_0x0e3c('0x2d')][_0x0e3c('0x49')]+'%'};return _0x5d0a2c;})});}if(_0x57a021['query'][_0x0e3c('0x4b')]){var _0x5d9b2f=_0x57a021[_0x0e3c('0x2d')]['$gte'][_0x0e3c('0x4c')](',');var _0x522a81={};_0x522a81[_0x5d9b2f[0x0]]={'$gte':moment(_0x5d9b2f[0x1])[_0x0e3c('0x4d')](_0x0e3c('0x4e'))};_0x28a994[_0x0e3c('0x46')]=_['merge'](_0x28a994[_0x0e3c('0x46')],_0x522a81);}_0x28a994=_['merge']({},_0x28a994,_0x57a021[_0x0e3c('0x4f')]);return db[_0x0e3c('0x3b')][_0x0e3c('0x1a')]({'where':_0x28a994['where']})['then'](function(_0x5a216a){_0x40a8e1[_0x0e3c('0x1a')]=_0x5a216a;if(_0x57a021[_0x0e3c('0x2d')][_0x0e3c('0x50')]){_0x28a994['include']=[{'all':!![]}];}return db[_0x0e3c('0x3b')][_0x0e3c('0x2b')](_0x28a994);})['then'](function(_0x2e1255){if(_0x57a021[_0x0e3c('0x2d')][_0x0e3c('0x51')]==='true'){for(var _0x1c52f9=0x0;_0x1c52f9<_0x2e1255['length'];_0x1c52f9++){_0x2e1255[_0x1c52f9][_0x0e3c('0x39')]=juice(_0x2e1255[_0x1c52f9]['body']);}}_0x40a8e1['rows']=_0x2e1255;return _0x40a8e1;});}})[_0x0e3c('0x1e')](respondWithFilteredResult(_0x350896,_0x28a994))[_0x0e3c('0x2e')](handleError(_0x350896,null));};exports[_0x0e3c('0x52')]=function(_0x7bdf3d,_0x176f9d){return db[_0x0e3c('0x25')][_0x0e3c('0x37')]({'where':{'id':_0x7bdf3d[_0x0e3c('0x30')]['id']}})[_0x0e3c('0x1e')](handleEntityNotFound(_0x176f9d,null))['then'](function(_0xec2cbb){if(_0xec2cbb){return _0xec2cbb['setTags'](_0x7bdf3d['body'][_0x0e3c('0x3e')],_[_0x0e3c('0x3d')](_0x7bdf3d['body'],[_0x0e3c('0x3e'),'id'])||{})['spread'](function(){return db[_0x0e3c('0x53')][_0x0e3c('0x2b')]({'attributes':['id','name',_0x0e3c('0x54')],'where':{'id':_0x7bdf3d[_0x0e3c('0x39')][_0x0e3c('0x3e')]}});})[_0x0e3c('0x1e')](function(_0x11a806){socket[_0x0e3c('0x55')](_0x0e3c('0x56'),{'id':Number(_0x7bdf3d[_0x0e3c('0x30')]['id']),'tags':_0x11a806||[]});return{'id':Number(_0x7bdf3d[_0x0e3c('0x30')]['id']),'tags':_0x11a806||[]};});}})[_0x0e3c('0x1e')](respondWithResult(_0x176f9d,null))['catch'](handleError(_0x176f9d,null));};exports[_0x0e3c('0x57')]=function(_0x590242,_0x6a5046){return db[_0x0e3c('0x25')][_0x0e3c('0x37')]({'where':{'id':_0x590242['params']['id']}})[_0x0e3c('0x1e')](handleEntityNotFound(_0x6a5046,null))['then'](function(_0x4b5c69){if(_0x4b5c69){return _0x4b5c69[_0x0e3c('0x57')](_0x590242[_0x0e3c('0x2d')][_0x0e3c('0x3e')]);}})[_0x0e3c('0x1e')](respondWithStatusCode(_0x6a5046,null))['catch'](handleError(_0x6a5046,null));};exports[_0x0e3c('0x58')]=function(_0x20ca2c,_0x49a50d){var _0xe7761b=moment()['unix']()['toString']();var _0x1e0067=path['join'](config[_0x0e3c('0x59')],'server',_0x0e3c('0x5a'),'tmp');var _0x1b47e9=path[_0x0e3c('0x5b')](config[_0x0e3c('0x59')],'server','files','attachments');var _0xc69978=path[_0x0e3c('0x5b')](_0x1e0067,_0xe7761b);var _0x568990=util[_0x0e3c('0x4d')]('transcript-%d-%s.zip',_0x20ca2c[_0x0e3c('0x30')]['id'],_0xe7761b);var _0x1743bd=path[_0x0e3c('0x5b')](_0x1e0067,_0x568990);var _0x311022=[];if(_0x20ca2c[_0x0e3c('0x2d')][_0x0e3c('0x5c')]){_0x311022['push']({'model':db[_0x0e3c('0x5d')],'as':'Attachments','raw':!![]});}var _0x3968f0=[{'model':db[_0x0e3c('0x3b')],'as':'Messages','attributes':['id',_0x0e3c('0x39'),_0x0e3c('0x5e'),'to','cc',_0x0e3c('0x5f'),'subject',_0x0e3c('0x60')],'where':{'secret':![]},'order':qs[_0x0e3c('0x45')]('id'),'include':_0x311022}];return db[_0x0e3c('0x25')][_0x0e3c('0x37')]({'where':{'id':_0x20ca2c[_0x0e3c('0x30')]['id']},'include':_0x3968f0})['then'](handleEntityNotFound(_0x49a50d,null))[_0x0e3c('0x1e')](function(_0x368eb2){if(_0x368eb2&&_0x368eb2[_0x0e3c('0x61')]){var _0x38813d=_0x368eb2[_0x0e3c('0x62')]({'plain':!![]});fs[_0x0e3c('0x63')](_0xc69978);return BPromise['each'](_0x38813d[_0x0e3c('0x61')],function(_0x2c8f44,_0x213e8c){var _0x34d52e={'from':_0x2c8f44[_0x0e3c('0x5e')],'to':_0x2c8f44['to']||'missing.recipient@your.company.com','subject':_0x2c8f44[_0x0e3c('0x64')],'html':htmlEntities['decode'](_0x2c8f44[_0x0e3c('0x39')]),'headers':{'Date':moment(_0x2c8f44[_0x0e3c('0x60')])[_0x0e3c('0x4d')](_0x0e3c('0x65'))},'attachments':[]};if(_0x2c8f44['cc']){_0x34d52e[_0x0e3c('0x66')]['Cc']=_0x2c8f44['cc'];}if(_0x2c8f44[_0x0e3c('0x5f')]){_0x34d52e[_0x0e3c('0x66')][_0x0e3c('0x67')]=_0x2c8f44[_0x0e3c('0x5f')];}return new BPromise(function(_0x368680,_0x5b259d){if(_0x2c8f44[_0x0e3c('0x68')]){for(var _0x3a814d=0x0;_0x3a814d<_0x2c8f44[_0x0e3c('0x68')][_0x0e3c('0x35')];_0x3a814d++){var _0x3622ff=_0x2c8f44[_0x0e3c('0x68')][_0x3a814d];var _0x1f585e=path[_0x0e3c('0x5b')](_0x1b47e9,_0x3622ff['basename']);if(fs['existsSync'](_0x1f585e)){_0x34d52e[_0x0e3c('0x5c')][_0x0e3c('0x69')]({'name':_0x3622ff[_0x0e3c('0x22')],'contentType':_0x3622ff['type'],'data':fs[_0x0e3c('0x6a')](_0x1f585e)});}}}emlformat[_0x0e3c('0x6b')](_0x34d52e,function(_0x32d10e,_0x524ff1){if(_0x32d10e)return _0x5b259d(_0x32d10e);fs[_0x0e3c('0x6c')](path[_0x0e3c('0x5b')](_0xc69978,util[_0x0e3c('0x4d')](_0x0e3c('0x6d'),_0x213e8c)),_0x524ff1);return _0x368680(_0x524ff1);});});})[_0x0e3c('0x1e')](function(){return new BPromise(function(_0x170485,_0x595d41){zipdir(_0xc69978,{'saveTo':_0x1743bd},function(_0x54da45,_0xbb99a8){if(_0x54da45)return _0x595d41(_0x54da45);return _0x170485(_0xbb99a8);});})[_0x0e3c('0x1e')](function(){return new BPromise(function(_0x3026f7,_0x1fb2ec){rimraf(_0xc69978,function(_0x1a1d0c){if(_0x1a1d0c)_0x1fb2ec(_0x1a1d0c);return _0x3026f7();});});})['then'](function(){return _0x49a50d['download'](_0x1743bd,_0x568990,function(_0xc4e56e){if(!_0xc4e56e)fs[_0x0e3c('0x6e')](_0x1743bd);});});});}else{return _0x49a50d[_0x0e3c('0x14')](0xc8);}})[_0x0e3c('0x2e')](handleError(_0x49a50d,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index df02d7e..7668e2d 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 _0xb776=['catch','hasOwnProperty','hook','exports','MailInteraction','../../mysqldb','MailMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit'];(function(_0x1858d1,_0xe16bfb){var _0x3a4ea7=function(_0x2685d3){while(--_0x2685d3){_0x1858d1['push'](_0x1858d1['shift']());}};_0x3a4ea7(++_0xe16bfb);}(_0xb776,0x1b9));var _0x6b77=function(_0x21760b,_0x5865b2){_0x21760b=_0x21760b-0x0;var _0xdbaae0=_0xb776[_0x21760b];return _0xdbaae0;};'use strict';var EventEmitter=require('events');var MailInteraction=require('../../mysqldb')['db'][_0x6b77('0x0')];var MailMessage=require(_0x6b77('0x1'))['db'][_0x6b77('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x6b77('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6b77('0x4'),'afterDestroy':_0x6b77('0x5')};function emitEvent(_0x1354bc){return function(_0x1ea418,_0x5b5ea4,_0x3b9e1c){_0x1ea418[_0x6b77('0x6')]({'attributes':['id'],'raw':!![]})[_0x6b77('0x7')](function(_0x2f8f06){_0x1ea418[_0x6b77('0x8')](_0x6b77('0x9'),_0x2f8f06[_0x6b77('0xa')](function(_0x19e67b){return{'id':_0x19e67b['id']};}));return MailMessage[_0x6b77('0xb')]({'where':{'MailInteractionId':_0x1ea418['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6b77('0x7')](function(_0x9c34a8){_0x1ea418[_0x6b77('0x8')](_0x6b77('0xc'),_0x9c34a8[_0x6b77('0xd')]);MailInteractionEvents['emit'](_0x1354bc+':'+_0x1ea418['id'],_0x1ea418);MailInteractionEvents[_0x6b77('0xe')](_0x1354bc,_0x1ea418);_0x3b9e1c(null);})[_0x6b77('0xf')](_0x3b9e1c(null));};}for(var e in events){if(events[_0x6b77('0x10')](e)){var event=events[e];MailInteraction[_0x6b77('0x11')](e,emitEvent(event));}}module[_0x6b77('0x12')]=MailInteractionEvents; \ No newline at end of file +var _0x7b1b=['exports','events','MailInteraction','MailMessage','save','remove','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook'];(function(_0x305b20,_0x5e57e9){var _0x26d64a=function(_0x2e17f0){while(--_0x2e17f0){_0x305b20['push'](_0x305b20['shift']());}};_0x26d64a(++_0x5e57e9);}(_0x7b1b,0xa1));var _0xb7b1=function(_0x5dd6a0,_0x5745e3){_0x5dd6a0=_0x5dd6a0-0x0;var _0x4bfbff=_0x7b1b[_0x5dd6a0];return _0x4bfbff;};'use strict';var EventEmitter=require(_0xb7b1('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0xb7b1('0x1')];var MailMessage=require('../../mysqldb')['db'][_0xb7b1('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb7b1('0x3'),'afterUpdate':'update','afterDestroy':_0xb7b1('0x4')};function emitEvent(_0x511c98){return function(_0x5cf423,_0x4ab2cb,_0x4fb22d){_0x5cf423['getUsers']({'attributes':['id'],'raw':!![]})[_0xb7b1('0x5')](function(_0x2b4fef){_0x5cf423[_0xb7b1('0x6')](_0xb7b1('0x7'),_0x2b4fef[_0xb7b1('0x8')](function(_0x3d16f9){return{'id':_0x3d16f9['id']};}));return MailMessage[_0xb7b1('0x9')]({'where':{'MailInteractionId':_0x5cf423['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb7b1('0x5')](function(_0x33b890){_0x5cf423[_0xb7b1('0x6')](_0xb7b1('0xa'),_0x33b890['length']);MailInteractionEvents[_0xb7b1('0xb')](_0x511c98+':'+_0x5cf423['id'],_0x5cf423);MailInteractionEvents[_0xb7b1('0xb')](_0x511c98,_0x5cf423);_0x4fb22d(null);})[_0xb7b1('0xc')](_0x4fb22d(null));};}for(var e in events){if(events[_0xb7b1('0xd')](e)){var event=events[e];MailInteraction[_0xb7b1('0xe')](e,emitEvent(event));}}module[_0xb7b1('0xf')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 6006cf2..166b187 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 _0x916f=['get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','define','mail_interactions','fti_mail_interactions','subject','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','closedAt','models'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x916f,0x1c1));var _0xf916=function(_0x599eee,_0x154fb0){_0x599eee=_0x599eee-0x0;var _0x266943=_0x916f[_0x599eee];return _0x266943;};'use strict';var _=require(_0xf916('0x0'));var util=require('util');var logger=require(_0xf916('0x1'))('api');var moment=require(_0xf916('0x2'));var BPromise=require(_0xf916('0x3'));var rp=require(_0xf916('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf916('0x5'));var config=require(_0xf916('0x6'));var attributes=require('./mailInteraction.attributes');module['exports']=function(_0x29544d,_0x55dd54){return _0x29544d[_0xf916('0x7')]('MailInteraction',attributes,{'tableName':_0xf916('0x8'),'paranoid':![],'indexes':[{'name':_0xf916('0x9'),'fields':[_0xf916('0xa'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4fb93e,_0x2f4c30,_0x59224b){if(_0x4fb93e[_0xf916('0xb')]){_0x4fb93e[_0xf916('0xc')]=moment()[_0xf916('0xd')](_0xf916('0xe'));}if(_0x4fb93e[_0xf916('0xf')]){_0x4fb93e['closedAt']=moment()['format'](_0xf916('0xe'));}_0x59224b(null,_0x2f4c30);},'beforeUpdate':function(_0x2c29d6,_0x5c82cc,_0x33a3e5){if(_0x2c29d6[_0xf916('0x10')](_0xf916('0xb'))){_0x2c29d6[_0xf916('0xc')]=_0x2c29d6[_0xf916('0xb')]?moment()[_0xf916('0xd')](_0xf916('0xe')):null;}if(_0x2c29d6[_0xf916('0x10')](_0xf916('0xf'))){_0x2c29d6[_0xf916('0x11')]=moment()[_0xf916('0xd')](_0xf916('0xe'));_0x2c29d6[_0xf916('0xb')]=null;_0x2c29d6[_0xf916('0xc')]=null;}_0x33a3e5(null,_0x2c29d6);},'afterUpdate':function(_0x17f379,_0x13e042,_0x5867fb){var _0x22792f=_0x29544d[_0xf916('0x12')];var _0x22e393=_0x17f379[_0xf916('0x13')]({'plain':!![]});if(_0x22e393[_0xf916('0xf')]){return _0x22792f[_0xf916('0x14')][_0xf916('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x22e393['id']}})[_0xf916('0x16')](function(){_0x5867fb();})[_0xf916('0x17')](function(_0x310c18){_0x5867fb(_0x310c18);});}else{_0x5867fb();}}},'charset':_0xf916('0x18'),'collate':_0xf916('0x19')});}; \ No newline at end of file +var _0xb25d=['MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','models','get'];(function(_0x13b3b5,_0x52d8d8){var _0x337cd0=function(_0x31fbdf){while(--_0x31fbdf){_0x13b3b5['push'](_0x13b3b5['shift']());}};_0x337cd0(++_0x52d8d8);}(_0xb25d,0x132));var _0xdb25=function(_0x58da9c,_0x109e4c){_0x58da9c=_0x58da9c-0x0;var _0x3916c7=_0xb25d[_0x58da9c];return _0x3916c7;};'use strict';var _=require(_0xdb25('0x0'));var util=require(_0xdb25('0x1'));var logger=require(_0xdb25('0x2'))(_0xdb25('0x3'));var moment=require('moment');var BPromise=require(_0xdb25('0x4'));var rp=require(_0xdb25('0x5'));var fs=require('fs');var path=require(_0xdb25('0x6'));var rimraf=require(_0xdb25('0x7'));var config=require(_0xdb25('0x8'));var attributes=require(_0xdb25('0x9'));module['exports']=function(_0x428709,_0x5f3645){return _0x428709[_0xdb25('0xa')](_0xdb25('0xb'),attributes,{'tableName':_0xdb25('0xc'),'paranoid':![],'indexes':[{'name':_0xdb25('0xd'),'fields':[_0xdb25('0xe'),'to'],'type':_0xdb25('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x342724,_0x50724a,_0x39f8de){if(_0x342724[_0xdb25('0x10')]){_0x342724[_0xdb25('0x11')]=moment()[_0xdb25('0x12')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x342724[_0xdb25('0x13')]){_0x342724[_0xdb25('0x14')]=moment()['format'](_0xdb25('0x15'));}_0x39f8de(null,_0x50724a);},'beforeUpdate':function(_0x148a6c,_0x411a71,_0x2a1d56){if(_0x148a6c['changed'](_0xdb25('0x10'))){_0x148a6c[_0xdb25('0x11')]=_0x148a6c[_0xdb25('0x10')]?moment()[_0xdb25('0x12')](_0xdb25('0x15')):null;}if(_0x148a6c['changed'](_0xdb25('0x13'))){_0x148a6c[_0xdb25('0x14')]=moment()['format'](_0xdb25('0x15'));_0x148a6c[_0xdb25('0x10')]=null;_0x148a6c[_0xdb25('0x11')]=null;}_0x2a1d56(null,_0x148a6c);},'afterUpdate':function(_0x513181,_0x5bce79,_0x30a965){var _0x2426b8=_0x428709[_0xdb25('0x16')];var _0x9e68b1=_0x513181[_0xdb25('0x17')]({'plain':!![]});if(_0x9e68b1[_0xdb25('0x13')]){return _0x2426b8[_0xdb25('0x18')][_0xdb25('0x19')]({'read':!![]},{'where':{'MailInteractionId':_0x9e68b1['id']}})[_0xdb25('0x1a')](function(){_0x30a965();})[_0xdb25('0x1b')](function(_0x3b9d0d){_0x30a965(_0x3b9d0d);});}else{_0x30a965();}}},'charset':_0xdb25('0x1c'),'collate':_0xdb25('0x1d')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 97dd7fb..bb00610 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 _0x3f2b=['MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','update','options','raw','where','limit','AddTagsToMailInteraction','body','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info'];(function(_0x26d561,_0x32d756){var _0x1c8f0=function(_0x2301e5){while(--_0x2301e5){_0x26d561['push'](_0x26d561['shift']());}};_0x1c8f0(++_0x32d756);}(_0x3f2b,0x13c));var _0xb3f2=function(_0x135089,_0x510599){_0x135089=_0x135089-0x0;var _0x309b93=_0x3f2b[_0x135089];return _0x309b93;};'use strict';var _=require(_0xb3f2('0x0'));var util=require(_0xb3f2('0x1'));var moment=require(_0xb3f2('0x2'));var BPromise=require(_0xb3f2('0x3'));var rs=require(_0xb3f2('0x4'));var fs=require('fs');var Redis=require(_0xb3f2('0x5'));var db=require(_0xb3f2('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb3f2('0x7'))(_0xb3f2('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb3f2('0x9')][_0xb3f2('0xa')]({'port':0x232a});config[_0xb3f2('0xb')]=_[_0xb3f2('0xc')](config[_0xb3f2('0xb')],{'host':_0xb3f2('0xd'),'port':0x18eb});var socket=require(_0xb3f2('0xe'))(new Redis(config['redis']));require(_0xb3f2('0xf'))[_0xb3f2('0x10')](socket);function respondWithRpcPromise(_0x145546,_0x419597,_0x162b49){return new BPromise(function(_0xf0f91e,_0xbd4ea2){return client[_0xb3f2('0x11')](_0x145546,_0x162b49)[_0xb3f2('0x12')](function(_0x4355e1){logger[_0xb3f2('0x13')](_0xb3f2('0x14'),_0x419597,_0xb3f2('0x15'));logger[_0xb3f2('0x16')](_0xb3f2('0x17'),_0x419597,_0xb3f2('0x15'),JSON[_0xb3f2('0x18')](_0x4355e1));if(_0x4355e1[_0xb3f2('0x19')]){if(_0x4355e1['error'][_0xb3f2('0x1a')]===0x1f4){logger[_0xb3f2('0x19')]('MailInteraction,\x20%s,\x20%s',_0x419597,_0x4355e1['error'][_0xb3f2('0x1b')]);return _0xbd4ea2(_0x4355e1['error']['message']);}logger[_0xb3f2('0x19')]('MailInteraction,\x20%s,\x20%s',_0x419597,_0x4355e1[_0xb3f2('0x19')]['message']);return _0xf0f91e(_0x4355e1['error'][_0xb3f2('0x1b')]);}else{logger[_0xb3f2('0x13')]('MailInteraction,\x20%s,\x20%s',_0x419597,_0xb3f2('0x15'));_0xf0f91e(_0x4355e1[_0xb3f2('0x1c')][_0xb3f2('0x1b')]);}})[_0xb3f2('0x1d')](function(_0x10cf35){logger[_0xb3f2('0x19')](_0xb3f2('0x14'),_0x419597,_0x10cf35);_0xbd4ea2(_0x10cf35);});});}exports[_0xb3f2('0x1e')]=function(_0x16b811){var _0x557b86=this;return new Promise(function(_0x30726f,_0x50cf53){return db[_0xb3f2('0x1f')][_0xb3f2('0x20')](_0x16b811['body'],{'raw':_0x16b811['options']?_0x16b811[_0xb3f2('0x21')][_0xb3f2('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16b811[_0xb3f2('0x21')]?_0x16b811[_0xb3f2('0x21')][_0xb3f2('0x23')]||null:null,'attributes':_0x16b811[_0xb3f2('0x21')]?_0x16b811[_0xb3f2('0x21')]['attributes']||null:null,'limit':_0x16b811[_0xb3f2('0x21')]?_0x16b811['options'][_0xb3f2('0x24')]||null:null})[_0xb3f2('0x12')](function(_0x378ebb){logger[_0xb3f2('0x13')](_0xb3f2('0x1e'),_0x16b811);logger[_0xb3f2('0x16')](_0xb3f2('0x1e'),_0x16b811,JSON['stringify'](_0x378ebb));_0x30726f(_0x378ebb);})['catch'](function(_0x1b5a6b){logger[_0xb3f2('0x19')](_0xb3f2('0x1e'),_0x1b5a6b['message'],_0x16b811);_0x50cf53(_0x557b86[_0xb3f2('0x19')](0x1f4,_0x1b5a6b[_0xb3f2('0x1b')]));});});};exports[_0xb3f2('0x25')]=function(_0x416cf5){return new Promise(function(_0x2f0ec8,_0x1e05cd){return db[_0xb3f2('0x1f')]['find']({'where':_0x416cf5[_0xb3f2('0x21')]?_0x416cf5['options'][_0xb3f2('0x23')]||null:null})[_0xb3f2('0x12')](function(_0x23ff7c){if(_0x23ff7c){return _0x23ff7c['addTags'](_0x416cf5[_0xb3f2('0x26')][_0xb3f2('0x27')],_['omit'](_0x416cf5[_0xb3f2('0x26')],[_0xb3f2('0x27'),'id'])||{});}})[_0xb3f2('0x28')](function(_0xd35cc6){logger[_0xb3f2('0x13')](_0xb3f2('0x29'),_0x416cf5);logger['debug'](_0xb3f2('0x29'),_0x416cf5,JSON[_0xb3f2('0x18')](_0xd35cc6));_0x2f0ec8(_0xd35cc6);})[_0xb3f2('0x1d')](function(_0x37e63c){logger[_0xb3f2('0x19')](_0xb3f2('0x29'),_0x37e63c[_0xb3f2('0x1b')],_0x416cf5);_0x1e05cd(_this[_0xb3f2('0x19')](0x1f4,_0x37e63c[_0xb3f2('0x1b')]));});});}; \ No newline at end of file +var _0x1c23=['http','redis','localhost','socket.io-emitter','./mailInteraction.socket','request','then','info','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','MailInteraction,\x20%s,\x20%s','message','catch','UpdateMailInteraction','MailInteraction','update','options','raw','where','find','addTags','body','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x56d4c7,_0x8166){var _0x266d6e=function(_0xc475e){while(--_0xc475e){_0x56d4c7['push'](_0x56d4c7['shift']());}};_0x266d6e(++_0x8166);}(_0x1c23,0x1d5));var _0x31c2=function(_0x5b39f2,_0x2f7a2e){_0x5b39f2=_0x5b39f2-0x0;var _0x5b7cb8=_0x1c23[_0x5b39f2];return _0x5b7cb8;};'use strict';var _=require(_0x31c2('0x0'));var util=require(_0x31c2('0x1'));var moment=require(_0x31c2('0x2'));var BPromise=require(_0x31c2('0x3'));var rs=require(_0x31c2('0x4'));var fs=require('fs');var Redis=require(_0x31c2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x31c2('0x6'));var logger=require(_0x31c2('0x7'))('rpc');var config=require(_0x31c2('0x8'));var jayson=require(_0x31c2('0x9'));var client=jayson[_0x31c2('0xa')][_0x31c2('0xb')]({'port':0x232a});config[_0x31c2('0xc')]=_['defaults'](config[_0x31c2('0xc')],{'host':_0x31c2('0xd'),'port':0x18eb});var socket=require(_0x31c2('0xe'))(new Redis(config[_0x31c2('0xc')]));require(_0x31c2('0xf'))['register'](socket);function respondWithRpcPromise(_0x4821dd,_0x3794c4,_0x29f71f){return new BPromise(function(_0x22875b,_0x24443c){return client[_0x31c2('0x10')](_0x4821dd,_0x29f71f)[_0x31c2('0x11')](function(_0x5c1c28){logger[_0x31c2('0x12')]('MailInteraction,\x20%s,\x20%s',_0x3794c4,_0x31c2('0x13'));logger[_0x31c2('0x14')](_0x31c2('0x15'),_0x3794c4,'request\x20sent',JSON[_0x31c2('0x16')](_0x5c1c28));if(_0x5c1c28[_0x31c2('0x17')]){if(_0x5c1c28['error'][_0x31c2('0x18')]===0x1f4){logger[_0x31c2('0x17')](_0x31c2('0x19'),_0x3794c4,_0x5c1c28[_0x31c2('0x17')][_0x31c2('0x1a')]);return _0x24443c(_0x5c1c28[_0x31c2('0x17')][_0x31c2('0x1a')]);}logger[_0x31c2('0x17')](_0x31c2('0x19'),_0x3794c4,_0x5c1c28[_0x31c2('0x17')][_0x31c2('0x1a')]);return _0x22875b(_0x5c1c28['error']['message']);}else{logger[_0x31c2('0x12')](_0x31c2('0x19'),_0x3794c4,_0x31c2('0x13'));_0x22875b(_0x5c1c28['result']['message']);}})[_0x31c2('0x1b')](function(_0x4a52fa){logger[_0x31c2('0x17')](_0x31c2('0x19'),_0x3794c4,_0x4a52fa);_0x24443c(_0x4a52fa);});});}exports[_0x31c2('0x1c')]=function(_0xb4c4a5){var _0x55e997=this;return new Promise(function(_0xc29f8a,_0x4ae7ad){return db[_0x31c2('0x1d')][_0x31c2('0x1e')](_0xb4c4a5['body'],{'raw':_0xb4c4a5['options']?_0xb4c4a5[_0x31c2('0x1f')][_0x31c2('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb4c4a5['options']?_0xb4c4a5[_0x31c2('0x1f')][_0x31c2('0x21')]||null:null,'attributes':_0xb4c4a5[_0x31c2('0x1f')]?_0xb4c4a5[_0x31c2('0x1f')]['attributes']||null:null,'limit':_0xb4c4a5[_0x31c2('0x1f')]?_0xb4c4a5[_0x31c2('0x1f')]['limit']||null:null})[_0x31c2('0x11')](function(_0x598a87){logger['info'](_0x31c2('0x1c'),_0xb4c4a5);logger['debug'](_0x31c2('0x1c'),_0xb4c4a5,JSON[_0x31c2('0x16')](_0x598a87));_0xc29f8a(_0x598a87);})[_0x31c2('0x1b')](function(_0x211a43){logger[_0x31c2('0x17')]('UpdateMailInteraction',_0x211a43[_0x31c2('0x1a')],_0xb4c4a5);_0x4ae7ad(_0x55e997[_0x31c2('0x17')](0x1f4,_0x211a43[_0x31c2('0x1a')]));});});};exports['AddTagsToMailInteraction']=function(_0x28d51a){return new Promise(function(_0x3c0ec1,_0xf8879a){return db[_0x31c2('0x1d')][_0x31c2('0x22')]({'where':_0x28d51a[_0x31c2('0x1f')]?_0x28d51a[_0x31c2('0x1f')]['where']||null:null})[_0x31c2('0x11')](function(_0x394712){if(_0x394712){return _0x394712[_0x31c2('0x23')](_0x28d51a[_0x31c2('0x24')][_0x31c2('0x25')],_[_0x31c2('0x26')](_0x28d51a[_0x31c2('0x24')],['ids','id'])||{});}})['spread'](function(_0x421987){logger['info'](_0x31c2('0x27'),_0x28d51a);logger[_0x31c2('0x14')](_0x31c2('0x27'),_0x28d51a,JSON[_0x31c2('0x16')](_0x421987));_0x3c0ec1(_0x421987);})['catch'](function(_0xca74fc){logger['error'](_0x31c2('0x27'),_0xca74fc[_0x31c2('0x1a')],_0x28d51a);_0xf8879a(_this[_0x31c2('0x17')](0x1f4,_0xca74fc[_0x31c2('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 33f2cbd..b4eda4d 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 _0x3afc=['save','update','emit','removeListener','register','length'];(function(_0xb4fcb5,_0x3eab2f){var _0x300bdd=function(_0x246d9c){while(--_0x246d9c){_0xb4fcb5['push'](_0xb4fcb5['shift']());}};_0x300bdd(++_0x3eab2f);}(_0x3afc,0x174));var _0xc3af=function(_0x15d183,_0x54eb01){_0x15d183=_0x15d183-0x0;var _0x246a4c=_0x3afc[_0x15d183];return _0x246a4c;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0xc3af('0x0'),'remove',_0xc3af('0x1')];function createListener(_0x59edca,_0x187912){return function(_0x2a5987){_0x187912[_0xc3af('0x2')](_0x59edca,_0x2a5987);};}function removeListener(_0x4c3efa,_0x10429e){return function(){MailInteractionEvents[_0xc3af('0x3')](_0x4c3efa,_0x10429e);};}exports[_0xc3af('0x4')]=function(_0x260ac2){for(var _0x1623d=0x0,_0x56ff6a=events[_0xc3af('0x5')];_0x1623d<_0x56ff6a;_0x1623d++){var _0x1f8763=events[_0x1623d];var _0x413750=createListener('mailInteraction:'+_0x1f8763,_0x260ac2);MailInteractionEvents['on'](_0x1f8763,_0x413750);}}; \ No newline at end of file +var _0xefc1=['register','mailInteraction:','save','remove'];(function(_0x1e2ce7,_0xedc9ef){var _0x562e2d=function(_0x7b4d7d){while(--_0x7b4d7d){_0x1e2ce7['push'](_0x1e2ce7['shift']());}};_0x562e2d(++_0xedc9ef);}(_0xefc1,0xb6));var _0x1efc=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0xefc1[_0x543084];return _0x306a57;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x1efc('0x0'),_0x1efc('0x1'),'update'];function createListener(_0x3dca45,_0x1e0382){return function(_0x3759e1){_0x1e0382['emit'](_0x3dca45,_0x3759e1);};}function removeListener(_0x55aaff,_0x185427){return function(){MailInteractionEvents['removeListener'](_0x55aaff,_0x185427);};}exports[_0x1efc('0x2')]=function(_0x464ab3){for(var _0x18102b=0x0,_0x54c6ab=events['length'];_0x18102b<_0x54c6ab;_0x18102b++){var _0x4482f4=events[_0x18102b];var _0x3313ef=createListener(_0x1efc('0x3')+_0x4482f4,_0x464ab3);MailInteractionEvents['on'](_0x4482f4,_0x3313ef);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index fdd65dd..9521f95 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 _0x4133=['../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','post','mailmessage:create','create','put','accept','/:id/reject','delete','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2576bc,_0x40be2c){var _0x5038f1=function(_0x4c6334){while(--_0x4c6334){_0x2576bc['push'](_0x2576bc['shift']());}};_0x5038f1(++_0x40be2c);}(_0x4133,0x17a));var _0x3413=function(_0x484a09,_0x31b700){_0x484a09=_0x484a09-0x0;var _0x16ea35=_0x4133[_0x484a09];return _0x16ea35;};'use strict';var multer=require(_0x3413('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3413('0x1'));var express=require(_0x3413('0x2'));var router=express[_0x3413('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3413('0x4'));var interaction=require(_0x3413('0x5'));var config=require(_0x3413('0x6'));var controller=require(_0x3413('0x7'));router[_0x3413('0x8')]('/',auth[_0x3413('0x9')](),controller[_0x3413('0xa')]);router[_0x3413('0x8')](_0x3413('0xb'),auth[_0x3413('0x9')](),controller[_0x3413('0xc')]);router[_0x3413('0x8')](_0x3413('0xd'),auth[_0x3413('0x9')](),controller[_0x3413('0xe')]);router[_0x3413('0x8')](_0x3413('0xf'),auth[_0x3413('0x9')](),controller['download']);router[_0x3413('0x10')]('/',auth['isAuthenticated'](),interaction['tracked']('mail',_0x3413('0x11')),controller[_0x3413('0x12')]);router[_0x3413('0x13')](_0x3413('0xd'),auth['isAuthenticated'](),controller['update']);router['put']('/:id/accept',auth[_0x3413('0x9')](),controller[_0x3413('0x14')]);router[_0x3413('0x13')](_0x3413('0x15'),auth['isAuthenticated'](),controller['reject']);router[_0x3413('0x16')]('/:id',auth[_0x3413('0x9')](),controller['destroy']);module[_0x3413('0x17')]=router; \ No newline at end of file +var _0xc423=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/download','download','post','tracked','mail','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path'];(function(_0x1e71b7,_0x199ed3){var _0x4d0f44=function(_0x41c405){while(--_0x41c405){_0x1e71b7['push'](_0x1e71b7['shift']());}};_0x4d0f44(++_0x199ed3);}(_0xc423,0x159));var _0x3c42=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xc423[_0x413feb];return _0x40ee88;};'use strict';var multer=require(_0x3c42('0x0'));var util=require(_0x3c42('0x1'));var path=require(_0x3c42('0x2'));var timeout=require(_0x3c42('0x3'));var express=require(_0x3c42('0x4'));var router=express['Router']();var fs_extra=require(_0x3c42('0x5'));var auth=require(_0x3c42('0x6'));var interaction=require(_0x3c42('0x7'));var config=require('../../config/environment');var controller=require(_0x3c42('0x8'));router[_0x3c42('0x9')]('/',auth[_0x3c42('0xa')](),controller[_0x3c42('0xb')]);router[_0x3c42('0x9')](_0x3c42('0xc'),auth[_0x3c42('0xa')](),controller[_0x3c42('0xd')]);router['get'](_0x3c42('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x3c42('0x9')](_0x3c42('0xf'),auth[_0x3c42('0xa')](),controller[_0x3c42('0x10')]);router[_0x3c42('0x11')]('/',auth[_0x3c42('0xa')](),interaction[_0x3c42('0x12')](_0x3c42('0x13'),'mailmessage:create'),controller[_0x3c42('0x14')]);router[_0x3c42('0x15')](_0x3c42('0xe'),auth[_0x3c42('0xa')](),controller[_0x3c42('0x16')]);router['put'](_0x3c42('0x17'),auth['isAuthenticated'](),controller[_0x3c42('0x18')]);router[_0x3c42('0x15')](_0x3c42('0x19'),auth['isAuthenticated'](),controller[_0x3c42('0x1a')]);router[_0x3c42('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0x3c42('0x1c')]);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 8320c4b..b934e01 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 _0x1e35=['ENUM','out','STRING','long','DATE','INTEGER','Chat','Email','sequelize','lodash','exports','TEXT','medium','BOOLEAN'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x1e35,0xbe));var _0x51e3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1e35[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x51e3('0x0'));var _=require(_0x51e3('0x1'));module[_0x51e3('0x2')]={'body':{'type':Sequelize[_0x51e3('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x51e3('0x3')](_0x51e3('0x4'))},'read':{'type':Sequelize[_0x51e3('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x51e3('0x6')]('in','out'),'defaultValue':_0x51e3('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x51e3('0x8')](0x1fe)},'from':{'type':Sequelize[_0x51e3('0x8')]},'to':{'type':Sequelize['TEXT'](_0x51e3('0x9'))},'cc':{'type':Sequelize[_0x51e3('0x3')](_0x51e3('0x9'))},'bcc':{'type':Sequelize[_0x51e3('0x3')](_0x51e3('0x9'))},'subject':{'type':Sequelize[_0x51e3('0x3')]},'sentAt':{'type':Sequelize[_0x51e3('0xa')]},'attach':{'type':Sequelize[_0x51e3('0xb')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x51e3('0xa')]},'originTo':{'type':Sequelize['TEXT'](_0x51e3('0x9'))},'originCc':{'type':Sequelize['TEXT']('long')},'originChannel':{'type':Sequelize['ENUM']('Email',_0x51e3('0xc')),'defaultValue':_0x51e3('0xd'),'allowNull':![]}}; \ No newline at end of file +var _0xd51b=['Chat','exports','long','TEXT','medium','BOOLEAN','ENUM','out','STRING','INTEGER','DATE','Email'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd51b,0xb5));var _0xbd51=function(_0x1876d8,_0x1dc055){_0x1876d8=_0x1876d8-0x0;var _0x16539d=_0xd51b[_0x1876d8];return _0x16539d;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0xbd51('0x0')]={'body':{'type':Sequelize['TEXT'](_0xbd51('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xbd51('0x2')](_0xbd51('0x3'))},'read':{'type':Sequelize[_0xbd51('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbd51('0x5')]('in',_0xbd51('0x6')),'defaultValue':_0xbd51('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xbd51('0x7')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xbd51('0x2')](_0xbd51('0x1'))},'cc':{'type':Sequelize[_0xbd51('0x2')](_0xbd51('0x1'))},'bcc':{'type':Sequelize[_0xbd51('0x2')](_0xbd51('0x1'))},'subject':{'type':Sequelize[_0xbd51('0x2')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0xbd51('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xbd51('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xbd51('0x9')]},'originTo':{'type':Sequelize[_0xbd51('0x2')](_0xbd51('0x1'))},'originCc':{'type':Sequelize[_0xbd51('0x2')]('long')},'originChannel':{'type':Sequelize[_0xbd51('0x5')](_0xbd51('0xa'),_0xbd51('0xb')),'defaultValue':_0xbd51('0xa'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index f2b4bb5..05454fc 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 _0xfbbd=['fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','rows','include','find','update','body','destroy','params','describe','create','direction','out','secret','split','MailAccount','MailAccountId','CmContact','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','basename','List','Contacts','defaults','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','accept','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','MailInteraction','MailInteractionId','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','User','fullname','email','internal','channel','event','fromString','EventManager','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','contact','interface','SIP/%s','rejectmessage','download','unix','toString','server','files','tmp','from','bcc','createdAt','Attachment','Attachments','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','localhost','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','json','undefined','limit','count','offset','set','Content-Range','then','end','sendStatus','name','index','map','MailMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes'];(function(_0x327ad8,_0x5f490b){var _0x2e6b26=function(_0x36df04){while(--_0x36df04){_0x327ad8['push'](_0x327ad8['shift']());}};_0x2e6b26(++_0x5f490b);}(_0xfbbd,0x10d));var _0xdfbb=function(_0x2a31fe,_0x7b59d0){_0x2a31fe=_0x2a31fe-0x0;var _0xe03d80=_0xfbbd[_0x2a31fe];return _0xe03d80;};'use strict';var emlformat=require(_0xdfbb('0x0'));var moment=require(_0xdfbb('0x1'));var BPromise=require('bluebird');var util=require(_0xdfbb('0x2'));var path=require(_0xdfbb('0x3'));var fs=require('fs');var _=require(_0xdfbb('0x4'));var Redis=require(_0xdfbb('0x5'));var htmlToText=require(_0xdfbb('0x6'));var qs=require(_0xdfbb('0x7'));var logger=require(_0xdfbb('0x8'))(_0xdfbb('0x9'));var interaction_log=require(_0xdfbb('0x8'))(_0xdfbb('0xa'));var config=require(_0xdfbb('0xb'));var db=require(_0xdfbb('0xc'))['db'];config[_0xdfbb('0xd')]=_['defaults'](config['redis'],{'host':_0xdfbb('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdfbb('0xd')]));var htmlEntities=require(_0xdfbb('0xf'));require(_0xdfbb('0x10'))[_0xdfbb('0x11')](socket);var jayson=require(_0xdfbb('0x12'));var client=jayson[_0xdfbb('0x13')][_0xdfbb('0x14')]({'port':0x232c});var client9003=jayson[_0xdfbb('0x13')]['http']({'port':0x232b});var client9002=jayson[_0xdfbb('0x13')][_0xdfbb('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x3bd984,_0x216015,_0x2cde11,_0x2a1303){return new BPromise(function(_0x163353,_0x5c730f){var _0x28ba8=_0x2a1303||client;return _0x28ba8[_0xdfbb('0x15')](_0x3bd984,_0x2cde11)['then'](function(_0x4b2757){logger[_0xdfbb('0x16')](_0xdfbb('0x17'),_0x216015,_0xdfbb('0x18'));logger['debug'](_0xdfbb('0x19'),_0x216015,_0xdfbb('0x18'),JSON['stringify'](_0x4b2757));if(_0x4b2757[_0xdfbb('0x1a')]){if(_0x4b2757[_0xdfbb('0x1a')][_0xdfbb('0x1b')]===0x1f4){logger[_0xdfbb('0x1a')](_0xdfbb('0x17'),_0x216015,_0x4b2757[_0xdfbb('0x1a')][_0xdfbb('0x1c')]);return _0x5c730f(_0x4b2757[_0xdfbb('0x1a')]['message']);}logger[_0xdfbb('0x1a')]('MailMessage,\x20%s,\x20%s',_0x216015,_0x4b2757['error'][_0xdfbb('0x1c')]);return _0x163353(_0x4b2757[_0xdfbb('0x1a')]['message']);}else{logger[_0xdfbb('0x16')]('MailMessage,\x20%s,\x20%s',_0x216015,_0xdfbb('0x18'));_0x163353(_0x4b2757[_0xdfbb('0x1d')][_0xdfbb('0x1c')]);}})[_0xdfbb('0x1e')](function(_0xd6a261){logger['error']('MailMessage,\x20%s,\x20%s',_0x216015,_0xd6a261);_0x5c730f(_0xd6a261);});});}function respondWithResult(_0x54b8cf,_0x13107f){_0x13107f=_0x13107f||0xc8;return function(_0x34f1ca){if(_0x34f1ca){return _0x54b8cf[_0xdfbb('0x1f')](_0x13107f)[_0xdfbb('0x20')](_0x34f1ca);}};}function respondWithFilteredResult(_0x2a0829,_0xec2c7){return function(_0x479d36){if(_0x479d36){var _0x196d26=typeof _0xec2c7['offset']===_0xdfbb('0x21')&&typeof _0xec2c7[_0xdfbb('0x22')]===_0xdfbb('0x21');var _0x5bbe67=_0x479d36[_0xdfbb('0x23')];var _0x3bf4a7=_0x196d26?0x0:_0xec2c7[_0xdfbb('0x24')];var _0x47df53=_0x196d26?_0x479d36[_0xdfbb('0x23')]:_0xec2c7[_0xdfbb('0x24')]+_0xec2c7[_0xdfbb('0x22')];var _0x4e4f6d;if(_0x47df53>=_0x5bbe67){_0x47df53=_0x5bbe67;_0x4e4f6d=0xc8;}else{_0x4e4f6d=0xce;}_0x2a0829[_0xdfbb('0x1f')](_0x4e4f6d);return _0x2a0829[_0xdfbb('0x25')](_0xdfbb('0x26'),_0x3bf4a7+'-'+_0x47df53+'/'+_0x5bbe67)[_0xdfbb('0x20')](_0x479d36);}return null;};}function saveUpdates(_0x3bcb88){return function(_0x16b1d8){if(_0x16b1d8){return _0x16b1d8['update'](_0x3bcb88)[_0xdfbb('0x27')](function(_0x1fcb94){return _0x1fcb94;});}return null;};}function removeEntity(_0x2e17b6){return function(_0x4d1697){if(_0x4d1697){return _0x4d1697['destroy']()['then'](function(){_0x2e17b6[_0xdfbb('0x1f')](0xcc)[_0xdfbb('0x28')]();});}};}function handleEntityNotFound(_0xef1bd0){return function(_0x3d473a){if(!_0x3d473a){_0xef1bd0[_0xdfbb('0x29')](0x194);}return _0x3d473a;};}function handleError(_0x4b77cc,_0x40e104){_0x40e104=_0x40e104||0x1f4;return function(_0x2e1445){logger[_0xdfbb('0x1a')](_0x2e1445['stack']);if(_0x2e1445['name']){delete _0x2e1445[_0xdfbb('0x2a')];}_0x4b77cc[_0xdfbb('0x1f')](_0x40e104)['send'](_0x2e1445);};}exports[_0xdfbb('0x2b')]=function(_0x47bf3b,_0x4f0520){var _0x19f644={},_0x3fb214={},_0xec85e5={'count':0x0,'rows':[]};var _0x438559=_[_0xdfbb('0x2c')](db[_0xdfbb('0x2d')][_0xdfbb('0x2e')],function(_0x5cf141){return{'name':_0x5cf141[_0xdfbb('0x2f')],'type':_0x5cf141[_0xdfbb('0x30')]['key']};});_0x3fb214[_0xdfbb('0x31')]=_['map'](_0x438559,_0xdfbb('0x2a'));_0x3fb214[_0xdfbb('0x32')]=_[_0xdfbb('0x33')](_0x47bf3b['query']);_0x3fb214[_0xdfbb('0x34')]=_[_0xdfbb('0x35')](_0x3fb214[_0xdfbb('0x31')],_0x3fb214['query']);_0x19f644[_0xdfbb('0x36')]=_['intersection'](_0x3fb214[_0xdfbb('0x31')],qs[_0xdfbb('0x37')](_0x47bf3b[_0xdfbb('0x32')]['fields']));_0x19f644[_0xdfbb('0x36')]=_0x19f644[_0xdfbb('0x36')][_0xdfbb('0x38')]?_0x19f644[_0xdfbb('0x36')]:_0x3fb214[_0xdfbb('0x31')];if(!_0x47bf3b[_0xdfbb('0x32')][_0xdfbb('0x39')]('nolimit')){_0x19f644['limit']=qs[_0xdfbb('0x22')](_0x47bf3b[_0xdfbb('0x32')][_0xdfbb('0x22')]);_0x19f644[_0xdfbb('0x24')]=qs[_0xdfbb('0x24')](_0x47bf3b[_0xdfbb('0x32')][_0xdfbb('0x24')]);}_0x19f644[_0xdfbb('0x3a')]=qs['sort'](_0x47bf3b[_0xdfbb('0x32')][_0xdfbb('0x3b')]);_0x19f644['where']=qs[_0xdfbb('0x34')](_[_0xdfbb('0x3c')](_0x47bf3b[_0xdfbb('0x32')],_0x3fb214[_0xdfbb('0x34')]),_0x438559);if(_0x47bf3b[_0xdfbb('0x32')][_0xdfbb('0x3d')]){_0x19f644['where']=_[_0xdfbb('0x3e')](_0x19f644[_0xdfbb('0x3f')],{'$or':_[_0xdfbb('0x2c')](_0x438559,function(_0x80e84e){if(_0x80e84e[_0xdfbb('0x30')]!==_0xdfbb('0x40')){var _0x5897ef={};_0x5897ef[_0x80e84e[_0xdfbb('0x2a')]]={'$like':'%'+_0x47bf3b['query'][_0xdfbb('0x3d')]+'%'};return _0x5897ef;}})});}_0x19f644=_[_0xdfbb('0x3e')]({},_0x19f644,_0x47bf3b[_0xdfbb('0x41')]);var _0x4b1b8b={'where':_0x19f644[_0xdfbb('0x3f')]};return db[_0xdfbb('0x2d')][_0xdfbb('0x23')](_0x4b1b8b)[_0xdfbb('0x27')](function(_0x3a1c6a){_0xec85e5[_0xdfbb('0x23')]=_0x3a1c6a;if(_0x47bf3b[_0xdfbb('0x32')][_0xdfbb('0x42')]){_0x19f644['include']=[{'all':!![]}];}return db[_0xdfbb('0x2d')]['findAll'](_0x19f644);})[_0xdfbb('0x27')](function(_0x48417d){_0xec85e5[_0xdfbb('0x43')]=_0x48417d;return _0xec85e5;})[_0xdfbb('0x27')](respondWithFilteredResult(_0x4f0520,_0x19f644))[_0xdfbb('0x1e')](handleError(_0x4f0520,null));};exports['show']=function(_0x45c9b8,_0xb132b5){var _0x5205f5={'raw':!![],'where':{'id':_0x45c9b8['params']['id']}},_0x5deb2a={};_0x5deb2a[_0xdfbb('0x31')]=_[_0xdfbb('0x33')](db[_0xdfbb('0x2d')][_0xdfbb('0x2e')]);_0x5deb2a['query']=_[_0xdfbb('0x33')](_0x45c9b8[_0xdfbb('0x32')]);_0x5deb2a[_0xdfbb('0x34')]=_[_0xdfbb('0x35')](_0x5deb2a[_0xdfbb('0x31')],_0x5deb2a['query']);_0x5205f5['attributes']=_[_0xdfbb('0x35')](_0x5deb2a['model'],qs[_0xdfbb('0x37')](_0x45c9b8[_0xdfbb('0x32')][_0xdfbb('0x37')]));_0x5205f5[_0xdfbb('0x36')]=_0x5205f5[_0xdfbb('0x36')][_0xdfbb('0x38')]?_0x5205f5['attributes']:_0x5deb2a['model'];if(_0x45c9b8[_0xdfbb('0x32')][_0xdfbb('0x42')]){_0x5205f5[_0xdfbb('0x44')]=[{'all':!![]}];}_0x5205f5=_[_0xdfbb('0x3e')]({},_0x5205f5,_0x45c9b8[_0xdfbb('0x41')]);return db[_0xdfbb('0x2d')][_0xdfbb('0x45')](_0x5205f5)[_0xdfbb('0x27')](handleEntityNotFound(_0xb132b5,null))[_0xdfbb('0x27')](respondWithResult(_0xb132b5,null))['catch'](handleError(_0xb132b5,null));};exports[_0xdfbb('0x46')]=function(_0x47d2c3,_0x1fdaa6){if(_0x47d2c3['body']['id']){delete _0x47d2c3[_0xdfbb('0x47')]['id'];}return db['MailMessage'][_0xdfbb('0x45')]({'where':{'id':_0x47d2c3['params']['id']}})[_0xdfbb('0x27')](handleEntityNotFound(_0x1fdaa6,null))[_0xdfbb('0x27')](saveUpdates(_0x47d2c3[_0xdfbb('0x47')],null))[_0xdfbb('0x27')](respondWithResult(_0x1fdaa6,null))[_0xdfbb('0x1e')](handleError(_0x1fdaa6,null));};exports[_0xdfbb('0x48')]=function(_0x31a2ee,_0x27f855){return db[_0xdfbb('0x2d')][_0xdfbb('0x45')]({'where':{'id':_0x31a2ee[_0xdfbb('0x49')]['id']}})[_0xdfbb('0x27')](handleEntityNotFound(_0x27f855,null))['then'](removeEntity(_0x27f855,null))[_0xdfbb('0x1e')](handleError(_0x27f855,null));};exports[_0xdfbb('0x4a')]=function(_0x4b827d,_0xa1c269){return db[_0xdfbb('0x2d')][_0xdfbb('0x4a')]()[_0xdfbb('0x27')](respondWithResult(_0xa1c269,null))[_0xdfbb('0x1e')](handleError(_0xa1c269,null));};exports[_0xdfbb('0x4b')]=function(_0x427505,_0x38b917){return db['MailMessage']['create'](_0x427505[_0xdfbb('0x47')])[_0xdfbb('0x27')](function(_0x168ce7){if(_0x168ce7){if(_0x168ce7[_0xdfbb('0x4c')]===_0xdfbb('0x4d')&&!_0x168ce7[_0xdfbb('0x4e')]){var _0x11cab1,_0x57e630,_0xd8da71;if(_0x427505[_0xdfbb('0x47')]['to']){_0x57e630=_0x427505['body']['to'][_0xdfbb('0x4f')](',')[0x0];}return db[_0xdfbb('0x50')]['findOne']({'where':{'id':_0x168ce7[_0xdfbb('0x51')]},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xdfbb('0x52')],'as':'Contacts','where':{'email':_0x57e630},'limit':0x1,'order':[[_0xdfbb('0x53'),_0xdfbb('0x54')]]}]},{'model':db[_0xdfbb('0x55')],'as':_0xdfbb('0x56'),'raw':!![],'include':[{'model':db[_0xdfbb('0x57')],'as':_0xdfbb('0x57'),'raw':!![]}]}]})[_0xdfbb('0x27')](function(_0x24f894){_0x11cab1=_0x24f894;if(!_0x11cab1||!_0x11cab1[_0xdfbb('0x56')])return;var _0x4b5969=_0x11cab1[_0xdfbb('0x58')]();if(_0x427505['body'][_0xdfbb('0x59')]&&_0x427505['body'][_0xdfbb('0x59')][_0xdfbb('0x38')]){for(var _0x21f8f7=0x0;_0x21f8f7<_0x427505[_0xdfbb('0x47')][_0xdfbb('0x59')][_0xdfbb('0x38')];_0x21f8f7+=0x1){_0x427505[_0xdfbb('0x47')][_0xdfbb('0x59')][_0x21f8f7]={'filename':_0x427505[_0xdfbb('0x47')][_0xdfbb('0x59')][_0x21f8f7][_0xdfbb('0x2a')],'path':path[_0xdfbb('0x5a')](config[_0xdfbb('0x5b')],'server/files/attachments',_0x427505[_0xdfbb('0x47')][_0xdfbb('0x59')][_0x21f8f7][_0xdfbb('0x5c')])};}}_0xd8da71={'account':_0x4b5969,'message':_0x427505['body']};return;})[_0xdfbb('0x27')](function(){if(_0x11cab1[_0xdfbb('0x5d')]){if(_0x11cab1[_0xdfbb('0x5d')][_0xdfbb('0x5e')]['length']){return _0x11cab1[_0xdfbb('0x5d')][_0xdfbb('0x5e')][0x0];}else{return db[_0xdfbb('0x52')]['create'](_[_0xdfbb('0x5f')](_0x427505[_0xdfbb('0x47')],{'firstName':_0x427505['body']['to'],'email':_0x427505['body']['to'],'phone':_0x427505['body']['to'],'ListId':_0x11cab1[_0xdfbb('0x60')]}));}}else{throw new Error(_0xdfbb('0x61'));}})[_0xdfbb('0x27')](function(){if(_0xd8da71){return respondWithRpcPromise(_0xdfbb('0x62'),_0xdfbb('0x63'),_0xd8da71,client9003)[_0xdfbb('0x27')](function(_0x5c1db5){return _0x168ce7[_0xdfbb('0x46')]({'read':!![],'messageId':_0x5c1db5[_0xdfbb('0x64')],'sentAt':moment()[_0xdfbb('0x65')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xdfbb('0x1e')](function(_0x2dfcc1){logger[_0xdfbb('0x1a')]('%s',JSON['stringify'](_0x2dfcc1));return _0x168ce7;});}return _0x168ce7;});}return _0x168ce7;}})[_0xdfbb('0x27')](respondWithResult(_0x38b917,0xc9))['catch'](handleError(_0x38b917,null));};exports[_0xdfbb('0x66')]=function(_0x415563,_0x16ce93){var _0x2ceb1a={'agent':{},'channel':'mail'};if(_0x415563[_0xdfbb('0x47')]['id']){delete _0x415563[_0xdfbb('0x47')]['id'];}_0x415563[_0xdfbb('0x47')]['read']=!![];_0x415563[_0xdfbb('0x47')][_0xdfbb('0x67')]=moment()[_0xdfbb('0x65')](_0xdfbb('0x68'));_0x415563[_0xdfbb('0x47')]['UserId']=_0x415563['body'][_0xdfbb('0x69')]||_0x415563[_0xdfbb('0x6a')]['id'];_0x2ceb1a[_0xdfbb('0x6b')]['id']=_0x415563[_0xdfbb('0x47')]['UserId'];return db[_0xdfbb('0x2d')][_0xdfbb('0x45')]({'where':{'id':_0x415563[_0xdfbb('0x49')]['id'],'UserId':null}})[_0xdfbb('0x27')](handleEntityNotFound(_0x16ce93,null))[_0xdfbb('0x27')](saveUpdates(_0x415563[_0xdfbb('0x47')],null))[_0xdfbb('0x27')](function(_0x2b7253){if(_0x2b7253){_0x2ceb1a[_0xdfbb('0x1c')]=_0x2b7253['get']({'plain':!![]});return db[_0xdfbb('0x6c')]['find']({'where':{'id':_0x2b7253[_0xdfbb('0x6d')]}});}return null;})[_0xdfbb('0x27')](handleEntityNotFound(_0x16ce93,null))[_0xdfbb('0x27')](function(_0x1843ea){if(_0x1843ea){return _0x1843ea[_0xdfbb('0x46')]({'UserId':_0x415563[_0xdfbb('0x47')][_0xdfbb('0x69')],'read1stAt':_['isNil'](_0x1843ea['read1stAt'])?moment()['format'](_0xdfbb('0x68')):undefined});}return null;})[_0xdfbb('0x27')](function(_0x210504){if(_0x210504){_0x2ceb1a[_0xdfbb('0x6e')]=_0x210504[_0xdfbb('0x6f')]({'plain':!![]});interaction_log[_0xdfbb('0x16')](_0xdfbb('0x70'),_0x415563['user']['id'],_0x415563['user'][_0xdfbb('0x2a')],_0x415563[_0xdfbb('0x6a')][_0xdfbb('0x71')],_0x2ceb1a[_0xdfbb('0x6e')]['id'],_0x415563[_0xdfbb('0x47')]?JSON[_0xdfbb('0x72')](_0x415563[_0xdfbb('0x47')]):_0xdfbb('0x73'));return respondWithRpcPromise(_0xdfbb('0x74'),_0xdfbb('0x75'),_0x2ceb1a);}return null;})[_0xdfbb('0x27')](function(_0x357200){var _0x35a7a8=_0xdfbb('0x76')+_0x357200[_0xdfbb('0x1c')][_0xdfbb('0x77')];return db[_0xdfbb('0x78')][_0xdfbb('0x32')](_0x35a7a8,{'type':db['Sequelize'][_0xdfbb('0x79')][_0xdfbb('0x7a')],'raw':!![]})['then'](function(_0x33d254){return _0x33d254;});})[_0xdfbb('0x27')](function(_0x2a548e){if(_0x2a548e){_0x2ceb1a[_0xdfbb('0x1c')]['contact']=_0x2a548e[0x0];if(!_0x415563[_0xdfbb('0x47')][_0xdfbb('0x69')])return;return db[_0xdfbb('0x7b')][_0xdfbb('0x45')]({'where':{'id':_0x415563[_0xdfbb('0x47')][_0xdfbb('0x69')],'role':'agent'},'attributes':['id',_0xdfbb('0x2a'),_0xdfbb('0x7c'),_0xdfbb('0x7d'),_0xdfbb('0x7e')],'raw':!![]});}return null;})[_0xdfbb('0x27')](function(_0x3b670c){if(!_0x3b670c)return null;_0x2ceb1a[_0xdfbb('0x1c')][_0xdfbb('0x6b')]=_0x3b670c;return _0x2ceb1a;})[_0xdfbb('0x27')](function(_0x42d9c1){if(_0x42d9c1){if(_0x415563[_0xdfbb('0x47')]['manual']){_0x2ceb1a[_0xdfbb('0x1c')]['interface']=util[_0xdfbb('0x65')]('SIP/%s',_0x415563[_0xdfbb('0x6a')][_0xdfbb('0x2a')]);_0x2ceb1a[_0xdfbb('0x1c')]['channel']=_0x2ceb1a['channel'];_0x2ceb1a[_0xdfbb('0x1c')]['motionChannel']=_0x2ceb1a[_0xdfbb('0x7f')];_0x2ceb1a[_0xdfbb('0x1c')][_0xdfbb('0x80')]=_0xdfbb('0x66');_0x2ceb1a[_0xdfbb('0x1c')][_0xdfbb('0x47')]=htmlToText[_0xdfbb('0x81')](_0x2ceb1a[_0xdfbb('0x1c')][_0xdfbb('0x47')]);return respondWithRpcPromise(_0xdfbb('0x82'),_0xdfbb('0x82'),{'event':'acceptmessage','message':_0x2ceb1a[_0xdfbb('0x1c')]},client9002)['then'](function(){return _0x2ceb1a;});}return _0x2ceb1a;}return null;})[_0xdfbb('0x27')](respondWithResult(_0x16ce93,null))[_0xdfbb('0x1e')](handleError(_0x16ce93,null));};exports[_0xdfbb('0x83')]=function(_0x8bb598,_0x6d802c){var _0x5b18fc={'agent':{},'channel':'mail'};if(_0x8bb598['body']['id']){delete _0x8bb598[_0xdfbb('0x47')]['id'];}_0x8bb598['body']['UserId']=_0x8bb598[_0xdfbb('0x47')][_0xdfbb('0x69')]||_0x8bb598[_0xdfbb('0x6a')]['id'];_0x5b18fc['agent']['id']=_0x8bb598[_0xdfbb('0x47')][_0xdfbb('0x69')];return db['MailMessage']['find']({'where':{'id':_0x8bb598[_0xdfbb('0x49')]['id'],'UserId':null}})[_0xdfbb('0x27')](handleEntityNotFound(_0x6d802c,null))[_0xdfbb('0x27')](function(_0x24d13e){if(_0x24d13e){_0x5b18fc[_0xdfbb('0x1c')]=_0x24d13e['get']({'plain':!![]});return db['MailInteraction'][_0xdfbb('0x45')]({'where':{'id':_0x24d13e[_0xdfbb('0x6d')]}});}return null;})[_0xdfbb('0x27')](handleEntityNotFound(_0x6d802c,null))[_0xdfbb('0x27')](function(_0xedf901){if(_0xedf901){_0x5b18fc[_0xdfbb('0x6e')]=_0xedf901[_0xdfbb('0x6f')]({'plain':!![]});interaction_log['info'](_0xdfbb('0x84'),_0x8bb598['user']['id'],_0x8bb598['user'][_0xdfbb('0x2a')],_0x8bb598[_0xdfbb('0x6a')]['role'],_0x5b18fc[_0xdfbb('0x6e')]['id'],_0x8bb598[_0xdfbb('0x47')]?JSON['stringify'](_0x8bb598['body']):'null');return respondWithRpcPromise(_0xdfbb('0x85'),_0xdfbb('0x86'),_0x5b18fc);}return null;})[_0xdfbb('0x27')](function(_0x4d16e9){var _0x32b1c0=_0xdfbb('0x76')+_0x4d16e9[_0xdfbb('0x1c')][_0xdfbb('0x77')];return db[_0xdfbb('0x78')][_0xdfbb('0x32')](_0x32b1c0,{'type':db[_0xdfbb('0x87')][_0xdfbb('0x79')][_0xdfbb('0x7a')],'raw':!![]})[_0xdfbb('0x27')](function(_0x46255a){return _0x46255a;});})['then'](function(_0x2703de){if(_0x2703de){_0x5b18fc[_0xdfbb('0x1c')][_0xdfbb('0x88')]=_0x2703de[0x0];if(!_0x8bb598[_0xdfbb('0x47')]['UserId'])return;return db[_0xdfbb('0x7b')][_0xdfbb('0x45')]({'where':{'id':_0x8bb598[_0xdfbb('0x47')][_0xdfbb('0x69')],'role':'agent'},'attributes':['id',_0xdfbb('0x2a'),'fullname','email',_0xdfbb('0x7e')],'raw':!![]});}return null;})[_0xdfbb('0x27')](function(_0xd5c9a9){if(!_0xd5c9a9)return null;_0x5b18fc[_0xdfbb('0x1c')][_0xdfbb('0x6b')]=_0xd5c9a9;return _0x5b18fc;})[_0xdfbb('0x27')](function(_0x537d56){if(_0x537d56){_0x537d56[_0xdfbb('0x1c')][_0xdfbb('0x89')]=util[_0xdfbb('0x65')](_0xdfbb('0x8a'),_0x8bb598[_0xdfbb('0x6a')][_0xdfbb('0x2a')]);_0x537d56[_0xdfbb('0x1c')][_0xdfbb('0x7f')]=_0x5b18fc[_0xdfbb('0x7f')];_0x537d56[_0xdfbb('0x1c')]['motionChannel']=_0x5b18fc[_0xdfbb('0x7f')];_0x537d56[_0xdfbb('0x1c')][_0xdfbb('0x80')]=_0xdfbb('0x83');_0x537d56[_0xdfbb('0x1c')][_0xdfbb('0x47')]=htmlToText[_0xdfbb('0x81')](_0x5b18fc[_0xdfbb('0x1c')][_0xdfbb('0x47')]);respondWithRpcPromise(_0xdfbb('0x82'),_0xdfbb('0x82'),{'event':_0xdfbb('0x8b'),'message':_0x537d56[_0xdfbb('0x1c')]},client9002);return _0x5b18fc;}return null;})[_0xdfbb('0x27')](respondWithResult(_0x6d802c,null))[_0xdfbb('0x1e')](handleError(_0x6d802c,null));};exports[_0xdfbb('0x8c')]=function(_0x5380a7,_0x27ccfb){var _0x40113b=moment()[_0xdfbb('0x8d')]()[_0xdfbb('0x8e')]();var _0x3b04c3=path['join'](config[_0xdfbb('0x5b')],_0xdfbb('0x8f'),_0xdfbb('0x90'),_0xdfbb('0x91'));var _0x57f1a3=path[_0xdfbb('0x5a')](config[_0xdfbb('0x5b')],_0xdfbb('0x8f'),_0xdfbb('0x90'),_0xdfbb('0x59'));var _0x34fae1=util[_0xdfbb('0x65')]('message-%s.eml',_0x40113b);return db[_0xdfbb('0x2d')][_0xdfbb('0x45')]({'where':{'id':_0x5380a7[_0xdfbb('0x49')]['id']},'attributes':['id',_0xdfbb('0x47'),_0xdfbb('0x92'),'to','cc',_0xdfbb('0x93'),'subject',_0xdfbb('0x94')],'include':_0x5380a7[_0xdfbb('0x32')][_0xdfbb('0x59')]?[{'model':db[_0xdfbb('0x95')],'as':_0xdfbb('0x96')}]:undefined})[_0xdfbb('0x27')](handleEntityNotFound(_0x27ccfb,null))[_0xdfbb('0x27')](function(_0x3f8e68){if(_0x3f8e68){var _0x64da0f=_0x3f8e68;var _0x9e1c0d={'from':_0x64da0f[_0xdfbb('0x92')],'to':_0x64da0f['to'],'subject':_0x64da0f[_0xdfbb('0x97')],'html':htmlEntities[_0xdfbb('0x98')](_0x64da0f['body']),'headers':{'Date':moment(_0x64da0f[_0xdfbb('0x94')])['format'](_0xdfbb('0x99'))},'attachments':[]};if(_0x3f8e68['cc']){_0x9e1c0d[_0xdfbb('0x9a')]['Cc']=_0x3f8e68['cc'];}if(_0x3f8e68[_0xdfbb('0x93')]){_0x9e1c0d[_0xdfbb('0x9a')][_0xdfbb('0x9b')]=_0x3f8e68[_0xdfbb('0x93')];}return new BPromise(function(_0x3abfd9,_0x4b3091){if(_0x3f8e68[_0xdfbb('0x96')]){for(var _0x61a2f8=0x0;_0x61a2f8<_0x3f8e68[_0xdfbb('0x96')][_0xdfbb('0x38')];_0x61a2f8++){var _0x18f317=_0x3f8e68[_0xdfbb('0x96')][_0x61a2f8];var _0x8b509=path[_0xdfbb('0x5a')](_0x57f1a3,_0x18f317[_0xdfbb('0x5c')]);if(fs[_0xdfbb('0x9c')](_0x8b509)){_0x9e1c0d[_0xdfbb('0x59')][_0xdfbb('0x9d')]({'name':_0x18f317[_0xdfbb('0x2a')],'contentType':_0x18f317['type'],'data':fs[_0xdfbb('0x9e')](_0x8b509)});}}}emlformat[_0xdfbb('0x9f')](_0x9e1c0d,function(_0x34acdb,_0x307393){if(_0x34acdb)return _0x4b3091(_0x34acdb);fs[_0xdfbb('0xa0')](path[_0xdfbb('0x5a')](_0x3b04c3,_0x34fae1),_0x307393);return _0x3abfd9(_0x307393);});});}})['then'](function(_0x2dbf14){if(_0x2dbf14){return _0x27ccfb[_0xdfbb('0x8c')](path[_0xdfbb('0x5a')](_0x3b04c3,_0x34fae1),_0x34fae1,function(_0x352673){if(!_0x352673)fs[_0xdfbb('0xa1')](path['join'](_0x3b04c3,_0x34fae1));});}})[_0xdfbb('0x1e')](handleError(_0x27ccfb,null));}; \ No newline at end of file +var _0x86d3=['http','request','info','request\x20sent','debug','error','code','MailMessage,\x20%s,\x20%s','message','catch','json','undefined','limit','count','offset','status','update','then','destroy','sendStatus','name','index','map','MailMessage','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','includeAll','findAll','show','params','options','body','find','describe','create','direction','secret','split','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','server/files/attachments','basename','ListId','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','contact','User','email','internal','interface','channel','motionChannel','event','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','fullname','SIP/%s','fromString','unix','toString','root','server','files','tmp','message-%s.eml','from','bcc','subject','Attachment','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','existsSync','type','readFileSync','build','writeFileSync','unlinkSync','eml-format','path','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','redis','defaults','localhost','html-entities','./mailMessage.socket','register','client'];(function(_0x178892,_0x1c71d2){var _0x228722=function(_0xd6112e){while(--_0xd6112e){_0x178892['push'](_0x178892['shift']());}};_0x228722(++_0x1c71d2);}(_0x86d3,0x122));var _0x386d=function(_0x49fa98,_0x11accf){_0x49fa98=_0x49fa98-0x0;var _0x1698f1=_0x86d3[_0x49fa98];return _0x1698f1;};'use strict';var emlformat=require(_0x386d('0x0'));var moment=require('moment');var BPromise=require('bluebird');var util=require('util');var path=require(_0x386d('0x1'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x386d('0x2'));var htmlToText=require(_0x386d('0x3'));var qs=require(_0x386d('0x4'));var logger=require(_0x386d('0x5'))(_0x386d('0x6'));var interaction_log=require('../../config/logger')(_0x386d('0x7'));var config=require(_0x386d('0x8'));var db=require('../../mysqldb')['db'];config[_0x386d('0x9')]=_[_0x386d('0xa')](config[_0x386d('0x9')],{'host':_0x386d('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x386d('0x9')]));var htmlEntities=require(_0x386d('0xc'));require(_0x386d('0xd'))[_0x386d('0xe')](socket);var jayson=require('jayson/promise');var client=jayson[_0x386d('0xf')][_0x386d('0x10')]({'port':0x232c});var client9003=jayson[_0x386d('0xf')][_0x386d('0x10')]({'port':0x232b});var client9002=jayson[_0x386d('0xf')][_0x386d('0x10')]({'port':0x232a});function respondWithRpcPromise(_0x2c5068,_0x252d87,_0x4f5f80,_0x465478){return new BPromise(function(_0x3e6e39,_0x220567){var _0x43b4c3=_0x465478||client;return _0x43b4c3[_0x386d('0x11')](_0x2c5068,_0x4f5f80)['then'](function(_0x4f9038){logger[_0x386d('0x12')]('MailMessage,\x20%s,\x20%s',_0x252d87,_0x386d('0x13'));logger[_0x386d('0x14')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x252d87,_0x386d('0x13'),JSON['stringify'](_0x4f9038));if(_0x4f9038[_0x386d('0x15')]){if(_0x4f9038['error'][_0x386d('0x16')]===0x1f4){logger[_0x386d('0x15')](_0x386d('0x17'),_0x252d87,_0x4f9038[_0x386d('0x15')][_0x386d('0x18')]);return _0x220567(_0x4f9038['error'][_0x386d('0x18')]);}logger[_0x386d('0x15')](_0x386d('0x17'),_0x252d87,_0x4f9038[_0x386d('0x15')]['message']);return _0x3e6e39(_0x4f9038[_0x386d('0x15')][_0x386d('0x18')]);}else{logger[_0x386d('0x12')](_0x386d('0x17'),_0x252d87,_0x386d('0x13'));_0x3e6e39(_0x4f9038['result'][_0x386d('0x18')]);}})[_0x386d('0x19')](function(_0x4237d6){logger[_0x386d('0x15')](_0x386d('0x17'),_0x252d87,_0x4237d6);_0x220567(_0x4237d6);});});}function respondWithResult(_0x19c0bd,_0x5ea04b){_0x5ea04b=_0x5ea04b||0xc8;return function(_0x3dfa71){if(_0x3dfa71){return _0x19c0bd['status'](_0x5ea04b)[_0x386d('0x1a')](_0x3dfa71);}};}function respondWithFilteredResult(_0x50c4c5,_0x5af261){return function(_0x53fdb6){if(_0x53fdb6){var _0x46f153=typeof _0x5af261['offset']===_0x386d('0x1b')&&typeof _0x5af261[_0x386d('0x1c')]==='undefined';var _0x5d27f7=_0x53fdb6[_0x386d('0x1d')];var _0x1b71ba=_0x46f153?0x0:_0x5af261[_0x386d('0x1e')];var _0x136206=_0x46f153?_0x53fdb6['count']:_0x5af261[_0x386d('0x1e')]+_0x5af261[_0x386d('0x1c')];var _0x94afc5;if(_0x136206>=_0x5d27f7){_0x136206=_0x5d27f7;_0x94afc5=0xc8;}else{_0x94afc5=0xce;}_0x50c4c5[_0x386d('0x1f')](_0x94afc5);return _0x50c4c5['set']('Content-Range',_0x1b71ba+'-'+_0x136206+'/'+_0x5d27f7)[_0x386d('0x1a')](_0x53fdb6);}return null;};}function saveUpdates(_0x88df88){return function(_0x5e1d48){if(_0x5e1d48){return _0x5e1d48[_0x386d('0x20')](_0x88df88)[_0x386d('0x21')](function(_0x350610){return _0x350610;});}return null;};}function removeEntity(_0x160151){return function(_0x1c9a46){if(_0x1c9a46){return _0x1c9a46[_0x386d('0x22')]()[_0x386d('0x21')](function(){_0x160151[_0x386d('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3addc1){return function(_0x1ed2d2){if(!_0x1ed2d2){_0x3addc1[_0x386d('0x23')](0x194);}return _0x1ed2d2;};}function handleError(_0x480742,_0x4b0c7e){_0x4b0c7e=_0x4b0c7e||0x1f4;return function(_0x3c51a8){logger[_0x386d('0x15')](_0x3c51a8['stack']);if(_0x3c51a8[_0x386d('0x24')]){delete _0x3c51a8[_0x386d('0x24')];}_0x480742['status'](_0x4b0c7e)['send'](_0x3c51a8);};}exports[_0x386d('0x25')]=function(_0x2089a3,_0x27e429){var _0x342795={},_0x38d5ac={},_0x2c4b8f={'count':0x0,'rows':[]};var _0x966815=_[_0x386d('0x26')](db[_0x386d('0x27')][_0x386d('0x28')],function(_0x3bf9ae){return{'name':_0x3bf9ae[_0x386d('0x29')],'type':_0x3bf9ae['type'][_0x386d('0x2a')]};});_0x38d5ac['model']=_[_0x386d('0x26')](_0x966815,_0x386d('0x24'));_0x38d5ac[_0x386d('0x2b')]=_[_0x386d('0x2c')](_0x2089a3['query']);_0x38d5ac[_0x386d('0x2d')]=_[_0x386d('0x2e')](_0x38d5ac[_0x386d('0x2f')],_0x38d5ac[_0x386d('0x2b')]);_0x342795[_0x386d('0x30')]=_[_0x386d('0x2e')](_0x38d5ac['model'],qs['fields'](_0x2089a3['query'][_0x386d('0x31')]));_0x342795[_0x386d('0x30')]=_0x342795['attributes'][_0x386d('0x32')]?_0x342795[_0x386d('0x30')]:_0x38d5ac[_0x386d('0x2f')];if(!_0x2089a3[_0x386d('0x2b')][_0x386d('0x33')]('nolimit')){_0x342795['limit']=qs[_0x386d('0x1c')](_0x2089a3[_0x386d('0x2b')][_0x386d('0x1c')]);_0x342795['offset']=qs[_0x386d('0x1e')](_0x2089a3['query']['offset']);}_0x342795[_0x386d('0x34')]=qs[_0x386d('0x35')](_0x2089a3[_0x386d('0x2b')][_0x386d('0x35')]);_0x342795['where']=qs['filters'](_['pick'](_0x2089a3[_0x386d('0x2b')],_0x38d5ac[_0x386d('0x2d')]),_0x966815);if(_0x2089a3[_0x386d('0x2b')]['filter']){_0x342795[_0x386d('0x36')]=_[_0x386d('0x37')](_0x342795[_0x386d('0x36')],{'$or':_[_0x386d('0x26')](_0x966815,function(_0x43d6ff){if(_0x43d6ff['type']!==_0x386d('0x38')){var _0x1c30a3={};_0x1c30a3[_0x43d6ff[_0x386d('0x24')]]={'$like':'%'+_0x2089a3['query'][_0x386d('0x39')]+'%'};return _0x1c30a3;}})});}_0x342795=_['merge']({},_0x342795,_0x2089a3['options']);var _0x56513b={'where':_0x342795[_0x386d('0x36')]};return db['MailMessage'][_0x386d('0x1d')](_0x56513b)[_0x386d('0x21')](function(_0x4cdb61){_0x2c4b8f[_0x386d('0x1d')]=_0x4cdb61;if(_0x2089a3['query'][_0x386d('0x3a')]){_0x342795['include']=[{'all':!![]}];}return db[_0x386d('0x27')][_0x386d('0x3b')](_0x342795);})[_0x386d('0x21')](function(_0x68b681){_0x2c4b8f['rows']=_0x68b681;return _0x2c4b8f;})[_0x386d('0x21')](respondWithFilteredResult(_0x27e429,_0x342795))['catch'](handleError(_0x27e429,null));};exports[_0x386d('0x3c')]=function(_0x45b73a,_0x17c2a8){var _0x172274={'raw':!![],'where':{'id':_0x45b73a[_0x386d('0x3d')]['id']}},_0x1162dd={};_0x1162dd[_0x386d('0x2f')]=_[_0x386d('0x2c')](db[_0x386d('0x27')][_0x386d('0x28')]);_0x1162dd[_0x386d('0x2b')]=_[_0x386d('0x2c')](_0x45b73a['query']);_0x1162dd[_0x386d('0x2d')]=_[_0x386d('0x2e')](_0x1162dd[_0x386d('0x2f')],_0x1162dd['query']);_0x172274['attributes']=_[_0x386d('0x2e')](_0x1162dd[_0x386d('0x2f')],qs[_0x386d('0x31')](_0x45b73a[_0x386d('0x2b')][_0x386d('0x31')]));_0x172274['attributes']=_0x172274[_0x386d('0x30')][_0x386d('0x32')]?_0x172274[_0x386d('0x30')]:_0x1162dd[_0x386d('0x2f')];if(_0x45b73a[_0x386d('0x2b')][_0x386d('0x3a')]){_0x172274['include']=[{'all':!![]}];}_0x172274=_[_0x386d('0x37')]({},_0x172274,_0x45b73a[_0x386d('0x3e')]);return db[_0x386d('0x27')]['find'](_0x172274)[_0x386d('0x21')](handleEntityNotFound(_0x17c2a8,null))[_0x386d('0x21')](respondWithResult(_0x17c2a8,null))[_0x386d('0x19')](handleError(_0x17c2a8,null));};exports[_0x386d('0x20')]=function(_0x3af095,_0x19c515){if(_0x3af095[_0x386d('0x3f')]['id']){delete _0x3af095['body']['id'];}return db[_0x386d('0x27')][_0x386d('0x40')]({'where':{'id':_0x3af095[_0x386d('0x3d')]['id']}})['then'](handleEntityNotFound(_0x19c515,null))[_0x386d('0x21')](saveUpdates(_0x3af095[_0x386d('0x3f')],null))[_0x386d('0x21')](respondWithResult(_0x19c515,null))[_0x386d('0x19')](handleError(_0x19c515,null));};exports[_0x386d('0x22')]=function(_0x536066,_0x43e4e7){return db['MailMessage'][_0x386d('0x40')]({'where':{'id':_0x536066['params']['id']}})[_0x386d('0x21')](handleEntityNotFound(_0x43e4e7,null))[_0x386d('0x21')](removeEntity(_0x43e4e7,null))[_0x386d('0x19')](handleError(_0x43e4e7,null));};exports[_0x386d('0x41')]=function(_0x12ae04,_0x49e00a){return db[_0x386d('0x27')][_0x386d('0x41')]()[_0x386d('0x21')](respondWithResult(_0x49e00a,null))[_0x386d('0x19')](handleError(_0x49e00a,null));};exports[_0x386d('0x42')]=function(_0x4f15c0,_0x3555fe){return db['MailMessage'][_0x386d('0x42')](_0x4f15c0[_0x386d('0x3f')])[_0x386d('0x21')](function(_0x5f376c){if(_0x5f376c){if(_0x5f376c[_0x386d('0x43')]==='out'&&!_0x5f376c[_0x386d('0x44')]){var _0x5b4396,_0x19f9e4,_0x504ea5;if(_0x4f15c0[_0x386d('0x3f')]['to']){_0x19f9e4=_0x4f15c0[_0x386d('0x3f')]['to'][_0x386d('0x45')](',')[0x0];}return db['MailAccount'][_0x386d('0x46')]({'where':{'id':_0x5f376c[_0x386d('0x47')]},'include':[{'model':db[_0x386d('0x48')],'as':_0x386d('0x49'),'include':[{'model':db[_0x386d('0x4a')],'as':_0x386d('0x4b'),'where':{'email':_0x19f9e4},'limit':0x1,'order':[[_0x386d('0x4c'),_0x386d('0x4d')]]}]},{'model':db[_0x386d('0x4e')],'as':_0x386d('0x4f'),'raw':!![],'include':[{'model':db[_0x386d('0x50')],'as':_0x386d('0x50'),'raw':!![]}]}]})['then'](function(_0x884097){_0x5b4396=_0x884097;if(!_0x5b4396||!_0x5b4396['Smtp'])return;var _0x442dfd=_0x5b4396[_0x386d('0x51')]();if(_0x4f15c0[_0x386d('0x3f')][_0x386d('0x52')]&&_0x4f15c0[_0x386d('0x3f')][_0x386d('0x52')][_0x386d('0x32')]){for(var _0x12ae40=0x0;_0x12ae40<_0x4f15c0['body'][_0x386d('0x52')][_0x386d('0x32')];_0x12ae40+=0x1){_0x4f15c0[_0x386d('0x3f')][_0x386d('0x52')][_0x12ae40]={'filename':_0x4f15c0[_0x386d('0x3f')][_0x386d('0x52')][_0x12ae40]['name'],'path':path[_0x386d('0x53')](config['root'],_0x386d('0x54'),_0x4f15c0[_0x386d('0x3f')][_0x386d('0x52')][_0x12ae40][_0x386d('0x55')])};}}_0x504ea5={'account':_0x442dfd,'message':_0x4f15c0[_0x386d('0x3f')]};return;})[_0x386d('0x21')](function(){if(_0x5b4396[_0x386d('0x49')]){if(_0x5b4396[_0x386d('0x49')][_0x386d('0x4b')][_0x386d('0x32')]){return _0x5b4396['List'][_0x386d('0x4b')][0x0];}else{return db[_0x386d('0x4a')][_0x386d('0x42')](_[_0x386d('0xa')](_0x4f15c0[_0x386d('0x3f')],{'firstName':_0x4f15c0[_0x386d('0x3f')]['to'],'email':_0x4f15c0[_0x386d('0x3f')]['to'],'phone':_0x4f15c0[_0x386d('0x3f')]['to'],'ListId':_0x5b4396[_0x386d('0x56')]}));}}else{throw new Error('List\x20not\x20found');}})[_0x386d('0x21')](function(){if(_0x504ea5){return respondWithRpcPromise(_0x386d('0x57'),_0x386d('0x58'),_0x504ea5,client9003)[_0x386d('0x21')](function(_0x345612){return _0x5f376c[_0x386d('0x20')]({'read':!![],'messageId':_0x345612[_0x386d('0x59')],'sentAt':moment()[_0x386d('0x5a')](_0x386d('0x5b'))});})[_0x386d('0x19')](function(_0xecee4b){logger['error']('%s',JSON['stringify'](_0xecee4b));return _0x5f376c;});}return _0x5f376c;});}return _0x5f376c;}})[_0x386d('0x21')](respondWithResult(_0x3555fe,0xc9))[_0x386d('0x19')](handleError(_0x3555fe,null));};exports[_0x386d('0x5c')]=function(_0x398ebc,_0x2c1514){var _0x1602f7={'agent':{},'channel':_0x386d('0x5d')};if(_0x398ebc[_0x386d('0x3f')]['id']){delete _0x398ebc['body']['id'];}_0x398ebc[_0x386d('0x3f')][_0x386d('0x5e')]=!![];_0x398ebc['body'][_0x386d('0x5f')]=moment()['format'](_0x386d('0x5b'));_0x398ebc[_0x386d('0x3f')][_0x386d('0x60')]=_0x398ebc[_0x386d('0x3f')][_0x386d('0x60')]||_0x398ebc[_0x386d('0x61')]['id'];_0x1602f7[_0x386d('0x62')]['id']=_0x398ebc[_0x386d('0x3f')]['UserId'];return db[_0x386d('0x27')][_0x386d('0x40')]({'where':{'id':_0x398ebc[_0x386d('0x3d')]['id'],'UserId':null}})[_0x386d('0x21')](handleEntityNotFound(_0x2c1514,null))[_0x386d('0x21')](saveUpdates(_0x398ebc[_0x386d('0x3f')],null))['then'](function(_0x3a84e0){if(_0x3a84e0){_0x1602f7[_0x386d('0x18')]=_0x3a84e0[_0x386d('0x63')]({'plain':!![]});return db[_0x386d('0x64')][_0x386d('0x40')]({'where':{'id':_0x3a84e0[_0x386d('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x2c1514,null))[_0x386d('0x21')](function(_0x14bea1){if(_0x14bea1){return _0x14bea1[_0x386d('0x20')]({'UserId':_0x398ebc[_0x386d('0x3f')][_0x386d('0x60')],'read1stAt':_[_0x386d('0x66')](_0x14bea1[_0x386d('0x67')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x1e5458){if(_0x1e5458){_0x1602f7[_0x386d('0x68')]=_0x1e5458['get']({'plain':!![]});interaction_log[_0x386d('0x12')](_0x386d('0x69'),_0x398ebc[_0x386d('0x61')]['id'],_0x398ebc[_0x386d('0x61')]['name'],_0x398ebc[_0x386d('0x61')][_0x386d('0x6a')],_0x1602f7[_0x386d('0x68')]['id'],_0x398ebc[_0x386d('0x3f')]?JSON[_0x386d('0x6b')](_0x398ebc['body']):_0x386d('0x6c'));return respondWithRpcPromise(_0x386d('0x6d'),'acceptMessage',_0x1602f7);}return null;})[_0x386d('0x21')](function(_0x56fdf7){var _0x2a4e5a=_0x386d('0x6e')+_0x56fdf7[_0x386d('0x18')][_0x386d('0x6f')];return db['sequelize']['query'](_0x2a4e5a,{'type':db[_0x386d('0x70')][_0x386d('0x71')]['SELECT'],'raw':!![]})[_0x386d('0x21')](function(_0x4f7666){return _0x4f7666;});})[_0x386d('0x21')](function(_0x46d5e7){if(_0x46d5e7){_0x1602f7[_0x386d('0x18')][_0x386d('0x72')]=_0x46d5e7[0x0];if(!_0x398ebc[_0x386d('0x3f')][_0x386d('0x60')])return;return db[_0x386d('0x73')][_0x386d('0x40')]({'where':{'id':_0x398ebc[_0x386d('0x3f')][_0x386d('0x60')],'role':'agent'},'attributes':['id',_0x386d('0x24'),'fullname',_0x386d('0x74'),_0x386d('0x75')],'raw':!![]});}return null;})[_0x386d('0x21')](function(_0x10352b){if(!_0x10352b)return null;_0x1602f7[_0x386d('0x18')][_0x386d('0x62')]=_0x10352b;return _0x1602f7;})['then'](function(_0x4801e1){if(_0x4801e1){if(_0x398ebc[_0x386d('0x3f')]['manual']){_0x1602f7['message'][_0x386d('0x76')]=util[_0x386d('0x5a')]('SIP/%s',_0x398ebc[_0x386d('0x61')][_0x386d('0x24')]);_0x1602f7[_0x386d('0x18')][_0x386d('0x77')]=_0x1602f7[_0x386d('0x77')];_0x1602f7[_0x386d('0x18')][_0x386d('0x78')]=_0x1602f7[_0x386d('0x77')];_0x1602f7[_0x386d('0x18')][_0x386d('0x79')]=_0x386d('0x5c');_0x1602f7[_0x386d('0x18')][_0x386d('0x3f')]=htmlToText['fromString'](_0x1602f7['message'][_0x386d('0x3f')]);return respondWithRpcPromise(_0x386d('0x7a'),_0x386d('0x7a'),{'event':_0x386d('0x7b'),'message':_0x1602f7['message']},client9002)[_0x386d('0x21')](function(){return _0x1602f7;});}return _0x1602f7;}return null;})[_0x386d('0x21')](respondWithResult(_0x2c1514,null))[_0x386d('0x19')](handleError(_0x2c1514,null));};exports[_0x386d('0x7c')]=function(_0x17a852,_0x60e4fd){var _0x4f2c56={'agent':{},'channel':_0x386d('0x5d')};if(_0x17a852[_0x386d('0x3f')]['id']){delete _0x17a852[_0x386d('0x3f')]['id'];}_0x17a852[_0x386d('0x3f')][_0x386d('0x60')]=_0x17a852[_0x386d('0x3f')][_0x386d('0x60')]||_0x17a852[_0x386d('0x61')]['id'];_0x4f2c56[_0x386d('0x62')]['id']=_0x17a852['body']['UserId'];return db['MailMessage'][_0x386d('0x40')]({'where':{'id':_0x17a852[_0x386d('0x3d')]['id'],'UserId':null}})[_0x386d('0x21')](handleEntityNotFound(_0x60e4fd,null))[_0x386d('0x21')](function(_0x21d295){if(_0x21d295){_0x4f2c56['message']=_0x21d295[_0x386d('0x63')]({'plain':!![]});return db[_0x386d('0x64')][_0x386d('0x40')]({'where':{'id':_0x21d295[_0x386d('0x65')]}});}return null;})[_0x386d('0x21')](handleEntityNotFound(_0x60e4fd,null))[_0x386d('0x21')](function(_0x31274d){if(_0x31274d){_0x4f2c56[_0x386d('0x68')]=_0x31274d[_0x386d('0x63')]({'plain':!![]});interaction_log['info'](_0x386d('0x7d'),_0x17a852[_0x386d('0x61')]['id'],_0x17a852[_0x386d('0x61')]['name'],_0x17a852[_0x386d('0x61')]['role'],_0x4f2c56['interaction']['id'],_0x17a852[_0x386d('0x3f')]?JSON[_0x386d('0x6b')](_0x17a852[_0x386d('0x3f')]):'null');return respondWithRpcPromise('RejectMessage',_0x386d('0x7e'),_0x4f2c56);}return null;})[_0x386d('0x21')](function(_0x1bde04){var _0x4db285=_0x386d('0x6e')+_0x1bde04['message']['ContactId'];return db['sequelize']['query'](_0x4db285,{'type':db[_0x386d('0x70')][_0x386d('0x71')]['SELECT'],'raw':!![]})[_0x386d('0x21')](function(_0x58819b){return _0x58819b;});})[_0x386d('0x21')](function(_0x5b662a){if(_0x5b662a){_0x4f2c56['message']['contact']=_0x5b662a[0x0];if(!_0x17a852['body']['UserId'])return;return db[_0x386d('0x73')][_0x386d('0x40')]({'where':{'id':_0x17a852[_0x386d('0x3f')][_0x386d('0x60')],'role':_0x386d('0x62')},'attributes':['id',_0x386d('0x24'),_0x386d('0x7f'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0x7376be){if(!_0x7376be)return null;_0x4f2c56[_0x386d('0x18')][_0x386d('0x62')]=_0x7376be;return _0x4f2c56;})[_0x386d('0x21')](function(_0x45838a){if(_0x45838a){_0x45838a[_0x386d('0x18')]['interface']=util[_0x386d('0x5a')](_0x386d('0x80'),_0x17a852[_0x386d('0x61')][_0x386d('0x24')]);_0x45838a['message'][_0x386d('0x77')]=_0x4f2c56[_0x386d('0x77')];_0x45838a[_0x386d('0x18')][_0x386d('0x78')]=_0x4f2c56[_0x386d('0x77')];_0x45838a[_0x386d('0x18')][_0x386d('0x79')]='reject';_0x45838a['message'][_0x386d('0x3f')]=htmlToText[_0x386d('0x81')](_0x4f2c56['message'][_0x386d('0x3f')]);respondWithRpcPromise(_0x386d('0x7a'),_0x386d('0x7a'),{'event':'rejectmessage','message':_0x45838a[_0x386d('0x18')]},client9002);return _0x4f2c56;}return null;})[_0x386d('0x21')](respondWithResult(_0x60e4fd,null))['catch'](handleError(_0x60e4fd,null));};exports['download']=function(_0x234fc2,_0x410a04){var _0x169ddc=moment()[_0x386d('0x82')]()[_0x386d('0x83')]();var _0x3f4e12=path[_0x386d('0x53')](config[_0x386d('0x84')],_0x386d('0x85'),_0x386d('0x86'),_0x386d('0x87'));var _0x319fb4=path['join'](config[_0x386d('0x84')],_0x386d('0x85'),'files',_0x386d('0x52'));var _0x1afc82=util[_0x386d('0x5a')](_0x386d('0x88'),_0x169ddc);return db['MailMessage'][_0x386d('0x40')]({'where':{'id':_0x234fc2['params']['id']},'attributes':['id',_0x386d('0x3f'),_0x386d('0x89'),'to','cc',_0x386d('0x8a'),_0x386d('0x8b'),'createdAt'],'include':_0x234fc2[_0x386d('0x2b')][_0x386d('0x52')]?[{'model':db[_0x386d('0x8c')],'as':'Attachments'}]:undefined})[_0x386d('0x21')](handleEntityNotFound(_0x410a04,null))[_0x386d('0x21')](function(_0x2dc7b2){if(_0x2dc7b2){var _0xfaea8f=_0x2dc7b2;var _0x18c695={'from':_0xfaea8f[_0x386d('0x89')],'to':_0xfaea8f['to'],'subject':_0xfaea8f[_0x386d('0x8b')],'html':htmlEntities[_0x386d('0x8d')](_0xfaea8f[_0x386d('0x3f')]),'headers':{'Date':moment(_0xfaea8f[_0x386d('0x8e')])[_0x386d('0x5a')](_0x386d('0x8f'))},'attachments':[]};if(_0x2dc7b2['cc']){_0x18c695[_0x386d('0x90')]['Cc']=_0x2dc7b2['cc'];}if(_0x2dc7b2['bcc']){_0x18c695['headers'][_0x386d('0x91')]=_0x2dc7b2[_0x386d('0x8a')];}return new BPromise(function(_0x3e0bd8,_0x2bfbd7){if(_0x2dc7b2[_0x386d('0x92')]){for(var _0x3d430e=0x0;_0x3d430e<_0x2dc7b2[_0x386d('0x92')][_0x386d('0x32')];_0x3d430e++){var _0x1dd81a=_0x2dc7b2[_0x386d('0x92')][_0x3d430e];var _0x484640=path[_0x386d('0x53')](_0x319fb4,_0x1dd81a[_0x386d('0x55')]);if(fs[_0x386d('0x93')](_0x484640)){_0x18c695['attachments']['push']({'name':_0x1dd81a[_0x386d('0x24')],'contentType':_0x1dd81a[_0x386d('0x94')],'data':fs[_0x386d('0x95')](_0x484640)});}}}emlformat[_0x386d('0x96')](_0x18c695,function(_0x4a584e,_0x4015da){if(_0x4a584e)return _0x2bfbd7(_0x4a584e);fs[_0x386d('0x97')](path['join'](_0x3f4e12,_0x1afc82),_0x4015da);return _0x3e0bd8(_0x4015da);});});}})['then'](function(_0x1c08af){if(_0x1c08af){return _0x410a04['download'](path[_0x386d('0x53')](_0x3f4e12,_0x1afc82),_0x1afc82,function(_0x20bf45){if(!_0x20bf45)fs[_0x386d('0x98')](path[_0x386d('0x53')](_0x3f4e12,_0x1afc82));});}})['catch'](handleError(_0x410a04,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 426f077..4c72e23 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 _0xd2ce=['save','update','emit','hook','events','../../mysqldb','MailMessage','setMaxListeners'];(function(_0x5c692e,_0x454490){var _0x2ab4d1=function(_0x529423){while(--_0x529423){_0x5c692e['push'](_0x5c692e['shift']());}};_0x2ab4d1(++_0x454490);}(_0xd2ce,0x174));var _0xed2c=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xd2ce[_0x3054be];return _0x3df150;};'use strict';var EventEmitter=require(_0xed2c('0x0'));var MailMessage=require(_0xed2c('0x1'))['db'][_0xed2c('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xed2c('0x3')](0x0);var events={'afterCreate':_0xed2c('0x4'),'afterUpdate':_0xed2c('0x5'),'afterDestroy':'remove'};function emitEvent(_0x157d4c){return function(_0x5dc7d8,_0x3fef09,_0x425645){MailMessageEvents[_0xed2c('0x6')](_0x157d4c+':'+_0x5dc7d8['id'],_0x5dc7d8);MailMessageEvents[_0xed2c('0x6')](_0x157d4c,_0x5dc7d8);_0x425645(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0xed2c('0x7')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0x3310=['../../mysqldb','MailMessage','setMaxListeners','update','emit','hook','exports','events'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3310,0x1df));var _0x0331=function(_0x208808,_0x4eb5b0){_0x208808=_0x208808-0x0;var _0xe6c0e0=_0x3310[_0x208808];return _0xe6c0e0;};'use strict';var EventEmitter=require(_0x0331('0x0'));var MailMessage=require(_0x0331('0x1'))['db'][_0x0331('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x0331('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0331('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5f6e09){return function(_0x52fb92,_0x1552f0,_0xb501cd){MailMessageEvents[_0x0331('0x5')](_0x5f6e09+':'+_0x52fb92['id'],_0x52fb92);MailMessageEvents[_0x0331('0x5')](_0x5f6e09,_0x52fb92);_0xb501cd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x0331('0x6')](e,emitEvent(event));}}module[_0x0331('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 5dbc592..b50312c 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 _0xf074=['rimraf','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','body','fromString','get','direction','toLowerCase','out','UserId','MailInteraction','findOne','MailInteractionId','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text','path'];(function(_0x2135f3,_0x12fda0){var _0x1740b7=function(_0x486c52){while(--_0x486c52){_0x2135f3['push'](_0x2135f3['shift']());}};_0x1740b7(++_0x12fda0);}(_0xf074,0x1b2));var _0x4f07=function(_0x32179c,_0x32fb68){_0x32179c=_0x32179c-0x0;var _0xad3766=_0xf074[_0x32179c];return _0xad3766;};'use strict';var _=require('lodash');var util=require(_0x4f07('0x0'));var logger=require(_0x4f07('0x1'))(_0x4f07('0x2'));var moment=require(_0x4f07('0x3'));var BPromise=require(_0x4f07('0x4'));var rp=require(_0x4f07('0x5'));var htmlToText=require(_0x4f07('0x6'));var fs=require('fs');var path=require(_0x4f07('0x7'));var rimraf=require(_0x4f07('0x8'));var config=require('../../config/environment');var attributes=require(_0x4f07('0x9'));module[_0x4f07('0xa')]=function(_0x51f42f,_0x302463){return _0x51f42f[_0x4f07('0xb')](_0x4f07('0xc'),attributes,{'tableName':_0x4f07('0xd'),'paranoid':![],'indexes':[{'name':_0x4f07('0xe'),'fields':[_0x4f07('0xe')]},{'name':_0x4f07('0xf'),'fields':[_0x4f07('0x10'),_0x4f07('0x11')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x141c0c,_0x217382,_0x292020){if(_0x141c0c[_0x4f07('0x12')]){_0x141c0c[_0x4f07('0x10')]=htmlToText[_0x4f07('0x13')](_0x141c0c[_0x4f07('0x12')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x292020(null,_0x217382);},'afterCreate':function(_0x142af6,_0x9ba367,_0x472b18){var _0xe48e34=_0x51f42f['models'];var _0x33bd0a=_0x142af6[_0x4f07('0x14')]({'plain':!![]});if(_0x33bd0a[_0x4f07('0x15')][_0x4f07('0x16')]()==='in'||_0x33bd0a[_0x4f07('0x15')][_0x4f07('0x16')]()===_0x4f07('0x17')&&!_0x33bd0a['secret']&&!_['isNil'](_0x33bd0a[_0x4f07('0x18')])){_0xe48e34[_0x4f07('0x19')][_0x4f07('0x1a')]({'where':{'id':_0x33bd0a[_0x4f07('0x1b')]}})['then'](function(_0x4fb166){if(_0x4fb166){_0x4fb166[_0x4f07('0x1c')]({'lastMsgAt':_0x33bd0a[_0x4f07('0x1d')],'lastMsgDirection':_0x33bd0a[_0x4f07('0x15')][_0x4f07('0x16')]()});}})[_0x4f07('0x1e')](function(_0x34cc05){console[_0x4f07('0x1f')](_0x34cc05);});}_0x472b18();}},'charset':_0x4f07('0x20'),'collate':_0x4f07('0x21')});}; \ No newline at end of file +var _0x5719=['../../config/environment','./mailMessage.attributes','exports','define','MailMessage','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','direction','toLowerCase','secret','isNil','UserId','findOne','MailInteractionId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','html-to-text','path','rimraf'];(function(_0x358548,_0x1be5eb){var _0x5d19e6=function(_0x4856c7){while(--_0x4856c7){_0x358548['push'](_0x358548['shift']());}};_0x5d19e6(++_0x1be5eb);}(_0x5719,0xec));var _0x9571=function(_0x13ff1b,_0x44a638){_0x13ff1b=_0x13ff1b-0x0;var _0x2d936c=_0x5719[_0x13ff1b];return _0x2d936c;};'use strict';var _=require(_0x9571('0x0'));var util=require(_0x9571('0x1'));var logger=require(_0x9571('0x2'))('api');var moment=require(_0x9571('0x3'));var BPromise=require(_0x9571('0x4'));var rp=require(_0x9571('0x5'));var htmlToText=require(_0x9571('0x6'));var fs=require('fs');var path=require(_0x9571('0x7'));var rimraf=require(_0x9571('0x8'));var config=require(_0x9571('0x9'));var attributes=require(_0x9571('0xa'));module[_0x9571('0xb')]=function(_0x47141d,_0x37cb2c){return _0x47141d[_0x9571('0xc')](_0x9571('0xd'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x9571('0xe'),'fields':[_0x9571('0xe')]},{'name':_0x9571('0xf'),'fields':[_0x9571('0x10'),_0x9571('0x11')],'type':_0x9571('0x12')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x50b816,_0x611919,_0x4dcebc){if(_0x50b816[_0x9571('0x13')]){_0x50b816[_0x9571('0x10')]=htmlToText[_0x9571('0x14')](_0x50b816[_0x9571('0x13')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x4dcebc(null,_0x611919);},'afterCreate':function(_0x5df278,_0x28a999,_0x1f2b26){var _0x23932c=_0x47141d[_0x9571('0x15')];var _0x20ceb9=_0x5df278['get']({'plain':!![]});if(_0x20ceb9[_0x9571('0x16')][_0x9571('0x17')]()==='in'||_0x20ceb9['direction'][_0x9571('0x17')]()==='out'&&!_0x20ceb9[_0x9571('0x18')]&&!_[_0x9571('0x19')](_0x20ceb9[_0x9571('0x1a')])){_0x23932c['MailInteraction'][_0x9571('0x1b')]({'where':{'id':_0x20ceb9[_0x9571('0x1c')]}})[_0x9571('0x1d')](function(_0x4e9588){if(_0x4e9588){_0x4e9588[_0x9571('0x1e')]({'lastMsgAt':_0x20ceb9['createdAt'],'lastMsgDirection':_0x20ceb9[_0x9571('0x16')][_0x9571('0x17')]()});}})[_0x9571('0x1f')](function(_0x224b33){console[_0x9571('0x20')](_0x224b33);});}_0x1f2b26();}},'charset':_0x9571('0x21'),'collate':_0x9571('0x22')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 6de9f45..033c208 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 _0xb9be=['redis','localhost','socket.io-emitter','./mailMessage.socket','register','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateMailMessage','MailMessage','create','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','defaults'];(function(_0x3718b7,_0x2da677){var _0xf8c91e=function(_0x2519b4){while(--_0x2519b4){_0x3718b7['push'](_0x3718b7['shift']());}};_0xf8c91e(++_0x2da677);}(_0xb9be,0xc5));var _0xeb9b=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xb9be[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xeb9b('0x0'));var util=require(_0xeb9b('0x1'));var moment=require(_0xeb9b('0x2'));var BPromise=require(_0xeb9b('0x3'));var rs=require(_0xeb9b('0x4'));var fs=require('fs');var Redis=require(_0xeb9b('0x5'));var db=require(_0xeb9b('0x6'))['db'];var utils=require(_0xeb9b('0x7'));var logger=require(_0xeb9b('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xeb9b('0x9'));var client=jayson[_0xeb9b('0xa')][_0xeb9b('0xb')]({'port':0x232a});config['redis']=_[_0xeb9b('0xc')](config[_0xeb9b('0xd')],{'host':_0xeb9b('0xe'),'port':0x18eb});var socket=require(_0xeb9b('0xf'))(new Redis(config[_0xeb9b('0xd')]));require(_0xeb9b('0x10'))[_0xeb9b('0x11')](socket);function respondWithRpcPromise(_0x16761a,_0x32f0c4,_0x4f4952){return new BPromise(function(_0x20c855,_0x58d6a4){return client['request'](_0x16761a,_0x4f4952)[_0xeb9b('0x12')](function(_0x4236c0){logger['info'](_0xeb9b('0x13'),_0x32f0c4,_0xeb9b('0x14'));logger[_0xeb9b('0x15')](_0xeb9b('0x16'),_0x32f0c4,'request\x20sent',JSON['stringify'](_0x4236c0));if(_0x4236c0['error']){if(_0x4236c0[_0xeb9b('0x17')][_0xeb9b('0x18')]===0x1f4){logger[_0xeb9b('0x17')]('MailMessage,\x20%s,\x20%s',_0x32f0c4,_0x4236c0['error']['message']);return _0x58d6a4(_0x4236c0[_0xeb9b('0x17')][_0xeb9b('0x19')]);}logger[_0xeb9b('0x17')](_0xeb9b('0x13'),_0x32f0c4,_0x4236c0[_0xeb9b('0x17')][_0xeb9b('0x19')]);return _0x20c855(_0x4236c0[_0xeb9b('0x17')]['message']);}else{logger[_0xeb9b('0x1a')](_0xeb9b('0x13'),_0x32f0c4,_0xeb9b('0x14'));_0x20c855(_0x4236c0[_0xeb9b('0x1b')][_0xeb9b('0x19')]);}})[_0xeb9b('0x1c')](function(_0x21010e){logger[_0xeb9b('0x17')](_0xeb9b('0x13'),_0x32f0c4,_0x21010e);_0x58d6a4(_0x21010e);});});}exports[_0xeb9b('0x1d')]=function(_0x4f436e){var _0x43dc48=this;return new Promise(function(_0x5a7ffd,_0x5d5f54){return db[_0xeb9b('0x1e')][_0xeb9b('0x1f')](_0x4f436e['body'],{'raw':_0x4f436e[_0xeb9b('0x20')]?_0x4f436e[_0xeb9b('0x20')][_0xeb9b('0x21')]===undefined?!![]:![]:!![]})[_0xeb9b('0x12')](function(_0x3c8be7){logger[_0xeb9b('0x1a')](_0xeb9b('0x1d'),_0x4f436e);logger[_0xeb9b('0x15')](_0xeb9b('0x1d'),_0x4f436e,JSON[_0xeb9b('0x22')](_0x3c8be7));_0x5a7ffd(_0x3c8be7);})[_0xeb9b('0x1c')](function(_0x296f95){logger[_0xeb9b('0x17')](_0xeb9b('0x1d'),_0x296f95[_0xeb9b('0x19')],_0x4f436e);_0x5d5f54(_0x43dc48[_0xeb9b('0x17')](0x1f4,_0x296f95['message']));});});}; \ No newline at end of file +var _0xb10b=['options','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','CreateMailMessage','MailMessage','body'];(function(_0x28a043,_0x3d894d){var _0x48a72b=function(_0x4ea9e2){while(--_0x4ea9e2){_0x28a043['push'](_0x28a043['shift']());}};_0x48a72b(++_0x3d894d);}(_0xb10b,0x12a));var _0xbb10=function(_0x4b432a,_0x578c42){_0x4b432a=_0x4b432a-0x0;var _0x505158=_0xb10b[_0x4b432a];return _0x505158;};'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});config[_0xbb10('0xb')]=_['defaults'](config[_0xbb10('0xb')],{'host':_0xbb10('0xc'),'port':0x18eb});var socket=require(_0xbb10('0xd'))(new Redis(config[_0xbb10('0xb')]));require(_0xbb10('0xe'))[_0xbb10('0xf')](socket);function respondWithRpcPromise(_0x229887,_0xa3adc8,_0x5ab04a){return new BPromise(function(_0x4e47f8,_0x20bd61){return client[_0xbb10('0x10')](_0x229887,_0x5ab04a)[_0xbb10('0x11')](function(_0x5e136d){logger[_0xbb10('0x12')]('MailMessage,\x20%s,\x20%s',_0xa3adc8,_0xbb10('0x13'));logger[_0xbb10('0x14')](_0xbb10('0x15'),_0xa3adc8,_0xbb10('0x13'),JSON[_0xbb10('0x16')](_0x5e136d));if(_0x5e136d[_0xbb10('0x17')]){if(_0x5e136d['error'][_0xbb10('0x18')]===0x1f4){logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);return _0x20bd61(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')]['message']);return _0x4e47f8(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}else{logger[_0xbb10('0x12')](_0xbb10('0x19'),_0xa3adc8,_0xbb10('0x13'));_0x4e47f8(_0x5e136d[_0xbb10('0x1b')][_0xbb10('0x1a')]);}})[_0xbb10('0x1c')](function(_0xbf2906){logger[_0xbb10('0x17')]('MailMessage,\x20%s,\x20%s',_0xa3adc8,_0xbf2906);_0x20bd61(_0xbf2906);});});}exports[_0xbb10('0x1d')]=function(_0x19f48d){var _0x388fab=this;return new Promise(function(_0x109908,_0xdf237d){return db[_0xbb10('0x1e')]['create'](_0x19f48d[_0xbb10('0x1f')],{'raw':_0x19f48d[_0xbb10('0x20')]?_0x19f48d['options']['raw']===undefined?!![]:![]:!![]})[_0xbb10('0x11')](function(_0x311abe){logger[_0xbb10('0x12')](_0xbb10('0x1d'),_0x19f48d);logger[_0xbb10('0x14')](_0xbb10('0x1d'),_0x19f48d,JSON[_0xbb10('0x16')](_0x311abe));_0x109908(_0x311abe);})[_0xbb10('0x1c')](function(_0x7f2377){logger[_0xbb10('0x17')](_0xbb10('0x1d'),_0x7f2377[_0xbb10('0x1a')],_0x19f48d);_0xdf237d(_0x388fab['error'](0x1f4,_0x7f2377['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index b2f93a4..8d29632 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 _0x87e7=['update','emit','removeListener','register','length','mailMessage:','./mailMessage.events','remove'];(function(_0x3048ea,_0x3838c2){var _0x1a13c4=function(_0x2c6a6b){while(--_0x2c6a6b){_0x3048ea['push'](_0x3048ea['shift']());}};_0x1a13c4(++_0x3838c2);}(_0x87e7,0x11e));var _0x787e=function(_0x1c443f,_0x51319d){_0x1c443f=_0x1c443f-0x0;var _0x4a4a71=_0x87e7[_0x1c443f];return _0x4a4a71;};'use strict';var MailMessageEvents=require(_0x787e('0x0'));var events=['save',_0x787e('0x1'),_0x787e('0x2')];function createListener(_0x5bd83a,_0x1309d2){return function(_0x5609b9){_0x1309d2[_0x787e('0x3')](_0x5bd83a,_0x5609b9);};}function removeListener(_0x3c571d,_0x26e9ec){return function(){MailMessageEvents[_0x787e('0x4')](_0x3c571d,_0x26e9ec);};}exports[_0x787e('0x5')]=function(_0x189256){for(var _0x14b6bf=0x0,_0x2f65da=events[_0x787e('0x6')];_0x14b6bf<_0x2f65da;_0x14b6bf++){var _0x36bc02=events[_0x14b6bf];var _0x5dd8e6=createListener(_0x787e('0x7')+_0x36bc02,_0x189256);MailMessageEvents['on'](_0x36bc02,_0x5dd8e6);}}; \ No newline at end of file +var _0x7df8=['length','mailMessage:','./mailMessage.events','save','remove','update'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x7df8,0x1a0));var _0x87df=function(_0x26834f,_0x18f679){_0x26834f=_0x26834f-0x0;var _0x11c269=_0x7df8[_0x26834f];return _0x11c269;};'use strict';var MailMessageEvents=require(_0x87df('0x0'));var events=[_0x87df('0x1'),_0x87df('0x2'),_0x87df('0x3')];function createListener(_0x44e349,_0x3de7e2){return function(_0x4c4855){_0x3de7e2['emit'](_0x44e349,_0x4c4855);};}function removeListener(_0x3b9929,_0x15108c){return function(){MailMessageEvents['removeListener'](_0x3b9929,_0x15108c);};}exports['register']=function(_0x5e4e9e){for(var _0x5a1aac=0x0,_0x49f565=events[_0x87df('0x4')];_0x5a1aac<_0x49f565;_0x5a1aac++){var _0x41b41f=events[_0x5a1aac];var _0x3daa75=createListener(_0x87df('0x5')+_0x41b41f,_0x5e4e9e);MailMessageEvents['on'](_0x41b41f,_0x3daa75);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 81478f8..8e00a1c 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 _0x68af=['post','create','addTeams','addAgents','/:id','update','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','/:id/teams','/:id/users'];(function(_0x352b7c,_0xf3c28b){var _0x2f96ff=function(_0x393352){while(--_0x393352){_0x352b7c['push'](_0x352b7c['shift']());}};_0x2f96ff(++_0xf3c28b);}(_0x68af,0xf2));var _0xf68a=function(_0x219632,_0x476c58){_0x219632=_0x219632-0x0;var _0x192b37=_0x68af[_0x219632];return _0x192b37;};'use strict';var multer=require(_0xf68a('0x0'));var util=require(_0xf68a('0x1'));var path=require(_0xf68a('0x2'));var timeout=require(_0xf68a('0x3'));var express=require(_0xf68a('0x4'));var router=express[_0xf68a('0x5')]();var fs_extra=require(_0xf68a('0x6'));var auth=require(_0xf68a('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf68a('0x8'));router[_0xf68a('0x9')]('/',auth[_0xf68a('0xa')](),controller[_0xf68a('0xb')]);router[_0xf68a('0x9')](_0xf68a('0xc'),auth[_0xf68a('0xa')](),controller[_0xf68a('0xd')]);router[_0xf68a('0x9')]('/:id',auth[_0xf68a('0xa')](),controller[_0xf68a('0xe')]);router[_0xf68a('0x9')](_0xf68a('0xf'),auth['isAuthenticated'](),controller[_0xf68a('0x10')]);router[_0xf68a('0x9')](_0xf68a('0x11'),auth['isAuthenticated'](),controller['getTeams']);router[_0xf68a('0x9')](_0xf68a('0x12'),auth[_0xf68a('0xa')](),controller['getAgents']);router[_0xf68a('0x13')]('/',auth[_0xf68a('0xa')](),controller[_0xf68a('0x14')]);router[_0xf68a('0x13')](_0xf68a('0x11'),auth[_0xf68a('0xa')](),controller[_0xf68a('0x15')]);router[_0xf68a('0x13')](_0xf68a('0x12'),auth[_0xf68a('0xa')](),controller[_0xf68a('0x16')]);router['put'](_0xf68a('0x17'),auth[_0xf68a('0xa')](),controller[_0xf68a('0x18')]);router['delete'](_0xf68a('0x17'),auth[_0xf68a('0xa')](),controller['destroy']);router[_0xf68a('0x19')](_0xf68a('0x11'),auth[_0xf68a('0xa')](),controller[_0xf68a('0x1a')]);router[_0xf68a('0x19')](_0xf68a('0x12'),auth[_0xf68a('0xa')](),controller[_0xf68a('0x1b')]);module[_0xf68a('0x1c')]=router; \ No newline at end of file +var _0x22d0=['/:id/users','getAgents','post','create','addTeams','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/members','/:id/teams','getTeams'];(function(_0x547cc7,_0x11a028){var _0x4b61ea=function(_0x24dd05){while(--_0x24dd05){_0x547cc7['push'](_0x547cc7['shift']());}};_0x4b61ea(++_0x11a028);}(_0x22d0,0x186));var _0x022d=function(_0x35e54a,_0x46953a){_0x35e54a=_0x35e54a-0x0;var _0x35c2b0=_0x22d0[_0x35e54a];return _0x35c2b0;};'use strict';var multer=require(_0x022d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x022d('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x022d('0x2'));var interaction=require(_0x022d('0x3'));var config=require(_0x022d('0x4'));var controller=require(_0x022d('0x5'));router['get']('/',auth[_0x022d('0x6')](),controller[_0x022d('0x7')]);router[_0x022d('0x8')](_0x022d('0x9'),auth[_0x022d('0x6')](),controller[_0x022d('0xa')]);router[_0x022d('0x8')](_0x022d('0xb'),auth[_0x022d('0x6')](),controller['show']);router['get'](_0x022d('0xc'),auth['isAuthenticated'](),controller['getMembers']);router['get'](_0x022d('0xd'),auth[_0x022d('0x6')](),controller[_0x022d('0xe')]);router[_0x022d('0x8')](_0x022d('0xf'),auth[_0x022d('0x6')](),controller[_0x022d('0x10')]);router[_0x022d('0x11')]('/',auth[_0x022d('0x6')](),controller[_0x022d('0x12')]);router[_0x022d('0x11')]('/:id/teams',auth[_0x022d('0x6')](),controller[_0x022d('0x13')]);router['post']('/:id/users',auth[_0x022d('0x6')](),controller[_0x022d('0x14')]);router['put'](_0x022d('0xb'),auth[_0x022d('0x6')](),controller[_0x022d('0x15')]);router[_0x022d('0x16')]('/:id',auth[_0x022d('0x6')](),controller[_0x022d('0x17')]);router['delete'](_0x022d('0xd'),auth[_0x022d('0x6')](),controller[_0x022d('0x18')]);router[_0x022d('0x16')](_0x022d('0xf'),auth[_0x022d('0x6')](),controller[_0x022d('0x19')]);module[_0x022d('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 1978178..b384e80 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 _0xb7df=['INTEGER','ENUM','sequelize','exports','STRING'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xb7df,0x13d));var _0xfb7d=function(_0x3691af,_0x536a8b){_0x3691af=_0x3691af-0x0;var _0x50a129=_0xb7df[_0x3691af];return _0x50a129;};'use strict';var Sequelize=require(_0xfb7d('0x0'));module[_0xfb7d('0x1')]={'name':{'type':Sequelize[_0xfb7d('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xfb7d('0x2')]},'timeout':{'type':Sequelize[_0xfb7d('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xfb7d('0x4')]('rrmemory','beepall','roundrobin')}}; \ No newline at end of file +var _0x5723=['name','rrmemory','beepall','roundrobin','sequelize','STRING'];(function(_0x58c73b,_0x35d50a){var _0x16c62b=function(_0x16c72c){while(--_0x16c72c){_0x58c73b['push'](_0x58c73b['shift']());}};_0x16c62b(++_0x35d50a);}(_0x5723,0x124));var _0x3572=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5723[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x3572('0x0'));module['exports']={'name':{'type':Sequelize[_0x3572('0x1')],'unique':_0x3572('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3572('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x3572('0x3'),_0x3572('0x4'),_0x3572('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 4959914..eb5a01f 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 _0x82d2=['emit','userMailQueue:save','removeTeams','select','field','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','union','compact','value','transaction','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','get','MailQueues','UserProfileResource','destroy','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','key','getOptions','where','include','findAll','rows','catch','params','model','keys','query','filters','intersection','fields','attributes','length','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','describe','findOne','UserMailQueue','hasOwnProperty','nolimit','order','sort','pick','filter','User','findAndCountAll','UserId','agent','mailPause','updatedAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','sequelize','each','findOrCreate','forEach'];(function(_0x10e8d6,_0x1ca6ad){var _0x5ea71b=function(_0x2ffef8){while(--_0x2ffef8){_0x10e8d6['push'](_0x10e8d6['shift']());}};_0x5ea71b(++_0x1ca6ad);}(_0x82d2,0x19c));var _0x282d=function(_0x5b59ee,_0xe7449e){_0x5b59ee=_0x5b59ee-0x0;var _0x5a09c0=_0x82d2[_0x5b59ee];return _0x5a09c0;};'use strict';var BPromise=require(_0x282d('0x0'));var util=require(_0x282d('0x1'));var _=require(_0x282d('0x2'));var squel=require('squel');var Redis=require(_0x282d('0x3'));var qs=require(_0x282d('0x4'));var logger=require(_0x282d('0x5'))(_0x282d('0x6'));var config=require(_0x282d('0x7'));var db=require(_0x282d('0x8'))['db'];config['redis']=_[_0x282d('0x9')](config[_0x282d('0xa')],{'host':_0x282d('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x282d('0xa')]));require(_0x282d('0xc'))[_0x282d('0xd')](socket);function respondWithStatusCode(_0x10c2e5,_0x1143dc){_0x1143dc=_0x1143dc||0xcc;return function(_0x440b0f){if(_0x440b0f){return _0x10c2e5[_0x282d('0xe')](_0x1143dc);}return _0x10c2e5[_0x282d('0xf')](_0x1143dc)[_0x282d('0x10')]();};}function respondWithResult(_0x2bc4f0,_0x1692c1){_0x1692c1=_0x1692c1||0xc8;return function(_0xf3e64a){if(_0xf3e64a){return _0x2bc4f0[_0x282d('0xf')](_0x1692c1)[_0x282d('0x11')](_0xf3e64a);}};}function respondWithFilteredResult(_0x1bb707,_0x2bb18b){return function(_0x3117a1){if(_0x3117a1){var _0x21bc78=typeof _0x2bb18b[_0x282d('0x12')]===_0x282d('0x13')&&typeof _0x2bb18b[_0x282d('0x14')]==='undefined';var _0x1f68ed=_0x3117a1['count'];var _0x466979=_0x21bc78?0x0:_0x2bb18b[_0x282d('0x12')];var _0x13341e=_0x21bc78?_0x3117a1[_0x282d('0x15')]:_0x2bb18b[_0x282d('0x12')]+_0x2bb18b[_0x282d('0x14')];var _0x53236c;if(_0x13341e>=_0x1f68ed){_0x13341e=_0x1f68ed;_0x53236c=0xc8;}else{_0x53236c=0xce;}_0x1bb707[_0x282d('0xf')](_0x53236c);return _0x1bb707[_0x282d('0x16')](_0x282d('0x17'),_0x466979+'-'+_0x13341e+'/'+_0x1f68ed)['json'](_0x3117a1);}return null;};}function saveUpdates(_0x53ba5c){return function(_0x45c93c){if(_0x45c93c){return _0x45c93c[_0x282d('0x18')](_0x53ba5c)[_0x282d('0x19')](function(_0x31c481){return _0x31c481;});}return null;};}function removeEntity(_0x1ea6d7){return function(_0x3d2ee2){if(_0x3d2ee2){return _0x3d2ee2['destroy']()[_0x282d('0x19')](function(){var _0x22e60f=_0x3d2ee2[_0x282d('0x1a')]({'plain':!![]});var _0x4009ef=_0x282d('0x1b');return db[_0x282d('0x1c')][_0x282d('0x1d')]({'where':{'type':_0x4009ef,'resourceId':_0x22e60f['id']}})[_0x282d('0x19')](function(){return _0x3d2ee2;});})[_0x282d('0x19')](function(){_0x1ea6d7['status'](0xcc)[_0x282d('0x10')]();});}};}function handleEntityNotFound(_0x2e3269){return function(_0x503d55){if(!_0x503d55){_0x2e3269[_0x282d('0xe')](0x194);}return _0x503d55;};}function handleError(_0x51a34d,_0x23efff){_0x23efff=_0x23efff||0x1f4;return function(_0x3f29b6){logger[_0x282d('0x1e')](_0x3f29b6[_0x282d('0x1f')]);if(_0x3f29b6['name']){delete _0x3f29b6[_0x282d('0x20')];}_0x51a34d['status'](_0x23efff)[_0x282d('0x21')](_0x3f29b6);};}exports[_0x282d('0x22')]=function(_0x451af5,_0x2f1299){var _0x18a361={};var _0x4dea46={'count':0x0,'rows':[]};var _0x1345a9=_[_0x282d('0x23')](db[_0x282d('0x24')][_0x282d('0x25')],function(_0x38df7a){return{'name':_0x38df7a[_0x282d('0x26')],'type':_0x38df7a['type'][_0x282d('0x27')]};});_0x18a361=qs[_0x282d('0x28')](_0x1345a9,_0x451af5);var _0xf4fd84={'where':_0x18a361[_0x282d('0x29')]};return db[_0x282d('0x24')]['count'](_0xf4fd84)[_0x282d('0x19')](function(_0x49cb19){_0x4dea46[_0x282d('0x15')]=_0x49cb19;_0x18a361[_0x282d('0x2a')]=qs[_0x282d('0x2a')](_0x451af5['query']);return db[_0x282d('0x24')][_0x282d('0x2b')](_0x18a361);})['then'](function(_0xeb5b6e){_0x4dea46[_0x282d('0x2c')]=_0xeb5b6e;return _0x4dea46;})[_0x282d('0x19')](respondWithFilteredResult(_0x2f1299,_0x18a361))[_0x282d('0x2d')](handleError(_0x2f1299,null));};exports['show']=function(_0x112d7e,_0x205772){var _0x52973b={'raw':!![],'where':{'id':_0x112d7e[_0x282d('0x2e')]['id']}},_0x4d4680={};_0x4d4680[_0x282d('0x2f')]=_[_0x282d('0x30')](db[_0x282d('0x24')]['rawAttributes']);_0x4d4680[_0x282d('0x31')]=_[_0x282d('0x30')](_0x112d7e['query']);_0x4d4680[_0x282d('0x32')]=_[_0x282d('0x33')](_0x4d4680[_0x282d('0x2f')],_0x4d4680[_0x282d('0x31')]);_0x52973b['attributes']=_[_0x282d('0x33')](_0x4d4680[_0x282d('0x2f')],qs['fields'](_0x112d7e[_0x282d('0x31')][_0x282d('0x34')]));_0x52973b[_0x282d('0x35')]=_0x52973b[_0x282d('0x35')][_0x282d('0x36')]?_0x52973b[_0x282d('0x35')]:_0x4d4680[_0x282d('0x2f')];if(_0x112d7e[_0x282d('0x31')]['includeAll']){_0x52973b['include']=[{'all':!![]}];}_0x52973b=_[_0x282d('0x37')]({},_0x52973b,_0x112d7e[_0x282d('0x38')]);return db[_0x282d('0x24')][_0x282d('0x39')](_0x52973b)[_0x282d('0x19')](handleEntityNotFound(_0x205772,null))[_0x282d('0x19')](respondWithResult(_0x205772,null))['catch'](handleError(_0x205772,null));};exports[_0x282d('0x3a')]=function(_0x3db40a,_0x131706){return db[_0x282d('0x24')][_0x282d('0x3a')](_0x3db40a[_0x282d('0x3b')],{})['then'](function(_0x2ef781){var _0x2c1f25=_0x3db40a[_0x282d('0x3c')][_0x282d('0x1a')]({'plain':!![]});if(!_0x2c1f25)throw new Error(_0x282d('0x3d'));if(_0x2c1f25[_0x282d('0x3e')]===_0x282d('0x3c')){var _0x5170bd=_0x2ef781[_0x282d('0x1a')]({'plain':!![]});var _0x482840=_0x282d('0x1b');return db[_0x282d('0x3f')][_0x282d('0x39')]({'where':{'name':_0x482840,'userProfileId':_0x2c1f25[_0x282d('0x40')]},'raw':!![]})[_0x282d('0x19')](function(_0x5108a5){if(_0x5108a5&&_0x5108a5[_0x282d('0x41')]===0x0){return db['UserProfileResource']['create']({'name':_0x5170bd[_0x282d('0x20')],'resourceId':_0x5170bd['id'],'type':_0x5108a5[_0x282d('0x20')],'sectionId':_0x5108a5['id']},{})[_0x282d('0x19')](function(){return _0x2ef781;});}else{return _0x2ef781;}})[_0x282d('0x2d')](function(_0x38f18d){logger[_0x282d('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x38f18d);throw _0x38f18d;});}return _0x2ef781;})[_0x282d('0x19')](respondWithResult(_0x131706,0xc9))[_0x282d('0x2d')](handleError(_0x131706,null));};exports[_0x282d('0x18')]=function(_0xf355bc,_0x190315){if(_0xf355bc[_0x282d('0x3b')]['id']){delete _0xf355bc['body']['id'];}return db[_0x282d('0x24')]['find']({'where':{'id':_0xf355bc['params']['id']}})['then'](handleEntityNotFound(_0x190315,null))[_0x282d('0x19')](saveUpdates(_0xf355bc[_0x282d('0x3b')],null))[_0x282d('0x19')](respondWithResult(_0x190315,null))[_0x282d('0x2d')](handleError(_0x190315,null));};exports[_0x282d('0x1d')]=function(_0x24bca8,_0x56831b){return db[_0x282d('0x24')][_0x282d('0x39')]({'where':{'id':_0x24bca8[_0x282d('0x2e')]['id']}})[_0x282d('0x19')](handleEntityNotFound(_0x56831b,null))[_0x282d('0x19')](removeEntity(_0x56831b,null))['catch'](handleError(_0x56831b,null));};exports['describe']=function(_0x2c8557,_0x404e67){return db[_0x282d('0x24')][_0x282d('0x42')]()['then'](respondWithResult(_0x404e67,null))['catch'](handleError(_0x404e67,null));};exports['getMembers']=function(_0x5e08ba,_0x39624d){var _0x5db352={'raw':!![],'where':{}},_0x4be135={},_0x1e7e9a;return db[_0x282d('0x24')][_0x282d('0x43')]({'where':{'id':_0x5e08ba[_0x282d('0x2e')]['id']}})['then'](handleEntityNotFound(_0x39624d,null))[_0x282d('0x19')](function(_0x440d65){if(_0x440d65){_0x1e7e9a=_0x440d65[_0x282d('0x1a')]({'plain':!![]});_0x4be135[_0x282d('0x2f')]=_[_0x282d('0x30')](db[_0x282d('0x44')][_0x282d('0x25')]);_0x4be135['query']=_[_0x282d('0x30')](_0x5e08ba[_0x282d('0x31')]);_0x4be135[_0x282d('0x32')]=_[_0x282d('0x33')](_0x4be135[_0x282d('0x2f')],_0x4be135[_0x282d('0x31')]);_0x5db352['attributes']=_[_0x282d('0x33')](_0x4be135['model'],qs[_0x282d('0x34')](_0x5e08ba['query'][_0x282d('0x34')]));_0x5db352[_0x282d('0x35')]=_0x5db352[_0x282d('0x35')][_0x282d('0x36')]?_0x5db352[_0x282d('0x35')]:_0x4be135['model'];if(!_0x5e08ba[_0x282d('0x31')][_0x282d('0x45')](_0x282d('0x46'))){_0x5db352[_0x282d('0x14')]=qs[_0x282d('0x14')](_0x5e08ba['query'][_0x282d('0x14')]);_0x5db352[_0x282d('0x12')]=qs[_0x282d('0x12')](_0x5e08ba['query'][_0x282d('0x12')]);}_0x5db352[_0x282d('0x47')]=qs[_0x282d('0x48')](_0x5e08ba[_0x282d('0x31')][_0x282d('0x48')]);_0x5db352[_0x282d('0x29')]=qs[_0x282d('0x32')](_[_0x282d('0x49')](_0x5e08ba[_0x282d('0x31')],_0x4be135[_0x282d('0x32')]));_0x5db352[_0x282d('0x29')]['MailQueueId']=_0x440d65['id'];if(_0x5e08ba[_0x282d('0x31')][_0x282d('0x4a')]){_0x5db352[_0x282d('0x29')]=_[_0x282d('0x37')](_0x5db352[_0x282d('0x29')],{'$or':_[_0x282d('0x23')](_0x5db352[_0x282d('0x35')],function(_0x12601f){var _0x3f211f={};_0x3f211f[_0x12601f]={'$like':'%'+_0x5e08ba['query']['filter']+'%'};return _0x3f211f;})});}_0x5db352=_['merge']({},_0x5db352,_0x5e08ba[_0x282d('0x38')]);return db['UserMailQueue']['findAll'](_0x5db352);}})[_0x282d('0x19')](function(_0x1eb164){if(_0x1eb164){return db[_0x282d('0x4b')][_0x282d('0x4c')]({'where':{'id':_[_0x282d('0x23')](_0x1eb164,_0x282d('0x4d')),'role':_0x282d('0x4e')},'attributes':['id',_0x282d('0x20'),_0x282d('0x4f'),_0x282d('0x50'),'createdAt']});}})[_0x282d('0x19')](function(_0x4da7c){if(_0x4da7c){return{'count':_0x4da7c[_0x282d('0x15')],'rows':_[_0x282d('0x23')](_0x4da7c[_0x282d('0x2c')],function(_0x11f421){return{'membername':_0x11f421[_0x282d('0x20')],'UserId':_0x11f421['id'],'queue_name':_0x1e7e9a[_0x282d('0x20')],'MailQueueId':_0x1e7e9a['id'],'interface':util[_0x282d('0x51')](_0x282d('0x52'),_0x282d('0x53'),_0x11f421['name']),'penalty':0x0,'paused':_0x11f421[_0x282d('0x4f')],'createdAt':_0x11f421['createdAt'],'updatedAt':_0x11f421[_0x282d('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x39624d,_0x5db352))[_0x282d('0x2d')](handleError(_0x39624d,null));};exports[_0x282d('0x54')]=function(_0x5ce73e,_0x33bbcc){var _0x24722f={};var _0x58cec4={};var _0x177bab;var _0x35251c;return db['MailQueue'][_0x282d('0x43')]({'where':{'id':_0x5ce73e[_0x282d('0x2e')]['id']}})[_0x282d('0x19')](handleEntityNotFound(_0x33bbcc,null))[_0x282d('0x19')](function(_0x15268a){if(_0x15268a){_0x177bab=_0x15268a;_0x58cec4[_0x282d('0x2f')]=_[_0x282d('0x30')](db[_0x282d('0x55')][_0x282d('0x25')]);_0x58cec4[_0x282d('0x31')]=_[_0x282d('0x30')](_0x5ce73e[_0x282d('0x31')]);_0x58cec4[_0x282d('0x32')]=_[_0x282d('0x33')](_0x58cec4[_0x282d('0x2f')],_0x58cec4['query']);_0x24722f[_0x282d('0x35')]=_[_0x282d('0x33')](_0x58cec4['model'],qs[_0x282d('0x34')](_0x5ce73e[_0x282d('0x31')]['fields']));_0x24722f[_0x282d('0x35')]=_0x24722f['attributes'][_0x282d('0x36')]?_0x24722f['attributes']:_0x58cec4['model'];_0x24722f[_0x282d('0x47')]=qs[_0x282d('0x48')](_0x5ce73e[_0x282d('0x31')][_0x282d('0x48')]);_0x24722f[_0x282d('0x29')]=qs[_0x282d('0x32')](_['pick'](_0x5ce73e[_0x282d('0x31')],_0x58cec4[_0x282d('0x32')]));if(_0x5ce73e['query'][_0x282d('0x4a')]){_0x24722f[_0x282d('0x29')]=_['merge'](_0x24722f[_0x282d('0x29')],{'$or':_[_0x282d('0x23')](_0x24722f['attributes'],function(_0x1b1d94){var _0x4e8ab4={};_0x4e8ab4[_0x1b1d94]={'$like':'%'+_0x5ce73e[_0x282d('0x31')][_0x282d('0x4a')]+'%'};return _0x4e8ab4;})});}_0x24722f=_['merge']({},_0x24722f,_0x5ce73e[_0x282d('0x38')]);return _0x177bab[_0x282d('0x54')](_0x24722f);}})[_0x282d('0x19')](function(_0x12ca06){if(_0x12ca06){_0x35251c=_0x12ca06[_0x282d('0x36')];if(!_0x5ce73e[_0x282d('0x31')]['hasOwnProperty'](_0x282d('0x46'))){_0x24722f[_0x282d('0x14')]=qs[_0x282d('0x14')](_0x5ce73e['query'][_0x282d('0x14')]);_0x24722f['offset']=qs[_0x282d('0x12')](_0x5ce73e[_0x282d('0x31')][_0x282d('0x12')]);}return _0x177bab[_0x282d('0x54')](_0x24722f);}})[_0x282d('0x19')](function(_0x467c1f){if(_0x467c1f){return _0x467c1f?{'count':_0x35251c,'rows':_0x467c1f}:null;}})[_0x282d('0x19')](respondWithResult(_0x33bbcc,null))[_0x282d('0x2d')](handleError(_0x33bbcc,null));};exports[_0x282d('0x56')]=function(_0x282fe3,_0x178ddf){var _0x39a8dd=_0x282fe3[_0x282d('0x3b')][_0x282d('0x57')];return db[_0x282d('0x55')][_0x282d('0x2b')]({'where':{'id':_0x39a8dd},'attributes':['id'],'include':[{'model':db[_0x282d('0x4b')],'as':_0x282d('0x58'),'attributes':['id','name',_0x282d('0x59'),_0x282d('0x5a'),_0x282d('0x5b')],'raw':!![]}]})[_0x282d('0x19')](function(_0x419f13){if(_0x419f13){var _0x42c301=_['flatMap'](_0x419f13,function(_0x10938f){var _0x34c21a=_0x10938f[_0x282d('0x1a')]({'plain':!![]});return _0x34c21a[_0x282d('0x58')];});return db[_0x282d('0x24')][_0x282d('0x39')]({'where':{'id':_0x282fe3['params']['id']}})[_0x282d('0x19')](function(_0xd02ce7){return db[_0x282d('0x5c')]['transaction'](function(_0x4eee7e){return _0xd02ce7['addTeams'](_0x39a8dd,{'transaction':_0x4eee7e})[_0x282d('0x19')](function(){return BPromise[_0x282d('0x5d')](_0x42c301,function(_0x1de5ef){return db[_0x282d('0x44')][_0x282d('0x5e')]({'where':{'UserId':_0x1de5ef['id'],'MailQueueId':_0x282fe3[_0x282d('0x2e')]['id']},'transaction':_0x4eee7e});});})['then'](function(){_0x42c301[_0x282d('0x5f')](function(_0x42617e){socket[_0x282d('0x60')](_0x282d('0x61'),{'UserId':_0x42617e['id'],'MailQueueId':_0xd02ce7['id']});});});});});}})[_0x282d('0x19')](respondWithStatusCode(_0x178ddf,null))[_0x282d('0x2d')](handleError(_0x178ddf,null));};exports[_0x282d('0x62')]=function(_0x474f24,_0x262e19){return db[_0x282d('0x55')][_0x282d('0x2b')]({'where':{'id':_0x474f24[_0x282d('0x31')][_0x282d('0x57')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x282d('0x19')](handleEntityNotFound(_0x262e19,null))[_0x282d('0x19')](function(_0x337ea0){var _0x31f1b6=_[_0x282d('0x23')](_0x337ea0,'id');var _0x469961=[];var _0x5a5864=[];var _0x4cdf25=squel[_0x282d('0x63')]();_0x4cdf25[_0x282d('0x64')]('tq.TeamId')[_0x282d('0x65')](_0x282d('0x66'),'tq')[_0x282d('0x67')](_0x282d('0x68'),'ut',_0x282d('0x69'))['where'](_0x282d('0x6a'),_0x474f24['params']['id']);for(var _0x470610=0x0;_0x470610<_0x337ea0[_0x282d('0x36')];_0x470610+=0x1){let _0x1ac4f4=_0x337ea0[_0x470610];for(var _0x2c3649=0x0;_0x2c3649<_0x1ac4f4[_0x282d('0x58')][_0x282d('0x36')];_0x2c3649+=0x1){let _0xd7528d=_0x1ac4f4['Agents'][_0x2c3649];var _0x1b4a20=_0x4cdf25[_0x282d('0x6b')]();_0x1b4a20['where'](_0x282d('0x6c'),_0xd7528d['id']);_0x5a5864[_0x282d('0x6d')](db[_0x282d('0x5c')][_0x282d('0x31')](_0x1b4a20[_0x282d('0x6e')](),{'type':db[_0x282d('0x5c')][_0x282d('0x6f')][_0x282d('0x70')]})[_0x282d('0x19')](function(_0x108fe0){if(_0x108fe0[_0x282d('0x36')]===0x1){return _0xd7528d['id'];}else{var _0x218aa5=_[_0x282d('0x71')](_[_0x282d('0x23')](_0x108fe0,_0x282d('0x72')),function(_0x21eb07){return _['includes'](_0x31f1b6,_0x21eb07);});if(_0x218aa5){return _0xd7528d['id'];}}}));}}return BPromise['all'](_0x5a5864)[_0x282d('0x19')](function(_0x2dbc82){_0x469961=_(_0x469961)[_0x282d('0x73')](_0x2dbc82)[_0x282d('0x74')]()[_0x282d('0x75')]();return db['MailQueue'][_0x282d('0x39')]({'where':{'id':_0x474f24[_0x282d('0x2e')]['id']}})[_0x282d('0x19')](function(_0x11e4a3){return db['sequelize'][_0x282d('0x76')](function(_0x5aa63c){return _0x11e4a3[_0x282d('0x62')](_0x474f24[_0x282d('0x31')][_0x282d('0x57')],{'transaction':_0x5aa63c})[_0x282d('0x19')](function(){if(!_[_0x282d('0x77')](_0x469961)){return _0x11e4a3[_0x282d('0x78')](_0x469961,{'transaction':_0x5aa63c});}})[_0x282d('0x19')](function(){_0x469961[_0x282d('0x5f')](function(_0x6403e3){socket[_0x282d('0x60')](_0x282d('0x79'),{'UserId':_0x6403e3,'MailQueueId':_0x11e4a3['id']});});});});});});})['then'](respondWithStatusCode(_0x262e19,null))[_0x282d('0x2d')](handleError(_0x262e19,null));};exports[_0x282d('0x7a')]=function(_0xccf0af,_0x29fc61){return db[_0x282d('0x24')][_0x282d('0x39')]({'where':{'id':_0xccf0af[_0x282d('0x2e')]['id']}})[_0x282d('0x19')](handleEntityNotFound(_0x29fc61,null))[_0x282d('0x19')](function(_0x11c120){if(_0x11c120){return _0x11c120[_0x282d('0x7a')](_0xccf0af[_0x282d('0x3b')][_0x282d('0x57')],_[_0x282d('0x7b')](_0xccf0af['body'],[_0x282d('0x57'),'id'])||{})[_0x282d('0x7c')](function(_0x120d61){for(var _0x50d584=0x0;_0x50d584<_0xccf0af['body']['ids'][_0x282d('0x36')];_0x50d584+=0x1){socket['emit'](_0x282d('0x61'),{'UserId':Number(_0xccf0af[_0x282d('0x3b')]['ids'][_0x50d584]),'MailQueueId':Number(_0xccf0af[_0x282d('0x2e')]['id'])});}return _0x120d61;});}})[_0x282d('0x19')](respondWithResult(_0x29fc61,null))[_0x282d('0x2d')](handleError(_0x29fc61,null));};exports[_0x282d('0x78')]=function(_0x49ab8e,_0x38f94a){return db[_0x282d('0x24')]['find']({'where':{'id':_0x49ab8e['params']['id']}})[_0x282d('0x19')](handleEntityNotFound(_0x38f94a,null))['then'](function(_0x295cd9){if(_0x295cd9){return _0x295cd9['removeAgents'](_0x49ab8e[_0x282d('0x31')][_0x282d('0x57')])[_0x282d('0x19')](function(){if(_[_0x282d('0x7d')](_0x49ab8e['query'][_0x282d('0x57')])){for(var _0x2249a7=0x0;_0x2249a7<_0x49ab8e[_0x282d('0x31')][_0x282d('0x57')]['length'];_0x2249a7+=0x1){socket[_0x282d('0x60')](_0x282d('0x79'),{'UserId':Number(_0x49ab8e[_0x282d('0x31')][_0x282d('0x57')][_0x2249a7]),'MailQueueId':Number(_0x49ab8e[_0x282d('0x2e')]['id'])});}}else{socket['emit']('userMailQueue:remove',{'UserId':Number(_0x49ab8e[_0x282d('0x31')][_0x282d('0x57')]),'MailQueueId':Number(_0x49ab8e[_0x282d('0x2e')]['id'])});}});}})[_0x282d('0x19')](respondWithStatusCode(_0x38f94a,null))[_0x282d('0x2d')](handleError(_0x38f94a,null));};exports[_0x282d('0x7e')]=function(_0xba69f4,_0x51cd9e){var _0x5ef49f={};var _0xce362e={};var _0x4f483c;var _0x25748a;return db[_0x282d('0x24')][_0x282d('0x43')]({'where':{'id':_0xba69f4['params']['id']}})['then'](handleEntityNotFound(_0x51cd9e,null))[_0x282d('0x19')](function(_0xe54d20){if(_0xe54d20){_0x4f483c=_0xe54d20;_0xce362e[_0x282d('0x2f')]=_[_0x282d('0x30')](db[_0x282d('0x4b')][_0x282d('0x25')]);_0xce362e['query']=_[_0x282d('0x30')](_0xba69f4[_0x282d('0x31')]);_0xce362e['filters']=_[_0x282d('0x33')](_0xce362e[_0x282d('0x2f')],_0xce362e[_0x282d('0x31')]);_0x5ef49f[_0x282d('0x35')]=_[_0x282d('0x33')](_0xce362e[_0x282d('0x2f')],qs[_0x282d('0x34')](_0xba69f4[_0x282d('0x31')][_0x282d('0x34')]));_0x5ef49f[_0x282d('0x35')]=_0x5ef49f[_0x282d('0x35')]['length']?_0x5ef49f[_0x282d('0x35')]:_0xce362e['model'];_0x5ef49f['order']=qs[_0x282d('0x48')](_0xba69f4[_0x282d('0x31')]['sort']);_0x5ef49f['where']=qs[_0x282d('0x32')](_[_0x282d('0x49')](_0xba69f4['query'],_0xce362e[_0x282d('0x32')]));if(_0xba69f4['query']['filter']){_0x5ef49f[_0x282d('0x29')]=_[_0x282d('0x37')](_0x5ef49f[_0x282d('0x29')],{'$or':_[_0x282d('0x23')](_0x5ef49f['attributes'],function(_0x37d638){var _0x563bed={};_0x563bed[_0x37d638]={'$like':'%'+_0xba69f4[_0x282d('0x31')][_0x282d('0x4a')]+'%'};return _0x563bed;})});}_0x5ef49f=_['merge']({},_0x5ef49f,_0xba69f4['options']);return _0x4f483c['getAgents'](_0x5ef49f);}})['then'](function(_0x322db7){if(_0x322db7){_0x25748a=_0x322db7['length'];if(!_0xba69f4[_0x282d('0x31')][_0x282d('0x45')]('nolimit')){_0x5ef49f[_0x282d('0x14')]=qs['limit'](_0xba69f4[_0x282d('0x31')][_0x282d('0x14')]);_0x5ef49f[_0x282d('0x12')]=qs[_0x282d('0x12')](_0xba69f4['query']['offset']);}return _0x4f483c[_0x282d('0x7e')](_0x5ef49f);}})[_0x282d('0x19')](function(_0x3ba114){if(_0x3ba114){return _0x3ba114?{'count':_0x25748a,'rows':_0x3ba114}:null;}})[_0x282d('0x19')](respondWithResult(_0x51cd9e,null))[_0x282d('0x2d')](handleError(_0x51cd9e,null));}; \ No newline at end of file +var _0x24f2=['userMailQueue:save','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','redis','defaults','localhost','./mailQueue.socket','register','sendStatus','status','json','offset','limit','count','Content-Range','update','then','destroy','get','MailQueues','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','getOptions','where','MailQueue','include','query','rows','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','options','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','getMembers','findOne','hasOwnProperty','nolimit','pick','MailQueueId','merge','filter','UserMailQueue','findAll','UserId','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','order','sort','addTeams','User','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','emit','removeTeams','ids','select','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','map','TeamId','includes','union','compact','isEmpty','removeAgents','forEach','userMailQueue:remove','addAgents','omit','spread'];(function(_0x37941e,_0x101a10){var _0x5d1984=function(_0x415d87){while(--_0x415d87){_0x37941e['push'](_0x37941e['shift']());}};_0x5d1984(++_0x101a10);}(_0x24f2,0xff));var _0x224f=function(_0x4e5552,_0x19ec4e){_0x4e5552=_0x4e5552-0x0;var _0x60a338=_0x24f2[_0x4e5552];return _0x60a338;};'use strict';var BPromise=require(_0x224f('0x0'));var util=require(_0x224f('0x1'));var _=require(_0x224f('0x2'));var squel=require(_0x224f('0x3'));var Redis=require(_0x224f('0x4'));var qs=require(_0x224f('0x5'));var logger=require('../../config/logger')(_0x224f('0x6'));var config=require(_0x224f('0x7'));var db=require('../../mysqldb')['db'];config[_0x224f('0x8')]=_[_0x224f('0x9')](config[_0x224f('0x8')],{'host':_0x224f('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x224f('0x8')]));require(_0x224f('0xb'))[_0x224f('0xc')](socket);function respondWithStatusCode(_0x129607,_0x130ab4){_0x130ab4=_0x130ab4||0xcc;return function(_0x23cf7f){if(_0x23cf7f){return _0x129607[_0x224f('0xd')](_0x130ab4);}return _0x129607[_0x224f('0xe')](_0x130ab4)['end']();};}function respondWithResult(_0x4a3420,_0xb88320){_0xb88320=_0xb88320||0xc8;return function(_0x187818){if(_0x187818){return _0x4a3420[_0x224f('0xe')](_0xb88320)[_0x224f('0xf')](_0x187818);}};}function respondWithFilteredResult(_0x3dd3a4,_0x266979){return function(_0x561560){if(_0x561560){var _0x3ae612=typeof _0x266979[_0x224f('0x10')]==='undefined'&&typeof _0x266979[_0x224f('0x11')]==='undefined';var _0x7f98f6=_0x561560[_0x224f('0x12')];var _0x37946f=_0x3ae612?0x0:_0x266979['offset'];var _0x170557=_0x3ae612?_0x561560[_0x224f('0x12')]:_0x266979[_0x224f('0x10')]+_0x266979[_0x224f('0x11')];var _0x2f20dd;if(_0x170557>=_0x7f98f6){_0x170557=_0x7f98f6;_0x2f20dd=0xc8;}else{_0x2f20dd=0xce;}_0x3dd3a4[_0x224f('0xe')](_0x2f20dd);return _0x3dd3a4['set'](_0x224f('0x13'),_0x37946f+'-'+_0x170557+'/'+_0x7f98f6)[_0x224f('0xf')](_0x561560);}return null;};}function saveUpdates(_0x48b87b){return function(_0x1fc764){if(_0x1fc764){return _0x1fc764[_0x224f('0x14')](_0x48b87b)[_0x224f('0x15')](function(_0x621064){return _0x621064;});}return null;};}function removeEntity(_0x4c7103){return function(_0x160891){if(_0x160891){return _0x160891[_0x224f('0x16')]()[_0x224f('0x15')](function(){var _0x3f25cf=_0x160891[_0x224f('0x17')]({'plain':!![]});var _0x3c34db=_0x224f('0x18');return db['UserProfileResource'][_0x224f('0x16')]({'where':{'type':_0x3c34db,'resourceId':_0x3f25cf['id']}})[_0x224f('0x15')](function(){return _0x160891;});})[_0x224f('0x15')](function(){_0x4c7103[_0x224f('0xe')](0xcc)[_0x224f('0x19')]();});}};}function handleEntityNotFound(_0x36f5e3){return function(_0x5e9d7d){if(!_0x5e9d7d){_0x36f5e3[_0x224f('0xd')](0x194);}return _0x5e9d7d;};}function handleError(_0x258733,_0x3e2f14){_0x3e2f14=_0x3e2f14||0x1f4;return function(_0x24cbe6){logger[_0x224f('0x1a')](_0x24cbe6[_0x224f('0x1b')]);if(_0x24cbe6[_0x224f('0x1c')]){delete _0x24cbe6[_0x224f('0x1c')];}_0x258733[_0x224f('0xe')](_0x3e2f14)[_0x224f('0x1d')](_0x24cbe6);};}exports[_0x224f('0x1e')]=function(_0x50f255,_0x3fc3bb){var _0x1774f8={};var _0x10030a={'count':0x0,'rows':[]};var _0x58342f=_['map'](db['MailQueue'][_0x224f('0x1f')],function(_0xf0acd7){return{'name':_0xf0acd7[_0x224f('0x20')],'type':_0xf0acd7[_0x224f('0x21')][_0x224f('0x22')]};});_0x1774f8=qs[_0x224f('0x23')](_0x58342f,_0x50f255);var _0x15ae8d={'where':_0x1774f8[_0x224f('0x24')]};return db[_0x224f('0x25')]['count'](_0x15ae8d)[_0x224f('0x15')](function(_0xf1e937){_0x10030a[_0x224f('0x12')]=_0xf1e937;_0x1774f8[_0x224f('0x26')]=qs[_0x224f('0x26')](_0x50f255[_0x224f('0x27')]);return db[_0x224f('0x25')]['findAll'](_0x1774f8);})[_0x224f('0x15')](function(_0xbd56ff){_0x10030a[_0x224f('0x28')]=_0xbd56ff;return _0x10030a;})['then'](respondWithFilteredResult(_0x3fc3bb,_0x1774f8))[_0x224f('0x29')](handleError(_0x3fc3bb,null));};exports[_0x224f('0x2a')]=function(_0x5213aa,_0x3b7cb9){var _0x60a8fe={'raw':!![],'where':{'id':_0x5213aa[_0x224f('0x2b')]['id']}},_0x374f69={};_0x374f69[_0x224f('0x2c')]=_[_0x224f('0x2d')](db[_0x224f('0x25')]['rawAttributes']);_0x374f69['query']=_[_0x224f('0x2d')](_0x5213aa[_0x224f('0x27')]);_0x374f69[_0x224f('0x2e')]=_[_0x224f('0x2f')](_0x374f69['model'],_0x374f69[_0x224f('0x27')]);_0x60a8fe[_0x224f('0x30')]=_[_0x224f('0x2f')](_0x374f69[_0x224f('0x2c')],qs[_0x224f('0x31')](_0x5213aa[_0x224f('0x27')][_0x224f('0x31')]));_0x60a8fe[_0x224f('0x30')]=_0x60a8fe['attributes'][_0x224f('0x32')]?_0x60a8fe[_0x224f('0x30')]:_0x374f69[_0x224f('0x2c')];if(_0x5213aa['query'][_0x224f('0x33')]){_0x60a8fe[_0x224f('0x26')]=[{'all':!![]}];}_0x60a8fe=_['merge']({},_0x60a8fe,_0x5213aa[_0x224f('0x34')]);return db[_0x224f('0x25')]['find'](_0x60a8fe)['then'](handleEntityNotFound(_0x3b7cb9,null))['then'](respondWithResult(_0x3b7cb9,null))[_0x224f('0x29')](handleError(_0x3b7cb9,null));};exports['create']=function(_0x51be07,_0x55fd31){return db[_0x224f('0x25')]['create'](_0x51be07[_0x224f('0x35')],{})['then'](function(_0x9bb54f){var _0x3e0d28=_0x51be07[_0x224f('0x36')][_0x224f('0x17')]({'plain':!![]});if(!_0x3e0d28)throw new Error(_0x224f('0x37'));if(_0x3e0d28['role']==='user'){var _0x2ebd92=_0x9bb54f['get']({'plain':!![]});var _0x4a0ea4='MailQueues';return db[_0x224f('0x38')]['find']({'where':{'name':_0x4a0ea4,'userProfileId':_0x3e0d28[_0x224f('0x39')]},'raw':!![]})[_0x224f('0x15')](function(_0x14a81d){if(_0x14a81d&&_0x14a81d[_0x224f('0x3a')]===0x0){return db['UserProfileResource'][_0x224f('0x3b')]({'name':_0x2ebd92[_0x224f('0x1c')],'resourceId':_0x2ebd92['id'],'type':_0x14a81d['name'],'sectionId':_0x14a81d['id']},{})['then'](function(){return _0x9bb54f;});}else{return _0x9bb54f;}})['catch'](function(_0x3e3e89){logger[_0x224f('0x1a')](_0x224f('0x3c'),_0x3e3e89);throw _0x3e3e89;});}return _0x9bb54f;})['then'](respondWithResult(_0x55fd31,0xc9))['catch'](handleError(_0x55fd31,null));};exports[_0x224f('0x14')]=function(_0xd609d3,_0x4105a6){if(_0xd609d3['body']['id']){delete _0xd609d3[_0x224f('0x35')]['id'];}return db[_0x224f('0x25')][_0x224f('0x3d')]({'where':{'id':_0xd609d3[_0x224f('0x2b')]['id']}})['then'](handleEntityNotFound(_0x4105a6,null))['then'](saveUpdates(_0xd609d3[_0x224f('0x35')],null))[_0x224f('0x15')](respondWithResult(_0x4105a6,null))[_0x224f('0x29')](handleError(_0x4105a6,null));};exports[_0x224f('0x16')]=function(_0x57c7f1,_0x506b24){return db[_0x224f('0x25')][_0x224f('0x3d')]({'where':{'id':_0x57c7f1[_0x224f('0x2b')]['id']}})[_0x224f('0x15')](handleEntityNotFound(_0x506b24,null))['then'](removeEntity(_0x506b24,null))[_0x224f('0x29')](handleError(_0x506b24,null));};exports['describe']=function(_0x5d43b8,_0xe1ce5c){return db[_0x224f('0x25')][_0x224f('0x3e')]()[_0x224f('0x15')](respondWithResult(_0xe1ce5c,null))[_0x224f('0x29')](handleError(_0xe1ce5c,null));};exports[_0x224f('0x3f')]=function(_0x1f68fd,_0xff9999){var _0x51c866={'raw':!![],'where':{}},_0x32ff62={},_0x19dd4d;return db[_0x224f('0x25')][_0x224f('0x40')]({'where':{'id':_0x1f68fd[_0x224f('0x2b')]['id']}})[_0x224f('0x15')](handleEntityNotFound(_0xff9999,null))[_0x224f('0x15')](function(_0x5df853){if(_0x5df853){_0x19dd4d=_0x5df853[_0x224f('0x17')]({'plain':!![]});_0x32ff62[_0x224f('0x2c')]=_[_0x224f('0x2d')](db['UserMailQueue'][_0x224f('0x1f')]);_0x32ff62[_0x224f('0x27')]=_[_0x224f('0x2d')](_0x1f68fd['query']);_0x32ff62[_0x224f('0x2e')]=_[_0x224f('0x2f')](_0x32ff62['model'],_0x32ff62[_0x224f('0x27')]);_0x51c866[_0x224f('0x30')]=_[_0x224f('0x2f')](_0x32ff62['model'],qs['fields'](_0x1f68fd[_0x224f('0x27')]['fields']));_0x51c866[_0x224f('0x30')]=_0x51c866[_0x224f('0x30')][_0x224f('0x32')]?_0x51c866[_0x224f('0x30')]:_0x32ff62[_0x224f('0x2c')];if(!_0x1f68fd[_0x224f('0x27')][_0x224f('0x41')](_0x224f('0x42'))){_0x51c866['limit']=qs[_0x224f('0x11')](_0x1f68fd[_0x224f('0x27')][_0x224f('0x11')]);_0x51c866[_0x224f('0x10')]=qs[_0x224f('0x10')](_0x1f68fd[_0x224f('0x27')]['offset']);}_0x51c866['order']=qs['sort'](_0x1f68fd[_0x224f('0x27')]['sort']);_0x51c866[_0x224f('0x24')]=qs[_0x224f('0x2e')](_[_0x224f('0x43')](_0x1f68fd[_0x224f('0x27')],_0x32ff62[_0x224f('0x2e')]));_0x51c866[_0x224f('0x24')][_0x224f('0x44')]=_0x5df853['id'];if(_0x1f68fd[_0x224f('0x27')]['filter']){_0x51c866[_0x224f('0x24')]=_[_0x224f('0x45')](_0x51c866[_0x224f('0x24')],{'$or':_['map'](_0x51c866[_0x224f('0x30')],function(_0xa8d3c9){var _0x954a2e={};_0x954a2e[_0xa8d3c9]={'$like':'%'+_0x1f68fd['query'][_0x224f('0x46')]+'%'};return _0x954a2e;})});}_0x51c866=_[_0x224f('0x45')]({},_0x51c866,_0x1f68fd[_0x224f('0x34')]);return db[_0x224f('0x47')][_0x224f('0x48')](_0x51c866);}})[_0x224f('0x15')](function(_0x29a8a1){if(_0x29a8a1){return db['User']['findAndCountAll']({'where':{'id':_['map'](_0x29a8a1,_0x224f('0x49')),'role':'agent'},'attributes':['id',_0x224f('0x1c'),_0x224f('0x4a'),_0x224f('0x4b'),_0x224f('0x4c')]});}})[_0x224f('0x15')](function(_0x1a0b3c){if(_0x1a0b3c){return{'count':_0x1a0b3c[_0x224f('0x12')],'rows':_['map'](_0x1a0b3c['rows'],function(_0x1a6715){return{'membername':_0x1a6715[_0x224f('0x1c')],'UserId':_0x1a6715['id'],'queue_name':_0x19dd4d['name'],'MailQueueId':_0x19dd4d['id'],'interface':util[_0x224f('0x4d')](_0x224f('0x4e'),_0x224f('0x4f'),_0x1a6715[_0x224f('0x1c')]),'penalty':0x0,'paused':_0x1a6715[_0x224f('0x4a')],'createdAt':_0x1a6715['createdAt'],'updatedAt':_0x1a6715[_0x224f('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x224f('0x15')](respondWithFilteredResult(_0xff9999,_0x51c866))[_0x224f('0x29')](handleError(_0xff9999,null));};exports[_0x224f('0x50')]=function(_0xb861b3,_0x250dbd){var _0x30928c={};var _0x3da326={};var _0x2edb41;var _0x2be8cd;return db[_0x224f('0x25')][_0x224f('0x40')]({'where':{'id':_0xb861b3['params']['id']}})[_0x224f('0x15')](handleEntityNotFound(_0x250dbd,null))[_0x224f('0x15')](function(_0x3d661c){if(_0x3d661c){_0x2edb41=_0x3d661c;_0x3da326['model']=_['keys'](db[_0x224f('0x51')]['rawAttributes']);_0x3da326[_0x224f('0x27')]=_[_0x224f('0x2d')](_0xb861b3[_0x224f('0x27')]);_0x3da326['filters']=_[_0x224f('0x2f')](_0x3da326['model'],_0x3da326[_0x224f('0x27')]);_0x30928c['attributes']=_[_0x224f('0x2f')](_0x3da326[_0x224f('0x2c')],qs['fields'](_0xb861b3[_0x224f('0x27')]['fields']));_0x30928c[_0x224f('0x30')]=_0x30928c[_0x224f('0x30')][_0x224f('0x32')]?_0x30928c[_0x224f('0x30')]:_0x3da326[_0x224f('0x2c')];_0x30928c[_0x224f('0x52')]=qs[_0x224f('0x53')](_0xb861b3[_0x224f('0x27')][_0x224f('0x53')]);_0x30928c[_0x224f('0x24')]=qs[_0x224f('0x2e')](_[_0x224f('0x43')](_0xb861b3['query'],_0x3da326[_0x224f('0x2e')]));if(_0xb861b3[_0x224f('0x27')][_0x224f('0x46')]){_0x30928c['where']=_[_0x224f('0x45')](_0x30928c['where'],{'$or':_['map'](_0x30928c['attributes'],function(_0x122652){var _0x53b680={};_0x53b680[_0x122652]={'$like':'%'+_0xb861b3['query'][_0x224f('0x46')]+'%'};return _0x53b680;})});}_0x30928c=_[_0x224f('0x45')]({},_0x30928c,_0xb861b3[_0x224f('0x34')]);return _0x2edb41[_0x224f('0x50')](_0x30928c);}})[_0x224f('0x15')](function(_0x2d31d9){if(_0x2d31d9){_0x2be8cd=_0x2d31d9[_0x224f('0x32')];if(!_0xb861b3[_0x224f('0x27')][_0x224f('0x41')]('nolimit')){_0x30928c[_0x224f('0x11')]=qs[_0x224f('0x11')](_0xb861b3[_0x224f('0x27')]['limit']);_0x30928c[_0x224f('0x10')]=qs['offset'](_0xb861b3['query'][_0x224f('0x10')]);}return _0x2edb41[_0x224f('0x50')](_0x30928c);}})['then'](function(_0x595801){if(_0x595801){return _0x595801?{'count':_0x2be8cd,'rows':_0x595801}:null;}})[_0x224f('0x15')](respondWithResult(_0x250dbd,null))[_0x224f('0x29')](handleError(_0x250dbd,null));};exports[_0x224f('0x54')]=function(_0x52192f,_0x276856){var _0x3bd1c3=_0x52192f['body']['ids'];return db['Team']['findAll']({'where':{'id':_0x3bd1c3},'attributes':['id'],'include':[{'model':db[_0x224f('0x55')],'as':_0x224f('0x56'),'attributes':['id',_0x224f('0x1c'),_0x224f('0x57'),_0x224f('0x58'),'interface'],'raw':!![]}]})['then'](function(_0x21b568){if(_0x21b568){var _0x86c89c=_[_0x224f('0x59')](_0x21b568,function(_0x472db4){var _0x1c7207=_0x472db4[_0x224f('0x17')]({'plain':!![]});return _0x1c7207[_0x224f('0x56')];});return db[_0x224f('0x25')][_0x224f('0x3d')]({'where':{'id':_0x52192f[_0x224f('0x2b')]['id']}})[_0x224f('0x15')](function(_0x3adf79){return db[_0x224f('0x5a')][_0x224f('0x5b')](function(_0x48cb85){return _0x3adf79[_0x224f('0x54')](_0x3bd1c3,{'transaction':_0x48cb85})[_0x224f('0x15')](function(){return BPromise[_0x224f('0x5c')](_0x86c89c,function(_0x155489){return db['UserMailQueue'][_0x224f('0x5d')]({'where':{'UserId':_0x155489['id'],'MailQueueId':_0x52192f[_0x224f('0x2b')]['id']},'transaction':_0x48cb85});});})[_0x224f('0x15')](function(){_0x86c89c['forEach'](function(_0x27d274){socket[_0x224f('0x5e')]('userMailQueue:save',{'UserId':_0x27d274['id'],'MailQueueId':_0x3adf79['id']});});});});});}})[_0x224f('0x15')](respondWithStatusCode(_0x276856,null))[_0x224f('0x29')](handleError(_0x276856,null));};exports[_0x224f('0x5f')]=function(_0x2f5eaf,_0x5492a6){return db[_0x224f('0x51')]['findAll']({'where':{'id':_0x2f5eaf['query'][_0x224f('0x60')]},'attributes':['id'],'include':[{'model':db[_0x224f('0x55')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x224f('0x15')](handleEntityNotFound(_0x5492a6,null))[_0x224f('0x15')](function(_0x25d834){var _0x42b642=_['map'](_0x25d834,'id');var _0x2b1ab7=[];var _0x311d05=[];var _0x451117=squel[_0x224f('0x61')]();_0x451117['field']('tq.TeamId')[_0x224f('0x62')](_0x224f('0x63'),'tq')[_0x224f('0x64')](_0x224f('0x65'),'ut',_0x224f('0x66'))[_0x224f('0x24')](_0x224f('0x67'),_0x2f5eaf['params']['id']);for(var _0x13896b=0x0;_0x13896b<_0x25d834[_0x224f('0x32')];_0x13896b+=0x1){let _0x4441d3=_0x25d834[_0x13896b];for(var _0x3048b3=0x0;_0x3048b3<_0x4441d3['Agents'][_0x224f('0x32')];_0x3048b3+=0x1){let _0x34cb39=_0x4441d3['Agents'][_0x3048b3];var _0x3f5856=_0x451117[_0x224f('0x68')]();_0x3f5856[_0x224f('0x24')](_0x224f('0x69'),_0x34cb39['id']);_0x311d05[_0x224f('0x6a')](db[_0x224f('0x5a')][_0x224f('0x27')](_0x3f5856[_0x224f('0x6b')](),{'type':db[_0x224f('0x5a')][_0x224f('0x6c')][_0x224f('0x6d')]})['then'](function(_0x1482a2){if(_0x1482a2[_0x224f('0x32')]===0x1){return _0x34cb39['id'];}else{var _0x11c994=_[_0x224f('0x6e')](_[_0x224f('0x6f')](_0x1482a2,_0x224f('0x70')),function(_0x149a11){return _[_0x224f('0x71')](_0x42b642,_0x149a11);});if(_0x11c994){return _0x34cb39['id'];}}}));}}return BPromise['all'](_0x311d05)[_0x224f('0x15')](function(_0x5e8911){_0x2b1ab7=_(_0x2b1ab7)[_0x224f('0x72')](_0x5e8911)[_0x224f('0x73')]()['value']();return db['MailQueue'][_0x224f('0x3d')]({'where':{'id':_0x2f5eaf[_0x224f('0x2b')]['id']}})[_0x224f('0x15')](function(_0x122988){return db['sequelize'][_0x224f('0x5b')](function(_0x1f40d5){return _0x122988[_0x224f('0x5f')](_0x2f5eaf[_0x224f('0x27')][_0x224f('0x60')],{'transaction':_0x1f40d5})[_0x224f('0x15')](function(){if(!_[_0x224f('0x74')](_0x2b1ab7)){return _0x122988[_0x224f('0x75')](_0x2b1ab7,{'transaction':_0x1f40d5});}})['then'](function(){_0x2b1ab7[_0x224f('0x76')](function(_0x1790a4){socket['emit'](_0x224f('0x77'),{'UserId':_0x1790a4,'MailQueueId':_0x122988['id']});});});});});});})[_0x224f('0x15')](respondWithStatusCode(_0x5492a6,null))[_0x224f('0x29')](handleError(_0x5492a6,null));};exports['addAgents']=function(_0xf5bd90,_0x1c3c9e){return db[_0x224f('0x25')][_0x224f('0x3d')]({'where':{'id':_0xf5bd90['params']['id']}})[_0x224f('0x15')](handleEntityNotFound(_0x1c3c9e,null))[_0x224f('0x15')](function(_0xda820){if(_0xda820){return _0xda820[_0x224f('0x78')](_0xf5bd90[_0x224f('0x35')][_0x224f('0x60')],_[_0x224f('0x79')](_0xf5bd90[_0x224f('0x35')],[_0x224f('0x60'),'id'])||{})[_0x224f('0x7a')](function(_0x209cdf){for(var _0x573ab5=0x0;_0x573ab5<_0xf5bd90[_0x224f('0x35')][_0x224f('0x60')][_0x224f('0x32')];_0x573ab5+=0x1){socket[_0x224f('0x5e')](_0x224f('0x7b'),{'UserId':Number(_0xf5bd90[_0x224f('0x35')]['ids'][_0x573ab5]),'MailQueueId':Number(_0xf5bd90[_0x224f('0x2b')]['id'])});}return _0x209cdf;});}})[_0x224f('0x15')](respondWithResult(_0x1c3c9e,null))[_0x224f('0x29')](handleError(_0x1c3c9e,null));};exports[_0x224f('0x75')]=function(_0x547aeb,_0x41a560){return db[_0x224f('0x25')]['find']({'where':{'id':_0x547aeb['params']['id']}})[_0x224f('0x15')](handleEntityNotFound(_0x41a560,null))[_0x224f('0x15')](function(_0x34d9fe){if(_0x34d9fe){return _0x34d9fe[_0x224f('0x75')](_0x547aeb[_0x224f('0x27')][_0x224f('0x60')])[_0x224f('0x15')](function(){if(_[_0x224f('0x7c')](_0x547aeb['query'][_0x224f('0x60')])){for(var _0x508420=0x0;_0x508420<_0x547aeb['query'][_0x224f('0x60')][_0x224f('0x32')];_0x508420+=0x1){socket[_0x224f('0x5e')](_0x224f('0x77'),{'UserId':Number(_0x547aeb[_0x224f('0x27')][_0x224f('0x60')][_0x508420]),'MailQueueId':Number(_0x547aeb[_0x224f('0x2b')]['id'])});}}else{socket['emit'](_0x224f('0x77'),{'UserId':Number(_0x547aeb[_0x224f('0x27')][_0x224f('0x60')]),'MailQueueId':Number(_0x547aeb[_0x224f('0x2b')]['id'])});}});}})['then'](respondWithStatusCode(_0x41a560,null))[_0x224f('0x29')](handleError(_0x41a560,null));};exports[_0x224f('0x7d')]=function(_0x34c1ce,_0x88e35c){var _0x5cfb3a={};var _0x3e8a21={};var _0x5c66b0;var _0x97138f;return db[_0x224f('0x25')]['findOne']({'where':{'id':_0x34c1ce[_0x224f('0x2b')]['id']}})[_0x224f('0x15')](handleEntityNotFound(_0x88e35c,null))['then'](function(_0x398b55){if(_0x398b55){_0x5c66b0=_0x398b55;_0x3e8a21[_0x224f('0x2c')]=_[_0x224f('0x2d')](db['User'][_0x224f('0x1f')]);_0x3e8a21[_0x224f('0x27')]=_[_0x224f('0x2d')](_0x34c1ce['query']);_0x3e8a21[_0x224f('0x2e')]=_[_0x224f('0x2f')](_0x3e8a21[_0x224f('0x2c')],_0x3e8a21[_0x224f('0x27')]);_0x5cfb3a['attributes']=_[_0x224f('0x2f')](_0x3e8a21[_0x224f('0x2c')],qs[_0x224f('0x31')](_0x34c1ce[_0x224f('0x27')]['fields']));_0x5cfb3a[_0x224f('0x30')]=_0x5cfb3a[_0x224f('0x30')][_0x224f('0x32')]?_0x5cfb3a['attributes']:_0x3e8a21[_0x224f('0x2c')];_0x5cfb3a['order']=qs['sort'](_0x34c1ce[_0x224f('0x27')][_0x224f('0x53')]);_0x5cfb3a[_0x224f('0x24')]=qs[_0x224f('0x2e')](_[_0x224f('0x43')](_0x34c1ce[_0x224f('0x27')],_0x3e8a21['filters']));if(_0x34c1ce[_0x224f('0x27')][_0x224f('0x46')]){_0x5cfb3a['where']=_[_0x224f('0x45')](_0x5cfb3a[_0x224f('0x24')],{'$or':_[_0x224f('0x6f')](_0x5cfb3a[_0x224f('0x30')],function(_0x51a98a){var _0x30675e={};_0x30675e[_0x51a98a]={'$like':'%'+_0x34c1ce[_0x224f('0x27')][_0x224f('0x46')]+'%'};return _0x30675e;})});}_0x5cfb3a=_[_0x224f('0x45')]({},_0x5cfb3a,_0x34c1ce[_0x224f('0x34')]);return _0x5c66b0[_0x224f('0x7d')](_0x5cfb3a);}})[_0x224f('0x15')](function(_0x237d07){if(_0x237d07){_0x97138f=_0x237d07['length'];if(!_0x34c1ce[_0x224f('0x27')]['hasOwnProperty'](_0x224f('0x42'))){_0x5cfb3a[_0x224f('0x11')]=qs[_0x224f('0x11')](_0x34c1ce['query']['limit']);_0x5cfb3a[_0x224f('0x10')]=qs[_0x224f('0x10')](_0x34c1ce[_0x224f('0x27')][_0x224f('0x10')]);}return _0x5c66b0[_0x224f('0x7d')](_0x5cfb3a);}})[_0x224f('0x15')](function(_0x35c071){if(_0x35c071){return _0x35c071?{'count':_0x97138f,'rows':_0x35c071}:null;}})[_0x224f('0x15')](respondWithResult(_0x88e35c,null))['catch'](handleError(_0x88e35c,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 9130683..ae8b384 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 _0x653e=['exports','events','../../mysqldb','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x407abe,_0x25cde9){var _0x3c3597=function(_0x527a92){while(--_0x527a92){_0x407abe['push'](_0x407abe['shift']());}};_0x3c3597(++_0x25cde9);}(_0x653e,0x7f));var _0xe653=function(_0x237da8,_0x37b77a){_0x237da8=_0x237da8-0x0;var _0x558825=_0x653e[_0x237da8];return _0x558825;};'use strict';var EventEmitter=require(_0xe653('0x0'));var MailQueue=require(_0xe653('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe653('0x2'),'afterUpdate':_0xe653('0x3'),'afterDestroy':_0xe653('0x4')};function emitEvent(_0x23be7f){return function(_0x47b7ef,_0x2e16cb,_0x3a0733){MailQueueEvents['emit'](_0x23be7f+':'+_0x47b7ef['id'],_0x47b7ef);MailQueueEvents[_0xe653('0x5')](_0x23be7f,_0x47b7ef);_0x3a0733(null);};}for(var e in events){if(events[_0xe653('0x6')](e)){var event=events[e];MailQueue[_0xe653('0x7')](e,emitEvent(event));}}module[_0xe653('0x8')]=MailQueueEvents; \ No newline at end of file +var _0x73e4=['hook','exports','events','../../mysqldb','MailQueue','setMaxListeners','save','remove','emit'];(function(_0xadc7a0,_0x175356){var _0x113f84=function(_0x3d5e76){while(--_0x3d5e76){_0xadc7a0['push'](_0xadc7a0['shift']());}};_0x113f84(++_0x175356);}(_0x73e4,0x1df));var _0x473e=function(_0x39ea42,_0x3c1f50){_0x39ea42=_0x39ea42-0x0;var _0x33f5b7=_0x73e4[_0x39ea42];return _0x33f5b7;};'use strict';var EventEmitter=require(_0x473e('0x0'));var MailQueue=require(_0x473e('0x1'))['db'][_0x473e('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x473e('0x3')](0x0);var events={'afterCreate':_0x473e('0x4'),'afterUpdate':'update','afterDestroy':_0x473e('0x5')};function emitEvent(_0x2c9a1c){return function(_0x2ddb37,_0x4b9bc4,_0x4e065e){MailQueueEvents['emit'](_0x2c9a1c+':'+_0x2ddb37['id'],_0x2ddb37);MailQueueEvents[_0x473e('0x6')](_0x2c9a1c,_0x2ddb37);_0x4e065e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x473e('0x7')](e,emitEvent(event));}}module[_0x473e('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index eb09129..86cd014 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 _0x635d=['define','MailQueue','mail_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailQueue.attributes','exports'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x635d,0x16f));var _0xd635=function(_0x24e509,_0x25db6a){_0x24e509=_0x24e509-0x0;var _0x414e34=_0x635d[_0x24e509];return _0x414e34;};'use strict';var _=require(_0xd635('0x0'));var util=require(_0xd635('0x1'));var logger=require(_0xd635('0x2'))(_0xd635('0x3'));var moment=require(_0xd635('0x4'));var BPromise=require(_0xd635('0x5'));var rp=require(_0xd635('0x6'));var fs=require('fs');var path=require(_0xd635('0x7'));var rimraf=require('rimraf');var config=require(_0xd635('0x8'));var attributes=require(_0xd635('0x9'));module[_0xd635('0xa')]=function(_0x528ec9,_0x4098e6){return _0x528ec9[_0xd635('0xb')](_0xd635('0xc'),attributes,{'tableName':_0xd635('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9095=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','exports','MailQueue','mail_queues'];(function(_0x4a4122,_0x3ddf94){var _0x22f915=function(_0x50fb5b){while(--_0x50fb5b){_0x4a4122['push'](_0x4a4122['shift']());}};_0x22f915(++_0x3ddf94);}(_0x9095,0x190));var _0x5909=function(_0x10f6e8,_0x351db6){_0x10f6e8=_0x10f6e8-0x0;var _0x35bb3c=_0x9095[_0x10f6e8];return _0x35bb3c;};'use strict';var _=require('lodash');var util=require(_0x5909('0x0'));var logger=require(_0x5909('0x1'))(_0x5909('0x2'));var moment=require('moment');var BPromise=require(_0x5909('0x3'));var rp=require(_0x5909('0x4'));var fs=require('fs');var path=require(_0x5909('0x5'));var rimraf=require(_0x5909('0x6'));var config=require('../../config/environment');var attributes=require('./mailQueue.attributes');module[_0x5909('0x7')]=function(_0x339416,_0x4b82f2){return _0x339416['define'](_0x5909('0x8'),attributes,{'tableName':_0x5909('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 32bf7a8..6f29a04 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 _0x3ab0=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','error','code','message','MailQueue,\x20%s,\x20%s','result','GetMailQueue','MailQueue','findAll','options','where','include','map','attributes','debug','catch','ShowMailQueue','find','raw','model','stringify','lodash','util','moment'];(function(_0x5ab905,_0x11c9e5){var _0x125804=function(_0x15e5d4){while(--_0x15e5d4){_0x5ab905['push'](_0x5ab905['shift']());}};_0x125804(++_0x11c9e5);}(_0x3ab0,0xa9));var _0x03ab=function(_0x56a866,_0x4729c4){_0x56a866=_0x56a866-0x0;var _0x1d71ed=_0x3ab0[_0x56a866];return _0x1d71ed;};'use strict';var _=require(_0x03ab('0x0'));var util=require(_0x03ab('0x1'));var moment=require(_0x03ab('0x2'));var BPromise=require('bluebird');var rs=require(_0x03ab('0x3'));var fs=require('fs');var Redis=require(_0x03ab('0x4'));var db=require(_0x03ab('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x03ab('0x6'))(_0x03ab('0x7'));var config=require(_0x03ab('0x8'));var jayson=require(_0x03ab('0x9'));var client=jayson[_0x03ab('0xa')][_0x03ab('0xb')]({'port':0x232a});config[_0x03ab('0xc')]=_[_0x03ab('0xd')](config[_0x03ab('0xc')],{'host':_0x03ab('0xe'),'port':0x18eb});var socket=require(_0x03ab('0xf'))(new Redis(config[_0x03ab('0xc')]));require(_0x03ab('0x10'))[_0x03ab('0x11')](socket);function respondWithRpcPromise(_0x4e39da,_0x32125a,_0x496e2b){return new BPromise(function(_0x180122,_0x17bee9){return client[_0x03ab('0x12')](_0x4e39da,_0x496e2b)[_0x03ab('0x13')](function(_0x5663eb){logger[_0x03ab('0x14')]('MailQueue,\x20%s,\x20%s',_0x32125a,_0x03ab('0x15'));logger['debug'](_0x03ab('0x16'),_0x32125a,'request\x20sent',JSON['stringify'](_0x5663eb));if(_0x5663eb['error']){if(_0x5663eb[_0x03ab('0x17')][_0x03ab('0x18')]===0x1f4){logger[_0x03ab('0x17')]('MailQueue,\x20%s,\x20%s',_0x32125a,_0x5663eb['error'][_0x03ab('0x19')]);return _0x17bee9(_0x5663eb['error'][_0x03ab('0x19')]);}logger[_0x03ab('0x17')](_0x03ab('0x1a'),_0x32125a,_0x5663eb[_0x03ab('0x17')]['message']);return _0x180122(_0x5663eb[_0x03ab('0x17')]['message']);}else{logger['info'](_0x03ab('0x1a'),_0x32125a,_0x03ab('0x15'));_0x180122(_0x5663eb[_0x03ab('0x1b')]['message']);}})['catch'](function(_0x46c476){logger[_0x03ab('0x17')](_0x03ab('0x1a'),_0x32125a,_0x46c476);_0x17bee9(_0x46c476);});});}exports[_0x03ab('0x1c')]=function(_0x2ea506){var _0x1af8f6=this;return new Promise(function(_0x2ff9a3,_0x22c5d6){return db[_0x03ab('0x1d')][_0x03ab('0x1e')]({'raw':_0x2ea506[_0x03ab('0x1f')]?_0x2ea506[_0x03ab('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x2ea506['options']?_0x2ea506[_0x03ab('0x1f')][_0x03ab('0x20')]||null:null,'attributes':_0x2ea506[_0x03ab('0x1f')]?_0x2ea506[_0x03ab('0x1f')]['attributes']||null:null,'limit':_0x2ea506[_0x03ab('0x1f')]?_0x2ea506[_0x03ab('0x1f')]['limit']||null:null,'include':_0x2ea506[_0x03ab('0x1f')]?_0x2ea506[_0x03ab('0x1f')][_0x03ab('0x21')]?_[_0x03ab('0x22')](_0x2ea506[_0x03ab('0x1f')][_0x03ab('0x21')],function(_0x2cce0a){return{'model':db[_0x2cce0a['model']],'as':_0x2cce0a['as'],'attributes':_0x2cce0a[_0x03ab('0x23')],'include':_0x2cce0a[_0x03ab('0x21')]?_[_0x03ab('0x22')](_0x2cce0a[_0x03ab('0x21')],function(_0x238c95){return{'model':db[_0x238c95['model']],'as':_0x238c95['as'],'attributes':_0x238c95[_0x03ab('0x23')],'include':_0x238c95[_0x03ab('0x21')]?_['map'](_0x238c95[_0x03ab('0x21')],function(_0x5de95d){return{'model':db[_0x5de95d['model']],'as':_0x5de95d['as'],'attributes':_0x5de95d['attributes']};}):[]};}):[]};}):[]:[]})[_0x03ab('0x13')](function(_0x68eb29){logger[_0x03ab('0x14')](_0x03ab('0x1c'),_0x2ea506);logger[_0x03ab('0x24')](_0x03ab('0x1c'),_0x2ea506,JSON['stringify'](_0x68eb29));_0x2ff9a3(_0x68eb29);})[_0x03ab('0x25')](function(_0x53c104){logger['error'](_0x03ab('0x1c'),_0x53c104[_0x03ab('0x19')],_0x2ea506);_0x22c5d6(_0x1af8f6[_0x03ab('0x17')](0x1f4,_0x53c104[_0x03ab('0x19')]));});});};exports[_0x03ab('0x26')]=function(_0x558e24){var _0x20b420=this;return new Promise(function(_0xf30bc,_0xb5cb2d){return db['MailQueue'][_0x03ab('0x27')]({'raw':_0x558e24[_0x03ab('0x1f')]?_0x558e24[_0x03ab('0x1f')][_0x03ab('0x28')]===undefined?!![]:![]:!![],'where':_0x558e24['options']?_0x558e24[_0x03ab('0x1f')][_0x03ab('0x20')]||null:null,'attributes':_0x558e24[_0x03ab('0x1f')]?_0x558e24['options'][_0x03ab('0x23')]||null:null,'include':_0x558e24['options']?_0x558e24[_0x03ab('0x1f')][_0x03ab('0x21')]?_[_0x03ab('0x22')](_0x558e24[_0x03ab('0x1f')][_0x03ab('0x21')],function(_0x169b87){return{'model':db[_0x169b87['model']],'as':_0x169b87['as'],'attributes':_0x169b87['attributes'],'include':_0x169b87[_0x03ab('0x21')]?_[_0x03ab('0x22')](_0x169b87[_0x03ab('0x21')],function(_0x513489){return{'model':db[_0x513489[_0x03ab('0x29')]],'as':_0x513489['as'],'attributes':_0x513489[_0x03ab('0x23')],'include':_0x513489[_0x03ab('0x21')]?_['map'](_0x513489[_0x03ab('0x21')],function(_0x476f04){return{'model':db[_0x476f04['model']],'as':_0x476f04['as'],'attributes':_0x476f04[_0x03ab('0x23')]};}):[]};}):[]};}):[]:[]})[_0x03ab('0x13')](function(_0x2503b6){logger[_0x03ab('0x14')](_0x03ab('0x26'),_0x558e24);logger['debug'](_0x03ab('0x26'),_0x558e24,JSON[_0x03ab('0x2a')](_0x2503b6));_0xf30bc(_0x2503b6);})[_0x03ab('0x25')](function(_0x3c6449){logger[_0x03ab('0x17')]('ShowMailQueue',_0x3c6449[_0x03ab('0x19')],_0x558e24);_0xb5cb2d(_0x20b420[_0x03ab('0x17')](0x1f4,_0x3c6449[_0x03ab('0x19')]));});});}; \ No newline at end of file +var _0x1601=['model','catch','ShowMailQueue','find','util','bluebird','ioredis','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','./mailQueue.socket','register','request','then','info','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','MailQueue,\x20%s,\x20%s','message','result','GetMailQueue','MailQueue','options','raw','where','limit','include','map','attributes'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x1601,0x151));var _0x1160=function(_0x4e1991,_0xeb727c){_0x4e1991=_0x4e1991-0x0;var _0x318050=_0x1601[_0x4e1991];return _0x318050;};'use strict';var _=require('lodash');var util=require(_0x1160('0x0'));var moment=require('moment');var BPromise=require(_0x1160('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1160('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1160('0x3'))(_0x1160('0x4'));var config=require(_0x1160('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1160('0x6')]({'port':0x232a});config[_0x1160('0x7')]=_[_0x1160('0x8')](config['redis'],{'host':_0x1160('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1160('0x7')]));require(_0x1160('0xa'))[_0x1160('0xb')](socket);function respondWithRpcPromise(_0x35fbfe,_0x536fbe,_0x39da44){return new BPromise(function(_0x14d24f,_0x9872a5){return client[_0x1160('0xc')](_0x35fbfe,_0x39da44)[_0x1160('0xd')](function(_0x4f41bf){logger[_0x1160('0xe')]('MailQueue,\x20%s,\x20%s',_0x536fbe,_0x1160('0xf'));logger[_0x1160('0x10')](_0x1160('0x11'),_0x536fbe,_0x1160('0xf'),JSON[_0x1160('0x12')](_0x4f41bf));if(_0x4f41bf['error']){if(_0x4f41bf[_0x1160('0x13')][_0x1160('0x14')]===0x1f4){logger[_0x1160('0x13')](_0x1160('0x15'),_0x536fbe,_0x4f41bf[_0x1160('0x13')][_0x1160('0x16')]);return _0x9872a5(_0x4f41bf[_0x1160('0x13')][_0x1160('0x16')]);}logger[_0x1160('0x13')](_0x1160('0x15'),_0x536fbe,_0x4f41bf[_0x1160('0x13')][_0x1160('0x16')]);return _0x14d24f(_0x4f41bf[_0x1160('0x13')][_0x1160('0x16')]);}else{logger[_0x1160('0xe')](_0x1160('0x15'),_0x536fbe,_0x1160('0xf'));_0x14d24f(_0x4f41bf[_0x1160('0x17')]['message']);}})['catch'](function(_0x221b5d){logger['error']('MailQueue,\x20%s,\x20%s',_0x536fbe,_0x221b5d);_0x9872a5(_0x221b5d);});});}exports[_0x1160('0x18')]=function(_0x7efc43){var _0xe7bfcb=this;return new Promise(function(_0x3c1ce9,_0x4abddd){return db[_0x1160('0x19')]['findAll']({'raw':_0x7efc43[_0x1160('0x1a')]?_0x7efc43[_0x1160('0x1a')][_0x1160('0x1b')]===undefined?!![]:![]:!![],'where':_0x7efc43[_0x1160('0x1a')]?_0x7efc43[_0x1160('0x1a')][_0x1160('0x1c')]||null:null,'attributes':_0x7efc43['options']?_0x7efc43[_0x1160('0x1a')]['attributes']||null:null,'limit':_0x7efc43[_0x1160('0x1a')]?_0x7efc43[_0x1160('0x1a')][_0x1160('0x1d')]||null:null,'include':_0x7efc43[_0x1160('0x1a')]?_0x7efc43[_0x1160('0x1a')][_0x1160('0x1e')]?_[_0x1160('0x1f')](_0x7efc43[_0x1160('0x1a')][_0x1160('0x1e')],function(_0x52d053){return{'model':db[_0x52d053['model']],'as':_0x52d053['as'],'attributes':_0x52d053[_0x1160('0x20')],'include':_0x52d053[_0x1160('0x1e')]?_[_0x1160('0x1f')](_0x52d053[_0x1160('0x1e')],function(_0x532a43){return{'model':db[_0x532a43[_0x1160('0x21')]],'as':_0x532a43['as'],'attributes':_0x532a43[_0x1160('0x20')],'include':_0x532a43['include']?_[_0x1160('0x1f')](_0x532a43[_0x1160('0x1e')],function(_0x1d45b1){return{'model':db[_0x1d45b1[_0x1160('0x21')]],'as':_0x1d45b1['as'],'attributes':_0x1d45b1[_0x1160('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3cde09){logger[_0x1160('0xe')](_0x1160('0x18'),_0x7efc43);logger[_0x1160('0x10')]('GetMailQueue',_0x7efc43,JSON[_0x1160('0x12')](_0x3cde09));_0x3c1ce9(_0x3cde09);})[_0x1160('0x22')](function(_0x5609d0){logger[_0x1160('0x13')]('GetMailQueue',_0x5609d0['message'],_0x7efc43);_0x4abddd(_0xe7bfcb[_0x1160('0x13')](0x1f4,_0x5609d0[_0x1160('0x16')]));});});};exports[_0x1160('0x23')]=function(_0x319196){var _0x4ab8e4=this;return new Promise(function(_0x44d8c8,_0xdff5a3){return db['MailQueue'][_0x1160('0x24')]({'raw':_0x319196[_0x1160('0x1a')]?_0x319196[_0x1160('0x1a')][_0x1160('0x1b')]===undefined?!![]:![]:!![],'where':_0x319196[_0x1160('0x1a')]?_0x319196[_0x1160('0x1a')][_0x1160('0x1c')]||null:null,'attributes':_0x319196[_0x1160('0x1a')]?_0x319196[_0x1160('0x1a')]['attributes']||null:null,'include':_0x319196[_0x1160('0x1a')]?_0x319196[_0x1160('0x1a')][_0x1160('0x1e')]?_['map'](_0x319196[_0x1160('0x1a')][_0x1160('0x1e')],function(_0x595015){return{'model':db[_0x595015[_0x1160('0x21')]],'as':_0x595015['as'],'attributes':_0x595015['attributes'],'include':_0x595015[_0x1160('0x1e')]?_[_0x1160('0x1f')](_0x595015['include'],function(_0x36fc9c){return{'model':db[_0x36fc9c[_0x1160('0x21')]],'as':_0x36fc9c['as'],'attributes':_0x36fc9c[_0x1160('0x20')],'include':_0x36fc9c[_0x1160('0x1e')]?_[_0x1160('0x1f')](_0x36fc9c[_0x1160('0x1e')],function(_0x203531){return{'model':db[_0x203531['model']],'as':_0x203531['as'],'attributes':_0x203531[_0x1160('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1160('0xd')](function(_0x1a05f9){logger[_0x1160('0xe')](_0x1160('0x23'),_0x319196);logger[_0x1160('0x10')](_0x1160('0x23'),_0x319196,JSON[_0x1160('0x12')](_0x1a05f9));_0x44d8c8(_0x1a05f9);})['catch'](function(_0xaafdbe){logger['error']('ShowMailQueue',_0xaafdbe[_0x1160('0x16')],_0x319196);_0xdff5a3(_0x4ab8e4[_0x1160('0x13')](0x1f4,_0xaafdbe[_0x1160('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 83b8087..9bae056 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 _0x0e6c=['remove','update','emit','register','length'];(function(_0x4336c9,_0x2a18a9){var _0x39668c=function(_0x44f273){while(--_0x44f273){_0x4336c9['push'](_0x4336c9['shift']());}};_0x39668c(++_0x2a18a9);}(_0x0e6c,0x64));var _0xc0e6=function(_0x5d13f6,_0x2aa719){_0x5d13f6=_0x5d13f6-0x0;var _0x5b91ca=_0x0e6c[_0x5d13f6];return _0x5b91ca;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=['save',_0xc0e6('0x0'),_0xc0e6('0x1')];function createListener(_0x4185a4,_0x5f24d8){return function(_0x4237a3){_0x5f24d8[_0xc0e6('0x2')](_0x4185a4,_0x4237a3);};}function removeListener(_0xcc5037,_0x118f14){return function(){MailQueueEvents['removeListener'](_0xcc5037,_0x118f14);};}exports[_0xc0e6('0x3')]=function(_0x5e7759){for(var _0x3f8f68=0x0,_0x2ffbf1=events[_0xc0e6('0x4')];_0x3f8f68<_0x2ffbf1;_0x3f8f68++){var _0x494a08=events[_0x3f8f68];var _0x5c3c0f=createListener('mailQueue:'+_0x494a08,_0x5e7759);MailQueueEvents['on'](_0x494a08,_0x5c3c0f);}}; \ No newline at end of file +var _0x0f03=['register','length','mailQueue:','./mailQueue.events','remove','update','emit','removeListener'];(function(_0x1cc6fa,_0x5b91e3){var _0x468b91=function(_0x1c37b2){while(--_0x1c37b2){_0x1cc6fa['push'](_0x1cc6fa['shift']());}};_0x468b91(++_0x5b91e3);}(_0x0f03,0x113));var _0x30f0=function(_0x19365a,_0x6fd7d3){_0x19365a=_0x19365a-0x0;var _0x30bac3=_0x0f03[_0x19365a];return _0x30bac3;};'use strict';var MailQueueEvents=require(_0x30f0('0x0'));var events=['save',_0x30f0('0x1'),_0x30f0('0x2')];function createListener(_0x2a8f11,_0x1d1970){return function(_0x292aaf){_0x1d1970[_0x30f0('0x3')](_0x2a8f11,_0x292aaf);};}function removeListener(_0x3000d,_0x48816a){return function(){MailQueueEvents[_0x30f0('0x4')](_0x3000d,_0x48816a);};}exports[_0x30f0('0x5')]=function(_0x213cb3){for(var _0x58ea11=0x0,_0x21ffcb=events[_0x30f0('0x6')];_0x58ea11<_0x21ffcb;_0x58ea11++){var _0x3cdd7b=events[_0x58ea11];var _0x1e6ee2=createListener(_0x30f0('0x7')+_0x3cdd7b,_0x213cb3);MailQueueEvents['on'](_0x3cdd7b,_0x1e6ee2);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 713d429..f3c6f69 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 _0x6c1f=['index','get','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','isAuthenticated'];(function(_0x560597,_0x170c46){var _0x15dfb5=function(_0x315586){while(--_0x315586){_0x560597['push'](_0x560597['shift']());}};_0x15dfb5(++_0x170c46);}(_0x6c1f,0x166));var _0xf6c1=function(_0x44511e,_0x2242ba){_0x44511e=_0x44511e-0x0;var _0x243798=_0x6c1f[_0x44511e];return _0x243798;};'use strict';var multer=require(_0xf6c1('0x0'));var util=require('util');var path=require(_0xf6c1('0x1'));var timeout=require(_0xf6c1('0x2'));var express=require(_0xf6c1('0x3'));var router=express['Router']();var fs_extra=require(_0xf6c1('0x4'));var auth=require(_0xf6c1('0x5'));var interaction=require(_0xf6c1('0x6'));var config=require(_0xf6c1('0x7'));var controller=require(_0xf6c1('0x8'));router['get']('/',auth[_0xf6c1('0x9')](),controller[_0xf6c1('0xa')]);router[_0xf6c1('0xb')](_0xf6c1('0xc'),auth[_0xf6c1('0x9')](),controller[_0xf6c1('0xd')]);router[_0xf6c1('0xb')](_0xf6c1('0xe'),auth[_0xf6c1('0x9')](),controller[_0xf6c1('0xf')]);router[_0xf6c1('0x10')]('/',auth[_0xf6c1('0x9')](),controller[_0xf6c1('0x11')]);router[_0xf6c1('0x12')](_0xf6c1('0xe'),auth['isAuthenticated'](),controller[_0xf6c1('0x13')]);router[_0xf6c1('0x14')](_0xf6c1('0xe'),auth[_0xf6c1('0x9')](),controller[_0xf6c1('0x15')]);module[_0xf6c1('0x16')]=router; \ No newline at end of file +var _0x3ecc=['index','/describe','/:id','isAuthenticated','show','post','create','put','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x3ecc,0xb2));var _0xc3ec=function(_0x427a0e,_0x4a275e){_0x427a0e=_0x427a0e-0x0;var _0x5262da=_0x3ecc[_0x427a0e];return _0x5262da;};'use strict';var multer=require(_0xc3ec('0x0'));var util=require(_0xc3ec('0x1'));var path=require(_0xc3ec('0x2'));var timeout=require(_0xc3ec('0x3'));var express=require('express');var router=express[_0xc3ec('0x4')]();var fs_extra=require(_0xc3ec('0x5'));var auth=require(_0xc3ec('0x6'));var interaction=require(_0xc3ec('0x7'));var config=require(_0xc3ec('0x8'));var controller=require(_0xc3ec('0x9'));router[_0xc3ec('0xa')]('/',auth['isAuthenticated'](),controller[_0xc3ec('0xb')]);router[_0xc3ec('0xa')](_0xc3ec('0xc'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xc3ec('0xd'),auth[_0xc3ec('0xe')](),controller[_0xc3ec('0xf')]);router[_0xc3ec('0x10')]('/',auth['isAuthenticated'](),controller[_0xc3ec('0x11')]);router[_0xc3ec('0x12')]('/:id',auth[_0xc3ec('0xe')](),controller['update']);router[_0xc3ec('0x13')](_0xc3ec('0xd'),auth[_0xc3ec('0xe')](),controller[_0xc3ec('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 7e7721e..f795c37 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 _0x34ab=['DATE','moment','sequelize','exports','STRING'];(function(_0x1ca1e6,_0x7f383e){var _0x4a3a82=function(_0x3b5e42){while(--_0x3b5e42){_0x1ca1e6['push'](_0x1ca1e6['shift']());}};_0x4a3a82(++_0x7f383e);}(_0x34ab,0xf1));var _0xb34a=function(_0x65c50e,_0x1aa926){_0x65c50e=_0x65c50e-0x0;var _0x4573e7=_0x34ab[_0x65c50e];return _0x4573e7;};'use strict';var moment=require(_0xb34a('0x0'));var Sequelize=require(_0xb34a('0x1'));module[_0xb34a('0x2')]={'uniqueid':{'type':Sequelize[_0xb34a('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xb34a('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xb34a('0x4')]},'reason':{'type':Sequelize[_0xb34a('0x3')]}}; \ No newline at end of file +var _0xc61d=['STRING','DATE','exports'];(function(_0x4bc458,_0x2ef1ea){var _0x87c5c7=function(_0x2f3959){while(--_0x2f3959){_0x4bc458['push'](_0x4bc458['shift']());}};_0x87c5c7(++_0x2ef1ea);}(_0xc61d,0x19a));var _0xdc61=function(_0x2f24e7,_0x38df4c){_0x2f24e7=_0x2f24e7-0x0;var _0x44bfc7=_0xc61d[_0x2f24e7];return _0x44bfc7;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xdc61('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xdc61('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xdc61('0x2')]},'acceptAt':{'type':Sequelize[_0xdc61('0x2')]},'exitAt':{'type':Sequelize[_0xdc61('0x2')]},'reason':{'type':Sequelize[_0xdc61('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index ffeef7d..1cd16fb 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 _0x77d4=['save','update','then','error','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','filter','options','includeAll','findAll','rows','catch','show','params','include','merge','find','create','body','describe','rimraf','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','json','apply','reject'];(function(_0x4caf4f,_0x1f9d37){var _0xf64dd9=function(_0x37507){while(--_0x37507){_0x4caf4f['push'](_0x4caf4f['shift']());}};_0xf64dd9(++_0x1f9d37);}(_0x77d4,0x108));var _0x477d=function(_0x3a3fcc,_0x38afb3){_0x3a3fcc=_0x3a3fcc-0x0;var _0xe16438=_0x77d4[_0x3a3fcc];return _0xe16438;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x477d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x477d('0x1'));var rp=require('request-promise');var moment=require(_0x477d('0x2'));var BPromise=require(_0x477d('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x477d('0x4'));var sox=require(_0x477d('0x5'));var csv=require(_0x477d('0x6'));var ejs=require(_0x477d('0x7'));var fs=require('fs');var fs_extra=require(_0x477d('0x8'));var _=require(_0x477d('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x477d('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x477d('0xb'));var Papa=require(_0x477d('0xc'));var Redis=require(_0x477d('0xd'));var authService=require(_0x477d('0xe'));var qs=require(_0x477d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x477d('0x10'));var logger=require('../../config/logger')(_0x477d('0x11'));var utils=require(_0x477d('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x477d('0x13'));var db=require(_0x477d('0x14'))['db'];function respondWithStatusCode(_0x5a190c,_0x5dd33c){_0x5dd33c=_0x5dd33c||0xcc;return function(_0x6ff724){if(_0x6ff724){return _0x5a190c[_0x477d('0x15')](_0x5dd33c);}return _0x5a190c['status'](_0x5dd33c)[_0x477d('0x16')]();};}function respondWithResult(_0x1d5699,_0x48c73a){_0x48c73a=_0x48c73a||0xc8;return function(_0x4b2021){if(_0x4b2021){return _0x1d5699[_0x477d('0x17')](_0x48c73a)['json'](_0x4b2021);}};}function respondWithFilteredResult(_0x30481f,_0x234b99){return function(_0x25fc02){if(_0x25fc02){var _0x5985b5=typeof _0x234b99[_0x477d('0x18')]===_0x477d('0x19')&&typeof _0x234b99[_0x477d('0x1a')]===_0x477d('0x19');var _0x57b38e=_0x25fc02[_0x477d('0x1b')];var _0x5d5553=_0x5985b5?0x0:_0x234b99[_0x477d('0x18')];var _0x1399d7=_0x5985b5?_0x25fc02[_0x477d('0x1b')]:_0x234b99[_0x477d('0x18')]+_0x234b99[_0x477d('0x1a')];var _0x2145ce;if(_0x1399d7>=_0x57b38e){_0x1399d7=_0x57b38e;_0x2145ce=0xc8;}else{_0x2145ce=0xce;}_0x30481f['status'](_0x2145ce);return _0x30481f[_0x477d('0x1c')]('Content-Range',_0x5d5553+'-'+_0x1399d7+'/'+_0x57b38e)[_0x477d('0x1d')](_0x25fc02);}return null;};}function patchUpdates(_0x24a6d5){return function(_0x40256e){try{jsonpatch[_0x477d('0x1e')](_0x40256e,_0x24a6d5,!![]);}catch(_0x27b3aa){return BPromise[_0x477d('0x1f')](_0x27b3aa);}return _0x40256e[_0x477d('0x20')]();};}function saveUpdates(_0x17154d,_0x45a8bd){return function(_0x5981a){if(_0x5981a){return _0x5981a[_0x477d('0x21')](_0x17154d)[_0x477d('0x22')](function(_0x43c845){return _0x43c845;});}return null;};}function removeEntity(_0x1f3868,_0x4e6a44){return function(_0x4481b0){if(_0x4481b0){return _0x4481b0['destroy']()[_0x477d('0x22')](function(){_0x1f3868[_0x477d('0x17')](0xcc)[_0x477d('0x16')]();});}};}function handleEntityNotFound(_0x2287b4,_0x4bb50e){return function(_0xd6dca5){if(!_0xd6dca5){_0x2287b4[_0x477d('0x15')](0x194);}return _0xd6dca5;};}function handleError(_0x1ca4fe,_0x48ee5e){_0x48ee5e=_0x48ee5e||0x1f4;return function(_0x585648){logger[_0x477d('0x23')](_0x585648[_0x477d('0x24')]);if(_0x585648[_0x477d('0x25')]){delete _0x585648['name'];}_0x1ca4fe[_0x477d('0x17')](_0x48ee5e)[_0x477d('0x26')](_0x585648);};}exports[_0x477d('0x27')]=function(_0xe4dd40,_0x37b332){var _0x537fc4={},_0x2fc959={},_0xeb02f5={'count':0x0,'rows':[]};var _0x17dd16=_[_0x477d('0x28')](db[_0x477d('0x29')][_0x477d('0x2a')],function(_0x180046){return{'name':_0x180046[_0x477d('0x2b')],'type':_0x180046[_0x477d('0x2c')][_0x477d('0x2d')]};});_0x2fc959[_0x477d('0x2e')]=_[_0x477d('0x28')](_0x17dd16,_0x477d('0x25'));_0x2fc959[_0x477d('0x2f')]=_[_0x477d('0x30')](_0xe4dd40[_0x477d('0x2f')]);_0x2fc959[_0x477d('0x31')]=_[_0x477d('0x32')](_0x2fc959[_0x477d('0x2e')],_0x2fc959[_0x477d('0x2f')]);_0x537fc4['attributes']=_[_0x477d('0x32')](_0x2fc959['model'],qs[_0x477d('0x33')](_0xe4dd40[_0x477d('0x2f')][_0x477d('0x33')]));_0x537fc4['attributes']=_0x537fc4[_0x477d('0x34')][_0x477d('0x35')]?_0x537fc4[_0x477d('0x34')]:_0x2fc959[_0x477d('0x2e')];if(!_0xe4dd40[_0x477d('0x2f')][_0x477d('0x36')](_0x477d('0x37'))){_0x537fc4[_0x477d('0x1a')]=qs[_0x477d('0x1a')](_0xe4dd40[_0x477d('0x2f')]['limit']);_0x537fc4[_0x477d('0x18')]=qs[_0x477d('0x18')](_0xe4dd40[_0x477d('0x2f')]['offset']);}_0x537fc4[_0x477d('0x38')]=qs[_0x477d('0x39')](_0xe4dd40[_0x477d('0x2f')]['sort']);_0x537fc4['where']=qs[_0x477d('0x31')](_[_0x477d('0x3a')](_0xe4dd40[_0x477d('0x2f')],_0x2fc959[_0x477d('0x31')]),_0x17dd16);if(_0xe4dd40[_0x477d('0x2f')]['filter']){_0x537fc4[_0x477d('0x3b')]=_['merge'](_0x537fc4[_0x477d('0x3b')],{'$or':_[_0x477d('0x28')](_0x17dd16,function(_0x356f41){if(_0x356f41['type']!=='VIRTUAL'){var _0x184d50={};_0x184d50[_0x356f41[_0x477d('0x25')]]={'$like':'%'+_0xe4dd40[_0x477d('0x2f')][_0x477d('0x3c')]+'%'};return _0x184d50;}})});}_0x537fc4=_['merge']({},_0x537fc4,_0xe4dd40[_0x477d('0x3d')]);var _0xc091e={'where':_0x537fc4[_0x477d('0x3b')]};return db[_0x477d('0x29')][_0x477d('0x1b')](_0xc091e)['then'](function(_0x472149){_0xeb02f5[_0x477d('0x1b')]=_0x472149;if(_0xe4dd40['query'][_0x477d('0x3e')]){_0x537fc4['include']=[{'all':!![]}];}return db[_0x477d('0x29')][_0x477d('0x3f')](_0x537fc4);})[_0x477d('0x22')](function(_0x335b2a){_0xeb02f5[_0x477d('0x40')]=_0x335b2a;return _0xeb02f5;})[_0x477d('0x22')](respondWithFilteredResult(_0x37b332,_0x537fc4))[_0x477d('0x41')](handleError(_0x37b332,null));};exports[_0x477d('0x42')]=function(_0x43ffd1,_0x4c22f5){var _0x5759f={'raw':!![],'where':{'id':_0x43ffd1[_0x477d('0x43')]['id']}},_0x31c9a1={};_0x31c9a1[_0x477d('0x2e')]=_['keys'](db['MailQueueReport'][_0x477d('0x2a')]);_0x31c9a1[_0x477d('0x2f')]=_['keys'](_0x43ffd1[_0x477d('0x2f')]);_0x31c9a1['filters']=_['intersection'](_0x31c9a1[_0x477d('0x2e')],_0x31c9a1[_0x477d('0x2f')]);_0x5759f[_0x477d('0x34')]=_[_0x477d('0x32')](_0x31c9a1[_0x477d('0x2e')],qs[_0x477d('0x33')](_0x43ffd1['query'][_0x477d('0x33')]));_0x5759f[_0x477d('0x34')]=_0x5759f[_0x477d('0x34')][_0x477d('0x35')]?_0x5759f[_0x477d('0x34')]:_0x31c9a1['model'];if(_0x43ffd1['query'][_0x477d('0x3e')]){_0x5759f[_0x477d('0x44')]=[{'all':!![]}];}_0x5759f=_[_0x477d('0x45')]({},_0x5759f,_0x43ffd1['options']);return db[_0x477d('0x29')][_0x477d('0x46')](_0x5759f)[_0x477d('0x22')](handleEntityNotFound(_0x4c22f5,null))[_0x477d('0x22')](respondWithResult(_0x4c22f5,null))[_0x477d('0x41')](handleError(_0x4c22f5,null));};exports[_0x477d('0x47')]=function(_0x13f606,_0x4d4e19){return db[_0x477d('0x29')][_0x477d('0x47')](_0x13f606[_0x477d('0x48')],{})[_0x477d('0x22')](respondWithResult(_0x4d4e19,0xc9))[_0x477d('0x41')](handleError(_0x4d4e19,null));};exports[_0x477d('0x21')]=function(_0x2aad84,_0x30e474){if(_0x2aad84[_0x477d('0x48')]['id']){delete _0x2aad84[_0x477d('0x48')]['id'];}return db[_0x477d('0x29')][_0x477d('0x46')]({'where':{'id':_0x2aad84[_0x477d('0x43')]['id']}})[_0x477d('0x22')](handleEntityNotFound(_0x30e474,null))[_0x477d('0x22')](saveUpdates(_0x2aad84['body'],null))[_0x477d('0x22')](respondWithResult(_0x30e474,null))[_0x477d('0x41')](handleError(_0x30e474,null));};exports['destroy']=function(_0x566ba0,_0x5cb3ca){return db[_0x477d('0x29')][_0x477d('0x46')]({'where':{'id':_0x566ba0[_0x477d('0x43')]['id']}})[_0x477d('0x22')](handleEntityNotFound(_0x5cb3ca,null))[_0x477d('0x22')](removeEntity(_0x5cb3ca,null))[_0x477d('0x41')](handleError(_0x5cb3ca,null));};exports[_0x477d('0x49')]=function(_0x342f18,_0x593faf){return db[_0x477d('0x29')][_0x477d('0x49')]()[_0x477d('0x22')](respondWithResult(_0x593faf,null))[_0x477d('0x41')](handleError(_0x593faf,null));}; \ No newline at end of file +var _0x3a6d=['keys','filters','intersection','attributes','model','fields','length','nolimit','order','sort','pick','filter','where','type','options','includeAll','rows','catch','params','rawAttributes','merge','find','create','body','update','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','save','then','error','stack','name','send','index','map','MailQueueReport','fieldName','key','query'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3a6d,0x143));var _0xd3a6=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x3a6d[_0x4ff09b];return _0x3f5c2e;};'use strict';var emlformat=require(_0xd3a6('0x0'));var rimraf=require(_0xd3a6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd3a6('0x2'));var rp=require(_0xd3a6('0x3'));var moment=require(_0xd3a6('0x4'));var BPromise=require(_0xd3a6('0x5'));var Mustache=require(_0xd3a6('0x6'));var util=require('util');var path=require(_0xd3a6('0x7'));var sox=require(_0xd3a6('0x8'));var csv=require(_0xd3a6('0x9'));var ejs=require(_0xd3a6('0xa'));var fs=require('fs');var fs_extra=require(_0xd3a6('0xb'));var _=require(_0xd3a6('0xc'));var squel=require('squel');var crypto=require(_0xd3a6('0xd'));var jsforce=require(_0xd3a6('0xe'));var deskjs=require(_0xd3a6('0xf'));var toCsv=require(_0xd3a6('0x9'));var querystring=require(_0xd3a6('0x10'));var Papa=require(_0xd3a6('0x11'));var Redis=require(_0xd3a6('0x12'));var authService=require(_0xd3a6('0x13'));var qs=require(_0xd3a6('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd3a6('0x15'));var logger=require(_0xd3a6('0x16'))(_0xd3a6('0x17'));var utils=require(_0xd3a6('0x18'));var config=require(_0xd3a6('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b0467,_0x1c6ad7){_0x1c6ad7=_0x1c6ad7||0xcc;return function(_0x671004){if(_0x671004){return _0x4b0467[_0xd3a6('0x1a')](_0x1c6ad7);}return _0x4b0467[_0xd3a6('0x1b')](_0x1c6ad7)[_0xd3a6('0x1c')]();};}function respondWithResult(_0x2911a0,_0xa56452){_0xa56452=_0xa56452||0xc8;return function(_0x4e67fb){if(_0x4e67fb){return _0x2911a0[_0xd3a6('0x1b')](_0xa56452)[_0xd3a6('0x1d')](_0x4e67fb);}};}function respondWithFilteredResult(_0x171a8f,_0x500a37){return function(_0x3c2399){if(_0x3c2399){var _0x305b61=typeof _0x500a37[_0xd3a6('0x1e')]==='undefined'&&typeof _0x500a37[_0xd3a6('0x1f')]==='undefined';var _0x518b6d=_0x3c2399[_0xd3a6('0x20')];var _0x8d1286=_0x305b61?0x0:_0x500a37[_0xd3a6('0x1e')];var _0xbe58b4=_0x305b61?_0x3c2399[_0xd3a6('0x20')]:_0x500a37[_0xd3a6('0x1e')]+_0x500a37[_0xd3a6('0x1f')];var _0x4ec27c;if(_0xbe58b4>=_0x518b6d){_0xbe58b4=_0x518b6d;_0x4ec27c=0xc8;}else{_0x4ec27c=0xce;}_0x171a8f[_0xd3a6('0x1b')](_0x4ec27c);return _0x171a8f['set'](_0xd3a6('0x21'),_0x8d1286+'-'+_0xbe58b4+'/'+_0x518b6d)[_0xd3a6('0x1d')](_0x3c2399);}return null;};}function patchUpdates(_0x12f2c1){return function(_0x20a34e){try{jsonpatch[_0xd3a6('0x22')](_0x20a34e,_0x12f2c1,!![]);}catch(_0x6ecd88){return BPromise['reject'](_0x6ecd88);}return _0x20a34e[_0xd3a6('0x23')]();};}function saveUpdates(_0x422f5c,_0x57cf15){return function(_0x543a6a){if(_0x543a6a){return _0x543a6a['update'](_0x422f5c)['then'](function(_0x5c9075){return _0x5c9075;});}return null;};}function removeEntity(_0x98a12a,_0x400982){return function(_0x3d0b28){if(_0x3d0b28){return _0x3d0b28['destroy']()[_0xd3a6('0x24')](function(){_0x98a12a['status'](0xcc)[_0xd3a6('0x1c')]();});}};}function handleEntityNotFound(_0x16afc8,_0x429079){return function(_0x4f6130){if(!_0x4f6130){_0x16afc8[_0xd3a6('0x1a')](0x194);}return _0x4f6130;};}function handleError(_0x3bc8d1,_0x1b09ac){_0x1b09ac=_0x1b09ac||0x1f4;return function(_0x219e32){logger[_0xd3a6('0x25')](_0x219e32[_0xd3a6('0x26')]);if(_0x219e32['name']){delete _0x219e32[_0xd3a6('0x27')];}_0x3bc8d1[_0xd3a6('0x1b')](_0x1b09ac)[_0xd3a6('0x28')](_0x219e32);};}exports[_0xd3a6('0x29')]=function(_0x30abc2,_0x45c628){var _0x5c2186={},_0x535bd4={},_0x1f4859={'count':0x0,'rows':[]};var _0x210aa1=_[_0xd3a6('0x2a')](db[_0xd3a6('0x2b')]['rawAttributes'],function(_0x3de3bb){return{'name':_0x3de3bb[_0xd3a6('0x2c')],'type':_0x3de3bb['type'][_0xd3a6('0x2d')]};});_0x535bd4['model']=_[_0xd3a6('0x2a')](_0x210aa1,_0xd3a6('0x27'));_0x535bd4[_0xd3a6('0x2e')]=_[_0xd3a6('0x2f')](_0x30abc2[_0xd3a6('0x2e')]);_0x535bd4[_0xd3a6('0x30')]=_[_0xd3a6('0x31')](_0x535bd4['model'],_0x535bd4['query']);_0x5c2186[_0xd3a6('0x32')]=_[_0xd3a6('0x31')](_0x535bd4[_0xd3a6('0x33')],qs['fields'](_0x30abc2[_0xd3a6('0x2e')][_0xd3a6('0x34')]));_0x5c2186[_0xd3a6('0x32')]=_0x5c2186[_0xd3a6('0x32')][_0xd3a6('0x35')]?_0x5c2186[_0xd3a6('0x32')]:_0x535bd4[_0xd3a6('0x33')];if(!_0x30abc2[_0xd3a6('0x2e')]['hasOwnProperty'](_0xd3a6('0x36'))){_0x5c2186[_0xd3a6('0x1f')]=qs[_0xd3a6('0x1f')](_0x30abc2[_0xd3a6('0x2e')][_0xd3a6('0x1f')]);_0x5c2186[_0xd3a6('0x1e')]=qs['offset'](_0x30abc2[_0xd3a6('0x2e')]['offset']);}_0x5c2186[_0xd3a6('0x37')]=qs[_0xd3a6('0x38')](_0x30abc2[_0xd3a6('0x2e')][_0xd3a6('0x38')]);_0x5c2186['where']=qs['filters'](_[_0xd3a6('0x39')](_0x30abc2[_0xd3a6('0x2e')],_0x535bd4[_0xd3a6('0x30')]),_0x210aa1);if(_0x30abc2['query'][_0xd3a6('0x3a')]){_0x5c2186[_0xd3a6('0x3b')]=_['merge'](_0x5c2186[_0xd3a6('0x3b')],{'$or':_['map'](_0x210aa1,function(_0x1e695a){if(_0x1e695a[_0xd3a6('0x3c')]!=='VIRTUAL'){var _0x219ba5={};_0x219ba5[_0x1e695a['name']]={'$like':'%'+_0x30abc2[_0xd3a6('0x2e')][_0xd3a6('0x3a')]+'%'};return _0x219ba5;}})});}_0x5c2186=_['merge']({},_0x5c2186,_0x30abc2[_0xd3a6('0x3d')]);var _0xfcef03={'where':_0x5c2186[_0xd3a6('0x3b')]};return db[_0xd3a6('0x2b')]['count'](_0xfcef03)[_0xd3a6('0x24')](function(_0x324dbd){_0x1f4859[_0xd3a6('0x20')]=_0x324dbd;if(_0x30abc2[_0xd3a6('0x2e')][_0xd3a6('0x3e')]){_0x5c2186['include']=[{'all':!![]}];}return db[_0xd3a6('0x2b')]['findAll'](_0x5c2186);})[_0xd3a6('0x24')](function(_0x1bc18a){_0x1f4859[_0xd3a6('0x3f')]=_0x1bc18a;return _0x1f4859;})['then'](respondWithFilteredResult(_0x45c628,_0x5c2186))[_0xd3a6('0x40')](handleError(_0x45c628,null));};exports['show']=function(_0x23aa99,_0x4cbf76){var _0x448213={'raw':!![],'where':{'id':_0x23aa99[_0xd3a6('0x41')]['id']}},_0x629153={};_0x629153[_0xd3a6('0x33')]=_[_0xd3a6('0x2f')](db[_0xd3a6('0x2b')][_0xd3a6('0x42')]);_0x629153['query']=_[_0xd3a6('0x2f')](_0x23aa99[_0xd3a6('0x2e')]);_0x629153[_0xd3a6('0x30')]=_[_0xd3a6('0x31')](_0x629153['model'],_0x629153[_0xd3a6('0x2e')]);_0x448213[_0xd3a6('0x32')]=_[_0xd3a6('0x31')](_0x629153[_0xd3a6('0x33')],qs[_0xd3a6('0x34')](_0x23aa99[_0xd3a6('0x2e')][_0xd3a6('0x34')]));_0x448213[_0xd3a6('0x32')]=_0x448213['attributes'][_0xd3a6('0x35')]?_0x448213[_0xd3a6('0x32')]:_0x629153[_0xd3a6('0x33')];if(_0x23aa99[_0xd3a6('0x2e')][_0xd3a6('0x3e')]){_0x448213['include']=[{'all':!![]}];}_0x448213=_[_0xd3a6('0x43')]({},_0x448213,_0x23aa99[_0xd3a6('0x3d')]);return db[_0xd3a6('0x2b')][_0xd3a6('0x44')](_0x448213)[_0xd3a6('0x24')](handleEntityNotFound(_0x4cbf76,null))[_0xd3a6('0x24')](respondWithResult(_0x4cbf76,null))[_0xd3a6('0x40')](handleError(_0x4cbf76,null));};exports[_0xd3a6('0x45')]=function(_0x4ac576,_0x7828c2){return db['MailQueueReport'][_0xd3a6('0x45')](_0x4ac576[_0xd3a6('0x46')],{})['then'](respondWithResult(_0x7828c2,0xc9))[_0xd3a6('0x40')](handleError(_0x7828c2,null));};exports[_0xd3a6('0x47')]=function(_0x3cf99a,_0x375067){if(_0x3cf99a[_0xd3a6('0x46')]['id']){delete _0x3cf99a[_0xd3a6('0x46')]['id'];}return db[_0xd3a6('0x2b')][_0xd3a6('0x44')]({'where':{'id':_0x3cf99a[_0xd3a6('0x41')]['id']}})[_0xd3a6('0x24')](handleEntityNotFound(_0x375067,null))['then'](saveUpdates(_0x3cf99a[_0xd3a6('0x46')],null))[_0xd3a6('0x24')](respondWithResult(_0x375067,null))[_0xd3a6('0x40')](handleError(_0x375067,null));};exports[_0xd3a6('0x48')]=function(_0x26bd65,_0x225393){return db[_0xd3a6('0x2b')][_0xd3a6('0x44')]({'where':{'id':_0x26bd65[_0xd3a6('0x41')]['id']}})[_0xd3a6('0x24')](handleEntityNotFound(_0x225393,null))['then'](removeEntity(_0x225393,null))[_0xd3a6('0x40')](handleError(_0x225393,null));};exports[_0xd3a6('0x49')]=function(_0x618b72,_0x4995b7){return db[_0xd3a6('0x2b')]['describe']()['then'](respondWithResult(_0x4995b7,null))['catch'](handleError(_0x4995b7,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 0fc9125..b5ea4b3 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 _0x69bf=['util','../../config/logger','bluebird','path','../../config/environment','exports','define','MailQueueReport','uniqueid','lodash'];(function(_0xab842,_0x3a34c9){var _0x1044e2=function(_0x50a187){while(--_0x50a187){_0xab842['push'](_0xab842['shift']());}};_0x1044e2(++_0x3a34c9);}(_0x69bf,0x1cb));var _0xf69b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x69bf[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xf69b('0x0'));var util=require(_0xf69b('0x1'));var logger=require(_0xf69b('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf69b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf69b('0x4'));var rimraf=require('rimraf');var config=require(_0xf69b('0x5'));var attributes=require('./mailQueueReport.attributes');module[_0xf69b('0x6')]=function(_0x544dd7,_0x71a80a){return _0x544dd7[_0xf69b('0x7')](_0xf69b('0x8'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xf69b('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x70e2=['moment','bluebird','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','api'];(function(_0x2d1877,_0x1dab8e){var _0x1a950e=function(_0x35e56e){while(--_0x35e56e){_0x2d1877['push'](_0x2d1877['shift']());}};_0x1a950e(++_0x1dab8e);}(_0x70e2,0x119));var _0x270e=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x70e2[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0x270e('0x0'));var util=require(_0x270e('0x1'));var logger=require(_0x270e('0x2'))(_0x270e('0x3'));var moment=require(_0x270e('0x4'));var BPromise=require(_0x270e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x270e('0x6'));var rimraf=require(_0x270e('0x7'));var config=require(_0x270e('0x8'));var attributes=require(_0x270e('0x9'));module[_0x270e('0xa')]=function(_0x51bee4,_0x413c32){return _0x51bee4[_0x270e('0xb')](_0x270e('0xc'),attributes,{'tableName':_0x270e('0xd'),'paranoid':![],'indexes':[{'name':_0x270e('0xe'),'fields':[_0x270e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 6f17c50..787e5b2 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(_0x3165bb,_0x2174ce){var _0x20999f=function(_0x3a760c){while(--_0x3a760c){_0x3165bb['push'](_0x3165bb['shift']());}};_0x20999f(++_0x2174ce);}(_0x7a54,0x106));var _0x47a5=function(_0x300ddb,_0x224bc2){_0x300ddb=_0x300ddb-0x0;var _0x4d1bbd=_0x7a54[_0x300ddb];return _0x4d1bbd;};'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 _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0x4fdf11,_0x424d57){var _0x462038=function(_0x3a7d45){while(--_0x3a7d45){_0x4fdf11['push'](_0x4fdf11['shift']());}};_0x462038(++_0x424d57);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xc4aa[_0x2235bf];return _0x4c3a64;};'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')]('MailQueueReport,\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);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index bb23884..da27396 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x444975,_0x44aaf0){var _0x45cc12=function(_0x5ddd31){while(--_0x5ddd31){_0x444975['push'](_0x444975['shift']());}};_0x45cc12(++_0x44aaf0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x202a98,_0x5a8367){var _0x12b54d=function(_0x3a08bf){while(--_0x3a08bf){_0x202a98['push'](_0x202a98['shift']());}};_0x12b54d(++_0x5a8367);}(_0xedd9,0xfc));var _0x9edd=function(_0x9defc4,_0x569d66){_0x9defc4=_0x9defc4-0x0;var _0x5bb415=_0xedd9[_0x9defc4];return _0x5bb415;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 4f101f5..cef01c8 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 _0x62a7=['STRING','BOOLEAN','INTEGER','INBOX','sequelize','exports'];(function(_0x27acb0,_0x4bc9eb){var _0x2c3e10=function(_0x5e81ae){while(--_0x5e81ae){_0x27acb0['push'](_0x27acb0['shift']());}};_0x2c3e10(++_0x4bc9eb);}(_0x62a7,0x1d8));var _0x762a=function(_0x21ee11,_0x172225){_0x21ee11=_0x21ee11-0x0;var _0xb4c64e=_0x62a7[_0x21ee11];return _0xb4c64e;};'use strict';var Sequelize=require(_0x762a('0x0'));module[_0x762a('0x1')]={'description':{'type':Sequelize[_0x762a('0x2')]},'host':{'type':Sequelize[_0x762a('0x2')]},'authentication':{'type':Sequelize[_0x762a('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x762a('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x762a('0x4')]},'tls':{'type':Sequelize[_0x762a('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x762a('0x2')],'defaultValue':_0x762a('0x5')},'connTimeout':{'type':Sequelize[_0x762a('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x762a('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x762a('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xdf94=['STRING','BOOLEAN','INTEGER','exports'];(function(_0x3d1684,_0x103504){var _0x20dbaa=function(_0xc5a5f){while(--_0xc5a5f){_0x3d1684['push'](_0x3d1684['shift']());}};_0x20dbaa(++_0x103504);}(_0xdf94,0x1d7));var _0x4df9=function(_0x58fd36,_0x41104f){_0x58fd36=_0x58fd36-0x0;var _0x113ac7=_0xdf94[_0x58fd36];return _0x113ac7;};'use strict';var Sequelize=require('sequelize');module[_0x4df9('0x0')]={'description':{'type':Sequelize[_0x4df9('0x1')]},'host':{'type':Sequelize[_0x4df9('0x1')]},'authentication':{'type':Sequelize[_0x4df9('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x4df9('0x1')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x4df9('0x3')]},'tls':{'type':Sequelize[_0x4df9('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x4df9('0x1')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x4df9('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index e6e4a59..c57fdfe 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 _0x54db=['request-promise','path','../../config/environment','./mailServerIn.attributes','exports','mail_servers_in','lodash','../../config/logger','api','moment','bluebird'];(function(_0x3966c7,_0x31e828){var _0x5bcd3b=function(_0x1914da){while(--_0x1914da){_0x3966c7['push'](_0x3966c7['shift']());}};_0x5bcd3b(++_0x31e828);}(_0x54db,0x124));var _0xb54d=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x54db[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0xb54d('0x0'));var util=require('util');var logger=require(_0xb54d('0x1'))(_0xb54d('0x2'));var moment=require(_0xb54d('0x3'));var BPromise=require(_0xb54d('0x4'));var rp=require(_0xb54d('0x5'));var fs=require('fs');var path=require(_0xb54d('0x6'));var rimraf=require('rimraf');var config=require(_0xb54d('0x7'));var attributes=require(_0xb54d('0x8'));module[_0xb54d('0x9')]=function(_0x1066b8,_0x3cfa27){return _0x1066b8['define']('MailServerIn',attributes,{'tableName':_0xb54d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x95f4=['api','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','util','../../config/logger'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x95f4,0x184));var _0x495f=function(_0x1878b5,_0x22cd53){_0x1878b5=_0x1878b5-0x0;var _0x4bdb4d=_0x95f4[_0x1878b5];return _0x4bdb4d;};'use strict';var _=require('lodash');var util=require(_0x495f('0x0'));var logger=require(_0x495f('0x1'))(_0x495f('0x2'));var moment=require('moment');var BPromise=require(_0x495f('0x3'));var rp=require(_0x495f('0x4'));var fs=require('fs');var path=require(_0x495f('0x5'));var rimraf=require(_0x495f('0x6'));var config=require(_0x495f('0x7'));var attributes=require(_0x495f('0x8'));module[_0x495f('0x9')]=function(_0xdabcbb,_0x373f14){return _0xdabcbb[_0x495f('0xa')](_0x495f('0xb'),attributes,{'tableName':_0x495f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index c6608d4..a072e3f 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 _0x4157=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','include','model','map','lodash','util'];(function(_0x3a1ea5,_0x349f01){var _0xfac9b2=function(_0xd5310c){while(--_0xd5310c){_0x3a1ea5['push'](_0x3a1ea5['shift']());}};_0xfac9b2(++_0x349f01);}(_0x4157,0xf3));var _0x7415=function(_0x44b6d8,_0x533378){_0x44b6d8=_0x44b6d8-0x0;var _0x2434d9=_0x4157[_0x44b6d8];return _0x2434d9;};'use strict';var _=require(_0x7415('0x0'));var util=require(_0x7415('0x1'));var moment=require(_0x7415('0x2'));var BPromise=require(_0x7415('0x3'));var rs=require(_0x7415('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7415('0x5'))['db'];var utils=require(_0x7415('0x6'));var logger=require(_0x7415('0x7'))(_0x7415('0x8'));var config=require(_0x7415('0x9'));var jayson=require(_0x7415('0xa'));var client=jayson[_0x7415('0xb')][_0x7415('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3c7980,_0x49b694,_0x26fe93){return new BPromise(function(_0x588c5a,_0x972b02){return client['request'](_0x3c7980,_0x26fe93)[_0x7415('0xd')](function(_0x1a42df){logger[_0x7415('0xe')](_0x7415('0xf'),_0x49b694,_0x7415('0x10'));logger[_0x7415('0x11')](_0x7415('0x12'),_0x49b694,'request\x20sent',JSON[_0x7415('0x13')](_0x1a42df));if(_0x1a42df[_0x7415('0x14')]){if(_0x1a42df[_0x7415('0x14')][_0x7415('0x15')]===0x1f4){logger[_0x7415('0x14')]('MailServerIn,\x20%s,\x20%s',_0x49b694,_0x1a42df[_0x7415('0x14')][_0x7415('0x16')]);return _0x972b02(_0x1a42df[_0x7415('0x14')][_0x7415('0x16')]);}logger[_0x7415('0x14')](_0x7415('0xf'),_0x49b694,_0x1a42df[_0x7415('0x14')][_0x7415('0x16')]);return _0x588c5a(_0x1a42df[_0x7415('0x14')][_0x7415('0x16')]);}else{logger[_0x7415('0xe')](_0x7415('0xf'),_0x49b694,_0x7415('0x10'));_0x588c5a(_0x1a42df['result'][_0x7415('0x16')]);}})[_0x7415('0x17')](function(_0x2398d1){logger[_0x7415('0x14')]('MailServerIn,\x20%s,\x20%s',_0x49b694,_0x2398d1);_0x972b02(_0x2398d1);});});}exports[_0x7415('0x18')]=function(_0x2543f1){var _0x51efee=this;return new Promise(function(_0x302a2b,_0x510ae1){return db[_0x7415('0x19')][_0x7415('0x1a')]({'raw':_0x2543f1[_0x7415('0x1b')]?_0x2543f1[_0x7415('0x1b')][_0x7415('0x1c')]===undefined?!![]:![]:!![],'where':_0x2543f1[_0x7415('0x1b')]?_0x2543f1[_0x7415('0x1b')][_0x7415('0x1d')]||null:null,'attributes':_0x2543f1[_0x7415('0x1b')]?_0x2543f1[_0x7415('0x1b')][_0x7415('0x1e')]||null:null,'limit':_0x2543f1['options']?_0x2543f1['options'][_0x7415('0x1f')]||null:null,'include':_0x2543f1[_0x7415('0x1b')]?_0x2543f1[_0x7415('0x1b')][_0x7415('0x20')]?_['map'](_0x2543f1[_0x7415('0x1b')]['include'],function(_0x478abe){return{'model':db[_0x478abe[_0x7415('0x21')]],'as':_0x478abe['as'],'attributes':_0x478abe[_0x7415('0x1e')],'include':_0x478abe[_0x7415('0x20')]?_[_0x7415('0x22')](_0x478abe[_0x7415('0x20')],function(_0x24a554){return{'model':db[_0x24a554[_0x7415('0x21')]],'as':_0x24a554['as'],'attributes':_0x24a554[_0x7415('0x1e')],'include':_0x24a554[_0x7415('0x20')]?_[_0x7415('0x22')](_0x24a554['include'],function(_0x464f49){return{'model':db[_0x464f49[_0x7415('0x21')]],'as':_0x464f49['as'],'attributes':_0x464f49[_0x7415('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7415('0xd')](function(_0x28792b){logger['info'](_0x7415('0x18'),_0x2543f1);logger['debug'](_0x7415('0x18'),_0x2543f1,JSON[_0x7415('0x13')](_0x28792b));_0x302a2b(_0x28792b);})[_0x7415('0x17')](function(_0x31588b){logger['error'](_0x7415('0x18'),_0x31588b['message'],_0x2543f1);_0x510ae1(_0x51efee['error'](0x1f4,_0x31588b[_0x7415('0x16')]));});});}; \ No newline at end of file +var _0xad8a=['debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMailServerIn','findAll','options','raw','limit','include','map','model','attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','MailServerIn,\x20%s,\x20%s','request\x20sent'];(function(_0x1deef9,_0x51a983){var _0x4faf21=function(_0x8ba69){while(--_0x8ba69){_0x1deef9['push'](_0x1deef9['shift']());}};_0x4faf21(++_0x51a983);}(_0xad8a,0xb0));var _0xaad8=function(_0x3db83f,_0x2614a9){_0x3db83f=_0x3db83f-0x0;var _0x3d99c7=_0xad8a[_0x3db83f];return _0x3d99c7;};'use strict';var _=require(_0xaad8('0x0'));var util=require(_0xaad8('0x1'));var moment=require(_0xaad8('0x2'));var BPromise=require(_0xaad8('0x3'));var rs=require(_0xaad8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaad8('0x5'))['db'];var utils=require(_0xaad8('0x6'));var logger=require(_0xaad8('0x7'))('rpc');var config=require(_0xaad8('0x8'));var jayson=require(_0xaad8('0x9'));var client=jayson[_0xaad8('0xa')][_0xaad8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x95aef9,_0x39c599,_0x28f3a1){return new BPromise(function(_0xf3a6c7,_0x11408a){return client[_0xaad8('0xc')](_0x95aef9,_0x28f3a1)['then'](function(_0x52477f){logger[_0xaad8('0xd')](_0xaad8('0xe'),_0x39c599,_0xaad8('0xf'));logger[_0xaad8('0x10')](_0xaad8('0x11'),_0x39c599,_0xaad8('0xf'),JSON[_0xaad8('0x12')](_0x52477f));if(_0x52477f[_0xaad8('0x13')]){if(_0x52477f[_0xaad8('0x13')]['code']===0x1f4){logger[_0xaad8('0x13')](_0xaad8('0xe'),_0x39c599,_0x52477f[_0xaad8('0x13')][_0xaad8('0x14')]);return _0x11408a(_0x52477f[_0xaad8('0x13')][_0xaad8('0x14')]);}logger[_0xaad8('0x13')](_0xaad8('0xe'),_0x39c599,_0x52477f[_0xaad8('0x13')][_0xaad8('0x14')]);return _0xf3a6c7(_0x52477f[_0xaad8('0x13')][_0xaad8('0x14')]);}else{logger[_0xaad8('0xd')]('MailServerIn,\x20%s,\x20%s',_0x39c599,_0xaad8('0xf'));_0xf3a6c7(_0x52477f[_0xaad8('0x15')]['message']);}})[_0xaad8('0x16')](function(_0x2a8e12){logger[_0xaad8('0x13')](_0xaad8('0xe'),_0x39c599,_0x2a8e12);_0x11408a(_0x2a8e12);});});}exports[_0xaad8('0x17')]=function(_0x3895e2){var _0x535b82=this;return new Promise(function(_0xfd8b0a,_0x26684c){return db['MailServerIn'][_0xaad8('0x18')]({'raw':_0x3895e2['options']?_0x3895e2[_0xaad8('0x19')][_0xaad8('0x1a')]===undefined?!![]:![]:!![],'where':_0x3895e2[_0xaad8('0x19')]?_0x3895e2[_0xaad8('0x19')]['where']||null:null,'attributes':_0x3895e2[_0xaad8('0x19')]?_0x3895e2[_0xaad8('0x19')]['attributes']||null:null,'limit':_0x3895e2[_0xaad8('0x19')]?_0x3895e2[_0xaad8('0x19')][_0xaad8('0x1b')]||null:null,'include':_0x3895e2['options']?_0x3895e2['options'][_0xaad8('0x1c')]?_[_0xaad8('0x1d')](_0x3895e2[_0xaad8('0x19')][_0xaad8('0x1c')],function(_0x29ba69){return{'model':db[_0x29ba69[_0xaad8('0x1e')]],'as':_0x29ba69['as'],'attributes':_0x29ba69[_0xaad8('0x1f')],'include':_0x29ba69[_0xaad8('0x1c')]?_[_0xaad8('0x1d')](_0x29ba69[_0xaad8('0x1c')],function(_0x1bbac4){return{'model':db[_0x1bbac4[_0xaad8('0x1e')]],'as':_0x1bbac4['as'],'attributes':_0x1bbac4[_0xaad8('0x1f')],'include':_0x1bbac4[_0xaad8('0x1c')]?_[_0xaad8('0x1d')](_0x1bbac4['include'],function(_0x3d254e){return{'model':db[_0x3d254e[_0xaad8('0x1e')]],'as':_0x3d254e['as'],'attributes':_0x3d254e[_0xaad8('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x237c67){logger[_0xaad8('0xd')](_0xaad8('0x17'),_0x3895e2);logger[_0xaad8('0x10')](_0xaad8('0x17'),_0x3895e2,JSON['stringify'](_0x237c67));_0xfd8b0a(_0x237c67);})[_0xaad8('0x16')](function(_0x43c489){logger[_0xaad8('0x13')](_0xaad8('0x17'),_0x43c489[_0xaad8('0x14')],_0x3895e2);_0x26684c(_0x535b82['error'](0x1f4,_0x43c489[_0xaad8('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index deb1702..7cbe667 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_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('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x7a54,0x106));var _0x47a5=function(_0x2144dd,_0x52d9e8){_0x2144dd=_0x2144dd-0x0;var _0x519331=_0x7a54[_0x2144dd];return _0x519331;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index da85dd0..b40c12c 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 _0xd4f4=['exports','STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x54bdbc,_0x893959){var _0x4ee490=function(_0x5d58b0){while(--_0x5d58b0){_0x54bdbc['push'](_0x54bdbc['shift']());}};_0x4ee490(++_0x893959);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x222b78,_0x3c8166){_0x222b78=_0x222b78-0x0;var _0x5c05ee=_0xd4f4[_0x222b78];return _0x5c05ee;};'use strict';var Sequelize=require(_0x4d4f('0x0'));module[_0x4d4f('0x1')]={'description':{'type':Sequelize[_0x4d4f('0x2')]},'host':{'type':Sequelize[_0x4d4f('0x2')]},'user':{'type':Sequelize[_0x4d4f('0x2')]},'pass':{'type':Sequelize[_0x4d4f('0x2')]},'port':{'type':Sequelize[_0x4d4f('0x3')]},'secure':{'type':Sequelize[_0x4d4f('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x4d4f('0x2')]},'authentication':{'type':Sequelize[_0x4d4f('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x4d4f('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x1775=['STRING','INTEGER','BOOLEAN','exports'];(function(_0x181a6d,_0x74b05e){var _0x26c766=function(_0x2028df){while(--_0x2028df){_0x181a6d['push'](_0x181a6d['shift']());}};_0x26c766(++_0x74b05e);}(_0x1775,0x1db));var _0x5177=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1775[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0x5177('0x0')]={'description':{'type':Sequelize[_0x5177('0x1')]},'host':{'type':Sequelize[_0x5177('0x1')]},'user':{'type':Sequelize[_0x5177('0x1')]},'pass':{'type':Sequelize[_0x5177('0x1')]},'port':{'type':Sequelize[_0x5177('0x2')]},'secure':{'type':Sequelize[_0x5177('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x5177('0x1')]},'authentication':{'type':Sequelize[_0x5177('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x5177('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 476027f..ad35002 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 _0x74b8=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','save','then','end','error','name','index','map','MailServerOut','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','catch','show','params','find','create','body','update','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x516e7d,_0x5f14f2){var _0x4e3fad=function(_0x226853){while(--_0x226853){_0x516e7d['push'](_0x516e7d['shift']());}};_0x4e3fad(++_0x5f14f2);}(_0x74b8,0x81));var _0x874b=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x74b8[_0x5447fd];return _0x15b28a;};'use strict';var emlformat=require(_0x874b('0x0'));var rimraf=require(_0x874b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x874b('0x2'));var rp=require(_0x874b('0x3'));var moment=require('moment');var BPromise=require(_0x874b('0x4'));var Mustache=require(_0x874b('0x5'));var util=require('util');var path=require(_0x874b('0x6'));var sox=require('sox');var csv=require(_0x874b('0x7'));var ejs=require(_0x874b('0x8'));var fs=require('fs');var fs_extra=require(_0x874b('0x9'));var _=require(_0x874b('0xa'));var squel=require(_0x874b('0xb'));var crypto=require(_0x874b('0xc'));var jsforce=require(_0x874b('0xd'));var deskjs=require(_0x874b('0xe'));var toCsv=require('to-csv');var querystring=require(_0x874b('0xf'));var Papa=require('papaparse');var Redis=require(_0x874b('0x10'));var authService=require(_0x874b('0x11'));var qs=require(_0x874b('0x12'));var as=require(_0x874b('0x13'));var hardwareService=require(_0x874b('0x14'));var logger=require(_0x874b('0x15'))('api');var utils=require(_0x874b('0x16'));var config=require(_0x874b('0x17'));var licenseUtil=require(_0x874b('0x18'));var db=require(_0x874b('0x19'))['db'];function respondWithStatusCode(_0x1c8221,_0x5a1802){_0x5a1802=_0x5a1802||0xcc;return function(_0x1d2441){if(_0x1d2441){return _0x1c8221[_0x874b('0x1a')](_0x5a1802);}return _0x1c8221[_0x874b('0x1b')](_0x5a1802)['end']();};}function respondWithResult(_0x1443d6,_0x1118e5){_0x1118e5=_0x1118e5||0xc8;return function(_0x139a56){if(_0x139a56){return _0x1443d6[_0x874b('0x1b')](_0x1118e5)[_0x874b('0x1c')](_0x139a56);}};}function respondWithFilteredResult(_0x4a361d,_0x385f76){return function(_0x18e0ce){if(_0x18e0ce){var _0x12e6aa=typeof _0x385f76[_0x874b('0x1d')]===_0x874b('0x1e')&&typeof _0x385f76[_0x874b('0x1f')]==='undefined';var _0x204b66=_0x18e0ce[_0x874b('0x20')];var _0x4bcf65=_0x12e6aa?0x0:_0x385f76[_0x874b('0x1d')];var _0x3b8586=_0x12e6aa?_0x18e0ce[_0x874b('0x20')]:_0x385f76[_0x874b('0x1d')]+_0x385f76['limit'];var _0x7341b9;if(_0x3b8586>=_0x204b66){_0x3b8586=_0x204b66;_0x7341b9=0xc8;}else{_0x7341b9=0xce;}_0x4a361d[_0x874b('0x1b')](_0x7341b9);return _0x4a361d['set'](_0x874b('0x21'),_0x4bcf65+'-'+_0x3b8586+'/'+_0x204b66)[_0x874b('0x1c')](_0x18e0ce);}return null;};}function patchUpdates(_0x296c5){return function(_0x5b75ed){try{jsonpatch['apply'](_0x5b75ed,_0x296c5,!![]);}catch(_0x2d1f52){return BPromise['reject'](_0x2d1f52);}return _0x5b75ed[_0x874b('0x22')]();};}function saveUpdates(_0x2fb0b5,_0x577559){return function(_0x35122e){if(_0x35122e){return _0x35122e['update'](_0x2fb0b5)[_0x874b('0x23')](function(_0x48d790){return _0x48d790;});}return null;};}function removeEntity(_0x2fb1b5,_0x337247){return function(_0x54e3f1){if(_0x54e3f1){return _0x54e3f1['destroy']()[_0x874b('0x23')](function(){_0x2fb1b5[_0x874b('0x1b')](0xcc)[_0x874b('0x24')]();});}};}function handleEntityNotFound(_0x402df4,_0x275d95){return function(_0x1f0157){if(!_0x1f0157){_0x402df4['sendStatus'](0x194);}return _0x1f0157;};}function handleError(_0x3b5556,_0x2a9023){_0x2a9023=_0x2a9023||0x1f4;return function(_0x59b22b){logger[_0x874b('0x25')](_0x59b22b['stack']);if(_0x59b22b[_0x874b('0x26')]){delete _0x59b22b[_0x874b('0x26')];}_0x3b5556[_0x874b('0x1b')](_0x2a9023)['send'](_0x59b22b);};}exports[_0x874b('0x27')]=function(_0x55a8f3,_0x336c2f){var _0x5ab6c8={},_0x37cbb8={},_0x4fc6e4={'count':0x0,'rows':[]};var _0x8175ad=_[_0x874b('0x28')](db[_0x874b('0x29')][_0x874b('0x2a')],function(_0x3816ab){return{'name':_0x3816ab[_0x874b('0x2b')],'type':_0x3816ab[_0x874b('0x2c')][_0x874b('0x2d')]};});_0x37cbb8[_0x874b('0x2e')]=_[_0x874b('0x28')](_0x8175ad,_0x874b('0x26'));_0x37cbb8[_0x874b('0x2f')]=_[_0x874b('0x30')](_0x55a8f3['query']);_0x37cbb8[_0x874b('0x31')]=_[_0x874b('0x32')](_0x37cbb8[_0x874b('0x2e')],_0x37cbb8[_0x874b('0x2f')]);_0x5ab6c8[_0x874b('0x33')]=_['intersection'](_0x37cbb8[_0x874b('0x2e')],qs[_0x874b('0x34')](_0x55a8f3[_0x874b('0x2f')][_0x874b('0x34')]));_0x5ab6c8[_0x874b('0x33')]=_0x5ab6c8[_0x874b('0x33')][_0x874b('0x35')]?_0x5ab6c8[_0x874b('0x33')]:_0x37cbb8[_0x874b('0x2e')];if(!_0x55a8f3[_0x874b('0x2f')][_0x874b('0x36')](_0x874b('0x37'))){_0x5ab6c8['limit']=qs['limit'](_0x55a8f3['query'][_0x874b('0x1f')]);_0x5ab6c8['offset']=qs['offset'](_0x55a8f3[_0x874b('0x2f')][_0x874b('0x1d')]);}_0x5ab6c8[_0x874b('0x38')]=qs[_0x874b('0x39')](_0x55a8f3[_0x874b('0x2f')][_0x874b('0x39')]);_0x5ab6c8[_0x874b('0x3a')]=qs[_0x874b('0x31')](_[_0x874b('0x3b')](_0x55a8f3[_0x874b('0x2f')],_0x37cbb8['filters']),_0x8175ad);if(_0x55a8f3[_0x874b('0x2f')][_0x874b('0x3c')]){_0x5ab6c8['where']=_[_0x874b('0x3d')](_0x5ab6c8[_0x874b('0x3a')],{'$or':_['map'](_0x8175ad,function(_0x122a8f){if(_0x122a8f[_0x874b('0x2c')]!==_0x874b('0x3e')){var _0x5258cd={};_0x5258cd[_0x122a8f['name']]={'$like':'%'+_0x55a8f3[_0x874b('0x2f')]['filter']+'%'};return _0x5258cd;}})});}_0x5ab6c8=_[_0x874b('0x3d')]({},_0x5ab6c8,_0x55a8f3['options']);var _0x5f2133={'where':_0x5ab6c8[_0x874b('0x3a')]};return db[_0x874b('0x29')]['count'](_0x5f2133)['then'](function(_0x4fad29){_0x4fc6e4['count']=_0x4fad29;if(_0x55a8f3['query'][_0x874b('0x3f')]){_0x5ab6c8['include']=[{'all':!![]}];}return db[_0x874b('0x29')]['findAll'](_0x5ab6c8);})[_0x874b('0x23')](function(_0x261f8e){_0x4fc6e4[_0x874b('0x40')]=_0x261f8e;return _0x4fc6e4;})[_0x874b('0x23')](respondWithFilteredResult(_0x336c2f,_0x5ab6c8))[_0x874b('0x41')](handleError(_0x336c2f,null));};exports[_0x874b('0x42')]=function(_0x5653f5,_0x4e4fcd){var _0x263fd1={'raw':!![],'where':{'id':_0x5653f5[_0x874b('0x43')]['id']}},_0x2e841e={};_0x2e841e['model']=_['keys'](db[_0x874b('0x29')]['rawAttributes']);_0x2e841e[_0x874b('0x2f')]=_[_0x874b('0x30')](_0x5653f5[_0x874b('0x2f')]);_0x2e841e[_0x874b('0x31')]=_[_0x874b('0x32')](_0x2e841e[_0x874b('0x2e')],_0x2e841e['query']);_0x263fd1['attributes']=_['intersection'](_0x2e841e[_0x874b('0x2e')],qs[_0x874b('0x34')](_0x5653f5[_0x874b('0x2f')]['fields']));_0x263fd1[_0x874b('0x33')]=_0x263fd1[_0x874b('0x33')]['length']?_0x263fd1[_0x874b('0x33')]:_0x2e841e[_0x874b('0x2e')];if(_0x5653f5[_0x874b('0x2f')][_0x874b('0x3f')]){_0x263fd1['include']=[{'all':!![]}];}_0x263fd1=_[_0x874b('0x3d')]({},_0x263fd1,_0x5653f5['options']);return db[_0x874b('0x29')][_0x874b('0x44')](_0x263fd1)[_0x874b('0x23')](handleEntityNotFound(_0x4e4fcd,null))[_0x874b('0x23')](respondWithResult(_0x4e4fcd,null))['catch'](handleError(_0x4e4fcd,null));};exports['create']=function(_0xde6cc9,_0x599414){return db['MailServerOut'][_0x874b('0x45')](_0xde6cc9[_0x874b('0x46')],{})[_0x874b('0x23')](respondWithResult(_0x599414,0xc9))[_0x874b('0x41')](handleError(_0x599414,null));};exports[_0x874b('0x47')]=function(_0x1e0786,_0x2f427d){if(_0x1e0786[_0x874b('0x46')]['id']){delete _0x1e0786[_0x874b('0x46')]['id'];}return db[_0x874b('0x29')][_0x874b('0x44')]({'where':{'id':_0x1e0786['params']['id']}})[_0x874b('0x23')](handleEntityNotFound(_0x2f427d,null))['then'](saveUpdates(_0x1e0786[_0x874b('0x46')],null))[_0x874b('0x23')](respondWithResult(_0x2f427d,null))['catch'](handleError(_0x2f427d,null));};exports['destroy']=function(_0x54cb9e,_0x5316d){return db[_0x874b('0x29')][_0x874b('0x44')]({'where':{'id':_0x54cb9e[_0x874b('0x43')]['id']}})[_0x874b('0x23')](handleEntityNotFound(_0x5316d,null))[_0x874b('0x23')](removeEntity(_0x5316d,null))[_0x874b('0x41')](handleError(_0x5316d,null));}; \ No newline at end of file +var _0x71bb=['zip-dir','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','MailServerOut','rawAttributes','fieldName','key','map','keys','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','rimraf'];(function(_0x116170,_0x52d23e){var _0x12b47b=function(_0x3c167a){while(--_0x3c167a){_0x116170['push'](_0x116170['shift']());}};_0x12b47b(++_0x52d23e);}(_0x71bb,0x176));var _0xb71b=function(_0x5eb7df,_0x199b27){_0x5eb7df=_0x5eb7df-0x0;var _0x13daa9=_0x71bb[_0x5eb7df];return _0x13daa9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb71b('0x0'));var zipdir=require(_0xb71b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb71b('0x2'));var moment=require('moment');var BPromise=require(_0xb71b('0x3'));var Mustache=require(_0xb71b('0x4'));var util=require('util');var path=require(_0xb71b('0x5'));var sox=require(_0xb71b('0x6'));var csv=require('to-csv');var ejs=require(_0xb71b('0x7'));var fs=require('fs');var fs_extra=require(_0xb71b('0x8'));var _=require(_0xb71b('0x9'));var squel=require(_0xb71b('0xa'));var crypto=require(_0xb71b('0xb'));var jsforce=require(_0xb71b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb71b('0xd'));var querystring=require(_0xb71b('0xe'));var Papa=require(_0xb71b('0xf'));var Redis=require(_0xb71b('0x10'));var authService=require(_0xb71b('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb71b('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xb71b('0x13'));var config=require(_0xb71b('0x14'));var licenseUtil=require(_0xb71b('0x15'));var db=require(_0xb71b('0x16'))['db'];function respondWithStatusCode(_0x5ed632,_0x526094){_0x526094=_0x526094||0xcc;return function(_0x5bdfee){if(_0x5bdfee){return _0x5ed632[_0xb71b('0x17')](_0x526094);}return _0x5ed632[_0xb71b('0x18')](_0x526094)[_0xb71b('0x19')]();};}function respondWithResult(_0x2beb3d,_0x17195a){_0x17195a=_0x17195a||0xc8;return function(_0x5df4ee){if(_0x5df4ee){return _0x2beb3d[_0xb71b('0x18')](_0x17195a)[_0xb71b('0x1a')](_0x5df4ee);}};}function respondWithFilteredResult(_0x4d0ab2,_0x431b47){return function(_0x177d58){if(_0x177d58){var _0x1462d0=typeof _0x431b47[_0xb71b('0x1b')]===_0xb71b('0x1c')&&typeof _0x431b47[_0xb71b('0x1d')]===_0xb71b('0x1c');var _0x2c36b9=_0x177d58[_0xb71b('0x1e')];var _0x1bb1ff=_0x1462d0?0x0:_0x431b47[_0xb71b('0x1b')];var _0xaa495e=_0x1462d0?_0x177d58[_0xb71b('0x1e')]:_0x431b47[_0xb71b('0x1b')]+_0x431b47[_0xb71b('0x1d')];var _0x2b3e69;if(_0xaa495e>=_0x2c36b9){_0xaa495e=_0x2c36b9;_0x2b3e69=0xc8;}else{_0x2b3e69=0xce;}_0x4d0ab2['status'](_0x2b3e69);return _0x4d0ab2['set'](_0xb71b('0x1f'),_0x1bb1ff+'-'+_0xaa495e+'/'+_0x2c36b9)[_0xb71b('0x1a')](_0x177d58);}return null;};}function patchUpdates(_0x488542){return function(_0x34bce4){try{jsonpatch[_0xb71b('0x20')](_0x34bce4,_0x488542,!![]);}catch(_0x7cde97){return BPromise[_0xb71b('0x21')](_0x7cde97);}return _0x34bce4[_0xb71b('0x22')]();};}function saveUpdates(_0xc9616b,_0x13b0d6){return function(_0x556298){if(_0x556298){return _0x556298[_0xb71b('0x23')](_0xc9616b)[_0xb71b('0x24')](function(_0x4dbb86){return _0x4dbb86;});}return null;};}function removeEntity(_0x13cd98,_0x1b73dc){return function(_0x4e8bcd){if(_0x4e8bcd){return _0x4e8bcd[_0xb71b('0x25')]()[_0xb71b('0x24')](function(){_0x13cd98[_0xb71b('0x18')](0xcc)[_0xb71b('0x19')]();});}};}function handleEntityNotFound(_0x1832bb,_0xa9d0f7){return function(_0x5cfc1d){if(!_0x5cfc1d){_0x1832bb['sendStatus'](0x194);}return _0x5cfc1d;};}function handleError(_0x5a57b8,_0x162f6a){_0x162f6a=_0x162f6a||0x1f4;return function(_0x1a6562){logger[_0xb71b('0x26')](_0x1a6562[_0xb71b('0x27')]);if(_0x1a6562[_0xb71b('0x28')]){delete _0x1a6562[_0xb71b('0x28')];}_0x5a57b8[_0xb71b('0x18')](_0x162f6a)[_0xb71b('0x29')](_0x1a6562);};}exports[_0xb71b('0x2a')]=function(_0x47aea5,_0x5a2f71){var _0xe216e3={},_0xba73be={},_0x1f1cb0={'count':0x0,'rows':[]};var _0x5a1ace=_['map'](db[_0xb71b('0x2b')][_0xb71b('0x2c')],function(_0x2c090f){return{'name':_0x2c090f[_0xb71b('0x2d')],'type':_0x2c090f['type'][_0xb71b('0x2e')]};});_0xba73be['model']=_[_0xb71b('0x2f')](_0x5a1ace,_0xb71b('0x28'));_0xba73be['query']=_[_0xb71b('0x30')](_0x47aea5[_0xb71b('0x31')]);_0xba73be[_0xb71b('0x32')]=_[_0xb71b('0x33')](_0xba73be['model'],_0xba73be[_0xb71b('0x31')]);_0xe216e3[_0xb71b('0x34')]=_[_0xb71b('0x33')](_0xba73be[_0xb71b('0x35')],qs['fields'](_0x47aea5[_0xb71b('0x31')][_0xb71b('0x36')]));_0xe216e3['attributes']=_0xe216e3[_0xb71b('0x34')][_0xb71b('0x37')]?_0xe216e3[_0xb71b('0x34')]:_0xba73be[_0xb71b('0x35')];if(!_0x47aea5[_0xb71b('0x31')]['hasOwnProperty'](_0xb71b('0x38'))){_0xe216e3[_0xb71b('0x1d')]=qs[_0xb71b('0x1d')](_0x47aea5[_0xb71b('0x31')][_0xb71b('0x1d')]);_0xe216e3[_0xb71b('0x1b')]=qs[_0xb71b('0x1b')](_0x47aea5[_0xb71b('0x31')][_0xb71b('0x1b')]);}_0xe216e3[_0xb71b('0x39')]=qs[_0xb71b('0x3a')](_0x47aea5[_0xb71b('0x31')][_0xb71b('0x3a')]);_0xe216e3['where']=qs['filters'](_[_0xb71b('0x3b')](_0x47aea5['query'],_0xba73be[_0xb71b('0x32')]),_0x5a1ace);if(_0x47aea5[_0xb71b('0x31')][_0xb71b('0x3c')]){_0xe216e3[_0xb71b('0x3d')]=_[_0xb71b('0x3e')](_0xe216e3[_0xb71b('0x3d')],{'$or':_['map'](_0x5a1ace,function(_0x48af29){if(_0x48af29['type']!==_0xb71b('0x3f')){var _0x336d6a={};_0x336d6a[_0x48af29['name']]={'$like':'%'+_0x47aea5['query'][_0xb71b('0x3c')]+'%'};return _0x336d6a;}})});}_0xe216e3=_['merge']({},_0xe216e3,_0x47aea5['options']);var _0x5e0451={'where':_0xe216e3[_0xb71b('0x3d')]};return db[_0xb71b('0x2b')][_0xb71b('0x1e')](_0x5e0451)['then'](function(_0x2f9720){_0x1f1cb0[_0xb71b('0x1e')]=_0x2f9720;if(_0x47aea5[_0xb71b('0x31')][_0xb71b('0x40')]){_0xe216e3[_0xb71b('0x41')]=[{'all':!![]}];}return db[_0xb71b('0x2b')][_0xb71b('0x42')](_0xe216e3);})['then'](function(_0x5d6fa4){_0x1f1cb0[_0xb71b('0x43')]=_0x5d6fa4;return _0x1f1cb0;})[_0xb71b('0x24')](respondWithFilteredResult(_0x5a2f71,_0xe216e3))[_0xb71b('0x44')](handleError(_0x5a2f71,null));};exports[_0xb71b('0x45')]=function(_0x86ee8d,_0xd13d13){var _0x28d7e8={'raw':!![],'where':{'id':_0x86ee8d['params']['id']}},_0x52a2d0={};_0x52a2d0[_0xb71b('0x35')]=_[_0xb71b('0x30')](db[_0xb71b('0x2b')][_0xb71b('0x2c')]);_0x52a2d0[_0xb71b('0x31')]=_[_0xb71b('0x30')](_0x86ee8d[_0xb71b('0x31')]);_0x52a2d0[_0xb71b('0x32')]=_[_0xb71b('0x33')](_0x52a2d0[_0xb71b('0x35')],_0x52a2d0[_0xb71b('0x31')]);_0x28d7e8[_0xb71b('0x34')]=_[_0xb71b('0x33')](_0x52a2d0['model'],qs[_0xb71b('0x36')](_0x86ee8d[_0xb71b('0x31')][_0xb71b('0x36')]));_0x28d7e8[_0xb71b('0x34')]=_0x28d7e8[_0xb71b('0x34')][_0xb71b('0x37')]?_0x28d7e8[_0xb71b('0x34')]:_0x52a2d0['model'];if(_0x86ee8d[_0xb71b('0x31')][_0xb71b('0x40')]){_0x28d7e8[_0xb71b('0x41')]=[{'all':!![]}];}_0x28d7e8=_[_0xb71b('0x3e')]({},_0x28d7e8,_0x86ee8d[_0xb71b('0x46')]);return db['MailServerOut'][_0xb71b('0x47')](_0x28d7e8)[_0xb71b('0x24')](handleEntityNotFound(_0xd13d13,null))['then'](respondWithResult(_0xd13d13,null))[_0xb71b('0x44')](handleError(_0xd13d13,null));};exports[_0xb71b('0x48')]=function(_0x52c7fe,_0x43fa7a){return db['MailServerOut'][_0xb71b('0x48')](_0x52c7fe[_0xb71b('0x49')],{})[_0xb71b('0x24')](respondWithResult(_0x43fa7a,0xc9))[_0xb71b('0x44')](handleError(_0x43fa7a,null));};exports[_0xb71b('0x23')]=function(_0x1257c9,_0x2daeb2){if(_0x1257c9[_0xb71b('0x49')]['id']){delete _0x1257c9[_0xb71b('0x49')]['id'];}return db['MailServerOut'][_0xb71b('0x47')]({'where':{'id':_0x1257c9[_0xb71b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2daeb2,null))[_0xb71b('0x24')](saveUpdates(_0x1257c9[_0xb71b('0x49')],null))['then'](respondWithResult(_0x2daeb2,null))[_0xb71b('0x44')](handleError(_0x2daeb2,null));};exports['destroy']=function(_0x20a4fb,_0x548131){return db['MailServerOut'][_0xb71b('0x47')]({'where':{'id':_0x20a4fb[_0xb71b('0x4a')]['id']}})[_0xb71b('0x24')](handleEntityNotFound(_0x548131,null))[_0xb71b('0x24')](removeEntity(_0x548131,null))[_0xb71b('0x44')](handleError(_0x548131,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 732763b..a3dcee8 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 _0x0e2d=['request-promise','path','rimraf','./mailServerOut.attributes','define','mail_servers_out','lodash','util','../../config/logger','api','moment'];(function(_0x29aeb2,_0x48d202){var _0x381f10=function(_0x241ed4){while(--_0x241ed4){_0x29aeb2['push'](_0x29aeb2['shift']());}};_0x381f10(++_0x48d202);}(_0x0e2d,0xab));var _0xd0e2=function(_0x1dc779,_0x362048){_0x1dc779=_0x1dc779-0x0;var _0x41976d=_0x0e2d[_0x1dc779];return _0x41976d;};'use strict';var _=require(_0xd0e2('0x0'));var util=require(_0xd0e2('0x1'));var logger=require(_0xd0e2('0x2'))(_0xd0e2('0x3'));var moment=require(_0xd0e2('0x4'));var BPromise=require('bluebird');var rp=require(_0xd0e2('0x5'));var fs=require('fs');var path=require(_0xd0e2('0x6'));var rimraf=require(_0xd0e2('0x7'));var config=require('../../config/environment');var attributes=require(_0xd0e2('0x8'));module['exports']=function(_0x5f3df6,_0xd0f5b8){return _0x5f3df6[_0xd0e2('0x9')]('MailServerOut',attributes,{'tableName':_0xd0e2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x193c=['MailServerOut','mail_servers_out','lodash','util','api','moment','bluebird','request-promise','path','define'];(function(_0x35c627,_0x4a2520){var _0x4f2ce5=function(_0x4196bb){while(--_0x4196bb){_0x35c627['push'](_0x35c627['shift']());}};_0x4f2ce5(++_0x4a2520);}(_0x193c,0x1ce));var _0xc193=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x193c[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xc193('0x0'));var util=require(_0xc193('0x1'));var logger=require('../../config/logger')(_0xc193('0x2'));var moment=require(_0xc193('0x3'));var BPromise=require(_0xc193('0x4'));var rp=require(_0xc193('0x5'));var fs=require('fs');var path=require(_0xc193('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailServerOut.attributes');module['exports']=function(_0x259150,_0x50d468){return _0x259150[_0xc193('0x7')](_0xc193('0x8'),attributes,{'tableName':_0xc193('0x9'),'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 5a78ed5..28e3e3c 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x230078,_0x40e1b4){var _0x379ab7=function(_0x39675e){while(--_0x39675e){_0x230078['push'](_0x230078['shift']());}};_0x379ab7(++_0x40e1b4);}(_0xadb5,0xad));var _0x5adb=function(_0x36b0a6,_0x1b581e){_0x36b0a6=_0x36b0a6-0x0;var _0x3935ce=_0xadb5[_0x36b0a6];return _0x3935ce;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0xd2a93a,_0x5cfc39){var _0x41d6f4=function(_0x1a1020){while(--_0x1a1020){_0xd2a93a['push'](_0xd2a93a['shift']());}};_0x41d6f4(++_0x5cfc39);}(_0xdb28,0x106));var _0x8db2=function(_0x8cf4d6,_0x58be29){_0x8cf4d6=_0x8cf4d6-0x0;var _0x2e0793=_0xdb28[_0x8cf4d6];return _0x2e0793;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 372ed2f..e22c50c 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 _0x54a4=['util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','create','put','update','delete','destroy','exports','multer'];(function(_0x58f8a7,_0xbd36a7){var _0x149b97=function(_0x1def61){while(--_0x1def61){_0x58f8a7['push'](_0x58f8a7['shift']());}};_0x149b97(++_0xbd36a7);}(_0x54a4,0x125));var _0x454a=function(_0x1af1ba,_0xbd3104){_0x1af1ba=_0x1af1ba-0x0;var _0x37d83b=_0x54a4[_0x1af1ba];return _0x37d83b;};'use strict';var multer=require(_0x454a('0x0'));var util=require(_0x454a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x454a('0x2'));var router=express[_0x454a('0x3')]();var fs_extra=require(_0x454a('0x4'));var auth=require(_0x454a('0x5'));var interaction=require(_0x454a('0x6'));var config=require(_0x454a('0x7'));var controller=require(_0x454a('0x8'));router[_0x454a('0x9')]('/',auth[_0x454a('0xa')](),controller[_0x454a('0xb')]);router[_0x454a('0x9')](_0x454a('0xc'),auth[_0x454a('0xa')](),controller[_0x454a('0xd')]);router['get'](_0x454a('0xe'),auth[_0x454a('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x454a('0xf')]);router[_0x454a('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x454a('0x11')]);router[_0x454a('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x454a('0x13')]);module[_0x454a('0x14')]=router; \ No newline at end of file +var _0x4077=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete','destroy','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4077,0xcf));var _0x7407=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4077[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7407('0x0'));var util=require(_0x7407('0x1'));var path=require(_0x7407('0x2'));var timeout=require(_0x7407('0x3'));var express=require(_0x7407('0x4'));var router=express[_0x7407('0x5')]();var fs_extra=require(_0x7407('0x6'));var auth=require(_0x7407('0x7'));var interaction=require(_0x7407('0x8'));var config=require('../../config/environment');var controller=require('./mailSubstatus.controller');router[_0x7407('0x9')]('/',auth[_0x7407('0xa')](),controller[_0x7407('0xb')]);router[_0x7407('0x9')](_0x7407('0xc'),auth['isAuthenticated'](),controller[_0x7407('0xd')]);router[_0x7407('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x7407('0xe')]);router[_0x7407('0xf')]('/',auth[_0x7407('0xa')](),controller[_0x7407('0x10')]);router[_0x7407('0x11')](_0x7407('0x12'),auth[_0x7407('0xa')](),controller[_0x7407('0x13')]);router[_0x7407('0x14')]('/:id',auth[_0x7407('0xa')](),controller[_0x7407('0x15')]);module[_0x7407('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 4bf29ec..61865b8 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 _0x687b=['STRING','name','sequelize','exports'];(function(_0x312cc0,_0x1e801f){var _0xb557f8=function(_0x145655){while(--_0x145655){_0x312cc0['push'](_0x312cc0['shift']());}};_0xb557f8(++_0x1e801f);}(_0x687b,0x14a));var _0xb687=function(_0x38e8b0,_0x5b8cb5){_0x38e8b0=_0x38e8b0-0x0;var _0x139697=_0x687b[_0x38e8b0];return _0x139697;};'use strict';var Sequelize=require(_0xb687('0x0'));module[_0xb687('0x1')]={'name':{'type':Sequelize[_0xb687('0x2')],'unique':_0xb687('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfc46=['name','sequelize','STRING'];(function(_0x5e33f6,_0x2e18e6){var _0x20cb0f=function(_0x358e5c){while(--_0x358e5c){_0x5e33f6['push'](_0x5e33f6['shift']());}};_0x20cb0f(++_0x2e18e6);}(_0xfc46,0x9a));var _0x6fc4=function(_0x228641,_0x25d636){_0x228641=_0x228641-0x0;var _0x5d5d78=_0xfc46[_0x228641];return _0x5d5d78;};'use strict';var Sequelize=require(_0x6fc4('0x0'));module['exports']={'name':{'type':Sequelize[_0x6fc4('0x1')],'unique':_0x6fc4('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6fc4('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index bc5dedb..4a1655c 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 _0x3d91=['destroy','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','include','findAll','rows','catch','params','keys','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','save','update','then'];(function(_0x3dea7d,_0x2cd4ea){var _0x53919a=function(_0x1554e2){while(--_0x1554e2){_0x3dea7d['push'](_0x3dea7d['shift']());}};_0x53919a(++_0x2cd4ea);}(_0x3d91,0x6f));var _0x13d9=function(_0x20f08b,_0x646ea0){_0x20f08b=_0x20f08b-0x0;var _0x675062=_0x3d91[_0x20f08b];return _0x675062;};'use strict';var emlformat=require(_0x13d9('0x0'));var rimraf=require(_0x13d9('0x1'));var zipdir=require(_0x13d9('0x2'));var jsonpatch=require(_0x13d9('0x3'));var rp=require(_0x13d9('0x4'));var moment=require(_0x13d9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x13d9('0x6'));var util=require('util');var path=require(_0x13d9('0x7'));var sox=require(_0x13d9('0x8'));var csv=require(_0x13d9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x13d9('0xa'));var _=require('lodash');var squel=require(_0x13d9('0xb'));var crypto=require(_0x13d9('0xc'));var jsforce=require(_0x13d9('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x13d9('0xe'));var Papa=require(_0x13d9('0xf'));var Redis=require('ioredis');var authService=require(_0x13d9('0x10'));var qs=require(_0x13d9('0x11'));var as=require(_0x13d9('0x12'));var hardwareService=require(_0x13d9('0x13'));var logger=require('../../config/logger')(_0x13d9('0x14'));var utils=require(_0x13d9('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x13d9('0x16'))['db'];function respondWithStatusCode(_0x7a0ec,_0x514c2c){_0x514c2c=_0x514c2c||0xcc;return function(_0x51fd20){if(_0x51fd20){return _0x7a0ec[_0x13d9('0x17')](_0x514c2c);}return _0x7a0ec[_0x13d9('0x18')](_0x514c2c)[_0x13d9('0x19')]();};}function respondWithResult(_0x5e89c0,_0x41d3cf){_0x41d3cf=_0x41d3cf||0xc8;return function(_0x8ec2e0){if(_0x8ec2e0){return _0x5e89c0[_0x13d9('0x18')](_0x41d3cf)[_0x13d9('0x1a')](_0x8ec2e0);}};}function respondWithFilteredResult(_0x492a9b,_0x591cfb){return function(_0x26fee4){if(_0x26fee4){var _0x20fa73=typeof _0x591cfb[_0x13d9('0x1b')]===_0x13d9('0x1c')&&typeof _0x591cfb['limit']==='undefined';var _0x18228c=_0x26fee4[_0x13d9('0x1d')];var _0x51911e=_0x20fa73?0x0:_0x591cfb[_0x13d9('0x1b')];var _0x295904=_0x20fa73?_0x26fee4[_0x13d9('0x1d')]:_0x591cfb[_0x13d9('0x1b')]+_0x591cfb[_0x13d9('0x1e')];var _0x54a59e;if(_0x295904>=_0x18228c){_0x295904=_0x18228c;_0x54a59e=0xc8;}else{_0x54a59e=0xce;}_0x492a9b[_0x13d9('0x18')](_0x54a59e);return _0x492a9b[_0x13d9('0x1f')]('Content-Range',_0x51911e+'-'+_0x295904+'/'+_0x18228c)['json'](_0x26fee4);}return null;};}function patchUpdates(_0x39f07e){return function(_0x37ac09){try{jsonpatch['apply'](_0x37ac09,_0x39f07e,!![]);}catch(_0x363b99){return BPromise['reject'](_0x363b99);}return _0x37ac09[_0x13d9('0x20')]();};}function saveUpdates(_0x20cbbd,_0xecca5a){return function(_0x2ccad9){if(_0x2ccad9){return _0x2ccad9[_0x13d9('0x21')](_0x20cbbd)[_0x13d9('0x22')](function(_0x2a0076){return _0x2a0076;});}return null;};}function removeEntity(_0x481329,_0x2321ec){return function(_0xd9f0f7){if(_0xd9f0f7){return _0xd9f0f7[_0x13d9('0x23')]()[_0x13d9('0x22')](function(){_0x481329[_0x13d9('0x18')](0xcc)[_0x13d9('0x19')]();});}};}function handleEntityNotFound(_0x47f917,_0x59ba13){return function(_0x48b633){if(!_0x48b633){_0x47f917['sendStatus'](0x194);}return _0x48b633;};}function handleError(_0x4214ab,_0x190184){_0x190184=_0x190184||0x1f4;return function(_0x251186){logger['error'](_0x251186[_0x13d9('0x24')]);if(_0x251186['name']){delete _0x251186[_0x13d9('0x25')];}_0x4214ab[_0x13d9('0x18')](_0x190184)[_0x13d9('0x26')](_0x251186);};}exports[_0x13d9('0x27')]=function(_0x57722a,_0x4adf3b){var _0x969a09={},_0x59475a={},_0x56619e={'count':0x0,'rows':[]};var _0x391087=_[_0x13d9('0x28')](db[_0x13d9('0x29')][_0x13d9('0x2a')],function(_0x3ffc47){return{'name':_0x3ffc47[_0x13d9('0x2b')],'type':_0x3ffc47[_0x13d9('0x2c')]['key']};});_0x59475a[_0x13d9('0x2d')]=_[_0x13d9('0x28')](_0x391087,_0x13d9('0x25'));_0x59475a[_0x13d9('0x2e')]=_['keys'](_0x57722a[_0x13d9('0x2e')]);_0x59475a['filters']=_[_0x13d9('0x2f')](_0x59475a[_0x13d9('0x2d')],_0x59475a[_0x13d9('0x2e')]);_0x969a09[_0x13d9('0x30')]=_[_0x13d9('0x2f')](_0x59475a[_0x13d9('0x2d')],qs[_0x13d9('0x31')](_0x57722a['query'][_0x13d9('0x31')]));_0x969a09[_0x13d9('0x30')]=_0x969a09[_0x13d9('0x30')][_0x13d9('0x32')]?_0x969a09['attributes']:_0x59475a['model'];if(!_0x57722a[_0x13d9('0x2e')][_0x13d9('0x33')](_0x13d9('0x34'))){_0x969a09['limit']=qs[_0x13d9('0x1e')](_0x57722a[_0x13d9('0x2e')][_0x13d9('0x1e')]);_0x969a09['offset']=qs['offset'](_0x57722a['query'][_0x13d9('0x1b')]);}_0x969a09[_0x13d9('0x35')]=qs['sort'](_0x57722a[_0x13d9('0x2e')][_0x13d9('0x36')]);_0x969a09['where']=qs[_0x13d9('0x37')](_[_0x13d9('0x38')](_0x57722a[_0x13d9('0x2e')],_0x59475a[_0x13d9('0x37')]),_0x391087);if(_0x57722a[_0x13d9('0x2e')][_0x13d9('0x39')]){_0x969a09[_0x13d9('0x3a')]=_['merge'](_0x969a09[_0x13d9('0x3a')],{'$or':_[_0x13d9('0x28')](_0x391087,function(_0x35fc60){if(_0x35fc60['type']!==_0x13d9('0x3b')){var _0x3ce31d={};_0x3ce31d[_0x35fc60[_0x13d9('0x25')]]={'$like':'%'+_0x57722a[_0x13d9('0x2e')][_0x13d9('0x39')]+'%'};return _0x3ce31d;}})});}_0x969a09=_[_0x13d9('0x3c')]({},_0x969a09,_0x57722a[_0x13d9('0x3d')]);var _0x491631={'where':_0x969a09[_0x13d9('0x3a')]};return db[_0x13d9('0x29')]['count'](_0x491631)['then'](function(_0x3cca98){_0x56619e[_0x13d9('0x1d')]=_0x3cca98;if(_0x57722a[_0x13d9('0x2e')]['includeAll']){_0x969a09[_0x13d9('0x3e')]=[{'all':!![]}];}return db[_0x13d9('0x29')][_0x13d9('0x3f')](_0x969a09);})[_0x13d9('0x22')](function(_0x2fd098){_0x56619e[_0x13d9('0x40')]=_0x2fd098;return _0x56619e;})[_0x13d9('0x22')](respondWithFilteredResult(_0x4adf3b,_0x969a09))[_0x13d9('0x41')](handleError(_0x4adf3b,null));};exports['show']=function(_0x4d2642,_0x17a4c2){var _0x2a1a8d={'raw':!![],'where':{'id':_0x4d2642[_0x13d9('0x42')]['id']}},_0x133d50={};_0x133d50[_0x13d9('0x2d')]=_[_0x13d9('0x43')](db['MailSubstatus'][_0x13d9('0x2a')]);_0x133d50['query']=_[_0x13d9('0x43')](_0x4d2642['query']);_0x133d50['filters']=_['intersection'](_0x133d50[_0x13d9('0x2d')],_0x133d50['query']);_0x2a1a8d[_0x13d9('0x30')]=_[_0x13d9('0x2f')](_0x133d50[_0x13d9('0x2d')],qs[_0x13d9('0x31')](_0x4d2642[_0x13d9('0x2e')]['fields']));_0x2a1a8d[_0x13d9('0x30')]=_0x2a1a8d[_0x13d9('0x30')][_0x13d9('0x32')]?_0x2a1a8d[_0x13d9('0x30')]:_0x133d50[_0x13d9('0x2d')];if(_0x4d2642['query'][_0x13d9('0x44')]){_0x2a1a8d['include']=[{'all':!![]}];}_0x2a1a8d=_[_0x13d9('0x3c')]({},_0x2a1a8d,_0x4d2642[_0x13d9('0x3d')]);return db[_0x13d9('0x29')][_0x13d9('0x45')](_0x2a1a8d)[_0x13d9('0x22')](handleEntityNotFound(_0x17a4c2,null))[_0x13d9('0x22')](respondWithResult(_0x17a4c2,null))['catch'](handleError(_0x17a4c2,null));};exports[_0x13d9('0x46')]=function(_0x506156,_0x35ca09){return db[_0x13d9('0x29')][_0x13d9('0x46')](_0x506156[_0x13d9('0x47')],{})['then'](respondWithResult(_0x35ca09,0xc9))[_0x13d9('0x41')](handleError(_0x35ca09,null));};exports[_0x13d9('0x21')]=function(_0x22dead,_0x161c14){if(_0x22dead[_0x13d9('0x47')]['id']){delete _0x22dead[_0x13d9('0x47')]['id'];}return db[_0x13d9('0x29')]['find']({'where':{'id':_0x22dead['params']['id']}})[_0x13d9('0x22')](handleEntityNotFound(_0x161c14,null))[_0x13d9('0x22')](saveUpdates(_0x22dead['body'],null))[_0x13d9('0x22')](respondWithResult(_0x161c14,null))[_0x13d9('0x41')](handleError(_0x161c14,null));};exports['destroy']=function(_0x12e7e7,_0x3b79bb){return db[_0x13d9('0x29')][_0x13d9('0x45')]({'where':{'id':_0x12e7e7[_0x13d9('0x42')]['id']}})['then'](handleEntityNotFound(_0x3b79bb,null))[_0x13d9('0x22')](removeEntity(_0x3b79bb,null))[_0x13d9('0x41')](handleError(_0x3b79bb,null));};exports[_0x13d9('0x48')]=function(_0x13a071,_0x913d9c){return db[_0x13d9('0x29')]['describe']()[_0x13d9('0x22')](respondWithResult(_0x913d9c,null))['catch'](handleError(_0x913d9c,null));}; \ No newline at end of file +var _0x42c6=['jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','index','map','fieldName','type','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','MailSubstatus','include','findAll','rows','show','params','rawAttributes','keys','length','find','create','body','describe','catch','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x478ce1,_0x460726){var _0x5c8c1a=function(_0x44625e){while(--_0x44625e){_0x478ce1['push'](_0x478ce1['shift']());}};_0x5c8c1a(++_0x460726);}(_0x42c6,0x8d));var _0x642c=function(_0x2f2b37,_0x5a545b){_0x2f2b37=_0x2f2b37-0x0;var _0x170f0b=_0x42c6[_0x2f2b37];return _0x170f0b;};'use strict';var emlformat=require(_0x642c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x642c('0x1'));var jsonpatch=require(_0x642c('0x2'));var rp=require('request-promise');var moment=require(_0x642c('0x3'));var BPromise=require(_0x642c('0x4'));var Mustache=require(_0x642c('0x5'));var util=require(_0x642c('0x6'));var path=require(_0x642c('0x7'));var sox=require(_0x642c('0x8'));var csv=require(_0x642c('0x9'));var ejs=require(_0x642c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x642c('0xb'));var squel=require(_0x642c('0xc'));var crypto=require('crypto');var jsforce=require(_0x642c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x642c('0x9'));var querystring=require('querystring');var Papa=require(_0x642c('0xe'));var Redis=require(_0x642c('0xf'));var authService=require(_0x642c('0x10'));var qs=require(_0x642c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x642c('0x12'));var logger=require(_0x642c('0x13'))(_0x642c('0x14'));var utils=require(_0x642c('0x15'));var config=require(_0x642c('0x16'));var licenseUtil=require(_0x642c('0x17'));var db=require(_0x642c('0x18'))['db'];function respondWithStatusCode(_0x442ca5,_0xee4004){_0xee4004=_0xee4004||0xcc;return function(_0x423ed8){if(_0x423ed8){return _0x442ca5[_0x642c('0x19')](_0xee4004);}return _0x442ca5[_0x642c('0x1a')](_0xee4004)[_0x642c('0x1b')]();};}function respondWithResult(_0x55e173,_0x23e01d){_0x23e01d=_0x23e01d||0xc8;return function(_0x5117d4){if(_0x5117d4){return _0x55e173[_0x642c('0x1a')](_0x23e01d)['json'](_0x5117d4);}};}function respondWithFilteredResult(_0x49ad01,_0x1476fc){return function(_0x500631){if(_0x500631){var _0x254510=typeof _0x1476fc[_0x642c('0x1c')]===_0x642c('0x1d')&&typeof _0x1476fc[_0x642c('0x1e')]===_0x642c('0x1d');var _0xfc6b98=_0x500631[_0x642c('0x1f')];var _0x4a683c=_0x254510?0x0:_0x1476fc['offset'];var _0x4b2a5e=_0x254510?_0x500631[_0x642c('0x1f')]:_0x1476fc[_0x642c('0x1c')]+_0x1476fc[_0x642c('0x1e')];var _0x6e263b;if(_0x4b2a5e>=_0xfc6b98){_0x4b2a5e=_0xfc6b98;_0x6e263b=0xc8;}else{_0x6e263b=0xce;}_0x49ad01['status'](_0x6e263b);return _0x49ad01[_0x642c('0x20')](_0x642c('0x21'),_0x4a683c+'-'+_0x4b2a5e+'/'+_0xfc6b98)[_0x642c('0x22')](_0x500631);}return null;};}function patchUpdates(_0x32a8cf){return function(_0x2a13d6){try{jsonpatch['apply'](_0x2a13d6,_0x32a8cf,!![]);}catch(_0x412479){return BPromise[_0x642c('0x23')](_0x412479);}return _0x2a13d6[_0x642c('0x24')]();};}function saveUpdates(_0x5eeec8,_0x51e9aa){return function(_0x4260a5){if(_0x4260a5){return _0x4260a5[_0x642c('0x25')](_0x5eeec8)[_0x642c('0x26')](function(_0x153f90){return _0x153f90;});}return null;};}function removeEntity(_0x2e54fa,_0x4e2953){return function(_0x547ac4){if(_0x547ac4){return _0x547ac4[_0x642c('0x27')]()[_0x642c('0x26')](function(){_0x2e54fa[_0x642c('0x1a')](0xcc)[_0x642c('0x1b')]();});}};}function handleEntityNotFound(_0x4516dc,_0x2ab79c){return function(_0x4f9fe9){if(!_0x4f9fe9){_0x4516dc[_0x642c('0x19')](0x194);}return _0x4f9fe9;};}function handleError(_0x358c3f,_0x2b1d35){_0x2b1d35=_0x2b1d35||0x1f4;return function(_0x37c223){logger[_0x642c('0x28')](_0x37c223[_0x642c('0x29')]);if(_0x37c223[_0x642c('0x2a')]){delete _0x37c223[_0x642c('0x2a')];}_0x358c3f[_0x642c('0x1a')](_0x2b1d35)['send'](_0x37c223);};}exports[_0x642c('0x2b')]=function(_0x169a52,_0x1a573f){var _0x14d951={},_0x56be6c={},_0x383ab2={'count':0x0,'rows':[]};var _0x504648=_[_0x642c('0x2c')](db['MailSubstatus']['rawAttributes'],function(_0x3d07de){return{'name':_0x3d07de[_0x642c('0x2d')],'type':_0x3d07de[_0x642c('0x2e')]['key']};});_0x56be6c[_0x642c('0x2f')]=_[_0x642c('0x2c')](_0x504648,'name');_0x56be6c['query']=_['keys'](_0x169a52[_0x642c('0x30')]);_0x56be6c['filters']=_[_0x642c('0x31')](_0x56be6c[_0x642c('0x2f')],_0x56be6c[_0x642c('0x30')]);_0x14d951[_0x642c('0x32')]=_[_0x642c('0x31')](_0x56be6c[_0x642c('0x2f')],qs['fields'](_0x169a52[_0x642c('0x30')][_0x642c('0x33')]));_0x14d951[_0x642c('0x32')]=_0x14d951[_0x642c('0x32')]['length']?_0x14d951[_0x642c('0x32')]:_0x56be6c[_0x642c('0x2f')];if(!_0x169a52[_0x642c('0x30')][_0x642c('0x34')](_0x642c('0x35'))){_0x14d951[_0x642c('0x1e')]=qs[_0x642c('0x1e')](_0x169a52[_0x642c('0x30')][_0x642c('0x1e')]);_0x14d951[_0x642c('0x1c')]=qs['offset'](_0x169a52[_0x642c('0x30')][_0x642c('0x1c')]);}_0x14d951[_0x642c('0x36')]=qs['sort'](_0x169a52[_0x642c('0x30')][_0x642c('0x37')]);_0x14d951[_0x642c('0x38')]=qs[_0x642c('0x39')](_[_0x642c('0x3a')](_0x169a52[_0x642c('0x30')],_0x56be6c[_0x642c('0x39')]),_0x504648);if(_0x169a52[_0x642c('0x30')][_0x642c('0x3b')]){_0x14d951[_0x642c('0x38')]=_[_0x642c('0x3c')](_0x14d951[_0x642c('0x38')],{'$or':_[_0x642c('0x2c')](_0x504648,function(_0x5b3f3c){if(_0x5b3f3c[_0x642c('0x2e')]!==_0x642c('0x3d')){var _0xb021f4={};_0xb021f4[_0x5b3f3c[_0x642c('0x2a')]]={'$like':'%'+_0x169a52[_0x642c('0x30')][_0x642c('0x3b')]+'%'};return _0xb021f4;}})});}_0x14d951=_[_0x642c('0x3c')]({},_0x14d951,_0x169a52[_0x642c('0x3e')]);var _0x3c1ce0={'where':_0x14d951[_0x642c('0x38')]};return db[_0x642c('0x3f')][_0x642c('0x1f')](_0x3c1ce0)['then'](function(_0x6c9879){_0x383ab2['count']=_0x6c9879;if(_0x169a52['query']['includeAll']){_0x14d951[_0x642c('0x40')]=[{'all':!![]}];}return db[_0x642c('0x3f')][_0x642c('0x41')](_0x14d951);})[_0x642c('0x26')](function(_0x137366){_0x383ab2[_0x642c('0x42')]=_0x137366;return _0x383ab2;})[_0x642c('0x26')](respondWithFilteredResult(_0x1a573f,_0x14d951))['catch'](handleError(_0x1a573f,null));};exports[_0x642c('0x43')]=function(_0x1460b8,_0xf8258c){var _0x5e1baa={'raw':!![],'where':{'id':_0x1460b8[_0x642c('0x44')]['id']}},_0x2b99fe={};_0x2b99fe[_0x642c('0x2f')]=_['keys'](db['MailSubstatus'][_0x642c('0x45')]);_0x2b99fe['query']=_[_0x642c('0x46')](_0x1460b8[_0x642c('0x30')]);_0x2b99fe[_0x642c('0x39')]=_[_0x642c('0x31')](_0x2b99fe[_0x642c('0x2f')],_0x2b99fe['query']);_0x5e1baa[_0x642c('0x32')]=_[_0x642c('0x31')](_0x2b99fe[_0x642c('0x2f')],qs[_0x642c('0x33')](_0x1460b8[_0x642c('0x30')][_0x642c('0x33')]));_0x5e1baa['attributes']=_0x5e1baa['attributes'][_0x642c('0x47')]?_0x5e1baa[_0x642c('0x32')]:_0x2b99fe[_0x642c('0x2f')];if(_0x1460b8[_0x642c('0x30')]['includeAll']){_0x5e1baa[_0x642c('0x40')]=[{'all':!![]}];}_0x5e1baa=_['merge']({},_0x5e1baa,_0x1460b8['options']);return db[_0x642c('0x3f')][_0x642c('0x48')](_0x5e1baa)['then'](handleEntityNotFound(_0xf8258c,null))['then'](respondWithResult(_0xf8258c,null))['catch'](handleError(_0xf8258c,null));};exports[_0x642c('0x49')]=function(_0x3a265b,_0x28c587){return db[_0x642c('0x3f')][_0x642c('0x49')](_0x3a265b[_0x642c('0x4a')],{})[_0x642c('0x26')](respondWithResult(_0x28c587,0xc9))['catch'](handleError(_0x28c587,null));};exports[_0x642c('0x25')]=function(_0x475730,_0x319bf3){if(_0x475730['body']['id']){delete _0x475730[_0x642c('0x4a')]['id'];}return db[_0x642c('0x3f')][_0x642c('0x48')]({'where':{'id':_0x475730['params']['id']}})[_0x642c('0x26')](handleEntityNotFound(_0x319bf3,null))[_0x642c('0x26')](saveUpdates(_0x475730[_0x642c('0x4a')],null))[_0x642c('0x26')](respondWithResult(_0x319bf3,null))['catch'](handleError(_0x319bf3,null));};exports[_0x642c('0x27')]=function(_0x1e8439,_0x30c95c){return db[_0x642c('0x3f')][_0x642c('0x48')]({'where':{'id':_0x1e8439[_0x642c('0x44')]['id']}})[_0x642c('0x26')](handleEntityNotFound(_0x30c95c,null))[_0x642c('0x26')](removeEntity(_0x30c95c,null))['catch'](handleError(_0x30c95c,null));};exports[_0x642c('0x4b')]=function(_0x3d473b,_0x11b337){return db[_0x642c('0x3f')]['describe']()[_0x642c('0x26')](respondWithResult(_0x11b337,null))[_0x642c('0x4c')](handleError(_0x11b337,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 5f578b8..b1fffbf 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 _0x0a9f=['setMaxListeners','update','emit','hook','events','../../mysqldb','MailSubstatus'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x0a9f,0x17e));var _0xf0a9=function(_0x5622b2,_0x5dc268){_0x5622b2=_0x5622b2-0x0;var _0x2c441b=_0x0a9f[_0x5622b2];return _0x2c441b;};'use strict';var EventEmitter=require(_0xf0a9('0x0'));var MailSubstatus=require(_0xf0a9('0x1'))['db'][_0xf0a9('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xf0a9('0x3')](0x0);var events={'afterUpdate':_0xf0a9('0x4')};function emitEvent(_0x4ae716){return function(_0x123981,_0x425f54,_0x403482){MailSubstatusEvents[_0xf0a9('0x5')](_0x4ae716+':'+_0x123981['id'],_0x123981);MailSubstatusEvents[_0xf0a9('0x5')](_0x4ae716,_0x123981);_0x403482(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0xf0a9('0x6')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file +var _0x01a0=['events','../../mysqldb','MailSubstatus','setMaxListeners','update','emit','hasOwnProperty','hook','exports'];(function(_0x2fbe52,_0x2a0921){var _0x3bb8fe=function(_0xcf2b30){while(--_0xcf2b30){_0x2fbe52['push'](_0x2fbe52['shift']());}};_0x3bb8fe(++_0x2a0921);}(_0x01a0,0x195));var _0x001a=function(_0x3a177b,_0x10d9fe){_0x3a177b=_0x3a177b-0x0;var _0x205959=_0x01a0[_0x3a177b];return _0x205959;};'use strict';var EventEmitter=require(_0x001a('0x0'));var MailSubstatus=require(_0x001a('0x1'))['db'][_0x001a('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x001a('0x3')](0x0);var events={'afterUpdate':_0x001a('0x4')};function emitEvent(_0x53836a){return function(_0x50550a,_0x5f3782,_0xfd97dc){MailSubstatusEvents['emit'](_0x53836a+':'+_0x50550a['id'],_0x50550a);MailSubstatusEvents[_0x001a('0x5')](_0x53836a,_0x50550a);_0xfd97dc(null);};}for(var e in events){if(events[_0x001a('0x6')](e)){var event=events[e];MailSubstatus[_0x001a('0x7')](e,emitEvent(event));}}module[_0x001a('0x8')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index ee1dacc..9018e71 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 _0x3ea3=['./mailSubstatus.attributes','exports','models','define','mail_substatuses','Condition','update','name','mailSubstatus','_previousDataValues','then'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x3ea3,0xb0));var _0x33ea=function(_0x2f55e7,_0x582fd6){_0x2f55e7=_0x2f55e7-0x0;var _0x53f494=_0x3ea3[_0x2f55e7];return _0x53f494;};'use strict';var attributes=require(_0x33ea('0x0'));module[_0x33ea('0x1')]=function(_0x449fe2){var _0x5c8fdf=_0x449fe2[_0x33ea('0x2')];return _0x449fe2[_0x33ea('0x3')]('MailSubstatus',attributes,{'tableName':_0x33ea('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x541324,_0x2f2a2f,_0x4316c2){return _0x5c8fdf[_0x33ea('0x5')][_0x33ea('0x6')]({'value':_0x541324[_0x33ea('0x7')]},{'where':{'field':_0x33ea('0x8'),'value':_0x541324[_0x33ea('0x9')][_0x33ea('0x7')]}})[_0x33ea('0xa')](function(){_0x4316c2();})['catch'](function(_0x479dde){_0x4316c2(_0x479dde);});}}});}; \ No newline at end of file +var _0x0a0c=['name','_previousDataValues','then','catch','./mailSubstatus.attributes','exports','models','define','mail_substatuses','Condition','update'];(function(_0x417605,_0x4752b0){var _0x2f6c62=function(_0x495d97){while(--_0x495d97){_0x417605['push'](_0x417605['shift']());}};_0x2f6c62(++_0x4752b0);}(_0x0a0c,0x19b));var _0xc0a0=function(_0x1275d6,_0x3d30f1){_0x1275d6=_0x1275d6-0x0;var _0x34c1b4=_0x0a0c[_0x1275d6];return _0x34c1b4;};'use strict';var attributes=require(_0xc0a0('0x0'));module[_0xc0a0('0x1')]=function(_0x2fac61){var _0xacc2f4=_0x2fac61[_0xc0a0('0x2')];return _0x2fac61[_0xc0a0('0x3')]('MailSubstatus',attributes,{'tableName':_0xc0a0('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x3f5c8a,_0x18643d,_0x10962f){return _0xacc2f4[_0xc0a0('0x5')][_0xc0a0('0x6')]({'value':_0x3f5c8a[_0xc0a0('0x7')]},{'where':{'field':'mailSubstatus','value':_0x3f5c8a[_0xc0a0('0x8')][_0xc0a0('0x7')]}})[_0xc0a0('0x9')](function(){_0x10962f();})[_0xc0a0('0xa')](function(_0x58f236){_0x10962f(_0x58f236);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 786fe08..edb2654 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 _0xa7dc=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch'];(function(_0x197123,_0x52021d){var _0x2dd1d8=function(_0x1a9b6e){while(--_0x1a9b6e){_0x197123['push'](_0x197123['shift']());}};_0x2dd1d8(++_0x52021d);}(_0xa7dc,0x1ba));var _0xca7d=function(_0x1f0d41,_0x4f76a3){_0x1f0d41=_0x1f0d41-0x0;var _0xd08f0b=_0xa7dc[_0x1f0d41];return _0xd08f0b;};'use strict';var _=require('lodash');var util=require(_0xca7d('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xca7d('0x1'));var fs=require('fs');var Redis=require(_0xca7d('0x2'));var db=require(_0xca7d('0x3'))['db'];var utils=require(_0xca7d('0x4'));var logger=require(_0xca7d('0x5'))(_0xca7d('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xca7d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5bc6b9,_0x2516a4,_0xf09cfc){return new BPromise(function(_0xc5cbf7,_0x4803ed){return client[_0xca7d('0x8')](_0x5bc6b9,_0xf09cfc)['then'](function(_0x3e5d51){logger[_0xca7d('0x9')](_0xca7d('0xa'),_0x2516a4,'request\x20sent');logger['debug']('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x2516a4,_0xca7d('0xb'),JSON[_0xca7d('0xc')](_0x3e5d51));if(_0x3e5d51['error']){if(_0x3e5d51[_0xca7d('0xd')][_0xca7d('0xe')]===0x1f4){logger[_0xca7d('0xd')](_0xca7d('0xa'),_0x2516a4,_0x3e5d51[_0xca7d('0xd')][_0xca7d('0xf')]);return _0x4803ed(_0x3e5d51['error'][_0xca7d('0xf')]);}logger['error'](_0xca7d('0xa'),_0x2516a4,_0x3e5d51['error'][_0xca7d('0xf')]);return _0xc5cbf7(_0x3e5d51['error'][_0xca7d('0xf')]);}else{logger[_0xca7d('0x9')](_0xca7d('0xa'),_0x2516a4,_0xca7d('0xb'));_0xc5cbf7(_0x3e5d51['result']['message']);}})[_0xca7d('0x10')](function(_0x95cfea){logger[_0xca7d('0xd')](_0xca7d('0xa'),_0x2516a4,_0x95cfea);_0x4803ed(_0x95cfea);});});} \ No newline at end of file +var _0xcd8e=['request','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3e9942,_0x12e0e6){var _0x2f7e3f=function(_0x512089){while(--_0x512089){_0x3e9942['push'](_0x3e9942['shift']());}};_0x2f7e3f(++_0x12e0e6);}(_0xcd8e,0xa9));var _0xecd8=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xcd8e[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xecd8('0x0'));var util=require('util');var moment=require(_0xecd8('0x1'));var BPromise=require(_0xecd8('0x2'));var rs=require(_0xecd8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xecd8('0x4'));var logger=require(_0xecd8('0x5'))(_0xecd8('0x6'));var config=require(_0xecd8('0x7'));var jayson=require(_0xecd8('0x8'));var client=jayson[_0xecd8('0x9')][_0xecd8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13ec2c,_0x4038cf,_0x2dacee){return new BPromise(function(_0x426fff,_0x9a6c5a){return client[_0xecd8('0xb')](_0x13ec2c,_0x2dacee)['then'](function(_0x586992){logger['info'](_0xecd8('0xc'),_0x4038cf,_0xecd8('0xd'));logger['debug'](_0xecd8('0xe'),_0x4038cf,_0xecd8('0xd'),JSON['stringify'](_0x586992));if(_0x586992[_0xecd8('0xf')]){if(_0x586992['error']['code']===0x1f4){logger[_0xecd8('0xf')](_0xecd8('0xc'),_0x4038cf,_0x586992[_0xecd8('0xf')]['message']);return _0x9a6c5a(_0x586992[_0xecd8('0xf')][_0xecd8('0x10')]);}logger['error'](_0xecd8('0xc'),_0x4038cf,_0x586992[_0xecd8('0xf')][_0xecd8('0x10')]);return _0x426fff(_0x586992['error'][_0xecd8('0x10')]);}else{logger[_0xecd8('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x4038cf,_0xecd8('0xd'));_0x426fff(_0x586992[_0xecd8('0x12')][_0xecd8('0x10')]);}})[_0xecd8('0x13')](function(_0x135712){logger[_0xecd8('0xf')](_0xecd8('0xc'),_0x4038cf,_0x135712);_0x9a6c5a(_0x135712);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 0aa8fae..b4232bd 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 _0xa626=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','destroy','multer','util','path'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0xa626,0x1cb));var _0x6a62=function(_0x14879f,_0x45e022){_0x14879f=_0x14879f-0x0;var _0x4c349b=_0xa626[_0x14879f];return _0x4c349b;};'use strict';var multer=require(_0x6a62('0x0'));var util=require(_0x6a62('0x1'));var path=require(_0x6a62('0x2'));var timeout=require(_0x6a62('0x3'));var express=require(_0x6a62('0x4'));var router=express['Router']();var fs_extra=require(_0x6a62('0x5'));var auth=require(_0x6a62('0x6'));var interaction=require(_0x6a62('0x7'));var config=require(_0x6a62('0x8'));var controller=require(_0x6a62('0x9'));router[_0x6a62('0xa')]('/',auth[_0x6a62('0xb')](),controller[_0x6a62('0xc')]);router[_0x6a62('0xa')](_0x6a62('0xd'),auth[_0x6a62('0xb')](),controller[_0x6a62('0xe')]);router[_0x6a62('0xa')](_0x6a62('0xf'),auth[_0x6a62('0xb')](),controller[_0x6a62('0x10')]);router[_0x6a62('0x11')]('/',auth[_0x6a62('0xb')](),controller['create']);router[_0x6a62('0x12')]('/:id',auth[_0x6a62('0xb')](),controller[_0x6a62('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x6a62('0x14')]);module['exports']=router; \ No newline at end of file +var _0x2ee8=['/:id','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','/describe','describe'];(function(_0x33c8c7,_0x35103c){var _0x3bc0b2=function(_0x4f828a){while(--_0x4f828a){_0x33c8c7['push'](_0x33c8c7['shift']());}};_0x3bc0b2(++_0x35103c);}(_0x2ee8,0x126));var _0x82ee=function(_0xa7f9b5,_0xfd46ac){_0xa7f9b5=_0xa7f9b5-0x0;var _0x599723=_0x2ee8[_0xa7f9b5];return _0x599723;};'use strict';var multer=require(_0x82ee('0x0'));var util=require('util');var path=require(_0x82ee('0x1'));var timeout=require(_0x82ee('0x2'));var express=require(_0x82ee('0x3'));var router=express[_0x82ee('0x4')]();var fs_extra=require(_0x82ee('0x5'));var auth=require(_0x82ee('0x6'));var interaction=require(_0x82ee('0x7'));var config=require(_0x82ee('0x8'));var controller=require(_0x82ee('0x9'));router[_0x82ee('0xa')]('/',auth[_0x82ee('0xb')](),controller['index']);router['get'](_0x82ee('0xc'),auth['isAuthenticated'](),controller[_0x82ee('0xd')]);router[_0x82ee('0xa')](_0x82ee('0xe'),auth[_0x82ee('0xb')](),controller['show']);router[_0x82ee('0xf')]('/',auth[_0x82ee('0xb')](),controller[_0x82ee('0x10')]);router[_0x82ee('0x11')](_0x82ee('0xe'),auth[_0x82ee('0xb')](),controller[_0x82ee('0x12')]);router[_0x82ee('0x13')](_0x82ee('0xe'),auth[_0x82ee('0xb')](),controller[_0x82ee('0x14')]);module[_0x82ee('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 4a91e5a..c719fa7 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x51d365,_0x529b0b){var _0xbfea18=function(_0x22b12d){while(--_0x22b12d){_0x51d365['push'](_0x51d365['shift']());}};_0xbfea18(++_0x529b0b);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x2731f0,_0x126b1b){_0x2731f0=_0x2731f0-0x0;var _0x36a180=_0xf3cd[_0x2731f0];return _0x36a180;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0xf44d98,_0x12a472){var _0x5ebb04=function(_0x930c33){while(--_0x930c33){_0xf44d98['push'](_0xf44d98['shift']());}};_0x5ebb04(++_0x12a472);}(_0x9bde,0xe1));var _0xe9bd=function(_0x6b9c99,_0x2399ea){_0x6b9c99=_0x6b9c99-0x0;var _0x48464d=_0x9bde[_0x6b9c99];return _0x48464d;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 458af42..1310b88 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 _0x25a8=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','name','send','index','MailTransferReport','rawAttributes','fieldName','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x25a8,0x168));var _0x825a=function(_0x30f05c,_0x4b254c){_0x30f05c=_0x30f05c-0x0;var _0x127943=_0x25a8[_0x30f05c];return _0x127943;};'use strict';var emlformat=require(_0x825a('0x0'));var rimraf=require(_0x825a('0x1'));var zipdir=require(_0x825a('0x2'));var jsonpatch=require(_0x825a('0x3'));var rp=require(_0x825a('0x4'));var moment=require(_0x825a('0x5'));var BPromise=require(_0x825a('0x6'));var Mustache=require('mustache');var util=require(_0x825a('0x7'));var path=require('path');var sox=require(_0x825a('0x8'));var csv=require(_0x825a('0x9'));var ejs=require(_0x825a('0xa'));var fs=require('fs');var fs_extra=require(_0x825a('0xb'));var _=require(_0x825a('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x825a('0xd'));var deskjs=require(_0x825a('0xe'));var toCsv=require(_0x825a('0x9'));var querystring=require('querystring');var Papa=require(_0x825a('0xf'));var Redis=require('ioredis');var authService=require(_0x825a('0x10'));var qs=require(_0x825a('0x11'));var as=require(_0x825a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x825a('0x13'))('api');var utils=require(_0x825a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x825a('0x15'));var db=require(_0x825a('0x16'))['db'];function respondWithStatusCode(_0x55b9a9,_0x54983e){_0x54983e=_0x54983e||0xcc;return function(_0x229320){if(_0x229320){return _0x55b9a9[_0x825a('0x17')](_0x54983e);}return _0x55b9a9[_0x825a('0x18')](_0x54983e)[_0x825a('0x19')]();};}function respondWithResult(_0x395c52,_0x21d5f1){_0x21d5f1=_0x21d5f1||0xc8;return function(_0xbc68f0){if(_0xbc68f0){return _0x395c52[_0x825a('0x18')](_0x21d5f1)[_0x825a('0x1a')](_0xbc68f0);}};}function respondWithFilteredResult(_0x2042ce,_0x4969dd){return function(_0x4a3bb8){if(_0x4a3bb8){var _0x2466c4=typeof _0x4969dd[_0x825a('0x1b')]===_0x825a('0x1c')&&typeof _0x4969dd[_0x825a('0x1d')]===_0x825a('0x1c');var _0x11720e=_0x4a3bb8['count'];var _0x27c274=_0x2466c4?0x0:_0x4969dd[_0x825a('0x1b')];var _0x22254d=_0x2466c4?_0x4a3bb8[_0x825a('0x1e')]:_0x4969dd[_0x825a('0x1b')]+_0x4969dd['limit'];var _0x170d6e;if(_0x22254d>=_0x11720e){_0x22254d=_0x11720e;_0x170d6e=0xc8;}else{_0x170d6e=0xce;}_0x2042ce[_0x825a('0x18')](_0x170d6e);return _0x2042ce[_0x825a('0x1f')](_0x825a('0x20'),_0x27c274+'-'+_0x22254d+'/'+_0x11720e)[_0x825a('0x1a')](_0x4a3bb8);}return null;};}function patchUpdates(_0x259446){return function(_0x41d3a9){try{jsonpatch[_0x825a('0x21')](_0x41d3a9,_0x259446,!![]);}catch(_0x3178c8){return BPromise['reject'](_0x3178c8);}return _0x41d3a9['save']();};}function saveUpdates(_0x4efbfe,_0x530645){return function(_0x4b9b67){if(_0x4b9b67){return _0x4b9b67[_0x825a('0x22')](_0x4efbfe)[_0x825a('0x23')](function(_0x289a4e){return _0x289a4e;});}return null;};}function removeEntity(_0x4d48d0,_0x114bc2){return function(_0x2a5ded){if(_0x2a5ded){return _0x2a5ded[_0x825a('0x24')]()[_0x825a('0x23')](function(){_0x4d48d0[_0x825a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4712b6,_0x1b29a5){return function(_0x31b942){if(!_0x31b942){_0x4712b6[_0x825a('0x17')](0x194);}return _0x31b942;};}function handleError(_0x19e8b1,_0xeec0e3){_0xeec0e3=_0xeec0e3||0x1f4;return function(_0x40fd56){logger['error'](_0x40fd56['stack']);if(_0x40fd56[_0x825a('0x25')]){delete _0x40fd56[_0x825a('0x25')];}_0x19e8b1['status'](_0xeec0e3)[_0x825a('0x26')](_0x40fd56);};}exports[_0x825a('0x27')]=function(_0x41bc73,_0xc5d59b){var _0x408476={},_0x96a13e={},_0x1de5e1={'count':0x0,'rows':[]};var _0x95fe4f=_['map'](db[_0x825a('0x28')][_0x825a('0x29')],function(_0x371ad7){return{'name':_0x371ad7[_0x825a('0x2a')],'type':_0x371ad7['type']['key']};});_0x96a13e[_0x825a('0x2b')]=_[_0x825a('0x2c')](_0x95fe4f,_0x825a('0x25'));_0x96a13e[_0x825a('0x2d')]=_[_0x825a('0x2e')](_0x41bc73['query']);_0x96a13e['filters']=_[_0x825a('0x2f')](_0x96a13e[_0x825a('0x2b')],_0x96a13e[_0x825a('0x2d')]);_0x408476[_0x825a('0x30')]=_[_0x825a('0x2f')](_0x96a13e[_0x825a('0x2b')],qs[_0x825a('0x31')](_0x41bc73[_0x825a('0x2d')][_0x825a('0x31')]));_0x408476[_0x825a('0x30')]=_0x408476[_0x825a('0x30')]['length']?_0x408476[_0x825a('0x30')]:_0x96a13e[_0x825a('0x2b')];if(!_0x41bc73[_0x825a('0x2d')][_0x825a('0x32')]('nolimit')){_0x408476['limit']=qs[_0x825a('0x1d')](_0x41bc73[_0x825a('0x2d')][_0x825a('0x1d')]);_0x408476[_0x825a('0x1b')]=qs[_0x825a('0x1b')](_0x41bc73[_0x825a('0x2d')][_0x825a('0x1b')]);}_0x408476[_0x825a('0x33')]=qs[_0x825a('0x34')](_0x41bc73[_0x825a('0x2d')][_0x825a('0x34')]);_0x408476[_0x825a('0x35')]=qs[_0x825a('0x36')](_[_0x825a('0x37')](_0x41bc73['query'],_0x96a13e[_0x825a('0x36')]),_0x95fe4f);if(_0x41bc73[_0x825a('0x2d')][_0x825a('0x38')]){_0x408476['where']=_['merge'](_0x408476[_0x825a('0x35')],{'$or':_['map'](_0x95fe4f,function(_0x1a6f4b){if(_0x1a6f4b[_0x825a('0x39')]!==_0x825a('0x3a')){var _0x2b01c9={};_0x2b01c9[_0x1a6f4b[_0x825a('0x25')]]={'$like':'%'+_0x41bc73[_0x825a('0x2d')][_0x825a('0x38')]+'%'};return _0x2b01c9;}})});}_0x408476=_[_0x825a('0x3b')]({},_0x408476,_0x41bc73['options']);var _0x2c4ec5={'where':_0x408476[_0x825a('0x35')]};return db[_0x825a('0x28')][_0x825a('0x1e')](_0x2c4ec5)[_0x825a('0x23')](function(_0x502565){_0x1de5e1[_0x825a('0x1e')]=_0x502565;if(_0x41bc73[_0x825a('0x2d')][_0x825a('0x3c')]){_0x408476[_0x825a('0x3d')]=[{'all':!![]}];}return db['MailTransferReport'][_0x825a('0x3e')](_0x408476);})[_0x825a('0x23')](function(_0x46af71){_0x1de5e1[_0x825a('0x3f')]=_0x46af71;return _0x1de5e1;})[_0x825a('0x23')](respondWithFilteredResult(_0xc5d59b,_0x408476))[_0x825a('0x40')](handleError(_0xc5d59b,null));};exports[_0x825a('0x41')]=function(_0x586e9f,_0x28494d){var _0x551a53={'raw':!![],'where':{'id':_0x586e9f[_0x825a('0x42')]['id']}},_0x7eaa8={};_0x7eaa8[_0x825a('0x2b')]=_[_0x825a('0x2e')](db[_0x825a('0x28')][_0x825a('0x29')]);_0x7eaa8[_0x825a('0x2d')]=_[_0x825a('0x2e')](_0x586e9f['query']);_0x7eaa8['filters']=_[_0x825a('0x2f')](_0x7eaa8[_0x825a('0x2b')],_0x7eaa8[_0x825a('0x2d')]);_0x551a53[_0x825a('0x30')]=_[_0x825a('0x2f')](_0x7eaa8[_0x825a('0x2b')],qs[_0x825a('0x31')](_0x586e9f[_0x825a('0x2d')]['fields']));_0x551a53[_0x825a('0x30')]=_0x551a53[_0x825a('0x30')]['length']?_0x551a53[_0x825a('0x30')]:_0x7eaa8[_0x825a('0x2b')];if(_0x586e9f[_0x825a('0x2d')][_0x825a('0x3c')]){_0x551a53[_0x825a('0x3d')]=[{'all':!![]}];}_0x551a53=_[_0x825a('0x3b')]({},_0x551a53,_0x586e9f[_0x825a('0x43')]);return db['MailTransferReport'][_0x825a('0x44')](_0x551a53)[_0x825a('0x23')](handleEntityNotFound(_0x28494d,null))['then'](respondWithResult(_0x28494d,null))[_0x825a('0x40')](handleError(_0x28494d,null));};exports[_0x825a('0x45')]=function(_0x18dc6e,_0x28d2d4){return db[_0x825a('0x28')][_0x825a('0x45')](_0x18dc6e[_0x825a('0x46')],{})['then'](respondWithResult(_0x28d2d4,0xc9))['catch'](handleError(_0x28d2d4,null));};exports[_0x825a('0x22')]=function(_0x59f940,_0x3d4065){if(_0x59f940[_0x825a('0x46')]['id']){delete _0x59f940[_0x825a('0x46')]['id'];}return db[_0x825a('0x28')][_0x825a('0x44')]({'where':{'id':_0x59f940['params']['id']}})['then'](handleEntityNotFound(_0x3d4065,null))['then'](saveUpdates(_0x59f940['body'],null))[_0x825a('0x23')](respondWithResult(_0x3d4065,null))[_0x825a('0x40')](handleError(_0x3d4065,null));};exports[_0x825a('0x24')]=function(_0x1c023c,_0x110e08){return db['MailTransferReport'][_0x825a('0x44')]({'where':{'id':_0x1c023c[_0x825a('0x42')]['id']}})[_0x825a('0x23')](handleEntityNotFound(_0x110e08,null))[_0x825a('0x23')](removeEntity(_0x110e08,null))['catch'](handleError(_0x110e08,null));};exports[_0x825a('0x47')]=function(_0x349f25,_0x4bfab2){return db[_0x825a('0x28')][_0x825a('0x47')]()['then'](respondWithResult(_0x4bfab2,null))[_0x825a('0x40')](handleError(_0x4bfab2,null));}; \ No newline at end of file +var _0xba2b=['../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','apply','reject','save','update','then','destroy','error','stack','name','send','index','MailTransferReport','rawAttributes','type','key','model','map','keys','query','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','includeAll','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x4d17ac,_0x25fa6f){var _0x24e8a5=function(_0x126cef){while(--_0x126cef){_0x4d17ac['push'](_0x4d17ac['shift']());}};_0x24e8a5(++_0x25fa6f);}(_0xba2b,0x7f));var _0xbba2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba2b[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xbba2('0x0'));var rimraf=require(_0xbba2('0x1'));var zipdir=require(_0xbba2('0x2'));var jsonpatch=require(_0xbba2('0x3'));var rp=require(_0xbba2('0x4'));var moment=require(_0xbba2('0x5'));var BPromise=require(_0xbba2('0x6'));var Mustache=require(_0xbba2('0x7'));var util=require(_0xbba2('0x8'));var path=require(_0xbba2('0x9'));var sox=require(_0xbba2('0xa'));var csv=require(_0xbba2('0xb'));var ejs=require(_0xbba2('0xc'));var fs=require('fs');var fs_extra=require(_0xbba2('0xd'));var _=require(_0xbba2('0xe'));var squel=require(_0xbba2('0xf'));var crypto=require(_0xbba2('0x10'));var jsforce=require(_0xbba2('0x11'));var deskjs=require(_0xbba2('0x12'));var toCsv=require(_0xbba2('0xb'));var querystring=require(_0xbba2('0x13'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbba2('0x14'));var qs=require(_0xbba2('0x15'));var as=require(_0xbba2('0x16'));var hardwareService=require(_0xbba2('0x17'));var logger=require('../../config/logger')(_0xbba2('0x18'));var utils=require(_0xbba2('0x19'));var config=require(_0xbba2('0x1a'));var licenseUtil=require(_0xbba2('0x1b'));var db=require(_0xbba2('0x1c'))['db'];function respondWithStatusCode(_0x213f1f,_0x80764d){_0x80764d=_0x80764d||0xcc;return function(_0x14cb6a){if(_0x14cb6a){return _0x213f1f['sendStatus'](_0x80764d);}return _0x213f1f[_0xbba2('0x1d')](_0x80764d)[_0xbba2('0x1e')]();};}function respondWithResult(_0x4b62f6,_0x436c82){_0x436c82=_0x436c82||0xc8;return function(_0x2c89bb){if(_0x2c89bb){return _0x4b62f6[_0xbba2('0x1d')](_0x436c82)[_0xbba2('0x1f')](_0x2c89bb);}};}function respondWithFilteredResult(_0x56fb7c,_0x2bde3c){return function(_0x5eee8e){if(_0x5eee8e){var _0x1bf914=typeof _0x2bde3c[_0xbba2('0x20')]===_0xbba2('0x21')&&typeof _0x2bde3c['limit']===_0xbba2('0x21');var _0x8e1bca=_0x5eee8e[_0xbba2('0x22')];var _0x2dc126=_0x1bf914?0x0:_0x2bde3c[_0xbba2('0x20')];var _0x5233ee=_0x1bf914?_0x5eee8e[_0xbba2('0x22')]:_0x2bde3c[_0xbba2('0x20')]+_0x2bde3c[_0xbba2('0x23')];var _0x16f499;if(_0x5233ee>=_0x8e1bca){_0x5233ee=_0x8e1bca;_0x16f499=0xc8;}else{_0x16f499=0xce;}_0x56fb7c[_0xbba2('0x1d')](_0x16f499);return _0x56fb7c['set']('Content-Range',_0x2dc126+'-'+_0x5233ee+'/'+_0x8e1bca)[_0xbba2('0x1f')](_0x5eee8e);}return null;};}function patchUpdates(_0x41aa59){return function(_0x30bd0d){try{jsonpatch[_0xbba2('0x24')](_0x30bd0d,_0x41aa59,!![]);}catch(_0x2b72e3){return BPromise[_0xbba2('0x25')](_0x2b72e3);}return _0x30bd0d[_0xbba2('0x26')]();};}function saveUpdates(_0x550f74,_0x531740){return function(_0xebb16c){if(_0xebb16c){return _0xebb16c[_0xbba2('0x27')](_0x550f74)[_0xbba2('0x28')](function(_0x12bf39){return _0x12bf39;});}return null;};}function removeEntity(_0x3938ee,_0x50e249){return function(_0x53678f){if(_0x53678f){return _0x53678f[_0xbba2('0x29')]()[_0xbba2('0x28')](function(){_0x3938ee[_0xbba2('0x1d')](0xcc)[_0xbba2('0x1e')]();});}};}function handleEntityNotFound(_0x4b1be2,_0xe570e0){return function(_0x5c7135){if(!_0x5c7135){_0x4b1be2['sendStatus'](0x194);}return _0x5c7135;};}function handleError(_0x4c2c1f,_0x3c89e1){_0x3c89e1=_0x3c89e1||0x1f4;return function(_0x5cb498){logger[_0xbba2('0x2a')](_0x5cb498[_0xbba2('0x2b')]);if(_0x5cb498[_0xbba2('0x2c')]){delete _0x5cb498[_0xbba2('0x2c')];}_0x4c2c1f['status'](_0x3c89e1)[_0xbba2('0x2d')](_0x5cb498);};}exports[_0xbba2('0x2e')]=function(_0x445d86,_0x34f9c2){var _0x57bc66={},_0x6d6710={},_0x342a7b={'count':0x0,'rows':[]};var _0x4e8da1=_['map'](db[_0xbba2('0x2f')][_0xbba2('0x30')],function(_0x195985){return{'name':_0x195985['fieldName'],'type':_0x195985[_0xbba2('0x31')][_0xbba2('0x32')]};});_0x6d6710[_0xbba2('0x33')]=_[_0xbba2('0x34')](_0x4e8da1,_0xbba2('0x2c'));_0x6d6710['query']=_[_0xbba2('0x35')](_0x445d86[_0xbba2('0x36')]);_0x6d6710[_0xbba2('0x37')]=_['intersection'](_0x6d6710['model'],_0x6d6710[_0xbba2('0x36')]);_0x57bc66[_0xbba2('0x38')]=_[_0xbba2('0x39')](_0x6d6710[_0xbba2('0x33')],qs[_0xbba2('0x3a')](_0x445d86['query']['fields']));_0x57bc66[_0xbba2('0x38')]=_0x57bc66[_0xbba2('0x38')][_0xbba2('0x3b')]?_0x57bc66[_0xbba2('0x38')]:_0x6d6710[_0xbba2('0x33')];if(!_0x445d86[_0xbba2('0x36')]['hasOwnProperty']('nolimit')){_0x57bc66['limit']=qs[_0xbba2('0x23')](_0x445d86[_0xbba2('0x36')][_0xbba2('0x23')]);_0x57bc66[_0xbba2('0x20')]=qs[_0xbba2('0x20')](_0x445d86[_0xbba2('0x36')][_0xbba2('0x20')]);}_0x57bc66[_0xbba2('0x3c')]=qs[_0xbba2('0x3d')](_0x445d86[_0xbba2('0x36')]['sort']);_0x57bc66[_0xbba2('0x3e')]=qs[_0xbba2('0x37')](_[_0xbba2('0x3f')](_0x445d86[_0xbba2('0x36')],_0x6d6710['filters']),_0x4e8da1);if(_0x445d86[_0xbba2('0x36')][_0xbba2('0x40')]){_0x57bc66['where']=_[_0xbba2('0x41')](_0x57bc66[_0xbba2('0x3e')],{'$or':_['map'](_0x4e8da1,function(_0x3bc1da){if(_0x3bc1da[_0xbba2('0x31')]!==_0xbba2('0x42')){var _0x1d8a54={};_0x1d8a54[_0x3bc1da[_0xbba2('0x2c')]]={'$like':'%'+_0x445d86['query'][_0xbba2('0x40')]+'%'};return _0x1d8a54;}})});}_0x57bc66=_[_0xbba2('0x41')]({},_0x57bc66,_0x445d86['options']);var _0x264a32={'where':_0x57bc66['where']};return db[_0xbba2('0x2f')][_0xbba2('0x22')](_0x264a32)[_0xbba2('0x28')](function(_0x51e657){_0x342a7b[_0xbba2('0x22')]=_0x51e657;if(_0x445d86['query']['includeAll']){_0x57bc66[_0xbba2('0x43')]=[{'all':!![]}];}return db['MailTransferReport'][_0xbba2('0x44')](_0x57bc66);})[_0xbba2('0x28')](function(_0x35cfa9){_0x342a7b[_0xbba2('0x45')]=_0x35cfa9;return _0x342a7b;})[_0xbba2('0x28')](respondWithFilteredResult(_0x34f9c2,_0x57bc66))[_0xbba2('0x46')](handleError(_0x34f9c2,null));};exports['show']=function(_0x165316,_0x92f551){var _0x2341b8={'raw':!![],'where':{'id':_0x165316['params']['id']}},_0x2aa906={};_0x2aa906['model']=_['keys'](db[_0xbba2('0x2f')][_0xbba2('0x30')]);_0x2aa906[_0xbba2('0x36')]=_[_0xbba2('0x35')](_0x165316[_0xbba2('0x36')]);_0x2aa906[_0xbba2('0x37')]=_[_0xbba2('0x39')](_0x2aa906[_0xbba2('0x33')],_0x2aa906[_0xbba2('0x36')]);_0x2341b8[_0xbba2('0x38')]=_['intersection'](_0x2aa906['model'],qs[_0xbba2('0x3a')](_0x165316[_0xbba2('0x36')][_0xbba2('0x3a')]));_0x2341b8['attributes']=_0x2341b8[_0xbba2('0x38')][_0xbba2('0x3b')]?_0x2341b8[_0xbba2('0x38')]:_0x2aa906[_0xbba2('0x33')];if(_0x165316[_0xbba2('0x36')][_0xbba2('0x47')]){_0x2341b8[_0xbba2('0x43')]=[{'all':!![]}];}_0x2341b8=_['merge']({},_0x2341b8,_0x165316[_0xbba2('0x48')]);return db[_0xbba2('0x2f')][_0xbba2('0x49')](_0x2341b8)['then'](handleEntityNotFound(_0x92f551,null))[_0xbba2('0x28')](respondWithResult(_0x92f551,null))['catch'](handleError(_0x92f551,null));};exports[_0xbba2('0x4a')]=function(_0x5a0ec5,_0x531a3f){return db[_0xbba2('0x2f')][_0xbba2('0x4a')](_0x5a0ec5[_0xbba2('0x4b')],{})[_0xbba2('0x28')](respondWithResult(_0x531a3f,0xc9))['catch'](handleError(_0x531a3f,null));};exports[_0xbba2('0x27')]=function(_0x4d6d72,_0x26e131){if(_0x4d6d72[_0xbba2('0x4b')]['id']){delete _0x4d6d72[_0xbba2('0x4b')]['id'];}return db[_0xbba2('0x2f')]['find']({'where':{'id':_0x4d6d72['params']['id']}})[_0xbba2('0x28')](handleEntityNotFound(_0x26e131,null))['then'](saveUpdates(_0x4d6d72[_0xbba2('0x4b')],null))['then'](respondWithResult(_0x26e131,null))[_0xbba2('0x46')](handleError(_0x26e131,null));};exports[_0xbba2('0x29')]=function(_0x3387a1,_0x28fb71){return db[_0xbba2('0x2f')][_0xbba2('0x49')]({'where':{'id':_0x3387a1['params']['id']}})[_0xbba2('0x28')](handleEntityNotFound(_0x28fb71,null))['then'](removeEntity(_0x28fb71,null))['catch'](handleError(_0x28fb71,null));};exports[_0xbba2('0x4c')]=function(_0x325de2,_0x46b010){return db['MailTransferReport']['describe']()['then'](respondWithResult(_0x46b010,null))['catch'](handleError(_0x46b010,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index e93e66f..d3b0282 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 _0xc737=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','MailTransferReport','lodash'];(function(_0x623028,_0x5c3eb7){var _0x5ca7c6=function(_0x3f36cb){while(--_0x3f36cb){_0x623028['push'](_0x623028['shift']());}};_0x5ca7c6(++_0x5c3eb7);}(_0xc737,0x8e));var _0x7c73=function(_0x1b9c08,_0x375d1e){_0x1b9c08=_0x1b9c08-0x0;var _0x3c0e37=_0xc737[_0x1b9c08];return _0x3c0e37;};'use strict';var _=require(_0x7c73('0x0'));var util=require(_0x7c73('0x1'));var logger=require('../../config/logger')(_0x7c73('0x2'));var moment=require(_0x7c73('0x3'));var BPromise=require(_0x7c73('0x4'));var rp=require(_0x7c73('0x5'));var fs=require('fs');var path=require(_0x7c73('0x6'));var rimraf=require(_0x7c73('0x7'));var config=require(_0x7c73('0x8'));var attributes=require('./mailTransferReport.attributes');module['exports']=function(_0x1eb29f,_0x2f09f7){return _0x1eb29f[_0x7c73('0x9')](_0x7c73('0xa'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xdd50=['util','../../config/logger','api','moment','bluebird','request-promise','exports','define','MailTransferReport','uniqueid'];(function(_0x377bb5,_0x1acb05){var _0x4fd548=function(_0x2fbb07){while(--_0x2fbb07){_0x377bb5['push'](_0x377bb5['shift']());}};_0x4fd548(++_0x1acb05);}(_0xdd50,0x172));var _0x0dd5=function(_0x336376,_0xe4b28d){_0x336376=_0x336376-0x0;var _0x1d2a8e=_0xdd50[_0x336376];return _0x1d2a8e;};'use strict';var _=require('lodash');var util=require(_0x0dd5('0x0'));var logger=require(_0x0dd5('0x1'))(_0x0dd5('0x2'));var moment=require(_0x0dd5('0x3'));var BPromise=require(_0x0dd5('0x4'));var rp=require(_0x0dd5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailTransferReport.attributes');module[_0x0dd5('0x6')]=function(_0x4f6b13,_0x9471f5){return _0x4f6b13[_0x0dd5('0x7')](_0x0dd5('0x8'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0x0dd5('0x9'),'fields':[_0x0dd5('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 4e14cac..a2a388b 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 _0xb3d5=['error','code','MailTransferReport,\x20%s,\x20%s','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','stringify'];(function(_0x140a60,_0xe96b8a){var _0x4876fc=function(_0x1a48f8){while(--_0x1a48f8){_0x140a60['push'](_0x140a60['shift']());}};_0x4876fc(++_0xe96b8a);}(_0xb3d5,0x1f3));var _0x5b3d=function(_0x4b90f3,_0x147233){_0x4b90f3=_0x4b90f3-0x0;var _0x75eb5a=_0xb3d5[_0x4b90f3];return _0x75eb5a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5b3d('0x0'));var BPromise=require(_0x5b3d('0x1'));var rs=require(_0x5b3d('0x2'));var fs=require('fs');var Redis=require(_0x5b3d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5b3d('0x4'));var logger=require(_0x5b3d('0x5'))('rpc');var config=require(_0x5b3d('0x6'));var jayson=require(_0x5b3d('0x7'));var client=jayson[_0x5b3d('0x8')][_0x5b3d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x189906,_0x361495,_0x2a4ae3){return new BPromise(function(_0x4b769d,_0x18a9b1){return client['request'](_0x189906,_0x2a4ae3)[_0x5b3d('0xa')](function(_0x4fd980){logger[_0x5b3d('0xb')]('MailTransferReport,\x20%s,\x20%s',_0x361495,_0x5b3d('0xc'));logger['debug']('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x361495,_0x5b3d('0xc'),JSON[_0x5b3d('0xd')](_0x4fd980));if(_0x4fd980[_0x5b3d('0xe')]){if(_0x4fd980[_0x5b3d('0xe')][_0x5b3d('0xf')]===0x1f4){logger[_0x5b3d('0xe')](_0x5b3d('0x10'),_0x361495,_0x4fd980[_0x5b3d('0xe')][_0x5b3d('0x11')]);return _0x18a9b1(_0x4fd980[_0x5b3d('0xe')][_0x5b3d('0x11')]);}logger[_0x5b3d('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x361495,_0x4fd980[_0x5b3d('0xe')][_0x5b3d('0x11')]);return _0x4b769d(_0x4fd980[_0x5b3d('0xe')]['message']);}else{logger[_0x5b3d('0xb')](_0x5b3d('0x10'),_0x361495,'request\x20sent');_0x4b769d(_0x4fd980['result'][_0x5b3d('0x11')]);}})[_0x5b3d('0x12')](function(_0x1a4979){logger[_0x5b3d('0xe')](_0x5b3d('0x10'),_0x361495,_0x1a4979);_0x18a9b1(_0x1a4979);});});} \ No newline at end of file +var _0xef4e=['jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','../../mysqldb','rpc'];(function(_0x2f31ea,_0x351d88){var _0x5b6a5d=function(_0xf990d6){while(--_0xf990d6){_0x2f31ea['push'](_0x2f31ea['shift']());}};_0x5b6a5d(++_0x351d88);}(_0xef4e,0x19f));var _0xeef4=function(_0xc0754,_0x37f107){_0xc0754=_0xc0754-0x0;var _0x195498=_0xef4e[_0xc0754];return _0x195498;};'use strict';var _=require(_0xeef4('0x0'));var util=require('util');var moment=require(_0xeef4('0x1'));var BPromise=require(_0xeef4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeef4('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xeef4('0x4'));var config=require('../../config/environment');var jayson=require(_0xeef4('0x5'));var client=jayson[_0xeef4('0x6')][_0xeef4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xa5c32,_0x4bf706,_0xaf20f3){return new BPromise(function(_0x478d44,_0x40c2ea){return client[_0xeef4('0x8')](_0xa5c32,_0xaf20f3)[_0xeef4('0x9')](function(_0x14f927){logger[_0xeef4('0xa')](_0xeef4('0xb'),_0x4bf706,_0xeef4('0xc'));logger[_0xeef4('0xd')](_0xeef4('0xe'),_0x4bf706,'request\x20sent',JSON['stringify'](_0x14f927));if(_0x14f927['error']){if(_0x14f927[_0xeef4('0xf')][_0xeef4('0x10')]===0x1f4){logger[_0xeef4('0xf')](_0xeef4('0xb'),_0x4bf706,_0x14f927[_0xeef4('0xf')]['message']);return _0x40c2ea(_0x14f927[_0xeef4('0xf')][_0xeef4('0x11')]);}logger[_0xeef4('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x4bf706,_0x14f927['error'][_0xeef4('0x11')]);return _0x478d44(_0x14f927['error'][_0xeef4('0x11')]);}else{logger['info'](_0xeef4('0xb'),_0x4bf706,'request\x20sent');_0x478d44(_0x14f927[_0xeef4('0x12')]['message']);}})[_0xeef4('0x13')](function(_0x25f950){logger[_0xeef4('0xf')](_0xeef4('0xb'),_0x4bf706,_0x25f950);_0x40c2ea(_0x25f950);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index df91ee7..f7e3eb4 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 _0x5a7b=['update','delete','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put'];(function(_0x4d34fe,_0x2373e2){var _0x18f30d=function(_0x1e3177){while(--_0x1e3177){_0x4d34fe['push'](_0x4d34fe['shift']());}};_0x18f30d(++_0x2373e2);}(_0x5a7b,0xd5));var _0xb5a7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5a7b[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xb5a7('0x0'));var util=require(_0xb5a7('0x1'));var path=require('path');var timeout=require(_0xb5a7('0x2'));var express=require('express');var router=express[_0xb5a7('0x3')]();var fs_extra=require(_0xb5a7('0x4'));var auth=require(_0xb5a7('0x5'));var interaction=require(_0xb5a7('0x6'));var config=require(_0xb5a7('0x7'));var controller=require('./memberReport.controller');router['get']('/',auth[_0xb5a7('0x8')](),controller[_0xb5a7('0x9')]);router[_0xb5a7('0xa')](_0xb5a7('0xb'),auth[_0xb5a7('0x8')](),controller[_0xb5a7('0xc')]);router['get'](_0xb5a7('0xd'),auth['isAuthenticated'](),controller[_0xb5a7('0xe')]);router[_0xb5a7('0xf')]('/',auth[_0xb5a7('0x8')](),controller[_0xb5a7('0x10')]);router[_0xb5a7('0x11')](_0xb5a7('0xd'),auth[_0xb5a7('0x8')](),controller[_0xb5a7('0x12')]);router[_0xb5a7('0x13')]('/:id',auth[_0xb5a7('0x8')](),controller[_0xb5a7('0x14')]);module['exports']=router; \ No newline at end of file +var _0x90ce=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./memberReport.controller','get','index','isAuthenticated','describe','/:id','show','post','create','put','destroy','multer','util'];(function(_0x17266e,_0x5d273d){var _0x8eeaf4=function(_0xda6721){while(--_0xda6721){_0x17266e['push'](_0x17266e['shift']());}};_0x8eeaf4(++_0x5d273d);}(_0x90ce,0x1d9));var _0xe90c=function(_0x1f6f84,_0x2bab55){_0x1f6f84=_0x1f6f84-0x0;var _0x177f40=_0x90ce[_0x1f6f84];return _0x177f40;};'use strict';var multer=require(_0xe90c('0x0'));var util=require(_0xe90c('0x1'));var path=require(_0xe90c('0x2'));var timeout=require('connect-timeout');var express=require(_0xe90c('0x3'));var router=express[_0xe90c('0x4')]();var fs_extra=require(_0xe90c('0x5'));var auth=require(_0xe90c('0x6'));var interaction=require(_0xe90c('0x7'));var config=require('../../config/environment');var controller=require(_0xe90c('0x8'));router[_0xe90c('0x9')]('/',auth['isAuthenticated'](),controller[_0xe90c('0xa')]);router['get']('/describe',auth[_0xe90c('0xb')](),controller[_0xe90c('0xc')]);router['get'](_0xe90c('0xd'),auth[_0xe90c('0xb')](),controller[_0xe90c('0xe')]);router[_0xe90c('0xf')]('/',auth[_0xe90c('0xb')](),controller[_0xe90c('0x10')]);router[_0xe90c('0x11')](_0xe90c('0xd'),auth[_0xe90c('0xb')](),controller['update']);router['delete'](_0xe90c('0xd'),auth[_0xe90c('0xb')](),controller[_0xe90c('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 6fdaeab..e142300 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 _0xe203=['talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','diff','setDataValue','exitAt','duration'];(function(_0x545bed,_0x221e96){var _0x16c79c=function(_0x465346){while(--_0x465346){_0x545bed['push'](_0x545bed['shift']());}};_0x16c79c(++_0x221e96);}(_0xe203,0xfe));var _0x3e20=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe203[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x3e20('0x0'));module[_0x3e20('0x1')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x3e20('0x2')]},'interface':{'type':Sequelize[_0x3e20('0x2')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0x3e20('0x3'),'comment':_0x3e20('0x4')},'duration':{'type':Sequelize[_0x3e20('0x5')]},'enterAt':{'type':Sequelize[_0x3e20('0x6')]},'exitAt':{'type':Sequelize[_0x3e20('0x6')],'set':function(_0x1abfe3){var _0x215406=moment(_0x1abfe3);var _0x139915=moment(this[_0x3e20('0x7')]('enterAt'));var _0x4f840e=_0x215406[_0x3e20('0x8')](_0x139915,'seconds');this[_0x3e20('0x9')](_0x3e20('0xa'),_0x1abfe3);this[_0x3e20('0x9')](_0x3e20('0xb'),_0x4f840e>=0x0?_0x4f840e:null);}},'data1':{'type':Sequelize[_0x3e20('0x2')],'comment':_0x3e20('0xc')},'data2':{'type':Sequelize[_0x3e20('0x2')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x3e20('0x2')],'comment':_0x3e20('0xd')},'data4':{'type':Sequelize[_0x3e20('0x2')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x3e20('0x2')],'comment':'talk:[queue]'},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x3e20('0x5')]},'uniqueid':{'type':Sequelize[_0x3e20('0x2')]}}; \ No newline at end of file +var _0x71c0=['talk:[start]','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','diff','seconds','setDataValue','talk:[inbound,\x20outbound],\x20pause:[reason]'];(function(_0x29d491,_0x340b76){var _0x20aaef=function(_0x317d63){while(--_0x317d63){_0x29d491['push'](_0x29d491['shift']());}};_0x20aaef(++_0x340b76);}(_0x71c0,0x1a3));var _0x071c=function(_0x95916a,_0x3707d7){_0x95916a=_0x95916a-0x0;var _0x2a0ac4=_0x71c0[_0x95916a];return _0x2a0ac4;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'channel':{'type':Sequelize[_0x071c('0x0')]},'membername':{'type':Sequelize[_0x071c('0x0')]},'interface':{'type':Sequelize[_0x071c('0x0')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0x071c('0x1'),'comment':_0x071c('0x2')},'duration':{'type':Sequelize[_0x071c('0x3')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x071c('0x4')],'set':function(_0x3760dd){var _0x5c88ba=moment(_0x3760dd);var _0x5e9b58=moment(this[_0x071c('0x5')]('enterAt'));var _0x54777b=_0x5c88ba[_0x071c('0x6')](_0x5e9b58,_0x071c('0x7'));this[_0x071c('0x8')]('exitAt',_0x3760dd);this['setDataValue']('duration',_0x54777b>=0x0?_0x54777b:null);}},'data1':{'type':Sequelize[_0x071c('0x0')],'comment':_0x071c('0x9')},'data2':{'type':Sequelize['STRING'],'comment':_0x071c('0xa')},'data3':{'type':Sequelize[_0x071c('0x0')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0x071c('0x0')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x071c('0x0')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x071c('0x0')]},'internal':{'type':Sequelize[_0x071c('0x3')]},'uniqueid':{'type':Sequelize[_0x071c('0x0')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 61cfb21..7102a6c 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['catch','params','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows'];(function(_0x591c61,_0x38bdf0){var _0x519b5e=function(_0x2595f9){while(--_0x2595f9){_0x591c61['push'](_0x591c61['shift']());}};_0x519b5e(++_0x38bdf0);}(_0x9c44,0x178));var _0x49c4=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x9c44[_0x543084];return _0x306a57;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=_[_0x49c4('0x29')](db[_0x49c4('0x2a')][_0x49c4('0x2b')],function(_0x17b50f){return{'name':_0x17b50f[_0x49c4('0x2c')],'type':_0x17b50f[_0x49c4('0x2d')]['key']};});_0x46e04d['model']=_['map'](_0x6329b3,_0x49c4('0x26'));_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d[_0x49c4('0x30')]=_['intersection'](_0x46e04d[_0x49c4('0x31')],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x46e04d['model'],qs['fields'](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x2b2793[_0x49c4('0x32')]=_0x2b2793[_0x49c4('0x32')][_0x49c4('0x35')]?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x31')];if(!_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x36')]('nolimit')){_0x2b2793['limit']=qs[_0x49c4('0x1b')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x1b')]);_0x2b2793[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x19')]);}_0x2b2793[_0x49c4('0x37')]=qs[_0x49c4('0x38')](_0x5987ae['query'][_0x49c4('0x38')]);_0x2b2793['where']=qs[_0x49c4('0x30')](_[_0x49c4('0x39')](_0x5987ae[_0x49c4('0x2e')],_0x46e04d[_0x49c4('0x30')]),_0x6329b3);if(_0x5987ae['query'][_0x49c4('0x3a')]){_0x2b2793[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2b2793['where'],{'$or':_[_0x49c4('0x29')](_0x6329b3,function(_0x21d8c7){if(_0x21d8c7[_0x49c4('0x2d')]!==_0x49c4('0x3d')){var _0x1ba7a0={};_0x1ba7a0[_0x21d8c7[_0x49c4('0x26')]]={'$like':'%'+_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x3a')]+'%'};return _0x1ba7a0;}})});}_0x2b2793=_[_0x49c4('0x3c')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3e')]);var _0x1e506a={'where':_0x2b2793['where']};return db[_0x49c4('0x2a')][_0x49c4('0x1c')](_0x1e506a)[_0x49c4('0x3f')](function(_0x23aa32){_0x4f28a2[_0x49c4('0x1c')]=_0x23aa32;if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x2b2793[_0x49c4('0x41')]=[{'all':!![]}];}return db[_0x49c4('0x2a')][_0x49c4('0x42')](_0x2b2793);})[_0x49c4('0x3f')](function(_0xa3d59e){_0x4f28a2[_0x49c4('0x43')]=_0xa3d59e;return _0x4f28a2;})['then'](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x44')](handleError(_0x889909,null));};exports['show']=function(_0x104efb,_0x4915bc){var _0x28d4fb={'raw':!![],'where':{'id':_0x104efb[_0x49c4('0x45')]['id']}},_0x1480da={};_0x1480da[_0x49c4('0x31')]=_['keys'](db['MemberReport'][_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x104efb[_0x49c4('0x2e')]);_0x1480da['filters']=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],_0x1480da[_0x49c4('0x2e')]);_0x28d4fb[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],qs[_0x49c4('0x34')](_0x104efb[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x28d4fb['attributes']=_0x28d4fb[_0x49c4('0x32')]['length']?_0x28d4fb[_0x49c4('0x32')]:_0x1480da[_0x49c4('0x31')];if(_0x104efb[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x28d4fb[_0x49c4('0x41')]=[{'all':!![]}];}_0x28d4fb=_['merge']({},_0x28d4fb,_0x104efb[_0x49c4('0x3e')]);return db[_0x49c4('0x2a')][_0x49c4('0x46')](_0x28d4fb)[_0x49c4('0x3f')](handleEntityNotFound(_0x4915bc,null))[_0x49c4('0x3f')](respondWithResult(_0x4915bc,null))[_0x49c4('0x44')](handleError(_0x4915bc,null));};exports[_0x49c4('0x47')]=function(_0x4d89e0,_0x3bac1b){return db['MemberReport'][_0x49c4('0x47')](_0x4d89e0[_0x49c4('0x48')],{})[_0x49c4('0x3f')](respondWithResult(_0x3bac1b,0xc9))[_0x49c4('0x44')](handleError(_0x3bac1b,null));};exports[_0x49c4('0x22')]=function(_0x30bea5,_0x2c6be1){if(_0x30bea5['body']['id']){delete _0x30bea5[_0x49c4('0x48')]['id'];}return db[_0x49c4('0x2a')]['find']({'where':{'id':_0x30bea5[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x3f')](saveUpdates(_0x30bea5[_0x49c4('0x48')],null))['then'](respondWithResult(_0x2c6be1,null))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x23')]=function(_0x4e8221,_0x4597c3){return db[_0x49c4('0x2a')][_0x49c4('0x46')]({'where':{'id':_0x4e8221[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x4597c3,null))[_0x49c4('0x3f')](removeEntity(_0x4597c3,null))[_0x49c4('0x44')](handleError(_0x4597c3,null));};exports['describe']=function(_0x1f26c2,_0x1550ce){return db[_0x49c4('0x2a')][_0x49c4('0x49')]()[_0x49c4('0x3f')](respondWithResult(_0x1550ce,null))[_0x49c4('0x44')](handleError(_0x1550ce,null));}; \ No newline at end of file +var _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(_0x2b8077,_0x453634){var _0x308091=function(_0x426df7){while(--_0x426df7){_0x2b8077['push'](_0x2b8077['shift']());}};_0x308091(++_0x453634);}(_0x34e8,0x12c));var _0x834e=function(_0x434c37,_0x61ee91){_0x434c37=_0x434c37-0x0;var _0x3cc37f=_0x34e8[_0x434c37];return _0x3cc37f;};'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 8eabdad..a1a813a 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 _0x4473=['path','exports','define','MemberReport','report_member','membername_interface','membername','interface','bluebird','request-promise'];(function(_0x5b306d,_0x498446){var _0x55bfc0=function(_0x589c50){while(--_0x589c50){_0x5b306d['push'](_0x5b306d['shift']());}};_0x55bfc0(++_0x498446);}(_0x4473,0x15c));var _0x3447=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x4473[_0x1d1779];return _0x2377e9;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x3447('0x0'));var rp=require(_0x3447('0x1'));var fs=require('fs');var path=require(_0x3447('0x2'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./memberReport.attributes');module[_0x3447('0x3')]=function(_0x3a82c7,_0x27f3c8){return _0x3a82c7[_0x3447('0x4')](_0x3447('0x5'),attributes,{'tableName':_0x3447('0x6'),'paranoid':![],'indexes':[{'name':_0x3447('0x7'),'fields':[_0x3447('0x8'),_0x3447('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x150a=['report_member','membername_interface','interface','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./memberReport.attributes','define','MemberReport'];(function(_0x1e4c44,_0x28478e){var _0x20dd61=function(_0x3d6bbd){while(--_0x3d6bbd){_0x1e4c44['push'](_0x1e4c44['shift']());}};_0x20dd61(++_0x28478e);}(_0x150a,0x1a7));var _0xa150=function(_0x200d69,_0x430951){_0x200d69=_0x200d69-0x0;var _0x14fde8=_0x150a[_0x200d69];return _0x14fde8;};'use strict';var _=require(_0xa150('0x0'));var util=require(_0xa150('0x1'));var logger=require(_0xa150('0x2'))('api');var moment=require(_0xa150('0x3'));var BPromise=require(_0xa150('0x4'));var rp=require(_0xa150('0x5'));var fs=require('fs');var path=require(_0xa150('0x6'));var rimraf=require('rimraf');var config=require(_0xa150('0x7'));var attributes=require(_0xa150('0x8'));module['exports']=function(_0x59c49c,_0x245742){return _0x59c49c[_0xa150('0x9')](_0xa150('0xa'),attributes,{'tableName':_0xa150('0xb'),'paranoid':![],'indexes':[{'name':_0xa150('0xc'),'fields':['membername',_0xa150('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 6589e0c..c42b567 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 _0x96fd=['model','map','CreateMemberReport','MemberReport','body','update','raw','UpdateMemberReport','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMemberReport','findAll','options','where','attributes','limit','include'];(function(_0x587333,_0x393113){var _0x2a7ea4=function(_0x24df34){while(--_0x24df34){_0x587333['push'](_0x587333['shift']());}};_0x2a7ea4(++_0x393113);}(_0x96fd,0x1e9));var _0xd96f=function(_0x11d544,_0x3947f2){_0x11d544=_0x11d544-0x0;var _0x2a2883=_0x96fd[_0x11d544];return _0x2a2883;};'use strict';var _=require('lodash');var util=require(_0xd96f('0x0'));var moment=require('moment');var BPromise=require(_0xd96f('0x1'));var rs=require(_0xd96f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd96f('0x3'))['db'];var utils=require(_0xd96f('0x4'));var logger=require(_0xd96f('0x5'))(_0xd96f('0x6'));var config=require('../../config/environment');var jayson=require(_0xd96f('0x7'));var client=jayson[_0xd96f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe6000a,_0x446862,_0x3ae72a){return new BPromise(function(_0xb32b34,_0x10a4f3){return client[_0xd96f('0x9')](_0xe6000a,_0x3ae72a)[_0xd96f('0xa')](function(_0x1f1543){logger[_0xd96f('0xb')](_0xd96f('0xc'),_0x446862,_0xd96f('0xd'));logger[_0xd96f('0xe')](_0xd96f('0xf'),_0x446862,_0xd96f('0xd'),JSON[_0xd96f('0x10')](_0x1f1543));if(_0x1f1543[_0xd96f('0x11')]){if(_0x1f1543[_0xd96f('0x11')][_0xd96f('0x12')]===0x1f4){logger['error']('MemberReport,\x20%s,\x20%s',_0x446862,_0x1f1543[_0xd96f('0x11')][_0xd96f('0x13')]);return _0x10a4f3(_0x1f1543['error']['message']);}logger[_0xd96f('0x11')](_0xd96f('0xc'),_0x446862,_0x1f1543[_0xd96f('0x11')][_0xd96f('0x13')]);return _0xb32b34(_0x1f1543[_0xd96f('0x11')][_0xd96f('0x13')]);}else{logger[_0xd96f('0xb')](_0xd96f('0xc'),_0x446862,_0xd96f('0xd'));_0xb32b34(_0x1f1543[_0xd96f('0x14')]['message']);}})[_0xd96f('0x15')](function(_0x569e1){logger['error'](_0xd96f('0xc'),_0x446862,_0x569e1);_0x10a4f3(_0x569e1);});});}exports[_0xd96f('0x16')]=function(_0x45c990){var _0x15d2d5=this;return new Promise(function(_0x7663e3,_0x1f1c2e){return db['MemberReport'][_0xd96f('0x17')]({'raw':_0x45c990[_0xd96f('0x18')]?_0x45c990[_0xd96f('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x45c990[_0xd96f('0x18')]?_0x45c990[_0xd96f('0x18')][_0xd96f('0x19')]||null:null,'attributes':_0x45c990[_0xd96f('0x18')]?_0x45c990[_0xd96f('0x18')][_0xd96f('0x1a')]||null:null,'limit':_0x45c990[_0xd96f('0x18')]?_0x45c990['options'][_0xd96f('0x1b')]||null:null,'include':_0x45c990[_0xd96f('0x18')]?_0x45c990['options'][_0xd96f('0x1c')]?_['map'](_0x45c990[_0xd96f('0x18')]['include'],function(_0x5ade3f){return{'model':db[_0x5ade3f[_0xd96f('0x1d')]],'as':_0x5ade3f['as'],'attributes':_0x5ade3f['attributes'],'include':_0x5ade3f['include']?_[_0xd96f('0x1e')](_0x5ade3f[_0xd96f('0x1c')],function(_0x1b4b26){return{'model':db[_0x1b4b26[_0xd96f('0x1d')]],'as':_0x1b4b26['as'],'attributes':_0x1b4b26[_0xd96f('0x1a')],'include':_0x1b4b26[_0xd96f('0x1c')]?_['map'](_0x1b4b26[_0xd96f('0x1c')],function(_0x24d81a){return{'model':db[_0x24d81a[_0xd96f('0x1d')]],'as':_0x24d81a['as'],'attributes':_0x24d81a[_0xd96f('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd96f('0xa')](function(_0x3725cd){logger[_0xd96f('0xb')](_0xd96f('0x16'),_0x45c990);logger[_0xd96f('0xe')](_0xd96f('0x16'),_0x45c990,JSON[_0xd96f('0x10')](_0x3725cd));_0x7663e3(_0x3725cd);})[_0xd96f('0x15')](function(_0x1e2ade){logger[_0xd96f('0x11')](_0xd96f('0x16'),_0x1e2ade[_0xd96f('0x13')],_0x45c990);_0x1f1c2e(_0x15d2d5[_0xd96f('0x11')](0x1f4,_0x1e2ade[_0xd96f('0x13')]));});});};exports[_0xd96f('0x1f')]=function(_0x1738dd){var _0x497b02=this;return new Promise(function(_0x3abf3d,_0x390863){return db[_0xd96f('0x20')]['create'](_0x1738dd[_0xd96f('0x21')],{'raw':_0x1738dd[_0xd96f('0x18')]?_0x1738dd[_0xd96f('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xd96f('0xa')](function(_0x5cea25){logger[_0xd96f('0xb')]('CreateMemberReport',_0x1738dd);logger[_0xd96f('0xe')](_0xd96f('0x1f'),_0x1738dd,JSON[_0xd96f('0x10')](_0x5cea25));_0x3abf3d(_0x5cea25);})[_0xd96f('0x15')](function(_0x239506){logger[_0xd96f('0x11')](_0xd96f('0x1f'),_0x239506['message'],_0x1738dd);_0x390863(_0x497b02['error'](0x1f4,_0x239506[_0xd96f('0x13')]));});});};exports['UpdateMemberReport']=function(_0x541b33){var _0x56fa1d=this;return new Promise(function(_0x38c05f,_0x31db2c){return db[_0xd96f('0x20')][_0xd96f('0x22')](_0x541b33['body'],{'raw':_0x541b33[_0xd96f('0x18')]?_0x541b33[_0xd96f('0x18')][_0xd96f('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x541b33[_0xd96f('0x18')]?_0x541b33[_0xd96f('0x18')][_0xd96f('0x19')]||null:null,'attributes':_0x541b33[_0xd96f('0x18')]?_0x541b33[_0xd96f('0x18')][_0xd96f('0x1a')]||null:null,'limit':_0x541b33[_0xd96f('0x18')]?_0x541b33[_0xd96f('0x18')][_0xd96f('0x1b')]||null:null})['then'](function(_0x13579f){logger[_0xd96f('0xb')](_0xd96f('0x24'),_0x541b33);logger[_0xd96f('0xe')]('UpdateMemberReport',_0x541b33,JSON[_0xd96f('0x10')](_0x13579f));_0x38c05f(_0x13579f);})[_0xd96f('0x15')](function(_0x7dff88){logger[_0xd96f('0x11')]('UpdateMemberReport',_0x7dff88['message'],_0x541b33);_0x31db2c(_0x56fa1d[_0xd96f('0x11')](0x1f4,_0x7dff88[_0xd96f('0x13')]));});});}; \ No newline at end of file +var _0xafc4=['lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','MemberReport,\x20%s,\x20%s','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','GetMemberReport','MemberReport','options','raw','where','attributes','limit','include','model','map','CreateMemberReport','create','body','debug','UpdateMemberReport'];(function(_0x595ae0,_0x4bdeae){var _0x87773a=function(_0xa7e1e7){while(--_0xa7e1e7){_0x595ae0['push'](_0x595ae0['shift']());}};_0x87773a(++_0x4bdeae);}(_0xafc4,0x69));var _0x4afc=function(_0x4ba578,_0xad9860){_0x4ba578=_0x4ba578-0x0;var _0x5a0af6=_0xafc4[_0x4ba578];return _0x5a0af6;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var moment=require(_0x4afc('0x1'));var BPromise=require('bluebird');var rs=require(_0x4afc('0x2'));var fs=require('fs');var Redis=require(_0x4afc('0x3'));var db=require(_0x4afc('0x4'))['db'];var utils=require(_0x4afc('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4afc('0x6'));var client=jayson[_0x4afc('0x7')][_0x4afc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1bb281,_0xc828d9,_0xaf053d){return new BPromise(function(_0x5e1e29,_0x31e165){return client[_0x4afc('0x9')](_0x1bb281,_0xaf053d)[_0x4afc('0xa')](function(_0x1e6bf5){logger[_0x4afc('0xb')](_0x4afc('0xc'),_0xc828d9,'request\x20sent');logger['debug'](_0x4afc('0xd'),_0xc828d9,'request\x20sent',JSON[_0x4afc('0xe')](_0x1e6bf5));if(_0x1e6bf5[_0x4afc('0xf')]){if(_0x1e6bf5['error'][_0x4afc('0x10')]===0x1f4){logger[_0x4afc('0xf')](_0x4afc('0xc'),_0xc828d9,_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);return _0x31e165(_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);}logger[_0x4afc('0xf')]('MemberReport,\x20%s,\x20%s',_0xc828d9,_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);return _0x5e1e29(_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);}else{logger['info']('MemberReport,\x20%s,\x20%s',_0xc828d9,_0x4afc('0x12'));_0x5e1e29(_0x1e6bf5['result'][_0x4afc('0x11')]);}})[_0x4afc('0x13')](function(_0x2b928b){logger[_0x4afc('0xf')](_0x4afc('0xc'),_0xc828d9,_0x2b928b);_0x31e165(_0x2b928b);});});}exports[_0x4afc('0x14')]=function(_0x22f809){var _0x3ad418=this;return new Promise(function(_0x16365f,_0x135349){return db[_0x4afc('0x15')]['findAll']({'raw':_0x22f809[_0x4afc('0x16')]?_0x22f809[_0x4afc('0x16')][_0x4afc('0x17')]===undefined?!![]:![]:!![],'where':_0x22f809[_0x4afc('0x16')]?_0x22f809['options'][_0x4afc('0x18')]||null:null,'attributes':_0x22f809[_0x4afc('0x16')]?_0x22f809[_0x4afc('0x16')][_0x4afc('0x19')]||null:null,'limit':_0x22f809[_0x4afc('0x16')]?_0x22f809[_0x4afc('0x16')][_0x4afc('0x1a')]||null:null,'include':_0x22f809['options']?_0x22f809[_0x4afc('0x16')][_0x4afc('0x1b')]?_['map'](_0x22f809[_0x4afc('0x16')]['include'],function(_0x1aa676){return{'model':db[_0x1aa676[_0x4afc('0x1c')]],'as':_0x1aa676['as'],'attributes':_0x1aa676[_0x4afc('0x19')],'include':_0x1aa676[_0x4afc('0x1b')]?_[_0x4afc('0x1d')](_0x1aa676[_0x4afc('0x1b')],function(_0x40a0db){return{'model':db[_0x40a0db[_0x4afc('0x1c')]],'as':_0x40a0db['as'],'attributes':_0x40a0db[_0x4afc('0x19')],'include':_0x40a0db[_0x4afc('0x1b')]?_[_0x4afc('0x1d')](_0x40a0db[_0x4afc('0x1b')],function(_0x35f5b3){return{'model':db[_0x35f5b3['model']],'as':_0x35f5b3['as'],'attributes':_0x35f5b3[_0x4afc('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4afc('0xa')](function(_0x2d6112){logger['info']('GetMemberReport',_0x22f809);logger['debug'](_0x4afc('0x14'),_0x22f809,JSON[_0x4afc('0xe')](_0x2d6112));_0x16365f(_0x2d6112);})['catch'](function(_0xd26d2f){logger[_0x4afc('0xf')]('GetMemberReport',_0xd26d2f['message'],_0x22f809);_0x135349(_0x3ad418['error'](0x1f4,_0xd26d2f[_0x4afc('0x11')]));});});};exports[_0x4afc('0x1e')]=function(_0x17a43d){var _0x46357b=this;return new Promise(function(_0xc1d91,_0x28cd3e){return db['MemberReport'][_0x4afc('0x1f')](_0x17a43d[_0x4afc('0x20')],{'raw':_0x17a43d[_0x4afc('0x16')]?_0x17a43d[_0x4afc('0x16')][_0x4afc('0x17')]===undefined?!![]:![]:!![]})[_0x4afc('0xa')](function(_0xbabe1e){logger[_0x4afc('0xb')]('CreateMemberReport',_0x17a43d);logger[_0x4afc('0x21')]('CreateMemberReport',_0x17a43d,JSON['stringify'](_0xbabe1e));_0xc1d91(_0xbabe1e);})[_0x4afc('0x13')](function(_0x33ebbc){logger[_0x4afc('0xf')](_0x4afc('0x1e'),_0x33ebbc[_0x4afc('0x11')],_0x17a43d);_0x28cd3e(_0x46357b[_0x4afc('0xf')](0x1f4,_0x33ebbc['message']));});});};exports[_0x4afc('0x22')]=function(_0x2d0ad8){var _0x111dbf=this;return new Promise(function(_0x127ac8,_0x3127e6){return db[_0x4afc('0x15')]['update'](_0x2d0ad8[_0x4afc('0x20')],{'raw':_0x2d0ad8[_0x4afc('0x16')]?_0x2d0ad8[_0x4afc('0x16')][_0x4afc('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d0ad8['options']?_0x2d0ad8['options'][_0x4afc('0x18')]||null:null,'attributes':_0x2d0ad8[_0x4afc('0x16')]?_0x2d0ad8[_0x4afc('0x16')]['attributes']||null:null,'limit':_0x2d0ad8['options']?_0x2d0ad8[_0x4afc('0x16')]['limit']||null:null})['then'](function(_0x295b53){logger[_0x4afc('0xb')](_0x4afc('0x22'),_0x2d0ad8);logger[_0x4afc('0x21')](_0x4afc('0x22'),_0x2d0ad8,JSON[_0x4afc('0xe')](_0x295b53));_0x127ac8(_0x295b53);})[_0x4afc('0x13')](function(_0x29c0df){logger[_0x4afc('0xf')](_0x4afc('0x22'),_0x29c0df[_0x4afc('0x11')],_0x2d0ad8);_0x3127e6(_0x111dbf[_0x4afc('0xf')](0x1f4,_0x29c0df[_0x4afc('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 5bd97fc..3ea1f07 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 _0x7852=['fs-extra','../../components/auth/service','../../config/environment','./migration.controller','get','multer','path','connect-timeout','Router'];(function(_0x5b6e9c,_0x5ad208){var _0x5b3a24=function(_0xc7b9ba){while(--_0xc7b9ba){_0x5b6e9c['push'](_0x5b6e9c['shift']());}};_0x5b3a24(++_0x5ad208);}(_0x7852,0x137));var _0x2785=function(_0x5963cf,_0x3064d6){_0x5963cf=_0x5963cf-0x0;var _0x1a4f67=_0x7852[_0x5963cf];return _0x1a4f67;};'use strict';var multer=require(_0x2785('0x0'));var util=require('util');var path=require(_0x2785('0x1'));var timeout=require(_0x2785('0x2'));var express=require('express');var router=express[_0x2785('0x3')]();var fs_extra=require(_0x2785('0x4'));var auth=require(_0x2785('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2785('0x6'));var controller=require(_0x2785('0x7'));router[_0x2785('0x8')]('/',controller['index']);module['exports']=router; \ No newline at end of file +var _0x2499=['../../components/interaction/service','./migration.controller','get','index','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x2499,0x7d));var _0x9249=function(_0x500ca7,_0x5d4949){_0x500ca7=_0x500ca7-0x0;var _0x1d09ae=_0x2499[_0x500ca7];return _0x1d09ae;};'use strict';var multer=require(_0x9249('0x0'));var util=require(_0x9249('0x1'));var path=require(_0x9249('0x2'));var timeout=require(_0x9249('0x3'));var express=require(_0x9249('0x4'));var router=express['Router']();var fs_extra=require(_0x9249('0x5'));var auth=require(_0x9249('0x6'));var interaction=require(_0x9249('0x7'));var config=require('../../config/environment');var controller=require(_0x9249('0x8'));router[_0x9249('0x9')]('/',controller[_0x9249('0xa')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index df2007e..448f032 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 _0x7ed2=['exports','STRING','sequelize'];(function(_0x44b431,_0x538c94){var _0xe6dcbe=function(_0x298188){while(--_0x298188){_0x44b431['push'](_0x44b431['shift']());}};_0xe6dcbe(++_0x538c94);}(_0x7ed2,0x173));var _0x27ed=function(_0x5697ef,_0x2b870a){_0x5697ef=_0x5697ef-0x0;var _0x4fe292=_0x7ed2[_0x5697ef];return _0x4fe292;};'use strict';var Sequelize=require(_0x27ed('0x0'));module[_0x27ed('0x1')]={'version':{'type':Sequelize[_0x27ed('0x2')],'unique':'version'}}; \ No newline at end of file +var _0xe5c6=['exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe5c6,0xbb));var _0x6e5c=function(_0x45faab,_0x384f81){_0x45faab=_0x45faab-0x0;var _0x2f7be9=_0xe5c6[_0x45faab];return _0x2f7be9;};'use strict';var Sequelize=require('sequelize');module[_0x6e5c('0x0')]={'version':{'type':Sequelize['STRING'],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 34b8922..b066c1e 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 _0x2032=['pick','filter','merge','VIRTUAL','options','Migration','includeAll','include','findAll','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where'];(function(_0xde1c77,_0x3a7049){var _0x4be9de=function(_0x401a99){while(--_0x401a99){_0xde1c77['push'](_0xde1c77['shift']());}};_0x4be9de(++_0x3a7049);}(_0x2032,0xe2));var _0x2203=function(_0x3fadd1,_0x330846){_0x3fadd1=_0x3fadd1-0x0;var _0x1b03ee=_0x2032[_0x3fadd1];return _0x1b03ee;};'use strict';var emlformat=require(_0x2203('0x0'));var rimraf=require(_0x2203('0x1'));var zipdir=require(_0x2203('0x2'));var jsonpatch=require(_0x2203('0x3'));var rp=require('request-promise');var moment=require(_0x2203('0x4'));var BPromise=require(_0x2203('0x5'));var Mustache=require(_0x2203('0x6'));var util=require(_0x2203('0x7'));var path=require(_0x2203('0x8'));var sox=require(_0x2203('0x9'));var csv=require(_0x2203('0xa'));var ejs=require(_0x2203('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2203('0xc'));var deskjs=require(_0x2203('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2203('0xe'));var Papa=require(_0x2203('0xf'));var Redis=require(_0x2203('0x10'));var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require(_0x2203('0x14'));var logger=require(_0x2203('0x15'))(_0x2203('0x16'));var utils=require(_0x2203('0x17'));var config=require(_0x2203('0x18'));var licenseUtil=require(_0x2203('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17f382,_0xa2249d){_0xa2249d=_0xa2249d||0xcc;return function(_0x1195a8){if(_0x1195a8){return _0x17f382[_0x2203('0x1a')](_0xa2249d);}return _0x17f382['status'](_0xa2249d)[_0x2203('0x1b')]();};}function respondWithResult(_0x164914,_0x2e35ad){_0x2e35ad=_0x2e35ad||0xc8;return function(_0x1f2ed3){if(_0x1f2ed3){return _0x164914[_0x2203('0x1c')](_0x2e35ad)[_0x2203('0x1d')](_0x1f2ed3);}};}function respondWithFilteredResult(_0x2b19e1,_0x19522f){return function(_0x12e5e7){if(_0x12e5e7){var _0x12322d=typeof _0x19522f[_0x2203('0x1e')]===_0x2203('0x1f')&&typeof _0x19522f[_0x2203('0x20')]===_0x2203('0x1f');var _0x4668e5=_0x12e5e7[_0x2203('0x21')];var _0x5873d6=_0x12322d?0x0:_0x19522f[_0x2203('0x1e')];var _0x1f2261=_0x12322d?_0x12e5e7[_0x2203('0x21')]:_0x19522f[_0x2203('0x1e')]+_0x19522f[_0x2203('0x20')];var _0x2169f0;if(_0x1f2261>=_0x4668e5){_0x1f2261=_0x4668e5;_0x2169f0=0xc8;}else{_0x2169f0=0xce;}_0x2b19e1[_0x2203('0x1c')](_0x2169f0);return _0x2b19e1[_0x2203('0x22')](_0x2203('0x23'),_0x5873d6+'-'+_0x1f2261+'/'+_0x4668e5)['json'](_0x12e5e7);}return null;};}function patchUpdates(_0x1fdb84){return function(_0x5a4ebf){try{jsonpatch['apply'](_0x5a4ebf,_0x1fdb84,!![]);}catch(_0x4092fc){return BPromise[_0x2203('0x24')](_0x4092fc);}return _0x5a4ebf[_0x2203('0x25')]();};}function saveUpdates(_0x4748da,_0x36c363){return function(_0x59fff0){if(_0x59fff0){return _0x59fff0[_0x2203('0x26')](_0x4748da)[_0x2203('0x27')](function(_0x2e5d12){return _0x2e5d12;});}return null;};}function removeEntity(_0x600cf6,_0x42a041){return function(_0x12a8d9){if(_0x12a8d9){return _0x12a8d9[_0x2203('0x28')]()['then'](function(){_0x600cf6[_0x2203('0x1c')](0xcc)[_0x2203('0x1b')]();});}};}function handleEntityNotFound(_0x325684,_0xb49398){return function(_0x339847){if(!_0x339847){_0x325684[_0x2203('0x1a')](0x194);}return _0x339847;};}function handleError(_0x18c48c,_0xe8f833){_0xe8f833=_0xe8f833||0x1f4;return function(_0x26fce9){logger[_0x2203('0x29')](_0x26fce9[_0x2203('0x2a')]);if(_0x26fce9['name']){delete _0x26fce9[_0x2203('0x2b')];}_0x18c48c['status'](_0xe8f833)['send'](_0x26fce9);};}exports[_0x2203('0x2c')]=function(_0x31aeaf,_0x51ee88){var _0x1da2b3={},_0x9a35c9={},_0x10deaa={'count':0x0,'rows':[]};var _0x4798a8=_[_0x2203('0x2d')](db['Migration'][_0x2203('0x2e')],function(_0x517095){return{'name':_0x517095[_0x2203('0x2f')],'type':_0x517095[_0x2203('0x30')][_0x2203('0x31')]};});_0x9a35c9[_0x2203('0x32')]=_['map'](_0x4798a8,_0x2203('0x2b'));_0x9a35c9[_0x2203('0x33')]=_[_0x2203('0x34')](_0x31aeaf[_0x2203('0x33')]);_0x9a35c9[_0x2203('0x35')]=_[_0x2203('0x36')](_0x9a35c9[_0x2203('0x32')],_0x9a35c9[_0x2203('0x33')]);_0x1da2b3[_0x2203('0x37')]=_[_0x2203('0x36')](_0x9a35c9[_0x2203('0x32')],qs[_0x2203('0x38')](_0x31aeaf['query'][_0x2203('0x38')]));_0x1da2b3[_0x2203('0x37')]=_0x1da2b3[_0x2203('0x37')][_0x2203('0x39')]?_0x1da2b3[_0x2203('0x37')]:_0x9a35c9[_0x2203('0x32')];if(!_0x31aeaf['query']['hasOwnProperty'](_0x2203('0x3a'))){_0x1da2b3[_0x2203('0x20')]=qs[_0x2203('0x20')](_0x31aeaf[_0x2203('0x33')]['limit']);_0x1da2b3['offset']=qs[_0x2203('0x1e')](_0x31aeaf[_0x2203('0x33')][_0x2203('0x1e')]);}_0x1da2b3[_0x2203('0x3b')]=qs[_0x2203('0x3c')](_0x31aeaf[_0x2203('0x33')][_0x2203('0x3c')]);_0x1da2b3[_0x2203('0x3d')]=qs['filters'](_[_0x2203('0x3e')](_0x31aeaf[_0x2203('0x33')],_0x9a35c9[_0x2203('0x35')]),_0x4798a8);if(_0x31aeaf[_0x2203('0x33')][_0x2203('0x3f')]){_0x1da2b3[_0x2203('0x3d')]=_[_0x2203('0x40')](_0x1da2b3[_0x2203('0x3d')],{'$or':_[_0x2203('0x2d')](_0x4798a8,function(_0x1b71f0){if(_0x1b71f0[_0x2203('0x30')]!==_0x2203('0x41')){var _0x3776aa={};_0x3776aa[_0x1b71f0[_0x2203('0x2b')]]={'$like':'%'+_0x31aeaf['query']['filter']+'%'};return _0x3776aa;}})});}_0x1da2b3=_[_0x2203('0x40')]({},_0x1da2b3,_0x31aeaf[_0x2203('0x42')]);var _0x432adb={'where':_0x1da2b3['where']};return db[_0x2203('0x43')][_0x2203('0x21')](_0x432adb)[_0x2203('0x27')](function(_0x25abd9){_0x10deaa[_0x2203('0x21')]=_0x25abd9;if(_0x31aeaf[_0x2203('0x33')][_0x2203('0x44')]){_0x1da2b3[_0x2203('0x45')]=[{'all':!![]}];}return db['Migration'][_0x2203('0x46')](_0x1da2b3);})[_0x2203('0x27')](function(_0x31600a){_0x10deaa['rows']=_0x31600a;return _0x10deaa;})['then'](respondWithFilteredResult(_0x51ee88,_0x1da2b3))[_0x2203('0x47')](handleError(_0x51ee88,null));}; \ No newline at end of file +var _0x163b=['model','attributes','fields','length','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','findAll','rows','eml-format','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','Migration','rawAttributes','fieldName','type','map','query','keys','filters','intersection'];(function(_0x315f9a,_0x2b67fc){var _0x22adf4=function(_0x55bfdd){while(--_0x55bfdd){_0x315f9a['push'](_0x315f9a['shift']());}};_0x22adf4(++_0x2b67fc);}(_0x163b,0x91));var _0xb163=function(_0x37b4af,_0x43c63b){_0x37b4af=_0x37b4af-0x0;var _0x30043a=_0x163b[_0x37b4af];return _0x30043a;};'use strict';var emlformat=require(_0xb163('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb163('0x1'));var rp=require(_0xb163('0x2'));var moment=require(_0xb163('0x3'));var BPromise=require(_0xb163('0x4'));var Mustache=require('mustache');var util=require(_0xb163('0x5'));var path=require('path');var sox=require(_0xb163('0x6'));var csv=require(_0xb163('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb163('0x8'));var squel=require(_0xb163('0x9'));var crypto=require(_0xb163('0xa'));var jsforce=require(_0xb163('0xb'));var deskjs=require(_0xb163('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb163('0xd'));var Papa=require(_0xb163('0xe'));var Redis=require('ioredis');var authService=require(_0xb163('0xf'));var qs=require(_0xb163('0x10'));var as=require(_0xb163('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb163('0x12'))('api');var utils=require(_0xb163('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb163('0x14'))['db'];function respondWithStatusCode(_0xdfdf61,_0x494c4c){_0x494c4c=_0x494c4c||0xcc;return function(_0x3ebfa6){if(_0x3ebfa6){return _0xdfdf61[_0xb163('0x15')](_0x494c4c);}return _0xdfdf61[_0xb163('0x16')](_0x494c4c)[_0xb163('0x17')]();};}function respondWithResult(_0x446775,_0xd3c599){_0xd3c599=_0xd3c599||0xc8;return function(_0x3419d2){if(_0x3419d2){return _0x446775[_0xb163('0x16')](_0xd3c599)[_0xb163('0x18')](_0x3419d2);}};}function respondWithFilteredResult(_0x1266fd,_0x2d5965){return function(_0xc1336c){if(_0xc1336c){var _0x4888b1=typeof _0x2d5965['offset']===_0xb163('0x19')&&typeof _0x2d5965[_0xb163('0x1a')]===_0xb163('0x19');var _0x177ef0=_0xc1336c[_0xb163('0x1b')];var _0x3d6e67=_0x4888b1?0x0:_0x2d5965[_0xb163('0x1c')];var _0x3ecc9d=_0x4888b1?_0xc1336c[_0xb163('0x1b')]:_0x2d5965[_0xb163('0x1c')]+_0x2d5965['limit'];var _0x5b7e1d;if(_0x3ecc9d>=_0x177ef0){_0x3ecc9d=_0x177ef0;_0x5b7e1d=0xc8;}else{_0x5b7e1d=0xce;}_0x1266fd[_0xb163('0x16')](_0x5b7e1d);return _0x1266fd['set'](_0xb163('0x1d'),_0x3d6e67+'-'+_0x3ecc9d+'/'+_0x177ef0)[_0xb163('0x18')](_0xc1336c);}return null;};}function patchUpdates(_0x94a368){return function(_0x4137a3){try{jsonpatch[_0xb163('0x1e')](_0x4137a3,_0x94a368,!![]);}catch(_0x3ac78c){return BPromise[_0xb163('0x1f')](_0x3ac78c);}return _0x4137a3[_0xb163('0x20')]();};}function saveUpdates(_0x206896,_0x7aeef0){return function(_0x52424b){if(_0x52424b){return _0x52424b[_0xb163('0x21')](_0x206896)[_0xb163('0x22')](function(_0x9b703d){return _0x9b703d;});}return null;};}function removeEntity(_0x43da6a,_0x119d4e){return function(_0x3860ab){if(_0x3860ab){return _0x3860ab[_0xb163('0x23')]()[_0xb163('0x22')](function(){_0x43da6a[_0xb163('0x16')](0xcc)[_0xb163('0x17')]();});}};}function handleEntityNotFound(_0x2c8076,_0x438c61){return function(_0x50fd9e){if(!_0x50fd9e){_0x2c8076[_0xb163('0x15')](0x194);}return _0x50fd9e;};}function handleError(_0xd29d20,_0x5f2136){_0x5f2136=_0x5f2136||0x1f4;return function(_0x6370ef){logger[_0xb163('0x24')](_0x6370ef[_0xb163('0x25')]);if(_0x6370ef[_0xb163('0x26')]){delete _0x6370ef[_0xb163('0x26')];}_0xd29d20[_0xb163('0x16')](_0x5f2136)[_0xb163('0x27')](_0x6370ef);};}exports[_0xb163('0x28')]=function(_0x173d95,_0x179b51){var _0x3a6d6a={},_0x17b53d={},_0x4a874b={'count':0x0,'rows':[]};var _0x17cd02=_['map'](db[_0xb163('0x29')][_0xb163('0x2a')],function(_0x521a5b){return{'name':_0x521a5b[_0xb163('0x2b')],'type':_0x521a5b[_0xb163('0x2c')]['key']};});_0x17b53d['model']=_[_0xb163('0x2d')](_0x17cd02,'name');_0x17b53d[_0xb163('0x2e')]=_[_0xb163('0x2f')](_0x173d95[_0xb163('0x2e')]);_0x17b53d[_0xb163('0x30')]=_[_0xb163('0x31')](_0x17b53d[_0xb163('0x32')],_0x17b53d[_0xb163('0x2e')]);_0x3a6d6a[_0xb163('0x33')]=_[_0xb163('0x31')](_0x17b53d[_0xb163('0x32')],qs[_0xb163('0x34')](_0x173d95['query'][_0xb163('0x34')]));_0x3a6d6a[_0xb163('0x33')]=_0x3a6d6a[_0xb163('0x33')][_0xb163('0x35')]?_0x3a6d6a[_0xb163('0x33')]:_0x17b53d[_0xb163('0x32')];if(!_0x173d95[_0xb163('0x2e')]['hasOwnProperty'](_0xb163('0x36'))){_0x3a6d6a['limit']=qs[_0xb163('0x1a')](_0x173d95[_0xb163('0x2e')][_0xb163('0x1a')]);_0x3a6d6a[_0xb163('0x1c')]=qs['offset'](_0x173d95[_0xb163('0x2e')]['offset']);}_0x3a6d6a[_0xb163('0x37')]=qs[_0xb163('0x38')](_0x173d95['query'][_0xb163('0x38')]);_0x3a6d6a['where']=qs[_0xb163('0x30')](_['pick'](_0x173d95['query'],_0x17b53d[_0xb163('0x30')]),_0x17cd02);if(_0x173d95['query'][_0xb163('0x39')]){_0x3a6d6a['where']=_[_0xb163('0x3a')](_0x3a6d6a[_0xb163('0x3b')],{'$or':_[_0xb163('0x2d')](_0x17cd02,function(_0x2152a9){if(_0x2152a9[_0xb163('0x2c')]!==_0xb163('0x3c')){var _0x42d1cd={};_0x42d1cd[_0x2152a9['name']]={'$like':'%'+_0x173d95[_0xb163('0x2e')][_0xb163('0x39')]+'%'};return _0x42d1cd;}})});}_0x3a6d6a=_['merge']({},_0x3a6d6a,_0x173d95[_0xb163('0x3d')]);var _0x13fd71={'where':_0x3a6d6a[_0xb163('0x3b')]};return db[_0xb163('0x29')]['count'](_0x13fd71)[_0xb163('0x22')](function(_0x14f925){_0x4a874b[_0xb163('0x1b')]=_0x14f925;if(_0x173d95[_0xb163('0x2e')][_0xb163('0x3e')]){_0x3a6d6a['include']=[{'all':!![]}];}return db[_0xb163('0x29')][_0xb163('0x3f')](_0x3a6d6a);})['then'](function(_0x91d1d9){_0x4a874b[_0xb163('0x40')]=_0x91d1d9;return _0x4a874b;})['then'](respondWithFilteredResult(_0x179b51,_0x3a6d6a))['catch'](handleError(_0x179b51,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index a152bf1..9c00e77 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 _0x0763=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','exports','migrations','lodash','util'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x0763,0x150));var _0x3076=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0x0763[_0x4b73a2];return _0x383c66;};'use strict';var _=require(_0x3076('0x0'));var util=require(_0x3076('0x1'));var logger=require(_0x3076('0x2'))(_0x3076('0x3'));var moment=require(_0x3076('0x4'));var BPromise=require(_0x3076('0x5'));var rp=require(_0x3076('0x6'));var fs=require('fs');var path=require(_0x3076('0x7'));var rimraf=require(_0x3076('0x8'));var config=require(_0x3076('0x9'));var attributes=require(_0x3076('0xa'));module[_0x3076('0xb')]=function(_0x509f58,_0x630254){return _0x509f58['define']('Migration',attributes,{'tableName':_0x3076('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a71=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','define','migrations'];(function(_0x1b0cbb,_0x317bd9){var _0xf65219=function(_0x19a30e){while(--_0x19a30e){_0x1b0cbb['push'](_0x1b0cbb['shift']());}};_0xf65219(++_0x317bd9);}(_0x2a71,0x179));var _0x12a7=function(_0x343f5b,_0x5c5f5f){_0x343f5b=_0x343f5b-0x0;var _0x14d9cc=_0x2a71[_0x343f5b];return _0x14d9cc;};'use strict';var _=require(_0x12a7('0x0'));var util=require(_0x12a7('0x1'));var logger=require(_0x12a7('0x2'))(_0x12a7('0x3'));var moment=require(_0x12a7('0x4'));var BPromise=require(_0x12a7('0x5'));var rp=require(_0x12a7('0x6'));var fs=require('fs');var path=require(_0x12a7('0x7'));var rimraf=require(_0x12a7('0x8'));var config=require(_0x12a7('0x9'));var attributes=require(_0x12a7('0xa'));module['exports']=function(_0xdfe28f,_0x4506b1){return _0xdfe28f[_0x12a7('0xb')]('Migration',attributes,{'tableName':_0x12a7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 641def1..15f357b 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 _0xea1a=['info','Migration,\x20%s,\x20%s,\x20%s','error','Migration,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x117696,_0x18926a){var _0x5bef49=function(_0x1662cb){while(--_0x1662cb){_0x117696['push'](_0x117696['shift']());}};_0x5bef49(++_0x18926a);}(_0xea1a,0x158));var _0xaea1=function(_0xd90015,_0x5aaa2b){_0xd90015=_0xd90015-0x0;var _0x68d03d=_0xea1a[_0xd90015];return _0x68d03d;};'use strict';var _=require(_0xaea1('0x0'));var util=require(_0xaea1('0x1'));var moment=require(_0xaea1('0x2'));var BPromise=require(_0xaea1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaea1('0x4'));var db=require(_0xaea1('0x5'))['db'];var utils=require(_0xaea1('0x6'));var logger=require(_0xaea1('0x7'))(_0xaea1('0x8'));var config=require(_0xaea1('0x9'));var jayson=require(_0xaea1('0xa'));var client=jayson[_0xaea1('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x884233,_0x8883ab,_0x3359a9){return new BPromise(function(_0x51ca63,_0x1b5adf){return client['request'](_0x884233,_0x3359a9)[_0xaea1('0xc')](function(_0x4892e0){logger[_0xaea1('0xd')]('Migration,\x20%s,\x20%s',_0x8883ab,'request\x20sent');logger['debug'](_0xaea1('0xe'),_0x8883ab,'request\x20sent',JSON['stringify'](_0x4892e0));if(_0x4892e0[_0xaea1('0xf')]){if(_0x4892e0[_0xaea1('0xf')]['code']===0x1f4){logger[_0xaea1('0xf')](_0xaea1('0x10'),_0x8883ab,_0x4892e0[_0xaea1('0xf')][_0xaea1('0x11')]);return _0x1b5adf(_0x4892e0[_0xaea1('0xf')][_0xaea1('0x11')]);}logger[_0xaea1('0xf')]('Migration,\x20%s,\x20%s',_0x8883ab,_0x4892e0[_0xaea1('0xf')][_0xaea1('0x11')]);return _0x51ca63(_0x4892e0[_0xaea1('0xf')][_0xaea1('0x11')]);}else{logger[_0xaea1('0xd')](_0xaea1('0x10'),_0x8883ab,_0xaea1('0x12'));_0x51ca63(_0x4892e0[_0xaea1('0x13')][_0xaea1('0x11')]);}})[_0xaea1('0x14')](function(_0x2920f7){logger[_0xaea1('0xf')](_0xaea1('0x10'),_0x8883ab,_0x2920f7);_0x1b5adf(_0x2920f7);});});} \ No newline at end of file +var _0x6c76=['request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','request','info','Migration,\x20%s,\x20%s'];(function(_0x1824f0,_0x450d1c){var _0x22df10=function(_0x3d7a4f){while(--_0x3d7a4f){_0x1824f0['push'](_0x1824f0['shift']());}};_0x22df10(++_0x450d1c);}(_0x6c76,0x184));var _0x66c7=function(_0x40850a,_0x240159){_0x40850a=_0x40850a-0x0;var _0x3f6fca=_0x6c76[_0x40850a];return _0x3f6fca;};'use strict';var _=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var moment=require(_0x66c7('0x2'));var BPromise=require('bluebird');var rs=require(_0x66c7('0x3'));var fs=require('fs');var Redis=require(_0x66c7('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x66c7('0x5'))(_0x66c7('0x6'));var config=require('../../config/environment');var jayson=require(_0x66c7('0x7'));var client=jayson[_0x66c7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23408c,_0x4dffcd,_0x4fa6ce){return new BPromise(function(_0x208d06,_0x2b0065){return client[_0x66c7('0x9')](_0x23408c,_0x4fa6ce)['then'](function(_0x20c010){logger[_0x66c7('0xa')](_0x66c7('0xb'),_0x4dffcd,_0x66c7('0xc'));logger['debug'](_0x66c7('0xd'),_0x4dffcd,_0x66c7('0xc'),JSON[_0x66c7('0xe')](_0x20c010));if(_0x20c010[_0x66c7('0xf')]){if(_0x20c010[_0x66c7('0xf')][_0x66c7('0x10')]===0x1f4){logger[_0x66c7('0xf')]('Migration,\x20%s,\x20%s',_0x4dffcd,_0x20c010[_0x66c7('0xf')][_0x66c7('0x11')]);return _0x2b0065(_0x20c010[_0x66c7('0xf')][_0x66c7('0x11')]);}logger[_0x66c7('0xf')](_0x66c7('0xb'),_0x4dffcd,_0x20c010[_0x66c7('0xf')][_0x66c7('0x11')]);return _0x208d06(_0x20c010[_0x66c7('0xf')]['message']);}else{logger[_0x66c7('0xa')]('Migration,\x20%s,\x20%s',_0x4dffcd,_0x66c7('0xc'));_0x208d06(_0x20c010[_0x66c7('0x12')][_0x66c7('0x11')]);}})[_0x66c7('0x13')](function(_0x22b262){logger['error']('Migration,\x20%s,\x20%s',_0x4dffcd,_0x22b262);_0x2b0065(_0x22b262);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 42cbf06..81eeae0 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 _0x6dc0=['get','/:id','show','post','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./network.controller','isAuthenticated'];(function(_0x5ac1e5,_0x4b5012){var _0x1bccc6=function(_0x102562){while(--_0x102562){_0x5ac1e5['push'](_0x5ac1e5['shift']());}};_0x1bccc6(++_0x4b5012);}(_0x6dc0,0xb6));var _0x06dc=function(_0x81aad8,_0x11602d){_0x81aad8=_0x81aad8-0x0;var _0x587403=_0x6dc0[_0x81aad8];return _0x587403;};'use strict';var multer=require(_0x06dc('0x0'));var util=require(_0x06dc('0x1'));var path=require(_0x06dc('0x2'));var timeout=require('connect-timeout');var express=require(_0x06dc('0x3'));var router=express[_0x06dc('0x4')]();var fs_extra=require(_0x06dc('0x5'));var auth=require(_0x06dc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x06dc('0x7'));var controller=require(_0x06dc('0x8'));router['get']('/',auth[_0x06dc('0x9')](),controller['index']);router[_0x06dc('0xa')](_0x06dc('0xb'),auth[_0x06dc('0x9')](),controller[_0x06dc('0xc')]);router[_0x06dc('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x06dc('0xb'),auth[_0x06dc('0x9')](),controller['update']);router[_0x06dc('0xe')](_0x06dc('0xb'),auth[_0x06dc('0x9')](),controller[_0x06dc('0xf')]);module['exports']=router; \ No newline at end of file +var _0x7b77=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./network.controller','get','isAuthenticated','index','show','post','create','update','delete','destroy','exports','multer','util','path'];(function(_0x8ea18d,_0x4f5e70){var _0x285c0d=function(_0xb604cf){while(--_0xb604cf){_0x8ea18d['push'](_0x8ea18d['shift']());}};_0x285c0d(++_0x4f5e70);}(_0x7b77,0x179));var _0x77b7=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x7b77[_0x178e48];return _0x440d7e;};'use strict';var multer=require(_0x77b7('0x0'));var util=require(_0x77b7('0x1'));var path=require(_0x77b7('0x2'));var timeout=require(_0x77b7('0x3'));var express=require('express');var router=express[_0x77b7('0x4')]();var fs_extra=require(_0x77b7('0x5'));var auth=require(_0x77b7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x77b7('0x7'));var controller=require(_0x77b7('0x8'));router[_0x77b7('0x9')]('/',auth[_0x77b7('0xa')](),controller[_0x77b7('0xb')]);router[_0x77b7('0x9')]('/:id',auth[_0x77b7('0xa')](),controller[_0x77b7('0xc')]);router[_0x77b7('0xd')]('/',auth['isAuthenticated'](),controller[_0x77b7('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x77b7('0xf')]);router[_0x77b7('0x10')]('/:id',auth[_0x77b7('0xa')](),controller[_0x77b7('0x11')]);module[_0x77b7('0x12')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index bab1f05..be7b9e1 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 _0x7042=['localnet','externip','stun','turn','STRING','exports','ENUM'];(function(_0x28add6,_0x1c1430){var _0x2e4b89=function(_0x2aa051){while(--_0x2aa051){_0x28add6['push'](_0x28add6['shift']());}};_0x2e4b89(++_0x1c1430);}(_0x7042,0x1b0));var _0x2704=function(_0x115a47,_0x4a140f){_0x115a47=_0x115a47-0x0;var _0x2070bf=_0x7042[_0x115a47];return _0x2070bf;};'use strict';var Sequelize=require('sequelize');module[_0x2704('0x0')]={'type':{'type':Sequelize[_0x2704('0x1')](_0x2704('0x2'),_0x2704('0x3'),_0x2704('0x4'),_0x2704('0x5'))},'value':{'type':Sequelize[_0x2704('0x6')]},'username':{'type':Sequelize[_0x2704('0x6')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc748=['stun','turn','STRING','exports','externip'];(function(_0x2568e8,_0x4622c3){var _0x4169fa=function(_0x1260af){while(--_0x1260af){_0x2568e8['push'](_0x2568e8['shift']());}};_0x4169fa(++_0x4622c3);}(_0xc748,0xa3));var _0x8c74=function(_0x4b1032,_0x36952e){_0x4b1032=_0x4b1032-0x0;var _0x5a1d55=_0xc748[_0x4b1032];return _0x5a1d55;};'use strict';var Sequelize=require('sequelize');module[_0x8c74('0x0')]={'type':{'type':Sequelize['ENUM']('localnet',_0x8c74('0x1'),_0x8c74('0x2'),_0x8c74('0x3'))},'value':{'type':Sequelize[_0x8c74('0x4')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 9277980..45ff15a 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 _0x2fd7=['toUpperCase','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','TURN','readFileSync','server/files/templates/turn_multiple.ejs','res_stun_monitor.so','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','catch','find','params','/etc/asterisk/turn_xcally.conf','format','util','ejs','lodash','../../mysqldb','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','result','status','json','undefined','limit','count','offset','set','Content-Range','update','destroy','end','sendStatus','name','send','index','map','Network','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','rawAttributes','length','create','body'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x2fd7,0x1b0));var _0x72fd=function(_0x35ff61,_0x3e388a){_0x35ff61=_0x35ff61-0x0;var _0x4c02ab=_0x2fd7[_0x35ff61];return _0x4c02ab;};'use strict';var util=require(_0x72fd('0x0'));var path=require('path');var ejs=require(_0x72fd('0x1'));var fs=require('fs');var _=require(_0x72fd('0x2'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0x72fd('0x3'))['db'];var jayson=require(_0x72fd('0x4'));var client=jayson[_0x72fd('0x5')][_0x72fd('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x662bd1,_0x16405e,_0x2457ec,_0x41a214){return new Promise(function(_0x427f9c,_0x7149ea){var _0x1c6e7e=_0x41a214||client;return _0x1c6e7e[_0x72fd('0x7')](_0x662bd1,_0x2457ec)[_0x72fd('0x8')](function(_0x3fb7a1){logger[_0x72fd('0x9')](_0x72fd('0xa'),_0x16405e,_0x72fd('0xb'));logger[_0x72fd('0xc')](_0x72fd('0xd'),_0x16405e,_0x72fd('0xb'),JSON[_0x72fd('0xe')](_0x3fb7a1));if(_0x3fb7a1['error']){if(_0x3fb7a1['error']['code']===0x1f4){logger[_0x72fd('0xf')]('Network,\x20%s,\x20%s',_0x16405e,_0x3fb7a1['error']['message']);return _0x7149ea(_0x3fb7a1[_0x72fd('0xf')][_0x72fd('0x10')]);}logger['error'](_0x72fd('0xa'),_0x16405e,_0x3fb7a1['error'][_0x72fd('0x10')]);return _0x427f9c(_0x3fb7a1[_0x72fd('0xf')]['message']);}else{logger[_0x72fd('0x9')]('Network,\x20%s,\x20%s',_0x16405e,_0x72fd('0xb'));_0x427f9c(_0x3fb7a1[_0x72fd('0x11')][_0x72fd('0x10')]);}})['catch'](function(_0x35eb5a){logger['error'](_0x72fd('0xa'),_0x16405e,_0x35eb5a);_0x7149ea(_0x35eb5a);});});}function respondWithResult(_0x5bfe94,_0x2c9b73){_0x2c9b73=_0x2c9b73||0xc8;return function(_0x195114){if(_0x195114){return _0x5bfe94[_0x72fd('0x12')](_0x2c9b73)[_0x72fd('0x13')](_0x195114);}};}function respondWithFilteredResult(_0x4a489a,_0x51dd9f){return function(_0x1eff33){if(_0x1eff33){var _0x353045=typeof _0x51dd9f['offset']===_0x72fd('0x14')&&typeof _0x51dd9f[_0x72fd('0x15')]===_0x72fd('0x14');var _0x37d2a6=_0x1eff33[_0x72fd('0x16')];var _0x44a7d9=_0x353045?0x0:_0x51dd9f['offset'];var _0x5f2409=_0x353045?_0x1eff33[_0x72fd('0x16')]:_0x51dd9f[_0x72fd('0x17')]+_0x51dd9f['limit'];var _0x45c1cd;if(_0x5f2409>=_0x37d2a6){_0x5f2409=_0x37d2a6;_0x45c1cd=0xc8;}else{_0x45c1cd=0xce;}_0x4a489a[_0x72fd('0x12')](_0x45c1cd);return _0x4a489a[_0x72fd('0x18')](_0x72fd('0x19'),_0x44a7d9+'-'+_0x5f2409+'/'+_0x37d2a6)[_0x72fd('0x13')](_0x1eff33);}return null;};}function saveUpdates(_0x14097f){return function(_0x7d5d75){if(_0x7d5d75){return _0x7d5d75[_0x72fd('0x1a')](_0x14097f)[_0x72fd('0x8')](function(_0x3d158f){return _0x3d158f;});}return null;};}function removeEntity(_0x2b3340){return function(_0xa93622){if(_0xa93622){return _0xa93622[_0x72fd('0x1b')]()[_0x72fd('0x8')](function(){_0x2b3340['status'](0xcc)[_0x72fd('0x1c')]();});}};}function handleEntityNotFound(_0x48f56d){return function(_0x53a19d){if(!_0x53a19d){_0x48f56d[_0x72fd('0x1d')](0x194);}return _0x53a19d;};}function handleError(_0x5b09f7,_0x254f1c){_0x254f1c=_0x254f1c||0x1f4;return function(_0x55172d){logger['error'](_0x55172d['stack']);if(_0x55172d['name']){delete _0x55172d[_0x72fd('0x1e')];}_0x5b09f7[_0x72fd('0x12')](_0x254f1c)[_0x72fd('0x1f')](_0x55172d);};}exports[_0x72fd('0x20')]=function(_0x1ca08a,_0xd7cd76){var _0x5d19e8={},_0xd27b13={},_0x2d9c60={'count':0x0,'rows':[]};var _0xa2e625=_[_0x72fd('0x21')](db[_0x72fd('0x22')]['rawAttributes'],function(_0x467a2c){return{'name':_0x467a2c[_0x72fd('0x23')],'type':_0x467a2c[_0x72fd('0x24')]['key']};});_0xd27b13[_0x72fd('0x25')]=_['map'](_0xa2e625,'name');_0xd27b13[_0x72fd('0x26')]=_[_0x72fd('0x27')](_0x1ca08a[_0x72fd('0x26')]);_0xd27b13['filters']=_[_0x72fd('0x28')](_0xd27b13[_0x72fd('0x25')],_0xd27b13[_0x72fd('0x26')]);_0x5d19e8[_0x72fd('0x29')]=_[_0x72fd('0x28')](_0xd27b13[_0x72fd('0x25')],qs['fields'](_0x1ca08a[_0x72fd('0x26')][_0x72fd('0x2a')]));_0x5d19e8[_0x72fd('0x29')]=_0x5d19e8[_0x72fd('0x29')]['length']?_0x5d19e8['attributes']:_0xd27b13['model'];if(!_0x1ca08a[_0x72fd('0x26')][_0x72fd('0x2b')]('nolimit')){_0x5d19e8['limit']=qs['limit'](_0x1ca08a[_0x72fd('0x26')][_0x72fd('0x15')]);_0x5d19e8['offset']=qs[_0x72fd('0x17')](_0x1ca08a[_0x72fd('0x26')]['offset']);}_0x5d19e8[_0x72fd('0x2c')]=qs[_0x72fd('0x2d')](_0x1ca08a[_0x72fd('0x26')][_0x72fd('0x2d')]);_0x5d19e8[_0x72fd('0x2e')]=qs[_0x72fd('0x2f')](_[_0x72fd('0x30')](_0x1ca08a[_0x72fd('0x26')],_0xd27b13['filters']),_0xa2e625);if(_0x1ca08a[_0x72fd('0x26')][_0x72fd('0x31')]){_0x5d19e8[_0x72fd('0x2e')]=_[_0x72fd('0x32')](_0x5d19e8[_0x72fd('0x2e')],{'$or':_['map'](_0xa2e625,function(_0x105aee){if(_0x105aee[_0x72fd('0x24')]!==_0x72fd('0x33')){var _0x58298c={};_0x58298c[_0x105aee[_0x72fd('0x1e')]]={'$like':'%'+_0x1ca08a[_0x72fd('0x26')][_0x72fd('0x31')]+'%'};return _0x58298c;}})});}_0x5d19e8=_[_0x72fd('0x32')]({},_0x5d19e8,_0x1ca08a[_0x72fd('0x34')]);var _0x513d06={'where':_0x5d19e8[_0x72fd('0x2e')]};return db[_0x72fd('0x22')][_0x72fd('0x16')](_0x513d06)[_0x72fd('0x8')](function(_0x222982){_0x2d9c60['count']=_0x222982;if(_0x1ca08a['query'][_0x72fd('0x35')]){_0x5d19e8['include']=[{'all':!![]}];}return db[_0x72fd('0x22')][_0x72fd('0x36')](_0x5d19e8);})[_0x72fd('0x8')](function(_0x36bcff){_0x2d9c60[_0x72fd('0x37')]=_0x36bcff;return _0x2d9c60;})[_0x72fd('0x8')](respondWithFilteredResult(_0xd7cd76,_0x5d19e8))['catch'](handleError(_0xd7cd76,null));};exports['show']=function(_0x11f8eb,_0x59c638){var _0x3dea49={'raw':!![],'where':{'id':_0x11f8eb['params']['id']}},_0x1bfa76={};_0x1bfa76[_0x72fd('0x25')]=_[_0x72fd('0x27')](db[_0x72fd('0x22')][_0x72fd('0x38')]);_0x1bfa76['query']=_[_0x72fd('0x27')](_0x11f8eb[_0x72fd('0x26')]);_0x1bfa76['filters']=_[_0x72fd('0x28')](_0x1bfa76[_0x72fd('0x25')],_0x1bfa76[_0x72fd('0x26')]);_0x3dea49[_0x72fd('0x29')]=_[_0x72fd('0x28')](_0x1bfa76['model'],qs['fields'](_0x11f8eb[_0x72fd('0x26')][_0x72fd('0x2a')]));_0x3dea49[_0x72fd('0x29')]=_0x3dea49[_0x72fd('0x29')][_0x72fd('0x39')]?_0x3dea49[_0x72fd('0x29')]:_0x1bfa76['model'];if(_0x11f8eb[_0x72fd('0x26')][_0x72fd('0x35')]){_0x3dea49['include']=[{'all':!![]}];}_0x3dea49=_[_0x72fd('0x32')]({},_0x3dea49,_0x11f8eb['options']);return db[_0x72fd('0x22')]['find'](_0x3dea49)['then'](handleEntityNotFound(_0x59c638,null))[_0x72fd('0x8')](respondWithResult(_0x59c638,null))['catch'](handleError(_0x59c638,null));};exports[_0x72fd('0x3a')]=function(_0x508a25,_0x5e1b94){var _0x94fe18;return db[_0x72fd('0x22')][_0x72fd('0x3a')](_0x508a25[_0x72fd('0x3b')],{'raw':!![]})[_0x72fd('0x8')](function(_0x36d468){_0x94fe18=_0x36d468;return db[_0x72fd('0x22')][_0x72fd('0x36')]({'where':{'type':_0x508a25[_0x72fd('0x3b')]['type']},'raw':!![]});})['then'](function(_0xc2a5b8){if(_0x94fe18[_0x72fd('0x24')][_0x72fd('0x3c')]()=='STUN'){var _0x5a7234=fs['readFileSync'](path[_0x72fd('0x3d')](config[_0x72fd('0x3e')],_0x72fd('0x3f')),_0x72fd('0x40'));var _0x32f3bc=ejs[_0x72fd('0x41')](_0x5a7234,{'networks':_0xc2a5b8||[]});fs[_0x72fd('0x42')](_0x72fd('0x43'),_0x32f3bc);return respondWithRpcPromise(_0x72fd('0x44'),'create',{'module':'res_stun_monitor.so'});}else if(_0x94fe18[_0x72fd('0x24')][_0x72fd('0x3c')]()==_0x72fd('0x45')){var _0x41799f=fs[_0x72fd('0x46')](path['join'](config[_0x72fd('0x3e')],_0x72fd('0x47')),_0x72fd('0x40'));var _0x44f000=ejs[_0x72fd('0x41')](_0x41799f,{'networks':_0xc2a5b8||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x44f000);return respondWithRpcPromise(_0x72fd('0x44'),'create',{'module':_0x72fd('0x48')});}else{var _0x1a5367=fs[_0x72fd('0x46')](path[_0x72fd('0x3d')](config[_0x72fd('0x3e')],_0x72fd('0x49')),_0x72fd('0x40'));var _0x417fe4=ejs['render'](_0x1a5367,{'networks':_0xc2a5b8||[]});fs['writeFileSync'](util['format'](_0x72fd('0x4a'),_0x508a25[_0x72fd('0x3b')][_0x72fd('0x24')][_0x72fd('0x4b')]()),_0x417fe4);return respondWithRpcPromise(_0x72fd('0x44'),_0x72fd('0x3a'),{'module':_0x72fd('0x4c')});}})[_0x72fd('0x8')](function(){return _0x94fe18;})[_0x72fd('0x8')](respondWithResult(_0x5e1b94,0xc9))[_0x72fd('0x4d')](handleError(_0x5e1b94,null));};exports['update']=function(_0xba5a71,_0x3d019a){var _0x26e19b;return db[_0x72fd('0x22')][_0x72fd('0x4e')]({'where':{'id':_0xba5a71[_0x72fd('0x4f')]['id']}})[_0x72fd('0x8')](handleEntityNotFound(_0x3d019a,null))[_0x72fd('0x8')](saveUpdates(_0xba5a71['body'],null))[_0x72fd('0x8')](function(_0x3666a9){if(_0x3666a9){_0x26e19b=_0x3666a9;return db['Network'][_0x72fd('0x36')]({'where':{'type':_0x26e19b[_0x72fd('0x24')]},'raw':!![]});}return null;})[_0x72fd('0x8')](function(_0x18d39d){if(_0x26e19b['type'][_0x72fd('0x3c')]()=='STUN'){var _0x544166=fs[_0x72fd('0x46')](path[_0x72fd('0x3d')](config[_0x72fd('0x3e')],'server/files/templates/stun_multiple.ejs'),_0x72fd('0x40'));var _0x16326d=ejs[_0x72fd('0x41')](_0x544166,{'networks':_0x18d39d||[]});fs[_0x72fd('0x42')](_0x72fd('0x43'),_0x16326d);return respondWithRpcPromise('Reload',_0x72fd('0x1a'),{'module':'res_stun_monitor.so'});}else if(_0x26e19b[_0x72fd('0x24')][_0x72fd('0x3c')]()==_0x72fd('0x45')){var _0x5f2d9e=fs[_0x72fd('0x46')](path['join'](config[_0x72fd('0x3e')],_0x72fd('0x47')),_0x72fd('0x40'));var _0x27a585=ejs[_0x72fd('0x41')](_0x5f2d9e,{'networks':_0x18d39d||[]});fs[_0x72fd('0x42')](_0x72fd('0x50'),_0x27a585);return respondWithRpcPromise('Reload',_0x72fd('0x1a'),{'module':_0x72fd('0x48')});}else{var _0x71d4a5=fs[_0x72fd('0x46')](path['join'](config['root'],_0x72fd('0x49')),_0x72fd('0x40'));var _0x416359=ejs[_0x72fd('0x41')](_0x71d4a5,{'networks':_0x18d39d||[]});fs[_0x72fd('0x42')](util[_0x72fd('0x51')](_0x72fd('0x4a'),_0xba5a71[_0x72fd('0x3b')][_0x72fd('0x24')]['toLowerCase']()),_0x416359);return respondWithRpcPromise('Reload','update',{'module':_0x72fd('0x4c')});}})['then'](function(_0x55f55b){if(_0x55f55b){return _0x26e19b;}return null;})[_0x72fd('0x8')](respondWithResult(_0x3d019a,null))[_0x72fd('0x4d')](handleError(_0x3d019a,null));};exports[_0x72fd('0x1b')]=function(_0x2f9653,_0xb78b5a){var _0x34da8f;return db[_0x72fd('0x22')]['find']({'where':{'id':_0x2f9653[_0x72fd('0x4f')]['id']}})[_0x72fd('0x8')](function(_0xb3a1f4){_0x34da8f=_0xb3a1f4;return _0xb3a1f4;})[_0x72fd('0x8')](handleEntityNotFound(_0xb78b5a,null))['then'](removeEntity(_0xb78b5a,null))[_0x72fd('0x8')](function(){if(_0x34da8f){return db['Network'][_0x72fd('0x36')]({'where':{'type':_0x34da8f['type']},'raw':!![]});}})[_0x72fd('0x8')](function(_0x5aa226){if(_0x34da8f[_0x72fd('0x24')][_0x72fd('0x3c')]()=='STUN'){var _0x20476b=fs[_0x72fd('0x46')](path['join'](config[_0x72fd('0x3e')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x1d4c8b=ejs[_0x72fd('0x41')](_0x20476b,{'networks':_0x5aa226||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x1d4c8b);return respondWithRpcPromise(_0x72fd('0x44'),_0x72fd('0x1b'),{'module':'res_stun_monitor.so'});}else if(_0x34da8f[_0x72fd('0x24')]['toUpperCase']()==_0x72fd('0x45')){var _0x1ba280=fs[_0x72fd('0x46')](path[_0x72fd('0x3d')](config['root'],_0x72fd('0x47')),_0x72fd('0x40'));var _0x4f3389=ejs[_0x72fd('0x41')](_0x1ba280,{'networks':_0x5aa226||[]});fs[_0x72fd('0x42')]('/etc/asterisk/turn_xcally.conf',_0x4f3389);return respondWithRpcPromise(_0x72fd('0x44'),_0x72fd('0x1b'),{'module':_0x72fd('0x48')});}else{var _0x46223c=fs[_0x72fd('0x46')](path[_0x72fd('0x3d')](config[_0x72fd('0x3e')],_0x72fd('0x49')),_0x72fd('0x40'));var _0x3649e2=ejs[_0x72fd('0x41')](_0x46223c,{'networks':_0x5aa226||[]});fs[_0x72fd('0x42')](util[_0x72fd('0x51')]('/etc/asterisk/sip_xcally_%s.conf',_0x34da8f[_0x72fd('0x24')][_0x72fd('0x4b')]()),_0x3649e2);return respondWithRpcPromise(_0x72fd('0x44'),'destroy',{'module':'chan_sip.so'});}})[_0x72fd('0x4d')](handleError(_0xb78b5a,null));}; \ No newline at end of file +var _0x6982=['sendStatus','send','index','map','Network','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','name','options','count','includeAll','findAll','include','find','create','body','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','TURN','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','toLowerCase','chan_sip.so','params','/etc/asterisk/sip_xcally_%s.conf','path','../../components/parsers/qs','../../config/logger','../../config/environment','jayson/promise','client','http','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','json','offset','limit','undefined','Content-Range','update','then','destroy'];(function(_0x566667,_0x3f99c2){var _0x277136=function(_0x129ea0){while(--_0x129ea0){_0x566667['push'](_0x566667['shift']());}};_0x277136(++_0x3f99c2);}(_0x6982,0x1c1));var _0x2698=function(_0x5708c8,_0x5a3bc3){_0x5708c8=_0x5708c8-0x0;var _0x595a01=_0x6982[_0x5708c8];return _0x595a01;};'use strict';var util=require('util');var path=require(_0x2698('0x0'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var qs=require(_0x2698('0x1'));var logger=require(_0x2698('0x2'))('api');var config=require(_0x2698('0x3'));var db=require('../../mysqldb')['db'];var jayson=require(_0x2698('0x4'));var client=jayson[_0x2698('0x5')][_0x2698('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4c7899,_0x458dab,_0x5db5d1,_0x559642){return new Promise(function(_0x273b6f,_0x16abc9){var _0x24adae=_0x559642||client;return _0x24adae['request'](_0x4c7899,_0x5db5d1)['then'](function(_0x6bd155){logger[_0x2698('0x7')](_0x2698('0x8'),_0x458dab,_0x2698('0x9'));logger['debug'](_0x2698('0xa'),_0x458dab,_0x2698('0x9'),JSON['stringify'](_0x6bd155));if(_0x6bd155[_0x2698('0xb')]){if(_0x6bd155[_0x2698('0xb')][_0x2698('0xc')]===0x1f4){logger[_0x2698('0xb')](_0x2698('0x8'),_0x458dab,_0x6bd155[_0x2698('0xb')]['message']);return _0x16abc9(_0x6bd155[_0x2698('0xb')][_0x2698('0xd')]);}logger[_0x2698('0xb')](_0x2698('0x8'),_0x458dab,_0x6bd155['error'][_0x2698('0xd')]);return _0x273b6f(_0x6bd155[_0x2698('0xb')][_0x2698('0xd')]);}else{logger[_0x2698('0x7')](_0x2698('0x8'),_0x458dab,_0x2698('0x9'));_0x273b6f(_0x6bd155[_0x2698('0xe')]['message']);}})[_0x2698('0xf')](function(_0x347f59){logger[_0x2698('0xb')]('Network,\x20%s,\x20%s',_0x458dab,_0x347f59);_0x16abc9(_0x347f59);});});}function respondWithResult(_0x370529,_0x1924ac){_0x1924ac=_0x1924ac||0xc8;return function(_0x46f799){if(_0x46f799){return _0x370529[_0x2698('0x10')](_0x1924ac)[_0x2698('0x11')](_0x46f799);}};}function respondWithFilteredResult(_0x1f1d87,_0xc371a3){return function(_0x95313d){if(_0x95313d){var _0x4d7abe=typeof _0xc371a3[_0x2698('0x12')]==='undefined'&&typeof _0xc371a3[_0x2698('0x13')]===_0x2698('0x14');var _0x10d5db=_0x95313d['count'];var _0x1813e6=_0x4d7abe?0x0:_0xc371a3[_0x2698('0x12')];var _0x382485=_0x4d7abe?_0x95313d['count']:_0xc371a3[_0x2698('0x12')]+_0xc371a3[_0x2698('0x13')];var _0x107d02;if(_0x382485>=_0x10d5db){_0x382485=_0x10d5db;_0x107d02=0xc8;}else{_0x107d02=0xce;}_0x1f1d87['status'](_0x107d02);return _0x1f1d87['set'](_0x2698('0x15'),_0x1813e6+'-'+_0x382485+'/'+_0x10d5db)['json'](_0x95313d);}return null;};}function saveUpdates(_0x5b0418){return function(_0x69d15b){if(_0x69d15b){return _0x69d15b[_0x2698('0x16')](_0x5b0418)[_0x2698('0x17')](function(_0x1f9dc0){return _0x1f9dc0;});}return null;};}function removeEntity(_0x5db93e){return function(_0x242407){if(_0x242407){return _0x242407[_0x2698('0x18')]()[_0x2698('0x17')](function(){_0x5db93e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a28b9){return function(_0x2ff17a){if(!_0x2ff17a){_0x4a28b9[_0x2698('0x19')](0x194);}return _0x2ff17a;};}function handleError(_0x5f3497,_0x1fc91d){_0x1fc91d=_0x1fc91d||0x1f4;return function(_0x33427c){logger[_0x2698('0xb')](_0x33427c['stack']);if(_0x33427c['name']){delete _0x33427c['name'];}_0x5f3497[_0x2698('0x10')](_0x1fc91d)[_0x2698('0x1a')](_0x33427c);};}exports[_0x2698('0x1b')]=function(_0x2735c2,_0x47b990){var _0x1d771f={},_0x47fe71={},_0x4ed0b2={'count':0x0,'rows':[]};var _0x26f015=_[_0x2698('0x1c')](db[_0x2698('0x1d')][_0x2698('0x1e')],function(_0x472b0a){return{'name':_0x472b0a[_0x2698('0x1f')],'type':_0x472b0a[_0x2698('0x20')]['key']};});_0x47fe71['model']=_[_0x2698('0x1c')](_0x26f015,'name');_0x47fe71[_0x2698('0x21')]=_[_0x2698('0x22')](_0x2735c2[_0x2698('0x21')]);_0x47fe71[_0x2698('0x23')]=_[_0x2698('0x24')](_0x47fe71[_0x2698('0x25')],_0x47fe71[_0x2698('0x21')]);_0x1d771f[_0x2698('0x26')]=_['intersection'](_0x47fe71[_0x2698('0x25')],qs[_0x2698('0x27')](_0x2735c2[_0x2698('0x21')]['fields']));_0x1d771f[_0x2698('0x26')]=_0x1d771f[_0x2698('0x26')][_0x2698('0x28')]?_0x1d771f[_0x2698('0x26')]:_0x47fe71['model'];if(!_0x2735c2['query'][_0x2698('0x29')]('nolimit')){_0x1d771f[_0x2698('0x13')]=qs[_0x2698('0x13')](_0x2735c2[_0x2698('0x21')][_0x2698('0x13')]);_0x1d771f[_0x2698('0x12')]=qs['offset'](_0x2735c2[_0x2698('0x21')]['offset']);}_0x1d771f[_0x2698('0x2a')]=qs[_0x2698('0x2b')](_0x2735c2[_0x2698('0x21')][_0x2698('0x2b')]);_0x1d771f[_0x2698('0x2c')]=qs[_0x2698('0x23')](_[_0x2698('0x2d')](_0x2735c2[_0x2698('0x21')],_0x47fe71[_0x2698('0x23')]),_0x26f015);if(_0x2735c2[_0x2698('0x21')][_0x2698('0x2e')]){_0x1d771f['where']=_[_0x2698('0x2f')](_0x1d771f['where'],{'$or':_['map'](_0x26f015,function(_0x2fbd3b){if(_0x2fbd3b[_0x2698('0x20')]!==_0x2698('0x30')){var _0x20ffe9={};_0x20ffe9[_0x2fbd3b[_0x2698('0x31')]]={'$like':'%'+_0x2735c2[_0x2698('0x21')][_0x2698('0x2e')]+'%'};return _0x20ffe9;}})});}_0x1d771f=_['merge']({},_0x1d771f,_0x2735c2[_0x2698('0x32')]);var _0x223655={'where':_0x1d771f[_0x2698('0x2c')]};return db[_0x2698('0x1d')][_0x2698('0x33')](_0x223655)['then'](function(_0x2a03be){_0x4ed0b2['count']=_0x2a03be;if(_0x2735c2[_0x2698('0x21')][_0x2698('0x34')]){_0x1d771f['include']=[{'all':!![]}];}return db['Network'][_0x2698('0x35')](_0x1d771f);})[_0x2698('0x17')](function(_0x180d28){_0x4ed0b2['rows']=_0x180d28;return _0x4ed0b2;})[_0x2698('0x17')](respondWithFilteredResult(_0x47b990,_0x1d771f))[_0x2698('0xf')](handleError(_0x47b990,null));};exports['show']=function(_0x49ba0e,_0x395455){var _0x2d6508={'raw':!![],'where':{'id':_0x49ba0e['params']['id']}},_0x900e82={};_0x900e82['model']=_[_0x2698('0x22')](db['Network'][_0x2698('0x1e')]);_0x900e82[_0x2698('0x21')]=_['keys'](_0x49ba0e[_0x2698('0x21')]);_0x900e82[_0x2698('0x23')]=_[_0x2698('0x24')](_0x900e82[_0x2698('0x25')],_0x900e82[_0x2698('0x21')]);_0x2d6508[_0x2698('0x26')]=_[_0x2698('0x24')](_0x900e82[_0x2698('0x25')],qs['fields'](_0x49ba0e[_0x2698('0x21')][_0x2698('0x27')]));_0x2d6508['attributes']=_0x2d6508[_0x2698('0x26')][_0x2698('0x28')]?_0x2d6508['attributes']:_0x900e82[_0x2698('0x25')];if(_0x49ba0e[_0x2698('0x21')][_0x2698('0x34')]){_0x2d6508[_0x2698('0x36')]=[{'all':!![]}];}_0x2d6508=_[_0x2698('0x2f')]({},_0x2d6508,_0x49ba0e[_0x2698('0x32')]);return db[_0x2698('0x1d')][_0x2698('0x37')](_0x2d6508)['then'](handleEntityNotFound(_0x395455,null))[_0x2698('0x17')](respondWithResult(_0x395455,null))[_0x2698('0xf')](handleError(_0x395455,null));};exports[_0x2698('0x38')]=function(_0x1f8370,_0x342359){var _0x974c5;return db[_0x2698('0x1d')][_0x2698('0x38')](_0x1f8370[_0x2698('0x39')],{'raw':!![]})[_0x2698('0x17')](function(_0x2933c1){_0x974c5=_0x2933c1;return db[_0x2698('0x1d')]['findAll']({'where':{'type':_0x1f8370[_0x2698('0x39')][_0x2698('0x20')]},'raw':!![]});})['then'](function(_0x27d353){if(_0x974c5[_0x2698('0x20')]['toUpperCase']()==_0x2698('0x3a')){var _0xf82510=fs[_0x2698('0x3b')](path[_0x2698('0x3c')](config[_0x2698('0x3d')],_0x2698('0x3e')),_0x2698('0x3f'));var _0x4830d6=ejs[_0x2698('0x40')](_0xf82510,{'networks':_0x27d353||[]});fs['writeFileSync'](_0x2698('0x41'),_0x4830d6);return respondWithRpcPromise(_0x2698('0x42'),'create',{'module':_0x2698('0x43')});}else if(_0x974c5[_0x2698('0x20')][_0x2698('0x44')]()==_0x2698('0x45')){var _0x551818=fs[_0x2698('0x3b')](path[_0x2698('0x3c')](config[_0x2698('0x3d')],_0x2698('0x46')),'utf8');var _0x1504e6=ejs['render'](_0x551818,{'networks':_0x27d353||[]});fs[_0x2698('0x47')](_0x2698('0x48'),_0x1504e6);return respondWithRpcPromise(_0x2698('0x42'),_0x2698('0x38'),{'module':_0x2698('0x43')});}else{var _0x2a0f57=fs[_0x2698('0x3b')](path[_0x2698('0x3c')](config['root'],_0x2698('0x49')),_0x2698('0x3f'));var _0x38a4ec=ejs[_0x2698('0x40')](_0x2a0f57,{'networks':_0x27d353||[]});fs[_0x2698('0x47')](util[_0x2698('0x4a')]('/etc/asterisk/sip_xcally_%s.conf',_0x1f8370[_0x2698('0x39')]['type'][_0x2698('0x4b')]()),_0x38a4ec);return respondWithRpcPromise(_0x2698('0x42'),_0x2698('0x38'),{'module':_0x2698('0x4c')});}})[_0x2698('0x17')](function(){return _0x974c5;})[_0x2698('0x17')](respondWithResult(_0x342359,0xc9))['catch'](handleError(_0x342359,null));};exports[_0x2698('0x16')]=function(_0x1d7b5f,_0x5da1a0){var _0x9318b6;return db['Network']['find']({'where':{'id':_0x1d7b5f[_0x2698('0x4d')]['id']}})[_0x2698('0x17')](handleEntityNotFound(_0x5da1a0,null))['then'](saveUpdates(_0x1d7b5f[_0x2698('0x39')],null))['then'](function(_0x2e85b5){if(_0x2e85b5){_0x9318b6=_0x2e85b5;return db[_0x2698('0x1d')]['findAll']({'where':{'type':_0x9318b6[_0x2698('0x20')]},'raw':!![]});}return null;})[_0x2698('0x17')](function(_0x360521){if(_0x9318b6[_0x2698('0x20')][_0x2698('0x44')]()==_0x2698('0x3a')){var _0x6ddfc6=fs['readFileSync'](path[_0x2698('0x3c')](config[_0x2698('0x3d')],_0x2698('0x3e')),'utf8');var _0x43b289=ejs['render'](_0x6ddfc6,{'networks':_0x360521||[]});fs[_0x2698('0x47')]('/etc/asterisk/stun_xcally.conf',_0x43b289);return respondWithRpcPromise(_0x2698('0x42'),_0x2698('0x16'),{'module':'res_stun_monitor.so'});}else if(_0x9318b6[_0x2698('0x20')][_0x2698('0x44')]()=='TURN'){var _0x9acde=fs[_0x2698('0x3b')](path[_0x2698('0x3c')](config[_0x2698('0x3d')],'server/files/templates/turn_multiple.ejs'),_0x2698('0x3f'));var _0x45292a=ejs[_0x2698('0x40')](_0x9acde,{'networks':_0x360521||[]});fs[_0x2698('0x47')](_0x2698('0x48'),_0x45292a);return respondWithRpcPromise(_0x2698('0x42'),_0x2698('0x16'),{'module':_0x2698('0x43')});}else{var _0x4153d6=fs[_0x2698('0x3b')](path[_0x2698('0x3c')](config[_0x2698('0x3d')],_0x2698('0x49')),_0x2698('0x3f'));var _0x415c0a=ejs['render'](_0x4153d6,{'networks':_0x360521||[]});fs['writeFileSync'](util[_0x2698('0x4a')](_0x2698('0x4e'),_0x1d7b5f[_0x2698('0x39')][_0x2698('0x20')]['toLowerCase']()),_0x415c0a);return respondWithRpcPromise('Reload',_0x2698('0x16'),{'module':'chan_sip.so'});}})[_0x2698('0x17')](function(_0x261761){if(_0x261761){return _0x9318b6;}return null;})[_0x2698('0x17')](respondWithResult(_0x5da1a0,null))[_0x2698('0xf')](handleError(_0x5da1a0,null));};exports[_0x2698('0x18')]=function(_0x5affb3,_0x4a93d1){var _0x59fc68;return db[_0x2698('0x1d')]['find']({'where':{'id':_0x5affb3[_0x2698('0x4d')]['id']}})[_0x2698('0x17')](function(_0x75600f){_0x59fc68=_0x75600f;return _0x75600f;})[_0x2698('0x17')](handleEntityNotFound(_0x4a93d1,null))[_0x2698('0x17')](removeEntity(_0x4a93d1,null))[_0x2698('0x17')](function(){if(_0x59fc68){return db[_0x2698('0x1d')]['findAll']({'where':{'type':_0x59fc68['type']},'raw':!![]});}})[_0x2698('0x17')](function(_0x5630e1){if(_0x59fc68[_0x2698('0x20')][_0x2698('0x44')]()=='STUN'){var _0x51bbe8=fs[_0x2698('0x3b')](path[_0x2698('0x3c')](config[_0x2698('0x3d')],_0x2698('0x3e')),_0x2698('0x3f'));var _0x2d3df1=ejs[_0x2698('0x40')](_0x51bbe8,{'networks':_0x5630e1||[]});fs[_0x2698('0x47')](_0x2698('0x41'),_0x2d3df1);return respondWithRpcPromise('Reload','destroy',{'module':_0x2698('0x43')});}else if(_0x59fc68[_0x2698('0x20')][_0x2698('0x44')]()=='TURN'){var _0x1eea7e=fs['readFileSync'](path['join'](config[_0x2698('0x3d')],_0x2698('0x46')),'utf8');var _0x24bc57=ejs[_0x2698('0x40')](_0x1eea7e,{'networks':_0x5630e1||[]});fs[_0x2698('0x47')](_0x2698('0x48'),_0x24bc57);return respondWithRpcPromise('Reload',_0x2698('0x18'),{'module':'res_stun_monitor.so'});}else{var _0x1b1d6f=fs[_0x2698('0x3b')](path[_0x2698('0x3c')](config[_0x2698('0x3d')],_0x2698('0x49')),_0x2698('0x3f'));var _0x366b6=ejs[_0x2698('0x40')](_0x1b1d6f,{'networks':_0x5630e1||[]});fs['writeFileSync'](util[_0x2698('0x4a')](_0x2698('0x4e'),_0x59fc68[_0x2698('0x20')][_0x2698('0x4b')]()),_0x366b6);return respondWithRpcPromise(_0x2698('0x42'),_0x2698('0x18'),{'module':_0x2698('0x4c')});}})['catch'](handleError(_0x4a93d1,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index ebcb742..e0f8d64 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 _0x073e=['rimraf','../../config/environment','define','Network','network','lodash','util','../../config/logger','api','path'];(function(_0x1fcffc,_0x526d4e){var _0x1b69c6=function(_0x8e8d41){while(--_0x8e8d41){_0x1fcffc['push'](_0x1fcffc['shift']());}};_0x1b69c6(++_0x526d4e);}(_0x073e,0x181));var _0xe073=function(_0x2db0fa,_0x4c06c0){_0x2db0fa=_0x2db0fa-0x0;var _0x4f2b48=_0x073e[_0x2db0fa];return _0x4f2b48;};'use strict';var _=require(_0xe073('0x0'));var util=require(_0xe073('0x1'));var logger=require(_0xe073('0x2'))(_0xe073('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe073('0x4'));var rimraf=require(_0xe073('0x5'));var config=require(_0xe073('0x6'));var attributes=require('./network.attributes');module['exports']=function(_0x4bc6b3,_0x45995e){return _0x4bc6b3[_0xe073('0x7')](_0xe073('0x8'),attributes,{'tableName':_0xe073('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc3fe=['request-promise','rimraf','../../config/environment','./network.attributes','define','lodash','util','../../config/logger','moment','bluebird'];(function(_0xaa63b5,_0xc4ee62){var _0x417bf9=function(_0x2c912c){while(--_0x2c912c){_0xaa63b5['push'](_0xaa63b5['shift']());}};_0x417bf9(++_0xc4ee62);}(_0xc3fe,0xff));var _0xec3f=function(_0x1d506a,_0x4fc4a0){_0x1d506a=_0x1d506a-0x0;var _0x5edd79=_0xc3fe[_0x1d506a];return _0x5edd79;};'use strict';var _=require(_0xec3f('0x0'));var util=require(_0xec3f('0x1'));var logger=require(_0xec3f('0x2'))('api');var moment=require(_0xec3f('0x3'));var BPromise=require(_0xec3f('0x4'));var rp=require(_0xec3f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xec3f('0x6'));var config=require(_0xec3f('0x7'));var attributes=require(_0xec3f('0x8'));module['exports']=function(_0x4fb9aa,_0x2d5b29){return _0x4fb9aa[_0xec3f('0x9')]('Network',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 25d08f5..487b594 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(_0x3c8cde,_0x3065d9){var _0x1b587e=function(_0x5e34f3){while(--_0x5e34f3){_0x3c8cde['push'](_0x3c8cde['shift']());}};_0x1b587e(++_0x3065d9);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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(_0x27efc8,_0x1dbb5c){var _0x4a3c6a=function(_0x3957a7){while(--_0x3957a7){_0x27efc8['push'](_0x27efc8['shift']());}};_0x4a3c6a(++_0x1dbb5c);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index d41824e..24359ac 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 _0x5f60=['addApplications','/:id/users','addAgents','/:id/send','send','put','delete','destroy','removeAnswers','removeAgents','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','getAgents','create','post','addAnswer','notify'];(function(_0x49852d,_0x56ed57){var _0x552388=function(_0x185718){while(--_0x185718){_0x49852d['push'](_0x49852d['shift']());}};_0x552388(++_0x56ed57);}(_0x5f60,0xbe));var _0x05f6=function(_0x2c93e2,_0x4fb5e2){_0x2c93e2=_0x2c93e2-0x0;var _0x57264e=_0x5f60[_0x2c93e2];return _0x57264e;};'use strict';var multer=require(_0x05f6('0x0'));var util=require(_0x05f6('0x1'));var path=require(_0x05f6('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x05f6('0x3'));var auth=require(_0x05f6('0x4'));var interaction=require(_0x05f6('0x5'));var config=require(_0x05f6('0x6'));var controller=require(_0x05f6('0x7'));router[_0x05f6('0x8')]('/',auth[_0x05f6('0x9')](),controller[_0x05f6('0xa')]);router[_0x05f6('0x8')](_0x05f6('0xb'),auth[_0x05f6('0x9')](),controller['describe']);router['get'](_0x05f6('0xc'),auth[_0x05f6('0x9')](),controller[_0x05f6('0xd')]);router[_0x05f6('0x8')](_0x05f6('0xe'),auth[_0x05f6('0x9')](),controller['getDispositions']);router['get'](_0x05f6('0xf'),auth[_0x05f6('0x9')](),controller[_0x05f6('0x10')]);router['get'](_0x05f6('0x11'),auth[_0x05f6('0x9')](),controller[_0x05f6('0x12')]);router[_0x05f6('0x8')](_0x05f6('0x13'),auth['isAuthenticated'](),controller[_0x05f6('0x14')]);router['get']('/:id/users',auth[_0x05f6('0x9')](),controller[_0x05f6('0x15')]);router['post']('/',auth[_0x05f6('0x9')](),controller[_0x05f6('0x16')]);router[_0x05f6('0x17')](_0x05f6('0xe'),auth[_0x05f6('0x9')](),controller['addDisposition']);router[_0x05f6('0x17')](_0x05f6('0xf'),auth[_0x05f6('0x9')](),controller[_0x05f6('0x18')]);router['post']('/:id/notify',controller[_0x05f6('0x19')]);router[_0x05f6('0x17')]('/:id/applications',auth[_0x05f6('0x9')](),controller[_0x05f6('0x1a')]);router[_0x05f6('0x17')](_0x05f6('0x1b'),auth[_0x05f6('0x9')](),controller[_0x05f6('0x1c')]);router[_0x05f6('0x17')](_0x05f6('0x1d'),auth[_0x05f6('0x9')](),controller[_0x05f6('0x1e')]);router[_0x05f6('0x1f')](_0x05f6('0xc'),auth[_0x05f6('0x9')](),controller['update']);router[_0x05f6('0x20')](_0x05f6('0xc'),auth[_0x05f6('0x9')](),controller[_0x05f6('0x21')]);router[_0x05f6('0x20')]('/:id/dispositions',auth[_0x05f6('0x9')](),controller['removeDispositions']);router[_0x05f6('0x20')]('/:id/canned_answers',auth[_0x05f6('0x9')](),controller[_0x05f6('0x22')]);router[_0x05f6('0x20')]('/:id/users',auth[_0x05f6('0x9')](),controller[_0x05f6('0x23')]);module['exports']=router; \ No newline at end of file +var _0x1575=['get','index','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','send','put','update','delete','removeAnswers','removeAgents','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1575,0x94));var _0x5157=function(_0x202c99,_0x121caf){_0x202c99=_0x202c99-0x0;var _0x256a0f=_0x1575[_0x202c99];return _0x256a0f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5157('0x0'));var timeout=require('connect-timeout');var express=require(_0x5157('0x1'));var router=express[_0x5157('0x2')]();var fs_extra=require(_0x5157('0x3'));var auth=require(_0x5157('0x4'));var interaction=require(_0x5157('0x5'));var config=require(_0x5157('0x6'));var controller=require(_0x5157('0x7'));router[_0x5157('0x8')]('/',auth['isAuthenticated'](),controller[_0x5157('0x9')]);router[_0x5157('0x8')]('/describe',auth[_0x5157('0xa')](),controller[_0x5157('0xb')]);router[_0x5157('0x8')](_0x5157('0xc'),auth[_0x5157('0xa')](),controller[_0x5157('0xd')]);router['get'](_0x5157('0xe'),auth[_0x5157('0xa')](),controller[_0x5157('0xf')]);router[_0x5157('0x8')](_0x5157('0x10'),auth[_0x5157('0xa')](),controller[_0x5157('0x11')]);router[_0x5157('0x8')](_0x5157('0x12'),auth[_0x5157('0xa')](),controller['getApplications']);router[_0x5157('0x8')](_0x5157('0x13'),auth[_0x5157('0xa')](),controller[_0x5157('0x14')]);router[_0x5157('0x8')](_0x5157('0x15'),auth['isAuthenticated'](),controller[_0x5157('0x16')]);router[_0x5157('0x17')]('/',auth['isAuthenticated'](),controller[_0x5157('0x18')]);router['post'](_0x5157('0xe'),auth[_0x5157('0xa')](),controller[_0x5157('0x19')]);router[_0x5157('0x17')](_0x5157('0x10'),auth[_0x5157('0xa')](),controller[_0x5157('0x1a')]);router[_0x5157('0x17')](_0x5157('0x1b'),controller[_0x5157('0x1c')]);router[_0x5157('0x17')]('/:id/applications',auth[_0x5157('0xa')](),controller[_0x5157('0x1d')]);router[_0x5157('0x17')]('/:id/users',auth['isAuthenticated'](),controller[_0x5157('0x1e')]);router[_0x5157('0x17')](_0x5157('0x1f'),auth['isAuthenticated'](),controller[_0x5157('0x20')]);router[_0x5157('0x21')](_0x5157('0xc'),auth[_0x5157('0xa')](),controller[_0x5157('0x22')]);router[_0x5157('0x23')](_0x5157('0xc'),auth[_0x5157('0xa')](),controller['destroy']);router[_0x5157('0x23')](_0x5157('0xe'),auth[_0x5157('0xa')](),controller['removeDispositions']);router['delete']('/:id/canned_answers',auth[_0x5157('0xa')](),controller[_0x5157('0x24')]);router[_0x5157('0x23')](_0x5157('0x15'),auth[_0x5157('0xa')](),controller[_0x5157('0x25')]);module[_0x5157('0x26')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index a03f5e2..2cb4268 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 _0x7d05=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','TEXT'];(function(_0x33377c,_0x13a2fa){var _0x3cc735=function(_0x40cf97){while(--_0x40cf97){_0x33377c['push'](_0x33377c['shift']());}};_0x3cc735(++_0x13a2fa);}(_0x7d05,0xe8));var _0x57d0=function(_0x829c5c,_0x5515bc){_0x829c5c=_0x829c5c-0x0;var _0x280f4f=_0x7d05[_0x829c5c];return _0x280f4f;};'use strict';var Sequelize=require(_0x57d0('0x0'));var rs=require(_0x57d0('0x1'));module[_0x57d0('0x2')]={'name':{'type':Sequelize[_0x57d0('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x57d0('0x3')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x57d0('0x4')]();}},'replyUri':{'type':Sequelize[_0x57d0('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x57d0('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x57d0('0x5')],'defaultValue':function(){return _0x57d0('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x57d0('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x57d0('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x57d0('0x3')]},'queueTransfer':{'type':Sequelize[_0x57d0('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x57d0('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x57d0('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x57d0('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x57d0('0x8')],'defaultValue':![],'comment':_0x57d0('0xa'),'set':function(_0x173808){if(!_0x173808)this[_0x57d0('0xb')](_0x57d0('0xc'),null);this[_0x57d0('0xb')](_0x57d0('0xd'),_0x173808);}}}; \ No newline at end of file +var _0x974b=['exports','STRING','name','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize'];(function(_0x3340c8,_0x3d67d7){var _0x30ca8a=function(_0x435fff){while(--_0x435fff){_0x3340c8['push'](_0x3340c8['shift']());}};_0x30ca8a(++_0x3d67d7);}(_0x974b,0xbf));var _0xb974=function(_0x3f5d1a,_0x33400b){_0x3f5d1a=_0x3f5d1a-0x0;var _0x2db38a=_0x974b[_0x3f5d1a];return _0x2db38a;};'use strict';var Sequelize=require(_0xb974('0x0'));var rs=require('randomstring');module[_0xb974('0x1')]={'name':{'type':Sequelize[_0xb974('0x2')],'unique':_0xb974('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xb974('0x2')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xb974('0x4')]();}},'replyUri':{'type':Sequelize[_0xb974('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xb974('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xb974('0x5');}},'notificationSound':{'type':Sequelize[_0xb974('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb974('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb974('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xb974('0x2')]},'queueTransfer':{'type':Sequelize[_0xb974('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb974('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb974('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb974('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb974('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0xb974('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xb974('0x6')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x27f4d1){if(!_0x27f4d1)this[_0xb974('0x9')](_0xb974('0xa'),null);this['setDataValue'](_0xb974('0xb'),_0x27f4d1);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 270a06e..f38b264 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 _0x3787=['getApplications','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','addAgents','omit','spread','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','rimraf','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','./openchannelAccount.socket','register','client','http','request','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','get','name','send','Pause','map','OpenchannelAccount','fieldName','type','key','model','query','intersection','attributes','fields','nolimit','offset','order','sort','where','filter','merge','options','findAll','show','params','mandatoryDispositionPause','keys','rawAttributes','includeAll','include','find','create','user','role','OpenchannelAccounts','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','filters','length','hasOwnProperty','pick','rows','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','notify','CmContact','difference','createdAt','updatedAt','CompanyId','isNil','from','Sequelize','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','List','Contacts','DESC','Applications','account','applications','list','orderBy','priority','defaults','ListId','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','messageId','interaction','created','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','transaction','sequelize','ISOLATION_LEVELS','READ_COMMITTED','OpenchannelApplication','bulkCreate','findAndCountAll','stack','finally'];(function(_0x23d369,_0x4d2f85){var _0x1e711b=function(_0x4829ec){while(--_0x4829ec){_0x23d369['push'](_0x23d369['shift']());}};_0x1e711b(++_0x4d2f85);}(_0x3787,0xd3));var _0x7378=function(_0x10e52c,_0xcb0072){_0x10e52c=_0x10e52c-0x0;var _0x8ca261=_0x3787[_0x10e52c];return _0x8ca261;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7378('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7378('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7378('0x2'));var util=require(_0x7378('0x3'));var path=require(_0x7378('0x4'));var sox=require(_0x7378('0x5'));var csv=require(_0x7378('0x6'));var ejs=require(_0x7378('0x7'));var fs=require('fs');var fs_extra=require(_0x7378('0x8'));var _=require(_0x7378('0x9'));var squel=require(_0x7378('0xa'));var crypto=require(_0x7378('0xb'));var jsforce=require(_0x7378('0xc'));var deskjs=require(_0x7378('0xd'));var toCsv=require(_0x7378('0x6'));var querystring=require(_0x7378('0xe'));var Papa=require(_0x7378('0xf'));var Redis=require(_0x7378('0x10'));var authService=require(_0x7378('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7378('0x12'));var hardwareService=require(_0x7378('0x13'));var logger=require('../../config/logger')(_0x7378('0x14'));var utils=require(_0x7378('0x15'));var config=require(_0x7378('0x16'));var licenseUtil=require(_0x7378('0x17'));var db=require(_0x7378('0x18'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x7378('0x19'),'port':0x18eb});var socket=require(_0x7378('0x1a'))(new Redis(config['redis']));require(_0x7378('0x1b'))[_0x7378('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x7378('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0x7378('0x1d')][_0x7378('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x873f4f,_0x7dd3bf,_0x406a4c,_0x4303ff){return new BPromise(function(_0x582ca4,_0x5af7d2){var _0x13141b=_0x4303ff||client;return _0x13141b[_0x7378('0x1f')](_0x873f4f,_0x406a4c)[_0x7378('0x20')](function(_0xc2d9fa){logger[_0x7378('0x21')]('OpenchannelAccount,\x20%s,\x20%s',_0x7dd3bf,_0x7378('0x22'));logger[_0x7378('0x23')](_0x7378('0x24'),_0x7dd3bf,_0x7378('0x22'),JSON['stringify'](_0xc2d9fa));if(_0xc2d9fa[_0x7378('0x25')]){if(_0xc2d9fa[_0x7378('0x25')][_0x7378('0x26')]===0x1f4){logger['error'](_0x7378('0x27'),_0x7dd3bf,_0xc2d9fa['error'][_0x7378('0x28')]);return _0x5af7d2(_0xc2d9fa[_0x7378('0x25')][_0x7378('0x28')]);}logger[_0x7378('0x25')](_0x7378('0x27'),_0x7dd3bf,_0xc2d9fa[_0x7378('0x25')]['message']);return _0x582ca4(_0xc2d9fa['error'][_0x7378('0x28')]);}else{logger[_0x7378('0x21')]('OpenchannelAccount,\x20%s,\x20%s',_0x7dd3bf,_0x7378('0x22'));_0x582ca4(_0xc2d9fa[_0x7378('0x29')][_0x7378('0x28')]);}})[_0x7378('0x2a')](function(_0x4293f3){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x7dd3bf,_0x4293f3);_0x5af7d2(_0x4293f3);});});}function respondWithStatusCode(_0x1e8727,_0x1f7341){_0x1f7341=_0x1f7341||0xcc;return function(_0x2f1c82){if(_0x2f1c82){return _0x1e8727[_0x7378('0x2b')](_0x1f7341);}return _0x1e8727[_0x7378('0x2c')](_0x1f7341)[_0x7378('0x2d')]();};}function respondWithResult(_0x44696d,_0x437023){_0x437023=_0x437023||0xc8;return function(_0x1c1b20){if(_0x1c1b20){return _0x44696d['status'](_0x437023)[_0x7378('0x2e')](_0x1c1b20);}};}function respondWithFilteredResult(_0x3d72ac,_0x149c49){return function(_0x3227d6){if(_0x3227d6){var _0x1b3e19=typeof _0x149c49['offset']==='undefined'&&typeof _0x149c49[_0x7378('0x2f')]===_0x7378('0x30');var _0xa55adc=_0x3227d6[_0x7378('0x31')];var _0x9e22e6=_0x1b3e19?0x0:_0x149c49['offset'];var _0x4760ce=_0x1b3e19?_0x3227d6[_0x7378('0x31')]:_0x149c49['offset']+_0x149c49[_0x7378('0x2f')];var _0x29d663;if(_0x4760ce>=_0xa55adc){_0x4760ce=_0xa55adc;_0x29d663=0xc8;}else{_0x29d663=0xce;}_0x3d72ac[_0x7378('0x2c')](_0x29d663);return _0x3d72ac[_0x7378('0x32')](_0x7378('0x33'),_0x9e22e6+'-'+_0x4760ce+'/'+_0xa55adc)['json'](_0x3227d6);}return null;};}function patchUpdates(_0x5d0a62){return function(_0x1107fc){try{jsonpatch[_0x7378('0x34')](_0x1107fc,_0x5d0a62,!![]);}catch(_0x17ff22){return BPromise[_0x7378('0x35')](_0x17ff22);}return _0x1107fc[_0x7378('0x36')]();};}function saveUpdates(_0x4bfbab,_0x3f5eef){return function(_0x1ab88d){if(_0x1ab88d){return _0x1ab88d[_0x7378('0x37')](_0x4bfbab)[_0x7378('0x20')](function(_0x271eb1){return _0x271eb1;});}return null;};}function removeEntity(_0x5d739a,_0x16e3b5){return function(_0x5f05b3){if(_0x5f05b3){return _0x5f05b3[_0x7378('0x38')]()[_0x7378('0x20')](function(){var _0x5f003f=_0x5f05b3[_0x7378('0x39')]({'plain':!![]});var _0x5e07dc='OpenchannelAccounts';return db['UserProfileResource'][_0x7378('0x38')]({'where':{'type':_0x5e07dc,'resourceId':_0x5f003f['id']}})[_0x7378('0x20')](function(){return _0x5f05b3;});})[_0x7378('0x20')](function(){_0x5d739a[_0x7378('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1136b7,_0x701c19){return function(_0x40f85d){if(!_0x40f85d){_0x1136b7[_0x7378('0x2b')](0x194);}return _0x40f85d;};}function handleError(_0x3a8ac0,_0x330845){_0x330845=_0x330845||0x1f4;return function(_0x190827){logger['error'](_0x190827['stack']);if(_0x190827[_0x7378('0x3a')]){delete _0x190827[_0x7378('0x3a')];}_0x3a8ac0['status'](_0x330845)[_0x7378('0x3b')](_0x190827);};}exports['index']=function(_0x5ff3c2,_0x1523c6){var _0x265aaf={'include':[{'model':db[_0x7378('0x3c')],'as':'mandatoryDispositionPause'}]},_0x32e300={},_0x1b74a7={'count':0x0,'rows':[]};var _0x392cab=_[_0x7378('0x3d')](db[_0x7378('0x3e')]['rawAttributes'],function(_0x26a218){return{'name':_0x26a218[_0x7378('0x3f')],'type':_0x26a218[_0x7378('0x40')][_0x7378('0x41')]};});_0x32e300[_0x7378('0x42')]=_['map'](_0x392cab,_0x7378('0x3a'));_0x32e300['query']=_['keys'](_0x5ff3c2[_0x7378('0x43')]);_0x32e300['filters']=_[_0x7378('0x44')](_0x32e300['model'],_0x32e300[_0x7378('0x43')]);_0x265aaf[_0x7378('0x45')]=_[_0x7378('0x44')](_0x32e300[_0x7378('0x42')],qs[_0x7378('0x46')](_0x5ff3c2[_0x7378('0x43')][_0x7378('0x46')]));_0x265aaf[_0x7378('0x45')]=_0x265aaf[_0x7378('0x45')]['length']?_0x265aaf[_0x7378('0x45')]:_0x32e300[_0x7378('0x42')];if(!_0x5ff3c2[_0x7378('0x43')]['hasOwnProperty'](_0x7378('0x47'))){_0x265aaf['limit']=qs[_0x7378('0x2f')](_0x5ff3c2[_0x7378('0x43')][_0x7378('0x2f')]);_0x265aaf[_0x7378('0x48')]=qs[_0x7378('0x48')](_0x5ff3c2['query']['offset']);}_0x265aaf[_0x7378('0x49')]=qs[_0x7378('0x4a')](_0x5ff3c2['query'][_0x7378('0x4a')]);_0x265aaf[_0x7378('0x4b')]=qs['filters'](_['pick'](_0x5ff3c2[_0x7378('0x43')],_0x32e300['filters']),_0x392cab);if(_0x5ff3c2[_0x7378('0x43')][_0x7378('0x4c')]){_0x265aaf[_0x7378('0x4b')]=_[_0x7378('0x4d')](_0x265aaf[_0x7378('0x4b')],{'$or':_[_0x7378('0x3d')](_0x392cab,function(_0x17c6da){if(_0x17c6da[_0x7378('0x40')]!=='VIRTUAL'){var _0x1a4d30={};_0x1a4d30[_0x17c6da[_0x7378('0x3a')]]={'$like':'%'+_0x5ff3c2[_0x7378('0x43')][_0x7378('0x4c')]+'%'};return _0x1a4d30;}})});}_0x265aaf=_[_0x7378('0x4d')]({},_0x265aaf,_0x5ff3c2[_0x7378('0x4e')]);var _0xb39228={'where':_0x265aaf['where']};return db[_0x7378('0x3e')][_0x7378('0x31')](_0xb39228)[_0x7378('0x20')](function(_0x41b65b){_0x1b74a7[_0x7378('0x31')]=_0x41b65b;if(_0x5ff3c2[_0x7378('0x43')]['includeAll']){_0x265aaf['include']=[{'all':!![]}];}return db[_0x7378('0x3e')][_0x7378('0x4f')](_0x265aaf);})['then'](function(_0x687f1f){_0x1b74a7['rows']=_0x687f1f;return _0x1b74a7;})[_0x7378('0x20')](respondWithFilteredResult(_0x1523c6,_0x265aaf))[_0x7378('0x2a')](handleError(_0x1523c6,null));};exports[_0x7378('0x50')]=function(_0x303f28,_0x156be4){var _0x5021b3={'raw':![],'where':{'id':_0x303f28[_0x7378('0x51')]['id']},'include':[{'model':db[_0x7378('0x3c')],'as':_0x7378('0x52')}]},_0x1d2c6d={};_0x1d2c6d[_0x7378('0x42')]=_[_0x7378('0x53')](db[_0x7378('0x3e')][_0x7378('0x54')]);_0x1d2c6d[_0x7378('0x43')]=_['keys'](_0x303f28[_0x7378('0x43')]);_0x1d2c6d['filters']=_[_0x7378('0x44')](_0x1d2c6d[_0x7378('0x42')],_0x1d2c6d['query']);_0x5021b3[_0x7378('0x45')]=_[_0x7378('0x44')](_0x1d2c6d[_0x7378('0x42')],qs[_0x7378('0x46')](_0x303f28[_0x7378('0x43')][_0x7378('0x46')]));_0x5021b3[_0x7378('0x45')]=_0x5021b3[_0x7378('0x45')]['length']?_0x5021b3['attributes']:_0x1d2c6d['model'];if(_0x303f28[_0x7378('0x43')][_0x7378('0x55')]){_0x5021b3[_0x7378('0x56')]=[{'all':!![]}];}_0x5021b3=_[_0x7378('0x4d')]({},_0x5021b3,_0x303f28[_0x7378('0x4e')]);return db[_0x7378('0x3e')][_0x7378('0x57')](_0x5021b3)['then'](handleEntityNotFound(_0x156be4,null))[_0x7378('0x20')](respondWithResult(_0x156be4,null))[_0x7378('0x2a')](handleError(_0x156be4,null));};exports[_0x7378('0x58')]=function(_0x5dca38,_0x5c9f02){return db[_0x7378('0x3e')][_0x7378('0x58')](_0x5dca38['body'],{})[_0x7378('0x20')](function(_0x239a32){var _0x3e7b0c=_0x5dca38[_0x7378('0x59')][_0x7378('0x39')]({'plain':!![]});if(!_0x3e7b0c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e7b0c[_0x7378('0x5a')]===_0x7378('0x59')){var _0x7e6487=_0x239a32[_0x7378('0x39')]({'plain':!![]});var _0x273cde=_0x7378('0x5b');return db[_0x7378('0x5c')][_0x7378('0x57')]({'where':{'name':_0x273cde,'userProfileId':_0x3e7b0c['userProfileId']},'raw':!![]})['then'](function(_0x453f95){if(_0x453f95&&_0x453f95[_0x7378('0x5d')]===0x0){return db[_0x7378('0x5e')][_0x7378('0x58')]({'name':_0x7e6487['name'],'resourceId':_0x7e6487['id'],'type':_0x453f95['name'],'sectionId':_0x453f95['id']},{})['then'](function(){return _0x239a32;});}else{return _0x239a32;}})[_0x7378('0x2a')](function(_0x2258fc){logger[_0x7378('0x25')](_0x7378('0x5f'),_0x2258fc);throw _0x2258fc;});}return _0x239a32;})[_0x7378('0x20')](respondWithResult(_0x5c9f02,0xc9))[_0x7378('0x2a')](handleError(_0x5c9f02,null));};exports[_0x7378('0x37')]=function(_0x3d2a4d,_0xc9f8b4){if(_0x3d2a4d['body']['id']){delete _0x3d2a4d[_0x7378('0x60')]['id'];}return db[_0x7378('0x3e')]['find']({'where':{'id':_0x3d2a4d['params']['id']},'include':[{'model':db[_0x7378('0x3c')],'as':_0x7378('0x52')}]})[_0x7378('0x20')](handleEntityNotFound(_0xc9f8b4,null))[_0x7378('0x20')](saveUpdates(_0x3d2a4d[_0x7378('0x60')],null))['then'](respondWithResult(_0xc9f8b4,null))['catch'](handleError(_0xc9f8b4,null));};exports['destroy']=function(_0x242943,_0x2a1855){return db[_0x7378('0x3e')]['find']({'where':{'id':_0x242943[_0x7378('0x51')]['id']}})[_0x7378('0x20')](handleEntityNotFound(_0x2a1855,null))[_0x7378('0x20')](removeEntity(_0x2a1855,null))['catch'](handleError(_0x2a1855,null));};exports['describe']=function(_0x577f7f,_0x43c8bb){return db['OpenchannelAccount'][_0x7378('0x61')]()[_0x7378('0x20')](respondWithResult(_0x43c8bb,null))[_0x7378('0x2a')](handleError(_0x43c8bb,null));};exports[_0x7378('0x62')]=function(_0x7b8c66,_0x343e16,_0x86b0e){if(_0x7b8c66[_0x7378('0x60')]['id']){delete _0x7b8c66[_0x7378('0x60')]['id'];}return db[_0x7378('0x3e')][_0x7378('0x57')]({'where':{'id':_0x7b8c66[_0x7378('0x51')]['id']}})[_0x7378('0x20')](handleEntityNotFound(_0x343e16,null))[_0x7378('0x20')](function(_0x1e08f0){if(_0x1e08f0){_0x7b8c66[_0x7378('0x60')][_0x7378('0x63')]=_0x1e08f0['id'];return db[_0x7378('0x64')][_0x7378('0x58')](_0x7b8c66[_0x7378('0x60')]);}})['then'](respondWithResult(_0x343e16,null))[_0x7378('0x2a')](handleError(_0x343e16,null));};exports[_0x7378('0x65')]=function(_0x2f616d,_0x324776,_0x23ccb9){var _0x25b0c8={'raw':![],'where':{}};var _0x182cf2={};var _0x236135={'count':0x0,'rows':[]};return db[_0x7378('0x3e')][_0x7378('0x66')]({'where':{'id':_0x2f616d[_0x7378('0x51')]['id']}})[_0x7378('0x20')](handleEntityNotFound(_0x324776,null))[_0x7378('0x20')](function(_0x40f4b0){if(_0x40f4b0){_0x182cf2['model']=_[_0x7378('0x53')](db[_0x7378('0x64')][_0x7378('0x54')]);_0x182cf2[_0x7378('0x43')]=_['keys'](_0x2f616d[_0x7378('0x43')]);_0x182cf2[_0x7378('0x67')]=_['intersection'](_0x182cf2['model'],_0x182cf2[_0x7378('0x43')]);_0x25b0c8['attributes']=_['intersection'](_0x182cf2[_0x7378('0x42')],qs[_0x7378('0x46')](_0x2f616d[_0x7378('0x43')][_0x7378('0x46')]));_0x25b0c8['attributes']=_0x25b0c8[_0x7378('0x45')][_0x7378('0x68')]?_0x25b0c8[_0x7378('0x45')]:_0x182cf2[_0x7378('0x42')];if(!_0x2f616d[_0x7378('0x43')][_0x7378('0x69')](_0x7378('0x47'))){_0x25b0c8[_0x7378('0x2f')]=qs[_0x7378('0x2f')](_0x2f616d['query'][_0x7378('0x2f')]);_0x25b0c8[_0x7378('0x48')]=qs[_0x7378('0x48')](_0x2f616d['query'][_0x7378('0x48')]);}_0x25b0c8['order']=qs[_0x7378('0x4a')](_0x2f616d[_0x7378('0x43')][_0x7378('0x4a')]);_0x25b0c8[_0x7378('0x4b')]=qs[_0x7378('0x67')](_[_0x7378('0x6a')](_0x2f616d[_0x7378('0x43')],_0x182cf2[_0x7378('0x67')]));_0x25b0c8[_0x7378('0x4b')][_0x7378('0x63')]=_0x40f4b0['id'];if(_0x2f616d[_0x7378('0x43')][_0x7378('0x4c')]){_0x25b0c8['where']=_[_0x7378('0x4d')](_0x25b0c8['where'],{'$or':_[_0x7378('0x3d')](_0x25b0c8[_0x7378('0x45')],function(_0x32f95b){var _0x2efaca={};_0x2efaca[_0x32f95b]={'$like':'%'+_0x2f616d['query'][_0x7378('0x4c')]+'%'};return _0x2efaca;})});}_0x25b0c8=_[_0x7378('0x4d')]({},_0x25b0c8,_0x2f616d[_0x7378('0x4e')]);return db[_0x7378('0x64')][_0x7378('0x31')]({'where':_0x25b0c8[_0x7378('0x4b')]})[_0x7378('0x20')](function(_0x28a852){_0x236135[_0x7378('0x31')]=_0x28a852;if(_0x2f616d[_0x7378('0x43')][_0x7378('0x55')]){_0x25b0c8[_0x7378('0x56')]=[{'all':!![]}];}return db[_0x7378('0x64')]['findAll'](_0x25b0c8);})['then'](function(_0x4c52fb){_0x236135[_0x7378('0x6b')]=_0x4c52fb;return _0x236135;});}})[_0x7378('0x20')](respondWithFilteredResult(_0x324776,_0x25b0c8))[_0x7378('0x2a')](handleError(_0x324776,null));};exports[_0x7378('0x6c')]=function(_0x4230ac,_0x25bfdc,_0x568e2d){return db[_0x7378('0x3e')][_0x7378('0x57')]({'where':{'id':_0x4230ac['params']['id']}})[_0x7378('0x20')](handleEntityNotFound(_0x25bfdc,null))[_0x7378('0x20')](function(_0x2ba843){if(_0x2ba843){return _0x2ba843[_0x7378('0x6c')](_0x4230ac[_0x7378('0x43')]['ids']);}})[_0x7378('0x20')](respondWithStatusCode(_0x25bfdc,null))[_0x7378('0x2a')](handleError(_0x25bfdc,null));};exports['addAnswer']=function(_0xf8420f,_0x38e984,_0x5829af){if(_0xf8420f[_0x7378('0x60')]['id']){delete _0xf8420f[_0x7378('0x60')]['id'];}return db[_0x7378('0x3e')][_0x7378('0x57')]({'where':{'id':_0xf8420f[_0x7378('0x51')]['id']}})[_0x7378('0x20')](handleEntityNotFound(_0x38e984,null))[_0x7378('0x20')](function(_0x7f53c8){if(_0x7f53c8){_0xf8420f[_0x7378('0x60')]['OpenchannelAccountId']=_0x7f53c8['id'];return db[_0x7378('0x6d')][_0x7378('0x58')](_0xf8420f[_0x7378('0x60')]);}})[_0x7378('0x20')](respondWithResult(_0x38e984,null))[_0x7378('0x2a')](handleError(_0x38e984,null));};exports[_0x7378('0x6e')]=function(_0x471494,_0x4eded4,_0x859cfa){var _0x52b111={'raw':![],'where':{}};var _0x16f758={};var _0x5851f3={'count':0x0,'rows':[]};return db[_0x7378('0x3e')]['findOne']({'where':{'id':_0x471494[_0x7378('0x51')]['id']}})['then'](handleEntityNotFound(_0x4eded4,null))[_0x7378('0x20')](function(_0x2e8011){if(_0x2e8011){_0x16f758[_0x7378('0x42')]=_[_0x7378('0x53')](db['CannedAnswer'][_0x7378('0x54')]);_0x16f758[_0x7378('0x43')]=_['keys'](_0x471494['query']);_0x16f758[_0x7378('0x67')]=_[_0x7378('0x44')](_0x16f758[_0x7378('0x42')],_0x16f758[_0x7378('0x43')]);_0x52b111[_0x7378('0x45')]=_['intersection'](_0x16f758[_0x7378('0x42')],qs[_0x7378('0x46')](_0x471494[_0x7378('0x43')]['fields']));_0x52b111['attributes']=_0x52b111['attributes'][_0x7378('0x68')]?_0x52b111[_0x7378('0x45')]:_0x16f758[_0x7378('0x42')];if(!_0x471494['query'][_0x7378('0x69')]('nolimit')){_0x52b111[_0x7378('0x2f')]=qs[_0x7378('0x2f')](_0x471494[_0x7378('0x43')][_0x7378('0x2f')]);_0x52b111[_0x7378('0x48')]=qs[_0x7378('0x48')](_0x471494['query'][_0x7378('0x48')]);}_0x52b111[_0x7378('0x49')]=qs[_0x7378('0x4a')](_0x471494['query']['sort']);_0x52b111[_0x7378('0x4b')]=qs[_0x7378('0x67')](_[_0x7378('0x6a')](_0x471494[_0x7378('0x43')],_0x16f758['filters']));_0x52b111[_0x7378('0x4b')][_0x7378('0x63')]=_0x2e8011['id'];if(_0x471494[_0x7378('0x43')][_0x7378('0x4c')]){_0x52b111[_0x7378('0x4b')]=_[_0x7378('0x4d')](_0x52b111['where'],{'$or':_[_0x7378('0x3d')](_0x52b111['attributes'],function(_0x5b7dee){var _0x5adeee={};_0x5adeee[_0x5b7dee]={'$like':'%'+_0x471494['query'][_0x7378('0x4c')]+'%'};return _0x5adeee;})});}_0x52b111=_[_0x7378('0x4d')]({},_0x52b111,_0x471494[_0x7378('0x4e')]);return db[_0x7378('0x6d')][_0x7378('0x31')]({'where':_0x52b111[_0x7378('0x4b')]})[_0x7378('0x20')](function(_0xf142cf){_0x5851f3['count']=_0xf142cf;if(_0x471494[_0x7378('0x43')]['includeAll']){_0x52b111[_0x7378('0x56')]=[{'all':!![]}];}return db[_0x7378('0x6d')][_0x7378('0x4f')](_0x52b111);})[_0x7378('0x20')](function(_0x342df5){_0x5851f3[_0x7378('0x6b')]=_0x342df5;return _0x5851f3;});}})[_0x7378('0x20')](respondWithFilteredResult(_0x4eded4,_0x52b111))[_0x7378('0x2a')](handleError(_0x4eded4,null));};exports[_0x7378('0x6f')]=function(_0x5859cb,_0x2f605e,_0x57e059){return db['OpenchannelAccount']['find']({'where':{'id':_0x5859cb[_0x7378('0x51')]['id']}})[_0x7378('0x20')](handleEntityNotFound(_0x2f605e,null))['then'](function(_0x9c208b){if(_0x9c208b){return _0x9c208b[_0x7378('0x6f')](_0x5859cb['query'][_0x7378('0x70')]);}})[_0x7378('0x20')](respondWithStatusCode(_0x2f605e,null))['catch'](handleError(_0x2f605e,null));};exports[_0x7378('0x71')]=function(_0x3b43aa,_0x3d08ee,_0x348f7a){var _0x4d8381={'body':_0x3b43aa['body'],'channel':'openchannel'};var _0x315be3=[];var _0x42a4ff=[];var _0x201f7f={};var _0x25f08e=![];return db[_0x7378('0x72')]['describe']()[_0x7378('0x20')](function(_0x2cf8db){if(!_0x2cf8db){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x315be3=_[_0x7378('0x73')](_[_0x7378('0x53')](_0x2cf8db),[_0x7378('0x74'),_0x7378('0x75')]);_0x42a4ff=_[_0x7378('0x73')](_['keys'](_0x2cf8db),[_0x7378('0x74'),_0x7378('0x75'),_0x7378('0x76'),'ListId']);if(_0x3b43aa['body']['id']){delete _0x3b43aa[_0x7378('0x60')]['id'];}if(_[_0x7378('0x77')](_0x3b43aa[_0x7378('0x60')][_0x7378('0x78')])){throw new db[(_0x7378('0x79'))][(_0x7378('0x7a'))]('from\x20is\x20mandatory');}if(_[_0x7378('0x77')](_0x3b43aa[_0x7378('0x60')][_0x7378('0x60')])||_0x3b43aa['body'][_0x7378('0x60')]===''){throw new db[(_0x7378('0x79'))][(_0x7378('0x7a'))](_0x7378('0x7b'));}if(_[_0x7378('0x77')](_0x3b43aa['body']['mapKey'])){throw new db[(_0x7378('0x79'))][(_0x7378('0x7a'))](_0x7378('0x7c')+_0x42a4ff);}if(!_['includes'](_0x42a4ff,_0x3b43aa['body'][_0x7378('0x7d')])){throw new db[(_0x7378('0x79'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x42a4ff);}_0x201f7f[_0x3b43aa['body'][_0x7378('0x7d')]]=_0x3b43aa['body']['from'];})[_0x7378('0x20')](function(){return db[_0x7378('0x3e')][_0x7378('0x57')]({'where':{'id':_0x3b43aa[_0x7378('0x51')]['id']},'include':[{'model':db['CmList'],'as':_0x7378('0x7e'),'include':[{'model':db[_0x7378('0x72')],'as':_0x7378('0x7f'),'where':_0x201f7f,'limit':0x1,'order':[['updatedAt',_0x7378('0x80')]]}]},{'model':db['OpenchannelApplication'],'as':_0x7378('0x81')}]});})[_0x7378('0x20')](handleEntityNotFound(_0x3d08ee,null))[_0x7378('0x20')](function(_0x11e82a){if(_0x11e82a&&_0x11e82a[_0x7378('0x7e')]){_0x4d8381[_0x7378('0x82')]=_0x11e82a;_0x4d8381[_0x7378('0x83')]=_0x11e82a[_0x7378('0x81')];_0x4d8381[_0x7378('0x84')]=_0x11e82a['List'];_0x4d8381[_0x7378('0x83')]=_[_0x7378('0x85')](_0x4d8381[_0x7378('0x83')],[_0x7378('0x86')],['asc']);if(_0x4d8381[_0x7378('0x82')]['Applications']){delete _0x4d8381[_0x7378('0x82')][_0x7378('0x81')];}if(_0x4d8381[_0x7378('0x82')][_0x7378('0x7e')]&&_0x4d8381[_0x7378('0x82')][_0x7378('0x7e')][_0x7378('0x7f')][_0x7378('0x68')]){return _0x4d8381[_0x7378('0x82')][_0x7378('0x7e')][_0x7378('0x7f')][0x0];}var _0x14d699=_[_0x7378('0x87')](_0x3b43aa[_0x7378('0x60')],{'firstName':_0x3b43aa['body']['from'],'ListId':_0x11e82a[_0x7378('0x88')]});_0x14d699[_0x3b43aa['body'][_0x7378('0x7d')]]=_0x3b43aa[_0x7378('0x60')][_0x7378('0x78')];return db[_0x7378('0x72')]['create'](_0x14d699,{'fields':_0x315be3,'raw':!![]});}})[_0x7378('0x20')](handleEntityNotFound(_0x3d08ee,null))[_0x7378('0x20')](function(_0x39c756){_0x4d8381[_0x7378('0x89')]=_0x39c756;if(_0x39c756){var _0x2af7b8={'ContactId':_0x39c756['id'],'OpenchannelAccountId':_0x3b43aa[_0x7378('0x51')]['id'],'from':(_0x39c756[_0x7378('0x8a')]||'')+'\x20'+(_0x39c756[_0x7378('0x8b')]||'')};var _0xcb8db7={'OpenchannelAccountId':_0x3b43aa['params']['id'],'closed':![]};if(_0x3b43aa[_0x7378('0x60')][_0x7378('0x8c')]){_0xcb8db7[_0x7378('0x8c')]=_0x3b43aa[_0x7378('0x60')][_0x7378('0x8c')];return db[_0x7378('0x8d')][_0x7378('0x57')]({'where':_0xcb8db7})[_0x7378('0x20')](function(_0x1bcbc8){if(_0x1bcbc8){return[_0x1bcbc8,![]];}_0x2af7b8[_0x7378('0x8c')]=_0x3b43aa['body'][_0x7378('0x8c')];_0x2af7b8[_0x7378('0x8e')]=_0x3b43aa[_0x7378('0x60')][_0x7378('0x8e')];return db[_0x7378('0x8d')][_0x7378('0x58')](_0x2af7b8)[_0x7378('0x20')](function(_0x2bd600){return[_0x2bd600,!![]];});});}else{_0xcb8db7[_0x7378('0x8c')]=null;}_0xcb8db7['ContactId']=_0x39c756['id'];return db['OpenchannelInteraction'][_0x7378('0x57')]({'where':_0xcb8db7})['then'](function(_0x34fe3f){if(_0x34fe3f){return[_0x34fe3f,![]];}return db[_0x7378('0x8d')][_0x7378('0x58')](_0x2af7b8)['then'](function(_0x4f820b){return[_0x4f820b,!![]];});});}})['spread'](function(_0x4e3ea7,_0x3f1951){if(_0x4e3ea7){_0x25f08e=_0x3f1951;if(!_0x3f1951){var _0x385eae={'from':(_0x4d8381[_0x7378('0x89')][_0x7378('0x8a')]||'')+'\x20'+(_0x4d8381[_0x7378('0x89')][_0x7378('0x8b')]||'')};if(_0x3b43aa[_0x7378('0x60')][_0x7378('0x8c')]&&_0x3b43aa[_0x7378('0x60')]['messageId']&&_0x3b43aa['body'][_0x7378('0x8c')]!=_0x3b43aa[_0x7378('0x60')][_0x7378('0x8f')]){_0x385eae[_0x7378('0x8c')]=_0x3b43aa['body']['messageId'];}return _0x4e3ea7[_0x7378('0x37')](_0x385eae);}else{return _0x4e3ea7;}}})['then'](function(_0x57b5fb){_0x4d8381[_0x7378('0x90')]=_0x57b5fb[_0x7378('0x39')]({'plain':!![]});_0x4d8381[_0x7378('0x90')][_0x7378('0x91')]=_0x25f08e;if(_0x4d8381[_0x7378('0x90')][_0x7378('0x91')]){if(_0x4d8381['account']['autoclose']){_0x4d8381[_0x7378('0x83')][_0x7378('0x92')]({'id':0x0,'priority':_0x4d8381[_0x7378('0x83')][_0x7378('0x68')]+0x1,'app':_0x7378('0x93'),'appdata':_0x7378('0x94'),'interval':_0x7378('0x95')});}}return db[_0x7378('0x96')][_0x7378('0x58')]({'body':_0x3b43aa[_0x7378('0x60')][_0x7378('0x60')],'OpenchannelAccountId':_0x3b43aa[_0x7378('0x51')]['id'],'OpenchannelInteractionId':_0x57b5fb['id'],'direction':'in','ContactId':_0x4d8381[_0x7378('0x89')]['id'],'AttachmentId':_0x3b43aa[_0x7378('0x60')][_0x7378('0x97')]});})['then'](function(_0x3e9703){_0x4d8381[_0x7378('0x28')]=_0x3e9703;if(!_0x4d8381[_0x7378('0x90')][_0x7378('0x98')])return;return db[_0x7378('0x99')][_0x7378('0x57')]({'attributes':['id','name'],'where':{'id':_0x4d8381[_0x7378('0x90')][_0x7378('0x98')]}});})[_0x7378('0x20')](function(_0x3aa515){if(_0x3aa515){_0x4d8381[_0x7378('0x83')][_0x7378('0x9a')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3aa515[_0x7378('0x3a')]+','+(_0x4d8381[_0x7378('0x82')][_0x7378('0x9b')]||0xa),'interval':'*,*,*,*'});}if(!_0x4d8381[_0x7378('0x90')][_0x7378('0x9c')])return;return db['OpenchannelQueue'][_0x7378('0x57')]({'attributes':['id','name'],'where':{'id':_0x4d8381[_0x7378('0x90')]['queueId']}});})[_0x7378('0x20')](function(_0x479d15){if(_0x479d15){_0x4d8381['applications'][_0x7378('0x9a')]({'id':0x0,'priority':0x1,'app':_0x7378('0x9d'),'appdata':_0x479d15['name']+','+(_0x4d8381[_0x7378('0x82')][_0x7378('0x9e')]||0x12c),'interval':_0x7378('0x95')});}return respondWithRpcPromise(_0x7378('0x9f'),_0x7378('0xa0'),_0x4d8381);})[_0x7378('0x20')](function(_0x4e4104){respondWithRpcPromise(_0x7378('0xa1'),'EventManager',{'event':_0x7378('0x71'),'message':_0x4e4104},client9002);return _0x4e4104;})[_0x7378('0x20')](respondWithResult(_0x3d08ee,null))['catch'](handleError(_0x3d08ee,null));};exports['addApplications']=function(_0x51c5c0,_0x5141d5){var _0x2db335=_0x51c5c0[_0x7378('0x51')]['id'];var _0x54964e=_0x51c5c0[_0x7378('0x60')];var _0x20af04=0xc8;var _0x36b816=null;return db['sequelize'][_0x7378('0xa2')]({'isolationLevel':db[_0x7378('0xa3')]['Transaction'][_0x7378('0xa4')][_0x7378('0xa5')]},function(_0x1dce44){return db['OpenchannelAccount']['findOne']({'where':{'id':_0x2db335},'transaction':_0x1dce44})[_0x7378('0x20')](function(_0xae2e4a){if(_0xae2e4a){return db[_0x7378('0xa6')][_0x7378('0x38')]({'where':{'OpenchannelAccountId':_0x2db335},'transaction':_0x1dce44})[_0x7378('0x20')](function(){var _0x2b8a92=_[_0x7378('0x3d')](_0x54964e,function(_0x1bf5d){_0x1bf5d[_0x7378('0x63')]=_0x2db335;return _0x1bf5d;});return db['OpenchannelApplication'][_0x7378('0xa7')](_0x2b8a92,{'transaction':_0x1dce44});});}else{_0x20af04=0x194;_0x36b816=[];}});})['then'](function(){if(_0x20af04!==0x194){return db[_0x7378('0xa6')][_0x7378('0xa8')]({'where':{'OpenchannelAccountId':_0x2db335},'order':'priority'})['then'](function(_0x14d10f){_0x36b816=_0x14d10f;});}})[_0x7378('0x2a')](function(_0x17a8d1){_0x20af04=0x1f4;logger[_0x7378('0x25')](_0x17a8d1[_0x7378('0xa9')]);if(_0x17a8d1[_0x7378('0x3a')]){delete _0x17a8d1[_0x7378('0x3a')];}_0x36b816=_0x17a8d1;})[_0x7378('0xaa')](function(){if(_0x36b816===null){_0x5141d5[_0x7378('0x2b')](_0x20af04);}else{if(_0x20af04===0x1f4){_0x5141d5[_0x7378('0x2c')](_0x20af04)['send'](_0x36b816);}else{_0x5141d5[_0x7378('0x2c')](_0x20af04)[_0x7378('0x2e')](_0x36b816);}}});};exports[_0x7378('0xab')]=function(_0x369617,_0x4ec61a,_0x4c25c8){var _0x342879={};var _0x4489f6={};var _0x1609c1;var _0x213454;return db[_0x7378('0x3e')][_0x7378('0x66')]({'where':{'id':_0x369617[_0x7378('0x51')]['id']}})[_0x7378('0x20')](handleEntityNotFound(_0x4ec61a,null))['then'](function(_0x2d90c4){if(_0x2d90c4){_0x1609c1=_0x2d90c4;_0x4489f6[_0x7378('0x42')]=_[_0x7378('0x53')](db[_0x7378('0xa6')][_0x7378('0x54')]);_0x4489f6['query']=_[_0x7378('0x53')](_0x369617[_0x7378('0x43')]);_0x4489f6[_0x7378('0x67')]=_[_0x7378('0x44')](_0x4489f6[_0x7378('0x42')],_0x4489f6[_0x7378('0x43')]);_0x342879[_0x7378('0x45')]=_[_0x7378('0x44')](_0x4489f6[_0x7378('0x42')],qs[_0x7378('0x46')](_0x369617[_0x7378('0x43')][_0x7378('0x46')]));_0x342879[_0x7378('0x45')]=_0x342879['attributes']['length']?_0x342879['attributes']:_0x4489f6[_0x7378('0x42')];_0x342879[_0x7378('0x49')]=qs[_0x7378('0x4a')](_0x369617[_0x7378('0x43')][_0x7378('0x4a')]);_0x342879[_0x7378('0x4b')]=qs[_0x7378('0x67')](_[_0x7378('0x6a')](_0x369617['query'],_0x4489f6[_0x7378('0x67')]));if(_0x369617[_0x7378('0x43')][_0x7378('0x4c')]){_0x342879[_0x7378('0x4b')]=_[_0x7378('0x4d')](_0x342879['where'],{'$or':_[_0x7378('0x3d')](_0x342879['attributes'],function(_0x2789ca){var _0x161576={};_0x161576[_0x2789ca]={'$like':'%'+_0x369617[_0x7378('0x43')]['filter']+'%'};return _0x161576;})});}_0x342879=_[_0x7378('0x4d')]({},_0x342879,_0x369617[_0x7378('0x4e')]);return _0x1609c1[_0x7378('0xab')](_0x342879);}})[_0x7378('0x20')](function(_0x2cca76){if(_0x2cca76){_0x213454=_0x2cca76[_0x7378('0x68')];if(!_0x369617[_0x7378('0x43')][_0x7378('0x69')](_0x7378('0x47'))){_0x342879[_0x7378('0x2f')]=qs[_0x7378('0x2f')](_0x369617[_0x7378('0x43')]['limit']);_0x342879[_0x7378('0x48')]=qs[_0x7378('0x48')](_0x369617['query'][_0x7378('0x48')]);}return _0x1609c1[_0x7378('0xab')](_0x342879);}})[_0x7378('0x20')](function(_0x4f7373){if(_0x4f7373){return _0x4f7373?{'count':_0x213454,'rows':_0x4f7373}:null;}})['then'](respondWithResult(_0x4ec61a,null))[_0x7378('0x2a')](handleError(_0x4ec61a,null));};exports[_0x7378('0xac')]=function(_0x2759d7,_0x20f0ed,_0x1290f5){var _0x34d409={'raw':![],'where':{}};var _0x5a1b05={};var _0x4098eb={'count':0x0,'rows':[]};return db[_0x7378('0x3e')][_0x7378('0x66')]({'where':{'id':_0x2759d7[_0x7378('0x51')]['id']}})[_0x7378('0x20')](handleEntityNotFound(_0x20f0ed,null))[_0x7378('0x20')](function(_0x547efa){if(_0x547efa){_0x5a1b05['model']=_[_0x7378('0x53')](db['OpenchannelInteraction'][_0x7378('0x54')]);_0x5a1b05[_0x7378('0x43')]=_['keys'](_0x2759d7[_0x7378('0x43')]);_0x5a1b05[_0x7378('0x67')]=_[_0x7378('0x44')](_0x5a1b05[_0x7378('0x42')],_0x5a1b05[_0x7378('0x43')]);_0x34d409[_0x7378('0x45')]=_[_0x7378('0x44')](_0x5a1b05[_0x7378('0x42')],qs[_0x7378('0x46')](_0x2759d7[_0x7378('0x43')][_0x7378('0x46')]));_0x34d409[_0x7378('0x45')]=_0x34d409[_0x7378('0x45')][_0x7378('0x68')]?_0x34d409['attributes']:_0x5a1b05[_0x7378('0x42')];if(!_0x2759d7[_0x7378('0x43')][_0x7378('0x69')](_0x7378('0x47'))){_0x34d409[_0x7378('0x2f')]=qs[_0x7378('0x2f')](_0x2759d7[_0x7378('0x43')]['limit']);_0x34d409['offset']=qs['offset'](_0x2759d7[_0x7378('0x43')][_0x7378('0x48')]);}_0x34d409[_0x7378('0x49')]=qs[_0x7378('0x4a')](_0x2759d7[_0x7378('0x43')]['sort']);_0x34d409[_0x7378('0x4b')]=qs['filters'](_[_0x7378('0x6a')](_0x2759d7[_0x7378('0x43')],_0x5a1b05[_0x7378('0x67')]));_0x34d409[_0x7378('0x4b')][_0x7378('0x63')]=_0x547efa['id'];if(_0x2759d7['query'][_0x7378('0x4c')]){_0x34d409[_0x7378('0x4b')]=_[_0x7378('0x4d')](_0x34d409['where'],{'$or':_['map'](_0x34d409[_0x7378('0x45')],function(_0x34423f){var _0x16d838={};_0x16d838[_0x34423f]={'$like':'%'+_0x2759d7[_0x7378('0x43')][_0x7378('0x4c')]+'%'};return _0x16d838;})});}_0x34d409=_['merge']({},_0x34d409,_0x2759d7[_0x7378('0x4e')]);return db[_0x7378('0x8d')][_0x7378('0x31')]({'where':_0x34d409[_0x7378('0x4b')]})[_0x7378('0x20')](function(_0x29d60b){_0x4098eb[_0x7378('0x31')]=_0x29d60b;if(_0x2759d7['query']['includeAll']){_0x34d409[_0x7378('0x56')]=[{'model':db[_0x7378('0x72')],'as':_0x7378('0xad'),'required':![]},{'model':db['User'],'as':_0x7378('0xae'),'attributes':[_0x7378('0x3a'),_0x7378('0xaf'),_0x7378('0xb0')],'required':![]},{'model':db['Tag'],'as':_0x7378('0xb1'),'attributes':['id',_0x7378('0x3a'),_0x7378('0xb2')],'where':_0x2759d7[_0x7378('0x43')]['tag']?{'id':_0x2759d7[_0x7378('0x43')][_0x7378('0xb3')]}:undefined,'required':_0x2759d7['query'][_0x7378('0xb3')]?!![]:![]}];}return db[_0x7378('0x8d')][_0x7378('0x4f')](_0x34d409);})['then'](function(_0x5b6fa7){_0x4098eb[_0x7378('0x6b')]=_0x5b6fa7;return _0x4098eb;});}})['then'](respondWithFilteredResult(_0x20f0ed,_0x34d409))[_0x7378('0x2a')](handleError(_0x20f0ed,null));};exports['addAgents']=function(_0x3a1178,_0x4bba5b,_0x3ccedb){return db[_0x7378('0x3e')][_0x7378('0x57')]({'where':{'id':_0x3a1178[_0x7378('0x51')]['id']}})['then'](handleEntityNotFound(_0x4bba5b,null))[_0x7378('0x20')](function(_0x27cb96){if(_0x27cb96){return _0x27cb96[_0x7378('0xb4')](_0x3a1178[_0x7378('0x60')][_0x7378('0x70')],_[_0x7378('0xb5')](_0x3a1178['body'],[_0x7378('0x70'),'id'])||{})[_0x7378('0xb6')](function(_0x6eec8c){for(var _0x39586c=0x0;_0x39586c<_0x3a1178[_0x7378('0x60')][_0x7378('0x70')]['length'];_0x39586c+=0x1){socket[_0x7378('0xb7')](_0x7378('0xb8'),{'UserId':Number(_0x3a1178['body']['ids'][_0x39586c]),'OpenchannelAccountId':Number(_0x3a1178['params']['id'])});}return _0x6eec8c;});}})[_0x7378('0x20')](respondWithResult(_0x4bba5b,null))[_0x7378('0x2a')](handleError(_0x4bba5b,null));};exports[_0x7378('0xb9')]=function(_0x5a4651,_0x28940a,_0x13fa7d){return db['OpenchannelAccount']['find']({'where':{'id':_0x5a4651[_0x7378('0x51')]['id']}})[_0x7378('0x20')](handleEntityNotFound(_0x28940a,null))[_0x7378('0x20')](function(_0xc35e23){if(_0xc35e23){return _0xc35e23[_0x7378('0xb9')](_0x5a4651[_0x7378('0x43')][_0x7378('0x70')])[_0x7378('0x20')](function(){if(_['isArray'](_0x5a4651[_0x7378('0x43')]['ids'])){for(var _0x575178=0x0;_0x575178<_0x5a4651[_0x7378('0x43')][_0x7378('0x70')][_0x7378('0x68')];_0x575178+=0x1){socket[_0x7378('0xb7')](_0x7378('0xba'),{'UserId':Number(_0x5a4651[_0x7378('0x43')][_0x7378('0x70')][_0x575178]),'OpenchannelAccountId':Number(_0x5a4651[_0x7378('0x51')]['id'])});}}else{socket['emit'](_0x7378('0xba'),{'UserId':Number(_0x5a4651[_0x7378('0x43')]['ids']),'OpenchannelAccountId':Number(_0x5a4651['params']['id'])});}});}})[_0x7378('0x20')](respondWithStatusCode(_0x28940a,null))['catch'](handleError(_0x28940a,null));};exports[_0x7378('0xbb')]=function(_0x2d4718,_0x249652,_0x529ef4){var _0x2d0ef7={};var _0x588936={};var _0x2b0690;var _0x24c16f;return db[_0x7378('0x3e')]['findOne']({'where':{'id':_0x2d4718[_0x7378('0x51')]['id']}})[_0x7378('0x20')](handleEntityNotFound(_0x249652,null))[_0x7378('0x20')](function(_0x517677){if(_0x517677){_0x2b0690=_0x517677;_0x588936[_0x7378('0x42')]=_[_0x7378('0x53')](db['User'][_0x7378('0x54')]);_0x588936[_0x7378('0x43')]=_['keys'](_0x2d4718[_0x7378('0x43')]);_0x588936[_0x7378('0x67')]=_[_0x7378('0x44')](_0x588936[_0x7378('0x42')],_0x588936[_0x7378('0x43')]);_0x2d0ef7['attributes']=_['intersection'](_0x588936[_0x7378('0x42')],qs['fields'](_0x2d4718[_0x7378('0x43')][_0x7378('0x46')]));_0x2d0ef7[_0x7378('0x45')]=_0x2d0ef7[_0x7378('0x45')][_0x7378('0x68')]?_0x2d0ef7[_0x7378('0x45')]:_0x588936['model'];_0x2d0ef7[_0x7378('0x49')]=qs[_0x7378('0x4a')](_0x2d4718[_0x7378('0x43')][_0x7378('0x4a')]);_0x2d0ef7[_0x7378('0x4b')]=qs['filters'](_[_0x7378('0x6a')](_0x2d4718[_0x7378('0x43')],_0x588936['filters']));if(_0x2d4718['query']['filter']){_0x2d0ef7[_0x7378('0x4b')]=_[_0x7378('0x4d')](_0x2d0ef7[_0x7378('0x4b')],{'$or':_[_0x7378('0x3d')](_0x2d0ef7['attributes'],function(_0x5cf949){var _0x29a42d={};_0x29a42d[_0x5cf949]={'$like':'%'+_0x2d4718['query'][_0x7378('0x4c')]+'%'};return _0x29a42d;})});}_0x2d0ef7=_[_0x7378('0x4d')]({},_0x2d0ef7,_0x2d4718['options']);return _0x2b0690[_0x7378('0xbb')](_0x2d0ef7);}})['then'](function(_0x5d492b){if(_0x5d492b){_0x24c16f=_0x5d492b[_0x7378('0x68')];if(!_0x2d4718[_0x7378('0x43')][_0x7378('0x69')](_0x7378('0x47'))){_0x2d0ef7['limit']=qs['limit'](_0x2d4718[_0x7378('0x43')][_0x7378('0x2f')]);_0x2d0ef7[_0x7378('0x48')]=qs['offset'](_0x2d4718[_0x7378('0x43')][_0x7378('0x48')]);}return _0x2b0690[_0x7378('0xbb')](_0x2d0ef7);}})['then'](function(_0x280f2a){if(_0x280f2a){return _0x280f2a?{'count':_0x24c16f,'rows':_0x280f2a}:null;}})[_0x7378('0x20')](respondWithResult(_0x249652,null))['catch'](handleError(_0x249652,null));};exports['send']=function(_0x13dbde,_0xdf6a63,_0x44a96a){var _0x42b5b7,_0x131750,_0x14b13c;if(_['isNil'](_0x13dbde[_0x7378('0x60')][_0x7378('0x60')])||_0x13dbde['body'][_0x7378('0x60')]===''){throw new db[(_0x7378('0x79'))][(_0x7378('0x7a'))](_0x7378('0x7b'));}if(_[_0x7378('0x77')](_0x13dbde[_0x7378('0x60')]['to'])){}_0x42b5b7=_0x13dbde[_0x7378('0x60')]['to'];return db[_0x7378('0x3e')][_0x7378('0x66')]({'where':{'id':_0x13dbde[_0x7378('0x51')]['id']}})['then'](handleEntityNotFound(_0xdf6a63,null))['then'](function(_0x5b4873){if(_0x5b4873){return db['OpenchannelAccount'][_0x7378('0x57')]({'where':{'id':_0x5b4873['id']},'include':[{'model':db['CmList'],'as':_0x7378('0x7e'),'include':[{'model':db[_0x7378('0x72')],'as':_0x7378('0x7f'),'where':{[_0x5b4873[_0x7378('0x7d')]]:_0x42b5b7},'limit':0x1,'order':[[_0x7378('0x75'),_0x7378('0x80')]]}]}]})[_0x7378('0x20')](handleEntityNotFound(_0xdf6a63,null))[_0x7378('0x20')](function(_0x1652e9){if(_0x1652e9&&_0x1652e9['List']){_0x131750=_0x1652e9[_0x7378('0x39')]({'plain':!![]});if(_0x131750[_0x7378('0x7e')]&&_0x131750[_0x7378('0x7e')][_0x7378('0x7f')][_0x7378('0x68')]){return _0x131750[_0x7378('0x7e')][_0x7378('0x7f')][0x0];}return db[_0x7378('0x72')][_0x7378('0x58')](_[_0x7378('0x87')](_0x13dbde[_0x7378('0x60')],{'firstName':_0x42b5b7,[_0x1652e9[_0x7378('0x7d')]]:_0x42b5b7,'phone':_0x42b5b7,'ListId':_0x131750[_0x7378('0x88')]}));}})[_0x7378('0x20')](handleEntityNotFound(_0xdf6a63,null))['then'](function(_0x3083ae){if(_0x3083ae){_0x14b13c=_0x3083ae;return db[_0x7378('0x8d')]['find']({'where':{'ContactId':_0x14b13c['id'],'closed':![],'OpenchannelAccountId':_0x131750['id']}})[_0x7378('0x20')](function(_0x3680d8){if(_0x3680d8){return[_0x3680d8,![]];}return db[_0x7378('0x8d')][_0x7378('0x58')]({'UserId':_0x13dbde[_0x7378('0x59')]['id'],'ContactId':_0x14b13c['id'],'OpenchannelAccountId':_0x131750['id'],'lastMsgDirection':_0x7378('0xbc'),'firstMsgDirection':_0x7378('0xbc'),'Messages':[_[_0x7378('0x4d')](_0x13dbde[_0x7378('0x60')],{'read':![],'body':_0x13dbde['body'][_0x7378('0x60')],'OpenchannelAccountId':_0x131750['id'],'UserId':_0x13dbde['user']['id'],'ContactId':_0x14b13c['id']})]},{'include':[{'model':db[_0x7378('0x96')],'as':_0x7378('0xbd')}]})[_0x7378('0x20')](function(_0x4bb28b){return[_0x4bb28b,!![]];});});}})[_0x7378('0xb6')](function(_0x218cd0,_0x209fa8){if(_0x209fa8){return _0x218cd0;}return db[_0x7378('0x96')][_0x7378('0x58')](_[_0x7378('0x4d')](_0x13dbde[_0x7378('0x60')],{'read':![],'body':_0x13dbde[_0x7378('0x60')][_0x7378('0x60')],'OpenchannelAccountId':_0x131750['id'],'OpenchannelInteractionId':_0x218cd0['id'],'UserId':_0x13dbde['user']['id'],'ContactId':_0x14b13c['id']}))['then'](function(_0x22228b){_0x218cd0[_0x7378('0xbe')]['Messages']=[];_0x218cd0[_0x7378('0xbe')][_0x7378('0xbd')]['push'](_0x22228b['dataValues']);return _0x218cd0;});});}})[_0x7378('0x20')](respondWithResult(_0xdf6a63,null))['catch'](handleError(_0xdf6a63,null));}; \ No newline at end of file +var _0x853e=['sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','params','Pause','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','update','describe','addDisposition','findOne','Disposition','order','removeDispositions','ids','CannedAnswer','getAnswers','length','nolimit','OpenchannelAccountId','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','updatedAt','CompanyId','ListId','from\x20is\x20mandatory','isNil','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','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','asc','from','contact','threadId','OpenchannelInteraction','externalUrl','spread','lastName','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','finally','getApplications','getInteractions','Contact','fullname','internal','Tag','Tags','color','tag','addAgents','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','out','OpenchannelMessage','Messages','dataValues','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','get','OpenchannelAccounts','UserProfileResource','end','sendStatus','stack','name','send','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','key','query','keys','filters','intersection','attributes','fields','model','hasOwnProperty'];(function(_0x33ebf5,_0x258ec6){var _0x66957b=function(_0x49739a){while(--_0x49739a){_0x33ebf5['push'](_0x33ebf5['shift']());}};_0x66957b(++_0x258ec6);}(_0x853e,0x1ea));var _0xe853=function(_0x313ae4,_0x588a94){_0x313ae4=_0x313ae4-0x0;var _0x1e42af=_0x853e[_0x313ae4];return _0x1e42af;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe853('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe853('0x1'));var rp=require('request-promise');var moment=require(_0xe853('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xe853('0x3'));var util=require(_0xe853('0x4'));var path=require(_0xe853('0x5'));var sox=require(_0xe853('0x6'));var csv=require(_0xe853('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe853('0x8'));var _=require(_0xe853('0x9'));var squel=require(_0xe853('0xa'));var crypto=require(_0xe853('0xb'));var jsforce=require(_0xe853('0xc'));var deskjs=require(_0xe853('0xd'));var toCsv=require(_0xe853('0x7'));var querystring=require(_0xe853('0xe'));var Papa=require(_0xe853('0xf'));var Redis=require(_0xe853('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe853('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xe853('0x12'));var config=require(_0xe853('0x13'));var licenseUtil=require(_0xe853('0x14'));var db=require('../../mysqldb')['db'];config[_0xe853('0x15')]=_[_0xe853('0x16')](config[_0xe853('0x15')],{'host':_0xe853('0x17'),'port':0x18eb});var socket=require(_0xe853('0x18'))(new Redis(config[_0xe853('0x15')]));require(_0xe853('0x19'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xe853('0x1a')][_0xe853('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x41c489,_0x11e4a0,_0x21c5f0,_0x9309a5){return new BPromise(function(_0x335ca3,_0x111f2e){var _0x2a98fa=_0x9309a5||client;return _0x2a98fa[_0xe853('0x1c')](_0x41c489,_0x21c5f0)[_0xe853('0x1d')](function(_0x1d2526){logger[_0xe853('0x1e')](_0xe853('0x1f'),_0x11e4a0,_0xe853('0x20'));logger[_0xe853('0x21')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x11e4a0,_0xe853('0x20'),JSON[_0xe853('0x22')](_0x1d2526));if(_0x1d2526[_0xe853('0x23')]){if(_0x1d2526[_0xe853('0x23')][_0xe853('0x24')]===0x1f4){logger[_0xe853('0x23')](_0xe853('0x1f'),_0x11e4a0,_0x1d2526[_0xe853('0x23')][_0xe853('0x25')]);return _0x111f2e(_0x1d2526[_0xe853('0x23')][_0xe853('0x25')]);}logger['error'](_0xe853('0x1f'),_0x11e4a0,_0x1d2526[_0xe853('0x23')][_0xe853('0x25')]);return _0x335ca3(_0x1d2526[_0xe853('0x23')][_0xe853('0x25')]);}else{logger[_0xe853('0x1e')](_0xe853('0x1f'),_0x11e4a0,_0xe853('0x20'));_0x335ca3(_0x1d2526['result'][_0xe853('0x25')]);}})[_0xe853('0x26')](function(_0x198895){logger[_0xe853('0x23')](_0xe853('0x1f'),_0x11e4a0,_0x198895);_0x111f2e(_0x198895);});});}function respondWithStatusCode(_0x58454e,_0x1fdaaf){_0x1fdaaf=_0x1fdaaf||0xcc;return function(_0x33e0b0){if(_0x33e0b0){return _0x58454e['sendStatus'](_0x1fdaaf);}return _0x58454e[_0xe853('0x27')](_0x1fdaaf)['end']();};}function respondWithResult(_0x5c8852,_0x545738){_0x545738=_0x545738||0xc8;return function(_0x586fa0){if(_0x586fa0){return _0x5c8852[_0xe853('0x27')](_0x545738)[_0xe853('0x28')](_0x586fa0);}};}function respondWithFilteredResult(_0x438b5b,_0x5d268f){return function(_0x397301){if(_0x397301){var _0x1e99c8=typeof _0x5d268f[_0xe853('0x29')]===_0xe853('0x2a')&&typeof _0x5d268f[_0xe853('0x2b')]===_0xe853('0x2a');var _0x51fc77=_0x397301['count'];var _0x139fa2=_0x1e99c8?0x0:_0x5d268f[_0xe853('0x29')];var _0x47cace=_0x1e99c8?_0x397301[_0xe853('0x2c')]:_0x5d268f['offset']+_0x5d268f[_0xe853('0x2b')];var _0x1bede6;if(_0x47cace>=_0x51fc77){_0x47cace=_0x51fc77;_0x1bede6=0xc8;}else{_0x1bede6=0xce;}_0x438b5b[_0xe853('0x27')](_0x1bede6);return _0x438b5b['set'](_0xe853('0x2d'),_0x139fa2+'-'+_0x47cace+'/'+_0x51fc77)[_0xe853('0x28')](_0x397301);}return null;};}function patchUpdates(_0x21d3e5){return function(_0x44e383){try{jsonpatch[_0xe853('0x2e')](_0x44e383,_0x21d3e5,!![]);}catch(_0x38c960){return BPromise[_0xe853('0x2f')](_0x38c960);}return _0x44e383[_0xe853('0x30')]();};}function saveUpdates(_0x165ac9,_0x290025){return function(_0x11e503){if(_0x11e503){return _0x11e503['update'](_0x165ac9)[_0xe853('0x1d')](function(_0x56c49b){return _0x56c49b;});}return null;};}function removeEntity(_0x342528,_0x43e7f7){return function(_0x22d5ec){if(_0x22d5ec){return _0x22d5ec[_0xe853('0x31')]()['then'](function(){var _0x37c67c=_0x22d5ec[_0xe853('0x32')]({'plain':!![]});var _0x2287c8=_0xe853('0x33');return db[_0xe853('0x34')][_0xe853('0x31')]({'where':{'type':_0x2287c8,'resourceId':_0x37c67c['id']}})['then'](function(){return _0x22d5ec;});})[_0xe853('0x1d')](function(){_0x342528[_0xe853('0x27')](0xcc)[_0xe853('0x35')]();});}};}function handleEntityNotFound(_0x69dba5,_0xc8b547){return function(_0x2dbf3b){if(!_0x2dbf3b){_0x69dba5[_0xe853('0x36')](0x194);}return _0x2dbf3b;};}function handleError(_0x1ef84e,_0xaf7166){_0xaf7166=_0xaf7166||0x1f4;return function(_0x5d9735){logger['error'](_0x5d9735[_0xe853('0x37')]);if(_0x5d9735[_0xe853('0x38')]){delete _0x5d9735[_0xe853('0x38')];}_0x1ef84e['status'](_0xaf7166)[_0xe853('0x39')](_0x5d9735);};}exports['index']=function(_0x52bbaa,_0x4af4fc){var _0x29ed45={'include':[{'model':db['Pause'],'as':_0xe853('0x3a')}]},_0x5b1fe4={},_0x3ae0cb={'count':0x0,'rows':[]};var _0x1c0696=_[_0xe853('0x3b')](db[_0xe853('0x3c')][_0xe853('0x3d')],function(_0x9fca20){return{'name':_0x9fca20['fieldName'],'type':_0x9fca20['type'][_0xe853('0x3e')]};});_0x5b1fe4['model']=_[_0xe853('0x3b')](_0x1c0696,_0xe853('0x38'));_0x5b1fe4[_0xe853('0x3f')]=_[_0xe853('0x40')](_0x52bbaa[_0xe853('0x3f')]);_0x5b1fe4[_0xe853('0x41')]=_[_0xe853('0x42')](_0x5b1fe4['model'],_0x5b1fe4[_0xe853('0x3f')]);_0x29ed45[_0xe853('0x43')]=_[_0xe853('0x42')](_0x5b1fe4['model'],qs[_0xe853('0x44')](_0x52bbaa[_0xe853('0x3f')]['fields']));_0x29ed45[_0xe853('0x43')]=_0x29ed45[_0xe853('0x43')]['length']?_0x29ed45[_0xe853('0x43')]:_0x5b1fe4[_0xe853('0x45')];if(!_0x52bbaa[_0xe853('0x3f')][_0xe853('0x46')]('nolimit')){_0x29ed45[_0xe853('0x2b')]=qs['limit'](_0x52bbaa[_0xe853('0x3f')][_0xe853('0x2b')]);_0x29ed45[_0xe853('0x29')]=qs['offset'](_0x52bbaa[_0xe853('0x3f')][_0xe853('0x29')]);}_0x29ed45['order']=qs[_0xe853('0x47')](_0x52bbaa['query'][_0xe853('0x47')]);_0x29ed45[_0xe853('0x48')]=qs[_0xe853('0x41')](_[_0xe853('0x49')](_0x52bbaa['query'],_0x5b1fe4['filters']),_0x1c0696);if(_0x52bbaa[_0xe853('0x3f')][_0xe853('0x4a')]){_0x29ed45['where']=_[_0xe853('0x4b')](_0x29ed45[_0xe853('0x48')],{'$or':_['map'](_0x1c0696,function(_0x5e8329){if(_0x5e8329[_0xe853('0x4c')]!==_0xe853('0x4d')){var _0x27c306={};_0x27c306[_0x5e8329[_0xe853('0x38')]]={'$like':'%'+_0x52bbaa[_0xe853('0x3f')][_0xe853('0x4a')]+'%'};return _0x27c306;}})});}_0x29ed45=_[_0xe853('0x4b')]({},_0x29ed45,_0x52bbaa[_0xe853('0x4e')]);var _0x1f07f6={'where':_0x29ed45[_0xe853('0x48')]};return db['OpenchannelAccount']['count'](_0x1f07f6)[_0xe853('0x1d')](function(_0x2986a7){_0x3ae0cb['count']=_0x2986a7;if(_0x52bbaa[_0xe853('0x3f')][_0xe853('0x4f')]){_0x29ed45['include']=[{'all':!![]}];}return db[_0xe853('0x3c')][_0xe853('0x50')](_0x29ed45);})[_0xe853('0x1d')](function(_0x5eeb43){_0x3ae0cb[_0xe853('0x51')]=_0x5eeb43;return _0x3ae0cb;})[_0xe853('0x1d')](respondWithFilteredResult(_0x4af4fc,_0x29ed45))['catch'](handleError(_0x4af4fc,null));};exports[_0xe853('0x52')]=function(_0x18d215,_0x38ca06){var _0xd0de05={'raw':![],'where':{'id':_0x18d215[_0xe853('0x53')]['id']},'include':[{'model':db[_0xe853('0x54')],'as':_0xe853('0x3a')}]},_0x428c83={};_0x428c83['model']=_[_0xe853('0x40')](db[_0xe853('0x3c')][_0xe853('0x3d')]);_0x428c83[_0xe853('0x3f')]=_[_0xe853('0x40')](_0x18d215[_0xe853('0x3f')]);_0x428c83[_0xe853('0x41')]=_[_0xe853('0x42')](_0x428c83[_0xe853('0x45')],_0x428c83[_0xe853('0x3f')]);_0xd0de05[_0xe853('0x43')]=_[_0xe853('0x42')](_0x428c83[_0xe853('0x45')],qs[_0xe853('0x44')](_0x18d215[_0xe853('0x3f')][_0xe853('0x44')]));_0xd0de05['attributes']=_0xd0de05[_0xe853('0x43')]['length']?_0xd0de05[_0xe853('0x43')]:_0x428c83[_0xe853('0x45')];if(_0x18d215[_0xe853('0x3f')]['includeAll']){_0xd0de05[_0xe853('0x55')]=[{'all':!![]}];}_0xd0de05=_[_0xe853('0x4b')]({},_0xd0de05,_0x18d215['options']);return db['OpenchannelAccount'][_0xe853('0x56')](_0xd0de05)[_0xe853('0x1d')](handleEntityNotFound(_0x38ca06,null))['then'](respondWithResult(_0x38ca06,null))[_0xe853('0x26')](handleError(_0x38ca06,null));};exports[_0xe853('0x57')]=function(_0x3327fa,_0x256dec){return db[_0xe853('0x3c')][_0xe853('0x57')](_0x3327fa[_0xe853('0x58')],{})['then'](function(_0x8188fb){var _0x1a88f4=_0x3327fa[_0xe853('0x59')][_0xe853('0x32')]({'plain':!![]});if(!_0x1a88f4)throw new Error(_0xe853('0x5a'));if(_0x1a88f4['role']==='user'){var _0x33d6b7=_0x8188fb[_0xe853('0x32')]({'plain':!![]});var _0x1d3940=_0xe853('0x33');return db[_0xe853('0x5b')][_0xe853('0x56')]({'where':{'name':_0x1d3940,'userProfileId':_0x1a88f4['userProfileId']},'raw':!![]})[_0xe853('0x1d')](function(_0x54b058){if(_0x54b058&&_0x54b058[_0xe853('0x5c')]===0x0){return db[_0xe853('0x34')]['create']({'name':_0x33d6b7[_0xe853('0x38')],'resourceId':_0x33d6b7['id'],'type':_0x54b058[_0xe853('0x38')],'sectionId':_0x54b058['id']},{})['then'](function(){return _0x8188fb;});}else{return _0x8188fb;}})[_0xe853('0x26')](function(_0x2dd6ed){logger[_0xe853('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2dd6ed);throw _0x2dd6ed;});}return _0x8188fb;})['then'](respondWithResult(_0x256dec,0xc9))['catch'](handleError(_0x256dec,null));};exports[_0xe853('0x5d')]=function(_0x688f6d,_0x182980){if(_0x688f6d[_0xe853('0x58')]['id']){delete _0x688f6d[_0xe853('0x58')]['id'];}return db[_0xe853('0x3c')][_0xe853('0x56')]({'where':{'id':_0x688f6d[_0xe853('0x53')]['id']},'include':[{'model':db[_0xe853('0x54')],'as':_0xe853('0x3a')}]})['then'](handleEntityNotFound(_0x182980,null))[_0xe853('0x1d')](saveUpdates(_0x688f6d[_0xe853('0x58')],null))[_0xe853('0x1d')](respondWithResult(_0x182980,null))['catch'](handleError(_0x182980,null));};exports[_0xe853('0x31')]=function(_0x3416ae,_0x45c966){return db[_0xe853('0x3c')][_0xe853('0x56')]({'where':{'id':_0x3416ae[_0xe853('0x53')]['id']}})[_0xe853('0x1d')](handleEntityNotFound(_0x45c966,null))['then'](removeEntity(_0x45c966,null))['catch'](handleError(_0x45c966,null));};exports[_0xe853('0x5e')]=function(_0x416b33,_0x3ecf96){return db[_0xe853('0x3c')][_0xe853('0x5e')]()[_0xe853('0x1d')](respondWithResult(_0x3ecf96,null))[_0xe853('0x26')](handleError(_0x3ecf96,null));};exports[_0xe853('0x5f')]=function(_0x4f914d,_0x7e9300,_0x316cf1){if(_0x4f914d['body']['id']){delete _0x4f914d[_0xe853('0x58')]['id'];}return db['OpenchannelAccount'][_0xe853('0x56')]({'where':{'id':_0x4f914d['params']['id']}})['then'](handleEntityNotFound(_0x7e9300,null))[_0xe853('0x1d')](function(_0x4d72b7){if(_0x4d72b7){_0x4f914d[_0xe853('0x58')]['OpenchannelAccountId']=_0x4d72b7['id'];return db['Disposition'][_0xe853('0x57')](_0x4f914d[_0xe853('0x58')]);}})[_0xe853('0x1d')](respondWithResult(_0x7e9300,null))[_0xe853('0x26')](handleError(_0x7e9300,null));};exports['getDispositions']=function(_0x53b8e0,_0x238d54,_0x4dd074){var _0xbb7073={'raw':![],'where':{}};var _0x4c85c0={};var _0x462ded={'count':0x0,'rows':[]};return db[_0xe853('0x3c')][_0xe853('0x60')]({'where':{'id':_0x53b8e0[_0xe853('0x53')]['id']}})[_0xe853('0x1d')](handleEntityNotFound(_0x238d54,null))['then'](function(_0x229966){if(_0x229966){_0x4c85c0[_0xe853('0x45')]=_[_0xe853('0x40')](db[_0xe853('0x61')][_0xe853('0x3d')]);_0x4c85c0['query']=_[_0xe853('0x40')](_0x53b8e0[_0xe853('0x3f')]);_0x4c85c0['filters']=_[_0xe853('0x42')](_0x4c85c0[_0xe853('0x45')],_0x4c85c0[_0xe853('0x3f')]);_0xbb7073[_0xe853('0x43')]=_[_0xe853('0x42')](_0x4c85c0[_0xe853('0x45')],qs['fields'](_0x53b8e0[_0xe853('0x3f')][_0xe853('0x44')]));_0xbb7073[_0xe853('0x43')]=_0xbb7073[_0xe853('0x43')]['length']?_0xbb7073[_0xe853('0x43')]:_0x4c85c0[_0xe853('0x45')];if(!_0x53b8e0['query'][_0xe853('0x46')]('nolimit')){_0xbb7073[_0xe853('0x2b')]=qs[_0xe853('0x2b')](_0x53b8e0[_0xe853('0x3f')]['limit']);_0xbb7073[_0xe853('0x29')]=qs[_0xe853('0x29')](_0x53b8e0[_0xe853('0x3f')]['offset']);}_0xbb7073[_0xe853('0x62')]=qs[_0xe853('0x47')](_0x53b8e0[_0xe853('0x3f')][_0xe853('0x47')]);_0xbb7073[_0xe853('0x48')]=qs[_0xe853('0x41')](_[_0xe853('0x49')](_0x53b8e0['query'],_0x4c85c0[_0xe853('0x41')]));_0xbb7073[_0xe853('0x48')]['OpenchannelAccountId']=_0x229966['id'];if(_0x53b8e0['query'][_0xe853('0x4a')]){_0xbb7073[_0xe853('0x48')]=_[_0xe853('0x4b')](_0xbb7073[_0xe853('0x48')],{'$or':_[_0xe853('0x3b')](_0xbb7073['attributes'],function(_0xa57b05){var _0x13fb51={};_0x13fb51[_0xa57b05]={'$like':'%'+_0x53b8e0[_0xe853('0x3f')]['filter']+'%'};return _0x13fb51;})});}_0xbb7073=_['merge']({},_0xbb7073,_0x53b8e0['options']);return db[_0xe853('0x61')]['count']({'where':_0xbb7073[_0xe853('0x48')]})[_0xe853('0x1d')](function(_0x4c207d){_0x462ded[_0xe853('0x2c')]=_0x4c207d;if(_0x53b8e0['query'][_0xe853('0x4f')]){_0xbb7073[_0xe853('0x55')]=[{'all':!![]}];}return db[_0xe853('0x61')]['findAll'](_0xbb7073);})[_0xe853('0x1d')](function(_0x26a240){_0x462ded[_0xe853('0x51')]=_0x26a240;return _0x462ded;});}})[_0xe853('0x1d')](respondWithFilteredResult(_0x238d54,_0xbb7073))[_0xe853('0x26')](handleError(_0x238d54,null));};exports['removeDispositions']=function(_0x3f18c4,_0x310f8b,_0x36c41f){return db[_0xe853('0x3c')][_0xe853('0x56')]({'where':{'id':_0x3f18c4[_0xe853('0x53')]['id']}})[_0xe853('0x1d')](handleEntityNotFound(_0x310f8b,null))['then'](function(_0x270595){if(_0x270595){return _0x270595[_0xe853('0x63')](_0x3f18c4[_0xe853('0x3f')][_0xe853('0x64')]);}})[_0xe853('0x1d')](respondWithStatusCode(_0x310f8b,null))['catch'](handleError(_0x310f8b,null));};exports['addAnswer']=function(_0x8f9ea0,_0x32e18b,_0x41333d){if(_0x8f9ea0[_0xe853('0x58')]['id']){delete _0x8f9ea0[_0xe853('0x58')]['id'];}return db[_0xe853('0x3c')][_0xe853('0x56')]({'where':{'id':_0x8f9ea0[_0xe853('0x53')]['id']}})[_0xe853('0x1d')](handleEntityNotFound(_0x32e18b,null))[_0xe853('0x1d')](function(_0x265780){if(_0x265780){_0x8f9ea0[_0xe853('0x58')]['OpenchannelAccountId']=_0x265780['id'];return db[_0xe853('0x65')][_0xe853('0x57')](_0x8f9ea0['body']);}})[_0xe853('0x1d')](respondWithResult(_0x32e18b,null))[_0xe853('0x26')](handleError(_0x32e18b,null));};exports[_0xe853('0x66')]=function(_0x3c12db,_0x41410e,_0x31cbb3){var _0x367ed9={'raw':![],'where':{}};var _0x1a1e33={};var _0x965060={'count':0x0,'rows':[]};return db[_0xe853('0x3c')][_0xe853('0x60')]({'where':{'id':_0x3c12db['params']['id']}})[_0xe853('0x1d')](handleEntityNotFound(_0x41410e,null))[_0xe853('0x1d')](function(_0x5be42c){if(_0x5be42c){_0x1a1e33[_0xe853('0x45')]=_['keys'](db[_0xe853('0x65')]['rawAttributes']);_0x1a1e33[_0xe853('0x3f')]=_['keys'](_0x3c12db[_0xe853('0x3f')]);_0x1a1e33[_0xe853('0x41')]=_['intersection'](_0x1a1e33[_0xe853('0x45')],_0x1a1e33[_0xe853('0x3f')]);_0x367ed9[_0xe853('0x43')]=_['intersection'](_0x1a1e33[_0xe853('0x45')],qs[_0xe853('0x44')](_0x3c12db['query']['fields']));_0x367ed9[_0xe853('0x43')]=_0x367ed9[_0xe853('0x43')][_0xe853('0x67')]?_0x367ed9[_0xe853('0x43')]:_0x1a1e33[_0xe853('0x45')];if(!_0x3c12db[_0xe853('0x3f')][_0xe853('0x46')](_0xe853('0x68'))){_0x367ed9[_0xe853('0x2b')]=qs[_0xe853('0x2b')](_0x3c12db[_0xe853('0x3f')][_0xe853('0x2b')]);_0x367ed9['offset']=qs['offset'](_0x3c12db['query'][_0xe853('0x29')]);}_0x367ed9[_0xe853('0x62')]=qs['sort'](_0x3c12db[_0xe853('0x3f')][_0xe853('0x47')]);_0x367ed9[_0xe853('0x48')]=qs[_0xe853('0x41')](_[_0xe853('0x49')](_0x3c12db[_0xe853('0x3f')],_0x1a1e33[_0xe853('0x41')]));_0x367ed9[_0xe853('0x48')][_0xe853('0x69')]=_0x5be42c['id'];if(_0x3c12db[_0xe853('0x3f')][_0xe853('0x4a')]){_0x367ed9['where']=_[_0xe853('0x4b')](_0x367ed9[_0xe853('0x48')],{'$or':_[_0xe853('0x3b')](_0x367ed9[_0xe853('0x43')],function(_0x3060ee){var _0x3f8bc0={};_0x3f8bc0[_0x3060ee]={'$like':'%'+_0x3c12db[_0xe853('0x3f')][_0xe853('0x4a')]+'%'};return _0x3f8bc0;})});}_0x367ed9=_[_0xe853('0x4b')]({},_0x367ed9,_0x3c12db[_0xe853('0x4e')]);return db['CannedAnswer'][_0xe853('0x2c')]({'where':_0x367ed9[_0xe853('0x48')]})[_0xe853('0x1d')](function(_0x328b60){_0x965060['count']=_0x328b60;if(_0x3c12db[_0xe853('0x3f')][_0xe853('0x4f')]){_0x367ed9['include']=[{'all':!![]}];}return db[_0xe853('0x65')][_0xe853('0x50')](_0x367ed9);})[_0xe853('0x1d')](function(_0x4c2554){_0x965060[_0xe853('0x51')]=_0x4c2554;return _0x965060;});}})[_0xe853('0x1d')](respondWithFilteredResult(_0x41410e,_0x367ed9))[_0xe853('0x26')](handleError(_0x41410e,null));};exports[_0xe853('0x6a')]=function(_0x269ef2,_0x3e7c96,_0x14e989){return db['OpenchannelAccount'][_0xe853('0x56')]({'where':{'id':_0x269ef2['params']['id']}})[_0xe853('0x1d')](handleEntityNotFound(_0x3e7c96,null))[_0xe853('0x1d')](function(_0x55433e){if(_0x55433e){return _0x55433e[_0xe853('0x6a')](_0x269ef2['query'][_0xe853('0x64')]);}})[_0xe853('0x1d')](respondWithStatusCode(_0x3e7c96,null))['catch'](handleError(_0x3e7c96,null));};exports[_0xe853('0x6b')]=function(_0x1532b1,_0x12646d,_0x2459f6){var _0x1374a8={'body':_0x1532b1['body'],'channel':_0xe853('0x6c')};var _0x5d3e00=[];var _0x24b9eb=[];var _0x19e4f4={};var _0x4ea957=![];return db[_0xe853('0x6d')][_0xe853('0x5e')]()[_0xe853('0x1d')](function(_0x445155){if(!_0x445155){throw new db[(_0xe853('0x6e'))][(_0xe853('0x6f'))]('no\x20available\x20attributes');}_0x5d3e00=_['difference'](_[_0xe853('0x40')](_0x445155),['createdAt','updatedAt']);_0x24b9eb=_['difference'](_[_0xe853('0x40')](_0x445155),['createdAt',_0xe853('0x70'),_0xe853('0x71'),_0xe853('0x72')]);if(_0x1532b1[_0xe853('0x58')]['id']){delete _0x1532b1[_0xe853('0x58')]['id'];}if(_['isNil'](_0x1532b1[_0xe853('0x58')]['from'])){throw new db['Sequelize']['ValidationError'](_0xe853('0x73'));}if(_[_0xe853('0x74')](_0x1532b1[_0xe853('0x58')]['body'])||_0x1532b1[_0xe853('0x58')][_0xe853('0x58')]===''){throw new db[(_0xe853('0x6e'))][(_0xe853('0x6f'))](_0xe853('0x75'));}if(_[_0xe853('0x74')](_0x1532b1[_0xe853('0x58')]['mapKey'])){throw new db[(_0xe853('0x6e'))]['ValidationError'](_0xe853('0x76')+_0x24b9eb);}if(!_[_0xe853('0x77')](_0x24b9eb,_0x1532b1[_0xe853('0x58')][_0xe853('0x78')])){throw new db[(_0xe853('0x6e'))]['ValidationError'](_0xe853('0x79')+_0x24b9eb);}_0x19e4f4[_0x1532b1[_0xe853('0x58')][_0xe853('0x78')]]=_0x1532b1[_0xe853('0x58')]['from'];})[_0xe853('0x1d')](function(){return db[_0xe853('0x3c')]['find']({'where':{'id':_0x1532b1[_0xe853('0x53')]['id']},'include':[{'model':db[_0xe853('0x7a')],'as':_0xe853('0x7b'),'include':[{'model':db[_0xe853('0x6d')],'as':_0xe853('0x7c'),'where':_0x19e4f4,'limit':0x1,'order':[['updatedAt',_0xe853('0x7d')]]}]},{'model':db[_0xe853('0x7e')],'as':_0xe853('0x7f')}]});})[_0xe853('0x1d')](handleEntityNotFound(_0x12646d,null))[_0xe853('0x1d')](function(_0x2d87c6){if(_0x2d87c6&&_0x2d87c6[_0xe853('0x7b')]){_0x1374a8[_0xe853('0x80')]=_0x2d87c6;_0x1374a8[_0xe853('0x81')]=_0x2d87c6['Applications'];_0x1374a8[_0xe853('0x82')]=_0x2d87c6[_0xe853('0x7b')];_0x1374a8[_0xe853('0x81')]=_[_0xe853('0x83')](_0x1374a8['applications'],[_0xe853('0x84')],[_0xe853('0x85')]);if(_0x1374a8[_0xe853('0x80')]['Applications']){delete _0x1374a8[_0xe853('0x80')]['Applications'];}if(_0x1374a8[_0xe853('0x80')][_0xe853('0x7b')]&&_0x1374a8['account'][_0xe853('0x7b')][_0xe853('0x7c')]['length']){return _0x1374a8[_0xe853('0x80')][_0xe853('0x7b')]['Contacts'][0x0];}var _0x364a93=_[_0xe853('0x16')](_0x1532b1[_0xe853('0x58')],{'firstName':_0x1532b1[_0xe853('0x58')][_0xe853('0x86')],'ListId':_0x2d87c6[_0xe853('0x72')]});_0x364a93[_0x1532b1[_0xe853('0x58')]['mapKey']]=_0x1532b1['body'][_0xe853('0x86')];return db['CmContact'][_0xe853('0x57')](_0x364a93,{'fields':_0x5d3e00,'raw':!![]});}})[_0xe853('0x1d')](handleEntityNotFound(_0x12646d,null))[_0xe853('0x1d')](function(_0x27ae88){_0x1374a8[_0xe853('0x87')]=_0x27ae88;if(_0x27ae88){var _0x1ca7ad={'ContactId':_0x27ae88['id'],'OpenchannelAccountId':_0x1532b1[_0xe853('0x53')]['id'],'from':(_0x27ae88['firstName']||'')+'\x20'+(_0x27ae88['lastName']||'')};var _0x27a677={'OpenchannelAccountId':_0x1532b1['params']['id'],'closed':![]};if(_0x1532b1[_0xe853('0x58')][_0xe853('0x88')]){_0x27a677[_0xe853('0x88')]=_0x1532b1[_0xe853('0x58')][_0xe853('0x88')];return db[_0xe853('0x89')][_0xe853('0x56')]({'where':_0x27a677})['then'](function(_0x30c98d){if(_0x30c98d){return[_0x30c98d,![]];}_0x1ca7ad['threadId']=_0x1532b1['body'][_0xe853('0x88')];_0x1ca7ad[_0xe853('0x8a')]=_0x1532b1['body']['externalUrl'];return db[_0xe853('0x89')][_0xe853('0x57')](_0x1ca7ad)['then'](function(_0x52a3fb){return[_0x52a3fb,!![]];});});}else{_0x27a677[_0xe853('0x88')]=null;}_0x27a677['ContactId']=_0x27ae88['id'];return db['OpenchannelInteraction']['find']({'where':_0x27a677})[_0xe853('0x1d')](function(_0x3da748){if(_0x3da748){return[_0x3da748,![]];}return db[_0xe853('0x89')][_0xe853('0x57')](_0x1ca7ad)[_0xe853('0x1d')](function(_0x2ae935){return[_0x2ae935,!![]];});});}})[_0xe853('0x8b')](function(_0x34e2d6,_0x2da6de){if(_0x34e2d6){_0x4ea957=_0x2da6de;if(!_0x2da6de){var _0x4c4a04={'from':(_0x1374a8[_0xe853('0x87')]['firstName']||'')+'\x20'+(_0x1374a8['contact'][_0xe853('0x8c')]||'')};if(_0x1532b1[_0xe853('0x58')][_0xe853('0x88')]&&_0x1532b1[_0xe853('0x58')]['messageId']&&_0x1532b1[_0xe853('0x58')][_0xe853('0x88')]!=_0x1532b1[_0xe853('0x58')]['messageId']){_0x4c4a04[_0xe853('0x88')]=_0x1532b1[_0xe853('0x58')][_0xe853('0x8d')];}return _0x34e2d6[_0xe853('0x5d')](_0x4c4a04);}else{return _0x34e2d6;}}})[_0xe853('0x1d')](function(_0x51f06e){_0x1374a8[_0xe853('0x8e')]=_0x51f06e[_0xe853('0x32')]({'plain':!![]});_0x1374a8['interaction'][_0xe853('0x8f')]=_0x4ea957;if(_0x1374a8[_0xe853('0x8e')][_0xe853('0x8f')]){if(_0x1374a8['account'][_0xe853('0x90')]){_0x1374a8[_0xe853('0x81')][_0xe853('0x91')]({'id':0x0,'priority':_0x1374a8[_0xe853('0x81')][_0xe853('0x67')]+0x1,'app':_0xe853('0x92'),'appdata':_0xe853('0x93'),'interval':_0xe853('0x94')});}}return db['OpenchannelMessage'][_0xe853('0x57')]({'body':_0x1532b1[_0xe853('0x58')][_0xe853('0x58')],'OpenchannelAccountId':_0x1532b1[_0xe853('0x53')]['id'],'OpenchannelInteractionId':_0x51f06e['id'],'direction':'in','ContactId':_0x1374a8['contact']['id'],'AttachmentId':_0x1532b1[_0xe853('0x58')][_0xe853('0x95')]});})[_0xe853('0x1d')](function(_0x3f46f8){_0x1374a8[_0xe853('0x25')]=_0x3f46f8;if(!_0x1374a8[_0xe853('0x8e')][_0xe853('0x96')])return;return db[_0xe853('0x97')][_0xe853('0x56')]({'attributes':['id',_0xe853('0x38')],'where':{'id':_0x1374a8[_0xe853('0x8e')][_0xe853('0x96')]}});})[_0xe853('0x1d')](function(_0x322ff1){if(_0x322ff1){_0x1374a8[_0xe853('0x81')][_0xe853('0x98')]({'id':0x0,'priority':0x0,'app':_0xe853('0x99'),'appdata':_0x322ff1[_0xe853('0x38')]+','+(_0x1374a8[_0xe853('0x80')][_0xe853('0x9a')]||0xa),'interval':_0xe853('0x94')});}if(!_0x1374a8[_0xe853('0x8e')]['queueId'])return;return db['OpenchannelQueue'][_0xe853('0x56')]({'attributes':['id','name'],'where':{'id':_0x1374a8[_0xe853('0x8e')][_0xe853('0x9b')]}});})[_0xe853('0x1d')](function(_0x37364f){if(_0x37364f){_0x1374a8[_0xe853('0x81')][_0xe853('0x98')]({'id':0x0,'priority':0x1,'app':_0xe853('0x9c'),'appdata':_0x37364f[_0xe853('0x38')]+','+(_0x1374a8[_0xe853('0x80')][_0xe853('0x9d')]||0x12c),'interval':_0xe853('0x94')});}return respondWithRpcPromise(_0xe853('0x9e'),_0xe853('0x9f'),_0x1374a8);})['then'](function(_0x2b3532){respondWithRpcPromise(_0xe853('0xa0'),'EventManager',{'event':'notify','message':_0x2b3532},client9002);return _0x2b3532;})['then'](respondWithResult(_0x12646d,null))[_0xe853('0x26')](handleError(_0x12646d,null));};exports['addApplications']=function(_0x4b6f02,_0x17329f){var _0x568927=_0x4b6f02[_0xe853('0x53')]['id'];var _0x51b3ae=_0x4b6f02[_0xe853('0x58')];var _0x2b3d41=0xc8;var _0x229c52=null;return db[_0xe853('0xa1')][_0xe853('0xa2')]({'isolationLevel':db['sequelize'][_0xe853('0xa3')][_0xe853('0xa4')][_0xe853('0xa5')]},function(_0x42c93b){return db[_0xe853('0x3c')][_0xe853('0x60')]({'where':{'id':_0x568927},'transaction':_0x42c93b})[_0xe853('0x1d')](function(_0x38133a){if(_0x38133a){return db[_0xe853('0x7e')][_0xe853('0x31')]({'where':{'OpenchannelAccountId':_0x568927},'transaction':_0x42c93b})['then'](function(){var _0x2e57c5=_[_0xe853('0x3b')](_0x51b3ae,function(_0x16b8a1){_0x16b8a1[_0xe853('0x69')]=_0x568927;return _0x16b8a1;});return db[_0xe853('0x7e')]['bulkCreate'](_0x2e57c5,{'transaction':_0x42c93b});});}else{_0x2b3d41=0x194;_0x229c52=[];}});})[_0xe853('0x1d')](function(){if(_0x2b3d41!==0x194){return db['OpenchannelApplication']['findAndCountAll']({'where':{'OpenchannelAccountId':_0x568927},'order':_0xe853('0x84')})['then'](function(_0x25b97b){_0x229c52=_0x25b97b;});}})['catch'](function(_0x2fdae7){_0x2b3d41=0x1f4;logger['error'](_0x2fdae7[_0xe853('0x37')]);if(_0x2fdae7[_0xe853('0x38')]){delete _0x2fdae7[_0xe853('0x38')];}_0x229c52=_0x2fdae7;})[_0xe853('0xa6')](function(){if(_0x229c52===null){_0x17329f[_0xe853('0x36')](_0x2b3d41);}else{if(_0x2b3d41===0x1f4){_0x17329f[_0xe853('0x27')](_0x2b3d41)[_0xe853('0x39')](_0x229c52);}else{_0x17329f[_0xe853('0x27')](_0x2b3d41)[_0xe853('0x28')](_0x229c52);}}});};exports[_0xe853('0xa7')]=function(_0x39ae4d,_0x6533ba,_0x1e9417){var _0x38e348={};var _0x2d1bb6={};var _0x23a130;var _0x38adf6;return db[_0xe853('0x3c')]['findOne']({'where':{'id':_0x39ae4d[_0xe853('0x53')]['id']}})[_0xe853('0x1d')](handleEntityNotFound(_0x6533ba,null))[_0xe853('0x1d')](function(_0x5aa098){if(_0x5aa098){_0x23a130=_0x5aa098;_0x2d1bb6[_0xe853('0x45')]=_['keys'](db[_0xe853('0x7e')][_0xe853('0x3d')]);_0x2d1bb6['query']=_['keys'](_0x39ae4d['query']);_0x2d1bb6[_0xe853('0x41')]=_[_0xe853('0x42')](_0x2d1bb6[_0xe853('0x45')],_0x2d1bb6[_0xe853('0x3f')]);_0x38e348['attributes']=_[_0xe853('0x42')](_0x2d1bb6[_0xe853('0x45')],qs[_0xe853('0x44')](_0x39ae4d[_0xe853('0x3f')][_0xe853('0x44')]));_0x38e348[_0xe853('0x43')]=_0x38e348[_0xe853('0x43')]['length']?_0x38e348[_0xe853('0x43')]:_0x2d1bb6[_0xe853('0x45')];_0x38e348[_0xe853('0x62')]=qs['sort'](_0x39ae4d[_0xe853('0x3f')][_0xe853('0x47')]);_0x38e348[_0xe853('0x48')]=qs[_0xe853('0x41')](_[_0xe853('0x49')](_0x39ae4d['query'],_0x2d1bb6[_0xe853('0x41')]));if(_0x39ae4d[_0xe853('0x3f')][_0xe853('0x4a')]){_0x38e348[_0xe853('0x48')]=_[_0xe853('0x4b')](_0x38e348[_0xe853('0x48')],{'$or':_[_0xe853('0x3b')](_0x38e348[_0xe853('0x43')],function(_0x188bb4){var _0x1f3b91={};_0x1f3b91[_0x188bb4]={'$like':'%'+_0x39ae4d['query'][_0xe853('0x4a')]+'%'};return _0x1f3b91;})});}_0x38e348=_[_0xe853('0x4b')]({},_0x38e348,_0x39ae4d[_0xe853('0x4e')]);return _0x23a130['getApplications'](_0x38e348);}})['then'](function(_0x585ffe){if(_0x585ffe){_0x38adf6=_0x585ffe[_0xe853('0x67')];if(!_0x39ae4d['query'][_0xe853('0x46')](_0xe853('0x68'))){_0x38e348['limit']=qs['limit'](_0x39ae4d['query']['limit']);_0x38e348[_0xe853('0x29')]=qs[_0xe853('0x29')](_0x39ae4d[_0xe853('0x3f')][_0xe853('0x29')]);}return _0x23a130[_0xe853('0xa7')](_0x38e348);}})['then'](function(_0x5653c4){if(_0x5653c4){return _0x5653c4?{'count':_0x38adf6,'rows':_0x5653c4}:null;}})[_0xe853('0x1d')](respondWithResult(_0x6533ba,null))[_0xe853('0x26')](handleError(_0x6533ba,null));};exports[_0xe853('0xa8')]=function(_0x3a928a,_0x1f92ef,_0x5b4d72){var _0x10ab67={'raw':![],'where':{}};var _0x4624b8={};var _0x3317f3={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x3a928a[_0xe853('0x53')]['id']}})[_0xe853('0x1d')](handleEntityNotFound(_0x1f92ef,null))[_0xe853('0x1d')](function(_0xa0ad23){if(_0xa0ad23){_0x4624b8[_0xe853('0x45')]=_[_0xe853('0x40')](db[_0xe853('0x89')]['rawAttributes']);_0x4624b8[_0xe853('0x3f')]=_[_0xe853('0x40')](_0x3a928a['query']);_0x4624b8[_0xe853('0x41')]=_[_0xe853('0x42')](_0x4624b8['model'],_0x4624b8[_0xe853('0x3f')]);_0x10ab67[_0xe853('0x43')]=_[_0xe853('0x42')](_0x4624b8[_0xe853('0x45')],qs[_0xe853('0x44')](_0x3a928a[_0xe853('0x3f')][_0xe853('0x44')]));_0x10ab67[_0xe853('0x43')]=_0x10ab67['attributes'][_0xe853('0x67')]?_0x10ab67['attributes']:_0x4624b8[_0xe853('0x45')];if(!_0x3a928a[_0xe853('0x3f')][_0xe853('0x46')](_0xe853('0x68'))){_0x10ab67[_0xe853('0x2b')]=qs['limit'](_0x3a928a[_0xe853('0x3f')][_0xe853('0x2b')]);_0x10ab67[_0xe853('0x29')]=qs[_0xe853('0x29')](_0x3a928a[_0xe853('0x3f')][_0xe853('0x29')]);}_0x10ab67[_0xe853('0x62')]=qs[_0xe853('0x47')](_0x3a928a[_0xe853('0x3f')][_0xe853('0x47')]);_0x10ab67[_0xe853('0x48')]=qs[_0xe853('0x41')](_[_0xe853('0x49')](_0x3a928a['query'],_0x4624b8[_0xe853('0x41')]));_0x10ab67[_0xe853('0x48')][_0xe853('0x69')]=_0xa0ad23['id'];if(_0x3a928a['query']['filter']){_0x10ab67[_0xe853('0x48')]=_[_0xe853('0x4b')](_0x10ab67[_0xe853('0x48')],{'$or':_[_0xe853('0x3b')](_0x10ab67[_0xe853('0x43')],function(_0x567569){var _0x1374b7={};_0x1374b7[_0x567569]={'$like':'%'+_0x3a928a[_0xe853('0x3f')][_0xe853('0x4a')]+'%'};return _0x1374b7;})});}_0x10ab67=_['merge']({},_0x10ab67,_0x3a928a[_0xe853('0x4e')]);return db['OpenchannelInteraction'][_0xe853('0x2c')]({'where':_0x10ab67[_0xe853('0x48')]})[_0xe853('0x1d')](function(_0x1b562f){_0x3317f3[_0xe853('0x2c')]=_0x1b562f;if(_0x3a928a[_0xe853('0x3f')][_0xe853('0x4f')]){_0x10ab67[_0xe853('0x55')]=[{'model':db[_0xe853('0x6d')],'as':_0xe853('0xa9'),'required':![]},{'model':db[_0xe853('0x97')],'as':'Owner','attributes':[_0xe853('0x38'),_0xe853('0xaa'),_0xe853('0xab')],'required':![]},{'model':db[_0xe853('0xac')],'as':_0xe853('0xad'),'attributes':['id',_0xe853('0x38'),_0xe853('0xae')],'where':_0x3a928a['query'][_0xe853('0xaf')]?{'id':_0x3a928a['query']['tag']}:undefined,'required':_0x3a928a[_0xe853('0x3f')][_0xe853('0xaf')]?!![]:![]}];}return db['OpenchannelInteraction'][_0xe853('0x50')](_0x10ab67);})[_0xe853('0x1d')](function(_0x2caf0d){_0x3317f3[_0xe853('0x51')]=_0x2caf0d;return _0x3317f3;});}})[_0xe853('0x1d')](respondWithFilteredResult(_0x1f92ef,_0x10ab67))['catch'](handleError(_0x1f92ef,null));};exports[_0xe853('0xb0')]=function(_0x27c1aa,_0x536867,_0x40a9fe){return db[_0xe853('0x3c')][_0xe853('0x56')]({'where':{'id':_0x27c1aa[_0xe853('0x53')]['id']}})[_0xe853('0x1d')](handleEntityNotFound(_0x536867,null))[_0xe853('0x1d')](function(_0x680a0a){if(_0x680a0a){return _0x680a0a['addAgents'](_0x27c1aa[_0xe853('0x58')][_0xe853('0x64')],_['omit'](_0x27c1aa[_0xe853('0x58')],[_0xe853('0x64'),'id'])||{})[_0xe853('0x8b')](function(_0x38c7f6){for(var _0x1dc090=0x0;_0x1dc090<_0x27c1aa[_0xe853('0x58')][_0xe853('0x64')][_0xe853('0x67')];_0x1dc090+=0x1){socket['emit'](_0xe853('0xb1'),{'UserId':Number(_0x27c1aa['body'][_0xe853('0x64')][_0x1dc090]),'OpenchannelAccountId':Number(_0x27c1aa[_0xe853('0x53')]['id'])});}return _0x38c7f6;});}})[_0xe853('0x1d')](respondWithResult(_0x536867,null))[_0xe853('0x26')](handleError(_0x536867,null));};exports['removeAgents']=function(_0x44221f,_0x260a11,_0x4b85d7){return db[_0xe853('0x3c')]['find']({'where':{'id':_0x44221f['params']['id']}})[_0xe853('0x1d')](handleEntityNotFound(_0x260a11,null))['then'](function(_0x67ba7b){if(_0x67ba7b){return _0x67ba7b[_0xe853('0xb2')](_0x44221f['query'][_0xe853('0x64')])[_0xe853('0x1d')](function(){if(_[_0xe853('0xb3')](_0x44221f[_0xe853('0x3f')][_0xe853('0x64')])){for(var _0x264407=0x0;_0x264407<_0x44221f[_0xe853('0x3f')][_0xe853('0x64')][_0xe853('0x67')];_0x264407+=0x1){socket[_0xe853('0xb4')](_0xe853('0xb5'),{'UserId':Number(_0x44221f[_0xe853('0x3f')]['ids'][_0x264407]),'OpenchannelAccountId':Number(_0x44221f[_0xe853('0x53')]['id'])});}}else{socket[_0xe853('0xb4')](_0xe853('0xb5'),{'UserId':Number(_0x44221f[_0xe853('0x3f')][_0xe853('0x64')]),'OpenchannelAccountId':Number(_0x44221f[_0xe853('0x53')]['id'])});}});}})['then'](respondWithStatusCode(_0x260a11,null))[_0xe853('0x26')](handleError(_0x260a11,null));};exports[_0xe853('0xb6')]=function(_0x433fb8,_0x345a4d,_0xc9f75f){var _0x3db59a={};var _0x104ac1={};var _0xa8a34b;var _0x4393c8;return db['OpenchannelAccount'][_0xe853('0x60')]({'where':{'id':_0x433fb8['params']['id']}})[_0xe853('0x1d')](handleEntityNotFound(_0x345a4d,null))[_0xe853('0x1d')](function(_0x104400){if(_0x104400){_0xa8a34b=_0x104400;_0x104ac1[_0xe853('0x45')]=_[_0xe853('0x40')](db['User'][_0xe853('0x3d')]);_0x104ac1[_0xe853('0x3f')]=_[_0xe853('0x40')](_0x433fb8[_0xe853('0x3f')]);_0x104ac1[_0xe853('0x41')]=_[_0xe853('0x42')](_0x104ac1[_0xe853('0x45')],_0x104ac1[_0xe853('0x3f')]);_0x3db59a[_0xe853('0x43')]=_[_0xe853('0x42')](_0x104ac1[_0xe853('0x45')],qs[_0xe853('0x44')](_0x433fb8['query'][_0xe853('0x44')]));_0x3db59a[_0xe853('0x43')]=_0x3db59a[_0xe853('0x43')][_0xe853('0x67')]?_0x3db59a[_0xe853('0x43')]:_0x104ac1[_0xe853('0x45')];_0x3db59a[_0xe853('0x62')]=qs[_0xe853('0x47')](_0x433fb8[_0xe853('0x3f')]['sort']);_0x3db59a[_0xe853('0x48')]=qs['filters'](_['pick'](_0x433fb8[_0xe853('0x3f')],_0x104ac1[_0xe853('0x41')]));if(_0x433fb8[_0xe853('0x3f')]['filter']){_0x3db59a['where']=_[_0xe853('0x4b')](_0x3db59a[_0xe853('0x48')],{'$or':_[_0xe853('0x3b')](_0x3db59a['attributes'],function(_0x5891b6){var _0x39216c={};_0x39216c[_0x5891b6]={'$like':'%'+_0x433fb8['query']['filter']+'%'};return _0x39216c;})});}_0x3db59a=_['merge']({},_0x3db59a,_0x433fb8[_0xe853('0x4e')]);return _0xa8a34b[_0xe853('0xb6')](_0x3db59a);}})['then'](function(_0x524c29){if(_0x524c29){_0x4393c8=_0x524c29[_0xe853('0x67')];if(!_0x433fb8[_0xe853('0x3f')][_0xe853('0x46')](_0xe853('0x68'))){_0x3db59a[_0xe853('0x2b')]=qs[_0xe853('0x2b')](_0x433fb8[_0xe853('0x3f')][_0xe853('0x2b')]);_0x3db59a[_0xe853('0x29')]=qs[_0xe853('0x29')](_0x433fb8[_0xe853('0x3f')][_0xe853('0x29')]);}return _0xa8a34b['getAgents'](_0x3db59a);}})[_0xe853('0x1d')](function(_0x29be17){if(_0x29be17){return _0x29be17?{'count':_0x4393c8,'rows':_0x29be17}:null;}})[_0xe853('0x1d')](respondWithResult(_0x345a4d,null))[_0xe853('0x26')](handleError(_0x345a4d,null));};exports[_0xe853('0x39')]=function(_0x4e4a0b,_0x5bc989,_0x423bdb){var _0x2158b0,_0x40134c,_0x30ebcf;if(_[_0xe853('0x74')](_0x4e4a0b[_0xe853('0x58')]['body'])||_0x4e4a0b['body'][_0xe853('0x58')]===''){throw new db['Sequelize']['ValidationError'](_0xe853('0x75'));}if(_['isNil'](_0x4e4a0b[_0xe853('0x58')]['to'])){}_0x2158b0=_0x4e4a0b[_0xe853('0x58')]['to'];return db[_0xe853('0x3c')][_0xe853('0x60')]({'where':{'id':_0x4e4a0b['params']['id']}})[_0xe853('0x1d')](handleEntityNotFound(_0x5bc989,null))['then'](function(_0x492604){if(_0x492604){return db['OpenchannelAccount']['find']({'where':{'id':_0x492604['id']},'include':[{'model':db[_0xe853('0x7a')],'as':_0xe853('0x7b'),'include':[{'model':db[_0xe853('0x6d')],'as':_0xe853('0x7c'),'where':{[_0x492604[_0xe853('0x78')]]:_0x2158b0},'limit':0x1,'order':[[_0xe853('0x70'),'DESC']]}]}]})[_0xe853('0x1d')](handleEntityNotFound(_0x5bc989,null))[_0xe853('0x1d')](function(_0x2b8f78){if(_0x2b8f78&&_0x2b8f78[_0xe853('0x7b')]){_0x40134c=_0x2b8f78[_0xe853('0x32')]({'plain':!![]});if(_0x40134c[_0xe853('0x7b')]&&_0x40134c[_0xe853('0x7b')]['Contacts']['length']){return _0x40134c[_0xe853('0x7b')][_0xe853('0x7c')][0x0];}return db[_0xe853('0x6d')][_0xe853('0x57')](_[_0xe853('0x16')](_0x4e4a0b['body'],{'firstName':_0x2158b0,[_0x2b8f78['mapKey']]:_0x2158b0,'phone':_0x2158b0,'ListId':_0x40134c['ListId']}));}})[_0xe853('0x1d')](handleEntityNotFound(_0x5bc989,null))[_0xe853('0x1d')](function(_0x235310){if(_0x235310){_0x30ebcf=_0x235310;return db[_0xe853('0x89')]['find']({'where':{'ContactId':_0x30ebcf['id'],'closed':![],'OpenchannelAccountId':_0x40134c['id']}})[_0xe853('0x1d')](function(_0x3ded6e){if(_0x3ded6e){return[_0x3ded6e,![]];}return db[_0xe853('0x89')][_0xe853('0x57')]({'UserId':_0x4e4a0b[_0xe853('0x59')]['id'],'ContactId':_0x30ebcf['id'],'OpenchannelAccountId':_0x40134c['id'],'lastMsgDirection':_0xe853('0xb7'),'firstMsgDirection':_0xe853('0xb7'),'Messages':[_[_0xe853('0x4b')](_0x4e4a0b[_0xe853('0x58')],{'read':![],'body':_0x4e4a0b['body'][_0xe853('0x58')],'OpenchannelAccountId':_0x40134c['id'],'UserId':_0x4e4a0b[_0xe853('0x59')]['id'],'ContactId':_0x30ebcf['id']})]},{'include':[{'model':db[_0xe853('0xb8')],'as':_0xe853('0xb9')}]})[_0xe853('0x1d')](function(_0x25421f){return[_0x25421f,!![]];});});}})['spread'](function(_0x57b44c,_0x1719f5){if(_0x1719f5){return _0x57b44c;}return db[_0xe853('0xb8')][_0xe853('0x57')](_[_0xe853('0x4b')](_0x4e4a0b[_0xe853('0x58')],{'read':![],'body':_0x4e4a0b[_0xe853('0x58')][_0xe853('0x58')],'OpenchannelAccountId':_0x40134c['id'],'OpenchannelInteractionId':_0x57b44c['id'],'UserId':_0x4e4a0b[_0xe853('0x59')]['id'],'ContactId':_0x30ebcf['id']}))[_0xe853('0x1d')](function(_0x106d30){_0x57b44c['dataValues'][_0xe853('0xb9')]=[];_0x57b44c[_0xe853('0xba')][_0xe853('0xb9')]['push'](_0x106d30[_0xe853('0xba')]);return _0x57b44c;});});}})[_0xe853('0x1d')](respondWithResult(_0x5bc989,null))[_0xe853('0x26')](handleError(_0x5bc989,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 2a13be7..ecca0e5 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 _0xf4eb=['hook','events','update','emit','hasOwnProperty'];(function(_0x2143da,_0xca44ca){var _0x564668=function(_0x24bfaa){while(--_0x24bfaa){_0x2143da['push'](_0x2143da['shift']());}};_0x564668(++_0xca44ca);}(_0xf4eb,0xec));var _0xbf4e=function(_0x449295,_0x1986f0){_0x449295=_0x449295-0x0;var _0x2b81f8=_0xf4eb[_0x449295];return _0x2b81f8;};'use strict';var EventEmitter=require(_0xbf4e('0x0'));var OpenchannelAccount=require('../../mysqldb')['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xbf4e('0x1'),'afterDestroy':'remove'};function emitEvent(_0x4e7fa7){return function(_0x2e3070,_0x1c7606,_0x32d1d7){OpenchannelAccountEvents[_0xbf4e('0x2')](_0x4e7fa7+':'+_0x2e3070['id'],_0x2e3070);OpenchannelAccountEvents[_0xbf4e('0x2')](_0x4e7fa7,_0x2e3070);_0x32d1d7(null);};}for(var e in events){if(events[_0xbf4e('0x3')](e)){var event=events[e];OpenchannelAccount[_0xbf4e('0x4')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0x6324=['hasOwnProperty','hook','events','../../mysqldb','OpenchannelAccount','setMaxListeners','update','emit'];(function(_0x40909e,_0x63b633){var _0xa32cfc=function(_0x1ee851){while(--_0x1ee851){_0x40909e['push'](_0x40909e['shift']());}};_0xa32cfc(++_0x63b633);}(_0x6324,0x142));var _0x4632=function(_0x261fee,_0x46a708){_0x261fee=_0x261fee-0x0;var _0x26f7b4=_0x6324[_0x261fee];return _0x26f7b4;};'use strict';var EventEmitter=require(_0x4632('0x0'));var OpenchannelAccount=require(_0x4632('0x1'))['db'][_0x4632('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x4632('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4632('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3bea40){return function(_0x54c200,_0x13b218,_0x592e39){OpenchannelAccountEvents[_0x4632('0x5')](_0x3bea40+':'+_0x54c200['id'],_0x54c200);OpenchannelAccountEvents[_0x4632('0x5')](_0x3bea40,_0x54c200);_0x592e39(null);};}for(var e in events){if(events[_0x4632('0x6')](e)){var event=events[e];OpenchannelAccount[_0x4632('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 50a0998..bda0caa 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(_0x5d57cd,_0x13c181){var _0x1b4453=function(_0x5b3b11){while(--_0x5b3b11){_0x5d57cd['push'](_0x5d57cd['shift']());}};_0x1b4453(++_0x13c181);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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(_0x3843f1,_0x24274c){var _0x3685c9=function(_0x57dd34){while(--_0x57dd34){_0x3843f1['push'](_0x3843f1['shift']());}};_0x3685c9(++_0x24274c);}(_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 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 364a1ed..68d7224 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 _0xa74f=['info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','then'];(function(_0x51ef19,_0x3d7a48){var _0x502bc8=function(_0x1c27e7){while(--_0x1c27e7){_0x51ef19['push'](_0x51ef19['shift']());}};_0x502bc8(++_0x3d7a48);}(_0xa74f,0x9a));var _0xfa74=function(_0x54c9dd,_0x233a86){_0x54c9dd=_0x54c9dd-0x0;var _0x855156=_0xa74f[_0x54c9dd];return _0x855156;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfa74('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfa74('0x1'));var db=require(_0xfa74('0x2'))['db'];var utils=require(_0xfa74('0x3'));var logger=require(_0xfa74('0x4'))('rpc');var config=require(_0xfa74('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfa74('0x6')]({'port':0x232a});config[_0xfa74('0x7')]=_[_0xfa74('0x8')](config[_0xfa74('0x7')],{'host':_0xfa74('0x9'),'port':0x18eb});var socket=require(_0xfa74('0xa'))(new Redis(config['redis']));require(_0xfa74('0xb'))[_0xfa74('0xc')](socket);function respondWithRpcPromise(_0x355e37,_0x2a405e,_0x4d118c){return new BPromise(function(_0x46117e,_0x4f8891){return client['request'](_0x355e37,_0x4d118c)[_0xfa74('0xd')](function(_0x1d919d){logger[_0xfa74('0xe')](_0xfa74('0xf'),_0x2a405e,'request\x20sent');logger[_0xfa74('0x10')](_0xfa74('0x11'),_0x2a405e,_0xfa74('0x12'),JSON[_0xfa74('0x13')](_0x1d919d));if(_0x1d919d['error']){if(_0x1d919d[_0xfa74('0x14')][_0xfa74('0x15')]===0x1f4){logger[_0xfa74('0x14')](_0xfa74('0xf'),_0x2a405e,_0x1d919d[_0xfa74('0x14')]['message']);return _0x4f8891(_0x1d919d[_0xfa74('0x14')][_0xfa74('0x16')]);}logger[_0xfa74('0x14')](_0xfa74('0xf'),_0x2a405e,_0x1d919d[_0xfa74('0x14')][_0xfa74('0x16')]);return _0x46117e(_0x1d919d[_0xfa74('0x14')]['message']);}else{logger[_0xfa74('0xe')](_0xfa74('0xf'),_0x2a405e,'request\x20sent');_0x46117e(_0x1d919d['result'][_0xfa74('0x16')]);}})[_0xfa74('0x17')](function(_0xb8fe6b){logger['error'](_0xfa74('0xf'),_0x2a405e,_0xb8fe6b);_0x4f8891(_0xb8fe6b);});});} \ No newline at end of file +var _0x757a=['redis','localhost','socket.io-emitter','./openchannelAccount.socket','request','then','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','OpenchannelAccount,\x20%s,\x20%s','message','info','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x122835,_0x5bf3c2){var _0x5ef7ab=function(_0xc3ce51){while(--_0xc3ce51){_0x122835['push'](_0x122835['shift']());}};_0x5ef7ab(++_0x5bf3c2);}(_0x757a,0xde));var _0xa757=function(_0x17fa2b,_0x5a61e0){_0x17fa2b=_0x17fa2b-0x0;var _0x8cb6b3=_0x757a[_0x17fa2b];return _0x8cb6b3;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});config[_0xa757('0x9')]=_['defaults'](config[_0xa757('0x9')],{'host':_0xa757('0xa'),'port':0x18eb});var socket=require(_0xa757('0xb'))(new Redis(config[_0xa757('0x9')]));require(_0xa757('0xc'))['register'](socket);function respondWithRpcPromise(_0x89c630,_0x2ca96f,_0x32f0ec){return new BPromise(function(_0x3e2c9a,_0xb7610b){return client[_0xa757('0xd')](_0x89c630,_0x32f0ec)[_0xa757('0xe')](function(_0x483d77){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x2ca96f,'request\x20sent');logger['debug'](_0xa757('0xf'),_0x2ca96f,'request\x20sent',JSON['stringify'](_0x483d77));if(_0x483d77[_0xa757('0x10')]){if(_0x483d77['error']['code']===0x1f4){logger[_0xa757('0x10')](_0xa757('0x11'),_0x2ca96f,_0x483d77[_0xa757('0x10')][_0xa757('0x12')]);return _0xb7610b(_0x483d77[_0xa757('0x10')][_0xa757('0x12')]);}logger[_0xa757('0x10')](_0xa757('0x11'),_0x2ca96f,_0x483d77[_0xa757('0x10')][_0xa757('0x12')]);return _0x3e2c9a(_0x483d77['error'][_0xa757('0x12')]);}else{logger[_0xa757('0x13')](_0xa757('0x11'),_0x2ca96f,'request\x20sent');_0x3e2c9a(_0x483d77['result'][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x1bd14c){logger[_0xa757('0x10')](_0xa757('0x11'),_0x2ca96f,_0x1bd14c);_0xb7610b(_0x1bd14c);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 4825c24..3dd201f 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 _0x3a79=['emit','removeListener','length','openchannelAccount:','save','remove'];(function(_0xa3daf7,_0x1cf62c){var _0x2d4ffc=function(_0x25558d){while(--_0x25558d){_0xa3daf7['push'](_0xa3daf7['shift']());}};_0x2d4ffc(++_0x1cf62c);}(_0x3a79,0xca));var _0x93a7=function(_0x486b56,_0x141308){_0x486b56=_0x486b56-0x0;var _0x232f60=_0x3a79[_0x486b56];return _0x232f60;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x93a7('0x0'),_0x93a7('0x1'),'update'];function createListener(_0x109b5e,_0x8e64e2){return function(_0x31fb0d){_0x8e64e2[_0x93a7('0x2')](_0x109b5e,_0x31fb0d);};}function removeListener(_0x2a6b2b,_0x1e43e0){return function(){OpenchannelAccountEvents[_0x93a7('0x3')](_0x2a6b2b,_0x1e43e0);};}exports['register']=function(_0x2976b2){for(var _0x4efb20=0x0,_0x2579e5=events[_0x93a7('0x4')];_0x4efb20<_0x2579e5;_0x4efb20++){var _0x1b59d1=events[_0x4efb20];var _0x2417da=createListener(_0x93a7('0x5')+_0x1b59d1,_0x2976b2);OpenchannelAccountEvents['on'](_0x1b59d1,_0x2417da);}}; \ No newline at end of file +var _0x4a81=['save','remove','update','openchannelAccount:','./openchannelAccount.events'];(function(_0x58cf07,_0x2e3858){var _0x42afe0=function(_0x3c71ff){while(--_0x3c71ff){_0x58cf07['push'](_0x58cf07['shift']());}};_0x42afe0(++_0x2e3858);}(_0x4a81,0x1b7));var _0x14a8=function(_0x539958,_0xe91ab6){_0x539958=_0x539958-0x0;var _0x365443=_0x4a81[_0x539958];return _0x365443;};'use strict';var OpenchannelAccountEvents=require(_0x14a8('0x0'));var events=[_0x14a8('0x1'),_0x14a8('0x2'),_0x14a8('0x3')];function createListener(_0x4a7f9e,_0x5845a3){return function(_0x45869b){_0x5845a3['emit'](_0x4a7f9e,_0x45869b);};}function removeListener(_0x39c3d4,_0x3363f8){return function(){OpenchannelAccountEvents['removeListener'](_0x39c3d4,_0x3363f8);};}exports['register']=function(_0x2cd6d2){for(var _0x4aa19e=0x0,_0x134295=events['length'];_0x4aa19e<_0x134295;_0x4aa19e++){var _0x26e442=events[_0x4aa19e];var _0x4271b5=createListener(_0x14a8('0x4')+_0x26e442,_0x2cd6d2);OpenchannelAccountEvents['on'](_0x26e442,_0x4271b5);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 0ac8ae5..2914081 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 _0x545f=['../../components/auth/service','../../config/environment','get','index','/:id','post','isAuthenticated','create','put','delete','destroy','exports','multer','path','connect-timeout','fs-extra'];(function(_0x464771,_0x3df5de){var _0x224ba7=function(_0x5c505a){while(--_0x5c505a){_0x464771['push'](_0x464771['shift']());}};_0x224ba7(++_0x3df5de);}(_0x545f,0x14c));var _0xf545=function(_0x1e3671,_0x9ae4fc){_0x1e3671=_0x1e3671-0x0;var _0x48d5f5=_0x545f[_0x1e3671];return _0x48d5f5;};'use strict';var multer=require(_0xf545('0x0'));var util=require('util');var path=require(_0xf545('0x1'));var timeout=require(_0xf545('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf545('0x3'));var auth=require(_0xf545('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf545('0x5'));var controller=require('./openchannelApplication.controller');router[_0xf545('0x6')]('/',auth['isAuthenticated'](),controller[_0xf545('0x7')]);router[_0xf545('0x6')](_0xf545('0x8'),auth['isAuthenticated'](),controller['show']);router[_0xf545('0x9')]('/',auth[_0xf545('0xa')](),controller[_0xf545('0xb')]);router[_0xf545('0xc')](_0xf545('0x8'),auth['isAuthenticated'](),controller['update']);router[_0xf545('0xd')](_0xf545('0x8'),auth[_0xf545('0xa')](),controller[_0xf545('0xe')]);module[_0xf545('0xf')]=router; \ No newline at end of file +var _0x2966=['delete','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2966,0xc7));var _0x6296=function(_0x12838c,_0x186682){_0x12838c=_0x12838c-0x0;var _0x4a859d=_0x2966[_0x12838c];return _0x4a859d;};'use strict';var multer=require(_0x6296('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6296('0x1'));var router=express[_0x6296('0x2')]();var fs_extra=require(_0x6296('0x3'));var auth=require(_0x6296('0x4'));var interaction=require(_0x6296('0x5'));var config=require(_0x6296('0x6'));var controller=require(_0x6296('0x7'));router[_0x6296('0x8')]('/',auth[_0x6296('0x9')](),controller[_0x6296('0xa')]);router[_0x6296('0x8')](_0x6296('0xb'),auth[_0x6296('0x9')](),controller[_0x6296('0xc')]);router[_0x6296('0xd')]('/',auth[_0x6296('0x9')](),controller[_0x6296('0xe')]);router[_0x6296('0xf')]('/:id',auth[_0x6296('0x9')](),controller[_0x6296('0x10')]);router[_0x6296('0x11')](_0x6296('0xb'),auth[_0x6296('0x9')](),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 90c7d0a..005bfcf 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 _0x152e=['STRING','noop','sequelize','exports'];(function(_0x2aab19,_0x2808de){var _0x42736c=function(_0x25772c){while(--_0x25772c){_0x2aab19['push'](_0x2aab19['shift']());}};_0x42736c(++_0x2808de);}(_0x152e,0x10e));var _0xe152=function(_0x297fe8,_0x2c9c7e){_0x297fe8=_0x297fe8-0x0;var _0x337023=_0x152e[_0x297fe8];return _0x337023;};'use strict';var Sequelize=require(_0xe152('0x0'));module[_0xe152('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xe152('0x2')],'allowNull':![],'defaultValue':_0xe152('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xe152('0x2')]},'interval':{'type':Sequelize[_0xe152('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xe23c=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x2d7678,_0x55201c){var _0x21fd13=function(_0x501a88){while(--_0x501a88){_0x2d7678['push'](_0x2d7678['shift']());}};_0x21fd13(++_0x55201c);}(_0xe23c,0xfc));var _0xce23=function(_0x5a7d5f,_0x5695cb){_0x5a7d5f=_0x5a7d5f-0x0;var _0x5dcded=_0xe23c[_0x5a7d5f];return _0x5dcded;};'use strict';var Sequelize=require('sequelize');module[_0xce23('0x0')]={'priority':{'type':Sequelize[_0xce23('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xce23('0x2')],'allowNull':![],'defaultValue':_0xce23('0x3')},'appdata':{'type':Sequelize[_0xce23('0x4')]()},'description':{'type':Sequelize[_0xce23('0x2')]},'interval':{'type':Sequelize[_0xce23('0x2')],'defaultValue':_0xce23('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 6c16909..5d1f862 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 _0x5009=['util','path','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','reject','save','update','destroy','error','stack','name','send','index','map','OpenchannelApplication','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','includeAll','then','catch','rawAttributes','include','options','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x2a102d,_0x1a851a){var _0xac258f=function(_0x38dfd0){while(--_0x38dfd0){_0x2a102d['push'](_0x2a102d['shift']());}};_0xac258f(++_0x1a851a);}(_0x5009,0x113));var _0x9500=function(_0x4ef880,_0x3148a7){_0x4ef880=_0x4ef880-0x0;var _0x28ddca=_0x5009[_0x4ef880];return _0x28ddca;};'use strict';var emlformat=require(_0x9500('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9500('0x1'));var jsonpatch=require(_0x9500('0x2'));var rp=require(_0x9500('0x3'));var moment=require(_0x9500('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9500('0x5'));var path=require(_0x9500('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9500('0x7'));var fs=require('fs');var fs_extra=require(_0x9500('0x8'));var _=require('lodash');var squel=require(_0x9500('0x9'));var crypto=require(_0x9500('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9500('0xb'));var toCsv=require('to-csv');var querystring=require(_0x9500('0xc'));var Papa=require(_0x9500('0xd'));var Redis=require('ioredis');var authService=require(_0x9500('0xe'));var qs=require(_0x9500('0xf'));var as=require(_0x9500('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9500('0x11'))('api');var utils=require(_0x9500('0x12'));var config=require(_0x9500('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x9500('0x14'))['db'];function respondWithStatusCode(_0x1005a9,_0x326342){_0x326342=_0x326342||0xcc;return function(_0x319ad9){if(_0x319ad9){return _0x1005a9[_0x9500('0x15')](_0x326342);}return _0x1005a9['status'](_0x326342)[_0x9500('0x16')]();};}function respondWithResult(_0x3b7c01,_0x2cc221){_0x2cc221=_0x2cc221||0xc8;return function(_0x45b6fe){if(_0x45b6fe){return _0x3b7c01[_0x9500('0x17')](_0x2cc221)[_0x9500('0x18')](_0x45b6fe);}};}function respondWithFilteredResult(_0x2c2ced,_0x5c5a34){return function(_0x327264){if(_0x327264){var _0x3cd713=typeof _0x5c5a34['offset']===_0x9500('0x19')&&typeof _0x5c5a34[_0x9500('0x1a')]===_0x9500('0x19');var _0x4d753d=_0x327264[_0x9500('0x1b')];var _0x3f77ce=_0x3cd713?0x0:_0x5c5a34[_0x9500('0x1c')];var _0x42c5d1=_0x3cd713?_0x327264['count']:_0x5c5a34[_0x9500('0x1c')]+_0x5c5a34[_0x9500('0x1a')];var _0xe2f5bf;if(_0x42c5d1>=_0x4d753d){_0x42c5d1=_0x4d753d;_0xe2f5bf=0xc8;}else{_0xe2f5bf=0xce;}_0x2c2ced[_0x9500('0x17')](_0xe2f5bf);return _0x2c2ced[_0x9500('0x1d')]('Content-Range',_0x3f77ce+'-'+_0x42c5d1+'/'+_0x4d753d)[_0x9500('0x18')](_0x327264);}return null;};}function patchUpdates(_0x12a20e){return function(_0x4624ab){try{jsonpatch[_0x9500('0x1e')](_0x4624ab,_0x12a20e,!![]);}catch(_0xf04ace){return BPromise[_0x9500('0x1f')](_0xf04ace);}return _0x4624ab[_0x9500('0x20')]();};}function saveUpdates(_0xdd1658,_0x1e2775){return function(_0x23d983){if(_0x23d983){return _0x23d983[_0x9500('0x21')](_0xdd1658)['then'](function(_0x395906){return _0x395906;});}return null;};}function removeEntity(_0x54b6af,_0x570214){return function(_0x49e35a){if(_0x49e35a){return _0x49e35a[_0x9500('0x22')]()['then'](function(){_0x54b6af['status'](0xcc)[_0x9500('0x16')]();});}};}function handleEntityNotFound(_0x140c07,_0x326440){return function(_0x19fbb9){if(!_0x19fbb9){_0x140c07[_0x9500('0x15')](0x194);}return _0x19fbb9;};}function handleError(_0xbfea9f,_0x207b39){_0x207b39=_0x207b39||0x1f4;return function(_0x218537){logger[_0x9500('0x23')](_0x218537[_0x9500('0x24')]);if(_0x218537[_0x9500('0x25')]){delete _0x218537['name'];}_0xbfea9f[_0x9500('0x17')](_0x207b39)[_0x9500('0x26')](_0x218537);};}exports[_0x9500('0x27')]=function(_0x5151b2,_0x15830c){var _0xdb0dfc={},_0x19a1cd={},_0x38b7f0={'count':0x0,'rows':[]};var _0xde1e5b=_[_0x9500('0x28')](db[_0x9500('0x29')]['rawAttributes'],function(_0x48c103){return{'name':_0x48c103[_0x9500('0x2a')],'type':_0x48c103['type'][_0x9500('0x2b')]};});_0x19a1cd['model']=_[_0x9500('0x28')](_0xde1e5b,_0x9500('0x25'));_0x19a1cd[_0x9500('0x2c')]=_[_0x9500('0x2d')](_0x5151b2[_0x9500('0x2c')]);_0x19a1cd[_0x9500('0x2e')]=_['intersection'](_0x19a1cd[_0x9500('0x2f')],_0x19a1cd[_0x9500('0x2c')]);_0xdb0dfc[_0x9500('0x30')]=_[_0x9500('0x31')](_0x19a1cd['model'],qs[_0x9500('0x32')](_0x5151b2[_0x9500('0x2c')][_0x9500('0x32')]));_0xdb0dfc[_0x9500('0x30')]=_0xdb0dfc[_0x9500('0x30')][_0x9500('0x33')]?_0xdb0dfc[_0x9500('0x30')]:_0x19a1cd['model'];if(!_0x5151b2['query'][_0x9500('0x34')]('nolimit')){_0xdb0dfc[_0x9500('0x1a')]=qs['limit'](_0x5151b2[_0x9500('0x2c')][_0x9500('0x1a')]);_0xdb0dfc[_0x9500('0x1c')]=qs['offset'](_0x5151b2['query'][_0x9500('0x1c')]);}_0xdb0dfc[_0x9500('0x35')]=qs['sort'](_0x5151b2[_0x9500('0x2c')][_0x9500('0x36')]);_0xdb0dfc[_0x9500('0x37')]=qs[_0x9500('0x2e')](_['pick'](_0x5151b2[_0x9500('0x2c')],_0x19a1cd[_0x9500('0x2e')]),_0xde1e5b);if(_0x5151b2[_0x9500('0x2c')][_0x9500('0x38')]){_0xdb0dfc[_0x9500('0x37')]=_[_0x9500('0x39')](_0xdb0dfc[_0x9500('0x37')],{'$or':_[_0x9500('0x28')](_0xde1e5b,function(_0x3af646){if(_0x3af646[_0x9500('0x3a')]!==_0x9500('0x3b')){var _0x368b0c={};_0x368b0c[_0x3af646['name']]={'$like':'%'+_0x5151b2[_0x9500('0x2c')][_0x9500('0x38')]+'%'};return _0x368b0c;}})});}_0xdb0dfc=_[_0x9500('0x39')]({},_0xdb0dfc,_0x5151b2['options']);var _0x3cad75={'where':_0xdb0dfc['where']};return db[_0x9500('0x29')][_0x9500('0x1b')](_0x3cad75)['then'](function(_0x5c6d56){_0x38b7f0['count']=_0x5c6d56;if(_0x5151b2['query'][_0x9500('0x3c')]){_0xdb0dfc['include']=[{'all':!![]}];}return db[_0x9500('0x29')]['findAll'](_0xdb0dfc);})[_0x9500('0x3d')](function(_0x2f76dd){_0x38b7f0['rows']=_0x2f76dd;return _0x38b7f0;})[_0x9500('0x3d')](respondWithFilteredResult(_0x15830c,_0xdb0dfc))[_0x9500('0x3e')](handleError(_0x15830c,null));};exports['show']=function(_0x5abf60,_0x25dfdb){var _0x247a2b={'raw':!![],'where':{'id':_0x5abf60['params']['id']}},_0x393973={};_0x393973[_0x9500('0x2f')]=_[_0x9500('0x2d')](db[_0x9500('0x29')][_0x9500('0x3f')]);_0x393973[_0x9500('0x2c')]=_[_0x9500('0x2d')](_0x5abf60[_0x9500('0x2c')]);_0x393973['filters']=_[_0x9500('0x31')](_0x393973['model'],_0x393973[_0x9500('0x2c')]);_0x247a2b[_0x9500('0x30')]=_[_0x9500('0x31')](_0x393973[_0x9500('0x2f')],qs[_0x9500('0x32')](_0x5abf60[_0x9500('0x2c')][_0x9500('0x32')]));_0x247a2b[_0x9500('0x30')]=_0x247a2b[_0x9500('0x30')][_0x9500('0x33')]?_0x247a2b[_0x9500('0x30')]:_0x393973['model'];if(_0x5abf60[_0x9500('0x2c')][_0x9500('0x3c')]){_0x247a2b[_0x9500('0x40')]=[{'all':!![]}];}_0x247a2b=_[_0x9500('0x39')]({},_0x247a2b,_0x5abf60[_0x9500('0x41')]);return db[_0x9500('0x29')][_0x9500('0x42')](_0x247a2b)[_0x9500('0x3d')](handleEntityNotFound(_0x25dfdb,null))[_0x9500('0x3d')](respondWithResult(_0x25dfdb,null))[_0x9500('0x3e')](handleError(_0x25dfdb,null));};exports['create']=function(_0x39820b,_0x7dc51d){return db[_0x9500('0x29')][_0x9500('0x43')](_0x39820b['body'],{})[_0x9500('0x3d')](respondWithResult(_0x7dc51d,0xc9))['catch'](handleError(_0x7dc51d,null));};exports[_0x9500('0x21')]=function(_0x1028fc,_0x1f13a1){if(_0x1028fc[_0x9500('0x44')]['id']){delete _0x1028fc[_0x9500('0x44')]['id'];}return db['OpenchannelApplication'][_0x9500('0x42')]({'where':{'id':_0x1028fc['params']['id']}})[_0x9500('0x3d')](handleEntityNotFound(_0x1f13a1,null))['then'](saveUpdates(_0x1028fc[_0x9500('0x44')],null))[_0x9500('0x3d')](respondWithResult(_0x1f13a1,null))[_0x9500('0x3e')](handleError(_0x1f13a1,null));};exports[_0x9500('0x22')]=function(_0x2142e7,_0x8cd3fd){return db['OpenchannelApplication']['find']({'where':{'id':_0x2142e7[_0x9500('0x45')]['id']}})[_0x9500('0x3d')](handleEntityNotFound(_0x8cd3fd,null))['then'](removeEntity(_0x8cd3fd,null))[_0x9500('0x3e')](handleError(_0x8cd3fd,null));}; \ No newline at end of file +var _0x05ab=['rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','options','includeAll','include','findAll','catch','show','length','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','json','apply','save','update','destroy','then','stack','name','index','map','OpenchannelApplication'];(function(_0x3f986b,_0x3b35f5){var _0x5148b2=function(_0x4ab31f){while(--_0x4ab31f){_0x3f986b['push'](_0x3f986b['shift']());}};_0x5148b2(++_0x3b35f5);}(_0x05ab,0x1e2));var _0xb05a=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x05ab[_0x3b0731];return _0x4204d7;};'use strict';var emlformat=require(_0xb05a('0x0'));var rimraf=require(_0xb05a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb05a('0x2'));var rp=require(_0xb05a('0x3'));var moment=require(_0xb05a('0x4'));var BPromise=require(_0xb05a('0x5'));var Mustache=require(_0xb05a('0x6'));var util=require(_0xb05a('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb05a('0x8'));var fs=require('fs');var fs_extra=require(_0xb05a('0x9'));var _=require('lodash');var squel=require(_0xb05a('0xa'));var crypto=require('crypto');var jsforce=require(_0xb05a('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb05a('0xc'));var Redis=require('ioredis');var authService=require(_0xb05a('0xd'));var qs=require(_0xb05a('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb05a('0xf'));var utils=require('../../config/utils');var config=require(_0xb05a('0x10'));var licenseUtil=require(_0xb05a('0x11'));var db=require(_0xb05a('0x12'))['db'];function respondWithStatusCode(_0x415f6d,_0x19adad){_0x19adad=_0x19adad||0xcc;return function(_0x226c5b){if(_0x226c5b){return _0x415f6d[_0xb05a('0x13')](_0x19adad);}return _0x415f6d['status'](_0x19adad)[_0xb05a('0x14')]();};}function respondWithResult(_0x3705ff,_0x58f434){_0x58f434=_0x58f434||0xc8;return function(_0x27796d){if(_0x27796d){return _0x3705ff[_0xb05a('0x15')](_0x58f434)['json'](_0x27796d);}};}function respondWithFilteredResult(_0x477025,_0x3777b0){return function(_0x5b5299){if(_0x5b5299){var _0x28939b=typeof _0x3777b0[_0xb05a('0x16')]==='undefined'&&typeof _0x3777b0[_0xb05a('0x17')]===_0xb05a('0x18');var _0x156b90=_0x5b5299[_0xb05a('0x19')];var _0xd52464=_0x28939b?0x0:_0x3777b0['offset'];var _0x527feb=_0x28939b?_0x5b5299['count']:_0x3777b0[_0xb05a('0x16')]+_0x3777b0[_0xb05a('0x17')];var _0x2b6c05;if(_0x527feb>=_0x156b90){_0x527feb=_0x156b90;_0x2b6c05=0xc8;}else{_0x2b6c05=0xce;}_0x477025[_0xb05a('0x15')](_0x2b6c05);return _0x477025[_0xb05a('0x1a')]('Content-Range',_0xd52464+'-'+_0x527feb+'/'+_0x156b90)[_0xb05a('0x1b')](_0x5b5299);}return null;};}function patchUpdates(_0x5df23f){return function(_0x2697e9){try{jsonpatch[_0xb05a('0x1c')](_0x2697e9,_0x5df23f,!![]);}catch(_0x38963a){return BPromise['reject'](_0x38963a);}return _0x2697e9[_0xb05a('0x1d')]();};}function saveUpdates(_0x537ccd,_0x32f325){return function(_0x6c112e){if(_0x6c112e){return _0x6c112e[_0xb05a('0x1e')](_0x537ccd)['then'](function(_0x2cc8fa){return _0x2cc8fa;});}return null;};}function removeEntity(_0xe42ac5,_0x286ef7){return function(_0xdcf144){if(_0xdcf144){return _0xdcf144[_0xb05a('0x1f')]()[_0xb05a('0x20')](function(){_0xe42ac5[_0xb05a('0x15')](0xcc)[_0xb05a('0x14')]();});}};}function handleEntityNotFound(_0x294441,_0x3e07c4){return function(_0x967809){if(!_0x967809){_0x294441['sendStatus'](0x194);}return _0x967809;};}function handleError(_0x530242,_0x33471f){_0x33471f=_0x33471f||0x1f4;return function(_0x1ddf1d){logger['error'](_0x1ddf1d[_0xb05a('0x21')]);if(_0x1ddf1d[_0xb05a('0x22')]){delete _0x1ddf1d[_0xb05a('0x22')];}_0x530242[_0xb05a('0x15')](_0x33471f)['send'](_0x1ddf1d);};}exports[_0xb05a('0x23')]=function(_0x5aecc1,_0xb84ad0){var _0x27163c={},_0x28ab4b={},_0x9b300f={'count':0x0,'rows':[]};var _0x81f6c5=_[_0xb05a('0x24')](db[_0xb05a('0x25')][_0xb05a('0x26')],function(_0xbcdd4){return{'name':_0xbcdd4[_0xb05a('0x27')],'type':_0xbcdd4[_0xb05a('0x28')]['key']};});_0x28ab4b[_0xb05a('0x29')]=_[_0xb05a('0x24')](_0x81f6c5,'name');_0x28ab4b[_0xb05a('0x2a')]=_[_0xb05a('0x2b')](_0x5aecc1[_0xb05a('0x2a')]);_0x28ab4b[_0xb05a('0x2c')]=_[_0xb05a('0x2d')](_0x28ab4b[_0xb05a('0x29')],_0x28ab4b[_0xb05a('0x2a')]);_0x27163c[_0xb05a('0x2e')]=_[_0xb05a('0x2d')](_0x28ab4b[_0xb05a('0x29')],qs['fields'](_0x5aecc1['query'][_0xb05a('0x2f')]));_0x27163c['attributes']=_0x27163c['attributes']['length']?_0x27163c[_0xb05a('0x2e')]:_0x28ab4b[_0xb05a('0x29')];if(!_0x5aecc1[_0xb05a('0x2a')][_0xb05a('0x30')]('nolimit')){_0x27163c[_0xb05a('0x17')]=qs[_0xb05a('0x17')](_0x5aecc1[_0xb05a('0x2a')][_0xb05a('0x17')]);_0x27163c[_0xb05a('0x16')]=qs[_0xb05a('0x16')](_0x5aecc1['query'][_0xb05a('0x16')]);}_0x27163c[_0xb05a('0x31')]=qs[_0xb05a('0x32')](_0x5aecc1[_0xb05a('0x2a')][_0xb05a('0x32')]);_0x27163c[_0xb05a('0x33')]=qs[_0xb05a('0x2c')](_[_0xb05a('0x34')](_0x5aecc1[_0xb05a('0x2a')],_0x28ab4b[_0xb05a('0x2c')]),_0x81f6c5);if(_0x5aecc1[_0xb05a('0x2a')]['filter']){_0x27163c['where']=_[_0xb05a('0x35')](_0x27163c[_0xb05a('0x33')],{'$or':_['map'](_0x81f6c5,function(_0x171397){if(_0x171397[_0xb05a('0x28')]!=='VIRTUAL'){var _0x1fec37={};_0x1fec37[_0x171397[_0xb05a('0x22')]]={'$like':'%'+_0x5aecc1[_0xb05a('0x2a')]['filter']+'%'};return _0x1fec37;}})});}_0x27163c=_[_0xb05a('0x35')]({},_0x27163c,_0x5aecc1[_0xb05a('0x36')]);var _0x144807={'where':_0x27163c[_0xb05a('0x33')]};return db['OpenchannelApplication'][_0xb05a('0x19')](_0x144807)[_0xb05a('0x20')](function(_0x3a02c8){_0x9b300f[_0xb05a('0x19')]=_0x3a02c8;if(_0x5aecc1['query'][_0xb05a('0x37')]){_0x27163c[_0xb05a('0x38')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0xb05a('0x39')](_0x27163c);})[_0xb05a('0x20')](function(_0x42db2c){_0x9b300f['rows']=_0x42db2c;return _0x9b300f;})[_0xb05a('0x20')](respondWithFilteredResult(_0xb84ad0,_0x27163c))[_0xb05a('0x3a')](handleError(_0xb84ad0,null));};exports[_0xb05a('0x3b')]=function(_0x2bb7b0,_0x59ad4c){var _0x5de788={'raw':!![],'where':{'id':_0x2bb7b0['params']['id']}},_0x3e1c8d={};_0x3e1c8d[_0xb05a('0x29')]=_['keys'](db[_0xb05a('0x25')][_0xb05a('0x26')]);_0x3e1c8d[_0xb05a('0x2a')]=_['keys'](_0x2bb7b0[_0xb05a('0x2a')]);_0x3e1c8d[_0xb05a('0x2c')]=_[_0xb05a('0x2d')](_0x3e1c8d[_0xb05a('0x29')],_0x3e1c8d['query']);_0x5de788[_0xb05a('0x2e')]=_[_0xb05a('0x2d')](_0x3e1c8d['model'],qs[_0xb05a('0x2f')](_0x2bb7b0['query']['fields']));_0x5de788[_0xb05a('0x2e')]=_0x5de788['attributes'][_0xb05a('0x3c')]?_0x5de788['attributes']:_0x3e1c8d['model'];if(_0x2bb7b0[_0xb05a('0x2a')][_0xb05a('0x37')]){_0x5de788[_0xb05a('0x38')]=[{'all':!![]}];}_0x5de788=_[_0xb05a('0x35')]({},_0x5de788,_0x2bb7b0[_0xb05a('0x36')]);return db['OpenchannelApplication'][_0xb05a('0x3d')](_0x5de788)[_0xb05a('0x20')](handleEntityNotFound(_0x59ad4c,null))[_0xb05a('0x20')](respondWithResult(_0x59ad4c,null))['catch'](handleError(_0x59ad4c,null));};exports['create']=function(_0x40817f,_0x50eefe){return db[_0xb05a('0x25')][_0xb05a('0x3e')](_0x40817f['body'],{})[_0xb05a('0x20')](respondWithResult(_0x50eefe,0xc9))[_0xb05a('0x3a')](handleError(_0x50eefe,null));};exports[_0xb05a('0x1e')]=function(_0x16e156,_0x16294d){if(_0x16e156[_0xb05a('0x3f')]['id']){delete _0x16e156[_0xb05a('0x3f')]['id'];}return db['OpenchannelApplication']['find']({'where':{'id':_0x16e156['params']['id']}})[_0xb05a('0x20')](handleEntityNotFound(_0x16294d,null))['then'](saveUpdates(_0x16e156[_0xb05a('0x3f')],null))[_0xb05a('0x20')](respondWithResult(_0x16294d,null))[_0xb05a('0x3a')](handleError(_0x16294d,null));};exports[_0xb05a('0x1f')]=function(_0x2b48f8,_0x33ef98){return db[_0xb05a('0x25')][_0xb05a('0x3d')]({'where':{'id':_0x2b48f8[_0xb05a('0x40')]['id']}})[_0xb05a('0x20')](handleEntityNotFound(_0x33ef98,null))[_0xb05a('0x20')](removeEntity(_0x33ef98,null))[_0xb05a('0x3a')](handleError(_0x33ef98,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 6b6ef10..457afe6 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 _0x7c7d=['api','moment','request-promise','path','./openchannelApplication.attributes','define','openchannel_applications','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0xa417ff,_0x2ab57c){var _0x2c0a82=function(_0x118e47){while(--_0x118e47){_0xa417ff['push'](_0xa417ff['shift']());}};_0x2c0a82(++_0x2ab57c);}(_0x7c7d,0xe4));var _0xd7c7=function(_0x4307a5,_0x148615){_0x4307a5=_0x4307a5-0x0;var _0x6c146e=_0x7c7d[_0x4307a5];return _0x6c146e;};'use strict';var _=require('lodash');var util=require(_0xd7c7('0x0'));var logger=require(_0xd7c7('0x1'))(_0xd7c7('0x2'));var moment=require(_0xd7c7('0x3'));var BPromise=require('bluebird');var rp=require(_0xd7c7('0x4'));var fs=require('fs');var path=require(_0xd7c7('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd7c7('0x6'));module['exports']=function(_0x4062fc,_0x15b740){return _0x4062fc[_0xd7c7('0x7')]('OpenchannelApplication',attributes,{'tableName':_0xd7c7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd7c7('0x9')});}; \ No newline at end of file +var _0x6ed8=['./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x6ed8,0x8d));var _0x86ed=function(_0x314f45,_0x4a71c6){_0x314f45=_0x314f45-0x0;var _0x11202c=_0x6ed8[_0x314f45];return _0x11202c;};'use strict';var _=require(_0x86ed('0x0'));var util=require(_0x86ed('0x1'));var logger=require(_0x86ed('0x2'))(_0x86ed('0x3'));var moment=require('moment');var BPromise=require(_0x86ed('0x4'));var rp=require(_0x86ed('0x5'));var fs=require('fs');var path=require(_0x86ed('0x6'));var rimraf=require(_0x86ed('0x7'));var config=require(_0x86ed('0x8'));var attributes=require(_0x86ed('0x9'));module[_0x86ed('0xa')]=function(_0x50d64e,_0x32b087){return _0x50d64e[_0x86ed('0xb')](_0x86ed('0xc'),attributes,{'tableName':_0x86ed('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x86ed('0xe'),'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 50f5fbc..932fd4c 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 _0x2b6c=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UpdateOpenchannelApplication','OpenchannelApplication','body','options','where','attributes','limit','util','moment','bluebird','randomstring'];(function(_0x4cbc66,_0x563ba5){var _0x3ee478=function(_0x2b576a){while(--_0x2b576a){_0x4cbc66['push'](_0x4cbc66['shift']());}};_0x3ee478(++_0x563ba5);}(_0x2b6c,0x158));var _0xc2b6=function(_0x1aecdc,_0x522a27){_0x1aecdc=_0x1aecdc-0x0;var _0xef638b=_0x2b6c[_0x1aecdc];return _0xef638b;};'use strict';var _=require('lodash');var util=require(_0xc2b6('0x0'));var moment=require(_0xc2b6('0x1'));var BPromise=require(_0xc2b6('0x2'));var rs=require(_0xc2b6('0x3'));var fs=require('fs');var Redis=require(_0xc2b6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc2b6('0x5'));var logger=require(_0xc2b6('0x6'))(_0xc2b6('0x7'));var config=require(_0xc2b6('0x8'));var jayson=require(_0xc2b6('0x9'));var client=jayson[_0xc2b6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5835ef,_0x928bf4,_0x3d1453){return new BPromise(function(_0x352e8b,_0x4ef2b8){return client[_0xc2b6('0xb')](_0x5835ef,_0x3d1453)[_0xc2b6('0xc')](function(_0x4df050){logger[_0xc2b6('0xd')](_0xc2b6('0xe'),_0x928bf4,_0xc2b6('0xf'));logger[_0xc2b6('0x10')](_0xc2b6('0x11'),_0x928bf4,_0xc2b6('0xf'),JSON[_0xc2b6('0x12')](_0x4df050));if(_0x4df050[_0xc2b6('0x13')]){if(_0x4df050['error'][_0xc2b6('0x14')]===0x1f4){logger[_0xc2b6('0x13')](_0xc2b6('0xe'),_0x928bf4,_0x4df050[_0xc2b6('0x13')][_0xc2b6('0x15')]);return _0x4ef2b8(_0x4df050['error'][_0xc2b6('0x15')]);}logger[_0xc2b6('0x13')](_0xc2b6('0xe'),_0x928bf4,_0x4df050['error'][_0xc2b6('0x15')]);return _0x352e8b(_0x4df050[_0xc2b6('0x13')][_0xc2b6('0x15')]);}else{logger[_0xc2b6('0xd')]('OpenchannelApplication,\x20%s,\x20%s',_0x928bf4,_0xc2b6('0xf'));_0x352e8b(_0x4df050['result']['message']);}})['catch'](function(_0x119396){logger[_0xc2b6('0x13')](_0xc2b6('0xe'),_0x928bf4,_0x119396);_0x4ef2b8(_0x119396);});});}exports[_0xc2b6('0x16')]=function(_0x576a03){var _0x47e8c6=this;return new Promise(function(_0x50c6c8,_0x3474f2){return db[_0xc2b6('0x17')]['update'](_0x576a03[_0xc2b6('0x18')],{'raw':_0x576a03[_0xc2b6('0x19')]?_0x576a03[_0xc2b6('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x576a03[_0xc2b6('0x19')]?_0x576a03[_0xc2b6('0x19')][_0xc2b6('0x1a')]||null:null,'attributes':_0x576a03[_0xc2b6('0x19')]?_0x576a03[_0xc2b6('0x19')][_0xc2b6('0x1b')]||null:null,'limit':_0x576a03[_0xc2b6('0x19')]?_0x576a03[_0xc2b6('0x19')][_0xc2b6('0x1c')]||null:null})[_0xc2b6('0xc')](function(_0x3aaf75){logger[_0xc2b6('0xd')](_0xc2b6('0x16'),_0x576a03);logger[_0xc2b6('0x10')](_0xc2b6('0x16'),_0x576a03,JSON[_0xc2b6('0x12')](_0x3aaf75));_0x50c6c8(_0x3aaf75);})['catch'](function(_0x681bbf){logger[_0xc2b6('0x13')](_0xc2b6('0x16'),_0x681bbf[_0xc2b6('0x15')],_0x576a03);_0x3474f2(_0x47e8c6[_0xc2b6('0x13')](0x1f4,_0x681bbf[_0xc2b6('0x15')]));});});}; \ No newline at end of file +var _0x1763=['update','body','options','raw','attributes','limit','UpdateOpenchannelApplication','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelApplication,\x20%s,\x20%s','message','result','catch','OpenchannelApplication'];(function(_0x583a7b,_0x2561d8){var _0x23f652=function(_0x4ac81d){while(--_0x4ac81d){_0x583a7b['push'](_0x583a7b['shift']());}};_0x23f652(++_0x2561d8);}(_0x1763,0x15c));var _0x3176=function(_0x40d548,_0x233d52){_0x40d548=_0x40d548-0x0;var _0x1791f8=_0x1763[_0x40d548];return _0x1791f8;};'use strict';var _=require(_0x3176('0x0'));var util=require('util');var moment=require(_0x3176('0x1'));var BPromise=require('bluebird');var rs=require(_0x3176('0x2'));var fs=require('fs');var Redis=require(_0x3176('0x3'));var db=require(_0x3176('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3176('0x5'))(_0x3176('0x6'));var config=require(_0x3176('0x7'));var jayson=require(_0x3176('0x8'));var client=jayson[_0x3176('0x9')][_0x3176('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ab228,_0x2f4995,_0x571046){return new BPromise(function(_0x2a1b47,_0x929d4c){return client['request'](_0x5ab228,_0x571046)[_0x3176('0xb')](function(_0x377587){logger[_0x3176('0xc')]('OpenchannelApplication,\x20%s,\x20%s',_0x2f4995,_0x3176('0xd'));logger[_0x3176('0xe')](_0x3176('0xf'),_0x2f4995,_0x3176('0xd'),JSON[_0x3176('0x10')](_0x377587));if(_0x377587['error']){if(_0x377587[_0x3176('0x11')][_0x3176('0x12')]===0x1f4){logger['error'](_0x3176('0x13'),_0x2f4995,_0x377587[_0x3176('0x11')][_0x3176('0x14')]);return _0x929d4c(_0x377587[_0x3176('0x11')][_0x3176('0x14')]);}logger['error'](_0x3176('0x13'),_0x2f4995,_0x377587[_0x3176('0x11')]['message']);return _0x2a1b47(_0x377587['error'][_0x3176('0x14')]);}else{logger[_0x3176('0xc')](_0x3176('0x13'),_0x2f4995,_0x3176('0xd'));_0x2a1b47(_0x377587[_0x3176('0x15')][_0x3176('0x14')]);}})[_0x3176('0x16')](function(_0x2d8c3e){logger[_0x3176('0x11')](_0x3176('0x13'),_0x2f4995,_0x2d8c3e);_0x929d4c(_0x2d8c3e);});});}exports['UpdateOpenchannelApplication']=function(_0x430b66){var _0x91b727=this;return new Promise(function(_0x1edc6b,_0x1e727a){return db[_0x3176('0x17')][_0x3176('0x18')](_0x430b66[_0x3176('0x19')],{'raw':_0x430b66[_0x3176('0x1a')]?_0x430b66['options'][_0x3176('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x430b66[_0x3176('0x1a')]?_0x430b66[_0x3176('0x1a')]['where']||null:null,'attributes':_0x430b66['options']?_0x430b66[_0x3176('0x1a')][_0x3176('0x1c')]||null:null,'limit':_0x430b66[_0x3176('0x1a')]?_0x430b66[_0x3176('0x1a')][_0x3176('0x1d')]||null:null})[_0x3176('0xb')](function(_0x1f4572){logger['info']('UpdateOpenchannelApplication',_0x430b66);logger['debug'](_0x3176('0x1e'),_0x430b66,JSON[_0x3176('0x10')](_0x1f4572));_0x1edc6b(_0x1f4572);})[_0x3176('0x16')](function(_0x4118c3){logger[_0x3176('0x11')](_0x3176('0x1e'),_0x4118c3[_0x3176('0x14')],_0x430b66);_0x1e727a(_0x91b727[_0x3176('0x11')](0x1f4,_0x4118c3[_0x3176('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index bcfa5b3..997aa00 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 _0x2de9=['removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','/describe','describe','/:id','isAuthenticated','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy'];(function(_0x441a8b,_0x443d8b){var _0x23a72f=function(_0x472df4){while(--_0x472df4){_0x441a8b['push'](_0x441a8b['shift']());}};_0x23a72f(++_0x443d8b);}(_0x2de9,0x1ae));var _0x92de=function(_0x38c6db,_0x54e36f){_0x38c6db=_0x38c6db-0x0;var _0x19638d=_0x2de9[_0x38c6db];return _0x19638d;};'use strict';var multer=require(_0x92de('0x0'));var util=require(_0x92de('0x1'));var path=require(_0x92de('0x2'));var timeout=require(_0x92de('0x3'));var express=require(_0x92de('0x4'));var router=express[_0x92de('0x5')]();var fs_extra=require(_0x92de('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x92de('0x7'));var config=require(_0x92de('0x8'));var controller=require(_0x92de('0x9'));router[_0x92de('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x92de('0xb'),auth['isAuthenticated'](),controller[_0x92de('0xc')]);router[_0x92de('0xa')](_0x92de('0xd'),auth[_0x92de('0xe')](),controller[_0x92de('0xf')]);router[_0x92de('0xa')]('/:id/messages',auth[_0x92de('0xe')](),controller[_0x92de('0x10')]);router[_0x92de('0xa')](_0x92de('0x11'),auth[_0x92de('0xe')](),controller[_0x92de('0x12')]);router[_0x92de('0x13')]('/',auth['isAuthenticated'](),controller[_0x92de('0x14')]);router[_0x92de('0x13')](_0x92de('0x15'),auth[_0x92de('0xe')](),controller[_0x92de('0x16')]);router[_0x92de('0x13')](_0x92de('0x17'),auth[_0x92de('0xe')](),interaction[_0x92de('0x18')](_0x92de('0x19'),_0x92de('0x1a')),controller['addTags']);router[_0x92de('0x1b')](_0x92de('0xd'),auth['isAuthenticated'](),interaction[_0x92de('0x18')](_0x92de('0x19'),_0x92de('0x1c')),controller[_0x92de('0x1d')]);router[_0x92de('0x1e')]('/:id',auth[_0x92de('0xe')](),interaction[_0x92de('0x18')](_0x92de('0x19'),_0x92de('0x1f')),controller['destroy']);router[_0x92de('0x1e')](_0x92de('0x17'),auth[_0x92de('0xe')](),controller[_0x92de('0x20')]);module['exports']=router; \ No newline at end of file +var _0xd748=['describe','/:id','/:id/messages','getMessages','download','post','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index'];(function(_0x467cbd,_0x1f9c26){var _0x4d5c0a=function(_0x4bbc52){while(--_0x4bbc52){_0x467cbd['push'](_0x467cbd['shift']());}};_0x4d5c0a(++_0x1f9c26);}(_0xd748,0x1f2));var _0x8d74=function(_0x10852d,_0x4cdcc6){_0x10852d=_0x10852d-0x0;var _0x13a8d6=_0xd748[_0x10852d];return _0x13a8d6;};'use strict';var multer=require(_0x8d74('0x0'));var util=require(_0x8d74('0x1'));var path=require(_0x8d74('0x2'));var timeout=require(_0x8d74('0x3'));var express=require(_0x8d74('0x4'));var router=express[_0x8d74('0x5')]();var fs_extra=require(_0x8d74('0x6'));var auth=require(_0x8d74('0x7'));var interaction=require(_0x8d74('0x8'));var config=require(_0x8d74('0x9'));var controller=require(_0x8d74('0xa'));router[_0x8d74('0xb')]('/',auth[_0x8d74('0xc')](),controller[_0x8d74('0xd')]);router[_0x8d74('0xb')]('/describe',auth[_0x8d74('0xc')](),controller[_0x8d74('0xe')]);router[_0x8d74('0xb')](_0x8d74('0xf'),auth[_0x8d74('0xc')](),controller['show']);router[_0x8d74('0xb')](_0x8d74('0x10'),auth['isAuthenticated'](),controller[_0x8d74('0x11')]);router['get']('/:id/download',auth[_0x8d74('0xc')](),controller[_0x8d74('0x12')]);router[_0x8d74('0x13')]('/',auth[_0x8d74('0xc')](),controller['create']);router[_0x8d74('0x13')](_0x8d74('0x10'),auth[_0x8d74('0xc')](),controller['addMessage']);router[_0x8d74('0x13')](_0x8d74('0x14'),auth[_0x8d74('0xc')](),interaction[_0x8d74('0x15')](_0x8d74('0x16'),_0x8d74('0x17')),controller[_0x8d74('0x18')]);router['put']('/:id',auth[_0x8d74('0xc')](),interaction[_0x8d74('0x15')](_0x8d74('0x16'),_0x8d74('0x19')),controller[_0x8d74('0x1a')]);router[_0x8d74('0x1b')](_0x8d74('0xf'),auth['isAuthenticated'](),interaction[_0x8d74('0x15')](_0x8d74('0x16'),_0x8d74('0x1c')),controller[_0x8d74('0x1d')]);router[_0x8d74('0x1b')]('/:id/tags',auth[_0x8d74('0xc')](),controller[_0x8d74('0x1e')]);module[_0x8d74('0x1f')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 53738ae..9675e46 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 _0xbdb7=['BOOLEAN','DATE','STRING','out','ENUM','INTEGER','sequelize','exports'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x223b0c,_0x371c5a){_0x223b0c=_0x223b0c-0x0;var _0x4ce5ed=_0xbdb7[_0x223b0c];return _0x4ce5ed;};'use strict';var Sequelize=require(_0x7bdb('0x0'));module[_0x7bdb('0x1')]={'closed':{'type':Sequelize[_0x7bdb('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7bdb('0x3')]},'disposition':{'type':Sequelize[_0x7bdb('0x4')]},'secondDisposition':{'type':Sequelize[_0x7bdb('0x4')]},'thirdDisposition':{'type':Sequelize[_0x7bdb('0x4')]},'note':{'type':Sequelize[_0x7bdb('0x4')]},'read1stAt':{'type':Sequelize[_0x7bdb('0x3')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x7bdb('0x4')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x7bdb('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x7bdb('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x7bdb('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x7bdb('0x7')]}}; \ No newline at end of file +var _0x36e1=['exports','BOOLEAN','STRING','DATE','ENUM','out','INTEGER','sequelize'];(function(_0x597992,_0x516580){var _0x2bea67=function(_0x40b79f){while(--_0x40b79f){_0x597992['push'](_0x597992['shift']());}};_0x2bea67(++_0x516580);}(_0x36e1,0x187));var _0x136e=function(_0x2797c6,_0x37421b){_0x2797c6=_0x2797c6-0x0;var _0x54809f=_0x36e1[_0x2797c6];return _0x54809f;};'use strict';var Sequelize=require(_0x136e('0x0'));module[_0x136e('0x1')]={'closed':{'type':Sequelize[_0x136e('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x136e('0x3')]},'secondDisposition':{'type':Sequelize[_0x136e('0x3')]},'thirdDisposition':{'type':Sequelize[_0x136e('0x3')]},'note':{'type':Sequelize[_0x136e('0x3')]},'read1stAt':{'type':Sequelize[_0x136e('0x4')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x136e('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x136e('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x136e('0x5')]('in',_0x136e('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x136e('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x136e('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x136e('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index f0ec10c..78cf2e5 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 _0x6a22=['createReadStream','pipe','createWriteStream','out','Contact','read','value','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','error','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','zip-dir','moment','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','update','destroy','then','stack','name','send','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','openchannel','query','user','catch','show','from','params','keys','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','body','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','include','rows','addTags','setTags','color','openchannelInteractionTags:save','removeTags','toString','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','User','fullname','CmContact','firstName','lastName','push','Attachment','createdAt','direction','secret','OpenchannelAccount','Account','Owner','get','Openchannel','closed','closedAt','disposition','Public','Private','Messages','basename','existsSync'];(function(_0x54d49e,_0x5d9911){var _0x4af0f1=function(_0xf117b3){while(--_0xf117b3){_0x54d49e['push'](_0x54d49e['shift']());}};_0x4af0f1(++_0x5d9911);}(_0x6a22,0x11b));var _0x26a2=function(_0x39ce5a,_0x260622){_0x39ce5a=_0x39ce5a-0x0;var _0x46cd9a=_0x6a22[_0x39ce5a];return _0x46cd9a;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x26a2('0x0'));var moment=require(_0x26a2('0x1'));var util=require(_0x26a2('0x2'));var path=require(_0x26a2('0x3'));var ejs=require(_0x26a2('0x4'));var fs=require('fs');var _=require(_0x26a2('0x5'));var Redis=require(_0x26a2('0x6'));var interaction=require(_0x26a2('0x7'));var qs=require(_0x26a2('0x8'));var pdf=require(_0x26a2('0x9'));var logger=require(_0x26a2('0xa'))(_0x26a2('0xb'));var config=require(_0x26a2('0xc'));var db=require(_0x26a2('0xd'))['db'];config[_0x26a2('0xe')]=_['defaults'](config['redis'],{'host':_0x26a2('0xf'),'port':0x18eb});var socket=require(_0x26a2('0x10'))(new Redis(config[_0x26a2('0xe')]));require(_0x26a2('0x11'))[_0x26a2('0x12')](socket);function respondWithStatusCode(_0x422707,_0x373823){_0x373823=_0x373823||0xcc;return function(_0x4aa477){if(_0x4aa477){return _0x422707[_0x26a2('0x13')](_0x373823);}return _0x422707[_0x26a2('0x14')](_0x373823)[_0x26a2('0x15')]();};}function respondWithResult(_0x5a02eb,_0x5f5d4c){_0x5f5d4c=_0x5f5d4c||0xc8;return function(_0x5850e4){if(_0x5850e4){return _0x5a02eb[_0x26a2('0x14')](_0x5f5d4c)['json'](_0x5850e4);}};}function respondWithFilteredResult(_0x267ab3,_0x57b9a7){return function(_0xb23e4c){if(_0xb23e4c){var _0x41b565=typeof _0x57b9a7[_0x26a2('0x16')]===_0x26a2('0x17')&&typeof _0x57b9a7[_0x26a2('0x18')]===_0x26a2('0x17');var _0x588c9c=_0xb23e4c[_0x26a2('0x19')];var _0x43b916=_0x41b565?0x0:_0x57b9a7[_0x26a2('0x16')];var _0x149c81=_0x41b565?_0xb23e4c[_0x26a2('0x19')]:_0x57b9a7[_0x26a2('0x16')]+_0x57b9a7['limit'];var _0xe98017;if(_0x149c81>=_0x588c9c){_0x149c81=_0x588c9c;_0xe98017=0xc8;}else{_0xe98017=0xce;}_0x267ab3[_0x26a2('0x14')](_0xe98017);return _0x267ab3[_0x26a2('0x1a')]('Content-Range',_0x43b916+'-'+_0x149c81+'/'+_0x588c9c)[_0x26a2('0x1b')](_0xb23e4c);}return null;};}function saveUpdates(_0x1bc385){return function(_0x27c0dc){if(_0x27c0dc){return _0x27c0dc[_0x26a2('0x1c')](_0x1bc385)['then'](function(_0x510355){return _0x510355;});}return null;};}function removeEntity(_0x407b1d){return function(_0x401f97){if(_0x401f97){return _0x401f97[_0x26a2('0x1d')]()[_0x26a2('0x1e')](function(){_0x407b1d[_0x26a2('0x14')](0xcc)[_0x26a2('0x15')]();});}};}function handleEntityNotFound(_0x55c0b6){return function(_0x309bdd){if(!_0x309bdd){_0x55c0b6[_0x26a2('0x13')](0x194);}return _0x309bdd;};}function handleError(_0x415cf9,_0x1b54f5){_0x1b54f5=_0x1b54f5||0x1f4;return function(_0x3629f5){logger['error'](_0x3629f5[_0x26a2('0x1f')]);if(_0x3629f5[_0x26a2('0x20')]){delete _0x3629f5[_0x26a2('0x20')];}_0x415cf9['status'](_0x1b54f5)[_0x26a2('0x21')](_0x3629f5);};}exports[_0x26a2('0x22')]=function(_0x27d686,_0x302acd){var _0x31b3c5={};var _0xaa1ab9=_[_0x26a2('0x23')](db[_0x26a2('0x24')][_0x26a2('0x25')],function(_0x37467e){return{'name':_0x37467e[_0x26a2('0x26')],'type':_0x37467e[_0x26a2('0x27')][_0x26a2('0x28')]};});_0x31b3c5=qs[_0x26a2('0x29')](_0xaa1ab9,_0x27d686);return interaction[_0x26a2('0x2a')](_0x26a2('0x2b'),_0x27d686[_0x26a2('0x2c')],_0x27d686[_0x26a2('0x2d')],_0x31b3c5,_0xaa1ab9)[_0x26a2('0x1e')](respondWithFilteredResult(_0x302acd,_0x31b3c5))[_0x26a2('0x2e')](handleError(_0x302acd,null));};exports[_0x26a2('0x2f')]=function(_0x141300,_0x4c03d1){var _0x237386={};if(_0x141300['query'][_0x26a2('0x27')]&&_0x141300[_0x26a2('0x2c')][_0x26a2('0x27')]===_0x26a2('0x30')){_0x237386['from']=_0x141300[_0x26a2('0x31')]['id'];}else{_0x237386['id']=_0x141300[_0x26a2('0x31')]['id'];}var _0x3dcd24={'raw':![],'where':_0x237386},_0x4c607c={};_0x4c607c['model']=_[_0x26a2('0x32')](db['OpenchannelInteraction'][_0x26a2('0x25')]);_0x4c607c['query']=_[_0x26a2('0x32')](_0x141300['query']);_0x4c607c[_0x26a2('0x33')]=_[_0x26a2('0x34')](_0x4c607c[_0x26a2('0x35')],_0x4c607c[_0x26a2('0x2c')]);_0x3dcd24[_0x26a2('0x36')]=_['intersection'](_0x4c607c['model'],qs[_0x26a2('0x37')](_0x141300[_0x26a2('0x2c')][_0x26a2('0x37')]));_0x3dcd24[_0x26a2('0x36')]=_0x3dcd24[_0x26a2('0x36')][_0x26a2('0x38')]?_0x3dcd24['attributes']:_0x4c607c[_0x26a2('0x35')];if(_0x141300[_0x26a2('0x2c')][_0x26a2('0x39')]){_0x3dcd24['include']=[{'all':!![]}];}_0x3dcd24=_[_0x26a2('0x3a')]({},_0x3dcd24,_0x141300[_0x26a2('0x3b')]);return db['OpenchannelInteraction'][_0x26a2('0x3c')](_0x3dcd24)[_0x26a2('0x1e')](handleEntityNotFound(_0x4c03d1,null))[_0x26a2('0x1e')](respondWithResult(_0x4c03d1,null))['catch'](handleError(_0x4c03d1,null));};exports[_0x26a2('0x3d')]=function(_0x531f01,_0x277369){return db[_0x26a2('0x24')][_0x26a2('0x3d')](_0x531f01[_0x26a2('0x3e')],{})[_0x26a2('0x1e')](respondWithResult(_0x277369,0xc9))['catch'](handleError(_0x277369,null));};exports[_0x26a2('0x1c')]=function(_0x226952,_0x309f2e){if(_0x226952[_0x26a2('0x3e')]['id']){delete _0x226952[_0x26a2('0x3e')]['id'];}return db[_0x26a2('0x24')][_0x26a2('0x3c')]({'where':{'id':_0x226952[_0x26a2('0x31')]['id']}})[_0x26a2('0x1e')](handleEntityNotFound(_0x309f2e,null))[_0x26a2('0x1e')](saveUpdates(_0x226952[_0x26a2('0x3e')],null))[_0x26a2('0x1e')](respondWithResult(_0x309f2e,null))[_0x26a2('0x2e')](handleError(_0x309f2e,null));};exports[_0x26a2('0x1d')]=function(_0x3d7896,_0x5dd120){return db['OpenchannelInteraction'][_0x26a2('0x3c')]({'where':{'id':_0x3d7896[_0x26a2('0x31')]['id']}})[_0x26a2('0x1e')](handleEntityNotFound(_0x5dd120,null))[_0x26a2('0x1e')](removeEntity(_0x5dd120,null))['catch'](handleError(_0x5dd120,null));};exports[_0x26a2('0x3f')]=function(_0x47a2a1,_0x25939f){return db[_0x26a2('0x24')]['describe']()['then'](respondWithResult(_0x25939f,null))[_0x26a2('0x2e')](handleError(_0x25939f,null));};exports[_0x26a2('0x40')]=function(_0x55818e,_0x59167b){return db[_0x26a2('0x41')][_0x26a2('0x3c')]({'where':{'id':_0x55818e[_0x26a2('0x31')]['id']}})[_0x26a2('0x1e')](handleEntityNotFound(_0x59167b,null))['then'](function(_0x4aa3ac){if(_0x4aa3ac){return _0x4aa3ac[_0x26a2('0x40')](_0x55818e['body'][_0x26a2('0x42')],_[_0x26a2('0x43')](_0x55818e[_0x26a2('0x3e')],[_0x26a2('0x42'),'id'])||{});}})['then'](respondWithResult(_0x59167b,null))['catch'](handleError(_0x59167b,null));};exports[_0x26a2('0x44')]=function(_0x1f60fb,_0x1b095e){var _0x306491={'raw':![],'where':{}};var _0x4c3977={};var _0x54acdd={'count':0x0,'rows':[]};return db[_0x26a2('0x24')][_0x26a2('0x45')]({'where':{'id':_0x1f60fb['params']['id']}})[_0x26a2('0x1e')](handleEntityNotFound(_0x1b095e,null))[_0x26a2('0x1e')](function(_0xe3a381){if(_0xe3a381){_0x4c3977[_0x26a2('0x35')]=_['keys'](db[_0x26a2('0x41')][_0x26a2('0x25')]);_0x4c3977['query']=_[_0x26a2('0x32')](_0x1f60fb[_0x26a2('0x2c')]);_0x4c3977[_0x26a2('0x33')]=_[_0x26a2('0x34')](_0x4c3977[_0x26a2('0x35')],_0x4c3977[_0x26a2('0x2c')]);_0x306491[_0x26a2('0x36')]=_['intersection'](_0x4c3977[_0x26a2('0x35')],qs[_0x26a2('0x37')](_0x1f60fb[_0x26a2('0x2c')][_0x26a2('0x37')]));_0x306491[_0x26a2('0x36')]=_0x306491['attributes'][_0x26a2('0x38')]?_0x306491[_0x26a2('0x36')]:_0x4c3977['model'];if(!_0x1f60fb[_0x26a2('0x2c')]['hasOwnProperty'](_0x26a2('0x46'))){_0x306491[_0x26a2('0x18')]=qs[_0x26a2('0x18')](_0x1f60fb[_0x26a2('0x2c')]['limit']);_0x306491['offset']=qs[_0x26a2('0x16')](_0x1f60fb[_0x26a2('0x2c')][_0x26a2('0x16')]);}_0x306491[_0x26a2('0x47')]=qs[_0x26a2('0x48')](_0x1f60fb[_0x26a2('0x2c')]['sort']);_0x306491[_0x26a2('0x49')]=qs['filters'](_[_0x26a2('0x4a')](_0x1f60fb[_0x26a2('0x2c')],_0x4c3977[_0x26a2('0x33')]));_0x306491['where'][_0x26a2('0x4b')]=_0xe3a381['id'];if(_0x1f60fb[_0x26a2('0x2c')][_0x26a2('0x4c')]){_0x306491[_0x26a2('0x49')]=_['merge'](_0x306491[_0x26a2('0x49')],{'$or':_[_0x26a2('0x23')](_0x306491[_0x26a2('0x36')],function(_0x28a736){var _0x1e48b1={};_0x1e48b1[_0x28a736]={'$like':'%'+_0x1f60fb['query']['filter']+'%'};return _0x1e48b1;})});}if(_0x1f60fb[_0x26a2('0x2c')][_0x26a2('0x4d')]){var _0x5450be=_0x1f60fb[_0x26a2('0x2c')]['$gte'][_0x26a2('0x4e')](',');var _0x447655={};_0x447655[_0x5450be[0x0]]={'$gte':moment(_0x5450be[0x1])[_0x26a2('0x4f')](_0x26a2('0x50'))};_0x306491['where']=_[_0x26a2('0x3a')](_0x306491['where'],_0x447655);}_0x306491=_[_0x26a2('0x3a')]({},_0x306491,_0x1f60fb[_0x26a2('0x3b')]);return db[_0x26a2('0x41')][_0x26a2('0x19')]({'where':_0x306491['where']})[_0x26a2('0x1e')](function(_0x1fa3ba){_0x54acdd[_0x26a2('0x19')]=_0x1fa3ba;if(_0x1f60fb[_0x26a2('0x2c')]['includeAll']){_0x306491[_0x26a2('0x51')]=[{'all':!![]}];}return db[_0x26a2('0x41')][_0x26a2('0x2a')](_0x306491);})[_0x26a2('0x1e')](function(_0x5ccf29){_0x54acdd[_0x26a2('0x52')]=_0x5ccf29;return _0x54acdd;});}})[_0x26a2('0x1e')](respondWithFilteredResult(_0x1b095e,_0x306491))[_0x26a2('0x2e')](handleError(_0x1b095e,null));};exports[_0x26a2('0x53')]=function(_0x2b2db7,_0x355e3e){return db[_0x26a2('0x24')]['find']({'where':{'id':_0x2b2db7[_0x26a2('0x31')]['id']}})[_0x26a2('0x1e')](handleEntityNotFound(_0x355e3e,null))[_0x26a2('0x1e')](function(_0x419ae8){if(_0x419ae8){return _0x419ae8[_0x26a2('0x54')](_0x2b2db7[_0x26a2('0x3e')]['ids'],_['omit'](_0x2b2db7['body'],['ids','id'])||{})['spread'](function(){return db['Tag'][_0x26a2('0x2a')]({'attributes':['id',_0x26a2('0x20'),_0x26a2('0x55')],'where':{'id':_0x2b2db7[_0x26a2('0x3e')][_0x26a2('0x42')]}});})[_0x26a2('0x1e')](function(_0x44ac74){socket['emit'](_0x26a2('0x56'),{'id':Number(_0x2b2db7[_0x26a2('0x31')]['id']),'tags':_0x44ac74||[]});return{'id':Number(_0x2b2db7[_0x26a2('0x31')]['id']),'tags':_0x44ac74||[]};});}})[_0x26a2('0x1e')](respondWithResult(_0x355e3e,null))[_0x26a2('0x2e')](handleError(_0x355e3e,null));};exports[_0x26a2('0x57')]=function(_0x3df5c0,_0x4f298c){return db['OpenchannelInteraction']['find']({'where':{'id':_0x3df5c0[_0x26a2('0x31')]['id']}})['then'](handleEntityNotFound(_0x4f298c,null))[_0x26a2('0x1e')](function(_0x4e3630){if(_0x4e3630){return _0x4e3630[_0x26a2('0x57')](_0x3df5c0[_0x26a2('0x2c')][_0x26a2('0x42')]);}})[_0x26a2('0x1e')](respondWithStatusCode(_0x4f298c,null))[_0x26a2('0x2e')](handleError(_0x4f298c,null));};exports['download']=function(_0x5c3394,_0x207567){var _0x4a5ff4=moment()['unix']()[_0x26a2('0x58')]();var _0x5d70c8=path[_0x26a2('0x59')](config[_0x26a2('0x5a')],'server',_0x26a2('0x5b'),_0x26a2('0x5c'));var _0x35b85b=path['join'](config[_0x26a2('0x5a')],_0x26a2('0x5d'),_0x26a2('0x5b'),_0x26a2('0x5e'));var _0x526b06=path[_0x26a2('0x59')](_0x5d70c8,_0x4a5ff4);var _0xb84566=util[_0x26a2('0x4f')](_0x26a2('0x5f'),_0x5c3394['params']['id'],_0x4a5ff4);var _0x4365f6=path[_0x26a2('0x59')](_0x5d70c8,_0xb84566);var _0x2b4d04=[];_0x2b4d04['push']({'model':db[_0x26a2('0x60')],'as':_0x26a2('0x60'),'attributes':['id',_0x26a2('0x61')],'raw':!![]});_0x2b4d04['push']({'model':db[_0x26a2('0x62')],'as':'Contact','attributes':['id',_0x26a2('0x63'),_0x26a2('0x64')],'raw':!![]});if(_0x5c3394[_0x26a2('0x2c')][_0x26a2('0x5e')]){_0x2b4d04[_0x26a2('0x65')]({'model':db['Attachment'],'as':_0x26a2('0x66'),'raw':!![]});}var _0x2ebb96=[{'model':db[_0x26a2('0x41')],'as':'Messages','attributes':['id',_0x26a2('0x3e'),_0x26a2('0x67'),_0x26a2('0x68'),_0x26a2('0x69'),'read'],'include':_0x2b4d04}];_0x2ebb96[_0x26a2('0x65')]({'model':db[_0x26a2('0x6a')],'as':_0x26a2('0x6b'),'attributes':['id',_0x26a2('0x20')]});_0x2ebb96[_0x26a2('0x65')]({'model':db[_0x26a2('0x60')],'as':_0x26a2('0x6c'),'attributes':['id',_0x26a2('0x61')]});return db[_0x26a2('0x24')][_0x26a2('0x3c')]({'where':{'id':_0x5c3394[_0x26a2('0x31')]['id']},'include':_0x2ebb96})['then'](handleEntityNotFound(_0x207567,null))[_0x26a2('0x1e')](function(_0x3df7ea){if(_0x3df7ea){var _0x55e9b6=_0x3df7ea[_0x26a2('0x6d')]({'plain':!![]});fs['mkdirSync'](_0x526b06);var _0x57539d={'channel':_0x26a2('0x6e'),'account':_0x55e9b6[_0x26a2('0x6b')][_0x26a2('0x20')],'agent':_0x55e9b6[_0x26a2('0x6c')]?_0x55e9b6[_0x26a2('0x6c')]['fullname']:'N.A.','createdAt':moment(_0x55e9b6['createdAt'])['format'](_0x26a2('0x50'))['toString'](),'closedAt':_0x55e9b6[_0x26a2('0x6f')]?moment(_0x55e9b6[_0x26a2('0x70')])[_0x26a2('0x4f')](_0x26a2('0x50'))[_0x26a2('0x58')]():'','disposition':_0x55e9b6[_0x26a2('0x71')],'visibility':_0x55e9b6['threadId']?_0x26a2('0x72'):_0x26a2('0x73'),'messages':_(_0x55e9b6[_0x26a2('0x74')])[_0x26a2('0x4c')]({'secret':![]})[_0x26a2('0x23')](function(_0x20fe10){if(_0x20fe10[_0x26a2('0x66')]){var _0x547102=path['join'](_0x35b85b,_0x20fe10[_0x26a2('0x66')][_0x26a2('0x75')]);if(fs[_0x26a2('0x76')](_0x547102)){fs[_0x26a2('0x77')](_0x547102)[_0x26a2('0x78')](fs[_0x26a2('0x79')](path[_0x26a2('0x59')](_0x526b06,_0x20fe10[_0x26a2('0x66')][_0x26a2('0x75')])));}}return{'date':moment(_0x20fe10[_0x26a2('0x67')])[_0x26a2('0x4f')](_0x26a2('0x50'))[_0x26a2('0x58')](),'sender':_0x20fe10[_0x26a2('0x68')]===_0x26a2('0x7a')?_0x20fe10[_0x26a2('0x60')]?_0x20fe10[_0x26a2('0x60')]['fullname']:'System':_0x20fe10[_0x26a2('0x7b')][_0x26a2('0x63')]+(_0x20fe10[_0x26a2('0x7b')][_0x26a2('0x64')]?'\x20'+_0x20fe10['Contact']['lastName']:''),'body':_0x20fe10['Attachment']?_0x20fe10[_0x26a2('0x66')]['basename']:_0x20fe10[_0x26a2('0x3e')],'direction':_0x20fe10[_0x26a2('0x68')]===_0x26a2('0x7a')?'A':'C','secret':_0x20fe10[_0x26a2('0x69')],'read':_0x20fe10[_0x26a2('0x7c')],'attachment':_0x20fe10[_0x26a2('0x66')]};})[_0x26a2('0x7d')]()};return ejs['renderFile'](path['join'](config[_0x26a2('0x5a')],_0x26a2('0x5d'),'views',_0x26a2('0x7e')),{'interaction':_0x57539d})[_0x26a2('0x1e')](function(_0x5886a3){var _0x17421d=path[_0x26a2('0x59')](_0x526b06,_0x26a2('0x7f')+_0x55e9b6['id']+'-'+_0x4a5ff4+_0x26a2('0x80'));var _0x564ba5={'path':_0x17421d,'channel':_0x26a2('0x6e'),'interactionId':_0x55e9b6['id']};return pdf[_0x26a2('0x81')](_0x5886a3,_0x564ba5);})['then'](function(){return new Promise(function(_0x2b6c35,_0x18c54b){zipdir(_0x526b06,{'saveTo':_0x4365f6},function(_0x3d6a64,_0x4d1822){if(_0x3d6a64)return _0x18c54b(_0x3d6a64);return _0x2b6c35(_0x4d1822);});})[_0x26a2('0x1e')](function(){return new Promise(function(_0x3dc154,_0x480dbe){rimraf(_0x526b06,function(_0x4b617e){if(_0x4b617e)_0x480dbe(_0x4b617e);return _0x3dc154();});});})[_0x26a2('0x1e')](function(){return _0x207567[_0x26a2('0x82')](_0x4365f6,_0xb84566,function(_0x5ddb64){if(_0x5ddb64){logger[_0x26a2('0x83')](_0x26a2('0x84'),_0x5ddb64);}else{fs[_0x26a2('0x85')](_0x4365f6);}});});});}else{return _0x207567[_0x26a2('0x13')](0xc8);}})[_0x26a2('0x2e')](handleError(_0x207567,null));}; \ No newline at end of file +var _0x29bd=['error','stack','name','send','index','map','OpenchannelInteraction','rawAttributes','type','key','getOptions','openchannel','user','catch','from','params','model','keys','query','filters','intersection','attributes','fields','includeAll','include','merge','find','create','body','describe','addMessage','OpenchannelMessage','ids','length','hasOwnProperty','nolimit','order','sort','where','OpenchannelInteractionId','filter','$gte','split','rows','addTags','omit','spread','Tag','findAll','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','server','files','tmp','join','attachments','format','transcript-%d-%s.zip','push','User','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','secret','read','OpenchannelAccount','Account','fullname','get','mkdirSync','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','threadId','Public','Private','existsSync','createReadStream','pipe','createWriteStream','direction','out','System','basename','root','views','downloadInteraction.ejs','Openchannel','createPdfFromHTML','unlinkSync','rimraf','zip-dir','moment','util','path','ejs','lodash','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','end','status','offset','undefined','limit','count','set','Content-Range','json','update','destroy','then','sendStatus'];(function(_0x57486e,_0x32283b){var _0x5f110b=function(_0xa18fc3){while(--_0xa18fc3){_0x57486e['push'](_0x57486e['shift']());}};_0x5f110b(++_0x32283b);}(_0x29bd,0x16c));var _0xd29b=function(_0x538229,_0x1844c7){_0x538229=_0x538229-0x0;var _0x2557f5=_0x29bd[_0x538229];return _0x2557f5;};'use strict';var rimraf=require(_0xd29b('0x0'));var zipdir=require(_0xd29b('0x1'));var moment=require(_0xd29b('0x2'));var util=require(_0xd29b('0x3'));var path=require(_0xd29b('0x4'));var ejs=require(_0xd29b('0x5'));var fs=require('fs');var _=require(_0xd29b('0x6'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0xd29b('0x7'));var pdf=require(_0xd29b('0x8'));var logger=require(_0xd29b('0x9'))(_0xd29b('0xa'));var config=require(_0xd29b('0xb'));var db=require(_0xd29b('0xc'))['db'];config[_0xd29b('0xd')]=_[_0xd29b('0xe')](config[_0xd29b('0xd')],{'host':_0xd29b('0xf'),'port':0x18eb});var socket=require(_0xd29b('0x10'))(new Redis(config[_0xd29b('0xd')]));require(_0xd29b('0x11'))[_0xd29b('0x12')](socket);function respondWithStatusCode(_0x2b49cb,_0x784dc){_0x784dc=_0x784dc||0xcc;return function(_0x43e19b){if(_0x43e19b){return _0x2b49cb['sendStatus'](_0x784dc);}return _0x2b49cb['status'](_0x784dc)[_0xd29b('0x13')]();};}function respondWithResult(_0x3031fc,_0x1102c3){_0x1102c3=_0x1102c3||0xc8;return function(_0x5be87d){if(_0x5be87d){return _0x3031fc[_0xd29b('0x14')](_0x1102c3)['json'](_0x5be87d);}};}function respondWithFilteredResult(_0x11fb2d,_0x11bf4d){return function(_0x3bae6a){if(_0x3bae6a){var _0x5b367f=typeof _0x11bf4d[_0xd29b('0x15')]===_0xd29b('0x16')&&typeof _0x11bf4d[_0xd29b('0x17')]===_0xd29b('0x16');var _0xf5664c=_0x3bae6a[_0xd29b('0x18')];var _0x4a91d4=_0x5b367f?0x0:_0x11bf4d[_0xd29b('0x15')];var _0x2d72a7=_0x5b367f?_0x3bae6a[_0xd29b('0x18')]:_0x11bf4d[_0xd29b('0x15')]+_0x11bf4d[_0xd29b('0x17')];var _0x3c0122;if(_0x2d72a7>=_0xf5664c){_0x2d72a7=_0xf5664c;_0x3c0122=0xc8;}else{_0x3c0122=0xce;}_0x11fb2d[_0xd29b('0x14')](_0x3c0122);return _0x11fb2d[_0xd29b('0x19')](_0xd29b('0x1a'),_0x4a91d4+'-'+_0x2d72a7+'/'+_0xf5664c)[_0xd29b('0x1b')](_0x3bae6a);}return null;};}function saveUpdates(_0x21b9ca){return function(_0x8e7982){if(_0x8e7982){return _0x8e7982[_0xd29b('0x1c')](_0x21b9ca)['then'](function(_0x5a21cc){return _0x5a21cc;});}return null;};}function removeEntity(_0x21206a){return function(_0xaf4a93){if(_0xaf4a93){return _0xaf4a93[_0xd29b('0x1d')]()[_0xd29b('0x1e')](function(){_0x21206a[_0xd29b('0x14')](0xcc)[_0xd29b('0x13')]();});}};}function handleEntityNotFound(_0x8b8b55){return function(_0x8a8736){if(!_0x8a8736){_0x8b8b55[_0xd29b('0x1f')](0x194);}return _0x8a8736;};}function handleError(_0x28f683,_0x2d223a){_0x2d223a=_0x2d223a||0x1f4;return function(_0x56ca21){logger[_0xd29b('0x20')](_0x56ca21[_0xd29b('0x21')]);if(_0x56ca21['name']){delete _0x56ca21[_0xd29b('0x22')];}_0x28f683[_0xd29b('0x14')](_0x2d223a)[_0xd29b('0x23')](_0x56ca21);};}exports[_0xd29b('0x24')]=function(_0x1774a4,_0x2bc678){var _0x1c71ca={};var _0x1ef447=_[_0xd29b('0x25')](db[_0xd29b('0x26')][_0xd29b('0x27')],function(_0x1017af){return{'name':_0x1017af['fieldName'],'type':_0x1017af[_0xd29b('0x28')][_0xd29b('0x29')]};});_0x1c71ca=qs[_0xd29b('0x2a')](_0x1ef447,_0x1774a4);return interaction['findAll'](_0xd29b('0x2b'),_0x1774a4['query'],_0x1774a4[_0xd29b('0x2c')],_0x1c71ca,_0x1ef447)[_0xd29b('0x1e')](respondWithFilteredResult(_0x2bc678,_0x1c71ca))[_0xd29b('0x2d')](handleError(_0x2bc678,null));};exports['show']=function(_0x1d21b6,_0x469238){var _0x506699={};if(_0x1d21b6['query'][_0xd29b('0x28')]&&_0x1d21b6['query'][_0xd29b('0x28')]===_0xd29b('0x2e')){_0x506699[_0xd29b('0x2e')]=_0x1d21b6[_0xd29b('0x2f')]['id'];}else{_0x506699['id']=_0x1d21b6['params']['id'];}var _0x57e151={'raw':![],'where':_0x506699},_0x428a5b={};_0x428a5b[_0xd29b('0x30')]=_[_0xd29b('0x31')](db[_0xd29b('0x26')][_0xd29b('0x27')]);_0x428a5b[_0xd29b('0x32')]=_[_0xd29b('0x31')](_0x1d21b6['query']);_0x428a5b[_0xd29b('0x33')]=_[_0xd29b('0x34')](_0x428a5b[_0xd29b('0x30')],_0x428a5b[_0xd29b('0x32')]);_0x57e151[_0xd29b('0x35')]=_['intersection'](_0x428a5b[_0xd29b('0x30')],qs['fields'](_0x1d21b6[_0xd29b('0x32')][_0xd29b('0x36')]));_0x57e151['attributes']=_0x57e151[_0xd29b('0x35')]['length']?_0x57e151[_0xd29b('0x35')]:_0x428a5b['model'];if(_0x1d21b6['query'][_0xd29b('0x37')]){_0x57e151[_0xd29b('0x38')]=[{'all':!![]}];}_0x57e151=_[_0xd29b('0x39')]({},_0x57e151,_0x1d21b6['options']);return db['OpenchannelInteraction'][_0xd29b('0x3a')](_0x57e151)[_0xd29b('0x1e')](handleEntityNotFound(_0x469238,null))[_0xd29b('0x1e')](respondWithResult(_0x469238,null))[_0xd29b('0x2d')](handleError(_0x469238,null));};exports[_0xd29b('0x3b')]=function(_0x3df4ac,_0x226733){return db[_0xd29b('0x26')][_0xd29b('0x3b')](_0x3df4ac[_0xd29b('0x3c')],{})[_0xd29b('0x1e')](respondWithResult(_0x226733,0xc9))[_0xd29b('0x2d')](handleError(_0x226733,null));};exports[_0xd29b('0x1c')]=function(_0x4b26a3,_0x3cf5de){if(_0x4b26a3['body']['id']){delete _0x4b26a3[_0xd29b('0x3c')]['id'];}return db['OpenchannelInteraction'][_0xd29b('0x3a')]({'where':{'id':_0x4b26a3[_0xd29b('0x2f')]['id']}})[_0xd29b('0x1e')](handleEntityNotFound(_0x3cf5de,null))['then'](saveUpdates(_0x4b26a3['body'],null))[_0xd29b('0x1e')](respondWithResult(_0x3cf5de,null))[_0xd29b('0x2d')](handleError(_0x3cf5de,null));};exports['destroy']=function(_0x199393,_0x500bca){return db[_0xd29b('0x26')][_0xd29b('0x3a')]({'where':{'id':_0x199393[_0xd29b('0x2f')]['id']}})[_0xd29b('0x1e')](handleEntityNotFound(_0x500bca,null))[_0xd29b('0x1e')](removeEntity(_0x500bca,null))[_0xd29b('0x2d')](handleError(_0x500bca,null));};exports[_0xd29b('0x3d')]=function(_0x17303c,_0x3b5bc0){return db[_0xd29b('0x26')]['describe']()[_0xd29b('0x1e')](respondWithResult(_0x3b5bc0,null))['catch'](handleError(_0x3b5bc0,null));};exports[_0xd29b('0x3e')]=function(_0x48c65b,_0xcbf835){return db[_0xd29b('0x3f')][_0xd29b('0x3a')]({'where':{'id':_0x48c65b[_0xd29b('0x2f')]['id']}})['then'](handleEntityNotFound(_0xcbf835,null))['then'](function(_0x237fae){if(_0x237fae){return _0x237fae[_0xd29b('0x3e')](_0x48c65b[_0xd29b('0x3c')][_0xd29b('0x40')],_['omit'](_0x48c65b[_0xd29b('0x3c')],[_0xd29b('0x40'),'id'])||{});}})[_0xd29b('0x1e')](respondWithResult(_0xcbf835,null))[_0xd29b('0x2d')](handleError(_0xcbf835,null));};exports['getMessages']=function(_0x134813,_0x3b020e){var _0x3ec92c={'raw':![],'where':{}};var _0x4b6d5a={};var _0x4221bf={'count':0x0,'rows':[]};return db[_0xd29b('0x26')]['findOne']({'where':{'id':_0x134813[_0xd29b('0x2f')]['id']}})[_0xd29b('0x1e')](handleEntityNotFound(_0x3b020e,null))[_0xd29b('0x1e')](function(_0x2cb812){if(_0x2cb812){_0x4b6d5a[_0xd29b('0x30')]=_[_0xd29b('0x31')](db[_0xd29b('0x3f')][_0xd29b('0x27')]);_0x4b6d5a[_0xd29b('0x32')]=_['keys'](_0x134813['query']);_0x4b6d5a[_0xd29b('0x33')]=_['intersection'](_0x4b6d5a['model'],_0x4b6d5a[_0xd29b('0x32')]);_0x3ec92c[_0xd29b('0x35')]=_['intersection'](_0x4b6d5a[_0xd29b('0x30')],qs['fields'](_0x134813['query'][_0xd29b('0x36')]));_0x3ec92c[_0xd29b('0x35')]=_0x3ec92c[_0xd29b('0x35')][_0xd29b('0x41')]?_0x3ec92c[_0xd29b('0x35')]:_0x4b6d5a[_0xd29b('0x30')];if(!_0x134813[_0xd29b('0x32')][_0xd29b('0x42')](_0xd29b('0x43'))){_0x3ec92c[_0xd29b('0x17')]=qs[_0xd29b('0x17')](_0x134813['query'][_0xd29b('0x17')]);_0x3ec92c[_0xd29b('0x15')]=qs[_0xd29b('0x15')](_0x134813[_0xd29b('0x32')][_0xd29b('0x15')]);}_0x3ec92c[_0xd29b('0x44')]=qs[_0xd29b('0x45')](_0x134813[_0xd29b('0x32')][_0xd29b('0x45')]);_0x3ec92c[_0xd29b('0x46')]=qs['filters'](_['pick'](_0x134813[_0xd29b('0x32')],_0x4b6d5a['filters']));_0x3ec92c[_0xd29b('0x46')][_0xd29b('0x47')]=_0x2cb812['id'];if(_0x134813[_0xd29b('0x32')]['filter']){_0x3ec92c[_0xd29b('0x46')]=_[_0xd29b('0x39')](_0x3ec92c['where'],{'$or':_['map'](_0x3ec92c[_0xd29b('0x35')],function(_0x19fa4c){var _0x53a267={};_0x53a267[_0x19fa4c]={'$like':'%'+_0x134813[_0xd29b('0x32')][_0xd29b('0x48')]+'%'};return _0x53a267;})});}if(_0x134813[_0xd29b('0x32')][_0xd29b('0x49')]){var _0x2db764=_0x134813[_0xd29b('0x32')]['$gte'][_0xd29b('0x4a')](',');var _0x371ec4={};_0x371ec4[_0x2db764[0x0]]={'$gte':moment(_0x2db764[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x3ec92c[_0xd29b('0x46')]=_['merge'](_0x3ec92c[_0xd29b('0x46')],_0x371ec4);}_0x3ec92c=_[_0xd29b('0x39')]({},_0x3ec92c,_0x134813['options']);return db['OpenchannelMessage'][_0xd29b('0x18')]({'where':_0x3ec92c[_0xd29b('0x46')]})[_0xd29b('0x1e')](function(_0x53a932){_0x4221bf[_0xd29b('0x18')]=_0x53a932;if(_0x134813[_0xd29b('0x32')][_0xd29b('0x37')]){_0x3ec92c['include']=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x3ec92c);})[_0xd29b('0x1e')](function(_0x44cbab){_0x4221bf[_0xd29b('0x4b')]=_0x44cbab;return _0x4221bf;});}})[_0xd29b('0x1e')](respondWithFilteredResult(_0x3b020e,_0x3ec92c))[_0xd29b('0x2d')](handleError(_0x3b020e,null));};exports[_0xd29b('0x4c')]=function(_0x5172bc,_0x1a12db){return db['OpenchannelInteraction'][_0xd29b('0x3a')]({'where':{'id':_0x5172bc['params']['id']}})['then'](handleEntityNotFound(_0x1a12db,null))[_0xd29b('0x1e')](function(_0x1a8c03){if(_0x1a8c03){return _0x1a8c03['setTags'](_0x5172bc[_0xd29b('0x3c')][_0xd29b('0x40')],_[_0xd29b('0x4d')](_0x5172bc[_0xd29b('0x3c')],[_0xd29b('0x40'),'id'])||{})[_0xd29b('0x4e')](function(){return db[_0xd29b('0x4f')][_0xd29b('0x50')]({'attributes':['id',_0xd29b('0x22'),'color'],'where':{'id':_0x5172bc[_0xd29b('0x3c')][_0xd29b('0x40')]}});})[_0xd29b('0x1e')](function(_0x3751c9){socket[_0xd29b('0x51')](_0xd29b('0x52'),{'id':Number(_0x5172bc[_0xd29b('0x2f')]['id']),'tags':_0x3751c9||[]});return{'id':Number(_0x5172bc[_0xd29b('0x2f')]['id']),'tags':_0x3751c9||[]};});}})[_0xd29b('0x1e')](respondWithResult(_0x1a12db,null))[_0xd29b('0x2d')](handleError(_0x1a12db,null));};exports[_0xd29b('0x53')]=function(_0x4a0abc,_0x1bb336){return db[_0xd29b('0x26')][_0xd29b('0x3a')]({'where':{'id':_0x4a0abc[_0xd29b('0x2f')]['id']}})[_0xd29b('0x1e')](handleEntityNotFound(_0x1bb336,null))[_0xd29b('0x1e')](function(_0x507a58){if(_0x507a58){return _0x507a58[_0xd29b('0x53')](_0x4a0abc[_0xd29b('0x32')][_0xd29b('0x40')]);}})[_0xd29b('0x1e')](respondWithStatusCode(_0x1bb336,null))['catch'](handleError(_0x1bb336,null));};exports[_0xd29b('0x54')]=function(_0x129855,_0x5c49b3){var _0xfa9dcb=moment()[_0xd29b('0x55')]()[_0xd29b('0x56')]();var _0x8decf8=path['join'](config['root'],_0xd29b('0x57'),_0xd29b('0x58'),_0xd29b('0x59'));var _0x4307a3=path[_0xd29b('0x5a')](config['root'],_0xd29b('0x57'),_0xd29b('0x58'),_0xd29b('0x5b'));var _0x55cf30=path[_0xd29b('0x5a')](_0x8decf8,_0xfa9dcb);var _0x102fa1=util[_0xd29b('0x5c')](_0xd29b('0x5d'),_0x129855[_0xd29b('0x2f')]['id'],_0xfa9dcb);var _0x5e68b5=path['join'](_0x8decf8,_0x102fa1);var _0x4bc4bd=[];_0x4bc4bd[_0xd29b('0x5e')]({'model':db[_0xd29b('0x5f')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x4bc4bd['push']({'model':db[_0xd29b('0x60')],'as':_0xd29b('0x61'),'attributes':['id',_0xd29b('0x62'),_0xd29b('0x63')],'raw':!![]});if(_0x129855[_0xd29b('0x32')][_0xd29b('0x5b')]){_0x4bc4bd[_0xd29b('0x5e')]({'model':db[_0xd29b('0x64')],'as':_0xd29b('0x64'),'raw':!![]});}var _0x5c305c=[{'model':db[_0xd29b('0x3f')],'as':_0xd29b('0x65'),'attributes':['id',_0xd29b('0x3c'),_0xd29b('0x66'),'direction',_0xd29b('0x67'),_0xd29b('0x68')],'include':_0x4bc4bd}];_0x5c305c[_0xd29b('0x5e')]({'model':db[_0xd29b('0x69')],'as':_0xd29b('0x6a'),'attributes':['id',_0xd29b('0x22')]});_0x5c305c[_0xd29b('0x5e')]({'model':db[_0xd29b('0x5f')],'as':'Owner','attributes':['id',_0xd29b('0x6b')]});return db[_0xd29b('0x26')]['find']({'where':{'id':_0x129855['params']['id']},'include':_0x5c305c})[_0xd29b('0x1e')](handleEntityNotFound(_0x5c49b3,null))[_0xd29b('0x1e')](function(_0x2238aa){if(_0x2238aa){var _0x2ec334=_0x2238aa[_0xd29b('0x6c')]({'plain':!![]});fs[_0xd29b('0x6d')](_0x55cf30);var _0x612919={'channel':'Openchannel','account':_0x2ec334['Account'][_0xd29b('0x22')],'agent':_0x2ec334[_0xd29b('0x6e')]?_0x2ec334[_0xd29b('0x6e')][_0xd29b('0x6b')]:_0xd29b('0x6f'),'createdAt':moment(_0x2ec334[_0xd29b('0x66')])['format'](_0xd29b('0x70'))[_0xd29b('0x56')](),'closedAt':_0x2ec334[_0xd29b('0x71')]?moment(_0x2ec334[_0xd29b('0x72')])[_0xd29b('0x5c')](_0xd29b('0x70'))['toString']():'','disposition':_0x2ec334['disposition'],'visibility':_0x2ec334[_0xd29b('0x73')]?_0xd29b('0x74'):_0xd29b('0x75'),'messages':_(_0x2ec334[_0xd29b('0x65')])[_0xd29b('0x48')]({'secret':![]})[_0xd29b('0x25')](function(_0x59c23c){if(_0x59c23c['Attachment']){var _0x5cd67b=path[_0xd29b('0x5a')](_0x4307a3,_0x59c23c[_0xd29b('0x64')]['basename']);if(fs[_0xd29b('0x76')](_0x5cd67b)){fs[_0xd29b('0x77')](_0x5cd67b)[_0xd29b('0x78')](fs[_0xd29b('0x79')](path[_0xd29b('0x5a')](_0x55cf30,_0x59c23c[_0xd29b('0x64')]['basename'])));}}return{'date':moment(_0x59c23c[_0xd29b('0x66')])['format'](_0xd29b('0x70'))[_0xd29b('0x56')](),'sender':_0x59c23c[_0xd29b('0x7a')]===_0xd29b('0x7b')?_0x59c23c[_0xd29b('0x5f')]?_0x59c23c[_0xd29b('0x5f')][_0xd29b('0x6b')]:_0xd29b('0x7c'):_0x59c23c[_0xd29b('0x61')][_0xd29b('0x62')]+(_0x59c23c[_0xd29b('0x61')][_0xd29b('0x63')]?'\x20'+_0x59c23c[_0xd29b('0x61')][_0xd29b('0x63')]:''),'body':_0x59c23c['Attachment']?_0x59c23c['Attachment'][_0xd29b('0x7d')]:_0x59c23c[_0xd29b('0x3c')],'direction':_0x59c23c['direction']===_0xd29b('0x7b')?'A':'C','secret':_0x59c23c['secret'],'read':_0x59c23c[_0xd29b('0x68')],'attachment':_0x59c23c[_0xd29b('0x64')]};})['value']()};return ejs['renderFile'](path[_0xd29b('0x5a')](config[_0xd29b('0x7e')],_0xd29b('0x57'),_0xd29b('0x7f'),_0xd29b('0x80')),{'interaction':_0x612919})[_0xd29b('0x1e')](function(_0x56d217){var _0x9d57e5=path['join'](_0x55cf30,'transcript-'+_0x2ec334['id']+'-'+_0xfa9dcb+'.pdf');var _0x5ef02e={'path':_0x9d57e5,'channel':_0xd29b('0x81'),'interactionId':_0x2ec334['id']};return pdf[_0xd29b('0x82')](_0x56d217,_0x5ef02e);})[_0xd29b('0x1e')](function(){return new Promise(function(_0x265cd6,_0x4675e3){zipdir(_0x55cf30,{'saveTo':_0x5e68b5},function(_0x429fe6,_0x2362df){if(_0x429fe6)return _0x4675e3(_0x429fe6);return _0x265cd6(_0x2362df);});})[_0xd29b('0x1e')](function(){return new Promise(function(_0x45c488,_0x4674a8){rimraf(_0x55cf30,function(_0xa13b3f){if(_0xa13b3f)_0x4674a8(_0xa13b3f);return _0x45c488();});});})[_0xd29b('0x1e')](function(){return _0x5c49b3[_0xd29b('0x54')](_0x5e68b5,_0x102fa1,function(_0x400965){if(_0x400965){logger[_0xd29b('0x20')]('Unable\x20to\x20delete\x20zip\x20file',_0x400965);}else{fs[_0xd29b('0x83')](_0x5e68b5);}});});});}else{return _0x5c49b3[_0xd29b('0x1f')](0xc8);}})['catch'](handleError(_0x5c49b3,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 8d6c4dc..fc7ffa6 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 _0x9a6e=['setDataValue','Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','then'];(function(_0x48ffda,_0x27b8b5){var _0x1f9eab=function(_0x16f871){while(--_0x16f871){_0x48ffda['push'](_0x48ffda['shift']());}};_0x1f9eab(++_0x27b8b5);}(_0x9a6e,0xd2));var _0xe9a6=function(_0x2f2cb6,_0x5f5576){_0x2f2cb6=_0x2f2cb6-0x0;var _0x33c4a7=_0x9a6e[_0x2f2cb6];return _0x33c4a7;};'use strict';var EventEmitter=require(_0xe9a6('0x0'));var OpenchannelInteraction=require(_0xe9a6('0x1'))['db'][_0xe9a6('0x2')];var OpenchannelMessage=require(_0xe9a6('0x1'))['db'][_0xe9a6('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xe9a6('0x4')](0x0);var events={'afterCreate':_0xe9a6('0x5'),'afterUpdate':_0xe9a6('0x6'),'afterDestroy':_0xe9a6('0x7')};function emitEvent(_0x9d4a4){return function(_0x3b24f7,_0x443892,_0x3c6291){_0x3b24f7[_0xe9a6('0x8')]({'attributes':['id'],'raw':!![]})[_0xe9a6('0x9')](function(_0xfd6c4c){_0x3b24f7[_0xe9a6('0xa')](_0xe9a6('0xb'),_0xfd6c4c[_0xe9a6('0xc')](function(_0x515254){return{'id':_0x515254['id']};}));return OpenchannelMessage[_0xe9a6('0xd')]({'where':{'OpenchannelInteractionId':_0x3b24f7['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe9a6('0x9')](function(_0x1d7860){_0x3b24f7[_0xe9a6('0xa')](_0xe9a6('0xe'),_0x1d7860[_0xe9a6('0xf')]);OpenchannelInteractionEvents['emit'](_0x9d4a4+':'+_0x3b24f7['id'],_0x3b24f7);OpenchannelInteractionEvents[_0xe9a6('0x10')](_0x9d4a4,_0x3b24f7);_0x3c6291(null);})['catch'](_0x3c6291(null));};}for(var e in events){if(events[_0xe9a6('0x11')](e)){var event=events[e];OpenchannelInteraction[_0xe9a6('0x12')](e,emitEvent(event));}}module[_0xe9a6('0x13')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x4e23=['setMaxListeners','remove','getUsers','then','setDataValue','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','OpenchannelInteraction','../../mysqldb','OpenchannelMessage'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x4e23,0x183));var _0x34e2=function(_0x8b2fb8,_0x547221){_0x8b2fb8=_0x8b2fb8-0x0;var _0x28059e=_0x4e23[_0x8b2fb8];return _0x28059e;};'use strict';var EventEmitter=require(_0x34e2('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x34e2('0x1')];var OpenchannelMessage=require(_0x34e2('0x2'))['db'][_0x34e2('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x34e2('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x34e2('0x5')};function emitEvent(_0x13133a){return function(_0x37c662,_0x542035,_0x35c8da){_0x37c662[_0x34e2('0x6')]({'attributes':['id'],'raw':!![]})[_0x34e2('0x7')](function(_0x1cabac){_0x37c662[_0x34e2('0x8')]('Users',_0x1cabac['map'](function(_0x53922c){return{'id':_0x53922c['id']};}));return OpenchannelMessage[_0x34e2('0x9')]({'where':{'OpenchannelInteractionId':_0x37c662['id'],'direction':'in','read':![]},'raw':!![]});})[_0x34e2('0x7')](function(_0x1069a7){_0x37c662['setDataValue'](_0x34e2('0xa'),_0x1069a7[_0x34e2('0xb')]);OpenchannelInteractionEvents['emit'](_0x13133a+':'+_0x37c662['id'],_0x37c662);OpenchannelInteractionEvents[_0x34e2('0xc')](_0x13133a,_0x37c662);_0x35c8da(null);})[_0x34e2('0xd')](_0x35c8da(null));};}for(var e in events){if(events[_0x34e2('0xe')](e)){var event=events[e];OpenchannelInteraction[_0x34e2('0xf')](e,emitEvent(event));}}module[_0x34e2('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 6b2e1f0..43d1dec 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 _0x3308=['openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','path','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction'];(function(_0x2f8357,_0x10480f){var _0x235b63=function(_0x3d9087){while(--_0x3d9087){_0x2f8357['push'](_0x2f8357['shift']());}};_0x235b63(++_0x10480f);}(_0x3308,0x16b));var _0x8330=function(_0xee591,_0x1437ac){_0xee591=_0xee591-0x0;var _0x182fbd=_0x3308[_0xee591];return _0x182fbd;};'use strict';var _=require(_0x8330('0x0'));var util=require(_0x8330('0x1'));var logger=require(_0x8330('0x2'))(_0x8330('0x3'));var moment=require(_0x8330('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8330('0x5'));var rimraf=require('rimraf');var config=require(_0x8330('0x6'));var attributes=require(_0x8330('0x7'));module[_0x8330('0x8')]=function(_0x498340,_0x5b2bb3){return _0x498340[_0x8330('0x9')](_0x8330('0xa'),attributes,{'tableName':_0x8330('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8330('0xc'),'collate':_0x8330('0xd'),'hooks':{'beforeUpdate':function(_0x39bb7d,_0x33a4f1,_0x2e9760){if(_0x39bb7d[_0x8330('0xe')](_0x8330('0xf'))){_0x39bb7d['closedAt']=moment()['format'](_0x8330('0x10'));}_0x2e9760(null,_0x39bb7d);}}});}; \ No newline at end of file +var _0xbcd9=['utf8mb4_unicode_ci','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','utf8mb4'];(function(_0x414549,_0x5829e0){var _0x3f488c=function(_0x3b97e4){while(--_0x3b97e4){_0x414549['push'](_0x414549['shift']());}};_0x3f488c(++_0x5829e0);}(_0xbcd9,0x105));var _0x9bcd=function(_0xaf292,_0x38baae){_0xaf292=_0xaf292-0x0;var _0x32a0d1=_0xbcd9[_0xaf292];return _0x32a0d1;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x9bcd('0x0'));var moment=require(_0x9bcd('0x1'));var BPromise=require(_0x9bcd('0x2'));var rp=require(_0x9bcd('0x3'));var fs=require('fs');var path=require(_0x9bcd('0x4'));var rimraf=require('rimraf');var config=require(_0x9bcd('0x5'));var attributes=require(_0x9bcd('0x6'));module[_0x9bcd('0x7')]=function(_0x21779f,_0x49b73b){return _0x21779f[_0x9bcd('0x8')](_0x9bcd('0x9'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9bcd('0xa'),'collate':_0x9bcd('0xb'),'hooks':{'beforeUpdate':function(_0x3e3680,_0x469cbd,_0xa6583e){if(_0x3e3680[_0x9bcd('0xc')]('closed')){_0x3e3680[_0x9bcd('0xd')]=moment()[_0x9bcd('0xe')](_0x9bcd('0xf'));}_0xa6583e(null,_0x3e3680);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 39da2bd..fb3fb24 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 _0x8971=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','register','request','info','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','attributes','limit','then','AddTagsToOpenchannelInteraction','find','addTags','omit','ids','spread','AddTags'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x8971,0x1b8));var _0x1897=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x8971[_0x255d5b];return _0x3e141a;};'use strict';var _=require(_0x1897('0x0'));var util=require(_0x1897('0x1'));var moment=require(_0x1897('0x2'));var BPromise=require(_0x1897('0x3'));var rs=require(_0x1897('0x4'));var fs=require('fs');var Redis=require(_0x1897('0x5'));var db=require(_0x1897('0x6'))['db'];var utils=require(_0x1897('0x7'));var logger=require(_0x1897('0x8'))('rpc');var config=require(_0x1897('0x9'));var jayson=require(_0x1897('0xa'));var client=jayson[_0x1897('0xb')][_0x1897('0xc')]({'port':0x232a});config[_0x1897('0xd')]=_[_0x1897('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1897('0xd')]));require('./openchannelInteraction.socket')[_0x1897('0xf')](socket);function respondWithRpcPromise(_0x5a66dc,_0x517666,_0x433fc1){return new BPromise(function(_0x23fe59,_0x354a68){return client[_0x1897('0x10')](_0x5a66dc,_0x433fc1)['then'](function(_0x54afee){logger[_0x1897('0x11')](_0x1897('0x12'),_0x517666,'request\x20sent');logger[_0x1897('0x13')](_0x1897('0x14'),_0x517666,_0x1897('0x15'),JSON[_0x1897('0x16')](_0x54afee));if(_0x54afee[_0x1897('0x17')]){if(_0x54afee[_0x1897('0x17')]['code']===0x1f4){logger[_0x1897('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x517666,_0x54afee[_0x1897('0x17')][_0x1897('0x18')]);return _0x354a68(_0x54afee[_0x1897('0x17')][_0x1897('0x18')]);}logger[_0x1897('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x517666,_0x54afee[_0x1897('0x17')][_0x1897('0x18')]);return _0x23fe59(_0x54afee[_0x1897('0x17')]['message']);}else{logger[_0x1897('0x11')](_0x1897('0x12'),_0x517666,'request\x20sent');_0x23fe59(_0x54afee[_0x1897('0x19')][_0x1897('0x18')]);}})[_0x1897('0x1a')](function(_0x7fec3a){logger[_0x1897('0x17')](_0x1897('0x12'),_0x517666,_0x7fec3a);_0x354a68(_0x7fec3a);});});}exports[_0x1897('0x1b')]=function(_0x23a1c7){var _0x244062=this;return new Promise(function(_0x407304,_0x9d8f3e){return db[_0x1897('0x1c')][_0x1897('0x1d')](_0x23a1c7[_0x1897('0x1e')],{'raw':_0x23a1c7[_0x1897('0x1f')]?_0x23a1c7['options'][_0x1897('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23a1c7[_0x1897('0x1f')]?_0x23a1c7[_0x1897('0x1f')][_0x1897('0x21')]||null:null,'attributes':_0x23a1c7['options']?_0x23a1c7[_0x1897('0x1f')][_0x1897('0x22')]||null:null,'limit':_0x23a1c7[_0x1897('0x1f')]?_0x23a1c7[_0x1897('0x1f')][_0x1897('0x23')]||null:null})[_0x1897('0x24')](function(_0x52e1f0){logger[_0x1897('0x11')]('UpdateOpenchannelInteraction',_0x23a1c7);logger[_0x1897('0x13')](_0x1897('0x1b'),_0x23a1c7,JSON[_0x1897('0x16')](_0x52e1f0));_0x407304(_0x52e1f0);})[_0x1897('0x1a')](function(_0xe9f089){logger[_0x1897('0x17')]('UpdateOpenchannelInteraction',_0xe9f089[_0x1897('0x18')],_0x23a1c7);_0x9d8f3e(_0x244062[_0x1897('0x17')](0x1f4,_0xe9f089[_0x1897('0x18')]));});});};exports[_0x1897('0x25')]=function(_0x9fc8a2){return new Promise(function(_0x4abde9,_0x1809a9){return db['OpenchannelInteraction'][_0x1897('0x26')]({'where':_0x9fc8a2[_0x1897('0x1f')]?_0x9fc8a2[_0x1897('0x1f')]['where']||null:null})[_0x1897('0x24')](function(_0x543377){if(_0x543377){return _0x543377[_0x1897('0x27')](_0x9fc8a2[_0x1897('0x1e')]['ids'],_[_0x1897('0x28')](_0x9fc8a2['body'],[_0x1897('0x29'),'id'])||{});}})[_0x1897('0x2a')](function(_0x3d4b46){logger[_0x1897('0x11')](_0x1897('0x2b'),_0x9fc8a2);logger[_0x1897('0x13')]('AddTags',_0x9fc8a2,JSON[_0x1897('0x16')](_0x3d4b46));_0x4abde9(_0x3d4b46);})['catch'](function(_0x43489a){logger[_0x1897('0x17')](_0x1897('0x2b'),_0x43489a['message'],_0x9fc8a2);_0x1809a9(_this['error'](0x1f4,_0x43489a[_0x1897('0x18')]));});});}; \ No newline at end of file +var _0x75a5=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateOpenchannelInteraction','update','body','options','raw','stringify','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','where','ids','omit','spread','AddTags','moment','randomstring'];(function(_0x3b52af,_0x53b4ca){var _0x4b3c6c=function(_0x589446){while(--_0x589446){_0x3b52af['push'](_0x3b52af['shift']());}};_0x4b3c6c(++_0x53b4ca);}(_0x75a5,0x1ea));var _0x575a=function(_0x209577,_0xb63b8f){_0x209577=_0x209577-0x0;var _0x47a69a=_0x75a5[_0x209577];return _0x47a69a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x575a('0x0'));var BPromise=require('bluebird');var rs=require(_0x575a('0x1'));var fs=require('fs');var Redis=require(_0x575a('0x2'));var db=require(_0x575a('0x3'))['db'];var utils=require(_0x575a('0x4'));var logger=require(_0x575a('0x5'))(_0x575a('0x6'));var config=require(_0x575a('0x7'));var jayson=require(_0x575a('0x8'));var client=jayson[_0x575a('0x9')][_0x575a('0xa')]({'port':0x232a});config[_0x575a('0xb')]=_['defaults'](config['redis'],{'host':_0x575a('0xc'),'port':0x18eb});var socket=require(_0x575a('0xd'))(new Redis(config[_0x575a('0xb')]));require(_0x575a('0xe'))['register'](socket);function respondWithRpcPromise(_0x23f4d1,_0x1eb5c4,_0x3084d2){return new BPromise(function(_0x130459,_0x56f269){return client[_0x575a('0xf')](_0x23f4d1,_0x3084d2)[_0x575a('0x10')](function(_0x3f84fc){logger[_0x575a('0x11')](_0x575a('0x12'),_0x1eb5c4,_0x575a('0x13'));logger[_0x575a('0x14')](_0x575a('0x15'),_0x1eb5c4,_0x575a('0x13'),JSON['stringify'](_0x3f84fc));if(_0x3f84fc['error']){if(_0x3f84fc[_0x575a('0x16')][_0x575a('0x17')]===0x1f4){logger[_0x575a('0x16')](_0x575a('0x12'),_0x1eb5c4,_0x3f84fc['error']['message']);return _0x56f269(_0x3f84fc['error']['message']);}logger['error'](_0x575a('0x12'),_0x1eb5c4,_0x3f84fc[_0x575a('0x16')][_0x575a('0x18')]);return _0x130459(_0x3f84fc[_0x575a('0x16')][_0x575a('0x18')]);}else{logger['info'](_0x575a('0x12'),_0x1eb5c4,_0x575a('0x13'));_0x130459(_0x3f84fc[_0x575a('0x19')][_0x575a('0x18')]);}})[_0x575a('0x1a')](function(_0x5865a5){logger[_0x575a('0x16')](_0x575a('0x12'),_0x1eb5c4,_0x5865a5);_0x56f269(_0x5865a5);});});}exports[_0x575a('0x1b')]=function(_0x219b89){var _0x2a18b9=this;return new Promise(function(_0x45f599,_0x145f56){return db['OpenchannelInteraction'][_0x575a('0x1c')](_0x219b89[_0x575a('0x1d')],{'raw':_0x219b89[_0x575a('0x1e')]?_0x219b89[_0x575a('0x1e')][_0x575a('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x219b89[_0x575a('0x1e')]?_0x219b89[_0x575a('0x1e')]['where']||null:null,'attributes':_0x219b89['options']?_0x219b89[_0x575a('0x1e')]['attributes']||null:null,'limit':_0x219b89[_0x575a('0x1e')]?_0x219b89[_0x575a('0x1e')]['limit']||null:null})[_0x575a('0x10')](function(_0x156faa){logger[_0x575a('0x11')]('UpdateOpenchannelInteraction',_0x219b89);logger[_0x575a('0x14')](_0x575a('0x1b'),_0x219b89,JSON[_0x575a('0x20')](_0x156faa));_0x45f599(_0x156faa);})[_0x575a('0x1a')](function(_0x4429b2){logger['error'](_0x575a('0x1b'),_0x4429b2[_0x575a('0x18')],_0x219b89);_0x145f56(_0x2a18b9[_0x575a('0x16')](0x1f4,_0x4429b2[_0x575a('0x18')]));});});};exports[_0x575a('0x21')]=function(_0x57d1a8){return new Promise(function(_0x458ba2,_0x4c9de3){return db[_0x575a('0x22')][_0x575a('0x23')]({'where':_0x57d1a8[_0x575a('0x1e')]?_0x57d1a8[_0x575a('0x1e')][_0x575a('0x24')]||null:null})[_0x575a('0x10')](function(_0x16b4db){if(_0x16b4db){return _0x16b4db['addTags'](_0x57d1a8[_0x575a('0x1d')][_0x575a('0x25')],_[_0x575a('0x26')](_0x57d1a8['body'],[_0x575a('0x25'),'id'])||{});}})[_0x575a('0x27')](function(_0xa13ae5){logger[_0x575a('0x11')](_0x575a('0x28'),_0x57d1a8);logger[_0x575a('0x14')](_0x575a('0x28'),_0x57d1a8,JSON[_0x575a('0x20')](_0xa13ae5));_0x458ba2(_0xa13ae5);})[_0x575a('0x1a')](function(_0x28ef96){logger['error'](_0x575a('0x28'),_0x28ef96[_0x575a('0x18')],_0x57d1a8);_0x4c9de3(_this['error'](0x1f4,_0x28ef96[_0x575a('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 6e4f91f..f4f209f 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 _0x532a=['removeListener','register','./openchannelInteraction.events','save','update','emit'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x532a,0x1ee));var _0xa532=function(_0x4d2583,_0x52bd89){_0x4d2583=_0x4d2583-0x0;var _0x57fa3a=_0x532a[_0x4d2583];return _0x57fa3a;};'use strict';var OpenchannelInteractionEvents=require(_0xa532('0x0'));var events=[_0xa532('0x1'),'remove',_0xa532('0x2')];function createListener(_0x160c24,_0x553e80){return function(_0x208758){_0x553e80[_0xa532('0x3')](_0x160c24,_0x208758);};}function removeListener(_0x3e4f3a,_0x3f6617){return function(){OpenchannelInteractionEvents[_0xa532('0x4')](_0x3e4f3a,_0x3f6617);};}exports[_0xa532('0x5')]=function(_0x130c8d){for(var _0x7e79cc=0x0,_0x118416=events['length'];_0x7e79cc<_0x118416;_0x7e79cc++){var _0x54e67d=events[_0x7e79cc];var _0x2b9381=createListener('openchannelInteraction:'+_0x54e67d,_0x130c8d);OpenchannelInteractionEvents['on'](_0x54e67d,_0x2b9381);}}; \ No newline at end of file +var _0xb347=['update','removeListener','register','length','openchannelInteraction:','save','remove'];(function(_0x3636e0,_0x464dab){var _0x984370=function(_0x16c17f){while(--_0x16c17f){_0x3636e0['push'](_0x3636e0['shift']());}};_0x984370(++_0x464dab);}(_0xb347,0x1e8));var _0x7b34=function(_0x2d7e78,_0x57432b){_0x2d7e78=_0x2d7e78-0x0;var _0x4e4f16=_0xb347[_0x2d7e78];return _0x4e4f16;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x7b34('0x0'),_0x7b34('0x1'),_0x7b34('0x2')];function createListener(_0x56baf4,_0x43c464){return function(_0x151c56){_0x43c464['emit'](_0x56baf4,_0x151c56);};}function removeListener(_0x3becac,_0x240089){return function(){OpenchannelInteractionEvents[_0x7b34('0x3')](_0x3becac,_0x240089);};}exports[_0x7b34('0x4')]=function(_0x2e85b7){for(var _0x4b898e=0x0,_0xf8c69d=events[_0x7b34('0x5')];_0x4b898e<_0xf8c69d;_0x4b898e++){var _0x44f87f=events[_0x4b898e];var _0x1815ae=createListener(_0x7b34('0x6')+_0x44f87f,_0x2e85b7);OpenchannelInteractionEvents['on'](_0x44f87f,_0x1815ae);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index feb15e1..f7036d0 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['put','update','/:id/accept','accept','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','describe','get','/:id','show','post','openchannel','openchannelmessage:create','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x70e0,0x17b));var _0x070e=function(_0x13392b,_0x165387){_0x13392b=_0x13392b-0x0;var _0x37693e=_0x70e0[_0x13392b];return _0x37693e;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x070e('0xe'),_0x070e('0xf')),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x12')]);router[_0x070e('0x11')](_0x070e('0x13'),auth[_0x070e('0x8')](),controller[_0x070e('0x14')]);router['put']('/:id/reject',auth[_0x070e('0x8')](),controller['reject']);router['delete']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x15')]);module['exports']=router; \ No newline at end of file +var _0x9c44=['index','get','/describe','/:id','show','tracked','openchannel','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelMessage.controller','isAuthenticated'];(function(_0x2f5a27,_0x575ae6){var _0x37bf23=function(_0x358e99){while(--_0x358e99){_0x2f5a27['push'](_0x2f5a27['shift']());}};_0x37bf23(++_0x575ae6);}(_0x9c44,0x178));var _0x49c4=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x9c44[_0x24061a];return _0x82054e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x49c4('0xd')](_0x49c4('0xe'),'openchannelmessage:create'),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0x11')]);router[_0x49c4('0x10')]('/:id/accept',auth[_0x49c4('0x7')](),controller[_0x49c4('0x12')]);router['put'](_0x49c4('0x13'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);router[_0x49c4('0x15')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x16')]);module[_0x49c4('0x17')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index d30c1e5..3bb54fa 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 _0x574d=['out','DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x574d,0xc0));var _0xd574=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x574d[_0x3b0731];return _0x4204d7;};'use strict';var Sequelize=require(_0xd574('0x0'));module[_0xd574('0x1')]={'body':{'type':Sequelize[_0xd574('0x2')](_0xd574('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xd574('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xd574('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd574('0x5')]('in','out'),'defaultValue':_0xd574('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xd574('0x7')]},'providerName':{'type':Sequelize[_0xd574('0x8')]},'providerResponse':{'type':Sequelize[_0xd574('0x2')]}}; \ No newline at end of file +var _0x49db=['medium','BOOLEAN','ENUM','out','STRING','sequelize','exports','TEXT'];(function(_0x5ed8f8,_0x245c75){var _0x1eddd2=function(_0x17c56b){while(--_0x17c56b){_0x5ed8f8['push'](_0x5ed8f8['shift']());}};_0x1eddd2(++_0x245c75);}(_0x49db,0xc5));var _0xb49d=function(_0x4c8e60,_0x260f03){_0x4c8e60=_0x4c8e60-0x0;var _0x5e1e62=_0x49db[_0x4c8e60];return _0x5e1e62;};'use strict';var Sequelize=require(_0xb49d('0x0'));module[_0xb49d('0x1')]={'body':{'type':Sequelize[_0xb49d('0x2')](_0xb49d('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xb49d('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xb49d('0x5')]('in',_0xb49d('0x6')),'defaultValue':_0xb49d('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xb49d('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 80c1f73..1ec511f 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 _0x8b19=['register','jayson/promise','client','http','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','undefined','limit','offset','set','Content-Range','apply','reject','save','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','length','sort','where','filters','pick','filter','merge','VIRTUAL','options','OpenchannelMessage','count','includeAll','include','findAll','rows','show','fields','find','create','body','update','params','describe','openchannel','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','stringify','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','openchannel-interactions','RejectMessage','rejectMessage','email','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter'];(function(_0x4be797,_0x98238d){var _0x5b0c57=function(_0x465e77){while(--_0x465e77){_0x4be797['push'](_0x4be797['shift']());}};_0x5b0c57(++_0x98238d);}(_0x8b19,0xec));var _0x98b1=function(_0x536d6a,_0x1b5e9f){_0x536d6a=_0x536d6a-0x0;var _0x26ded3=_0x8b19[_0x536d6a];return _0x26ded3;};'use strict';var emlformat=require(_0x98b1('0x0'));var rimraf=require(_0x98b1('0x1'));var zipdir=require(_0x98b1('0x2'));var jsonpatch=require(_0x98b1('0x3'));var rp=require(_0x98b1('0x4'));var moment=require(_0x98b1('0x5'));var BPromise=require(_0x98b1('0x6'));var Mustache=require('mustache');var util=require(_0x98b1('0x7'));var path=require(_0x98b1('0x8'));var sox=require(_0x98b1('0x9'));var csv=require(_0x98b1('0xa'));var ejs=require(_0x98b1('0xb'));var fs=require('fs');var fs_extra=require(_0x98b1('0xc'));var _=require(_0x98b1('0xd'));var squel=require('squel');var crypto=require(_0x98b1('0xe'));var jsforce=require(_0x98b1('0xf'));var deskjs=require(_0x98b1('0x10'));var toCsv=require(_0x98b1('0xa'));var querystring=require(_0x98b1('0x11'));var Papa=require(_0x98b1('0x12'));var Redis=require('ioredis');var authService=require(_0x98b1('0x13'));var qs=require(_0x98b1('0x14'));var as=require(_0x98b1('0x15'));var hardwareService=require(_0x98b1('0x16'));var logger=require(_0x98b1('0x17'))(_0x98b1('0x18'));var utils=require(_0x98b1('0x19'));var config=require(_0x98b1('0x1a'));var licenseUtil=require(_0x98b1('0x1b'));var db=require(_0x98b1('0x1c'))['db'];config[_0x98b1('0x1d')]=_['defaults'](config[_0x98b1('0x1d')],{'host':_0x98b1('0x1e'),'port':0x18eb});var socket=require(_0x98b1('0x1f'))(new Redis(config[_0x98b1('0x1d')]));require('./openchannelMessage.socket')[_0x98b1('0x20')](socket);var jayson=require(_0x98b1('0x21'));var client=jayson[_0x98b1('0x22')]['http']({'port':0x232c});var client9002=jayson[_0x98b1('0x22')][_0x98b1('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x14620d,_0xb30f93,_0x160bea,_0x4c882f){return new BPromise(function(_0x525f77,_0x3a0922){var _0x4d04b7=_0x4c882f||client;return _0x4d04b7['request'](_0x14620d,_0x160bea)[_0x98b1('0x24')](function(_0xcf020f){logger[_0x98b1('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0xb30f93,_0x98b1('0x26'));logger[_0x98b1('0x27')](_0x98b1('0x28'),_0xb30f93,_0x98b1('0x26'),JSON['stringify'](_0xcf020f));if(_0xcf020f[_0x98b1('0x29')]){if(_0xcf020f[_0x98b1('0x29')][_0x98b1('0x2a')]===0x1f4){logger[_0x98b1('0x29')](_0x98b1('0x2b'),_0xb30f93,_0xcf020f[_0x98b1('0x29')][_0x98b1('0x2c')]);return _0x3a0922(_0xcf020f[_0x98b1('0x29')][_0x98b1('0x2c')]);}logger[_0x98b1('0x29')](_0x98b1('0x2b'),_0xb30f93,_0xcf020f['error'][_0x98b1('0x2c')]);return _0x525f77(_0xcf020f['error'][_0x98b1('0x2c')]);}else{logger['info'](_0x98b1('0x2b'),_0xb30f93,_0x98b1('0x26'));_0x525f77(_0xcf020f[_0x98b1('0x2d')][_0x98b1('0x2c')]);}})[_0x98b1('0x2e')](function(_0x29fc74){logger[_0x98b1('0x29')]('OpenchannelMessage,\x20%s,\x20%s',_0xb30f93,_0x29fc74);_0x3a0922(_0x29fc74);});});}function respondWithStatusCode(_0x30cd2f,_0x3ffe71){_0x3ffe71=_0x3ffe71||0xcc;return function(_0x102e28){if(_0x102e28){return _0x30cd2f[_0x98b1('0x2f')](_0x3ffe71);}return _0x30cd2f[_0x98b1('0x30')](_0x3ffe71)[_0x98b1('0x31')]();};}function respondWithResult(_0x3ed3df,_0x546e81){_0x546e81=_0x546e81||0xc8;return function(_0x3cb40a){if(_0x3cb40a){return _0x3ed3df[_0x98b1('0x30')](_0x546e81)['json'](_0x3cb40a);}};}function respondWithFilteredResult(_0x18a544,_0x23bc5f){return function(_0x1acf7b){if(_0x1acf7b){var _0x1deafc=typeof _0x23bc5f['offset']===_0x98b1('0x32')&&typeof _0x23bc5f[_0x98b1('0x33')]==='undefined';var _0x446b7f=_0x1acf7b['count'];var _0x233edf=_0x1deafc?0x0:_0x23bc5f['offset'];var _0x56d5b4=_0x1deafc?_0x1acf7b['count']:_0x23bc5f[_0x98b1('0x34')]+_0x23bc5f[_0x98b1('0x33')];var _0x4e0217;if(_0x56d5b4>=_0x446b7f){_0x56d5b4=_0x446b7f;_0x4e0217=0xc8;}else{_0x4e0217=0xce;}_0x18a544['status'](_0x4e0217);return _0x18a544[_0x98b1('0x35')](_0x98b1('0x36'),_0x233edf+'-'+_0x56d5b4+'/'+_0x446b7f)['json'](_0x1acf7b);}return null;};}function patchUpdates(_0xb4348c){return function(_0x46cbb2){try{jsonpatch[_0x98b1('0x37')](_0x46cbb2,_0xb4348c,!![]);}catch(_0x376b31){return BPromise[_0x98b1('0x38')](_0x376b31);}return _0x46cbb2[_0x98b1('0x39')]();};}function saveUpdates(_0x4be3c4,_0x18f4cd){return function(_0x4e9e7b){if(_0x4e9e7b){return _0x4e9e7b['update'](_0x4be3c4)[_0x98b1('0x24')](function(_0x379554){return _0x379554;});}return null;};}function removeEntity(_0x19a8c3,_0x47fca1){return function(_0x311763){if(_0x311763){return _0x311763['destroy']()[_0x98b1('0x24')](function(){_0x19a8c3[_0x98b1('0x30')](0xcc)[_0x98b1('0x31')]();});}};}function handleEntityNotFound(_0x5f1c56,_0x1d5165){return function(_0x2a625b){if(!_0x2a625b){_0x5f1c56[_0x98b1('0x2f')](0x194);}return _0x2a625b;};}function handleError(_0x4ab3ed,_0x558b4b){_0x558b4b=_0x558b4b||0x1f4;return function(_0x3446d6){logger[_0x98b1('0x29')](_0x3446d6[_0x98b1('0x3a')]);if(_0x3446d6[_0x98b1('0x3b')]){delete _0x3446d6[_0x98b1('0x3b')];}_0x4ab3ed[_0x98b1('0x30')](_0x558b4b)['send'](_0x3446d6);};}exports[_0x98b1('0x3c')]=function(_0x5a6e0b,_0x2cda3a){var _0xfcfc7d={},_0x11a981={},_0x5280a7={'count':0x0,'rows':[]};var _0x2f79be=_['map'](db['OpenchannelMessage'][_0x98b1('0x3d')],function(_0x54fcb3){return{'name':_0x54fcb3[_0x98b1('0x3e')],'type':_0x54fcb3[_0x98b1('0x3f')][_0x98b1('0x40')]};});_0x11a981[_0x98b1('0x41')]=_[_0x98b1('0x42')](_0x2f79be,_0x98b1('0x3b'));_0x11a981[_0x98b1('0x43')]=_[_0x98b1('0x44')](_0x5a6e0b[_0x98b1('0x43')]);_0x11a981['filters']=_['intersection'](_0x11a981['model'],_0x11a981['query']);_0xfcfc7d[_0x98b1('0x45')]=_[_0x98b1('0x46')](_0x11a981[_0x98b1('0x41')],qs['fields'](_0x5a6e0b[_0x98b1('0x43')]['fields']));_0xfcfc7d[_0x98b1('0x45')]=_0xfcfc7d[_0x98b1('0x45')][_0x98b1('0x47')]?_0xfcfc7d[_0x98b1('0x45')]:_0x11a981[_0x98b1('0x41')];if(!_0x5a6e0b[_0x98b1('0x43')]['hasOwnProperty']('nolimit')){_0xfcfc7d[_0x98b1('0x33')]=qs[_0x98b1('0x33')](_0x5a6e0b['query']['limit']);_0xfcfc7d[_0x98b1('0x34')]=qs[_0x98b1('0x34')](_0x5a6e0b['query']['offset']);}_0xfcfc7d['order']=qs['sort'](_0x5a6e0b[_0x98b1('0x43')][_0x98b1('0x48')]);_0xfcfc7d[_0x98b1('0x49')]=qs[_0x98b1('0x4a')](_[_0x98b1('0x4b')](_0x5a6e0b['query'],_0x11a981['filters']),_0x2f79be);if(_0x5a6e0b['query'][_0x98b1('0x4c')]){_0xfcfc7d[_0x98b1('0x49')]=_[_0x98b1('0x4d')](_0xfcfc7d[_0x98b1('0x49')],{'$or':_[_0x98b1('0x42')](_0x2f79be,function(_0x12c5e2){if(_0x12c5e2[_0x98b1('0x3f')]!==_0x98b1('0x4e')){var _0x12cfd8={};_0x12cfd8[_0x12c5e2[_0x98b1('0x3b')]]={'$like':'%'+_0x5a6e0b[_0x98b1('0x43')][_0x98b1('0x4c')]+'%'};return _0x12cfd8;}})});}_0xfcfc7d=_[_0x98b1('0x4d')]({},_0xfcfc7d,_0x5a6e0b[_0x98b1('0x4f')]);var _0xe7de86={'where':_0xfcfc7d[_0x98b1('0x49')]};return db[_0x98b1('0x50')][_0x98b1('0x51')](_0xe7de86)[_0x98b1('0x24')](function(_0x18146b){_0x5280a7[_0x98b1('0x51')]=_0x18146b;if(_0x5a6e0b['query'][_0x98b1('0x52')]){_0xfcfc7d[_0x98b1('0x53')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x98b1('0x54')](_0xfcfc7d);})[_0x98b1('0x24')](function(_0x5de28a){_0x5280a7[_0x98b1('0x55')]=_0x5de28a;return _0x5280a7;})[_0x98b1('0x24')](respondWithFilteredResult(_0x2cda3a,_0xfcfc7d))[_0x98b1('0x2e')](handleError(_0x2cda3a,null));};exports[_0x98b1('0x56')]=function(_0x2b49ba,_0x4d7f64){var _0x12dae1={'raw':!![],'where':{'id':_0x2b49ba['params']['id']}},_0x1327b2={};_0x1327b2[_0x98b1('0x41')]=_[_0x98b1('0x44')](db['OpenchannelMessage']['rawAttributes']);_0x1327b2[_0x98b1('0x43')]=_[_0x98b1('0x44')](_0x2b49ba['query']);_0x1327b2[_0x98b1('0x4a')]=_['intersection'](_0x1327b2[_0x98b1('0x41')],_0x1327b2['query']);_0x12dae1['attributes']=_[_0x98b1('0x46')](_0x1327b2[_0x98b1('0x41')],qs['fields'](_0x2b49ba[_0x98b1('0x43')][_0x98b1('0x57')]));_0x12dae1[_0x98b1('0x45')]=_0x12dae1[_0x98b1('0x45')][_0x98b1('0x47')]?_0x12dae1[_0x98b1('0x45')]:_0x1327b2['model'];if(_0x2b49ba['query'][_0x98b1('0x52')]){_0x12dae1['include']=[{'all':!![]}];}_0x12dae1=_['merge']({},_0x12dae1,_0x2b49ba[_0x98b1('0x4f')]);return db[_0x98b1('0x50')][_0x98b1('0x58')](_0x12dae1)[_0x98b1('0x24')](handleEntityNotFound(_0x4d7f64,null))[_0x98b1('0x24')](respondWithResult(_0x4d7f64,null))[_0x98b1('0x2e')](handleError(_0x4d7f64,null));};exports[_0x98b1('0x59')]=function(_0x488cb3,_0x11cf2){return db['OpenchannelMessage'][_0x98b1('0x59')](_0x488cb3[_0x98b1('0x5a')],{})[_0x98b1('0x24')](respondWithResult(_0x11cf2,0xc9))[_0x98b1('0x2e')](handleError(_0x11cf2,null));};exports[_0x98b1('0x5b')]=function(_0x4dfe72,_0x4b9148){if(_0x4dfe72[_0x98b1('0x5a')]['id']){delete _0x4dfe72[_0x98b1('0x5a')]['id'];}return db[_0x98b1('0x50')]['find']({'where':{'id':_0x4dfe72[_0x98b1('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4b9148,null))[_0x98b1('0x24')](saveUpdates(_0x4dfe72[_0x98b1('0x5a')],null))['then'](respondWithResult(_0x4b9148,null))['catch'](handleError(_0x4b9148,null));};exports['destroy']=function(_0x193f3c,_0x47b66){return db['OpenchannelMessage'][_0x98b1('0x58')]({'where':{'id':_0x193f3c[_0x98b1('0x5c')]['id']}})[_0x98b1('0x24')](handleEntityNotFound(_0x47b66,null))[_0x98b1('0x24')](removeEntity(_0x47b66,null))[_0x98b1('0x2e')](handleError(_0x47b66,null));};exports[_0x98b1('0x5d')]=function(_0x228a35,_0x2fee53){return db[_0x98b1('0x50')][_0x98b1('0x5d')]()[_0x98b1('0x24')](respondWithResult(_0x2fee53,null))['catch'](handleError(_0x2fee53,null));};var interaction_log=require(_0x98b1('0x17'))('openchannel-interactions');exports['accept']=function(_0xebd54d,_0x2194bf,_0x1576a8){var _0x2cb426={'agent':{},'channel':_0x98b1('0x5e')};if(_0xebd54d[_0x98b1('0x5a')]['id']){delete _0xebd54d[_0x98b1('0x5a')]['id'];}_0xebd54d[_0x98b1('0x5a')]['read']=!![];_0xebd54d['body'][_0x98b1('0x5f')]=moment()[_0x98b1('0x60')](_0x98b1('0x61'));_0xebd54d[_0x98b1('0x5a')][_0x98b1('0x62')]=_0xebd54d[_0x98b1('0x5a')][_0x98b1('0x62')]||_0xebd54d['user']['id'];_0x2cb426['agent']['id']=_0xebd54d[_0x98b1('0x5a')][_0x98b1('0x62')];return db[_0x98b1('0x50')][_0x98b1('0x58')]({'where':{'id':_0xebd54d['params']['id'],'UserId':null}})[_0x98b1('0x24')](handleEntityNotFound(_0x2194bf,null))['then'](saveUpdates(_0xebd54d[_0x98b1('0x5a')],null))[_0x98b1('0x24')](function(_0x4df248){if(_0x4df248){_0x2cb426[_0x98b1('0x2c')]=_0x4df248[_0x98b1('0x63')]({'plain':!![]});return db[_0x98b1('0x64')][_0x98b1('0x58')]({'where':{'id':_0x4df248[_0x98b1('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x2194bf,null))[_0x98b1('0x24')](function(_0x2b7c8a){if(_0x2b7c8a){return _0x2b7c8a[_0x98b1('0x5b')]({'UserId':_0xebd54d[_0x98b1('0x5a')][_0x98b1('0x62')],'read1stAt':_['isNil'](_0x2b7c8a[_0x98b1('0x66')])?moment()['format'](_0x98b1('0x61')):undefined});}return null;})[_0x98b1('0x24')](function(_0x16e962){if(_0x16e962){_0x2cb426['interaction']=_0x16e962['get']({'plain':!![]});interaction_log[_0x98b1('0x25')](_0x98b1('0x67'),_0xebd54d[_0x98b1('0x68')]['id'],_0xebd54d[_0x98b1('0x68')][_0x98b1('0x3b')],_0xebd54d[_0x98b1('0x68')][_0x98b1('0x69')],_0x2cb426[_0x98b1('0x6a')]['id'],_0xebd54d[_0x98b1('0x5a')]?JSON[_0x98b1('0x6b')](_0xebd54d[_0x98b1('0x5a')]):_0x98b1('0x6c'));return respondWithRpcPromise(_0x98b1('0x6d'),'acceptMessage',_0x2cb426);}return null;})[_0x98b1('0x24')](function(_0x3dc8d4){var _0x2955ed=_0x98b1('0x6e')+_0x3dc8d4[_0x98b1('0x2c')][_0x98b1('0x6f')];return db[_0x98b1('0x70')][_0x98b1('0x43')](_0x2955ed,{'type':db[_0x98b1('0x71')][_0x98b1('0x72')][_0x98b1('0x73')],'raw':!![]})[_0x98b1('0x24')](function(_0x500287){return _0x500287;});})[_0x98b1('0x24')](function(_0x37ab40){if(_0x37ab40){_0x2cb426[_0x98b1('0x2c')][_0x98b1('0x74')]=_0x37ab40[0x0];if(!_0xebd54d[_0x98b1('0x5a')][_0x98b1('0x62')])return;return db[_0x98b1('0x75')][_0x98b1('0x58')]({'where':{'id':_0xebd54d[_0x98b1('0x5a')][_0x98b1('0x62')],'role':_0x98b1('0x76')},'attributes':['id',_0x98b1('0x3b'),_0x98b1('0x77'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0x12e9ee){if(!_0x12e9ee)return null;_0x2cb426[_0x98b1('0x2c')][_0x98b1('0x76')]=_0x12e9ee;return _0x2cb426;})[_0x98b1('0x24')](function(_0x2b388c){if(_0x2b388c){if(_0xebd54d[_0x98b1('0x5a')][_0x98b1('0x78')]){_0x2cb426[_0x98b1('0x2c')][_0x98b1('0x79')]=util[_0x98b1('0x60')](_0x98b1('0x7a'),_0xebd54d['user'][_0x98b1('0x3b')]);_0x2cb426[_0x98b1('0x2c')][_0x98b1('0x7b')]=_0x2cb426[_0x98b1('0x7b')];_0x2cb426['message'][_0x98b1('0x7c')]=_0x2cb426[_0x98b1('0x7b')];_0x2cb426['message'][_0x98b1('0x7d')]=_0x98b1('0x7e');return respondWithRpcPromise(_0x98b1('0x7f'),_0x98b1('0x7f'),{'event':_0x98b1('0x80'),'message':_0x2cb426[_0x98b1('0x2c')]},client9002)[_0x98b1('0x24')](function(){return _0x2cb426;});}return _0x2cb426;}return null;})[_0x98b1('0x24')](respondWithResult(_0x2194bf,null))[_0x98b1('0x2e')](handleError(_0x2194bf,null));};var interaction_log=require(_0x98b1('0x17'))(_0x98b1('0x81'));exports[_0x98b1('0x38')]=function(_0x1f2798,_0x35c2f0,_0x1f8ad9){var _0x5a3d69={'agent':{},'channel':_0x98b1('0x5e')};if(_0x1f2798[_0x98b1('0x5a')]['id']){delete _0x1f2798[_0x98b1('0x5a')]['id'];}_0x1f2798[_0x98b1('0x5a')][_0x98b1('0x62')]=_0x1f2798['body'][_0x98b1('0x62')]||_0x1f2798[_0x98b1('0x68')]['id'];_0x5a3d69['agent']['id']=_0x1f2798[_0x98b1('0x5a')][_0x98b1('0x62')];return db['OpenchannelMessage'][_0x98b1('0x58')]({'where':{'id':_0x1f2798[_0x98b1('0x5c')]['id'],'UserId':null}})[_0x98b1('0x24')](handleEntityNotFound(_0x35c2f0,null))[_0x98b1('0x24')](function(_0x7ec062){if(_0x7ec062){_0x5a3d69[_0x98b1('0x2c')]=_0x7ec062[_0x98b1('0x63')]({'plain':!![]});return db[_0x98b1('0x64')]['find']({'where':{'id':_0x7ec062[_0x98b1('0x65')]}});}return null;})[_0x98b1('0x24')](handleEntityNotFound(_0x35c2f0,null))[_0x98b1('0x24')](function(_0x3400f1){if(_0x3400f1){_0x5a3d69[_0x98b1('0x6a')]=_0x3400f1['get']({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1f2798[_0x98b1('0x68')]['id'],_0x1f2798[_0x98b1('0x68')][_0x98b1('0x3b')],_0x1f2798[_0x98b1('0x68')][_0x98b1('0x69')],_0x5a3d69[_0x98b1('0x6a')]['id'],_0x1f2798['body']?JSON[_0x98b1('0x6b')](_0x1f2798[_0x98b1('0x5a')]):_0x98b1('0x6c'));return respondWithRpcPromise(_0x98b1('0x82'),_0x98b1('0x83'),_0x5a3d69);}return null;})[_0x98b1('0x24')](function(_0x1b50c7){var _0x583cfe=_0x98b1('0x6e')+_0x1b50c7[_0x98b1('0x2c')][_0x98b1('0x6f')];return db[_0x98b1('0x70')][_0x98b1('0x43')](_0x583cfe,{'type':db[_0x98b1('0x71')][_0x98b1('0x72')][_0x98b1('0x73')],'raw':!![]})['then'](function(_0x33cb17){return _0x33cb17;});})[_0x98b1('0x24')](function(_0x50b4bc){if(_0x50b4bc){_0x5a3d69['message'][_0x98b1('0x74')]=_0x50b4bc[0x0];if(!_0x1f2798[_0x98b1('0x5a')][_0x98b1('0x62')])return;return db[_0x98b1('0x75')]['find']({'where':{'id':_0x1f2798['body'][_0x98b1('0x62')],'role':_0x98b1('0x76')},'attributes':['id',_0x98b1('0x3b'),'fullname',_0x98b1('0x84'),'internal'],'raw':!![]});}return null;})['then'](function(_0x4e7ac8){if(!_0x4e7ac8)return null;_0x5a3d69[_0x98b1('0x2c')][_0x98b1('0x76')]=_0x4e7ac8;return _0x5a3d69;})[_0x98b1('0x24')](function(_0x544169){if(_0x544169){_0x544169[_0x98b1('0x2c')][_0x98b1('0x79')]=util['format']('SIP/%s',_0x1f2798[_0x98b1('0x68')]['name']);_0x544169[_0x98b1('0x2c')][_0x98b1('0x7b')]=_0x5a3d69[_0x98b1('0x7b')];_0x544169['message']['motionChannel']=_0x5a3d69['channel'];_0x544169[_0x98b1('0x2c')][_0x98b1('0x7d')]=_0x98b1('0x38');respondWithRpcPromise(_0x98b1('0x7f'),'EventManager',{'event':_0x98b1('0x85'),'message':_0x544169[_0x98b1('0x2c')]},client9002);return _0x5a3d69;}return null;})[_0x98b1('0x24')](respondWithResult(_0x35c2f0,null))[_0x98b1('0x2e')](handleError(_0x35c2f0,null));}; \ No newline at end of file +var _0xcfbd=['format','UserId','user','agent','OpenchannelInteraction','OpenchannelInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','openchannel-interactions','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','sequelize','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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/license/hardware','../../mysqldb','redis','socket.io-emitter','client','http','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','pick','filter','merge','where','includeAll','include','show','params','length','options','find','create','body','describe','../../config/logger','openchannel','read','readAt'];(function(_0x772163,_0x4af539){var _0x29b72d=function(_0x1605c5){while(--_0x1605c5){_0x772163['push'](_0x772163['shift']());}};_0x29b72d(++_0x4af539);}(_0xcfbd,0x1a1));var _0xdcfb=function(_0x57e4ec,_0x3c5538){_0x57e4ec=_0x57e4ec-0x0;var _0x5cff0a=_0xcfbd[_0x57e4ec];return _0x5cff0a;};'use strict';var emlformat=require(_0xdcfb('0x0'));var rimraf=require(_0xdcfb('0x1'));var zipdir=require(_0xdcfb('0x2'));var jsonpatch=require(_0xdcfb('0x3'));var rp=require(_0xdcfb('0x4'));var moment=require(_0xdcfb('0x5'));var BPromise=require(_0xdcfb('0x6'));var Mustache=require('mustache');var util=require(_0xdcfb('0x7'));var path=require(_0xdcfb('0x8'));var sox=require(_0xdcfb('0x9'));var csv=require(_0xdcfb('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdcfb('0xb'));var _=require(_0xdcfb('0xc'));var squel=require('squel');var crypto=require(_0xdcfb('0xd'));var jsforce=require(_0xdcfb('0xe'));var deskjs=require(_0xdcfb('0xf'));var toCsv=require(_0xdcfb('0xa'));var querystring=require(_0xdcfb('0x10'));var Papa=require(_0xdcfb('0x11'));var Redis=require(_0xdcfb('0x12'));var authService=require(_0xdcfb('0x13'));var qs=require(_0xdcfb('0x14'));var as=require(_0xdcfb('0x15'));var hardwareService=require(_0xdcfb('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdcfb('0x17'))['db'];config[_0xdcfb('0x18')]=_['defaults'](config[_0xdcfb('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xdcfb('0x19'))(new Redis(config[_0xdcfb('0x18')]));require('./openchannelMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xdcfb('0x1a')][_0xdcfb('0x1b')]({'port':0x232c});var client9002=jayson[_0xdcfb('0x1a')][_0xdcfb('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x693d15,_0x57b821,_0x1c3983,_0x35e840){return new BPromise(function(_0x55bbd8,_0x99c1c4){var _0x45d785=_0x35e840||client;return _0x45d785['request'](_0x693d15,_0x1c3983)[_0xdcfb('0x1c')](function(_0x19b195){logger[_0xdcfb('0x1d')]('OpenchannelMessage,\x20%s,\x20%s',_0x57b821,_0xdcfb('0x1e'));logger[_0xdcfb('0x1f')](_0xdcfb('0x20'),_0x57b821,_0xdcfb('0x1e'),JSON[_0xdcfb('0x21')](_0x19b195));if(_0x19b195['error']){if(_0x19b195['error'][_0xdcfb('0x22')]===0x1f4){logger[_0xdcfb('0x23')](_0xdcfb('0x24'),_0x57b821,_0x19b195['error'][_0xdcfb('0x25')]);return _0x99c1c4(_0x19b195['error'][_0xdcfb('0x25')]);}logger[_0xdcfb('0x23')](_0xdcfb('0x24'),_0x57b821,_0x19b195[_0xdcfb('0x23')][_0xdcfb('0x25')]);return _0x55bbd8(_0x19b195[_0xdcfb('0x23')][_0xdcfb('0x25')]);}else{logger['info'](_0xdcfb('0x24'),_0x57b821,_0xdcfb('0x1e'));_0x55bbd8(_0x19b195[_0xdcfb('0x26')][_0xdcfb('0x25')]);}})[_0xdcfb('0x27')](function(_0x5d2315){logger[_0xdcfb('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x57b821,_0x5d2315);_0x99c1c4(_0x5d2315);});});}function respondWithStatusCode(_0x3f4abb,_0x57ee2f){_0x57ee2f=_0x57ee2f||0xcc;return function(_0x448c94){if(_0x448c94){return _0x3f4abb[_0xdcfb('0x28')](_0x57ee2f);}return _0x3f4abb[_0xdcfb('0x29')](_0x57ee2f)[_0xdcfb('0x2a')]();};}function respondWithResult(_0x44bee3,_0x5150ae){_0x5150ae=_0x5150ae||0xc8;return function(_0x516f8a){if(_0x516f8a){return _0x44bee3[_0xdcfb('0x29')](_0x5150ae)[_0xdcfb('0x2b')](_0x516f8a);}};}function respondWithFilteredResult(_0x4b5f66,_0x15c8a1){return function(_0x29f798){if(_0x29f798){var _0xf79a3a=typeof _0x15c8a1[_0xdcfb('0x2c')]===_0xdcfb('0x2d')&&typeof _0x15c8a1[_0xdcfb('0x2e')]===_0xdcfb('0x2d');var _0x1d4591=_0x29f798[_0xdcfb('0x2f')];var _0x19bedb=_0xf79a3a?0x0:_0x15c8a1['offset'];var _0x346123=_0xf79a3a?_0x29f798[_0xdcfb('0x2f')]:_0x15c8a1[_0xdcfb('0x2c')]+_0x15c8a1[_0xdcfb('0x2e')];var _0x2e9926;if(_0x346123>=_0x1d4591){_0x346123=_0x1d4591;_0x2e9926=0xc8;}else{_0x2e9926=0xce;}_0x4b5f66['status'](_0x2e9926);return _0x4b5f66[_0xdcfb('0x30')]('Content-Range',_0x19bedb+'-'+_0x346123+'/'+_0x1d4591)[_0xdcfb('0x2b')](_0x29f798);}return null;};}function patchUpdates(_0x44c234){return function(_0x1249c3){try{jsonpatch[_0xdcfb('0x31')](_0x1249c3,_0x44c234,!![]);}catch(_0x2c02e1){return BPromise[_0xdcfb('0x32')](_0x2c02e1);}return _0x1249c3[_0xdcfb('0x33')]();};}function saveUpdates(_0x4221c6,_0x1fc39f){return function(_0x4e344f){if(_0x4e344f){return _0x4e344f[_0xdcfb('0x34')](_0x4221c6)[_0xdcfb('0x1c')](function(_0x4ed25c){return _0x4ed25c;});}return null;};}function removeEntity(_0x3c095b,_0x117be7){return function(_0xc2ee76){if(_0xc2ee76){return _0xc2ee76[_0xdcfb('0x35')]()[_0xdcfb('0x1c')](function(){_0x3c095b[_0xdcfb('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x533cdb,_0x3e28bb){return function(_0x2ecd61){if(!_0x2ecd61){_0x533cdb[_0xdcfb('0x28')](0x194);}return _0x2ecd61;};}function handleError(_0x3757fa,_0x2d86b6){_0x2d86b6=_0x2d86b6||0x1f4;return function(_0x4ae505){logger[_0xdcfb('0x23')](_0x4ae505[_0xdcfb('0x36')]);if(_0x4ae505[_0xdcfb('0x37')]){delete _0x4ae505[_0xdcfb('0x37')];}_0x3757fa['status'](_0x2d86b6)[_0xdcfb('0x38')](_0x4ae505);};}exports[_0xdcfb('0x39')]=function(_0x5c9e1e,_0x42a205){var _0x383ff3={},_0x941c50={},_0x597dd4={'count':0x0,'rows':[]};var _0x453c1c=_[_0xdcfb('0x3a')](db[_0xdcfb('0x3b')][_0xdcfb('0x3c')],function(_0x3b128a){return{'name':_0x3b128a[_0xdcfb('0x3d')],'type':_0x3b128a[_0xdcfb('0x3e')]['key']};});_0x941c50[_0xdcfb('0x3f')]=_[_0xdcfb('0x3a')](_0x453c1c,'name');_0x941c50[_0xdcfb('0x40')]=_[_0xdcfb('0x41')](_0x5c9e1e[_0xdcfb('0x40')]);_0x941c50[_0xdcfb('0x42')]=_[_0xdcfb('0x43')](_0x941c50[_0xdcfb('0x3f')],_0x941c50[_0xdcfb('0x40')]);_0x383ff3['attributes']=_[_0xdcfb('0x43')](_0x941c50[_0xdcfb('0x3f')],qs[_0xdcfb('0x44')](_0x5c9e1e[_0xdcfb('0x40')][_0xdcfb('0x44')]));_0x383ff3[_0xdcfb('0x45')]=_0x383ff3[_0xdcfb('0x45')]['length']?_0x383ff3[_0xdcfb('0x45')]:_0x941c50[_0xdcfb('0x3f')];if(!_0x5c9e1e[_0xdcfb('0x40')]['hasOwnProperty'](_0xdcfb('0x46'))){_0x383ff3[_0xdcfb('0x2e')]=qs['limit'](_0x5c9e1e[_0xdcfb('0x40')][_0xdcfb('0x2e')]);_0x383ff3['offset']=qs[_0xdcfb('0x2c')](_0x5c9e1e[_0xdcfb('0x40')][_0xdcfb('0x2c')]);}_0x383ff3[_0xdcfb('0x47')]=qs[_0xdcfb('0x48')](_0x5c9e1e[_0xdcfb('0x40')][_0xdcfb('0x48')]);_0x383ff3['where']=qs['filters'](_[_0xdcfb('0x49')](_0x5c9e1e['query'],_0x941c50[_0xdcfb('0x42')]),_0x453c1c);if(_0x5c9e1e[_0xdcfb('0x40')][_0xdcfb('0x4a')]){_0x383ff3['where']=_[_0xdcfb('0x4b')](_0x383ff3[_0xdcfb('0x4c')],{'$or':_[_0xdcfb('0x3a')](_0x453c1c,function(_0x592da4){if(_0x592da4['type']!=='VIRTUAL'){var _0x440803={};_0x440803[_0x592da4['name']]={'$like':'%'+_0x5c9e1e[_0xdcfb('0x40')][_0xdcfb('0x4a')]+'%'};return _0x440803;}})});}_0x383ff3=_[_0xdcfb('0x4b')]({},_0x383ff3,_0x5c9e1e['options']);var _0x461061={'where':_0x383ff3['where']};return db[_0xdcfb('0x3b')][_0xdcfb('0x2f')](_0x461061)[_0xdcfb('0x1c')](function(_0x50e20d){_0x597dd4[_0xdcfb('0x2f')]=_0x50e20d;if(_0x5c9e1e['query'][_0xdcfb('0x4d')]){_0x383ff3[_0xdcfb('0x4e')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x383ff3);})[_0xdcfb('0x1c')](function(_0x295bd7){_0x597dd4['rows']=_0x295bd7;return _0x597dd4;})[_0xdcfb('0x1c')](respondWithFilteredResult(_0x42a205,_0x383ff3))[_0xdcfb('0x27')](handleError(_0x42a205,null));};exports[_0xdcfb('0x4f')]=function(_0x5e76bd,_0x2dd35a){var _0x494d4a={'raw':!![],'where':{'id':_0x5e76bd[_0xdcfb('0x50')]['id']}},_0x357ed8={};_0x357ed8[_0xdcfb('0x3f')]=_[_0xdcfb('0x41')](db[_0xdcfb('0x3b')][_0xdcfb('0x3c')]);_0x357ed8[_0xdcfb('0x40')]=_[_0xdcfb('0x41')](_0x5e76bd['query']);_0x357ed8[_0xdcfb('0x42')]=_[_0xdcfb('0x43')](_0x357ed8[_0xdcfb('0x3f')],_0x357ed8[_0xdcfb('0x40')]);_0x494d4a['attributes']=_[_0xdcfb('0x43')](_0x357ed8['model'],qs['fields'](_0x5e76bd[_0xdcfb('0x40')][_0xdcfb('0x44')]));_0x494d4a[_0xdcfb('0x45')]=_0x494d4a[_0xdcfb('0x45')][_0xdcfb('0x51')]?_0x494d4a['attributes']:_0x357ed8[_0xdcfb('0x3f')];if(_0x5e76bd[_0xdcfb('0x40')][_0xdcfb('0x4d')]){_0x494d4a[_0xdcfb('0x4e')]=[{'all':!![]}];}_0x494d4a=_['merge']({},_0x494d4a,_0x5e76bd[_0xdcfb('0x52')]);return db[_0xdcfb('0x3b')][_0xdcfb('0x53')](_0x494d4a)[_0xdcfb('0x1c')](handleEntityNotFound(_0x2dd35a,null))[_0xdcfb('0x1c')](respondWithResult(_0x2dd35a,null))[_0xdcfb('0x27')](handleError(_0x2dd35a,null));};exports[_0xdcfb('0x54')]=function(_0x34781a,_0x5ed369){return db[_0xdcfb('0x3b')][_0xdcfb('0x54')](_0x34781a['body'],{})[_0xdcfb('0x1c')](respondWithResult(_0x5ed369,0xc9))[_0xdcfb('0x27')](handleError(_0x5ed369,null));};exports[_0xdcfb('0x34')]=function(_0x771302,_0x59a9a9){if(_0x771302[_0xdcfb('0x55')]['id']){delete _0x771302['body']['id'];}return db['OpenchannelMessage'][_0xdcfb('0x53')]({'where':{'id':_0x771302[_0xdcfb('0x50')]['id']}})['then'](handleEntityNotFound(_0x59a9a9,null))[_0xdcfb('0x1c')](saveUpdates(_0x771302[_0xdcfb('0x55')],null))['then'](respondWithResult(_0x59a9a9,null))[_0xdcfb('0x27')](handleError(_0x59a9a9,null));};exports['destroy']=function(_0x2d3af1,_0x56c51a){return db[_0xdcfb('0x3b')][_0xdcfb('0x53')]({'where':{'id':_0x2d3af1['params']['id']}})[_0xdcfb('0x1c')](handleEntityNotFound(_0x56c51a,null))[_0xdcfb('0x1c')](removeEntity(_0x56c51a,null))[_0xdcfb('0x27')](handleError(_0x56c51a,null));};exports[_0xdcfb('0x56')]=function(_0x1e0517,_0x1cdd97){return db[_0xdcfb('0x3b')][_0xdcfb('0x56')]()[_0xdcfb('0x1c')](respondWithResult(_0x1cdd97,null))[_0xdcfb('0x27')](handleError(_0x1cdd97,null));};var interaction_log=require(_0xdcfb('0x57'))('openchannel-interactions');exports['accept']=function(_0x1b88a9,_0x328723,_0x2713c4){var _0x3f73ae={'agent':{},'channel':_0xdcfb('0x58')};if(_0x1b88a9[_0xdcfb('0x55')]['id']){delete _0x1b88a9[_0xdcfb('0x55')]['id'];}_0x1b88a9[_0xdcfb('0x55')][_0xdcfb('0x59')]=!![];_0x1b88a9[_0xdcfb('0x55')][_0xdcfb('0x5a')]=moment()[_0xdcfb('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');_0x1b88a9[_0xdcfb('0x55')]['UserId']=_0x1b88a9[_0xdcfb('0x55')][_0xdcfb('0x5c')]||_0x1b88a9[_0xdcfb('0x5d')]['id'];_0x3f73ae[_0xdcfb('0x5e')]['id']=_0x1b88a9['body'][_0xdcfb('0x5c')];return db['OpenchannelMessage'][_0xdcfb('0x53')]({'where':{'id':_0x1b88a9[_0xdcfb('0x50')]['id'],'UserId':null}})[_0xdcfb('0x1c')](handleEntityNotFound(_0x328723,null))[_0xdcfb('0x1c')](saveUpdates(_0x1b88a9[_0xdcfb('0x55')],null))[_0xdcfb('0x1c')](function(_0x974927){if(_0x974927){_0x3f73ae[_0xdcfb('0x25')]=_0x974927['get']({'plain':!![]});return db[_0xdcfb('0x5f')][_0xdcfb('0x53')]({'where':{'id':_0x974927[_0xdcfb('0x60')]}});}return null;})[_0xdcfb('0x1c')](handleEntityNotFound(_0x328723,null))['then'](function(_0x11308b){if(_0x11308b){return _0x11308b[_0xdcfb('0x34')]({'UserId':_0x1b88a9[_0xdcfb('0x55')]['UserId'],'read1stAt':_[_0xdcfb('0x61')](_0x11308b['read1stAt'])?moment()[_0xdcfb('0x5b')](_0xdcfb('0x62')):undefined});}return null;})[_0xdcfb('0x1c')](function(_0x173920){if(_0x173920){_0x3f73ae['interaction']=_0x173920[_0xdcfb('0x63')]({'plain':!![]});interaction_log['info'](_0xdcfb('0x64'),_0x1b88a9['user']['id'],_0x1b88a9[_0xdcfb('0x5d')]['name'],_0x1b88a9[_0xdcfb('0x5d')][_0xdcfb('0x65')],_0x3f73ae[_0xdcfb('0x66')]['id'],_0x1b88a9[_0xdcfb('0x55')]?JSON[_0xdcfb('0x21')](_0x1b88a9['body']):_0xdcfb('0x67'));return respondWithRpcPromise('AcceptMessage',_0xdcfb('0x68'),_0x3f73ae);}return null;})[_0xdcfb('0x1c')](function(_0x216e6){var _0x544883=_0xdcfb('0x69')+_0x216e6[_0xdcfb('0x25')][_0xdcfb('0x6a')];return db['sequelize'][_0xdcfb('0x40')](_0x544883,{'type':db[_0xdcfb('0x6b')]['QueryTypes'][_0xdcfb('0x6c')],'raw':!![]})['then'](function(_0x323257){return _0x323257;});})['then'](function(_0x1d870c){if(_0x1d870c){_0x3f73ae['message'][_0xdcfb('0x6d')]=_0x1d870c[0x0];if(!_0x1b88a9[_0xdcfb('0x55')][_0xdcfb('0x5c')])return;return db[_0xdcfb('0x6e')][_0xdcfb('0x53')]({'where':{'id':_0x1b88a9[_0xdcfb('0x55')][_0xdcfb('0x5c')],'role':_0xdcfb('0x5e')},'attributes':['id',_0xdcfb('0x37'),_0xdcfb('0x6f'),_0xdcfb('0x70'),_0xdcfb('0x71')],'raw':!![]});}return null;})[_0xdcfb('0x1c')](function(_0x35f8f6){if(!_0x35f8f6)return null;_0x3f73ae[_0xdcfb('0x25')][_0xdcfb('0x5e')]=_0x35f8f6;return _0x3f73ae;})['then'](function(_0x1b8106){if(_0x1b8106){if(_0x1b88a9[_0xdcfb('0x55')]['manual']){_0x3f73ae[_0xdcfb('0x25')][_0xdcfb('0x72')]=util[_0xdcfb('0x5b')](_0xdcfb('0x73'),_0x1b88a9['user']['name']);_0x3f73ae[_0xdcfb('0x25')][_0xdcfb('0x74')]=_0x3f73ae[_0xdcfb('0x74')];_0x3f73ae[_0xdcfb('0x25')][_0xdcfb('0x75')]=_0x3f73ae[_0xdcfb('0x74')];_0x3f73ae[_0xdcfb('0x25')][_0xdcfb('0x76')]=_0xdcfb('0x77');return respondWithRpcPromise(_0xdcfb('0x78'),_0xdcfb('0x78'),{'event':_0xdcfb('0x79'),'message':_0x3f73ae[_0xdcfb('0x25')]},client9002)[_0xdcfb('0x1c')](function(){return _0x3f73ae;});}return _0x3f73ae;}return null;})['then'](respondWithResult(_0x328723,null))[_0xdcfb('0x27')](handleError(_0x328723,null));};var interaction_log=require('../../config/logger')(_0xdcfb('0x7a'));exports[_0xdcfb('0x32')]=function(_0x287a6e,_0x55dccf,_0x31dcf1){var _0x429807={'agent':{},'channel':'openchannel'};if(_0x287a6e[_0xdcfb('0x55')]['id']){delete _0x287a6e['body']['id'];}_0x287a6e[_0xdcfb('0x55')][_0xdcfb('0x5c')]=_0x287a6e[_0xdcfb('0x55')][_0xdcfb('0x5c')]||_0x287a6e[_0xdcfb('0x5d')]['id'];_0x429807[_0xdcfb('0x5e')]['id']=_0x287a6e[_0xdcfb('0x55')][_0xdcfb('0x5c')];return db[_0xdcfb('0x3b')]['find']({'where':{'id':_0x287a6e[_0xdcfb('0x50')]['id'],'UserId':null}})[_0xdcfb('0x1c')](handleEntityNotFound(_0x55dccf,null))[_0xdcfb('0x1c')](function(_0x2c4c36){if(_0x2c4c36){_0x429807[_0xdcfb('0x25')]=_0x2c4c36[_0xdcfb('0x63')]({'plain':!![]});return db['OpenchannelInteraction'][_0xdcfb('0x53')]({'where':{'id':_0x2c4c36['OpenchannelInteractionId']}});}return null;})[_0xdcfb('0x1c')](handleEntityNotFound(_0x55dccf,null))[_0xdcfb('0x1c')](function(_0x32822e){if(_0x32822e){_0x429807[_0xdcfb('0x66')]=_0x32822e[_0xdcfb('0x63')]({'plain':!![]});interaction_log[_0xdcfb('0x1d')](_0xdcfb('0x7b'),_0x287a6e[_0xdcfb('0x5d')]['id'],_0x287a6e['user'][_0xdcfb('0x37')],_0x287a6e['user'][_0xdcfb('0x65')],_0x429807[_0xdcfb('0x66')]['id'],_0x287a6e['body']?JSON[_0xdcfb('0x21')](_0x287a6e['body']):'null');return respondWithRpcPromise('RejectMessage',_0xdcfb('0x7c'),_0x429807);}return null;})[_0xdcfb('0x1c')](function(_0x2259c2){var _0x396911=_0xdcfb('0x69')+_0x2259c2[_0xdcfb('0x25')][_0xdcfb('0x6a')];return db[_0xdcfb('0x7d')]['query'](_0x396911,{'type':db['Sequelize']['QueryTypes'][_0xdcfb('0x6c')],'raw':!![]})[_0xdcfb('0x1c')](function(_0x4f6ad4){return _0x4f6ad4;});})[_0xdcfb('0x1c')](function(_0x4b2388){if(_0x4b2388){_0x429807[_0xdcfb('0x25')][_0xdcfb('0x6d')]=_0x4b2388[0x0];if(!_0x287a6e[_0xdcfb('0x55')]['UserId'])return;return db[_0xdcfb('0x6e')]['find']({'where':{'id':_0x287a6e[_0xdcfb('0x55')][_0xdcfb('0x5c')],'role':'agent'},'attributes':['id',_0xdcfb('0x37'),_0xdcfb('0x6f'),_0xdcfb('0x70'),_0xdcfb('0x71')],'raw':!![]});}return null;})[_0xdcfb('0x1c')](function(_0x30138c){if(!_0x30138c)return null;_0x429807[_0xdcfb('0x25')][_0xdcfb('0x5e')]=_0x30138c;return _0x429807;})[_0xdcfb('0x1c')](function(_0x544e96){if(_0x544e96){_0x544e96[_0xdcfb('0x25')][_0xdcfb('0x72')]=util[_0xdcfb('0x5b')](_0xdcfb('0x73'),_0x287a6e['user'][_0xdcfb('0x37')]);_0x544e96[_0xdcfb('0x25')][_0xdcfb('0x74')]=_0x429807['channel'];_0x544e96[_0xdcfb('0x25')]['motionChannel']=_0x429807[_0xdcfb('0x74')];_0x544e96[_0xdcfb('0x25')]['event']=_0xdcfb('0x32');respondWithRpcPromise(_0xdcfb('0x78'),_0xdcfb('0x78'),{'event':_0xdcfb('0x7e'),'message':_0x544e96[_0xdcfb('0x25')]},client9002);return _0x429807;}return null;})[_0xdcfb('0x1c')](respondWithResult(_0x55dccf,null))[_0xdcfb('0x27')](handleError(_0x55dccf,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 6e2fa33..24e565f 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 _0xbbd8=['exports','OpenchannelMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xbbd8,0x19f));var _0x8bbd=function(_0x234de6,_0x3ad980){_0x234de6=_0x234de6-0x0;var _0xd39c7e=_0xbbd8[_0x234de6];return _0xd39c7e;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require('../../mysqldb')['db'][_0x8bbd('0x0')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x8bbd('0x1')](0x0);var events={'afterCreate':_0x8bbd('0x2'),'afterUpdate':_0x8bbd('0x3'),'afterDestroy':_0x8bbd('0x4')};function emitEvent(_0x19724d){return function(_0x2c4439,_0x425e3d,_0x3e1241){OpenchannelMessageEvents[_0x8bbd('0x5')](_0x19724d+':'+_0x2c4439['id'],_0x2c4439);OpenchannelMessageEvents['emit'](_0x19724d,_0x2c4439);_0x3e1241(null);};}for(var e in events){if(events[_0x8bbd('0x6')](e)){var event=events[e];OpenchannelMessage[_0x8bbd('0x7')](e,emitEvent(event));}}module[_0x8bbd('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x25d1=['OpenchannelMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x523a03,_0x47d6d3){var _0x1f6f00=function(_0x3396ca){while(--_0x3396ca){_0x523a03['push'](_0x523a03['shift']());}};_0x1f6f00(++_0x47d6d3);}(_0x25d1,0x150));var _0x125d=function(_0x3e8cae,_0x4cb96a){_0x3e8cae=_0x3e8cae-0x0;var _0x45c4d6=_0x25d1[_0x3e8cae];return _0x45c4d6;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require('../../mysqldb')['db'][_0x125d('0x0')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x125d('0x1')](0x0);var events={'afterCreate':_0x125d('0x2'),'afterUpdate':_0x125d('0x3'),'afterDestroy':_0x125d('0x4')};function emitEvent(_0x586f08){return function(_0x2460b0,_0x1d1706,_0x1044a9){OpenchannelMessageEvents[_0x125d('0x5')](_0x586f08+':'+_0x2460b0['id'],_0x2460b0);OpenchannelMessageEvents['emit'](_0x586f08,_0x2460b0);_0x1044a9(null);};}for(var e in events){if(events[_0x125d('0x6')](e)){var event=events[e];OpenchannelMessage[_0x125d('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index e24696f..2dec51c 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 _0xe649=['threadId','OpenchannelMessage,\x20%s,\x20%s','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./openchannelMessage.attributes','fti_openchannel_messages','FULLTEXT','get','direction','toLowerCase','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','CmContact','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','replyUri','info','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','GET','body','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s'];(function(_0x279fc8,_0x1ba427){var _0x4521a5=function(_0xbd2f4c){while(--_0xbd2f4c){_0x279fc8['push'](_0x279fc8['shift']());}};_0x4521a5(++_0x1ba427);}(_0xe649,0x198));var _0x9e64=function(_0x35decb,_0x2c7932){_0x35decb=_0x35decb-0x0;var _0xca0580=_0xe649[_0x35decb];return _0xca0580;};'use strict';var _=require(_0x9e64('0x0'));var util=require(_0x9e64('0x1'));var logger=require(_0x9e64('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9e64('0x3'));var rp=require(_0x9e64('0x4'));var fs=require('fs');var path=require(_0x9e64('0x5'));var rimraf=require(_0x9e64('0x6'));var config=require('../../config/environment');var attributes=require(_0x9e64('0x7'));module['exports']=function(_0x4a42b8,_0x29aab5){return _0x4a42b8['define']('OpenchannelMessage',attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x9e64('0x8'),'fields':['body'],'type':_0x9e64('0x9')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3cec11,_0x5d54a1,_0x57918f){var _0x37ea9=_0x4a42b8['models'];var _0x4f3d5e=_0x3cec11[_0x9e64('0xa')]({'plain':!![]});if(_0x4f3d5e[_0x9e64('0xb')][_0x9e64('0xc')]()==='in'||_0x4f3d5e[_0x9e64('0xb')][_0x9e64('0xc')]()==='out'&&!_0x4f3d5e[_0x9e64('0xd')]&&!_[_0x9e64('0xe')](_0x4f3d5e[_0x9e64('0xf')])){_0x37ea9[_0x9e64('0x10')][_0x9e64('0x11')]({'where':{'id':_0x4f3d5e[_0x9e64('0x12')]}})[_0x9e64('0x13')](function(_0x3f22ba){if(_0x3f22ba){_0x3f22ba[_0x9e64('0x14')]({'lastMsgAt':_0x4f3d5e[_0x9e64('0x15')],'lastMsgDirection':_0x4f3d5e[_0x9e64('0xb')]['toLowerCase']()});}})[_0x9e64('0x16')](function(_0x16c98f){console[_0x9e64('0x17')](_0x16c98f);});}if(_0x4f3d5e[_0x9e64('0xb')]==='out'&&!_0x4f3d5e[_0x9e64('0xd')]){var _0x80bab3;_0x37ea9[_0x9e64('0x18')]['describe']()[_0x9e64('0x13')](function(_0x756902){return _0x37ea9[_0x9e64('0x19')][_0x9e64('0x1a')]({'where':{'id':_0x4f3d5e[_0x9e64('0x1b')]},'include':[{'model':_0x37ea9[_0x9e64('0x10')],'as':_0x9e64('0x1c'),'where':{'id':_0x4f3d5e[_0x9e64('0x12')]},'limit':0x1,'include':[{'model':_0x37ea9['CmContact'],'as':_0x9e64('0x1d'),'attributes':_[_0x9e64('0x1e')](_0x756902)}]}]});})[_0x9e64('0x13')](function(_0x1194a8){_0x80bab3=_0x1194a8[_0x9e64('0xa')]({'plain':!![]});if(_0x80bab3&&_0x80bab3[_0x9e64('0x1f')]){logger[_0x9e64('0x20')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util['format'](_0x9e64('0x21'),_0x4f3d5e['id'],_0x80bab3[_0x9e64('0x1f')]));if(_0x80bab3[_0x9e64('0x1c')]&&_0x80bab3[_0x9e64('0x1c')][_0x9e64('0x22')]){_0x4f3d5e[_0x9e64('0x23')]=_[_0x9e64('0x24')](_0x80bab3[_0x9e64('0x1c')][0x0],'Contact');_0x4f3d5e[_0x9e64('0x1d')]=_0x80bab3[_0x9e64('0x1c')][0x0][_0x9e64('0x1d')];}var _0x5d54a1={'method':_0x9e64('0x25'),'uri':encodeURI(_0x80bab3[_0x9e64('0x1f')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5d54a1['method']){case _0x9e64('0x26'):_0x5d54a1['qs']=_0x4f3d5e;break;case _0x9e64('0x25'):_0x5d54a1[_0x9e64('0x27')]=_0x4f3d5e;break;}return rp(_0x5d54a1)[_0x9e64('0x13')](function(_0x23f860){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x9e64('0x28'),util['format'](_0x9e64('0x29'),_0x4f3d5e['id'],_0x80bab3[_0x9e64('0x1f')]));if(_0x23f860[_0x9e64('0x27')][_0x9e64('0x2a')]&&_0x23f860[_0x9e64('0x27')][_0x9e64('0x2a')]!=_0x4f3d5e[_0x9e64('0x23')][_0x9e64('0x2a')]){return _0x37ea9['OpenchannelInteraction'][_0x9e64('0x14')]({'threadId':_0x23f860[_0x9e64('0x27')][_0x9e64('0x2a')]},{'where':{'id':_0x4f3d5e[_0x9e64('0x23')]['id']}});}else{return;}})['then'](function(){return _0x3cec11[_0x9e64('0x14')]({'read':!![]});})['catch'](function(_0x23e38a){logger[_0x9e64('0x17')](_0x9e64('0x2b'),_0x9e64('0x28'),util['inspect'](_0x23e38a,{'showHidden':![],'depth':null}));_0x57918f();});}else{_0x57918f();}})['finally'](function(){_0x57918f();});}else{_0x57918f();}}},'charset':'utf8mb4','collate':_0x9e64('0x2c')});}; \ No newline at end of file +var _0x202a=['finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','OpenchannelInteractionId','then','update','createdAt','catch','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteraction','Interactions','CmContact','Contact','keys','info','OpenchannelMessage,\x20%s,\x20%s','format','replyUri','Interaction','omit','method','GET','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','error','inspect'];(function(_0x5891c,_0x26c3ab){var _0x82a0a7=function(_0x5cf85c){while(--_0x5cf85c){_0x5891c['push'](_0x5891c['shift']());}};_0x82a0a7(++_0x26c3ab);}(_0x202a,0x1e0));var _0xa202=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x202a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa202('0x0'));var util=require(_0xa202('0x1'));var logger=require(_0xa202('0x2'))('api');var moment=require(_0xa202('0x3'));var BPromise=require('bluebird');var rp=require(_0xa202('0x4'));var fs=require('fs');var path=require(_0xa202('0x5'));var rimraf=require(_0xa202('0x6'));var config=require(_0xa202('0x7'));var attributes=require('./openchannelMessage.attributes');module[_0xa202('0x8')]=function(_0x21d7d0,_0x51afa8){return _0x21d7d0[_0xa202('0x9')](_0xa202('0xa'),attributes,{'tableName':_0xa202('0xb'),'paranoid':![],'indexes':[{'name':_0xa202('0xc'),'fields':[_0xa202('0xd')],'type':_0xa202('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1de2a9,_0x307f72,_0x2055d7){var _0x59bbdc=_0x21d7d0[_0xa202('0xf')];var _0x3f38d6=_0x1de2a9[_0xa202('0x10')]({'plain':!![]});if(_0x3f38d6[_0xa202('0x11')][_0xa202('0x12')]()==='in'||_0x3f38d6[_0xa202('0x11')][_0xa202('0x12')]()===_0xa202('0x13')&&!_0x3f38d6[_0xa202('0x14')]&&!_[_0xa202('0x15')](_0x3f38d6[_0xa202('0x16')])){_0x59bbdc['OpenchannelInteraction'][_0xa202('0x17')]({'where':{'id':_0x3f38d6[_0xa202('0x18')]}})[_0xa202('0x19')](function(_0x1f92d6){if(_0x1f92d6){_0x1f92d6[_0xa202('0x1a')]({'lastMsgAt':_0x3f38d6[_0xa202('0x1b')],'lastMsgDirection':_0x3f38d6[_0xa202('0x11')][_0xa202('0x12')]()});}})[_0xa202('0x1c')](function(_0x23bce9){console['error'](_0x23bce9);});}if(_0x3f38d6[_0xa202('0x11')]===_0xa202('0x13')&&!_0x3f38d6[_0xa202('0x14')]){var _0x42b39f;_0x59bbdc['CmContact']['describe']()['then'](function(_0x175b74){return _0x59bbdc[_0xa202('0x1d')][_0xa202('0x1e')]({'where':{'id':_0x3f38d6[_0xa202('0x1f')]},'include':[{'model':_0x59bbdc[_0xa202('0x20')],'as':_0xa202('0x21'),'where':{'id':_0x3f38d6['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x59bbdc[_0xa202('0x22')],'as':_0xa202('0x23'),'attributes':_[_0xa202('0x24')](_0x175b74)}]}]});})['then'](function(_0x37c1d9){_0x42b39f=_0x37c1d9['get']({'plain':!![]});if(_0x42b39f&&_0x42b39f['replyUri']){logger[_0xa202('0x25')](_0xa202('0x26'),'afterCreate',util[_0xa202('0x27')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x3f38d6['id'],_0x42b39f[_0xa202('0x28')]));if(_0x42b39f['Interactions']&&_0x42b39f['Interactions']['length']){_0x3f38d6[_0xa202('0x29')]=_[_0xa202('0x2a')](_0x42b39f[_0xa202('0x21')][0x0],'Contact');_0x3f38d6[_0xa202('0x23')]=_0x42b39f[_0xa202('0x21')][0x0]['Contact'];}var _0x307f72={'method':'POST','uri':encodeURI(_0x42b39f[_0xa202('0x28')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x307f72[_0xa202('0x2b')]){case _0xa202('0x2c'):_0x307f72['qs']=_0x3f38d6;break;case'POST':_0x307f72[_0xa202('0xd')]=_0x3f38d6;break;}return rp(_0x307f72)[_0xa202('0x19')](function(_0x1513e0){logger['info'](_0xa202('0x26'),_0xa202('0x2d'),util[_0xa202('0x27')](_0xa202('0x2e'),_0x3f38d6['id'],_0x42b39f[_0xa202('0x28')]));if(_0x1513e0[_0xa202('0xd')][_0xa202('0x2f')]&&_0x1513e0[_0xa202('0xd')]['threadId']!=_0x3f38d6[_0xa202('0x29')][_0xa202('0x2f')]){return _0x59bbdc['OpenchannelInteraction'][_0xa202('0x1a')]({'threadId':_0x1513e0[_0xa202('0xd')]['threadId']},{'where':{'id':_0x3f38d6['Interaction']['id']}});}else{return;}})[_0xa202('0x19')](function(){return _0x1de2a9[_0xa202('0x1a')]({'read':!![]});})[_0xa202('0x1c')](function(_0x37130f){logger[_0xa202('0x30')](_0xa202('0x26'),_0xa202('0x2d'),util[_0xa202('0x31')](_0x37130f,{'showHidden':![],'depth':null}));_0x2055d7();});}else{_0x2055d7();}})[_0xa202('0x32')](function(){_0x2055d7();});}else{_0x2055d7();}}},'charset':_0xa202('0x33'),'collate':_0xa202('0x34')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 2b3ad1e..dcfa422 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','CreateOpenchannelMessage','create','options','info'];(function(_0x34ba7e,_0xc0222e){var _0x38bd64=function(_0x503b57){while(--_0x503b57){_0x34ba7e['push'](_0x34ba7e['shift']());}};_0x38bd64(++_0xc0222e);}(_0x2ef3,0xba));var _0x32ef=function(_0x313b2a,_0x4629bb){_0x313b2a=_0x313b2a-0x0;var _0x374f4b=_0x2ef3[_0x313b2a];return _0x374f4b;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x32ef('0xa')]=_[_0x32ef('0xb')](config[_0x32ef('0xa')],{'host':_0x32ef('0xc'),'port':0x18eb});var socket=require(_0x32ef('0xd'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xe'))[_0x32ef('0xf')](socket);function respondWithRpcPromise(_0x28275c,_0x77df79,_0x56eb42){return new BPromise(function(_0x5780e9,_0x401d0b){return client[_0x32ef('0x10')](_0x28275c,_0x56eb42)[_0x32ef('0x11')](function(_0x1499c2){logger['info'](_0x32ef('0x12'),_0x77df79,'request\x20sent');logger[_0x32ef('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x77df79,_0x32ef('0x14'),JSON[_0x32ef('0x15')](_0x1499c2));if(_0x1499c2['error']){if(_0x1499c2['error'][_0x32ef('0x16')]===0x1f4){logger['error'](_0x32ef('0x12'),_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x401d0b(_0x1499c2[_0x32ef('0x17')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x5780e9(_0x1499c2[_0x32ef('0x17')]['message']);}else{logger['info'](_0x32ef('0x12'),_0x77df79,_0x32ef('0x14'));_0x5780e9(_0x1499c2[_0x32ef('0x19')]['message']);}})[_0x32ef('0x1a')](function(_0x33e230){logger['error'](_0x32ef('0x12'),_0x77df79,_0x33e230);_0x401d0b(_0x33e230);});});}exports[_0x32ef('0x1b')]=function(_0x26aff3){var _0x251084=this;return new Promise(function(_0x445cda,_0x3aec05){return db['OpenchannelMessage'][_0x32ef('0x1c')](_0x26aff3['body'],{'raw':_0x26aff3[_0x32ef('0x1d')]?_0x26aff3[_0x32ef('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x32ef('0x11')](function(_0x97780){logger[_0x32ef('0x1e')]('CreateOpenchannelMessage',_0x26aff3);logger['debug'](_0x32ef('0x1b'),_0x26aff3,JSON[_0x32ef('0x15')](_0x97780));_0x445cda(_0x97780);})[_0x32ef('0x1a')](function(_0x478bef){logger['error'](_0x32ef('0x1b'),_0x478bef['message'],_0x26aff3);_0x3aec05(_0x251084['error'](0x1f4,_0x478bef[_0x32ef('0x18')]));});});}; \ No newline at end of file +var _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3d0f36,_0x477b6d){var _0x1648ba=function(_0x47d3d8){while(--_0x47d3d8){_0x3d0f36['push'](_0x3d0f36['shift']());}};_0x1648ba(++_0x477b6d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5f1330,_0x5be4fe){_0x5f1330=_0x5f1330-0x0;var _0x205aeb=_0x5f2f[_0x5f1330];return _0x205aeb;};'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});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index e7511c0..d89d65d 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 _0xc77b=['save','remove','emit','removeListener','register','length','openchannelMessage:','./openchannelMessage.events'];(function(_0x1ea97d,_0x5f599a){var _0x9beb7c=function(_0x1f6202){while(--_0x1f6202){_0x1ea97d['push'](_0x1ea97d['shift']());}};_0x9beb7c(++_0x5f599a);}(_0xc77b,0x187));var _0xbc77=function(_0x39f00e,_0x3e67c2){_0x39f00e=_0x39f00e-0x0;var _0x54b762=_0xc77b[_0x39f00e];return _0x54b762;};'use strict';var OpenchannelMessageEvents=require(_0xbc77('0x0'));var events=[_0xbc77('0x1'),_0xbc77('0x2'),'update'];function createListener(_0x65b0af,_0x185649){return function(_0x1e388a){_0x185649[_0xbc77('0x3')](_0x65b0af,_0x1e388a);};}function removeListener(_0x337316,_0x279473){return function(){OpenchannelMessageEvents[_0xbc77('0x4')](_0x337316,_0x279473);};}exports[_0xbc77('0x5')]=function(_0x4783d4){for(var _0x378251=0x0,_0x40a25d=events[_0xbc77('0x6')];_0x378251<_0x40a25d;_0x378251++){var _0x22e6c8=events[_0x378251];var _0x6f5ae7=createListener(_0xbc77('0x7')+_0x22e6c8,_0x4783d4);OpenchannelMessageEvents['on'](_0x22e6c8,_0x6f5ae7);}}; \ No newline at end of file +var _0xdced=['save','remove','update','removeListener','register','length','openchannelMessage:'];(function(_0x4b0c37,_0x4cc3a8){var _0x58e950=function(_0x2588ce){while(--_0x2588ce){_0x4b0c37['push'](_0x4b0c37['shift']());}};_0x58e950(++_0x4cc3a8);}(_0xdced,0xcb));var _0xddce=function(_0x35944f,_0x5b1107){_0x35944f=_0x35944f-0x0;var _0xb26f38=_0xdced[_0x35944f];return _0xb26f38;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0xddce('0x0'),_0xddce('0x1'),_0xddce('0x2')];function createListener(_0x3d775a,_0x7e2315){return function(_0x1a747d){_0x7e2315['emit'](_0x3d775a,_0x1a747d);};}function removeListener(_0x1c3f2a,_0x509b66){return function(){OpenchannelMessageEvents[_0xddce('0x3')](_0x1c3f2a,_0x509b66);};}exports[_0xddce('0x4')]=function(_0x541f99){for(var _0x31c76b=0x0,_0x57e11c=events[_0xddce('0x5')];_0x31c76b<_0x57e11c;_0x31c76b++){var _0x46b464=events[_0x31c76b];var _0x272a2c=createListener(_0xddce('0x6')+_0x46b464,_0x541f99);OpenchannelMessageEvents['on'](_0x46b464,_0x272a2c);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 2897a7a..fdb1325 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 _0xa077=['removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','/:id/members','getMembers','getTeams','/:id/users','post','create','/:id/teams','addAgents','put','update','delete'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa077,0xb8));var _0x7a07=function(_0x2ecb2e,_0x47e095){_0x2ecb2e=_0x2ecb2e-0x0;var _0x5109e1=_0xa077[_0x2ecb2e];return _0x5109e1;};'use strict';var multer=require(_0x7a07('0x0'));var util=require('util');var path=require(_0x7a07('0x1'));var timeout=require(_0x7a07('0x2'));var express=require(_0x7a07('0x3'));var router=express[_0x7a07('0x4')]();var fs_extra=require(_0x7a07('0x5'));var auth=require(_0x7a07('0x6'));var interaction=require(_0x7a07('0x7'));var config=require('../../config/environment');var controller=require('./openchannelQueue.controller');router[_0x7a07('0x8')]('/',auth[_0x7a07('0x9')](),controller['index']);router[_0x7a07('0x8')](_0x7a07('0xa'),auth[_0x7a07('0x9')](),controller[_0x7a07('0xb')]);router[_0x7a07('0x8')](_0x7a07('0xc'),auth[_0x7a07('0x9')](),controller['show']);router['get'](_0x7a07('0xd'),auth['isAuthenticated'](),controller[_0x7a07('0xe')]);router['get']('/:id/teams',auth['isAuthenticated'](),controller[_0x7a07('0xf')]);router[_0x7a07('0x8')](_0x7a07('0x10'),auth[_0x7a07('0x9')](),controller['getAgents']);router[_0x7a07('0x11')]('/',auth[_0x7a07('0x9')](),controller[_0x7a07('0x12')]);router[_0x7a07('0x11')](_0x7a07('0x13'),auth['isAuthenticated'](),controller['addTeams']);router[_0x7a07('0x11')](_0x7a07('0x10'),auth[_0x7a07('0x9')](),controller[_0x7a07('0x14')]);router[_0x7a07('0x15')](_0x7a07('0xc'),auth[_0x7a07('0x9')](),controller[_0x7a07('0x16')]);router[_0x7a07('0x17')](_0x7a07('0xc'),auth[_0x7a07('0x9')](),controller['destroy']);router[_0x7a07('0x17')](_0x7a07('0x13'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x7a07('0x17')]('/:id/users',auth['isAuthenticated'](),controller[_0x7a07('0x18')]);module[_0x7a07('0x19')]=router; \ No newline at end of file +var _0x14bf=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','update','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','Router','../../config/environment','get','index','/describe','isAuthenticated','/:id','show'];(function(_0x609988,_0x507944){var _0x159984=function(_0x39d9ce){while(--_0x39d9ce){_0x609988['push'](_0x609988['shift']());}};_0x159984(++_0x507944);}(_0x14bf,0x17a));var _0xf14b=function(_0x27dda3,_0x4e37aa){_0x27dda3=_0x27dda3-0x0;var _0x3e6a6e=_0x14bf[_0x27dda3];return _0x3e6a6e;};'use strict';var multer=require(_0xf14b('0x0'));var util=require(_0xf14b('0x1'));var path=require(_0xf14b('0x2'));var timeout=require(_0xf14b('0x3'));var express=require('express');var router=express[_0xf14b('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf14b('0x5'));var controller=require('./openchannelQueue.controller');router[_0xf14b('0x6')]('/',auth['isAuthenticated'](),controller[_0xf14b('0x7')]);router[_0xf14b('0x6')](_0xf14b('0x8'),auth[_0xf14b('0x9')](),controller['describe']);router[_0xf14b('0x6')](_0xf14b('0xa'),auth['isAuthenticated'](),controller[_0xf14b('0xb')]);router['get'](_0xf14b('0xc'),auth[_0xf14b('0x9')](),controller[_0xf14b('0xd')]);router['get'](_0xf14b('0xe'),auth[_0xf14b('0x9')](),controller[_0xf14b('0xf')]);router[_0xf14b('0x6')](_0xf14b('0x10'),auth['isAuthenticated'](),controller[_0xf14b('0x11')]);router[_0xf14b('0x12')]('/',auth[_0xf14b('0x9')](),controller[_0xf14b('0x13')]);router[_0xf14b('0x12')](_0xf14b('0xe'),auth[_0xf14b('0x9')](),controller['addTeams']);router[_0xf14b('0x12')](_0xf14b('0x10'),auth[_0xf14b('0x9')](),controller[_0xf14b('0x14')]);router['put'](_0xf14b('0xa'),auth[_0xf14b('0x9')](),controller[_0xf14b('0x15')]);router['delete'](_0xf14b('0xa'),auth[_0xf14b('0x9')](),controller['destroy']);router[_0xf14b('0x16')](_0xf14b('0xe'),auth[_0xf14b('0x9')](),controller[_0xf14b('0x17')]);router[_0xf14b('0x16')](_0xf14b('0x10'),auth[_0xf14b('0x9')](),controller[_0xf14b('0x18')]);module[_0xf14b('0x19')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 3caf5a9..0964b45 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 _0x318d=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x2ed25c,_0x20bf6a){var _0x5983f0=function(_0x229290){while(--_0x229290){_0x2ed25c['push'](_0x2ed25c['shift']());}};_0x5983f0(++_0x20bf6a);}(_0x318d,0xe5));var _0xd318=function(_0x12c4cd,_0xdebe29){_0x12c4cd=_0x12c4cd-0x0;var _0x18a029=_0x318d[_0x12c4cd];return _0x18a029;};'use strict';var Sequelize=require(_0xd318('0x0'));module[_0xd318('0x1')]={'name':{'type':Sequelize[_0xd318('0x2')],'unique':_0xd318('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xd318('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd318('0x5')](_0xd318('0x6'),_0xd318('0x7'),_0xd318('0x8'))}}; \ No newline at end of file +var _0xcf6f=['exports','STRING','name','INTEGER','ENUM','beepall','sequelize'];(function(_0x12f074,_0x48b78e){var _0x2aa23b=function(_0xf4b797){while(--_0xf4b797){_0x12f074['push'](_0x12f074['shift']());}};_0x2aa23b(++_0x48b78e);}(_0xcf6f,0x1a3));var _0xfcf6=function(_0x226369,_0x1f1a9c){_0x226369=_0x226369-0x0;var _0x51545a=_0xcf6f[_0x226369];return _0x51545a;};'use strict';var Sequelize=require(_0xfcf6('0x0'));module[_0xfcf6('0x1')]={'name':{'type':Sequelize[_0xfcf6('0x2')],'unique':_0xfcf6('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xfcf6('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xfcf6('0x5')]('rrmemory',_0xfcf6('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 a04389c..df7ce70 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 _0x0fb4=['socket.io-emitter','./openchannelQueue.socket','register','status','end','json','undefined','limit','count','offset','set','Content-Range','then','destroy','get','OpenchannelQueues','UserProfileResource','sendStatus','stack','name','send','index','key','where','OpenchannelQueue','include','query','rows','catch','show','params','model','keys','rawAttributes','intersection','attributes','fields','length','includeAll','merge','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','create','error','update','describe','findOne','UserOpenchannelQueue','filters','nolimit','order','sort','pick','OpenchannelQueueId','map','options','findAll','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','filter','hasOwnProperty','addTeams','ids','Agents','voicePause','interface','transaction','each','findOrCreate','forEach','userOpenchannelQueue:save','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','every','includes','all','union','compact','value','isEmpty','removeAgents','emit','addAgents','omit','isArray','userOpenchannelQueue:remove','getAgents','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','localhost'];(function(_0x10c532,_0x44566d){var _0x10dfec=function(_0x291f87){while(--_0x291f87){_0x10c532['push'](_0x10c532['shift']());}};_0x10dfec(++_0x44566d);}(_0x0fb4,0x166));var _0x40fb=function(_0x4c184d,_0x4278ab){_0x4c184d=_0x4c184d-0x0;var _0x23d997=_0x0fb4[_0x4c184d];return _0x23d997;};'use strict';var BPromise=require(_0x40fb('0x0'));var util=require('util');var _=require(_0x40fb('0x1'));var squel=require('squel');var Redis=require(_0x40fb('0x2'));var qs=require(_0x40fb('0x3'));var logger=require(_0x40fb('0x4'))('api');var config=require('../../config/environment');var db=require(_0x40fb('0x5'))['db'];config[_0x40fb('0x6')]=_['defaults'](config[_0x40fb('0x6')],{'host':_0x40fb('0x7'),'port':0x18eb});var socket=require(_0x40fb('0x8'))(new Redis(config[_0x40fb('0x6')]));require(_0x40fb('0x9'))[_0x40fb('0xa')](socket);function respondWithStatusCode(_0x48541f,_0xcb14f7){_0xcb14f7=_0xcb14f7||0xcc;return function(_0x169054){if(_0x169054){return _0x48541f['sendStatus'](_0xcb14f7);}return _0x48541f[_0x40fb('0xb')](_0xcb14f7)[_0x40fb('0xc')]();};}function respondWithResult(_0x261808,_0x3eb151){_0x3eb151=_0x3eb151||0xc8;return function(_0x24d8e3){if(_0x24d8e3){return _0x261808['status'](_0x3eb151)[_0x40fb('0xd')](_0x24d8e3);}};}function respondWithFilteredResult(_0x341b64,_0x296a0c){return function(_0x254727){if(_0x254727){var _0x9837c4=typeof _0x296a0c['offset']===_0x40fb('0xe')&&typeof _0x296a0c[_0x40fb('0xf')]===_0x40fb('0xe');var _0x14a35a=_0x254727[_0x40fb('0x10')];var _0x3e4eac=_0x9837c4?0x0:_0x296a0c[_0x40fb('0x11')];var _0x4db57f=_0x9837c4?_0x254727['count']:_0x296a0c['offset']+_0x296a0c[_0x40fb('0xf')];var _0x59556c;if(_0x4db57f>=_0x14a35a){_0x4db57f=_0x14a35a;_0x59556c=0xc8;}else{_0x59556c=0xce;}_0x341b64[_0x40fb('0xb')](_0x59556c);return _0x341b64[_0x40fb('0x12')](_0x40fb('0x13'),_0x3e4eac+'-'+_0x4db57f+'/'+_0x14a35a)[_0x40fb('0xd')](_0x254727);}return null;};}function saveUpdates(_0xe471db){return function(_0x3d2b37){if(_0x3d2b37){return _0x3d2b37['update'](_0xe471db)[_0x40fb('0x14')](function(_0x5fdf6a){return _0x5fdf6a;});}return null;};}function removeEntity(_0x3c3a05){return function(_0x2742be){if(_0x2742be){return _0x2742be[_0x40fb('0x15')]()[_0x40fb('0x14')](function(){var _0x399a2d=_0x2742be[_0x40fb('0x16')]({'plain':!![]});var _0x2ecd13=_0x40fb('0x17');return db[_0x40fb('0x18')][_0x40fb('0x15')]({'where':{'type':_0x2ecd13,'resourceId':_0x399a2d['id']}})[_0x40fb('0x14')](function(){return _0x2742be;});})[_0x40fb('0x14')](function(){_0x3c3a05[_0x40fb('0xb')](0xcc)[_0x40fb('0xc')]();});}};}function handleEntityNotFound(_0x5c173d){return function(_0x167795){if(!_0x167795){_0x5c173d[_0x40fb('0x19')](0x194);}return _0x167795;};}function handleError(_0x5605f2,_0x241e36){_0x241e36=_0x241e36||0x1f4;return function(_0x435e3a){logger['error'](_0x435e3a[_0x40fb('0x1a')]);if(_0x435e3a[_0x40fb('0x1b')]){delete _0x435e3a['name'];}_0x5605f2[_0x40fb('0xb')](_0x241e36)[_0x40fb('0x1c')](_0x435e3a);};}exports[_0x40fb('0x1d')]=function(_0x38ae59,_0x436113){var _0x5d22c7={};var _0x21d6f9={'count':0x0,'rows':[]};var _0x8fd4f2=_['map'](db['OpenchannelQueue']['rawAttributes'],function(_0x494252){return{'name':_0x494252['fieldName'],'type':_0x494252['type'][_0x40fb('0x1e')]};});_0x5d22c7=qs['getOptions'](_0x8fd4f2,_0x38ae59);var _0x3eb697={'where':_0x5d22c7[_0x40fb('0x1f')]};return db[_0x40fb('0x20')][_0x40fb('0x10')](_0x3eb697)['then'](function(_0x42e32e){_0x21d6f9[_0x40fb('0x10')]=_0x42e32e;_0x5d22c7[_0x40fb('0x21')]=qs[_0x40fb('0x21')](_0x38ae59[_0x40fb('0x22')]);return db['OpenchannelQueue']['findAll'](_0x5d22c7);})[_0x40fb('0x14')](function(_0x1e71c9){_0x21d6f9[_0x40fb('0x23')]=_0x1e71c9;return _0x21d6f9;})[_0x40fb('0x14')](respondWithFilteredResult(_0x436113,_0x5d22c7))[_0x40fb('0x24')](handleError(_0x436113,null));};exports[_0x40fb('0x25')]=function(_0x3b1eed,_0x5c1f69){var _0x113c29={'raw':!![],'where':{'id':_0x3b1eed[_0x40fb('0x26')]['id']}},_0x4cd314={};_0x4cd314[_0x40fb('0x27')]=_[_0x40fb('0x28')](db[_0x40fb('0x20')][_0x40fb('0x29')]);_0x4cd314[_0x40fb('0x22')]=_['keys'](_0x3b1eed[_0x40fb('0x22')]);_0x4cd314['filters']=_[_0x40fb('0x2a')](_0x4cd314['model'],_0x4cd314[_0x40fb('0x22')]);_0x113c29[_0x40fb('0x2b')]=_[_0x40fb('0x2a')](_0x4cd314[_0x40fb('0x27')],qs[_0x40fb('0x2c')](_0x3b1eed[_0x40fb('0x22')][_0x40fb('0x2c')]));_0x113c29[_0x40fb('0x2b')]=_0x113c29[_0x40fb('0x2b')][_0x40fb('0x2d')]?_0x113c29[_0x40fb('0x2b')]:_0x4cd314[_0x40fb('0x27')];if(_0x3b1eed['query'][_0x40fb('0x2e')]){_0x113c29['include']=[{'all':!![]}];}_0x113c29=_[_0x40fb('0x2f')]({},_0x113c29,_0x3b1eed['options']);return db['OpenchannelQueue'][_0x40fb('0x30')](_0x113c29)[_0x40fb('0x14')](handleEntityNotFound(_0x5c1f69,null))['then'](respondWithResult(_0x5c1f69,null))[_0x40fb('0x24')](handleError(_0x5c1f69,null));};exports['create']=function(_0x213b59,_0x5ab0f8){return db[_0x40fb('0x20')]['create'](_0x213b59[_0x40fb('0x31')],{})[_0x40fb('0x14')](function(_0x3860f4){var _0x5827c9=_0x213b59[_0x40fb('0x32')][_0x40fb('0x16')]({'plain':!![]});if(!_0x5827c9)throw new Error(_0x40fb('0x33'));if(_0x5827c9['role']===_0x40fb('0x32')){var _0x5eebc7=_0x3860f4[_0x40fb('0x16')]({'plain':!![]});var _0x26f277=_0x40fb('0x17');return db[_0x40fb('0x34')][_0x40fb('0x30')]({'where':{'name':_0x26f277,'userProfileId':_0x5827c9[_0x40fb('0x35')]},'raw':!![]})[_0x40fb('0x14')](function(_0x5daf00){if(_0x5daf00&&_0x5daf00[_0x40fb('0x36')]===0x0){return db[_0x40fb('0x18')][_0x40fb('0x37')]({'name':_0x5eebc7[_0x40fb('0x1b')],'resourceId':_0x5eebc7['id'],'type':_0x5daf00[_0x40fb('0x1b')],'sectionId':_0x5daf00['id']},{})['then'](function(){return _0x3860f4;});}else{return _0x3860f4;}})[_0x40fb('0x24')](function(_0x297566){logger[_0x40fb('0x38')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x297566);throw _0x297566;});}return _0x3860f4;})[_0x40fb('0x14')](respondWithResult(_0x5ab0f8,0xc9))['catch'](handleError(_0x5ab0f8,null));};exports[_0x40fb('0x39')]=function(_0x57aac3,_0x184b43){if(_0x57aac3[_0x40fb('0x31')]['id']){delete _0x57aac3[_0x40fb('0x31')]['id'];}return db[_0x40fb('0x20')][_0x40fb('0x30')]({'where':{'id':_0x57aac3[_0x40fb('0x26')]['id']}})[_0x40fb('0x14')](handleEntityNotFound(_0x184b43,null))['then'](saveUpdates(_0x57aac3[_0x40fb('0x31')],null))[_0x40fb('0x14')](respondWithResult(_0x184b43,null))[_0x40fb('0x24')](handleError(_0x184b43,null));};exports['destroy']=function(_0x2036d7,_0x3823bb){return db[_0x40fb('0x20')][_0x40fb('0x30')]({'where':{'id':_0x2036d7['params']['id']}})[_0x40fb('0x14')](handleEntityNotFound(_0x3823bb,null))[_0x40fb('0x14')](removeEntity(_0x3823bb,null))[_0x40fb('0x24')](handleError(_0x3823bb,null));};exports['describe']=function(_0x2f5fb3,_0x3ccac0){return db[_0x40fb('0x20')][_0x40fb('0x3a')]()[_0x40fb('0x14')](respondWithResult(_0x3ccac0,null))[_0x40fb('0x24')](handleError(_0x3ccac0,null));};exports['getMembers']=function(_0x492571,_0x1b4ec6){var _0x14abee={'raw':!![],'where':{}},_0x2cb2f4={},_0x21f7ae;return db[_0x40fb('0x20')][_0x40fb('0x3b')]({'where':{'id':_0x492571[_0x40fb('0x26')]['id']}})['then'](handleEntityNotFound(_0x1b4ec6,null))['then'](function(_0x501091){if(_0x501091){_0x21f7ae=_0x501091[_0x40fb('0x16')]({'plain':!![]});_0x2cb2f4[_0x40fb('0x27')]=_['keys'](db[_0x40fb('0x3c')][_0x40fb('0x29')]);_0x2cb2f4[_0x40fb('0x22')]=_[_0x40fb('0x28')](_0x492571['query']);_0x2cb2f4[_0x40fb('0x3d')]=_[_0x40fb('0x2a')](_0x2cb2f4[_0x40fb('0x27')],_0x2cb2f4[_0x40fb('0x22')]);_0x14abee['attributes']=_[_0x40fb('0x2a')](_0x2cb2f4[_0x40fb('0x27')],qs[_0x40fb('0x2c')](_0x492571['query'][_0x40fb('0x2c')]));_0x14abee['attributes']=_0x14abee[_0x40fb('0x2b')][_0x40fb('0x2d')]?_0x14abee[_0x40fb('0x2b')]:_0x2cb2f4[_0x40fb('0x27')];if(!_0x492571['query']['hasOwnProperty'](_0x40fb('0x3e'))){_0x14abee[_0x40fb('0xf')]=qs[_0x40fb('0xf')](_0x492571[_0x40fb('0x22')][_0x40fb('0xf')]);_0x14abee[_0x40fb('0x11')]=qs['offset'](_0x492571[_0x40fb('0x22')][_0x40fb('0x11')]);}_0x14abee[_0x40fb('0x3f')]=qs[_0x40fb('0x40')](_0x492571['query'][_0x40fb('0x40')]);_0x14abee[_0x40fb('0x1f')]=qs['filters'](_[_0x40fb('0x41')](_0x492571['query'],_0x2cb2f4[_0x40fb('0x3d')]));_0x14abee['where'][_0x40fb('0x42')]=_0x501091['id'];if(_0x492571[_0x40fb('0x22')]['filter']){_0x14abee[_0x40fb('0x1f')]=_[_0x40fb('0x2f')](_0x14abee[_0x40fb('0x1f')],{'$or':_[_0x40fb('0x43')](_0x14abee['attributes'],function(_0xbb2912){var _0x52158f={};_0x52158f[_0xbb2912]={'$like':'%'+_0x492571[_0x40fb('0x22')]['filter']+'%'};return _0x52158f;})});}_0x14abee=_[_0x40fb('0x2f')]({},_0x14abee,_0x492571[_0x40fb('0x44')]);return db[_0x40fb('0x3c')][_0x40fb('0x45')](_0x14abee);}})[_0x40fb('0x14')](function(_0xe3b88e){if(_0xe3b88e){return db[_0x40fb('0x46')][_0x40fb('0x47')]({'where':{'id':_['map'](_0xe3b88e,_0x40fb('0x48')),'role':_0x40fb('0x49')},'attributes':['id',_0x40fb('0x1b'),_0x40fb('0x4a'),_0x40fb('0x4b'),_0x40fb('0x4c')]});}})[_0x40fb('0x14')](function(_0xcada67){if(_0xcada67){return{'count':_0xcada67['count'],'rows':_[_0x40fb('0x43')](_0xcada67['rows'],function(_0x26f1fb){return{'membername':_0x26f1fb[_0x40fb('0x1b')],'UserId':_0x26f1fb['id'],'queue_name':_0x21f7ae['name'],'OpenchannelQueueId':_0x21f7ae['id'],'interface':util[_0x40fb('0x4d')](_0x40fb('0x4e'),_0x40fb('0x4f'),_0x26f1fb[_0x40fb('0x1b')]),'penalty':0x0,'paused':_0x26f1fb[_0x40fb('0x4a')],'createdAt':_0x26f1fb['createdAt'],'updatedAt':_0x26f1fb[_0x40fb('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x40fb('0x14')](respondWithFilteredResult(_0x1b4ec6,_0x14abee))[_0x40fb('0x24')](handleError(_0x1b4ec6,null));};exports[_0x40fb('0x50')]=function(_0x10b0b7,_0x1e8c73){var _0x34f194={};var _0x4cf727={};var _0x13643a;var _0x1666fd;return db[_0x40fb('0x20')][_0x40fb('0x3b')]({'where':{'id':_0x10b0b7[_0x40fb('0x26')]['id']}})[_0x40fb('0x14')](handleEntityNotFound(_0x1e8c73,null))[_0x40fb('0x14')](function(_0x336ddf){if(_0x336ddf){_0x13643a=_0x336ddf;_0x4cf727[_0x40fb('0x27')]=_[_0x40fb('0x28')](db[_0x40fb('0x51')][_0x40fb('0x29')]);_0x4cf727[_0x40fb('0x22')]=_['keys'](_0x10b0b7['query']);_0x4cf727[_0x40fb('0x3d')]=_[_0x40fb('0x2a')](_0x4cf727['model'],_0x4cf727[_0x40fb('0x22')]);_0x34f194[_0x40fb('0x2b')]=_[_0x40fb('0x2a')](_0x4cf727[_0x40fb('0x27')],qs[_0x40fb('0x2c')](_0x10b0b7[_0x40fb('0x22')][_0x40fb('0x2c')]));_0x34f194['attributes']=_0x34f194[_0x40fb('0x2b')][_0x40fb('0x2d')]?_0x34f194[_0x40fb('0x2b')]:_0x4cf727[_0x40fb('0x27')];_0x34f194[_0x40fb('0x3f')]=qs[_0x40fb('0x40')](_0x10b0b7[_0x40fb('0x22')]['sort']);_0x34f194[_0x40fb('0x1f')]=qs['filters'](_[_0x40fb('0x41')](_0x10b0b7[_0x40fb('0x22')],_0x4cf727[_0x40fb('0x3d')]));if(_0x10b0b7[_0x40fb('0x22')][_0x40fb('0x52')]){_0x34f194[_0x40fb('0x1f')]=_[_0x40fb('0x2f')](_0x34f194[_0x40fb('0x1f')],{'$or':_[_0x40fb('0x43')](_0x34f194[_0x40fb('0x2b')],function(_0x58d061){var _0x3bb329={};_0x3bb329[_0x58d061]={'$like':'%'+_0x10b0b7[_0x40fb('0x22')]['filter']+'%'};return _0x3bb329;})});}_0x34f194=_['merge']({},_0x34f194,_0x10b0b7[_0x40fb('0x44')]);return _0x13643a[_0x40fb('0x50')](_0x34f194);}})[_0x40fb('0x14')](function(_0x238d83){if(_0x238d83){_0x1666fd=_0x238d83[_0x40fb('0x2d')];if(!_0x10b0b7['query'][_0x40fb('0x53')](_0x40fb('0x3e'))){_0x34f194[_0x40fb('0xf')]=qs[_0x40fb('0xf')](_0x10b0b7[_0x40fb('0x22')][_0x40fb('0xf')]);_0x34f194[_0x40fb('0x11')]=qs['offset'](_0x10b0b7[_0x40fb('0x22')][_0x40fb('0x11')]);}return _0x13643a[_0x40fb('0x50')](_0x34f194);}})[_0x40fb('0x14')](function(_0x47b029){if(_0x47b029){return _0x47b029?{'count':_0x1666fd,'rows':_0x47b029}:null;}})[_0x40fb('0x14')](respondWithResult(_0x1e8c73,null))[_0x40fb('0x24')](handleError(_0x1e8c73,null));};exports[_0x40fb('0x54')]=function(_0x2385d0,_0x170992){var _0x2e3b7d=_0x2385d0[_0x40fb('0x31')][_0x40fb('0x55')];return db[_0x40fb('0x51')][_0x40fb('0x45')]({'where':{'id':_0x2e3b7d},'attributes':['id'],'include':[{'model':db[_0x40fb('0x46')],'as':_0x40fb('0x56'),'attributes':['id','name','online',_0x40fb('0x57'),_0x40fb('0x58')],'raw':!![]}]})[_0x40fb('0x14')](function(_0xb88c4e){if(_0xb88c4e){var _0x1b6e36=_['flatMap'](_0xb88c4e,function(_0x37dead){var _0x413090=_0x37dead['get']({'plain':!![]});return _0x413090['Agents'];});return db[_0x40fb('0x20')][_0x40fb('0x30')]({'where':{'id':_0x2385d0['params']['id']}})[_0x40fb('0x14')](function(_0x3ff12c){return db['sequelize'][_0x40fb('0x59')](function(_0x345edd){return _0x3ff12c['addTeams'](_0x2e3b7d,{'transaction':_0x345edd})[_0x40fb('0x14')](function(){return BPromise[_0x40fb('0x5a')](_0x1b6e36,function(_0x3d9a98){return db['UserOpenchannelQueue'][_0x40fb('0x5b')]({'where':{'UserId':_0x3d9a98['id'],'OpenchannelQueueId':_0x2385d0[_0x40fb('0x26')]['id']},'transaction':_0x345edd});});})['then'](function(){_0x1b6e36[_0x40fb('0x5c')](function(_0x50457c){socket['emit'](_0x40fb('0x5d'),{'UserId':_0x50457c['id'],'OpenchannelQueueId':_0x3ff12c['id']});});});});});}})['then'](respondWithStatusCode(_0x170992,null))[_0x40fb('0x24')](handleError(_0x170992,null));};exports['removeTeams']=function(_0x5a70f8,_0x6b9484){return db[_0x40fb('0x51')][_0x40fb('0x45')]({'where':{'id':_0x5a70f8['query'][_0x40fb('0x55')]},'attributes':['id'],'include':[{'model':db[_0x40fb('0x46')],'as':_0x40fb('0x56'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x6b9484,null))[_0x40fb('0x14')](function(_0x54a5c6){var _0x2f3dd0=_['map'](_0x54a5c6,'id');var _0x1a7032=[];var _0x311370=[];var _0x10ab43=squel[_0x40fb('0x5e')]();_0x10ab43[_0x40fb('0x5f')](_0x40fb('0x60'))[_0x40fb('0x61')]('team_has_openchannel_queues','tq')[_0x40fb('0x62')](_0x40fb('0x63'),'ut',_0x40fb('0x64'))[_0x40fb('0x1f')](_0x40fb('0x65'),_0x5a70f8['params']['id']);for(var _0x546a38=0x0;_0x546a38<_0x54a5c6[_0x40fb('0x2d')];_0x546a38+=0x1){let _0x4e02ea=_0x54a5c6[_0x546a38];for(var _0x3d4e97=0x0;_0x3d4e97<_0x4e02ea[_0x40fb('0x56')][_0x40fb('0x2d')];_0x3d4e97+=0x1){let _0x2d5f8e=_0x4e02ea[_0x40fb('0x56')][_0x3d4e97];var _0x35819d=_0x10ab43[_0x40fb('0x66')]();_0x35819d['where'](_0x40fb('0x67'),_0x2d5f8e['id']);_0x311370[_0x40fb('0x68')](db[_0x40fb('0x69')][_0x40fb('0x22')](_0x35819d[_0x40fb('0x6a')](),{'type':db[_0x40fb('0x69')]['QueryTypes'][_0x40fb('0x6b')]})[_0x40fb('0x14')](function(_0x3bb40e){if(_0x3bb40e[_0x40fb('0x2d')]===0x1){return _0x2d5f8e['id'];}else{var _0x41a7d0=_[_0x40fb('0x6c')](_[_0x40fb('0x43')](_0x3bb40e,'TeamId'),function(_0x38864a){return _[_0x40fb('0x6d')](_0x2f3dd0,_0x38864a);});if(_0x41a7d0){return _0x2d5f8e['id'];}}}));}}return BPromise[_0x40fb('0x6e')](_0x311370)[_0x40fb('0x14')](function(_0x5340a8){_0x1a7032=_(_0x1a7032)[_0x40fb('0x6f')](_0x5340a8)[_0x40fb('0x70')]()[_0x40fb('0x71')]();return db[_0x40fb('0x20')][_0x40fb('0x30')]({'where':{'id':_0x5a70f8[_0x40fb('0x26')]['id']}})[_0x40fb('0x14')](function(_0x32d403){return db['sequelize'][_0x40fb('0x59')](function(_0x47e8e8){return _0x32d403['removeTeams'](_0x5a70f8[_0x40fb('0x22')]['ids'],{'transaction':_0x47e8e8})[_0x40fb('0x14')](function(){if(!_[_0x40fb('0x72')](_0x1a7032)){return _0x32d403[_0x40fb('0x73')](_0x1a7032,{'transaction':_0x47e8e8});}})[_0x40fb('0x14')](function(){_0x1a7032[_0x40fb('0x5c')](function(_0x2775b8){socket[_0x40fb('0x74')]('userOpenchannelQueue:remove',{'UserId':_0x2775b8,'OpenchannelQueueId':_0x32d403['id']});});});});});});})[_0x40fb('0x14')](respondWithStatusCode(_0x6b9484,null))['catch'](handleError(_0x6b9484,null));};exports[_0x40fb('0x75')]=function(_0x4898eb,_0x50a315){return db[_0x40fb('0x20')][_0x40fb('0x30')]({'where':{'id':_0x4898eb['params']['id']}})[_0x40fb('0x14')](handleEntityNotFound(_0x50a315,null))['then'](function(_0x4bdbb4){if(_0x4bdbb4){return _0x4bdbb4[_0x40fb('0x75')](_0x4898eb[_0x40fb('0x31')]['ids'],_[_0x40fb('0x76')](_0x4898eb[_0x40fb('0x31')],[_0x40fb('0x55'),'id'])||{})['spread'](function(_0x2cf0ae){for(var _0x2bc85f=0x0;_0x2bc85f<_0x4898eb[_0x40fb('0x31')][_0x40fb('0x55')][_0x40fb('0x2d')];_0x2bc85f+=0x1){socket[_0x40fb('0x74')](_0x40fb('0x5d'),{'UserId':Number(_0x4898eb[_0x40fb('0x31')][_0x40fb('0x55')][_0x2bc85f]),'OpenchannelQueueId':Number(_0x4898eb[_0x40fb('0x26')]['id'])});}return _0x2cf0ae;});}})['then'](respondWithResult(_0x50a315,null))[_0x40fb('0x24')](handleError(_0x50a315,null));};exports[_0x40fb('0x73')]=function(_0x37ad6d,_0x24610d){return db['OpenchannelQueue'][_0x40fb('0x30')]({'where':{'id':_0x37ad6d[_0x40fb('0x26')]['id']}})[_0x40fb('0x14')](handleEntityNotFound(_0x24610d,null))['then'](function(_0x34db3c){if(_0x34db3c){return _0x34db3c[_0x40fb('0x73')](_0x37ad6d[_0x40fb('0x22')][_0x40fb('0x55')])[_0x40fb('0x14')](function(){if(_[_0x40fb('0x77')](_0x37ad6d['query'][_0x40fb('0x55')])){for(var _0x36499b=0x0;_0x36499b<_0x37ad6d[_0x40fb('0x22')][_0x40fb('0x55')][_0x40fb('0x2d')];_0x36499b+=0x1){socket[_0x40fb('0x74')](_0x40fb('0x78'),{'UserId':Number(_0x37ad6d[_0x40fb('0x22')][_0x40fb('0x55')][_0x36499b]),'OpenchannelQueueId':Number(_0x37ad6d[_0x40fb('0x26')]['id'])});}}else{socket[_0x40fb('0x74')](_0x40fb('0x78'),{'UserId':Number(_0x37ad6d[_0x40fb('0x22')][_0x40fb('0x55')]),'OpenchannelQueueId':Number(_0x37ad6d['params']['id'])});}});}})[_0x40fb('0x14')](respondWithStatusCode(_0x24610d,null))[_0x40fb('0x24')](handleError(_0x24610d,null));};exports[_0x40fb('0x79')]=function(_0x1f8d78,_0xa90789){var _0x23bef8={};var _0x2aa26a={};var _0x1929bc;var _0xb5104d;return db[_0x40fb('0x20')][_0x40fb('0x3b')]({'where':{'id':_0x1f8d78[_0x40fb('0x26')]['id']}})[_0x40fb('0x14')](handleEntityNotFound(_0xa90789,null))[_0x40fb('0x14')](function(_0x3c008c){if(_0x3c008c){_0x1929bc=_0x3c008c;_0x2aa26a[_0x40fb('0x27')]=_['keys'](db['User'][_0x40fb('0x29')]);_0x2aa26a[_0x40fb('0x22')]=_['keys'](_0x1f8d78[_0x40fb('0x22')]);_0x2aa26a[_0x40fb('0x3d')]=_[_0x40fb('0x2a')](_0x2aa26a['model'],_0x2aa26a[_0x40fb('0x22')]);_0x23bef8[_0x40fb('0x2b')]=_[_0x40fb('0x2a')](_0x2aa26a[_0x40fb('0x27')],qs[_0x40fb('0x2c')](_0x1f8d78[_0x40fb('0x22')][_0x40fb('0x2c')]));_0x23bef8[_0x40fb('0x2b')]=_0x23bef8[_0x40fb('0x2b')][_0x40fb('0x2d')]?_0x23bef8[_0x40fb('0x2b')]:_0x2aa26a['model'];_0x23bef8[_0x40fb('0x3f')]=qs['sort'](_0x1f8d78['query'][_0x40fb('0x40')]);_0x23bef8[_0x40fb('0x1f')]=qs[_0x40fb('0x3d')](_['pick'](_0x1f8d78[_0x40fb('0x22')],_0x2aa26a['filters']));if(_0x1f8d78[_0x40fb('0x22')]['filter']){_0x23bef8[_0x40fb('0x1f')]=_[_0x40fb('0x2f')](_0x23bef8['where'],{'$or':_[_0x40fb('0x43')](_0x23bef8[_0x40fb('0x2b')],function(_0x2a5e11){var _0x24eb32={};_0x24eb32[_0x2a5e11]={'$like':'%'+_0x1f8d78[_0x40fb('0x22')][_0x40fb('0x52')]+'%'};return _0x24eb32;})});}_0x23bef8=_[_0x40fb('0x2f')]({},_0x23bef8,_0x1f8d78['options']);return _0x1929bc[_0x40fb('0x79')](_0x23bef8);}})[_0x40fb('0x14')](function(_0x18f2d7){if(_0x18f2d7){_0xb5104d=_0x18f2d7[_0x40fb('0x2d')];if(!_0x1f8d78[_0x40fb('0x22')][_0x40fb('0x53')](_0x40fb('0x3e'))){_0x23bef8[_0x40fb('0xf')]=qs[_0x40fb('0xf')](_0x1f8d78['query']['limit']);_0x23bef8[_0x40fb('0x11')]=qs[_0x40fb('0x11')](_0x1f8d78[_0x40fb('0x22')]['offset']);}return _0x1929bc[_0x40fb('0x79')](_0x23bef8);}})['then'](function(_0x74cee9){if(_0x74cee9){return _0x74cee9?{'count':_0xb5104d,'rows':_0x74cee9}:null;}})[_0x40fb('0x14')](respondWithResult(_0xa90789,null))[_0x40fb('0x24')](handleError(_0xa90789,null));}; \ No newline at end of file +var _0x6f35=['userOpenchannelQueue:save','removeTeams','Team','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','sequelize','QueryTypes','SELECT','TeamId','includes','all','union','transaction','forEach','userOpenchannelQueue:remove','addAgents','removeAgents','getAgents','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','./openchannelQueue.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','then','destroy','get','stack','name','index','map','OpenchannelQueue','type','key','getOptions','where','query','rows','catch','model','keys','rawAttributes','filters','intersection','fields','attributes','length','include','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelQueues','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','getMembers','findOne','UserOpenchannelQueue','hasOwnProperty','nolimit','sort','pick','OpenchannelQueueId','filter','findAll','User','findAndCountAll','UserId','agent','openchannelPause','createdAt','format','%s/%s','SIP','updatedAt','order','getTeams','addTeams','ids','Agents','online','voicePause','interface','findOrCreate','emit'];(function(_0x2731a0,_0x5e59ff){var _0x418aed=function(_0xc78500){while(--_0xc78500){_0x2731a0['push'](_0x2731a0['shift']());}};_0x418aed(++_0x5e59ff);}(_0x6f35,0x8e));var _0x56f3=function(_0x257b00,_0x3658be){_0x257b00=_0x257b00-0x0;var _0x247e16=_0x6f35[_0x257b00];return _0x247e16;};'use strict';var BPromise=require(_0x56f3('0x0'));var util=require('util');var _=require(_0x56f3('0x1'));var squel=require(_0x56f3('0x2'));var Redis=require(_0x56f3('0x3'));var qs=require(_0x56f3('0x4'));var logger=require(_0x56f3('0x5'))(_0x56f3('0x6'));var config=require(_0x56f3('0x7'));var db=require(_0x56f3('0x8'))['db'];config[_0x56f3('0x9')]=_[_0x56f3('0xa')](config[_0x56f3('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x56f3('0x9')]));require(_0x56f3('0xb'))[_0x56f3('0xc')](socket);function respondWithStatusCode(_0xb8f1f5,_0x2ba0df){_0x2ba0df=_0x2ba0df||0xcc;return function(_0x10d90f){if(_0x10d90f){return _0xb8f1f5[_0x56f3('0xd')](_0x2ba0df);}return _0xb8f1f5[_0x56f3('0xe')](_0x2ba0df)[_0x56f3('0xf')]();};}function respondWithResult(_0x577f0f,_0x23b837){_0x23b837=_0x23b837||0xc8;return function(_0x2e82ef){if(_0x2e82ef){return _0x577f0f['status'](_0x23b837)[_0x56f3('0x10')](_0x2e82ef);}};}function respondWithFilteredResult(_0x41403d,_0x3e0818){return function(_0x4b8b63){if(_0x4b8b63){var _0x5e7aca=typeof _0x3e0818['offset']===_0x56f3('0x11')&&typeof _0x3e0818[_0x56f3('0x12')]===_0x56f3('0x11');var _0x43b863=_0x4b8b63[_0x56f3('0x13')];var _0x43ad6f=_0x5e7aca?0x0:_0x3e0818[_0x56f3('0x14')];var _0x5c6344=_0x5e7aca?_0x4b8b63[_0x56f3('0x13')]:_0x3e0818['offset']+_0x3e0818[_0x56f3('0x12')];var _0x33ae78;if(_0x5c6344>=_0x43b863){_0x5c6344=_0x43b863;_0x33ae78=0xc8;}else{_0x33ae78=0xce;}_0x41403d[_0x56f3('0xe')](_0x33ae78);return _0x41403d['set'](_0x56f3('0x15'),_0x43ad6f+'-'+_0x5c6344+'/'+_0x43b863)[_0x56f3('0x10')](_0x4b8b63);}return null;};}function saveUpdates(_0x30643e){return function(_0x32c45d){if(_0x32c45d){return _0x32c45d['update'](_0x30643e)[_0x56f3('0x16')](function(_0x241cd2){return _0x241cd2;});}return null;};}function removeEntity(_0x42f2a7){return function(_0x962f34){if(_0x962f34){return _0x962f34[_0x56f3('0x17')]()['then'](function(){var _0x32ec4a=_0x962f34[_0x56f3('0x18')]({'plain':!![]});var _0xbbaa='OpenchannelQueues';return db['UserProfileResource'][_0x56f3('0x17')]({'where':{'type':_0xbbaa,'resourceId':_0x32ec4a['id']}})[_0x56f3('0x16')](function(){return _0x962f34;});})['then'](function(){_0x42f2a7[_0x56f3('0xe')](0xcc)[_0x56f3('0xf')]();});}};}function handleEntityNotFound(_0x26b11a){return function(_0x282e65){if(!_0x282e65){_0x26b11a['sendStatus'](0x194);}return _0x282e65;};}function handleError(_0x4624d4,_0x5dc4fb){_0x5dc4fb=_0x5dc4fb||0x1f4;return function(_0x3f98b4){logger['error'](_0x3f98b4[_0x56f3('0x19')]);if(_0x3f98b4[_0x56f3('0x1a')]){delete _0x3f98b4['name'];}_0x4624d4[_0x56f3('0xe')](_0x5dc4fb)['send'](_0x3f98b4);};}exports[_0x56f3('0x1b')]=function(_0x27a976,_0x1126aa){var _0x5f3ac1={};var _0x52050b={'count':0x0,'rows':[]};var _0x7e45e3=_[_0x56f3('0x1c')](db[_0x56f3('0x1d')]['rawAttributes'],function(_0x23ddde){return{'name':_0x23ddde['fieldName'],'type':_0x23ddde[_0x56f3('0x1e')][_0x56f3('0x1f')]};});_0x5f3ac1=qs[_0x56f3('0x20')](_0x7e45e3,_0x27a976);var _0x51a1fc={'where':_0x5f3ac1[_0x56f3('0x21')]};return db[_0x56f3('0x1d')][_0x56f3('0x13')](_0x51a1fc)['then'](function(_0xbc447c){_0x52050b[_0x56f3('0x13')]=_0xbc447c;_0x5f3ac1['include']=qs['include'](_0x27a976[_0x56f3('0x22')]);return db['OpenchannelQueue']['findAll'](_0x5f3ac1);})[_0x56f3('0x16')](function(_0x41d57d){_0x52050b[_0x56f3('0x23')]=_0x41d57d;return _0x52050b;})[_0x56f3('0x16')](respondWithFilteredResult(_0x1126aa,_0x5f3ac1))[_0x56f3('0x24')](handleError(_0x1126aa,null));};exports['show']=function(_0x4f307a,_0x5e8d08){var _0x179751={'raw':!![],'where':{'id':_0x4f307a['params']['id']}},_0x24561b={};_0x24561b[_0x56f3('0x25')]=_[_0x56f3('0x26')](db[_0x56f3('0x1d')][_0x56f3('0x27')]);_0x24561b[_0x56f3('0x22')]=_[_0x56f3('0x26')](_0x4f307a[_0x56f3('0x22')]);_0x24561b[_0x56f3('0x28')]=_[_0x56f3('0x29')](_0x24561b[_0x56f3('0x25')],_0x24561b[_0x56f3('0x22')]);_0x179751['attributes']=_[_0x56f3('0x29')](_0x24561b[_0x56f3('0x25')],qs[_0x56f3('0x2a')](_0x4f307a[_0x56f3('0x22')][_0x56f3('0x2a')]));_0x179751[_0x56f3('0x2b')]=_0x179751[_0x56f3('0x2b')][_0x56f3('0x2c')]?_0x179751[_0x56f3('0x2b')]:_0x24561b[_0x56f3('0x25')];if(_0x4f307a[_0x56f3('0x22')]['includeAll']){_0x179751[_0x56f3('0x2d')]=[{'all':!![]}];}_0x179751=_[_0x56f3('0x2e')]({},_0x179751,_0x4f307a[_0x56f3('0x2f')]);return db['OpenchannelQueue'][_0x56f3('0x30')](_0x179751)[_0x56f3('0x16')](handleEntityNotFound(_0x5e8d08,null))[_0x56f3('0x16')](respondWithResult(_0x5e8d08,null))[_0x56f3('0x24')](handleError(_0x5e8d08,null));};exports[_0x56f3('0x31')]=function(_0x37d9da,_0xf96d5e){return db['OpenchannelQueue']['create'](_0x37d9da[_0x56f3('0x32')],{})[_0x56f3('0x16')](function(_0xb7025b){var _0x5871c7=_0x37d9da['user'][_0x56f3('0x18')]({'plain':!![]});if(!_0x5871c7)throw new Error(_0x56f3('0x33'));if(_0x5871c7[_0x56f3('0x34')]==='user'){var _0x34bd8a=_0xb7025b[_0x56f3('0x18')]({'plain':!![]});var _0x536b8b=_0x56f3('0x35');return db[_0x56f3('0x36')][_0x56f3('0x30')]({'where':{'name':_0x536b8b,'userProfileId':_0x5871c7[_0x56f3('0x37')]},'raw':!![]})['then'](function(_0xf4e49e){if(_0xf4e49e&&_0xf4e49e['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x34bd8a[_0x56f3('0x1a')],'resourceId':_0x34bd8a['id'],'type':_0xf4e49e['name'],'sectionId':_0xf4e49e['id']},{})[_0x56f3('0x16')](function(){return _0xb7025b;});}else{return _0xb7025b;}})[_0x56f3('0x24')](function(_0x341982){logger['error'](_0x56f3('0x38'),_0x341982);throw _0x341982;});}return _0xb7025b;})[_0x56f3('0x16')](respondWithResult(_0xf96d5e,0xc9))['catch'](handleError(_0xf96d5e,null));};exports[_0x56f3('0x39')]=function(_0x451d45,_0x7320a1){if(_0x451d45[_0x56f3('0x32')]['id']){delete _0x451d45[_0x56f3('0x32')]['id'];}return db[_0x56f3('0x1d')][_0x56f3('0x30')]({'where':{'id':_0x451d45[_0x56f3('0x3a')]['id']}})[_0x56f3('0x16')](handleEntityNotFound(_0x7320a1,null))[_0x56f3('0x16')](saveUpdates(_0x451d45['body'],null))['then'](respondWithResult(_0x7320a1,null))['catch'](handleError(_0x7320a1,null));};exports['destroy']=function(_0x11bdfe,_0x50369c){return db['OpenchannelQueue'][_0x56f3('0x30')]({'where':{'id':_0x11bdfe['params']['id']}})['then'](handleEntityNotFound(_0x50369c,null))[_0x56f3('0x16')](removeEntity(_0x50369c,null))[_0x56f3('0x24')](handleError(_0x50369c,null));};exports[_0x56f3('0x3b')]=function(_0x270fe9,_0x3b24bf){return db[_0x56f3('0x1d')][_0x56f3('0x3b')]()[_0x56f3('0x16')](respondWithResult(_0x3b24bf,null))['catch'](handleError(_0x3b24bf,null));};exports[_0x56f3('0x3c')]=function(_0x123cca,_0x4497fc){var _0x9ec491={'raw':!![],'where':{}},_0x424783={},_0xcc1347;return db[_0x56f3('0x1d')][_0x56f3('0x3d')]({'where':{'id':_0x123cca[_0x56f3('0x3a')]['id']}})['then'](handleEntityNotFound(_0x4497fc,null))['then'](function(_0x14075b){if(_0x14075b){_0xcc1347=_0x14075b['get']({'plain':!![]});_0x424783[_0x56f3('0x25')]=_['keys'](db[_0x56f3('0x3e')][_0x56f3('0x27')]);_0x424783[_0x56f3('0x22')]=_[_0x56f3('0x26')](_0x123cca[_0x56f3('0x22')]);_0x424783[_0x56f3('0x28')]=_[_0x56f3('0x29')](_0x424783[_0x56f3('0x25')],_0x424783['query']);_0x9ec491[_0x56f3('0x2b')]=_[_0x56f3('0x29')](_0x424783[_0x56f3('0x25')],qs[_0x56f3('0x2a')](_0x123cca[_0x56f3('0x22')][_0x56f3('0x2a')]));_0x9ec491['attributes']=_0x9ec491[_0x56f3('0x2b')]['length']?_0x9ec491[_0x56f3('0x2b')]:_0x424783[_0x56f3('0x25')];if(!_0x123cca[_0x56f3('0x22')][_0x56f3('0x3f')](_0x56f3('0x40'))){_0x9ec491[_0x56f3('0x12')]=qs[_0x56f3('0x12')](_0x123cca['query'][_0x56f3('0x12')]);_0x9ec491['offset']=qs['offset'](_0x123cca[_0x56f3('0x22')][_0x56f3('0x14')]);}_0x9ec491['order']=qs[_0x56f3('0x41')](_0x123cca[_0x56f3('0x22')][_0x56f3('0x41')]);_0x9ec491[_0x56f3('0x21')]=qs[_0x56f3('0x28')](_[_0x56f3('0x42')](_0x123cca[_0x56f3('0x22')],_0x424783[_0x56f3('0x28')]));_0x9ec491['where'][_0x56f3('0x43')]=_0x14075b['id'];if(_0x123cca[_0x56f3('0x22')][_0x56f3('0x44')]){_0x9ec491[_0x56f3('0x21')]=_[_0x56f3('0x2e')](_0x9ec491['where'],{'$or':_[_0x56f3('0x1c')](_0x9ec491[_0x56f3('0x2b')],function(_0x88417a){var _0x10cbfc={};_0x10cbfc[_0x88417a]={'$like':'%'+_0x123cca[_0x56f3('0x22')][_0x56f3('0x44')]+'%'};return _0x10cbfc;})});}_0x9ec491=_[_0x56f3('0x2e')]({},_0x9ec491,_0x123cca[_0x56f3('0x2f')]);return db[_0x56f3('0x3e')][_0x56f3('0x45')](_0x9ec491);}})['then'](function(_0x49113f){if(_0x49113f){return db[_0x56f3('0x46')][_0x56f3('0x47')]({'where':{'id':_[_0x56f3('0x1c')](_0x49113f,_0x56f3('0x48')),'role':_0x56f3('0x49')},'attributes':['id','name',_0x56f3('0x4a'),'updatedAt',_0x56f3('0x4b')]});}})['then'](function(_0xb11b0d){if(_0xb11b0d){return{'count':_0xb11b0d['count'],'rows':_[_0x56f3('0x1c')](_0xb11b0d[_0x56f3('0x23')],function(_0x3889c5){return{'membername':_0x3889c5[_0x56f3('0x1a')],'UserId':_0x3889c5['id'],'queue_name':_0xcc1347[_0x56f3('0x1a')],'OpenchannelQueueId':_0xcc1347['id'],'interface':util[_0x56f3('0x4c')](_0x56f3('0x4d'),_0x56f3('0x4e'),_0x3889c5['name']),'penalty':0x0,'paused':_0x3889c5[_0x56f3('0x4a')],'createdAt':_0x3889c5[_0x56f3('0x4b')],'updatedAt':_0x3889c5[_0x56f3('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x56f3('0x16')](respondWithFilteredResult(_0x4497fc,_0x9ec491))[_0x56f3('0x24')](handleError(_0x4497fc,null));};exports['getTeams']=function(_0x1cad85,_0x29d9eb){var _0xafc8d={};var _0x3bcfa1={};var _0x31f556;var _0x5bd3f6;return db['OpenchannelQueue'][_0x56f3('0x3d')]({'where':{'id':_0x1cad85['params']['id']}})[_0x56f3('0x16')](handleEntityNotFound(_0x29d9eb,null))[_0x56f3('0x16')](function(_0x1a07e3){if(_0x1a07e3){_0x31f556=_0x1a07e3;_0x3bcfa1[_0x56f3('0x25')]=_[_0x56f3('0x26')](db['Team'][_0x56f3('0x27')]);_0x3bcfa1['query']=_[_0x56f3('0x26')](_0x1cad85['query']);_0x3bcfa1[_0x56f3('0x28')]=_[_0x56f3('0x29')](_0x3bcfa1[_0x56f3('0x25')],_0x3bcfa1[_0x56f3('0x22')]);_0xafc8d['attributes']=_[_0x56f3('0x29')](_0x3bcfa1['model'],qs['fields'](_0x1cad85['query'][_0x56f3('0x2a')]));_0xafc8d[_0x56f3('0x2b')]=_0xafc8d[_0x56f3('0x2b')]['length']?_0xafc8d[_0x56f3('0x2b')]:_0x3bcfa1[_0x56f3('0x25')];_0xafc8d[_0x56f3('0x50')]=qs['sort'](_0x1cad85[_0x56f3('0x22')]['sort']);_0xafc8d[_0x56f3('0x21')]=qs[_0x56f3('0x28')](_[_0x56f3('0x42')](_0x1cad85[_0x56f3('0x22')],_0x3bcfa1[_0x56f3('0x28')]));if(_0x1cad85[_0x56f3('0x22')][_0x56f3('0x44')]){_0xafc8d[_0x56f3('0x21')]=_[_0x56f3('0x2e')](_0xafc8d['where'],{'$or':_[_0x56f3('0x1c')](_0xafc8d[_0x56f3('0x2b')],function(_0xd64bcc){var _0x1ce65e={};_0x1ce65e[_0xd64bcc]={'$like':'%'+_0x1cad85['query'][_0x56f3('0x44')]+'%'};return _0x1ce65e;})});}_0xafc8d=_[_0x56f3('0x2e')]({},_0xafc8d,_0x1cad85[_0x56f3('0x2f')]);return _0x31f556[_0x56f3('0x51')](_0xafc8d);}})[_0x56f3('0x16')](function(_0x54a4df){if(_0x54a4df){_0x5bd3f6=_0x54a4df[_0x56f3('0x2c')];if(!_0x1cad85[_0x56f3('0x22')][_0x56f3('0x3f')](_0x56f3('0x40'))){_0xafc8d[_0x56f3('0x12')]=qs[_0x56f3('0x12')](_0x1cad85['query']['limit']);_0xafc8d[_0x56f3('0x14')]=qs[_0x56f3('0x14')](_0x1cad85['query'][_0x56f3('0x14')]);}return _0x31f556[_0x56f3('0x51')](_0xafc8d);}})[_0x56f3('0x16')](function(_0x567c05){if(_0x567c05){return _0x567c05?{'count':_0x5bd3f6,'rows':_0x567c05}:null;}})[_0x56f3('0x16')](respondWithResult(_0x29d9eb,null))[_0x56f3('0x24')](handleError(_0x29d9eb,null));};exports[_0x56f3('0x52')]=function(_0x52c9d7,_0x1f83aa){var _0x2aec0c=_0x52c9d7[_0x56f3('0x32')][_0x56f3('0x53')];return db['Team']['findAll']({'where':{'id':_0x2aec0c},'attributes':['id'],'include':[{'model':db['User'],'as':_0x56f3('0x54'),'attributes':['id',_0x56f3('0x1a'),_0x56f3('0x55'),_0x56f3('0x56'),_0x56f3('0x57')],'raw':!![]}]})[_0x56f3('0x16')](function(_0x77d96d){if(_0x77d96d){var _0x5b5ba3=_['flatMap'](_0x77d96d,function(_0x1dd65b){var _0x5981ef=_0x1dd65b[_0x56f3('0x18')]({'plain':!![]});return _0x5981ef[_0x56f3('0x54')];});return db[_0x56f3('0x1d')]['find']({'where':{'id':_0x52c9d7[_0x56f3('0x3a')]['id']}})['then'](function(_0x27c2eb){return db['sequelize']['transaction'](function(_0x27aebc){return _0x27c2eb[_0x56f3('0x52')](_0x2aec0c,{'transaction':_0x27aebc})['then'](function(){return BPromise['each'](_0x5b5ba3,function(_0x45b71e){return db[_0x56f3('0x3e')][_0x56f3('0x58')]({'where':{'UserId':_0x45b71e['id'],'OpenchannelQueueId':_0x52c9d7[_0x56f3('0x3a')]['id']},'transaction':_0x27aebc});});})[_0x56f3('0x16')](function(){_0x5b5ba3['forEach'](function(_0x32d617){socket[_0x56f3('0x59')](_0x56f3('0x5a'),{'UserId':_0x32d617['id'],'OpenchannelQueueId':_0x27c2eb['id']});});});});});}})[_0x56f3('0x16')](respondWithStatusCode(_0x1f83aa,null))[_0x56f3('0x24')](handleError(_0x1f83aa,null));};exports[_0x56f3('0x5b')]=function(_0x5534f8,_0x38c706){return db[_0x56f3('0x5c')][_0x56f3('0x45')]({'where':{'id':_0x5534f8[_0x56f3('0x22')][_0x56f3('0x53')]},'attributes':['id'],'include':[{'model':db[_0x56f3('0x46')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x38c706,null))[_0x56f3('0x16')](function(_0xd8e9f7){var _0x3167ce=_[_0x56f3('0x1c')](_0xd8e9f7,'id');var _0x365306=[];var _0x7eec83=[];var _0x9a1070=squel[_0x56f3('0x5d')]();_0x9a1070[_0x56f3('0x5e')](_0x56f3('0x5f'))[_0x56f3('0x60')](_0x56f3('0x61'),'tq')[_0x56f3('0x62')](_0x56f3('0x63'),'ut',_0x56f3('0x64'))[_0x56f3('0x21')]('OpenchannelQueueId\x20=\x20?',_0x5534f8['params']['id']);for(var _0x3dc497=0x0;_0x3dc497<_0xd8e9f7['length'];_0x3dc497+=0x1){let _0x36fcf8=_0xd8e9f7[_0x3dc497];for(var _0x5a2816=0x0;_0x5a2816<_0x36fcf8['Agents'][_0x56f3('0x2c')];_0x5a2816+=0x1){let _0x44f581=_0x36fcf8[_0x56f3('0x54')][_0x5a2816];var _0x3afd9f=_0x9a1070[_0x56f3('0x65')]();_0x3afd9f[_0x56f3('0x21')]('ut.UserId\x20=\x20?',_0x44f581['id']);_0x7eec83[_0x56f3('0x66')](db[_0x56f3('0x67')][_0x56f3('0x22')](_0x3afd9f['toString'](),{'type':db[_0x56f3('0x67')][_0x56f3('0x68')][_0x56f3('0x69')]})[_0x56f3('0x16')](function(_0x3ff0ed){if(_0x3ff0ed['length']===0x1){return _0x44f581['id'];}else{var _0x1a1342=_['every'](_['map'](_0x3ff0ed,_0x56f3('0x6a')),function(_0x35b154){return _[_0x56f3('0x6b')](_0x3167ce,_0x35b154);});if(_0x1a1342){return _0x44f581['id'];}}}));}}return BPromise[_0x56f3('0x6c')](_0x7eec83)[_0x56f3('0x16')](function(_0x573740){_0x365306=_(_0x365306)[_0x56f3('0x6d')](_0x573740)['compact']()['value']();return db['OpenchannelQueue']['find']({'where':{'id':_0x5534f8[_0x56f3('0x3a')]['id']}})['then'](function(_0x540fb8){return db[_0x56f3('0x67')][_0x56f3('0x6e')](function(_0x1c3d4c){return _0x540fb8[_0x56f3('0x5b')](_0x5534f8[_0x56f3('0x22')][_0x56f3('0x53')],{'transaction':_0x1c3d4c})[_0x56f3('0x16')](function(){if(!_['isEmpty'](_0x365306)){return _0x540fb8['removeAgents'](_0x365306,{'transaction':_0x1c3d4c});}})[_0x56f3('0x16')](function(){_0x365306[_0x56f3('0x6f')](function(_0x500294){socket[_0x56f3('0x59')](_0x56f3('0x70'),{'UserId':_0x500294,'OpenchannelQueueId':_0x540fb8['id']});});});});});});})['then'](respondWithStatusCode(_0x38c706,null))[_0x56f3('0x24')](handleError(_0x38c706,null));};exports['addAgents']=function(_0x5961d8,_0x36f661){return db['OpenchannelQueue']['find']({'where':{'id':_0x5961d8['params']['id']}})[_0x56f3('0x16')](handleEntityNotFound(_0x36f661,null))[_0x56f3('0x16')](function(_0x18848e){if(_0x18848e){return _0x18848e[_0x56f3('0x71')](_0x5961d8[_0x56f3('0x32')][_0x56f3('0x53')],_['omit'](_0x5961d8[_0x56f3('0x32')],[_0x56f3('0x53'),'id'])||{})['spread'](function(_0x3c2a0e){for(var _0x54ae91=0x0;_0x54ae91<_0x5961d8[_0x56f3('0x32')][_0x56f3('0x53')]['length'];_0x54ae91+=0x1){socket['emit'](_0x56f3('0x5a'),{'UserId':Number(_0x5961d8[_0x56f3('0x32')][_0x56f3('0x53')][_0x54ae91]),'OpenchannelQueueId':Number(_0x5961d8[_0x56f3('0x3a')]['id'])});}return _0x3c2a0e;});}})[_0x56f3('0x16')](respondWithResult(_0x36f661,null))[_0x56f3('0x24')](handleError(_0x36f661,null));};exports[_0x56f3('0x72')]=function(_0x3d8914,_0x216757){return db[_0x56f3('0x1d')][_0x56f3('0x30')]({'where':{'id':_0x3d8914[_0x56f3('0x3a')]['id']}})[_0x56f3('0x16')](handleEntityNotFound(_0x216757,null))[_0x56f3('0x16')](function(_0x273090){if(_0x273090){return _0x273090[_0x56f3('0x72')](_0x3d8914[_0x56f3('0x22')]['ids'])[_0x56f3('0x16')](function(){if(_['isArray'](_0x3d8914[_0x56f3('0x22')][_0x56f3('0x53')])){for(var _0x409e8d=0x0;_0x409e8d<_0x3d8914['query'][_0x56f3('0x53')]['length'];_0x409e8d+=0x1){socket['emit'](_0x56f3('0x70'),{'UserId':Number(_0x3d8914[_0x56f3('0x22')][_0x56f3('0x53')][_0x409e8d]),'OpenchannelQueueId':Number(_0x3d8914[_0x56f3('0x3a')]['id'])});}}else{socket['emit'](_0x56f3('0x70'),{'UserId':Number(_0x3d8914[_0x56f3('0x22')][_0x56f3('0x53')]),'OpenchannelQueueId':Number(_0x3d8914[_0x56f3('0x3a')]['id'])});}});}})[_0x56f3('0x16')](respondWithStatusCode(_0x216757,null))['catch'](handleError(_0x216757,null));};exports[_0x56f3('0x73')]=function(_0x3054ef,_0x3076e8){var _0x176547={};var _0x683c44={};var _0x455432;var _0x109abf;return db[_0x56f3('0x1d')]['findOne']({'where':{'id':_0x3054ef[_0x56f3('0x3a')]['id']}})[_0x56f3('0x16')](handleEntityNotFound(_0x3076e8,null))[_0x56f3('0x16')](function(_0x1da95b){if(_0x1da95b){_0x455432=_0x1da95b;_0x683c44[_0x56f3('0x25')]=_['keys'](db[_0x56f3('0x46')]['rawAttributes']);_0x683c44['query']=_['keys'](_0x3054ef[_0x56f3('0x22')]);_0x683c44[_0x56f3('0x28')]=_[_0x56f3('0x29')](_0x683c44[_0x56f3('0x25')],_0x683c44[_0x56f3('0x22')]);_0x176547[_0x56f3('0x2b')]=_[_0x56f3('0x29')](_0x683c44['model'],qs[_0x56f3('0x2a')](_0x3054ef[_0x56f3('0x22')][_0x56f3('0x2a')]));_0x176547[_0x56f3('0x2b')]=_0x176547['attributes'][_0x56f3('0x2c')]?_0x176547[_0x56f3('0x2b')]:_0x683c44[_0x56f3('0x25')];_0x176547[_0x56f3('0x50')]=qs['sort'](_0x3054ef[_0x56f3('0x22')][_0x56f3('0x41')]);_0x176547[_0x56f3('0x21')]=qs[_0x56f3('0x28')](_[_0x56f3('0x42')](_0x3054ef[_0x56f3('0x22')],_0x683c44[_0x56f3('0x28')]));if(_0x3054ef[_0x56f3('0x22')]['filter']){_0x176547[_0x56f3('0x21')]=_[_0x56f3('0x2e')](_0x176547[_0x56f3('0x21')],{'$or':_[_0x56f3('0x1c')](_0x176547[_0x56f3('0x2b')],function(_0x49e0ba){var _0xee8fdc={};_0xee8fdc[_0x49e0ba]={'$like':'%'+_0x3054ef['query'][_0x56f3('0x44')]+'%'};return _0xee8fdc;})});}_0x176547=_['merge']({},_0x176547,_0x3054ef[_0x56f3('0x2f')]);return _0x455432[_0x56f3('0x73')](_0x176547);}})[_0x56f3('0x16')](function(_0x4d195a){if(_0x4d195a){_0x109abf=_0x4d195a[_0x56f3('0x2c')];if(!_0x3054ef[_0x56f3('0x22')]['hasOwnProperty'](_0x56f3('0x40'))){_0x176547[_0x56f3('0x12')]=qs[_0x56f3('0x12')](_0x3054ef[_0x56f3('0x22')][_0x56f3('0x12')]);_0x176547[_0x56f3('0x14')]=qs[_0x56f3('0x14')](_0x3054ef[_0x56f3('0x22')]['offset']);}return _0x455432['getAgents'](_0x176547);}})[_0x56f3('0x16')](function(_0x273946){if(_0x273946){return _0x273946?{'count':_0x109abf,'rows':_0x273946}:null;}})[_0x56f3('0x16')](respondWithResult(_0x3076e8,null))[_0x56f3('0x24')](handleError(_0x3076e8,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 7012145..4d63dc0 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 _0xa405=['hook','exports','events','../../mysqldb','OpenchannelQueue','save','remove','emit','hasOwnProperty'];(function(_0x40015a,_0x415db5){var _0x42f8a4=function(_0x5685ad){while(--_0x5685ad){_0x40015a['push'](_0x40015a['shift']());}};_0x42f8a4(++_0x415db5);}(_0xa405,0x1d6));var _0x5a40=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xa405[_0x167cc1];return _0x10bc4b;};'use strict';var EventEmitter=require(_0x5a40('0x0'));var OpenchannelQueue=require(_0x5a40('0x1'))['db'][_0x5a40('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5a40('0x3'),'afterUpdate':'update','afterDestroy':_0x5a40('0x4')};function emitEvent(_0x4e6c95){return function(_0x3dcfdf,_0x257c0a,_0x2ab7b1){OpenchannelQueueEvents[_0x5a40('0x5')](_0x4e6c95+':'+_0x3dcfdf['id'],_0x3dcfdf);OpenchannelQueueEvents[_0x5a40('0x5')](_0x4e6c95,_0x3dcfdf);_0x2ab7b1(null);};}for(var e in events){if(events[_0x5a40('0x6')](e)){var event=events[e];OpenchannelQueue[_0x5a40('0x7')](e,emitEvent(event));}}module[_0x5a40('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x98ef=['save','update','remove','emit','hook','../../mysqldb','OpenchannelQueue'];(function(_0x297160,_0x82adb3){var _0x2f7717=function(_0x484a8e){while(--_0x484a8e){_0x297160['push'](_0x297160['shift']());}};_0x2f7717(++_0x82adb3);}(_0x98ef,0x11d));var _0xf98e=function(_0x1f2da8,_0x10b850){_0x1f2da8=_0x1f2da8-0x0;var _0x559ddc=_0x98ef[_0x1f2da8];return _0x559ddc;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0xf98e('0x0'))['db'][_0xf98e('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf98e('0x2'),'afterUpdate':_0xf98e('0x3'),'afterDestroy':_0xf98e('0x4')};function emitEvent(_0xeb3bf0){return function(_0x2ef67e,_0x41c147,_0x4813ca){OpenchannelQueueEvents[_0xf98e('0x5')](_0xeb3bf0+':'+_0x2ef67e['id'],_0x2ef67e);OpenchannelQueueEvents[_0xf98e('0x5')](_0xeb3bf0,_0x2ef67e);_0x4813ca(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0xf98e('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index f879333..5af986c 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 _0xe196=['openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0xe196,0x1b4));var _0x6e19=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe196[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x6e19('0x0'));var util=require(_0x6e19('0x1'));var logger=require(_0x6e19('0x2'))(_0x6e19('0x3'));var moment=require(_0x6e19('0x4'));var BPromise=require(_0x6e19('0x5'));var rp=require(_0x6e19('0x6'));var fs=require('fs');var path=require(_0x6e19('0x7'));var rimraf=require(_0x6e19('0x8'));var config=require(_0x6e19('0x9'));var attributes=require(_0x6e19('0xa'));module[_0x6e19('0xb')]=function(_0x28e29a,_0xe80bea){return _0x28e29a[_0x6e19('0xc')](_0x6e19('0xd'),attributes,{'tableName':_0x6e19('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2673=['exports','define','OpenchannelQueue','lodash','../../config/logger','api','moment','bluebird','../../config/environment','./openchannelQueue.attributes'];(function(_0x393064,_0x72d92){var _0x5c30af=function(_0x1952f6){while(--_0x1952f6){_0x393064['push'](_0x393064['shift']());}};_0x5c30af(++_0x72d92);}(_0x2673,0x12f));var _0x3267=function(_0x15da5f,_0x3fce0e){_0x15da5f=_0x15da5f-0x0;var _0x1992f1=_0x2673[_0x15da5f];return _0x1992f1;};'use strict';var _=require(_0x3267('0x0'));var util=require('util');var logger=require(_0x3267('0x1'))(_0x3267('0x2'));var moment=require(_0x3267('0x3'));var BPromise=require(_0x3267('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3267('0x5'));var attributes=require(_0x3267('0x6'));module[_0x3267('0x7')]=function(_0x412d03,_0x1817ff){return _0x412d03[_0x3267('0x8')](_0x3267('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 424ae03..25e4ef4 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 _0xe2ca=['options','raw','where','attributes','limit','include','map','model','GetOpenchannelQueue','ShowOpenchannelQueue','find','moment','bluebird','randomstring','../../mysqldb','../../config/logger','client','redis','localhost','./openchannelQueue.socket','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','OpenchannelQueue','findAll'];(function(_0x5c01ee,_0x53f4ff){var _0x151230=function(_0x3d3a21){while(--_0x3d3a21){_0x5c01ee['push'](_0x5c01ee['shift']());}};_0x151230(++_0x53f4ff);}(_0xe2ca,0x71));var _0xae2c=function(_0x593c6e,_0xc03d0e){_0x593c6e=_0x593c6e-0x0;var _0x6fb15a=_0xe2ca[_0x593c6e];return _0x6fb15a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xae2c('0x0'));var BPromise=require(_0xae2c('0x1'));var rs=require(_0xae2c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xae2c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xae2c('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xae2c('0x5')]['http']({'port':0x232a});config[_0xae2c('0x6')]=_['defaults'](config[_0xae2c('0x6')],{'host':_0xae2c('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xae2c('0x6')]));require(_0xae2c('0x8'))['register'](socket);function respondWithRpcPromise(_0x409810,_0xdbc82,_0x580954){return new BPromise(function(_0x2e8b0b,_0x530a2a){return client['request'](_0x409810,_0x580954)[_0xae2c('0x9')](function(_0x5dd0f8){logger[_0xae2c('0xa')](_0xae2c('0xb'),_0xdbc82,_0xae2c('0xc'));logger[_0xae2c('0xd')](_0xae2c('0xe'),_0xdbc82,'request\x20sent',JSON[_0xae2c('0xf')](_0x5dd0f8));if(_0x5dd0f8[_0xae2c('0x10')]){if(_0x5dd0f8[_0xae2c('0x10')][_0xae2c('0x11')]===0x1f4){logger[_0xae2c('0x10')]('OpenchannelQueue,\x20%s,\x20%s',_0xdbc82,_0x5dd0f8['error'][_0xae2c('0x12')]);return _0x530a2a(_0x5dd0f8[_0xae2c('0x10')][_0xae2c('0x12')]);}logger[_0xae2c('0x10')](_0xae2c('0xb'),_0xdbc82,_0x5dd0f8[_0xae2c('0x10')][_0xae2c('0x12')]);return _0x2e8b0b(_0x5dd0f8[_0xae2c('0x10')][_0xae2c('0x12')]);}else{logger[_0xae2c('0xa')](_0xae2c('0xb'),_0xdbc82,'request\x20sent');_0x2e8b0b(_0x5dd0f8[_0xae2c('0x13')]['message']);}})[_0xae2c('0x14')](function(_0x4fcf7a){logger[_0xae2c('0x10')]('OpenchannelQueue,\x20%s,\x20%s',_0xdbc82,_0x4fcf7a);_0x530a2a(_0x4fcf7a);});});}exports['GetOpenchannelQueue']=function(_0x568441){var _0x2e797a=this;return new Promise(function(_0xc46925,_0x5869c8){return db[_0xae2c('0x15')][_0xae2c('0x16')]({'raw':_0x568441[_0xae2c('0x17')]?_0x568441[_0xae2c('0x17')][_0xae2c('0x18')]===undefined?!![]:![]:!![],'where':_0x568441['options']?_0x568441[_0xae2c('0x17')][_0xae2c('0x19')]||null:null,'attributes':_0x568441[_0xae2c('0x17')]?_0x568441['options'][_0xae2c('0x1a')]||null:null,'limit':_0x568441[_0xae2c('0x17')]?_0x568441['options'][_0xae2c('0x1b')]||null:null,'include':_0x568441[_0xae2c('0x17')]?_0x568441[_0xae2c('0x17')]['include']?_['map'](_0x568441[_0xae2c('0x17')][_0xae2c('0x1c')],function(_0x1612d4){return{'model':db[_0x1612d4['model']],'as':_0x1612d4['as'],'attributes':_0x1612d4[_0xae2c('0x1a')],'include':_0x1612d4[_0xae2c('0x1c')]?_[_0xae2c('0x1d')](_0x1612d4[_0xae2c('0x1c')],function(_0x4ed5fb){return{'model':db[_0x4ed5fb[_0xae2c('0x1e')]],'as':_0x4ed5fb['as'],'attributes':_0x4ed5fb[_0xae2c('0x1a')],'include':_0x4ed5fb[_0xae2c('0x1c')]?_[_0xae2c('0x1d')](_0x4ed5fb[_0xae2c('0x1c')],function(_0x3fa0bf){return{'model':db[_0x3fa0bf[_0xae2c('0x1e')]],'as':_0x3fa0bf['as'],'attributes':_0x3fa0bf['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x275d72){logger[_0xae2c('0xa')]('GetOpenchannelQueue',_0x568441);logger['debug']('GetOpenchannelQueue',_0x568441,JSON[_0xae2c('0xf')](_0x275d72));_0xc46925(_0x275d72);})[_0xae2c('0x14')](function(_0x2f1f72){logger[_0xae2c('0x10')](_0xae2c('0x1f'),_0x2f1f72[_0xae2c('0x12')],_0x568441);_0x5869c8(_0x2e797a[_0xae2c('0x10')](0x1f4,_0x2f1f72[_0xae2c('0x12')]));});});};exports[_0xae2c('0x20')]=function(_0x4e0475){var _0x57d752=this;return new Promise(function(_0x52de61,_0x25246b){return db[_0xae2c('0x15')][_0xae2c('0x21')]({'raw':_0x4e0475[_0xae2c('0x17')]?_0x4e0475[_0xae2c('0x17')][_0xae2c('0x18')]===undefined?!![]:![]:!![],'where':_0x4e0475['options']?_0x4e0475['options'][_0xae2c('0x19')]||null:null,'attributes':_0x4e0475[_0xae2c('0x17')]?_0x4e0475['options'][_0xae2c('0x1a')]||null:null,'include':_0x4e0475[_0xae2c('0x17')]?_0x4e0475['options'][_0xae2c('0x1c')]?_[_0xae2c('0x1d')](_0x4e0475[_0xae2c('0x17')][_0xae2c('0x1c')],function(_0x13219a){return{'model':db[_0x13219a[_0xae2c('0x1e')]],'as':_0x13219a['as'],'attributes':_0x13219a[_0xae2c('0x1a')],'include':_0x13219a[_0xae2c('0x1c')]?_['map'](_0x13219a['include'],function(_0x35de11){return{'model':db[_0x35de11['model']],'as':_0x35de11['as'],'attributes':_0x35de11[_0xae2c('0x1a')],'include':_0x35de11['include']?_['map'](_0x35de11[_0xae2c('0x1c')],function(_0x474e31){return{'model':db[_0x474e31[_0xae2c('0x1e')]],'as':_0x474e31['as'],'attributes':_0x474e31['attributes']};}):[]};}):[]};}):[]:[]})[_0xae2c('0x9')](function(_0x2e38f3){logger[_0xae2c('0xa')]('ShowOpenchannelQueue',_0x4e0475);logger[_0xae2c('0xd')](_0xae2c('0x20'),_0x4e0475,JSON[_0xae2c('0xf')](_0x2e38f3));_0x52de61(_0x2e38f3);})[_0xae2c('0x14')](function(_0x2f82c2){logger[_0xae2c('0x10')]('ShowOpenchannelQueue',_0x2f82c2[_0xae2c('0x12')],_0x4e0475);_0x25246b(_0x57d752[_0xae2c('0x10')](0x1f4,_0x2f82c2[_0xae2c('0x12')]));});});}; \ No newline at end of file +var _0x72e7=['findAll','options','raw','limit','include','map','model','attributes','find','where','ShowOpenchannelQueue','stringify','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','./openchannelQueue.socket','register','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetOpenchannelQueue','OpenchannelQueue'];(function(_0x1c83c9,_0x2a0efc){var _0x49c840=function(_0x2945e2){while(--_0x2945e2){_0x1c83c9['push'](_0x1c83c9['shift']());}};_0x49c840(++_0x2a0efc);}(_0x72e7,0x1e0));var _0x772e=function(_0x4fa8da,_0x50a548){_0x4fa8da=_0x4fa8da-0x0;var _0x4965d0=_0x72e7[_0x4fa8da];return _0x4965d0;};'use strict';var _=require(_0x772e('0x0'));var util=require(_0x772e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x772e('0x2'));var fs=require('fs');var Redis=require(_0x772e('0x3'));var db=require(_0x772e('0x4'))['db'];var utils=require(_0x772e('0x5'));var logger=require(_0x772e('0x6'))('rpc');var config=require(_0x772e('0x7'));var jayson=require(_0x772e('0x8'));var client=jayson['client'][_0x772e('0x9')]({'port':0x232a});config[_0x772e('0xa')]=_[_0x772e('0xb')](config[_0x772e('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x772e('0xa')]));require(_0x772e('0xc'))[_0x772e('0xd')](socket);function respondWithRpcPromise(_0x2a7e59,_0x2ac9a9,_0x290175){return new BPromise(function(_0x2b24cf,_0xeceb1c){return client['request'](_0x2a7e59,_0x290175)[_0x772e('0xe')](function(_0x10f2fc){logger['info'](_0x772e('0xf'),_0x2ac9a9,_0x772e('0x10'));logger[_0x772e('0x11')](_0x772e('0x12'),_0x2ac9a9,_0x772e('0x10'),JSON['stringify'](_0x10f2fc));if(_0x10f2fc[_0x772e('0x13')]){if(_0x10f2fc[_0x772e('0x13')][_0x772e('0x14')]===0x1f4){logger[_0x772e('0x13')](_0x772e('0xf'),_0x2ac9a9,_0x10f2fc[_0x772e('0x13')]['message']);return _0xeceb1c(_0x10f2fc[_0x772e('0x13')][_0x772e('0x15')]);}logger['error'](_0x772e('0xf'),_0x2ac9a9,_0x10f2fc[_0x772e('0x13')][_0x772e('0x15')]);return _0x2b24cf(_0x10f2fc[_0x772e('0x13')][_0x772e('0x15')]);}else{logger[_0x772e('0x16')](_0x772e('0xf'),_0x2ac9a9,_0x772e('0x10'));_0x2b24cf(_0x10f2fc[_0x772e('0x17')][_0x772e('0x15')]);}})[_0x772e('0x18')](function(_0xc55e89){logger[_0x772e('0x13')](_0x772e('0xf'),_0x2ac9a9,_0xc55e89);_0xeceb1c(_0xc55e89);});});}exports[_0x772e('0x19')]=function(_0x3b095a){var _0x516cc2=this;return new Promise(function(_0x397940,_0x18f4e8){return db[_0x772e('0x1a')][_0x772e('0x1b')]({'raw':_0x3b095a[_0x772e('0x1c')]?_0x3b095a[_0x772e('0x1c')][_0x772e('0x1d')]===undefined?!![]:![]:!![],'where':_0x3b095a[_0x772e('0x1c')]?_0x3b095a[_0x772e('0x1c')]['where']||null:null,'attributes':_0x3b095a[_0x772e('0x1c')]?_0x3b095a[_0x772e('0x1c')]['attributes']||null:null,'limit':_0x3b095a['options']?_0x3b095a[_0x772e('0x1c')][_0x772e('0x1e')]||null:null,'include':_0x3b095a[_0x772e('0x1c')]?_0x3b095a[_0x772e('0x1c')][_0x772e('0x1f')]?_[_0x772e('0x20')](_0x3b095a[_0x772e('0x1c')][_0x772e('0x1f')],function(_0x292a2f){return{'model':db[_0x292a2f[_0x772e('0x21')]],'as':_0x292a2f['as'],'attributes':_0x292a2f[_0x772e('0x22')],'include':_0x292a2f['include']?_[_0x772e('0x20')](_0x292a2f[_0x772e('0x1f')],function(_0x4d5aef){return{'model':db[_0x4d5aef[_0x772e('0x21')]],'as':_0x4d5aef['as'],'attributes':_0x4d5aef['attributes'],'include':_0x4d5aef[_0x772e('0x1f')]?_[_0x772e('0x20')](_0x4d5aef[_0x772e('0x1f')],function(_0xe5f4b1){return{'model':db[_0xe5f4b1[_0x772e('0x21')]],'as':_0xe5f4b1['as'],'attributes':_0xe5f4b1['attributes']};}):[]};}):[]};}):[]:[]})[_0x772e('0xe')](function(_0x1e627f){logger[_0x772e('0x16')](_0x772e('0x19'),_0x3b095a);logger['debug']('GetOpenchannelQueue',_0x3b095a,JSON['stringify'](_0x1e627f));_0x397940(_0x1e627f);})[_0x772e('0x18')](function(_0x2d15f5){logger['error'](_0x772e('0x19'),_0x2d15f5[_0x772e('0x15')],_0x3b095a);_0x18f4e8(_0x516cc2[_0x772e('0x13')](0x1f4,_0x2d15f5[_0x772e('0x15')]));});});};exports['ShowOpenchannelQueue']=function(_0x2b55cd){var _0x5fa5dc=this;return new Promise(function(_0x4fa7ff,_0x4c6225){return db['OpenchannelQueue'][_0x772e('0x23')]({'raw':_0x2b55cd[_0x772e('0x1c')]?_0x2b55cd['options']['raw']===undefined?!![]:![]:!![],'where':_0x2b55cd[_0x772e('0x1c')]?_0x2b55cd[_0x772e('0x1c')][_0x772e('0x24')]||null:null,'attributes':_0x2b55cd['options']?_0x2b55cd['options'][_0x772e('0x22')]||null:null,'include':_0x2b55cd[_0x772e('0x1c')]?_0x2b55cd[_0x772e('0x1c')]['include']?_[_0x772e('0x20')](_0x2b55cd[_0x772e('0x1c')][_0x772e('0x1f')],function(_0x81fcc9){return{'model':db[_0x81fcc9[_0x772e('0x21')]],'as':_0x81fcc9['as'],'attributes':_0x81fcc9[_0x772e('0x22')],'include':_0x81fcc9[_0x772e('0x1f')]?_[_0x772e('0x20')](_0x81fcc9[_0x772e('0x1f')],function(_0x8f534b){return{'model':db[_0x8f534b[_0x772e('0x21')]],'as':_0x8f534b['as'],'attributes':_0x8f534b[_0x772e('0x22')],'include':_0x8f534b[_0x772e('0x1f')]?_[_0x772e('0x20')](_0x8f534b[_0x772e('0x1f')],function(_0x5a94c0){return{'model':db[_0x5a94c0[_0x772e('0x21')]],'as':_0x5a94c0['as'],'attributes':_0x5a94c0[_0x772e('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x352698){logger[_0x772e('0x16')](_0x772e('0x25'),_0x2b55cd);logger[_0x772e('0x11')](_0x772e('0x25'),_0x2b55cd,JSON[_0x772e('0x26')](_0x352698));_0x4fa7ff(_0x352698);})[_0x772e('0x18')](function(_0x55fbde){logger[_0x772e('0x13')](_0x772e('0x25'),_0x55fbde[_0x772e('0x15')],_0x2b55cd);_0x4c6225(_0x5fa5dc['error'](0x1f4,_0x55fbde[_0x772e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index d3fa08a..cb4b046 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 _0x2101=['./openchannelQueue.events','remove','length','openchannelQueue:'];(function(_0x23e126,_0x2b3e0a){var _0x448983=function(_0x45765b){while(--_0x45765b){_0x23e126['push'](_0x23e126['shift']());}};_0x448983(++_0x2b3e0a);}(_0x2101,0xec));var _0x1210=function(_0x228bce,_0x4b71ad){_0x228bce=_0x228bce-0x0;var _0x3cc7c5=_0x2101[_0x228bce];return _0x3cc7c5;};'use strict';var OpenchannelQueueEvents=require(_0x1210('0x0'));var events=['save',_0x1210('0x1'),'update'];function createListener(_0x182ace,_0x544a89){return function(_0x1d30f4){_0x544a89['emit'](_0x182ace,_0x1d30f4);};}function removeListener(_0x1f8bd7,_0x365099){return function(){OpenchannelQueueEvents['removeListener'](_0x1f8bd7,_0x365099);};}exports['register']=function(_0x19c5ae){for(var _0x4a5981=0x0,_0x39b8e5=events[_0x1210('0x2')];_0x4a5981<_0x39b8e5;_0x4a5981++){var _0x271fe4=events[_0x4a5981];var _0x354a07=createListener(_0x1210('0x3')+_0x271fe4,_0x19c5ae);OpenchannelQueueEvents['on'](_0x271fe4,_0x354a07);}}; \ No newline at end of file +var _0x587d=['removeListener','register','length','openchannelQueue:','./openchannelQueue.events','save','remove','emit'];(function(_0x138064,_0x438903){var _0x4dc0d6=function(_0x4ed311){while(--_0x4ed311){_0x138064['push'](_0x138064['shift']());}};_0x4dc0d6(++_0x438903);}(_0x587d,0x134));var _0xd587=function(_0x15c236,_0x1328ce){_0x15c236=_0x15c236-0x0;var _0x234900=_0x587d[_0x15c236];return _0x234900;};'use strict';var OpenchannelQueueEvents=require(_0xd587('0x0'));var events=[_0xd587('0x1'),_0xd587('0x2'),'update'];function createListener(_0x36b36d,_0x502f01){return function(_0x52f599){_0x502f01[_0xd587('0x3')](_0x36b36d,_0x52f599);};}function removeListener(_0x44e258,_0x46ca65){return function(){OpenchannelQueueEvents[_0xd587('0x4')](_0x44e258,_0x46ca65);};}exports[_0xd587('0x5')]=function(_0x71b568){for(var _0x270e3e=0x0,_0x568b0a=events[_0xd587('0x6')];_0x270e3e<_0x568b0a;_0x270e3e++){var _0x579279=events[_0x270e3e];var _0x47d747=createListener(_0xd587('0x7')+_0x579279,_0x71b568);OpenchannelQueueEvents['on'](_0x579279,_0x47d747);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index b793c18..20272de 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 _0xfdc2=['isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','get'];(function(_0x19f0ec,_0x364bc8){var _0x28f328=function(_0x573508){while(--_0x573508){_0x19f0ec['push'](_0x19f0ec['shift']());}};_0x28f328(++_0x364bc8);}(_0xfdc2,0x64));var _0x2fdc=function(_0x313bc3,_0x35a7e6){_0x313bc3=_0x313bc3-0x0;var _0x5b3795=_0xfdc2[_0x313bc3];return _0x5b3795;};'use strict';var multer=require(_0x2fdc('0x0'));var util=require(_0x2fdc('0x1'));var path=require(_0x2fdc('0x2'));var timeout=require('connect-timeout');var express=require(_0x2fdc('0x3'));var router=express[_0x2fdc('0x4')]();var fs_extra=require(_0x2fdc('0x5'));var auth=require(_0x2fdc('0x6'));var interaction=require(_0x2fdc('0x7'));var config=require('../../config/environment');var controller=require(_0x2fdc('0x8'));router[_0x2fdc('0x9')]('/',auth[_0x2fdc('0xa')](),controller['index']);router['get'](_0x2fdc('0xb'),auth[_0x2fdc('0xa')](),controller[_0x2fdc('0xc')]);router['get'](_0x2fdc('0xd'),auth[_0x2fdc('0xa')](),controller[_0x2fdc('0xe')]);router[_0x2fdc('0xf')]('/',auth[_0x2fdc('0xa')](),controller[_0x2fdc('0x10')]);router[_0x2fdc('0x11')]('/:id',auth[_0x2fdc('0xa')](),controller[_0x2fdc('0x12')]);router[_0x2fdc('0x13')](_0x2fdc('0xd'),auth[_0x2fdc('0xa')](),controller[_0x2fdc('0x14')]);module[_0x2fdc('0x15')]=router; \ No newline at end of file +var _0xd291=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','put'];(function(_0x50cee2,_0x56709e){var _0x3875c3=function(_0x2812af){while(--_0x2812af){_0x50cee2['push'](_0x50cee2['shift']());}};_0x3875c3(++_0x56709e);}(_0xd291,0x13f));var _0x1d29=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd291[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x1d29('0x0'));var util=require(_0x1d29('0x1'));var path=require(_0x1d29('0x2'));var timeout=require(_0x1d29('0x3'));var express=require(_0x1d29('0x4'));var router=express['Router']();var fs_extra=require(_0x1d29('0x5'));var auth=require(_0x1d29('0x6'));var interaction=require(_0x1d29('0x7'));var config=require(_0x1d29('0x8'));var controller=require(_0x1d29('0x9'));router[_0x1d29('0xa')]('/',auth[_0x1d29('0xb')](),controller['index']);router['get'](_0x1d29('0xc'),auth[_0x1d29('0xb')](),controller[_0x1d29('0xd')]);router[_0x1d29('0xa')](_0x1d29('0xe'),auth['isAuthenticated'](),controller[_0x1d29('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x1d29('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x1d29('0x11')]);router[_0x1d29('0x12')](_0x1d29('0xe'),auth[_0x1d29('0xb')](),controller[_0x1d29('0x13')]);module[_0x1d29('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 198e094..e8e79cf 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 _0x352d=['moment','sequelize','exports','STRING','DATE'];(function(_0x2370db,_0x592999){var _0x47585c=function(_0xb6899e){while(--_0xb6899e){_0x2370db['push'](_0x2370db['shift']());}};_0x47585c(++_0x592999);}(_0x352d,0xe1));var _0xd352=function(_0x554431,_0x4d4b0a){_0x554431=_0x554431-0x0;var _0x4d421a=_0x352d[_0x554431];return _0x4d421a;};'use strict';var moment=require(_0xd352('0x0'));var Sequelize=require(_0xd352('0x1'));module[_0xd352('0x2')]={'uniqueid':{'type':Sequelize[_0xd352('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xd352('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xd352('0x4')]},'reason':{'type':Sequelize[_0xd352('0x3')]}}; \ No newline at end of file +var _0xa80e=['STRING','DATE','moment','sequelize','exports'];(function(_0x19ec40,_0x75c91d){var _0x1c6d1e=function(_0x45c42c){while(--_0x45c42c){_0x19ec40['push'](_0x19ec40['shift']());}};_0x1c6d1e(++_0x75c91d);}(_0xa80e,0x7f));var _0xea80=function(_0x3a777d,_0x2f0f12){_0x3a777d=_0x3a777d-0x0;var _0x5c2dbc=_0xa80e[_0x3a777d];return _0x5c2dbc;};'use strict';var moment=require(_0xea80('0x0'));var Sequelize=require(_0xea80('0x1'));module[_0xea80('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xea80('0x3')]},'joinAt':{'type':Sequelize[_0xea80('0x4')]},'leaveAt':{'type':Sequelize[_0xea80('0x4')]},'acceptAt':{'type':Sequelize[_0xea80('0x4')]},'exitAt':{'type':Sequelize[_0xea80('0x4')]},'reason':{'type':Sequelize[_0xea80('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 2ee6ff5..6335e70 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 _0x11b7=['count','set','Content-Range','json','apply','reject','then','destroy','sendStatus','error','stack','name','index','map','OpenchannelQueueReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','update','describe','request-promise','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit'];(function(_0x1ee6fd,_0x33f3ff){var _0x141b5d=function(_0x33566c){while(--_0x33566c){_0x1ee6fd['push'](_0x1ee6fd['shift']());}};_0x141b5d(++_0x33f3ff);}(_0x11b7,0x196));var _0x711b=function(_0xad11b4,_0x1c6e20){_0xad11b4=_0xad11b4-0x0;var _0x3567f3=_0x11b7[_0xad11b4];return _0x3567f3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x711b('0x0'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x711b('0x1'));var util=require(_0x711b('0x2'));var path=require('path');var sox=require(_0x711b('0x3'));var csv=require(_0x711b('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x711b('0x5'));var _=require(_0x711b('0x6'));var squel=require('squel');var crypto=require(_0x711b('0x7'));var jsforce=require(_0x711b('0x8'));var deskjs=require(_0x711b('0x9'));var toCsv=require(_0x711b('0x4'));var querystring=require(_0x711b('0xa'));var Papa=require(_0x711b('0xb'));var Redis=require(_0x711b('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x711b('0xd'));var as=require(_0x711b('0xe'));var hardwareService=require(_0x711b('0xf'));var logger=require(_0x711b('0x10'))(_0x711b('0x11'));var utils=require(_0x711b('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x711b('0x13'));var db=require(_0x711b('0x14'))['db'];function respondWithStatusCode(_0x55cfa1,_0x3c554e){_0x3c554e=_0x3c554e||0xcc;return function(_0x28eb1b){if(_0x28eb1b){return _0x55cfa1['sendStatus'](_0x3c554e);}return _0x55cfa1[_0x711b('0x15')](_0x3c554e)[_0x711b('0x16')]();};}function respondWithResult(_0x8cb06d,_0x222d61){_0x222d61=_0x222d61||0xc8;return function(_0x272a7f){if(_0x272a7f){return _0x8cb06d['status'](_0x222d61)['json'](_0x272a7f);}};}function respondWithFilteredResult(_0x5cecec,_0x5827aa){return function(_0x211864){if(_0x211864){var _0x58dba4=typeof _0x5827aa[_0x711b('0x17')]===_0x711b('0x18')&&typeof _0x5827aa[_0x711b('0x19')]===_0x711b('0x18');var _0x3e4181=_0x211864[_0x711b('0x1a')];var _0x30004e=_0x58dba4?0x0:_0x5827aa[_0x711b('0x17')];var _0x4d93a5=_0x58dba4?_0x211864[_0x711b('0x1a')]:_0x5827aa[_0x711b('0x17')]+_0x5827aa['limit'];var _0x588112;if(_0x4d93a5>=_0x3e4181){_0x4d93a5=_0x3e4181;_0x588112=0xc8;}else{_0x588112=0xce;}_0x5cecec[_0x711b('0x15')](_0x588112);return _0x5cecec[_0x711b('0x1b')](_0x711b('0x1c'),_0x30004e+'-'+_0x4d93a5+'/'+_0x3e4181)[_0x711b('0x1d')](_0x211864);}return null;};}function patchUpdates(_0x55fe0d){return function(_0x5bdd90){try{jsonpatch[_0x711b('0x1e')](_0x5bdd90,_0x55fe0d,!![]);}catch(_0x375d15){return BPromise[_0x711b('0x1f')](_0x375d15);}return _0x5bdd90['save']();};}function saveUpdates(_0x33a5f9,_0x255653){return function(_0x5375c6){if(_0x5375c6){return _0x5375c6['update'](_0x33a5f9)[_0x711b('0x20')](function(_0x26701c){return _0x26701c;});}return null;};}function removeEntity(_0x3e2777,_0x672b29){return function(_0x2b15ef){if(_0x2b15ef){return _0x2b15ef[_0x711b('0x21')]()[_0x711b('0x20')](function(){_0x3e2777['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b66c5,_0x1f4474){return function(_0x5aa41d){if(!_0x5aa41d){_0x1b66c5[_0x711b('0x22')](0x194);}return _0x5aa41d;};}function handleError(_0x4d9fe0,_0x37e16e){_0x37e16e=_0x37e16e||0x1f4;return function(_0x593483){logger[_0x711b('0x23')](_0x593483[_0x711b('0x24')]);if(_0x593483[_0x711b('0x25')]){delete _0x593483['name'];}_0x4d9fe0[_0x711b('0x15')](_0x37e16e)['send'](_0x593483);};}exports[_0x711b('0x26')]=function(_0x3f0e58,_0x2c256d){var _0x18ad76={},_0x1de08e={},_0x30e758={'count':0x0,'rows':[]};var _0x5dab84=_[_0x711b('0x27')](db[_0x711b('0x28')]['rawAttributes'],function(_0x16653f){return{'name':_0x16653f[_0x711b('0x29')],'type':_0x16653f[_0x711b('0x2a')][_0x711b('0x2b')]};});_0x1de08e[_0x711b('0x2c')]=_[_0x711b('0x27')](_0x5dab84,_0x711b('0x25'));_0x1de08e[_0x711b('0x2d')]=_[_0x711b('0x2e')](_0x3f0e58['query']);_0x1de08e[_0x711b('0x2f')]=_[_0x711b('0x30')](_0x1de08e[_0x711b('0x2c')],_0x1de08e[_0x711b('0x2d')]);_0x18ad76['attributes']=_[_0x711b('0x30')](_0x1de08e[_0x711b('0x2c')],qs['fields'](_0x3f0e58[_0x711b('0x2d')][_0x711b('0x31')]));_0x18ad76[_0x711b('0x32')]=_0x18ad76[_0x711b('0x32')][_0x711b('0x33')]?_0x18ad76[_0x711b('0x32')]:_0x1de08e[_0x711b('0x2c')];if(!_0x3f0e58[_0x711b('0x2d')][_0x711b('0x34')]('nolimit')){_0x18ad76[_0x711b('0x19')]=qs[_0x711b('0x19')](_0x3f0e58[_0x711b('0x2d')]['limit']);_0x18ad76['offset']=qs[_0x711b('0x17')](_0x3f0e58[_0x711b('0x2d')]['offset']);}_0x18ad76['order']=qs[_0x711b('0x35')](_0x3f0e58[_0x711b('0x2d')][_0x711b('0x35')]);_0x18ad76[_0x711b('0x36')]=qs['filters'](_['pick'](_0x3f0e58[_0x711b('0x2d')],_0x1de08e[_0x711b('0x2f')]),_0x5dab84);if(_0x3f0e58[_0x711b('0x2d')]['filter']){_0x18ad76[_0x711b('0x36')]=_[_0x711b('0x37')](_0x18ad76['where'],{'$or':_[_0x711b('0x27')](_0x5dab84,function(_0x2dbda3){if(_0x2dbda3[_0x711b('0x2a')]!==_0x711b('0x38')){var _0x4c1d6e={};_0x4c1d6e[_0x2dbda3[_0x711b('0x25')]]={'$like':'%'+_0x3f0e58[_0x711b('0x2d')][_0x711b('0x39')]+'%'};return _0x4c1d6e;}})});}_0x18ad76=_['merge']({},_0x18ad76,_0x3f0e58['options']);var _0x551f1f={'where':_0x18ad76[_0x711b('0x36')]};return db[_0x711b('0x28')][_0x711b('0x1a')](_0x551f1f)[_0x711b('0x20')](function(_0x52eb3a){_0x30e758[_0x711b('0x1a')]=_0x52eb3a;if(_0x3f0e58[_0x711b('0x2d')][_0x711b('0x3a')]){_0x18ad76[_0x711b('0x3b')]=[{'all':!![]}];}return db[_0x711b('0x28')][_0x711b('0x3c')](_0x18ad76);})['then'](function(_0xc26f12){_0x30e758[_0x711b('0x3d')]=_0xc26f12;return _0x30e758;})[_0x711b('0x20')](respondWithFilteredResult(_0x2c256d,_0x18ad76))[_0x711b('0x3e')](handleError(_0x2c256d,null));};exports[_0x711b('0x3f')]=function(_0x5403d4,_0x52420a){var _0x1e7b0c={'raw':!![],'where':{'id':_0x5403d4[_0x711b('0x40')]['id']}},_0x3cf2e7={};_0x3cf2e7['model']=_[_0x711b('0x2e')](db[_0x711b('0x28')][_0x711b('0x41')]);_0x3cf2e7[_0x711b('0x2d')]=_[_0x711b('0x2e')](_0x5403d4[_0x711b('0x2d')]);_0x3cf2e7[_0x711b('0x2f')]=_[_0x711b('0x30')](_0x3cf2e7[_0x711b('0x2c')],_0x3cf2e7[_0x711b('0x2d')]);_0x1e7b0c[_0x711b('0x32')]=_[_0x711b('0x30')](_0x3cf2e7[_0x711b('0x2c')],qs[_0x711b('0x31')](_0x5403d4['query']['fields']));_0x1e7b0c[_0x711b('0x32')]=_0x1e7b0c[_0x711b('0x32')][_0x711b('0x33')]?_0x1e7b0c['attributes']:_0x3cf2e7[_0x711b('0x2c')];if(_0x5403d4[_0x711b('0x2d')][_0x711b('0x3a')]){_0x1e7b0c[_0x711b('0x3b')]=[{'all':!![]}];}_0x1e7b0c=_[_0x711b('0x37')]({},_0x1e7b0c,_0x5403d4[_0x711b('0x42')]);return db[_0x711b('0x28')][_0x711b('0x43')](_0x1e7b0c)[_0x711b('0x20')](handleEntityNotFound(_0x52420a,null))[_0x711b('0x20')](respondWithResult(_0x52420a,null))[_0x711b('0x3e')](handleError(_0x52420a,null));};exports[_0x711b('0x44')]=function(_0x3ee75c,_0x20ecd2){return db[_0x711b('0x28')][_0x711b('0x44')](_0x3ee75c[_0x711b('0x45')],{})[_0x711b('0x20')](respondWithResult(_0x20ecd2,0xc9))[_0x711b('0x3e')](handleError(_0x20ecd2,null));};exports[_0x711b('0x46')]=function(_0x5ed9a9,_0x41cad6){if(_0x5ed9a9[_0x711b('0x45')]['id']){delete _0x5ed9a9['body']['id'];}return db['OpenchannelQueueReport'][_0x711b('0x43')]({'where':{'id':_0x5ed9a9[_0x711b('0x40')]['id']}})[_0x711b('0x20')](handleEntityNotFound(_0x41cad6,null))[_0x711b('0x20')](saveUpdates(_0x5ed9a9['body'],null))[_0x711b('0x20')](respondWithResult(_0x41cad6,null))[_0x711b('0x3e')](handleError(_0x41cad6,null));};exports[_0x711b('0x21')]=function(_0x2c33f4,_0xf880b8){return db[_0x711b('0x28')]['find']({'where':{'id':_0x2c33f4['params']['id']}})[_0x711b('0x20')](handleEntityNotFound(_0xf880b8,null))[_0x711b('0x20')](removeEntity(_0xf880b8,null))[_0x711b('0x3e')](handleError(_0xf880b8,null));};exports['describe']=function(_0x419213,_0x505932){return db[_0x711b('0x28')][_0x711b('0x47')]()[_0x711b('0x20')](respondWithResult(_0x505932,null))[_0x711b('0x3e')](handleError(_0x505932,null));}; \ No newline at end of file +var _0xbe08=['fs-extra','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','apply','save','update','then','destroy','sendStatus','error','stack','name','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs'];(function(_0x26bf51,_0x5e261a){var _0x503415=function(_0x92b028){while(--_0x92b028){_0x26bf51['push'](_0x26bf51['shift']());}};_0x503415(++_0x5e261a);}(_0xbe08,0x88));var _0x8be0=function(_0x2ae466,_0x5c07c0){_0x2ae466=_0x2ae466-0x0;var _0x3c4090=_0xbe08[_0x2ae466];return _0x3c4090;};'use strict';var emlformat=require(_0x8be0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8be0('0x1'));var rp=require(_0x8be0('0x2'));var moment=require(_0x8be0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8be0('0x4'));var util=require(_0x8be0('0x5'));var path=require(_0x8be0('0x6'));var sox=require(_0x8be0('0x7'));var csv=require(_0x8be0('0x8'));var ejs=require(_0x8be0('0x9'));var fs=require('fs');var fs_extra=require(_0x8be0('0xa'));var _=require('lodash');var squel=require(_0x8be0('0xb'));var crypto=require('crypto');var jsforce=require(_0x8be0('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8be0('0xd'));var Redis=require(_0x8be0('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x8be0('0xf'));var as=require(_0x8be0('0x10'));var hardwareService=require(_0x8be0('0x11'));var logger=require(_0x8be0('0x12'))('api');var utils=require(_0x8be0('0x13'));var config=require(_0x8be0('0x14'));var licenseUtil=require(_0x8be0('0x15'));var db=require(_0x8be0('0x16'))['db'];function respondWithStatusCode(_0x1f59be,_0x283b44){_0x283b44=_0x283b44||0xcc;return function(_0x4e632b){if(_0x4e632b){return _0x1f59be['sendStatus'](_0x283b44);}return _0x1f59be[_0x8be0('0x17')](_0x283b44)[_0x8be0('0x18')]();};}function respondWithResult(_0xfd7b3d,_0x12df3b){_0x12df3b=_0x12df3b||0xc8;return function(_0x54a28f){if(_0x54a28f){return _0xfd7b3d[_0x8be0('0x17')](_0x12df3b)[_0x8be0('0x19')](_0x54a28f);}};}function respondWithFilteredResult(_0x46342d,_0x301583){return function(_0x4f720c){if(_0x4f720c){var _0x3c86cd=typeof _0x301583[_0x8be0('0x1a')]==='undefined'&&typeof _0x301583[_0x8be0('0x1b')]===_0x8be0('0x1c');var _0x4fdc97=_0x4f720c[_0x8be0('0x1d')];var _0x2642e9=_0x3c86cd?0x0:_0x301583[_0x8be0('0x1a')];var _0x541706=_0x3c86cd?_0x4f720c[_0x8be0('0x1d')]:_0x301583[_0x8be0('0x1a')]+_0x301583['limit'];var _0x3a914c;if(_0x541706>=_0x4fdc97){_0x541706=_0x4fdc97;_0x3a914c=0xc8;}else{_0x3a914c=0xce;}_0x46342d[_0x8be0('0x17')](_0x3a914c);return _0x46342d[_0x8be0('0x1e')]('Content-Range',_0x2642e9+'-'+_0x541706+'/'+_0x4fdc97)[_0x8be0('0x19')](_0x4f720c);}return null;};}function patchUpdates(_0x4b157b){return function(_0xadd05d){try{jsonpatch[_0x8be0('0x1f')](_0xadd05d,_0x4b157b,!![]);}catch(_0x4bff58){return BPromise['reject'](_0x4bff58);}return _0xadd05d[_0x8be0('0x20')]();};}function saveUpdates(_0x3b6ea0,_0x3da316){return function(_0x2ecf59){if(_0x2ecf59){return _0x2ecf59[_0x8be0('0x21')](_0x3b6ea0)[_0x8be0('0x22')](function(_0x4faf9a){return _0x4faf9a;});}return null;};}function removeEntity(_0x16156d,_0x247080){return function(_0xe97871){if(_0xe97871){return _0xe97871[_0x8be0('0x23')]()['then'](function(){_0x16156d[_0x8be0('0x17')](0xcc)[_0x8be0('0x18')]();});}};}function handleEntityNotFound(_0x1025a0,_0x4f6f6b){return function(_0x3d77eb){if(!_0x3d77eb){_0x1025a0[_0x8be0('0x24')](0x194);}return _0x3d77eb;};}function handleError(_0x253ea4,_0x5182e1){_0x5182e1=_0x5182e1||0x1f4;return function(_0x5a6aba){logger[_0x8be0('0x25')](_0x5a6aba[_0x8be0('0x26')]);if(_0x5a6aba[_0x8be0('0x27')]){delete _0x5a6aba[_0x8be0('0x27')];}_0x253ea4[_0x8be0('0x17')](_0x5182e1)['send'](_0x5a6aba);};}exports[_0x8be0('0x28')]=function(_0x4af433,_0x440a6b){var _0x199697={},_0x31144e={},_0x252602={'count':0x0,'rows':[]};var _0x8dca23=_[_0x8be0('0x29')](db[_0x8be0('0x2a')][_0x8be0('0x2b')],function(_0x24d5ff){return{'name':_0x24d5ff[_0x8be0('0x2c')],'type':_0x24d5ff[_0x8be0('0x2d')][_0x8be0('0x2e')]};});_0x31144e[_0x8be0('0x2f')]=_[_0x8be0('0x29')](_0x8dca23,_0x8be0('0x27'));_0x31144e[_0x8be0('0x30')]=_[_0x8be0('0x31')](_0x4af433['query']);_0x31144e[_0x8be0('0x32')]=_[_0x8be0('0x33')](_0x31144e['model'],_0x31144e['query']);_0x199697[_0x8be0('0x34')]=_[_0x8be0('0x33')](_0x31144e[_0x8be0('0x2f')],qs['fields'](_0x4af433['query'][_0x8be0('0x35')]));_0x199697['attributes']=_0x199697[_0x8be0('0x34')][_0x8be0('0x36')]?_0x199697[_0x8be0('0x34')]:_0x31144e[_0x8be0('0x2f')];if(!_0x4af433[_0x8be0('0x30')][_0x8be0('0x37')](_0x8be0('0x38'))){_0x199697[_0x8be0('0x1b')]=qs[_0x8be0('0x1b')](_0x4af433['query'][_0x8be0('0x1b')]);_0x199697[_0x8be0('0x1a')]=qs[_0x8be0('0x1a')](_0x4af433['query'][_0x8be0('0x1a')]);}_0x199697['order']=qs['sort'](_0x4af433[_0x8be0('0x30')][_0x8be0('0x39')]);_0x199697['where']=qs[_0x8be0('0x32')](_['pick'](_0x4af433[_0x8be0('0x30')],_0x31144e[_0x8be0('0x32')]),_0x8dca23);if(_0x4af433[_0x8be0('0x30')][_0x8be0('0x3a')]){_0x199697['where']=_[_0x8be0('0x3b')](_0x199697[_0x8be0('0x3c')],{'$or':_['map'](_0x8dca23,function(_0x3d494f){if(_0x3d494f['type']!==_0x8be0('0x3d')){var _0x3767d4={};_0x3767d4[_0x3d494f['name']]={'$like':'%'+_0x4af433[_0x8be0('0x30')][_0x8be0('0x3a')]+'%'};return _0x3767d4;}})});}_0x199697=_['merge']({},_0x199697,_0x4af433[_0x8be0('0x3e')]);var _0x54f0ab={'where':_0x199697[_0x8be0('0x3c')]};return db[_0x8be0('0x2a')][_0x8be0('0x1d')](_0x54f0ab)[_0x8be0('0x22')](function(_0x35a2ee){_0x252602[_0x8be0('0x1d')]=_0x35a2ee;if(_0x4af433[_0x8be0('0x30')]['includeAll']){_0x199697[_0x8be0('0x3f')]=[{'all':!![]}];}return db[_0x8be0('0x2a')][_0x8be0('0x40')](_0x199697);})['then'](function(_0x21dfd6){_0x252602[_0x8be0('0x41')]=_0x21dfd6;return _0x252602;})[_0x8be0('0x22')](respondWithFilteredResult(_0x440a6b,_0x199697))[_0x8be0('0x42')](handleError(_0x440a6b,null));};exports['show']=function(_0x29172e,_0x3b3179){var _0x9f3079={'raw':!![],'where':{'id':_0x29172e[_0x8be0('0x43')]['id']}},_0x456076={};_0x456076[_0x8be0('0x2f')]=_[_0x8be0('0x31')](db['OpenchannelQueueReport']['rawAttributes']);_0x456076[_0x8be0('0x30')]=_['keys'](_0x29172e[_0x8be0('0x30')]);_0x456076[_0x8be0('0x32')]=_['intersection'](_0x456076[_0x8be0('0x2f')],_0x456076[_0x8be0('0x30')]);_0x9f3079[_0x8be0('0x34')]=_[_0x8be0('0x33')](_0x456076[_0x8be0('0x2f')],qs[_0x8be0('0x35')](_0x29172e[_0x8be0('0x30')][_0x8be0('0x35')]));_0x9f3079['attributes']=_0x9f3079[_0x8be0('0x34')]['length']?_0x9f3079['attributes']:_0x456076[_0x8be0('0x2f')];if(_0x29172e[_0x8be0('0x30')][_0x8be0('0x44')]){_0x9f3079[_0x8be0('0x3f')]=[{'all':!![]}];}_0x9f3079=_[_0x8be0('0x3b')]({},_0x9f3079,_0x29172e[_0x8be0('0x3e')]);return db[_0x8be0('0x2a')][_0x8be0('0x45')](_0x9f3079)[_0x8be0('0x22')](handleEntityNotFound(_0x3b3179,null))[_0x8be0('0x22')](respondWithResult(_0x3b3179,null))[_0x8be0('0x42')](handleError(_0x3b3179,null));};exports[_0x8be0('0x46')]=function(_0x5652d0,_0x4ef288){return db['OpenchannelQueueReport']['create'](_0x5652d0[_0x8be0('0x47')],{})[_0x8be0('0x22')](respondWithResult(_0x4ef288,0xc9))[_0x8be0('0x42')](handleError(_0x4ef288,null));};exports['update']=function(_0x14f294,_0x7bd1b0){if(_0x14f294['body']['id']){delete _0x14f294['body']['id'];}return db[_0x8be0('0x2a')][_0x8be0('0x45')]({'where':{'id':_0x14f294[_0x8be0('0x43')]['id']}})[_0x8be0('0x22')](handleEntityNotFound(_0x7bd1b0,null))['then'](saveUpdates(_0x14f294['body'],null))[_0x8be0('0x22')](respondWithResult(_0x7bd1b0,null))[_0x8be0('0x42')](handleError(_0x7bd1b0,null));};exports[_0x8be0('0x23')]=function(_0x323b4b,_0x1695d5){return db[_0x8be0('0x2a')][_0x8be0('0x45')]({'where':{'id':_0x323b4b[_0x8be0('0x43')]['id']}})[_0x8be0('0x22')](handleEntityNotFound(_0x1695d5,null))['then'](removeEntity(_0x1695d5,null))[_0x8be0('0x42')](handleError(_0x1695d5,null));};exports['describe']=function(_0x549fed,_0x8d6519){return db['OpenchannelQueueReport'][_0x8be0('0x48')]()[_0x8be0('0x22')](respondWithResult(_0x8d6519,null))[_0x8be0('0x42')](handleError(_0x8d6519,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 3ba9a3b..5dac4f1 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0x3b96cf,_0x1592f2){var _0x2e315a=function(_0x21fa50){while(--_0x21fa50){_0x3b96cf['push'](_0x3b96cf['shift']());}};_0x2e315a(++_0x1592f2);}(_0x814b,0x1a2));var _0xb814=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x814b[_0x5f3f88];return _0xd08119;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2ef3=['define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./openchannelQueueReport.attributes','exports'];(function(_0x32a299,_0x4f1137){var _0x420086=function(_0x15a2b2){while(--_0x15a2b2){_0x32a299['push'](_0x32a299['shift']());}};_0x420086(++_0x4f1137);}(_0x2ef3,0xba));var _0x32ef=function(_0x1e4c4f,_0x53e5b5){_0x1e4c4f=_0x1e4c4f-0x0;var _0x55534c=_0x2ef3[_0x1e4c4f];return _0x55534c;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[{'name':_0x32ef('0xd'),'fields':[_0x32ef('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 07d58d5..28edb20 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 _0xfcbb=['body','raw','where','attributes','limit','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','UpdateOpenchannelQueueReport','update'];(function(_0x218445,_0x1e241e){var _0x303561=function(_0xc7b9be){while(--_0xc7b9be){_0x218445['push'](_0x218445['shift']());}};_0x303561(++_0x1e241e);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x56e399,_0x592bc6){_0x56e399=_0x56e399-0x0;var _0x16f4c6=_0xfcbb[_0x56e399];return _0x16f4c6;};'use strict';var _=require(_0xbfcb('0x0'));var util=require(_0xbfcb('0x1'));var moment=require(_0xbfcb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbfcb('0x3'));var db=require(_0xbfcb('0x4'))['db'];var utils=require(_0xbfcb('0x5'));var logger=require(_0xbfcb('0x6'))(_0xbfcb('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbfcb('0x8')][_0xbfcb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8d4e6a,_0x2df839,_0x288ee5){return new BPromise(function(_0x2f875c,_0x49717b){return client['request'](_0x8d4e6a,_0x288ee5)[_0xbfcb('0xa')](function(_0x331173){logger[_0xbfcb('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x2df839,_0xbfcb('0xc'));logger[_0xbfcb('0xd')](_0xbfcb('0xe'),_0x2df839,_0xbfcb('0xc'),JSON[_0xbfcb('0xf')](_0x331173));if(_0x331173[_0xbfcb('0x10')]){if(_0x331173['error'][_0xbfcb('0x11')]===0x1f4){logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x331173[_0xbfcb('0x10')]['message']);return _0x49717b(_0x331173[_0xbfcb('0x10')]['message']);}logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x331173[_0xbfcb('0x10')][_0xbfcb('0x13')]);return _0x2f875c(_0x331173[_0xbfcb('0x10')][_0xbfcb('0x13')]);}else{logger[_0xbfcb('0xb')](_0xbfcb('0x12'),_0x2df839,_0xbfcb('0xc'));_0x2f875c(_0x331173[_0xbfcb('0x14')][_0xbfcb('0x13')]);}})[_0xbfcb('0x15')](function(_0x26f335){logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x26f335);_0x49717b(_0x26f335);});});}exports[_0xbfcb('0x16')]=function(_0xba1d6){var _0x38689e=this;return new Promise(function(_0x3404aa,_0x46b8d2){return db[_0xbfcb('0x17')][_0xbfcb('0x18')](_0xba1d6['body'],{'raw':_0xba1d6[_0xbfcb('0x19')]?_0xba1d6[_0xbfcb('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xbfcb('0xa')](function(_0x1a7225){logger['info']('CreateOpenchannelQueueReport',_0xba1d6);logger[_0xbfcb('0xd')](_0xbfcb('0x16'),_0xba1d6,JSON[_0xbfcb('0xf')](_0x1a7225));_0x3404aa(_0x1a7225);})[_0xbfcb('0x15')](function(_0x1c5924){logger['error'](_0xbfcb('0x16'),_0x1c5924[_0xbfcb('0x13')],_0xba1d6);_0x46b8d2(_0x38689e[_0xbfcb('0x10')](0x1f4,_0x1c5924[_0xbfcb('0x13')]));});});};exports[_0xbfcb('0x1a')]=function(_0x19616c){var _0x69c8e9=this;return new Promise(function(_0x14e43c,_0x11f6f7){return db[_0xbfcb('0x17')][_0xbfcb('0x1b')](_0x19616c[_0xbfcb('0x1c')],{'raw':_0x19616c[_0xbfcb('0x19')]?_0x19616c[_0xbfcb('0x19')][_0xbfcb('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19616c[_0xbfcb('0x19')]?_0x19616c['options'][_0xbfcb('0x1e')]||null:null,'attributes':_0x19616c[_0xbfcb('0x19')]?_0x19616c['options'][_0xbfcb('0x1f')]||null:null,'limit':_0x19616c[_0xbfcb('0x19')]?_0x19616c[_0xbfcb('0x19')][_0xbfcb('0x20')]||null:null})[_0xbfcb('0xa')](function(_0x3542e9){logger[_0xbfcb('0xb')](_0xbfcb('0x1a'),_0x19616c);logger[_0xbfcb('0xd')](_0xbfcb('0x1a'),_0x19616c,JSON['stringify'](_0x3542e9));_0x14e43c(_0x3542e9);})[_0xbfcb('0x15')](function(_0x3aa3cd){logger[_0xbfcb('0x10')](_0xbfcb('0x1a'),_0x3aa3cd[_0xbfcb('0x13')],_0x19616c);_0x11f6f7(_0x69c8e9[_0xbfcb('0x10')](0x1f4,_0x3aa3cd[_0xbfcb('0x13')]));});});}; \ No newline at end of file +var _0x36ee=['CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','raw','update','body','attributes','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch'];(function(_0x2e2276,_0x43b703){var _0x5b61d5=function(_0x13fdef){while(--_0x13fdef){_0x2e2276['push'](_0x2e2276['shift']());}};_0x5b61d5(++_0x43b703);}(_0x36ee,0xe8));var _0xe36e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x36ee[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe36e('0x0'));var BPromise=require('bluebird');var rs=require(_0xe36e('0x1'));var fs=require('fs');var Redis=require(_0xe36e('0x2'));var db=require(_0xe36e('0x3'))['db'];var utils=require(_0xe36e('0x4'));var logger=require(_0xe36e('0x5'))(_0xe36e('0x6'));var config=require(_0xe36e('0x7'));var jayson=require(_0xe36e('0x8'));var client=jayson[_0xe36e('0x9')][_0xe36e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21be0b,_0x1aa596,_0x51b4bd){return new BPromise(function(_0x74b4b7,_0x4aebdd){return client[_0xe36e('0xb')](_0x21be0b,_0x51b4bd)[_0xe36e('0xc')](function(_0x46f239){logger['info'](_0xe36e('0xd'),_0x1aa596,'request\x20sent');logger[_0xe36e('0xe')](_0xe36e('0xf'),_0x1aa596,_0xe36e('0x10'),JSON[_0xe36e('0x11')](_0x46f239));if(_0x46f239[_0xe36e('0x12')]){if(_0x46f239[_0xe36e('0x12')][_0xe36e('0x13')]===0x1f4){logger[_0xe36e('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x1aa596,_0x46f239[_0xe36e('0x12')][_0xe36e('0x14')]);return _0x4aebdd(_0x46f239[_0xe36e('0x12')][_0xe36e('0x14')]);}logger['error'](_0xe36e('0xd'),_0x1aa596,_0x46f239['error']['message']);return _0x74b4b7(_0x46f239[_0xe36e('0x12')][_0xe36e('0x14')]);}else{logger[_0xe36e('0x15')](_0xe36e('0xd'),_0x1aa596,_0xe36e('0x10'));_0x74b4b7(_0x46f239[_0xe36e('0x16')][_0xe36e('0x14')]);}})[_0xe36e('0x17')](function(_0x387c37){logger[_0xe36e('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x1aa596,_0x387c37);_0x4aebdd(_0x387c37);});});}exports[_0xe36e('0x18')]=function(_0x2184ae){var _0x56c019=this;return new Promise(function(_0x21d9a3,_0x533c06){return db[_0xe36e('0x19')][_0xe36e('0x1a')](_0x2184ae['body'],{'raw':_0x2184ae[_0xe36e('0x1b')]?_0x2184ae[_0xe36e('0x1b')][_0xe36e('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x21e95e){logger[_0xe36e('0x15')](_0xe36e('0x18'),_0x2184ae);logger[_0xe36e('0xe')](_0xe36e('0x18'),_0x2184ae,JSON[_0xe36e('0x11')](_0x21e95e));_0x21d9a3(_0x21e95e);})['catch'](function(_0xd71137){logger[_0xe36e('0x12')](_0xe36e('0x18'),_0xd71137[_0xe36e('0x14')],_0x2184ae);_0x533c06(_0x56c019[_0xe36e('0x12')](0x1f4,_0xd71137['message']));});});};exports['UpdateOpenchannelQueueReport']=function(_0x4749a8){var _0x10818d=this;return new Promise(function(_0xb0cd85,_0xb32195){return db[_0xe36e('0x19')][_0xe36e('0x1d')](_0x4749a8[_0xe36e('0x1e')],{'raw':_0x4749a8['options']?_0x4749a8[_0xe36e('0x1b')][_0xe36e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4749a8[_0xe36e('0x1b')]?_0x4749a8[_0xe36e('0x1b')]['where']||null:null,'attributes':_0x4749a8[_0xe36e('0x1b')]?_0x4749a8['options'][_0xe36e('0x1f')]||null:null,'limit':_0x4749a8['options']?_0x4749a8[_0xe36e('0x1b')]['limit']||null:null})[_0xe36e('0xc')](function(_0x4c5d98){logger[_0xe36e('0x15')]('UpdateOpenchannelQueueReport',_0x4749a8);logger['debug']('UpdateOpenchannelQueueReport',_0x4749a8,JSON['stringify'](_0x4c5d98));_0xb0cd85(_0x4c5d98);})[_0xe36e('0x17')](function(_0x1fc639){logger['error']('UpdateOpenchannelQueueReport',_0x1fc639[_0xe36e('0x14')],_0x4749a8);_0xb32195(_0x10818d[_0xe36e('0x12')](0x1f4,_0x1fc639[_0xe36e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index a084d94..77a1ef2 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 _0x0fa4=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x43330e,_0x3ddaae){var _0x9fedf4=function(_0x3b0708){while(--_0x3b0708){_0x43330e['push'](_0x43330e['shift']());}};_0x9fedf4(++_0x3ddaae);}(_0x0fa4,0x17b));var _0x40fa=function(_0x5326dc,_0x526083){_0x5326dc=_0x5326dc-0x0;var _0x27da77=_0x0fa4[_0x5326dc];return _0x27da77;};'use strict';var multer=require(_0x40fa('0x0'));var util=require(_0x40fa('0x1'));var path=require(_0x40fa('0x2'));var timeout=require(_0x40fa('0x3'));var express=require(_0x40fa('0x4'));var router=express[_0x40fa('0x5')]();var fs_extra=require(_0x40fa('0x6'));var auth=require(_0x40fa('0x7'));var interaction=require(_0x40fa('0x8'));var config=require(_0x40fa('0x9'));var controller=require(_0x40fa('0xa'));router[_0x40fa('0xb')]('/',auth[_0x40fa('0xc')](),controller[_0x40fa('0xd')]);router['get'](_0x40fa('0xe'),auth[_0x40fa('0xc')](),controller[_0x40fa('0xf')]);router[_0x40fa('0xb')](_0x40fa('0x10'),auth[_0x40fa('0xc')](),controller[_0x40fa('0x11')]);router[_0x40fa('0x12')]('/',auth[_0x40fa('0xc')](),controller[_0x40fa('0x13')]);router[_0x40fa('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x40fa('0x15')]);router['delete'](_0x40fa('0x10'),auth[_0x40fa('0xc')](),controller[_0x40fa('0x16')]);module[_0x40fa('0x17')]=router; \ No newline at end of file +var _0xe261=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','update','delete','destroy','exports','multer'];(function(_0x4d1be0,_0x135738){var _0x47d662=function(_0xdd044e){while(--_0xdd044e){_0x4d1be0['push'](_0x4d1be0['shift']());}};_0x47d662(++_0x135738);}(_0xe261,0x133));var _0x1e26=function(_0x1f0fdd,_0x51192b){_0x1f0fdd=_0x1f0fdd-0x0;var _0x389232=_0xe261[_0x1f0fdd];return _0x389232;};'use strict';var multer=require(_0x1e26('0x0'));var util=require(_0x1e26('0x1'));var path=require(_0x1e26('0x2'));var timeout=require(_0x1e26('0x3'));var express=require(_0x1e26('0x4'));var router=express[_0x1e26('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1e26('0x6'));var interaction=require(_0x1e26('0x7'));var config=require(_0x1e26('0x8'));var controller=require(_0x1e26('0x9'));router[_0x1e26('0xa')]('/',auth[_0x1e26('0xb')](),controller[_0x1e26('0xc')]);router[_0x1e26('0xa')](_0x1e26('0xd'),auth['isAuthenticated'](),controller[_0x1e26('0xe')]);router['get'](_0x1e26('0xf'),auth[_0x1e26('0xb')](),controller[_0x1e26('0x10')]);router['post']('/',auth[_0x1e26('0xb')](),controller['create']);router[_0x1e26('0x11')](_0x1e26('0xf'),auth[_0x1e26('0xb')](),controller[_0x1e26('0x12')]);router[_0x1e26('0x13')](_0x1e26('0xf'),auth[_0x1e26('0xb')](),controller[_0x1e26('0x14')]);module[_0x1e26('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 feeb081..4556a62 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x4833e2,_0x521235){var _0x5e8b2a=function(_0x566a59){while(--_0x566a59){_0x4833e2['push'](_0x4833e2['shift']());}};_0x5e8b2a(++_0x521235);}(_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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0xca7971,_0x42e52f){var _0x43a5d4=function(_0x160b19){while(--_0x160b19){_0xca7971['push'](_0xca7971['shift']());}};_0x43a5d4(++_0x42e52f);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x197185,_0x251145){_0x197185=_0x197185-0x0;var _0x2c8af1=_0xf3cd[_0x197185];return _0x2c8af1;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index f5b4d0d..eec2328 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 _0x742f=['path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','reject','then','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','key','filters','intersection','model','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','find','catch','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x5680b1,_0x4ffb1d){var _0x336629=function(_0x4de39a){while(--_0x4de39a){_0x5680b1['push'](_0x5680b1['shift']());}};_0x336629(++_0x4ffb1d);}(_0x742f,0x131));var _0xf742=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x742f[_0x9cd4c3];return _0x4c9025;};'use strict';var emlformat=require(_0xf742('0x0'));var rimraf=require(_0xf742('0x1'));var zipdir=require(_0xf742('0x2'));var jsonpatch=require(_0xf742('0x3'));var rp=require(_0xf742('0x4'));var moment=require(_0xf742('0x5'));var BPromise=require(_0xf742('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf742('0x7'));var sox=require(_0xf742('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf742('0x9'));var _=require(_0xf742('0xa'));var squel=require(_0xf742('0xb'));var crypto=require(_0xf742('0xc'));var jsforce=require(_0xf742('0xd'));var deskjs=require(_0xf742('0xe'));var toCsv=require(_0xf742('0xf'));var querystring=require(_0xf742('0x10'));var Papa=require(_0xf742('0x11'));var Redis=require(_0xf742('0x12'));var authService=require(_0xf742('0x13'));var qs=require(_0xf742('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf742('0x15'));var logger=require('../../config/logger')(_0xf742('0x16'));var utils=require(_0xf742('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xf742('0x18'));var db=require(_0xf742('0x19'))['db'];function respondWithStatusCode(_0x2cfb2e,_0x256482){_0x256482=_0x256482||0xcc;return function(_0x47af88){if(_0x47af88){return _0x2cfb2e[_0xf742('0x1a')](_0x256482);}return _0x2cfb2e['status'](_0x256482)[_0xf742('0x1b')]();};}function respondWithResult(_0x2c5ac3,_0x4e716f){_0x4e716f=_0x4e716f||0xc8;return function(_0xa6878e){if(_0xa6878e){return _0x2c5ac3[_0xf742('0x1c')](_0x4e716f)[_0xf742('0x1d')](_0xa6878e);}};}function respondWithFilteredResult(_0x230acb,_0x5b394f){return function(_0x56878e){if(_0x56878e){var _0x52586f=typeof _0x5b394f['offset']===_0xf742('0x1e')&&typeof _0x5b394f[_0xf742('0x1f')]===_0xf742('0x1e');var _0x502e34=_0x56878e[_0xf742('0x20')];var _0x395678=_0x52586f?0x0:_0x5b394f[_0xf742('0x21')];var _0x385b10=_0x52586f?_0x56878e[_0xf742('0x20')]:_0x5b394f[_0xf742('0x21')]+_0x5b394f[_0xf742('0x1f')];var _0x3b4310;if(_0x385b10>=_0x502e34){_0x385b10=_0x502e34;_0x3b4310=0xc8;}else{_0x3b4310=0xce;}_0x230acb[_0xf742('0x1c')](_0x3b4310);return _0x230acb[_0xf742('0x22')]('Content-Range',_0x395678+'-'+_0x385b10+'/'+_0x502e34)[_0xf742('0x1d')](_0x56878e);}return null;};}function patchUpdates(_0x59e908){return function(_0x1ba741){try{jsonpatch[_0xf742('0x23')](_0x1ba741,_0x59e908,!![]);}catch(_0x2a2cbb){return BPromise[_0xf742('0x24')](_0x2a2cbb);}return _0x1ba741['save']();};}function saveUpdates(_0x1df8c2,_0x4cada8){return function(_0x430bc5){if(_0x430bc5){return _0x430bc5['update'](_0x1df8c2)[_0xf742('0x25')](function(_0x8c322){return _0x8c322;});}return null;};}function removeEntity(_0x5a4aec,_0x4e47e1){return function(_0xa04293){if(_0xa04293){return _0xa04293['destroy']()[_0xf742('0x25')](function(){_0x5a4aec['status'](0xcc)[_0xf742('0x1b')]();});}};}function handleEntityNotFound(_0x51e099,_0x16f895){return function(_0x5c74d4){if(!_0x5c74d4){_0x51e099[_0xf742('0x1a')](0x194);}return _0x5c74d4;};}function handleError(_0x57dede,_0x5d188f){_0x5d188f=_0x5d188f||0x1f4;return function(_0x27c770){logger[_0xf742('0x26')](_0x27c770[_0xf742('0x27')]);if(_0x27c770[_0xf742('0x28')]){delete _0x27c770[_0xf742('0x28')];}_0x57dede[_0xf742('0x1c')](_0x5d188f)[_0xf742('0x29')](_0x27c770);};}exports[_0xf742('0x2a')]=function(_0xf64017,_0x3ab10a){var _0x3e9963={},_0x291a5f={},_0x72331f={'count':0x0,'rows':[]};var _0x1078bb=_[_0xf742('0x2b')](db[_0xf742('0x2c')][_0xf742('0x2d')],function(_0x32477e){return{'name':_0x32477e[_0xf742('0x2e')],'type':_0x32477e['type'][_0xf742('0x2f')]};});_0x291a5f['model']=_[_0xf742('0x2b')](_0x1078bb,_0xf742('0x28'));_0x291a5f['query']=_['keys'](_0xf64017['query']);_0x291a5f[_0xf742('0x30')]=_[_0xf742('0x31')](_0x291a5f[_0xf742('0x32')],_0x291a5f['query']);_0x3e9963[_0xf742('0x33')]=_[_0xf742('0x31')](_0x291a5f[_0xf742('0x32')],qs[_0xf742('0x34')](_0xf64017[_0xf742('0x35')][_0xf742('0x34')]));_0x3e9963[_0xf742('0x33')]=_0x3e9963['attributes'][_0xf742('0x36')]?_0x3e9963[_0xf742('0x33')]:_0x291a5f['model'];if(!_0xf64017[_0xf742('0x35')][_0xf742('0x37')](_0xf742('0x38'))){_0x3e9963[_0xf742('0x1f')]=qs[_0xf742('0x1f')](_0xf64017[_0xf742('0x35')][_0xf742('0x1f')]);_0x3e9963[_0xf742('0x21')]=qs[_0xf742('0x21')](_0xf64017['query'][_0xf742('0x21')]);}_0x3e9963[_0xf742('0x39')]=qs[_0xf742('0x3a')](_0xf64017[_0xf742('0x35')][_0xf742('0x3a')]);_0x3e9963[_0xf742('0x3b')]=qs[_0xf742('0x30')](_[_0xf742('0x3c')](_0xf64017['query'],_0x291a5f[_0xf742('0x30')]),_0x1078bb);if(_0xf64017[_0xf742('0x35')][_0xf742('0x3d')]){_0x3e9963[_0xf742('0x3b')]=_[_0xf742('0x3e')](_0x3e9963['where'],{'$or':_['map'](_0x1078bb,function(_0x2436cd){if(_0x2436cd[_0xf742('0x3f')]!==_0xf742('0x40')){var _0x29ecc3={};_0x29ecc3[_0x2436cd[_0xf742('0x28')]]={'$like':'%'+_0xf64017[_0xf742('0x35')][_0xf742('0x3d')]+'%'};return _0x29ecc3;}})});}_0x3e9963=_[_0xf742('0x3e')]({},_0x3e9963,_0xf64017[_0xf742('0x41')]);var _0x4dca88={'where':_0x3e9963[_0xf742('0x3b')]};return db[_0xf742('0x2c')]['count'](_0x4dca88)[_0xf742('0x25')](function(_0x310a50){_0x72331f[_0xf742('0x20')]=_0x310a50;if(_0xf64017['query'][_0xf742('0x42')]){_0x3e9963[_0xf742('0x43')]=[{'all':!![]}];}return db[_0xf742('0x2c')][_0xf742('0x44')](_0x3e9963);})[_0xf742('0x25')](function(_0x99cdea){_0x72331f[_0xf742('0x45')]=_0x99cdea;return _0x72331f;})[_0xf742('0x25')](respondWithFilteredResult(_0x3ab10a,_0x3e9963))['catch'](handleError(_0x3ab10a,null));};exports['show']=function(_0x3b8f03,_0x2f49b4){var _0x5df404={'raw':!![],'where':{'id':_0x3b8f03[_0xf742('0x46')]['id']}},_0x1b9786={};_0x1b9786[_0xf742('0x32')]=_[_0xf742('0x47')](db[_0xf742('0x2c')][_0xf742('0x2d')]);_0x1b9786['query']=_[_0xf742('0x47')](_0x3b8f03['query']);_0x1b9786[_0xf742('0x30')]=_[_0xf742('0x31')](_0x1b9786[_0xf742('0x32')],_0x1b9786['query']);_0x5df404[_0xf742('0x33')]=_[_0xf742('0x31')](_0x1b9786[_0xf742('0x32')],qs[_0xf742('0x34')](_0x3b8f03[_0xf742('0x35')][_0xf742('0x34')]));_0x5df404[_0xf742('0x33')]=_0x5df404['attributes'][_0xf742('0x36')]?_0x5df404[_0xf742('0x33')]:_0x1b9786['model'];if(_0x3b8f03[_0xf742('0x35')]['includeAll']){_0x5df404[_0xf742('0x43')]=[{'all':!![]}];}_0x5df404=_[_0xf742('0x3e')]({},_0x5df404,_0x3b8f03[_0xf742('0x41')]);return db[_0xf742('0x2c')][_0xf742('0x48')](_0x5df404)[_0xf742('0x25')](handleEntityNotFound(_0x2f49b4,null))[_0xf742('0x25')](respondWithResult(_0x2f49b4,null))[_0xf742('0x49')](handleError(_0x2f49b4,null));};exports['create']=function(_0x5e3a11,_0x5165e8){return db[_0xf742('0x2c')][_0xf742('0x4a')](_0x5e3a11['body'],{})['then'](respondWithResult(_0x5165e8,0xc9))[_0xf742('0x49')](handleError(_0x5165e8,null));};exports[_0xf742('0x4b')]=function(_0x466267,_0xd36475){if(_0x466267[_0xf742('0x4c')]['id']){delete _0x466267[_0xf742('0x4c')]['id'];}return db[_0xf742('0x2c')][_0xf742('0x48')]({'where':{'id':_0x466267['params']['id']}})[_0xf742('0x25')](handleEntityNotFound(_0xd36475,null))[_0xf742('0x25')](saveUpdates(_0x466267[_0xf742('0x4c')],null))[_0xf742('0x25')](respondWithResult(_0xd36475,null))['catch'](handleError(_0xd36475,null));};exports['destroy']=function(_0x4f3b06,_0x5b56c5){return db['OpenchannelTransferReport'][_0xf742('0x48')]({'where':{'id':_0x4f3b06['params']['id']}})[_0xf742('0x25')](handleEntityNotFound(_0x5b56c5,null))[_0xf742('0x25')](removeEntity(_0x5b56c5,null))[_0xf742('0x49')](handleError(_0x5b56c5,null));};exports[_0xf742('0x4d')]=function(_0x32e2ab,_0x31da1b){return db[_0xf742('0x2c')][_0xf742('0x4d')]()[_0xf742('0x25')](respondWithResult(_0x31da1b,null))['catch'](handleError(_0x31da1b,null));}; \ No newline at end of file +var _0xe49c=['order','sort','pick','filter','where','VIRTUAL','merge','OpenchannelTransferReport','include','findAll','rows','show','params','length','includeAll','options','catch','create','body','find','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','offset','undefined','limit','count','status','json','apply','reject','save','then','error','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x761b6d,_0x7c7fa8){var _0x3a1639=function(_0x33b90a){while(--_0x33b90a){_0x761b6d['push'](_0x761b6d['shift']());}};_0x3a1639(++_0x7c7fa8);}(_0xe49c,0xa7));var _0xce49=function(_0xc7f23c,_0x2be758){_0xc7f23c=_0xc7f23c-0x0;var _0x4b4def=_0xe49c[_0xc7f23c];return _0x4b4def;};'use strict';var emlformat=require(_0xce49('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xce49('0x1'));var jsonpatch=require(_0xce49('0x2'));var rp=require(_0xce49('0x3'));var moment=require(_0xce49('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xce49('0x5'));var util=require('util');var path=require('path');var sox=require(_0xce49('0x6'));var csv=require(_0xce49('0x7'));var ejs=require(_0xce49('0x8'));var fs=require('fs');var fs_extra=require(_0xce49('0x9'));var _=require(_0xce49('0xa'));var squel=require(_0xce49('0xb'));var crypto=require(_0xce49('0xc'));var jsforce=require(_0xce49('0xd'));var deskjs=require(_0xce49('0xe'));var toCsv=require(_0xce49('0x7'));var querystring=require('querystring');var Papa=require(_0xce49('0xf'));var Redis=require(_0xce49('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xce49('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xce49('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xce49('0x13'));var config=require(_0xce49('0x14'));var licenseUtil=require(_0xce49('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d2f05,_0xaef963){_0xaef963=_0xaef963||0xcc;return function(_0x19109b){if(_0x19109b){return _0x3d2f05[_0xce49('0x16')](_0xaef963);}return _0x3d2f05['status'](_0xaef963)[_0xce49('0x17')]();};}function respondWithResult(_0x1e2aeb,_0x2dc5bc){_0x2dc5bc=_0x2dc5bc||0xc8;return function(_0xf3df12){if(_0xf3df12){return _0x1e2aeb['status'](_0x2dc5bc)['json'](_0xf3df12);}};}function respondWithFilteredResult(_0x410558,_0x24c7b1){return function(_0x45e142){if(_0x45e142){var _0x1da861=typeof _0x24c7b1[_0xce49('0x18')]===_0xce49('0x19')&&typeof _0x24c7b1[_0xce49('0x1a')]===_0xce49('0x19');var _0x2d6904=_0x45e142['count'];var _0x14634e=_0x1da861?0x0:_0x24c7b1[_0xce49('0x18')];var _0x331c94=_0x1da861?_0x45e142[_0xce49('0x1b')]:_0x24c7b1['offset']+_0x24c7b1[_0xce49('0x1a')];var _0x153a88;if(_0x331c94>=_0x2d6904){_0x331c94=_0x2d6904;_0x153a88=0xc8;}else{_0x153a88=0xce;}_0x410558[_0xce49('0x1c')](_0x153a88);return _0x410558['set']('Content-Range',_0x14634e+'-'+_0x331c94+'/'+_0x2d6904)[_0xce49('0x1d')](_0x45e142);}return null;};}function patchUpdates(_0x29f105){return function(_0x254bdf){try{jsonpatch[_0xce49('0x1e')](_0x254bdf,_0x29f105,!![]);}catch(_0x140b86){return BPromise[_0xce49('0x1f')](_0x140b86);}return _0x254bdf[_0xce49('0x20')]();};}function saveUpdates(_0x2e9bb8,_0x38401f){return function(_0x2413b1){if(_0x2413b1){return _0x2413b1['update'](_0x2e9bb8)[_0xce49('0x21')](function(_0x1d3ecd){return _0x1d3ecd;});}return null;};}function removeEntity(_0x5a21f4,_0x31b617){return function(_0x228b70){if(_0x228b70){return _0x228b70['destroy']()[_0xce49('0x21')](function(){_0x5a21f4[_0xce49('0x1c')](0xcc)[_0xce49('0x17')]();});}};}function handleEntityNotFound(_0x3294de,_0x2be29d){return function(_0x3988b6){if(!_0x3988b6){_0x3294de['sendStatus'](0x194);}return _0x3988b6;};}function handleError(_0x19d9f0,_0x4534f9){_0x4534f9=_0x4534f9||0x1f4;return function(_0x5f2a61){logger[_0xce49('0x22')](_0x5f2a61['stack']);if(_0x5f2a61['name']){delete _0x5f2a61[_0xce49('0x23')];}_0x19d9f0[_0xce49('0x1c')](_0x4534f9)[_0xce49('0x24')](_0x5f2a61);};}exports[_0xce49('0x25')]=function(_0xd8f330,_0x32687c){var _0x3657b1={},_0xd09c6e={},_0x5b9f69={'count':0x0,'rows':[]};var _0x5052b7=_['map'](db['OpenchannelTransferReport'][_0xce49('0x26')],function(_0x494106){return{'name':_0x494106[_0xce49('0x27')],'type':_0x494106[_0xce49('0x28')][_0xce49('0x29')]};});_0xd09c6e[_0xce49('0x2a')]=_[_0xce49('0x2b')](_0x5052b7,'name');_0xd09c6e[_0xce49('0x2c')]=_[_0xce49('0x2d')](_0xd8f330[_0xce49('0x2c')]);_0xd09c6e[_0xce49('0x2e')]=_[_0xce49('0x2f')](_0xd09c6e[_0xce49('0x2a')],_0xd09c6e['query']);_0x3657b1[_0xce49('0x30')]=_['intersection'](_0xd09c6e[_0xce49('0x2a')],qs[_0xce49('0x31')](_0xd8f330[_0xce49('0x2c')][_0xce49('0x31')]));_0x3657b1['attributes']=_0x3657b1[_0xce49('0x30')]['length']?_0x3657b1[_0xce49('0x30')]:_0xd09c6e[_0xce49('0x2a')];if(!_0xd8f330['query'][_0xce49('0x32')](_0xce49('0x33'))){_0x3657b1[_0xce49('0x1a')]=qs[_0xce49('0x1a')](_0xd8f330[_0xce49('0x2c')][_0xce49('0x1a')]);_0x3657b1[_0xce49('0x18')]=qs['offset'](_0xd8f330[_0xce49('0x2c')]['offset']);}_0x3657b1[_0xce49('0x34')]=qs[_0xce49('0x35')](_0xd8f330[_0xce49('0x2c')][_0xce49('0x35')]);_0x3657b1['where']=qs[_0xce49('0x2e')](_[_0xce49('0x36')](_0xd8f330[_0xce49('0x2c')],_0xd09c6e[_0xce49('0x2e')]),_0x5052b7);if(_0xd8f330[_0xce49('0x2c')][_0xce49('0x37')]){_0x3657b1[_0xce49('0x38')]=_['merge'](_0x3657b1[_0xce49('0x38')],{'$or':_[_0xce49('0x2b')](_0x5052b7,function(_0x27c6d9){if(_0x27c6d9[_0xce49('0x28')]!==_0xce49('0x39')){var _0x5e9b6e={};_0x5e9b6e[_0x27c6d9['name']]={'$like':'%'+_0xd8f330['query']['filter']+'%'};return _0x5e9b6e;}})});}_0x3657b1=_[_0xce49('0x3a')]({},_0x3657b1,_0xd8f330['options']);var _0x42acb8={'where':_0x3657b1['where']};return db[_0xce49('0x3b')][_0xce49('0x1b')](_0x42acb8)[_0xce49('0x21')](function(_0x12f260){_0x5b9f69[_0xce49('0x1b')]=_0x12f260;if(_0xd8f330['query']['includeAll']){_0x3657b1[_0xce49('0x3c')]=[{'all':!![]}];}return db[_0xce49('0x3b')][_0xce49('0x3d')](_0x3657b1);})[_0xce49('0x21')](function(_0x8afa6c){_0x5b9f69[_0xce49('0x3e')]=_0x8afa6c;return _0x5b9f69;})[_0xce49('0x21')](respondWithFilteredResult(_0x32687c,_0x3657b1))['catch'](handleError(_0x32687c,null));};exports[_0xce49('0x3f')]=function(_0x5df581,_0x5f3b33){var _0x47769a={'raw':!![],'where':{'id':_0x5df581[_0xce49('0x40')]['id']}},_0x5d9809={};_0x5d9809['model']=_[_0xce49('0x2d')](db['OpenchannelTransferReport'][_0xce49('0x26')]);_0x5d9809[_0xce49('0x2c')]=_['keys'](_0x5df581[_0xce49('0x2c')]);_0x5d9809[_0xce49('0x2e')]=_[_0xce49('0x2f')](_0x5d9809['model'],_0x5d9809['query']);_0x47769a[_0xce49('0x30')]=_[_0xce49('0x2f')](_0x5d9809['model'],qs[_0xce49('0x31')](_0x5df581['query'][_0xce49('0x31')]));_0x47769a[_0xce49('0x30')]=_0x47769a[_0xce49('0x30')][_0xce49('0x41')]?_0x47769a[_0xce49('0x30')]:_0x5d9809['model'];if(_0x5df581[_0xce49('0x2c')][_0xce49('0x42')]){_0x47769a['include']=[{'all':!![]}];}_0x47769a=_[_0xce49('0x3a')]({},_0x47769a,_0x5df581[_0xce49('0x43')]);return db[_0xce49('0x3b')]['find'](_0x47769a)['then'](handleEntityNotFound(_0x5f3b33,null))[_0xce49('0x21')](respondWithResult(_0x5f3b33,null))[_0xce49('0x44')](handleError(_0x5f3b33,null));};exports[_0xce49('0x45')]=function(_0x3b4fe4,_0x5029a2){return db[_0xce49('0x3b')][_0xce49('0x45')](_0x3b4fe4[_0xce49('0x46')],{})[_0xce49('0x21')](respondWithResult(_0x5029a2,0xc9))['catch'](handleError(_0x5029a2,null));};exports['update']=function(_0x3e083e,_0x2c0bfd){if(_0x3e083e['body']['id']){delete _0x3e083e[_0xce49('0x46')]['id'];}return db[_0xce49('0x3b')][_0xce49('0x47')]({'where':{'id':_0x3e083e[_0xce49('0x40')]['id']}})[_0xce49('0x21')](handleEntityNotFound(_0x2c0bfd,null))[_0xce49('0x21')](saveUpdates(_0x3e083e[_0xce49('0x46')],null))[_0xce49('0x21')](respondWithResult(_0x2c0bfd,null))[_0xce49('0x44')](handleError(_0x2c0bfd,null));};exports[_0xce49('0x48')]=function(_0x4aafc3,_0x3babfd){return db[_0xce49('0x3b')][_0xce49('0x47')]({'where':{'id':_0x4aafc3[_0xce49('0x40')]['id']}})[_0xce49('0x21')](handleEntityNotFound(_0x3babfd,null))[_0xce49('0x21')](removeEntity(_0x3babfd,null))[_0xce49('0x44')](handleError(_0x3babfd,null));};exports['describe']=function(_0x1d82d0,_0x3a4034){return db['OpenchannelTransferReport']['describe']()[_0xce49('0x21')](respondWithResult(_0x3a4034,null))['catch'](handleError(_0x3a4034,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index f8ff7d7..04aa499 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 _0xa6be=['api','moment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x34012c,_0x4979a2){var _0x5cee29=function(_0x18c089){while(--_0x18c089){_0x34012c['push'](_0x34012c['shift']());}};_0x5cee29(++_0x4979a2);}(_0xa6be,0xc3));var _0xea6b=function(_0x29ca34,_0x3ff9fd){_0x29ca34=_0x29ca34-0x0;var _0x14a0be=_0xa6be[_0x29ca34];return _0x14a0be;};'use strict';var _=require(_0xea6b('0x0'));var util=require(_0xea6b('0x1'));var logger=require(_0xea6b('0x2'))(_0xea6b('0x3'));var moment=require(_0xea6b('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xea6b('0x5'));module[_0xea6b('0x6')]=function(_0x81ca14,_0x32de24){return _0x81ca14[_0xea6b('0x7')](_0xea6b('0x8'),attributes,{'tableName':_0xea6b('0x9'),'paranoid':![],'indexes':[{'name':_0xea6b('0xa'),'fields':[_0xea6b('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9b53=['exports','OpenchannelTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5e4a6a,_0x287632){var _0xc8879f=function(_0x4a5f5a){while(--_0x4a5f5a){_0x5e4a6a['push'](_0x5e4a6a['shift']());}};_0xc8879f(++_0x287632);}(_0x9b53,0x1f1));var _0x39b5=function(_0x23c783,_0x4ff818){_0x23c783=_0x23c783-0x0;var _0x14fe0f=_0x9b53[_0x23c783];return _0x14fe0f;};'use strict';var _=require(_0x39b5('0x0'));var util=require(_0x39b5('0x1'));var logger=require(_0x39b5('0x2'))(_0x39b5('0x3'));var moment=require(_0x39b5('0x4'));var BPromise=require(_0x39b5('0x5'));var rp=require(_0x39b5('0x6'));var fs=require('fs');var path=require(_0x39b5('0x7'));var rimraf=require(_0x39b5('0x8'));var config=require(_0x39b5('0x9'));var attributes=require('./openchannelTransferReport.attributes');module[_0x39b5('0xa')]=function(_0x4cb835,_0x4b9d7b){return _0x4cb835['define'](_0x39b5('0xb'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x39b5('0xc'),'fields':[_0x39b5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index edf74c8..b86beec 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 _0xa1f6=['client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','jayson/promise'];(function(_0x571c1e,_0x3b5f56){var _0x4b2fd9=function(_0x1994f3){while(--_0x1994f3){_0x571c1e['push'](_0x571c1e['shift']());}};_0x4b2fd9(++_0x3b5f56);}(_0xa1f6,0x19d));var _0x6a1f=function(_0x3daa8c,_0x388a87){_0x3daa8c=_0x3daa8c-0x0;var _0x2b1bd7=_0xa1f6[_0x3daa8c];return _0x2b1bd7;};'use strict';var _=require(_0x6a1f('0x0'));var util=require(_0x6a1f('0x1'));var moment=require(_0x6a1f('0x2'));var BPromise=require(_0x6a1f('0x3'));var rs=require(_0x6a1f('0x4'));var fs=require('fs');var Redis=require(_0x6a1f('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6a1f('0x6'));var client=jayson[_0x6a1f('0x7')][_0x6a1f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3a772b,_0x328033,_0x3ecd63){return new BPromise(function(_0x36c00b,_0x56bf63){return client[_0x6a1f('0x9')](_0x3a772b,_0x3ecd63)[_0x6a1f('0xa')](function(_0x2300b1){logger[_0x6a1f('0xb')](_0x6a1f('0xc'),_0x328033,'request\x20sent');logger[_0x6a1f('0xd')](_0x6a1f('0xe'),_0x328033,_0x6a1f('0xf'),JSON[_0x6a1f('0x10')](_0x2300b1));if(_0x2300b1['error']){if(_0x2300b1[_0x6a1f('0x11')]['code']===0x1f4){logger[_0x6a1f('0x11')](_0x6a1f('0xc'),_0x328033,_0x2300b1[_0x6a1f('0x11')][_0x6a1f('0x12')]);return _0x56bf63(_0x2300b1[_0x6a1f('0x11')][_0x6a1f('0x12')]);}logger[_0x6a1f('0x11')](_0x6a1f('0xc'),_0x328033,_0x2300b1[_0x6a1f('0x11')][_0x6a1f('0x12')]);return _0x36c00b(_0x2300b1[_0x6a1f('0x11')][_0x6a1f('0x12')]);}else{logger[_0x6a1f('0xb')](_0x6a1f('0xc'),_0x328033,_0x6a1f('0xf'));_0x36c00b(_0x2300b1[_0x6a1f('0x13')][_0x6a1f('0x12')]);}})[_0x6a1f('0x14')](function(_0x2c44a0){logger['error'](_0x6a1f('0xc'),_0x328033,_0x2c44a0);_0x56bf63(_0x2c44a0);});});} \ No newline at end of file +var _0x5334=['http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0xe39886,_0x234df8){var _0xe374f6=function(_0x474399){while(--_0x474399){_0xe39886['push'](_0xe39886['shift']());}};_0xe374f6(++_0x234df8);}(_0x5334,0x84));var _0x4533=function(_0x2817f5,_0xbb1c52){_0x2817f5=_0x2817f5-0x0;var _0x303e39=_0x5334[_0x2817f5];return _0x303e39;};'use strict';var _=require(_0x4533('0x0'));var util=require(_0x4533('0x1'));var moment=require(_0x4533('0x2'));var BPromise=require(_0x4533('0x3'));var rs=require(_0x4533('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4533('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4533('0x6'))(_0x4533('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x4533('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4dea06,_0x4d89e7,_0x487906){return new BPromise(function(_0x3fbdc3,_0x42f94b){return client[_0x4533('0x9')](_0x4dea06,_0x487906)[_0x4533('0xa')](function(_0x31018b){logger[_0x4533('0xb')](_0x4533('0xc'),_0x4d89e7,'request\x20sent');logger[_0x4533('0xd')](_0x4533('0xe'),_0x4d89e7,_0x4533('0xf'),JSON[_0x4533('0x10')](_0x31018b));if(_0x31018b['error']){if(_0x31018b[_0x4533('0x11')]['code']===0x1f4){logger[_0x4533('0x11')](_0x4533('0xc'),_0x4d89e7,_0x31018b[_0x4533('0x11')][_0x4533('0x12')]);return _0x42f94b(_0x31018b['error'][_0x4533('0x12')]);}logger[_0x4533('0x11')](_0x4533('0xc'),_0x4d89e7,_0x31018b[_0x4533('0x11')]['message']);return _0x3fbdc3(_0x31018b[_0x4533('0x11')]['message']);}else{logger['info'](_0x4533('0xc'),_0x4d89e7,_0x4533('0xf'));_0x3fbdc3(_0x31018b['result'][_0x4533('0x12')]);}})[_0x4533('0x13')](function(_0x2a9877){logger['error'](_0x4533('0xc'),_0x4d89e7,_0x2a9877);_0x42f94b(_0x2a9877);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index e297f97..a7324ea 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 _0x6a13=['/:id','show','isAuthenticated','create','put','update','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get'];(function(_0x7ee9d3,_0x52b266){var _0xd27e87=function(_0x1503a0){while(--_0x1503a0){_0x7ee9d3['push'](_0x7ee9d3['shift']());}};_0xd27e87(++_0x52b266);}(_0x6a13,0xf4));var _0x36a1=function(_0x3fd997,_0x9e79d7){_0x3fd997=_0x3fd997-0x0;var _0x291a1d=_0x6a13[_0x3fd997];return _0x291a1d;};'use strict';var multer=require('multer');var util=require(_0x36a1('0x0'));var path=require('path');var timeout=require(_0x36a1('0x1'));var express=require(_0x36a1('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x36a1('0x3'));var interaction=require(_0x36a1('0x4'));var config=require(_0x36a1('0x5'));var controller=require('./pause.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x36a1('0x6')]);router[_0x36a1('0x7')](_0x36a1('0x8'),auth['isAuthenticated'](),controller[_0x36a1('0x9')]);router['post']('/',auth[_0x36a1('0xa')](),controller[_0x36a1('0xb')]);router[_0x36a1('0xc')](_0x36a1('0x8'),auth[_0x36a1('0xa')](),controller[_0x36a1('0xd')]);router['delete'](_0x36a1('0x8'),auth[_0x36a1('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe3bd=['post','create','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show'];(function(_0x26da89,_0x264785){var _0xc95b7b=function(_0x230e5b){while(--_0x230e5b){_0x26da89['push'](_0x26da89['shift']());}};_0xc95b7b(++_0x264785);}(_0xe3bd,0x126));var _0xde3b=function(_0x572637,_0x216d95){_0x572637=_0x572637-0x0;var _0xb6748=_0xe3bd[_0x572637];return _0xb6748;};'use strict';var multer=require('multer');var util=require(_0xde3b('0x0'));var path=require(_0xde3b('0x1'));var timeout=require(_0xde3b('0x2'));var express=require('express');var router=express[_0xde3b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xde3b('0x4'));var interaction=require(_0xde3b('0x5'));var config=require(_0xde3b('0x6'));var controller=require('./pause.controller');router[_0xde3b('0x7')]('/',auth['isAuthenticated'](),controller[_0xde3b('0x8')]);router['get'](_0xde3b('0x9'),auth[_0xde3b('0xa')](),controller[_0xde3b('0xb')]);router[_0xde3b('0xc')]('/',auth[_0xde3b('0xa')](),controller[_0xde3b('0xd')]);router['put'](_0xde3b('0x9'),auth[_0xde3b('0xa')](),controller[_0xde3b('0xe')]);router[_0xde3b('0xf')]('/:id',auth[_0xde3b('0xa')](),controller[_0xde3b('0x10')]);module[_0xde3b('0x11')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 184e1a7..278eded 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 _0x0293=['name','STRING','sequelize'];(function(_0x5b441a,_0x36c84e){var _0x26f90b=function(_0x432ecd){while(--_0x432ecd){_0x5b441a['push'](_0x5b441a['shift']());}};_0x26f90b(++_0x36c84e);}(_0x0293,0x116));var _0x3029=function(_0x679d60,_0x57d85d){_0x679d60=_0x679d60-0x0;var _0xc057d1=_0x0293[_0x679d60];return _0xc057d1;};'use strict';var Sequelize=require(_0x3029('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x3029('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x3029('0x2')]}}; \ No newline at end of file +var _0xaeee=['STRING','sequelize','exports'];(function(_0x356327,_0x631377){var _0x941b71=function(_0x47b655){while(--_0x47b655){_0x356327['push'](_0x356327['shift']());}};_0x941b71(++_0x631377);}(_0xaeee,0x118));var _0xeaee=function(_0x25233f,_0x4b06c8){_0x25233f=_0x25233f-0x0;var _0x5458fb=_0xaeee[_0x25233f];return _0x5458fb;};'use strict';var Sequelize=require(_0xeaee('0x0'));module[_0xeaee('0x1')]={'name':{'type':Sequelize[_0xeaee('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xeaee('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index fec7528..fbfe67c 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 _0x9a8c=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','fast-json-patch','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','set','reject','update','then','get','Pauses','UserProfileResource','destroy','error','stack','name','send','index','Pause','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','include','findAll','rows','catch','show','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation'];(function(_0x2d61ac,_0x18ff36){var _0x3f7d3c=function(_0x2ba7e5){while(--_0x2ba7e5){_0x2d61ac['push'](_0x2d61ac['shift']());}};_0x3f7d3c(++_0x18ff36);}(_0x9a8c,0x1e8));var _0xc9a8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9a8c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc9a8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc9a8('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc9a8('0x2'));var util=require(_0xc9a8('0x3'));var path=require(_0xc9a8('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc9a8('0x5'));var fs=require('fs');var fs_extra=require(_0xc9a8('0x6'));var _=require(_0xc9a8('0x7'));var squel=require(_0xc9a8('0x8'));var crypto=require(_0xc9a8('0x9'));var jsforce=require(_0xc9a8('0xa'));var deskjs=require(_0xc9a8('0xb'));var toCsv=require(_0xc9a8('0xc'));var querystring=require(_0xc9a8('0xd'));var Papa=require(_0xc9a8('0xe'));var Redis=require('ioredis');var authService=require(_0xc9a8('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xc9a8('0x10'));var hardwareService=require(_0xc9a8('0x11'));var logger=require(_0xc9a8('0x12'))(_0xc9a8('0x13'));var utils=require('../../config/utils');var config=require(_0xc9a8('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb39f49,_0x2db2eb){_0x2db2eb=_0x2db2eb||0xcc;return function(_0x42b3c7){if(_0x42b3c7){return _0xb39f49[_0xc9a8('0x15')](_0x2db2eb);}return _0xb39f49[_0xc9a8('0x16')](_0x2db2eb)[_0xc9a8('0x17')]();};}function respondWithResult(_0x3e8f81,_0x52b4fe){_0x52b4fe=_0x52b4fe||0xc8;return function(_0x211af1){if(_0x211af1){return _0x3e8f81[_0xc9a8('0x16')](_0x52b4fe)[_0xc9a8('0x18')](_0x211af1);}};}function respondWithFilteredResult(_0x27ab7e,_0x2945d2){return function(_0x342556){if(_0x342556){var _0x2786c3=typeof _0x2945d2[_0xc9a8('0x19')]===_0xc9a8('0x1a')&&typeof _0x2945d2[_0xc9a8('0x1b')]===_0xc9a8('0x1a');var _0x2c06a4=_0x342556['count'];var _0x152c2c=_0x2786c3?0x0:_0x2945d2[_0xc9a8('0x19')];var _0x5d0d08=_0x2786c3?_0x342556['count']:_0x2945d2['offset']+_0x2945d2[_0xc9a8('0x1b')];var _0x2503f9;if(_0x5d0d08>=_0x2c06a4){_0x5d0d08=_0x2c06a4;_0x2503f9=0xc8;}else{_0x2503f9=0xce;}_0x27ab7e[_0xc9a8('0x16')](_0x2503f9);return _0x27ab7e[_0xc9a8('0x1c')]('Content-Range',_0x152c2c+'-'+_0x5d0d08+'/'+_0x2c06a4)['json'](_0x342556);}return null;};}function patchUpdates(_0x552811){return function(_0x12e7be){try{jsonpatch['apply'](_0x12e7be,_0x552811,!![]);}catch(_0x298a75){return BPromise[_0xc9a8('0x1d')](_0x298a75);}return _0x12e7be['save']();};}function saveUpdates(_0x34b40d,_0x3ab23c){return function(_0x2ad423){if(_0x2ad423){return _0x2ad423[_0xc9a8('0x1e')](_0x34b40d)[_0xc9a8('0x1f')](function(_0x5dd020){return _0x5dd020;});}return null;};}function removeEntity(_0x4b43d8,_0xdda3e5){return function(_0x7d2858){if(_0x7d2858){return _0x7d2858['destroy']()[_0xc9a8('0x1f')](function(){var _0x163496=_0x7d2858[_0xc9a8('0x20')]({'plain':!![]});var _0x17fab8=_0xc9a8('0x21');return db[_0xc9a8('0x22')][_0xc9a8('0x23')]({'where':{'type':_0x17fab8,'resourceId':_0x163496['id']}})[_0xc9a8('0x1f')](function(){return _0x7d2858;});})[_0xc9a8('0x1f')](function(){_0x4b43d8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5455a7,_0x362913){return function(_0x4f5b50){if(!_0x4f5b50){_0x5455a7[_0xc9a8('0x15')](0x194);}return _0x4f5b50;};}function handleError(_0x596345,_0x55f609){_0x55f609=_0x55f609||0x1f4;return function(_0x5e7100){logger[_0xc9a8('0x24')](_0x5e7100[_0xc9a8('0x25')]);if(_0x5e7100[_0xc9a8('0x26')]){delete _0x5e7100[_0xc9a8('0x26')];}_0x596345[_0xc9a8('0x16')](_0x55f609)[_0xc9a8('0x27')](_0x5e7100);};}exports[_0xc9a8('0x28')]=function(_0x3f5e1c,_0x592f0f){var _0x2e3e1d={},_0x4a991c={},_0xf414df={'count':0x0,'rows':[]};var _0x20ddf3=_['map'](db[_0xc9a8('0x29')][_0xc9a8('0x2a')],function(_0x58bd4b){return{'name':_0x58bd4b[_0xc9a8('0x2b')],'type':_0x58bd4b[_0xc9a8('0x2c')][_0xc9a8('0x2d')]};});_0x4a991c[_0xc9a8('0x2e')]=_[_0xc9a8('0x2f')](_0x20ddf3,_0xc9a8('0x26'));_0x4a991c[_0xc9a8('0x30')]=_[_0xc9a8('0x31')](_0x3f5e1c['query']);_0x4a991c[_0xc9a8('0x32')]=_[_0xc9a8('0x33')](_0x4a991c['model'],_0x4a991c[_0xc9a8('0x30')]);_0x2e3e1d[_0xc9a8('0x34')]=_[_0xc9a8('0x33')](_0x4a991c[_0xc9a8('0x2e')],qs['fields'](_0x3f5e1c[_0xc9a8('0x30')][_0xc9a8('0x35')]));_0x2e3e1d[_0xc9a8('0x34')]=_0x2e3e1d[_0xc9a8('0x34')][_0xc9a8('0x36')]?_0x2e3e1d['attributes']:_0x4a991c[_0xc9a8('0x2e')];if(!_0x3f5e1c[_0xc9a8('0x30')][_0xc9a8('0x37')](_0xc9a8('0x38'))){_0x2e3e1d[_0xc9a8('0x1b')]=qs[_0xc9a8('0x1b')](_0x3f5e1c['query']['limit']);_0x2e3e1d[_0xc9a8('0x19')]=qs[_0xc9a8('0x19')](_0x3f5e1c['query'][_0xc9a8('0x19')]);}_0x2e3e1d[_0xc9a8('0x39')]=qs[_0xc9a8('0x3a')](_0x3f5e1c[_0xc9a8('0x30')]['sort']);_0x2e3e1d[_0xc9a8('0x3b')]=qs['filters'](_[_0xc9a8('0x3c')](_0x3f5e1c[_0xc9a8('0x30')],_0x4a991c[_0xc9a8('0x32')]),_0x20ddf3);if(_0x3f5e1c[_0xc9a8('0x30')][_0xc9a8('0x3d')]){_0x2e3e1d[_0xc9a8('0x3b')]=_[_0xc9a8('0x3e')](_0x2e3e1d['where'],{'$or':_[_0xc9a8('0x2f')](_0x20ddf3,function(_0x2ebc2b){if(_0x2ebc2b[_0xc9a8('0x2c')]!=='VIRTUAL'){var _0x1287aa={};_0x1287aa[_0x2ebc2b[_0xc9a8('0x26')]]={'$like':'%'+_0x3f5e1c[_0xc9a8('0x30')][_0xc9a8('0x3d')]+'%'};return _0x1287aa;}})});}_0x2e3e1d=_[_0xc9a8('0x3e')]({},_0x2e3e1d,_0x3f5e1c[_0xc9a8('0x3f')]);var _0x5766ae={'where':_0x2e3e1d[_0xc9a8('0x3b')]};return db[_0xc9a8('0x29')][_0xc9a8('0x40')](_0x5766ae)['then'](function(_0x18f644){_0xf414df[_0xc9a8('0x40')]=_0x18f644;if(_0x3f5e1c[_0xc9a8('0x30')]['includeAll']){_0x2e3e1d[_0xc9a8('0x41')]=[{'all':!![]}];}return db['Pause'][_0xc9a8('0x42')](_0x2e3e1d);})[_0xc9a8('0x1f')](function(_0x4a2a7b){_0xf414df[_0xc9a8('0x43')]=_0x4a2a7b;return _0xf414df;})['then'](respondWithFilteredResult(_0x592f0f,_0x2e3e1d))[_0xc9a8('0x44')](handleError(_0x592f0f,null));};exports[_0xc9a8('0x45')]=function(_0x3e8f38,_0x1c0c7c){var _0x193b19={'raw':!![],'where':{'id':_0x3e8f38[_0xc9a8('0x46')]['id']}},_0x44e327={};_0x44e327[_0xc9a8('0x2e')]=_[_0xc9a8('0x31')](db['Pause'][_0xc9a8('0x2a')]);_0x44e327['query']=_[_0xc9a8('0x31')](_0x3e8f38[_0xc9a8('0x30')]);_0x44e327['filters']=_[_0xc9a8('0x33')](_0x44e327[_0xc9a8('0x2e')],_0x44e327['query']);_0x193b19[_0xc9a8('0x34')]=_[_0xc9a8('0x33')](_0x44e327[_0xc9a8('0x2e')],qs[_0xc9a8('0x35')](_0x3e8f38[_0xc9a8('0x30')][_0xc9a8('0x35')]));_0x193b19['attributes']=_0x193b19['attributes']['length']?_0x193b19[_0xc9a8('0x34')]:_0x44e327[_0xc9a8('0x2e')];if(_0x3e8f38[_0xc9a8('0x30')][_0xc9a8('0x47')]){_0x193b19[_0xc9a8('0x41')]=[{'all':!![]}];}_0x193b19=_[_0xc9a8('0x3e')]({},_0x193b19,_0x3e8f38[_0xc9a8('0x3f')]);return db[_0xc9a8('0x29')][_0xc9a8('0x48')](_0x193b19)[_0xc9a8('0x1f')](handleEntityNotFound(_0x1c0c7c,null))['then'](respondWithResult(_0x1c0c7c,null))[_0xc9a8('0x44')](handleError(_0x1c0c7c,null));};exports[_0xc9a8('0x49')]=function(_0x47a702,_0x3bfb4c){return db[_0xc9a8('0x29')][_0xc9a8('0x49')](_0x47a702['body'],{})[_0xc9a8('0x1f')](function(_0x400a84){var _0x16657c=_0x47a702[_0xc9a8('0x4a')][_0xc9a8('0x20')]({'plain':!![]});if(!_0x16657c)throw new Error(_0xc9a8('0x4b'));if(_0x16657c[_0xc9a8('0x4c')]===_0xc9a8('0x4a')){var _0x6261b4=_0x400a84['get']({'plain':!![]});var _0x13464c=_0xc9a8('0x21');return db[_0xc9a8('0x4d')][_0xc9a8('0x48')]({'where':{'name':_0x13464c,'userProfileId':_0x16657c['userProfileId']},'raw':!![]})[_0xc9a8('0x1f')](function(_0x335a8c){if(_0x335a8c&&_0x335a8c[_0xc9a8('0x4e')]===0x0){return db[_0xc9a8('0x22')]['create']({'name':_0x6261b4['name'],'resourceId':_0x6261b4['id'],'type':_0x335a8c[_0xc9a8('0x26')],'sectionId':_0x335a8c['id']},{})[_0xc9a8('0x1f')](function(){return _0x400a84;});}else{return _0x400a84;}})[_0xc9a8('0x44')](function(_0x1627ea){logger['error'](_0xc9a8('0x4f'),_0x1627ea);throw _0x1627ea;});}return _0x400a84;})[_0xc9a8('0x1f')](respondWithResult(_0x3bfb4c,0xc9))[_0xc9a8('0x44')](handleError(_0x3bfb4c,null));};exports[_0xc9a8('0x1e')]=function(_0x1965ac,_0x3a7cca){if(_0x1965ac[_0xc9a8('0x50')]['id']){delete _0x1965ac[_0xc9a8('0x50')]['id'];}return db[_0xc9a8('0x29')][_0xc9a8('0x48')]({'where':{'id':_0x1965ac[_0xc9a8('0x46')]['id']}})[_0xc9a8('0x1f')](handleEntityNotFound(_0x3a7cca,null))[_0xc9a8('0x1f')](saveUpdates(_0x1965ac[_0xc9a8('0x50')],null))[_0xc9a8('0x1f')](respondWithResult(_0x3a7cca,null))[_0xc9a8('0x44')](handleError(_0x3a7cca,null));};exports[_0xc9a8('0x23')]=function(_0xb410a7,_0x39b65e){return db[_0xc9a8('0x29')][_0xc9a8('0x48')]({'where':{'id':_0xb410a7[_0xc9a8('0x46')]['id']}})[_0xc9a8('0x1f')](handleEntityNotFound(_0x39b65e,null))[_0xc9a8('0x1f')](removeEntity(_0x39b65e,null))[_0xc9a8('0x44')](handleError(_0x39b65e,null));}; \ No newline at end of file +var _0x738a=['query','keys','filters','intersection','attributes','hasOwnProperty','order','pick','filter','where','merge','include','rows','catch','show','fields','length','includeAll','options','create','body','user','role','UserProfileSection','find','userProfileId','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','update','then','get','Pauses','destroy','name','send','index','map','Pause','rawAttributes','fieldName','type','model'];(function(_0x1b7679,_0x4a85d2){var _0x18ccf5=function(_0x7e412c){while(--_0x7e412c){_0x1b7679['push'](_0x1b7679['shift']());}};_0x18ccf5(++_0x4a85d2);}(_0x738a,0x1a6));var _0xa738=function(_0x23884b,_0x50c307){_0x23884b=_0x23884b-0x0;var _0x28113b=_0x738a[_0x23884b];return _0x28113b;};'use strict';var emlformat=require(_0xa738('0x0'));var rimraf=require(_0xa738('0x1'));var zipdir=require(_0xa738('0x2'));var jsonpatch=require(_0xa738('0x3'));var rp=require(_0xa738('0x4'));var moment=require(_0xa738('0x5'));var BPromise=require(_0xa738('0x6'));var Mustache=require(_0xa738('0x7'));var util=require(_0xa738('0x8'));var path=require(_0xa738('0x9'));var sox=require(_0xa738('0xa'));var csv=require(_0xa738('0xb'));var ejs=require(_0xa738('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa738('0xd'));var crypto=require(_0xa738('0xe'));var jsforce=require(_0xa738('0xf'));var deskjs=require(_0xa738('0x10'));var toCsv=require(_0xa738('0xb'));var querystring=require(_0xa738('0x11'));var Papa=require(_0xa738('0x12'));var Redis=require('ioredis');var authService=require(_0xa738('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa738('0x14'));var hardwareService=require(_0xa738('0x15'));var logger=require(_0xa738('0x16'))(_0xa738('0x17'));var utils=require(_0xa738('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xa738('0x19'));var db=require(_0xa738('0x1a'))['db'];function respondWithStatusCode(_0x29f424,_0x14d778){_0x14d778=_0x14d778||0xcc;return function(_0x227d98){if(_0x227d98){return _0x29f424[_0xa738('0x1b')](_0x14d778);}return _0x29f424[_0xa738('0x1c')](_0x14d778)[_0xa738('0x1d')]();};}function respondWithResult(_0x1eecfe,_0x37ea2a){_0x37ea2a=_0x37ea2a||0xc8;return function(_0x4fb1a3){if(_0x4fb1a3){return _0x1eecfe[_0xa738('0x1c')](_0x37ea2a)[_0xa738('0x1e')](_0x4fb1a3);}};}function respondWithFilteredResult(_0x34b672,_0x395796){return function(_0x5081f8){if(_0x5081f8){var _0x54bf57=typeof _0x395796['offset']===_0xa738('0x1f')&&typeof _0x395796[_0xa738('0x20')]==='undefined';var _0x363055=_0x5081f8['count'];var _0xe863a6=_0x54bf57?0x0:_0x395796[_0xa738('0x21')];var _0x3802be=_0x54bf57?_0x5081f8[_0xa738('0x22')]:_0x395796[_0xa738('0x21')]+_0x395796[_0xa738('0x20')];var _0x999aba;if(_0x3802be>=_0x363055){_0x3802be=_0x363055;_0x999aba=0xc8;}else{_0x999aba=0xce;}_0x34b672[_0xa738('0x1c')](_0x999aba);return _0x34b672[_0xa738('0x23')](_0xa738('0x24'),_0xe863a6+'-'+_0x3802be+'/'+_0x363055)[_0xa738('0x1e')](_0x5081f8);}return null;};}function patchUpdates(_0x394148){return function(_0x510ec6){try{jsonpatch['apply'](_0x510ec6,_0x394148,!![]);}catch(_0x2e1279){return BPromise[_0xa738('0x25')](_0x2e1279);}return _0x510ec6['save']();};}function saveUpdates(_0x3e609a,_0x29b678){return function(_0x2d7d37){if(_0x2d7d37){return _0x2d7d37[_0xa738('0x26')](_0x3e609a)[_0xa738('0x27')](function(_0x33cafd){return _0x33cafd;});}return null;};}function removeEntity(_0x2dd1f1,_0x43e4a8){return function(_0x48c32e){if(_0x48c32e){return _0x48c32e['destroy']()[_0xa738('0x27')](function(){var _0x1d564d=_0x48c32e[_0xa738('0x28')]({'plain':!![]});var _0x1ec76b=_0xa738('0x29');return db['UserProfileResource'][_0xa738('0x2a')]({'where':{'type':_0x1ec76b,'resourceId':_0x1d564d['id']}})[_0xa738('0x27')](function(){return _0x48c32e;});})[_0xa738('0x27')](function(){_0x2dd1f1[_0xa738('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d91cd,_0x2a5a35){return function(_0x144deb){if(!_0x144deb){_0x2d91cd[_0xa738('0x1b')](0x194);}return _0x144deb;};}function handleError(_0x976c25,_0x207b29){_0x207b29=_0x207b29||0x1f4;return function(_0x425bfd){logger['error'](_0x425bfd['stack']);if(_0x425bfd['name']){delete _0x425bfd[_0xa738('0x2b')];}_0x976c25['status'](_0x207b29)[_0xa738('0x2c')](_0x425bfd);};}exports[_0xa738('0x2d')]=function(_0x4b9d7c,_0x1ceb9d){var _0x59cf32={},_0x1d176e={},_0x76e621={'count':0x0,'rows':[]};var _0x435138=_[_0xa738('0x2e')](db[_0xa738('0x2f')][_0xa738('0x30')],function(_0x5c01b5){return{'name':_0x5c01b5[_0xa738('0x31')],'type':_0x5c01b5[_0xa738('0x32')]['key']};});_0x1d176e[_0xa738('0x33')]=_['map'](_0x435138,'name');_0x1d176e[_0xa738('0x34')]=_[_0xa738('0x35')](_0x4b9d7c['query']);_0x1d176e[_0xa738('0x36')]=_[_0xa738('0x37')](_0x1d176e[_0xa738('0x33')],_0x1d176e[_0xa738('0x34')]);_0x59cf32[_0xa738('0x38')]=_[_0xa738('0x37')](_0x1d176e[_0xa738('0x33')],qs['fields'](_0x4b9d7c[_0xa738('0x34')]['fields']));_0x59cf32[_0xa738('0x38')]=_0x59cf32['attributes']['length']?_0x59cf32[_0xa738('0x38')]:_0x1d176e[_0xa738('0x33')];if(!_0x4b9d7c[_0xa738('0x34')][_0xa738('0x39')]('nolimit')){_0x59cf32[_0xa738('0x20')]=qs[_0xa738('0x20')](_0x4b9d7c[_0xa738('0x34')][_0xa738('0x20')]);_0x59cf32[_0xa738('0x21')]=qs[_0xa738('0x21')](_0x4b9d7c['query'][_0xa738('0x21')]);}_0x59cf32[_0xa738('0x3a')]=qs['sort'](_0x4b9d7c['query']['sort']);_0x59cf32['where']=qs['filters'](_[_0xa738('0x3b')](_0x4b9d7c[_0xa738('0x34')],_0x1d176e[_0xa738('0x36')]),_0x435138);if(_0x4b9d7c['query'][_0xa738('0x3c')]){_0x59cf32[_0xa738('0x3d')]=_[_0xa738('0x3e')](_0x59cf32[_0xa738('0x3d')],{'$or':_[_0xa738('0x2e')](_0x435138,function(_0x54ec61){if(_0x54ec61[_0xa738('0x32')]!=='VIRTUAL'){var _0x3cee68={};_0x3cee68[_0x54ec61[_0xa738('0x2b')]]={'$like':'%'+_0x4b9d7c[_0xa738('0x34')][_0xa738('0x3c')]+'%'};return _0x3cee68;}})});}_0x59cf32=_['merge']({},_0x59cf32,_0x4b9d7c['options']);var _0x5ea94d={'where':_0x59cf32[_0xa738('0x3d')]};return db[_0xa738('0x2f')][_0xa738('0x22')](_0x5ea94d)[_0xa738('0x27')](function(_0xe2e0d2){_0x76e621[_0xa738('0x22')]=_0xe2e0d2;if(_0x4b9d7c['query']['includeAll']){_0x59cf32[_0xa738('0x3f')]=[{'all':!![]}];}return db[_0xa738('0x2f')]['findAll'](_0x59cf32);})[_0xa738('0x27')](function(_0x1f96ad){_0x76e621[_0xa738('0x40')]=_0x1f96ad;return _0x76e621;})['then'](respondWithFilteredResult(_0x1ceb9d,_0x59cf32))[_0xa738('0x41')](handleError(_0x1ceb9d,null));};exports[_0xa738('0x42')]=function(_0x40cfd3,_0x748ce3){var _0x56dd8d={'raw':!![],'where':{'id':_0x40cfd3['params']['id']}},_0x3fd7d9={};_0x3fd7d9[_0xa738('0x33')]=_[_0xa738('0x35')](db[_0xa738('0x2f')][_0xa738('0x30')]);_0x3fd7d9[_0xa738('0x34')]=_['keys'](_0x40cfd3[_0xa738('0x34')]);_0x3fd7d9[_0xa738('0x36')]=_[_0xa738('0x37')](_0x3fd7d9[_0xa738('0x33')],_0x3fd7d9[_0xa738('0x34')]);_0x56dd8d['attributes']=_['intersection'](_0x3fd7d9[_0xa738('0x33')],qs['fields'](_0x40cfd3['query'][_0xa738('0x43')]));_0x56dd8d[_0xa738('0x38')]=_0x56dd8d[_0xa738('0x38')][_0xa738('0x44')]?_0x56dd8d[_0xa738('0x38')]:_0x3fd7d9[_0xa738('0x33')];if(_0x40cfd3['query'][_0xa738('0x45')]){_0x56dd8d[_0xa738('0x3f')]=[{'all':!![]}];}_0x56dd8d=_['merge']({},_0x56dd8d,_0x40cfd3[_0xa738('0x46')]);return db['Pause']['find'](_0x56dd8d)[_0xa738('0x27')](handleEntityNotFound(_0x748ce3,null))[_0xa738('0x27')](respondWithResult(_0x748ce3,null))['catch'](handleError(_0x748ce3,null));};exports[_0xa738('0x47')]=function(_0x286943,_0x9c73bc){return db[_0xa738('0x2f')][_0xa738('0x47')](_0x286943[_0xa738('0x48')],{})[_0xa738('0x27')](function(_0x2021be){var _0x572349=_0x286943[_0xa738('0x49')][_0xa738('0x28')]({'plain':!![]});if(!_0x572349)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x572349[_0xa738('0x4a')]==='user'){var _0x4b9235=_0x2021be[_0xa738('0x28')]({'plain':!![]});var _0x561236=_0xa738('0x29');return db[_0xa738('0x4b')][_0xa738('0x4c')]({'where':{'name':_0x561236,'userProfileId':_0x572349[_0xa738('0x4d')]},'raw':!![]})[_0xa738('0x27')](function(_0x538532){if(_0x538532&&_0x538532['autoAssociation']===0x0){return db['UserProfileResource'][_0xa738('0x47')]({'name':_0x4b9235[_0xa738('0x2b')],'resourceId':_0x4b9235['id'],'type':_0x538532[_0xa738('0x2b')],'sectionId':_0x538532['id']},{})[_0xa738('0x27')](function(){return _0x2021be;});}else{return _0x2021be;}})['catch'](function(_0x52817d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x52817d);throw _0x52817d;});}return _0x2021be;})[_0xa738('0x27')](respondWithResult(_0x9c73bc,0xc9))[_0xa738('0x41')](handleError(_0x9c73bc,null));};exports['update']=function(_0x18cde9,_0x5c3b38){if(_0x18cde9[_0xa738('0x48')]['id']){delete _0x18cde9['body']['id'];}return db['Pause'][_0xa738('0x4c')]({'where':{'id':_0x18cde9[_0xa738('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5c3b38,null))[_0xa738('0x27')](saveUpdates(_0x18cde9['body'],null))[_0xa738('0x27')](respondWithResult(_0x5c3b38,null))[_0xa738('0x41')](handleError(_0x5c3b38,null));};exports[_0xa738('0x2a')]=function(_0x19fa70,_0x2ba9d8){return db[_0xa738('0x2f')][_0xa738('0x4c')]({'where':{'id':_0x19fa70[_0xa738('0x4e')]['id']}})[_0xa738('0x27')](handleEntityNotFound(_0x2ba9d8,null))[_0xa738('0x27')](removeEntity(_0x2ba9d8,null))[_0xa738('0x41')](handleError(_0x2ba9d8,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index a18f164..69b3f61 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 _0x326f=['tools_pauses','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x4f640b,_0x4d5b33){var _0x6c0f0e=function(_0x200f27){while(--_0x200f27){_0x4f640b['push'](_0x4f640b['shift']());}};_0x6c0f0e(++_0x4d5b33);}(_0x326f,0xd1));var _0xf326=function(_0x45a649,_0x598a82){_0x45a649=_0x45a649-0x0;var _0x3bb99b=_0x326f[_0x45a649];return _0x3bb99b;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf494=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','lodash','util'];(function(_0x1c969e,_0x379a6e){var _0x3fb966=function(_0x53f051){while(--_0x53f051){_0x1c969e['push'](_0x1c969e['shift']());}};_0x3fb966(++_0x379a6e);}(_0xf494,0x1c6));var _0x4f49=function(_0xfbbfec,_0xe79de1){_0xfbbfec=_0xfbbfec-0x0;var _0x34bf3c=_0xf494[_0xfbbfec];return _0x34bf3c;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('Pause',attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 0684992..c6c65d8 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(_0x9c8be3,_0x2e3b5c){var _0x402af1=function(_0x580ec8){while(--_0x580ec8){_0x9c8be3['push'](_0x9c8be3['shift']());}};_0x402af1(++_0x2e3b5c);}(_0xb10b,0x12a));var _0xbb10=function(_0x44f280,_0x4a1dad){_0x44f280=_0x44f280-0x0;var _0x4ee19d=_0xb10b[_0x44f280];return _0x4ee19d;};'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(_0x588b21,_0x39d1c8){var _0x309b23=function(_0x458db4){while(--_0x458db4){_0x588b21['push'](_0x588b21['shift']());}};_0x309b23(++_0x39d1c8);}(_0xb10b,0x12a));var _0xbb10=function(_0xce44ee,_0x387d70){_0xce44ee=_0xce44ee-0x0;var _0xf97a49=_0xb10b[_0xce44ee];return _0xf97a49;};'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 198be68..724a3df 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 _0x303a=['show','/:id/download','download','join','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','upload','webhookPost','/:id','update','delete','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook'];(function(_0x2b0875,_0x21ff12){var _0xedb8d7=function(_0x33ebf6){while(--_0x33ebf6){_0x2b0875['push'](_0x2b0875['shift']());}};_0xedb8d7(++_0x21ff12);}(_0x303a,0x1a0));var _0xa303=function(_0x17f9f4,_0x212dda){_0x17f9f4=_0x17f9f4-0x0;var _0x4dc32c=_0x303a[_0x17f9f4];return _0x4dc32c;};'use strict';var multer=require(_0xa303('0x0'));var util=require('util');var path=require(_0xa303('0x1'));var timeout=require(_0xa303('0x2'));var express=require(_0xa303('0x3'));var router=express[_0xa303('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa303('0x5'));var interaction=require(_0xa303('0x6'));var config=require(_0xa303('0x7'));var controller=require(_0xa303('0x8'));router[_0xa303('0x9')]('/',auth[_0xa303('0xa')](),controller[_0xa303('0xb')]);router[_0xa303('0x9')](_0xa303('0xc'),controller['webhookGet']);router['get']('/:id',auth[_0xa303('0xa')](),controller[_0xa303('0xd')]);router['get'](_0xa303('0xe'),auth['isAuthenticated'](),controller[_0xa303('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x29cd60,_0x17dfcd,_0x382cfd){_0x382cfd(null,path[_0xa303('0x10')](config['root'],_0xa303('0x11')));},'filename':function(_0x4c0169,_0xf5df1e,_0x43a054){_0xf5df1e[_0xa303('0x12')]=_0xf5df1e['originalname'][_0xa303('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x43a054(null,util[_0xa303('0x14')](_0xa303('0x15'),path[_0xa303('0x16')](_0xf5df1e[_0xa303('0x12')],path[_0xa303('0x17')](_0xf5df1e[_0xa303('0x12')])),Date[_0xa303('0x18')](),path['extname'](_0xf5df1e[_0xa303('0x12')])));}})});router[_0xa303('0x19')]('/',upload[_0xa303('0x1a')](_0xa303('0x1b')),controller[_0xa303('0x1c')]);router[_0xa303('0x19')]('/webhook',controller[_0xa303('0x1d')]);router['put'](_0xa303('0x1e'),auth['isAuthenticated'](),controller[_0xa303('0x1f')]);router['delete'](_0xa303('0x1e'),auth[_0xa303('0xa')](),controller[_0xa303('0x20')]);module['exports']=router; \ No newline at end of file +var _0xc6d8=['format','%s-%s%s','basename','extname','now','single','file','post','put','update','delete','exports','multer','path','express','fs-extra','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','/:id','/:id/download','download','diskStorage','root','originalname','replace'];(function(_0x169060,_0x3a386b){var _0x2aa180=function(_0x2b8ac7){while(--_0x2b8ac7){_0x169060['push'](_0x169060['shift']());}};_0x2aa180(++_0x3a386b);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x545f6d,_0x16c27e){_0x545f6d=_0x545f6d-0x0;var _0x594012=_0xc6d8[_0x545f6d];return _0x594012;};'use strict';var multer=require(_0x8c6d('0x0'));var util=require('util');var path=require(_0x8c6d('0x1'));var timeout=require('connect-timeout');var express=require(_0x8c6d('0x2'));var router=express['Router']();var fs_extra=require(_0x8c6d('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8c6d('0x4'));var controller=require(_0x8c6d('0x5'));router[_0x8c6d('0x6')]('/',auth[_0x8c6d('0x7')](),controller[_0x8c6d('0x8')]);router[_0x8c6d('0x6')](_0x8c6d('0x9'),controller['webhookGet']);router[_0x8c6d('0x6')](_0x8c6d('0xa'),auth[_0x8c6d('0x7')](),controller['show']);router[_0x8c6d('0x6')](_0x8c6d('0xb'),auth[_0x8c6d('0x7')](),controller[_0x8c6d('0xc')]);var upload=multer({'storage':multer[_0x8c6d('0xd')]({'destination':function(_0x43a7ab,_0x60cd5c,_0x392a6b){_0x392a6b(null,path['join'](config[_0x8c6d('0xe')],'server/files/plugins'));},'filename':function(_0x4c0878,_0x22d0fb,_0x890e85){_0x22d0fb[_0x8c6d('0xf')]=_0x22d0fb[_0x8c6d('0xf')][_0x8c6d('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x890e85(null,util[_0x8c6d('0x11')](_0x8c6d('0x12'),path[_0x8c6d('0x13')](_0x22d0fb[_0x8c6d('0xf')],path[_0x8c6d('0x14')](_0x22d0fb['originalname'])),Date[_0x8c6d('0x15')](),path['extname'](_0x22d0fb[_0x8c6d('0xf')])));}})});router['post']('/',upload[_0x8c6d('0x16')](_0x8c6d('0x17')),controller['upload']);router[_0x8c6d('0x18')](_0x8c6d('0x9'),controller['webhookPost']);router[_0x8c6d('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x8c6d('0x1a')]);router['delete'](_0x8c6d('0xa'),auth[_0x8c6d('0x7')](),controller[_0x8c6d('0x1b')]);module[_0x8c6d('0x1c')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 570d6ac..0e466ac 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 _0xaeb7=['adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xaeb7,0xad));var _0x7aeb=function(_0x5093a3,_0x54dd5b){_0x5093a3=_0x5093a3-0x0;var _0x42b05c=_0xaeb7[_0x5093a3];return _0x42b05c;};'use strict';var Sequelize=require(_0x7aeb('0x0'));module[_0x7aeb('0x1')]={'name':{'type':Sequelize[_0x7aeb('0x2')]},'type':{'type':Sequelize[_0x7aeb('0x3')](_0x7aeb('0x4'),'script')},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x7aeb('0x5')]},'path':{'type':Sequelize[_0x7aeb('0x2')],'comment':_0x7aeb('0x6')},'active':{'type':Sequelize[_0x7aeb('0x7')],'defaultValue':0x0,'comment':_0x7aeb('0x8')},'sidebar':{'type':Sequelize['ENUM'](_0x7aeb('0x9'),_0x7aeb('0xa'),_0x7aeb('0xb'),_0x7aeb('0xc')),'defaultValue':_0x7aeb('0xb'),'comment':_0x7aeb('0xd')},'icon':{'type':Sequelize[_0x7aeb('0x2')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x7aeb('0x2')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc81c=['agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','STRING','ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly'];(function(_0x97576f,_0x36282c){var _0x3ae416=function(_0x361e1a){while(--_0x361e1a){_0x97576f['push'](_0x97576f['shift']());}};_0x3ae416(++_0x36282c);}(_0xc81c,0x13c));var _0xcc81=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xc81c[_0x1d1779];return _0x2377e9;};'use strict';var Sequelize=require(_0xcc81('0x0'));module['exports']={'name':{'type':Sequelize[_0xcc81('0x1')]},'type':{'type':Sequelize[_0xcc81('0x2')](_0xcc81('0x3'),'script')},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0xcc81('0x4')]},'path':{'type':Sequelize[_0xcc81('0x1')],'comment':_0xcc81('0x5')},'active':{'type':Sequelize[_0xcc81('0x6')],'defaultValue':0x0,'comment':_0xcc81('0x7')},'sidebar':{'type':Sequelize[_0xcc81('0x2')](_0xcc81('0x8'),_0xcc81('0x9'),_0xcc81('0xa'),_0xcc81('0xb')),'defaultValue':_0xcc81('0xa'),'comment':_0xcc81('0xc')},'icon':{'type':Sequelize[_0xcc81('0x1')]},'adminUrl':{'type':Sequelize[_0xcc81('0x1')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0xcc81('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index d35e1f8..2260a83 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 _0x455e=['undefined','limit','count','set','Content-Range','json','apply','save','then','get','Plugins','UserProfileResource','destroy','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','download','join','root','server/files/plugins','format','%s.zip','createWriteStream','zip','warning','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','error','Sequelize','pipe','glob','**/*','node_modules/**/*','basename','finalize','close','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','extname','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','scriptPath','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','dirname','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','status','webhookPost','http://localhost:','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','querystring','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','localhost','socket.io-emitter','redis','./plugin.socket','register','sendStatus','end','offset'];(function(_0x2f2377,_0x11cc21){var _0x441e6b=function(_0x1d0e90){while(--_0x1d0e90){_0x2f2377['push'](_0x2f2377['shift']());}};_0x441e6b(++_0x11cc21);}(_0x455e,0x8f));var _0xe455=function(_0x5cc0c8,_0x403e0e){_0x5cc0c8=_0x5cc0c8-0x0;var _0x3b3f67=_0x455e[_0x5cc0c8];return _0x3b3f67;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe455('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe455('0x1'));var rp=require(_0xe455('0x2'));var moment=require(_0xe455('0x3'));var BPromise=require(_0xe455('0x4'));var Mustache=require(_0xe455('0x5'));var util=require('util');var path=require(_0xe455('0x6'));var sox=require('sox');var csv=require(_0xe455('0x7'));var ejs=require(_0xe455('0x8'));var fs=require('fs');var fs_extra=require(_0xe455('0x9'));var _=require(_0xe455('0xa'));var squel=require('squel');var crypto=require(_0xe455('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe455('0x7'));var querystring=require(_0xe455('0xc'));var Papa=require('papaparse');var extract=require(_0xe455('0xd'));var rimraf=require(_0xe455('0x0'));var archiver=require(_0xe455('0xe'));var Redis=require(_0xe455('0xf'));var authService=require(_0xe455('0x10'));var qs=require(_0xe455('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe455('0x12'));var logger=require(_0xe455('0x13'))(_0xe455('0x14'));var utils=require(_0xe455('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe455('0x16'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xe455('0x17'),'port':0x18eb});var socket=require(_0xe455('0x18'))(new Redis(config[_0xe455('0x19')]));require(_0xe455('0x1a'))[_0xe455('0x1b')](socket);function respondWithStatusCode(_0x5b97a4,_0x42911b){_0x42911b=_0x42911b||0xcc;return function(_0x5159ff){if(_0x5159ff){return _0x5b97a4[_0xe455('0x1c')](_0x42911b);}return _0x5b97a4['status'](_0x42911b)[_0xe455('0x1d')]();};}function respondWithResult(_0xbc85e7,_0xb0175c){_0xb0175c=_0xb0175c||0xc8;return function(_0x15ebf4){if(_0x15ebf4){return _0xbc85e7['status'](_0xb0175c)['json'](_0x15ebf4);}};}function respondWithFilteredResult(_0x5bac47,_0x2c260a){return function(_0xad5b39){if(_0xad5b39){var _0x21a5b8=typeof _0x2c260a[_0xe455('0x1e')]===_0xe455('0x1f')&&typeof _0x2c260a[_0xe455('0x20')]===_0xe455('0x1f');var _0x59c651=_0xad5b39['count'];var _0x39b208=_0x21a5b8?0x0:_0x2c260a['offset'];var _0x2a1d0c=_0x21a5b8?_0xad5b39[_0xe455('0x21')]:_0x2c260a[_0xe455('0x1e')]+_0x2c260a[_0xe455('0x20')];var _0x2bad84;if(_0x2a1d0c>=_0x59c651){_0x2a1d0c=_0x59c651;_0x2bad84=0xc8;}else{_0x2bad84=0xce;}_0x5bac47['status'](_0x2bad84);return _0x5bac47[_0xe455('0x22')](_0xe455('0x23'),_0x39b208+'-'+_0x2a1d0c+'/'+_0x59c651)[_0xe455('0x24')](_0xad5b39);}return null;};}function patchUpdates(_0x23d847){return function(_0x3fb8f9){try{jsonpatch[_0xe455('0x25')](_0x3fb8f9,_0x23d847,!![]);}catch(_0x49fb06){return BPromise['reject'](_0x49fb06);}return _0x3fb8f9[_0xe455('0x26')]();};}function saveUpdates(_0x5ef2ae,_0x4fa482){return function(_0x2dd6ff){if(_0x2dd6ff){return _0x2dd6ff['update'](_0x5ef2ae)['then'](function(_0x1f5bf6){return _0x1f5bf6;});}return null;};}function removeEntity(_0x1331ce,_0x382b6e){return function(_0x3f069c){if(_0x3f069c){return _0x3f069c['destroy']()[_0xe455('0x27')](function(){var _0x3ac950=_0x3f069c[_0xe455('0x28')]({'plain':!![]});var _0x430f82=_0xe455('0x29');return db[_0xe455('0x2a')][_0xe455('0x2b')]({'where':{'type':_0x430f82,'resourceId':_0x3ac950['id']}})[_0xe455('0x27')](function(){return _0x3f069c;});})['then'](function(){_0x1331ce['status'](0xcc)[_0xe455('0x1d')]();});}};}function handleEntityNotFound(_0x5d8fdf,_0x3d2682){return function(_0x40a905){if(!_0x40a905){_0x5d8fdf['sendStatus'](0x194);}return _0x40a905;};}function handleError(_0x54b866,_0x30186b){_0x30186b=_0x30186b||0x1f4;return function(_0x5dbae2){logger['error'](_0x5dbae2[_0xe455('0x2c')]);if(_0x5dbae2[_0xe455('0x2d')]){delete _0x5dbae2[_0xe455('0x2d')];}_0x54b866['status'](_0x30186b)[_0xe455('0x2e')](_0x5dbae2);};}exports[_0xe455('0x2f')]=function(_0x159bb3,_0x562e33){var _0x1d17f7={},_0x3da42d={},_0x47cf86={'count':0x0,'rows':[]};var _0x542606=_[_0xe455('0x30')](db[_0xe455('0x31')][_0xe455('0x32')],function(_0x2b6952){return{'name':_0x2b6952[_0xe455('0x33')],'type':_0x2b6952[_0xe455('0x34')]['key']};});_0x3da42d[_0xe455('0x35')]=_['map'](_0x542606,_0xe455('0x2d'));_0x3da42d[_0xe455('0x36')]=_[_0xe455('0x37')](_0x159bb3[_0xe455('0x36')]);_0x3da42d[_0xe455('0x38')]=_[_0xe455('0x39')](_0x3da42d[_0xe455('0x35')],_0x3da42d[_0xe455('0x36')]);_0x1d17f7[_0xe455('0x3a')]=_[_0xe455('0x39')](_0x3da42d['model'],qs[_0xe455('0x3b')](_0x159bb3[_0xe455('0x36')]['fields']));_0x1d17f7['attributes']=_0x1d17f7[_0xe455('0x3a')][_0xe455('0x3c')]?_0x1d17f7[_0xe455('0x3a')]:_0x3da42d[_0xe455('0x35')];if(!_0x159bb3[_0xe455('0x36')]['hasOwnProperty'](_0xe455('0x3d'))){_0x1d17f7['limit']=qs['limit'](_0x159bb3[_0xe455('0x36')][_0xe455('0x20')]);_0x1d17f7[_0xe455('0x1e')]=qs[_0xe455('0x1e')](_0x159bb3['query']['offset']);}_0x1d17f7[_0xe455('0x3e')]=qs[_0xe455('0x3f')](_0x159bb3['query'][_0xe455('0x3f')]);_0x1d17f7['where']=qs[_0xe455('0x38')](_[_0xe455('0x40')](_0x159bb3['query'],_0x3da42d[_0xe455('0x38')]),_0x542606);if(_0x159bb3['query'][_0xe455('0x41')]){_0x1d17f7[_0xe455('0x42')]=_['merge'](_0x1d17f7[_0xe455('0x42')],{'$or':_[_0xe455('0x30')](_0x542606,function(_0x4b1d0b){if(_0x4b1d0b[_0xe455('0x34')]!==_0xe455('0x43')){var _0x1abb2e={};_0x1abb2e[_0x4b1d0b[_0xe455('0x2d')]]={'$like':'%'+_0x159bb3[_0xe455('0x36')][_0xe455('0x41')]+'%'};return _0x1abb2e;}})});}_0x1d17f7=_[_0xe455('0x44')]({},_0x1d17f7,_0x159bb3[_0xe455('0x45')]);var _0x1e87b1={'where':_0x1d17f7[_0xe455('0x42')]};return db[_0xe455('0x31')][_0xe455('0x21')](_0x1e87b1)[_0xe455('0x27')](function(_0x254eaa){_0x47cf86[_0xe455('0x21')]=_0x254eaa;if(_0x159bb3['query'][_0xe455('0x46')]){_0x1d17f7[_0xe455('0x47')]=[{'all':!![]}];}return db[_0xe455('0x31')][_0xe455('0x48')](_0x1d17f7);})['then'](function(_0xc59dfb){_0x47cf86[_0xe455('0x49')]=_0xc59dfb;return _0x47cf86;})['then'](respondWithFilteredResult(_0x562e33,_0x1d17f7))[_0xe455('0x4a')](handleError(_0x562e33,null));};exports[_0xe455('0x4b')]=function(_0x284205,_0x375259){var _0x8eb0b1={'raw':!![],'where':{'id':_0x284205[_0xe455('0x4c')]['id']}},_0xcafc3a={};_0xcafc3a[_0xe455('0x35')]=_[_0xe455('0x37')](db['Plugin'][_0xe455('0x32')]);_0xcafc3a[_0xe455('0x36')]=_['keys'](_0x284205[_0xe455('0x36')]);_0xcafc3a[_0xe455('0x38')]=_[_0xe455('0x39')](_0xcafc3a[_0xe455('0x35')],_0xcafc3a[_0xe455('0x36')]);_0x8eb0b1['attributes']=_[_0xe455('0x39')](_0xcafc3a[_0xe455('0x35')],qs['fields'](_0x284205['query']['fields']));_0x8eb0b1['attributes']=_0x8eb0b1[_0xe455('0x3a')][_0xe455('0x3c')]?_0x8eb0b1[_0xe455('0x3a')]:_0xcafc3a[_0xe455('0x35')];if(_0x284205[_0xe455('0x36')][_0xe455('0x46')]){_0x8eb0b1['include']=[{'all':!![]}];}_0x8eb0b1=_[_0xe455('0x44')]({},_0x8eb0b1,_0x284205[_0xe455('0x45')]);return db[_0xe455('0x31')][_0xe455('0x4d')](_0x8eb0b1)['then'](handleEntityNotFound(_0x375259,null))[_0xe455('0x27')](respondWithResult(_0x375259,null))[_0xe455('0x4a')](handleError(_0x375259,null));};exports[_0xe455('0x4e')]=function(_0x5e517f,_0x102eee,_0x526ca5){return db[_0xe455('0x31')][_0xe455('0x4d')]({'where':{'id':_0x5e517f[_0xe455('0x4c')]['id']},'attributes':[_0xe455('0x2d'),_0xe455('0x6')],'raw':!![]})[_0xe455('0x27')](handleEntityNotFound(_0x102eee,null))['then'](function(_0x2d2ba3){if(_0x2d2ba3){var _0x4a3d1d=path[_0xe455('0x4f')](config[_0xe455('0x50')],_0xe455('0x51'),util[_0xe455('0x52')](_0xe455('0x53'),path['basename'](_0x2d2ba3[_0xe455('0x6')])));var _0x1a735f=fs[_0xe455('0x54')](_0x4a3d1d);var _0x21ea97=archiver(_0xe455('0x55'),{'zlib':{'level':0x9}});_0x21ea97['on'](_0xe455('0x56'),function(_0x17b5a6){if(_0x17b5a6['code']===_0xe455('0x57')){logger['error'](_0x17b5a6);}else{throw new db['Sequelize'][(_0xe455('0x58'))](_0xe455('0x59'));}});_0x21ea97['on'](_0xe455('0x5a'),function(_0x18bcf4){throw new db[(_0xe455('0x5b'))][(_0xe455('0x58'))](_0xe455('0x59'));});_0x21ea97[_0xe455('0x5c')](_0x1a735f);_0x21ea97[_0xe455('0x5d')](_0xe455('0x5e'),{'cwd':path['join'](config[_0xe455('0x50')],_0xe455('0x51'),path['dirname'](_0x2d2ba3[_0xe455('0x6')])),'ignore':[path[_0xe455('0x4f')](path['basename'](_0x2d2ba3[_0xe455('0x6')]),_0xe455('0x5f')),path['join'](path[_0xe455('0x60')](_0x2d2ba3[_0xe455('0x6')]),'attachments/**/*')],'nodir':!![]})[_0xe455('0x61')]();_0x1a735f['on'](_0xe455('0x62'),function(){if(!fs['existsSync'](_0x4a3d1d)){throw new db[(_0xe455('0x5b'))][(_0xe455('0x58'))](_0xe455('0x63'));}return _0x102eee[_0xe455('0x4e')](_0x4a3d1d,util[_0xe455('0x52')](_0xe455('0x53'),path['basename'](_0x2d2ba3[_0xe455('0x6')])),function(_0x272771){if(_0x272771){throw new db[(_0xe455('0x5b'))][(_0xe455('0x58'))](_0xe455('0x64'));}fs[_0xe455('0x65')](_0x4a3d1d);logger[_0xe455('0x66')](_0xe455('0x67'));logger[_0xe455('0x66')](_0xe455('0x68'));});});}return null;})['catch'](handleError(_0x102eee,null));};exports[_0xe455('0x69')]=function(_0x390743,_0x2b4f7d,_0x326c29){var _0x5e329b=path[_0xe455('0x60')](_0x390743[_0xe455('0x6a')]['filename'],path[_0xe455('0x6b')](_0x390743[_0xe455('0x6a')][_0xe455('0x6c')]));var _0x861be2=path['join'](config['root'],'server/files/plugins',_0x390743['file'][_0xe455('0x6c')]);var _0x304e3e=path[_0xe455('0x4f')](config[_0xe455('0x50')],_0xe455('0x51'),_0x5e329b);logger[_0xe455('0x66')](_0xe455('0x6d'),_0x861be2);logger[_0xe455('0x66')](_0xe455('0x6e'),_0x304e3e);try{fs[_0xe455('0x6f')](_0x861be2,parseInt(_0xe455('0x70'),0x8));extract(_0x861be2,{'dir':_0x304e3e},function(_0x4eb4d8){if(_0x4eb4d8){logger['error'](_0x4eb4d8);handleError(_0x4eb4d8,!![]);};var _0x523a52=fs[_0xe455('0x71')](_0x304e3e);if(_0x523a52[_0xe455('0x3c')]>0x1){removeReferences(_0x861be2,_0x304e3e);logger[_0xe455('0x5a')](_0xe455('0x72'));return _0x326c29(new Error(_0xe455('0x72')));}var _0x1edb54=fs[_0xe455('0x73')](path['join'](_0x304e3e,_0x523a52[0x0]));if(_0x1edb54['isFile']()){removeReferences(_0x861be2,_0x304e3e);logger[_0xe455('0x5a')](_0xe455('0x72'));return _0x326c29(new Error(_0xe455('0x72')));}if(_0x1edb54[_0xe455('0x74')]()){var _0x9c0225=fs[_0xe455('0x71')](path['join'](_0x304e3e,_0x523a52[0x0]));if(_0x9c0225['length']===0x0){removeReferences(_0x861be2,_0x304e3e);logger['error']('Invalid\x20plugin\x20structure');return _0x326c29(new Error(_0xe455('0x72')));}var _0x43670e=_0x9c0225[_0xe455('0x75')](function(_0x28d4fc){return _0x28d4fc===_0xe455('0x76');});if(!_0x43670e){return _0x326c29(new Error(_0xe455('0x77')));}var _0x20733b=fs[_0xe455('0x78')](path['join'](_0x304e3e,_0x523a52[0x0],_0xe455('0x76')));var _0x4a4289=JSON[_0xe455('0x79')](_0x20733b);if(_0xe455('0x1f')==typeof _0x4a4289[_0xe455('0x2d')]){return _0x326c29(new Error(_0xe455('0x7a')));}if(_0xe455('0x1f')==typeof _0x4a4289[_0xe455('0x34')]){return _0x326c29(new Error(_0xe455('0x7b')));}if(_0xe455('0x1f')==typeof _0x4a4289[_0xe455('0x7c')]){return _0x326c29(new Error(_0xe455('0x7d')));}if('undefined'==typeof _0x4a4289[_0xe455('0x7e')]){return _0x326c29(new Error(_0xe455('0x7f')));}if(_0x4a4289[_0xe455('0x34')]===_0xe455('0x80')){if('undefined'==typeof _0x4a4289[_0xe455('0x7e')][_0xe455('0x81')]){return _0x326c29(new Error(_0xe455('0x82')));}if(_0xe455('0x1f')==typeof _0x4a4289[_0xe455('0x7e')][_0xe455('0x81')][_0xe455('0x83')]&&_0xe455('0x1f')==typeof _0x4a4289[_0xe455('0x7e')][_0xe455('0x81')][_0xe455('0x84')]){return _0x326c29(new Error(_0xe455('0x85')));}}else if(_0x4a4289[_0xe455('0x34')]===_0xe455('0x86')){if(_0xe455('0x1f')==typeof _0x4a4289[_0xe455('0x7e')][_0xe455('0x87')]){return _0x326c29(new Error(_0xe455('0x88')));}if(_0xe455('0x1f')==typeof _0x4a4289[_0xe455('0x7e')]['scriptPath']){return _0x326c29(new Error(_0xe455('0x89')));}}else{return _0x326c29(new Error(_0xe455('0x8a')));}var _0x53ff57=_0x4a4289[_0xe455('0x2d')];var _0x5de5b9=_0x4a4289[_0xe455('0x8b')];var _0x10389c=_0x4a4289['type'];var _0x4b27a0=_0x4a4289[_0xe455('0x8c')]?_0x4a4289[_0xe455('0x8c')]:'always';var _0x24f19a=_0x4a4289[_0xe455('0x8d')]?_0x4a4289[_0xe455('0x8d')]:_0xe455('0x8e');var _0x418b3b='';var _0x572c05='';var _0x4a733d='';var _0x2a4c2f='';var _0x3c5f46=_0x4a4289[_0xe455('0x7c')];if(_0x10389c===_0xe455('0x80')){if(_0xe455('0x1f')!=typeof _0x4a4289[_0xe455('0x7e')][_0xe455('0x81')][_0xe455('0x83')]){var _0x10889f=_0x4a4289['parameters'][_0xe455('0x81')][_0xe455('0x83')];if(!/^(f|ht)tps?:\/\//i[_0xe455('0x8f')](_0x10889f)){_0x418b3b=path[_0xe455('0x4f')](_0xe455('0x90'),_0x5e329b,_0x523a52[0x0],_0x10889f);}else{_0x418b3b=_0x10889f;}}else{logger[_0xe455('0x66')](_0xe455('0x91'));}if(_0xe455('0x1f')!=typeof _0x4a4289[_0xe455('0x7e')]['views'][_0xe455('0x84')]){var _0x7593b1=_0x4a4289['parameters'][_0xe455('0x81')][_0xe455('0x84')];if(!/^(f|ht)tps?:\/\//i[_0xe455('0x8f')](_0x7593b1)){_0x572c05=path[_0xe455('0x4f')](_0xe455('0x90'),_0x5e329b,_0x523a52[0x0],_0x7593b1);}else{_0x572c05=_0x7593b1;}}else{logger[_0xe455('0x66')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x10389c===_0xe455('0x86')){_0x4a733d=_0x4a4289[_0xe455('0x7e')][_0xe455('0x87')];_0x2a4c2f=_0x4a4289[_0xe455('0x7e')][_0xe455('0x92')];if('undefined'!=typeof _0x4a4289[_0xe455('0x7e')][_0xe455('0x81')]){if(_0xe455('0x1f')!=typeof _0x4a4289[_0xe455('0x7e')][_0xe455('0x81')]['admin']){var _0x10889f=_0x4a4289[_0xe455('0x7e')][_0xe455('0x81')][_0xe455('0x83')];if(!/^(f|ht)tps?:\/\//i[_0xe455('0x8f')](_0x10889f)){_0x418b3b=path[_0xe455('0x4f')](_0xe455('0x90'),_0x5e329b,_0x523a52[0x0],_0x10889f);}else{_0x418b3b=_0x10889f;}}if(_0xe455('0x1f')!=typeof _0x4a4289[_0xe455('0x7e')][_0xe455('0x81')][_0xe455('0x84')]){var _0x7593b1=_0x4a4289[_0xe455('0x7e')][_0xe455('0x81')][_0xe455('0x84')];if(!/^(f|ht)tps?:\/\//i[_0xe455('0x8f')](_0x7593b1)){_0x572c05=path[_0xe455('0x4f')](_0xe455('0x90'),_0x5e329b,_0x523a52[0x0],_0x7593b1);}else{_0x572c05=_0x7593b1;}}}}var _0x1f50a0={'name':_0x53ff57,'description':_0x5de5b9,'path':path[_0xe455('0x4f')](_0x5e329b,_0x523a52[0x0]),'type':_0x10389c,'sidebar':_0x4b27a0,'icon':_0x24f19a,'adminUrl':_0x418b3b,'agentUrl':_0x572c05,'scriptName':_0x4a733d,'scriptPath':_0x2a4c2f,'version':_0x3c5f46};removeReferences(_0x861be2,null);return db[_0xe455('0x31')][_0xe455('0x93')](_0x1f50a0)[_0xe455('0x27')](function(_0x5cb056){var _0x106118={'role':_0x390743[_0xe455('0x94')]['role'],'userProfileId':_0x390743[_0xe455('0x94')][_0xe455('0x95')]};if(!_0x106118)throw new Error(_0xe455('0x96'));if(_0x106118[_0xe455('0x97')]==='user'){var _0xee1d87=_0x5cb056[_0xe455('0x28')]({'plain':!![]});return db['UserProfileSection'][_0xe455('0x4d')]({'where':{'name':_0xe455('0x29'),'userProfileId':_0x106118[_0xe455('0x95')]},'raw':!![]})[_0xe455('0x27')](function(_0x4ff71a){if(_0x4ff71a&&_0x4ff71a['autoAssociation']===0x0){return db[_0xe455('0x2a')][_0xe455('0x93')]({'name':_0xee1d87[_0xe455('0x2d')],'resourceId':_0xee1d87['id'],'type':_0x4ff71a[_0xe455('0x2d')],'sectionId':_0x4ff71a['id']},{})[_0xe455('0x27')](function(){return _0x5cb056;});}else{return _0x5cb056;}})[_0xe455('0x4a')](function(_0x3b165d){logger[_0xe455('0x5a')](_0xe455('0x98'),_0x3b165d);throw _0x3b165d;});}return _0x5cb056;})['then'](respondWithResult(_0x2b4f7d,null))[_0xe455('0x4a')](handleError(_0x2b4f7d,null));}});}catch(_0x42216a){_0x2b4f7d['status'](0x1f4)[_0xe455('0x2e')](_0x42216a);}};function removeReferences(_0xf18b19,_0x3ba5df){try{if(_0xf18b19){fs[_0xe455('0x65')](_0xf18b19);logger[_0xe455('0x66')](_0xe455('0x99'));}if(_0x3ba5df){rimraf(_0x3ba5df,function(){});logger['info'](_0xe455('0x9a'));}}catch(_0x18df6f){logger[_0xe455('0x5a')](_0x18df6f);}}exports[_0xe455('0x9b')]=function(_0x133bdc,_0x47801f,_0x16ed08){return db[_0xe455('0x31')]['find']({'where':{'id':_0x133bdc['params']['id']}})[_0xe455('0x27')](handleEntityNotFound(_0x47801f,null))[_0xe455('0x27')](saveUpdates(_0x133bdc[_0xe455('0x94')],null))[_0xe455('0x27')](respondWithResult(_0x47801f,null))[_0xe455('0x4a')](handleError(_0x47801f,null));};exports['delete']=function(_0x48ad78,_0x1627a1,_0x517e7d){return db['Plugin'][_0xe455('0x4d')]({'where':{'id':_0x48ad78[_0xe455('0x4c')]['id']}})[_0xe455('0x27')](function(_0x169e3f){if(_0x169e3f){return _0x169e3f[_0xe455('0x2b')]();}})[_0xe455('0x27')](function(_0x476d0e){rimraf(path['join'](config[_0xe455('0x50')],_0xe455('0x51'),path[_0xe455('0x9c')](_0x476d0e[_0xe455('0x6')])),function(){});return _0x476d0e;})[_0xe455('0x27')](handleEntityNotFound(_0x1627a1,null))['then'](respondWithStatusCode(_0x1627a1,null))['catch'](handleError(_0x1627a1,null));};exports[_0xe455('0x9d')]=function(_0x393b9f,_0x2c08e7,_0x1c02be){return BPromise[_0xe455('0x9e')]()[_0xe455('0x27')](function(){if(!_0x393b9f[_0xe455('0x36')][_0xe455('0x6')]){throw new Error(_0xe455('0x9f'));}if(!_0x393b9f['query'][_0xe455('0xa0')]){throw new Error(_0xe455('0xa1'));}var _0x465dee=_0x393b9f['query']['hostname']?_0x393b9f[_0xe455('0x36')][_0xe455('0xa2')]+':'+_0x393b9f[_0xe455('0x36')][_0xe455('0xa0')]:'http://localhost:'+_0x393b9f[_0xe455('0x36')][_0xe455('0xa0')];var _0x22fa7e=_0x393b9f[_0xe455('0x36')]['json']?_0x393b9f[_0xe455('0x36')][_0xe455('0x24')]:!![];var _0x276a86=_0x393b9f['query'][_0xe455('0xa3')]?_0x393b9f[_0xe455('0x36')][_0xe455('0xa3')]:null;var _0x55a7ad={'method':_0x393b9f[_0xe455('0xa4')],'uri':util[_0xe455('0x52')](_0xe455('0xa5'),_0x465dee,_0x393b9f[_0xe455('0x36')][_0xe455('0x6')]),'json':_0x22fa7e,'resolveWithFullResponse':!![],'encoding':_0x276a86,'qs':_0x393b9f[_0xe455('0x36')]};if(_0x393b9f[_0xe455('0xa6')]){_0x55a7ad[_0xe455('0xa6')]=_0x393b9f[_0xe455('0xa6')];if(_0x55a7ad['headers'][_0xe455('0xa7')]){delete _0x55a7ad['headers'][_0xe455('0xa7')];}}if(_0x55a7ad[_0xe455('0xa6')][_0xe455('0xa8')]){delete _0x55a7ad['headers'][_0xe455('0xa8')];}return rp(_0x55a7ad);})[_0xe455('0x27')](function(_0x19c096){if(_0x19c096){_0x2c08e7['set'](_0x19c096[_0xe455('0xa6')]);logger[_0xe455('0x66')](_0x19c096['body']);if(_[_0xe455('0xa9')](_0x393b9f['query'][_0xe455('0x6')],_0xe455('0x4e'))&&_0x19c096['statusCode']==0x1f4){return _0x2c08e7[_0xe455('0x1c')](_0x19c096[_0xe455('0xaa')]);}else{return _0x2c08e7[_0xe455('0xab')](_0x19c096[_0xe455('0xaa')])['send'](_0x19c096['body']);}}else{return _0x2c08e7[_0xe455('0x1c')](0xc8);}})['catch'](handleError(_0x2c08e7,null));};exports[_0xe455('0xac')]=function(_0x15824f,_0x2382d5,_0x8ab7ee){return BPromise['resolve']()[_0xe455('0x27')](function(){if(!_0x15824f[_0xe455('0x36')][_0xe455('0x6')]){throw new Error(_0xe455('0x9f'));}if(!_0x15824f[_0xe455('0x36')][_0xe455('0xa0')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x319f12=_0x15824f[_0xe455('0x36')]['hostname']?_0x15824f['query'][_0xe455('0xa2')]+':'+_0x15824f['query']['port']:_0xe455('0xad')+_0x15824f[_0xe455('0x36')]['port'];var _0xa7de00=_0x15824f[_0xe455('0x36')][_0xe455('0x24')]?_0x15824f[_0xe455('0x36')][_0xe455('0x24')]:!![];var _0x50c508=_0x15824f[_0xe455('0x36')][_0xe455('0xa3')]?_0x15824f[_0xe455('0x36')][_0xe455('0xa3')]:null;var _0x2832ee={'method':_0x15824f[_0xe455('0xa4')],'uri':util['format']('%s%s',_0x319f12,_0x15824f[_0xe455('0x36')][_0xe455('0x6')]),'json':_0xa7de00,'resolveWithFullResponse':!![],'encoding':_0x50c508,'body':_0x15824f['body']};if(_0x15824f['headers']){_0x2832ee[_0xe455('0xa6')]=_0x15824f[_0xe455('0xa6')];if(_0x2832ee[_0xe455('0xa6')][_0xe455('0xa7')]){delete _0x2832ee[_0xe455('0xa6')][_0xe455('0xa7')];}}if(_0x2832ee['headers'][_0xe455('0xa8')]){delete _0x2832ee[_0xe455('0xa6')][_0xe455('0xa8')];}return rp(_0x2832ee);})['then'](function(_0x44dc54){if(_0x44dc54){_0x2382d5[_0xe455('0x22')](_0x44dc54['headers']);logger['info'](_0x44dc54[_0xe455('0x94')]);return _0x2382d5[_0xe455('0xab')](_0x44dc54[_0xe455('0xaa')])[_0xe455('0x2e')](_0x44dc54[_0xe455('0x94')]);}else{return _0x2382d5[_0xe455('0x1c')](0xc8);}})[_0xe455('0x4a')](handleError(_0x2382d5,null));}; \ No newline at end of file +var _0x44a2=['\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','method','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','extract-zip','archiver','ioredis','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','UserProfileResource','stack','name','send','Plugin','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','include','rows','catch','show','params','keys','includeAll','find','download','root','server/files/plugins','format','%s.zip','basename','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','error','pipe','**/*','join','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','scriptPath','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','script','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','update','delete','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port'];(function(_0x1ae975,_0x70b40e){var _0x2576ca=function(_0x1b4e97){while(--_0x1b4e97){_0x1ae975['push'](_0x1ae975['shift']());}};_0x2576ca(++_0x70b40e);}(_0x44a2,0xb1));var _0x244a=function(_0x38fe0c,_0x33e9b3){_0x38fe0c=_0x38fe0c-0x0;var _0x2f30a2=_0x44a2[_0x38fe0c];return _0x2f30a2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x244a('0x0'));var zipdir=require(_0x244a('0x1'));var jsonpatch=require(_0x244a('0x2'));var rp=require('request-promise');var moment=require(_0x244a('0x3'));var BPromise=require(_0x244a('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x244a('0x5'));var sox=require(_0x244a('0x6'));var csv=require(_0x244a('0x7'));var ejs=require(_0x244a('0x8'));var fs=require('fs');var fs_extra=require(_0x244a('0x9'));var _=require(_0x244a('0xa'));var squel=require(_0x244a('0xb'));var crypto=require(_0x244a('0xc'));var jsforce=require(_0x244a('0xd'));var deskjs=require(_0x244a('0xe'));var toCsv=require(_0x244a('0x7'));var querystring=require(_0x244a('0xf'));var Papa=require('papaparse');var extract=require(_0x244a('0x10'));var rimraf=require(_0x244a('0x0'));var archiver=require(_0x244a('0x11'));var Redis=require(_0x244a('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x244a('0x13'));var logger=require('../../config/logger')(_0x244a('0x14'));var utils=require(_0x244a('0x15'));var config=require(_0x244a('0x16'));var licenseUtil=require(_0x244a('0x17'));var db=require(_0x244a('0x18'))['db'];config[_0x244a('0x19')]=_['defaults'](config[_0x244a('0x19')],{'host':_0x244a('0x1a'),'port':0x18eb});var socket=require(_0x244a('0x1b'))(new Redis(config[_0x244a('0x19')]));require(_0x244a('0x1c'))[_0x244a('0x1d')](socket);function respondWithStatusCode(_0x3f431b,_0x1145ad){_0x1145ad=_0x1145ad||0xcc;return function(_0xe51522){if(_0xe51522){return _0x3f431b[_0x244a('0x1e')](_0x1145ad);}return _0x3f431b[_0x244a('0x1f')](_0x1145ad)[_0x244a('0x20')]();};}function respondWithResult(_0x5cdcc9,_0x15718d){_0x15718d=_0x15718d||0xc8;return function(_0x22c0aa){if(_0x22c0aa){return _0x5cdcc9[_0x244a('0x1f')](_0x15718d)['json'](_0x22c0aa);}};}function respondWithFilteredResult(_0x5826af,_0x310f96){return function(_0xdf06bd){if(_0xdf06bd){var _0xf1fbc9=typeof _0x310f96[_0x244a('0x21')]===_0x244a('0x22')&&typeof _0x310f96['limit']==='undefined';var _0x8d566f=_0xdf06bd[_0x244a('0x23')];var _0x2ebf2d=_0xf1fbc9?0x0:_0x310f96[_0x244a('0x21')];var _0xffa97c=_0xf1fbc9?_0xdf06bd[_0x244a('0x23')]:_0x310f96['offset']+_0x310f96[_0x244a('0x24')];var _0xc1af20;if(_0xffa97c>=_0x8d566f){_0xffa97c=_0x8d566f;_0xc1af20=0xc8;}else{_0xc1af20=0xce;}_0x5826af[_0x244a('0x1f')](_0xc1af20);return _0x5826af[_0x244a('0x25')](_0x244a('0x26'),_0x2ebf2d+'-'+_0xffa97c+'/'+_0x8d566f)[_0x244a('0x27')](_0xdf06bd);}return null;};}function patchUpdates(_0x268249){return function(_0x4047d7){try{jsonpatch[_0x244a('0x28')](_0x4047d7,_0x268249,!![]);}catch(_0x35eaab){return BPromise[_0x244a('0x29')](_0x35eaab);}return _0x4047d7[_0x244a('0x2a')]();};}function saveUpdates(_0x42b4a9,_0x436630){return function(_0x17d54d){if(_0x17d54d){return _0x17d54d['update'](_0x42b4a9)[_0x244a('0x2b')](function(_0x2e0b2b){return _0x2e0b2b;});}return null;};}function removeEntity(_0x25aeaa,_0x2717e1){return function(_0xf3ce89){if(_0xf3ce89){return _0xf3ce89[_0x244a('0x2c')]()[_0x244a('0x2b')](function(){var _0x592b74=_0xf3ce89['get']({'plain':!![]});var _0x1c9b9a='Plugins';return db[_0x244a('0x2d')][_0x244a('0x2c')]({'where':{'type':_0x1c9b9a,'resourceId':_0x592b74['id']}})[_0x244a('0x2b')](function(){return _0xf3ce89;});})[_0x244a('0x2b')](function(){_0x25aeaa[_0x244a('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x591ceb,_0x4143d1){return function(_0x4ae90e){if(!_0x4ae90e){_0x591ceb['sendStatus'](0x194);}return _0x4ae90e;};}function handleError(_0x4df7af,_0x2e7eaa){_0x2e7eaa=_0x2e7eaa||0x1f4;return function(_0x18647b){logger['error'](_0x18647b[_0x244a('0x2e')]);if(_0x18647b[_0x244a('0x2f')]){delete _0x18647b[_0x244a('0x2f')];}_0x4df7af[_0x244a('0x1f')](_0x2e7eaa)[_0x244a('0x30')](_0x18647b);};}exports['index']=function(_0x134ab8,_0x34d1f1){var _0x448eb8={},_0x4668cc={},_0x54282f={'count':0x0,'rows':[]};var _0xf1400f=_['map'](db[_0x244a('0x31')][_0x244a('0x32')],function(_0x2e5299){return{'name':_0x2e5299[_0x244a('0x33')],'type':_0x2e5299[_0x244a('0x34')][_0x244a('0x35')]};});_0x4668cc[_0x244a('0x36')]=_['map'](_0xf1400f,_0x244a('0x2f'));_0x4668cc[_0x244a('0x37')]=_['keys'](_0x134ab8[_0x244a('0x37')]);_0x4668cc[_0x244a('0x38')]=_[_0x244a('0x39')](_0x4668cc['model'],_0x4668cc['query']);_0x448eb8[_0x244a('0x3a')]=_[_0x244a('0x39')](_0x4668cc[_0x244a('0x36')],qs[_0x244a('0x3b')](_0x134ab8[_0x244a('0x37')]['fields']));_0x448eb8[_0x244a('0x3a')]=_0x448eb8[_0x244a('0x3a')][_0x244a('0x3c')]?_0x448eb8[_0x244a('0x3a')]:_0x4668cc['model'];if(!_0x134ab8[_0x244a('0x37')][_0x244a('0x3d')](_0x244a('0x3e'))){_0x448eb8[_0x244a('0x24')]=qs[_0x244a('0x24')](_0x134ab8[_0x244a('0x37')]['limit']);_0x448eb8[_0x244a('0x21')]=qs[_0x244a('0x21')](_0x134ab8[_0x244a('0x37')][_0x244a('0x21')]);}_0x448eb8[_0x244a('0x3f')]=qs['sort'](_0x134ab8[_0x244a('0x37')][_0x244a('0x40')]);_0x448eb8[_0x244a('0x41')]=qs[_0x244a('0x38')](_['pick'](_0x134ab8[_0x244a('0x37')],_0x4668cc[_0x244a('0x38')]),_0xf1400f);if(_0x134ab8[_0x244a('0x37')][_0x244a('0x42')]){_0x448eb8['where']=_[_0x244a('0x43')](_0x448eb8[_0x244a('0x41')],{'$or':_[_0x244a('0x44')](_0xf1400f,function(_0x28e7a8){if(_0x28e7a8['type']!==_0x244a('0x45')){var _0x3c5ccf={};_0x3c5ccf[_0x28e7a8[_0x244a('0x2f')]]={'$like':'%'+_0x134ab8[_0x244a('0x37')][_0x244a('0x42')]+'%'};return _0x3c5ccf;}})});}_0x448eb8=_[_0x244a('0x43')]({},_0x448eb8,_0x134ab8[_0x244a('0x46')]);var _0x3413b4={'where':_0x448eb8[_0x244a('0x41')]};return db[_0x244a('0x31')][_0x244a('0x23')](_0x3413b4)[_0x244a('0x2b')](function(_0xa372b2){_0x54282f[_0x244a('0x23')]=_0xa372b2;if(_0x134ab8[_0x244a('0x37')]['includeAll']){_0x448eb8[_0x244a('0x47')]=[{'all':!![]}];}return db[_0x244a('0x31')]['findAll'](_0x448eb8);})[_0x244a('0x2b')](function(_0x27e4aa){_0x54282f[_0x244a('0x48')]=_0x27e4aa;return _0x54282f;})[_0x244a('0x2b')](respondWithFilteredResult(_0x34d1f1,_0x448eb8))[_0x244a('0x49')](handleError(_0x34d1f1,null));};exports[_0x244a('0x4a')]=function(_0x3c6d9f,_0xccced1){var _0x17cd19={'raw':!![],'where':{'id':_0x3c6d9f[_0x244a('0x4b')]['id']}},_0x13d71c={};_0x13d71c[_0x244a('0x36')]=_[_0x244a('0x4c')](db[_0x244a('0x31')]['rawAttributes']);_0x13d71c[_0x244a('0x37')]=_[_0x244a('0x4c')](_0x3c6d9f['query']);_0x13d71c[_0x244a('0x38')]=_['intersection'](_0x13d71c['model'],_0x13d71c[_0x244a('0x37')]);_0x17cd19[_0x244a('0x3a')]=_['intersection'](_0x13d71c['model'],qs[_0x244a('0x3b')](_0x3c6d9f[_0x244a('0x37')]['fields']));_0x17cd19[_0x244a('0x3a')]=_0x17cd19[_0x244a('0x3a')][_0x244a('0x3c')]?_0x17cd19['attributes']:_0x13d71c[_0x244a('0x36')];if(_0x3c6d9f[_0x244a('0x37')][_0x244a('0x4d')]){_0x17cd19[_0x244a('0x47')]=[{'all':!![]}];}_0x17cd19=_[_0x244a('0x43')]({},_0x17cd19,_0x3c6d9f[_0x244a('0x46')]);return db[_0x244a('0x31')][_0x244a('0x4e')](_0x17cd19)[_0x244a('0x2b')](handleEntityNotFound(_0xccced1,null))[_0x244a('0x2b')](respondWithResult(_0xccced1,null))[_0x244a('0x49')](handleError(_0xccced1,null));};exports[_0x244a('0x4f')]=function(_0x1f87e0,_0x19dd44,_0x4605f4){return db[_0x244a('0x31')][_0x244a('0x4e')]({'where':{'id':_0x1f87e0[_0x244a('0x4b')]['id']},'attributes':[_0x244a('0x2f'),_0x244a('0x5')],'raw':!![]})['then'](handleEntityNotFound(_0x19dd44,null))['then'](function(_0x1abec6){if(_0x1abec6){var _0x5ba6c2=path['join'](config[_0x244a('0x50')],_0x244a('0x51'),util[_0x244a('0x52')](_0x244a('0x53'),path[_0x244a('0x54')](_0x1abec6[_0x244a('0x5')])));var _0xd46ac5=fs['createWriteStream'](_0x5ba6c2);var _0x56cb01=archiver('zip',{'zlib':{'level':0x9}});_0x56cb01['on'](_0x244a('0x55'),function(_0x1a72c6){if(_0x1a72c6[_0x244a('0x56')]===_0x244a('0x57')){logger['error'](_0x1a72c6);}else{throw new db[(_0x244a('0x58'))][(_0x244a('0x59'))](_0x244a('0x5a'));}});_0x56cb01['on'](_0x244a('0x5b'),function(_0x5affa9){throw new db[(_0x244a('0x58'))][(_0x244a('0x59'))](_0x244a('0x5a'));});_0x56cb01[_0x244a('0x5c')](_0xd46ac5);_0x56cb01['glob'](_0x244a('0x5d'),{'cwd':path[_0x244a('0x5e')](config[_0x244a('0x50')],_0x244a('0x51'),path[_0x244a('0x5f')](_0x1abec6[_0x244a('0x5')])),'ignore':[path[_0x244a('0x5e')](path[_0x244a('0x54')](_0x1abec6[_0x244a('0x5')]),_0x244a('0x60')),path['join'](path[_0x244a('0x54')](_0x1abec6[_0x244a('0x5')]),_0x244a('0x61'))],'nodir':!![]})[_0x244a('0x62')]();_0xd46ac5['on'](_0x244a('0x63'),function(){if(!fs[_0x244a('0x64')](_0x5ba6c2)){throw new db['Sequelize'][(_0x244a('0x59'))](_0x244a('0x65'));}return _0x19dd44[_0x244a('0x4f')](_0x5ba6c2,util[_0x244a('0x52')](_0x244a('0x53'),path[_0x244a('0x54')](_0x1abec6[_0x244a('0x5')])),function(_0x10540d){if(_0x10540d){throw new db[(_0x244a('0x58'))][(_0x244a('0x59'))](_0x244a('0x66'));}fs[_0x244a('0x67')](_0x5ba6c2);logger['info']('Download\x20completed');logger[_0x244a('0x68')]('Temporary\x20file\x20removed');});});}return null;})[_0x244a('0x49')](handleError(_0x19dd44,null));};exports['upload']=function(_0x252a4d,_0x529701,_0x42d5e8){var _0x126ff4=path[_0x244a('0x54')](_0x252a4d[_0x244a('0x69')][_0x244a('0x6a')],path[_0x244a('0x6b')](_0x252a4d[_0x244a('0x69')][_0x244a('0x6a')]));var _0x5eb529=path['join'](config[_0x244a('0x50')],_0x244a('0x51'),_0x252a4d[_0x244a('0x69')][_0x244a('0x6a')]);var _0x59f29b=path[_0x244a('0x5e')](config[_0x244a('0x50')],_0x244a('0x51'),_0x126ff4);logger[_0x244a('0x68')](_0x244a('0x6c'),_0x5eb529);logger['info']('Plugin\x20upload\x20destination:\x20%s',_0x59f29b);try{fs['chmodSync'](_0x5eb529,parseInt('0777',0x8));extract(_0x5eb529,{'dir':_0x59f29b},function(_0x113d0a){if(_0x113d0a){logger[_0x244a('0x5b')](_0x113d0a);handleError(_0x113d0a,!![]);};var _0x559927=fs[_0x244a('0x6d')](_0x59f29b);if(_0x559927[_0x244a('0x3c')]>0x1){removeReferences(_0x5eb529,_0x59f29b);logger[_0x244a('0x5b')](_0x244a('0x6e'));return _0x42d5e8(new Error(_0x244a('0x6e')));}var _0x5e8c8b=fs[_0x244a('0x6f')](path[_0x244a('0x5e')](_0x59f29b,_0x559927[0x0]));if(_0x5e8c8b[_0x244a('0x70')]()){removeReferences(_0x5eb529,_0x59f29b);logger[_0x244a('0x5b')](_0x244a('0x6e'));return _0x42d5e8(new Error('Invalid\x20plugin\x20structure'));}if(_0x5e8c8b[_0x244a('0x71')]()){var _0x5e9793=fs['readdirSync'](path[_0x244a('0x5e')](_0x59f29b,_0x559927[0x0]));if(_0x5e9793['length']===0x0){removeReferences(_0x5eb529,_0x59f29b);logger[_0x244a('0x5b')]('Invalid\x20plugin\x20structure');return _0x42d5e8(new Error(_0x244a('0x6e')));}var _0x4fbec5=_0x5e9793[_0x244a('0x72')](function(_0x16039a){return _0x16039a===_0x244a('0x73');});if(!_0x4fbec5){return _0x42d5e8(new Error(_0x244a('0x74')));}var _0x4bb4ac=fs[_0x244a('0x75')](path[_0x244a('0x5e')](_0x59f29b,_0x559927[0x0],_0x244a('0x73')));var _0x11faa2=JSON[_0x244a('0x76')](_0x4bb4ac);if(_0x244a('0x22')==typeof _0x11faa2[_0x244a('0x2f')]){return _0x42d5e8(new Error(_0x244a('0x77')));}if(_0x244a('0x22')==typeof _0x11faa2[_0x244a('0x34')]){return _0x42d5e8(new Error('Invalid\x20manifest:\x20type\x20missing'));}if('undefined'==typeof _0x11faa2[_0x244a('0x78')]){return _0x42d5e8(new Error(_0x244a('0x79')));}if('undefined'==typeof _0x11faa2[_0x244a('0x7a')]){return _0x42d5e8(new Error(_0x244a('0x7b')));}if(_0x11faa2[_0x244a('0x34')]===_0x244a('0x7c')){if('undefined'==typeof _0x11faa2[_0x244a('0x7a')][_0x244a('0x7d')]){return _0x42d5e8(new Error(_0x244a('0x7e')));}if(_0x244a('0x22')==typeof _0x11faa2[_0x244a('0x7a')]['views'][_0x244a('0x7f')]&&_0x244a('0x22')==typeof _0x11faa2[_0x244a('0x7a')][_0x244a('0x7d')][_0x244a('0x80')]){return _0x42d5e8(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x11faa2[_0x244a('0x34')]==='script'){if('undefined'==typeof _0x11faa2[_0x244a('0x7a')]['scriptName']){return _0x42d5e8(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x244a('0x22')==typeof _0x11faa2[_0x244a('0x7a')][_0x244a('0x81')]){return _0x42d5e8(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x42d5e8(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x35b4a0=_0x11faa2['name'];var _0x560d4a=_0x11faa2['description'];var _0x5c53dd=_0x11faa2[_0x244a('0x34')];var _0x22492e=_0x11faa2[_0x244a('0x82')]?_0x11faa2[_0x244a('0x82')]:_0x244a('0x83');var _0x5994a1=_0x11faa2['icon']?_0x11faa2[_0x244a('0x84')]:_0x244a('0x85');var _0x17919b='';var _0x4e6e2e='';var _0x372d84='';var _0x5db8fd='';var _0x1affdb=_0x11faa2[_0x244a('0x78')];if(_0x5c53dd==='html'){if(_0x244a('0x22')!=typeof _0x11faa2[_0x244a('0x7a')][_0x244a('0x7d')]['admin']){var _0x512285=_0x11faa2[_0x244a('0x7a')][_0x244a('0x7d')][_0x244a('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x244a('0x86')](_0x512285)){_0x17919b=path[_0x244a('0x5e')](_0x244a('0x87'),_0x126ff4,_0x559927[0x0],_0x512285);}else{_0x17919b=_0x512285;}}else{logger[_0x244a('0x68')](_0x244a('0x88'));}if(_0x244a('0x22')!=typeof _0x11faa2[_0x244a('0x7a')][_0x244a('0x7d')][_0x244a('0x80')]){var _0x15c59e=_0x11faa2['parameters'][_0x244a('0x7d')][_0x244a('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x244a('0x86')](_0x15c59e)){_0x4e6e2e=path[_0x244a('0x5e')](_0x244a('0x87'),_0x126ff4,_0x559927[0x0],_0x15c59e);}else{_0x4e6e2e=_0x15c59e;}}else{logger[_0x244a('0x68')](_0x244a('0x89'));}}else if(_0x5c53dd===_0x244a('0x8a')){_0x372d84=_0x11faa2['parameters']['scriptName'];_0x5db8fd=_0x11faa2[_0x244a('0x7a')][_0x244a('0x81')];if('undefined'!=typeof _0x11faa2[_0x244a('0x7a')][_0x244a('0x7d')]){if(_0x244a('0x22')!=typeof _0x11faa2['parameters'][_0x244a('0x7d')][_0x244a('0x7f')]){var _0x512285=_0x11faa2[_0x244a('0x7a')]['views'][_0x244a('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x244a('0x86')](_0x512285)){_0x17919b=path[_0x244a('0x5e')](_0x244a('0x87'),_0x126ff4,_0x559927[0x0],_0x512285);}else{_0x17919b=_0x512285;}}if('undefined'!=typeof _0x11faa2[_0x244a('0x7a')][_0x244a('0x7d')][_0x244a('0x80')]){var _0x15c59e=_0x11faa2[_0x244a('0x7a')][_0x244a('0x7d')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x15c59e)){_0x4e6e2e=path['join'](_0x244a('0x87'),_0x126ff4,_0x559927[0x0],_0x15c59e);}else{_0x4e6e2e=_0x15c59e;}}}}var _0x368559={'name':_0x35b4a0,'description':_0x560d4a,'path':path[_0x244a('0x5e')](_0x126ff4,_0x559927[0x0]),'type':_0x5c53dd,'sidebar':_0x22492e,'icon':_0x5994a1,'adminUrl':_0x17919b,'agentUrl':_0x4e6e2e,'scriptName':_0x372d84,'scriptPath':_0x5db8fd,'version':_0x1affdb};removeReferences(_0x5eb529,null);return db[_0x244a('0x31')][_0x244a('0x8b')](_0x368559)[_0x244a('0x2b')](function(_0xceb069){var _0x3e455e={'role':_0x252a4d[_0x244a('0x8c')][_0x244a('0x8d')],'userProfileId':_0x252a4d['body']['userProfileId']};if(!_0x3e455e)throw new Error(_0x244a('0x8e'));if(_0x3e455e[_0x244a('0x8d')]==='user'){var _0x3cf90f=_0xceb069[_0x244a('0x8f')]({'plain':!![]});return db[_0x244a('0x90')][_0x244a('0x4e')]({'where':{'name':'Plugins','userProfileId':_0x3e455e[_0x244a('0x91')]},'raw':!![]})['then'](function(_0x81958c){if(_0x81958c&&_0x81958c['autoAssociation']===0x0){return db['UserProfileResource'][_0x244a('0x8b')]({'name':_0x3cf90f['name'],'resourceId':_0x3cf90f['id'],'type':_0x81958c[_0x244a('0x2f')],'sectionId':_0x81958c['id']},{})[_0x244a('0x2b')](function(){return _0xceb069;});}else{return _0xceb069;}})['catch'](function(_0x2a3355){logger[_0x244a('0x5b')](_0x244a('0x92'),_0x2a3355);throw _0x2a3355;});}return _0xceb069;})[_0x244a('0x2b')](respondWithResult(_0x529701,null))['catch'](handleError(_0x529701,null));}});}catch(_0xf160f6){_0x529701['status'](0x1f4)[_0x244a('0x30')](_0xf160f6);}};function removeReferences(_0x5a353c,_0x7d2130){try{if(_0x5a353c){fs['unlinkSync'](_0x5a353c);logger['info'](_0x244a('0x93'));}if(_0x7d2130){rimraf(_0x7d2130,function(){});logger[_0x244a('0x68')]('Extracted\x20folder\x20removed');}}catch(_0x263aa0){logger[_0x244a('0x5b')](_0x263aa0);}}exports[_0x244a('0x94')]=function(_0x19ed65,_0x5f4786,_0x9bbbdc){return db[_0x244a('0x31')]['find']({'where':{'id':_0x19ed65[_0x244a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5f4786,null))[_0x244a('0x2b')](saveUpdates(_0x19ed65['body'],null))['then'](respondWithResult(_0x5f4786,null))[_0x244a('0x49')](handleError(_0x5f4786,null));};exports[_0x244a('0x95')]=function(_0x17c123,_0x46ff94,_0x5561d9){return db[_0x244a('0x31')]['find']({'where':{'id':_0x17c123[_0x244a('0x4b')]['id']}})[_0x244a('0x2b')](function(_0x5bb77a){if(_0x5bb77a){return _0x5bb77a['destroy']();}})[_0x244a('0x2b')](function(_0x262ea6){rimraf(path[_0x244a('0x5e')](config[_0x244a('0x50')],'server/files/plugins',path[_0x244a('0x5f')](_0x262ea6[_0x244a('0x5')])),function(){});return _0x262ea6;})[_0x244a('0x2b')](handleEntityNotFound(_0x46ff94,null))[_0x244a('0x2b')](respondWithStatusCode(_0x46ff94,null))['catch'](handleError(_0x46ff94,null));};exports['webhookGet']=function(_0x1a4246,_0x5556ad,_0x3fb793){return BPromise[_0x244a('0x96')]()['then'](function(){if(!_0x1a4246[_0x244a('0x37')][_0x244a('0x5')]){throw new Error(_0x244a('0x97'));}if(!_0x1a4246[_0x244a('0x37')][_0x244a('0x98')]){throw new Error(_0x244a('0x99'));}var _0x4efe8d=_0x1a4246['query'][_0x244a('0x9a')]?_0x1a4246[_0x244a('0x37')][_0x244a('0x9a')]+':'+_0x1a4246[_0x244a('0x37')]['port']:_0x244a('0x9b')+_0x1a4246[_0x244a('0x37')][_0x244a('0x98')];var _0x9b60ee=_0x1a4246[_0x244a('0x37')][_0x244a('0x27')]?_0x1a4246[_0x244a('0x37')]['json']:!![];var _0xaa19c5=_0x1a4246[_0x244a('0x37')]['encoding']?_0x1a4246[_0x244a('0x37')][_0x244a('0x9c')]:null;var _0x40e07d={'method':_0x1a4246['method'],'uri':util[_0x244a('0x52')](_0x244a('0x9d'),_0x4efe8d,_0x1a4246['query']['path']),'json':_0x9b60ee,'resolveWithFullResponse':!![],'encoding':_0xaa19c5,'qs':_0x1a4246['query']};if(_0x1a4246['headers']){_0x40e07d[_0x244a('0x9e')]=_0x1a4246[_0x244a('0x9e')];if(_0x40e07d['headers'][_0x244a('0x9f')]){delete _0x40e07d['headers'][_0x244a('0x9f')];}}if(_0x40e07d[_0x244a('0x9e')][_0x244a('0xa0')]){delete _0x40e07d[_0x244a('0x9e')]['content-type'];}return rp(_0x40e07d);})[_0x244a('0x2b')](function(_0x161799){if(_0x161799){_0x5556ad[_0x244a('0x25')](_0x161799['headers']);logger[_0x244a('0x68')](_0x161799['body']);if(_[_0x244a('0xa1')](_0x1a4246[_0x244a('0x37')][_0x244a('0x5')],'download')&&_0x161799[_0x244a('0xa2')]==0x1f4){return _0x5556ad[_0x244a('0x1e')](_0x161799['statusCode']);}else{return _0x5556ad['status'](_0x161799['statusCode'])[_0x244a('0x30')](_0x161799[_0x244a('0x8c')]);}}else{return _0x5556ad[_0x244a('0x1e')](0xc8);}})[_0x244a('0x49')](handleError(_0x5556ad,null));};exports[_0x244a('0xa3')]=function(_0x284be4,_0x1d3a26,_0x46f2a8){return BPromise[_0x244a('0x96')]()[_0x244a('0x2b')](function(){if(!_0x284be4[_0x244a('0x37')][_0x244a('0x5')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x284be4['query'][_0x244a('0x98')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x154c6a=_0x284be4[_0x244a('0x37')]['hostname']?_0x284be4['query'][_0x244a('0x9a')]+':'+_0x284be4[_0x244a('0x37')]['port']:'http://localhost:'+_0x284be4[_0x244a('0x37')][_0x244a('0x98')];var _0x14742f=_0x284be4[_0x244a('0x37')][_0x244a('0x27')]?_0x284be4[_0x244a('0x37')]['json']:!![];var _0x499b67=_0x284be4[_0x244a('0x37')][_0x244a('0x9c')]?_0x284be4[_0x244a('0x37')][_0x244a('0x9c')]:null;var _0x18285e={'method':_0x284be4[_0x244a('0xa4')],'uri':util[_0x244a('0x52')](_0x244a('0x9d'),_0x154c6a,_0x284be4[_0x244a('0x37')][_0x244a('0x5')]),'json':_0x14742f,'resolveWithFullResponse':!![],'encoding':_0x499b67,'body':_0x284be4[_0x244a('0x8c')]};if(_0x284be4[_0x244a('0x9e')]){_0x18285e['headers']=_0x284be4['headers'];if(_0x18285e[_0x244a('0x9e')][_0x244a('0x9f')]){delete _0x18285e[_0x244a('0x9e')][_0x244a('0x9f')];}}if(_0x18285e[_0x244a('0x9e')][_0x244a('0xa0')]){delete _0x18285e[_0x244a('0x9e')][_0x244a('0xa0')];}return rp(_0x18285e);})[_0x244a('0x2b')](function(_0x45e073){if(_0x45e073){_0x1d3a26[_0x244a('0x25')](_0x45e073[_0x244a('0x9e')]);logger[_0x244a('0x68')](_0x45e073[_0x244a('0x8c')]);return _0x1d3a26['status'](_0x45e073[_0x244a('0xa2')])['send'](_0x45e073['body']);}else{return _0x1d3a26[_0x244a('0x1e')](0xc8);}})[_0x244a('0x49')](handleError(_0x1d3a26,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 3628460..aa45064 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 _0xdc97=['events','../../mysqldb','Plugin','save','remove','emit','hook'];(function(_0xa88264,_0x4f727a){var _0x258d08=function(_0x4a46f5){while(--_0x4a46f5){_0xa88264['push'](_0xa88264['shift']());}};_0x258d08(++_0x4f727a);}(_0xdc97,0x13b));var _0x7dc9=function(_0x1bdccd,_0x3830f9){_0x1bdccd=_0x1bdccd-0x0;var _0x2b6700=_0xdc97[_0x1bdccd];return _0x2b6700;};'use strict';var EventEmitter=require(_0x7dc9('0x0'));var Plugin=require(_0x7dc9('0x1'))['db'][_0x7dc9('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7dc9('0x3'),'afterUpdate':'update','afterDestroy':_0x7dc9('0x4')};function emitEvent(_0x2b86da){return function(_0x478a95,_0x2a77c1,_0x1e513b){PluginEvents[_0x7dc9('0x5')](_0x2b86da+':'+_0x478a95['id'],_0x478a95);PluginEvents[_0x7dc9('0x5')](_0x2b86da,_0x478a95);_0x1e513b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x7dc9('0x6')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0x22ed=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','Plugin','setMaxListeners','save'];(function(_0x382e3b,_0x382994){var _0x47d697=function(_0x3d2836){while(--_0x3d2836){_0x382e3b['push'](_0x382e3b['shift']());}};_0x47d697(++_0x382994);}(_0x22ed,0x1a9));var _0xd22e=function(_0x2c0854,_0x2844af){_0x2c0854=_0x2c0854-0x0;var _0x52b94d=_0x22ed[_0x2c0854];return _0x52b94d;};'use strict';var EventEmitter=require(_0xd22e('0x0'));var Plugin=require(_0xd22e('0x1'))['db'][_0xd22e('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xd22e('0x3')](0x0);var events={'afterCreate':_0xd22e('0x4'),'afterUpdate':_0xd22e('0x5'),'afterDestroy':_0xd22e('0x6')};function emitEvent(_0x10244b){return function(_0x3a1306,_0x214c17,_0x3c4894){PluginEvents[_0xd22e('0x7')](_0x10244b+':'+_0x3a1306['id'],_0x3a1306);PluginEvents['emit'](_0x10244b,_0x3a1306);_0x3c4894(null);};}for(var e in events){if(events[_0xd22e('0x8')](e)){var event=events[e];Plugin[_0xd22e('0x9')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 557b36c..1ddd688 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 _0x8994=['../../config/environment','exports','define','Plugin','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x39efd5,_0x374e8c){var _0x514f37=function(_0x53cc51){while(--_0x53cc51){_0x39efd5['push'](_0x39efd5['shift']());}};_0x514f37(++_0x374e8c);}(_0x8994,0x16f));var _0x4899=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0x8994[_0x474bc0];return _0x4b24cf;};'use strict';var _=require(_0x4899('0x0'));var util=require(_0x4899('0x1'));var logger=require(_0x4899('0x2'))(_0x4899('0x3'));var moment=require('moment');var BPromise=require(_0x4899('0x4'));var rp=require(_0x4899('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4899('0x6'));var config=require(_0x4899('0x7'));var attributes=require('./plugin.attributes');module[_0x4899('0x8')]=function(_0x1ae947,_0xd8f787){return _0x1ae947[_0x4899('0x9')](_0x4899('0xa'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4f5d=['define','Plugin','plugins','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./plugin.attributes','exports'];(function(_0x14077a,_0x2d985d){var _0x5b5de7=function(_0x5805e6){while(--_0x5805e6){_0x14077a['push'](_0x14077a['shift']());}};_0x5b5de7(++_0x2d985d);}(_0x4f5d,0x1d1));var _0xd4f5=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x4f5d[_0x18ab2a];return _0x16dcee;};'use strict';var _=require(_0xd4f5('0x0'));var util=require(_0xd4f5('0x1'));var logger=require(_0xd4f5('0x2'))(_0xd4f5('0x3'));var moment=require(_0xd4f5('0x4'));var BPromise=require(_0xd4f5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd4f5('0x6'));var rimraf=require(_0xd4f5('0x7'));var config=require(_0xd4f5('0x8'));var attributes=require(_0xd4f5('0x9'));module[_0xd4f5('0xa')]=function(_0x2c44bb,_0x121bfd){return _0x2c44bb[_0xd4f5('0xb')](_0xd4f5('0xc'),attributes,{'tableName':_0xd4f5('0xd'),'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 d8f6427..b250c8c 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 _0x8ac0=['moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreatePlugin','create','options','raw','catch','lodash','util'];(function(_0x1c8abb,_0x4fe2f9){var _0x58eb71=function(_0x5ee26a){while(--_0x5ee26a){_0x1c8abb['push'](_0x1c8abb['shift']());}};_0x58eb71(++_0x4fe2f9);}(_0x8ac0,0x9e));var _0x08ac=function(_0x483bff,_0x16d0d7){_0x483bff=_0x483bff-0x0;var _0x4e971f=_0x8ac0[_0x483bff];return _0x4e971f;};'use strict';var _=require(_0x08ac('0x0'));var util=require(_0x08ac('0x1'));var moment=require(_0x08ac('0x2'));var BPromise=require(_0x08ac('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x08ac('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x08ac('0x5'))(_0x08ac('0x6'));var config=require(_0x08ac('0x7'));var jayson=require(_0x08ac('0x8'));var client=jayson[_0x08ac('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x08ac('0xa')],{'host':_0x08ac('0xb'),'port':0x18eb});var socket=require(_0x08ac('0xc'))(new Redis(config['redis']));require(_0x08ac('0xd'))[_0x08ac('0xe')](socket);function respondWithRpcPromise(_0x1b2d4f,_0x2a2c35,_0x18ff8d){return new BPromise(function(_0xb0717e,_0x437e18){return client[_0x08ac('0xf')](_0x1b2d4f,_0x18ff8d)[_0x08ac('0x10')](function(_0x1595e5){logger[_0x08ac('0x11')](_0x08ac('0x12'),_0x2a2c35,_0x08ac('0x13'));logger[_0x08ac('0x14')](_0x08ac('0x15'),_0x2a2c35,_0x08ac('0x13'),JSON[_0x08ac('0x16')](_0x1595e5));if(_0x1595e5[_0x08ac('0x17')]){if(_0x1595e5['error'][_0x08ac('0x18')]===0x1f4){logger[_0x08ac('0x17')]('Plugin,\x20%s,\x20%s',_0x2a2c35,_0x1595e5[_0x08ac('0x17')]['message']);return _0x437e18(_0x1595e5[_0x08ac('0x17')][_0x08ac('0x19')]);}logger[_0x08ac('0x17')]('Plugin,\x20%s,\x20%s',_0x2a2c35,_0x1595e5[_0x08ac('0x17')][_0x08ac('0x19')]);return _0xb0717e(_0x1595e5[_0x08ac('0x17')][_0x08ac('0x19')]);}else{logger['info'](_0x08ac('0x12'),_0x2a2c35,'request\x20sent');_0xb0717e(_0x1595e5[_0x08ac('0x1a')]['message']);}})['catch'](function(_0xaf52c3){logger[_0x08ac('0x17')](_0x08ac('0x12'),_0x2a2c35,_0xaf52c3);_0x437e18(_0xaf52c3);});});}exports[_0x08ac('0x1b')]=function(_0xe01e5f){var _0xa13a64=this;return new Promise(function(_0x51b2e9,_0x32761b){return db['Plugin'][_0x08ac('0x1c')](_0xe01e5f['body'],{'raw':_0xe01e5f['options']?_0xe01e5f[_0x08ac('0x1d')][_0x08ac('0x1e')]===undefined?!![]:![]:!![]})[_0x08ac('0x10')](function(_0x47d56a){logger[_0x08ac('0x11')](_0x08ac('0x1b'),_0xe01e5f);logger['debug']('CreatePlugin',_0xe01e5f,JSON['stringify'](_0x47d56a));_0x51b2e9(_0x47d56a);})[_0x08ac('0x1f')](function(_0x55c9d8){logger[_0x08ac('0x17')](_0x08ac('0x1b'),_0x55c9d8[_0x08ac('0x19')],_0xe01e5f);_0x32761b(_0xa13a64[_0x08ac('0x17')](0x1f4,_0x55c9d8[_0x08ac('0x19')]));});});}; \ No newline at end of file +var _0x051b=['request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','message','result','CreatePlugin','Plugin','body','options','raw','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register'];(function(_0x44a6a2,_0x2584f3){var _0x2f8540=function(_0x52027f){while(--_0x52027f){_0x44a6a2['push'](_0x44a6a2['shift']());}};_0x2f8540(++_0x2584f3);}(_0x051b,0x14c));var _0xb051=function(_0x3860cf,_0x4f742a){_0x3860cf=_0x3860cf-0x0;var _0x2a3b0e=_0x051b[_0x3860cf];return _0x2a3b0e;};'use strict';var _=require(_0xb051('0x0'));var util=require(_0xb051('0x1'));var moment=require(_0xb051('0x2'));var BPromise=require(_0xb051('0x3'));var rs=require(_0xb051('0x4'));var fs=require('fs');var Redis=require(_0xb051('0x5'));var db=require(_0xb051('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb051('0x7'))(_0xb051('0x8'));var config=require(_0xb051('0x9'));var jayson=require(_0xb051('0xa'));var client=jayson[_0xb051('0xb')]['http']({'port':0x232a});config[_0xb051('0xc')]=_[_0xb051('0xd')](config[_0xb051('0xc')],{'host':_0xb051('0xe'),'port':0x18eb});var socket=require(_0xb051('0xf'))(new Redis(config[_0xb051('0xc')]));require(_0xb051('0x10'))[_0xb051('0x11')](socket);function respondWithRpcPromise(_0x322db2,_0x46cb90,_0x7573e9){return new BPromise(function(_0x36bffa,_0x4c3976){return client[_0xb051('0x12')](_0x322db2,_0x7573e9)[_0xb051('0x13')](function(_0x3defc4){logger[_0xb051('0x14')](_0xb051('0x15'),_0x46cb90,_0xb051('0x16'));logger[_0xb051('0x17')](_0xb051('0x18'),_0x46cb90,_0xb051('0x16'),JSON['stringify'](_0x3defc4));if(_0x3defc4['error']){if(_0x3defc4[_0xb051('0x19')]['code']===0x1f4){logger[_0xb051('0x19')]('Plugin,\x20%s,\x20%s',_0x46cb90,_0x3defc4[_0xb051('0x19')]['message']);return _0x4c3976(_0x3defc4[_0xb051('0x19')][_0xb051('0x1a')]);}logger['error'](_0xb051('0x15'),_0x46cb90,_0x3defc4[_0xb051('0x19')][_0xb051('0x1a')]);return _0x36bffa(_0x3defc4['error'][_0xb051('0x1a')]);}else{logger[_0xb051('0x14')](_0xb051('0x15'),_0x46cb90,_0xb051('0x16'));_0x36bffa(_0x3defc4[_0xb051('0x1b')]['message']);}})['catch'](function(_0x38b1a5){logger[_0xb051('0x19')](_0xb051('0x15'),_0x46cb90,_0x38b1a5);_0x4c3976(_0x38b1a5);});});}exports[_0xb051('0x1c')]=function(_0x28000e){var _0x562728=this;return new Promise(function(_0x4e4b8a,_0x534965){return db[_0xb051('0x1d')]['create'](_0x28000e[_0xb051('0x1e')],{'raw':_0x28000e['options']?_0x28000e[_0xb051('0x1f')][_0xb051('0x20')]===undefined?!![]:![]:!![]})[_0xb051('0x13')](function(_0x10fc68){logger[_0xb051('0x14')](_0xb051('0x1c'),_0x28000e);logger[_0xb051('0x17')](_0xb051('0x1c'),_0x28000e,JSON[_0xb051('0x21')](_0x10fc68));_0x4e4b8a(_0x10fc68);})[_0xb051('0x22')](function(_0xa47723){logger[_0xb051('0x19')](_0xb051('0x1c'),_0xa47723['message'],_0x28000e);_0x534965(_0x562728[_0xb051('0x19')](0x1f4,_0xa47723[_0xb051('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index ee262af..5475a9b 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 _0xb349=['removeListener','length','plugin:','./plugin.events','remove','update','emit'];(function(_0x1b6a83,_0x56c08d){var _0x1bf266=function(_0x4eed19){while(--_0x4eed19){_0x1b6a83['push'](_0x1b6a83['shift']());}};_0x1bf266(++_0x56c08d);}(_0xb349,0x1a7));var _0x9b34=function(_0x323708,_0x57c2e9){_0x323708=_0x323708-0x0;var _0x551f52=_0xb349[_0x323708];return _0x551f52;};'use strict';var PluginEvents=require(_0x9b34('0x0'));var events=['save',_0x9b34('0x1'),_0x9b34('0x2')];function createListener(_0x427b00,_0xb518ee){return function(_0x5787bd){_0xb518ee[_0x9b34('0x3')](_0x427b00,_0x5787bd);};}function removeListener(_0x2e7b6a,_0x341ccb){return function(){PluginEvents[_0x9b34('0x4')](_0x2e7b6a,_0x341ccb);};}exports['register']=function(_0x38558f){for(var _0x2ca756=0x0,_0x12f98c=events[_0x9b34('0x5')];_0x2ca756<_0x12f98c;_0x2ca756++){var _0x439c05=events[_0x2ca756];var _0x210f9a=createListener(_0x9b34('0x6')+_0x439c05,_0x38558f);PluginEvents['on'](_0x439c05,_0x210f9a);}}; \ No newline at end of file +var _0x0388=['save','remove','update','emit','removeListener','register','length','plugin:','./plugin.events'];(function(_0x4e77e0,_0x2a8374){var _0x10ed26=function(_0x200533){while(--_0x200533){_0x4e77e0['push'](_0x4e77e0['shift']());}};_0x10ed26(++_0x2a8374);}(_0x0388,0x11f));var _0x8038=function(_0x4b5db1,_0x725d15){_0x4b5db1=_0x4b5db1-0x0;var _0x4e9793=_0x0388[_0x4b5db1];return _0x4e9793;};'use strict';var PluginEvents=require(_0x8038('0x0'));var events=[_0x8038('0x1'),_0x8038('0x2'),_0x8038('0x3')];function createListener(_0x25140d,_0x3c2989){return function(_0x2ebe2f){_0x3c2989[_0x8038('0x4')](_0x25140d,_0x2ebe2f);};}function removeListener(_0x5609b0,_0x6028c7){return function(){PluginEvents[_0x8038('0x5')](_0x5609b0,_0x6028c7);};}exports[_0x8038('0x6')]=function(_0x17dc46){for(var _0x134868=0x0,_0x13c5d1=events[_0x8038('0x7')];_0x134868<_0x13c5d1;_0x134868++){var _0x54f0a1=events[_0x134868];var _0x27e613=createListener(_0x8038('0x8')+_0x54f0a1,_0x17dc46);PluginEvents['on'](_0x54f0a1,_0x27e613);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index b8fa53f..3a29875 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(_0x1c9459,_0x538ed1){var _0x3b6d03=function(_0x2a05cf){while(--_0x2a05cf){_0x1c9459['push'](_0x1c9459['shift']());}};_0x3b6d03(++_0x538ed1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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(_0x14c9d4,_0x44319b){var _0x1f696e=function(_0x241799){while(--_0x241799){_0x14c9d4['push'](_0x14c9d4['shift']());}};_0x1f696e(++_0x44319b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index e938d69..43c4b53 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 _0x702d=['../../config/pm2','../../config/logger','api','path','exec','bluebird','sendStatus','status','error','stack','name','send','npm\x20install','info','index','list','then','reject','express','motion2','length','catch','show','params','create','body','join','../../files/plugins','script','cwd','chdir','start','dump','Missing\x20name\x20and/or\x20path','restart','stop','hasOwnProperty','destroy','delete','Unknown\x20id','lodash'];(function(_0x2fbd0e,_0x3460a9){var _0x481c9f=function(_0x4bc402){while(--_0x4bc402){_0x2fbd0e['push'](_0x2fbd0e['shift']());}};_0x481c9f(++_0x3460a9);}(_0x702d,0x147));var _0xd702=function(_0x1535b3,_0x2660a6){_0x1535b3=_0x1535b3-0x0;var _0x150da3=_0x702d[_0x1535b3];return _0x150da3;};'use strict';var _=require(_0xd702('0x0'));var pm2=require(_0xd702('0x1'));var logger=require(_0xd702('0x2'))(_0xd702('0x3'));var path=require(_0xd702('0x4'));var exec=require('child_process')[_0xd702('0x5')];var BPromise=require(_0xd702('0x6'));function handleEntityNotFound(_0x27b260,_0x1c5a32){return function(_0x481ee0){if(!_0x481ee0){_0x27b260[_0xd702('0x7')](0x194);;}return _0x481ee0;};}function respondWithResult(_0x544e94,_0x1aecfc){_0x1aecfc=_0x1aecfc||0xc8;return function(_0x3a2c03){if(_0x3a2c03){return _0x544e94[_0xd702('0x8')](_0x1aecfc)['json'](_0x3a2c03);}return null;};}function handleError(_0x12bb75,_0x53bd02){_0x53bd02=_0x53bd02||0x1f4;return function(_0x39c49e){logger[_0xd702('0x9')](_0x39c49e[_0xd702('0xa')]);if(_0x39c49e[_0xd702('0xb')]){delete _0x39c49e[_0xd702('0xb')];}_0x12bb75[_0xd702('0x8')](_0x53bd02)[_0xd702('0xc')](_0x39c49e);};}function execChildProcess(){return new BPromise(function(_0x1988eb,_0x5907cf){exec(_0xd702('0xd'),function(_0x58805a,_0x4a3439,_0x3e9439){logger[_0xd702('0xe')](_0x4a3439);logger[_0xd702('0xe')](_0x3e9439);if(_0x58805a){logger['error'](_0x58805a);return _0x5907cf(_0x58805a);}return _0x1988eb(_0x4a3439);});});}exports[_0xd702('0xf')]=function(_0x128add,_0x1ed8a3){return pm2[_0xd702('0x10')]()[_0xd702('0x11')](function(_0x181ff2){if(_0x181ff2){var _0x59dd33=_[_0xd702('0x12')](_0x181ff2,function(_0x3ea0ab){return _0x3ea0ab['name']===_0xd702('0x13')||_0x3ea0ab['name']===_0xd702('0x14');});return{'rows':_0x59dd33,'count':_0x59dd33[_0xd702('0x15')]};}return null;})['then'](respondWithResult(_0x1ed8a3,null))[_0xd702('0x16')](handleError(_0x1ed8a3,null));};exports[_0xd702('0x17')]=function(_0x2a87f2,_0x4fdbbd){return pm2['describe'](_0x2a87f2[_0xd702('0x18')]['id'])['then'](respondWithResult(_0x4fdbbd,null))[_0xd702('0x11')](handleEntityNotFound(_0x4fdbbd,null))[_0xd702('0x16')](handleError(_0x4fdbbd,null));};exports[_0xd702('0x19')]=function(_0x265b1b,_0x4cf326){if(_0x265b1b[_0xd702('0x1a')][_0xd702('0xb')]&&_0x265b1b['body']['script']){var _0x536ca8=path[_0xd702('0x1b')](__dirname,_0xd702('0x1c'),_0x265b1b['body'][_0xd702('0x1d')]);var _0x5d91fd=process[_0xd702('0x1e')]();process['chdir'](path['dirname'](_0x536ca8));return execChildProcess()['then'](function(_0x21c00e){process[_0xd702('0x1f')](_0x5d91fd);return pm2[_0xd702('0x20')]({'name':_0x265b1b['body'][_0xd702('0xb')],'script':_0x536ca8});})[_0xd702('0x11')](function(_0x10599a){pm2[_0xd702('0x21')]();return _0x10599a[0x0];})[_0xd702('0x11')](respondWithResult(_0x4cf326,0xc9))[_0xd702('0x16')](handleError(_0x4cf326,null));}else{return _0x4cf326[_0xd702('0x8')](0x1f4)[_0xd702('0xc')]({'message':_0xd702('0x22')});}};exports['update']=function(_0x116b2f,_0x322cb8){if(_0x116b2f[_0xd702('0x1a')]['id']){delete _0x116b2f[_0xd702('0x1a')]['id'];}var _0xbe4518={'online':_0xd702('0x23'),'stopped':_0xd702('0x24')};if(_0xbe4518[_0xd702('0x25')](_0x116b2f['body']['status'])){return pm2[_0xbe4518[_0x116b2f[_0xd702('0x1a')][_0xd702('0x8')]]](_0x116b2f['params']['id'])[_0xd702('0x11')](respondWithResult(_0x322cb8,0xc8))[_0xd702('0x16')](handleError(_0x322cb8,null));}else{return _0x322cb8[_0xd702('0x8')](0x1f4)[_0xd702('0xc')]({'message':'Unknown\x20status'});}};exports[_0xd702('0x26')]=function(_0x313281,_0x1630ed){if(_0x313281[_0xd702('0x1a')]['id']){delete _0x313281[_0xd702('0x1a')]['id'];}if(_0x313281['params']['id']){return pm2[_0xd702('0x27')](_0x313281[_0xd702('0x18')]['id'])[_0xd702('0x11')](function(_0x5abfea){pm2[_0xd702('0x21')]();return _0x5abfea[0x0];})['then'](respondWithResult(_0x1630ed,null))['catch'](handleError(_0x1630ed,null));}else{return _0x1630ed[_0xd702('0x8')](0x1f4)[_0xd702('0xc')]({'message':_0xd702('0x28')});}}; \ No newline at end of file +var _0x2f68=['dump','Unknown\x20id','../../config/pm2','../../config/logger','api','path','exec','sendStatus','status','error','name','send','npm\x20install','info','index','list','then','reject','express','motion2','length','catch','show','describe','params','create','body','join','../../files/plugins','chdir','dirname','start','Missing\x20name\x20and/or\x20path','restart','stop','Unknown\x20status','destroy','delete'];(function(_0x53884d,_0x48715c){var _0x2ae3dd=function(_0x256da8){while(--_0x256da8){_0x53884d['push'](_0x53884d['shift']());}};_0x2ae3dd(++_0x48715c);}(_0x2f68,0x9a));var _0x82f6=function(_0x56114e,_0x2e104a){_0x56114e=_0x56114e-0x0;var _0x424f16=_0x2f68[_0x56114e];return _0x424f16;};'use strict';var _=require('lodash');var pm2=require(_0x82f6('0x0'));var logger=require(_0x82f6('0x1'))(_0x82f6('0x2'));var path=require(_0x82f6('0x3'));var exec=require('child_process')[_0x82f6('0x4')];var BPromise=require('bluebird');function handleEntityNotFound(_0x2a06dc,_0x2ab73d){return function(_0x5dad09){if(!_0x5dad09){_0x2a06dc[_0x82f6('0x5')](0x194);;}return _0x5dad09;};}function respondWithResult(_0x2c4302,_0x542737){_0x542737=_0x542737||0xc8;return function(_0x5a8089){if(_0x5a8089){return _0x2c4302[_0x82f6('0x6')](_0x542737)['json'](_0x5a8089);}return null;};}function handleError(_0x5daa3c,_0x864400){_0x864400=_0x864400||0x1f4;return function(_0xbd30d5){logger[_0x82f6('0x7')](_0xbd30d5['stack']);if(_0xbd30d5[_0x82f6('0x8')]){delete _0xbd30d5[_0x82f6('0x8')];}_0x5daa3c['status'](_0x864400)[_0x82f6('0x9')](_0xbd30d5);};}function execChildProcess(){return new BPromise(function(_0x1eec2f,_0x3f8320){exec(_0x82f6('0xa'),function(_0x1a68c4,_0x34bd7c,_0x4c870e){logger[_0x82f6('0xb')](_0x34bd7c);logger[_0x82f6('0xb')](_0x4c870e);if(_0x1a68c4){logger['error'](_0x1a68c4);return _0x3f8320(_0x1a68c4);}return _0x1eec2f(_0x34bd7c);});});}exports[_0x82f6('0xc')]=function(_0x1f8bf5,_0x397527){return pm2[_0x82f6('0xd')]()[_0x82f6('0xe')](function(_0xa00275){if(_0xa00275){var _0x115c7b=_[_0x82f6('0xf')](_0xa00275,function(_0x1e7cbc){return _0x1e7cbc['name']===_0x82f6('0x10')||_0x1e7cbc['name']===_0x82f6('0x11');});return{'rows':_0x115c7b,'count':_0x115c7b[_0x82f6('0x12')]};}return null;})[_0x82f6('0xe')](respondWithResult(_0x397527,null))[_0x82f6('0x13')](handleError(_0x397527,null));};exports[_0x82f6('0x14')]=function(_0x2326ae,_0x326378){return pm2[_0x82f6('0x15')](_0x2326ae[_0x82f6('0x16')]['id'])[_0x82f6('0xe')](respondWithResult(_0x326378,null))[_0x82f6('0xe')](handleEntityNotFound(_0x326378,null))[_0x82f6('0x13')](handleError(_0x326378,null));};exports[_0x82f6('0x17')]=function(_0x4fe226,_0x3a8269){if(_0x4fe226['body'][_0x82f6('0x8')]&&_0x4fe226[_0x82f6('0x18')]['script']){var _0x2b03ad=path[_0x82f6('0x19')](__dirname,_0x82f6('0x1a'),_0x4fe226[_0x82f6('0x18')]['script']);var _0xdc4dea=process['cwd']();process[_0x82f6('0x1b')](path[_0x82f6('0x1c')](_0x2b03ad));return execChildProcess()['then'](function(_0x516deb){process[_0x82f6('0x1b')](_0xdc4dea);return pm2[_0x82f6('0x1d')]({'name':_0x4fe226['body']['name'],'script':_0x2b03ad});})[_0x82f6('0xe')](function(_0x31face){pm2['dump']();return _0x31face[0x0];})[_0x82f6('0xe')](respondWithResult(_0x3a8269,0xc9))[_0x82f6('0x13')](handleError(_0x3a8269,null));}else{return _0x3a8269['status'](0x1f4)['send']({'message':_0x82f6('0x1e')});}};exports['update']=function(_0x469b6b,_0x5a6d69){if(_0x469b6b['body']['id']){delete _0x469b6b[_0x82f6('0x18')]['id'];}var _0x15c9b7={'online':_0x82f6('0x1f'),'stopped':_0x82f6('0x20')};if(_0x15c9b7['hasOwnProperty'](_0x469b6b[_0x82f6('0x18')][_0x82f6('0x6')])){return pm2[_0x15c9b7[_0x469b6b[_0x82f6('0x18')][_0x82f6('0x6')]]](_0x469b6b[_0x82f6('0x16')]['id'])[_0x82f6('0xe')](respondWithResult(_0x5a6d69,0xc8))[_0x82f6('0x13')](handleError(_0x5a6d69,null));}else{return _0x5a6d69[_0x82f6('0x6')](0x1f4)[_0x82f6('0x9')]({'message':_0x82f6('0x21')});}};exports[_0x82f6('0x22')]=function(_0x20d1c5,_0x6ce179){if(_0x20d1c5[_0x82f6('0x18')]['id']){delete _0x20d1c5['body']['id'];}if(_0x20d1c5[_0x82f6('0x16')]['id']){return pm2[_0x82f6('0x23')](_0x20d1c5[_0x82f6('0x16')]['id'])['then'](function(_0x36f37a){pm2[_0x82f6('0x24')]();return _0x36f37a[0x0];})[_0x82f6('0xe')](respondWithResult(_0x6ce179,null))[_0x82f6('0x13')](handleError(_0x6ce179,null));}else{return _0x6ce179[_0x82f6('0x6')](0x1f4)[_0x82f6('0x9')]({'message':_0x82f6('0x25')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 789cbde..498337a 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 _0x9bbb=['isAuthenticated','getAgents','/queues','getQueues','exports','express','Router','../../components/auth/service','./realtime.controller','get','/agents'];(function(_0x5b4431,_0x66eaec){var _0x479e92=function(_0x392d1a){while(--_0x392d1a){_0x5b4431['push'](_0x5b4431['shift']());}};_0x479e92(++_0x66eaec);}(_0x9bbb,0x170));var _0xb9bb=function(_0xc40664,_0xe11845){_0xc40664=_0xc40664-0x0;var _0x5b86dd=_0x9bbb[_0xc40664];return _0x5b86dd;};'use strict';var express=require(_0xb9bb('0x0'));var router=express[_0xb9bb('0x1')]();var auth=require(_0xb9bb('0x2'));var controller=require(_0xb9bb('0x3'));router[_0xb9bb('0x4')](_0xb9bb('0x5'),auth[_0xb9bb('0x6')](),controller[_0xb9bb('0x7')]);router['get'](_0xb9bb('0x8'),auth['isAuthenticated'](),controller[_0xb9bb('0x9')]);module[_0xb9bb('0xa')]=router; \ No newline at end of file +var _0x824a=['Router','/agents','isAuthenticated','getAgents','get','/queues'];(function(_0x355e5d,_0x4b1a06){var _0x72c1d0=function(_0x4a9bea){while(--_0x4a9bea){_0x355e5d['push'](_0x355e5d['shift']());}};_0x72c1d0(++_0x4b1a06);}(_0x824a,0x1aa));var _0xa824=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x824a[_0x19950b];return _0x3c6b41;};'use strict';var express=require('express');var router=express[_0xa824('0x0')]();var auth=require('../../components/auth/service');var controller=require('./realtime.controller');router['get'](_0xa824('0x1'),auth[_0xa824('0x2')](),controller[_0xa824('0x3')]);router[_0xa824('0x4')](_0xa824('0x5'),auth[_0xa824('0x2')](),controller['getQueues']);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 7a2283e..1d252e4 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 _0xe1e1=['getRealtimeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../mysqldb','../../errors/api','APIBadRequestError','offset','limit','undefined','count','set','Content-Range','json','getChannels','query','pauseTypeFilter','*pause','resolve','then','isValidChannel','channel','format','Channel\x20parameter\x20%s\x20is\x20invalid','sort','includes','globalStatus','fields','join','getAgentIdsByQueues','rows','getSortedAgentsIdsByStatus','length','map','User','key','role','getOptions','raw','push','literal','FIELD(id,','order','forEach','Pause','where','merge','user','Agents','agent','online','assign','UserProfile','getResources','findAndCountAll','filterAgentAttributes','pause','voice','voiceStatus','talking','Status','getRealtimeAgentsQueryFields','pick','catch','getQueues','toLowerCase','startCase','fieldName','type','name','dialActive','userProfileId','Queues'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xe1e1,0xe2));var _0x1e1e=function(_0x24cea3,_0x463f04){_0x24cea3=_0x24cea3-0x0;var _0x3dc9f7=_0xe1e1[_0x24cea3];return _0x3dc9f7;};'use strict';var _=require(_0x1e1e('0x0'));var util=require(_0x1e1e('0x1'));var rta=require(_0x1e1e('0x2'));var rtq=require(_0x1e1e('0x3'));var qs=require(_0x1e1e('0x4'));var utils=require('../../config/utils');var db=require(_0x1e1e('0x5'))['db'];var APIBadRequestError=require(_0x1e1e('0x6'))[_0x1e1e('0x7')];var APIHandleError=require(_0x1e1e('0x6'))['handleError'];function respondWithFilteredResult(_0x435f02,_0x5b63a5){return function(_0x387641){if(_0x387641){var _0xf8ec18=typeof _0x5b63a5[_0x1e1e('0x8')]==='undefined'&&typeof _0x5b63a5[_0x1e1e('0x9')]===_0x1e1e('0xa');var _0xa1949a=_0x387641['count'];var _0x20a474=_0xf8ec18?0x0:_0x5b63a5[_0x1e1e('0x8')];var _0x38878c=_0xf8ec18?_0x387641[_0x1e1e('0xb')]:_0x5b63a5[_0x1e1e('0x8')]+_0x5b63a5['limit'];var _0x5446a4;if(_0x38878c>=_0xa1949a){_0x38878c=_0xa1949a;_0x5446a4=0xc8;}else{_0x5446a4=0xce;}_0x435f02['status'](_0x5446a4);return _0x435f02[_0x1e1e('0xc')](_0x1e1e('0xd'),_0x20a474+'-'+_0x38878c+'/'+_0xa1949a)[_0x1e1e('0xe')](_0x387641);}return null;};}exports['getAgents']=function(_0x18b143,_0x3e9149){var _0x11d471={'count':0x0,'rows':[]};var _0x2e5473={};var _0x498709;var _0x259ba9=utils[_0x1e1e('0xf')]();var _0x3db912;var _0x1c0db9;var _0x882724=_0x18b143[_0x1e1e('0x10')]['globalQueueFilter'];var _0x17ca4b=_0x18b143[_0x1e1e('0x10')]['globalStatusFilter'];var _0x101f0c=_0x18b143[_0x1e1e('0x10')][_0x1e1e('0x11')];var _0x35b2d6=_0x17ca4b==='pause'||_0x17ca4b===_0x1e1e('0x12')?!![]:![];var _0x2fb21e=[];var _0x1065d0;var _0x425b49;Promise[_0x1e1e('0x13')]()[_0x1e1e('0x14')](function(){if(_0x18b143['query']['channel']){if(!utils[_0x1e1e('0x15')](_0x18b143[_0x1e1e('0x10')][_0x1e1e('0x16')])){throw new APIBadRequestError(util[_0x1e1e('0x17')](_0x1e1e('0x18'),_0x18b143[_0x1e1e('0x10')][_0x1e1e('0x16')]));}_0x498709=_0x18b143['query']['channel']['toLowerCase']();}if(!_0x18b143[_0x1e1e('0x10')]['sort']||!_0x18b143[_0x1e1e('0x10')][_0x1e1e('0x19')][_0x1e1e('0x1a')](_0x1e1e('0x1b'))){_0x18b143[_0x1e1e('0x10')][_0x1e1e('0x19')]=rta['validateSortParameter'](_0x18b143['query']['sort']);return;}var _0x3bd777=rta['getUpdatedSortOptions'](_0x18b143['query'][_0x1e1e('0x19')]);_0x18b143[_0x1e1e('0x10')][_0x1e1e('0x19')]=_0x3bd777[_0x1e1e('0x1c')][_0x1e1e('0x1d')](',');_0x1065d0=_0x3bd777['order'];})[_0x1e1e('0x14')](function(){if(!_0x882724){return[];}return rta[_0x1e1e('0x1e')](_0x882724,_0x498709);})[_0x1e1e('0x14')](function(_0x540318){_0x2fb21e=_0x540318;return rta['getRealtimeAgents']();})[_0x1e1e('0x14')](function(_0x26d41b){_0x1c0db9=_0x26d41b[_0x1e1e('0x1f')];if((!_0x17ca4b||_0x35b2d6)&&!_0x1065d0){return _0x2fb21e;}if(_0x1065d0&&!_0x17ca4b){return rta[_0x1e1e('0x20')](_0x1c0db9,_0x2fb21e,_0x1065d0);}else{return rta['getAgentIdsByStatus'](_0x1c0db9,_0x2fb21e,_0x17ca4b);}})[_0x1e1e('0x14')](function(_0xdc93d1){_0x2fb21e=_0xdc93d1;var _0x19b171=![];if(_0x2fb21e[_0x1e1e('0x21')]===0x0){if(_0x882724||_0x17ca4b){_0x19b171=!![];}if(_0x35b2d6){_0x19b171=![];}}if(_0x19b171){return _0x11d471;}var _0x1d83be=_[_0x1e1e('0x22')](db[_0x1e1e('0x23')]['rawAttributes'],function(_0xe0d385){return{'name':_0xe0d385['fieldName'],'type':_0xe0d385['type'][_0x1e1e('0x24')]};});_0x18b143[_0x1e1e('0x10')][_0x1e1e('0x25')]='agent';_0x2e5473=qs[_0x1e1e('0x26')](_0x1d83be,_0x18b143);_0x2e5473[_0x1e1e('0x27')]=!![];var _0x128779=[];if(_0x2fb21e['length']>0x0){_0x128779[_0x1e1e('0x28')]({'id':{'$in':_0x2fb21e}});if(_0x1065d0&&!_0x17ca4b){_0x425b49=[db['sequelize'][_0x1e1e('0x29')](_0x1e1e('0x2a')+_0x2fb21e+')')];_0x2e5473[_0x1e1e('0x2b')]=_0x425b49;}}if(_0x35b2d6){_0x259ba9[_0x1e1e('0x2c')](function(_0x4deeed){var _0x338ee2=!![];if(_0x17ca4b===_0x1e1e('0x12')&&_0x498709!==_0x4deeed){_0x338ee2=![];}_0x128779['push']({[_0x4deeed+_0x1e1e('0x2d')]:_0x338ee2});});if(_0x101f0c){_0x128779[_0x1e1e('0x28')]({'pauseType':_0x101f0c});}}else if(_0x17ca4b){_0x259ba9['forEach'](function(_0x37f550){_0x128779['push']({[_0x37f550+_0x1e1e('0x2d')]:![]});});}_0x2e5473[_0x1e1e('0x2e')]=_[_0x1e1e('0x2f')](_0x2e5473[_0x1e1e('0x2e')],{'$and':_0x128779});if(_0x18b143[_0x1e1e('0x30')][_0x1e1e('0x25')]===_0x1e1e('0x30')){var _0xf8585c={'params':{'id':_0x18b143[_0x1e1e('0x30')]['userProfileId']},'query':{'section':_0x1e1e('0x31'),'role':_0x1e1e('0x32'),'raw':!![],'ids':_0x2fb21e,'customSorting':_0x425b49}};if(_0x18b143[_0x1e1e('0x10')][_0x1e1e('0x33')]){_0xf8585c[_0x1e1e('0x10')][_0x1e1e('0x33')]=!![];}if(_0x35b2d6){_0xf8585c[_0x1e1e('0x10')]['extraQueryConditions']=_0x128779;}_0xf8585c['query']=Object[_0x1e1e('0x34')](_0xf8585c['query'],_0x18b143[_0x1e1e('0x10')]);return db[_0x1e1e('0x35')][_0x1e1e('0x36')](_0xf8585c);}return db[_0x1e1e('0x23')][_0x1e1e('0x37')](_0x2e5473);})['then'](function(_0xa9f590){_0x11d471[_0x1e1e('0xb')]=_0xa9f590[_0x1e1e('0xb')];_0x3db912=_0xa9f590[_0x1e1e('0x1f')];return _0x3db912[_0x1e1e('0x22')](function(_0x2c6d46){var _0x3e9c04=_['find'](_0x1c0db9,['id',_0x2c6d46['id']]);if(_0x3e9c04){var _0x239383=rta[_0x1e1e('0x38')](_0x3e9c04);_[_0x1e1e('0x2f')](_0x2c6d46,_0x239383);}_0x2c6d46[_0x1e1e('0x1b')]=rta['getAgentStatus'](_0x2c6d46);if(_0x2c6d46['globalStatus']['includes'](_0x1e1e('0x39'))){_0x259ba9['forEach'](function(_0x264090){if(_0x2c6d46[_0x264090+'Pause']){if(_0x264090===_0x1e1e('0x3a')){if(_0x2c6d46[_0x1e1e('0x3b')]!==_0x1e1e('0x3c')){_0x2c6d46['voiceStatus']='pause';}}else{_0x2c6d46[_0x264090+_0x1e1e('0x3d')]=_0x1e1e('0x39');}}});}return _0x2c6d46;});})['then'](function(_0x4a0435){if(!_0x1065d0||_0x425b49){return _0x4a0435;}return rta['sortAgentsByStatus'](_0x4a0435,_0x1065d0);})[_0x1e1e('0x14')](function(_0x587f32){var _0x3baffe=rta[_0x1e1e('0x3e')]();_0x11d471['rows']=_0x587f32['map'](function(_0x905c77){return _[_0x1e1e('0x3f')](_0x905c77,_0x3baffe);});return _0x11d471;})[_0x1e1e('0x14')](respondWithFilteredResult(_0x3e9149,_0x2e5473))[_0x1e1e('0x40')](APIHandleError(_0x3e9149));};exports[_0x1e1e('0x41')]=function(_0x2433ed,_0x34d135){var _0x431cb6={'count':0x0,'rows':[]};var _0x57828a={};var _0x1d91fb;var _0x484779;var _0x5d4c4a;Promise[_0x1e1e('0x13')]()[_0x1e1e('0x14')](function(){if(_0x2433ed[_0x1e1e('0x10')][_0x1e1e('0x16')]){if(!utils[_0x1e1e('0x15')](_0x2433ed[_0x1e1e('0x10')][_0x1e1e('0x16')])){throw new APIBadRequestError(util[_0x1e1e('0x17')](_0x1e1e('0x18'),_0x2433ed[_0x1e1e('0x10')][_0x1e1e('0x16')]));}_0x1d91fb=_0x2433ed[_0x1e1e('0x10')]['channel'][_0x1e1e('0x42')]();}var _0x1ca7e5=_[_0x1e1e('0x43')](_0x1d91fb)+'Queue';var _0x34c14f=_[_0x1e1e('0x22')](db[_0x1ca7e5]['rawAttributes'],function(_0xda2c4f){return{'name':_0xda2c4f[_0x1e1e('0x44')],'type':_0xda2c4f[_0x1e1e('0x45')]['key']};});if(!_0x2433ed[_0x1e1e('0x10')]['fields']){var _0x52d0bf=['id',_0x1e1e('0x46')];if(_0x1d91fb===_0x1e1e('0x3a')){_0x52d0bf['push'](_0x1e1e('0x45'));if(_0x2433ed['query'][_0x1e1e('0x45')]==='outbound'){_0x52d0bf[_0x1e1e('0x28')]([_0x1e1e('0x47'),'dialMethod']);}}_0x2433ed[_0x1e1e('0x10')][_0x1e1e('0x1c')]=_0x52d0bf['join'](',');}_0x57828a=qs[_0x1e1e('0x26')](_0x34c14f,_0x2433ed);if(_0x2433ed[_0x1e1e('0x30')]['role']===_0x1e1e('0x30')){var _0x32ddd9={'params':{'id':_0x2433ed[_0x1e1e('0x30')][_0x1e1e('0x48')]},'query':{'section':_0x1d91fb===_0x1e1e('0x3a')&&_0x2433ed[_0x1e1e('0x10')][_0x1e1e('0x45')]==='outbound'?'QueueCampaigns':_[_0x1e1e('0x43')](_0x1d91fb)+_0x1e1e('0x49'),'type':_0x2433ed['query'][_0x1e1e('0x45')],'nolimit':!![],'sort':_0x1e1e('0x46'),'filter':_0x2433ed['query']['filter']}};_0x32ddd9['query']=Object['assign'](_0x32ddd9[_0x1e1e('0x10')],_0x2433ed[_0x1e1e('0x10')]);delete _0x32ddd9[_0x1e1e('0x10')]['id'];return db['UserProfile']['getResources'](_0x32ddd9);}return db[_0x1ca7e5][_0x1e1e('0x37')](_0x57828a);})[_0x1e1e('0x14')](function(_0x550336){_0x431cb6[_0x1e1e('0xb')]=_0x550336[_0x1e1e('0xb')];_0x484779=_0x550336[_0x1e1e('0x1f')];return rtq[_0x1e1e('0x4a')](_0x2433ed,_0x1d91fb);})[_0x1e1e('0x14')](function(_0x9bfcbc){_0x5d4c4a=_0x9bfcbc[_0x1e1e('0x1f')];return rtq['initializeQueues'](_0x484779,_0x5d4c4a,_0x1d91fb,_0x2433ed[_0x1e1e('0x10')][_0x1e1e('0x45')]);})[_0x1e1e('0x14')](function(_0x2724cb){_0x431cb6[_0x1e1e('0x1f')]=_0x2724cb;return _0x431cb6;})['then'](respondWithFilteredResult(_0x34d135,_0x57828a))[_0x1e1e('0x40')](APIHandleError(_0x34d135));}; \ No newline at end of file +var _0x9639=['query','globalStatusFilter','pauseTypeFilter','*pause','isValidChannel','channel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','then','getAgentIdsByQueues','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','User','rawAttributes','type','key','role','getOptions','raw','push','sequelize','literal','FIELD(id,','forEach','Pause','where','user','userProfileId','online','extraQueryConditions','assign','UserProfile','getResources','findAndCountAll','find','filterAgentAttributes','merge','pause','voice','voiceStatus','talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','rows','catch','getQueues','resolve','startCase','Queue','name','outbound','dialActive','Queues','filter','getRealtimeQueues','initializeQueues','lodash','util','../../components/realtime/agents','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','undefined','count','status','set','Content-Range','json','getAgents','getChannels'];(function(_0x1c0991,_0x4f22d2){var _0x5034de=function(_0x520f49){while(--_0x520f49){_0x1c0991['push'](_0x1c0991['shift']());}};_0x5034de(++_0x4f22d2);}(_0x9639,0x146));var _0x9963=function(_0x561d78,_0x15720d){_0x561d78=_0x561d78-0x0;var _0x1d9831=_0x9639[_0x561d78];return _0x1d9831;};'use strict';var _=require(_0x9963('0x0'));var util=require(_0x9963('0x1'));var rta=require(_0x9963('0x2'));var rtq=require('../../components/realtime/queues');var qs=require(_0x9963('0x3'));var utils=require(_0x9963('0x4'));var db=require(_0x9963('0x5'))['db'];var APIBadRequestError=require(_0x9963('0x6'))[_0x9963('0x7')];var APIHandleError=require(_0x9963('0x6'))[_0x9963('0x8')];function respondWithFilteredResult(_0x214414,_0x51e5c0){return function(_0x3085f5){if(_0x3085f5){var _0x284199=typeof _0x51e5c0[_0x9963('0x9')]==='undefined'&&typeof _0x51e5c0['limit']===_0x9963('0xa');var _0x1560e4=_0x3085f5[_0x9963('0xb')];var _0x471c6e=_0x284199?0x0:_0x51e5c0[_0x9963('0x9')];var _0x46995f=_0x284199?_0x3085f5[_0x9963('0xb')]:_0x51e5c0[_0x9963('0x9')]+_0x51e5c0['limit'];var _0x59bf01;if(_0x46995f>=_0x1560e4){_0x46995f=_0x1560e4;_0x59bf01=0xc8;}else{_0x59bf01=0xce;}_0x214414[_0x9963('0xc')](_0x59bf01);return _0x214414[_0x9963('0xd')](_0x9963('0xe'),_0x471c6e+'-'+_0x46995f+'/'+_0x1560e4)[_0x9963('0xf')](_0x3085f5);}return null;};}exports[_0x9963('0x10')]=function(_0x236991,_0x2c4599){var _0x2958fb={'count':0x0,'rows':[]};var _0x6d6aee={};var _0x4142e2;var _0x4a7b0d=utils[_0x9963('0x11')]();var _0x1e5127;var _0x5ee4a8;var _0x1062de=_0x236991[_0x9963('0x12')]['globalQueueFilter'];var _0x1a929a=_0x236991[_0x9963('0x12')][_0x9963('0x13')];var _0x4a8143=_0x236991[_0x9963('0x12')][_0x9963('0x14')];var _0x2750c1=_0x1a929a==='pause'||_0x1a929a===_0x9963('0x15')?!![]:![];var _0x24797f=[];var _0x18ced1;var _0x5d546e;Promise['resolve']()['then'](function(){if(_0x236991[_0x9963('0x12')]['channel']){if(!utils[_0x9963('0x16')](_0x236991[_0x9963('0x12')][_0x9963('0x17')])){throw new APIBadRequestError(util[_0x9963('0x18')](_0x9963('0x19'),_0x236991[_0x9963('0x12')][_0x9963('0x17')]));}_0x4142e2=_0x236991['query'][_0x9963('0x17')][_0x9963('0x1a')]();}if(!_0x236991['query']['sort']||!_0x236991['query'][_0x9963('0x1b')][_0x9963('0x1c')](_0x9963('0x1d'))){_0x236991[_0x9963('0x12')][_0x9963('0x1b')]=rta[_0x9963('0x1e')](_0x236991[_0x9963('0x12')][_0x9963('0x1b')]);return;}var _0x1d2324=rta[_0x9963('0x1f')](_0x236991[_0x9963('0x12')][_0x9963('0x1b')]);_0x236991[_0x9963('0x12')]['sort']=_0x1d2324[_0x9963('0x20')][_0x9963('0x21')](',');_0x18ced1=_0x1d2324[_0x9963('0x22')];})[_0x9963('0x23')](function(){if(!_0x1062de){return[];}return rta[_0x9963('0x24')](_0x1062de,_0x4142e2);})['then'](function(_0x44613a){_0x24797f=_0x44613a;return rta['getRealtimeAgents']();})['then'](function(_0x4d8ef3){_0x5ee4a8=_0x4d8ef3['rows'];if((!_0x1a929a||_0x2750c1)&&!_0x18ced1){return _0x24797f;}if(_0x18ced1&&!_0x1a929a){return rta[_0x9963('0x25')](_0x5ee4a8,_0x24797f,_0x18ced1);}else{return rta[_0x9963('0x26')](_0x5ee4a8,_0x24797f,_0x1a929a);}})[_0x9963('0x23')](function(_0x390e05){_0x24797f=_0x390e05;var _0x5dcddc=![];if(_0x24797f[_0x9963('0x27')]===0x0){if(_0x1062de||_0x1a929a){_0x5dcddc=!![];}if(_0x2750c1){_0x5dcddc=![];}}if(_0x5dcddc){return _0x2958fb;}var _0x331405=_[_0x9963('0x28')](db[_0x9963('0x29')][_0x9963('0x2a')],function(_0x3db549){return{'name':_0x3db549['fieldName'],'type':_0x3db549[_0x9963('0x2b')][_0x9963('0x2c')]};});_0x236991[_0x9963('0x12')][_0x9963('0x2d')]='agent';_0x6d6aee=qs[_0x9963('0x2e')](_0x331405,_0x236991);_0x6d6aee[_0x9963('0x2f')]=!![];var _0x3416fc=[];if(_0x24797f['length']>0x0){_0x3416fc[_0x9963('0x30')]({'id':{'$in':_0x24797f}});if(_0x18ced1&&!_0x1a929a){_0x5d546e=[db[_0x9963('0x31')][_0x9963('0x32')](_0x9963('0x33')+_0x24797f+')')];_0x6d6aee[_0x9963('0x22')]=_0x5d546e;}}if(_0x2750c1){_0x4a7b0d[_0x9963('0x34')](function(_0x4a6e61){var _0x3acdca=!![];if(_0x1a929a===_0x9963('0x15')&&_0x4142e2!==_0x4a6e61){_0x3acdca=![];}_0x3416fc[_0x9963('0x30')]({[_0x4a6e61+_0x9963('0x35')]:_0x3acdca});});if(_0x4a8143){_0x3416fc[_0x9963('0x30')]({'pauseType':_0x4a8143});}}else if(_0x1a929a){_0x4a7b0d['forEach'](function(_0x4d4861){_0x3416fc[_0x9963('0x30')]({[_0x4d4861+_0x9963('0x35')]:![]});});}_0x6d6aee['where']=_['merge'](_0x6d6aee[_0x9963('0x36')],{'$and':_0x3416fc});if(_0x236991['user']['role']==='user'){var _0x14ec4c={'params':{'id':_0x236991[_0x9963('0x37')][_0x9963('0x38')]},'query':{'section':'Agents','role':'agent','raw':!![],'ids':_0x24797f,'customSorting':_0x5d546e}};if(_0x236991[_0x9963('0x12')][_0x9963('0x39')]){_0x14ec4c[_0x9963('0x12')][_0x9963('0x39')]=!![];}if(_0x2750c1){_0x14ec4c[_0x9963('0x12')][_0x9963('0x3a')]=_0x3416fc;}_0x14ec4c[_0x9963('0x12')]=Object[_0x9963('0x3b')](_0x14ec4c['query'],_0x236991[_0x9963('0x12')]);return db[_0x9963('0x3c')][_0x9963('0x3d')](_0x14ec4c);}return db[_0x9963('0x29')][_0x9963('0x3e')](_0x6d6aee);})[_0x9963('0x23')](function(_0x356bf0){_0x2958fb[_0x9963('0xb')]=_0x356bf0[_0x9963('0xb')];_0x1e5127=_0x356bf0['rows'];return _0x1e5127[_0x9963('0x28')](function(_0x16e47b){var _0x473329=_[_0x9963('0x3f')](_0x5ee4a8,['id',_0x16e47b['id']]);if(_0x473329){var _0x1d3804=rta[_0x9963('0x40')](_0x473329);_[_0x9963('0x41')](_0x16e47b,_0x1d3804);}_0x16e47b[_0x9963('0x1d')]=rta['getAgentStatus'](_0x16e47b);if(_0x16e47b[_0x9963('0x1d')]['includes'](_0x9963('0x42'))){_0x4a7b0d[_0x9963('0x34')](function(_0x4a20c6){if(_0x16e47b[_0x4a20c6+'Pause']){if(_0x4a20c6===_0x9963('0x43')){if(_0x16e47b[_0x9963('0x44')]!==_0x9963('0x45')){_0x16e47b['voiceStatus']=_0x9963('0x42');}}else{_0x16e47b[_0x4a20c6+_0x9963('0x46')]=_0x9963('0x42');}}});}return _0x16e47b;});})['then'](function(_0x5d05e9){if(!_0x18ced1||_0x5d546e){return _0x5d05e9;}return rta[_0x9963('0x47')](_0x5d05e9,_0x18ced1);})['then'](function(_0x24049a){var _0x5736b3=rta[_0x9963('0x48')]();_0x2958fb[_0x9963('0x49')]=_0x24049a[_0x9963('0x28')](function(_0x49ddfd){return _['pick'](_0x49ddfd,_0x5736b3);});return _0x2958fb;})[_0x9963('0x23')](respondWithFilteredResult(_0x2c4599,_0x6d6aee))[_0x9963('0x4a')](APIHandleError(_0x2c4599));};exports[_0x9963('0x4b')]=function(_0x5ace0b,_0x2a3a84){var _0x19be8d={'count':0x0,'rows':[]};var _0x592944={};var _0x5c6fcd;var _0x342eea;var _0x1adf8a;Promise[_0x9963('0x4c')]()[_0x9963('0x23')](function(){if(_0x5ace0b[_0x9963('0x12')]['channel']){if(!utils['isValidChannel'](_0x5ace0b[_0x9963('0x12')][_0x9963('0x17')])){throw new APIBadRequestError(util[_0x9963('0x18')](_0x9963('0x19'),_0x5ace0b[_0x9963('0x12')]['channel']));}_0x5c6fcd=_0x5ace0b['query'][_0x9963('0x17')][_0x9963('0x1a')]();}var _0x3a466d=_[_0x9963('0x4d')](_0x5c6fcd)+_0x9963('0x4e');var _0x370c37=_[_0x9963('0x28')](db[_0x3a466d]['rawAttributes'],function(_0x3e7c5d){return{'name':_0x3e7c5d['fieldName'],'type':_0x3e7c5d['type'][_0x9963('0x2c')]};});if(!_0x5ace0b[_0x9963('0x12')][_0x9963('0x20')]){var _0x135fc6=['id',_0x9963('0x4f')];if(_0x5c6fcd===_0x9963('0x43')){_0x135fc6[_0x9963('0x30')](_0x9963('0x2b'));if(_0x5ace0b[_0x9963('0x12')][_0x9963('0x2b')]===_0x9963('0x50')){_0x135fc6[_0x9963('0x30')]([_0x9963('0x51'),'dialMethod']);}}_0x5ace0b['query'][_0x9963('0x20')]=_0x135fc6['join'](',');}_0x592944=qs[_0x9963('0x2e')](_0x370c37,_0x5ace0b);if(_0x5ace0b[_0x9963('0x37')][_0x9963('0x2d')]===_0x9963('0x37')){var _0x4e1972={'params':{'id':_0x5ace0b[_0x9963('0x37')][_0x9963('0x38')]},'query':{'section':_0x5c6fcd==='voice'&&_0x5ace0b[_0x9963('0x12')][_0x9963('0x2b')]==='outbound'?'QueueCampaigns':_[_0x9963('0x4d')](_0x5c6fcd)+_0x9963('0x52'),'type':_0x5ace0b[_0x9963('0x12')][_0x9963('0x2b')],'nolimit':!![],'sort':_0x9963('0x4f'),'filter':_0x5ace0b['query'][_0x9963('0x53')]}};_0x4e1972[_0x9963('0x12')]=Object[_0x9963('0x3b')](_0x4e1972[_0x9963('0x12')],_0x5ace0b[_0x9963('0x12')]);delete _0x4e1972[_0x9963('0x12')]['id'];return db[_0x9963('0x3c')]['getResources'](_0x4e1972);}return db[_0x3a466d][_0x9963('0x3e')](_0x592944);})[_0x9963('0x23')](function(_0x3814fe){_0x19be8d[_0x9963('0xb')]=_0x3814fe[_0x9963('0xb')];_0x342eea=_0x3814fe[_0x9963('0x49')];return rtq[_0x9963('0x54')](_0x5ace0b,_0x5c6fcd);})[_0x9963('0x23')](function(_0x4dab51){_0x1adf8a=_0x4dab51[_0x9963('0x49')];return rtq[_0x9963('0x55')](_0x342eea,_0x1adf8a,_0x5c6fcd,_0x5ace0b[_0x9963('0x12')]['type']);})[_0x9963('0x23')](function(_0x3a80c2){_0x19be8d[_0x9963('0x49')]=_0x3a80c2;return _0x19be8d;})['then'](respondWithFilteredResult(_0x2a3a84,_0x592944))[_0x9963('0x4a')](APIHandleError(_0x2a3a84));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 40d670a..e4ddc86 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x39aa6c,_0x1cb0b2){var _0x5e86c5=function(_0x522f1f){while(--_0x522f1f){_0x39aa6c['push'](_0x39aa6c['shift']());}};_0x5e86c5(++_0x1cb0b2);}(_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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x5c660a,_0x4b5262){var _0x3a77a4=function(_0x479c95){while(--_0x479c95){_0x5c660a['push'](_0x5c660a['shift']());}};_0x3a77a4(++_0x4b5262);}(_0x9c44,0x178));var _0x49c4=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x9c44[_0x1caf6a];return _0x1bf493;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index b08e3c6..0678309 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 _0x1db9=['exports','INTEGER','STRING','DATE','sequelize'];(function(_0x4ccd05,_0x33ab5f){var _0xa108e6=function(_0x1f37aa){while(--_0x1f37aa){_0x4ccd05['push'](_0x4ccd05['shift']());}};_0xa108e6(++_0x33ab5f);}(_0x1db9,0x176));var _0x91db=function(_0x151a98,_0x26abd6){_0x151a98=_0x151a98-0x0;var _0x4f8374=_0x1db9[_0x151a98];return _0x4f8374;};'use strict';var Sequelize=require(_0x91db('0x0'));module[_0x91db('0x1')]={'state':{'type':Sequelize[_0x91db('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x91db('0x3')]},'scheduledat':{'type':Sequelize[_0x91db('0x4')]},'uniqueid':{'type':Sequelize[_0x91db('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x91db('0x4')]},'ringtime':{'type':Sequelize[_0x91db('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x91db('0x3')]}}; \ No newline at end of file +var _0x93bb=['exports','INTEGER','STRING','DATE','sequelize'];(function(_0x56cc28,_0x4a921e){var _0x1f5798=function(_0x45f7a5){while(--_0x45f7a5){_0x56cc28['push'](_0x56cc28['shift']());}};_0x1f5798(++_0x4a921e);}(_0x93bb,0x135));var _0xb93b=function(_0x5e5105,_0x38c58e){_0x5e5105=_0x5e5105-0x0;var _0x5e8eb2=_0x93bb[_0x5e5105];return _0x5e8eb2;};'use strict';var Sequelize=require(_0xb93b('0x0'));module[_0xb93b('0x1')]={'state':{'type':Sequelize[_0xb93b('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xb93b('0x3')]},'scheduledat':{'type':Sequelize[_0xb93b('0x4')]},'uniqueid':{'type':Sequelize[_0xb93b('0x3')]},'starttime':{'type':Sequelize[_0xb93b('0x4')]},'responsetime':{'type':Sequelize[_0xb93b('0x4')]},'ringtime':{'type':Sequelize[_0xb93b('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xb93b('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xb93b('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index a47115e..f5c7800 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 _0xcadc=['ReportAgentPreview','report_agent_preview','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports'];(function(_0x10d34b,_0x4fef76){var _0x92b0bf=function(_0x16e291){while(--_0x16e291){_0x10d34b['push'](_0x10d34b['shift']());}};_0x92b0bf(++_0x4fef76);}(_0xcadc,0x1a6));var _0xccad=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xcadc[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0xccad('0x0'));var logger=require(_0xccad('0x1'))(_0xccad('0x2'));var moment=require(_0xccad('0x3'));var BPromise=require('bluebird');var rp=require(_0xccad('0x4'));var fs=require('fs');var path=require(_0xccad('0x5'));var rimraf=require(_0xccad('0x6'));var config=require(_0xccad('0x7'));var attributes=require(_0xccad('0x8'));module[_0xccad('0x9')]=function(_0x2c853c,_0x794432){return _0x2c853c['define'](_0xccad('0xa'),attributes,{'tableName':_0xccad('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5861=['rimraf','../../config/environment','./reportAgentPreview.attributes','exports','lodash','util','../../config/logger','api','request-promise'];(function(_0x4d23dd,_0xc722e9){var _0x3005b6=function(_0x43d6b8){while(--_0x43d6b8){_0x4d23dd['push'](_0x4d23dd['shift']());}};_0x3005b6(++_0xc722e9);}(_0x5861,0xaf));var _0x1586=function(_0x516ee3,_0x2c3e16){_0x516ee3=_0x516ee3-0x0;var _0x384e5e=_0x5861[_0x516ee3];return _0x384e5e;};'use strict';var _=require(_0x1586('0x0'));var util=require(_0x1586('0x1'));var logger=require(_0x1586('0x2'))(_0x1586('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1586('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1586('0x5'));var config=require(_0x1586('0x6'));var attributes=require(_0x1586('0x7'));module[_0x1586('0x8')]=function(_0x333212,_0x35e6b9){return _0x333212['define']('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 174c404..69e80af 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 _0xda74=['moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','result','catch','CreateReportAgentPreview','create','body','raw','lodash'];(function(_0x2fd160,_0x53c0d6){var _0x5c2031=function(_0x8ecfa5){while(--_0x8ecfa5){_0x2fd160['push'](_0x2fd160['shift']());}};_0x5c2031(++_0x53c0d6);}(_0xda74,0x7c));var _0x4da7=function(_0x2c0870,_0x15ec7a){_0x2c0870=_0x2c0870-0x0;var _0x231d2d=_0xda74[_0x2c0870];return _0x231d2d;};'use strict';var _=require(_0x4da7('0x0'));var util=require('util');var moment=require(_0x4da7('0x1'));var BPromise=require('bluebird');var rs=require(_0x4da7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4da7('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4da7('0x4'))(_0x4da7('0x5'));var config=require(_0x4da7('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4da7('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18f64b,_0x2f6a93,_0x247592){return new BPromise(function(_0x5a8bf2,_0x59ade4){return client[_0x4da7('0x8')](_0x18f64b,_0x247592)[_0x4da7('0x9')](function(_0x24be31){logger[_0x4da7('0xa')]('ReportAgentPreview,\x20%s,\x20%s',_0x2f6a93,_0x4da7('0xb'));logger[_0x4da7('0xc')](_0x4da7('0xd'),_0x2f6a93,_0x4da7('0xb'),JSON[_0x4da7('0xe')](_0x24be31));if(_0x24be31[_0x4da7('0xf')]){if(_0x24be31['error'][_0x4da7('0x10')]===0x1f4){logger[_0x4da7('0xf')](_0x4da7('0x11'),_0x2f6a93,_0x24be31[_0x4da7('0xf')][_0x4da7('0x12')]);return _0x59ade4(_0x24be31[_0x4da7('0xf')]['message']);}logger[_0x4da7('0xf')](_0x4da7('0x11'),_0x2f6a93,_0x24be31[_0x4da7('0xf')][_0x4da7('0x12')]);return _0x5a8bf2(_0x24be31[_0x4da7('0xf')][_0x4da7('0x12')]);}else{logger['info'](_0x4da7('0x11'),_0x2f6a93,'request\x20sent');_0x5a8bf2(_0x24be31[_0x4da7('0x13')][_0x4da7('0x12')]);}})[_0x4da7('0x14')](function(_0x5941e0){logger[_0x4da7('0xf')](_0x4da7('0x11'),_0x2f6a93,_0x5941e0);_0x59ade4(_0x5941e0);});});}exports[_0x4da7('0x15')]=function(_0x1f5107){var _0xa241ac=this;return new Promise(function(_0x496414,_0x55208b){return db['ReportAgentPreview'][_0x4da7('0x16')](_0x1f5107[_0x4da7('0x17')],{'raw':_0x1f5107['options']?_0x1f5107['options'][_0x4da7('0x18')]===undefined?!![]:![]:!![]})[_0x4da7('0x9')](function(_0x2b5228){logger['info'](_0x4da7('0x15'),_0x1f5107);logger[_0x4da7('0xc')](_0x4da7('0x15'),_0x1f5107,JSON[_0x4da7('0xe')](_0x2b5228));_0x496414(_0x2b5228);})['catch'](function(_0x1a336a){logger[_0x4da7('0xf')]('CreateReportAgentPreview',_0x1a336a[_0x4da7('0x12')],_0x1f5107);_0x55208b(_0xa241ac[_0x4da7('0xf')](0x1f4,_0x1a336a[_0x4da7('0x12')]));});});}; \ No newline at end of file +var _0xe3ab=['rpc','../../config/environment','jayson/promise','client','http','request','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateReportAgentPreview','create','body','options','raw','debug','stringify','lodash','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x2a0220,_0x26b912){var _0x3b3ace=function(_0x43976f){while(--_0x43976f){_0x2a0220['push'](_0x2a0220['shift']());}};_0x3b3ace(++_0x26b912);}(_0xe3ab,0x8b));var _0xbe3a=function(_0x321f81,_0x3b42ad){_0x321f81=_0x321f81-0x0;var _0x222334=_0xe3ab[_0x321f81];return _0x222334;};'use strict';var _=require(_0xbe3a('0x0'));var util=require('util');var moment=require(_0xbe3a('0x1'));var BPromise=require(_0xbe3a('0x2'));var rs=require(_0xbe3a('0x3'));var fs=require('fs');var Redis=require(_0xbe3a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe3a('0x5'));var logger=require('../../config/logger')(_0xbe3a('0x6'));var config=require(_0xbe3a('0x7'));var jayson=require(_0xbe3a('0x8'));var client=jayson[_0xbe3a('0x9')][_0xbe3a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b0ca0,_0x127fb1,_0x28151d){return new BPromise(function(_0x16f31a,_0x2ce90a){return client[_0xbe3a('0xb')](_0x3b0ca0,_0x28151d)[_0xbe3a('0xc')](function(_0x4e2e89){logger['info'](_0xbe3a('0xd'),_0x127fb1,_0xbe3a('0xe'));logger['debug'](_0xbe3a('0xf'),_0x127fb1,_0xbe3a('0xe'),JSON['stringify'](_0x4e2e89));if(_0x4e2e89[_0xbe3a('0x10')]){if(_0x4e2e89['error'][_0xbe3a('0x11')]===0x1f4){logger[_0xbe3a('0x10')](_0xbe3a('0xd'),_0x127fb1,_0x4e2e89[_0xbe3a('0x10')][_0xbe3a('0x12')]);return _0x2ce90a(_0x4e2e89[_0xbe3a('0x10')][_0xbe3a('0x12')]);}logger[_0xbe3a('0x10')](_0xbe3a('0xd'),_0x127fb1,_0x4e2e89[_0xbe3a('0x10')]['message']);return _0x16f31a(_0x4e2e89[_0xbe3a('0x10')][_0xbe3a('0x12')]);}else{logger[_0xbe3a('0x13')](_0xbe3a('0xd'),_0x127fb1,_0xbe3a('0xe'));_0x16f31a(_0x4e2e89[_0xbe3a('0x14')]['message']);}})[_0xbe3a('0x15')](function(_0x670959){logger[_0xbe3a('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x127fb1,_0x670959);_0x2ce90a(_0x670959);});});}exports[_0xbe3a('0x16')]=function(_0x13bc9d){var _0x2e1963=this;return new Promise(function(_0x120c7b,_0x1ab9f9){return db['ReportAgentPreview'][_0xbe3a('0x17')](_0x13bc9d[_0xbe3a('0x18')],{'raw':_0x13bc9d['options']?_0x13bc9d[_0xbe3a('0x19')][_0xbe3a('0x1a')]===undefined?!![]:![]:!![]})[_0xbe3a('0xc')](function(_0x5e6b76){logger[_0xbe3a('0x13')](_0xbe3a('0x16'),_0x13bc9d);logger[_0xbe3a('0x1b')]('CreateReportAgentPreview',_0x13bc9d,JSON[_0xbe3a('0x1c')](_0x5e6b76));_0x120c7b(_0x5e6b76);})[_0xbe3a('0x15')](function(_0x40bf5e){logger[_0xbe3a('0x10')]('CreateReportAgentPreview',_0x40bf5e[_0xbe3a('0x12')],_0x13bc9d);_0x1ab9f9(_0x2e1963['error'](0x1f4,_0x40bf5e[_0xbe3a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index b269270..b7fd9da 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 _0xfda2=['multer','util','express','Router','./rpc.controller','get','/voice/channels','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','chatQueues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','updateVoiceQueue','outbound','/outbound/channels','outboundChannels','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','mail','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','agentNotify'];(function(_0x405838,_0xf863a9){var _0x539075=function(_0x5a6265){while(--_0x5a6265){_0x405838['push'](_0x405838['shift']());}};_0x539075(++_0xf863a9);}(_0xfda2,0x1ce));var _0x2fda=function(_0x492fe5,_0x4c6490){_0x492fe5=_0x492fe5-0x0;var _0x21020b=_0xfda2[_0x492fe5];return _0x21020b;};'use strict';var multer=require(_0x2fda('0x0'));var util=require(_0x2fda('0x1'));var path=require('path');var express=require(_0x2fda('0x2'));var router=express[_0x2fda('0x3')]();var auth=require('../../components/auth/service');var controller=require(_0x2fda('0x4'));router[_0x2fda('0x5')](_0x2fda('0x6'),auth[_0x2fda('0x7')](),controller['voiceChannels']);router[_0x2fda('0x5')](_0x2fda('0x8'),auth['isAuthenticated'](),controller['voiceChannelMixMonitor']);router[_0x2fda('0x5')](_0x2fda('0x9'),auth[_0x2fda('0x7')](),controller[_0x2fda('0xa')]);router[_0x2fda('0x5')](_0x2fda('0xb'),auth[_0x2fda('0x7')](),controller['voiceQueues']);router[_0x2fda('0x5')]('/chat/queues',auth['isAuthenticated'](),controller[_0x2fda('0xc')]);router[_0x2fda('0x5')]('/mail/queues',auth[_0x2fda('0x7')](),controller[_0x2fda('0xd')]);router['get'](_0x2fda('0xe'),auth[_0x2fda('0x7')](),controller[_0x2fda('0xf')]);router[_0x2fda('0x5')](_0x2fda('0x10'),auth['isAuthenticated'](),controller['openchannelQueues']);router[_0x2fda('0x5')](_0x2fda('0x11'),auth['isAuthenticated'](),controller[_0x2fda('0x12')]);router['get'](_0x2fda('0x13'),auth[_0x2fda('0x7')](),controller[_0x2fda('0x14')]);router[_0x2fda('0x5')](_0x2fda('0x15'),auth[_0x2fda('0x7')](),controller[_0x2fda('0x16')]);router[_0x2fda('0x5')]('/voice/queues/preview/:id',auth[_0x2fda('0x7')](),controller[_0x2fda('0x17')]);router[_0x2fda('0x5')](_0x2fda('0x18'),auth['isAuthenticated'](),controller[_0x2fda('0x19')]);router[_0x2fda('0x5')]('/voice/queues/channels/:uniqueid',auth[_0x2fda('0x7')](),controller[_0x2fda('0x1a')]);router[_0x2fda('0x5')](_0x2fda('0x1b'),auth[_0x2fda('0x7')](),controller['voiceQueuesChannelHangup']);router[_0x2fda('0x5')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x2fda('0x7')](),controller[_0x2fda('0x1c')]);router[_0x2fda('0x5')](_0x2fda('0x1d'),auth[_0x2fda('0x7')](),controller[_0x2fda('0x1e')]);router['put'](_0x2fda('0x1d'),auth[_0x2fda('0x7')](),controller[_0x2fda('0x1f')]);router['get']('/outbound',auth[_0x2fda('0x7')](),controller[_0x2fda('0x20')]);router[_0x2fda('0x5')](_0x2fda('0x21'),auth['isAuthenticated'](),controller[_0x2fda('0x22')]);router['get']('/agents',auth[_0x2fda('0x7')](),controller['agents']);router['put'](_0x2fda('0x23'),auth[_0x2fda('0x7')](),controller[_0x2fda('0x24')]);router[_0x2fda('0x5')](_0x2fda('0x25'),auth[_0x2fda('0x7')](),controller[_0x2fda('0x26')]);router[_0x2fda('0x5')](_0x2fda('0x27'),auth[_0x2fda('0x7')](),controller['trunks']);router[_0x2fda('0x5')]('/campaigns',auth[_0x2fda('0x7')](),controller[_0x2fda('0x28')]);router[_0x2fda('0x5')](_0x2fda('0x29'),auth[_0x2fda('0x7')](),controller[_0x2fda('0x2a')]);router[_0x2fda('0x5')](_0x2fda('0x2b'),auth[_0x2fda('0x7')](),controller[_0x2fda('0x2c')]);router[_0x2fda('0x5')](_0x2fda('0x2d'),auth[_0x2fda('0x7')](),controller[_0x2fda('0x2e')]);router['get'](_0x2fda('0x2f'),auth['isAuthenticated'](),controller[_0x2fda('0x30')]);router[_0x2fda('0x5')](_0x2fda('0x31'),auth[_0x2fda('0x7')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x2fda('0x5')](_0x2fda('0x32'),auth['isAuthenticated'](),controller[_0x2fda('0x33')]);router['get']('/whatsapp/queues/waitinginteractions',auth[_0x2fda('0x7')](),controller[_0x2fda('0x34')]);router[_0x2fda('0x5')](_0x2fda('0x35'),auth[_0x2fda('0x7')](),controller['faxQueuesWaitingInteractions']);router[_0x2fda('0x36')](_0x2fda('0x37'),auth['isAuthenticated'](),controller[_0x2fda('0x38')](_0x2fda('0x39')));router[_0x2fda('0x5')]('/mail/queues/:id',auth[_0x2fda('0x7')](),controller[_0x2fda('0x3a')]);router[_0x2fda('0x36')](_0x2fda('0x3b'),auth[_0x2fda('0x7')](),controller[_0x2fda('0x38')](_0x2fda('0x3c')));router[_0x2fda('0x5')](_0x2fda('0x3d'),auth[_0x2fda('0x7')](),controller[_0x2fda('0x3e')]);router[_0x2fda('0x36')](_0x2fda('0x3f'),auth[_0x2fda('0x7')](),controller[_0x2fda('0x38')](_0x2fda('0x40')));router[_0x2fda('0x5')]('/fax/queues/:id',auth['isAuthenticated'](),controller[_0x2fda('0x41')]);router[_0x2fda('0x36')](_0x2fda('0x42'),auth[_0x2fda('0x7')](),controller['queueNotify'](_0x2fda('0x43')));router[_0x2fda('0x5')](_0x2fda('0x44'),auth[_0x2fda('0x7')](),controller[_0x2fda('0x45')]);router[_0x2fda('0x36')](_0x2fda('0x46'),auth['isAuthenticated'](),controller[_0x2fda('0x38')](_0x2fda('0x47')));router['post'](_0x2fda('0x48'),auth[_0x2fda('0x7')](),controller['queueNotify']('whatsapp'));router['get'](_0x2fda('0x49'),auth[_0x2fda('0x7')](),controller[_0x2fda('0x4a')]);router[_0x2fda('0x5')](_0x2fda('0x4b'),auth[_0x2fda('0x7')](),controller['showWhatsappQueues']);router[_0x2fda('0x36')]('/agents/:id/notify',auth[_0x2fda('0x7')](),controller[_0x2fda('0x4c')]);module['exports']=router; \ No newline at end of file +var _0xf1c5=['/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','outboundChannels','/agents','agents','/agents/:id/capacity','/telephones','/trunks','trunks','/campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','mail','/chat/queues/:id/notify','chat','showChatQueues','fax','/fax/queues/:id','showFaxQueues','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','express','./rpc.controller','get','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','chatQueues','mailAccounts','/openchannel/queues','openchannelQueues'];(function(_0x31e997,_0x295fb6){var _0x2b8cd8=function(_0x1476b1){while(--_0x1476b1){_0x31e997['push'](_0x31e997['shift']());}};_0x2b8cd8(++_0x295fb6);}(_0xf1c5,0xd9));var _0x5f1c=function(_0x6496d,_0x263cb6){_0x6496d=_0x6496d-0x0;var _0x3ac068=_0xf1c5[_0x6496d];return _0x3ac068;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var express=require(_0x5f1c('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x5f1c('0x1'));router[_0x5f1c('0x2')]('/voice/channels',auth[_0x5f1c('0x3')](),controller['voiceChannels']);router['get'](_0x5f1c('0x4'),auth[_0x5f1c('0x3')](),controller[_0x5f1c('0x5')]);router[_0x5f1c('0x2')](_0x5f1c('0x6'),auth[_0x5f1c('0x3')](),controller[_0x5f1c('0x7')]);router[_0x5f1c('0x2')]('/voice/queues',auth[_0x5f1c('0x3')](),controller[_0x5f1c('0x8')]);router[_0x5f1c('0x2')](_0x5f1c('0x9'),auth[_0x5f1c('0x3')](),controller[_0x5f1c('0xa')]);router['get']('/mail/queues',auth[_0x5f1c('0x3')](),controller['mailQueues']);router[_0x5f1c('0x2')]('/mail/accounts',auth[_0x5f1c('0x3')](),controller[_0x5f1c('0xb')]);router[_0x5f1c('0x2')](_0x5f1c('0xc'),auth[_0x5f1c('0x3')](),controller[_0x5f1c('0xd')]);router[_0x5f1c('0x2')](_0x5f1c('0xe'),auth[_0x5f1c('0x3')](),controller[_0x5f1c('0xf')]);router['get'](_0x5f1c('0x10'),auth[_0x5f1c('0x3')](),controller[_0x5f1c('0x11')]);router[_0x5f1c('0x2')](_0x5f1c('0x12'),auth[_0x5f1c('0x3')](),controller['faxQueues']);router[_0x5f1c('0x2')](_0x5f1c('0x13'),auth[_0x5f1c('0x3')](),controller['voiceQueuesPreview']);router[_0x5f1c('0x2')](_0x5f1c('0x14'),auth[_0x5f1c('0x3')](),controller['voiceQueuesChannels']);router[_0x5f1c('0x2')]('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller[_0x5f1c('0x15')]);router['get'](_0x5f1c('0x16'),auth['isAuthenticated'](),controller[_0x5f1c('0x17')]);router[_0x5f1c('0x2')](_0x5f1c('0x18'),auth[_0x5f1c('0x3')](),controller[_0x5f1c('0x19')]);router[_0x5f1c('0x2')](_0x5f1c('0x1a'),auth['isAuthenticated'](),controller[_0x5f1c('0x1b')]);router[_0x5f1c('0x1c')](_0x5f1c('0x1a'),auth[_0x5f1c('0x3')](),controller[_0x5f1c('0x1d')]);router[_0x5f1c('0x2')](_0x5f1c('0x1e'),auth[_0x5f1c('0x3')](),controller[_0x5f1c('0x1f')]);router[_0x5f1c('0x2')]('/outbound/channels',auth['isAuthenticated'](),controller[_0x5f1c('0x20')]);router['get'](_0x5f1c('0x21'),auth[_0x5f1c('0x3')](),controller[_0x5f1c('0x22')]);router[_0x5f1c('0x1c')](_0x5f1c('0x23'),auth[_0x5f1c('0x3')](),controller['agentCapacity']);router['get'](_0x5f1c('0x24'),auth['isAuthenticated'](),controller['telephones']);router['get'](_0x5f1c('0x25'),auth[_0x5f1c('0x3')](),controller[_0x5f1c('0x26')]);router['get'](_0x5f1c('0x27'),auth[_0x5f1c('0x3')](),controller['campaigns']);router[_0x5f1c('0x2')](_0x5f1c('0x28'),auth['isAuthenticated'](),controller['faxAccounts']);router[_0x5f1c('0x2')](_0x5f1c('0x29'),auth[_0x5f1c('0x3')](),controller[_0x5f1c('0x2a')]);router[_0x5f1c('0x2')](_0x5f1c('0x2b'),auth[_0x5f1c('0x3')](),controller[_0x5f1c('0x2c')]);router['get'](_0x5f1c('0x2d'),auth['isAuthenticated'](),controller[_0x5f1c('0x2e')]);router[_0x5f1c('0x2')](_0x5f1c('0x2f'),auth[_0x5f1c('0x3')](),controller[_0x5f1c('0x30')]);router[_0x5f1c('0x2')](_0x5f1c('0x31'),auth['isAuthenticated'](),controller[_0x5f1c('0x32')]);router[_0x5f1c('0x2')](_0x5f1c('0x33'),auth[_0x5f1c('0x3')](),controller['whatsappQueuesWaitingInteractions']);router[_0x5f1c('0x2')](_0x5f1c('0x34'),auth['isAuthenticated'](),controller['faxQueuesWaitingInteractions']);router[_0x5f1c('0x35')](_0x5f1c('0x36'),auth[_0x5f1c('0x3')](),controller[_0x5f1c('0x37')](_0x5f1c('0x38')));router[_0x5f1c('0x2')]('/mail/queues/:id',auth['isAuthenticated'](),controller['showMailQueues']);router[_0x5f1c('0x35')](_0x5f1c('0x39'),auth['isAuthenticated'](),controller[_0x5f1c('0x37')](_0x5f1c('0x3a')));router[_0x5f1c('0x2')]('/chat/queues/:id',auth[_0x5f1c('0x3')](),controller[_0x5f1c('0x3b')]);router[_0x5f1c('0x35')]('/fax/queues/:id/notify',auth['isAuthenticated'](),controller[_0x5f1c('0x37')](_0x5f1c('0x3c')));router[_0x5f1c('0x2')](_0x5f1c('0x3d'),auth['isAuthenticated'](),controller[_0x5f1c('0x3e')]);router[_0x5f1c('0x35')]('/openchannel/queues/:id/notify',auth[_0x5f1c('0x3')](),controller['queueNotify'](_0x5f1c('0x3f')));router[_0x5f1c('0x2')](_0x5f1c('0x40'),auth['isAuthenticated'](),controller[_0x5f1c('0x41')]);router[_0x5f1c('0x35')](_0x5f1c('0x42'),auth[_0x5f1c('0x3')](),controller['queueNotify'](_0x5f1c('0x43')));router[_0x5f1c('0x35')](_0x5f1c('0x44'),auth['isAuthenticated'](),controller[_0x5f1c('0x37')](_0x5f1c('0x45')));router['get'](_0x5f1c('0x46'),auth[_0x5f1c('0x3')](),controller[_0x5f1c('0x47')]);router[_0x5f1c('0x2')](_0x5f1c('0x48'),auth[_0x5f1c('0x3')](),controller[_0x5f1c('0x49')]);router[_0x5f1c('0x35')](_0x5f1c('0x4a'),auth[_0x5f1c('0x3')](),controller[_0x5f1c('0x4b')]);module[_0x5f1c('0x4c')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index c7fff76..0f10f04 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 _0xe706=['indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','Account','update','queue','MessageId','InteractionId','TransferReport','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','Agent\x20not\x20found','messageId','\x20Message\x20not\x20found','From','create','Start','agentTransferTimeout','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','name','send','isNil','rows','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','user','hasOwnProperty','MemberReport','findAll','INTERACTION','interaction','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','SIP/%s','interface','agent','internal','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','OpenchannelQueues','showOpenchannelQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','uniq'];(function(_0x33a497,_0x544a62){var _0x708cfa=function(_0x3b4e11){while(--_0x3b4e11){_0x33a497['push'](_0x33a497['shift']());}};_0x708cfa(++_0x544a62);}(_0xe706,0xa3));var _0x6e70=function(_0x2563e4,_0x456262){_0x2563e4=_0x2563e4-0x0;var _0x53e6d8=_0xe706[_0x2563e4];return _0x53e6d8;};'use strict';var BPromise=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));var _=require(_0x6e70('0x2'));var util=require('util');var db=require(_0x6e70('0x3'))['db'];var logger=require(_0x6e70('0x4'))(_0x6e70('0x5'));var jayson=require(_0x6e70('0x6'));var amiClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232a});var mailClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232b});var routingClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){var _0x449b48=_0x45a2d4?_0x45a2d4:amiClient;return _0x449b48[_0x6e70('0x9')](_0x36357b,_0x293ce7)[_0x6e70('0xa')](function(_0x100eb7){if(_0x100eb7[_0x6e70('0xb')]){if(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xc')]===0x1f4){return _0x3c4843(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xd')]);}return _0x188ed3(_0x100eb7['error']['message']);}else{_0x188ed3(_0x100eb7[_0x6e70('0xe')]);}})[_0x6e70('0xf')](function(_0x18cf27){_0x3c4843(_0x18cf27);});});}function respondWithResult(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xc8;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x10')](_0x3b38f3)[_0x6e70('0x11')](_0x310eb7);}return _0x27dd9b['sendStatus'](0x194);};}function handleError(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0x1f4;return function(_0x257e81){logger['error'](_0x257e81['stack']);if(_0x257e81[_0x6e70('0x12')]){delete _0x257e81[_0x6e70('0x12')];}_0x52737e['status'](_0x48bc72)[_0x6e70('0x13')](_0x257e81);};}function findById(_0x5c3fe7){return function(_0x2efc0f){if(!_[_0x6e70('0x14')](_0x5c3fe7)&&!_['isNil'](_0x2efc0f)&&!_['isNil'](_0x2efc0f[_0x6e70('0x15')])){return _['find'](_0x2efc0f[_0x6e70('0x15')],function(_0x173afe){return _0x173afe['id']==_0x5c3fe7;});}return null;};}exports['voiceChannels']=function(_0x497d61,_0xc238ba){return respondWithRpcPromise(_0x6e70('0x16'),_0x497d61[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0xc238ba,null))[_0x6e70('0xf')](handleError(_0xc238ba,null));};exports[_0x6e70('0x18')]=function(_0x1b2453,_0x44a49f){return respondWithRpcPromise(_0x6e70('0x19'),_[_0x6e70('0x1a')](_0x1b2453['query'],_0x1b2453[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x44a49f,null))[_0x6e70('0xf')](handleError(_0x44a49f,null));};exports['voiceChannelStopMixMonitor']=function(_0x3ccd87,_0xa5d49){return respondWithRpcPromise(_0x6e70('0x1c'),_['merge'](_0x3ccd87[_0x6e70('0x17')],_0x3ccd87['params']))['then'](respondWithResult(_0xa5d49,null))['catch'](handleError(_0xa5d49,null));};exports[_0x6e70('0x1d')]=function(_0x19c5ae,_0x51d292){return respondWithRpcPromise(_0x6e70('0x1e'),_0x19c5ae[_0x6e70('0x17')])['then'](respondWithResult(_0x51d292,null))[_0x6e70('0xf')](handleError(_0x51d292,null));};exports[_0x6e70('0x1f')]=function(_0x2bb231,_0x4a67ac){return respondWithRpcPromise('VoiceQueues',_0x2bb231[_0x6e70('0x17')])[_0x6e70('0xa')](findById(_0x2bb231[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4a67ac,null))[_0x6e70('0xf')](handleError(_0x4a67ac,null));};exports['updateVoiceQueue']=function(_0x1952ea,_0x406f29){return respondWithRpcPromise(_0x6e70('0x20'),_[_0x6e70('0x1a')](_0x1952ea[_0x6e70('0x21')],_0x1952ea[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x406f29,null))[_0x6e70('0xf')](handleError(_0x406f29,null));};exports[_0x6e70('0x22')]=function(_0x3a5d30,_0x4b1229){return respondWithRpcPromise(_0x6e70('0x23'),_['merge'](_0x3a5d30[_0x6e70('0x17')],_0x3a5d30['params']))[_0x6e70('0xa')](respondWithResult(_0x4b1229,null))[_0x6e70('0xf')](handleError(_0x4b1229,null));};exports[_0x6e70('0x24')]=function(_0x56f6f7,_0x38c40d){return respondWithRpcPromise(_0x6e70('0x25'),_0x56f6f7['query'])[_0x6e70('0xa')](respondWithResult(_0x38c40d,null))[_0x6e70('0xf')](handleError(_0x38c40d,null));};exports['voiceQueuesChannel']=function(_0x10d8f6,_0x3665a1){return respondWithRpcPromise(_0x6e70('0x26'),_[_0x6e70('0x1a')](_0x10d8f6[_0x6e70('0x17')],_0x10d8f6[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x3665a1,null))[_0x6e70('0xf')](handleError(_0x3665a1,null));};exports[_0x6e70('0x27')]=function(_0x419a41,_0x4d32d8){return respondWithRpcPromise(_0x6e70('0x28'),_['merge'](_0x419a41[_0x6e70('0x17')],_0x419a41[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x4d32d8,null))[_0x6e70('0xf')](handleError(_0x4d32d8,null));};exports[_0x6e70('0x29')]=function(_0x989b80,_0x2440be){return respondWithRpcPromise(_0x6e70('0x2a'),_[_0x6e70('0x1a')](_0x989b80[_0x6e70('0x17')],_0x989b80[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x2440be,null))[_0x6e70('0xf')](handleError(_0x2440be,null));};exports['outbound']=function(_0x5446a2,_0x5424eb){return respondWithRpcPromise(_0x6e70('0x2b'),_0x5446a2[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x5424eb,null))[_0x6e70('0xf')](handleError(_0x5424eb,null));};exports[_0x6e70('0x2c')]=function(_0x3bdd87,_0x572a71){return respondWithRpcPromise(_0x6e70('0x2d'),_0x3bdd87[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x572a71,null))[_0x6e70('0xf')](handleError(_0x572a71,null));};exports[_0x6e70('0x2e')]=function(_0x37bf46,_0x246e61){var _0x16fc7d;return respondWithRpcPromise('Agents',_0x37bf46[_0x6e70('0x17')])[_0x6e70('0xa')](function(_0x22fce9){_0x16fc7d=_0x22fce9;return respondWithRpcPromise(_0x6e70('0x2f'),_0x37bf46[_0x6e70('0x17')],routingClient);})[_0x6e70('0xa')](function(_0x21b0e7){return _['merge']({},_0x21b0e7,_0x16fc7d);})['then'](respondWithResult(_0x246e61,null))['catch'](handleError(_0x246e61,null));};exports[_0x6e70('0x30')]=function(_0x2b63cc,_0x83847b){if(_0x2b63cc[_0x6e70('0x21')]&&_0x2b63cc[_0x6e70('0x21')]['interaction']&&_0x2b63cc[_0x6e70('0x31')]&&_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]){for(var _0x52b197 in _0x2b63cc['body']['interaction']){if(_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x6e70('0x32')](_0x52b197)){db[_0x6e70('0x33')][_0x6e70('0x34')]({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'exitAt':null,'uniqueid':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]&&_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')]?{'$notIn':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]}:{'$ne':null}}})[_0x6e70('0xa')](function(_0x3d39c3){var _0xac87d6=moment()[_0x6e70('0x38')](_0x6e70('0x39'));for(var _0x3d9c5=0x0,_0x552e7e=_0x3d39c3[_0x6e70('0x37')];_0x3d9c5<_0x552e7e;_0x3d9c5+=0x1){_0x3d39c3[_0x3d9c5][_0x6e70('0x3a')]({'exitAt':_0xac87d6});}});for(var _0x10de2a=0x0;_0x10de2a<_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')];_0x10de2a+=0x1){db[_0x6e70('0x33')]['findOrCreate']({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a],'exitAt':null},'defaults':{'channel':_0x52b197,'membername':_0x2b63cc['user'][_0x6e70('0x12')],'interface':_[_0x6e70('0x14')](_0x2b63cc[_0x6e70('0x31')]['interface'])?util['format'](_0x6e70('0x3b'),_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]):_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3c')],'type':_0x6e70('0x35'),'enterAt':moment()['format'](_0x6e70('0x39')),'role':_0x6e70('0x3d'),'internal':_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3e')],'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x2b63cc[_0x6e70('0x1b')]['id'],'capacity':_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x3f')]},routingClient)[_0x6e70('0xa')](respondWithResult(_0x83847b,null))[_0x6e70('0xf')](handleError(_0x83847b,null));};exports['telephones']=function(_0x41bd0b,_0x232366){return respondWithRpcPromise(_0x6e70('0x40'),_0x41bd0b[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x232366,null))['catch'](handleError(_0x232366,null));};exports[_0x6e70('0x41')]=function(_0x1dd242,_0x2c20d3){return respondWithRpcPromise(_0x6e70('0x42'),_0x1dd242[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x2c20d3,null))['catch'](handleError(_0x2c20d3,null));};exports[_0x6e70('0x43')]=function(_0x8d425d,_0x5c2396){return respondWithRpcPromise(_0x6e70('0x44'),_0x8d425d[_0x6e70('0x17')])['then'](respondWithResult(_0x5c2396,null))[_0x6e70('0xf')](handleError(_0x5c2396,null));};exports[_0x6e70('0x45')]=function(_0x2134c4,_0x46d536){return respondWithRpcPromise(_0x6e70('0x46'),_0x2134c4['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x46d536,null))[_0x6e70('0xf')](handleError(_0x46d536,null));};exports[_0x6e70('0x47')]=function(_0x13be81,_0x1c02d7){return respondWithRpcPromise(_0x6e70('0x46'),_0x13be81[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x13be81[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x1c02d7,null))[_0x6e70('0xf')](handleError(_0x1c02d7,null));};exports[_0x6e70('0x48')]=function(_0xb8f78,_0x1fd9a6){return respondWithRpcPromise(_0x6e70('0x49'),_0xb8f78[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x1fd9a6,null))[_0x6e70('0xf')](handleError(_0x1fd9a6,null));};exports[_0x6e70('0x4a')]=function(_0x1c7dca,_0x4c6aab){return respondWithRpcPromise(_0x6e70('0x49'),_0x1c7dca[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x1c7dca[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4c6aab,null))[_0x6e70('0xf')](handleError(_0x4c6aab,null));};exports['mailAccounts']=function(_0x42bd85,_0x6cabf0){return respondWithRpcPromise('MailAccounts',_0x42bd85[_0x6e70('0x17')],mailClient)[_0x6e70('0xa')](respondWithResult(_0x6cabf0,null))[_0x6e70('0xf')](handleError(_0x6cabf0,null));};exports['openchannelQueues']=function(_0x51f268,_0x2f9be4){return respondWithRpcPromise(_0x6e70('0x4b'),_0x51f268[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2f9be4,null))[_0x6e70('0xf')](handleError(_0x2f9be4,null));};exports[_0x6e70('0x4c')]=function(_0x30cd88,_0x57bfe5){return respondWithRpcPromise('OpenchannelQueues',_0x30cd88[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x30cd88[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x57bfe5,null))['catch'](handleError(_0x57bfe5,null));};exports['smsQueues']=function(_0x2e972b,_0x4e5545){return respondWithRpcPromise('SmsQueues',_0x2e972b['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x4e5545,null))['catch'](handleError(_0x4e5545,null));};exports[_0x6e70('0x4d')]=function(_0x23900b,_0x3b4da0){return respondWithRpcPromise(_0x6e70('0x4e'),_0x23900b[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x23900b[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x3b4da0,null))['catch'](handleError(_0x3b4da0,null));};exports[_0x6e70('0x4f')]=function(_0x6a560f,_0x22c836){return respondWithRpcPromise(_0x6e70('0x50'),_0x6a560f[_0x6e70('0x17')],routingClient)['then'](respondWithResult(_0x22c836,null))['catch'](handleError(_0x22c836,null));};exports['showWhatsappQueues']=function(_0x1bb338,_0xd91b9){return respondWithRpcPromise(_0x6e70('0x50'),_0x1bb338['query'],routingClient)['then'](findById(_0x1bb338[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xd91b9,null))[_0x6e70('0xf')](handleError(_0xd91b9,null));};exports[_0x6e70('0x51')]=function(_0x2285f1,_0x32b884){return respondWithRpcPromise('FaxQueues',_0x2285f1[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x32b884,null))[_0x6e70('0xf')](handleError(_0x32b884,null));};exports[_0x6e70('0x52')]=function(_0x515c0c,_0xce964b){return respondWithRpcPromise('FaxQueues',_0x515c0c['query'],routingClient)[_0x6e70('0xa')](findById(_0x515c0c[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xce964b,null))[_0x6e70('0xf')](handleError(_0xce964b,null));};exports[_0x6e70('0x53')]=function(_0x2be0fc,_0x4b5b19){return respondWithRpcPromise(_0x6e70('0x54'),_0x2be0fc[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x4b5b19,null))[_0x6e70('0xf')](handleError(_0x4b5b19,null));};exports[_0x6e70('0x55')]=function(_0x13c092,_0x363722){return respondWithRpcPromise(_0x6e70('0x56'),_0x13c092[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x363722,null))['catch'](handleError(_0x363722,null));};exports[_0x6e70('0x57')]=function(_0x303c5a,_0x577c3b){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x303c5a['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x577c3b,null))[_0x6e70('0xf')](handleError(_0x577c3b,null));};exports[_0x6e70('0x58')]=function(_0x14bb74,_0x5a3dcb){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x14bb74['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x5a3dcb,null))[_0x6e70('0xf')](handleError(_0x5a3dcb,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x58666a,_0x1c7c5f){return respondWithRpcPromise(_0x6e70('0x59'),_0x58666a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](function(_0x44bf96){if(_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')]!==undefined){var _0x3650e9=_(_0x44bf96[_0x6e70('0x15')])[_0x6e70('0x5b')]([_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')],_0x58666a[_0x6e70('0x1b')]['id']])['map']('queue_id')[_0x6e70('0x5c')]()['value']();return _0x44bf96[_0x6e70('0x15')]['filter'](function(_0x5b5471){return _0x3650e9[_0x6e70('0x5d')](_0x5b5471['queue_id'])>-0x1;});}else{return _0x44bf96['rows'][_0x6e70('0x5b')](function(_0x21e4c2){return _0x21e4c2[_0x6e70('0x5e')]===parseInt(_0x58666a['params']['id']);});}})['then'](respondWithResult(_0x1c7c5f,null))['catch'](handleError(_0x1c7c5f,null));};exports[_0x6e70('0x5f')]=function(_0x512b0a,_0x2e8ed3){return respondWithRpcPromise(_0x6e70('0x60'),_0x512b0a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2e8ed3,null))[_0x6e70('0xf')](handleError(_0x2e8ed3,null));};exports[_0x6e70('0x61')]=function(_0x214a8f,_0x50046a){return respondWithRpcPromise(_0x6e70('0x62'),_0x214a8f[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x50046a,null))['catch'](handleError(_0x50046a,null));};exports[_0x6e70('0x63')]=function(_0x227d94,_0x11a615){return respondWithRpcPromise(_0x6e70('0x64'),_0x227d94[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x11a615,null))[_0x6e70('0xf')](handleError(_0x11a615,null));};exports[_0x6e70('0x65')]=function(_0x461ec0){return function(_0x48f6fd,_0x463eed){var _0x39e6db,_0x53acc8;var _0x252f07=_[_0x6e70('0x66')](_0x461ec0);var _0x51be27=_0x461ec0==='chat'?_0x6e70('0x67'):'Account';return db[_0x252f07+_0x6e70('0x68')]['findOne']({'raw':!![],'where':{'id':_0x48f6fd[_0x6e70('0x1b')]['id']}})[_0x6e70('0xa')](function(_0x106f32){if(_[_0x6e70('0x14')](_0x106f32)){throw new Error(_0x252f07+_0x6e70('0x69'));}_0x39e6db=_0x106f32;return db[_0x252f07+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x48f6fd['body']['messageId']},'include':[{'model':db[_0x252f07+_0x6e70('0x6c')],'as':'Interaction'},{'model':db[_0x252f07+_0x51be27],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x28e5b1){if(_[_0x6e70('0x14')](_0x28e5b1)){throw new Error(_0x252f07+'\x20Message\x20not\x20found');}_0x53acc8=_0x28e5b1;return _0x28e5b1[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x260dfa={'uniqueid':_0x461ec0+'.'+_0x53acc8['id']+'.'+_0x53acc8[_0x6e70('0x6c')]['id'],'FromUserId':_0x48f6fd[_0x6e70('0x31')]['id'],'type':_0x6e70('0x6f')};_0x260dfa[_0x252f07+_0x6e70('0x70')]=_0x53acc8['id'];_0x260dfa[_0x252f07+_0x6e70('0x71')]=_0x53acc8[_0x6e70('0x6c')]['id'];_0x260dfa['From'+_0x252f07+_0x51be27+'Id']=_0x53acc8[_0x6e70('0x6d')]['id'];_0x260dfa['To'+_0x252f07+'QueueId']=_0x39e6db['id'];return db[_0x252f07+_0x6e70('0x72')]['create'](_0x260dfa);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x461ec0,'interaction':_0x53acc8[_0x6e70('0x6c')],'message':_0x53acc8,'account':_0x53acc8[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x6f'),'appdata':_0x39e6db[_0x6e70('0x12')]+','+(_0x53acc8[_0x6e70('0x6d')]['queueTransferTimeout']||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})[_0x6e70('0xa')](respondWithResult(_0x463eed,null))['catch'](handleError(_0x463eed,null));};};exports[_0x6e70('0x74')]=function(_0x50e494,_0x17d3a4){var _0x5d0585,_0x4a87e2;if(_[_0x6e70('0x14')](_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')])){throw new Error(_0x6e70('0x76'));}var _0x3e6661=_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')];var _0x5c0276=_[_0x6e70('0x66')](_0x3e6661);var _0x4f4a16=_0x3e6661===_0x6e70('0x77')?_0x6e70('0x67'):_0x6e70('0x6d');return db[_0x6e70('0x78')][_0x6e70('0x6b')]({'raw':!![],'where':{'id':_0x50e494[_0x6e70('0x1b')]['id'],'role':_0x6e70('0x3d')}})['then'](function(_0x4466f0){if(_['isNil'](_0x4466f0)){throw new Error(_0x6e70('0x79'));}_0x5d0585=_0x4466f0;return db[_0x5c0276+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x50e494[_0x6e70('0x21')][_0x6e70('0x7a')]},'include':[{'model':db[_0x5c0276+_0x6e70('0x6c')],'as':_0x6e70('0x6c')},{'model':db[_0x5c0276+_0x4f4a16],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x162bc3){if(_['isNil'](_0x162bc3)){throw new Error(_0x5c0276+_0x6e70('0x7b'));}_0x4a87e2=_0x162bc3;return _0x162bc3[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x6e70('0xa')](function(){var _0x181802={'uniqueid':_0x3e6661+'.'+_0x4a87e2['id']+'.'+_0x4a87e2[_0x6e70('0x6c')]['id'],'FromUserId':_0x50e494['user']['id'],'type':'agent','ToUserId':_0x5d0585['id']};_0x181802[_0x5c0276+'MessageId']=_0x4a87e2['id'];_0x181802[_0x5c0276+_0x6e70('0x71')]=_0x4a87e2[_0x6e70('0x6c')]['id'];_0x181802[_0x6e70('0x7c')+_0x5c0276+_0x4f4a16+'Id']=_0x4a87e2[_0x6e70('0x6d')]['id'];return db[_0x5c0276+_0x6e70('0x72')][_0x6e70('0x7d')](_0x181802);})[_0x6e70('0xa')](function(){return respondWithRpcPromise(_0x6e70('0x7e'),{'channel':_0x3e6661,'interaction':_0x4a87e2[_0x6e70('0x6c')],'message':_0x4a87e2,'account':_0x4a87e2[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x3d'),'appdata':_0x5d0585[_0x6e70('0x12')]+','+(_0x4a87e2[_0x6e70('0x6d')][_0x6e70('0x7f')]||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x17d3a4,null))[_0x6e70('0xf')](handleError(_0x17d3a4,null));}; \ No newline at end of file +var _0xbaf0=['MailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','value','indexOf','smsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','Agent\x20not\x20found','InteractionId','agentTransferTimeout','moment','lodash','util','../../mysqldb','../../config/logger','api','client','http','request','then','error','code','message','result','status','sendStatus','stack','name','isNil','rows','voiceChannels','VoiceChannels','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','mailQueuesWaitingInteractions'];(function(_0x4506ef,_0x2dc975){var _0x4e44ad=function(_0x5da483){while(--_0x5da483){_0x4506ef['push'](_0x4506ef['shift']());}};_0x4e44ad(++_0x2dc975);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var BPromise=require('bluebird');var moment=require(_0x0baf('0x0'));var _=require(_0x0baf('0x1'));var util=require(_0x0baf('0x2'));var db=require(_0x0baf('0x3'))['db'];var logger=require(_0x0baf('0x4'))(_0x0baf('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232a});var mailClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232b});var routingClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){var _0x5f20aa=_0x1d0a0d?_0x1d0a0d:amiClient;return _0x5f20aa[_0x0baf('0x8')](_0x1a10b1,_0x2dcaac)[_0x0baf('0x9')](function(_0x465528){if(_0x465528[_0x0baf('0xa')]){if(_0x465528[_0x0baf('0xa')][_0x0baf('0xb')]===0x1f4){return _0x11b947(_0x465528[_0x0baf('0xa')][_0x0baf('0xc')]);}return _0x5f5030(_0x465528[_0x0baf('0xa')][_0x0baf('0xc')]);}else{_0x5f5030(_0x465528[_0x0baf('0xd')]);}})['catch'](function(_0x5a53e2){_0x11b947(_0x5a53e2);});});}function respondWithResult(_0x465dd7,_0xe4378c){_0xe4378c=_0xe4378c||0xc8;return function(_0x5db689){if(_0x5db689){return _0x465dd7[_0x0baf('0xe')](_0xe4378c)['json'](_0x5db689);}return _0x465dd7[_0x0baf('0xf')](0x194);};}function handleError(_0x49e44b,_0x1c76a8){_0x1c76a8=_0x1c76a8||0x1f4;return function(_0x1f50c3){logger[_0x0baf('0xa')](_0x1f50c3[_0x0baf('0x10')]);if(_0x1f50c3[_0x0baf('0x11')]){delete _0x1f50c3[_0x0baf('0x11')];}_0x49e44b['status'](_0x1c76a8)['send'](_0x1f50c3);};}function findById(_0x2312c7){return function(_0x38395b){if(!_[_0x0baf('0x12')](_0x2312c7)&&!_[_0x0baf('0x12')](_0x38395b)&&!_[_0x0baf('0x12')](_0x38395b[_0x0baf('0x13')])){return _['find'](_0x38395b[_0x0baf('0x13')],function(_0xfbecec){return _0xfbecec['id']==_0x2312c7;});}return null;};}exports[_0x0baf('0x14')]=function(_0x3e9cb4,_0x47070d){return respondWithRpcPromise(_0x0baf('0x15'),_0x3e9cb4['query'])['then'](respondWithResult(_0x47070d,null))[_0x0baf('0x16')](handleError(_0x47070d,null));};exports[_0x0baf('0x17')]=function(_0x32e839,_0x1848e8){return respondWithRpcPromise(_0x0baf('0x18'),_[_0x0baf('0x19')](_0x32e839[_0x0baf('0x1a')],_0x32e839[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x1848e8,null))[_0x0baf('0x16')](handleError(_0x1848e8,null));};exports['voiceChannelStopMixMonitor']=function(_0x334bd6,_0x482522){return respondWithRpcPromise(_0x0baf('0x1c'),_['merge'](_0x334bd6['query'],_0x334bd6[_0x0baf('0x1b')]))['then'](respondWithResult(_0x482522,null))['catch'](handleError(_0x482522,null));};exports[_0x0baf('0x1d')]=function(_0x27b59c,_0x34e264){return respondWithRpcPromise(_0x0baf('0x1e'),_0x27b59c[_0x0baf('0x1a')])['then'](respondWithResult(_0x34e264,null))[_0x0baf('0x16')](handleError(_0x34e264,null));};exports[_0x0baf('0x1f')]=function(_0x1ca35a,_0x366e71){return respondWithRpcPromise(_0x0baf('0x1e'),_0x1ca35a[_0x0baf('0x1a')])[_0x0baf('0x9')](findById(_0x1ca35a['params']['id']))[_0x0baf('0x9')](respondWithResult(_0x366e71,null))[_0x0baf('0x16')](handleError(_0x366e71,null));};exports[_0x0baf('0x20')]=function(_0x265915,_0x55c715){return respondWithRpcPromise(_0x0baf('0x21'),_[_0x0baf('0x19')](_0x265915['body'],_0x265915[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x55c715,null))[_0x0baf('0x16')](handleError(_0x55c715,null));};exports[_0x0baf('0x22')]=function(_0xd14f0f,_0x366924){return respondWithRpcPromise(_0x0baf('0x23'),_['merge'](_0xd14f0f[_0x0baf('0x1a')],_0xd14f0f[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x366924,null))[_0x0baf('0x16')](handleError(_0x366924,null));};exports[_0x0baf('0x24')]=function(_0x275ea1,_0x2fc983){return respondWithRpcPromise(_0x0baf('0x25'),_0x275ea1[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x2fc983,null))[_0x0baf('0x16')](handleError(_0x2fc983,null));};exports[_0x0baf('0x26')]=function(_0x45294a,_0x3a3353){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0baf('0x19')](_0x45294a['query'],_0x45294a[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x3a3353,null))[_0x0baf('0x16')](handleError(_0x3a3353,null));};exports[_0x0baf('0x27')]=function(_0x5300a5,_0x1a2b03){return respondWithRpcPromise(_0x0baf('0x28'),_['merge'](_0x5300a5[_0x0baf('0x1a')],_0x5300a5[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x1a2b03,null))[_0x0baf('0x16')](handleError(_0x1a2b03,null));};exports[_0x0baf('0x29')]=function(_0x1b0991,_0xe03d82){return respondWithRpcPromise(_0x0baf('0x2a'),_['merge'](_0x1b0991[_0x0baf('0x1a')],_0x1b0991[_0x0baf('0x1b')]))['then'](respondWithResult(_0xe03d82,null))[_0x0baf('0x16')](handleError(_0xe03d82,null));};exports['outbound']=function(_0x5c545f,_0x11bc49){return respondWithRpcPromise(_0x0baf('0x2b'),_0x5c545f['query'])['then'](respondWithResult(_0x11bc49,null))[_0x0baf('0x16')](handleError(_0x11bc49,null));};exports[_0x0baf('0x2c')]=function(_0x3412bc,_0xb2d9ab){return respondWithRpcPromise(_0x0baf('0x2d'),_0x3412bc[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0xb2d9ab,null))[_0x0baf('0x16')](handleError(_0xb2d9ab,null));};exports[_0x0baf('0x2e')]=function(_0x36c6d2,_0x200864){var _0x148540;return respondWithRpcPromise(_0x0baf('0x2f'),_0x36c6d2[_0x0baf('0x1a')])['then'](function(_0x3573ce){_0x148540=_0x3573ce;return respondWithRpcPromise(_0x0baf('0x2f'),_0x36c6d2['query'],routingClient);})[_0x0baf('0x9')](function(_0x324369){return _[_0x0baf('0x19')]({},_0x324369,_0x148540);})[_0x0baf('0x9')](respondWithResult(_0x200864,null))[_0x0baf('0x16')](handleError(_0x200864,null));};exports[_0x0baf('0x30')]=function(_0x57b581,_0x23ad34){if(_0x57b581[_0x0baf('0x31')]&&_0x57b581['body'][_0x0baf('0x32')]&&_0x57b581[_0x0baf('0x33')]&&_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')]){for(var _0x504031 in _0x57b581[_0x0baf('0x31')][_0x0baf('0x32')]){if(_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x0baf('0x34')](_0x504031)){db[_0x0baf('0x35')][_0x0baf('0x36')]({'where':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'type':_0x0baf('0x37'),'exitAt':null,'uniqueid':_0x57b581['body'][_0x0baf('0x32')][_0x504031]&&_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x0baf('0x38')]?{'$notIn':_0x57b581[_0x0baf('0x31')]['interaction'][_0x504031]}:{'$ne':null}}})[_0x0baf('0x9')](function(_0x310240){var _0x27c3ee=moment()[_0x0baf('0x39')](_0x0baf('0x3a'));for(var _0x54ed41=0x0,_0x2a0924=_0x310240[_0x0baf('0x38')];_0x54ed41<_0x2a0924;_0x54ed41+=0x1){_0x310240[_0x54ed41][_0x0baf('0x3b')]({'exitAt':_0x27c3ee});}});for(var _0x1522b0=0x0;_0x1522b0<_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x0baf('0x38')];_0x1522b0+=0x1){db['MemberReport'][_0x0baf('0x3c')]({'where':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'type':'INTERACTION','uniqueid':_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x1522b0],'exitAt':null},'defaults':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'interface':_[_0x0baf('0x12')](_0x57b581[_0x0baf('0x33')][_0x0baf('0x3d')])?util['format'](_0x0baf('0x3e'),_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')]):_0x57b581[_0x0baf('0x33')][_0x0baf('0x3d')],'type':_0x0baf('0x37'),'enterAt':moment()[_0x0baf('0x39')](_0x0baf('0x3a')),'role':_0x0baf('0x3f'),'internal':_0x57b581[_0x0baf('0x33')][_0x0baf('0x40')],'uniqueid':_0x57b581['body']['interaction'][_0x504031][_0x1522b0]}});}}}}return respondWithRpcPromise(_0x0baf('0x41'),{'id':_0x57b581[_0x0baf('0x1b')]['id'],'capacity':_0x57b581[_0x0baf('0x31')][_0x0baf('0x42')]},routingClient)[_0x0baf('0x9')](respondWithResult(_0x23ad34,null))[_0x0baf('0x16')](handleError(_0x23ad34,null));};exports[_0x0baf('0x43')]=function(_0x4b492c,_0x3fe534){return respondWithRpcPromise(_0x0baf('0x44'),_0x4b492c[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x3fe534,null))[_0x0baf('0x16')](handleError(_0x3fe534,null));};exports[_0x0baf('0x45')]=function(_0x5e1849,_0x3eebe5){return respondWithRpcPromise('Trunks',_0x5e1849[_0x0baf('0x1a')])['then'](respondWithResult(_0x3eebe5,null))[_0x0baf('0x16')](handleError(_0x3eebe5,null));};exports['campaigns']=function(_0x35b1a5,_0x4c035b){return respondWithRpcPromise(_0x0baf('0x46'),_0x35b1a5[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x4c035b,null))[_0x0baf('0x16')](handleError(_0x4c035b,null));};exports[_0x0baf('0x47')]=function(_0x576475,_0x21f179){return respondWithRpcPromise(_0x0baf('0x48'),_0x576475[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x21f179,null))[_0x0baf('0x16')](handleError(_0x21f179,null));};exports[_0x0baf('0x49')]=function(_0x480834,_0x402f4d){return respondWithRpcPromise(_0x0baf('0x48'),_0x480834[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](findById(_0x480834[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x402f4d,null))[_0x0baf('0x16')](handleError(_0x402f4d,null));};exports['mailQueues']=function(_0x48e855,_0x23f6ea){return respondWithRpcPromise(_0x0baf('0x4a'),_0x48e855[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x23f6ea,null))[_0x0baf('0x16')](handleError(_0x23f6ea,null));};exports[_0x0baf('0x4b')]=function(_0xaa4293,_0x14a667){return respondWithRpcPromise(_0x0baf('0x4a'),_0xaa4293['query'],routingClient)[_0x0baf('0x9')](findById(_0xaa4293[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x14a667,null))[_0x0baf('0x16')](handleError(_0x14a667,null));};exports[_0x0baf('0x4c')]=function(_0xebfc0c,_0x26f5c9){return respondWithRpcPromise('MailAccounts',_0xebfc0c[_0x0baf('0x1a')],mailClient)[_0x0baf('0x9')](respondWithResult(_0x26f5c9,null))[_0x0baf('0x16')](handleError(_0x26f5c9,null));};exports[_0x0baf('0x4d')]=function(_0x1c7d88,_0x1a6d22){return respondWithRpcPromise(_0x0baf('0x4e'),_0x1c7d88[_0x0baf('0x1a')],routingClient)['then'](respondWithResult(_0x1a6d22,null))[_0x0baf('0x16')](handleError(_0x1a6d22,null));};exports['showOpenchannelQueues']=function(_0x3c00e7,_0x5f2fbe){return respondWithRpcPromise('OpenchannelQueues',_0x3c00e7[_0x0baf('0x1a')],routingClient)['then'](findById(_0x3c00e7[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x5f2fbe,null))['catch'](handleError(_0x5f2fbe,null));};exports[_0x0baf('0x4f')]=function(_0xfb6708,_0x156572){return respondWithRpcPromise('SmsQueues',_0xfb6708['query'],routingClient)[_0x0baf('0x9')](respondWithResult(_0x156572,null))[_0x0baf('0x16')](handleError(_0x156572,null));};exports[_0x0baf('0x50')]=function(_0x7f49e,_0x784e1a){return respondWithRpcPromise('SmsQueues',_0x7f49e[_0x0baf('0x1a')],routingClient)['then'](findById(_0x7f49e['params']['id']))['then'](respondWithResult(_0x784e1a,null))[_0x0baf('0x16')](handleError(_0x784e1a,null));};exports['whatsappQueues']=function(_0x4946d4,_0x11a81e){return respondWithRpcPromise(_0x0baf('0x51'),_0x4946d4[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x11a81e,null))[_0x0baf('0x16')](handleError(_0x11a81e,null));};exports[_0x0baf('0x52')]=function(_0x4c05d6,_0xec3b32){return respondWithRpcPromise(_0x0baf('0x51'),_0x4c05d6[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](findById(_0x4c05d6[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0xec3b32,null))['catch'](handleError(_0xec3b32,null));};exports[_0x0baf('0x53')]=function(_0x468363,_0x29fd46){return respondWithRpcPromise('FaxQueues',_0x468363[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x29fd46,null))[_0x0baf('0x16')](handleError(_0x29fd46,null));};exports[_0x0baf('0x54')]=function(_0x125906,_0x27a959){return respondWithRpcPromise(_0x0baf('0x55'),_0x125906['query'],routingClient)['then'](findById(_0x125906['params']['id']))[_0x0baf('0x9')](respondWithResult(_0x27a959,null))[_0x0baf('0x16')](handleError(_0x27a959,null));};exports[_0x0baf('0x56')]=function(_0x12b9b5,_0x3e65d4){return respondWithRpcPromise(_0x0baf('0x57'),_0x12b9b5['query'])['then'](respondWithResult(_0x3e65d4,null))[_0x0baf('0x16')](handleError(_0x3e65d4,null));};exports['chatQueuesWaitingInteractions']=function(_0x22cd07,_0x3e9b79){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x22cd07[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x3e9b79,null))[_0x0baf('0x16')](handleError(_0x3e9b79,null));};exports[_0x0baf('0x58')]=function(_0x115ff5,_0x33a5af){return respondWithRpcPromise(_0x0baf('0x59'),_0x115ff5[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x33a5af,null))['catch'](handleError(_0x33a5af,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x58a079,_0x493784){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x58a079[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x493784,null))[_0x0baf('0x16')](handleError(_0x493784,null));};exports[_0x0baf('0x5a')]=function(_0x5093f5,_0x1be7f2){return respondWithRpcPromise(_0x0baf('0x5b'),_0x5093f5['query'],routingClient)['then'](function(_0x43aecd){if(_0x5093f5[_0x0baf('0x1a')][_0x0baf('0x5c')]!==undefined){var _0x442e5f=_(_0x43aecd[_0x0baf('0x13')])[_0x0baf('0x5d')]([_0x5093f5[_0x0baf('0x1a')][_0x0baf('0x5c')],_0x5093f5['params']['id']])[_0x0baf('0x5e')](_0x0baf('0x5f'))['uniq']()[_0x0baf('0x60')]();return _0x43aecd[_0x0baf('0x13')]['filter'](function(_0x97d385){return _0x442e5f[_0x0baf('0x61')](_0x97d385[_0x0baf('0x5f')])>-0x1;});}else{return _0x43aecd[_0x0baf('0x13')][_0x0baf('0x5d')](function(_0x4fc5af){return _0x4fc5af['queue_id']===parseInt(_0x5093f5[_0x0baf('0x1b')]['id']);});}})[_0x0baf('0x9')](respondWithResult(_0x1be7f2,null))['catch'](handleError(_0x1be7f2,null));};exports[_0x0baf('0x62')]=function(_0x59dad5,_0x21ad25){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x59dad5[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x21ad25,null))[_0x0baf('0x16')](handleError(_0x21ad25,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x3c2bc1,_0x5008c5){return respondWithRpcPromise(_0x0baf('0x63'),_0x3c2bc1[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x5008c5,null))[_0x0baf('0x16')](handleError(_0x5008c5,null));};exports[_0x0baf('0x64')]=function(_0x52e845,_0x866e6e){return respondWithRpcPromise(_0x0baf('0x65'),_0x52e845['query'],routingClient)[_0x0baf('0x9')](respondWithResult(_0x866e6e,null))[_0x0baf('0x16')](handleError(_0x866e6e,null));};exports[_0x0baf('0x66')]=function(_0x379c54){return function(_0x1cbbcc,_0x250df2){var _0xa4fd1b,_0x1cda78;var _0x44ef57=_[_0x0baf('0x67')](_0x379c54);var _0x3b7abf=_0x379c54===_0x0baf('0x68')?'Website':'Account';return db[_0x44ef57+_0x0baf('0x69')][_0x0baf('0x6a')]({'raw':!![],'where':{'id':_0x1cbbcc[_0x0baf('0x1b')]['id']}})['then'](function(_0x507783){if(_[_0x0baf('0x12')](_0x507783)){throw new Error(_0x44ef57+_0x0baf('0x6b'));}_0xa4fd1b=_0x507783;return db[_0x44ef57+_0x0baf('0x6c')][_0x0baf('0x6a')]({'where':{'id':_0x1cbbcc[_0x0baf('0x31')][_0x0baf('0x6d')]},'include':[{'model':db[_0x44ef57+_0x0baf('0x6e')],'as':_0x0baf('0x6e')},{'model':db[_0x44ef57+_0x3b7abf],'as':_0x0baf('0x6f')}]});})['then'](function(_0x1590a5){if(_[_0x0baf('0x12')](_0x1590a5)){throw new Error(_0x44ef57+_0x0baf('0x70'));}_0x1cda78=_0x1590a5;return _0x1590a5[_0x0baf('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x5d26e6={'uniqueid':_0x379c54+'.'+_0x1cda78['id']+'.'+_0x1cda78['Interaction']['id'],'FromUserId':_0x1cbbcc[_0x0baf('0x33')]['id'],'type':_0x0baf('0x72')};_0x5d26e6[_0x44ef57+'MessageId']=_0x1cda78['id'];_0x5d26e6[_0x44ef57+'InteractionId']=_0x1cda78[_0x0baf('0x6e')]['id'];_0x5d26e6[_0x0baf('0x73')+_0x44ef57+_0x3b7abf+'Id']=_0x1cda78['Account']['id'];_0x5d26e6['To'+_0x44ef57+_0x0baf('0x74')]=_0xa4fd1b['id'];return db[_0x44ef57+_0x0baf('0x75')][_0x0baf('0x76')](_0x5d26e6);})[_0x0baf('0x9')](function(){return respondWithRpcPromise(_0x0baf('0x77'),{'channel':_0x379c54,'interaction':_0x1cda78[_0x0baf('0x6e')],'message':_0x1cda78,'account':_0x1cda78[_0x0baf('0x6f')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0baf('0x72'),'appdata':_0xa4fd1b[_0x0baf('0x11')]+','+(_0x1cda78[_0x0baf('0x6f')][_0x0baf('0x78')]||0x12c),'interval':_0x0baf('0x79')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x250df2,null))[_0x0baf('0x16')](handleError(_0x250df2,null));};};exports[_0x0baf('0x7a')]=function(_0x1e1adb,_0x3bd15b){var _0x3c37b4,_0x195303;if(_['isNil'](_0x1e1adb[_0x0baf('0x31')][_0x0baf('0x7b')])){throw new Error(_0x0baf('0x7c'));}var _0x457ae8=_0x1e1adb[_0x0baf('0x31')]['channel'];var _0x3761b5=_[_0x0baf('0x67')](_0x457ae8);var _0x2eae1b=_0x457ae8===_0x0baf('0x68')?_0x0baf('0x7d'):'Account';return db['User'][_0x0baf('0x6a')]({'raw':!![],'where':{'id':_0x1e1adb['params']['id'],'role':_0x0baf('0x3f')}})['then'](function(_0x32d8b6){if(_[_0x0baf('0x12')](_0x32d8b6)){throw new Error(_0x0baf('0x7e'));}_0x3c37b4=_0x32d8b6;return db[_0x3761b5+_0x0baf('0x6c')]['findOne']({'where':{'id':_0x1e1adb[_0x0baf('0x31')][_0x0baf('0x6d')]},'include':[{'model':db[_0x3761b5+_0x0baf('0x6e')],'as':'Interaction'},{'model':db[_0x3761b5+_0x2eae1b],'as':'Account'}]});})['then'](function(_0x4d4884){if(_[_0x0baf('0x12')](_0x4d4884)){throw new Error(_0x3761b5+_0x0baf('0x70'));}_0x195303=_0x4d4884;return _0x4d4884[_0x0baf('0x71')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0baf('0x9')](function(){var _0x597830={'uniqueid':_0x457ae8+'.'+_0x195303['id']+'.'+_0x195303[_0x0baf('0x6e')]['id'],'FromUserId':_0x1e1adb[_0x0baf('0x33')]['id'],'type':_0x0baf('0x3f'),'ToUserId':_0x3c37b4['id']};_0x597830[_0x3761b5+'MessageId']=_0x195303['id'];_0x597830[_0x3761b5+_0x0baf('0x7f')]=_0x195303[_0x0baf('0x6e')]['id'];_0x597830['From'+_0x3761b5+_0x2eae1b+'Id']=_0x195303[_0x0baf('0x6f')]['id'];return db[_0x3761b5+'TransferReport'][_0x0baf('0x76')](_0x597830);})[_0x0baf('0x9')](function(){return respondWithRpcPromise(_0x0baf('0x77'),{'channel':_0x457ae8,'interaction':_0x195303[_0x0baf('0x6e')],'message':_0x195303,'account':_0x195303['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x3c37b4[_0x0baf('0x11')]+','+(_0x195303['Account'][_0x0baf('0x80')]||0x12c),'interval':_0x0baf('0x79')}],'transfer':!![]},routingClient);})[_0x0baf('0x9')](respondWithResult(_0x3bd15b,null))[_0x0baf('0x16')](handleError(_0x3bd15b,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 9c111fa..25a61e0 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 _0xbc75=['./schedule.controller','get','isAuthenticated','show','/:id/run','run','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1245e0,_0x9562cd){var _0x282d34=function(_0x460715){while(--_0x460715){_0x1245e0['push'](_0x1245e0['shift']());}};_0x282d34(++_0x9562cd);}(_0xbc75,0x172));var _0x5bc7=function(_0x1d3ee9,_0x38d62){_0x1d3ee9=_0x1d3ee9-0x0;var _0x4170d2=_0xbc75[_0x1d3ee9];return _0x4170d2;};'use strict';var multer=require(_0x5bc7('0x0'));var util=require(_0x5bc7('0x1'));var path=require(_0x5bc7('0x2'));var timeout=require(_0x5bc7('0x3'));var express=require(_0x5bc7('0x4'));var router=express[_0x5bc7('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5bc7('0x6'));var interaction=require(_0x5bc7('0x7'));var config=require('../../config/environment');var controller=require(_0x5bc7('0x8'));router[_0x5bc7('0x9')]('/',auth[_0x5bc7('0xa')](),controller['index']);router[_0x5bc7('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x5bc7('0xb')]);router[_0x5bc7('0x9')](_0x5bc7('0xc'),auth[_0x5bc7('0xa')](),controller[_0x5bc7('0xd')]);router['post']('/',auth[_0x5bc7('0xa')](),controller[_0x5bc7('0xe')]);router['put']('/:id',auth[_0x5bc7('0xa')](),controller[_0x5bc7('0xf')]);router[_0x5bc7('0x10')]('/:id',auth[_0x5bc7('0xa')](),controller[_0x5bc7('0x11')]);module['exports']=router; \ No newline at end of file +var _0x414f=['isAuthenticated','run','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','/:id','show'];(function(_0x3c54e3,_0x17c963){var _0x36ecc1=function(_0x564f85){while(--_0x564f85){_0x3c54e3['push'](_0x3c54e3['shift']());}};_0x36ecc1(++_0x17c963);}(_0x414f,0xc1));var _0xf414=function(_0x563d3b,_0x40812b){_0x563d3b=_0x563d3b-0x0;var _0xcc6fa4=_0x414f[_0x563d3b];return _0xcc6fa4;};'use strict';var multer=require(_0xf414('0x0'));var util=require(_0xf414('0x1'));var path=require(_0xf414('0x2'));var timeout=require(_0xf414('0x3'));var express=require(_0xf414('0x4'));var router=express[_0xf414('0x5')]();var fs_extra=require(_0xf414('0x6'));var auth=require(_0xf414('0x7'));var interaction=require(_0xf414('0x8'));var config=require(_0xf414('0x9'));var controller=require(_0xf414('0xa'));router[_0xf414('0xb')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xf414('0xc'),auth['isAuthenticated'](),controller[_0xf414('0xd')]);router[_0xf414('0xb')]('/:id/run',auth[_0xf414('0xe')](),controller[_0xf414('0xf')]);router[_0xf414('0x10')]('/',auth[_0xf414('0xe')](),controller[_0xf414('0x11')]);router[_0xf414('0x12')](_0xf414('0xc'),auth[_0xf414('0xe')](),controller[_0xf414('0x13')]);router[_0xf414('0x14')](_0xf414('0xc'),auth[_0xf414('0xe')](),controller[_0xf414('0x15')]);module[_0xf414('0x16')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 182bf44..af64e47 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 _0x5751=['custom','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','INTEGER','ENUM','quarters','months','days','hours','csv','pdf'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5751,0x101));var _0x1575=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x5751[_0x68c979];return _0x4f0001;};'use strict';var Sequelize=require(_0x1575('0x0'));module[_0x1575('0x1')]={'name':{'type':Sequelize[_0x1575('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x1575('0x2')]},'active':{'type':Sequelize[_0x1575('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1575('0x4')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x1575('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x1575('0x6')]('years',_0x1575('0x7'),_0x1575('0x8'),'weeks',_0x1575('0x9'),_0x1575('0xa'),'minutes'),'allowNull':![],'defaultValue':_0x1575('0x9')},'output':{'type':Sequelize[_0x1575('0x6')](_0x1575('0xb'),_0x1575('0xc'),'xlsx'),'allowNull':![],'defaultValue':_0x1575('0xb')},'type':{'type':Sequelize[_0x1575('0x6')]('custom','default'),'allowNull':![],'defaultValue':_0x1575('0xd')},'sendMail':{'type':Sequelize[_0x1575('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x1575('0xe')]},'sendIfEmpty':{'type':Sequelize[_0x1575('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x67ef=['pdf','xlsx','csv','custom','default','TEXT','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','days','hours'];(function(_0x378bc8,_0x479dce){var _0x128a05=function(_0x42a7f5){while(--_0x42a7f5){_0x378bc8['push'](_0x378bc8['shift']());}};_0x128a05(++_0x479dce);}(_0x67ef,0x1d1));var _0xf67e=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x67ef[_0x2c7618];return _0x5ce3f0;};'use strict';var Sequelize=require('sequelize');module[_0xf67e('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xf67e('0x1')]},'active':{'type':Sequelize[_0xf67e('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xf67e('0x1')],'allowNull':![],'defaultValue':_0xf67e('0x3')},'startAt':{'type':Sequelize[_0xf67e('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0xf67e('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xf67e('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xf67e('0x6')](_0xf67e('0x7'),_0xf67e('0x8'),'months','weeks',_0xf67e('0x9'),_0xf67e('0xa'),'minutes'),'allowNull':![],'defaultValue':_0xf67e('0x9')},'output':{'type':Sequelize[_0xf67e('0x6')]('csv',_0xf67e('0xb'),_0xf67e('0xc')),'allowNull':![],'defaultValue':_0xf67e('0xd')},'type':{'type':Sequelize[_0xf67e('0x6')](_0xf67e('0xe'),_0xf67e('0xf')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0xf67e('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xf67e('0x1')]},'cc':{'type':Sequelize[_0xf67e('0x10')]},'bcc':{'type':Sequelize[_0xf67e('0x10')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index b430ee4..88f8123 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 _0xdfb3=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','get','Scheduler','error','name','index','map','Schedule','rawAttributes','fieldName','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','intersection','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','run','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','ioredis'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xdfb3,0x149));var _0x3dfb=function(_0x2d9f17,_0x5e14c2){_0x2d9f17=_0x2d9f17-0x0;var _0x1d21ba=_0xdfb3[_0x2d9f17];return _0x1d21ba;};'use strict';var emlformat=require(_0x3dfb('0x0'));var rimraf=require(_0x3dfb('0x1'));var zipdir=require(_0x3dfb('0x2'));var jsonpatch=require(_0x3dfb('0x3'));var rp=require(_0x3dfb('0x4'));var moment=require(_0x3dfb('0x5'));var BPromise=require(_0x3dfb('0x6'));var Mustache=require(_0x3dfb('0x7'));var util=require('util');var path=require(_0x3dfb('0x8'));var sox=require(_0x3dfb('0x9'));var csv=require(_0x3dfb('0xa'));var ejs=require(_0x3dfb('0xb'));var fs=require('fs');var fs_extra=require(_0x3dfb('0xc'));var _=require('lodash');var squel=require(_0x3dfb('0xd'));var crypto=require(_0x3dfb('0xe'));var jsforce=require(_0x3dfb('0xf'));var deskjs=require(_0x3dfb('0x10'));var toCsv=require('to-csv');var querystring=require(_0x3dfb('0x11'));var Papa=require('papaparse');var Redis=require(_0x3dfb('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3dfb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3dfb('0x14'));var logger=require(_0x3dfb('0x15'))(_0x3dfb('0x16'));var utils=require(_0x3dfb('0x17'));var config=require(_0x3dfb('0x18'));var licenseUtil=require(_0x3dfb('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c93f4,_0x482722){_0x482722=_0x482722||0xcc;return function(_0x1e21e0){if(_0x1e21e0){return _0x5c93f4[_0x3dfb('0x1a')](_0x482722);}return _0x5c93f4['status'](_0x482722)[_0x3dfb('0x1b')]();};}function respondWithResult(_0x2c913d,_0x1e0a31){_0x1e0a31=_0x1e0a31||0xc8;return function(_0x1f8a40){if(_0x1f8a40){return _0x2c913d[_0x3dfb('0x1c')](_0x1e0a31)[_0x3dfb('0x1d')](_0x1f8a40);}};}function respondWithFilteredResult(_0x2fe5ea,_0x43ab90){return function(_0xa547e3){if(_0xa547e3){var _0x3de4eb=typeof _0x43ab90[_0x3dfb('0x1e')]===_0x3dfb('0x1f')&&typeof _0x43ab90[_0x3dfb('0x20')]==='undefined';var _0x80d72e=_0xa547e3[_0x3dfb('0x21')];var _0x581806=_0x3de4eb?0x0:_0x43ab90[_0x3dfb('0x1e')];var _0x4fa55e=_0x3de4eb?_0xa547e3[_0x3dfb('0x21')]:_0x43ab90['offset']+_0x43ab90[_0x3dfb('0x20')];var _0x11fc01;if(_0x4fa55e>=_0x80d72e){_0x4fa55e=_0x80d72e;_0x11fc01=0xc8;}else{_0x11fc01=0xce;}_0x2fe5ea['status'](_0x11fc01);return _0x2fe5ea['set'](_0x3dfb('0x22'),_0x581806+'-'+_0x4fa55e+'/'+_0x80d72e)['json'](_0xa547e3);}return null;};}function patchUpdates(_0x1f11eb){return function(_0x5b8ebc){try{jsonpatch['apply'](_0x5b8ebc,_0x1f11eb,!![]);}catch(_0x50e6fc){return BPromise[_0x3dfb('0x23')](_0x50e6fc);}return _0x5b8ebc['save']();};}function saveUpdates(_0x34dc60,_0x38ae7d){return function(_0xcda56){if(_0xcda56){return _0xcda56[_0x3dfb('0x24')](_0x34dc60)[_0x3dfb('0x25')](function(_0x1e68db){return _0x1e68db;});}return null;};}function removeEntity(_0x58958a,_0x523f9f){return function(_0xafc29e){if(_0xafc29e){return _0xafc29e[_0x3dfb('0x26')]()[_0x3dfb('0x25')](function(){var _0x48fc92=_0xafc29e[_0x3dfb('0x27')]({'plain':!![]});var _0xa323a0=_0x3dfb('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0xa323a0,'resourceId':_0x48fc92['id']}})[_0x3dfb('0x25')](function(){return _0xafc29e;});})[_0x3dfb('0x25')](function(){_0x58958a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b1581,_0x1e4bb3){return function(_0x182fe4){if(!_0x182fe4){_0x4b1581[_0x3dfb('0x1a')](0x194);}return _0x182fe4;};}function handleError(_0x5a4fc9,_0x383017){_0x383017=_0x383017||0x1f4;return function(_0x120fca){logger[_0x3dfb('0x29')](_0x120fca['stack']);if(_0x120fca[_0x3dfb('0x2a')]){delete _0x120fca[_0x3dfb('0x2a')];}_0x5a4fc9['status'](_0x383017)['send'](_0x120fca);};}exports[_0x3dfb('0x2b')]=function(_0x4f5d21,_0x589917){var _0x4cfd28={},_0x263906={},_0x5401a8={'count':0x0,'rows':[]};var _0x4ff54d=_[_0x3dfb('0x2c')](db[_0x3dfb('0x2d')][_0x3dfb('0x2e')],function(_0x49a82b){return{'name':_0x49a82b[_0x3dfb('0x2f')],'type':_0x49a82b['type'][_0x3dfb('0x30')]};});_0x263906['model']=_[_0x3dfb('0x2c')](_0x4ff54d,_0x3dfb('0x2a'));_0x263906[_0x3dfb('0x31')]=_[_0x3dfb('0x32')](_0x4f5d21[_0x3dfb('0x31')]);_0x263906[_0x3dfb('0x33')]=_['intersection'](_0x263906[_0x3dfb('0x34')],_0x263906[_0x3dfb('0x31')]);_0x4cfd28[_0x3dfb('0x35')]=_['intersection'](_0x263906['model'],qs['fields'](_0x4f5d21[_0x3dfb('0x31')][_0x3dfb('0x36')]));_0x4cfd28[_0x3dfb('0x35')]=_0x4cfd28[_0x3dfb('0x35')][_0x3dfb('0x37')]?_0x4cfd28[_0x3dfb('0x35')]:_0x263906['model'];if(!_0x4f5d21[_0x3dfb('0x31')][_0x3dfb('0x38')](_0x3dfb('0x39'))){_0x4cfd28[_0x3dfb('0x20')]=qs[_0x3dfb('0x20')](_0x4f5d21[_0x3dfb('0x31')][_0x3dfb('0x20')]);_0x4cfd28['offset']=qs[_0x3dfb('0x1e')](_0x4f5d21[_0x3dfb('0x31')][_0x3dfb('0x1e')]);}_0x4cfd28[_0x3dfb('0x3a')]=qs['sort'](_0x4f5d21[_0x3dfb('0x31')][_0x3dfb('0x3b')]);_0x4cfd28['where']=qs[_0x3dfb('0x33')](_[_0x3dfb('0x3c')](_0x4f5d21[_0x3dfb('0x31')],_0x263906['filters']),_0x4ff54d);if(_0x4f5d21[_0x3dfb('0x31')][_0x3dfb('0x3d')]){_0x4cfd28[_0x3dfb('0x3e')]=_[_0x3dfb('0x3f')](_0x4cfd28[_0x3dfb('0x3e')],{'$or':_[_0x3dfb('0x2c')](_0x4ff54d,function(_0x5d1733){if(_0x5d1733[_0x3dfb('0x40')]!==_0x3dfb('0x41')){var _0x4ac8be={};_0x4ac8be[_0x5d1733[_0x3dfb('0x2a')]]={'$like':'%'+_0x4f5d21[_0x3dfb('0x31')][_0x3dfb('0x3d')]+'%'};return _0x4ac8be;}})});}_0x4cfd28=_[_0x3dfb('0x3f')]({},_0x4cfd28,_0x4f5d21[_0x3dfb('0x42')]);var _0x2f9baf={'where':_0x4cfd28['where']};return db[_0x3dfb('0x2d')][_0x3dfb('0x21')](_0x2f9baf)[_0x3dfb('0x25')](function(_0x2db9d9){_0x5401a8[_0x3dfb('0x21')]=_0x2db9d9;if(_0x4f5d21[_0x3dfb('0x31')][_0x3dfb('0x43')]){_0x4cfd28['include']=[{'all':!![]}];}return db[_0x3dfb('0x2d')][_0x3dfb('0x44')](_0x4cfd28);})[_0x3dfb('0x25')](function(_0x4d7580){_0x5401a8[_0x3dfb('0x45')]=_0x4d7580;return _0x5401a8;})[_0x3dfb('0x25')](respondWithFilteredResult(_0x589917,_0x4cfd28))[_0x3dfb('0x46')](handleError(_0x589917,null));};exports[_0x3dfb('0x47')]=function(_0x17c06e,_0x208d3b){var _0x584649={'raw':![],'where':{'id':_0x17c06e['params']['id']}},_0xa75882={};_0xa75882[_0x3dfb('0x34')]=_[_0x3dfb('0x32')](db[_0x3dfb('0x2d')][_0x3dfb('0x2e')]);_0xa75882['query']=_[_0x3dfb('0x32')](_0x17c06e[_0x3dfb('0x31')]);_0xa75882['filters']=_[_0x3dfb('0x48')](_0xa75882['model'],_0xa75882['query']);_0x584649[_0x3dfb('0x35')]=_[_0x3dfb('0x48')](_0xa75882[_0x3dfb('0x34')],qs[_0x3dfb('0x36')](_0x17c06e[_0x3dfb('0x31')]['fields']));_0x584649[_0x3dfb('0x35')]=_0x584649[_0x3dfb('0x35')]['length']?_0x584649[_0x3dfb('0x35')]:_0xa75882[_0x3dfb('0x34')];if(_0x17c06e['query'][_0x3dfb('0x43')]){_0x584649[_0x3dfb('0x49')]=[{'all':!![]}];}_0x584649=_['merge']({},_0x584649,_0x17c06e[_0x3dfb('0x42')]);return db[_0x3dfb('0x2d')][_0x3dfb('0x4a')](_0x584649)['then'](handleEntityNotFound(_0x208d3b,null))[_0x3dfb('0x25')](respondWithResult(_0x208d3b,null))[_0x3dfb('0x46')](handleError(_0x208d3b,null));};exports['create']=function(_0x251e95,_0x4cb54d){return db[_0x3dfb('0x2d')][_0x3dfb('0x4b')](_0x251e95[_0x3dfb('0x4c')],{})[_0x3dfb('0x25')](function(_0x4c6d07){var _0x34fb23=_0x251e95[_0x3dfb('0x4d')]['get']({'plain':!![]});if(!_0x34fb23)throw new Error(_0x3dfb('0x4e'));if(_0x34fb23[_0x3dfb('0x4f')]===_0x3dfb('0x4d')){var _0x2f8151=_0x4c6d07['get']({'plain':!![]});var _0x521122='Scheduler';return db[_0x3dfb('0x50')][_0x3dfb('0x4a')]({'where':{'name':_0x521122,'userProfileId':_0x34fb23[_0x3dfb('0x51')]},'raw':!![]})[_0x3dfb('0x25')](function(_0x4c1f59){if(_0x4c1f59&&_0x4c1f59[_0x3dfb('0x52')]===0x0){return db[_0x3dfb('0x53')][_0x3dfb('0x4b')]({'name':_0x2f8151[_0x3dfb('0x2a')],'resourceId':_0x2f8151['id'],'type':_0x4c1f59['name'],'sectionId':_0x4c1f59['id']},{})[_0x3dfb('0x25')](function(){return _0x4c6d07;});}else{return _0x4c6d07;}})[_0x3dfb('0x46')](function(_0x4a5084){logger[_0x3dfb('0x29')](_0x3dfb('0x54'),_0x4a5084);throw _0x4a5084;});}return _0x4c6d07;})[_0x3dfb('0x25')](respondWithResult(_0x4cb54d,0xc9))[_0x3dfb('0x46')](handleError(_0x4cb54d,null));};exports[_0x3dfb('0x24')]=function(_0x5766d7,_0x3d758e){if(_0x5766d7[_0x3dfb('0x4c')]['id']){delete _0x5766d7[_0x3dfb('0x4c')]['id'];}return db[_0x3dfb('0x2d')]['find']({'where':{'id':_0x5766d7[_0x3dfb('0x55')]['id']}})[_0x3dfb('0x25')](handleEntityNotFound(_0x3d758e,null))[_0x3dfb('0x25')](saveUpdates(_0x5766d7[_0x3dfb('0x4c')],null))[_0x3dfb('0x25')](respondWithResult(_0x3d758e,null))[_0x3dfb('0x46')](handleError(_0x3d758e,null));};exports[_0x3dfb('0x26')]=function(_0x3b80dd,_0x4089e8){return db[_0x3dfb('0x2d')][_0x3dfb('0x4a')]({'where':{'id':_0x3b80dd[_0x3dfb('0x55')]['id']}})[_0x3dfb('0x25')](handleEntityNotFound(_0x4089e8,null))[_0x3dfb('0x25')](removeEntity(_0x4089e8,null))[_0x3dfb('0x46')](handleError(_0x4089e8,null));};exports[_0x3dfb('0x56')]=function(_0x2cf6dc,_0x15605,_0x35f2f3){var _0x13217c=require('../../config/schedule');return db[_0x3dfb('0x2d')][_0x3dfb('0x4a')]({'where':{'id':_0x2cf6dc['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x15605,null))[_0x3dfb('0x25')](function(){_0x13217c[_0x3dfb('0x56')](_0x2cf6dc[_0x3dfb('0x55')]['id']);})[_0x3dfb('0x25')](respondWithStatusCode(_0x15605,null))['catch'](handleError(_0x15605,null));}; \ No newline at end of file +var _0x6dc7=['findAll','rows','catch','show','params','rawAttributes','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','run','../../config/schedule','eml-format','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','get','Scheduler','destroy','name','send','index','map','Schedule','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include'];(function(_0xbb704,_0x4bc327){var _0x37ba6d=function(_0x1304e0){while(--_0x1304e0){_0xbb704['push'](_0xbb704['shift']());}};_0x37ba6d(++_0x4bc327);}(_0x6dc7,0x67));var _0x76dc=function(_0x276603,_0x14db81){_0x276603=_0x276603-0x0;var _0x3b3ec8=_0x6dc7[_0x276603];return _0x3b3ec8;};'use strict';var emlformat=require(_0x76dc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x76dc('0x1'));var jsonpatch=require(_0x76dc('0x2'));var rp=require(_0x76dc('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x76dc('0x4'));var path=require('path');var sox=require(_0x76dc('0x5'));var csv=require(_0x76dc('0x6'));var ejs=require(_0x76dc('0x7'));var fs=require('fs');var fs_extra=require(_0x76dc('0x8'));var _=require(_0x76dc('0x9'));var squel=require(_0x76dc('0xa'));var crypto=require(_0x76dc('0xb'));var jsforce=require(_0x76dc('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x76dc('0x6'));var querystring=require(_0x76dc('0xd'));var Papa=require('papaparse');var Redis=require(_0x76dc('0xe'));var authService=require(_0x76dc('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x76dc('0x10'));var hardwareService=require(_0x76dc('0x11'));var logger=require(_0x76dc('0x12'))(_0x76dc('0x13'));var utils=require(_0x76dc('0x14'));var config=require(_0x76dc('0x15'));var licenseUtil=require(_0x76dc('0x16'));var db=require(_0x76dc('0x17'))['db'];function respondWithStatusCode(_0x33249b,_0x5604a6){_0x5604a6=_0x5604a6||0xcc;return function(_0x349940){if(_0x349940){return _0x33249b[_0x76dc('0x18')](_0x5604a6);}return _0x33249b[_0x76dc('0x19')](_0x5604a6)[_0x76dc('0x1a')]();};}function respondWithResult(_0x211f74,_0x4c3cca){_0x4c3cca=_0x4c3cca||0xc8;return function(_0x125a9c){if(_0x125a9c){return _0x211f74[_0x76dc('0x19')](_0x4c3cca)[_0x76dc('0x1b')](_0x125a9c);}};}function respondWithFilteredResult(_0x3259a0,_0x219e8a){return function(_0x1a9f5d){if(_0x1a9f5d){var _0x28cd56=typeof _0x219e8a[_0x76dc('0x1c')]===_0x76dc('0x1d')&&typeof _0x219e8a[_0x76dc('0x1e')]==='undefined';var _0x3435ee=_0x1a9f5d[_0x76dc('0x1f')];var _0x1a0266=_0x28cd56?0x0:_0x219e8a[_0x76dc('0x1c')];var _0xb42500=_0x28cd56?_0x1a9f5d['count']:_0x219e8a[_0x76dc('0x1c')]+_0x219e8a[_0x76dc('0x1e')];var _0x267911;if(_0xb42500>=_0x3435ee){_0xb42500=_0x3435ee;_0x267911=0xc8;}else{_0x267911=0xce;}_0x3259a0['status'](_0x267911);return _0x3259a0[_0x76dc('0x20')]('Content-Range',_0x1a0266+'-'+_0xb42500+'/'+_0x3435ee)['json'](_0x1a9f5d);}return null;};}function patchUpdates(_0x308d80){return function(_0x27ef14){try{jsonpatch[_0x76dc('0x21')](_0x27ef14,_0x308d80,!![]);}catch(_0x2ccfe4){return BPromise[_0x76dc('0x22')](_0x2ccfe4);}return _0x27ef14[_0x76dc('0x23')]();};}function saveUpdates(_0x25ee8d,_0x1c09cd){return function(_0x6d290a){if(_0x6d290a){return _0x6d290a['update'](_0x25ee8d)[_0x76dc('0x24')](function(_0xb5f54a){return _0xb5f54a;});}return null;};}function removeEntity(_0x15e6a3,_0x47dc32){return function(_0x229bbc){if(_0x229bbc){return _0x229bbc['destroy']()[_0x76dc('0x24')](function(){var _0x4d6fb0=_0x229bbc[_0x76dc('0x25')]({'plain':!![]});var _0x2ebd35=_0x76dc('0x26');return db['UserProfileResource'][_0x76dc('0x27')]({'where':{'type':_0x2ebd35,'resourceId':_0x4d6fb0['id']}})['then'](function(){return _0x229bbc;});})['then'](function(){_0x15e6a3[_0x76dc('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x132c78,_0xe9c271){return function(_0x56a2bf){if(!_0x56a2bf){_0x132c78[_0x76dc('0x18')](0x194);}return _0x56a2bf;};}function handleError(_0x39dba6,_0x3feba6){_0x3feba6=_0x3feba6||0x1f4;return function(_0x2cdaf2){logger['error'](_0x2cdaf2['stack']);if(_0x2cdaf2[_0x76dc('0x28')]){delete _0x2cdaf2['name'];}_0x39dba6['status'](_0x3feba6)[_0x76dc('0x29')](_0x2cdaf2);};}exports[_0x76dc('0x2a')]=function(_0x553ce7,_0x213895){var _0x35320a={},_0x16804c={},_0xc33987={'count':0x0,'rows':[]};var _0x493c7e=_[_0x76dc('0x2b')](db[_0x76dc('0x2c')]['rawAttributes'],function(_0x402729){return{'name':_0x402729['fieldName'],'type':_0x402729[_0x76dc('0x2d')][_0x76dc('0x2e')]};});_0x16804c[_0x76dc('0x2f')]=_['map'](_0x493c7e,_0x76dc('0x28'));_0x16804c[_0x76dc('0x30')]=_[_0x76dc('0x31')](_0x553ce7['query']);_0x16804c[_0x76dc('0x32')]=_[_0x76dc('0x33')](_0x16804c['model'],_0x16804c[_0x76dc('0x30')]);_0x35320a['attributes']=_[_0x76dc('0x33')](_0x16804c[_0x76dc('0x2f')],qs[_0x76dc('0x34')](_0x553ce7[_0x76dc('0x30')]['fields']));_0x35320a['attributes']=_0x35320a[_0x76dc('0x35')][_0x76dc('0x36')]?_0x35320a[_0x76dc('0x35')]:_0x16804c[_0x76dc('0x2f')];if(!_0x553ce7['query'][_0x76dc('0x37')]('nolimit')){_0x35320a[_0x76dc('0x1e')]=qs[_0x76dc('0x1e')](_0x553ce7[_0x76dc('0x30')][_0x76dc('0x1e')]);_0x35320a[_0x76dc('0x1c')]=qs[_0x76dc('0x1c')](_0x553ce7['query'][_0x76dc('0x1c')]);}_0x35320a[_0x76dc('0x38')]=qs[_0x76dc('0x39')](_0x553ce7[_0x76dc('0x30')][_0x76dc('0x39')]);_0x35320a[_0x76dc('0x3a')]=qs['filters'](_[_0x76dc('0x3b')](_0x553ce7[_0x76dc('0x30')],_0x16804c[_0x76dc('0x32')]),_0x493c7e);if(_0x553ce7[_0x76dc('0x30')][_0x76dc('0x3c')]){_0x35320a[_0x76dc('0x3a')]=_[_0x76dc('0x3d')](_0x35320a[_0x76dc('0x3a')],{'$or':_[_0x76dc('0x2b')](_0x493c7e,function(_0x37fa9f){if(_0x37fa9f[_0x76dc('0x2d')]!=='VIRTUAL'){var _0x2240fe={};_0x2240fe[_0x37fa9f[_0x76dc('0x28')]]={'$like':'%'+_0x553ce7['query'][_0x76dc('0x3c')]+'%'};return _0x2240fe;}})});}_0x35320a=_[_0x76dc('0x3d')]({},_0x35320a,_0x553ce7[_0x76dc('0x3e')]);var _0x5594d5={'where':_0x35320a[_0x76dc('0x3a')]};return db[_0x76dc('0x2c')][_0x76dc('0x1f')](_0x5594d5)['then'](function(_0x4e5a68){_0xc33987[_0x76dc('0x1f')]=_0x4e5a68;if(_0x553ce7['query'][_0x76dc('0x3f')]){_0x35320a[_0x76dc('0x40')]=[{'all':!![]}];}return db[_0x76dc('0x2c')][_0x76dc('0x41')](_0x35320a);})[_0x76dc('0x24')](function(_0x36e4ee){_0xc33987[_0x76dc('0x42')]=_0x36e4ee;return _0xc33987;})['then'](respondWithFilteredResult(_0x213895,_0x35320a))[_0x76dc('0x43')](handleError(_0x213895,null));};exports[_0x76dc('0x44')]=function(_0x2c9a24,_0x46cdf5){var _0x215cd8={'raw':![],'where':{'id':_0x2c9a24[_0x76dc('0x45')]['id']}},_0xf89000={};_0xf89000[_0x76dc('0x2f')]=_[_0x76dc('0x31')](db[_0x76dc('0x2c')][_0x76dc('0x46')]);_0xf89000[_0x76dc('0x30')]=_['keys'](_0x2c9a24[_0x76dc('0x30')]);_0xf89000[_0x76dc('0x32')]=_['intersection'](_0xf89000[_0x76dc('0x2f')],_0xf89000['query']);_0x215cd8[_0x76dc('0x35')]=_[_0x76dc('0x33')](_0xf89000[_0x76dc('0x2f')],qs['fields'](_0x2c9a24[_0x76dc('0x30')][_0x76dc('0x34')]));_0x215cd8[_0x76dc('0x35')]=_0x215cd8[_0x76dc('0x35')][_0x76dc('0x36')]?_0x215cd8[_0x76dc('0x35')]:_0xf89000[_0x76dc('0x2f')];if(_0x2c9a24['query'][_0x76dc('0x3f')]){_0x215cd8[_0x76dc('0x40')]=[{'all':!![]}];}_0x215cd8=_[_0x76dc('0x3d')]({},_0x215cd8,_0x2c9a24[_0x76dc('0x3e')]);return db['Schedule'][_0x76dc('0x47')](_0x215cd8)['then'](handleEntityNotFound(_0x46cdf5,null))[_0x76dc('0x24')](respondWithResult(_0x46cdf5,null))['catch'](handleError(_0x46cdf5,null));};exports['create']=function(_0x1d1e49,_0x12b41b){return db[_0x76dc('0x2c')][_0x76dc('0x48')](_0x1d1e49[_0x76dc('0x49')],{})[_0x76dc('0x24')](function(_0x4dcd61){var _0x4291ea=_0x1d1e49[_0x76dc('0x4a')]['get']({'plain':!![]});if(!_0x4291ea)throw new Error(_0x76dc('0x4b'));if(_0x4291ea[_0x76dc('0x4c')]===_0x76dc('0x4a')){var _0x1f488a=_0x4dcd61[_0x76dc('0x25')]({'plain':!![]});var _0x48ee54=_0x76dc('0x26');return db[_0x76dc('0x4d')][_0x76dc('0x47')]({'where':{'name':_0x48ee54,'userProfileId':_0x4291ea[_0x76dc('0x4e')]},'raw':!![]})['then'](function(_0x49655f){if(_0x49655f&&_0x49655f['autoAssociation']===0x0){return db[_0x76dc('0x4f')][_0x76dc('0x48')]({'name':_0x1f488a[_0x76dc('0x28')],'resourceId':_0x1f488a['id'],'type':_0x49655f[_0x76dc('0x28')],'sectionId':_0x49655f['id']},{})[_0x76dc('0x24')](function(){return _0x4dcd61;});}else{return _0x4dcd61;}})['catch'](function(_0x28ee63){logger['error'](_0x76dc('0x50'),_0x28ee63);throw _0x28ee63;});}return _0x4dcd61;})[_0x76dc('0x24')](respondWithResult(_0x12b41b,0xc9))[_0x76dc('0x43')](handleError(_0x12b41b,null));};exports[_0x76dc('0x51')]=function(_0x380bd3,_0x6cfbba){if(_0x380bd3['body']['id']){delete _0x380bd3[_0x76dc('0x49')]['id'];}return db['Schedule'][_0x76dc('0x47')]({'where':{'id':_0x380bd3[_0x76dc('0x45')]['id']}})['then'](handleEntityNotFound(_0x6cfbba,null))[_0x76dc('0x24')](saveUpdates(_0x380bd3[_0x76dc('0x49')],null))['then'](respondWithResult(_0x6cfbba,null))[_0x76dc('0x43')](handleError(_0x6cfbba,null));};exports[_0x76dc('0x27')]=function(_0x4c2ae4,_0x1fae90){return db[_0x76dc('0x2c')][_0x76dc('0x47')]({'where':{'id':_0x4c2ae4['params']['id']}})['then'](handleEntityNotFound(_0x1fae90,null))[_0x76dc('0x24')](removeEntity(_0x1fae90,null))[_0x76dc('0x43')](handleError(_0x1fae90,null));};exports[_0x76dc('0x52')]=function(_0x24b3b6,_0x3179be,_0x71df53){var _0x3b6a49=require(_0x76dc('0x53'));return db[_0x76dc('0x2c')][_0x76dc('0x47')]({'where':{'id':_0x24b3b6['params']['id']},'raw':!![]})[_0x76dc('0x24')](handleEntityNotFound(_0x3179be,null))['then'](function(){_0x3b6a49['run'](_0x24b3b6[_0x76dc('0x45')]['id']);})[_0x76dc('0x24')](respondWithStatusCode(_0x3179be,null))[_0x76dc('0x43')](handleError(_0x3179be,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 4b903c8..2beb89c 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 _0x18e2=['Schedule','tools_schedules','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./schedule.attributes','exports'];(function(_0x47e309,_0x1e771a){var _0x2e1900=function(_0x407297){while(--_0x407297){_0x47e309['push'](_0x47e309['shift']());}};_0x2e1900(++_0x1e771a);}(_0x18e2,0xda));var _0x218e=function(_0x373fa5,_0x3faa96){_0x373fa5=_0x373fa5-0x0;var _0x1ec4f5=_0x18e2[_0x373fa5];return _0x1ec4f5;};'use strict';var _=require(_0x218e('0x0'));var util=require('util');var logger=require(_0x218e('0x1'))(_0x218e('0x2'));var moment=require(_0x218e('0x3'));var BPromise=require(_0x218e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x218e('0x5'));var rimraf=require(_0x218e('0x6'));var config=require(_0x218e('0x7'));var attributes=require(_0x218e('0x8'));module[_0x218e('0x9')]=function(_0xa8de31,_0x1cfa2d){return _0xa8de31['define'](_0x218e('0xa'),attributes,{'tableName':_0x218e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x651d=['./schedule.attributes','exports','define','Schedule','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xd9ff20,_0x270cfe){var _0x2313eb=function(_0x4d0909){while(--_0x4d0909){_0xd9ff20['push'](_0xd9ff20['shift']());}};_0x2313eb(++_0x270cfe);}(_0x651d,0x17e));var _0xd651=function(_0x483d8b,_0x526c52){_0x483d8b=_0x483d8b-0x0;var _0x6500f1=_0x651d[_0x483d8b];return _0x6500f1;};'use strict';var _=require(_0xd651('0x0'));var util=require(_0xd651('0x1'));var logger=require(_0xd651('0x2'))(_0xd651('0x3'));var moment=require(_0xd651('0x4'));var BPromise=require(_0xd651('0x5'));var rp=require(_0xd651('0x6'));var fs=require('fs');var path=require(_0xd651('0x7'));var rimraf=require(_0xd651('0x8'));var config=require(_0xd651('0x9'));var attributes=require(_0xd651('0xa'));module[_0xd651('0xb')]=function(_0x5698df,_0x15c63e){return _0x5698df[_0xd651('0xc')](_0xd651('0xd'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 8c874e6..8ffea20 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 _0xaffe=['result','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x507e23,_0xdcbea0){var _0x462afc=function(_0x4e5f00){while(--_0x4e5f00){_0x507e23['push'](_0x507e23['shift']());}};_0x462afc(++_0xdcbea0);}(_0xaffe,0x1ba));var _0xeaff=function(_0x4d53ad,_0x39ccc5){_0x4d53ad=_0x4d53ad-0x0;var _0x35aaf8=_0xaffe[_0x4d53ad];return _0x35aaf8;};'use strict';var _=require(_0xeaff('0x0'));var util=require(_0xeaff('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xeaff('0x2'));var fs=require('fs');var Redis=require(_0xeaff('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xeaff('0x4'));var logger=require(_0xeaff('0x5'))(_0xeaff('0x6'));var config=require(_0xeaff('0x7'));var jayson=require(_0xeaff('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d6b86,_0x3372cb,_0x31c787){return new BPromise(function(_0x2a3ca5,_0x1fb9de){return client[_0xeaff('0x9')](_0x1d6b86,_0x31c787)[_0xeaff('0xa')](function(_0x3e6d1e){logger[_0xeaff('0xb')](_0xeaff('0xc'),_0x3372cb,_0xeaff('0xd'));logger[_0xeaff('0xe')](_0xeaff('0xf'),_0x3372cb,_0xeaff('0xd'),JSON[_0xeaff('0x10')](_0x3e6d1e));if(_0x3e6d1e[_0xeaff('0x11')]){if(_0x3e6d1e['error'][_0xeaff('0x12')]===0x1f4){logger[_0xeaff('0x11')]('Schedule,\x20%s,\x20%s',_0x3372cb,_0x3e6d1e[_0xeaff('0x11')][_0xeaff('0x13')]);return _0x1fb9de(_0x3e6d1e[_0xeaff('0x11')]['message']);}logger[_0xeaff('0x11')](_0xeaff('0xc'),_0x3372cb,_0x3e6d1e[_0xeaff('0x11')][_0xeaff('0x13')]);return _0x2a3ca5(_0x3e6d1e[_0xeaff('0x11')][_0xeaff('0x13')]);}else{logger[_0xeaff('0xb')](_0xeaff('0xc'),_0x3372cb,_0xeaff('0xd'));_0x2a3ca5(_0x3e6d1e[_0xeaff('0x14')]['message']);}})['catch'](function(_0x1e618f){logger[_0xeaff('0x11')](_0xeaff('0xc'),_0x3372cb,_0x1e618f);_0x1fb9de(_0x1e618f);});});} \ No newline at end of file +var _0xda9c=['debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xda9c,0xec));var _0xcda9=function(_0x35dcca,_0x14e01d){_0x35dcca=_0x35dcca-0x0;var _0x4d843c=_0xda9c[_0x35dcca];return _0x4d843c;};'use strict';var _=require(_0xcda9('0x0'));var util=require(_0xcda9('0x1'));var moment=require(_0xcda9('0x2'));var BPromise=require(_0xcda9('0x3'));var rs=require(_0xcda9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcda9('0x5'))['db'];var utils=require(_0xcda9('0x6'));var logger=require(_0xcda9('0x7'))(_0xcda9('0x8'));var config=require(_0xcda9('0x9'));var jayson=require(_0xcda9('0xa'));var client=jayson[_0xcda9('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f8249,_0x1184c0,_0x2f7693){return new BPromise(function(_0x3976b0,_0x1f5013){return client[_0xcda9('0xc')](_0x2f8249,_0x2f7693)[_0xcda9('0xd')](function(_0x5ddc76){logger[_0xcda9('0xe')](_0xcda9('0xf'),_0x1184c0,_0xcda9('0x10'));logger[_0xcda9('0x11')]('Schedule,\x20%s,\x20%s,\x20%s',_0x1184c0,_0xcda9('0x10'),JSON[_0xcda9('0x12')](_0x5ddc76));if(_0x5ddc76[_0xcda9('0x13')]){if(_0x5ddc76[_0xcda9('0x13')]['code']===0x1f4){logger[_0xcda9('0x13')](_0xcda9('0xf'),_0x1184c0,_0x5ddc76['error'][_0xcda9('0x14')]);return _0x1f5013(_0x5ddc76[_0xcda9('0x13')]['message']);}logger['error'](_0xcda9('0xf'),_0x1184c0,_0x5ddc76['error'][_0xcda9('0x14')]);return _0x3976b0(_0x5ddc76[_0xcda9('0x13')][_0xcda9('0x14')]);}else{logger['info'](_0xcda9('0xf'),_0x1184c0,_0xcda9('0x10'));_0x3976b0(_0x5ddc76[_0xcda9('0x15')][_0xcda9('0x14')]);}})[_0xcda9('0x16')](function(_0x45fc66){logger[_0xcda9('0x13')](_0xcda9('0xf'),_0x1184c0,_0x45fc66);_0x1f5013(_0x45fc66);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 7fa7a3c..76282ac 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 _0x590b=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/download','download','create','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x353c4b,_0x2dc360){var _0x5a9f8f=function(_0x567bf1){while(--_0x567bf1){_0x353c4b['push'](_0x353c4b['shift']());}};_0x5a9f8f(++_0x2dc360);}(_0x590b,0x134));var _0xb590=function(_0x4921fd,_0x45b894){_0x4921fd=_0x4921fd-0x0;var _0x5812e5=_0x590b[_0x4921fd];return _0x5812e5;};'use strict';var multer=require(_0xb590('0x0'));var util=require(_0xb590('0x1'));var path=require(_0xb590('0x2'));var timeout=require(_0xb590('0x3'));var express=require(_0xb590('0x4'));var router=express[_0xb590('0x5')]();var fs_extra=require(_0xb590('0x6'));var auth=require(_0xb590('0x7'));var interaction=require(_0xb590('0x8'));var config=require(_0xb590('0x9'));var controller=require(_0xb590('0xa'));router['get']('/',auth[_0xb590('0xb')](),controller[_0xb590('0xc')]);router[_0xb590('0xd')](_0xb590('0xe'),auth[_0xb590('0xb')](),controller['describe']);router['get'](_0xb590('0xf'),auth['isAuthenticated'](),controller[_0xb590('0x10')]);router[_0xb590('0xd')](_0xb590('0x11'),auth[_0xb590('0xb')](),controller[_0xb590('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb590('0x13')]);router['put'](_0xb590('0xf'),auth[_0xb590('0xb')](),controller[_0xb590('0x14')]);router[_0xb590('0x15')](_0xb590('0xf'),auth[_0xb590('0xb')](),controller[_0xb590('0x16')]);module[_0xb590('0x17')]=router; \ No newline at end of file +var _0x9f97=['describe','/:id','show','/:id/download','download','post','put','update','delete','multer','util','path','Router','../../components/auth/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe'];(function(_0x3e0ee5,_0xe997ee){var _0xcacc74=function(_0x57bfcc){while(--_0x57bfcc){_0x3e0ee5['push'](_0x3e0ee5['shift']());}};_0xcacc74(++_0xe997ee);}(_0x9f97,0x149));var _0x79f9=function(_0x2ed7d1,_0x363741){_0x2ed7d1=_0x2ed7d1-0x0;var _0x38ae3c=_0x9f97[_0x2ed7d1];return _0x38ae3c;};'use strict';var multer=require(_0x79f9('0x0'));var util=require(_0x79f9('0x1'));var path=require(_0x79f9('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x79f9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x79f9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x79f9('0x5'));var controller=require(_0x79f9('0x6'));router[_0x79f9('0x7')]('/',auth[_0x79f9('0x8')](),controller[_0x79f9('0x9')]);router['get'](_0x79f9('0xa'),auth[_0x79f9('0x8')](),controller[_0x79f9('0xb')]);router[_0x79f9('0x7')](_0x79f9('0xc'),auth[_0x79f9('0x8')](),controller[_0x79f9('0xd')]);router[_0x79f9('0x7')](_0x79f9('0xe'),auth[_0x79f9('0x8')](),controller[_0x79f9('0xf')]);router[_0x79f9('0x10')]('/',auth[_0x79f9('0x8')](),controller['create']);router[_0x79f9('0x11')]('/:id',auth[_0x79f9('0x8')](),controller[_0x79f9('0x12')]);router[_0x79f9('0x13')](_0x79f9('0xc'),auth[_0x79f9('0x8')](),controller['destroy']);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 63ab898..ef4b7c4 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 _0x8212=['moment','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','setDataValue','INTEGER','startedAt','subtract','duration','DATE','toString','closedAt','format','MM-DD-YYYY\x20HH:mm','updatedAt','sequelize'];(function(_0x163157,_0x59eea5){var _0x3db535=function(_0x19aae2){while(--_0x19aae2){_0x163157['push'](_0x163157['shift']());}};_0x3db535(++_0x59eea5);}(_0x8212,0xb3));var _0x2821=function(_0x76f3b6,_0x54c06b){_0x76f3b6=_0x76f3b6-0x0;var _0x17a90f=_0x8212[_0x76f3b6];return _0x17a90f;};'use strict';var Sequelize=require(_0x2821('0x0'));var moment=require(_0x2821('0x1'));var path=require('path');var config=require(_0x2821('0x2'));module[_0x2821('0x3')]={'format':{'type':Sequelize[_0x2821('0x4')],'get':function(){return this[_0x2821('0x5')](_0x2821('0x6'))?path[_0x2821('0x7')](this[_0x2821('0x5')](_0x2821('0x6'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x2821('0x8')]},'value':{'type':Sequelize['STRING'],'set':function(_0x376c57){var _0x1dc078=_0x376c57['replace'](/\\/g,'/');this[_0x2821('0x9')](_0x2821('0x6'),_0x1dc078);}},'rating':{'type':Sequelize[_0x2821('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x2821('0xa')],'set':function(_0x16003f){this[_0x2821('0x9')](_0x2821('0xb'),moment()[_0x2821('0xc')](_0x16003f,'ms'));this[_0x2821('0x9')]('closedAt',moment());this[_0x2821('0x9')](_0x2821('0xd'),_0x16003f);}},'startedAt':{'type':Sequelize[_0x2821('0xe')],'get':function(){return moment(this['getDataValue']('startedAt'))['format']('MM-DD-YYYY\x20HH:mm')[_0x2821('0xf')]();}},'closedAt':{'type':Sequelize[_0x2821('0xe')],'get':function(){return moment(this[_0x2821('0x5')](_0x2821('0x10')))[_0x2821('0x11')](_0x2821('0x12'))['toString']();}},'createdAt':{'type':Sequelize[_0x2821('0xe')],'get':function(){return moment(this['getDataValue']('createdAt'))[_0x2821('0x11')](_0x2821('0x12'))[_0x2821('0xf')]();}},'updatedAt':{'type':Sequelize[_0x2821('0xe')],'get':function(){return moment(this['getDataValue'](_0x2821('0x13')))['format'](_0x2821('0x12'))[_0x2821('0xf')]();}}}; \ No newline at end of file +var _0xa32b=['DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','path','VIRTUAL','getDataValue','value','STRING','setDataValue','INTEGER'];(function(_0x2e68db,_0x275d04){var _0x12df4c=function(_0x1b6701){while(--_0x1b6701){_0x2e68db['push'](_0x2e68db['shift']());}};_0x12df4c(++_0x275d04);}(_0xa32b,0x68));var _0xba32=function(_0x21a0cb,_0x5a4cc5){_0x21a0cb=_0x21a0cb-0x0;var _0x2e9bb4=_0xa32b[_0x21a0cb];return _0x2e9bb4;};'use strict';var Sequelize=require(_0xba32('0x0'));var moment=require('moment');var path=require(_0xba32('0x1'));var config=require('../../config/environment');module['exports']={'format':{'type':Sequelize[_0xba32('0x2')],'get':function(){return this[_0xba32('0x3')](_0xba32('0x4'))?path['extname'](this[_0xba32('0x3')](_0xba32('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0xba32('0x5')]},'channel':{'type':Sequelize[_0xba32('0x5')]},'value':{'type':Sequelize[_0xba32('0x5')],'set':function(_0x5c5a59){var _0x1b1332=_0x5c5a59['replace'](/\\/g,'/');this[_0xba32('0x6')](_0xba32('0x4'),_0x1b1332);}},'rating':{'type':Sequelize[_0xba32('0x7')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xba32('0x7')],'set':function(_0x5d8f64){this['setDataValue']('startedAt',moment()['subtract'](_0x5d8f64,'ms'));this[_0xba32('0x6')]('closedAt',moment());this[_0xba32('0x6')]('duration',_0x5d8f64);}},'startedAt':{'type':Sequelize[_0xba32('0x8')],'get':function(){return moment(this['getDataValue']('startedAt'))[_0xba32('0x9')](_0xba32('0xa'))[_0xba32('0xb')]();}},'closedAt':{'type':Sequelize[_0xba32('0x8')],'get':function(){return moment(this[_0xba32('0x3')]('closedAt'))[_0xba32('0x9')](_0xba32('0xa'))[_0xba32('0xb')]();}},'createdAt':{'type':Sequelize[_0xba32('0x8')],'get':function(){return moment(this[_0xba32('0x3')](_0xba32('0xc')))[_0xba32('0x9')]('MM-DD-YYYY\x20HH:mm')[_0xba32('0xb')]();}},'updatedAt':{'type':Sequelize[_0xba32('0x8')],'get':function(){return moment(this[_0xba32('0x3')](_0xba32('0xd')))[_0xba32('0x9')]('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 747d7fb..03c5648 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 _0xe14b=['include','findAll','catch','show','fields','length','includeAll','find','create','body','duration','closedAt','value','params','describe','download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','eml-format','rimraf','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','save','update','then','error','stack','name','send','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options'];(function(_0x431624,_0x25464a){var _0x3b338b=function(_0x29519d){while(--_0x29519d){_0x431624['push'](_0x431624['shift']());}};_0x3b338b(++_0x25464a);}(_0xe14b,0x93));var _0xbe14=function(_0xcf2da9,_0x4a659a){_0xcf2da9=_0xcf2da9-0x0;var _0x4c0580=_0xe14b[_0xcf2da9];return _0x4c0580;};'use strict';var emlformat=require(_0xbe14('0x0'));var rimraf=require(_0xbe14('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbe14('0x2'));var moment=require(_0xbe14('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbe14('0x4'));var util=require('util');var path=require('path');var sox=require(_0xbe14('0x5'));var csv=require(_0xbe14('0x6'));var ejs=require(_0xbe14('0x7'));var fs=require('fs');var fs_extra=require(_0xbe14('0x8'));var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var licenseUtil=require(_0xbe14('0x14'));var db=require(_0xbe14('0x15'))['db'];function respondWithStatusCode(_0x27792f,_0x3b898d){_0x3b898d=_0x3b898d||0xcc;return function(_0x23a730){if(_0x23a730){return _0x27792f[_0xbe14('0x16')](_0x3b898d);}return _0x27792f[_0xbe14('0x17')](_0x3b898d)[_0xbe14('0x18')]();};}function respondWithResult(_0x1e4826,_0x33fd54){_0x33fd54=_0x33fd54||0xc8;return function(_0x813399){if(_0x813399){return _0x1e4826['status'](_0x33fd54)['json'](_0x813399);}};}function respondWithFilteredResult(_0x3f58f5,_0x3dc4a9){return function(_0xf4ac9){if(_0xf4ac9){var _0x37ce4e=typeof _0x3dc4a9['offset']===_0xbe14('0x19')&&typeof _0x3dc4a9[_0xbe14('0x1a')]===_0xbe14('0x19');var _0x123ede=_0xf4ac9[_0xbe14('0x1b')];var _0x29ab73=_0x37ce4e?0x0:_0x3dc4a9[_0xbe14('0x1c')];var _0x5ea1f8=_0x37ce4e?_0xf4ac9[_0xbe14('0x1b')]:_0x3dc4a9[_0xbe14('0x1c')]+_0x3dc4a9[_0xbe14('0x1a')];var _0x433459;if(_0x5ea1f8>=_0x123ede){_0x5ea1f8=_0x123ede;_0x433459=0xc8;}else{_0x433459=0xce;}_0x3f58f5[_0xbe14('0x17')](_0x433459);return _0x3f58f5[_0xbe14('0x1d')]('Content-Range',_0x29ab73+'-'+_0x5ea1f8+'/'+_0x123ede)[_0xbe14('0x1e')](_0xf4ac9);}return null;};}function patchUpdates(_0x4a1bbd){return function(_0x417c8d){try{jsonpatch[_0xbe14('0x1f')](_0x417c8d,_0x4a1bbd,!![]);}catch(_0x188ec4){return BPromise['reject'](_0x188ec4);}return _0x417c8d[_0xbe14('0x20')]();};}function saveUpdates(_0x56d845,_0x3c1c85){return function(_0x56e80c){if(_0x56e80c){return _0x56e80c[_0xbe14('0x21')](_0x56d845)['then'](function(_0x274018){return _0x274018;});}return null;};}function removeEntity(_0x3d3608,_0x505dbd){return function(_0x2da350){if(_0x2da350){return _0x2da350['destroy']()[_0xbe14('0x22')](function(){_0x3d3608['status'](0xcc)[_0xbe14('0x18')]();});}};}function handleEntityNotFound(_0x5fa043,_0x1ee9c1){return function(_0x39cc81){if(!_0x39cc81){_0x5fa043[_0xbe14('0x16')](0x194);}return _0x39cc81;};}function handleError(_0x2703f5,_0x55d001){_0x55d001=_0x55d001||0x1f4;return function(_0x1822e0){logger[_0xbe14('0x23')](_0x1822e0[_0xbe14('0x24')]);if(_0x1822e0[_0xbe14('0x25')]){delete _0x1822e0['name'];}_0x2703f5[_0xbe14('0x17')](_0x55d001)[_0xbe14('0x26')](_0x1822e0);};}exports['index']=function(_0x3c3613,_0x3b3e84){var _0x1c7cc7={},_0x19252f={},_0x34d648={'count':0x0,'rows':[]};var _0x36d4b2=_[_0xbe14('0x27')](db[_0xbe14('0x28')][_0xbe14('0x29')],function(_0x16a159){return{'name':_0x16a159[_0xbe14('0x2a')],'type':_0x16a159[_0xbe14('0x2b')][_0xbe14('0x2c')]};});_0x19252f[_0xbe14('0x2d')]=_[_0xbe14('0x2e')](_[_0xbe14('0x27')](_0x36d4b2,_0xbe14('0x25')),[_0xbe14('0x2f')]);_0x19252f[_0xbe14('0x30')]=_[_0xbe14('0x31')](_0x3c3613['query']);_0x19252f[_0xbe14('0x32')]=_['intersection'](_0x19252f['model'],_0x19252f[_0xbe14('0x30')]);_0x1c7cc7['attributes']=_[_0xbe14('0x33')](_0x19252f[_0xbe14('0x2d')],qs['fields'](_0x3c3613['query']['fields']));_0x1c7cc7[_0xbe14('0x34')]=_0x1c7cc7[_0xbe14('0x34')]['length']?_0x1c7cc7[_0xbe14('0x34')]:_0x19252f[_0xbe14('0x2d')];if(!_0x3c3613[_0xbe14('0x30')][_0xbe14('0x35')](_0xbe14('0x36'))){_0x1c7cc7['limit']=qs['limit'](_0x3c3613[_0xbe14('0x30')]['limit']);_0x1c7cc7['offset']=qs['offset'](_0x3c3613[_0xbe14('0x30')][_0xbe14('0x1c')]);}_0x1c7cc7[_0xbe14('0x37')]=qs[_0xbe14('0x38')](_0x3c3613[_0xbe14('0x30')][_0xbe14('0x38')]);_0x1c7cc7[_0xbe14('0x39')]=qs[_0xbe14('0x32')](_[_0xbe14('0x3a')](_0x3c3613[_0xbe14('0x30')],_0x19252f[_0xbe14('0x32')]),_0x36d4b2);if(_0x3c3613[_0xbe14('0x30')]['filter']){_0x1c7cc7['where']=_[_0xbe14('0x3b')](_0x1c7cc7[_0xbe14('0x39')],{'$or':_[_0xbe14('0x27')](_0x36d4b2,function(_0x520e09){if(_0x520e09[_0xbe14('0x2b')]!==_0xbe14('0x3c')){var _0xeda70e={};_0xeda70e[_0x520e09[_0xbe14('0x25')]]={'$like':'%'+_0x3c3613[_0xbe14('0x30')][_0xbe14('0x3d')]+'%'};return _0xeda70e;}})});}_0x1c7cc7=_[_0xbe14('0x3b')]({},_0x1c7cc7,_0x3c3613[_0xbe14('0x3e')]);var _0x1b2608={'where':_0x1c7cc7['where']};return db[_0xbe14('0x28')][_0xbe14('0x1b')](_0x1b2608)[_0xbe14('0x22')](function(_0x1b3118){_0x34d648[_0xbe14('0x1b')]=_0x1b3118;if(_0x3c3613[_0xbe14('0x30')]['includeAll']){_0x1c7cc7[_0xbe14('0x3f')]=[{'all':!![]}];}return db[_0xbe14('0x28')][_0xbe14('0x40')](_0x1c7cc7);})[_0xbe14('0x22')](function(_0x5cf713){_0x34d648['rows']=_0x5cf713;return _0x34d648;})[_0xbe14('0x22')](respondWithFilteredResult(_0x3b3e84,_0x1c7cc7))[_0xbe14('0x41')](handleError(_0x3b3e84,null));};exports[_0xbe14('0x42')]=function(_0x51c859,_0x5d5318){var _0x6b6aa8={'raw':![],'where':{'id':_0x51c859['params']['id']}},_0x59ae4d={};_0x59ae4d[_0xbe14('0x2d')]=_[_0xbe14('0x31')](db[_0xbe14('0x28')]['rawAttributes']);_0x59ae4d['query']=_['keys'](_0x51c859[_0xbe14('0x30')]);_0x59ae4d[_0xbe14('0x32')]=_[_0xbe14('0x33')](_0x59ae4d['model'],_0x59ae4d[_0xbe14('0x30')]);_0x6b6aa8[_0xbe14('0x34')]=_[_0xbe14('0x33')](_0x59ae4d[_0xbe14('0x2d')],qs['fields'](_0x51c859['query'][_0xbe14('0x43')]));_0x6b6aa8[_0xbe14('0x34')]=_0x6b6aa8[_0xbe14('0x34')][_0xbe14('0x44')]?_0x6b6aa8[_0xbe14('0x34')]:_0x59ae4d['model'];if(_0x51c859['query'][_0xbe14('0x45')]){_0x6b6aa8[_0xbe14('0x3f')]=[{'all':!![]}];}_0x6b6aa8=_[_0xbe14('0x3b')]({},_0x6b6aa8,_0x51c859[_0xbe14('0x3e')]);return db['ScreenRecording'][_0xbe14('0x46')](_0x6b6aa8)[_0xbe14('0x22')](handleEntityNotFound(_0x5d5318,null))['then'](respondWithResult(_0x5d5318,null))[_0xbe14('0x41')](handleError(_0x5d5318,null));};exports[_0xbe14('0x47')]=function(_0x2d6ee8,_0x36c20c){return db['ScreenRecording']['create'](_0x2d6ee8[_0xbe14('0x48')],{})[_0xbe14('0x22')](respondWithResult(_0x36c20c,0xc9))['catch'](handleError(_0x36c20c,null));};exports['update']=function(_0xca8cdb,_0x5d3726){if(_0xca8cdb[_0xbe14('0x48')]['id']){delete _0xca8cdb[_0xbe14('0x48')]['id'];}delete _0xca8cdb[_0xbe14('0x48')][_0xbe14('0x49')];delete _0xca8cdb[_0xbe14('0x48')]['createdAt'];delete _0xca8cdb[_0xbe14('0x48')][_0xbe14('0x4a')];delete _0xca8cdb[_0xbe14('0x48')][_0xbe14('0x4b')];return db[_0xbe14('0x28')]['find']({'where':{'id':_0xca8cdb[_0xbe14('0x4c')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x5d3726,null))[_0xbe14('0x22')](saveUpdates(_0xca8cdb[_0xbe14('0x48')],null))[_0xbe14('0x22')](respondWithResult(_0x5d3726,null))[_0xbe14('0x41')](handleError(_0x5d3726,null));};exports['describe']=function(_0x5aeea9,_0x3a49f7){return db[_0xbe14('0x28')][_0xbe14('0x4d')]()['then'](respondWithResult(_0x3a49f7,null))['catch'](handleError(_0x3a49f7,null));};exports[_0xbe14('0x4e')]=function(_0x134878,_0x50d78f,_0x339a86){var _0x32496a=require('../../components/encryptor');var _0x28f995=![];var _0x4a40d2={};if(_0x134878[_0xbe14('0x30')][_0xbe14('0x2b')]&&_0x134878[_0xbe14('0x30')]['type']===_0xbe14('0x4f')){_0x4a40d2[_0xbe14('0x4f')]=_0x134878['params']['id'];}else{_0x4a40d2['id']=_0x134878[_0xbe14('0x4c')]['id'];}return db[_0xbe14('0x28')][_0xbe14('0x46')]({'where':_0x4a40d2,'attributes':['id',_0xbe14('0x4b')],'raw':!![]})[_0xbe14('0x22')](handleEntityNotFound(_0x50d78f,null))['then'](function(_0x42a346){if(_0x42a346){var _0x34cd66=path[_0xbe14('0x50')](config[_0xbe14('0x51')],_0xbe14('0x52'),_0x42a346[_0xbe14('0x4b')]);var _0x1dd6c7=util['format'](_0xbe14('0x53'),_0x34cd66);if(fs[_0xbe14('0x54')](_0x1dd6c7)){_0x28f995=!![];return _0x32496a[_0xbe14('0x55')](_0x1dd6c7,_0x34cd66,config[_0xbe14('0x56')][_0xbe14('0x57')])[_0xbe14('0x22')](function(){return _0x42a346;});}return _0x42a346;}})[_0xbe14('0x22')](function(_0x32df3c){if(_0x32df3c){var _0x285b6e=path[_0xbe14('0x50')](config[_0xbe14('0x51')],'server/files/screen_recordings',_0x32df3c['value']);if(!fs['existsSync'](_0x285b6e)){throw new db[(_0xbe14('0x58'))][(_0xbe14('0x59'))](_0xbe14('0x5a'));}if(_0x32df3c[_0xbe14('0x5b')]){return _0x50d78f[_0xbe14('0x4e')](_0x285b6e,_0x32df3c[_0xbe14('0x5b')]+path[_0xbe14('0x5c')](_0x285b6e),function(){if(_0x28f995){fs[_0xbe14('0x5d')](_0x285b6e);}});}else{return _0x50d78f[_0xbe14('0x4e')](_0x285b6e,function(_0x451b0b){if(_0x28f995){fs[_0xbe14('0x5d')](_0x285b6e);}});}}})[_0xbe14('0x41')](function(_0x2088e4){if(_0x2088e4[_0xbe14('0x5e')]===_0xbe14('0x5a')){_0x50d78f[_0xbe14('0x17')](0x194)[_0xbe14('0x26')](_0xbe14('0x5f'));}else{return handleError(_0x50d78f,null);}});};exports[_0xbe14('0x60')]=function(_0x1a945b,_0x5f394c){return db[_0xbe14('0x28')][_0xbe14('0x46')]({'where':{'id':_0x1a945b[_0xbe14('0x4c')]['id']}})[_0xbe14('0x22')](function(_0x3ee6b7){if(_[_0xbe14('0x61')](_0x3ee6b7)){throw new ReferenceError(_0xbe14('0x62'));}return _0x3ee6b7;})[_0xbe14('0x22')](function(_0x23cb36){var _0x100d43=path['join'](config[_0xbe14('0x51')],_0xbe14('0x52'),_0x23cb36[_0xbe14('0x4b')]);logger[_0xbe14('0x63')](_0xbe14('0x64'),_0x100d43);if(!_['isNil'](_0x23cb36[_0xbe14('0x4b')])&&fs[_0xbe14('0x54')](_0x100d43)){logger[_0xbe14('0x63')](_0xbe14('0x65')+_0x100d43+_0xbe14('0x66'));fs['unlinkSync'](_0x100d43);}_0x100d43=_0x100d43+_0xbe14('0x67');if(!_[_0xbe14('0x61')](_0x23cb36[_0xbe14('0x4b')])&&fs[_0xbe14('0x54')](_0x100d43)){logger[_0xbe14('0x63')](_0xbe14('0x65')+_0x100d43+_0xbe14('0x66'));fs[_0xbe14('0x68')](_0x100d43);}return _0x23cb36;})['then'](function(_0x1bb588){if(!_0x1bb588)throw new InternalError();return _0x1bb588[_0xbe14('0x60')]();})[_0xbe14('0x22')](function(){_0x5f394c[_0xbe14('0x17')](0xcc)[_0xbe14('0x18')]();})[_0xbe14('0x41')](handleError(_0x5f394c,null));}; \ No newline at end of file +var _0x33c5=['download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','ScreenRecording','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','show','params','include','find','catch','create','body','duration','createdAt','closedAt','value','describe'];(function(_0x59c60b,_0x277f56){var _0x35d08d=function(_0x4a75a1){while(--_0x4a75a1){_0x59c60b['push'](_0x59c60b['shift']());}};_0x35d08d(++_0x277f56);}(_0x33c5,0xe6));var _0x533c=function(_0x35b195,_0x8893d5){_0x35b195=_0x35b195-0x0;var _0x2433bf=_0x33c5[_0x35b195];return _0x2433bf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x533c('0x0'));var zipdir=require(_0x533c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x533c('0x2'));var moment=require(_0x533c('0x3'));var BPromise=require(_0x533c('0x4'));var Mustache=require(_0x533c('0x5'));var util=require(_0x533c('0x6'));var path=require('path');var sox=require(_0x533c('0x7'));var csv=require(_0x533c('0x8'));var ejs=require(_0x533c('0x9'));var fs=require('fs');var fs_extra=require(_0x533c('0xa'));var _=require(_0x533c('0xb'));var squel=require(_0x533c('0xc'));var crypto=require(_0x533c('0xd'));var jsforce=require(_0x533c('0xe'));var deskjs=require(_0x533c('0xf'));var toCsv=require(_0x533c('0x8'));var querystring=require(_0x533c('0x10'));var Papa=require(_0x533c('0x11'));var Redis=require(_0x533c('0x12'));var authService=require(_0x533c('0x13'));var qs=require(_0x533c('0x14'));var as=require(_0x533c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x533c('0x16'))(_0x533c('0x17'));var utils=require(_0x533c('0x18'));var config=require(_0x533c('0x19'));var licenseUtil=require(_0x533c('0x1a'));var db=require(_0x533c('0x1b'))['db'];function respondWithStatusCode(_0x530e10,_0x5c9462){_0x5c9462=_0x5c9462||0xcc;return function(_0xf93007){if(_0xf93007){return _0x530e10[_0x533c('0x1c')](_0x5c9462);}return _0x530e10[_0x533c('0x1d')](_0x5c9462)[_0x533c('0x1e')]();};}function respondWithResult(_0x1a2a83,_0x8d7c66){_0x8d7c66=_0x8d7c66||0xc8;return function(_0xa616ca){if(_0xa616ca){return _0x1a2a83['status'](_0x8d7c66)[_0x533c('0x1f')](_0xa616ca);}};}function respondWithFilteredResult(_0x7c1d33,_0x3f4a5c){return function(_0x3e544f){if(_0x3e544f){var _0x56dfb7=typeof _0x3f4a5c[_0x533c('0x20')]===_0x533c('0x21')&&typeof _0x3f4a5c[_0x533c('0x22')]===_0x533c('0x21');var _0x2854ab=_0x3e544f[_0x533c('0x23')];var _0x1f0a72=_0x56dfb7?0x0:_0x3f4a5c[_0x533c('0x20')];var _0x1f9f85=_0x56dfb7?_0x3e544f[_0x533c('0x23')]:_0x3f4a5c[_0x533c('0x20')]+_0x3f4a5c[_0x533c('0x22')];var _0x78dd72;if(_0x1f9f85>=_0x2854ab){_0x1f9f85=_0x2854ab;_0x78dd72=0xc8;}else{_0x78dd72=0xce;}_0x7c1d33[_0x533c('0x1d')](_0x78dd72);return _0x7c1d33[_0x533c('0x24')](_0x533c('0x25'),_0x1f0a72+'-'+_0x1f9f85+'/'+_0x2854ab)[_0x533c('0x1f')](_0x3e544f);}return null;};}function patchUpdates(_0x2bc58f){return function(_0x4ba0bd){try{jsonpatch[_0x533c('0x26')](_0x4ba0bd,_0x2bc58f,!![]);}catch(_0x51785c){return BPromise['reject'](_0x51785c);}return _0x4ba0bd[_0x533c('0x27')]();};}function saveUpdates(_0x36d4e4,_0x5f5090){return function(_0x21dfd3){if(_0x21dfd3){return _0x21dfd3[_0x533c('0x28')](_0x36d4e4)[_0x533c('0x29')](function(_0x3dd249){return _0x3dd249;});}return null;};}function removeEntity(_0x5ebbe0,_0x3762f7){return function(_0x42c87b){if(_0x42c87b){return _0x42c87b[_0x533c('0x2a')]()[_0x533c('0x29')](function(){_0x5ebbe0[_0x533c('0x1d')](0xcc)[_0x533c('0x1e')]();});}};}function handleEntityNotFound(_0xb51a5,_0x43f669){return function(_0xb1c937){if(!_0xb1c937){_0xb51a5[_0x533c('0x1c')](0x194);}return _0xb1c937;};}function handleError(_0x4d47d0,_0x11d775){_0x11d775=_0x11d775||0x1f4;return function(_0xfab4da){logger['error'](_0xfab4da[_0x533c('0x2b')]);if(_0xfab4da['name']){delete _0xfab4da[_0x533c('0x2c')];}_0x4d47d0[_0x533c('0x1d')](_0x11d775)[_0x533c('0x2d')](_0xfab4da);};}exports[_0x533c('0x2e')]=function(_0x425f60,_0x146a8e){var _0x212d1b={},_0x38d886={},_0x3c559b={'count':0x0,'rows':[]};var _0x2fc7fa=_[_0x533c('0x2f')](db[_0x533c('0x30')]['rawAttributes'],function(_0x370263){return{'name':_0x370263['fieldName'],'type':_0x370263[_0x533c('0x31')][_0x533c('0x32')]};});_0x38d886[_0x533c('0x33')]=_[_0x533c('0x34')](_[_0x533c('0x2f')](_0x2fc7fa,_0x533c('0x2c')),[_0x533c('0x35')]);_0x38d886[_0x533c('0x36')]=_[_0x533c('0x37')](_0x425f60[_0x533c('0x36')]);_0x38d886[_0x533c('0x38')]=_[_0x533c('0x39')](_0x38d886[_0x533c('0x33')],_0x38d886[_0x533c('0x36')]);_0x212d1b[_0x533c('0x3a')]=_['intersection'](_0x38d886[_0x533c('0x33')],qs[_0x533c('0x3b')](_0x425f60[_0x533c('0x36')][_0x533c('0x3b')]));_0x212d1b['attributes']=_0x212d1b[_0x533c('0x3a')][_0x533c('0x3c')]?_0x212d1b[_0x533c('0x3a')]:_0x38d886[_0x533c('0x33')];if(!_0x425f60[_0x533c('0x36')]['hasOwnProperty']('nolimit')){_0x212d1b['limit']=qs['limit'](_0x425f60['query'][_0x533c('0x22')]);_0x212d1b['offset']=qs[_0x533c('0x20')](_0x425f60['query'][_0x533c('0x20')]);}_0x212d1b[_0x533c('0x3d')]=qs[_0x533c('0x3e')](_0x425f60['query'][_0x533c('0x3e')]);_0x212d1b[_0x533c('0x3f')]=qs[_0x533c('0x38')](_['pick'](_0x425f60[_0x533c('0x36')],_0x38d886[_0x533c('0x38')]),_0x2fc7fa);if(_0x425f60[_0x533c('0x36')]['filter']){_0x212d1b[_0x533c('0x3f')]=_[_0x533c('0x40')](_0x212d1b[_0x533c('0x3f')],{'$or':_[_0x533c('0x2f')](_0x2fc7fa,function(_0x454dbc){if(_0x454dbc[_0x533c('0x31')]!==_0x533c('0x41')){var _0x2dbd81={};_0x2dbd81[_0x454dbc[_0x533c('0x2c')]]={'$like':'%'+_0x425f60[_0x533c('0x36')][_0x533c('0x42')]+'%'};return _0x2dbd81;}})});}_0x212d1b=_['merge']({},_0x212d1b,_0x425f60[_0x533c('0x43')]);var _0x784493={'where':_0x212d1b[_0x533c('0x3f')]};return db[_0x533c('0x30')][_0x533c('0x23')](_0x784493)[_0x533c('0x29')](function(_0x5d2bf9){_0x3c559b[_0x533c('0x23')]=_0x5d2bf9;if(_0x425f60[_0x533c('0x36')][_0x533c('0x44')]){_0x212d1b['include']=[{'all':!![]}];}return db[_0x533c('0x30')][_0x533c('0x45')](_0x212d1b);})[_0x533c('0x29')](function(_0x1abd47){_0x3c559b['rows']=_0x1abd47;return _0x3c559b;})[_0x533c('0x29')](respondWithFilteredResult(_0x146a8e,_0x212d1b))['catch'](handleError(_0x146a8e,null));};exports[_0x533c('0x46')]=function(_0x39034e,_0x55a372){var _0x3f4015={'raw':![],'where':{'id':_0x39034e[_0x533c('0x47')]['id']}},_0x3f1e47={};_0x3f1e47['model']=_['keys'](db['ScreenRecording']['rawAttributes']);_0x3f1e47[_0x533c('0x36')]=_['keys'](_0x39034e[_0x533c('0x36')]);_0x3f1e47['filters']=_[_0x533c('0x39')](_0x3f1e47['model'],_0x3f1e47[_0x533c('0x36')]);_0x3f4015[_0x533c('0x3a')]=_['intersection'](_0x3f1e47[_0x533c('0x33')],qs[_0x533c('0x3b')](_0x39034e[_0x533c('0x36')][_0x533c('0x3b')]));_0x3f4015[_0x533c('0x3a')]=_0x3f4015['attributes'][_0x533c('0x3c')]?_0x3f4015[_0x533c('0x3a')]:_0x3f1e47[_0x533c('0x33')];if(_0x39034e[_0x533c('0x36')]['includeAll']){_0x3f4015[_0x533c('0x48')]=[{'all':!![]}];}_0x3f4015=_[_0x533c('0x40')]({},_0x3f4015,_0x39034e['options']);return db['ScreenRecording'][_0x533c('0x49')](_0x3f4015)['then'](handleEntityNotFound(_0x55a372,null))[_0x533c('0x29')](respondWithResult(_0x55a372,null))[_0x533c('0x4a')](handleError(_0x55a372,null));};exports[_0x533c('0x4b')]=function(_0x471c59,_0xe9354a){return db[_0x533c('0x30')][_0x533c('0x4b')](_0x471c59[_0x533c('0x4c')],{})['then'](respondWithResult(_0xe9354a,0xc9))[_0x533c('0x4a')](handleError(_0xe9354a,null));};exports[_0x533c('0x28')]=function(_0xaaf682,_0x57c6c6){if(_0xaaf682[_0x533c('0x4c')]['id']){delete _0xaaf682[_0x533c('0x4c')]['id'];}delete _0xaaf682['body'][_0x533c('0x4d')];delete _0xaaf682['body'][_0x533c('0x4e')];delete _0xaaf682[_0x533c('0x4c')][_0x533c('0x4f')];delete _0xaaf682[_0x533c('0x4c')][_0x533c('0x50')];return db[_0x533c('0x30')][_0x533c('0x49')]({'where':{'id':_0xaaf682['params']['id']}})[_0x533c('0x29')](handleEntityNotFound(_0x57c6c6,null))[_0x533c('0x29')](saveUpdates(_0xaaf682[_0x533c('0x4c')],null))[_0x533c('0x29')](respondWithResult(_0x57c6c6,null))[_0x533c('0x4a')](handleError(_0x57c6c6,null));};exports[_0x533c('0x51')]=function(_0x3eb174,_0x50d5a2){return db['ScreenRecording']['describe']()['then'](respondWithResult(_0x50d5a2,null))[_0x533c('0x4a')](handleError(_0x50d5a2,null));};exports[_0x533c('0x52')]=function(_0x5c5dd0,_0xac086b,_0x1da579){var _0x2f6794=require('../../components/encryptor');var _0x1de19e=![];var _0x564a31={};if(_0x5c5dd0['query'][_0x533c('0x31')]&&_0x5c5dd0[_0x533c('0x36')][_0x533c('0x31')]===_0x533c('0x53')){_0x564a31[_0x533c('0x53')]=_0x5c5dd0[_0x533c('0x47')]['id'];}else{_0x564a31['id']=_0x5c5dd0[_0x533c('0x47')]['id'];}return db['ScreenRecording'][_0x533c('0x49')]({'where':_0x564a31,'attributes':['id','value'],'raw':!![]})[_0x533c('0x29')](handleEntityNotFound(_0xac086b,null))[_0x533c('0x29')](function(_0x274686){if(_0x274686){var _0x2c7600=path[_0x533c('0x54')](config[_0x533c('0x55')],_0x533c('0x56'),_0x274686[_0x533c('0x50')]);var _0x58f528=util[_0x533c('0x35')](_0x533c('0x57'),_0x2c7600);if(fs[_0x533c('0x58')](_0x58f528)){_0x1de19e=!![];return _0x2f6794[_0x533c('0x59')](_0x58f528,_0x2c7600,config[_0x533c('0x5a')][_0x533c('0x5b')])['then'](function(){return _0x274686;});}return _0x274686;}})[_0x533c('0x29')](function(_0x554a9f){if(_0x554a9f){var _0x43383e=path[_0x533c('0x54')](config[_0x533c('0x55')],_0x533c('0x56'),_0x554a9f[_0x533c('0x50')]);if(!fs[_0x533c('0x58')](_0x43383e)){throw new db['Sequelize']['ValidationError'](_0x533c('0x5c'));}if(_0x554a9f[_0x533c('0x5d')]){return _0xac086b[_0x533c('0x52')](_0x43383e,_0x554a9f[_0x533c('0x5d')]+path['extname'](_0x43383e),function(){if(_0x1de19e){fs[_0x533c('0x5e')](_0x43383e);}});}else{return _0xac086b[_0x533c('0x52')](_0x43383e,function(_0x8e04c7){if(_0x1de19e){fs[_0x533c('0x5e')](_0x43383e);}});}}})[_0x533c('0x4a')](function(_0x2f2863){if(_0x2f2863[_0x533c('0x5f')]===_0x533c('0x5c')){_0xac086b[_0x533c('0x1d')](0x194)[_0x533c('0x2d')](_0x533c('0x60'));}else{return handleError(_0xac086b,null);}});};exports[_0x533c('0x2a')]=function(_0x13a7f2,_0xea6ea2){return db[_0x533c('0x30')][_0x533c('0x49')]({'where':{'id':_0x13a7f2[_0x533c('0x47')]['id']}})['then'](function(_0x31bba1){if(_['isNil'](_0x31bba1)){throw new ReferenceError('Entity\x20not\x20found');}return _0x31bba1;})[_0x533c('0x29')](function(_0xb23f94){var _0x965b85=path[_0x533c('0x54')](config[_0x533c('0x55')],_0x533c('0x56'),_0xb23f94[_0x533c('0x50')]);logger['info'](_0x533c('0x61'),_0x965b85);if(!_[_0x533c('0x62')](_0xb23f94['value'])&&fs[_0x533c('0x58')](_0x965b85)){logger[_0x533c('0x63')](_0x533c('0x64')+_0x965b85+_0x533c('0x65'));fs['unlinkSync'](_0x965b85);}_0x965b85=_0x965b85+_0x533c('0x66');if(!_[_0x533c('0x62')](_0xb23f94['value'])&&fs[_0x533c('0x58')](_0x965b85)){logger[_0x533c('0x63')]('File:\x20\x22'+_0x965b85+_0x533c('0x65'));fs[_0x533c('0x67')](_0x965b85);}return _0xb23f94;})['then'](function(_0x444f46){if(!_0x444f46)throw new InternalError();return _0x444f46['destroy']();})['then'](function(){_0xea6ea2[_0x533c('0x1d')](0xcc)[_0x533c('0x1e')]();})[_0x533c('0x4a')](handleError(_0xea6ea2,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 77502df..ece78ee 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 _0xafa5=['screen_recordings','interactionid','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./screenRecording.attributes','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xafa5,0x141));var _0x5afa=function(_0x24fa80,_0x5d9fb1){_0x24fa80=_0x24fa80-0x0;var _0x27fcd3=_0xafa5[_0x24fa80];return _0x27fcd3;};'use strict';var _=require('lodash');var util=require(_0x5afa('0x0'));var logger=require(_0x5afa('0x1'))(_0x5afa('0x2'));var moment=require(_0x5afa('0x3'));var BPromise=require('bluebird');var rp=require(_0x5afa('0x4'));var fs=require('fs');var path=require(_0x5afa('0x5'));var rimraf=require('rimraf');var config=require(_0x5afa('0x6'));var attributes=require(_0x5afa('0x7'));module['exports']=function(_0x102703,_0x39a567){return _0x102703[_0x5afa('0x8')]('ScreenRecording',attributes,{'tableName':_0x5afa('0x9'),'paranoid':![],'indexes':[{'name':_0x5afa('0xa'),'fields':[_0x5afa('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7793=['exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xcfc31d,_0xa87d72){var _0x56a8e5=function(_0x5ccc33){while(--_0x5ccc33){_0xcfc31d['push'](_0xcfc31d['shift']());}};_0x56a8e5(++_0xa87d72);}(_0x7793,0x7d));var _0x3779=function(_0x5e5537,_0x53577d){_0x5e5537=_0x5e5537-0x0;var _0x136983=_0x7793[_0x5e5537];return _0x136983;};'use strict';var _=require(_0x3779('0x0'));var util=require(_0x3779('0x1'));var logger=require(_0x3779('0x2'))(_0x3779('0x3'));var moment=require(_0x3779('0x4'));var BPromise=require(_0x3779('0x5'));var rp=require(_0x3779('0x6'));var fs=require('fs');var path=require(_0x3779('0x7'));var rimraf=require(_0x3779('0x8'));var config=require(_0x3779('0x9'));var attributes=require('./screenRecording.attributes');module[_0x3779('0xa')]=function(_0xb4ca8c,_0x5a7879){return _0xb4ca8c[_0x3779('0xb')](_0x3779('0xc'),attributes,{'tableName':_0x3779('0xd'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x3779('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index bdea628..4bedb8c 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 _0x1690=['message','catch','lodash','util','moment','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','ScreenRecording,\x20%s,\x20%s','result'];(function(_0x4ff7d1,_0x3331d1){var _0x16e063=function(_0x18c921){while(--_0x18c921){_0x4ff7d1['push'](_0x4ff7d1['shift']());}};_0x16e063(++_0x3331d1);}(_0x1690,0x1a6));var _0x0169=function(_0x3ffccc,_0x39620f){_0x3ffccc=_0x3ffccc-0x0;var _0x1583d2=_0x1690[_0x3ffccc];return _0x1583d2;};'use strict';var _=require(_0x0169('0x0'));var util=require(_0x0169('0x1'));var moment=require(_0x0169('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0169('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0169('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x0169('0x5'));var jayson=require(_0x0169('0x6'));var client=jayson[_0x0169('0x7')][_0x0169('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3234c4,_0x1df330,_0x56c444){return new BPromise(function(_0x2c4b2e,_0x12f95e){return client['request'](_0x3234c4,_0x56c444)[_0x0169('0x9')](function(_0xb25263){logger[_0x0169('0xa')]('ScreenRecording,\x20%s,\x20%s',_0x1df330,_0x0169('0xb'));logger[_0x0169('0xc')](_0x0169('0xd'),_0x1df330,_0x0169('0xb'),JSON[_0x0169('0xe')](_0xb25263));if(_0xb25263[_0x0169('0xf')]){if(_0xb25263[_0x0169('0xf')][_0x0169('0x10')]===0x1f4){logger[_0x0169('0xf')](_0x0169('0x11'),_0x1df330,_0xb25263['error']['message']);return _0x12f95e(_0xb25263[_0x0169('0xf')]['message']);}logger['error']('ScreenRecording,\x20%s,\x20%s',_0x1df330,_0xb25263[_0x0169('0xf')]['message']);return _0x2c4b2e(_0xb25263[_0x0169('0xf')]['message']);}else{logger['info'](_0x0169('0x11'),_0x1df330,_0x0169('0xb'));_0x2c4b2e(_0xb25263[_0x0169('0x12')][_0x0169('0x13')]);}})[_0x0169('0x14')](function(_0x215259){logger[_0x0169('0xf')]('ScreenRecording,\x20%s,\x20%s',_0x1df330,_0x215259);_0x12f95e(_0x215259);});});} \ No newline at end of file +var _0xa41e=['stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xa41e,0x164));var _0xea41=function(_0x204c92,_0x5ddee9){_0x204c92=_0x204c92-0x0;var _0x16f530=_0xa41e[_0x204c92];return _0x16f530;};'use strict';var _=require('lodash');var util=require(_0xea41('0x0'));var moment=require(_0xea41('0x1'));var BPromise=require(_0xea41('0x2'));var rs=require(_0xea41('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xea41('0x4'))['db'];var utils=require(_0xea41('0x5'));var logger=require(_0xea41('0x6'))(_0xea41('0x7'));var config=require(_0xea41('0x8'));var jayson=require(_0xea41('0x9'));var client=jayson[_0xea41('0xa')][_0xea41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4348d0,_0x5b0507,_0x38e605){return new BPromise(function(_0x234c3e,_0x573b50){return client[_0xea41('0xc')](_0x4348d0,_0x38e605)[_0xea41('0xd')](function(_0x3a2d4b){logger[_0xea41('0xe')](_0xea41('0xf'),_0x5b0507,_0xea41('0x10'));logger[_0xea41('0x11')](_0xea41('0x12'),_0x5b0507,_0xea41('0x10'),JSON[_0xea41('0x13')](_0x3a2d4b));if(_0x3a2d4b[_0xea41('0x14')]){if(_0x3a2d4b[_0xea41('0x14')][_0xea41('0x15')]===0x1f4){logger[_0xea41('0x14')](_0xea41('0xf'),_0x5b0507,_0x3a2d4b[_0xea41('0x14')][_0xea41('0x16')]);return _0x573b50(_0x3a2d4b[_0xea41('0x14')][_0xea41('0x16')]);}logger[_0xea41('0x14')](_0xea41('0xf'),_0x5b0507,_0x3a2d4b['error'][_0xea41('0x16')]);return _0x234c3e(_0x3a2d4b[_0xea41('0x14')][_0xea41('0x16')]);}else{logger[_0xea41('0xe')](_0xea41('0xf'),_0x5b0507,_0xea41('0x10'));_0x234c3e(_0x3a2d4b[_0xea41('0x17')]['message']);}})[_0xea41('0x18')](function(_0x59de8f){logger[_0xea41('0x14')](_0xea41('0xf'),_0x5b0507,_0x59de8f);_0x573b50(_0x59de8f);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 68d36be..bff4bc2 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 _0x5304=['originalname','post','/:id/logo','single','addLogo','join','logologin','file','addLogoLogin','preferred','addPreferred','favicon','addFavicon','update','exports','util','connect-timeout','express','Router','../../components/interaction/service','isAuthenticated','index','get','/now','show','getLogo','/:id/logo_login','getLogoLogin','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','root','server/files/images/logos/','format','%s%s','logo','extname'];(function(_0x5daf0a,_0x4f5617){var _0x5bb34c=function(_0x402b01){while(--_0x402b01){_0x5daf0a['push'](_0x5daf0a['shift']());}};_0x5bb34c(++_0x4f5617);}(_0x5304,0x1ef));var _0x4530=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x5304[_0x16d10f];return _0x50c823;};'use strict';var multer=require('multer');var util=require(_0x4530('0x0'));var path=require('path');var timeout=require(_0x4530('0x1'));var express=require(_0x4530('0x2'));var router=express[_0x4530('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4530('0x4'));var config=require('../../config/environment');var controller=require('./setting.controller');router['get']('/',auth[_0x4530('0x5')](),controller[_0x4530('0x6')]);router[_0x4530('0x7')](_0x4530('0x8'),controller['getDate']);router[_0x4530('0x7')]('/:id',controller[_0x4530('0x9')]);router[_0x4530('0x7')]('/:id/logo',controller[_0x4530('0xa')]);router[_0x4530('0x7')](_0x4530('0xb'),controller[_0x4530('0xc')]);router[_0x4530('0x7')]('/:id/gdpr',controller[_0x4530('0xd')]);router[_0x4530('0x7')](_0x4530('0xe'),controller[_0x4530('0xf')]);router[_0x4530('0x7')](_0x4530('0x10'),controller[_0x4530('0x11')]);var upload=multer({'storage':multer[_0x4530('0x12')]({'destination':function(_0x4fc3bc,_0x43e54d,_0x396dd0){_0x396dd0(null,path['join'](config[_0x4530('0x13')],_0x4530('0x14')));},'filename':function(_0x4feb18,_0x4b8fed,_0x5f5fb4){_0x5f5fb4(null,util[_0x4530('0x15')](_0x4530('0x16'),_0x4530('0x17'),path[_0x4530('0x18')](_0x4b8fed[_0x4530('0x19')])));}})});router[_0x4530('0x1a')](_0x4530('0x1b'),upload[_0x4530('0x1c')]('file'),controller[_0x4530('0x1d')]);var upload=multer({'storage':multer[_0x4530('0x12')]({'destination':function(_0x30c01f,_0x4e7b8,_0x33e4f6){_0x33e4f6(null,path[_0x4530('0x1e')](config[_0x4530('0x13')],'server/files/images/logos/'));},'filename':function(_0x5376eb,_0x460191,_0x45f5a3){_0x45f5a3(null,util[_0x4530('0x15')](_0x4530('0x16'),_0x4530('0x1f'),path['extname'](_0x460191[_0x4530('0x19')])));}})});router[_0x4530('0x1a')](_0x4530('0xb'),upload[_0x4530('0x1c')](_0x4530('0x20')),controller[_0x4530('0x21')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3b7b76,_0x2f7467,_0x16f3bc){_0x16f3bc(null,path['join'](config[_0x4530('0x13')],_0x4530('0x14')));},'filename':function(_0x353118,_0x3f149b,_0x58d298){_0x58d298(null,util['format']('%s%s',_0x4530('0x22'),path[_0x4530('0x18')](_0x3f149b[_0x4530('0x19')])));}})});router[_0x4530('0x1a')]('/:id/preferred',upload[_0x4530('0x1c')](_0x4530('0x20')),controller[_0x4530('0x23')]);var upload=multer({'storage':multer[_0x4530('0x12')]({'destination':function(_0x22405f,_0xbf35f3,_0xf547fe){_0xf547fe(null,path[_0x4530('0x1e')](config[_0x4530('0x13')],_0x4530('0x14')));},'filename':function(_0x5eb753,_0x20d016,_0x4a95c4){_0x4a95c4(null,util[_0x4530('0x15')](_0x4530('0x16'),_0x4530('0x24'),path[_0x4530('0x18')](_0x20d016[_0x4530('0x19')])));}})});router[_0x4530('0x1a')](_0x4530('0x10'),upload[_0x4530('0x1c')](_0x4530('0x20')),controller[_0x4530('0x25')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x4530('0x26')]);module[_0x4530('0x27')]=router; \ No newline at end of file +var _0xb514=['%s%s','logo','extname','post','single','file','addLogo','server/files/images/logos/','format','logologin','originalname','/:id/logo_login','addLogoLogin','preferred','addPreferred','favicon','addFavicon','put','update','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','show','getLogo','getLogoLogin','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xb514,0x16c));var _0x4b51=function(_0x1a7550,_0x1edace){_0x1a7550=_0x1a7550-0x0;var _0x426e22=_0xb514[_0x1a7550];return _0x426e22;};'use strict';var multer=require(_0x4b51('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4b51('0x1'));var express=require(_0x4b51('0x2'));var router=express[_0x4b51('0x3')]();var fs_extra=require(_0x4b51('0x4'));var auth=require(_0x4b51('0x5'));var interaction=require(_0x4b51('0x6'));var config=require(_0x4b51('0x7'));var controller=require(_0x4b51('0x8'));router[_0x4b51('0x9')]('/',auth[_0x4b51('0xa')](),controller[_0x4b51('0xb')]);router['get'](_0x4b51('0xc'),controller['getDate']);router[_0x4b51('0x9')]('/:id',controller[_0x4b51('0xd')]);router['get']('/:id/logo',controller[_0x4b51('0xe')]);router[_0x4b51('0x9')]('/:id/logo_login',controller[_0x4b51('0xf')]);router['get']('/:id/gdpr',controller['gdpr']);router[_0x4b51('0x9')](_0x4b51('0x10'),controller[_0x4b51('0x11')]);router[_0x4b51('0x9')](_0x4b51('0x12'),controller[_0x4b51('0x13')]);var upload=multer({'storage':multer[_0x4b51('0x14')]({'destination':function(_0xa04a5,_0x5a689d,_0x1f4143){_0x1f4143(null,path[_0x4b51('0x15')](config[_0x4b51('0x16')],'server/files/images/logos/'));},'filename':function(_0x3736cc,_0x119bfb,_0x5c0b9d){_0x5c0b9d(null,util['format'](_0x4b51('0x17'),_0x4b51('0x18'),path[_0x4b51('0x19')](_0x119bfb['originalname'])));}})});router[_0x4b51('0x1a')]('/:id/logo',upload[_0x4b51('0x1b')](_0x4b51('0x1c')),controller[_0x4b51('0x1d')]);var upload=multer({'storage':multer[_0x4b51('0x14')]({'destination':function(_0xe81c00,_0x100fd8,_0x1a8aac){_0x1a8aac(null,path[_0x4b51('0x15')](config[_0x4b51('0x16')],_0x4b51('0x1e')));},'filename':function(_0x11f970,_0x4afe76,_0x2c9ef2){_0x2c9ef2(null,util[_0x4b51('0x1f')](_0x4b51('0x17'),_0x4b51('0x20'),path[_0x4b51('0x19')](_0x4afe76[_0x4b51('0x21')])));}})});router['post'](_0x4b51('0x22'),upload[_0x4b51('0x1b')](_0x4b51('0x1c')),controller[_0x4b51('0x23')]);var upload=multer({'storage':multer[_0x4b51('0x14')]({'destination':function(_0x55ac95,_0x1981cd,_0x36d4d3){_0x36d4d3(null,path[_0x4b51('0x15')](config[_0x4b51('0x16')],_0x4b51('0x1e')));},'filename':function(_0xf5a6d3,_0x39a3e1,_0x4fd832){_0x4fd832(null,util[_0x4b51('0x1f')](_0x4b51('0x17'),_0x4b51('0x24'),path['extname'](_0x39a3e1[_0x4b51('0x21')])));}})});router[_0x4b51('0x1a')]('/:id/preferred',upload['single']('file'),controller[_0x4b51('0x25')]);var upload=multer({'storage':multer[_0x4b51('0x14')]({'destination':function(_0x2848dc,_0x5dd161,_0x27b636){_0x27b636(null,path[_0x4b51('0x15')](config[_0x4b51('0x16')],_0x4b51('0x1e')));},'filename':function(_0x2fc22,_0x4ada1f,_0x55b69c){_0x55b69c(null,util['format'](_0x4b51('0x17'),_0x4b51('0x26'),path[_0x4b51('0x19')](_0x4ada1f['originalname'])));}})});router[_0x4b51('0x1a')](_0x4b51('0x12'),upload['single'](_0x4b51('0x1c')),controller[_0x4b51('0x27')]);router[_0x4b51('0x28')]('/:id',auth[_0x4b51('0xa')](),controller[_0x4b51('0x29')]);module[_0x4b51('0x2a')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 5f52a49..dad3ad5 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(_0x706db8,_0x4ae7a2){var _0x1ac625=function(_0x3ba1ab){while(--_0x3ba1ab){_0x706db8['push'](_0x706db8['shift']());}};_0x1ac625(++_0x4ae7a2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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(_0x452854,_0x3d2b64){var _0xccfda=function(_0x5f2467){while(--_0x5f2467){_0x452854['push'](_0x452854['shift']());}};_0xccfda(++_0x3d2b64);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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 7398672..faf6474 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 _0xe563=['body','addLogo','file','filename','logo','find','loginLogo','params','getLogo','server/files/images/logos','getLicense','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','root','toLower','join','default_logo.svg','upperFirst','custom','existsSync','\x20not\x20found','download','preferred','favicon','default_loginLogo.svg','default','Sequelize','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','ValidationError','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','error','message','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','destroy','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','pick','filter','where','VIRTUAL','merge','options','Setting','include','rows','show','includeAll','catch','update'];(function(_0x4fef91,_0x33303d){var _0x4edadb=function(_0x4f6107){while(--_0x4f6107){_0x4fef91['push'](_0x4fef91['shift']());}};_0x4edadb(++_0x33303d);}(_0xe563,0x125));var _0x3e56=function(_0x625cd8,_0x424bf8){_0x625cd8=_0x625cd8-0x0;var _0x28f426=_0xe563[_0x625cd8];return _0x28f426;};'use strict';var emlformat=require(_0x3e56('0x0'));var rimraf=require(_0x3e56('0x1'));var zipdir=require(_0x3e56('0x2'));var jsonpatch=require(_0x3e56('0x3'));var rp=require(_0x3e56('0x4'));var moment=require(_0x3e56('0x5'));var BPromise=require(_0x3e56('0x6'));var Mustache=require(_0x3e56('0x7'));var util=require(_0x3e56('0x8'));var path=require(_0x3e56('0x9'));var sox=require('sox');var csv=require(_0x3e56('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e56('0xb'));var _=require(_0x3e56('0xc'));var squel=require(_0x3e56('0xd'));var crypto=require(_0x3e56('0xe'));var jsforce=require(_0x3e56('0xf'));var deskjs=require(_0x3e56('0x10'));var toCsv=require(_0x3e56('0xa'));var querystring=require(_0x3e56('0x11'));var Papa=require(_0x3e56('0x12'));var Redis=require(_0x3e56('0x13'));var authService=require(_0x3e56('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x3e56('0x15'));var hardwareService=require(_0x3e56('0x16'));var logger=require(_0x3e56('0x17'))(_0x3e56('0x18'));var utils=require(_0x3e56('0x19'));var config=require(_0x3e56('0x1a'));var licenseUtil=require(_0x3e56('0x1b'));var db=require(_0x3e56('0x1c'))['db'];var jayson=require(_0x3e56('0x1d'));var client=jayson[_0x3e56('0x1e')][_0x3e56('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x21313a,_0x4cf468,_0x6a8f8c,_0x11d186){return new BPromise(function(_0x4ad88f,_0x2dcfd2){var _0x32d8e9=_0x11d186||client;return _0x32d8e9[_0x3e56('0x20')](_0x21313a,_0x6a8f8c)[_0x3e56('0x21')](function(_0x302527){logger[_0x3e56('0x22')](_0x3e56('0x23'),_0x4cf468,_0x3e56('0x24'));logger['debug'](_0x3e56('0x25'),_0x4cf468,_0x3e56('0x24'),JSON['stringify'](_0x302527));if(_0x302527[_0x3e56('0x26')]){if(_0x302527[_0x3e56('0x26')]['code']===0x1f4){logger[_0x3e56('0x26')](_0x3e56('0x23'),_0x4cf468,_0x302527['error'][_0x3e56('0x27')]);return _0x2dcfd2(_0x302527[_0x3e56('0x26')][_0x3e56('0x27')]);}logger[_0x3e56('0x26')](_0x3e56('0x23'),_0x4cf468,_0x302527[_0x3e56('0x26')][_0x3e56('0x27')]);return _0x4ad88f(_0x302527['error']['message']);}else{logger[_0x3e56('0x22')](_0x3e56('0x23'),_0x4cf468,_0x3e56('0x24'));_0x4ad88f(_0x302527['result'][_0x3e56('0x27')]);}})['catch'](function(_0x6022ff){logger[_0x3e56('0x26')](_0x3e56('0x23'),_0x4cf468,_0x6022ff);_0x2dcfd2(_0x6022ff);});});}function respondWithStatusCode(_0xc79453,_0x1f7b69){_0x1f7b69=_0x1f7b69||0xcc;return function(_0x48eefe){if(_0x48eefe){return _0xc79453[_0x3e56('0x28')](_0x1f7b69);}return _0xc79453[_0x3e56('0x29')](_0x1f7b69)[_0x3e56('0x2a')]();};}function respondWithResult(_0x305404,_0x25b3e8){_0x25b3e8=_0x25b3e8||0xc8;return function(_0x30a46f){if(_0x30a46f){return _0x305404[_0x3e56('0x29')](_0x25b3e8)[_0x3e56('0x2b')](_0x30a46f);}};}function respondWithFilteredResult(_0xafe6bf,_0x19cfc2){return function(_0x51ff4d){if(_0x51ff4d){var _0x540d1c=typeof _0x19cfc2[_0x3e56('0x2c')]===_0x3e56('0x2d')&&typeof _0x19cfc2['limit']===_0x3e56('0x2d');var _0x5230ac=_0x51ff4d[_0x3e56('0x2e')];var _0x2aafab=_0x540d1c?0x0:_0x19cfc2[_0x3e56('0x2c')];var _0x466404=_0x540d1c?_0x51ff4d[_0x3e56('0x2e')]:_0x19cfc2[_0x3e56('0x2c')]+_0x19cfc2['limit'];var _0x2c7d08;if(_0x466404>=_0x5230ac){_0x466404=_0x5230ac;_0x2c7d08=0xc8;}else{_0x2c7d08=0xce;}_0xafe6bf[_0x3e56('0x29')](_0x2c7d08);return _0xafe6bf[_0x3e56('0x2f')]('Content-Range',_0x2aafab+'-'+_0x466404+'/'+_0x5230ac)[_0x3e56('0x2b')](_0x51ff4d);}return null;};}function patchUpdates(_0x54587b){return function(_0x19ea60){try{jsonpatch[_0x3e56('0x30')](_0x19ea60,_0x54587b,!![]);}catch(_0x45b934){return BPromise[_0x3e56('0x31')](_0x45b934);}return _0x19ea60[_0x3e56('0x32')]();};}function saveUpdates(_0xc349f1,_0x49a77c){return function(_0x479b2b){if(_0x479b2b){return _0x479b2b['update'](_0xc349f1)[_0x3e56('0x21')](function(_0x3d8ada){return _0x3d8ada;});}return null;};}function removeEntity(_0x22b1ef,_0xa32da2){return function(_0x56cf22){if(_0x56cf22){return _0x56cf22[_0x3e56('0x33')]()[_0x3e56('0x21')](function(){_0x22b1ef[_0x3e56('0x29')](0xcc)[_0x3e56('0x2a')]();});}};}function handleEntityNotFound(_0x555aaf,_0x1b25c7){return function(_0x37fcaf){if(!_0x37fcaf){_0x555aaf[_0x3e56('0x28')](0x194);}return _0x37fcaf;};}function handleError(_0x33799c,_0x59837d){_0x59837d=_0x59837d||0x1f4;return function(_0x12c5b3){logger[_0x3e56('0x26')](_0x12c5b3[_0x3e56('0x34')]);if(_0x12c5b3[_0x3e56('0x35')]){delete _0x12c5b3[_0x3e56('0x35')];}_0x33799c[_0x3e56('0x29')](_0x59837d)['send'](_0x12c5b3);};}exports[_0x3e56('0x36')]=function(_0x5c77e5,_0xeacc06){var _0x470e24={},_0x35180c={},_0x993ffd={'count':0x0,'rows':[]};var _0x949455=_[_0x3e56('0x37')](db['Setting'][_0x3e56('0x38')],function(_0x5bce8a){return{'name':_0x5bce8a[_0x3e56('0x39')],'type':_0x5bce8a[_0x3e56('0x3a')][_0x3e56('0x3b')]};});_0x35180c[_0x3e56('0x3c')]=_[_0x3e56('0x37')](_0x949455,_0x3e56('0x35'));_0x35180c[_0x3e56('0x3d')]=_[_0x3e56('0x3e')](_0x5c77e5['query']);_0x35180c[_0x3e56('0x3f')]=_[_0x3e56('0x40')](_0x35180c[_0x3e56('0x3c')],_0x35180c['query']);_0x470e24['attributes']=_[_0x3e56('0x40')](_0x35180c['model'],qs[_0x3e56('0x41')](_0x5c77e5[_0x3e56('0x3d')][_0x3e56('0x41')]));_0x470e24['attributes']=_0x470e24[_0x3e56('0x42')][_0x3e56('0x43')]?_0x470e24['attributes']:_0x35180c['model'];if(!_0x5c77e5[_0x3e56('0x3d')][_0x3e56('0x44')]('nolimit')){_0x470e24[_0x3e56('0x45')]=qs['limit'](_0x5c77e5['query'][_0x3e56('0x45')]);_0x470e24[_0x3e56('0x2c')]=qs[_0x3e56('0x2c')](_0x5c77e5[_0x3e56('0x3d')]['offset']);}_0x470e24[_0x3e56('0x46')]=qs[_0x3e56('0x47')](_0x5c77e5['query'][_0x3e56('0x47')]);_0x470e24['where']=qs[_0x3e56('0x3f')](_[_0x3e56('0x48')](_0x5c77e5['query'],_0x35180c[_0x3e56('0x3f')]),_0x949455);if(_0x5c77e5['query'][_0x3e56('0x49')]){_0x470e24[_0x3e56('0x4a')]=_['merge'](_0x470e24[_0x3e56('0x4a')],{'$or':_[_0x3e56('0x37')](_0x949455,function(_0x311ade){if(_0x311ade[_0x3e56('0x3a')]!==_0x3e56('0x4b')){var _0x320711={};_0x320711[_0x311ade[_0x3e56('0x35')]]={'$like':'%'+_0x5c77e5[_0x3e56('0x3d')]['filter']+'%'};return _0x320711;}})});}_0x470e24=_[_0x3e56('0x4c')]({},_0x470e24,_0x5c77e5[_0x3e56('0x4d')]);var _0x88e8e6={'where':_0x470e24[_0x3e56('0x4a')]};return db[_0x3e56('0x4e')][_0x3e56('0x2e')](_0x88e8e6)['then'](function(_0xed1bcf){_0x993ffd['count']=_0xed1bcf;if(_0x5c77e5[_0x3e56('0x3d')]['includeAll']){_0x470e24[_0x3e56('0x4f')]=[{'all':!![]}];}return db[_0x3e56('0x4e')]['findAll'](_0x470e24);})[_0x3e56('0x21')](function(_0x53e5f2){_0x993ffd[_0x3e56('0x50')]=_0x53e5f2;return _0x993ffd;})[_0x3e56('0x21')](respondWithFilteredResult(_0xeacc06,_0x470e24))['catch'](handleError(_0xeacc06,null));};exports[_0x3e56('0x51')]=function(_0x5d6451,_0x1d04df){var _0x5dafc1={'raw':![],'where':{'id':_0x5d6451['params']['id']}},_0x32e659={};_0x32e659['model']=_['keys'](db['Setting'][_0x3e56('0x38')]);_0x32e659['query']=_[_0x3e56('0x3e')](_0x5d6451['query']);_0x32e659[_0x3e56('0x3f')]=_[_0x3e56('0x40')](_0x32e659['model'],_0x32e659[_0x3e56('0x3d')]);_0x5dafc1[_0x3e56('0x42')]=_[_0x3e56('0x40')](_0x32e659['model'],qs[_0x3e56('0x41')](_0x5d6451[_0x3e56('0x3d')]['fields']));_0x5dafc1['attributes']=_0x5dafc1[_0x3e56('0x42')][_0x3e56('0x43')]?_0x5dafc1[_0x3e56('0x42')]:_0x32e659[_0x3e56('0x3c')];if(_0x5d6451['query'][_0x3e56('0x52')]){_0x5dafc1[_0x3e56('0x4f')]=[{'all':!![]}];}_0x5dafc1=_[_0x3e56('0x4c')]({},_0x5dafc1,_0x5d6451[_0x3e56('0x4d')]);return db[_0x3e56('0x4e')]['find'](_0x5dafc1)[_0x3e56('0x21')](handleEntityNotFound(_0x1d04df,null))[_0x3e56('0x21')](respondWithResult(_0x1d04df,null))[_0x3e56('0x53')](handleError(_0x1d04df,null));};exports[_0x3e56('0x54')]=function(_0x55756d,_0x498836){if(_0x55756d[_0x3e56('0x55')]['id']){delete _0x55756d['body']['id'];}return db['Setting']['find']({'where':{'id':_0x55756d['params']['id']}})[_0x3e56('0x21')](handleEntityNotFound(_0x498836,null))[_0x3e56('0x21')](saveUpdates(_0x55756d[_0x3e56('0x55')],null))[_0x3e56('0x21')](respondWithResult(_0x498836,null))[_0x3e56('0x53')](handleError(_0x498836,null));};exports[_0x3e56('0x56')]=function(_0x4526be,_0x16b30f,_0x81a22c){if(_0x4526be[_0x3e56('0x57')]&&_0x4526be[_0x3e56('0x57')][_0x3e56('0x58')]){_0x4526be['body'][_0x3e56('0x59')]=_0x4526be[_0x3e56('0x57')][_0x3e56('0x58')];}return db[_0x3e56('0x4e')][_0x3e56('0x5a')]({'where':{'id':_0x4526be['params']['id']}})[_0x3e56('0x21')](handleEntityNotFound(_0x16b30f,null))['then'](saveUpdates(_0x4526be['body'],null))[_0x3e56('0x21')](respondWithResult(_0x16b30f,null))[_0x3e56('0x53')](handleError(_0x16b30f,null));};exports['addLogoLogin']=function(_0x2cddc1,_0x2bc3a9,_0x1c7c69){if(_0x2cddc1[_0x3e56('0x57')]&&_0x2cddc1['file'][_0x3e56('0x58')]){_0x2cddc1[_0x3e56('0x55')][_0x3e56('0x5b')]=_0x2cddc1[_0x3e56('0x57')][_0x3e56('0x58')];}return db['Setting'][_0x3e56('0x5a')]({'where':{'id':_0x2cddc1[_0x3e56('0x5c')]['id']}})['then'](handleEntityNotFound(_0x2bc3a9,null))[_0x3e56('0x21')](saveUpdates(_0x2cddc1['body'],null))[_0x3e56('0x21')](respondWithResult(_0x2bc3a9,null))[_0x3e56('0x53')](handleError(_0x2bc3a9,null));};var utilLicense=require(_0x3e56('0x1b'));exports[_0x3e56('0x5d')]=function(_0x339786,_0x5192b4,_0x436a23){var _0x495ab9=_0x3e56('0x5e');var _0x372cf4={'custom':![]};return utilLicense[_0x3e56('0x5f')]()[_0x3e56('0x21')](function(_0x27fa05){if(_0x27fa05){_0x372cf4=_0x27fa05;}return db[_0x3e56('0x4e')][_0x3e56('0x5a')]({'where':{'id':_0x339786[_0x3e56('0x5c')]['id']},'attributes':[_0x3e56('0x59'),_0x3e56('0x5b'),'preferred','favicon',_0x3e56('0x60'),_0x3e56('0x61'),_0x3e56('0x62'),_0x3e56('0x63')],'raw':!![]});})['then'](handleEntityNotFound(_0x5192b4,null))[_0x3e56('0x21')](function(_0x430418){if(_0x430418){var _0x2779ec=_0x430418[_0x3e56('0x59')]&&fs['existsSync'](path['join'](config[_0x3e56('0x64')],_0x495ab9,_[_0x3e56('0x65')](_0x430418[_0x3e56('0x59')])))?path[_0x3e56('0x66')](config[_0x3e56('0x64')],_0x495ab9,_[_0x3e56('0x65')](_0x430418['logo'])):path[_0x3e56('0x66')](config[_0x3e56('0x64')],_0x495ab9,_[_0x3e56('0x65')](_0x3e56('0x67')));var _0x3f0d16='default'+_[_0x3e56('0x68')](_0x3e56('0x59'));if(_0x430418[_0x3f0d16]||!_0x372cf4[_0x3e56('0x69')]){_0x2779ec=path[_0x3e56('0x66')](config[_0x3e56('0x64')],_0x495ab9,_[_0x3e56('0x65')](_0x3e56('0x67')));}if(!fs[_0x3e56('0x6a')](_0x2779ec)){throw new db['Sequelize']['ValidationError'](_[_0x3e56('0x68')](_0x3e56('0x59'))+_0x3e56('0x6b'));}return _0x5192b4[_0x3e56('0x6c')](_0x2779ec);}})[_0x3e56('0x53')](handleError(_0x5192b4,null));};var utilLicense=require(_0x3e56('0x1b'));exports['getLogoLogin']=function(_0x548256,_0x366c8d,_0x596f33){var _0x36c61c=_0x3e56('0x5e');var _0x43b11a={'custom':![]};return utilLicense[_0x3e56('0x5f')]()['then'](function(_0x1ab8c7){if(_0x1ab8c7){_0x43b11a=_0x1ab8c7;}return db[_0x3e56('0x4e')][_0x3e56('0x5a')]({'where':{'id':_0x548256[_0x3e56('0x5c')]['id']},'attributes':[_0x3e56('0x59'),_0x3e56('0x5b'),_0x3e56('0x6d'),_0x3e56('0x6e'),'defaultLogo',_0x3e56('0x61'),_0x3e56('0x62'),_0x3e56('0x63')],'raw':!![]});})['then'](handleEntityNotFound(_0x366c8d,null))[_0x3e56('0x21')](function(_0x2a1df5){if(_0x2a1df5){var _0xf9c14a=_0x2a1df5['loginLogo']&&fs[_0x3e56('0x6a')](path[_0x3e56('0x66')](config[_0x3e56('0x64')],_0x36c61c,_[_0x3e56('0x65')](_0x2a1df5[_0x3e56('0x5b')])))?path[_0x3e56('0x66')](config[_0x3e56('0x64')],_0x36c61c,_[_0x3e56('0x65')](_0x2a1df5[_0x3e56('0x5b')])):path[_0x3e56('0x66')](config[_0x3e56('0x64')],_0x36c61c,_['toLower'](_0x3e56('0x6f')));var _0x7657d5=_0x3e56('0x70')+_[_0x3e56('0x68')]('loginLogo');if(_0x2a1df5[_0x7657d5]||!_0x43b11a[_0x3e56('0x69')]){_0xf9c14a=path[_0x3e56('0x66')](config[_0x3e56('0x64')],_0x36c61c,_[_0x3e56('0x65')]('default_loginLogo.svg'));}if(!fs[_0x3e56('0x6a')](_0xf9c14a)){throw new db[(_0x3e56('0x71'))]['ValidationError'](_['upperFirst'](_0x3e56('0x5b'))+_0x3e56('0x6b'));}return _0x366c8d[_0x3e56('0x6c')](_0xf9c14a);}})[_0x3e56('0x53')](handleError(_0x366c8d,null));};exports['gdpr']=function(_0x464db9,_0x4b3f67){return db[_0x3e56('0x4e')][_0x3e56('0x5a')]({'where':{'id':_0x464db9['params']['id']},'attributes':[_0x3e56('0x72')]})['then'](respondWithResult(_0x4b3f67,null))[_0x3e56('0x53')](handleError(_0x4b3f67,null));};exports[_0x3e56('0x73')]=function(_0x2693e3,_0x5425a3,_0x2a08c){if(_0x2693e3[_0x3e56('0x57')]&&_0x2693e3[_0x3e56('0x57')][_0x3e56('0x58')]){_0x2693e3['body'][_0x3e56('0x6d')]=_0x2693e3['file'][_0x3e56('0x58')];}return db[_0x3e56('0x4e')]['find']({'where':{'id':_0x2693e3['params']['id']}})[_0x3e56('0x21')](handleEntityNotFound(_0x5425a3,null))[_0x3e56('0x21')](saveUpdates(_0x2693e3[_0x3e56('0x55')],null))[_0x3e56('0x21')](respondWithResult(_0x5425a3,null))[_0x3e56('0x53')](handleError(_0x5425a3,null));};var utilLicense=require('../../config/license/util');exports[_0x3e56('0x74')]=function(_0x4b17a6,_0x706c72,_0x32267e){var _0x36c563=_0x3e56('0x5e');var _0x5e3abe={'custom':![]};return utilLicense[_0x3e56('0x5f')]()[_0x3e56('0x21')](function(_0x39170e){if(_0x39170e){_0x5e3abe=_0x39170e;}return db[_0x3e56('0x4e')][_0x3e56('0x5a')]({'where':{'id':_0x4b17a6[_0x3e56('0x5c')]['id']},'attributes':[_0x3e56('0x59'),_0x3e56('0x5b'),'preferred',_0x3e56('0x6e'),_0x3e56('0x60'),_0x3e56('0x61'),_0x3e56('0x62'),_0x3e56('0x63')],'raw':!![]});})[_0x3e56('0x21')](handleEntityNotFound(_0x706c72,null))['then'](function(_0x55a100){if(_0x55a100){var _0x3beab4=_0x55a100['preferred']&&fs[_0x3e56('0x6a')](path[_0x3e56('0x66')](config[_0x3e56('0x64')],_0x36c563,_[_0x3e56('0x65')](_0x55a100[_0x3e56('0x6d')])))?path[_0x3e56('0x66')](config['root'],_0x36c563,_[_0x3e56('0x65')](_0x55a100['preferred'])):path[_0x3e56('0x66')](config[_0x3e56('0x64')],_0x36c563,_[_0x3e56('0x65')](_0x3e56('0x75')));var _0x421c64=_0x3e56('0x70')+_[_0x3e56('0x68')](_0x3e56('0x6d'));if(_0x55a100[_0x421c64]||!_0x5e3abe['custom']||!_0x5e3abe[_0x3e56('0x6d')]){_0x3beab4=path[_0x3e56('0x66')](config['root'],_0x36c563,_['toLower'](_0x3e56('0x75')));}if(!fs[_0x3e56('0x6a')](_0x3beab4)){throw new db[(_0x3e56('0x71'))]['ValidationError'](_[_0x3e56('0x68')](_0x3e56('0x6d'))+_0x3e56('0x6b'));}return _0x706c72['download'](_0x3beab4);}})[_0x3e56('0x53')](handleError(_0x706c72,null));};exports[_0x3e56('0x76')]=function(_0x3822b6,_0x485e2d,_0x34d154){if(_0x3822b6[_0x3e56('0x57')]&&_0x3822b6[_0x3e56('0x57')]['filename']){_0x3822b6[_0x3e56('0x55')][_0x3e56('0x6e')]=_0x3822b6[_0x3e56('0x57')][_0x3e56('0x58')];}return db['Setting']['find']({'where':{'id':_0x3822b6[_0x3e56('0x5c')]['id']}})[_0x3e56('0x21')](handleEntityNotFound(_0x485e2d,null))[_0x3e56('0x21')](saveUpdates(_0x3822b6[_0x3e56('0x55')],null))[_0x3e56('0x21')](respondWithResult(_0x485e2d,null))['catch'](handleError(_0x485e2d,null));};var utilLicense=require(_0x3e56('0x1b'));exports[_0x3e56('0x77')]=function(_0x545140,_0x3bd26e,_0x356946){var _0xb4798e=_0x3e56('0x5e');var _0x4de4af={'custom':![]};return utilLicense[_0x3e56('0x5f')]()['then'](function(_0x3cdd81){if(_0x3cdd81){_0x4de4af=_0x3cdd81;}return db[_0x3e56('0x4e')]['find']({'where':{'id':_0x545140['params']['id']},'attributes':[_0x3e56('0x59'),'loginLogo',_0x3e56('0x6d'),_0x3e56('0x6e'),_0x3e56('0x60'),'defaultLoginLogo',_0x3e56('0x62'),_0x3e56('0x63')],'raw':!![]});})[_0x3e56('0x21')](handleEntityNotFound(_0x3bd26e,null))[_0x3e56('0x21')](function(_0x2843d6){if(_0x2843d6){var _0x47bad5=_0x2843d6[_0x3e56('0x6e')]&&fs[_0x3e56('0x6a')](path[_0x3e56('0x66')](config[_0x3e56('0x64')],_0xb4798e,_[_0x3e56('0x65')](_0x2843d6['favicon'])))?path[_0x3e56('0x66')](config[_0x3e56('0x64')],_0xb4798e,_[_0x3e56('0x65')](_0x2843d6[_0x3e56('0x6e')])):path[_0x3e56('0x66')](config[_0x3e56('0x64')],_0xb4798e,_['toLower'](_0x3e56('0x78')));var _0x1aa4e9=_0x3e56('0x70')+_['upperFirst']('favicon');if(_0x2843d6[_0x1aa4e9]||!_0x4de4af[_0x3e56('0x69')]){_0x47bad5=path[_0x3e56('0x66')](config[_0x3e56('0x64')],_0xb4798e,_[_0x3e56('0x65')](_0x3e56('0x78')));}if(!fs['existsSync'](_0x47bad5)){throw new db[(_0x3e56('0x71'))][(_0x3e56('0x79'))](_[_0x3e56('0x68')](_0x3e56('0x6e'))+_0x3e56('0x6b'));}return _0x3bd26e[_0x3e56('0x6c')](_0x47bad5);}})[_0x3e56('0x53')](handleError(_0x3bd26e,null));};exports['getDate']=function(_0x8db654,_0x1aac1a){var _0x318db3={'offset':moment()['utcOffset']()};_0x318db3['now']=moment()[_0x3e56('0x7a')](_0x318db3[_0x3e56('0x2c')])[_0x3e56('0x7b')](_0x3e56('0x7c'));return _0x1aac1a[_0x3e56('0x29')](0xc8)[_0x3e56('0x7d')](_0x318db3);}; \ No newline at end of file +var _0x8ed3=['code','message','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','Setting','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','show','params','find','body','file','filename','logo','addLogoLogin','loginLogo','getLogo','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','Sequelize','ValidationError','download','getLogoLogin','server/files/images/logos','default_loginLogo.svg','custom','\x20not\x20found','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8ed3,0x1d4));var _0x38ed=function(_0x26c1ff,_0xb7c424){_0x26c1ff=_0x26c1ff-0x0;var _0xa7f0ee=_0x8ed3[_0x26c1ff];return _0xa7f0ee;};'use strict';var emlformat=require(_0x38ed('0x0'));var rimraf=require(_0x38ed('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x38ed('0x2'));var rp=require(_0x38ed('0x3'));var moment=require(_0x38ed('0x4'));var BPromise=require(_0x38ed('0x5'));var Mustache=require(_0x38ed('0x6'));var util=require(_0x38ed('0x7'));var path=require(_0x38ed('0x8'));var sox=require(_0x38ed('0x9'));var csv=require('to-csv');var ejs=require(_0x38ed('0xa'));var fs=require('fs');var fs_extra=require(_0x38ed('0xb'));var _=require(_0x38ed('0xc'));var squel=require('squel');var crypto=require(_0x38ed('0xd'));var jsforce=require(_0x38ed('0xe'));var deskjs=require(_0x38ed('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x38ed('0x10'));var Redis=require(_0x38ed('0x11'));var authService=require(_0x38ed('0x12'));var qs=require(_0x38ed('0x13'));var as=require(_0x38ed('0x14'));var hardwareService=require(_0x38ed('0x15'));var logger=require(_0x38ed('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x38ed('0x17'));var licenseUtil=require(_0x38ed('0x18'));var db=require(_0x38ed('0x19'))['db'];var jayson=require(_0x38ed('0x1a'));var client=jayson[_0x38ed('0x1b')][_0x38ed('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x4e8dbb,_0x10adf9,_0x578d8b,_0x39cf33){return new BPromise(function(_0x4d8c18,_0x366819){var _0x355498=_0x39cf33||client;return _0x355498[_0x38ed('0x1d')](_0x4e8dbb,_0x578d8b)[_0x38ed('0x1e')](function(_0x44a246){logger[_0x38ed('0x1f')](_0x38ed('0x20'),_0x10adf9,_0x38ed('0x21'));logger[_0x38ed('0x22')]('Setting,\x20%s,\x20%s,\x20%s',_0x10adf9,_0x38ed('0x21'),JSON['stringify'](_0x44a246));if(_0x44a246[_0x38ed('0x23')]){if(_0x44a246[_0x38ed('0x23')][_0x38ed('0x24')]===0x1f4){logger[_0x38ed('0x23')](_0x38ed('0x20'),_0x10adf9,_0x44a246[_0x38ed('0x23')][_0x38ed('0x25')]);return _0x366819(_0x44a246[_0x38ed('0x23')][_0x38ed('0x25')]);}logger[_0x38ed('0x23')]('Setting,\x20%s,\x20%s',_0x10adf9,_0x44a246['error'][_0x38ed('0x25')]);return _0x4d8c18(_0x44a246[_0x38ed('0x23')][_0x38ed('0x25')]);}else{logger['info'](_0x38ed('0x20'),_0x10adf9,'request\x20sent');_0x4d8c18(_0x44a246['result'][_0x38ed('0x25')]);}})[_0x38ed('0x26')](function(_0x2e4207){logger[_0x38ed('0x23')]('Setting,\x20%s,\x20%s',_0x10adf9,_0x2e4207);_0x366819(_0x2e4207);});});}function respondWithStatusCode(_0x2c9ee9,_0x2ce646){_0x2ce646=_0x2ce646||0xcc;return function(_0x47e64b){if(_0x47e64b){return _0x2c9ee9[_0x38ed('0x27')](_0x2ce646);}return _0x2c9ee9[_0x38ed('0x28')](_0x2ce646)[_0x38ed('0x29')]();};}function respondWithResult(_0x16b3c3,_0x32f80d){_0x32f80d=_0x32f80d||0xc8;return function(_0x5b4370){if(_0x5b4370){return _0x16b3c3['status'](_0x32f80d)[_0x38ed('0x2a')](_0x5b4370);}};}function respondWithFilteredResult(_0xb20a7,_0x5f3a0c){return function(_0xfe2e1f){if(_0xfe2e1f){var _0x685dee=typeof _0x5f3a0c['offset']===_0x38ed('0x2b')&&typeof _0x5f3a0c[_0x38ed('0x2c')]===_0x38ed('0x2b');var _0x12d6f3=_0xfe2e1f[_0x38ed('0x2d')];var _0x19e4f9=_0x685dee?0x0:_0x5f3a0c[_0x38ed('0x2e')];var _0x13dea0=_0x685dee?_0xfe2e1f[_0x38ed('0x2d')]:_0x5f3a0c['offset']+_0x5f3a0c[_0x38ed('0x2c')];var _0x59736a;if(_0x13dea0>=_0x12d6f3){_0x13dea0=_0x12d6f3;_0x59736a=0xc8;}else{_0x59736a=0xce;}_0xb20a7[_0x38ed('0x28')](_0x59736a);return _0xb20a7[_0x38ed('0x2f')](_0x38ed('0x30'),_0x19e4f9+'-'+_0x13dea0+'/'+_0x12d6f3)['json'](_0xfe2e1f);}return null;};}function patchUpdates(_0xc15955){return function(_0x350b7a){try{jsonpatch[_0x38ed('0x31')](_0x350b7a,_0xc15955,!![]);}catch(_0x5a069d){return BPromise[_0x38ed('0x32')](_0x5a069d);}return _0x350b7a[_0x38ed('0x33')]();};}function saveUpdates(_0x105fc0,_0x52dfa1){return function(_0x345d71){if(_0x345d71){return _0x345d71[_0x38ed('0x34')](_0x105fc0)[_0x38ed('0x1e')](function(_0x2e2e0d){return _0x2e2e0d;});}return null;};}function removeEntity(_0x5875b6,_0x79b811){return function(_0x4d1cdf){if(_0x4d1cdf){return _0x4d1cdf[_0x38ed('0x35')]()['then'](function(){_0x5875b6['status'](0xcc)[_0x38ed('0x29')]();});}};}function handleEntityNotFound(_0x1b2974,_0x5af6a0){return function(_0x2a0983){if(!_0x2a0983){_0x1b2974[_0x38ed('0x27')](0x194);}return _0x2a0983;};}function handleError(_0x5dd8ee,_0x5bb85d){_0x5bb85d=_0x5bb85d||0x1f4;return function(_0x58f572){logger[_0x38ed('0x23')](_0x58f572[_0x38ed('0x36')]);if(_0x58f572['name']){delete _0x58f572[_0x38ed('0x37')];}_0x5dd8ee[_0x38ed('0x28')](_0x5bb85d)[_0x38ed('0x38')](_0x58f572);};}exports[_0x38ed('0x39')]=function(_0x37fcac,_0x56b191){var _0x3ca4ee={},_0x2e151c={},_0xe34b46={'count':0x0,'rows':[]};var _0xc6c9=_['map'](db[_0x38ed('0x3a')][_0x38ed('0x3b')],function(_0xa805c6){return{'name':_0xa805c6[_0x38ed('0x3c')],'type':_0xa805c6[_0x38ed('0x3d')][_0x38ed('0x3e')]};});_0x2e151c[_0x38ed('0x3f')]=_[_0x38ed('0x40')](_0xc6c9,_0x38ed('0x37'));_0x2e151c['query']=_[_0x38ed('0x41')](_0x37fcac[_0x38ed('0x42')]);_0x2e151c[_0x38ed('0x43')]=_[_0x38ed('0x44')](_0x2e151c[_0x38ed('0x3f')],_0x2e151c['query']);_0x3ca4ee[_0x38ed('0x45')]=_[_0x38ed('0x44')](_0x2e151c[_0x38ed('0x3f')],qs['fields'](_0x37fcac['query'][_0x38ed('0x46')]));_0x3ca4ee['attributes']=_0x3ca4ee[_0x38ed('0x45')][_0x38ed('0x47')]?_0x3ca4ee[_0x38ed('0x45')]:_0x2e151c[_0x38ed('0x3f')];if(!_0x37fcac[_0x38ed('0x42')][_0x38ed('0x48')](_0x38ed('0x49'))){_0x3ca4ee[_0x38ed('0x2c')]=qs['limit'](_0x37fcac[_0x38ed('0x42')][_0x38ed('0x2c')]);_0x3ca4ee[_0x38ed('0x2e')]=qs[_0x38ed('0x2e')](_0x37fcac['query'][_0x38ed('0x2e')]);}_0x3ca4ee[_0x38ed('0x4a')]=qs['sort'](_0x37fcac[_0x38ed('0x42')][_0x38ed('0x4b')]);_0x3ca4ee[_0x38ed('0x4c')]=qs[_0x38ed('0x43')](_['pick'](_0x37fcac[_0x38ed('0x42')],_0x2e151c[_0x38ed('0x43')]),_0xc6c9);if(_0x37fcac[_0x38ed('0x42')][_0x38ed('0x4d')]){_0x3ca4ee[_0x38ed('0x4c')]=_[_0x38ed('0x4e')](_0x3ca4ee[_0x38ed('0x4c')],{'$or':_['map'](_0xc6c9,function(_0x46611a){if(_0x46611a['type']!=='VIRTUAL'){var _0x1abfac={};_0x1abfac[_0x46611a['name']]={'$like':'%'+_0x37fcac[_0x38ed('0x42')][_0x38ed('0x4d')]+'%'};return _0x1abfac;}})});}_0x3ca4ee=_[_0x38ed('0x4e')]({},_0x3ca4ee,_0x37fcac[_0x38ed('0x4f')]);var _0x4a5814={'where':_0x3ca4ee['where']};return db[_0x38ed('0x3a')][_0x38ed('0x2d')](_0x4a5814)[_0x38ed('0x1e')](function(_0x22d394){_0xe34b46[_0x38ed('0x2d')]=_0x22d394;if(_0x37fcac['query'][_0x38ed('0x50')]){_0x3ca4ee[_0x38ed('0x51')]=[{'all':!![]}];}return db[_0x38ed('0x3a')][_0x38ed('0x52')](_0x3ca4ee);})['then'](function(_0x49e492){_0xe34b46['rows']=_0x49e492;return _0xe34b46;})['then'](respondWithFilteredResult(_0x56b191,_0x3ca4ee))[_0x38ed('0x26')](handleError(_0x56b191,null));};exports[_0x38ed('0x53')]=function(_0x1eaffc,_0x28d896){var _0x1f01e0={'raw':![],'where':{'id':_0x1eaffc[_0x38ed('0x54')]['id']}},_0x2701c2={};_0x2701c2['model']=_[_0x38ed('0x41')](db['Setting'][_0x38ed('0x3b')]);_0x2701c2[_0x38ed('0x42')]=_[_0x38ed('0x41')](_0x1eaffc['query']);_0x2701c2['filters']=_[_0x38ed('0x44')](_0x2701c2['model'],_0x2701c2[_0x38ed('0x42')]);_0x1f01e0['attributes']=_['intersection'](_0x2701c2[_0x38ed('0x3f')],qs[_0x38ed('0x46')](_0x1eaffc['query'][_0x38ed('0x46')]));_0x1f01e0['attributes']=_0x1f01e0[_0x38ed('0x45')][_0x38ed('0x47')]?_0x1f01e0[_0x38ed('0x45')]:_0x2701c2[_0x38ed('0x3f')];if(_0x1eaffc['query'][_0x38ed('0x50')]){_0x1f01e0[_0x38ed('0x51')]=[{'all':!![]}];}_0x1f01e0=_[_0x38ed('0x4e')]({},_0x1f01e0,_0x1eaffc['options']);return db[_0x38ed('0x3a')][_0x38ed('0x55')](_0x1f01e0)[_0x38ed('0x1e')](handleEntityNotFound(_0x28d896,null))[_0x38ed('0x1e')](respondWithResult(_0x28d896,null))[_0x38ed('0x26')](handleError(_0x28d896,null));};exports[_0x38ed('0x34')]=function(_0x2fb560,_0x46660a){if(_0x2fb560[_0x38ed('0x56')]['id']){delete _0x2fb560['body']['id'];}return db['Setting']['find']({'where':{'id':_0x2fb560[_0x38ed('0x54')]['id']}})[_0x38ed('0x1e')](handleEntityNotFound(_0x46660a,null))['then'](saveUpdates(_0x2fb560[_0x38ed('0x56')],null))['then'](respondWithResult(_0x46660a,null))[_0x38ed('0x26')](handleError(_0x46660a,null));};exports['addLogo']=function(_0xb42563,_0x567e6f,_0x51076d){if(_0xb42563[_0x38ed('0x57')]&&_0xb42563[_0x38ed('0x57')][_0x38ed('0x58')]){_0xb42563[_0x38ed('0x56')][_0x38ed('0x59')]=_0xb42563[_0x38ed('0x57')][_0x38ed('0x58')];}return db[_0x38ed('0x3a')][_0x38ed('0x55')]({'where':{'id':_0xb42563[_0x38ed('0x54')]['id']}})[_0x38ed('0x1e')](handleEntityNotFound(_0x567e6f,null))[_0x38ed('0x1e')](saveUpdates(_0xb42563['body'],null))[_0x38ed('0x1e')](respondWithResult(_0x567e6f,null))['catch'](handleError(_0x567e6f,null));};exports[_0x38ed('0x5a')]=function(_0x56034b,_0x8451a8,_0x101ca1){if(_0x56034b[_0x38ed('0x57')]&&_0x56034b[_0x38ed('0x57')][_0x38ed('0x58')]){_0x56034b['body'][_0x38ed('0x5b')]=_0x56034b['file'][_0x38ed('0x58')];}return db['Setting'][_0x38ed('0x55')]({'where':{'id':_0x56034b['params']['id']}})['then'](handleEntityNotFound(_0x8451a8,null))['then'](saveUpdates(_0x56034b[_0x38ed('0x56')],null))['then'](respondWithResult(_0x8451a8,null))[_0x38ed('0x26')](handleError(_0x8451a8,null));};var utilLicense=require(_0x38ed('0x18'));exports[_0x38ed('0x5c')]=function(_0x47372e,_0x36bee0,_0x508dbe){var _0x3a894c='server/files/images/logos';var _0xf23ec5={'custom':![]};return utilLicense[_0x38ed('0x5d')]()[_0x38ed('0x1e')](function(_0x32d300){if(_0x32d300){_0xf23ec5=_0x32d300;}return db[_0x38ed('0x3a')][_0x38ed('0x55')]({'where':{'id':_0x47372e[_0x38ed('0x54')]['id']},'attributes':[_0x38ed('0x59'),'loginLogo',_0x38ed('0x5e'),_0x38ed('0x5f'),_0x38ed('0x60'),_0x38ed('0x61'),_0x38ed('0x62'),_0x38ed('0x63')],'raw':!![]});})['then'](handleEntityNotFound(_0x36bee0,null))[_0x38ed('0x1e')](function(_0x188932){if(_0x188932){var _0xb3bd23=_0x188932[_0x38ed('0x59')]&&fs[_0x38ed('0x64')](path[_0x38ed('0x65')](config[_0x38ed('0x66')],_0x3a894c,_[_0x38ed('0x67')](_0x188932[_0x38ed('0x59')])))?path[_0x38ed('0x65')](config[_0x38ed('0x66')],_0x3a894c,_['toLower'](_0x188932[_0x38ed('0x59')])):path[_0x38ed('0x65')](config[_0x38ed('0x66')],_0x3a894c,_['toLower'](_0x38ed('0x68')));var _0xac6922=_0x38ed('0x69')+_[_0x38ed('0x6a')]('logo');if(_0x188932[_0xac6922]||!_0xf23ec5['custom']){_0xb3bd23=path[_0x38ed('0x65')](config[_0x38ed('0x66')],_0x3a894c,_[_0x38ed('0x67')](_0x38ed('0x68')));}if(!fs[_0x38ed('0x64')](_0xb3bd23)){throw new db[(_0x38ed('0x6b'))][(_0x38ed('0x6c'))](_[_0x38ed('0x6a')]('logo')+'\x20not\x20found');}return _0x36bee0[_0x38ed('0x6d')](_0xb3bd23);}})[_0x38ed('0x26')](handleError(_0x36bee0,null));};var utilLicense=require(_0x38ed('0x18'));exports[_0x38ed('0x6e')]=function(_0x39340b,_0x5a0104,_0x337812){var _0xe8941c=_0x38ed('0x6f');var _0x539f8a={'custom':![]};return utilLicense[_0x38ed('0x5d')]()[_0x38ed('0x1e')](function(_0x1d2b74){if(_0x1d2b74){_0x539f8a=_0x1d2b74;}return db[_0x38ed('0x3a')]['find']({'where':{'id':_0x39340b[_0x38ed('0x54')]['id']},'attributes':[_0x38ed('0x59'),'loginLogo',_0x38ed('0x5e'),_0x38ed('0x5f'),_0x38ed('0x60'),_0x38ed('0x61'),_0x38ed('0x62'),_0x38ed('0x63')],'raw':!![]});})[_0x38ed('0x1e')](handleEntityNotFound(_0x5a0104,null))['then'](function(_0x10701e){if(_0x10701e){var _0x47440c=_0x10701e[_0x38ed('0x5b')]&&fs[_0x38ed('0x64')](path['join'](config[_0x38ed('0x66')],_0xe8941c,_[_0x38ed('0x67')](_0x10701e[_0x38ed('0x5b')])))?path['join'](config['root'],_0xe8941c,_[_0x38ed('0x67')](_0x10701e[_0x38ed('0x5b')])):path[_0x38ed('0x65')](config[_0x38ed('0x66')],_0xe8941c,_[_0x38ed('0x67')](_0x38ed('0x70')));var _0x151d8a=_0x38ed('0x69')+_[_0x38ed('0x6a')](_0x38ed('0x5b'));if(_0x10701e[_0x151d8a]||!_0x539f8a[_0x38ed('0x71')]){_0x47440c=path[_0x38ed('0x65')](config[_0x38ed('0x66')],_0xe8941c,_[_0x38ed('0x67')](_0x38ed('0x70')));}if(!fs[_0x38ed('0x64')](_0x47440c)){throw new db[(_0x38ed('0x6b'))][(_0x38ed('0x6c'))](_[_0x38ed('0x6a')](_0x38ed('0x5b'))+_0x38ed('0x72'));}return _0x5a0104['download'](_0x47440c);}})[_0x38ed('0x26')](handleError(_0x5a0104,null));};exports[_0x38ed('0x73')]=function(_0x526203,_0x46e6bd){return db['Setting'][_0x38ed('0x55')]({'where':{'id':_0x526203['params']['id']},'attributes':[_0x38ed('0x74')]})[_0x38ed('0x1e')](respondWithResult(_0x46e6bd,null))[_0x38ed('0x26')](handleError(_0x46e6bd,null));};exports[_0x38ed('0x75')]=function(_0x20d844,_0x4661ed,_0xe63ca7){if(_0x20d844[_0x38ed('0x57')]&&_0x20d844[_0x38ed('0x57')][_0x38ed('0x58')]){_0x20d844[_0x38ed('0x56')][_0x38ed('0x5e')]=_0x20d844[_0x38ed('0x57')][_0x38ed('0x58')];}return db[_0x38ed('0x3a')][_0x38ed('0x55')]({'where':{'id':_0x20d844[_0x38ed('0x54')]['id']}})[_0x38ed('0x1e')](handleEntityNotFound(_0x4661ed,null))[_0x38ed('0x1e')](saveUpdates(_0x20d844[_0x38ed('0x56')],null))[_0x38ed('0x1e')](respondWithResult(_0x4661ed,null))['catch'](handleError(_0x4661ed,null));};var utilLicense=require(_0x38ed('0x18'));exports[_0x38ed('0x76')]=function(_0x4e7d00,_0x7028a2,_0x2a999f){var _0x539e28=_0x38ed('0x6f');var _0x25df96={'custom':![]};return utilLicense[_0x38ed('0x5d')]()[_0x38ed('0x1e')](function(_0x340ca2){if(_0x340ca2){_0x25df96=_0x340ca2;}return db['Setting']['find']({'where':{'id':_0x4e7d00[_0x38ed('0x54')]['id']},'attributes':[_0x38ed('0x59'),_0x38ed('0x5b'),'preferred',_0x38ed('0x5f'),_0x38ed('0x60'),'defaultLoginLogo','defaultPreferred',_0x38ed('0x63')],'raw':!![]});})[_0x38ed('0x1e')](handleEntityNotFound(_0x7028a2,null))[_0x38ed('0x1e')](function(_0x2beda3){if(_0x2beda3){var _0x2d119a=_0x2beda3[_0x38ed('0x5e')]&&fs[_0x38ed('0x64')](path[_0x38ed('0x65')](config[_0x38ed('0x66')],_0x539e28,_[_0x38ed('0x67')](_0x2beda3[_0x38ed('0x5e')])))?path['join'](config[_0x38ed('0x66')],_0x539e28,_[_0x38ed('0x67')](_0x2beda3[_0x38ed('0x5e')])):path[_0x38ed('0x65')](config['root'],_0x539e28,_[_0x38ed('0x67')](_0x38ed('0x77')));var _0x1ae945='default'+_['upperFirst'](_0x38ed('0x5e'));if(_0x2beda3[_0x1ae945]||!_0x25df96['custom']||!_0x25df96[_0x38ed('0x5e')]){_0x2d119a=path[_0x38ed('0x65')](config[_0x38ed('0x66')],_0x539e28,_[_0x38ed('0x67')](_0x38ed('0x77')));}if(!fs['existsSync'](_0x2d119a)){throw new db['Sequelize'][(_0x38ed('0x6c'))](_['upperFirst'](_0x38ed('0x5e'))+'\x20not\x20found');}return _0x7028a2[_0x38ed('0x6d')](_0x2d119a);}})[_0x38ed('0x26')](handleError(_0x7028a2,null));};exports[_0x38ed('0x78')]=function(_0x3a353c,_0x518619,_0x6de69c){if(_0x3a353c[_0x38ed('0x57')]&&_0x3a353c['file'][_0x38ed('0x58')]){_0x3a353c[_0x38ed('0x56')][_0x38ed('0x5f')]=_0x3a353c[_0x38ed('0x57')][_0x38ed('0x58')];}return db[_0x38ed('0x3a')][_0x38ed('0x55')]({'where':{'id':_0x3a353c[_0x38ed('0x54')]['id']}})[_0x38ed('0x1e')](handleEntityNotFound(_0x518619,null))['then'](saveUpdates(_0x3a353c[_0x38ed('0x56')],null))['then'](respondWithResult(_0x518619,null))[_0x38ed('0x26')](handleError(_0x518619,null));};var utilLicense=require('../../config/license/util');exports[_0x38ed('0x79')]=function(_0x2930b4,_0x367bf2,_0xd6a55e){var _0x7e4a30=_0x38ed('0x6f');var _0x5cb4b0={'custom':![]};return utilLicense[_0x38ed('0x5d')]()[_0x38ed('0x1e')](function(_0x5ecd50){if(_0x5ecd50){_0x5cb4b0=_0x5ecd50;}return db['Setting'][_0x38ed('0x55')]({'where':{'id':_0x2930b4[_0x38ed('0x54')]['id']},'attributes':['logo',_0x38ed('0x5b'),_0x38ed('0x5e'),_0x38ed('0x5f'),_0x38ed('0x60'),'defaultLoginLogo',_0x38ed('0x62'),_0x38ed('0x63')],'raw':!![]});})[_0x38ed('0x1e')](handleEntityNotFound(_0x367bf2,null))[_0x38ed('0x1e')](function(_0x5d5aab){if(_0x5d5aab){var _0x545961=_0x5d5aab[_0x38ed('0x5f')]&&fs[_0x38ed('0x64')](path['join'](config[_0x38ed('0x66')],_0x7e4a30,_[_0x38ed('0x67')](_0x5d5aab[_0x38ed('0x5f')])))?path['join'](config[_0x38ed('0x66')],_0x7e4a30,_[_0x38ed('0x67')](_0x5d5aab[_0x38ed('0x5f')])):path['join'](config[_0x38ed('0x66')],_0x7e4a30,_[_0x38ed('0x67')](_0x38ed('0x7a')));var _0x1edc57=_0x38ed('0x69')+_[_0x38ed('0x6a')](_0x38ed('0x5f'));if(_0x5d5aab[_0x1edc57]||!_0x5cb4b0[_0x38ed('0x71')]){_0x545961=path[_0x38ed('0x65')](config[_0x38ed('0x66')],_0x7e4a30,_[_0x38ed('0x67')]('default_favicon.ico'));}if(!fs[_0x38ed('0x64')](_0x545961)){throw new db['Sequelize'][(_0x38ed('0x6c'))](_['upperFirst']('favicon')+_0x38ed('0x72'));}return _0x367bf2['download'](_0x545961);}})['catch'](handleError(_0x367bf2,null));};exports['getDate']=function(_0x12cfb1,_0x56ea95){var _0x65f1a4={'offset':moment()[_0x38ed('0x7b')]()};_0x65f1a4['now']=moment()['utcOffset'](_0x65f1a4['offset'])[_0x38ed('0x7c')](_0x38ed('0x7d'));return _0x56ea95[_0x38ed('0x28')](0xc8)['send'](_0x65f1a4);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 838ba4a..28d270e 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_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':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4c4042,_0x1ea485){var _0xbd10dc=function(_0x164b20){while(--_0x164b20){_0x4c4042['push'](_0x4c4042['shift']());}};_0xbd10dc(++_0x1ea485);}(_0x55ca,0x126));var _0xa55c=function(_0x5e32f3,_0x3386c1){_0x5e32f3=_0x5e32f3-0x0;var _0x4d4e03=_0x55ca[_0x5e32f3];return _0x4d4e03;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 35cfb9c..677aca9 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 _0x0121=['error','code','message','request\x20sent','result','ShowSetting','find','options','raw','attributes','include','map','model','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Setting,\x20%s,\x20%s','debug','stringify'];(function(_0x1bab5b,_0x4a2039){var _0x207c1b=function(_0x332000){while(--_0x332000){_0x1bab5b['push'](_0x1bab5b['shift']());}};_0x207c1b(++_0x4a2039);}(_0x0121,0x158));var _0x1012=function(_0x18dfc7,_0x3b0a8c){_0x18dfc7=_0x18dfc7-0x0;var _0x4ff768=_0x0121[_0x18dfc7];return _0x4ff768;};'use strict';var _=require(_0x1012('0x0'));var util=require('util');var moment=require(_0x1012('0x1'));var BPromise=require(_0x1012('0x2'));var rs=require(_0x1012('0x3'));var fs=require('fs');var Redis=require(_0x1012('0x4'));var db=require(_0x1012('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1012('0x6'))(_0x1012('0x7'));var config=require(_0x1012('0x8'));var jayson=require(_0x1012('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ab5,_0x479c4e,_0x45aab3){return new BPromise(function(_0x2f857c,_0x4d223c){return client[_0x1012('0xa')](_0x3c2ab5,_0x45aab3)[_0x1012('0xb')](function(_0x1f8000){logger[_0x1012('0xc')](_0x1012('0xd'),_0x479c4e,'request\x20sent');logger[_0x1012('0xe')]('Setting,\x20%s,\x20%s,\x20%s',_0x479c4e,'request\x20sent',JSON[_0x1012('0xf')](_0x1f8000));if(_0x1f8000['error']){if(_0x1f8000[_0x1012('0x10')][_0x1012('0x11')]===0x1f4){logger[_0x1012('0x10')](_0x1012('0xd'),_0x479c4e,_0x1f8000['error'][_0x1012('0x12')]);return _0x4d223c(_0x1f8000[_0x1012('0x10')][_0x1012('0x12')]);}logger[_0x1012('0x10')](_0x1012('0xd'),_0x479c4e,_0x1f8000[_0x1012('0x10')][_0x1012('0x12')]);return _0x2f857c(_0x1f8000['error']['message']);}else{logger[_0x1012('0xc')](_0x1012('0xd'),_0x479c4e,_0x1012('0x13'));_0x2f857c(_0x1f8000[_0x1012('0x14')][_0x1012('0x12')]);}})['catch'](function(_0x266cb8){logger['error'](_0x1012('0xd'),_0x479c4e,_0x266cb8);_0x4d223c(_0x266cb8);});});}exports[_0x1012('0x15')]=function(_0x400dab){var _0x5f3365=this;return new Promise(function(_0x19211b,_0x31c32f){return db['Setting'][_0x1012('0x16')]({'raw':_0x400dab['options']?_0x400dab[_0x1012('0x17')][_0x1012('0x18')]===undefined?!![]:![]:!![],'where':_0x400dab['options']?_0x400dab['options']['where']||null:null,'attributes':_0x400dab[_0x1012('0x17')]?_0x400dab['options'][_0x1012('0x19')]||null:null,'include':_0x400dab[_0x1012('0x17')]?_0x400dab[_0x1012('0x17')][_0x1012('0x1a')]?_[_0x1012('0x1b')](_0x400dab[_0x1012('0x17')]['include'],function(_0x1da0d6){return{'model':db[_0x1da0d6[_0x1012('0x1c')]],'as':_0x1da0d6['as'],'attributes':_0x1da0d6[_0x1012('0x19')],'include':_0x1da0d6[_0x1012('0x1a')]?_['map'](_0x1da0d6['include'],function(_0x435352){return{'model':db[_0x435352[_0x1012('0x1c')]],'as':_0x435352['as'],'attributes':_0x435352[_0x1012('0x19')],'include':_0x435352[_0x1012('0x1a')]?_['map'](_0x435352[_0x1012('0x1a')],function(_0xbd9595){return{'model':db[_0xbd9595[_0x1012('0x1c')]],'as':_0xbd9595['as'],'attributes':_0xbd9595[_0x1012('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1012('0xb')](function(_0xd1ee70){logger[_0x1012('0xc')](_0x1012('0x15'),_0x400dab);logger[_0x1012('0xe')](_0x1012('0x15'),_0x400dab,JSON['stringify'](_0xd1ee70));_0x19211b(_0xd1ee70);})[_0x1012('0x1d')](function(_0x5181a1){logger[_0x1012('0x10')]('ShowSetting',_0x5181a1[_0x1012('0x12')],_0x400dab);_0x31c32f(_0x5f3365[_0x1012('0x10')](0x1f4,_0x5181a1[_0x1012('0x12')]));});});}; \ No newline at end of file +var _0x4208=['util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','result','catch','ShowSetting','Setting','find','options','include','map','model','attributes','then','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4208,0xd8));var _0x8420=function(_0x43a4c2,_0x4e400f){_0x43a4c2=_0x43a4c2-0x0;var _0x3cd4fb=_0x4208[_0x43a4c2];return _0x3cd4fb;};'use strict';var _=require(_0x8420('0x0'));var util=require(_0x8420('0x1'));var moment=require(_0x8420('0x2'));var BPromise=require('bluebird');var rs=require(_0x8420('0x3'));var fs=require('fs');var Redis=require(_0x8420('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8420('0x5'));var logger=require(_0x8420('0x6'))(_0x8420('0x7'));var config=require('../../config/environment');var jayson=require(_0x8420('0x8'));var client=jayson['client'][_0x8420('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4850cc,_0x4f3b67,_0x4fbaac){return new BPromise(function(_0x523b64,_0x416d71){return client[_0x8420('0xa')](_0x4850cc,_0x4fbaac)['then'](function(_0x21c8f7){logger[_0x8420('0xb')]('Setting,\x20%s,\x20%s',_0x4f3b67,_0x8420('0xc'));logger[_0x8420('0xd')](_0x8420('0xe'),_0x4f3b67,'request\x20sent',JSON[_0x8420('0xf')](_0x21c8f7));if(_0x21c8f7[_0x8420('0x10')]){if(_0x21c8f7['error'][_0x8420('0x11')]===0x1f4){logger[_0x8420('0x10')](_0x8420('0x12'),_0x4f3b67,_0x21c8f7['error']['message']);return _0x416d71(_0x21c8f7['error']['message']);}logger['error']('Setting,\x20%s,\x20%s',_0x4f3b67,_0x21c8f7[_0x8420('0x10')][_0x8420('0x13')]);return _0x523b64(_0x21c8f7[_0x8420('0x10')][_0x8420('0x13')]);}else{logger[_0x8420('0xb')]('Setting,\x20%s,\x20%s',_0x4f3b67,_0x8420('0xc'));_0x523b64(_0x21c8f7[_0x8420('0x14')]['message']);}})[_0x8420('0x15')](function(_0xf3334b){logger[_0x8420('0x10')](_0x8420('0x12'),_0x4f3b67,_0xf3334b);_0x416d71(_0xf3334b);});});}exports[_0x8420('0x16')]=function(_0x1452fe){var _0x3925ca=this;return new Promise(function(_0x5010ad,_0x201fd4){return db[_0x8420('0x17')][_0x8420('0x18')]({'raw':_0x1452fe[_0x8420('0x19')]?_0x1452fe[_0x8420('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1452fe['options']?_0x1452fe[_0x8420('0x19')]['where']||null:null,'attributes':_0x1452fe[_0x8420('0x19')]?_0x1452fe[_0x8420('0x19')]['attributes']||null:null,'include':_0x1452fe['options']?_0x1452fe[_0x8420('0x19')][_0x8420('0x1a')]?_[_0x8420('0x1b')](_0x1452fe[_0x8420('0x19')][_0x8420('0x1a')],function(_0x5b2800){return{'model':db[_0x5b2800[_0x8420('0x1c')]],'as':_0x5b2800['as'],'attributes':_0x5b2800['attributes'],'include':_0x5b2800[_0x8420('0x1a')]?_['map'](_0x5b2800[_0x8420('0x1a')],function(_0x459342){return{'model':db[_0x459342[_0x8420('0x1c')]],'as':_0x459342['as'],'attributes':_0x459342[_0x8420('0x1d')],'include':_0x459342[_0x8420('0x1a')]?_[_0x8420('0x1b')](_0x459342[_0x8420('0x1a')],function(_0x48c2b1){return{'model':db[_0x48c2b1[_0x8420('0x1c')]],'as':_0x48c2b1['as'],'attributes':_0x48c2b1[_0x8420('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8420('0x1e')](function(_0x5600c0){logger[_0x8420('0xb')]('ShowSetting',_0x1452fe);logger[_0x8420('0xd')](_0x8420('0x16'),_0x1452fe,JSON[_0x8420('0xf')](_0x5600c0));_0x5010ad(_0x5600c0);})[_0x8420('0x15')](function(_0x2f79e2){logger[_0x8420('0x10')](_0x8420('0x16'),_0x2f79e2[_0x8420('0x13')],_0x1452fe);_0x201fd4(_0x3925ca['error'](0x1f4,_0x2f79e2['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index daf19e8..4bbe60f 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 _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x180e73,_0x39e847){var _0xa8b095=function(_0x126b4f){while(--_0x126b4f){_0x180e73['push'](_0x180e73['shift']());}};_0xa8b095(++_0x39e847);}(_0x7a54,0x106));var _0x47a5=function(_0x6f9a56,_0x4c4a28){_0x6f9a56=_0x6f9a56-0x0;var _0x44a979=_0x7a54[_0x6f9a56];return _0x44a979;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file +var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0xe4a9e8,_0x29735c){var _0x214927=function(_0x23c387){while(--_0x23c387){_0xe4a9e8['push'](_0xe4a9e8['shift']());}};_0x214927(++_0x29735c);}(_0x7a54,0x106));var _0x47a5=function(_0x5ab65f,_0x4d7cd0){_0x5ab65f=_0x5ab65f-0x0;var _0x4adaa8=_0x7a54[_0x5ab65f];return _0x4adaa8;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 1d48988..43420f2 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 _0x30de=['ENUM','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','name','twilio','connectel','clicksend','plivo','clickatell','csc','intelepeer'];(function(_0xd89c89,_0x44b883){var _0x1733c3=function(_0x898075){while(--_0x898075){_0xd89c89['push'](_0xd89c89['shift']());}};_0x1733c3(++_0x44b883);}(_0x30de,0x1ad));var _0xe30d=function(_0x355f62,_0x4dbf53){_0x355f62=_0x355f62-0x0;var _0x47b9be=_0x30de[_0x355f62];return _0x47b9be;};'use strict';var Sequelize=require(_0xe30d('0x0'));var rs=require(_0xe30d('0x1'));module[_0xe30d('0x2')]={'name':{'type':Sequelize[_0xe30d('0x3')],'unique':_0xe30d('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xe30d('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xe30d('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xe30d('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xe30d('0x3')]},'type':{'type':Sequelize['ENUM'](_0xe30d('0x5'),'skebby',_0xe30d('0x6'),_0xe30d('0x7'),_0xe30d('0x8'),_0xe30d('0x9'),'bandwidth',_0xe30d('0xa'),'infobip',_0xe30d('0xb'))},'accountSid':{'type':Sequelize[_0xe30d('0x3')]},'authId':{'type':Sequelize[_0xe30d('0x3')]},'authToken':{'type':Sequelize[_0xe30d('0x3')]},'smsMethod':{'type':Sequelize[_0xe30d('0xc')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xe30d('0x3')]},'apiKey':{'type':Sequelize[_0xe30d('0x3')]},'applicationId':{'type':Sequelize[_0xe30d('0x3')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xe30d('0x3')]},'deliveryReport':{'type':Sequelize[_0xe30d('0xd')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xe30d('0xe')],'defaultValue':function(){return _0xe30d('0xf');}},'notificationSound':{'type':Sequelize[_0xe30d('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe30d('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe30d('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xe30d('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe30d('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe30d('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe30d('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xe30d('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe30d('0x10')],'comment':_0xe30d('0x11')},'mandatoryDisposition':{'type':Sequelize[_0xe30d('0xd')],'defaultValue':![],'comment':_0xe30d('0x12'),'set':function(_0x201008){if(!_0x201008)this[_0xe30d('0x13')](_0xe30d('0x14'),null);this[_0xe30d('0x13')]('mandatoryDisposition',_0x201008);}}}; \ No newline at end of file +var _0x6a5a=['skebby','connectel','clicksend','plivo','clickatell','bandwidth','csc','infobip','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','name','generate','ENUM','twilio'];(function(_0x11d626,_0x4a1805){var _0x11c15c=function(_0x4117e7){while(--_0x4117e7){_0x11d626['push'](_0x11d626['shift']());}};_0x11c15c(++_0x4a1805);}(_0x6a5a,0x1c1));var _0xa6a5=function(_0x3c8cf3,_0x424160){_0x3c8cf3=_0x3c8cf3-0x0;var _0x554a7d=_0x6a5a[_0x3c8cf3];return _0x554a7d;};'use strict';var Sequelize=require(_0xa6a5('0x0'));var rs=require(_0xa6a5('0x1'));module['exports']={'name':{'type':Sequelize[_0xa6a5('0x2')],'unique':_0xa6a5('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xa6a5('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xa6a5('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xa6a5('0x2')],'defaultValue':function(){return rs[_0xa6a5('0x4')]();}},'phone':{'type':Sequelize[_0xa6a5('0x2')]},'type':{'type':Sequelize[_0xa6a5('0x5')](_0xa6a5('0x6'),_0xa6a5('0x7'),_0xa6a5('0x8'),_0xa6a5('0x9'),_0xa6a5('0xa'),_0xa6a5('0xb'),_0xa6a5('0xc'),_0xa6a5('0xd'),_0xa6a5('0xe'),'intelepeer')},'accountSid':{'type':Sequelize[_0xa6a5('0x2')]},'authId':{'type':Sequelize[_0xa6a5('0x2')]},'authToken':{'type':Sequelize[_0xa6a5('0x2')]},'smsMethod':{'type':Sequelize[_0xa6a5('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0xa6a5('0x2')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0xa6a5('0x2')]},'applicationId':{'type':Sequelize[_0xa6a5('0x2')]},'accountId':{'type':Sequelize[_0xa6a5('0x2')]},'senderString':{'type':Sequelize[_0xa6a5('0x2')]},'deliveryReport':{'type':Sequelize[_0xa6a5('0xf')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xa6a5('0x10')],'defaultValue':function(){return _0xa6a5('0x11');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa6a5('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xa6a5('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa6a5('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa6a5('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa6a5('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xa6a5('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa6a5('0x12')],'comment':_0xa6a5('0x13')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xa6a5('0x14'),'set':function(_0x436cd7){if(!_0x436cd7)this[_0xa6a5('0x15')](_0xa6a5('0x16'),null);this[_0xa6a5('0x15')](_0xa6a5('0x17'),_0x436cd7);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index dc7f5d0..5fa32cd 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 _0x0ed5=['MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','bandwidth','intelepeer','isNil','ValidationError','from\x20is\x20mandatory','mapKey','DESC','list','Contacts','contact','SmsInteraction','spread','interaction','autoclose','push','close','unmanaged','*,*,*,*','created','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','queueId','SmsQueue','queue','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','text/xml','\x0a','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','bulkCreate','finally','getApplications','fullname','internal','Tag','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','CmList','List','out','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','ACCEPTD','statusGet','message-id','state','addAgents','omit','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','jayson/promise','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','update','destroy','UserProfileResource','sendStatus','stack','name','send','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','SmsAccounts','find','userProfileId','autoAssociation','params','describe','addDisposition','Disposition','getDispositions','findOne','order','SmsAccountId','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','twilio','Body','messageId','MessageSid','skebby','sender','text','connectel','from','clicksend','message_id','plivo','From','Text'];(function(_0x338061,_0x199894){var _0x2171fd=function(_0x54e337){while(--_0x54e337){_0x338061['push'](_0x338061['shift']());}};_0x2171fd(++_0x199894);}(_0x0ed5,0x138));var _0x50ed=function(_0x2ce4bd,_0x490b3d){_0x2ce4bd=_0x2ce4bd-0x0;var _0x141ebc=_0x0ed5[_0x2ce4bd];return _0x141ebc;};'use strict';var emlformat=require(_0x50ed('0x0'));var rimraf=require(_0x50ed('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x50ed('0x2'));var rp=require(_0x50ed('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x50ed('0x4'));var util=require(_0x50ed('0x5'));var path=require(_0x50ed('0x6'));var sox=require(_0x50ed('0x7'));var csv=require(_0x50ed('0x8'));var ejs=require(_0x50ed('0x9'));var fs=require('fs');var fs_extra=require(_0x50ed('0xa'));var _=require(_0x50ed('0xb'));var squel=require(_0x50ed('0xc'));var crypto=require(_0x50ed('0xd'));var jsforce=require(_0x50ed('0xe'));var deskjs=require(_0x50ed('0xf'));var toCsv=require(_0x50ed('0x8'));var querystring=require(_0x50ed('0x10'));var Papa=require(_0x50ed('0x11'));var Redis=require('ioredis');var authService=require(_0x50ed('0x12'));var qs=require(_0x50ed('0x13'));var as=require(_0x50ed('0x14'));var hardwareService=require(_0x50ed('0x15'));var logger=require(_0x50ed('0x16'))(_0x50ed('0x17'));var utils=require(_0x50ed('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x50ed('0x19')](config[_0x50ed('0x1a')],{'host':_0x50ed('0x1b'),'port':0x18eb});var socket=require(_0x50ed('0x1c'))(new Redis(config[_0x50ed('0x1a')]));require(_0x50ed('0x1d'))['register'](socket);var jayson=require(_0x50ed('0x1e'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x3ff049,_0x1bb7b7,_0x5b2a97,_0x3f4477){return new BPromise(function(_0x547db0,_0x380ec6){var _0x429232=_0x3f4477||client;return _0x429232[_0x50ed('0x1f')](_0x3ff049,_0x5b2a97)[_0x50ed('0x20')](function(_0x1caa32){logger[_0x50ed('0x21')](_0x50ed('0x22'),_0x1bb7b7,_0x50ed('0x23'));logger[_0x50ed('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1bb7b7,_0x50ed('0x23'),JSON[_0x50ed('0x25')](_0x1caa32));if(_0x1caa32[_0x50ed('0x26')]){if(_0x1caa32['error'][_0x50ed('0x27')]===0x1f4){logger[_0x50ed('0x26')](_0x50ed('0x22'),_0x1bb7b7,_0x1caa32['error'][_0x50ed('0x28')]);return _0x380ec6(_0x1caa32[_0x50ed('0x26')][_0x50ed('0x28')]);}logger[_0x50ed('0x26')]('SmsAccount,\x20%s,\x20%s',_0x1bb7b7,_0x1caa32[_0x50ed('0x26')]['message']);return _0x547db0(_0x1caa32[_0x50ed('0x26')][_0x50ed('0x28')]);}else{logger[_0x50ed('0x21')](_0x50ed('0x22'),_0x1bb7b7,_0x50ed('0x23'));_0x547db0(_0x1caa32[_0x50ed('0x29')][_0x50ed('0x28')]);}})['catch'](function(_0x4564de){logger[_0x50ed('0x26')](_0x50ed('0x22'),_0x1bb7b7,_0x4564de);_0x380ec6(_0x4564de);});});}function respondWithStatusCode(_0x2a91f0,_0x25c1e9){_0x25c1e9=_0x25c1e9||0xcc;return function(_0x52a582){if(_0x52a582){return _0x2a91f0['sendStatus'](_0x25c1e9);}return _0x2a91f0[_0x50ed('0x2a')](_0x25c1e9)[_0x50ed('0x2b')]();};}function respondWithResult(_0x25febb,_0x174b90){_0x174b90=_0x174b90||0xc8;return function(_0x1a65fa){if(_0x1a65fa){return _0x25febb[_0x50ed('0x2a')](_0x174b90)[_0x50ed('0x2c')](_0x1a65fa);}};}function respondWithFilteredResult(_0x471cbe,_0x2eadbf){return function(_0x2008d0){if(_0x2008d0){var _0x92b109=typeof _0x2eadbf['offset']==='undefined'&&typeof _0x2eadbf[_0x50ed('0x2d')]===_0x50ed('0x2e');var _0x23e2d5=_0x2008d0[_0x50ed('0x2f')];var _0xe52515=_0x92b109?0x0:_0x2eadbf[_0x50ed('0x30')];var _0x56ab8=_0x92b109?_0x2008d0['count']:_0x2eadbf[_0x50ed('0x30')]+_0x2eadbf[_0x50ed('0x2d')];var _0x5e4a1b;if(_0x56ab8>=_0x23e2d5){_0x56ab8=_0x23e2d5;_0x5e4a1b=0xc8;}else{_0x5e4a1b=0xce;}_0x471cbe[_0x50ed('0x2a')](_0x5e4a1b);return _0x471cbe[_0x50ed('0x31')](_0x50ed('0x32'),_0xe52515+'-'+_0x56ab8+'/'+_0x23e2d5)[_0x50ed('0x2c')](_0x2008d0);}return null;};}function patchUpdates(_0x29fa5e){return function(_0x4bcbf2){try{jsonpatch[_0x50ed('0x33')](_0x4bcbf2,_0x29fa5e,!![]);}catch(_0x864d56){return BPromise['reject'](_0x864d56);}return _0x4bcbf2['save']();};}function saveUpdates(_0x6c09b1,_0x1d1b4c){return function(_0x3320f8){if(_0x3320f8){return _0x3320f8[_0x50ed('0x34')](_0x6c09b1)[_0x50ed('0x20')](function(_0x579c98){return _0x579c98;});}return null;};}function removeEntity(_0x15a508,_0x538170){return function(_0x2dfcf8){if(_0x2dfcf8){return _0x2dfcf8[_0x50ed('0x35')]()[_0x50ed('0x20')](function(){var _0xbc486b=_0x2dfcf8['get']({'plain':!![]});var _0x5c5a9b='SmsAccounts';return db[_0x50ed('0x36')][_0x50ed('0x35')]({'where':{'type':_0x5c5a9b,'resourceId':_0xbc486b['id']}})[_0x50ed('0x20')](function(){return _0x2dfcf8;});})[_0x50ed('0x20')](function(){_0x15a508[_0x50ed('0x2a')](0xcc)[_0x50ed('0x2b')]();});}};}function handleEntityNotFound(_0x297523,_0x57b8f6){return function(_0x5be871){if(!_0x5be871){_0x297523[_0x50ed('0x37')](0x194);}return _0x5be871;};}function handleError(_0x257d4e,_0x2b7261){_0x2b7261=_0x2b7261||0x1f4;return function(_0x4228b9){logger['error'](_0x4228b9[_0x50ed('0x38')]);if(_0x4228b9[_0x50ed('0x39')]){delete _0x4228b9[_0x50ed('0x39')];}_0x257d4e[_0x50ed('0x2a')](_0x2b7261)[_0x50ed('0x3a')](_0x4228b9);};}exports['index']=function(_0x57fe5f,_0xff7ce3){var _0x48a226={'include':[{'model':db[_0x50ed('0x3b')],'as':_0x50ed('0x3c')}]},_0x460832={},_0xd2a9a4={'count':0x0,'rows':[]};var _0x4013bd=_[_0x50ed('0x3d')](db[_0x50ed('0x3e')][_0x50ed('0x3f')],function(_0x2c31fb){return{'name':_0x2c31fb[_0x50ed('0x40')],'type':_0x2c31fb[_0x50ed('0x41')][_0x50ed('0x42')]};});_0x460832[_0x50ed('0x43')]=_[_0x50ed('0x3d')](_0x4013bd,_0x50ed('0x39'));_0x460832[_0x50ed('0x44')]=_[_0x50ed('0x45')](_0x57fe5f[_0x50ed('0x44')]);_0x460832['filters']=_[_0x50ed('0x46')](_0x460832['model'],_0x460832[_0x50ed('0x44')]);_0x48a226[_0x50ed('0x47')]=_[_0x50ed('0x46')](_0x460832[_0x50ed('0x43')],qs[_0x50ed('0x48')](_0x57fe5f[_0x50ed('0x44')]['fields']));_0x48a226[_0x50ed('0x47')]=_0x48a226[_0x50ed('0x47')][_0x50ed('0x49')]?_0x48a226[_0x50ed('0x47')]:_0x460832['model'];if(!_0x57fe5f[_0x50ed('0x44')][_0x50ed('0x4a')](_0x50ed('0x4b'))){_0x48a226[_0x50ed('0x2d')]=qs[_0x50ed('0x2d')](_0x57fe5f[_0x50ed('0x44')][_0x50ed('0x2d')]);_0x48a226[_0x50ed('0x30')]=qs[_0x50ed('0x30')](_0x57fe5f['query'][_0x50ed('0x30')]);}_0x48a226['order']=qs['sort'](_0x57fe5f['query'][_0x50ed('0x4c')]);_0x48a226['where']=qs[_0x50ed('0x4d')](_[_0x50ed('0x4e')](_0x57fe5f[_0x50ed('0x44')],_0x460832[_0x50ed('0x4d')]),_0x4013bd);if(_0x57fe5f[_0x50ed('0x44')][_0x50ed('0x4f')]){_0x48a226[_0x50ed('0x50')]=_[_0x50ed('0x51')](_0x48a226[_0x50ed('0x50')],{'$or':_['map'](_0x4013bd,function(_0x47c227){if(_0x47c227[_0x50ed('0x41')]!==_0x50ed('0x52')){var _0x3a76ed={};_0x3a76ed[_0x47c227['name']]={'$like':'%'+_0x57fe5f['query'][_0x50ed('0x4f')]+'%'};return _0x3a76ed;}})});}_0x48a226=_[_0x50ed('0x51')]({},_0x48a226,_0x57fe5f[_0x50ed('0x53')]);var _0x2b73c7={'where':_0x48a226[_0x50ed('0x50')]};return db[_0x50ed('0x3e')][_0x50ed('0x2f')](_0x2b73c7)['then'](function(_0x2d378e){_0xd2a9a4[_0x50ed('0x2f')]=_0x2d378e;if(_0x57fe5f['query'][_0x50ed('0x54')]){_0x48a226['include']=[{'all':!![]}];}return db[_0x50ed('0x3e')][_0x50ed('0x55')](_0x48a226);})[_0x50ed('0x20')](function(_0x1d0888){_0xd2a9a4[_0x50ed('0x56')]=_0x1d0888;return _0xd2a9a4;})['then'](respondWithFilteredResult(_0xff7ce3,_0x48a226))[_0x50ed('0x57')](handleError(_0xff7ce3,null));};exports[_0x50ed('0x58')]=function(_0x837a68,_0x432c3){var _0x3227ac={'raw':![],'where':{'id':_0x837a68['params']['id']},'include':[{'model':db[_0x50ed('0x3b')],'as':_0x50ed('0x3c')}]},_0x2be091={};_0x2be091['model']=_[_0x50ed('0x45')](db[_0x50ed('0x3e')][_0x50ed('0x3f')]);_0x2be091['query']=_[_0x50ed('0x45')](_0x837a68[_0x50ed('0x44')]);_0x2be091[_0x50ed('0x4d')]=_[_0x50ed('0x46')](_0x2be091[_0x50ed('0x43')],_0x2be091['query']);_0x3227ac[_0x50ed('0x47')]=_[_0x50ed('0x46')](_0x2be091[_0x50ed('0x43')],qs['fields'](_0x837a68['query'][_0x50ed('0x48')]));_0x3227ac[_0x50ed('0x47')]=_0x3227ac[_0x50ed('0x47')][_0x50ed('0x49')]?_0x3227ac[_0x50ed('0x47')]:_0x2be091[_0x50ed('0x43')];if(_0x837a68['query'][_0x50ed('0x54')]){_0x3227ac[_0x50ed('0x59')]=[{'all':!![]}];}_0x3227ac=_[_0x50ed('0x51')]({},_0x3227ac,_0x837a68[_0x50ed('0x53')]);return db[_0x50ed('0x3e')]['find'](_0x3227ac)[_0x50ed('0x20')](handleEntityNotFound(_0x432c3,null))[_0x50ed('0x20')](respondWithResult(_0x432c3,null))[_0x50ed('0x57')](handleError(_0x432c3,null));};exports[_0x50ed('0x5a')]=function(_0x3be758,_0x4e1e98){return db[_0x50ed('0x3e')][_0x50ed('0x5a')](_0x3be758[_0x50ed('0x5b')],{})['then'](function(_0x4629c4){var _0x204e1b=_0x3be758[_0x50ed('0x5c')]['get']({'plain':!![]});if(!_0x204e1b)throw new Error(_0x50ed('0x5d'));if(_0x204e1b[_0x50ed('0x5e')]===_0x50ed('0x5c')){var _0x35a993=_0x4629c4[_0x50ed('0x5f')]({'plain':!![]});var _0x274b14=_0x50ed('0x60');return db['UserProfileSection'][_0x50ed('0x61')]({'where':{'name':_0x274b14,'userProfileId':_0x204e1b[_0x50ed('0x62')]},'raw':!![]})['then'](function(_0x500d4c){if(_0x500d4c&&_0x500d4c[_0x50ed('0x63')]===0x0){return db[_0x50ed('0x36')]['create']({'name':_0x35a993[_0x50ed('0x39')],'resourceId':_0x35a993['id'],'type':_0x500d4c['name'],'sectionId':_0x500d4c['id']},{})[_0x50ed('0x20')](function(){return _0x4629c4;});}else{return _0x4629c4;}})['catch'](function(_0x4b1e48){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4b1e48);throw _0x4b1e48;});}return _0x4629c4;})['then'](respondWithResult(_0x4e1e98,0xc9))['catch'](handleError(_0x4e1e98,null));};exports[_0x50ed('0x34')]=function(_0x3a4b13,_0x5b1b3a){if(_0x3a4b13[_0x50ed('0x5b')]['id']){delete _0x3a4b13[_0x50ed('0x5b')]['id'];}return db[_0x50ed('0x3e')][_0x50ed('0x61')]({'where':{'id':_0x3a4b13[_0x50ed('0x64')]['id']},'include':[{'model':db['Pause'],'as':_0x50ed('0x3c')}]})[_0x50ed('0x20')](handleEntityNotFound(_0x5b1b3a,null))[_0x50ed('0x20')](saveUpdates(_0x3a4b13[_0x50ed('0x5b')],null))[_0x50ed('0x20')](respondWithResult(_0x5b1b3a,null))[_0x50ed('0x57')](handleError(_0x5b1b3a,null));};exports[_0x50ed('0x35')]=function(_0xac8130,_0x4be609){return db['SmsAccount']['find']({'where':{'id':_0xac8130[_0x50ed('0x64')]['id']}})[_0x50ed('0x20')](handleEntityNotFound(_0x4be609,null))['then'](removeEntity(_0x4be609,null))[_0x50ed('0x57')](handleError(_0x4be609,null));};exports[_0x50ed('0x65')]=function(_0x20917a,_0x44ea5c){return db['SmsAccount'][_0x50ed('0x65')]()[_0x50ed('0x20')](respondWithResult(_0x44ea5c,null))[_0x50ed('0x57')](handleError(_0x44ea5c,null));};exports[_0x50ed('0x66')]=function(_0xcf72b9,_0x57f1ee,_0x7504c8){if(_0xcf72b9[_0x50ed('0x5b')]['id']){delete _0xcf72b9[_0x50ed('0x5b')]['id'];}return db[_0x50ed('0x3e')]['find']({'where':{'id':_0xcf72b9[_0x50ed('0x64')]['id']}})['then'](handleEntityNotFound(_0x57f1ee,null))['then'](function(_0x16875b){if(_0x16875b){_0xcf72b9[_0x50ed('0x5b')]['SmsAccountId']=_0x16875b['id'];return db[_0x50ed('0x67')]['create'](_0xcf72b9[_0x50ed('0x5b')]);}})['then'](respondWithResult(_0x57f1ee,null))['catch'](handleError(_0x57f1ee,null));};exports[_0x50ed('0x68')]=function(_0x15203f,_0x51392d,_0x1ea342){var _0x4b37b9={'raw':![],'where':{}};var _0x3386f8={};var _0x387293={'count':0x0,'rows':[]};return db[_0x50ed('0x3e')][_0x50ed('0x69')]({'where':{'id':_0x15203f['params']['id']}})[_0x50ed('0x20')](handleEntityNotFound(_0x51392d,null))[_0x50ed('0x20')](function(_0x4faaf0){if(_0x4faaf0){_0x3386f8[_0x50ed('0x43')]=_[_0x50ed('0x45')](db[_0x50ed('0x67')][_0x50ed('0x3f')]);_0x3386f8[_0x50ed('0x44')]=_['keys'](_0x15203f['query']);_0x3386f8['filters']=_['intersection'](_0x3386f8[_0x50ed('0x43')],_0x3386f8[_0x50ed('0x44')]);_0x4b37b9[_0x50ed('0x47')]=_[_0x50ed('0x46')](_0x3386f8[_0x50ed('0x43')],qs['fields'](_0x15203f[_0x50ed('0x44')]['fields']));_0x4b37b9[_0x50ed('0x47')]=_0x4b37b9[_0x50ed('0x47')][_0x50ed('0x49')]?_0x4b37b9['attributes']:_0x3386f8[_0x50ed('0x43')];if(!_0x15203f[_0x50ed('0x44')][_0x50ed('0x4a')](_0x50ed('0x4b'))){_0x4b37b9['limit']=qs['limit'](_0x15203f['query'][_0x50ed('0x2d')]);_0x4b37b9[_0x50ed('0x30')]=qs[_0x50ed('0x30')](_0x15203f[_0x50ed('0x44')][_0x50ed('0x30')]);}_0x4b37b9[_0x50ed('0x6a')]=qs[_0x50ed('0x4c')](_0x15203f[_0x50ed('0x44')][_0x50ed('0x4c')]);_0x4b37b9['where']=qs[_0x50ed('0x4d')](_[_0x50ed('0x4e')](_0x15203f[_0x50ed('0x44')],_0x3386f8[_0x50ed('0x4d')]));_0x4b37b9[_0x50ed('0x50')][_0x50ed('0x6b')]=_0x4faaf0['id'];if(_0x15203f['query'][_0x50ed('0x4f')]){_0x4b37b9[_0x50ed('0x50')]=_[_0x50ed('0x51')](_0x4b37b9[_0x50ed('0x50')],{'$or':_[_0x50ed('0x3d')](_0x4b37b9[_0x50ed('0x47')],function(_0x4cab7d){var _0x25d3cd={};_0x25d3cd[_0x4cab7d]={'$like':'%'+_0x15203f['query']['filter']+'%'};return _0x25d3cd;})});}_0x4b37b9=_[_0x50ed('0x51')]({},_0x4b37b9,_0x15203f[_0x50ed('0x53')]);return db[_0x50ed('0x67')]['count']({'where':_0x4b37b9[_0x50ed('0x50')]})['then'](function(_0x59730c){_0x387293[_0x50ed('0x2f')]=_0x59730c;if(_0x15203f['query'][_0x50ed('0x54')]){_0x4b37b9['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x4b37b9);})[_0x50ed('0x20')](function(_0x2b86fc){_0x387293['rows']=_0x2b86fc;return _0x387293;});}})[_0x50ed('0x20')](respondWithFilteredResult(_0x51392d,_0x4b37b9))[_0x50ed('0x57')](handleError(_0x51392d,null));};exports['removeDispositions']=function(_0x117f4a,_0x17a3c1,_0x3cc2e5){return db['SmsAccount'][_0x50ed('0x61')]({'where':{'id':_0x117f4a[_0x50ed('0x64')]['id']}})['then'](handleEntityNotFound(_0x17a3c1,null))[_0x50ed('0x20')](function(_0x2f582f){if(_0x2f582f){return _0x2f582f[_0x50ed('0x6c')](_0x117f4a['query'][_0x50ed('0x6d')]);}})[_0x50ed('0x20')](respondWithStatusCode(_0x17a3c1,null))[_0x50ed('0x57')](handleError(_0x17a3c1,null));};exports[_0x50ed('0x6e')]=function(_0x4ff257,_0x56b0d7,_0x1fba1f){if(_0x4ff257['body']['id']){delete _0x4ff257[_0x50ed('0x5b')]['id'];}return db[_0x50ed('0x3e')][_0x50ed('0x61')]({'where':{'id':_0x4ff257[_0x50ed('0x64')]['id']}})[_0x50ed('0x20')](handleEntityNotFound(_0x56b0d7,null))[_0x50ed('0x20')](function(_0x33d0a1){if(_0x33d0a1){_0x4ff257[_0x50ed('0x5b')][_0x50ed('0x6b')]=_0x33d0a1['id'];return db[_0x50ed('0x6f')][_0x50ed('0x5a')](_0x4ff257[_0x50ed('0x5b')]);}})['then'](respondWithResult(_0x56b0d7,null))[_0x50ed('0x57')](handleError(_0x56b0d7,null));};exports['getAnswers']=function(_0x199a1d,_0x272730,_0x21a44d){var _0x7f909e={'raw':![],'where':{}};var _0x5830b1={};var _0x14caf1={'count':0x0,'rows':[]};return db[_0x50ed('0x3e')][_0x50ed('0x69')]({'where':{'id':_0x199a1d[_0x50ed('0x64')]['id']}})[_0x50ed('0x20')](handleEntityNotFound(_0x272730,null))[_0x50ed('0x20')](function(_0x32c6db){if(_0x32c6db){_0x5830b1[_0x50ed('0x43')]=_[_0x50ed('0x45')](db[_0x50ed('0x6f')]['rawAttributes']);_0x5830b1['query']=_[_0x50ed('0x45')](_0x199a1d[_0x50ed('0x44')]);_0x5830b1[_0x50ed('0x4d')]=_['intersection'](_0x5830b1['model'],_0x5830b1[_0x50ed('0x44')]);_0x7f909e[_0x50ed('0x47')]=_['intersection'](_0x5830b1[_0x50ed('0x43')],qs[_0x50ed('0x48')](_0x199a1d['query'][_0x50ed('0x48')]));_0x7f909e[_0x50ed('0x47')]=_0x7f909e[_0x50ed('0x47')]['length']?_0x7f909e['attributes']:_0x5830b1[_0x50ed('0x43')];if(!_0x199a1d['query'][_0x50ed('0x4a')](_0x50ed('0x4b'))){_0x7f909e['limit']=qs[_0x50ed('0x2d')](_0x199a1d[_0x50ed('0x44')][_0x50ed('0x2d')]);_0x7f909e[_0x50ed('0x30')]=qs['offset'](_0x199a1d['query'][_0x50ed('0x30')]);}_0x7f909e[_0x50ed('0x6a')]=qs[_0x50ed('0x4c')](_0x199a1d[_0x50ed('0x44')]['sort']);_0x7f909e[_0x50ed('0x50')]=qs[_0x50ed('0x4d')](_[_0x50ed('0x4e')](_0x199a1d[_0x50ed('0x44')],_0x5830b1[_0x50ed('0x4d')]));_0x7f909e[_0x50ed('0x50')][_0x50ed('0x6b')]=_0x32c6db['id'];if(_0x199a1d[_0x50ed('0x44')][_0x50ed('0x4f')]){_0x7f909e['where']=_[_0x50ed('0x51')](_0x7f909e[_0x50ed('0x50')],{'$or':_[_0x50ed('0x3d')](_0x7f909e[_0x50ed('0x47')],function(_0x32a97a){var _0x343e9a={};_0x343e9a[_0x32a97a]={'$like':'%'+_0x199a1d['query'][_0x50ed('0x4f')]+'%'};return _0x343e9a;})});}_0x7f909e=_[_0x50ed('0x51')]({},_0x7f909e,_0x199a1d['options']);return db[_0x50ed('0x6f')][_0x50ed('0x2f')]({'where':_0x7f909e[_0x50ed('0x50')]})[_0x50ed('0x20')](function(_0x45f8bf){_0x14caf1['count']=_0x45f8bf;if(_0x199a1d[_0x50ed('0x44')]['includeAll']){_0x7f909e[_0x50ed('0x59')]=[{'all':!![]}];}return db[_0x50ed('0x6f')][_0x50ed('0x55')](_0x7f909e);})[_0x50ed('0x20')](function(_0x1752ba){_0x14caf1[_0x50ed('0x56')]=_0x1752ba;return _0x14caf1;});}})[_0x50ed('0x20')](respondWithFilteredResult(_0x272730,_0x7f909e))[_0x50ed('0x57')](handleError(_0x272730,null));};exports[_0x50ed('0x70')]=function(_0x218932,_0x3295d1,_0x41d73a){return db[_0x50ed('0x3e')][_0x50ed('0x61')]({'where':{'id':_0x218932['params']['id']}})[_0x50ed('0x20')](handleEntityNotFound(_0x3295d1,null))[_0x50ed('0x20')](function(_0x3ca99d){if(_0x3ca99d){return _0x3ca99d[_0x50ed('0x70')](_0x218932[_0x50ed('0x44')][_0x50ed('0x6d')]);}})[_0x50ed('0x20')](respondWithStatusCode(_0x3295d1,null))['catch'](handleError(_0x3295d1,null));};exports[_0x50ed('0x71')]=function(_0x4c2852,_0x36eeb0,_0x546237){var _0x36916c={'channel':_0x50ed('0x72')};var _0x5a99f0=[];var _0x52fac5=[];var _0x7228ec={};return db[_0x50ed('0x3e')][_0x50ed('0x61')]({'where':{'id':_0x4c2852[_0x50ed('0x64')]['id']},'include':[{'model':db[_0x50ed('0x73')],'as':_0x50ed('0x74')}]})['then'](handleEntityNotFound(_0x36eeb0,null))[_0x50ed('0x20')](function(_0x48e666){_0x36916c[_0x50ed('0x75')]=_0x48e666;_0x36916c[_0x50ed('0x76')]=_[_0x50ed('0x77')](_0x48e666[_0x50ed('0x74')],[_0x50ed('0x78')],[_0x50ed('0x79')]);if(_0x36916c['account'][_0x50ed('0x74')]){delete _0x36916c[_0x50ed('0x75')]['Applications'];}return db[_0x50ed('0x7a')][_0x50ed('0x65')]();})[_0x50ed('0x20')](function(_0x54389e){if(!_0x54389e){throw new db[(_0x50ed('0x7b'))]['ValidationError'](_0x50ed('0x7c'));}_0x5a99f0=_[_0x50ed('0x7d')](_[_0x50ed('0x45')](_0x54389e),[_0x50ed('0x7e'),_0x50ed('0x7f')]);_0x52fac5=_[_0x50ed('0x7d')](_[_0x50ed('0x45')](_0x54389e),[_0x50ed('0x7e'),'updatedAt',_0x50ed('0x80'),_0x50ed('0x81')]);_0x36916c['body']={'mapKey':'mobile'};if(_0x36916c[_0x50ed('0x75')][_0x50ed('0x41')]){switch(_0x36916c['account'][_0x50ed('0x41')]){case _0x50ed('0x82'):_0x36916c[_0x50ed('0x5b')]['from']=_0x4c2852[_0x50ed('0x5b')]['From'];_0x36916c[_0x50ed('0x5b')][_0x50ed('0x5b')]=_0x4c2852['body'][_0x50ed('0x83')];_0x36916c[_0x50ed('0x5b')][_0x50ed('0x84')]=_0x4c2852[_0x50ed('0x5b')][_0x50ed('0x85')];break;case _0x50ed('0x86'):_0x36916c['body']['from']='+'+_0x4c2852[_0x50ed('0x5b')][_0x50ed('0x87')];_0x36916c['body'][_0x50ed('0x5b')]=_0x4c2852[_0x50ed('0x5b')][_0x50ed('0x88')];break;case _0x50ed('0x89'):_0x36916c['body'][_0x50ed('0x8a')]=_0x4c2852[_0x50ed('0x5b')][_0x50ed('0x8a')];_0x36916c[_0x50ed('0x5b')][_0x50ed('0x5b')]=_0x4c2852[_0x50ed('0x5b')][_0x50ed('0x28')];break;case _0x50ed('0x8b'):_0x36916c['body'][_0x50ed('0x8a')]=_0x4c2852[_0x50ed('0x5b')]['from'];_0x36916c[_0x50ed('0x5b')][_0x50ed('0x5b')]=_0x4c2852[_0x50ed('0x5b')][_0x50ed('0x5b')];_0x36916c[_0x50ed('0x5b')][_0x50ed('0x84')]=_0x4c2852['body'][_0x50ed('0x8c')];break;case _0x50ed('0x8d'):_0x36916c[_0x50ed('0x5b')][_0x50ed('0x8a')]=_0x4c2852[_0x50ed('0x5b')][_0x50ed('0x8e')];_0x36916c[_0x50ed('0x5b')][_0x50ed('0x5b')]=_0x4c2852['body'][_0x50ed('0x8f')];_0x36916c[_0x50ed('0x5b')][_0x50ed('0x84')]=_0x4c2852['body'][_0x50ed('0x90')];break;case _0x50ed('0x91'):_0x36916c[_0x50ed('0x5b')][_0x50ed('0x8a')]='+'+_0x4c2852[_0x50ed('0x5b')][_0x50ed('0x92')][0x0][_0x50ed('0x8a')];_0x36916c[_0x50ed('0x5b')]['body']=_0x4c2852[_0x50ed('0x5b')][_0x50ed('0x92')][0x0]['text'];_0x36916c[_0x50ed('0x5b')][_0x50ed('0x84')]=_0x4c2852[_0x50ed('0x5b')]['results'][0x0]['messageId'];break;case _0x50ed('0x93'):_0x36916c[_0x50ed('0x5b')][_0x50ed('0x8a')]=_0x4c2852['body'][_0x50ed('0x94')];_0x36916c[_0x50ed('0x5b')][_0x50ed('0x5b')]=_0x4c2852[_0x50ed('0x5b')][_0x50ed('0x95')]['message'];break;case _0x50ed('0x96'):_0x36916c[_0x50ed('0x5b')]['from']=_0x4c2852[_0x50ed('0x5b')]['fromNumber'];_0x36916c[_0x50ed('0x5b')]['body']=_0x4c2852[_0x50ed('0x5b')][_0x50ed('0x88')];_0x36916c[_0x50ed('0x5b')][_0x50ed('0x84')]=_0x4c2852[_0x50ed('0x5b')]['replyMessageId'];break;case _0x50ed('0x97'):_0x36916c[_0x50ed('0x5b')]['messageId']=_0x4c2852[_0x50ed('0x5b')][0x0]['message']['id'];_0x36916c[_0x50ed('0x5b')]['from']=_0x4c2852[_0x50ed('0x5b')][0x0][_0x50ed('0x28')][_0x50ed('0x8a')];_0x36916c[_0x50ed('0x5b')][_0x50ed('0x5b')]=_0x4c2852['body'][0x0][_0x50ed('0x28')][_0x50ed('0x88')];break;case _0x50ed('0x98'):_0x36916c[_0x50ed('0x5b')][_0x50ed('0x8a')]=_0x4c2852[_0x50ed('0x5b')][_0x50ed('0x8a')];_0x36916c[_0x50ed('0x5b')]['body']=_0x4c2852[_0x50ed('0x5b')][_0x50ed('0x28')];_0x36916c[_0x50ed('0x5b')]['messageId']=_0x4c2852[_0x50ed('0x5b')]['refid'];break;}}if(_0x36916c[_0x50ed('0x5b')]['id']){delete _0x36916c[_0x50ed('0x5b')]['id'];}if(_[_0x50ed('0x99')](_0x36916c[_0x50ed('0x5b')][_0x50ed('0x8a')])){throw new db['Sequelize'][(_0x50ed('0x9a'))](_0x50ed('0x9b'));}if(_[_0x50ed('0x99')](_0x36916c['body'][_0x50ed('0x5b')])||_0x36916c[_0x50ed('0x5b')][_0x50ed('0x5b')]===''){throw new db[(_0x50ed('0x7b'))][(_0x50ed('0x9a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x36916c[_0x50ed('0x5b')][_0x50ed('0x9c')])){throw new db['Sequelize'][(_0x50ed('0x9a'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x52fac5);}if(!_['includes'](_0x52fac5,_0x36916c[_0x50ed('0x5b')][_0x50ed('0x9c')])){throw new db['Sequelize'][(_0x50ed('0x9a'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x52fac5);}_0x7228ec[_0x36916c['body'][_0x50ed('0x9c')]]=_0x36916c[_0x50ed('0x5b')][_0x50ed('0x8a')];return db['CmList'][_0x50ed('0x61')]({'where':{'id':_0x36916c[_0x50ed('0x75')]['ListId']},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x7228ec,'limit':0x1,'order':[[_0x50ed('0x7f'),_0x50ed('0x9d')]]}]});})['then'](handleEntityNotFound(_0x36eeb0,null))[_0x50ed('0x20')](function(_0x5e60d4){if(_0x5e60d4){_0x36916c[_0x50ed('0x9e')]=_['omit'](_0x5e60d4,[_0x50ed('0x9f')]);if(_0x5e60d4[_0x50ed('0x9f')][_0x50ed('0x49')]){return _0x5e60d4[_0x50ed('0x9f')][0x0];}var _0x1088d0=_[_0x50ed('0x19')](_0x36916c[_0x50ed('0x5b')],{'firstName':_0x36916c['body']['from'],'ListId':_0x5e60d4['id']});_0x1088d0[_0x36916c[_0x50ed('0x5b')]['mapKey']]=_0x36916c[_0x50ed('0x5b')]['from'];return db[_0x50ed('0x7a')][_0x50ed('0x5a')](_0x1088d0,{'fields':_0x5a99f0,'raw':!![]});}})[_0x50ed('0x20')](handleEntityNotFound(_0x36eeb0,null))[_0x50ed('0x20')](function(_0x30562d){if(_0x30562d){_0x36916c[_0x50ed('0xa0')]=_0x30562d;var _0x113dfa={'ContactId':_0x30562d['id'],'phone':_0x36916c['body'][_0x50ed('0x8a')],'SmsAccountId':_0x4c2852[_0x50ed('0x64')]['id']};var _0x2b28f4={'ContactId':_0x30562d['id'],'SmsAccountId':_0x4c2852[_0x50ed('0x64')]['id'],'closed':![]};return db[_0x50ed('0xa1')]['find']({'where':_0x2b28f4})['then'](function(_0x1adbd2){if(_0x1adbd2){return[_0x1adbd2,![]];}return db[_0x50ed('0xa1')][_0x50ed('0x5a')](_0x113dfa)[_0x50ed('0x20')](function(_0x3a7908){return[_0x3a7908,!![]];});});}})[_0x50ed('0xa2')](function(_0x350ba2,_0x4dfbc1){_0x36916c[_0x50ed('0xa3')]=_0x350ba2[_0x50ed('0x5f')]({'plain':!![]});_0x36916c[_0x50ed('0xa3')]['created']=![];if(_0x4dfbc1){if(_0x36916c['account'][_0x50ed('0xa4')]){_0x36916c[_0x50ed('0x76')][_0x50ed('0xa5')]({'id':0x0,'priority':_0x36916c[_0x50ed('0x76')][_0x50ed('0x49')]+0x1,'app':_0x50ed('0xa6'),'appdata':_0x50ed('0xa7'),'interval':_0x50ed('0xa8')});}_0x36916c[_0x50ed('0xa3')][_0x50ed('0xa9')]=!![];}return db[_0x50ed('0xaa')][_0x50ed('0x5a')]({'phone':_0x36916c[_0x50ed('0x5b')][_0x50ed('0x8a')],'messageId':_0x36916c['body'][_0x50ed('0x84')],'body':_0x36916c[_0x50ed('0x5b')][_0x50ed('0x5b')],'SmsAccountId':_0x4c2852[_0x50ed('0x64')]['id'],'SmsInteractionId':_0x350ba2['id'],'direction':'in','ContactId':_0x350ba2[_0x50ed('0xab')],'AttachmentId':_0x36916c[_0x50ed('0x5b')][_0x50ed('0xac')]});})[_0x50ed('0x20')](function(_0xad409d){_0x36916c[_0x50ed('0x28')]=_0xad409d;if(!_0x36916c[_0x50ed('0xa3')][_0x50ed('0xad')])return;return db[_0x50ed('0xae')][_0x50ed('0x61')]({'attributes':['id',_0x50ed('0x39')],'where':{'id':_0x36916c[_0x50ed('0xa3')][_0x50ed('0xad')]}});})['then'](function(_0x575f9a){if(_0x575f9a){_0x36916c[_0x50ed('0x76')][_0x50ed('0xaf')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x575f9a[_0x50ed('0x39')]+','+(_0x36916c['account'][_0x50ed('0xb0')]||0xa),'interval':_0x50ed('0xa8')});}if(!_0x36916c[_0x50ed('0xa3')][_0x50ed('0xb1')])return;return db[_0x50ed('0xb2')]['find']({'attributes':['id',_0x50ed('0x39')],'where':{'id':_0x36916c[_0x50ed('0xa3')][_0x50ed('0xb1')]}});})[_0x50ed('0x20')](function(_0x10f06e){if(_0x10f06e){_0x36916c[_0x50ed('0x76')]['unshift']({'id':0x0,'priority':0x1,'app':_0x50ed('0xb3'),'appdata':_0x10f06e[_0x50ed('0x39')]+','+(_0x36916c[_0x50ed('0x75')]['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start','startRouting',_0x36916c);})[_0x50ed('0x20')](function(_0xe36fe4){if(_0xe36fe4){var _0x4897c2=0xc8;var _0x3d9406=_0x50ed('0xb4');logger[_0x50ed('0x21')](_0x50ed('0xb5'),_0x3d9406,_0x4897c2,_0x50ed('0xb6'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x3d9406,_0x4897c2,_0x50ed('0xb6'),JSON['stringify'](_0xe36fe4));if(_0x36916c['account'][_0x50ed('0x41')]===_0x50ed('0x82')){return _0x36eeb0[_0x50ed('0x2a')](_0x4897c2)[_0x50ed('0x31')]('Content-Type',_0x50ed('0xb7'))[_0x50ed('0x3a')](_0x50ed('0xb8'));}else{return _0x36eeb0['status'](_0x4897c2)[_0x50ed('0x2c')](_0xe36fe4);}}})[_0x50ed('0x57')](handleError(_0x36eeb0,null));};exports[_0x50ed('0xb9')]=function(_0x558274,_0x2a9965){var _0x216eaf=_0x558274['params']['id'];var _0x337399=_0x558274[_0x50ed('0x5b')];var _0x494f3d=0xc8;var _0x193c56=null;return db[_0x50ed('0xba')][_0x50ed('0xbb')]({'isolationLevel':db[_0x50ed('0xba')][_0x50ed('0xbc')]['ISOLATION_LEVELS'][_0x50ed('0xbd')]},function(_0x20f0cd){return db['SmsAccount'][_0x50ed('0x69')]({'where':{'id':_0x216eaf},'transaction':_0x20f0cd})[_0x50ed('0x20')](function(_0x1ded2a){if(_0x1ded2a){return db[_0x50ed('0x73')][_0x50ed('0x35')]({'where':{'SmsAccountId':_0x216eaf},'transaction':_0x20f0cd})[_0x50ed('0x20')](function(){var _0x4330ef=_['map'](_0x337399,function(_0x3a4e6b){_0x3a4e6b[_0x50ed('0x6b')]=_0x216eaf;return _0x3a4e6b;});return db[_0x50ed('0x73')][_0x50ed('0xbe')](_0x4330ef,{'transaction':_0x20f0cd});});}else{_0x494f3d=0x194;_0x193c56=[];}});})[_0x50ed('0x20')](function(){if(_0x494f3d!==0x194){return db[_0x50ed('0x73')]['findAndCountAll']({'where':{'SmsAccountId':_0x216eaf},'order':'priority'})[_0x50ed('0x20')](function(_0x4471c4){_0x193c56=_0x4471c4;});}})[_0x50ed('0x57')](function(_0x44a215){_0x494f3d=0x1f4;logger['error'](_0x44a215[_0x50ed('0x38')]);if(_0x44a215[_0x50ed('0x39')]){delete _0x44a215[_0x50ed('0x39')];}_0x193c56=_0x44a215;})[_0x50ed('0xbf')](function(){if(_0x193c56===null){_0x2a9965[_0x50ed('0x37')](_0x494f3d);}else{if(_0x494f3d===0x1f4){_0x2a9965['status'](_0x494f3d)['send'](_0x193c56);}else{_0x2a9965[_0x50ed('0x2a')](_0x494f3d)[_0x50ed('0x2c')](_0x193c56);}}});};exports[_0x50ed('0xc0')]=function(_0x381b21,_0x7c7ba6,_0x589f01){var _0x5b361c={};var _0xf7ce3c={};var _0x77a6aa;var _0x33645f;return db['SmsAccount']['findOne']({'where':{'id':_0x381b21[_0x50ed('0x64')]['id']}})[_0x50ed('0x20')](handleEntityNotFound(_0x7c7ba6,null))[_0x50ed('0x20')](function(_0x1e6cbb){if(_0x1e6cbb){_0x77a6aa=_0x1e6cbb;_0xf7ce3c[_0x50ed('0x43')]=_[_0x50ed('0x45')](db[_0x50ed('0x73')][_0x50ed('0x3f')]);_0xf7ce3c[_0x50ed('0x44')]=_[_0x50ed('0x45')](_0x381b21[_0x50ed('0x44')]);_0xf7ce3c[_0x50ed('0x4d')]=_[_0x50ed('0x46')](_0xf7ce3c[_0x50ed('0x43')],_0xf7ce3c[_0x50ed('0x44')]);_0x5b361c[_0x50ed('0x47')]=_[_0x50ed('0x46')](_0xf7ce3c[_0x50ed('0x43')],qs[_0x50ed('0x48')](_0x381b21['query'][_0x50ed('0x48')]));_0x5b361c[_0x50ed('0x47')]=_0x5b361c['attributes']['length']?_0x5b361c[_0x50ed('0x47')]:_0xf7ce3c[_0x50ed('0x43')];_0x5b361c[_0x50ed('0x6a')]=qs[_0x50ed('0x4c')](_0x381b21[_0x50ed('0x44')]['sort']);_0x5b361c[_0x50ed('0x50')]=qs['filters'](_[_0x50ed('0x4e')](_0x381b21[_0x50ed('0x44')],_0xf7ce3c[_0x50ed('0x4d')]));if(_0x381b21[_0x50ed('0x44')][_0x50ed('0x4f')]){_0x5b361c['where']=_[_0x50ed('0x51')](_0x5b361c[_0x50ed('0x50')],{'$or':_['map'](_0x5b361c[_0x50ed('0x47')],function(_0x1737ad){var _0x412271={};_0x412271[_0x1737ad]={'$like':'%'+_0x381b21[_0x50ed('0x44')][_0x50ed('0x4f')]+'%'};return _0x412271;})});}_0x5b361c=_[_0x50ed('0x51')]({},_0x5b361c,_0x381b21[_0x50ed('0x53')]);return _0x77a6aa['getApplications'](_0x5b361c);}})['then'](function(_0x4fb224){if(_0x4fb224){_0x33645f=_0x4fb224[_0x50ed('0x49')];if(!_0x381b21[_0x50ed('0x44')][_0x50ed('0x4a')](_0x50ed('0x4b'))){_0x5b361c[_0x50ed('0x2d')]=qs[_0x50ed('0x2d')](_0x381b21[_0x50ed('0x44')][_0x50ed('0x2d')]);_0x5b361c[_0x50ed('0x30')]=qs[_0x50ed('0x30')](_0x381b21[_0x50ed('0x44')][_0x50ed('0x30')]);}return _0x77a6aa[_0x50ed('0xc0')](_0x5b361c);}})[_0x50ed('0x20')](function(_0x3d8c29){if(_0x3d8c29){return _0x3d8c29?{'count':_0x33645f,'rows':_0x3d8c29}:null;}})[_0x50ed('0x20')](respondWithResult(_0x7c7ba6,null))[_0x50ed('0x57')](handleError(_0x7c7ba6,null));};exports['getInteractions']=function(_0x3c7389,_0x5ed09f,_0x4cf74b){var _0xd451a3={'raw':![],'where':{}};var _0x4b0d92={};var _0x20e467={'count':0x0,'rows':[]};return db['SmsAccount'][_0x50ed('0x69')]({'where':{'id':_0x3c7389[_0x50ed('0x64')]['id']}})['then'](handleEntityNotFound(_0x5ed09f,null))[_0x50ed('0x20')](function(_0x4c6dc9){if(_0x4c6dc9){_0x4b0d92['model']=_['keys'](db[_0x50ed('0xa1')][_0x50ed('0x3f')]);_0x4b0d92[_0x50ed('0x44')]=_['keys'](_0x3c7389[_0x50ed('0x44')]);_0x4b0d92['filters']=_['intersection'](_0x4b0d92[_0x50ed('0x43')],_0x4b0d92[_0x50ed('0x44')]);_0xd451a3[_0x50ed('0x47')]=_[_0x50ed('0x46')](_0x4b0d92['model'],qs[_0x50ed('0x48')](_0x3c7389[_0x50ed('0x44')][_0x50ed('0x48')]));_0xd451a3[_0x50ed('0x47')]=_0xd451a3[_0x50ed('0x47')]['length']?_0xd451a3[_0x50ed('0x47')]:_0x4b0d92['model'];if(!_0x3c7389[_0x50ed('0x44')][_0x50ed('0x4a')](_0x50ed('0x4b'))){_0xd451a3['limit']=qs[_0x50ed('0x2d')](_0x3c7389[_0x50ed('0x44')][_0x50ed('0x2d')]);_0xd451a3[_0x50ed('0x30')]=qs['offset'](_0x3c7389[_0x50ed('0x44')][_0x50ed('0x30')]);}_0xd451a3['order']=qs[_0x50ed('0x4c')](_0x3c7389[_0x50ed('0x44')]['sort']);_0xd451a3[_0x50ed('0x50')]=qs[_0x50ed('0x4d')](_[_0x50ed('0x4e')](_0x3c7389['query'],_0x4b0d92[_0x50ed('0x4d')]));_0xd451a3[_0x50ed('0x50')][_0x50ed('0x6b')]=_0x4c6dc9['id'];if(_0x3c7389[_0x50ed('0x44')]['filter']){_0xd451a3[_0x50ed('0x50')]=_[_0x50ed('0x51')](_0xd451a3['where'],{'$or':_[_0x50ed('0x3d')](_0xd451a3[_0x50ed('0x47')],function(_0x385bac){var _0x22e034={};_0x22e034[_0x385bac]={'$like':'%'+_0x3c7389[_0x50ed('0x44')]['filter']+'%'};return _0x22e034;})});}_0xd451a3=_[_0x50ed('0x51')]({},_0xd451a3,_0x3c7389[_0x50ed('0x53')]);return db[_0x50ed('0xa1')][_0x50ed('0x2f')]({'where':_0xd451a3[_0x50ed('0x50')]})[_0x50ed('0x20')](function(_0x568ee3){_0x20e467[_0x50ed('0x2f')]=_0x568ee3;if(_0x3c7389[_0x50ed('0x44')][_0x50ed('0x54')]){_0xd451a3[_0x50ed('0x59')]=[{'model':db[_0x50ed('0x7a')],'as':'Contact','required':![]},{'model':db[_0x50ed('0xae')],'as':'Owner','attributes':['name',_0x50ed('0xc1'),_0x50ed('0xc2')],'required':![]},{'model':db[_0x50ed('0xc3')],'as':_0x50ed('0xc4'),'attributes':['id','name',_0x50ed('0xc5')],'where':_0x3c7389[_0x50ed('0x44')][_0x50ed('0xc6')]?{'id':_0x3c7389[_0x50ed('0x44')]['tag']}:undefined,'required':_0x3c7389[_0x50ed('0x44')]['tag']?!![]:![]}];}return db[_0x50ed('0xa1')]['findAll'](_0xd451a3);})['then'](function(_0x2aa723){_0x20e467['rows']=_0x2aa723;return _0x20e467;});}})[_0x50ed('0x20')](respondWithFilteredResult(_0x5ed09f,_0xd451a3))[_0x50ed('0x57')](handleError(_0x5ed09f,null));};exports[_0x50ed('0x3a')]=function(_0x477eaa,_0x133c5f,_0x1ec1ad){var _0x10b0a1,_0x1192cd,_0x164074;if(_[_0x50ed('0x99')](_0x477eaa['body'][_0x50ed('0x5b')])||_0x477eaa[_0x50ed('0x5b')][_0x50ed('0x5b')]===''){throw new db[(_0x50ed('0x7b'))][(_0x50ed('0x9a'))](_0x50ed('0xc7'));}if(_['isNil'](_0x477eaa[_0x50ed('0x5b')]['to'])){throw new db['Sequelize'][(_0x50ed('0x9a'))](_0x50ed('0xc8'));}_0x10b0a1=_0x477eaa[_0x50ed('0x5b')]['to'];return db[_0x50ed('0x3e')][_0x50ed('0x61')]({'where':{'id':_0x477eaa[_0x50ed('0x64')]['id']},'include':[{'model':db[_0x50ed('0xc9')],'as':_0x50ed('0xca'),'include':[{'model':db[_0x50ed('0x7a')],'as':_0x50ed('0x9f'),'where':{'mobile':_0x10b0a1},'limit':0x1,'order':[[_0x50ed('0x7f'),_0x50ed('0x9d')]]}]}]})[_0x50ed('0x20')](handleEntityNotFound(_0x133c5f,null))['then'](function(_0xd5e9bc){if(_0xd5e9bc&&_0xd5e9bc[_0x50ed('0xca')]){_0x1192cd=_0xd5e9bc['get']({'plain':!![]});if(_0x1192cd[_0x50ed('0xca')]&&_0x1192cd[_0x50ed('0xca')][_0x50ed('0x9f')][_0x50ed('0x49')]){return _0x1192cd[_0x50ed('0xca')][_0x50ed('0x9f')][0x0];}return db[_0x50ed('0x7a')][_0x50ed('0x5a')](_['defaults'](_0x477eaa[_0x50ed('0x5b')],{'firstName':_0x10b0a1,'mobile':_0x10b0a1,'phone':_0x10b0a1,'ListId':_0x1192cd[_0x50ed('0x81')]}));}})['then'](handleEntityNotFound(_0x133c5f,null))[_0x50ed('0x20')](function(_0x4ef74d){if(_0x4ef74d){_0x164074=_0x4ef74d;return db['SmsInteraction'][_0x50ed('0x61')]({'where':{'ContactId':_0x164074['id'],'closed':![],'SmsAccountId':_0x1192cd['id']}})[_0x50ed('0x20')](function(_0x39ca94){if(_0x39ca94){return[_0x39ca94,![]];}return db[_0x50ed('0xa1')][_0x50ed('0x5a')]({'UserId':_0x477eaa['user']['id'],'ContactId':_0x164074['id'],'SmsAccountId':_0x1192cd['id'],'phone':_0x10b0a1,'firstMsgDirection':_0x50ed('0xcb'),'Messages':[_[_0x50ed('0x51')](_0x477eaa[_0x50ed('0x5b')],{'read':![],'body':_0x477eaa[_0x50ed('0x5b')][_0x50ed('0x5b')],'phone':_0x10b0a1,'SmsAccountId':_0x1192cd['id'],'UserId':_0x477eaa[_0x50ed('0x5c')]['id'],'ContactId':_0x164074['id']})]},{'include':[{'model':db[_0x50ed('0xaa')],'as':'Messages'}]})[_0x50ed('0x20')](function(_0x277b30){return[_0x277b30,!![]];});});}})[_0x50ed('0xa2')](function(_0x2cf3ea,_0x33b62d){if(_0x33b62d){return _0x2cf3ea;}return db[_0x50ed('0xaa')]['create'](_[_0x50ed('0x51')](_0x477eaa[_0x50ed('0x5b')],{'read':![],'body':_0x477eaa[_0x50ed('0x5b')][_0x50ed('0x5b')],'phone':_0x10b0a1,'SmsAccountId':_0x1192cd['id'],'SmsInteractionId':_0x2cf3ea['id'],'UserId':_0x477eaa[_0x50ed('0x5c')]['id'],'ContactId':_0x164074['id']}))['then'](function(_0x9a25c5){_0x2cf3ea[_0x50ed('0xcc')]['Messages']=[];_0x2cf3ea[_0x50ed('0xcc')]['Messages'][_0x50ed('0xa5')](_0x9a25c5[_0x50ed('0xcc')]);return _0x2cf3ea;});})[_0x50ed('0x20')](respondWithResult(_0x133c5f,null))[_0x50ed('0x57')](handleError(_0x133c5f,null));};exports[_0x50ed('0x2a')]=function(_0x117505,_0x183f95,_0xc2e5d4){if(_0x117505[_0x50ed('0x5b')]['id']){delete _0x117505[_0x50ed('0x5b')]['id'];}var _0x13357c,_0x4f66e5,_0x52a54d;return db['SmsAccount'][_0x50ed('0x61')]({'where':{'id':_0x117505[_0x50ed('0x64')]['id']}})[_0x50ed('0x20')](handleEntityNotFound(_0x183f95,null))[_0x50ed('0x20')](function(_0x30c380){if(_0x30c380){_0x52a54d=_0x30c380;logger[_0x50ed('0x24')](_0x50ed('0xb5'),_0x50ed('0x2a'),_0x50ed('0xcd'),_0x30c380[_0x50ed('0x41')],util[_0x50ed('0xce')](_0x117505[_0x50ed('0x5b')],{'showHidden':![],'depth':null}));switch(_0x30c380[_0x50ed('0x41')]){case _0x50ed('0x86'):if(_0x117505['body'][_0x50ed('0xcf')]&&_0x117505[_0x50ed('0x5b')][_0x50ed('0x2a')]){_0x4f66e5=_0x117505[_0x50ed('0x5b')]['status'];return db[_0x50ed('0xaa')][_0x50ed('0x61')]({'where':{'messageId':_0x117505[_0x50ed('0x5b')][_0x50ed('0xcf')]}});}break;case _0x50ed('0x89'):if(_0x117505['body'][_0x50ed('0xd0')]&&_0x117505[_0x50ed('0x5b')][_0x50ed('0xd1')]){_0x4f66e5=_0x117505[_0x50ed('0x5b')]['statusInt'];return db[_0x50ed('0xaa')][_0x50ed('0x61')]({'where':{'messageId':_0x117505[_0x50ed('0x5b')][_0x50ed('0xd0')]}});}break;case _0x50ed('0x8b'):if(_0x117505[_0x50ed('0x5b')][_0x50ed('0x8c')]&&_0x117505[_0x50ed('0x5b')][_0x50ed('0xd2')]){_0x4f66e5=_0x117505[_0x50ed('0x5b')][_0x50ed('0xd2')];return db[_0x50ed('0xaa')]['find']({'where':{'messageId':_0x117505['body']['message_id']}});}break;case _0x50ed('0x91'):var _0x5210d2=_0x117505[_0x50ed('0x5b')][_0x50ed('0x92')][0x0];if(_0x5210d2[_0x50ed('0x84')]&&_0x5210d2[_0x50ed('0x2a')][_0x50ed('0xd3')]===_0x50ed('0xd4')){_0x4f66e5=_0x5210d2[_0x50ed('0x2a')][_0x50ed('0xd3')];return db[_0x50ed('0xaa')]['find']({'where':{'messageId':_0x5210d2[_0x50ed('0x84')]}});}break;case _0x50ed('0x96'):if(_0x117505[_0x50ed('0x5b')][_0x50ed('0x84')]&&_0x117505[_0x50ed('0x5b')][_0x50ed('0x2a')]){_0x4f66e5=_0x117505[_0x50ed('0x5b')][_0x50ed('0x2a')];return db[_0x50ed('0xaa')]['find']({'where':{'messageId':_0x117505[_0x50ed('0x5b')][_0x50ed('0x84')]}});}break;case'bandwidth':if(_0x117505[_0x50ed('0x5b')][0x0]['message']['id']){_0x4f66e5=_0x117505[_0x50ed('0x5b')][0x0][_0x50ed('0x41')];return db[_0x50ed('0xaa')][_0x50ed('0x61')]({'where':{'messageId':_0x117505['body'][0x0][_0x50ed('0x28')]['id']}});}break;case _0x50ed('0x98'):if(_0x117505[_0x50ed('0x5b')]['redif']&&_0x117505[_0x50ed('0x5b')][_0x50ed('0x2a')]){_0x4f66e5=_0x117505[_0x50ed('0x5b')]['status'];return db['SmsMessage'][_0x50ed('0x61')]({'where':{'messageId':_0x117505[_0x50ed('0x5b')]['redif']}});}break;}}})[_0x50ed('0x20')](handleEntityNotFound(_0x183f95,null))[_0x50ed('0x20')](function(_0x9fdfb6){if(_0x9fdfb6){_0x13357c=_0x9fdfb6;switch(_0x52a54d[_0x50ed('0x41')]){case'skebby':if(_0x4f66e5===_0x50ed('0xd4')){return _0x13357c['update']({'read':!![]});}else{logger[_0x50ed('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x50ed('0x86'),util[_0x50ed('0xce')](_0x117505[_0x50ed('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x50ed('0x89'):if(_0x4f66e5==='1'){return _0x13357c['update']({'read':!![]});}else{logger[_0x50ed('0x26')](_0x50ed('0xb5'),_0x50ed('0x2a'),'skebby',util[_0x50ed('0xce')](_0x117505[_0x50ed('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x50ed('0x8b'):if(!_0x117505[_0x50ed('0x5b')][_0x50ed('0xd5')]&&_0x4f66e5>=0xc8&&_0x4f66e5<=0xce){return _0x13357c[_0x50ed('0x34')]({'read':!![]});}else{logger[_0x50ed('0x26')](_0x50ed('0xb5'),'status',_0x50ed('0x8b'),util[_0x50ed('0xce')](_0x117505['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x5705d8=_0x117505[_0x50ed('0x5b')][_0x50ed('0x92')][0x0];if(_0x5705d8[_0x50ed('0x2a')][_0x50ed('0xd3')]===_0x50ed('0xd4')){return _0x13357c[_0x50ed('0x34')]({'read':!![]});}else{logger['error'](_0x50ed('0xb5'),_0x50ed('0x2a'),_0x50ed('0x91'),util[_0x50ed('0xce')](_0x117505['body'],{'showHidden':![],'depth':null}));}break;case _0x50ed('0x96'):if(_0x4f66e5==_0x50ed('0xd6')||_0x4f66e5==_0x50ed('0xd7')){return _0x13357c[_0x50ed('0x34')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x50ed('0x2a'),'clickatell',util[_0x50ed('0xce')](_0x117505[_0x50ed('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x50ed('0x97'):if(_0x4f66e5==_0x50ed('0xd8')){return _0x13357c[_0x50ed('0x34')]({'read':!![]});}else{logger[_0x50ed('0x26')](_0x50ed('0xb5'),_0x50ed('0x2a'),_0x50ed('0x97'),util['inspect'](_0x117505[_0x50ed('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x50ed('0x98'):if(_0x4f66e5==='DELIVRD'||_0x4f66e5===_0x50ed('0xd9')){return _0x13357c['update']({'read':!![]});}else{logger[_0x50ed('0x26')](_0x50ed('0xb5'),_0x50ed('0x2a'),_0x50ed('0x98'),util['inspect'](_0x117505['body'],{'showHidden':![],'depth':null}));}break;}return _0x13357c;}})[_0x50ed('0x20')](respondWithResult(_0x183f95,null))['catch'](handleError(_0x183f95,null));};exports[_0x50ed('0xda')]=function(_0x21c554,_0x198e29,_0x3339d6){var _0x4d4c46,_0x2cde6e,_0x3003b4;return db[_0x50ed('0x3e')][_0x50ed('0x61')]({'where':{'id':_0x21c554[_0x50ed('0x64')]['id']}})[_0x50ed('0x20')](handleEntityNotFound(_0x198e29,null))[_0x50ed('0x20')](function(_0xcf342){if(_0xcf342){_0x3003b4=_0xcf342;logger[_0x50ed('0x24')](_0x50ed('0xb5'),'status','received\x20delivery\x20report\x20from',_0xcf342['type'],util[_0x50ed('0xce')](_0x21c554[_0x50ed('0x44')],{'showHidden':![],'depth':null}));switch(_0xcf342['type']){case _0x50ed('0x93'):if(_0x21c554['query'][_0x50ed('0xdb')]&&_0x21c554[_0x50ed('0x44')][_0x50ed('0xdc')]){_0x2cde6e=_0x21c554[_0x50ed('0x44')][_0x50ed('0xdc')];return db[_0x50ed('0xaa')][_0x50ed('0x61')]({'where':{'messageId':_0x21c554[_0x50ed('0x44')][_0x50ed('0xdb')]}});}break;}}})[_0x50ed('0x20')](handleEntityNotFound(_0x198e29,null))['then'](function(_0xc3a277){if(_0xc3a277){_0x4d4c46=_0xc3a277;switch(_0x3003b4[_0x50ed('0x41')]){case _0x50ed('0x93'):if(_0x2cde6e==='2'||_0x2cde6e==='6'){return _0x4d4c46[_0x50ed('0x34')]({'read':!![]});}else{logger[_0x50ed('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x50ed('0x2a'),'csc',util[_0x50ed('0xce')](_0x21c554[_0x50ed('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x4d4c46;}})['then'](respondWithResult(_0x198e29,null))[_0x50ed('0x57')](handleError(_0x198e29,null));};exports[_0x50ed('0xdd')]=function(_0x18092d,_0x5dbfa3,_0x386ee0){return db[_0x50ed('0x3e')][_0x50ed('0x61')]({'where':{'id':_0x18092d['params']['id']}})[_0x50ed('0x20')](handleEntityNotFound(_0x5dbfa3,null))[_0x50ed('0x20')](function(_0x2ee302){if(_0x2ee302){return _0x2ee302[_0x50ed('0xdd')](_0x18092d[_0x50ed('0x5b')][_0x50ed('0x6d')],_[_0x50ed('0xde')](_0x18092d['body'],[_0x50ed('0x6d'),'id'])||{})[_0x50ed('0xa2')](function(_0x4c0383){for(var _0x21cf27=0x0;_0x21cf27<_0x18092d[_0x50ed('0x5b')][_0x50ed('0x6d')][_0x50ed('0x49')];_0x21cf27+=0x1){socket[_0x50ed('0xdf')](_0x50ed('0xe0'),{'UserId':Number(_0x18092d[_0x50ed('0x5b')]['ids'][_0x21cf27]),'SmsAccountId':Number(_0x18092d[_0x50ed('0x64')]['id'])});}return _0x4c0383;});}})[_0x50ed('0x20')](respondWithResult(_0x5dbfa3,null))[_0x50ed('0x57')](handleError(_0x5dbfa3,null));};exports[_0x50ed('0xe1')]=function(_0x561f22,_0xc1b4b,_0x14fbfc){return db['SmsAccount'][_0x50ed('0x61')]({'where':{'id':_0x561f22['params']['id']}})[_0x50ed('0x20')](handleEntityNotFound(_0xc1b4b,null))['then'](function(_0x424357){if(_0x424357){return _0x424357[_0x50ed('0xe1')](_0x561f22[_0x50ed('0x44')][_0x50ed('0x6d')])[_0x50ed('0x20')](function(){if(_['isArray'](_0x561f22[_0x50ed('0x44')][_0x50ed('0x6d')])){for(var _0x59c489=0x0;_0x59c489<_0x561f22[_0x50ed('0x44')][_0x50ed('0x6d')][_0x50ed('0x49')];_0x59c489+=0x1){socket[_0x50ed('0xdf')]('userSmsAccount:remove',{'UserId':Number(_0x561f22[_0x50ed('0x44')][_0x50ed('0x6d')][_0x59c489]),'SmsAccountId':Number(_0x561f22[_0x50ed('0x64')]['id'])});}}else{socket[_0x50ed('0xdf')](_0x50ed('0xe2'),{'UserId':Number(_0x561f22[_0x50ed('0x44')][_0x50ed('0x6d')]),'SmsAccountId':Number(_0x561f22['params']['id'])});}});}})['then'](respondWithStatusCode(_0xc1b4b,null))['catch'](handleError(_0xc1b4b,null));};exports[_0x50ed('0xe3')]=function(_0x4b2f4,_0x257aaf,_0x229292){var _0x3c319c={};var _0xa9e785={};var _0x15fa68;var _0x15b1fd;return db['SmsAccount']['findOne']({'where':{'id':_0x4b2f4['params']['id']}})[_0x50ed('0x20')](handleEntityNotFound(_0x257aaf,null))[_0x50ed('0x20')](function(_0x89c3e1){if(_0x89c3e1){_0x15fa68=_0x89c3e1;_0xa9e785[_0x50ed('0x43')]=_[_0x50ed('0x45')](db[_0x50ed('0xae')][_0x50ed('0x3f')]);_0xa9e785[_0x50ed('0x44')]=_[_0x50ed('0x45')](_0x4b2f4['query']);_0xa9e785['filters']=_[_0x50ed('0x46')](_0xa9e785[_0x50ed('0x43')],_0xa9e785[_0x50ed('0x44')]);_0x3c319c[_0x50ed('0x47')]=_['intersection'](_0xa9e785[_0x50ed('0x43')],qs[_0x50ed('0x48')](_0x4b2f4[_0x50ed('0x44')][_0x50ed('0x48')]));_0x3c319c[_0x50ed('0x47')]=_0x3c319c[_0x50ed('0x47')][_0x50ed('0x49')]?_0x3c319c[_0x50ed('0x47')]:_0xa9e785[_0x50ed('0x43')];_0x3c319c[_0x50ed('0x6a')]=qs[_0x50ed('0x4c')](_0x4b2f4['query']['sort']);_0x3c319c[_0x50ed('0x50')]=qs[_0x50ed('0x4d')](_[_0x50ed('0x4e')](_0x4b2f4[_0x50ed('0x44')],_0xa9e785[_0x50ed('0x4d')]));if(_0x4b2f4[_0x50ed('0x44')][_0x50ed('0x4f')]){_0x3c319c[_0x50ed('0x50')]=_[_0x50ed('0x51')](_0x3c319c[_0x50ed('0x50')],{'$or':_[_0x50ed('0x3d')](_0x3c319c[_0x50ed('0x47')],function(_0x1119d4){var _0x340d1f={};_0x340d1f[_0x1119d4]={'$like':'%'+_0x4b2f4[_0x50ed('0x44')][_0x50ed('0x4f')]+'%'};return _0x340d1f;})});}_0x3c319c=_[_0x50ed('0x51')]({},_0x3c319c,_0x4b2f4[_0x50ed('0x53')]);return _0x15fa68['getAgents'](_0x3c319c);}})[_0x50ed('0x20')](function(_0x5591b4){if(_0x5591b4){_0x15b1fd=_0x5591b4[_0x50ed('0x49')];if(!_0x4b2f4[_0x50ed('0x44')][_0x50ed('0x4a')]('nolimit')){_0x3c319c[_0x50ed('0x2d')]=qs[_0x50ed('0x2d')](_0x4b2f4['query'][_0x50ed('0x2d')]);_0x3c319c['offset']=qs[_0x50ed('0x30')](_0x4b2f4['query'][_0x50ed('0x30')]);}return _0x15fa68['getAgents'](_0x3c319c);}})[_0x50ed('0x20')](function(_0x4dbcdd){if(_0x4dbcdd){return _0x4dbcdd?{'count':_0x15b1fd,'rows':_0x4dbcdd}:null;}})[_0x50ed('0x20')](respondWithResult(_0x257aaf,null))['catch'](handleError(_0x257aaf,null));}; \ No newline at end of file +var _0x1729=['unshift','agent','waitForTheAssignedAgent','queueId','SmsQueue','queue','startRouting','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','Contact','User','Owner','fullname','internal','Tags','tag','to\x20is\x20mandatory','List','user','out','Messages','dataValues','received\x20delivery\x20report\x20from','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','redif','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','ACCEPTD','statusGet','csc','message-id','state','addAgents','emit','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsAccount.socket','register','client','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','SmsAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','SmsAccount','include','findAll','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','SmsAccountId','Disposition','getDispositions','findOne','filter','includeAll','removeDispositions','ids','addAnswer','CannedAnswer','rows','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','priority','asc','CmContact','updatedAt','difference','createdAt','CompanyId','ListId','mobile','twilio','from','Body','MessageSid','skebby','sender','text','connectel','clicksend','messageId','message_id','plivo','From','Text','MessageUUID','infobip','results','originatingAddress','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','ValidationError','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','defaults','contact','SmsInteraction','spread','interaction','created','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','UserId'];(function(_0x3cfd5d,_0x5a35d3){var _0x1ffc55=function(_0x56ebdf){while(--_0x56ebdf){_0x3cfd5d['push'](_0x3cfd5d['shift']());}};_0x1ffc55(++_0x5a35d3);}(_0x1729,0x11f));var _0x9172=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0x1729[_0x39c734];return _0xb2a2f9;};'use strict';var emlformat=require(_0x9172('0x0'));var rimraf=require(_0x9172('0x1'));var zipdir=require(_0x9172('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9172('0x3'));var moment=require(_0x9172('0x4'));var BPromise=require(_0x9172('0x5'));var Mustache=require(_0x9172('0x6'));var util=require(_0x9172('0x7'));var path=require(_0x9172('0x8'));var sox=require(_0x9172('0x9'));var csv=require(_0x9172('0xa'));var ejs=require(_0x9172('0xb'));var fs=require('fs');var fs_extra=require(_0x9172('0xc'));var _=require(_0x9172('0xd'));var squel=require(_0x9172('0xe'));var crypto=require(_0x9172('0xf'));var jsforce=require(_0x9172('0x10'));var deskjs=require(_0x9172('0x11'));var toCsv=require(_0x9172('0xa'));var querystring=require(_0x9172('0x12'));var Papa=require(_0x9172('0x13'));var Redis=require('ioredis');var authService=require(_0x9172('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x9172('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9172('0x16'))(_0x9172('0x17'));var utils=require(_0x9172('0x18'));var config=require(_0x9172('0x19'));var licenseUtil=require(_0x9172('0x1a'));var db=require(_0x9172('0x1b'))['db'];config[_0x9172('0x1c')]=_['defaults'](config[_0x9172('0x1c')],{'host':_0x9172('0x1d'),'port':0x18eb});var socket=require(_0x9172('0x1e'))(new Redis(config['redis']));require(_0x9172('0x1f'))[_0x9172('0x20')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9172('0x21')]['http']({'port':0x232c});function respondWithRpcPromise(_0x1f79f9,_0x54d7d4,_0x385e79,_0x481846){return new BPromise(function(_0x4f7677,_0x5cd4fd){var _0x1e6dcb=_0x481846||client;return _0x1e6dcb[_0x9172('0x22')](_0x1f79f9,_0x385e79)[_0x9172('0x23')](function(_0x4ca73d){logger['info'](_0x9172('0x24'),_0x54d7d4,_0x9172('0x25'));logger[_0x9172('0x26')](_0x9172('0x27'),_0x54d7d4,_0x9172('0x25'),JSON['stringify'](_0x4ca73d));if(_0x4ca73d[_0x9172('0x28')]){if(_0x4ca73d[_0x9172('0x28')][_0x9172('0x29')]===0x1f4){logger[_0x9172('0x28')]('SmsAccount,\x20%s,\x20%s',_0x54d7d4,_0x4ca73d[_0x9172('0x28')][_0x9172('0x2a')]);return _0x5cd4fd(_0x4ca73d[_0x9172('0x28')]['message']);}logger[_0x9172('0x28')](_0x9172('0x24'),_0x54d7d4,_0x4ca73d['error'][_0x9172('0x2a')]);return _0x4f7677(_0x4ca73d[_0x9172('0x28')][_0x9172('0x2a')]);}else{logger[_0x9172('0x2b')](_0x9172('0x24'),_0x54d7d4,_0x9172('0x25'));_0x4f7677(_0x4ca73d[_0x9172('0x2c')][_0x9172('0x2a')]);}})[_0x9172('0x2d')](function(_0x5d9512){logger[_0x9172('0x28')](_0x9172('0x24'),_0x54d7d4,_0x5d9512);_0x5cd4fd(_0x5d9512);});});}function respondWithStatusCode(_0x1a1781,_0x40ccb7){_0x40ccb7=_0x40ccb7||0xcc;return function(_0x47fa42){if(_0x47fa42){return _0x1a1781[_0x9172('0x2e')](_0x40ccb7);}return _0x1a1781[_0x9172('0x2f')](_0x40ccb7)[_0x9172('0x30')]();};}function respondWithResult(_0xc2eb19,_0x56cfb6){_0x56cfb6=_0x56cfb6||0xc8;return function(_0x205726){if(_0x205726){return _0xc2eb19['status'](_0x56cfb6)[_0x9172('0x31')](_0x205726);}};}function respondWithFilteredResult(_0x100144,_0x362218){return function(_0x4e591f){if(_0x4e591f){var _0x18adff=typeof _0x362218[_0x9172('0x32')]==='undefined'&&typeof _0x362218[_0x9172('0x33')]==='undefined';var _0x3e6c0e=_0x4e591f[_0x9172('0x34')];var _0x213040=_0x18adff?0x0:_0x362218['offset'];var _0x3c2c18=_0x18adff?_0x4e591f[_0x9172('0x34')]:_0x362218['offset']+_0x362218['limit'];var _0x2fc81b;if(_0x3c2c18>=_0x3e6c0e){_0x3c2c18=_0x3e6c0e;_0x2fc81b=0xc8;}else{_0x2fc81b=0xce;}_0x100144[_0x9172('0x2f')](_0x2fc81b);return _0x100144[_0x9172('0x35')](_0x9172('0x36'),_0x213040+'-'+_0x3c2c18+'/'+_0x3e6c0e)[_0x9172('0x31')](_0x4e591f);}return null;};}function patchUpdates(_0x19dd86){return function(_0x5528a8){try{jsonpatch[_0x9172('0x37')](_0x5528a8,_0x19dd86,!![]);}catch(_0xf0fdb2){return BPromise[_0x9172('0x38')](_0xf0fdb2);}return _0x5528a8[_0x9172('0x39')]();};}function saveUpdates(_0x2fb911,_0x42524d){return function(_0x4b2962){if(_0x4b2962){return _0x4b2962[_0x9172('0x3a')](_0x2fb911)[_0x9172('0x23')](function(_0x381de4){return _0x381de4;});}return null;};}function removeEntity(_0x577f90,_0x1bb68a){return function(_0x155cc9){if(_0x155cc9){return _0x155cc9[_0x9172('0x3b')]()[_0x9172('0x23')](function(){var _0x4c75f6=_0x155cc9[_0x9172('0x3c')]({'plain':!![]});var _0x24df16=_0x9172('0x3d');return db['UserProfileResource']['destroy']({'where':{'type':_0x24df16,'resourceId':_0x4c75f6['id']}})[_0x9172('0x23')](function(){return _0x155cc9;});})['then'](function(){_0x577f90['status'](0xcc)[_0x9172('0x30')]();});}};}function handleEntityNotFound(_0x5d17d4,_0x568a9d){return function(_0x5537aa){if(!_0x5537aa){_0x5d17d4['sendStatus'](0x194);}return _0x5537aa;};}function handleError(_0x56e019,_0x1dd909){_0x1dd909=_0x1dd909||0x1f4;return function(_0xd70a5c){logger[_0x9172('0x28')](_0xd70a5c[_0x9172('0x3e')]);if(_0xd70a5c[_0x9172('0x3f')]){delete _0xd70a5c['name'];}_0x56e019[_0x9172('0x2f')](_0x1dd909)[_0x9172('0x40')](_0xd70a5c);};}exports[_0x9172('0x41')]=function(_0x3928c1,_0x332db4){var _0x104c0c={'include':[{'model':db[_0x9172('0x42')],'as':_0x9172('0x43')}]},_0x2d926c={},_0x13caf8={'count':0x0,'rows':[]};var _0x110fec=_[_0x9172('0x44')](db['SmsAccount'][_0x9172('0x45')],function(_0x1ed223){return{'name':_0x1ed223['fieldName'],'type':_0x1ed223[_0x9172('0x46')][_0x9172('0x47')]};});_0x2d926c[_0x9172('0x48')]=_['map'](_0x110fec,_0x9172('0x3f'));_0x2d926c[_0x9172('0x49')]=_['keys'](_0x3928c1[_0x9172('0x49')]);_0x2d926c[_0x9172('0x4a')]=_[_0x9172('0x4b')](_0x2d926c[_0x9172('0x48')],_0x2d926c[_0x9172('0x49')]);_0x104c0c[_0x9172('0x4c')]=_[_0x9172('0x4b')](_0x2d926c[_0x9172('0x48')],qs[_0x9172('0x4d')](_0x3928c1[_0x9172('0x49')][_0x9172('0x4d')]));_0x104c0c[_0x9172('0x4c')]=_0x104c0c[_0x9172('0x4c')][_0x9172('0x4e')]?_0x104c0c[_0x9172('0x4c')]:_0x2d926c['model'];if(!_0x3928c1[_0x9172('0x49')][_0x9172('0x4f')](_0x9172('0x50'))){_0x104c0c['limit']=qs[_0x9172('0x33')](_0x3928c1[_0x9172('0x49')][_0x9172('0x33')]);_0x104c0c[_0x9172('0x32')]=qs[_0x9172('0x32')](_0x3928c1[_0x9172('0x49')]['offset']);}_0x104c0c[_0x9172('0x51')]=qs[_0x9172('0x52')](_0x3928c1[_0x9172('0x49')][_0x9172('0x52')]);_0x104c0c[_0x9172('0x53')]=qs[_0x9172('0x4a')](_[_0x9172('0x54')](_0x3928c1[_0x9172('0x49')],_0x2d926c[_0x9172('0x4a')]),_0x110fec);if(_0x3928c1[_0x9172('0x49')]['filter']){_0x104c0c[_0x9172('0x53')]=_[_0x9172('0x55')](_0x104c0c['where'],{'$or':_[_0x9172('0x44')](_0x110fec,function(_0x4ffa7b){if(_0x4ffa7b[_0x9172('0x46')]!==_0x9172('0x56')){var _0x5f60e4={};_0x5f60e4[_0x4ffa7b['name']]={'$like':'%'+_0x3928c1[_0x9172('0x49')]['filter']+'%'};return _0x5f60e4;}})});}_0x104c0c=_[_0x9172('0x55')]({},_0x104c0c,_0x3928c1[_0x9172('0x57')]);var _0x16e291={'where':_0x104c0c[_0x9172('0x53')]};return db[_0x9172('0x58')][_0x9172('0x34')](_0x16e291)['then'](function(_0x435ce6){_0x13caf8[_0x9172('0x34')]=_0x435ce6;if(_0x3928c1[_0x9172('0x49')]['includeAll']){_0x104c0c[_0x9172('0x59')]=[{'all':!![]}];}return db['SmsAccount'][_0x9172('0x5a')](_0x104c0c);})[_0x9172('0x23')](function(_0x77abe3){_0x13caf8['rows']=_0x77abe3;return _0x13caf8;})[_0x9172('0x23')](respondWithFilteredResult(_0x332db4,_0x104c0c))[_0x9172('0x2d')](handleError(_0x332db4,null));};exports[_0x9172('0x5b')]=function(_0x18eb6f,_0x16ed0e){var _0x22f817={'raw':![],'where':{'id':_0x18eb6f[_0x9172('0x5c')]['id']},'include':[{'model':db[_0x9172('0x42')],'as':_0x9172('0x43')}]},_0x27a79a={};_0x27a79a[_0x9172('0x48')]=_['keys'](db[_0x9172('0x58')][_0x9172('0x45')]);_0x27a79a['query']=_[_0x9172('0x5d')](_0x18eb6f['query']);_0x27a79a['filters']=_['intersection'](_0x27a79a[_0x9172('0x48')],_0x27a79a[_0x9172('0x49')]);_0x22f817['attributes']=_[_0x9172('0x4b')](_0x27a79a[_0x9172('0x48')],qs[_0x9172('0x4d')](_0x18eb6f[_0x9172('0x49')][_0x9172('0x4d')]));_0x22f817[_0x9172('0x4c')]=_0x22f817[_0x9172('0x4c')][_0x9172('0x4e')]?_0x22f817[_0x9172('0x4c')]:_0x27a79a[_0x9172('0x48')];if(_0x18eb6f[_0x9172('0x49')]['includeAll']){_0x22f817[_0x9172('0x59')]=[{'all':!![]}];}_0x22f817=_[_0x9172('0x55')]({},_0x22f817,_0x18eb6f['options']);return db['SmsAccount'][_0x9172('0x5e')](_0x22f817)[_0x9172('0x23')](handleEntityNotFound(_0x16ed0e,null))['then'](respondWithResult(_0x16ed0e,null))[_0x9172('0x2d')](handleError(_0x16ed0e,null));};exports[_0x9172('0x5f')]=function(_0x183c6d,_0x5ad2b4){return db['SmsAccount']['create'](_0x183c6d[_0x9172('0x60')],{})[_0x9172('0x23')](function(_0x5d4e55){var _0x3115ac=_0x183c6d['user'][_0x9172('0x3c')]({'plain':!![]});if(!_0x3115ac)throw new Error(_0x9172('0x61'));if(_0x3115ac['role']==='user'){var _0x21294e=_0x5d4e55[_0x9172('0x3c')]({'plain':!![]});var _0x25581f=_0x9172('0x3d');return db[_0x9172('0x62')][_0x9172('0x5e')]({'where':{'name':_0x25581f,'userProfileId':_0x3115ac[_0x9172('0x63')]},'raw':!![]})[_0x9172('0x23')](function(_0x37e563){if(_0x37e563&&_0x37e563['autoAssociation']===0x0){return db['UserProfileResource'][_0x9172('0x5f')]({'name':_0x21294e[_0x9172('0x3f')],'resourceId':_0x21294e['id'],'type':_0x37e563[_0x9172('0x3f')],'sectionId':_0x37e563['id']},{})[_0x9172('0x23')](function(){return _0x5d4e55;});}else{return _0x5d4e55;}})[_0x9172('0x2d')](function(_0x30089f){logger['error'](_0x9172('0x64'),_0x30089f);throw _0x30089f;});}return _0x5d4e55;})['then'](respondWithResult(_0x5ad2b4,0xc9))['catch'](handleError(_0x5ad2b4,null));};exports[_0x9172('0x3a')]=function(_0x4fb5ab,_0x91d5e9){if(_0x4fb5ab['body']['id']){delete _0x4fb5ab['body']['id'];}return db[_0x9172('0x58')][_0x9172('0x5e')]({'where':{'id':_0x4fb5ab[_0x9172('0x5c')]['id']},'include':[{'model':db[_0x9172('0x42')],'as':_0x9172('0x43')}]})[_0x9172('0x23')](handleEntityNotFound(_0x91d5e9,null))[_0x9172('0x23')](saveUpdates(_0x4fb5ab[_0x9172('0x60')],null))['then'](respondWithResult(_0x91d5e9,null))['catch'](handleError(_0x91d5e9,null));};exports[_0x9172('0x3b')]=function(_0x2e758d,_0x3cc548){return db[_0x9172('0x58')][_0x9172('0x5e')]({'where':{'id':_0x2e758d[_0x9172('0x5c')]['id']}})[_0x9172('0x23')](handleEntityNotFound(_0x3cc548,null))[_0x9172('0x23')](removeEntity(_0x3cc548,null))[_0x9172('0x2d')](handleError(_0x3cc548,null));};exports['describe']=function(_0x3c6aa5,_0x534213){return db[_0x9172('0x58')][_0x9172('0x65')]()[_0x9172('0x23')](respondWithResult(_0x534213,null))[_0x9172('0x2d')](handleError(_0x534213,null));};exports['addDisposition']=function(_0x54da66,_0x19abc6,_0xd6f234){if(_0x54da66[_0x9172('0x60')]['id']){delete _0x54da66[_0x9172('0x60')]['id'];}return db[_0x9172('0x58')][_0x9172('0x5e')]({'where':{'id':_0x54da66[_0x9172('0x5c')]['id']}})['then'](handleEntityNotFound(_0x19abc6,null))['then'](function(_0x3c0418){if(_0x3c0418){_0x54da66[_0x9172('0x60')][_0x9172('0x66')]=_0x3c0418['id'];return db[_0x9172('0x67')][_0x9172('0x5f')](_0x54da66[_0x9172('0x60')]);}})[_0x9172('0x23')](respondWithResult(_0x19abc6,null))[_0x9172('0x2d')](handleError(_0x19abc6,null));};exports[_0x9172('0x68')]=function(_0x5dd9c0,_0x506883,_0x166009){var _0x5b4e66={'raw':![],'where':{}};var _0x21d761={};var _0x30feb8={'count':0x0,'rows':[]};return db[_0x9172('0x58')][_0x9172('0x69')]({'where':{'id':_0x5dd9c0[_0x9172('0x5c')]['id']}})[_0x9172('0x23')](handleEntityNotFound(_0x506883,null))[_0x9172('0x23')](function(_0x559c38){if(_0x559c38){_0x21d761[_0x9172('0x48')]=_[_0x9172('0x5d')](db['Disposition']['rawAttributes']);_0x21d761[_0x9172('0x49')]=_[_0x9172('0x5d')](_0x5dd9c0[_0x9172('0x49')]);_0x21d761[_0x9172('0x4a')]=_[_0x9172('0x4b')](_0x21d761[_0x9172('0x48')],_0x21d761[_0x9172('0x49')]);_0x5b4e66[_0x9172('0x4c')]=_[_0x9172('0x4b')](_0x21d761['model'],qs['fields'](_0x5dd9c0[_0x9172('0x49')][_0x9172('0x4d')]));_0x5b4e66[_0x9172('0x4c')]=_0x5b4e66[_0x9172('0x4c')][_0x9172('0x4e')]?_0x5b4e66[_0x9172('0x4c')]:_0x21d761[_0x9172('0x48')];if(!_0x5dd9c0[_0x9172('0x49')][_0x9172('0x4f')](_0x9172('0x50'))){_0x5b4e66[_0x9172('0x33')]=qs['limit'](_0x5dd9c0[_0x9172('0x49')]['limit']);_0x5b4e66[_0x9172('0x32')]=qs[_0x9172('0x32')](_0x5dd9c0['query'][_0x9172('0x32')]);}_0x5b4e66[_0x9172('0x51')]=qs[_0x9172('0x52')](_0x5dd9c0['query']['sort']);_0x5b4e66[_0x9172('0x53')]=qs['filters'](_['pick'](_0x5dd9c0[_0x9172('0x49')],_0x21d761[_0x9172('0x4a')]));_0x5b4e66['where'][_0x9172('0x66')]=_0x559c38['id'];if(_0x5dd9c0[_0x9172('0x49')][_0x9172('0x6a')]){_0x5b4e66[_0x9172('0x53')]=_[_0x9172('0x55')](_0x5b4e66[_0x9172('0x53')],{'$or':_[_0x9172('0x44')](_0x5b4e66[_0x9172('0x4c')],function(_0x41aa63){var _0x1967d2={};_0x1967d2[_0x41aa63]={'$like':'%'+_0x5dd9c0[_0x9172('0x49')][_0x9172('0x6a')]+'%'};return _0x1967d2;})});}_0x5b4e66=_[_0x9172('0x55')]({},_0x5b4e66,_0x5dd9c0[_0x9172('0x57')]);return db[_0x9172('0x67')]['count']({'where':_0x5b4e66['where']})[_0x9172('0x23')](function(_0x1f5958){_0x30feb8[_0x9172('0x34')]=_0x1f5958;if(_0x5dd9c0['query'][_0x9172('0x6b')]){_0x5b4e66[_0x9172('0x59')]=[{'all':!![]}];}return db[_0x9172('0x67')][_0x9172('0x5a')](_0x5b4e66);})[_0x9172('0x23')](function(_0x4794d9){_0x30feb8['rows']=_0x4794d9;return _0x30feb8;});}})[_0x9172('0x23')](respondWithFilteredResult(_0x506883,_0x5b4e66))['catch'](handleError(_0x506883,null));};exports[_0x9172('0x6c')]=function(_0x55fb7b,_0xf04747,_0x35a3c9){return db['SmsAccount'][_0x9172('0x5e')]({'where':{'id':_0x55fb7b[_0x9172('0x5c')]['id']}})[_0x9172('0x23')](handleEntityNotFound(_0xf04747,null))[_0x9172('0x23')](function(_0x58b521){if(_0x58b521){return _0x58b521[_0x9172('0x6c')](_0x55fb7b['query'][_0x9172('0x6d')]);}})[_0x9172('0x23')](respondWithStatusCode(_0xf04747,null))[_0x9172('0x2d')](handleError(_0xf04747,null));};exports[_0x9172('0x6e')]=function(_0x5b9d4e,_0x3cc583,_0x3fbb1a){if(_0x5b9d4e[_0x9172('0x60')]['id']){delete _0x5b9d4e[_0x9172('0x60')]['id'];}return db[_0x9172('0x58')][_0x9172('0x5e')]({'where':{'id':_0x5b9d4e[_0x9172('0x5c')]['id']}})[_0x9172('0x23')](handleEntityNotFound(_0x3cc583,null))[_0x9172('0x23')](function(_0x4fa8e4){if(_0x4fa8e4){_0x5b9d4e[_0x9172('0x60')][_0x9172('0x66')]=_0x4fa8e4['id'];return db[_0x9172('0x6f')][_0x9172('0x5f')](_0x5b9d4e[_0x9172('0x60')]);}})[_0x9172('0x23')](respondWithResult(_0x3cc583,null))[_0x9172('0x2d')](handleError(_0x3cc583,null));};exports['getAnswers']=function(_0xd08928,_0x4198cf,_0x10da7a){var _0x28ea62={'raw':![],'where':{}};var _0x2d8a8a={};var _0x3ecaf9={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0xd08928[_0x9172('0x5c')]['id']}})[_0x9172('0x23')](handleEntityNotFound(_0x4198cf,null))[_0x9172('0x23')](function(_0xb65b8d){if(_0xb65b8d){_0x2d8a8a[_0x9172('0x48')]=_['keys'](db[_0x9172('0x6f')][_0x9172('0x45')]);_0x2d8a8a[_0x9172('0x49')]=_[_0x9172('0x5d')](_0xd08928[_0x9172('0x49')]);_0x2d8a8a[_0x9172('0x4a')]=_[_0x9172('0x4b')](_0x2d8a8a[_0x9172('0x48')],_0x2d8a8a[_0x9172('0x49')]);_0x28ea62['attributes']=_['intersection'](_0x2d8a8a['model'],qs[_0x9172('0x4d')](_0xd08928[_0x9172('0x49')][_0x9172('0x4d')]));_0x28ea62['attributes']=_0x28ea62[_0x9172('0x4c')][_0x9172('0x4e')]?_0x28ea62[_0x9172('0x4c')]:_0x2d8a8a[_0x9172('0x48')];if(!_0xd08928['query']['hasOwnProperty'](_0x9172('0x50'))){_0x28ea62[_0x9172('0x33')]=qs['limit'](_0xd08928[_0x9172('0x49')][_0x9172('0x33')]);_0x28ea62[_0x9172('0x32')]=qs['offset'](_0xd08928[_0x9172('0x49')][_0x9172('0x32')]);}_0x28ea62[_0x9172('0x51')]=qs['sort'](_0xd08928[_0x9172('0x49')][_0x9172('0x52')]);_0x28ea62['where']=qs[_0x9172('0x4a')](_['pick'](_0xd08928[_0x9172('0x49')],_0x2d8a8a[_0x9172('0x4a')]));_0x28ea62[_0x9172('0x53')][_0x9172('0x66')]=_0xb65b8d['id'];if(_0xd08928[_0x9172('0x49')]['filter']){_0x28ea62[_0x9172('0x53')]=_[_0x9172('0x55')](_0x28ea62[_0x9172('0x53')],{'$or':_[_0x9172('0x44')](_0x28ea62[_0x9172('0x4c')],function(_0x3fc5b1){var _0x528e28={};_0x528e28[_0x3fc5b1]={'$like':'%'+_0xd08928[_0x9172('0x49')]['filter']+'%'};return _0x528e28;})});}_0x28ea62=_['merge']({},_0x28ea62,_0xd08928[_0x9172('0x57')]);return db[_0x9172('0x6f')][_0x9172('0x34')]({'where':_0x28ea62[_0x9172('0x53')]})[_0x9172('0x23')](function(_0x68c0a){_0x3ecaf9['count']=_0x68c0a;if(_0xd08928[_0x9172('0x49')]['includeAll']){_0x28ea62[_0x9172('0x59')]=[{'all':!![]}];}return db['CannedAnswer'][_0x9172('0x5a')](_0x28ea62);})['then'](function(_0x547531){_0x3ecaf9[_0x9172('0x70')]=_0x547531;return _0x3ecaf9;});}})['then'](respondWithFilteredResult(_0x4198cf,_0x28ea62))[_0x9172('0x2d')](handleError(_0x4198cf,null));};exports[_0x9172('0x71')]=function(_0x263fc5,_0x454a27,_0x1679cb){return db[_0x9172('0x58')]['find']({'where':{'id':_0x263fc5[_0x9172('0x5c')]['id']}})[_0x9172('0x23')](handleEntityNotFound(_0x454a27,null))[_0x9172('0x23')](function(_0x4eafb7){if(_0x4eafb7){return _0x4eafb7['removeAnswers'](_0x263fc5['query'][_0x9172('0x6d')]);}})[_0x9172('0x23')](respondWithStatusCode(_0x454a27,null))[_0x9172('0x2d')](handleError(_0x454a27,null));};exports[_0x9172('0x72')]=function(_0x1cb729,_0x2c8ccf,_0x23f9bb){var _0x1784ba={'channel':_0x9172('0x73')};var _0x353026=[];var _0x3a4e77=[];var _0x48d1ad={};return db['SmsAccount']['find']({'where':{'id':_0x1cb729[_0x9172('0x5c')]['id']},'include':[{'model':db[_0x9172('0x74')],'as':_0x9172('0x75')}]})['then'](handleEntityNotFound(_0x2c8ccf,null))[_0x9172('0x23')](function(_0x24d1af){_0x1784ba[_0x9172('0x76')]=_0x24d1af;_0x1784ba[_0x9172('0x77')]=_['orderBy'](_0x24d1af['Applications'],[_0x9172('0x78')],[_0x9172('0x79')]);if(_0x1784ba[_0x9172('0x76')][_0x9172('0x75')]){delete _0x1784ba[_0x9172('0x76')]['Applications'];}return db[_0x9172('0x7a')][_0x9172('0x65')]();})[_0x9172('0x23')](function(_0x4a6bd7){if(!_0x4a6bd7){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x353026=_['difference'](_['keys'](_0x4a6bd7),['createdAt',_0x9172('0x7b')]);_0x3a4e77=_[_0x9172('0x7c')](_[_0x9172('0x5d')](_0x4a6bd7),[_0x9172('0x7d'),_0x9172('0x7b'),_0x9172('0x7e'),_0x9172('0x7f')]);_0x1784ba[_0x9172('0x60')]={'mapKey':_0x9172('0x80')};if(_0x1784ba[_0x9172('0x76')][_0x9172('0x46')]){switch(_0x1784ba[_0x9172('0x76')]['type']){case _0x9172('0x81'):_0x1784ba[_0x9172('0x60')][_0x9172('0x82')]=_0x1cb729[_0x9172('0x60')]['From'];_0x1784ba[_0x9172('0x60')][_0x9172('0x60')]=_0x1cb729['body'][_0x9172('0x83')];_0x1784ba['body']['messageId']=_0x1cb729[_0x9172('0x60')][_0x9172('0x84')];break;case _0x9172('0x85'):_0x1784ba['body'][_0x9172('0x82')]='+'+_0x1cb729[_0x9172('0x60')][_0x9172('0x86')];_0x1784ba['body'][_0x9172('0x60')]=_0x1cb729[_0x9172('0x60')][_0x9172('0x87')];break;case _0x9172('0x88'):_0x1784ba['body'][_0x9172('0x82')]=_0x1cb729[_0x9172('0x60')]['from'];_0x1784ba[_0x9172('0x60')][_0x9172('0x60')]=_0x1cb729[_0x9172('0x60')][_0x9172('0x2a')];break;case _0x9172('0x89'):_0x1784ba[_0x9172('0x60')][_0x9172('0x82')]=_0x1cb729[_0x9172('0x60')]['from'];_0x1784ba[_0x9172('0x60')][_0x9172('0x60')]=_0x1cb729[_0x9172('0x60')][_0x9172('0x60')];_0x1784ba[_0x9172('0x60')][_0x9172('0x8a')]=_0x1cb729['body'][_0x9172('0x8b')];break;case _0x9172('0x8c'):_0x1784ba[_0x9172('0x60')]['from']=_0x1cb729['body'][_0x9172('0x8d')];_0x1784ba[_0x9172('0x60')]['body']=_0x1cb729[_0x9172('0x60')][_0x9172('0x8e')];_0x1784ba[_0x9172('0x60')]['messageId']=_0x1cb729['body'][_0x9172('0x8f')];break;case _0x9172('0x90'):_0x1784ba[_0x9172('0x60')][_0x9172('0x82')]='+'+_0x1cb729[_0x9172('0x60')][_0x9172('0x91')][0x0]['from'];_0x1784ba[_0x9172('0x60')]['body']=_0x1cb729[_0x9172('0x60')]['results'][0x0][_0x9172('0x87')];_0x1784ba['body']['messageId']=_0x1cb729[_0x9172('0x60')][_0x9172('0x91')][0x0][_0x9172('0x8a')];break;case'csc':_0x1784ba[_0x9172('0x60')][_0x9172('0x82')]=_0x1cb729[_0x9172('0x60')][_0x9172('0x92')];_0x1784ba[_0x9172('0x60')]['body']=_0x1cb729[_0x9172('0x60')]['segmentedMessage']['message'];break;case _0x9172('0x93'):_0x1784ba['body'][_0x9172('0x82')]=_0x1cb729[_0x9172('0x60')][_0x9172('0x94')];_0x1784ba[_0x9172('0x60')][_0x9172('0x60')]=_0x1cb729[_0x9172('0x60')][_0x9172('0x87')];_0x1784ba[_0x9172('0x60')][_0x9172('0x8a')]=_0x1cb729[_0x9172('0x60')][_0x9172('0x95')];break;case _0x9172('0x96'):_0x1784ba[_0x9172('0x60')]['messageId']=_0x1cb729[_0x9172('0x60')][0x0][_0x9172('0x2a')]['id'];_0x1784ba[_0x9172('0x60')][_0x9172('0x82')]=_0x1cb729[_0x9172('0x60')][0x0][_0x9172('0x2a')][_0x9172('0x82')];_0x1784ba[_0x9172('0x60')][_0x9172('0x60')]=_0x1cb729[_0x9172('0x60')][0x0]['message'][_0x9172('0x87')];break;case _0x9172('0x97'):_0x1784ba['body'][_0x9172('0x82')]=_0x1cb729[_0x9172('0x60')]['from'];_0x1784ba['body'][_0x9172('0x60')]=_0x1cb729[_0x9172('0x60')][_0x9172('0x2a')];_0x1784ba['body'][_0x9172('0x8a')]=_0x1cb729['body'][_0x9172('0x98')];break;}}if(_0x1784ba[_0x9172('0x60')]['id']){delete _0x1784ba['body']['id'];}if(_[_0x9172('0x99')](_0x1784ba[_0x9172('0x60')][_0x9172('0x82')])){throw new db['Sequelize'][(_0x9172('0x9a'))]('from\x20is\x20mandatory');}if(_[_0x9172('0x99')](_0x1784ba[_0x9172('0x60')][_0x9172('0x60')])||_0x1784ba['body'][_0x9172('0x60')]===''){throw new db[(_0x9172('0x9b'))][(_0x9172('0x9a'))](_0x9172('0x9c'));}if(_[_0x9172('0x99')](_0x1784ba[_0x9172('0x60')][_0x9172('0x9d')])){throw new db['Sequelize']['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3a4e77);}if(!_[_0x9172('0x9e')](_0x3a4e77,_0x1784ba[_0x9172('0x60')]['mapKey'])){throw new db['Sequelize']['ValidationError'](_0x9172('0x9f')+_0x3a4e77);}_0x48d1ad[_0x1784ba['body'][_0x9172('0x9d')]]=_0x1784ba['body']['from'];return db[_0x9172('0xa0')][_0x9172('0x5e')]({'where':{'id':_0x1784ba[_0x9172('0x76')][_0x9172('0x7f')]},'include':[{'model':db[_0x9172('0x7a')],'as':_0x9172('0xa1'),'where':_0x48d1ad,'limit':0x1,'order':[[_0x9172('0x7b'),_0x9172('0xa2')]]}]});})[_0x9172('0x23')](handleEntityNotFound(_0x2c8ccf,null))['then'](function(_0x5c371){if(_0x5c371){_0x1784ba[_0x9172('0xa3')]=_['omit'](_0x5c371,['Contacts']);if(_0x5c371[_0x9172('0xa1')][_0x9172('0x4e')]){return _0x5c371[_0x9172('0xa1')][0x0];}var _0x31c34e=_[_0x9172('0xa4')](_0x1784ba[_0x9172('0x60')],{'firstName':_0x1784ba[_0x9172('0x60')][_0x9172('0x82')],'ListId':_0x5c371['id']});_0x31c34e[_0x1784ba[_0x9172('0x60')][_0x9172('0x9d')]]=_0x1784ba[_0x9172('0x60')][_0x9172('0x82')];return db[_0x9172('0x7a')][_0x9172('0x5f')](_0x31c34e,{'fields':_0x353026,'raw':!![]});}})[_0x9172('0x23')](handleEntityNotFound(_0x2c8ccf,null))[_0x9172('0x23')](function(_0x10b13f){if(_0x10b13f){_0x1784ba[_0x9172('0xa5')]=_0x10b13f;var _0x241ace={'ContactId':_0x10b13f['id'],'phone':_0x1784ba[_0x9172('0x60')][_0x9172('0x82')],'SmsAccountId':_0x1cb729[_0x9172('0x5c')]['id']};var _0x2ad0e={'ContactId':_0x10b13f['id'],'SmsAccountId':_0x1cb729['params']['id'],'closed':![]};return db[_0x9172('0xa6')][_0x9172('0x5e')]({'where':_0x2ad0e})[_0x9172('0x23')](function(_0x11363c){if(_0x11363c){return[_0x11363c,![]];}return db[_0x9172('0xa6')]['create'](_0x241ace)['then'](function(_0x319f23){return[_0x319f23,!![]];});});}})[_0x9172('0xa7')](function(_0x39cac8,_0x4167b3){_0x1784ba[_0x9172('0xa8')]=_0x39cac8[_0x9172('0x3c')]({'plain':!![]});_0x1784ba[_0x9172('0xa8')][_0x9172('0xa9')]=![];if(_0x4167b3){if(_0x1784ba[_0x9172('0x76')]['autoclose']){_0x1784ba[_0x9172('0x77')][_0x9172('0xaa')]({'id':0x0,'priority':_0x1784ba[_0x9172('0x77')]['length']+0x1,'app':_0x9172('0xab'),'appdata':_0x9172('0xac'),'interval':_0x9172('0xad')});}_0x1784ba['interaction'][_0x9172('0xa9')]=!![];}return db[_0x9172('0xae')]['create']({'phone':_0x1784ba[_0x9172('0x60')][_0x9172('0x82')],'messageId':_0x1784ba[_0x9172('0x60')][_0x9172('0x8a')],'body':_0x1784ba[_0x9172('0x60')]['body'],'SmsAccountId':_0x1cb729[_0x9172('0x5c')]['id'],'SmsInteractionId':_0x39cac8['id'],'direction':'in','ContactId':_0x39cac8[_0x9172('0xaf')],'AttachmentId':_0x1784ba['body']['AttachmentId']});})['then'](function(_0x27f560){_0x1784ba[_0x9172('0x2a')]=_0x27f560;if(!_0x1784ba[_0x9172('0xa8')][_0x9172('0xb0')])return;return db['User'][_0x9172('0x5e')]({'attributes':['id','name'],'where':{'id':_0x1784ba[_0x9172('0xa8')][_0x9172('0xb0')]}});})[_0x9172('0x23')](function(_0x320446){if(_0x320446){_0x1784ba[_0x9172('0x77')][_0x9172('0xb1')]({'id':0x0,'priority':0x0,'app':_0x9172('0xb2'),'appdata':_0x320446[_0x9172('0x3f')]+','+(_0x1784ba[_0x9172('0x76')][_0x9172('0xb3')]||0xa),'interval':_0x9172('0xad')});}if(!_0x1784ba[_0x9172('0xa8')][_0x9172('0xb4')])return;return db[_0x9172('0xb5')]['find']({'attributes':['id',_0x9172('0x3f')],'where':{'id':_0x1784ba[_0x9172('0xa8')][_0x9172('0xb4')]}});})[_0x9172('0x23')](function(_0x1ff527){if(_0x1ff527){_0x1784ba['applications'][_0x9172('0xb1')]({'id':0x0,'priority':0x1,'app':_0x9172('0xb6'),'appdata':_0x1ff527[_0x9172('0x3f')]+','+(_0x1784ba['account']['waitForTheAssignedQueue']||0x12c),'interval':_0x9172('0xad')});}return respondWithRpcPromise('Start',_0x9172('0xb7'),_0x1784ba);})[_0x9172('0x23')](function(_0x1b177d){if(_0x1b177d){var _0x5217d6=0xc8;var _0x44187e='receiveMessage';logger[_0x9172('0x2b')](_0x9172('0x27'),_0x44187e,_0x5217d6,_0x9172('0xb8'));logger[_0x9172('0x26')](_0x9172('0xb9'),_0x44187e,_0x5217d6,_0x9172('0xb8'),JSON['stringify'](_0x1b177d));if(_0x1784ba[_0x9172('0x76')][_0x9172('0x46')]===_0x9172('0x81')){return _0x2c8ccf['status'](_0x5217d6)[_0x9172('0x35')]('Content-Type',_0x9172('0xba'))[_0x9172('0x40')]('\x0a');}else{return _0x2c8ccf[_0x9172('0x2f')](_0x5217d6)[_0x9172('0x31')](_0x1b177d);}}})['catch'](handleError(_0x2c8ccf,null));};exports[_0x9172('0xbb')]=function(_0x518c49,_0x4b010b){var _0x1d91be=_0x518c49[_0x9172('0x5c')]['id'];var _0x43bcc6=_0x518c49[_0x9172('0x60')];var _0x578547=0xc8;var _0x5e52b3=null;return db[_0x9172('0xbc')][_0x9172('0xbd')]({'isolationLevel':db[_0x9172('0xbc')][_0x9172('0xbe')]['ISOLATION_LEVELS'][_0x9172('0xbf')]},function(_0x19ba38){return db[_0x9172('0x58')]['findOne']({'where':{'id':_0x1d91be},'transaction':_0x19ba38})['then'](function(_0x4a0f7b){if(_0x4a0f7b){return db[_0x9172('0x74')][_0x9172('0x3b')]({'where':{'SmsAccountId':_0x1d91be},'transaction':_0x19ba38})[_0x9172('0x23')](function(){var _0xe4342f=_[_0x9172('0x44')](_0x43bcc6,function(_0x15a226){_0x15a226[_0x9172('0x66')]=_0x1d91be;return _0x15a226;});return db['SmsApplication'][_0x9172('0xc0')](_0xe4342f,{'transaction':_0x19ba38});});}else{_0x578547=0x194;_0x5e52b3=[];}});})[_0x9172('0x23')](function(){if(_0x578547!==0x194){return db[_0x9172('0x74')][_0x9172('0xc1')]({'where':{'SmsAccountId':_0x1d91be},'order':_0x9172('0x78')})[_0x9172('0x23')](function(_0x2d1b76){_0x5e52b3=_0x2d1b76;});}})['catch'](function(_0x4be026){_0x578547=0x1f4;logger[_0x9172('0x28')](_0x4be026['stack']);if(_0x4be026[_0x9172('0x3f')]){delete _0x4be026[_0x9172('0x3f')];}_0x5e52b3=_0x4be026;})[_0x9172('0xc2')](function(){if(_0x5e52b3===null){_0x4b010b[_0x9172('0x2e')](_0x578547);}else{if(_0x578547===0x1f4){_0x4b010b[_0x9172('0x2f')](_0x578547)[_0x9172('0x40')](_0x5e52b3);}else{_0x4b010b[_0x9172('0x2f')](_0x578547)['json'](_0x5e52b3);}}});};exports[_0x9172('0xc3')]=function(_0x21b878,_0x4f05b4,_0x43536d){var _0xc237fa={};var _0x736652={};var _0x3435a5;var _0x217344;return db[_0x9172('0x58')]['findOne']({'where':{'id':_0x21b878['params']['id']}})[_0x9172('0x23')](handleEntityNotFound(_0x4f05b4,null))[_0x9172('0x23')](function(_0x9bf1c8){if(_0x9bf1c8){_0x3435a5=_0x9bf1c8;_0x736652[_0x9172('0x48')]=_[_0x9172('0x5d')](db[_0x9172('0x74')][_0x9172('0x45')]);_0x736652[_0x9172('0x49')]=_[_0x9172('0x5d')](_0x21b878[_0x9172('0x49')]);_0x736652[_0x9172('0x4a')]=_[_0x9172('0x4b')](_0x736652[_0x9172('0x48')],_0x736652[_0x9172('0x49')]);_0xc237fa[_0x9172('0x4c')]=_['intersection'](_0x736652[_0x9172('0x48')],qs[_0x9172('0x4d')](_0x21b878['query'][_0x9172('0x4d')]));_0xc237fa[_0x9172('0x4c')]=_0xc237fa['attributes'][_0x9172('0x4e')]?_0xc237fa[_0x9172('0x4c')]:_0x736652[_0x9172('0x48')];_0xc237fa[_0x9172('0x51')]=qs[_0x9172('0x52')](_0x21b878['query'][_0x9172('0x52')]);_0xc237fa[_0x9172('0x53')]=qs['filters'](_['pick'](_0x21b878['query'],_0x736652[_0x9172('0x4a')]));if(_0x21b878[_0x9172('0x49')]['filter']){_0xc237fa[_0x9172('0x53')]=_[_0x9172('0x55')](_0xc237fa[_0x9172('0x53')],{'$or':_[_0x9172('0x44')](_0xc237fa[_0x9172('0x4c')],function(_0x4dd7e4){var _0x432a73={};_0x432a73[_0x4dd7e4]={'$like':'%'+_0x21b878['query'][_0x9172('0x6a')]+'%'};return _0x432a73;})});}_0xc237fa=_[_0x9172('0x55')]({},_0xc237fa,_0x21b878['options']);return _0x3435a5[_0x9172('0xc3')](_0xc237fa);}})[_0x9172('0x23')](function(_0x51c4b7){if(_0x51c4b7){_0x217344=_0x51c4b7['length'];if(!_0x21b878[_0x9172('0x49')]['hasOwnProperty']('nolimit')){_0xc237fa[_0x9172('0x33')]=qs['limit'](_0x21b878[_0x9172('0x49')][_0x9172('0x33')]);_0xc237fa['offset']=qs[_0x9172('0x32')](_0x21b878[_0x9172('0x49')][_0x9172('0x32')]);}return _0x3435a5[_0x9172('0xc3')](_0xc237fa);}})[_0x9172('0x23')](function(_0x16a780){if(_0x16a780){return _0x16a780?{'count':_0x217344,'rows':_0x16a780}:null;}})[_0x9172('0x23')](respondWithResult(_0x4f05b4,null))[_0x9172('0x2d')](handleError(_0x4f05b4,null));};exports['getInteractions']=function(_0xcd35e2,_0x5eafca,_0x53d1b5){var _0x421500={'raw':![],'where':{}};var _0x2101dc={};var _0x5f4977={'count':0x0,'rows':[]};return db[_0x9172('0x58')][_0x9172('0x69')]({'where':{'id':_0xcd35e2[_0x9172('0x5c')]['id']}})[_0x9172('0x23')](handleEntityNotFound(_0x5eafca,null))[_0x9172('0x23')](function(_0x39714b){if(_0x39714b){_0x2101dc[_0x9172('0x48')]=_[_0x9172('0x5d')](db[_0x9172('0xa6')]['rawAttributes']);_0x2101dc[_0x9172('0x49')]=_['keys'](_0xcd35e2[_0x9172('0x49')]);_0x2101dc[_0x9172('0x4a')]=_[_0x9172('0x4b')](_0x2101dc[_0x9172('0x48')],_0x2101dc['query']);_0x421500[_0x9172('0x4c')]=_[_0x9172('0x4b')](_0x2101dc['model'],qs[_0x9172('0x4d')](_0xcd35e2[_0x9172('0x49')]['fields']));_0x421500[_0x9172('0x4c')]=_0x421500[_0x9172('0x4c')][_0x9172('0x4e')]?_0x421500[_0x9172('0x4c')]:_0x2101dc[_0x9172('0x48')];if(!_0xcd35e2['query']['hasOwnProperty'](_0x9172('0x50'))){_0x421500[_0x9172('0x33')]=qs[_0x9172('0x33')](_0xcd35e2['query']['limit']);_0x421500[_0x9172('0x32')]=qs[_0x9172('0x32')](_0xcd35e2[_0x9172('0x49')][_0x9172('0x32')]);}_0x421500[_0x9172('0x51')]=qs[_0x9172('0x52')](_0xcd35e2[_0x9172('0x49')][_0x9172('0x52')]);_0x421500['where']=qs['filters'](_[_0x9172('0x54')](_0xcd35e2[_0x9172('0x49')],_0x2101dc[_0x9172('0x4a')]));_0x421500[_0x9172('0x53')]['SmsAccountId']=_0x39714b['id'];if(_0xcd35e2[_0x9172('0x49')][_0x9172('0x6a')]){_0x421500[_0x9172('0x53')]=_[_0x9172('0x55')](_0x421500[_0x9172('0x53')],{'$or':_['map'](_0x421500['attributes'],function(_0x1cd672){var _0xbe69d6={};_0xbe69d6[_0x1cd672]={'$like':'%'+_0xcd35e2[_0x9172('0x49')][_0x9172('0x6a')]+'%'};return _0xbe69d6;})});}_0x421500=_['merge']({},_0x421500,_0xcd35e2[_0x9172('0x57')]);return db[_0x9172('0xa6')][_0x9172('0x34')]({'where':_0x421500[_0x9172('0x53')]})[_0x9172('0x23')](function(_0x2e560e){_0x5f4977[_0x9172('0x34')]=_0x2e560e;if(_0xcd35e2[_0x9172('0x49')][_0x9172('0x6b')]){_0x421500[_0x9172('0x59')]=[{'model':db[_0x9172('0x7a')],'as':_0x9172('0xc4'),'required':![]},{'model':db[_0x9172('0xc5')],'as':_0x9172('0xc6'),'attributes':[_0x9172('0x3f'),_0x9172('0xc7'),_0x9172('0xc8')],'required':![]},{'model':db['Tag'],'as':_0x9172('0xc9'),'attributes':['id',_0x9172('0x3f'),'color'],'where':_0xcd35e2[_0x9172('0x49')][_0x9172('0xca')]?{'id':_0xcd35e2[_0x9172('0x49')][_0x9172('0xca')]}:undefined,'required':_0xcd35e2[_0x9172('0x49')][_0x9172('0xca')]?!![]:![]}];}return db[_0x9172('0xa6')][_0x9172('0x5a')](_0x421500);})[_0x9172('0x23')](function(_0x3161e1){_0x5f4977[_0x9172('0x70')]=_0x3161e1;return _0x5f4977;});}})[_0x9172('0x23')](respondWithFilteredResult(_0x5eafca,_0x421500))[_0x9172('0x2d')](handleError(_0x5eafca,null));};exports[_0x9172('0x40')]=function(_0x263470,_0x25c77c,_0x2344fb){var _0x901fa9,_0x47a99e,_0x50fe6f;if(_['isNil'](_0x263470[_0x9172('0x60')][_0x9172('0x60')])||_0x263470[_0x9172('0x60')][_0x9172('0x60')]===''){throw new db[(_0x9172('0x9b'))][(_0x9172('0x9a'))](_0x9172('0x9c'));}if(_[_0x9172('0x99')](_0x263470[_0x9172('0x60')]['to'])){throw new db['Sequelize'][(_0x9172('0x9a'))](_0x9172('0xcb'));}_0x901fa9=_0x263470['body']['to'];return db[_0x9172('0x58')][_0x9172('0x5e')]({'where':{'id':_0x263470[_0x9172('0x5c')]['id']},'include':[{'model':db[_0x9172('0xa0')],'as':_0x9172('0xcc'),'include':[{'model':db[_0x9172('0x7a')],'as':_0x9172('0xa1'),'where':{'mobile':_0x901fa9},'limit':0x1,'order':[['updatedAt',_0x9172('0xa2')]]}]}]})[_0x9172('0x23')](handleEntityNotFound(_0x25c77c,null))[_0x9172('0x23')](function(_0x4d255a){if(_0x4d255a&&_0x4d255a[_0x9172('0xcc')]){_0x47a99e=_0x4d255a[_0x9172('0x3c')]({'plain':!![]});if(_0x47a99e['List']&&_0x47a99e[_0x9172('0xcc')][_0x9172('0xa1')][_0x9172('0x4e')]){return _0x47a99e['List'][_0x9172('0xa1')][0x0];}return db['CmContact'][_0x9172('0x5f')](_['defaults'](_0x263470['body'],{'firstName':_0x901fa9,'mobile':_0x901fa9,'phone':_0x901fa9,'ListId':_0x47a99e['ListId']}));}})[_0x9172('0x23')](handleEntityNotFound(_0x25c77c,null))[_0x9172('0x23')](function(_0x5be2a1){if(_0x5be2a1){_0x50fe6f=_0x5be2a1;return db['SmsInteraction'][_0x9172('0x5e')]({'where':{'ContactId':_0x50fe6f['id'],'closed':![],'SmsAccountId':_0x47a99e['id']}})[_0x9172('0x23')](function(_0x44122d){if(_0x44122d){return[_0x44122d,![]];}return db[_0x9172('0xa6')][_0x9172('0x5f')]({'UserId':_0x263470[_0x9172('0xcd')]['id'],'ContactId':_0x50fe6f['id'],'SmsAccountId':_0x47a99e['id'],'phone':_0x901fa9,'firstMsgDirection':_0x9172('0xce'),'Messages':[_['merge'](_0x263470[_0x9172('0x60')],{'read':![],'body':_0x263470[_0x9172('0x60')][_0x9172('0x60')],'phone':_0x901fa9,'SmsAccountId':_0x47a99e['id'],'UserId':_0x263470[_0x9172('0xcd')]['id'],'ContactId':_0x50fe6f['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x9172('0xcf')}]})['then'](function(_0x416d0b){return[_0x416d0b,!![]];});});}})[_0x9172('0xa7')](function(_0x3cb745,_0x1dcd6f){if(_0x1dcd6f){return _0x3cb745;}return db[_0x9172('0xae')]['create'](_[_0x9172('0x55')](_0x263470[_0x9172('0x60')],{'read':![],'body':_0x263470['body'][_0x9172('0x60')],'phone':_0x901fa9,'SmsAccountId':_0x47a99e['id'],'SmsInteractionId':_0x3cb745['id'],'UserId':_0x263470[_0x9172('0xcd')]['id'],'ContactId':_0x50fe6f['id']}))[_0x9172('0x23')](function(_0x5117e9){_0x3cb745[_0x9172('0xd0')]['Messages']=[];_0x3cb745['dataValues'][_0x9172('0xcf')][_0x9172('0xaa')](_0x5117e9[_0x9172('0xd0')]);return _0x3cb745;});})[_0x9172('0x23')](respondWithResult(_0x25c77c,null))['catch'](handleError(_0x25c77c,null));};exports[_0x9172('0x2f')]=function(_0x10c6b9,_0x4a9d8c,_0x11d5b6){if(_0x10c6b9['body']['id']){delete _0x10c6b9[_0x9172('0x60')]['id'];}var _0x5c5a37,_0x4c8a54,_0x4b0462;return db[_0x9172('0x58')][_0x9172('0x5e')]({'where':{'id':_0x10c6b9['params']['id']}})[_0x9172('0x23')](handleEntityNotFound(_0x4a9d8c,null))[_0x9172('0x23')](function(_0x4bf54c){if(_0x4bf54c){_0x4b0462=_0x4bf54c;logger['debug'](_0x9172('0x27'),'status',_0x9172('0xd1'),_0x4bf54c[_0x9172('0x46')],util['inspect'](_0x10c6b9[_0x9172('0x60')],{'showHidden':![],'depth':null}));switch(_0x4bf54c['type']){case'skebby':if(_0x10c6b9[_0x9172('0x60')]['skebby_dispatch_id']&&_0x10c6b9[_0x9172('0x60')][_0x9172('0x2f')]){_0x4c8a54=_0x10c6b9['body'][_0x9172('0x2f')];return db[_0x9172('0xae')][_0x9172('0x5e')]({'where':{'messageId':_0x10c6b9[_0x9172('0x60')][_0x9172('0xd2')]}});}break;case _0x9172('0x88'):if(_0x10c6b9[_0x9172('0x60')][_0x9172('0xd3')]&&_0x10c6b9[_0x9172('0x60')][_0x9172('0xd4')]){_0x4c8a54=_0x10c6b9['body'][_0x9172('0xd4')];return db['SmsMessage'][_0x9172('0x5e')]({'where':{'messageId':_0x10c6b9[_0x9172('0x60')]['requestid']}});}break;case _0x9172('0x89'):if(_0x10c6b9[_0x9172('0x60')]['message_id']&&_0x10c6b9[_0x9172('0x60')]['status_code']){_0x4c8a54=_0x10c6b9[_0x9172('0x60')][_0x9172('0xd5')];return db['SmsMessage'][_0x9172('0x5e')]({'where':{'messageId':_0x10c6b9['body'][_0x9172('0x8b')]}});}break;case _0x9172('0x90'):var _0x1bb57a=_0x10c6b9['body'][_0x9172('0x91')][0x0];if(_0x1bb57a[_0x9172('0x8a')]&&_0x1bb57a[_0x9172('0x2f')][_0x9172('0xd6')]===_0x9172('0xd7')){_0x4c8a54=_0x1bb57a[_0x9172('0x2f')][_0x9172('0xd6')];return db['SmsMessage']['find']({'where':{'messageId':_0x1bb57a['messageId']}});}break;case _0x9172('0x93'):if(_0x10c6b9[_0x9172('0x60')][_0x9172('0x8a')]&&_0x10c6b9[_0x9172('0x60')]['status']){_0x4c8a54=_0x10c6b9[_0x9172('0x60')][_0x9172('0x2f')];return db['SmsMessage']['find']({'where':{'messageId':_0x10c6b9[_0x9172('0x60')][_0x9172('0x8a')]}});}break;case _0x9172('0x96'):if(_0x10c6b9[_0x9172('0x60')][0x0][_0x9172('0x2a')]['id']){_0x4c8a54=_0x10c6b9[_0x9172('0x60')][0x0][_0x9172('0x46')];return db[_0x9172('0xae')][_0x9172('0x5e')]({'where':{'messageId':_0x10c6b9[_0x9172('0x60')][0x0][_0x9172('0x2a')]['id']}});}break;case _0x9172('0x97'):if(_0x10c6b9[_0x9172('0x60')][_0x9172('0xd8')]&&_0x10c6b9[_0x9172('0x60')][_0x9172('0x2f')]){_0x4c8a54=_0x10c6b9[_0x9172('0x60')][_0x9172('0x2f')];return db[_0x9172('0xae')][_0x9172('0x5e')]({'where':{'messageId':_0x10c6b9[_0x9172('0x60')][_0x9172('0xd8')]}});}break;}}})[_0x9172('0x23')](handleEntityNotFound(_0x4a9d8c,null))['then'](function(_0x1eee78){if(_0x1eee78){_0x5c5a37=_0x1eee78;switch(_0x4b0462[_0x9172('0x46')]){case _0x9172('0x85'):if(_0x4c8a54===_0x9172('0xd7')){return _0x5c5a37[_0x9172('0x3a')]({'read':!![]});}else{logger[_0x9172('0x28')](_0x9172('0x27'),'status','skebby',util['inspect'](_0x10c6b9[_0x9172('0x60')],{'showHidden':![],'depth':null}));}break;case _0x9172('0x88'):if(_0x4c8a54==='1'){return _0x5c5a37[_0x9172('0x3a')]({'read':!![]});}else{logger[_0x9172('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x9172('0x85'),util[_0x9172('0xd9')](_0x10c6b9['body'],{'showHidden':![],'depth':null}));}break;case _0x9172('0x89'):if(!_0x10c6b9['body'][_0x9172('0xda')]&&_0x4c8a54>=0xc8&&_0x4c8a54<=0xce){return _0x5c5a37[_0x9172('0x3a')]({'read':!![]});}else{logger[_0x9172('0x28')](_0x9172('0x27'),_0x9172('0x2f'),_0x9172('0x89'),util[_0x9172('0xd9')](_0x10c6b9[_0x9172('0x60')],{'showHidden':![],'depth':null}));}break;case _0x9172('0x90'):var _0x41682a=_0x10c6b9[_0x9172('0x60')][_0x9172('0x91')][0x0];if(_0x41682a[_0x9172('0x2f')][_0x9172('0xd6')]===_0x9172('0xd7')){return _0x5c5a37[_0x9172('0x3a')]({'read':!![]});}else{logger[_0x9172('0x28')](_0x9172('0x27'),'status','infobip',util[_0x9172('0xd9')](_0x10c6b9[_0x9172('0x60')],{'showHidden':![],'depth':null}));}break;case _0x9172('0x93'):if(_0x4c8a54==_0x9172('0xdb')||_0x4c8a54==_0x9172('0xdc')){return _0x5c5a37[_0x9172('0x3a')]({'read':!![]});}else{logger[_0x9172('0x28')](_0x9172('0x27'),_0x9172('0x2f'),_0x9172('0x93'),util['inspect'](_0x10c6b9[_0x9172('0x60')],{'showHidden':![],'depth':null}));}break;case _0x9172('0x96'):if(_0x4c8a54=='message-delivered'){return _0x5c5a37['update']({'read':!![]});}else{logger[_0x9172('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','bandwidth',util[_0x9172('0xd9')](_0x10c6b9[_0x9172('0x60')],{'showHidden':![],'depth':null}));}break;case _0x9172('0x97'):if(_0x4c8a54==='DELIVRD'||_0x4c8a54===_0x9172('0xdd')){return _0x5c5a37[_0x9172('0x3a')]({'read':!![]});}else{logger[_0x9172('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9172('0x2f'),_0x9172('0x97'),util[_0x9172('0xd9')](_0x10c6b9[_0x9172('0x60')],{'showHidden':![],'depth':null}));}break;}return _0x5c5a37;}})[_0x9172('0x23')](respondWithResult(_0x4a9d8c,null))['catch'](handleError(_0x4a9d8c,null));};exports[_0x9172('0xde')]=function(_0x2593bf,_0x558635,_0x223785){var _0x5cce7f,_0x5e1392,_0x1a72c4;return db['SmsAccount'][_0x9172('0x5e')]({'where':{'id':_0x2593bf[_0x9172('0x5c')]['id']}})[_0x9172('0x23')](handleEntityNotFound(_0x558635,null))[_0x9172('0x23')](function(_0x14d7b9){if(_0x14d7b9){_0x1a72c4=_0x14d7b9;logger[_0x9172('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x9172('0xd1'),_0x14d7b9[_0x9172('0x46')],util[_0x9172('0xd9')](_0x2593bf[_0x9172('0x49')],{'showHidden':![],'depth':null}));switch(_0x14d7b9['type']){case _0x9172('0xdf'):if(_0x2593bf[_0x9172('0x49')][_0x9172('0xe0')]&&_0x2593bf[_0x9172('0x49')][_0x9172('0xe1')]){_0x5e1392=_0x2593bf[_0x9172('0x49')][_0x9172('0xe1')];return db['SmsMessage'][_0x9172('0x5e')]({'where':{'messageId':_0x2593bf[_0x9172('0x49')][_0x9172('0xe0')]}});}break;}}})['then'](handleEntityNotFound(_0x558635,null))['then'](function(_0x565b5a){if(_0x565b5a){_0x5cce7f=_0x565b5a;switch(_0x1a72c4[_0x9172('0x46')]){case _0x9172('0xdf'):if(_0x5e1392==='2'||_0x5e1392==='6'){return _0x5cce7f[_0x9172('0x3a')]({'read':!![]});}else{logger[_0x9172('0x28')](_0x9172('0x27'),_0x9172('0x2f'),_0x9172('0xdf'),util[_0x9172('0xd9')](_0x2593bf['query'],{'showHidden':![],'depth':null}));};break;}return _0x5cce7f;}})[_0x9172('0x23')](respondWithResult(_0x558635,null))['catch'](handleError(_0x558635,null));};exports[_0x9172('0xe2')]=function(_0x5e2681,_0x2e024f,_0x1d3fa9){return db[_0x9172('0x58')][_0x9172('0x5e')]({'where':{'id':_0x5e2681[_0x9172('0x5c')]['id']}})['then'](handleEntityNotFound(_0x2e024f,null))['then'](function(_0x4fb608){if(_0x4fb608){return _0x4fb608['addAgents'](_0x5e2681['body'][_0x9172('0x6d')],_['omit'](_0x5e2681[_0x9172('0x60')],[_0x9172('0x6d'),'id'])||{})[_0x9172('0xa7')](function(_0x161734){for(var _0x1ccc85=0x0;_0x1ccc85<_0x5e2681['body'][_0x9172('0x6d')][_0x9172('0x4e')];_0x1ccc85+=0x1){socket[_0x9172('0xe3')]('userSmsAccount:save',{'UserId':Number(_0x5e2681[_0x9172('0x60')]['ids'][_0x1ccc85]),'SmsAccountId':Number(_0x5e2681[_0x9172('0x5c')]['id'])});}return _0x161734;});}})[_0x9172('0x23')](respondWithResult(_0x2e024f,null))[_0x9172('0x2d')](handleError(_0x2e024f,null));};exports[_0x9172('0xe4')]=function(_0x57892a,_0x19ec90,_0x4a8ce2){return db[_0x9172('0x58')][_0x9172('0x5e')]({'where':{'id':_0x57892a[_0x9172('0x5c')]['id']}})[_0x9172('0x23')](handleEntityNotFound(_0x19ec90,null))[_0x9172('0x23')](function(_0x1aef48){if(_0x1aef48){return _0x1aef48[_0x9172('0xe4')](_0x57892a[_0x9172('0x49')][_0x9172('0x6d')])[_0x9172('0x23')](function(){if(_[_0x9172('0xe5')](_0x57892a[_0x9172('0x49')][_0x9172('0x6d')])){for(var _0x53109c=0x0;_0x53109c<_0x57892a[_0x9172('0x49')][_0x9172('0x6d')]['length'];_0x53109c+=0x1){socket[_0x9172('0xe3')](_0x9172('0xe6'),{'UserId':Number(_0x57892a[_0x9172('0x49')][_0x9172('0x6d')][_0x53109c]),'SmsAccountId':Number(_0x57892a[_0x9172('0x5c')]['id'])});}}else{socket[_0x9172('0xe3')](_0x9172('0xe6'),{'UserId':Number(_0x57892a[_0x9172('0x49')]['ids']),'SmsAccountId':Number(_0x57892a[_0x9172('0x5c')]['id'])});}});}})['then'](respondWithStatusCode(_0x19ec90,null))[_0x9172('0x2d')](handleError(_0x19ec90,null));};exports[_0x9172('0xe7')]=function(_0x2a4737,_0x520dbb,_0x5ef0e1){var _0x156257={};var _0xce022d={};var _0x2b8765;var _0x1c1b4e;return db['SmsAccount'][_0x9172('0x69')]({'where':{'id':_0x2a4737[_0x9172('0x5c')]['id']}})['then'](handleEntityNotFound(_0x520dbb,null))[_0x9172('0x23')](function(_0x5bad62){if(_0x5bad62){_0x2b8765=_0x5bad62;_0xce022d[_0x9172('0x48')]=_[_0x9172('0x5d')](db[_0x9172('0xc5')][_0x9172('0x45')]);_0xce022d['query']=_[_0x9172('0x5d')](_0x2a4737[_0x9172('0x49')]);_0xce022d[_0x9172('0x4a')]=_[_0x9172('0x4b')](_0xce022d['model'],_0xce022d['query']);_0x156257[_0x9172('0x4c')]=_[_0x9172('0x4b')](_0xce022d[_0x9172('0x48')],qs[_0x9172('0x4d')](_0x2a4737[_0x9172('0x49')][_0x9172('0x4d')]));_0x156257[_0x9172('0x4c')]=_0x156257[_0x9172('0x4c')][_0x9172('0x4e')]?_0x156257[_0x9172('0x4c')]:_0xce022d[_0x9172('0x48')];_0x156257[_0x9172('0x51')]=qs[_0x9172('0x52')](_0x2a4737['query']['sort']);_0x156257[_0x9172('0x53')]=qs['filters'](_[_0x9172('0x54')](_0x2a4737[_0x9172('0x49')],_0xce022d[_0x9172('0x4a')]));if(_0x2a4737[_0x9172('0x49')]['filter']){_0x156257[_0x9172('0x53')]=_[_0x9172('0x55')](_0x156257[_0x9172('0x53')],{'$or':_['map'](_0x156257[_0x9172('0x4c')],function(_0x283c79){var _0x1ad3b0={};_0x1ad3b0[_0x283c79]={'$like':'%'+_0x2a4737[_0x9172('0x49')][_0x9172('0x6a')]+'%'};return _0x1ad3b0;})});}_0x156257=_['merge']({},_0x156257,_0x2a4737[_0x9172('0x57')]);return _0x2b8765[_0x9172('0xe7')](_0x156257);}})[_0x9172('0x23')](function(_0x3010a3){if(_0x3010a3){_0x1c1b4e=_0x3010a3[_0x9172('0x4e')];if(!_0x2a4737[_0x9172('0x49')][_0x9172('0x4f')](_0x9172('0x50'))){_0x156257['limit']=qs[_0x9172('0x33')](_0x2a4737['query'][_0x9172('0x33')]);_0x156257[_0x9172('0x32')]=qs[_0x9172('0x32')](_0x2a4737['query'][_0x9172('0x32')]);}return _0x2b8765[_0x9172('0xe7')](_0x156257);}})[_0x9172('0x23')](function(_0x1ec7ae){if(_0x1ec7ae){return _0x1ec7ae?{'count':_0x1c1b4e,'rows':_0x1ec7ae}:null;}})['then'](respondWithResult(_0x520dbb,null))['catch'](handleError(_0x520dbb,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index a9a015c..820a7fa 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 _0x3302=['SmsAccount','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x56a7cb,_0xddcb23){var _0x20c921=function(_0x61aeab){while(--_0x61aeab){_0x56a7cb['push'](_0x56a7cb['shift']());}};_0x20c921(++_0xddcb23);}(_0x3302,0x116));var _0x2330=function(_0x3e2b49,_0x820a55){_0x3e2b49=_0x3e2b49-0x0;var _0x32ef8d=_0x3302[_0x3e2b49];return _0x32ef8d;};'use strict';var EventEmitter=require(_0x2330('0x0'));var SmsAccount=require(_0x2330('0x1'))['db'][_0x2330('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2330('0x3'),'afterUpdate':_0x2330('0x4'),'afterDestroy':_0x2330('0x5')};function emitEvent(_0xaf06c8){return function(_0x3ec180,_0x424d7c,_0x178929){SmsAccountEvents['emit'](_0xaf06c8+':'+_0x3ec180['id'],_0x3ec180);SmsAccountEvents[_0x2330('0x6')](_0xaf06c8,_0x3ec180);_0x178929(null);};}for(var e in events){if(events[_0x2330('0x7')](e)){var event=events[e];SmsAccount[_0x2330('0x8')](e,emitEvent(event));}}module[_0x2330('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0x21d9=['../../mysqldb','SmsAccount','setMaxListeners','save','update','hasOwnProperty','hook','events'];(function(_0x237546,_0xa81b26){var _0x233e29=function(_0x728aa4){while(--_0x728aa4){_0x237546['push'](_0x237546['shift']());}};_0x233e29(++_0xa81b26);}(_0x21d9,0x16f));var _0x921d=function(_0x2341ab,_0x326a6c){_0x2341ab=_0x2341ab-0x0;var _0x54533e=_0x21d9[_0x2341ab];return _0x54533e;};'use strict';var EventEmitter=require(_0x921d('0x0'));var SmsAccount=require(_0x921d('0x1'))['db'][_0x921d('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x921d('0x3')](0x0);var events={'afterCreate':_0x921d('0x4'),'afterUpdate':_0x921d('0x5'),'afterDestroy':'remove'};function emitEvent(_0x39eda4){return function(_0x32234f,_0x38f9cd,_0x41fb51){SmsAccountEvents['emit'](_0x39eda4+':'+_0x32234f['id'],_0x32234f);SmsAccountEvents['emit'](_0x39eda4,_0x32234f);_0x41fb51(null);};}for(var e in events){if(events[_0x921d('0x6')](e)){var event=events[e];SmsAccount[_0x921d('0x7')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index a952711..b8224e8 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 _0x14a1=['../../config/environment','./smsAccount.attributes','define','SmsAccount','sms_accounts','lodash','util','moment','request-promise','rimraf'];(function(_0x3c1cf1,_0x2b199f){var _0x651e2d=function(_0x417be6){while(--_0x417be6){_0x3c1cf1['push'](_0x3c1cf1['shift']());}};_0x651e2d(++_0x2b199f);}(_0x14a1,0x159));var _0x114a=function(_0x286f52,_0x865177){_0x286f52=_0x286f52-0x0;var _0x31aeff=_0x14a1[_0x286f52];return _0x31aeff;};'use strict';var _=require(_0x114a('0x0'));var util=require(_0x114a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x114a('0x2'));var BPromise=require('bluebird');var rp=require(_0x114a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x114a('0x4'));var config=require(_0x114a('0x5'));var attributes=require(_0x114a('0x6'));module['exports']=function(_0x1be14f,_0x4c57b8){return _0x1be14f[_0x114a('0x7')](_0x114a('0x8'),attributes,{'tableName':_0x114a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf83f=['define','SmsAccount','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x2de0a7,_0x38d3e7){var _0x429437=function(_0x23c148){while(--_0x23c148){_0x2de0a7['push'](_0x2de0a7['shift']());}};_0x429437(++_0x38d3e7);}(_0xf83f,0x162));var _0xff83=function(_0xca0940,_0x293603){_0xca0940=_0xca0940-0x0;var _0xbc10f3=_0xf83f[_0xca0940];return _0xbc10f3;};'use strict';var _=require(_0xff83('0x0'));var util=require(_0xff83('0x1'));var logger=require('../../config/logger')(_0xff83('0x2'));var moment=require(_0xff83('0x3'));var BPromise=require(_0xff83('0x4'));var rp=require(_0xff83('0x5'));var fs=require('fs');var path=require(_0xff83('0x6'));var rimraf=require('rimraf');var config=require(_0xff83('0x7'));var attributes=require('./smsAccount.attributes');module[_0xff83('0x8')]=function(_0x4d97cd,_0x1d8d4f){return _0x4d97cd[_0xff83('0x9')](_0xff83('0xa'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 1ac6f3e..80f21f9 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 _0x4c5d=['jayson/promise','client','http','redis','defaults','./smsAccount.socket','register','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','ShowSmsAccount','SmsAccount','find','options','where','include','map','model','attributes','then','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x57db73,_0x59171e){var _0x5b0c39=function(_0x3db350){while(--_0x3db350){_0x57db73['push'](_0x57db73['shift']());}};_0x5b0c39(++_0x59171e);}(_0x4c5d,0x1c0));var _0xd4c5=function(_0x12d424,_0x2bf675){_0x12d424=_0x12d424-0x0;var _0xc68108=_0x4c5d[_0x12d424];return _0xc68108;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd4c5('0x0'));var BPromise=require(_0xd4c5('0x1'));var rs=require(_0xd4c5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd4c5('0x3'))['db'];var utils=require(_0xd4c5('0x4'));var logger=require(_0xd4c5('0x5'))(_0xd4c5('0x6'));var config=require('../../config/environment');var jayson=require(_0xd4c5('0x7'));var client=jayson[_0xd4c5('0x8')][_0xd4c5('0x9')]({'port':0x232a});config[_0xd4c5('0xa')]=_[_0xd4c5('0xb')](config[_0xd4c5('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd4c5('0xa')]));require(_0xd4c5('0xc'))[_0xd4c5('0xd')](socket);function respondWithRpcPromise(_0x11b2ae,_0x465fd1,_0x219a2a){return new BPromise(function(_0x175a00,_0x55c12f){return client['request'](_0x11b2ae,_0x219a2a)['then'](function(_0xf7d044){logger[_0xd4c5('0xe')]('SmsAccount,\x20%s,\x20%s',_0x465fd1,_0xd4c5('0xf'));logger[_0xd4c5('0x10')](_0xd4c5('0x11'),_0x465fd1,_0xd4c5('0xf'),JSON[_0xd4c5('0x12')](_0xf7d044));if(_0xf7d044['error']){if(_0xf7d044[_0xd4c5('0x13')][_0xd4c5('0x14')]===0x1f4){logger[_0xd4c5('0x13')](_0xd4c5('0x15'),_0x465fd1,_0xf7d044[_0xd4c5('0x13')]['message']);return _0x55c12f(_0xf7d044['error']['message']);}logger['error'](_0xd4c5('0x15'),_0x465fd1,_0xf7d044[_0xd4c5('0x13')][_0xd4c5('0x16')]);return _0x175a00(_0xf7d044[_0xd4c5('0x13')][_0xd4c5('0x16')]);}else{logger[_0xd4c5('0xe')](_0xd4c5('0x15'),_0x465fd1,_0xd4c5('0xf'));_0x175a00(_0xf7d044[_0xd4c5('0x17')][_0xd4c5('0x16')]);}})[_0xd4c5('0x18')](function(_0x3164ed){logger[_0xd4c5('0x13')](_0xd4c5('0x15'),_0x465fd1,_0x3164ed);_0x55c12f(_0x3164ed);});});}exports[_0xd4c5('0x19')]=function(_0xa387c4){var _0x3e2238=this;return new Promise(function(_0x3ca9bc,_0x1642da){return db[_0xd4c5('0x1a')][_0xd4c5('0x1b')]({'raw':_0xa387c4[_0xd4c5('0x1c')]?_0xa387c4[_0xd4c5('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0xa387c4[_0xd4c5('0x1c')]?_0xa387c4['options'][_0xd4c5('0x1d')]||null:null,'attributes':_0xa387c4[_0xd4c5('0x1c')]?_0xa387c4['options']['attributes']||null:null,'include':_0xa387c4[_0xd4c5('0x1c')]?_0xa387c4[_0xd4c5('0x1c')][_0xd4c5('0x1e')]?_[_0xd4c5('0x1f')](_0xa387c4[_0xd4c5('0x1c')]['include'],function(_0x42faa9){return{'model':db[_0x42faa9[_0xd4c5('0x20')]],'as':_0x42faa9['as'],'attributes':_0x42faa9['attributes'],'include':_0x42faa9[_0xd4c5('0x1e')]?_[_0xd4c5('0x1f')](_0x42faa9[_0xd4c5('0x1e')],function(_0x5dc87f){return{'model':db[_0x5dc87f['model']],'as':_0x5dc87f['as'],'attributes':_0x5dc87f[_0xd4c5('0x21')],'include':_0x5dc87f[_0xd4c5('0x1e')]?_[_0xd4c5('0x1f')](_0x5dc87f[_0xd4c5('0x1e')],function(_0x1bb306){return{'model':db[_0x1bb306[_0xd4c5('0x20')]],'as':_0x1bb306['as'],'attributes':_0x1bb306[_0xd4c5('0x21')]};}):[]};}):[]};}):[]:[]})[_0xd4c5('0x22')](function(_0x3255bd){logger['info'](_0xd4c5('0x19'),_0xa387c4);logger[_0xd4c5('0x10')](_0xd4c5('0x19'),_0xa387c4,JSON[_0xd4c5('0x12')](_0x3255bd));_0x3ca9bc(_0x3255bd);})[_0xd4c5('0x18')](function(_0x38ec52){logger[_0xd4c5('0x13')](_0xd4c5('0x19'),_0x38ec52['message'],_0xa387c4);_0x1642da(_0x3e2238[_0xd4c5('0x13')](0x1f4,_0x38ec52[_0xd4c5('0x16')]));});});}; \ No newline at end of file +var _0x7c65=['SmsAccount,\x20%s,\x20%s','message','info','result','find','options','where','attributes','include','map','model','ShowSmsAccount','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','request','then','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3575ed,_0x3294bb){var _0x36cb29=function(_0x346b66){while(--_0x346b66){_0x3575ed['push'](_0x3575ed['shift']());}};_0x36cb29(++_0x3294bb);}(_0x7c65,0x95));var _0x57c6=function(_0x3c68b6,_0x381ac5){_0x3c68b6=_0x3c68b6-0x0;var _0x423ec7=_0x7c65[_0x3c68b6];return _0x423ec7;};'use strict';var _=require(_0x57c6('0x0'));var util=require('util');var moment=require(_0x57c6('0x1'));var BPromise=require(_0x57c6('0x2'));var rs=require(_0x57c6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x57c6('0x4'));var logger=require(_0x57c6('0x5'))(_0x57c6('0x6'));var config=require(_0x57c6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x57c6('0x8')][_0x57c6('0x9')]({'port':0x232a});config[_0x57c6('0xa')]=_[_0x57c6('0xb')](config[_0x57c6('0xa')],{'host':_0x57c6('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x57c6('0xa')]));require('./smsAccount.socket')['register'](socket);function respondWithRpcPromise(_0x22d75f,_0x2de272,_0x429a4e){return new BPromise(function(_0x30cb6e,_0x325a0b){return client[_0x57c6('0xd')](_0x22d75f,_0x429a4e)[_0x57c6('0xe')](function(_0x3a8be9){logger['info']('SmsAccount,\x20%s,\x20%s',_0x2de272,_0x57c6('0xf'));logger[_0x57c6('0x10')](_0x57c6('0x11'),_0x2de272,_0x57c6('0xf'),JSON[_0x57c6('0x12')](_0x3a8be9));if(_0x3a8be9[_0x57c6('0x13')]){if(_0x3a8be9[_0x57c6('0x13')][_0x57c6('0x14')]===0x1f4){logger[_0x57c6('0x13')](_0x57c6('0x15'),_0x2de272,_0x3a8be9[_0x57c6('0x13')][_0x57c6('0x16')]);return _0x325a0b(_0x3a8be9[_0x57c6('0x13')]['message']);}logger[_0x57c6('0x13')](_0x57c6('0x15'),_0x2de272,_0x3a8be9[_0x57c6('0x13')][_0x57c6('0x16')]);return _0x30cb6e(_0x3a8be9[_0x57c6('0x13')][_0x57c6('0x16')]);}else{logger[_0x57c6('0x17')]('SmsAccount,\x20%s,\x20%s',_0x2de272,_0x57c6('0xf'));_0x30cb6e(_0x3a8be9[_0x57c6('0x18')][_0x57c6('0x16')]);}})['catch'](function(_0x3fb152){logger[_0x57c6('0x13')]('SmsAccount,\x20%s,\x20%s',_0x2de272,_0x3fb152);_0x325a0b(_0x3fb152);});});}exports['ShowSmsAccount']=function(_0x5b8892){var _0x2147df=this;return new Promise(function(_0x1c9a20,_0xd7eefa){return db['SmsAccount'][_0x57c6('0x19')]({'raw':_0x5b8892[_0x57c6('0x1a')]?_0x5b8892[_0x57c6('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5b8892[_0x57c6('0x1a')]?_0x5b8892[_0x57c6('0x1a')][_0x57c6('0x1b')]||null:null,'attributes':_0x5b8892[_0x57c6('0x1a')]?_0x5b8892[_0x57c6('0x1a')][_0x57c6('0x1c')]||null:null,'include':_0x5b8892[_0x57c6('0x1a')]?_0x5b8892[_0x57c6('0x1a')][_0x57c6('0x1d')]?_[_0x57c6('0x1e')](_0x5b8892['options']['include'],function(_0x503059){return{'model':db[_0x503059['model']],'as':_0x503059['as'],'attributes':_0x503059[_0x57c6('0x1c')],'include':_0x503059[_0x57c6('0x1d')]?_[_0x57c6('0x1e')](_0x503059['include'],function(_0x3178de){return{'model':db[_0x3178de[_0x57c6('0x1f')]],'as':_0x3178de['as'],'attributes':_0x3178de[_0x57c6('0x1c')],'include':_0x3178de['include']?_[_0x57c6('0x1e')](_0x3178de[_0x57c6('0x1d')],function(_0x52f015){return{'model':db[_0x52f015['model']],'as':_0x52f015['as'],'attributes':_0x52f015['attributes']};}):[]};}):[]};}):[]:[]})[_0x57c6('0xe')](function(_0x3f4da8){logger[_0x57c6('0x17')](_0x57c6('0x20'),_0x5b8892);logger['debug'](_0x57c6('0x20'),_0x5b8892,JSON['stringify'](_0x3f4da8));_0x1c9a20(_0x3f4da8);})[_0x57c6('0x21')](function(_0x33a06a){logger['error'](_0x57c6('0x20'),_0x33a06a[_0x57c6('0x16')],_0x5b8892);_0xd7eefa(_0x2147df['error'](0x1f4,_0x33a06a[_0x57c6('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index ca62b00..6251421 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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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 c8d0607..9567a9a 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(_0x3452a8,_0x4bfaa4){var _0x233814=function(_0x40b537){while(--_0x40b537){_0x3452a8['push'](_0x3452a8['shift']());}};_0x233814(++_0x4bfaa4);}(_0x3e74,0x175));var _0x43e7=function(_0x263746,_0x5ed172){_0x263746=_0x263746-0x0;var _0x4814eb=_0x3e74[_0x263746];return _0x4814eb;};'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 _0xedd9=['post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x1f5700,_0x19a2e0){var _0x25925e=function(_0x140956){while(--_0x140956){_0x1f5700['push'](_0x1f5700['shift']());}};_0x25925e(++_0x19a2e0);}(_0xedd9,0xfc));var _0x9edd=function(_0x23a092,_0x4682ff){_0x23a092=_0x23a092-0x0;var _0xadcf39=_0xedd9[_0x23a092];return _0xadcf39;};'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');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0xe')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['put'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 0a27e81..ce59d3a 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 _0x2875=['*,*,*,*','sequelize','STRING','noop'];(function(_0x42cd79,_0xb9e647){var _0x3cb89e=function(_0x11476c){while(--_0x11476c){_0x42cd79['push'](_0x42cd79['shift']());}};_0x3cb89e(++_0xb9e647);}(_0x2875,0x85));var _0x5287=function(_0x77fcad,_0xeebb41){_0x77fcad=_0x77fcad-0x0;var _0x3d032e=_0x2875[_0x77fcad];return _0x3d032e;};'use strict';var Sequelize=require(_0x5287('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x5287('0x1')],'allowNull':![],'defaultValue':_0x5287('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x5287('0x1')]},'interval':{'type':Sequelize[_0x5287('0x1')],'defaultValue':_0x5287('0x3')}}; \ No newline at end of file +var _0x057f=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x3da6e5,_0x1e2021){var _0x3ea51c=function(_0x116dcf){while(--_0x116dcf){_0x3da6e5['push'](_0x3da6e5['shift']());}};_0x3ea51c(++_0x1e2021);}(_0x057f,0x10b));var _0xf057=function(_0x4a1a85,_0x162d79){_0x4a1a85=_0x4a1a85-0x0;var _0x15f578=_0x057f[_0x4a1a85];return _0x15f578;};'use strict';var Sequelize=require(_0xf057('0x0'));module[_0xf057('0x1')]={'priority':{'type':Sequelize[_0xf057('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf057('0x3')],'allowNull':![],'defaultValue':_0xf057('0x4')},'appdata':{'type':Sequelize[_0xf057('0x5')]()},'description':{'type':Sequelize[_0xf057('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xf057('0x6')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index f3afd4f..50e9354 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 _0xdc43=['moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','Content-Range','apply','reject','then','error','stack','send','index','map','SmsApplication','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','filter','merge','where','type','VIRTUAL','count','catch','show','params','includeAll','options','create','body','update','find','destroy','eml-format','zip-dir','fast-json-patch'];(function(_0x31752d,_0x2efff8){var _0x29da67=function(_0x296d74){while(--_0x296d74){_0x31752d['push'](_0x31752d['shift']());}};_0x29da67(++_0x2efff8);}(_0xdc43,0x19b));var _0x3dc4=function(_0x55ea43,_0x31605c){_0x55ea43=_0x55ea43-0x0;var _0x394afb=_0xdc43[_0x55ea43];return _0x394afb;};'use strict';var emlformat=require(_0x3dc4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3dc4('0x1'));var jsonpatch=require(_0x3dc4('0x2'));var rp=require('request-promise');var moment=require(_0x3dc4('0x3'));var BPromise=require(_0x3dc4('0x4'));var Mustache=require(_0x3dc4('0x5'));var util=require(_0x3dc4('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x3dc4('0x7'));var ejs=require(_0x3dc4('0x8'));var fs=require('fs');var fs_extra=require(_0x3dc4('0x9'));var _=require('lodash');var squel=require(_0x3dc4('0xa'));var crypto=require(_0x3dc4('0xb'));var jsforce=require(_0x3dc4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3dc4('0x7'));var querystring=require(_0x3dc4('0xd'));var Papa=require(_0x3dc4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3dc4('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3dc4('0x10'));var logger=require(_0x3dc4('0x11'))(_0x3dc4('0x12'));var utils=require('../../config/utils');var config=require(_0x3dc4('0x13'));var licenseUtil=require(_0x3dc4('0x14'));var db=require(_0x3dc4('0x15'))['db'];function respondWithStatusCode(_0x52cd39,_0x4118bc){_0x4118bc=_0x4118bc||0xcc;return function(_0x42d325){if(_0x42d325){return _0x52cd39[_0x3dc4('0x16')](_0x4118bc);}return _0x52cd39['status'](_0x4118bc)[_0x3dc4('0x17')]();};}function respondWithResult(_0x3d637a,_0x469392){_0x469392=_0x469392||0xc8;return function(_0x286fa7){if(_0x286fa7){return _0x3d637a[_0x3dc4('0x18')](_0x469392)[_0x3dc4('0x19')](_0x286fa7);}};}function respondWithFilteredResult(_0x109757,_0x982765){return function(_0x72ffc4){if(_0x72ffc4){var _0x559bfc=typeof _0x982765[_0x3dc4('0x1a')]===_0x3dc4('0x1b')&&typeof _0x982765[_0x3dc4('0x1c')]===_0x3dc4('0x1b');var _0x31df76=_0x72ffc4['count'];var _0x116f7c=_0x559bfc?0x0:_0x982765['offset'];var _0x5a1afb=_0x559bfc?_0x72ffc4['count']:_0x982765[_0x3dc4('0x1a')]+_0x982765['limit'];var _0x421870;if(_0x5a1afb>=_0x31df76){_0x5a1afb=_0x31df76;_0x421870=0xc8;}else{_0x421870=0xce;}_0x109757['status'](_0x421870);return _0x109757['set'](_0x3dc4('0x1d'),_0x116f7c+'-'+_0x5a1afb+'/'+_0x31df76)[_0x3dc4('0x19')](_0x72ffc4);}return null;};}function patchUpdates(_0x5efe7f){return function(_0x1ed126){try{jsonpatch[_0x3dc4('0x1e')](_0x1ed126,_0x5efe7f,!![]);}catch(_0x219e4b){return BPromise[_0x3dc4('0x1f')](_0x219e4b);}return _0x1ed126['save']();};}function saveUpdates(_0x8950b0,_0x40863d){return function(_0x4edabf){if(_0x4edabf){return _0x4edabf['update'](_0x8950b0)[_0x3dc4('0x20')](function(_0x3ade21){return _0x3ade21;});}return null;};}function removeEntity(_0x4ab3ef,_0x3b5f8e){return function(_0x294bd4){if(_0x294bd4){return _0x294bd4['destroy']()[_0x3dc4('0x20')](function(){_0x4ab3ef[_0x3dc4('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cd56a,_0x53b74d){return function(_0x62ba93){if(!_0x62ba93){_0x5cd56a[_0x3dc4('0x16')](0x194);}return _0x62ba93;};}function handleError(_0x3b39b3,_0x56b7b3){_0x56b7b3=_0x56b7b3||0x1f4;return function(_0xbfbcd4){logger[_0x3dc4('0x21')](_0xbfbcd4[_0x3dc4('0x22')]);if(_0xbfbcd4['name']){delete _0xbfbcd4['name'];}_0x3b39b3[_0x3dc4('0x18')](_0x56b7b3)[_0x3dc4('0x23')](_0xbfbcd4);};}exports[_0x3dc4('0x24')]=function(_0x507738,_0x4e05ac){var _0x1fb5e0={},_0x35a4f3={},_0x5ac952={'count':0x0,'rows':[]};var _0x375520=_[_0x3dc4('0x25')](db[_0x3dc4('0x26')][_0x3dc4('0x27')],function(_0x52490f){return{'name':_0x52490f[_0x3dc4('0x28')],'type':_0x52490f['type'][_0x3dc4('0x29')]};});_0x35a4f3[_0x3dc4('0x2a')]=_[_0x3dc4('0x25')](_0x375520,_0x3dc4('0x2b'));_0x35a4f3[_0x3dc4('0x2c')]=_[_0x3dc4('0x2d')](_0x507738[_0x3dc4('0x2c')]);_0x35a4f3[_0x3dc4('0x2e')]=_[_0x3dc4('0x2f')](_0x35a4f3[_0x3dc4('0x2a')],_0x35a4f3[_0x3dc4('0x2c')]);_0x1fb5e0[_0x3dc4('0x30')]=_[_0x3dc4('0x2f')](_0x35a4f3['model'],qs[_0x3dc4('0x31')](_0x507738[_0x3dc4('0x2c')][_0x3dc4('0x31')]));_0x1fb5e0[_0x3dc4('0x30')]=_0x1fb5e0['attributes'][_0x3dc4('0x32')]?_0x1fb5e0['attributes']:_0x35a4f3[_0x3dc4('0x2a')];if(!_0x507738[_0x3dc4('0x2c')]['hasOwnProperty'](_0x3dc4('0x33'))){_0x1fb5e0[_0x3dc4('0x1c')]=qs[_0x3dc4('0x1c')](_0x507738[_0x3dc4('0x2c')][_0x3dc4('0x1c')]);_0x1fb5e0[_0x3dc4('0x1a')]=qs[_0x3dc4('0x1a')](_0x507738[_0x3dc4('0x2c')]['offset']);}_0x1fb5e0[_0x3dc4('0x34')]=qs['sort'](_0x507738[_0x3dc4('0x2c')]['sort']);_0x1fb5e0['where']=qs['filters'](_['pick'](_0x507738[_0x3dc4('0x2c')],_0x35a4f3[_0x3dc4('0x2e')]),_0x375520);if(_0x507738[_0x3dc4('0x2c')][_0x3dc4('0x35')]){_0x1fb5e0['where']=_[_0x3dc4('0x36')](_0x1fb5e0[_0x3dc4('0x37')],{'$or':_['map'](_0x375520,function(_0x551cb8){if(_0x551cb8[_0x3dc4('0x38')]!==_0x3dc4('0x39')){var _0xd9da2c={};_0xd9da2c[_0x551cb8[_0x3dc4('0x2b')]]={'$like':'%'+_0x507738[_0x3dc4('0x2c')][_0x3dc4('0x35')]+'%'};return _0xd9da2c;}})});}_0x1fb5e0=_[_0x3dc4('0x36')]({},_0x1fb5e0,_0x507738['options']);var _0x4ead28={'where':_0x1fb5e0[_0x3dc4('0x37')]};return db[_0x3dc4('0x26')]['count'](_0x4ead28)[_0x3dc4('0x20')](function(_0x110c4a){_0x5ac952[_0x3dc4('0x3a')]=_0x110c4a;if(_0x507738[_0x3dc4('0x2c')]['includeAll']){_0x1fb5e0['include']=[{'all':!![]}];}return db[_0x3dc4('0x26')]['findAll'](_0x1fb5e0);})['then'](function(_0x8c942b){_0x5ac952['rows']=_0x8c942b;return _0x5ac952;})[_0x3dc4('0x20')](respondWithFilteredResult(_0x4e05ac,_0x1fb5e0))[_0x3dc4('0x3b')](handleError(_0x4e05ac,null));};exports[_0x3dc4('0x3c')]=function(_0x376455,_0x4943ec){var _0x3f1853={'raw':!![],'where':{'id':_0x376455[_0x3dc4('0x3d')]['id']}},_0x5c4ee8={};_0x5c4ee8[_0x3dc4('0x2a')]=_[_0x3dc4('0x2d')](db[_0x3dc4('0x26')]['rawAttributes']);_0x5c4ee8[_0x3dc4('0x2c')]=_[_0x3dc4('0x2d')](_0x376455[_0x3dc4('0x2c')]);_0x5c4ee8['filters']=_[_0x3dc4('0x2f')](_0x5c4ee8['model'],_0x5c4ee8[_0x3dc4('0x2c')]);_0x3f1853[_0x3dc4('0x30')]=_[_0x3dc4('0x2f')](_0x5c4ee8[_0x3dc4('0x2a')],qs[_0x3dc4('0x31')](_0x376455[_0x3dc4('0x2c')][_0x3dc4('0x31')]));_0x3f1853['attributes']=_0x3f1853[_0x3dc4('0x30')][_0x3dc4('0x32')]?_0x3f1853[_0x3dc4('0x30')]:_0x5c4ee8[_0x3dc4('0x2a')];if(_0x376455[_0x3dc4('0x2c')][_0x3dc4('0x3e')]){_0x3f1853['include']=[{'all':!![]}];}_0x3f1853=_[_0x3dc4('0x36')]({},_0x3f1853,_0x376455[_0x3dc4('0x3f')]);return db['SmsApplication']['find'](_0x3f1853)[_0x3dc4('0x20')](handleEntityNotFound(_0x4943ec,null))[_0x3dc4('0x20')](respondWithResult(_0x4943ec,null))[_0x3dc4('0x3b')](handleError(_0x4943ec,null));};exports['create']=function(_0x34d721,_0x4de88c){return db[_0x3dc4('0x26')][_0x3dc4('0x40')](_0x34d721[_0x3dc4('0x41')],{})['then'](respondWithResult(_0x4de88c,0xc9))['catch'](handleError(_0x4de88c,null));};exports[_0x3dc4('0x42')]=function(_0x49c9a8,_0x16feb3){if(_0x49c9a8[_0x3dc4('0x41')]['id']){delete _0x49c9a8[_0x3dc4('0x41')]['id'];}return db['SmsApplication'][_0x3dc4('0x43')]({'where':{'id':_0x49c9a8['params']['id']}})[_0x3dc4('0x20')](handleEntityNotFound(_0x16feb3,null))[_0x3dc4('0x20')](saveUpdates(_0x49c9a8['body'],null))[_0x3dc4('0x20')](respondWithResult(_0x16feb3,null))[_0x3dc4('0x3b')](handleError(_0x16feb3,null));};exports[_0x3dc4('0x44')]=function(_0xecacfc,_0x2760d7){return db[_0x3dc4('0x26')]['find']({'where':{'id':_0xecacfc[_0x3dc4('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2760d7,null))['then'](removeEntity(_0x2760d7,null))[_0x3dc4('0x3b')](handleError(_0x2760d7,null));}; \ No newline at end of file +var _0x4c5a=['SmsApplication','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','intersection','find','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','json','offset','undefined','limit','count','set','apply','reject','save','update','then','status','end','sendStatus','stack','name','send','index','map'];(function(_0x4621be,_0x4aed45){var _0x3e5b37=function(_0x303730){while(--_0x303730){_0x4621be['push'](_0x4621be['shift']());}};_0x3e5b37(++_0x4aed45);}(_0x4c5a,0x1ef));var _0xa4c5=function(_0x499099,_0x4139dd){_0x499099=_0x499099-0x0;var _0x2c6bd4=_0x4c5a[_0x499099];return _0x2c6bd4;};'use strict';var emlformat=require(_0xa4c5('0x0'));var rimraf=require(_0xa4c5('0x1'));var zipdir=require(_0xa4c5('0x2'));var jsonpatch=require(_0xa4c5('0x3'));var rp=require(_0xa4c5('0x4'));var moment=require('moment');var BPromise=require(_0xa4c5('0x5'));var Mustache=require(_0xa4c5('0x6'));var util=require('util');var path=require('path');var sox=require(_0xa4c5('0x7'));var csv=require('to-csv');var ejs=require(_0xa4c5('0x8'));var fs=require('fs');var fs_extra=require(_0xa4c5('0x9'));var _=require(_0xa4c5('0xa'));var squel=require(_0xa4c5('0xb'));var crypto=require(_0xa4c5('0xc'));var jsforce=require(_0xa4c5('0xd'));var deskjs=require(_0xa4c5('0xe'));var toCsv=require(_0xa4c5('0xf'));var querystring=require(_0xa4c5('0x10'));var Papa=require(_0xa4c5('0x11'));var Redis=require('ioredis');var authService=require(_0xa4c5('0x12'));var qs=require(_0xa4c5('0x13'));var as=require(_0xa4c5('0x14'));var hardwareService=require(_0xa4c5('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xa4c5('0x16'));var config=require(_0xa4c5('0x17'));var licenseUtil=require(_0xa4c5('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23ac26,_0x3d7038){_0x3d7038=_0x3d7038||0xcc;return function(_0x3e122b){if(_0x3e122b){return _0x23ac26['sendStatus'](_0x3d7038);}return _0x23ac26['status'](_0x3d7038)['end']();};}function respondWithResult(_0x3ae317,_0x525527){_0x525527=_0x525527||0xc8;return function(_0x3dc482){if(_0x3dc482){return _0x3ae317['status'](_0x525527)[_0xa4c5('0x19')](_0x3dc482);}};}function respondWithFilteredResult(_0x18f1d5,_0x185454){return function(_0x13dd07){if(_0x13dd07){var _0x2505f0=typeof _0x185454[_0xa4c5('0x1a')]===_0xa4c5('0x1b')&&typeof _0x185454[_0xa4c5('0x1c')]===_0xa4c5('0x1b');var _0x230671=_0x13dd07[_0xa4c5('0x1d')];var _0xa35496=_0x2505f0?0x0:_0x185454['offset'];var _0x2da979=_0x2505f0?_0x13dd07['count']:_0x185454[_0xa4c5('0x1a')]+_0x185454[_0xa4c5('0x1c')];var _0x201e13;if(_0x2da979>=_0x230671){_0x2da979=_0x230671;_0x201e13=0xc8;}else{_0x201e13=0xce;}_0x18f1d5['status'](_0x201e13);return _0x18f1d5[_0xa4c5('0x1e')]('Content-Range',_0xa35496+'-'+_0x2da979+'/'+_0x230671)[_0xa4c5('0x19')](_0x13dd07);}return null;};}function patchUpdates(_0x429109){return function(_0x1378d9){try{jsonpatch[_0xa4c5('0x1f')](_0x1378d9,_0x429109,!![]);}catch(_0x318f39){return BPromise[_0xa4c5('0x20')](_0x318f39);}return _0x1378d9[_0xa4c5('0x21')]();};}function saveUpdates(_0x3ee3c6,_0x3224b3){return function(_0x51e0ac){if(_0x51e0ac){return _0x51e0ac[_0xa4c5('0x22')](_0x3ee3c6)[_0xa4c5('0x23')](function(_0x5d174b){return _0x5d174b;});}return null;};}function removeEntity(_0xea1e9,_0x153b71){return function(_0x36ff22){if(_0x36ff22){return _0x36ff22['destroy']()[_0xa4c5('0x23')](function(){_0xea1e9[_0xa4c5('0x24')](0xcc)[_0xa4c5('0x25')]();});}};}function handleEntityNotFound(_0x347b0b,_0x36c249){return function(_0xee5941){if(!_0xee5941){_0x347b0b[_0xa4c5('0x26')](0x194);}return _0xee5941;};}function handleError(_0x100388,_0x1a30cf){_0x1a30cf=_0x1a30cf||0x1f4;return function(_0x169eac){logger['error'](_0x169eac[_0xa4c5('0x27')]);if(_0x169eac['name']){delete _0x169eac[_0xa4c5('0x28')];}_0x100388['status'](_0x1a30cf)[_0xa4c5('0x29')](_0x169eac);};}exports[_0xa4c5('0x2a')]=function(_0x3fd266,_0x2e1a77){var _0x4d632a={},_0x185266={},_0x5332bb={'count':0x0,'rows':[]};var _0x268dd2=_[_0xa4c5('0x2b')](db[_0xa4c5('0x2c')][_0xa4c5('0x2d')],function(_0x522884){return{'name':_0x522884[_0xa4c5('0x2e')],'type':_0x522884['type'][_0xa4c5('0x2f')]};});_0x185266[_0xa4c5('0x30')]=_[_0xa4c5('0x2b')](_0x268dd2,_0xa4c5('0x28'));_0x185266[_0xa4c5('0x31')]=_[_0xa4c5('0x32')](_0x3fd266['query']);_0x185266[_0xa4c5('0x33')]=_['intersection'](_0x185266[_0xa4c5('0x30')],_0x185266[_0xa4c5('0x31')]);_0x4d632a[_0xa4c5('0x34')]=_['intersection'](_0x185266[_0xa4c5('0x30')],qs[_0xa4c5('0x35')](_0x3fd266[_0xa4c5('0x31')][_0xa4c5('0x35')]));_0x4d632a[_0xa4c5('0x34')]=_0x4d632a[_0xa4c5('0x34')][_0xa4c5('0x36')]?_0x4d632a[_0xa4c5('0x34')]:_0x185266[_0xa4c5('0x30')];if(!_0x3fd266[_0xa4c5('0x31')][_0xa4c5('0x37')](_0xa4c5('0x38'))){_0x4d632a[_0xa4c5('0x1c')]=qs[_0xa4c5('0x1c')](_0x3fd266[_0xa4c5('0x31')]['limit']);_0x4d632a[_0xa4c5('0x1a')]=qs[_0xa4c5('0x1a')](_0x3fd266['query']['offset']);}_0x4d632a[_0xa4c5('0x39')]=qs[_0xa4c5('0x3a')](_0x3fd266['query']['sort']);_0x4d632a['where']=qs[_0xa4c5('0x33')](_[_0xa4c5('0x3b')](_0x3fd266['query'],_0x185266['filters']),_0x268dd2);if(_0x3fd266[_0xa4c5('0x31')][_0xa4c5('0x3c')]){_0x4d632a[_0xa4c5('0x3d')]=_['merge'](_0x4d632a[_0xa4c5('0x3d')],{'$or':_['map'](_0x268dd2,function(_0x3a6550){if(_0x3a6550[_0xa4c5('0x3e')]!==_0xa4c5('0x3f')){var _0x1ba8be={};_0x1ba8be[_0x3a6550[_0xa4c5('0x28')]]={'$like':'%'+_0x3fd266[_0xa4c5('0x31')][_0xa4c5('0x3c')]+'%'};return _0x1ba8be;}})});}_0x4d632a=_[_0xa4c5('0x40')]({},_0x4d632a,_0x3fd266[_0xa4c5('0x41')]);var _0x38b01c={'where':_0x4d632a['where']};return db['SmsApplication']['count'](_0x38b01c)[_0xa4c5('0x23')](function(_0x30152f){_0x5332bb['count']=_0x30152f;if(_0x3fd266[_0xa4c5('0x31')][_0xa4c5('0x42')]){_0x4d632a[_0xa4c5('0x43')]=[{'all':!![]}];}return db[_0xa4c5('0x2c')][_0xa4c5('0x44')](_0x4d632a);})['then'](function(_0x2bb5fd){_0x5332bb['rows']=_0x2bb5fd;return _0x5332bb;})[_0xa4c5('0x23')](respondWithFilteredResult(_0x2e1a77,_0x4d632a))[_0xa4c5('0x45')](handleError(_0x2e1a77,null));};exports[_0xa4c5('0x46')]=function(_0x38a4fa,_0x4d668b){var _0x4c9913={'raw':!![],'where':{'id':_0x38a4fa['params']['id']}},_0x446e6f={};_0x446e6f[_0xa4c5('0x30')]=_[_0xa4c5('0x32')](db['SmsApplication']['rawAttributes']);_0x446e6f[_0xa4c5('0x31')]=_[_0xa4c5('0x32')](_0x38a4fa[_0xa4c5('0x31')]);_0x446e6f['filters']=_['intersection'](_0x446e6f[_0xa4c5('0x30')],_0x446e6f[_0xa4c5('0x31')]);_0x4c9913['attributes']=_[_0xa4c5('0x47')](_0x446e6f[_0xa4c5('0x30')],qs[_0xa4c5('0x35')](_0x38a4fa[_0xa4c5('0x31')][_0xa4c5('0x35')]));_0x4c9913['attributes']=_0x4c9913[_0xa4c5('0x34')][_0xa4c5('0x36')]?_0x4c9913['attributes']:_0x446e6f['model'];if(_0x38a4fa[_0xa4c5('0x31')][_0xa4c5('0x42')]){_0x4c9913[_0xa4c5('0x43')]=[{'all':!![]}];}_0x4c9913=_[_0xa4c5('0x40')]({},_0x4c9913,_0x38a4fa[_0xa4c5('0x41')]);return db[_0xa4c5('0x2c')][_0xa4c5('0x48')](_0x4c9913)[_0xa4c5('0x23')](handleEntityNotFound(_0x4d668b,null))[_0xa4c5('0x23')](respondWithResult(_0x4d668b,null))[_0xa4c5('0x45')](handleError(_0x4d668b,null));};exports[_0xa4c5('0x49')]=function(_0x42b996,_0x265e24){return db['SmsApplication'][_0xa4c5('0x49')](_0x42b996[_0xa4c5('0x4a')],{})[_0xa4c5('0x23')](respondWithResult(_0x265e24,0xc9))[_0xa4c5('0x45')](handleError(_0x265e24,null));};exports[_0xa4c5('0x22')]=function(_0x1b6d8c,_0x20fb6f){if(_0x1b6d8c[_0xa4c5('0x4a')]['id']){delete _0x1b6d8c['body']['id'];}return db[_0xa4c5('0x2c')][_0xa4c5('0x48')]({'where':{'id':_0x1b6d8c[_0xa4c5('0x4b')]['id']}})[_0xa4c5('0x23')](handleEntityNotFound(_0x20fb6f,null))[_0xa4c5('0x23')](saveUpdates(_0x1b6d8c['body'],null))['then'](respondWithResult(_0x20fb6f,null))[_0xa4c5('0x45')](handleError(_0x20fb6f,null));};exports[_0xa4c5('0x4c')]=function(_0x38187b,_0x1c28f0){return db[_0xa4c5('0x2c')]['find']({'where':{'id':_0x38187b[_0xa4c5('0x4b')]['id']}})[_0xa4c5('0x23')](handleEntityNotFound(_0x1c28f0,null))[_0xa4c5('0x23')](removeEntity(_0x1c28f0,null))[_0xa4c5('0x45')](handleError(_0x1c28f0,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index ca7d2a9..0b3f095 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 _0x00bb=['SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./smsApplication.attributes','define'];(function(_0x45d80c,_0x35c0ff){var _0x449a98=function(_0x1b5ab7){while(--_0x1b5ab7){_0x45d80c['push'](_0x45d80c['shift']());}};_0x449a98(++_0x35c0ff);}(_0x00bb,0x1d8));var _0xb00b=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x00bb[_0x33032e];return _0x13316b;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var logger=require(_0xb00b('0x2'))('api');var moment=require(_0xb00b('0x3'));var BPromise=require('bluebird');var rp=require(_0xb00b('0x4'));var fs=require('fs');var path=require(_0xb00b('0x5'));var rimraf=require('rimraf');var config=require(_0xb00b('0x6'));var attributes=require(_0xb00b('0x7'));module['exports']=function(_0x574cf8,_0x532ffb){return _0x574cf8[_0xb00b('0x8')](_0xb00b('0x9'),attributes,{'tableName':_0xb00b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb00b('0xb'),'collate':_0xb00b('0xc')});}; \ No newline at end of file +var _0x7cf8=['./smsApplication.attributes','exports','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7cf8,0x13a));var _0x87cf=function(_0x36dbe3,_0x1557ed){_0x36dbe3=_0x36dbe3-0x0;var _0x560dcb=_0x7cf8[_0x36dbe3];return _0x560dcb;};'use strict';var _=require(_0x87cf('0x0'));var util=require(_0x87cf('0x1'));var logger=require(_0x87cf('0x2'))(_0x87cf('0x3'));var moment=require(_0x87cf('0x4'));var BPromise=require(_0x87cf('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x87cf('0x6'));var rimraf=require(_0x87cf('0x7'));var config=require('../../config/environment');var attributes=require(_0x87cf('0x8'));module[_0x87cf('0x9')]=function(_0x3bd3e0,_0x2c90ad){return _0x3bd3e0['define'](_0x87cf('0xa'),attributes,{'tableName':_0x87cf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x87cf('0xc'),'collate':_0x87cf('0xd')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 620c14e..3378561 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 _0xdbc6=['client','then','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x1a1860,_0x9bca0){var _0x4f3b47=function(_0x3df8e7){while(--_0x3df8e7){_0x1a1860['push'](_0x1a1860['shift']());}};_0x4f3b47(++_0x9bca0);}(_0xdbc6,0x13b));var _0x6dbc=function(_0x4a29c2,_0x5d9b15){_0x4a29c2=_0x4a29c2-0x0;var _0x2bfafc=_0xdbc6[_0x4a29c2];return _0x2bfafc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6dbc('0x0'));var BPromise=require('bluebird');var rs=require(_0x6dbc('0x1'));var fs=require('fs');var Redis=require(_0x6dbc('0x2'));var db=require(_0x6dbc('0x3'))['db'];var utils=require(_0x6dbc('0x4'));var logger=require(_0x6dbc('0x5'))(_0x6dbc('0x6'));var config=require('../../config/environment');var jayson=require(_0x6dbc('0x7'));var client=jayson[_0x6dbc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbfd1f,_0x18da4b,_0x24849e){return new BPromise(function(_0x2f028f,_0x3231d8){return client['request'](_0xbfd1f,_0x24849e)[_0x6dbc('0x9')](function(_0x3c57b4){logger['info'](_0x6dbc('0xa'),_0x18da4b,_0x6dbc('0xb'));logger['debug'](_0x6dbc('0xc'),_0x18da4b,_0x6dbc('0xb'),JSON[_0x6dbc('0xd')](_0x3c57b4));if(_0x3c57b4[_0x6dbc('0xe')]){if(_0x3c57b4[_0x6dbc('0xe')]['code']===0x1f4){logger['error'](_0x6dbc('0xa'),_0x18da4b,_0x3c57b4[_0x6dbc('0xe')][_0x6dbc('0xf')]);return _0x3231d8(_0x3c57b4[_0x6dbc('0xe')][_0x6dbc('0xf')]);}logger[_0x6dbc('0xe')](_0x6dbc('0xa'),_0x18da4b,_0x3c57b4[_0x6dbc('0xe')][_0x6dbc('0xf')]);return _0x2f028f(_0x3c57b4['error'][_0x6dbc('0xf')]);}else{logger[_0x6dbc('0x10')](_0x6dbc('0xa'),_0x18da4b,_0x6dbc('0xb'));_0x2f028f(_0x3c57b4[_0x6dbc('0x11')][_0x6dbc('0xf')]);}})[_0x6dbc('0x12')](function(_0x1ee71a){logger['error']('SmsApplication,\x20%s,\x20%s',_0x18da4b,_0x1ee71a);_0x3231d8(_0x1ee71a);});});} \ No newline at end of file +var _0x056b=['stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s'];(function(_0x2a2e72,_0x1de962){var _0x3cfb4a=function(_0x3d435c){while(--_0x3d435c){_0x2a2e72['push'](_0x2a2e72['shift']());}};_0x3cfb4a(++_0x1de962);}(_0x056b,0xb6));var _0xb056=function(_0x342afb,_0x68c265){_0x342afb=_0x342afb-0x0;var _0x446112=_0x056b[_0x342afb];return _0x446112;};'use strict';var _=require('lodash');var util=require(_0xb056('0x0'));var moment=require(_0xb056('0x1'));var BPromise=require(_0xb056('0x2'));var rs=require(_0xb056('0x3'));var fs=require('fs');var Redis=require(_0xb056('0x4'));var db=require(_0xb056('0x5'))['db'];var utils=require(_0xb056('0x6'));var logger=require(_0xb056('0x7'))(_0xb056('0x8'));var config=require(_0xb056('0x9'));var jayson=require(_0xb056('0xa'));var client=jayson['client'][_0xb056('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x314637,_0x3eae69,_0x3c9b89){return new BPromise(function(_0x80daf1,_0x6bf4c){return client['request'](_0x314637,_0x3c9b89)['then'](function(_0x37a86d){logger[_0xb056('0xc')](_0xb056('0xd'),_0x3eae69,_0xb056('0xe'));logger['debug'](_0xb056('0xf'),_0x3eae69,'request\x20sent',JSON[_0xb056('0x10')](_0x37a86d));if(_0x37a86d[_0xb056('0x11')]){if(_0x37a86d[_0xb056('0x11')][_0xb056('0x12')]===0x1f4){logger[_0xb056('0x11')]('SmsApplication,\x20%s,\x20%s',_0x3eae69,_0x37a86d['error'][_0xb056('0x13')]);return _0x6bf4c(_0x37a86d[_0xb056('0x11')]['message']);}logger[_0xb056('0x11')](_0xb056('0xd'),_0x3eae69,_0x37a86d[_0xb056('0x11')][_0xb056('0x13')]);return _0x80daf1(_0x37a86d[_0xb056('0x11')][_0xb056('0x13')]);}else{logger[_0xb056('0xc')]('SmsApplication,\x20%s,\x20%s',_0x3eae69,_0xb056('0xe'));_0x80daf1(_0x37a86d[_0xb056('0x14')][_0xb056('0x13')]);}})[_0xb056('0x15')](function(_0x5a4ef1){logger[_0xb056('0x11')]('SmsApplication,\x20%s,\x20%s',_0x3eae69,_0x5a4ef1);_0x6bf4c(_0x5a4ef1);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 00e2fae..e9c3b37 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 _0x3423=['/:id','/:id/messages','download','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','put','delete','smsinteraction:destroy','destroy','removeTags','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x7a3247,_0x15cb12){var _0x1bfde5=function(_0x62bbef){while(--_0x62bbef){_0x7a3247['push'](_0x7a3247['shift']());}};_0x1bfde5(++_0x15cb12);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3342('0x0'));var timeout=require(_0x3342('0x1'));var express=require(_0x3342('0x2'));var router=express[_0x3342('0x3')]();var fs_extra=require(_0x3342('0x4'));var auth=require(_0x3342('0x5'));var interaction=require(_0x3342('0x6'));var config=require(_0x3342('0x7'));var controller=require(_0x3342('0x8'));router[_0x3342('0x9')]('/',auth[_0x3342('0xa')](),controller[_0x3342('0xb')]);router[_0x3342('0x9')](_0x3342('0xc'),auth[_0x3342('0xa')](),controller[_0x3342('0xd')]);router[_0x3342('0x9')](_0x3342('0xe'),auth[_0x3342('0xa')](),controller['show']);router['get'](_0x3342('0xf'),auth['isAuthenticated'](),controller['getMessages']);router['get']('/:id/download',auth[_0x3342('0xa')](),controller[_0x3342('0x10')]);router['post']('/',auth[_0x3342('0xa')](),controller['create']);router[_0x3342('0x11')](_0x3342('0xf'),auth['isAuthenticated'](),controller[_0x3342('0x12')]);router[_0x3342('0x11')](_0x3342('0x13'),auth[_0x3342('0xa')](),interaction[_0x3342('0x14')](_0x3342('0x15'),_0x3342('0x16')),controller['addTags']);router[_0x3342('0x17')](_0x3342('0xe'),auth['isAuthenticated'](),interaction[_0x3342('0x14')](_0x3342('0x15'),'smsinteraction:update'),controller['update']);router[_0x3342('0x18')](_0x3342('0xe'),auth[_0x3342('0xa')](),interaction[_0x3342('0x14')](_0x3342('0x15'),_0x3342('0x19')),controller[_0x3342('0x1a')]);router[_0x3342('0x18')](_0x3342('0x13'),auth['isAuthenticated'](),controller[_0x3342('0x1b')]);module[_0x3342('0x1c')]=router; \ No newline at end of file +var _0x34b7=['/:id/tags','removeTags','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','tracked','sms','smsinteraction:addtags','addTags','put','/:id','smsinteraction:update','delete','destroy'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x34b7,0x196));var _0x734b=function(_0x7b17fe,_0x1233ff){_0x7b17fe=_0x7b17fe-0x0;var _0x5215be=_0x34b7[_0x7b17fe];return _0x5215be;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x734b('0x0'));var timeout=require(_0x734b('0x1'));var express=require(_0x734b('0x2'));var router=express[_0x734b('0x3')]();var fs_extra=require(_0x734b('0x4'));var auth=require(_0x734b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x734b('0x6'));router[_0x734b('0x7')]('/',auth[_0x734b('0x8')](),controller[_0x734b('0x9')]);router[_0x734b('0x7')](_0x734b('0xa'),auth['isAuthenticated'](),controller[_0x734b('0xb')]);router[_0x734b('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x734b('0x7')]('/:id/messages',auth[_0x734b('0x8')](),controller[_0x734b('0xc')]);router[_0x734b('0x7')](_0x734b('0xd'),auth[_0x734b('0x8')](),controller[_0x734b('0xe')]);router[_0x734b('0xf')]('/',auth[_0x734b('0x8')](),controller[_0x734b('0x10')]);router[_0x734b('0xf')](_0x734b('0x11'),auth[_0x734b('0x8')](),controller[_0x734b('0x12')]);router[_0x734b('0xf')]('/:id/tags',auth[_0x734b('0x8')](),interaction[_0x734b('0x13')](_0x734b('0x14'),_0x734b('0x15')),controller[_0x734b('0x16')]);router[_0x734b('0x17')](_0x734b('0x18'),auth[_0x734b('0x8')](),interaction[_0x734b('0x13')](_0x734b('0x14'),_0x734b('0x19')),controller['update']);router[_0x734b('0x1a')](_0x734b('0x18'),auth[_0x734b('0x8')](),interaction[_0x734b('0x13')]('sms','smsinteraction:destroy'),controller[_0x734b('0x1b')]);router[_0x734b('0x1a')](_0x734b('0x1c'),auth[_0x734b('0x8')](),controller[_0x734b('0x1d')]);module[_0x734b('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index c05dcf4..45cafb6 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 _0xfa28=['exports','BOOLEAN','DATE','STRING','out','INTEGER','sequelize','moment'];(function(_0x3ac349,_0xd10e8a){var _0x3dd4be=function(_0x13fa14){while(--_0x13fa14){_0x3ac349['push'](_0x3ac349['shift']());}};_0x3dd4be(++_0xd10e8a);}(_0xfa28,0x1c6));var _0x8fa2=function(_0x111e94,_0x31c837){_0x111e94=_0x111e94-0x0;var _0x3de107=_0xfa28[_0x111e94];return _0x3de107;};'use strict';var Sequelize=require(_0x8fa2('0x0'));var moment=require(_0x8fa2('0x1'));module[_0x8fa2('0x2')]={'closed':{'type':Sequelize[_0x8fa2('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8fa2('0x4')]},'disposition':{'type':Sequelize[_0x8fa2('0x5')]},'secondDisposition':{'type':Sequelize[_0x8fa2('0x5')]},'thirdDisposition':{'type':Sequelize[_0x8fa2('0x5')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x8fa2('0x5')]},'read1stAt':{'type':Sequelize[_0x8fa2('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x8fa2('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x8fa2('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x8fa2('0x7')]}}; \ No newline at end of file +var _0xd6f9=['ENUM','BOOLEAN','sequelize','moment','DATE','STRING'];(function(_0x366e99,_0x15d82d){var _0x180bbe=function(_0x282498){while(--_0x282498){_0x366e99['push'](_0x366e99['shift']());}};_0x180bbe(++_0x15d82d);}(_0xd6f9,0x1ca));var _0x9d6f=function(_0x16de68,_0x33d7ff){_0x16de68=_0x16de68-0x0;var _0x1c277e=_0xd6f9[_0x16de68];return _0x1c277e;};'use strict';var Sequelize=require(_0x9d6f('0x0'));var moment=require(_0x9d6f('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9d6f('0x2')]},'disposition':{'type':Sequelize[_0x9d6f('0x3')]},'secondDisposition':{'type':Sequelize[_0x9d6f('0x3')]},'thirdDisposition':{'type':Sequelize[_0x9d6f('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x9d6f('0x3')]},'read1stAt':{'type':Sequelize[_0x9d6f('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x9d6f('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9d6f('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x9d6f('0x5')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 41fbf62..b96f18c 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 _0x6231=['moment','bluebird','path','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','register','sendStatus','status','end','json','offset','undefined','limit','count','set','update','then','destroy','name','send','index','map','rawAttributes','type','key','findAll','query','user','params','model','keys','SmsInteraction','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','body','describe','SmsMessage','addMessage','omit','ids','getMessages','findOne','nolimit','order','sort','where','pick','filter','$gte','rows','setTags','Tag','color','emit','smsInteractionTags:save','removeTags','download','unix','toString','join','server','tmp','transcript-%d-%s.zip','push','User','fullname','Contact','lastName','Messages','createdAt','secret','read','SmsAccount','Account','Owner','mkdirSync','Sms','N.A.','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','direction','out','System','firstName','value','renderFile','root','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf'];(function(_0x4da382,_0x4cfc5d){var _0x10073f=function(_0x32dc45){while(--_0x32dc45){_0x4da382['push'](_0x4da382['shift']());}};_0x10073f(++_0x4cfc5d);}(_0x6231,0xe5));var _0x1623=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6231[_0x2dafbe];return _0x58a45a;};'use strict';var rimraf=require(_0x1623('0x0'));var zipdir=require('zip-dir');var moment=require(_0x1623('0x1'));var BPromise=require(_0x1623('0x2'));var util=require('util');var path=require(_0x1623('0x3'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0x1623('0x4'));var interaction=require('../../components/interaction/service');var qs=require(_0x1623('0x5'));var pdf=require(_0x1623('0x6'));var logger=require(_0x1623('0x7'))(_0x1623('0x8'));var config=require(_0x1623('0x9'));var db=require(_0x1623('0xa'))['db'];config['redis']=_[_0x1623('0xb')](config[_0x1623('0xc')],{'host':_0x1623('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1623('0xc')]));require('./smsInteraction.socket')[_0x1623('0xe')](socket);function respondWithStatusCode(_0xd64818,_0x1d5373){_0x1d5373=_0x1d5373||0xcc;return function(_0x39534d){if(_0x39534d){return _0xd64818[_0x1623('0xf')](_0x1d5373);}return _0xd64818[_0x1623('0x10')](_0x1d5373)[_0x1623('0x11')]();};}function respondWithResult(_0x37e200,_0x44ef42){_0x44ef42=_0x44ef42||0xc8;return function(_0x4238f5){if(_0x4238f5){return _0x37e200[_0x1623('0x10')](_0x44ef42)[_0x1623('0x12')](_0x4238f5);}};}function respondWithFilteredResult(_0x243741,_0x1c8280){return function(_0x81c46){if(_0x81c46){var _0x3a12d4=typeof _0x1c8280[_0x1623('0x13')]===_0x1623('0x14')&&typeof _0x1c8280[_0x1623('0x15')]===_0x1623('0x14');var _0x23a484=_0x81c46[_0x1623('0x16')];var _0x2988f4=_0x3a12d4?0x0:_0x1c8280['offset'];var _0xab750c=_0x3a12d4?_0x81c46[_0x1623('0x16')]:_0x1c8280[_0x1623('0x13')]+_0x1c8280[_0x1623('0x15')];var _0x22f293;if(_0xab750c>=_0x23a484){_0xab750c=_0x23a484;_0x22f293=0xc8;}else{_0x22f293=0xce;}_0x243741[_0x1623('0x10')](_0x22f293);return _0x243741[_0x1623('0x17')]('Content-Range',_0x2988f4+'-'+_0xab750c+'/'+_0x23a484)['json'](_0x81c46);}return null;};}function saveUpdates(_0x5290ef){return function(_0xde0453){if(_0xde0453){return _0xde0453[_0x1623('0x18')](_0x5290ef)[_0x1623('0x19')](function(_0xbbf1f4){return _0xbbf1f4;});}return null;};}function removeEntity(_0x1e2be4){return function(_0x493205){if(_0x493205){return _0x493205[_0x1623('0x1a')]()[_0x1623('0x19')](function(){_0x1e2be4[_0x1623('0x10')](0xcc)[_0x1623('0x11')]();});}};}function handleEntityNotFound(_0x42b39c){return function(_0x133ff8){if(!_0x133ff8){_0x42b39c[_0x1623('0xf')](0x194);}return _0x133ff8;};}function handleError(_0x15ca48,_0x334134){_0x334134=_0x334134||0x1f4;return function(_0x3aa5cb){logger['error'](_0x3aa5cb['stack']);if(_0x3aa5cb[_0x1623('0x1b')]){delete _0x3aa5cb[_0x1623('0x1b')];}_0x15ca48[_0x1623('0x10')](_0x334134)[_0x1623('0x1c')](_0x3aa5cb);};}exports[_0x1623('0x1d')]=function(_0x208ed8,_0x6b5ab5){var _0x250ddc={};var _0x47b4da=_[_0x1623('0x1e')](db['SmsInteraction'][_0x1623('0x1f')],function(_0x44eb3c){return{'name':_0x44eb3c['fieldName'],'type':_0x44eb3c[_0x1623('0x20')][_0x1623('0x21')]};});_0x250ddc=qs['getOptions'](_0x47b4da,_0x208ed8);return interaction[_0x1623('0x22')]('sms',_0x208ed8[_0x1623('0x23')],_0x208ed8[_0x1623('0x24')],_0x250ddc,_0x47b4da)[_0x1623('0x19')](respondWithFilteredResult(_0x6b5ab5,_0x250ddc))['catch'](handleError(_0x6b5ab5,null));};exports['show']=function(_0x864af0,_0x38a9ec){var _0x17c356={'raw':![],'where':{'id':_0x864af0[_0x1623('0x25')]['id']}},_0x2affb9={};_0x2affb9[_0x1623('0x26')]=_[_0x1623('0x27')](db[_0x1623('0x28')][_0x1623('0x1f')]);_0x2affb9['query']=_[_0x1623('0x27')](_0x864af0['query']);_0x2affb9[_0x1623('0x29')]=_[_0x1623('0x2a')](_0x2affb9[_0x1623('0x26')],_0x2affb9['query']);_0x17c356[_0x1623('0x2b')]=_[_0x1623('0x2a')](_0x2affb9[_0x1623('0x26')],qs[_0x1623('0x2c')](_0x864af0[_0x1623('0x23')]['fields']));_0x17c356[_0x1623('0x2b')]=_0x17c356[_0x1623('0x2b')][_0x1623('0x2d')]?_0x17c356[_0x1623('0x2b')]:_0x2affb9[_0x1623('0x26')];if(_0x864af0[_0x1623('0x23')][_0x1623('0x2e')]){_0x17c356[_0x1623('0x2f')]=[{'all':!![]}];}_0x17c356=_[_0x1623('0x30')]({},_0x17c356,_0x864af0[_0x1623('0x31')]);return db[_0x1623('0x28')][_0x1623('0x32')](_0x17c356)['then'](handleEntityNotFound(_0x38a9ec,null))['then'](respondWithResult(_0x38a9ec,null))[_0x1623('0x33')](handleError(_0x38a9ec,null));};exports['create']=function(_0x1323fe,_0xb3fc03){return db[_0x1623('0x28')]['create'](_0x1323fe[_0x1623('0x34')],{})[_0x1623('0x19')](respondWithResult(_0xb3fc03,0xc9))[_0x1623('0x33')](handleError(_0xb3fc03,null));};exports[_0x1623('0x18')]=function(_0x455601,_0xfa05b1){if(_0x455601[_0x1623('0x34')]['id']){delete _0x455601[_0x1623('0x34')]['id'];}return db['SmsInteraction'][_0x1623('0x32')]({'where':{'id':_0x455601[_0x1623('0x25')]['id']}})[_0x1623('0x19')](handleEntityNotFound(_0xfa05b1,null))[_0x1623('0x19')](saveUpdates(_0x455601[_0x1623('0x34')],null))['then'](respondWithResult(_0xfa05b1,null))['catch'](handleError(_0xfa05b1,null));};exports[_0x1623('0x1a')]=function(_0x5a78fe,_0x4e30a9){return db[_0x1623('0x28')][_0x1623('0x32')]({'where':{'id':_0x5a78fe['params']['id']}})['then'](handleEntityNotFound(_0x4e30a9,null))[_0x1623('0x19')](removeEntity(_0x4e30a9,null))[_0x1623('0x33')](handleError(_0x4e30a9,null));};exports[_0x1623('0x35')]=function(_0x282a5c,_0x29a58f){return db['SmsInteraction'][_0x1623('0x35')]()[_0x1623('0x19')](respondWithResult(_0x29a58f,null))['catch'](handleError(_0x29a58f,null));};exports['addMessage']=function(_0x4cc404,_0x53245d){return db[_0x1623('0x36')][_0x1623('0x32')]({'where':{'id':_0x4cc404[_0x1623('0x25')]['id']}})['then'](handleEntityNotFound(_0x53245d,null))[_0x1623('0x19')](function(_0x12e67b){if(_0x12e67b){return _0x12e67b[_0x1623('0x37')](_0x4cc404[_0x1623('0x34')]['ids'],_[_0x1623('0x38')](_0x4cc404[_0x1623('0x34')],[_0x1623('0x39'),'id'])||{});}})[_0x1623('0x19')](respondWithResult(_0x53245d,null))['catch'](handleError(_0x53245d,null));};exports[_0x1623('0x3a')]=function(_0x43f055,_0x495821){var _0x15b55c={'raw':![],'where':{}};var _0x569fc2={};var _0x1c2ae2={'count':0x0,'rows':[]};return db[_0x1623('0x28')][_0x1623('0x3b')]({'where':{'id':_0x43f055[_0x1623('0x25')]['id']}})[_0x1623('0x19')](handleEntityNotFound(_0x495821,null))['then'](function(_0xdda1e0){if(_0xdda1e0){_0x569fc2['model']=_[_0x1623('0x27')](db[_0x1623('0x36')][_0x1623('0x1f')]);_0x569fc2[_0x1623('0x23')]=_[_0x1623('0x27')](_0x43f055['query']);_0x569fc2[_0x1623('0x29')]=_[_0x1623('0x2a')](_0x569fc2[_0x1623('0x26')],_0x569fc2[_0x1623('0x23')]);_0x15b55c['attributes']=_[_0x1623('0x2a')](_0x569fc2[_0x1623('0x26')],qs[_0x1623('0x2c')](_0x43f055[_0x1623('0x23')]['fields']));_0x15b55c[_0x1623('0x2b')]=_0x15b55c[_0x1623('0x2b')]['length']?_0x15b55c[_0x1623('0x2b')]:_0x569fc2[_0x1623('0x26')];if(!_0x43f055[_0x1623('0x23')]['hasOwnProperty'](_0x1623('0x3c'))){_0x15b55c[_0x1623('0x15')]=qs[_0x1623('0x15')](_0x43f055[_0x1623('0x23')][_0x1623('0x15')]);_0x15b55c[_0x1623('0x13')]=qs[_0x1623('0x13')](_0x43f055[_0x1623('0x23')][_0x1623('0x13')]);}_0x15b55c[_0x1623('0x3d')]=qs[_0x1623('0x3e')](_0x43f055['query'][_0x1623('0x3e')]);_0x15b55c[_0x1623('0x3f')]=qs['filters'](_[_0x1623('0x40')](_0x43f055[_0x1623('0x23')],_0x569fc2['filters']));_0x15b55c[_0x1623('0x3f')]['SmsInteractionId']=_0xdda1e0['id'];if(_0x43f055[_0x1623('0x23')][_0x1623('0x41')]){_0x15b55c[_0x1623('0x3f')]=_['merge'](_0x15b55c[_0x1623('0x3f')],{'$or':_[_0x1623('0x1e')](_0x15b55c['attributes'],function(_0x1a0067){var _0x1f9ebf={};_0x1f9ebf[_0x1a0067]={'$like':'%'+_0x43f055[_0x1623('0x23')][_0x1623('0x41')]+'%'};return _0x1f9ebf;})});}if(_0x43f055[_0x1623('0x23')][_0x1623('0x42')]){var _0x3db4ab=_0x43f055[_0x1623('0x23')][_0x1623('0x42')]['split'](',');var _0x24f668={};_0x24f668[_0x3db4ab[0x0]]={'$gte':moment(_0x3db4ab[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x15b55c[_0x1623('0x3f')]=_[_0x1623('0x30')](_0x15b55c['where'],_0x24f668);}_0x15b55c=_['merge']({},_0x15b55c,_0x43f055[_0x1623('0x31')]);return db[_0x1623('0x36')][_0x1623('0x16')]({'where':_0x15b55c[_0x1623('0x3f')]})[_0x1623('0x19')](function(_0x414957){_0x1c2ae2[_0x1623('0x16')]=_0x414957;if(_0x43f055[_0x1623('0x23')]['includeAll']){_0x15b55c[_0x1623('0x2f')]=[{'all':!![]}];}return db[_0x1623('0x36')][_0x1623('0x22')](_0x15b55c);})[_0x1623('0x19')](function(_0x13e73c){_0x1c2ae2[_0x1623('0x43')]=_0x13e73c;return _0x1c2ae2;});}})[_0x1623('0x19')](respondWithFilteredResult(_0x495821,_0x15b55c))['catch'](handleError(_0x495821,null));};exports['addTags']=function(_0x564dd5,_0x3c2fc6){return db[_0x1623('0x28')]['find']({'where':{'id':_0x564dd5['params']['id']}})[_0x1623('0x19')](handleEntityNotFound(_0x3c2fc6,null))[_0x1623('0x19')](function(_0xd43e7b){if(_0xd43e7b){return _0xd43e7b[_0x1623('0x44')](_0x564dd5[_0x1623('0x34')]['ids'],_['omit'](_0x564dd5[_0x1623('0x34')],[_0x1623('0x39'),'id'])||{})['spread'](function(){return db[_0x1623('0x45')][_0x1623('0x22')]({'attributes':['id',_0x1623('0x1b'),_0x1623('0x46')],'where':{'id':_0x564dd5[_0x1623('0x34')][_0x1623('0x39')]}});})[_0x1623('0x19')](function(_0x22892b){socket[_0x1623('0x47')](_0x1623('0x48'),{'id':Number(_0x564dd5[_0x1623('0x25')]['id']),'tags':_0x22892b||[]});return{'id':Number(_0x564dd5[_0x1623('0x25')]['id']),'tags':_0x22892b||[]};});}})[_0x1623('0x19')](respondWithResult(_0x3c2fc6,null))['catch'](handleError(_0x3c2fc6,null));};exports[_0x1623('0x49')]=function(_0x5bba2f,_0x2aa472){return db[_0x1623('0x28')]['find']({'where':{'id':_0x5bba2f['params']['id']}})[_0x1623('0x19')](handleEntityNotFound(_0x2aa472,null))['then'](function(_0x341870){if(_0x341870){return _0x341870[_0x1623('0x49')](_0x5bba2f[_0x1623('0x23')][_0x1623('0x39')]);}})['then'](respondWithStatusCode(_0x2aa472,null))[_0x1623('0x33')](handleError(_0x2aa472,null));};exports[_0x1623('0x4a')]=function(_0x230f14,_0xaab896){var _0x398f9b=moment()[_0x1623('0x4b')]()[_0x1623('0x4c')]();var _0x439c5f=path[_0x1623('0x4d')](config['root'],_0x1623('0x4e'),'files',_0x1623('0x4f'));var _0x1cc693=path[_0x1623('0x4d')](_0x439c5f,_0x398f9b);var _0x18d623=util['format'](_0x1623('0x50'),_0x230f14[_0x1623('0x25')]['id'],_0x398f9b);var _0x59bd97=path[_0x1623('0x4d')](_0x439c5f,_0x18d623);var _0x1d3b24=[];_0x1d3b24[_0x1623('0x51')]({'model':db[_0x1623('0x52')],'as':_0x1623('0x52'),'attributes':['id',_0x1623('0x53')],'raw':!![]});_0x1d3b24['push']({'model':db['CmContact'],'as':_0x1623('0x54'),'attributes':['id','firstName',_0x1623('0x55')],'raw':!![]});var _0x146135=[{'model':db['SmsMessage'],'as':_0x1623('0x56'),'attributes':['id',_0x1623('0x34'),_0x1623('0x57'),'direction',_0x1623('0x58'),_0x1623('0x59')],'include':_0x1d3b24}];_0x146135[_0x1623('0x51')]({'model':db[_0x1623('0x5a')],'as':_0x1623('0x5b'),'attributes':['id',_0x1623('0x1b')]});_0x146135[_0x1623('0x51')]({'model':db['User'],'as':_0x1623('0x5c'),'attributes':['id','fullname']});return db['SmsInteraction'][_0x1623('0x32')]({'where':{'id':_0x230f14['params']['id']},'include':_0x146135})[_0x1623('0x19')](handleEntityNotFound(_0xaab896,null))[_0x1623('0x19')](function(_0x445d50){if(_0x445d50){var _0x50f09a=_0x445d50['get']({'plain':!![]});fs[_0x1623('0x5d')](_0x1cc693);var _0x4c2259={'channel':_0x1623('0x5e'),'account':_0x50f09a[_0x1623('0x5b')]['name'],'agent':_0x50f09a[_0x1623('0x5c')]?_0x50f09a[_0x1623('0x5c')][_0x1623('0x53')]:_0x1623('0x5f'),'createdAt':moment(_0x50f09a[_0x1623('0x57')])[_0x1623('0x60')](_0x1623('0x61'))[_0x1623('0x4c')](),'closedAt':_0x50f09a[_0x1623('0x62')]?moment(_0x50f09a[_0x1623('0x63')])[_0x1623('0x60')](_0x1623('0x61'))[_0x1623('0x4c')]():'','disposition':_0x50f09a['disposition'],'messages':_(_0x50f09a[_0x1623('0x56')])['filter']({'secret':![]})['map'](function(_0x111c32){return{'date':moment(_0x111c32[_0x1623('0x57')])['format'](_0x1623('0x61'))['toString'](),'sender':_0x111c32[_0x1623('0x64')]===_0x1623('0x65')?_0x111c32[_0x1623('0x52')]?_0x111c32['User'][_0x1623('0x53')]:_0x1623('0x66'):_0x111c32[_0x1623('0x54')][_0x1623('0x67')]+(_0x111c32[_0x1623('0x54')]['lastName']?'\x20'+_0x111c32['Contact'][_0x1623('0x55')]:''),'body':_0x111c32[_0x1623('0x34')],'direction':_0x111c32[_0x1623('0x64')]===_0x1623('0x65')?'A':'C','secret':_0x111c32[_0x1623('0x58')],'read':_0x111c32[_0x1623('0x59')]};})[_0x1623('0x68')]()};return ejs[_0x1623('0x69')](path['join'](config[_0x1623('0x6a')],_0x1623('0x4e'),_0x1623('0x6b'),_0x1623('0x6c')),{'interaction':_0x4c2259})[_0x1623('0x19')](function(_0xa4c0e){var _0x34c219=path['join'](_0x1cc693,_0x1623('0x6d')+_0x50f09a['id']+'-'+_0x398f9b+_0x1623('0x6e'));var _0x3a492d={'path':_0x34c219,'channel':'Sms','interactionId':_0x50f09a['id']};return pdf[_0x1623('0x6f')](_0xa4c0e,_0x3a492d);})['then'](function(){return new BPromise(function(_0x2371b0,_0x8ab3fb){zipdir(_0x1cc693,{'saveTo':_0x59bd97},function(_0x3c5d8a,_0x50e84d){if(_0x3c5d8a)return _0x8ab3fb(_0x3c5d8a);return _0x2371b0(_0x50e84d);});})['then'](function(){return new BPromise(function(_0x20d47a,_0x2327c4){rimraf(_0x1cc693,function(_0x5689e3){if(_0x5689e3)_0x2327c4(_0x5689e3);return _0x20d47a();});});})[_0x1623('0x19')](function(){return _0xaab896['download'](_0x59bd97,_0x18d623,function(_0x268933){if(_0x268933){console[_0x1623('0x70')](_0x1623('0x71'),_0x268933);}else{fs[_0x1623('0x72')](_0x59bd97);}});});});}else{return _0xaab896[_0x1623('0xf')](0xc8);}})['catch'](handleError(_0xaab896,null));}; \ No newline at end of file +var _0xfe73=['merge','options','find','create','body','describe','addMessage','SmsMessage','ids','omit','findOne','rawAttributes','filters','nolimit','order','sort','where','pick','SmsInteractionId','split','format','YYYY-MM-DD\x20HH:mm:ss','include','rows','addTags','setTags','spread','Tag','color','emit','smsInteractionTags:save','removeTags','download','toString','join','root','files','tmp','transcript-%d-%s.zip','User','fullname','push','CmContact','Contact','firstName','lastName','Messages','direction','read','SmsAccount','Owner','get','N.A.','createdAt','closed','closedAt','out','System','secret','value','renderFile','server','views','downloadInteraction.ejs','.pdf','Sms','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','moment','bluebird','ejs','lodash','../../components/parsers/qs','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','SmsInteraction','fieldName','getOptions','findAll','sms','query','user','catch','params','model','keys','intersection','attributes','fields','length','includeAll'];(function(_0x4ed32d,_0x327695){var _0xf624df=function(_0x29518c){while(--_0x29518c){_0x4ed32d['push'](_0x4ed32d['shift']());}};_0xf624df(++_0x327695);}(_0xfe73,0x12f));var _0x3fe7=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0xfe73[_0x31a371];return _0x2a5bd6;};'use strict';var rimraf=require(_0x3fe7('0x0'));var zipdir=require(_0x3fe7('0x1'));var moment=require(_0x3fe7('0x2'));var BPromise=require(_0x3fe7('0x3'));var util=require('util');var path=require('path');var ejs=require(_0x3fe7('0x4'));var fs=require('fs');var _=require(_0x3fe7('0x5'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0x3fe7('0x6'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0x3fe7('0x7'))['db'];config['redis']=_[_0x3fe7('0x8')](config[_0x3fe7('0x9')],{'host':_0x3fe7('0xa'),'port':0x18eb});var socket=require(_0x3fe7('0xb'))(new Redis(config[_0x3fe7('0x9')]));require('./smsInteraction.socket')[_0x3fe7('0xc')](socket);function respondWithStatusCode(_0x5edc48,_0x5b3f66){_0x5b3f66=_0x5b3f66||0xcc;return function(_0x351a8a){if(_0x351a8a){return _0x5edc48[_0x3fe7('0xd')](_0x5b3f66);}return _0x5edc48[_0x3fe7('0xe')](_0x5b3f66)[_0x3fe7('0xf')]();};}function respondWithResult(_0x346f2c,_0x39ab0f){_0x39ab0f=_0x39ab0f||0xc8;return function(_0x3dddaa){if(_0x3dddaa){return _0x346f2c['status'](_0x39ab0f)[_0x3fe7('0x10')](_0x3dddaa);}};}function respondWithFilteredResult(_0x5ed9a1,_0x9f3d5b){return function(_0xd792a5){if(_0xd792a5){var _0x309260=typeof _0x9f3d5b[_0x3fe7('0x11')]==='undefined'&&typeof _0x9f3d5b[_0x3fe7('0x12')]===_0x3fe7('0x13');var _0x1e6f0b=_0xd792a5[_0x3fe7('0x14')];var _0x2e8076=_0x309260?0x0:_0x9f3d5b[_0x3fe7('0x11')];var _0xe1c88a=_0x309260?_0xd792a5[_0x3fe7('0x14')]:_0x9f3d5b[_0x3fe7('0x11')]+_0x9f3d5b[_0x3fe7('0x12')];var _0x489913;if(_0xe1c88a>=_0x1e6f0b){_0xe1c88a=_0x1e6f0b;_0x489913=0xc8;}else{_0x489913=0xce;}_0x5ed9a1[_0x3fe7('0xe')](_0x489913);return _0x5ed9a1[_0x3fe7('0x15')](_0x3fe7('0x16'),_0x2e8076+'-'+_0xe1c88a+'/'+_0x1e6f0b)['json'](_0xd792a5);}return null;};}function saveUpdates(_0x41711e){return function(_0xae37d3){if(_0xae37d3){return _0xae37d3[_0x3fe7('0x17')](_0x41711e)[_0x3fe7('0x18')](function(_0x4d98f7){return _0x4d98f7;});}return null;};}function removeEntity(_0x550c84){return function(_0xc7d300){if(_0xc7d300){return _0xc7d300[_0x3fe7('0x19')]()[_0x3fe7('0x18')](function(){_0x550c84['status'](0xcc)[_0x3fe7('0xf')]();});}};}function handleEntityNotFound(_0x1067d1){return function(_0x46021c){if(!_0x46021c){_0x1067d1['sendStatus'](0x194);}return _0x46021c;};}function handleError(_0x57d937,_0x133dcf){_0x133dcf=_0x133dcf||0x1f4;return function(_0x3ad457){logger[_0x3fe7('0x1a')](_0x3ad457[_0x3fe7('0x1b')]);if(_0x3ad457[_0x3fe7('0x1c')]){delete _0x3ad457[_0x3fe7('0x1c')];}_0x57d937[_0x3fe7('0xe')](_0x133dcf)[_0x3fe7('0x1d')](_0x3ad457);};}exports[_0x3fe7('0x1e')]=function(_0x55142e,_0x57958e){var _0x24f9f7={};var _0x423132=_[_0x3fe7('0x1f')](db[_0x3fe7('0x20')]['rawAttributes'],function(_0x37f6d){return{'name':_0x37f6d[_0x3fe7('0x21')],'type':_0x37f6d['type']['key']};});_0x24f9f7=qs[_0x3fe7('0x22')](_0x423132,_0x55142e);return interaction[_0x3fe7('0x23')](_0x3fe7('0x24'),_0x55142e[_0x3fe7('0x25')],_0x55142e[_0x3fe7('0x26')],_0x24f9f7,_0x423132)[_0x3fe7('0x18')](respondWithFilteredResult(_0x57958e,_0x24f9f7))[_0x3fe7('0x27')](handleError(_0x57958e,null));};exports['show']=function(_0x1f574d,_0xeceebe){var _0x5179ac={'raw':![],'where':{'id':_0x1f574d[_0x3fe7('0x28')]['id']}},_0x3cfa7c={};_0x3cfa7c[_0x3fe7('0x29')]=_[_0x3fe7('0x2a')](db[_0x3fe7('0x20')]['rawAttributes']);_0x3cfa7c[_0x3fe7('0x25')]=_[_0x3fe7('0x2a')](_0x1f574d[_0x3fe7('0x25')]);_0x3cfa7c['filters']=_[_0x3fe7('0x2b')](_0x3cfa7c[_0x3fe7('0x29')],_0x3cfa7c[_0x3fe7('0x25')]);_0x5179ac[_0x3fe7('0x2c')]=_[_0x3fe7('0x2b')](_0x3cfa7c['model'],qs[_0x3fe7('0x2d')](_0x1f574d[_0x3fe7('0x25')][_0x3fe7('0x2d')]));_0x5179ac[_0x3fe7('0x2c')]=_0x5179ac[_0x3fe7('0x2c')][_0x3fe7('0x2e')]?_0x5179ac[_0x3fe7('0x2c')]:_0x3cfa7c['model'];if(_0x1f574d['query'][_0x3fe7('0x2f')]){_0x5179ac['include']=[{'all':!![]}];}_0x5179ac=_[_0x3fe7('0x30')]({},_0x5179ac,_0x1f574d[_0x3fe7('0x31')]);return db[_0x3fe7('0x20')][_0x3fe7('0x32')](_0x5179ac)['then'](handleEntityNotFound(_0xeceebe,null))[_0x3fe7('0x18')](respondWithResult(_0xeceebe,null))[_0x3fe7('0x27')](handleError(_0xeceebe,null));};exports[_0x3fe7('0x33')]=function(_0x16b16b,_0x5c12b0){return db[_0x3fe7('0x20')]['create'](_0x16b16b[_0x3fe7('0x34')],{})[_0x3fe7('0x18')](respondWithResult(_0x5c12b0,0xc9))[_0x3fe7('0x27')](handleError(_0x5c12b0,null));};exports['update']=function(_0xe76e85,_0x5b5e21){if(_0xe76e85[_0x3fe7('0x34')]['id']){delete _0xe76e85[_0x3fe7('0x34')]['id'];}return db[_0x3fe7('0x20')][_0x3fe7('0x32')]({'where':{'id':_0xe76e85['params']['id']}})[_0x3fe7('0x18')](handleEntityNotFound(_0x5b5e21,null))['then'](saveUpdates(_0xe76e85['body'],null))[_0x3fe7('0x18')](respondWithResult(_0x5b5e21,null))[_0x3fe7('0x27')](handleError(_0x5b5e21,null));};exports[_0x3fe7('0x19')]=function(_0x19768d,_0x6d7a3c){return db[_0x3fe7('0x20')][_0x3fe7('0x32')]({'where':{'id':_0x19768d['params']['id']}})[_0x3fe7('0x18')](handleEntityNotFound(_0x6d7a3c,null))[_0x3fe7('0x18')](removeEntity(_0x6d7a3c,null))['catch'](handleError(_0x6d7a3c,null));};exports[_0x3fe7('0x35')]=function(_0x2fbd8d,_0x358123){return db[_0x3fe7('0x20')][_0x3fe7('0x35')]()['then'](respondWithResult(_0x358123,null))[_0x3fe7('0x27')](handleError(_0x358123,null));};exports[_0x3fe7('0x36')]=function(_0x21ac64,_0x58124f){return db[_0x3fe7('0x37')][_0x3fe7('0x32')]({'where':{'id':_0x21ac64['params']['id']}})[_0x3fe7('0x18')](handleEntityNotFound(_0x58124f,null))[_0x3fe7('0x18')](function(_0x2ea61b){if(_0x2ea61b){return _0x2ea61b[_0x3fe7('0x36')](_0x21ac64['body'][_0x3fe7('0x38')],_[_0x3fe7('0x39')](_0x21ac64[_0x3fe7('0x34')],['ids','id'])||{});}})['then'](respondWithResult(_0x58124f,null))[_0x3fe7('0x27')](handleError(_0x58124f,null));};exports['getMessages']=function(_0x185ee4,_0x4e014d){var _0x43952f={'raw':![],'where':{}};var _0x216430={};var _0x26143a={'count':0x0,'rows':[]};return db[_0x3fe7('0x20')][_0x3fe7('0x3a')]({'where':{'id':_0x185ee4['params']['id']}})[_0x3fe7('0x18')](handleEntityNotFound(_0x4e014d,null))[_0x3fe7('0x18')](function(_0x63c351){if(_0x63c351){_0x216430[_0x3fe7('0x29')]=_[_0x3fe7('0x2a')](db[_0x3fe7('0x37')][_0x3fe7('0x3b')]);_0x216430['query']=_['keys'](_0x185ee4[_0x3fe7('0x25')]);_0x216430[_0x3fe7('0x3c')]=_['intersection'](_0x216430[_0x3fe7('0x29')],_0x216430['query']);_0x43952f[_0x3fe7('0x2c')]=_[_0x3fe7('0x2b')](_0x216430[_0x3fe7('0x29')],qs['fields'](_0x185ee4['query'][_0x3fe7('0x2d')]));_0x43952f['attributes']=_0x43952f[_0x3fe7('0x2c')][_0x3fe7('0x2e')]?_0x43952f[_0x3fe7('0x2c')]:_0x216430[_0x3fe7('0x29')];if(!_0x185ee4[_0x3fe7('0x25')]['hasOwnProperty'](_0x3fe7('0x3d'))){_0x43952f[_0x3fe7('0x12')]=qs[_0x3fe7('0x12')](_0x185ee4[_0x3fe7('0x25')][_0x3fe7('0x12')]);_0x43952f[_0x3fe7('0x11')]=qs[_0x3fe7('0x11')](_0x185ee4[_0x3fe7('0x25')][_0x3fe7('0x11')]);}_0x43952f[_0x3fe7('0x3e')]=qs[_0x3fe7('0x3f')](_0x185ee4['query']['sort']);_0x43952f[_0x3fe7('0x40')]=qs[_0x3fe7('0x3c')](_[_0x3fe7('0x41')](_0x185ee4[_0x3fe7('0x25')],_0x216430[_0x3fe7('0x3c')]));_0x43952f[_0x3fe7('0x40')][_0x3fe7('0x42')]=_0x63c351['id'];if(_0x185ee4[_0x3fe7('0x25')]['filter']){_0x43952f[_0x3fe7('0x40')]=_[_0x3fe7('0x30')](_0x43952f[_0x3fe7('0x40')],{'$or':_[_0x3fe7('0x1f')](_0x43952f[_0x3fe7('0x2c')],function(_0x405579){var _0x1e36e8={};_0x1e36e8[_0x405579]={'$like':'%'+_0x185ee4[_0x3fe7('0x25')]['filter']+'%'};return _0x1e36e8;})});}if(_0x185ee4[_0x3fe7('0x25')]['$gte']){var _0x12ee8f=_0x185ee4[_0x3fe7('0x25')]['$gte'][_0x3fe7('0x43')](',');var _0x25b8b0={};_0x25b8b0[_0x12ee8f[0x0]]={'$gte':moment(_0x12ee8f[0x1])[_0x3fe7('0x44')](_0x3fe7('0x45'))};_0x43952f[_0x3fe7('0x40')]=_[_0x3fe7('0x30')](_0x43952f[_0x3fe7('0x40')],_0x25b8b0);}_0x43952f=_[_0x3fe7('0x30')]({},_0x43952f,_0x185ee4['options']);return db[_0x3fe7('0x37')][_0x3fe7('0x14')]({'where':_0x43952f[_0x3fe7('0x40')]})[_0x3fe7('0x18')](function(_0xce7e26){_0x26143a['count']=_0xce7e26;if(_0x185ee4['query']['includeAll']){_0x43952f[_0x3fe7('0x46')]=[{'all':!![]}];}return db[_0x3fe7('0x37')]['findAll'](_0x43952f);})[_0x3fe7('0x18')](function(_0x58c934){_0x26143a[_0x3fe7('0x47')]=_0x58c934;return _0x26143a;});}})[_0x3fe7('0x18')](respondWithFilteredResult(_0x4e014d,_0x43952f))[_0x3fe7('0x27')](handleError(_0x4e014d,null));};exports[_0x3fe7('0x48')]=function(_0x32cfcf,_0x21c054){return db['SmsInteraction'][_0x3fe7('0x32')]({'where':{'id':_0x32cfcf[_0x3fe7('0x28')]['id']}})[_0x3fe7('0x18')](handleEntityNotFound(_0x21c054,null))['then'](function(_0x5018ad){if(_0x5018ad){return _0x5018ad[_0x3fe7('0x49')](_0x32cfcf[_0x3fe7('0x34')]['ids'],_[_0x3fe7('0x39')](_0x32cfcf[_0x3fe7('0x34')],[_0x3fe7('0x38'),'id'])||{})[_0x3fe7('0x4a')](function(){return db[_0x3fe7('0x4b')]['findAll']({'attributes':['id',_0x3fe7('0x1c'),_0x3fe7('0x4c')],'where':{'id':_0x32cfcf[_0x3fe7('0x34')][_0x3fe7('0x38')]}});})[_0x3fe7('0x18')](function(_0x5c11d8){socket[_0x3fe7('0x4d')](_0x3fe7('0x4e'),{'id':Number(_0x32cfcf[_0x3fe7('0x28')]['id']),'tags':_0x5c11d8||[]});return{'id':Number(_0x32cfcf[_0x3fe7('0x28')]['id']),'tags':_0x5c11d8||[]};});}})[_0x3fe7('0x18')](respondWithResult(_0x21c054,null))[_0x3fe7('0x27')](handleError(_0x21c054,null));};exports[_0x3fe7('0x4f')]=function(_0x151374,_0x5a6b71){return db[_0x3fe7('0x20')]['find']({'where':{'id':_0x151374[_0x3fe7('0x28')]['id']}})[_0x3fe7('0x18')](handleEntityNotFound(_0x5a6b71,null))[_0x3fe7('0x18')](function(_0x33170f){if(_0x33170f){return _0x33170f[_0x3fe7('0x4f')](_0x151374['query'][_0x3fe7('0x38')]);}})['then'](respondWithStatusCode(_0x5a6b71,null))['catch'](handleError(_0x5a6b71,null));};exports[_0x3fe7('0x50')]=function(_0x5c9e8d,_0x41494c){var _0x22316f=moment()['unix']()[_0x3fe7('0x51')]();var _0x194f94=path[_0x3fe7('0x52')](config[_0x3fe7('0x53')],'server',_0x3fe7('0x54'),_0x3fe7('0x55'));var _0x4f279c=path[_0x3fe7('0x52')](_0x194f94,_0x22316f);var _0x447667=util[_0x3fe7('0x44')](_0x3fe7('0x56'),_0x5c9e8d['params']['id'],_0x22316f);var _0xf00999=path[_0x3fe7('0x52')](_0x194f94,_0x447667);var _0x4c2072=[];_0x4c2072['push']({'model':db[_0x3fe7('0x57')],'as':_0x3fe7('0x57'),'attributes':['id',_0x3fe7('0x58')],'raw':!![]});_0x4c2072[_0x3fe7('0x59')]({'model':db[_0x3fe7('0x5a')],'as':_0x3fe7('0x5b'),'attributes':['id',_0x3fe7('0x5c'),_0x3fe7('0x5d')],'raw':!![]});var _0x738c9b=[{'model':db[_0x3fe7('0x37')],'as':_0x3fe7('0x5e'),'attributes':['id',_0x3fe7('0x34'),'createdAt',_0x3fe7('0x5f'),'secret',_0x3fe7('0x60')],'include':_0x4c2072}];_0x738c9b[_0x3fe7('0x59')]({'model':db[_0x3fe7('0x61')],'as':'Account','attributes':['id',_0x3fe7('0x1c')]});_0x738c9b[_0x3fe7('0x59')]({'model':db[_0x3fe7('0x57')],'as':_0x3fe7('0x62'),'attributes':['id',_0x3fe7('0x58')]});return db[_0x3fe7('0x20')]['find']({'where':{'id':_0x5c9e8d['params']['id']},'include':_0x738c9b})['then'](handleEntityNotFound(_0x41494c,null))[_0x3fe7('0x18')](function(_0x8025b6){if(_0x8025b6){var _0x40e396=_0x8025b6[_0x3fe7('0x63')]({'plain':!![]});fs['mkdirSync'](_0x4f279c);var _0x267440={'channel':'Sms','account':_0x40e396['Account']['name'],'agent':_0x40e396[_0x3fe7('0x62')]?_0x40e396[_0x3fe7('0x62')][_0x3fe7('0x58')]:_0x3fe7('0x64'),'createdAt':moment(_0x40e396[_0x3fe7('0x65')])[_0x3fe7('0x44')](_0x3fe7('0x45'))['toString'](),'closedAt':_0x40e396[_0x3fe7('0x66')]?moment(_0x40e396[_0x3fe7('0x67')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x3fe7('0x51')]():'','disposition':_0x40e396['disposition'],'messages':_(_0x40e396[_0x3fe7('0x5e')])['filter']({'secret':![]})[_0x3fe7('0x1f')](function(_0x575711){return{'date':moment(_0x575711['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x575711['direction']===_0x3fe7('0x68')?_0x575711['User']?_0x575711[_0x3fe7('0x57')]['fullname']:_0x3fe7('0x69'):_0x575711['Contact'][_0x3fe7('0x5c')]+(_0x575711[_0x3fe7('0x5b')]['lastName']?'\x20'+_0x575711[_0x3fe7('0x5b')][_0x3fe7('0x5d')]:''),'body':_0x575711[_0x3fe7('0x34')],'direction':_0x575711[_0x3fe7('0x5f')]===_0x3fe7('0x68')?'A':'C','secret':_0x575711[_0x3fe7('0x6a')],'read':_0x575711[_0x3fe7('0x60')]};})[_0x3fe7('0x6b')]()};return ejs[_0x3fe7('0x6c')](path[_0x3fe7('0x52')](config[_0x3fe7('0x53')],_0x3fe7('0x6d'),_0x3fe7('0x6e'),_0x3fe7('0x6f')),{'interaction':_0x267440})[_0x3fe7('0x18')](function(_0x209bae){var _0x305c03=path[_0x3fe7('0x52')](_0x4f279c,'transcript-'+_0x40e396['id']+'-'+_0x22316f+_0x3fe7('0x70'));var _0x3b1da4={'path':_0x305c03,'channel':_0x3fe7('0x71'),'interactionId':_0x40e396['id']};return pdf[_0x3fe7('0x72')](_0x209bae,_0x3b1da4);})['then'](function(){return new BPromise(function(_0x9aab07,_0x42a21a){zipdir(_0x4f279c,{'saveTo':_0xf00999},function(_0xf6c15,_0x200b42){if(_0xf6c15)return _0x42a21a(_0xf6c15);return _0x9aab07(_0x200b42);});})['then'](function(){return new BPromise(function(_0x130478,_0x17f6d4){rimraf(_0x4f279c,function(_0x59d4cd){if(_0x59d4cd)_0x17f6d4(_0x59d4cd);return _0x130478();});});})[_0x3fe7('0x18')](function(){return _0x41494c[_0x3fe7('0x50')](_0xf00999,_0x447667,function(_0x33a220){if(_0x33a220){console['log'](_0x3fe7('0x73'),_0x33a220);}else{fs[_0x3fe7('0x74')](_0xf00999);}});});});}else{return _0x41494c[_0x3fe7('0xd')](0xc8);}})[_0x3fe7('0x27')](handleError(_0x41494c,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index c2b4371..2c3c96d 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 _0x25e7=['hasOwnProperty','hook','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','setDataValue','Users','map','findAll','then','unreadMessages','length','emit'];(function(_0x2d37b7,_0x3bf618){var _0x4dfbdb=function(_0x18fc40){while(--_0x18fc40){_0x2d37b7['push'](_0x2d37b7['shift']());}};_0x4dfbdb(++_0x3bf618);}(_0x25e7,0x1d6));var _0x725e=function(_0x5e2474,_0x3dde05){_0x5e2474=_0x5e2474-0x0;var _0x4208ca=_0x25e7[_0x5e2474];return _0x4208ca;};'use strict';var EventEmitter=require(_0x725e('0x0'));var SmsInteraction=require(_0x725e('0x1'))['db'][_0x725e('0x2')];var SmsMessage=require(_0x725e('0x1'))['db'][_0x725e('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x725e('0x4')](0x0);var events={'afterCreate':_0x725e('0x5'),'afterUpdate':_0x725e('0x6'),'afterDestroy':_0x725e('0x7')};function emitEvent(_0x3da706){return function(_0x493364,_0x5e17a9,_0x2497a5){_0x493364['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x111a50){_0x493364[_0x725e('0x8')](_0x725e('0x9'),_0x111a50[_0x725e('0xa')](function(_0x40d238){return{'id':_0x40d238['id']};}));return SmsMessage[_0x725e('0xb')]({'where':{'SmsInteractionId':_0x493364['id'],'direction':'in','read':![]},'raw':!![]});})[_0x725e('0xc')](function(_0x7c40ff){_0x493364[_0x725e('0x8')](_0x725e('0xd'),_0x7c40ff[_0x725e('0xe')]);SmsInteractionEvents[_0x725e('0xf')](_0x3da706+':'+_0x493364['id'],_0x493364);SmsInteractionEvents['emit'](_0x3da706,_0x493364);_0x2497a5(null);})['catch'](_0x2497a5(null));};}for(var e in events){if(events[_0x725e('0x10')](e)){var event=events[e];SmsInteraction[_0x725e('0x11')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x2272=['findAll','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','save','update','remove','getUsers','then','setDataValue','Users','map'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x2272,0xd8));var _0x2227=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2272[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require(_0x2227('0x0'));var SmsInteraction=require(_0x2227('0x1'))['db'][_0x2227('0x2')];var SmsMessage=require(_0x2227('0x1'))['db'][_0x2227('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2227('0x4'),'afterUpdate':_0x2227('0x5'),'afterDestroy':_0x2227('0x6')};function emitEvent(_0x4c17c2){return function(_0x4ebde3,_0x1e5a8a,_0x3b8661){_0x4ebde3[_0x2227('0x7')]({'attributes':['id'],'raw':!![]})[_0x2227('0x8')](function(_0xaec623){_0x4ebde3[_0x2227('0x9')](_0x2227('0xa'),_0xaec623[_0x2227('0xb')](function(_0x18094d){return{'id':_0x18094d['id']};}));return SmsMessage[_0x2227('0xc')]({'where':{'SmsInteractionId':_0x4ebde3['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x799370){_0x4ebde3['setDataValue'](_0x2227('0xd'),_0x799370[_0x2227('0xe')]);SmsInteractionEvents[_0x2227('0xf')](_0x4c17c2+':'+_0x4ebde3['id'],_0x4ebde3);SmsInteractionEvents[_0x2227('0xf')](_0x4c17c2,_0x4ebde3);_0x3b8661(null);})[_0x2227('0x10')](_0x3b8661(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x2227('0x11')](e,emitEvent(event));}}module[_0x2227('0x12')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 2509a09..148d5f7 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 _0x5a89=['moment','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','changed','closedAt','format','lodash','util','../../config/logger','api'];(function(_0x5d0f7a,_0x15240b){var _0x51cd10=function(_0x27b9f0){while(--_0x27b9f0){_0x5d0f7a['push'](_0x5d0f7a['shift']());}};_0x51cd10(++_0x15240b);}(_0x5a89,0x65));var _0x95a8=function(_0x1e8e92,_0xa55ca6){_0x1e8e92=_0x1e8e92-0x0;var _0x5efeca=_0x5a89[_0x1e8e92];return _0x5efeca;};'use strict';var _=require(_0x95a8('0x0'));var util=require(_0x95a8('0x1'));var logger=require(_0x95a8('0x2'))(_0x95a8('0x3'));var moment=require(_0x95a8('0x4'));var BPromise=require('bluebird');var rp=require(_0x95a8('0x5'));var fs=require('fs');var path=require(_0x95a8('0x6'));var rimraf=require(_0x95a8('0x7'));var config=require(_0x95a8('0x8'));var attributes=require(_0x95a8('0x9'));module[_0x95a8('0xa')]=function(_0x19f7bf,_0x16213b){return _0x19f7bf[_0x95a8('0xb')]('SmsInteraction',attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x82157a,_0x297b48,_0xafc59c){if(_0x82157a[_0x95a8('0xc')]('closed')){_0x82157a[_0x95a8('0xd')]=moment()[_0x95a8('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0xafc59c(null,_0x82157a);}}});}; \ No newline at end of file +var _0x9181=['../../config/environment','define','SmsInteraction','sms_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x264a59,_0x31c079){var _0xa2eb76=function(_0x20e23b){while(--_0x20e23b){_0x264a59['push'](_0x264a59['shift']());}};_0xa2eb76(++_0x31c079);}(_0x9181,0x138));var _0x1918=function(_0x43d978,_0x198291){_0x43d978=_0x43d978-0x0;var _0x4b874d=_0x9181[_0x43d978];return _0x4b874d;};'use strict';var _=require(_0x1918('0x0'));var util=require(_0x1918('0x1'));var logger=require(_0x1918('0x2'))(_0x1918('0x3'));var moment=require(_0x1918('0x4'));var BPromise=require(_0x1918('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1918('0x6'));var rimraf=require(_0x1918('0x7'));var config=require(_0x1918('0x8'));var attributes=require('./smsInteraction.attributes');module['exports']=function(_0x2c9e27,_0x340489){return _0x2c9e27[_0x1918('0x9')](_0x1918('0xa'),attributes,{'tableName':_0x1918('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3f1240,_0x227547,_0x3e779b){if(_0x3f1240[_0x1918('0xc')](_0x1918('0xd'))){_0x3f1240[_0x1918('0xe')]=moment()['format'](_0x1918('0xf'));}_0x3e779b(null,_0x3f1240);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 5c632b0..0207dec 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 _0xbab8=['debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','SmsInteraction','body','options','raw','where','attributes','limit','UpdateSmsInteraction','AddTagsToSmsInteraction','find','addTags','ids','omit','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent'];(function(_0x3f9f92,_0x3ff33c){var _0x5448ca=function(_0x4b19c6){while(--_0x4b19c6){_0x3f9f92['push'](_0x3f9f92['shift']());}};_0x5448ca(++_0x3ff33c);}(_0xbab8,0x12c));var _0x8bab=function(_0x509a14,_0x4fff5e){_0x509a14=_0x509a14-0x0;var _0x868244=_0xbab8[_0x509a14];return _0x868244;};'use strict';var _=require(_0x8bab('0x0'));var util=require('util');var moment=require(_0x8bab('0x1'));var BPromise=require(_0x8bab('0x2'));var rs=require(_0x8bab('0x3'));var fs=require('fs');var Redis=require(_0x8bab('0x4'));var db=require(_0x8bab('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8bab('0x6'))('rpc');var config=require(_0x8bab('0x7'));var jayson=require(_0x8bab('0x8'));var client=jayson[_0x8bab('0x9')]['http']({'port':0x232a});config[_0x8bab('0xa')]=_[_0x8bab('0xb')](config['redis'],{'host':_0x8bab('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8bab('0xd'))[_0x8bab('0xe')](socket);function respondWithRpcPromise(_0x2b96a2,_0x80038e,_0x4acc24){return new BPromise(function(_0x400c46,_0x3ae198){return client[_0x8bab('0xf')](_0x2b96a2,_0x4acc24)[_0x8bab('0x10')](function(_0x4e42ab){logger[_0x8bab('0x11')](_0x8bab('0x12'),_0x80038e,_0x8bab('0x13'));logger[_0x8bab('0x14')](_0x8bab('0x15'),_0x80038e,'request\x20sent',JSON[_0x8bab('0x16')](_0x4e42ab));if(_0x4e42ab[_0x8bab('0x17')]){if(_0x4e42ab[_0x8bab('0x17')]['code']===0x1f4){logger[_0x8bab('0x17')](_0x8bab('0x12'),_0x80038e,_0x4e42ab[_0x8bab('0x17')][_0x8bab('0x18')]);return _0x3ae198(_0x4e42ab[_0x8bab('0x17')]['message']);}logger[_0x8bab('0x17')](_0x8bab('0x12'),_0x80038e,_0x4e42ab['error'][_0x8bab('0x18')]);return _0x400c46(_0x4e42ab[_0x8bab('0x17')][_0x8bab('0x18')]);}else{logger['info'](_0x8bab('0x12'),_0x80038e,_0x8bab('0x13'));_0x400c46(_0x4e42ab['result'][_0x8bab('0x18')]);}})[_0x8bab('0x19')](function(_0x59ef83){logger[_0x8bab('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x80038e,_0x59ef83);_0x3ae198(_0x59ef83);});});}exports['UpdateSmsInteraction']=function(_0x5419e0){var _0x401e5b=this;return new Promise(function(_0x2d9111,_0x106a0a){return db[_0x8bab('0x1a')]['update'](_0x5419e0[_0x8bab('0x1b')],{'raw':_0x5419e0[_0x8bab('0x1c')]?_0x5419e0[_0x8bab('0x1c')][_0x8bab('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5419e0[_0x8bab('0x1c')]?_0x5419e0[_0x8bab('0x1c')][_0x8bab('0x1e')]||null:null,'attributes':_0x5419e0[_0x8bab('0x1c')]?_0x5419e0['options'][_0x8bab('0x1f')]||null:null,'limit':_0x5419e0[_0x8bab('0x1c')]?_0x5419e0[_0x8bab('0x1c')][_0x8bab('0x20')]||null:null})[_0x8bab('0x10')](function(_0x292730){logger[_0x8bab('0x11')](_0x8bab('0x21'),_0x5419e0);logger[_0x8bab('0x14')](_0x8bab('0x21'),_0x5419e0,JSON[_0x8bab('0x16')](_0x292730));_0x2d9111(_0x292730);})[_0x8bab('0x19')](function(_0x17e4ea){logger['error'](_0x8bab('0x21'),_0x17e4ea[_0x8bab('0x18')],_0x5419e0);_0x106a0a(_0x401e5b[_0x8bab('0x17')](0x1f4,_0x17e4ea['message']));});});};exports[_0x8bab('0x22')]=function(_0x3107f7){return new Promise(function(_0x19b755,_0x35c570){return db[_0x8bab('0x1a')][_0x8bab('0x23')]({'where':_0x3107f7['options']?_0x3107f7['options'][_0x8bab('0x1e')]||null:null})['then'](function(_0x430687){if(_0x430687){return _0x430687[_0x8bab('0x24')](_0x3107f7['body'][_0x8bab('0x25')],_[_0x8bab('0x26')](_0x3107f7[_0x8bab('0x1b')],['ids','id'])||{});}})['spread'](function(_0x24bc92){logger['info'](_0x8bab('0x27'),_0x3107f7);logger[_0x8bab('0x14')](_0x8bab('0x27'),_0x3107f7,JSON[_0x8bab('0x16')](_0x24bc92));_0x19b755(_0x24bc92);})['catch'](function(_0x35a708){logger['error'](_0x8bab('0x27'),_0x35a708['message'],_0x3107f7);_0x35c570(_this['error'](0x1f4,_0x35a708[_0x8bab('0x18')]));});});}; \ No newline at end of file +var _0x3020=['where','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','attributes','limit','debug','find'];(function(_0x116b01,_0x2a7947){var _0x4fd916=function(_0x1187ab){while(--_0x1187ab){_0x116b01['push'](_0x116b01['shift']());}};_0x4fd916(++_0x2a7947);}(_0x3020,0x81));var _0x0302=function(_0x46f743,_0x1419b8){_0x46f743=_0x46f743-0x0;var _0x30694c=_0x3020[_0x46f743];return _0x30694c;};'use strict';var _=require(_0x0302('0x0'));var util=require('util');var moment=require(_0x0302('0x1'));var BPromise=require(_0x0302('0x2'));var rs=require(_0x0302('0x3'));var fs=require('fs');var Redis=require(_0x0302('0x4'));var db=require(_0x0302('0x5'))['db'];var utils=require(_0x0302('0x6'));var logger=require('../../config/logger')(_0x0302('0x7'));var config=require(_0x0302('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0302('0x9')]['http']({'port':0x232a});config[_0x0302('0xa')]=_['defaults'](config[_0x0302('0xa')],{'host':_0x0302('0xb'),'port':0x18eb});var socket=require(_0x0302('0xc'))(new Redis(config[_0x0302('0xa')]));require(_0x0302('0xd'))[_0x0302('0xe')](socket);function respondWithRpcPromise(_0x2efd1d,_0x2e72e0,_0xe3f8b3){return new BPromise(function(_0x350694,_0x57af6d){return client[_0x0302('0xf')](_0x2efd1d,_0xe3f8b3)[_0x0302('0x10')](function(_0x2e29d4){logger['info'](_0x0302('0x11'),_0x2e72e0,_0x0302('0x12'));logger['debug']('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x2e72e0,_0x0302('0x12'),JSON[_0x0302('0x13')](_0x2e29d4));if(_0x2e29d4[_0x0302('0x14')]){if(_0x2e29d4[_0x0302('0x14')][_0x0302('0x15')]===0x1f4){logger[_0x0302('0x14')](_0x0302('0x11'),_0x2e72e0,_0x2e29d4[_0x0302('0x14')][_0x0302('0x16')]);return _0x57af6d(_0x2e29d4[_0x0302('0x14')]['message']);}logger[_0x0302('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x2e72e0,_0x2e29d4[_0x0302('0x14')][_0x0302('0x16')]);return _0x350694(_0x2e29d4[_0x0302('0x14')]['message']);}else{logger[_0x0302('0x17')](_0x0302('0x11'),_0x2e72e0,'request\x20sent');_0x350694(_0x2e29d4[_0x0302('0x18')]['message']);}})[_0x0302('0x19')](function(_0x2929c6){logger[_0x0302('0x14')](_0x0302('0x11'),_0x2e72e0,_0x2929c6);_0x57af6d(_0x2929c6);});});}exports[_0x0302('0x1a')]=function(_0x2ec66a){var _0x38d007=this;return new Promise(function(_0x3ef6f8,_0x2a17d9){return db[_0x0302('0x1b')][_0x0302('0x1c')](_0x2ec66a[_0x0302('0x1d')],{'raw':_0x2ec66a[_0x0302('0x1e')]?_0x2ec66a[_0x0302('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ec66a[_0x0302('0x1e')]?_0x2ec66a[_0x0302('0x1e')]['where']||null:null,'attributes':_0x2ec66a['options']?_0x2ec66a[_0x0302('0x1e')][_0x0302('0x1f')]||null:null,'limit':_0x2ec66a['options']?_0x2ec66a[_0x0302('0x1e')][_0x0302('0x20')]||null:null})['then'](function(_0x10b8cb){logger['info'](_0x0302('0x1a'),_0x2ec66a);logger[_0x0302('0x21')](_0x0302('0x1a'),_0x2ec66a,JSON[_0x0302('0x13')](_0x10b8cb));_0x3ef6f8(_0x10b8cb);})['catch'](function(_0x38970c){logger[_0x0302('0x14')](_0x0302('0x1a'),_0x38970c[_0x0302('0x16')],_0x2ec66a);_0x2a17d9(_0x38d007[_0x0302('0x14')](0x1f4,_0x38970c['message']));});});};exports['AddTagsToSmsInteraction']=function(_0x10016d){return new Promise(function(_0x1ff8bc,_0x466023){return db[_0x0302('0x1b')][_0x0302('0x22')]({'where':_0x10016d[_0x0302('0x1e')]?_0x10016d[_0x0302('0x1e')][_0x0302('0x23')]||null:null})['then'](function(_0x30ffdc){if(_0x30ffdc){return _0x30ffdc[_0x0302('0x24')](_0x10016d[_0x0302('0x1d')][_0x0302('0x25')],_[_0x0302('0x26')](_0x10016d[_0x0302('0x1d')],['ids','id'])||{});}})[_0x0302('0x27')](function(_0x4188b3){logger[_0x0302('0x17')](_0x0302('0x28'),_0x10016d);logger[_0x0302('0x21')](_0x0302('0x28'),_0x10016d,JSON[_0x0302('0x13')](_0x4188b3));_0x1ff8bc(_0x4188b3);})[_0x0302('0x19')](function(_0x3d2fa8){logger['error'](_0x0302('0x28'),_0x3d2fa8[_0x0302('0x16')],_0x10016d);_0x466023(_this[_0x0302('0x14')](0x1f4,_0x3d2fa8[_0x0302('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index b5e519f..28c7c9c 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 _0x70c3=['emit','removeListener','register','length','save'];(function(_0x1da469,_0x37f22a){var _0x46b169=function(_0x426c43){while(--_0x426c43){_0x1da469['push'](_0x1da469['shift']());}};_0x46b169(++_0x37f22a);}(_0x70c3,0x1e9));var _0x370c=function(_0x572b34,_0x4e018e){_0x572b34=_0x572b34-0x0;var _0x4d94bc=_0x70c3[_0x572b34];return _0x4d94bc;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x370c('0x0'),'remove','update'];function createListener(_0x4a0148,_0x2e3b70){return function(_0x446c4c){_0x2e3b70[_0x370c('0x1')](_0x4a0148,_0x446c4c);};}function removeListener(_0x3caf62,_0x8d9e8f){return function(){SmsInteractionEvents[_0x370c('0x2')](_0x3caf62,_0x8d9e8f);};}exports[_0x370c('0x3')]=function(_0x5719e9){for(var _0x4e3330=0x0,_0x2cf12d=events[_0x370c('0x4')];_0x4e3330<_0x2cf12d;_0x4e3330++){var _0x2ce8b6=events[_0x4e3330];var _0x36a669=createListener('smsInteraction:'+_0x2ce8b6,_0x5719e9);SmsInteractionEvents['on'](_0x2ce8b6,_0x36a669);}}; \ No newline at end of file +var _0x6e11=['./smsInteraction.events','save','remove','emit','register','length','smsInteraction:'];(function(_0x2af009,_0x5432ee){var _0x46d15f=function(_0x26569f){while(--_0x26569f){_0x2af009['push'](_0x2af009['shift']());}};_0x46d15f(++_0x5432ee);}(_0x6e11,0x1ab));var _0x16e1=function(_0x310504,_0x26ad95){_0x310504=_0x310504-0x0;var _0x5b36d0=_0x6e11[_0x310504];return _0x5b36d0;};'use strict';var SmsInteractionEvents=require(_0x16e1('0x0'));var events=[_0x16e1('0x1'),_0x16e1('0x2'),'update'];function createListener(_0x388557,_0xa0bbac){return function(_0x5ed52c){_0xa0bbac[_0x16e1('0x3')](_0x388557,_0x5ed52c);};}function removeListener(_0x477350,_0x2be153){return function(){SmsInteractionEvents['removeListener'](_0x477350,_0x2be153);};}exports[_0x16e1('0x4')]=function(_0x3eec1b){for(var _0xcece47=0x0,_0x28b8b3=events[_0x16e1('0x5')];_0xcece47<_0x28b8b3;_0xcece47++){var _0x5e4e97=events[_0xcece47];var _0x6f0ae6=createListener(_0x16e1('0x6')+_0x5e4e97,_0x3eec1b);SmsInteractionEvents['on'](_0x5e4e97,_0x6f0ae6);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 0af240d..6ecd7c1 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 _0xd5b7=['show','post','tracked','sms','smsmessage:create','/:id/status','status','update','put','/:id/accept','/:id/reject','delete','destroy','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x471ccc,_0x47700d){var _0x42a813=function(_0x3d4cfe){while(--_0x3d4cfe){_0x471ccc['push'](_0x471ccc['shift']());}};_0x42a813(++_0x47700d);}(_0xd5b7,0xaf));var _0x7d5b=function(_0x47408e,_0x481428){_0x47408e=_0x47408e-0x0;var _0x1636bc=_0xd5b7[_0x47408e];return _0x1636bc;};'use strict';var multer=require(_0x7d5b('0x0'));var util=require(_0x7d5b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7d5b('0x2'));var router=express[_0x7d5b('0x3')]();var fs_extra=require(_0x7d5b('0x4'));var auth=require(_0x7d5b('0x5'));var interaction=require(_0x7d5b('0x6'));var config=require(_0x7d5b('0x7'));var controller=require('./smsMessage.controller');router[_0x7d5b('0x8')]('/',auth[_0x7d5b('0x9')](),controller[_0x7d5b('0xa')]);router[_0x7d5b('0x8')](_0x7d5b('0xb'),auth[_0x7d5b('0x9')](),controller[_0x7d5b('0xc')]);router[_0x7d5b('0x8')](_0x7d5b('0xd'),auth[_0x7d5b('0x9')](),controller[_0x7d5b('0xe')]);router[_0x7d5b('0xf')]('/',auth['isAuthenticated'](),interaction[_0x7d5b('0x10')](_0x7d5b('0x11'),_0x7d5b('0x12')),controller['create']);router[_0x7d5b('0xf')](_0x7d5b('0x13'),controller[_0x7d5b('0x14')]);router['put'](_0x7d5b('0xd'),auth[_0x7d5b('0x9')](),controller[_0x7d5b('0x15')]);router[_0x7d5b('0x16')](_0x7d5b('0x17'),auth[_0x7d5b('0x9')](),controller['accept']);router[_0x7d5b('0x16')](_0x7d5b('0x18'),auth[_0x7d5b('0x9')](),controller['reject']);router[_0x7d5b('0x19')](_0x7d5b('0xd'),auth['isAuthenticated'](),controller[_0x7d5b('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xfea2=['fs-extra','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','/:id','show','post','tracked','sms','/:id/status','status','put','/:id/reject','reject','destroy','exports','util','connect-timeout','express','Router'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xfea2,0xa4));var _0x2fea=function(_0xace5bb,_0x4322f6){_0xace5bb=_0xace5bb-0x0;var _0x37bd48=_0xfea2[_0xace5bb];return _0x37bd48;};'use strict';var multer=require('multer');var util=require(_0x2fea('0x0'));var path=require('path');var timeout=require(_0x2fea('0x1'));var express=require(_0x2fea('0x2'));var router=express[_0x2fea('0x3')]();var fs_extra=require(_0x2fea('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2fea('0x5'));var config=require(_0x2fea('0x6'));var controller=require(_0x2fea('0x7'));router[_0x2fea('0x8')]('/',auth[_0x2fea('0x9')](),controller[_0x2fea('0xa')]);router[_0x2fea('0x8')](_0x2fea('0xb'),auth[_0x2fea('0x9')](),controller['describe']);router[_0x2fea('0x8')](_0x2fea('0xc'),auth[_0x2fea('0x9')](),controller[_0x2fea('0xd')]);router[_0x2fea('0xe')]('/',auth['isAuthenticated'](),interaction[_0x2fea('0xf')](_0x2fea('0x10'),'smsmessage:create'),controller['create']);router[_0x2fea('0xe')](_0x2fea('0x11'),controller[_0x2fea('0x12')]);router[_0x2fea('0x13')](_0x2fea('0xc'),auth[_0x2fea('0x9')](),controller['update']);router[_0x2fea('0x13')]('/:id/accept',auth[_0x2fea('0x9')](),controller['accept']);router[_0x2fea('0x13')](_0x2fea('0x14'),auth[_0x2fea('0x9')](),controller[_0x2fea('0x15')]);router['delete'](_0x2fea('0xc'),auth[_0x2fea('0x9')](),controller[_0x2fea('0x16')]);module[_0x2fea('0x17')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 2321f79..3195434 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 _0xc1fa=['BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports','TEXT','medium'];(function(_0x402731,_0x43c115){var _0x111736=function(_0x5a7044){while(--_0x5a7044){_0x402731['push'](_0x402731['shift']());}};_0x111736(++_0x43c115);}(_0xc1fa,0x83));var _0xac1f=function(_0xf55e73,_0x3fecc5){_0xf55e73=_0xf55e73-0x0;var _0x116b99=_0xc1fa[_0xf55e73];return _0x116b99;};'use strict';var Sequelize=require(_0xac1f('0x0'));module[_0xac1f('0x1')]={'body':{'type':Sequelize[_0xac1f('0x2')](_0xac1f('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xac1f('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xac1f('0x5')]('in','out'),'defaultValue':_0xac1f('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xac1f('0x7')](0xbe)},'phone':{'type':Sequelize[_0xac1f('0x7')]},'readAt':{'type':Sequelize[_0xac1f('0x8')]},'secret':{'type':Sequelize[_0xac1f('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xac1f('0x7')]},'providerResponse':{'type':Sequelize[_0xac1f('0x2')]}}; \ No newline at end of file +var _0x88ce=['STRING','DATE','TEXT','exports','medium','BOOLEAN','ENUM','out'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0x88ce,0xab));var _0xe88c=function(_0x1b2871,_0x11e8bf){_0x1b2871=_0x1b2871-0x0;var _0xb2e25e=_0x88ce[_0x1b2871];return _0xb2e25e;};'use strict';var Sequelize=require('sequelize');module[_0xe88c('0x0')]={'body':{'type':Sequelize['TEXT'](_0xe88c('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xe88c('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe88c('0x3')]('in',_0xe88c('0x4')),'defaultValue':_0xe88c('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xe88c('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xe88c('0x6')]},'secret':{'type':Sequelize[_0xe88c('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xe88c('0x5')]},'providerResponse':{'type':Sequelize[_0xe88c('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 0b96e55..c8cb4e9 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 _0xeb0f=['pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','body','find','describe','../../config/logger','sms-interactions','sms','read','readAt','format','UserId','user','agent','get','SmsInteraction','SmsInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[SMSMESSAGE: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','fullname','email','internal','interface','channel','motionChannel','accept','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','event','rejectmessage','SmsAccountId','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','indexOf','sent','Status','plivio','infobip','groupName','DELIVERED','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','reject','save','update','destroy','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x2b1634,_0x3a4201){var _0x357d97=function(_0x4495c6){while(--_0x4495c6){_0x2b1634['push'](_0x2b1634['shift']());}};_0x357d97(++_0x3a4201);}(_0xeb0f,0x176));var _0xfeb0=function(_0x399e47,_0x4fd7b2){_0x399e47=_0x399e47-0x0;var _0x37eab3=_0xeb0f[_0x399e47];return _0x37eab3;};'use strict';var emlformat=require(_0xfeb0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfeb0('0x1'));var jsonpatch=require(_0xfeb0('0x2'));var rp=require(_0xfeb0('0x3'));var moment=require(_0xfeb0('0x4'));var BPromise=require(_0xfeb0('0x5'));var Mustache=require(_0xfeb0('0x6'));var util=require('util');var path=require(_0xfeb0('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfeb0('0x8'));var fs=require('fs');var fs_extra=require(_0xfeb0('0x9'));var _=require(_0xfeb0('0xa'));var squel=require(_0xfeb0('0xb'));var crypto=require(_0xfeb0('0xc'));var jsforce=require(_0xfeb0('0xd'));var deskjs=require(_0xfeb0('0xe'));var toCsv=require(_0xfeb0('0xf'));var querystring=require(_0xfeb0('0x10'));var Papa=require(_0xfeb0('0x11'));var Redis=require(_0xfeb0('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfeb0('0x13'));var hardwareService=require(_0xfeb0('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xfeb0('0x15'));var config=require(_0xfeb0('0x16'));var licenseUtil=require(_0xfeb0('0x17'));var db=require(_0xfeb0('0x18'))['db'];config[_0xfeb0('0x19')]=_['defaults'](config[_0xfeb0('0x19')],{'host':_0xfeb0('0x1a'),'port':0x18eb});var socket=require(_0xfeb0('0x1b'))(new Redis(config[_0xfeb0('0x19')]));require(_0xfeb0('0x1c'))[_0xfeb0('0x1d')](socket);var jayson=require(_0xfeb0('0x1e'));var client=jayson[_0xfeb0('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0xfeb0('0x1f')][_0xfeb0('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x1d7f72,_0x58662b,_0x4f0c65,_0x4ede0e){return new BPromise(function(_0x1aa982,_0x4714cb){var _0x3428ee=_0x4ede0e||client;return _0x3428ee[_0xfeb0('0x21')](_0x1d7f72,_0x4f0c65)[_0xfeb0('0x22')](function(_0x82a86e){logger[_0xfeb0('0x23')](_0xfeb0('0x24'),_0x58662b,'request\x20sent');logger[_0xfeb0('0x25')](_0xfeb0('0x26'),_0x58662b,'request\x20sent',JSON[_0xfeb0('0x27')](_0x82a86e));if(_0x82a86e[_0xfeb0('0x28')]){if(_0x82a86e[_0xfeb0('0x28')]['code']===0x1f4){logger[_0xfeb0('0x28')]('SmsMessage,\x20%s,\x20%s',_0x58662b,_0x82a86e[_0xfeb0('0x28')][_0xfeb0('0x29')]);return _0x4714cb(_0x82a86e[_0xfeb0('0x28')][_0xfeb0('0x29')]);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x58662b,_0x82a86e[_0xfeb0('0x28')]['message']);return _0x1aa982(_0x82a86e[_0xfeb0('0x28')][_0xfeb0('0x29')]);}else{logger[_0xfeb0('0x23')](_0xfeb0('0x24'),_0x58662b,'request\x20sent');_0x1aa982(_0x82a86e[_0xfeb0('0x2a')][_0xfeb0('0x29')]);}})['catch'](function(_0x73119e){logger[_0xfeb0('0x28')](_0xfeb0('0x24'),_0x58662b,_0x73119e);_0x4714cb(_0x73119e);});});}function respondWithStatusCode(_0x388c62,_0x2114dc){_0x2114dc=_0x2114dc||0xcc;return function(_0x34ba8f){if(_0x34ba8f){return _0x388c62[_0xfeb0('0x2b')](_0x2114dc);}return _0x388c62[_0xfeb0('0x2c')](_0x2114dc)[_0xfeb0('0x2d')]();};}function respondWithResult(_0x547d4c,_0x44811a){_0x44811a=_0x44811a||0xc8;return function(_0x2f4d02){if(_0x2f4d02){return _0x547d4c['status'](_0x44811a)[_0xfeb0('0x2e')](_0x2f4d02);}};}function respondWithFilteredResult(_0x2f875c,_0x2a2b52){return function(_0x14eed2){if(_0x14eed2){var _0x58cf1=typeof _0x2a2b52['offset']===_0xfeb0('0x2f')&&typeof _0x2a2b52['limit']==='undefined';var _0x4cd828=_0x14eed2[_0xfeb0('0x30')];var _0x40cd34=_0x58cf1?0x0:_0x2a2b52[_0xfeb0('0x31')];var _0x4c4fe6=_0x58cf1?_0x14eed2[_0xfeb0('0x30')]:_0x2a2b52[_0xfeb0('0x31')]+_0x2a2b52[_0xfeb0('0x32')];var _0x266edb;if(_0x4c4fe6>=_0x4cd828){_0x4c4fe6=_0x4cd828;_0x266edb=0xc8;}else{_0x266edb=0xce;}_0x2f875c[_0xfeb0('0x2c')](_0x266edb);return _0x2f875c[_0xfeb0('0x33')]('Content-Range',_0x40cd34+'-'+_0x4c4fe6+'/'+_0x4cd828)['json'](_0x14eed2);}return null;};}function patchUpdates(_0x14bc1b){return function(_0x5d188e){try{jsonpatch[_0xfeb0('0x34')](_0x5d188e,_0x14bc1b,!![]);}catch(_0x1dde16){return BPromise[_0xfeb0('0x35')](_0x1dde16);}return _0x5d188e[_0xfeb0('0x36')]();};}function saveUpdates(_0x45d664,_0x45ba50){return function(_0x11cfe6){if(_0x11cfe6){return _0x11cfe6[_0xfeb0('0x37')](_0x45d664)[_0xfeb0('0x22')](function(_0x37a1d9){return _0x37a1d9;});}return null;};}function removeEntity(_0x41295c,_0x2cb4fb){return function(_0x28d4a6){if(_0x28d4a6){return _0x28d4a6[_0xfeb0('0x38')]()[_0xfeb0('0x22')](function(){_0x41295c[_0xfeb0('0x2c')](0xcc)[_0xfeb0('0x2d')]();});}};}function handleEntityNotFound(_0x4e047d,_0x20b206){return function(_0x33fe82){if(!_0x33fe82){_0x4e047d['sendStatus'](0x194);}return _0x33fe82;};}function handleError(_0xc694d9,_0x11215f){_0x11215f=_0x11215f||0x1f4;return function(_0x369a15){logger[_0xfeb0('0x28')](_0x369a15[_0xfeb0('0x39')]);if(_0x369a15['name']){delete _0x369a15[_0xfeb0('0x3a')];}_0xc694d9['status'](_0x11215f)[_0xfeb0('0x3b')](_0x369a15);};}exports[_0xfeb0('0x3c')]=function(_0x5acd6f,_0x3851fb){var _0x58a729={},_0x2888f2={},_0x2dc8fe={'count':0x0,'rows':[]};var _0x3a545b=_[_0xfeb0('0x3d')](db[_0xfeb0('0x3e')][_0xfeb0('0x3f')],function(_0x27a6ae){return{'name':_0x27a6ae[_0xfeb0('0x40')],'type':_0x27a6ae[_0xfeb0('0x41')]['key']};});_0x2888f2[_0xfeb0('0x42')]=_[_0xfeb0('0x3d')](_0x3a545b,_0xfeb0('0x3a'));_0x2888f2[_0xfeb0('0x43')]=_[_0xfeb0('0x44')](_0x5acd6f['query']);_0x2888f2[_0xfeb0('0x45')]=_[_0xfeb0('0x46')](_0x2888f2[_0xfeb0('0x42')],_0x2888f2[_0xfeb0('0x43')]);_0x58a729['attributes']=_[_0xfeb0('0x46')](_0x2888f2[_0xfeb0('0x42')],qs[_0xfeb0('0x47')](_0x5acd6f[_0xfeb0('0x43')][_0xfeb0('0x47')]));_0x58a729[_0xfeb0('0x48')]=_0x58a729['attributes'][_0xfeb0('0x49')]?_0x58a729['attributes']:_0x2888f2[_0xfeb0('0x42')];if(!_0x5acd6f['query'][_0xfeb0('0x4a')](_0xfeb0('0x4b'))){_0x58a729[_0xfeb0('0x32')]=qs[_0xfeb0('0x32')](_0x5acd6f[_0xfeb0('0x43')][_0xfeb0('0x32')]);_0x58a729[_0xfeb0('0x31')]=qs[_0xfeb0('0x31')](_0x5acd6f[_0xfeb0('0x43')]['offset']);}_0x58a729[_0xfeb0('0x4c')]=qs['sort'](_0x5acd6f[_0xfeb0('0x43')][_0xfeb0('0x4d')]);_0x58a729[_0xfeb0('0x4e')]=qs[_0xfeb0('0x45')](_[_0xfeb0('0x4f')](_0x5acd6f['query'],_0x2888f2['filters']),_0x3a545b);if(_0x5acd6f[_0xfeb0('0x43')][_0xfeb0('0x50')]){_0x58a729[_0xfeb0('0x4e')]=_[_0xfeb0('0x51')](_0x58a729[_0xfeb0('0x4e')],{'$or':_[_0xfeb0('0x3d')](_0x3a545b,function(_0x12d24f){if(_0x12d24f[_0xfeb0('0x41')]!==_0xfeb0('0x52')){var _0x130916={};_0x130916[_0x12d24f['name']]={'$like':'%'+_0x5acd6f[_0xfeb0('0x43')][_0xfeb0('0x50')]+'%'};return _0x130916;}})});}_0x58a729=_['merge']({},_0x58a729,_0x5acd6f[_0xfeb0('0x53')]);var _0x3ee041={'where':_0x58a729[_0xfeb0('0x4e')]};return db['SmsMessage'][_0xfeb0('0x30')](_0x3ee041)[_0xfeb0('0x22')](function(_0x5dfbdb){_0x2dc8fe[_0xfeb0('0x30')]=_0x5dfbdb;if(_0x5acd6f[_0xfeb0('0x43')][_0xfeb0('0x54')]){_0x58a729['include']=[{'all':!![]}];}return db['SmsMessage'][_0xfeb0('0x55')](_0x58a729);})['then'](function(_0x2ab71c){_0x2dc8fe[_0xfeb0('0x56')]=_0x2ab71c;return _0x2dc8fe;})[_0xfeb0('0x22')](respondWithFilteredResult(_0x3851fb,_0x58a729))[_0xfeb0('0x57')](handleError(_0x3851fb,null));};exports[_0xfeb0('0x58')]=function(_0x2bd414,_0x41de77){var _0x5ef8f9={'raw':!![],'where':{'id':_0x2bd414[_0xfeb0('0x59')]['id']}},_0x52ebfd={};_0x52ebfd['model']=_[_0xfeb0('0x44')](db['SmsMessage']['rawAttributes']);_0x52ebfd[_0xfeb0('0x43')]=_[_0xfeb0('0x44')](_0x2bd414[_0xfeb0('0x43')]);_0x52ebfd[_0xfeb0('0x45')]=_[_0xfeb0('0x46')](_0x52ebfd[_0xfeb0('0x42')],_0x52ebfd[_0xfeb0('0x43')]);_0x5ef8f9[_0xfeb0('0x48')]=_[_0xfeb0('0x46')](_0x52ebfd[_0xfeb0('0x42')],qs[_0xfeb0('0x47')](_0x2bd414[_0xfeb0('0x43')][_0xfeb0('0x47')]));_0x5ef8f9[_0xfeb0('0x48')]=_0x5ef8f9[_0xfeb0('0x48')]['length']?_0x5ef8f9['attributes']:_0x52ebfd[_0xfeb0('0x42')];if(_0x2bd414['query'][_0xfeb0('0x54')]){_0x5ef8f9[_0xfeb0('0x5a')]=[{'all':!![]}];}_0x5ef8f9=_[_0xfeb0('0x51')]({},_0x5ef8f9,_0x2bd414[_0xfeb0('0x53')]);return db['SmsMessage']['find'](_0x5ef8f9)['then'](handleEntityNotFound(_0x41de77,null))[_0xfeb0('0x22')](respondWithResult(_0x41de77,null))[_0xfeb0('0x57')](handleError(_0x41de77,null));};exports['create']=function(_0x11e95f,_0x1dc290){return db[_0xfeb0('0x3e')]['create'](_0x11e95f['body'],{})[_0xfeb0('0x22')](respondWithResult(_0x1dc290,0xc9))[_0xfeb0('0x57')](handleError(_0x1dc290,null));};exports[_0xfeb0('0x37')]=function(_0x2fa55b,_0x33c64f){if(_0x2fa55b[_0xfeb0('0x5b')]['id']){delete _0x2fa55b[_0xfeb0('0x5b')]['id'];}return db[_0xfeb0('0x3e')]['find']({'where':{'id':_0x2fa55b[_0xfeb0('0x59')]['id']}})[_0xfeb0('0x22')](handleEntityNotFound(_0x33c64f,null))[_0xfeb0('0x22')](saveUpdates(_0x2fa55b['body'],null))[_0xfeb0('0x22')](respondWithResult(_0x33c64f,null))[_0xfeb0('0x57')](handleError(_0x33c64f,null));};exports['destroy']=function(_0xafb423,_0xf2025b){return db[_0xfeb0('0x3e')][_0xfeb0('0x5c')]({'where':{'id':_0xafb423[_0xfeb0('0x59')]['id']}})['then'](handleEntityNotFound(_0xf2025b,null))[_0xfeb0('0x22')](removeEntity(_0xf2025b,null))[_0xfeb0('0x57')](handleError(_0xf2025b,null));};exports[_0xfeb0('0x5d')]=function(_0x4d02e4,_0x4dd525){return db[_0xfeb0('0x3e')][_0xfeb0('0x5d')]()['then'](respondWithResult(_0x4dd525,null))[_0xfeb0('0x57')](handleError(_0x4dd525,null));};var interaction_log=require(_0xfeb0('0x5e'))(_0xfeb0('0x5f'));exports['accept']=function(_0x351d55,_0xca4e9c,_0x2b6c7b){var _0x3321e7={'agent':{},'channel':_0xfeb0('0x60')};if(_0x351d55[_0xfeb0('0x5b')]['id']){delete _0x351d55[_0xfeb0('0x5b')]['id'];}_0x351d55['body'][_0xfeb0('0x61')]=!![];_0x351d55[_0xfeb0('0x5b')][_0xfeb0('0x62')]=moment()[_0xfeb0('0x63')]('YYYY-MM-DD\x20HH:mm:ss');_0x351d55['body'][_0xfeb0('0x64')]=_0x351d55[_0xfeb0('0x5b')][_0xfeb0('0x64')]||_0x351d55[_0xfeb0('0x65')]['id'];_0x3321e7[_0xfeb0('0x66')]['id']=_0x351d55[_0xfeb0('0x5b')][_0xfeb0('0x64')];return db[_0xfeb0('0x3e')][_0xfeb0('0x5c')]({'where':{'id':_0x351d55[_0xfeb0('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xca4e9c,null))[_0xfeb0('0x22')](saveUpdates(_0x351d55['body'],null))['then'](function(_0x21a359){if(_0x21a359){_0x3321e7['message']=_0x21a359[_0xfeb0('0x67')]({'plain':!![]});return db[_0xfeb0('0x68')][_0xfeb0('0x5c')]({'where':{'id':_0x21a359[_0xfeb0('0x69')]}});}return null;})[_0xfeb0('0x22')](handleEntityNotFound(_0xca4e9c,null))['then'](function(_0x2ef790){if(_0x2ef790){return _0x2ef790['update']({'UserId':_0x351d55[_0xfeb0('0x5b')]['UserId'],'read1stAt':_['isNil'](_0x2ef790[_0xfeb0('0x6a')])?moment()[_0xfeb0('0x63')](_0xfeb0('0x6b')):undefined});}return null;})[_0xfeb0('0x22')](function(_0x5f51a1){if(_0x5f51a1){_0x3321e7[_0xfeb0('0x6c')]=_0x5f51a1[_0xfeb0('0x67')]({'plain':!![]});interaction_log['info'](_0xfeb0('0x6d'),_0x351d55[_0xfeb0('0x65')]['id'],_0x351d55[_0xfeb0('0x65')][_0xfeb0('0x3a')],_0x351d55[_0xfeb0('0x65')][_0xfeb0('0x6e')],_0x3321e7[_0xfeb0('0x6c')]['id'],_0x351d55['body']?JSON[_0xfeb0('0x27')](_0x351d55[_0xfeb0('0x5b')]):_0xfeb0('0x6f'));return respondWithRpcPromise(_0xfeb0('0x70'),_0xfeb0('0x71'),_0x3321e7);}return null;})['then'](function(_0x43cf8e){var _0x2dd7d3=_0xfeb0('0x72')+_0x43cf8e[_0xfeb0('0x29')][_0xfeb0('0x73')];return db[_0xfeb0('0x74')][_0xfeb0('0x43')](_0x2dd7d3,{'type':db[_0xfeb0('0x75')][_0xfeb0('0x76')][_0xfeb0('0x77')],'raw':!![]})[_0xfeb0('0x22')](function(_0x167532){return _0x167532;});})[_0xfeb0('0x22')](function(_0x438a3a){if(_0x438a3a){_0x3321e7[_0xfeb0('0x29')][_0xfeb0('0x78')]=_0x438a3a[0x0];if(!_0x351d55['body'][_0xfeb0('0x64')])return;return db[_0xfeb0('0x79')][_0xfeb0('0x5c')]({'where':{'id':_0x351d55[_0xfeb0('0x5b')][_0xfeb0('0x64')],'role':_0xfeb0('0x66')},'attributes':['id',_0xfeb0('0x3a'),_0xfeb0('0x7a'),_0xfeb0('0x7b'),_0xfeb0('0x7c')],'raw':!![]});}return null;})[_0xfeb0('0x22')](function(_0x503f8e){if(!_0x503f8e)return null;_0x3321e7[_0xfeb0('0x29')]['agent']=_0x503f8e;return _0x3321e7;})['then'](function(_0x502db6){if(_0x502db6){if(_0x351d55[_0xfeb0('0x5b')]['manual']){_0x3321e7['message'][_0xfeb0('0x7d')]=util[_0xfeb0('0x63')]('SIP/%s',_0x351d55[_0xfeb0('0x65')]['name']);_0x3321e7[_0xfeb0('0x29')][_0xfeb0('0x7e')]=_0x3321e7[_0xfeb0('0x7e')];_0x3321e7['message'][_0xfeb0('0x7f')]=_0x3321e7[_0xfeb0('0x7e')];_0x3321e7[_0xfeb0('0x29')]['event']=_0xfeb0('0x80');return respondWithRpcPromise(_0xfeb0('0x81'),_0xfeb0('0x81'),{'event':_0xfeb0('0x82'),'message':_0x3321e7[_0xfeb0('0x29')]},client9002)['then'](function(){return _0x3321e7;});}return _0x3321e7;}return null;})['then'](respondWithResult(_0xca4e9c,null))['catch'](handleError(_0xca4e9c,null));};var interaction_log=require(_0xfeb0('0x5e'))('sms-interactions');exports[_0xfeb0('0x35')]=function(_0x2a58aa,_0x435dc8,_0x51d242){var _0x4b6a93={'agent':{},'channel':_0xfeb0('0x60')};if(_0x2a58aa[_0xfeb0('0x5b')]['id']){delete _0x2a58aa[_0xfeb0('0x5b')]['id'];}_0x2a58aa[_0xfeb0('0x5b')]['UserId']=_0x2a58aa[_0xfeb0('0x5b')]['UserId']||_0x2a58aa[_0xfeb0('0x65')]['id'];_0x4b6a93[_0xfeb0('0x66')]['id']=_0x2a58aa[_0xfeb0('0x5b')]['UserId'];return db[_0xfeb0('0x3e')]['find']({'where':{'id':_0x2a58aa[_0xfeb0('0x59')]['id'],'UserId':null}})[_0xfeb0('0x22')](handleEntityNotFound(_0x435dc8,null))[_0xfeb0('0x22')](function(_0x41d150){if(_0x41d150){_0x4b6a93[_0xfeb0('0x29')]=_0x41d150[_0xfeb0('0x67')]({'plain':!![]});return db[_0xfeb0('0x68')][_0xfeb0('0x5c')]({'where':{'id':_0x41d150[_0xfeb0('0x69')]}});}return null;})[_0xfeb0('0x22')](handleEntityNotFound(_0x435dc8,null))[_0xfeb0('0x22')](function(_0x40e2f8){if(_0x40e2f8){_0x4b6a93[_0xfeb0('0x6c')]=_0x40e2f8[_0xfeb0('0x67')]({'plain':!![]});interaction_log[_0xfeb0('0x23')](_0xfeb0('0x83'),_0x2a58aa['user']['id'],_0x2a58aa[_0xfeb0('0x65')][_0xfeb0('0x3a')],_0x2a58aa['user'][_0xfeb0('0x6e')],_0x4b6a93[_0xfeb0('0x6c')]['id'],_0x2a58aa['body']?JSON[_0xfeb0('0x27')](_0x2a58aa[_0xfeb0('0x5b')]):_0xfeb0('0x6f'));return respondWithRpcPromise(_0xfeb0('0x84'),_0xfeb0('0x85'),_0x4b6a93);}return null;})[_0xfeb0('0x22')](function(_0x56a2e6){var _0x2ed16c=_0xfeb0('0x72')+_0x56a2e6[_0xfeb0('0x29')][_0xfeb0('0x73')];return db[_0xfeb0('0x74')]['query'](_0x2ed16c,{'type':db[_0xfeb0('0x75')][_0xfeb0('0x76')][_0xfeb0('0x77')],'raw':!![]})[_0xfeb0('0x22')](function(_0x3e275a){return _0x3e275a;});})[_0xfeb0('0x22')](function(_0x727c2d){if(_0x727c2d){_0x4b6a93[_0xfeb0('0x29')][_0xfeb0('0x78')]=_0x727c2d[0x0];if(!_0x2a58aa[_0xfeb0('0x5b')][_0xfeb0('0x64')])return;return db['User'][_0xfeb0('0x5c')]({'where':{'id':_0x2a58aa['body'][_0xfeb0('0x64')],'role':'agent'},'attributes':['id',_0xfeb0('0x3a'),_0xfeb0('0x7a'),_0xfeb0('0x7b'),_0xfeb0('0x7c')],'raw':!![]});}return null;})['then'](function(_0x34fb6d){if(!_0x34fb6d)return null;_0x4b6a93['message'][_0xfeb0('0x66')]=_0x34fb6d;return _0x4b6a93;})[_0xfeb0('0x22')](function(_0x191146){if(_0x191146){_0x191146[_0xfeb0('0x29')][_0xfeb0('0x7d')]=util[_0xfeb0('0x63')]('SIP/%s',_0x2a58aa[_0xfeb0('0x65')][_0xfeb0('0x3a')]);_0x191146['message'][_0xfeb0('0x7e')]=_0x4b6a93[_0xfeb0('0x7e')];_0x191146[_0xfeb0('0x29')]['motionChannel']=_0x4b6a93[_0xfeb0('0x7e')];_0x191146[_0xfeb0('0x29')][_0xfeb0('0x86')]='reject';respondWithRpcPromise('EventManager',_0xfeb0('0x81'),{'event':_0xfeb0('0x87'),'message':_0x191146[_0xfeb0('0x29')]},client9002);return _0x4b6a93;}return null;})['then'](respondWithResult(_0x435dc8,null))[_0xfeb0('0x57')](handleError(_0x435dc8,null));};exports[_0xfeb0('0x2c')]=function(_0x58cdde,_0xd59620,_0x57acc7){if(_0x58cdde['body']['id']){delete _0x58cdde[_0xfeb0('0x5b')]['id'];}var _0x56a191;return db['SmsMessage']['find']({'where':{'id':_0x58cdde[_0xfeb0('0x59')]['id']}})[_0xfeb0('0x22')](handleEntityNotFound(_0xd59620,null))['then'](function(_0x5d4a02){if(_0x5d4a02){_0x56a191=_0x5d4a02;return db['SmsAccount']['find']({'where':{'id':_0x5d4a02[_0xfeb0('0x88')]}});}})[_0xfeb0('0x22')](handleEntityNotFound(_0xd59620,null))[_0xfeb0('0x22')](function(_0x3902d7){if(_0x3902d7){logger[_0xfeb0('0x25')](_0xfeb0('0x26'),_0xfeb0('0x2c'),'received\x20delivery\x20report\x20from',_0x3902d7[_0xfeb0('0x41')],util['inspect'](_0x58cdde[_0xfeb0('0x5b')],{'showHidden':![],'depth':null}));switch(_0x3902d7[_0xfeb0('0x41')]){case _0xfeb0('0x89'):if(_0x58cdde['body'][_0xfeb0('0x8a')]&&_0x58cdde['body'][_0xfeb0('0x8a')]===_0x56a191[_0xfeb0('0x8b')]){return _0x56a191[_0xfeb0('0x37')]({'read':!![]});}else{logger[_0xfeb0('0x28')](_0xfeb0('0x8c'),_0xfeb0('0x2c'),'twilio',util[_0xfeb0('0x8d')](_0x58cdde[_0xfeb0('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xfeb0('0x8e'):if(_0x58cdde[_0xfeb0('0x5b')]['MessageUUID']&&_0x58cdde['body'][_0xfeb0('0x8f')]===_0x56a191['messageId']&&_[_0xfeb0('0x90')]([_0xfeb0('0x91'),'delivered'],_0x58cdde['body'][_0xfeb0('0x92')])>=0x0){return _0x56a191[_0xfeb0('0x37')]({'read':!![]});}else{logger[_0xfeb0('0x28')](_0xfeb0('0x8c'),_0xfeb0('0x2c'),_0xfeb0('0x93'),util['inspect'](_0x58cdde['body'],{'showHidden':![],'depth':null}));}break;case _0xfeb0('0x94'):var _0x36e26e=_0x58cdde[_0xfeb0('0x5b')]['results'][0x0];if(_0x36e26e['status'][_0xfeb0('0x95')]===_0xfeb0('0x96')){return _0x56a191[_0xfeb0('0x37')]({'read':!![]});}else{logger[_0xfeb0('0x28')](_0xfeb0('0x8c'),_0xfeb0('0x2c'),_0xfeb0('0x94'),util[_0xfeb0('0x8d')](_0x58cdde[_0xfeb0('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x56a191;}})['then'](respondWithResult(_0xd59620,null))['catch'](handleError(_0xd59620,null));}; \ No newline at end of file +var _0xc7bd=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','register','jayson/promise','client','http','request','then','SmsMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','map','SmsMessage','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','options','create','body','find','describe','../../config/logger','sms-interactions','accept','sms','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','fullname','email','internal','manual','interface','format','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','User','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','results','groupName','DELIVERED','infobip','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x16fcdc,_0x1ea569){var _0x28f952=function(_0x307fce){while(--_0x307fce){_0x16fcdc['push'](_0x16fcdc['shift']());}};_0x28f952(++_0x1ea569);}(_0xc7bd,0x86));var _0xdc7b=function(_0x4bb2fb,_0x24d580){_0x4bb2fb=_0x4bb2fb-0x0;var _0xb41875=_0xc7bd[_0x4bb2fb];return _0xb41875;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdc7b('0x0'));var zipdir=require(_0xdc7b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdc7b('0x2'));var moment=require('moment');var BPromise=require(_0xdc7b('0x3'));var Mustache=require('mustache');var util=require(_0xdc7b('0x4'));var path=require(_0xdc7b('0x5'));var sox=require(_0xdc7b('0x6'));var csv=require(_0xdc7b('0x7'));var ejs=require(_0xdc7b('0x8'));var fs=require('fs');var fs_extra=require(_0xdc7b('0x9'));var _=require(_0xdc7b('0xa'));var squel=require('squel');var crypto=require(_0xdc7b('0xb'));var jsforce=require(_0xdc7b('0xc'));var deskjs=require(_0xdc7b('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdc7b('0xe'));var Redis=require(_0xdc7b('0xf'));var authService=require(_0xdc7b('0x10'));var qs=require(_0xdc7b('0x11'));var as=require(_0xdc7b('0x12'));var hardwareService=require(_0xdc7b('0x13'));var logger=require('../../config/logger')(_0xdc7b('0x14'));var utils=require(_0xdc7b('0x15'));var config=require(_0xdc7b('0x16'));var licenseUtil=require(_0xdc7b('0x17'));var db=require(_0xdc7b('0x18'))['db'];config[_0xdc7b('0x19')]=_['defaults'](config[_0xdc7b('0x19')],{'host':_0xdc7b('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdc7b('0x19')]));require('./smsMessage.socket')[_0xdc7b('0x1b')](socket);var jayson=require(_0xdc7b('0x1c'));var client=jayson[_0xdc7b('0x1d')][_0xdc7b('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0xdc7b('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x2088f1,_0x5e0281,_0x35c671,_0x12b8ca){return new BPromise(function(_0xefe69c,_0x2ed99d){var _0x19b289=_0x12b8ca||client;return _0x19b289[_0xdc7b('0x1f')](_0x2088f1,_0x35c671)[_0xdc7b('0x20')](function(_0x25334e){logger['info'](_0xdc7b('0x21'),_0x5e0281,'request\x20sent');logger[_0xdc7b('0x22')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5e0281,_0xdc7b('0x23'),JSON[_0xdc7b('0x24')](_0x25334e));if(_0x25334e[_0xdc7b('0x25')]){if(_0x25334e[_0xdc7b('0x25')][_0xdc7b('0x26')]===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x5e0281,_0x25334e['error'][_0xdc7b('0x27')]);return _0x2ed99d(_0x25334e[_0xdc7b('0x25')]['message']);}logger[_0xdc7b('0x25')](_0xdc7b('0x21'),_0x5e0281,_0x25334e[_0xdc7b('0x25')]['message']);return _0xefe69c(_0x25334e[_0xdc7b('0x25')]['message']);}else{logger[_0xdc7b('0x28')](_0xdc7b('0x21'),_0x5e0281,_0xdc7b('0x23'));_0xefe69c(_0x25334e[_0xdc7b('0x29')][_0xdc7b('0x27')]);}})[_0xdc7b('0x2a')](function(_0x10c260){logger[_0xdc7b('0x25')](_0xdc7b('0x21'),_0x5e0281,_0x10c260);_0x2ed99d(_0x10c260);});});}function respondWithStatusCode(_0x5b6ad7,_0x1c1eaf){_0x1c1eaf=_0x1c1eaf||0xcc;return function(_0x48189d){if(_0x48189d){return _0x5b6ad7[_0xdc7b('0x2b')](_0x1c1eaf);}return _0x5b6ad7[_0xdc7b('0x2c')](_0x1c1eaf)['end']();};}function respondWithResult(_0x30b37d,_0x5be3e4){_0x5be3e4=_0x5be3e4||0xc8;return function(_0x4525d4){if(_0x4525d4){return _0x30b37d[_0xdc7b('0x2c')](_0x5be3e4)[_0xdc7b('0x2d')](_0x4525d4);}};}function respondWithFilteredResult(_0x5bbe04,_0x2eb566){return function(_0x102288){if(_0x102288){var _0x2cfd85=typeof _0x2eb566[_0xdc7b('0x2e')]===_0xdc7b('0x2f')&&typeof _0x2eb566['limit']===_0xdc7b('0x2f');var _0x1f795d=_0x102288[_0xdc7b('0x30')];var _0x2d493d=_0x2cfd85?0x0:_0x2eb566['offset'];var _0x102731=_0x2cfd85?_0x102288[_0xdc7b('0x30')]:_0x2eb566[_0xdc7b('0x2e')]+_0x2eb566[_0xdc7b('0x31')];var _0x4ad851;if(_0x102731>=_0x1f795d){_0x102731=_0x1f795d;_0x4ad851=0xc8;}else{_0x4ad851=0xce;}_0x5bbe04[_0xdc7b('0x2c')](_0x4ad851);return _0x5bbe04[_0xdc7b('0x32')](_0xdc7b('0x33'),_0x2d493d+'-'+_0x102731+'/'+_0x1f795d)[_0xdc7b('0x2d')](_0x102288);}return null;};}function patchUpdates(_0x195d45){return function(_0x571e32){try{jsonpatch[_0xdc7b('0x34')](_0x571e32,_0x195d45,!![]);}catch(_0x5a4468){return BPromise[_0xdc7b('0x35')](_0x5a4468);}return _0x571e32[_0xdc7b('0x36')]();};}function saveUpdates(_0x41d6cd,_0x533047){return function(_0x37cfac){if(_0x37cfac){return _0x37cfac[_0xdc7b('0x37')](_0x41d6cd)[_0xdc7b('0x20')](function(_0x4b03f0){return _0x4b03f0;});}return null;};}function removeEntity(_0x1fe37e,_0x3d73c1){return function(_0x5c3a6c){if(_0x5c3a6c){return _0x5c3a6c[_0xdc7b('0x38')]()['then'](function(){_0x1fe37e[_0xdc7b('0x2c')](0xcc)[_0xdc7b('0x39')]();});}};}function handleEntityNotFound(_0x535f69,_0x338447){return function(_0x5a1ac0){if(!_0x5a1ac0){_0x535f69[_0xdc7b('0x2b')](0x194);}return _0x5a1ac0;};}function handleError(_0xce2413,_0x14138d){_0x14138d=_0x14138d||0x1f4;return function(_0x1fc5f6){logger[_0xdc7b('0x25')](_0x1fc5f6[_0xdc7b('0x3a')]);if(_0x1fc5f6['name']){delete _0x1fc5f6[_0xdc7b('0x3b')];}_0xce2413[_0xdc7b('0x2c')](_0x14138d)[_0xdc7b('0x3c')](_0x1fc5f6);};}exports['index']=function(_0x5dc9d5,_0x53e502){var _0x36c272={},_0x3038b5={},_0x3e5007={'count':0x0,'rows':[]};var _0x162b4e=_[_0xdc7b('0x3d')](db[_0xdc7b('0x3e')][_0xdc7b('0x3f')],function(_0x239ffe){return{'name':_0x239ffe[_0xdc7b('0x40')],'type':_0x239ffe[_0xdc7b('0x41')]['key']};});_0x3038b5[_0xdc7b('0x42')]=_[_0xdc7b('0x3d')](_0x162b4e,'name');_0x3038b5['query']=_[_0xdc7b('0x43')](_0x5dc9d5[_0xdc7b('0x44')]);_0x3038b5[_0xdc7b('0x45')]=_[_0xdc7b('0x46')](_0x3038b5[_0xdc7b('0x42')],_0x3038b5[_0xdc7b('0x44')]);_0x36c272[_0xdc7b('0x47')]=_[_0xdc7b('0x46')](_0x3038b5[_0xdc7b('0x42')],qs[_0xdc7b('0x48')](_0x5dc9d5['query'][_0xdc7b('0x48')]));_0x36c272[_0xdc7b('0x47')]=_0x36c272[_0xdc7b('0x47')]['length']?_0x36c272[_0xdc7b('0x47')]:_0x3038b5[_0xdc7b('0x42')];if(!_0x5dc9d5[_0xdc7b('0x44')][_0xdc7b('0x49')](_0xdc7b('0x4a'))){_0x36c272[_0xdc7b('0x31')]=qs[_0xdc7b('0x31')](_0x5dc9d5[_0xdc7b('0x44')][_0xdc7b('0x31')]);_0x36c272[_0xdc7b('0x2e')]=qs['offset'](_0x5dc9d5[_0xdc7b('0x44')][_0xdc7b('0x2e')]);}_0x36c272[_0xdc7b('0x4b')]=qs[_0xdc7b('0x4c')](_0x5dc9d5[_0xdc7b('0x44')]['sort']);_0x36c272[_0xdc7b('0x4d')]=qs[_0xdc7b('0x45')](_[_0xdc7b('0x4e')](_0x5dc9d5['query'],_0x3038b5[_0xdc7b('0x45')]),_0x162b4e);if(_0x5dc9d5[_0xdc7b('0x44')][_0xdc7b('0x4f')]){_0x36c272[_0xdc7b('0x4d')]=_['merge'](_0x36c272['where'],{'$or':_[_0xdc7b('0x3d')](_0x162b4e,function(_0x4ea569){if(_0x4ea569['type']!==_0xdc7b('0x50')){var _0xb3a171={};_0xb3a171[_0x4ea569[_0xdc7b('0x3b')]]={'$like':'%'+_0x5dc9d5[_0xdc7b('0x44')][_0xdc7b('0x4f')]+'%'};return _0xb3a171;}})});}_0x36c272=_[_0xdc7b('0x51')]({},_0x36c272,_0x5dc9d5['options']);var _0x5f2349={'where':_0x36c272[_0xdc7b('0x4d')]};return db[_0xdc7b('0x3e')][_0xdc7b('0x30')](_0x5f2349)[_0xdc7b('0x20')](function(_0x2dfd57){_0x3e5007[_0xdc7b('0x30')]=_0x2dfd57;if(_0x5dc9d5[_0xdc7b('0x44')][_0xdc7b('0x52')]){_0x36c272[_0xdc7b('0x53')]=[{'all':!![]}];}return db[_0xdc7b('0x3e')][_0xdc7b('0x54')](_0x36c272);})['then'](function(_0x33cc3c){_0x3e5007[_0xdc7b('0x55')]=_0x33cc3c;return _0x3e5007;})['then'](respondWithFilteredResult(_0x53e502,_0x36c272))['catch'](handleError(_0x53e502,null));};exports[_0xdc7b('0x56')]=function(_0x3a6b7f,_0x1c063e){var _0x227a68={'raw':!![],'where':{'id':_0x3a6b7f[_0xdc7b('0x57')]['id']}},_0x425de5={};_0x425de5[_0xdc7b('0x42')]=_[_0xdc7b('0x43')](db['SmsMessage']['rawAttributes']);_0x425de5[_0xdc7b('0x44')]=_[_0xdc7b('0x43')](_0x3a6b7f[_0xdc7b('0x44')]);_0x425de5['filters']=_['intersection'](_0x425de5[_0xdc7b('0x42')],_0x425de5[_0xdc7b('0x44')]);_0x227a68['attributes']=_[_0xdc7b('0x46')](_0x425de5[_0xdc7b('0x42')],qs['fields'](_0x3a6b7f[_0xdc7b('0x44')][_0xdc7b('0x48')]));_0x227a68[_0xdc7b('0x47')]=_0x227a68[_0xdc7b('0x47')]['length']?_0x227a68[_0xdc7b('0x47')]:_0x425de5[_0xdc7b('0x42')];if(_0x3a6b7f[_0xdc7b('0x44')][_0xdc7b('0x52')]){_0x227a68[_0xdc7b('0x53')]=[{'all':!![]}];}_0x227a68=_[_0xdc7b('0x51')]({},_0x227a68,_0x3a6b7f[_0xdc7b('0x58')]);return db[_0xdc7b('0x3e')]['find'](_0x227a68)[_0xdc7b('0x20')](handleEntityNotFound(_0x1c063e,null))[_0xdc7b('0x20')](respondWithResult(_0x1c063e,null))[_0xdc7b('0x2a')](handleError(_0x1c063e,null));};exports[_0xdc7b('0x59')]=function(_0x38d694,_0x587c24){return db[_0xdc7b('0x3e')][_0xdc7b('0x59')](_0x38d694[_0xdc7b('0x5a')],{})[_0xdc7b('0x20')](respondWithResult(_0x587c24,0xc9))[_0xdc7b('0x2a')](handleError(_0x587c24,null));};exports[_0xdc7b('0x37')]=function(_0x12937e,_0x3e8a91){if(_0x12937e['body']['id']){delete _0x12937e[_0xdc7b('0x5a')]['id'];}return db[_0xdc7b('0x3e')][_0xdc7b('0x5b')]({'where':{'id':_0x12937e[_0xdc7b('0x57')]['id']}})[_0xdc7b('0x20')](handleEntityNotFound(_0x3e8a91,null))[_0xdc7b('0x20')](saveUpdates(_0x12937e[_0xdc7b('0x5a')],null))[_0xdc7b('0x20')](respondWithResult(_0x3e8a91,null))[_0xdc7b('0x2a')](handleError(_0x3e8a91,null));};exports[_0xdc7b('0x38')]=function(_0x350111,_0x242dba){return db['SmsMessage'][_0xdc7b('0x5b')]({'where':{'id':_0x350111['params']['id']}})[_0xdc7b('0x20')](handleEntityNotFound(_0x242dba,null))[_0xdc7b('0x20')](removeEntity(_0x242dba,null))['catch'](handleError(_0x242dba,null));};exports[_0xdc7b('0x5c')]=function(_0xd13ed5,_0x383d83){return db[_0xdc7b('0x3e')][_0xdc7b('0x5c')]()[_0xdc7b('0x20')](respondWithResult(_0x383d83,null))[_0xdc7b('0x2a')](handleError(_0x383d83,null));};var interaction_log=require(_0xdc7b('0x5d'))(_0xdc7b('0x5e'));exports[_0xdc7b('0x5f')]=function(_0xa6471c,_0x1d6dad,_0x47dc98){var _0x59a484={'agent':{},'channel':_0xdc7b('0x60')};if(_0xa6471c[_0xdc7b('0x5a')]['id']){delete _0xa6471c['body']['id'];}_0xa6471c['body']['read']=!![];_0xa6471c[_0xdc7b('0x5a')][_0xdc7b('0x61')]=moment()['format'](_0xdc7b('0x62'));_0xa6471c[_0xdc7b('0x5a')][_0xdc7b('0x63')]=_0xa6471c[_0xdc7b('0x5a')][_0xdc7b('0x63')]||_0xa6471c[_0xdc7b('0x64')]['id'];_0x59a484[_0xdc7b('0x65')]['id']=_0xa6471c[_0xdc7b('0x5a')][_0xdc7b('0x63')];return db[_0xdc7b('0x3e')][_0xdc7b('0x5b')]({'where':{'id':_0xa6471c['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1d6dad,null))[_0xdc7b('0x20')](saveUpdates(_0xa6471c['body'],null))[_0xdc7b('0x20')](function(_0xc507c6){if(_0xc507c6){_0x59a484['message']=_0xc507c6[_0xdc7b('0x66')]({'plain':!![]});return db['SmsInteraction'][_0xdc7b('0x5b')]({'where':{'id':_0xc507c6[_0xdc7b('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x1d6dad,null))[_0xdc7b('0x20')](function(_0x2f21c4){if(_0x2f21c4){return _0x2f21c4[_0xdc7b('0x37')]({'UserId':_0xa6471c[_0xdc7b('0x5a')][_0xdc7b('0x63')],'read1stAt':_[_0xdc7b('0x68')](_0x2f21c4[_0xdc7b('0x69')])?moment()['format'](_0xdc7b('0x62')):undefined});}return null;})[_0xdc7b('0x20')](function(_0x555b23){if(_0x555b23){_0x59a484[_0xdc7b('0x6a')]=_0x555b23[_0xdc7b('0x66')]({'plain':!![]});interaction_log['info'](_0xdc7b('0x6b'),_0xa6471c[_0xdc7b('0x64')]['id'],_0xa6471c['user'][_0xdc7b('0x3b')],_0xa6471c['user']['role'],_0x59a484[_0xdc7b('0x6a')]['id'],_0xa6471c[_0xdc7b('0x5a')]?JSON[_0xdc7b('0x24')](_0xa6471c[_0xdc7b('0x5a')]):_0xdc7b('0x6c'));return respondWithRpcPromise('AcceptMessage',_0xdc7b('0x6d'),_0x59a484);}return null;})['then'](function(_0x50c80c){var _0x353af4=_0xdc7b('0x6e')+_0x50c80c[_0xdc7b('0x27')][_0xdc7b('0x6f')];return db[_0xdc7b('0x70')][_0xdc7b('0x44')](_0x353af4,{'type':db[_0xdc7b('0x71')][_0xdc7b('0x72')][_0xdc7b('0x73')],'raw':!![]})[_0xdc7b('0x20')](function(_0x45ee01){return _0x45ee01;});})[_0xdc7b('0x20')](function(_0x1ef6dd){if(_0x1ef6dd){_0x59a484['message']['contact']=_0x1ef6dd[0x0];if(!_0xa6471c[_0xdc7b('0x5a')][_0xdc7b('0x63')])return;return db['User'][_0xdc7b('0x5b')]({'where':{'id':_0xa6471c['body'][_0xdc7b('0x63')],'role':_0xdc7b('0x65')},'attributes':['id',_0xdc7b('0x3b'),_0xdc7b('0x74'),_0xdc7b('0x75'),_0xdc7b('0x76')],'raw':!![]});}return null;})[_0xdc7b('0x20')](function(_0x842451){if(!_0x842451)return null;_0x59a484[_0xdc7b('0x27')][_0xdc7b('0x65')]=_0x842451;return _0x59a484;})['then'](function(_0x24639e){if(_0x24639e){if(_0xa6471c['body'][_0xdc7b('0x77')]){_0x59a484[_0xdc7b('0x27')][_0xdc7b('0x78')]=util[_0xdc7b('0x79')](_0xdc7b('0x7a'),_0xa6471c['user'][_0xdc7b('0x3b')]);_0x59a484['message'][_0xdc7b('0x7b')]=_0x59a484[_0xdc7b('0x7b')];_0x59a484['message'][_0xdc7b('0x7c')]=_0x59a484[_0xdc7b('0x7b')];_0x59a484['message'][_0xdc7b('0x7d')]='accept';return respondWithRpcPromise(_0xdc7b('0x7e'),'EventManager',{'event':_0xdc7b('0x7f'),'message':_0x59a484[_0xdc7b('0x27')]},client9002)[_0xdc7b('0x20')](function(){return _0x59a484;});}return _0x59a484;}return null;})[_0xdc7b('0x20')](respondWithResult(_0x1d6dad,null))['catch'](handleError(_0x1d6dad,null));};var interaction_log=require(_0xdc7b('0x5d'))(_0xdc7b('0x5e'));exports[_0xdc7b('0x35')]=function(_0x472138,_0x52a29f,_0x3e8d8b){var _0x18a690={'agent':{},'channel':'sms'};if(_0x472138[_0xdc7b('0x5a')]['id']){delete _0x472138[_0xdc7b('0x5a')]['id'];}_0x472138['body'][_0xdc7b('0x63')]=_0x472138[_0xdc7b('0x5a')][_0xdc7b('0x63')]||_0x472138['user']['id'];_0x18a690[_0xdc7b('0x65')]['id']=_0x472138['body'][_0xdc7b('0x63')];return db['SmsMessage']['find']({'where':{'id':_0x472138[_0xdc7b('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x52a29f,null))['then'](function(_0x438afd){if(_0x438afd){_0x18a690['message']=_0x438afd[_0xdc7b('0x66')]({'plain':!![]});return db[_0xdc7b('0x80')][_0xdc7b('0x5b')]({'where':{'id':_0x438afd[_0xdc7b('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x52a29f,null))[_0xdc7b('0x20')](function(_0x28bbc1){if(_0x28bbc1){_0x18a690[_0xdc7b('0x6a')]=_0x28bbc1[_0xdc7b('0x66')]({'plain':!![]});interaction_log['info'](_0xdc7b('0x81'),_0x472138['user']['id'],_0x472138['user']['name'],_0x472138[_0xdc7b('0x64')][_0xdc7b('0x82')],_0x18a690[_0xdc7b('0x6a')]['id'],_0x472138['body']?JSON[_0xdc7b('0x24')](_0x472138[_0xdc7b('0x5a')]):_0xdc7b('0x6c'));return respondWithRpcPromise('RejectMessage',_0xdc7b('0x83'),_0x18a690);}return null;})[_0xdc7b('0x20')](function(_0x5da655){var _0x51ae68='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5da655[_0xdc7b('0x27')][_0xdc7b('0x6f')];return db['sequelize'][_0xdc7b('0x44')](_0x51ae68,{'type':db[_0xdc7b('0x71')][_0xdc7b('0x72')][_0xdc7b('0x73')],'raw':!![]})[_0xdc7b('0x20')](function(_0x1943a8){return _0x1943a8;});})[_0xdc7b('0x20')](function(_0x34f4d9){if(_0x34f4d9){_0x18a690[_0xdc7b('0x27')]['contact']=_0x34f4d9[0x0];if(!_0x472138['body'][_0xdc7b('0x63')])return;return db[_0xdc7b('0x84')][_0xdc7b('0x5b')]({'where':{'id':_0x472138['body'][_0xdc7b('0x63')],'role':_0xdc7b('0x65')},'attributes':['id',_0xdc7b('0x3b'),_0xdc7b('0x74'),_0xdc7b('0x75'),_0xdc7b('0x76')],'raw':!![]});}return null;})[_0xdc7b('0x20')](function(_0x44cc4c){if(!_0x44cc4c)return null;_0x18a690[_0xdc7b('0x27')][_0xdc7b('0x65')]=_0x44cc4c;return _0x18a690;})['then'](function(_0x4d474b){if(_0x4d474b){_0x4d474b[_0xdc7b('0x27')][_0xdc7b('0x78')]=util[_0xdc7b('0x79')](_0xdc7b('0x7a'),_0x472138[_0xdc7b('0x64')][_0xdc7b('0x3b')]);_0x4d474b[_0xdc7b('0x27')][_0xdc7b('0x7b')]=_0x18a690['channel'];_0x4d474b[_0xdc7b('0x27')][_0xdc7b('0x7c')]=_0x18a690[_0xdc7b('0x7b')];_0x4d474b[_0xdc7b('0x27')][_0xdc7b('0x7d')]=_0xdc7b('0x35');respondWithRpcPromise('EventManager',_0xdc7b('0x7e'),{'event':_0xdc7b('0x85'),'message':_0x4d474b[_0xdc7b('0x27')]},client9002);return _0x18a690;}return null;})['then'](respondWithResult(_0x52a29f,null))[_0xdc7b('0x2a')](handleError(_0x52a29f,null));};exports[_0xdc7b('0x2c')]=function(_0x54d0bb,_0x525099,_0x58f693){if(_0x54d0bb['body']['id']){delete _0x54d0bb[_0xdc7b('0x5a')]['id'];}var _0x20f062;return db[_0xdc7b('0x3e')][_0xdc7b('0x5b')]({'where':{'id':_0x54d0bb[_0xdc7b('0x57')]['id']}})[_0xdc7b('0x20')](handleEntityNotFound(_0x525099,null))[_0xdc7b('0x20')](function(_0x1bdca2){if(_0x1bdca2){_0x20f062=_0x1bdca2;return db[_0xdc7b('0x86')][_0xdc7b('0x5b')]({'where':{'id':_0x1bdca2[_0xdc7b('0x87')]}});}})[_0xdc7b('0x20')](handleEntityNotFound(_0x525099,null))[_0xdc7b('0x20')](function(_0x8501da){if(_0x8501da){logger[_0xdc7b('0x22')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xdc7b('0x2c'),_0xdc7b('0x88'),_0x8501da['type'],util[_0xdc7b('0x89')](_0x54d0bb[_0xdc7b('0x5a')],{'showHidden':![],'depth':null}));switch(_0x8501da[_0xdc7b('0x41')]){case _0xdc7b('0x8a'):if(_0x54d0bb[_0xdc7b('0x5a')][_0xdc7b('0x8b')]&&_0x54d0bb[_0xdc7b('0x5a')][_0xdc7b('0x8b')]===_0x20f062[_0xdc7b('0x8c')]){return _0x20f062[_0xdc7b('0x37')]({'read':!![]});}else{logger[_0xdc7b('0x25')](_0xdc7b('0x8d'),_0xdc7b('0x2c'),'twilio',util['inspect'](_0x54d0bb[_0xdc7b('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xdc7b('0x8e'):if(_0x54d0bb[_0xdc7b('0x5a')][_0xdc7b('0x8f')]&&_0x54d0bb[_0xdc7b('0x5a')][_0xdc7b('0x8f')]===_0x20f062['messageId']&&_[_0xdc7b('0x90')]([_0xdc7b('0x91'),_0xdc7b('0x92')],_0x54d0bb[_0xdc7b('0x5a')][_0xdc7b('0x93')])>=0x0){return _0x20f062[_0xdc7b('0x37')]({'read':!![]});}else{logger[_0xdc7b('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xdc7b('0x2c'),'plivio',util[_0xdc7b('0x89')](_0x54d0bb['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x32df27=_0x54d0bb[_0xdc7b('0x5a')][_0xdc7b('0x94')][0x0];if(_0x32df27[_0xdc7b('0x2c')][_0xdc7b('0x95')]===_0xdc7b('0x96')){return _0x20f062['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xdc7b('0x2c'),_0xdc7b('0x97'),util[_0xdc7b('0x89')](_0x54d0bb[_0xdc7b('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x20f062;}})[_0xdc7b('0x20')](respondWithResult(_0x525099,null))[_0xdc7b('0x2a')](handleError(_0x525099,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 1dc3270..8129658 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 _0x75fe=['hasOwnProperty','hook','exports','events','setMaxListeners','save','update','remove','emit'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x75fe,0x162));var _0xe75f=function(_0x2930b8,_0x2e1d8b){_0x2930b8=_0x2930b8-0x0;var _0x3711bc=_0x75fe[_0x2930b8];return _0x3711bc;};'use strict';var EventEmitter=require(_0xe75f('0x0'));var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xe75f('0x1')](0x0);var events={'afterCreate':_0xe75f('0x2'),'afterUpdate':_0xe75f('0x3'),'afterDestroy':_0xe75f('0x4')};function emitEvent(_0xe043c){return function(_0x3b7848,_0x584cb7,_0x23937a){SmsMessageEvents['emit'](_0xe043c+':'+_0x3b7848['id'],_0x3b7848);SmsMessageEvents[_0xe75f('0x5')](_0xe043c,_0x3b7848);_0x23937a(null);};}for(var e in events){if(events[_0xe75f('0x6')](e)){var event=events[e];SmsMessage[_0xe75f('0x7')](e,emitEvent(event));}}module[_0xe75f('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0x91f3=['SmsMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x57eb2d,_0x5e4918){var _0xd8e18=function(_0x189389){while(--_0x189389){_0x57eb2d['push'](_0x57eb2d['shift']());}};_0xd8e18(++_0x5e4918);}(_0x91f3,0x76));var _0x391f=function(_0x44b6f8,_0x302591){_0x44b6f8=_0x44b6f8-0x0;var _0x32b459=_0x91f3[_0x44b6f8];return _0x32b459;};'use strict';var EventEmitter=require(_0x391f('0x0'));var SmsMessage=require(_0x391f('0x1'))['db'][_0x391f('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x391f('0x3')](0x0);var events={'afterCreate':_0x391f('0x4'),'afterUpdate':_0x391f('0x5'),'afterDestroy':_0x391f('0x6')};function emitEvent(_0x34a03a){return function(_0x489d54,_0x48945f,_0x1389b0){SmsMessageEvents[_0x391f('0x7')](_0x34a03a+':'+_0x489d54['id'],_0x489d54);SmsMessageEvents[_0x391f('0x7')](_0x34a03a,_0x489d54);_0x1389b0(null);};}for(var e in events){if(events[_0x391f('0x8')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x391f('0x9')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 386ce90..7d375d9 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 _0x5ef0=['exports','define','messageId','fti_sms_messages','get','direction','toLowerCase','out','secret','isNil','SmsInteraction','findOne','SmsInteractionId','then','createdAt','catch','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','create','remote','/api/sms/messages/','/status?token=','token','sid','update','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','sms','POST','session_key','total_sent','internal_order_id','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','clicksend','xCALLY\x20Motion','body','%s:%s','https://rest.clicksend.com/v3/sms/send','format','base64','http_code','queued_count','head','data','messages','deliveryReport','clickSend','authId','https://api.plivo.com/v1/Account/%s/Message/','toString','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','application/json','Missing\x20parameters:\x20base_url','csc','login','text','length','apiKey','createHash','md5','digest','hex','signature=','/external/get/send.php?','id_sms','clickatell','https://platform.clickatell.com/messages','UTF-8','apiMessageId','Missing\x20parameters:\x20apiKey','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','Basic\x20%s','bandwidth','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','intelepeer','Token\x20not\x20received','finally','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsMessage.attributes'];(function(_0x3fc1ad,_0x4ab661){var _0x2019d8=function(_0x17b5bd){while(--_0x17b5bd){_0x3fc1ad['push'](_0x3fc1ad['shift']());}};_0x2019d8(++_0x4ab661);}(_0x5ef0,0x1df));var _0x05ef=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5ef0[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x05ef('0x0'));var util=require('util');var logger=require(_0x05ef('0x1'))(_0x05ef('0x2'));var moment=require(_0x05ef('0x3'));var BPromise=require(_0x05ef('0x4'));var rp=require(_0x05ef('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x05ef('0x6'));var config=require(_0x05ef('0x7'));var attributes=require(_0x05ef('0x8'));module[_0x05ef('0x9')]=function(_0x2654cc,_0xfcc879){return _0x2654cc[_0x05ef('0xa')]('SmsMessage',attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x05ef('0xb'),'fields':['messageId']},{'name':_0x05ef('0xc'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x6f0a61,_0x329367,_0x2503fa){var _0x12f1e7=_0x2654cc['models'];var _0x7a19=_0x6f0a61[_0x05ef('0xd')]({'plain':!![]});if(_0x7a19[_0x05ef('0xe')][_0x05ef('0xf')]()==='in'||_0x7a19[_0x05ef('0xe')][_0x05ef('0xf')]()===_0x05ef('0x10')&&!_0x7a19[_0x05ef('0x11')]&&!_['isNil'](_0x7a19['UserId'])&&!_[_0x05ef('0x12')](_0x7a19['SmsInteractionId'])){_0x12f1e7[_0x05ef('0x13')][_0x05ef('0x14')]({'where':{'id':_0x7a19[_0x05ef('0x15')]}})[_0x05ef('0x16')](function(_0x416d98){if(_0x416d98){_0x416d98['update']({'lastMsgAt':_0x7a19[_0x05ef('0x17')],'lastMsgDirection':_0x7a19['direction'][_0x05ef('0xf')]()});}})[_0x05ef('0x18')](function(_0x3abec1){console[_0x05ef('0x19')](_0x3abec1);});}if(_0x7a19['direction']==='out'&&!_0x7a19[_0x05ef('0x11')]){var _0x5f0a24;_0x12f1e7[_0x05ef('0x1a')][_0x05ef('0x1b')]({'where':{'id':_0x7a19[_0x05ef('0x1c')]},'raw':!![]})[_0x05ef('0x16')](function(_0x446bf1){_0x5f0a24=_0x446bf1;if(_0x5f0a24&&_0x5f0a24[_0x05ef('0x1d')]){switch(_0x5f0a24[_0x05ef('0x1d')]){case _0x05ef('0x1e'):var _0x808ab7=require('twilio');if(_0x5f0a24[_0x05ef('0x1f')]&&_0x5f0a24[_0x05ef('0x20')]&&_0x5f0a24[_0x05ef('0x21')]){var _0xa4e86c=new _0x808ab7(_0x5f0a24[_0x05ef('0x1f')],_0x5f0a24[_0x05ef('0x20')]);_0xa4e86c['messages'][_0x05ef('0x22')]({'body':_0x7a19['body'],'to':_0x7a19[_0x05ef('0x21')],'from':_0x5f0a24[_0x05ef('0x21')],'statusCallback':_0x5f0a24[_0x05ef('0x23')]+_0x05ef('0x24')+_0x7a19['id']+_0x05ef('0x25')+_0x5f0a24[_0x05ef('0x26')]})['then'](function(_0xc9e80c){if(_0xc9e80c[_0x05ef('0x27')]){return _0x6f0a61[_0x05ef('0x28')]({'messageId':_0xc9e80c[_0x05ef('0x27')]});}})[_0x05ef('0x18')](function(_0x11d1d3){logger[_0x05ef('0x19')](_0x05ef('0x29'),_0x05ef('0x2a'),_0x05ef('0x1e'),util[_0x05ef('0x2b')](_0x11d1d3,{'showHidden':![],'depth':null}));});}else{logger[_0x05ef('0x19')](_0x05ef('0x29'),_0x05ef('0x2a'),'twilio',_0x05ef('0x2c'));}break;case _0x05ef('0x2d'):var _0x210879=_0x05ef('0x2e');if(_0x5f0a24[_0x05ef('0x2f')]&&_0x5f0a24[_0x05ef('0x30')]){var _0x189b15={'recipient':[_0x7a19[_0x05ef('0x21')]],'message':_0x7a19['body'],'message_type':_0x5f0a24['smsMethod']};if(_0x5f0a24[_0x05ef('0x31')]&&_0x5f0a24[_0x05ef('0x31')]!=='SI'){_0x189b15[_0x05ef('0x32')]=_0x5f0a24[_0x05ef('0x21')];}var _0x12568b={'url':_0x210879+_0x05ef('0x33')+_0x5f0a24[_0x05ef('0x2f')]+_0x05ef('0x34')+_0x5f0a24[_0x05ef('0x30')],'method':_0x05ef('0x35')};rp(_0x12568b)[_0x05ef('0x16')](function(_0x508e55){var _0x4b3a54=_0x508e55['split'](';');var _0x2b074e={'user_key':_0x4b3a54[0x0],'session_key':_0x4b3a54[0x1]};_0x12568b={'url':_0x210879+_0x05ef('0x36'),'method':_0x05ef('0x37'),'headers':{'user_key':_0x2b074e['user_key'],'Session_key':_0x2b074e[_0x05ef('0x38')]},'json':!![],'body':_0x189b15};return rp(_0x12568b);})[_0x05ef('0x16')](function(_0x4d81d7){if(_0x4d81d7[_0x05ef('0x39')]>=0x1){var _0x55f206={'messageId':_0x4d81d7[_0x05ef('0x3a')]};if(_0x5f0a24[_0x05ef('0x31')]!=='GP'||!_0x5f0a24['deliveryReport']){_0x55f206[_0x05ef('0x3b')]=!![];}return _0x6f0a61[_0x05ef('0x28')](_0x55f206);}else{return logger[_0x05ef('0x19')](_0x05ef('0x29'),_0x05ef('0x2a'),'skebby',util[_0x05ef('0x2b')](_0x4d81d7,{'showHidden':![],'depth':null}));}})[_0x05ef('0x18')](function(_0x5f2402){return logger[_0x05ef('0x19')](_0x05ef('0x29'),_0x05ef('0x2a'),'skebby',util[_0x05ef('0x2b')](_0x5f2402,{'showHidden':![],'depth':null}));});}else{logger[_0x05ef('0x19')](_0x05ef('0x29'),_0x05ef('0x2a'),_0x05ef('0x2d'),_0x05ef('0x3c'));}break;case _0x05ef('0x3d'):if(_0x5f0a24['authToken']){var _0x106910={'recipient':_0x7a19[_0x05ef('0x21')],'message':_0x7a19['body'],'sender':_0x5f0a24[_0x05ef('0x3e')]||_0x5f0a24[_0x05ef('0x21')],'authorization':_0x5f0a24[_0x05ef('0x20')]};var _0x329367={'method':_0x05ef('0x37'),'uri':_0x05ef('0x3f'),'body':_0x106910,'json':!![]};rp(_0x329367)[_0x05ef('0x16')](function(_0x46b262){var _0x48aa59={'messageId':_0x46b262[_0x05ef('0x40')]};if(!_0x5f0a24['deliveryReport']){_0x48aa59[_0x05ef('0x3b')]=!![];}return _0x6f0a61[_0x05ef('0x28')](_0x48aa59);})[_0x05ef('0x18')](function(_0x43775a){logger[_0x05ef('0x19')](_0x05ef('0x29'),_0x05ef('0x2a'),'connectel',util[_0x05ef('0x2b')](_0x43775a,{'showHidden':![],'depth':null}));});}else{logger[_0x05ef('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x05ef('0x2a'),'connectel','Missing\x20parameters:\x20authToken');}break;case _0x05ef('0x41'):if(_0x5f0a24['username']&&_0x5f0a24[_0x05ef('0x30')]){var _0x106910={'messages':[{'source':_0x05ef('0x42'),'to':_0x7a19[_0x05ef('0x21')],'body':_0x7a19[_0x05ef('0x43')],'from':_0x5f0a24[_0x05ef('0x3e')]||_0x5f0a24[_0x05ef('0x21')]}]};var _0x5c8970=util['format'](_0x05ef('0x44'),_0x5f0a24[_0x05ef('0x2f')],_0x5f0a24[_0x05ef('0x30')]);var _0x329367={'method':_0x05ef('0x37'),'uri':_0x05ef('0x45'),'body':_0x106910,'headers':{'Authorization':util[_0x05ef('0x46')]('Basic\x20%s',new Buffer(_0x5c8970)['toString'](_0x05ef('0x47')))},'json':!![]};rp(_0x329367)[_0x05ef('0x16')](function(_0x57766c){if(_0x57766c[_0x05ef('0x48')]>=0xc8&&_0x57766c[_0x05ef('0x48')]<=0xce){if(_0x57766c['data']&&_0x57766c['data'][_0x05ef('0x49')]>0x0){var _0x571d19=_[_0x05ef('0x4a')](_0x57766c[_0x05ef('0x4b')][_0x05ef('0x4c')]);var _0x4797e6={'messageId':_0x571d19['message_id']};if(!_0x5f0a24[_0x05ef('0x4d')]){_0x4797e6[_0x05ef('0x3b')]=!![];}return _0x6f0a61[_0x05ef('0x28')](_0x4797e6);}else{logger[_0x05ef('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x05ef('0x4e'),util[_0x05ef('0x2b')](_0x57766c,{'showHidden':![],'depth':null}));}}else{logger[_0x05ef('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x05ef('0x2a'),'clickSend',util['inspect'](_0x57766c,{'showHidden':![],'depth':null}));}})[_0x05ef('0x18')](function(_0x149815){logger[_0x05ef('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x05ef('0x2a'),_0x05ef('0x4e'),util[_0x05ef('0x2b')](_0x149815,{'showHidden':![],'depth':null}));});}else{logger[_0x05ef('0x19')](_0x05ef('0x29'),'afterCreate',_0x05ef('0x4e'),_0x05ef('0x3c'));}break;case'plivo':if(_0x5f0a24[_0x05ef('0x4f')]&&_0x5f0a24[_0x05ef('0x20')]){var _0x106910={'dst':_0x7a19['phone'],'text':_0x7a19[_0x05ef('0x43')],'src':_0x5f0a24[_0x05ef('0x3e')]||_0x5f0a24[_0x05ef('0x21')],'url':_0x5f0a24[_0x05ef('0x23')]+_0x05ef('0x24')+_0x7a19['id']+_0x05ef('0x25')+_0x5f0a24[_0x05ef('0x26')]};var _0x5c8970=util['format'](_0x05ef('0x44'),_0x5f0a24[_0x05ef('0x4f')],_0x5f0a24[_0x05ef('0x20')]);var _0x329367={'method':'POST','uri':util[_0x05ef('0x46')](_0x05ef('0x50'),_0x5f0a24[_0x05ef('0x4f')]),'body':_0x106910,'headers':{'Authorization':util[_0x05ef('0x46')]('Basic\x20%s',new Buffer(_0x5c8970)[_0x05ef('0x51')]('base64'))},'json':!![]};rp(_0x329367)['then'](function(_0x3b27da){var _0x3e3633={'messageId':_0x3b27da[_0x05ef('0x52')][0x0]};return _0x6f0a61[_0x05ef('0x28')](_0x3e3633);})['catch'](function(_0x54f5d4){logger[_0x05ef('0x19')](_0x05ef('0x29'),'afterCreate',_0x05ef('0x53'),util[_0x05ef('0x2b')](_0x54f5d4,{'showHidden':![],'depth':null}));});}else{logger[_0x05ef('0x19')](_0x05ef('0x29'),'afterCreate',_0x05ef('0x53'),_0x05ef('0x54'));}break;case _0x05ef('0x55'):if(_0x5f0a24[_0x05ef('0x2f')]&&_0x5f0a24['password']){if(_0x5f0a24[_0x05ef('0x56')]){var _0x5c481b={'method':_0x05ef('0x37'),'uri':_0x5f0a24[_0x05ef('0x56')]+_0x05ef('0x57'),'body':{'username':_0x5f0a24['username'],'password':_0x5f0a24[_0x05ef('0x30')]},'json':!![]};return rp(_0x5c481b)['then'](function(_0xbb9ab7){var _0x756431={'method':_0x05ef('0x37'),'uri':_0x5f0a24[_0x05ef('0x56')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x5f0a24['phone'],'destinations':[{'to':_0x7a19[_0x05ef('0x21')]}],'text':_0x7a19[_0x05ef('0x43')],'notifyUrl':_0x5f0a24[_0x05ef('0x23')]+_0x05ef('0x24')+_0x7a19['id']+_0x05ef('0x25')+_0x5f0a24[_0x05ef('0x26')],'notifyContentType':_0x05ef('0x58'),'callbackData':_0x5f0a24[_0x05ef('0x21')]+';'+_0x7a19[_0x05ef('0x43')]}]},'headers':{'Authorization':'IBSSO\x20'+_0xbb9ab7[_0x05ef('0x26')]},'json':!![]};return rp(_0x756431)[_0x05ef('0x16')](function(_0x23be4b){if(_0x23be4b[_0x05ef('0x4c')]){var _0x393b49={'messageId':_0x23be4b[_0x05ef('0x4c')][0x0][_0x05ef('0xb')]};if(!_0x5f0a24['deliveryReport']){_0x393b49[_0x05ef('0x3b')]=!![];}return _0x6f0a61['update'](_0x393b49);}else{return logger[_0x05ef('0x19')](_0x05ef('0x29'),_0x05ef('0x2a'),_0x05ef('0x55'),util[_0x05ef('0x2b')](_0x23be4b,{'showHidden':![],'depth':null}));}});})[_0x05ef('0x18')](function(_0x2f331f){return logger[_0x05ef('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x05ef('0x2a'),_0x05ef('0x55'),util['inspect'](_0x2f331f,{'showHidden':![],'depth':null}));});}else{logger[_0x05ef('0x19')](_0x05ef('0x29'),_0x05ef('0x2a'),_0x05ef('0x55'),_0x05ef('0x59'));}}else{logger['error'](_0x05ef('0x29'),_0x05ef('0x2a'),'infobip',_0x05ef('0x3c'));}break;case _0x05ef('0x5a'):var _0x45324f=require('crypto');if(_0x5f0a24['apiKey']){var _0x30be30={};_0x30be30[_0x05ef('0x5b')]=_0x5f0a24[_0x05ef('0x2f')];_0x30be30[_0x05ef('0x21')]=_0x7a19[_0x05ef('0x21')];_0x30be30['sender']=_0x5f0a24[_0x05ef('0x21')];_0x30be30[_0x05ef('0x5c')]=_0x7a19[_0x05ef('0x43')];_0x30be30['timestamp']=+new Date();var _0x541220='';var _0x5bc04d='';var _0x5156f8=Object['keys'](_0x30be30);_0x5156f8['sort']();for(var _0x2472aa=0x0;_0x2472aa<_0x5156f8[_0x05ef('0x5d')];_0x2472aa++){if(_0x541220!=''){_0x541220+='&';}_0x541220+=_0x5156f8[_0x2472aa]+'='+encodeURIComponent(_0x30be30[_0x5156f8[_0x2472aa]]);_0x5bc04d+=_0x30be30[_0x5156f8[_0x2472aa]];}_0x5bc04d+=_0x5f0a24[_0x05ef('0x5e')];_0x5bc04d=_0x45324f[_0x05ef('0x5f')](_0x05ef('0x60'))[_0x05ef('0x28')](_0x5bc04d)[_0x05ef('0x61')](_0x05ef('0x62'));if(_0x541220!==''){_0x541220+='&';}_0x541220+=_0x05ef('0x63')+_0x5bc04d;var _0x12568b={'method':'GET','uri':_0x5f0a24[_0x05ef('0x56')]+_0x05ef('0x64')+_0x541220,'json':!![]};return rp(_0x12568b)[_0x05ef('0x16')](function(_0x55eb46){var _0x3d3075=Object['keys'](_0x55eb46);if(_0x55eb46[_0x3d3075[0x0]]['error']&&parseInt(_0x55eb46[_0x3d3075[0x0]][_0x05ef('0x19')])===0x0){var _0xf1f58b={'messageId':_0x55eb46[_0x3d3075[0x0]][_0x05ef('0x65')]};if(!_0x5f0a24[_0x05ef('0x4d')]){_0xf1f58b[_0x05ef('0x3b')]=!![];}return _0x6f0a61[_0x05ef('0x28')](_0xf1f58b);}else{return logger[_0x05ef('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x05ef('0x2a'),_0x05ef('0x5a'),util['inspect'](_0x55eb46[_0x05ef('0x19')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x1bf127){return logger[_0x05ef('0x19')](_0x05ef('0x29'),_0x05ef('0x2a'),'csc',util['inspect'](_0x1bf127,{'showHidden':![],'depth':null}));});}else{logger[_0x05ef('0x19')](_0x05ef('0x29'),'afterCreate',_0x05ef('0x5a'),'Missing\x20parameters:\x20apiKey');}break;case _0x05ef('0x66'):if(_0x5f0a24[_0x05ef('0x5e')]){var _0x5340ed={'method':_0x05ef('0x37'),'uri':_0x05ef('0x67'),'headers':{'Authorization':_0x5f0a24[_0x05ef('0x5e')]},'body':{'content':_0x7a19[_0x05ef('0x43')],'to':[_0x7a19[_0x05ef('0x21')]],'from':_0x5f0a24['phone'],'binary':![],'clientMessageId':'uuid','charset':_0x05ef('0x68')},'json':!![]};rp(_0x5340ed)[_0x05ef('0x16')](function(_0x38a8cb){if(!_0x38a8cb[_0x05ef('0x19')]){var _0x350f74={'messageId':_0x38a8cb[_0x05ef('0x4c')][0x0][_0x05ef('0x69')]};if(!_0x5f0a24[_0x05ef('0x4d')]){_0x350f74['read']=!![];}return _0x6f0a61[_0x05ef('0x28')](_0x350f74);}else{return logger[_0x05ef('0x19')](_0x05ef('0x29'),_0x05ef('0x2a'),_0x05ef('0x66'),util[_0x05ef('0x2b')](_0x38a8cb[_0x05ef('0x19')],{'showHidden':![],'depth':null}));}})[_0x05ef('0x18')](function(_0x29c781){return logger[_0x05ef('0x19')](_0x05ef('0x29'),_0x05ef('0x2a'),_0x05ef('0x66'),util[_0x05ef('0x2b')](_0x29c781,{'showHidden':![],'depth':null}));});}else{logger[_0x05ef('0x19')](_0x05ef('0x29'),_0x05ef('0x2a'),_0x05ef('0x66'),_0x05ef('0x6a'));}break;case'bandwidth':if(_0x5f0a24[_0x05ef('0x2f')]&&_0x5f0a24[_0x05ef('0x30')]){var _0x5c8970=util[_0x05ef('0x46')]('%s:%s',_0x5f0a24['username'],_0x5f0a24[_0x05ef('0x30')]);var _0x329367={'method':_0x05ef('0x37'),'uri':_0x05ef('0x6b')+_0x5f0a24[_0x05ef('0x6c')]+_0x05ef('0x6d'),'body':{'to':[_0x7a19['phone']],'text':_0x7a19[_0x05ef('0x43')],'from':_0x5f0a24['phone'],'applicationId':_0x5f0a24[_0x05ef('0x6e')]},'headers':{'Authorization':util[_0x05ef('0x46')](_0x05ef('0x6f'),new Buffer(_0x5c8970)[_0x05ef('0x51')](_0x05ef('0x47')))},'json':!![]};rp(_0x329367)[_0x05ef('0x16')](function(_0x4806c3){if(_0x4806c3['id']){var _0x1b4183={'messageId':_0x4806c3['id']};return _0x6f0a61[_0x05ef('0x28')](_0x1b4183);}else{logger['error'](_0x05ef('0x29'),_0x05ef('0x2a'),_0x05ef('0x70'),util[_0x05ef('0x2b')](_0x4806c3,{'showHidden':![],'depth':null}));}})[_0x05ef('0x18')](function(_0x5812f8){logger['error'](_0x05ef('0x29'),_0x05ef('0x2a'),_0x05ef('0x70'),util[_0x05ef('0x2b')](_0x5812f8,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x05ef('0x2a'),_0x05ef('0x70'),_0x05ef('0x3c'));}break;case'intelepeer':if(_0x5f0a24[_0x05ef('0x5e')]){var _0x48dab7={};var _0x12568b={'method':'POST','uri':_0x05ef('0x71'),'headers':{'Authorization':_0x05ef('0x72')+_0x5f0a24[_0x05ef('0x5e')],'Content-Type':_0x05ef('0x58')},'body':{'from':_0x5f0a24['phone'],'to':_0x7a19['phone'],'text':_0x7a19[_0x05ef('0x43')]},'json':!![]};return rp(_0x12568b)[_0x05ef('0x16')](function(_0x3bf551){if(_0x3bf551['code']==0xca){_0x48dab7[_0x05ef('0x73')]=_0x3bf551;var _0x3438c7={'method':_0x05ef('0x37'),'uri':_0x05ef('0x74'),'headers':{'Authorization':'Bearer\x20'+_0x5f0a24[_0x05ef('0x5e')],'Content-Type':'application/json'},'body':{'refid':_0x48dab7[_0x05ef('0x73')][_0x05ef('0x75')]},'json':!![]};return rp(_0x3438c7)[_0x05ef('0x16')](function(_0x3a1109){_0x48dab7[_0x05ef('0x76')]=_0x3a1109;var _0x24c685={'messageId':_0x48dab7[_0x05ef('0x73')][_0x05ef('0x75')],'read':!![]};return _0x6f0a61[_0x05ef('0x28')](_0x24c685);});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x05ef('0x2a'),_0x05ef('0x77'),util[_0x05ef('0x2b')](_0x3bf551,{'showHidden':![],'depth':null}));}})[_0x05ef('0x18')](function(_0x4c9223){return logger[_0x05ef('0x19')](_0x05ef('0x29'),_0x05ef('0x2a'),'intelepeer',util[_0x05ef('0x2b')](_0x4c9223,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x05ef('0x29'),'afterCreate',_0x05ef('0x77'),_0x05ef('0x78'));}break;}}})[_0x05ef('0x79')](function(){_0x2503fa();});}else{_0x2503fa();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xe289=['crypto','apiKey','login','text','timestamp','keys','sort','createHash','digest','signature=','csc','clickatell','uuid','UTF-8','Missing\x20parameters:\x20apiKey','bandwidth','https://messaging.bandwidth.com/api/v2/users/','applicationId','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','message','refid','status','intelepeer','finally','utf8mb4','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','then','createdAt','error','find','SmsAccountId','twilio','accountSid','authToken','messages','create','phone','/api/sms/messages/','/status?token=','token','sid','update','catch','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','split','sms','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','POST','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','message_id','clickSend','plivo','remote','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url'];(function(_0x203dfa,_0x19b6f6){var _0x4a5283=function(_0x63167a){while(--_0x63167a){_0x203dfa['push'](_0x203dfa['shift']());}};_0x4a5283(++_0x19b6f6);}(_0xe289,0x92));var _0x9e28=function(_0x538af4,_0x38f152){_0x538af4=_0x538af4-0x0;var _0x28d15f=_0xe289[_0x538af4];return _0x28d15f;};'use strict';var _=require('lodash');var util=require(_0x9e28('0x0'));var logger=require(_0x9e28('0x1'))(_0x9e28('0x2'));var moment=require('moment');var BPromise=require(_0x9e28('0x3'));var rp=require(_0x9e28('0x4'));var fs=require('fs');var path=require(_0x9e28('0x5'));var rimraf=require(_0x9e28('0x6'));var config=require(_0x9e28('0x7'));var attributes=require('./smsMessage.attributes');module['exports']=function(_0x5678d2,_0xc1c87e){return _0x5678d2[_0x9e28('0x8')]('SmsMessage',attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x9e28('0x9'),'fields':[_0x9e28('0x9')]},{'name':_0x9e28('0xa'),'fields':[_0x9e28('0xb')],'type':_0x9e28('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3ea2e6,_0x1a84df,_0x12d7fc){var _0x10908d=_0x5678d2[_0x9e28('0xd')];var _0x4b56d9=_0x3ea2e6[_0x9e28('0xe')]({'plain':!![]});if(_0x4b56d9[_0x9e28('0xf')][_0x9e28('0x10')]()==='in'||_0x4b56d9[_0x9e28('0xf')][_0x9e28('0x10')]()===_0x9e28('0x11')&&!_0x4b56d9[_0x9e28('0x12')]&&!_[_0x9e28('0x13')](_0x4b56d9[_0x9e28('0x14')])&&!_[_0x9e28('0x13')](_0x4b56d9[_0x9e28('0x15')])){_0x10908d[_0x9e28('0x16')]['findOne']({'where':{'id':_0x4b56d9[_0x9e28('0x15')]}})[_0x9e28('0x17')](function(_0x2dd0ef){if(_0x2dd0ef){_0x2dd0ef['update']({'lastMsgAt':_0x4b56d9[_0x9e28('0x18')],'lastMsgDirection':_0x4b56d9[_0x9e28('0xf')][_0x9e28('0x10')]()});}})['catch'](function(_0xa97298){console[_0x9e28('0x19')](_0xa97298);});}if(_0x4b56d9[_0x9e28('0xf')]===_0x9e28('0x11')&&!_0x4b56d9['secret']){var _0x4a65d3;_0x10908d['SmsAccount'][_0x9e28('0x1a')]({'where':{'id':_0x4b56d9[_0x9e28('0x1b')]},'raw':!![]})[_0x9e28('0x17')](function(_0x2048cc){_0x4a65d3=_0x2048cc;if(_0x4a65d3&&_0x4a65d3['type']){switch(_0x4a65d3['type']){case _0x9e28('0x1c'):var _0x34be4d=require(_0x9e28('0x1c'));if(_0x4a65d3[_0x9e28('0x1d')]&&_0x4a65d3[_0x9e28('0x1e')]&&_0x4a65d3['phone']){var _0x25108c=new _0x34be4d(_0x4a65d3[_0x9e28('0x1d')],_0x4a65d3['authToken']);_0x25108c[_0x9e28('0x1f')][_0x9e28('0x20')]({'body':_0x4b56d9['body'],'to':_0x4b56d9[_0x9e28('0x21')],'from':_0x4a65d3[_0x9e28('0x21')],'statusCallback':_0x4a65d3['remote']+_0x9e28('0x22')+_0x4b56d9['id']+_0x9e28('0x23')+_0x4a65d3[_0x9e28('0x24')]})[_0x9e28('0x17')](function(_0x4b4d5e){if(_0x4b4d5e[_0x9e28('0x25')]){return _0x3ea2e6[_0x9e28('0x26')]({'messageId':_0x4b4d5e[_0x9e28('0x25')]});}})[_0x9e28('0x27')](function(_0x36e8af){logger['error'](_0x9e28('0x28'),_0x9e28('0x29'),_0x9e28('0x1c'),util[_0x9e28('0x2a')](_0x36e8af,{'showHidden':![],'depth':null}));});}else{logger[_0x9e28('0x19')](_0x9e28('0x28'),_0x9e28('0x29'),_0x9e28('0x1c'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x9e28('0x2b'):var _0x79b209=_0x9e28('0x2c');if(_0x4a65d3[_0x9e28('0x2d')]&&_0x4a65d3[_0x9e28('0x2e')]){var _0x30a349={'recipient':[_0x4b56d9[_0x9e28('0x21')]],'message':_0x4b56d9['body'],'message_type':_0x4a65d3[_0x9e28('0x2f')]};if(_0x4a65d3[_0x9e28('0x2f')]&&_0x4a65d3[_0x9e28('0x2f')]!=='SI'){_0x30a349[_0x9e28('0x30')]=_0x4a65d3[_0x9e28('0x21')];}var _0x5645fc={'url':_0x79b209+_0x9e28('0x31')+_0x4a65d3[_0x9e28('0x2d')]+_0x9e28('0x32')+_0x4a65d3[_0x9e28('0x2e')],'method':_0x9e28('0x33')};rp(_0x5645fc)[_0x9e28('0x17')](function(_0x5e576b){var _0x1c97ae=_0x5e576b[_0x9e28('0x34')](';');var _0x256e16={'user_key':_0x1c97ae[0x0],'session_key':_0x1c97ae[0x1]};_0x5645fc={'url':_0x79b209+_0x9e28('0x35'),'method':'POST','headers':{'user_key':_0x256e16[_0x9e28('0x36')],'Session_key':_0x256e16[_0x9e28('0x37')]},'json':!![],'body':_0x30a349};return rp(_0x5645fc);})[_0x9e28('0x17')](function(_0x3d5750){if(_0x3d5750[_0x9e28('0x38')]>=0x1){var _0x1513a7={'messageId':_0x3d5750[_0x9e28('0x39')]};if(_0x4a65d3[_0x9e28('0x2f')]!=='GP'||!_0x4a65d3[_0x9e28('0x3a')]){_0x1513a7[_0x9e28('0x3b')]=!![];}return _0x3ea2e6[_0x9e28('0x26')](_0x1513a7);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9e28('0x29'),'skebby',util[_0x9e28('0x2a')](_0x3d5750,{'showHidden':![],'depth':null}));}})[_0x9e28('0x27')](function(_0x45f997){return logger['error'](_0x9e28('0x28'),_0x9e28('0x29'),_0x9e28('0x2b'),util[_0x9e28('0x2a')](_0x45f997,{'showHidden':![],'depth':null}));});}else{logger[_0x9e28('0x19')](_0x9e28('0x28'),_0x9e28('0x29'),_0x9e28('0x2b'),_0x9e28('0x3c'));}break;case _0x9e28('0x3d'):if(_0x4a65d3[_0x9e28('0x1e')]){var _0x30e564={'recipient':_0x4b56d9[_0x9e28('0x21')],'message':_0x4b56d9['body'],'sender':_0x4a65d3[_0x9e28('0x3e')]||_0x4a65d3['phone'],'authorization':_0x4a65d3[_0x9e28('0x1e')]};var _0x1a84df={'method':_0x9e28('0x3f'),'uri':_0x9e28('0x40'),'body':_0x30e564,'json':!![]};rp(_0x1a84df)[_0x9e28('0x17')](function(_0x123f54){var _0x4f1194={'messageId':_0x123f54[_0x9e28('0x41')]};if(!_0x4a65d3['deliveryReport']){_0x4f1194[_0x9e28('0x3b')]=!![];}return _0x3ea2e6[_0x9e28('0x26')](_0x4f1194);})['catch'](function(_0x1961e2){logger[_0x9e28('0x19')](_0x9e28('0x28'),_0x9e28('0x29'),_0x9e28('0x3d'),util['inspect'](_0x1961e2,{'showHidden':![],'depth':null}));});}else{logger[_0x9e28('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9e28('0x29'),'connectel',_0x9e28('0x42'));}break;case _0x9e28('0x43'):if(_0x4a65d3[_0x9e28('0x2d')]&&_0x4a65d3['password']){var _0x30e564={'messages':[{'source':_0x9e28('0x44'),'to':_0x4b56d9['phone'],'body':_0x4b56d9[_0x9e28('0xb')],'from':_0x4a65d3['senderString']||_0x4a65d3[_0x9e28('0x21')]}]};var _0xd204a1=util[_0x9e28('0x45')](_0x9e28('0x46'),_0x4a65d3[_0x9e28('0x2d')],_0x4a65d3[_0x9e28('0x2e')]);var _0x1a84df={'method':_0x9e28('0x3f'),'uri':_0x9e28('0x47'),'body':_0x30e564,'headers':{'Authorization':util[_0x9e28('0x45')](_0x9e28('0x48'),new Buffer(_0xd204a1)[_0x9e28('0x49')](_0x9e28('0x4a')))},'json':!![]};rp(_0x1a84df)[_0x9e28('0x17')](function(_0x3295d4){if(_0x3295d4[_0x9e28('0x4b')]>=0xc8&&_0x3295d4[_0x9e28('0x4b')]<=0xce){if(_0x3295d4[_0x9e28('0x4c')]&&_0x3295d4[_0x9e28('0x4c')][_0x9e28('0x4d')]>0x0){var _0x32a024=_['head'](_0x3295d4[_0x9e28('0x4c')]['messages']);var _0x146af7={'messageId':_0x32a024[_0x9e28('0x4e')]};if(!_0x4a65d3[_0x9e28('0x3a')]){_0x146af7[_0x9e28('0x3b')]=!![];}return _0x3ea2e6['update'](_0x146af7);}else{logger[_0x9e28('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x9e28('0x4f'),util[_0x9e28('0x2a')](_0x3295d4,{'showHidden':![],'depth':null}));}}else{logger[_0x9e28('0x19')](_0x9e28('0x28'),'afterCreate','clickSend',util[_0x9e28('0x2a')](_0x3295d4,{'showHidden':![],'depth':null}));}})[_0x9e28('0x27')](function(_0x381f2b){logger[_0x9e28('0x19')](_0x9e28('0x28'),'afterCreate','clickSend',util['inspect'](_0x381f2b,{'showHidden':![],'depth':null}));});}else{logger[_0x9e28('0x19')](_0x9e28('0x28'),_0x9e28('0x29'),_0x9e28('0x4f'),_0x9e28('0x3c'));}break;case _0x9e28('0x50'):if(_0x4a65d3['authId']&&_0x4a65d3[_0x9e28('0x1e')]){var _0x30e564={'dst':_0x4b56d9[_0x9e28('0x21')],'text':_0x4b56d9[_0x9e28('0xb')],'src':_0x4a65d3[_0x9e28('0x3e')]||_0x4a65d3[_0x9e28('0x21')],'url':_0x4a65d3[_0x9e28('0x51')]+_0x9e28('0x22')+_0x4b56d9['id']+_0x9e28('0x23')+_0x4a65d3[_0x9e28('0x24')]};var _0xd204a1=util[_0x9e28('0x45')](_0x9e28('0x46'),_0x4a65d3['authId'],_0x4a65d3[_0x9e28('0x1e')]);var _0x1a84df={'method':'POST','uri':util['format'](_0x9e28('0x52'),_0x4a65d3['authId']),'body':_0x30e564,'headers':{'Authorization':util[_0x9e28('0x45')](_0x9e28('0x48'),new Buffer(_0xd204a1)[_0x9e28('0x49')](_0x9e28('0x4a')))},'json':!![]};rp(_0x1a84df)[_0x9e28('0x17')](function(_0x588316){var _0x18e6b7={'messageId':_0x588316[_0x9e28('0x53')][0x0]};return _0x3ea2e6[_0x9e28('0x26')](_0x18e6b7);})[_0x9e28('0x27')](function(_0x3d7742){logger[_0x9e28('0x19')](_0x9e28('0x28'),'afterCreate',_0x9e28('0x50'),util[_0x9e28('0x2a')](_0x3d7742,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x9e28('0x28'),_0x9e28('0x29'),_0x9e28('0x50'),_0x9e28('0x54'));}break;case'infobip':if(_0x4a65d3[_0x9e28('0x2d')]&&_0x4a65d3['password']){if(_0x4a65d3[_0x9e28('0x55')]){var _0x5e6bef={'method':_0x9e28('0x3f'),'uri':_0x4a65d3[_0x9e28('0x55')]+_0x9e28('0x56'),'body':{'username':_0x4a65d3['username'],'password':_0x4a65d3[_0x9e28('0x2e')]},'json':!![]};return rp(_0x5e6bef)['then'](function(_0x5ad7c3){var _0x17b54a={'method':'POST','uri':_0x4a65d3[_0x9e28('0x55')]+_0x9e28('0x57'),'body':{'messages':[{'from':_0x4a65d3['phone'],'destinations':[{'to':_0x4b56d9[_0x9e28('0x21')]}],'text':_0x4b56d9['body'],'notifyUrl':_0x4a65d3[_0x9e28('0x51')]+_0x9e28('0x22')+_0x4b56d9['id']+'/status?token='+_0x4a65d3[_0x9e28('0x24')],'notifyContentType':_0x9e28('0x58'),'callbackData':_0x4a65d3[_0x9e28('0x21')]+';'+_0x4b56d9['body']}]},'headers':{'Authorization':_0x9e28('0x59')+_0x5ad7c3['token']},'json':!![]};return rp(_0x17b54a)[_0x9e28('0x17')](function(_0x210190){if(_0x210190[_0x9e28('0x1f')]){var _0x3ccdf7={'messageId':_0x210190[_0x9e28('0x1f')][0x0][_0x9e28('0x9')]};if(!_0x4a65d3[_0x9e28('0x3a')]){_0x3ccdf7[_0x9e28('0x3b')]=!![];}return _0x3ea2e6[_0x9e28('0x26')](_0x3ccdf7);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9e28('0x29'),_0x9e28('0x5a'),util[_0x9e28('0x2a')](_0x210190,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x573a0c){return logger[_0x9e28('0x19')](_0x9e28('0x28'),'afterCreate',_0x9e28('0x5a'),util[_0x9e28('0x2a')](_0x573a0c,{'showHidden':![],'depth':null}));});}else{logger[_0x9e28('0x19')](_0x9e28('0x28'),_0x9e28('0x29'),_0x9e28('0x5a'),_0x9e28('0x5b'));}}else{logger[_0x9e28('0x19')](_0x9e28('0x28'),_0x9e28('0x29'),_0x9e28('0x5a'),_0x9e28('0x3c'));}break;case'csc':var _0x464adf=require(_0x9e28('0x5c'));if(_0x4a65d3[_0x9e28('0x5d')]){var _0x195958={};_0x195958[_0x9e28('0x5e')]=_0x4a65d3['username'];_0x195958[_0x9e28('0x21')]=_0x4b56d9['phone'];_0x195958['sender']=_0x4a65d3[_0x9e28('0x21')];_0x195958[_0x9e28('0x5f')]=_0x4b56d9[_0x9e28('0xb')];_0x195958[_0x9e28('0x60')]=+new Date();var _0x5c175e='';var _0x266150='';var _0x41cf08=Object[_0x9e28('0x61')](_0x195958);_0x41cf08[_0x9e28('0x62')]();for(var _0x30f5db=0x0;_0x30f5db<_0x41cf08['length'];_0x30f5db++){if(_0x5c175e!=''){_0x5c175e+='&';}_0x5c175e+=_0x41cf08[_0x30f5db]+'='+encodeURIComponent(_0x195958[_0x41cf08[_0x30f5db]]);_0x266150+=_0x195958[_0x41cf08[_0x30f5db]];}_0x266150+=_0x4a65d3[_0x9e28('0x5d')];_0x266150=_0x464adf[_0x9e28('0x63')]('md5')[_0x9e28('0x26')](_0x266150)[_0x9e28('0x64')]('hex');if(_0x5c175e!==''){_0x5c175e+='&';}_0x5c175e+=_0x9e28('0x65')+_0x266150;var _0x5645fc={'method':_0x9e28('0x33'),'uri':_0x4a65d3[_0x9e28('0x55')]+'/external/get/send.php?'+_0x5c175e,'json':!![]};return rp(_0x5645fc)[_0x9e28('0x17')](function(_0x544bd2){var _0x542911=Object['keys'](_0x544bd2);if(_0x544bd2[_0x542911[0x0]][_0x9e28('0x19')]&&parseInt(_0x544bd2[_0x542911[0x0]]['error'])===0x0){var _0x1d5a97={'messageId':_0x544bd2[_0x542911[0x0]]['id_sms']};if(!_0x4a65d3[_0x9e28('0x3a')]){_0x1d5a97['read']=!![];}return _0x3ea2e6['update'](_0x1d5a97);}else{return logger[_0x9e28('0x19')](_0x9e28('0x28'),_0x9e28('0x29'),_0x9e28('0x66'),util[_0x9e28('0x2a')](_0x544bd2[_0x9e28('0x19')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x462c65){return logger[_0x9e28('0x19')](_0x9e28('0x28'),_0x9e28('0x29'),_0x9e28('0x66'),util['inspect'](_0x462c65,{'showHidden':![],'depth':null}));});}else{logger[_0x9e28('0x19')](_0x9e28('0x28'),_0x9e28('0x29'),_0x9e28('0x66'),'Missing\x20parameters:\x20apiKey');}break;case _0x9e28('0x67'):if(_0x4a65d3[_0x9e28('0x5d')]){var _0xc1b8f2={'method':_0x9e28('0x3f'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x4a65d3[_0x9e28('0x5d')]},'body':{'content':_0x4b56d9[_0x9e28('0xb')],'to':[_0x4b56d9[_0x9e28('0x21')]],'from':_0x4a65d3['phone'],'binary':![],'clientMessageId':_0x9e28('0x68'),'charset':_0x9e28('0x69')},'json':!![]};rp(_0xc1b8f2)[_0x9e28('0x17')](function(_0x263a00){if(!_0x263a00[_0x9e28('0x19')]){var _0x4b5a60={'messageId':_0x263a00[_0x9e28('0x1f')][0x0]['apiMessageId']};if(!_0x4a65d3[_0x9e28('0x3a')]){_0x4b5a60['read']=!![];}return _0x3ea2e6[_0x9e28('0x26')](_0x4b5a60);}else{return logger['error'](_0x9e28('0x28'),_0x9e28('0x29'),'clickatell',util['inspect'](_0x263a00[_0x9e28('0x19')],{'showHidden':![],'depth':null}));}})[_0x9e28('0x27')](function(_0x40a47e){return logger['error'](_0x9e28('0x28'),'afterCreate','clickatell',util[_0x9e28('0x2a')](_0x40a47e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x9e28('0x28'),'afterCreate',_0x9e28('0x67'),_0x9e28('0x6a'));}break;case _0x9e28('0x6b'):if(_0x4a65d3[_0x9e28('0x2d')]&&_0x4a65d3[_0x9e28('0x2e')]){var _0xd204a1=util[_0x9e28('0x45')]('%s:%s',_0x4a65d3[_0x9e28('0x2d')],_0x4a65d3[_0x9e28('0x2e')]);var _0x1a84df={'method':'POST','uri':_0x9e28('0x6c')+_0x4a65d3['accountId']+'/messages','body':{'to':[_0x4b56d9[_0x9e28('0x21')]],'text':_0x4b56d9[_0x9e28('0xb')],'from':_0x4a65d3[_0x9e28('0x21')],'applicationId':_0x4a65d3[_0x9e28('0x6d')]},'headers':{'Authorization':util[_0x9e28('0x45')]('Basic\x20%s',new Buffer(_0xd204a1)[_0x9e28('0x49')](_0x9e28('0x4a')))},'json':!![]};rp(_0x1a84df)[_0x9e28('0x17')](function(_0x25cefc){if(_0x25cefc['id']){var _0x6bdf39={'messageId':_0x25cefc['id']};return _0x3ea2e6['update'](_0x6bdf39);}else{logger[_0x9e28('0x19')](_0x9e28('0x28'),_0x9e28('0x29'),_0x9e28('0x6b'),util['inspect'](_0x25cefc,{'showHidden':![],'depth':null}));}})[_0x9e28('0x27')](function(_0x1eb48b){logger[_0x9e28('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x9e28('0x6b'),util[_0x9e28('0x2a')](_0x1eb48b,{'showHidden':![],'depth':null}));});}else{logger[_0x9e28('0x19')](_0x9e28('0x28'),_0x9e28('0x29'),'bandwidth','Missing\x20parameters:\x20username,\x20password');}break;case'intelepeer':if(_0x4a65d3[_0x9e28('0x5d')]){var _0x31f151={};var _0x5645fc={'method':_0x9e28('0x3f'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':'Bearer\x20'+_0x4a65d3['apiKey'],'Content-Type':_0x9e28('0x58')},'body':{'from':_0x4a65d3[_0x9e28('0x21')],'to':_0x4b56d9[_0x9e28('0x21')],'text':_0x4b56d9[_0x9e28('0xb')]},'json':!![]};return rp(_0x5645fc)['then'](function(_0x1640a2){if(_0x1640a2[_0x9e28('0x6e')]==0xca){_0x31f151['message']=_0x1640a2;var _0x4e2fb6={'method':_0x9e28('0x3f'),'uri':_0x9e28('0x6f'),'headers':{'Authorization':_0x9e28('0x70')+_0x4a65d3[_0x9e28('0x5d')],'Content-Type':_0x9e28('0x58')},'body':{'refid':_0x31f151[_0x9e28('0x71')][_0x9e28('0x72')]},'json':!![]};return rp(_0x4e2fb6)[_0x9e28('0x17')](function(_0x106a1c){_0x31f151[_0x9e28('0x73')]=_0x106a1c;var _0x829823={'messageId':_0x31f151[_0x9e28('0x71')][_0x9e28('0x72')],'read':!![]};return _0x3ea2e6[_0x9e28('0x26')](_0x829823);});}else{return logger['error'](_0x9e28('0x28'),_0x9e28('0x29'),'intelepeer',util[_0x9e28('0x2a')](_0x1640a2,{'showHidden':![],'depth':null}));}})[_0x9e28('0x27')](function(_0xcc6d4c){return logger[_0x9e28('0x19')](_0x9e28('0x28'),_0x9e28('0x29'),_0x9e28('0x74'),util[_0x9e28('0x2a')](_0xcc6d4c,{'showHidden':![],'depth':null}));});}else{return logger[_0x9e28('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9e28('0x29'),_0x9e28('0x74'),'Token\x20not\x20received');}break;}}})[_0x9e28('0x75')](function(){_0x12d7fc();});}else{_0x12d7fc();}}},'charset':_0x9e28('0x76'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 3b70232..162c40d 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 _0x3376=['request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','create','body','options','raw','CreateSmsMessage','stringify','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','client','http','defaults','localhost','socket.io-emitter','register','request','then','info','SmsMessage,\x20%s,\x20%s'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x3376,0xe7));var _0x6337=function(_0x3ca3fd,_0x1cb2be){_0x3ca3fd=_0x3ca3fd-0x0;var _0x1a0673=_0x3376[_0x3ca3fd];return _0x1a0673;};'use strict';var _=require(_0x6337('0x0'));var util=require(_0x6337('0x1'));var moment=require('moment');var BPromise=require(_0x6337('0x2'));var rs=require(_0x6337('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6337('0x4'))['db'];var utils=require(_0x6337('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6337('0x6'));var client=jayson[_0x6337('0x7')][_0x6337('0x8')]({'port':0x232a});config['redis']=_[_0x6337('0x9')](config['redis'],{'host':_0x6337('0xa'),'port':0x18eb});var socket=require(_0x6337('0xb'))(new Redis(config['redis']));require('./smsMessage.socket')[_0x6337('0xc')](socket);function respondWithRpcPromise(_0x59195a,_0x338bf8,_0x31546c){return new BPromise(function(_0x11e464,_0x28c775){return client[_0x6337('0xd')](_0x59195a,_0x31546c)[_0x6337('0xe')](function(_0x38db7f){logger[_0x6337('0xf')](_0x6337('0x10'),_0x338bf8,_0x6337('0x11'));logger[_0x6337('0x12')](_0x6337('0x13'),_0x338bf8,'request\x20sent',JSON['stringify'](_0x38db7f));if(_0x38db7f[_0x6337('0x14')]){if(_0x38db7f[_0x6337('0x14')][_0x6337('0x15')]===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x338bf8,_0x38db7f[_0x6337('0x14')][_0x6337('0x16')]);return _0x28c775(_0x38db7f['error']['message']);}logger['error'](_0x6337('0x10'),_0x338bf8,_0x38db7f[_0x6337('0x14')][_0x6337('0x16')]);return _0x11e464(_0x38db7f[_0x6337('0x14')]['message']);}else{logger['info'](_0x6337('0x10'),_0x338bf8,_0x6337('0x11'));_0x11e464(_0x38db7f[_0x6337('0x17')][_0x6337('0x16')]);}})[_0x6337('0x18')](function(_0x2ea798){logger['error'](_0x6337('0x10'),_0x338bf8,_0x2ea798);_0x28c775(_0x2ea798);});});}exports['CreateSmsMessage']=function(_0x20f72c){var _0x397db8=this;return new Promise(function(_0x93743b,_0x201f3a){return db['SmsMessage'][_0x6337('0x19')](_0x20f72c[_0x6337('0x1a')],{'raw':_0x20f72c['options']?_0x20f72c[_0x6337('0x1b')][_0x6337('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x58fcd7){logger[_0x6337('0xf')](_0x6337('0x1d'),_0x20f72c);logger[_0x6337('0x12')](_0x6337('0x1d'),_0x20f72c,JSON[_0x6337('0x1e')](_0x58fcd7));_0x93743b(_0x58fcd7);})[_0x6337('0x18')](function(_0x356c96){logger['error'](_0x6337('0x1d'),_0x356c96['message'],_0x20f72c);_0x201f3a(_0x397db8['error'](0x1f4,_0x356c96[_0x6337('0x16')]));});});}; \ No newline at end of file +var _0xd6d2=['../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./smsMessage.socket','register','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSmsMessage','create','body','options','raw','info','debug','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2abf7f,_0x23b05a){var _0x248bce=function(_0x4c836d){while(--_0x4c836d){_0x2abf7f['push'](_0x2abf7f['shift']());}};_0x248bce(++_0x23b05a);}(_0xd6d2,0x13b));var _0x2d6d=function(_0x318b92,_0x3cfd51){_0x318b92=_0x318b92-0x0;var _0x195785=_0xd6d2[_0x318b92];return _0x195785;};'use strict';var _=require(_0x2d6d('0x0'));var util=require('util');var moment=require(_0x2d6d('0x1'));var BPromise=require(_0x2d6d('0x2'));var rs=require(_0x2d6d('0x3'));var fs=require('fs');var Redis=require(_0x2d6d('0x4'));var db=require(_0x2d6d('0x5'))['db'];var utils=require(_0x2d6d('0x6'));var logger=require(_0x2d6d('0x7'))(_0x2d6d('0x8'));var config=require(_0x2d6d('0x9'));var jayson=require(_0x2d6d('0xa'));var client=jayson[_0x2d6d('0xb')][_0x2d6d('0xc')]({'port':0x232a});config['redis']=_[_0x2d6d('0xd')](config[_0x2d6d('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x2d6d('0xf'))(new Redis(config[_0x2d6d('0xe')]));require(_0x2d6d('0x10'))[_0x2d6d('0x11')](socket);function respondWithRpcPromise(_0x486c5f,_0x4fb248,_0x26edfc){return new BPromise(function(_0x3383dd,_0x4b4ab4){return client[_0x2d6d('0x12')](_0x486c5f,_0x26edfc)[_0x2d6d('0x13')](function(_0x10939a){logger['info'](_0x2d6d('0x14'),_0x4fb248,_0x2d6d('0x15'));logger['debug'](_0x2d6d('0x16'),_0x4fb248,_0x2d6d('0x15'),JSON['stringify'](_0x10939a));if(_0x10939a['error']){if(_0x10939a[_0x2d6d('0x17')][_0x2d6d('0x18')]===0x1f4){logger[_0x2d6d('0x17')](_0x2d6d('0x14'),_0x4fb248,_0x10939a['error'][_0x2d6d('0x19')]);return _0x4b4ab4(_0x10939a[_0x2d6d('0x17')]['message']);}logger['error'](_0x2d6d('0x14'),_0x4fb248,_0x10939a['error']['message']);return _0x3383dd(_0x10939a[_0x2d6d('0x17')][_0x2d6d('0x19')]);}else{logger['info'](_0x2d6d('0x14'),_0x4fb248,'request\x20sent');_0x3383dd(_0x10939a[_0x2d6d('0x1a')][_0x2d6d('0x19')]);}})[_0x2d6d('0x1b')](function(_0xafdb42){logger[_0x2d6d('0x17')](_0x2d6d('0x14'),_0x4fb248,_0xafdb42);_0x4b4ab4(_0xafdb42);});});}exports[_0x2d6d('0x1c')]=function(_0x349381){var _0x361130=this;return new Promise(function(_0x1a6cec,_0x552da3){return db['SmsMessage'][_0x2d6d('0x1d')](_0x349381[_0x2d6d('0x1e')],{'raw':_0x349381[_0x2d6d('0x1f')]?_0x349381[_0x2d6d('0x1f')][_0x2d6d('0x20')]===undefined?!![]:![]:!![]})[_0x2d6d('0x13')](function(_0x372baa){logger[_0x2d6d('0x21')](_0x2d6d('0x1c'),_0x349381);logger[_0x2d6d('0x22')](_0x2d6d('0x1c'),_0x349381,JSON[_0x2d6d('0x23')](_0x372baa));_0x1a6cec(_0x372baa);})[_0x2d6d('0x1b')](function(_0x56d41f){logger[_0x2d6d('0x17')](_0x2d6d('0x1c'),_0x56d41f[_0x2d6d('0x19')],_0x349381);_0x552da3(_0x361130[_0x2d6d('0x17')](0x1f4,_0x56d41f[_0x2d6d('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index e0b860e..836c2c3 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 _0x9da8=['emit','register','length','save','remove','update'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9da8,0x105));var _0x89da=function(_0x1cc01a,_0x10e545){_0x1cc01a=_0x1cc01a-0x0;var _0xf401d7=_0x9da8[_0x1cc01a];return _0xf401d7;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x89da('0x0'),_0x89da('0x1'),_0x89da('0x2')];function createListener(_0x58b2a0,_0x5408cf){return function(_0x22f68e){_0x5408cf[_0x89da('0x3')](_0x58b2a0,_0x22f68e);};}function removeListener(_0x49a2b9,_0x18de26){return function(){SmsMessageEvents['removeListener'](_0x49a2b9,_0x18de26);};}exports[_0x89da('0x4')]=function(_0x1cf627){for(var _0x19a17a=0x0,_0x506dd3=events[_0x89da('0x5')];_0x19a17a<_0x506dd3;_0x19a17a++){var _0x4414b9=events[_0x19a17a];var _0x318b10=createListener('smsMessage:'+_0x4414b9,_0x1cf627);SmsMessageEvents['on'](_0x4414b9,_0x318b10);}}; \ No newline at end of file +var _0xd9f7=['removeListener','register','length','smsMessage:','save','emit'];(function(_0x13b20a,_0x126b31){var _0x4aaef6=function(_0x53b8de){while(--_0x53b8de){_0x13b20a['push'](_0x13b20a['shift']());}};_0x4aaef6(++_0x126b31);}(_0xd9f7,0x118));var _0x7d9f=function(_0x219536,_0x8e0b9b){_0x219536=_0x219536-0x0;var _0x231e4d=_0xd9f7[_0x219536];return _0x231e4d;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x7d9f('0x0'),'remove','update'];function createListener(_0x9f2659,_0xa7b02){return function(_0x4dbfeb){_0xa7b02[_0x7d9f('0x1')](_0x9f2659,_0x4dbfeb);};}function removeListener(_0x27736e,_0x591c06){return function(){SmsMessageEvents[_0x7d9f('0x2')](_0x27736e,_0x591c06);};}exports[_0x7d9f('0x3')]=function(_0x257727){for(var _0x38d247=0x0,_0x55264a=events[_0x7d9f('0x4')];_0x38d247<_0x55264a;_0x38d247++){var _0x45441a=events[_0x38d247];var _0x713147=createListener(_0x7d9f('0x5')+_0x45441a,_0x257727);SmsMessageEvents['on'](_0x45441a,_0x713147);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index b0768b7..f6ead24 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 _0xdd4a=['describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','create','post','addTeams','addAgents','put','/:id','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe'];(function(_0x30520f,_0x33e349){var _0x3aed14=function(_0x1f4ef8){while(--_0x1f4ef8){_0x30520f['push'](_0x30520f['shift']());}};_0x3aed14(++_0x33e349);}(_0xdd4a,0x152));var _0xadd4=function(_0x5db96a,_0x60039){_0x5db96a=_0x5db96a-0x0;var _0x13fdb0=_0xdd4a[_0x5db96a];return _0x13fdb0;};'use strict';var multer=require(_0xadd4('0x0'));var util=require(_0xadd4('0x1'));var path=require(_0xadd4('0x2'));var timeout=require(_0xadd4('0x3'));var express=require(_0xadd4('0x4'));var router=express[_0xadd4('0x5')]();var fs_extra=require(_0xadd4('0x6'));var auth=require(_0xadd4('0x7'));var interaction=require(_0xadd4('0x8'));var config=require(_0xadd4('0x9'));var controller=require('./smsQueue.controller');router['get']('/',auth[_0xadd4('0xa')](),controller[_0xadd4('0xb')]);router[_0xadd4('0xc')](_0xadd4('0xd'),auth[_0xadd4('0xa')](),controller[_0xadd4('0xe')]);router[_0xadd4('0xc')]('/:id',auth[_0xadd4('0xa')](),controller[_0xadd4('0xf')]);router[_0xadd4('0xc')](_0xadd4('0x10'),auth['isAuthenticated'](),controller[_0xadd4('0x11')]);router[_0xadd4('0xc')](_0xadd4('0x12'),auth[_0xadd4('0xa')](),controller[_0xadd4('0x13')]);router[_0xadd4('0xc')](_0xadd4('0x14'),auth[_0xadd4('0xa')](),controller['getAgents']);router['post']('/',auth[_0xadd4('0xa')](),controller[_0xadd4('0x15')]);router[_0xadd4('0x16')]('/:id/teams',auth[_0xadd4('0xa')](),controller[_0xadd4('0x17')]);router[_0xadd4('0x16')](_0xadd4('0x14'),auth[_0xadd4('0xa')](),controller[_0xadd4('0x18')]);router[_0xadd4('0x19')](_0xadd4('0x1a'),auth['isAuthenticated'](),controller['update']);router[_0xadd4('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0xadd4('0x1c')]);router[_0xadd4('0x1b')](_0xadd4('0x12'),auth[_0xadd4('0xa')](),controller[_0xadd4('0x1d')]);router[_0xadd4('0x1b')](_0xadd4('0x14'),auth[_0xadd4('0xa')](),controller[_0xadd4('0x1e')]);module[_0xadd4('0x1f')]=router; \ No newline at end of file +var _0x449a=['/:id/teams','addTeams','post','put','update','delete','destroy','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueue.controller','get','/describe','/:id','show','/:id/members','isAuthenticated','getMembers','getTeams','/:id/users','create'];(function(_0x43554c,_0xaefc41){var _0x1ec98c=function(_0x48aa1c){while(--_0x48aa1c){_0x43554c['push'](_0x43554c['shift']());}};_0x1ec98c(++_0xaefc41);}(_0x449a,0x191));var _0xa449=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0x449a[_0x3305de];return _0x3b5a84;};'use strict';var multer=require(_0xa449('0x0'));var util=require(_0xa449('0x1'));var path=require(_0xa449('0x2'));var timeout=require('connect-timeout');var express=require(_0xa449('0x3'));var router=express[_0xa449('0x4')]();var fs_extra=require(_0xa449('0x5'));var auth=require(_0xa449('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa449('0x7'));var controller=require(_0xa449('0x8'));router[_0xa449('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa449('0x9')](_0xa449('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xa449('0x9')](_0xa449('0xb'),auth['isAuthenticated'](),controller[_0xa449('0xc')]);router[_0xa449('0x9')](_0xa449('0xd'),auth[_0xa449('0xe')](),controller[_0xa449('0xf')]);router[_0xa449('0x9')]('/:id/teams',auth[_0xa449('0xe')](),controller[_0xa449('0x10')]);router['get'](_0xa449('0x11'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0xa449('0x12')]);router['post'](_0xa449('0x13'),auth[_0xa449('0xe')](),controller[_0xa449('0x14')]);router[_0xa449('0x15')](_0xa449('0x11'),auth['isAuthenticated'](),controller['addAgents']);router[_0xa449('0x16')]('/:id',auth[_0xa449('0xe')](),controller[_0xa449('0x17')]);router[_0xa449('0x18')](_0xa449('0xb'),auth[_0xa449('0xe')](),controller[_0xa449('0x19')]);router[_0xa449('0x18')](_0xa449('0x13'),auth[_0xa449('0xe')](),controller['removeTeams']);router[_0xa449('0x18')](_0xa449('0x11'),auth[_0xa449('0xe')](),controller[_0xa449('0x1a')]);module[_0xa449('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index bb5a827..297374f 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 _0x19b1=['exports','name','STRING','INTEGER','ENUM','roundrobin','sequelize'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x19b1,0xe6));var _0x119b=function(_0x58eec7,_0x2353db){_0x58eec7=_0x58eec7-0x0;var _0x25c5d3=_0x19b1[_0x58eec7];return _0x25c5d3;};'use strict';var Sequelize=require(_0x119b('0x0'));module[_0x119b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x119b('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x119b('0x3')]},'timeout':{'type':Sequelize[_0x119b('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x119b('0x5')]('rrmemory','beepall',_0x119b('0x6'))}}; \ No newline at end of file +var _0x5836=['sequelize','exports','STRING','name','INTEGER','rrmemory','beepall'];(function(_0x15c740,_0x3ab5cd){var _0x249631=function(_0x2c0006){while(--_0x2c0006){_0x15c740['push'](_0x15c740['shift']());}};_0x249631(++_0x3ab5cd);}(_0x5836,0x1f1));var _0x6583=function(_0x2d24e2,_0x38c3af){_0x2d24e2=_0x2d24e2-0x0;var _0x330f61=_0x5836[_0x2d24e2];return _0x330f61;};'use strict';var Sequelize=require(_0x6583('0x0'));module[_0x6583('0x1')]={'name':{'type':Sequelize[_0x6583('0x2')],'unique':_0x6583('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6583('0x2')]},'timeout':{'type':Sequelize[_0x6583('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x6583('0x5'),_0x6583('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 3ff8cd1..5c93581 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 _0x5f2f=['redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','SmsQueues','UserProfileResource','error','stack','name','map','SmsQueue','rawAttributes','type','key','getOptions','where','include','findAll','rows','show','params','model','keys','query','filters','intersection','attributes','fields','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','field','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','sequelize','transaction','isEmpty','removeAgents','addAgents','omit','spread','isArray','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api'];(function(_0xfd80d5,_0x303f80){var _0xeb957d=function(_0x1c5d12){while(--_0x1c5d12){_0xfd80d5['push'](_0xfd80d5['shift']());}};_0xeb957d(++_0x303f80);}(_0x5f2f,0x73));var _0xf5f2=function(_0x56e4e7,_0x1db098){_0x56e4e7=_0x56e4e7-0x0;var _0x383618=_0x5f2f[_0x56e4e7];return _0x383618;};'use strict';var BPromise=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var squel=require(_0xf5f2('0x3'));var Redis=require(_0xf5f2('0x4'));var qs=require(_0xf5f2('0x5'));var logger=require(_0xf5f2('0x6'))(_0xf5f2('0x7'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xf5f2('0x8')]=_[_0xf5f2('0x9')](config[_0xf5f2('0x8')],{'host':_0xf5f2('0xa'),'port':0x18eb});var socket=require(_0xf5f2('0xb'))(new Redis(config[_0xf5f2('0x8')]));require('./smsQueue.socket')[_0xf5f2('0xc')](socket);function respondWithStatusCode(_0x46cd9c,_0x2ec345){_0x2ec345=_0x2ec345||0xcc;return function(_0x56a69f){if(_0x56a69f){return _0x46cd9c[_0xf5f2('0xd')](_0x2ec345);}return _0x46cd9c[_0xf5f2('0xe')](_0x2ec345)[_0xf5f2('0xf')]();};}function respondWithResult(_0x4e0e6b,_0x977a59){_0x977a59=_0x977a59||0xc8;return function(_0x4ebbbe){if(_0x4ebbbe){return _0x4e0e6b['status'](_0x977a59)[_0xf5f2('0x10')](_0x4ebbbe);}};}function respondWithFilteredResult(_0x151aba,_0x4b78cd){return function(_0x336f6b){if(_0x336f6b){var _0x14b51f=typeof _0x4b78cd[_0xf5f2('0x11')]===_0xf5f2('0x12')&&typeof _0x4b78cd[_0xf5f2('0x13')]===_0xf5f2('0x12');var _0x5c01b8=_0x336f6b[_0xf5f2('0x14')];var _0xea612c=_0x14b51f?0x0:_0x4b78cd[_0xf5f2('0x11')];var _0x1c1a5c=_0x14b51f?_0x336f6b[_0xf5f2('0x14')]:_0x4b78cd['offset']+_0x4b78cd[_0xf5f2('0x13')];var _0x286197;if(_0x1c1a5c>=_0x5c01b8){_0x1c1a5c=_0x5c01b8;_0x286197=0xc8;}else{_0x286197=0xce;}_0x151aba[_0xf5f2('0xe')](_0x286197);return _0x151aba[_0xf5f2('0x15')](_0xf5f2('0x16'),_0xea612c+'-'+_0x1c1a5c+'/'+_0x5c01b8)[_0xf5f2('0x10')](_0x336f6b);}return null;};}function saveUpdates(_0xdb61b3){return function(_0x395a5a){if(_0x395a5a){return _0x395a5a[_0xf5f2('0x17')](_0xdb61b3)[_0xf5f2('0x18')](function(_0x20fccd){return _0x20fccd;});}return null;};}function removeEntity(_0x28e097){return function(_0x4ff59b){if(_0x4ff59b){return _0x4ff59b[_0xf5f2('0x19')]()[_0xf5f2('0x18')](function(){var _0x626999=_0x4ff59b[_0xf5f2('0x1a')]({'plain':!![]});var _0x56acc5=_0xf5f2('0x1b');return db[_0xf5f2('0x1c')]['destroy']({'where':{'type':_0x56acc5,'resourceId':_0x626999['id']}})['then'](function(){return _0x4ff59b;});})[_0xf5f2('0x18')](function(){_0x28e097[_0xf5f2('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45b74f){return function(_0x170042){if(!_0x170042){_0x45b74f[_0xf5f2('0xd')](0x194);}return _0x170042;};}function handleError(_0x39c024,_0x36f1cb){_0x36f1cb=_0x36f1cb||0x1f4;return function(_0x4c691a){logger[_0xf5f2('0x1d')](_0x4c691a[_0xf5f2('0x1e')]);if(_0x4c691a[_0xf5f2('0x1f')]){delete _0x4c691a[_0xf5f2('0x1f')];}_0x39c024[_0xf5f2('0xe')](_0x36f1cb)['send'](_0x4c691a);};}exports['index']=function(_0x5f1124,_0x3f79d5){var _0x13da6f={};var _0x1a5bb3={'count':0x0,'rows':[]};var _0xf6c58d=_[_0xf5f2('0x20')](db[_0xf5f2('0x21')][_0xf5f2('0x22')],function(_0x294414){return{'name':_0x294414['fieldName'],'type':_0x294414[_0xf5f2('0x23')][_0xf5f2('0x24')]};});_0x13da6f=qs[_0xf5f2('0x25')](_0xf6c58d,_0x5f1124);var _0x31bfcb={'where':_0x13da6f[_0xf5f2('0x26')]};return db[_0xf5f2('0x21')]['count'](_0x31bfcb)['then'](function(_0x22c826){_0x1a5bb3[_0xf5f2('0x14')]=_0x22c826;_0x13da6f[_0xf5f2('0x27')]=qs['include'](_0x5f1124['query']);return db[_0xf5f2('0x21')][_0xf5f2('0x28')](_0x13da6f);})[_0xf5f2('0x18')](function(_0x153924){_0x1a5bb3[_0xf5f2('0x29')]=_0x153924;return _0x1a5bb3;})['then'](respondWithFilteredResult(_0x3f79d5,_0x13da6f))['catch'](handleError(_0x3f79d5,null));};exports[_0xf5f2('0x2a')]=function(_0x4e19cb,_0xb744b9){var _0x58a4df={'raw':!![],'where':{'id':_0x4e19cb[_0xf5f2('0x2b')]['id']}},_0x45b643={};_0x45b643[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x21')][_0xf5f2('0x22')]);_0x45b643[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x4e19cb['query']);_0x45b643[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x45b643[_0xf5f2('0x2c')],_0x45b643[_0xf5f2('0x2e')]);_0x58a4df[_0xf5f2('0x31')]=_[_0xf5f2('0x30')](_0x45b643[_0xf5f2('0x2c')],qs['fields'](_0x4e19cb[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x58a4df['attributes']=_0x58a4df[_0xf5f2('0x31')]['length']?_0x58a4df[_0xf5f2('0x31')]:_0x45b643[_0xf5f2('0x2c')];if(_0x4e19cb[_0xf5f2('0x2e')][_0xf5f2('0x33')]){_0x58a4df['include']=[{'all':!![]}];}_0x58a4df=_['merge']({},_0x58a4df,_0x4e19cb[_0xf5f2('0x34')]);return db[_0xf5f2('0x21')][_0xf5f2('0x35')](_0x58a4df)['then'](handleEntityNotFound(_0xb744b9,null))[_0xf5f2('0x18')](respondWithResult(_0xb744b9,null))['catch'](handleError(_0xb744b9,null));};exports[_0xf5f2('0x36')]=function(_0x566c47,_0x46f464){return db[_0xf5f2('0x21')]['create'](_0x566c47[_0xf5f2('0x37')],{})[_0xf5f2('0x18')](function(_0x5a4441){var _0x35f738=_0x566c47['user']['get']({'plain':!![]});if(!_0x35f738)throw new Error(_0xf5f2('0x38'));if(_0x35f738[_0xf5f2('0x39')]===_0xf5f2('0x3a')){var _0x2d4400=_0x5a4441[_0xf5f2('0x1a')]({'plain':!![]});var _0xe62b57=_0xf5f2('0x1b');return db['UserProfileSection'][_0xf5f2('0x35')]({'where':{'name':_0xe62b57,'userProfileId':_0x35f738[_0xf5f2('0x3b')]},'raw':!![]})['then'](function(_0xc6a1ae){if(_0xc6a1ae&&_0xc6a1ae[_0xf5f2('0x3c')]===0x0){return db[_0xf5f2('0x1c')][_0xf5f2('0x36')]({'name':_0x2d4400[_0xf5f2('0x1f')],'resourceId':_0x2d4400['id'],'type':_0xc6a1ae[_0xf5f2('0x1f')],'sectionId':_0xc6a1ae['id']},{})[_0xf5f2('0x18')](function(){return _0x5a4441;});}else{return _0x5a4441;}})[_0xf5f2('0x3d')](function(_0x574f24){logger[_0xf5f2('0x1d')](_0xf5f2('0x3e'),_0x574f24);throw _0x574f24;});}return _0x5a4441;})[_0xf5f2('0x18')](respondWithResult(_0x46f464,0xc9))['catch'](handleError(_0x46f464,null));};exports['update']=function(_0x59eb00,_0x76d21b){if(_0x59eb00[_0xf5f2('0x37')]['id']){delete _0x59eb00['body']['id'];}return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x59eb00[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x76d21b,null))[_0xf5f2('0x18')](saveUpdates(_0x59eb00[_0xf5f2('0x37')],null))[_0xf5f2('0x18')](respondWithResult(_0x76d21b,null))[_0xf5f2('0x3d')](handleError(_0x76d21b,null));};exports[_0xf5f2('0x19')]=function(_0x106062,_0x444317){return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x106062[_0xf5f2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x444317,null))[_0xf5f2('0x18')](removeEntity(_0x444317,null))['catch'](handleError(_0x444317,null));};exports[_0xf5f2('0x3f')]=function(_0xc04f44,_0x218def){return db[_0xf5f2('0x21')][_0xf5f2('0x3f')]()[_0xf5f2('0x18')](respondWithResult(_0x218def,null))['catch'](handleError(_0x218def,null));};exports[_0xf5f2('0x40')]=function(_0x2e7193,_0x1c1497){var _0x29b108={'raw':!![],'where':{}},_0x12124d={},_0x10753a;return db[_0xf5f2('0x21')][_0xf5f2('0x41')]({'where':{'id':_0x2e7193['params']['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x1c1497,null))[_0xf5f2('0x18')](function(_0x45db9a){if(_0x45db9a){_0x10753a=_0x45db9a['get']({'plain':!![]});_0x12124d[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x42')]['rawAttributes']);_0x12124d['query']=_[_0xf5f2('0x2d')](_0x2e7193[_0xf5f2('0x2e')]);_0x12124d['filters']=_[_0xf5f2('0x30')](_0x12124d['model'],_0x12124d[_0xf5f2('0x2e')]);_0x29b108['attributes']=_[_0xf5f2('0x30')](_0x12124d['model'],qs[_0xf5f2('0x32')](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x29b108[_0xf5f2('0x31')]=_0x29b108['attributes'][_0xf5f2('0x43')]?_0x29b108[_0xf5f2('0x31')]:_0x12124d['model'];if(!_0x2e7193['query'][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x29b108['limit']=qs[_0xf5f2('0x13')](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x13')]);_0x29b108[_0xf5f2('0x11')]=qs['offset'](_0x2e7193['query'][_0xf5f2('0x11')]);}_0x29b108[_0xf5f2('0x46')]=qs['sort'](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x29b108[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_[_0xf5f2('0x48')](_0x2e7193[_0xf5f2('0x2e')],_0x12124d[_0xf5f2('0x2f')]));_0x29b108['where']['SmsQueueId']=_0x45db9a['id'];if(_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x29b108[_0xf5f2('0x26')]=_[_0xf5f2('0x4a')](_0x29b108[_0xf5f2('0x26')],{'$or':_['map'](_0x29b108[_0xf5f2('0x31')],function(_0x20ba91){var _0x18b124={};_0x18b124[_0x20ba91]={'$like':'%'+_0x2e7193['query'][_0xf5f2('0x49')]+'%'};return _0x18b124;})});}_0x29b108=_['merge']({},_0x29b108,_0x2e7193[_0xf5f2('0x34')]);return db[_0xf5f2('0x42')][_0xf5f2('0x28')](_0x29b108);}})[_0xf5f2('0x18')](function(_0x4afa4d){if(_0x4afa4d){return db['User'][_0xf5f2('0x4b')]({'where':{'id':_['map'](_0x4afa4d,_0xf5f2('0x4c')),'role':_0xf5f2('0x4d')},'attributes':['id','name',_0xf5f2('0x4e'),_0xf5f2('0x4f'),_0xf5f2('0x50')]});}})['then'](function(_0x397b99){if(_0x397b99){return{'count':_0x397b99[_0xf5f2('0x14')],'rows':_[_0xf5f2('0x20')](_0x397b99[_0xf5f2('0x29')],function(_0x51fa7e){return{'membername':_0x51fa7e[_0xf5f2('0x1f')],'UserId':_0x51fa7e['id'],'queue_name':_0x10753a['name'],'SmsQueueId':_0x10753a['id'],'interface':util[_0xf5f2('0x51')](_0xf5f2('0x52'),_0xf5f2('0x53'),_0x51fa7e[_0xf5f2('0x1f')]),'penalty':0x0,'paused':_0x51fa7e[_0xf5f2('0x4e')],'createdAt':_0x51fa7e['createdAt'],'updatedAt':_0x51fa7e[_0xf5f2('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf5f2('0x18')](respondWithFilteredResult(_0x1c1497,_0x29b108))[_0xf5f2('0x3d')](handleError(_0x1c1497,null));};exports[_0xf5f2('0x54')]=function(_0x2c5733,_0x5359b5){var _0x31e16b={};var _0x5ee6bc={};var _0x4c96ee;var _0xd4f6ef;return db['SmsQueue'][_0xf5f2('0x41')]({'where':{'id':_0x2c5733[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5359b5,null))[_0xf5f2('0x18')](function(_0x5767fc){if(_0x5767fc){_0x4c96ee=_0x5767fc;_0x5ee6bc[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x55')][_0xf5f2('0x22')]);_0x5ee6bc[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x2c5733[_0xf5f2('0x2e')]);_0x5ee6bc['filters']=_[_0xf5f2('0x30')](_0x5ee6bc[_0xf5f2('0x2c')],_0x5ee6bc[_0xf5f2('0x2e')]);_0x31e16b[_0xf5f2('0x31')]=_['intersection'](_0x5ee6bc[_0xf5f2('0x2c')],qs['fields'](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x31e16b['attributes']=_0x31e16b[_0xf5f2('0x31')][_0xf5f2('0x43')]?_0x31e16b[_0xf5f2('0x31')]:_0x5ee6bc[_0xf5f2('0x2c')];_0x31e16b[_0xf5f2('0x46')]=qs['sort'](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x31e16b[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_[_0xf5f2('0x48')](_0x2c5733[_0xf5f2('0x2e')],_0x5ee6bc['filters']));if(_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x31e16b['where']=_[_0xf5f2('0x4a')](_0x31e16b[_0xf5f2('0x26')],{'$or':_[_0xf5f2('0x20')](_0x31e16b['attributes'],function(_0x551cc9){var _0x4f3df6={};_0x4f3df6[_0x551cc9]={'$like':'%'+_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x49')]+'%'};return _0x4f3df6;})});}_0x31e16b=_[_0xf5f2('0x4a')]({},_0x31e16b,_0x2c5733[_0xf5f2('0x34')]);return _0x4c96ee[_0xf5f2('0x54')](_0x31e16b);}})['then'](function(_0x278b76){if(_0x278b76){_0xd4f6ef=_0x278b76[_0xf5f2('0x43')];if(!_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x31e16b[_0xf5f2('0x13')]=qs[_0xf5f2('0x13')](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x13')]);_0x31e16b[_0xf5f2('0x11')]=qs[_0xf5f2('0x11')](_0x2c5733['query']['offset']);}return _0x4c96ee['getTeams'](_0x31e16b);}})[_0xf5f2('0x18')](function(_0xafba8e){if(_0xafba8e){return _0xafba8e?{'count':_0xd4f6ef,'rows':_0xafba8e}:null;}})[_0xf5f2('0x18')](respondWithResult(_0x5359b5,null))[_0xf5f2('0x3d')](handleError(_0x5359b5,null));};exports[_0xf5f2('0x56')]=function(_0x5c6959,_0x9d943f){var _0x43c732=_0x5c6959[_0xf5f2('0x37')][_0xf5f2('0x57')];return db[_0xf5f2('0x55')]['findAll']({'where':{'id':_0x43c732},'attributes':['id'],'include':[{'model':db[_0xf5f2('0x58')],'as':_0xf5f2('0x59'),'attributes':['id','name',_0xf5f2('0x5a'),_0xf5f2('0x5b'),_0xf5f2('0x5c')],'raw':!![]}]})[_0xf5f2('0x18')](function(_0x588434){if(_0x588434){var _0x40b36e=_[_0xf5f2('0x5d')](_0x588434,function(_0x19602d){var _0x2adeb4=_0x19602d[_0xf5f2('0x1a')]({'plain':!![]});return _0x2adeb4['Agents'];});return db['SmsQueue'][_0xf5f2('0x35')]({'where':{'id':_0x5c6959[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](function(_0xe3ea1e){return db['sequelize']['transaction'](function(_0x16048e){return _0xe3ea1e['addTeams'](_0x43c732,{'transaction':_0x16048e})['then'](function(){return BPromise['each'](_0x40b36e,function(_0x57cb18){return db[_0xf5f2('0x42')][_0xf5f2('0x5e')]({'where':{'UserId':_0x57cb18['id'],'SmsQueueId':_0x5c6959[_0xf5f2('0x2b')]['id']},'transaction':_0x16048e});});})[_0xf5f2('0x18')](function(){_0x40b36e[_0xf5f2('0x5f')](function(_0x9f941e){socket[_0xf5f2('0x60')](_0xf5f2('0x61'),{'UserId':_0x9f941e['id'],'SmsQueueId':_0xe3ea1e['id']});});});});});}})[_0xf5f2('0x18')](respondWithStatusCode(_0x9d943f,null))[_0xf5f2('0x3d')](handleError(_0x9d943f,null));};exports[_0xf5f2('0x62')]=function(_0x2afeac,_0x1ba503){return db[_0xf5f2('0x55')][_0xf5f2('0x28')]({'where':{'id':_0x2afeac[_0xf5f2('0x2e')][_0xf5f2('0x57')]},'attributes':['id'],'include':[{'model':db[_0xf5f2('0x58')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf5f2('0x18')](handleEntityNotFound(_0x1ba503,null))[_0xf5f2('0x18')](function(_0x21043b){var _0x2811ad=_[_0xf5f2('0x20')](_0x21043b,'id');var _0x308220=[];var _0x16491c=[];var _0xcf48eb=squel['select']();_0xcf48eb[_0xf5f2('0x63')]('tq.TeamId')['from']('team_has_sms_queues','tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf5f2('0x26')](_0xf5f2('0x64'),_0x2afeac[_0xf5f2('0x2b')]['id']);for(var _0x375bc9=0x0;_0x375bc9<_0x21043b[_0xf5f2('0x43')];_0x375bc9+=0x1){let _0x3cf857=_0x21043b[_0x375bc9];for(var _0x5dc63f=0x0;_0x5dc63f<_0x3cf857['Agents'][_0xf5f2('0x43')];_0x5dc63f+=0x1){let _0x578a22=_0x3cf857[_0xf5f2('0x59')][_0x5dc63f];var _0x186fdd=_0xcf48eb['clone']();_0x186fdd['where'](_0xf5f2('0x65'),_0x578a22['id']);_0x16491c[_0xf5f2('0x66')](db['sequelize'][_0xf5f2('0x2e')](_0x186fdd[_0xf5f2('0x67')](),{'type':db['sequelize'][_0xf5f2('0x68')][_0xf5f2('0x69')]})[_0xf5f2('0x18')](function(_0x4c1678){if(_0x4c1678[_0xf5f2('0x43')]===0x1){return _0x578a22['id'];}else{var _0xc28adc=_[_0xf5f2('0x6a')](_[_0xf5f2('0x20')](_0x4c1678,_0xf5f2('0x6b')),function(_0x3e0288){return _[_0xf5f2('0x6c')](_0x2811ad,_0x3e0288);});if(_0xc28adc){return _0x578a22['id'];}}}));}}return BPromise[_0xf5f2('0x6d')](_0x16491c)[_0xf5f2('0x18')](function(_0x3a6f60){_0x308220=_(_0x308220)[_0xf5f2('0x6e')](_0x3a6f60)[_0xf5f2('0x6f')]()[_0xf5f2('0x70')]();return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x2afeac[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](function(_0x29a9d4){return db[_0xf5f2('0x71')][_0xf5f2('0x72')](function(_0x800f42){return _0x29a9d4['removeTeams'](_0x2afeac[_0xf5f2('0x2e')][_0xf5f2('0x57')],{'transaction':_0x800f42})['then'](function(){if(!_[_0xf5f2('0x73')](_0x308220)){return _0x29a9d4[_0xf5f2('0x74')](_0x308220,{'transaction':_0x800f42});}})['then'](function(){_0x308220[_0xf5f2('0x5f')](function(_0x2f54eb){socket[_0xf5f2('0x60')]('userSmsQueue:remove',{'UserId':_0x2f54eb,'SmsQueueId':_0x29a9d4['id']});});});});});});})['then'](respondWithStatusCode(_0x1ba503,null))[_0xf5f2('0x3d')](handleError(_0x1ba503,null));};exports[_0xf5f2('0x75')]=function(_0x213ade,_0x5ba275){return db['SmsQueue'][_0xf5f2('0x35')]({'where':{'id':_0x213ade[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5ba275,null))['then'](function(_0x4cde64){if(_0x4cde64){return _0x4cde64['addAgents'](_0x213ade['body']['ids'],_[_0xf5f2('0x76')](_0x213ade['body'],[_0xf5f2('0x57'),'id'])||{})[_0xf5f2('0x77')](function(_0xec3c35){for(var _0x43a167=0x0;_0x43a167<_0x213ade[_0xf5f2('0x37')][_0xf5f2('0x57')][_0xf5f2('0x43')];_0x43a167+=0x1){socket[_0xf5f2('0x60')](_0xf5f2('0x61'),{'UserId':Number(_0x213ade[_0xf5f2('0x37')][_0xf5f2('0x57')][_0x43a167]),'SmsQueueId':Number(_0x213ade[_0xf5f2('0x2b')]['id'])});}return _0xec3c35;});}})[_0xf5f2('0x18')](respondWithResult(_0x5ba275,null))['catch'](handleError(_0x5ba275,null));};exports[_0xf5f2('0x74')]=function(_0x2a4fed,_0x5783e2){return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x2a4fed['params']['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5783e2,null))[_0xf5f2('0x18')](function(_0x281f61){if(_0x281f61){return _0x281f61['removeAgents'](_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')])['then'](function(){if(_[_0xf5f2('0x78')](_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')])){for(var _0x517aa8=0x0;_0x517aa8<_0x2a4fed[_0xf5f2('0x2e')]['ids'][_0xf5f2('0x43')];_0x517aa8+=0x1){socket['emit'](_0xf5f2('0x79'),{'UserId':Number(_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')][_0x517aa8]),'SmsQueueId':Number(_0x2a4fed[_0xf5f2('0x2b')]['id'])});}}else{socket['emit'](_0xf5f2('0x79'),{'UserId':Number(_0x2a4fed['query']['ids']),'SmsQueueId':Number(_0x2a4fed['params']['id'])});}});}})[_0xf5f2('0x18')](respondWithStatusCode(_0x5783e2,null))[_0xf5f2('0x3d')](handleError(_0x5783e2,null));};exports['getAgents']=function(_0x3c8a1b,_0x15025d){var _0x35790b={};var _0x3962b2={};var _0x28873e;var _0x1fc5ae;return db['SmsQueue'][_0xf5f2('0x41')]({'where':{'id':_0x3c8a1b[_0xf5f2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x15025d,null))[_0xf5f2('0x18')](function(_0x19cbff){if(_0x19cbff){_0x28873e=_0x19cbff;_0x3962b2['model']=_[_0xf5f2('0x2d')](db[_0xf5f2('0x58')][_0xf5f2('0x22')]);_0x3962b2[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x3c8a1b[_0xf5f2('0x2e')]);_0x3962b2['filters']=_[_0xf5f2('0x30')](_0x3962b2[_0xf5f2('0x2c')],_0x3962b2[_0xf5f2('0x2e')]);_0x35790b[_0xf5f2('0x31')]=_[_0xf5f2('0x30')](_0x3962b2[_0xf5f2('0x2c')],qs[_0xf5f2('0x32')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x35790b['attributes']=_0x35790b[_0xf5f2('0x31')][_0xf5f2('0x43')]?_0x35790b[_0xf5f2('0x31')]:_0x3962b2[_0xf5f2('0x2c')];_0x35790b[_0xf5f2('0x46')]=qs[_0xf5f2('0x47')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x35790b[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_['pick'](_0x3c8a1b['query'],_0x3962b2[_0xf5f2('0x2f')]));if(_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x35790b[_0xf5f2('0x26')]=_['merge'](_0x35790b[_0xf5f2('0x26')],{'$or':_[_0xf5f2('0x20')](_0x35790b[_0xf5f2('0x31')],function(_0x3d7f53){var _0x456a1e={};_0x456a1e[_0x3d7f53]={'$like':'%'+_0x3c8a1b['query'][_0xf5f2('0x49')]+'%'};return _0x456a1e;})});}_0x35790b=_[_0xf5f2('0x4a')]({},_0x35790b,_0x3c8a1b['options']);return _0x28873e[_0xf5f2('0x7a')](_0x35790b);}})[_0xf5f2('0x18')](function(_0x2563fa){if(_0x2563fa){_0x1fc5ae=_0x2563fa[_0xf5f2('0x43')];if(!_0x3c8a1b['query'][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x35790b[_0xf5f2('0x13')]=qs['limit'](_0x3c8a1b['query'][_0xf5f2('0x13')]);_0x35790b[_0xf5f2('0x11')]=qs[_0xf5f2('0x11')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x11')]);}return _0x28873e[_0xf5f2('0x7a')](_0x35790b);}})['then'](function(_0x39dee8){if(_0x39dee8){return _0x39dee8?{'count':_0x1fc5ae,'rows':_0x39dee8}:null;}})['then'](respondWithResult(_0x15025d,null))[_0xf5f2('0x3d')](handleError(_0x15025d,null));}; \ No newline at end of file +var _0xdb28=['userSmsQueue:save','removeTeams','select','field','from','team_has_sms_queues','join','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','TeamId','includes','all','union','value','isEmpty','removeAgents','forEach','addAgents','omit','spread','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','./smsQueue.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','update','then','get','SmsQueues','destroy','error','stack','name','map','SmsQueue','fieldName','type','key','where','include','rows','show','keys','query','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','body','params','describe','getMembers','findOne','UserSmsQueue','rawAttributes','hasOwnProperty','nolimit','order','sort','SmsQueueId','filter','findAll','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','pick','ids','Agents','online','voicePause','interface','sequelize','transaction','addTeams','each','emit'];(function(_0x5b8ad4,_0x2e2409){var _0x5e8fbe=function(_0x220503){while(--_0x220503){_0x5b8ad4['push'](_0x5b8ad4['shift']());}};_0x5e8fbe(++_0x2e2409);}(_0xdb28,0x106));var _0x8db2=function(_0x57e801,_0x2e0c25){_0x57e801=_0x57e801-0x0;var _0x28a9e8=_0xdb28[_0x57e801];return _0x28a9e8;};'use strict';var BPromise=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var _=require(_0x8db2('0x2'));var squel=require(_0x8db2('0x3'));var Redis=require('ioredis');var qs=require(_0x8db2('0x4'));var logger=require(_0x8db2('0x5'))(_0x8db2('0x6'));var config=require(_0x8db2('0x7'));var db=require(_0x8db2('0x8'))['db'];config['redis']=_[_0x8db2('0x9')](config[_0x8db2('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8db2('0xa')]));require(_0x8db2('0xb'))[_0x8db2('0xc')](socket);function respondWithStatusCode(_0x29f698,_0x2f3f2f){_0x2f3f2f=_0x2f3f2f||0xcc;return function(_0x1ff362){if(_0x1ff362){return _0x29f698[_0x8db2('0xd')](_0x2f3f2f);}return _0x29f698['status'](_0x2f3f2f)[_0x8db2('0xe')]();};}function respondWithResult(_0x476216,_0x1f62af){_0x1f62af=_0x1f62af||0xc8;return function(_0x57015f){if(_0x57015f){return _0x476216[_0x8db2('0xf')](_0x1f62af)[_0x8db2('0x10')](_0x57015f);}};}function respondWithFilteredResult(_0x576475,_0x41beda){return function(_0x3b2faa){if(_0x3b2faa){var _0x1349f6=typeof _0x41beda[_0x8db2('0x11')]===_0x8db2('0x12')&&typeof _0x41beda['limit']==='undefined';var _0x15070d=_0x3b2faa[_0x8db2('0x13')];var _0x350d61=_0x1349f6?0x0:_0x41beda[_0x8db2('0x11')];var _0x227355=_0x1349f6?_0x3b2faa[_0x8db2('0x13')]:_0x41beda[_0x8db2('0x11')]+_0x41beda[_0x8db2('0x14')];var _0x131252;if(_0x227355>=_0x15070d){_0x227355=_0x15070d;_0x131252=0xc8;}else{_0x131252=0xce;}_0x576475[_0x8db2('0xf')](_0x131252);return _0x576475['set'](_0x8db2('0x15'),_0x350d61+'-'+_0x227355+'/'+_0x15070d)[_0x8db2('0x10')](_0x3b2faa);}return null;};}function saveUpdates(_0x48101e){return function(_0x2b3f73){if(_0x2b3f73){return _0x2b3f73[_0x8db2('0x16')](_0x48101e)[_0x8db2('0x17')](function(_0x3fddc2){return _0x3fddc2;});}return null;};}function removeEntity(_0x2efd06){return function(_0x46ce14){if(_0x46ce14){return _0x46ce14['destroy']()['then'](function(){var _0x77789=_0x46ce14[_0x8db2('0x18')]({'plain':!![]});var _0x1310d3=_0x8db2('0x19');return db['UserProfileResource'][_0x8db2('0x1a')]({'where':{'type':_0x1310d3,'resourceId':_0x77789['id']}})[_0x8db2('0x17')](function(){return _0x46ce14;});})[_0x8db2('0x17')](function(){_0x2efd06[_0x8db2('0xf')](0xcc)[_0x8db2('0xe')]();});}};}function handleEntityNotFound(_0x597260){return function(_0x124467){if(!_0x124467){_0x597260[_0x8db2('0xd')](0x194);}return _0x124467;};}function handleError(_0x18f69c,_0x125be2){_0x125be2=_0x125be2||0x1f4;return function(_0x2260d8){logger[_0x8db2('0x1b')](_0x2260d8[_0x8db2('0x1c')]);if(_0x2260d8['name']){delete _0x2260d8[_0x8db2('0x1d')];}_0x18f69c['status'](_0x125be2)['send'](_0x2260d8);};}exports['index']=function(_0x4d923c,_0xec8cd2){var _0x29b5cd={};var _0x3be281={'count':0x0,'rows':[]};var _0x2baed0=_[_0x8db2('0x1e')](db[_0x8db2('0x1f')]['rawAttributes'],function(_0x3544ba){return{'name':_0x3544ba[_0x8db2('0x20')],'type':_0x3544ba[_0x8db2('0x21')][_0x8db2('0x22')]};});_0x29b5cd=qs['getOptions'](_0x2baed0,_0x4d923c);var _0x2e0691={'where':_0x29b5cd[_0x8db2('0x23')]};return db[_0x8db2('0x1f')][_0x8db2('0x13')](_0x2e0691)[_0x8db2('0x17')](function(_0x21bae5){_0x3be281[_0x8db2('0x13')]=_0x21bae5;_0x29b5cd[_0x8db2('0x24')]=qs[_0x8db2('0x24')](_0x4d923c['query']);return db[_0x8db2('0x1f')]['findAll'](_0x29b5cd);})['then'](function(_0x302188){_0x3be281[_0x8db2('0x25')]=_0x302188;return _0x3be281;})[_0x8db2('0x17')](respondWithFilteredResult(_0xec8cd2,_0x29b5cd))['catch'](handleError(_0xec8cd2,null));};exports[_0x8db2('0x26')]=function(_0x56b71a,_0x3f7aac){var _0x2b653b={'raw':!![],'where':{'id':_0x56b71a['params']['id']}},_0x14bd12={};_0x14bd12['model']=_[_0x8db2('0x27')](db[_0x8db2('0x1f')]['rawAttributes']);_0x14bd12['query']=_[_0x8db2('0x27')](_0x56b71a[_0x8db2('0x28')]);_0x14bd12[_0x8db2('0x29')]=_[_0x8db2('0x2a')](_0x14bd12[_0x8db2('0x2b')],_0x14bd12[_0x8db2('0x28')]);_0x2b653b[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x14bd12[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x56b71a['query'][_0x8db2('0x2d')]));_0x2b653b[_0x8db2('0x2c')]=_0x2b653b['attributes'][_0x8db2('0x2e')]?_0x2b653b[_0x8db2('0x2c')]:_0x14bd12['model'];if(_0x56b71a['query'][_0x8db2('0x2f')]){_0x2b653b['include']=[{'all':!![]}];}_0x2b653b=_[_0x8db2('0x30')]({},_0x2b653b,_0x56b71a[_0x8db2('0x31')]);return db[_0x8db2('0x1f')][_0x8db2('0x32')](_0x2b653b)['then'](handleEntityNotFound(_0x3f7aac,null))[_0x8db2('0x17')](respondWithResult(_0x3f7aac,null))['catch'](handleError(_0x3f7aac,null));};exports[_0x8db2('0x33')]=function(_0xd550ae,_0x2c8bc9){return db[_0x8db2('0x1f')]['create'](_0xd550ae['body'],{})[_0x8db2('0x17')](function(_0x2c0507){var _0x5dc2b4=_0xd550ae[_0x8db2('0x34')][_0x8db2('0x18')]({'plain':!![]});if(!_0x5dc2b4)throw new Error(_0x8db2('0x35'));if(_0x5dc2b4['role']===_0x8db2('0x34')){var _0x149186=_0x2c0507[_0x8db2('0x18')]({'plain':!![]});var _0x279e74=_0x8db2('0x19');return db[_0x8db2('0x36')][_0x8db2('0x32')]({'where':{'name':_0x279e74,'userProfileId':_0x5dc2b4[_0x8db2('0x37')]},'raw':!![]})[_0x8db2('0x17')](function(_0x63c561){if(_0x63c561&&_0x63c561[_0x8db2('0x38')]===0x0){return db[_0x8db2('0x39')][_0x8db2('0x33')]({'name':_0x149186['name'],'resourceId':_0x149186['id'],'type':_0x63c561[_0x8db2('0x1d')],'sectionId':_0x63c561['id']},{})[_0x8db2('0x17')](function(){return _0x2c0507;});}else{return _0x2c0507;}})['catch'](function(_0x49a7ae){logger[_0x8db2('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49a7ae);throw _0x49a7ae;});}return _0x2c0507;})[_0x8db2('0x17')](respondWithResult(_0x2c8bc9,0xc9))[_0x8db2('0x3a')](handleError(_0x2c8bc9,null));};exports[_0x8db2('0x16')]=function(_0x307783,_0xb4fe2c){if(_0x307783[_0x8db2('0x3b')]['id']){delete _0x307783[_0x8db2('0x3b')]['id'];}return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x307783[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0xb4fe2c,null))[_0x8db2('0x17')](saveUpdates(_0x307783['body'],null))[_0x8db2('0x17')](respondWithResult(_0xb4fe2c,null))[_0x8db2('0x3a')](handleError(_0xb4fe2c,null));};exports[_0x8db2('0x1a')]=function(_0x2c47cc,_0x5427af){return db[_0x8db2('0x1f')]['find']({'where':{'id':_0x2c47cc[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x5427af,null))[_0x8db2('0x17')](removeEntity(_0x5427af,null))['catch'](handleError(_0x5427af,null));};exports['describe']=function(_0x1ec3d0,_0x47c556){return db[_0x8db2('0x1f')][_0x8db2('0x3d')]()[_0x8db2('0x17')](respondWithResult(_0x47c556,null))[_0x8db2('0x3a')](handleError(_0x47c556,null));};exports[_0x8db2('0x3e')]=function(_0x40c6e6,_0x4355e2){var _0xab6bdd={'raw':!![],'where':{}},_0x4291e3={},_0x12a1ef;return db[_0x8db2('0x1f')][_0x8db2('0x3f')]({'where':{'id':_0x40c6e6['params']['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x4355e2,null))[_0x8db2('0x17')](function(_0xdbba64){if(_0xdbba64){_0x12a1ef=_0xdbba64[_0x8db2('0x18')]({'plain':!![]});_0x4291e3['model']=_['keys'](db[_0x8db2('0x40')][_0x8db2('0x41')]);_0x4291e3[_0x8db2('0x28')]=_['keys'](_0x40c6e6['query']);_0x4291e3['filters']=_[_0x8db2('0x2a')](_0x4291e3[_0x8db2('0x2b')],_0x4291e3[_0x8db2('0x28')]);_0xab6bdd[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x4291e3[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x40c6e6['query']['fields']));_0xab6bdd[_0x8db2('0x2c')]=_0xab6bdd[_0x8db2('0x2c')][_0x8db2('0x2e')]?_0xab6bdd[_0x8db2('0x2c')]:_0x4291e3[_0x8db2('0x2b')];if(!_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x42')](_0x8db2('0x43'))){_0xab6bdd[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x14')]);_0xab6bdd[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x40c6e6[_0x8db2('0x28')]['offset']);}_0xab6bdd[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x40c6e6['query'][_0x8db2('0x45')]);_0xab6bdd[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_['pick'](_0x40c6e6[_0x8db2('0x28')],_0x4291e3[_0x8db2('0x29')]));_0xab6bdd[_0x8db2('0x23')][_0x8db2('0x46')]=_0xdbba64['id'];if(_0x40c6e6[_0x8db2('0x28')]['filter']){_0xab6bdd[_0x8db2('0x23')]=_[_0x8db2('0x30')](_0xab6bdd[_0x8db2('0x23')],{'$or':_['map'](_0xab6bdd[_0x8db2('0x2c')],function(_0x18cc13){var _0x33dddd={};_0x33dddd[_0x18cc13]={'$like':'%'+_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x47')]+'%'};return _0x33dddd;})});}_0xab6bdd=_[_0x8db2('0x30')]({},_0xab6bdd,_0x40c6e6[_0x8db2('0x31')]);return db['UserSmsQueue'][_0x8db2('0x48')](_0xab6bdd);}})[_0x8db2('0x17')](function(_0x4d3c19){if(_0x4d3c19){return db[_0x8db2('0x49')][_0x8db2('0x4a')]({'where':{'id':_['map'](_0x4d3c19,_0x8db2('0x4b')),'role':_0x8db2('0x4c')},'attributes':['id',_0x8db2('0x1d'),_0x8db2('0x4d'),_0x8db2('0x4e'),_0x8db2('0x4f')]});}})[_0x8db2('0x17')](function(_0x33a600){if(_0x33a600){return{'count':_0x33a600[_0x8db2('0x13')],'rows':_[_0x8db2('0x1e')](_0x33a600[_0x8db2('0x25')],function(_0x447a47){return{'membername':_0x447a47[_0x8db2('0x1d')],'UserId':_0x447a47['id'],'queue_name':_0x12a1ef[_0x8db2('0x1d')],'SmsQueueId':_0x12a1ef['id'],'interface':util[_0x8db2('0x50')](_0x8db2('0x51'),'SIP',_0x447a47[_0x8db2('0x1d')]),'penalty':0x0,'paused':_0x447a47[_0x8db2('0x4d')],'createdAt':_0x447a47[_0x8db2('0x4f')],'updatedAt':_0x447a47[_0x8db2('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8db2('0x17')](respondWithFilteredResult(_0x4355e2,_0xab6bdd))['catch'](handleError(_0x4355e2,null));};exports[_0x8db2('0x52')]=function(_0x2c3087,_0x3ab670){var _0x1e1c0d={};var _0x2ad70f={};var _0x348da8;var _0x17341d;return db[_0x8db2('0x1f')][_0x8db2('0x3f')]({'where':{'id':_0x2c3087[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x3ab670,null))[_0x8db2('0x17')](function(_0x170a72){if(_0x170a72){_0x348da8=_0x170a72;_0x2ad70f[_0x8db2('0x2b')]=_[_0x8db2('0x27')](db[_0x8db2('0x53')][_0x8db2('0x41')]);_0x2ad70f[_0x8db2('0x28')]=_['keys'](_0x2c3087[_0x8db2('0x28')]);_0x2ad70f['filters']=_[_0x8db2('0x2a')](_0x2ad70f['model'],_0x2ad70f[_0x8db2('0x28')]);_0x1e1c0d[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x2ad70f[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x2c3087['query']['fields']));_0x1e1c0d[_0x8db2('0x2c')]=_0x1e1c0d[_0x8db2('0x2c')][_0x8db2('0x2e')]?_0x1e1c0d[_0x8db2('0x2c')]:_0x2ad70f[_0x8db2('0x2b')];_0x1e1c0d[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x2c3087[_0x8db2('0x28')]['sort']);_0x1e1c0d[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_[_0x8db2('0x54')](_0x2c3087[_0x8db2('0x28')],_0x2ad70f[_0x8db2('0x29')]));if(_0x2c3087[_0x8db2('0x28')][_0x8db2('0x47')]){_0x1e1c0d[_0x8db2('0x23')]=_['merge'](_0x1e1c0d['where'],{'$or':_[_0x8db2('0x1e')](_0x1e1c0d[_0x8db2('0x2c')],function(_0x1d2dfc){var _0x27f4cd={};_0x27f4cd[_0x1d2dfc]={'$like':'%'+_0x2c3087[_0x8db2('0x28')]['filter']+'%'};return _0x27f4cd;})});}_0x1e1c0d=_['merge']({},_0x1e1c0d,_0x2c3087[_0x8db2('0x31')]);return _0x348da8[_0x8db2('0x52')](_0x1e1c0d);}})['then'](function(_0xa698bd){if(_0xa698bd){_0x17341d=_0xa698bd[_0x8db2('0x2e')];if(!_0x2c3087[_0x8db2('0x28')]['hasOwnProperty'](_0x8db2('0x43'))){_0x1e1c0d[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x2c3087['query'][_0x8db2('0x14')]);_0x1e1c0d[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x2c3087[_0x8db2('0x28')][_0x8db2('0x11')]);}return _0x348da8['getTeams'](_0x1e1c0d);}})[_0x8db2('0x17')](function(_0x3023fe){if(_0x3023fe){return _0x3023fe?{'count':_0x17341d,'rows':_0x3023fe}:null;}})[_0x8db2('0x17')](respondWithResult(_0x3ab670,null))['catch'](handleError(_0x3ab670,null));};exports['addTeams']=function(_0x2cdf3c,_0xbe05ca){var _0x487dcb=_0x2cdf3c[_0x8db2('0x3b')][_0x8db2('0x55')];return db[_0x8db2('0x53')][_0x8db2('0x48')]({'where':{'id':_0x487dcb},'attributes':['id'],'include':[{'model':db[_0x8db2('0x49')],'as':_0x8db2('0x56'),'attributes':['id',_0x8db2('0x1d'),_0x8db2('0x57'),_0x8db2('0x58'),_0x8db2('0x59')],'raw':!![]}]})[_0x8db2('0x17')](function(_0x3e1478){if(_0x3e1478){var _0x24a52d=_['flatMap'](_0x3e1478,function(_0x2ba42d){var _0x4f29f1=_0x2ba42d[_0x8db2('0x18')]({'plain':!![]});return _0x4f29f1[_0x8db2('0x56')];});return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x2cdf3c[_0x8db2('0x3c')]['id']}})['then'](function(_0x2159c4){return db[_0x8db2('0x5a')][_0x8db2('0x5b')](function(_0x25a3ab){return _0x2159c4[_0x8db2('0x5c')](_0x487dcb,{'transaction':_0x25a3ab})[_0x8db2('0x17')](function(){return BPromise[_0x8db2('0x5d')](_0x24a52d,function(_0x3ac0fa){return db[_0x8db2('0x40')]['findOrCreate']({'where':{'UserId':_0x3ac0fa['id'],'SmsQueueId':_0x2cdf3c['params']['id']},'transaction':_0x25a3ab});});})[_0x8db2('0x17')](function(){_0x24a52d['forEach'](function(_0xf8afa5){socket[_0x8db2('0x5e')](_0x8db2('0x5f'),{'UserId':_0xf8afa5['id'],'SmsQueueId':_0x2159c4['id']});});});});});}})['then'](respondWithStatusCode(_0xbe05ca,null))[_0x8db2('0x3a')](handleError(_0xbe05ca,null));};exports[_0x8db2('0x60')]=function(_0x3e37e7,_0x591c5d){return db[_0x8db2('0x53')][_0x8db2('0x48')]({'where':{'id':_0x3e37e7[_0x8db2('0x28')][_0x8db2('0x55')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8db2('0x56'),'attributes':['id'],'raw':!![]}]})[_0x8db2('0x17')](handleEntityNotFound(_0x591c5d,null))[_0x8db2('0x17')](function(_0x1edb1a){var _0xcf1c42=_[_0x8db2('0x1e')](_0x1edb1a,'id');var _0x1aadfb=[];var _0x3682bf=[];var _0x358f48=squel[_0x8db2('0x61')]();_0x358f48[_0x8db2('0x62')]('tq.TeamId')[_0x8db2('0x63')](_0x8db2('0x64'),'tq')[_0x8db2('0x65')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x8db2('0x66'),_0x3e37e7[_0x8db2('0x3c')]['id']);for(var _0x3191c8=0x0;_0x3191c8<_0x1edb1a[_0x8db2('0x2e')];_0x3191c8+=0x1){let _0x2ad024=_0x1edb1a[_0x3191c8];for(var _0x313918=0x0;_0x313918<_0x2ad024[_0x8db2('0x56')][_0x8db2('0x2e')];_0x313918+=0x1){let _0x3b1929=_0x2ad024[_0x8db2('0x56')][_0x313918];var _0x46eb80=_0x358f48['clone']();_0x46eb80[_0x8db2('0x23')](_0x8db2('0x67'),_0x3b1929['id']);_0x3682bf[_0x8db2('0x68')](db[_0x8db2('0x5a')]['query'](_0x46eb80['toString'](),{'type':db[_0x8db2('0x5a')][_0x8db2('0x69')]['SELECT']})[_0x8db2('0x17')](function(_0x121f31){if(_0x121f31[_0x8db2('0x2e')]===0x1){return _0x3b1929['id'];}else{var _0x5f2ece=_['every'](_['map'](_0x121f31,_0x8db2('0x6a')),function(_0x18b4a6){return _[_0x8db2('0x6b')](_0xcf1c42,_0x18b4a6);});if(_0x5f2ece){return _0x3b1929['id'];}}}));}}return BPromise[_0x8db2('0x6c')](_0x3682bf)[_0x8db2('0x17')](function(_0x4e8aac){_0x1aadfb=_(_0x1aadfb)[_0x8db2('0x6d')](_0x4e8aac)['compact']()[_0x8db2('0x6e')]();return db[_0x8db2('0x1f')][_0x8db2('0x32')]({'where':{'id':_0x3e37e7[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](function(_0x5d5380){return db['sequelize'][_0x8db2('0x5b')](function(_0x51afcf){return _0x5d5380[_0x8db2('0x60')](_0x3e37e7[_0x8db2('0x28')][_0x8db2('0x55')],{'transaction':_0x51afcf})[_0x8db2('0x17')](function(){if(!_[_0x8db2('0x6f')](_0x1aadfb)){return _0x5d5380[_0x8db2('0x70')](_0x1aadfb,{'transaction':_0x51afcf});}})['then'](function(){_0x1aadfb[_0x8db2('0x71')](function(_0x222ea2){socket[_0x8db2('0x5e')]('userSmsQueue:remove',{'UserId':_0x222ea2,'SmsQueueId':_0x5d5380['id']});});});});});});})[_0x8db2('0x17')](respondWithStatusCode(_0x591c5d,null))[_0x8db2('0x3a')](handleError(_0x591c5d,null));};exports['addAgents']=function(_0x2d7abf,_0x7cb97d){return db[_0x8db2('0x1f')][_0x8db2('0x32')]({'where':{'id':_0x2d7abf[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x7cb97d,null))[_0x8db2('0x17')](function(_0x19e25b){if(_0x19e25b){return _0x19e25b[_0x8db2('0x72')](_0x2d7abf['body'][_0x8db2('0x55')],_[_0x8db2('0x73')](_0x2d7abf[_0x8db2('0x3b')],[_0x8db2('0x55'),'id'])||{})[_0x8db2('0x74')](function(_0x345ff9){for(var _0x16d1c5=0x0;_0x16d1c5<_0x2d7abf[_0x8db2('0x3b')][_0x8db2('0x55')][_0x8db2('0x2e')];_0x16d1c5+=0x1){socket['emit'](_0x8db2('0x5f'),{'UserId':Number(_0x2d7abf[_0x8db2('0x3b')][_0x8db2('0x55')][_0x16d1c5]),'SmsQueueId':Number(_0x2d7abf[_0x8db2('0x3c')]['id'])});}return _0x345ff9;});}})['then'](respondWithResult(_0x7cb97d,null))[_0x8db2('0x3a')](handleError(_0x7cb97d,null));};exports[_0x8db2('0x70')]=function(_0x46476e,_0x4f653e){return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x46476e[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x4f653e,null))[_0x8db2('0x17')](function(_0x4f9ce4){if(_0x4f9ce4){return _0x4f9ce4[_0x8db2('0x70')](_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')])[_0x8db2('0x17')](function(){if(_['isArray'](_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')])){for(var _0x3e7b24=0x0;_0x3e7b24<_0x46476e['query']['ids']['length'];_0x3e7b24+=0x1){socket[_0x8db2('0x5e')](_0x8db2('0x75'),{'UserId':Number(_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')][_0x3e7b24]),'SmsQueueId':Number(_0x46476e['params']['id'])});}}else{socket['emit'](_0x8db2('0x75'),{'UserId':Number(_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')]),'SmsQueueId':Number(_0x46476e[_0x8db2('0x3c')]['id'])});}});}})[_0x8db2('0x17')](respondWithStatusCode(_0x4f653e,null))[_0x8db2('0x3a')](handleError(_0x4f653e,null));};exports['getAgents']=function(_0x2942eb,_0x5f32ce){var _0x432780={};var _0x23457b={};var _0x1ef898;var _0x39f2d3;return db[_0x8db2('0x1f')]['findOne']({'where':{'id':_0x2942eb[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x5f32ce,null))['then'](function(_0x28beec){if(_0x28beec){_0x1ef898=_0x28beec;_0x23457b[_0x8db2('0x2b')]=_[_0x8db2('0x27')](db[_0x8db2('0x49')]['rawAttributes']);_0x23457b[_0x8db2('0x28')]=_['keys'](_0x2942eb['query']);_0x23457b[_0x8db2('0x29')]=_[_0x8db2('0x2a')](_0x23457b[_0x8db2('0x2b')],_0x23457b[_0x8db2('0x28')]);_0x432780[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x23457b[_0x8db2('0x2b')],qs['fields'](_0x2942eb[_0x8db2('0x28')]['fields']));_0x432780['attributes']=_0x432780[_0x8db2('0x2c')]['length']?_0x432780['attributes']:_0x23457b[_0x8db2('0x2b')];_0x432780[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x2942eb['query'][_0x8db2('0x45')]);_0x432780[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_['pick'](_0x2942eb[_0x8db2('0x28')],_0x23457b[_0x8db2('0x29')]));if(_0x2942eb[_0x8db2('0x28')][_0x8db2('0x47')]){_0x432780[_0x8db2('0x23')]=_[_0x8db2('0x30')](_0x432780[_0x8db2('0x23')],{'$or':_[_0x8db2('0x1e')](_0x432780['attributes'],function(_0xa7b208){var _0x3cb456={};_0x3cb456[_0xa7b208]={'$like':'%'+_0x2942eb[_0x8db2('0x28')][_0x8db2('0x47')]+'%'};return _0x3cb456;})});}_0x432780=_[_0x8db2('0x30')]({},_0x432780,_0x2942eb[_0x8db2('0x31')]);return _0x1ef898[_0x8db2('0x76')](_0x432780);}})[_0x8db2('0x17')](function(_0x3a53e2){if(_0x3a53e2){_0x39f2d3=_0x3a53e2[_0x8db2('0x2e')];if(!_0x2942eb[_0x8db2('0x28')]['hasOwnProperty'](_0x8db2('0x43'))){_0x432780[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x2942eb['query'][_0x8db2('0x14')]);_0x432780[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x2942eb['query']['offset']);}return _0x1ef898[_0x8db2('0x76')](_0x432780);}})[_0x8db2('0x17')](function(_0x296966){if(_0x296966){return _0x296966?{'count':_0x39f2d3,'rows':_0x296966}:null;}})[_0x8db2('0x17')](respondWithResult(_0x5f32ce,null))[_0x8db2('0x3a')](handleError(_0x5f32ce,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index f57b49f..f022b46 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 _0x78ff=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','SmsQueue','setMaxListeners','save','update'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0x78ff,0x145));var _0xf78f=function(_0x15dba5,_0x5d2fbe){_0x15dba5=_0x15dba5-0x0;var _0x12e9f9=_0x78ff[_0x15dba5];return _0x12e9f9;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0xf78f('0x0'))['db'][_0xf78f('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xf78f('0x2')](0x0);var events={'afterCreate':_0xf78f('0x3'),'afterUpdate':_0xf78f('0x4'),'afterDestroy':_0xf78f('0x5')};function emitEvent(_0x3f7a2c){return function(_0x1cf462,_0x240d13,_0x2d5bd1){SmsQueueEvents[_0xf78f('0x6')](_0x3f7a2c+':'+_0x1cf462['id'],_0x1cf462);SmsQueueEvents[_0xf78f('0x6')](_0x3f7a2c,_0x1cf462);_0x2d5bd1(null);};}for(var e in events){if(events[_0xf78f('0x7')](e)){var event=events[e];SmsQueue[_0xf78f('0x8')](e,emitEvent(event));}}module[_0xf78f('0x9')]=SmsQueueEvents; \ No newline at end of file +var _0xb02d=['remove','hook','../../mysqldb','SmsQueue','setMaxListeners'];(function(_0x1720ec,_0x3f61b6){var _0x17921c=function(_0x2e4cf9){while(--_0x2e4cf9){_0x1720ec['push'](_0x1720ec['shift']());}};_0x17921c(++_0x3f61b6);}(_0xb02d,0x188));var _0xdb02=function(_0x372b6f,_0x53b7e4){_0x372b6f=_0x372b6f-0x0;var _0x49af2b=_0xb02d[_0x372b6f];return _0x49af2b;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0xdb02('0x0'))['db'][_0xdb02('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xdb02('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xdb02('0x3')};function emitEvent(_0x485915){return function(_0x16b5da,_0x1ec630,_0x362b9c){SmsQueueEvents['emit'](_0x485915+':'+_0x16b5da['id'],_0x16b5da);SmsQueueEvents['emit'](_0x485915,_0x16b5da);_0x362b9c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0xdb02('0x4')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index ffdfd67..17f9ebb 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 _0x07fa=['../../config/environment','./smsQueue.attributes','SmsQueue','sms_queues','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x32aa7b,_0x49defc){var _0x1d4df4=function(_0x3ad652){while(--_0x3ad652){_0x32aa7b['push'](_0x32aa7b['shift']());}};_0x1d4df4(++_0x49defc);}(_0x07fa,0x1a8));var _0xa07f=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0x07fa[_0x5ddaac];return _0x2a9c58;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa07f('0x0'))(_0xa07f('0x1'));var moment=require(_0xa07f('0x2'));var BPromise=require(_0xa07f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa07f('0x4'));var rimraf=require(_0xa07f('0x5'));var config=require(_0xa07f('0x6'));var attributes=require(_0xa07f('0x7'));module['exports']=function(_0x58a4a8,_0x2eb1fd){return _0x58a4a8['define'](_0xa07f('0x8'),attributes,{'tableName':_0xa07f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef83=['bluebird','request-promise','path','rimraf','exports','define','SmsQueue','sms_queues','lodash','util','../../config/logger','api','moment'];(function(_0x1a8a82,_0x4dc3d4){var _0xd30750=function(_0x48371b){while(--_0x48371b){_0x1a8a82['push'](_0x1a8a82['shift']());}};_0xd30750(++_0x4dc3d4);}(_0xef83,0xb1));var _0x3ef8=function(_0x56f151,_0x281759){_0x56f151=_0x56f151-0x0;var _0x52c1e3=_0xef83[_0x56f151];return _0x52c1e3;};'use strict';var _=require(_0x3ef8('0x0'));var util=require(_0x3ef8('0x1'));var logger=require(_0x3ef8('0x2'))(_0x3ef8('0x3'));var moment=require(_0x3ef8('0x4'));var BPromise=require(_0x3ef8('0x5'));var rp=require(_0x3ef8('0x6'));var fs=require('fs');var path=require(_0x3ef8('0x7'));var rimraf=require(_0x3ef8('0x8'));var config=require('../../config/environment');var attributes=require('./smsQueue.attributes');module[_0x3ef8('0x9')]=function(_0x6a0d62,_0xc53f8f){return _0x6a0d62[_0x3ef8('0xa')](_0x3ef8('0xb'),attributes,{'tableName':_0x3ef8('0xc'),'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 ed01d18..9e492a4 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 _0x6f96=['model','debug','ShowSmsQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x38aeea,_0x57522a){var _0x5e8d2c=function(_0xff08ce){while(--_0xff08ce){_0x38aeea['push'](_0x38aeea['shift']());}};_0x5e8d2c(++_0x57522a);}(_0x6f96,0x187));var _0x66f9=function(_0x5417f2,_0x5b2237){_0x5417f2=_0x5417f2-0x0;var _0x48aa43=_0x6f96[_0x5417f2];return _0x48aa43;};'use strict';var _=require(_0x66f9('0x0'));var util=require(_0x66f9('0x1'));var moment=require(_0x66f9('0x2'));var BPromise=require(_0x66f9('0x3'));var rs=require(_0x66f9('0x4'));var fs=require('fs');var Redis=require(_0x66f9('0x5'));var db=require(_0x66f9('0x6'))['db'];var utils=require(_0x66f9('0x7'));var logger=require(_0x66f9('0x8'))(_0x66f9('0x9'));var config=require(_0x66f9('0xa'));var jayson=require(_0x66f9('0xb'));var client=jayson[_0x66f9('0xc')]['http']({'port':0x232a});config[_0x66f9('0xd')]=_[_0x66f9('0xe')](config[_0x66f9('0xd')],{'host':_0x66f9('0xf'),'port':0x18eb});var socket=require(_0x66f9('0x10'))(new Redis(config[_0x66f9('0xd')]));require('./smsQueue.socket')[_0x66f9('0x11')](socket);function respondWithRpcPromise(_0x9549eb,_0xd76264,_0xbf4265){return new BPromise(function(_0x506af7,_0x3f5ba1){return client[_0x66f9('0x12')](_0x9549eb,_0xbf4265)[_0x66f9('0x13')](function(_0x6794b3){logger[_0x66f9('0x14')](_0x66f9('0x15'),_0xd76264,_0x66f9('0x16'));logger['debug']('SmsQueue,\x20%s,\x20%s,\x20%s',_0xd76264,_0x66f9('0x16'),JSON[_0x66f9('0x17')](_0x6794b3));if(_0x6794b3['error']){if(_0x6794b3[_0x66f9('0x18')][_0x66f9('0x19')]===0x1f4){logger[_0x66f9('0x18')](_0x66f9('0x15'),_0xd76264,_0x6794b3[_0x66f9('0x18')][_0x66f9('0x1a')]);return _0x3f5ba1(_0x6794b3[_0x66f9('0x18')][_0x66f9('0x1a')]);}logger[_0x66f9('0x18')]('SmsQueue,\x20%s,\x20%s',_0xd76264,_0x6794b3[_0x66f9('0x18')][_0x66f9('0x1a')]);return _0x506af7(_0x6794b3['error'][_0x66f9('0x1a')]);}else{logger[_0x66f9('0x14')](_0x66f9('0x15'),_0xd76264,_0x66f9('0x16'));_0x506af7(_0x6794b3[_0x66f9('0x1b')]['message']);}})[_0x66f9('0x1c')](function(_0x66a29c){logger[_0x66f9('0x18')](_0x66f9('0x15'),_0xd76264,_0x66a29c);_0x3f5ba1(_0x66a29c);});});}exports[_0x66f9('0x1d')]=function(_0x2f0ded){var _0x4ec217=this;return new Promise(function(_0x12eae7,_0x161483){return db[_0x66f9('0x1e')][_0x66f9('0x1f')]({'raw':_0x2f0ded[_0x66f9('0x20')]?_0x2f0ded[_0x66f9('0x20')][_0x66f9('0x21')]===undefined?!![]:![]:!![],'where':_0x2f0ded[_0x66f9('0x20')]?_0x2f0ded['options'][_0x66f9('0x22')]||null:null,'attributes':_0x2f0ded[_0x66f9('0x20')]?_0x2f0ded[_0x66f9('0x20')][_0x66f9('0x23')]||null:null,'limit':_0x2f0ded[_0x66f9('0x20')]?_0x2f0ded[_0x66f9('0x20')][_0x66f9('0x24')]||null:null,'include':_0x2f0ded[_0x66f9('0x20')]?_0x2f0ded[_0x66f9('0x20')][_0x66f9('0x25')]?_[_0x66f9('0x26')](_0x2f0ded['options'][_0x66f9('0x25')],function(_0x29d2d7){return{'model':db[_0x29d2d7[_0x66f9('0x27')]],'as':_0x29d2d7['as'],'attributes':_0x29d2d7[_0x66f9('0x23')],'include':_0x29d2d7[_0x66f9('0x25')]?_[_0x66f9('0x26')](_0x29d2d7[_0x66f9('0x25')],function(_0xadac1a){return{'model':db[_0xadac1a[_0x66f9('0x27')]],'as':_0xadac1a['as'],'attributes':_0xadac1a[_0x66f9('0x23')],'include':_0xadac1a[_0x66f9('0x25')]?_[_0x66f9('0x26')](_0xadac1a[_0x66f9('0x25')],function(_0x3f01b5){return{'model':db[_0x3f01b5['model']],'as':_0x3f01b5['as'],'attributes':_0x3f01b5[_0x66f9('0x23')]};}):[]};}):[]};}):[]:[]})[_0x66f9('0x13')](function(_0x163b03){logger[_0x66f9('0x14')](_0x66f9('0x1d'),_0x2f0ded);logger[_0x66f9('0x28')](_0x66f9('0x1d'),_0x2f0ded,JSON[_0x66f9('0x17')](_0x163b03));_0x12eae7(_0x163b03);})[_0x66f9('0x1c')](function(_0x238d82){logger[_0x66f9('0x18')](_0x66f9('0x1d'),_0x238d82[_0x66f9('0x1a')],_0x2f0ded);_0x161483(_0x4ec217[_0x66f9('0x18')](0x1f4,_0x238d82[_0x66f9('0x1a')]));});});};exports[_0x66f9('0x29')]=function(_0x2fbacf){var _0x4668a4=this;return new Promise(function(_0x85adfb,_0x1dd63c){return db[_0x66f9('0x1e')][_0x66f9('0x2a')]({'raw':_0x2fbacf['options']?_0x2fbacf[_0x66f9('0x20')][_0x66f9('0x21')]===undefined?!![]:![]:!![],'where':_0x2fbacf[_0x66f9('0x20')]?_0x2fbacf[_0x66f9('0x20')][_0x66f9('0x22')]||null:null,'attributes':_0x2fbacf[_0x66f9('0x20')]?_0x2fbacf[_0x66f9('0x20')][_0x66f9('0x23')]||null:null,'include':_0x2fbacf[_0x66f9('0x20')]?_0x2fbacf['options'][_0x66f9('0x25')]?_[_0x66f9('0x26')](_0x2fbacf['options'][_0x66f9('0x25')],function(_0x2fc9b3){return{'model':db[_0x2fc9b3[_0x66f9('0x27')]],'as':_0x2fc9b3['as'],'attributes':_0x2fc9b3['attributes'],'include':_0x2fc9b3[_0x66f9('0x25')]?_['map'](_0x2fc9b3[_0x66f9('0x25')],function(_0x530625){return{'model':db[_0x530625[_0x66f9('0x27')]],'as':_0x530625['as'],'attributes':_0x530625[_0x66f9('0x23')],'include':_0x530625[_0x66f9('0x25')]?_['map'](_0x530625[_0x66f9('0x25')],function(_0x1e240b){return{'model':db[_0x1e240b[_0x66f9('0x27')]],'as':_0x1e240b['as'],'attributes':_0x1e240b[_0x66f9('0x23')]};}):[]};}):[]};}):[]:[]})[_0x66f9('0x13')](function(_0x44cb33){logger[_0x66f9('0x14')]('ShowSmsQueue',_0x2fbacf);logger['debug'](_0x66f9('0x29'),_0x2fbacf,JSON['stringify'](_0x44cb33));_0x85adfb(_0x44cb33);})[_0x66f9('0x1c')](function(_0x3475d1){logger[_0x66f9('0x18')](_0x66f9('0x29'),_0x3475d1['message'],_0x2fbacf);_0x1dd63c(_0x4668a4[_0x66f9('0x18')](0x1f4,_0x3475d1['message']));});});}; \ No newline at end of file +var _0x30b9=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsQueue.socket','register','info','SmsQueue,\x20%s,\x20%s','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetSmsQueue','SmsQueue','findAll','options','raw','where','limit','include','map','model','attributes','then','catch','ShowSmsQueue','find','lodash','util','moment'];(function(_0x368017,_0x44fc9c){var _0x54b512=function(_0x87ded0){while(--_0x87ded0){_0x368017['push'](_0x368017['shift']());}};_0x54b512(++_0x44fc9c);}(_0x30b9,0xd4));var _0x930b=function(_0x38e804,_0x55745b){_0x38e804=_0x38e804-0x0;var _0x4999af=_0x30b9[_0x38e804];return _0x4999af;};'use strict';var _=require(_0x930b('0x0'));var util=require(_0x930b('0x1'));var moment=require(_0x930b('0x2'));var BPromise=require(_0x930b('0x3'));var rs=require(_0x930b('0x4'));var fs=require('fs');var Redis=require(_0x930b('0x5'));var db=require(_0x930b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x930b('0x7'))(_0x930b('0x8'));var config=require(_0x930b('0x9'));var jayson=require(_0x930b('0xa'));var client=jayson[_0x930b('0xb')][_0x930b('0xc')]({'port':0x232a});config[_0x930b('0xd')]=_[_0x930b('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x930b('0xf'))(new Redis(config[_0x930b('0xd')]));require(_0x930b('0x10'))[_0x930b('0x11')](socket);function respondWithRpcPromise(_0x29979b,_0x480d1a,_0x1fa4f6){return new BPromise(function(_0x49bdee,_0x1d93d5){return client['request'](_0x29979b,_0x1fa4f6)['then'](function(_0x1e19f6){logger[_0x930b('0x12')](_0x930b('0x13'),_0x480d1a,'request\x20sent');logger[_0x930b('0x14')](_0x930b('0x15'),_0x480d1a,_0x930b('0x16'),JSON[_0x930b('0x17')](_0x1e19f6));if(_0x1e19f6['error']){if(_0x1e19f6[_0x930b('0x18')][_0x930b('0x19')]===0x1f4){logger[_0x930b('0x18')](_0x930b('0x13'),_0x480d1a,_0x1e19f6[_0x930b('0x18')][_0x930b('0x1a')]);return _0x1d93d5(_0x1e19f6['error']['message']);}logger[_0x930b('0x18')](_0x930b('0x13'),_0x480d1a,_0x1e19f6['error'][_0x930b('0x1a')]);return _0x49bdee(_0x1e19f6[_0x930b('0x18')]['message']);}else{logger[_0x930b('0x12')](_0x930b('0x13'),_0x480d1a,_0x930b('0x16'));_0x49bdee(_0x1e19f6[_0x930b('0x1b')][_0x930b('0x1a')]);}})['catch'](function(_0x418a2c){logger[_0x930b('0x18')](_0x930b('0x13'),_0x480d1a,_0x418a2c);_0x1d93d5(_0x418a2c);});});}exports[_0x930b('0x1c')]=function(_0x508e0a){var _0x2667e9=this;return new Promise(function(_0xa403af,_0x41870){return db[_0x930b('0x1d')][_0x930b('0x1e')]({'raw':_0x508e0a['options']?_0x508e0a[_0x930b('0x1f')][_0x930b('0x20')]===undefined?!![]:![]:!![],'where':_0x508e0a[_0x930b('0x1f')]?_0x508e0a[_0x930b('0x1f')][_0x930b('0x21')]||null:null,'attributes':_0x508e0a[_0x930b('0x1f')]?_0x508e0a[_0x930b('0x1f')]['attributes']||null:null,'limit':_0x508e0a[_0x930b('0x1f')]?_0x508e0a[_0x930b('0x1f')][_0x930b('0x22')]||null:null,'include':_0x508e0a[_0x930b('0x1f')]?_0x508e0a[_0x930b('0x1f')][_0x930b('0x23')]?_[_0x930b('0x24')](_0x508e0a[_0x930b('0x1f')]['include'],function(_0x1f175f){return{'model':db[_0x1f175f[_0x930b('0x25')]],'as':_0x1f175f['as'],'attributes':_0x1f175f[_0x930b('0x26')],'include':_0x1f175f['include']?_['map'](_0x1f175f[_0x930b('0x23')],function(_0x3e301f){return{'model':db[_0x3e301f[_0x930b('0x25')]],'as':_0x3e301f['as'],'attributes':_0x3e301f[_0x930b('0x26')],'include':_0x3e301f[_0x930b('0x23')]?_[_0x930b('0x24')](_0x3e301f[_0x930b('0x23')],function(_0x25b2e5){return{'model':db[_0x25b2e5[_0x930b('0x25')]],'as':_0x25b2e5['as'],'attributes':_0x25b2e5[_0x930b('0x26')]};}):[]};}):[]};}):[]:[]})[_0x930b('0x27')](function(_0x1d4d65){logger['info'](_0x930b('0x1c'),_0x508e0a);logger['debug'](_0x930b('0x1c'),_0x508e0a,JSON[_0x930b('0x17')](_0x1d4d65));_0xa403af(_0x1d4d65);})[_0x930b('0x28')](function(_0x56f917){logger[_0x930b('0x18')](_0x930b('0x1c'),_0x56f917[_0x930b('0x1a')],_0x508e0a);_0x41870(_0x2667e9['error'](0x1f4,_0x56f917[_0x930b('0x1a')]));});});};exports[_0x930b('0x29')]=function(_0x2e24d4){var _0x2c84f2=this;return new Promise(function(_0x4344e7,_0x54c32f){return db[_0x930b('0x1d')][_0x930b('0x2a')]({'raw':_0x2e24d4[_0x930b('0x1f')]?_0x2e24d4[_0x930b('0x1f')][_0x930b('0x20')]===undefined?!![]:![]:!![],'where':_0x2e24d4[_0x930b('0x1f')]?_0x2e24d4['options']['where']||null:null,'attributes':_0x2e24d4[_0x930b('0x1f')]?_0x2e24d4[_0x930b('0x1f')][_0x930b('0x26')]||null:null,'include':_0x2e24d4['options']?_0x2e24d4[_0x930b('0x1f')][_0x930b('0x23')]?_[_0x930b('0x24')](_0x2e24d4[_0x930b('0x1f')][_0x930b('0x23')],function(_0x5006bb){return{'model':db[_0x5006bb[_0x930b('0x25')]],'as':_0x5006bb['as'],'attributes':_0x5006bb[_0x930b('0x26')],'include':_0x5006bb[_0x930b('0x23')]?_['map'](_0x5006bb[_0x930b('0x23')],function(_0x1b6001){return{'model':db[_0x1b6001[_0x930b('0x25')]],'as':_0x1b6001['as'],'attributes':_0x1b6001[_0x930b('0x26')],'include':_0x1b6001['include']?_['map'](_0x1b6001['include'],function(_0x571160){return{'model':db[_0x571160[_0x930b('0x25')]],'as':_0x571160['as'],'attributes':_0x571160['attributes']};}):[]};}):[]};}):[]:[]})[_0x930b('0x27')](function(_0x52dddb){logger['info']('ShowSmsQueue',_0x2e24d4);logger[_0x930b('0x14')](_0x930b('0x29'),_0x2e24d4,JSON['stringify'](_0x52dddb));_0x4344e7(_0x52dddb);})[_0x930b('0x28')](function(_0x333a3e){logger[_0x930b('0x18')](_0x930b('0x29'),_0x333a3e[_0x930b('0x1a')],_0x2e24d4);_0x54c32f(_0x2c84f2[_0x930b('0x18')](0x1f4,_0x333a3e['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 4ac1e96..556ddc3 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 _0xd717=['smsQueue:','./smsQueue.events','remove','update','removeListener','length'];(function(_0x18a814,_0x523e26){var _0x345660=function(_0x20ce8c){while(--_0x20ce8c){_0x18a814['push'](_0x18a814['shift']());}};_0x345660(++_0x523e26);}(_0xd717,0x10f));var _0x7d71=function(_0x2b746b,_0x421fa0){_0x2b746b=_0x2b746b-0x0;var _0x1bd43d=_0xd717[_0x2b746b];return _0x1bd43d;};'use strict';var SmsQueueEvents=require(_0x7d71('0x0'));var events=['save',_0x7d71('0x1'),_0x7d71('0x2')];function createListener(_0x5c5cac,_0x5bd231){return function(_0x4a755c){_0x5bd231['emit'](_0x5c5cac,_0x4a755c);};}function removeListener(_0x47d07a,_0x2008a5){return function(){SmsQueueEvents[_0x7d71('0x3')](_0x47d07a,_0x2008a5);};}exports['register']=function(_0x46666f){for(var _0x5a9ce7=0x0,_0x3aaf8e=events[_0x7d71('0x4')];_0x5a9ce7<_0x3aaf8e;_0x5a9ce7++){var _0x8f5905=events[_0x5a9ce7];var _0x37e91b=createListener(_0x7d71('0x5')+_0x8f5905,_0x46666f);SmsQueueEvents['on'](_0x8f5905,_0x37e91b);}}; \ No newline at end of file +var _0xea12=['emit','register','smsQueue:','./smsQueue.events','save','remove','update'];(function(_0x4dc392,_0x255362){var _0x4e45ad=function(_0x1d932d){while(--_0x1d932d){_0x4dc392['push'](_0x4dc392['shift']());}};_0x4e45ad(++_0x255362);}(_0xea12,0x192));var _0x2ea1=function(_0x501c4c,_0x30ce7f){_0x501c4c=_0x501c4c-0x0;var _0x318509=_0xea12[_0x501c4c];return _0x318509;};'use strict';var SmsQueueEvents=require(_0x2ea1('0x0'));var events=[_0x2ea1('0x1'),_0x2ea1('0x2'),_0x2ea1('0x3')];function createListener(_0x15bfbb,_0x5a4d42){return function(_0x1b2088){_0x5a4d42[_0x2ea1('0x4')](_0x15bfbb,_0x1b2088);};}function removeListener(_0x15c6e1,_0x1c74ea){return function(){SmsQueueEvents['removeListener'](_0x15c6e1,_0x1c74ea);};}exports[_0x2ea1('0x5')]=function(_0xcf48dd){for(var _0x43bd47=0x0,_0x17e581=events['length'];_0x43bd47<_0x17e581;_0x43bd47++){var _0x14b921=events[_0x43bd47];var _0x2b33b0=createListener(_0x2ea1('0x6')+_0x14b921,_0xcf48dd);SmsQueueEvents['on'](_0x14b921,_0x2b33b0);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 40cf8a6..0d01541 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 _0xbe10=['../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x4a5f99,_0x2aaa0e){var _0x6394da=function(_0x509c8a){while(--_0x509c8a){_0x4a5f99['push'](_0x4a5f99['shift']());}};_0x6394da(++_0x2aaa0e);}(_0xbe10,0x174));var _0x0be1=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xbe10[_0x4ff09b];return _0x3f5c2e;};'use strict';var multer=require(_0x0be1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0be1('0x1'));var express=require(_0x0be1('0x2'));var router=express[_0x0be1('0x3')]();var fs_extra=require(_0x0be1('0x4'));var auth=require(_0x0be1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0be1('0x6'));var controller=require(_0x0be1('0x7'));router[_0x0be1('0x8')]('/',auth[_0x0be1('0x9')](),controller[_0x0be1('0xa')]);router[_0x0be1('0x8')](_0x0be1('0xb'),auth[_0x0be1('0x9')](),controller[_0x0be1('0xc')]);router['get'](_0x0be1('0xd'),auth[_0x0be1('0x9')](),controller['show']);router[_0x0be1('0xe')]('/',auth[_0x0be1('0x9')](),controller[_0x0be1('0xf')]);router[_0x0be1('0x10')](_0x0be1('0xd'),auth[_0x0be1('0x9')](),controller[_0x0be1('0x11')]);router[_0x0be1('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x0be1('0x13')]);module[_0x0be1('0x14')]=router; \ No newline at end of file +var _0xb073=['isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x2e4cdb,_0x5983be){var _0x48002c=function(_0x272b14){while(--_0x272b14){_0x2e4cdb['push'](_0x2e4cdb['shift']());}};_0x48002c(++_0x5983be);}(_0xb073,0x187));var _0x3b07=function(_0x35156b,_0x4f47e1){_0x35156b=_0x35156b-0x0;var _0x5e9bee=_0xb073[_0x35156b];return _0x5e9bee;};'use strict';var multer=require('multer');var util=require(_0x3b07('0x0'));var path=require('path');var timeout=require(_0x3b07('0x1'));var express=require(_0x3b07('0x2'));var router=express[_0x3b07('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3b07('0x4'));var interaction=require(_0x3b07('0x5'));var config=require(_0x3b07('0x6'));var controller=require('./smsQueueReport.controller');router[_0x3b07('0x7')]('/',auth[_0x3b07('0x8')](),controller[_0x3b07('0x9')]);router[_0x3b07('0x7')](_0x3b07('0xa'),auth[_0x3b07('0x8')](),controller[_0x3b07('0xb')]);router[_0x3b07('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x3b07('0xc')]);router[_0x3b07('0xd')]('/',auth[_0x3b07('0x8')](),controller[_0x3b07('0xe')]);router[_0x3b07('0xf')](_0x3b07('0x10'),auth[_0x3b07('0x8')](),controller[_0x3b07('0x11')]);router[_0x3b07('0x12')](_0x3b07('0x10'),auth[_0x3b07('0x8')](),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 4dc5cce..35d429f 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 _0x0f10=['exports','STRING','DATE','moment','sequelize'];(function(_0x431711,_0x3c6ce8){var _0x331955=function(_0x5d7092){while(--_0x5d7092){_0x431711['push'](_0x431711['shift']());}};_0x331955(++_0x3c6ce8);}(_0x0f10,0x7b));var _0x00f1=function(_0x2cce0c,_0x334752){_0x2cce0c=_0x2cce0c-0x0;var _0x34b4e2=_0x0f10[_0x2cce0c];return _0x34b4e2;};'use strict';var moment=require(_0x00f1('0x0'));var Sequelize=require(_0x00f1('0x1'));module[_0x00f1('0x2')]={'uniqueid':{'type':Sequelize[_0x00f1('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x00f1('0x3')]},'joinAt':{'type':Sequelize[_0x00f1('0x4')]},'leaveAt':{'type':Sequelize[_0x00f1('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x00f1('0x4')]},'reason':{'type':Sequelize[_0x00f1('0x3')]}}; \ No newline at end of file +var _0xd3fd=['DATE','moment','sequelize','exports','STRING'];(function(_0x244b11,_0x5454db){var _0x2e5192=function(_0x4a78d5){while(--_0x4a78d5){_0x244b11['push'](_0x244b11['shift']());}};_0x2e5192(++_0x5454db);}(_0xd3fd,0x10a));var _0xdd3f=function(_0x293a70,_0x59d647){_0x293a70=_0x293a70-0x0;var _0x13c872=_0xd3fd[_0x293a70];return _0x13c872;};'use strict';var moment=require(_0xdd3f('0x0'));var Sequelize=require(_0xdd3f('0x1'));module[_0xdd3f('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xdd3f('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xdd3f('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xdd3f('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 95808c8..00757f4 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 _0xe8de=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','attributes','intersection','fields','hasOwnProperty','sort','where','pick','filters','filter','merge','options','SmsQueueReport','include','findAll','rows','catch','params','length','includeAll','find','create','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x10c4f9,_0x100fb4){var _0x522b09=function(_0x3325e4){while(--_0x3325e4){_0x10c4f9['push'](_0x10c4f9['shift']());}};_0x522b09(++_0x100fb4);}(_0xe8de,0x1f2));var _0xee8d=function(_0xa8e125,_0x447e2a){_0xa8e125=_0xa8e125-0x0;var _0x279b67=_0xe8de[_0xa8e125];return _0x279b67;};'use strict';var emlformat=require(_0xee8d('0x0'));var rimraf=require(_0xee8d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xee8d('0x2'));var rp=require('request-promise');var moment=require(_0xee8d('0x3'));var BPromise=require(_0xee8d('0x4'));var Mustache=require(_0xee8d('0x5'));var util=require(_0xee8d('0x6'));var path=require(_0xee8d('0x7'));var sox=require(_0xee8d('0x8'));var csv=require('to-csv');var ejs=require(_0xee8d('0x9'));var fs=require('fs');var fs_extra=require(_0xee8d('0xa'));var _=require(_0xee8d('0xb'));var squel=require(_0xee8d('0xc'));var crypto=require(_0xee8d('0xd'));var jsforce=require(_0xee8d('0xe'));var deskjs=require(_0xee8d('0xf'));var toCsv=require(_0xee8d('0x10'));var querystring=require('querystring');var Papa=require(_0xee8d('0x11'));var Redis=require('ioredis');var authService=require(_0xee8d('0x12'));var qs=require(_0xee8d('0x13'));var as=require(_0xee8d('0x14'));var hardwareService=require(_0xee8d('0x15'));var logger=require('../../config/logger')(_0xee8d('0x16'));var utils=require(_0xee8d('0x17'));var config=require(_0xee8d('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31ce6a,_0x3c67da){_0x3c67da=_0x3c67da||0xcc;return function(_0x3fb19c){if(_0x3fb19c){return _0x31ce6a[_0xee8d('0x19')](_0x3c67da);}return _0x31ce6a[_0xee8d('0x1a')](_0x3c67da)['end']();};}function respondWithResult(_0x5c4e78,_0x235cea){_0x235cea=_0x235cea||0xc8;return function(_0xc0ec85){if(_0xc0ec85){return _0x5c4e78[_0xee8d('0x1a')](_0x235cea)[_0xee8d('0x1b')](_0xc0ec85);}};}function respondWithFilteredResult(_0x39cb8a,_0x296dd8){return function(_0x164058){if(_0x164058){var _0xf3b6d8=typeof _0x296dd8[_0xee8d('0x1c')]===_0xee8d('0x1d')&&typeof _0x296dd8['limit']==='undefined';var _0x202e90=_0x164058[_0xee8d('0x1e')];var _0x36a234=_0xf3b6d8?0x0:_0x296dd8[_0xee8d('0x1c')];var _0x437ef4=_0xf3b6d8?_0x164058['count']:_0x296dd8[_0xee8d('0x1c')]+_0x296dd8[_0xee8d('0x1f')];var _0x2ffc04;if(_0x437ef4>=_0x202e90){_0x437ef4=_0x202e90;_0x2ffc04=0xc8;}else{_0x2ffc04=0xce;}_0x39cb8a[_0xee8d('0x1a')](_0x2ffc04);return _0x39cb8a['set'](_0xee8d('0x20'),_0x36a234+'-'+_0x437ef4+'/'+_0x202e90)[_0xee8d('0x1b')](_0x164058);}return null;};}function patchUpdates(_0x352fa3){return function(_0x3907b4){try{jsonpatch[_0xee8d('0x21')](_0x3907b4,_0x352fa3,!![]);}catch(_0x46af94){return BPromise[_0xee8d('0x22')](_0x46af94);}return _0x3907b4[_0xee8d('0x23')]();};}function saveUpdates(_0x17c367,_0x28793b){return function(_0x5aed76){if(_0x5aed76){return _0x5aed76[_0xee8d('0x24')](_0x17c367)[_0xee8d('0x25')](function(_0x2da948){return _0x2da948;});}return null;};}function removeEntity(_0x17c15b,_0x59bfa6){return function(_0x310c93){if(_0x310c93){return _0x310c93[_0xee8d('0x26')]()[_0xee8d('0x25')](function(){_0x17c15b[_0xee8d('0x1a')](0xcc)[_0xee8d('0x27')]();});}};}function handleEntityNotFound(_0x20d04c,_0x73cafc){return function(_0x18d951){if(!_0x18d951){_0x20d04c[_0xee8d('0x19')](0x194);}return _0x18d951;};}function handleError(_0x512afd,_0x35fa67){_0x35fa67=_0x35fa67||0x1f4;return function(_0x1fb826){logger[_0xee8d('0x28')](_0x1fb826['stack']);if(_0x1fb826[_0xee8d('0x29')]){delete _0x1fb826['name'];}_0x512afd[_0xee8d('0x1a')](_0x35fa67)[_0xee8d('0x2a')](_0x1fb826);};}exports[_0xee8d('0x2b')]=function(_0x448bea,_0x3977e2){var _0x39de55={},_0x1183c3={},_0x28cc99={'count':0x0,'rows':[]};var _0x1ff79a=_[_0xee8d('0x2c')](db['SmsQueueReport'][_0xee8d('0x2d')],function(_0xf9dfef){return{'name':_0xf9dfef[_0xee8d('0x2e')],'type':_0xf9dfef[_0xee8d('0x2f')]['key']};});_0x1183c3[_0xee8d('0x30')]=_[_0xee8d('0x2c')](_0x1ff79a,'name');_0x1183c3['query']=_[_0xee8d('0x31')](_0x448bea[_0xee8d('0x32')]);_0x1183c3['filters']=_['intersection'](_0x1183c3[_0xee8d('0x30')],_0x1183c3[_0xee8d('0x32')]);_0x39de55[_0xee8d('0x33')]=_[_0xee8d('0x34')](_0x1183c3[_0xee8d('0x30')],qs[_0xee8d('0x35')](_0x448bea['query'][_0xee8d('0x35')]));_0x39de55[_0xee8d('0x33')]=_0x39de55[_0xee8d('0x33')]['length']?_0x39de55[_0xee8d('0x33')]:_0x1183c3[_0xee8d('0x30')];if(!_0x448bea[_0xee8d('0x32')][_0xee8d('0x36')]('nolimit')){_0x39de55[_0xee8d('0x1f')]=qs['limit'](_0x448bea[_0xee8d('0x32')][_0xee8d('0x1f')]);_0x39de55[_0xee8d('0x1c')]=qs['offset'](_0x448bea['query'][_0xee8d('0x1c')]);}_0x39de55['order']=qs[_0xee8d('0x37')](_0x448bea[_0xee8d('0x32')][_0xee8d('0x37')]);_0x39de55[_0xee8d('0x38')]=qs['filters'](_[_0xee8d('0x39')](_0x448bea[_0xee8d('0x32')],_0x1183c3[_0xee8d('0x3a')]),_0x1ff79a);if(_0x448bea['query'][_0xee8d('0x3b')]){_0x39de55[_0xee8d('0x38')]=_[_0xee8d('0x3c')](_0x39de55['where'],{'$or':_[_0xee8d('0x2c')](_0x1ff79a,function(_0x11eb31){if(_0x11eb31[_0xee8d('0x2f')]!=='VIRTUAL'){var _0x2ed678={};_0x2ed678[_0x11eb31[_0xee8d('0x29')]]={'$like':'%'+_0x448bea[_0xee8d('0x32')][_0xee8d('0x3b')]+'%'};return _0x2ed678;}})});}_0x39de55=_[_0xee8d('0x3c')]({},_0x39de55,_0x448bea[_0xee8d('0x3d')]);var _0x6e78ea={'where':_0x39de55[_0xee8d('0x38')]};return db[_0xee8d('0x3e')]['count'](_0x6e78ea)['then'](function(_0x58d320){_0x28cc99['count']=_0x58d320;if(_0x448bea[_0xee8d('0x32')]['includeAll']){_0x39de55[_0xee8d('0x3f')]=[{'all':!![]}];}return db[_0xee8d('0x3e')][_0xee8d('0x40')](_0x39de55);})[_0xee8d('0x25')](function(_0x4f431d){_0x28cc99[_0xee8d('0x41')]=_0x4f431d;return _0x28cc99;})[_0xee8d('0x25')](respondWithFilteredResult(_0x3977e2,_0x39de55))[_0xee8d('0x42')](handleError(_0x3977e2,null));};exports['show']=function(_0x5c0731,_0x14f50c){var _0xc9081={'raw':!![],'where':{'id':_0x5c0731[_0xee8d('0x43')]['id']}},_0x4a4e1a={};_0x4a4e1a['model']=_[_0xee8d('0x31')](db['SmsQueueReport'][_0xee8d('0x2d')]);_0x4a4e1a['query']=_[_0xee8d('0x31')](_0x5c0731[_0xee8d('0x32')]);_0x4a4e1a['filters']=_[_0xee8d('0x34')](_0x4a4e1a[_0xee8d('0x30')],_0x4a4e1a['query']);_0xc9081[_0xee8d('0x33')]=_[_0xee8d('0x34')](_0x4a4e1a[_0xee8d('0x30')],qs[_0xee8d('0x35')](_0x5c0731[_0xee8d('0x32')]['fields']));_0xc9081[_0xee8d('0x33')]=_0xc9081['attributes'][_0xee8d('0x44')]?_0xc9081[_0xee8d('0x33')]:_0x4a4e1a['model'];if(_0x5c0731[_0xee8d('0x32')][_0xee8d('0x45')]){_0xc9081[_0xee8d('0x3f')]=[{'all':!![]}];}_0xc9081=_[_0xee8d('0x3c')]({},_0xc9081,_0x5c0731['options']);return db[_0xee8d('0x3e')][_0xee8d('0x46')](_0xc9081)[_0xee8d('0x25')](handleEntityNotFound(_0x14f50c,null))[_0xee8d('0x25')](respondWithResult(_0x14f50c,null))[_0xee8d('0x42')](handleError(_0x14f50c,null));};exports[_0xee8d('0x47')]=function(_0x6b4927,_0x4e3039){return db[_0xee8d('0x3e')][_0xee8d('0x47')](_0x6b4927[_0xee8d('0x48')],{})['then'](respondWithResult(_0x4e3039,0xc9))[_0xee8d('0x42')](handleError(_0x4e3039,null));};exports[_0xee8d('0x24')]=function(_0x54a730,_0x940b76){if(_0x54a730[_0xee8d('0x48')]['id']){delete _0x54a730[_0xee8d('0x48')]['id'];}return db[_0xee8d('0x3e')]['find']({'where':{'id':_0x54a730['params']['id']}})[_0xee8d('0x25')](handleEntityNotFound(_0x940b76,null))['then'](saveUpdates(_0x54a730[_0xee8d('0x48')],null))['then'](respondWithResult(_0x940b76,null))[_0xee8d('0x42')](handleError(_0x940b76,null));};exports[_0xee8d('0x26')]=function(_0x5ceb86,_0x1f014d){return db[_0xee8d('0x3e')][_0xee8d('0x46')]({'where':{'id':_0x5ceb86[_0xee8d('0x43')]['id']}})[_0xee8d('0x25')](handleEntityNotFound(_0x1f014d,null))['then'](removeEntity(_0x1f014d,null))[_0xee8d('0x42')](handleError(_0x1f014d,null));};exports[_0xee8d('0x49')]=function(_0x1af27d,_0x5d8d73){return db[_0xee8d('0x3e')][_0xee8d('0x49')]()[_0xee8d('0x25')](respondWithResult(_0x5d8d73,null))[_0xee8d('0x42')](handleError(_0x5d8d73,null));}; \ No newline at end of file +var _0x4f1a=['error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','attributes','intersection','model','length','hasOwnProperty','sort','where','filters','filter','merge','VIRTUAL','SmsQueueReport','includeAll','include','findAll','rows','show','params','fields','catch','create','body','find','describe','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','then','destroy'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0x4f1a,0xb8));var _0xa4f1=function(_0x27d0d8,_0x2b657d){_0x27d0d8=_0x27d0d8-0x0;var _0x2b79d1=_0x4f1a[_0x27d0d8];return _0x2b79d1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa4f1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa4f1('0x1'));var rp=require(_0xa4f1('0x2'));var moment=require('moment');var BPromise=require(_0xa4f1('0x3'));var Mustache=require('mustache');var util=require(_0xa4f1('0x4'));var path=require(_0xa4f1('0x5'));var sox=require(_0xa4f1('0x6'));var csv=require(_0xa4f1('0x7'));var ejs=require(_0xa4f1('0x8'));var fs=require('fs');var fs_extra=require(_0xa4f1('0x9'));var _=require(_0xa4f1('0xa'));var squel=require(_0xa4f1('0xb'));var crypto=require(_0xa4f1('0xc'));var jsforce=require(_0xa4f1('0xd'));var deskjs=require(_0xa4f1('0xe'));var toCsv=require(_0xa4f1('0x7'));var querystring=require('querystring');var Papa=require(_0xa4f1('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa4f1('0x10'));var as=require(_0xa4f1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa4f1('0x12'))(_0xa4f1('0x13'));var utils=require('../../config/utils');var config=require(_0xa4f1('0x14'));var licenseUtil=require(_0xa4f1('0x15'));var db=require(_0xa4f1('0x16'))['db'];function respondWithStatusCode(_0x3da255,_0x24b31c){_0x24b31c=_0x24b31c||0xcc;return function(_0x4ddda6){if(_0x4ddda6){return _0x3da255[_0xa4f1('0x17')](_0x24b31c);}return _0x3da255['status'](_0x24b31c)[_0xa4f1('0x18')]();};}function respondWithResult(_0x19b297,_0x5d6464){_0x5d6464=_0x5d6464||0xc8;return function(_0x4b8a24){if(_0x4b8a24){return _0x19b297['status'](_0x5d6464)[_0xa4f1('0x19')](_0x4b8a24);}};}function respondWithFilteredResult(_0x17c7fe,_0x5d7619){return function(_0x3ff4d8){if(_0x3ff4d8){var _0x1fb21a=typeof _0x5d7619[_0xa4f1('0x1a')]===_0xa4f1('0x1b')&&typeof _0x5d7619[_0xa4f1('0x1c')]===_0xa4f1('0x1b');var _0x178975=_0x3ff4d8[_0xa4f1('0x1d')];var _0x35c0ba=_0x1fb21a?0x0:_0x5d7619[_0xa4f1('0x1a')];var _0x530f98=_0x1fb21a?_0x3ff4d8[_0xa4f1('0x1d')]:_0x5d7619[_0xa4f1('0x1a')]+_0x5d7619['limit'];var _0x39b2f7;if(_0x530f98>=_0x178975){_0x530f98=_0x178975;_0x39b2f7=0xc8;}else{_0x39b2f7=0xce;}_0x17c7fe[_0xa4f1('0x1e')](_0x39b2f7);return _0x17c7fe[_0xa4f1('0x1f')](_0xa4f1('0x20'),_0x35c0ba+'-'+_0x530f98+'/'+_0x178975)[_0xa4f1('0x19')](_0x3ff4d8);}return null;};}function patchUpdates(_0x3807ce){return function(_0x4b2a8c){try{jsonpatch[_0xa4f1('0x21')](_0x4b2a8c,_0x3807ce,!![]);}catch(_0x17003c){return BPromise[_0xa4f1('0x22')](_0x17003c);}return _0x4b2a8c['save']();};}function saveUpdates(_0x36b6b6,_0x2cb7b5){return function(_0x16e86d){if(_0x16e86d){return _0x16e86d[_0xa4f1('0x23')](_0x36b6b6)[_0xa4f1('0x24')](function(_0xfc4854){return _0xfc4854;});}return null;};}function removeEntity(_0x458ad7,_0x37d32a){return function(_0x48cda5){if(_0x48cda5){return _0x48cda5[_0xa4f1('0x25')]()[_0xa4f1('0x24')](function(){_0x458ad7[_0xa4f1('0x1e')](0xcc)[_0xa4f1('0x18')]();});}};}function handleEntityNotFound(_0x30a4bf,_0x5a2851){return function(_0x35f19c){if(!_0x35f19c){_0x30a4bf[_0xa4f1('0x17')](0x194);}return _0x35f19c;};}function handleError(_0x3d1e24,_0x32a3b8){_0x32a3b8=_0x32a3b8||0x1f4;return function(_0x4e1150){logger[_0xa4f1('0x26')](_0x4e1150[_0xa4f1('0x27')]);if(_0x4e1150[_0xa4f1('0x28')]){delete _0x4e1150[_0xa4f1('0x28')];}_0x3d1e24[_0xa4f1('0x1e')](_0x32a3b8)[_0xa4f1('0x29')](_0x4e1150);};}exports[_0xa4f1('0x2a')]=function(_0x1c0db3,_0x258be5){var _0x4facc1={},_0x4aee51={},_0x5f16f7={'count':0x0,'rows':[]};var _0x2e409c=_[_0xa4f1('0x2b')](db['SmsQueueReport'][_0xa4f1('0x2c')],function(_0x3aec38){return{'name':_0x3aec38[_0xa4f1('0x2d')],'type':_0x3aec38[_0xa4f1('0x2e')][_0xa4f1('0x2f')]};});_0x4aee51['model']=_[_0xa4f1('0x2b')](_0x2e409c,'name');_0x4aee51[_0xa4f1('0x30')]=_[_0xa4f1('0x31')](_0x1c0db3['query']);_0x4aee51['filters']=_['intersection'](_0x4aee51['model'],_0x4aee51[_0xa4f1('0x30')]);_0x4facc1[_0xa4f1('0x32')]=_[_0xa4f1('0x33')](_0x4aee51[_0xa4f1('0x34')],qs['fields'](_0x1c0db3[_0xa4f1('0x30')]['fields']));_0x4facc1[_0xa4f1('0x32')]=_0x4facc1[_0xa4f1('0x32')][_0xa4f1('0x35')]?_0x4facc1['attributes']:_0x4aee51[_0xa4f1('0x34')];if(!_0x1c0db3[_0xa4f1('0x30')][_0xa4f1('0x36')]('nolimit')){_0x4facc1[_0xa4f1('0x1c')]=qs[_0xa4f1('0x1c')](_0x1c0db3[_0xa4f1('0x30')][_0xa4f1('0x1c')]);_0x4facc1[_0xa4f1('0x1a')]=qs[_0xa4f1('0x1a')](_0x1c0db3[_0xa4f1('0x30')][_0xa4f1('0x1a')]);}_0x4facc1['order']=qs[_0xa4f1('0x37')](_0x1c0db3[_0xa4f1('0x30')][_0xa4f1('0x37')]);_0x4facc1[_0xa4f1('0x38')]=qs[_0xa4f1('0x39')](_['pick'](_0x1c0db3[_0xa4f1('0x30')],_0x4aee51[_0xa4f1('0x39')]),_0x2e409c);if(_0x1c0db3['query'][_0xa4f1('0x3a')]){_0x4facc1[_0xa4f1('0x38')]=_[_0xa4f1('0x3b')](_0x4facc1['where'],{'$or':_['map'](_0x2e409c,function(_0x5c391c){if(_0x5c391c['type']!==_0xa4f1('0x3c')){var _0x58b724={};_0x58b724[_0x5c391c[_0xa4f1('0x28')]]={'$like':'%'+_0x1c0db3[_0xa4f1('0x30')][_0xa4f1('0x3a')]+'%'};return _0x58b724;}})});}_0x4facc1=_[_0xa4f1('0x3b')]({},_0x4facc1,_0x1c0db3['options']);var _0x2dddf3={'where':_0x4facc1[_0xa4f1('0x38')]};return db[_0xa4f1('0x3d')][_0xa4f1('0x1d')](_0x2dddf3)['then'](function(_0x264565){_0x5f16f7[_0xa4f1('0x1d')]=_0x264565;if(_0x1c0db3[_0xa4f1('0x30')][_0xa4f1('0x3e')]){_0x4facc1[_0xa4f1('0x3f')]=[{'all':!![]}];}return db[_0xa4f1('0x3d')][_0xa4f1('0x40')](_0x4facc1);})[_0xa4f1('0x24')](function(_0x21421f){_0x5f16f7[_0xa4f1('0x41')]=_0x21421f;return _0x5f16f7;})[_0xa4f1('0x24')](respondWithFilteredResult(_0x258be5,_0x4facc1))['catch'](handleError(_0x258be5,null));};exports[_0xa4f1('0x42')]=function(_0x3c5f68,_0x5840b8){var _0xd4a4c7={'raw':!![],'where':{'id':_0x3c5f68[_0xa4f1('0x43')]['id']}},_0x45317f={};_0x45317f[_0xa4f1('0x34')]=_[_0xa4f1('0x31')](db[_0xa4f1('0x3d')][_0xa4f1('0x2c')]);_0x45317f[_0xa4f1('0x30')]=_[_0xa4f1('0x31')](_0x3c5f68[_0xa4f1('0x30')]);_0x45317f['filters']=_[_0xa4f1('0x33')](_0x45317f[_0xa4f1('0x34')],_0x45317f[_0xa4f1('0x30')]);_0xd4a4c7[_0xa4f1('0x32')]=_[_0xa4f1('0x33')](_0x45317f['model'],qs['fields'](_0x3c5f68['query'][_0xa4f1('0x44')]));_0xd4a4c7['attributes']=_0xd4a4c7['attributes'][_0xa4f1('0x35')]?_0xd4a4c7[_0xa4f1('0x32')]:_0x45317f['model'];if(_0x3c5f68[_0xa4f1('0x30')][_0xa4f1('0x3e')]){_0xd4a4c7['include']=[{'all':!![]}];}_0xd4a4c7=_[_0xa4f1('0x3b')]({},_0xd4a4c7,_0x3c5f68['options']);return db[_0xa4f1('0x3d')]['find'](_0xd4a4c7)[_0xa4f1('0x24')](handleEntityNotFound(_0x5840b8,null))['then'](respondWithResult(_0x5840b8,null))[_0xa4f1('0x45')](handleError(_0x5840b8,null));};exports['create']=function(_0x5df525,_0x4e68ba){return db['SmsQueueReport'][_0xa4f1('0x46')](_0x5df525[_0xa4f1('0x47')],{})[_0xa4f1('0x24')](respondWithResult(_0x4e68ba,0xc9))[_0xa4f1('0x45')](handleError(_0x4e68ba,null));};exports[_0xa4f1('0x23')]=function(_0x4b5f80,_0x23e213){if(_0x4b5f80[_0xa4f1('0x47')]['id']){delete _0x4b5f80['body']['id'];}return db[_0xa4f1('0x3d')][_0xa4f1('0x48')]({'where':{'id':_0x4b5f80[_0xa4f1('0x43')]['id']}})[_0xa4f1('0x24')](handleEntityNotFound(_0x23e213,null))[_0xa4f1('0x24')](saveUpdates(_0x4b5f80['body'],null))[_0xa4f1('0x24')](respondWithResult(_0x23e213,null))[_0xa4f1('0x45')](handleError(_0x23e213,null));};exports[_0xa4f1('0x25')]=function(_0x10159d,_0x38725f){return db[_0xa4f1('0x3d')][_0xa4f1('0x48')]({'where':{'id':_0x10159d['params']['id']}})[_0xa4f1('0x24')](handleEntityNotFound(_0x38725f,null))[_0xa4f1('0x24')](removeEntity(_0x38725f,null))['catch'](handleError(_0x38725f,null));};exports['describe']=function(_0x1661f3,_0x1c1615){return db['SmsQueueReport'][_0xa4f1('0x49')]()[_0xa4f1('0x24')](respondWithResult(_0x1c1615,null))[_0xa4f1('0x45')](handleError(_0x1c1615,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index bb1657c..9537ec7 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(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_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 _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2ef1f5,_0x32fffd){var _0x4e5c57=function(_0x2e52b1){while(--_0x2e52b1){_0x2ef1f5['push'](_0x2ef1f5['shift']());}};_0x4e5c57(++_0x32fffd);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 3ce8eef..f532b33 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 _0x836a=['raw','UpdateSmsQueueReport','SmsQueueReport','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsQueueReport','body','options'];(function(_0x4f86ce,_0x41ff07){var _0x3159a8=function(_0x358426){while(--_0x358426){_0x4f86ce['push'](_0x4f86ce['shift']());}};_0x3159a8(++_0x41ff07);}(_0x836a,0xcc));var _0xa836=function(_0x3c3a03,_0x3c0da1){_0x3c3a03=_0x3c3a03-0x0;var _0x57ff53=_0x836a[_0x3c3a03];return _0x57ff53;};'use strict';var _=require('lodash');var util=require(_0xa836('0x0'));var moment=require(_0xa836('0x1'));var BPromise=require(_0xa836('0x2'));var rs=require(_0xa836('0x3'));var fs=require('fs');var Redis=require(_0xa836('0x4'));var db=require(_0xa836('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa836('0x6'))(_0xa836('0x7'));var config=require('../../config/environment');var jayson=require(_0xa836('0x8'));var client=jayson[_0xa836('0x9')][_0xa836('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f618f,_0x7e031d,_0x55a66b){return new BPromise(function(_0x3945e6,_0x7de976){return client[_0xa836('0xb')](_0x2f618f,_0x55a66b)[_0xa836('0xc')](function(_0x2c228b){logger[_0xa836('0xd')](_0xa836('0xe'),_0x7e031d,_0xa836('0xf'));logger[_0xa836('0x10')](_0xa836('0x11'),_0x7e031d,'request\x20sent',JSON[_0xa836('0x12')](_0x2c228b));if(_0x2c228b[_0xa836('0x13')]){if(_0x2c228b['error'][_0xa836('0x14')]===0x1f4){logger[_0xa836('0x13')](_0xa836('0xe'),_0x7e031d,_0x2c228b[_0xa836('0x13')][_0xa836('0x15')]);return _0x7de976(_0x2c228b['error'][_0xa836('0x15')]);}logger['error'](_0xa836('0xe'),_0x7e031d,_0x2c228b['error'][_0xa836('0x15')]);return _0x3945e6(_0x2c228b[_0xa836('0x13')]['message']);}else{logger[_0xa836('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0x7e031d,'request\x20sent');_0x3945e6(_0x2c228b[_0xa836('0x16')][_0xa836('0x15')]);}})[_0xa836('0x17')](function(_0x903c64){logger[_0xa836('0x13')]('SmsQueueReport,\x20%s,\x20%s',_0x7e031d,_0x903c64);_0x7de976(_0x903c64);});});}exports[_0xa836('0x18')]=function(_0x542305){var _0x4fd0c3=this;return new Promise(function(_0x1b6c10,_0x4099a1){return db['SmsQueueReport']['create'](_0x542305[_0xa836('0x19')],{'raw':_0x542305[_0xa836('0x1a')]?_0x542305[_0xa836('0x1a')][_0xa836('0x1b')]===undefined?!![]:![]:!![]})[_0xa836('0xc')](function(_0x374e81){logger[_0xa836('0xd')]('CreateSmsQueueReport',_0x542305);logger[_0xa836('0x10')](_0xa836('0x18'),_0x542305,JSON[_0xa836('0x12')](_0x374e81));_0x1b6c10(_0x374e81);})[_0xa836('0x17')](function(_0x7b4607){logger[_0xa836('0x13')]('CreateSmsQueueReport',_0x7b4607[_0xa836('0x15')],_0x542305);_0x4099a1(_0x4fd0c3['error'](0x1f4,_0x7b4607[_0xa836('0x15')]));});});};exports[_0xa836('0x1c')]=function(_0x24e641){var _0x59fec1=this;return new Promise(function(_0x5dc752,_0x3b6f7e){return db[_0xa836('0x1d')]['update'](_0x24e641['body'],{'raw':_0x24e641[_0xa836('0x1a')]?_0x24e641[_0xa836('0x1a')][_0xa836('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24e641[_0xa836('0x1a')]?_0x24e641['options'][_0xa836('0x1e')]||null:null,'attributes':_0x24e641[_0xa836('0x1a')]?_0x24e641[_0xa836('0x1a')][_0xa836('0x1f')]||null:null,'limit':_0x24e641['options']?_0x24e641[_0xa836('0x1a')][_0xa836('0x20')]||null:null})['then'](function(_0x594a5f){logger[_0xa836('0xd')](_0xa836('0x1c'),_0x24e641);logger[_0xa836('0x10')]('UpdateSmsQueueReport',_0x24e641,JSON[_0xa836('0x12')](_0x594a5f));_0x5dc752(_0x594a5f);})[_0xa836('0x17')](function(_0xacbbdf){logger[_0xa836('0x13')]('UpdateSmsQueueReport',_0xacbbdf[_0xa836('0x15')],_0x24e641);_0x3b6f7e(_0x59fec1[_0xa836('0x13')](0x1f4,_0xacbbdf['message']));});});}; \ No newline at end of file +var _0xce8e=['request','then','info','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','stringify','UpdateSmsQueueReport','update','options','raw','where','attributes','limit','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http'];(function(_0xab56c3,_0x16490c){var _0x3de734=function(_0x38c0bb){while(--_0x38c0bb){_0xab56c3['push'](_0xab56c3['shift']());}};_0x3de734(++_0x16490c);}(_0xce8e,0x14a));var _0xece8=function(_0x45b259,_0x43d36e){_0x45b259=_0x45b259-0x0;var _0x254bc7=_0xce8e[_0x45b259];return _0x254bc7;};'use strict';var _=require('lodash');var util=require(_0xece8('0x0'));var moment=require(_0xece8('0x1'));var BPromise=require(_0xece8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xece8('0x3'));var db=require(_0xece8('0x4'))['db'];var utils=require(_0xece8('0x5'));var logger=require(_0xece8('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xece8('0x7'));var client=jayson[_0xece8('0x8')][_0xece8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x160b48,_0x52e546,_0x498a3f){return new BPromise(function(_0x5bab8e,_0x4991e0){return client[_0xece8('0xa')](_0x160b48,_0x498a3f)[_0xece8('0xb')](function(_0x262976){logger[_0xece8('0xc')](_0xece8('0xd'),_0x52e546,'request\x20sent');logger[_0xece8('0xe')](_0xece8('0xf'),_0x52e546,'request\x20sent',JSON['stringify'](_0x262976));if(_0x262976[_0xece8('0x10')]){if(_0x262976[_0xece8('0x10')][_0xece8('0x11')]===0x1f4){logger[_0xece8('0x10')](_0xece8('0xd'),_0x52e546,_0x262976['error'][_0xece8('0x12')]);return _0x4991e0(_0x262976[_0xece8('0x10')]['message']);}logger[_0xece8('0x10')](_0xece8('0xd'),_0x52e546,_0x262976[_0xece8('0x10')]['message']);return _0x5bab8e(_0x262976[_0xece8('0x10')][_0xece8('0x12')]);}else{logger['info'](_0xece8('0xd'),_0x52e546,_0xece8('0x13'));_0x5bab8e(_0x262976[_0xece8('0x14')][_0xece8('0x12')]);}})[_0xece8('0x15')](function(_0x3763be){logger[_0xece8('0x10')](_0xece8('0xd'),_0x52e546,_0x3763be);_0x4991e0(_0x3763be);});});}exports[_0xece8('0x16')]=function(_0x5718f3){var _0x5e64d4=this;return new Promise(function(_0x35fd84,_0x3755df){return db[_0xece8('0x17')][_0xece8('0x18')](_0x5718f3[_0xece8('0x19')],{'raw':_0x5718f3['options']?_0x5718f3['options']['raw']===undefined?!![]:![]:!![]})[_0xece8('0xb')](function(_0x29fd7e){logger['info'](_0xece8('0x16'),_0x5718f3);logger[_0xece8('0xe')](_0xece8('0x16'),_0x5718f3,JSON[_0xece8('0x1a')](_0x29fd7e));_0x35fd84(_0x29fd7e);})['catch'](function(_0x24260e){logger[_0xece8('0x10')](_0xece8('0x16'),_0x24260e[_0xece8('0x12')],_0x5718f3);_0x3755df(_0x5e64d4['error'](0x1f4,_0x24260e[_0xece8('0x12')]));});});};exports[_0xece8('0x1b')]=function(_0x226c47){var _0x354eed=this;return new Promise(function(_0x2629d0,_0x25276e){return db['SmsQueueReport'][_0xece8('0x1c')](_0x226c47['body'],{'raw':_0x226c47[_0xece8('0x1d')]?_0x226c47['options'][_0xece8('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x226c47[_0xece8('0x1d')]?_0x226c47['options'][_0xece8('0x1f')]||null:null,'attributes':_0x226c47['options']?_0x226c47[_0xece8('0x1d')][_0xece8('0x20')]||null:null,'limit':_0x226c47[_0xece8('0x1d')]?_0x226c47[_0xece8('0x1d')][_0xece8('0x21')]||null:null})[_0xece8('0xb')](function(_0x135697){logger[_0xece8('0xc')](_0xece8('0x1b'),_0x226c47);logger[_0xece8('0xe')](_0xece8('0x1b'),_0x226c47,JSON[_0xece8('0x1a')](_0x135697));_0x2629d0(_0x135697);})[_0xece8('0x15')](function(_0x50aafc){logger[_0xece8('0x10')](_0xece8('0x1b'),_0x50aafc[_0xece8('0x12')],_0x226c47);_0x25276e(_0x354eed[_0xece8('0x10')](0x1f4,_0x50aafc[_0xece8('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 643026b..631159f 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 _0x08d9=['fs-extra','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','multer','path','express','Router'];(function(_0x1e4d16,_0x41537e){var _0x221bee=function(_0x1ac2b2){while(--_0x1ac2b2){_0x1e4d16['push'](_0x1e4d16['shift']());}};_0x221bee(++_0x41537e);}(_0x08d9,0xc2));var _0x908d=function(_0x5db010,_0x5f7adc){_0x5db010=_0x5db010-0x0;var _0x505c87=_0x08d9[_0x5db010];return _0x505c87;};'use strict';var multer=require(_0x908d('0x0'));var util=require('util');var path=require(_0x908d('0x1'));var timeout=require('connect-timeout');var express=require(_0x908d('0x2'));var router=express[_0x908d('0x3')]();var fs_extra=require(_0x908d('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x908d('0x5'));var controller=require(_0x908d('0x6'));router[_0x908d('0x7')]('/',auth[_0x908d('0x8')](),controller[_0x908d('0x9')]);router['get'](_0x908d('0xa'),auth[_0x908d('0x8')](),controller[_0x908d('0xb')]);router[_0x908d('0x7')](_0x908d('0xc'),auth[_0x908d('0x8')](),controller[_0x908d('0xd')]);router[_0x908d('0xe')]('/',auth[_0x908d('0x8')](),controller[_0x908d('0xf')]);router['put'](_0x908d('0xc'),auth[_0x908d('0x8')](),controller[_0x908d('0x10')]);router[_0x908d('0x11')](_0x908d('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0c02=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/:id','show','post','delete','destroy','util','path','express','Router'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x20c0('0x0'));var path=require(_0x20c0('0x1'));var timeout=require('connect-timeout');var express=require(_0x20c0('0x2'));var router=express[_0x20c0('0x3')]();var fs_extra=require(_0x20c0('0x4'));var auth=require(_0x20c0('0x5'));var interaction=require(_0x20c0('0x6'));var config=require(_0x20c0('0x7'));var controller=require(_0x20c0('0x8'));router[_0x20c0('0x9')]('/',auth[_0x20c0('0xa')](),controller[_0x20c0('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x20c0('0x9')](_0x20c0('0xc'),auth[_0x20c0('0xa')](),controller[_0x20c0('0xd')]);router[_0x20c0('0xe')]('/',auth[_0x20c0('0xa')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x20c0('0xf')](_0x20c0('0xc'),auth[_0x20c0('0xa')](),controller[_0x20c0('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 1b412e6..6034eab 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0xb5179e,_0x67e31d){var _0x423511=function(_0x408d13){while(--_0x408d13){_0xb5179e['push'](_0xb5179e['shift']());}};_0x423511(++_0x67e31d);}(_0x9c44,0x178));var _0x49c4=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x9c44[_0x4b369d];return _0x571a98;};'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 +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x2dbc5b,_0x141f92){var _0x2bd121=function(_0x12e161){while(--_0x12e161){_0x2dbc5b['push'](_0x2dbc5b['shift']());}};_0x2bd121(++_0x141f92);}(_0xaa88,0x137));var _0x8aa8=function(_0x5216e0,_0x4f8cb9){_0x5216e0=_0x5216e0-0x0;var _0x5b3f40=_0xaa88[_0x5216e0];return _0x5b3f40;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 74ee68d..5e2090f 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 _0x1abc=['rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','params','keys','length','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','map','SmsTransferReport'];(function(_0x2c062f,_0xc90b9){var _0x202e72=function(_0x397f6f){while(--_0x397f6f){_0x2c062f['push'](_0x2c062f['shift']());}};_0x202e72(++_0xc90b9);}(_0x1abc,0xbd));var _0xc1ab=function(_0x330c71,_0x290139){_0x330c71=_0x330c71-0x0;var _0x1f5916=_0x1abc[_0x330c71];return _0x1f5916;};'use strict';var emlformat=require(_0xc1ab('0x0'));var rimraf=require(_0xc1ab('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc1ab('0x2'));var rp=require(_0xc1ab('0x3'));var moment=require('moment');var BPromise=require(_0xc1ab('0x4'));var Mustache=require('mustache');var util=require(_0xc1ab('0x5'));var path=require(_0xc1ab('0x6'));var sox=require(_0xc1ab('0x7'));var csv=require(_0xc1ab('0x8'));var ejs=require(_0xc1ab('0x9'));var fs=require('fs');var fs_extra=require(_0xc1ab('0xa'));var _=require(_0xc1ab('0xb'));var squel=require(_0xc1ab('0xc'));var crypto=require(_0xc1ab('0xd'));var jsforce=require(_0xc1ab('0xe'));var deskjs=require(_0xc1ab('0xf'));var toCsv=require(_0xc1ab('0x8'));var querystring=require(_0xc1ab('0x10'));var Papa=require(_0xc1ab('0x11'));var Redis=require('ioredis');var authService=require(_0xc1ab('0x12'));var qs=require(_0xc1ab('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc1ab('0x14'));var logger=require(_0xc1ab('0x15'))(_0xc1ab('0x16'));var utils=require(_0xc1ab('0x17'));var config=require(_0xc1ab('0x18'));var licenseUtil=require(_0xc1ab('0x19'));var db=require(_0xc1ab('0x1a'))['db'];function respondWithStatusCode(_0x25ad4f,_0x47f334){_0x47f334=_0x47f334||0xcc;return function(_0x1b323a){if(_0x1b323a){return _0x25ad4f['sendStatus'](_0x47f334);}return _0x25ad4f[_0xc1ab('0x1b')](_0x47f334)[_0xc1ab('0x1c')]();};}function respondWithResult(_0xe9688a,_0x58e5f5){_0x58e5f5=_0x58e5f5||0xc8;return function(_0x10c4b7){if(_0x10c4b7){return _0xe9688a['status'](_0x58e5f5)[_0xc1ab('0x1d')](_0x10c4b7);}};}function respondWithFilteredResult(_0xaf73d1,_0x1e1de9){return function(_0x1ea58f){if(_0x1ea58f){var _0x1cd3c1=typeof _0x1e1de9[_0xc1ab('0x1e')]===_0xc1ab('0x1f')&&typeof _0x1e1de9['limit']===_0xc1ab('0x1f');var _0x4f06b9=_0x1ea58f[_0xc1ab('0x20')];var _0x32e392=_0x1cd3c1?0x0:_0x1e1de9[_0xc1ab('0x1e')];var _0xafd703=_0x1cd3c1?_0x1ea58f[_0xc1ab('0x20')]:_0x1e1de9[_0xc1ab('0x1e')]+_0x1e1de9[_0xc1ab('0x21')];var _0x1be86f;if(_0xafd703>=_0x4f06b9){_0xafd703=_0x4f06b9;_0x1be86f=0xc8;}else{_0x1be86f=0xce;}_0xaf73d1[_0xc1ab('0x1b')](_0x1be86f);return _0xaf73d1[_0xc1ab('0x22')](_0xc1ab('0x23'),_0x32e392+'-'+_0xafd703+'/'+_0x4f06b9)[_0xc1ab('0x1d')](_0x1ea58f);}return null;};}function patchUpdates(_0x4d34f3){return function(_0x39f85b){try{jsonpatch[_0xc1ab('0x24')](_0x39f85b,_0x4d34f3,!![]);}catch(_0x38acee){return BPromise['reject'](_0x38acee);}return _0x39f85b[_0xc1ab('0x25')]();};}function saveUpdates(_0x26a68c,_0x55bc27){return function(_0x343f17){if(_0x343f17){return _0x343f17[_0xc1ab('0x26')](_0x26a68c)[_0xc1ab('0x27')](function(_0x30e216){return _0x30e216;});}return null;};}function removeEntity(_0x3509fe,_0x479e52){return function(_0x1065b3){if(_0x1065b3){return _0x1065b3[_0xc1ab('0x28')]()['then'](function(){_0x3509fe['status'](0xcc)[_0xc1ab('0x1c')]();});}};}function handleEntityNotFound(_0xa82345,_0x480b57){return function(_0x305e36){if(!_0x305e36){_0xa82345[_0xc1ab('0x29')](0x194);}return _0x305e36;};}function handleError(_0xecd7f4,_0x62c4a3){_0x62c4a3=_0x62c4a3||0x1f4;return function(_0x2495c6){logger[_0xc1ab('0x2a')](_0x2495c6[_0xc1ab('0x2b')]);if(_0x2495c6[_0xc1ab('0x2c')]){delete _0x2495c6[_0xc1ab('0x2c')];}_0xecd7f4[_0xc1ab('0x1b')](_0x62c4a3)[_0xc1ab('0x2d')](_0x2495c6);};}exports['index']=function(_0x4125b1,_0x2eec48){var _0x4fa4d4={},_0x1b8c43={},_0x5ad145={'count':0x0,'rows':[]};var _0x14b6c0=_[_0xc1ab('0x2e')](db[_0xc1ab('0x2f')][_0xc1ab('0x30')],function(_0x520a09){return{'name':_0x520a09[_0xc1ab('0x31')],'type':_0x520a09[_0xc1ab('0x32')][_0xc1ab('0x33')]};});_0x1b8c43[_0xc1ab('0x34')]=_[_0xc1ab('0x2e')](_0x14b6c0,_0xc1ab('0x2c'));_0x1b8c43['query']=_['keys'](_0x4125b1[_0xc1ab('0x35')]);_0x1b8c43['filters']=_['intersection'](_0x1b8c43[_0xc1ab('0x34')],_0x1b8c43[_0xc1ab('0x35')]);_0x4fa4d4['attributes']=_[_0xc1ab('0x36')](_0x1b8c43[_0xc1ab('0x34')],qs[_0xc1ab('0x37')](_0x4125b1[_0xc1ab('0x35')][_0xc1ab('0x37')]));_0x4fa4d4[_0xc1ab('0x38')]=_0x4fa4d4[_0xc1ab('0x38')]['length']?_0x4fa4d4[_0xc1ab('0x38')]:_0x1b8c43[_0xc1ab('0x34')];if(!_0x4125b1[_0xc1ab('0x35')][_0xc1ab('0x39')](_0xc1ab('0x3a'))){_0x4fa4d4['limit']=qs[_0xc1ab('0x21')](_0x4125b1[_0xc1ab('0x35')][_0xc1ab('0x21')]);_0x4fa4d4[_0xc1ab('0x1e')]=qs[_0xc1ab('0x1e')](_0x4125b1[_0xc1ab('0x35')]['offset']);}_0x4fa4d4[_0xc1ab('0x3b')]=qs['sort'](_0x4125b1[_0xc1ab('0x35')][_0xc1ab('0x3c')]);_0x4fa4d4['where']=qs[_0xc1ab('0x3d')](_[_0xc1ab('0x3e')](_0x4125b1[_0xc1ab('0x35')],_0x1b8c43[_0xc1ab('0x3d')]),_0x14b6c0);if(_0x4125b1[_0xc1ab('0x35')][_0xc1ab('0x3f')]){_0x4fa4d4[_0xc1ab('0x40')]=_[_0xc1ab('0x41')](_0x4fa4d4[_0xc1ab('0x40')],{'$or':_[_0xc1ab('0x2e')](_0x14b6c0,function(_0x1371d5){if(_0x1371d5[_0xc1ab('0x32')]!==_0xc1ab('0x42')){var _0x3c3302={};_0x3c3302[_0x1371d5[_0xc1ab('0x2c')]]={'$like':'%'+_0x4125b1[_0xc1ab('0x35')][_0xc1ab('0x3f')]+'%'};return _0x3c3302;}})});}_0x4fa4d4=_[_0xc1ab('0x41')]({},_0x4fa4d4,_0x4125b1[_0xc1ab('0x43')]);var _0x348f7c={'where':_0x4fa4d4[_0xc1ab('0x40')]};return db[_0xc1ab('0x2f')]['count'](_0x348f7c)['then'](function(_0x4791e7){_0x5ad145[_0xc1ab('0x20')]=_0x4791e7;if(_0x4125b1[_0xc1ab('0x35')][_0xc1ab('0x44')]){_0x4fa4d4[_0xc1ab('0x45')]=[{'all':!![]}];}return db[_0xc1ab('0x2f')]['findAll'](_0x4fa4d4);})[_0xc1ab('0x27')](function(_0x319f53){_0x5ad145[_0xc1ab('0x46')]=_0x319f53;return _0x5ad145;})[_0xc1ab('0x27')](respondWithFilteredResult(_0x2eec48,_0x4fa4d4))[_0xc1ab('0x47')](handleError(_0x2eec48,null));};exports['show']=function(_0x4e1cd9,_0x50fedf){var _0xdd3338={'raw':!![],'where':{'id':_0x4e1cd9[_0xc1ab('0x48')]['id']}},_0x3c20ef={};_0x3c20ef[_0xc1ab('0x34')]=_[_0xc1ab('0x49')](db[_0xc1ab('0x2f')][_0xc1ab('0x30')]);_0x3c20ef[_0xc1ab('0x35')]=_['keys'](_0x4e1cd9['query']);_0x3c20ef[_0xc1ab('0x3d')]=_[_0xc1ab('0x36')](_0x3c20ef['model'],_0x3c20ef[_0xc1ab('0x35')]);_0xdd3338['attributes']=_[_0xc1ab('0x36')](_0x3c20ef['model'],qs[_0xc1ab('0x37')](_0x4e1cd9[_0xc1ab('0x35')][_0xc1ab('0x37')]));_0xdd3338[_0xc1ab('0x38')]=_0xdd3338['attributes'][_0xc1ab('0x4a')]?_0xdd3338[_0xc1ab('0x38')]:_0x3c20ef[_0xc1ab('0x34')];if(_0x4e1cd9[_0xc1ab('0x35')][_0xc1ab('0x44')]){_0xdd3338[_0xc1ab('0x45')]=[{'all':!![]}];}_0xdd3338=_['merge']({},_0xdd3338,_0x4e1cd9['options']);return db[_0xc1ab('0x2f')][_0xc1ab('0x4b')](_0xdd3338)[_0xc1ab('0x27')](handleEntityNotFound(_0x50fedf,null))[_0xc1ab('0x27')](respondWithResult(_0x50fedf,null))[_0xc1ab('0x47')](handleError(_0x50fedf,null));};exports[_0xc1ab('0x4c')]=function(_0x1b49ed,_0x66e6f9){return db[_0xc1ab('0x2f')]['create'](_0x1b49ed[_0xc1ab('0x4d')],{})[_0xc1ab('0x27')](respondWithResult(_0x66e6f9,0xc9))[_0xc1ab('0x47')](handleError(_0x66e6f9,null));};exports[_0xc1ab('0x26')]=function(_0x294922,_0x218278){if(_0x294922[_0xc1ab('0x4d')]['id']){delete _0x294922['body']['id'];}return db[_0xc1ab('0x2f')][_0xc1ab('0x4b')]({'where':{'id':_0x294922[_0xc1ab('0x48')]['id']}})['then'](handleEntityNotFound(_0x218278,null))[_0xc1ab('0x27')](saveUpdates(_0x294922[_0xc1ab('0x4d')],null))[_0xc1ab('0x27')](respondWithResult(_0x218278,null))['catch'](handleError(_0x218278,null));};exports[_0xc1ab('0x28')]=function(_0x30ca30,_0x11c489){return db[_0xc1ab('0x2f')]['find']({'where':{'id':_0x30ca30[_0xc1ab('0x48')]['id']}})[_0xc1ab('0x27')](handleEntityNotFound(_0x11c489,null))[_0xc1ab('0x27')](removeEntity(_0x11c489,null))['catch'](handleError(_0x11c489,null));};exports[_0xc1ab('0x4e')]=function(_0x9ef64c,_0x21f2ed){return db[_0xc1ab('0x2f')][_0xc1ab('0x4e')]()[_0xc1ab('0x27')](respondWithResult(_0x21f2ed,null))[_0xc1ab('0x47')](handleError(_0x21f2ed,null));}; \ No newline at end of file +var _0x0ea9=['keys','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','SmsTransferReport','findAll','catch','show','params'];(function(_0x50ca2e,_0x3294ee){var _0x8a58c5=function(_0x6f29aa){while(--_0x6f29aa){_0x50ca2e['push'](_0x50ca2e['shift']());}};_0x8a58c5(++_0x3294ee);}(_0x0ea9,0xe9));var _0x90ea=function(_0x2d4c2d,_0x3a7895){_0x2d4c2d=_0x2d4c2d-0x0;var _0x25f284=_0x0ea9[_0x2d4c2d];return _0x25f284;};'use strict';var emlformat=require(_0x90ea('0x0'));var rimraf=require(_0x90ea('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x90ea('0x2'));var rp=require(_0x90ea('0x3'));var moment=require(_0x90ea('0x4'));var BPromise=require(_0x90ea('0x5'));var Mustache=require(_0x90ea('0x6'));var util=require(_0x90ea('0x7'));var path=require(_0x90ea('0x8'));var sox=require('sox');var csv=require(_0x90ea('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x90ea('0xa'));var _=require(_0x90ea('0xb'));var squel=require(_0x90ea('0xc'));var crypto=require(_0x90ea('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x90ea('0xe'));var toCsv=require(_0x90ea('0x9'));var querystring=require(_0x90ea('0xf'));var Papa=require(_0x90ea('0x10'));var Redis=require(_0x90ea('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x90ea('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x90ea('0x13'));var utils=require('../../config/utils');var config=require(_0x90ea('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x90ea('0x15'))['db'];function respondWithStatusCode(_0x55fe94,_0x225feb){_0x225feb=_0x225feb||0xcc;return function(_0x79ab2d){if(_0x79ab2d){return _0x55fe94[_0x90ea('0x16')](_0x225feb);}return _0x55fe94['status'](_0x225feb)[_0x90ea('0x17')]();};}function respondWithResult(_0x4b3b53,_0x1d716a){_0x1d716a=_0x1d716a||0xc8;return function(_0x42421c){if(_0x42421c){return _0x4b3b53[_0x90ea('0x18')](_0x1d716a)['json'](_0x42421c);}};}function respondWithFilteredResult(_0x2ce8de,_0x3a0b14){return function(_0x1610e5){if(_0x1610e5){var _0x1b9dc4=typeof _0x3a0b14[_0x90ea('0x19')]===_0x90ea('0x1a')&&typeof _0x3a0b14['limit']===_0x90ea('0x1a');var _0x24a277=_0x1610e5[_0x90ea('0x1b')];var _0x5d3c56=_0x1b9dc4?0x0:_0x3a0b14[_0x90ea('0x19')];var _0x3acf92=_0x1b9dc4?_0x1610e5[_0x90ea('0x1b')]:_0x3a0b14['offset']+_0x3a0b14['limit'];var _0x1c655c;if(_0x3acf92>=_0x24a277){_0x3acf92=_0x24a277;_0x1c655c=0xc8;}else{_0x1c655c=0xce;}_0x2ce8de['status'](_0x1c655c);return _0x2ce8de[_0x90ea('0x1c')](_0x90ea('0x1d'),_0x5d3c56+'-'+_0x3acf92+'/'+_0x24a277)[_0x90ea('0x1e')](_0x1610e5);}return null;};}function patchUpdates(_0x874145){return function(_0x2bcddc){try{jsonpatch[_0x90ea('0x1f')](_0x2bcddc,_0x874145,!![]);}catch(_0x1c61b2){return BPromise[_0x90ea('0x20')](_0x1c61b2);}return _0x2bcddc[_0x90ea('0x21')]();};}function saveUpdates(_0x1bab7f,_0x2c4032){return function(_0x10855d){if(_0x10855d){return _0x10855d[_0x90ea('0x22')](_0x1bab7f)[_0x90ea('0x23')](function(_0x1ad239){return _0x1ad239;});}return null;};}function removeEntity(_0x165856,_0x206843){return function(_0x28edc7){if(_0x28edc7){return _0x28edc7[_0x90ea('0x24')]()[_0x90ea('0x23')](function(){_0x165856[_0x90ea('0x18')](0xcc)[_0x90ea('0x17')]();});}};}function handleEntityNotFound(_0x1cf7ec,_0x5d1df7){return function(_0x4eaa3c){if(!_0x4eaa3c){_0x1cf7ec[_0x90ea('0x16')](0x194);}return _0x4eaa3c;};}function handleError(_0x1c6650,_0x16f5d2){_0x16f5d2=_0x16f5d2||0x1f4;return function(_0xa580c9){logger[_0x90ea('0x25')](_0xa580c9['stack']);if(_0xa580c9[_0x90ea('0x26')]){delete _0xa580c9[_0x90ea('0x26')];}_0x1c6650['status'](_0x16f5d2)[_0x90ea('0x27')](_0xa580c9);};}exports[_0x90ea('0x28')]=function(_0x52dd4c,_0x3762b8){var _0x5b5fbb={},_0x44dd4e={},_0x44be47={'count':0x0,'rows':[]};var _0xd4ccb6=_[_0x90ea('0x29')](db['SmsTransferReport'][_0x90ea('0x2a')],function(_0x5864e3){return{'name':_0x5864e3[_0x90ea('0x2b')],'type':_0x5864e3[_0x90ea('0x2c')][_0x90ea('0x2d')]};});_0x44dd4e[_0x90ea('0x2e')]=_[_0x90ea('0x29')](_0xd4ccb6,_0x90ea('0x26'));_0x44dd4e[_0x90ea('0x2f')]=_['keys'](_0x52dd4c['query']);_0x44dd4e[_0x90ea('0x30')]=_[_0x90ea('0x31')](_0x44dd4e[_0x90ea('0x2e')],_0x44dd4e['query']);_0x5b5fbb[_0x90ea('0x32')]=_[_0x90ea('0x31')](_0x44dd4e[_0x90ea('0x2e')],qs[_0x90ea('0x33')](_0x52dd4c[_0x90ea('0x2f')][_0x90ea('0x33')]));_0x5b5fbb['attributes']=_0x5b5fbb[_0x90ea('0x32')][_0x90ea('0x34')]?_0x5b5fbb['attributes']:_0x44dd4e['model'];if(!_0x52dd4c[_0x90ea('0x2f')][_0x90ea('0x35')](_0x90ea('0x36'))){_0x5b5fbb['limit']=qs[_0x90ea('0x37')](_0x52dd4c[_0x90ea('0x2f')][_0x90ea('0x37')]);_0x5b5fbb['offset']=qs[_0x90ea('0x19')](_0x52dd4c[_0x90ea('0x2f')]['offset']);}_0x5b5fbb[_0x90ea('0x38')]=qs[_0x90ea('0x39')](_0x52dd4c[_0x90ea('0x2f')][_0x90ea('0x39')]);_0x5b5fbb[_0x90ea('0x3a')]=qs[_0x90ea('0x30')](_[_0x90ea('0x3b')](_0x52dd4c[_0x90ea('0x2f')],_0x44dd4e[_0x90ea('0x30')]),_0xd4ccb6);if(_0x52dd4c[_0x90ea('0x2f')]['filter']){_0x5b5fbb[_0x90ea('0x3a')]=_[_0x90ea('0x3c')](_0x5b5fbb[_0x90ea('0x3a')],{'$or':_[_0x90ea('0x29')](_0xd4ccb6,function(_0x559a06){if(_0x559a06[_0x90ea('0x2c')]!==_0x90ea('0x3d')){var _0x27c4ec={};_0x27c4ec[_0x559a06[_0x90ea('0x26')]]={'$like':'%'+_0x52dd4c[_0x90ea('0x2f')][_0x90ea('0x3e')]+'%'};return _0x27c4ec;}})});}_0x5b5fbb=_[_0x90ea('0x3c')]({},_0x5b5fbb,_0x52dd4c[_0x90ea('0x3f')]);var _0xa6afdb={'where':_0x5b5fbb[_0x90ea('0x3a')]};return db['SmsTransferReport'][_0x90ea('0x1b')](_0xa6afdb)[_0x90ea('0x23')](function(_0x278226){_0x44be47[_0x90ea('0x1b')]=_0x278226;if(_0x52dd4c[_0x90ea('0x2f')][_0x90ea('0x40')]){_0x5b5fbb[_0x90ea('0x41')]=[{'all':!![]}];}return db[_0x90ea('0x42')][_0x90ea('0x43')](_0x5b5fbb);})[_0x90ea('0x23')](function(_0x216519){_0x44be47['rows']=_0x216519;return _0x44be47;})[_0x90ea('0x23')](respondWithFilteredResult(_0x3762b8,_0x5b5fbb))[_0x90ea('0x44')](handleError(_0x3762b8,null));};exports[_0x90ea('0x45')]=function(_0xc0a749,_0x307c41){var _0xf5821={'raw':!![],'where':{'id':_0xc0a749[_0x90ea('0x46')]['id']}},_0x34f4aa={};_0x34f4aa['model']=_[_0x90ea('0x47')](db[_0x90ea('0x42')][_0x90ea('0x2a')]);_0x34f4aa['query']=_[_0x90ea('0x47')](_0xc0a749[_0x90ea('0x2f')]);_0x34f4aa[_0x90ea('0x30')]=_[_0x90ea('0x31')](_0x34f4aa['model'],_0x34f4aa['query']);_0xf5821[_0x90ea('0x32')]=_[_0x90ea('0x31')](_0x34f4aa[_0x90ea('0x2e')],qs[_0x90ea('0x33')](_0xc0a749[_0x90ea('0x2f')][_0x90ea('0x33')]));_0xf5821[_0x90ea('0x32')]=_0xf5821['attributes'][_0x90ea('0x34')]?_0xf5821['attributes']:_0x34f4aa[_0x90ea('0x2e')];if(_0xc0a749[_0x90ea('0x2f')][_0x90ea('0x40')]){_0xf5821['include']=[{'all':!![]}];}_0xf5821=_['merge']({},_0xf5821,_0xc0a749[_0x90ea('0x3f')]);return db['SmsTransferReport'][_0x90ea('0x48')](_0xf5821)[_0x90ea('0x23')](handleEntityNotFound(_0x307c41,null))[_0x90ea('0x23')](respondWithResult(_0x307c41,null))[_0x90ea('0x44')](handleError(_0x307c41,null));};exports[_0x90ea('0x49')]=function(_0x4289a3,_0x1edf3f){return db[_0x90ea('0x42')]['create'](_0x4289a3[_0x90ea('0x4a')],{})[_0x90ea('0x23')](respondWithResult(_0x1edf3f,0xc9))[_0x90ea('0x44')](handleError(_0x1edf3f,null));};exports['update']=function(_0x2510b8,_0x203b40){if(_0x2510b8['body']['id']){delete _0x2510b8['body']['id'];}return db[_0x90ea('0x42')][_0x90ea('0x48')]({'where':{'id':_0x2510b8['params']['id']}})[_0x90ea('0x23')](handleEntityNotFound(_0x203b40,null))[_0x90ea('0x23')](saveUpdates(_0x2510b8['body'],null))[_0x90ea('0x23')](respondWithResult(_0x203b40,null))['catch'](handleError(_0x203b40,null));};exports[_0x90ea('0x24')]=function(_0x1c8996,_0x53bea7){return db['SmsTransferReport']['find']({'where':{'id':_0x1c8996[_0x90ea('0x46')]['id']}})[_0x90ea('0x23')](handleEntityNotFound(_0x53bea7,null))['then'](removeEntity(_0x53bea7,null))['catch'](handleError(_0x53bea7,null));};exports[_0x90ea('0x4b')]=function(_0x484c6a,_0x57312f){return db['SmsTransferReport'][_0x90ea('0x4b')]()[_0x90ea('0x23')](respondWithResult(_0x57312f,null))['catch'](handleError(_0x57312f,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index e3b2a16..60a0405 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 _0xcca7=['api','request-promise','rimraf','../../config/environment','./smsTransferReport.attributes','exports','report_sms_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x6eb833,_0x2bb5e5){var _0xdfc38c=function(_0x13c4a4){while(--_0x13c4a4){_0x6eb833['push'](_0x6eb833['shift']());}};_0xdfc38c(++_0x2bb5e5);}(_0xcca7,0x1aa));var _0x7cca=function(_0x5bf36d,_0x194769){_0x5bf36d=_0x5bf36d-0x0;var _0xc78588=_0xcca7[_0x5bf36d];return _0xc78588;};'use strict';var _=require(_0x7cca('0x0'));var util=require(_0x7cca('0x1'));var logger=require(_0x7cca('0x2'))(_0x7cca('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7cca('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7cca('0x5'));var config=require(_0x7cca('0x6'));var attributes=require(_0x7cca('0x7'));module[_0x7cca('0x8')]=function(_0x1c6c95,_0xe70805){return _0x1c6c95['define']('SmsTransferReport',attributes,{'tableName':_0x7cca('0x9'),'paranoid':![],'indexes':[{'name':_0x7cca('0xa'),'fields':[_0x7cca('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaad1=['lodash','../../config/logger','bluebird','rimraf','./smsTransferReport.attributes','exports','define','uniqueid'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xaad1,0x148));var _0x1aad=function(_0x25bb2d,_0x580e5f){_0x25bb2d=_0x25bb2d-0x0;var _0x4fb7d5=_0xaad1[_0x25bb2d];return _0x4fb7d5;};'use strict';var _=require(_0x1aad('0x0'));var util=require('util');var logger=require(_0x1aad('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1aad('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1aad('0x3'));var config=require('../../config/environment');var attributes=require(_0x1aad('0x4'));module[_0x1aad('0x5')]=function(_0x29bd24,_0x4c885f){return _0x29bd24[_0x1aad('0x6')]('SmsTransferReport',attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x1aad('0x7'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 8d9673d..3981169 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 _0x28e3=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util'];(function(_0x197185,_0x251145){var _0x2c8af1=function(_0x1dbcfd){while(--_0x1dbcfd){_0x197185['push'](_0x197185['shift']());}};_0x2c8af1(++_0x251145);}(_0x28e3,0x106));var _0x328e=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x28e3[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0x328e('0x0'));var util=require(_0x328e('0x1'));var moment=require(_0x328e('0x2'));var BPromise=require(_0x328e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x328e('0x4'));var db=require(_0x328e('0x5'))['db'];var utils=require(_0x328e('0x6'));var logger=require(_0x328e('0x7'))(_0x328e('0x8'));var config=require(_0x328e('0x9'));var jayson=require(_0x328e('0xa'));var client=jayson[_0x328e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b5c91,_0x58885f,_0x2bddaa){return new BPromise(function(_0x3696b6,_0x3467ee){return client[_0x328e('0xc')](_0x4b5c91,_0x2bddaa)[_0x328e('0xd')](function(_0x4a4f53){logger[_0x328e('0xe')](_0x328e('0xf'),_0x58885f,_0x328e('0x10'));logger['debug']('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x58885f,'request\x20sent',JSON[_0x328e('0x11')](_0x4a4f53));if(_0x4a4f53[_0x328e('0x12')]){if(_0x4a4f53[_0x328e('0x12')][_0x328e('0x13')]===0x1f4){logger[_0x328e('0x12')](_0x328e('0xf'),_0x58885f,_0x4a4f53[_0x328e('0x12')][_0x328e('0x14')]);return _0x3467ee(_0x4a4f53[_0x328e('0x12')][_0x328e('0x14')]);}logger[_0x328e('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x58885f,_0x4a4f53[_0x328e('0x12')][_0x328e('0x14')]);return _0x3696b6(_0x4a4f53[_0x328e('0x12')][_0x328e('0x14')]);}else{logger[_0x328e('0xe')](_0x328e('0xf'),_0x58885f,_0x328e('0x10'));_0x3696b6(_0x4a4f53[_0x328e('0x15')][_0x328e('0x14')]);}})['catch'](function(_0x1fdb79){logger[_0x328e('0x12')](_0x328e('0xf'),_0x58885f,_0x1fdb79);_0x3467ee(_0x1fdb79);});});} \ No newline at end of file +var _0x385b=['SmsTransferReport,\x20%s,\x20%s','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x466aeb,_0x3a35bf){var _0x57818e=function(_0x28ac49){while(--_0x28ac49){_0x466aeb['push'](_0x466aeb['shift']());}};_0x57818e(++_0x3a35bf);}(_0x385b,0x1a7));var _0xb385=function(_0xfb6cef,_0x206adf){_0xfb6cef=_0xfb6cef-0x0;var _0x40eb07=_0x385b[_0xfb6cef];return _0x40eb07;};'use strict';var _=require('lodash');var util=require(_0xb385('0x0'));var moment=require('moment');var BPromise=require(_0xb385('0x1'));var rs=require(_0xb385('0x2'));var fs=require('fs');var Redis=require(_0xb385('0x3'));var db=require(_0xb385('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb385('0x5'))(_0xb385('0x6'));var config=require(_0xb385('0x7'));var jayson=require(_0xb385('0x8'));var client=jayson[_0xb385('0x9')][_0xb385('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x411034,_0x367d50,_0x5b7929){return new BPromise(function(_0x397ddc,_0xe2bfc1){return client[_0xb385('0xb')](_0x411034,_0x5b7929)[_0xb385('0xc')](function(_0x507620){logger[_0xb385('0xd')](_0xb385('0xe'),_0x367d50,'request\x20sent');logger[_0xb385('0xf')](_0xb385('0x10'),_0x367d50,_0xb385('0x11'),JSON[_0xb385('0x12')](_0x507620));if(_0x507620[_0xb385('0x13')]){if(_0x507620[_0xb385('0x13')]['code']===0x1f4){logger[_0xb385('0x13')]('SmsTransferReport,\x20%s,\x20%s',_0x367d50,_0x507620['error'][_0xb385('0x14')]);return _0xe2bfc1(_0x507620['error'][_0xb385('0x14')]);}logger[_0xb385('0x13')](_0xb385('0xe'),_0x367d50,_0x507620['error'][_0xb385('0x14')]);return _0x397ddc(_0x507620[_0xb385('0x13')][_0xb385('0x14')]);}else{logger['info'](_0xb385('0xe'),_0x367d50,_0xb385('0x11'));_0x397ddc(_0x507620[_0xb385('0x15')]['message']);}})[_0xb385('0x16')](function(_0xad040a){logger[_0xb385('0x13')](_0xb385('0xe'),_0x367d50,_0xad040a);_0xe2bfc1(_0xad040a);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 84cf790..8075e65 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 _0x24db=['exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','root','originalname','format','%s-%s%s','now','extname','post','single','file','create','put','update','delete'];(function(_0x3f943f,_0x1bc3d7){var _0xdf628a=function(_0xe97b54){while(--_0xe97b54){_0x3f943f['push'](_0x3f943f['shift']());}};_0xdf628a(++_0x1bc3d7);}(_0x24db,0xe9));var _0xb24d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x24db[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xb24d('0x0'));var express=require(_0xb24d('0x1'));var router=express[_0xb24d('0x2')]();var fs_extra=require(_0xb24d('0x3'));var auth=require(_0xb24d('0x4'));var interaction=require(_0xb24d('0x5'));var config=require(_0xb24d('0x6'));var controller=require('./sound.controller');router[_0xb24d('0x7')]('/',auth[_0xb24d('0x8')](),controller[_0xb24d('0x9')]);router[_0xb24d('0x7')](_0xb24d('0xa'),auth[_0xb24d('0x8')](),controller[_0xb24d('0xb')]);router[_0xb24d('0x7')](_0xb24d('0xc'),auth['isAuthenticated'](),controller[_0xb24d('0xd')]);var upload=multer({'storage':multer[_0xb24d('0xe')]({'destination':function(_0x476986,_0x134f5e,_0x72f03){_0x72f03(null,path['join'](config[_0xb24d('0xf')],'server/files/sounds/original/'));},'filename':function(_0x3a55c4,_0x2714d2,_0x4ba510){_0x2714d2[_0xb24d('0x10')]=_0x2714d2['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4ba510(null,util[_0xb24d('0x11')](_0xb24d('0x12'),path['basename'](_0x2714d2['originalname'],path['extname'](_0x2714d2['originalname'])),Date[_0xb24d('0x13')](),path[_0xb24d('0x14')](_0x2714d2[_0xb24d('0x10')])));}})});router[_0xb24d('0x15')]('/',upload[_0xb24d('0x16')](_0xb24d('0x17')),controller[_0xb24d('0x18')]);router[_0xb24d('0x19')](_0xb24d('0xa'),auth['isAuthenticated'](),controller[_0xb24d('0x1a')]);router[_0xb24d('0x1b')](_0xb24d('0xa'),auth[_0xb24d('0x8')](),controller[_0xb24d('0x1b')]);module[_0xb24d('0x1c')]=router; \ No newline at end of file +var _0xa00c=['../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show','download','root','originalname','replace','basename','extname','now','post','single','file','put','update','delete','exports','multer','express','Router','../../components/auth/service'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa00c,0x1d7));var _0xca00=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xa00c[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0xca00('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xca00('0x1'));var router=express[_0xca00('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xca00('0x3'));var interaction=require(_0xca00('0x4'));var config=require(_0xca00('0x5'));var controller=require('./sound.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xca00('0x6')]);router[_0xca00('0x7')](_0xca00('0x8'),auth[_0xca00('0x9')](),controller[_0xca00('0xa')]);router[_0xca00('0x7')]('/:id/download',auth[_0xca00('0x9')](),controller[_0xca00('0xb')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x366b2b,_0xe2bddf,_0x1bced7){_0x1bced7(null,path['join'](config[_0xca00('0xc')],'server/files/sounds/original/'));},'filename':function(_0x406a25,_0x50eed2,_0x579445){_0x50eed2[_0xca00('0xd')]=_0x50eed2[_0xca00('0xd')][_0xca00('0xe')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x579445(null,util['format']('%s-%s%s',path[_0xca00('0xf')](_0x50eed2[_0xca00('0xd')],path[_0xca00('0x10')](_0x50eed2[_0xca00('0xd')])),Date[_0xca00('0x11')](),path[_0xca00('0x10')](_0x50eed2['originalname'])));}})});router[_0xca00('0x12')]('/',upload[_0xca00('0x13')](_0xca00('0x14')),controller['create']);router[_0xca00('0x15')](_0xca00('0x8'),auth[_0xca00('0x9')](),controller[_0xca00('0x16')]);router['delete'](_0xca00('0x8'),auth[_0xca00('0x9')](),controller[_0xca00('0x17')]);module[_0xca00('0x18')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index b8bd9cb..0240c5c 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 _0xb88b=['exports','STRING','name','FLOAT','BIGINT','INTEGER'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0xb88b,0x1c8));var _0xbb88=function(_0x1de918,_0x2dc421){_0x1de918=_0x1de918-0x0;var _0x5fc1a0=_0xb88b[_0x1de918];return _0x5fc1a0;};'use strict';var Sequelize=require('sequelize');module[_0xbb88('0x0')]={'name':{'type':Sequelize[_0xbb88('0x1')],'unique':_0xbb88('0x2'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0xbb88('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0xbb88('0x1')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0xbb88('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0xbb88('0x4')]},'original_sampleRate':{'type':Sequelize[_0xbb88('0x5')]},'converted_format':{'type':Sequelize[_0xbb88('0x1')]},'converted_duration':{'type':Sequelize[_0xbb88('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xbb88('0x4')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0xbb88('0x4')]},'converted_sampleRate':{'type':Sequelize[_0xbb88('0x5')]}}; \ No newline at end of file +var _0x6b74=['exports','STRING','BIGINT','FLOAT','INTEGER','sequelize'];(function(_0x6a1820,_0x30dce4){var _0x17a165=function(_0x4a8b8a){while(--_0x4a8b8a){_0x6a1820['push'](_0x6a1820['shift']());}};_0x17a165(++_0x30dce4);}(_0x6b74,0x65));var _0x46b7=function(_0xa79977,_0x4f7f12){_0xa79977=_0xa79977-0x0;var _0x109f10=_0x6b74[_0xa79977];return _0x109f10;};'use strict';var Sequelize=require(_0x46b7('0x0'));module[_0x46b7('0x1')]={'name':{'type':Sequelize[_0x46b7('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x46b7('0x2')]},'display_name':{'type':Sequelize[_0x46b7('0x2')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x46b7('0x2')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x46b7('0x3')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x46b7('0x2')]},'converted_duration':{'type':Sequelize[_0x46b7('0x4')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x46b7('0x5')]},'converted_bitRate':{'type':Sequelize[_0x46b7('0x3')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 0eb6ea2..c1c3fec 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 _0x354b=['to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','Sounds','UserProfileResource','error','stack','name','send','index','map','fieldName','type','key','query','filters','intersection','fields','attributes','length','nolimit','order','sort','filter','where','merge','options','Sound','includeAll','include','rows','catch','show','params','keys','rawAttributes','model','find','download','save_name','root','server/files/sounds/converted','converted_format','Sequelize','ValidationError','Sound\x20not\x20found','format','create','basename','file','originalname','extname','filename','substring','wav','join','%s.%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_bitRate','converted_sampleRate','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','autoAssociation','pick','description','delete','server/files/sounds/original','original_format','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x5cc51f,_0x22c480){var _0x315a2f=function(_0x4f93bd){while(--_0x4f93bd){_0x5cc51f['push'](_0x5cc51f['shift']());}};_0x315a2f(++_0x22c480);}(_0x354b,0x171));var _0xb354=function(_0x1fa5aa,_0x32648f){_0x1fa5aa=_0x1fa5aa-0x0;var _0x1c532f=_0x354b[_0x1fa5aa];return _0x1c532f;};'use strict';var emlformat=require(_0xb354('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb354('0x1'));var jsonpatch=require(_0xb354('0x2'));var rp=require(_0xb354('0x3'));var moment=require(_0xb354('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb354('0x5'));var util=require(_0xb354('0x6'));var path=require('path');var sox=require(_0xb354('0x7'));var csv=require('to-csv');var ejs=require(_0xb354('0x8'));var fs=require('fs');var fs_extra=require(_0xb354('0x9'));var _=require(_0xb354('0xa'));var squel=require(_0xb354('0xb'));var crypto=require(_0xb354('0xc'));var jsforce=require(_0xb354('0xd'));var deskjs=require(_0xb354('0xe'));var toCsv=require(_0xb354('0xf'));var querystring=require(_0xb354('0x10'));var Papa=require(_0xb354('0x11'));var Redis=require(_0xb354('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb354('0x13'));var as=require(_0xb354('0x14'));var hardwareService=require(_0xb354('0x15'));var logger=require(_0xb354('0x16'))(_0xb354('0x17'));var utils=require(_0xb354('0x18'));var config=require(_0xb354('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xb354('0x1a'))['db'];function respondWithStatusCode(_0x45dbd7,_0x5f32b1){_0x5f32b1=_0x5f32b1||0xcc;return function(_0x5c8208){if(_0x5c8208){return _0x45dbd7[_0xb354('0x1b')](_0x5f32b1);}return _0x45dbd7[_0xb354('0x1c')](_0x5f32b1)[_0xb354('0x1d')]();};}function respondWithResult(_0x584a09,_0x31b34b){_0x31b34b=_0x31b34b||0xc8;return function(_0x521adf){if(_0x521adf){return _0x584a09['status'](_0x31b34b)[_0xb354('0x1e')](_0x521adf);}};}function respondWithFilteredResult(_0x5b14e7,_0x3e0bcb){return function(_0x13d11b){if(_0x13d11b){var _0x1541c3=typeof _0x3e0bcb[_0xb354('0x1f')]===_0xb354('0x20')&&typeof _0x3e0bcb[_0xb354('0x21')]===_0xb354('0x20');var _0x150fd9=_0x13d11b['count'];var _0x773c43=_0x1541c3?0x0:_0x3e0bcb['offset'];var _0x442fdc=_0x1541c3?_0x13d11b[_0xb354('0x22')]:_0x3e0bcb[_0xb354('0x1f')]+_0x3e0bcb['limit'];var _0x46df96;if(_0x442fdc>=_0x150fd9){_0x442fdc=_0x150fd9;_0x46df96=0xc8;}else{_0x46df96=0xce;}_0x5b14e7[_0xb354('0x1c')](_0x46df96);return _0x5b14e7[_0xb354('0x23')](_0xb354('0x24'),_0x773c43+'-'+_0x442fdc+'/'+_0x150fd9)[_0xb354('0x1e')](_0x13d11b);}return null;};}function patchUpdates(_0x32b9db){return function(_0x2781af){try{jsonpatch['apply'](_0x2781af,_0x32b9db,!![]);}catch(_0x74076f){return BPromise[_0xb354('0x25')](_0x74076f);}return _0x2781af[_0xb354('0x26')]();};}function saveUpdates(_0x481496,_0x1cb7a0){return function(_0x3358eb){if(_0x3358eb){return _0x3358eb[_0xb354('0x27')](_0x481496)[_0xb354('0x28')](function(_0x91fc23){return _0x91fc23;});}return null;};}function removeEntity(_0x16afc7,_0x57484a){return function(_0x4024cd){if(_0x4024cd){return _0x4024cd[_0xb354('0x29')]()['then'](function(){var _0x2be582=_0x4024cd['get']({'plain':!![]});var _0x39dec9=_0xb354('0x2a');return db[_0xb354('0x2b')]['destroy']({'where':{'type':_0x39dec9,'resourceId':_0x2be582['id']}})[_0xb354('0x28')](function(){return _0x4024cd;});})['then'](function(){_0x16afc7[_0xb354('0x1c')](0xcc)[_0xb354('0x1d')]();});}};}function handleEntityNotFound(_0x1f193f,_0x36ddb0){return function(_0x63a02b){if(!_0x63a02b){_0x1f193f['sendStatus'](0x194);}return _0x63a02b;};}function handleError(_0x514ca0,_0x1067ba){_0x1067ba=_0x1067ba||0x1f4;return function(_0x4e0063){logger[_0xb354('0x2c')](_0x4e0063[_0xb354('0x2d')]);if(_0x4e0063[_0xb354('0x2e')]){delete _0x4e0063[_0xb354('0x2e')];}_0x514ca0['status'](_0x1067ba)[_0xb354('0x2f')](_0x4e0063);};}exports[_0xb354('0x30')]=function(_0x4c80b0,_0x14dc6f){var _0x4ed14d={},_0x47560c={},_0xa2832e={'count':0x0,'rows':[]};var _0x54efb5=_[_0xb354('0x31')](db['Sound']['rawAttributes'],function(_0x3c3980){return{'name':_0x3c3980[_0xb354('0x32')],'type':_0x3c3980[_0xb354('0x33')][_0xb354('0x34')]};});_0x47560c['model']=_[_0xb354('0x31')](_0x54efb5,_0xb354('0x2e'));_0x47560c[_0xb354('0x35')]=_['keys'](_0x4c80b0['query']);_0x47560c[_0xb354('0x36')]=_[_0xb354('0x37')](_0x47560c['model'],_0x47560c[_0xb354('0x35')]);_0x4ed14d['attributes']=_[_0xb354('0x37')](_0x47560c['model'],qs[_0xb354('0x38')](_0x4c80b0['query'][_0xb354('0x38')]));_0x4ed14d['attributes']=_0x4ed14d[_0xb354('0x39')][_0xb354('0x3a')]?_0x4ed14d[_0xb354('0x39')]:_0x47560c['model'];if(!_0x4c80b0[_0xb354('0x35')]['hasOwnProperty'](_0xb354('0x3b'))){_0x4ed14d[_0xb354('0x21')]=qs['limit'](_0x4c80b0[_0xb354('0x35')][_0xb354('0x21')]);_0x4ed14d[_0xb354('0x1f')]=qs[_0xb354('0x1f')](_0x4c80b0[_0xb354('0x35')][_0xb354('0x1f')]);}_0x4ed14d[_0xb354('0x3c')]=qs[_0xb354('0x3d')](_0x4c80b0['query'][_0xb354('0x3d')]);_0x4ed14d['where']=qs[_0xb354('0x36')](_['pick'](_0x4c80b0['query'],_0x47560c['filters']),_0x54efb5);if(_0x4c80b0[_0xb354('0x35')][_0xb354('0x3e')]){_0x4ed14d[_0xb354('0x3f')]=_[_0xb354('0x40')](_0x4ed14d[_0xb354('0x3f')],{'$or':_[_0xb354('0x31')](_0x54efb5,function(_0x431084){if(_0x431084['type']!=='VIRTUAL'){var _0x14e2ce={};_0x14e2ce[_0x431084[_0xb354('0x2e')]]={'$like':'%'+_0x4c80b0[_0xb354('0x35')]['filter']+'%'};return _0x14e2ce;}})});}_0x4ed14d=_[_0xb354('0x40')]({},_0x4ed14d,_0x4c80b0[_0xb354('0x41')]);var _0x4112c6={'where':_0x4ed14d['where']};return db[_0xb354('0x42')]['count'](_0x4112c6)[_0xb354('0x28')](function(_0x2dc64c){_0xa2832e[_0xb354('0x22')]=_0x2dc64c;if(_0x4c80b0['query'][_0xb354('0x43')]){_0x4ed14d[_0xb354('0x44')]=[{'all':!![]}];}return db['Sound']['findAll'](_0x4ed14d);})['then'](function(_0xff11db){_0xa2832e[_0xb354('0x45')]=_0xff11db;return _0xa2832e;})[_0xb354('0x28')](respondWithFilteredResult(_0x14dc6f,_0x4ed14d))[_0xb354('0x46')](handleError(_0x14dc6f,null));};exports[_0xb354('0x47')]=function(_0x62b1c9,_0x4d06d6){var _0x180022={'raw':!![],'where':{'id':_0x62b1c9[_0xb354('0x48')]['id']}},_0x37948a={};_0x37948a['model']=_[_0xb354('0x49')](db[_0xb354('0x42')][_0xb354('0x4a')]);_0x37948a['query']=_[_0xb354('0x49')](_0x62b1c9['query']);_0x37948a[_0xb354('0x36')]=_[_0xb354('0x37')](_0x37948a[_0xb354('0x4b')],_0x37948a[_0xb354('0x35')]);_0x180022['attributes']=_[_0xb354('0x37')](_0x37948a['model'],qs[_0xb354('0x38')](_0x62b1c9[_0xb354('0x35')][_0xb354('0x38')]));_0x180022[_0xb354('0x39')]=_0x180022['attributes'][_0xb354('0x3a')]?_0x180022[_0xb354('0x39')]:_0x37948a['model'];if(_0x62b1c9[_0xb354('0x35')][_0xb354('0x43')]){_0x180022[_0xb354('0x44')]=[{'all':!![]}];}_0x180022=_['merge']({},_0x180022,_0x62b1c9[_0xb354('0x41')]);return db[_0xb354('0x42')][_0xb354('0x4c')](_0x180022)[_0xb354('0x28')](handleEntityNotFound(_0x4d06d6,null))[_0xb354('0x28')](respondWithResult(_0x4d06d6,null))[_0xb354('0x46')](handleError(_0x4d06d6,null));};exports[_0xb354('0x4d')]=function(_0x467362,_0x3af433,_0x7db7be){return db[_0xb354('0x42')][_0xb354('0x4c')]({'where':{'id':_0x467362['params']['id']},'attributes':[_0xb354('0x2e'),_0xb354('0x4e'),'converted_format'],'raw':!![]})['then'](handleEntityNotFound(_0x3af433,null))[_0xb354('0x28')](function(_0x54bcec){if(_0x54bcec){if(!fs['existsSync'](path['join'](config[_0xb354('0x4f')],_0xb354('0x50'),_0x54bcec[_0xb354('0x4e')]+'.'+_0x54bcec[_0xb354('0x51')]))){throw new db[(_0xb354('0x52'))][(_0xb354('0x53'))](_0xb354('0x54'));}return _0x3af433[_0xb354('0x4d')](path['join'](config[_0xb354('0x4f')],_0xb354('0x50'),util[_0xb354('0x55')]('%s.%s',_0x54bcec[_0xb354('0x4e')],_0x54bcec[_0xb354('0x51')])),util[_0xb354('0x55')]('%s.%s',_0x54bcec[_0xb354('0x2e')],_0x54bcec[_0xb354('0x51')]));}return null;})['catch'](handleError(_0x3af433,null));};exports[_0xb354('0x56')]=function(_0x332ec4,_0xbe3e8f,_0x390331){var _0x21a801={'name':path[_0xb354('0x57')](_0x332ec4[_0xb354('0x58')][_0xb354('0x59')],path[_0xb354('0x5a')](_0x332ec4[_0xb354('0x58')][_0xb354('0x59')])),'save_name':path[_0xb354('0x57')](_0x332ec4[_0xb354('0x58')]['filename'],path['extname'](_0x332ec4[_0xb354('0x58')][_0xb354('0x5b')])),'original_format':path['extname'](_0x332ec4['file']['originalname'])[_0xb354('0x5c')](0x1),'converted_format':_0xb354('0x5d')};var _0x3d573e=path['join'](config['root'],'server/files/sounds/original',_0x332ec4['file'][_0xb354('0x5b')]);var _0xf5f582=path[_0xb354('0x5e')](config['root'],_0xb354('0x50'),util[_0xb354('0x55')](_0xb354('0x5f'),path['basename'](_0x332ec4[_0xb354('0x58')][_0xb354('0x5b')],path[_0xb354('0x5a')](_0x332ec4[_0xb354('0x58')]['filename'])),_0x21a801[_0xb354('0x51')]));logger[_0xb354('0x60')]('Sound\x20upload\x20filepath:\x20%s',_0x3d573e);logger[_0xb354('0x60')](_0xb354('0x61'),_0xf5f582);try{fs[_0xb354('0x62')](_0x3d573e,parseInt(_0xb354('0x63'),0x8));var _0x36f1fd=sox[_0xb354('0x64')](_0x3d573e,_0xf5f582,{'sampleRate':0x1f40,'format':_0xb354('0x5d'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x36f1fd['on'](_0xb354('0x2c'),function(_0x58a14e){fs['unlinkSync'](_0x3d573e);_0xbe3e8f[_0xb354('0x1c')](0x1f4)[_0xb354('0x2f')](_0x58a14e);});_0x36f1fd['on'](_0xb354('0x65'),function(_0x3b5080){_0x21a801[_0xb354('0x66')]=isNaN(_0x3b5080[_0xb354('0x67')])?null:_0x3b5080[_0xb354('0x67')]*0x3e8;_0x21a801[_0xb354('0x68')]=isNaN(_0x3b5080['sampleCount'])?null:_0x3b5080[_0xb354('0x69')];_0x21a801[_0xb354('0x6a')]=isNaN(_0x3b5080[_0xb354('0x6b')])?null:_0x3b5080[_0xb354('0x6b')];_0x21a801['original_bitRate']=isNaN(_0x3b5080[_0xb354('0x6c')])?null:_0x3b5080[_0xb354('0x6c')];_0x21a801[_0xb354('0x6d')]=isNaN(_0x3b5080[_0xb354('0x6e')])?null:_0x3b5080[_0xb354('0x6e')];});_0x36f1fd['on'](_0xb354('0x6f'),function(_0x3f2827){_0x21a801['converted_duration']=isNaN(_0x3f2827[_0xb354('0x67')])?null:_0x3f2827[_0xb354('0x67')]*0x3e8;_0x21a801['converted_sampleCount']=isNaN(_0x3f2827[_0xb354('0x69')])?null:_0x3f2827['sampleCount'];_0x21a801['converted_channelCount']=isNaN(_0x3f2827[_0xb354('0x6b')])?null:_0x3f2827[_0xb354('0x6b')];_0x21a801[_0xb354('0x70')]=isNaN(_0x3f2827['bitRate'])?null:_0x3f2827[_0xb354('0x6c')];_0x21a801[_0xb354('0x71')]=isNaN(_0x3f2827['sampleRate'])?null:_0x3f2827['sampleRate'];});_0x36f1fd['on'](_0xb354('0x1d'),function(){fs[_0xb354('0x62')](_0xf5f582,parseInt(_0xb354('0x63'),0x8));return db[_0xb354('0x42')]['create'](_0x21a801)['then'](function(_0x2089b6){var _0x3c4d20={'role':_0x332ec4['body']['role'],'userProfileId':_0x332ec4[_0xb354('0x72')][_0xb354('0x73')]};if(!_0x3c4d20)throw new Error(_0xb354('0x74'));if(_0x3c4d20[_0xb354('0x75')]===_0xb354('0x76')){var _0x1dbf07=_0x2089b6[_0xb354('0x77')]({'plain':!![]});return db[_0xb354('0x78')][_0xb354('0x4c')]({'where':{'name':_0xb354('0x2a'),'userProfileId':_0x3c4d20['userProfileId']},'raw':!![]})['then'](function(_0x3721bd){if(_0x3721bd&&_0x3721bd[_0xb354('0x79')]===0x0){return db[_0xb354('0x2b')][_0xb354('0x56')]({'name':_0x1dbf07[_0xb354('0x2e')],'resourceId':_0x1dbf07['id'],'type':_0x3721bd[_0xb354('0x2e')],'sectionId':_0x3721bd['id']},{})['then'](function(){return _0x2089b6;});}else{return _0x2089b6;}})[_0xb354('0x46')](function(_0x6817d0){logger[_0xb354('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x6817d0);throw _0x6817d0;});}return _0x2089b6;})[_0xb354('0x28')](respondWithResult(_0xbe3e8f,null))[_0xb354('0x46')](handleError(_0xbe3e8f,null));});_0x36f1fd['start']();}catch(_0x31c17d){_0xbe3e8f[_0xb354('0x1c')](0x1f4)['send'](_0x31c17d);}};exports[_0xb354('0x27')]=function(_0x9cdf02,_0x43dc6c,_0x328c5c){return db[_0xb354('0x42')][_0xb354('0x4c')]({'where':{'id':_0x9cdf02[_0xb354('0x48')]['id']}})[_0xb354('0x28')](handleEntityNotFound(_0x43dc6c,null))[_0xb354('0x28')](saveUpdates(_[_0xb354('0x7a')](_0x9cdf02[_0xb354('0x72')],['name',_0xb354('0x7b')]),null))['then'](respondWithResult(_0x43dc6c,null))[_0xb354('0x46')](handleError(_0x43dc6c,null));};exports[_0xb354('0x7c')]=function(_0x1ae5ac,_0x39c750,_0x488228){return db[_0xb354('0x42')][_0xb354('0x4c')]({'where':{'id':_0x1ae5ac['params']['id']}})['then'](function(_0xb511f6){if(_0xb511f6){return _0xb511f6['destroy']();}})[_0xb354('0x28')](function(_0x5a124b){var _0x1d8e2b=path[_0xb354('0x5e')](config[_0xb354('0x4f')],_0xb354('0x7d'),util[_0xb354('0x55')]('%s.%s',_0x5a124b['save_name'],_0x5a124b[_0xb354('0x7e')]));var _0x8911b3=path[_0xb354('0x5e')](config[_0xb354('0x4f')],'server/files/sounds/converted',util['format'](_0xb354('0x5f'),_0x5a124b['save_name'],_0x5a124b[_0xb354('0x51')]));fs[_0xb354('0x7f')](_0x1d8e2b);fs[_0xb354('0x7f')](_0x8911b3);return _0x5a124b;})[_0xb354('0x28')](function(_0x564d8f){if(_0x564d8f){return _0x39c750[_0xb354('0x1c')](0xcc)['end']();}})[_0xb354('0x28')](handleEntityNotFound(_0x39c750,null))[_0xb354('0x46')](handleError(_0x39c750,null));}; \ No newline at end of file +var _0xcd05=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','update','destroy','then','get','Sounds','UserProfileResource','end','name','index','Sound','type','map','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','include','rows','show','params','rawAttributes','options','find','catch','download','save_name','join','root','server/files/sounds/converted','ValidationError','Sound\x20not\x20found','format','%s.%s','converted_format','create','basename','file','originalname','filename','extname','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','wav','error','unlinkSync','send','src','original_duration','duration','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_channelCount','converted_bitRate','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','delete','original_format','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv'];(function(_0x4e65e5,_0x54b75c){var _0x67bc9c=function(_0x3961c6){while(--_0x3961c6){_0x4e65e5['push'](_0x4e65e5['shift']());}};_0x67bc9c(++_0x54b75c);}(_0xcd05,0x1cb));var _0x5cd0=function(_0x26d6d9,_0x431cb8){_0x26d6d9=_0x26d6d9-0x0;var _0x1b4875=_0xcd05[_0x26d6d9];return _0x1b4875;};'use strict';var emlformat=require(_0x5cd0('0x0'));var rimraf=require(_0x5cd0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5cd0('0x2'));var rp=require(_0x5cd0('0x3'));var moment=require('moment');var BPromise=require(_0x5cd0('0x4'));var Mustache=require(_0x5cd0('0x5'));var util=require('util');var path=require(_0x5cd0('0x6'));var sox=require(_0x5cd0('0x7'));var csv=require(_0x5cd0('0x8'));var ejs=require(_0x5cd0('0x9'));var fs=require('fs');var fs_extra=require(_0x5cd0('0xa'));var _=require(_0x5cd0('0xb'));var squel=require(_0x5cd0('0xc'));var crypto=require(_0x5cd0('0xd'));var jsforce=require(_0x5cd0('0xe'));var deskjs=require(_0x5cd0('0xf'));var toCsv=require(_0x5cd0('0x8'));var querystring=require('querystring');var Papa=require(_0x5cd0('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5cd0('0x11'));var as=require(_0x5cd0('0x12'));var hardwareService=require(_0x5cd0('0x13'));var logger=require(_0x5cd0('0x14'))('api');var utils=require(_0x5cd0('0x15'));var config=require(_0x5cd0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5cd0('0x17'))['db'];function respondWithStatusCode(_0x4d2681,_0x4d1d2f){_0x4d1d2f=_0x4d1d2f||0xcc;return function(_0x183659){if(_0x183659){return _0x4d2681[_0x5cd0('0x18')](_0x4d1d2f);}return _0x4d2681[_0x5cd0('0x19')](_0x4d1d2f)['end']();};}function respondWithResult(_0x5b0e96,_0x2b4485){_0x2b4485=_0x2b4485||0xc8;return function(_0x42b0b8){if(_0x42b0b8){return _0x5b0e96[_0x5cd0('0x19')](_0x2b4485)[_0x5cd0('0x1a')](_0x42b0b8);}};}function respondWithFilteredResult(_0x187baf,_0x3f920f){return function(_0x1c207d){if(_0x1c207d){var _0x502861=typeof _0x3f920f[_0x5cd0('0x1b')]===_0x5cd0('0x1c')&&typeof _0x3f920f[_0x5cd0('0x1d')]===_0x5cd0('0x1c');var _0xe352d0=_0x1c207d['count'];var _0x362bc8=_0x502861?0x0:_0x3f920f[_0x5cd0('0x1b')];var _0x212e36=_0x502861?_0x1c207d[_0x5cd0('0x1e')]:_0x3f920f[_0x5cd0('0x1b')]+_0x3f920f[_0x5cd0('0x1d')];var _0x319d36;if(_0x212e36>=_0xe352d0){_0x212e36=_0xe352d0;_0x319d36=0xc8;}else{_0x319d36=0xce;}_0x187baf[_0x5cd0('0x19')](_0x319d36);return _0x187baf[_0x5cd0('0x1f')]('Content-Range',_0x362bc8+'-'+_0x212e36+'/'+_0xe352d0)[_0x5cd0('0x1a')](_0x1c207d);}return null;};}function patchUpdates(_0xc8dd90){return function(_0xda351f){try{jsonpatch['apply'](_0xda351f,_0xc8dd90,!![]);}catch(_0x9c3a3c){return BPromise['reject'](_0x9c3a3c);}return _0xda351f['save']();};}function saveUpdates(_0x1d103b,_0x5d4bfb){return function(_0x424122){if(_0x424122){return _0x424122[_0x5cd0('0x20')](_0x1d103b)['then'](function(_0xf32766){return _0xf32766;});}return null;};}function removeEntity(_0x5bf1cb,_0x4ed0d4){return function(_0x365dbe){if(_0x365dbe){return _0x365dbe[_0x5cd0('0x21')]()[_0x5cd0('0x22')](function(){var _0x519eb3=_0x365dbe[_0x5cd0('0x23')]({'plain':!![]});var _0x10e180=_0x5cd0('0x24');return db[_0x5cd0('0x25')][_0x5cd0('0x21')]({'where':{'type':_0x10e180,'resourceId':_0x519eb3['id']}})[_0x5cd0('0x22')](function(){return _0x365dbe;});})[_0x5cd0('0x22')](function(){_0x5bf1cb['status'](0xcc)[_0x5cd0('0x26')]();});}};}function handleEntityNotFound(_0x2619f6,_0x30a83c){return function(_0x2ec2d6){if(!_0x2ec2d6){_0x2619f6[_0x5cd0('0x18')](0x194);}return _0x2ec2d6;};}function handleError(_0x58e36c,_0x171c26){_0x171c26=_0x171c26||0x1f4;return function(_0x31fa94){logger['error'](_0x31fa94['stack']);if(_0x31fa94[_0x5cd0('0x27')]){delete _0x31fa94[_0x5cd0('0x27')];}_0x58e36c['status'](_0x171c26)['send'](_0x31fa94);};}exports[_0x5cd0('0x28')]=function(_0x6bdd5f,_0x5ca9d4){var _0x25acf1={},_0x542429={},_0x58414d={'count':0x0,'rows':[]};var _0x4d6ebb=_['map'](db[_0x5cd0('0x29')]['rawAttributes'],function(_0x22b702){return{'name':_0x22b702['fieldName'],'type':_0x22b702[_0x5cd0('0x2a')]['key']};});_0x542429['model']=_[_0x5cd0('0x2b')](_0x4d6ebb,'name');_0x542429[_0x5cd0('0x2c')]=_[_0x5cd0('0x2d')](_0x6bdd5f[_0x5cd0('0x2c')]);_0x542429['filters']=_[_0x5cd0('0x2e')](_0x542429['model'],_0x542429[_0x5cd0('0x2c')]);_0x25acf1[_0x5cd0('0x2f')]=_[_0x5cd0('0x2e')](_0x542429[_0x5cd0('0x30')],qs[_0x5cd0('0x31')](_0x6bdd5f['query'][_0x5cd0('0x31')]));_0x25acf1['attributes']=_0x25acf1[_0x5cd0('0x2f')][_0x5cd0('0x32')]?_0x25acf1[_0x5cd0('0x2f')]:_0x542429['model'];if(!_0x6bdd5f[_0x5cd0('0x2c')][_0x5cd0('0x33')](_0x5cd0('0x34'))){_0x25acf1['limit']=qs[_0x5cd0('0x1d')](_0x6bdd5f[_0x5cd0('0x2c')]['limit']);_0x25acf1['offset']=qs[_0x5cd0('0x1b')](_0x6bdd5f[_0x5cd0('0x2c')][_0x5cd0('0x1b')]);}_0x25acf1[_0x5cd0('0x35')]=qs[_0x5cd0('0x36')](_0x6bdd5f[_0x5cd0('0x2c')][_0x5cd0('0x36')]);_0x25acf1[_0x5cd0('0x37')]=qs[_0x5cd0('0x38')](_[_0x5cd0('0x39')](_0x6bdd5f[_0x5cd0('0x2c')],_0x542429[_0x5cd0('0x38')]),_0x4d6ebb);if(_0x6bdd5f[_0x5cd0('0x2c')][_0x5cd0('0x3a')]){_0x25acf1['where']=_[_0x5cd0('0x3b')](_0x25acf1[_0x5cd0('0x37')],{'$or':_[_0x5cd0('0x2b')](_0x4d6ebb,function(_0x111172){if(_0x111172['type']!=='VIRTUAL'){var _0x1f0774={};_0x1f0774[_0x111172['name']]={'$like':'%'+_0x6bdd5f[_0x5cd0('0x2c')][_0x5cd0('0x3a')]+'%'};return _0x1f0774;}})});}_0x25acf1=_['merge']({},_0x25acf1,_0x6bdd5f['options']);var _0xec9d1e={'where':_0x25acf1['where']};return db[_0x5cd0('0x29')][_0x5cd0('0x1e')](_0xec9d1e)['then'](function(_0x889615){_0x58414d[_0x5cd0('0x1e')]=_0x889615;if(_0x6bdd5f['query'][_0x5cd0('0x3c')]){_0x25acf1[_0x5cd0('0x3d')]=[{'all':!![]}];}return db['Sound']['findAll'](_0x25acf1);})[_0x5cd0('0x22')](function(_0x49bb3c){_0x58414d[_0x5cd0('0x3e')]=_0x49bb3c;return _0x58414d;})[_0x5cd0('0x22')](respondWithFilteredResult(_0x5ca9d4,_0x25acf1))['catch'](handleError(_0x5ca9d4,null));};exports[_0x5cd0('0x3f')]=function(_0x68bee7,_0x3ea629){var _0x59129c={'raw':!![],'where':{'id':_0x68bee7[_0x5cd0('0x40')]['id']}},_0x31073c={};_0x31073c[_0x5cd0('0x30')]=_[_0x5cd0('0x2d')](db[_0x5cd0('0x29')][_0x5cd0('0x41')]);_0x31073c[_0x5cd0('0x2c')]=_['keys'](_0x68bee7['query']);_0x31073c['filters']=_[_0x5cd0('0x2e')](_0x31073c['model'],_0x31073c[_0x5cd0('0x2c')]);_0x59129c['attributes']=_[_0x5cd0('0x2e')](_0x31073c['model'],qs[_0x5cd0('0x31')](_0x68bee7[_0x5cd0('0x2c')]['fields']));_0x59129c[_0x5cd0('0x2f')]=_0x59129c['attributes'][_0x5cd0('0x32')]?_0x59129c[_0x5cd0('0x2f')]:_0x31073c['model'];if(_0x68bee7[_0x5cd0('0x2c')]['includeAll']){_0x59129c[_0x5cd0('0x3d')]=[{'all':!![]}];}_0x59129c=_['merge']({},_0x59129c,_0x68bee7[_0x5cd0('0x42')]);return db[_0x5cd0('0x29')][_0x5cd0('0x43')](_0x59129c)['then'](handleEntityNotFound(_0x3ea629,null))[_0x5cd0('0x22')](respondWithResult(_0x3ea629,null))[_0x5cd0('0x44')](handleError(_0x3ea629,null));};exports[_0x5cd0('0x45')]=function(_0x35cc5d,_0x3879a1,_0x30d153){return db[_0x5cd0('0x29')][_0x5cd0('0x43')]({'where':{'id':_0x35cc5d['params']['id']},'attributes':[_0x5cd0('0x27'),_0x5cd0('0x46'),'converted_format'],'raw':!![]})[_0x5cd0('0x22')](handleEntityNotFound(_0x3879a1,null))[_0x5cd0('0x22')](function(_0x5a4e21){if(_0x5a4e21){if(!fs['existsSync'](path[_0x5cd0('0x47')](config[_0x5cd0('0x48')],_0x5cd0('0x49'),_0x5a4e21['save_name']+'.'+_0x5a4e21['converted_format']))){throw new db['Sequelize'][(_0x5cd0('0x4a'))](_0x5cd0('0x4b'));}return _0x3879a1['download'](path[_0x5cd0('0x47')](config['root'],_0x5cd0('0x49'),util[_0x5cd0('0x4c')](_0x5cd0('0x4d'),_0x5a4e21['save_name'],_0x5a4e21['converted_format'])),util[_0x5cd0('0x4c')](_0x5cd0('0x4d'),_0x5a4e21[_0x5cd0('0x27')],_0x5a4e21[_0x5cd0('0x4e')]));}return null;})[_0x5cd0('0x44')](handleError(_0x3879a1,null));};exports[_0x5cd0('0x4f')]=function(_0x4db521,_0x1e42c1,_0x2b9c60){var _0x5d742b={'name':path[_0x5cd0('0x50')](_0x4db521[_0x5cd0('0x51')][_0x5cd0('0x52')],path['extname'](_0x4db521['file'][_0x5cd0('0x52')])),'save_name':path[_0x5cd0('0x50')](_0x4db521['file'][_0x5cd0('0x53')],path[_0x5cd0('0x54')](_0x4db521[_0x5cd0('0x51')][_0x5cd0('0x53')])),'original_format':path[_0x5cd0('0x54')](_0x4db521[_0x5cd0('0x51')][_0x5cd0('0x52')])['substring'](0x1),'converted_format':'wav'};var _0x41fd11=path['join'](config[_0x5cd0('0x48')],_0x5cd0('0x55'),_0x4db521[_0x5cd0('0x51')][_0x5cd0('0x53')]);var _0x5522e5=path['join'](config['root'],_0x5cd0('0x49'),util[_0x5cd0('0x4c')](_0x5cd0('0x4d'),path[_0x5cd0('0x50')](_0x4db521['file'][_0x5cd0('0x53')],path[_0x5cd0('0x54')](_0x4db521[_0x5cd0('0x51')]['filename'])),_0x5d742b[_0x5cd0('0x4e')]));logger[_0x5cd0('0x56')](_0x5cd0('0x57'),_0x41fd11);logger[_0x5cd0('0x56')](_0x5cd0('0x58'),_0x5522e5);try{fs[_0x5cd0('0x59')](_0x41fd11,parseInt(_0x5cd0('0x5a'),0x8));var _0x6edbf2=sox['transcode'](_0x41fd11,_0x5522e5,{'sampleRate':0x1f40,'format':_0x5cd0('0x5b'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x6edbf2['on'](_0x5cd0('0x5c'),function(_0x453211){fs[_0x5cd0('0x5d')](_0x41fd11);_0x1e42c1['status'](0x1f4)[_0x5cd0('0x5e')](_0x453211);});_0x6edbf2['on'](_0x5cd0('0x5f'),function(_0x2e0280){_0x5d742b[_0x5cd0('0x60')]=isNaN(_0x2e0280[_0x5cd0('0x61')])?null:_0x2e0280[_0x5cd0('0x61')]*0x3e8;_0x5d742b['original_sampleCount']=isNaN(_0x2e0280[_0x5cd0('0x62')])?null:_0x2e0280[_0x5cd0('0x62')];_0x5d742b[_0x5cd0('0x63')]=isNaN(_0x2e0280[_0x5cd0('0x64')])?null:_0x2e0280[_0x5cd0('0x64')];_0x5d742b['original_bitRate']=isNaN(_0x2e0280[_0x5cd0('0x65')])?null:_0x2e0280[_0x5cd0('0x65')];_0x5d742b[_0x5cd0('0x66')]=isNaN(_0x2e0280[_0x5cd0('0x67')])?null:_0x2e0280[_0x5cd0('0x67')];});_0x6edbf2['on'](_0x5cd0('0x68'),function(_0x20fdbb){_0x5d742b['converted_duration']=isNaN(_0x20fdbb[_0x5cd0('0x61')])?null:_0x20fdbb[_0x5cd0('0x61')]*0x3e8;_0x5d742b[_0x5cd0('0x69')]=isNaN(_0x20fdbb[_0x5cd0('0x62')])?null:_0x20fdbb[_0x5cd0('0x62')];_0x5d742b[_0x5cd0('0x6a')]=isNaN(_0x20fdbb[_0x5cd0('0x64')])?null:_0x20fdbb[_0x5cd0('0x64')];_0x5d742b[_0x5cd0('0x6b')]=isNaN(_0x20fdbb['bitRate'])?null:_0x20fdbb[_0x5cd0('0x65')];_0x5d742b['converted_sampleRate']=isNaN(_0x20fdbb[_0x5cd0('0x67')])?null:_0x20fdbb[_0x5cd0('0x67')];});_0x6edbf2['on'](_0x5cd0('0x26'),function(){fs[_0x5cd0('0x59')](_0x5522e5,parseInt(_0x5cd0('0x5a'),0x8));return db[_0x5cd0('0x29')][_0x5cd0('0x4f')](_0x5d742b)['then'](function(_0x491829){var _0x556f41={'role':_0x4db521[_0x5cd0('0x6c')]['role'],'userProfileId':_0x4db521[_0x5cd0('0x6c')]['userProfileId']};if(!_0x556f41)throw new Error(_0x5cd0('0x6d'));if(_0x556f41[_0x5cd0('0x6e')]===_0x5cd0('0x6f')){var _0x3c074d=_0x491829[_0x5cd0('0x23')]({'plain':!![]});return db[_0x5cd0('0x70')][_0x5cd0('0x43')]({'where':{'name':'Sounds','userProfileId':_0x556f41[_0x5cd0('0x71')]},'raw':!![]})['then'](function(_0x106026){if(_0x106026&&_0x106026['autoAssociation']===0x0){return db[_0x5cd0('0x25')]['create']({'name':_0x3c074d[_0x5cd0('0x27')],'resourceId':_0x3c074d['id'],'type':_0x106026['name'],'sectionId':_0x106026['id']},{})[_0x5cd0('0x22')](function(){return _0x491829;});}else{return _0x491829;}})[_0x5cd0('0x44')](function(_0x13256c){logger[_0x5cd0('0x5c')](_0x5cd0('0x72'),_0x13256c);throw _0x13256c;});}return _0x491829;})[_0x5cd0('0x22')](respondWithResult(_0x1e42c1,null))[_0x5cd0('0x44')](handleError(_0x1e42c1,null));});_0x6edbf2['start']();}catch(_0x47ec5a){_0x1e42c1[_0x5cd0('0x19')](0x1f4)[_0x5cd0('0x5e')](_0x47ec5a);}};exports[_0x5cd0('0x20')]=function(_0x251467,_0x5e3ade,_0x547303){return db[_0x5cd0('0x29')][_0x5cd0('0x43')]({'where':{'id':_0x251467[_0x5cd0('0x40')]['id']}})[_0x5cd0('0x22')](handleEntityNotFound(_0x5e3ade,null))[_0x5cd0('0x22')](saveUpdates(_[_0x5cd0('0x39')](_0x251467[_0x5cd0('0x6c')],[_0x5cd0('0x27'),'description']),null))[_0x5cd0('0x22')](respondWithResult(_0x5e3ade,null))[_0x5cd0('0x44')](handleError(_0x5e3ade,null));};exports[_0x5cd0('0x73')]=function(_0x41336c,_0x44c5a2,_0x4e615e){return db[_0x5cd0('0x29')][_0x5cd0('0x43')]({'where':{'id':_0x41336c[_0x5cd0('0x40')]['id']}})['then'](function(_0x2f08a6){if(_0x2f08a6){return _0x2f08a6[_0x5cd0('0x21')]();}})[_0x5cd0('0x22')](function(_0x2ac9e7){var _0x116a64=path[_0x5cd0('0x47')](config['root'],'server/files/sounds/original',util[_0x5cd0('0x4c')]('%s.%s',_0x2ac9e7[_0x5cd0('0x46')],_0x2ac9e7[_0x5cd0('0x74')]));var _0x544573=path[_0x5cd0('0x47')](config[_0x5cd0('0x48')],_0x5cd0('0x49'),util['format']('%s.%s',_0x2ac9e7['save_name'],_0x2ac9e7[_0x5cd0('0x4e')]));fs[_0x5cd0('0x5d')](_0x116a64);fs[_0x5cd0('0x5d')](_0x544573);return _0x2ac9e7;})['then'](function(_0x2fcdf6){if(_0x2fcdf6){return _0x44c5a2[_0x5cd0('0x19')](0xcc)[_0x5cd0('0x26')]();}})[_0x5cd0('0x22')](handleEntityNotFound(_0x44c5a2,null))[_0x5cd0('0x44')](handleError(_0x44c5a2,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 31d809b..7bf5e8f 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 _0x0b4d=['moment','bluebird','../../config/environment','./sound.attributes','exports','Sound','lodash','util'];(function(_0x22386f,_0x38d739){var _0x20bade=function(_0x5dee70){while(--_0x5dee70){_0x22386f['push'](_0x22386f['shift']());}};_0x20bade(++_0x38d739);}(_0x0b4d,0x1be));var _0xd0b4=function(_0x1183da,_0x1534a4){_0x1183da=_0x1183da-0x0;var _0x18b71e=_0x0b4d[_0x1183da];return _0x18b71e;};'use strict';var _=require(_0xd0b4('0x0'));var util=require(_0xd0b4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd0b4('0x2'));var BPromise=require(_0xd0b4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd0b4('0x4'));var attributes=require(_0xd0b4('0x5'));module[_0xd0b4('0x6')]=function(_0x5325fd,_0x51d569){return _0x5325fd['define'](_0xd0b4('0x7'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc9a7=['moment','request-promise','path','rimraf','./sound.attributes','exports','define','lodash','util','../../config/logger'];(function(_0x4a65ca,_0x1a3208){var _0xa01c97=function(_0x4a9e3b){while(--_0x4a9e3b){_0x4a65ca['push'](_0x4a65ca['shift']());}};_0xa01c97(++_0x1a3208);}(_0xc9a7,0x147));var _0x7c9a=function(_0x5d36b1,_0x243fac){_0x5d36b1=_0x5d36b1-0x0;var _0x43fbe3=_0xc9a7[_0x5d36b1];return _0x43fbe3;};'use strict';var _=require(_0x7c9a('0x0'));var util=require(_0x7c9a('0x1'));var logger=require(_0x7c9a('0x2'))('api');var moment=require(_0x7c9a('0x3'));var BPromise=require('bluebird');var rp=require(_0x7c9a('0x4'));var fs=require('fs');var path=require(_0x7c9a('0x5'));var rimraf=require(_0x7c9a('0x6'));var config=require('../../config/environment');var attributes=require(_0x7c9a('0x7'));module[_0x7c9a('0x8')]=function(_0x1ae0ec,_0x27790f){return _0x1ae0ec[_0x7c9a('0x9')]('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 ccc00c7..14b517c 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 _0x3135=['Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowSound','Sound','options','raw','where','attributes','include','map','model','lodash','util','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x138279,_0x630c35){var _0x36e90d=function(_0x586524){while(--_0x586524){_0x138279['push'](_0x138279['shift']());}};_0x36e90d(++_0x630c35);}(_0x3135,0x187));var _0x5313=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3135[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x5313('0x0'));var util=require(_0x5313('0x1'));var moment=require('moment');var BPromise=require(_0x5313('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5313('0x3'));var db=require(_0x5313('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x5313('0x5'));var jayson=require(_0x5313('0x6'));var client=jayson[_0x5313('0x7')][_0x5313('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x762e2e,_0x39c9a0,_0x38c170){return new BPromise(function(_0xf8c790,_0x317248){return client[_0x5313('0x9')](_0x762e2e,_0x38c170)[_0x5313('0xa')](function(_0x5ae421){logger[_0x5313('0xb')](_0x5313('0xc'),_0x39c9a0,'request\x20sent');logger[_0x5313('0xd')](_0x5313('0xe'),_0x39c9a0,_0x5313('0xf'),JSON[_0x5313('0x10')](_0x5ae421));if(_0x5ae421[_0x5313('0x11')]){if(_0x5ae421[_0x5313('0x11')][_0x5313('0x12')]===0x1f4){logger[_0x5313('0x11')](_0x5313('0xc'),_0x39c9a0,_0x5ae421['error'][_0x5313('0x13')]);return _0x317248(_0x5ae421[_0x5313('0x11')]['message']);}logger['error'](_0x5313('0xc'),_0x39c9a0,_0x5ae421[_0x5313('0x11')]['message']);return _0xf8c790(_0x5ae421[_0x5313('0x11')]['message']);}else{logger[_0x5313('0xb')](_0x5313('0xc'),_0x39c9a0,'request\x20sent');_0xf8c790(_0x5ae421[_0x5313('0x14')][_0x5313('0x13')]);}})[_0x5313('0x15')](function(_0x5e53d6){logger['error'](_0x5313('0xc'),_0x39c9a0,_0x5e53d6);_0x317248(_0x5e53d6);});});}exports[_0x5313('0x16')]=function(_0x184744){var _0x22dfc8=this;return new Promise(function(_0x2067b1,_0x5c563c){return db[_0x5313('0x17')]['find']({'raw':_0x184744[_0x5313('0x18')]?_0x184744['options'][_0x5313('0x19')]===undefined?!![]:![]:!![],'where':_0x184744[_0x5313('0x18')]?_0x184744['options'][_0x5313('0x1a')]||null:null,'attributes':_0x184744[_0x5313('0x18')]?_0x184744[_0x5313('0x18')][_0x5313('0x1b')]||null:null,'include':_0x184744[_0x5313('0x18')]?_0x184744[_0x5313('0x18')][_0x5313('0x1c')]?_[_0x5313('0x1d')](_0x184744[_0x5313('0x18')]['include'],function(_0x19751d){return{'model':db[_0x19751d[_0x5313('0x1e')]],'as':_0x19751d['as'],'attributes':_0x19751d[_0x5313('0x1b')],'include':_0x19751d['include']?_[_0x5313('0x1d')](_0x19751d['include'],function(_0x263471){return{'model':db[_0x263471[_0x5313('0x1e')]],'as':_0x263471['as'],'attributes':_0x263471[_0x5313('0x1b')],'include':_0x263471[_0x5313('0x1c')]?_[_0x5313('0x1d')](_0x263471[_0x5313('0x1c')],function(_0xdeb68e){return{'model':db[_0xdeb68e['model']],'as':_0xdeb68e['as'],'attributes':_0xdeb68e['attributes']};}):[]};}):[]};}):[]:[]})[_0x5313('0xa')](function(_0x3e0f79){logger['info']('ShowSound',_0x184744);logger[_0x5313('0xd')]('ShowSound',_0x184744,JSON[_0x5313('0x10')](_0x3e0f79));_0x2067b1(_0x3e0f79);})[_0x5313('0x15')](function(_0x213ba3){logger[_0x5313('0x11')](_0x5313('0x16'),_0x213ba3['message'],_0x184744);_0x5c563c(_0x22dfc8['error'](0x1f4,_0x213ba3[_0x5313('0x13')]));});});}; \ No newline at end of file +var _0x92e0=['ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','find','options','raw','where','map','include','model','attributes','ShowSound','util','bluebird'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x92e0,0x166));var _0x092e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x92e0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x092e('0x0'));var moment=require('moment');var BPromise=require(_0x092e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x092e('0x2'));var db=require(_0x092e('0x3'))['db'];var utils=require(_0x092e('0x4'));var logger=require('../../config/logger')(_0x092e('0x5'));var config=require('../../config/environment');var jayson=require(_0x092e('0x6'));var client=jayson[_0x092e('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x545bc6,_0xa52f9c,_0x41277a){return new BPromise(function(_0x131812,_0x291528){return client[_0x092e('0x8')](_0x545bc6,_0x41277a)[_0x092e('0x9')](function(_0xbcabe2){logger[_0x092e('0xa')](_0x092e('0xb'),_0xa52f9c,_0x092e('0xc'));logger[_0x092e('0xd')](_0x092e('0xe'),_0xa52f9c,'request\x20sent',JSON[_0x092e('0xf')](_0xbcabe2));if(_0xbcabe2[_0x092e('0x10')]){if(_0xbcabe2['error'][_0x092e('0x11')]===0x1f4){logger['error']('Sound,\x20%s,\x20%s',_0xa52f9c,_0xbcabe2[_0x092e('0x10')][_0x092e('0x12')]);return _0x291528(_0xbcabe2[_0x092e('0x10')][_0x092e('0x12')]);}logger[_0x092e('0x10')](_0x092e('0xb'),_0xa52f9c,_0xbcabe2[_0x092e('0x10')]['message']);return _0x131812(_0xbcabe2[_0x092e('0x10')][_0x092e('0x12')]);}else{logger[_0x092e('0xa')](_0x092e('0xb'),_0xa52f9c,_0x092e('0xc'));_0x131812(_0xbcabe2[_0x092e('0x13')]['message']);}})[_0x092e('0x14')](function(_0x1e4589){logger[_0x092e('0x10')](_0x092e('0xb'),_0xa52f9c,_0x1e4589);_0x291528(_0x1e4589);});});}exports['ShowSound']=function(_0x367db0){var _0x2cb49d=this;return new Promise(function(_0xfef2de,_0x2bc301){return db['Sound'][_0x092e('0x15')]({'raw':_0x367db0['options']?_0x367db0[_0x092e('0x16')][_0x092e('0x17')]===undefined?!![]:![]:!![],'where':_0x367db0['options']?_0x367db0['options'][_0x092e('0x18')]||null:null,'attributes':_0x367db0[_0x092e('0x16')]?_0x367db0[_0x092e('0x16')]['attributes']||null:null,'include':_0x367db0[_0x092e('0x16')]?_0x367db0[_0x092e('0x16')]['include']?_[_0x092e('0x19')](_0x367db0[_0x092e('0x16')][_0x092e('0x1a')],function(_0x32b136){return{'model':db[_0x32b136[_0x092e('0x1b')]],'as':_0x32b136['as'],'attributes':_0x32b136[_0x092e('0x1c')],'include':_0x32b136[_0x092e('0x1a')]?_['map'](_0x32b136['include'],function(_0x152f5d){return{'model':db[_0x152f5d['model']],'as':_0x152f5d['as'],'attributes':_0x152f5d[_0x092e('0x1c')],'include':_0x152f5d[_0x092e('0x1a')]?_[_0x092e('0x19')](_0x152f5d[_0x092e('0x1a')],function(_0x5bfe07){return{'model':db[_0x5bfe07[_0x092e('0x1b')]],'as':_0x5bfe07['as'],'attributes':_0x5bfe07[_0x092e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x092e('0x9')](function(_0xb38be3){logger[_0x092e('0xa')](_0x092e('0x1d'),_0x367db0);logger[_0x092e('0xd')](_0x092e('0x1d'),_0x367db0,JSON[_0x092e('0xf')](_0xb38be3));_0xfef2de(_0xb38be3);})[_0x092e('0x14')](function(_0x3c52fb){logger[_0x092e('0x10')]('ShowSound',_0x3c52fb[_0x092e('0x12')],_0x367db0);_0x2bc301(_0x2cb49d[_0x092e('0x10')](0x1f4,_0x3c52fb[_0x092e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index d95cb0c..34c108d 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8603=['../../components/interaction/service','./squareMessage.controller','isAuthenticated','index','get','/:id','create','put','update','exports','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x786e9,_0x1a029){var _0x1f891b=function(_0x31ad7c){while(--_0x31ad7c){_0x786e9['push'](_0x786e9['shift']());}};_0x1f891b(++_0x1a029);}(_0x8603,0x190));var _0x3860=function(_0x3cab7e,_0x4718bc){_0x3cab7e=_0x3cab7e-0x0;var _0x5b14ea=_0x8603[_0x3cab7e];return _0x5b14ea;};'use strict';var multer=require('multer');var util=require(_0x3860('0x0'));var path=require(_0x3860('0x1'));var timeout=require(_0x3860('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3860('0x3'));var auth=require(_0x3860('0x4'));var interaction=require(_0x3860('0x5'));var config=require('../../config/environment');var controller=require(_0x3860('0x6'));router['get']('/',auth[_0x3860('0x7')](),controller[_0x3860('0x8')]);router[_0x3860('0x9')](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x3860('0xb')]);router[_0x3860('0xc')]('/:id',auth[_0x3860('0x7')](),controller[_0x3860('0xd')]);router['delete'](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['destroy']);module[_0x3860('0xe')]=router; \ No newline at end of file +var _0x4fc2=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','/:id'];(function(_0x2f3947,_0x2ee083){var _0x3e6ab7=function(_0x4057c0){while(--_0x4057c0){_0x2f3947['push'](_0x2f3947['shift']());}};_0x3e6ab7(++_0x2ee083);}(_0x4fc2,0x111));var _0x24fc=function(_0x6751fa,_0x410198){_0x6751fa=_0x6751fa-0x0;var _0x3f24c1=_0x4fc2[_0x6751fa];return _0x3f24c1;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xe')]);router['put'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x10')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x11')]);module[_0x24fc('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index dc19c59..6fe9c99 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 _0xcea3=['medium','ENUM','out','TEXT','sequelize','exports','STRING'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xcea3,0x1e7));var _0x3cea=function(_0x38b541,_0x3494bb){_0x38b541=_0x38b541-0x0;var _0x15accd=_0xcea3[_0x38b541];return _0x15accd;};'use strict';var Sequelize=require(_0x3cea('0x0'));module[_0x3cea('0x1')]={'uniqueid':{'type':Sequelize[_0x3cea('0x2')]},'body':{'type':Sequelize['TEXT'](_0x3cea('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x3cea('0x4')]('in','out'),'defaultValue':_0x3cea('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x3cea('0x2')]},'providerResponse':{'type':Sequelize[_0x3cea('0x6')]}}; \ No newline at end of file +var _0x6b02=['TEXT','medium','ENUM','out','sequelize','exports','STRING'];(function(_0x31697f,_0x4c2b4a){var _0x47b369=function(_0x33dbf8){while(--_0x33dbf8){_0x31697f['push'](_0x31697f['shift']());}};_0x47b369(++_0x4c2b4a);}(_0x6b02,0x90));var _0x26b0=function(_0xc79916,_0x50c372){_0xc79916=_0xc79916-0x0;var _0x4df2ab=_0x6b02[_0xc79916];return _0x4df2ab;};'use strict';var Sequelize=require(_0x26b0('0x0'));module[_0x26b0('0x1')]={'uniqueid':{'type':Sequelize[_0x26b0('0x2')]},'body':{'type':Sequelize[_0x26b0('0x3')](_0x26b0('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x26b0('0x5')]('in',_0x26b0('0x6')),'defaultValue':_0x26b0('0x6'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x26b0('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index fca8a64..daf131d 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 _0x2515=['util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','SquareMessage','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','where','merge','filter','options','include','rows','catch','show','find','create','body','destroy','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2515,0x1c2));var _0x5251=function(_0x223fd2,_0x40b449){_0x223fd2=_0x223fd2-0x0;var _0x5d1701=_0x2515[_0x223fd2];return _0x5d1701;};'use strict';var emlformat=require(_0x5251('0x0'));var rimraf=require(_0x5251('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5251('0x2'));var rp=require(_0x5251('0x3'));var moment=require(_0x5251('0x4'));var BPromise=require(_0x5251('0x5'));var Mustache=require('mustache');var util=require(_0x5251('0x6'));var path=require(_0x5251('0x7'));var sox=require('sox');var csv=require(_0x5251('0x8'));var ejs=require(_0x5251('0x9'));var fs=require('fs');var fs_extra=require(_0x5251('0xa'));var _=require(_0x5251('0xb'));var squel=require(_0x5251('0xc'));var crypto=require(_0x5251('0xd'));var jsforce=require(_0x5251('0xe'));var deskjs=require(_0x5251('0xf'));var toCsv=require(_0x5251('0x8'));var querystring=require(_0x5251('0x10'));var Papa=require(_0x5251('0x11'));var Redis=require(_0x5251('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5251('0x13'));var as=require(_0x5251('0x14'));var hardwareService=require(_0x5251('0x15'));var logger=require('../../config/logger')(_0x5251('0x16'));var utils=require(_0x5251('0x17'));var config=require(_0x5251('0x18'));var licenseUtil=require(_0x5251('0x19'));var db=require(_0x5251('0x1a'))['db'];function respondWithStatusCode(_0x35bcad,_0x32a518){_0x32a518=_0x32a518||0xcc;return function(_0x2d2488){if(_0x2d2488){return _0x35bcad[_0x5251('0x1b')](_0x32a518);}return _0x35bcad[_0x5251('0x1c')](_0x32a518)[_0x5251('0x1d')]();};}function respondWithResult(_0xa0c768,_0xe926ce){_0xe926ce=_0xe926ce||0xc8;return function(_0x37c8cd){if(_0x37c8cd){return _0xa0c768[_0x5251('0x1c')](_0xe926ce)[_0x5251('0x1e')](_0x37c8cd);}};}function respondWithFilteredResult(_0x2fef30,_0x283ca1){return function(_0x1010f7){if(_0x1010f7){var _0x5660a7=typeof _0x283ca1[_0x5251('0x1f')]===_0x5251('0x20')&&typeof _0x283ca1[_0x5251('0x21')]===_0x5251('0x20');var _0x781054=_0x1010f7[_0x5251('0x22')];var _0x3c12d5=_0x5660a7?0x0:_0x283ca1[_0x5251('0x1f')];var _0x382470=_0x5660a7?_0x1010f7[_0x5251('0x22')]:_0x283ca1[_0x5251('0x1f')]+_0x283ca1['limit'];var _0x7c58b0;if(_0x382470>=_0x781054){_0x382470=_0x781054;_0x7c58b0=0xc8;}else{_0x7c58b0=0xce;}_0x2fef30[_0x5251('0x1c')](_0x7c58b0);return _0x2fef30[_0x5251('0x23')](_0x5251('0x24'),_0x3c12d5+'-'+_0x382470+'/'+_0x781054)['json'](_0x1010f7);}return null;};}function patchUpdates(_0x3e7d9d){return function(_0x230c2b){try{jsonpatch[_0x5251('0x25')](_0x230c2b,_0x3e7d9d,!![]);}catch(_0x24b19c){return BPromise[_0x5251('0x26')](_0x24b19c);}return _0x230c2b[_0x5251('0x27')]();};}function saveUpdates(_0x495f8d,_0xf95bc5){return function(_0x4e6fe7){if(_0x4e6fe7){return _0x4e6fe7[_0x5251('0x28')](_0x495f8d)[_0x5251('0x29')](function(_0x323b34){return _0x323b34;});}return null;};}function removeEntity(_0x5596ac,_0x2c5f46){return function(_0x11cff9){if(_0x11cff9){return _0x11cff9['destroy']()[_0x5251('0x29')](function(){_0x5596ac[_0x5251('0x1c')](0xcc)[_0x5251('0x1d')]();});}};}function handleEntityNotFound(_0x2adfc8,_0x2b8e0f){return function(_0x47c659){if(!_0x47c659){_0x2adfc8['sendStatus'](0x194);}return _0x47c659;};}function handleError(_0x1ba533,_0x11aee7){_0x11aee7=_0x11aee7||0x1f4;return function(_0x5bd203){logger[_0x5251('0x2a')](_0x5bd203[_0x5251('0x2b')]);if(_0x5bd203[_0x5251('0x2c')]){delete _0x5bd203[_0x5251('0x2c')];}_0x1ba533[_0x5251('0x1c')](_0x11aee7)['send'](_0x5bd203);};}exports[_0x5251('0x2d')]=function(_0x1713e8,_0x438d02){var _0x4cef03={},_0x19b3ad={},_0xfbe7cd={'count':0x0,'rows':[]};var _0x326d0d=_['map'](db[_0x5251('0x2e')][_0x5251('0x2f')],function(_0x17c450){return{'name':_0x17c450['fieldName'],'type':_0x17c450[_0x5251('0x30')][_0x5251('0x31')]};});_0x19b3ad[_0x5251('0x32')]=_[_0x5251('0x33')](_0x326d0d,'name');_0x19b3ad[_0x5251('0x34')]=_[_0x5251('0x35')](_0x1713e8[_0x5251('0x34')]);_0x19b3ad['filters']=_[_0x5251('0x36')](_0x19b3ad[_0x5251('0x32')],_0x19b3ad[_0x5251('0x34')]);_0x4cef03[_0x5251('0x37')]=_['intersection'](_0x19b3ad[_0x5251('0x32')],qs[_0x5251('0x38')](_0x1713e8[_0x5251('0x34')][_0x5251('0x38')]));_0x4cef03[_0x5251('0x37')]=_0x4cef03[_0x5251('0x37')][_0x5251('0x39')]?_0x4cef03[_0x5251('0x37')]:_0x19b3ad['model'];if(!_0x1713e8[_0x5251('0x34')][_0x5251('0x3a')](_0x5251('0x3b'))){_0x4cef03['limit']=qs[_0x5251('0x21')](_0x1713e8['query']['limit']);_0x4cef03[_0x5251('0x1f')]=qs[_0x5251('0x1f')](_0x1713e8[_0x5251('0x34')][_0x5251('0x1f')]);}_0x4cef03[_0x5251('0x3c')]=qs[_0x5251('0x3d')](_0x1713e8['query'][_0x5251('0x3d')]);_0x4cef03['where']=qs[_0x5251('0x3e')](_['pick'](_0x1713e8[_0x5251('0x34')],_0x19b3ad['filters']),_0x326d0d);if(_0x1713e8[_0x5251('0x34')]['filter']){_0x4cef03[_0x5251('0x3f')]=_[_0x5251('0x40')](_0x4cef03[_0x5251('0x3f')],{'$or':_[_0x5251('0x33')](_0x326d0d,function(_0x1e61cf){if(_0x1e61cf['type']!=='VIRTUAL'){var _0x6cda40={};_0x6cda40[_0x1e61cf[_0x5251('0x2c')]]={'$like':'%'+_0x1713e8[_0x5251('0x34')][_0x5251('0x41')]+'%'};return _0x6cda40;}})});}_0x4cef03=_[_0x5251('0x40')]({},_0x4cef03,_0x1713e8[_0x5251('0x42')]);var _0x2d3d44={'where':_0x4cef03['where']};return db[_0x5251('0x2e')][_0x5251('0x22')](_0x2d3d44)[_0x5251('0x29')](function(_0x5bb327){_0xfbe7cd['count']=_0x5bb327;if(_0x1713e8[_0x5251('0x34')]['includeAll']){_0x4cef03[_0x5251('0x43')]=[{'all':!![]}];}return db['SquareMessage']['findAll'](_0x4cef03);})['then'](function(_0x1ac1aa){_0xfbe7cd[_0x5251('0x44')]=_0x1ac1aa;return _0xfbe7cd;})['then'](respondWithFilteredResult(_0x438d02,_0x4cef03))[_0x5251('0x45')](handleError(_0x438d02,null));};exports[_0x5251('0x46')]=function(_0x3d0526,_0x1fd128){var _0x532d5e={'raw':!![],'where':{'id':_0x3d0526['params']['id']}},_0x30cf1a={};_0x30cf1a[_0x5251('0x32')]=_['keys'](db[_0x5251('0x2e')][_0x5251('0x2f')]);_0x30cf1a[_0x5251('0x34')]=_['keys'](_0x3d0526[_0x5251('0x34')]);_0x30cf1a[_0x5251('0x3e')]=_[_0x5251('0x36')](_0x30cf1a[_0x5251('0x32')],_0x30cf1a[_0x5251('0x34')]);_0x532d5e[_0x5251('0x37')]=_['intersection'](_0x30cf1a['model'],qs[_0x5251('0x38')](_0x3d0526['query'][_0x5251('0x38')]));_0x532d5e[_0x5251('0x37')]=_0x532d5e[_0x5251('0x37')][_0x5251('0x39')]?_0x532d5e[_0x5251('0x37')]:_0x30cf1a[_0x5251('0x32')];if(_0x3d0526[_0x5251('0x34')]['includeAll']){_0x532d5e[_0x5251('0x43')]=[{'all':!![]}];}_0x532d5e=_[_0x5251('0x40')]({},_0x532d5e,_0x3d0526[_0x5251('0x42')]);return db[_0x5251('0x2e')][_0x5251('0x47')](_0x532d5e)[_0x5251('0x29')](handleEntityNotFound(_0x1fd128,null))['then'](respondWithResult(_0x1fd128,null))['catch'](handleError(_0x1fd128,null));};exports[_0x5251('0x48')]=function(_0x366e7f,_0xc983db){return db[_0x5251('0x2e')][_0x5251('0x48')](_0x366e7f['body'],{})['then'](respondWithResult(_0xc983db,0xc9))['catch'](handleError(_0xc983db,null));};exports[_0x5251('0x28')]=function(_0x277163,_0x28fff1){if(_0x277163[_0x5251('0x49')]['id']){delete _0x277163['body']['id'];}return db['SquareMessage'][_0x5251('0x47')]({'where':{'id':_0x277163['params']['id']}})[_0x5251('0x29')](handleEntityNotFound(_0x28fff1,null))['then'](saveUpdates(_0x277163[_0x5251('0x49')],null))['then'](respondWithResult(_0x28fff1,null))[_0x5251('0x45')](handleError(_0x28fff1,null));};exports[_0x5251('0x4a')]=function(_0x422be4,_0x2277f5){return db[_0x5251('0x2e')]['find']({'where':{'id':_0x422be4[_0x5251('0x4b')]['id']}})[_0x5251('0x29')](handleEntityNotFound(_0x2277f5,null))['then'](removeEntity(_0x2277f5,null))['catch'](handleError(_0x2277f5,null));}; \ No newline at end of file +var _0x21ad=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','save','update','then','destroy','error','stack','name','send','index','map','SquareMessage','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','rawAttributes','merge','create','body','find','params','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js'];(function(_0x3bbe6f,_0x218a49){var _0x1acc60=function(_0x25a8f9){while(--_0x25a8f9){_0x3bbe6f['push'](_0x3bbe6f['shift']());}};_0x1acc60(++_0x218a49);}(_0x21ad,0x85));var _0xd21a=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x21ad[_0x24061a];return _0x82054e;};'use strict';var emlformat=require(_0xd21a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd21a('0x1'));var jsonpatch=require(_0xd21a('0x2'));var rp=require(_0xd21a('0x3'));var moment=require('moment');var BPromise=require(_0xd21a('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd21a('0x5'));var sox=require(_0xd21a('0x6'));var csv=require(_0xd21a('0x7'));var ejs=require(_0xd21a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd21a('0x9'));var squel=require(_0xd21a('0xa'));var crypto=require(_0xd21a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd21a('0xc'));var toCsv=require(_0xd21a('0x7'));var querystring=require('querystring');var Papa=require(_0xd21a('0xd'));var Redis=require(_0xd21a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd21a('0xf'));var as=require(_0xd21a('0x10'));var hardwareService=require(_0xd21a('0x11'));var logger=require(_0xd21a('0x12'))(_0xd21a('0x13'));var utils=require(_0xd21a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xd21a('0x15'));var db=require(_0xd21a('0x16'))['db'];function respondWithStatusCode(_0x559f4a,_0x12c44e){_0x12c44e=_0x12c44e||0xcc;return function(_0x455ba0){if(_0x455ba0){return _0x559f4a[_0xd21a('0x17')](_0x12c44e);}return _0x559f4a[_0xd21a('0x18')](_0x12c44e)[_0xd21a('0x19')]();};}function respondWithResult(_0xd4ff0e,_0x445cd9){_0x445cd9=_0x445cd9||0xc8;return function(_0x4ee3b4){if(_0x4ee3b4){return _0xd4ff0e['status'](_0x445cd9)[_0xd21a('0x1a')](_0x4ee3b4);}};}function respondWithFilteredResult(_0x20d9a6,_0x216be9){return function(_0x2d0095){if(_0x2d0095){var _0x51a6b5=typeof _0x216be9[_0xd21a('0x1b')]===_0xd21a('0x1c')&&typeof _0x216be9[_0xd21a('0x1d')]===_0xd21a('0x1c');var _0x1b88ff=_0x2d0095[_0xd21a('0x1e')];var _0x357e71=_0x51a6b5?0x0:_0x216be9[_0xd21a('0x1b')];var _0x4c3d6d=_0x51a6b5?_0x2d0095[_0xd21a('0x1e')]:_0x216be9[_0xd21a('0x1b')]+_0x216be9['limit'];var _0x2a18bb;if(_0x4c3d6d>=_0x1b88ff){_0x4c3d6d=_0x1b88ff;_0x2a18bb=0xc8;}else{_0x2a18bb=0xce;}_0x20d9a6[_0xd21a('0x18')](_0x2a18bb);return _0x20d9a6['set']('Content-Range',_0x357e71+'-'+_0x4c3d6d+'/'+_0x1b88ff)[_0xd21a('0x1a')](_0x2d0095);}return null;};}function patchUpdates(_0x905fd4){return function(_0x186ed0){try{jsonpatch[_0xd21a('0x1f')](_0x186ed0,_0x905fd4,!![]);}catch(_0x1c9734){return BPromise['reject'](_0x1c9734);}return _0x186ed0[_0xd21a('0x20')]();};}function saveUpdates(_0x1d0805,_0x192424){return function(_0x7f9b2){if(_0x7f9b2){return _0x7f9b2[_0xd21a('0x21')](_0x1d0805)[_0xd21a('0x22')](function(_0x16ceb3){return _0x16ceb3;});}return null;};}function removeEntity(_0x3e41b8,_0x14e397){return function(_0x4d4a64){if(_0x4d4a64){return _0x4d4a64[_0xd21a('0x23')]()[_0xd21a('0x22')](function(){_0x3e41b8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d3dc5,_0xa0bde7){return function(_0x2cfcff){if(!_0x2cfcff){_0x5d3dc5[_0xd21a('0x17')](0x194);}return _0x2cfcff;};}function handleError(_0x579aea,_0x29121a){_0x29121a=_0x29121a||0x1f4;return function(_0x27c022){logger[_0xd21a('0x24')](_0x27c022[_0xd21a('0x25')]);if(_0x27c022[_0xd21a('0x26')]){delete _0x27c022[_0xd21a('0x26')];}_0x579aea[_0xd21a('0x18')](_0x29121a)[_0xd21a('0x27')](_0x27c022);};}exports[_0xd21a('0x28')]=function(_0x1208e2,_0x4d7a16){var _0x4d517c={},_0x591b9a={},_0x5710e0={'count':0x0,'rows':[]};var _0x228a2f=_[_0xd21a('0x29')](db[_0xd21a('0x2a')]['rawAttributes'],function(_0x2489c4){return{'name':_0x2489c4[_0xd21a('0x2b')],'type':_0x2489c4[_0xd21a('0x2c')][_0xd21a('0x2d')]};});_0x591b9a[_0xd21a('0x2e')]=_[_0xd21a('0x29')](_0x228a2f,_0xd21a('0x26'));_0x591b9a[_0xd21a('0x2f')]=_[_0xd21a('0x30')](_0x1208e2[_0xd21a('0x2f')]);_0x591b9a['filters']=_[_0xd21a('0x31')](_0x591b9a[_0xd21a('0x2e')],_0x591b9a[_0xd21a('0x2f')]);_0x4d517c[_0xd21a('0x32')]=_['intersection'](_0x591b9a['model'],qs[_0xd21a('0x33')](_0x1208e2[_0xd21a('0x2f')][_0xd21a('0x33')]));_0x4d517c[_0xd21a('0x32')]=_0x4d517c['attributes'][_0xd21a('0x34')]?_0x4d517c['attributes']:_0x591b9a[_0xd21a('0x2e')];if(!_0x1208e2[_0xd21a('0x2f')][_0xd21a('0x35')]('nolimit')){_0x4d517c[_0xd21a('0x1d')]=qs['limit'](_0x1208e2[_0xd21a('0x2f')][_0xd21a('0x1d')]);_0x4d517c['offset']=qs[_0xd21a('0x1b')](_0x1208e2[_0xd21a('0x2f')][_0xd21a('0x1b')]);}_0x4d517c[_0xd21a('0x36')]=qs[_0xd21a('0x37')](_0x1208e2['query'][_0xd21a('0x37')]);_0x4d517c[_0xd21a('0x38')]=qs[_0xd21a('0x39')](_[_0xd21a('0x3a')](_0x1208e2[_0xd21a('0x2f')],_0x591b9a[_0xd21a('0x39')]),_0x228a2f);if(_0x1208e2[_0xd21a('0x2f')][_0xd21a('0x3b')]){_0x4d517c[_0xd21a('0x38')]=_['merge'](_0x4d517c[_0xd21a('0x38')],{'$or':_[_0xd21a('0x29')](_0x228a2f,function(_0x846f4b){if(_0x846f4b[_0xd21a('0x2c')]!==_0xd21a('0x3c')){var _0x2c7cfe={};_0x2c7cfe[_0x846f4b['name']]={'$like':'%'+_0x1208e2[_0xd21a('0x2f')][_0xd21a('0x3b')]+'%'};return _0x2c7cfe;}})});}_0x4d517c=_['merge']({},_0x4d517c,_0x1208e2[_0xd21a('0x3d')]);var _0xc8c707={'where':_0x4d517c[_0xd21a('0x38')]};return db[_0xd21a('0x2a')][_0xd21a('0x1e')](_0xc8c707)['then'](function(_0x261204){_0x5710e0[_0xd21a('0x1e')]=_0x261204;if(_0x1208e2[_0xd21a('0x2f')][_0xd21a('0x3e')]){_0x4d517c[_0xd21a('0x3f')]=[{'all':!![]}];}return db[_0xd21a('0x2a')][_0xd21a('0x40')](_0x4d517c);})[_0xd21a('0x22')](function(_0x46269d){_0x5710e0[_0xd21a('0x41')]=_0x46269d;return _0x5710e0;})[_0xd21a('0x22')](respondWithFilteredResult(_0x4d7a16,_0x4d517c))[_0xd21a('0x42')](handleError(_0x4d7a16,null));};exports['show']=function(_0x5a064c,_0xfcd393){var _0x5cf655={'raw':!![],'where':{'id':_0x5a064c['params']['id']}},_0x55e178={};_0x55e178[_0xd21a('0x2e')]=_[_0xd21a('0x30')](db['SquareMessage'][_0xd21a('0x43')]);_0x55e178[_0xd21a('0x2f')]=_[_0xd21a('0x30')](_0x5a064c[_0xd21a('0x2f')]);_0x55e178[_0xd21a('0x39')]=_[_0xd21a('0x31')](_0x55e178[_0xd21a('0x2e')],_0x55e178['query']);_0x5cf655[_0xd21a('0x32')]=_['intersection'](_0x55e178[_0xd21a('0x2e')],qs['fields'](_0x5a064c[_0xd21a('0x2f')]['fields']));_0x5cf655['attributes']=_0x5cf655[_0xd21a('0x32')]['length']?_0x5cf655[_0xd21a('0x32')]:_0x55e178[_0xd21a('0x2e')];if(_0x5a064c['query'][_0xd21a('0x3e')]){_0x5cf655[_0xd21a('0x3f')]=[{'all':!![]}];}_0x5cf655=_[_0xd21a('0x44')]({},_0x5cf655,_0x5a064c['options']);return db[_0xd21a('0x2a')]['find'](_0x5cf655)['then'](handleEntityNotFound(_0xfcd393,null))[_0xd21a('0x22')](respondWithResult(_0xfcd393,null))[_0xd21a('0x42')](handleError(_0xfcd393,null));};exports[_0xd21a('0x45')]=function(_0x2ffe7c,_0x224b6a){return db[_0xd21a('0x2a')][_0xd21a('0x45')](_0x2ffe7c['body'],{})[_0xd21a('0x22')](respondWithResult(_0x224b6a,0xc9))['catch'](handleError(_0x224b6a,null));};exports[_0xd21a('0x21')]=function(_0x30584a,_0x282ea7){if(_0x30584a[_0xd21a('0x46')]['id']){delete _0x30584a[_0xd21a('0x46')]['id'];}return db[_0xd21a('0x2a')][_0xd21a('0x47')]({'where':{'id':_0x30584a[_0xd21a('0x48')]['id']}})[_0xd21a('0x22')](handleEntityNotFound(_0x282ea7,null))[_0xd21a('0x22')](saveUpdates(_0x30584a[_0xd21a('0x46')],null))[_0xd21a('0x22')](respondWithResult(_0x282ea7,null))[_0xd21a('0x42')](handleError(_0x282ea7,null));};exports[_0xd21a('0x23')]=function(_0x4cd0c8,_0x115965){return db[_0xd21a('0x2a')][_0xd21a('0x47')]({'where':{'id':_0x4cd0c8[_0xd21a('0x48')]['id']}})[_0xd21a('0x22')](handleEntityNotFound(_0x115965,null))[_0xd21a('0x22')](removeEntity(_0x115965,null))[_0xd21a('0x42')](handleError(_0x115965,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index d6c8f72..a3c1066 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 _0xbd09=['path','rimraf','../../config/environment','exports','define','SquareMessage','square_messages','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x390a19,_0x5dd137){var _0x5d8230=function(_0x2e6234){while(--_0x2e6234){_0x390a19['push'](_0x390a19['shift']());}};_0x5d8230(++_0x5dd137);}(_0xbd09,0x8b));var _0x9bd0=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xbd09[_0x5c351c];return _0x26f3b3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9bd0('0x0'))(_0x9bd0('0x1'));var moment=require(_0x9bd0('0x2'));var BPromise=require(_0x9bd0('0x3'));var rp=require(_0x9bd0('0x4'));var fs=require('fs');var path=require(_0x9bd0('0x5'));var rimraf=require(_0x9bd0('0x6'));var config=require(_0x9bd0('0x7'));var attributes=require('./squareMessage.attributes');module[_0x9bd0('0x8')]=function(_0x4e5583,_0x55d1c2){return _0x4e5583[_0x9bd0('0x9')](_0x9bd0('0xa'),attributes,{'tableName':_0x9bd0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb0c4=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash'];(function(_0x178668,_0x1ec300){var _0x26107d=function(_0x4c0aa8){while(--_0x4c0aa8){_0x178668['push'](_0x178668['shift']());}};_0x26107d(++_0x1ec300);}(_0xb0c4,0xc2));var _0x4b0c=function(_0x5c2a2b,_0x22c94e){_0x5c2a2b=_0x5c2a2b-0x0;var _0x19921f=_0xb0c4[_0x5c2a2b];return _0x19921f;};'use strict';var _=require(_0x4b0c('0x0'));var util=require('util');var logger=require(_0x4b0c('0x1'))(_0x4b0c('0x2'));var moment=require('moment');var BPromise=require(_0x4b0c('0x3'));var rp=require(_0x4b0c('0x4'));var fs=require('fs');var path=require(_0x4b0c('0x5'));var rimraf=require(_0x4b0c('0x6'));var config=require(_0x4b0c('0x7'));var attributes=require(_0x4b0c('0x8'));module[_0x4b0c('0x9')]=function(_0x2a1999,_0xc28b43){return _0x2a1999[_0x4b0c('0xa')](_0x4b0c('0xb'),attributes,{'tableName':_0x4b0c('0xc'),'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 3db1d54..97b7e9a 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 _0xdb4e=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','SquareMessage,\x20%s,\x20%s','debug','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','CreateSquareMessage','create','body','options','stringify'];(function(_0x34fabb,_0x54ec70){var _0x3a1b8f=function(_0x2e1491){while(--_0x2e1491){_0x34fabb['push'](_0x34fabb['shift']());}};_0x3a1b8f(++_0x54ec70);}(_0xdb4e,0x82));var _0xedb4=function(_0x47b6e4,_0x541578){_0x47b6e4=_0x47b6e4-0x0;var _0x398027=_0xdb4e[_0x47b6e4];return _0x398027;};'use strict';var _=require('lodash');var util=require(_0xedb4('0x0'));var moment=require(_0xedb4('0x1'));var BPromise=require(_0xedb4('0x2'));var rs=require(_0xedb4('0x3'));var fs=require('fs');var Redis=require(_0xedb4('0x4'));var db=require(_0xedb4('0x5'))['db'];var utils=require(_0xedb4('0x6'));var logger=require(_0xedb4('0x7'))('rpc');var config=require(_0xedb4('0x8'));var jayson=require(_0xedb4('0x9'));var client=jayson['client'][_0xedb4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b5c5f,_0x5b3546,_0x102a93){return new BPromise(function(_0x3acf6b,_0x31ac13){return client[_0xedb4('0xb')](_0x2b5c5f,_0x102a93)[_0xedb4('0xc')](function(_0x22572c){logger[_0xedb4('0xd')](_0xedb4('0xe'),_0x5b3546,'request\x20sent');logger[_0xedb4('0xf')](_0xedb4('0x10'),_0x5b3546,_0xedb4('0x11'),JSON['stringify'](_0x22572c));if(_0x22572c[_0xedb4('0x12')]){if(_0x22572c[_0xedb4('0x12')][_0xedb4('0x13')]===0x1f4){logger[_0xedb4('0x12')](_0xedb4('0xe'),_0x5b3546,_0x22572c[_0xedb4('0x12')][_0xedb4('0x14')]);return _0x31ac13(_0x22572c['error'][_0xedb4('0x14')]);}logger[_0xedb4('0x12')](_0xedb4('0xe'),_0x5b3546,_0x22572c[_0xedb4('0x12')][_0xedb4('0x14')]);return _0x3acf6b(_0x22572c['error'][_0xedb4('0x14')]);}else{logger[_0xedb4('0xd')](_0xedb4('0xe'),_0x5b3546,_0xedb4('0x11'));_0x3acf6b(_0x22572c['result'][_0xedb4('0x14')]);}})['catch'](function(_0x129aa7){logger[_0xedb4('0x12')]('SquareMessage,\x20%s,\x20%s',_0x5b3546,_0x129aa7);_0x31ac13(_0x129aa7);});});}exports[_0xedb4('0x15')]=function(_0x689e33){var _0x41d50a=this;return new Promise(function(_0x53dd8d,_0x14f80e){return db['SquareMessage'][_0xedb4('0x16')](_0x689e33[_0xedb4('0x17')],{'raw':_0x689e33[_0xedb4('0x18')]?_0x689e33[_0xedb4('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xedb4('0xc')](function(_0x1153d8){logger[_0xedb4('0xd')]('CreateSquareMessage',_0x689e33);logger[_0xedb4('0xf')](_0xedb4('0x15'),_0x689e33,JSON[_0xedb4('0x19')](_0x1153d8));_0x53dd8d(_0x1153d8);})['catch'](function(_0x414c31){logger['error'](_0xedb4('0x15'),_0x414c31[_0xedb4('0x14')],_0x689e33);_0x14f80e(_0x41d50a[_0xedb4('0x12')](0x1f4,_0x414c31[_0xedb4('0x14')]));});});}; \ No newline at end of file +var _0x443a=['rpc','jayson/promise','client','http','request','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareMessage','SquareMessage','create','body','options','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x235fdc,_0x4e76cf){var _0x5e0dfd=function(_0x3dea73){while(--_0x3dea73){_0x235fdc['push'](_0x235fdc['shift']());}};_0x5e0dfd(++_0x4e76cf);}(_0x443a,0x1aa));var _0xa443=function(_0x4b7c5a,_0x57eaf5){_0x4b7c5a=_0x4b7c5a-0x0;var _0x40ff02=_0x443a[_0x4b7c5a];return _0x40ff02;};'use strict';var _=require(_0xa443('0x0'));var util=require(_0xa443('0x1'));var moment=require(_0xa443('0x2'));var BPromise=require(_0xa443('0x3'));var rs=require(_0xa443('0x4'));var fs=require('fs');var Redis=require(_0xa443('0x5'));var db=require(_0xa443('0x6'))['db'];var utils=require(_0xa443('0x7'));var logger=require(_0xa443('0x8'))(_0xa443('0x9'));var config=require('../../config/environment');var jayson=require(_0xa443('0xa'));var client=jayson[_0xa443('0xb')][_0xa443('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1e2ede,_0x406436,_0x298ff6){return new BPromise(function(_0xec3bab,_0x4ac779){return client[_0xa443('0xd')](_0x1e2ede,_0x298ff6)['then'](function(_0x13a168){logger[_0xa443('0xe')](_0xa443('0xf'),_0x406436,_0xa443('0x10'));logger[_0xa443('0x11')](_0xa443('0x12'),_0x406436,'request\x20sent',JSON[_0xa443('0x13')](_0x13a168));if(_0x13a168[_0xa443('0x14')]){if(_0x13a168[_0xa443('0x14')][_0xa443('0x15')]===0x1f4){logger[_0xa443('0x14')](_0xa443('0xf'),_0x406436,_0x13a168['error'][_0xa443('0x16')]);return _0x4ac779(_0x13a168[_0xa443('0x14')][_0xa443('0x16')]);}logger['error'](_0xa443('0xf'),_0x406436,_0x13a168[_0xa443('0x14')][_0xa443('0x16')]);return _0xec3bab(_0x13a168[_0xa443('0x14')][_0xa443('0x16')]);}else{logger[_0xa443('0xe')](_0xa443('0xf'),_0x406436,_0xa443('0x10'));_0xec3bab(_0x13a168[_0xa443('0x17')][_0xa443('0x16')]);}})['catch'](function(_0x25148e){logger[_0xa443('0x14')](_0xa443('0xf'),_0x406436,_0x25148e);_0x4ac779(_0x25148e);});});}exports[_0xa443('0x18')]=function(_0x13feb5){var _0x4427b2=this;return new Promise(function(_0x192a7,_0x26c2be){return db[_0xa443('0x19')][_0xa443('0x1a')](_0x13feb5[_0xa443('0x1b')],{'raw':_0x13feb5['options']?_0x13feb5[_0xa443('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x10f862){logger[_0xa443('0xe')]('CreateSquareMessage',_0x13feb5);logger['debug'](_0xa443('0x18'),_0x13feb5,JSON[_0xa443('0x13')](_0x10f862));_0x192a7(_0x10f862);})['catch'](function(_0x408a49){logger[_0xa443('0x14')]('CreateSquareMessage',_0x408a49[_0xa443('0x16')],_0x13feb5);_0x26c2be(_0x4427b2['error'](0x1f4,_0x408a49[_0xa443('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index e4b2b63..578d748 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 _0xb4fc=['delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/test','15s','create'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xb4fc,0x1c5));var _0xcb4f=function(_0x58ffd3,_0xdf6a5f){_0x58ffd3=_0x58ffd3-0x0;var _0xf86480=_0xb4fc[_0x58ffd3];return _0xf86480;};'use strict';var multer=require(_0xcb4f('0x0'));var util=require('util');var path=require(_0xcb4f('0x1'));var timeout=require(_0xcb4f('0x2'));var express=require(_0xcb4f('0x3'));var router=express[_0xcb4f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xcb4f('0x5'));var interaction=require(_0xcb4f('0x6'));var config=require(_0xcb4f('0x7'));var controller=require('./squareOdbc.controller');router[_0xcb4f('0x8')]('/',auth[_0xcb4f('0x9')](),controller['index']);router[_0xcb4f('0x8')](_0xcb4f('0xa'),auth[_0xcb4f('0x9')](),controller[_0xcb4f('0xb')]);router[_0xcb4f('0x8')](_0xcb4f('0xc'),auth[_0xcb4f('0x9')](),timeout(_0xcb4f('0xd')),controller['test']);router['post']('/',auth[_0xcb4f('0x9')](),controller[_0xcb4f('0xe')]);router['put'](_0xcb4f('0xa'),auth[_0xcb4f('0x9')](),controller['update']);router[_0xcb4f('0xf')](_0xcb4f('0xa'),auth[_0xcb4f('0x9')](),controller[_0xcb4f('0x10')]);module[_0xcb4f('0x11')]=router; \ No newline at end of file +var _0x3097=['update','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','/:id/test','15s','post','create'];(function(_0x5e7b08,_0x47bbc6){var _0x5a73b9=function(_0x4b5cf3){while(--_0x4b5cf3){_0x5e7b08['push'](_0x5e7b08['shift']());}};_0x5a73b9(++_0x47bbc6);}(_0x3097,0x16a));var _0x7309=function(_0x204be9,_0x525eaf){_0x204be9=_0x204be9-0x0;var _0x54fe9c=_0x3097[_0x204be9];return _0x54fe9c;};'use strict';var multer=require(_0x7309('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7309('0x1'));var router=express[_0x7309('0x2')]();var fs_extra=require(_0x7309('0x3'));var auth=require(_0x7309('0x4'));var interaction=require(_0x7309('0x5'));var config=require('../../config/environment');var controller=require(_0x7309('0x6'));router[_0x7309('0x7')]('/',auth[_0x7309('0x8')](),controller[_0x7309('0x9')]);router[_0x7309('0x7')](_0x7309('0xa'),auth['isAuthenticated'](),controller[_0x7309('0xb')]);router[_0x7309('0x7')](_0x7309('0xc'),auth['isAuthenticated'](),timeout(_0x7309('0xd')),controller['test']);router[_0x7309('0xe')]('/',auth[_0x7309('0x8')](),controller[_0x7309('0xf')]);router['put']('/:id',auth[_0x7309('0x8')](),controller[_0x7309('0x10')]);router['delete'](_0x7309('0xa'),auth[_0x7309('0x8')](),controller['destroy']);module[_0x7309('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 295027f..5f858fd 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 _0xa170=['exports','STRING'];(function(_0x1dd532,_0x36e81c){var _0x3732aa=function(_0x19d50a){while(--_0x19d50a){_0x1dd532['push'](_0x1dd532['shift']());}};_0x3732aa(++_0x36e81c);}(_0xa170,0x114));var _0x0a17=function(_0x3a864a,_0x40a599){_0x3a864a=_0x3a864a-0x0;var _0x41e6cb=_0xa170[_0x3a864a];return _0x41e6cb;};'use strict';var Sequelize=require('sequelize');module[_0x0a17('0x0')]={'name':{'type':Sequelize[_0x0a17('0x1')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x0a17('0x1')]},'description':{'type':Sequelize[_0x0a17('0x1')]}}; \ No newline at end of file +var _0x5638=['name','sequelize','STRING'];(function(_0x4bcf0d,_0x3bd4b9){var _0x1134e6=function(_0xae6e25){while(--_0xae6e25){_0x4bcf0d['push'](_0x4bcf0d['shift']());}};_0x1134e6(++_0x3bd4b9);}(_0x5638,0x127));var _0x8563=function(_0x51a189,_0x134d97){_0x51a189=_0x51a189-0x0;var _0x9cdefc=_0x5638[_0x51a189];return _0x9cdefc;};'use strict';var Sequelize=require(_0x8563('0x0'));module['exports']={'name':{'type':Sequelize[_0x8563('0x1')],'unique':_0x8563('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x8563('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index d36e1e4..9758106 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 _0xdf2e=['crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','then','destroy','get','ODBC','UserProfileResource','stack','name','index','map','SquareOdbc','rawAttributes','fieldName','type','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','options','include','rows','catch','show','params','find','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','create','error','update','body','test','dsn','odbc','openSync','rimraf','zip-dir','request-promise','moment','bluebird','util','to-csv','fs-extra','lodash','squel'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xdf2e,0x122));var _0xedf2=function(_0x456a4b,_0x51df8){_0x456a4b=_0x456a4b-0x0;var _0x42957c=_0xdf2e[_0x456a4b];return _0x42957c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xedf2('0x0'));var zipdir=require(_0xedf2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xedf2('0x2'));var moment=require(_0xedf2('0x3'));var BPromise=require(_0xedf2('0x4'));var Mustache=require('mustache');var util=require(_0xedf2('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xedf2('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xedf2('0x7'));var _=require(_0xedf2('0x8'));var squel=require(_0xedf2('0x9'));var crypto=require(_0xedf2('0xa'));var jsforce=require(_0xedf2('0xb'));var deskjs=require(_0xedf2('0xc'));var toCsv=require(_0xedf2('0x6'));var querystring=require(_0xedf2('0xd'));var Papa=require(_0xedf2('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xedf2('0xf'));var hardwareService=require(_0xedf2('0x10'));var logger=require(_0xedf2('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xedf2('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xedf2('0x13'))['db'];function respondWithStatusCode(_0x47a677,_0x4f8ef9){_0x4f8ef9=_0x4f8ef9||0xcc;return function(_0x3ae0ab){if(_0x3ae0ab){return _0x47a677[_0xedf2('0x14')](_0x4f8ef9);}return _0x47a677[_0xedf2('0x15')](_0x4f8ef9)[_0xedf2('0x16')]();};}function respondWithResult(_0x452b62,_0x1161cd){_0x1161cd=_0x1161cd||0xc8;return function(_0xd8a63e){if(_0xd8a63e){return _0x452b62[_0xedf2('0x15')](_0x1161cd)['json'](_0xd8a63e);}};}function respondWithFilteredResult(_0x501afb,_0x134356){return function(_0x221abe){if(_0x221abe){var _0x32dba8=typeof _0x134356[_0xedf2('0x17')]===_0xedf2('0x18')&&typeof _0x134356[_0xedf2('0x19')]===_0xedf2('0x18');var _0x2676e1=_0x221abe[_0xedf2('0x1a')];var _0x517231=_0x32dba8?0x0:_0x134356[_0xedf2('0x17')];var _0x172f7c=_0x32dba8?_0x221abe[_0xedf2('0x1a')]:_0x134356[_0xedf2('0x17')]+_0x134356[_0xedf2('0x19')];var _0x555bdc;if(_0x172f7c>=_0x2676e1){_0x172f7c=_0x2676e1;_0x555bdc=0xc8;}else{_0x555bdc=0xce;}_0x501afb[_0xedf2('0x15')](_0x555bdc);return _0x501afb['set'](_0xedf2('0x1b'),_0x517231+'-'+_0x172f7c+'/'+_0x2676e1)['json'](_0x221abe);}return null;};}function patchUpdates(_0x1a7e6a){return function(_0x9fe97d){try{jsonpatch[_0xedf2('0x1c')](_0x9fe97d,_0x1a7e6a,!![]);}catch(_0x2cae61){return BPromise['reject'](_0x2cae61);}return _0x9fe97d['save']();};}function saveUpdates(_0x2824d5,_0x51de66){return function(_0x334f0f){if(_0x334f0f){return _0x334f0f['update'](_0x2824d5)[_0xedf2('0x1d')](function(_0x5acb07){return _0x5acb07;});}return null;};}function removeEntity(_0x129d37,_0x33f6fd){return function(_0x3444d4){if(_0x3444d4){return _0x3444d4[_0xedf2('0x1e')]()[_0xedf2('0x1d')](function(){var _0x381eb0=_0x3444d4[_0xedf2('0x1f')]({'plain':!![]});var _0x287862=_0xedf2('0x20');return db[_0xedf2('0x21')][_0xedf2('0x1e')]({'where':{'type':_0x287862,'resourceId':_0x381eb0['id']}})[_0xedf2('0x1d')](function(){return _0x3444d4;});})[_0xedf2('0x1d')](function(){_0x129d37[_0xedf2('0x15')](0xcc)[_0xedf2('0x16')]();});}};}function handleEntityNotFound(_0xe9d293,_0x1b91c2){return function(_0x6352b){if(!_0x6352b){_0xe9d293[_0xedf2('0x14')](0x194);}return _0x6352b;};}function handleError(_0x246a19,_0x90d998){_0x90d998=_0x90d998||0x1f4;return function(_0x3c4b3e){logger['error'](_0x3c4b3e[_0xedf2('0x22')]);if(_0x3c4b3e[_0xedf2('0x23')]){delete _0x3c4b3e['name'];}_0x246a19[_0xedf2('0x15')](_0x90d998)['send'](_0x3c4b3e);};}exports[_0xedf2('0x24')]=function(_0xad6324,_0x227ed5){var _0x3d9463={},_0x276276={},_0x2d7a7c={'count':0x0,'rows':[]};var _0x3ba15c=_[_0xedf2('0x25')](db[_0xedf2('0x26')][_0xedf2('0x27')],function(_0x4671d5){return{'name':_0x4671d5[_0xedf2('0x28')],'type':_0x4671d5[_0xedf2('0x29')]['key']};});_0x276276[_0xedf2('0x2a')]=_[_0xedf2('0x25')](_0x3ba15c,'name');_0x276276['query']=_[_0xedf2('0x2b')](_0xad6324['query']);_0x276276[_0xedf2('0x2c')]=_[_0xedf2('0x2d')](_0x276276['model'],_0x276276[_0xedf2('0x2e')]);_0x3d9463['attributes']=_['intersection'](_0x276276[_0xedf2('0x2a')],qs[_0xedf2('0x2f')](_0xad6324[_0xedf2('0x2e')][_0xedf2('0x2f')]));_0x3d9463[_0xedf2('0x30')]=_0x3d9463[_0xedf2('0x30')][_0xedf2('0x31')]?_0x3d9463[_0xedf2('0x30')]:_0x276276[_0xedf2('0x2a')];if(!_0xad6324[_0xedf2('0x2e')][_0xedf2('0x32')]('nolimit')){_0x3d9463[_0xedf2('0x19')]=qs['limit'](_0xad6324[_0xedf2('0x2e')][_0xedf2('0x19')]);_0x3d9463[_0xedf2('0x17')]=qs[_0xedf2('0x17')](_0xad6324['query'][_0xedf2('0x17')]);}_0x3d9463[_0xedf2('0x33')]=qs[_0xedf2('0x34')](_0xad6324['query'][_0xedf2('0x34')]);_0x3d9463[_0xedf2('0x35')]=qs[_0xedf2('0x2c')](_[_0xedf2('0x36')](_0xad6324[_0xedf2('0x2e')],_0x276276[_0xedf2('0x2c')]),_0x3ba15c);if(_0xad6324[_0xedf2('0x2e')]['filter']){_0x3d9463[_0xedf2('0x35')]=_[_0xedf2('0x37')](_0x3d9463['where'],{'$or':_[_0xedf2('0x25')](_0x3ba15c,function(_0x5f10d6){if(_0x5f10d6[_0xedf2('0x29')]!=='VIRTUAL'){var _0x3754ad={};_0x3754ad[_0x5f10d6[_0xedf2('0x23')]]={'$like':'%'+_0xad6324[_0xedf2('0x2e')]['filter']+'%'};return _0x3754ad;}})});}_0x3d9463=_[_0xedf2('0x37')]({},_0x3d9463,_0xad6324[_0xedf2('0x38')]);var _0x314446={'where':_0x3d9463['where']};return db[_0xedf2('0x26')][_0xedf2('0x1a')](_0x314446)[_0xedf2('0x1d')](function(_0x49451f){_0x2d7a7c[_0xedf2('0x1a')]=_0x49451f;if(_0xad6324[_0xedf2('0x2e')]['includeAll']){_0x3d9463[_0xedf2('0x39')]=[{'all':!![]}];}return db[_0xedf2('0x26')]['findAll'](_0x3d9463);})[_0xedf2('0x1d')](function(_0x1fa0ee){_0x2d7a7c[_0xedf2('0x3a')]=_0x1fa0ee;return _0x2d7a7c;})['then'](respondWithFilteredResult(_0x227ed5,_0x3d9463))[_0xedf2('0x3b')](handleError(_0x227ed5,null));};exports[_0xedf2('0x3c')]=function(_0x10f2e1,_0x438fe8){var _0x5bef32={'raw':!![],'where':{'id':_0x10f2e1[_0xedf2('0x3d')]['id']}},_0x380653={};_0x380653[_0xedf2('0x2a')]=_[_0xedf2('0x2b')](db['SquareOdbc'][_0xedf2('0x27')]);_0x380653[_0xedf2('0x2e')]=_[_0xedf2('0x2b')](_0x10f2e1[_0xedf2('0x2e')]);_0x380653[_0xedf2('0x2c')]=_[_0xedf2('0x2d')](_0x380653['model'],_0x380653[_0xedf2('0x2e')]);_0x5bef32['attributes']=_[_0xedf2('0x2d')](_0x380653['model'],qs['fields'](_0x10f2e1['query']['fields']));_0x5bef32[_0xedf2('0x30')]=_0x5bef32[_0xedf2('0x30')][_0xedf2('0x31')]?_0x5bef32[_0xedf2('0x30')]:_0x380653[_0xedf2('0x2a')];if(_0x10f2e1[_0xedf2('0x2e')]['includeAll']){_0x5bef32[_0xedf2('0x39')]=[{'all':!![]}];}_0x5bef32=_['merge']({},_0x5bef32,_0x10f2e1[_0xedf2('0x38')]);return db[_0xedf2('0x26')][_0xedf2('0x3e')](_0x5bef32)[_0xedf2('0x1d')](handleEntityNotFound(_0x438fe8,null))[_0xedf2('0x1d')](respondWithResult(_0x438fe8,null))[_0xedf2('0x3b')](handleError(_0x438fe8,null));};exports['create']=function(_0x3b37a4,_0x3b5da9){return db['SquareOdbc']['create'](_0x3b37a4['body'],{})['then'](function(_0xc62096){var _0x1992a9=_0x3b37a4['user'][_0xedf2('0x1f')]({'plain':!![]});if(!_0x1992a9)throw new Error(_0xedf2('0x3f'));if(_0x1992a9[_0xedf2('0x40')]===_0xedf2('0x41')){var _0xf56ba7=_0xc62096[_0xedf2('0x1f')]({'plain':!![]});var _0x25c274='ODBC';return db['UserProfileSection']['find']({'where':{'name':_0x25c274,'userProfileId':_0x1992a9[_0xedf2('0x42')]},'raw':!![]})[_0xedf2('0x1d')](function(_0xe8a015){if(_0xe8a015&&_0xe8a015['autoAssociation']===0x0){return db[_0xedf2('0x21')][_0xedf2('0x43')]({'name':_0xf56ba7[_0xedf2('0x23')],'resourceId':_0xf56ba7['id'],'type':_0xe8a015['name'],'sectionId':_0xe8a015['id']},{})[_0xedf2('0x1d')](function(){return _0xc62096;});}else{return _0xc62096;}})[_0xedf2('0x3b')](function(_0x3f54a7){logger[_0xedf2('0x44')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f54a7);throw _0x3f54a7;});}return _0xc62096;})[_0xedf2('0x1d')](respondWithResult(_0x3b5da9,0xc9))[_0xedf2('0x3b')](handleError(_0x3b5da9,null));};exports[_0xedf2('0x45')]=function(_0x342b36,_0x157286){if(_0x342b36['body']['id']){delete _0x342b36[_0xedf2('0x46')]['id'];}return db['SquareOdbc']['find']({'where':{'id':_0x342b36[_0xedf2('0x3d')]['id']}})[_0xedf2('0x1d')](handleEntityNotFound(_0x157286,null))[_0xedf2('0x1d')](saveUpdates(_0x342b36[_0xedf2('0x46')],null))[_0xedf2('0x1d')](respondWithResult(_0x157286,null))[_0xedf2('0x3b')](handleError(_0x157286,null));};exports[_0xedf2('0x1e')]=function(_0x1ede0e,_0x53e349){return db[_0xedf2('0x26')][_0xedf2('0x3e')]({'where':{'id':_0x1ede0e[_0xedf2('0x3d')]['id']}})[_0xedf2('0x1d')](handleEntityNotFound(_0x53e349,null))['then'](removeEntity(_0x53e349,null))[_0xedf2('0x3b')](handleError(_0x53e349,null));};exports[_0xedf2('0x47')]=function(_0x1a569b,_0x475ce3,_0x33536d){var _0x5e265e;return db[_0xedf2('0x26')][_0xedf2('0x3e')]({'where':{'id':_0x1a569b[_0xedf2('0x3d')]['id']},'attributes':['id',_0xedf2('0x48')]})[_0xedf2('0x1d')](handleEntityNotFound(_0x475ce3,null))[_0xedf2('0x1d')](function(_0x54c08f){if(_0x54c08f){var _0x2c7cbe=require(_0xedf2('0x49'))();_0x2c7cbe[_0xedf2('0x4a')](_0x54c08f['dsn']);_0x2c7cbe['closeSync']();return _0x54c08f;}})['then'](respondWithResult(_0x475ce3,null))['catch'](handleError(_0x475ce3,null));}; \ No newline at end of file +var _0xde35=['request-promise','moment','bluebird','mustache','path','sox','to-csv','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','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','save','update','then','destroy','ODBC','UserProfileResource','error','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','findAll','show','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','test','dsn','odbc','openSync','rimraf','zip-dir','fast-json-patch'];(function(_0x5177f7,_0x5c9bdb){var _0x120715=function(_0x255bae){while(--_0x255bae){_0x5177f7['push'](_0x5177f7['shift']());}};_0x120715(++_0x5c9bdb);}(_0xde35,0x159));var _0x5de3=function(_0x574e35,_0x255a18){_0x574e35=_0x574e35-0x0;var _0x48ffac=_0xde35[_0x574e35];return _0x48ffac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5de3('0x0'));var zipdir=require(_0x5de3('0x1'));var jsonpatch=require(_0x5de3('0x2'));var rp=require(_0x5de3('0x3'));var moment=require(_0x5de3('0x4'));var BPromise=require(_0x5de3('0x5'));var Mustache=require(_0x5de3('0x6'));var util=require('util');var path=require(_0x5de3('0x7'));var sox=require(_0x5de3('0x8'));var csv=require(_0x5de3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5de3('0xa'));var crypto=require(_0x5de3('0xb'));var jsforce=require(_0x5de3('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5de3('0x9'));var querystring=require(_0x5de3('0xd'));var Papa=require(_0x5de3('0xe'));var Redis=require('ioredis');var authService=require(_0x5de3('0xf'));var qs=require(_0x5de3('0x10'));var as=require(_0x5de3('0x11'));var hardwareService=require(_0x5de3('0x12'));var logger=require(_0x5de3('0x13'))(_0x5de3('0x14'));var utils=require(_0x5de3('0x15'));var config=require(_0x5de3('0x16'));var licenseUtil=require(_0x5de3('0x17'));var db=require(_0x5de3('0x18'))['db'];function respondWithStatusCode(_0x16497d,_0x296a4a){_0x296a4a=_0x296a4a||0xcc;return function(_0x2af906){if(_0x2af906){return _0x16497d['sendStatus'](_0x296a4a);}return _0x16497d['status'](_0x296a4a)[_0x5de3('0x19')]();};}function respondWithResult(_0x40ec2d,_0x44e9e9){_0x44e9e9=_0x44e9e9||0xc8;return function(_0x397d35){if(_0x397d35){return _0x40ec2d['status'](_0x44e9e9)['json'](_0x397d35);}};}function respondWithFilteredResult(_0x145f91,_0x3b2cb5){return function(_0x447c30){if(_0x447c30){var _0x81b176=typeof _0x3b2cb5[_0x5de3('0x1a')]===_0x5de3('0x1b')&&typeof _0x3b2cb5[_0x5de3('0x1c')]==='undefined';var _0x282801=_0x447c30[_0x5de3('0x1d')];var _0x339107=_0x81b176?0x0:_0x3b2cb5[_0x5de3('0x1a')];var _0x157260=_0x81b176?_0x447c30['count']:_0x3b2cb5['offset']+_0x3b2cb5['limit'];var _0x5bfb31;if(_0x157260>=_0x282801){_0x157260=_0x282801;_0x5bfb31=0xc8;}else{_0x5bfb31=0xce;}_0x145f91[_0x5de3('0x1e')](_0x5bfb31);return _0x145f91[_0x5de3('0x1f')](_0x5de3('0x20'),_0x339107+'-'+_0x157260+'/'+_0x282801)[_0x5de3('0x21')](_0x447c30);}return null;};}function patchUpdates(_0x2d6ea7){return function(_0x55057b){try{jsonpatch[_0x5de3('0x22')](_0x55057b,_0x2d6ea7,!![]);}catch(_0xf6506e){return BPromise['reject'](_0xf6506e);}return _0x55057b[_0x5de3('0x23')]();};}function saveUpdates(_0x2885ca,_0x3855f8){return function(_0x20619f){if(_0x20619f){return _0x20619f[_0x5de3('0x24')](_0x2885ca)[_0x5de3('0x25')](function(_0x5f0fde){return _0x5f0fde;});}return null;};}function removeEntity(_0x8bda68,_0x2ff505){return function(_0x94cda1){if(_0x94cda1){return _0x94cda1[_0x5de3('0x26')]()[_0x5de3('0x25')](function(){var _0x48d7fa=_0x94cda1['get']({'plain':!![]});var _0x29ab58=_0x5de3('0x27');return db[_0x5de3('0x28')][_0x5de3('0x26')]({'where':{'type':_0x29ab58,'resourceId':_0x48d7fa['id']}})[_0x5de3('0x25')](function(){return _0x94cda1;});})['then'](function(){_0x8bda68[_0x5de3('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x521a17,_0x120938){return function(_0x36c6c8){if(!_0x36c6c8){_0x521a17['sendStatus'](0x194);}return _0x36c6c8;};}function handleError(_0x2e9141,_0x5bbb50){_0x5bbb50=_0x5bbb50||0x1f4;return function(_0x1f1765){logger[_0x5de3('0x29')](_0x1f1765[_0x5de3('0x2a')]);if(_0x1f1765[_0x5de3('0x2b')]){delete _0x1f1765['name'];}_0x2e9141[_0x5de3('0x1e')](_0x5bbb50)[_0x5de3('0x2c')](_0x1f1765);};}exports[_0x5de3('0x2d')]=function(_0x53e0f0,_0xdfa9bf){var _0x30ab99={},_0x44c5f7={},_0x308457={'count':0x0,'rows':[]};var _0x4ea58b=_[_0x5de3('0x2e')](db[_0x5de3('0x2f')][_0x5de3('0x30')],function(_0x129acd){return{'name':_0x129acd[_0x5de3('0x31')],'type':_0x129acd[_0x5de3('0x32')][_0x5de3('0x33')]};});_0x44c5f7[_0x5de3('0x34')]=_[_0x5de3('0x2e')](_0x4ea58b,_0x5de3('0x2b'));_0x44c5f7[_0x5de3('0x35')]=_[_0x5de3('0x36')](_0x53e0f0['query']);_0x44c5f7[_0x5de3('0x37')]=_[_0x5de3('0x38')](_0x44c5f7[_0x5de3('0x34')],_0x44c5f7[_0x5de3('0x35')]);_0x30ab99[_0x5de3('0x39')]=_[_0x5de3('0x38')](_0x44c5f7[_0x5de3('0x34')],qs['fields'](_0x53e0f0[_0x5de3('0x35')][_0x5de3('0x3a')]));_0x30ab99[_0x5de3('0x39')]=_0x30ab99[_0x5de3('0x39')][_0x5de3('0x3b')]?_0x30ab99[_0x5de3('0x39')]:_0x44c5f7[_0x5de3('0x34')];if(!_0x53e0f0[_0x5de3('0x35')][_0x5de3('0x3c')](_0x5de3('0x3d'))){_0x30ab99[_0x5de3('0x1c')]=qs['limit'](_0x53e0f0[_0x5de3('0x35')][_0x5de3('0x1c')]);_0x30ab99[_0x5de3('0x1a')]=qs[_0x5de3('0x1a')](_0x53e0f0[_0x5de3('0x35')][_0x5de3('0x1a')]);}_0x30ab99['order']=qs[_0x5de3('0x3e')](_0x53e0f0[_0x5de3('0x35')][_0x5de3('0x3e')]);_0x30ab99[_0x5de3('0x3f')]=qs['filters'](_[_0x5de3('0x40')](_0x53e0f0[_0x5de3('0x35')],_0x44c5f7['filters']),_0x4ea58b);if(_0x53e0f0[_0x5de3('0x35')][_0x5de3('0x41')]){_0x30ab99['where']=_[_0x5de3('0x42')](_0x30ab99[_0x5de3('0x3f')],{'$or':_[_0x5de3('0x2e')](_0x4ea58b,function(_0x50259c){if(_0x50259c[_0x5de3('0x32')]!=='VIRTUAL'){var _0x4809fb={};_0x4809fb[_0x50259c[_0x5de3('0x2b')]]={'$like':'%'+_0x53e0f0['query'][_0x5de3('0x41')]+'%'};return _0x4809fb;}})});}_0x30ab99=_[_0x5de3('0x42')]({},_0x30ab99,_0x53e0f0[_0x5de3('0x43')]);var _0x53f679={'where':_0x30ab99[_0x5de3('0x3f')]};return db[_0x5de3('0x2f')]['count'](_0x53f679)[_0x5de3('0x25')](function(_0x44b227){_0x308457[_0x5de3('0x1d')]=_0x44b227;if(_0x53e0f0[_0x5de3('0x35')][_0x5de3('0x44')]){_0x30ab99['include']=[{'all':!![]}];}return db['SquareOdbc'][_0x5de3('0x45')](_0x30ab99);})[_0x5de3('0x25')](function(_0x904bac){_0x308457['rows']=_0x904bac;return _0x308457;})[_0x5de3('0x25')](respondWithFilteredResult(_0xdfa9bf,_0x30ab99))['catch'](handleError(_0xdfa9bf,null));};exports[_0x5de3('0x46')]=function(_0x41ea84,_0x54c4c6){var _0x4afa58={'raw':!![],'where':{'id':_0x41ea84['params']['id']}},_0x261939={};_0x261939[_0x5de3('0x34')]=_[_0x5de3('0x36')](db['SquareOdbc'][_0x5de3('0x30')]);_0x261939[_0x5de3('0x35')]=_[_0x5de3('0x36')](_0x41ea84[_0x5de3('0x35')]);_0x261939[_0x5de3('0x37')]=_[_0x5de3('0x38')](_0x261939['model'],_0x261939[_0x5de3('0x35')]);_0x4afa58[_0x5de3('0x39')]=_['intersection'](_0x261939[_0x5de3('0x34')],qs['fields'](_0x41ea84['query']['fields']));_0x4afa58['attributes']=_0x4afa58[_0x5de3('0x39')][_0x5de3('0x3b')]?_0x4afa58[_0x5de3('0x39')]:_0x261939[_0x5de3('0x34')];if(_0x41ea84[_0x5de3('0x35')][_0x5de3('0x44')]){_0x4afa58[_0x5de3('0x47')]=[{'all':!![]}];}_0x4afa58=_[_0x5de3('0x42')]({},_0x4afa58,_0x41ea84['options']);return db[_0x5de3('0x2f')][_0x5de3('0x48')](_0x4afa58)[_0x5de3('0x25')](handleEntityNotFound(_0x54c4c6,null))[_0x5de3('0x25')](respondWithResult(_0x54c4c6,null))['catch'](handleError(_0x54c4c6,null));};exports[_0x5de3('0x49')]=function(_0x6bd73f,_0x5a1009){return db[_0x5de3('0x2f')]['create'](_0x6bd73f[_0x5de3('0x4a')],{})[_0x5de3('0x25')](function(_0x581dcc){var _0x23e055=_0x6bd73f['user'][_0x5de3('0x4b')]({'plain':!![]});if(!_0x23e055)throw new Error(_0x5de3('0x4c'));if(_0x23e055['role']===_0x5de3('0x4d')){var _0x5b358d=_0x581dcc[_0x5de3('0x4b')]({'plain':!![]});var _0x214855=_0x5de3('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x214855,'userProfileId':_0x23e055[_0x5de3('0x4e')]},'raw':!![]})[_0x5de3('0x25')](function(_0x2d9b6f){if(_0x2d9b6f&&_0x2d9b6f[_0x5de3('0x4f')]===0x0){return db['UserProfileResource'][_0x5de3('0x49')]({'name':_0x5b358d[_0x5de3('0x2b')],'resourceId':_0x5b358d['id'],'type':_0x2d9b6f[_0x5de3('0x2b')],'sectionId':_0x2d9b6f['id']},{})[_0x5de3('0x25')](function(){return _0x581dcc;});}else{return _0x581dcc;}})[_0x5de3('0x50')](function(_0x55e6de){logger[_0x5de3('0x29')](_0x5de3('0x51'),_0x55e6de);throw _0x55e6de;});}return _0x581dcc;})[_0x5de3('0x25')](respondWithResult(_0x5a1009,0xc9))['catch'](handleError(_0x5a1009,null));};exports[_0x5de3('0x24')]=function(_0x551a91,_0x48a0e9){if(_0x551a91[_0x5de3('0x4a')]['id']){delete _0x551a91[_0x5de3('0x4a')]['id'];}return db[_0x5de3('0x2f')]['find']({'where':{'id':_0x551a91[_0x5de3('0x52')]['id']}})[_0x5de3('0x25')](handleEntityNotFound(_0x48a0e9,null))[_0x5de3('0x25')](saveUpdates(_0x551a91[_0x5de3('0x4a')],null))[_0x5de3('0x25')](respondWithResult(_0x48a0e9,null))[_0x5de3('0x50')](handleError(_0x48a0e9,null));};exports[_0x5de3('0x26')]=function(_0x362475,_0x210887){return db[_0x5de3('0x2f')][_0x5de3('0x48')]({'where':{'id':_0x362475['params']['id']}})[_0x5de3('0x25')](handleEntityNotFound(_0x210887,null))[_0x5de3('0x25')](removeEntity(_0x210887,null))[_0x5de3('0x50')](handleError(_0x210887,null));};exports[_0x5de3('0x53')]=function(_0x43bd49,_0xa4fb79,_0x5a2fe5){var _0x5599dc;return db[_0x5de3('0x2f')][_0x5de3('0x48')]({'where':{'id':_0x43bd49[_0x5de3('0x52')]['id']},'attributes':['id',_0x5de3('0x54')]})[_0x5de3('0x25')](handleEntityNotFound(_0xa4fb79,null))[_0x5de3('0x25')](function(_0x11f8f4){if(_0x11f8f4){var _0x5e8c84=require(_0x5de3('0x55'))();_0x5e8c84[_0x5de3('0x56')](_0x11f8f4[_0x5de3('0x54')]);_0x5e8c84['closeSync']();return _0x11f8f4;}})['then'](respondWithResult(_0xa4fb79,null))[_0x5de3('0x50')](handleError(_0xa4fb79,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 32fb1e2..d0a892e 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 _0x0d63=['rimraf','../../config/environment','exports','define','SquareOdbc','square_odbc','lodash','../../config/logger','path'];(function(_0x1fdd5d,_0x2874e3){var _0x525d89=function(_0x27777a){while(--_0x27777a){_0x1fdd5d['push'](_0x1fdd5d['shift']());}};_0x525d89(++_0x2874e3);}(_0x0d63,0x7b));var _0x30d6=function(_0x55af86,_0x5c8ff6){_0x55af86=_0x55af86-0x0;var _0x58df3b=_0x0d63[_0x55af86];return _0x58df3b;};'use strict';var _=require(_0x30d6('0x0'));var util=require('util');var logger=require(_0x30d6('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x30d6('0x2'));var rimraf=require(_0x30d6('0x3'));var config=require(_0x30d6('0x4'));var attributes=require('./squareOdbc.attributes');module[_0x30d6('0x5')]=function(_0x3f8f31,_0x3010e8){return _0x3f8f31[_0x30d6('0x6')](_0x30d6('0x7'),attributes,{'tableName':_0x30d6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed3d=['moment','bluebird','request-promise','path','../../config/environment','./squareOdbc.attributes','exports','define','square_odbc','api'];(function(_0xc416a5,_0x4d95ce){var _0x1c82b9=function(_0x17ca10){while(--_0x17ca10){_0xc416a5['push'](_0xc416a5['shift']());}};_0x1c82b9(++_0x4d95ce);}(_0xed3d,0x1e9));var _0xded3=function(_0xcbb2dd,_0x9cc69b){_0xcbb2dd=_0xcbb2dd-0x0;var _0x34f9bc=_0xed3d[_0xcbb2dd];return _0x34f9bc;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xded3('0x0'));var moment=require(_0xded3('0x1'));var BPromise=require(_0xded3('0x2'));var rp=require(_0xded3('0x3'));var fs=require('fs');var path=require(_0xded3('0x4'));var rimraf=require('rimraf');var config=require(_0xded3('0x5'));var attributes=require(_0xded3('0x6'));module[_0xded3('0x7')]=function(_0x2c4d0f,_0x57f634){return _0x2c4d0f[_0xded3('0x8')]('SquareOdbc',attributes,{'tableName':_0xded3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 76dee08..b41d21b 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 _0xea4b=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareOdbc,\x20%s,\x20%s','message','result','catch','SquareOdbc','find','options','raw','where','attributes','map','include','model','ShowSquareOdbc','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x842858,_0x3a3ca0){var _0x46c2a2=function(_0x47f795){while(--_0x47f795){_0x842858['push'](_0x842858['shift']());}};_0x46c2a2(++_0x3a3ca0);}(_0xea4b,0x10b));var _0xbea4=function(_0x5e8763,_0x558211){_0x5e8763=_0x5e8763-0x0;var _0x286b08=_0xea4b[_0x5e8763];return _0x286b08;};'use strict';var _=require(_0xbea4('0x0'));var util=require('util');var moment=require(_0xbea4('0x1'));var BPromise=require('bluebird');var rs=require(_0xbea4('0x2'));var fs=require('fs');var Redis=require(_0xbea4('0x3'));var db=require(_0xbea4('0x4'))['db'];var utils=require(_0xbea4('0x5'));var logger=require(_0xbea4('0x6'))('rpc');var config=require(_0xbea4('0x7'));var jayson=require(_0xbea4('0x8'));var client=jayson[_0xbea4('0x9')][_0xbea4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x595902,_0x39fbeb,_0x2d694b){return new BPromise(function(_0xabdf84,_0x292c8f){return client[_0xbea4('0xb')](_0x595902,_0x2d694b)[_0xbea4('0xc')](function(_0x475efa){logger[_0xbea4('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x39fbeb,_0xbea4('0xe'));logger[_0xbea4('0xf')](_0xbea4('0x10'),_0x39fbeb,_0xbea4('0xe'),JSON[_0xbea4('0x11')](_0x475efa));if(_0x475efa['error']){if(_0x475efa[_0xbea4('0x12')][_0xbea4('0x13')]===0x1f4){logger[_0xbea4('0x12')](_0xbea4('0x14'),_0x39fbeb,_0x475efa[_0xbea4('0x12')][_0xbea4('0x15')]);return _0x292c8f(_0x475efa[_0xbea4('0x12')][_0xbea4('0x15')]);}logger[_0xbea4('0x12')](_0xbea4('0x14'),_0x39fbeb,_0x475efa['error'][_0xbea4('0x15')]);return _0xabdf84(_0x475efa[_0xbea4('0x12')][_0xbea4('0x15')]);}else{logger['info'](_0xbea4('0x14'),_0x39fbeb,'request\x20sent');_0xabdf84(_0x475efa[_0xbea4('0x16')][_0xbea4('0x15')]);}})[_0xbea4('0x17')](function(_0x3de07d){logger[_0xbea4('0x12')](_0xbea4('0x14'),_0x39fbeb,_0x3de07d);_0x292c8f(_0x3de07d);});});}exports['ShowSquareOdbc']=function(_0x431c41){var _0x337e95=this;return new Promise(function(_0xb5fa4e,_0x529121){return db[_0xbea4('0x18')][_0xbea4('0x19')]({'raw':_0x431c41[_0xbea4('0x1a')]?_0x431c41[_0xbea4('0x1a')][_0xbea4('0x1b')]===undefined?!![]:![]:!![],'where':_0x431c41[_0xbea4('0x1a')]?_0x431c41[_0xbea4('0x1a')][_0xbea4('0x1c')]||null:null,'attributes':_0x431c41[_0xbea4('0x1a')]?_0x431c41[_0xbea4('0x1a')][_0xbea4('0x1d')]||null:null,'include':_0x431c41[_0xbea4('0x1a')]?_0x431c41[_0xbea4('0x1a')]['include']?_[_0xbea4('0x1e')](_0x431c41[_0xbea4('0x1a')][_0xbea4('0x1f')],function(_0xf2da2){return{'model':db[_0xf2da2[_0xbea4('0x20')]],'as':_0xf2da2['as'],'attributes':_0xf2da2[_0xbea4('0x1d')],'include':_0xf2da2[_0xbea4('0x1f')]?_[_0xbea4('0x1e')](_0xf2da2[_0xbea4('0x1f')],function(_0xe09e08){return{'model':db[_0xe09e08[_0xbea4('0x20')]],'as':_0xe09e08['as'],'attributes':_0xe09e08['attributes'],'include':_0xe09e08[_0xbea4('0x1f')]?_['map'](_0xe09e08[_0xbea4('0x1f')],function(_0x5ae0d4){return{'model':db[_0x5ae0d4[_0xbea4('0x20')]],'as':_0x5ae0d4['as'],'attributes':_0x5ae0d4[_0xbea4('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xbea4('0xc')](function(_0x3b94ab){logger['info'](_0xbea4('0x21'),_0x431c41);logger[_0xbea4('0xf')](_0xbea4('0x21'),_0x431c41,JSON[_0xbea4('0x11')](_0x3b94ab));_0xb5fa4e(_0x3b94ab);})[_0xbea4('0x17')](function(_0x243f22){logger[_0xbea4('0x12')](_0xbea4('0x21'),_0x243f22['message'],_0x431c41);_0x529121(_0x337e95['error'](0x1f4,_0x243f22[_0xbea4('0x15')]));});});}; \ No newline at end of file +var _0x2394=['lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','SquareOdbc','options','where','attributes','include','map','model','then','ShowSquareOdbc','stringify'];(function(_0x5ca4b1,_0x50fa81){var _0x3970e6=function(_0x1fb8e2){while(--_0x1fb8e2){_0x5ca4b1['push'](_0x5ca4b1['shift']());}};_0x3970e6(++_0x50fa81);}(_0x2394,0xa0));var _0x4239=function(_0x3f4f78,_0x34055b){_0x3f4f78=_0x3f4f78-0x0;var _0x419576=_0x2394[_0x3f4f78];return _0x419576;};'use strict';var _=require(_0x4239('0x0'));var util=require(_0x4239('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4239('0x2'));var fs=require('fs');var Redis=require(_0x4239('0x3'));var db=require(_0x4239('0x4'))['db'];var utils=require(_0x4239('0x5'));var logger=require(_0x4239('0x6'))(_0x4239('0x7'));var config=require(_0x4239('0x8'));var jayson=require(_0x4239('0x9'));var client=jayson['client'][_0x4239('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4be3af,_0x394479,_0x359eed){return new BPromise(function(_0x359f15,_0x2ee482){return client[_0x4239('0xb')](_0x4be3af,_0x359eed)['then'](function(_0x1a1c7c){logger[_0x4239('0xc')](_0x4239('0xd'),_0x394479,_0x4239('0xe'));logger[_0x4239('0xf')](_0x4239('0x10'),_0x394479,_0x4239('0xe'),JSON['stringify'](_0x1a1c7c));if(_0x1a1c7c[_0x4239('0x11')]){if(_0x1a1c7c['error'][_0x4239('0x12')]===0x1f4){logger[_0x4239('0x11')](_0x4239('0xd'),_0x394479,_0x1a1c7c[_0x4239('0x11')][_0x4239('0x13')]);return _0x2ee482(_0x1a1c7c[_0x4239('0x11')][_0x4239('0x13')]);}logger[_0x4239('0x11')](_0x4239('0xd'),_0x394479,_0x1a1c7c[_0x4239('0x11')]['message']);return _0x359f15(_0x1a1c7c[_0x4239('0x11')]['message']);}else{logger[_0x4239('0xc')]('SquareOdbc,\x20%s,\x20%s',_0x394479,_0x4239('0xe'));_0x359f15(_0x1a1c7c[_0x4239('0x14')]['message']);}})[_0x4239('0x15')](function(_0x43b8a9){logger['error'](_0x4239('0xd'),_0x394479,_0x43b8a9);_0x2ee482(_0x43b8a9);});});}exports['ShowSquareOdbc']=function(_0x4d12b9){var _0x5b4ac5=this;return new Promise(function(_0x1d603c,_0x31da4c){return db[_0x4239('0x16')]['find']({'raw':_0x4d12b9[_0x4239('0x17')]?_0x4d12b9['options']['raw']===undefined?!![]:![]:!![],'where':_0x4d12b9[_0x4239('0x17')]?_0x4d12b9['options'][_0x4239('0x18')]||null:null,'attributes':_0x4d12b9[_0x4239('0x17')]?_0x4d12b9[_0x4239('0x17')][_0x4239('0x19')]||null:null,'include':_0x4d12b9[_0x4239('0x17')]?_0x4d12b9['options'][_0x4239('0x1a')]?_[_0x4239('0x1b')](_0x4d12b9[_0x4239('0x17')][_0x4239('0x1a')],function(_0x319311){return{'model':db[_0x319311[_0x4239('0x1c')]],'as':_0x319311['as'],'attributes':_0x319311[_0x4239('0x19')],'include':_0x319311[_0x4239('0x1a')]?_['map'](_0x319311[_0x4239('0x1a')],function(_0x444e8a){return{'model':db[_0x444e8a[_0x4239('0x1c')]],'as':_0x444e8a['as'],'attributes':_0x444e8a['attributes'],'include':_0x444e8a['include']?_[_0x4239('0x1b')](_0x444e8a['include'],function(_0x348d0c){return{'model':db[_0x348d0c[_0x4239('0x1c')]],'as':_0x348d0c['as'],'attributes':_0x348d0c['attributes']};}):[]};}):[]};}):[]:[]})[_0x4239('0x1d')](function(_0xf0e7ed){logger['info'](_0x4239('0x1e'),_0x4d12b9);logger[_0x4239('0xf')]('ShowSquareOdbc',_0x4d12b9,JSON[_0x4239('0x1f')](_0xf0e7ed));_0x1d603c(_0xf0e7ed);})[_0x4239('0x15')](function(_0x9cbc35){logger[_0x4239('0x11')](_0x4239('0x1e'),_0x9cbc35[_0x4239('0x13')],_0x4d12b9);_0x31da4c(_0x5b4ac5[_0x4239('0x11')](0x1f4,_0x9cbc35[_0x4239('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 9f481c5..54faba3 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 _0xc5ed=['index','show','post','create','put','/:id','update','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated'];(function(_0x4fbdc8,_0x265bdb){var _0x5dd79d=function(_0xe9d7c){while(--_0xe9d7c){_0x4fbdc8['push'](_0x4fbdc8['shift']());}};_0x5dd79d(++_0x265bdb);}(_0xc5ed,0x194));var _0xdc5e=function(_0x5e3e7d,_0x248b95){_0x5e3e7d=_0x5e3e7d-0x0;var _0x3fc549=_0xc5ed[_0x5e3e7d];return _0x3fc549;};'use strict';var multer=require('multer');var util=require(_0xdc5e('0x0'));var path=require(_0xdc5e('0x1'));var timeout=require('connect-timeout');var express=require(_0xdc5e('0x2'));var router=express[_0xdc5e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xdc5e('0x4'));var interaction=require(_0xdc5e('0x5'));var config=require(_0xdc5e('0x6'));var controller=require(_0xdc5e('0x7'));router[_0xdc5e('0x8')]('/',auth[_0xdc5e('0x9')](),controller[_0xdc5e('0xa')]);router[_0xdc5e('0x8')]('/:id',auth[_0xdc5e('0x9')](),controller[_0xdc5e('0xb')]);router[_0xdc5e('0xc')]('/',auth[_0xdc5e('0x9')](),controller[_0xdc5e('0xd')]);router[_0xdc5e('0xe')](_0xdc5e('0xf'),auth[_0xdc5e('0x9')](),controller[_0xdc5e('0x10')]);router['delete'](_0xdc5e('0xf'),auth[_0xdc5e('0x9')](),controller['destroy']);module[_0xdc5e('0x11')]=router; \ No newline at end of file +var _0x2bea=['delete','destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x2bea,0x75));var _0xa2be=function(_0x57c4bb,_0x395d85){_0x57c4bb=_0x57c4bb-0x0;var _0x54cc20=_0x2bea[_0x57c4bb];return _0x54cc20;};'use strict';var multer=require('multer');var util=require(_0xa2be('0x0'));var path=require(_0xa2be('0x1'));var timeout=require('connect-timeout');var express=require(_0xa2be('0x2'));var router=express['Router']();var fs_extra=require(_0xa2be('0x3'));var auth=require(_0xa2be('0x4'));var interaction=require(_0xa2be('0x5'));var config=require(_0xa2be('0x6'));var controller=require(_0xa2be('0x7'));router[_0xa2be('0x8')]('/',auth[_0xa2be('0x9')](),controller[_0xa2be('0xa')]);router[_0xa2be('0x8')](_0xa2be('0xb'),auth[_0xa2be('0x9')](),controller[_0xa2be('0xc')]);router[_0xa2be('0xd')]('/',auth[_0xa2be('0x9')](),controller[_0xa2be('0xe')]);router[_0xa2be('0xf')](_0xa2be('0xb'),auth[_0xa2be('0x9')](),controller['update']);router[_0xa2be('0x10')](_0xa2be('0xb'),auth[_0xa2be('0x9')](),controller[_0xa2be('0x11')]);module[_0xa2be('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 05bd968..180bb53 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 _0xa7ee=['utf8','long','production','DATE','sequelize','STRING','name','TEXT','getDataValue','preproduction','toString'];(function(_0x328b40,_0x370642){var _0x556a56=function(_0x467553){while(--_0x467553){_0x328b40['push'](_0x328b40['shift']());}};_0x556a56(++_0x370642);}(_0xa7ee,0x159));var _0xea7e=function(_0x68359d,_0x51477f){_0x68359d=_0x68359d-0x0;var _0x15d875=_0xa7ee[_0x68359d];return _0x15d875;};'use strict';var Sequelize=require(_0xea7e('0x0'));module['exports']={'name':{'type':Sequelize[_0xea7e('0x1')],'unique':_0xea7e('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xea7e('0x1')]},'notes':{'type':Sequelize[_0xea7e('0x3')]},'preproduction':{'type':Sequelize['BLOB']('long'),'get':function(){if(this[_0xea7e('0x4')]('preproduction')){return this[_0xea7e('0x4')](_0xea7e('0x5'))[_0xea7e('0x6')](_0xea7e('0x7'));}}},'production':{'type':Sequelize['BLOB'](_0xea7e('0x8')),'get':function(){if(this[_0xea7e('0x4')](_0xea7e('0x9'))){return this[_0xea7e('0x4')](_0xea7e('0x9'))['toString']('utf8');}}},'savedAt':{'type':Sequelize[_0xea7e('0xa')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x04bc=['production','toString','DATE','sequelize','exports','STRING','name','BLOB','long','getDataValue','preproduction','utf8'];(function(_0x1324dd,_0x379837){var _0x4023ab=function(_0x56356b){while(--_0x56356b){_0x1324dd['push'](_0x1324dd['shift']());}};_0x4023ab(++_0x379837);}(_0x04bc,0x87));var _0xc04b=function(_0x43511b,_0x3e2b51){_0x43511b=_0x43511b-0x0;var _0x1fb9de=_0x04bc[_0x43511b];return _0x1fb9de;};'use strict';var Sequelize=require(_0xc04b('0x0'));module[_0xc04b('0x1')]={'name':{'type':Sequelize[_0xc04b('0x2')],'unique':_0xc04b('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xc04b('0x2')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0xc04b('0x4')](_0xc04b('0x5')),'get':function(){if(this[_0xc04b('0x6')](_0xc04b('0x7'))){return this[_0xc04b('0x6')](_0xc04b('0x7'))['toString'](_0xc04b('0x8'));}}},'production':{'type':Sequelize[_0xc04b('0x4')](_0xc04b('0x5')),'get':function(){if(this['getDataValue']('production')){return this['getDataValue'](_0xc04b('0x9'))[_0xc04b('0xa')]('utf8');}}},'savedAt':{'type':Sequelize[_0xc04b('0xb')]},'publishedAt':{'type':Sequelize[_0xc04b('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 220b267..ed4de16 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 _0xd949=['stringify','end','sendStatus','error','name','index','map','SquareProject','type','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','include','rows','catch','params','rawAttributes','length','includeAll','options','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','body','find','production','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','status','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','get','SquareProjects','UserProfileResource','publish','agi'];(function(_0x371fab,_0x8629a0){var _0x388ca4=function(_0x20967b){while(--_0x20967b){_0x371fab['push'](_0x371fab['shift']());}};_0x388ca4(++_0x8629a0);}(_0xd949,0x1b2));var _0x9d94=function(_0x84b885,_0x5594fa){_0x84b885=_0x84b885-0x0;var _0x14c0ac=_0xd949[_0x84b885];return _0x14c0ac;};'use strict';var _=require(_0x9d94('0x0'));var Redis=require(_0x9d94('0x1'));var qs=require(_0x9d94('0x2'));var logger=require(_0x9d94('0x3'))('api');var config=require(_0x9d94('0x4'));var db=require(_0x9d94('0x5'))['db'];config[_0x9d94('0x6')]=_[_0x9d94('0x7')](config[_0x9d94('0x6')],{'host':_0x9d94('0x8'),'port':0x18eb});var socket=require(_0x9d94('0x9'))(new Redis(config[_0x9d94('0x6')]));require(_0x9d94('0xa'))[_0x9d94('0xb')](socket);function respondWithResult(_0x378b68,_0x6b18df){_0x6b18df=_0x6b18df||0xc8;return function(_0x3f7414){if(_0x3f7414){return _0x378b68[_0x9d94('0xc')](_0x6b18df)['json'](_0x3f7414);}};}function respondWithFilteredResult(_0x3fd731,_0x154648){return function(_0x25b7f1){if(_0x25b7f1){var _0x34438a=typeof _0x154648[_0x9d94('0xd')]===_0x9d94('0xe')&&typeof _0x154648[_0x9d94('0xf')]===_0x9d94('0xe');var _0x5445a3=_0x25b7f1[_0x9d94('0x10')];var _0x404bed=_0x34438a?0x0:_0x154648['offset'];var _0x3a3418=_0x34438a?_0x25b7f1[_0x9d94('0x10')]:_0x154648['offset']+_0x154648[_0x9d94('0xf')];var _0x56ccc7;if(_0x3a3418>=_0x5445a3){_0x3a3418=_0x5445a3;_0x56ccc7=0xc8;}else{_0x56ccc7=0xce;}_0x3fd731[_0x9d94('0xc')](_0x56ccc7);return _0x3fd731[_0x9d94('0x11')](_0x9d94('0x12'),_0x404bed+'-'+_0x3a3418+'/'+_0x5445a3)[_0x9d94('0x13')](_0x25b7f1);}return null;};}function saveUpdates(_0x349114){return function(_0xeb2dd6){if(_0xeb2dd6){return _0xeb2dd6[_0x9d94('0x14')](_0x349114)[_0x9d94('0x15')](function(_0x3a9a99){return _0x3a9a99;});}return null;};}function removeEntity(_0xaa4911){return function(_0x2862fa){if(_0x2862fa){return _0x2862fa[_0x9d94('0x16')]()[_0x9d94('0x15')](function(){var _0x1072da=_0x2862fa[_0x9d94('0x17')]({'plain':!![]});var _0x3200ca=_0x9d94('0x18');return db[_0x9d94('0x19')][_0x9d94('0x16')]({'where':{'type':_0x3200ca,'resourceId':_0x1072da['id']}})['then'](function(){return _0x2862fa;});})['then'](function(){var _0x21004f=new Redis(config[_0x9d94('0x6')]);_0x21004f[_0x9d94('0x1a')](_0x9d94('0x1b'),JSON[_0x9d94('0x1c')]({'id':_0x2862fa['id'],'deleted':!![]}));})[_0x9d94('0x15')](function(){_0xaa4911[_0x9d94('0xc')](0xcc)[_0x9d94('0x1d')]();});}};}function handleEntityNotFound(_0x131ad0){return function(_0x4a117f){if(!_0x4a117f){_0x131ad0[_0x9d94('0x1e')](0x194);}return _0x4a117f;};}function handleError(_0x1506a1,_0x4ab060){_0x4ab060=_0x4ab060||0x1f4;return function(_0x3ecc43){logger[_0x9d94('0x1f')](_0x3ecc43['stack']);if(_0x3ecc43[_0x9d94('0x20')]){delete _0x3ecc43['name'];}_0x1506a1[_0x9d94('0xc')](_0x4ab060)['send'](_0x3ecc43);};}exports[_0x9d94('0x21')]=function(_0x1678ec,_0x1c284d){var _0x440011={},_0x411c7f={},_0x203e08={'count':0x0,'rows':[]};var _0x2ca550=_[_0x9d94('0x22')](db[_0x9d94('0x23')]['rawAttributes'],function(_0x1f6694){return{'name':_0x1f6694['fieldName'],'type':_0x1f6694[_0x9d94('0x24')]['key']};});_0x411c7f[_0x9d94('0x25')]=_[_0x9d94('0x22')](_0x2ca550,'name');_0x411c7f[_0x9d94('0x26')]=_[_0x9d94('0x27')](_0x1678ec[_0x9d94('0x26')]);_0x411c7f[_0x9d94('0x28')]=_['intersection'](_0x411c7f['model'],_0x411c7f['query']);_0x440011[_0x9d94('0x29')]=_[_0x9d94('0x2a')](_0x411c7f[_0x9d94('0x25')],qs[_0x9d94('0x2b')](_0x1678ec['query'][_0x9d94('0x2b')]));_0x440011[_0x9d94('0x29')]=_0x440011[_0x9d94('0x29')]['length']?_0x440011[_0x9d94('0x29')]:_0x411c7f[_0x9d94('0x25')];if(!_0x1678ec[_0x9d94('0x26')]['hasOwnProperty'](_0x9d94('0x2c'))){_0x440011[_0x9d94('0xf')]=qs['limit'](_0x1678ec['query'][_0x9d94('0xf')]);_0x440011[_0x9d94('0xd')]=qs[_0x9d94('0xd')](_0x1678ec['query'][_0x9d94('0xd')]);}_0x440011[_0x9d94('0x2d')]=qs[_0x9d94('0x2e')](_0x1678ec['query'][_0x9d94('0x2e')]);_0x440011[_0x9d94('0x2f')]=qs[_0x9d94('0x28')](_[_0x9d94('0x30')](_0x1678ec[_0x9d94('0x26')],_0x411c7f[_0x9d94('0x28')]),_0x2ca550);if(_0x1678ec[_0x9d94('0x26')][_0x9d94('0x31')]){_0x440011[_0x9d94('0x2f')]=_['merge'](_0x440011['where'],{'$or':_[_0x9d94('0x22')](_0x2ca550,function(_0x32fa9e){if(_0x32fa9e[_0x9d94('0x24')]!==_0x9d94('0x32')){var _0x3353f7={};_0x3353f7[_0x32fa9e[_0x9d94('0x20')]]={'$like':'%'+_0x1678ec[_0x9d94('0x26')][_0x9d94('0x31')]+'%'};return _0x3353f7;}})});}_0x440011=_[_0x9d94('0x33')]({},_0x440011,_0x1678ec['options']);var _0x40349b={'where':_0x440011[_0x9d94('0x2f')]};return db['SquareProject']['count'](_0x40349b)['then'](function(_0x1bc11f){_0x203e08['count']=_0x1bc11f;if(_0x1678ec[_0x9d94('0x26')]['includeAll']){_0x440011[_0x9d94('0x34')]=[{'all':!![]}];}return db[_0x9d94('0x23')]['findAll'](_0x440011);})[_0x9d94('0x15')](function(_0x4088df){_0x203e08[_0x9d94('0x35')]=_0x4088df;return _0x203e08;})[_0x9d94('0x15')](respondWithFilteredResult(_0x1c284d,_0x440011))[_0x9d94('0x36')](handleError(_0x1c284d,null));};exports['show']=function(_0x4532f3,_0x62d29d){var _0x101e55={'raw':![],'where':{'id':_0x4532f3[_0x9d94('0x37')]['id']}},_0x5bc2c8={};_0x5bc2c8['model']=_[_0x9d94('0x27')](db[_0x9d94('0x23')][_0x9d94('0x38')]);_0x5bc2c8[_0x9d94('0x26')]=_[_0x9d94('0x27')](_0x4532f3[_0x9d94('0x26')]);_0x5bc2c8[_0x9d94('0x28')]=_[_0x9d94('0x2a')](_0x5bc2c8[_0x9d94('0x25')],_0x5bc2c8[_0x9d94('0x26')]);_0x101e55[_0x9d94('0x29')]=_[_0x9d94('0x2a')](_0x5bc2c8['model'],qs[_0x9d94('0x2b')](_0x4532f3['query']['fields']));_0x101e55[_0x9d94('0x29')]=_0x101e55[_0x9d94('0x29')][_0x9d94('0x39')]?_0x101e55[_0x9d94('0x29')]:_0x5bc2c8[_0x9d94('0x25')];if(_0x4532f3[_0x9d94('0x26')][_0x9d94('0x3a')]){_0x101e55['include']=[{'all':!![]}];}_0x101e55=_[_0x9d94('0x33')]({},_0x101e55,_0x4532f3[_0x9d94('0x3b')]);return db[_0x9d94('0x23')]['find'](_0x101e55)[_0x9d94('0x15')](handleEntityNotFound(_0x62d29d,null))['then'](respondWithResult(_0x62d29d,null))[_0x9d94('0x36')](handleError(_0x62d29d,null));};exports['create']=function(_0x14a8e3,_0x457dfd){return db[_0x9d94('0x23')]['create'](_0x14a8e3['body'],{})[_0x9d94('0x15')](function(_0x367b59){var _0x4c656c=_0x14a8e3['user'][_0x9d94('0x17')]({'plain':!![]});if(!_0x4c656c)throw new Error(_0x9d94('0x3c'));if(_0x4c656c['role']==='user'){var _0x3137f3=_0x367b59[_0x9d94('0x17')]({'plain':!![]});var _0x15e3fc=_0x9d94('0x18');return db[_0x9d94('0x3d')]['find']({'where':{'name':_0x15e3fc,'userProfileId':_0x4c656c[_0x9d94('0x3e')]},'raw':!![]})[_0x9d94('0x15')](function(_0x259ace){if(_0x259ace&&_0x259ace['autoAssociation']===0x0){return db[_0x9d94('0x19')]['create']({'name':_0x3137f3['name'],'resourceId':_0x3137f3['id'],'type':_0x259ace[_0x9d94('0x20')],'sectionId':_0x259ace['id']},{})['then'](function(){return _0x367b59;});}else{return _0x367b59;}})[_0x9d94('0x36')](function(_0x310ab3){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x310ab3);throw _0x310ab3;});}return _0x367b59;})[_0x9d94('0x15')](respondWithResult(_0x457dfd,0xc9))[_0x9d94('0x36')](handleError(_0x457dfd,null));};exports[_0x9d94('0x14')]=function(_0x52c22a,_0x1aa9b9){if(_0x52c22a['body']['id']){delete _0x52c22a[_0x9d94('0x3f')]['id'];}return db[_0x9d94('0x23')][_0x9d94('0x40')]({'where':{'id':_0x52c22a[_0x9d94('0x37')]['id']}})[_0x9d94('0x15')](handleEntityNotFound(_0x1aa9b9,null))[_0x9d94('0x15')](saveUpdates(_0x52c22a[_0x9d94('0x3f')],null))[_0x9d94('0x15')](function(_0x2f1a02){if(!_0x2f1a02)return;var _0x255b78=_0x2f1a02['get']({'plain':!![]});return _0x255b78;})[_0x9d94('0x15')](function(_0x36ef42){var _0x189809=new Redis(config[_0x9d94('0x6')]);_0x189809[_0x9d94('0x1a')]('agi',JSON[_0x9d94('0x1c')](_['pick'](_0x36ef42,['id',_0x9d94('0x20'),_0x9d94('0x41')])));return _0x36ef42;})[_0x9d94('0x15')](respondWithResult(_0x1aa9b9,null))['catch'](handleError(_0x1aa9b9,null));};exports['destroy']=function(_0x86fdcb,_0xaf2064){return db[_0x9d94('0x23')][_0x9d94('0x40')]({'where':{'id':_0x86fdcb[_0x9d94('0x37')]['id']}})[_0x9d94('0x15')](handleEntityNotFound(_0xaf2064,null))[_0x9d94('0x15')](removeEntity(_0xaf2064,null))[_0x9d94('0x36')](handleError(_0xaf2064,null));}; \ No newline at end of file +var _0x5289=['rows','show','params','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','production','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','status','json','undefined','limit','count','offset','set','update','then','destroy','get','SquareProjects','UserProfileResource','publish','agi','end','error','name','index','map','SquareProject','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll'];(function(_0x2c8bc7,_0x4ff58d){var _0x3a1da5=function(_0x133eb4){while(--_0x133eb4){_0x2c8bc7['push'](_0x2c8bc7['shift']());}};_0x3a1da5(++_0x4ff58d);}(_0x5289,0x1b2));var _0x9528=function(_0x4fc0fc,_0x36bb55){_0x4fc0fc=_0x4fc0fc-0x0;var _0xf9689=_0x5289[_0x4fc0fc];return _0xf9689;};'use strict';var _=require(_0x9528('0x0'));var Redis=require('ioredis');var qs=require(_0x9528('0x1'));var logger=require(_0x9528('0x2'))(_0x9528('0x3'));var config=require(_0x9528('0x4'));var db=require('../../mysqldb')['db'];config[_0x9528('0x5')]=_[_0x9528('0x6')](config[_0x9528('0x5')],{'host':_0x9528('0x7'),'port':0x18eb});var socket=require(_0x9528('0x8'))(new Redis(config[_0x9528('0x5')]));require(_0x9528('0x9'))[_0x9528('0xa')](socket);function respondWithResult(_0x20ebb5,_0x57dc3){_0x57dc3=_0x57dc3||0xc8;return function(_0x3de24b){if(_0x3de24b){return _0x20ebb5[_0x9528('0xb')](_0x57dc3)[_0x9528('0xc')](_0x3de24b);}};}function respondWithFilteredResult(_0x295b77,_0x3ca5f7){return function(_0x4c55d7){if(_0x4c55d7){var _0x310bec=typeof _0x3ca5f7['offset']===_0x9528('0xd')&&typeof _0x3ca5f7[_0x9528('0xe')]===_0x9528('0xd');var _0x3e1809=_0x4c55d7[_0x9528('0xf')];var _0x112150=_0x310bec?0x0:_0x3ca5f7['offset'];var _0x583089=_0x310bec?_0x4c55d7[_0x9528('0xf')]:_0x3ca5f7[_0x9528('0x10')]+_0x3ca5f7[_0x9528('0xe')];var _0x50d88f;if(_0x583089>=_0x3e1809){_0x583089=_0x3e1809;_0x50d88f=0xc8;}else{_0x50d88f=0xce;}_0x295b77[_0x9528('0xb')](_0x50d88f);return _0x295b77[_0x9528('0x11')]('Content-Range',_0x112150+'-'+_0x583089+'/'+_0x3e1809)['json'](_0x4c55d7);}return null;};}function saveUpdates(_0x24b813){return function(_0x52fe18){if(_0x52fe18){return _0x52fe18[_0x9528('0x12')](_0x24b813)[_0x9528('0x13')](function(_0x5f2e44){return _0x5f2e44;});}return null;};}function removeEntity(_0x2545de){return function(_0xbdf5e2){if(_0xbdf5e2){return _0xbdf5e2[_0x9528('0x14')]()[_0x9528('0x13')](function(){var _0x24834a=_0xbdf5e2[_0x9528('0x15')]({'plain':!![]});var _0x4c4b05=_0x9528('0x16');return db[_0x9528('0x17')]['destroy']({'where':{'type':_0x4c4b05,'resourceId':_0x24834a['id']}})[_0x9528('0x13')](function(){return _0xbdf5e2;});})['then'](function(){var _0x3769b7=new Redis(config[_0x9528('0x5')]);_0x3769b7[_0x9528('0x18')](_0x9528('0x19'),JSON['stringify']({'id':_0xbdf5e2['id'],'deleted':!![]}));})[_0x9528('0x13')](function(){_0x2545de[_0x9528('0xb')](0xcc)[_0x9528('0x1a')]();});}};}function handleEntityNotFound(_0x3f30e1){return function(_0x3b698e){if(!_0x3b698e){_0x3f30e1['sendStatus'](0x194);}return _0x3b698e;};}function handleError(_0x166cca,_0x56788b){_0x56788b=_0x56788b||0x1f4;return function(_0x10cf80){logger[_0x9528('0x1b')](_0x10cf80['stack']);if(_0x10cf80[_0x9528('0x1c')]){delete _0x10cf80[_0x9528('0x1c')];}_0x166cca[_0x9528('0xb')](_0x56788b)['send'](_0x10cf80);};}exports[_0x9528('0x1d')]=function(_0x53fb5c,_0x4ab248){var _0x3a359f={},_0x513494={},_0x2878d1={'count':0x0,'rows':[]};var _0x516a84=_[_0x9528('0x1e')](db[_0x9528('0x1f')][_0x9528('0x20')],function(_0x30d39a){return{'name':_0x30d39a[_0x9528('0x21')],'type':_0x30d39a[_0x9528('0x22')][_0x9528('0x23')]};});_0x513494[_0x9528('0x24')]=_[_0x9528('0x1e')](_0x516a84,_0x9528('0x1c'));_0x513494[_0x9528('0x25')]=_[_0x9528('0x26')](_0x53fb5c[_0x9528('0x25')]);_0x513494[_0x9528('0x27')]=_['intersection'](_0x513494['model'],_0x513494['query']);_0x3a359f['attributes']=_[_0x9528('0x28')](_0x513494[_0x9528('0x24')],qs[_0x9528('0x29')](_0x53fb5c[_0x9528('0x25')][_0x9528('0x29')]));_0x3a359f[_0x9528('0x2a')]=_0x3a359f[_0x9528('0x2a')][_0x9528('0x2b')]?_0x3a359f[_0x9528('0x2a')]:_0x513494[_0x9528('0x24')];if(!_0x53fb5c[_0x9528('0x25')][_0x9528('0x2c')](_0x9528('0x2d'))){_0x3a359f[_0x9528('0xe')]=qs[_0x9528('0xe')](_0x53fb5c[_0x9528('0x25')]['limit']);_0x3a359f[_0x9528('0x10')]=qs[_0x9528('0x10')](_0x53fb5c[_0x9528('0x25')]['offset']);}_0x3a359f[_0x9528('0x2e')]=qs[_0x9528('0x2f')](_0x53fb5c['query']['sort']);_0x3a359f['where']=qs[_0x9528('0x27')](_[_0x9528('0x30')](_0x53fb5c[_0x9528('0x25')],_0x513494[_0x9528('0x27')]),_0x516a84);if(_0x53fb5c['query'][_0x9528('0x31')]){_0x3a359f[_0x9528('0x32')]=_[_0x9528('0x33')](_0x3a359f[_0x9528('0x32')],{'$or':_[_0x9528('0x1e')](_0x516a84,function(_0x5f7e79){if(_0x5f7e79[_0x9528('0x22')]!=='VIRTUAL'){var _0x340b1e={};_0x340b1e[_0x5f7e79[_0x9528('0x1c')]]={'$like':'%'+_0x53fb5c[_0x9528('0x25')][_0x9528('0x31')]+'%'};return _0x340b1e;}})});}_0x3a359f=_['merge']({},_0x3a359f,_0x53fb5c[_0x9528('0x34')]);var _0x3761bf={'where':_0x3a359f[_0x9528('0x32')]};return db[_0x9528('0x1f')][_0x9528('0xf')](_0x3761bf)[_0x9528('0x13')](function(_0x141a2b){_0x2878d1['count']=_0x141a2b;if(_0x53fb5c[_0x9528('0x25')][_0x9528('0x35')]){_0x3a359f[_0x9528('0x36')]=[{'all':!![]}];}return db['SquareProject'][_0x9528('0x37')](_0x3a359f);})['then'](function(_0x6bdf32){_0x2878d1[_0x9528('0x38')]=_0x6bdf32;return _0x2878d1;})['then'](respondWithFilteredResult(_0x4ab248,_0x3a359f))['catch'](handleError(_0x4ab248,null));};exports[_0x9528('0x39')]=function(_0x1cac25,_0x2cc41d){var _0x3b4387={'raw':![],'where':{'id':_0x1cac25[_0x9528('0x3a')]['id']}},_0x4aeeb3={};_0x4aeeb3[_0x9528('0x24')]=_[_0x9528('0x26')](db[_0x9528('0x1f')][_0x9528('0x20')]);_0x4aeeb3[_0x9528('0x25')]=_[_0x9528('0x26')](_0x1cac25['query']);_0x4aeeb3[_0x9528('0x27')]=_[_0x9528('0x28')](_0x4aeeb3[_0x9528('0x24')],_0x4aeeb3['query']);_0x3b4387[_0x9528('0x2a')]=_[_0x9528('0x28')](_0x4aeeb3[_0x9528('0x24')],qs[_0x9528('0x29')](_0x1cac25['query'][_0x9528('0x29')]));_0x3b4387['attributes']=_0x3b4387[_0x9528('0x2a')]['length']?_0x3b4387['attributes']:_0x4aeeb3[_0x9528('0x24')];if(_0x1cac25['query'][_0x9528('0x35')]){_0x3b4387['include']=[{'all':!![]}];}_0x3b4387=_[_0x9528('0x33')]({},_0x3b4387,_0x1cac25['options']);return db['SquareProject'][_0x9528('0x3b')](_0x3b4387)['then'](handleEntityNotFound(_0x2cc41d,null))[_0x9528('0x13')](respondWithResult(_0x2cc41d,null))[_0x9528('0x3c')](handleError(_0x2cc41d,null));};exports[_0x9528('0x3d')]=function(_0x85cb84,_0x2a3f44){return db[_0x9528('0x1f')][_0x9528('0x3d')](_0x85cb84[_0x9528('0x3e')],{})[_0x9528('0x13')](function(_0x175d19){var _0x256c4a=_0x85cb84['user'][_0x9528('0x15')]({'plain':!![]});if(!_0x256c4a)throw new Error(_0x9528('0x3f'));if(_0x256c4a[_0x9528('0x40')]==='user'){var _0x2cf009=_0x175d19[_0x9528('0x15')]({'plain':!![]});var _0x2ce9ee=_0x9528('0x16');return db[_0x9528('0x41')][_0x9528('0x3b')]({'where':{'name':_0x2ce9ee,'userProfileId':_0x256c4a[_0x9528('0x42')]},'raw':!![]})[_0x9528('0x13')](function(_0x58e50e){if(_0x58e50e&&_0x58e50e[_0x9528('0x43')]===0x0){return db[_0x9528('0x17')]['create']({'name':_0x2cf009['name'],'resourceId':_0x2cf009['id'],'type':_0x58e50e[_0x9528('0x1c')],'sectionId':_0x58e50e['id']},{})['then'](function(){return _0x175d19;});}else{return _0x175d19;}})[_0x9528('0x3c')](function(_0x38aaff){logger[_0x9528('0x1b')](_0x9528('0x44'),_0x38aaff);throw _0x38aaff;});}return _0x175d19;})[_0x9528('0x13')](respondWithResult(_0x2a3f44,0xc9))['catch'](handleError(_0x2a3f44,null));};exports[_0x9528('0x12')]=function(_0x1fd533,_0x31634e){if(_0x1fd533['body']['id']){delete _0x1fd533[_0x9528('0x3e')]['id'];}return db['SquareProject'][_0x9528('0x3b')]({'where':{'id':_0x1fd533[_0x9528('0x3a')]['id']}})[_0x9528('0x13')](handleEntityNotFound(_0x31634e,null))[_0x9528('0x13')](saveUpdates(_0x1fd533[_0x9528('0x3e')],null))['then'](function(_0x46278b){if(!_0x46278b)return;var _0x540a87=_0x46278b[_0x9528('0x15')]({'plain':!![]});return _0x540a87;})[_0x9528('0x13')](function(_0x43bc0c){var _0x1b1012=new Redis(config[_0x9528('0x5')]);_0x1b1012[_0x9528('0x18')](_0x9528('0x19'),JSON['stringify'](_[_0x9528('0x30')](_0x43bc0c,['id','name',_0x9528('0x45')])));return _0x43bc0c;})[_0x9528('0x13')](respondWithResult(_0x31634e,null))[_0x9528('0x3c')](handleError(_0x31634e,null));};exports[_0x9528('0x14')]=function(_0x7f36da,_0x118f32){return db['SquareProject']['find']({'where':{'id':_0x7f36da[_0x9528('0x3a')]['id']}})['then'](handleEntityNotFound(_0x118f32,null))[_0x9528('0x13')](removeEntity(_0x118f32,null))[_0x9528('0x3c')](handleError(_0x118f32,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 664017d..e290510 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 _0x14a6=['setMaxListeners','save','emit','hasOwnProperty','hook','exports','events','SquareProject'];(function(_0xd36370,_0x5ea327){var _0x272d21=function(_0x245cd4){while(--_0x245cd4){_0xd36370['push'](_0xd36370['shift']());}};_0x272d21(++_0x5ea327);}(_0x14a6,0x176));var _0x614a=function(_0x4874c2,_0x3ce845){_0x4874c2=_0x4874c2-0x0;var _0x3cdd3e=_0x14a6[_0x4874c2];return _0x3cdd3e;};'use strict';var EventEmitter=require(_0x614a('0x0'));var SquareProject=require('../../mysqldb')['db'][_0x614a('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x614a('0x2')](0x0);var events={'afterCreate':_0x614a('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5f0dc4){return function(_0x119bfe,_0x55df11,_0x540839){SquareProjectEvents['emit'](_0x5f0dc4+':'+_0x119bfe['id'],_0x119bfe);SquareProjectEvents[_0x614a('0x4')](_0x5f0dc4,_0x119bfe);_0x540839(null);};}for(var e in events){if(events[_0x614a('0x5')](e)){var event=events[e];SquareProject[_0x614a('0x6')](e,emitEvent(event));}}module[_0x614a('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0x8ec9=['hook','exports','events','../../mysqldb','SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8ec9,0xf4));var _0x98ec=function(_0x159de8,_0x2d2ad9){_0x159de8=_0x159de8-0x0;var _0x1332f8=_0x8ec9[_0x159de8];return _0x1332f8;};'use strict';var EventEmitter=require(_0x98ec('0x0'));var SquareProject=require(_0x98ec('0x1'))['db'][_0x98ec('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x98ec('0x3')](0x0);var events={'afterCreate':_0x98ec('0x4'),'afterUpdate':_0x98ec('0x5'),'afterDestroy':_0x98ec('0x6')};function emitEvent(_0x5ad660){return function(_0x563355,_0x52c8db,_0x2487f2){SquareProjectEvents[_0x98ec('0x7')](_0x5ad660+':'+_0x563355['id'],_0x563355);SquareProjectEvents[_0x98ec('0x7')](_0x5ad660,_0x563355);_0x2487f2(null);};}for(var e in events){if(events[_0x98ec('0x8')](e)){var event=events[e];SquareProject[_0x98ec('0x9')](e,emitEvent(event));}}module[_0x98ec('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 f60fa3d..5788820 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 _0x979e=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./squareProject.attributes','define','SquareProject','changed','preproduction','format','production','publishedAt','YYYY-MM-DD\x20HH:mm:ss','util'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x979e,0x153));var _0xe979=function(_0x4882ae,_0x4c7b7b){_0x4882ae=_0x4882ae-0x0;var _0x456b80=_0x979e[_0x4882ae];return _0x456b80;};'use strict';var _=require('lodash');var util=require(_0xe979('0x0'));var logger=require(_0xe979('0x1'))(_0xe979('0x2'));var moment=require(_0xe979('0x3'));var BPromise=require(_0xe979('0x4'));var rp=require(_0xe979('0x5'));var fs=require('fs');var path=require(_0xe979('0x6'));var rimraf=require(_0xe979('0x7'));var config=require('../../config/environment');var attributes=require(_0xe979('0x8'));module['exports']=function(_0x5d7cf7,_0x55212f){return _0x5d7cf7[_0xe979('0x9')](_0xe979('0xa'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3a50e0,_0x3a1668,_0x5f4eee){if(_0x3a50e0[_0xe979('0xb')](_0xe979('0xc'))){_0x3a50e0['savedAt']=moment()[_0xe979('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x3a50e0[_0xe979('0xb')](_0xe979('0xe'))){_0x3a50e0[_0xe979('0xf')]=moment()['format'](_0xe979('0x10'));}_0x5f4eee(null,_0x3a50e0);}}});}; \ No newline at end of file +var _0x97c2=['production','publishedAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects','preproduction','format','YYYY-MM-DD\x20HH:mm:ss','changed'];(function(_0x38857f,_0x54e6bf){var _0x574b0a=function(_0x1f88c9){while(--_0x1f88c9){_0x38857f['push'](_0x38857f['shift']());}};_0x574b0a(++_0x54e6bf);}(_0x97c2,0x17c));var _0x297c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x97c2[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x297c('0x0'));var util=require(_0x297c('0x1'));var logger=require(_0x297c('0x2'))(_0x297c('0x3'));var moment=require(_0x297c('0x4'));var BPromise=require(_0x297c('0x5'));var rp=require(_0x297c('0x6'));var fs=require('fs');var path=require(_0x297c('0x7'));var rimraf=require(_0x297c('0x8'));var config=require(_0x297c('0x9'));var attributes=require(_0x297c('0xa'));module[_0x297c('0xb')]=function(_0x441a28,_0x167486){return _0x441a28[_0x297c('0xc')](_0x297c('0xd'),attributes,{'tableName':_0x297c('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x395e7e,_0x1cd2c6,_0x182825){if(_0x395e7e['changed'](_0x297c('0xf'))){_0x395e7e['savedAt']=moment()[_0x297c('0x10')](_0x297c('0x11'));}if(_0x395e7e[_0x297c('0x12')](_0x297c('0x13'))){_0x395e7e[_0x297c('0x14')]=moment()[_0x297c('0x10')](_0x297c('0x11'));}_0x182825(null,_0x395e7e);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 3e70d7c..354e38f 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 _0xc5a9=['../../config/logger','rpc','../../config/environment','redis','localhost','socket.io-emitter','./squareProject.socket','SquareProject','findAll','options','raw','where','limit','include','map','attributes','model','then','info','debug','catch','error','GetSquareProjects','message','ShowSquareProject','find','stringify','ioredis','../../mysqldb'];(function(_0x48dcc3,_0x2f1cb7){var _0x3c1fcc=function(_0x4e7973){while(--_0x4e7973){_0x48dcc3['push'](_0x48dcc3['shift']());}};_0x3c1fcc(++_0x2f1cb7);}(_0xc5a9,0x1b1));var _0x9c5a=function(_0x365e54,_0x44be74){_0x365e54=_0x365e54-0x0;var _0x13317a=_0xc5a9[_0x365e54];return _0x13317a;};'use strict';var _=require('lodash');var Redis=require(_0x9c5a('0x0'));var db=require(_0x9c5a('0x1'))['db'];var logger=require(_0x9c5a('0x2'))(_0x9c5a('0x3'));var config=require(_0x9c5a('0x4'));config[_0x9c5a('0x5')]=_['defaults'](config[_0x9c5a('0x5')],{'host':_0x9c5a('0x6'),'port':0x18eb});var socket=require(_0x9c5a('0x7'))(new Redis(config[_0x9c5a('0x5')]));require(_0x9c5a('0x8'))['register'](socket);exports['GetSquareProjects']=function(_0x738f1a){var _0x4667f1=this;return new Promise(function(_0x4d18be,_0x76694c){return db[_0x9c5a('0x9')][_0x9c5a('0xa')]({'raw':_0x738f1a[_0x9c5a('0xb')]?_0x738f1a[_0x9c5a('0xb')][_0x9c5a('0xc')]===undefined?!![]:![]:!![],'where':_0x738f1a[_0x9c5a('0xb')]?_0x738f1a[_0x9c5a('0xb')][_0x9c5a('0xd')]||null:null,'attributes':_0x738f1a[_0x9c5a('0xb')]?_0x738f1a[_0x9c5a('0xb')]['attributes']||null:null,'limit':_0x738f1a[_0x9c5a('0xb')]?_0x738f1a['options'][_0x9c5a('0xe')]||null:null,'include':_0x738f1a[_0x9c5a('0xb')]?_0x738f1a[_0x9c5a('0xb')][_0x9c5a('0xf')]?_[_0x9c5a('0x10')](_0x738f1a[_0x9c5a('0xb')][_0x9c5a('0xf')],function(_0x7fd1f1){return{'model':db[_0x7fd1f1['model']],'as':_0x7fd1f1['as'],'attributes':_0x7fd1f1[_0x9c5a('0x11')],'include':_0x7fd1f1[_0x9c5a('0xf')]?_[_0x9c5a('0x10')](_0x7fd1f1['include'],function(_0x4cbdcc){return{'model':db[_0x4cbdcc['model']],'as':_0x4cbdcc['as'],'attributes':_0x4cbdcc[_0x9c5a('0x11')],'include':_0x4cbdcc['include']?_[_0x9c5a('0x10')](_0x4cbdcc[_0x9c5a('0xf')],function(_0x13cbe7){return{'model':db[_0x13cbe7[_0x9c5a('0x12')]],'as':_0x13cbe7['as'],'attributes':_0x13cbe7[_0x9c5a('0x11')]};}):[]};}):[]};}):[]:[]})[_0x9c5a('0x13')](function(_0x59ba12){logger[_0x9c5a('0x14')]('GetSquareProjects',_0x738f1a);logger[_0x9c5a('0x15')]('GetSquareProjects',_0x738f1a,JSON['stringify'](_0x59ba12));_0x4d18be(_0x59ba12);})[_0x9c5a('0x16')](function(_0x48c433){logger[_0x9c5a('0x17')](_0x9c5a('0x18'),_0x48c433[_0x9c5a('0x19')],_0x738f1a);_0x76694c(_0x4667f1['error'](0x1f4,_0x48c433['message']));});});};exports[_0x9c5a('0x1a')]=function(_0x3bfa81){var _0x53acde=this;return new Promise(function(_0x7ed9c0,_0x47765e){return db[_0x9c5a('0x9')][_0x9c5a('0x1b')]({'raw':_0x3bfa81[_0x9c5a('0xb')]?_0x3bfa81[_0x9c5a('0xb')][_0x9c5a('0xc')]===undefined?!![]:![]:!![],'where':_0x3bfa81[_0x9c5a('0xb')]?_0x3bfa81['options']['where']||null:null,'attributes':_0x3bfa81['options']?_0x3bfa81['options'][_0x9c5a('0x11')]||null:null,'include':_0x3bfa81[_0x9c5a('0xb')]?_0x3bfa81['options']['include']?_['map'](_0x3bfa81['options']['include'],function(_0x201a71){return{'model':db[_0x201a71[_0x9c5a('0x12')]],'as':_0x201a71['as'],'attributes':_0x201a71[_0x9c5a('0x11')],'include':_0x201a71[_0x9c5a('0xf')]?_[_0x9c5a('0x10')](_0x201a71['include'],function(_0x4b849d){return{'model':db[_0x4b849d['model']],'as':_0x4b849d['as'],'attributes':_0x4b849d[_0x9c5a('0x11')],'include':_0x4b849d['include']?_[_0x9c5a('0x10')](_0x4b849d['include'],function(_0x3fc6c2){return{'model':db[_0x3fc6c2[_0x9c5a('0x12')]],'as':_0x3fc6c2['as'],'attributes':_0x3fc6c2[_0x9c5a('0x11')]};}):[]};}):[]};}):[]:[]})[_0x9c5a('0x13')](function(_0x3b2a6c){logger[_0x9c5a('0x14')](_0x9c5a('0x1a'),_0x3bfa81);logger[_0x9c5a('0x15')](_0x9c5a('0x1a'),_0x3bfa81,JSON[_0x9c5a('0x1c')](_0x3b2a6c));_0x7ed9c0(_0x3b2a6c);})[_0x9c5a('0x16')](function(_0x546f89){logger[_0x9c5a('0x17')](_0x9c5a('0x1a'),_0x546f89[_0x9c5a('0x19')],_0x3bfa81);_0x47765e(_0x53acde[_0x9c5a('0x17')](0x1f4,_0x546f89[_0x9c5a('0x19')]));});});}; \ No newline at end of file +var _0x428f=['./squareProject.socket','register','GetSquareProjects','options','raw','where','attributes','limit','include','map','model','then','debug','error','message','SquareProject','find','info','ShowSquareProject','stringify','catch','ioredis','rpc','../../config/environment','redis','socket.io-emitter'];(function(_0x2e0505,_0x5d5cb1){var _0x1a698b=function(_0x5594de){while(--_0x5594de){_0x2e0505['push'](_0x2e0505['shift']());}};_0x1a698b(++_0x5d5cb1);}(_0x428f,0x1b5));var _0xf428=function(_0x1e3a63,_0x1e33f2){_0x1e3a63=_0x1e3a63-0x0;var _0x2a89d6=_0x428f[_0x1e3a63];return _0x2a89d6;};'use strict';var _=require('lodash');var Redis=require(_0xf428('0x0'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0xf428('0x1'));var config=require(_0xf428('0x2'));config['redis']=_['defaults'](config[_0xf428('0x3')],{'host':'localhost','port':0x18eb});var socket=require(_0xf428('0x4'))(new Redis(config[_0xf428('0x3')]));require(_0xf428('0x5'))[_0xf428('0x6')](socket);exports[_0xf428('0x7')]=function(_0x391063){var _0x108716=this;return new Promise(function(_0x98b74b,_0x113013){return db['SquareProject']['findAll']({'raw':_0x391063['options']?_0x391063[_0xf428('0x8')][_0xf428('0x9')]===undefined?!![]:![]:!![],'where':_0x391063[_0xf428('0x8')]?_0x391063[_0xf428('0x8')][_0xf428('0xa')]||null:null,'attributes':_0x391063[_0xf428('0x8')]?_0x391063[_0xf428('0x8')][_0xf428('0xb')]||null:null,'limit':_0x391063[_0xf428('0x8')]?_0x391063[_0xf428('0x8')][_0xf428('0xc')]||null:null,'include':_0x391063[_0xf428('0x8')]?_0x391063['options'][_0xf428('0xd')]?_[_0xf428('0xe')](_0x391063[_0xf428('0x8')][_0xf428('0xd')],function(_0x4ba98e){return{'model':db[_0x4ba98e[_0xf428('0xf')]],'as':_0x4ba98e['as'],'attributes':_0x4ba98e[_0xf428('0xb')],'include':_0x4ba98e['include']?_['map'](_0x4ba98e[_0xf428('0xd')],function(_0x3a42e7){return{'model':db[_0x3a42e7[_0xf428('0xf')]],'as':_0x3a42e7['as'],'attributes':_0x3a42e7[_0xf428('0xb')],'include':_0x3a42e7['include']?_['map'](_0x3a42e7['include'],function(_0x43ca79){return{'model':db[_0x43ca79[_0xf428('0xf')]],'as':_0x43ca79['as'],'attributes':_0x43ca79[_0xf428('0xb')]};}):[]};}):[]};}):[]:[]})[_0xf428('0x10')](function(_0x2ef0b8){logger['info'](_0xf428('0x7'),_0x391063);logger[_0xf428('0x11')](_0xf428('0x7'),_0x391063,JSON['stringify'](_0x2ef0b8));_0x98b74b(_0x2ef0b8);})['catch'](function(_0x53eb1b){logger[_0xf428('0x12')](_0xf428('0x7'),_0x53eb1b[_0xf428('0x13')],_0x391063);_0x113013(_0x108716[_0xf428('0x12')](0x1f4,_0x53eb1b[_0xf428('0x13')]));});});};exports['ShowSquareProject']=function(_0x2c9eac){var _0x572758=this;return new Promise(function(_0xb9738c,_0x460db4){return db[_0xf428('0x14')][_0xf428('0x15')]({'raw':_0x2c9eac[_0xf428('0x8')]?_0x2c9eac['options'][_0xf428('0x9')]===undefined?!![]:![]:!![],'where':_0x2c9eac[_0xf428('0x8')]?_0x2c9eac[_0xf428('0x8')][_0xf428('0xa')]||null:null,'attributes':_0x2c9eac[_0xf428('0x8')]?_0x2c9eac[_0xf428('0x8')][_0xf428('0xb')]||null:null,'include':_0x2c9eac[_0xf428('0x8')]?_0x2c9eac['options'][_0xf428('0xd')]?_[_0xf428('0xe')](_0x2c9eac[_0xf428('0x8')][_0xf428('0xd')],function(_0x52c79e){return{'model':db[_0x52c79e['model']],'as':_0x52c79e['as'],'attributes':_0x52c79e['attributes'],'include':_0x52c79e[_0xf428('0xd')]?_[_0xf428('0xe')](_0x52c79e['include'],function(_0x381ba8){return{'model':db[_0x381ba8[_0xf428('0xf')]],'as':_0x381ba8['as'],'attributes':_0x381ba8[_0xf428('0xb')],'include':_0x381ba8['include']?_[_0xf428('0xe')](_0x381ba8['include'],function(_0x46b345){return{'model':db[_0x46b345[_0xf428('0xf')]],'as':_0x46b345['as'],'attributes':_0x46b345[_0xf428('0xb')]};}):[]};}):[]};}):[]:[]})[_0xf428('0x10')](function(_0x24cbf0){logger[_0xf428('0x16')](_0xf428('0x17'),_0x2c9eac);logger[_0xf428('0x11')](_0xf428('0x17'),_0x2c9eac,JSON[_0xf428('0x18')](_0x24cbf0));_0xb9738c(_0x24cbf0);})[_0xf428('0x19')](function(_0x499616){logger[_0xf428('0x12')](_0xf428('0x17'),_0x499616[_0xf428('0x13')],_0x2c9eac);_0x460db4(_0x572758[_0xf428('0x12')](0x1f4,_0x499616[_0xf428('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index d6152d9..64324c8 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 _0x4ccd=['removeListener','register','length','squareProject:','./squareProject.events','save','remove','update','emit'];(function(_0x163d71,_0x3fc130){var _0x338b47=function(_0x57b1dc){while(--_0x57b1dc){_0x163d71['push'](_0x163d71['shift']());}};_0x338b47(++_0x3fc130);}(_0x4ccd,0x187));var _0xd4cc=function(_0x1d39f6,_0x146f4a){_0x1d39f6=_0x1d39f6-0x0;var _0x3dbd7a=_0x4ccd[_0x1d39f6];return _0x3dbd7a;};'use strict';var SquareProjectEvents=require(_0xd4cc('0x0'));var events=[_0xd4cc('0x1'),_0xd4cc('0x2'),_0xd4cc('0x3')];function createListener(_0x207db8,_0x5c9f37){return function(_0x5b3f94){_0x5c9f37[_0xd4cc('0x4')](_0x207db8,_0x5b3f94);};}function removeListener(_0x558244,_0x45fa79){return function(){SquareProjectEvents[_0xd4cc('0x5')](_0x558244,_0x45fa79);};}exports[_0xd4cc('0x6')]=function(_0x4d1995){for(var _0x51b959=0x0,_0x4f8895=events[_0xd4cc('0x7')];_0x51b959<_0x4f8895;_0x51b959++){var _0x44d091=events[_0x51b959];var _0x35af53=createListener(_0xd4cc('0x8')+_0x44d091,_0x4d1995);SquareProjectEvents['on'](_0x44d091,_0x35af53);}}; \ No newline at end of file +var _0x094c=['./squareProject.events','remove','update','removeListener','register','length','squareProject:'];(function(_0x136d06,_0x2a2214){var _0x93021c=function(_0x66b423){while(--_0x66b423){_0x136d06['push'](_0x136d06['shift']());}};_0x93021c(++_0x2a2214);}(_0x094c,0x118));var _0xc094=function(_0x5b8685,_0x1a1c28){_0x5b8685=_0x5b8685-0x0;var _0xa3ef57=_0x094c[_0x5b8685];return _0xa3ef57;};'use strict';var SquareProjectEvents=require(_0xc094('0x0'));var events=['save',_0xc094('0x1'),_0xc094('0x2')];function createListener(_0x13ddc6,_0x231829){return function(_0x5f0c94){_0x231829['emit'](_0x13ddc6,_0x5f0c94);};}function removeListener(_0xea6e0b,_0x1150f9){return function(){SquareProjectEvents[_0xc094('0x3')](_0xea6e0b,_0x1150f9);};}exports[_0xc094('0x4')]=function(_0x5b2737){for(var _0x2e7ba6=0x0,_0x264b76=events[_0xc094('0x5')];_0x2e7ba6<_0x264b76;_0x2e7ba6++){var _0x5b6fe2=events[_0x2e7ba6];var _0x1093e1=createListener(_0xc094('0x6')+_0x5b6fe2,_0x5b2737);SquareProjectEvents['on'](_0x5b6fe2,_0x1093e1);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 24142e3..c085e33 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 _0xe14b=['Router','../../components/auth/service','./squareRecording.controller','get','isAuthenticated','index','/:id','download','post','delete','destroy','exports','multer','util','express'];(function(_0xa495bc,_0x157a1d){var _0x17b6dd=function(_0x4174af){while(--_0x4174af){_0xa495bc['push'](_0xa495bc['shift']());}};_0x17b6dd(++_0x157a1d);}(_0xe14b,0x93));var _0xbe14=function(_0x2943cd,_0x5b30f3){_0x2943cd=_0x2943cd-0x0;var _0x271023=_0xe14b[_0x2943cd];return _0x271023;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['show']);router['get']('/:id/download',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0xb')]('/',auth[_0xbe14('0x7')](),controller['create']);router['put'](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0xc')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xd')]);module[_0xbe14('0xe')]=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(_0x5b07bc,_0x312ae2){var _0x53c8ac=function(_0x558a36){while(--_0x558a36){_0x5b07bc['push'](_0x5b07bc['shift']());}};_0x53c8ac(++_0x312ae2);}(_0x53ec,0x192));var _0xc53e=function(_0x5ea2f9,_0x320917){_0x5ea2f9=_0x5ea2f9-0x0;var _0x36e586=_0x53ec[_0x5ea2f9];return _0x36e586;};'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 933a41b..b0632c9 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 _0x7217=['lastIndexOf','sequelize','STRING','VIRTUAL','getDataValue','savePath','substring'];(function(_0x30ea5a,_0x194d21){var _0x1bc76d=function(_0x4555ef){while(--_0x4555ef){_0x30ea5a['push'](_0x30ea5a['shift']());}};_0x1bc76d(++_0x194d21);}(_0x7217,0x19e));var _0x7721=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x7217[_0x1cfa0d];return _0xe33279;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7721('0x1')]},'callerid':{'type':Sequelize[_0x7721('0x1')]},'calleridname':{'type':Sequelize[_0x7721('0x1')]},'context':{'type':Sequelize[_0x7721('0x1')]},'extension':{'type':Sequelize[_0x7721('0x1')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x7721('0x1')]},'projectName':{'type':Sequelize[_0x7721('0x1')]},'saveName':{'type':Sequelize[_0x7721('0x1')]},'filename':{'type':Sequelize[_0x7721('0x1')]},'savePath':{'type':Sequelize[_0x7721('0x1')]},'format':{'type':Sequelize[_0x7721('0x2')],'get':function(){var _0x18ab6b='';var _0x21f680=this[_0x7721('0x3')](_0x7721('0x4'));if(_0x21f680){_0x18ab6b=_0x21f680[_0x7721('0x5')](_0x21f680[_0x7721('0x6')]('.'));}return _0x18ab6b;}}}; \ No newline at end of file +var _0xd8fb=['STRING','getDataValue','savePath','sequelize','exports'];(function(_0x365b46,_0xe73199){var _0x42616f=function(_0x243a7c){while(--_0x243a7c){_0x365b46['push'](_0x365b46['shift']());}};_0x42616f(++_0xe73199);}(_0xd8fb,0x99));var _0xbd8f=function(_0x28326f,_0x3f1095){_0x28326f=_0x28326f-0x0;var _0x4a24be=_0xd8fb[_0x28326f];return _0x4a24be;};'use strict';var Sequelize=require(_0xbd8f('0x0'));module[_0xbd8f('0x1')]={'uniqueid':{'type':Sequelize[_0xbd8f('0x2')]},'callerid':{'type':Sequelize[_0xbd8f('0x2')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xbd8f('0x2')]},'accountcode':{'type':Sequelize[_0xbd8f('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xbd8f('0x2')]},'saveName':{'type':Sequelize[_0xbd8f('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0xbd8f('0x2')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0xf503c4='';var _0x578499=this[_0xbd8f('0x3')](_0xbd8f('0x4'));if(_0x578499){_0xf503c4=_0x578499['substring'](_0x578499['lastIndexOf']('.'));}return _0xf503c4;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 3c79f12..f996116 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 _0x88d1=['format','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','extname','download','unlink','message','SquareRecording\x20not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','error','stack','name','SquareRecording','type','map','query','intersection','model','attributes','fields','length','nolimit','where','pick','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','rawAttributes','filters','find','create','body','update','../../components/encryptor','uniqueid','filename','savePath'];(function(_0x423cec,_0x54e1b6){var _0x318e8c=function(_0x200705){while(--_0x200705){_0x423cec['push'](_0x423cec['shift']());}};_0x318e8c(++_0x54e1b6);}(_0x88d1,0x189));var _0x188d=function(_0xb106c7,_0x1e0c90){_0xb106c7=_0xb106c7-0x0;var _0x24a91e=_0x88d1[_0xb106c7];return _0x24a91e;};'use strict';var emlformat=require(_0x188d('0x0'));var rimraf=require(_0x188d('0x1'));var zipdir=require(_0x188d('0x2'));var jsonpatch=require(_0x188d('0x3'));var rp=require(_0x188d('0x4'));var moment=require(_0x188d('0x5'));var BPromise=require(_0x188d('0x6'));var Mustache=require(_0x188d('0x7'));var util=require(_0x188d('0x8'));var path=require('path');var sox=require(_0x188d('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x188d('0xa'));var squel=require('squel');var crypto=require(_0x188d('0xb'));var jsforce=require(_0x188d('0xc'));var deskjs=require(_0x188d('0xd'));var toCsv=require(_0x188d('0xe'));var querystring=require(_0x188d('0xf'));var Papa=require(_0x188d('0x10'));var Redis=require(_0x188d('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x188d('0x12'));var hardwareService=require(_0x188d('0x13'));var logger=require(_0x188d('0x14'))(_0x188d('0x15'));var utils=require('../../config/utils');var config=require(_0x188d('0x16'));var licenseUtil=require(_0x188d('0x17'));var db=require(_0x188d('0x18'))['db'];function respondWithStatusCode(_0x3c297d,_0x39622a){_0x39622a=_0x39622a||0xcc;return function(_0x4eaab1){if(_0x4eaab1){return _0x3c297d[_0x188d('0x19')](_0x39622a);}return _0x3c297d[_0x188d('0x1a')](_0x39622a)[_0x188d('0x1b')]();};}function respondWithResult(_0x3970fd,_0x1c1af6){_0x1c1af6=_0x1c1af6||0xc8;return function(_0x24c93f){if(_0x24c93f){return _0x3970fd['status'](_0x1c1af6)[_0x188d('0x1c')](_0x24c93f);}};}function respondWithFilteredResult(_0x19be4f,_0x4aa2d8){return function(_0x7498d){if(_0x7498d){var _0x45d969=typeof _0x4aa2d8[_0x188d('0x1d')]===_0x188d('0x1e')&&typeof _0x4aa2d8[_0x188d('0x1f')]===_0x188d('0x1e');var _0x1639e2=_0x7498d[_0x188d('0x20')];var _0x592b0d=_0x45d969?0x0:_0x4aa2d8['offset'];var _0x2d192d=_0x45d969?_0x7498d['count']:_0x4aa2d8[_0x188d('0x1d')]+_0x4aa2d8[_0x188d('0x1f')];var _0x24fcfc;if(_0x2d192d>=_0x1639e2){_0x2d192d=_0x1639e2;_0x24fcfc=0xc8;}else{_0x24fcfc=0xce;}_0x19be4f[_0x188d('0x1a')](_0x24fcfc);return _0x19be4f[_0x188d('0x21')](_0x188d('0x22'),_0x592b0d+'-'+_0x2d192d+'/'+_0x1639e2)[_0x188d('0x1c')](_0x7498d);}return null;};}function patchUpdates(_0x15952d){return function(_0x392074){try{jsonpatch['apply'](_0x392074,_0x15952d,!![]);}catch(_0x5395fb){return BPromise['reject'](_0x5395fb);}return _0x392074[_0x188d('0x23')]();};}function saveUpdates(_0x112dd5,_0x154387){return function(_0x4efeb3){if(_0x4efeb3){return _0x4efeb3['update'](_0x112dd5)[_0x188d('0x24')](function(_0x102a8b){return _0x102a8b;});}return null;};}function removeEntity(_0x16dc09,_0x4555e5){return function(_0x4b2bb7){if(_0x4b2bb7){return _0x4b2bb7['destroy']()[_0x188d('0x24')](function(){_0x16dc09[_0x188d('0x1a')](0xcc)[_0x188d('0x1b')]();});}};}function handleEntityNotFound(_0x22cbf2,_0x1863ce){return function(_0x5cf598){if(!_0x5cf598){_0x22cbf2[_0x188d('0x19')](0x194);}return _0x5cf598;};}function handleError(_0x33a05b,_0x27b04a){_0x27b04a=_0x27b04a||0x1f4;return function(_0x373185){logger[_0x188d('0x25')](_0x373185[_0x188d('0x26')]);if(_0x373185['name']){delete _0x373185[_0x188d('0x27')];}_0x33a05b[_0x188d('0x1a')](_0x27b04a)['send'](_0x373185);};}exports['index']=function(_0x4a5ca3,_0x1c1b3c){var _0x2d90f3={},_0x3a79af={},_0x4a4e28={'count':0x0,'rows':[]};var _0x30bacb=_['map'](db[_0x188d('0x28')]['rawAttributes'],function(_0x4e147b){return{'name':_0x4e147b['fieldName'],'type':_0x4e147b[_0x188d('0x29')]['key']};});_0x3a79af['model']=_[_0x188d('0x2a')](_0x30bacb,_0x188d('0x27'));_0x3a79af[_0x188d('0x2b')]=_['keys'](_0x4a5ca3[_0x188d('0x2b')]);_0x3a79af['filters']=_[_0x188d('0x2c')](_0x3a79af[_0x188d('0x2d')],_0x3a79af['query']);_0x2d90f3[_0x188d('0x2e')]=_[_0x188d('0x2c')](_0x3a79af['model'],qs[_0x188d('0x2f')](_0x4a5ca3[_0x188d('0x2b')]['fields']));_0x2d90f3[_0x188d('0x2e')]=_0x2d90f3['attributes'][_0x188d('0x30')]?_0x2d90f3[_0x188d('0x2e')]:_0x3a79af['model'];if(!_0x4a5ca3['query']['hasOwnProperty'](_0x188d('0x31'))){_0x2d90f3[_0x188d('0x1f')]=qs['limit'](_0x4a5ca3['query'][_0x188d('0x1f')]);_0x2d90f3[_0x188d('0x1d')]=qs[_0x188d('0x1d')](_0x4a5ca3[_0x188d('0x2b')]['offset']);}_0x2d90f3['order']=qs['sort'](_0x4a5ca3[_0x188d('0x2b')]['sort']);_0x2d90f3[_0x188d('0x32')]=qs['filters'](_[_0x188d('0x33')](_0x4a5ca3['query'],_0x3a79af['filters']),_0x30bacb);if(_0x4a5ca3['query']['filter']){_0x2d90f3[_0x188d('0x32')]=_[_0x188d('0x34')](_0x2d90f3[_0x188d('0x32')],{'$or':_[_0x188d('0x2a')](_0x30bacb,function(_0x24657b){if(_0x24657b['type']!==_0x188d('0x35')){var _0x37d9df={};_0x37d9df[_0x24657b[_0x188d('0x27')]]={'$like':'%'+_0x4a5ca3[_0x188d('0x2b')]['filter']+'%'};return _0x37d9df;}})});}_0x2d90f3=_['merge']({},_0x2d90f3,_0x4a5ca3[_0x188d('0x36')]);var _0x1282aa={'where':_0x2d90f3[_0x188d('0x32')]};return db[_0x188d('0x28')][_0x188d('0x20')](_0x1282aa)[_0x188d('0x24')](function(_0x284ee8){_0x4a4e28['count']=_0x284ee8;if(_0x4a5ca3[_0x188d('0x2b')]['includeAll']){_0x2d90f3[_0x188d('0x37')]=[{'all':!![]}];}return db[_0x188d('0x28')][_0x188d('0x38')](_0x2d90f3);})['then'](function(_0x3ec494){_0x4a4e28[_0x188d('0x39')]=_0x3ec494;return _0x4a4e28;})['then'](respondWithFilteredResult(_0x1c1b3c,_0x2d90f3))[_0x188d('0x3a')](handleError(_0x1c1b3c,null));};exports[_0x188d('0x3b')]=function(_0x584354,_0x358750){var _0x30ef94={'raw':!![],'where':{'id':_0x584354[_0x188d('0x3c')]['id']}},_0x559fbd={};_0x559fbd[_0x188d('0x2d')]=_[_0x188d('0x3d')](db[_0x188d('0x28')][_0x188d('0x3e')]);_0x559fbd[_0x188d('0x2b')]=_['keys'](_0x584354['query']);_0x559fbd[_0x188d('0x3f')]=_['intersection'](_0x559fbd[_0x188d('0x2d')],_0x559fbd[_0x188d('0x2b')]);_0x30ef94['attributes']=_['intersection'](_0x559fbd[_0x188d('0x2d')],qs['fields'](_0x584354[_0x188d('0x2b')][_0x188d('0x2f')]));_0x30ef94['attributes']=_0x30ef94[_0x188d('0x2e')][_0x188d('0x30')]?_0x30ef94[_0x188d('0x2e')]:_0x559fbd[_0x188d('0x2d')];if(_0x584354['query']['includeAll']){_0x30ef94[_0x188d('0x37')]=[{'all':!![]}];}_0x30ef94=_[_0x188d('0x34')]({},_0x30ef94,_0x584354[_0x188d('0x36')]);return db['SquareRecording'][_0x188d('0x40')](_0x30ef94)['then'](handleEntityNotFound(_0x358750,null))[_0x188d('0x24')](respondWithResult(_0x358750,null))[_0x188d('0x3a')](handleError(_0x358750,null));};exports[_0x188d('0x41')]=function(_0x27969e,_0x1ae784){return db[_0x188d('0x28')][_0x188d('0x41')](_0x27969e[_0x188d('0x42')],{})[_0x188d('0x24')](respondWithResult(_0x1ae784,0xc9))[_0x188d('0x3a')](handleError(_0x1ae784,null));};exports[_0x188d('0x43')]=function(_0x3509ff,_0x4650a1){if(_0x3509ff[_0x188d('0x42')]['id']){delete _0x3509ff['body']['id'];}return db[_0x188d('0x28')][_0x188d('0x40')]({'where':{'id':_0x3509ff[_0x188d('0x3c')]['id']}})['then'](handleEntityNotFound(_0x4650a1,null))[_0x188d('0x24')](saveUpdates(_0x3509ff['body'],null))[_0x188d('0x24')](respondWithResult(_0x4650a1,null))[_0x188d('0x3a')](handleError(_0x4650a1,null));};exports['download']=function(_0x306af5,_0x583908,_0x5b4687){var _0xad46cf=require(_0x188d('0x44'));var _0x38431b=![];var _0x4d3289={};if(_0x306af5[_0x188d('0x2b')][_0x188d('0x29')]&&_0x306af5[_0x188d('0x2b')][_0x188d('0x29')]===_0x188d('0x45')){_0x4d3289[_0x188d('0x45')]=_0x306af5[_0x188d('0x3c')]['id'];}else{_0x4d3289['id']=_0x306af5[_0x188d('0x3c')]['id'];}return db['SquareRecording'][_0x188d('0x40')]({'where':_0x4d3289,'attributes':['id','savePath',_0x188d('0x46')],'raw':!![]})['then'](handleEntityNotFound(_0x583908,null))[_0x188d('0x24')](function(_0x1452c1){if(_0x1452c1){var _0x51c995=_0x1452c1[_0x188d('0x47')];var _0x201d7a=util[_0x188d('0x48')](_0x188d('0x49'),_0x51c995);if(fs[_0x188d('0x4a')](_0x201d7a)){_0x38431b=!![];return _0xad46cf[_0x188d('0x4b')](_0x201d7a,_0x51c995,config[_0x188d('0x4c')]['recording'])[_0x188d('0x24')](function(){return _0x1452c1;});}return _0x1452c1;}})['then'](function(_0x4e4a58){if(_0x4e4a58){var _0x140db7=_0x4e4a58[_0x188d('0x47')];if(!fs[_0x188d('0x4a')](_0x140db7)){throw new db[(_0x188d('0x4d'))][(_0x188d('0x4e'))]('SquareRecording\x20not\x20found');}if(_0x4e4a58['filename']){return _0x583908['download'](_0x140db7,_0x4e4a58[_0x188d('0x46')]+path[_0x188d('0x4f')](_0x140db7),function(){if(_0x38431b){fs['unlink'](_0x140db7);}});}else{return _0x583908[_0x188d('0x50')](_0x140db7,function(_0x42690d){if(_0x38431b){fs[_0x188d('0x51')](_0x140db7);}});}}})[_0x188d('0x3a')](function(_0x20d806){if(_0x20d806[_0x188d('0x52')]===_0x188d('0x53')){_0x583908[_0x188d('0x1a')](0x194)['send']('Not\x20found');}else{return handleError(_0x583908,null);}});};exports[_0x188d('0x54')]=function(_0x339874,_0x513cec){return db[_0x188d('0x28')][_0x188d('0x40')]({'where':{'id':_0x339874['params']['id']}})[_0x188d('0x24')](function(_0x360069){if(_[_0x188d('0x55')](_0x360069)){throw new ReferenceError(_0x188d('0x56'));}return _0x360069;})[_0x188d('0x24')](function(_0x1be493){var _0x2de966=_0x1be493[_0x188d('0x47')];logger[_0x188d('0x57')](_0x188d('0x58'),_0x2de966);if(!_[_0x188d('0x55')](_0x1be493[_0x188d('0x47')])&&fs[_0x188d('0x4a')](_0x2de966)){logger[_0x188d('0x57')](_0x188d('0x59')+_0x2de966+_0x188d('0x5a'));fs[_0x188d('0x5b')](_0x2de966);}_0x2de966=_0x2de966+_0x188d('0x5c');if(!_['isNil'](_0x1be493[_0x188d('0x47')])&&fs[_0x188d('0x4a')](_0x2de966)){logger['info'](_0x188d('0x59')+_0x2de966+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x188d('0x5b')](_0x2de966);}return _0x1be493;})[_0x188d('0x24')](function(_0x2ee4b6){if(!_0x2ee4b6)throw new InternalError();return _0x2ee4b6['destroy']();})['then'](function(){_0x513cec[_0x188d('0x1a')](0xcc)[_0x188d('0x1b')]();})['catch'](handleError(_0x513cec,null));}; \ No newline at end of file +var _0x66e6=['status','limit','undefined','count','offset','set','Content-Range','json','apply','reject','save','update','then','end','error','stack','name','send','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','sort','pick','where','filter','merge','options','SquareRecording','includeAll','include','rows','catch','show','params','length','create','body','find','download','../../components/encryptor','uniqueid','filename','savePath','format','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus'];(function(_0xb05925,_0x21c9c7){var _0x4e09d6=function(_0x3bec9d){while(--_0x3bec9d){_0xb05925['push'](_0xb05925['shift']());}};_0x4e09d6(++_0x21c9c7);}(_0x66e6,0xa6));var _0x666e=function(_0x491fc2,_0x4d7cff){_0x491fc2=_0x491fc2-0x0;var _0x157e9f=_0x66e6[_0x491fc2];return _0x157e9f;};'use strict';var emlformat=require(_0x666e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x666e('0x1'));var jsonpatch=require(_0x666e('0x2'));var rp=require(_0x666e('0x3'));var moment=require('moment');var BPromise=require(_0x666e('0x4'));var Mustache=require(_0x666e('0x5'));var util=require(_0x666e('0x6'));var path=require(_0x666e('0x7'));var sox=require('sox');var csv=require(_0x666e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x666e('0x9'));var crypto=require(_0x666e('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x666e('0xb'));var toCsv=require(_0x666e('0x8'));var querystring=require(_0x666e('0xc'));var Papa=require(_0x666e('0xd'));var Redis=require(_0x666e('0xe'));var authService=require(_0x666e('0xf'));var qs=require(_0x666e('0x10'));var as=require(_0x666e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x666e('0x12'));var utils=require(_0x666e('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x666e('0x14'))['db'];function respondWithStatusCode(_0x404c5e,_0x34c830){_0x34c830=_0x34c830||0xcc;return function(_0xfdecbf){if(_0xfdecbf){return _0x404c5e[_0x666e('0x15')](_0x34c830);}return _0x404c5e[_0x666e('0x16')](_0x34c830)['end']();};}function respondWithResult(_0x506a52,_0x2876f2){_0x2876f2=_0x2876f2||0xc8;return function(_0x2f8404){if(_0x2f8404){return _0x506a52[_0x666e('0x16')](_0x2876f2)['json'](_0x2f8404);}};}function respondWithFilteredResult(_0x3b56de,_0x5da30b){return function(_0x2cb85f){if(_0x2cb85f){var _0x4ff58d=typeof _0x5da30b['offset']==='undefined'&&typeof _0x5da30b[_0x666e('0x17')]===_0x666e('0x18');var _0x2fce61=_0x2cb85f[_0x666e('0x19')];var _0x3f5da1=_0x4ff58d?0x0:_0x5da30b[_0x666e('0x1a')];var _0x1b299d=_0x4ff58d?_0x2cb85f[_0x666e('0x19')]:_0x5da30b[_0x666e('0x1a')]+_0x5da30b['limit'];var _0x1d8a61;if(_0x1b299d>=_0x2fce61){_0x1b299d=_0x2fce61;_0x1d8a61=0xc8;}else{_0x1d8a61=0xce;}_0x3b56de['status'](_0x1d8a61);return _0x3b56de[_0x666e('0x1b')](_0x666e('0x1c'),_0x3f5da1+'-'+_0x1b299d+'/'+_0x2fce61)[_0x666e('0x1d')](_0x2cb85f);}return null;};}function patchUpdates(_0x5a154b){return function(_0x268850){try{jsonpatch[_0x666e('0x1e')](_0x268850,_0x5a154b,!![]);}catch(_0x3ffa8e){return BPromise[_0x666e('0x1f')](_0x3ffa8e);}return _0x268850[_0x666e('0x20')]();};}function saveUpdates(_0xf2359b,_0x2c1613){return function(_0x3a37d6){if(_0x3a37d6){return _0x3a37d6[_0x666e('0x21')](_0xf2359b)[_0x666e('0x22')](function(_0x4131fa){return _0x4131fa;});}return null;};}function removeEntity(_0xcf5916,_0x134ace){return function(_0x2e4751){if(_0x2e4751){return _0x2e4751['destroy']()['then'](function(){_0xcf5916[_0x666e('0x16')](0xcc)[_0x666e('0x23')]();});}};}function handleEntityNotFound(_0x3bc18e,_0x5bf517){return function(_0x9f7707){if(!_0x9f7707){_0x3bc18e[_0x666e('0x15')](0x194);}return _0x9f7707;};}function handleError(_0x34e8d3,_0x1a9071){_0x1a9071=_0x1a9071||0x1f4;return function(_0x2a2843){logger[_0x666e('0x24')](_0x2a2843[_0x666e('0x25')]);if(_0x2a2843[_0x666e('0x26')]){delete _0x2a2843[_0x666e('0x26')];}_0x34e8d3[_0x666e('0x16')](_0x1a9071)[_0x666e('0x27')](_0x2a2843);};}exports['index']=function(_0x20eb58,_0x48cb92){var _0x28659b={},_0x58b584={},_0x1ed778={'count':0x0,'rows':[]};var _0x4cd97e=_['map'](db['SquareRecording'][_0x666e('0x28')],function(_0x3477b8){return{'name':_0x3477b8[_0x666e('0x29')],'type':_0x3477b8[_0x666e('0x2a')][_0x666e('0x2b')]};});_0x58b584['model']=_[_0x666e('0x2c')](_0x4cd97e,_0x666e('0x26'));_0x58b584[_0x666e('0x2d')]=_[_0x666e('0x2e')](_0x20eb58[_0x666e('0x2d')]);_0x58b584[_0x666e('0x2f')]=_[_0x666e('0x30')](_0x58b584[_0x666e('0x31')],_0x58b584[_0x666e('0x2d')]);_0x28659b[_0x666e('0x32')]=_[_0x666e('0x30')](_0x58b584[_0x666e('0x31')],qs[_0x666e('0x33')](_0x20eb58[_0x666e('0x2d')][_0x666e('0x33')]));_0x28659b[_0x666e('0x32')]=_0x28659b[_0x666e('0x32')]['length']?_0x28659b[_0x666e('0x32')]:_0x58b584['model'];if(!_0x20eb58[_0x666e('0x2d')][_0x666e('0x34')]('nolimit')){_0x28659b[_0x666e('0x17')]=qs[_0x666e('0x17')](_0x20eb58[_0x666e('0x2d')][_0x666e('0x17')]);_0x28659b['offset']=qs['offset'](_0x20eb58[_0x666e('0x2d')][_0x666e('0x1a')]);}_0x28659b['order']=qs[_0x666e('0x35')](_0x20eb58[_0x666e('0x2d')][_0x666e('0x35')]);_0x28659b['where']=qs['filters'](_[_0x666e('0x36')](_0x20eb58[_0x666e('0x2d')],_0x58b584[_0x666e('0x2f')]),_0x4cd97e);if(_0x20eb58[_0x666e('0x2d')]['filter']){_0x28659b[_0x666e('0x37')]=_['merge'](_0x28659b[_0x666e('0x37')],{'$or':_[_0x666e('0x2c')](_0x4cd97e,function(_0x43b2d4){if(_0x43b2d4[_0x666e('0x2a')]!=='VIRTUAL'){var _0x5864fc={};_0x5864fc[_0x43b2d4[_0x666e('0x26')]]={'$like':'%'+_0x20eb58[_0x666e('0x2d')][_0x666e('0x38')]+'%'};return _0x5864fc;}})});}_0x28659b=_[_0x666e('0x39')]({},_0x28659b,_0x20eb58[_0x666e('0x3a')]);var _0x17c50e={'where':_0x28659b[_0x666e('0x37')]};return db[_0x666e('0x3b')]['count'](_0x17c50e)['then'](function(_0x3ac628){_0x1ed778[_0x666e('0x19')]=_0x3ac628;if(_0x20eb58['query'][_0x666e('0x3c')]){_0x28659b[_0x666e('0x3d')]=[{'all':!![]}];}return db['SquareRecording']['findAll'](_0x28659b);})['then'](function(_0x3ae372){_0x1ed778[_0x666e('0x3e')]=_0x3ae372;return _0x1ed778;})[_0x666e('0x22')](respondWithFilteredResult(_0x48cb92,_0x28659b))[_0x666e('0x3f')](handleError(_0x48cb92,null));};exports[_0x666e('0x40')]=function(_0x39bbcb,_0x346d8d){var _0x115386={'raw':!![],'where':{'id':_0x39bbcb[_0x666e('0x41')]['id']}},_0x2207f5={};_0x2207f5[_0x666e('0x31')]=_[_0x666e('0x2e')](db[_0x666e('0x3b')][_0x666e('0x28')]);_0x2207f5[_0x666e('0x2d')]=_[_0x666e('0x2e')](_0x39bbcb['query']);_0x2207f5[_0x666e('0x2f')]=_[_0x666e('0x30')](_0x2207f5[_0x666e('0x31')],_0x2207f5[_0x666e('0x2d')]);_0x115386[_0x666e('0x32')]=_[_0x666e('0x30')](_0x2207f5[_0x666e('0x31')],qs['fields'](_0x39bbcb[_0x666e('0x2d')][_0x666e('0x33')]));_0x115386['attributes']=_0x115386[_0x666e('0x32')][_0x666e('0x42')]?_0x115386[_0x666e('0x32')]:_0x2207f5[_0x666e('0x31')];if(_0x39bbcb[_0x666e('0x2d')][_0x666e('0x3c')]){_0x115386['include']=[{'all':!![]}];}_0x115386=_[_0x666e('0x39')]({},_0x115386,_0x39bbcb[_0x666e('0x3a')]);return db['SquareRecording']['find'](_0x115386)[_0x666e('0x22')](handleEntityNotFound(_0x346d8d,null))['then'](respondWithResult(_0x346d8d,null))[_0x666e('0x3f')](handleError(_0x346d8d,null));};exports['create']=function(_0x58e004,_0x5a6b5b){return db['SquareRecording'][_0x666e('0x43')](_0x58e004[_0x666e('0x44')],{})['then'](respondWithResult(_0x5a6b5b,0xc9))[_0x666e('0x3f')](handleError(_0x5a6b5b,null));};exports[_0x666e('0x21')]=function(_0x3be833,_0x30a915){if(_0x3be833[_0x666e('0x44')]['id']){delete _0x3be833['body']['id'];}return db[_0x666e('0x3b')][_0x666e('0x45')]({'where':{'id':_0x3be833[_0x666e('0x41')]['id']}})[_0x666e('0x22')](handleEntityNotFound(_0x30a915,null))[_0x666e('0x22')](saveUpdates(_0x3be833[_0x666e('0x44')],null))[_0x666e('0x22')](respondWithResult(_0x30a915,null))[_0x666e('0x3f')](handleError(_0x30a915,null));};exports[_0x666e('0x46')]=function(_0x4826bf,_0x53b0c1,_0x34331c){var _0x4f895d=require(_0x666e('0x47'));var _0xe60cd9=![];var _0x580cd2={};if(_0x4826bf['query']['type']&&_0x4826bf[_0x666e('0x2d')][_0x666e('0x2a')]===_0x666e('0x48')){_0x580cd2[_0x666e('0x48')]=_0x4826bf[_0x666e('0x41')]['id'];}else{_0x580cd2['id']=_0x4826bf[_0x666e('0x41')]['id'];}return db['SquareRecording'][_0x666e('0x45')]({'where':_0x580cd2,'attributes':['id','savePath',_0x666e('0x49')],'raw':!![]})[_0x666e('0x22')](handleEntityNotFound(_0x53b0c1,null))['then'](function(_0x3394c1){if(_0x3394c1){var _0x245bea=_0x3394c1[_0x666e('0x4a')];var _0x53baf2=util[_0x666e('0x4b')](_0x666e('0x4c'),_0x245bea);if(fs[_0x666e('0x4d')](_0x53baf2)){_0xe60cd9=!![];return _0x4f895d['decryptFile'](_0x53baf2,_0x245bea,config[_0x666e('0x4e')][_0x666e('0x4f')])['then'](function(){return _0x3394c1;});}return _0x3394c1;}})['then'](function(_0x1a62e3){if(_0x1a62e3){var _0x3ae2b9=_0x1a62e3[_0x666e('0x4a')];if(!fs[_0x666e('0x4d')](_0x3ae2b9)){throw new db[(_0x666e('0x50'))][(_0x666e('0x51'))](_0x666e('0x52'));}if(_0x1a62e3[_0x666e('0x49')]){return _0x53b0c1[_0x666e('0x46')](_0x3ae2b9,_0x1a62e3[_0x666e('0x49')]+path[_0x666e('0x53')](_0x3ae2b9),function(){if(_0xe60cd9){fs[_0x666e('0x54')](_0x3ae2b9);}});}else{return _0x53b0c1[_0x666e('0x46')](_0x3ae2b9,function(_0xe499f1){if(_0xe60cd9){fs[_0x666e('0x54')](_0x3ae2b9);}});}}})[_0x666e('0x3f')](function(_0x53b3bf){if(_0x53b3bf[_0x666e('0x55')]==='SquareRecording\x20not\x20found'){_0x53b0c1[_0x666e('0x16')](0x194)['send'](_0x666e('0x56'));}else{return handleError(_0x53b0c1,null);}});};exports[_0x666e('0x57')]=function(_0x2fff32,_0x1645cc){return db['SquareRecording'][_0x666e('0x45')]({'where':{'id':_0x2fff32[_0x666e('0x41')]['id']}})['then'](function(_0x26f150){if(_['isNil'](_0x26f150)){throw new ReferenceError(_0x666e('0x58'));}return _0x26f150;})[_0x666e('0x22')](function(_0x2817d8){var _0x509a70=_0x2817d8['savePath'];logger[_0x666e('0x59')](_0x666e('0x5a'),_0x509a70);if(!_[_0x666e('0x5b')](_0x2817d8[_0x666e('0x4a')])&&fs[_0x666e('0x4d')](_0x509a70)){logger[_0x666e('0x59')](_0x666e('0x5c')+_0x509a70+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x666e('0x5d')](_0x509a70);}_0x509a70=_0x509a70+'.cypher';if(!_['isNil'](_0x2817d8[_0x666e('0x4a')])&&fs['existsSync'](_0x509a70)){logger[_0x666e('0x59')]('File:\x20\x22'+_0x509a70+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x666e('0x5d')](_0x509a70);}return _0x2817d8;})[_0x666e('0x22')](function(_0xc474ee){if(!_0xc474ee)throw new InternalError();return _0xc474ee[_0x666e('0x57')]();})[_0x666e('0x22')](function(){_0x1645cc[_0x666e('0x16')](0xcc)['end']();})[_0x666e('0x3f')](handleError(_0x1645cc,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index cbd3051..c08e54f 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 _0x762e=['exports','define','SquareRecording','square_recordings','lodash','api','request-promise','path','rimraf','./squareRecording.attributes'];(function(_0x2b59db,_0x2fd753){var _0x1b8a3b=function(_0x41c9ab){while(--_0x41c9ab){_0x2b59db['push'](_0x2b59db['shift']());}};_0x1b8a3b(++_0x2fd753);}(_0x762e,0xea));var _0xe762=function(_0x15b20f,_0x40e904){_0x15b20f=_0x15b20f-0x0;var _0x5a86af=_0x762e[_0x15b20f];return _0x5a86af;};'use strict';var _=require(_0xe762('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe762('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe762('0x2'));var fs=require('fs');var path=require(_0xe762('0x3'));var rimraf=require(_0xe762('0x4'));var config=require('../../config/environment');var attributes=require(_0xe762('0x5'));module[_0xe762('0x6')]=function(_0x48995a,_0x4abeb6){return _0x48995a[_0xe762('0x7')](_0xe762('0x8'),attributes,{'tableName':_0xe762('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb90a=['../../config/environment','./squareRecording.attributes','define','SquareRecording','lodash','util','api'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0xb90a,0x12a));var _0xab90=function(_0x206aec,_0x3a5d60){_0x206aec=_0x206aec-0x0;var _0x369042=_0xb90a[_0x206aec];return _0x369042;};'use strict';var _=require(_0xab90('0x0'));var util=require(_0xab90('0x1'));var logger=require('../../config/logger')(_0xab90('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('rimraf');var config=require(_0xab90('0x3'));var attributes=require(_0xab90('0x4'));module['exports']=function(_0x5e0540,_0xf36407){return _0x5e0540[_0xab90('0x5')](_0xab90('0x6'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 17d146e..ba5a5d7 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 _0x1a55=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','lodash','moment','bluebird'];(function(_0x5cff47,_0x561069){var _0x2a2efe=function(_0x46acac){while(--_0x46acac){_0x5cff47['push'](_0x5cff47['shift']());}};_0x2a2efe(++_0x561069);}(_0x1a55,0x102));var _0x51a5=function(_0x289596,_0x2c6663){_0x289596=_0x289596-0x0;var _0x1c9de8=_0x1a55[_0x289596];return _0x1c9de8;};'use strict';var _=require(_0x51a5('0x0'));var util=require('util');var moment=require(_0x51a5('0x1'));var BPromise=require(_0x51a5('0x2'));var rs=require(_0x51a5('0x3'));var fs=require('fs');var Redis=require(_0x51a5('0x4'));var db=require(_0x51a5('0x5'))['db'];var utils=require(_0x51a5('0x6'));var logger=require(_0x51a5('0x7'))(_0x51a5('0x8'));var config=require(_0x51a5('0x9'));var jayson=require(_0x51a5('0xa'));var client=jayson[_0x51a5('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33c819,_0x91324d,_0x85a124){return new BPromise(function(_0x11a6b2,_0xf8659c){return client[_0x51a5('0xc')](_0x33c819,_0x85a124)['then'](function(_0x2c0bc7){logger[_0x51a5('0xd')](_0x51a5('0xe'),_0x91324d,'request\x20sent');logger[_0x51a5('0xf')](_0x51a5('0x10'),_0x91324d,'request\x20sent',JSON[_0x51a5('0x11')](_0x2c0bc7));if(_0x2c0bc7[_0x51a5('0x12')]){if(_0x2c0bc7[_0x51a5('0x12')]['code']===0x1f4){logger[_0x51a5('0x12')](_0x51a5('0xe'),_0x91324d,_0x2c0bc7[_0x51a5('0x12')]['message']);return _0xf8659c(_0x2c0bc7[_0x51a5('0x12')][_0x51a5('0x13')]);}logger['error']('SquareRecording,\x20%s,\x20%s',_0x91324d,_0x2c0bc7[_0x51a5('0x12')]['message']);return _0x11a6b2(_0x2c0bc7[_0x51a5('0x12')]['message']);}else{logger['info'](_0x51a5('0xe'),_0x91324d,_0x51a5('0x14'));_0x11a6b2(_0x2c0bc7[_0x51a5('0x15')]['message']);}})[_0x51a5('0x16')](function(_0x5a54fc){logger['error'](_0x51a5('0xe'),_0x91324d,_0x5a54fc);_0xf8659c(_0x5a54fc);});});}exports[_0x51a5('0x17')]=function(_0x583f94){var _0x5ba2d9=this;return new Promise(function(_0x30d3b7,_0x1f8cc9){return db[_0x51a5('0x18')][_0x51a5('0x19')](_0x583f94[_0x51a5('0x1a')],{'raw':_0x583f94[_0x51a5('0x1b')]?_0x583f94[_0x51a5('0x1b')][_0x51a5('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x45d602){logger[_0x51a5('0xd')](_0x51a5('0x17'),_0x583f94);logger[_0x51a5('0xf')]('CreateSquareRecording',_0x583f94,JSON[_0x51a5('0x11')](_0x45d602));_0x30d3b7(_0x45d602);})['catch'](function(_0x38df97){logger['error'](_0x51a5('0x17'),_0x38df97[_0x51a5('0x13')],_0x583f94);_0x1f8cc9(_0x5ba2d9[_0x51a5('0x12')](0x1f4,_0x38df97[_0x51a5('0x13')]));});});}; \ No newline at end of file +var _0xd152=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareRecording','SquareRecording','options','raw','util','randomstring'];(function(_0x4b0167,_0x154254){var _0x635b82=function(_0x3ecb62){while(--_0x3ecb62){_0x4b0167['push'](_0x4b0167['shift']());}};_0x635b82(++_0x154254);}(_0xd152,0x66));var _0x2d15=function(_0x2bdc0b,_0x487dae){_0x2bdc0b=_0x2bdc0b-0x0;var _0x2a8794=_0xd152[_0x2bdc0b];return _0x2a8794;};'use strict';var _=require('lodash');var util=require(_0x2d15('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2d15('0x1'));var fs=require('fs');var Redis=require(_0x2d15('0x2'));var db=require(_0x2d15('0x3'))['db'];var utils=require(_0x2d15('0x4'));var logger=require(_0x2d15('0x5'))('rpc');var config=require(_0x2d15('0x6'));var jayson=require(_0x2d15('0x7'));var client=jayson[_0x2d15('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10fe47,_0x1cd3b2,_0x39665e){return new BPromise(function(_0x304e48,_0x4d6218){return client[_0x2d15('0x9')](_0x10fe47,_0x39665e)[_0x2d15('0xa')](function(_0x18d6d3){logger[_0x2d15('0xb')](_0x2d15('0xc'),_0x1cd3b2,_0x2d15('0xd'));logger[_0x2d15('0xe')](_0x2d15('0xf'),_0x1cd3b2,_0x2d15('0xd'),JSON[_0x2d15('0x10')](_0x18d6d3));if(_0x18d6d3[_0x2d15('0x11')]){if(_0x18d6d3['error'][_0x2d15('0x12')]===0x1f4){logger[_0x2d15('0x11')](_0x2d15('0xc'),_0x1cd3b2,_0x18d6d3['error'][_0x2d15('0x13')]);return _0x4d6218(_0x18d6d3[_0x2d15('0x11')][_0x2d15('0x13')]);}logger[_0x2d15('0x11')](_0x2d15('0xc'),_0x1cd3b2,_0x18d6d3['error'][_0x2d15('0x13')]);return _0x304e48(_0x18d6d3[_0x2d15('0x11')][_0x2d15('0x13')]);}else{logger[_0x2d15('0xb')](_0x2d15('0xc'),_0x1cd3b2,_0x2d15('0xd'));_0x304e48(_0x18d6d3[_0x2d15('0x14')][_0x2d15('0x13')]);}})[_0x2d15('0x15')](function(_0x560e10){logger['error']('SquareRecording,\x20%s,\x20%s',_0x1cd3b2,_0x560e10);_0x4d6218(_0x560e10);});});}exports[_0x2d15('0x16')]=function(_0x5632ba){var _0xdeac07=this;return new Promise(function(_0x267334,_0x203cae){return db[_0x2d15('0x17')]['create'](_0x5632ba['body'],{'raw':_0x5632ba[_0x2d15('0x18')]?_0x5632ba['options'][_0x2d15('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x33771d){logger[_0x2d15('0xb')](_0x2d15('0x16'),_0x5632ba);logger['debug']('CreateSquareRecording',_0x5632ba,JSON[_0x2d15('0x10')](_0x33771d));_0x267334(_0x33771d);})[_0x2d15('0x15')](function(_0x317219){logger[_0x2d15('0x11')](_0x2d15('0x16'),_0x317219[_0x2d15('0x13')],_0x5632ba);_0x203cae(_0xdeac07[_0x2d15('0x11')](0x1f4,_0x317219[_0x2d15('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 4bc20dc..dfcbdef 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(_0x222f8f,_0x2f31a4){var _0x5650e6=function(_0x106c4){while(--_0x106c4){_0x222f8f['push'](_0x222f8f['shift']());}};_0x5650e6(++_0x2f31a4);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'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 _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(_0x28d4d0,_0x59656f){var _0x11d661=function(_0x227d63){while(--_0x227d63){_0x28d4d0['push'](_0x28d4d0['shift']());}};_0x11d661(++_0x59656f);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index f686a6d..8615664 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 _0x8edd=['BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x59d212,_0x126f7b){var _0x16eb64=function(_0x1ade17){while(--_0x1ade17){_0x59d212['push'](_0x59d212['shift']());}};_0x16eb64(++_0x126f7b);}(_0x8edd,0x8d));var _0xd8ed=function(_0x48db05,_0x3261b7){_0x48db05=_0x48db05-0x0;var _0x2ad791=_0x8edd[_0x48db05];return _0x2ad791;};'use strict';var Sequelize=require(_0xd8ed('0x0'));module[_0xd8ed('0x1')]={'network':{'type':Sequelize[_0xd8ed('0x2')]},'network_script':{'type':Sequelize[_0xd8ed('0x2')]},'request':{'type':Sequelize[_0xd8ed('0x2')]},'channel':{'type':Sequelize[_0xd8ed('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xd8ed('0x2')]},'uniqueid':{'type':Sequelize[_0xd8ed('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xd8ed('0x2')]},'callingpres':{'type':Sequelize[_0xd8ed('0x2')]},'callingani2':{'type':Sequelize[_0xd8ed('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xd8ed('0x2')]},'rdnis':{'type':Sequelize[_0xd8ed('0x2')]},'context':{'type':Sequelize[_0xd8ed('0x2')]},'extension':{'type':Sequelize[_0xd8ed('0x2')]},'priority':{'type':Sequelize[_0xd8ed('0x2')]},'enhanced':{'type':Sequelize[_0xd8ed('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xd8ed('0x2')]},'joinAt':{'type':Sequelize[_0xd8ed('0x3')]},'leaveAt':{'type':Sequelize[_0xd8ed('0x3')]},'bot':{'type':Sequelize[_0xd8ed('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xdc96=['DATE','BOOLEAN','exports','STRING'];(function(_0x5a4e85,_0x30ba85){var _0x209aa7=function(_0x287c43){while(--_0x287c43){_0x5a4e85['push'](_0x5a4e85['shift']());}};_0x209aa7(++_0x30ba85);}(_0xdc96,0x1da));var _0x6dc9=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xdc96[_0x2c7618];return _0x5ce3f0;};'use strict';var Sequelize=require('sequelize');module[_0x6dc9('0x0')]={'network':{'type':Sequelize[_0x6dc9('0x1')]},'network_script':{'type':Sequelize[_0x6dc9('0x1')]},'request':{'type':Sequelize[_0x6dc9('0x1')]},'channel':{'type':Sequelize[_0x6dc9('0x1')]},'language':{'type':Sequelize[_0x6dc9('0x1')]},'type':{'type':Sequelize[_0x6dc9('0x1')]},'uniqueid':{'type':Sequelize[_0x6dc9('0x1')]},'version':{'type':Sequelize[_0x6dc9('0x1')]},'callerid':{'type':Sequelize[_0x6dc9('0x1')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x6dc9('0x1')]},'callingani2':{'type':Sequelize[_0x6dc9('0x1')]},'callington':{'type':Sequelize[_0x6dc9('0x1')]},'callingtns':{'type':Sequelize[_0x6dc9('0x1')]},'dnid':{'type':Sequelize[_0x6dc9('0x1')]},'rdnis':{'type':Sequelize[_0x6dc9('0x1')]},'context':{'type':Sequelize[_0x6dc9('0x1')]},'extension':{'type':Sequelize[_0x6dc9('0x1')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x6dc9('0x1')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x6dc9('0x1')]},'project_name':{'type':Sequelize[_0x6dc9('0x1')]},'joinAt':{'type':Sequelize[_0x6dc9('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x6dc9('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 46ee94b..5b103bc 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 _0x4070=['key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','catch','show','params','length','find','body','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','SquareReport','rawAttributes','fieldName','type'];(function(_0x5e178e,_0x54568c){var _0x4500b6=function(_0x47b81a){while(--_0x47b81a){_0x5e178e['push'](_0x5e178e['shift']());}};_0x4500b6(++_0x54568c);}(_0x4070,0x103));var _0x0407=function(_0x148bc0,_0xf5cfdc){_0x148bc0=_0x148bc0-0x0;var _0x34d7d0=_0x4070[_0x148bc0];return _0x34d7d0;};'use strict';var emlformat=require(_0x0407('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0407('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0407('0x2'));var moment=require(_0x0407('0x3'));var BPromise=require(_0x0407('0x4'));var Mustache=require(_0x0407('0x5'));var util=require(_0x0407('0x6'));var path=require(_0x0407('0x7'));var sox=require(_0x0407('0x8'));var csv=require(_0x0407('0x9'));var ejs=require(_0x0407('0xa'));var fs=require('fs');var fs_extra=require(_0x0407('0xb'));var _=require(_0x0407('0xc'));var squel=require(_0x0407('0xd'));var crypto=require(_0x0407('0xe'));var jsforce=require(_0x0407('0xf'));var deskjs=require(_0x0407('0x10'));var toCsv=require(_0x0407('0x9'));var querystring=require('querystring');var Papa=require(_0x0407('0x11'));var Redis=require(_0x0407('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0407('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0407('0x14'))(_0x0407('0x15'));var utils=require(_0x0407('0x16'));var config=require(_0x0407('0x17'));var licenseUtil=require(_0x0407('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e0cf3,_0x497402){_0x497402=_0x497402||0xcc;return function(_0x3525f7){if(_0x3525f7){return _0x4e0cf3[_0x0407('0x19')](_0x497402);}return _0x4e0cf3[_0x0407('0x1a')](_0x497402)[_0x0407('0x1b')]();};}function respondWithResult(_0x5ec8d4,_0x157f94){_0x157f94=_0x157f94||0xc8;return function(_0x6f1e9f){if(_0x6f1e9f){return _0x5ec8d4[_0x0407('0x1a')](_0x157f94)[_0x0407('0x1c')](_0x6f1e9f);}};}function respondWithFilteredResult(_0x1b80e7,_0x11e6c9){return function(_0x4e6b55){if(_0x4e6b55){var _0x55cc26=typeof _0x11e6c9[_0x0407('0x1d')]===_0x0407('0x1e')&&typeof _0x11e6c9['limit']==='undefined';var _0x13be12=_0x4e6b55[_0x0407('0x1f')];var _0x1df7c5=_0x55cc26?0x0:_0x11e6c9['offset'];var _0x4e48f6=_0x55cc26?_0x4e6b55[_0x0407('0x1f')]:_0x11e6c9[_0x0407('0x1d')]+_0x11e6c9[_0x0407('0x20')];var _0x5a5d12;if(_0x4e48f6>=_0x13be12){_0x4e48f6=_0x13be12;_0x5a5d12=0xc8;}else{_0x5a5d12=0xce;}_0x1b80e7['status'](_0x5a5d12);return _0x1b80e7[_0x0407('0x21')](_0x0407('0x22'),_0x1df7c5+'-'+_0x4e48f6+'/'+_0x13be12)[_0x0407('0x1c')](_0x4e6b55);}return null;};}function patchUpdates(_0xb1709d){return function(_0xa27ae0){try{jsonpatch[_0x0407('0x23')](_0xa27ae0,_0xb1709d,!![]);}catch(_0x2dd3c9){return BPromise[_0x0407('0x24')](_0x2dd3c9);}return _0xa27ae0[_0x0407('0x25')]();};}function saveUpdates(_0x351094,_0x35cb56){return function(_0x1ec938){if(_0x1ec938){return _0x1ec938[_0x0407('0x26')](_0x351094)[_0x0407('0x27')](function(_0x376de6){return _0x376de6;});}return null;};}function removeEntity(_0x59bbac,_0x2b2ca9){return function(_0x548be0){if(_0x548be0){return _0x548be0[_0x0407('0x28')]()[_0x0407('0x27')](function(){_0x59bbac[_0x0407('0x1a')](0xcc)[_0x0407('0x1b')]();});}};}function handleEntityNotFound(_0x15d5cc,_0x3b99c9){return function(_0x3c1d79){if(!_0x3c1d79){_0x15d5cc['sendStatus'](0x194);}return _0x3c1d79;};}function handleError(_0x1a5870,_0x82eed6){_0x82eed6=_0x82eed6||0x1f4;return function(_0x37b9d8){logger['error'](_0x37b9d8[_0x0407('0x29')]);if(_0x37b9d8[_0x0407('0x2a')]){delete _0x37b9d8[_0x0407('0x2a')];}_0x1a5870['status'](_0x82eed6)[_0x0407('0x2b')](_0x37b9d8);};}exports[_0x0407('0x2c')]=function(_0x53b499,_0x5197ea){var _0x540004={},_0xe145fc={},_0x5c3c95={'count':0x0,'rows':[]};var _0x5f35b8=_['map'](db[_0x0407('0x2d')][_0x0407('0x2e')],function(_0x278e4d){return{'name':_0x278e4d[_0x0407('0x2f')],'type':_0x278e4d[_0x0407('0x30')][_0x0407('0x31')]};});_0xe145fc[_0x0407('0x32')]=_[_0x0407('0x33')](_0x5f35b8,_0x0407('0x2a'));_0xe145fc[_0x0407('0x34')]=_[_0x0407('0x35')](_0x53b499[_0x0407('0x34')]);_0xe145fc[_0x0407('0x36')]=_[_0x0407('0x37')](_0xe145fc['model'],_0xe145fc[_0x0407('0x34')]);_0x540004[_0x0407('0x38')]=_[_0x0407('0x37')](_0xe145fc['model'],qs[_0x0407('0x39')](_0x53b499[_0x0407('0x34')]['fields']));_0x540004[_0x0407('0x38')]=_0x540004[_0x0407('0x38')]['length']?_0x540004[_0x0407('0x38')]:_0xe145fc[_0x0407('0x32')];if(!_0x53b499['query'][_0x0407('0x3a')](_0x0407('0x3b'))){_0x540004[_0x0407('0x20')]=qs[_0x0407('0x20')](_0x53b499[_0x0407('0x34')]['limit']);_0x540004['offset']=qs[_0x0407('0x1d')](_0x53b499['query']['offset']);}_0x540004[_0x0407('0x3c')]=qs[_0x0407('0x3d')](_0x53b499[_0x0407('0x34')][_0x0407('0x3d')]);_0x540004[_0x0407('0x3e')]=qs[_0x0407('0x36')](_[_0x0407('0x3f')](_0x53b499['query'],_0xe145fc[_0x0407('0x36')]),_0x5f35b8);if(_0x53b499[_0x0407('0x34')][_0x0407('0x40')]){_0x540004['where']=_['merge'](_0x540004[_0x0407('0x3e')],{'$or':_[_0x0407('0x33')](_0x5f35b8,function(_0x2aef25){if(_0x2aef25['type']!==_0x0407('0x41')){var _0x53ca17={};_0x53ca17[_0x2aef25[_0x0407('0x2a')]]={'$like':'%'+_0x53b499[_0x0407('0x34')][_0x0407('0x40')]+'%'};return _0x53ca17;}})});}_0x540004=_[_0x0407('0x42')]({},_0x540004,_0x53b499[_0x0407('0x43')]);var _0x26d3e0={'where':_0x540004['where']};return db[_0x0407('0x2d')][_0x0407('0x1f')](_0x26d3e0)[_0x0407('0x27')](function(_0x2f10be){_0x5c3c95['count']=_0x2f10be;if(_0x53b499[_0x0407('0x34')][_0x0407('0x44')]){_0x540004[_0x0407('0x45')]=[{'all':!![]}];}return db['SquareReport']['findAll'](_0x540004);})[_0x0407('0x27')](function(_0x2c4f45){_0x5c3c95['rows']=_0x2c4f45;return _0x5c3c95;})[_0x0407('0x27')](respondWithFilteredResult(_0x5197ea,_0x540004))[_0x0407('0x46')](handleError(_0x5197ea,null));};exports[_0x0407('0x47')]=function(_0x32a70a,_0x11676a){var _0x28c953={'raw':!![],'where':{'id':_0x32a70a[_0x0407('0x48')]['id']}},_0x5aad0d={};_0x5aad0d[_0x0407('0x32')]=_['keys'](db[_0x0407('0x2d')][_0x0407('0x2e')]);_0x5aad0d[_0x0407('0x34')]=_[_0x0407('0x35')](_0x32a70a['query']);_0x5aad0d[_0x0407('0x36')]=_[_0x0407('0x37')](_0x5aad0d[_0x0407('0x32')],_0x5aad0d[_0x0407('0x34')]);_0x28c953[_0x0407('0x38')]=_[_0x0407('0x37')](_0x5aad0d[_0x0407('0x32')],qs['fields'](_0x32a70a[_0x0407('0x34')][_0x0407('0x39')]));_0x28c953[_0x0407('0x38')]=_0x28c953['attributes'][_0x0407('0x49')]?_0x28c953[_0x0407('0x38')]:_0x5aad0d['model'];if(_0x32a70a['query'][_0x0407('0x44')]){_0x28c953[_0x0407('0x45')]=[{'all':!![]}];}_0x28c953=_[_0x0407('0x42')]({},_0x28c953,_0x32a70a[_0x0407('0x43')]);return db['SquareReport'][_0x0407('0x4a')](_0x28c953)[_0x0407('0x27')](handleEntityNotFound(_0x11676a,null))[_0x0407('0x27')](respondWithResult(_0x11676a,null))[_0x0407('0x46')](handleError(_0x11676a,null));};exports['create']=function(_0x892ce,_0x3e5202){return db[_0x0407('0x2d')]['create'](_0x892ce[_0x0407('0x4b')],{})[_0x0407('0x27')](respondWithResult(_0x3e5202,0xc9))['catch'](handleError(_0x3e5202,null));};exports[_0x0407('0x26')]=function(_0x4dd347,_0xbd0d66){if(_0x4dd347[_0x0407('0x4b')]['id']){delete _0x4dd347[_0x0407('0x4b')]['id'];}return db[_0x0407('0x2d')][_0x0407('0x4a')]({'where':{'id':_0x4dd347[_0x0407('0x48')]['id']}})[_0x0407('0x27')](handleEntityNotFound(_0xbd0d66,null))[_0x0407('0x27')](saveUpdates(_0x4dd347[_0x0407('0x4b')],null))[_0x0407('0x27')](respondWithResult(_0xbd0d66,null))['catch'](handleError(_0xbd0d66,null));};exports[_0x0407('0x28')]=function(_0x32acca,_0xc28496){return db['SquareReport'][_0x0407('0x4a')]({'where':{'id':_0x32acca['params']['id']}})[_0x0407('0x27')](handleEntityNotFound(_0xc28496,null))[_0x0407('0x27')](removeEntity(_0xc28496,null))[_0x0407('0x46')](handleError(_0xc28496,null));};exports[_0x0407('0x4c')]=function(_0x3d508f,_0x4c1df3){return db[_0x0407('0x2d')][_0x0407('0x4c')]()[_0x0407('0x27')](respondWithResult(_0x4c1df3,null))[_0x0407('0x46')](handleError(_0x4c1df3,null));}; \ No newline at end of file +var _0xd3f7=['map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','merge','options','SquareReport','includeAll','include','findAll','rows','params','keys','find','catch','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','end','error','stack','name','send'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd3f7,0xbb));var _0x7d3f=function(_0xc77819,_0x139fdc){_0xc77819=_0xc77819-0x0;var _0x1c9434=_0xd3f7[_0xc77819];return _0x1c9434;};'use strict';var emlformat=require(_0x7d3f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7d3f('0x1'));var jsonpatch=require(_0x7d3f('0x2'));var rp=require(_0x7d3f('0x3'));var moment=require(_0x7d3f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7d3f('0x5'));var util=require(_0x7d3f('0x6'));var path=require(_0x7d3f('0x7'));var sox=require(_0x7d3f('0x8'));var csv=require(_0x7d3f('0x9'));var ejs=require(_0x7d3f('0xa'));var fs=require('fs');var fs_extra=require(_0x7d3f('0xb'));var _=require(_0x7d3f('0xc'));var squel=require(_0x7d3f('0xd'));var crypto=require(_0x7d3f('0xe'));var jsforce=require(_0x7d3f('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7d3f('0x9'));var querystring=require(_0x7d3f('0x10'));var Papa=require(_0x7d3f('0x11'));var Redis=require(_0x7d3f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7d3f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7d3f('0x14'));var logger=require('../../config/logger')(_0x7d3f('0x15'));var utils=require(_0x7d3f('0x16'));var config=require(_0x7d3f('0x17'));var licenseUtil=require(_0x7d3f('0x18'));var db=require(_0x7d3f('0x19'))['db'];function respondWithStatusCode(_0x2e16b2,_0x53c9b6){_0x53c9b6=_0x53c9b6||0xcc;return function(_0x340f8b){if(_0x340f8b){return _0x2e16b2[_0x7d3f('0x1a')](_0x53c9b6);}return _0x2e16b2['status'](_0x53c9b6)['end']();};}function respondWithResult(_0x2244bd,_0x474c20){_0x474c20=_0x474c20||0xc8;return function(_0x15bfa0){if(_0x15bfa0){return _0x2244bd[_0x7d3f('0x1b')](_0x474c20)[_0x7d3f('0x1c')](_0x15bfa0);}};}function respondWithFilteredResult(_0x4468b1,_0x5f0a29){return function(_0x149261){if(_0x149261){var _0x2dfe3e=typeof _0x5f0a29[_0x7d3f('0x1d')]===_0x7d3f('0x1e')&&typeof _0x5f0a29[_0x7d3f('0x1f')]===_0x7d3f('0x1e');var _0x58de31=_0x149261[_0x7d3f('0x20')];var _0x33fd54=_0x2dfe3e?0x0:_0x5f0a29[_0x7d3f('0x1d')];var _0x4c4a0c=_0x2dfe3e?_0x149261[_0x7d3f('0x20')]:_0x5f0a29[_0x7d3f('0x1d')]+_0x5f0a29[_0x7d3f('0x1f')];var _0x27cfa7;if(_0x4c4a0c>=_0x58de31){_0x4c4a0c=_0x58de31;_0x27cfa7=0xc8;}else{_0x27cfa7=0xce;}_0x4468b1['status'](_0x27cfa7);return _0x4468b1[_0x7d3f('0x21')](_0x7d3f('0x22'),_0x33fd54+'-'+_0x4c4a0c+'/'+_0x58de31)[_0x7d3f('0x1c')](_0x149261);}return null;};}function patchUpdates(_0xce1191){return function(_0x527e9d){try{jsonpatch[_0x7d3f('0x23')](_0x527e9d,_0xce1191,!![]);}catch(_0x378561){return BPromise[_0x7d3f('0x24')](_0x378561);}return _0x527e9d['save']();};}function saveUpdates(_0x5f5b54,_0x2ef99f){return function(_0x5715c5){if(_0x5715c5){return _0x5715c5[_0x7d3f('0x25')](_0x5f5b54)[_0x7d3f('0x26')](function(_0x4c5743){return _0x4c5743;});}return null;};}function removeEntity(_0x37606e,_0x3ec5f0){return function(_0x5d2c21){if(_0x5d2c21){return _0x5d2c21['destroy']()[_0x7d3f('0x26')](function(){_0x37606e['status'](0xcc)[_0x7d3f('0x27')]();});}};}function handleEntityNotFound(_0xe37283,_0x623dfe){return function(_0x1ee0b3){if(!_0x1ee0b3){_0xe37283[_0x7d3f('0x1a')](0x194);}return _0x1ee0b3;};}function handleError(_0x1cd5d4,_0x4fb007){_0x4fb007=_0x4fb007||0x1f4;return function(_0x98b0bb){logger[_0x7d3f('0x28')](_0x98b0bb[_0x7d3f('0x29')]);if(_0x98b0bb[_0x7d3f('0x2a')]){delete _0x98b0bb['name'];}_0x1cd5d4[_0x7d3f('0x1b')](_0x4fb007)[_0x7d3f('0x2b')](_0x98b0bb);};}exports['index']=function(_0x918bf6,_0x47ddbc){var _0x5fde36={},_0x4869cf={},_0x1287c1={'count':0x0,'rows':[]};var _0x8f241d=_[_0x7d3f('0x2c')](db['SquareReport'][_0x7d3f('0x2d')],function(_0x531d11){return{'name':_0x531d11[_0x7d3f('0x2e')],'type':_0x531d11['type'][_0x7d3f('0x2f')]};});_0x4869cf[_0x7d3f('0x30')]=_[_0x7d3f('0x2c')](_0x8f241d,_0x7d3f('0x2a'));_0x4869cf[_0x7d3f('0x31')]=_['keys'](_0x918bf6['query']);_0x4869cf[_0x7d3f('0x32')]=_[_0x7d3f('0x33')](_0x4869cf['model'],_0x4869cf[_0x7d3f('0x31')]);_0x5fde36[_0x7d3f('0x34')]=_['intersection'](_0x4869cf['model'],qs[_0x7d3f('0x35')](_0x918bf6[_0x7d3f('0x31')]['fields']));_0x5fde36[_0x7d3f('0x34')]=_0x5fde36[_0x7d3f('0x34')][_0x7d3f('0x36')]?_0x5fde36['attributes']:_0x4869cf['model'];if(!_0x918bf6[_0x7d3f('0x31')][_0x7d3f('0x37')]('nolimit')){_0x5fde36[_0x7d3f('0x1f')]=qs[_0x7d3f('0x1f')](_0x918bf6[_0x7d3f('0x31')][_0x7d3f('0x1f')]);_0x5fde36['offset']=qs[_0x7d3f('0x1d')](_0x918bf6[_0x7d3f('0x31')][_0x7d3f('0x1d')]);}_0x5fde36[_0x7d3f('0x38')]=qs[_0x7d3f('0x39')](_0x918bf6[_0x7d3f('0x31')][_0x7d3f('0x39')]);_0x5fde36[_0x7d3f('0x3a')]=qs[_0x7d3f('0x32')](_[_0x7d3f('0x3b')](_0x918bf6[_0x7d3f('0x31')],_0x4869cf[_0x7d3f('0x32')]),_0x8f241d);if(_0x918bf6[_0x7d3f('0x31')][_0x7d3f('0x3c')]){_0x5fde36[_0x7d3f('0x3a')]=_['merge'](_0x5fde36[_0x7d3f('0x3a')],{'$or':_[_0x7d3f('0x2c')](_0x8f241d,function(_0x299713){if(_0x299713[_0x7d3f('0x3d')]!=='VIRTUAL'){var _0x29c75f={};_0x29c75f[_0x299713[_0x7d3f('0x2a')]]={'$like':'%'+_0x918bf6['query']['filter']+'%'};return _0x29c75f;}})});}_0x5fde36=_[_0x7d3f('0x3e')]({},_0x5fde36,_0x918bf6[_0x7d3f('0x3f')]);var _0x245438={'where':_0x5fde36[_0x7d3f('0x3a')]};return db[_0x7d3f('0x40')]['count'](_0x245438)[_0x7d3f('0x26')](function(_0x3c446f){_0x1287c1['count']=_0x3c446f;if(_0x918bf6[_0x7d3f('0x31')][_0x7d3f('0x41')]){_0x5fde36[_0x7d3f('0x42')]=[{'all':!![]}];}return db['SquareReport'][_0x7d3f('0x43')](_0x5fde36);})[_0x7d3f('0x26')](function(_0x4e828d){_0x1287c1[_0x7d3f('0x44')]=_0x4e828d;return _0x1287c1;})['then'](respondWithFilteredResult(_0x47ddbc,_0x5fde36))['catch'](handleError(_0x47ddbc,null));};exports['show']=function(_0x444c6c,_0xcc98b3){var _0xb990c6={'raw':!![],'where':{'id':_0x444c6c[_0x7d3f('0x45')]['id']}},_0x21a19a={};_0x21a19a[_0x7d3f('0x30')]=_[_0x7d3f('0x46')](db[_0x7d3f('0x40')][_0x7d3f('0x2d')]);_0x21a19a['query']=_[_0x7d3f('0x46')](_0x444c6c[_0x7d3f('0x31')]);_0x21a19a[_0x7d3f('0x32')]=_[_0x7d3f('0x33')](_0x21a19a['model'],_0x21a19a[_0x7d3f('0x31')]);_0xb990c6[_0x7d3f('0x34')]=_[_0x7d3f('0x33')](_0x21a19a[_0x7d3f('0x30')],qs['fields'](_0x444c6c['query'][_0x7d3f('0x35')]));_0xb990c6['attributes']=_0xb990c6['attributes']['length']?_0xb990c6[_0x7d3f('0x34')]:_0x21a19a[_0x7d3f('0x30')];if(_0x444c6c[_0x7d3f('0x31')]['includeAll']){_0xb990c6[_0x7d3f('0x42')]=[{'all':!![]}];}_0xb990c6=_[_0x7d3f('0x3e')]({},_0xb990c6,_0x444c6c[_0x7d3f('0x3f')]);return db[_0x7d3f('0x40')][_0x7d3f('0x47')](_0xb990c6)[_0x7d3f('0x26')](handleEntityNotFound(_0xcc98b3,null))['then'](respondWithResult(_0xcc98b3,null))[_0x7d3f('0x48')](handleError(_0xcc98b3,null));};exports[_0x7d3f('0x49')]=function(_0xcccc1d,_0x3c3933){return db[_0x7d3f('0x40')][_0x7d3f('0x49')](_0xcccc1d['body'],{})[_0x7d3f('0x26')](respondWithResult(_0x3c3933,0xc9))['catch'](handleError(_0x3c3933,null));};exports[_0x7d3f('0x25')]=function(_0x200e71,_0x1d4b1f){if(_0x200e71['body']['id']){delete _0x200e71[_0x7d3f('0x4a')]['id'];}return db[_0x7d3f('0x40')]['find']({'where':{'id':_0x200e71[_0x7d3f('0x45')]['id']}})[_0x7d3f('0x26')](handleEntityNotFound(_0x1d4b1f,null))[_0x7d3f('0x26')](saveUpdates(_0x200e71['body'],null))[_0x7d3f('0x26')](respondWithResult(_0x1d4b1f,null))[_0x7d3f('0x48')](handleError(_0x1d4b1f,null));};exports[_0x7d3f('0x4b')]=function(_0x3364e1,_0x5dc3fa){return db[_0x7d3f('0x40')]['find']({'where':{'id':_0x3364e1[_0x7d3f('0x45')]['id']}})['then'](handleEntityNotFound(_0x5dc3fa,null))[_0x7d3f('0x26')](removeEntity(_0x5dc3fa,null))[_0x7d3f('0x48')](handleError(_0x5dc3fa,null));};exports[_0x7d3f('0x4c')]=function(_0x379221,_0x348cd7){return db['SquareReport'][_0x7d3f('0x4c')]()[_0x7d3f('0x26')](respondWithResult(_0x348cd7,null))[_0x7d3f('0x48')](handleError(_0x348cd7,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index ffd97e7..2bc2a35 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 _0xa3ec=['exports','define','SquareReport','report_square','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./squareReport.attributes'];(function(_0x2cbb2a,_0x3cedf5){var _0x51579f=function(_0x329c0b){while(--_0x329c0b){_0x2cbb2a['push'](_0x2cbb2a['shift']());}};_0x51579f(++_0x3cedf5);}(_0xa3ec,0x106));var _0xca3e=function(_0x1f2313,_0xee725c){_0x1f2313=_0x1f2313-0x0;var _0x3b649c=_0xa3ec[_0x1f2313];return _0x3b649c;};'use strict';var _=require(_0xca3e('0x0'));var util=require(_0xca3e('0x1'));var logger=require(_0xca3e('0x2'))(_0xca3e('0x3'));var moment=require(_0xca3e('0x4'));var BPromise=require(_0xca3e('0x5'));var rp=require(_0xca3e('0x6'));var fs=require('fs');var path=require(_0xca3e('0x7'));var rimraf=require(_0xca3e('0x8'));var config=require('../../config/environment');var attributes=require(_0xca3e('0x9'));module[_0xca3e('0xa')]=function(_0x39295b,_0x5278f7){return _0x39295b[_0xca3e('0xb')](_0xca3e('0xc'),attributes,{'tableName':_0xca3e('0xd'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0xca3e('0xe'),_0xca3e('0xf')]},{'name':_0xca3e('0x10'),'fields':[_0xca3e('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x47cd=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./squareReport.attributes','define','SquareReport','report_square','uniqueid','project_name'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x47cd,0xc4));var _0xd47c=function(_0x5ac31d,_0x56aaac){_0x5ac31d=_0x5ac31d-0x0;var _0x49a8bf=_0x47cd[_0x5ac31d];return _0x49a8bf;};'use strict';var _=require(_0xd47c('0x0'));var util=require(_0xd47c('0x1'));var logger=require(_0xd47c('0x2'))('api');var moment=require(_0xd47c('0x3'));var BPromise=require(_0xd47c('0x4'));var rp=require(_0xd47c('0x5'));var fs=require('fs');var path=require(_0xd47c('0x6'));var rimraf=require(_0xd47c('0x7'));var config=require('../../config/environment');var attributes=require(_0xd47c('0x8'));module['exports']=function(_0x54313b,_0x2364bf){return _0x54313b[_0xd47c('0x9')](_0xd47c('0xa'),attributes,{'tableName':_0xd47c('0xb'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0xd47c('0xc'),_0xd47c('0xd')]},{'name':'leaveAt','fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index d01d8ae..f222268 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 _0x7e4f=['info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateSquareReport','create','body','options','raw','UpdateSquareReport','SquareReport','update','where','limit','then','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request'];(function(_0x3735bf,_0x4bce37){var _0x2d9565=function(_0x443fa4){while(--_0x443fa4){_0x3735bf['push'](_0x3735bf['shift']());}};_0x2d9565(++_0x4bce37);}(_0x7e4f,0xee));var _0xf7e4=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x7e4f[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf7e4('0x0'));var BPromise=require(_0xf7e4('0x1'));var rs=require(_0xf7e4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf7e4('0x3'))['db'];var utils=require(_0xf7e4('0x4'));var logger=require(_0xf7e4('0x5'))(_0xf7e4('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf7e4('0x7')][_0xf7e4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x168cc4,_0x46b472,_0x1d7b8e){return new BPromise(function(_0x57d427,_0xc306fc){return client[_0xf7e4('0x9')](_0x168cc4,_0x1d7b8e)['then'](function(_0x284055){logger[_0xf7e4('0xa')](_0xf7e4('0xb'),_0x46b472,_0xf7e4('0xc'));logger[_0xf7e4('0xd')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x46b472,'request\x20sent',JSON[_0xf7e4('0xe')](_0x284055));if(_0x284055[_0xf7e4('0xf')]){if(_0x284055[_0xf7e4('0xf')][_0xf7e4('0x10')]===0x1f4){logger[_0xf7e4('0xf')]('SquareReport,\x20%s,\x20%s',_0x46b472,_0x284055[_0xf7e4('0xf')][_0xf7e4('0x11')]);return _0xc306fc(_0x284055[_0xf7e4('0xf')]['message']);}logger[_0xf7e4('0xf')](_0xf7e4('0xb'),_0x46b472,_0x284055['error']['message']);return _0x57d427(_0x284055['error']['message']);}else{logger['info'](_0xf7e4('0xb'),_0x46b472,_0xf7e4('0xc'));_0x57d427(_0x284055[_0xf7e4('0x12')]['message']);}})[_0xf7e4('0x13')](function(_0x2f6b1d){logger[_0xf7e4('0xf')](_0xf7e4('0xb'),_0x46b472,_0x2f6b1d);_0xc306fc(_0x2f6b1d);});});}exports[_0xf7e4('0x14')]=function(_0x58eec2){var _0x202ed9=this;return new Promise(function(_0x44c676,_0x4598b5){return db['SquareReport'][_0xf7e4('0x15')](_0x58eec2[_0xf7e4('0x16')],{'raw':_0x58eec2[_0xf7e4('0x17')]?_0x58eec2[_0xf7e4('0x17')][_0xf7e4('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x36e34a){logger['info']('CreateSquareReport',_0x58eec2);logger['debug'](_0xf7e4('0x14'),_0x58eec2,JSON[_0xf7e4('0xe')](_0x36e34a));_0x44c676(_0x36e34a);})[_0xf7e4('0x13')](function(_0x4b2a91){logger['error'](_0xf7e4('0x14'),_0x4b2a91['message'],_0x58eec2);_0x4598b5(_0x202ed9['error'](0x1f4,_0x4b2a91[_0xf7e4('0x11')]));});});};exports[_0xf7e4('0x19')]=function(_0x226e09){var _0x4c43fb=this;return new Promise(function(_0x25dea1,_0x2da1f1){return db[_0xf7e4('0x1a')][_0xf7e4('0x1b')](_0x226e09[_0xf7e4('0x16')],{'raw':_0x226e09[_0xf7e4('0x17')]?_0x226e09[_0xf7e4('0x17')][_0xf7e4('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x226e09['options']?_0x226e09[_0xf7e4('0x17')][_0xf7e4('0x1c')]||null:null,'attributes':_0x226e09[_0xf7e4('0x17')]?_0x226e09[_0xf7e4('0x17')]['attributes']||null:null,'limit':_0x226e09[_0xf7e4('0x17')]?_0x226e09[_0xf7e4('0x17')][_0xf7e4('0x1d')]||null:null})[_0xf7e4('0x1e')](function(_0x1226ff){logger[_0xf7e4('0xa')](_0xf7e4('0x19'),_0x226e09);logger[_0xf7e4('0xd')](_0xf7e4('0x19'),_0x226e09,JSON[_0xf7e4('0xe')](_0x1226ff));_0x25dea1(_0x1226ff);})[_0xf7e4('0x13')](function(_0x3f479c){logger[_0xf7e4('0xf')](_0xf7e4('0x19'),_0x3f479c['message'],_0x226e09);_0x2da1f1(_0x4c43fb['error'](0x1f4,_0x3f479c[_0xf7e4('0x11')]));});});}; \ No newline at end of file +var _0x657b=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','CreateSquareReport','SquareReport','create','body','options','raw','catch','UpdateSquareReport','update','attributes','limit','stringify','lodash','util','moment'];(function(_0x59bd02,_0x5cf860){var _0x40fefc=function(_0x51b864){while(--_0x51b864){_0x59bd02['push'](_0x59bd02['shift']());}};_0x40fefc(++_0x5cf860);}(_0x657b,0xfd));var _0xb657=function(_0x45cd42,_0x3f8140){_0x45cd42=_0x45cd42-0x0;var _0x750010=_0x657b[_0x45cd42];return _0x750010;};'use strict';var _=require(_0xb657('0x0'));var util=require(_0xb657('0x1'));var moment=require(_0xb657('0x2'));var BPromise=require('bluebird');var rs=require(_0xb657('0x3'));var fs=require('fs');var Redis=require(_0xb657('0x4'));var db=require(_0xb657('0x5'))['db'];var utils=require(_0xb657('0x6'));var logger=require(_0xb657('0x7'))('rpc');var config=require(_0xb657('0x8'));var jayson=require(_0xb657('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2adafc,_0xa82260,_0x1f0d42){return new BPromise(function(_0x5de110,_0x2c1fb1){return client['request'](_0x2adafc,_0x1f0d42)[_0xb657('0xa')](function(_0x361629){logger['info'](_0xb657('0xb'),_0xa82260,_0xb657('0xc'));logger[_0xb657('0xd')](_0xb657('0xe'),_0xa82260,'request\x20sent',JSON['stringify'](_0x361629));if(_0x361629['error']){if(_0x361629[_0xb657('0xf')][_0xb657('0x10')]===0x1f4){logger[_0xb657('0xf')](_0xb657('0xb'),_0xa82260,_0x361629[_0xb657('0xf')][_0xb657('0x11')]);return _0x2c1fb1(_0x361629[_0xb657('0xf')][_0xb657('0x11')]);}logger[_0xb657('0xf')](_0xb657('0xb'),_0xa82260,_0x361629[_0xb657('0xf')][_0xb657('0x11')]);return _0x5de110(_0x361629[_0xb657('0xf')][_0xb657('0x11')]);}else{logger[_0xb657('0x12')]('SquareReport,\x20%s,\x20%s',_0xa82260,_0xb657('0xc'));_0x5de110(_0x361629[_0xb657('0x13')][_0xb657('0x11')]);}})['catch'](function(_0x2edc5d){logger[_0xb657('0xf')](_0xb657('0xb'),_0xa82260,_0x2edc5d);_0x2c1fb1(_0x2edc5d);});});}exports[_0xb657('0x14')]=function(_0x4612f9){var _0x4f7730=this;return new Promise(function(_0x8ede6f,_0x32e480){return db[_0xb657('0x15')][_0xb657('0x16')](_0x4612f9[_0xb657('0x17')],{'raw':_0x4612f9[_0xb657('0x18')]?_0x4612f9[_0xb657('0x18')][_0xb657('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0xd95153){logger[_0xb657('0x12')](_0xb657('0x14'),_0x4612f9);logger['debug'](_0xb657('0x14'),_0x4612f9,JSON['stringify'](_0xd95153));_0x8ede6f(_0xd95153);})[_0xb657('0x1a')](function(_0x4c58f2){logger[_0xb657('0xf')](_0xb657('0x14'),_0x4c58f2[_0xb657('0x11')],_0x4612f9);_0x32e480(_0x4f7730[_0xb657('0xf')](0x1f4,_0x4c58f2['message']));});});};exports[_0xb657('0x1b')]=function(_0x2dbc47){var _0x122907=this;return new Promise(function(_0x4b9bc7,_0x1ce186){return db[_0xb657('0x15')][_0xb657('0x1c')](_0x2dbc47[_0xb657('0x17')],{'raw':_0x2dbc47[_0xb657('0x18')]?_0x2dbc47[_0xb657('0x18')][_0xb657('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2dbc47[_0xb657('0x18')]?_0x2dbc47[_0xb657('0x18')]['where']||null:null,'attributes':_0x2dbc47[_0xb657('0x18')]?_0x2dbc47[_0xb657('0x18')][_0xb657('0x1d')]||null:null,'limit':_0x2dbc47[_0xb657('0x18')]?_0x2dbc47[_0xb657('0x18')][_0xb657('0x1e')]||null:null})['then'](function(_0x2497a2){logger[_0xb657('0x12')]('UpdateSquareReport',_0x2dbc47);logger[_0xb657('0xd')]('UpdateSquareReport',_0x2dbc47,JSON[_0xb657('0x1f')](_0x2497a2));_0x4b9bc7(_0x2497a2);})[_0xb657('0x1a')](function(_0x431346){logger[_0xb657('0xf')](_0xb657('0x1b'),_0x431346[_0xb657('0x11')],_0x2dbc47);_0x1ce186(_0x122907[_0xb657('0xf')](0x1f4,_0x431346[_0xb657('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index aa9b1f8..3b9482a 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 _0x171c=['index','/describe','describe','/:id','show','put','delete','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller','get','isAuthenticated'];(function(_0x4f1071,_0x344c47){var _0x1fb4dd=function(_0xe2ab1c){while(--_0xe2ab1c){_0x4f1071['push'](_0x4f1071['shift']());}};_0x1fb4dd(++_0x344c47);}(_0x171c,0x17d));var _0xc171=function(_0x3b7c4d,_0x43c187){_0x3b7c4d=_0x3b7c4d-0x0;var _0x3995b2=_0x171c[_0x3b7c4d];return _0x3995b2;};'use strict';var multer=require(_0xc171('0x0'));var util=require('util');var path=require(_0xc171('0x1'));var timeout=require('connect-timeout');var express=require(_0xc171('0x2'));var router=express[_0xc171('0x3')]();var fs_extra=require(_0xc171('0x4'));var auth=require(_0xc171('0x5'));var interaction=require(_0xc171('0x6'));var config=require('../../config/environment');var controller=require(_0xc171('0x7'));router[_0xc171('0x8')]('/',auth[_0xc171('0x9')](),controller[_0xc171('0xa')]);router['get'](_0xc171('0xb'),auth[_0xc171('0x9')](),controller[_0xc171('0xc')]);router[_0xc171('0x8')](_0xc171('0xd'),auth[_0xc171('0x9')](),controller[_0xc171('0xe')]);router['post']('/',auth[_0xc171('0x9')](),controller['create']);router[_0xc171('0xf')](_0xc171('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xc171('0x10')](_0xc171('0xd'),auth[_0xc171('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3564=['/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated'];(function(_0x27b9a5,_0x16f995){var _0x5df8fb=function(_0x47c0e7){while(--_0x47c0e7){_0x27b9a5['push'](_0x27b9a5['shift']());}};_0x5df8fb(++_0x16f995);}(_0x3564,0xfa));var _0x4356=function(_0x58c802,_0x361a3d){_0x58c802=_0x58c802-0x0;var _0x3a0e12=_0x3564[_0x58c802];return _0x3a0e12;};'use strict';var multer=require(_0x4356('0x0'));var util=require(_0x4356('0x1'));var path=require(_0x4356('0x2'));var timeout=require(_0x4356('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4356('0x4'));var interaction=require(_0x4356('0x5'));var config=require(_0x4356('0x6'));var controller=require(_0x4356('0x7'));router[_0x4356('0x8')]('/',auth[_0x4356('0x9')](),controller['index']);router[_0x4356('0x8')](_0x4356('0xa'),auth[_0x4356('0x9')](),controller[_0x4356('0xb')]);router[_0x4356('0x8')](_0x4356('0xc'),auth[_0x4356('0x9')](),controller[_0x4356('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4356('0xe')]);router[_0x4356('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x4356('0x10')]);router[_0x4356('0x11')](_0x4356('0xc'),auth[_0x4356('0x9')](),controller[_0x4356('0x12')]);module[_0x4356('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 576c397..9ab8457 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 _0xf04c=['STRING','sequelize','exports'];(function(_0x4245da,_0xa976da){var _0x18925b=function(_0x3ed249){while(--_0x3ed249){_0x4245da['push'](_0x4245da['shift']());}};_0x18925b(++_0xa976da);}(_0xf04c,0xfd));var _0xcf04=function(_0x85a4e0,_0x47df41){_0x85a4e0=_0x85a4e0-0x0;var _0x340968=_0xf04c[_0x85a4e0];return _0x340968;};'use strict';var Sequelize=require(_0xcf04('0x0'));module[_0xcf04('0x1')]={'uniqueid':{'type':Sequelize[_0xcf04('0x2')]},'node':{'type':Sequelize[_0xcf04('0x2')]},'application':{'type':Sequelize[_0xcf04('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0xcf04('0x2')]},'callerid':{'type':Sequelize[_0xcf04('0x2')]}}; \ No newline at end of file +var _0x8891=['TEXT','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8891,0x10d));var _0x1889=function(_0x4301c7,_0x34373b){_0x4301c7=_0x4301c7-0x0;var _0x167782=_0x8891[_0x4301c7];return _0x167782;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x1889('0x0')]},'node':{'type':Sequelize[_0x1889('0x0')]},'application':{'type':Sequelize[_0x1889('0x0')]},'data':{'type':Sequelize[_0x1889('0x1')]},'project_name':{'type':Sequelize[_0x1889('0x0')]},'callerid':{'type':Sequelize[_0x1889('0x0')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index e8a5dec..4081850 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 _0x47f5=['stack','name','send','index','map','SquareDetailsReport','rawAttributes','key','query','filters','intersection','model','attributes','fields','length','order','sort','filter','where','type','includeAll','include','findAll','rows','catch','show','params','keys','merge','find','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','Content-Range','json','reject','save','update','destroy','then'];(function(_0x1e4c55,_0x1415eb){var _0x511ab5=function(_0x2958cb){while(--_0x2958cb){_0x1e4c55['push'](_0x1e4c55['shift']());}};_0x511ab5(++_0x1415eb);}(_0x47f5,0x1be));var _0x547f=function(_0x595bd1,_0xb1e7a){_0x595bd1=_0x595bd1-0x0;var _0xd0344f=_0x47f5[_0x595bd1];return _0xd0344f;};'use strict';var emlformat=require(_0x547f('0x0'));var rimraf=require(_0x547f('0x1'));var zipdir=require(_0x547f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x547f('0x3'));var moment=require(_0x547f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x547f('0x5'));var util=require(_0x547f('0x6'));var path=require(_0x547f('0x7'));var sox=require(_0x547f('0x8'));var csv=require(_0x547f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x547f('0xa'));var squel=require('squel');var crypto=require(_0x547f('0xb'));var jsforce=require(_0x547f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x547f('0x9'));var querystring=require(_0x547f('0xd'));var Papa=require(_0x547f('0xe'));var Redis=require(_0x547f('0xf'));var authService=require(_0x547f('0x10'));var qs=require(_0x547f('0x11'));var as=require(_0x547f('0x12'));var hardwareService=require(_0x547f('0x13'));var logger=require(_0x547f('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x547f('0x15'));var licenseUtil=require(_0x547f('0x16'));var db=require(_0x547f('0x17'))['db'];function respondWithStatusCode(_0x2770a8,_0x4e2c20){_0x4e2c20=_0x4e2c20||0xcc;return function(_0x467b71){if(_0x467b71){return _0x2770a8[_0x547f('0x18')](_0x4e2c20);}return _0x2770a8[_0x547f('0x19')](_0x4e2c20)[_0x547f('0x1a')]();};}function respondWithResult(_0x2f4bc6,_0x312059){_0x312059=_0x312059||0xc8;return function(_0x58358a){if(_0x58358a){return _0x2f4bc6[_0x547f('0x19')](_0x312059)['json'](_0x58358a);}};}function respondWithFilteredResult(_0xc40384,_0x371152){return function(_0x480552){if(_0x480552){var _0x52a2ab=typeof _0x371152[_0x547f('0x1b')]==='undefined'&&typeof _0x371152[_0x547f('0x1c')]==='undefined';var _0xe31ad6=_0x480552[_0x547f('0x1d')];var _0x36435c=_0x52a2ab?0x0:_0x371152[_0x547f('0x1b')];var _0x1a1155=_0x52a2ab?_0x480552[_0x547f('0x1d')]:_0x371152[_0x547f('0x1b')]+_0x371152[_0x547f('0x1c')];var _0x4be6a3;if(_0x1a1155>=_0xe31ad6){_0x1a1155=_0xe31ad6;_0x4be6a3=0xc8;}else{_0x4be6a3=0xce;}_0xc40384[_0x547f('0x19')](_0x4be6a3);return _0xc40384['set'](_0x547f('0x1e'),_0x36435c+'-'+_0x1a1155+'/'+_0xe31ad6)[_0x547f('0x1f')](_0x480552);}return null;};}function patchUpdates(_0x201ae6){return function(_0x1bcedd){try{jsonpatch['apply'](_0x1bcedd,_0x201ae6,!![]);}catch(_0x3f8c73){return BPromise[_0x547f('0x20')](_0x3f8c73);}return _0x1bcedd[_0x547f('0x21')]();};}function saveUpdates(_0x511e81,_0x6a6487){return function(_0x1c4485){if(_0x1c4485){return _0x1c4485[_0x547f('0x22')](_0x511e81)['then'](function(_0x2b1d49){return _0x2b1d49;});}return null;};}function removeEntity(_0x8d29be,_0x60acf6){return function(_0x36e705){if(_0x36e705){return _0x36e705[_0x547f('0x23')]()[_0x547f('0x24')](function(){_0x8d29be['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x48b2df,_0xdfd1e3){return function(_0x57b3ac){if(!_0x57b3ac){_0x48b2df[_0x547f('0x18')](0x194);}return _0x57b3ac;};}function handleError(_0x2c554b,_0x45c181){_0x45c181=_0x45c181||0x1f4;return function(_0x4672af){logger['error'](_0x4672af[_0x547f('0x25')]);if(_0x4672af[_0x547f('0x26')]){delete _0x4672af[_0x547f('0x26')];}_0x2c554b[_0x547f('0x19')](_0x45c181)[_0x547f('0x27')](_0x4672af);};}exports[_0x547f('0x28')]=function(_0x59ac8b,_0x50bcfd){var _0x442eec={},_0x12421f={},_0x1cbe41={'count':0x0,'rows':[]};var _0xa3c113=_[_0x547f('0x29')](db[_0x547f('0x2a')][_0x547f('0x2b')],function(_0x3a4d53){return{'name':_0x3a4d53['fieldName'],'type':_0x3a4d53['type'][_0x547f('0x2c')]};});_0x12421f['model']=_[_0x547f('0x29')](_0xa3c113,_0x547f('0x26'));_0x12421f[_0x547f('0x2d')]=_['keys'](_0x59ac8b['query']);_0x12421f[_0x547f('0x2e')]=_[_0x547f('0x2f')](_0x12421f[_0x547f('0x30')],_0x12421f[_0x547f('0x2d')]);_0x442eec[_0x547f('0x31')]=_[_0x547f('0x2f')](_0x12421f[_0x547f('0x30')],qs[_0x547f('0x32')](_0x59ac8b['query'][_0x547f('0x32')]));_0x442eec['attributes']=_0x442eec[_0x547f('0x31')][_0x547f('0x33')]?_0x442eec['attributes']:_0x12421f[_0x547f('0x30')];if(!_0x59ac8b[_0x547f('0x2d')]['hasOwnProperty']('nolimit')){_0x442eec[_0x547f('0x1c')]=qs[_0x547f('0x1c')](_0x59ac8b['query'][_0x547f('0x1c')]);_0x442eec['offset']=qs[_0x547f('0x1b')](_0x59ac8b['query'][_0x547f('0x1b')]);}_0x442eec[_0x547f('0x34')]=qs['sort'](_0x59ac8b['query'][_0x547f('0x35')]);_0x442eec['where']=qs['filters'](_['pick'](_0x59ac8b[_0x547f('0x2d')],_0x12421f[_0x547f('0x2e')]),_0xa3c113);if(_0x59ac8b[_0x547f('0x2d')][_0x547f('0x36')]){_0x442eec[_0x547f('0x37')]=_['merge'](_0x442eec[_0x547f('0x37')],{'$or':_[_0x547f('0x29')](_0xa3c113,function(_0x28bbd0){if(_0x28bbd0[_0x547f('0x38')]!=='VIRTUAL'){var _0x306e2a={};_0x306e2a[_0x28bbd0[_0x547f('0x26')]]={'$like':'%'+_0x59ac8b['query'][_0x547f('0x36')]+'%'};return _0x306e2a;}})});}_0x442eec=_['merge']({},_0x442eec,_0x59ac8b['options']);var _0x46e66d={'where':_0x442eec[_0x547f('0x37')]};return db[_0x547f('0x2a')]['count'](_0x46e66d)[_0x547f('0x24')](function(_0x11d8f4){_0x1cbe41[_0x547f('0x1d')]=_0x11d8f4;if(_0x59ac8b[_0x547f('0x2d')][_0x547f('0x39')]){_0x442eec[_0x547f('0x3a')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0x547f('0x3b')](_0x442eec);})[_0x547f('0x24')](function(_0x86f51d){_0x1cbe41[_0x547f('0x3c')]=_0x86f51d;return _0x1cbe41;})['then'](respondWithFilteredResult(_0x50bcfd,_0x442eec))[_0x547f('0x3d')](handleError(_0x50bcfd,null));};exports[_0x547f('0x3e')]=function(_0x8d6b4,_0x56fb1c){var _0x5cc933={'raw':!![],'where':{'id':_0x8d6b4[_0x547f('0x3f')]['id']}},_0xe8d24c={};_0xe8d24c[_0x547f('0x30')]=_[_0x547f('0x40')](db['SquareDetailsReport'][_0x547f('0x2b')]);_0xe8d24c['query']=_[_0x547f('0x40')](_0x8d6b4[_0x547f('0x2d')]);_0xe8d24c[_0x547f('0x2e')]=_[_0x547f('0x2f')](_0xe8d24c[_0x547f('0x30')],_0xe8d24c[_0x547f('0x2d')]);_0x5cc933[_0x547f('0x31')]=_[_0x547f('0x2f')](_0xe8d24c[_0x547f('0x30')],qs[_0x547f('0x32')](_0x8d6b4[_0x547f('0x2d')][_0x547f('0x32')]));_0x5cc933[_0x547f('0x31')]=_0x5cc933[_0x547f('0x31')][_0x547f('0x33')]?_0x5cc933[_0x547f('0x31')]:_0xe8d24c[_0x547f('0x30')];if(_0x8d6b4[_0x547f('0x2d')][_0x547f('0x39')]){_0x5cc933['include']=[{'all':!![]}];}_0x5cc933=_[_0x547f('0x41')]({},_0x5cc933,_0x8d6b4['options']);return db[_0x547f('0x2a')][_0x547f('0x42')](_0x5cc933)[_0x547f('0x24')](handleEntityNotFound(_0x56fb1c,null))['then'](respondWithResult(_0x56fb1c,null))['catch'](handleError(_0x56fb1c,null));};exports['create']=function(_0x5eee2f,_0x55a596){return db[_0x547f('0x2a')]['create'](_0x5eee2f['body'],{})[_0x547f('0x24')](respondWithResult(_0x55a596,0xc9))[_0x547f('0x3d')](handleError(_0x55a596,null));};exports[_0x547f('0x22')]=function(_0x1fcf42,_0x3102d6){if(_0x1fcf42[_0x547f('0x43')]['id']){delete _0x1fcf42[_0x547f('0x43')]['id'];}return db['SquareDetailsReport'][_0x547f('0x42')]({'where':{'id':_0x1fcf42['params']['id']}})[_0x547f('0x24')](handleEntityNotFound(_0x3102d6,null))['then'](saveUpdates(_0x1fcf42[_0x547f('0x43')],null))[_0x547f('0x24')](respondWithResult(_0x3102d6,null))['catch'](handleError(_0x3102d6,null));};exports[_0x547f('0x23')]=function(_0x13a1d9,_0x126763){return db[_0x547f('0x2a')][_0x547f('0x42')]({'where':{'id':_0x13a1d9[_0x547f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x126763,null))[_0x547f('0x24')](removeEntity(_0x126763,null))['catch'](handleError(_0x126763,null));};exports[_0x547f('0x44')]=function(_0x5d22de,_0x150027){return db[_0x547f('0x2a')][_0x547f('0x44')]()[_0x547f('0x24')](respondWithResult(_0x150027,null))[_0x547f('0x3d')](handleError(_0x150027,null));}; \ No newline at end of file +var _0xfd1e=['zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','key','model','query','keys','attributes','fields','length','nolimit','limit','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','include','findAll','catch','show','params','intersection','includeAll','find','create','body','describe','eml-format','rimraf'];(function(_0x30e7f6,_0x19f9b6){var _0x472de0=function(_0x3b32f8){while(--_0x3b32f8){_0x30e7f6['push'](_0x30e7f6['shift']());}};_0x472de0(++_0x19f9b6);}(_0xfd1e,0x92));var _0xefd1=function(_0x3c9c3b,_0x1e016c){_0x3c9c3b=_0x3c9c3b-0x0;var _0x4236a9=_0xfd1e[_0x3c9c3b];return _0x4236a9;};'use strict';var emlformat=require(_0xefd1('0x0'));var rimraf=require(_0xefd1('0x1'));var zipdir=require(_0xefd1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xefd1('0x3'));var BPromise=require(_0xefd1('0x4'));var Mustache=require(_0xefd1('0x5'));var util=require(_0xefd1('0x6'));var path=require(_0xefd1('0x7'));var sox=require(_0xefd1('0x8'));var csv=require(_0xefd1('0x9'));var ejs=require(_0xefd1('0xa'));var fs=require('fs');var fs_extra=require(_0xefd1('0xb'));var _=require(_0xefd1('0xc'));var squel=require(_0xefd1('0xd'));var crypto=require(_0xefd1('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xefd1('0xf'));var toCsv=require(_0xefd1('0x9'));var querystring=require('querystring');var Papa=require(_0xefd1('0x10'));var Redis=require(_0xefd1('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xefd1('0x12'));var logger=require('../../config/logger')(_0xefd1('0x13'));var utils=require(_0xefd1('0x14'));var config=require(_0xefd1('0x15'));var licenseUtil=require(_0xefd1('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4bb9c5,_0x3f49ab){_0x3f49ab=_0x3f49ab||0xcc;return function(_0x3ca97b){if(_0x3ca97b){return _0x4bb9c5['sendStatus'](_0x3f49ab);}return _0x4bb9c5[_0xefd1('0x17')](_0x3f49ab)[_0xefd1('0x18')]();};}function respondWithResult(_0x214202,_0x4b546f){_0x4b546f=_0x4b546f||0xc8;return function(_0x3ac173){if(_0x3ac173){return _0x214202[_0xefd1('0x17')](_0x4b546f)['json'](_0x3ac173);}};}function respondWithFilteredResult(_0x1607fc,_0x26d19d){return function(_0xca96f5){if(_0xca96f5){var _0x139b1b=typeof _0x26d19d[_0xefd1('0x19')]===_0xefd1('0x1a')&&typeof _0x26d19d['limit']==='undefined';var _0x40ebee=_0xca96f5['count'];var _0x11b087=_0x139b1b?0x0:_0x26d19d[_0xefd1('0x19')];var _0x1530e3=_0x139b1b?_0xca96f5[_0xefd1('0x1b')]:_0x26d19d['offset']+_0x26d19d['limit'];var _0x328985;if(_0x1530e3>=_0x40ebee){_0x1530e3=_0x40ebee;_0x328985=0xc8;}else{_0x328985=0xce;}_0x1607fc[_0xefd1('0x17')](_0x328985);return _0x1607fc[_0xefd1('0x1c')](_0xefd1('0x1d'),_0x11b087+'-'+_0x1530e3+'/'+_0x40ebee)['json'](_0xca96f5);}return null;};}function patchUpdates(_0x5b95d3){return function(_0x3086cc){try{jsonpatch[_0xefd1('0x1e')](_0x3086cc,_0x5b95d3,!![]);}catch(_0x2abe01){return BPromise[_0xefd1('0x1f')](_0x2abe01);}return _0x3086cc[_0xefd1('0x20')]();};}function saveUpdates(_0x2426db,_0xc624d8){return function(_0x4911cd){if(_0x4911cd){return _0x4911cd[_0xefd1('0x21')](_0x2426db)[_0xefd1('0x22')](function(_0x5642b3){return _0x5642b3;});}return null;};}function removeEntity(_0x421a2d,_0x588ca){return function(_0x231107){if(_0x231107){return _0x231107[_0xefd1('0x23')]()[_0xefd1('0x22')](function(){_0x421a2d[_0xefd1('0x17')](0xcc)[_0xefd1('0x18')]();});}};}function handleEntityNotFound(_0x590e38,_0x4565c1){return function(_0x275cfb){if(!_0x275cfb){_0x590e38[_0xefd1('0x24')](0x194);}return _0x275cfb;};}function handleError(_0x3b3908,_0x2f12ce){_0x2f12ce=_0x2f12ce||0x1f4;return function(_0x1609c2){logger['error'](_0x1609c2[_0xefd1('0x25')]);if(_0x1609c2[_0xefd1('0x26')]){delete _0x1609c2[_0xefd1('0x26')];}_0x3b3908[_0xefd1('0x17')](_0x2f12ce)[_0xefd1('0x27')](_0x1609c2);};}exports[_0xefd1('0x28')]=function(_0x5b43bc,_0x1e6201){var _0x364492={},_0x2c2e32={},_0xa8ee30={'count':0x0,'rows':[]};var _0x6ef74a=_[_0xefd1('0x29')](db[_0xefd1('0x2a')][_0xefd1('0x2b')],function(_0x14485f){return{'name':_0x14485f[_0xefd1('0x2c')],'type':_0x14485f['type'][_0xefd1('0x2d')]};});_0x2c2e32[_0xefd1('0x2e')]=_[_0xefd1('0x29')](_0x6ef74a,'name');_0x2c2e32[_0xefd1('0x2f')]=_[_0xefd1('0x30')](_0x5b43bc[_0xefd1('0x2f')]);_0x2c2e32['filters']=_['intersection'](_0x2c2e32[_0xefd1('0x2e')],_0x2c2e32[_0xefd1('0x2f')]);_0x364492[_0xefd1('0x31')]=_['intersection'](_0x2c2e32[_0xefd1('0x2e')],qs[_0xefd1('0x32')](_0x5b43bc[_0xefd1('0x2f')][_0xefd1('0x32')]));_0x364492[_0xefd1('0x31')]=_0x364492[_0xefd1('0x31')][_0xefd1('0x33')]?_0x364492[_0xefd1('0x31')]:_0x2c2e32[_0xefd1('0x2e')];if(!_0x5b43bc[_0xefd1('0x2f')]['hasOwnProperty'](_0xefd1('0x34'))){_0x364492['limit']=qs['limit'](_0x5b43bc[_0xefd1('0x2f')][_0xefd1('0x35')]);_0x364492[_0xefd1('0x19')]=qs[_0xefd1('0x19')](_0x5b43bc[_0xefd1('0x2f')]['offset']);}_0x364492['order']=qs[_0xefd1('0x36')](_0x5b43bc[_0xefd1('0x2f')][_0xefd1('0x36')]);_0x364492[_0xefd1('0x37')]=qs[_0xefd1('0x38')](_[_0xefd1('0x39')](_0x5b43bc['query'],_0x2c2e32[_0xefd1('0x38')]),_0x6ef74a);if(_0x5b43bc[_0xefd1('0x2f')][_0xefd1('0x3a')]){_0x364492['where']=_['merge'](_0x364492[_0xefd1('0x37')],{'$or':_[_0xefd1('0x29')](_0x6ef74a,function(_0x2d0043){if(_0x2d0043[_0xefd1('0x3b')]!==_0xefd1('0x3c')){var _0x389d4e={};_0x389d4e[_0x2d0043[_0xefd1('0x26')]]={'$like':'%'+_0x5b43bc[_0xefd1('0x2f')][_0xefd1('0x3a')]+'%'};return _0x389d4e;}})});}_0x364492=_[_0xefd1('0x3d')]({},_0x364492,_0x5b43bc[_0xefd1('0x3e')]);var _0x2f9277={'where':_0x364492[_0xefd1('0x37')]};return db[_0xefd1('0x2a')][_0xefd1('0x1b')](_0x2f9277)[_0xefd1('0x22')](function(_0x25074b){_0xa8ee30[_0xefd1('0x1b')]=_0x25074b;if(_0x5b43bc[_0xefd1('0x2f')]['includeAll']){_0x364492[_0xefd1('0x3f')]=[{'all':!![]}];}return db[_0xefd1('0x2a')][_0xefd1('0x40')](_0x364492);})[_0xefd1('0x22')](function(_0x287777){_0xa8ee30['rows']=_0x287777;return _0xa8ee30;})[_0xefd1('0x22')](respondWithFilteredResult(_0x1e6201,_0x364492))[_0xefd1('0x41')](handleError(_0x1e6201,null));};exports[_0xefd1('0x42')]=function(_0x2adc42,_0x42d88e){var _0x38c37e={'raw':!![],'where':{'id':_0x2adc42[_0xefd1('0x43')]['id']}},_0x46aa59={};_0x46aa59[_0xefd1('0x2e')]=_[_0xefd1('0x30')](db[_0xefd1('0x2a')][_0xefd1('0x2b')]);_0x46aa59[_0xefd1('0x2f')]=_[_0xefd1('0x30')](_0x2adc42[_0xefd1('0x2f')]);_0x46aa59[_0xefd1('0x38')]=_['intersection'](_0x46aa59[_0xefd1('0x2e')],_0x46aa59[_0xefd1('0x2f')]);_0x38c37e[_0xefd1('0x31')]=_[_0xefd1('0x44')](_0x46aa59[_0xefd1('0x2e')],qs[_0xefd1('0x32')](_0x2adc42['query']['fields']));_0x38c37e[_0xefd1('0x31')]=_0x38c37e['attributes']['length']?_0x38c37e[_0xefd1('0x31')]:_0x46aa59['model'];if(_0x2adc42[_0xefd1('0x2f')][_0xefd1('0x45')]){_0x38c37e['include']=[{'all':!![]}];}_0x38c37e=_[_0xefd1('0x3d')]({},_0x38c37e,_0x2adc42[_0xefd1('0x3e')]);return db[_0xefd1('0x2a')][_0xefd1('0x46')](_0x38c37e)[_0xefd1('0x22')](handleEntityNotFound(_0x42d88e,null))[_0xefd1('0x22')](respondWithResult(_0x42d88e,null))[_0xefd1('0x41')](handleError(_0x42d88e,null));};exports[_0xefd1('0x47')]=function(_0x2f68d3,_0x4bedcb){return db[_0xefd1('0x2a')][_0xefd1('0x47')](_0x2f68d3[_0xefd1('0x48')],{})[_0xefd1('0x22')](respondWithResult(_0x4bedcb,0xc9))[_0xefd1('0x41')](handleError(_0x4bedcb,null));};exports[_0xefd1('0x21')]=function(_0x3108fb,_0x1d038b){if(_0x3108fb[_0xefd1('0x48')]['id']){delete _0x3108fb['body']['id'];}return db[_0xefd1('0x2a')][_0xefd1('0x46')]({'where':{'id':_0x3108fb[_0xefd1('0x43')]['id']}})[_0xefd1('0x22')](handleEntityNotFound(_0x1d038b,null))['then'](saveUpdates(_0x3108fb[_0xefd1('0x48')],null))[_0xefd1('0x22')](respondWithResult(_0x1d038b,null))['catch'](handleError(_0x1d038b,null));};exports[_0xefd1('0x23')]=function(_0x186db5,_0x178935){return db[_0xefd1('0x2a')][_0xefd1('0x46')]({'where':{'id':_0x186db5['params']['id']}})[_0xefd1('0x22')](handleEntityNotFound(_0x178935,null))[_0xefd1('0x22')](removeEntity(_0x178935,null))['catch'](handleError(_0x178935,null));};exports['describe']=function(_0x44eb86,_0x1ca725){return db[_0xefd1('0x2a')][_0xefd1('0x49')]()[_0xefd1('0x22')](respondWithResult(_0x1ca725,null))[_0xefd1('0x41')](handleError(_0x1ca725,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index eb04046..f452599 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 _0x906c=['bluebird','request-promise','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','report_square_details','lodash','api','moment'];(function(_0x433694,_0x4a1257){var _0x38569f=function(_0x42d8f6){while(--_0x42d8f6){_0x433694['push'](_0x433694['shift']());}};_0x38569f(++_0x4a1257);}(_0x906c,0xfa));var _0xc906=function(_0x1a706a,_0x49ce65){_0x1a706a=_0x1a706a-0x0;var _0x139364=_0x906c[_0x1a706a];return _0x139364;};'use strict';var _=require(_0xc906('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc906('0x1'));var moment=require(_0xc906('0x2'));var BPromise=require(_0xc906('0x3'));var rp=require(_0xc906('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc906('0x5'));var config=require(_0xc906('0x6'));var attributes=require(_0xc906('0x7'));module[_0xc906('0x8')]=function(_0x2ded2f,_0x133ab3){return _0x2ded2f[_0xc906('0x9')]('SquareDetailsReport',attributes,{'tableName':_0xc906('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x56c0=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./squareReportDetail.attributes','define','SquareDetailsReport','report_square_details','lodash'];(function(_0x11a694,_0xce229c){var _0x1041e5=function(_0x3bf368){while(--_0x3bf368){_0x11a694['push'](_0x11a694['shift']());}};_0x1041e5(++_0xce229c);}(_0x56c0,0x12b));var _0x056c=function(_0x5b47fa,_0x42b2c6){_0x5b47fa=_0x5b47fa-0x0;var _0x34aeae=_0x56c0[_0x5b47fa];return _0x34aeae;};'use strict';var _=require(_0x056c('0x0'));var util=require('util');var logger=require(_0x056c('0x1'))(_0x056c('0x2'));var moment=require(_0x056c('0x3'));var BPromise=require(_0x056c('0x4'));var rp=require(_0x056c('0x5'));var fs=require('fs');var path=require(_0x056c('0x6'));var rimraf=require('rimraf');var config=require(_0x056c('0x7'));var attributes=require(_0x056c('0x8'));module['exports']=function(_0x2cb0ee,_0x208649){return _0x2cb0ee[_0x056c('0x9')](_0x056c('0xa'),attributes,{'tableName':_0x056c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 3077e8b..b78706c 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 _0xbbbc=['options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','request\x20sent','error','message','result','catch','CreateSquareDetailsReport','create','body'];(function(_0x1fa890,_0x4fbfa9){var _0x119874=function(_0x1903e4){while(--_0x1903e4){_0x1fa890['push'](_0x1fa890['shift']());}};_0x119874(++_0x4fbfa9);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x36a560,_0x57378b){_0x36a560=_0x36a560-0x0;var _0x10923a=_0xbbbc[_0x36a560];return _0x10923a;};'use strict';var _=require(_0xcbbb('0x0'));var util=require(_0xcbbb('0x1'));var moment=require(_0xcbbb('0x2'));var BPromise=require(_0xcbbb('0x3'));var rs=require(_0xcbbb('0x4'));var fs=require('fs');var Redis=require(_0xcbbb('0x5'));var db=require(_0xcbbb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcbbb('0x7'))(_0xcbbb('0x8'));var config=require(_0xcbbb('0x9'));var jayson=require(_0xcbbb('0xa'));var client=jayson[_0xcbbb('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x388197,_0x1796b4,_0x32ec9c){return new BPromise(function(_0x6f4fd8,_0x356249){return client[_0xcbbb('0xc')](_0x388197,_0x32ec9c)[_0xcbbb('0xd')](function(_0x4ec90a){logger[_0xcbbb('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x1796b4,'request\x20sent');logger[_0xcbbb('0xf')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x1796b4,_0xcbbb('0x10'),JSON['stringify'](_0x4ec90a));if(_0x4ec90a[_0xcbbb('0x11')]){if(_0x4ec90a[_0xcbbb('0x11')]['code']===0x1f4){logger[_0xcbbb('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x1796b4,_0x4ec90a[_0xcbbb('0x11')]['message']);return _0x356249(_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);}logger[_0xcbbb('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x1796b4,_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);return _0x6f4fd8(_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);}else{logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x1796b4,_0xcbbb('0x10'));_0x6f4fd8(_0x4ec90a[_0xcbbb('0x13')][_0xcbbb('0x12')]);}})[_0xcbbb('0x14')](function(_0x5e25ca){logger[_0xcbbb('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x1796b4,_0x5e25ca);_0x356249(_0x5e25ca);});});}exports[_0xcbbb('0x15')]=function(_0x3436af){var _0x3572bb=this;return new Promise(function(_0x5052df,_0x57c5e9){return db['SquareDetailsReport'][_0xcbbb('0x16')](_0x3436af[_0xcbbb('0x17')],{'raw':_0x3436af[_0xcbbb('0x18')]?_0x3436af[_0xcbbb('0x18')][_0xcbbb('0x19')]===undefined?!![]:![]:!![]})[_0xcbbb('0xd')](function(_0x45de5f){logger[_0xcbbb('0xe')](_0xcbbb('0x15'),_0x3436af);logger[_0xcbbb('0xf')]('CreateSquareDetailsReport',_0x3436af,JSON[_0xcbbb('0x1a')](_0x45de5f));_0x5052df(_0x45de5f);})[_0xcbbb('0x14')](function(_0x159c62){logger[_0xcbbb('0x11')](_0xcbbb('0x15'),_0x159c62[_0xcbbb('0x12')],_0x3436af);_0x57c5e9(_0x3572bb[_0xcbbb('0x11')](0x1f4,_0x159c62[_0xcbbb('0x12')]));});});}; \ No newline at end of file +var _0x7382=['message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw','stringify','util','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x632aa4,_0x20076f){var _0x82b9d3=function(_0x11cf5c){while(--_0x11cf5c){_0x632aa4['push'](_0x632aa4['shift']());}};_0x82b9d3(++_0x20076f);}(_0x7382,0x111));var _0x2738=function(_0x2ce774,_0x49c84a){_0x2ce774=_0x2ce774-0x0;var _0xd84a5a=_0x7382[_0x2ce774];return _0xd84a5a;};'use strict';var _=require('lodash');var util=require(_0x2738('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2738('0x1'));var logger=require(_0x2738('0x2'))(_0x2738('0x3'));var config=require(_0x2738('0x4'));var jayson=require(_0x2738('0x5'));var client=jayson['client'][_0x2738('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2bc38a,_0xd74b07,_0x523aef){return new BPromise(function(_0x4235e7,_0x487d14){return client[_0x2738('0x7')](_0x2bc38a,_0x523aef)['then'](function(_0x476864){logger[_0x2738('0x8')](_0x2738('0x9'),_0xd74b07,'request\x20sent');logger[_0x2738('0xa')](_0x2738('0xb'),_0xd74b07,_0x2738('0xc'),JSON['stringify'](_0x476864));if(_0x476864['error']){if(_0x476864[_0x2738('0xd')][_0x2738('0xe')]===0x1f4){logger[_0x2738('0xd')](_0x2738('0x9'),_0xd74b07,_0x476864[_0x2738('0xd')][_0x2738('0xf')]);return _0x487d14(_0x476864[_0x2738('0xd')][_0x2738('0xf')]);}logger[_0x2738('0xd')](_0x2738('0x9'),_0xd74b07,_0x476864[_0x2738('0xd')]['message']);return _0x4235e7(_0x476864[_0x2738('0xd')][_0x2738('0xf')]);}else{logger['info'](_0x2738('0x9'),_0xd74b07,'request\x20sent');_0x4235e7(_0x476864[_0x2738('0x10')]['message']);}})[_0x2738('0x11')](function(_0x568065){logger[_0x2738('0xd')](_0x2738('0x9'),_0xd74b07,_0x568065);_0x487d14(_0x568065);});});}exports[_0x2738('0x12')]=function(_0x3c6810){var _0x1d0aca=this;return new Promise(function(_0x1e0f57,_0x42685a){return db[_0x2738('0x13')]['create'](_0x3c6810[_0x2738('0x14')],{'raw':_0x3c6810['options']?_0x3c6810[_0x2738('0x15')][_0x2738('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x5a1d61){logger[_0x2738('0x8')](_0x2738('0x12'),_0x3c6810);logger[_0x2738('0xa')](_0x2738('0x12'),_0x3c6810,JSON[_0x2738('0x17')](_0x5a1d61));_0x1e0f57(_0x5a1d61);})[_0x2738('0x11')](function(_0x18e1d8){logger[_0x2738('0xd')](_0x2738('0x12'),_0x18e1d8[_0x2738('0xf')],_0x3c6810);_0x42685a(_0x1d0aca[_0x2738('0xd')](0x1f4,_0x18e1d8['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 1098f43..3f9ce81 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 _0x6be4=['get','isAuthenticated','index','killProcess','exports','express','Router','../../components/auth/service','./system.controller'];(function(_0xda7f4f,_0x13c5c7){var _0x1b9e6e=function(_0x1f6506){while(--_0x1f6506){_0xda7f4f['push'](_0xda7f4f['shift']());}};_0x1b9e6e(++_0x13c5c7);}(_0x6be4,0x137));var _0x46be=function(_0x5aa593,_0x275634){_0x5aa593=_0x5aa593-0x0;var _0x3c2770=_0x6be4[_0x5aa593];return _0x3c2770;};'use strict';var express=require(_0x46be('0x0'));var router=express[_0x46be('0x1')]();var auth=require(_0x46be('0x2'));var controller=require(_0x46be('0x3'));router[_0x46be('0x4')]('/',auth[_0x46be('0x5')](),controller[_0x46be('0x6')]);router[_0x46be('0x4')]('/process/:pid/kill',auth[_0x46be('0x5')](),controller[_0x46be('0x7')]);module[_0x46be('0x8')]=router; \ No newline at end of file +var _0xec14=['isAuthenticated','index','/process/:pid/kill','exports','express','Router','../../components/auth/service','./system.controller'];(function(_0x5459b0,_0x4d2ef8){var _0x675a35=function(_0x538e11){while(--_0x538e11){_0x5459b0['push'](_0x5459b0['shift']());}};_0x675a35(++_0x4d2ef8);}(_0xec14,0x1ac));var _0x4ec1=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xec14[_0x373dee];return _0x46798f;};'use strict';var express=require(_0x4ec1('0x0'));var router=express[_0x4ec1('0x1')]();var auth=require(_0x4ec1('0x2'));var controller=require(_0x4ec1('0x3'));router['get']('/',auth[_0x4ec1('0x4')](),controller[_0x4ec1('0x5')]);router['get'](_0x4ec1('0x6'),auth[_0x4ec1('0x4')](),controller['killProcess']);module[_0x4ec1('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 8705944..8520b9a 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 _0xe32f=['catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','json'];(function(_0xe4797c,_0x1a9bcf){var _0x41e9a7=function(_0x316ce1){while(--_0x316ce1){_0xe4797c['push'](_0xe4797c['shift']());}};_0x41e9a7(++_0x1a9bcf);}(_0xe32f,0x1cd));var _0xfe32=function(_0xce546,_0x141dbb){_0xce546=_0xce546-0x0;var _0x241852=_0xe32f[_0xce546];return _0x241852;};'use strict';var info=require(_0xfe32('0x0'));var exec=require(_0xfe32('0x1'))[_0xfe32('0x2')];var logger=require('../../config/logger')('api');var util=require('util');var BPromise=require(_0xfe32('0x3'));var _=require(_0xfe32('0x4'));function handleError(_0x42f2cb,_0x2f77d2,_0x432e9c){_0x2f77d2=_0x2f77d2||0x1f4;return function(_0xb8138e){logger[_0xfe32('0x5')](_0xfe32('0x6'),_0x432e9c,_0x2f77d2,util[_0xfe32('0x7')](_0xb8138e,{'showHidden':![],'depth':null}));delete _0xb8138e[_0xfe32('0x8')];_0x42f2cb[_0xfe32('0x9')](_0x2f77d2)[_0xfe32('0xa')](_0xb8138e);};}exports[_0xfe32('0xb')]=function(_0x8f71f0,_0x25ae8c){return info[_0xfe32('0xc')]()['then'](function(_0x30f695){return _0x25ae8c[_0xfe32('0x9')](0xc8)[_0xfe32('0xd')](_0x30f695);})[_0xfe32('0xe')](function(_0x3907cd){return _0x25ae8c[_0xfe32('0x9')](0x1f4)[_0xfe32('0xd')](_0x3907cd);});};exports[_0xfe32('0xf')]=function(_0x20c85e,_0x38da72){var _0x332033=[_0xfe32('0x10')];return new BPromise(function(_0x11f068,_0xcb01de){return exec(util[_0xfe32('0x11')](_0xfe32('0x12'),_0x20c85e[_0xfe32('0x13')][_0xfe32('0x14')]),function(_0x1514e8,_0x5d6a87,_0x53837b){if(_0x1514e8){return _0xcb01de(_0x1514e8);}return _0x11f068(_0x5d6a87);});})['then'](function(_0x8f9e9f){var _0x2eb0bc=![];var _0x4a559a=_0x8f9e9f['split'](/\n/);for(var _0x5df004=0x0,_0x2cca1b=_0x332033['length'];_0x5df004<_0x2cca1b,_0x2eb0bc===![];_0x5df004+=0x1){if(_0x8f9e9f[_0xfe32('0x15')](_0x332033[_0x5df004])>=0x0){_0x2eb0bc=!![];}}if(!_0x2eb0bc){throw new Error(util[_0xfe32('0x11')](_0xfe32('0x16'),_0x20c85e[_0xfe32('0x13')][_0xfe32('0x14')]));}process['kill'](_0x20c85e[_0xfe32('0x13')]['pid'],_0xfe32('0x17'));return _0x38da72[_0xfe32('0x9')](0xc8)[_0xfe32('0xd')]({'message':util['format'](_0xfe32('0x18'),_0x20c85e[_0xfe32('0x13')]['pid'])});})[_0xfe32('0xe')](handleError(_0x38da72,null,_0xfe32('0xf')));}; \ No newline at end of file +var _0xd60f=['bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','getAllData','json','catch','status','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','then','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','params','SIGINT','killProcess','child_process','exec','util'];(function(_0x38690a,_0x266237){var _0xac4ede=function(_0x17bd4f){while(--_0x17bd4f){_0x38690a['push'](_0x38690a['shift']());}};_0xac4ede(++_0x266237);}(_0xd60f,0x1a6));var _0xfd60=function(_0x522903,_0x1c42c7){_0x522903=_0x522903-0x0;var _0x4f43d6=_0xd60f[_0x522903];return _0x4f43d6;};'use strict';var info=require('systeminformation');var exec=require(_0xfd60('0x0'))[_0xfd60('0x1')];var logger=require('../../config/logger')('api');var util=require(_0xfd60('0x2'));var BPromise=require(_0xfd60('0x3'));var _=require(_0xfd60('0x4'));function handleError(_0x25dfcd,_0x5e09a4,_0x3a91b9){_0x5e09a4=_0x5e09a4||0x1f4;return function(_0x3897cd){logger[_0xfd60('0x5')](_0xfd60('0x6'),_0x3a91b9,_0x5e09a4,util[_0xfd60('0x7')](_0x3897cd,{'showHidden':![],'depth':null}));delete _0x3897cd[_0xfd60('0x8')];_0x25dfcd['status'](_0x5e09a4)['send'](_0x3897cd);};}exports['index']=function(_0x1933fb,_0x2ea0f1){return info[_0xfd60('0x9')]()['then'](function(_0x424f9d){return _0x2ea0f1['status'](0xc8)[_0xfd60('0xa')](_0x424f9d);})[_0xfd60('0xb')](function(_0x56148c){return _0x2ea0f1[_0xfd60('0xc')](0x1f4)['json'](_0x56148c);});};exports['killProcess']=function(_0x18d132,_0xe9a0d6){var _0x587037=[_0xfd60('0xd')];return new BPromise(function(_0x2879dd,_0xe6dca7){return exec(util[_0xfd60('0xe')](_0xfd60('0xf'),_0x18d132['params'][_0xfd60('0x10')]),function(_0x8011eb,_0x5a5708,_0x19c83d){if(_0x8011eb){return _0xe6dca7(_0x8011eb);}return _0x2879dd(_0x5a5708);});})[_0xfd60('0x11')](function(_0x2497d4){var _0x459e2a=![];var _0x1d4f20=_0x2497d4[_0xfd60('0x12')](/\n/);for(var _0xb391dd=0x0,_0x5a4d84=_0x587037[_0xfd60('0x13')];_0xb391dd<_0x5a4d84,_0x459e2a===![];_0xb391dd+=0x1){if(_0x2497d4['indexOf'](_0x587037[_0xb391dd])>=0x0){_0x459e2a=!![];}}if(!_0x459e2a){throw new Error(util['format'](_0xfd60('0x14'),_0x18d132['params'][_0xfd60('0x10')]));}process[_0xfd60('0x15')](_0x18d132[_0xfd60('0x16')][_0xfd60('0x10')],_0xfd60('0x17'));return _0xe9a0d6['status'](0xc8)[_0xfd60('0xa')]({'message':util[_0xfd60('0xe')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x18d132[_0xfd60('0x16')][_0xfd60('0x10')])});})[_0xfd60('0xb')](handleError(_0xe9a0d6,null,_0xfd60('0x18')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index ebe1618..8dd0dc3 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 _0xe1d1=['destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete'];(function(_0x16ee11,_0x41af42){var _0x128d83=function(_0x40e757){while(--_0x40e757){_0x16ee11['push'](_0x16ee11['shift']());}};_0x128d83(++_0x41af42);}(_0xe1d1,0x131));var _0x1e1d=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0xe1d1[_0x20589d];return _0x422de9;};'use strict';var multer=require(_0x1e1d('0x0'));var util=require(_0x1e1d('0x1'));var path=require('path');var timeout=require(_0x1e1d('0x2'));var express=require(_0x1e1d('0x3'));var router=express[_0x1e1d('0x4')]();var fs_extra=require(_0x1e1d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1e1d('0x6'));var config=require(_0x1e1d('0x7'));var controller=require(_0x1e1d('0x8'));router[_0x1e1d('0x9')]('/',auth[_0x1e1d('0xa')](),controller[_0x1e1d('0xb')]);router['get'](_0x1e1d('0xc'),auth[_0x1e1d('0xa')](),controller[_0x1e1d('0xd')]);router[_0x1e1d('0xe')]('/',auth[_0x1e1d('0xa')](),controller[_0x1e1d('0xf')]);router['put'](_0x1e1d('0xc'),auth[_0x1e1d('0xa')](),controller[_0x1e1d('0x10')]);router[_0x1e1d('0x11')](_0x1e1d('0xc'),auth[_0x1e1d('0xa')](),controller[_0x1e1d('0x12')]);module['exports']=router; \ No newline at end of file +var _0x7c5a=['../../components/auth/service','../../components/interaction/service','./tag.controller','isAuthenticated','index','get','show','post','create','put','/:id','destroy','exports','util','path'];(function(_0x14aea5,_0xa0740f){var _0x571a59=function(_0x1a7dbe){while(--_0x1a7dbe){_0x14aea5['push'](_0x14aea5['shift']());}};_0x571a59(++_0xa0740f);}(_0x7c5a,0x184));var _0xa7c5=function(_0x46ad9e,_0x44df29){_0x46ad9e=_0x46ad9e-0x0;var _0x470e4a=_0x7c5a[_0x46ad9e];return _0x470e4a;};'use strict';var multer=require('multer');var util=require(_0xa7c5('0x0'));var path=require(_0xa7c5('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa7c5('0x2'));var interaction=require(_0xa7c5('0x3'));var config=require('../../config/environment');var controller=require(_0xa7c5('0x4'));router['get']('/',auth[_0xa7c5('0x5')](),controller[_0xa7c5('0x6')]);router[_0xa7c5('0x7')]('/:id',auth[_0xa7c5('0x5')](),controller[_0xa7c5('0x8')]);router[_0xa7c5('0x9')]('/',auth[_0xa7c5('0x5')](),controller[_0xa7c5('0xa')]);router[_0xa7c5('0xb')](_0xa7c5('0xc'),auth[_0xa7c5('0x5')](),controller['update']);router['delete']('/:id',auth[_0xa7c5('0x5')](),controller[_0xa7c5('0xd')]);module[_0xa7c5('0xe')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 90ce024..51833e6 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 _0x757a=['exports','STRING'];(function(_0x2d5c23,_0x4c5b6b){var _0x38f2a3=function(_0x56d5fa){while(--_0x56d5fa){_0x2d5c23['push'](_0x2d5c23['shift']());}};_0x38f2a3(++_0x4c5b6b);}(_0x757a,0xde));var _0xa757=function(_0x1fe121,_0x508fd6){_0x1fe121=_0x1fe121-0x0;var _0x2a2343=_0x757a[_0x1fe121];return _0x2a2343;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xa757('0x1')]}}; \ No newline at end of file +var _0xb84e=['STRING','name','exports'];(function(_0x28e3de,_0x53c407){var _0xd5954b=function(_0x246952){while(--_0x246952){_0x28e3de['push'](_0x28e3de['shift']());}};_0xd5954b(++_0x53c407);}(_0xb84e,0xbf));var _0xeb84=function(_0x43f881,_0xd6e5a2){_0x43f881=_0x43f881-0x0;var _0x365c14=_0xb84e[_0x43f881];return _0x365c14;};'use strict';var Sequelize=require('sequelize');module[_0xeb84('0x0')]={'name':{'type':Sequelize[_0xeb84('0x1')],'unique':_0xeb84('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xeb84('0x1')],'defaultValue':'#0091EA'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 791ca85..a4ed17e 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 _0x8ce3=['hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','UserProfileSection','autoAssociation','UserProfileResource','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','stack','name','send','map','Tag','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields'];(function(_0x1780f8,_0x11ba93){var _0x33a410=function(_0x2a015f){while(--_0x2a015f){_0x1780f8['push'](_0x1780f8['shift']());}};_0x33a410(++_0x11ba93);}(_0x8ce3,0xc3));var _0x38ce=function(_0x161ac3,_0x142e49){_0x161ac3=_0x161ac3-0x0;var _0x3bb837=_0x8ce3[_0x161ac3];return _0x3bb837;};'use strict';var emlformat=require(_0x38ce('0x0'));var rimraf=require(_0x38ce('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x38ce('0x2'));var rp=require(_0x38ce('0x3'));var moment=require(_0x38ce('0x4'));var BPromise=require(_0x38ce('0x5'));var Mustache=require(_0x38ce('0x6'));var util=require(_0x38ce('0x7'));var path=require(_0x38ce('0x8'));var sox=require(_0x38ce('0x9'));var csv=require('to-csv');var ejs=require(_0x38ce('0xa'));var fs=require('fs');var fs_extra=require(_0x38ce('0xb'));var _=require('lodash');var squel=require(_0x38ce('0xc'));var crypto=require(_0x38ce('0xd'));var jsforce=require(_0x38ce('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x38ce('0xf'));var querystring=require('querystring');var Papa=require(_0x38ce('0x10'));var Redis=require('ioredis');var authService=require(_0x38ce('0x11'));var qs=require(_0x38ce('0x12'));var as=require(_0x38ce('0x13'));var hardwareService=require(_0x38ce('0x14'));var logger=require(_0x38ce('0x15'))(_0x38ce('0x16'));var utils=require(_0x38ce('0x17'));var config=require(_0x38ce('0x18'));var licenseUtil=require(_0x38ce('0x19'));var db=require(_0x38ce('0x1a'))['db'];function respondWithStatusCode(_0x42e234,_0x3ef662){_0x3ef662=_0x3ef662||0xcc;return function(_0x28b554){if(_0x28b554){return _0x42e234[_0x38ce('0x1b')](_0x3ef662);}return _0x42e234[_0x38ce('0x1c')](_0x3ef662)[_0x38ce('0x1d')]();};}function respondWithResult(_0x56a09f,_0x48ba7c){_0x48ba7c=_0x48ba7c||0xc8;return function(_0x3c4d7f){if(_0x3c4d7f){return _0x56a09f[_0x38ce('0x1c')](_0x48ba7c)[_0x38ce('0x1e')](_0x3c4d7f);}};}function respondWithFilteredResult(_0x55be6a,_0x2f3b99){return function(_0x54fcd3){if(_0x54fcd3){var _0x2771ec=typeof _0x2f3b99[_0x38ce('0x1f')]==='undefined'&&typeof _0x2f3b99[_0x38ce('0x20')]===_0x38ce('0x21');var _0x1dfaba=_0x54fcd3['count'];var _0xe4099a=_0x2771ec?0x0:_0x2f3b99[_0x38ce('0x1f')];var _0x3df527=_0x2771ec?_0x54fcd3[_0x38ce('0x22')]:_0x2f3b99[_0x38ce('0x1f')]+_0x2f3b99[_0x38ce('0x20')];var _0x2d4218;if(_0x3df527>=_0x1dfaba){_0x3df527=_0x1dfaba;_0x2d4218=0xc8;}else{_0x2d4218=0xce;}_0x55be6a['status'](_0x2d4218);return _0x55be6a[_0x38ce('0x23')](_0x38ce('0x24'),_0xe4099a+'-'+_0x3df527+'/'+_0x1dfaba)[_0x38ce('0x1e')](_0x54fcd3);}return null;};}function patchUpdates(_0x303391){return function(_0x30b060){try{jsonpatch[_0x38ce('0x25')](_0x30b060,_0x303391,!![]);}catch(_0x323490){return BPromise[_0x38ce('0x26')](_0x323490);}return _0x30b060[_0x38ce('0x27')]();};}function saveUpdates(_0x3cf50b,_0x1aace7){return function(_0x580cf3){if(_0x580cf3){return _0x580cf3[_0x38ce('0x28')](_0x3cf50b)[_0x38ce('0x29')](function(_0xe40e9c){return _0xe40e9c;});}return null;};}function removeEntity(_0xcf5d9e,_0x4a56b0){return function(_0x2c85e6){if(_0x2c85e6){return _0x2c85e6[_0x38ce('0x2a')]()['then'](function(){var _0xe0af00=_0x2c85e6[_0x38ce('0x2b')]({'plain':!![]});var _0x43b479='Tags';return db['UserProfileResource'][_0x38ce('0x2a')]({'where':{'type':_0x43b479,'resourceId':_0xe0af00['id']}})[_0x38ce('0x29')](function(){return _0x2c85e6;});})[_0x38ce('0x29')](function(){_0xcf5d9e[_0x38ce('0x1c')](0xcc)[_0x38ce('0x1d')]();});}};}function handleEntityNotFound(_0x2a59fe,_0x13e2fc){return function(_0xce1f64){if(!_0xce1f64){_0x2a59fe[_0x38ce('0x1b')](0x194);}return _0xce1f64;};}function handleError(_0x4649be,_0xfc590a){_0xfc590a=_0xfc590a||0x1f4;return function(_0x381703){logger['error'](_0x381703[_0x38ce('0x2c')]);if(_0x381703[_0x38ce('0x2d')]){delete _0x381703['name'];}_0x4649be[_0x38ce('0x1c')](_0xfc590a)[_0x38ce('0x2e')](_0x381703);};}exports['index']=function(_0xd96d33,_0x282ee4){var _0x568d94={},_0x28d775={},_0x53f2c9={'count':0x0,'rows':[]};var _0x1aa8fb=_[_0x38ce('0x2f')](db[_0x38ce('0x30')][_0x38ce('0x31')],function(_0x444b93){return{'name':_0x444b93[_0x38ce('0x32')],'type':_0x444b93[_0x38ce('0x33')][_0x38ce('0x34')]};});_0x28d775['model']=_['map'](_0x1aa8fb,_0x38ce('0x2d'));_0x28d775[_0x38ce('0x35')]=_[_0x38ce('0x36')](_0xd96d33[_0x38ce('0x35')]);_0x28d775[_0x38ce('0x37')]=_['intersection'](_0x28d775[_0x38ce('0x38')],_0x28d775[_0x38ce('0x35')]);_0x568d94[_0x38ce('0x39')]=_[_0x38ce('0x3a')](_0x28d775[_0x38ce('0x38')],qs[_0x38ce('0x3b')](_0xd96d33[_0x38ce('0x35')]['fields']));_0x568d94[_0x38ce('0x39')]=_0x568d94[_0x38ce('0x39')]['length']?_0x568d94[_0x38ce('0x39')]:_0x28d775[_0x38ce('0x38')];if(!_0xd96d33[_0x38ce('0x35')][_0x38ce('0x3c')](_0x38ce('0x3d'))){_0x568d94[_0x38ce('0x20')]=qs[_0x38ce('0x20')](_0xd96d33[_0x38ce('0x35')]['limit']);_0x568d94[_0x38ce('0x1f')]=qs[_0x38ce('0x1f')](_0xd96d33[_0x38ce('0x35')][_0x38ce('0x1f')]);}_0x568d94['order']=qs[_0x38ce('0x3e')](_0xd96d33['query'][_0x38ce('0x3e')]);_0x568d94[_0x38ce('0x3f')]=qs[_0x38ce('0x37')](_[_0x38ce('0x40')](_0xd96d33[_0x38ce('0x35')],_0x28d775[_0x38ce('0x37')]),_0x1aa8fb);if(_0xd96d33['query'][_0x38ce('0x41')]){_0x568d94['where']=_[_0x38ce('0x42')](_0x568d94[_0x38ce('0x3f')],{'$or':_[_0x38ce('0x2f')](_0x1aa8fb,function(_0x37b738){if(_0x37b738[_0x38ce('0x33')]!==_0x38ce('0x43')){var _0x5209ee={};_0x5209ee[_0x37b738[_0x38ce('0x2d')]]={'$like':'%'+_0xd96d33[_0x38ce('0x35')][_0x38ce('0x41')]+'%'};return _0x5209ee;}})});}_0x568d94=_[_0x38ce('0x42')]({},_0x568d94,_0xd96d33[_0x38ce('0x44')]);var _0x467d3e={'where':_0x568d94['where']};return db['Tag'][_0x38ce('0x22')](_0x467d3e)[_0x38ce('0x29')](function(_0x174c86){_0x53f2c9[_0x38ce('0x22')]=_0x174c86;if(_0xd96d33[_0x38ce('0x35')][_0x38ce('0x45')]){_0x568d94[_0x38ce('0x46')]=[{'all':!![]}];}return db['Tag'][_0x38ce('0x47')](_0x568d94);})[_0x38ce('0x29')](function(_0x5a689b){_0x53f2c9[_0x38ce('0x48')]=_0x5a689b;return _0x53f2c9;})[_0x38ce('0x29')](respondWithFilteredResult(_0x282ee4,_0x568d94))[_0x38ce('0x49')](handleError(_0x282ee4,null));};exports['show']=function(_0xaf99ce,_0xd95bc8){var _0x33f6a6={'raw':!![],'where':{'id':_0xaf99ce[_0x38ce('0x4a')]['id']}},_0x981068={};_0x981068[_0x38ce('0x38')]=_['keys'](db[_0x38ce('0x30')][_0x38ce('0x31')]);_0x981068[_0x38ce('0x35')]=_[_0x38ce('0x36')](_0xaf99ce[_0x38ce('0x35')]);_0x981068[_0x38ce('0x37')]=_['intersection'](_0x981068[_0x38ce('0x38')],_0x981068[_0x38ce('0x35')]);_0x33f6a6['attributes']=_['intersection'](_0x981068['model'],qs[_0x38ce('0x3b')](_0xaf99ce[_0x38ce('0x35')]['fields']));_0x33f6a6['attributes']=_0x33f6a6[_0x38ce('0x39')]['length']?_0x33f6a6[_0x38ce('0x39')]:_0x981068['model'];if(_0xaf99ce[_0x38ce('0x35')][_0x38ce('0x45')]){_0x33f6a6['include']=[{'all':!![]}];}_0x33f6a6=_[_0x38ce('0x42')]({},_0x33f6a6,_0xaf99ce[_0x38ce('0x44')]);return db['Tag'][_0x38ce('0x4b')](_0x33f6a6)[_0x38ce('0x29')](handleEntityNotFound(_0xd95bc8,null))[_0x38ce('0x29')](respondWithResult(_0xd95bc8,null))[_0x38ce('0x49')](handleError(_0xd95bc8,null));};exports[_0x38ce('0x4c')]=function(_0x25a299,_0x58cc6f){return db[_0x38ce('0x30')][_0x38ce('0x4c')](_0x25a299['body'],{})[_0x38ce('0x29')](function(_0x316eec){var _0x429517=_0x25a299[_0x38ce('0x4d')][_0x38ce('0x2b')]({'plain':!![]});if(!_0x429517)throw new Error(_0x38ce('0x4e'));if(_0x429517[_0x38ce('0x4f')]==='user'){var _0x3e1522=_0x316eec[_0x38ce('0x2b')]({'plain':!![]});var _0x3f88df=_0x38ce('0x50');return db[_0x38ce('0x51')][_0x38ce('0x4b')]({'where':{'name':_0x3f88df,'userProfileId':_0x429517['userProfileId']},'raw':!![]})['then'](function(_0xc2c9d3){if(_0xc2c9d3&&_0xc2c9d3[_0x38ce('0x52')]===0x0){return db[_0x38ce('0x53')][_0x38ce('0x4c')]({'name':_0x3e1522[_0x38ce('0x2d')],'resourceId':_0x3e1522['id'],'type':_0xc2c9d3[_0x38ce('0x2d')],'sectionId':_0xc2c9d3['id']},{})['then'](function(){return _0x316eec;});}else{return _0x316eec;}})['catch'](function(_0x199c5b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x199c5b);throw _0x199c5b;});}return _0x316eec;})[_0x38ce('0x29')](respondWithResult(_0x58cc6f,0xc9))[_0x38ce('0x49')](handleError(_0x58cc6f,null));};exports[_0x38ce('0x28')]=function(_0xbe5626,_0xd031c0){if(_0xbe5626['body']['id']){delete _0xbe5626[_0x38ce('0x54')]['id'];}return db[_0x38ce('0x30')][_0x38ce('0x4b')]({'where':{'id':_0xbe5626[_0x38ce('0x4a')]['id']}})[_0x38ce('0x29')](handleEntityNotFound(_0xd031c0,null))[_0x38ce('0x29')](saveUpdates(_0xbe5626[_0x38ce('0x54')],null))[_0x38ce('0x29')](respondWithResult(_0xd031c0,null))[_0x38ce('0x49')](handleError(_0xd031c0,null));};exports[_0x38ce('0x2a')]=function(_0x2db125,_0x56d63e){return db['Tag'][_0x38ce('0x4b')]({'where':{'id':_0x2db125[_0x38ce('0x4a')]['id']}})[_0x38ce('0x29')](handleEntityNotFound(_0x56d63e,null))[_0x38ce('0x29')](removeEntity(_0x56d63e,null))['catch'](handleError(_0x56d63e,null));}; \ No newline at end of file +var _0xf4eb=['body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','eml-format','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','then','destroy','Tags','UserProfileResource','error','stack','name','send','index','map','Tag','fieldName','key','model','keys','filters','intersection','attributes','fields','query','length','order','sort','pick','where','merge','type','VIRTUAL','filter','options','include','rows','catch','show','rawAttributes','find','create'];(function(_0x4daf96,_0x30ffec){var _0x3f88ed=function(_0x2bab56){while(--_0x2bab56){_0x4daf96['push'](_0x4daf96['shift']());}};_0x3f88ed(++_0x30ffec);}(_0xf4eb,0xec));var _0xbf4e=function(_0xf6a9b3,_0x5cdaba){_0xf6a9b3=_0xf6a9b3-0x0;var _0x3d0a82=_0xf4eb[_0xf6a9b3];return _0x3d0a82;};'use strict';var emlformat=require(_0xbf4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf4e('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbf4e('0x2'));var path=require(_0xbf4e('0x3'));var sox=require(_0xbf4e('0x4'));var csv=require(_0xbf4e('0x5'));var ejs=require(_0xbf4e('0x6'));var fs=require('fs');var fs_extra=require(_0xbf4e('0x7'));var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x5'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var licenseUtil=require(_0xbf4e('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17fd01,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x56d185){if(_0x56d185){return _0x17fd01[_0xbf4e('0x13')](_0x5a3035);}return _0x17fd01[_0xbf4e('0x14')](_0x5a3035)[_0xbf4e('0x15')]();};}function respondWithResult(_0x302841,_0x3b74bd){_0x3b74bd=_0x3b74bd||0xc8;return function(_0x61bd54){if(_0x61bd54){return _0x302841['status'](_0x3b74bd)['json'](_0x61bd54);}};}function respondWithFilteredResult(_0x180432,_0x1735ae){return function(_0x28fc6b){if(_0x28fc6b){var _0x542909=typeof _0x1735ae[_0xbf4e('0x16')]===_0xbf4e('0x17')&&typeof _0x1735ae[_0xbf4e('0x18')]===_0xbf4e('0x17');var _0x5a631e=_0x28fc6b[_0xbf4e('0x19')];var _0x577c27=_0x542909?0x0:_0x1735ae['offset'];var _0x566ec3=_0x542909?_0x28fc6b['count']:_0x1735ae[_0xbf4e('0x16')]+_0x1735ae[_0xbf4e('0x18')];var _0x1fc800;if(_0x566ec3>=_0x5a631e){_0x566ec3=_0x5a631e;_0x1fc800=0xc8;}else{_0x1fc800=0xce;}_0x180432['status'](_0x1fc800);return _0x180432['set'](_0xbf4e('0x1a'),_0x577c27+'-'+_0x566ec3+'/'+_0x5a631e)[_0xbf4e('0x1b')](_0x28fc6b);}return null;};}function patchUpdates(_0x3be138){return function(_0x3a875b){try{jsonpatch[_0xbf4e('0x1c')](_0x3a875b,_0x3be138,!![]);}catch(_0x1e2a68){return BPromise[_0xbf4e('0x1d')](_0x1e2a68);}return _0x3a875b[_0xbf4e('0x1e')]();};}function saveUpdates(_0xd09e12,_0x376832){return function(_0x30539b){if(_0x30539b){return _0x30539b['update'](_0xd09e12)[_0xbf4e('0x1f')](function(_0x2e7673){return _0x2e7673;});}return null;};}function removeEntity(_0x51648c,_0x31e3f5){return function(_0x30994d){if(_0x30994d){return _0x30994d[_0xbf4e('0x20')]()[_0xbf4e('0x1f')](function(){var _0x3a5d72=_0x30994d['get']({'plain':!![]});var _0x90635e=_0xbf4e('0x21');return db[_0xbf4e('0x22')]['destroy']({'where':{'type':_0x90635e,'resourceId':_0x3a5d72['id']}})[_0xbf4e('0x1f')](function(){return _0x30994d;});})['then'](function(){_0x51648c['status'](0xcc)[_0xbf4e('0x15')]();});}};}function handleEntityNotFound(_0x5a0a9b,_0x38c923){return function(_0x315df3){if(!_0x315df3){_0x5a0a9b[_0xbf4e('0x13')](0x194);}return _0x315df3;};}function handleError(_0x41f918,_0x5c912f){_0x5c912f=_0x5c912f||0x1f4;return function(_0x2d4686){logger[_0xbf4e('0x23')](_0x2d4686[_0xbf4e('0x24')]);if(_0x2d4686['name']){delete _0x2d4686[_0xbf4e('0x25')];}_0x41f918['status'](_0x5c912f)[_0xbf4e('0x26')](_0x2d4686);};}exports[_0xbf4e('0x27')]=function(_0xb8b58e,_0x498dbd){var _0x1d12e2={},_0x362716={},_0x2f3cf8={'count':0x0,'rows':[]};var _0xc7ca87=_[_0xbf4e('0x28')](db[_0xbf4e('0x29')]['rawAttributes'],function(_0x35c82d){return{'name':_0x35c82d[_0xbf4e('0x2a')],'type':_0x35c82d['type'][_0xbf4e('0x2b')]};});_0x362716[_0xbf4e('0x2c')]=_['map'](_0xc7ca87,_0xbf4e('0x25'));_0x362716['query']=_[_0xbf4e('0x2d')](_0xb8b58e['query']);_0x362716[_0xbf4e('0x2e')]=_[_0xbf4e('0x2f')](_0x362716[_0xbf4e('0x2c')],_0x362716['query']);_0x1d12e2[_0xbf4e('0x30')]=_[_0xbf4e('0x2f')](_0x362716[_0xbf4e('0x2c')],qs[_0xbf4e('0x31')](_0xb8b58e[_0xbf4e('0x32')][_0xbf4e('0x31')]));_0x1d12e2['attributes']=_0x1d12e2[_0xbf4e('0x30')][_0xbf4e('0x33')]?_0x1d12e2[_0xbf4e('0x30')]:_0x362716[_0xbf4e('0x2c')];if(!_0xb8b58e[_0xbf4e('0x32')]['hasOwnProperty']('nolimit')){_0x1d12e2['limit']=qs['limit'](_0xb8b58e[_0xbf4e('0x32')][_0xbf4e('0x18')]);_0x1d12e2[_0xbf4e('0x16')]=qs[_0xbf4e('0x16')](_0xb8b58e[_0xbf4e('0x32')][_0xbf4e('0x16')]);}_0x1d12e2[_0xbf4e('0x34')]=qs[_0xbf4e('0x35')](_0xb8b58e[_0xbf4e('0x32')]['sort']);_0x1d12e2['where']=qs[_0xbf4e('0x2e')](_[_0xbf4e('0x36')](_0xb8b58e[_0xbf4e('0x32')],_0x362716['filters']),_0xc7ca87);if(_0xb8b58e[_0xbf4e('0x32')]['filter']){_0x1d12e2[_0xbf4e('0x37')]=_[_0xbf4e('0x38')](_0x1d12e2[_0xbf4e('0x37')],{'$or':_[_0xbf4e('0x28')](_0xc7ca87,function(_0x5ce339){if(_0x5ce339[_0xbf4e('0x39')]!==_0xbf4e('0x3a')){var _0x3aa308={};_0x3aa308[_0x5ce339[_0xbf4e('0x25')]]={'$like':'%'+_0xb8b58e['query'][_0xbf4e('0x3b')]+'%'};return _0x3aa308;}})});}_0x1d12e2=_[_0xbf4e('0x38')]({},_0x1d12e2,_0xb8b58e[_0xbf4e('0x3c')]);var _0x29fe9d={'where':_0x1d12e2[_0xbf4e('0x37')]};return db[_0xbf4e('0x29')][_0xbf4e('0x19')](_0x29fe9d)['then'](function(_0x176166){_0x2f3cf8[_0xbf4e('0x19')]=_0x176166;if(_0xb8b58e['query']['includeAll']){_0x1d12e2[_0xbf4e('0x3d')]=[{'all':!![]}];}return db[_0xbf4e('0x29')]['findAll'](_0x1d12e2);})['then'](function(_0x2b1bf4){_0x2f3cf8[_0xbf4e('0x3e')]=_0x2b1bf4;return _0x2f3cf8;})[_0xbf4e('0x1f')](respondWithFilteredResult(_0x498dbd,_0x1d12e2))[_0xbf4e('0x3f')](handleError(_0x498dbd,null));};exports[_0xbf4e('0x40')]=function(_0x3ad0a4,_0x5a03c6){var _0x3ecc15={'raw':!![],'where':{'id':_0x3ad0a4['params']['id']}},_0x7bd91={};_0x7bd91['model']=_['keys'](db['Tag'][_0xbf4e('0x41')]);_0x7bd91['query']=_[_0xbf4e('0x2d')](_0x3ad0a4[_0xbf4e('0x32')]);_0x7bd91['filters']=_['intersection'](_0x7bd91[_0xbf4e('0x2c')],_0x7bd91[_0xbf4e('0x32')]);_0x3ecc15[_0xbf4e('0x30')]=_[_0xbf4e('0x2f')](_0x7bd91[_0xbf4e('0x2c')],qs['fields'](_0x3ad0a4[_0xbf4e('0x32')][_0xbf4e('0x31')]));_0x3ecc15[_0xbf4e('0x30')]=_0x3ecc15[_0xbf4e('0x30')][_0xbf4e('0x33')]?_0x3ecc15[_0xbf4e('0x30')]:_0x7bd91[_0xbf4e('0x2c')];if(_0x3ad0a4[_0xbf4e('0x32')]['includeAll']){_0x3ecc15[_0xbf4e('0x3d')]=[{'all':!![]}];}_0x3ecc15=_[_0xbf4e('0x38')]({},_0x3ecc15,_0x3ad0a4[_0xbf4e('0x3c')]);return db[_0xbf4e('0x29')][_0xbf4e('0x42')](_0x3ecc15)[_0xbf4e('0x1f')](handleEntityNotFound(_0x5a03c6,null))[_0xbf4e('0x1f')](respondWithResult(_0x5a03c6,null))[_0xbf4e('0x3f')](handleError(_0x5a03c6,null));};exports[_0xbf4e('0x43')]=function(_0x3447ab,_0x2fdba9){return db[_0xbf4e('0x29')][_0xbf4e('0x43')](_0x3447ab[_0xbf4e('0x44')],{})[_0xbf4e('0x1f')](function(_0x2892ce){var _0x10bc23=_0x3447ab['user'][_0xbf4e('0x45')]({'plain':!![]});if(!_0x10bc23)throw new Error(_0xbf4e('0x46'));if(_0x10bc23[_0xbf4e('0x47')]==='user'){var _0x33ab9a=_0x2892ce['get']({'plain':!![]});var _0x4a050e=_0xbf4e('0x21');return db[_0xbf4e('0x48')]['find']({'where':{'name':_0x4a050e,'userProfileId':_0x10bc23[_0xbf4e('0x49')]},'raw':!![]})[_0xbf4e('0x1f')](function(_0x31d779){if(_0x31d779&&_0x31d779[_0xbf4e('0x4a')]===0x0){return db[_0xbf4e('0x22')][_0xbf4e('0x43')]({'name':_0x33ab9a[_0xbf4e('0x25')],'resourceId':_0x33ab9a['id'],'type':_0x31d779[_0xbf4e('0x25')],'sectionId':_0x31d779['id']},{})[_0xbf4e('0x1f')](function(){return _0x2892ce;});}else{return _0x2892ce;}})[_0xbf4e('0x3f')](function(_0x271ad2){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x271ad2);throw _0x271ad2;});}return _0x2892ce;})[_0xbf4e('0x1f')](respondWithResult(_0x2fdba9,0xc9))[_0xbf4e('0x3f')](handleError(_0x2fdba9,null));};exports[_0xbf4e('0x4b')]=function(_0x586f5d,_0x339ce6){if(_0x586f5d[_0xbf4e('0x44')]['id']){delete _0x586f5d['body']['id'];}return db['Tag'][_0xbf4e('0x42')]({'where':{'id':_0x586f5d['params']['id']}})['then'](handleEntityNotFound(_0x339ce6,null))[_0xbf4e('0x1f')](saveUpdates(_0x586f5d[_0xbf4e('0x44')],null))[_0xbf4e('0x1f')](respondWithResult(_0x339ce6,null))[_0xbf4e('0x3f')](handleError(_0x339ce6,null));};exports[_0xbf4e('0x20')]=function(_0x5ec2d9,_0x242a75){return db['Tag'][_0xbf4e('0x42')]({'where':{'id':_0x5ec2d9['params']['id']}})[_0xbf4e('0x1f')](handleEntityNotFound(_0x242a75,null))['then'](removeEntity(_0x242a75,null))[_0xbf4e('0x3f')](handleError(_0x242a75,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 260634f..5d05a22 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 _0x4ccc=['Tag','util','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','define'];(function(_0x5a99bb,_0xbc6bff){var _0x1b9940=function(_0xb4086e){while(--_0xb4086e){_0x5a99bb['push'](_0x5a99bb['shift']());}};_0x1b9940(++_0xbc6bff);}(_0x4ccc,0x145));var _0xc4cc=function(_0x97ebfb,_0x416f0f){_0x97ebfb=_0x97ebfb-0x0;var _0x5d61f6=_0x4ccc[_0x97ebfb];return _0x5d61f6;};'use strict';var _=require('lodash');var util=require(_0xc4cc('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc4cc('0x1'));var fs=require('fs');var path=require(_0xc4cc('0x2'));var rimraf=require(_0xc4cc('0x3'));var config=require(_0xc4cc('0x4'));var attributes=require(_0xc4cc('0x5'));module[_0xc4cc('0x6')]=function(_0x2eb85e,_0x1971b8){return _0x2eb85e[_0xc4cc('0x7')](_0xc4cc('0x8'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e5c=['../../config/logger','api','moment','bluebird','path','./tag.attributes','exports','tools_tags','lodash','util'];(function(_0x2f4402,_0x7ae62e){var _0x332446=function(_0x418082){while(--_0x418082){_0x2f4402['push'](_0x2f4402['shift']());}};_0x332446(++_0x7ae62e);}(_0x0e5c,0x1e8));var _0xc0e5=function(_0x5be795,_0x1cb1b8){_0x5be795=_0x5be795-0x0;var _0x4e8a3b=_0x0e5c[_0x5be795];return _0x4e8a3b;};'use strict';var _=require(_0xc0e5('0x0'));var util=require(_0xc0e5('0x1'));var logger=require(_0xc0e5('0x2'))(_0xc0e5('0x3'));var moment=require(_0xc0e5('0x4'));var BPromise=require(_0xc0e5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc0e5('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc0e5('0x7'));module[_0xc0e5('0x8')]=function(_0x17d889,_0x4866df){return _0x17d889['define']('Tag',attributes,{'tableName':_0xc0e5('0x9'),'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 4b15925..9c499b3 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 _0x99e9=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x35e92e,_0x21581b){var _0x1205a8=function(_0x4325d8){while(--_0x4325d8){_0x35e92e['push'](_0x35e92e['shift']());}};_0x1205a8(++_0x21581b);}(_0x99e9,0xb4));var _0x999e=function(_0x4456a2,_0x376ff2){_0x4456a2=_0x4456a2-0x0;var _0xf36b56=_0x99e9[_0x4456a2];return _0xf36b56;};'use strict';var _=require('lodash');var util=require(_0x999e('0x0'));var moment=require(_0x999e('0x1'));var BPromise=require(_0x999e('0x2'));var rs=require(_0x999e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x999e('0x4'))['db'];var utils=require(_0x999e('0x5'));var logger=require(_0x999e('0x6'))('rpc');var config=require(_0x999e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x999e('0x8')][_0x999e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x100330,_0x18f337,_0x5c1c17){return new BPromise(function(_0x46aeae,_0x38a692){return client[_0x999e('0xa')](_0x100330,_0x5c1c17)[_0x999e('0xb')](function(_0x2c38cf){logger[_0x999e('0xc')](_0x999e('0xd'),_0x18f337,_0x999e('0xe'));logger[_0x999e('0xf')](_0x999e('0x10'),_0x18f337,_0x999e('0xe'),JSON[_0x999e('0x11')](_0x2c38cf));if(_0x2c38cf[_0x999e('0x12')]){if(_0x2c38cf[_0x999e('0x12')][_0x999e('0x13')]===0x1f4){logger[_0x999e('0x12')](_0x999e('0xd'),_0x18f337,_0x2c38cf['error'][_0x999e('0x14')]);return _0x38a692(_0x2c38cf['error'][_0x999e('0x14')]);}logger[_0x999e('0x12')](_0x999e('0xd'),_0x18f337,_0x2c38cf['error'][_0x999e('0x14')]);return _0x46aeae(_0x2c38cf['error'][_0x999e('0x14')]);}else{logger['info']('Tag,\x20%s,\x20%s',_0x18f337,_0x999e('0xe'));_0x46aeae(_0x2c38cf[_0x999e('0x15')][_0x999e('0x14')]);}})[_0x999e('0x16')](function(_0x1e9bff){logger[_0x999e('0x12')]('Tag,\x20%s,\x20%s',_0x18f337,_0x1e9bff);_0x38a692(_0x1e9bff);});});} \ No newline at end of file +var _0x207c=['message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','request','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','error'];(function(_0x39507b,_0x3efdac){var _0x5e7dd4=function(_0x18527e){while(--_0x18527e){_0x39507b['push'](_0x39507b['shift']());}};_0x5e7dd4(++_0x3efdac);}(_0x207c,0x1e8));var _0xc207=function(_0x2efb96,_0x40a4ce){_0x2efb96=_0x2efb96-0x0;var _0x50d38d=_0x207c[_0x2efb96];return _0x50d38d;};'use strict';var _=require('lodash');var util=require(_0xc207('0x0'));var moment=require(_0xc207('0x1'));var BPromise=require(_0xc207('0x2'));var rs=require(_0xc207('0x3'));var fs=require('fs');var Redis=require(_0xc207('0x4'));var db=require(_0xc207('0x5'))['db'];var utils=require(_0xc207('0x6'));var logger=require('../../config/logger')(_0xc207('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc207('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x314561,_0x3395e4,_0x59ff6f){return new BPromise(function(_0x25cb97,_0xad159b){return client[_0xc207('0x9')](_0x314561,_0x59ff6f)['then'](function(_0xffae6c){logger[_0xc207('0xa')](_0xc207('0xb'),_0x3395e4,_0xc207('0xc'));logger[_0xc207('0xd')](_0xc207('0xe'),_0x3395e4,'request\x20sent',JSON['stringify'](_0xffae6c));if(_0xffae6c['error']){if(_0xffae6c[_0xc207('0xf')]['code']===0x1f4){logger[_0xc207('0xf')](_0xc207('0xb'),_0x3395e4,_0xffae6c['error'][_0xc207('0x10')]);return _0xad159b(_0xffae6c[_0xc207('0xf')][_0xc207('0x10')]);}logger[_0xc207('0xf')](_0xc207('0xb'),_0x3395e4,_0xffae6c['error'][_0xc207('0x10')]);return _0x25cb97(_0xffae6c[_0xc207('0xf')][_0xc207('0x10')]);}else{logger[_0xc207('0xa')]('Tag,\x20%s,\x20%s',_0x3395e4,'request\x20sent');_0x25cb97(_0xffae6c['result'][_0xc207('0x10')]);}})[_0xc207('0x11')](function(_0x3d9c7b){logger[_0xc207('0xf')]('Tag,\x20%s,\x20%s',_0x3395e4,_0x3d9c7b);_0xad159b(_0x3d9c7b);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index a9f2039..f07cb69 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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 1d41694..53b75ec 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x110ed8,_0x4e37e6){var _0x1b4f61=function(_0x7a07f2){while(--_0x7a07f2){_0x110ed8['push'](_0x110ed8['shift']());}};_0x1b4f61(++_0x4e37e6);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb10b=['name','sequelize','STRING'];(function(_0x2a6023,_0x1b8215){var _0x6332=function(_0x53a75b){while(--_0x53a75b){_0x2a6023['push'](_0x2a6023['shift']());}};_0x6332(++_0x1b8215);}(_0xb10b,0x12a));var _0xbb10=function(_0x54d506,_0xabf5c2){_0x54d506=_0x54d506-0x0;var _0x5d3040=_0xb10b[_0x54d506];return _0x5d3040;};'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/team/team.controller.js b/server/api/team/team.controller.js index c580ce1..e46bb9e 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 _0x7703=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','stack','send','index','map','Team','rawAttributes','fieldName','type','key','name','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','then','includeAll','include','findAll','catch','create','body','user','get','Teams','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','error','update','params','destroy','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','VoiceQueueId','UserMailQueue','SmsQueueId','UserSmsQueue','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getQueues','findOne','channel','isValidChannel','ValidationError','capitalize','toLowerCase','order','Queues','addQueues','Unknown\x20channel','add','ids','removeQueues','remove','addAgents','isArray','Mail','Sms','Fax','Openchannel','Whatsapp','transaction','Voice','penalty','TeamVoiceQueue','findOrCreate','Queue:save','User','online','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','voicePause','all','spread','removeAgents','Chat','emit','Queue:remove','QueueId','getAgents','hasOwnProperty','rimraf','moment','bluebird','mustache','util','sox','jsforce','desk.js','to-csv','papaparse','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end'];(function(_0x2cb3eb,_0x4d83aa){var _0x2759ee=function(_0x4108a0){while(--_0x4108a0){_0x2cb3eb['push'](_0x2cb3eb['shift']());}};_0x2759ee(++_0x4d83aa);}(_0x7703,0x1a2));var _0x3770=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0x7703[_0x5416db];return _0x243e35;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3770('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3770('0x1'));var BPromise=require(_0x3770('0x2'));var Mustache=require(_0x3770('0x3'));var util=require(_0x3770('0x4'));var path=require('path');var sox=require(_0x3770('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3770('0x6'));var deskjs=require(_0x3770('0x7'));var toCsv=require(_0x3770('0x8'));var querystring=require('querystring');var Papa=require(_0x3770('0x9'));var Redis=require(_0x3770('0xa'));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(_0x3770('0xb'))(_0x3770('0xc'));var utils=require('../../config/utils');var config=require(_0x3770('0xd'));var licenseUtil=require('../../config/license/util');var db=require(_0x3770('0xe'))['db'];config[_0x3770('0xf')]=_[_0x3770('0x10')](config[_0x3770('0xf')],{'host':_0x3770('0x11'),'port':0x18eb});var socket=require(_0x3770('0x12'))(new Redis(config[_0x3770('0xf')]));require('./team.socket')[_0x3770('0x13')](socket);function respondWithStatusCode(_0x4be6e5,_0x184e2d){_0x184e2d=_0x184e2d||0xcc;return function(_0x537a50){if(_0x537a50){return _0x4be6e5[_0x3770('0x14')](_0x184e2d);}return _0x4be6e5[_0x3770('0x15')](_0x184e2d)[_0x3770('0x16')]();};}function respondWithResult(_0x22cf27,_0x55a4dc){_0x55a4dc=_0x55a4dc||0xc8;return function(_0x2381bb){if(_0x2381bb){return _0x22cf27[_0x3770('0x15')](_0x55a4dc)[_0x3770('0x17')](_0x2381bb);}};}function respondWithFilteredResult(_0x3880e7,_0x718212){return function(_0xe95d8d){if(_0xe95d8d){var _0x9e4864=typeof _0x718212[_0x3770('0x18')]===_0x3770('0x19')&&typeof _0x718212[_0x3770('0x1a')]==='undefined';var _0x4a6593=_0xe95d8d[_0x3770('0x1b')];var _0x2ae6c7=_0x9e4864?0x0:_0x718212[_0x3770('0x18')];var _0x5ce7c2=_0x9e4864?_0xe95d8d['count']:_0x718212[_0x3770('0x18')]+_0x718212[_0x3770('0x1a')];var _0x3b1f03;if(_0x5ce7c2>=_0x4a6593){_0x5ce7c2=_0x4a6593;_0x3b1f03=0xc8;}else{_0x3b1f03=0xce;}_0x3880e7[_0x3770('0x15')](_0x3b1f03);return _0x3880e7[_0x3770('0x1c')](_0x3770('0x1d'),_0x2ae6c7+'-'+_0x5ce7c2+'/'+_0x4a6593)['json'](_0xe95d8d);}return null;};}function patchUpdates(_0x3140dd){return function(_0x29761d){try{jsonpatch[_0x3770('0x1e')](_0x29761d,_0x3140dd,!![]);}catch(_0x217dc5){return BPromise[_0x3770('0x1f')](_0x217dc5);}return _0x29761d[_0x3770('0x20')]();};}function saveUpdates(_0x5cba07,_0x128ab4){return function(_0x3ae840){if(_0x3ae840){return _0x3ae840['update'](_0x5cba07)['then'](function(_0x101327){return _0x101327;});}return null;};}function handleEntityNotFound(_0x399e57,_0x31fa8e){return function(_0x1a0b5a){if(!_0x1a0b5a){_0x399e57['sendStatus'](0x194);}return _0x1a0b5a;};}function handleError(_0xfeb369,_0x547837){_0x547837=_0x547837||0x1f4;return function(_0x4ab1bc){logger['error'](_0x4ab1bc[_0x3770('0x21')]);if(_0x4ab1bc['name']){delete _0x4ab1bc['name'];}_0xfeb369[_0x3770('0x15')](_0x547837)[_0x3770('0x22')](_0x4ab1bc);};}exports[_0x3770('0x23')]=function(_0x508352,_0xb4a993){var _0x15977d={},_0x2734e3={},_0x83ae4c={'count':0x0,'rows':[]};var _0x5c174e=_[_0x3770('0x24')](db[_0x3770('0x25')][_0x3770('0x26')],function(_0xb35f88){return{'name':_0xb35f88[_0x3770('0x27')],'type':_0xb35f88[_0x3770('0x28')][_0x3770('0x29')]};});_0x2734e3['model']=_[_0x3770('0x24')](_0x5c174e,_0x3770('0x2a'));_0x2734e3[_0x3770('0x2b')]=_[_0x3770('0x2c')](_0x508352['query']);_0x2734e3[_0x3770('0x2d')]=_[_0x3770('0x2e')](_0x2734e3[_0x3770('0x2f')],_0x2734e3['query']);_0x15977d[_0x3770('0x30')]=_['intersection'](_0x2734e3[_0x3770('0x2f')],qs[_0x3770('0x31')](_0x508352[_0x3770('0x2b')][_0x3770('0x31')]));_0x15977d['attributes']=_0x15977d[_0x3770('0x30')][_0x3770('0x32')]?_0x15977d['attributes']:_0x2734e3[_0x3770('0x2f')];if(!_0x508352[_0x3770('0x2b')]['hasOwnProperty'](_0x3770('0x33'))){_0x15977d['limit']=qs[_0x3770('0x1a')](_0x508352[_0x3770('0x2b')]['limit']);_0x15977d['offset']=qs[_0x3770('0x18')](_0x508352[_0x3770('0x2b')]['offset']);}_0x15977d['order']=qs['sort'](_0x508352[_0x3770('0x2b')][_0x3770('0x34')]);_0x15977d[_0x3770('0x35')]=qs['filters'](_[_0x3770('0x36')](_0x508352[_0x3770('0x2b')],_0x2734e3['filters']),_0x5c174e);if(_0x508352[_0x3770('0x2b')][_0x3770('0x37')]){_0x15977d['where']=_['merge'](_0x15977d[_0x3770('0x35')],{'$or':_[_0x3770('0x24')](_0x5c174e,function(_0x5e148b){if(_0x5e148b[_0x3770('0x28')]!==_0x3770('0x38')){var _0x27b4c3={};_0x27b4c3[_0x5e148b[_0x3770('0x2a')]]={'$like':'%'+_0x508352[_0x3770('0x2b')][_0x3770('0x37')]+'%'};return _0x27b4c3;}})});}_0x15977d=_[_0x3770('0x39')]({},_0x15977d,_0x508352[_0x3770('0x3a')]);var _0x2f373b={'where':_0x15977d['where']};return db[_0x3770('0x25')][_0x3770('0x1b')](_0x2f373b)[_0x3770('0x3b')](function(_0x55ae84){_0x83ae4c[_0x3770('0x1b')]=_0x55ae84;if(_0x508352['query'][_0x3770('0x3c')]){_0x15977d[_0x3770('0x3d')]=[{'all':!![]}];}return db[_0x3770('0x25')][_0x3770('0x3e')](_0x15977d);})[_0x3770('0x3b')](function(_0x371db2){_0x83ae4c['rows']=_0x371db2;return _0x83ae4c;})[_0x3770('0x3b')](respondWithFilteredResult(_0xb4a993,_0x15977d))['catch'](handleError(_0xb4a993,null));};exports['show']=function(_0x17f720,_0x3d5a57){var _0xecd773={'raw':![],'where':{'id':_0x17f720['params']['id']}},_0x2e5cff={};_0x2e5cff[_0x3770('0x2f')]=_[_0x3770('0x2c')](db[_0x3770('0x25')][_0x3770('0x26')]);_0x2e5cff['query']=_[_0x3770('0x2c')](_0x17f720['query']);_0x2e5cff[_0x3770('0x2d')]=_[_0x3770('0x2e')](_0x2e5cff['model'],_0x2e5cff[_0x3770('0x2b')]);_0xecd773[_0x3770('0x30')]=_[_0x3770('0x2e')](_0x2e5cff[_0x3770('0x2f')],qs['fields'](_0x17f720[_0x3770('0x2b')][_0x3770('0x31')]));_0xecd773[_0x3770('0x30')]=_0xecd773[_0x3770('0x30')][_0x3770('0x32')]?_0xecd773[_0x3770('0x30')]:_0x2e5cff['model'];if(_0x17f720[_0x3770('0x2b')][_0x3770('0x3c')]){_0xecd773['include']=[{'all':!![]}];}_0xecd773=_[_0x3770('0x39')]({},_0xecd773,_0x17f720[_0x3770('0x3a')]);return db[_0x3770('0x25')]['find'](_0xecd773)[_0x3770('0x3b')](handleEntityNotFound(_0x3d5a57,null))[_0x3770('0x3b')](respondWithResult(_0x3d5a57,null))[_0x3770('0x3f')](handleError(_0x3d5a57,null));};exports[_0x3770('0x40')]=function(_0x489681,_0x3669ef){return db[_0x3770('0x25')][_0x3770('0x40')](_0x489681[_0x3770('0x41')],{})[_0x3770('0x3b')](function(_0x3d5985){var _0x478d45=_0x489681[_0x3770('0x42')][_0x3770('0x43')]({'plain':!![]});if(!_0x478d45)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x478d45['role']===_0x3770('0x42')){var _0x1cd00f=_0x3d5985[_0x3770('0x43')]({'plain':!![]});var _0x4cc861=_0x3770('0x44');return db[_0x3770('0x45')][_0x3770('0x46')]({'where':{'name':_0x4cc861,'userProfileId':_0x478d45[_0x3770('0x47')]},'raw':!![]})[_0x3770('0x3b')](function(_0x162c29){if(_0x162c29&&_0x162c29[_0x3770('0x48')]===0x0){return db[_0x3770('0x49')][_0x3770('0x40')]({'name':_0x1cd00f[_0x3770('0x2a')],'resourceId':_0x1cd00f['id'],'type':_0x162c29['name'],'sectionId':_0x162c29['id']},{})[_0x3770('0x3b')](function(){return _0x3d5985;});}else{return _0x3d5985;}})['catch'](function(_0x459774){logger[_0x3770('0x4a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x459774);throw _0x459774;});}return _0x3d5985;})[_0x3770('0x3b')](respondWithResult(_0x3669ef,0xc9))['catch'](handleError(_0x3669ef,null));};exports[_0x3770('0x4b')]=function(_0x4ebb1d,_0x497043){if(_0x4ebb1d[_0x3770('0x41')]['id']){delete _0x4ebb1d['body']['id'];}return db[_0x3770('0x25')][_0x3770('0x46')]({'where':{'id':_0x4ebb1d[_0x3770('0x4c')]['id']}})[_0x3770('0x3b')](handleEntityNotFound(_0x497043,null))[_0x3770('0x3b')](saveUpdates(_0x4ebb1d['body'],null))['then'](respondWithResult(_0x497043,null))['catch'](handleError(_0x497043,null));};exports[_0x3770('0x4d')]=function(_0x33b1ef,_0x2e1351){var _0x47fd19=_0x33b1ef[_0x3770('0x4c')]['id'];var _0x5a5128=[];return db[_0x3770('0x4e')]['transaction'](function(_0x46a45d){var _0x1785dd=_0x3770('0x4f')+_0x47fd19;return db[_0x3770('0x4e')][_0x3770('0x2b')](_0x1785dd,{'type':db[_0x3770('0x50')]['QueryTypes'][_0x3770('0x51')],'raw':!![],'transaction':_0x46a45d})['then'](function(_0x5c71f1){_0x5a5128=_['map'](_0x5c71f1,function(_0x53c345){return Number(_0x53c345[_0x3770('0x52')]);});})[_0x3770('0x3b')](function(){var _0x214882=_0x3770('0x53')+_0x47fd19;return db[_0x3770('0x4e')][_0x3770('0x2b')](_0x214882,{'type':db['Sequelize'][_0x3770('0x54')][_0x3770('0x51')],'raw':!![],'transaction':_0x46a45d});})[_0x3770('0x3b')](function(_0x587153){var _0x44fc66=_[_0x3770('0x24')](_0x587153,function(_0x21fde6){return Number(_0x21fde6[_0x3770('0x55')]);});return db['UserVoiceQueue'][_0x3770('0x4d')]({'where':{'UserId':{'$in':_0x5a5128},'VoiceQueueId':{'$in':_0x44fc66}},'transaction':_0x46a45d});})[_0x3770('0x3b')](function(){var _0x20654c='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x47fd19;return db['sequelize']['query'](_0x20654c,{'type':db[_0x3770('0x50')][_0x3770('0x54')][_0x3770('0x51')],'raw':!![],'transaction':_0x46a45d});})[_0x3770('0x3b')](function(_0x4d185d){var _0x2b4452=_[_0x3770('0x24')](_0x4d185d,function(_0x2d7ef5){return Number(_0x2d7ef5['MailQueueId']);});return db[_0x3770('0x56')][_0x3770('0x4d')]({'where':{'UserId':{'$in':_0x5a5128},'MailQueueId':{'$in':_0x2b4452}},'transaction':_0x46a45d});})[_0x3770('0x3b')](function(){var _0x58e166='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x47fd19;return db['sequelize'][_0x3770('0x2b')](_0x58e166,{'type':db['Sequelize'][_0x3770('0x54')][_0x3770('0x51')],'raw':!![],'transaction':_0x46a45d});})['then'](function(_0x1edf3a){var _0x19aa21=_[_0x3770('0x24')](_0x1edf3a,function(_0x1243f8){return Number(_0x1243f8[_0x3770('0x57')]);});return db[_0x3770('0x58')][_0x3770('0x4d')]({'where':{'UserId':{'$in':_0x5a5128},'SmsQueueId':{'$in':_0x19aa21}},'transaction':_0x46a45d});})[_0x3770('0x3b')](function(){var _0x312f75='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x47fd19;return db[_0x3770('0x4e')]['query'](_0x312f75,{'type':db[_0x3770('0x50')][_0x3770('0x54')]['SELECT'],'raw':!![],'transaction':_0x46a45d});})[_0x3770('0x3b')](function(_0x1c2aaa){var _0x5bc271=_[_0x3770('0x24')](_0x1c2aaa,function(_0x49b541){return Number(_0x49b541[_0x3770('0x59')]);});return db[_0x3770('0x5a')][_0x3770('0x4d')]({'where':{'UserId':{'$in':_0x5a5128},'ChatQueueId':{'$in':_0x5bc271}},'transaction':_0x46a45d});})['then'](function(){var _0x10d02b=_0x3770('0x5b')+_0x47fd19;return db[_0x3770('0x4e')]['query'](_0x10d02b,{'type':db[_0x3770('0x50')][_0x3770('0x54')][_0x3770('0x51')],'raw':!![],'transaction':_0x46a45d});})['then'](function(_0x21bbba){var _0x33a202=_[_0x3770('0x24')](_0x21bbba,function(_0x53c2d0){return Number(_0x53c2d0[_0x3770('0x5c')]);});return db[_0x3770('0x5d')]['destroy']({'where':{'UserId':{'$in':_0x5a5128},'FaxQueueId':{'$in':_0x33a202}},'transaction':_0x46a45d});})[_0x3770('0x3b')](function(){var _0x4bdd8f=_0x3770('0x5e')+_0x47fd19;return db[_0x3770('0x4e')][_0x3770('0x2b')](_0x4bdd8f,{'type':db['Sequelize'][_0x3770('0x54')][_0x3770('0x51')],'raw':!![],'transaction':_0x46a45d});})[_0x3770('0x3b')](function(_0xc6e750){var _0x2a817a=_[_0x3770('0x24')](_0xc6e750,function(_0x7e5b26){return Number(_0x7e5b26['OpenchannelQueueId']);});return db[_0x3770('0x5f')][_0x3770('0x4d')]({'where':{'UserId':{'$in':_0x5a5128},'OpenchannelQueueId':{'$in':_0x2a817a}},'transaction':_0x46a45d});})[_0x3770('0x3b')](function(){var _0x439a16=_0x3770('0x60')+_0x47fd19;return db['sequelize'][_0x3770('0x2b')](_0x439a16,{'type':db[_0x3770('0x50')][_0x3770('0x54')][_0x3770('0x51')],'raw':!![],'transaction':_0x46a45d});})[_0x3770('0x3b')](function(_0x11d8cc){var _0x3e5e42=_[_0x3770('0x24')](_0x11d8cc,function(_0x5bcbd9){return Number(_0x5bcbd9['WhatsappQueueId']);});return db[_0x3770('0x61')][_0x3770('0x4d')]({'where':{'UserId':{'$in':_0x5a5128},'WhatsappQueueId':{'$in':_0x3e5e42}},'transaction':_0x46a45d});})['then'](function(){return db[_0x3770('0x62')][_0x3770('0x46')]({'where':{'TeamId':_0x47fd19}});})[_0x3770('0x3b')](function(_0x3b007a){if(_0x3b007a===null){return;}return db[_0x3770('0x63')][_0x3770('0x4d')]({'where':{'UserId':{'$in':_0x5a5128},'VoicePrefixId':_0x3b007a[_0x3770('0x64')]},'transaction':_0x46a45d});})[_0x3770('0x3b')](function(){return db['Team'][_0x3770('0x4d')]({'where':{'id':_0x47fd19},'cascade':!![],'transaction':_0x46a45d});})['then'](function(_0x507718){if(_0x507718===0x0){_0x2e1351[_0x3770('0x14')](0x194);}else{return db[_0x3770('0x49')][_0x3770('0x4d')]({'where':{'type':'Teams','resourceId':_0x47fd19},'cascade':!![],'transaction':_0x46a45d})[_0x3770('0x3b')](function(){_0x2e1351[_0x3770('0x15')](0xcc)[_0x3770('0x16')]();});}})[_0x3770('0x3f')](function(_0x5a3b22){_0x2e1351[_0x3770('0x15')](0x1f4)[_0x3770('0x22')](_0x5a3b22);});});};exports[_0x3770('0x65')]=function(_0x375259,_0x566233,_0x28f474){return db[_0x3770('0x25')][_0x3770('0x66')]({'where':{'id':_0x375259['params']['id']}})[_0x3770('0x3b')](handleEntityNotFound(_0x566233,null))[_0x3770('0x3b')](function(_0x2615ac){if(!_0x375259['query'][_0x3770('0x67')]||!utils[_0x3770('0x68')](_0x375259[_0x3770('0x2b')][_0x3770('0x67')])){throw new db['Sequelize'][(_0x3770('0x69'))]('Unknown\x20channel');}var _0x3761d1={};var _0x1f8627={};_0x1f8627[_0x3770('0x2f')]=_[_0x3770('0x2c')](db[_[_0x3770('0x6a')](_0x375259[_0x3770('0x2b')]['channel'][_0x3770('0x6b')]())+'Queue'][_0x3770('0x26')]);_0x1f8627[_0x3770('0x2b')]=_[_0x3770('0x2c')](_0x375259['query']);_0x1f8627['filters']=_[_0x3770('0x2e')](_0x1f8627['model'],_0x1f8627[_0x3770('0x2b')]);_0x3761d1['attributes']=_[_0x3770('0x2e')](_0x1f8627['model'],qs[_0x3770('0x31')](_0x375259['query'][_0x3770('0x31')]));_0x3761d1['attributes']=_0x3761d1[_0x3770('0x30')][_0x3770('0x32')]?_0x3761d1[_0x3770('0x30')]:_0x1f8627[_0x3770('0x2f')];_0x3761d1[_0x3770('0x1a')]=qs[_0x3770('0x1a')](_0x375259[_0x3770('0x2b')][_0x3770('0x1a')]);_0x3761d1[_0x3770('0x18')]=qs['offset'](_0x375259[_0x3770('0x2b')][_0x3770('0x18')]);_0x3761d1[_0x3770('0x6c')]=qs[_0x3770('0x34')](_0x375259['query']['sort']);_0x3761d1['where']=qs[_0x3770('0x2d')](_['pick'](_0x375259[_0x3770('0x2b')],_0x1f8627[_0x3770('0x2d')]));_0x3761d1=_[_0x3770('0x39')]({},_0x3761d1,_0x375259[_0x3770('0x3a')]);return _0x2615ac['get'+_[_0x3770('0x6a')](_0x375259[_0x3770('0x2b')][_0x3770('0x67')]['toLowerCase']())+_0x3770('0x6d')](_0x3761d1);})[_0x3770('0x3b')](respondWithResult(_0x566233,null))[_0x3770('0x3f')](handleError(_0x566233,null));};exports[_0x3770('0x6e')]=function(_0x2f1e1d,_0x173885,_0x50e45d){return db[_0x3770('0x25')]['findOne']({'where':{'id':_0x2f1e1d[_0x3770('0x4c')]['id']}})['then'](function(_0x58a391){if(_0x58a391){if(!_0x2f1e1d[_0x3770('0x41')][_0x3770('0x67')]||!utils['isValidChannel'](_0x2f1e1d[_0x3770('0x41')][_0x3770('0x67')])){throw new db[(_0x3770('0x50'))][(_0x3770('0x69'))](_0x3770('0x6f'));}return _0x58a391[_0x3770('0x70')+_[_0x3770('0x6a')](_0x2f1e1d['body'][_0x3770('0x67')][_0x3770('0x6b')]())+'Queues'](_0x2f1e1d[_0x3770('0x41')][_0x3770('0x71')]);}return null;})[_0x3770('0x3b')](handleEntityNotFound(_0x173885,null))[_0x3770('0x3b')](respondWithStatusCode(_0x173885,null))[_0x3770('0x3f')](handleError(_0x173885,null));};exports[_0x3770('0x72')]=function(_0x431a71,_0x2fbf30,_0x25f3b9){return db['Team'][_0x3770('0x66')]({'where':{'id':_0x431a71[_0x3770('0x4c')]['id']}})['then'](function(_0x3c1ba0){if(_0x3c1ba0){if(!_0x431a71[_0x3770('0x2b')][_0x3770('0x67')]||!utils['isValidChannel'](_0x431a71[_0x3770('0x2b')][_0x3770('0x67')])){throw new db['Sequelize'][(_0x3770('0x69'))](_0x3770('0x6f'));}return _0x3c1ba0[_0x3770('0x73')+_[_0x3770('0x6a')](_0x431a71[_0x3770('0x2b')][_0x3770('0x67')][_0x3770('0x6b')]())+_0x3770('0x6d')](_0x431a71['query']['ids']);}return null;})[_0x3770('0x3b')](handleEntityNotFound(_0x2fbf30,null))['then'](respondWithStatusCode(_0x2fbf30,null))[_0x3770('0x3f')](handleError(_0x2fbf30,null));};exports[_0x3770('0x74')]=function(_0x46bb77,_0x26d00a){var _0xfcb596=_[_0x3770('0x75')](_0x46bb77[_0x3770('0x41')]['ids'])?_0x46bb77[_0x3770('0x41')][_0x3770('0x71')]:[_0x46bb77[_0x3770('0x41')][_0x3770('0x71')]];var _0x3e8ffe=_0x46bb77[_0x3770('0x4c')]['id'];return db[_0x3770('0x25')][_0x3770('0x46')]({'where':{'id':_0x3e8ffe}})[_0x3770('0x3b')](handleEntityNotFound(_0x26d00a,null))[_0x3770('0x3b')](function(_0x49fca6){if(_0x49fca6){var _0x4f88db=['Voice','Chat',_0x3770('0x76'),_0x3770('0x77'),_0x3770('0x78'),_0x3770('0x79'),_0x3770('0x7a')];return db[_0x3770('0x4e')][_0x3770('0x7b')](function(_0x5e92c7){var _0x2cc940=_[_0x3770('0x24')](_0x4f88db,function(_0x12d81f){var _0x3ccb5d={'attributes':['id',_0x3770('0x2a')]};if(_0x12d81f===_0x3770('0x7c')){_0x3ccb5d['through']={'attributes':[_0x3770('0x7d')]};}return _0x49fca6[_0x3770('0x43')+_0x12d81f+_0x3770('0x6d')](_0x3ccb5d)['then'](function(_0x4f91c2){var _0x4de965=_[_0x3770('0x24')](_0x4f91c2,function(_0x49e7ba){var _0x585b27=_[_0x3770('0x24')](_0xfcb596,function(_0x847711){var _0x22ae3e={'where':{'UserId':_0x847711,[_0x12d81f+'QueueId']:_0x49e7ba['id']},'transaction':_0x5e92c7};if(_0x12d81f===_0x3770('0x7c')){_0x22ae3e['defaults']={'penalty':_0x49e7ba[_0x3770('0x7e')]['penalty']};}return db['User'+_0x12d81f+'Queue'][_0x3770('0x7f')](_0x22ae3e)[_0x3770('0x3b')](function(){socket['emit'](_0x3770('0x42')+_0x12d81f+_0x3770('0x80'),{'UserId':_0x847711,[_0x12d81f+'QueueId']:_0x49e7ba['id']});if(_0x12d81f!==_0x3770('0x7c')){return;}return db[_0x3770('0x81')]['findAll']({'where':{'id':_0xfcb596,'online':0x1},'attributes':['id',_0x3770('0x2a'),_0x3770('0x82'),'voicePause',_0x3770('0x83')],'raw':!![]})[_0x3770('0x3b')](function(_0xc5aaf0){var _0x5e7ea9=_[_0x3770('0x24')](_0xc5aaf0,function(_0x25b76e){return db[_0x3770('0x84')][_0x3770('0x85')]({'membername':_0x25b76e[_0x3770('0x2a')],'UserId':_0x25b76e['id'],'queue_name':_0x49e7ba[_0x3770('0x2a')],'VoiceQueueId':_0x49e7ba['id'],'interface':_[_0x3770('0x86')](_0x25b76e[_0x3770('0x83')])?util[_0x3770('0x87')](_0x3770('0x88'),_0x25b76e[_0x3770('0x2a')]):_0x25b76e[_0x3770('0x83')],'paused':_0x25b76e[_0x3770('0x89')]||![],'penalty':_0x49e7ba[_0x3770('0x7e')][_0x3770('0x7d')]},{'transaction':_0x5e92c7});});return Promise[_0x3770('0x8a')](_0x5e7ea9);});});});return Promise['all'](_0x585b27);});return Promise['all'](_0x4de965);})['then'](function(){return db[_0x3770('0x62')][_0x3770('0x66')]({'where':{'teamId':_0x3e8ffe}})[_0x3770('0x3b')](function(_0x406fe3){if(_0x406fe3){var _0x1da381=_[_0x3770('0x24')](_0xfcb596,function(_0x39bbe4){db[_0x3770('0x63')][_0x3770('0x85')]({'UserId':_0x39bbe4,'VoicePrefixId':_0x406fe3[_0x3770('0x64')]});});return Promise[_0x3770('0x8a')](_0x1da381);}});});});return Promise[_0x3770('0x8a')](_0x2cc940)[_0x3770('0x3b')](function(){return _0x49fca6[_0x3770('0x74')](_0xfcb596,{'transaction':_0x5e92c7})[_0x3770('0x8b')](function(_0x36fd76){return _0x36fd76;});});});}})[_0x3770('0x3b')](respondWithResult(_0x26d00a,null))[_0x3770('0x3f')](handleError(_0x26d00a,null));};exports[_0x3770('0x8c')]=function(_0xbdb20a,_0x511dd4){var _0x2b16ed=_['isArray'](_0xbdb20a[_0x3770('0x2b')]['ids'])?_0xbdb20a[_0x3770('0x2b')]['ids']:[_0xbdb20a['query'][_0x3770('0x71')]];var _0x331058=_0xbdb20a[_0x3770('0x4c')]['id'];return db['Team'][_0x3770('0x46')]({'where':{'id':_0x331058}})['then'](handleEntityNotFound(_0x511dd4,null))[_0x3770('0x3b')](function(_0x11cb69){if(_0x11cb69){var _0xb7eec7=[_0x3770('0x7c'),_0x3770('0x8d'),'Mail',_0x3770('0x77'),_0x3770('0x78'),'Openchannel','Whatsapp'];return db[_0x3770('0x4e')][_0x3770('0x7b')](function(_0x13587d){var _0x455d98=_[_0x3770('0x24')](_0xb7eec7,function(_0x300945){var _0x3b39e8={'attributes':['id','name']};return _0x11cb69[_0x3770('0x43')+_0x300945+'Queues'](_0x3b39e8)[_0x3770('0x3b')](function(_0x1d8834){var _0x549110=_[_0x3770('0x24')](_0x1d8834,function(_0x44256d){return _0x44256d[_0x3770('0x8c')](_0x2b16ed,{'transaction':_0x13587d})[_0x3770('0x3b')](function(){var _0x3e35d1=_[_0x3770('0x24')](_0x2b16ed,function(_0x2fd6cf){socket[_0x3770('0x8e')]('user'+_0x300945+_0x3770('0x8f'),{'UserId':Number(_0x2fd6cf),[_0x300945+_0x3770('0x90')]:_0x44256d['id']});if(_0x300945!==_0x3770('0x7c')){return;}return db['UserVoiceQueueRt'][_0x3770('0x4d')]({'where':{'VoiceQueueId':_0x44256d['id'],'UserId':_0x2fd6cf},'transaction':_0x13587d});});return Promise['all'](_0x3e35d1);});});return Promise['all'](_0x549110);});});return Promise['all'](_0x455d98)[_0x3770('0x3b')](function(){return _0x11cb69[_0x3770('0x8c')](_0x2b16ed,{'transaction':_0x13587d});})['then'](function(){return db[_0x3770('0x62')]['findOne']({'where':{'teamId':_0x331058}})[_0x3770('0x3b')](function(_0x15b58d){if(_0x15b58d){var _0x3c6650=_['map'](_0x2b16ed,function(_0x25e5b7){db[_0x3770('0x63')][_0x3770('0x4d')]({'where':{'UserId':_0x25e5b7,'VoicePrefixId':_0x15b58d[_0x3770('0x64')]}});});return Promise[_0x3770('0x8a')](_0x3c6650);}});});});}})[_0x3770('0x3b')](respondWithStatusCode(_0x511dd4,null))[_0x3770('0x3f')](handleError(_0x511dd4,null));};exports[_0x3770('0x91')]=function(_0x348cf8,_0x1c2c68,_0x21e671){var _0x326922={};var _0x9639cb={};var _0xa1cc4;var _0x53a68e;return db['Team'][_0x3770('0x66')]({'where':{'id':_0x348cf8[_0x3770('0x4c')]['id']}})[_0x3770('0x3b')](handleEntityNotFound(_0x1c2c68,null))[_0x3770('0x3b')](function(_0x814d5d){if(_0x814d5d){_0xa1cc4=_0x814d5d;_0x9639cb[_0x3770('0x2f')]=_[_0x3770('0x2c')](db[_0x3770('0x81')][_0x3770('0x26')]);_0x9639cb['query']=_[_0x3770('0x2c')](_0x348cf8['query']);_0x9639cb[_0x3770('0x2d')]=_[_0x3770('0x2e')](_0x9639cb[_0x3770('0x2f')],_0x9639cb[_0x3770('0x2b')]);_0x326922[_0x3770('0x30')]=_['intersection'](_0x9639cb[_0x3770('0x2f')],qs[_0x3770('0x31')](_0x348cf8[_0x3770('0x2b')][_0x3770('0x31')]));_0x326922['attributes']=_0x326922[_0x3770('0x30')][_0x3770('0x32')]?_0x326922[_0x3770('0x30')]:_0x9639cb[_0x3770('0x2f')];_0x326922['order']=qs[_0x3770('0x34')](_0x348cf8['query'][_0x3770('0x34')]);_0x326922[_0x3770('0x35')]=qs[_0x3770('0x2d')](_[_0x3770('0x36')](_0x348cf8[_0x3770('0x2b')],_0x9639cb[_0x3770('0x2d')]));if(_0x348cf8[_0x3770('0x2b')][_0x3770('0x37')]){_0x326922[_0x3770('0x35')]=_[_0x3770('0x39')](_0x326922['where'],{'$or':_['map'](_0x326922[_0x3770('0x30')],function(_0x3f4ec8){var _0x37464a={};_0x37464a[_0x3f4ec8]={'$like':'%'+_0x348cf8[_0x3770('0x2b')][_0x3770('0x37')]+'%'};return _0x37464a;})});}_0x326922=_['merge']({},_0x326922,_0x348cf8['options']);return _0xa1cc4[_0x3770('0x91')](_0x326922);}})[_0x3770('0x3b')](function(_0x12c6f8){if(_0x12c6f8){_0x53a68e=_0x12c6f8[_0x3770('0x32')];if(!_0x348cf8[_0x3770('0x2b')][_0x3770('0x92')]('nolimit')){_0x326922[_0x3770('0x1a')]=qs[_0x3770('0x1a')](_0x348cf8['query'][_0x3770('0x1a')]);_0x326922['offset']=qs[_0x3770('0x18')](_0x348cf8['query'][_0x3770('0x18')]);}return _0xa1cc4[_0x3770('0x91')](_0x326922);}})['then'](function(_0x53d02a){if(_0x53d02a){return _0x53d02a?{'count':_0x53a68e,'rows':_0x53d02a}:null;}})[_0x3770('0x3b')](respondWithResult(_0x1c2c68,null))[_0x3770('0x3f')](handleError(_0x1c2c68,null));}; \ No newline at end of file +var _0x2a06=['intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','find','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserId','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','UserOpenchannelQueue','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getQueues','findOne','isValidChannel','toLowerCase','Queue','order','pick','capitalize','channel','Queues','addQueues','ValidationError','Unknown\x20channel','add','ids','removeQueues','remove','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','Voice','TeamVoiceQueue','penalty','User','findOrCreate','emit','Queue:save','QueueId','online','voicePause','isNil','format','SIP/%s','interface','all','upsert','addAgents','spread','removeAgents','isArray','UserVoiceQueueRt','getAgents','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','defaults','localhost','socket.io-emitter','redis','./team.socket','register','sendStatus','status','end','offset','undefined','count','set','json','apply','save','update','then','stack','name','send','map','Team','rawAttributes','fieldName','type','model','query','keys'];(function(_0x152449,_0x49f41d){var _0x5b58b2=function(_0x226c30){while(--_0x226c30){_0x152449['push'](_0x152449['shift']());}};_0x5b58b2(++_0x49f41d);}(_0x2a06,0x1a2));var _0x62a0=function(_0x2da29f,_0x2f1bba){_0x2da29f=_0x2da29f-0x0;var _0x3b0a84=_0x2a06[_0x2da29f];return _0x3b0a84;};'use strict';var emlformat=require(_0x62a0('0x0'));var rimraf=require(_0x62a0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x62a0('0x2'));var rp=require(_0x62a0('0x3'));var moment=require('moment');var BPromise=require(_0x62a0('0x4'));var Mustache=require('mustache');var util=require(_0x62a0('0x5'));var path=require('path');var sox=require(_0x62a0('0x6'));var csv=require(_0x62a0('0x7'));var ejs=require(_0x62a0('0x8'));var fs=require('fs');var fs_extra=require(_0x62a0('0x9'));var _=require(_0x62a0('0xa'));var squel=require(_0x62a0('0xb'));var crypto=require(_0x62a0('0xc'));var jsforce=require(_0x62a0('0xd'));var deskjs=require(_0x62a0('0xe'));var toCsv=require(_0x62a0('0x7'));var querystring=require(_0x62a0('0xf'));var Papa=require('papaparse');var Redis=require(_0x62a0('0x10'));var authService=require(_0x62a0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x62a0('0x12'));var hardwareService=require(_0x62a0('0x13'));var logger=require(_0x62a0('0x14'))(_0x62a0('0x15'));var utils=require('../../config/utils');var config=require(_0x62a0('0x16'));var licenseUtil=require(_0x62a0('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x62a0('0x18')](config['redis'],{'host':_0x62a0('0x19'),'port':0x18eb});var socket=require(_0x62a0('0x1a'))(new Redis(config[_0x62a0('0x1b')]));require(_0x62a0('0x1c'))[_0x62a0('0x1d')](socket);function respondWithStatusCode(_0x2729b9,_0x5ac616){_0x5ac616=_0x5ac616||0xcc;return function(_0x4f2355){if(_0x4f2355){return _0x2729b9[_0x62a0('0x1e')](_0x5ac616);}return _0x2729b9[_0x62a0('0x1f')](_0x5ac616)[_0x62a0('0x20')]();};}function respondWithResult(_0x575f7f,_0x10ec23){_0x10ec23=_0x10ec23||0xc8;return function(_0x1dbcaa){if(_0x1dbcaa){return _0x575f7f[_0x62a0('0x1f')](_0x10ec23)['json'](_0x1dbcaa);}};}function respondWithFilteredResult(_0x5144b6,_0x52c417){return function(_0x4b25aa){if(_0x4b25aa){var _0x2e4358=typeof _0x52c417[_0x62a0('0x21')]===_0x62a0('0x22')&&typeof _0x52c417['limit']===_0x62a0('0x22');var _0x17076e=_0x4b25aa['count'];var _0x418a38=_0x2e4358?0x0:_0x52c417[_0x62a0('0x21')];var _0x1d21b2=_0x2e4358?_0x4b25aa[_0x62a0('0x23')]:_0x52c417['offset']+_0x52c417['limit'];var _0x472e7f;if(_0x1d21b2>=_0x17076e){_0x1d21b2=_0x17076e;_0x472e7f=0xc8;}else{_0x472e7f=0xce;}_0x5144b6[_0x62a0('0x1f')](_0x472e7f);return _0x5144b6[_0x62a0('0x24')]('Content-Range',_0x418a38+'-'+_0x1d21b2+'/'+_0x17076e)[_0x62a0('0x25')](_0x4b25aa);}return null;};}function patchUpdates(_0xeff190){return function(_0x447ab0){try{jsonpatch[_0x62a0('0x26')](_0x447ab0,_0xeff190,!![]);}catch(_0x3da50c){return BPromise['reject'](_0x3da50c);}return _0x447ab0[_0x62a0('0x27')]();};}function saveUpdates(_0x3636ac,_0x1f7609){return function(_0x53bea1){if(_0x53bea1){return _0x53bea1[_0x62a0('0x28')](_0x3636ac)[_0x62a0('0x29')](function(_0x577f57){return _0x577f57;});}return null;};}function handleEntityNotFound(_0xe912fe,_0x11a11f){return function(_0x1c5a71){if(!_0x1c5a71){_0xe912fe[_0x62a0('0x1e')](0x194);}return _0x1c5a71;};}function handleError(_0x5b5c1c,_0x3d40c2){_0x3d40c2=_0x3d40c2||0x1f4;return function(_0x56672d){logger['error'](_0x56672d[_0x62a0('0x2a')]);if(_0x56672d[_0x62a0('0x2b')]){delete _0x56672d[_0x62a0('0x2b')];}_0x5b5c1c[_0x62a0('0x1f')](_0x3d40c2)[_0x62a0('0x2c')](_0x56672d);};}exports['index']=function(_0x1861c9,_0x47f8f8){var _0x5c41d7={},_0x4d0906={},_0x358596={'count':0x0,'rows':[]};var _0x167e7a=_[_0x62a0('0x2d')](db[_0x62a0('0x2e')][_0x62a0('0x2f')],function(_0x448c04){return{'name':_0x448c04[_0x62a0('0x30')],'type':_0x448c04[_0x62a0('0x31')]['key']};});_0x4d0906[_0x62a0('0x32')]=_[_0x62a0('0x2d')](_0x167e7a,_0x62a0('0x2b'));_0x4d0906[_0x62a0('0x33')]=_[_0x62a0('0x34')](_0x1861c9[_0x62a0('0x33')]);_0x4d0906['filters']=_[_0x62a0('0x35')](_0x4d0906[_0x62a0('0x32')],_0x4d0906[_0x62a0('0x33')]);_0x5c41d7[_0x62a0('0x36')]=_[_0x62a0('0x35')](_0x4d0906[_0x62a0('0x32')],qs[_0x62a0('0x37')](_0x1861c9[_0x62a0('0x33')][_0x62a0('0x37')]));_0x5c41d7[_0x62a0('0x36')]=_0x5c41d7[_0x62a0('0x36')][_0x62a0('0x38')]?_0x5c41d7[_0x62a0('0x36')]:_0x4d0906['model'];if(!_0x1861c9['query'][_0x62a0('0x39')]('nolimit')){_0x5c41d7['limit']=qs[_0x62a0('0x3a')](_0x1861c9[_0x62a0('0x33')][_0x62a0('0x3a')]);_0x5c41d7['offset']=qs[_0x62a0('0x21')](_0x1861c9[_0x62a0('0x33')][_0x62a0('0x21')]);}_0x5c41d7['order']=qs[_0x62a0('0x3b')](_0x1861c9['query']['sort']);_0x5c41d7[_0x62a0('0x3c')]=qs[_0x62a0('0x3d')](_['pick'](_0x1861c9[_0x62a0('0x33')],_0x4d0906[_0x62a0('0x3d')]),_0x167e7a);if(_0x1861c9[_0x62a0('0x33')][_0x62a0('0x3e')]){_0x5c41d7['where']=_['merge'](_0x5c41d7['where'],{'$or':_[_0x62a0('0x2d')](_0x167e7a,function(_0x48199d){if(_0x48199d[_0x62a0('0x31')]!==_0x62a0('0x3f')){var _0x14733c={};_0x14733c[_0x48199d['name']]={'$like':'%'+_0x1861c9['query']['filter']+'%'};return _0x14733c;}})});}_0x5c41d7=_[_0x62a0('0x40')]({},_0x5c41d7,_0x1861c9[_0x62a0('0x41')]);var _0xf907cc={'where':_0x5c41d7[_0x62a0('0x3c')]};return db[_0x62a0('0x2e')]['count'](_0xf907cc)[_0x62a0('0x29')](function(_0x34b51d){_0x358596[_0x62a0('0x23')]=_0x34b51d;if(_0x1861c9[_0x62a0('0x33')][_0x62a0('0x42')]){_0x5c41d7[_0x62a0('0x43')]=[{'all':!![]}];}return db[_0x62a0('0x2e')][_0x62a0('0x44')](_0x5c41d7);})[_0x62a0('0x29')](function(_0x306c6d){_0x358596[_0x62a0('0x45')]=_0x306c6d;return _0x358596;})[_0x62a0('0x29')](respondWithFilteredResult(_0x47f8f8,_0x5c41d7))[_0x62a0('0x46')](handleError(_0x47f8f8,null));};exports[_0x62a0('0x47')]=function(_0x1adb97,_0x251d04){var _0x4a1288={'raw':![],'where':{'id':_0x1adb97[_0x62a0('0x48')]['id']}},_0x38c50f={};_0x38c50f[_0x62a0('0x32')]=_[_0x62a0('0x34')](db[_0x62a0('0x2e')][_0x62a0('0x2f')]);_0x38c50f[_0x62a0('0x33')]=_[_0x62a0('0x34')](_0x1adb97[_0x62a0('0x33')]);_0x38c50f['filters']=_[_0x62a0('0x35')](_0x38c50f[_0x62a0('0x32')],_0x38c50f['query']);_0x4a1288[_0x62a0('0x36')]=_[_0x62a0('0x35')](_0x38c50f[_0x62a0('0x32')],qs['fields'](_0x1adb97[_0x62a0('0x33')][_0x62a0('0x37')]));_0x4a1288[_0x62a0('0x36')]=_0x4a1288[_0x62a0('0x36')][_0x62a0('0x38')]?_0x4a1288[_0x62a0('0x36')]:_0x38c50f['model'];if(_0x1adb97[_0x62a0('0x33')]['includeAll']){_0x4a1288['include']=[{'all':!![]}];}_0x4a1288=_[_0x62a0('0x40')]({},_0x4a1288,_0x1adb97[_0x62a0('0x41')]);return db[_0x62a0('0x2e')]['find'](_0x4a1288)[_0x62a0('0x29')](handleEntityNotFound(_0x251d04,null))['then'](respondWithResult(_0x251d04,null))[_0x62a0('0x46')](handleError(_0x251d04,null));};exports['create']=function(_0x42682e,_0x5c80b0){return db['Team'][_0x62a0('0x49')](_0x42682e['body'],{})[_0x62a0('0x29')](function(_0xb148b6){var _0x1921f9=_0x42682e[_0x62a0('0x4a')][_0x62a0('0x4b')]({'plain':!![]});if(!_0x1921f9)throw new Error(_0x62a0('0x4c'));if(_0x1921f9[_0x62a0('0x4d')]===_0x62a0('0x4a')){var _0x242457=_0xb148b6[_0x62a0('0x4b')]({'plain':!![]});var _0x158430=_0x62a0('0x4e');return db[_0x62a0('0x4f')][_0x62a0('0x50')]({'where':{'name':_0x158430,'userProfileId':_0x1921f9[_0x62a0('0x51')]},'raw':!![]})['then'](function(_0x6ba22d){if(_0x6ba22d&&_0x6ba22d['autoAssociation']===0x0){return db[_0x62a0('0x52')][_0x62a0('0x49')]({'name':_0x242457[_0x62a0('0x2b')],'resourceId':_0x242457['id'],'type':_0x6ba22d[_0x62a0('0x2b')],'sectionId':_0x6ba22d['id']},{})['then'](function(){return _0xb148b6;});}else{return _0xb148b6;}})[_0x62a0('0x46')](function(_0x5a6280){logger[_0x62a0('0x53')](_0x62a0('0x54'),_0x5a6280);throw _0x5a6280;});}return _0xb148b6;})[_0x62a0('0x29')](respondWithResult(_0x5c80b0,0xc9))[_0x62a0('0x46')](handleError(_0x5c80b0,null));};exports[_0x62a0('0x28')]=function(_0x25632d,_0x23ba12){if(_0x25632d[_0x62a0('0x55')]['id']){delete _0x25632d[_0x62a0('0x55')]['id'];}return db[_0x62a0('0x2e')][_0x62a0('0x50')]({'where':{'id':_0x25632d[_0x62a0('0x48')]['id']}})['then'](handleEntityNotFound(_0x23ba12,null))[_0x62a0('0x29')](saveUpdates(_0x25632d['body'],null))[_0x62a0('0x29')](respondWithResult(_0x23ba12,null))[_0x62a0('0x46')](handleError(_0x23ba12,null));};exports[_0x62a0('0x56')]=function(_0x151001,_0x13d20d){var _0x28c7a4=_0x151001[_0x62a0('0x48')]['id'];var _0x24b01c=[];return db[_0x62a0('0x57')][_0x62a0('0x58')](function(_0x156c68){var _0x498ce3=_0x62a0('0x59')+_0x28c7a4;return db[_0x62a0('0x57')]['query'](_0x498ce3,{'type':db[_0x62a0('0x5a')][_0x62a0('0x5b')][_0x62a0('0x5c')],'raw':!![],'transaction':_0x156c68})[_0x62a0('0x29')](function(_0x59369b){_0x24b01c=_[_0x62a0('0x2d')](_0x59369b,function(_0x1460e3){return Number(_0x1460e3[_0x62a0('0x5d')]);});})[_0x62a0('0x29')](function(){var _0x405e75='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x28c7a4;return db[_0x62a0('0x57')][_0x62a0('0x33')](_0x405e75,{'type':db[_0x62a0('0x5a')][_0x62a0('0x5b')]['SELECT'],'raw':!![],'transaction':_0x156c68});})[_0x62a0('0x29')](function(_0x1f5b78){var _0x55daf4=_[_0x62a0('0x2d')](_0x1f5b78,function(_0x353942){return Number(_0x353942[_0x62a0('0x5e')]);});return db[_0x62a0('0x5f')][_0x62a0('0x56')]({'where':{'UserId':{'$in':_0x24b01c},'VoiceQueueId':{'$in':_0x55daf4}},'transaction':_0x156c68});})['then'](function(){var _0x4052c1=_0x62a0('0x60')+_0x28c7a4;return db['sequelize'][_0x62a0('0x33')](_0x4052c1,{'type':db['Sequelize']['QueryTypes'][_0x62a0('0x5c')],'raw':!![],'transaction':_0x156c68});})[_0x62a0('0x29')](function(_0x555fba){var _0x364609=_['map'](_0x555fba,function(_0xd32508){return Number(_0xd32508[_0x62a0('0x61')]);});return db['UserMailQueue'][_0x62a0('0x56')]({'where':{'UserId':{'$in':_0x24b01c},'MailQueueId':{'$in':_0x364609}},'transaction':_0x156c68});})[_0x62a0('0x29')](function(){var _0x351c7d=_0x62a0('0x62')+_0x28c7a4;return db[_0x62a0('0x57')]['query'](_0x351c7d,{'type':db[_0x62a0('0x5a')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x156c68});})['then'](function(_0xf333da){var _0x378ac2=_[_0x62a0('0x2d')](_0xf333da,function(_0x35ad29){return Number(_0x35ad29['SmsQueueId']);});return db['UserSmsQueue']['destroy']({'where':{'UserId':{'$in':_0x24b01c},'SmsQueueId':{'$in':_0x378ac2}},'transaction':_0x156c68});})[_0x62a0('0x29')](function(){var _0x2c1eb5=_0x62a0('0x63')+_0x28c7a4;return db[_0x62a0('0x57')]['query'](_0x2c1eb5,{'type':db[_0x62a0('0x5a')]['QueryTypes'][_0x62a0('0x5c')],'raw':!![],'transaction':_0x156c68});})['then'](function(_0xb1e86d){var _0x4972f1=_[_0x62a0('0x2d')](_0xb1e86d,function(_0x239498){return Number(_0x239498[_0x62a0('0x64')]);});return db[_0x62a0('0x65')][_0x62a0('0x56')]({'where':{'UserId':{'$in':_0x24b01c},'ChatQueueId':{'$in':_0x4972f1}},'transaction':_0x156c68});})[_0x62a0('0x29')](function(){var _0x580e82=_0x62a0('0x66')+_0x28c7a4;return db[_0x62a0('0x57')][_0x62a0('0x33')](_0x580e82,{'type':db['Sequelize'][_0x62a0('0x5b')][_0x62a0('0x5c')],'raw':!![],'transaction':_0x156c68});})[_0x62a0('0x29')](function(_0x5881f3){var _0xb432c1=_['map'](_0x5881f3,function(_0x5e5bf6){return Number(_0x5e5bf6[_0x62a0('0x67')]);});return db[_0x62a0('0x68')]['destroy']({'where':{'UserId':{'$in':_0x24b01c},'FaxQueueId':{'$in':_0xb432c1}},'transaction':_0x156c68});})[_0x62a0('0x29')](function(){var _0xef5ef8=_0x62a0('0x69')+_0x28c7a4;return db[_0x62a0('0x57')][_0x62a0('0x33')](_0xef5ef8,{'type':db[_0x62a0('0x5a')][_0x62a0('0x5b')][_0x62a0('0x5c')],'raw':!![],'transaction':_0x156c68});})[_0x62a0('0x29')](function(_0x40b6c5){var _0x28248c=_[_0x62a0('0x2d')](_0x40b6c5,function(_0x5bfba7){return Number(_0x5bfba7['OpenchannelQueueId']);});return db[_0x62a0('0x6a')][_0x62a0('0x56')]({'where':{'UserId':{'$in':_0x24b01c},'OpenchannelQueueId':{'$in':_0x28248c}},'transaction':_0x156c68});})[_0x62a0('0x29')](function(){var _0x313caf='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x28c7a4;return db[_0x62a0('0x57')][_0x62a0('0x33')](_0x313caf,{'type':db['Sequelize']['QueryTypes'][_0x62a0('0x5c')],'raw':!![],'transaction':_0x156c68});})['then'](function(_0x428a5d){var _0x415e4d=_['map'](_0x428a5d,function(_0x5b733b){return Number(_0x5b733b[_0x62a0('0x6b')]);});return db[_0x62a0('0x6c')][_0x62a0('0x56')]({'where':{'UserId':{'$in':_0x24b01c},'WhatsappQueueId':{'$in':_0x415e4d}},'transaction':_0x156c68});})[_0x62a0('0x29')](function(){return db[_0x62a0('0x6d')][_0x62a0('0x50')]({'where':{'TeamId':_0x28c7a4}});})[_0x62a0('0x29')](function(_0x1c1eb9){if(_0x1c1eb9===null){return;}return db[_0x62a0('0x6e')]['destroy']({'where':{'UserId':{'$in':_0x24b01c},'VoicePrefixId':_0x1c1eb9[_0x62a0('0x6f')]},'transaction':_0x156c68});})[_0x62a0('0x29')](function(){return db[_0x62a0('0x2e')]['destroy']({'where':{'id':_0x28c7a4},'cascade':!![],'transaction':_0x156c68});})[_0x62a0('0x29')](function(_0x44c7c4){if(_0x44c7c4===0x0){_0x13d20d[_0x62a0('0x1e')](0x194);}else{return db['UserProfileResource'][_0x62a0('0x56')]({'where':{'type':'Teams','resourceId':_0x28c7a4},'cascade':!![],'transaction':_0x156c68})[_0x62a0('0x29')](function(){_0x13d20d[_0x62a0('0x1f')](0xcc)['end']();});}})['catch'](function(_0x49f7b3){_0x13d20d['status'](0x1f4)['send'](_0x49f7b3);});});};exports[_0x62a0('0x70')]=function(_0x5e1010,_0x3c2bfb,_0x3d85e3){return db[_0x62a0('0x2e')][_0x62a0('0x71')]({'where':{'id':_0x5e1010[_0x62a0('0x48')]['id']}})[_0x62a0('0x29')](handleEntityNotFound(_0x3c2bfb,null))[_0x62a0('0x29')](function(_0x593fcd){if(!_0x5e1010[_0x62a0('0x33')]['channel']||!utils[_0x62a0('0x72')](_0x5e1010[_0x62a0('0x33')]['channel'])){throw new db['Sequelize']['ValidationError']('Unknown\x20channel');}var _0x5aca1a={};var _0x16994e={};_0x16994e['model']=_[_0x62a0('0x34')](db[_['capitalize'](_0x5e1010[_0x62a0('0x33')]['channel'][_0x62a0('0x73')]())+_0x62a0('0x74')][_0x62a0('0x2f')]);_0x16994e[_0x62a0('0x33')]=_[_0x62a0('0x34')](_0x5e1010['query']);_0x16994e[_0x62a0('0x3d')]=_['intersection'](_0x16994e[_0x62a0('0x32')],_0x16994e[_0x62a0('0x33')]);_0x5aca1a[_0x62a0('0x36')]=_[_0x62a0('0x35')](_0x16994e[_0x62a0('0x32')],qs[_0x62a0('0x37')](_0x5e1010[_0x62a0('0x33')][_0x62a0('0x37')]));_0x5aca1a[_0x62a0('0x36')]=_0x5aca1a['attributes']['length']?_0x5aca1a[_0x62a0('0x36')]:_0x16994e['model'];_0x5aca1a[_0x62a0('0x3a')]=qs[_0x62a0('0x3a')](_0x5e1010['query'][_0x62a0('0x3a')]);_0x5aca1a[_0x62a0('0x21')]=qs[_0x62a0('0x21')](_0x5e1010[_0x62a0('0x33')][_0x62a0('0x21')]);_0x5aca1a[_0x62a0('0x75')]=qs[_0x62a0('0x3b')](_0x5e1010[_0x62a0('0x33')][_0x62a0('0x3b')]);_0x5aca1a[_0x62a0('0x3c')]=qs['filters'](_[_0x62a0('0x76')](_0x5e1010['query'],_0x16994e[_0x62a0('0x3d')]));_0x5aca1a=_[_0x62a0('0x40')]({},_0x5aca1a,_0x5e1010[_0x62a0('0x41')]);return _0x593fcd[_0x62a0('0x4b')+_[_0x62a0('0x77')](_0x5e1010[_0x62a0('0x33')][_0x62a0('0x78')][_0x62a0('0x73')]())+_0x62a0('0x79')](_0x5aca1a);})[_0x62a0('0x29')](respondWithResult(_0x3c2bfb,null))[_0x62a0('0x46')](handleError(_0x3c2bfb,null));};exports[_0x62a0('0x7a')]=function(_0x1fee0f,_0x83f822,_0x11a421){return db[_0x62a0('0x2e')][_0x62a0('0x71')]({'where':{'id':_0x1fee0f[_0x62a0('0x48')]['id']}})['then'](function(_0x417b4b){if(_0x417b4b){if(!_0x1fee0f['body'][_0x62a0('0x78')]||!utils[_0x62a0('0x72')](_0x1fee0f[_0x62a0('0x55')]['channel'])){throw new db['Sequelize'][(_0x62a0('0x7b'))](_0x62a0('0x7c'));}return _0x417b4b[_0x62a0('0x7d')+_[_0x62a0('0x77')](_0x1fee0f[_0x62a0('0x55')][_0x62a0('0x78')][_0x62a0('0x73')]())+_0x62a0('0x79')](_0x1fee0f[_0x62a0('0x55')][_0x62a0('0x7e')]);}return null;})['then'](handleEntityNotFound(_0x83f822,null))[_0x62a0('0x29')](respondWithStatusCode(_0x83f822,null))[_0x62a0('0x46')](handleError(_0x83f822,null));};exports[_0x62a0('0x7f')]=function(_0x11e4de,_0x3af900,_0x2fb1ac){return db[_0x62a0('0x2e')]['findOne']({'where':{'id':_0x11e4de[_0x62a0('0x48')]['id']}})['then'](function(_0x30bc3b){if(_0x30bc3b){if(!_0x11e4de[_0x62a0('0x33')][_0x62a0('0x78')]||!utils[_0x62a0('0x72')](_0x11e4de[_0x62a0('0x33')]['channel'])){throw new db['Sequelize'][(_0x62a0('0x7b'))](_0x62a0('0x7c'));}return _0x30bc3b[_0x62a0('0x80')+_[_0x62a0('0x77')](_0x11e4de['query'][_0x62a0('0x78')][_0x62a0('0x73')]())+'Queues'](_0x11e4de[_0x62a0('0x33')][_0x62a0('0x7e')]);}return null;})['then'](handleEntityNotFound(_0x3af900,null))[_0x62a0('0x29')](respondWithStatusCode(_0x3af900,null))['catch'](handleError(_0x3af900,null));};exports['addAgents']=function(_0x581720,_0x33ac17){var _0x5a8262=_['isArray'](_0x581720[_0x62a0('0x55')][_0x62a0('0x7e')])?_0x581720[_0x62a0('0x55')]['ids']:[_0x581720['body']['ids']];var _0x1629bc=_0x581720['params']['id'];return db[_0x62a0('0x2e')][_0x62a0('0x50')]({'where':{'id':_0x1629bc}})[_0x62a0('0x29')](handleEntityNotFound(_0x33ac17,null))[_0x62a0('0x29')](function(_0x479cb3){if(_0x479cb3){var _0x3e0672=['Voice',_0x62a0('0x81'),_0x62a0('0x82'),_0x62a0('0x83'),_0x62a0('0x84'),_0x62a0('0x85'),_0x62a0('0x86')];return db[_0x62a0('0x57')][_0x62a0('0x58')](function(_0x3007ab){var _0x1d813a=_[_0x62a0('0x2d')](_0x3e0672,function(_0x51c964){var _0x4fc9a8={'attributes':['id',_0x62a0('0x2b')]};if(_0x51c964===_0x62a0('0x87')){_0x4fc9a8['through']={'attributes':['penalty']};}return _0x479cb3[_0x62a0('0x4b')+_0x51c964+_0x62a0('0x79')](_0x4fc9a8)[_0x62a0('0x29')](function(_0x45cd8b){var _0x4908a4=_[_0x62a0('0x2d')](_0x45cd8b,function(_0x54fb65){var _0x6b5817=_[_0x62a0('0x2d')](_0x5a8262,function(_0x181f4c){var _0x6df270={'where':{'UserId':_0x181f4c,[_0x51c964+'QueueId']:_0x54fb65['id']},'transaction':_0x3007ab};if(_0x51c964===_0x62a0('0x87')){_0x6df270['defaults']={'penalty':_0x54fb65[_0x62a0('0x88')][_0x62a0('0x89')]};}return db[_0x62a0('0x8a')+_0x51c964+_0x62a0('0x74')][_0x62a0('0x8b')](_0x6df270)[_0x62a0('0x29')](function(){socket[_0x62a0('0x8c')](_0x62a0('0x4a')+_0x51c964+_0x62a0('0x8d'),{'UserId':_0x181f4c,[_0x51c964+_0x62a0('0x8e')]:_0x54fb65['id']});if(_0x51c964!==_0x62a0('0x87')){return;}return db[_0x62a0('0x8a')]['findAll']({'where':{'id':_0x5a8262,'online':0x1},'attributes':['id',_0x62a0('0x2b'),_0x62a0('0x8f'),_0x62a0('0x90'),'interface'],'raw':!![]})['then'](function(_0x2d5b3d){var _0x453578=_['map'](_0x2d5b3d,function(_0x5e5473){return db['UserVoiceQueueRt']['upsert']({'membername':_0x5e5473['name'],'UserId':_0x5e5473['id'],'queue_name':_0x54fb65['name'],'VoiceQueueId':_0x54fb65['id'],'interface':_[_0x62a0('0x91')](_0x5e5473['interface'])?util[_0x62a0('0x92')](_0x62a0('0x93'),_0x5e5473[_0x62a0('0x2b')]):_0x5e5473[_0x62a0('0x94')],'paused':_0x5e5473[_0x62a0('0x90')]||![],'penalty':_0x54fb65['TeamVoiceQueue']['penalty']},{'transaction':_0x3007ab});});return Promise[_0x62a0('0x95')](_0x453578);});});});return Promise[_0x62a0('0x95')](_0x6b5817);});return Promise[_0x62a0('0x95')](_0x4908a4);})[_0x62a0('0x29')](function(){return db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0x1629bc}})['then'](function(_0x51427a){if(_0x51427a){var _0x106514=_[_0x62a0('0x2d')](_0x5a8262,function(_0x11a2c8){db[_0x62a0('0x6e')][_0x62a0('0x96')]({'UserId':_0x11a2c8,'VoicePrefixId':_0x51427a['VoicePrefixId']});});return Promise[_0x62a0('0x95')](_0x106514);}});});});return Promise[_0x62a0('0x95')](_0x1d813a)[_0x62a0('0x29')](function(){return _0x479cb3[_0x62a0('0x97')](_0x5a8262,{'transaction':_0x3007ab})[_0x62a0('0x98')](function(_0x1cc535){return _0x1cc535;});});});}})[_0x62a0('0x29')](respondWithResult(_0x33ac17,null))[_0x62a0('0x46')](handleError(_0x33ac17,null));};exports[_0x62a0('0x99')]=function(_0x1562d2,_0x3060d7){var _0x2d7fea=_[_0x62a0('0x9a')](_0x1562d2[_0x62a0('0x33')]['ids'])?_0x1562d2[_0x62a0('0x33')][_0x62a0('0x7e')]:[_0x1562d2[_0x62a0('0x33')]['ids']];var _0x43ad7b=_0x1562d2[_0x62a0('0x48')]['id'];return db['Team']['find']({'where':{'id':_0x43ad7b}})[_0x62a0('0x29')](handleEntityNotFound(_0x3060d7,null))['then'](function(_0x30620a){if(_0x30620a){var _0x4dfc8e=[_0x62a0('0x87'),_0x62a0('0x81'),_0x62a0('0x82'),'Sms',_0x62a0('0x84'),_0x62a0('0x85'),_0x62a0('0x86')];return db[_0x62a0('0x57')][_0x62a0('0x58')](function(_0x153512){var _0x223435=_[_0x62a0('0x2d')](_0x4dfc8e,function(_0x5ca6f2){var _0x5dbdb4={'attributes':['id',_0x62a0('0x2b')]};return _0x30620a[_0x62a0('0x4b')+_0x5ca6f2+_0x62a0('0x79')](_0x5dbdb4)['then'](function(_0x19d0e1){var _0x31e4c5=_[_0x62a0('0x2d')](_0x19d0e1,function(_0x1bc5a7){return _0x1bc5a7['removeAgents'](_0x2d7fea,{'transaction':_0x153512})[_0x62a0('0x29')](function(){var _0x16a478=_[_0x62a0('0x2d')](_0x2d7fea,function(_0x13d100){socket[_0x62a0('0x8c')](_0x62a0('0x4a')+_0x5ca6f2+'Queue:remove',{'UserId':Number(_0x13d100),[_0x5ca6f2+'QueueId']:_0x1bc5a7['id']});if(_0x5ca6f2!==_0x62a0('0x87')){return;}return db[_0x62a0('0x9b')][_0x62a0('0x56')]({'where':{'VoiceQueueId':_0x1bc5a7['id'],'UserId':_0x13d100},'transaction':_0x153512});});return Promise[_0x62a0('0x95')](_0x16a478);});});return Promise[_0x62a0('0x95')](_0x31e4c5);});});return Promise['all'](_0x223435)[_0x62a0('0x29')](function(){return _0x30620a[_0x62a0('0x99')](_0x2d7fea,{'transaction':_0x153512});})['then'](function(){return db[_0x62a0('0x6d')][_0x62a0('0x71')]({'where':{'teamId':_0x43ad7b}})[_0x62a0('0x29')](function(_0x31f884){if(_0x31f884){var _0x265c48=_[_0x62a0('0x2d')](_0x2d7fea,function(_0x1c1f34){db[_0x62a0('0x6e')][_0x62a0('0x56')]({'where':{'UserId':_0x1c1f34,'VoicePrefixId':_0x31f884[_0x62a0('0x6f')]}});});return Promise[_0x62a0('0x95')](_0x265c48);}});});});}})[_0x62a0('0x29')](respondWithStatusCode(_0x3060d7,null))[_0x62a0('0x46')](handleError(_0x3060d7,null));};exports['getAgents']=function(_0xefbffc,_0x5b57b6,_0x20af73){var _0x5d20e0={};var _0x4470e6={};var _0x41d654;var _0x2ab786;return db[_0x62a0('0x2e')][_0x62a0('0x71')]({'where':{'id':_0xefbffc[_0x62a0('0x48')]['id']}})[_0x62a0('0x29')](handleEntityNotFound(_0x5b57b6,null))[_0x62a0('0x29')](function(_0x2e0428){if(_0x2e0428){_0x41d654=_0x2e0428;_0x4470e6[_0x62a0('0x32')]=_[_0x62a0('0x34')](db[_0x62a0('0x8a')][_0x62a0('0x2f')]);_0x4470e6[_0x62a0('0x33')]=_[_0x62a0('0x34')](_0xefbffc[_0x62a0('0x33')]);_0x4470e6['filters']=_[_0x62a0('0x35')](_0x4470e6['model'],_0x4470e6['query']);_0x5d20e0[_0x62a0('0x36')]=_[_0x62a0('0x35')](_0x4470e6[_0x62a0('0x32')],qs[_0x62a0('0x37')](_0xefbffc[_0x62a0('0x33')][_0x62a0('0x37')]));_0x5d20e0[_0x62a0('0x36')]=_0x5d20e0[_0x62a0('0x36')]['length']?_0x5d20e0[_0x62a0('0x36')]:_0x4470e6[_0x62a0('0x32')];_0x5d20e0['order']=qs['sort'](_0xefbffc['query'][_0x62a0('0x3b')]);_0x5d20e0[_0x62a0('0x3c')]=qs[_0x62a0('0x3d')](_[_0x62a0('0x76')](_0xefbffc[_0x62a0('0x33')],_0x4470e6[_0x62a0('0x3d')]));if(_0xefbffc[_0x62a0('0x33')][_0x62a0('0x3e')]){_0x5d20e0[_0x62a0('0x3c')]=_[_0x62a0('0x40')](_0x5d20e0[_0x62a0('0x3c')],{'$or':_[_0x62a0('0x2d')](_0x5d20e0[_0x62a0('0x36')],function(_0x3fc8d2){var _0x1225d4={};_0x1225d4[_0x3fc8d2]={'$like':'%'+_0xefbffc['query'][_0x62a0('0x3e')]+'%'};return _0x1225d4;})});}_0x5d20e0=_[_0x62a0('0x40')]({},_0x5d20e0,_0xefbffc[_0x62a0('0x41')]);return _0x41d654['getAgents'](_0x5d20e0);}})['then'](function(_0x453f08){if(_0x453f08){_0x2ab786=_0x453f08[_0x62a0('0x38')];if(!_0xefbffc[_0x62a0('0x33')][_0x62a0('0x39')]('nolimit')){_0x5d20e0[_0x62a0('0x3a')]=qs[_0x62a0('0x3a')](_0xefbffc['query']['limit']);_0x5d20e0[_0x62a0('0x21')]=qs[_0x62a0('0x21')](_0xefbffc[_0x62a0('0x33')]['offset']);}return _0x41d654[_0x62a0('0x9c')](_0x5d20e0);}})['then'](function(_0x28beb2){if(_0x28beb2){return _0x28beb2?{'count':_0x2ab786,'rows':_0x28beb2}:null;}})[_0x62a0('0x29')](respondWithResult(_0x5b57b6,null))[_0x62a0('0x46')](handleError(_0x5b57b6,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 3adda5e..5280bda 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 _0x6bfe=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team','setMaxListeners','save','update','remove'];(function(_0x2c5268,_0xd7eca7){var _0x68f319=function(_0x2815fd){while(--_0x2815fd){_0x2c5268['push'](_0x2c5268['shift']());}};_0x68f319(++_0xd7eca7);}(_0x6bfe,0x185));var _0xe6bf=function(_0x4dcfe3,_0x4f0618){_0x4dcfe3=_0x4dcfe3-0x0;var _0xd4c55=_0x6bfe[_0x4dcfe3];return _0xd4c55;};'use strict';var EventEmitter=require(_0xe6bf('0x0'));var Team=require(_0xe6bf('0x1'))['db'][_0xe6bf('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xe6bf('0x3')](0x0);var events={'afterCreate':_0xe6bf('0x4'),'afterUpdate':_0xe6bf('0x5'),'afterDestroy':_0xe6bf('0x6')};function emitEvent(_0x439bb0){return function(_0x171966,_0x46b040,_0x3484b0){TeamEvents[_0xe6bf('0x7')](_0x439bb0+':'+_0x171966['id'],_0x171966);TeamEvents['emit'](_0x439bb0,_0x171966);_0x3484b0(null);};}for(var e in events){if(events[_0xe6bf('0x8')](e)){var event=events[e];Team[_0xe6bf('0x9')](e,emitEvent(event));}}module[_0xe6bf('0xa')]=TeamEvents; \ No newline at end of file +var _0xe510=['emit','hasOwnProperty','exports','events','../../mysqldb','Team','save','update'];(function(_0x5ad70b,_0x308a10){var _0x11a670=function(_0x2ad636){while(--_0x2ad636){_0x5ad70b['push'](_0x5ad70b['shift']());}};_0x11a670(++_0x308a10);}(_0xe510,0x6b));var _0x0e51=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xe510[_0x12fc8d];return _0x3f9d04;};'use strict';var EventEmitter=require(_0x0e51('0x0'));var Team=require(_0x0e51('0x1'))['db'][_0x0e51('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0e51('0x3'),'afterUpdate':_0x0e51('0x4'),'afterDestroy':'remove'};function emitEvent(_0x35ad94){return function(_0x4169bb,_0x43fd90,_0xd48654){TeamEvents[_0x0e51('0x5')](_0x35ad94+':'+_0x4169bb['id'],_0x4169bb);TeamEvents[_0x0e51('0x5')](_0x35ad94,_0x4169bb);_0xd48654(null);};}for(var e in events){if(events[_0x0e51('0x6')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x0e51('0x7')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index c7cd19f..38e9ab4 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 _0xf273=['map','setDataValue','channel','catch','exports','define','Team','teams','Fax','Mail','Sms','Voice','Whatsapp','resolve','all','./team.attributes','Queues','then'];(function(_0x567f76,_0x14e6fd){var _0x55061c=function(_0x6c145b){while(--_0x6c145b){_0x567f76['push'](_0x567f76['shift']());}};_0x55061c(++_0x14e6fd);}(_0xf273,0x19b));var _0x3f27=function(_0x552fb5,_0x51fa13){_0x552fb5=_0x552fb5-0x0;var _0x10a203=_0xf273[_0x552fb5];return _0x10a203;};'use strict';var _=require('lodash');var attributes=require(_0x3f27('0x0'));function getQueuesByChannel(_0x104a33,_0x319392){var _0x2e9dc2='get'+_0x319392+_0x3f27('0x1');return _0x104a33[_0x2e9dc2]()[_0x3f27('0x2')](function(_0x3ced26){return _[_0x3f27('0x3')](_0x3ced26,function(_0x36c0c7){_0x36c0c7[_0x3f27('0x4')](_0x3f27('0x5'),_0x319392);return _0x36c0c7;});})[_0x3f27('0x6')](function(_0x36f977){throw _0x36f977;});}module[_0x3f27('0x7')]=function(_0x236b73){return _0x236b73[_0x3f27('0x8')](_0x3f27('0x9'),attributes,{'tableName':_0x3f27('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x2d028f=this;var _0x496094=['Chat',_0x3f27('0xb'),_0x3f27('0xc'),'Openchannel',_0x3f27('0xd'),_0x3f27('0xe'),_0x3f27('0xf')];return Promise[_0x3f27('0x10')]()[_0x3f27('0x2')](function(){var _0x249712=_['map'](_0x496094,function(_0x56f80f){return getQueuesByChannel(_0x2d028f,_0x56f80f);});return Promise[_0x3f27('0x11')](_0x249712);})[_0x3f27('0x6')](function(_0x27f968){throw _0x27f968;});}}});}; \ No newline at end of file +var _0xb048=['resolve','all','get','then','map','catch','define','teams','Chat','Fax','Openchannel','Voice'];(function(_0x34c519,_0x4b45da){var _0x7efb32=function(_0x22a56a){while(--_0x22a56a){_0x34c519['push'](_0x34c519['shift']());}};_0x7efb32(++_0x4b45da);}(_0xb048,0x15e));var _0x8b04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb048[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var attributes=require('./team.attributes');function getQueuesByChannel(_0xc38971,_0x41d033){var _0x30a032=_0x8b04('0x0')+_0x41d033+'Queues';return _0xc38971[_0x30a032]()[_0x8b04('0x1')](function(_0x56853f){return _[_0x8b04('0x2')](_0x56853f,function(_0x2f2981){_0x2f2981['setDataValue']('channel',_0x41d033);return _0x2f2981;});})[_0x8b04('0x3')](function(_0xa8bc98){throw _0xa8bc98;});}module['exports']=function(_0x5e334d){return _0x5e334d[_0x8b04('0x4')]('Team',attributes,{'tableName':_0x8b04('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x25ba03=this;var _0xe33378=[_0x8b04('0x6'),_0x8b04('0x7'),'Mail',_0x8b04('0x8'),'Sms',_0x8b04('0x9'),'Whatsapp'];return Promise[_0x8b04('0xa')]()[_0x8b04('0x1')](function(){var _0xec75de=_[_0x8b04('0x2')](_0xe33378,function(_0x1f3ae6){return getQueuesByChannel(_0x25ba03,_0x1f3ae6);});return Promise[_0x8b04('0xb')](_0xec75de);})[_0x8b04('0x3')](function(_0x35ba79){throw _0x35ba79;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index e46c267..9fc9c1d 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 _0x328d=['../../mysqldb','../../config/logger','jayson/promise','client','redis','localhost','socket.io-emitter','register','request','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','bluebird','randomstring','ioredis'];(function(_0x492ce0,_0x474c65){var _0x17a696=function(_0x246049){while(--_0x246049){_0x492ce0['push'](_0x492ce0['shift']());}};_0x17a696(++_0x474c65);}(_0x328d,0xf8));var _0xd328=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x328d[_0x1da527];return _0x40fc7c;};'use strict';var _=require(_0xd328('0x0'));var util=require(_0xd328('0x1'));var moment=require('moment');var BPromise=require(_0xd328('0x2'));var rs=require(_0xd328('0x3'));var fs=require('fs');var Redis=require(_0xd328('0x4'));var db=require(_0xd328('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd328('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd328('0x7'));var client=jayson[_0xd328('0x8')]['http']({'port':0x232a});config[_0xd328('0x9')]=_['defaults'](config[_0xd328('0x9')],{'host':_0xd328('0xa'),'port':0x18eb});var socket=require(_0xd328('0xb'))(new Redis(config[_0xd328('0x9')]));require('./team.socket')[_0xd328('0xc')](socket);function respondWithRpcPromise(_0x475c41,_0x5d36fe,_0x5cc22e){return new BPromise(function(_0x195277,_0x50ffd2){return client[_0xd328('0xd')](_0x475c41,_0x5cc22e)['then'](function(_0x127cea){logger[_0xd328('0xe')](_0xd328('0xf'),_0x5d36fe,_0xd328('0x10'));logger[_0xd328('0x11')](_0xd328('0x12'),_0x5d36fe,_0xd328('0x10'),JSON['stringify'](_0x127cea));if(_0x127cea[_0xd328('0x13')]){if(_0x127cea[_0xd328('0x13')][_0xd328('0x14')]===0x1f4){logger[_0xd328('0x13')]('Team,\x20%s,\x20%s',_0x5d36fe,_0x127cea[_0xd328('0x13')][_0xd328('0x15')]);return _0x50ffd2(_0x127cea['error'][_0xd328('0x15')]);}logger[_0xd328('0x13')](_0xd328('0xf'),_0x5d36fe,_0x127cea['error'][_0xd328('0x15')]);return _0x195277(_0x127cea[_0xd328('0x13')][_0xd328('0x15')]);}else{logger[_0xd328('0xe')]('Team,\x20%s,\x20%s',_0x5d36fe,'request\x20sent');_0x195277(_0x127cea[_0xd328('0x16')][_0xd328('0x15')]);}})['catch'](function(_0x53f66b){logger[_0xd328('0x13')](_0xd328('0xf'),_0x5d36fe,_0x53f66b);_0x50ffd2(_0x53f66b);});});} \ No newline at end of file +var _0x0b19=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','./team.socket','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x4625ce,_0x55986a){var _0x5d5e26=function(_0x14e834){while(--_0x14e834){_0x4625ce['push'](_0x4625ce['shift']());}};_0x5d5e26(++_0x55986a);}(_0x0b19,0x190));var _0x90b1=function(_0x5d9675,_0xdceabd){_0x5d9675=_0x5d9675-0x0;var _0x1fd2f6=_0x0b19[_0x5d9675];return _0x1fd2f6;};'use strict';var _=require('lodash');var util=require(_0x90b1('0x0'));var moment=require(_0x90b1('0x1'));var BPromise=require('bluebird');var rs=require(_0x90b1('0x2'));var fs=require('fs');var Redis=require(_0x90b1('0x3'));var db=require(_0x90b1('0x4'))['db'];var utils=require(_0x90b1('0x5'));var logger=require(_0x90b1('0x6'))('rpc');var config=require(_0x90b1('0x7'));var jayson=require(_0x90b1('0x8'));var client=jayson['client'][_0x90b1('0x9')]({'port':0x232a});config[_0x90b1('0xa')]=_['defaults'](config[_0x90b1('0xa')],{'host':_0x90b1('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x90b1('0xa')]));require(_0x90b1('0xc'))['register'](socket);function respondWithRpcPromise(_0x3e0177,_0x59c8f9,_0x2be798){return new BPromise(function(_0x4893fd,_0xd1cec9){return client[_0x90b1('0xd')](_0x3e0177,_0x2be798)[_0x90b1('0xe')](function(_0x16f26d){logger[_0x90b1('0xf')](_0x90b1('0x10'),_0x59c8f9,_0x90b1('0x11'));logger[_0x90b1('0x12')](_0x90b1('0x13'),_0x59c8f9,_0x90b1('0x11'),JSON['stringify'](_0x16f26d));if(_0x16f26d[_0x90b1('0x14')]){if(_0x16f26d[_0x90b1('0x14')][_0x90b1('0x15')]===0x1f4){logger[_0x90b1('0x14')](_0x90b1('0x10'),_0x59c8f9,_0x16f26d[_0x90b1('0x14')]['message']);return _0xd1cec9(_0x16f26d['error'][_0x90b1('0x16')]);}logger[_0x90b1('0x14')](_0x90b1('0x10'),_0x59c8f9,_0x16f26d[_0x90b1('0x14')]['message']);return _0x4893fd(_0x16f26d[_0x90b1('0x14')][_0x90b1('0x16')]);}else{logger[_0x90b1('0xf')](_0x90b1('0x10'),_0x59c8f9,'request\x20sent');_0x4893fd(_0x16f26d[_0x90b1('0x17')][_0x90b1('0x16')]);}})[_0x90b1('0x18')](function(_0x2471ea){logger[_0x90b1('0x14')](_0x90b1('0x10'),_0x59c8f9,_0x2471ea);_0xd1cec9(_0x2471ea);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 283ab2f..a4a9ec9 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 _0x63cf=['remove','update','removeListener','register','team:','./team.events','save'];(function(_0x4b0f64,_0x4a6dca){var _0x4fcad4=function(_0x5ac61f){while(--_0x5ac61f){_0x4b0f64['push'](_0x4b0f64['shift']());}};_0x4fcad4(++_0x4a6dca);}(_0x63cf,0xc9));var _0xf63c=function(_0xf26c2e,_0x56c3ea){_0xf26c2e=_0xf26c2e-0x0;var _0x46ecb4=_0x63cf[_0xf26c2e];return _0x46ecb4;};'use strict';var TeamEvents=require(_0xf63c('0x0'));var events=[_0xf63c('0x1'),_0xf63c('0x2'),_0xf63c('0x3')];function createListener(_0x112d53,_0x34b27e){return function(_0x1e5162){_0x34b27e['emit'](_0x112d53,_0x1e5162);};}function removeListener(_0x1aa7fd,_0x5844c1){return function(){TeamEvents[_0xf63c('0x4')](_0x1aa7fd,_0x5844c1);};}exports[_0xf63c('0x5')]=function(_0x30da33){for(var _0x2fe800=0x0,_0x6be9b2=events['length'];_0x2fe800<_0x6be9b2;_0x2fe800++){var _0x339935=events[_0x2fe800];var _0x3ba6cc=createListener(_0xf63c('0x6')+_0x339935,_0x30da33);TeamEvents['on'](_0x339935,_0x3ba6cc);}}; \ No newline at end of file +var _0x56dc=['team:','./team.events','remove','update','removeListener','register','length'];(function(_0x4f6e1a,_0x579259){var _0x49b458=function(_0x4b5a61){while(--_0x4b5a61){_0x4f6e1a['push'](_0x4f6e1a['shift']());}};_0x49b458(++_0x579259);}(_0x56dc,0xfd));var _0xc56d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x56dc[_0x3dd15e];return _0x231fd0;};'use strict';var TeamEvents=require(_0xc56d('0x0'));var events=['save',_0xc56d('0x1'),_0xc56d('0x2')];function createListener(_0x1bb6ec,_0x11e58b){return function(_0x1cfc0f){_0x11e58b['emit'](_0x1bb6ec,_0x1cfc0f);};}function removeListener(_0x2ffdfe,_0x2e7620){return function(){TeamEvents[_0xc56d('0x3')](_0x2ffdfe,_0x2e7620);};}exports[_0xc56d('0x4')]=function(_0x3eb4ed){for(var _0x3e68f4=0x0,_0x571341=events[_0xc56d('0x5')];_0x3e68f4<_0x571341;_0x3e68f4++){var _0x24b556=events[_0x3e68f4];var _0x3ac7cd=createListener(_0xc56d('0x6')+_0x24b556,_0x3eb4ed);TeamEvents['on'](_0x24b556,_0x3ac7cd);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 253c363..dedd50a 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 _0x950a=['sequelize','exports','INTEGER'];(function(_0x445f2b,_0x4662ef){var _0x59278e=function(_0x4233ad){while(--_0x4233ad){_0x445f2b['push'](_0x445f2b['shift']());}};_0x59278e(++_0x4662ef);}(_0x950a,0x174));var _0xa950=function(_0x4665b2,_0x5f8f90){_0x4665b2=_0x4665b2-0x0;var _0x239ea7=_0x950a[_0x4665b2];return _0x239ea7;};'use strict';var Sequelize=require(_0xa950('0x0'));module[_0xa950('0x1')]={'TeamId':{'type':Sequelize[_0xa950('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x24b3=['INTEGER','sequelize','exports'];(function(_0x7e6c4c,_0x4768c0){var _0x51ec6b=function(_0x444d53){while(--_0x444d53){_0x7e6c4c['push'](_0x7e6c4c['shift']());}};_0x51ec6b(++_0x4768c0);}(_0x24b3,0xd3));var _0x324b=function(_0x4248e0,_0x1d3b1d){_0x4248e0=_0x4248e0-0x0;var _0x5c44f1=_0x24b3[_0x4248e0];return _0x5c44f1;};'use strict';var Sequelize=require(_0x324b('0x0'));module[_0x324b('0x1')]={'TeamId':{'type':Sequelize[_0x324b('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index fb4eba1..4ac75f6 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 _0x6f59=['../../config/environment','./teamVoicePrefix.attributes','exports','TeamVoicePrefix','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x30659a,_0x7f34a5){var _0x49cd65=function(_0x5a716a){while(--_0x5a716a){_0x30659a['push'](_0x30659a['shift']());}};_0x49cd65(++_0x7f34a5);}(_0x6f59,0x1be));var _0x96f5=function(_0x2d2750,_0x4d1da6){_0x2d2750=_0x2d2750-0x0;var _0x24c699=_0x6f59[_0x2d2750];return _0x24c699;};'use strict';var _=require(_0x96f5('0x0'));var util=require(_0x96f5('0x1'));var logger=require(_0x96f5('0x2'))(_0x96f5('0x3'));var moment=require(_0x96f5('0x4'));var BPromise=require(_0x96f5('0x5'));var rp=require(_0x96f5('0x6'));var fs=require('fs');var path=require(_0x96f5('0x7'));var rimraf=require(_0x96f5('0x8'));var config=require(_0x96f5('0x9'));var attributes=require(_0x96f5('0xa'));module[_0x96f5('0xb')]=function(_0x598154,_0xf6cd7d){return _0x598154['define'](_0x96f5('0xc'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee4e=['./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0xee4e,0x122));var _0xeee4=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0xee4e[_0x50007c];return _0x5c1ec7;};'use strict';var _=require(_0xeee4('0x0'));var util=require(_0xeee4('0x1'));var logger=require(_0xeee4('0x2'))('api');var moment=require(_0xeee4('0x3'));var BPromise=require(_0xeee4('0x4'));var rp=require(_0xeee4('0x5'));var fs=require('fs');var path=require(_0xeee4('0x6'));var rimraf=require(_0xeee4('0x7'));var config=require(_0xeee4('0x8'));var attributes=require(_0xeee4('0x9'));module[_0xeee4('0xa')]=function(_0x5564f7,_0xcf3bbd){return _0x5564f7[_0xeee4('0xb')](_0xeee4('0xc'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 0129616..dfb0ede 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x31a505,_0x6b435b){var _0x287b14=function(_0xce36ad){while(--_0xce36ad){_0x31a505['push'](_0x31a505['shift']());}};_0x287b14(++_0x6b435b);}(_0xedd9,0xfc));var _0x9edd=function(_0x5a8c89,_0x210289){_0x5a8c89=_0x5a8c89-0x0;var _0x1b8a9f=_0xedd9[_0x5a8c89];return _0x1b8a9f;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x177e72,_0x28bf32){var _0x392698=function(_0x45a052){while(--_0x45a052){_0x177e72['push'](_0x177e72['shift']());}};_0x392698(++_0x28bf32);}(_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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index d403634..6831afa 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 _0x143e=['exports','sequelize'];(function(_0x970068,_0x3e4142){var _0x51063d=function(_0x32b30e){while(--_0x32b30e){_0x970068['push'](_0x970068['shift']());}};_0x51063d(++_0x3e4142);}(_0x143e,0xdf));var _0xe143=function(_0x3b6939,_0xb65e69){_0x3b6939=_0x3b6939-0x0;var _0xc9f654=_0x143e[_0x3b6939];return _0xc9f654;};'use strict';var Sequelize=require(_0xe143('0x0'));module[_0xe143('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xe341=['sequelize','INTEGER'];(function(_0x1999b3,_0x14aaf6){var _0x31a31a=function(_0x326679){while(--_0x326679){_0x1999b3['push'](_0x1999b3['shift']());}};_0x31a31a(++_0x14aaf6);}(_0xe341,0x18c));var _0x1e34=function(_0x248f6a,_0x54db0b){_0x248f6a=_0x248f6a-0x0;var _0x151dd0=_0xe341[_0x248f6a];return _0x151dd0;};'use strict';var Sequelize=require(_0x1e34('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x1e34('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 557e1f4..c1e8afd 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 _0x851d=['bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','define','TeamVoiceQueue','team_has_voice_queues','lodash','../../config/logger','api'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0x851d,0x69));var _0xd851=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x851d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd851('0x0'));var util=require('util');var logger=require(_0xd851('0x1'))(_0xd851('0x2'));var moment=require('moment');var BPromise=require(_0xd851('0x3'));var rp=require(_0xd851('0x4'));var fs=require('fs');var path=require(_0xd851('0x5'));var rimraf=require(_0xd851('0x6'));var config=require(_0xd851('0x7'));var attributes=require(_0xd851('0x8'));module['exports']=function(_0x578809,_0x1fff93){return _0x578809[_0xd851('0x9')](_0xd851('0xa'),attributes,{'tableName':_0xd851('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6737=['../../config/environment','./teamVoiceQueue.attributes','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x47c725,_0x2ebe05){var _0x35cc43=function(_0x10ca71){while(--_0x10ca71){_0x47c725['push'](_0x47c725['shift']());}};_0x35cc43(++_0x2ebe05);}(_0x6737,0xe2));var _0x7673=function(_0x2ebbb8,_0x4431c9){_0x2ebbb8=_0x2ebbb8-0x0;var _0x254e15=_0x6737[_0x2ebbb8];return _0x254e15;};'use strict';var _=require('lodash');var util=require(_0x7673('0x0'));var logger=require(_0x7673('0x1'))('api');var moment=require(_0x7673('0x2'));var BPromise=require(_0x7673('0x3'));var rp=require(_0x7673('0x4'));var fs=require('fs');var path=require(_0x7673('0x5'));var rimraf=require('rimraf');var config=require(_0x7673('0x6'));var attributes=require(_0x7673('0x7'));module['exports']=function(_0x2f5edc,_0x15230f){return _0x2f5edc['define']('TeamVoiceQueue',attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index ee0bf27..95371d4 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 _0x25e4=['../../config/environment','http','then','info','request\x20sent','debug','stringify','error','code','TeamVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x7ee493,_0x2cc2cb){var _0x1f2c25=function(_0x243745){while(--_0x243745){_0x7ee493['push'](_0x7ee493['shift']());}};_0x1f2c25(++_0x2cc2cb);}(_0x25e4,0x10a));var _0x425e=function(_0x3af4ad,_0x90cec1){_0x3af4ad=_0x3af4ad-0x0;var _0x2f447e=_0x25e4[_0x3af4ad];return _0x2f447e;};'use strict';var _=require(_0x425e('0x0'));var util=require(_0x425e('0x1'));var moment=require(_0x425e('0x2'));var BPromise=require(_0x425e('0x3'));var rs=require(_0x425e('0x4'));var fs=require('fs');var Redis=require(_0x425e('0x5'));var db=require(_0x425e('0x6'))['db'];var utils=require(_0x425e('0x7'));var logger=require(_0x425e('0x8'))(_0x425e('0x9'));var config=require(_0x425e('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x425e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3568ca,_0x2bf2e1,_0x4bd169){return new BPromise(function(_0x547850,_0xa62524){return client['request'](_0x3568ca,_0x4bd169)[_0x425e('0xc')](function(_0x901ec3){logger[_0x425e('0xd')]('TeamVoiceQueue,\x20%s,\x20%s',_0x2bf2e1,_0x425e('0xe'));logger[_0x425e('0xf')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x2bf2e1,_0x425e('0xe'),JSON[_0x425e('0x10')](_0x901ec3));if(_0x901ec3[_0x425e('0x11')]){if(_0x901ec3[_0x425e('0x11')][_0x425e('0x12')]===0x1f4){logger[_0x425e('0x11')](_0x425e('0x13'),_0x2bf2e1,_0x901ec3['error']['message']);return _0xa62524(_0x901ec3[_0x425e('0x11')][_0x425e('0x14')]);}logger[_0x425e('0x11')](_0x425e('0x13'),_0x2bf2e1,_0x901ec3['error'][_0x425e('0x14')]);return _0x547850(_0x901ec3[_0x425e('0x11')][_0x425e('0x14')]);}else{logger[_0x425e('0xd')](_0x425e('0x13'),_0x2bf2e1,_0x425e('0xe'));_0x547850(_0x901ec3[_0x425e('0x15')]['message']);}})[_0x425e('0x16')](function(_0x2935f2){logger[_0x425e('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x2bf2e1,_0x2935f2);_0xa62524(_0x2935f2);});});} \ No newline at end of file +var _0xb56b=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x434804,_0x415f68){var _0x573fc8=function(_0x3ce265){while(--_0x3ce265){_0x434804['push'](_0x434804['shift']());}};_0x573fc8(++_0x415f68);}(_0xb56b,0xdc));var _0xbb56=function(_0x2638d0,_0x52f653){_0x2638d0=_0x2638d0-0x0;var _0x411a60=_0xb56b[_0x2638d0];return _0x411a60;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbb56('0x0'));var BPromise=require(_0xbb56('0x1'));var rs=require(_0xbb56('0x2'));var fs=require('fs');var Redis=require(_0xbb56('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb56('0x4'));var logger=require(_0xbb56('0x5'))('rpc');var config=require(_0xbb56('0x6'));var jayson=require(_0xbb56('0x7'));var client=jayson[_0xbb56('0x8')][_0xbb56('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x24a583,_0x475f03,_0x3107a5){return new BPromise(function(_0x4615fe,_0x5c8c9a){return client['request'](_0x24a583,_0x3107a5)[_0xbb56('0xa')](function(_0x3f659e){logger['info'](_0xbb56('0xb'),_0x475f03,_0xbb56('0xc'));logger[_0xbb56('0xd')](_0xbb56('0xe'),_0x475f03,'request\x20sent',JSON[_0xbb56('0xf')](_0x3f659e));if(_0x3f659e[_0xbb56('0x10')]){if(_0x3f659e[_0xbb56('0x10')][_0xbb56('0x11')]===0x1f4){logger[_0xbb56('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x475f03,_0x3f659e[_0xbb56('0x10')][_0xbb56('0x12')]);return _0x5c8c9a(_0x3f659e[_0xbb56('0x10')][_0xbb56('0x12')]);}logger[_0xbb56('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x475f03,_0x3f659e[_0xbb56('0x10')][_0xbb56('0x12')]);return _0x4615fe(_0x3f659e[_0xbb56('0x10')][_0xbb56('0x12')]);}else{logger[_0xbb56('0x13')](_0xbb56('0xb'),_0x475f03,'request\x20sent');_0x4615fe(_0x3f659e[_0xbb56('0x14')]['message']);}})[_0xbb56('0x15')](function(_0x190e8e){logger[_0xbb56('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x475f03,_0x190e8e);_0x5c8c9a(_0x190e8e);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index baaaf10..37ad6e1 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 _0xf811=['show','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id'];(function(_0x1e2f5b,_0x60bf47){var _0x2bb7bc=function(_0x1ddf91){while(--_0x1ddf91){_0x1e2f5b['push'](_0x1e2f5b['shift']());}};_0x2bb7bc(++_0x60bf47);}(_0xf811,0x6f));var _0x1f81=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0xf811[_0x381589];return _0x2a075d;};'use strict';var multer=require(_0x1f81('0x0'));var util=require(_0x1f81('0x1'));var path=require(_0x1f81('0x2'));var timeout=require(_0x1f81('0x3'));var express=require(_0x1f81('0x4'));var router=express[_0x1f81('0x5')]();var fs_extra=require(_0x1f81('0x6'));var auth=require(_0x1f81('0x7'));var interaction=require(_0x1f81('0x8'));var config=require(_0x1f81('0x9'));var controller=require(_0x1f81('0xa'));router[_0x1f81('0xb')]('/',auth[_0x1f81('0xc')](),controller[_0x1f81('0xd')]);router['get'](_0x1f81('0xe'),auth[_0x1f81('0xc')](),controller[_0x1f81('0xf')]);router['post']('/',auth[_0x1f81('0xc')](),controller[_0x1f81('0x10')]);router['put'](_0x1f81('0xe'),auth['isAuthenticated'](),controller[_0x1f81('0x11')]);router[_0x1f81('0x12')](_0x1f81('0xe'),auth[_0x1f81('0xc')](),controller[_0x1f81('0x13')]);module[_0x1f81('0x14')]=router; \ No newline at end of file +var _0xd9eb=['../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0xbd53d6,_0x53f8d9){var _0x1dc607=function(_0x11a292){while(--_0x11a292){_0xbd53d6['push'](_0xbd53d6['shift']());}};_0x1dc607(++_0x53f8d9);}(_0xd9eb,0xca));var _0xbd9e=function(_0x4b1475,_0x41bf4c){_0x4b1475=_0x4b1475-0x0;var _0x3153e6=_0xd9eb[_0x4b1475];return _0x3153e6;};'use strict';var multer=require(_0xbd9e('0x0'));var util=require(_0xbd9e('0x1'));var path=require(_0xbd9e('0x2'));var timeout=require(_0xbd9e('0x3'));var express=require(_0xbd9e('0x4'));var router=express[_0xbd9e('0x5')]();var fs_extra=require(_0xbd9e('0x6'));var auth=require(_0xbd9e('0x7'));var interaction=require(_0xbd9e('0x8'));var config=require(_0xbd9e('0x9'));var controller=require(_0xbd9e('0xa'));router[_0xbd9e('0xb')]('/',auth[_0xbd9e('0xc')](),controller['index']);router[_0xbd9e('0xb')](_0xbd9e('0xd'),auth[_0xbd9e('0xc')](),controller[_0xbd9e('0xe')]);router[_0xbd9e('0xf')]('/',auth[_0xbd9e('0xc')](),controller[_0xbd9e('0x10')]);router[_0xbd9e('0x11')](_0xbd9e('0xd'),auth[_0xbd9e('0xc')](),controller[_0xbd9e('0x12')]);router[_0xbd9e('0x13')]('/:id',auth[_0xbd9e('0xc')](),controller[_0xbd9e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index ed1f579..2ae6165 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 _0xc891=['TEXT','sequelize','STRING'];(function(_0x548568,_0x38b789){var _0x3a8c75=function(_0x3d7cfd){while(--_0x3d7cfd){_0x548568['push'](_0x548568['shift']());}};_0x3a8c75(++_0x38b789);}(_0xc891,0x1ea));var _0x1c89=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xc891[_0x110c3d];return _0x226d67;};'use strict';var Sequelize=require(_0x1c89('0x0'));module['exports']={'name':{'type':Sequelize[_0x1c89('0x1')]},'description':{'type':Sequelize[_0x1c89('0x1')]},'html':{'type':Sequelize[_0x1c89('0x2')]}}; \ No newline at end of file +var _0xc2a5=['sequelize','exports','STRING'];(function(_0x2ea26d,_0x49f40f){var _0x596837=function(_0x59a595){while(--_0x59a595){_0x2ea26d['push'](_0x2ea26d['shift']());}};_0x596837(++_0x49f40f);}(_0xc2a5,0x1a1));var _0x5c2a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc2a5[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x5c2a('0x0'));module[_0x5c2a('0x1')]={'name':{'type':Sequelize[_0x5c2a('0x2')]},'description':{'type':Sequelize[_0x5c2a('0x2')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index a4a7c6e..9fd1909 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 _0x8d73=['reject','save','update','destroy','then','get','Templates','name','send','index','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','sort','filters','pick','where','merge','VIRTUAL','filter','Template','includeAll','include','findAll','catch','show','keys','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x485e81,_0x124192){var _0x14cf22=function(_0x4fe35e){while(--_0x4fe35e){_0x485e81['push'](_0x485e81['shift']());}};_0x14cf22(++_0x124192);}(_0x8d73,0x11c));var _0x38d7=function(_0xb3fdb5,_0x2e1c8f){_0xb3fdb5=_0xb3fdb5-0x0;var _0x3fb4f9=_0x8d73[_0xb3fdb5];return _0x3fb4f9;};'use strict';var emlformat=require(_0x38d7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x38d7('0x1'));var jsonpatch=require(_0x38d7('0x2'));var rp=require(_0x38d7('0x3'));var moment=require(_0x38d7('0x4'));var BPromise=require(_0x38d7('0x5'));var Mustache=require(_0x38d7('0x6'));var util=require('util');var path=require(_0x38d7('0x7'));var sox=require(_0x38d7('0x8'));var csv=require(_0x38d7('0x9'));var ejs=require(_0x38d7('0xa'));var fs=require('fs');var fs_extra=require(_0x38d7('0xb'));var _=require(_0x38d7('0xc'));var squel=require(_0x38d7('0xd'));var crypto=require('crypto');var jsforce=require(_0x38d7('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x38d7('0xf'));var Papa=require(_0x38d7('0x10'));var Redis=require(_0x38d7('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x38d7('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x38d7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x38d7('0x14'))['db'];function respondWithStatusCode(_0x22c04f,_0x58c82d){_0x58c82d=_0x58c82d||0xcc;return function(_0x5ca24e){if(_0x5ca24e){return _0x22c04f[_0x38d7('0x15')](_0x58c82d);}return _0x22c04f[_0x38d7('0x16')](_0x58c82d)[_0x38d7('0x17')]();};}function respondWithResult(_0x24bb0d,_0x45b55d){_0x45b55d=_0x45b55d||0xc8;return function(_0x55e296){if(_0x55e296){return _0x24bb0d['status'](_0x45b55d)[_0x38d7('0x18')](_0x55e296);}};}function respondWithFilteredResult(_0x3ff2a4,_0x40d847){return function(_0x4fc152){if(_0x4fc152){var _0x483cfd=typeof _0x40d847[_0x38d7('0x19')]===_0x38d7('0x1a')&&typeof _0x40d847[_0x38d7('0x1b')]===_0x38d7('0x1a');var _0x35269b=_0x4fc152[_0x38d7('0x1c')];var _0x2329d9=_0x483cfd?0x0:_0x40d847[_0x38d7('0x19')];var _0x57910b=_0x483cfd?_0x4fc152[_0x38d7('0x1c')]:_0x40d847[_0x38d7('0x19')]+_0x40d847[_0x38d7('0x1b')];var _0xd280d0;if(_0x57910b>=_0x35269b){_0x57910b=_0x35269b;_0xd280d0=0xc8;}else{_0xd280d0=0xce;}_0x3ff2a4['status'](_0xd280d0);return _0x3ff2a4[_0x38d7('0x1d')](_0x38d7('0x1e'),_0x2329d9+'-'+_0x57910b+'/'+_0x35269b)[_0x38d7('0x18')](_0x4fc152);}return null;};}function patchUpdates(_0x38da16){return function(_0x90f50f){try{jsonpatch[_0x38d7('0x1f')](_0x90f50f,_0x38da16,!![]);}catch(_0x45e177){return BPromise[_0x38d7('0x20')](_0x45e177);}return _0x90f50f[_0x38d7('0x21')]();};}function saveUpdates(_0x193a6f,_0xd181f){return function(_0x4dcf38){if(_0x4dcf38){return _0x4dcf38[_0x38d7('0x22')](_0x193a6f)['then'](function(_0x364fe3){return _0x364fe3;});}return null;};}function removeEntity(_0x5a00c6,_0x55454f){return function(_0x551bab){if(_0x551bab){return _0x551bab[_0x38d7('0x23')]()[_0x38d7('0x24')](function(){var _0x261ef5=_0x551bab[_0x38d7('0x25')]({'plain':!![]});var _0x3f5529=_0x38d7('0x26');return db['UserProfileResource'][_0x38d7('0x23')]({'where':{'type':_0x3f5529,'resourceId':_0x261ef5['id']}})[_0x38d7('0x24')](function(){return _0x551bab;});})['then'](function(){_0x5a00c6[_0x38d7('0x16')](0xcc)[_0x38d7('0x17')]();});}};}function handleEntityNotFound(_0x40c322,_0x270998){return function(_0x1715f8){if(!_0x1715f8){_0x40c322[_0x38d7('0x15')](0x194);}return _0x1715f8;};}function handleError(_0x2845a0,_0x5e034b){_0x5e034b=_0x5e034b||0x1f4;return function(_0xf27160){logger['error'](_0xf27160['stack']);if(_0xf27160[_0x38d7('0x27')]){delete _0xf27160[_0x38d7('0x27')];}_0x2845a0['status'](_0x5e034b)[_0x38d7('0x28')](_0xf27160);};}exports[_0x38d7('0x29')]=function(_0x386454,_0x28ad0c){var _0x450fe4={},_0x2417f7={},_0x31b0b3={'count':0x0,'rows':[]};var _0x4b22db=_['map'](db['Template'][_0x38d7('0x2a')],function(_0x3cd8b1){return{'name':_0x3cd8b1[_0x38d7('0x2b')],'type':_0x3cd8b1[_0x38d7('0x2c')][_0x38d7('0x2d')]};});_0x2417f7[_0x38d7('0x2e')]=_[_0x38d7('0x2f')](_0x4b22db,'name');_0x2417f7[_0x38d7('0x30')]=_['keys'](_0x386454[_0x38d7('0x30')]);_0x2417f7['filters']=_[_0x38d7('0x31')](_0x2417f7[_0x38d7('0x2e')],_0x2417f7[_0x38d7('0x30')]);_0x450fe4[_0x38d7('0x32')]=_[_0x38d7('0x31')](_0x2417f7[_0x38d7('0x2e')],qs['fields'](_0x386454[_0x38d7('0x30')][_0x38d7('0x33')]));_0x450fe4[_0x38d7('0x32')]=_0x450fe4[_0x38d7('0x32')][_0x38d7('0x34')]?_0x450fe4[_0x38d7('0x32')]:_0x2417f7[_0x38d7('0x2e')];if(!_0x386454[_0x38d7('0x30')][_0x38d7('0x35')]('nolimit')){_0x450fe4['limit']=qs[_0x38d7('0x1b')](_0x386454['query']['limit']);_0x450fe4['offset']=qs[_0x38d7('0x19')](_0x386454[_0x38d7('0x30')][_0x38d7('0x19')]);}_0x450fe4['order']=qs[_0x38d7('0x36')](_0x386454[_0x38d7('0x30')][_0x38d7('0x36')]);_0x450fe4['where']=qs[_0x38d7('0x37')](_[_0x38d7('0x38')](_0x386454[_0x38d7('0x30')],_0x2417f7[_0x38d7('0x37')]),_0x4b22db);if(_0x386454['query']['filter']){_0x450fe4[_0x38d7('0x39')]=_[_0x38d7('0x3a')](_0x450fe4[_0x38d7('0x39')],{'$or':_[_0x38d7('0x2f')](_0x4b22db,function(_0x5afac6){if(_0x5afac6[_0x38d7('0x2c')]!==_0x38d7('0x3b')){var _0x1475f2={};_0x1475f2[_0x5afac6[_0x38d7('0x27')]]={'$like':'%'+_0x386454[_0x38d7('0x30')][_0x38d7('0x3c')]+'%'};return _0x1475f2;}})});}_0x450fe4=_['merge']({},_0x450fe4,_0x386454['options']);var _0x14a004={'where':_0x450fe4['where']};return db[_0x38d7('0x3d')][_0x38d7('0x1c')](_0x14a004)['then'](function(_0x466e2a){_0x31b0b3['count']=_0x466e2a;if(_0x386454[_0x38d7('0x30')][_0x38d7('0x3e')]){_0x450fe4[_0x38d7('0x3f')]=[{'all':!![]}];}return db[_0x38d7('0x3d')][_0x38d7('0x40')](_0x450fe4);})['then'](function(_0x33ce73){_0x31b0b3['rows']=_0x33ce73;return _0x31b0b3;})[_0x38d7('0x24')](respondWithFilteredResult(_0x28ad0c,_0x450fe4))[_0x38d7('0x41')](handleError(_0x28ad0c,null));};exports[_0x38d7('0x42')]=function(_0x44359d,_0x588b56){var _0x2c079c={'raw':!![],'where':{'id':_0x44359d['params']['id']}},_0x4a54c5={};_0x4a54c5[_0x38d7('0x2e')]=_[_0x38d7('0x43')](db[_0x38d7('0x3d')]['rawAttributes']);_0x4a54c5[_0x38d7('0x30')]=_[_0x38d7('0x43')](_0x44359d['query']);_0x4a54c5[_0x38d7('0x37')]=_['intersection'](_0x4a54c5['model'],_0x4a54c5[_0x38d7('0x30')]);_0x2c079c[_0x38d7('0x32')]=_[_0x38d7('0x31')](_0x4a54c5['model'],qs['fields'](_0x44359d['query'][_0x38d7('0x33')]));_0x2c079c['attributes']=_0x2c079c[_0x38d7('0x32')]['length']?_0x2c079c['attributes']:_0x4a54c5[_0x38d7('0x2e')];if(_0x44359d[_0x38d7('0x30')][_0x38d7('0x3e')]){_0x2c079c['include']=[{'all':!![]}];}_0x2c079c=_[_0x38d7('0x3a')]({},_0x2c079c,_0x44359d['options']);return db[_0x38d7('0x3d')][_0x38d7('0x44')](_0x2c079c)[_0x38d7('0x24')](handleEntityNotFound(_0x588b56,null))[_0x38d7('0x24')](respondWithResult(_0x588b56,null))[_0x38d7('0x41')](handleError(_0x588b56,null));};exports[_0x38d7('0x45')]=function(_0x2ca22c,_0x29d36f){return db[_0x38d7('0x3d')][_0x38d7('0x45')](_0x2ca22c[_0x38d7('0x46')],{})['then'](function(_0x45e92c){var _0x4171eb=_0x2ca22c[_0x38d7('0x47')][_0x38d7('0x25')]({'plain':!![]});if(!_0x4171eb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4171eb[_0x38d7('0x48')]==='user'){var _0x4eea5d=_0x45e92c[_0x38d7('0x25')]({'plain':!![]});var _0x2e8cf4=_0x38d7('0x26');return db[_0x38d7('0x49')][_0x38d7('0x44')]({'where':{'name':_0x2e8cf4,'userProfileId':_0x4171eb[_0x38d7('0x4a')]},'raw':!![]})[_0x38d7('0x24')](function(_0x2f7cd4){if(_0x2f7cd4&&_0x2f7cd4[_0x38d7('0x4b')]===0x0){return db[_0x38d7('0x4c')][_0x38d7('0x45')]({'name':_0x4eea5d[_0x38d7('0x27')],'resourceId':_0x4eea5d['id'],'type':_0x2f7cd4[_0x38d7('0x27')],'sectionId':_0x2f7cd4['id']},{})[_0x38d7('0x24')](function(){return _0x45e92c;});}else{return _0x45e92c;}})[_0x38d7('0x41')](function(_0x510ec4){logger['error'](_0x38d7('0x4d'),_0x510ec4);throw _0x510ec4;});}return _0x45e92c;})[_0x38d7('0x24')](respondWithResult(_0x29d36f,0xc9))[_0x38d7('0x41')](handleError(_0x29d36f,null));};exports[_0x38d7('0x22')]=function(_0x4e357c,_0x40828e){if(_0x4e357c[_0x38d7('0x46')]['id']){delete _0x4e357c[_0x38d7('0x46')]['id'];}return db[_0x38d7('0x3d')][_0x38d7('0x44')]({'where':{'id':_0x4e357c['params']['id']}})[_0x38d7('0x24')](handleEntityNotFound(_0x40828e,null))[_0x38d7('0x24')](saveUpdates(_0x4e357c[_0x38d7('0x46')],null))['then'](respondWithResult(_0x40828e,null))[_0x38d7('0x41')](handleError(_0x40828e,null));};exports[_0x38d7('0x23')]=function(_0x4edf24,_0x44c1a1){return db[_0x38d7('0x3d')][_0x38d7('0x44')]({'where':{'id':_0x4edf24[_0x38d7('0x4e')]['id']}})[_0x38d7('0x24')](handleEntityNotFound(_0x44c1a1,null))[_0x38d7('0x24')](removeEntity(_0x44c1a1,null))['catch'](handleError(_0x44c1a1,null));}; \ No newline at end of file +var _0xc03b=['limit','count','offset','set','Content-Range','reject','save','then','destroy','Templates','error','name','send','index','map','Template','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','show','params','find','catch','create','body','get','role','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0xc03b,0x135));var _0xbc03=function(_0x5b445b,_0xd251da){_0x5b445b=_0x5b445b-0x0;var _0x1a40fe=_0xc03b[_0x5b445b];return _0x1a40fe;};'use strict';var emlformat=require(_0xbc03('0x0'));var rimraf=require(_0xbc03('0x1'));var zipdir=require(_0xbc03('0x2'));var jsonpatch=require(_0xbc03('0x3'));var rp=require(_0xbc03('0x4'));var moment=require(_0xbc03('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbc03('0x6'));var path=require(_0xbc03('0x7'));var sox=require(_0xbc03('0x8'));var csv=require(_0xbc03('0x9'));var ejs=require(_0xbc03('0xa'));var fs=require('fs');var fs_extra=require(_0xbc03('0xb'));var _=require(_0xbc03('0xc'));var squel=require(_0xbc03('0xd'));var crypto=require('crypto');var jsforce=require(_0xbc03('0xe'));var deskjs=require(_0xbc03('0xf'));var toCsv=require(_0xbc03('0x9'));var querystring=require(_0xbc03('0x10'));var Papa=require(_0xbc03('0x11'));var Redis=require('ioredis');var authService=require(_0xbc03('0x12'));var qs=require(_0xbc03('0x13'));var as=require(_0xbc03('0x14'));var hardwareService=require(_0xbc03('0x15'));var logger=require(_0xbc03('0x16'))('api');var utils=require(_0xbc03('0x17'));var config=require(_0xbc03('0x18'));var licenseUtil=require(_0xbc03('0x19'));var db=require(_0xbc03('0x1a'))['db'];function respondWithStatusCode(_0x1e60da,_0x4580f3){_0x4580f3=_0x4580f3||0xcc;return function(_0x4708eb){if(_0x4708eb){return _0x1e60da[_0xbc03('0x1b')](_0x4580f3);}return _0x1e60da[_0xbc03('0x1c')](_0x4580f3)[_0xbc03('0x1d')]();};}function respondWithResult(_0x22ef7a,_0x7452ef){_0x7452ef=_0x7452ef||0xc8;return function(_0xea245e){if(_0xea245e){return _0x22ef7a[_0xbc03('0x1c')](_0x7452ef)[_0xbc03('0x1e')](_0xea245e);}};}function respondWithFilteredResult(_0x3d9142,_0x1c56d0){return function(_0xf2e4f6){if(_0xf2e4f6){var _0x35eb0e=typeof _0x1c56d0['offset']==='undefined'&&typeof _0x1c56d0[_0xbc03('0x1f')]==='undefined';var _0x1a24c9=_0xf2e4f6[_0xbc03('0x20')];var _0x57b9ff=_0x35eb0e?0x0:_0x1c56d0[_0xbc03('0x21')];var _0x5445dc=_0x35eb0e?_0xf2e4f6[_0xbc03('0x20')]:_0x1c56d0[_0xbc03('0x21')]+_0x1c56d0[_0xbc03('0x1f')];var _0x4f2647;if(_0x5445dc>=_0x1a24c9){_0x5445dc=_0x1a24c9;_0x4f2647=0xc8;}else{_0x4f2647=0xce;}_0x3d9142[_0xbc03('0x1c')](_0x4f2647);return _0x3d9142[_0xbc03('0x22')](_0xbc03('0x23'),_0x57b9ff+'-'+_0x5445dc+'/'+_0x1a24c9)[_0xbc03('0x1e')](_0xf2e4f6);}return null;};}function patchUpdates(_0x4c3e2f){return function(_0x55bfca){try{jsonpatch['apply'](_0x55bfca,_0x4c3e2f,!![]);}catch(_0x16482c){return BPromise[_0xbc03('0x24')](_0x16482c);}return _0x55bfca[_0xbc03('0x25')]();};}function saveUpdates(_0x2f6846,_0x3a23b5){return function(_0x28bfc6){if(_0x28bfc6){return _0x28bfc6['update'](_0x2f6846)[_0xbc03('0x26')](function(_0x4857e4){return _0x4857e4;});}return null;};}function removeEntity(_0x555c47,_0x115318){return function(_0x49306e){if(_0x49306e){return _0x49306e[_0xbc03('0x27')]()[_0xbc03('0x26')](function(){var _0x219b4b=_0x49306e['get']({'plain':!![]});var _0x265de4=_0xbc03('0x28');return db['UserProfileResource'][_0xbc03('0x27')]({'where':{'type':_0x265de4,'resourceId':_0x219b4b['id']}})[_0xbc03('0x26')](function(){return _0x49306e;});})[_0xbc03('0x26')](function(){_0x555c47[_0xbc03('0x1c')](0xcc)[_0xbc03('0x1d')]();});}};}function handleEntityNotFound(_0x5d0050,_0xb5c9b0){return function(_0x412d0c){if(!_0x412d0c){_0x5d0050[_0xbc03('0x1b')](0x194);}return _0x412d0c;};}function handleError(_0x2282a1,_0x541ef2){_0x541ef2=_0x541ef2||0x1f4;return function(_0x46fcef){logger[_0xbc03('0x29')](_0x46fcef['stack']);if(_0x46fcef[_0xbc03('0x2a')]){delete _0x46fcef['name'];}_0x2282a1[_0xbc03('0x1c')](_0x541ef2)[_0xbc03('0x2b')](_0x46fcef);};}exports[_0xbc03('0x2c')]=function(_0x27f235,_0x368bbd){var _0x23c918={},_0x22d52={},_0x3cf80a={'count':0x0,'rows':[]};var _0x40a0aa=_[_0xbc03('0x2d')](db[_0xbc03('0x2e')][_0xbc03('0x2f')],function(_0x2b8b72){return{'name':_0x2b8b72[_0xbc03('0x30')],'type':_0x2b8b72[_0xbc03('0x31')][_0xbc03('0x32')]};});_0x22d52[_0xbc03('0x33')]=_['map'](_0x40a0aa,_0xbc03('0x2a'));_0x22d52[_0xbc03('0x34')]=_[_0xbc03('0x35')](_0x27f235[_0xbc03('0x34')]);_0x22d52['filters']=_[_0xbc03('0x36')](_0x22d52[_0xbc03('0x33')],_0x22d52[_0xbc03('0x34')]);_0x23c918[_0xbc03('0x37')]=_['intersection'](_0x22d52[_0xbc03('0x33')],qs[_0xbc03('0x38')](_0x27f235[_0xbc03('0x34')][_0xbc03('0x38')]));_0x23c918[_0xbc03('0x37')]=_0x23c918[_0xbc03('0x37')][_0xbc03('0x39')]?_0x23c918[_0xbc03('0x37')]:_0x22d52['model'];if(!_0x27f235['query'][_0xbc03('0x3a')](_0xbc03('0x3b'))){_0x23c918[_0xbc03('0x1f')]=qs[_0xbc03('0x1f')](_0x27f235[_0xbc03('0x34')]['limit']);_0x23c918['offset']=qs[_0xbc03('0x21')](_0x27f235[_0xbc03('0x34')][_0xbc03('0x21')]);}_0x23c918[_0xbc03('0x3c')]=qs['sort'](_0x27f235[_0xbc03('0x34')][_0xbc03('0x3d')]);_0x23c918[_0xbc03('0x3e')]=qs[_0xbc03('0x3f')](_[_0xbc03('0x40')](_0x27f235[_0xbc03('0x34')],_0x22d52['filters']),_0x40a0aa);if(_0x27f235[_0xbc03('0x34')][_0xbc03('0x41')]){_0x23c918[_0xbc03('0x3e')]=_[_0xbc03('0x42')](_0x23c918[_0xbc03('0x3e')],{'$or':_[_0xbc03('0x2d')](_0x40a0aa,function(_0x2e95d2){if(_0x2e95d2[_0xbc03('0x31')]!==_0xbc03('0x43')){var _0x20984b={};_0x20984b[_0x2e95d2['name']]={'$like':'%'+_0x27f235[_0xbc03('0x34')]['filter']+'%'};return _0x20984b;}})});}_0x23c918=_[_0xbc03('0x42')]({},_0x23c918,_0x27f235[_0xbc03('0x44')]);var _0x164c70={'where':_0x23c918[_0xbc03('0x3e')]};return db[_0xbc03('0x2e')]['count'](_0x164c70)[_0xbc03('0x26')](function(_0x34b59d){_0x3cf80a['count']=_0x34b59d;if(_0x27f235[_0xbc03('0x34')][_0xbc03('0x45')]){_0x23c918[_0xbc03('0x46')]=[{'all':!![]}];}return db[_0xbc03('0x2e')]['findAll'](_0x23c918);})['then'](function(_0x561e11){_0x3cf80a['rows']=_0x561e11;return _0x3cf80a;})['then'](respondWithFilteredResult(_0x368bbd,_0x23c918))['catch'](handleError(_0x368bbd,null));};exports[_0xbc03('0x47')]=function(_0x5e2c22,_0x8b0666){var _0x22338b={'raw':!![],'where':{'id':_0x5e2c22[_0xbc03('0x48')]['id']}},_0x53bcf5={};_0x53bcf5[_0xbc03('0x33')]=_['keys'](db[_0xbc03('0x2e')]['rawAttributes']);_0x53bcf5[_0xbc03('0x34')]=_[_0xbc03('0x35')](_0x5e2c22[_0xbc03('0x34')]);_0x53bcf5[_0xbc03('0x3f')]=_[_0xbc03('0x36')](_0x53bcf5[_0xbc03('0x33')],_0x53bcf5[_0xbc03('0x34')]);_0x22338b[_0xbc03('0x37')]=_[_0xbc03('0x36')](_0x53bcf5[_0xbc03('0x33')],qs['fields'](_0x5e2c22[_0xbc03('0x34')]['fields']));_0x22338b[_0xbc03('0x37')]=_0x22338b[_0xbc03('0x37')]['length']?_0x22338b[_0xbc03('0x37')]:_0x53bcf5[_0xbc03('0x33')];if(_0x5e2c22[_0xbc03('0x34')][_0xbc03('0x45')]){_0x22338b[_0xbc03('0x46')]=[{'all':!![]}];}_0x22338b=_['merge']({},_0x22338b,_0x5e2c22[_0xbc03('0x44')]);return db[_0xbc03('0x2e')][_0xbc03('0x49')](_0x22338b)[_0xbc03('0x26')](handleEntityNotFound(_0x8b0666,null))[_0xbc03('0x26')](respondWithResult(_0x8b0666,null))[_0xbc03('0x4a')](handleError(_0x8b0666,null));};exports[_0xbc03('0x4b')]=function(_0x28bd68,_0x254d5b){return db[_0xbc03('0x2e')][_0xbc03('0x4b')](_0x28bd68[_0xbc03('0x4c')],{})[_0xbc03('0x26')](function(_0x16d3a7){var _0x172334=_0x28bd68['user'][_0xbc03('0x4d')]({'plain':!![]});if(!_0x172334)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x172334[_0xbc03('0x4e')]===_0xbc03('0x4f')){var _0x56acda=_0x16d3a7['get']({'plain':!![]});var _0x5282fd='Templates';return db['UserProfileSection']['find']({'where':{'name':_0x5282fd,'userProfileId':_0x172334[_0xbc03('0x50')]},'raw':!![]})[_0xbc03('0x26')](function(_0x41dfcb){if(_0x41dfcb&&_0x41dfcb[_0xbc03('0x51')]===0x0){return db[_0xbc03('0x52')][_0xbc03('0x4b')]({'name':_0x56acda[_0xbc03('0x2a')],'resourceId':_0x56acda['id'],'type':_0x41dfcb['name'],'sectionId':_0x41dfcb['id']},{})['then'](function(){return _0x16d3a7;});}else{return _0x16d3a7;}})[_0xbc03('0x4a')](function(_0x305106){logger[_0xbc03('0x29')](_0xbc03('0x53'),_0x305106);throw _0x305106;});}return _0x16d3a7;})['then'](respondWithResult(_0x254d5b,0xc9))['catch'](handleError(_0x254d5b,null));};exports[_0xbc03('0x54')]=function(_0x2566d1,_0x543296){if(_0x2566d1[_0xbc03('0x4c')]['id']){delete _0x2566d1['body']['id'];}return db[_0xbc03('0x2e')][_0xbc03('0x49')]({'where':{'id':_0x2566d1['params']['id']}})['then'](handleEntityNotFound(_0x543296,null))['then'](saveUpdates(_0x2566d1[_0xbc03('0x4c')],null))[_0xbc03('0x26')](respondWithResult(_0x543296,null))[_0xbc03('0x4a')](handleError(_0x543296,null));};exports['destroy']=function(_0x5e6078,_0x36b9fd){return db[_0xbc03('0x2e')]['find']({'where':{'id':_0x5e6078[_0xbc03('0x48')]['id']}})['then'](handleEntityNotFound(_0x36b9fd,null))['then'](removeEntity(_0x36b9fd,null))['catch'](handleError(_0x36b9fd,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index f635121..b1555e4 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 _0xe381=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','define','lodash','util'];(function(_0xbac63a,_0xfc7132){var _0x551652=function(_0x31557c){while(--_0x31557c){_0xbac63a['push'](_0xbac63a['shift']());}};_0x551652(++_0xfc7132);}(_0xe381,0xdb));var _0x1e38=function(_0x4d3924,_0x327b56){_0x4d3924=_0x4d3924-0x0;var _0x844555=_0xe381[_0x4d3924];return _0x844555;};'use strict';var _=require(_0x1e38('0x0'));var util=require(_0x1e38('0x1'));var logger=require(_0x1e38('0x2'))(_0x1e38('0x3'));var moment=require(_0x1e38('0x4'));var BPromise=require(_0x1e38('0x5'));var rp=require(_0x1e38('0x6'));var fs=require('fs');var path=require(_0x1e38('0x7'));var rimraf=require(_0x1e38('0x8'));var config=require(_0x1e38('0x9'));var attributes=require(_0x1e38('0xa'));module[_0x1e38('0xb')]=function(_0x416391,_0x48eca4){return _0x416391[_0x1e38('0xc')]('Template',attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x88ec=['lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','./template.attributes','define','Template','tools_templates'];(function(_0x5c6994,_0x19ad9a){var _0x1d5c84=function(_0x4a385a){while(--_0x4a385a){_0x5c6994['push'](_0x5c6994['shift']());}};_0x1d5c84(++_0x19ad9a);}(_0x88ec,0x160));var _0xc88e=function(_0x2518d4,_0x3e189d){_0x2518d4=_0x2518d4-0x0;var _0xdb00bc=_0x88ec[_0x2518d4];return _0xdb00bc;};'use strict';var _=require(_0xc88e('0x0'));var util=require(_0xc88e('0x1'));var logger=require(_0xc88e('0x2'))('api');var moment=require(_0xc88e('0x3'));var BPromise=require(_0xc88e('0x4'));var rp=require(_0xc88e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc88e('0x6'));var config=require('../../config/environment');var attributes=require(_0xc88e('0x7'));module['exports']=function(_0x2b4a0e,_0x5c9f54){return _0x2b4a0e[_0xc88e('0x8')](_0xc88e('0x9'),attributes,{'tableName':_0xc88e('0xa'),'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 213f45f..7252fd9 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 _0x3dac=['../../config/utils','rpc','../../config/environment','client','http','request','info','Template,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetTemplate','Template','findAll','options','raw','where','include','map','attributes','model','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1b96ae,_0x11cd19){var _0x394985=function(_0x581c14){while(--_0x581c14){_0x1b96ae['push'](_0x1b96ae['shift']());}};_0x394985(++_0x11cd19);}(_0x3dac,0xe1));var _0xc3da=function(_0x20becb,_0x2a2e41){_0x20becb=_0x20becb-0x0;var _0x42752b=_0x3dac[_0x20becb];return _0x42752b;};'use strict';var _=require(_0xc3da('0x0'));var util=require(_0xc3da('0x1'));var moment=require('moment');var BPromise=require(_0xc3da('0x2'));var rs=require(_0xc3da('0x3'));var fs=require('fs');var Redis=require(_0xc3da('0x4'));var db=require(_0xc3da('0x5'))['db'];var utils=require(_0xc3da('0x6'));var logger=require('../../config/logger')(_0xc3da('0x7'));var config=require(_0xc3da('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc3da('0x9')][_0xc3da('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b5ed7,_0x3f8edd,_0x402fcd){return new BPromise(function(_0xb66cff,_0x3482f1){return client[_0xc3da('0xb')](_0x4b5ed7,_0x402fcd)['then'](function(_0xe67572){logger[_0xc3da('0xc')](_0xc3da('0xd'),_0x3f8edd,'request\x20sent');logger[_0xc3da('0xe')]('Template,\x20%s,\x20%s,\x20%s',_0x3f8edd,_0xc3da('0xf'),JSON[_0xc3da('0x10')](_0xe67572));if(_0xe67572[_0xc3da('0x11')]){if(_0xe67572[_0xc3da('0x11')][_0xc3da('0x12')]===0x1f4){logger[_0xc3da('0x11')](_0xc3da('0xd'),_0x3f8edd,_0xe67572[_0xc3da('0x11')]['message']);return _0x3482f1(_0xe67572[_0xc3da('0x11')]['message']);}logger['error'](_0xc3da('0xd'),_0x3f8edd,_0xe67572['error'][_0xc3da('0x13')]);return _0xb66cff(_0xe67572[_0xc3da('0x11')][_0xc3da('0x13')]);}else{logger[_0xc3da('0xc')]('Template,\x20%s,\x20%s',_0x3f8edd,'request\x20sent');_0xb66cff(_0xe67572[_0xc3da('0x14')][_0xc3da('0x13')]);}})[_0xc3da('0x15')](function(_0x524979){logger[_0xc3da('0x11')]('Template,\x20%s,\x20%s',_0x3f8edd,_0x524979);_0x3482f1(_0x524979);});});}exports[_0xc3da('0x16')]=function(_0x4857bd){var _0x326ef9=this;return new Promise(function(_0x38b3c1,_0x145b45){return db[_0xc3da('0x17')][_0xc3da('0x18')]({'raw':_0x4857bd['options']?_0x4857bd[_0xc3da('0x19')][_0xc3da('0x1a')]===undefined?!![]:![]:!![],'where':_0x4857bd[_0xc3da('0x19')]?_0x4857bd['options'][_0xc3da('0x1b')]||null:null,'attributes':_0x4857bd[_0xc3da('0x19')]?_0x4857bd['options']['attributes']||null:null,'limit':_0x4857bd[_0xc3da('0x19')]?_0x4857bd[_0xc3da('0x19')]['limit']||null:null,'include':_0x4857bd[_0xc3da('0x19')]?_0x4857bd[_0xc3da('0x19')][_0xc3da('0x1c')]?_[_0xc3da('0x1d')](_0x4857bd[_0xc3da('0x19')][_0xc3da('0x1c')],function(_0x2adea4){return{'model':db[_0x2adea4['model']],'as':_0x2adea4['as'],'attributes':_0x2adea4[_0xc3da('0x1e')],'include':_0x2adea4[_0xc3da('0x1c')]?_[_0xc3da('0x1d')](_0x2adea4[_0xc3da('0x1c')],function(_0x1879f6){return{'model':db[_0x1879f6[_0xc3da('0x1f')]],'as':_0x1879f6['as'],'attributes':_0x1879f6[_0xc3da('0x1e')],'include':_0x1879f6[_0xc3da('0x1c')]?_[_0xc3da('0x1d')](_0x1879f6['include'],function(_0x4e0e09){return{'model':db[_0x4e0e09[_0xc3da('0x1f')]],'as':_0x4e0e09['as'],'attributes':_0x4e0e09[_0xc3da('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc3da('0x20')](function(_0x1218b5){logger['info'](_0xc3da('0x16'),_0x4857bd);logger['debug'](_0xc3da('0x16'),_0x4857bd,JSON['stringify'](_0x1218b5));_0x38b3c1(_0x1218b5);})[_0xc3da('0x15')](function(_0x1eb625){logger[_0xc3da('0x11')](_0xc3da('0x16'),_0x1eb625[_0xc3da('0x13')],_0x4857bd);_0x145b45(_0x326ef9['error'](0x1f4,_0x1eb625[_0xc3da('0x13')]));});});}; \ No newline at end of file +var _0x46a8=['http','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','raw','options','attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x46a8,0x135));var _0x846a=function(_0x3dbeca,_0x11d0c6){_0x3dbeca=_0x3dbeca-0x0;var _0x94352c=_0x46a8[_0x3dbeca];return _0x94352c;};'use strict';var _=require(_0x846a('0x0'));var util=require(_0x846a('0x1'));var moment=require(_0x846a('0x2'));var BPromise=require(_0x846a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x846a('0x4'));var db=require(_0x846a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x846a('0x6'))(_0x846a('0x7'));var config=require(_0x846a('0x8'));var jayson=require(_0x846a('0x9'));var client=jayson[_0x846a('0xa')][_0x846a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x539560,_0x2cf245,_0x329c51){return new BPromise(function(_0x235035,_0x1cb6b4){return client[_0x846a('0xc')](_0x539560,_0x329c51)[_0x846a('0xd')](function(_0x142fbd){logger[_0x846a('0xe')]('Template,\x20%s,\x20%s',_0x2cf245,_0x846a('0xf'));logger[_0x846a('0x10')](_0x846a('0x11'),_0x2cf245,_0x846a('0xf'),JSON[_0x846a('0x12')](_0x142fbd));if(_0x142fbd[_0x846a('0x13')]){if(_0x142fbd[_0x846a('0x13')][_0x846a('0x14')]===0x1f4){logger[_0x846a('0x13')](_0x846a('0x15'),_0x2cf245,_0x142fbd[_0x846a('0x13')][_0x846a('0x16')]);return _0x1cb6b4(_0x142fbd['error'][_0x846a('0x16')]);}logger[_0x846a('0x13')](_0x846a('0x15'),_0x2cf245,_0x142fbd[_0x846a('0x13')]['message']);return _0x235035(_0x142fbd[_0x846a('0x13')][_0x846a('0x16')]);}else{logger[_0x846a('0xe')](_0x846a('0x15'),_0x2cf245,_0x846a('0xf'));_0x235035(_0x142fbd[_0x846a('0x17')][_0x846a('0x16')]);}})[_0x846a('0x18')](function(_0x1c48f3){logger['error'](_0x846a('0x15'),_0x2cf245,_0x1c48f3);_0x1cb6b4(_0x1c48f3);});});}exports[_0x846a('0x19')]=function(_0x861b2e){var _0x1b4170=this;return new Promise(function(_0x3e68d4,_0x37864b){return db['Template']['findAll']({'raw':_0x861b2e['options']?_0x861b2e['options'][_0x846a('0x1a')]===undefined?!![]:![]:!![],'where':_0x861b2e[_0x846a('0x1b')]?_0x861b2e[_0x846a('0x1b')]['where']||null:null,'attributes':_0x861b2e[_0x846a('0x1b')]?_0x861b2e[_0x846a('0x1b')][_0x846a('0x1c')]||null:null,'limit':_0x861b2e[_0x846a('0x1b')]?_0x861b2e['options']['limit']||null:null,'include':_0x861b2e[_0x846a('0x1b')]?_0x861b2e['options'][_0x846a('0x1d')]?_[_0x846a('0x1e')](_0x861b2e[_0x846a('0x1b')]['include'],function(_0x2276ca){return{'model':db[_0x2276ca[_0x846a('0x1f')]],'as':_0x2276ca['as'],'attributes':_0x2276ca[_0x846a('0x1c')],'include':_0x2276ca[_0x846a('0x1d')]?_['map'](_0x2276ca['include'],function(_0x4372f2){return{'model':db[_0x4372f2[_0x846a('0x1f')]],'as':_0x4372f2['as'],'attributes':_0x4372f2['attributes'],'include':_0x4372f2[_0x846a('0x1d')]?_[_0x846a('0x1e')](_0x4372f2[_0x846a('0x1d')],function(_0x1ed14e){return{'model':db[_0x1ed14e[_0x846a('0x1f')]],'as':_0x1ed14e['as'],'attributes':_0x1ed14e[_0x846a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x846a('0xd')](function(_0x911efb){logger['info'](_0x846a('0x19'),_0x861b2e);logger[_0x846a('0x10')](_0x846a('0x19'),_0x861b2e,JSON[_0x846a('0x12')](_0x911efb));_0x3e68d4(_0x911efb);})['catch'](function(_0x3e945b){logger[_0x846a('0x13')](_0x846a('0x19'),_0x3e945b['message'],_0x861b2e);_0x37864b(_0x1b4170['error'](0x1f4,_0x3e945b['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index e1ca18f..bbd5e7e 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 _0xd1a2=['multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','post','addAllCondition','addAnyCondition','addAction','update','destroy','exports'];(function(_0x175e65,_0x36e14f){var _0x2161c6=function(_0x49b687){while(--_0x49b687){_0x175e65['push'](_0x175e65['shift']());}};_0x2161c6(++_0x36e14f);}(_0xd1a2,0x190));var _0x2d1a=function(_0x3a0cab,_0x3c0820){_0x3a0cab=_0x3a0cab-0x0;var _0x39bd0d=_0xd1a2[_0x3a0cab];return _0x39bd0d;};'use strict';var multer=require(_0x2d1a('0x0'));var util=require(_0x2d1a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2d1a('0x2'));var router=express[_0x2d1a('0x3')]();var fs_extra=require(_0x2d1a('0x4'));var auth=require(_0x2d1a('0x5'));var interaction=require(_0x2d1a('0x6'));var config=require(_0x2d1a('0x7'));var controller=require('./trigger.controller');router['get']('/',auth[_0x2d1a('0x8')](),controller[_0x2d1a('0x9')]);router[_0x2d1a('0xa')](_0x2d1a('0xb'),auth[_0x2d1a('0x8')](),controller[_0x2d1a('0xc')]);router[_0x2d1a('0xa')](_0x2d1a('0xd'),auth[_0x2d1a('0x8')](),controller[_0x2d1a('0xe')]);router[_0x2d1a('0xa')](_0x2d1a('0xf'),auth[_0x2d1a('0x8')](),controller[_0x2d1a('0x10')]);router[_0x2d1a('0xa')](_0x2d1a('0x11'),auth['isAuthenticated'](),controller['getActions']);router[_0x2d1a('0x12')]('/',auth[_0x2d1a('0x8')](),controller['create']);router['post'](_0x2d1a('0xd'),auth['isAuthenticated'](),controller[_0x2d1a('0x13')]);router[_0x2d1a('0x12')](_0x2d1a('0xf'),auth[_0x2d1a('0x8')](),controller[_0x2d1a('0x14')]);router['post']('/:id/actions',auth[_0x2d1a('0x8')](),controller[_0x2d1a('0x15')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x2d1a('0x16')]);router['delete'](_0x2d1a('0xb'),auth[_0x2d1a('0x8')](),controller[_0x2d1a('0x17')]);module[_0x2d1a('0x18')]=router; \ No newline at end of file +var _0x8265=['get','isAuthenticated','/:id','/:id/all_conditions','getAllConditions','/:id/actions','getActions','post','create','addAllCondition','/:id/any_conditions','addAnyCondition','put','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./trigger.controller'];(function(_0x383627,_0x5be16e){var _0x2c16a0=function(_0x569b72){while(--_0x569b72){_0x383627['push'](_0x383627['shift']());}};_0x2c16a0(++_0x5be16e);}(_0x8265,0xa0));var _0x5826=function(_0x2ee21f,_0x1fb11f){_0x2ee21f=_0x2ee21f-0x0;var _0x14161a=_0x8265[_0x2ee21f];return _0x14161a;};'use strict';var multer=require(_0x5826('0x0'));var util=require(_0x5826('0x1'));var path=require(_0x5826('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5826('0x3')]();var fs_extra=require(_0x5826('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5826('0x5'));var config=require(_0x5826('0x6'));var controller=require(_0x5826('0x7'));router[_0x5826('0x8')]('/',auth[_0x5826('0x9')](),controller['index']);router[_0x5826('0x8')](_0x5826('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0x5826('0xb'),auth[_0x5826('0x9')](),controller[_0x5826('0xc')]);router['get']('/:id/any_conditions',auth[_0x5826('0x9')](),controller['getAnyConditions']);router['get'](_0x5826('0xd'),auth[_0x5826('0x9')](),controller[_0x5826('0xe')]);router[_0x5826('0xf')]('/',auth[_0x5826('0x9')](),controller[_0x5826('0x10')]);router[_0x5826('0xf')](_0x5826('0xb'),auth[_0x5826('0x9')](),controller[_0x5826('0x11')]);router[_0x5826('0xf')](_0x5826('0x12'),auth[_0x5826('0x9')](),controller[_0x5826('0x13')]);router['post'](_0x5826('0xd'),auth[_0x5826('0x9')](),controller['addAction']);router[_0x5826('0x14')](_0x5826('0xa'),auth[_0x5826('0x9')](),controller['update']);router[_0x5826('0x15')](_0x5826('0xa'),auth[_0x5826('0x9')](),controller[_0x5826('0x16')]);module[_0x5826('0x17')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index d419b58..9cb2539 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 _0x84c7=['exports','STRING','BOOLEAN','sequelize'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x84c7,0x6f));var _0x784c=function(_0x449aa4,_0x3ab067){_0x449aa4=_0x449aa4-0x0;var _0xc4e420=_0x84c7[_0x449aa4];return _0xc4e420;};'use strict';var Sequelize=require(_0x784c('0x0'));module[_0x784c('0x1')]={'name':{'type':Sequelize[_0x784c('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x784c('0x2')]},'status':{'type':Sequelize[_0x784c('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xc45b=['BOOLEAN','sequelize','exports','STRING'];(function(_0x14b767,_0x577e84){var _0x22267a=function(_0xa87ebc){while(--_0xa87ebc){_0x14b767['push'](_0x14b767['shift']());}};_0x22267a(++_0x577e84);}(_0xc45b,0x169));var _0xbc45=function(_0x37f492,_0x337b42){_0x37f492=_0x37f492-0x0;var _0x469e0e=_0xc45b[_0x37f492];return _0x469e0e;};'use strict';var Sequelize=require(_0xbc45('0x0'));module[_0xbc45('0x1')]={'name':{'type':Sequelize[_0xbc45('0x2')]},'channel':{'type':Sequelize[_0xbc45('0x2')]},'description':{'type':Sequelize[_0xbc45('0x2')]},'status':{'type':Sequelize[_0xbc45('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 5332666..6b62766 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 _0x3d71=['save','update','then','destroy','get','Triggers','UserProfileResource','name','send','index','map','Trigger','fieldName','type','model','query','keys','intersection','fields','attributes','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','include','findAll','rows','catch','params','rawAttributes','length','options','find','create','body','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','hasOwnProperty','getAnyConditions','getActions','Action','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','api','../../config/utils','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject'];(function(_0x5ab18b,_0x38ed8f){var _0x5dafb6=function(_0x412969){while(--_0x412969){_0x5ab18b['push'](_0x5ab18b['shift']());}};_0x5dafb6(++_0x38ed8f);}(_0x3d71,0x131));var _0x13d7=function(_0x53bb74,_0x590c3e){_0x53bb74=_0x53bb74-0x0;var _0x286b70=_0x3d71[_0x53bb74];return _0x286b70;};'use strict';var emlformat=require(_0x13d7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x13d7('0x1'));var jsonpatch=require(_0x13d7('0x2'));var rp=require(_0x13d7('0x3'));var moment=require(_0x13d7('0x4'));var BPromise=require(_0x13d7('0x5'));var Mustache=require(_0x13d7('0x6'));var util=require(_0x13d7('0x7'));var path=require('path');var sox=require(_0x13d7('0x8'));var csv=require(_0x13d7('0x9'));var ejs=require(_0x13d7('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x13d7('0xb'));var crypto=require(_0x13d7('0xc'));var jsforce=require(_0x13d7('0xd'));var deskjs=require(_0x13d7('0xe'));var toCsv=require(_0x13d7('0x9'));var querystring=require(_0x13d7('0xf'));var Papa=require('papaparse');var Redis=require(_0x13d7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x13d7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x13d7('0x12'));var utils=require(_0x13d7('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5367c0,_0x429af1){_0x429af1=_0x429af1||0xcc;return function(_0x28dd8e){if(_0x28dd8e){return _0x5367c0['sendStatus'](_0x429af1);}return _0x5367c0[_0x13d7('0x14')](_0x429af1)[_0x13d7('0x15')]();};}function respondWithResult(_0x3306ab,_0x47b010){_0x47b010=_0x47b010||0xc8;return function(_0x5d7e84){if(_0x5d7e84){return _0x3306ab['status'](_0x47b010)[_0x13d7('0x16')](_0x5d7e84);}};}function respondWithFilteredResult(_0x5e7751,_0x40f1fb){return function(_0x2172bf){if(_0x2172bf){var _0x1f23d9=typeof _0x40f1fb[_0x13d7('0x17')]===_0x13d7('0x18')&&typeof _0x40f1fb['limit']==='undefined';var _0x3ad482=_0x2172bf['count'];var _0x5a4c52=_0x1f23d9?0x0:_0x40f1fb[_0x13d7('0x17')];var _0x2c7d65=_0x1f23d9?_0x2172bf[_0x13d7('0x19')]:_0x40f1fb[_0x13d7('0x17')]+_0x40f1fb[_0x13d7('0x1a')];var _0x3d0688;if(_0x2c7d65>=_0x3ad482){_0x2c7d65=_0x3ad482;_0x3d0688=0xc8;}else{_0x3d0688=0xce;}_0x5e7751[_0x13d7('0x14')](_0x3d0688);return _0x5e7751[_0x13d7('0x1b')](_0x13d7('0x1c'),_0x5a4c52+'-'+_0x2c7d65+'/'+_0x3ad482)[_0x13d7('0x16')](_0x2172bf);}return null;};}function patchUpdates(_0x585746){return function(_0x2ae742){try{jsonpatch[_0x13d7('0x1d')](_0x2ae742,_0x585746,!![]);}catch(_0x3a0d0a){return BPromise[_0x13d7('0x1e')](_0x3a0d0a);}return _0x2ae742[_0x13d7('0x1f')]();};}function saveUpdates(_0xfadfa8,_0xd6b722){return function(_0x5251d1){if(_0x5251d1){return _0x5251d1[_0x13d7('0x20')](_0xfadfa8)[_0x13d7('0x21')](function(_0x40edf2){return _0x40edf2;});}return null;};}function removeEntity(_0x99deca,_0x1be0f3){return function(_0x158a58){if(_0x158a58){return _0x158a58[_0x13d7('0x22')]()['then'](function(){var _0x3b0664=_0x158a58[_0x13d7('0x23')]({'plain':!![]});var _0x155a25=_0x13d7('0x24');return db[_0x13d7('0x25')][_0x13d7('0x22')]({'where':{'type':_0x155a25,'resourceId':_0x3b0664['id']}})['then'](function(){return _0x158a58;});})[_0x13d7('0x21')](function(){_0x99deca[_0x13d7('0x14')](0xcc)[_0x13d7('0x15')]();});}};}function handleEntityNotFound(_0x2fe548,_0xc34d5f){return function(_0x353dd6){if(!_0x353dd6){_0x2fe548['sendStatus'](0x194);}return _0x353dd6;};}function handleError(_0x597895,_0x573de2){_0x573de2=_0x573de2||0x1f4;return function(_0x466f92){logger['error'](_0x466f92['stack']);if(_0x466f92[_0x13d7('0x26')]){delete _0x466f92[_0x13d7('0x26')];}_0x597895[_0x13d7('0x14')](_0x573de2)[_0x13d7('0x27')](_0x466f92);};}exports[_0x13d7('0x28')]=function(_0x39f403,_0x331f63){var _0x1ac6f7={},_0x42a280={},_0x3f70cb={'count':0x0,'rows':[]};var _0x2f65fe=_[_0x13d7('0x29')](db[_0x13d7('0x2a')]['rawAttributes'],function(_0x4194d1){return{'name':_0x4194d1[_0x13d7('0x2b')],'type':_0x4194d1[_0x13d7('0x2c')]['key']};});_0x42a280[_0x13d7('0x2d')]=_[_0x13d7('0x29')](_0x2f65fe,_0x13d7('0x26'));_0x42a280[_0x13d7('0x2e')]=_[_0x13d7('0x2f')](_0x39f403[_0x13d7('0x2e')]);_0x42a280['filters']=_[_0x13d7('0x30')](_0x42a280[_0x13d7('0x2d')],_0x42a280['query']);_0x1ac6f7['attributes']=_['intersection'](_0x42a280['model'],qs[_0x13d7('0x31')](_0x39f403['query']['fields']));_0x1ac6f7[_0x13d7('0x32')]=_0x1ac6f7[_0x13d7('0x32')]['length']?_0x1ac6f7['attributes']:_0x42a280[_0x13d7('0x2d')];if(!_0x39f403['query']['hasOwnProperty'](_0x13d7('0x33'))){_0x1ac6f7[_0x13d7('0x1a')]=qs['limit'](_0x39f403['query'][_0x13d7('0x1a')]);_0x1ac6f7[_0x13d7('0x17')]=qs['offset'](_0x39f403[_0x13d7('0x2e')][_0x13d7('0x17')]);}_0x1ac6f7[_0x13d7('0x34')]=qs['sort'](_0x39f403[_0x13d7('0x2e')][_0x13d7('0x35')]);_0x1ac6f7[_0x13d7('0x36')]=qs[_0x13d7('0x37')](_[_0x13d7('0x38')](_0x39f403[_0x13d7('0x2e')],_0x42a280[_0x13d7('0x37')]),_0x2f65fe);if(_0x39f403[_0x13d7('0x2e')][_0x13d7('0x39')]){_0x1ac6f7[_0x13d7('0x36')]=_[_0x13d7('0x3a')](_0x1ac6f7[_0x13d7('0x36')],{'$or':_[_0x13d7('0x29')](_0x2f65fe,function(_0x57b697){if(_0x57b697['type']!=='VIRTUAL'){var _0x479692={};_0x479692[_0x57b697[_0x13d7('0x26')]]={'$like':'%'+_0x39f403['query'][_0x13d7('0x39')]+'%'};return _0x479692;}})});}_0x1ac6f7=_[_0x13d7('0x3a')]({},_0x1ac6f7,_0x39f403['options']);var _0x26873b={'where':_0x1ac6f7[_0x13d7('0x36')]};return db[_0x13d7('0x2a')][_0x13d7('0x19')](_0x26873b)[_0x13d7('0x21')](function(_0x476eb6){_0x3f70cb[_0x13d7('0x19')]=_0x476eb6;if(_0x39f403['query'][_0x13d7('0x3b')]){_0x1ac6f7[_0x13d7('0x3c')]=[{'all':!![]}];}return db[_0x13d7('0x2a')][_0x13d7('0x3d')](_0x1ac6f7);})[_0x13d7('0x21')](function(_0x50a7c3){_0x3f70cb[_0x13d7('0x3e')]=_0x50a7c3;return _0x3f70cb;})[_0x13d7('0x21')](respondWithFilteredResult(_0x331f63,_0x1ac6f7))[_0x13d7('0x3f')](handleError(_0x331f63,null));};exports['show']=function(_0x372b4b,_0x54299b){var _0x4d6a38={'raw':![],'where':{'id':_0x372b4b[_0x13d7('0x40')]['id']}},_0x514c14={};_0x514c14[_0x13d7('0x2d')]=_[_0x13d7('0x2f')](db[_0x13d7('0x2a')][_0x13d7('0x41')]);_0x514c14[_0x13d7('0x2e')]=_['keys'](_0x372b4b[_0x13d7('0x2e')]);_0x514c14['filters']=_[_0x13d7('0x30')](_0x514c14['model'],_0x514c14[_0x13d7('0x2e')]);_0x4d6a38[_0x13d7('0x32')]=_['intersection'](_0x514c14[_0x13d7('0x2d')],qs[_0x13d7('0x31')](_0x372b4b['query']['fields']));_0x4d6a38[_0x13d7('0x32')]=_0x4d6a38['attributes'][_0x13d7('0x42')]?_0x4d6a38[_0x13d7('0x32')]:_0x514c14[_0x13d7('0x2d')];if(_0x372b4b['query'][_0x13d7('0x3b')]){_0x4d6a38['include']=[{'all':!![]}];}_0x4d6a38=_[_0x13d7('0x3a')]({},_0x4d6a38,_0x372b4b[_0x13d7('0x43')]);return db['Trigger'][_0x13d7('0x44')](_0x4d6a38)[_0x13d7('0x21')](handleEntityNotFound(_0x54299b,null))[_0x13d7('0x21')](respondWithResult(_0x54299b,null))[_0x13d7('0x3f')](handleError(_0x54299b,null));};exports[_0x13d7('0x45')]=function(_0xa7a20c,_0x103ddc){return db[_0x13d7('0x2a')][_0x13d7('0x45')](_0xa7a20c[_0x13d7('0x46')],{})[_0x13d7('0x21')](function(_0x9c3f5){var _0xb8f0ae=_0xa7a20c[_0x13d7('0x47')][_0x13d7('0x23')]({'plain':!![]});if(!_0xb8f0ae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xb8f0ae['role']===_0x13d7('0x47')){var _0x5f4aed=_0x9c3f5[_0x13d7('0x23')]({'plain':!![]});var _0x552d25='Triggers';return db[_0x13d7('0x48')][_0x13d7('0x44')]({'where':{'name':_0x552d25,'userProfileId':_0xb8f0ae['userProfileId']},'raw':!![]})[_0x13d7('0x21')](function(_0x5c4f72){if(_0x5c4f72&&_0x5c4f72[_0x13d7('0x49')]===0x0){return db['UserProfileResource']['create']({'name':_0x5f4aed[_0x13d7('0x26')],'resourceId':_0x5f4aed['id'],'type':_0x5c4f72[_0x13d7('0x26')],'sectionId':_0x5c4f72['id']},{})[_0x13d7('0x21')](function(){return _0x9c3f5;});}else{return _0x9c3f5;}})['catch'](function(_0x43a1aa){logger['error'](_0x13d7('0x4a'),_0x43a1aa);throw _0x43a1aa;});}return _0x9c3f5;})[_0x13d7('0x21')](respondWithResult(_0x103ddc,0xc9))[_0x13d7('0x3f')](handleError(_0x103ddc,null));};exports[_0x13d7('0x20')]=function(_0x14283e,_0x1bc14f){if(_0x14283e[_0x13d7('0x46')]['id']){delete _0x14283e[_0x13d7('0x46')]['id'];}return db['Trigger']['find']({'where':{'id':_0x14283e['params']['id']}})[_0x13d7('0x21')](handleEntityNotFound(_0x1bc14f,null))[_0x13d7('0x21')](saveUpdates(_0x14283e[_0x13d7('0x46')],null))[_0x13d7('0x21')](respondWithResult(_0x1bc14f,null))[_0x13d7('0x3f')](handleError(_0x1bc14f,null));};exports['destroy']=function(_0x4ca60d,_0x5e4ba4){return db[_0x13d7('0x2a')][_0x13d7('0x44')]({'where':{'id':_0x4ca60d['params']['id']}})[_0x13d7('0x21')](handleEntityNotFound(_0x5e4ba4,null))[_0x13d7('0x21')](removeEntity(_0x5e4ba4,null))[_0x13d7('0x3f')](handleError(_0x5e4ba4,null));};exports['addAllCondition']=function(_0x582bc0,_0x3bc884,_0x170879){if(_0x582bc0[_0x13d7('0x46')]['id']){delete _0x582bc0['body']['id'];}return db[_0x13d7('0x2a')][_0x13d7('0x44')]({'where':{'id':_0x582bc0[_0x13d7('0x40')]['id']}})[_0x13d7('0x21')](handleEntityNotFound(_0x3bc884,null))[_0x13d7('0x21')](function(_0x3f65e7){if(_0x3f65e7){_0x582bc0[_0x13d7('0x46')]['TriggerAllId']=_0x3f65e7['id'];return db[_0x13d7('0x4b')]['create'](_0x582bc0['body']);}})['then'](respondWithResult(_0x3bc884,null))[_0x13d7('0x3f')](handleError(_0x3bc884,null));};exports[_0x13d7('0x4c')]=function(_0x4663b2,_0x5de410,_0x22f3cd){if(_0x4663b2[_0x13d7('0x46')]['id']){delete _0x4663b2[_0x13d7('0x46')]['id'];}return db['Trigger'][_0x13d7('0x44')]({'where':{'id':_0x4663b2[_0x13d7('0x40')]['id']}})[_0x13d7('0x21')](handleEntityNotFound(_0x5de410,null))[_0x13d7('0x21')](function(_0x2ea4bd){if(_0x2ea4bd){_0x4663b2['body'][_0x13d7('0x4d')]=_0x2ea4bd['id'];return db['Condition'][_0x13d7('0x45')](_0x4663b2['body']);}})[_0x13d7('0x21')](respondWithResult(_0x5de410,null))['catch'](handleError(_0x5de410,null));};exports[_0x13d7('0x4e')]=function(_0x1efd4b,_0xdb487c,_0x24148c){var _0x24937b={};var _0x50ece1={};var _0x628e31;var _0x49111d;return db[_0x13d7('0x2a')][_0x13d7('0x4f')]({'where':{'id':_0x1efd4b[_0x13d7('0x40')]['id']}})['then'](handleEntityNotFound(_0xdb487c,null))[_0x13d7('0x21')](function(_0x10f372){if(_0x10f372){_0x628e31=_0x10f372;_0x50ece1[_0x13d7('0x2d')]=_['keys'](db[_0x13d7('0x4b')][_0x13d7('0x41')]);_0x50ece1[_0x13d7('0x2e')]=_[_0x13d7('0x2f')](_0x1efd4b[_0x13d7('0x2e')]);_0x50ece1[_0x13d7('0x37')]=_[_0x13d7('0x30')](_0x50ece1[_0x13d7('0x2d')],_0x50ece1[_0x13d7('0x2e')]);_0x24937b[_0x13d7('0x32')]=_[_0x13d7('0x30')](_0x50ece1[_0x13d7('0x2d')],qs['fields'](_0x1efd4b[_0x13d7('0x2e')]['fields']));_0x24937b['attributes']=_0x24937b[_0x13d7('0x32')][_0x13d7('0x42')]?_0x24937b[_0x13d7('0x32')]:_0x50ece1['model'];_0x24937b[_0x13d7('0x34')]=qs[_0x13d7('0x35')](_0x1efd4b[_0x13d7('0x2e')][_0x13d7('0x35')]);_0x24937b[_0x13d7('0x36')]=qs[_0x13d7('0x37')](_[_0x13d7('0x38')](_0x1efd4b[_0x13d7('0x2e')],_0x50ece1[_0x13d7('0x37')]));if(_0x1efd4b[_0x13d7('0x2e')][_0x13d7('0x39')]){_0x24937b['where']=_[_0x13d7('0x3a')](_0x24937b[_0x13d7('0x36')],{'$or':_[_0x13d7('0x29')](_0x24937b[_0x13d7('0x32')],function(_0x254e47){var _0x3ac770={};_0x3ac770[_0x254e47]={'$like':'%'+_0x1efd4b['query']['filter']+'%'};return _0x3ac770;})});}_0x24937b=_[_0x13d7('0x3a')]({},_0x24937b,_0x1efd4b[_0x13d7('0x43')]);return _0x628e31[_0x13d7('0x4e')](_0x24937b);}})[_0x13d7('0x21')](function(_0x3eafdd){if(_0x3eafdd){_0x49111d=_0x3eafdd[_0x13d7('0x42')];if(!_0x1efd4b['query'][_0x13d7('0x50')]('nolimit')){_0x24937b['limit']=qs[_0x13d7('0x1a')](_0x1efd4b[_0x13d7('0x2e')]['limit']);_0x24937b['offset']=qs['offset'](_0x1efd4b[_0x13d7('0x2e')][_0x13d7('0x17')]);}return _0x628e31[_0x13d7('0x4e')](_0x24937b);}})[_0x13d7('0x21')](function(_0x2dc5ec){if(_0x2dc5ec){return _0x2dc5ec?{'count':_0x49111d,'rows':_0x2dc5ec}:null;}})[_0x13d7('0x21')](respondWithResult(_0xdb487c,null))[_0x13d7('0x3f')](handleError(_0xdb487c,null));};exports[_0x13d7('0x51')]=function(_0xb42091,_0x26299c,_0x2227ff){var _0x1bb5f9={};var _0x2a9bb1={};var _0x4a3659;var _0x565e59;return db[_0x13d7('0x2a')][_0x13d7('0x4f')]({'where':{'id':_0xb42091[_0x13d7('0x40')]['id']}})[_0x13d7('0x21')](handleEntityNotFound(_0x26299c,null))[_0x13d7('0x21')](function(_0x5ef9bc){if(_0x5ef9bc){_0x4a3659=_0x5ef9bc;_0x2a9bb1[_0x13d7('0x2d')]=_[_0x13d7('0x2f')](db[_0x13d7('0x4b')][_0x13d7('0x41')]);_0x2a9bb1[_0x13d7('0x2e')]=_[_0x13d7('0x2f')](_0xb42091[_0x13d7('0x2e')]);_0x2a9bb1[_0x13d7('0x37')]=_[_0x13d7('0x30')](_0x2a9bb1[_0x13d7('0x2d')],_0x2a9bb1[_0x13d7('0x2e')]);_0x1bb5f9[_0x13d7('0x32')]=_[_0x13d7('0x30')](_0x2a9bb1[_0x13d7('0x2d')],qs[_0x13d7('0x31')](_0xb42091[_0x13d7('0x2e')][_0x13d7('0x31')]));_0x1bb5f9[_0x13d7('0x32')]=_0x1bb5f9[_0x13d7('0x32')]['length']?_0x1bb5f9[_0x13d7('0x32')]:_0x2a9bb1[_0x13d7('0x2d')];_0x1bb5f9[_0x13d7('0x34')]=qs[_0x13d7('0x35')](_0xb42091[_0x13d7('0x2e')][_0x13d7('0x35')]);_0x1bb5f9['where']=qs[_0x13d7('0x37')](_[_0x13d7('0x38')](_0xb42091[_0x13d7('0x2e')],_0x2a9bb1['filters']));if(_0xb42091[_0x13d7('0x2e')]['filter']){_0x1bb5f9[_0x13d7('0x36')]=_[_0x13d7('0x3a')](_0x1bb5f9[_0x13d7('0x36')],{'$or':_[_0x13d7('0x29')](_0x1bb5f9['attributes'],function(_0x3a13c8){var _0x261efe={};_0x261efe[_0x3a13c8]={'$like':'%'+_0xb42091[_0x13d7('0x2e')][_0x13d7('0x39')]+'%'};return _0x261efe;})});}_0x1bb5f9=_[_0x13d7('0x3a')]({},_0x1bb5f9,_0xb42091[_0x13d7('0x43')]);return _0x4a3659[_0x13d7('0x51')](_0x1bb5f9);}})[_0x13d7('0x21')](function(_0x3fecc4){if(_0x3fecc4){_0x565e59=_0x3fecc4[_0x13d7('0x42')];if(!_0xb42091[_0x13d7('0x2e')][_0x13d7('0x50')](_0x13d7('0x33'))){_0x1bb5f9[_0x13d7('0x1a')]=qs['limit'](_0xb42091[_0x13d7('0x2e')][_0x13d7('0x1a')]);_0x1bb5f9[_0x13d7('0x17')]=qs[_0x13d7('0x17')](_0xb42091['query'][_0x13d7('0x17')]);}return _0x4a3659[_0x13d7('0x51')](_0x1bb5f9);}})['then'](function(_0x4ece0d){if(_0x4ece0d){return _0x4ece0d?{'count':_0x565e59,'rows':_0x4ece0d}:null;}})[_0x13d7('0x21')](respondWithResult(_0x26299c,null))[_0x13d7('0x3f')](handleError(_0x26299c,null));};exports['addAction']=function(_0xbbba88,_0x209d04,_0x188ae0){if(_0xbbba88[_0x13d7('0x46')]['id']){delete _0xbbba88[_0x13d7('0x46')]['id'];}return db[_0x13d7('0x2a')][_0x13d7('0x44')]({'where':{'id':_0xbbba88[_0x13d7('0x40')]['id']}})[_0x13d7('0x21')](handleEntityNotFound(_0x209d04,null))[_0x13d7('0x21')](function(_0x5adbb6){if(_0x5adbb6){_0xbbba88[_0x13d7('0x46')]['TriggerId']=_0x5adbb6['id'];return db['Action'][_0x13d7('0x45')](_0xbbba88[_0x13d7('0x46')]);}})[_0x13d7('0x21')](respondWithResult(_0x209d04,null))[_0x13d7('0x3f')](handleError(_0x209d04,null));};exports[_0x13d7('0x52')]=function(_0x192ed0,_0x394169,_0x127906){var _0x4e0529={};var _0xa360b8={};var _0xdbc910;var _0x419e50;return db[_0x13d7('0x2a')][_0x13d7('0x4f')]({'where':{'id':_0x192ed0['params']['id']}})[_0x13d7('0x21')](handleEntityNotFound(_0x394169,null))[_0x13d7('0x21')](function(_0x3045ec){if(_0x3045ec){_0xdbc910=_0x3045ec;_0xa360b8[_0x13d7('0x2d')]=_[_0x13d7('0x2f')](db[_0x13d7('0x53')][_0x13d7('0x41')]);_0xa360b8['query']=_['keys'](_0x192ed0[_0x13d7('0x2e')]);_0xa360b8['filters']=_[_0x13d7('0x30')](_0xa360b8[_0x13d7('0x2d')],_0xa360b8['query']);_0x4e0529[_0x13d7('0x32')]=_[_0x13d7('0x30')](_0xa360b8[_0x13d7('0x2d')],qs[_0x13d7('0x31')](_0x192ed0[_0x13d7('0x2e')][_0x13d7('0x31')]));_0x4e0529[_0x13d7('0x32')]=_0x4e0529['attributes'][_0x13d7('0x42')]?_0x4e0529[_0x13d7('0x32')]:_0xa360b8['model'];_0x4e0529[_0x13d7('0x34')]=qs[_0x13d7('0x35')](_0x192ed0[_0x13d7('0x2e')]['sort']);_0x4e0529[_0x13d7('0x36')]=qs[_0x13d7('0x37')](_['pick'](_0x192ed0[_0x13d7('0x2e')],_0xa360b8['filters']));if(_0x192ed0[_0x13d7('0x2e')][_0x13d7('0x39')]){_0x4e0529[_0x13d7('0x36')]=_[_0x13d7('0x3a')](_0x4e0529[_0x13d7('0x36')],{'$or':_[_0x13d7('0x29')](_0x4e0529[_0x13d7('0x32')],function(_0x4ed3af){var _0x1fe5f4={};_0x1fe5f4[_0x4ed3af]={'$like':'%'+_0x192ed0[_0x13d7('0x2e')][_0x13d7('0x39')]+'%'};return _0x1fe5f4;})});}_0x4e0529=_[_0x13d7('0x3a')]({},_0x4e0529,_0x192ed0[_0x13d7('0x43')]);return _0xdbc910[_0x13d7('0x52')](_0x4e0529);}})['then'](function(_0x330089){if(_0x330089){_0x419e50=_0x330089[_0x13d7('0x42')];if(!_0x192ed0[_0x13d7('0x2e')][_0x13d7('0x50')](_0x13d7('0x33'))){_0x4e0529['limit']=qs[_0x13d7('0x1a')](_0x192ed0['query'][_0x13d7('0x1a')]);_0x4e0529['offset']=qs[_0x13d7('0x17')](_0x192ed0[_0x13d7('0x2e')][_0x13d7('0x17')]);}return _0xdbc910[_0x13d7('0x52')](_0x4e0529);}})[_0x13d7('0x21')](function(_0x4b3120){if(_0x4b3120){return _0x4b3120?{'count':_0x419e50,'rows':_0x4b3120}:null;}})[_0x13d7('0x21')](respondWithResult(_0x394169,null))[_0x13d7('0x3f')](handleError(_0x394169,null));}; \ No newline at end of file +var _0xbb9f=['Action','getActions','eml-format','zip-dir','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','undefined','limit','offset','set','json','apply','reject','save','update','then','get','Triggers','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','addAllCondition','TriggerAllId','Condition','addAnyCondition','getAllConditions','findOne','hasOwnProperty','nolimit','getAnyConditions','addAction'];(function(_0x2c0be1,_0x1e88f2){var _0x3d4bd2=function(_0x2b5497){while(--_0x2b5497){_0x2c0be1['push'](_0x2c0be1['shift']());}};_0x3d4bd2(++_0x1e88f2);}(_0xbb9f,0xc2));var _0xfbb9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbb9f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xfbb9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfbb9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfbb9('0x2'));var BPromise=require(_0xfbb9('0x3'));var Mustache=require('mustache');var util=require(_0xfbb9('0x4'));var path=require('path');var sox=require(_0xfbb9('0x5'));var csv=require(_0xfbb9('0x6'));var ejs=require(_0xfbb9('0x7'));var fs=require('fs');var fs_extra=require(_0xfbb9('0x8'));var _=require(_0xfbb9('0x9'));var squel=require(_0xfbb9('0xa'));var crypto=require(_0xfbb9('0xb'));var jsforce=require(_0xfbb9('0xc'));var deskjs=require(_0xfbb9('0xd'));var toCsv=require(_0xfbb9('0x6'));var querystring=require(_0xfbb9('0xe'));var Papa=require(_0xfbb9('0xf'));var Redis=require(_0xfbb9('0x10'));var authService=require(_0xfbb9('0x11'));var qs=require(_0xfbb9('0x12'));var as=require(_0xfbb9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfbb9('0x14'))(_0xfbb9('0x15'));var utils=require(_0xfbb9('0x16'));var config=require(_0xfbb9('0x17'));var licenseUtil=require(_0xfbb9('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xebec91,_0x124ee1){_0x124ee1=_0x124ee1||0xcc;return function(_0x4beb14){if(_0x4beb14){return _0xebec91[_0xfbb9('0x19')](_0x124ee1);}return _0xebec91['status'](_0x124ee1)[_0xfbb9('0x1a')]();};}function respondWithResult(_0x41521b,_0x33b59){_0x33b59=_0x33b59||0xc8;return function(_0x5f519f){if(_0x5f519f){return _0x41521b[_0xfbb9('0x1b')](_0x33b59)['json'](_0x5f519f);}};}function respondWithFilteredResult(_0x1cb051,_0x502e69){return function(_0x39849c){if(_0x39849c){var _0x31e763=typeof _0x502e69['offset']===_0xfbb9('0x1c')&&typeof _0x502e69[_0xfbb9('0x1d')]===_0xfbb9('0x1c');var _0x2e582d=_0x39849c['count'];var _0x3f9624=_0x31e763?0x0:_0x502e69[_0xfbb9('0x1e')];var _0x52a5ba=_0x31e763?_0x39849c['count']:_0x502e69[_0xfbb9('0x1e')]+_0x502e69['limit'];var _0x4e78dd;if(_0x52a5ba>=_0x2e582d){_0x52a5ba=_0x2e582d;_0x4e78dd=0xc8;}else{_0x4e78dd=0xce;}_0x1cb051[_0xfbb9('0x1b')](_0x4e78dd);return _0x1cb051[_0xfbb9('0x1f')]('Content-Range',_0x3f9624+'-'+_0x52a5ba+'/'+_0x2e582d)[_0xfbb9('0x20')](_0x39849c);}return null;};}function patchUpdates(_0x17d8fc){return function(_0x2a2315){try{jsonpatch[_0xfbb9('0x21')](_0x2a2315,_0x17d8fc,!![]);}catch(_0x17541d){return BPromise[_0xfbb9('0x22')](_0x17541d);}return _0x2a2315[_0xfbb9('0x23')]();};}function saveUpdates(_0x572c50,_0x4a1dd1){return function(_0x5000f6){if(_0x5000f6){return _0x5000f6[_0xfbb9('0x24')](_0x572c50)[_0xfbb9('0x25')](function(_0xe7f6d0){return _0xe7f6d0;});}return null;};}function removeEntity(_0x191890,_0x59f652){return function(_0x42eb79){if(_0x42eb79){return _0x42eb79['destroy']()['then'](function(){var _0x420b96=_0x42eb79[_0xfbb9('0x26')]({'plain':!![]});var _0x17c501=_0xfbb9('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x17c501,'resourceId':_0x420b96['id']}})[_0xfbb9('0x25')](function(){return _0x42eb79;});})[_0xfbb9('0x25')](function(){_0x191890[_0xfbb9('0x1b')](0xcc)[_0xfbb9('0x1a')]();});}};}function handleEntityNotFound(_0x542f82,_0x5dfd72){return function(_0x10f783){if(!_0x10f783){_0x542f82[_0xfbb9('0x19')](0x194);}return _0x10f783;};}function handleError(_0x5e9ab6,_0x152895){_0x152895=_0x152895||0x1f4;return function(_0x415a45){logger['error'](_0x415a45['stack']);if(_0x415a45[_0xfbb9('0x28')]){delete _0x415a45[_0xfbb9('0x28')];}_0x5e9ab6[_0xfbb9('0x1b')](_0x152895)[_0xfbb9('0x29')](_0x415a45);};}exports[_0xfbb9('0x2a')]=function(_0x521523,_0xec4b16){var _0x5a5642={},_0x7b45c5={},_0x4d0603={'count':0x0,'rows':[]};var _0x1c31f7=_[_0xfbb9('0x2b')](db[_0xfbb9('0x2c')][_0xfbb9('0x2d')],function(_0x33f1a2){return{'name':_0x33f1a2[_0xfbb9('0x2e')],'type':_0x33f1a2[_0xfbb9('0x2f')][_0xfbb9('0x30')]};});_0x7b45c5[_0xfbb9('0x31')]=_[_0xfbb9('0x2b')](_0x1c31f7,'name');_0x7b45c5[_0xfbb9('0x32')]=_[_0xfbb9('0x33')](_0x521523[_0xfbb9('0x32')]);_0x7b45c5[_0xfbb9('0x34')]=_[_0xfbb9('0x35')](_0x7b45c5[_0xfbb9('0x31')],_0x7b45c5[_0xfbb9('0x32')]);_0x5a5642[_0xfbb9('0x36')]=_[_0xfbb9('0x35')](_0x7b45c5['model'],qs['fields'](_0x521523[_0xfbb9('0x32')]['fields']));_0x5a5642['attributes']=_0x5a5642[_0xfbb9('0x36')][_0xfbb9('0x37')]?_0x5a5642[_0xfbb9('0x36')]:_0x7b45c5[_0xfbb9('0x31')];if(!_0x521523[_0xfbb9('0x32')]['hasOwnProperty']('nolimit')){_0x5a5642['limit']=qs['limit'](_0x521523[_0xfbb9('0x32')]['limit']);_0x5a5642[_0xfbb9('0x1e')]=qs[_0xfbb9('0x1e')](_0x521523[_0xfbb9('0x32')]['offset']);}_0x5a5642[_0xfbb9('0x38')]=qs[_0xfbb9('0x39')](_0x521523[_0xfbb9('0x32')][_0xfbb9('0x39')]);_0x5a5642['where']=qs[_0xfbb9('0x34')](_[_0xfbb9('0x3a')](_0x521523['query'],_0x7b45c5['filters']),_0x1c31f7);if(_0x521523[_0xfbb9('0x32')][_0xfbb9('0x3b')]){_0x5a5642[_0xfbb9('0x3c')]=_[_0xfbb9('0x3d')](_0x5a5642[_0xfbb9('0x3c')],{'$or':_[_0xfbb9('0x2b')](_0x1c31f7,function(_0x1e51f2){if(_0x1e51f2[_0xfbb9('0x2f')]!==_0xfbb9('0x3e')){var _0x1168a2={};_0x1168a2[_0x1e51f2[_0xfbb9('0x28')]]={'$like':'%'+_0x521523[_0xfbb9('0x32')]['filter']+'%'};return _0x1168a2;}})});}_0x5a5642=_[_0xfbb9('0x3d')]({},_0x5a5642,_0x521523[_0xfbb9('0x3f')]);var _0x19b769={'where':_0x5a5642[_0xfbb9('0x3c')]};return db[_0xfbb9('0x2c')][_0xfbb9('0x40')](_0x19b769)[_0xfbb9('0x25')](function(_0x467460){_0x4d0603['count']=_0x467460;if(_0x521523['query'][_0xfbb9('0x41')]){_0x5a5642[_0xfbb9('0x42')]=[{'all':!![]}];}return db[_0xfbb9('0x2c')]['findAll'](_0x5a5642);})[_0xfbb9('0x25')](function(_0x1c2403){_0x4d0603[_0xfbb9('0x43')]=_0x1c2403;return _0x4d0603;})[_0xfbb9('0x25')](respondWithFilteredResult(_0xec4b16,_0x5a5642))[_0xfbb9('0x44')](handleError(_0xec4b16,null));};exports[_0xfbb9('0x45')]=function(_0x1a121d,_0x109f7d){var _0x5113b8={'raw':![],'where':{'id':_0x1a121d[_0xfbb9('0x46')]['id']}},_0x3c1c0b={};_0x3c1c0b[_0xfbb9('0x31')]=_[_0xfbb9('0x33')](db[_0xfbb9('0x2c')]['rawAttributes']);_0x3c1c0b[_0xfbb9('0x32')]=_[_0xfbb9('0x33')](_0x1a121d[_0xfbb9('0x32')]);_0x3c1c0b[_0xfbb9('0x34')]=_[_0xfbb9('0x35')](_0x3c1c0b[_0xfbb9('0x31')],_0x3c1c0b['query']);_0x5113b8[_0xfbb9('0x36')]=_['intersection'](_0x3c1c0b[_0xfbb9('0x31')],qs[_0xfbb9('0x47')](_0x1a121d['query'][_0xfbb9('0x47')]));_0x5113b8['attributes']=_0x5113b8[_0xfbb9('0x36')][_0xfbb9('0x37')]?_0x5113b8[_0xfbb9('0x36')]:_0x3c1c0b[_0xfbb9('0x31')];if(_0x1a121d[_0xfbb9('0x32')]['includeAll']){_0x5113b8[_0xfbb9('0x42')]=[{'all':!![]}];}_0x5113b8=_[_0xfbb9('0x3d')]({},_0x5113b8,_0x1a121d['options']);return db[_0xfbb9('0x2c')][_0xfbb9('0x48')](_0x5113b8)[_0xfbb9('0x25')](handleEntityNotFound(_0x109f7d,null))[_0xfbb9('0x25')](respondWithResult(_0x109f7d,null))[_0xfbb9('0x44')](handleError(_0x109f7d,null));};exports[_0xfbb9('0x49')]=function(_0x1f1823,_0x5ceea1){return db[_0xfbb9('0x2c')]['create'](_0x1f1823[_0xfbb9('0x4a')],{})[_0xfbb9('0x25')](function(_0x2cd20a){var _0xffa7f9=_0x1f1823[_0xfbb9('0x4b')][_0xfbb9('0x26')]({'plain':!![]});if(!_0xffa7f9)throw new Error(_0xfbb9('0x4c'));if(_0xffa7f9[_0xfbb9('0x4d')]==='user'){var _0x2a2b12=_0x2cd20a[_0xfbb9('0x26')]({'plain':!![]});var _0x1a6770=_0xfbb9('0x27');return db[_0xfbb9('0x4e')][_0xfbb9('0x48')]({'where':{'name':_0x1a6770,'userProfileId':_0xffa7f9['userProfileId']},'raw':!![]})[_0xfbb9('0x25')](function(_0x5aa669){if(_0x5aa669&&_0x5aa669[_0xfbb9('0x4f')]===0x0){return db[_0xfbb9('0x50')][_0xfbb9('0x49')]({'name':_0x2a2b12['name'],'resourceId':_0x2a2b12['id'],'type':_0x5aa669[_0xfbb9('0x28')],'sectionId':_0x5aa669['id']},{})[_0xfbb9('0x25')](function(){return _0x2cd20a;});}else{return _0x2cd20a;}})[_0xfbb9('0x44')](function(_0x3f1e7f){logger[_0xfbb9('0x51')](_0xfbb9('0x52'),_0x3f1e7f);throw _0x3f1e7f;});}return _0x2cd20a;})[_0xfbb9('0x25')](respondWithResult(_0x5ceea1,0xc9))[_0xfbb9('0x44')](handleError(_0x5ceea1,null));};exports[_0xfbb9('0x24')]=function(_0x2a6e4c,_0xff1b60){if(_0x2a6e4c[_0xfbb9('0x4a')]['id']){delete _0x2a6e4c[_0xfbb9('0x4a')]['id'];}return db[_0xfbb9('0x2c')][_0xfbb9('0x48')]({'where':{'id':_0x2a6e4c[_0xfbb9('0x46')]['id']}})[_0xfbb9('0x25')](handleEntityNotFound(_0xff1b60,null))[_0xfbb9('0x25')](saveUpdates(_0x2a6e4c[_0xfbb9('0x4a')],null))['then'](respondWithResult(_0xff1b60,null))[_0xfbb9('0x44')](handleError(_0xff1b60,null));};exports[_0xfbb9('0x53')]=function(_0x48414d,_0x1376cb){return db[_0xfbb9('0x2c')][_0xfbb9('0x48')]({'where':{'id':_0x48414d['params']['id']}})[_0xfbb9('0x25')](handleEntityNotFound(_0x1376cb,null))['then'](removeEntity(_0x1376cb,null))['catch'](handleError(_0x1376cb,null));};exports[_0xfbb9('0x54')]=function(_0xf67bd9,_0xa3ad7a,_0x30cf09){if(_0xf67bd9[_0xfbb9('0x4a')]['id']){delete _0xf67bd9[_0xfbb9('0x4a')]['id'];}return db[_0xfbb9('0x2c')]['find']({'where':{'id':_0xf67bd9[_0xfbb9('0x46')]['id']}})[_0xfbb9('0x25')](handleEntityNotFound(_0xa3ad7a,null))[_0xfbb9('0x25')](function(_0x2cd3c7){if(_0x2cd3c7){_0xf67bd9['body'][_0xfbb9('0x55')]=_0x2cd3c7['id'];return db[_0xfbb9('0x56')][_0xfbb9('0x49')](_0xf67bd9[_0xfbb9('0x4a')]);}})[_0xfbb9('0x25')](respondWithResult(_0xa3ad7a,null))['catch'](handleError(_0xa3ad7a,null));};exports[_0xfbb9('0x57')]=function(_0x4f5030,_0x15ce36,_0x27ddb7){if(_0x4f5030[_0xfbb9('0x4a')]['id']){delete _0x4f5030[_0xfbb9('0x4a')]['id'];}return db[_0xfbb9('0x2c')][_0xfbb9('0x48')]({'where':{'id':_0x4f5030['params']['id']}})[_0xfbb9('0x25')](handleEntityNotFound(_0x15ce36,null))[_0xfbb9('0x25')](function(_0x1f7756){if(_0x1f7756){_0x4f5030[_0xfbb9('0x4a')]['TriggerAnyId']=_0x1f7756['id'];return db[_0xfbb9('0x56')][_0xfbb9('0x49')](_0x4f5030[_0xfbb9('0x4a')]);}})['then'](respondWithResult(_0x15ce36,null))[_0xfbb9('0x44')](handleError(_0x15ce36,null));};exports[_0xfbb9('0x58')]=function(_0x2be222,_0x2cddb5,_0x478cea){var _0x459db6={};var _0x470cdb={};var _0x129662;var _0x4ab6c1;return db['Trigger'][_0xfbb9('0x59')]({'where':{'id':_0x2be222['params']['id']}})[_0xfbb9('0x25')](handleEntityNotFound(_0x2cddb5,null))[_0xfbb9('0x25')](function(_0x50c2a7){if(_0x50c2a7){_0x129662=_0x50c2a7;_0x470cdb[_0xfbb9('0x31')]=_[_0xfbb9('0x33')](db[_0xfbb9('0x56')][_0xfbb9('0x2d')]);_0x470cdb[_0xfbb9('0x32')]=_[_0xfbb9('0x33')](_0x2be222['query']);_0x470cdb['filters']=_[_0xfbb9('0x35')](_0x470cdb['model'],_0x470cdb[_0xfbb9('0x32')]);_0x459db6[_0xfbb9('0x36')]=_[_0xfbb9('0x35')](_0x470cdb[_0xfbb9('0x31')],qs['fields'](_0x2be222[_0xfbb9('0x32')][_0xfbb9('0x47')]));_0x459db6[_0xfbb9('0x36')]=_0x459db6['attributes'][_0xfbb9('0x37')]?_0x459db6[_0xfbb9('0x36')]:_0x470cdb[_0xfbb9('0x31')];_0x459db6[_0xfbb9('0x38')]=qs[_0xfbb9('0x39')](_0x2be222['query']['sort']);_0x459db6[_0xfbb9('0x3c')]=qs['filters'](_['pick'](_0x2be222[_0xfbb9('0x32')],_0x470cdb[_0xfbb9('0x34')]));if(_0x2be222[_0xfbb9('0x32')][_0xfbb9('0x3b')]){_0x459db6[_0xfbb9('0x3c')]=_[_0xfbb9('0x3d')](_0x459db6[_0xfbb9('0x3c')],{'$or':_[_0xfbb9('0x2b')](_0x459db6[_0xfbb9('0x36')],function(_0x3e839f){var _0x1dc5dd={};_0x1dc5dd[_0x3e839f]={'$like':'%'+_0x2be222[_0xfbb9('0x32')][_0xfbb9('0x3b')]+'%'};return _0x1dc5dd;})});}_0x459db6=_[_0xfbb9('0x3d')]({},_0x459db6,_0x2be222[_0xfbb9('0x3f')]);return _0x129662[_0xfbb9('0x58')](_0x459db6);}})[_0xfbb9('0x25')](function(_0x2d252a){if(_0x2d252a){_0x4ab6c1=_0x2d252a[_0xfbb9('0x37')];if(!_0x2be222[_0xfbb9('0x32')][_0xfbb9('0x5a')](_0xfbb9('0x5b'))){_0x459db6[_0xfbb9('0x1d')]=qs[_0xfbb9('0x1d')](_0x2be222['query'][_0xfbb9('0x1d')]);_0x459db6[_0xfbb9('0x1e')]=qs['offset'](_0x2be222['query'][_0xfbb9('0x1e')]);}return _0x129662[_0xfbb9('0x58')](_0x459db6);}})['then'](function(_0x5691f6){if(_0x5691f6){return _0x5691f6?{'count':_0x4ab6c1,'rows':_0x5691f6}:null;}})[_0xfbb9('0x25')](respondWithResult(_0x2cddb5,null))[_0xfbb9('0x44')](handleError(_0x2cddb5,null));};exports['getAnyConditions']=function(_0x5b8793,_0x24cda2,_0x11c290){var _0x190665={};var _0x2d5b08={};var _0x36bd4b;var _0x21c795;return db[_0xfbb9('0x2c')][_0xfbb9('0x59')]({'where':{'id':_0x5b8793['params']['id']}})['then'](handleEntityNotFound(_0x24cda2,null))[_0xfbb9('0x25')](function(_0x460f73){if(_0x460f73){_0x36bd4b=_0x460f73;_0x2d5b08[_0xfbb9('0x31')]=_[_0xfbb9('0x33')](db[_0xfbb9('0x56')]['rawAttributes']);_0x2d5b08[_0xfbb9('0x32')]=_[_0xfbb9('0x33')](_0x5b8793[_0xfbb9('0x32')]);_0x2d5b08[_0xfbb9('0x34')]=_['intersection'](_0x2d5b08[_0xfbb9('0x31')],_0x2d5b08['query']);_0x190665[_0xfbb9('0x36')]=_[_0xfbb9('0x35')](_0x2d5b08['model'],qs[_0xfbb9('0x47')](_0x5b8793[_0xfbb9('0x32')][_0xfbb9('0x47')]));_0x190665[_0xfbb9('0x36')]=_0x190665[_0xfbb9('0x36')][_0xfbb9('0x37')]?_0x190665['attributes']:_0x2d5b08[_0xfbb9('0x31')];_0x190665['order']=qs['sort'](_0x5b8793[_0xfbb9('0x32')]['sort']);_0x190665[_0xfbb9('0x3c')]=qs['filters'](_[_0xfbb9('0x3a')](_0x5b8793[_0xfbb9('0x32')],_0x2d5b08[_0xfbb9('0x34')]));if(_0x5b8793[_0xfbb9('0x32')][_0xfbb9('0x3b')]){_0x190665[_0xfbb9('0x3c')]=_['merge'](_0x190665[_0xfbb9('0x3c')],{'$or':_[_0xfbb9('0x2b')](_0x190665[_0xfbb9('0x36')],function(_0x1bfaf8){var _0x31d895={};_0x31d895[_0x1bfaf8]={'$like':'%'+_0x5b8793[_0xfbb9('0x32')]['filter']+'%'};return _0x31d895;})});}_0x190665=_[_0xfbb9('0x3d')]({},_0x190665,_0x5b8793[_0xfbb9('0x3f')]);return _0x36bd4b[_0xfbb9('0x5c')](_0x190665);}})[_0xfbb9('0x25')](function(_0x1c54da){if(_0x1c54da){_0x21c795=_0x1c54da['length'];if(!_0x5b8793['query'][_0xfbb9('0x5a')](_0xfbb9('0x5b'))){_0x190665[_0xfbb9('0x1d')]=qs[_0xfbb9('0x1d')](_0x5b8793[_0xfbb9('0x32')][_0xfbb9('0x1d')]);_0x190665[_0xfbb9('0x1e')]=qs['offset'](_0x5b8793[_0xfbb9('0x32')]['offset']);}return _0x36bd4b[_0xfbb9('0x5c')](_0x190665);}})[_0xfbb9('0x25')](function(_0x1ab98a){if(_0x1ab98a){return _0x1ab98a?{'count':_0x21c795,'rows':_0x1ab98a}:null;}})[_0xfbb9('0x25')](respondWithResult(_0x24cda2,null))[_0xfbb9('0x44')](handleError(_0x24cda2,null));};exports[_0xfbb9('0x5d')]=function(_0x396a9f,_0x289847,_0x325850){if(_0x396a9f[_0xfbb9('0x4a')]['id']){delete _0x396a9f[_0xfbb9('0x4a')]['id'];}return db[_0xfbb9('0x2c')][_0xfbb9('0x48')]({'where':{'id':_0x396a9f[_0xfbb9('0x46')]['id']}})[_0xfbb9('0x25')](handleEntityNotFound(_0x289847,null))[_0xfbb9('0x25')](function(_0x13ecfc){if(_0x13ecfc){_0x396a9f[_0xfbb9('0x4a')]['TriggerId']=_0x13ecfc['id'];return db[_0xfbb9('0x5e')][_0xfbb9('0x49')](_0x396a9f['body']);}})[_0xfbb9('0x25')](respondWithResult(_0x289847,null))[_0xfbb9('0x44')](handleError(_0x289847,null));};exports['getActions']=function(_0x29f9c8,_0x14ee3a,_0x3d2f5e){var _0x2d4f31={};var _0x29a40c={};var _0x110973;var _0x546f9c;return db[_0xfbb9('0x2c')][_0xfbb9('0x59')]({'where':{'id':_0x29f9c8[_0xfbb9('0x46')]['id']}})[_0xfbb9('0x25')](handleEntityNotFound(_0x14ee3a,null))[_0xfbb9('0x25')](function(_0x3f1ff3){if(_0x3f1ff3){_0x110973=_0x3f1ff3;_0x29a40c[_0xfbb9('0x31')]=_[_0xfbb9('0x33')](db[_0xfbb9('0x5e')][_0xfbb9('0x2d')]);_0x29a40c[_0xfbb9('0x32')]=_[_0xfbb9('0x33')](_0x29f9c8['query']);_0x29a40c[_0xfbb9('0x34')]=_[_0xfbb9('0x35')](_0x29a40c[_0xfbb9('0x31')],_0x29a40c['query']);_0x2d4f31[_0xfbb9('0x36')]=_[_0xfbb9('0x35')](_0x29a40c['model'],qs[_0xfbb9('0x47')](_0x29f9c8[_0xfbb9('0x32')][_0xfbb9('0x47')]));_0x2d4f31['attributes']=_0x2d4f31[_0xfbb9('0x36')]['length']?_0x2d4f31['attributes']:_0x29a40c['model'];_0x2d4f31[_0xfbb9('0x38')]=qs[_0xfbb9('0x39')](_0x29f9c8[_0xfbb9('0x32')][_0xfbb9('0x39')]);_0x2d4f31[_0xfbb9('0x3c')]=qs[_0xfbb9('0x34')](_[_0xfbb9('0x3a')](_0x29f9c8[_0xfbb9('0x32')],_0x29a40c['filters']));if(_0x29f9c8[_0xfbb9('0x32')][_0xfbb9('0x3b')]){_0x2d4f31[_0xfbb9('0x3c')]=_['merge'](_0x2d4f31[_0xfbb9('0x3c')],{'$or':_[_0xfbb9('0x2b')](_0x2d4f31[_0xfbb9('0x36')],function(_0xb3ddcb){var _0x555be8={};_0x555be8[_0xb3ddcb]={'$like':'%'+_0x29f9c8[_0xfbb9('0x32')][_0xfbb9('0x3b')]+'%'};return _0x555be8;})});}_0x2d4f31=_[_0xfbb9('0x3d')]({},_0x2d4f31,_0x29f9c8['options']);return _0x110973[_0xfbb9('0x5f')](_0x2d4f31);}})[_0xfbb9('0x25')](function(_0x2b63fe){if(_0x2b63fe){_0x546f9c=_0x2b63fe[_0xfbb9('0x37')];if(!_0x29f9c8[_0xfbb9('0x32')][_0xfbb9('0x5a')]('nolimit')){_0x2d4f31[_0xfbb9('0x1d')]=qs[_0xfbb9('0x1d')](_0x29f9c8[_0xfbb9('0x32')]['limit']);_0x2d4f31[_0xfbb9('0x1e')]=qs[_0xfbb9('0x1e')](_0x29f9c8[_0xfbb9('0x32')][_0xfbb9('0x1e')]);}return _0x110973[_0xfbb9('0x5f')](_0x2d4f31);}})[_0xfbb9('0x25')](function(_0x4eccbf){if(_0x4eccbf){return _0x4eccbf?{'count':_0x546f9c,'rows':_0x4eccbf}:null;}})['then'](respondWithResult(_0x14ee3a,null))[_0xfbb9('0x44')](handleError(_0x14ee3a,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 62e3115..dc47e39 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 _0x4fde=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./trigger.attributes','exports','define','Trigger','tools_triggers','lodash'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x4fde,0x19f));var _0xe4fd=function(_0x3c59fc,_0x10dbd2){_0x3c59fc=_0x3c59fc-0x0;var _0x2b78d4=_0x4fde[_0x3c59fc];return _0x2b78d4;};'use strict';var _=require(_0xe4fd('0x0'));var util=require(_0xe4fd('0x1'));var logger=require(_0xe4fd('0x2'))(_0xe4fd('0x3'));var moment=require('moment');var BPromise=require(_0xe4fd('0x4'));var rp=require(_0xe4fd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe4fd('0x6'));var config=require(_0xe4fd('0x7'));var attributes=require(_0xe4fd('0x8'));module[_0xe4fd('0x9')]=function(_0x464a19,_0x73219e){return _0x464a19[_0xe4fd('0xa')](_0xe4fd('0xb'),attributes,{'tableName':_0xe4fd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaab2=['api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Trigger','tools_triggers','util','../../config/logger'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xaab2,0xca));var _0x2aab=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xaab2[_0x2d7f0e];return _0x110b07;};'use strict';var _=require('lodash');var util=require(_0x2aab('0x0'));var logger=require(_0x2aab('0x1'))(_0x2aab('0x2'));var moment=require('moment');var BPromise=require(_0x2aab('0x3'));var rp=require(_0x2aab('0x4'));var fs=require('fs');var path=require(_0x2aab('0x5'));var rimraf=require(_0x2aab('0x6'));var config=require(_0x2aab('0x7'));var attributes=require('./trigger.attributes');module[_0x2aab('0x8')]=function(_0x5b35ec,_0x3af395){return _0x5b35ec[_0x2aab('0x9')](_0x2aab('0xa'),attributes,{'tableName':_0x2aab('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 c672c90..3d362d0 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 _0xecaf=['then','info','request\x20sent','debug','stringify','error','code','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger','Trigger','findAll','options','raw','where','limit','include','map','model','attributes','find','ShowTrigger','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x410263,_0xca0aac){var _0x584882=function(_0x338d99){while(--_0x338d99){_0x410263['push'](_0x410263['shift']());}};_0x584882(++_0xca0aac);}(_0xecaf,0xd1));var _0xfeca=function(_0x4d953b,_0x3c85ba){_0x4d953b=_0x4d953b-0x0;var _0x285ec0=_0xecaf[_0x4d953b];return _0x285ec0;};'use strict';var _=require(_0xfeca('0x0'));var util=require(_0xfeca('0x1'));var moment=require(_0xfeca('0x2'));var BPromise=require('bluebird');var rs=require(_0xfeca('0x3'));var fs=require('fs');var Redis=require(_0xfeca('0x4'));var db=require(_0xfeca('0x5'))['db'];var utils=require(_0xfeca('0x6'));var logger=require(_0xfeca('0x7'))(_0xfeca('0x8'));var config=require(_0xfeca('0x9'));var jayson=require(_0xfeca('0xa'));var client=jayson['client'][_0xfeca('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x245591,_0x171ae7,_0x3c06e4){return new BPromise(function(_0x4af177,_0x371cd7){return client[_0xfeca('0xc')](_0x245591,_0x3c06e4)[_0xfeca('0xd')](function(_0x3d5fcd){logger[_0xfeca('0xe')]('Trigger,\x20%s,\x20%s',_0x171ae7,_0xfeca('0xf'));logger[_0xfeca('0x10')]('Trigger,\x20%s,\x20%s,\x20%s',_0x171ae7,_0xfeca('0xf'),JSON[_0xfeca('0x11')](_0x3d5fcd));if(_0x3d5fcd[_0xfeca('0x12')]){if(_0x3d5fcd[_0xfeca('0x12')][_0xfeca('0x13')]===0x1f4){logger['error'](_0xfeca('0x14'),_0x171ae7,_0x3d5fcd[_0xfeca('0x12')][_0xfeca('0x15')]);return _0x371cd7(_0x3d5fcd['error']['message']);}logger[_0xfeca('0x12')](_0xfeca('0x14'),_0x171ae7,_0x3d5fcd[_0xfeca('0x12')][_0xfeca('0x15')]);return _0x4af177(_0x3d5fcd[_0xfeca('0x12')][_0xfeca('0x15')]);}else{logger[_0xfeca('0xe')]('Trigger,\x20%s,\x20%s',_0x171ae7,_0xfeca('0xf'));_0x4af177(_0x3d5fcd[_0xfeca('0x16')][_0xfeca('0x15')]);}})[_0xfeca('0x17')](function(_0x30092c){logger['error'](_0xfeca('0x14'),_0x171ae7,_0x30092c);_0x371cd7(_0x30092c);});});}exports[_0xfeca('0x18')]=function(_0x252800){var _0xda66c=this;return new Promise(function(_0x189c2e,_0x5a909a){return db[_0xfeca('0x19')][_0xfeca('0x1a')]({'raw':_0x252800['options']?_0x252800[_0xfeca('0x1b')][_0xfeca('0x1c')]===undefined?!![]:![]:!![],'where':_0x252800['options']?_0x252800[_0xfeca('0x1b')][_0xfeca('0x1d')]||null:null,'attributes':_0x252800['options']?_0x252800[_0xfeca('0x1b')]['attributes']||null:null,'limit':_0x252800[_0xfeca('0x1b')]?_0x252800[_0xfeca('0x1b')][_0xfeca('0x1e')]||null:null,'include':_0x252800['options']?_0x252800[_0xfeca('0x1b')][_0xfeca('0x1f')]?_[_0xfeca('0x20')](_0x252800[_0xfeca('0x1b')][_0xfeca('0x1f')],function(_0x1fa67f){return{'model':db[_0x1fa67f[_0xfeca('0x21')]],'as':_0x1fa67f['as'],'attributes':_0x1fa67f[_0xfeca('0x22')],'include':_0x1fa67f[_0xfeca('0x1f')]?_[_0xfeca('0x20')](_0x1fa67f['include'],function(_0x399509){return{'model':db[_0x399509[_0xfeca('0x21')]],'as':_0x399509['as'],'attributes':_0x399509[_0xfeca('0x22')],'include':_0x399509[_0xfeca('0x1f')]?_[_0xfeca('0x20')](_0x399509['include'],function(_0x26f438){return{'model':db[_0x26f438[_0xfeca('0x21')]],'as':_0x26f438['as'],'attributes':_0x26f438[_0xfeca('0x22')]};}):[]};}):[]};}):[]:[]})[_0xfeca('0xd')](function(_0x2aa004){logger[_0xfeca('0xe')](_0xfeca('0x18'),_0x252800);logger[_0xfeca('0x10')](_0xfeca('0x18'),_0x252800,JSON[_0xfeca('0x11')](_0x2aa004));_0x189c2e(_0x2aa004);})[_0xfeca('0x17')](function(_0x305bd3){logger[_0xfeca('0x12')](_0xfeca('0x18'),_0x305bd3[_0xfeca('0x15')],_0x252800);_0x5a909a(_0xda66c[_0xfeca('0x12')](0x1f4,_0x305bd3['message']));});});};exports['ShowTrigger']=function(_0x241e6a){var _0x21da80=this;return new Promise(function(_0xe23b08,_0x38e2da){return db[_0xfeca('0x19')][_0xfeca('0x23')]({'raw':_0x241e6a[_0xfeca('0x1b')]?_0x241e6a[_0xfeca('0x1b')][_0xfeca('0x1c')]===undefined?!![]:![]:!![],'where':_0x241e6a[_0xfeca('0x1b')]?_0x241e6a['options'][_0xfeca('0x1d')]||null:null,'attributes':_0x241e6a[_0xfeca('0x1b')]?_0x241e6a[_0xfeca('0x1b')][_0xfeca('0x22')]||null:null,'include':_0x241e6a['options']?_0x241e6a['options'][_0xfeca('0x1f')]?_['map'](_0x241e6a['options'][_0xfeca('0x1f')],function(_0x4e1f28){return{'model':db[_0x4e1f28['model']],'as':_0x4e1f28['as'],'attributes':_0x4e1f28['attributes'],'include':_0x4e1f28[_0xfeca('0x1f')]?_['map'](_0x4e1f28[_0xfeca('0x1f')],function(_0x5459d5){return{'model':db[_0x5459d5[_0xfeca('0x21')]],'as':_0x5459d5['as'],'attributes':_0x5459d5['attributes'],'include':_0x5459d5[_0xfeca('0x1f')]?_[_0xfeca('0x20')](_0x5459d5[_0xfeca('0x1f')],function(_0x3f907e){return{'model':db[_0x3f907e[_0xfeca('0x21')]],'as':_0x3f907e['as'],'attributes':_0x3f907e[_0xfeca('0x22')]};}):[]};}):[]};}):[]:[]})[_0xfeca('0xd')](function(_0x701b53){logger[_0xfeca('0xe')](_0xfeca('0x24'),_0x241e6a);logger[_0xfeca('0x10')](_0xfeca('0x24'),_0x241e6a,JSON['stringify'](_0x701b53));_0xe23b08(_0x701b53);})[_0xfeca('0x17')](function(_0x2ac840){logger[_0xfeca('0x12')](_0xfeca('0x24'),_0x2ac840[_0xfeca('0x15')],_0x241e6a);_0x38e2da(_0x21da80[_0xfeca('0x12')](0x1f4,_0x2ac840[_0xfeca('0x15')]));});});}; \ No newline at end of file +var _0xb768=['error','code','Trigger,\x20%s,\x20%s','message','info','request\x20sent','GetTrigger','Trigger','findAll','options','raw','limit','include','map','attributes','model','debug','catch','ShowTrigger','find','where','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','Trigger,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x490357,_0x34428b){var _0x5d435b=function(_0x124420){while(--_0x124420){_0x490357['push'](_0x490357['shift']());}};_0x5d435b(++_0x34428b);}(_0xb768,0x1ba));var _0x8b76=function(_0x1487e1,_0x4cf4ce){_0x1487e1=_0x1487e1-0x0;var _0x2eab21=_0xb768[_0x1487e1];return _0x2eab21;};'use strict';var _=require(_0x8b76('0x0'));var util=require('util');var moment=require(_0x8b76('0x1'));var BPromise=require(_0x8b76('0x2'));var rs=require(_0x8b76('0x3'));var fs=require('fs');var Redis=require(_0x8b76('0x4'));var db=require(_0x8b76('0x5'))['db'];var utils=require(_0x8b76('0x6'));var logger=require(_0x8b76('0x7'))('rpc');var config=require(_0x8b76('0x8'));var jayson=require(_0x8b76('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x20975e,_0x18ee9f,_0xfd1daf){return new BPromise(function(_0x7c1186,_0x56a1b7){return client[_0x8b76('0xa')](_0x20975e,_0xfd1daf)['then'](function(_0x545091){logger['info']('Trigger,\x20%s,\x20%s',_0x18ee9f,'request\x20sent');logger['debug'](_0x8b76('0xb'),_0x18ee9f,'request\x20sent',JSON[_0x8b76('0xc')](_0x545091));if(_0x545091[_0x8b76('0xd')]){if(_0x545091[_0x8b76('0xd')][_0x8b76('0xe')]===0x1f4){logger[_0x8b76('0xd')](_0x8b76('0xf'),_0x18ee9f,_0x545091['error']['message']);return _0x56a1b7(_0x545091['error']['message']);}logger[_0x8b76('0xd')]('Trigger,\x20%s,\x20%s',_0x18ee9f,_0x545091[_0x8b76('0xd')][_0x8b76('0x10')]);return _0x7c1186(_0x545091['error'][_0x8b76('0x10')]);}else{logger[_0x8b76('0x11')]('Trigger,\x20%s,\x20%s',_0x18ee9f,_0x8b76('0x12'));_0x7c1186(_0x545091['result'][_0x8b76('0x10')]);}})['catch'](function(_0x39dd0f){logger[_0x8b76('0xd')](_0x8b76('0xf'),_0x18ee9f,_0x39dd0f);_0x56a1b7(_0x39dd0f);});});}exports[_0x8b76('0x13')]=function(_0x5c7663){var _0xb83619=this;return new Promise(function(_0x6d3968,_0x1ffae8){return db[_0x8b76('0x14')][_0x8b76('0x15')]({'raw':_0x5c7663['options']?_0x5c7663[_0x8b76('0x16')][_0x8b76('0x17')]===undefined?!![]:![]:!![],'where':_0x5c7663[_0x8b76('0x16')]?_0x5c7663[_0x8b76('0x16')]['where']||null:null,'attributes':_0x5c7663[_0x8b76('0x16')]?_0x5c7663[_0x8b76('0x16')]['attributes']||null:null,'limit':_0x5c7663[_0x8b76('0x16')]?_0x5c7663['options'][_0x8b76('0x18')]||null:null,'include':_0x5c7663[_0x8b76('0x16')]?_0x5c7663[_0x8b76('0x16')][_0x8b76('0x19')]?_[_0x8b76('0x1a')](_0x5c7663['options'][_0x8b76('0x19')],function(_0x22d43c){return{'model':db[_0x22d43c['model']],'as':_0x22d43c['as'],'attributes':_0x22d43c[_0x8b76('0x1b')],'include':_0x22d43c[_0x8b76('0x19')]?_[_0x8b76('0x1a')](_0x22d43c[_0x8b76('0x19')],function(_0x3726a0){return{'model':db[_0x3726a0['model']],'as':_0x3726a0['as'],'attributes':_0x3726a0[_0x8b76('0x1b')],'include':_0x3726a0['include']?_[_0x8b76('0x1a')](_0x3726a0[_0x8b76('0x19')],function(_0x237087){return{'model':db[_0x237087[_0x8b76('0x1c')]],'as':_0x237087['as'],'attributes':_0x237087[_0x8b76('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x28d16b){logger[_0x8b76('0x11')](_0x8b76('0x13'),_0x5c7663);logger[_0x8b76('0x1d')](_0x8b76('0x13'),_0x5c7663,JSON['stringify'](_0x28d16b));_0x6d3968(_0x28d16b);})[_0x8b76('0x1e')](function(_0x24dbac){logger[_0x8b76('0xd')](_0x8b76('0x13'),_0x24dbac[_0x8b76('0x10')],_0x5c7663);_0x1ffae8(_0xb83619[_0x8b76('0xd')](0x1f4,_0x24dbac[_0x8b76('0x10')]));});});};exports[_0x8b76('0x1f')]=function(_0x34064d){var _0x11d485=this;return new Promise(function(_0x29987a,_0x4c8581){return db[_0x8b76('0x14')][_0x8b76('0x20')]({'raw':_0x34064d[_0x8b76('0x16')]?_0x34064d[_0x8b76('0x16')][_0x8b76('0x17')]===undefined?!![]:![]:!![],'where':_0x34064d[_0x8b76('0x16')]?_0x34064d[_0x8b76('0x16')][_0x8b76('0x21')]||null:null,'attributes':_0x34064d['options']?_0x34064d[_0x8b76('0x16')][_0x8b76('0x1b')]||null:null,'include':_0x34064d['options']?_0x34064d['options'][_0x8b76('0x19')]?_[_0x8b76('0x1a')](_0x34064d[_0x8b76('0x16')]['include'],function(_0x45512a){return{'model':db[_0x45512a[_0x8b76('0x1c')]],'as':_0x45512a['as'],'attributes':_0x45512a['attributes'],'include':_0x45512a['include']?_[_0x8b76('0x1a')](_0x45512a[_0x8b76('0x19')],function(_0x1be8f3){return{'model':db[_0x1be8f3[_0x8b76('0x1c')]],'as':_0x1be8f3['as'],'attributes':_0x1be8f3['attributes'],'include':_0x1be8f3[_0x8b76('0x19')]?_[_0x8b76('0x1a')](_0x1be8f3[_0x8b76('0x19')],function(_0x33b39b){return{'model':db[_0x33b39b['model']],'as':_0x33b39b['as'],'attributes':_0x33b39b[_0x8b76('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8b76('0x22')](function(_0x5e749f){logger[_0x8b76('0x11')]('ShowTrigger',_0x34064d);logger[_0x8b76('0x1d')](_0x8b76('0x1f'),_0x34064d,JSON[_0x8b76('0xc')](_0x5e749f));_0x29987a(_0x5e749f);})[_0x8b76('0x1e')](function(_0x5961a9){logger['error'](_0x8b76('0x1f'),_0x5961a9['message'],_0x34064d);_0x4c8581(_0x11d485['error'](0x1f4,_0x5961a9['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 0fdd320..d2b7fcd 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 _0xa79c=['exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','/:id/clone','create','destroy'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0xa79c,0x145));var _0xca79=function(_0x3aa2c0,_0x5f1793){_0x3aa2c0=_0x3aa2c0-0x0;var _0x59c92f=_0xa79c[_0x3aa2c0];return _0x59c92f;};'use strict';var multer=require(_0xca79('0x0'));var util=require(_0xca79('0x1'));var path=require('path');var timeout=require(_0xca79('0x2'));var express=require(_0xca79('0x3'));var router=express['Router']();var fs_extra=require(_0xca79('0x4'));var auth=require(_0xca79('0x5'));var interaction=require(_0xca79('0x6'));var config=require(_0xca79('0x7'));var controller=require('./trunk.controller');router[_0xca79('0x8')]('/',auth[_0xca79('0x9')](),controller[_0xca79('0xa')]);router['get'](_0xca79('0xb'),auth['isAuthenticated'](),controller[_0xca79('0xc')]);router[_0xca79('0xd')](_0xca79('0xe'),auth[_0xca79('0x9')](),controller['clone']);router[_0xca79('0xd')]('/',auth[_0xca79('0x9')](),controller[_0xca79('0xf')]);router['put'](_0xca79('0xb'),auth[_0xca79('0x9')](),controller['update']);router['delete'](_0xca79('0xb'),auth[_0xca79('0x9')](),controller[_0xca79('0x10')]);module[_0xca79('0x11')]=router; \ No newline at end of file +var _0x11f1=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x789166,_0x4941e4){var _0x1fcb38=function(_0x419105){while(--_0x419105){_0x789166['push'](_0x789166['shift']());}};_0x1fcb38(++_0x4941e4);}(_0x11f1,0x7c));var _0x111f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x11f1[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x111f('0x0'));var util=require(_0x111f('0x1'));var path=require(_0x111f('0x2'));var timeout=require(_0x111f('0x3'));var express=require(_0x111f('0x4'));var router=express[_0x111f('0x5')]();var fs_extra=require(_0x111f('0x6'));var auth=require(_0x111f('0x7'));var interaction=require(_0x111f('0x8'));var config=require('../../config/environment');var controller=require('./trunk.controller');router['get']('/',auth[_0x111f('0x9')](),controller[_0x111f('0xa')]);router[_0x111f('0xb')](_0x111f('0xc'),auth['isAuthenticated'](),controller[_0x111f('0xd')]);router[_0x111f('0xe')]('/:id/clone',auth[_0x111f('0x9')](),controller['clone']);router[_0x111f('0xe')]('/',auth[_0x111f('0x9')](),controller[_0x111f('0xf')]);router[_0x111f('0x10')](_0x111f('0xc'),auth[_0x111f('0x9')](),controller[_0x111f('0x11')]);router[_0x111f('0x12')](_0x111f('0xc'),auth[_0x111f('0x9')](),controller[_0x111f('0x13')]);module[_0x111f('0x14')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 26c1c4e..23ad6e0 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 _0xe3bf=['join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','rfc2833','update','outgoing','yes','nat','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','never','INTEGER','always','accept','uac','uas','pai','fingerprint','active','passive','actpass','dynamic','nonat','BOOLEAN','sequelize','exports','name','ENUM','friend','peer','STRING','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','setDataValue','transport'];(function(_0x4c0f9a,_0x1efd44){var _0x9dec53=function(_0x1512d7){while(--_0x1512d7){_0x4c0f9a['push'](_0x4c0f9a['shift']());}};_0x9dec53(++_0x1efd44);}(_0xe3bf,0x7d));var _0xfe3b=function(_0x395f78,_0x582ad4){_0x395f78=_0x395f78-0x0;var _0x1319ca=_0xe3bf[_0x395f78];return _0x1319ca;};'use strict';var Sequelize=require(_0xfe3b('0x0'));module[_0xfe3b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xfe3b('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xfe3b('0x3')](_0xfe3b('0x4'),'user',_0xfe3b('0x5')),'allowNull':![],'defaultValue':_0xfe3b('0x4')},'context':{'type':Sequelize[_0xfe3b('0x6')],'allowNull':![],'defaultValue':_0xfe3b('0x7')},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED',_0xfe3b('0x8'),_0xfe3b('0x9'),_0xfe3b('0xa'),_0xfe3b('0xb'),_0xfe3b('0xc'),'PROHIB_FAILED_SCREEN',_0xfe3b('0xd'))},'deny':{'type':Sequelize[_0xfe3b('0x6')]},'permit':{'type':Sequelize[_0xfe3b('0x6')]},'secret':{'type':Sequelize[_0xfe3b('0x6')]},'md5secret':{'type':Sequelize[_0xfe3b('0x6')]},'remotesecret':{'type':Sequelize[_0xfe3b('0x6')]},'transport':{'type':Sequelize[_0xfe3b('0x6')],'defaultValue':'udp','set':function(_0x4af5e8){this[_0xfe3b('0xe')](_0xfe3b('0xf'),_0x4af5e8?_0x4af5e8[_0xfe3b('0x10')](','):null);},'get':function(){return this[_0xfe3b('0x11')](_0xfe3b('0xf'))?this[_0xfe3b('0x11')](_0xfe3b('0xf'))[_0xfe3b('0x12')](','):null;},'comment':_0xfe3b('0x13')},'dtmfmode':{'type':Sequelize[_0xfe3b('0x3')]('rfc2833',_0xfe3b('0x14'),_0xfe3b('0x15'),_0xfe3b('0x16'),'auto'),'defaultValue':_0xfe3b('0x17')},'directmedia':{'type':Sequelize['ENUM']('yes','no','nonat',_0xfe3b('0x18'),_0xfe3b('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xfe3b('0x3')](_0xfe3b('0x1a'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xfe3b('0x6')]},'directmediadeny':{'type':Sequelize[_0xfe3b('0x6')]},'nat':{'type':Sequelize[_0xfe3b('0x6')],'defaultValue':'force_rport,comedia','set':function(_0x2e4462){this[_0xfe3b('0xe')](_0xfe3b('0x1b'),_0x2e4462?_0x2e4462[_0xfe3b('0x10')](','):null);},'get':function(){return this[_0xfe3b('0x11')](_0xfe3b('0x1b'))?this[_0xfe3b('0x11')](_0xfe3b('0x1b'))[_0xfe3b('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xfe3b('0x6')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xfe3b('0x6')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xfe3b('0x6')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xfe3b('0x6')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xfe3b('0x6')],'defaultValue':'all'},'allow':{'type':Sequelize[_0xfe3b('0x6')],'allowNull':![],'defaultValue':_0xfe3b('0x1c'),'set':function(_0x57db1c){this['setDataValue'](_0xfe3b('0x1d'),_0x57db1c?_0x57db1c[_0xfe3b('0x10')](';'):_0xfe3b('0x1c'));},'get':function(){return this[_0xfe3b('0x11')](_0xfe3b('0x1d'))?this['getDataValue']('allow')[_0xfe3b('0x12')](';'):null;},'comment':_0xfe3b('0x1e')},'autoframing':{'type':Sequelize[_0xfe3b('0x3')](_0xfe3b('0x1a'),'no')},'insecure':{'type':Sequelize[_0xfe3b('0x6')],'defaultValue':_0xfe3b('0x1f'),'set':function(_0x553e82){this['setDataValue'](_0xfe3b('0x20'),_0x553e82?_0x553e82['join'](','):null);},'get':function(){return this['getDataValue'](_0xfe3b('0x20'))?this['getDataValue'](_0xfe3b('0x20'))[_0xfe3b('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xfe3b('0x3')](_0xfe3b('0x1a'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xfe3b('0x3')]('yes','no',_0xfe3b('0x21'))},'promiscredir':{'type':Sequelize[_0xfe3b('0x3')](_0xfe3b('0x1a'),'no')},'useclientcode':{'type':Sequelize[_0xfe3b('0x3')]('yes','no')},'accountcode':{'type':Sequelize[_0xfe3b('0x22')](0xb)},'setvar':{'type':Sequelize[_0xfe3b('0x6')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xfe3b('0x6')]},'callcounter':{'type':Sequelize[_0xfe3b('0x3')](_0xfe3b('0x1a'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xfe3b('0x22')](0xb)},'allowoverlap':{'type':Sequelize[_0xfe3b('0x3')](_0xfe3b('0x1a'),'no')},'allowsubscribe':{'type':Sequelize[_0xfe3b('0x3')](_0xfe3b('0x1a'),'no')},'allowtransfer':{'type':Sequelize[_0xfe3b('0x3')](_0xfe3b('0x1a'),'no')},'ignoresdpversion':{'type':Sequelize[_0xfe3b('0x3')](_0xfe3b('0x1a'),'no')},'subscribecontext':{'type':Sequelize[_0xfe3b('0x6')]},'template':{'type':Sequelize[_0xfe3b('0x6')]},'videosupport':{'type':Sequelize[_0xfe3b('0x3')](_0xfe3b('0x1a'),'no',_0xfe3b('0x23')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0xfe3b('0x3')](_0xfe3b('0x1a'),'no')},'mailbox':{'type':Sequelize[_0xfe3b('0x6')]},'session_timers':{'type':Sequelize['ENUM'](_0xfe3b('0x24'),'refuse','originate')},'session_expires':{'type':Sequelize[_0xfe3b('0x22')](0xb)},'session_minse':{'type':Sequelize[_0xfe3b('0x22')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0xfe3b('0x25'),_0xfe3b('0x26')),'defaultValue':_0xfe3b('0x26')},'t38pt_usertpsource':{'type':Sequelize[_0xfe3b('0x6')]},'regexten':{'type':Sequelize[_0xfe3b('0x6')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0xfe3b('0x6')]},'port':{'type':Sequelize[_0xfe3b('0x22')](0x5)},'qualify':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xfe3b('0x22')](0xb)},'defaultip':{'type':Sequelize[_0xfe3b('0x6')]},'defaultuser':{'type':Sequelize[_0xfe3b('0x6')]},'rtptimeout':{'type':Sequelize[_0xfe3b('0x22')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xfe3b('0x22')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xfe3b('0x22')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0xfe3b('0x1a'),'no',_0xfe3b('0x27')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xfe3b('0x6')]},'callbackextension':{'type':Sequelize[_0xfe3b('0x6')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0xfe3b('0x22')](0xb)},'contactpermit':{'type':Sequelize[_0xfe3b('0x6')]},'contactdeny':{'type':Sequelize[_0xfe3b('0x6')]},'contactacl':{'type':Sequelize[_0xfe3b('0x6')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0xfe3b('0x6')]},'maxforwards':{'type':Sequelize[_0xfe3b('0x22')](0xb)},'encryption':{'type':Sequelize[_0xfe3b('0x3')](_0xfe3b('0x1a'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xfe3b('0x3')](_0xfe3b('0x1a'),'no')},'force_avp':{'type':Sequelize[_0xfe3b('0x3')](_0xfe3b('0x1a'),'no')},'icesupport':{'type':Sequelize[_0xfe3b('0x3')]('yes','no')},'dtlsenable':{'type':Sequelize[_0xfe3b('0x3')](_0xfe3b('0x1a'),'no')},'dtlsverify':{'type':Sequelize[_0xfe3b('0x3')]('yes','no',_0xfe3b('0x28'),'certificate')},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0xfe3b('0x6')]},'dtlsprivatekey':{'type':Sequelize[_0xfe3b('0x6')]},'dtlscipher':{'type':Sequelize[_0xfe3b('0x6')]},'dtlscafile':{'type':Sequelize[_0xfe3b('0x6')]},'dtlscapath':{'type':Sequelize[_0xfe3b('0x6')]},'dtlssetup':{'type':Sequelize[_0xfe3b('0x3')](_0xfe3b('0x29'),_0xfe3b('0x2a'),_0xfe3b('0x2b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xfe3b('0x3')](_0xfe3b('0x1a'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xfe3b('0x6')]},'recordofffeature':{'type':Sequelize[_0xfe3b('0x6')]},'call_limit':{'type':Sequelize[_0xfe3b('0x22')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0xfe3b('0x1a'),'no')},'subscribemwi':{'type':Sequelize[_0xfe3b('0x3')]('yes','no')},'vmexten':{'type':Sequelize[_0xfe3b('0x6')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0xfe3b('0x6')]},'description':{'type':Sequelize[_0xfe3b('0x6')]},'host':{'type':Sequelize[_0xfe3b('0x6')],'defaultValue':_0xfe3b('0x2c')},'canreinvite':{'type':Sequelize[_0xfe3b('0x3')](_0xfe3b('0x1a'),'no',_0xfe3b('0x2d'),_0xfe3b('0x18'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0xfe3b('0x6')]},'otherFields':{'type':Sequelize[_0xfe3b('0x6')]},'active':{'type':Sequelize[_0xfe3b('0x2e')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xfe3b('0x6')],'defaultValue':'no'}}; \ No newline at end of file +var _0xc098=['ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','port,invite','insecure','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','uac','uas','pai','fingerprint','certificate','active','dynamic','update','update,nonat','BOOLEAN','sequelize','exports','STRING','name','friend','peer','from-voip-provider','ENUM'];(function(_0x12adf0,_0x2ae018){var _0x195152=function(_0x3afd8e){while(--_0x3afd8e){_0x12adf0['push'](_0x12adf0['shift']());}};_0x195152(++_0x2ae018);}(_0xc098,0xf7));var _0x8c09=function(_0x37962d,_0xcde842){_0x37962d=_0x37962d-0x0;var _0x30330d=_0xc098[_0x37962d];return _0x30330d;};'use strict';var Sequelize=require(_0x8c09('0x0'));module[_0x8c09('0x1')]={'name':{'type':Sequelize[_0x8c09('0x2')],'allowNull':![],'unique':_0x8c09('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x8c09('0x4'),'user',_0x8c09('0x5')),'allowNull':![],'defaultValue':_0x8c09('0x4')},'context':{'type':Sequelize[_0x8c09('0x2')],'allowNull':![],'defaultValue':_0x8c09('0x6')},'callingpres':{'type':Sequelize[_0x8c09('0x7')](_0x8c09('0x8'),_0x8c09('0x9'),_0x8c09('0xa'),_0x8c09('0xb'),_0x8c09('0xc'),_0x8c09('0xd'),_0x8c09('0xe'),_0x8c09('0xf'))},'deny':{'type':Sequelize[_0x8c09('0x2')]},'permit':{'type':Sequelize[_0x8c09('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x8c09('0x2')]},'remotesecret':{'type':Sequelize[_0x8c09('0x2')]},'transport':{'type':Sequelize[_0x8c09('0x2')],'defaultValue':_0x8c09('0x10'),'set':function(_0x4d7816){this[_0x8c09('0x11')](_0x8c09('0x12'),_0x4d7816?_0x4d7816[_0x8c09('0x13')](','):null);},'get':function(){return this['getDataValue']('transport')?this['getDataValue']('transport')[_0x8c09('0x14')](','):null;},'comment':_0x8c09('0x15')},'dtmfmode':{'type':Sequelize[_0x8c09('0x7')](_0x8c09('0x16'),_0x8c09('0x17'),_0x8c09('0x18'),_0x8c09('0x19'),_0x8c09('0x1a')),'defaultValue':_0x8c09('0x16')},'directmedia':{'type':Sequelize[_0x8c09('0x7')](_0x8c09('0x1b'),'no',_0x8c09('0x1c'),'update','outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x8c09('0x7')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x8c09('0x2')]},'directmediadeny':{'type':Sequelize[_0x8c09('0x2')]},'nat':{'type':Sequelize[_0x8c09('0x2')],'defaultValue':'force_rport,comedia','set':function(_0xf54ee8){this[_0x8c09('0x11')]('nat',_0xf54ee8?_0xf54ee8[_0x8c09('0x13')](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0x8c09('0x1d')]('nat')[_0x8c09('0x14')](','):null;},'comment':_0x8c09('0x1e')},'callgroup':{'type':Sequelize[_0x8c09('0x2')]},'namedcallgroup':{'type':Sequelize[_0x8c09('0x2')]},'pickupgroup':{'type':Sequelize[_0x8c09('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x8c09('0x2')]},'language':{'type':Sequelize[_0x8c09('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':'all'},'allow':{'type':Sequelize[_0x8c09('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x6d5e0d){this[_0x8c09('0x11')]('allow',_0x6d5e0d?_0x6d5e0d[_0x8c09('0x13')](';'):_0x8c09('0x1f'));},'get':function(){return this[_0x8c09('0x1d')](_0x8c09('0x20'))?this['getDataValue']('allow')[_0x8c09('0x14')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x8c09('0x7')]('yes','no')},'insecure':{'type':Sequelize[_0x8c09('0x2')],'defaultValue':_0x8c09('0x21'),'set':function(_0x2d4a1e){this[_0x8c09('0x11')]('insecure',_0x2d4a1e?_0x2d4a1e[_0x8c09('0x13')](','):null);},'get':function(){return this[_0x8c09('0x1d')](_0x8c09('0x22'))?this[_0x8c09('0x1d')](_0x8c09('0x22'))[_0x8c09('0x14')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x8c09('0x7')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x8c09('0x1b'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x8c09('0x7')](_0x8c09('0x1b'),'no',_0x8c09('0x23'))},'promiscredir':{'type':Sequelize[_0x8c09('0x7')](_0x8c09('0x1b'),'no')},'useclientcode':{'type':Sequelize[_0x8c09('0x7')](_0x8c09('0x1b'),'no')},'accountcode':{'type':Sequelize[_0x8c09('0x24')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x8c09('0x25')},'amaflags':{'type':Sequelize[_0x8c09('0x2')]},'callcounter':{'type':Sequelize[_0x8c09('0x7')](_0x8c09('0x1b'),'no'),'defaultValue':_0x8c09('0x1b')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x8c09('0x7')](_0x8c09('0x1b'),'no')},'allowsubscribe':{'type':Sequelize[_0x8c09('0x7')](_0x8c09('0x1b'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x8c09('0x1b'),'no')},'ignoresdpversion':{'type':Sequelize[_0x8c09('0x7')](_0x8c09('0x1b'),'no')},'subscribecontext':{'type':Sequelize[_0x8c09('0x2')]},'template':{'type':Sequelize[_0x8c09('0x2')]},'videosupport':{'type':Sequelize[_0x8c09('0x7')](_0x8c09('0x1b'),'no',_0x8c09('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x8c09('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x8c09('0x7')](_0x8c09('0x1b'),'no')},'mailbox':{'type':Sequelize[_0x8c09('0x2')]},'session_timers':{'type':Sequelize[_0x8c09('0x7')](_0x8c09('0x27'),_0x8c09('0x28'),'originate')},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x8c09('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0x8c09('0x7')](_0x8c09('0x29'),'uas'),'defaultValue':_0x8c09('0x2a')},'t38pt_usertpsource':{'type':Sequelize[_0x8c09('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x8c09('0x24')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x8c09('0x1b'),'no'),'defaultValue':_0x8c09('0x1b')},'keepalive':{'type':Sequelize[_0x8c09('0x24')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x8c09('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x8c09('0x24')](0xb)},'sendrpid':{'type':Sequelize['ENUM']('yes','no',_0x8c09('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x8c09('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x8c09('0x24')](0xb)},'timerb':{'type':Sequelize[_0x8c09('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0x8c09('0x24')](0xb)},'contactpermit':{'type':Sequelize[_0x8c09('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x8c09('0x2')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x8c09('0x2')]},'maxforwards':{'type':Sequelize[_0x8c09('0x24')](0xb)},'encryption':{'type':Sequelize[_0x8c09('0x7')](_0x8c09('0x1b'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x8c09('0x7')](_0x8c09('0x1b'),'no')},'force_avp':{'type':Sequelize[_0x8c09('0x7')](_0x8c09('0x1b'),'no')},'icesupport':{'type':Sequelize[_0x8c09('0x7')](_0x8c09('0x1b'),'no')},'dtlsenable':{'type':Sequelize[_0x8c09('0x7')](_0x8c09('0x1b'),'no')},'dtlsverify':{'type':Sequelize[_0x8c09('0x7')](_0x8c09('0x1b'),'no',_0x8c09('0x2c'),_0x8c09('0x2d'))},'dtlsrekey':{'type':Sequelize[_0x8c09('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0x8c09('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x8c09('0x2')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x8c09('0x2')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x8c09('0x7')](_0x8c09('0x2e'),'passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x8c09('0x2')]},'usereqphone':{'type':Sequelize[_0x8c09('0x7')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x8c09('0x2')]},'recordofffeature':{'type':Sequelize[_0x8c09('0x2')]},'call_limit':{'type':Sequelize[_0x8c09('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x8c09('0x7')]('yes','no')},'subscribemwi':{'type':Sequelize[_0x8c09('0x7')]('yes','no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x8c09('0x2')]},'mohsuggest':{'type':Sequelize[_0x8c09('0x2')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8c09('0x2')]},'host':{'type':Sequelize[_0x8c09('0x2')],'defaultValue':_0x8c09('0x2f')},'canreinvite':{'type':Sequelize[_0x8c09('0x7')]('yes','no',_0x8c09('0x1c'),_0x8c09('0x30'),_0x8c09('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x8c09('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x8c09('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 4d4cbe1..d16b27a 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 _0x81bd=['/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','update','server/files/templates/trunk.ejs','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','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','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','destroy','UserProfileResource','name','index','Trunk','rawAttributes','fieldName','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','clone','find','get','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Trunks','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/registry.ejs','utf8','writeFileSync'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x81bd,0x7c));var _0xd81b=function(_0x19b5c0,_0x18ca6d){_0x19b5c0=_0x19b5c0-0x0;var _0x2fb804=_0x81bd[_0x19b5c0];return _0x2fb804;};'use strict';var emlformat=require(_0xd81b('0x0'));var rimraf=require(_0xd81b('0x1'));var zipdir=require(_0xd81b('0x2'));var jsonpatch=require(_0xd81b('0x3'));var rp=require(_0xd81b('0x4'));var moment=require(_0xd81b('0x5'));var BPromise=require(_0xd81b('0x6'));var Mustache=require('mustache');var util=require(_0xd81b('0x7'));var path=require(_0xd81b('0x8'));var sox=require(_0xd81b('0x9'));var csv=require('to-csv');var ejs=require(_0xd81b('0xa'));var fs=require('fs');var fs_extra=require(_0xd81b('0xb'));var _=require(_0xd81b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd81b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd81b('0xe'));var querystring=require(_0xd81b('0xf'));var Papa=require(_0xd81b('0x10'));var Redis=require(_0xd81b('0x11'));var authService=require(_0xd81b('0x12'));var qs=require(_0xd81b('0x13'));var as=require(_0xd81b('0x14'));var hardwareService=require(_0xd81b('0x15'));var logger=require(_0xd81b('0x16'))(_0xd81b('0x17'));var utils=require(_0xd81b('0x18'));var config=require(_0xd81b('0x19'));var licenseUtil=require(_0xd81b('0x1a'));var db=require('../../mysqldb')['db'];var jayson=require(_0xd81b('0x1b'));var client=jayson['client'][_0xd81b('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xe75568,_0x5f0b6b,_0x35a053,_0x47dd04){return new BPromise(function(_0x13dd00,_0x41bf7a){var _0x6c6041=_0x47dd04||client;return _0x6c6041[_0xd81b('0x1d')](_0xe75568,_0x35a053)[_0xd81b('0x1e')](function(_0x552215){logger[_0xd81b('0x1f')](_0xd81b('0x20'),_0x5f0b6b,'request\x20sent');logger[_0xd81b('0x21')](_0xd81b('0x22'),_0x5f0b6b,_0xd81b('0x23'),JSON[_0xd81b('0x24')](_0x552215));if(_0x552215[_0xd81b('0x25')]){if(_0x552215[_0xd81b('0x25')][_0xd81b('0x26')]===0x1f4){logger[_0xd81b('0x25')](_0xd81b('0x20'),_0x5f0b6b,_0x552215[_0xd81b('0x25')][_0xd81b('0x27')]);return _0x41bf7a(_0x552215[_0xd81b('0x25')][_0xd81b('0x27')]);}logger[_0xd81b('0x25')](_0xd81b('0x20'),_0x5f0b6b,_0x552215[_0xd81b('0x25')]['message']);return _0x13dd00(_0x552215['error'][_0xd81b('0x27')]);}else{logger[_0xd81b('0x1f')](_0xd81b('0x20'),_0x5f0b6b,'request\x20sent');_0x13dd00(_0x552215[_0xd81b('0x28')][_0xd81b('0x27')]);}})['catch'](function(_0xcd6474){logger[_0xd81b('0x25')](_0xd81b('0x20'),_0x5f0b6b,_0xcd6474);_0x41bf7a(_0xcd6474);});});}function respondWithStatusCode(_0x1ad65c,_0x279176){_0x279176=_0x279176||0xcc;return function(_0xcb4f91){if(_0xcb4f91){return _0x1ad65c[_0xd81b('0x29')](_0x279176);}return _0x1ad65c[_0xd81b('0x2a')](_0x279176)[_0xd81b('0x2b')]();};}function respondWithResult(_0x212c4e,_0x2ccedf){_0x2ccedf=_0x2ccedf||0xc8;return function(_0x1bf351){if(_0x1bf351){return _0x212c4e['status'](_0x2ccedf)[_0xd81b('0x2c')](_0x1bf351);}};}function respondWithFilteredResult(_0x99dbc9,_0xe3637a){return function(_0x31b9fd){if(_0x31b9fd){var _0x3266c2=typeof _0xe3637a[_0xd81b('0x2d')]===_0xd81b('0x2e')&&typeof _0xe3637a[_0xd81b('0x2f')]===_0xd81b('0x2e');var _0x483a3d=_0x31b9fd[_0xd81b('0x30')];var _0x4e2eff=_0x3266c2?0x0:_0xe3637a['offset'];var _0xb9ff9f=_0x3266c2?_0x31b9fd[_0xd81b('0x30')]:_0xe3637a['offset']+_0xe3637a['limit'];var _0x4093c8;if(_0xb9ff9f>=_0x483a3d){_0xb9ff9f=_0x483a3d;_0x4093c8=0xc8;}else{_0x4093c8=0xce;}_0x99dbc9[_0xd81b('0x2a')](_0x4093c8);return _0x99dbc9[_0xd81b('0x31')](_0xd81b('0x32'),_0x4e2eff+'-'+_0xb9ff9f+'/'+_0x483a3d)[_0xd81b('0x2c')](_0x31b9fd);}return null;};}function patchUpdates(_0x4654ba){return function(_0x5527ed){try{jsonpatch[_0xd81b('0x33')](_0x5527ed,_0x4654ba,!![]);}catch(_0x26f629){return BPromise['reject'](_0x26f629);}return _0x5527ed['save']();};}function saveUpdates(_0x165892,_0x1966b1){return function(_0x50472a){if(_0x50472a){return _0x50472a['update'](_0x165892)['then'](function(_0x322991){return _0x322991;});}return null;};}function removeEntity(_0x3ead68,_0x1d2f46){return function(_0x1c4cf7){if(_0x1c4cf7){return _0x1c4cf7[_0xd81b('0x34')]()[_0xd81b('0x1e')](function(){var _0x29aabf=_0x1c4cf7['get']({'plain':!![]});var _0x28782f='Trunks';return db[_0xd81b('0x35')][_0xd81b('0x34')]({'where':{'type':_0x28782f,'resourceId':_0x29aabf['id']}})[_0xd81b('0x1e')](function(){return _0x1c4cf7;});})[_0xd81b('0x1e')](function(){_0x3ead68[_0xd81b('0x2a')](0xcc)[_0xd81b('0x2b')]();});}};}function handleEntityNotFound(_0x1c20d3,_0x2d23b9){return function(_0xf9d1a5){if(!_0xf9d1a5){_0x1c20d3[_0xd81b('0x29')](0x194);}return _0xf9d1a5;};}function handleError(_0x1be4e2,_0x3c8371){_0x3c8371=_0x3c8371||0x1f4;return function(_0x346038){logger['error'](_0x346038['stack']);if(_0x346038[_0xd81b('0x36')]){delete _0x346038[_0xd81b('0x36')];}_0x1be4e2[_0xd81b('0x2a')](_0x3c8371)['send'](_0x346038);};}exports[_0xd81b('0x37')]=function(_0x37ba34,_0x5a236a){var _0x46f058={},_0xaa9e97={},_0x512e39={'count':0x0,'rows':[]};var _0xed5272=_['map'](db[_0xd81b('0x38')][_0xd81b('0x39')],function(_0x203365){return{'name':_0x203365[_0xd81b('0x3a')],'type':_0x203365['type'][_0xd81b('0x3b')]};});_0xaa9e97[_0xd81b('0x3c')]=_[_0xd81b('0x3d')](_0xed5272,_0xd81b('0x36'));_0xaa9e97[_0xd81b('0x3e')]=_[_0xd81b('0x3f')](_0x37ba34[_0xd81b('0x3e')]);_0xaa9e97['filters']=_[_0xd81b('0x40')](_0xaa9e97[_0xd81b('0x3c')],_0xaa9e97[_0xd81b('0x3e')]);_0x46f058['attributes']=_[_0xd81b('0x40')](_0xaa9e97[_0xd81b('0x3c')],qs[_0xd81b('0x41')](_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x41')]));_0x46f058['attributes']=_0x46f058[_0xd81b('0x42')][_0xd81b('0x43')]?_0x46f058[_0xd81b('0x42')]:_0xaa9e97[_0xd81b('0x3c')];if(!_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x44')](_0xd81b('0x45'))){_0x46f058[_0xd81b('0x2f')]=qs[_0xd81b('0x2f')](_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x2f')]);_0x46f058['offset']=qs[_0xd81b('0x2d')](_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x2d')]);}_0x46f058[_0xd81b('0x46')]=qs[_0xd81b('0x47')](_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x47')]);_0x46f058[_0xd81b('0x48')]=qs['filters'](_['pick'](_0x37ba34[_0xd81b('0x3e')],_0xaa9e97[_0xd81b('0x49')]),_0xed5272);if(_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x4a')]){_0x46f058[_0xd81b('0x48')]=_[_0xd81b('0x4b')](_0x46f058[_0xd81b('0x48')],{'$or':_[_0xd81b('0x3d')](_0xed5272,function(_0x2fa588){if(_0x2fa588[_0xd81b('0x4c')]!==_0xd81b('0x4d')){var _0x38e436={};_0x38e436[_0x2fa588['name']]={'$like':'%'+_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x4a')]+'%'};return _0x38e436;}})});}_0x46f058=_[_0xd81b('0x4b')]({},_0x46f058,_0x37ba34[_0xd81b('0x4e')]);var _0x105a48={'where':_0x46f058[_0xd81b('0x48')]};return db[_0xd81b('0x38')][_0xd81b('0x30')](_0x105a48)[_0xd81b('0x1e')](function(_0x53ea36){_0x512e39[_0xd81b('0x30')]=_0x53ea36;if(_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x4f')]){_0x46f058[_0xd81b('0x50')]=[{'all':!![]}];}return db['Trunk'][_0xd81b('0x51')](_0x46f058);})[_0xd81b('0x1e')](function(_0x15030b){_0x512e39[_0xd81b('0x52')]=_0x15030b;return _0x512e39;})[_0xd81b('0x1e')](respondWithFilteredResult(_0x5a236a,_0x46f058))[_0xd81b('0x53')](handleError(_0x5a236a,null));};exports[_0xd81b('0x54')]=function(_0x43d7ce,_0x133a76){var _0x49cba6={'raw':![],'where':{'id':_0x43d7ce[_0xd81b('0x55')]['id']}},_0x534d10={};_0x534d10[_0xd81b('0x3c')]=_[_0xd81b('0x3f')](db[_0xd81b('0x38')][_0xd81b('0x39')]);_0x534d10[_0xd81b('0x3e')]=_[_0xd81b('0x3f')](_0x43d7ce[_0xd81b('0x3e')]);_0x534d10['filters']=_[_0xd81b('0x40')](_0x534d10[_0xd81b('0x3c')],_0x534d10[_0xd81b('0x3e')]);_0x49cba6[_0xd81b('0x42')]=_[_0xd81b('0x40')](_0x534d10['model'],qs[_0xd81b('0x41')](_0x43d7ce[_0xd81b('0x3e')]['fields']));_0x49cba6[_0xd81b('0x42')]=_0x49cba6[_0xd81b('0x42')][_0xd81b('0x43')]?_0x49cba6[_0xd81b('0x42')]:_0x534d10[_0xd81b('0x3c')];if(_0x43d7ce[_0xd81b('0x3e')][_0xd81b('0x4f')]){_0x49cba6[_0xd81b('0x50')]=[{'all':!![]}];}_0x49cba6=_[_0xd81b('0x4b')]({},_0x49cba6,_0x43d7ce[_0xd81b('0x4e')]);return db[_0xd81b('0x38')]['find'](_0x49cba6)[_0xd81b('0x1e')](handleEntityNotFound(_0x133a76,null))['then'](respondWithResult(_0x133a76,null))[_0xd81b('0x53')](handleError(_0x133a76,null));};exports[_0xd81b('0x56')]=function(_0x390db6,_0x3c2a9f){var _0x34d2a2={'where':{'id':_0x390db6['params']['id']}},_0x1e9f73={};_0x1e9f73[_0xd81b('0x3c')]=_[_0xd81b('0x3f')](db['Trunk']['rawAttributes']);_0x34d2a2[_0xd81b('0x42')]=_['intersection'](_0x1e9f73[_0xd81b('0x3c')],qs['fields'](_0x390db6[_0xd81b('0x3e')][_0xd81b('0x41')]));_0x34d2a2[_0xd81b('0x42')]=_0x34d2a2['attributes'][_0xd81b('0x43')]?_0x34d2a2[_0xd81b('0x42')]:_0x1e9f73['model'];if(_0x390db6[_0xd81b('0x3e')][_0xd81b('0x4f')]){_0x34d2a2['include']=[{'all':!![]}];}_0x34d2a2=_[_0xd81b('0x4b')]({},_0x34d2a2,_0x390db6['options']);return db[_0xd81b('0x38')][_0xd81b('0x57')](_0x34d2a2)[_0xd81b('0x1e')](handleEntityNotFound(_0x3c2a9f,null))[_0xd81b('0x1e')](function(_0x4add79){if(_0x4add79){var _0x32eab4=_0x4add79[_0xd81b('0x58')]({'plain':!![]});_0x32eab4=qs[_0xd81b('0x59')](_0x32eab4,['id',_0xd81b('0x5a'),_0xd81b('0x5b')]);_0x390db6['body']=_[_0xd81b('0x59')](_0x390db6[_0xd81b('0x5c')],['id',_0xd81b('0x5a'),_0xd81b('0x5b')]);return db[_0xd81b('0x38')][_0xd81b('0x5d')](_[_0xd81b('0x4b')](_0x32eab4,_0x390db6['body']),{'include':_0x390db6['query']['includeAll']?[{'all':!![]}]:undefined})[_0xd81b('0x1e')](function(_0x12b0bf){var _0x37507e=_0x390db6[_0xd81b('0x5e')][_0xd81b('0x58')]({'plain':!![]});if(!_0x37507e)throw new Error(_0xd81b('0x5f'));if(_0x37507e[_0xd81b('0x60')]==='user'){var _0x3fcd8c=_0x12b0bf[_0xd81b('0x58')]({'plain':!![]});var _0x35c9cf=_0xd81b('0x61');return db[_0xd81b('0x62')][_0xd81b('0x57')]({'where':{'name':_0x35c9cf,'userProfileId':_0x37507e[_0xd81b('0x63')]},'raw':!![]})['then'](function(_0x14b187){if(_0x14b187&&_0x14b187[_0xd81b('0x64')]===0x0){return db[_0xd81b('0x35')][_0xd81b('0x5d')]({'name':_0x3fcd8c[_0xd81b('0x36')],'resourceId':_0x3fcd8c['id'],'type':_0x14b187[_0xd81b('0x36')],'sectionId':_0x14b187['id']},{})[_0xd81b('0x1e')](function(){return _0x12b0bf;});}else{return _0x12b0bf;}})[_0xd81b('0x53')](function(_0x8fa8cd){logger[_0xd81b('0x25')](_0xd81b('0x65'),_0x8fa8cd);throw _0x8fa8cd;});}return _0x12b0bf;});}})[_0xd81b('0x1e')](respondWithResult(_0x3c2a9f,0xc9))['catch'](handleError(_0x3c2a9f,null));};exports[_0xd81b('0x5d')]=function(_0x5358a6,_0x2e7141,_0x6fa974){var _0x414f40;return db[_0xd81b('0x38')][_0xd81b('0x5d')](_0x5358a6[_0xd81b('0x5c')],{'raw':!![]})[_0xd81b('0x1e')](function(_0x18f2ac){_0x414f40=_0x18f2ac;return db[_0xd81b('0x38')][_0xd81b('0x51')]({'raw':!![]});})['then'](function(_0xfa2a13){var _0x344c32=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config[_0xd81b('0x68')],'server/files/templates/trunk.ejs'),'utf8');var _0x3274d2=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config[_0xd81b('0x68')],_0xd81b('0x69')),_0xd81b('0x6a'));var _0xaee7e3=ejs['render'](_0x344c32,{'trunks':_0xfa2a13||[]});fs[_0xd81b('0x6b')](_0xd81b('0x6c'),_0xaee7e3);if(_0x414f40[_0xd81b('0x6d')]){var _0x1c6ec8=ejs[_0xd81b('0x6e')](_0x3274d2,{'trunks':_0xfa2a13||[]});fs[_0xd81b('0x6b')](_0xd81b('0x6f'),_0x1c6ec8);}})[_0xd81b('0x1e')](function(){return respondWithRpcPromise(_0xd81b('0x70'),'create',{'module':_0xd81b('0x71')});})[_0xd81b('0x1e')](function(){var _0x3858eb=_0x5358a6[_0xd81b('0x5e')][_0xd81b('0x58')]({'plain':!![]});if(!_0x3858eb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3858eb[_0xd81b('0x60')]===_0xd81b('0x5e')){var _0x4cc440=_0x414f40[_0xd81b('0x58')]({'plain':!![]});return db[_0xd81b('0x62')]['find']({'where':{'name':_0xd81b('0x61'),'userProfileId':_0x3858eb[_0xd81b('0x63')]},'raw':!![]})[_0xd81b('0x1e')](function(_0x483026){if(_0x483026&&_0x483026[_0xd81b('0x64')]===0x0){return db[_0xd81b('0x35')][_0xd81b('0x5d')]({'name':_0x4cc440['name'],'resourceId':_0x4cc440['id'],'type':_0x483026['name'],'sectionId':_0x483026['id']},{})[_0xd81b('0x1e')](function(){return _0x414f40;});}else{return _0x414f40;}})[_0xd81b('0x53')](function(_0x36c694){logger['error'](_0xd81b('0x65'),_0x36c694);throw _0x36c694;});}return _0x414f40;})[_0xd81b('0x1e')](respondWithResult(_0x2e7141,0xc9))[_0xd81b('0x53')](handleError(_0x2e7141,null));};exports[_0xd81b('0x72')]=function(_0x524196,_0x4f69a7,_0x42ae01){var _0x256696;return db[_0xd81b('0x38')][_0xd81b('0x57')]({'where':{'id':_0x524196['params']['id']}})[_0xd81b('0x1e')](handleEntityNotFound(_0x4f69a7,null))[_0xd81b('0x1e')](saveUpdates(_0x524196['body'],null))[_0xd81b('0x1e')](function(_0x4e5bf4){if(_0x4e5bf4){_0x256696=_0x4e5bf4;return db[_0xd81b('0x38')][_0xd81b('0x51')]({'raw':!![]});}})['then'](function(_0x1be0e6){if(_0x1be0e6){var _0x9a9634=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config[_0xd81b('0x68')],'server/files/templates/trunk.ejs'),_0xd81b('0x6a'));var _0xc0e137=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config[_0xd81b('0x68')],_0xd81b('0x69')),'utf8');var _0x5c8ea0=ejs[_0xd81b('0x6e')](_0x9a9634,{'trunks':_0x1be0e6||[]});fs[_0xd81b('0x6b')](_0xd81b('0x6c'),_0x5c8ea0);var _0x15aed5=ejs['render'](_0xc0e137,{'trunks':_0x1be0e6||[]});fs[_0xd81b('0x6b')](_0xd81b('0x6f'),_0x15aed5);return respondWithRpcPromise(_0xd81b('0x70'),_0xd81b('0x72'),{'module':_0xd81b('0x71')});}return null;})['then'](function(_0x3744bf){if(_0x3744bf){return _0x256696;}})[_0xd81b('0x1e')](respondWithResult(_0x4f69a7,null))[_0xd81b('0x53')](handleError(_0x4f69a7,null));};exports[_0xd81b('0x34')]=function(_0x1d596c,_0x288124,_0x402eb9){var _0x57179a;return db[_0xd81b('0x38')][_0xd81b('0x57')]({'where':{'id':_0x1d596c[_0xd81b('0x55')]['id']}})[_0xd81b('0x1e')](handleEntityNotFound(_0x288124,null))[_0xd81b('0x1e')](removeEntity(_0x288124,null))[_0xd81b('0x1e')](function(){return db['Trunk'][_0xd81b('0x51')]({'raw':!![]});})['then'](function(_0x11e590){var _0x9e6e05=fs[_0xd81b('0x66')](path['join'](config[_0xd81b('0x68')],_0xd81b('0x73')),_0xd81b('0x6a'));var _0x5060dc=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config['root'],_0xd81b('0x69')),'utf8');var _0x5f5514=ejs[_0xd81b('0x6e')](_0x9e6e05,{'trunks':_0x11e590});var _0x428317=ejs[_0xd81b('0x6e')](_0x5060dc,{'trunks':_0x11e590});fs['writeFileSync'](_0xd81b('0x6c'),_0x5f5514);fs[_0xd81b('0x6b')](_0xd81b('0x6f'),_0x428317);return respondWithRpcPromise(_0xd81b('0x70'),_0xd81b('0x34'),{'module':_0xd81b('0x71')});})['catch'](handleError(_0x288124,null));}; \ No newline at end of file +var _0xdace=['../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','jayson/promise','client','http','request','then','info','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','Trunk,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','get','Trunks','UserProfileResource','destroy','stack','name','send','index','Trunk','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','merge','includeAll','include','rows','show','params','keys','find','clone','options','omit','createdAt','updatedAt','body','create','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','writeFileSync','registry','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','findAll','Reload','update','/etc/asterisk/sip_xcally_trunks.conf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs'];(function(_0x1592ac,_0x537d4f){var _0x55d2b9=function(_0x5f25f3){while(--_0x5f25f3){_0x1592ac['push'](_0x1592ac['shift']());}};_0x55d2b9(++_0x537d4f);}(_0xdace,0xc5));var _0xedac=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0xdace[_0x3ea913];return _0x2b4f28;};'use strict';var emlformat=require(_0xedac('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xedac('0x1'));var jsonpatch=require(_0xedac('0x2'));var rp=require(_0xedac('0x3'));var moment=require('moment');var BPromise=require(_0xedac('0x4'));var Mustache=require(_0xedac('0x5'));var util=require(_0xedac('0x6'));var path=require(_0xedac('0x7'));var sox=require('sox');var csv=require(_0xedac('0x8'));var ejs=require(_0xedac('0x9'));var fs=require('fs');var fs_extra=require(_0xedac('0xa'));var _=require('lodash');var squel=require(_0xedac('0xb'));var crypto=require(_0xedac('0xc'));var jsforce=require(_0xedac('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xedac('0x8'));var querystring=require(_0xedac('0xe'));var Papa=require(_0xedac('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xedac('0x10'));var as=require(_0xedac('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xedac('0x12'));var utils=require(_0xedac('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xedac('0x14'));var db=require('../../mysqldb')['db'];var jayson=require(_0xedac('0x15'));var client=jayson[_0xedac('0x16')][_0xedac('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x342186,_0x9a79a0,_0x473c3e,_0x28444a){return new BPromise(function(_0x11f0b0,_0x593030){var _0x110546=_0x28444a||client;return _0x110546[_0xedac('0x18')](_0x342186,_0x473c3e)[_0xedac('0x19')](function(_0x2676c3){logger[_0xedac('0x1a')]('Trunk,\x20%s,\x20%s',_0x9a79a0,_0xedac('0x1b'));logger['debug'](_0xedac('0x1c'),_0x9a79a0,_0xedac('0x1b'),JSON[_0xedac('0x1d')](_0x2676c3));if(_0x2676c3[_0xedac('0x1e')]){if(_0x2676c3['error']['code']===0x1f4){logger[_0xedac('0x1e')](_0xedac('0x1f'),_0x9a79a0,_0x2676c3[_0xedac('0x1e')][_0xedac('0x20')]);return _0x593030(_0x2676c3['error']['message']);}logger[_0xedac('0x1e')](_0xedac('0x1f'),_0x9a79a0,_0x2676c3[_0xedac('0x1e')][_0xedac('0x20')]);return _0x11f0b0(_0x2676c3[_0xedac('0x1e')][_0xedac('0x20')]);}else{logger[_0xedac('0x1a')](_0xedac('0x1f'),_0x9a79a0,'request\x20sent');_0x11f0b0(_0x2676c3[_0xedac('0x21')]['message']);}})[_0xedac('0x22')](function(_0x14fc02){logger['error'](_0xedac('0x1f'),_0x9a79a0,_0x14fc02);_0x593030(_0x14fc02);});});}function respondWithStatusCode(_0x404b8d,_0x1c87bf){_0x1c87bf=_0x1c87bf||0xcc;return function(_0x1e5e47){if(_0x1e5e47){return _0x404b8d[_0xedac('0x23')](_0x1c87bf);}return _0x404b8d[_0xedac('0x24')](_0x1c87bf)['end']();};}function respondWithResult(_0x3114a1,_0x87d343){_0x87d343=_0x87d343||0xc8;return function(_0x37563f){if(_0x37563f){return _0x3114a1[_0xedac('0x24')](_0x87d343)[_0xedac('0x25')](_0x37563f);}};}function respondWithFilteredResult(_0x453a3c,_0x40ba53){return function(_0x26c6f7){if(_0x26c6f7){var _0x409825=typeof _0x40ba53[_0xedac('0x26')]==='undefined'&&typeof _0x40ba53[_0xedac('0x27')]===_0xedac('0x28');var _0x19aed3=_0x26c6f7['count'];var _0x313e06=_0x409825?0x0:_0x40ba53['offset'];var _0x524514=_0x409825?_0x26c6f7[_0xedac('0x29')]:_0x40ba53[_0xedac('0x26')]+_0x40ba53[_0xedac('0x27')];var _0x14522a;if(_0x524514>=_0x19aed3){_0x524514=_0x19aed3;_0x14522a=0xc8;}else{_0x14522a=0xce;}_0x453a3c['status'](_0x14522a);return _0x453a3c['set'](_0xedac('0x2a'),_0x313e06+'-'+_0x524514+'/'+_0x19aed3)[_0xedac('0x25')](_0x26c6f7);}return null;};}function patchUpdates(_0x24b182){return function(_0x2ee8d7){try{jsonpatch[_0xedac('0x2b')](_0x2ee8d7,_0x24b182,!![]);}catch(_0x17fcf3){return BPromise[_0xedac('0x2c')](_0x17fcf3);}return _0x2ee8d7['save']();};}function saveUpdates(_0x3bc910,_0x26418a){return function(_0x2cbe33){if(_0x2cbe33){return _0x2cbe33['update'](_0x3bc910)[_0xedac('0x19')](function(_0x1213dc){return _0x1213dc;});}return null;};}function removeEntity(_0x5665d8,_0x3583cd){return function(_0x2c622a){if(_0x2c622a){return _0x2c622a['destroy']()[_0xedac('0x19')](function(){var _0x1e82da=_0x2c622a[_0xedac('0x2d')]({'plain':!![]});var _0x195f78=_0xedac('0x2e');return db[_0xedac('0x2f')][_0xedac('0x30')]({'where':{'type':_0x195f78,'resourceId':_0x1e82da['id']}})[_0xedac('0x19')](function(){return _0x2c622a;});})[_0xedac('0x19')](function(){_0x5665d8[_0xedac('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9ef574,_0xf5cd99){return function(_0x2a87ae){if(!_0x2a87ae){_0x9ef574[_0xedac('0x23')](0x194);}return _0x2a87ae;};}function handleError(_0x15815e,_0x1d2f45){_0x1d2f45=_0x1d2f45||0x1f4;return function(_0x107431){logger[_0xedac('0x1e')](_0x107431[_0xedac('0x31')]);if(_0x107431[_0xedac('0x32')]){delete _0x107431[_0xedac('0x32')];}_0x15815e[_0xedac('0x24')](_0x1d2f45)[_0xedac('0x33')](_0x107431);};}exports[_0xedac('0x34')]=function(_0xcf7c0c,_0x527878){var _0x1ddcc1={},_0x42c2c9={},_0x20d997={'count':0x0,'rows':[]};var _0x27481c=_['map'](db[_0xedac('0x35')][_0xedac('0x36')],function(_0x16b9d5){return{'name':_0x16b9d5['fieldName'],'type':_0x16b9d5[_0xedac('0x37')][_0xedac('0x38')]};});_0x42c2c9[_0xedac('0x39')]=_['map'](_0x27481c,_0xedac('0x32'));_0x42c2c9[_0xedac('0x3a')]=_['keys'](_0xcf7c0c[_0xedac('0x3a')]);_0x42c2c9[_0xedac('0x3b')]=_['intersection'](_0x42c2c9[_0xedac('0x39')],_0x42c2c9['query']);_0x1ddcc1[_0xedac('0x3c')]=_[_0xedac('0x3d')](_0x42c2c9[_0xedac('0x39')],qs[_0xedac('0x3e')](_0xcf7c0c[_0xedac('0x3a')][_0xedac('0x3e')]));_0x1ddcc1['attributes']=_0x1ddcc1[_0xedac('0x3c')][_0xedac('0x3f')]?_0x1ddcc1[_0xedac('0x3c')]:_0x42c2c9[_0xedac('0x39')];if(!_0xcf7c0c[_0xedac('0x3a')][_0xedac('0x40')](_0xedac('0x41'))){_0x1ddcc1[_0xedac('0x27')]=qs[_0xedac('0x27')](_0xcf7c0c[_0xedac('0x3a')][_0xedac('0x27')]);_0x1ddcc1[_0xedac('0x26')]=qs[_0xedac('0x26')](_0xcf7c0c[_0xedac('0x3a')][_0xedac('0x26')]);}_0x1ddcc1[_0xedac('0x42')]=qs['sort'](_0xcf7c0c[_0xedac('0x3a')][_0xedac('0x43')]);_0x1ddcc1[_0xedac('0x44')]=qs['filters'](_['pick'](_0xcf7c0c['query'],_0x42c2c9[_0xedac('0x3b')]),_0x27481c);if(_0xcf7c0c[_0xedac('0x3a')]['filter']){_0x1ddcc1[_0xedac('0x44')]=_['merge'](_0x1ddcc1[_0xedac('0x44')],{'$or':_['map'](_0x27481c,function(_0x13d51d){if(_0x13d51d[_0xedac('0x37')]!==_0xedac('0x45')){var _0x114b2e={};_0x114b2e[_0x13d51d[_0xedac('0x32')]]={'$like':'%'+_0xcf7c0c['query']['filter']+'%'};return _0x114b2e;}})});}_0x1ddcc1=_[_0xedac('0x46')]({},_0x1ddcc1,_0xcf7c0c['options']);var _0x39b159={'where':_0x1ddcc1[_0xedac('0x44')]};return db[_0xedac('0x35')]['count'](_0x39b159)[_0xedac('0x19')](function(_0x45189f){_0x20d997[_0xedac('0x29')]=_0x45189f;if(_0xcf7c0c['query'][_0xedac('0x47')]){_0x1ddcc1[_0xedac('0x48')]=[{'all':!![]}];}return db[_0xedac('0x35')]['findAll'](_0x1ddcc1);})['then'](function(_0x2cb3ca){_0x20d997[_0xedac('0x49')]=_0x2cb3ca;return _0x20d997;})['then'](respondWithFilteredResult(_0x527878,_0x1ddcc1))['catch'](handleError(_0x527878,null));};exports[_0xedac('0x4a')]=function(_0x38425e,_0x4e81bc){var _0x16a45a={'raw':![],'where':{'id':_0x38425e[_0xedac('0x4b')]['id']}},_0x4e0638={};_0x4e0638[_0xedac('0x39')]=_[_0xedac('0x4c')](db[_0xedac('0x35')][_0xedac('0x36')]);_0x4e0638[_0xedac('0x3a')]=_['keys'](_0x38425e[_0xedac('0x3a')]);_0x4e0638[_0xedac('0x3b')]=_['intersection'](_0x4e0638[_0xedac('0x39')],_0x4e0638[_0xedac('0x3a')]);_0x16a45a[_0xedac('0x3c')]=_['intersection'](_0x4e0638['model'],qs[_0xedac('0x3e')](_0x38425e[_0xedac('0x3a')]['fields']));_0x16a45a[_0xedac('0x3c')]=_0x16a45a[_0xedac('0x3c')][_0xedac('0x3f')]?_0x16a45a[_0xedac('0x3c')]:_0x4e0638[_0xedac('0x39')];if(_0x38425e[_0xedac('0x3a')][_0xedac('0x47')]){_0x16a45a[_0xedac('0x48')]=[{'all':!![]}];}_0x16a45a=_['merge']({},_0x16a45a,_0x38425e['options']);return db[_0xedac('0x35')][_0xedac('0x4d')](_0x16a45a)[_0xedac('0x19')](handleEntityNotFound(_0x4e81bc,null))['then'](respondWithResult(_0x4e81bc,null))[_0xedac('0x22')](handleError(_0x4e81bc,null));};exports[_0xedac('0x4e')]=function(_0x5cb635,_0x4f44e){var _0x276c23={'where':{'id':_0x5cb635['params']['id']}},_0x4bc336={};_0x4bc336['model']=_[_0xedac('0x4c')](db['Trunk'][_0xedac('0x36')]);_0x276c23['attributes']=_['intersection'](_0x4bc336[_0xedac('0x39')],qs[_0xedac('0x3e')](_0x5cb635[_0xedac('0x3a')][_0xedac('0x3e')]));_0x276c23[_0xedac('0x3c')]=_0x276c23['attributes'][_0xedac('0x3f')]?_0x276c23['attributes']:_0x4bc336[_0xedac('0x39')];if(_0x5cb635[_0xedac('0x3a')][_0xedac('0x47')]){_0x276c23[_0xedac('0x48')]=[{'all':!![]}];}_0x276c23=_[_0xedac('0x46')]({},_0x276c23,_0x5cb635[_0xedac('0x4f')]);return db[_0xedac('0x35')]['find'](_0x276c23)[_0xedac('0x19')](handleEntityNotFound(_0x4f44e,null))[_0xedac('0x19')](function(_0x1e1847){if(_0x1e1847){var _0xbc0ff5=_0x1e1847[_0xedac('0x2d')]({'plain':!![]});_0xbc0ff5=qs[_0xedac('0x50')](_0xbc0ff5,['id',_0xedac('0x51'),_0xedac('0x52')]);_0x5cb635[_0xedac('0x53')]=_[_0xedac('0x50')](_0x5cb635['body'],['id','createdAt',_0xedac('0x52')]);return db[_0xedac('0x35')][_0xedac('0x54')](_[_0xedac('0x46')](_0xbc0ff5,_0x5cb635[_0xedac('0x53')]),{'include':_0x5cb635['query'][_0xedac('0x47')]?[{'all':!![]}]:undefined})['then'](function(_0x8d20e7){var _0x15b168=_0x5cb635['user']['get']({'plain':!![]});if(!_0x15b168)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15b168[_0xedac('0x55')]===_0xedac('0x56')){var _0x2523bb=_0x8d20e7[_0xedac('0x2d')]({'plain':!![]});var _0x103632=_0xedac('0x2e');return db[_0xedac('0x57')][_0xedac('0x4d')]({'where':{'name':_0x103632,'userProfileId':_0x15b168[_0xedac('0x58')]},'raw':!![]})[_0xedac('0x19')](function(_0x4fdff8){if(_0x4fdff8&&_0x4fdff8[_0xedac('0x59')]===0x0){return db[_0xedac('0x2f')]['create']({'name':_0x2523bb[_0xedac('0x32')],'resourceId':_0x2523bb['id'],'type':_0x4fdff8[_0xedac('0x32')],'sectionId':_0x4fdff8['id']},{})[_0xedac('0x19')](function(){return _0x8d20e7;});}else{return _0x8d20e7;}})[_0xedac('0x22')](function(_0x32d9d8){logger[_0xedac('0x1e')](_0xedac('0x5a'),_0x32d9d8);throw _0x32d9d8;});}return _0x8d20e7;});}})[_0xedac('0x19')](respondWithResult(_0x4f44e,0xc9))[_0xedac('0x22')](handleError(_0x4f44e,null));};exports[_0xedac('0x54')]=function(_0xd34f0c,_0x207b40,_0x77fc48){var _0x3a1d68;return db[_0xedac('0x35')][_0xedac('0x54')](_0xd34f0c[_0xedac('0x53')],{'raw':!![]})[_0xedac('0x19')](function(_0x493214){_0x3a1d68=_0x493214;return db[_0xedac('0x35')]['findAll']({'raw':!![]});})[_0xedac('0x19')](function(_0x5458c3){var _0x2380ee=fs[_0xedac('0x5b')](path[_0xedac('0x5c')](config[_0xedac('0x5d')],_0xedac('0x5e')),_0xedac('0x5f'));var _0x58ad68=fs[_0xedac('0x5b')](path[_0xedac('0x5c')](config[_0xedac('0x5d')],_0xedac('0x60')),_0xedac('0x5f'));var _0x300f52=ejs['render'](_0x2380ee,{'trunks':_0x5458c3||[]});fs[_0xedac('0x61')]('/etc/asterisk/sip_xcally_trunks.conf',_0x300f52);if(_0x3a1d68[_0xedac('0x62')]){var _0x218670=ejs[_0xedac('0x63')](_0x58ad68,{'trunks':_0x5458c3||[]});fs['writeFileSync'](_0xedac('0x64'),_0x218670);}})['then'](function(){return respondWithRpcPromise('Reload',_0xedac('0x54'),{'module':_0xedac('0x65')});})[_0xedac('0x19')](function(){var _0x104c27=_0xd34f0c[_0xedac('0x56')]['get']({'plain':!![]});if(!_0x104c27)throw new Error(_0xedac('0x66'));if(_0x104c27['role']===_0xedac('0x56')){var _0x358032=_0x3a1d68[_0xedac('0x2d')]({'plain':!![]});return db[_0xedac('0x57')][_0xedac('0x4d')]({'where':{'name':_0xedac('0x2e'),'userProfileId':_0x104c27['userProfileId']},'raw':!![]})[_0xedac('0x19')](function(_0x1242a2){if(_0x1242a2&&_0x1242a2[_0xedac('0x59')]===0x0){return db[_0xedac('0x2f')][_0xedac('0x54')]({'name':_0x358032[_0xedac('0x32')],'resourceId':_0x358032['id'],'type':_0x1242a2[_0xedac('0x32')],'sectionId':_0x1242a2['id']},{})[_0xedac('0x19')](function(){return _0x3a1d68;});}else{return _0x3a1d68;}})[_0xedac('0x22')](function(_0x134a7a){logger[_0xedac('0x1e')](_0xedac('0x5a'),_0x134a7a);throw _0x134a7a;});}return _0x3a1d68;})['then'](respondWithResult(_0x207b40,0xc9))[_0xedac('0x22')](handleError(_0x207b40,null));};exports['update']=function(_0x5cba66,_0xdf86e8,_0x484b6b){var _0x197dad;return db[_0xedac('0x35')]['find']({'where':{'id':_0x5cba66[_0xedac('0x4b')]['id']}})['then'](handleEntityNotFound(_0xdf86e8,null))[_0xedac('0x19')](saveUpdates(_0x5cba66['body'],null))[_0xedac('0x19')](function(_0x5e512f){if(_0x5e512f){_0x197dad=_0x5e512f;return db[_0xedac('0x35')][_0xedac('0x67')]({'raw':!![]});}})['then'](function(_0x1dfc0b){if(_0x1dfc0b){var _0x4cec80=fs[_0xedac('0x5b')](path[_0xedac('0x5c')](config[_0xedac('0x5d')],_0xedac('0x5e')),_0xedac('0x5f'));var _0x4be552=fs[_0xedac('0x5b')](path['join'](config[_0xedac('0x5d')],_0xedac('0x60')),_0xedac('0x5f'));var _0x448066=ejs[_0xedac('0x63')](_0x4cec80,{'trunks':_0x1dfc0b||[]});fs[_0xedac('0x61')]('/etc/asterisk/sip_xcally_trunks.conf',_0x448066);var _0x1d8f28=ejs[_0xedac('0x63')](_0x4be552,{'trunks':_0x1dfc0b||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x1d8f28);return respondWithRpcPromise(_0xedac('0x68'),_0xedac('0x69'),{'module':_0xedac('0x65')});}return null;})[_0xedac('0x19')](function(_0x5ad133){if(_0x5ad133){return _0x197dad;}})['then'](respondWithResult(_0xdf86e8,null))[_0xedac('0x22')](handleError(_0xdf86e8,null));};exports[_0xedac('0x30')]=function(_0x4dd9bd,_0x3926ed,_0x472e8a){var _0x3b25ef;return db[_0xedac('0x35')][_0xedac('0x4d')]({'where':{'id':_0x4dd9bd[_0xedac('0x4b')]['id']}})[_0xedac('0x19')](handleEntityNotFound(_0x3926ed,null))[_0xedac('0x19')](removeEntity(_0x3926ed,null))[_0xedac('0x19')](function(){return db[_0xedac('0x35')]['findAll']({'raw':!![]});})[_0xedac('0x19')](function(_0x22c47b){var _0x230d51=fs[_0xedac('0x5b')](path[_0xedac('0x5c')](config['root'],_0xedac('0x5e')),_0xedac('0x5f'));var _0x35a3c4=fs[_0xedac('0x5b')](path['join'](config['root'],_0xedac('0x60')),_0xedac('0x5f'));var _0x1f541a=ejs[_0xedac('0x63')](_0x230d51,{'trunks':_0x22c47b});var _0x20f7e6=ejs[_0xedac('0x63')](_0x35a3c4,{'trunks':_0x22c47b});fs[_0xedac('0x61')](_0xedac('0x6a'),_0x1f541a);fs[_0xedac('0x61')](_0xedac('0x64'),_0x20f7e6);return respondWithRpcPromise(_0xedac('0x68'),_0xedac('0x30'),{'module':'chan_sip.so'});})[_0xedac('0x22')](handleError(_0x3926ed,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index ee40a28..7ec9656 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 _0x59a6=['rimraf','../../config/environment','define','Trunk','tools_trunks','lodash','../../config/logger','bluebird','request-promise','path'];(function(_0x174a72,_0x46034c){var _0x32cecd=function(_0x188a47){while(--_0x188a47){_0x174a72['push'](_0x174a72['shift']());}};_0x32cecd(++_0x46034c);}(_0x59a6,0xff));var _0x659a=function(_0x4d80a6,_0x494029){_0x4d80a6=_0x4d80a6-0x0;var _0x2735b0=_0x59a6[_0x4d80a6];return _0x2735b0;};'use strict';var _=require(_0x659a('0x0'));var util=require('util');var logger=require(_0x659a('0x1'))('api');var moment=require('moment');var BPromise=require(_0x659a('0x2'));var rp=require(_0x659a('0x3'));var fs=require('fs');var path=require(_0x659a('0x4'));var rimraf=require(_0x659a('0x5'));var config=require(_0x659a('0x6'));var attributes=require('./trunk.attributes');module['exports']=function(_0x40a48b,_0x4c3c25){return _0x40a48b[_0x659a('0x7')](_0x659a('0x8'),attributes,{'tableName':_0x659a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa3ea=['lodash','util','../../config/logger','api','moment','request-promise','path','./trunk.attributes','exports','define','Trunk','tools_trunks'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa3ea,0x1ec));var _0xaa3e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa3ea[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xaa3e('0x0'));var util=require(_0xaa3e('0x1'));var logger=require(_0xaa3e('0x2'))(_0xaa3e('0x3'));var moment=require(_0xaa3e('0x4'));var BPromise=require('bluebird');var rp=require(_0xaa3e('0x5'));var fs=require('fs');var path=require(_0xaa3e('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xaa3e('0x7'));module[_0xaa3e('0x8')]=function(_0x3b8620,_0x9baa61){return _0x3b8620[_0xaa3e('0x9')](_0xaa3e('0xa'),attributes,{'tableName':_0xaa3e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 859aa43..5bb2872 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 _0x3daa=['Trunk,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','GetTrunk','findAll','options','where','attributes','limit','map','include','model','stringify','ShowTrunk','Trunk','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x1fdd3e,_0x22735b){var _0x2da065=function(_0x45f972){while(--_0x45f972){_0x1fdd3e['push'](_0x1fdd3e['shift']());}};_0x2da065(++_0x22735b);}(_0x3daa,0x1c4));var _0xa3da=function(_0x19c45e,_0x3d1db7){_0x19c45e=_0x19c45e-0x0;var _0x48f142=_0x3daa[_0x19c45e];return _0x48f142;};'use strict';var _=require(_0xa3da('0x0'));var util=require(_0xa3da('0x1'));var moment=require(_0xa3da('0x2'));var BPromise=require(_0xa3da('0x3'));var rs=require(_0xa3da('0x4'));var fs=require('fs');var Redis=require(_0xa3da('0x5'));var db=require(_0xa3da('0x6'))['db'];var utils=require(_0xa3da('0x7'));var logger=require(_0xa3da('0x8'))(_0xa3da('0x9'));var config=require(_0xa3da('0xa'));var jayson=require(_0xa3da('0xb'));var client=jayson[_0xa3da('0xc')][_0xa3da('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5e6840,_0x8b195c,_0x14c8a1){return new BPromise(function(_0x280f30,_0x406493){return client[_0xa3da('0xe')](_0x5e6840,_0x14c8a1)[_0xa3da('0xf')](function(_0xd92bec){logger['info'](_0xa3da('0x10'),_0x8b195c,_0xa3da('0x11'));logger[_0xa3da('0x12')]('Trunk,\x20%s,\x20%s,\x20%s',_0x8b195c,_0xa3da('0x11'),JSON['stringify'](_0xd92bec));if(_0xd92bec[_0xa3da('0x13')]){if(_0xd92bec[_0xa3da('0x13')][_0xa3da('0x14')]===0x1f4){logger[_0xa3da('0x13')](_0xa3da('0x10'),_0x8b195c,_0xd92bec[_0xa3da('0x13')][_0xa3da('0x15')]);return _0x406493(_0xd92bec[_0xa3da('0x13')]['message']);}logger[_0xa3da('0x13')](_0xa3da('0x10'),_0x8b195c,_0xd92bec[_0xa3da('0x13')][_0xa3da('0x15')]);return _0x280f30(_0xd92bec['error'][_0xa3da('0x15')]);}else{logger[_0xa3da('0x16')](_0xa3da('0x10'),_0x8b195c,_0xa3da('0x11'));_0x280f30(_0xd92bec[_0xa3da('0x17')][_0xa3da('0x15')]);}})[_0xa3da('0x18')](function(_0x528f58){logger[_0xa3da('0x13')]('Trunk,\x20%s,\x20%s',_0x8b195c,_0x528f58);_0x406493(_0x528f58);});});}exports[_0xa3da('0x19')]=function(_0x363a7a){var _0x52a17e=this;return new Promise(function(_0x6540f8,_0x417869){return db['Trunk'][_0xa3da('0x1a')]({'raw':_0x363a7a[_0xa3da('0x1b')]?_0x363a7a[_0xa3da('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x363a7a[_0xa3da('0x1b')]?_0x363a7a[_0xa3da('0x1b')][_0xa3da('0x1c')]||null:null,'attributes':_0x363a7a[_0xa3da('0x1b')]?_0x363a7a[_0xa3da('0x1b')][_0xa3da('0x1d')]||null:null,'limit':_0x363a7a[_0xa3da('0x1b')]?_0x363a7a[_0xa3da('0x1b')][_0xa3da('0x1e')]||null:null,'include':_0x363a7a[_0xa3da('0x1b')]?_0x363a7a[_0xa3da('0x1b')]['include']?_[_0xa3da('0x1f')](_0x363a7a[_0xa3da('0x1b')]['include'],function(_0x530b20){return{'model':db[_0x530b20['model']],'as':_0x530b20['as'],'attributes':_0x530b20['attributes'],'include':_0x530b20[_0xa3da('0x20')]?_['map'](_0x530b20[_0xa3da('0x20')],function(_0x523d8d){return{'model':db[_0x523d8d[_0xa3da('0x21')]],'as':_0x523d8d['as'],'attributes':_0x523d8d['attributes'],'include':_0x523d8d[_0xa3da('0x20')]?_[_0xa3da('0x1f')](_0x523d8d[_0xa3da('0x20')],function(_0x2a4a7a){return{'model':db[_0x2a4a7a[_0xa3da('0x21')]],'as':_0x2a4a7a['as'],'attributes':_0x2a4a7a[_0xa3da('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa3da('0xf')](function(_0x247569){logger['info'](_0xa3da('0x19'),_0x363a7a);logger[_0xa3da('0x12')](_0xa3da('0x19'),_0x363a7a,JSON[_0xa3da('0x22')](_0x247569));_0x6540f8(_0x247569);})[_0xa3da('0x18')](function(_0x5291d0){logger[_0xa3da('0x13')](_0xa3da('0x19'),_0x5291d0[_0xa3da('0x15')],_0x363a7a);_0x417869(_0x52a17e['error'](0x1f4,_0x5291d0[_0xa3da('0x15')]));});});};exports[_0xa3da('0x23')]=function(_0x16ef0a){var _0x5eecdb=this;return new Promise(function(_0x3317b0,_0x1061cb){return db[_0xa3da('0x24')][_0xa3da('0x25')]({'raw':_0x16ef0a[_0xa3da('0x1b')]?_0x16ef0a[_0xa3da('0x1b')][_0xa3da('0x26')]===undefined?!![]:![]:!![],'where':_0x16ef0a[_0xa3da('0x1b')]?_0x16ef0a[_0xa3da('0x1b')][_0xa3da('0x1c')]||null:null,'attributes':_0x16ef0a[_0xa3da('0x1b')]?_0x16ef0a[_0xa3da('0x1b')][_0xa3da('0x1d')]||null:null,'include':_0x16ef0a['options']?_0x16ef0a[_0xa3da('0x1b')][_0xa3da('0x20')]?_[_0xa3da('0x1f')](_0x16ef0a[_0xa3da('0x1b')][_0xa3da('0x20')],function(_0x40ffb3){return{'model':db[_0x40ffb3[_0xa3da('0x21')]],'as':_0x40ffb3['as'],'attributes':_0x40ffb3[_0xa3da('0x1d')],'include':_0x40ffb3['include']?_[_0xa3da('0x1f')](_0x40ffb3[_0xa3da('0x20')],function(_0x4e93d3){return{'model':db[_0x4e93d3[_0xa3da('0x21')]],'as':_0x4e93d3['as'],'attributes':_0x4e93d3[_0xa3da('0x1d')],'include':_0x4e93d3[_0xa3da('0x20')]?_[_0xa3da('0x1f')](_0x4e93d3['include'],function(_0xb4f745){return{'model':db[_0xb4f745[_0xa3da('0x21')]],'as':_0xb4f745['as'],'attributes':_0xb4f745[_0xa3da('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa3da('0xf')](function(_0x254f84){logger[_0xa3da('0x16')](_0xa3da('0x23'),_0x16ef0a);logger[_0xa3da('0x12')](_0xa3da('0x23'),_0x16ef0a,JSON[_0xa3da('0x22')](_0x254f84));_0x3317b0(_0x254f84);})[_0xa3da('0x18')](function(_0x173d7c){logger['error'](_0xa3da('0x23'),_0x173d7c[_0xa3da('0x15')],_0x16ef0a);_0x1061cb(_0x5eecdb[_0xa3da('0x13')](0x1f4,_0x173d7c[_0xa3da('0x15')]));});});}; \ No newline at end of file +var _0xfc6e=['error','code','message','info','result','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','ShowTrunk','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xfc6e,0x13b));var _0xefc6=function(_0x24f9d9,_0x6b4d81){_0x24f9d9=_0x24f9d9-0x0;var _0x392b6c=_0xfc6e[_0x24f9d9];return _0x392b6c;};'use strict';var _=require(_0xefc6('0x0'));var util=require(_0xefc6('0x1'));var moment=require(_0xefc6('0x2'));var BPromise=require(_0xefc6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xefc6('0x4'));var db=require(_0xefc6('0x5'))['db'];var utils=require(_0xefc6('0x6'));var logger=require(_0xefc6('0x7'))(_0xefc6('0x8'));var config=require(_0xefc6('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xefc6('0xa')][_0xefc6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x530c78,_0x11f049,_0x533f5d){return new BPromise(function(_0xb0b489,_0x329c9d){return client[_0xefc6('0xc')](_0x530c78,_0x533f5d)[_0xefc6('0xd')](function(_0x26c51b){logger['info'](_0xefc6('0xe'),_0x11f049,_0xefc6('0xf'));logger[_0xefc6('0x10')]('Trunk,\x20%s,\x20%s,\x20%s',_0x11f049,_0xefc6('0xf'),JSON[_0xefc6('0x11')](_0x26c51b));if(_0x26c51b[_0xefc6('0x12')]){if(_0x26c51b['error'][_0xefc6('0x13')]===0x1f4){logger[_0xefc6('0x12')](_0xefc6('0xe'),_0x11f049,_0x26c51b[_0xefc6('0x12')]['message']);return _0x329c9d(_0x26c51b['error'][_0xefc6('0x14')]);}logger[_0xefc6('0x12')]('Trunk,\x20%s,\x20%s',_0x11f049,_0x26c51b['error'][_0xefc6('0x14')]);return _0xb0b489(_0x26c51b['error']['message']);}else{logger[_0xefc6('0x15')](_0xefc6('0xe'),_0x11f049,'request\x20sent');_0xb0b489(_0x26c51b[_0xefc6('0x16')][_0xefc6('0x14')]);}})[_0xefc6('0x17')](function(_0x15d301){logger[_0xefc6('0x12')](_0xefc6('0xe'),_0x11f049,_0x15d301);_0x329c9d(_0x15d301);});});}exports[_0xefc6('0x18')]=function(_0x2005a7){var _0x2d94d6=this;return new Promise(function(_0x21e94c,_0x73e8d7){return db[_0xefc6('0x19')][_0xefc6('0x1a')]({'raw':_0x2005a7[_0xefc6('0x1b')]?_0x2005a7['options'][_0xefc6('0x1c')]===undefined?!![]:![]:!![],'where':_0x2005a7[_0xefc6('0x1b')]?_0x2005a7[_0xefc6('0x1b')][_0xefc6('0x1d')]||null:null,'attributes':_0x2005a7[_0xefc6('0x1b')]?_0x2005a7['options'][_0xefc6('0x1e')]||null:null,'limit':_0x2005a7['options']?_0x2005a7['options'][_0xefc6('0x1f')]||null:null,'include':_0x2005a7[_0xefc6('0x1b')]?_0x2005a7['options'][_0xefc6('0x20')]?_[_0xefc6('0x21')](_0x2005a7['options'][_0xefc6('0x20')],function(_0x4817ad){return{'model':db[_0x4817ad[_0xefc6('0x22')]],'as':_0x4817ad['as'],'attributes':_0x4817ad[_0xefc6('0x1e')],'include':_0x4817ad['include']?_[_0xefc6('0x21')](_0x4817ad[_0xefc6('0x20')],function(_0x516651){return{'model':db[_0x516651[_0xefc6('0x22')]],'as':_0x516651['as'],'attributes':_0x516651[_0xefc6('0x1e')],'include':_0x516651[_0xefc6('0x20')]?_[_0xefc6('0x21')](_0x516651[_0xefc6('0x20')],function(_0x52d771){return{'model':db[_0x52d771[_0xefc6('0x22')]],'as':_0x52d771['as'],'attributes':_0x52d771[_0xefc6('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xefc6('0xd')](function(_0x34a690){logger['info'](_0xefc6('0x18'),_0x2005a7);logger[_0xefc6('0x10')](_0xefc6('0x18'),_0x2005a7,JSON[_0xefc6('0x11')](_0x34a690));_0x21e94c(_0x34a690);})['catch'](function(_0x2d3dbb){logger[_0xefc6('0x12')](_0xefc6('0x18'),_0x2d3dbb[_0xefc6('0x14')],_0x2005a7);_0x73e8d7(_0x2d94d6['error'](0x1f4,_0x2d3dbb['message']));});});};exports[_0xefc6('0x23')]=function(_0x228358){var _0x482a34=this;return new Promise(function(_0xb77676,_0x39ffca){return db[_0xefc6('0x19')][_0xefc6('0x24')]({'raw':_0x228358[_0xefc6('0x1b')]?_0x228358[_0xefc6('0x1b')][_0xefc6('0x1c')]===undefined?!![]:![]:!![],'where':_0x228358['options']?_0x228358['options'][_0xefc6('0x1d')]||null:null,'attributes':_0x228358[_0xefc6('0x1b')]?_0x228358[_0xefc6('0x1b')][_0xefc6('0x1e')]||null:null,'include':_0x228358['options']?_0x228358[_0xefc6('0x1b')][_0xefc6('0x20')]?_[_0xefc6('0x21')](_0x228358[_0xefc6('0x1b')][_0xefc6('0x20')],function(_0x26eb2f){return{'model':db[_0x26eb2f[_0xefc6('0x22')]],'as':_0x26eb2f['as'],'attributes':_0x26eb2f[_0xefc6('0x1e')],'include':_0x26eb2f['include']?_[_0xefc6('0x21')](_0x26eb2f['include'],function(_0x1386f7){return{'model':db[_0x1386f7[_0xefc6('0x22')]],'as':_0x1386f7['as'],'attributes':_0x1386f7[_0xefc6('0x1e')],'include':_0x1386f7[_0xefc6('0x20')]?_[_0xefc6('0x21')](_0x1386f7[_0xefc6('0x20')],function(_0x4a1f6f){return{'model':db[_0x4a1f6f[_0xefc6('0x22')]],'as':_0x4a1f6f['as'],'attributes':_0x4a1f6f[_0xefc6('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xefc6('0xd')](function(_0x2687a7){logger[_0xefc6('0x15')](_0xefc6('0x23'),_0x228358);logger[_0xefc6('0x10')](_0xefc6('0x23'),_0x228358,JSON[_0xefc6('0x11')](_0x2687a7));_0xb77676(_0x2687a7);})[_0xefc6('0x17')](function(_0x5c32a6){logger[_0xefc6('0x12')](_0xefc6('0x23'),_0x5c32a6[_0xefc6('0x14')],_0x228358);_0x39ffca(_0x482a34['error'](0x1f4,_0x5c32a6[_0xefc6('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index fb5b796..5a9106c 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 _0xbaae=['Router','../../components/auth/service','./user-setting.controller','put','/:id','update','exports'];(function(_0x1f5908,_0xf1fefa){var _0x4b7734=function(_0x21e81a){while(--_0x21e81a){_0x1f5908['push'](_0x1f5908['shift']());}};_0x4b7734(++_0xf1fefa);}(_0xbaae,0x8c));var _0xebaa=function(_0x1fe120,_0x3a3305){_0x1fe120=_0x1fe120-0x0;var _0x50e5dd=_0xbaae[_0x1fe120];return _0x50e5dd;};'use strict';var express=require('express');var router=express[_0xebaa('0x0')]();var auth=require(_0xebaa('0x1'));var controller=require(_0xebaa('0x2'));router[_0xebaa('0x3')](_0xebaa('0x4'),auth['isAuthenticated'](),controller[_0xebaa('0x5')]);module[_0xebaa('0x6')]=router; \ No newline at end of file +var _0x66cb=['/:id','isAuthenticated','exports','express','Router'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0x66cb,0x67));var _0xb66c=function(_0x4e438f,_0x4733c7){_0x4e438f=_0x4e438f-0x0;var _0x418ed9=_0x66cb[_0x4e438f];return _0x418ed9;};'use strict';var express=require(_0xb66c('0x0'));var router=express[_0xb66c('0x1')]();var auth=require('../../components/auth/service');var controller=require('./user-setting.controller');router['put'](_0xb66c('0x2'),auth[_0xb66c('0x3')](),controller['update']);module[_0xb66c('0x4')]=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 661efeb..51b397f 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 _0x853d=['debug','exports','ENUM','BOOLEAN','TEXT','DATE','INTEGER','UserId','sequelize','error'];(function(_0x111361,_0x544d53){var _0x43bff1=function(_0x33535a){while(--_0x33535a){_0x111361['push'](_0x111361['shift']());}};_0x43bff1(++_0x544d53);}(_0x853d,0x12a));var _0xd853=function(_0x55e839,_0x3b5345){_0x55e839=_0x55e839-0x0;var _0x39c61a=_0x853d[_0x55e839];return _0x39c61a;};'use strict';var Sequelize=require(_0xd853('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xd853('0x1'),'warning','info',_0xd853('0x2')];module[_0xd853('0x3')]={'clientSideLoggingLevel':{'type':Sequelize[_0xd853('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xd853('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xd853('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xd853('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xd853('0x8')],'unique':_0xd853('0x9')}}; \ No newline at end of file +var _0x3a1b=['INTEGER','UserId','error','warning','info','ENUM','TEXT','DATE'];(function(_0x30b951,_0x1b13d2){var _0x41b6a1=function(_0x5663c2){while(--_0x5663c2){_0x30b951['push'](_0x30b951['shift']());}};_0x41b6a1(++_0x1b13d2);}(_0x3a1b,0x19a));var _0xb3a1=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x3a1b[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0xb3a1('0x0'),_0xb3a1('0x1'),_0xb3a1('0x2'),'debug'];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0xb3a1('0x3')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xb3a1('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xb3a1('0x4')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xb3a1('0x5')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xb3a1('0x6')],'unique':_0xb3a1('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 7cdd561..6f30423 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 _0x6108=['../../config/logger','api','../../config/environment','redis','./user-setting.socket','defaults','localhost','json','then','sendStatus','error','stack','name','send','update','user','Unauthorized','params','Invalid\x20user\x20setting\x20id','body','lodash'];(function(_0x1c4006,_0x2524d4){var _0x19586e=function(_0x75a04b){while(--_0x75a04b){_0x1c4006['push'](_0x1c4006['shift']());}};_0x19586e(++_0x2524d4);}(_0x6108,0xbc));var _0x8610=function(_0x10e43c,_0x325992){_0x10e43c=_0x10e43c-0x0;var _0x2a46bc=_0x6108[_0x10e43c];return _0x2a46bc;};'use strict';var _=require(_0x8610('0x0'));var Redis=require('ioredis');var logger=require(_0x8610('0x1'))(_0x8610('0x2'));var config=require(_0x8610('0x3'));var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x8610('0x4')]));require(_0x8610('0x5'))['register'](socket);config['redis']=_[_0x8610('0x6')](config[_0x8610('0x4')],{'host':_0x8610('0x7'),'port':0x18eb});function respondWithResult(_0x26dab3,_0x4e0fe4){_0x4e0fe4=_0x4e0fe4||0xc8;return function(_0x174f41){if(_0x174f41){return _0x26dab3['status'](_0x4e0fe4)[_0x8610('0x8')](_0x174f41);}};}function saveUpdates(_0x2255a0){return function(_0x21774e){if(_0x21774e){return _0x21774e['update'](_0x2255a0)[_0x8610('0x9')](function(_0x3682b9){return _0x3682b9;});}return null;};}function handleEntityNotFound(_0x46854f){return function(_0x1eb419){if(!_0x1eb419){_0x46854f[_0x8610('0xa')](0x194);}return _0x1eb419;};}function handleError(_0x1da432,_0x4b3af2){_0x4b3af2=_0x4b3af2||0x1f4;return function(_0x1b6c16){logger[_0x8610('0xb')](_0x1b6c16[_0x8610('0xc')]);if(_0x1b6c16['name']){delete _0x1b6c16[_0x8610('0xd')];}_0x1da432['status'](_0x4b3af2)[_0x8610('0xe')](_0x1b6c16);};}exports[_0x8610('0xf')]=function(_0x413324,_0x277942){if(_0x413324[_0x8610('0x10')]['role']!=='admin')throw new Error(_0x8610('0x11'));if(isNaN(Number(_0x413324[_0x8610('0x12')]['id'])))throw new Error(_0x8610('0x13'));return db['UserSetting']['find']({'where':{'id':_0x413324['params']['id']}})[_0x8610('0x9')](handleEntityNotFound(_0x277942,null))[_0x8610('0x9')](saveUpdates(_0x413324[_0x8610('0x14')],null))[_0x8610('0x9')](respondWithResult(_0x277942,null))['catch'](handleError(_0x277942,null));}; \ No newline at end of file +var _0x5127=['status','send','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','body','catch','lodash','ioredis','../../config/logger','api','socket.io-emitter','./user-setting.socket','register','redis','defaults','localhost','json','update','then','sendStatus','error','stack','name'];(function(_0x55d911,_0x2b768c){var _0x3104c2=function(_0x1b4386){while(--_0x1b4386){_0x55d911['push'](_0x55d911['shift']());}};_0x3104c2(++_0x2b768c);}(_0x5127,0x18f));var _0x7512=function(_0x52cbe0,_0x332b2e){_0x52cbe0=_0x52cbe0-0x0;var _0x4bb9da=_0x5127[_0x52cbe0];return _0x4bb9da;};'use strict';var _=require(_0x7512('0x0'));var Redis=require(_0x7512('0x1'));var logger=require(_0x7512('0x2'))(_0x7512('0x3'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var socket=require(_0x7512('0x4'))(new Redis(config['redis']));require(_0x7512('0x5'))[_0x7512('0x6')](socket);config[_0x7512('0x7')]=_[_0x7512('0x8')](config[_0x7512('0x7')],{'host':_0x7512('0x9'),'port':0x18eb});function respondWithResult(_0x4e6779,_0x4d0765){_0x4d0765=_0x4d0765||0xc8;return function(_0x2d2e88){if(_0x2d2e88){return _0x4e6779['status'](_0x4d0765)[_0x7512('0xa')](_0x2d2e88);}};}function saveUpdates(_0x49b608){return function(_0x7328d7){if(_0x7328d7){return _0x7328d7[_0x7512('0xb')](_0x49b608)[_0x7512('0xc')](function(_0x3db733){return _0x3db733;});}return null;};}function handleEntityNotFound(_0x255ab9){return function(_0x7c0280){if(!_0x7c0280){_0x255ab9[_0x7512('0xd')](0x194);}return _0x7c0280;};}function handleError(_0x3c3efc,_0x202032){_0x202032=_0x202032||0x1f4;return function(_0x885024){logger[_0x7512('0xe')](_0x885024[_0x7512('0xf')]);if(_0x885024[_0x7512('0x10')]){delete _0x885024[_0x7512('0x10')];}_0x3c3efc[_0x7512('0x11')](_0x202032)[_0x7512('0x12')](_0x885024);};}exports[_0x7512('0xb')]=function(_0x527d96,_0x463c6){if(_0x527d96['user'][_0x7512('0x13')]!==_0x7512('0x14'))throw new Error(_0x7512('0x15'));if(isNaN(Number(_0x527d96[_0x7512('0x16')]['id'])))throw new Error(_0x7512('0x17'));return db['UserSetting']['find']({'where':{'id':_0x527d96[_0x7512('0x16')]['id']}})[_0x7512('0xc')](handleEntityNotFound(_0x463c6,null))[_0x7512('0xc')](saveUpdates(_0x527d96[_0x7512('0x18')],null))['then'](respondWithResult(_0x463c6,null))[_0x7512('0x19')](handleError(_0x463c6,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 4a68ac5..03ce2cb 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 _0x9f1d=['UserSetting','setMaxListeners','update','emit','hook','exports','events','../../mysqldb'];(function(_0x1d7d68,_0x4a407d){var _0x456c44=function(_0x348a5a){while(--_0x348a5a){_0x1d7d68['push'](_0x1d7d68['shift']());}};_0x456c44(++_0x4a407d);}(_0x9f1d,0x1be));var _0xd9f1=function(_0x25a97a,_0x4e6512){_0x25a97a=_0x25a97a-0x0;var _0x2c7965=_0x9f1d[_0x25a97a];return _0x2c7965;};'use strict';var EventEmitter=require(_0xd9f1('0x0'));var UserSetting=require(_0xd9f1('0x1'))['db'][_0xd9f1('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xd9f1('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd9f1('0x4'),'afterDestroy':'remove'};function emitEvent(_0x56574a){return function(_0x3c906a,_0x21b255,_0x102c46){UserSettingEvents[_0xd9f1('0x5')](_0x56574a+':'+_0x3c906a['id'],_0x3c906a);UserSettingEvents[_0xd9f1('0x5')](_0x56574a,_0x3c906a);_0x102c46(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0xd9f1('0x6')](e,emitEvent(event));}}module[_0xd9f1('0x7')]=UserSettingEvents; \ No newline at end of file +var _0x30df=['hook','events','../../mysqldb','UserSetting','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x30df,0x12a));var _0xf30d=function(_0x2c00ff,_0x2b584c){_0x2c00ff=_0x2c00ff-0x0;var _0x56b8b6=_0x30df[_0x2c00ff];return _0x56b8b6;};'use strict';var EventEmitter=require(_0xf30d('0x0'));var UserSetting=require(_0xf30d('0x1'))['db'][_0xf30d('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xf30d('0x3')](0x0);var events={'afterCreate':_0xf30d('0x4'),'afterUpdate':'update','afterDestroy':_0xf30d('0x5')};function emitEvent(_0x3fd0f3){return function(_0x481ce7,_0x40756a,_0x11c7aa){UserSettingEvents[_0xf30d('0x6')](_0x3fd0f3+':'+_0x481ce7['id'],_0x481ce7);UserSettingEvents[_0xf30d('0x6')](_0x3fd0f3,_0x481ce7);_0x11c7aa(null);};}for(var e in events){if(events[_0xf30d('0x7')](e)){var event=events[e];UserSetting[_0xf30d('0x8')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 490aee2..05be8b5 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 _0x63a5=['UserSetting','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports'];(function(_0x37f64a,_0x53a4a9){var _0x137153=function(_0x34ad32){while(--_0x34ad32){_0x37f64a['push'](_0x37f64a['shift']());}};_0x137153(++_0x53a4a9);}(_0x63a5,0x18e));var _0x563a=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0x63a5[_0x5a95fa];return _0x1a61b8;};'use strict';var attributes=require(_0x563a('0x0'));module[_0x563a('0x1')]=function(_0x91178){return _0x91178['define'](_0x563a('0x2'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x922339){if(!_0x922339[_0x563a('0x3')])_0x922339[_0x563a('0x4')]=null;else if(_0x922339[_0x563a('0x4')]===null)_0x922339['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file +var _0x5d86=['UserSetting','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports'];(function(_0x3ac919,_0x3b0588){var _0x425be6=function(_0x533915){while(--_0x533915){_0x3ac919['push'](_0x3ac919['shift']());}};_0x425be6(++_0x3b0588);}(_0x5d86,0x76));var _0x65d8=function(_0x4a4b9b,_0x47c325){_0x4a4b9b=_0x4a4b9b-0x0;var _0x260375=_0x5d86[_0x4a4b9b];return _0x260375;};'use strict';var attributes=require(_0x65d8('0x0'));module[_0x65d8('0x1')]=function(_0x5686cc){return _0x5686cc['define'](_0x65d8('0x2'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2bfcd7){if(!_0x2bfcd7[_0x65d8('0x3')])_0x2bfcd7['clientSideLoggingEnabledSince']=null;else if(_0x2bfcd7[_0x65d8('0x4')]===null)_0x2bfcd7['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 4e5126e..a3e1cfd 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 _0x6d54=['length','user-setting:','./user-setting.events','remove','update','emit','user-setting:update','UserId','register'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6d54,0x1f1));var _0x46d5=function(_0x5db291,_0x436956){_0x5db291=_0x5db291-0x0;var _0x54a80e=_0x6d54[_0x5db291];return _0x54a80e;};'use strict';var UserSettingEvents=require(_0x46d5('0x0'));var events=['save',_0x46d5('0x1'),_0x46d5('0x2')];function createListener(_0xd7b17c,_0x514516){return function(_0x26573){_0x514516[_0x46d5('0x3')](_0xd7b17c,_0x26573);if(_0xd7b17c===_0x46d5('0x4')){_0x514516[_0x46d5('0x3')]('user-setting:update:user-'+_0x26573[_0x46d5('0x5')],_0x26573);}};}exports[_0x46d5('0x6')]=function(_0x26fbac){for(var _0x4597e6=0x0,_0x4564de=events[_0x46d5('0x7')];_0x4597e6<_0x4564de;_0x4597e6++){var _0x38b437=events[_0x4597e6];var _0x7962c4=createListener(_0x46d5('0x8')+_0x38b437,_0x26fbac);UserSettingEvents['on'](_0x38b437,_0x7962c4);}}; \ No newline at end of file +var _0xe33b=['emit','user-setting:update','user-setting:update:user-','UserId','register','length','user-setting:','save','remove','update'];(function(_0x1954c7,_0x1ee1d1){var _0x3e9ed7=function(_0x3aa64f){while(--_0x3aa64f){_0x1954c7['push'](_0x1954c7['shift']());}};_0x3e9ed7(++_0x1ee1d1);}(_0xe33b,0x197));var _0xbe33=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0xe33b[_0x39e283];return _0x7de89f;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0xbe33('0x0'),_0xbe33('0x1'),_0xbe33('0x2')];function createListener(_0x4f2e09,_0x563b89){return function(_0x278099){_0x563b89[_0xbe33('0x3')](_0x4f2e09,_0x278099);if(_0x4f2e09===_0xbe33('0x4')){_0x563b89[_0xbe33('0x3')](_0xbe33('0x5')+_0x278099[_0xbe33('0x6')],_0x278099);}};}exports[_0xbe33('0x7')]=function(_0x212eba){for(var _0xeae4d9=0x0,_0x3f90f4=events[_0xbe33('0x8')];_0xeae4d9<_0x3f90f4;_0xeae4d9++){var _0x4410ea=events[_0xeae4d9];var _0x2da4b8=createListener(_0xbe33('0x9')+_0x4410ea,_0x212eba);UserSettingEvents['on'](_0x4410ea,_0x2da4b8);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 45f5ee1..5992c5b 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 _0x26fb=['addChatWebsites','addWhatsappAccounts','createApiKey','put','changePassword','removeQueues','delete','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','/:id/api_key','getApiKey','post','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','now','single','file','/:id/login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','/:id/teams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addSmsAccounts'];(function(_0x5e56d2,_0x69a9d9){var _0x382751=function(_0x44c5ef){while(--_0x44c5ef){_0x5e56d2['push'](_0x5e56d2['shift']());}};_0x382751(++_0x69a9d9);}(_0x26fb,0x1f4));var _0xb26f=function(_0x1c9fc4,_0x240343){_0x1c9fc4=_0x1c9fc4-0x0;var _0x2efcba=_0x26fb[_0x1c9fc4];return _0x2efcba;};'use strict';var multer=require(_0xb26f('0x0'));var util=require(_0xb26f('0x1'));var path=require(_0xb26f('0x2'));var timeout=require(_0xb26f('0x3'));var express=require(_0xb26f('0x4'));var router=express[_0xb26f('0x5')]();var fs_extra=require(_0xb26f('0x6'));var auth=require(_0xb26f('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xb26f('0x8'));var controller=require(_0xb26f('0x9'));router[_0xb26f('0xa')]('/',auth[_0xb26f('0xb')](),controller[_0xb26f('0xc')]);router['get'](_0xb26f('0xd'),auth[_0xb26f('0xb')](),controller[_0xb26f('0xe')]);router[_0xb26f('0xa')](_0xb26f('0xf'),auth['isAuthenticated'](),controller[_0xb26f('0x10')]);router[_0xb26f('0xa')](_0xb26f('0x11'),auth[_0xb26f('0xb')](),controller[_0xb26f('0x12')]);router[_0xb26f('0xa')](_0xb26f('0x13'),auth[_0xb26f('0xb')](),controller[_0xb26f('0x14')]);router[_0xb26f('0xa')](_0xb26f('0x15'),controller[_0xb26f('0x16')]);router[_0xb26f('0xa')](_0xb26f('0x17'),auth['isAuthenticated'](),controller[_0xb26f('0x18')]);router[_0xb26f('0xa')](_0xb26f('0x19'),auth[_0xb26f('0xb')](),controller[_0xb26f('0x1a')]);router[_0xb26f('0xa')](_0xb26f('0x1b'),auth['isAuthenticated'](),controller['getQueues']);router[_0xb26f('0xa')](_0xb26f('0x1c'),auth[_0xb26f('0xb')](),controller[_0xb26f('0x1d')]);router['get'](_0xb26f('0x1e'),auth[_0xb26f('0xb')](),controller['getGroups']);router['get'](_0xb26f('0x1f'),auth[_0xb26f('0xb')](),controller['getRecordings']);router[_0xb26f('0xa')](_0xb26f('0x20'),auth[_0xb26f('0xb')](),controller[_0xb26f('0x21')]);router['get'](_0xb26f('0x22'),auth['isAuthenticated'](),controller[_0xb26f('0x23')]);router[_0xb26f('0xa')](_0xb26f('0x24'),auth['isAuthenticated'](),controller[_0xb26f('0x25')]);router['get'](_0xb26f('0x26'),auth['isAuthenticated'](),controller[_0xb26f('0x27')]);router[_0xb26f('0xa')](_0xb26f('0x28'),auth['isAuthenticated'](),controller[_0xb26f('0x29')]);router[_0xb26f('0xa')](_0xb26f('0x2a'),auth[_0xb26f('0xb')](),controller['getFaxInteractions']);router[_0xb26f('0xa')](_0xb26f('0x2b'),auth[_0xb26f('0xb')](),controller[_0xb26f('0x2c')]);router[_0xb26f('0xa')]('/:id/teams',auth[_0xb26f('0xb')](),controller[_0xb26f('0x2d')]);router[_0xb26f('0xa')](_0xb26f('0x2e'),auth[_0xb26f('0xb')](),controller[_0xb26f('0x2f')]);router[_0xb26f('0xa')](_0xb26f('0x30'),auth['isAuthenticated'](),controller[_0xb26f('0x31')]);router[_0xb26f('0xa')](_0xb26f('0x32'),auth['isAuthenticated'](),controller['getVoicePrefixes']);router[_0xb26f('0xa')](_0xb26f('0x33'),auth[_0xb26f('0xb')](),controller[_0xb26f('0x34')]);router[_0xb26f('0xa')]('/:id/mail_accounts',auth[_0xb26f('0xb')](),controller[_0xb26f('0x35')]);router['get'](_0xb26f('0x36'),auth[_0xb26f('0xb')](),controller[_0xb26f('0x37')]);router['get'](_0xb26f('0x38'),auth[_0xb26f('0xb')](),controller[_0xb26f('0x39')]);router[_0xb26f('0xa')](_0xb26f('0x3a'),auth[_0xb26f('0xb')](),controller[_0xb26f('0x3b')]);router[_0xb26f('0xa')](_0xb26f('0x3c'),auth[_0xb26f('0xb')](),controller[_0xb26f('0x3d')]);router[_0xb26f('0xa')](_0xb26f('0x3e'),auth[_0xb26f('0xb')](),controller['getScheduledCalls']);router[_0xb26f('0xa')](_0xb26f('0x3f'),auth['isAuthenticated'](),controller[_0xb26f('0x40')]);router[_0xb26f('0x41')](_0xb26f('0x19'),auth['isAuthenticated'](),controller['addContacts']);router[_0xb26f('0x41')]('/',auth['isAuthenticated'](),controller[_0xb26f('0x42')]);router[_0xb26f('0x41')](_0xb26f('0x43'),auth[_0xb26f('0xb')](),controller[_0xb26f('0x44')]);router[_0xb26f('0x41')]('/:id/queues',auth['isAuthenticated'](),controller[_0xb26f('0x45')]);var upload=multer({'storage':multer[_0xb26f('0x46')]({'destination':function(_0x44d009,_0x102ee2,_0x4b01fc){_0x4b01fc(null,path[_0xb26f('0x47')](config[_0xb26f('0x48')],_0xb26f('0x49')));},'filename':function(_0x1e0476,_0x18e0b6,_0x223c6e){_0x223c6e(null,util[_0xb26f('0x4a')]('%s-%s',Date[_0xb26f('0x4b')](),_0x18e0b6['originalname']));}})});router[_0xb26f('0x41')](_0xb26f('0x15'),upload[_0xb26f('0x4c')](_0xb26f('0x4d')),controller['addAvatar']);router[_0xb26f('0x41')](_0xb26f('0x4e'),auth['isAuthenticated'](),controller['login']);router[_0xb26f('0x41')](_0xb26f('0x4f'),auth['isAuthenticated'](),controller[_0xb26f('0x50')]);router[_0xb26f('0x41')](_0xb26f('0x51'),auth[_0xb26f('0xb')](),controller[_0xb26f('0x52')]);router['post'](_0xb26f('0x53'),auth[_0xb26f('0xb')](),controller[_0xb26f('0x54')]);router[_0xb26f('0x41')](_0xb26f('0x55'),auth[_0xb26f('0xb')](),controller['addTeams']);router['post'](_0xb26f('0x56'),auth[_0xb26f('0xb')](),controller[_0xb26f('0x57')]);router['post'](_0xb26f('0x58'),auth['isAuthenticated'](),controller[_0xb26f('0x59')]);router[_0xb26f('0x41')](_0xb26f('0x5a'),auth['isAuthenticated'](),controller[_0xb26f('0x5b')]);router[_0xb26f('0x41')]('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0xb26f('0x5c')]);router[_0xb26f('0x41')](_0xb26f('0x5d'),auth[_0xb26f('0xb')](),controller[_0xb26f('0x5e')]);router[_0xb26f('0x41')](_0xb26f('0x5f'),auth[_0xb26f('0xb')](),controller['addWhatsappInteractions']);router[_0xb26f('0x41')](_0xb26f('0x33'),auth['isAuthenticated'](),controller[_0xb26f('0x60')]);router[_0xb26f('0x41')](_0xb26f('0x61'),auth[_0xb26f('0xb')](),controller[_0xb26f('0x62')]);router[_0xb26f('0x41')]('/:id/openchannel_accounts',auth[_0xb26f('0xb')](),controller['addOpenchannelAccounts']);router['post']('/:id/sms_accounts',auth[_0xb26f('0xb')](),controller[_0xb26f('0x63')]);router[_0xb26f('0x41')](_0xb26f('0x3a'),auth[_0xb26f('0xb')](),controller[_0xb26f('0x64')]);router[_0xb26f('0x41')](_0xb26f('0x3c'),auth['isAuthenticated'](),controller[_0xb26f('0x65')]);router[_0xb26f('0x41')](_0xb26f('0x3f'),auth[_0xb26f('0xb')](),controller[_0xb26f('0x66')]);router[_0xb26f('0x67')](_0xb26f('0x13'),auth['isAuthenticated'](),controller['update']);router[_0xb26f('0x67')]('/:id/password',auth[_0xb26f('0xb')](),controller[_0xb26f('0x68')]);router['delete']('/:id/queues',auth['isAuthenticated'](),controller[_0xb26f('0x69')]);router[_0xb26f('0x6a')](_0xb26f('0x55'),auth[_0xb26f('0xb')](),controller['removeTeams']);router[_0xb26f('0x6a')](_0xb26f('0x13'),auth[_0xb26f('0xb')](),controller[_0xb26f('0x6b')]);router[_0xb26f('0x6a')](_0xb26f('0x56'),auth['isAuthenticated'](),controller[_0xb26f('0x6c')]);router[_0xb26f('0x6a')](_0xb26f('0x58'),auth[_0xb26f('0xb')](),controller[_0xb26f('0x6d')]);router[_0xb26f('0x6a')](_0xb26f('0x5a'),auth[_0xb26f('0xb')](),controller[_0xb26f('0x6e')]);router[_0xb26f('0x6a')]('/:id/sms_interactions',auth[_0xb26f('0xb')](),controller['removeSmsInteractions']);router[_0xb26f('0x6a')](_0xb26f('0x5d'),auth[_0xb26f('0xb')](),controller[_0xb26f('0x6f')]);router[_0xb26f('0x6a')]('/:id/whatsapp_interactions',auth[_0xb26f('0xb')](),controller[_0xb26f('0x70')]);router[_0xb26f('0x6a')](_0xb26f('0x33'),auth['isAuthenticated'](),controller[_0xb26f('0x71')]);router[_0xb26f('0x6a')](_0xb26f('0x61'),auth[_0xb26f('0xb')](),controller[_0xb26f('0x72')]);router['delete'](_0xb26f('0x36'),auth[_0xb26f('0xb')](),controller['removeOpenchannelAccounts']);router[_0xb26f('0x6a')]('/:id/sms_accounts',auth[_0xb26f('0xb')](),controller[_0xb26f('0x73')]);router[_0xb26f('0x6a')](_0xb26f('0x3a'),auth[_0xb26f('0xb')](),controller['removeChatWebsites']);router[_0xb26f('0x6a')](_0xb26f('0x3c'),auth[_0xb26f('0xb')](),controller[_0xb26f('0x74')]);router[_0xb26f('0x6a')]('/:id/api_key',auth[_0xb26f('0xb')](),controller[_0xb26f('0x75')]);router[_0xb26f('0x41')](_0xb26f('0x76'),auth[_0xb26f('0xb')](),controller['messengerSoundNotification']);module[_0xb26f('0x77')]=router; \ No newline at end of file +var _0x7c7d=['removeChatWebsites','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','get','/whoami','whoami','getPresence','show','/:id/avatar','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','getScreenRecordings','/:id/chat/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','/:id/agents','/:id/prefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','bulkCreate','addQueues','diskStorage','root','format','%s-%s','now','originalname','single','file','login','/:id/logout','logout','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addWhatsappAccounts','put','/:id','update','/:id/password','changePassword','delete','removeTeams','destroy','removeChatInteractions','removeMailInteractions','/:id/fax_interactions','removeFaxInteractions','/:id/sms_interactions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','/:id/chat_websites'];(function(_0x2ab3d9,_0x50e716){var _0x210a54=function(_0x24c479){while(--_0x24c479){_0x2ab3d9['push'](_0x2ab3d9['shift']());}};_0x210a54(++_0x50e716);}(_0x7c7d,0x158));var _0xd7c7=function(_0xb78ee,_0x706ed4){_0xb78ee=_0xb78ee-0x0;var _0x30258b=_0x7c7d[_0xb78ee];return _0x30258b;};'use strict';var multer=require(_0xd7c7('0x0'));var util=require(_0xd7c7('0x1'));var path=require(_0xd7c7('0x2'));var timeout=require(_0xd7c7('0x3'));var express=require(_0xd7c7('0x4'));var router=express[_0xd7c7('0x5')]();var fs_extra=require(_0xd7c7('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd7c7('0x7'));var config=require(_0xd7c7('0x8'));var controller=require('./user.controller');router['get']('/',auth[_0xd7c7('0x9')](),controller[_0xd7c7('0xa')]);router['get'](_0xd7c7('0xb'),auth[_0xd7c7('0x9')](),controller[_0xd7c7('0xc')]);router[_0xd7c7('0xd')](_0xd7c7('0xe'),auth[_0xd7c7('0x9')](),controller[_0xd7c7('0xf')]);router[_0xd7c7('0xd')]('/presence',auth[_0xd7c7('0x9')](),controller[_0xd7c7('0x10')]);router[_0xd7c7('0xd')]('/:id',auth[_0xd7c7('0x9')](),controller[_0xd7c7('0x11')]);router[_0xd7c7('0xd')](_0xd7c7('0x12'),controller['getAvatar']);router[_0xd7c7('0xd')]('/:id/open_tabs',auth['isAuthenticated'](),controller[_0xd7c7('0x13')]);router['get'](_0xd7c7('0x14'),auth[_0xd7c7('0x9')](),controller[_0xd7c7('0x15')]);router[_0xd7c7('0xd')](_0xd7c7('0x16'),auth[_0xd7c7('0x9')](),controller[_0xd7c7('0x17')]);router[_0xd7c7('0xd')](_0xd7c7('0x18'),auth['isAuthenticated'](),controller[_0xd7c7('0x19')]);router['get'](_0xd7c7('0x1a'),auth[_0xd7c7('0x9')](),controller[_0xd7c7('0x1b')]);router['get'](_0xd7c7('0x1c'),auth[_0xd7c7('0x9')](),controller[_0xd7c7('0x1d')]);router['get']('/:id/screen_recordings',auth[_0xd7c7('0x9')](),controller[_0xd7c7('0x1e')]);router['get'](_0xd7c7('0x1f'),auth[_0xd7c7('0x9')](),controller['getChatInteractions']);router[_0xd7c7('0xd')]('/:id/openchannel/interactions',auth[_0xd7c7('0x9')](),controller[_0xd7c7('0x20')]);router[_0xd7c7('0xd')](_0xd7c7('0x21'),auth['isAuthenticated'](),controller[_0xd7c7('0x22')]);router[_0xd7c7('0xd')](_0xd7c7('0x23'),auth[_0xd7c7('0x9')](),controller[_0xd7c7('0x24')]);router[_0xd7c7('0xd')](_0xd7c7('0x25'),auth['isAuthenticated'](),controller[_0xd7c7('0x26')]);router[_0xd7c7('0xd')](_0xd7c7('0x27'),auth[_0xd7c7('0x9')](),controller['getWhatsappInteractions']);router[_0xd7c7('0xd')](_0xd7c7('0x28'),auth['isAuthenticated'](),controller['getTeams']);router[_0xd7c7('0xd')]('/:id/lists',auth['isAuthenticated'](),controller['getLists']);router[_0xd7c7('0xd')](_0xd7c7('0x29'),auth[_0xd7c7('0x9')](),controller['getAgents']);router[_0xd7c7('0xd')](_0xd7c7('0x2a'),auth[_0xd7c7('0x9')](),controller['getVoicePrefixes']);router['get'](_0xd7c7('0x2b'),auth['isAuthenticated'](),controller[_0xd7c7('0x2c')]);router[_0xd7c7('0xd')](_0xd7c7('0x2d'),auth[_0xd7c7('0x9')](),controller[_0xd7c7('0x2e')]);router[_0xd7c7('0xd')](_0xd7c7('0x2f'),auth['isAuthenticated'](),controller[_0xd7c7('0x30')]);router[_0xd7c7('0xd')](_0xd7c7('0x31'),auth[_0xd7c7('0x9')](),controller[_0xd7c7('0x32')]);router[_0xd7c7('0xd')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0xd7c7('0x33')]);router[_0xd7c7('0xd')](_0xd7c7('0x34'),auth[_0xd7c7('0x9')](),controller['getWhatsappAccounts']);router['get'](_0xd7c7('0x35'),auth[_0xd7c7('0x9')](),controller[_0xd7c7('0x36')]);router[_0xd7c7('0xd')](_0xd7c7('0x37'),auth[_0xd7c7('0x9')](),controller[_0xd7c7('0x38')]);router[_0xd7c7('0x39')](_0xd7c7('0x14'),auth[_0xd7c7('0x9')](),controller[_0xd7c7('0x3a')]);router[_0xd7c7('0x39')]('/',auth[_0xd7c7('0x9')](),controller[_0xd7c7('0x3b')]);router[_0xd7c7('0x39')](_0xd7c7('0x3c'),auth[_0xd7c7('0x9')](),controller[_0xd7c7('0x3d')]);router[_0xd7c7('0x39')](_0xd7c7('0x16'),auth['isAuthenticated'](),controller[_0xd7c7('0x3e')]);var upload=multer({'storage':multer[_0xd7c7('0x3f')]({'destination':function(_0x35b25e,_0x4959dc,_0x590ad8){_0x590ad8(null,path['join'](config[_0xd7c7('0x40')],'server/files/images/'));},'filename':function(_0x77ee22,_0x39505b,_0x38eb3){_0x38eb3(null,util[_0xd7c7('0x41')](_0xd7c7('0x42'),Date[_0xd7c7('0x43')](),_0x39505b[_0xd7c7('0x44')]));}})});router[_0xd7c7('0x39')]('/:id/avatar',upload[_0xd7c7('0x45')](_0xd7c7('0x46')),controller['addAvatar']);router[_0xd7c7('0x39')]('/:id/login',auth[_0xd7c7('0x9')](),controller[_0xd7c7('0x47')]);router[_0xd7c7('0x39')](_0xd7c7('0x48'),auth['isAuthenticated'](),controller[_0xd7c7('0x49')]);router[_0xd7c7('0x39')]('/:id/pause',auth[_0xd7c7('0x9')](),controller[_0xd7c7('0x4a')]);router['post'](_0xd7c7('0x4b'),auth[_0xd7c7('0x9')](),controller[_0xd7c7('0x4c')]);router[_0xd7c7('0x39')](_0xd7c7('0x28'),auth['isAuthenticated'](),controller[_0xd7c7('0x4d')]);router[_0xd7c7('0x39')](_0xd7c7('0x4e'),auth[_0xd7c7('0x9')](),controller[_0xd7c7('0x4f')]);router[_0xd7c7('0x39')]('/:id/mail_interactions',auth[_0xd7c7('0x9')](),controller['addMailInteractions']);router['post']('/:id/fax_interactions',auth[_0xd7c7('0x9')](),controller['addFaxInteractions']);router[_0xd7c7('0x39')]('/:id/sms_interactions',auth[_0xd7c7('0x9')](),controller[_0xd7c7('0x50')]);router[_0xd7c7('0x39')](_0xd7c7('0x51'),auth[_0xd7c7('0x9')](),controller[_0xd7c7('0x52')]);router[_0xd7c7('0x39')](_0xd7c7('0x53'),auth['isAuthenticated'](),controller[_0xd7c7('0x54')]);router['post'](_0xd7c7('0x2b'),auth['isAuthenticated'](),controller[_0xd7c7('0x55')]);router[_0xd7c7('0x39')](_0xd7c7('0x2d'),auth[_0xd7c7('0x9')](),controller[_0xd7c7('0x56')]);router['post'](_0xd7c7('0x2f'),auth[_0xd7c7('0x9')](),controller[_0xd7c7('0x57')]);router[_0xd7c7('0x39')](_0xd7c7('0x31'),auth[_0xd7c7('0x9')](),controller['addSmsAccounts']);router['post']('/:id/chat_websites',auth[_0xd7c7('0x9')](),controller['addChatWebsites']);router[_0xd7c7('0x39')]('/:id/whatsapp_accounts',auth[_0xd7c7('0x9')](),controller[_0xd7c7('0x58')]);router['post'](_0xd7c7('0x37'),auth[_0xd7c7('0x9')](),controller['createApiKey']);router[_0xd7c7('0x59')](_0xd7c7('0x5a'),auth[_0xd7c7('0x9')](),controller[_0xd7c7('0x5b')]);router[_0xd7c7('0x59')](_0xd7c7('0x5c'),auth['isAuthenticated'](),controller[_0xd7c7('0x5d')]);router[_0xd7c7('0x5e')]('/:id/queues',auth[_0xd7c7('0x9')](),controller['removeQueues']);router[_0xd7c7('0x5e')](_0xd7c7('0x28'),auth['isAuthenticated'](),controller[_0xd7c7('0x5f')]);router[_0xd7c7('0x5e')](_0xd7c7('0x5a'),auth['isAuthenticated'](),controller[_0xd7c7('0x60')]);router[_0xd7c7('0x5e')]('/:id/chat_interactions',auth[_0xd7c7('0x9')](),controller[_0xd7c7('0x61')]);router['delete']('/:id/mail_interactions',auth[_0xd7c7('0x9')](),controller[_0xd7c7('0x62')]);router[_0xd7c7('0x5e')](_0xd7c7('0x63'),auth[_0xd7c7('0x9')](),controller[_0xd7c7('0x64')]);router[_0xd7c7('0x5e')](_0xd7c7('0x65'),auth['isAuthenticated'](),controller['removeSmsInteractions']);router['delete'](_0xd7c7('0x51'),auth[_0xd7c7('0x9')](),controller[_0xd7c7('0x66')]);router['delete'](_0xd7c7('0x53'),auth['isAuthenticated'](),controller['removeWhatsappInteractions']);router['delete'](_0xd7c7('0x2b'),auth[_0xd7c7('0x9')](),controller[_0xd7c7('0x67')]);router['delete'](_0xd7c7('0x2d'),auth['isAuthenticated'](),controller[_0xd7c7('0x68')]);router['delete'](_0xd7c7('0x2f'),auth[_0xd7c7('0x9')](),controller[_0xd7c7('0x69')]);router[_0xd7c7('0x5e')](_0xd7c7('0x31'),auth[_0xd7c7('0x9')](),controller[_0xd7c7('0x6a')]);router[_0xd7c7('0x5e')](_0xd7c7('0x6b'),auth['isAuthenticated'](),controller[_0xd7c7('0x6c')]);router[_0xd7c7('0x5e')](_0xd7c7('0x34'),auth['isAuthenticated'](),controller['removeWhatsappAccounts']);router['delete'](_0xd7c7('0x37'),auth[_0xd7c7('0x9')](),controller[_0xd7c7('0x6d')]);router[_0xd7c7('0x39')](_0xd7c7('0x6e'),auth[_0xd7c7('0x9')](),controller[_0xd7c7('0x6f')]);module[_0xd7c7('0x70')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 42fe3d8..d85bcf4 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 _0x7e72=['internal','toLowerCase','ENUM','admin','user','agent','telephone','local','INTEGER','format','getDataValue','fullname','BOOLEAN','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','transport','split','rfc2833','info','shortinfo','inband','auto','update','outgoing','yes','force_rport,comedia','join','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','uac','uas','fingerprint','passive','actpass','nonat','update,nonat','DATE','TEXT','showWebBar','get','isArray','udp','wss','encryption','avpf','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','force_avp','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','STRING','setDataValue','name','The\x20name\x20of\x20the\x20user','callerid','\x22%s\x22\x20<%s>'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7e72,0x1c2));var _0x27e7=function(_0xfbfa3b,_0x3e3288){_0xfbfa3b=_0xfbfa3b-0x0;var _0x3c83fd=_0x7e72[_0xfbfa3b];return _0x3c83fd;};'use strict';var Sequelize=require(_0x27e7('0x0'));var moment=require(_0x27e7('0x1'));var util=require(_0x27e7('0x2'));var _=require(_0x27e7('0x3'));module['exports']={'name':{'type':Sequelize[_0x27e7('0x4')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x31e0b4){this[_0x27e7('0x5')](_0x27e7('0x6'),_0x31e0b4);this[_0x27e7('0x5')]('defaultuser',_0x31e0b4);},'comment':_0x27e7('0x7')},'fullname':{'type':Sequelize[_0x27e7('0x4')],'allowNull':![],'set':function(_0x4e2d40){this[_0x27e7('0x5')]('fullname',_0x4e2d40);this[_0x27e7('0x5')](_0x27e7('0x8'),util['format'](_0x27e7('0x9'),_0x4e2d40,this['getDataValue'](_0x27e7('0xa'))));}},'alias':{'type':Sequelize[_0x27e7('0x4')]},'email':{'type':Sequelize[_0x27e7('0x4')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0xa501c9){if(_0xa501c9){this[_0x27e7('0x5')]('email',_0xa501c9[_0x27e7('0xb')]());}}},'role':{'type':Sequelize[_0x27e7('0xc')](_0x27e7('0xd'),_0x27e7('0xe'),_0x27e7('0xf'),_0x27e7('0x10')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x27e7('0x4')],'defaultValue':_0x27e7('0x11')},'internal':{'type':Sequelize[_0x27e7('0x12')](0xb),'allowNull':![],'unique':'internal','set':function(_0x285a38){this['setDataValue'](_0x27e7('0xa'),_0x285a38);this[_0x27e7('0x5')]('accountcode',_0x285a38);this[_0x27e7('0x5')]('callerid',util[_0x27e7('0x13')]('\x22%s\x22\x20<%s>',this[_0x27e7('0x14')](_0x27e7('0x15')),_0x285a38));}},'salt':{'type':Sequelize[_0x27e7('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x27e7('0x4')]},'address':{'type':Sequelize[_0x27e7('0x4')]},'zipcode':{'type':Sequelize[_0x27e7('0x4')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x27e7('0x4')]},'country':{'type':Sequelize[_0x27e7('0x4')]},'online':{'type':Sequelize[_0x27e7('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x27e7('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x27e7('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x27e7('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x27e7('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x27e7('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x27e7('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x27e7('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x27e7('0x4')],'defaultValue':_0x27e7('0x17')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x27e7('0x12')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x27e7('0x12')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x27e7('0x12')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x27e7('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x27e7('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x27e7('0x12')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x27e7('0x12')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x27e7('0x12')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x27e7('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x27e7('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x27e7('0x4')],'allowNull':!![],'defaultValue':_0x27e7('0x18')},'ipaddr':{'type':Sequelize[_0x27e7('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x27e7('0x12')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x27e7('0x12')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x27e7('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x27e7('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x27e7('0x12')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x27e7('0xc')](_0x27e7('0x19'),'user',_0x27e7('0x1a')),'allowNull':!![],'defaultValue':_0x27e7('0x19')},'context':{'type':Sequelize[_0x27e7('0x4')],'allowNull':!![],'defaultValue':_0x27e7('0x1b')},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED',_0x27e7('0x1c'),'ALLOWED_FAILED_SCREEN',_0x27e7('0x1d'),_0x27e7('0x1e'),'PROHIB_PASSED_SCREEN',_0x27e7('0x1f'),_0x27e7('0x20')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x27e7('0x4')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x27e7('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x27e7('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x27e7('0x4')],'allowNull':!![],'defaultValue':'udp','set':function(_0x22af00){this[_0x27e7('0x5')](_0x27e7('0x21'),_0x22af00?_0x22af00['join'](','):null);},'get':function(){return this[_0x27e7('0x14')]('transport')?this['getDataValue'](_0x27e7('0x21'))[_0x27e7('0x22')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x27e7('0xc')](_0x27e7('0x23'),_0x27e7('0x24'),_0x27e7('0x25'),_0x27e7('0x26'),_0x27e7('0x27')),'allowNull':!![],'defaultValue':_0x27e7('0x23')},'directmedia':{'type':Sequelize[_0x27e7('0xc')]('yes','no','nonat',_0x27e7('0x28'),_0x27e7('0x29')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x27e7('0xc')](_0x27e7('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x27e7('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x27e7('0x4')],'allowNull':!![],'defaultValue':_0x27e7('0x2b'),'set':function(_0x5dd597){this[_0x27e7('0x5')]('nat',_0x5dd597?_0x5dd597[_0x27e7('0x2c')](','):null);},'get':function(){return this['getDataValue'](_0x27e7('0x2d'))?this[_0x27e7('0x14')](_0x27e7('0x2d'))[_0x27e7('0x22')](','):null;},'comment':_0x27e7('0x2e')},'callgroup':{'type':Sequelize[_0x27e7('0x4')]},'namedcallgroup':{'type':Sequelize[_0x27e7('0x4')]},'pickupgroup':{'type':Sequelize[_0x27e7('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x27e7('0x4')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x27e7('0x4')],'allowNull':![],'defaultValue':_0x27e7('0x2f')},'allow':{'type':Sequelize[_0x27e7('0x4')],'allowNull':![],'defaultValue':_0x27e7('0x30'),'set':function(_0x5d8039){this['setDataValue'](_0x27e7('0x31'),_0x5d8039?_0x5d8039[_0x27e7('0x2c')](';'):_0x27e7('0x30'));},'get':function(){return this[_0x27e7('0x14')](_0x27e7('0x31'))?this[_0x27e7('0x14')](_0x27e7('0x31'))[_0x27e7('0x22')](';'):null;},'comment':_0x27e7('0x32')},'autoframing':{'type':Sequelize[_0x27e7('0xc')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x27e7('0x4')],'allowNull':!![],'set':function(_0x1a22d9){this[_0x27e7('0x5')](_0x27e7('0x33'),_0x1a22d9?_0x1a22d9[_0x27e7('0x2c')](','):null);},'get':function(){return this['getDataValue'](_0x27e7('0x33'))?this['getDataValue'](_0x27e7('0x33'))['split'](','):null;},'comment':_0x27e7('0x34')},'trustrpid':{'type':Sequelize[_0x27e7('0xc')](_0x27e7('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x27e7('0xc')](_0x27e7('0x2a'),'no',_0x27e7('0x35')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x27e7('0xc')](_0x27e7('0x2a'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x27e7('0xc')](_0x27e7('0x2a'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x27e7('0x12')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x27e7('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x27e7('0x4')],'allowNull':!![],'defaultValue':_0x27e7('0x36')},'amaflags':{'type':Sequelize[_0x27e7('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x27e7('0xc')]('yes','no'),'allowNull':!![],'defaultValue':_0x27e7('0x2a')},'busylevel':{'type':Sequelize[_0x27e7('0x12')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x27e7('0xc')](_0x27e7('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x27e7('0xc')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x27e7('0x2a'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x27e7('0xc')](_0x27e7('0x2a'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x27e7('0x4')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x27e7('0x2a'),'no',_0x27e7('0x37')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x27e7('0x12')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x27e7('0xc')](_0x27e7('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x27e7('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x27e7('0x38'),_0x27e7('0x39'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x27e7('0x12')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x27e7('0x12')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x27e7('0xc')](_0x27e7('0x3a'),_0x27e7('0x3b')),'allowNull':!![],'defaultValue':_0x27e7('0x3b')},'t38pt_usertpsource':{'type':Sequelize[_0x27e7('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x27e7('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x27e7('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x27e7('0xc')](_0x27e7('0x2a'),'no'),'allowNull':!![],'defaultValue':_0x27e7('0x2a')},'keepalive':{'type':Sequelize[_0x27e7('0x12')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x27e7('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x27e7('0x12')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x27e7('0x12')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x27e7('0x12')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x27e7('0xc')](_0x27e7('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x27e7('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x27e7('0x12')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x27e7('0x12')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x27e7('0x12')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x27e7('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x27e7('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x27e7('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x27e7('0x12')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x27e7('0xc')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x27e7('0xc')](_0x27e7('0x2a'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x27e7('0xc')](_0x27e7('0x2a'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x27e7('0xc')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x27e7('0xc')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x27e7('0x2a'),'no',_0x27e7('0x3c'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x27e7('0x12')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x27e7('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x27e7('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x27e7('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x27e7('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x27e7('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x27e7('0xc')]('active',_0x27e7('0x3d'),_0x27e7('0x3e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x27e7('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x27e7('0xc')](_0x27e7('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x27e7('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x27e7('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x27e7('0x12')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x27e7('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x27e7('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x27e7('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x27e7('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x27e7('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x27e7('0xc')](_0x27e7('0x2a'),'no',_0x27e7('0x3f'),_0x27e7('0x28'),_0x27e7('0x40')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x27e7('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x27e7('0x41')]},'passwordResetAt':{'type':Sequelize[_0x27e7('0x41')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x27e7('0x42')]},'showWebBar':{'type':Sequelize[_0x27e7('0x12')],'defaultValue':0x0,'set':function(_0x13a338){this['setDataValue'](_0x27e7('0x43'),_0x13a338);var _0x447bc1=this[_0x27e7('0x44')]({'plain':!![]});switch(_0x13a338){case 0x0:case 0x1:var _0x2aa909=_0x447bc1[_0x27e7('0x21')]?_[_0x27e7('0x45')](_0x447bc1[_0x27e7('0x21')])?_0x447bc1[_0x27e7('0x21')][_0x27e7('0x2c')]():_0x447bc1[_0x27e7('0x21')]:_0x27e7('0x46');if(_0x2aa909===_0x27e7('0x47')){_0x2aa909=_0x27e7('0x46');}this[_0x27e7('0x5')]('transport',_0x2aa909);this[_0x27e7('0x5')](_0x27e7('0x48'),'no');this[_0x27e7('0x5')](_0x27e7('0x49'),null);this['setDataValue']('force_avp',null);this[_0x27e7('0x5')](_0x27e7('0x4a'),null);this[_0x27e7('0x5')](_0x27e7('0x4b'),null);this[_0x27e7('0x5')](_0x27e7('0x4c'),null);this[_0x27e7('0x5')](_0x27e7('0x4d'),null);this[_0x27e7('0x5')](_0x27e7('0x4e'),null);this[_0x27e7('0x5')](_0x27e7('0x4f'),null);this[_0x27e7('0x5')](_0x27e7('0x50'),'no');break;case 0x2:this['setDataValue'](_0x27e7('0x21'),'wss');this[_0x27e7('0x5')](_0x27e7('0x48'),_0x27e7('0x2a'));this[_0x27e7('0x5')](_0x27e7('0x49'),_0x27e7('0x2a'));this['setDataValue'](_0x27e7('0x51'),_0x27e7('0x2a'));this[_0x27e7('0x5')](_0x27e7('0x4a'),'yes');this['setDataValue']('dtlsenable',_0x27e7('0x2a'));this[_0x27e7('0x5')](_0x27e7('0x4c'),'no');this[_0x27e7('0x5')](_0x27e7('0x4d'),_0x27e7('0x3e'));this['setDataValue'](_0x27e7('0x4e'),_0x447bc1[_0x27e7('0x4e')]||'/etc/pki/tls/certs/motion.crt');this[_0x27e7('0x5')](_0x27e7('0x4f'),_0x447bc1[_0x27e7('0x4f')]||'/etc/pki/tls/private/motion.key');this[_0x27e7('0x5')](_0x27e7('0x50'),_0x27e7('0x2a'));break;default:}}},'permissions':{'type':Sequelize[_0x27e7('0x42')],'set':function(_0x193bcc){this[_0x27e7('0x5')]('permissions',_0x193bcc?_0x193bcc[_0x27e7('0x2c')](','):[]);},'get':function(){return this[_0x27e7('0x14')](_0x27e7('0x52'))?_['map'](this['getDataValue'](_0x27e7('0x52'))[_0x27e7('0x22')](','),function(_0x4af306){return parseInt(_0x4af306,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x27e7('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x27e7('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x27e7('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0x27e7('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x27e7('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x27e7('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x27e7('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x27e7('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x27e7('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x27e7('0x12')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x27e7('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x27e7('0x12')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x27e7('0xc')](_0x27e7('0x2a'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x27e7('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x27e7('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x27e7('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x27e7('0x53')],'get':function(){return this[_0x27e7('0x14')]('phoneBarEnableScreenRecordingByAgent')?this[_0x27e7('0x14')](_0x27e7('0x54')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x27e7('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x27e7('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x27e7('0x16')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x27e7('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x27e7('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x16598e){if(typeof _0x16598e===_0x27e7('0x55')){var _0x28915e=_0x16598e==='1'?!![]:_0x16598e==='0'?![]:_0x16598e===_0x27e7('0x56')?!![]:_0x16598e==='false'?![]:![];this['setDataValue'](_0x27e7('0x57'),_0x28915e);}else{this[_0x27e7('0x5')]('screenrecording',_0x16598e);}}},'blocked':{'type':Sequelize[_0x27e7('0x16')],'defaultValue':![],'set':function(_0x1a0dab){this[_0x27e7('0x5')](_0x27e7('0x58'),_0x1a0dab);if(_0x1a0dab===!![]){this[_0x27e7('0x5')](_0x27e7('0x59'),moment());this['setDataValue'](_0x27e7('0x5a'),0x0);}else{this[_0x27e7('0x5')](_0x27e7('0x59'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x27e7('0x12')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x27e7('0x16')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x27e7('0x16')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x27e7('0x12')](0x5)[_0x27e7('0x5b')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x27e7('0x16')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x27e7('0x16')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x27e7('0x16')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x27e7('0x16')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x27e7('0x16')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x27e7('0x12')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x27e7('0x12')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x27e7('0x16')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x27e7('0x12')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x27e7('0x16')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x27e7('0x16')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x27e7('0x16')],'defaultValue':![]}}; \ No newline at end of file +var _0x3948=['join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','yes','nonat','outgoing','force_rport,comedia','nat','split','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','always','accept','uac','uas','fingerprint','certificate','active','passive','actpass','update','update,nonat','TEXT','get','isArray','encryption','avpf','dtlssetup','dtlscertfile','rtcp_mux','force_avp','dtlsenable','dtlsverify','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','exports','STRING','name','setDataValue','defaultuser','fullname','format','\x22%s\x22\x20<%s>','getDataValue','email','toLowerCase','admin','user','local','internal','accountcode','callerid','BOOLEAN','DEFAULT\x20PAUSE','DATE','INTEGER','dynamic','ENUM','friend','peer','from-sip','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport'];(function(_0x36f1b9,_0x64bb99){var _0x11280d=function(_0x3a0601){while(--_0x3a0601){_0x36f1b9['push'](_0x36f1b9['shift']());}};_0x11280d(++_0x64bb99);}(_0x3948,0x93));var _0x8394=function(_0x209b37,_0x19f075){_0x209b37=_0x209b37-0x0;var _0x1d8b90=_0x3948[_0x209b37];return _0x1d8b90;};'use strict';var Sequelize=require(_0x8394('0x0'));var moment=require(_0x8394('0x1'));var util=require(_0x8394('0x2'));var _=require('lodash');module[_0x8394('0x3')]={'name':{'type':Sequelize[_0x8394('0x4')],'allowNull':![],'unique':_0x8394('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x4ce966){this[_0x8394('0x6')](_0x8394('0x5'),_0x4ce966);this['setDataValue'](_0x8394('0x7'),_0x4ce966);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x4e5afe){this[_0x8394('0x6')](_0x8394('0x8'),_0x4e5afe);this[_0x8394('0x6')]('callerid',util[_0x8394('0x9')](_0x8394('0xa'),_0x4e5afe,this[_0x8394('0xb')]('internal')));}},'alias':{'type':Sequelize[_0x8394('0x4')]},'email':{'type':Sequelize[_0x8394('0x4')],'allowNull':![],'unique':_0x8394('0xc'),'validate':{'isEmail':!![]},'set':function(_0x224a45){if(_0x224a45){this['setDataValue'](_0x8394('0xc'),_0x224a45[_0x8394('0xd')]());}}},'role':{'type':Sequelize['ENUM'](_0x8394('0xe'),_0x8394('0xf'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x8394('0x4')],'defaultValue':_0x8394('0x10')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x8394('0x11'),'set':function(_0x4ba95a){this[_0x8394('0x6')](_0x8394('0x11'),_0x4ba95a);this[_0x8394('0x6')](_0x8394('0x12'),_0x4ba95a);this['setDataValue'](_0x8394('0x13'),util[_0x8394('0x9')](_0x8394('0xa'),this[_0x8394('0xb')](_0x8394('0x8')),_0x4ba95a));}},'salt':{'type':Sequelize[_0x8394('0x4')]},'phone':{'type':Sequelize[_0x8394('0x4')]},'mobile':{'type':Sequelize[_0x8394('0x4')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x8394('0x4')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x8394('0x4')]},'country':{'type':Sequelize[_0x8394('0x4')]},'online':{'type':Sequelize[_0x8394('0x14')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x8394('0x14')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x8394('0x14')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x8394('0x14')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x8394('0x14')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x8394('0x14')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x8394('0x14')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x8394('0x14')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x8394('0x4')],'defaultValue':_0x8394('0x15')},'lastPauseAt':{'type':Sequelize[_0x8394('0x16')]},'chatCapacity':{'type':Sequelize[_0x8394('0x17')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x8394('0x17')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x8394('0x17')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x8394('0x17')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x8394('0x17')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x8394('0x17')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x8394('0x14')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x8394('0x17')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x8394('0x17')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x8394('0x17')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x8394('0x14')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x8394('0x14')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x8394('0x18')},'ipaddr':{'type':Sequelize[_0x8394('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x8394('0x17')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x8394('0x17')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x8394('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x8394('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x8394('0x17')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x8394('0x19')](_0x8394('0x1a'),_0x8394('0xf'),_0x8394('0x1b')),'allowNull':!![],'defaultValue':_0x8394('0x1a')},'context':{'type':Sequelize[_0x8394('0x4')],'allowNull':!![],'defaultValue':_0x8394('0x1c')},'callingpres':{'type':Sequelize[_0x8394('0x19')]('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN',_0x8394('0x1d'),_0x8394('0x1e'),_0x8394('0x1f'),_0x8394('0x20'),_0x8394('0x21'),_0x8394('0x22')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x8394('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x8394('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x8394('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x8394('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x8394('0x4')],'allowNull':!![],'defaultValue':_0x8394('0x23'),'set':function(_0xba32d1){this[_0x8394('0x6')](_0x8394('0x24'),_0xba32d1?_0xba32d1[_0x8394('0x25')](','):null);},'get':function(){return this[_0x8394('0xb')](_0x8394('0x24'))?this['getDataValue'](_0x8394('0x24'))['split'](','):null;},'comment':_0x8394('0x26')},'dtmfmode':{'type':Sequelize[_0x8394('0x19')](_0x8394('0x27'),_0x8394('0x28'),_0x8394('0x29'),'inband',_0x8394('0x2a')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x8394('0x19')](_0x8394('0x2b'),'no',_0x8394('0x2c'),'update',_0x8394('0x2d')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x8394('0x19')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x8394('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x8394('0x2e'),'set':function(_0x30ec9a){this['setDataValue'](_0x8394('0x2f'),_0x30ec9a?_0x30ec9a[_0x8394('0x25')](','):null);},'get':function(){return this[_0x8394('0xb')](_0x8394('0x2f'))?this[_0x8394('0xb')](_0x8394('0x2f'))[_0x8394('0x30')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x8394('0x4')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x8394('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x8394('0x4')]},'language':{'type':Sequelize[_0x8394('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x8394('0x4')]},'disallow':{'type':Sequelize[_0x8394('0x4')],'allowNull':![],'defaultValue':_0x8394('0x31')},'allow':{'type':Sequelize[_0x8394('0x4')],'allowNull':![],'defaultValue':_0x8394('0x32'),'set':function(_0x3927e2){this[_0x8394('0x6')](_0x8394('0x33'),_0x3927e2?_0x3927e2[_0x8394('0x25')](';'):_0x8394('0x32'));},'get':function(){return this[_0x8394('0xb')](_0x8394('0x33'))?this[_0x8394('0xb')](_0x8394('0x33'))['split'](';'):null;},'comment':_0x8394('0x34')},'autoframing':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x8394('0x4')],'allowNull':!![],'set':function(_0x175996){this[_0x8394('0x6')]('insecure',_0x175996?_0x175996[_0x8394('0x25')](','):null);},'get':function(){return this[_0x8394('0xb')](_0x8394('0x35'))?this[_0x8394('0xb')](_0x8394('0x35'))[_0x8394('0x30')](','):null;},'comment':_0x8394('0x36')},'trustrpid':{'type':Sequelize[_0x8394('0x19')](_0x8394('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x8394('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x8394('0x2b'),'no',_0x8394('0x37')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x8394('0x19')](_0x8394('0x2b'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x8394('0x19')](_0x8394('0x2b'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x8394('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x8394('0x4')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x8394('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x8394('0x19')](_0x8394('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x8394('0x2b')},'busylevel':{'type':Sequelize[_0x8394('0x17')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x8394('0x2b'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x8394('0x19')](_0x8394('0x2b'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x8394('0x19')](_0x8394('0x2b'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x8394('0x19')](_0x8394('0x2b'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x8394('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x8394('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x8394('0x2b'),'no',_0x8394('0x38')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x8394('0x17')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x8394('0x19')](_0x8394('0x2b'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x8394('0x39'),'refuse','originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x8394('0x17')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x8394('0x19')](_0x8394('0x3a'),_0x8394('0x3b')),'allowNull':!![],'defaultValue':_0x8394('0x3b')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x8394('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x8394('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x8394('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x8394('0x19')](_0x8394('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x8394('0x2b')},'keepalive':{'type':Sequelize[_0x8394('0x17')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x8394('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x8394('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x8394('0x17')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x8394('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x8394('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x8394('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x8394('0x17')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x8394('0x17')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x8394('0x17')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x8394('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x8394('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x8394('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x8394('0x17')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x8394('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x8394('0x19')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x8394('0x19')](_0x8394('0x2b'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x8394('0x19')](_0x8394('0x2b'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x8394('0x2b'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x8394('0x2b'),'no',_0x8394('0x3c'),_0x8394('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x8394('0x17')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x8394('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x8394('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x8394('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x8394('0x19')](_0x8394('0x3e'),_0x8394('0x3f'),_0x8394('0x40')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x8394('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x8394('0x19')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x8394('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x8394('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x8394('0x19')](_0x8394('0x2b'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x8394('0x19')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x8394('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x8394('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x8394('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x8394('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x8394('0x19')](_0x8394('0x2b'),'no','nonat',_0x8394('0x41'),_0x8394('0x42')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x8394('0x14')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x8394('0x16')]},'passwordResetAt':{'type':Sequelize[_0x8394('0x16')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x8394('0x43')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x4e57ff){this[_0x8394('0x6')]('showWebBar',_0x4e57ff);var _0xe9ac3e=this[_0x8394('0x44')]({'plain':!![]});switch(_0x4e57ff){case 0x0:case 0x1:var _0x246702=_0xe9ac3e[_0x8394('0x24')]?_[_0x8394('0x45')](_0xe9ac3e[_0x8394('0x24')])?_0xe9ac3e[_0x8394('0x24')][_0x8394('0x25')]():_0xe9ac3e[_0x8394('0x24')]:_0x8394('0x23');if(_0x246702==='wss'){_0x246702=_0x8394('0x23');}this[_0x8394('0x6')](_0x8394('0x24'),_0x246702);this[_0x8394('0x6')](_0x8394('0x46'),'no');this[_0x8394('0x6')](_0x8394('0x47'),null);this[_0x8394('0x6')]('force_avp',null);this['setDataValue']('icesupport',null);this[_0x8394('0x6')]('dtlsenable',null);this['setDataValue']('dtlsverify',null);this[_0x8394('0x6')](_0x8394('0x48'),null);this['setDataValue'](_0x8394('0x49'),null);this[_0x8394('0x6')]('dtlsprivatekey',null);this[_0x8394('0x6')](_0x8394('0x4a'),'no');break;case 0x2:this[_0x8394('0x6')](_0x8394('0x24'),'wss');this[_0x8394('0x6')](_0x8394('0x46'),_0x8394('0x2b'));this[_0x8394('0x6')](_0x8394('0x47'),_0x8394('0x2b'));this[_0x8394('0x6')](_0x8394('0x4b'),_0x8394('0x2b'));this[_0x8394('0x6')]('icesupport',_0x8394('0x2b'));this[_0x8394('0x6')](_0x8394('0x4c'),'yes');this[_0x8394('0x6')](_0x8394('0x4d'),'no');this['setDataValue']('dtlssetup',_0x8394('0x40'));this[_0x8394('0x6')](_0x8394('0x49'),_0xe9ac3e[_0x8394('0x49')]||_0x8394('0x4e'));this[_0x8394('0x6')](_0x8394('0x4f'),_0xe9ac3e[_0x8394('0x4f')]||'/etc/pki/tls/private/motion.key');this['setDataValue'](_0x8394('0x4a'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x8394('0x43')],'set':function(_0x56af6a){this[_0x8394('0x6')](_0x8394('0x50'),_0x56af6a?_0x56af6a[_0x8394('0x25')](','):[]);},'get':function(){return this['getDataValue'](_0x8394('0x50'))?_[_0x8394('0x51')](this[_0x8394('0xb')]('permissions')[_0x8394('0x30')](','),function(_0x358949){return parseInt(_0x358949,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x8394('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0x8394('0x14')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x8394('0x14')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x8394('0x14')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x8394('0x14')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x8394('0x14')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x8394('0x14')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x8394('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x8394('0x17')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x8394('0x19')](_0x8394('0x2b'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x8394('0x14')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x8394('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x8394('0x14')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x8394('0x14')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x8394('0x52')],'get':function(){return this[_0x8394('0xb')](_0x8394('0x53'))?this['getDataValue'](_0x8394('0x53')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x8394('0x14')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x8394('0x14')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x8394('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x8394('0x14')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x8394('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x8394('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x8394('0x14')],'defaultValue':![],'set':function(_0x34b68b){if(typeof _0x34b68b===_0x8394('0x54')){var _0x25a31c=_0x34b68b==='1'?!![]:_0x34b68b==='0'?![]:_0x34b68b===_0x8394('0x55')?!![]:_0x34b68b===_0x8394('0x56')?![]:![];this[_0x8394('0x6')](_0x8394('0x57'),_0x25a31c);}else{this[_0x8394('0x6')](_0x8394('0x57'),_0x34b68b);}}},'blocked':{'type':Sequelize[_0x8394('0x14')],'defaultValue':![],'set':function(_0x452f29){this[_0x8394('0x6')](_0x8394('0x58'),_0x452f29);if(_0x452f29===!![]){this[_0x8394('0x6')](_0x8394('0x59'),moment());this[_0x8394('0x6')](_0x8394('0x5a'),0x0);}else{this[_0x8394('0x6')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x8394('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x8394('0x17')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x8394('0x14')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x8394('0x14')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x8394('0x17')](0x5)[_0x8394('0x5b')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x8394('0x14')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x8394('0x14')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x8394('0x14')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x8394('0x14')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x8394('0x14')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x8394('0x14')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x8394('0x17')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x8394('0x14')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x8394('0x17')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x8394('0x14')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x8394('0x14')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x8394('0x17')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x8394('0x17')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x8394('0x14')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 1fe9c24..3858510 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 _0x2ffa=['getChannels','YYYY-MM-DD\x20HH:mm:ss','LOGIN','PAUSE','LOGININPAUSE','resolve','logout','type','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','lastPauseAt','Team','getTeams','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','getAssociatedQueues','flattenDeep','addAgent','getDataValue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','Voice','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','OpenchannelAccount','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','ChatWebsite','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','CmHopper','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notIn','$like','$notLike','$iLike','$notILike','$contains','$contained','firstName','lastName','phone','CmContact','Contact','dialActive','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','createApiKey','nonce','apiKeyNonce','API\x20key\x20not\x20available','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','unknown','teams','queues','flatten','toString','col','asc','desc','substring','orderBy','pause','voiceStatus','slice','charAt','SELECT','select','field','ui.','InteractionId','ui.createdAt','ui.UserId\x20=\x20?','OpenTabs','messengerSoundNotification','enabled','moment','util','lodash','../../components/auth/service','../../components/contacts','../../components/realtime/agents','../../config/logger','../../config/utils','../../config/license/util','../../errors/api','APINotFoundError','../../mysqldb','socket.io-emitter','redis','./user.socket','register','defaults','localhost','sendStatus','status','end','json','undefined','limit','count','offset','set','update','then','role','agent','userNotification:recalc:','destroy','get','Users','Agents','Telephones','telephone','filter','ignore','map','includes','find','value','UserProfileResource','error','stack','name','send','User','rawAttributes','fieldName','password','salt','previousPasswords','resetPasswordToken','resetPasswordExpires','md5secret','index','query','userSetting','true','include','attributes','rows','length','push','chat','dataValues','fax','whatsapp','all','show','params','getOptions','includeAll','UserSetting','options','openchannel','mail','body','catch','describe','addContacts','omit','ids','Setting','findById','validatePasswordPattern','internal','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','from','voicemail','fullname','permissions','101','103','113','110','104','105','106','107','108','109','111','114','115','user','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','settingsEnabled','userProfileId','VoiceMail','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','Unauthorized','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','create','UserProfileSection','findAll','isEmpty','compact','changePassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','Wrong\x20credentials','oldPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','findOne','securePassword','enforcePasswordHistory','passwordHistoryLimit','addQueues','channel','online','loginInPause','voicePause','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','spread','QueueId','emit','Queue:save','VoiceQueue','voice','interface','format','upsert','isValidChannel','remove','Queue:remove','UserVoiceQueueRt','userpic','file','filename','getAvatar','root','server/files/images/logos/default_profile.png','download','join','server/files/images/','getOpenTabs','CHAT','createdAt','FaxOpenTabs','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','getContacts','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','CmList','Tag','Tags','color','tag','getQueues','keys','filters','intersection','model','order','sort','where','pick','merge','Queue','nolimit','getVoiceQueuesRt','fields','getGroups','getRecordings','VoiceRecording','UserId','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','mobile','LOCAL/%s@from-sip/n','intrf','SIP/%s','user:%s','user:forcelogout','headers','connection','socket','remoteAddress','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach'];(function(_0x41f807,_0x16742c){var _0x1636f0=function(_0x28bba4){while(--_0x28bba4){_0x41f807['push'](_0x41f807['shift']());}};_0x1636f0(++_0x16742c);}(_0x2ffa,0x8b));var _0xa2ff=function(_0x6c927,_0xa19f8b){_0x6c927=_0x6c927-0x0;var _0x338d68=_0x2ffa[_0x6c927];return _0x338d68;};'use strict';var moment=require(_0xa2ff('0x0'));var util=require(_0xa2ff('0x1'));var path=require('path');var fs=require('fs');var _=require(_0xa2ff('0x2'));var squel=require('squel');var Redis=require('ioredis');var authService=require(_0xa2ff('0x3'));var contacts=require(_0xa2ff('0x4'));var qs=require('../../components/parsers/qs');var rta=require(_0xa2ff('0x5'));var logger=require(_0xa2ff('0x6'))('api');var utils=require(_0xa2ff('0x7'));var config=require('../../config/environment');var licenseUtil=require(_0xa2ff('0x8'));var APIBadRequestError=require(_0xa2ff('0x9'))['APIBadRequestError'];var APINotFoundError=require(_0xa2ff('0x9'))[_0xa2ff('0xa')];var APIHandleError=require('../../errors/api')['handleError'];var db=require(_0xa2ff('0xb'))['db'];var socket=require(_0xa2ff('0xc'))(new Redis(config[_0xa2ff('0xd')]));require(_0xa2ff('0xe'))[_0xa2ff('0xf')](socket);config[_0xa2ff('0xd')]=_[_0xa2ff('0x10')](config[_0xa2ff('0xd')],{'host':_0xa2ff('0x11'),'port':0x18eb});var values;function respondWithStatusCode(_0x18c38a,_0x398892){_0x398892=_0x398892||0xcc;return function(_0x4b2488){if(_0x4b2488){return _0x18c38a[_0xa2ff('0x12')](_0x398892);}return _0x18c38a[_0xa2ff('0x13')](_0x398892)[_0xa2ff('0x14')]();};}function respondWithResult(_0x35033f,_0x39e8ba){_0x39e8ba=_0x39e8ba||0xc8;return function(_0x374627){if(_0x374627){return _0x35033f[_0xa2ff('0x13')](_0x39e8ba)[_0xa2ff('0x15')](_0x374627);}};}function respondWithFilteredResult(_0x5eb479,_0x1d3575){return function(_0x143f98){if(_0x143f98){var _0x1d42c7=typeof _0x1d3575['offset']===_0xa2ff('0x16')&&typeof _0x1d3575[_0xa2ff('0x17')]===_0xa2ff('0x16');var _0x2cb575=_0x143f98[_0xa2ff('0x18')];var _0x48c7e5=_0x1d42c7?0x0:_0x1d3575[_0xa2ff('0x19')];var _0x31e238=_0x1d42c7?_0x143f98[_0xa2ff('0x18')]:_0x1d3575['offset']+_0x1d3575['limit'];var _0x4fe04e;if(_0x31e238>=_0x2cb575){_0x31e238=_0x2cb575;_0x4fe04e=0xc8;}else{_0x4fe04e=0xce;}_0x5eb479['status'](_0x4fe04e);return _0x5eb479[_0xa2ff('0x1a')]('Content-Range',_0x48c7e5+'-'+_0x31e238+'/'+_0x2cb575)['json'](_0x143f98);}return null;};}function saveUpdates(_0x66f6e7){return function(_0x5e382f){if(_0x5e382f){return _0x5e382f[_0xa2ff('0x1b')](_0x66f6e7)[_0xa2ff('0x1c')](function(_0x5a9d95){if(_0x5a9d95[_0xa2ff('0x1d')]===_0xa2ff('0x1e')){socket['emit'](_0xa2ff('0x1f')+_0x5a9d95['id'],_0x5a9d95);}return _0x5a9d95;});}return null;};}function removeEntity(_0x547046){return function(_0x522ed7){if(_0x522ed7){return _0x522ed7[_0xa2ff('0x20')]()[_0xa2ff('0x1c')](function(){var _0x8352a4=_0x522ed7[_0xa2ff('0x21')]({'plain':!![]});if(_0x8352a4[_0xa2ff('0x1d')]==='admin')return;var _0x2eb195=[{'name':_0xa2ff('0x22'),'value':'user','ignore':!![]},{'name':_0xa2ff('0x23'),'value':'agent','ignore':![]},{'name':_0xa2ff('0x24'),'value':_0xa2ff('0x25'),'ignore':![]}];var _0x1797c4=_(_0x2eb195)[_0xa2ff('0x26')](_0xa2ff('0x27'))[_0xa2ff('0x28')]('value')['value']();if(_[_0xa2ff('0x29')](_0x1797c4,_0x8352a4[_0xa2ff('0x1d')])){return;}var _0x4b8899=_[_0xa2ff('0x2a')](_0x2eb195,[_0xa2ff('0x2b'),_0x8352a4[_0xa2ff('0x1d')]])['name'];return db[_0xa2ff('0x2c')][_0xa2ff('0x20')]({'where':{'type':_0x4b8899,'resourceId':_0x8352a4['id']}})[_0xa2ff('0x1c')](function(){return _0x522ed7;});})[_0xa2ff('0x1c')](function(){_0x547046[_0xa2ff('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59d76c){return function(_0x3959f){if(!_0x3959f){_0x59d76c[_0xa2ff('0x12')](0x194);}return _0x3959f;};}function handleError(_0x18ea56,_0x42113a){_0x42113a=_0x42113a||0x1f4;return function(_0xf30c29){logger[_0xa2ff('0x2d')](_0xf30c29[_0xa2ff('0x2e')]);if(_0xf30c29[_0xa2ff('0x2f')]){delete _0xf30c29[_0xa2ff('0x2f')];}_0x18ea56[_0xa2ff('0x13')](_0x42113a)[_0xa2ff('0x30')](_0xf30c29);};}function getUserAttributes(){return _(db[_0xa2ff('0x31')][_0xa2ff('0x32')])[_0xa2ff('0x28')](function(_0x554222){return{'name':_0x554222[_0xa2ff('0x33')],'type':_0x554222['type']['key']};})[_0xa2ff('0x26')](function(_0x4aaff9){return![_0xa2ff('0x34'),_0xa2ff('0x35'),_0xa2ff('0x36'),_0xa2ff('0x37'),_0xa2ff('0x38'),_0xa2ff('0x39')]['includes'](_0x4aaff9[_0xa2ff('0x2f')]);})['value']();}exports[_0xa2ff('0x3a')]=function(_0x5d3408,_0x39688d){var _0x585a0b={},_0x476a3d={'count':0x0,'rows':[]};var _0x464a98=getUserAttributes();_0x585a0b=qs['getOptions'](_0x464a98,_0x5d3408);var _0x385e1c={'where':_0x585a0b['where']};return db['User'][_0xa2ff('0x18')](_0x385e1c)[_0xa2ff('0x1c')](function(_0x3e1ef7){_0x476a3d[_0xa2ff('0x18')]=_0x3e1ef7;if(_0x5d3408[_0xa2ff('0x3b')]['includeAll']){_0x585a0b['include']=[{'all':!![]}];}if(_0x5d3408[_0xa2ff('0x3b')][_0xa2ff('0x3c')]===_0xa2ff('0x3d')){_0x585a0b[_0xa2ff('0x3e')]=[{'model':db['UserSetting'],'as':'userSetting'}];}if(!_[_0xa2ff('0x29')](_0x585a0b[_0xa2ff('0x3f')],'id')){_0x585a0b[_0xa2ff('0x3f')]['push']('id');}return db[_0xa2ff('0x31')]['findAll'](_0x585a0b);})[_0xa2ff('0x1c')](function(_0x1be9e0){_0x476a3d[_0xa2ff('0x40')]=_0x1be9e0;if(_0x5d3408[_0xa2ff('0x3b')]['openTabs']===_0xa2ff('0x3d')){var _0x10e97c=[];for(var _0xd1bb08=0x0;_0xd1bb08<_0x476a3d['rows'][_0xa2ff('0x41')];_0xd1bb08++){_0x10e97c[_0xa2ff('0x42')](get_open_tabs(_0xa2ff('0x43'),_0x476a3d[_0xa2ff('0x40')][_0xd1bb08][_0xa2ff('0x44')]));_0x10e97c[_0xa2ff('0x42')](get_open_tabs('sms',_0x476a3d[_0xa2ff('0x40')][_0xd1bb08][_0xa2ff('0x44')]));_0x10e97c[_0xa2ff('0x42')](get_open_tabs(_0xa2ff('0x45'),_0x476a3d[_0xa2ff('0x40')][_0xd1bb08][_0xa2ff('0x44')]));_0x10e97c['push'](get_open_tabs('mail',_0x476a3d[_0xa2ff('0x40')][_0xd1bb08]['dataValues']));_0x10e97c[_0xa2ff('0x42')](get_open_tabs('openchannel',_0x476a3d['rows'][_0xd1bb08][_0xa2ff('0x44')]));_0x10e97c[_0xa2ff('0x42')](get_open_tabs(_0xa2ff('0x46'),_0x476a3d[_0xa2ff('0x40')][_0xd1bb08][_0xa2ff('0x44')]));}return Promise[_0xa2ff('0x47')](_0x10e97c)[_0xa2ff('0x1c')](function(){return _0x476a3d;});}else{return _0x476a3d;}})[_0xa2ff('0x1c')](respondWithFilteredResult(_0x39688d,_0x585a0b))['catch'](handleError(_0x39688d,null));};exports[_0xa2ff('0x48')]=function(_0x11b69b,_0x389cf6){var _0x19cd3b=getUserAttributes();_0x11b69b[_0xa2ff('0x3b')]['id']=_0x11b69b[_0xa2ff('0x49')]['id'];var _0x6623a7=qs[_0xa2ff('0x4a')](_0x19cd3b,_0x11b69b);if(_0x11b69b[_0xa2ff('0x3b')][_0xa2ff('0x4b')]){_0x6623a7['include']=[{'all':!![]}];}if(_0x11b69b['query']['userSetting']==='true'){_0x6623a7[_0xa2ff('0x3e')]=[{'model':db[_0xa2ff('0x4c')],'as':_0xa2ff('0x3c')}];}_0x6623a7=_['merge']({},_0x6623a7,_0x11b69b[_0xa2ff('0x4d')]);if(!_[_0xa2ff('0x29')](_0x6623a7[_0xa2ff('0x3f')],'id')){_0x6623a7[_0xa2ff('0x3f')][_0xa2ff('0x42')]('id');}return db[_0xa2ff('0x31')][_0xa2ff('0x2a')](_0x6623a7)[_0xa2ff('0x1c')](handleEntityNotFound(_0x389cf6,null))[_0xa2ff('0x1c')](function(_0x4912c3){var _0x103a80=[];values=_0x4912c3;if(_0x11b69b[_0xa2ff('0x3b')]['openTabs']===_0xa2ff('0x3d')){_0x103a80[_0xa2ff('0x42')](get_open_tabs('chat',_0x4912c3[_0xa2ff('0x44')]));_0x103a80[_0xa2ff('0x42')](get_open_tabs('sms',_0x4912c3[_0xa2ff('0x44')]));_0x103a80[_0xa2ff('0x42')](get_open_tabs(_0xa2ff('0x4e'),_0x4912c3['dataValues']));_0x103a80[_0xa2ff('0x42')](get_open_tabs(_0xa2ff('0x46'),_0x4912c3['dataValues']));_0x103a80[_0xa2ff('0x42')](get_open_tabs(_0xa2ff('0x45'),_0x4912c3['dataValues']));_0x103a80[_0xa2ff('0x42')](get_open_tabs(_0xa2ff('0x4f'),_0x4912c3['dataValues']));return Promise[_0xa2ff('0x47')](_0x103a80);}else{return values;}})['then'](function(){return values;})[_0xa2ff('0x1c')](respondWithResult(_0x389cf6,null))['catch'](handleError(_0x389cf6,null));};exports['update']=function(_0x452a37,_0x1f85f2){if(_0x452a37[_0xa2ff('0x50')]['id']){delete _0x452a37[_0xa2ff('0x50')]['id'];}delete _0x452a37['body'][_0xa2ff('0x1d')];return db[_0xa2ff('0x31')]['find']({'where':{'id':_0x452a37[_0xa2ff('0x49')]['id']}})[_0xa2ff('0x1c')](handleEntityNotFound(_0x1f85f2,null))[_0xa2ff('0x1c')](saveUpdates(_0x452a37[_0xa2ff('0x50')],null))['then'](respondWithResult(_0x1f85f2,null))[_0xa2ff('0x51')](handleError(_0x1f85f2,null));};exports[_0xa2ff('0x52')]=function(_0x1cc6d0,_0xff32db){return db['User']['describe']()[_0xa2ff('0x1c')](respondWithResult(_0xff32db,null))['catch'](handleError(_0xff32db,null));};exports[_0xa2ff('0x53')]=function(_0x616701,_0x4dd018){return db['User'][_0xa2ff('0x2a')]({'where':{'id':_0x616701['params']['id']}})[_0xa2ff('0x1c')](handleEntityNotFound(_0x4dd018,null))[_0xa2ff('0x1c')](function(_0x2eeb11){if(_0x2eeb11){return _0x2eeb11[_0xa2ff('0x53')](_0x616701[_0xa2ff('0x50')]['ids'],_[_0xa2ff('0x54')](_0x616701['body'],[_0xa2ff('0x55'),'id'])||{});}})['then'](respondWithResult(_0x4dd018,null))[_0xa2ff('0x51')](handleError(_0x4dd018,null));};function validateUser(_0x25ca8d){return new Promise(function(_0x148caa,_0x930f2c){if(_0x25ca8d['internal'])return _0x148caa(_0x25ca8d);return db[_0xa2ff('0x56')][_0xa2ff('0x57')](0x1)['then'](function(_0x172e9a){if(_0x172e9a['securePassword'])authService[_0xa2ff('0x58')](_0x25ca8d['password']);db[_0xa2ff('0x31')]['max'](_0xa2ff('0x59'))[_0xa2ff('0x1c')](function(_0x41e3e4){if(_[_0xa2ff('0x5a')](_0x41e3e4)){_0x25ca8d[_0xa2ff('0x59')]=_0x172e9a[_0xa2ff('0x5b')]||0x1;return;}if(_[_0xa2ff('0x5a')](_0x172e9a[_0xa2ff('0x5b')])||_0x172e9a['min_internal']===_0x41e3e4){_0x25ca8d[_0xa2ff('0x59')]=_0x41e3e4+0x1;return;}if(_0x172e9a[_0xa2ff('0x5b')]>_0x41e3e4){_0x25ca8d[_0xa2ff('0x59')]=_0x172e9a[_0xa2ff('0x5b')];return;}return db[_0xa2ff('0x5c')][_0xa2ff('0x3b')](_0xa2ff('0x5d'),{'type':db['sequelize'][_0xa2ff('0x5e')]['SELECT']})[_0xa2ff('0x1c')](function(_0x378223){if(_0x378223&&_0x378223['length']){for(var _0x190c84=0x0,_0x5aa015=_0x378223['length'];_0x190c84<_0x5aa015&&_[_0xa2ff('0x5a')](_0x25ca8d[_0xa2ff('0x59')]);_0x190c84++){if(_0x172e9a[_0xa2ff('0x5b')]<=_0x378223[_0x190c84][_0xa2ff('0x5f')]){_0x25ca8d[_0xa2ff('0x59')]=_0x378223[_0x190c84]['from'];}else if(_0x172e9a['min_internal']>_0x378223[_0x190c84][_0xa2ff('0x5f')]&&_0x172e9a[_0xa2ff('0x5b')]<=_0x378223[_0x190c84]['to']){_0x25ca8d[_0xa2ff('0x59')]=_0x172e9a[_0xa2ff('0x5b')];}}}if(_[_0xa2ff('0x5a')](_0x25ca8d[_0xa2ff('0x59')])){_0x25ca8d[_0xa2ff('0x59')]=_0x41e3e4+0x1;}return _0x148caa(_0x25ca8d);});});})[_0xa2ff('0x51')](function(_0x4dbbb4){_0x930f2c(_0x4dbbb4);});});}function updateUser(_0x2fe0ae){return new Promise(function(_0x233ef2,_0x20076d){try{if(_0x2fe0ae[_0xa2ff('0x60')]){_0x2fe0ae['mailbox']=_0x2fe0ae[_0xa2ff('0x59')];_0x2fe0ae['VoiceMail']={'mailbox':_0x2fe0ae['internal'],'password':_0x2fe0ae[_0xa2ff('0x34')],'fullname':_0x2fe0ae[_0xa2ff('0x61')],'email':_0x2fe0ae['email']};}if(_0x2fe0ae[_0xa2ff('0x1d')]==='agent'){if(!_0x2fe0ae[_0xa2ff('0x62')])_0x2fe0ae[_0xa2ff('0x62')]=[_0xa2ff('0x63'),'102',_0xa2ff('0x64'),_0xa2ff('0x65'),_0xa2ff('0x66'),_0xa2ff('0x67'),_0xa2ff('0x68'),_0xa2ff('0x69'),_0xa2ff('0x6a'),_0xa2ff('0x6b'),_0xa2ff('0x6c'),'100',_0xa2ff('0x6d'),_0xa2ff('0x6e'),_0xa2ff('0x6f')];}_0x233ef2(_0x2fe0ae);}catch(_0x54a87b){_0x20076d(_0x54a87b);}});}exports['create']=function(_0x8086fe,_0x3e2bc9){if(_0x8086fe[_0xa2ff('0x70')]['role']==='agent')throw new Error('Unauthorized');if(_0x8086fe[_0xa2ff('0x50')]['role']===_0xa2ff('0x70')&&_0x8086fe[_0xa2ff('0x70')]['role']!==_0xa2ff('0x71')){throw new Error(_0xa2ff('0x72'));}if(_0x8086fe[_0xa2ff('0x50')][_0xa2ff('0x1d')]==='admin'&&_0x8086fe['user'][_0xa2ff('0x1d')]!==_0xa2ff('0x71')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil['checkUserLimits']([_0x8086fe[_0xa2ff('0x50')]])['then'](function(){return validateUser(_0x8086fe['body']);})[_0xa2ff('0x1c')](function(_0x46e80d){return updateUser(_0x46e80d)['then'](function(_0x375647){if(_0x375647[_0xa2ff('0x1d')]===_0xa2ff('0x71')){_0x375647[_0xa2ff('0x73')]=_0x8086fe[_0xa2ff('0x70')][_0xa2ff('0x73')];delete _0x375647[_0xa2ff('0x74')];}return _0x375647;});})[_0xa2ff('0x1c')](function(_0x3d7b90){return db['User']['create'](_0x3d7b90,{'include':[{'model':db[_0xa2ff('0x75')],'as':_0xa2ff('0x75')}]});})['then'](function(_0x564ec8){if(_0x8086fe[_0xa2ff('0x50')][_0xa2ff('0x1d')]===_0xa2ff('0x70'))return _0x564ec8;if(_0x8086fe[_0xa2ff('0x70')]['role']!==_0xa2ff('0x70'))return _0x564ec8;return db['UserProfileSection'][_0xa2ff('0x2a')]({'where':{'name':_0x564ec8[_0xa2ff('0x1d')]===_0xa2ff('0x1e')?_0xa2ff('0x23'):_0xa2ff('0x24'),'userProfileId':_0x8086fe['user'][_0xa2ff('0x74')]},'raw':!![]})[_0xa2ff('0x1c')](function(_0x173a97){if(!_0x173a97||_0x173a97[_0xa2ff('0x76')]!=0x0)return _0x564ec8;return db[_0xa2ff('0x2c')]['create']({'name':_0x564ec8[_0xa2ff('0x2f')],'resourceId':_0x564ec8['id'],'type':_0x173a97[_0xa2ff('0x2f')],'sectionId':_0x173a97['id']},{})[_0xa2ff('0x1c')](function(){return _0x564ec8;});})[_0xa2ff('0x51')](function(_0x1ae687){logger['error'](_0xa2ff('0x77'),_0x1ae687);throw _0x1ae687;});})[_0xa2ff('0x1c')](respondWithResult(_0x3e2bc9,0xc9))[_0xa2ff('0x51')](handleError(_0x3e2bc9,null));};exports[_0xa2ff('0x78')]=function(_0x948bce,_0x5cb47e){var _0x44f9f5=_0x948bce['body'];var _0x26aed0=[];if(_0x948bce[_0xa2ff('0x70')][_0xa2ff('0x1d')]===_0xa2ff('0x1e'))throw new Error(_0xa2ff('0x79'));if(_['some'](_0x44f9f5,[_0xa2ff('0x1d'),_0xa2ff('0x70')])&&_0x948bce[_0xa2ff('0x70')][_0xa2ff('0x1d')]!==_0xa2ff('0x71')){throw new Error(_0xa2ff('0x72'));}if(_[_0xa2ff('0x7a')](_0x44f9f5,[_0xa2ff('0x1d'),'admin'])&&_0x948bce['user'][_0xa2ff('0x1d')]!==_0xa2ff('0x71')){throw new Error(_0xa2ff('0x7b'));}return licenseUtil['checkUserLimits'](_0x44f9f5)[_0xa2ff('0x1c')](function(){return validateUser(_0x44f9f5[0x0]);})[_0xa2ff('0x1c')](function(){for(var _0xb9f771=0x1;_0xb9f771<_0x44f9f5[_0xa2ff('0x41')];_0xb9f771++){var _0x23ffec=_0x44f9f5[_0xb9f771-0x1]['internal'];if(!_0x44f9f5[_0xb9f771][_0xa2ff('0x59')])_0x44f9f5[_0xb9f771][_0xa2ff('0x59')]=_0x23ffec+0x1;_0x26aed0[_0xa2ff('0x42')](validateUser(_0x44f9f5[_0xb9f771]));}return Promise[_0xa2ff('0x47')](_0x26aed0);})[_0xa2ff('0x1c')](function(){_0x26aed0=[];for(var _0x4ab55d=0x0;_0x4ab55d<_0x44f9f5[_0xa2ff('0x41')];_0x4ab55d++){_0x26aed0[_0xa2ff('0x42')](updateUser(_0x44f9f5[_0x4ab55d]));}return Promise[_0xa2ff('0x47')](_0x26aed0);})[_0xa2ff('0x1c')](function(){_0x26aed0=_0x44f9f5[_0xa2ff('0x28')](function(_0x33186f){return db[_0xa2ff('0x31')][_0xa2ff('0x7c')](_0x33186f,{'include':[{'model':db[_0xa2ff('0x75')],'as':_0xa2ff('0x75')}]})[_0xa2ff('0x1c')](function(_0x940a97){_0x33186f['id']=_0x940a97['id'];return _0x33186f;});});return Promise[_0xa2ff('0x47')](_0x26aed0);})[_0xa2ff('0x1c')](function(_0x1cd83b){if(_0x948bce[_0xa2ff('0x50')]['role']==='user')return _0x1cd83b;if(_0x948bce[_0xa2ff('0x70')]['role']!==_0xa2ff('0x70'))return _0x1cd83b;var _0x12ee47=_[_0xa2ff('0x7a')](_0x1cd83b,function(_0x134269){return _0x134269[_0xa2ff('0x1d')]===_0xa2ff('0x1e')||_0x134269['role']===_0xa2ff('0x25');});if(!_0x12ee47)return _0x1cd83b;return db[_0xa2ff('0x7d')][_0xa2ff('0x7e')]({'where':{'name':{'$or':[_0xa2ff('0x23'),_0xa2ff('0x24')]},'userProfileId':_0x948bce[_0xa2ff('0x70')][_0xa2ff('0x74')]},'raw':!![]})[_0xa2ff('0x1c')](function(_0x380925){if(_[_0xa2ff('0x7f')](_0x380925)||!_[_0xa2ff('0x7a')](_0x380925,[_0xa2ff('0x76'),0x0]))return _0x1cd83b;_0x26aed0=[];var _0x5495f3=_(_0x380925)[_0xa2ff('0x28')](function(_0x2f5e0e){if(_0x2f5e0e[_0xa2ff('0x76')]===0x1)return;return _0x2f5e0e[_0xa2ff('0x2f')]==='Agents'?'agent':_0xa2ff('0x25');})[_0xa2ff('0x80')]()['value']();for(var _0xce003=0x0;_0xce003<_0x1cd83b[_0xa2ff('0x41')];_0xce003++){if(!_[_0xa2ff('0x29')](_0x5495f3,_0x1cd83b[_0xce003][_0xa2ff('0x1d')]))return;var _0x2a3e7b=_0x1cd83b[_0xce003]['role']===_0xa2ff('0x1e')?_0xa2ff('0x23'):'Telephones';_0x26aed0['push'](db[_0xa2ff('0x2c')]['create']({'name':_0x1cd83b[_0xce003][_0xa2ff('0x2f')],'resourceId':_0x1cd83b[_0xce003]['id'],'type':_0x2a3e7b,'sectionId':_['find'](_0x380925,[_0xa2ff('0x2f'),_0x2a3e7b])['id']},{}));}return Promise[_0xa2ff('0x47')](_0x26aed0);});})[_0xa2ff('0x1c')](respondWithResult(_0x5cb47e,0xc9))[_0xa2ff('0x51')](handleError(_0x5cb47e,null));};exports[_0xa2ff('0x81')]=function(_0x3434cf,_0x25034b){if(_0x3434cf[_0xa2ff('0x50')]['id']){delete _0x3434cf[_0xa2ff('0x50')]['id'];}return db[_0xa2ff('0x31')]['find']({'where':{'id':_0x3434cf[_0xa2ff('0x49')]['id']}})[_0xa2ff('0x1c')](function(_0x1de773){if(!_0x1de773)return null;if(_0x1de773['id']===_0x3434cf['user']['id']){if(!_0x3434cf[_0xa2ff('0x50')]['oldPassword']||!_0x3434cf[_0xa2ff('0x50')][_0xa2ff('0x82')]){throw new db[(_0xa2ff('0x83'))][(_0xa2ff('0x84'))](_0xa2ff('0x85'));}if(!_0x1de773['authenticate'](_0x3434cf[_0xa2ff('0x50')]['oldPassword'])){throw new db[(_0xa2ff('0x83'))][(_0xa2ff('0x84'))](_0xa2ff('0x86'));}if(_0x3434cf['body'][_0xa2ff('0x87')]===_0x3434cf['body'][_0xa2ff('0x82')]){throw new db['Sequelize'][(_0xa2ff('0x84'))](_0xa2ff('0x88'));}}else if(_0x3434cf[_0xa2ff('0x70')][_0xa2ff('0x1d')]===_0xa2ff('0x71')){if(!_0x3434cf[_0xa2ff('0x50')]['newPassword']){throw new db[(_0xa2ff('0x83'))][(_0xa2ff('0x84'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x3434cf[_0xa2ff('0x70')][_0xa2ff('0x1d')]===_0xa2ff('0x70')){if(!_0x3434cf['body'][_0xa2ff('0x82')]){throw new db[(_0xa2ff('0x83'))][(_0xa2ff('0x84'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x1de773[_0xa2ff('0x1d')]!==_0xa2ff('0x1e')){throw new db[(_0xa2ff('0x83'))]['ValidationError'](_0xa2ff('0x79'));}}else{throw new db['Sequelize'][(_0xa2ff('0x84'))](_0xa2ff('0x79'));}return _0x1de773;})[_0xa2ff('0x1c')](handleEntityNotFound(_0x25034b,null))['then'](function(_0x126946){return db[_0xa2ff('0x56')][_0xa2ff('0x89')]({'attributes':['id',_0xa2ff('0x8a'),_0xa2ff('0x8b'),_0xa2ff('0x8c')]})[_0xa2ff('0x1c')](function(_0x2f2fc2){if(_0x2f2fc2[_0xa2ff('0x8a')])authService[_0xa2ff('0x58')](_0x3434cf[_0xa2ff('0x50')][_0xa2ff('0x82')]);if(!_0x2f2fc2[_0xa2ff('0x8b')]||!_0x126946[_0xa2ff('0x36')])return _0x126946;authService['validatePasswordHistory'](_0x3434cf[_0xa2ff('0x50')][_0xa2ff('0x82')],_0x126946[_0xa2ff('0x36')],_0x2f2fc2[_0xa2ff('0x8c')]);return _0x126946;})['then'](saveUpdates({'password':_0x3434cf[_0xa2ff('0x50')]['newPassword'],'passwordResetAt':_0x3434cf[_0xa2ff('0x70')]['id']==_0x3434cf[_0xa2ff('0x49')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x3434cf[_0xa2ff('0x50')]['newPassword'],_0x126946['previousPasswords'])},null));})['then'](respondWithResult(_0x25034b,null))[_0xa2ff('0x51')](handleError(_0x25034b,null));};exports[_0xa2ff('0x8d')]=function(_0x150451,_0x20c99d){var _0xef7114=_0x150451[_0xa2ff('0x50')][_0xa2ff('0x8e')];return db[_0xa2ff('0x31')][_0xa2ff('0x2a')]({'where':{'id':_0x150451[_0xa2ff('0x49')]['id']},'attributes':['id',_0xa2ff('0x2f'),'role',_0xa2ff('0x8f'),_0xa2ff('0x90'),_0xa2ff('0x91'),'interface']})[_0xa2ff('0x1c')](handleEntityNotFound(_0x20c99d,null))[_0xa2ff('0x1c')](function(_0x37b7ef){if(_0x37b7ef){if(!utils['isValidChannel'](_0xef7114)){throw new db[(_0xa2ff('0x83'))][(_0xa2ff('0x84'))](_0xa2ff('0x92'));}return _0x37b7ef[_0xa2ff('0x93')+_[_0xa2ff('0x94')](_0xef7114[_0xa2ff('0x95')]())+_0xa2ff('0x96')](_0x150451[_0xa2ff('0x50')]['ids'],{'penalty':_0x150451[_0xa2ff('0x50')][_0xa2ff('0x97')]||0x0})[_0xa2ff('0x98')](function(_0x4c4e65){for(var _0xa613bc=0x0;_0xa613bc<_0x150451[_0xa2ff('0x50')]['ids'][_0xa2ff('0x41')];_0xa613bc+=0x1){var _0x4277ad={'UserId':Number(_0x150451[_0xa2ff('0x49')]['id'])};_0x4277ad[_[_0xa2ff('0x94')](_0xef7114[_0xa2ff('0x95')]())+_0xa2ff('0x99')]=Number(_0x150451[_0xa2ff('0x50')][_0xa2ff('0x55')][_0xa613bc]);socket[_0xa2ff('0x9a')]('user'+_[_0xa2ff('0x94')](_0xef7114[_0xa2ff('0x95')]())+_0xa2ff('0x9b'),_0x4277ad);}return _0x4c4e65;})[_0xa2ff('0x1c')](function(){if(_0xef7114==='voice'){return db[_0xa2ff('0x9c')][_0xa2ff('0x7e')]({'where':{'id':_0x150451[_0xa2ff('0x50')][_0xa2ff('0x55')]||[]},'raw':!![],'attributes':['id',_0xa2ff('0x2f')]});}})[_0xa2ff('0x1c')](function(_0x2e341b){var _0x14f3b8=_0x37b7ef[_0xa2ff('0x21')]({'plain':!![]});var _0x3495d8=[];if(_0xef7114===_0xa2ff('0x9d')&&_0x14f3b8['role']==='agent'&&_0x14f3b8['online']){for(let _0x475a0a=0x0;_0x475a0a<_0x2e341b['length'];_0x475a0a+=0x1){_0x3495d8[_0xa2ff('0x42')]({'membername':_0x14f3b8['name'],'UserId':_0x14f3b8['id'],'queue_name':_0x2e341b[_0x475a0a][_0xa2ff('0x2f')],'VoiceQueueId':_0x2e341b[_0x475a0a]['id'],'interface':_[_0xa2ff('0x5a')](_0x14f3b8[_0xa2ff('0x9e')])?util[_0xa2ff('0x9f')]('SIP/%s',_0x14f3b8['name']):_0x14f3b8['interface'],'paused':_0x14f3b8[_0xa2ff('0x91')]||![],'penalty':_0x150451['body'][_0xa2ff('0x97')]||0x0});}return Promise[_0xa2ff('0x47')](_0x3495d8['map'](function(_0x24a4ed){return db['UserVoiceQueueRt'][_0xa2ff('0xa0')](_0x24a4ed);}));}return _0x37b7ef;});}})['then'](respondWithStatusCode(_0x20c99d,null))['catch'](handleError(_0x20c99d,null));};exports['removeQueues']=function(_0x31d75e,_0x55818c){var _0x20bf43,_0x48cd86;return db['User'][_0xa2ff('0x2a')]({'where':{'id':_0x31d75e[_0xa2ff('0x49')]['id']},'attributes':['id',_0xa2ff('0x2f'),'role']})[_0xa2ff('0x1c')](handleEntityNotFound(_0x55818c,null))[_0xa2ff('0x1c')](function(_0x1d2fa3){if(_0x1d2fa3){_0x20bf43=_0x1d2fa3;if(!_0x31d75e[_0xa2ff('0x3b')][_0xa2ff('0x8e')]||!utils[_0xa2ff('0xa1')](_0x31d75e[_0xa2ff('0x3b')]['channel'])){throw new db['Sequelize'][(_0xa2ff('0x84'))](_0xa2ff('0x92'));}return _0x1d2fa3[_0xa2ff('0xa2')+_[_0xa2ff('0x94')](_0x31d75e[_0xa2ff('0x3b')][_0xa2ff('0x8e')]['toLowerCase']())+_0xa2ff('0x96')](_0x31d75e['query'][_0xa2ff('0x55')]);}})[_0xa2ff('0x1c')](function(_0x30485d){if(_['isArray'](_0x31d75e['query'][_0xa2ff('0x55')])){for(var _0x5bd140=0x0;_0x5bd140<_0x31d75e[_0xa2ff('0x3b')][_0xa2ff('0x55')][_0xa2ff('0x41')];_0x5bd140+=0x1){_0x48cd86={'UserId':Number(_0x31d75e[_0xa2ff('0x49')]['id'])};_0x48cd86[_[_0xa2ff('0x94')](_0x31d75e[_0xa2ff('0x3b')][_0xa2ff('0x8e')][_0xa2ff('0x95')]())+_0xa2ff('0x99')]=Number(_0x31d75e[_0xa2ff('0x3b')][_0xa2ff('0x55')][_0x5bd140]);socket['emit'](_0xa2ff('0x70')+_[_0xa2ff('0x94')](_0x31d75e[_0xa2ff('0x3b')][_0xa2ff('0x8e')]['toLowerCase']())+'Queue:remove',_0x48cd86);}}else{_0x48cd86={'UserId':Number(_0x31d75e[_0xa2ff('0x49')]['id'])};_0x48cd86[_['capitalize'](_0x31d75e[_0xa2ff('0x3b')][_0xa2ff('0x8e')]['toLowerCase']())+_0xa2ff('0x99')]=Number(_0x31d75e['query'][_0xa2ff('0x55')]);socket[_0xa2ff('0x9a')](_0xa2ff('0x70')+_[_0xa2ff('0x94')](_0x31d75e[_0xa2ff('0x3b')][_0xa2ff('0x8e')][_0xa2ff('0x95')]())+_0xa2ff('0xa3'),_0x48cd86);}return _0x30485d;})[_0xa2ff('0x1c')](function(){if(_0x31d75e[_0xa2ff('0x3b')][_0xa2ff('0x8e')]==='voice'){return db[_0xa2ff('0xa4')][_0xa2ff('0x20')]({'where':{'UserId':_0x31d75e['params']['id'],'VoiceQueueId':_0x31d75e[_0xa2ff('0x3b')][_0xa2ff('0x55')]},'individualHooks':!![]})[_0xa2ff('0x1c')](function(){return _0x20bf43;});}return _0x20bf43;})[_0xa2ff('0x1c')](respondWithStatusCode(_0x55818c,null))[_0xa2ff('0x51')](handleError(_0x55818c,null));};exports['addAvatar']=function(_0x52bf5a,_0x1cfa9d){_0x52bf5a['body'][_0xa2ff('0xa5')]=_0x52bf5a[_0xa2ff('0xa6')][_0xa2ff('0xa7')];return db[_0xa2ff('0x31')][_0xa2ff('0x2a')]({'where':{'id':_0x52bf5a['params']['id']}})[_0xa2ff('0x1c')](handleEntityNotFound(_0x1cfa9d,null))[_0xa2ff('0x1c')](saveUpdates(_0x52bf5a[_0xa2ff('0x50')],null))[_0xa2ff('0x1c')](respondWithResult(_0x1cfa9d,null))[_0xa2ff('0x51')](handleError(_0x1cfa9d,null));};exports[_0xa2ff('0xa8')]=function(_0x9c4eaf,_0xcfdaa5){var _0x3eb5dc=path['join'](config[_0xa2ff('0xa9')],_0xa2ff('0xaa'));return db[_0xa2ff('0x31')][_0xa2ff('0x2a')]({'where':{'id':_0x9c4eaf['params']['id']},'attributes':['id',_0xa2ff('0xa5')],'raw':!![]})[_0xa2ff('0x1c')](handleEntityNotFound(_0xcfdaa5,null))['then'](function(_0x483e78){if(_0x483e78){if(_[_0xa2ff('0x5a')](_0x483e78[_0xa2ff('0xa5')])){return _0xcfdaa5[_0xa2ff('0xab')](_0x3eb5dc);}else{if(!fs['existsSync'](path[_0xa2ff('0xac')](config[_0xa2ff('0xa9')],_0xa2ff('0xad'),_0x483e78[_0xa2ff('0xa5')]))){return _0xcfdaa5[_0xa2ff('0xab')](_0x3eb5dc);}return _0xcfdaa5[_0xa2ff('0xab')](path[_0xa2ff('0xac')](config[_0xa2ff('0xa9')],'server/files/images/',_0x483e78[_0xa2ff('0xa5')]));}}})[_0xa2ff('0x51')](handleError(_0xcfdaa5,null));};exports[_0xa2ff('0xae')]=function(_0x147448,_0x4d8df8){return db[_0xa2ff('0x31')]['find']({'where':{'id':_0x147448[_0xa2ff('0x49')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x4d8df8,null))[_0xa2ff('0x1c')](function(_0x2dc06e){var _0x414e2c=[];values=_0x2dc06e[_0xa2ff('0x44')];_0x414e2c[_0xa2ff('0x42')](get_open_tabs(_0xa2ff('0x43'),_0x2dc06e[_0xa2ff('0x44')]));_0x414e2c['push'](get_open_tabs('sms',_0x2dc06e[_0xa2ff('0x44')]));_0x414e2c['push'](get_open_tabs(_0xa2ff('0x4e'),_0x2dc06e[_0xa2ff('0x44')]));_0x414e2c[_0xa2ff('0x42')](get_open_tabs(_0xa2ff('0x46'),_0x2dc06e[_0xa2ff('0x44')]));_0x414e2c[_0xa2ff('0x42')](get_open_tabs(_0xa2ff('0x45'),_0x2dc06e['dataValues']));_0x414e2c[_0xa2ff('0x42')](get_open_tabs(_0xa2ff('0x4f'),_0x2dc06e[_0xa2ff('0x44')]));return Promise[_0xa2ff('0x47')](_0x414e2c);})[_0xa2ff('0x1c')](function(_0x5b3b32){if(_0x5b3b32){var _0x562187=_['map'](values['ChatOpenTabs'],function(_0x125636){return{'channel':_0xa2ff('0xaf'),'id':_0x125636['id'],'createdAt':_0x125636[_0xa2ff('0xb0')]};});var _0x1ac4e5=_['map'](values[_0xa2ff('0xb1')],function(_0xf1fa20){return{'channel':'FAX','id':_0xf1fa20['id'],'createdAt':_0xf1fa20[_0xa2ff('0xb0')]};});var _0x2e6b58=_[_0xa2ff('0x28')](values[_0xa2ff('0xb2')],function(_0x4c6728){return{'channel':_0xa2ff('0xb3'),'id':_0x4c6728['id'],'createdAt':_0x4c6728[_0xa2ff('0xb0')]};});var _0x6275d2=_[_0xa2ff('0x28')](values[_0xa2ff('0xb4')],function(_0x3711e3){return{'channel':_0xa2ff('0xb5'),'id':_0x3711e3['id'],'createdAt':_0x3711e3[_0xa2ff('0xb0')]};});var _0x35c6f7=_['map'](values[_0xa2ff('0xb6')],function(_0x3a7289){return{'channel':_0xa2ff('0xb7'),'id':_0x3a7289['id'],'createdAt':_0x3a7289[_0xa2ff('0xb0')]};});var _0x509e30=_['map'](values[_0xa2ff('0xb8')],function(_0x5db634){return{'channel':_0xa2ff('0xb9'),'id':_0x5db634['id'],'createdAt':_0x5db634[_0xa2ff('0xb0')]};});var _0x1e7199=_[_0xa2ff('0xba')](_0x562187,_0x1ac4e5,_0x2e6b58,_0x6275d2,_0x35c6f7,_0x509e30);var _0x13714d={'count':_0x1e7199[_0xa2ff('0x41')],'rows':_0x1e7199};return _0x13714d;}else return null;})[_0xa2ff('0x1c')](respondWithResult(_0x4d8df8,null))[_0xa2ff('0x51')](handleError(_0x4d8df8,null));};exports[_0xa2ff('0xbb')]=function(_0x2fe4bc,_0x4f7bca){var _0x430b5d={};return db[_0xa2ff('0x31')][_0xa2ff('0x89')]({'where':{'id':_0x2fe4bc[_0xa2ff('0x49')]['id']}})[_0xa2ff('0x1c')](function(_0x27bcd6){if(!_0x27bcd6){throw new APINotFoundError(util[_0xa2ff('0x9f')](_0xa2ff('0xbc'),_0x2fe4bc[_0xa2ff('0x49')]['id']));}return contacts[_0xa2ff('0x52')]();})[_0xa2ff('0x1c')](function(_0x243862){_0x2fe4bc[_0xa2ff('0x3b')][_0xa2ff('0x31')]=_0x2fe4bc[_0xa2ff('0x49')]['id'];_0x430b5d=qs[_0xa2ff('0x4a')](_0x243862,_0x2fe4bc);if(_0x2fe4bc[_0xa2ff('0x3b')][_0xa2ff('0xbd')](_0xa2ff('0x4b'))){_0x430b5d[_0xa2ff('0x3e')]=[{'model':db[_0xa2ff('0xbe')],'as':'List','required':![]},{'model':db[_0xa2ff('0xbf')],'as':_0xa2ff('0xc0'),'attributes':['id',_0xa2ff('0x2f'),_0xa2ff('0xc1')],'where':_0x2fe4bc[_0xa2ff('0x3b')][_0xa2ff('0xc2')]?{'id':_0x2fe4bc[_0xa2ff('0x3b')]['tag']}:undefined,'required':_0x2fe4bc[_0xa2ff('0x3b')][_0xa2ff('0xc2')]?!![]:![]}];}return contacts[_0xa2ff('0x7e')](_0x2fe4bc[_0xa2ff('0x3b')],_0x2fe4bc[_0xa2ff('0x70')],_0x430b5d,_0x243862);})[_0xa2ff('0x1c')](respondWithFilteredResult(_0x4f7bca,_0x430b5d))[_0xa2ff('0x51')](APIHandleError(_0x4f7bca));};exports[_0xa2ff('0xc3')]=function(_0x353fd4,_0x561c3b){var _0x486ed3;var _0x34882d={};var _0x353906;return db[_0xa2ff('0x31')][_0xa2ff('0x89')]({'where':{'id':_0x353fd4[_0xa2ff('0x49')]['id']},'attributes':['id',_0xa2ff('0x2f'),_0xa2ff('0x1d')]})[_0xa2ff('0x1c')](handleEntityNotFound(_0x561c3b,null))[_0xa2ff('0x1c')](function(_0x21b1da){if(!utils[_0xa2ff('0xa1')](_0x353fd4[_0xa2ff('0x3b')]['channel'])){throw new db[(_0xa2ff('0x83'))]['ValidationError']('Unknown\x20channel');}_0x486ed3=_0x21b1da;var _0x4192eb={};_0x4192eb['model']=_[_0xa2ff('0xc4')](db[_[_0xa2ff('0x94')](_0x353fd4[_0xa2ff('0x3b')]['channel'])+'Queue'][_0xa2ff('0x32')]);_0x4192eb[_0xa2ff('0x3b')]=_[_0xa2ff('0xc4')](_0x353fd4[_0xa2ff('0x3b')]);_0x4192eb[_0xa2ff('0xc5')]=_[_0xa2ff('0xc6')](_0x4192eb[_0xa2ff('0xc7')],_0x4192eb[_0xa2ff('0x3b')]);_0x34882d[_0xa2ff('0x3f')]=_['intersection'](_0x4192eb[_0xa2ff('0xc7')],qs['fields'](_0x353fd4[_0xa2ff('0x3b')]['fields']));_0x34882d[_0xa2ff('0x3f')]=_0x34882d[_0xa2ff('0x3f')][_0xa2ff('0x41')]?_0x34882d['attributes']:_0x4192eb['model'];_0x34882d[_0xa2ff('0xc8')]=qs[_0xa2ff('0xc9')](_0x353fd4[_0xa2ff('0x3b')][_0xa2ff('0xc9')]);_0x34882d[_0xa2ff('0xca')]=qs['filters'](_[_0xa2ff('0xcb')](_0x353fd4['query'],_0x4192eb[_0xa2ff('0xc5')]));if(_0x353fd4[_0xa2ff('0x3b')][_0xa2ff('0x26')]){_0x34882d['where']=_['merge'](_0x34882d[_0xa2ff('0xca')],{'$or':_[_0xa2ff('0x28')](_0x34882d[_0xa2ff('0x3f')],function(_0x1fb5d0){var _0x377162={};_0x377162[_0x1fb5d0]={'$like':'%'+_0x353fd4['query'][_0xa2ff('0x26')]+'%'};return _0x377162;})});}_0x34882d=_[_0xa2ff('0xcc')]({},_0x34882d,_0x353fd4[_0xa2ff('0x4d')]);switch(_0x486ed3['role']){case _0xa2ff('0x71'):return db[_['capitalize'](_0x353fd4[_0xa2ff('0x3b')][_0xa2ff('0x8e')])+_0xa2ff('0xcd')][_0xa2ff('0x7e')](_0x34882d);case _0xa2ff('0x70'):case'agent':return _0x486ed3[_0xa2ff('0x21')+_[_0xa2ff('0x94')](_0x353fd4[_0xa2ff('0x3b')]['channel'])+_0xa2ff('0x96')](_0x34882d);default:throw new db['Sequelize'][(_0xa2ff('0x84'))]('Unknown\x20role');}})['then'](function(_0x3b158a){_0x353906=_0x3b158a[_0xa2ff('0x41')];if(!_0x353fd4[_0xa2ff('0x3b')][_0xa2ff('0xbd')](_0xa2ff('0xce'))){_0x34882d['limit']=qs[_0xa2ff('0x17')](_0x353fd4[_0xa2ff('0x3b')][_0xa2ff('0x17')]);_0x34882d[_0xa2ff('0x19')]=qs[_0xa2ff('0x19')](_0x353fd4[_0xa2ff('0x3b')][_0xa2ff('0x19')]);}switch(_0x486ed3[_0xa2ff('0x1d')]){case _0xa2ff('0x71'):return db[_['capitalize'](_0x353fd4[_0xa2ff('0x3b')][_0xa2ff('0x8e')])+_0xa2ff('0xcd')][_0xa2ff('0x7e')](_0x34882d);case'user':case'agent':return _0x486ed3['get'+_[_0xa2ff('0x94')](_0x353fd4['query'][_0xa2ff('0x8e')])+_0xa2ff('0x96')](_0x34882d);}})[_0xa2ff('0x1c')](function(_0x2a3129){return{'count':_0x353906,'rows':_0x2a3129};})[_0xa2ff('0x1c')](respondWithResult(_0x561c3b,null))[_0xa2ff('0x51')](handleError(_0x561c3b,null));};exports[_0xa2ff('0xcf')]=function(_0x1d3460,_0x4a0ee8){var _0x58687={};var _0xe90ec0={};var _0x39e661;var _0x154a8a;return db[_0xa2ff('0x31')][_0xa2ff('0x89')]({'where':{'id':_0x1d3460[_0xa2ff('0x49')]['id']}})[_0xa2ff('0x1c')](handleEntityNotFound(_0x4a0ee8,null))['then'](function(_0x4badb2){if(_0x4badb2){_0x39e661=_0x4badb2;_0xe90ec0[_0xa2ff('0xc7')]=_[_0xa2ff('0xc4')](db[_0xa2ff('0xa4')][_0xa2ff('0x32')]);_0xe90ec0[_0xa2ff('0x3b')]=_[_0xa2ff('0xc4')](_0x1d3460[_0xa2ff('0x3b')]);_0xe90ec0[_0xa2ff('0xc5')]=_[_0xa2ff('0xc6')](_0xe90ec0[_0xa2ff('0xc7')],_0xe90ec0[_0xa2ff('0x3b')]);_0x58687[_0xa2ff('0x3f')]=_[_0xa2ff('0xc6')](_0xe90ec0[_0xa2ff('0xc7')],qs[_0xa2ff('0xd0')](_0x1d3460[_0xa2ff('0x3b')]['fields']));_0x58687['attributes']=_0x58687[_0xa2ff('0x3f')]['length']?_0x58687[_0xa2ff('0x3f')]:_0xe90ec0[_0xa2ff('0xc7')];_0x58687[_0xa2ff('0xc8')]=qs[_0xa2ff('0xc9')](_0x1d3460[_0xa2ff('0x3b')]['sort']);_0x58687[_0xa2ff('0xca')]=qs[_0xa2ff('0xc5')](_[_0xa2ff('0xcb')](_0x1d3460['query'],_0xe90ec0[_0xa2ff('0xc5')]));if(_0x1d3460[_0xa2ff('0x3b')][_0xa2ff('0x26')]){_0x58687[_0xa2ff('0xca')]=_[_0xa2ff('0xcc')](_0x58687[_0xa2ff('0xca')],{'$or':_[_0xa2ff('0x28')](_0x58687[_0xa2ff('0x3f')],function(_0x5a6791){var _0x433fb0={};_0x433fb0[_0x5a6791]={'$like':'%'+_0x1d3460['query'][_0xa2ff('0x26')]+'%'};return _0x433fb0;})});}_0x58687=_[_0xa2ff('0xcc')]({},_0x58687,_0x1d3460[_0xa2ff('0x4d')]);return _0x39e661[_0xa2ff('0xcf')](_0x58687);}})[_0xa2ff('0x1c')](function(_0x1df30d){if(_0x1df30d){_0x154a8a=_0x1df30d[_0xa2ff('0x41')];if(!_0x1d3460[_0xa2ff('0x3b')][_0xa2ff('0xbd')](_0xa2ff('0xce'))){_0x58687[_0xa2ff('0x17')]=qs['limit'](_0x1d3460[_0xa2ff('0x3b')][_0xa2ff('0x17')]);_0x58687[_0xa2ff('0x19')]=qs['offset'](_0x1d3460[_0xa2ff('0x3b')]['offset']);}return _0x39e661[_0xa2ff('0xcf')](_0x58687);}})[_0xa2ff('0x1c')](function(_0x500859){if(_0x500859){return _0x500859?{'count':_0x154a8a,'rows':_0x500859}:null;}})[_0xa2ff('0x1c')](respondWithResult(_0x4a0ee8,null))[_0xa2ff('0x51')](handleError(_0x4a0ee8,null));};exports[_0xa2ff('0xd1')]=function(_0x2e47ee,_0x3ae50d){var _0x494d7d={};var _0x5a2a78={};var _0x484ae3;var _0x6fa4ec;return db[_0xa2ff('0x31')][_0xa2ff('0x89')]({'where':{'id':_0x2e47ee[_0xa2ff('0x49')]['id']}})[_0xa2ff('0x1c')](handleEntityNotFound(_0x3ae50d,null))[_0xa2ff('0x1c')](function(_0x2bb42e){if(_0x2bb42e){_0x484ae3=_0x2bb42e;_0x5a2a78['model']=_[_0xa2ff('0xc4')](db['ChatGroup'][_0xa2ff('0x32')]);_0x5a2a78['query']=_[_0xa2ff('0xc4')](_0x2e47ee[_0xa2ff('0x3b')]);_0x5a2a78[_0xa2ff('0xc5')]=_['intersection'](_0x5a2a78[_0xa2ff('0xc7')],_0x5a2a78[_0xa2ff('0x3b')]);_0x494d7d[_0xa2ff('0x3f')]=_['intersection'](_0x5a2a78[_0xa2ff('0xc7')],qs[_0xa2ff('0xd0')](_0x2e47ee['query']['fields']));_0x494d7d['attributes']=_0x494d7d[_0xa2ff('0x3f')][_0xa2ff('0x41')]?_0x494d7d[_0xa2ff('0x3f')]:_0x5a2a78[_0xa2ff('0xc7')];_0x494d7d[_0xa2ff('0xc8')]=qs[_0xa2ff('0xc9')](_0x2e47ee[_0xa2ff('0x3b')][_0xa2ff('0xc9')]);_0x494d7d[_0xa2ff('0xca')]=qs[_0xa2ff('0xc5')](_[_0xa2ff('0xcb')](_0x2e47ee[_0xa2ff('0x3b')],_0x5a2a78[_0xa2ff('0xc5')]));if(_0x2e47ee[_0xa2ff('0x3b')][_0xa2ff('0x26')]){_0x494d7d[_0xa2ff('0xca')]=_[_0xa2ff('0xcc')](_0x494d7d[_0xa2ff('0xca')],{'$or':_[_0xa2ff('0x28')](_0x494d7d[_0xa2ff('0x3f')],function(_0x2706c9){var _0x5be64d={};_0x5be64d[_0x2706c9]={'$like':'%'+_0x2e47ee[_0xa2ff('0x3b')][_0xa2ff('0x26')]+'%'};return _0x5be64d;})});}_0x494d7d=_['merge']({},_0x494d7d,_0x2e47ee[_0xa2ff('0x4d')]);return _0x484ae3[_0xa2ff('0xd1')](_0x494d7d);}})[_0xa2ff('0x1c')](function(_0x1a1ff8){if(_0x1a1ff8){_0x6fa4ec=_0x1a1ff8['length'];if(!_0x2e47ee[_0xa2ff('0x3b')][_0xa2ff('0xbd')](_0xa2ff('0xce'))){_0x494d7d['limit']=qs[_0xa2ff('0x17')](_0x2e47ee['query'][_0xa2ff('0x17')]);_0x494d7d[_0xa2ff('0x19')]=qs[_0xa2ff('0x19')](_0x2e47ee[_0xa2ff('0x3b')][_0xa2ff('0x19')]);}return _0x484ae3[_0xa2ff('0xd1')](_0x494d7d);}})[_0xa2ff('0x1c')](function(_0x19d6e8){if(_0x19d6e8){return _0x19d6e8?{'count':_0x6fa4ec,'rows':_0x19d6e8}:null;}})[_0xa2ff('0x1c')](respondWithResult(_0x3ae50d,null))[_0xa2ff('0x51')](handleError(_0x3ae50d,null));};exports[_0xa2ff('0xd2')]=function(_0x316207,_0x23b8cb){var _0x2ac7e2={'raw':!![],'where':{}};var _0x87f647={};var _0x55a036={'count':0x0,'rows':[]};return db['User'][_0xa2ff('0x89')]({'where':{'id':_0x316207[_0xa2ff('0x49')]['id']}})['then'](handleEntityNotFound(_0x23b8cb,null))['then'](function(_0x4b01e7){if(_0x4b01e7){_0x87f647[_0xa2ff('0xc7')]=_[_0xa2ff('0xc4')](db[_0xa2ff('0xd3')][_0xa2ff('0x32')]);_0x87f647[_0xa2ff('0x3b')]=_[_0xa2ff('0xc4')](_0x316207[_0xa2ff('0x3b')]);_0x87f647[_0xa2ff('0xc5')]=_['intersection'](_0x87f647[_0xa2ff('0xc7')],_0x87f647[_0xa2ff('0x3b')]);_0x2ac7e2['attributes']=_[_0xa2ff('0xc6')](_0x87f647[_0xa2ff('0xc7')],qs['fields'](_0x316207[_0xa2ff('0x3b')]['fields']));_0x2ac7e2[_0xa2ff('0x3f')]=_0x2ac7e2['attributes']['length']?_0x2ac7e2[_0xa2ff('0x3f')]:_0x87f647['model'];if(!_0x316207[_0xa2ff('0x3b')][_0xa2ff('0xbd')](_0xa2ff('0xce'))){_0x2ac7e2[_0xa2ff('0x17')]=qs[_0xa2ff('0x17')](_0x316207[_0xa2ff('0x3b')][_0xa2ff('0x17')]);_0x2ac7e2['offset']=qs['offset'](_0x316207[_0xa2ff('0x3b')][_0xa2ff('0x19')]);}_0x2ac7e2[_0xa2ff('0xc8')]=qs[_0xa2ff('0xc9')](_0x316207[_0xa2ff('0x3b')][_0xa2ff('0xc9')]);_0x2ac7e2[_0xa2ff('0xca')]=qs[_0xa2ff('0xc5')](_[_0xa2ff('0xcb')](_0x316207['query'],_0x87f647['filters']));_0x2ac7e2['where'][_0xa2ff('0xd4')]=_0x4b01e7['id'];if(_0x316207[_0xa2ff('0x3b')][_0xa2ff('0x26')]){_0x2ac7e2['where']=_['merge'](_0x2ac7e2[_0xa2ff('0xca')],{'$or':_[_0xa2ff('0x28')](_0x2ac7e2['attributes'],function(_0x1dd67c){var _0x5f0af8={};_0x5f0af8[_0x1dd67c]={'$like':'%'+_0x316207['query']['filter']+'%'};return _0x5f0af8;})});}_0x2ac7e2=_[_0xa2ff('0xcc')]({},_0x2ac7e2,_0x316207['options']);return db[_0xa2ff('0xd3')][_0xa2ff('0x18')]({'where':_0x2ac7e2[_0xa2ff('0xca')]})[_0xa2ff('0x1c')](function(_0x5b4bd5){_0x55a036['count']=_0x5b4bd5;if(_0x316207[_0xa2ff('0x3b')][_0xa2ff('0x4b')]){_0x2ac7e2[_0xa2ff('0x3e')]=[{'all':!![]}];}return db[_0xa2ff('0xd3')]['findAll'](_0x2ac7e2);})['then'](function(_0x5e3c32){_0x55a036[_0xa2ff('0x40')]=_0x5e3c32;return _0x55a036;});}})[_0xa2ff('0x1c')](respondWithFilteredResult(_0x23b8cb,_0x2ac7e2))[_0xa2ff('0x51')](handleError(_0x23b8cb,null));};exports['getScreenRecordings']=function(_0x30cbd9,_0x172d6e){var _0xa7e00d={'raw':!![],'where':{}};var _0x50c600={};var _0x109faf={'count':0x0,'rows':[]};return db['User'][_0xa2ff('0x89')]({'where':{'id':_0x30cbd9[_0xa2ff('0x49')]['id']}})[_0xa2ff('0x1c')](handleEntityNotFound(_0x172d6e,null))[_0xa2ff('0x1c')](function(_0x560b15){if(_0x560b15){_0x50c600['model']=_[_0xa2ff('0xc4')](db[_0xa2ff('0xd5')][_0xa2ff('0x32')]);_0x50c600[_0xa2ff('0x3b')]=_[_0xa2ff('0xc4')](_0x30cbd9[_0xa2ff('0x3b')]);_0x50c600[_0xa2ff('0xc5')]=_[_0xa2ff('0xc6')](_0x50c600['model'],_0x50c600[_0xa2ff('0x3b')]);_0xa7e00d['attributes']=_['intersection'](_0x50c600['model'],qs[_0xa2ff('0xd0')](_0x30cbd9[_0xa2ff('0x3b')][_0xa2ff('0xd0')]));_0xa7e00d[_0xa2ff('0x3f')]=_0xa7e00d['attributes'][_0xa2ff('0x41')]?_0xa7e00d[_0xa2ff('0x3f')]:_0x50c600[_0xa2ff('0xc7')];if(!_0x30cbd9[_0xa2ff('0x3b')][_0xa2ff('0xbd')](_0xa2ff('0xce'))){_0xa7e00d[_0xa2ff('0x17')]=qs[_0xa2ff('0x17')](_0x30cbd9[_0xa2ff('0x3b')]['limit']);_0xa7e00d[_0xa2ff('0x19')]=qs['offset'](_0x30cbd9['query']['offset']);}_0xa7e00d[_0xa2ff('0xc8')]=qs[_0xa2ff('0xc9')](_0x30cbd9[_0xa2ff('0x3b')]['sort']);_0xa7e00d[_0xa2ff('0xca')]=qs[_0xa2ff('0xc5')](_[_0xa2ff('0xcb')](_0x30cbd9[_0xa2ff('0x3b')],_0x50c600[_0xa2ff('0xc5')]));_0xa7e00d[_0xa2ff('0xca')][_0xa2ff('0xd4')]=_0x560b15['id'];if(_0x30cbd9[_0xa2ff('0x3b')][_0xa2ff('0x26')]){_0xa7e00d[_0xa2ff('0xca')]=_[_0xa2ff('0xcc')](_0xa7e00d['where'],{'$or':_[_0xa2ff('0x28')](_0xa7e00d[_0xa2ff('0x3f')],function(_0x245e5e){var _0x1ba5eb={};_0x1ba5eb[_0x245e5e]={'$like':'%'+_0x30cbd9[_0xa2ff('0x3b')][_0xa2ff('0x26')]+'%'};return _0x1ba5eb;})});}_0xa7e00d=_[_0xa2ff('0xcc')]({},_0xa7e00d,_0x30cbd9[_0xa2ff('0x4d')]);return db['ScreenRecording']['count']({'where':_0xa7e00d[_0xa2ff('0xca')]})['then'](function(_0x3298eb){_0x109faf[_0xa2ff('0x18')]=_0x3298eb;if(_0x30cbd9[_0xa2ff('0x3b')][_0xa2ff('0x4b')]){_0xa7e00d[_0xa2ff('0x3e')]=[{'all':!![]}];}return db[_0xa2ff('0xd5')][_0xa2ff('0x7e')](_0xa7e00d);})[_0xa2ff('0x1c')](function(_0x3a955e){_0x109faf[_0xa2ff('0x40')]=_0x3a955e;return _0x109faf;});}})[_0xa2ff('0x1c')](respondWithFilteredResult(_0x172d6e,_0xa7e00d))[_0xa2ff('0x51')](handleError(_0x172d6e,null));};exports[_0xa2ff('0xd6')]=function(_0x1407fd,_0x279c78){var _0x4995df={};var _0x717ec1={};var _0x5a91a6;var _0x11b61a;return db[_0xa2ff('0x31')][_0xa2ff('0x89')]({'where':{'id':_0x1407fd['params']['id']}})['then'](handleEntityNotFound(_0x279c78,null))[_0xa2ff('0x1c')](function(_0x361573){if(_0x361573){_0x5a91a6=_0x361573;_0x717ec1['model']=_[_0xa2ff('0xc4')](db[_0xa2ff('0xd7')]['rawAttributes']);_0x717ec1[_0xa2ff('0x3b')]=_[_0xa2ff('0xc4')](_0x1407fd[_0xa2ff('0x3b')]);_0x717ec1['filters']=_['intersection'](_0x717ec1['model'],_0x717ec1[_0xa2ff('0x3b')]);_0x4995df[_0xa2ff('0x3f')]=_['intersection'](_0x717ec1['model'],qs[_0xa2ff('0xd0')](_0x1407fd[_0xa2ff('0x3b')]['fields']));_0x4995df[_0xa2ff('0x3f')]=_0x4995df[_0xa2ff('0x3f')][_0xa2ff('0x41')]?_0x4995df[_0xa2ff('0x3f')]:_0x717ec1[_0xa2ff('0xc7')];_0x4995df[_0xa2ff('0xc8')]=qs[_0xa2ff('0xc9')](_0x1407fd['query'][_0xa2ff('0xc9')]);_0x4995df['where']=qs[_0xa2ff('0xc5')](_['pick'](_0x1407fd[_0xa2ff('0x3b')],_0x717ec1['filters']));if(_0x1407fd[_0xa2ff('0x3b')][_0xa2ff('0x26')]){_0x4995df[_0xa2ff('0xca')]=_['merge'](_0x4995df[_0xa2ff('0xca')],{'$or':_[_0xa2ff('0x28')](_0x4995df[_0xa2ff('0x3f')],function(_0x48dfc8){var _0x4b36c6={};_0x4b36c6[_0x48dfc8]={'$like':'%'+_0x1407fd[_0xa2ff('0x3b')][_0xa2ff('0x26')]+'%'};return _0x4b36c6;})});}_0x4995df=_[_0xa2ff('0xcc')]({},_0x4995df,_0x1407fd[_0xa2ff('0x4d')]);return _0x5a91a6[_0xa2ff('0xd6')](_0x4995df);}})[_0xa2ff('0x1c')](function(_0x1a4962){if(_0x1a4962){_0x11b61a=_0x1a4962[_0xa2ff('0x41')];if(!_0x1407fd['query'][_0xa2ff('0xbd')](_0xa2ff('0xce'))){_0x4995df[_0xa2ff('0x17')]=qs['limit'](_0x1407fd['query']['limit']);_0x4995df[_0xa2ff('0x19')]=qs['offset'](_0x1407fd[_0xa2ff('0x3b')][_0xa2ff('0x19')]);}return _0x5a91a6[_0xa2ff('0xd6')](_0x4995df);}})[_0xa2ff('0x1c')](function(_0x95fda4){if(_0x95fda4){return _0x95fda4?{'count':_0x11b61a,'rows':_0x95fda4}:null;}})[_0xa2ff('0x1c')](respondWithResult(_0x279c78,null))[_0xa2ff('0x51')](handleError(_0x279c78,null));};exports[_0xa2ff('0xd8')]=function(_0x5117d9,_0x4cbe31){var _0x5236da={};var _0x53d46f={};var _0x2a4d3b;var _0x3d970c;return db[_0xa2ff('0x31')][_0xa2ff('0x89')]({'where':{'id':_0x5117d9[_0xa2ff('0x49')]['id']}})[_0xa2ff('0x1c')](handleEntityNotFound(_0x4cbe31,null))[_0xa2ff('0x1c')](function(_0x314756){if(_0x314756){_0x2a4d3b=_0x314756;_0x53d46f[_0xa2ff('0xc7')]=_[_0xa2ff('0xc4')](db[_0xa2ff('0xd9')][_0xa2ff('0x32')]);_0x53d46f[_0xa2ff('0x3b')]=_[_0xa2ff('0xc4')](_0x5117d9[_0xa2ff('0x3b')]);_0x53d46f[_0xa2ff('0xc5')]=_['intersection'](_0x53d46f[_0xa2ff('0xc7')],_0x53d46f[_0xa2ff('0x3b')]);_0x5236da[_0xa2ff('0x3f')]=_['intersection'](_0x53d46f[_0xa2ff('0xc7')],qs[_0xa2ff('0xd0')](_0x5117d9[_0xa2ff('0x3b')][_0xa2ff('0xd0')]));_0x5236da[_0xa2ff('0x3f')]=_0x5236da[_0xa2ff('0x3f')]['length']?_0x5236da[_0xa2ff('0x3f')]:_0x53d46f[_0xa2ff('0xc7')];_0x5236da['order']=qs[_0xa2ff('0xc9')](_0x5117d9[_0xa2ff('0x3b')][_0xa2ff('0xc9')]);_0x5236da['where']=qs['filters'](_[_0xa2ff('0xcb')](_0x5117d9[_0xa2ff('0x3b')],_0x53d46f[_0xa2ff('0xc5')]));if(_0x5117d9[_0xa2ff('0x3b')]['filter']){_0x5236da[_0xa2ff('0xca')]=_[_0xa2ff('0xcc')](_0x5236da[_0xa2ff('0xca')],{'$or':_[_0xa2ff('0x28')](_0x5236da['attributes'],function(_0x3912af){var _0x596c10={};_0x596c10[_0x3912af]={'$like':'%'+_0x5117d9[_0xa2ff('0x3b')]['filter']+'%'};return _0x596c10;})});}_0x5236da=_[_0xa2ff('0xcc')]({},_0x5236da,_0x5117d9[_0xa2ff('0x4d')]);return _0x2a4d3b[_0xa2ff('0xd8')](_0x5236da);}})[_0xa2ff('0x1c')](function(_0x53e9fb){if(_0x53e9fb){_0x3d970c=_0x53e9fb[_0xa2ff('0x41')];if(!_0x5117d9['query'][_0xa2ff('0xbd')](_0xa2ff('0xce'))){_0x5236da[_0xa2ff('0x17')]=qs[_0xa2ff('0x17')](_0x5117d9[_0xa2ff('0x3b')][_0xa2ff('0x17')]);_0x5236da[_0xa2ff('0x19')]=qs['offset'](_0x5117d9[_0xa2ff('0x3b')][_0xa2ff('0x19')]);}return _0x2a4d3b['getOpenchannelInteractions'](_0x5236da);}})[_0xa2ff('0x1c')](function(_0x317305){if(_0x317305){return _0x317305?{'count':_0x3d970c,'rows':_0x317305}:null;}})['then'](respondWithResult(_0x4cbe31,null))['catch'](handleError(_0x4cbe31,null));};exports[_0xa2ff('0xda')]=function(_0x2ceefb,_0x5e021b){var _0x1942cd={'raw':!![],'where':{}};var _0x5be2b8={};var _0x39cc5c={'count':0x0,'rows':[]};return db[_0xa2ff('0x31')][_0xa2ff('0x89')]({'where':{'id':_0x2ceefb[_0xa2ff('0x49')]['id']}})['then'](handleEntityNotFound(_0x5e021b,null))[_0xa2ff('0x1c')](function(_0x481bd0){if(_0x481bd0){_0x5be2b8[_0xa2ff('0xc7')]=_[_0xa2ff('0xc4')](db[_0xa2ff('0xdb')][_0xa2ff('0x32')]);_0x5be2b8['query']=_[_0xa2ff('0xc4')](_0x2ceefb[_0xa2ff('0x3b')]);_0x5be2b8[_0xa2ff('0xc5')]=_['intersection'](_0x5be2b8[_0xa2ff('0xc7')],_0x5be2b8[_0xa2ff('0x3b')]);_0x1942cd['attributes']=_['intersection'](_0x5be2b8['model'],qs[_0xa2ff('0xd0')](_0x2ceefb[_0xa2ff('0x3b')][_0xa2ff('0xd0')]));_0x1942cd[_0xa2ff('0x3f')]=_0x1942cd['attributes'][_0xa2ff('0x41')]?_0x1942cd[_0xa2ff('0x3f')]:_0x5be2b8[_0xa2ff('0xc7')];if(!_0x2ceefb[_0xa2ff('0x3b')][_0xa2ff('0xbd')](_0xa2ff('0xce'))){_0x1942cd['limit']=qs[_0xa2ff('0x17')](_0x2ceefb[_0xa2ff('0x3b')]['limit']);_0x1942cd['offset']=qs[_0xa2ff('0x19')](_0x2ceefb[_0xa2ff('0x3b')][_0xa2ff('0x19')]);}_0x1942cd['order']=qs[_0xa2ff('0xc9')](_0x2ceefb[_0xa2ff('0x3b')][_0xa2ff('0xc9')]);_0x1942cd['where']=qs[_0xa2ff('0xc5')](_[_0xa2ff('0xcb')](_0x2ceefb['query'],_0x5be2b8['filters']));_0x1942cd[_0xa2ff('0xca')]['UserId']=_0x481bd0['id'];if(_0x2ceefb[_0xa2ff('0x3b')][_0xa2ff('0x26')]){_0x1942cd[_0xa2ff('0xca')]=_['merge'](_0x1942cd[_0xa2ff('0xca')],{'$or':_[_0xa2ff('0x28')](_0x1942cd[_0xa2ff('0x3f')],function(_0x159d23){var _0x2c831c={};_0x2c831c[_0x159d23]={'$like':'%'+_0x2ceefb['query'][_0xa2ff('0x26')]+'%'};return _0x2c831c;})});}_0x1942cd=_[_0xa2ff('0xcc')]({},_0x1942cd,_0x2ceefb[_0xa2ff('0x4d')]);return db['MailInteraction'][_0xa2ff('0x18')]({'where':_0x1942cd[_0xa2ff('0xca')]})[_0xa2ff('0x1c')](function(_0x5e40da){_0x39cc5c[_0xa2ff('0x18')]=_0x5e40da;if(_0x2ceefb['query'][_0xa2ff('0x4b')]){_0x1942cd[_0xa2ff('0x3e')]=[{'all':!![]}];}return db['MailInteraction'][_0xa2ff('0x7e')](_0x1942cd);})[_0xa2ff('0x1c')](function(_0x5f557b){_0x39cc5c[_0xa2ff('0x40')]=_0x5f557b;return _0x39cc5c;});}})['then'](respondWithFilteredResult(_0x5e021b,_0x1942cd))[_0xa2ff('0x51')](handleError(_0x5e021b,null));};exports[_0xa2ff('0xdc')]=function(_0x2e6608,_0x302373){var _0x3c3e50={};var _0x445b63={};var _0x52a41b;var _0x4fac3c;return db[_0xa2ff('0x31')][_0xa2ff('0x89')]({'where':{'id':_0x2e6608[_0xa2ff('0x49')]['id']}})[_0xa2ff('0x1c')](handleEntityNotFound(_0x302373,null))[_0xa2ff('0x1c')](function(_0x56ae08){if(_0x56ae08){_0x52a41b=_0x56ae08;_0x445b63['model']=_[_0xa2ff('0xc4')](db[_0xa2ff('0xdd')][_0xa2ff('0x32')]);_0x445b63[_0xa2ff('0x3b')]=_['keys'](_0x2e6608[_0xa2ff('0x3b')]);_0x445b63[_0xa2ff('0xc5')]=_[_0xa2ff('0xc6')](_0x445b63[_0xa2ff('0xc7')],_0x445b63[_0xa2ff('0x3b')]);_0x3c3e50[_0xa2ff('0x3f')]=_['intersection'](_0x445b63[_0xa2ff('0xc7')],qs[_0xa2ff('0xd0')](_0x2e6608['query'][_0xa2ff('0xd0')]));_0x3c3e50[_0xa2ff('0x3f')]=_0x3c3e50['attributes'][_0xa2ff('0x41')]?_0x3c3e50[_0xa2ff('0x3f')]:_0x445b63['model'];_0x3c3e50[_0xa2ff('0xc8')]=qs[_0xa2ff('0xc9')](_0x2e6608[_0xa2ff('0x3b')][_0xa2ff('0xc9')]);_0x3c3e50[_0xa2ff('0xca')]=qs['filters'](_[_0xa2ff('0xcb')](_0x2e6608[_0xa2ff('0x3b')],_0x445b63[_0xa2ff('0xc5')]));if(_0x2e6608[_0xa2ff('0x3b')][_0xa2ff('0x26')]){_0x3c3e50[_0xa2ff('0xca')]=_[_0xa2ff('0xcc')](_0x3c3e50['where'],{'$or':_[_0xa2ff('0x28')](_0x3c3e50[_0xa2ff('0x3f')],function(_0x564770){var _0x2395e5={};_0x2395e5[_0x564770]={'$like':'%'+_0x2e6608[_0xa2ff('0x3b')][_0xa2ff('0x26')]+'%'};return _0x2395e5;})});}_0x3c3e50=_[_0xa2ff('0xcc')]({},_0x3c3e50,_0x2e6608[_0xa2ff('0x4d')]);return _0x52a41b[_0xa2ff('0xdc')](_0x3c3e50);}})[_0xa2ff('0x1c')](function(_0x4fdfb1){if(_0x4fdfb1){_0x4fac3c=_0x4fdfb1[_0xa2ff('0x41')];if(!_0x2e6608[_0xa2ff('0x3b')][_0xa2ff('0xbd')](_0xa2ff('0xce'))){_0x3c3e50[_0xa2ff('0x17')]=qs[_0xa2ff('0x17')](_0x2e6608['query'][_0xa2ff('0x17')]);_0x3c3e50[_0xa2ff('0x19')]=qs[_0xa2ff('0x19')](_0x2e6608[_0xa2ff('0x3b')]['offset']);}return _0x52a41b[_0xa2ff('0xdc')](_0x3c3e50);}})['then'](function(_0x3f8e20){if(_0x3f8e20){return _0x3f8e20?{'count':_0x4fac3c,'rows':_0x3f8e20}:null;}})[_0xa2ff('0x1c')](respondWithResult(_0x302373,null))[_0xa2ff('0x51')](handleError(_0x302373,null));};exports[_0xa2ff('0xde')]=function(_0xe7dbd4,_0x15b377){var _0xba5c88={};var _0x2d56d1={};var _0x47d456;var _0x1f5b55;return db['User'][_0xa2ff('0x89')]({'where':{'id':_0xe7dbd4[_0xa2ff('0x49')]['id']}})[_0xa2ff('0x1c')](handleEntityNotFound(_0x15b377,null))[_0xa2ff('0x1c')](function(_0x175924){if(_0x175924){_0x47d456=_0x175924;_0x2d56d1[_0xa2ff('0xc7')]=_['keys'](db[_0xa2ff('0xdf')][_0xa2ff('0x32')]);_0x2d56d1['query']=_[_0xa2ff('0xc4')](_0xe7dbd4['query']);_0x2d56d1[_0xa2ff('0xc5')]=_[_0xa2ff('0xc6')](_0x2d56d1[_0xa2ff('0xc7')],_0x2d56d1[_0xa2ff('0x3b')]);_0xba5c88[_0xa2ff('0x3f')]=_[_0xa2ff('0xc6')](_0x2d56d1[_0xa2ff('0xc7')],qs[_0xa2ff('0xd0')](_0xe7dbd4[_0xa2ff('0x3b')]['fields']));_0xba5c88[_0xa2ff('0x3f')]=_0xba5c88[_0xa2ff('0x3f')][_0xa2ff('0x41')]?_0xba5c88[_0xa2ff('0x3f')]:_0x2d56d1['model'];_0xba5c88[_0xa2ff('0xc8')]=qs[_0xa2ff('0xc9')](_0xe7dbd4['query'][_0xa2ff('0xc9')]);_0xba5c88[_0xa2ff('0xca')]=qs[_0xa2ff('0xc5')](_[_0xa2ff('0xcb')](_0xe7dbd4[_0xa2ff('0x3b')],_0x2d56d1[_0xa2ff('0xc5')]));if(_0xe7dbd4[_0xa2ff('0x3b')]['filter']){_0xba5c88[_0xa2ff('0xca')]=_[_0xa2ff('0xcc')](_0xba5c88[_0xa2ff('0xca')],{'$or':_['map'](_0xba5c88['attributes'],function(_0x91b296){var _0x46f066={};_0x46f066[_0x91b296]={'$like':'%'+_0xe7dbd4[_0xa2ff('0x3b')][_0xa2ff('0x26')]+'%'};return _0x46f066;})});}_0xba5c88=_[_0xa2ff('0xcc')]({},_0xba5c88,_0xe7dbd4['options']);return _0x47d456[_0xa2ff('0xde')](_0xba5c88);}})['then'](function(_0x4c698c){if(_0x4c698c){_0x1f5b55=_0x4c698c[_0xa2ff('0x41')];if(!_0xe7dbd4[_0xa2ff('0x3b')][_0xa2ff('0xbd')](_0xa2ff('0xce'))){_0xba5c88[_0xa2ff('0x17')]=qs['limit'](_0xe7dbd4[_0xa2ff('0x3b')][_0xa2ff('0x17')]);_0xba5c88[_0xa2ff('0x19')]=qs[_0xa2ff('0x19')](_0xe7dbd4[_0xa2ff('0x3b')]['offset']);}return _0x47d456[_0xa2ff('0xde')](_0xba5c88);}})['then'](function(_0x1e25bc){if(_0x1e25bc){return _0x1e25bc?{'count':_0x1f5b55,'rows':_0x1e25bc}:null;}})[_0xa2ff('0x1c')](respondWithResult(_0x15b377,null))[_0xa2ff('0x51')](handleError(_0x15b377,null));};exports[_0xa2ff('0xe0')]=function(_0xb07b00,_0x54ce62){var _0x2a041e={};var _0x3a7979={};var _0x121c1f;var _0x49afe7;return db[_0xa2ff('0x31')][_0xa2ff('0x89')]({'where':{'id':_0xb07b00[_0xa2ff('0x49')]['id']}})['then'](handleEntityNotFound(_0x54ce62,null))[_0xa2ff('0x1c')](function(_0x1e24cf){if(_0x1e24cf){_0x121c1f=_0x1e24cf;_0x3a7979['model']=_[_0xa2ff('0xc4')](db[_0xa2ff('0xe1')]['rawAttributes']);_0x3a7979[_0xa2ff('0x3b')]=_[_0xa2ff('0xc4')](_0xb07b00['query']);_0x3a7979[_0xa2ff('0xc5')]=_[_0xa2ff('0xc6')](_0x3a7979[_0xa2ff('0xc7')],_0x3a7979[_0xa2ff('0x3b')]);_0x2a041e[_0xa2ff('0x3f')]=_[_0xa2ff('0xc6')](_0x3a7979[_0xa2ff('0xc7')],qs['fields'](_0xb07b00[_0xa2ff('0x3b')][_0xa2ff('0xd0')]));_0x2a041e[_0xa2ff('0x3f')]=_0x2a041e['attributes'][_0xa2ff('0x41')]?_0x2a041e['attributes']:_0x3a7979[_0xa2ff('0xc7')];_0x2a041e[_0xa2ff('0xc8')]=qs[_0xa2ff('0xc9')](_0xb07b00[_0xa2ff('0x3b')]['sort']);_0x2a041e[_0xa2ff('0xca')]=qs['filters'](_['pick'](_0xb07b00[_0xa2ff('0x3b')],_0x3a7979[_0xa2ff('0xc5')]));if(_0xb07b00[_0xa2ff('0x3b')]['filter']){_0x2a041e['where']=_[_0xa2ff('0xcc')](_0x2a041e[_0xa2ff('0xca')],{'$or':_[_0xa2ff('0x28')](_0x2a041e[_0xa2ff('0x3f')],function(_0x509995){var _0x1eb296={};_0x1eb296[_0x509995]={'$like':'%'+_0xb07b00['query'][_0xa2ff('0x26')]+'%'};return _0x1eb296;})});}_0x2a041e=_[_0xa2ff('0xcc')]({},_0x2a041e,_0xb07b00[_0xa2ff('0x4d')]);return _0x121c1f[_0xa2ff('0xe0')](_0x2a041e);}})['then'](function(_0x2e8c53){if(_0x2e8c53){_0x49afe7=_0x2e8c53[_0xa2ff('0x41')];if(!_0xb07b00[_0xa2ff('0x3b')][_0xa2ff('0xbd')](_0xa2ff('0xce'))){_0x2a041e[_0xa2ff('0x17')]=qs[_0xa2ff('0x17')](_0xb07b00[_0xa2ff('0x3b')][_0xa2ff('0x17')]);_0x2a041e[_0xa2ff('0x19')]=qs[_0xa2ff('0x19')](_0xb07b00[_0xa2ff('0x3b')][_0xa2ff('0x19')]);}return _0x121c1f[_0xa2ff('0xe0')](_0x2a041e);}})['then'](function(_0x2e53a5){if(_0x2e53a5){return _0x2e53a5?{'count':_0x49afe7,'rows':_0x2e53a5}:null;}})[_0xa2ff('0x1c')](respondWithResult(_0x54ce62,null))[_0xa2ff('0x51')](handleError(_0x54ce62,null));};exports[_0xa2ff('0xe2')]=function(_0x58a9ba,_0x471c55,_0x4a602e){var _0x16c70b;var _0x544817;var _0x36b4ad;var _0x48743c=!_[_0xa2ff('0x5a')](_0x58a9ba[_0xa2ff('0x49')]['id'])?_0x58a9ba['params']['id']:!_['isNil'](_0x58a9ba[_0xa2ff('0x70')]['id'])?_0x58a9ba[_0xa2ff('0x70')]['id']:null;return db[_0xa2ff('0x31')][_0xa2ff('0x2a')]({'where':{'id':_0x48743c,'role':{'$or':[_0xa2ff('0x71'),_0xa2ff('0x70'),_0xa2ff('0x1e')]}},'attributes':['id','name','phone',_0xa2ff('0xe3'),_0xa2ff('0x1d'),_0xa2ff('0x59'),_0xa2ff('0x90')]})[_0xa2ff('0x1c')](function(_0x2d589c){if(_0x2d589c){if(_0x2d589c[_0xa2ff('0x1d')]===_0xa2ff('0x1e')){_0x16c70b=_0x2d589c;if(_0x58a9ba['body'][_0xa2ff('0x9e')]){_0x36b4ad=util['format'](_0xa2ff('0xe4'),_0x16c70b[_0x58a9ba['body']['interface']]);}else if(_0x58a9ba[_0xa2ff('0x50')][_0xa2ff('0xe5')]){_0x36b4ad=util[_0xa2ff('0x9f')](_0xa2ff('0xe6'),_0x58a9ba[_0xa2ff('0x50')][_0xa2ff('0xe5')]);}else{_0x36b4ad=util[_0xa2ff('0x9f')](_0xa2ff('0xe6'),_0x16c70b[_0xa2ff('0x2f')]);}socket['to'](util[_0xa2ff('0x9f')](_0xa2ff('0xe7'),_0x16c70b[_0xa2ff('0x2f')]))[_0xa2ff('0x9a')](_0xa2ff('0xe8'),{'user':{'id':_0x16c70b['id'],'name':_0x16c70b[_0xa2ff('0x2f')]},'ip':_0x58a9ba[_0xa2ff('0xe9')]['x-forwarded-for']||_0x58a9ba[_0xa2ff('0xea')]['remoteAddress']||_0x58a9ba[_0xa2ff('0xeb')][_0xa2ff('0xec')]||_0x58a9ba['connection']['socket'][_0xa2ff('0xec')]});return db['UserVoiceQueueRt'][_0xa2ff('0x20')]({'where':{'membername':_0x16c70b[_0xa2ff('0x2f')]},'individualHooks':!![]});}}else{throw new db[(_0xa2ff('0x83'))][(_0xa2ff('0x84'))](_0xa2ff('0xed'));}})[_0xa2ff('0x1c')](function(){if(_0x16c70b){return _0x16c70b[_0xa2ff('0xee')]({'raw':!![]});}})[_0xa2ff('0x1c')](function(_0x4e1e19){if(_0x16c70b){if(_0x4e1e19){_0x544817=_0x4e1e19;if(_0x544817['length']){var _0x4d9097=_0x544817[_0xa2ff('0x28')](function(_0x22a273){var _0x56ab1e={'membername':_0x16c70b[_0xa2ff('0x2f')],'UserId':_0x16c70b['id'],'queue_name':_0x22a273[_0xa2ff('0x2f')],'VoiceQueueId':_0x22a273['id'],'interface':_0x36b4ad,'paused':_0x16c70b[_0xa2ff('0x90')]||![],'penalty':_0x22a273[_0xa2ff('0xef')]||0x0};return db[_0xa2ff('0xa4')][_0xa2ff('0xa0')](_0x56ab1e);});return Promise['all'](_0x4d9097);}}}})[_0xa2ff('0x1c')](function(){if(_0x16c70b){return db[_0xa2ff('0xf0')][_0xa2ff('0x7e')]({'where':{'membername':_0x16c70b[_0xa2ff('0x2f')],'exitAt':null}});}})['then'](function(_0x4564ed){if(_0x16c70b){var _0x1b6e50=[];_0x4564ed[_0xa2ff('0xf1')](function(_0x40164e){_0x1b6e50['push'](_0x40164e[_0xa2ff('0x1b')]({'exitAt':moment()[_0xa2ff('0x9f')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0xa2ff('0x47')](_0x1b6e50);}})['then'](function(){if(_0x16c70b){var _0x5daee4=[];var _0x3d4196=[];var _0x3d521b=utils[_0xa2ff('0xf2')]();var _0x1d780e={'membername':_0x16c70b[_0xa2ff('0x2f')],'interface':_0x36b4ad,'enterAt':moment()[_0xa2ff('0x9f')](_0xa2ff('0xf3')),'role':_0x16c70b[_0xa2ff('0x1d')],'internal':_0x16c70b[_0xa2ff('0x59')]};_0x3d521b['forEach'](function(_0x52bbf3){_0x5daee4[_0xa2ff('0x42')](_[_0xa2ff('0xcc')]({'channel':_0x52bbf3,'type':_0xa2ff('0xf4'),'data1':_0x58a9ba['body']['device'],'data2':_0x36b4ad},_0x1d780e));if(_0x16c70b[_0xa2ff('0x90')]){_0x3d4196[_0xa2ff('0x42')](_[_0xa2ff('0xcc')]({'channel':_0x52bbf3,'type':_0xa2ff('0xf5'),'data1':'LOGININPAUSE'},_0x1d780e));}});return db[_0xa2ff('0xf0')][_0xa2ff('0x78')](_0x5daee4[_0xa2ff('0xba')](_0x3d4196),{'individualHooks':!![]});}})[_0xa2ff('0x1c')](function(){if(_0x16c70b){return _0x16c70b[_0xa2ff('0x1b')]({'online':!![],'lastLoginAt':moment()[_0xa2ff('0x9f')](_0xa2ff('0xf3')),'voicePause':_0x16c70b[_0xa2ff('0x90')]||![],'mailPause':_0x16c70b['loginInPause']||![],'chatPause':_0x16c70b[_0xa2ff('0x90')]||![],'faxPause':_0x16c70b['loginInPause']||![],'smsPause':_0x16c70b[_0xa2ff('0x90')]||![],'openchannelPause':_0x16c70b['loginInPause']||![],'whatsappPause':_0x16c70b['loginInPause']||![],'pauseType':_0x16c70b['loginInPause']?_0xa2ff('0xf6'):null,'interface':_0x36b4ad,'lastPauseAt':moment()['format'](_0xa2ff('0xf3'))});}})['then'](function(_0x1130aa){if(_0x58a9ba['isMiddleware']){return _0x4a602e();}else{return Promise[_0xa2ff('0xf7')](_0x1130aa)[_0xa2ff('0x1c')](respondWithResult(_0x471c55,null));}})['catch'](handleError(_0x471c55,null));};exports[_0xa2ff('0xf8')]=function(_0x585ee1,_0x403dde){var _0x1143aa;return db[_0xa2ff('0x31')][_0xa2ff('0x2a')]({'where':{'id':_0x585ee1[_0xa2ff('0x49')]['id'],'role':_0xa2ff('0x1e')},'attributes':['id','name',_0xa2ff('0x1d')]})[_0xa2ff('0x1c')](handleEntityNotFound(_0x403dde,null))['then'](function(_0x31f910){if(_0x31f910){_0x1143aa=_0x31f910;return db[_0xa2ff('0xa4')][_0xa2ff('0x20')]({'where':{'membername':_0x1143aa[_0xa2ff('0x2f')]},'individualHooks':!![]});}})['then'](function(){return db[_0xa2ff('0xf0')]['findAll']({'where':{'membername':_0x1143aa[_0xa2ff('0x2f')],'exitAt':null}});})[_0xa2ff('0x1c')](function(_0x17799a){var _0x3d6e97=[];_0x17799a[_0xa2ff('0xf1')](function(_0x22856e){_0x3d6e97[_0xa2ff('0x42')](_0x22856e['update']({'exitAt':moment()[_0xa2ff('0x9f')](_0xa2ff('0xf3'))}));});return Promise['all'](_0x3d6e97);})[_0xa2ff('0x1c')](function(){return _0x1143aa[_0xa2ff('0x1b')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xa2ff('0x1c')](respondWithResult(_0x403dde,null))[_0xa2ff('0x51')](handleError(_0x403dde,null));};exports['pause']=function(_0x43c352,_0x48a350){var _0x7bc669;return db[_0xa2ff('0xa4')]['update']({'paused':0x1},{'where':{'UserId':_0x43c352[_0xa2ff('0x49')]['id']},'individualHooks':!![]})['then'](function(){return db[_0xa2ff('0x31')][_0xa2ff('0x2a')]({'where':{'id':_0x43c352[_0xa2ff('0x49')]['id'],'role':_0xa2ff('0x1e')},'attributes':['id','name',_0xa2ff('0x1d'),_0xa2ff('0x59'),_0xa2ff('0x9e'),'online']});})[_0xa2ff('0x1c')](handleEntityNotFound(_0x48a350,null))['then'](function(_0x33d4f2){if(_0x33d4f2){_0x7bc669=_0x33d4f2;return db[_0xa2ff('0xf0')][_0xa2ff('0x7e')]({'where':{'membername':_0x7bc669['name'],'type':_0xa2ff('0xf5'),'exitAt':null}});}})[_0xa2ff('0x1c')](function(_0x30f5ac){if(_0x30f5ac[_0xa2ff('0x41')]){var _0x554072=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x31619a=0x0,_0x5acdae=_0x30f5ac[_0xa2ff('0x41')];_0x31619a<_0x5acdae;_0x31619a++){_0x30f5ac[_0x31619a]['updateAttributes']({'exitAt':_0x554072});}}})[_0xa2ff('0x1c')](function(){var _0x33d879=[];var _0xba359a=utils['getChannels']();_0xba359a[_0xa2ff('0xf1')](function(_0x31e009){_0x33d879['push']({'channel':_0x31e009,'membername':_0x7bc669[_0xa2ff('0x2f')],'interface':_['isNil'](_0x7bc669[_0xa2ff('0x9e')])?util[_0xa2ff('0x9f')](_0xa2ff('0xe6'),_0x7bc669[_0xa2ff('0x2f')]):_0x7bc669[_0xa2ff('0x9e')],'type':_0xa2ff('0xf5'),'enterAt':moment()[_0xa2ff('0x9f')](_0xa2ff('0xf3')),'data1':_0x43c352[_0xa2ff('0x50')][_0xa2ff('0xf9')]||'DEFAULT\x20PAUSE','role':_0x7bc669['role'],'internal':_0x7bc669['internal']});});return db[_0xa2ff('0xf0')][_0xa2ff('0x78')](_0x33d879,{'individualHooks':!![]});})[_0xa2ff('0x1c')](function(){return _0x7bc669[_0xa2ff('0x1b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x43c352[_0xa2ff('0x50')][_0xa2ff('0xf9')]||_0xa2ff('0xfa'),'lastPauseAt':moment()['format'](_0xa2ff('0xf3'))});})[_0xa2ff('0x1c')](respondWithResult(_0x48a350,null))['catch'](handleError(_0x48a350,null));};exports[_0xa2ff('0xfb')]=function(_0xccc3df,_0x46d9a7){if(_0xccc3df[_0xa2ff('0x50')]['channel']&&!utils['isValidChannel'](_0xccc3df['body'][_0xa2ff('0x8e')])){throw new APIBadRequestError(util[_0xa2ff('0x9f')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0xccc3df[_0xa2ff('0x50')][_0xa2ff('0x8e')]));}return db['User'][_0xa2ff('0x2a')]({'where':{'id':_0xccc3df[_0xa2ff('0x49')]['id']},'attributes':['id',_0xa2ff('0x2f'),'role',_0xa2ff('0x59'),_0xa2ff('0x9e'),'online',_0xa2ff('0x91'),_0xa2ff('0xfc'),_0xa2ff('0xfd'),_0xa2ff('0xfe'),_0xa2ff('0xff'),_0xa2ff('0x100'),_0xa2ff('0x101'),'pauseType',_0xa2ff('0x102')]})[_0xa2ff('0x1c')](function(_0x14b1af){if(!_0x14b1af){throw new APINotFoundError(util[_0xa2ff('0x9f')](_0xa2ff('0xbc'),_0xccc3df[_0xa2ff('0x49')]['id']));}return _0x14b1af[_0xa2ff('0xfb')](_0xccc3df[_0xa2ff('0x50')][_0xa2ff('0x8e')]);})['then'](respondWithResult(_0x46d9a7,null))[_0xa2ff('0x51')](APIHandleError(_0x46d9a7));};exports['getTeams']=function(_0x5693d7,_0x5ccd5b){var _0x24ac62={};var _0x246054={};var _0x89508;var _0x521261;return db[_0xa2ff('0x31')][_0xa2ff('0x89')]({'where':{'id':_0x5693d7[_0xa2ff('0x49')]['id']}})[_0xa2ff('0x1c')](handleEntityNotFound(_0x5ccd5b,null))[_0xa2ff('0x1c')](function(_0x32c730){if(_0x32c730){_0x89508=_0x32c730;_0x246054[_0xa2ff('0xc7')]=_['keys'](db[_0xa2ff('0x103')]['rawAttributes']);_0x246054[_0xa2ff('0x3b')]=_[_0xa2ff('0xc4')](_0x5693d7[_0xa2ff('0x3b')]);_0x246054[_0xa2ff('0xc5')]=_['intersection'](_0x246054[_0xa2ff('0xc7')],_0x246054['query']);_0x24ac62[_0xa2ff('0x3f')]=_['intersection'](_0x246054['model'],qs[_0xa2ff('0xd0')](_0x5693d7[_0xa2ff('0x3b')][_0xa2ff('0xd0')]));_0x24ac62[_0xa2ff('0x3f')]=_0x24ac62[_0xa2ff('0x3f')]['length']?_0x24ac62[_0xa2ff('0x3f')]:_0x246054[_0xa2ff('0xc7')];_0x24ac62[_0xa2ff('0xc8')]=qs[_0xa2ff('0xc9')](_0x5693d7[_0xa2ff('0x3b')]['sort']);_0x24ac62[_0xa2ff('0xca')]=qs['filters'](_[_0xa2ff('0xcb')](_0x5693d7['query'],_0x246054['filters']));if(_0x5693d7[_0xa2ff('0x3b')]['filter']){_0x24ac62[_0xa2ff('0xca')]=_['merge'](_0x24ac62['where'],{'$or':_['map'](_0x24ac62[_0xa2ff('0x3f')],function(_0x3a3401){var _0x32a383={};_0x32a383[_0x3a3401]={'$like':'%'+_0x5693d7['query'][_0xa2ff('0x26')]+'%'};return _0x32a383;})});}_0x24ac62=_[_0xa2ff('0xcc')]({},_0x24ac62,_0x5693d7[_0xa2ff('0x4d')]);return _0x89508[_0xa2ff('0x104')](_0x24ac62);}})[_0xa2ff('0x1c')](function(_0xa2593){if(_0xa2593){_0x521261=_0xa2593[_0xa2ff('0x41')];if(!_0x5693d7[_0xa2ff('0x3b')][_0xa2ff('0xbd')]('nolimit')){_0x24ac62[_0xa2ff('0x17')]=qs['limit'](_0x5693d7[_0xa2ff('0x3b')]['limit']);_0x24ac62[_0xa2ff('0x19')]=qs[_0xa2ff('0x19')](_0x5693d7[_0xa2ff('0x3b')][_0xa2ff('0x19')]);}return _0x89508[_0xa2ff('0x104')](_0x24ac62);}})[_0xa2ff('0x1c')](function(_0x28d6b8){if(_0x28d6b8){return _0x28d6b8?{'count':_0x521261,'rows':_0x28d6b8}:null;}})['then'](respondWithResult(_0x5ccd5b,null))['catch'](handleError(_0x5ccd5b,null));};exports[_0xa2ff('0x105')]=function(_0xb0cec7,_0x50b9a5){var _0x16985f=_0xb0cec7[_0xa2ff('0x49')]['id'];var _0x47739d=_0xb0cec7[_0xa2ff('0x50')]?_0xb0cec7[_0xa2ff('0x50')][_0xa2ff('0x55')]:null;var _0x4a6e62=[];return Promise[_0xa2ff('0xf7')]()[_0xa2ff('0x1c')](function(){if(!_0x47739d)throw new APIBadRequestError(_0xa2ff('0x106'));})[_0xa2ff('0x1c')](function(){return db[_0xa2ff('0x31')][_0xa2ff('0x89')]({'where':{'id':_0x16985f}});})[_0xa2ff('0x1c')](function(_0x2fd850){if(!_0x2fd850)throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0xb0cec7[_0xa2ff('0x49')]['id']));return db['sequelize']['transaction'](function(_0x383a07){return _0x2fd850[_0xa2ff('0x105')](_0x47739d,{'transaction':_0x383a07})[_0xa2ff('0x1c')](function(){return db[_0xa2ff('0x103')][_0xa2ff('0x7e')]({'where':{'id':{'$in':_0x47739d}}});})[_0xa2ff('0x1c')](function(_0x376036){var _0x450712=_[_0xa2ff('0x28')](_0x376036,function(_0x8e949){return _0x8e949[_0xa2ff('0x107')]();});return Promise[_0xa2ff('0x47')](_0x450712);})[_0xa2ff('0x1c')](function(_0x2983e4){_0x4a6e62=_[_0xa2ff('0x108')](_0x2983e4);var _0x329b49=_['map'](_0x4a6e62,function(_0x56334b){return _0x56334b[_0xa2ff('0x109')](_0x2fd850['id'],{'transaction':_0x383a07});});return Promise['all'](_0x329b49);})[_0xa2ff('0x1c')](function(){if(!_0x2fd850['online'])return;var _0x1e997c=_[_0xa2ff('0x26')](_0x4a6e62,function(_0x4440d2){return _0x4440d2[_0xa2ff('0x10a')](_0xa2ff('0x8e'))==='Voice';});var _0x3d35a9=_[_0xa2ff('0x28')](_0x1e997c,function(_0x336955){return db['UserVoiceQueueRt'][_0xa2ff('0xa0')]({'membername':_0x2fd850['name'],'UserId':_0x2fd850['id'],'queue_name':_0x336955[_0xa2ff('0x2f')],'VoiceQueueId':_0x336955['id'],'interface':_[_0xa2ff('0x5a')](_0x2fd850['interface'])?util[_0xa2ff('0x9f')]('SIP/%s',_0x2fd850[_0xa2ff('0x2f')]):_0x2fd850[_0xa2ff('0x9e')],'paused':_0x2fd850[_0xa2ff('0x91')]||![],'penalty':_0x2fd850[_0xa2ff('0x97')]},{'transaction':_0x383a07});});return Promise['all'](_0x3d35a9);})[_0xa2ff('0x1c')](function(){return db[_0xa2ff('0x10b')][_0xa2ff('0x7e')]({'where':{'teamId':{'$in':_0x47739d}}});})[_0xa2ff('0x1c')](function(_0x4733f7){var _0x2c5595=_['map'](_0x4733f7,function(_0x561fea){return db[_0xa2ff('0x10c')][_0xa2ff('0x7c')]({'UserId':_0x2fd850['id'],'VoicePrefixId':_0x561fea[_0xa2ff('0x10d')]},{'transaction':_0x383a07});});return Promise[_0xa2ff('0x47')](_0x2c5595);});});})['then'](function(){for(var _0x5a4de8=0x0;_0x5a4de8<_0x4a6e62[_0xa2ff('0x41')];_0x5a4de8++){var _0x4d0043=_0x4a6e62[_0x5a4de8][_0xa2ff('0x10a')](_0xa2ff('0x8e'));var _0xe0ec51=_0x4d0043+'QueueId';socket['emit'](_0xa2ff('0x70')+_0x4d0043+_0xa2ff('0x9b'),{'UserId':_0x16985f,['queueField']:_0x4a6e62[_0x5a4de8]['id']});}})[_0xa2ff('0x1c')](respondWithStatusCode(_0x50b9a5,null))[_0xa2ff('0x51')](APIHandleError(_0x50b9a5));};exports['removeTeams']=function(_0x89a954,_0x197c38){var _0x12ef7c=_0x89a954['params']['id'];var _0x406634=null;if(_0x89a954['query']['ids']){_0x406634=_['isArray'](_0x89a954['query']['ids'])?_0x89a954[_0xa2ff('0x3b')]['ids']:[_0x89a954['query'][_0xa2ff('0x55')]];}var _0x415425=[];return Promise[_0xa2ff('0xf7')]()['then'](function(){if(!_0x406634)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})['then'](function(){return db[_0xa2ff('0x31')][_0xa2ff('0x89')]({'where':{'id':_0x12ef7c}});})['then'](function(_0xd0d3c2){if(!_0xd0d3c2)throw new APINotFoundError(util[_0xa2ff('0x9f')](_0xa2ff('0xbc'),_0x89a954['params']['id']));return db[_0xa2ff('0x5c')]['transaction'](function(_0x36e871){return _0xd0d3c2[_0xa2ff('0x10e')](_0x406634,{'transaction':_0x36e871})[_0xa2ff('0x1c')](function(){return db[_0xa2ff('0x103')][_0xa2ff('0x7e')]({'where':{'id':{'$in':_0x406634}}});})[_0xa2ff('0x1c')](function(_0x11f104){var _0x2834cb=_[_0xa2ff('0x28')](_0x11f104,function(_0x33cc5d){return _0x33cc5d[_0xa2ff('0x107')]();});return Promise[_0xa2ff('0x47')](_0x2834cb);})[_0xa2ff('0x1c')](function(_0x4093d7){_0x415425=_[_0xa2ff('0x108')](_0x4093d7);var _0x1cc324=_[_0xa2ff('0x28')](_0x415425,function(_0x2c889d){return _0x2c889d['removeAgent'](_0xd0d3c2['id'],{'transaction':_0x36e871});});return Promise[_0xa2ff('0x47')](_0x1cc324);})['then'](function(){if(!_0xd0d3c2[_0xa2ff('0x8f')])return;var _0x522195=_[_0xa2ff('0x26')](_0x415425,function(_0x54f84e){return _0x54f84e[_0xa2ff('0x10a')](_0xa2ff('0x8e'))===_0xa2ff('0x10f');});var _0x1ec5b6=_[_0xa2ff('0x28')](_0x522195,function(_0x4a22a1){return db[_0xa2ff('0xa4')][_0xa2ff('0x20')]({'where':{'VoiceQueueId':_0x4a22a1['id'],'UserId':_0xd0d3c2['id']},'transaction':_0x36e871});});return Promise[_0xa2ff('0x47')](_0x1ec5b6);})['then'](function(){return db['TeamVoicePrefix'][_0xa2ff('0x7e')]({'where':{'teamId':{'$in':_0x406634}}});})[_0xa2ff('0x1c')](function(_0x52279c){var _0x31d96e=_[_0xa2ff('0x28')](_0x52279c,function(_0x494def){return db[_0xa2ff('0x10c')][_0xa2ff('0x20')]({'where':{'UserId':_0xd0d3c2['id'],'VoicePrefixId':_0x494def[_0xa2ff('0x10d')]}},{'transaction':_0x36e871});});return Promise[_0xa2ff('0x47')](_0x31d96e);});});})[_0xa2ff('0x1c')](function(){for(var _0x52541a=0x0;_0x52541a<_0x415425[_0xa2ff('0x41')];_0x52541a++){var _0x34d699=_0x415425[_0x52541a]['getDataValue']('channel');var _0x4d53f3=_0x34d699+_0xa2ff('0x99');socket[_0xa2ff('0x9a')](_0xa2ff('0x70')+_0x34d699+'Queue:remove',{'UserId':_0x12ef7c,['queueField']:_0x415425[_0x52541a]['id']});}})['then'](respondWithStatusCode(_0x197c38,null))[_0xa2ff('0x51')](APIHandleError(_0x197c38));};exports[_0xa2ff('0x110')]=function(_0x3019df,_0x8e44ae){var _0x3b4711={};var _0xd6d270={};var _0x2cb18b;var _0x3ba420;return db['User']['findOne']({'where':{'id':_0x3019df[_0xa2ff('0x49')]['id']}})[_0xa2ff('0x1c')](handleEntityNotFound(_0x8e44ae,null))[_0xa2ff('0x1c')](function(_0x3e6d18){if(_0x3e6d18){_0x2cb18b=_0x3e6d18;_0xd6d270[_0xa2ff('0xc7')]=_[_0xa2ff('0xc4')](db[_0xa2ff('0xbe')][_0xa2ff('0x32')]);_0xd6d270[_0xa2ff('0x3b')]=_[_0xa2ff('0xc4')](_0x3019df['query']);_0xd6d270[_0xa2ff('0xc5')]=_[_0xa2ff('0xc6')](_0xd6d270[_0xa2ff('0xc7')],_0xd6d270[_0xa2ff('0x3b')]);_0x3b4711['attributes']=_['intersection'](_0xd6d270[_0xa2ff('0xc7')],qs['fields'](_0x3019df['query']['fields']));_0x3b4711[_0xa2ff('0x3f')]=_0x3b4711[_0xa2ff('0x3f')][_0xa2ff('0x41')]?_0x3b4711[_0xa2ff('0x3f')]:_0xd6d270[_0xa2ff('0xc7')];_0x3b4711['order']=qs[_0xa2ff('0xc9')](_0x3019df['query'][_0xa2ff('0xc9')]);_0x3b4711[_0xa2ff('0xca')]=qs['filters'](_[_0xa2ff('0xcb')](_0x3019df['query'],_0xd6d270[_0xa2ff('0xc5')]));if(_0x3019df[_0xa2ff('0x3b')][_0xa2ff('0x26')]){_0x3b4711[_0xa2ff('0xca')]=_['merge'](_0x3b4711[_0xa2ff('0xca')],{'$or':_[_0xa2ff('0x28')](_0x3b4711[_0xa2ff('0x3f')],function(_0x45f80b){var _0x1e078={};_0x1e078[_0x45f80b]={'$like':'%'+_0x3019df[_0xa2ff('0x3b')]['filter']+'%'};return _0x1e078;})});}_0x3b4711=_[_0xa2ff('0xcc')]({},_0x3b4711,_0x3019df[_0xa2ff('0x4d')]);return _0x2cb18b[_0xa2ff('0x110')](_0x3b4711);}})[_0xa2ff('0x1c')](function(_0x42397e){if(_0x42397e){_0x3ba420=_0x42397e[_0xa2ff('0x41')];if(!_0x3019df[_0xa2ff('0x3b')][_0xa2ff('0xbd')]('nolimit')){_0x3b4711[_0xa2ff('0x17')]=qs['limit'](_0x3019df[_0xa2ff('0x3b')][_0xa2ff('0x17')]);_0x3b4711[_0xa2ff('0x19')]=qs[_0xa2ff('0x19')](_0x3019df[_0xa2ff('0x3b')][_0xa2ff('0x19')]);}return _0x2cb18b[_0xa2ff('0x110')](_0x3b4711);}})[_0xa2ff('0x1c')](function(_0x2ad485){if(_0x2ad485){return _0x2ad485?{'count':_0x3ba420,'rows':_0x2ad485}:null;}})[_0xa2ff('0x1c')](respondWithResult(_0x8e44ae,null))['catch'](handleError(_0x8e44ae,null));};exports[_0xa2ff('0x111')]=function(_0x411845,_0x1d1043){var _0x16a0d7={};var _0x3292d3={};var _0x44c46a;return db[_0xa2ff('0x31')][_0xa2ff('0x89')]({'where':{'id':_0x411845[_0xa2ff('0x49')]['id']}})[_0xa2ff('0x1c')](handleEntityNotFound(_0x1d1043,null))[_0xa2ff('0x1c')](function(_0x338fcc){if(_0x338fcc){_0x44c46a=_0x338fcc;_0x3292d3[_0xa2ff('0xc7')]=_[_0xa2ff('0xc4')](db[_0xa2ff('0x31')][_0xa2ff('0x32')]);_0x3292d3[_0xa2ff('0x3b')]=_[_0xa2ff('0xc4')](_0x411845['query']);_0x3292d3['filters']=_[_0xa2ff('0xc6')](_0x3292d3[_0xa2ff('0xc7')],_0x3292d3[_0xa2ff('0x3b')]);_0x16a0d7[_0xa2ff('0x3f')]=_['intersection'](_0x3292d3[_0xa2ff('0xc7')],qs[_0xa2ff('0xd0')](_0x411845['query'][_0xa2ff('0xd0')]));_0x16a0d7[_0xa2ff('0x3f')]=_0x16a0d7[_0xa2ff('0x3f')][_0xa2ff('0x41')]?_0x16a0d7['attributes']:_0x3292d3[_0xa2ff('0xc7')];_0x16a0d7[_0xa2ff('0xc8')]=qs['sort'](_0x411845[_0xa2ff('0x3b')][_0xa2ff('0xc9')]);_0x16a0d7[_0xa2ff('0xca')]=qs[_0xa2ff('0xc5')](_[_0xa2ff('0xcb')](_0x411845['query'],_0x3292d3[_0xa2ff('0xc5')]));if(_0x411845[_0xa2ff('0x3b')][_0xa2ff('0x26')]){_0x16a0d7[_0xa2ff('0xca')]=_[_0xa2ff('0xcc')](_0x16a0d7['where'],{'$or':_[_0xa2ff('0x28')](_0x16a0d7[_0xa2ff('0x3f')],function(_0x2aeecf){var _0x18f33a={};_0x18f33a[_0x2aeecf]={'$like':'%'+_0x411845[_0xa2ff('0x3b')]['filter']+'%'};return _0x18f33a;})});}_0x16a0d7['model']=db[_0xa2ff('0x31')];_0x16a0d7['as']=_0xa2ff('0x23');_0x16a0d7=_[_0xa2ff('0xcc')]({},_0x16a0d7,_0x411845[_0xa2ff('0x4d')]);return _0x44c46a[_0xa2ff('0xee')]({'include':[_0x16a0d7]});}})['then'](function(_0x5889e2){if(_0x5889e2){var _0x196d7b={},_0x14834b=[];for(var _0x5a30c2=0x0;_0x5a30c2<_0x5889e2[_0xa2ff('0x41')];_0x5a30c2+=0x1){for(var _0x2c35f5=0x0,_0x9945d5;_0x2c35f5<_0x5889e2[_0x5a30c2][_0xa2ff('0x23')][_0xa2ff('0x41')];_0x2c35f5+=0x1){_0x9945d5=_0x5889e2[_0x5a30c2][_0xa2ff('0x23')][_0x2c35f5]['get']({'plain':!![]});_0x196d7b[_0x9945d5['id']]=_0x9945d5;}}_0x196d7b=_[_0xa2ff('0x112')](_0x196d7b);for(var _0x20f550=qs['offset'](_0x411845[_0xa2ff('0x3b')][_0xa2ff('0x19')]);_0x20f550<_0x196d7b[_0xa2ff('0x41')]&&_0x14834b[_0xa2ff('0x41')]=_0x29124a){_0x1174ac=_0x29124a;_0x33a37e=0xc8;}else{_0x33a37e=0xce;}_0x2ba462['status'](_0x33a37e);return _0x2ba462[_0x5d08('0x1c')]('Content-Range',_0x9900ed+'-'+_0x1174ac+'/'+_0x29124a)[_0x5d08('0x17')](_0xdbabba);}return null;};}function saveUpdates(_0x19f2bc){return function(_0x22075c){if(_0x22075c){return _0x22075c[_0x5d08('0x1d')](_0x19f2bc)['then'](function(_0x1dc19a){if(_0x1dc19a[_0x5d08('0x1e')]===_0x5d08('0x1f')){socket[_0x5d08('0x20')](_0x5d08('0x21')+_0x1dc19a['id'],_0x1dc19a);}return _0x1dc19a;});}return null;};}function removeEntity(_0x4b360c){return function(_0x39bed6){if(_0x39bed6){return _0x39bed6['destroy']()[_0x5d08('0x22')](function(){var _0x437bca=_0x39bed6[_0x5d08('0x23')]({'plain':!![]});if(_0x437bca[_0x5d08('0x1e')]===_0x5d08('0x24'))return;var _0xa555fd=[{'name':_0x5d08('0x25'),'value':_0x5d08('0x26'),'ignore':!![]},{'name':'Agents','value':'agent','ignore':![]},{'name':_0x5d08('0x27'),'value':_0x5d08('0x28'),'ignore':![]}];var _0x392a9d=_(_0xa555fd)['filter'](_0x5d08('0x29'))[_0x5d08('0x2a')]('value')['value']();if(_[_0x5d08('0x2b')](_0x392a9d,_0x437bca['role'])){return;}var _0x5eebce=_[_0x5d08('0x2c')](_0xa555fd,['value',_0x437bca['role']])['name'];return db['UserProfileResource'][_0x5d08('0x2d')]({'where':{'type':_0x5eebce,'resourceId':_0x437bca['id']}})['then'](function(){return _0x39bed6;});})[_0x5d08('0x22')](function(){_0x4b360c['status'](0xcc)[_0x5d08('0x16')]();});}};}function handleEntityNotFound(_0x41f312){return function(_0x4b224c){if(!_0x4b224c){_0x41f312[_0x5d08('0x14')](0x194);}return _0x4b224c;};}function handleError(_0x33c11f,_0x4c82dd){_0x4c82dd=_0x4c82dd||0x1f4;return function(_0x150cb9){logger[_0x5d08('0x2e')](_0x150cb9[_0x5d08('0x2f')]);if(_0x150cb9['name']){delete _0x150cb9['name'];}_0x33c11f[_0x5d08('0x15')](_0x4c82dd)[_0x5d08('0x30')](_0x150cb9);};}function getUserAttributes(){return _(db['User'][_0x5d08('0x31')])['map'](function(_0x34aaba){return{'name':_0x34aaba['fieldName'],'type':_0x34aaba[_0x5d08('0x32')][_0x5d08('0x33')]};})[_0x5d08('0x34')](function(_0x3e1486){return!['password',_0x5d08('0x35'),_0x5d08('0x36'),_0x5d08('0x37'),_0x5d08('0x38'),_0x5d08('0x39')][_0x5d08('0x2b')](_0x3e1486[_0x5d08('0x3a')]);})[_0x5d08('0x3b')]();}exports[_0x5d08('0x3c')]=function(_0x474241,_0x1677ef){var _0x558590={},_0x34cda5={'count':0x0,'rows':[]};var _0x24fd89=getUserAttributes();_0x558590=qs[_0x5d08('0x3d')](_0x24fd89,_0x474241);var _0x30214f={'where':_0x558590[_0x5d08('0x3e')]};return db[_0x5d08('0x3f')][_0x5d08('0x1b')](_0x30214f)[_0x5d08('0x22')](function(_0x370ebf){_0x34cda5[_0x5d08('0x1b')]=_0x370ebf;if(_0x474241[_0x5d08('0x40')][_0x5d08('0x41')]){_0x558590[_0x5d08('0x42')]=[{'all':!![]}];}if(_0x474241[_0x5d08('0x40')][_0x5d08('0x43')]==='true'){_0x558590[_0x5d08('0x42')]=[{'model':db['UserSetting'],'as':_0x5d08('0x43')}];}if(!_[_0x5d08('0x2b')](_0x558590[_0x5d08('0x44')],'id')){_0x558590[_0x5d08('0x44')][_0x5d08('0x45')]('id');}return db[_0x5d08('0x3f')]['findAll'](_0x558590);})[_0x5d08('0x22')](function(_0x1fc39e){_0x34cda5[_0x5d08('0x46')]=_0x1fc39e;if(_0x474241[_0x5d08('0x40')]['openTabs']===_0x5d08('0x47')){var _0x2c400a=[];for(var _0x543aa9=0x0;_0x543aa9<_0x34cda5[_0x5d08('0x46')][_0x5d08('0x48')];_0x543aa9++){_0x2c400a[_0x5d08('0x45')](get_open_tabs('chat',_0x34cda5[_0x5d08('0x46')][_0x543aa9][_0x5d08('0x49')]));_0x2c400a[_0x5d08('0x45')](get_open_tabs(_0x5d08('0x4a'),_0x34cda5[_0x5d08('0x46')][_0x543aa9][_0x5d08('0x49')]));_0x2c400a[_0x5d08('0x45')](get_open_tabs(_0x5d08('0x4b'),_0x34cda5[_0x5d08('0x46')][_0x543aa9][_0x5d08('0x49')]));_0x2c400a[_0x5d08('0x45')](get_open_tabs(_0x5d08('0x4c'),_0x34cda5[_0x5d08('0x46')][_0x543aa9]['dataValues']));_0x2c400a[_0x5d08('0x45')](get_open_tabs(_0x5d08('0x4d'),_0x34cda5[_0x5d08('0x46')][_0x543aa9][_0x5d08('0x49')]));_0x2c400a[_0x5d08('0x45')](get_open_tabs('whatsapp',_0x34cda5[_0x5d08('0x46')][_0x543aa9][_0x5d08('0x49')]));}return Promise['all'](_0x2c400a)[_0x5d08('0x22')](function(){return _0x34cda5;});}else{return _0x34cda5;}})[_0x5d08('0x22')](respondWithFilteredResult(_0x1677ef,_0x558590))[_0x5d08('0x4e')](handleError(_0x1677ef,null));};exports[_0x5d08('0x4f')]=function(_0x3668d5,_0xbb1fa2){var _0x4a5ad3=getUserAttributes();_0x3668d5[_0x5d08('0x40')]['id']=_0x3668d5['params']['id'];var _0x1c2b8c=qs[_0x5d08('0x3d')](_0x4a5ad3,_0x3668d5);if(_0x3668d5['query'][_0x5d08('0x41')]){_0x1c2b8c[_0x5d08('0x42')]=[{'all':!![]}];}if(_0x3668d5[_0x5d08('0x40')][_0x5d08('0x43')]==='true'){_0x1c2b8c[_0x5d08('0x42')]=[{'model':db['UserSetting'],'as':'userSetting'}];}_0x1c2b8c=_[_0x5d08('0x50')]({},_0x1c2b8c,_0x3668d5[_0x5d08('0x51')]);if(!_['includes'](_0x1c2b8c[_0x5d08('0x44')],'id')){_0x1c2b8c[_0x5d08('0x44')][_0x5d08('0x45')]('id');}return db['User'][_0x5d08('0x2c')](_0x1c2b8c)[_0x5d08('0x22')](handleEntityNotFound(_0xbb1fa2,null))[_0x5d08('0x22')](function(_0x33fab2){var _0x40e43d=[];values=_0x33fab2;if(_0x3668d5[_0x5d08('0x40')]['openTabs']==='true'){_0x40e43d['push'](get_open_tabs('chat',_0x33fab2[_0x5d08('0x49')]));_0x40e43d['push'](get_open_tabs(_0x5d08('0x4a'),_0x33fab2[_0x5d08('0x49')]));_0x40e43d[_0x5d08('0x45')](get_open_tabs(_0x5d08('0x4d'),_0x33fab2[_0x5d08('0x49')]));_0x40e43d['push'](get_open_tabs(_0x5d08('0x52'),_0x33fab2['dataValues']));_0x40e43d['push'](get_open_tabs(_0x5d08('0x4b'),_0x33fab2[_0x5d08('0x49')]));_0x40e43d[_0x5d08('0x45')](get_open_tabs(_0x5d08('0x4c'),_0x33fab2[_0x5d08('0x49')]));return Promise[_0x5d08('0x53')](_0x40e43d);}else{return values;}})[_0x5d08('0x22')](function(){return values;})[_0x5d08('0x22')](respondWithResult(_0xbb1fa2,null))[_0x5d08('0x4e')](handleError(_0xbb1fa2,null));};exports[_0x5d08('0x1d')]=function(_0x243d86,_0x747971){if(_0x243d86['body']['id']){delete _0x243d86[_0x5d08('0x54')]['id'];}delete _0x243d86[_0x5d08('0x54')][_0x5d08('0x1e')];return db[_0x5d08('0x3f')][_0x5d08('0x2c')]({'where':{'id':_0x243d86[_0x5d08('0x55')]['id']}})[_0x5d08('0x22')](handleEntityNotFound(_0x747971,null))['then'](saveUpdates(_0x243d86[_0x5d08('0x54')],null))['then'](respondWithResult(_0x747971,null))[_0x5d08('0x4e')](handleError(_0x747971,null));};exports[_0x5d08('0x56')]=function(_0x46072f,_0x2efabf){return db[_0x5d08('0x3f')]['describe']()['then'](respondWithResult(_0x2efabf,null))[_0x5d08('0x4e')](handleError(_0x2efabf,null));};exports['addContacts']=function(_0x14ab34,_0x3763ba){return db[_0x5d08('0x3f')][_0x5d08('0x2c')]({'where':{'id':_0x14ab34[_0x5d08('0x55')]['id']}})[_0x5d08('0x22')](handleEntityNotFound(_0x3763ba,null))[_0x5d08('0x22')](function(_0x300d64){if(_0x300d64){return _0x300d64[_0x5d08('0x57')](_0x14ab34[_0x5d08('0x54')][_0x5d08('0x58')],_['omit'](_0x14ab34[_0x5d08('0x54')],[_0x5d08('0x58'),'id'])||{});}})[_0x5d08('0x22')](respondWithResult(_0x3763ba,null))[_0x5d08('0x4e')](handleError(_0x3763ba,null));};function validateUser(_0x2056c2){return new Promise(function(_0x11b09c,_0x33ffc8){if(_0x2056c2['internal'])return _0x11b09c(_0x2056c2);return db[_0x5d08('0x59')][_0x5d08('0x5a')](0x1)[_0x5d08('0x22')](function(_0x22766c){if(_0x22766c[_0x5d08('0x5b')])authService['validatePasswordPattern'](_0x2056c2['password']);db[_0x5d08('0x3f')][_0x5d08('0x5c')](_0x5d08('0x5d'))[_0x5d08('0x22')](function(_0x3674ef){if(_[_0x5d08('0x5e')](_0x3674ef)){_0x2056c2[_0x5d08('0x5d')]=_0x22766c[_0x5d08('0x5f')]||0x1;return;}if(_[_0x5d08('0x5e')](_0x22766c['min_internal'])||_0x22766c[_0x5d08('0x5f')]===_0x3674ef){_0x2056c2['internal']=_0x3674ef+0x1;return;}if(_0x22766c[_0x5d08('0x5f')]>_0x3674ef){_0x2056c2['internal']=_0x22766c[_0x5d08('0x5f')];return;}return db[_0x5d08('0x60')][_0x5d08('0x40')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db['sequelize'][_0x5d08('0x61')]['SELECT']})[_0x5d08('0x22')](function(_0x44661d){if(_0x44661d&&_0x44661d[_0x5d08('0x48')]){for(var _0x2129ef=0x0,_0x394578=_0x44661d['length'];_0x2129ef<_0x394578&&_[_0x5d08('0x5e')](_0x2056c2['internal']);_0x2129ef++){if(_0x22766c[_0x5d08('0x5f')]<=_0x44661d[_0x2129ef][_0x5d08('0x62')]){_0x2056c2[_0x5d08('0x5d')]=_0x44661d[_0x2129ef][_0x5d08('0x62')];}else if(_0x22766c[_0x5d08('0x5f')]>_0x44661d[_0x2129ef][_0x5d08('0x62')]&&_0x22766c[_0x5d08('0x5f')]<=_0x44661d[_0x2129ef]['to']){_0x2056c2[_0x5d08('0x5d')]=_0x22766c[_0x5d08('0x5f')];}}}if(_[_0x5d08('0x5e')](_0x2056c2[_0x5d08('0x5d')])){_0x2056c2[_0x5d08('0x5d')]=_0x3674ef+0x1;}return _0x11b09c(_0x2056c2);});});})[_0x5d08('0x4e')](function(_0x3244cc){_0x33ffc8(_0x3244cc);});});}function updateUser(_0x3914ab){return new Promise(function(_0x16cbec,_0xd5ceef){try{if(_0x3914ab[_0x5d08('0x63')]){_0x3914ab[_0x5d08('0x64')]=_0x3914ab[_0x5d08('0x5d')];_0x3914ab[_0x5d08('0x65')]={'mailbox':_0x3914ab['internal'],'password':_0x3914ab['password'],'fullname':_0x3914ab[_0x5d08('0x66')],'email':_0x3914ab[_0x5d08('0x67')]};}if(_0x3914ab[_0x5d08('0x1e')]===_0x5d08('0x1f')){if(!_0x3914ab['permissions'])_0x3914ab[_0x5d08('0x68')]=[_0x5d08('0x69'),'102',_0x5d08('0x6a'),_0x5d08('0x6b'),_0x5d08('0x6c'),_0x5d08('0x6d'),_0x5d08('0x6e'),_0x5d08('0x6f'),'107','108',_0x5d08('0x70'),'100',_0x5d08('0x71'),_0x5d08('0x72'),_0x5d08('0x73')];}_0x16cbec(_0x3914ab);}catch(_0x5c7d8a){_0xd5ceef(_0x5c7d8a);}});}exports[_0x5d08('0x74')]=function(_0x5e99cd,_0x173a76){if(_0x5e99cd[_0x5d08('0x26')][_0x5d08('0x1e')]===_0x5d08('0x1f'))throw new Error(_0x5d08('0x75'));if(_0x5e99cd[_0x5d08('0x54')][_0x5d08('0x1e')]===_0x5d08('0x26')&&_0x5e99cd[_0x5d08('0x26')][_0x5d08('0x1e')]!==_0x5d08('0x24')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x5e99cd[_0x5d08('0x54')][_0x5d08('0x1e')]===_0x5d08('0x24')&&_0x5e99cd[_0x5d08('0x26')][_0x5d08('0x1e')]!==_0x5d08('0x24')){throw new Error(_0x5d08('0x76'));}return licenseUtil['checkUserLimits']([_0x5e99cd[_0x5d08('0x54')]])[_0x5d08('0x22')](function(){return validateUser(_0x5e99cd['body']);})['then'](function(_0x257b17){return updateUser(_0x257b17)['then'](function(_0x50b116){if(_0x50b116[_0x5d08('0x1e')]==='admin'){_0x50b116['settingsEnabled']=_0x5e99cd[_0x5d08('0x26')]['settingsEnabled'];delete _0x50b116[_0x5d08('0x77')];}return _0x50b116;});})['then'](function(_0x2cd35c){return db[_0x5d08('0x3f')]['create'](_0x2cd35c,{'include':[{'model':db[_0x5d08('0x65')],'as':_0x5d08('0x65')}]});})[_0x5d08('0x22')](function(_0x119f0f){if(_0x5e99cd['body']['role']===_0x5d08('0x26'))return _0x119f0f;if(_0x5e99cd[_0x5d08('0x26')][_0x5d08('0x1e')]!==_0x5d08('0x26'))return _0x119f0f;return db['UserProfileSection']['find']({'where':{'name':_0x119f0f[_0x5d08('0x1e')]===_0x5d08('0x1f')?_0x5d08('0x78'):_0x5d08('0x27'),'userProfileId':_0x5e99cd[_0x5d08('0x26')][_0x5d08('0x77')]},'raw':!![]})[_0x5d08('0x22')](function(_0x3d9693){if(!_0x3d9693||_0x3d9693[_0x5d08('0x79')]!=0x0)return _0x119f0f;return db[_0x5d08('0x7a')][_0x5d08('0x74')]({'name':_0x119f0f[_0x5d08('0x3a')],'resourceId':_0x119f0f['id'],'type':_0x3d9693[_0x5d08('0x3a')],'sectionId':_0x3d9693['id']},{})[_0x5d08('0x22')](function(){return _0x119f0f;});})[_0x5d08('0x4e')](function(_0x376e28){logger[_0x5d08('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x376e28);throw _0x376e28;});})['then'](respondWithResult(_0x173a76,0xc9))[_0x5d08('0x4e')](handleError(_0x173a76,null));};exports[_0x5d08('0x7b')]=function(_0x2c495b,_0x29d467){var _0x50887d=_0x2c495b[_0x5d08('0x54')];var _0x38019f=[];if(_0x2c495b[_0x5d08('0x26')]['role']==='agent')throw new Error('Unauthorized');if(_[_0x5d08('0x7c')](_0x50887d,[_0x5d08('0x1e'),'user'])&&_0x2c495b['user'][_0x5d08('0x1e')]!==_0x5d08('0x24')){throw new Error(_0x5d08('0x7d'));}if(_['some'](_0x50887d,['role','admin'])&&_0x2c495b[_0x5d08('0x26')]['role']!==_0x5d08('0x24')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x5d08('0x7e')](_0x50887d)[_0x5d08('0x22')](function(){return validateUser(_0x50887d[0x0]);})[_0x5d08('0x22')](function(){for(var _0x2f29df=0x1;_0x2f29df<_0x50887d[_0x5d08('0x48')];_0x2f29df++){var _0x4f6b4a=_0x50887d[_0x2f29df-0x1]['internal'];if(!_0x50887d[_0x2f29df][_0x5d08('0x5d')])_0x50887d[_0x2f29df][_0x5d08('0x5d')]=_0x4f6b4a+0x1;_0x38019f[_0x5d08('0x45')](validateUser(_0x50887d[_0x2f29df]));}return Promise[_0x5d08('0x53')](_0x38019f);})[_0x5d08('0x22')](function(){_0x38019f=[];for(var _0x531784=0x0;_0x531784<_0x50887d[_0x5d08('0x48')];_0x531784++){_0x38019f[_0x5d08('0x45')](updateUser(_0x50887d[_0x531784]));}return Promise[_0x5d08('0x53')](_0x38019f);})[_0x5d08('0x22')](function(){_0x38019f=_0x50887d[_0x5d08('0x2a')](function(_0x3fe215){return db[_0x5d08('0x3f')][_0x5d08('0x74')](_0x3fe215,{'include':[{'model':db[_0x5d08('0x65')],'as':_0x5d08('0x65')}]})[_0x5d08('0x22')](function(_0x34c9b1){_0x3fe215['id']=_0x34c9b1['id'];return _0x3fe215;});});return Promise['all'](_0x38019f);})['then'](function(_0x2cfe63){if(_0x2c495b[_0x5d08('0x54')][_0x5d08('0x1e')]===_0x5d08('0x26'))return _0x2cfe63;if(_0x2c495b[_0x5d08('0x26')]['role']!==_0x5d08('0x26'))return _0x2cfe63;var _0x52ae10=_[_0x5d08('0x7c')](_0x2cfe63,function(_0x14adef){return _0x14adef[_0x5d08('0x1e')]===_0x5d08('0x1f')||_0x14adef[_0x5d08('0x1e')]===_0x5d08('0x28');});if(!_0x52ae10)return _0x2cfe63;return db[_0x5d08('0x7f')][_0x5d08('0x80')]({'where':{'name':{'$or':[_0x5d08('0x78'),_0x5d08('0x27')]},'userProfileId':_0x2c495b[_0x5d08('0x26')][_0x5d08('0x77')]},'raw':!![]})[_0x5d08('0x22')](function(_0x210f00){if(_[_0x5d08('0x81')](_0x210f00)||!_[_0x5d08('0x7c')](_0x210f00,[_0x5d08('0x79'),0x0]))return _0x2cfe63;_0x38019f=[];var _0x591b63=_(_0x210f00)[_0x5d08('0x2a')](function(_0x41b0ba){if(_0x41b0ba[_0x5d08('0x79')]===0x1)return;return _0x41b0ba[_0x5d08('0x3a')]==='Agents'?_0x5d08('0x1f'):'telephone';})['compact']()[_0x5d08('0x3b')]();for(var _0x3491dc=0x0;_0x3491dc<_0x2cfe63[_0x5d08('0x48')];_0x3491dc++){if(!_[_0x5d08('0x2b')](_0x591b63,_0x2cfe63[_0x3491dc]['role']))return;var _0x3f0bb9=_0x2cfe63[_0x3491dc]['role']==='agent'?_0x5d08('0x78'):_0x5d08('0x27');_0x38019f[_0x5d08('0x45')](db['UserProfileResource']['create']({'name':_0x2cfe63[_0x3491dc]['name'],'resourceId':_0x2cfe63[_0x3491dc]['id'],'type':_0x3f0bb9,'sectionId':_[_0x5d08('0x2c')](_0x210f00,[_0x5d08('0x3a'),_0x3f0bb9])['id']},{}));}return Promise[_0x5d08('0x53')](_0x38019f);});})[_0x5d08('0x22')](respondWithResult(_0x29d467,0xc9))[_0x5d08('0x4e')](handleError(_0x29d467,null));};exports['changePassword']=function(_0x93e861,_0x15ba51){if(_0x93e861[_0x5d08('0x54')]['id']){delete _0x93e861['body']['id'];}return db['User']['find']({'where':{'id':_0x93e861[_0x5d08('0x55')]['id']}})['then'](function(_0x41ea41){if(!_0x41ea41)return null;if(_0x41ea41['id']===_0x93e861[_0x5d08('0x26')]['id']){if(!_0x93e861[_0x5d08('0x54')][_0x5d08('0x82')]||!_0x93e861['body'][_0x5d08('0x83')]){throw new db[(_0x5d08('0x84'))][(_0x5d08('0x85'))](_0x5d08('0x86'));}if(!_0x41ea41[_0x5d08('0x87')](_0x93e861[_0x5d08('0x54')][_0x5d08('0x82')])){throw new db[(_0x5d08('0x84'))][(_0x5d08('0x85'))](_0x5d08('0x88'));}if(_0x93e861[_0x5d08('0x54')][_0x5d08('0x82')]===_0x93e861[_0x5d08('0x54')][_0x5d08('0x83')]){throw new db[(_0x5d08('0x84'))][(_0x5d08('0x85'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x93e861[_0x5d08('0x26')][_0x5d08('0x1e')]==='admin'){if(!_0x93e861[_0x5d08('0x54')]['newPassword']){throw new db[(_0x5d08('0x84'))][(_0x5d08('0x85'))](_0x5d08('0x89'));}}else if(_0x93e861['user'][_0x5d08('0x1e')]==='user'){if(!_0x93e861[_0x5d08('0x54')][_0x5d08('0x83')]){throw new db['Sequelize'][(_0x5d08('0x85'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x41ea41[_0x5d08('0x1e')]!==_0x5d08('0x1f')){throw new db[(_0x5d08('0x84'))][(_0x5d08('0x85'))](_0x5d08('0x75'));}}else{throw new db[(_0x5d08('0x84'))][(_0x5d08('0x85'))](_0x5d08('0x75'));}return _0x41ea41;})[_0x5d08('0x22')](handleEntityNotFound(_0x15ba51,null))['then'](function(_0x123f04){return db[_0x5d08('0x59')]['findOne']({'attributes':['id',_0x5d08('0x5b'),'enforcePasswordHistory',_0x5d08('0x8a')]})['then'](function(_0x1b74aa){if(_0x1b74aa['securePassword'])authService['validatePasswordPattern'](_0x93e861['body']['newPassword']);if(!_0x1b74aa[_0x5d08('0x8b')]||!_0x123f04[_0x5d08('0x36')])return _0x123f04;authService['validatePasswordHistory'](_0x93e861[_0x5d08('0x54')][_0x5d08('0x83')],_0x123f04[_0x5d08('0x36')],_0x1b74aa[_0x5d08('0x8a')]);return _0x123f04;})[_0x5d08('0x22')](saveUpdates({'password':_0x93e861[_0x5d08('0x54')][_0x5d08('0x83')],'passwordResetAt':_0x93e861[_0x5d08('0x26')]['id']==_0x93e861[_0x5d08('0x55')]['id']?moment():null,'previousPasswords':authService[_0x5d08('0x8c')](_0x93e861[_0x5d08('0x54')][_0x5d08('0x83')],_0x123f04[_0x5d08('0x36')])},null));})[_0x5d08('0x22')](respondWithResult(_0x15ba51,null))[_0x5d08('0x4e')](handleError(_0x15ba51,null));};exports[_0x5d08('0x8d')]=function(_0x4ecfbc,_0x2c48c2){var _0x5dc7d3=_0x4ecfbc[_0x5d08('0x54')][_0x5d08('0x8e')];return db['User'][_0x5d08('0x2c')]({'where':{'id':_0x4ecfbc[_0x5d08('0x55')]['id']},'attributes':['id',_0x5d08('0x3a'),_0x5d08('0x1e'),_0x5d08('0x8f'),_0x5d08('0x90'),_0x5d08('0x91'),_0x5d08('0x92')]})[_0x5d08('0x22')](handleEntityNotFound(_0x2c48c2,null))[_0x5d08('0x22')](function(_0x4754f2){if(_0x4754f2){if(!utils['isValidChannel'](_0x5dc7d3)){throw new db['Sequelize'][(_0x5d08('0x85'))](_0x5d08('0x93'));}return _0x4754f2['add'+_[_0x5d08('0x94')](_0x5dc7d3[_0x5d08('0x95')]())+'Queues'](_0x4ecfbc[_0x5d08('0x54')]['ids'],{'penalty':_0x4ecfbc[_0x5d08('0x54')][_0x5d08('0x96')]||0x0})[_0x5d08('0x97')](function(_0x1fdec6){for(var _0x8b0f15=0x0;_0x8b0f15<_0x4ecfbc[_0x5d08('0x54')][_0x5d08('0x58')]['length'];_0x8b0f15+=0x1){var _0x3225f3={'UserId':Number(_0x4ecfbc[_0x5d08('0x55')]['id'])};_0x3225f3[_[_0x5d08('0x94')](_0x5dc7d3[_0x5d08('0x95')]())+_0x5d08('0x98')]=Number(_0x4ecfbc[_0x5d08('0x54')]['ids'][_0x8b0f15]);socket[_0x5d08('0x20')]('user'+_['capitalize'](_0x5dc7d3[_0x5d08('0x95')]())+_0x5d08('0x99'),_0x3225f3);}return _0x1fdec6;})['then'](function(){if(_0x5dc7d3===_0x5d08('0x9a')){return db[_0x5d08('0x9b')]['findAll']({'where':{'id':_0x4ecfbc[_0x5d08('0x54')]['ids']||[]},'raw':!![],'attributes':['id',_0x5d08('0x3a')]});}})[_0x5d08('0x22')](function(_0x2efd16){var _0x27eb9e=_0x4754f2[_0x5d08('0x23')]({'plain':!![]});var _0x342f51=[];if(_0x5dc7d3===_0x5d08('0x9a')&&_0x27eb9e[_0x5d08('0x1e')]===_0x5d08('0x1f')&&_0x27eb9e[_0x5d08('0x8f')]){for(let _0x365a7b=0x0;_0x365a7b<_0x2efd16[_0x5d08('0x48')];_0x365a7b+=0x1){_0x342f51[_0x5d08('0x45')]({'membername':_0x27eb9e[_0x5d08('0x3a')],'UserId':_0x27eb9e['id'],'queue_name':_0x2efd16[_0x365a7b][_0x5d08('0x3a')],'VoiceQueueId':_0x2efd16[_0x365a7b]['id'],'interface':_[_0x5d08('0x5e')](_0x27eb9e[_0x5d08('0x92')])?util[_0x5d08('0x9c')](_0x5d08('0x9d'),_0x27eb9e[_0x5d08('0x3a')]):_0x27eb9e[_0x5d08('0x92')],'paused':_0x27eb9e[_0x5d08('0x91')]||![],'penalty':_0x4ecfbc[_0x5d08('0x54')][_0x5d08('0x96')]||0x0});}return Promise[_0x5d08('0x53')](_0x342f51['map'](function(_0x233500){return db[_0x5d08('0x9e')][_0x5d08('0x9f')](_0x233500);}));}return _0x4754f2;});}})[_0x5d08('0x22')](respondWithStatusCode(_0x2c48c2,null))[_0x5d08('0x4e')](handleError(_0x2c48c2,null));};exports[_0x5d08('0xa0')]=function(_0x4aacce,_0x3d2e16){var _0x322489,_0x4b8bce;return db['User']['find']({'where':{'id':_0x4aacce[_0x5d08('0x55')]['id']},'attributes':['id','name',_0x5d08('0x1e')]})['then'](handleEntityNotFound(_0x3d2e16,null))[_0x5d08('0x22')](function(_0x7778ce){if(_0x7778ce){_0x322489=_0x7778ce;if(!_0x4aacce[_0x5d08('0x40')][_0x5d08('0x8e')]||!utils[_0x5d08('0xa1')](_0x4aacce[_0x5d08('0x40')]['channel'])){throw new db[(_0x5d08('0x84'))][(_0x5d08('0x85'))]('Unknown\x20channel');}return _0x7778ce['remove'+_['capitalize'](_0x4aacce[_0x5d08('0x40')][_0x5d08('0x8e')][_0x5d08('0x95')]())+_0x5d08('0xa2')](_0x4aacce[_0x5d08('0x40')][_0x5d08('0x58')]);}})['then'](function(_0x4c24f8){if(_[_0x5d08('0xa3')](_0x4aacce['query'][_0x5d08('0x58')])){for(var _0x22e9d1=0x0;_0x22e9d1<_0x4aacce[_0x5d08('0x40')][_0x5d08('0x58')]['length'];_0x22e9d1+=0x1){_0x4b8bce={'UserId':Number(_0x4aacce[_0x5d08('0x55')]['id'])};_0x4b8bce[_[_0x5d08('0x94')](_0x4aacce[_0x5d08('0x40')]['channel'][_0x5d08('0x95')]())+_0x5d08('0x98')]=Number(_0x4aacce[_0x5d08('0x40')]['ids'][_0x22e9d1]);socket[_0x5d08('0x20')](_0x5d08('0x26')+_['capitalize'](_0x4aacce[_0x5d08('0x40')][_0x5d08('0x8e')]['toLowerCase']())+_0x5d08('0xa4'),_0x4b8bce);}}else{_0x4b8bce={'UserId':Number(_0x4aacce[_0x5d08('0x55')]['id'])};_0x4b8bce[_[_0x5d08('0x94')](_0x4aacce[_0x5d08('0x40')][_0x5d08('0x8e')][_0x5d08('0x95')]())+_0x5d08('0x98')]=Number(_0x4aacce['query']['ids']);socket[_0x5d08('0x20')]('user'+_['capitalize'](_0x4aacce[_0x5d08('0x40')][_0x5d08('0x8e')]['toLowerCase']())+_0x5d08('0xa4'),_0x4b8bce);}return _0x4c24f8;})[_0x5d08('0x22')](function(){if(_0x4aacce[_0x5d08('0x40')][_0x5d08('0x8e')]===_0x5d08('0x9a')){return db[_0x5d08('0x9e')][_0x5d08('0x2d')]({'where':{'UserId':_0x4aacce[_0x5d08('0x55')]['id'],'VoiceQueueId':_0x4aacce['query']['ids']},'individualHooks':!![]})[_0x5d08('0x22')](function(){return _0x322489;});}return _0x322489;})[_0x5d08('0x22')](respondWithStatusCode(_0x3d2e16,null))['catch'](handleError(_0x3d2e16,null));};exports['addAvatar']=function(_0x176145,_0x1105bf){_0x176145[_0x5d08('0x54')][_0x5d08('0xa5')]=_0x176145[_0x5d08('0xa6')][_0x5d08('0xa7')];return db[_0x5d08('0x3f')][_0x5d08('0x2c')]({'where':{'id':_0x176145[_0x5d08('0x55')]['id']}})['then'](handleEntityNotFound(_0x1105bf,null))[_0x5d08('0x22')](saveUpdates(_0x176145[_0x5d08('0x54')],null))[_0x5d08('0x22')](respondWithResult(_0x1105bf,null))[_0x5d08('0x4e')](handleError(_0x1105bf,null));};exports[_0x5d08('0xa8')]=function(_0x3e307f,_0x329e8c){var _0x29c2a7=path[_0x5d08('0xa9')](config[_0x5d08('0xaa')],_0x5d08('0xab'));return db[_0x5d08('0x3f')][_0x5d08('0x2c')]({'where':{'id':_0x3e307f[_0x5d08('0x55')]['id']},'attributes':['id',_0x5d08('0xa5')],'raw':!![]})[_0x5d08('0x22')](handleEntityNotFound(_0x329e8c,null))[_0x5d08('0x22')](function(_0x2acaea){if(_0x2acaea){if(_[_0x5d08('0x5e')](_0x2acaea[_0x5d08('0xa5')])){return _0x329e8c[_0x5d08('0xac')](_0x29c2a7);}else{if(!fs[_0x5d08('0xad')](path['join'](config['root'],_0x5d08('0xae'),_0x2acaea[_0x5d08('0xa5')]))){return _0x329e8c[_0x5d08('0xac')](_0x29c2a7);}return _0x329e8c[_0x5d08('0xac')](path['join'](config[_0x5d08('0xaa')],_0x5d08('0xae'),_0x2acaea[_0x5d08('0xa5')]));}}})[_0x5d08('0x4e')](handleError(_0x329e8c,null));};exports['getOpenTabs']=function(_0x181665,_0x4ec939){return db[_0x5d08('0x3f')]['find']({'where':{'id':_0x181665[_0x5d08('0x55')]['id']},'attributes':['id']})[_0x5d08('0x22')](handleEntityNotFound(_0x4ec939,null))[_0x5d08('0x22')](function(_0x38cc58){var _0x50c0a3=[];values=_0x38cc58[_0x5d08('0x49')];_0x50c0a3[_0x5d08('0x45')](get_open_tabs(_0x5d08('0xaf'),_0x38cc58[_0x5d08('0x49')]));_0x50c0a3[_0x5d08('0x45')](get_open_tabs(_0x5d08('0x4a'),_0x38cc58[_0x5d08('0x49')]));_0x50c0a3[_0x5d08('0x45')](get_open_tabs(_0x5d08('0x4d'),_0x38cc58[_0x5d08('0x49')]));_0x50c0a3['push'](get_open_tabs(_0x5d08('0x52'),_0x38cc58['dataValues']));_0x50c0a3[_0x5d08('0x45')](get_open_tabs(_0x5d08('0x4b'),_0x38cc58[_0x5d08('0x49')]));_0x50c0a3[_0x5d08('0x45')](get_open_tabs(_0x5d08('0x4c'),_0x38cc58[_0x5d08('0x49')]));return Promise[_0x5d08('0x53')](_0x50c0a3);})[_0x5d08('0x22')](function(_0x3e55a7){if(_0x3e55a7){var _0x17442b=_[_0x5d08('0x2a')](values[_0x5d08('0xb0')],function(_0x5229d4){return{'channel':'CHAT','id':_0x5229d4['id'],'createdAt':_0x5229d4[_0x5d08('0xb1')]};});var _0x5ec631=_[_0x5d08('0x2a')](values[_0x5d08('0xb2')],function(_0x22adc4){return{'channel':_0x5d08('0xb3'),'id':_0x22adc4['id'],'createdAt':_0x22adc4['createdAt']};});var _0x5a07e2=_[_0x5d08('0x2a')](values[_0x5d08('0xb4')],function(_0x200408){return{'channel':_0x5d08('0xb5'),'id':_0x200408['id'],'createdAt':_0x200408['createdAt']};});var _0x4c28c4=_[_0x5d08('0x2a')](values[_0x5d08('0xb6')],function(_0xef1052){return{'channel':_0x5d08('0xb7'),'id':_0xef1052['id'],'createdAt':_0xef1052[_0x5d08('0xb1')]};});var _0xbe5703=_['map'](values['SmsOpenTabs'],function(_0x1f8861){return{'channel':_0x5d08('0xb8'),'id':_0x1f8861['id'],'createdAt':_0x1f8861[_0x5d08('0xb1')]};});var _0x274a6f=_[_0x5d08('0x2a')](values[_0x5d08('0xb9')],function(_0x5ae83a){return{'channel':_0x5d08('0xba'),'id':_0x5ae83a['id'],'createdAt':_0x5ae83a[_0x5d08('0xb1')]};});var _0x5b0533=_[_0x5d08('0xbb')](_0x17442b,_0x5ec631,_0x5a07e2,_0x4c28c4,_0xbe5703,_0x274a6f);var _0x579f84={'count':_0x5b0533[_0x5d08('0x48')],'rows':_0x5b0533};return _0x579f84;}else return null;})[_0x5d08('0x22')](respondWithResult(_0x4ec939,null))['catch'](handleError(_0x4ec939,null));};exports[_0x5d08('0xbc')]=function(_0x3b9b04,_0x5c8b19){var _0x3c05d5={};return db[_0x5d08('0x3f')][_0x5d08('0xbd')]({'where':{'id':_0x3b9b04[_0x5d08('0x55')]['id']}})['then'](function(_0x569d59){if(!_0x569d59){throw new APINotFoundError(util[_0x5d08('0x9c')]('User\x20with\x20id\x20%s\x20not\x20found',_0x3b9b04[_0x5d08('0x55')]['id']));}return contacts['describe']();})[_0x5d08('0x22')](function(_0x47bd65){_0x3b9b04[_0x5d08('0x40')][_0x5d08('0x3f')]=_0x3b9b04[_0x5d08('0x55')]['id'];_0x3c05d5=qs[_0x5d08('0x3d')](_0x47bd65,_0x3b9b04);if(_0x3b9b04[_0x5d08('0x40')][_0x5d08('0xbe')](_0x5d08('0x41'))){_0x3c05d5['include']=[{'model':db[_0x5d08('0xbf')],'as':_0x5d08('0xc0'),'required':![]},{'model':db[_0x5d08('0xc1')],'as':'Tags','attributes':['id',_0x5d08('0x3a'),_0x5d08('0xc2')],'where':_0x3b9b04['query'][_0x5d08('0xc3')]?{'id':_0x3b9b04[_0x5d08('0x40')]['tag']}:undefined,'required':_0x3b9b04[_0x5d08('0x40')][_0x5d08('0xc3')]?!![]:![]}];}return contacts[_0x5d08('0x80')](_0x3b9b04['query'],_0x3b9b04[_0x5d08('0x26')],_0x3c05d5,_0x47bd65);})[_0x5d08('0x22')](respondWithFilteredResult(_0x5c8b19,_0x3c05d5))[_0x5d08('0x4e')](APIHandleError(_0x5c8b19));};exports['getQueues']=function(_0x52090f,_0x390b19){var _0x4e28c0;var _0x5a85b6={};var _0x4c248b;return db[_0x5d08('0x3f')][_0x5d08('0xbd')]({'where':{'id':_0x52090f['params']['id']},'attributes':['id','name','role']})['then'](handleEntityNotFound(_0x390b19,null))[_0x5d08('0x22')](function(_0x240817){if(!utils[_0x5d08('0xa1')](_0x52090f[_0x5d08('0x40')]['channel'])){throw new db[(_0x5d08('0x84'))][(_0x5d08('0x85'))](_0x5d08('0x93'));}_0x4e28c0=_0x240817;var _0x52462a={};_0x52462a[_0x5d08('0xc4')]=_[_0x5d08('0xc5')](db[_['capitalize'](_0x52090f['query'][_0x5d08('0x8e')])+'Queue'][_0x5d08('0x31')]);_0x52462a[_0x5d08('0x40')]=_[_0x5d08('0xc5')](_0x52090f[_0x5d08('0x40')]);_0x52462a[_0x5d08('0xc6')]=_[_0x5d08('0xc7')](_0x52462a[_0x5d08('0xc4')],_0x52462a[_0x5d08('0x40')]);_0x5a85b6[_0x5d08('0x44')]=_[_0x5d08('0xc7')](_0x52462a['model'],qs['fields'](_0x52090f[_0x5d08('0x40')]['fields']));_0x5a85b6[_0x5d08('0x44')]=_0x5a85b6[_0x5d08('0x44')][_0x5d08('0x48')]?_0x5a85b6['attributes']:_0x52462a[_0x5d08('0xc4')];_0x5a85b6[_0x5d08('0xc8')]=qs[_0x5d08('0xc9')](_0x52090f[_0x5d08('0x40')][_0x5d08('0xc9')]);_0x5a85b6[_0x5d08('0x3e')]=qs['filters'](_[_0x5d08('0xca')](_0x52090f['query'],_0x52462a[_0x5d08('0xc6')]));if(_0x52090f['query']['filter']){_0x5a85b6[_0x5d08('0x3e')]=_[_0x5d08('0x50')](_0x5a85b6[_0x5d08('0x3e')],{'$or':_[_0x5d08('0x2a')](_0x5a85b6['attributes'],function(_0x42a74b){var _0x42703d={};_0x42703d[_0x42a74b]={'$like':'%'+_0x52090f[_0x5d08('0x40')][_0x5d08('0x34')]+'%'};return _0x42703d;})});}_0x5a85b6=_[_0x5d08('0x50')]({},_0x5a85b6,_0x52090f[_0x5d08('0x51')]);switch(_0x4e28c0[_0x5d08('0x1e')]){case _0x5d08('0x24'):return db[_['capitalize'](_0x52090f['query'][_0x5d08('0x8e')])+'Queue']['findAll'](_0x5a85b6);case'user':case _0x5d08('0x1f'):return _0x4e28c0[_0x5d08('0x23')+_[_0x5d08('0x94')](_0x52090f[_0x5d08('0x40')]['channel'])+_0x5d08('0xa2')](_0x5a85b6);default:throw new db[(_0x5d08('0x84'))]['ValidationError'](_0x5d08('0xcb'));}})[_0x5d08('0x22')](function(_0x48244f){_0x4c248b=_0x48244f[_0x5d08('0x48')];if(!_0x52090f[_0x5d08('0x40')]['hasOwnProperty'](_0x5d08('0xcc'))){_0x5a85b6[_0x5d08('0x1a')]=qs[_0x5d08('0x1a')](_0x52090f[_0x5d08('0x40')][_0x5d08('0x1a')]);_0x5a85b6[_0x5d08('0x18')]=qs[_0x5d08('0x18')](_0x52090f[_0x5d08('0x40')][_0x5d08('0x18')]);}switch(_0x4e28c0[_0x5d08('0x1e')]){case _0x5d08('0x24'):return db[_[_0x5d08('0x94')](_0x52090f[_0x5d08('0x40')][_0x5d08('0x8e')])+_0x5d08('0xcd')][_0x5d08('0x80')](_0x5a85b6);case _0x5d08('0x26'):case _0x5d08('0x1f'):return _0x4e28c0[_0x5d08('0x23')+_[_0x5d08('0x94')](_0x52090f[_0x5d08('0x40')][_0x5d08('0x8e')])+_0x5d08('0xa2')](_0x5a85b6);}})['then'](function(_0x25c6f9){return{'count':_0x4c248b,'rows':_0x25c6f9};})[_0x5d08('0x22')](respondWithResult(_0x390b19,null))[_0x5d08('0x4e')](handleError(_0x390b19,null));};exports[_0x5d08('0xce')]=function(_0x759aa7,_0x291c35){var _0x278f51={};var _0x30e3cf={};var _0x81072d;var _0x4c11bb;return db[_0x5d08('0x3f')][_0x5d08('0xbd')]({'where':{'id':_0x759aa7[_0x5d08('0x55')]['id']}})['then'](handleEntityNotFound(_0x291c35,null))['then'](function(_0x1a07d4){if(_0x1a07d4){_0x81072d=_0x1a07d4;_0x30e3cf[_0x5d08('0xc4')]=_[_0x5d08('0xc5')](db[_0x5d08('0x9e')][_0x5d08('0x31')]);_0x30e3cf[_0x5d08('0x40')]=_[_0x5d08('0xc5')](_0x759aa7[_0x5d08('0x40')]);_0x30e3cf[_0x5d08('0xc6')]=_[_0x5d08('0xc7')](_0x30e3cf['model'],_0x30e3cf[_0x5d08('0x40')]);_0x278f51[_0x5d08('0x44')]=_['intersection'](_0x30e3cf[_0x5d08('0xc4')],qs[_0x5d08('0xcf')](_0x759aa7[_0x5d08('0x40')][_0x5d08('0xcf')]));_0x278f51['attributes']=_0x278f51['attributes'][_0x5d08('0x48')]?_0x278f51['attributes']:_0x30e3cf[_0x5d08('0xc4')];_0x278f51[_0x5d08('0xc8')]=qs[_0x5d08('0xc9')](_0x759aa7['query'][_0x5d08('0xc9')]);_0x278f51[_0x5d08('0x3e')]=qs[_0x5d08('0xc6')](_[_0x5d08('0xca')](_0x759aa7[_0x5d08('0x40')],_0x30e3cf[_0x5d08('0xc6')]));if(_0x759aa7[_0x5d08('0x40')]['filter']){_0x278f51[_0x5d08('0x3e')]=_[_0x5d08('0x50')](_0x278f51['where'],{'$or':_[_0x5d08('0x2a')](_0x278f51[_0x5d08('0x44')],function(_0x47d33a){var _0x570b8f={};_0x570b8f[_0x47d33a]={'$like':'%'+_0x759aa7[_0x5d08('0x40')][_0x5d08('0x34')]+'%'};return _0x570b8f;})});}_0x278f51=_[_0x5d08('0x50')]({},_0x278f51,_0x759aa7[_0x5d08('0x51')]);return _0x81072d[_0x5d08('0xce')](_0x278f51);}})[_0x5d08('0x22')](function(_0x40730d){if(_0x40730d){_0x4c11bb=_0x40730d[_0x5d08('0x48')];if(!_0x759aa7[_0x5d08('0x40')]['hasOwnProperty'](_0x5d08('0xcc'))){_0x278f51[_0x5d08('0x1a')]=qs[_0x5d08('0x1a')](_0x759aa7[_0x5d08('0x40')][_0x5d08('0x1a')]);_0x278f51[_0x5d08('0x18')]=qs[_0x5d08('0x18')](_0x759aa7['query'][_0x5d08('0x18')]);}return _0x81072d['getVoiceQueuesRt'](_0x278f51);}})[_0x5d08('0x22')](function(_0x10e47e){if(_0x10e47e){return _0x10e47e?{'count':_0x4c11bb,'rows':_0x10e47e}:null;}})[_0x5d08('0x22')](respondWithResult(_0x291c35,null))[_0x5d08('0x4e')](handleError(_0x291c35,null));};exports[_0x5d08('0xd0')]=function(_0x1c14f9,_0x25ab8b){var _0x2043ae={};var _0x200de1={};var _0x460a8e;var _0x15283f;return db[_0x5d08('0x3f')]['findOne']({'where':{'id':_0x1c14f9[_0x5d08('0x55')]['id']}})[_0x5d08('0x22')](handleEntityNotFound(_0x25ab8b,null))[_0x5d08('0x22')](function(_0x146c2b){if(_0x146c2b){_0x460a8e=_0x146c2b;_0x200de1[_0x5d08('0xc4')]=_[_0x5d08('0xc5')](db[_0x5d08('0xd1')][_0x5d08('0x31')]);_0x200de1['query']=_['keys'](_0x1c14f9[_0x5d08('0x40')]);_0x200de1[_0x5d08('0xc6')]=_[_0x5d08('0xc7')](_0x200de1[_0x5d08('0xc4')],_0x200de1[_0x5d08('0x40')]);_0x2043ae['attributes']=_['intersection'](_0x200de1[_0x5d08('0xc4')],qs[_0x5d08('0xcf')](_0x1c14f9[_0x5d08('0x40')][_0x5d08('0xcf')]));_0x2043ae['attributes']=_0x2043ae[_0x5d08('0x44')][_0x5d08('0x48')]?_0x2043ae[_0x5d08('0x44')]:_0x200de1[_0x5d08('0xc4')];_0x2043ae[_0x5d08('0xc8')]=qs[_0x5d08('0xc9')](_0x1c14f9[_0x5d08('0x40')][_0x5d08('0xc9')]);_0x2043ae[_0x5d08('0x3e')]=qs[_0x5d08('0xc6')](_[_0x5d08('0xca')](_0x1c14f9['query'],_0x200de1[_0x5d08('0xc6')]));if(_0x1c14f9[_0x5d08('0x40')][_0x5d08('0x34')]){_0x2043ae[_0x5d08('0x3e')]=_[_0x5d08('0x50')](_0x2043ae['where'],{'$or':_[_0x5d08('0x2a')](_0x2043ae['attributes'],function(_0x2b85bd){var _0x2eb1dc={};_0x2eb1dc[_0x2b85bd]={'$like':'%'+_0x1c14f9[_0x5d08('0x40')]['filter']+'%'};return _0x2eb1dc;})});}_0x2043ae=_['merge']({},_0x2043ae,_0x1c14f9['options']);return _0x460a8e[_0x5d08('0xd0')](_0x2043ae);}})['then'](function(_0x420814){if(_0x420814){_0x15283f=_0x420814[_0x5d08('0x48')];if(!_0x1c14f9[_0x5d08('0x40')][_0x5d08('0xbe')](_0x5d08('0xcc'))){_0x2043ae[_0x5d08('0x1a')]=qs[_0x5d08('0x1a')](_0x1c14f9[_0x5d08('0x40')]['limit']);_0x2043ae['offset']=qs[_0x5d08('0x18')](_0x1c14f9['query'][_0x5d08('0x18')]);}return _0x460a8e[_0x5d08('0xd0')](_0x2043ae);}})[_0x5d08('0x22')](function(_0x564f99){if(_0x564f99){return _0x564f99?{'count':_0x15283f,'rows':_0x564f99}:null;}})[_0x5d08('0x22')](respondWithResult(_0x25ab8b,null))[_0x5d08('0x4e')](handleError(_0x25ab8b,null));};exports[_0x5d08('0xd2')]=function(_0x4008cb,_0x2853ca){var _0x55d2b0={'raw':!![],'where':{}};var _0x47a878={};var _0x9d8683={'count':0x0,'rows':[]};return db[_0x5d08('0x3f')][_0x5d08('0xbd')]({'where':{'id':_0x4008cb[_0x5d08('0x55')]['id']}})[_0x5d08('0x22')](handleEntityNotFound(_0x2853ca,null))[_0x5d08('0x22')](function(_0x3bd999){if(_0x3bd999){_0x47a878['model']=_[_0x5d08('0xc5')](db['VoiceRecording'][_0x5d08('0x31')]);_0x47a878[_0x5d08('0x40')]=_['keys'](_0x4008cb['query']);_0x47a878[_0x5d08('0xc6')]=_[_0x5d08('0xc7')](_0x47a878[_0x5d08('0xc4')],_0x47a878[_0x5d08('0x40')]);_0x55d2b0['attributes']=_[_0x5d08('0xc7')](_0x47a878[_0x5d08('0xc4')],qs['fields'](_0x4008cb['query']['fields']));_0x55d2b0[_0x5d08('0x44')]=_0x55d2b0['attributes'][_0x5d08('0x48')]?_0x55d2b0['attributes']:_0x47a878[_0x5d08('0xc4')];if(!_0x4008cb['query'][_0x5d08('0xbe')]('nolimit')){_0x55d2b0[_0x5d08('0x1a')]=qs['limit'](_0x4008cb[_0x5d08('0x40')]['limit']);_0x55d2b0['offset']=qs[_0x5d08('0x18')](_0x4008cb[_0x5d08('0x40')]['offset']);}_0x55d2b0[_0x5d08('0xc8')]=qs[_0x5d08('0xc9')](_0x4008cb[_0x5d08('0x40')]['sort']);_0x55d2b0[_0x5d08('0x3e')]=qs[_0x5d08('0xc6')](_[_0x5d08('0xca')](_0x4008cb[_0x5d08('0x40')],_0x47a878[_0x5d08('0xc6')]));_0x55d2b0[_0x5d08('0x3e')][_0x5d08('0xd3')]=_0x3bd999['id'];if(_0x4008cb[_0x5d08('0x40')]['filter']){_0x55d2b0[_0x5d08('0x3e')]=_[_0x5d08('0x50')](_0x55d2b0[_0x5d08('0x3e')],{'$or':_[_0x5d08('0x2a')](_0x55d2b0[_0x5d08('0x44')],function(_0x23d156){var _0x1a2aa0={};_0x1a2aa0[_0x23d156]={'$like':'%'+_0x4008cb['query'][_0x5d08('0x34')]+'%'};return _0x1a2aa0;})});}_0x55d2b0=_[_0x5d08('0x50')]({},_0x55d2b0,_0x4008cb[_0x5d08('0x51')]);return db['VoiceRecording'][_0x5d08('0x1b')]({'where':_0x55d2b0[_0x5d08('0x3e')]})[_0x5d08('0x22')](function(_0x480049){_0x9d8683['count']=_0x480049;if(_0x4008cb[_0x5d08('0x40')][_0x5d08('0x41')]){_0x55d2b0['include']=[{'all':!![]}];}return db[_0x5d08('0xd4')][_0x5d08('0x80')](_0x55d2b0);})[_0x5d08('0x22')](function(_0x1bbfc3){_0x9d8683[_0x5d08('0x46')]=_0x1bbfc3;return _0x9d8683;});}})[_0x5d08('0x22')](respondWithFilteredResult(_0x2853ca,_0x55d2b0))['catch'](handleError(_0x2853ca,null));};exports[_0x5d08('0xd5')]=function(_0xfd7a2a,_0x2e6208){var _0x1b82e2={'raw':!![],'where':{}};var _0x2dfa95={};var _0xb6c7b2={'count':0x0,'rows':[]};return db[_0x5d08('0x3f')][_0x5d08('0xbd')]({'where':{'id':_0xfd7a2a[_0x5d08('0x55')]['id']}})['then'](handleEntityNotFound(_0x2e6208,null))[_0x5d08('0x22')](function(_0x52524e){if(_0x52524e){_0x2dfa95['model']=_[_0x5d08('0xc5')](db[_0x5d08('0xd6')][_0x5d08('0x31')]);_0x2dfa95[_0x5d08('0x40')]=_[_0x5d08('0xc5')](_0xfd7a2a[_0x5d08('0x40')]);_0x2dfa95[_0x5d08('0xc6')]=_[_0x5d08('0xc7')](_0x2dfa95[_0x5d08('0xc4')],_0x2dfa95[_0x5d08('0x40')]);_0x1b82e2[_0x5d08('0x44')]=_[_0x5d08('0xc7')](_0x2dfa95['model'],qs[_0x5d08('0xcf')](_0xfd7a2a[_0x5d08('0x40')][_0x5d08('0xcf')]));_0x1b82e2['attributes']=_0x1b82e2[_0x5d08('0x44')]['length']?_0x1b82e2[_0x5d08('0x44')]:_0x2dfa95[_0x5d08('0xc4')];if(!_0xfd7a2a['query'][_0x5d08('0xbe')](_0x5d08('0xcc'))){_0x1b82e2['limit']=qs['limit'](_0xfd7a2a[_0x5d08('0x40')][_0x5d08('0x1a')]);_0x1b82e2[_0x5d08('0x18')]=qs['offset'](_0xfd7a2a[_0x5d08('0x40')][_0x5d08('0x18')]);}_0x1b82e2[_0x5d08('0xc8')]=qs['sort'](_0xfd7a2a[_0x5d08('0x40')][_0x5d08('0xc9')]);_0x1b82e2[_0x5d08('0x3e')]=qs[_0x5d08('0xc6')](_['pick'](_0xfd7a2a['query'],_0x2dfa95[_0x5d08('0xc6')]));_0x1b82e2[_0x5d08('0x3e')][_0x5d08('0xd3')]=_0x52524e['id'];if(_0xfd7a2a[_0x5d08('0x40')][_0x5d08('0x34')]){_0x1b82e2[_0x5d08('0x3e')]=_[_0x5d08('0x50')](_0x1b82e2[_0x5d08('0x3e')],{'$or':_['map'](_0x1b82e2['attributes'],function(_0x23c936){var _0x30e3b2={};_0x30e3b2[_0x23c936]={'$like':'%'+_0xfd7a2a['query']['filter']+'%'};return _0x30e3b2;})});}_0x1b82e2=_[_0x5d08('0x50')]({},_0x1b82e2,_0xfd7a2a[_0x5d08('0x51')]);return db['ScreenRecording'][_0x5d08('0x1b')]({'where':_0x1b82e2[_0x5d08('0x3e')]})[_0x5d08('0x22')](function(_0x5bcde3){_0xb6c7b2[_0x5d08('0x1b')]=_0x5bcde3;if(_0xfd7a2a[_0x5d08('0x40')][_0x5d08('0x41')]){_0x1b82e2[_0x5d08('0x42')]=[{'all':!![]}];}return db[_0x5d08('0xd6')]['findAll'](_0x1b82e2);})[_0x5d08('0x22')](function(_0x3b6ba6){_0xb6c7b2['rows']=_0x3b6ba6;return _0xb6c7b2;});}})[_0x5d08('0x22')](respondWithFilteredResult(_0x2e6208,_0x1b82e2))[_0x5d08('0x4e')](handleError(_0x2e6208,null));};exports[_0x5d08('0xd7')]=function(_0x1c0996,_0x7518cd){var _0x37456f={};var _0x25b711={};var _0xda496f;var _0x1d97a4;return db[_0x5d08('0x3f')]['findOne']({'where':{'id':_0x1c0996[_0x5d08('0x55')]['id']}})[_0x5d08('0x22')](handleEntityNotFound(_0x7518cd,null))['then'](function(_0x81151d){if(_0x81151d){_0xda496f=_0x81151d;_0x25b711[_0x5d08('0xc4')]=_[_0x5d08('0xc5')](db[_0x5d08('0xd8')][_0x5d08('0x31')]);_0x25b711[_0x5d08('0x40')]=_[_0x5d08('0xc5')](_0x1c0996[_0x5d08('0x40')]);_0x25b711[_0x5d08('0xc6')]=_[_0x5d08('0xc7')](_0x25b711[_0x5d08('0xc4')],_0x25b711[_0x5d08('0x40')]);_0x37456f[_0x5d08('0x44')]=_[_0x5d08('0xc7')](_0x25b711[_0x5d08('0xc4')],qs[_0x5d08('0xcf')](_0x1c0996[_0x5d08('0x40')][_0x5d08('0xcf')]));_0x37456f[_0x5d08('0x44')]=_0x37456f[_0x5d08('0x44')]['length']?_0x37456f[_0x5d08('0x44')]:_0x25b711[_0x5d08('0xc4')];_0x37456f['order']=qs['sort'](_0x1c0996['query'][_0x5d08('0xc9')]);_0x37456f[_0x5d08('0x3e')]=qs[_0x5d08('0xc6')](_[_0x5d08('0xca')](_0x1c0996[_0x5d08('0x40')],_0x25b711[_0x5d08('0xc6')]));if(_0x1c0996[_0x5d08('0x40')][_0x5d08('0x34')]){_0x37456f[_0x5d08('0x3e')]=_[_0x5d08('0x50')](_0x37456f[_0x5d08('0x3e')],{'$or':_['map'](_0x37456f[_0x5d08('0x44')],function(_0x16fe4e){var _0x871fdc={};_0x871fdc[_0x16fe4e]={'$like':'%'+_0x1c0996['query'][_0x5d08('0x34')]+'%'};return _0x871fdc;})});}_0x37456f=_[_0x5d08('0x50')]({},_0x37456f,_0x1c0996[_0x5d08('0x51')]);return _0xda496f['getChatInteractions'](_0x37456f);}})['then'](function(_0x305dfe){if(_0x305dfe){_0x1d97a4=_0x305dfe[_0x5d08('0x48')];if(!_0x1c0996[_0x5d08('0x40')][_0x5d08('0xbe')](_0x5d08('0xcc'))){_0x37456f['limit']=qs[_0x5d08('0x1a')](_0x1c0996[_0x5d08('0x40')]['limit']);_0x37456f[_0x5d08('0x18')]=qs[_0x5d08('0x18')](_0x1c0996[_0x5d08('0x40')]['offset']);}return _0xda496f[_0x5d08('0xd7')](_0x37456f);}})[_0x5d08('0x22')](function(_0x4a44b8){if(_0x4a44b8){return _0x4a44b8?{'count':_0x1d97a4,'rows':_0x4a44b8}:null;}})[_0x5d08('0x22')](respondWithResult(_0x7518cd,null))['catch'](handleError(_0x7518cd,null));};exports[_0x5d08('0xd9')]=function(_0x4f3863,_0x1112cc){var _0x20956a={};var _0x387465={};var _0x34a6f2;var _0xf0f893;return db[_0x5d08('0x3f')]['findOne']({'where':{'id':_0x4f3863[_0x5d08('0x55')]['id']}})['then'](handleEntityNotFound(_0x1112cc,null))[_0x5d08('0x22')](function(_0x7b47e3){if(_0x7b47e3){_0x34a6f2=_0x7b47e3;_0x387465[_0x5d08('0xc4')]=_['keys'](db['OpenchannelInteraction'][_0x5d08('0x31')]);_0x387465[_0x5d08('0x40')]=_[_0x5d08('0xc5')](_0x4f3863[_0x5d08('0x40')]);_0x387465['filters']=_[_0x5d08('0xc7')](_0x387465['model'],_0x387465[_0x5d08('0x40')]);_0x20956a[_0x5d08('0x44')]=_[_0x5d08('0xc7')](_0x387465['model'],qs['fields'](_0x4f3863[_0x5d08('0x40')][_0x5d08('0xcf')]));_0x20956a['attributes']=_0x20956a[_0x5d08('0x44')]['length']?_0x20956a[_0x5d08('0x44')]:_0x387465[_0x5d08('0xc4')];_0x20956a[_0x5d08('0xc8')]=qs[_0x5d08('0xc9')](_0x4f3863['query'][_0x5d08('0xc9')]);_0x20956a[_0x5d08('0x3e')]=qs[_0x5d08('0xc6')](_[_0x5d08('0xca')](_0x4f3863[_0x5d08('0x40')],_0x387465['filters']));if(_0x4f3863[_0x5d08('0x40')]['filter']){_0x20956a[_0x5d08('0x3e')]=_[_0x5d08('0x50')](_0x20956a[_0x5d08('0x3e')],{'$or':_['map'](_0x20956a[_0x5d08('0x44')],function(_0x1f896c){var _0x59fd57={};_0x59fd57[_0x1f896c]={'$like':'%'+_0x4f3863[_0x5d08('0x40')][_0x5d08('0x34')]+'%'};return _0x59fd57;})});}_0x20956a=_['merge']({},_0x20956a,_0x4f3863[_0x5d08('0x51')]);return _0x34a6f2[_0x5d08('0xd9')](_0x20956a);}})[_0x5d08('0x22')](function(_0x50e474){if(_0x50e474){_0xf0f893=_0x50e474['length'];if(!_0x4f3863['query'][_0x5d08('0xbe')](_0x5d08('0xcc'))){_0x20956a[_0x5d08('0x1a')]=qs[_0x5d08('0x1a')](_0x4f3863[_0x5d08('0x40')][_0x5d08('0x1a')]);_0x20956a[_0x5d08('0x18')]=qs['offset'](_0x4f3863['query'][_0x5d08('0x18')]);}return _0x34a6f2[_0x5d08('0xd9')](_0x20956a);}})[_0x5d08('0x22')](function(_0x696b5c){if(_0x696b5c){return _0x696b5c?{'count':_0xf0f893,'rows':_0x696b5c}:null;}})[_0x5d08('0x22')](respondWithResult(_0x1112cc,null))[_0x5d08('0x4e')](handleError(_0x1112cc,null));};exports[_0x5d08('0xda')]=function(_0x4edfe8,_0x46a81f){var _0x1a48eb={'raw':!![],'where':{}};var _0x539370={};var _0x489629={'count':0x0,'rows':[]};return db[_0x5d08('0x3f')]['findOne']({'where':{'id':_0x4edfe8['params']['id']}})[_0x5d08('0x22')](handleEntityNotFound(_0x46a81f,null))[_0x5d08('0x22')](function(_0x1cdc37){if(_0x1cdc37){_0x539370['model']=_[_0x5d08('0xc5')](db[_0x5d08('0xdb')]['rawAttributes']);_0x539370[_0x5d08('0x40')]=_['keys'](_0x4edfe8[_0x5d08('0x40')]);_0x539370[_0x5d08('0xc6')]=_[_0x5d08('0xc7')](_0x539370['model'],_0x539370['query']);_0x1a48eb[_0x5d08('0x44')]=_[_0x5d08('0xc7')](_0x539370[_0x5d08('0xc4')],qs[_0x5d08('0xcf')](_0x4edfe8['query'][_0x5d08('0xcf')]));_0x1a48eb[_0x5d08('0x44')]=_0x1a48eb[_0x5d08('0x44')]['length']?_0x1a48eb['attributes']:_0x539370['model'];if(!_0x4edfe8[_0x5d08('0x40')][_0x5d08('0xbe')](_0x5d08('0xcc'))){_0x1a48eb['limit']=qs[_0x5d08('0x1a')](_0x4edfe8[_0x5d08('0x40')][_0x5d08('0x1a')]);_0x1a48eb[_0x5d08('0x18')]=qs['offset'](_0x4edfe8['query'][_0x5d08('0x18')]);}_0x1a48eb['order']=qs[_0x5d08('0xc9')](_0x4edfe8[_0x5d08('0x40')]['sort']);_0x1a48eb['where']=qs[_0x5d08('0xc6')](_[_0x5d08('0xca')](_0x4edfe8['query'],_0x539370['filters']));_0x1a48eb[_0x5d08('0x3e')][_0x5d08('0xd3')]=_0x1cdc37['id'];if(_0x4edfe8[_0x5d08('0x40')]['filter']){_0x1a48eb[_0x5d08('0x3e')]=_[_0x5d08('0x50')](_0x1a48eb[_0x5d08('0x3e')],{'$or':_[_0x5d08('0x2a')](_0x1a48eb[_0x5d08('0x44')],function(_0x5d7b49){var _0x57439a={};_0x57439a[_0x5d7b49]={'$like':'%'+_0x4edfe8[_0x5d08('0x40')]['filter']+'%'};return _0x57439a;})});}_0x1a48eb=_[_0x5d08('0x50')]({},_0x1a48eb,_0x4edfe8[_0x5d08('0x51')]);return db['MailInteraction'][_0x5d08('0x1b')]({'where':_0x1a48eb[_0x5d08('0x3e')]})[_0x5d08('0x22')](function(_0x2d07b0){_0x489629[_0x5d08('0x1b')]=_0x2d07b0;if(_0x4edfe8[_0x5d08('0x40')][_0x5d08('0x41')]){_0x1a48eb[_0x5d08('0x42')]=[{'all':!![]}];}return db[_0x5d08('0xdb')][_0x5d08('0x80')](_0x1a48eb);})[_0x5d08('0x22')](function(_0xb57a96){_0x489629[_0x5d08('0x46')]=_0xb57a96;return _0x489629;});}})[_0x5d08('0x22')](respondWithFilteredResult(_0x46a81f,_0x1a48eb))[_0x5d08('0x4e')](handleError(_0x46a81f,null));};exports[_0x5d08('0xdc')]=function(_0x4d9703,_0x43cc92){var _0x1d95df={};var _0x409129={};var _0x171bcb;var _0x3e51a1;return db[_0x5d08('0x3f')][_0x5d08('0xbd')]({'where':{'id':_0x4d9703[_0x5d08('0x55')]['id']}})[_0x5d08('0x22')](handleEntityNotFound(_0x43cc92,null))[_0x5d08('0x22')](function(_0x58fe38){if(_0x58fe38){_0x171bcb=_0x58fe38;_0x409129[_0x5d08('0xc4')]=_['keys'](db[_0x5d08('0xdd')][_0x5d08('0x31')]);_0x409129['query']=_[_0x5d08('0xc5')](_0x4d9703['query']);_0x409129['filters']=_[_0x5d08('0xc7')](_0x409129[_0x5d08('0xc4')],_0x409129[_0x5d08('0x40')]);_0x1d95df[_0x5d08('0x44')]=_[_0x5d08('0xc7')](_0x409129[_0x5d08('0xc4')],qs[_0x5d08('0xcf')](_0x4d9703[_0x5d08('0x40')][_0x5d08('0xcf')]));_0x1d95df['attributes']=_0x1d95df['attributes'][_0x5d08('0x48')]?_0x1d95df['attributes']:_0x409129[_0x5d08('0xc4')];_0x1d95df[_0x5d08('0xc8')]=qs[_0x5d08('0xc9')](_0x4d9703[_0x5d08('0x40')]['sort']);_0x1d95df['where']=qs[_0x5d08('0xc6')](_['pick'](_0x4d9703['query'],_0x409129[_0x5d08('0xc6')]));if(_0x4d9703[_0x5d08('0x40')]['filter']){_0x1d95df[_0x5d08('0x3e')]=_[_0x5d08('0x50')](_0x1d95df[_0x5d08('0x3e')],{'$or':_['map'](_0x1d95df[_0x5d08('0x44')],function(_0x5654dd){var _0x1918da={};_0x1918da[_0x5654dd]={'$like':'%'+_0x4d9703[_0x5d08('0x40')][_0x5d08('0x34')]+'%'};return _0x1918da;})});}_0x1d95df=_[_0x5d08('0x50')]({},_0x1d95df,_0x4d9703[_0x5d08('0x51')]);return _0x171bcb[_0x5d08('0xdc')](_0x1d95df);}})['then'](function(_0x35445e){if(_0x35445e){_0x3e51a1=_0x35445e[_0x5d08('0x48')];if(!_0x4d9703['query'][_0x5d08('0xbe')](_0x5d08('0xcc'))){_0x1d95df['limit']=qs[_0x5d08('0x1a')](_0x4d9703[_0x5d08('0x40')][_0x5d08('0x1a')]);_0x1d95df[_0x5d08('0x18')]=qs[_0x5d08('0x18')](_0x4d9703[_0x5d08('0x40')][_0x5d08('0x18')]);}return _0x171bcb[_0x5d08('0xdc')](_0x1d95df);}})[_0x5d08('0x22')](function(_0x5e60d6){if(_0x5e60d6){return _0x5e60d6?{'count':_0x3e51a1,'rows':_0x5e60d6}:null;}})[_0x5d08('0x22')](respondWithResult(_0x43cc92,null))[_0x5d08('0x4e')](handleError(_0x43cc92,null));};exports[_0x5d08('0xde')]=function(_0xc45edf,_0x5dcd70){var _0x3b0545={};var _0x1f2bac={};var _0x413e07;var _0x2c80da;return db[_0x5d08('0x3f')][_0x5d08('0xbd')]({'where':{'id':_0xc45edf[_0x5d08('0x55')]['id']}})[_0x5d08('0x22')](handleEntityNotFound(_0x5dcd70,null))[_0x5d08('0x22')](function(_0x5ea521){if(_0x5ea521){_0x413e07=_0x5ea521;_0x1f2bac[_0x5d08('0xc4')]=_[_0x5d08('0xc5')](db[_0x5d08('0xdf')]['rawAttributes']);_0x1f2bac[_0x5d08('0x40')]=_['keys'](_0xc45edf[_0x5d08('0x40')]);_0x1f2bac[_0x5d08('0xc6')]=_[_0x5d08('0xc7')](_0x1f2bac[_0x5d08('0xc4')],_0x1f2bac[_0x5d08('0x40')]);_0x3b0545['attributes']=_[_0x5d08('0xc7')](_0x1f2bac[_0x5d08('0xc4')],qs[_0x5d08('0xcf')](_0xc45edf['query']['fields']));_0x3b0545['attributes']=_0x3b0545[_0x5d08('0x44')][_0x5d08('0x48')]?_0x3b0545[_0x5d08('0x44')]:_0x1f2bac[_0x5d08('0xc4')];_0x3b0545[_0x5d08('0xc8')]=qs['sort'](_0xc45edf[_0x5d08('0x40')][_0x5d08('0xc9')]);_0x3b0545['where']=qs[_0x5d08('0xc6')](_[_0x5d08('0xca')](_0xc45edf['query'],_0x1f2bac[_0x5d08('0xc6')]));if(_0xc45edf[_0x5d08('0x40')][_0x5d08('0x34')]){_0x3b0545[_0x5d08('0x3e')]=_[_0x5d08('0x50')](_0x3b0545[_0x5d08('0x3e')],{'$or':_['map'](_0x3b0545[_0x5d08('0x44')],function(_0x24c218){var _0x271976={};_0x271976[_0x24c218]={'$like':'%'+_0xc45edf[_0x5d08('0x40')]['filter']+'%'};return _0x271976;})});}_0x3b0545=_[_0x5d08('0x50')]({},_0x3b0545,_0xc45edf[_0x5d08('0x51')]);return _0x413e07[_0x5d08('0xde')](_0x3b0545);}})[_0x5d08('0x22')](function(_0x4fb2e1){if(_0x4fb2e1){_0x2c80da=_0x4fb2e1[_0x5d08('0x48')];if(!_0xc45edf[_0x5d08('0x40')]['hasOwnProperty'](_0x5d08('0xcc'))){_0x3b0545['limit']=qs[_0x5d08('0x1a')](_0xc45edf[_0x5d08('0x40')][_0x5d08('0x1a')]);_0x3b0545['offset']=qs[_0x5d08('0x18')](_0xc45edf['query'][_0x5d08('0x18')]);}return _0x413e07['getFaxInteractions'](_0x3b0545);}})[_0x5d08('0x22')](function(_0x39220b){if(_0x39220b){return _0x39220b?{'count':_0x2c80da,'rows':_0x39220b}:null;}})[_0x5d08('0x22')](respondWithResult(_0x5dcd70,null))[_0x5d08('0x4e')](handleError(_0x5dcd70,null));};exports[_0x5d08('0xe0')]=function(_0x22a94c,_0x531d43){var _0x567dbf={};var _0x481ead={};var _0x540cf3;var _0x371a71;return db[_0x5d08('0x3f')][_0x5d08('0xbd')]({'where':{'id':_0x22a94c[_0x5d08('0x55')]['id']}})[_0x5d08('0x22')](handleEntityNotFound(_0x531d43,null))['then'](function(_0x2af69e){if(_0x2af69e){_0x540cf3=_0x2af69e;_0x481ead[_0x5d08('0xc4')]=_['keys'](db[_0x5d08('0xe1')]['rawAttributes']);_0x481ead[_0x5d08('0x40')]=_['keys'](_0x22a94c[_0x5d08('0x40')]);_0x481ead['filters']=_[_0x5d08('0xc7')](_0x481ead[_0x5d08('0xc4')],_0x481ead[_0x5d08('0x40')]);_0x567dbf[_0x5d08('0x44')]=_[_0x5d08('0xc7')](_0x481ead[_0x5d08('0xc4')],qs[_0x5d08('0xcf')](_0x22a94c[_0x5d08('0x40')][_0x5d08('0xcf')]));_0x567dbf[_0x5d08('0x44')]=_0x567dbf['attributes'][_0x5d08('0x48')]?_0x567dbf['attributes']:_0x481ead[_0x5d08('0xc4')];_0x567dbf[_0x5d08('0xc8')]=qs[_0x5d08('0xc9')](_0x22a94c['query'][_0x5d08('0xc9')]);_0x567dbf[_0x5d08('0x3e')]=qs[_0x5d08('0xc6')](_[_0x5d08('0xca')](_0x22a94c[_0x5d08('0x40')],_0x481ead['filters']));if(_0x22a94c[_0x5d08('0x40')][_0x5d08('0x34')]){_0x567dbf[_0x5d08('0x3e')]=_['merge'](_0x567dbf['where'],{'$or':_['map'](_0x567dbf[_0x5d08('0x44')],function(_0x196c69){var _0x167ee4={};_0x167ee4[_0x196c69]={'$like':'%'+_0x22a94c['query']['filter']+'%'};return _0x167ee4;})});}_0x567dbf=_[_0x5d08('0x50')]({},_0x567dbf,_0x22a94c[_0x5d08('0x51')]);return _0x540cf3[_0x5d08('0xe0')](_0x567dbf);}})[_0x5d08('0x22')](function(_0x42fc48){if(_0x42fc48){_0x371a71=_0x42fc48[_0x5d08('0x48')];if(!_0x22a94c['query']['hasOwnProperty'](_0x5d08('0xcc'))){_0x567dbf['limit']=qs[_0x5d08('0x1a')](_0x22a94c[_0x5d08('0x40')][_0x5d08('0x1a')]);_0x567dbf[_0x5d08('0x18')]=qs['offset'](_0x22a94c['query']['offset']);}return _0x540cf3[_0x5d08('0xe0')](_0x567dbf);}})['then'](function(_0x3c5124){if(_0x3c5124){return _0x3c5124?{'count':_0x371a71,'rows':_0x3c5124}:null;}})['then'](respondWithResult(_0x531d43,null))['catch'](handleError(_0x531d43,null));};exports['login']=function(_0x2a91c1,_0x1d0081,_0x5db421){var _0x118a00;var _0x59a9bc;var _0x48aae4;var _0x4e0b33=!_['isNil'](_0x2a91c1[_0x5d08('0x55')]['id'])?_0x2a91c1[_0x5d08('0x55')]['id']:!_['isNil'](_0x2a91c1[_0x5d08('0x26')]['id'])?_0x2a91c1[_0x5d08('0x26')]['id']:null;return db[_0x5d08('0x3f')][_0x5d08('0x2c')]({'where':{'id':_0x4e0b33,'role':{'$or':[_0x5d08('0x24'),_0x5d08('0x26'),_0x5d08('0x1f')]}},'attributes':['id',_0x5d08('0x3a'),_0x5d08('0xe2'),_0x5d08('0xe3'),_0x5d08('0x1e'),_0x5d08('0x5d'),'loginInPause']})[_0x5d08('0x22')](function(_0x285a9d){if(_0x285a9d){if(_0x285a9d['role']==='agent'){_0x118a00=_0x285a9d;if(_0x2a91c1['body'][_0x5d08('0x92')]){_0x48aae4=util[_0x5d08('0x9c')]('LOCAL/%s@from-sip/n',_0x118a00[_0x2a91c1[_0x5d08('0x54')][_0x5d08('0x92')]]);}else if(_0x2a91c1['body'][_0x5d08('0xe4')]){_0x48aae4=util['format']('SIP/%s',_0x2a91c1[_0x5d08('0x54')]['intrf']);}else{_0x48aae4=util[_0x5d08('0x9c')]('SIP/%s',_0x118a00[_0x5d08('0x3a')]);}socket['to'](util[_0x5d08('0x9c')](_0x5d08('0xe5'),_0x118a00[_0x5d08('0x3a')]))[_0x5d08('0x20')]('user:forcelogout',{'user':{'id':_0x118a00['id'],'name':_0x118a00['name']},'ip':_0x2a91c1[_0x5d08('0xe6')][_0x5d08('0xe7')]||_0x2a91c1[_0x5d08('0xe8')][_0x5d08('0xe9')]||_0x2a91c1[_0x5d08('0xea')]['remoteAddress']||_0x2a91c1['connection'][_0x5d08('0xea')]['remoteAddress']});return db[_0x5d08('0x9e')][_0x5d08('0x2d')]({'where':{'membername':_0x118a00[_0x5d08('0x3a')]},'individualHooks':!![]});}}else{throw new db['Sequelize']['ValidationError']('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0x5d08('0x22')](function(){if(_0x118a00){return _0x118a00[_0x5d08('0xeb')]({'raw':!![]});}})[_0x5d08('0x22')](function(_0x211582){if(_0x118a00){if(_0x211582){_0x59a9bc=_0x211582;if(_0x59a9bc['length']){var _0x5ac9df=_0x59a9bc[_0x5d08('0x2a')](function(_0xadc220){var _0x3cd63f={'membername':_0x118a00[_0x5d08('0x3a')],'UserId':_0x118a00['id'],'queue_name':_0xadc220[_0x5d08('0x3a')],'VoiceQueueId':_0xadc220['id'],'interface':_0x48aae4,'paused':_0x118a00[_0x5d08('0x90')]||![],'penalty':_0xadc220['UserVoiceQueue.penalty']||0x0};return db[_0x5d08('0x9e')][_0x5d08('0x9f')](_0x3cd63f);});return Promise[_0x5d08('0x53')](_0x5ac9df);}}}})[_0x5d08('0x22')](function(){if(_0x118a00){return db['MemberReport'][_0x5d08('0x80')]({'where':{'membername':_0x118a00['name'],'exitAt':null}});}})[_0x5d08('0x22')](function(_0x2e4765){if(_0x118a00){var _0x4604f7=[];_0x2e4765['forEach'](function(_0x197995){_0x4604f7['push'](_0x197995[_0x5d08('0x1d')]({'exitAt':moment()[_0x5d08('0x9c')](_0x5d08('0xec'))}));});return Promise[_0x5d08('0x53')](_0x4604f7);}})['then'](function(){if(_0x118a00){var _0x3a4d5c=[];var _0x1396be=[];var _0xfd43d0=utils[_0x5d08('0xed')]();var _0x17013e={'membername':_0x118a00[_0x5d08('0x3a')],'interface':_0x48aae4,'enterAt':moment()[_0x5d08('0x9c')](_0x5d08('0xec')),'role':_0x118a00[_0x5d08('0x1e')],'internal':_0x118a00[_0x5d08('0x5d')]};_0xfd43d0[_0x5d08('0xee')](function(_0x31b8f1){_0x3a4d5c[_0x5d08('0x45')](_['merge']({'channel':_0x31b8f1,'type':_0x5d08('0xef'),'data1':_0x2a91c1[_0x5d08('0x54')]['device'],'data2':_0x48aae4},_0x17013e));if(_0x118a00['loginInPause']){_0x1396be[_0x5d08('0x45')](_[_0x5d08('0x50')]({'channel':_0x31b8f1,'type':_0x5d08('0xf0'),'data1':_0x5d08('0xf1')},_0x17013e));}});return db[_0x5d08('0xf2')][_0x5d08('0x7b')](_0x3a4d5c[_0x5d08('0xbb')](_0x1396be),{'individualHooks':!![]});}})[_0x5d08('0x22')](function(){if(_0x118a00){return _0x118a00[_0x5d08('0x1d')]({'online':!![],'lastLoginAt':moment()['format'](_0x5d08('0xec')),'voicePause':_0x118a00[_0x5d08('0x90')]||![],'mailPause':_0x118a00[_0x5d08('0x90')]||![],'chatPause':_0x118a00[_0x5d08('0x90')]||![],'faxPause':_0x118a00['loginInPause']||![],'smsPause':_0x118a00[_0x5d08('0x90')]||![],'openchannelPause':_0x118a00[_0x5d08('0x90')]||![],'whatsappPause':_0x118a00[_0x5d08('0x90')]||![],'pauseType':_0x118a00[_0x5d08('0x90')]?_0x5d08('0xf1'):null,'interface':_0x48aae4,'lastPauseAt':moment()[_0x5d08('0x9c')](_0x5d08('0xec'))});}})[_0x5d08('0x22')](function(_0x26a217){if(_0x2a91c1[_0x5d08('0xf3')]){return _0x5db421();}else{return Promise[_0x5d08('0xf4')](_0x26a217)[_0x5d08('0x22')](respondWithResult(_0x1d0081,null));}})[_0x5d08('0x4e')](handleError(_0x1d0081,null));};exports[_0x5d08('0xf5')]=function(_0x55bbf6,_0x344a8a){var _0x31786d;return db[_0x5d08('0x3f')][_0x5d08('0x2c')]({'where':{'id':_0x55bbf6[_0x5d08('0x55')]['id'],'role':_0x5d08('0x1f')},'attributes':['id',_0x5d08('0x3a'),'role']})[_0x5d08('0x22')](handleEntityNotFound(_0x344a8a,null))['then'](function(_0x249f19){if(_0x249f19){_0x31786d=_0x249f19;return db[_0x5d08('0x9e')][_0x5d08('0x2d')]({'where':{'membername':_0x31786d['name']},'individualHooks':!![]});}})[_0x5d08('0x22')](function(){return db[_0x5d08('0xf2')][_0x5d08('0x80')]({'where':{'membername':_0x31786d[_0x5d08('0x3a')],'exitAt':null}});})[_0x5d08('0x22')](function(_0x5d8b2b){var _0x22668c=[];_0x5d8b2b[_0x5d08('0xee')](function(_0x2a480d){_0x22668c['push'](_0x2a480d[_0x5d08('0x1d')]({'exitAt':moment()[_0x5d08('0x9c')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x5d08('0x53')](_0x22668c);})['then'](function(){return _0x31786d[_0x5d08('0x1d')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x5d08('0x22')](respondWithResult(_0x344a8a,null))[_0x5d08('0x4e')](handleError(_0x344a8a,null));};exports[_0x5d08('0xf6')]=function(_0x1a9990,_0x5d7bc2){var _0x45b6c8;return db[_0x5d08('0x9e')][_0x5d08('0x1d')]({'paused':0x1},{'where':{'UserId':_0x1a9990['params']['id']},'individualHooks':!![]})[_0x5d08('0x22')](function(){return db[_0x5d08('0x3f')][_0x5d08('0x2c')]({'where':{'id':_0x1a9990[_0x5d08('0x55')]['id'],'role':_0x5d08('0x1f')},'attributes':['id','name',_0x5d08('0x1e'),'internal',_0x5d08('0x92'),_0x5d08('0x8f')]});})[_0x5d08('0x22')](handleEntityNotFound(_0x5d7bc2,null))[_0x5d08('0x22')](function(_0x324275){if(_0x324275){_0x45b6c8=_0x324275;return db['MemberReport']['findAll']({'where':{'membername':_0x45b6c8['name'],'type':_0x5d08('0xf0'),'exitAt':null}});}})[_0x5d08('0x22')](function(_0x4940c2){if(_0x4940c2[_0x5d08('0x48')]){var _0x4e5c88=moment()[_0x5d08('0x9c')](_0x5d08('0xec'));for(var _0x85e12=0x0,_0x2b0fda=_0x4940c2[_0x5d08('0x48')];_0x85e12<_0x2b0fda;_0x85e12++){_0x4940c2[_0x85e12]['updateAttributes']({'exitAt':_0x4e5c88});}}})[_0x5d08('0x22')](function(){var _0x309368=[];var _0xf55058=utils[_0x5d08('0xed')]();_0xf55058[_0x5d08('0xee')](function(_0x1eab0f){_0x309368['push']({'channel':_0x1eab0f,'membername':_0x45b6c8[_0x5d08('0x3a')],'interface':_[_0x5d08('0x5e')](_0x45b6c8['interface'])?util[_0x5d08('0x9c')](_0x5d08('0x9d'),_0x45b6c8[_0x5d08('0x3a')]):_0x45b6c8[_0x5d08('0x92')],'type':_0x5d08('0xf0'),'enterAt':moment()[_0x5d08('0x9c')](_0x5d08('0xec')),'data1':_0x1a9990[_0x5d08('0x54')][_0x5d08('0x32')]||_0x5d08('0xf7'),'role':_0x45b6c8[_0x5d08('0x1e')],'internal':_0x45b6c8['internal']});});return db[_0x5d08('0xf2')][_0x5d08('0x7b')](_0x309368,{'individualHooks':!![]});})[_0x5d08('0x22')](function(){return _0x45b6c8['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x1a9990['body'][_0x5d08('0x32')]||_0x5d08('0xf7'),'lastPauseAt':moment()[_0x5d08('0x9c')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x5d08('0x22')](respondWithResult(_0x5d7bc2,null))[_0x5d08('0x4e')](handleError(_0x5d7bc2,null));};exports['unpause']=function(_0x5a38ef,_0x48460e){if(_0x5a38ef[_0x5d08('0x54')][_0x5d08('0x8e')]&&!utils[_0x5d08('0xa1')](_0x5a38ef[_0x5d08('0x54')][_0x5d08('0x8e')])){throw new APIBadRequestError(util[_0x5d08('0x9c')](_0x5d08('0xf8'),_0x5a38ef[_0x5d08('0x54')][_0x5d08('0x8e')]));}return db['User'][_0x5d08('0x2c')]({'where':{'id':_0x5a38ef[_0x5d08('0x55')]['id']},'attributes':['id','name',_0x5d08('0x1e'),_0x5d08('0x5d'),_0x5d08('0x92'),'online',_0x5d08('0x91'),_0x5d08('0xf9'),_0x5d08('0xfa'),_0x5d08('0xfb'),_0x5d08('0xfc'),_0x5d08('0xfd'),'whatsappPause',_0x5d08('0xfe'),_0x5d08('0xff')]})[_0x5d08('0x22')](function(_0x1c7f54){if(!_0x1c7f54){throw new APINotFoundError(util['format'](_0x5d08('0x100'),_0x5a38ef[_0x5d08('0x55')]['id']));}return _0x1c7f54[_0x5d08('0x101')](_0x5a38ef[_0x5d08('0x54')][_0x5d08('0x8e')]);})[_0x5d08('0x22')](respondWithResult(_0x48460e,null))[_0x5d08('0x4e')](APIHandleError(_0x48460e));};exports['getTeams']=function(_0x2a88b7,_0x87981c){var _0x46454d={};var _0x1c95bd={};var _0x2eb6f4;var _0x5cce36;return db[_0x5d08('0x3f')][_0x5d08('0xbd')]({'where':{'id':_0x2a88b7[_0x5d08('0x55')]['id']}})[_0x5d08('0x22')](handleEntityNotFound(_0x87981c,null))[_0x5d08('0x22')](function(_0x437f70){if(_0x437f70){_0x2eb6f4=_0x437f70;_0x1c95bd[_0x5d08('0xc4')]=_[_0x5d08('0xc5')](db[_0x5d08('0x102')][_0x5d08('0x31')]);_0x1c95bd[_0x5d08('0x40')]=_[_0x5d08('0xc5')](_0x2a88b7[_0x5d08('0x40')]);_0x1c95bd['filters']=_[_0x5d08('0xc7')](_0x1c95bd['model'],_0x1c95bd['query']);_0x46454d[_0x5d08('0x44')]=_[_0x5d08('0xc7')](_0x1c95bd[_0x5d08('0xc4')],qs[_0x5d08('0xcf')](_0x2a88b7[_0x5d08('0x40')][_0x5d08('0xcf')]));_0x46454d[_0x5d08('0x44')]=_0x46454d[_0x5d08('0x44')][_0x5d08('0x48')]?_0x46454d[_0x5d08('0x44')]:_0x1c95bd[_0x5d08('0xc4')];_0x46454d[_0x5d08('0xc8')]=qs['sort'](_0x2a88b7['query'][_0x5d08('0xc9')]);_0x46454d[_0x5d08('0x3e')]=qs['filters'](_[_0x5d08('0xca')](_0x2a88b7['query'],_0x1c95bd[_0x5d08('0xc6')]));if(_0x2a88b7[_0x5d08('0x40')][_0x5d08('0x34')]){_0x46454d[_0x5d08('0x3e')]=_[_0x5d08('0x50')](_0x46454d[_0x5d08('0x3e')],{'$or':_[_0x5d08('0x2a')](_0x46454d[_0x5d08('0x44')],function(_0x156e14){var _0x70ee0b={};_0x70ee0b[_0x156e14]={'$like':'%'+_0x2a88b7[_0x5d08('0x40')][_0x5d08('0x34')]+'%'};return _0x70ee0b;})});}_0x46454d=_['merge']({},_0x46454d,_0x2a88b7[_0x5d08('0x51')]);return _0x2eb6f4[_0x5d08('0x103')](_0x46454d);}})[_0x5d08('0x22')](function(_0x576e05){if(_0x576e05){_0x5cce36=_0x576e05[_0x5d08('0x48')];if(!_0x2a88b7[_0x5d08('0x40')][_0x5d08('0xbe')](_0x5d08('0xcc'))){_0x46454d[_0x5d08('0x1a')]=qs[_0x5d08('0x1a')](_0x2a88b7[_0x5d08('0x40')][_0x5d08('0x1a')]);_0x46454d[_0x5d08('0x18')]=qs[_0x5d08('0x18')](_0x2a88b7[_0x5d08('0x40')][_0x5d08('0x18')]);}return _0x2eb6f4[_0x5d08('0x103')](_0x46454d);}})[_0x5d08('0x22')](function(_0x3d8f12){if(_0x3d8f12){return _0x3d8f12?{'count':_0x5cce36,'rows':_0x3d8f12}:null;}})[_0x5d08('0x22')](respondWithResult(_0x87981c,null))[_0x5d08('0x4e')](handleError(_0x87981c,null));};exports[_0x5d08('0x104')]=function(_0x37167e,_0x28c846){var _0xd7f42=_0x37167e[_0x5d08('0x55')]['id'];var _0x378e78=_0x37167e[_0x5d08('0x54')]?_0x37167e[_0x5d08('0x54')][_0x5d08('0x58')]:null;var _0x259423=[];return Promise['resolve']()[_0x5d08('0x22')](function(){if(!_0x378e78)throw new APIBadRequestError(_0x5d08('0x105'));})[_0x5d08('0x22')](function(){return db[_0x5d08('0x3f')][_0x5d08('0xbd')]({'where':{'id':_0xd7f42}});})[_0x5d08('0x22')](function(_0x3057d1){if(!_0x3057d1)throw new APINotFoundError(util[_0x5d08('0x9c')](_0x5d08('0x100'),_0x37167e[_0x5d08('0x55')]['id']));return db['sequelize'][_0x5d08('0x106')](function(_0x4bedf0){return _0x3057d1[_0x5d08('0x104')](_0x378e78,{'transaction':_0x4bedf0})['then'](function(){return db['Team'][_0x5d08('0x80')]({'where':{'id':{'$in':_0x378e78}}});})[_0x5d08('0x22')](function(_0x22c4a6){var _0x349dda=_[_0x5d08('0x2a')](_0x22c4a6,function(_0x2886e5){return _0x2886e5[_0x5d08('0x107')]();});return Promise[_0x5d08('0x53')](_0x349dda);})[_0x5d08('0x22')](function(_0x413807){_0x259423=_[_0x5d08('0x108')](_0x413807);var _0x2279f1=_[_0x5d08('0x2a')](_0x259423,function(_0x4669cc){return _0x4669cc[_0x5d08('0x109')](_0x3057d1['id'],{'transaction':_0x4bedf0});});return Promise[_0x5d08('0x53')](_0x2279f1);})['then'](function(){if(!_0x3057d1[_0x5d08('0x8f')])return;var _0x19dbaa=_[_0x5d08('0x34')](_0x259423,function(_0x416202){return _0x416202['getDataValue'](_0x5d08('0x8e'))===_0x5d08('0x10a');});var _0x2c2742=_[_0x5d08('0x2a')](_0x19dbaa,function(_0x527344){return db['UserVoiceQueueRt'][_0x5d08('0x9f')]({'membername':_0x3057d1[_0x5d08('0x3a')],'UserId':_0x3057d1['id'],'queue_name':_0x527344['name'],'VoiceQueueId':_0x527344['id'],'interface':_[_0x5d08('0x5e')](_0x3057d1[_0x5d08('0x92')])?util[_0x5d08('0x9c')]('SIP/%s',_0x3057d1['name']):_0x3057d1[_0x5d08('0x92')],'paused':_0x3057d1[_0x5d08('0x91')]||![],'penalty':_0x3057d1[_0x5d08('0x96')]},{'transaction':_0x4bedf0});});return Promise['all'](_0x2c2742);})['then'](function(){return db['TeamVoicePrefix'][_0x5d08('0x80')]({'where':{'teamId':{'$in':_0x378e78}}});})[_0x5d08('0x22')](function(_0xd5d57e){var _0x2dabff=_[_0x5d08('0x2a')](_0xd5d57e,function(_0x781322){return db[_0x5d08('0x10b')][_0x5d08('0x74')]({'UserId':_0x3057d1['id'],'VoicePrefixId':_0x781322[_0x5d08('0x10c')]},{'transaction':_0x4bedf0});});return Promise[_0x5d08('0x53')](_0x2dabff);});});})['then'](function(){for(var _0x41be39=0x0;_0x41be39<_0x259423[_0x5d08('0x48')];_0x41be39++){var _0x23eadc=_0x259423[_0x41be39][_0x5d08('0x10d')](_0x5d08('0x8e'));var _0x23f2b2=_0x23eadc+'QueueId';socket['emit']('user'+_0x23eadc+_0x5d08('0x99'),{'UserId':_0xd7f42,['queueField']:_0x259423[_0x41be39]['id']});}})[_0x5d08('0x22')](respondWithStatusCode(_0x28c846,null))['catch'](APIHandleError(_0x28c846));};exports['removeTeams']=function(_0x3e88d5,_0x3bc515){var _0x376ff9=_0x3e88d5[_0x5d08('0x55')]['id'];var _0x30ad5a=null;if(_0x3e88d5[_0x5d08('0x40')][_0x5d08('0x58')]){_0x30ad5a=_[_0x5d08('0xa3')](_0x3e88d5[_0x5d08('0x40')]['ids'])?_0x3e88d5['query']['ids']:[_0x3e88d5[_0x5d08('0x40')][_0x5d08('0x58')]];}var _0x447fc8=[];return Promise['resolve']()[_0x5d08('0x22')](function(){if(!_0x30ad5a)throw new APIBadRequestError(_0x5d08('0x10e'));})['then'](function(){return db['User']['findOne']({'where':{'id':_0x376ff9}});})['then'](function(_0x29da9f){if(!_0x29da9f)throw new APINotFoundError(util[_0x5d08('0x9c')](_0x5d08('0x100'),_0x3e88d5['params']['id']));return db['sequelize'][_0x5d08('0x106')](function(_0x2d7e70){return _0x29da9f[_0x5d08('0x10f')](_0x30ad5a,{'transaction':_0x2d7e70})[_0x5d08('0x22')](function(){return db[_0x5d08('0x102')]['findAll']({'where':{'id':{'$in':_0x30ad5a}}});})['then'](function(_0x24aaa9){var _0x1837c8=_[_0x5d08('0x2a')](_0x24aaa9,function(_0x92b7a9){return _0x92b7a9[_0x5d08('0x107')]();});return Promise[_0x5d08('0x53')](_0x1837c8);})[_0x5d08('0x22')](function(_0x12fafd){_0x447fc8=_[_0x5d08('0x108')](_0x12fafd);var _0x5e70c1=_[_0x5d08('0x2a')](_0x447fc8,function(_0x4faa78){return _0x4faa78[_0x5d08('0x110')](_0x29da9f['id'],{'transaction':_0x2d7e70});});return Promise[_0x5d08('0x53')](_0x5e70c1);})['then'](function(){if(!_0x29da9f[_0x5d08('0x8f')])return;var _0x4f6f94=_['filter'](_0x447fc8,function(_0x141cc1){return _0x141cc1['getDataValue'](_0x5d08('0x8e'))===_0x5d08('0x10a');});var _0x132939=_['map'](_0x4f6f94,function(_0x19fdf8){return db[_0x5d08('0x9e')][_0x5d08('0x2d')]({'where':{'VoiceQueueId':_0x19fdf8['id'],'UserId':_0x29da9f['id']},'transaction':_0x2d7e70});});return Promise[_0x5d08('0x53')](_0x132939);})[_0x5d08('0x22')](function(){return db['TeamVoicePrefix']['findAll']({'where':{'teamId':{'$in':_0x30ad5a}}});})[_0x5d08('0x22')](function(_0x48b831){var _0x38fe9f=_[_0x5d08('0x2a')](_0x48b831,function(_0x169f90){return db['UserVoicePrefix'][_0x5d08('0x2d')]({'where':{'UserId':_0x29da9f['id'],'VoicePrefixId':_0x169f90[_0x5d08('0x10c')]}},{'transaction':_0x2d7e70});});return Promise[_0x5d08('0x53')](_0x38fe9f);});});})['then'](function(){for(var _0x4db286=0x0;_0x4db286<_0x447fc8[_0x5d08('0x48')];_0x4db286++){var _0x272977=_0x447fc8[_0x4db286][_0x5d08('0x10d')](_0x5d08('0x8e'));var _0x4972b3=_0x272977+'QueueId';socket['emit']('user'+_0x272977+'Queue:remove',{'UserId':_0x376ff9,['queueField']:_0x447fc8[_0x4db286]['id']});}})[_0x5d08('0x22')](respondWithStatusCode(_0x3bc515,null))[_0x5d08('0x4e')](APIHandleError(_0x3bc515));};exports[_0x5d08('0x111')]=function(_0x18c580,_0xf84ddb){var _0x3fefce={};var _0x4f627e={};var _0x128beb;var _0x2dd84f;return db[_0x5d08('0x3f')][_0x5d08('0xbd')]({'where':{'id':_0x18c580[_0x5d08('0x55')]['id']}})['then'](handleEntityNotFound(_0xf84ddb,null))[_0x5d08('0x22')](function(_0x3be355){if(_0x3be355){_0x128beb=_0x3be355;_0x4f627e[_0x5d08('0xc4')]=_[_0x5d08('0xc5')](db[_0x5d08('0xbf')]['rawAttributes']);_0x4f627e[_0x5d08('0x40')]=_[_0x5d08('0xc5')](_0x18c580['query']);_0x4f627e[_0x5d08('0xc6')]=_['intersection'](_0x4f627e[_0x5d08('0xc4')],_0x4f627e[_0x5d08('0x40')]);_0x3fefce['attributes']=_['intersection'](_0x4f627e[_0x5d08('0xc4')],qs['fields'](_0x18c580[_0x5d08('0x40')][_0x5d08('0xcf')]));_0x3fefce[_0x5d08('0x44')]=_0x3fefce[_0x5d08('0x44')][_0x5d08('0x48')]?_0x3fefce[_0x5d08('0x44')]:_0x4f627e[_0x5d08('0xc4')];_0x3fefce[_0x5d08('0xc8')]=qs['sort'](_0x18c580['query'][_0x5d08('0xc9')]);_0x3fefce[_0x5d08('0x3e')]=qs[_0x5d08('0xc6')](_[_0x5d08('0xca')](_0x18c580['query'],_0x4f627e[_0x5d08('0xc6')]));if(_0x18c580[_0x5d08('0x40')][_0x5d08('0x34')]){_0x3fefce[_0x5d08('0x3e')]=_[_0x5d08('0x50')](_0x3fefce[_0x5d08('0x3e')],{'$or':_[_0x5d08('0x2a')](_0x3fefce[_0x5d08('0x44')],function(_0x36bb18){var _0x230ab9={};_0x230ab9[_0x36bb18]={'$like':'%'+_0x18c580[_0x5d08('0x40')]['filter']+'%'};return _0x230ab9;})});}_0x3fefce=_['merge']({},_0x3fefce,_0x18c580[_0x5d08('0x51')]);return _0x128beb['getLists'](_0x3fefce);}})['then'](function(_0x2387c5){if(_0x2387c5){_0x2dd84f=_0x2387c5[_0x5d08('0x48')];if(!_0x18c580[_0x5d08('0x40')][_0x5d08('0xbe')]('nolimit')){_0x3fefce[_0x5d08('0x1a')]=qs[_0x5d08('0x1a')](_0x18c580[_0x5d08('0x40')][_0x5d08('0x1a')]);_0x3fefce[_0x5d08('0x18')]=qs['offset'](_0x18c580['query']['offset']);}return _0x128beb[_0x5d08('0x111')](_0x3fefce);}})[_0x5d08('0x22')](function(_0x5bb841){if(_0x5bb841){return _0x5bb841?{'count':_0x2dd84f,'rows':_0x5bb841}:null;}})[_0x5d08('0x22')](respondWithResult(_0xf84ddb,null))['catch'](handleError(_0xf84ddb,null));};exports[_0x5d08('0x112')]=function(_0x1ccb0a,_0x599974){var _0x2e0d98={};var _0x4bf761={};var _0x11a6af;return db[_0x5d08('0x3f')][_0x5d08('0xbd')]({'where':{'id':_0x1ccb0a[_0x5d08('0x55')]['id']}})['then'](handleEntityNotFound(_0x599974,null))[_0x5d08('0x22')](function(_0x61411a){if(_0x61411a){_0x11a6af=_0x61411a;_0x4bf761['model']=_[_0x5d08('0xc5')](db['User'][_0x5d08('0x31')]);_0x4bf761[_0x5d08('0x40')]=_[_0x5d08('0xc5')](_0x1ccb0a[_0x5d08('0x40')]);_0x4bf761[_0x5d08('0xc6')]=_['intersection'](_0x4bf761[_0x5d08('0xc4')],_0x4bf761[_0x5d08('0x40')]);_0x2e0d98[_0x5d08('0x44')]=_[_0x5d08('0xc7')](_0x4bf761[_0x5d08('0xc4')],qs[_0x5d08('0xcf')](_0x1ccb0a['query'][_0x5d08('0xcf')]));_0x2e0d98[_0x5d08('0x44')]=_0x2e0d98[_0x5d08('0x44')][_0x5d08('0x48')]?_0x2e0d98[_0x5d08('0x44')]:_0x4bf761['model'];_0x2e0d98[_0x5d08('0xc8')]=qs[_0x5d08('0xc9')](_0x1ccb0a[_0x5d08('0x40')]['sort']);_0x2e0d98[_0x5d08('0x3e')]=qs[_0x5d08('0xc6')](_[_0x5d08('0xca')](_0x1ccb0a[_0x5d08('0x40')],_0x4bf761[_0x5d08('0xc6')]));if(_0x1ccb0a[_0x5d08('0x40')][_0x5d08('0x34')]){_0x2e0d98[_0x5d08('0x3e')]=_[_0x5d08('0x50')](_0x2e0d98[_0x5d08('0x3e')],{'$or':_[_0x5d08('0x2a')](_0x2e0d98[_0x5d08('0x44')],function(_0xecad3d){var _0x1f856f={};_0x1f856f[_0xecad3d]={'$like':'%'+_0x1ccb0a[_0x5d08('0x40')]['filter']+'%'};return _0x1f856f;})});}_0x2e0d98[_0x5d08('0xc4')]=db[_0x5d08('0x3f')];_0x2e0d98['as']=_0x5d08('0x78');_0x2e0d98=_[_0x5d08('0x50')]({},_0x2e0d98,_0x1ccb0a[_0x5d08('0x51')]);return _0x11a6af[_0x5d08('0xeb')]({'include':[_0x2e0d98]});}})['then'](function(_0x36f829){if(_0x36f829){var _0x15855c={},_0x2d6d4c=[];for(var _0x247447=0x0;_0x247447<_0x36f829[_0x5d08('0x48')];_0x247447+=0x1){for(var _0x36cba7=0x0,_0x51d27b;_0x36cba7<_0x36f829[_0x247447][_0x5d08('0x78')][_0x5d08('0x48')];_0x36cba7+=0x1){_0x51d27b=_0x36f829[_0x247447][_0x5d08('0x78')][_0x36cba7][_0x5d08('0x23')]({'plain':!![]});_0x15855c[_0x51d27b['id']]=_0x51d27b;}}_0x15855c=_[_0x5d08('0x113')](_0x15855c);for(var _0x59cc4d=qs[_0x5d08('0x18')](_0x1ccb0a[_0x5d08('0x40')][_0x5d08('0x18')]);_0x59cc4d<_0x15855c[_0x5d08('0x48')]&&_0x2d6d4c[_0x5d08('0x48')]=_0x51890e[_0xc343('0x4d')]){throw new Error(_0xc343('0x4e'));}})[_0xc343('0x18')](function(){if(_0x476502){return db[_0xc343('0x2b')]['destroy']({'where':{'membername':_0x476502['name']},'individualHooks':!![]});}})[_0xc343('0x18')](function(){if(_0x476502){return _0x476502[_0xc343('0x4f')]({'raw':!![]});}})['then'](function(_0x59961f){if(_0x476502){if(_0x59961f){var _0x15886a=[];_0x2f6171=_0x59961f;if(_0x2f6171[_0xc343('0x2f')]){for(var _0x5d53d6=0x0;_0x5d53d6<_0x2f6171['length'];_0x5d53d6++){_0x15886a[_0xc343('0x32')](db[_0xc343('0x2b')]['upsert']({'membername':_0x476502[_0xc343('0x24')],'UserId':_0x476502['id'],'queue_name':_0x2f6171[_0x5d53d6][_0xc343('0x24')],'VoiceQueueId':_0x2f6171[_0x5d53d6]['id'],'interface':_0x369a4c,'paused':_0x476502[_0xc343('0x50')]||![],'penalty':_0x2f6171[_0x5d53d6][_0xc343('0x51')]||0x0}));}return BPromise[_0xc343('0x46')](_0x15886a);}}}})[_0xc343('0x18')](function(){if(_0x476502){return db[_0xc343('0x2d')][_0xc343('0xf')]({'where':{'membername':_0x476502[_0xc343('0x24')],'exitAt':null}});}})[_0xc343('0x18')](function(_0x1623b3){if(_0x476502){if(_0x1623b3&&_0x1623b3['length']){var _0x28eeb2=[];_0x1623b3[_0xc343('0x31')](function(_0x57cb74){_0x28eeb2[_0xc343('0x32')](_0x57cb74[_0xc343('0x2c')]({'exitAt':moment()[_0xc343('0x28')](_0xc343('0x30'))}));});return BPromise['all'](_0x28eeb2);}}})[_0xc343('0x18')](function(){if(_0x476502){var _0x42f5a4=[];var _0x2f1355=[];var _0x352363=utils[_0xc343('0x52')]();var _0x271999={'membername':_0x476502[_0xc343('0x24')],'interface':_0x369a4c,'enterAt':moment()[_0xc343('0x28')](_0xc343('0x30')),'role':_0x476502[_0xc343('0x25')],'internal':_0x476502['internal']};_0x352363[_0xc343('0x31')](function(_0x5c2df8){_0x42f5a4[_0xc343('0x32')](_[_0xc343('0x53')]({'channel':_0x5c2df8,'type':_0xc343('0x54'),'data1':_0xc343('0x55'),'data2':_0x369a4c},_0x271999));if(_0x476502[_0xc343('0x50')]){_0x2f1355[_0xc343('0x32')](_[_0xc343('0x53')]({'channel':_0x5c2df8,'type':_0xc343('0x2e'),'data1':_0xc343('0x56')},_0x271999));}});return db['MemberReport'][_0xc343('0x38')](_0x42f5a4[_0xc343('0x57')](_0x2f1355),{'individualHooks':!![]});}})['then'](function(){if(_0x476502){return _0x476502[_0xc343('0x2c')]({'online':!![],'lastLoginAt':moment()['format'](_0xc343('0x30')),'voicePause':_0x476502['loginInPause']||![],'mailPause':_0x476502[_0xc343('0x50')]||![],'chatPause':_0x476502[_0xc343('0x50')]||![],'faxPause':_0x476502[_0xc343('0x50')]||![],'smsPause':_0x476502[_0xc343('0x50')]||![],'openchannelPause':_0x476502[_0xc343('0x50')]||![],'pauseType':_0x476502['loginInPause']?_0xc343('0x56'):null,'lastPauseAt':moment()[_0xc343('0x28')](_0xc343('0x30')),'interface':_0x369a4c});}})['then'](function(_0x11ec7c){_0x33257f(_0x11ec7c);})[_0xc343('0x22')](function(_0x1e52b7){_0x10b920(_0x16e9e4['error'](0x1f4,_0x1e52b7[_0xc343('0x1d')]));});});}; \ No newline at end of file +var _0x43a8=['length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','push','isNil','SIP/%s','body','DEFAULT\x20PAUSE','uniqueid','MemberReport','bulkCreate','update','type','UnpauseUser','resolve','channel','findOne','online','voicePause','mailPause','chatPause','smsPause','whatsappPause','pauseType','User\x20with\x20id\x20%s\x20not\x20found','params','system','destroy','forEach','LoginUser','mobile','phone','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','upsert','UserVoiceQueue.penalty','all','getChannels','merge','LOGIN','callysquare','LOGININPAUSE','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','localhost','socket.io-emitter','./user.socket','register','GetUser','findAll','options','raw','attributes','limit','include','map','model','then','debug','catch','error','message','User','find','where','ShowUser','stringify','PauseUser','name','role','internal','interface','UserVoiceQueueRt','PAUSE'];(function(_0x282536,_0x3ba66a){var _0x76aa80=function(_0x1625ae){while(--_0x1625ae){_0x282536['push'](_0x282536['shift']());}};_0x76aa80(++_0x3ba66a);}(_0x43a8,0x1e8));var _0x843a=function(_0x42af38,_0x9c25ec){_0x42af38=_0x42af38-0x0;var _0x27065a=_0x43a8[_0x42af38];return _0x27065a;};'use strict';var _=require(_0x843a('0x0'));var util=require(_0x843a('0x1'));var moment=require(_0x843a('0x2'));var BPromise=require(_0x843a('0x3'));var Redis=require(_0x843a('0x4'));var db=require(_0x843a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x843a('0x6'))(_0x843a('0x7'));var config=require(_0x843a('0x8'));config['redis']=_['defaults'](config[_0x843a('0x9')],{'host':_0x843a('0xa'),'port':0x18eb});var socket=require(_0x843a('0xb'))(new Redis(config['redis']));require(_0x843a('0xc'))[_0x843a('0xd')](socket);exports[_0x843a('0xe')]=function(_0x393328){var _0x25d224=this;return new Promise(function(_0x39639d,_0x230476){return db['User'][_0x843a('0xf')]({'raw':_0x393328['options']?_0x393328[_0x843a('0x10')][_0x843a('0x11')]===undefined?!![]:![]:!![],'where':_0x393328[_0x843a('0x10')]?_0x393328['options']['where']||null:null,'attributes':_0x393328[_0x843a('0x10')]?_0x393328[_0x843a('0x10')][_0x843a('0x12')]||null:null,'limit':_0x393328['options']?_0x393328[_0x843a('0x10')][_0x843a('0x13')]||null:null,'include':_0x393328[_0x843a('0x10')]?_0x393328['options'][_0x843a('0x14')]?_['map'](_0x393328[_0x843a('0x10')][_0x843a('0x14')],function(_0x17c82d){return{'model':db[_0x17c82d['model']],'as':_0x17c82d['as'],'attributes':_0x17c82d[_0x843a('0x12')],'include':_0x17c82d[_0x843a('0x14')]?_[_0x843a('0x15')](_0x17c82d[_0x843a('0x14')],function(_0x16aae9){return{'model':db[_0x16aae9[_0x843a('0x16')]],'as':_0x16aae9['as'],'attributes':_0x16aae9[_0x843a('0x12')],'include':_0x16aae9[_0x843a('0x14')]?_['map'](_0x16aae9[_0x843a('0x14')],function(_0x1c6a32){return{'model':db[_0x1c6a32[_0x843a('0x16')]],'as':_0x1c6a32['as'],'attributes':_0x1c6a32[_0x843a('0x12')]};}):[]};}):[]};}):[]:[]})[_0x843a('0x17')](function(_0x2619af){logger['info'](_0x843a('0xe'),_0x393328);logger[_0x843a('0x18')]('GetUser',_0x393328,JSON['stringify'](_0x2619af));_0x39639d(_0x2619af);})[_0x843a('0x19')](function(_0x1350fa){logger[_0x843a('0x1a')]('GetUser',_0x1350fa[_0x843a('0x1b')],_0x393328);_0x230476(_0x25d224[_0x843a('0x1a')](0x1f4,_0x1350fa[_0x843a('0x1b')]));});});};exports['ShowUser']=function(_0xcb39ac){var _0x4b25b9=this;return new Promise(function(_0x38041d,_0x4faa55){return db[_0x843a('0x1c')][_0x843a('0x1d')]({'raw':_0xcb39ac[_0x843a('0x10')]?_0xcb39ac[_0x843a('0x10')][_0x843a('0x11')]===undefined?!![]:![]:!![],'where':_0xcb39ac['options']?_0xcb39ac['options'][_0x843a('0x1e')]||null:null,'attributes':_0xcb39ac[_0x843a('0x10')]?_0xcb39ac[_0x843a('0x10')][_0x843a('0x12')]||null:null,'include':_0xcb39ac[_0x843a('0x10')]?_0xcb39ac[_0x843a('0x10')][_0x843a('0x14')]?_[_0x843a('0x15')](_0xcb39ac[_0x843a('0x10')][_0x843a('0x14')],function(_0x2e29ef){return{'model':db[_0x2e29ef[_0x843a('0x16')]],'as':_0x2e29ef['as'],'attributes':_0x2e29ef[_0x843a('0x12')],'include':_0x2e29ef['include']?_[_0x843a('0x15')](_0x2e29ef[_0x843a('0x14')],function(_0x1d3d39){return{'model':db[_0x1d3d39[_0x843a('0x16')]],'as':_0x1d3d39['as'],'attributes':_0x1d3d39[_0x843a('0x12')],'include':_0x1d3d39[_0x843a('0x14')]?_['map'](_0x1d3d39[_0x843a('0x14')],function(_0xc3d7d5){return{'model':db[_0xc3d7d5[_0x843a('0x16')]],'as':_0xc3d7d5['as'],'attributes':_0xc3d7d5[_0x843a('0x12')]};}):[]};}):[]};}):[]:[]})[_0x843a('0x17')](function(_0x389eb1){logger['info'](_0x843a('0x1f'),_0xcb39ac);logger[_0x843a('0x18')](_0x843a('0x1f'),_0xcb39ac,JSON[_0x843a('0x20')](_0x389eb1));_0x38041d(_0x389eb1);})[_0x843a('0x19')](function(_0x3602b5){logger[_0x843a('0x1a')]('ShowUser',_0x3602b5['message'],_0xcb39ac);_0x4faa55(_0x4b25b9[_0x843a('0x1a')](0x1f4,_0x3602b5[_0x843a('0x1b')]));});});};exports[_0x843a('0x21')]=function(_0x3548e7){var _0x3bafa4;return db['User'][_0x843a('0x1d')]({'where':_0x3548e7[_0x843a('0x10')][_0x843a('0x1e')]||{},'attributes':['id',_0x843a('0x22'),_0x843a('0x23'),_0x843a('0x24'),_0x843a('0x25')]})[_0x843a('0x17')](function(_0x192c5e){if(!_0x192c5e){throw new Error(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x3548e7['params']['id']));}_0x3bafa4=_0x192c5e;return db[_0x843a('0x26')]['update']({'paused':0x1},{'where':{'UserId':_0x3bafa4['id']},'individualHooks':!![]});})[_0x843a('0x17')](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x3bafa4[_0x843a('0x22')],'type':_0x843a('0x27'),'exitAt':null}});})[_0x843a('0x17')](function(_0x15680f){if(_0x15680f&&_0x15680f[_0x843a('0x28')]){var _0x90a0b2=moment()[_0x843a('0x29')](_0x843a('0x2a'));for(var _0x4b2d01=0x0,_0x674b9a=_0x15680f[_0x843a('0x28')];_0x4b2d01<_0x674b9a;_0x4b2d01++){_0x15680f[_0x4b2d01][_0x843a('0x2b')]({'exitAt':_0x90a0b2});}}})['then'](function(){var _0xeff216=[];var _0x24a860=utils['getChannels']();_0x24a860['forEach'](function(_0x29481f){_0xeff216[_0x843a('0x2c')]({'channel':_0x29481f,'membername':_0x3bafa4[_0x843a('0x22')],'interface':_[_0x843a('0x2d')](_0x3bafa4[_0x843a('0x25')])?util[_0x843a('0x29')](_0x843a('0x2e'),_0x3bafa4[_0x843a('0x22')]):_0x3bafa4['interface'],'type':_0x843a('0x27'),'enterAt':moment()[_0x843a('0x29')](_0x843a('0x2a')),'data1':_0x3548e7[_0x843a('0x2f')]['type']||_0x843a('0x30'),'role':_0x3bafa4[_0x843a('0x23')],'internal':_0x3bafa4[_0x843a('0x24')],'uniqueid':_0x3548e7['body'][_0x843a('0x31')]||null});});return db[_0x843a('0x32')][_0x843a('0x33')](_0xeff216,{'individualHooks':!![]});})[_0x843a('0x17')](function(){return _0x3bafa4[_0x843a('0x34')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x3548e7[_0x843a('0x2f')][_0x843a('0x35')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0x843a('0x19')](function(_0x2afde9){throw _0x2afde9;});};exports[_0x843a('0x36')]=function(_0x198a83){return Promise[_0x843a('0x37')]()[_0x843a('0x17')](function(){if(_0x198a83[_0x843a('0x2f')][_0x843a('0x38')]&&!utils['isValidChannel'](_0x198a83['body'][_0x843a('0x38')])){throw new Error(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x198a83[_0x843a('0x2f')]['channel']));}return db['User'][_0x843a('0x39')]({'where':_0x198a83[_0x843a('0x10')][_0x843a('0x1e')]||{},'attributes':['id',_0x843a('0x22'),_0x843a('0x23'),_0x843a('0x24'),_0x843a('0x25'),_0x843a('0x3a'),_0x843a('0x3b'),_0x843a('0x3c'),_0x843a('0x3d'),'faxPause','openchannelPause',_0x843a('0x3e'),_0x843a('0x3f'),_0x843a('0x40'),'lastPauseAt']});})[_0x843a('0x17')](function(_0x567b82){if(!_0x567b82){throw new Error(util[_0x843a('0x29')](_0x843a('0x41'),_0x198a83[_0x843a('0x42')]['id']));}return _0x567b82['unpause'](_0x198a83[_0x843a('0x2f')][_0x843a('0x38')],_0x843a('0x43'));})[_0x843a('0x19')](function(_0x29ae52){throw _0x29ae52;});};exports['LogoutUser']=function(_0x581e83){var _0x4b3916=this;return new Promise(function(_0x224677,_0x355860){var _0x43d738;return db['User']['findOne']({'where':_0x581e83[_0x843a('0x10')]['where']||{},'attributes':['id','name']})[_0x843a('0x17')](function(_0x5ba5b4){if(_0x5ba5b4){_0x43d738=_0x5ba5b4;return db['UserVoiceQueueRt'][_0x843a('0x44')]({'where':{'membername':_0x43d738[_0x843a('0x22')]},'individualHooks':!![]});}})[_0x843a('0x17')](function(){if(_0x43d738){return db[_0x843a('0x32')][_0x843a('0xf')]({'where':{'membername':_0x43d738[_0x843a('0x22')],'exitAt':null}});}})[_0x843a('0x17')](function(_0x4a5df5){if(_0x43d738){if(_0x4a5df5&&_0x4a5df5[_0x843a('0x28')]){var _0x7b7f0e=[];_0x4a5df5[_0x843a('0x45')](function(_0x24599c){_0x7b7f0e[_0x843a('0x2c')](_0x24599c[_0x843a('0x34')]({'exitAt':moment()[_0x843a('0x29')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x7b7f0e);}}})[_0x843a('0x17')](function(){if(_0x43d738){return _0x43d738[_0x843a('0x34')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x843a('0x17')](function(_0x48a8ea){_0x224677(_0x48a8ea);})['catch'](function(_0x4e94c1){_0x355860(_0x4b3916[_0x843a('0x1a')](0x1f4,_0x4e94c1[_0x843a('0x1b')]));});});};exports[_0x843a('0x46')]=function(_0x1a6a3d){var _0x1fe341=this;return new Promise(function(_0x4eef52,_0x186f2b){var _0x56c4bc;var _0x29fe2c;var _0x4d3586;var _0x5d294e;return db['User'][_0x843a('0x39')]({'where':_0x1a6a3d[_0x843a('0x10')]['where']||{},'attributes':['id',_0x843a('0x22'),_0x843a('0x23'),_0x843a('0x47'),_0x843a('0x48'),_0x843a('0x24'),_0x843a('0x49'),_0x843a('0x25')]})[_0x843a('0x17')](function(_0x524a9a){if(_0x524a9a){_0x56c4bc=_0x524a9a;_0x5d294e=_0x1a6a3d['body'][_0x843a('0x25')]?_0x1a6a3d['body']['interface']:util['format']('SIP/%s',_0x56c4bc[_0x843a('0x22')]);return db['User'][_0x843a('0x4a')]({'where':{'role':_0x843a('0x4b'),'online':!![],'id':{'$ne':_0x56c4bc['id']}}});}})[_0x843a('0x17')](function(_0x370b17){if(_0x370b17){_0x4d3586=_0x370b17;return require(_0x843a('0x4c'))[_0x843a('0x4d')]();}})[_0x843a('0x17')](function(_0x40cf8e){if(_0x40cf8e&&_0x40cf8e['agents']&&_0x4d3586>=_0x40cf8e[_0x843a('0x4e')]){throw new Error(_0x843a('0x4f'));}})[_0x843a('0x17')](function(){if(_0x56c4bc){return db[_0x843a('0x26')][_0x843a('0x44')]({'where':{'membername':_0x56c4bc['name']},'individualHooks':!![]});}})[_0x843a('0x17')](function(){if(_0x56c4bc){return _0x56c4bc['getVoiceQueues']({'raw':!![]});}})[_0x843a('0x17')](function(_0x12ab4e){if(_0x56c4bc){if(_0x12ab4e){var _0x4a6820=[];_0x29fe2c=_0x12ab4e;if(_0x29fe2c[_0x843a('0x28')]){for(var _0x4dbc70=0x0;_0x4dbc70<_0x29fe2c['length'];_0x4dbc70++){_0x4a6820[_0x843a('0x2c')](db['UserVoiceQueueRt'][_0x843a('0x50')]({'membername':_0x56c4bc['name'],'UserId':_0x56c4bc['id'],'queue_name':_0x29fe2c[_0x4dbc70][_0x843a('0x22')],'VoiceQueueId':_0x29fe2c[_0x4dbc70]['id'],'interface':_0x5d294e,'paused':_0x56c4bc[_0x843a('0x49')]||![],'penalty':_0x29fe2c[_0x4dbc70][_0x843a('0x51')]||0x0}));}return BPromise[_0x843a('0x52')](_0x4a6820);}}}})[_0x843a('0x17')](function(){if(_0x56c4bc){return db[_0x843a('0x32')][_0x843a('0xf')]({'where':{'membername':_0x56c4bc[_0x843a('0x22')],'exitAt':null}});}})[_0x843a('0x17')](function(_0xb0a59f){if(_0x56c4bc){if(_0xb0a59f&&_0xb0a59f[_0x843a('0x28')]){var _0x2b46b7=[];_0xb0a59f['forEach'](function(_0x49a4f1){_0x2b46b7[_0x843a('0x2c')](_0x49a4f1['update']({'exitAt':moment()[_0x843a('0x29')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x843a('0x52')](_0x2b46b7);}}})[_0x843a('0x17')](function(){if(_0x56c4bc){var _0x4b38da=[];var _0x749007=[];var _0xd7e0e6=utils[_0x843a('0x53')]();var _0x39063a={'membername':_0x56c4bc[_0x843a('0x22')],'interface':_0x5d294e,'enterAt':moment()[_0x843a('0x29')](_0x843a('0x2a')),'role':_0x56c4bc[_0x843a('0x23')],'internal':_0x56c4bc[_0x843a('0x24')]};_0xd7e0e6[_0x843a('0x45')](function(_0x550337){_0x4b38da[_0x843a('0x2c')](_[_0x843a('0x54')]({'channel':_0x550337,'type':_0x843a('0x55'),'data1':_0x843a('0x56'),'data2':_0x5d294e},_0x39063a));if(_0x56c4bc[_0x843a('0x49')]){_0x749007[_0x843a('0x2c')](_[_0x843a('0x54')]({'channel':_0x550337,'type':_0x843a('0x27'),'data1':_0x843a('0x57')},_0x39063a));}});return db[_0x843a('0x32')][_0x843a('0x33')](_0x4b38da['concat'](_0x749007),{'individualHooks':!![]});}})[_0x843a('0x17')](function(){if(_0x56c4bc){return _0x56c4bc[_0x843a('0x34')]({'online':!![],'lastLoginAt':moment()[_0x843a('0x29')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x56c4bc[_0x843a('0x49')]||![],'mailPause':_0x56c4bc[_0x843a('0x49')]||![],'chatPause':_0x56c4bc[_0x843a('0x49')]||![],'faxPause':_0x56c4bc['loginInPause']||![],'smsPause':_0x56c4bc[_0x843a('0x49')]||![],'openchannelPause':_0x56c4bc[_0x843a('0x49')]||![],'pauseType':_0x56c4bc['loginInPause']?'LOGININPAUSE':null,'lastPauseAt':moment()['format'](_0x843a('0x2a')),'interface':_0x5d294e});}})[_0x843a('0x17')](function(_0x91db07){_0x4eef52(_0x91db07);})[_0x843a('0x19')](function(_0x3a1a77){_0x186f2b(_0x1fe341['error'](0x1f4,_0x3a1a77['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 971635d..b4d48bb 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 _0xf260=['./user.events','save','update','emit','removeListener','register','length','user:'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xf260,0x80));var _0x0f26=function(_0x228a4a,_0x23d65e){_0x228a4a=_0x228a4a-0x0;var _0x3d3937=_0xf260[_0x228a4a];return _0x3d3937;};'use strict';var UserEvents=require(_0x0f26('0x0'));var events=[_0x0f26('0x1'),'remove',_0x0f26('0x2')];function createListener(_0x2d7914,_0x43c868){return function(_0x30561e){_0x43c868[_0x0f26('0x3')](_0x2d7914,_0x30561e);};}function removeListener(_0x50065c,_0x577fca){return function(){UserEvents[_0x0f26('0x4')](_0x50065c,_0x577fca);};}exports[_0x0f26('0x5')]=function(_0x116145){for(var _0x168c6b=0x0,_0x3a8b11=events[_0x0f26('0x6')];_0x168c6b<_0x3a8b11;_0x168c6b++){var _0x267917=events[_0x168c6b];var _0x131e6f=createListener(_0x0f26('0x7')+_0x267917,_0x116145);UserEvents['on'](_0x267917,_0x131e6f);}}; \ No newline at end of file +var _0x6642=['register','length','user:','./user.events','update','removeListener'];(function(_0x3dc477,_0x3670c9){var _0x3fc1a8=function(_0x149e8b){while(--_0x149e8b){_0x3dc477['push'](_0x3dc477['shift']());}};_0x3fc1a8(++_0x3670c9);}(_0x6642,0xed));var _0x2664=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6642[_0x3dd15e];return _0x231fd0;};'use strict';var UserEvents=require(_0x2664('0x0'));var events=['save','remove',_0x2664('0x1')];function createListener(_0x2ad635,_0x4723f3){return function(_0x39251a){_0x4723f3['emit'](_0x2ad635,_0x39251a);};}function removeListener(_0x553903,_0x5c5c4c){return function(){UserEvents[_0x2664('0x2')](_0x553903,_0x5c5c4c);};}exports[_0x2664('0x3')]=function(_0x65d277){for(var _0x52d467=0x0,_0x1804ed=events[_0x2664('0x4')];_0x52d467<_0x1804ed;_0x52d467++){var _0x12f7d7=events[_0x52d467];var _0x35c1ba=createListener(_0x2664('0x5')+_0x12f7d7,_0x65d277);UserEvents['on'](_0x12f7d7,_0x35c1ba);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index fea2586..4577e32 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(_0x534b0c,_0x17e0d3){var _0x570be4=function(_0x3d63e3){while(--_0x3d63e3){_0x534b0c['push'](_0x534b0c['shift']());}};_0x570be4(++_0x17e0d3);}(_0xe706,0xa3));var _0x6e70=function(_0x41d02a,_0x355e19){_0x41d02a=_0x41d02a-0x0;var _0x4c3983=_0xe706[_0x41d02a];return _0x4c3983;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x489b01,_0x597248){var _0x5dcc6c=function(_0xf8a48e){while(--_0xf8a48e){_0x489b01['push'](_0x489b01['shift']());}};_0x5dcc6c(++_0x597248);}(_0x9c44,0x178));var _0x49c4=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9c44[_0x3ff085];return _0x2b68c3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index e81b782..fb1c9ee 100644 --- a/server/api/userChatQueue/userChatQueue.attributes.js +++ b/server/api/userChatQueue/userChatQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa3c=['exports','INTEGER','sequelize'];(function(_0x2bfa86,_0x34bb3c){var _0xf15627=function(_0x3a930d){while(--_0x3a930d){_0x2bfa86['push'](_0x2bfa86['shift']());}};_0xf15627(++_0x34bb3c);}(_0xaa3c,0xb3));var _0xcaa3=function(_0xf8118f,_0x4a1087){_0xf8118f=_0xf8118f-0x0;var _0x8018c5=_0xaa3c[_0xf8118f];return _0x8018c5;};'use strict';var Sequelize=require(_0xcaa3('0x0'));module[_0xcaa3('0x1')]={'penalty':{'type':Sequelize[_0xcaa3('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xcbe5=['INTEGER','sequelize','exports'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0xcbe5,0xee));var _0x5cbe=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xcbe5[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require(_0x5cbe('0x0'));module[_0x5cbe('0x1')]={'penalty':{'type':Sequelize[_0x5cbe('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 0c25c0d..0a344dd 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 _0xbd9d=['bluebird','request-promise','path','rimraf','./userChatQueue.attributes','exports','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','moment'];(function(_0x44f0a1,_0x457d11){var _0x4af42e=function(_0x15fcbf){while(--_0x15fcbf){_0x44f0a1['push'](_0x44f0a1['shift']());}};_0x4af42e(++_0x457d11);}(_0xbd9d,0x1b5));var _0xdbd9=function(_0x35f4f8,_0x578df6){_0x35f4f8=_0x35f4f8-0x0;var _0x5f4a22=_0xbd9d[_0x35f4f8];return _0x5f4a22;};'use strict';var _=require(_0xdbd9('0x0'));var util=require(_0xdbd9('0x1'));var logger=require(_0xdbd9('0x2'))(_0xdbd9('0x3'));var moment=require(_0xdbd9('0x4'));var BPromise=require(_0xdbd9('0x5'));var rp=require(_0xdbd9('0x6'));var fs=require('fs');var path=require(_0xdbd9('0x7'));var rimraf=require(_0xdbd9('0x8'));var config=require('../../config/environment');var attributes=require(_0xdbd9('0x9'));module[_0xdbd9('0xa')]=function(_0x3b1999,_0xba102f){return _0x3b1999['define'](_0xdbd9('0xb'),attributes,{'tableName':_0xdbd9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc5d9=['define','user_has_chat_queues','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x8346f1,_0x5a67dd){var _0x24abb7=function(_0x48cdb9){while(--_0x48cdb9){_0x8346f1['push'](_0x8346f1['shift']());}};_0x24abb7(++_0x5a67dd);}(_0xc5d9,0x91));var _0x9c5d=function(_0x577831,_0x5b8f90){_0x577831=_0x577831-0x0;var _0x181033=_0xc5d9[_0x577831];return _0x181033;};'use strict';var _=require('lodash');var util=require(_0x9c5d('0x0'));var logger=require('../../config/logger')(_0x9c5d('0x1'));var moment=require(_0x9c5d('0x2'));var BPromise=require(_0x9c5d('0x3'));var rp=require(_0x9c5d('0x4'));var fs=require('fs');var path=require(_0x9c5d('0x5'));var rimraf=require(_0x9c5d('0x6'));var config=require(_0x9c5d('0x7'));var attributes=require('./userChatQueue.attributes');module[_0x9c5d('0x8')]=function(_0x5a756a,_0x43e042){return _0x5a756a[_0x9c5d('0x9')]('UserChatQueue',attributes,{'tableName':_0x9c5d('0xa'),'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 5bafb9a..73bbcaf 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 _0x7eab=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7eab,0x1b2));var _0xb7ea=function(_0x66a21e,_0x102645){_0x66a21e=_0x66a21e-0x0;var _0x4fa0a4=_0x7eab[_0x66a21e];return _0x4fa0a4;};'use strict';var _=require(_0xb7ea('0x0'));var util=require(_0xb7ea('0x1'));var moment=require('moment');var BPromise=require(_0xb7ea('0x2'));var rs=require(_0xb7ea('0x3'));var fs=require('fs');var Redis=require(_0xb7ea('0x4'));var db=require(_0xb7ea('0x5'))['db'];var utils=require(_0xb7ea('0x6'));var logger=require(_0xb7ea('0x7'))(_0xb7ea('0x8'));var config=require(_0xb7ea('0x9'));var jayson=require(_0xb7ea('0xa'));var client=jayson[_0xb7ea('0xb')][_0xb7ea('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x196d1a,_0x3e76ed,_0x2ace9f){return new BPromise(function(_0x9bfff1,_0x17ada9){return client[_0xb7ea('0xd')](_0x196d1a,_0x2ace9f)[_0xb7ea('0xe')](function(_0xe218b9){logger[_0xb7ea('0xf')](_0xb7ea('0x10'),_0x3e76ed,_0xb7ea('0x11'));logger['debug']('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x3e76ed,_0xb7ea('0x11'),JSON[_0xb7ea('0x12')](_0xe218b9));if(_0xe218b9[_0xb7ea('0x13')]){if(_0xe218b9[_0xb7ea('0x13')][_0xb7ea('0x14')]===0x1f4){logger[_0xb7ea('0x13')]('UserChatQueue,\x20%s,\x20%s',_0x3e76ed,_0xe218b9['error'][_0xb7ea('0x15')]);return _0x17ada9(_0xe218b9['error'][_0xb7ea('0x15')]);}logger[_0xb7ea('0x13')]('UserChatQueue,\x20%s,\x20%s',_0x3e76ed,_0xe218b9[_0xb7ea('0x13')][_0xb7ea('0x15')]);return _0x9bfff1(_0xe218b9[_0xb7ea('0x13')][_0xb7ea('0x15')]);}else{logger[_0xb7ea('0xf')](_0xb7ea('0x10'),_0x3e76ed,_0xb7ea('0x11'));_0x9bfff1(_0xe218b9[_0xb7ea('0x16')]['message']);}})[_0xb7ea('0x17')](function(_0x3ebc47){logger[_0xb7ea('0x13')](_0xb7ea('0x10'),_0x3e76ed,_0x3ebc47);_0x17ada9(_0x3ebc47);});});} \ No newline at end of file +var _0x8078=['then','info','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x5f2a50,_0x4700e0){var _0x7577ca=function(_0x45f47e){while(--_0x45f47e){_0x5f2a50['push'](_0x5f2a50['shift']());}};_0x7577ca(++_0x4700e0);}(_0x8078,0x1d3));var _0x8807=function(_0x295bcc,_0x3a69a0){_0x295bcc=_0x295bcc-0x0;var _0x245893=_0x8078[_0x295bcc];return _0x245893;};'use strict';var _=require(_0x8807('0x0'));var util=require('util');var moment=require(_0x8807('0x1'));var BPromise=require(_0x8807('0x2'));var rs=require(_0x8807('0x3'));var fs=require('fs');var Redis=require(_0x8807('0x4'));var db=require(_0x8807('0x5'))['db'];var utils=require(_0x8807('0x6'));var logger=require(_0x8807('0x7'))('rpc');var config=require(_0x8807('0x8'));var jayson=require(_0x8807('0x9'));var client=jayson[_0x8807('0xa')][_0x8807('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19cf68,_0x24eaa4,_0xda8f84){return new BPromise(function(_0x4d0885,_0x4c7f76){return client[_0x8807('0xc')](_0x19cf68,_0xda8f84)[_0x8807('0xd')](function(_0x1cd6c1){logger[_0x8807('0xe')]('UserChatQueue,\x20%s,\x20%s',_0x24eaa4,'request\x20sent');logger[_0x8807('0xf')](_0x8807('0x10'),_0x24eaa4,_0x8807('0x11'),JSON[_0x8807('0x12')](_0x1cd6c1));if(_0x1cd6c1['error']){if(_0x1cd6c1[_0x8807('0x13')][_0x8807('0x14')]===0x1f4){logger[_0x8807('0x13')](_0x8807('0x15'),_0x24eaa4,_0x1cd6c1[_0x8807('0x13')][_0x8807('0x16')]);return _0x4c7f76(_0x1cd6c1[_0x8807('0x13')]['message']);}logger[_0x8807('0x13')](_0x8807('0x15'),_0x24eaa4,_0x1cd6c1[_0x8807('0x13')][_0x8807('0x16')]);return _0x4d0885(_0x1cd6c1['error']['message']);}else{logger[_0x8807('0xe')]('UserChatQueue,\x20%s,\x20%s',_0x24eaa4,'request\x20sent');_0x4d0885(_0x1cd6c1[_0x8807('0x17')][_0x8807('0x16')]);}})['catch'](function(_0x4946ed){logger[_0x8807('0x13')]('UserChatQueue,\x20%s,\x20%s',_0x24eaa4,_0x4946ed);_0x4c7f76(_0x4946ed);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 3a4579f..507991e 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0xac218e,_0x4a3a42){var _0x513b6d=function(_0x9155fa){while(--_0x9155fa){_0xac218e['push'](_0xac218e['shift']());}};_0x513b6d(++_0x4a3a42);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x220fa9,_0x4255fb){var _0x518ed5=function(_0x280cd9){while(--_0x280cd9){_0x220fa9['push'](_0x220fa9['shift']());}};_0x518ed5(++_0x4255fb);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index d4645de..5e0a8dc 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 _0x7d3f=['STRING','sequelize','INTEGER'];(function(_0x4a9d70,_0x47fbb5){var _0x11b3a6=function(_0x33b721){while(--_0x33b721){_0x4a9d70['push'](_0x4a9d70['shift']());}};_0x11b3a6(++_0x47fbb5);}(_0x7d3f,0x175));var _0xf7d3=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x7d3f[_0x2b5eae];return _0x5f3ac9;};'use strict';var Sequelize=require(_0xf7d3('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xf7d3('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xf7d3('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xf7d3('0x2')]}}; \ No newline at end of file +var _0xf0fb=['STRING','exports','INTEGER'];(function(_0x526cee,_0x4752f5){var _0x318f56=function(_0x527f66){while(--_0x527f66){_0x526cee['push'](_0x526cee['shift']());}};_0x318f56(++_0x4752f5);}(_0xf0fb,0x1e7));var _0xbf0f=function(_0x913b85,_0x213182){_0x913b85=_0x913b85-0x0;var _0x1ce434=_0xf0fb[_0x913b85];return _0x1ce434;};'use strict';var Sequelize=require('sequelize');module[_0xbf0f('0x0')]={'penalty':{'type':Sequelize[_0xbf0f('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xbf0f('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xbf0f('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 8871d42..b1bdbf0 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 _0x4b8c=['request-promise','path','rimraf','exports','define','UserFaxQueue','user_has_fax_queues','lodash','../../config/logger','moment','bluebird'];(function(_0xafb8e6,_0x4b3a6b){var _0x36eec3=function(_0x30af02){while(--_0x30af02){_0xafb8e6['push'](_0xafb8e6['shift']());}};_0x36eec3(++_0x4b3a6b);}(_0x4b8c,0x10f));var _0xc4b8=function(_0xac7ae2,_0x449f86){_0xac7ae2=_0xac7ae2-0x0;var _0x1b0092=_0x4b8c[_0xac7ae2];return _0x1b0092;};'use strict';var _=require(_0xc4b8('0x0'));var util=require('util');var logger=require(_0xc4b8('0x1'))('api');var moment=require(_0xc4b8('0x2'));var BPromise=require(_0xc4b8('0x3'));var rp=require(_0xc4b8('0x4'));var fs=require('fs');var path=require(_0xc4b8('0x5'));var rimraf=require(_0xc4b8('0x6'));var config=require('../../config/environment');var attributes=require('./userFaxQueue.attributes');module[_0xc4b8('0x7')]=function(_0x337ac7,_0x3944e4){return _0x337ac7[_0xc4b8('0x8')](_0xc4b8('0x9'),attributes,{'tableName':_0xc4b8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x216e=['UserFaxQueue','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','define'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x216e,0x121));var _0xe216=function(_0x3e5d83,_0x44d303){_0x3e5d83=_0x3e5d83-0x0;var _0x22bef2=_0x216e[_0x3e5d83];return _0x22bef2;};'use strict';var _=require(_0xe216('0x0'));var util=require(_0xe216('0x1'));var logger=require(_0xe216('0x2'))(_0xe216('0x3'));var moment=require(_0xe216('0x4'));var BPromise=require('bluebird');var rp=require(_0xe216('0x5'));var fs=require('fs');var path=require(_0xe216('0x6'));var rimraf=require(_0xe216('0x7'));var config=require(_0xe216('0x8'));var attributes=require(_0xe216('0x9'));module['exports']=function(_0x1c9d54,_0x2d3cbc){return _0x1c9d54[_0xe216('0xa')](_0xe216('0xb'),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 4d3db95..7ea72ce 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 _0x408b=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','error','code','UserFaxQueue,\x20%s,\x20%s','message','result'];(function(_0x5207b3,_0x2034d3){var _0x487c33=function(_0x3d0ddc){while(--_0x3d0ddc){_0x5207b3['push'](_0x5207b3['shift']());}};_0x487c33(++_0x2034d3);}(_0x408b,0x1e6));var _0xb408=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x408b[_0x36eaaa];return _0x461349;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb408('0x0'));var BPromise=require('bluebird');var rs=require(_0xb408('0x1'));var fs=require('fs');var Redis=require(_0xb408('0x2'));var db=require(_0xb408('0x3'))['db'];var utils=require(_0xb408('0x4'));var logger=require(_0xb408('0x5'))('rpc');var config=require(_0xb408('0x6'));var jayson=require(_0xb408('0x7'));var client=jayson['client'][_0xb408('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x365d20,_0x28038b,_0x1c28ae){return new BPromise(function(_0x23dac4,_0xafe394){return client[_0xb408('0x9')](_0x365d20,_0x1c28ae)[_0xb408('0xa')](function(_0x589e19){logger[_0xb408('0xb')]('UserFaxQueue,\x20%s,\x20%s',_0x28038b,_0xb408('0xc'));logger['debug']('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x28038b,_0xb408('0xc'),JSON['stringify'](_0x589e19));if(_0x589e19[_0xb408('0xd')]){if(_0x589e19[_0xb408('0xd')][_0xb408('0xe')]===0x1f4){logger['error'](_0xb408('0xf'),_0x28038b,_0x589e19[_0xb408('0xd')][_0xb408('0x10')]);return _0xafe394(_0x589e19[_0xb408('0xd')][_0xb408('0x10')]);}logger[_0xb408('0xd')](_0xb408('0xf'),_0x28038b,_0x589e19[_0xb408('0xd')]['message']);return _0x23dac4(_0x589e19[_0xb408('0xd')][_0xb408('0x10')]);}else{logger[_0xb408('0xb')](_0xb408('0xf'),_0x28038b,'request\x20sent');_0x23dac4(_0x589e19[_0xb408('0x11')][_0xb408('0x10')]);}})['catch'](function(_0x50d17d){logger[_0xb408('0xd')](_0xb408('0xf'),_0x28038b,_0x50d17d);_0xafe394(_0x50d17d);});});} \ No newline at end of file +var _0x8779=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','moment','bluebird'];(function(_0x55e1d1,_0x3c9376){var _0x1165db=function(_0x5b0120){while(--_0x5b0120){_0x55e1d1['push'](_0x55e1d1['shift']());}};_0x1165db(++_0x3c9376);}(_0x8779,0x1e0));var _0x9877=function(_0x26ea35,_0x26899c){_0x26ea35=_0x26ea35-0x0;var _0x284134=_0x8779[_0x26ea35];return _0x284134;};'use strict';var _=require(_0x9877('0x0'));var util=require('util');var moment=require(_0x9877('0x1'));var BPromise=require(_0x9877('0x2'));var rs=require(_0x9877('0x3'));var fs=require('fs');var Redis=require(_0x9877('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9877('0x5'));var logger=require(_0x9877('0x6'))(_0x9877('0x7'));var config=require(_0x9877('0x8'));var jayson=require(_0x9877('0x9'));var client=jayson[_0x9877('0xa')][_0x9877('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x325a0a,_0x4f86ca,_0x24ec68){return new BPromise(function(_0xa9a806,_0x395b4f){return client[_0x9877('0xc')](_0x325a0a,_0x24ec68)[_0x9877('0xd')](function(_0x41d061){logger[_0x9877('0xe')](_0x9877('0xf'),_0x4f86ca,'request\x20sent');logger[_0x9877('0x10')](_0x9877('0x11'),_0x4f86ca,_0x9877('0x12'),JSON['stringify'](_0x41d061));if(_0x41d061['error']){if(_0x41d061[_0x9877('0x13')][_0x9877('0x14')]===0x1f4){logger['error'](_0x9877('0xf'),_0x4f86ca,_0x41d061[_0x9877('0x13')][_0x9877('0x15')]);return _0x395b4f(_0x41d061[_0x9877('0x13')]['message']);}logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x4f86ca,_0x41d061['error']['message']);return _0xa9a806(_0x41d061[_0x9877('0x13')][_0x9877('0x15')]);}else{logger[_0x9877('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x4f86ca,'request\x20sent');_0xa9a806(_0x41d061['result'][_0x9877('0x15')]);}})[_0x9877('0x16')](function(_0xcad664){logger['error'](_0x9877('0xf'),_0x4f86ca,_0xcad664);_0x395b4f(_0xcad664);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index f1139f7..7353e8b 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x39dc6a,_0x42f379){var _0x1aed2f=function(_0x5cefb5){while(--_0x5cefb5){_0x39dc6a['push'](_0x39dc6a['shift']());}};_0x1aed2f(++_0x42f379);}(_0xe706,0xa3));var _0x6e70=function(_0x456904,_0x4cb25c){_0x456904=_0x456904-0x0;var _0x4b0063=_0xe706[_0x456904];return _0x4b0063;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4f00b2,_0x43d128){var _0x49fa5d=function(_0x37824b){while(--_0x37824b){_0x4f00b2['push'](_0x4f00b2['shift']());}};_0x49fa5d(++_0x43d128);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5756c6,_0x58290a){_0x5756c6=_0x5756c6-0x0;var _0x4b5806=_0xcb91[_0x5756c6];return _0x4b5806;};'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 8ea99f2..2618b5e 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 _0x5845=['exports','INTEGER','sequelize'];(function(_0x104a84,_0x285970){var _0x4973ff=function(_0x5064e7){while(--_0x5064e7){_0x104a84['push'](_0x104a84['shift']());}};_0x4973ff(++_0x285970);}(_0x5845,0x80));var _0x5584=function(_0x49ade0,_0x29ebe4){_0x49ade0=_0x49ade0-0x0;var _0x34b9d2=_0x5845[_0x49ade0];return _0x34b9d2;};'use strict';var Sequelize=require(_0x5584('0x0'));module[_0x5584('0x1')]={'penalty':{'type':Sequelize[_0x5584('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0b03=['exports','INTEGER','sequelize'];(function(_0x3c1c93,_0x37a5a5){var _0x1bd4d4=function(_0x160615){while(--_0x160615){_0x3c1c93['push'](_0x3c1c93['shift']());}};_0x1bd4d4(++_0x37a5a5);}(_0x0b03,0x19a));var _0x30b0=function(_0x4fd56e,_0x52db7c){_0x4fd56e=_0x4fd56e-0x0;var _0x80b7d2=_0x0b03[_0x4fd56e];return _0x80b7d2;};'use strict';var Sequelize=require(_0x30b0('0x0'));module[_0x30b0('0x1')]={'penalty':{'type':Sequelize[_0x30b0('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 8dd67f1..9a4fab7 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 _0xcf77=['moment','bluebird','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','lodash','util','../../config/logger','api'];(function(_0x33aaed,_0x11dd47){var _0x11f6e7=function(_0x582b84){while(--_0x582b84){_0x33aaed['push'](_0x33aaed['shift']());}};_0x11f6e7(++_0x11dd47);}(_0xcf77,0x134));var _0x7cf7=function(_0x1a104e,_0x2ddb65){_0x1a104e=_0x1a104e-0x0;var _0x131002=_0xcf77[_0x1a104e];return _0x131002;};'use strict';var _=require(_0x7cf7('0x0'));var util=require(_0x7cf7('0x1'));var logger=require(_0x7cf7('0x2'))(_0x7cf7('0x3'));var moment=require(_0x7cf7('0x4'));var BPromise=require(_0x7cf7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7cf7('0x6'));var rimraf=require(_0x7cf7('0x7'));var config=require(_0x7cf7('0x8'));var attributes=require(_0x7cf7('0x9'));module[_0x7cf7('0xa')]=function(_0x4f6cc2,_0x485303){return _0x4f6cc2[_0x7cf7('0xb')](_0x7cf7('0xc'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9bf7=['exports','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userMailQueue.attributes'];(function(_0x5ee507,_0x59e998){var _0x223caf=function(_0x39bfad){while(--_0x39bfad){_0x5ee507['push'](_0x5ee507['shift']());}};_0x223caf(++_0x59e998);}(_0x9bf7,0x162));var _0x79bf=function(_0x254fd4,_0x1a100b){_0x254fd4=_0x254fd4-0x0;var _0x17a264=_0x9bf7[_0x254fd4];return _0x17a264;};'use strict';var _=require(_0x79bf('0x0'));var util=require(_0x79bf('0x1'));var logger=require(_0x79bf('0x2'))(_0x79bf('0x3'));var moment=require(_0x79bf('0x4'));var BPromise=require(_0x79bf('0x5'));var rp=require(_0x79bf('0x6'));var fs=require('fs');var path=require(_0x79bf('0x7'));var rimraf=require('rimraf');var config=require(_0x79bf('0x8'));var attributes=require(_0x79bf('0x9'));module[_0x79bf('0xa')]=function(_0x3a1b76,_0x1c1422){return _0x3a1b76[_0x79bf('0xb')](_0x79bf('0xc'),attributes,{'tableName':_0x79bf('0xd'),'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 f1e2555..cdbd341 100644 --- a/server/api/userMailQueue/userMailQueue.rpc.js +++ b/server/api/userMailQueue/userMailQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_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 +var _0xa41a=['rpc','../../config/environment','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4209a7,_0x350b11){var _0x5119fa=function(_0x2807b1){while(--_0x2807b1){_0x4209a7['push'](_0x4209a7['shift']());}};_0x5119fa(++_0x350b11);}(_0xa41a,0x6b));var _0xaa41=function(_0x47b6ff,_0xc8344a){_0x47b6ff=_0x47b6ff-0x0;var _0x306227=_0xa41a[_0x47b6ff];return _0x306227;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index e58187b..fc3dbd9 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 _0xb052=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','post','isAuthenticated','sendUserNotification','exports','multer','util','path','connect-timeout','express','Router'];(function(_0xf7fe97,_0x432968){var _0x55b1a5=function(_0x8897a1){while(--_0x8897a1){_0xf7fe97['push'](_0xf7fe97['shift']());}};_0x55b1a5(++_0x432968);}(_0xb052,0xb0));var _0x2b05=function(_0x28fbbf,_0x11f896){_0x28fbbf=_0x28fbbf-0x0;var _0x543af6=_0xb052[_0x28fbbf];return _0x543af6;};'use strict';var multer=require(_0x2b05('0x0'));var util=require(_0x2b05('0x1'));var path=require(_0x2b05('0x2'));var timeout=require(_0x2b05('0x3'));var express=require(_0x2b05('0x4'));var router=express[_0x2b05('0x5')]();var fs_extra=require(_0x2b05('0x6'));var auth=require(_0x2b05('0x7'));var interaction=require(_0x2b05('0x8'));var config=require(_0x2b05('0x9'));var controller=require('./userNotification.controller');router[_0x2b05('0xa')]('/',auth[_0x2b05('0xb')](),controller[_0x2b05('0xc')]);module[_0x2b05('0xd')]=router; \ No newline at end of file +var _0xabad=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','post','isAuthenticated','sendUserNotification','exports','multer','util','path','express','Router'];(function(_0x48f532,_0x116847){var _0x558b6c=function(_0x382120){while(--_0x382120){_0x48f532['push'](_0x48f532['shift']());}};_0x558b6c(++_0x116847);}(_0xabad,0x1b5));var _0xdaba=function(_0x1d0b80,_0x41fc24){_0x1d0b80=_0x1d0b80-0x0;var _0x35d642=_0xabad[_0x1d0b80];return _0x35d642;};'use strict';var multer=require(_0xdaba('0x0'));var util=require(_0xdaba('0x1'));var path=require(_0xdaba('0x2'));var timeout=require('connect-timeout');var express=require(_0xdaba('0x3'));var router=express[_0xdaba('0x4')]();var fs_extra=require(_0xdaba('0x5'));var auth=require(_0xdaba('0x6'));var interaction=require(_0xdaba('0x7'));var config=require(_0xdaba('0x8'));var controller=require('./userNotification.controller');router[_0xdaba('0x9')]('/',auth[_0xdaba('0xa')](),controller[_0xdaba('0xb')]);module[_0xdaba('0xc')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index da5e05f..cac0f30 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 _0x8cd9=['BOOLEAN','exports','TEXT','STRING'];(function(_0xd3dba8,_0x4ddede){var _0x4795e8=function(_0xc1bca){while(--_0xc1bca){_0xd3dba8['push'](_0xd3dba8['shift']());}};_0x4795e8(++_0x4ddede);}(_0x8cd9,0x175));var _0x98cd=function(_0x10edea,_0x2b5516){_0x10edea=_0x10edea-0x0;var _0x3780ee=_0x8cd9[_0x10edea];return _0x3780ee;};'use strict';var Sequelize=require('sequelize');module[_0x98cd('0x0')]={'body':{'type':Sequelize[_0x98cd('0x1')]},'senderName':{'type':Sequelize[_0x98cd('0x2')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x98cd('0x3')]}}; \ No newline at end of file +var _0x3d42=['STRING','TEXT','BOOLEAN','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3d42,0x107));var _0x23d4=function(_0x4adef5,_0x153611){_0x4adef5=_0x4adef5-0x0;var _0xbafb6d=_0x3d42[_0x4adef5];return _0xbafb6d;};'use strict';var Sequelize=require(_0x23d4('0x0'));module[_0x23d4('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x23d4('0x2')]},'recipientsId':{'type':Sequelize[_0x23d4('0x3')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x23d4('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index e69e84f..f0a7930 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 _0x6c12=['../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','status','end','offset','limit','undefined','count','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','sendUserNotification','body','hasOwnProperty','TemplateId','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','ValidationError','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','openchannelqueue','smsqueue','voicequeue','user','some','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','isEmpty','recipientsDescription','beep','join','sequelize','UserNotification','create','recipient','emit','userNotification:send','catch','text','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','forEach','User','union','queue','replace','ids','push','all','flatten','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x6c12,0x112));var _0x26c1=function(_0x1ebe90,_0x5d29fc){_0x1ebe90=_0x1ebe90-0x0;var _0x447c82=_0x6c12[_0x1ebe90];return _0x447c82;};'use strict';var emlformat=require(_0x26c1('0x0'));var rimraf=require(_0x26c1('0x1'));var zipdir=require(_0x26c1('0x2'));var jsonpatch=require(_0x26c1('0x3'));var rp=require(_0x26c1('0x4'));var moment=require(_0x26c1('0x5'));var BPromise=require(_0x26c1('0x6'));var Mustache=require(_0x26c1('0x7'));var util=require(_0x26c1('0x8'));var path=require(_0x26c1('0x9'));var sox=require(_0x26c1('0xa'));var csv=require(_0x26c1('0xb'));var ejs=require(_0x26c1('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x26c1('0xd'));var squel=require(_0x26c1('0xe'));var crypto=require(_0x26c1('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x26c1('0xb'));var querystring=require(_0x26c1('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x26c1('0x11'));var qs=require(_0x26c1('0x12'));var as=require(_0x26c1('0x13'));var hardwareService=require(_0x26c1('0x14'));var logger=require(_0x26c1('0x15'))(_0x26c1('0x16'));var utils=require(_0x26c1('0x17'));var config=require(_0x26c1('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x26c1('0x19'))['db'];config['redis']=_[_0x26c1('0x1a')](config[_0x26c1('0x1b')],{'host':_0x26c1('0x1c'),'port':0x18eb});var socket=require(_0x26c1('0x1d'))(new Redis(config[_0x26c1('0x1b')]));require('./userNotification.socket')['register'](socket);function respondWithStatusCode(_0x29d067,_0x82822d){_0x82822d=_0x82822d||0xcc;return function(_0x2faf34){if(_0x2faf34){return _0x29d067['sendStatus'](_0x82822d);}return _0x29d067[_0x26c1('0x1e')](_0x82822d)[_0x26c1('0x1f')]();};}function respondWithResult(_0x2a2598,_0x54c6c1){_0x54c6c1=_0x54c6c1||0xc8;return function(_0x4a9a85){if(_0x4a9a85){return _0x2a2598[_0x26c1('0x1e')](_0x54c6c1)['json'](_0x4a9a85);}};}function respondWithFilteredResult(_0x5a87be,_0xd5ee6d){return function(_0x119aa6){if(_0x119aa6){var _0x4d0387=typeof _0xd5ee6d[_0x26c1('0x20')]==='undefined'&&typeof _0xd5ee6d[_0x26c1('0x21')]===_0x26c1('0x22');var _0x3f8a2f=_0x119aa6[_0x26c1('0x23')];var _0x56e4fe=_0x4d0387?0x0:_0xd5ee6d['offset'];var _0x354dc1=_0x4d0387?_0x119aa6['count']:_0xd5ee6d[_0x26c1('0x20')]+_0xd5ee6d[_0x26c1('0x21')];var _0x4abec9;if(_0x354dc1>=_0x3f8a2f){_0x354dc1=_0x3f8a2f;_0x4abec9=0xc8;}else{_0x4abec9=0xce;}_0x5a87be[_0x26c1('0x1e')](_0x4abec9);return _0x5a87be[_0x26c1('0x24')]('Content-Range',_0x56e4fe+'-'+_0x354dc1+'/'+_0x3f8a2f)[_0x26c1('0x25')](_0x119aa6);}return null;};}function patchUpdates(_0x46049c){return function(_0x30e27f){try{jsonpatch[_0x26c1('0x26')](_0x30e27f,_0x46049c,!![]);}catch(_0x43ee86){return BPromise[_0x26c1('0x27')](_0x43ee86);}return _0x30e27f[_0x26c1('0x28')]();};}function saveUpdates(_0x424e7c,_0x29deeb){return function(_0x32854b){if(_0x32854b){return _0x32854b[_0x26c1('0x29')](_0x424e7c)[_0x26c1('0x2a')](function(_0x2561bf){return _0x2561bf;});}return null;};}function removeEntity(_0xf6095e,_0x16932f){return function(_0x18eddf){if(_0x18eddf){return _0x18eddf[_0x26c1('0x2b')]()[_0x26c1('0x2a')](function(){_0xf6095e[_0x26c1('0x1e')](0xcc)[_0x26c1('0x1f')]();});}};}function handleEntityNotFound(_0x2f48a1,_0x25f271){return function(_0x1c8b71){if(!_0x1c8b71){_0x2f48a1['sendStatus'](0x194);}return _0x1c8b71;};}function handleError(_0x32112b,_0x8acb0b){_0x8acb0b=_0x8acb0b||0x1f4;return function(_0x58b630){logger[_0x26c1('0x2c')](_0x58b630[_0x26c1('0x2d')]);if(_0x58b630[_0x26c1('0x2e')]){delete _0x58b630[_0x26c1('0x2e')];}_0x32112b['status'](_0x8acb0b)[_0x26c1('0x2f')](_0x58b630);};}exports[_0x26c1('0x30')]=function(_0x15afd9,_0xe0ffc1,_0x5f2603){if(!_0x15afd9[_0x26c1('0x31')][_0x26c1('0x32')]('text')&&!_0x15afd9['body'][_0x26c1('0x32')](_0x26c1('0x33'))){throw new db[(_0x26c1('0x34'))]['ValidationError'](_0x26c1('0x35'));}else{if(_0x15afd9[_0x26c1('0x31')][_0x26c1('0x32')](_0x26c1('0x33'))&&!_0x15afd9[_0x26c1('0x31')][_0x26c1('0x32')](_0x26c1('0x36'))){throw new db[(_0x26c1('0x34'))][(_0x26c1('0x37'))](_0x26c1('0x38'));}if(!_0x15afd9['body'][_0x26c1('0x32')]('recipients')){throw new db['Sequelize'][(_0x26c1('0x37'))](_0x26c1('0x39'));}else{try{var _0x138121=JSON[_0x26c1('0x3a')](_0x15afd9[_0x26c1('0x31')]['recipients']);}catch(_0xdf9806){logger['error'](_0xdf9806);throw new db[(_0x26c1('0x34'))][(_0x26c1('0x37'))](_0x26c1('0x3b'));}var _0x357517=[_0x26c1('0x3c'),_0x26c1('0x3d'),'mailqueue',_0x26c1('0x3e'),_0x26c1('0x3f'),_0x26c1('0x40'),'whatsappqueue','team',_0x26c1('0x41')];if(_[_0x26c1('0x42')](_0x138121,function(_0x3bcfe4){return!_[_0x26c1('0x43')](_0x357517,_0x3bcfe4[_0x26c1('0x44')]['toLowerCase']());})){throw new db['Sequelize']['ValidationError'](_0x26c1('0x45'));}}}var _0x2a3faa={};_0x2a3faa[_0x26c1('0x46')]=_0x15afd9[_0x26c1('0x31')][_0x26c1('0x32')]('senderName')?_0x15afd9[_0x26c1('0x31')][_0x26c1('0x46')]:_0x15afd9['user'][_0x26c1('0x47')];_0x2a3faa['recipientsDescription']=_[_0x26c1('0x48')](_0x15afd9[_0x26c1('0x31')][_0x26c1('0x49')])?null:_0x15afd9[_0x26c1('0x31')]['recipientsDescription'];_0x2a3faa[_0x26c1('0x4a')]=_0x15afd9['body'][_0x26c1('0x4a')]||![];_0x2a3faa['SenderId']=_0x15afd9[_0x26c1('0x41')]['id'];return getContent(_0x15afd9['body'])['then'](function(_0x5cf37b){_0x2a3faa['body']=_0x5cf37b;return getRecipients(_0x138121);})[_0x26c1('0x2a')](function(_0x13b751){_0x2a3faa['recipientsId']=_['sortBy'](_0x13b751)[_0x26c1('0x4b')](',');return db[_0x26c1('0x4c')]['transaction'](function(_0x30ec11){return db[_0x26c1('0x4d')][_0x26c1('0x4e')](_0x2a3faa,{'raw':!![],'transaction':_0x30ec11})[_0x26c1('0x2a')](function(_0x2c5c91){var _0x26c708={'sender':_0x2a3faa['senderName'],'description':_0x2a3faa[_0x26c1('0x49')],'content':_0x2a3faa[_0x26c1('0x31')],'beep':_0x2a3faa[_0x26c1('0x4a')]};_0x13b751['forEach'](function(_0x2cb241){_0x26c708[_0x26c1('0x4f')]=_0x2cb241;socket[_0x26c1('0x50')](_0x26c1('0x51'),_0x26c708);});return _0x2c5c91;});});})[_0x26c1('0x2a')](respondWithResult(_0xe0ffc1,0xc9))[_0x26c1('0x52')](handleError(_0xe0ffc1,null));};function getContent(_0x1798ff){return new BPromise(function(_0x3a0792,_0x105a67){if(_0x1798ff[_0x26c1('0x53')]){_0x3a0792(_0x1798ff['text']);return;}return db['Template'][_0x26c1('0x54')]({'attributes':[_0x26c1('0x55')],'where':{'id':_0x1798ff[_0x26c1('0x33')]},'raw':!![]})[_0x26c1('0x2a')](function(_0x53bf21){if(!_0x53bf21)throw new db[(_0x26c1('0x34'))][(_0x26c1('0x37'))](_0x26c1('0x56'));var _0x2e4ea8=Mustache[_0x26c1('0x57')](_0x53bf21[_0x26c1('0x55')],_0x1798ff[_0x26c1('0x36')]);_0x3a0792(_0x2e4ea8);})[_0x26c1('0x52')](function(_0x459db7){_0x105a67(_0x459db7);});});}function getRecipients(_0x1e391c){return new BPromise(function(_0x5ef5ba,_0x2947d3){var _0x2a16f1=[];var _0x3743c1=[];_0x1e391c[_0x26c1('0x58')](function(_0x45d419){var _0x397d6=_['startCase'](_0x45d419[_0x26c1('0x44')]['toLowerCase']());if(_0x397d6===_0x26c1('0x59')){_0x2a16f1=_[_0x26c1('0x5a')](_0x2a16f1,_0x45d419['ids']);}else{if(_[_0x26c1('0x43')](_0x397d6,_0x26c1('0x5b')))_0x397d6=_0x397d6[_0x26c1('0x5c')]('queue','Queue');_0x45d419[_0x26c1('0x5d')]['forEach'](function(_0x28d044){_0x3743c1[_0x26c1('0x5e')](getAgents(_0x397d6,_0x28d044));});}});return BPromise[_0x26c1('0x5f')](_0x3743c1)[_0x26c1('0x2a')](function(_0x2d1cbd){_0x2a16f1=_['union'](_0x2a16f1,_[_0x26c1('0x60')](_0x2d1cbd));_0x5ef5ba(_0x2a16f1);})[_0x26c1('0x52')](function(_0x310370){_0x2947d3(_0x310370);});});}function getAgents(_0x2633f0,_0x109547){return new BPromise(function(_0x2d05ed,_0x3fa62b){return db[_0x2633f0][_0x26c1('0x54')]({'where':{'id':_0x109547}})[_0x26c1('0x2a')](function(_0x1df454){return _0x1df454[_0x26c1('0x61')]({'attributes':['id'],'raw':!![]})[_0x26c1('0x2a')](function(_0x3623c2){var _0x17fe79=_[_0x26c1('0x62')](_0x3623c2,'id');_0x2d05ed(_0x17fe79);});})[_0x26c1('0x52')](function(_0x443b5d){_0x3fa62b(_0x443b5d);});});} \ No newline at end of file +var _0x6505=['to-csv','ejs','fs-extra','lodash','crypto','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./userNotification.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','error','stack','name','send','sendUserNotification','text','body','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','hasOwnProperty','view','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','openchannelqueue','voicequeue','whatsappqueue','some','toLowerCase','senderName','user','fullname','recipientsDescription','isEmpty','beep','SenderId','then','recipientsId','join','create','recipient','emit','userNotification:send','catch','Template','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','forEach','model','union','ids','queue','Queue','push','findOne','getAgents','map','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x44a680,_0x3298cc){var _0x16b806=function(_0x4db6b0){while(--_0x4db6b0){_0x44a680['push'](_0x44a680['shift']());}};_0x16b806(++_0x3298cc);}(_0x6505,0xb3));var _0x5650=function(_0x1bb5ac,_0x54147f){_0x1bb5ac=_0x1bb5ac-0x0;var _0x10a437=_0x6505[_0x1bb5ac];return _0x10a437;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5650('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5650('0x1'));var rp=require(_0x5650('0x2'));var moment=require(_0x5650('0x3'));var BPromise=require(_0x5650('0x4'));var Mustache=require(_0x5650('0x5'));var util=require(_0x5650('0x6'));var path=require(_0x5650('0x7'));var sox=require(_0x5650('0x8'));var csv=require(_0x5650('0x9'));var ejs=require(_0x5650('0xa'));var fs=require('fs');var fs_extra=require(_0x5650('0xb'));var _=require(_0x5650('0xc'));var squel=require('squel');var crypto=require(_0x5650('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5650('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5650('0xf'));var as=require(_0x5650('0x10'));var hardwareService=require(_0x5650('0x11'));var logger=require(_0x5650('0x12'))(_0x5650('0x13'));var utils=require(_0x5650('0x14'));var config=require(_0x5650('0x15'));var licenseUtil=require(_0x5650('0x16'));var db=require(_0x5650('0x17'))['db'];config[_0x5650('0x18')]=_[_0x5650('0x19')](config['redis'],{'host':_0x5650('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5650('0x18')]));require(_0x5650('0x1b'))[_0x5650('0x1c')](socket);function respondWithStatusCode(_0x3d2750,_0x5766a0){_0x5766a0=_0x5766a0||0xcc;return function(_0x53e167){if(_0x53e167){return _0x3d2750[_0x5650('0x1d')](_0x5766a0);}return _0x3d2750[_0x5650('0x1e')](_0x5766a0)[_0x5650('0x1f')]();};}function respondWithResult(_0x236bea,_0x421680){_0x421680=_0x421680||0xc8;return function(_0x23fd8e){if(_0x23fd8e){return _0x236bea[_0x5650('0x1e')](_0x421680)['json'](_0x23fd8e);}};}function respondWithFilteredResult(_0x365db0,_0x22fc8a){return function(_0x20c824){if(_0x20c824){var _0x56e2e2=typeof _0x22fc8a[_0x5650('0x20')]===_0x5650('0x21')&&typeof _0x22fc8a[_0x5650('0x22')]===_0x5650('0x21');var _0x37a99a=_0x20c824[_0x5650('0x23')];var _0x315b57=_0x56e2e2?0x0:_0x22fc8a[_0x5650('0x20')];var _0x18377a=_0x56e2e2?_0x20c824[_0x5650('0x23')]:_0x22fc8a[_0x5650('0x20')]+_0x22fc8a[_0x5650('0x22')];var _0x2abb02;if(_0x18377a>=_0x37a99a){_0x18377a=_0x37a99a;_0x2abb02=0xc8;}else{_0x2abb02=0xce;}_0x365db0[_0x5650('0x1e')](_0x2abb02);return _0x365db0[_0x5650('0x24')](_0x5650('0x25'),_0x315b57+'-'+_0x18377a+'/'+_0x37a99a)[_0x5650('0x26')](_0x20c824);}return null;};}function patchUpdates(_0x278fcc){return function(_0x28059e){try{jsonpatch[_0x5650('0x27')](_0x28059e,_0x278fcc,!![]);}catch(_0x374a1f){return BPromise[_0x5650('0x28')](_0x374a1f);}return _0x28059e['save']();};}function saveUpdates(_0x3e931b,_0x4a7885){return function(_0x28b7b6){if(_0x28b7b6){return _0x28b7b6[_0x5650('0x29')](_0x3e931b)['then'](function(_0x45dd5a){return _0x45dd5a;});}return null;};}function removeEntity(_0x27daaa,_0x541013){return function(_0x256591){if(_0x256591){return _0x256591['destroy']()['then'](function(){_0x27daaa[_0x5650('0x1e')](0xcc)[_0x5650('0x1f')]();});}};}function handleEntityNotFound(_0x43eff2,_0x4b8486){return function(_0xa41d8c){if(!_0xa41d8c){_0x43eff2[_0x5650('0x1d')](0x194);}return _0xa41d8c;};}function handleError(_0x45ab49,_0x283dc0){_0x283dc0=_0x283dc0||0x1f4;return function(_0x592ac9){logger[_0x5650('0x2a')](_0x592ac9[_0x5650('0x2b')]);if(_0x592ac9[_0x5650('0x2c')]){delete _0x592ac9[_0x5650('0x2c')];}_0x45ab49[_0x5650('0x1e')](_0x283dc0)[_0x5650('0x2d')](_0x592ac9);};}exports[_0x5650('0x2e')]=function(_0x335bed,_0x291097,_0x4796cd){if(!_0x335bed['body']['hasOwnProperty'](_0x5650('0x2f'))&&!_0x335bed[_0x5650('0x30')]['hasOwnProperty']('TemplateId')){throw new db[(_0x5650('0x31'))][(_0x5650('0x32'))](_0x5650('0x33'));}else{if(_0x335bed[_0x5650('0x30')]['hasOwnProperty'](_0x5650('0x34'))&&!_0x335bed[_0x5650('0x30')][_0x5650('0x35')](_0x5650('0x36'))){throw new db[(_0x5650('0x31'))][(_0x5650('0x32'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x335bed[_0x5650('0x30')]['hasOwnProperty'](_0x5650('0x37'))){throw new db[(_0x5650('0x31'))][(_0x5650('0x32'))](_0x5650('0x38'));}else{try{var _0x2f4ef8=JSON[_0x5650('0x39')](_0x335bed['body'][_0x5650('0x37')]);}catch(_0x3df1b6){logger[_0x5650('0x2a')](_0x3df1b6);throw new db['Sequelize'][(_0x5650('0x32'))](_0x5650('0x3a'));}var _0x1c3ae7=[_0x5650('0x3b'),'faxqueue','mailqueue',_0x5650('0x3c'),'smsqueue',_0x5650('0x3d'),_0x5650('0x3e'),'team','user'];if(_[_0x5650('0x3f')](_0x2f4ef8,function(_0x19d2e3){return!_['includes'](_0x1c3ae7,_0x19d2e3['model'][_0x5650('0x40')]());})){throw new db[(_0x5650('0x31'))][(_0x5650('0x32'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x288526={};_0x288526[_0x5650('0x41')]=_0x335bed[_0x5650('0x30')]['hasOwnProperty'](_0x5650('0x41'))?_0x335bed[_0x5650('0x30')][_0x5650('0x41')]:_0x335bed[_0x5650('0x42')][_0x5650('0x43')];_0x288526[_0x5650('0x44')]=_[_0x5650('0x45')](_0x335bed[_0x5650('0x30')]['recipientsDescription'])?null:_0x335bed['body'][_0x5650('0x44')];_0x288526['beep']=_0x335bed[_0x5650('0x30')][_0x5650('0x46')]||![];_0x288526[_0x5650('0x47')]=_0x335bed[_0x5650('0x42')]['id'];return getContent(_0x335bed['body'])[_0x5650('0x48')](function(_0xdabb42){_0x288526[_0x5650('0x30')]=_0xdabb42;return getRecipients(_0x2f4ef8);})['then'](function(_0x537f4c){_0x288526[_0x5650('0x49')]=_['sortBy'](_0x537f4c)[_0x5650('0x4a')](',');return db['sequelize']['transaction'](function(_0x347c65){return db['UserNotification'][_0x5650('0x4b')](_0x288526,{'raw':!![],'transaction':_0x347c65})[_0x5650('0x48')](function(_0x16cc1c){var _0x515f78={'sender':_0x288526[_0x5650('0x41')],'description':_0x288526['recipientsDescription'],'content':_0x288526[_0x5650('0x30')],'beep':_0x288526[_0x5650('0x46')]};_0x537f4c['forEach'](function(_0x42c208){_0x515f78[_0x5650('0x4c')]=_0x42c208;socket[_0x5650('0x4d')](_0x5650('0x4e'),_0x515f78);});return _0x16cc1c;});});})[_0x5650('0x48')](respondWithResult(_0x291097,0xc9))[_0x5650('0x4f')](handleError(_0x291097,null));};function getContent(_0x35bb0f){return new BPromise(function(_0x41e59b,_0x175474){if(_0x35bb0f[_0x5650('0x2f')]){_0x41e59b(_0x35bb0f[_0x5650('0x2f')]);return;}return db[_0x5650('0x50')]['findOne']({'attributes':['html'],'where':{'id':_0x35bb0f[_0x5650('0x34')]},'raw':!![]})[_0x5650('0x48')](function(_0x25a400){if(!_0x25a400)throw new db['Sequelize'][(_0x5650('0x32'))](_0x5650('0x51'));var _0x3823d6=Mustache[_0x5650('0x52')](_0x25a400[_0x5650('0x53')],_0x35bb0f[_0x5650('0x36')]);_0x41e59b(_0x3823d6);})[_0x5650('0x4f')](function(_0x393181){_0x175474(_0x393181);});});}function getRecipients(_0x12c656){return new BPromise(function(_0x38e9cf,_0x3584fa){var _0x4a865a=[];var _0x5ee238=[];_0x12c656[_0x5650('0x54')](function(_0x22fb6a){var _0x52286c=_['startCase'](_0x22fb6a[_0x5650('0x55')]['toLowerCase']());if(_0x52286c==='User'){_0x4a865a=_[_0x5650('0x56')](_0x4a865a,_0x22fb6a[_0x5650('0x57')]);}else{if(_['includes'](_0x52286c,'queue'))_0x52286c=_0x52286c['replace'](_0x5650('0x58'),_0x5650('0x59'));_0x22fb6a[_0x5650('0x57')][_0x5650('0x54')](function(_0x4942e3){_0x5ee238[_0x5650('0x5a')](getAgents(_0x52286c,_0x4942e3));});}});return BPromise['all'](_0x5ee238)['then'](function(_0x479b43){_0x4a865a=_[_0x5650('0x56')](_0x4a865a,_['flatten'](_0x479b43));_0x38e9cf(_0x4a865a);})[_0x5650('0x4f')](function(_0x15d281){_0x3584fa(_0x15d281);});});}function getAgents(_0x4fb17f,_0x2c480c){return new BPromise(function(_0x33a2a8,_0x267e73){return db[_0x4fb17f][_0x5650('0x5b')]({'where':{'id':_0x2c480c}})[_0x5650('0x48')](function(_0x410a47){return _0x410a47[_0x5650('0x5c')]({'attributes':['id'],'raw':!![]})[_0x5650('0x48')](function(_0xe1c426){var _0x3ae646=_[_0x5650('0x5d')](_0xe1c426,'id');_0x33a2a8(_0x3ae646);});})['catch'](function(_0x24ade3){_0x267e73(_0x24ade3);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index a8058c0..f93838e 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 _0x4a67=['UserNotification','setMaxListeners','save','emit','hook','events','../../mysqldb'];(function(_0x182663,_0x3578f5){var _0x10019e=function(_0x198277){while(--_0x198277){_0x182663['push'](_0x182663['shift']());}};_0x10019e(++_0x3578f5);}(_0x4a67,0x19b));var _0x74a6=function(_0x414dd8,_0x2c8c0c){_0x414dd8=_0x414dd8-0x0;var _0x4fd925=_0x4a67[_0x414dd8];return _0x4fd925;};'use strict';var EventEmitter=require(_0x74a6('0x0'));var UserNotification=require(_0x74a6('0x1'))['db'][_0x74a6('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x74a6('0x3')](0x0);var events={'afterCreate':_0x74a6('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x386f4b){return function(_0x21702d,_0xbb0541,_0x16621a){UserNotificationEvents['emit'](_0x386f4b+':'+_0x21702d['id'],_0x21702d);UserNotificationEvents[_0x74a6('0x5')](_0x386f4b,_0x21702d);_0x16621a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0x74a6('0x6')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file +var _0x6505=['../../mysqldb','UserNotification','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x1b8b1f,_0x5db94a){var _0x538d8b=function(_0x57a2c7){while(--_0x57a2c7){_0x1b8b1f['push'](_0x1b8b1f['shift']());}};_0x538d8b(++_0x5db94a);}(_0x6505,0x1c1));var _0x5650=function(_0x915a3c,_0x107136){_0x915a3c=_0x915a3c-0x0;var _0x204c99=_0x6505[_0x915a3c];return _0x204c99;};'use strict';var EventEmitter=require(_0x5650('0x0'));var UserNotification=require(_0x5650('0x1'))['db'][_0x5650('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5650('0x3'),'afterUpdate':_0x5650('0x4'),'afterDestroy':_0x5650('0x5')};function emitEvent(_0x33fda6){return function(_0x29a361,_0x3c8d59,_0x5e3da9){UserNotificationEvents[_0x5650('0x6')](_0x33fda6+':'+_0x29a361['id'],_0x29a361);UserNotificationEvents[_0x5650('0x6')](_0x33fda6,_0x29a361);_0x5e3da9(null);};}for(var e in events){if(events[_0x5650('0x7')](e)){var event=events[e];UserNotification[_0x5650('0x8')](e,emitEvent(event));}}module[_0x5650('0x9')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index a5dff63..834173d 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 _0xb9e7=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','UserNotification','userNotifications','utf8mb4','util','../../config/logger'];(function(_0x1d63b2,_0x52f531){var _0x3bb161=function(_0x1202ce){while(--_0x1202ce){_0x1d63b2['push'](_0x1d63b2['shift']());}};_0x3bb161(++_0x52f531);}(_0xb9e7,0x1df));var _0x7b9e=function(_0x3818c0,_0x542521){_0x3818c0=_0x3818c0-0x0;var _0x55ec33=_0xb9e7[_0x3818c0];return _0x55ec33;};'use strict';var _=require('lodash');var util=require(_0x7b9e('0x0'));var logger=require(_0x7b9e('0x1'))(_0x7b9e('0x2'));var moment=require(_0x7b9e('0x3'));var BPromise=require(_0x7b9e('0x4'));var rp=require(_0x7b9e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b9e('0x6'));var config=require(_0x7b9e('0x7'));var attributes=require('./userNotification.attributes');module[_0x7b9e('0x8')]=function(_0x51a0ca,_0x3a9c5e){return _0x51a0ca[_0x7b9e('0x9')](_0x7b9e('0xa'),attributes,{'tableName':_0x7b9e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7b9e('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xf905=['rimraf','../../config/environment','exports','UserNotification','userNotifications','utf8mb4','api','moment','request-promise','path'];(function(_0x460f4e,_0x1ed514){var _0x51635d=function(_0x38e3ad){while(--_0x38e3ad){_0x460f4e['push'](_0x460f4e['shift']());}};_0x51635d(++_0x1ed514);}(_0xf905,0x15a));var _0x5f90=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0xf905[_0x1573ea];return _0x51c0e2;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x5f90('0x0'));var moment=require(_0x5f90('0x1'));var BPromise=require('bluebird');var rp=require(_0x5f90('0x2'));var fs=require('fs');var path=require(_0x5f90('0x3'));var rimraf=require(_0x5f90('0x4'));var config=require(_0x5f90('0x5'));var attributes=require('./userNotification.attributes');module[_0x5f90('0x6')]=function(_0x1d63d7,_0x1c4820){return _0x1d63d7['define'](_0x5f90('0x7'),attributes,{'tableName':_0x5f90('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5f90('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 9420730..22f9c53 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 _0xa129=['UserNotification,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./userNotification.socket','register','request','info','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x214528,_0x3d20a1){var _0x52fc0e=function(_0xee43eb){while(--_0xee43eb){_0x214528['push'](_0x214528['shift']());}};_0x52fc0e(++_0x3d20a1);}(_0xa129,0x11b));var _0x9a12=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa129[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9a12('0x0'));var util=require(_0x9a12('0x1'));var moment=require(_0x9a12('0x2'));var BPromise=require(_0x9a12('0x3'));var rs=require(_0x9a12('0x4'));var fs=require('fs');var Redis=require(_0x9a12('0x5'));var db=require(_0x9a12('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9a12('0x7'))(_0x9a12('0x8'));var config=require(_0x9a12('0x9'));var jayson=require(_0x9a12('0xa'));var client=jayson[_0x9a12('0xb')][_0x9a12('0xc')]({'port':0x232a});config['redis']=_[_0x9a12('0xd')](config['redis'],{'host':_0x9a12('0xe'),'port':0x18eb});var socket=require(_0x9a12('0xf'))(new Redis(config[_0x9a12('0x10')]));require(_0x9a12('0x11'))[_0x9a12('0x12')](socket);function respondWithRpcPromise(_0x81559c,_0x1a714a,_0x56aa44){return new BPromise(function(_0xab826f,_0x1c641f){return client[_0x9a12('0x13')](_0x81559c,_0x56aa44)['then'](function(_0x42b99e){logger[_0x9a12('0x14')]('UserNotification,\x20%s,\x20%s',_0x1a714a,_0x9a12('0x15'));logger[_0x9a12('0x16')](_0x9a12('0x17'),_0x1a714a,_0x9a12('0x15'),JSON[_0x9a12('0x18')](_0x42b99e));if(_0x42b99e[_0x9a12('0x19')]){if(_0x42b99e[_0x9a12('0x19')][_0x9a12('0x1a')]===0x1f4){logger[_0x9a12('0x19')](_0x9a12('0x1b'),_0x1a714a,_0x42b99e[_0x9a12('0x19')]['message']);return _0x1c641f(_0x42b99e[_0x9a12('0x19')][_0x9a12('0x1c')]);}logger[_0x9a12('0x19')](_0x9a12('0x1b'),_0x1a714a,_0x42b99e[_0x9a12('0x19')][_0x9a12('0x1c')]);return _0xab826f(_0x42b99e[_0x9a12('0x19')][_0x9a12('0x1c')]);}else{logger[_0x9a12('0x14')](_0x9a12('0x1b'),_0x1a714a,'request\x20sent');_0xab826f(_0x42b99e[_0x9a12('0x1d')][_0x9a12('0x1c')]);}})[_0x9a12('0x1e')](function(_0x37df16){logger['error'](_0x9a12('0x1b'),_0x1a714a,_0x37df16);_0x1c641f(_0x37df16);});});} \ No newline at end of file +var _0x8648=['rpc','client','http','redis','localhost','socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x288be1,_0x232e15){var _0x55047a=function(_0x48f1c1){while(--_0x48f1c1){_0x288be1['push'](_0x288be1['shift']());}};_0x55047a(++_0x232e15);}(_0x8648,0x1ed));var _0x8864=function(_0x42d658,_0x3b6d4c){_0x42d658=_0x42d658-0x0;var _0x17a459=_0x8648[_0x42d658];return _0x17a459;};'use strict';var _=require('lodash');var util=require(_0x8864('0x0'));var moment=require(_0x8864('0x1'));var BPromise=require('bluebird');var rs=require(_0x8864('0x2'));var fs=require('fs');var Redis=require(_0x8864('0x3'));var db=require(_0x8864('0x4'))['db'];var utils=require(_0x8864('0x5'));var logger=require(_0x8864('0x6'))(_0x8864('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8864('0x8')][_0x8864('0x9')]({'port':0x232a});config[_0x8864('0xa')]=_['defaults'](config[_0x8864('0xa')],{'host':_0x8864('0xb'),'port':0x18eb});var socket=require(_0x8864('0xc'))(new Redis(config[_0x8864('0xa')]));require(_0x8864('0xd'))[_0x8864('0xe')](socket);function respondWithRpcPromise(_0x2f0914,_0x35553f,_0x20c9bf){return new BPromise(function(_0x41ca26,_0x507e4e){return client[_0x8864('0xf')](_0x2f0914,_0x20c9bf)[_0x8864('0x10')](function(_0x138fec){logger[_0x8864('0x11')](_0x8864('0x12'),_0x35553f,'request\x20sent');logger['debug']('UserNotification,\x20%s,\x20%s,\x20%s',_0x35553f,_0x8864('0x13'),JSON['stringify'](_0x138fec));if(_0x138fec[_0x8864('0x14')]){if(_0x138fec[_0x8864('0x14')][_0x8864('0x15')]===0x1f4){logger[_0x8864('0x14')](_0x8864('0x12'),_0x35553f,_0x138fec[_0x8864('0x14')][_0x8864('0x16')]);return _0x507e4e(_0x138fec[_0x8864('0x14')][_0x8864('0x16')]);}logger[_0x8864('0x14')]('UserNotification,\x20%s,\x20%s',_0x35553f,_0x138fec[_0x8864('0x14')][_0x8864('0x16')]);return _0x41ca26(_0x138fec[_0x8864('0x14')][_0x8864('0x16')]);}else{logger[_0x8864('0x11')](_0x8864('0x12'),_0x35553f,_0x8864('0x13'));_0x41ca26(_0x138fec[_0x8864('0x17')]['message']);}})[_0x8864('0x18')](function(_0x5ae462){logger[_0x8864('0x14')](_0x8864('0x12'),_0x35553f,_0x5ae462);_0x507e4e(_0x5ae462);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 5a714c5..e8e4745 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 _0x837e=['update','removeListener','length','userNotification:','./userNotification.events','remove'];(function(_0x5c4133,_0xff7f35){var _0x232190=function(_0x805687){while(--_0x805687){_0x5c4133['push'](_0x5c4133['shift']());}};_0x232190(++_0xff7f35);}(_0x837e,0x1e4));var _0xe837=function(_0x13d374,_0xb5aa9c){_0x13d374=_0x13d374-0x0;var _0x8e09b2=_0x837e[_0x13d374];return _0x8e09b2;};'use strict';var UserNotificationEvents=require(_0xe837('0x0'));var events=['save',_0xe837('0x1'),_0xe837('0x2')];function createListener(_0xbfd36b,_0x2ecb65){return function(_0x2183a9){_0x2ecb65['emit'](_0xbfd36b,_0x2183a9);};}function removeListener(_0x1453a3,_0x2eb0c0){return function(){UserNotificationEvents[_0xe837('0x3')](_0x1453a3,_0x2eb0c0);};}exports['register']=function(_0x32124b){for(var _0x2b9950=0x0,_0x6b560a=events[_0xe837('0x4')];_0x2b9950<_0x6b560a;_0x2b9950++){var _0x3f9745=events[_0x2b9950];var _0x189fcc=createListener(_0xe837('0x5')+_0x3f9745,_0x32124b);UserNotificationEvents['on'](_0x3f9745,_0x189fcc);}}; \ No newline at end of file +var _0x5dda=['length','userNotification:','./userNotification.events','remove','update','removeListener','register'];(function(_0x3ab5d4,_0x30d994){var _0x16152c=function(_0x296e76){while(--_0x296e76){_0x3ab5d4['push'](_0x3ab5d4['shift']());}};_0x16152c(++_0x30d994);}(_0x5dda,0xfe));var _0xa5dd=function(_0xef207f,_0x4c6b58){_0xef207f=_0xef207f-0x0;var _0x202fa7=_0x5dda[_0xef207f];return _0x202fa7;};'use strict';var UserNotificationEvents=require(_0xa5dd('0x0'));var events=['save',_0xa5dd('0x1'),_0xa5dd('0x2')];function createListener(_0x485407,_0x1301ed){return function(_0x18d4e5){_0x1301ed['emit'](_0x485407,_0x18d4e5);};}function removeListener(_0x37bf28,_0x437fbb){return function(){UserNotificationEvents[_0xa5dd('0x3')](_0x37bf28,_0x437fbb);};}exports[_0xa5dd('0x4')]=function(_0x8e844e){for(var _0x428ba0=0x0,_0x25f5df=events[_0xa5dd('0x5')];_0x428ba0<_0x25f5df;_0x428ba0++){var _0x4bf626=events[_0x428ba0];var _0x41edfd=createListener(_0xa5dd('0x6')+_0x4bf626,_0x8e844e);UserNotificationEvents['on'](_0x4bf626,_0x41edfd);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 86c3a8a..65e23ac 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x337a98,_0x518550){var _0x848c41=function(_0x3e863d){while(--_0x3e863d){_0x337a98['push'](_0x337a98['shift']());}};_0x848c41(++_0x518550);}(_0xe706,0xa3));var _0x6e70=function(_0x175bfd,_0x4d47b5){_0x175bfd=_0x175bfd-0x0;var _0x2753f2=_0xe706[_0x175bfd];return _0x2753f2;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xf06aa7,_0x1afe71){var _0x5ce8bc=function(_0x35343c){while(--_0x35343c){_0xf06aa7['push'](_0xf06aa7['shift']());}};_0x5ce8bc(++_0x1afe71);}(_0xe706,0xa3));var _0x6e70=function(_0xcfcdcb,_0x335750){_0xcfcdcb=_0xcfcdcb-0x0;var _0x55b9da=_0xe706[_0xcfcdcb];return _0x55b9da;};'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 ee1bb66..0bff8df 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 _0xaf11=['sequelize','exports'];(function(_0x2cf213,_0x5487ca){var _0x376287=function(_0x2f3d7d){while(--_0x2f3d7d){_0x2cf213['push'](_0x2cf213['shift']());}};_0x376287(++_0x5487ca);}(_0xaf11,0x190));var _0x1af1=function(_0xa63d7e,_0x39a5cd){_0xa63d7e=_0xa63d7e-0x0;var _0x3f826b=_0xaf11[_0xa63d7e];return _0x3f826b;};'use strict';var Sequelize=require(_0x1af1('0x0'));module[_0x1af1('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x777d=['INTEGER'];(function(_0x22205c,_0x473493){var _0x3f5efe=function(_0x153dbb){while(--_0x153dbb){_0x22205c['push'](_0x22205c['shift']());}};_0x3f5efe(++_0x473493);}(_0x777d,0xa0));var _0xd777=function(_0x12cbd8,_0x8ef0ce){_0x12cbd8=_0x12cbd8-0x0;var _0x2fb1ab=_0x777d[_0x12cbd8];return _0x2fb1ab;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xd777('0x0')],'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 8bc469f..248f659 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 _0x45d7=['util','../../config/logger','api','moment','bluebird','path','rimraf','./userOpenchannelQueue.attributes','exports','define','user_has_openchannel_queues','lodash'];(function(_0x504bb0,_0x40db89){var _0x1d4bb3=function(_0x1a17cc){while(--_0x1a17cc){_0x504bb0['push'](_0x504bb0['shift']());}};_0x1d4bb3(++_0x40db89);}(_0x45d7,0x137));var _0x745d=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x45d7[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x745d('0x0'));var util=require(_0x745d('0x1'));var logger=require(_0x745d('0x2'))(_0x745d('0x3'));var moment=require(_0x745d('0x4'));var BPromise=require(_0x745d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x745d('0x6'));var rimraf=require(_0x745d('0x7'));var config=require('../../config/environment');var attributes=require(_0x745d('0x8'));module[_0x745d('0x9')]=function(_0x1f1f88,_0x1d4444){return _0x1f1f88[_0x745d('0xa')]('UserOpenchannelQueue',attributes,{'tableName':_0x745d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4fe3=['path','rimraf','./userOpenchannelQueue.attributes','exports','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','moment','bluebird'];(function(_0xe2e26,_0x47e75d){var _0x5e90d0=function(_0x2bda02){while(--_0x2bda02){_0xe2e26['push'](_0xe2e26['shift']());}};_0x5e90d0(++_0x47e75d);}(_0x4fe3,0x146));var _0x34fe=function(_0xeffe77,_0x5e3269){_0xeffe77=_0xeffe77-0x0;var _0x37daec=_0x4fe3[_0xeffe77];return _0x37daec;};'use strict';var _=require(_0x34fe('0x0'));var util=require(_0x34fe('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x34fe('0x2'));var BPromise=require(_0x34fe('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x34fe('0x4'));var rimraf=require(_0x34fe('0x5'));var config=require('../../config/environment');var attributes=require(_0x34fe('0x6'));module[_0x34fe('0x7')]=function(_0x213540,_0x3100e0){return _0x213540['define'](_0x34fe('0x8'),attributes,{'tableName':_0x34fe('0x9'),'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 afc4bc5..6eb898c 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 _0xf813=['message','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x11d3ea,_0x2005e6){var _0x20e237=function(_0x1e2120){while(--_0x1e2120){_0x11d3ea['push'](_0x11d3ea['shift']());}};_0x20e237(++_0x2005e6);}(_0xf813,0x14c));var _0x3f81=function(_0x334c50,_0x1f11d0){_0x334c50=_0x334c50-0x0;var _0x524766=_0xf813[_0x334c50];return _0x524766;};'use strict';var _=require(_0x3f81('0x0'));var util=require(_0x3f81('0x1'));var moment=require(_0x3f81('0x2'));var BPromise=require(_0x3f81('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f81('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3f81('0x5'));var logger=require(_0x3f81('0x6'))(_0x3f81('0x7'));var config=require(_0x3f81('0x8'));var jayson=require(_0x3f81('0x9'));var client=jayson['client'][_0x3f81('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ddd33,_0x5f27ec,_0x256f40){return new BPromise(function(_0x2e433b,_0x5226c9){return client[_0x3f81('0xb')](_0x3ddd33,_0x256f40)['then'](function(_0x116cf8){logger[_0x3f81('0xc')](_0x3f81('0xd'),_0x5f27ec,'request\x20sent');logger[_0x3f81('0xe')](_0x3f81('0xf'),_0x5f27ec,_0x3f81('0x10'),JSON[_0x3f81('0x11')](_0x116cf8));if(_0x116cf8[_0x3f81('0x12')]){if(_0x116cf8['error'][_0x3f81('0x13')]===0x1f4){logger['error'](_0x3f81('0xd'),_0x5f27ec,_0x116cf8['error'][_0x3f81('0x14')]);return _0x5226c9(_0x116cf8[_0x3f81('0x12')][_0x3f81('0x14')]);}logger['error'](_0x3f81('0xd'),_0x5f27ec,_0x116cf8[_0x3f81('0x12')][_0x3f81('0x14')]);return _0x2e433b(_0x116cf8[_0x3f81('0x12')][_0x3f81('0x14')]);}else{logger[_0x3f81('0xc')](_0x3f81('0xd'),_0x5f27ec,_0x3f81('0x10'));_0x2e433b(_0x116cf8[_0x3f81('0x15')]['message']);}})['catch'](function(_0x540fb1){logger[_0x3f81('0x12')](_0x3f81('0xd'),_0x5f27ec,_0x540fb1);_0x5226c9(_0x540fb1);});});} \ No newline at end of file +var _0x0332=['rpc','../../config/environment','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x277721,_0x46971e){var _0x286051=function(_0x130c98){while(--_0x130c98){_0x277721['push'](_0x277721['shift']());}};_0x286051(++_0x46971e);}(_0x0332,0x93));var _0x2033=function(_0xc2b9ae,_0x515445){_0xc2b9ae=_0xc2b9ae-0x0;var _0x31deda=_0x0332[_0xc2b9ae];return _0x31deda;};'use strict';var _=require('lodash');var util=require(_0x2033('0x0'));var moment=require(_0x2033('0x1'));var BPromise=require(_0x2033('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2033('0x3'));var db=require(_0x2033('0x4'))['db'];var utils=require(_0x2033('0x5'));var logger=require(_0x2033('0x6'))(_0x2033('0x7'));var config=require(_0x2033('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2033('0x9')][_0x2033('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ba2e4,_0x14aa94,_0x2eb5aa){return new BPromise(function(_0x546408,_0x5802bb){return client[_0x2033('0xb')](_0x1ba2e4,_0x2eb5aa)[_0x2033('0xc')](function(_0x2d85f1){logger[_0x2033('0xd')](_0x2033('0xe'),_0x14aa94,_0x2033('0xf'));logger[_0x2033('0x10')](_0x2033('0x11'),_0x14aa94,_0x2033('0xf'),JSON['stringify'](_0x2d85f1));if(_0x2d85f1[_0x2033('0x12')]){if(_0x2d85f1[_0x2033('0x12')][_0x2033('0x13')]===0x1f4){logger[_0x2033('0x12')](_0x2033('0xe'),_0x14aa94,_0x2d85f1['error'][_0x2033('0x14')]);return _0x5802bb(_0x2d85f1['error'][_0x2033('0x14')]);}logger['error'](_0x2033('0xe'),_0x14aa94,_0x2d85f1[_0x2033('0x12')][_0x2033('0x14')]);return _0x546408(_0x2d85f1[_0x2033('0x12')]['message']);}else{logger[_0x2033('0xd')](_0x2033('0xe'),_0x14aa94,_0x2033('0xf'));_0x546408(_0x2d85f1['result'][_0x2033('0x14')]);}})[_0x2033('0x15')](function(_0x471dd7){logger[_0x2033('0x12')](_0x2033('0xe'),_0x14aa94,_0x471dd7);_0x5802bb(_0x471dd7);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index d20efb7..59975e0 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 _0x3b68=['get','isAuthenticated','index','/describe','/:id','getSections','/:id/resources','getResources','post','create','/:id/clone','addSections','addResources','delete','removeSections','removeResources','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller'];(function(_0x47014e,_0x197853){var _0x529d52=function(_0x144e4c){while(--_0x144e4c){_0x47014e['push'](_0x47014e['shift']());}};_0x529d52(++_0x197853);}(_0x3b68,0x170));var _0x83b6=function(_0x2c1337,_0x24afd2){_0x2c1337=_0x2c1337-0x0;var _0x44a8ad=_0x3b68[_0x2c1337];return _0x44a8ad;};'use strict';var multer=require(_0x83b6('0x0'));var util=require(_0x83b6('0x1'));var path=require(_0x83b6('0x2'));var timeout=require(_0x83b6('0x3'));var express=require('express');var router=express[_0x83b6('0x4')]();var fs_extra=require(_0x83b6('0x5'));var auth=require(_0x83b6('0x6'));var interaction=require(_0x83b6('0x7'));var config=require(_0x83b6('0x8'));var controller=require(_0x83b6('0x9'));router[_0x83b6('0xa')]('/',auth[_0x83b6('0xb')](),controller[_0x83b6('0xc')]);router[_0x83b6('0xa')](_0x83b6('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0x83b6('0xa')](_0x83b6('0xe'),auth[_0x83b6('0xb')](),controller['show']);router[_0x83b6('0xa')]('/:id/sections',auth[_0x83b6('0xb')](),controller[_0x83b6('0xf')]);router[_0x83b6('0xa')](_0x83b6('0x10'),auth[_0x83b6('0xb')](),controller[_0x83b6('0x11')]);router[_0x83b6('0x12')]('/',auth[_0x83b6('0xb')](),controller[_0x83b6('0x13')]);router['post'](_0x83b6('0x14'),auth[_0x83b6('0xb')](),controller['clone']);router['post']('/:id/sections',auth['isAuthenticated'](),controller[_0x83b6('0x15')]);router[_0x83b6('0x12')]('/:id/resources',auth[_0x83b6('0xb')](),controller[_0x83b6('0x16')]);router['put'](_0x83b6('0xe'),auth[_0x83b6('0xb')](),controller['update']);router[_0x83b6('0x17')](_0x83b6('0xe'),auth[_0x83b6('0xb')](),controller['destroy']);router[_0x83b6('0x17')]('/:id/sections',auth[_0x83b6('0xb')](),controller[_0x83b6('0x18')]);router['delete'](_0x83b6('0x10'),auth['isAuthenticated'](),controller[_0x83b6('0x19')]);module[_0x83b6('0x1a')]=router; \ No newline at end of file +var _0x0c7b=['/:id/sections','getSections','/:id/resources','post','/:id/clone','clone','addSections','update','destroy','delete','removeResources','multer','util','path','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','/describe','describe','/:id'];(function(_0x555f7e,_0x43d467){var _0x4347ba=function(_0x596bd6){while(--_0x596bd6){_0x555f7e['push'](_0x555f7e['shift']());}};_0x4347ba(++_0x43d467);}(_0x0c7b,0x136));var _0xb0c7=function(_0x4aa9c5,_0x1c9375){_0x4aa9c5=_0x4aa9c5-0x0;var _0x1fce6e=_0x0c7b[_0x4aa9c5];return _0x1fce6e;};'use strict';var multer=require(_0xb0c7('0x0'));var util=require(_0xb0c7('0x1'));var path=require(_0xb0c7('0x2'));var timeout=require('connect-timeout');var express=require(_0xb0c7('0x3'));var router=express[_0xb0c7('0x4')]();var fs_extra=require(_0xb0c7('0x5'));var auth=require(_0xb0c7('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./userProfile.controller');router[_0xb0c7('0x7')]('/',auth[_0xb0c7('0x8')](),controller['index']);router[_0xb0c7('0x7')](_0xb0c7('0x9'),auth[_0xb0c7('0x8')](),controller[_0xb0c7('0xa')]);router['get'](_0xb0c7('0xb'),auth[_0xb0c7('0x8')](),controller['show']);router[_0xb0c7('0x7')](_0xb0c7('0xc'),auth[_0xb0c7('0x8')](),controller[_0xb0c7('0xd')]);router[_0xb0c7('0x7')](_0xb0c7('0xe'),auth['isAuthenticated'](),controller['getResources']);router['post']('/',auth[_0xb0c7('0x8')](),controller['create']);router[_0xb0c7('0xf')](_0xb0c7('0x10'),auth['isAuthenticated'](),controller[_0xb0c7('0x11')]);router[_0xb0c7('0xf')](_0xb0c7('0xc'),auth['isAuthenticated'](),controller[_0xb0c7('0x12')]);router[_0xb0c7('0xf')](_0xb0c7('0xe'),auth[_0xb0c7('0x8')](),controller['addResources']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xb0c7('0x13')]);router['delete'](_0xb0c7('0xb'),auth[_0xb0c7('0x8')](),controller[_0xb0c7('0x14')]);router[_0xb0c7('0x15')](_0xb0c7('0xc'),auth['isAuthenticated'](),controller['removeSections']);router[_0xb0c7('0x15')](_0xb0c7('0xe'),auth[_0xb0c7('0x8')](),controller[_0xb0c7('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 12d0a27..60d60a4 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 _0x842a=['sequelize','exports','STRING','name','crudPermissions','getDataValue','BOOLEAN'];(function(_0x4b967a,_0x22f5b3){var _0xb548f=function(_0x212030){while(--_0x212030){_0x4b967a['push'](_0x4b967a['shift']());}};_0xb548f(++_0x22f5b3);}(_0x842a,0x70));var _0xa842=function(_0x20fb02,_0x96c029){_0x20fb02=_0x20fb02-0x0;var _0x24a33e=_0x842a[_0x20fb02];return _0x24a33e;};'use strict';var Sequelize=require(_0xa842('0x0'));module[_0xa842('0x1')]={'name':{'type':Sequelize[_0xa842('0x2')],'allowNull':![],'unique':_0xa842('0x3')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x4e9ed1){this['setDataValue'](_0xa842('0x4'),_0x4e9ed1?_0x4e9ed1['join'](''):[]);},'get':function(){return this['getDataValue'](_0xa842('0x4'))?this[_0xa842('0x5')](_0xa842('0x4'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xa842('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xa842('0x6')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xa842('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xa842('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xa842('0x6')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xa842('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xa842('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x3db9=['split','BOOLEAN','sequelize','STRING','setDataValue','crudPermissions','join','getDataValue'];(function(_0x3a8964,_0x45cbc2){var _0x295d95=function(_0x113b0a){while(--_0x113b0a){_0x3a8964['push'](_0x3a8964['shift']());}};_0x295d95(++_0x45cbc2);}(_0x3db9,0x1e2));var _0x93db=function(_0x3c9e8e,_0x20df03){_0x3c9e8e=_0x3c9e8e-0x0;var _0x57351a=_0x3db9[_0x3c9e8e];return _0x57351a;};'use strict';var Sequelize=require(_0x93db('0x0'));module['exports']={'name':{'type':Sequelize[_0x93db('0x1')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x479aba){this[_0x93db('0x2')](_0x93db('0x3'),_0x479aba?_0x479aba[_0x93db('0x4')](''):[]);},'get':function(){return this[_0x93db('0x5')](_0x93db('0x3'))?this['getDataValue']('crudPermissions')[_0x93db('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x93db('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x93db('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x93db('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x93db('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x93db('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x93db('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x93db('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x93db('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x93db('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index e5f7cf8..676b593 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 _0x1018=['get','omit','createdAt','updatedAt','crudPermissions','transaction','each','autoAssociation','UserProfileResource','sectionId','userProfileId','UserProfileSection','Resources','find','describe','addSections','sequelize','push','ids','getSections','enabled','includes','subsections','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','section','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','UserProfile','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','include','findAll','rows','catch','params','options','create','body','clone','includeAll'];(function(_0x30d14d,_0x3af90f){var _0x2efd56=function(_0x4ef9cf){while(--_0x4ef9cf){_0x30d14d['push'](_0x30d14d['shift']());}};_0x2efd56(++_0x3af90f);}(_0x1018,0x90));var _0x8101=function(_0x58fa4c,_0x2720fb){_0x58fa4c=_0x58fa4c-0x0;var _0x20831e=_0x1018[_0x58fa4c];return _0x20831e;};'use strict';var emlformat=require(_0x8101('0x0'));var rimraf=require(_0x8101('0x1'));var zipdir=require(_0x8101('0x2'));var jsonpatch=require(_0x8101('0x3'));var rp=require(_0x8101('0x4'));var moment=require(_0x8101('0x5'));var BPromise=require(_0x8101('0x6'));var Mustache=require(_0x8101('0x7'));var util=require(_0x8101('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x8101('0x9'));var ejs=require(_0x8101('0xa'));var fs=require('fs');var fs_extra=require(_0x8101('0xb'));var _=require(_0x8101('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8101('0xd'));var toCsv=require(_0x8101('0x9'));var querystring=require(_0x8101('0xe'));var Papa=require(_0x8101('0xf'));var Redis=require(_0x8101('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8101('0x11'));var hardwareService=require(_0x8101('0x12'));var logger=require(_0x8101('0x13'))(_0x8101('0x14'));var utils=require('../../config/utils');var config=require(_0x8101('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8101('0x16'))['db'];config[_0x8101('0x17')]=_[_0x8101('0x18')](config['redis'],{'host':_0x8101('0x19'),'port':0x18eb});var socket=require(_0x8101('0x1a'))(new Redis(config['redis']));require('./userProfile.socket')['register'](socket);function respondWithStatusCode(_0x23b9d4,_0x54c59a){_0x54c59a=_0x54c59a||0xcc;return function(_0x35ded2){if(_0x35ded2){return _0x23b9d4[_0x8101('0x1b')](_0x54c59a);}return _0x23b9d4[_0x8101('0x1c')](_0x54c59a)[_0x8101('0x1d')]();};}function respondWithResult(_0x18f9d7,_0x39025b){_0x39025b=_0x39025b||0xc8;return function(_0x3073d4){if(_0x3073d4){return _0x18f9d7['status'](_0x39025b)[_0x8101('0x1e')](_0x3073d4);}};}function respondWithFilteredResult(_0x549887,_0x6b6ecd){return function(_0x20c9a3){if(_0x20c9a3){var _0x1c4d63=typeof _0x6b6ecd[_0x8101('0x1f')]===_0x8101('0x20')&&typeof _0x6b6ecd[_0x8101('0x21')]===_0x8101('0x20');var _0x268994=_0x20c9a3[_0x8101('0x22')];var _0x289b3c=_0x1c4d63?0x0:_0x6b6ecd[_0x8101('0x1f')];var _0x1e0b74=_0x1c4d63?_0x20c9a3[_0x8101('0x22')]:_0x6b6ecd['offset']+_0x6b6ecd['limit'];var _0x58a240;if(_0x1e0b74>=_0x268994){_0x1e0b74=_0x268994;_0x58a240=0xc8;}else{_0x58a240=0xce;}_0x549887[_0x8101('0x1c')](_0x58a240);return _0x549887[_0x8101('0x23')](_0x8101('0x24'),_0x289b3c+'-'+_0x1e0b74+'/'+_0x268994)[_0x8101('0x1e')](_0x20c9a3);}return null;};}function patchUpdates(_0x1da403){return function(_0x289334){try{jsonpatch[_0x8101('0x25')](_0x289334,_0x1da403,!![]);}catch(_0x445886){return BPromise[_0x8101('0x26')](_0x445886);}return _0x289334[_0x8101('0x27')]();};}function saveUpdates(_0x59d4ca,_0x44cdab){return function(_0x4c7827){if(_0x4c7827){return _0x4c7827[_0x8101('0x28')](_0x59d4ca)[_0x8101('0x29')](function(_0x5933b2){return _0x5933b2;});}return null;};}function removeEntity(_0x1e895d,_0x1d13fb){return function(_0x252ae9){if(_0x252ae9){return _0x252ae9[_0x8101('0x2a')]()[_0x8101('0x29')](function(){_0x1e895d[_0x8101('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e9192,_0x51733c){return function(_0x56b071){if(!_0x56b071){_0x5e9192[_0x8101('0x1b')](0x194);}return _0x56b071;};}function handleError(_0x443406,_0xc2ccc6){_0xc2ccc6=_0xc2ccc6||0x1f4;return function(_0x50fb7e){logger['error'](_0x50fb7e[_0x8101('0x2b')]);if(_0x50fb7e['name']){delete _0x50fb7e[_0x8101('0x2c')];}_0x443406['status'](_0xc2ccc6)[_0x8101('0x2d')](_0x50fb7e);};}exports[_0x8101('0x2e')]=function(_0x7294ad,_0x35432f){var _0x51cff4={},_0x447d0b={},_0x578f64={'count':0x0,'rows':[]};var _0x2af5ac=_['map'](db[_0x8101('0x2f')][_0x8101('0x30')],function(_0x38c56f){return{'name':_0x38c56f[_0x8101('0x31')],'type':_0x38c56f[_0x8101('0x32')][_0x8101('0x33')]};});_0x447d0b[_0x8101('0x34')]=_[_0x8101('0x35')](_0x2af5ac,_0x8101('0x2c'));_0x447d0b[_0x8101('0x36')]=_[_0x8101('0x37')](_0x7294ad[_0x8101('0x36')]);_0x447d0b[_0x8101('0x38')]=_['intersection'](_0x447d0b[_0x8101('0x34')],_0x447d0b[_0x8101('0x36')]);_0x51cff4[_0x8101('0x39')]=_[_0x8101('0x3a')](_0x447d0b[_0x8101('0x34')],qs['fields'](_0x7294ad['query'][_0x8101('0x3b')]));_0x51cff4['attributes']=_0x51cff4[_0x8101('0x39')][_0x8101('0x3c')]?_0x51cff4[_0x8101('0x39')]:_0x447d0b[_0x8101('0x34')];if(!_0x7294ad[_0x8101('0x36')][_0x8101('0x3d')](_0x8101('0x3e'))){_0x51cff4[_0x8101('0x21')]=qs[_0x8101('0x21')](_0x7294ad[_0x8101('0x36')][_0x8101('0x21')]);_0x51cff4[_0x8101('0x1f')]=qs['offset'](_0x7294ad[_0x8101('0x36')][_0x8101('0x1f')]);}_0x51cff4[_0x8101('0x3f')]=qs[_0x8101('0x40')](_0x7294ad[_0x8101('0x36')][_0x8101('0x40')]);_0x51cff4['where']=qs[_0x8101('0x38')](_[_0x8101('0x41')](_0x7294ad['query'],_0x447d0b[_0x8101('0x38')]),_0x2af5ac);if(_0x7294ad[_0x8101('0x36')][_0x8101('0x42')]){_0x51cff4['where']=_[_0x8101('0x43')](_0x51cff4['where'],{'$or':_[_0x8101('0x35')](_0x2af5ac,function(_0x28be81){if(_0x28be81[_0x8101('0x32')]!=='VIRTUAL'){var _0x2224de={};_0x2224de[_0x28be81['name']]={'$like':'%'+_0x7294ad[_0x8101('0x36')][_0x8101('0x42')]+'%'};return _0x2224de;}})});}_0x51cff4=_['merge']({},_0x51cff4,_0x7294ad['options']);var _0x3e7afe={'where':_0x51cff4['where']};return db[_0x8101('0x2f')][_0x8101('0x22')](_0x3e7afe)[_0x8101('0x29')](function(_0x161688){_0x578f64[_0x8101('0x22')]=_0x161688;if(_0x7294ad[_0x8101('0x36')]['includeAll']){_0x51cff4[_0x8101('0x44')]=[{'all':!![]}];}return db['UserProfile'][_0x8101('0x45')](_0x51cff4);})[_0x8101('0x29')](function(_0x210877){_0x578f64[_0x8101('0x46')]=_0x210877;return _0x578f64;})[_0x8101('0x29')](respondWithFilteredResult(_0x35432f,_0x51cff4))[_0x8101('0x47')](handleError(_0x35432f,null));};exports['show']=function(_0x2878e7,_0x382bdd){var _0x4b9c44={'raw':![],'where':{'id':_0x2878e7[_0x8101('0x48')]['id']}},_0x4eea78={};_0x4eea78['model']=_[_0x8101('0x37')](db[_0x8101('0x2f')][_0x8101('0x30')]);_0x4eea78[_0x8101('0x36')]=_[_0x8101('0x37')](_0x2878e7['query']);_0x4eea78[_0x8101('0x38')]=_['intersection'](_0x4eea78[_0x8101('0x34')],_0x4eea78[_0x8101('0x36')]);_0x4b9c44[_0x8101('0x39')]=_['intersection'](_0x4eea78[_0x8101('0x34')],qs[_0x8101('0x3b')](_0x2878e7['query'][_0x8101('0x3b')]));_0x4b9c44[_0x8101('0x39')]=_0x4b9c44[_0x8101('0x39')][_0x8101('0x3c')]?_0x4b9c44[_0x8101('0x39')]:_0x4eea78['model'];if(_0x2878e7[_0x8101('0x36')]['includeAll']){_0x4b9c44[_0x8101('0x44')]=[{'all':!![]}];}_0x4b9c44=_['merge']({},_0x4b9c44,_0x2878e7[_0x8101('0x49')]);return db[_0x8101('0x2f')]['find'](_0x4b9c44)['then'](handleEntityNotFound(_0x382bdd,null))[_0x8101('0x29')](respondWithResult(_0x382bdd,null))['catch'](handleError(_0x382bdd,null));};exports[_0x8101('0x4a')]=function(_0x36a157,_0x148e25){return db[_0x8101('0x2f')][_0x8101('0x4a')](_0x36a157[_0x8101('0x4b')],{})[_0x8101('0x29')](respondWithResult(_0x148e25,0xc9))[_0x8101('0x47')](handleError(_0x148e25,null));};exports[_0x8101('0x4c')]=function(_0x5df39c,_0x4ea03f){var _0x362d45={'where':{'id':_0x5df39c['params']['id']}},_0x42ce1c={};_0x42ce1c['model']=_[_0x8101('0x37')](db[_0x8101('0x2f')]['rawAttributes']);_0x362d45[_0x8101('0x39')]=_[_0x8101('0x3a')](_0x42ce1c[_0x8101('0x34')],qs[_0x8101('0x3b')](_0x5df39c[_0x8101('0x36')]['fields']));_0x362d45[_0x8101('0x39')]=_0x362d45['attributes'][_0x8101('0x3c')]?_0x362d45[_0x8101('0x39')]:_0x42ce1c[_0x8101('0x34')];if(_0x5df39c['query'][_0x8101('0x4d')]){_0x362d45[_0x8101('0x44')]=[{'all':!![]}];}_0x362d45=_[_0x8101('0x43')]({},_0x362d45,_0x5df39c[_0x8101('0x49')]);return db[_0x8101('0x2f')]['find'](_0x362d45)[_0x8101('0x29')](handleEntityNotFound(_0x4ea03f,null))[_0x8101('0x29')](function(_0x220dc){if(_0x220dc){var _0x5c9e9d=_0x220dc[_0x8101('0x4e')]({'plain':!![]});_0x5c9e9d=qs[_0x8101('0x4f')](_0x5c9e9d,['id',_0x8101('0x50'),_0x8101('0x51'),_0x8101('0x52')]);_0x5df39c['body']=_['omit'](_0x5df39c['body'],['id',_0x8101('0x50'),_0x8101('0x51')]);return db['sequelize'][_0x8101('0x53')](function(_0x2cd66f){return db[_0x8101('0x2f')][_0x8101('0x4a')](_[_0x8101('0x43')](_0x5c9e9d,_0x5df39c[_0x8101('0x4b')]),{'include':_0x5df39c[_0x8101('0x36')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x2cd66f})['then'](function(_0x155957){var _0x481261=_0x155957[_0x8101('0x4e')]({'plain':!![]});return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x5df39c[_0x8101('0x48')]['id']},'raw':!![]})[_0x8101('0x29')](function(_0x13d9e6){if(_0x13d9e6){return BPromise[_0x8101('0x54')](_0x13d9e6,function(_0x48509d){return new BPromise(function(_0xbce807,_0x3a3657){if(_0x48509d[_0x8101('0x55')]===null||_0x48509d[_0x8101('0x55')]===0x1)_0xbce807(null);return db[_0x8101('0x56')][_0x8101('0x45')]({'where':{'sectionId':_0x48509d['id']},'raw':!![]})[_0x8101('0x29')](function(_0x34cb98){var _0x748719=_['map'](_0x34cb98,function(_0x4b9f08){return qs[_0x8101('0x4f')](_0x4b9f08,['id',_0x8101('0x50'),'updatedAt',_0x8101('0x57')]);});_0xbce807(_0x748719);})['catch'](function(_0x5139cd){_0x3a3657(_0x5139cd);});})[_0x8101('0x29')](function(_0x4f7156){var _0x564fbd=qs[_0x8101('0x4f')](_0x48509d,['id',_0x8101('0x50'),_0x8101('0x51')]);_0x564fbd[_0x8101('0x58')]=_0x481261['id'];if(_0x4f7156)_0x564fbd['Resources']=_0x4f7156;return _0x564fbd;})['then'](function(_0x42d2e0){return db[_0x8101('0x59')]['create'](_0x42d2e0,{'include':[{'model':db['UserProfileResource'],'as':_0x8101('0x5a')}],'raw':!![],'transaction':_0x2cd66f});});})[_0x8101('0x29')](function(){return _0x481261;});}});});});}})[_0x8101('0x29')](respondWithResult(_0x4ea03f,0xc9))[_0x8101('0x47')](handleError(_0x4ea03f,null));};exports[_0x8101('0x28')]=function(_0x1e914d,_0x52457e){if(_0x1e914d[_0x8101('0x4b')]['id']){delete _0x1e914d[_0x8101('0x4b')]['id'];}return db[_0x8101('0x2f')][_0x8101('0x5b')]({'where':{'id':_0x1e914d[_0x8101('0x48')]['id']}})[_0x8101('0x29')](handleEntityNotFound(_0x52457e,null))[_0x8101('0x29')](saveUpdates(_0x1e914d['body'],null))['then'](respondWithResult(_0x52457e,null))['catch'](handleError(_0x52457e,null));};exports[_0x8101('0x2a')]=function(_0x56b10f,_0x30a435){return db[_0x8101('0x2f')]['find']({'where':{'id':_0x56b10f[_0x8101('0x48')]['id']}})[_0x8101('0x29')](handleEntityNotFound(_0x30a435,null))[_0x8101('0x29')](removeEntity(_0x30a435,null))[_0x8101('0x47')](handleError(_0x30a435,null));};exports[_0x8101('0x5c')]=function(_0x38160f,_0x530ebe){return db[_0x8101('0x2f')]['describe']()[_0x8101('0x29')](respondWithResult(_0x530ebe,null))[_0x8101('0x47')](handleError(_0x530ebe,null));};exports[_0x8101('0x5d')]=function(_0x24053e,_0xc906b1){var _0x30840c=_0x24053e[_0x8101('0x4b')];return db['UserProfile']['find']({'where':{'id':_0x24053e['params']['id']}})[_0x8101('0x29')](handleEntityNotFound(_0xc906b1,null))[_0x8101('0x29')](function(_0x5a717c){if(_0x5a717c){return db[_0x8101('0x5e')]['transaction'](function(_0x5a51d6){return db[_0x8101('0x59')]['destroy']({'where':{'userProfileId':_0x24053e[_0x8101('0x48')]['id'],'sectionId':_[_0x8101('0x35')](_0x30840c,function(_0x1b75cd){return _0x1b75cd[_0x8101('0x57')];})},'transaction':_0x5a51d6})[_0x8101('0x29')](function(){var _0x1adf20=_['map'](_0x30840c,function(_0x5ba897){_0x5ba897['userProfileId']=_0x24053e[_0x8101('0x48')]['id'];return _0x5ba897;});var _0x5c42c4=[];return BPromise[_0x8101('0x54')](_0x1adf20,function(_0x1fe057){return db[_0x8101('0x59')][_0x8101('0x4a')](_0x1fe057,{'include':[{'model':db[_0x8101('0x56')],'as':_0x8101('0x5a')}],'raw':!![],'transaction':_0x5a51d6})['then'](function(_0x45ea4c){_0x5c42c4[_0x8101('0x5f')](_0x45ea4c[_0x8101('0x4e')]({'plain':!![]}));});})[_0x8101('0x29')](function(){return _0x5c42c4;});});});}})[_0x8101('0x29')](function(_0x2b025c){return _0x2b025c;})[_0x8101('0x29')](respondWithResult(_0xc906b1,null))[_0x8101('0x47')](handleError(_0xc906b1,null));};exports['removeSections']=function(_0x4eda89,_0x4ebeb6){var _0xf7206d;return db[_0x8101('0x2f')][_0x8101('0x5b')]({'where':{'id':_0x4eda89[_0x8101('0x48')]['id']},'attributes':['id','name']})[_0x8101('0x29')](handleEntityNotFound(_0x4ebeb6,null))['then'](function(_0x594602){if(_0x594602){_0xf7206d=_0x594602;return db['UserProfileSection'][_0x8101('0x2a')]({'where':{'userProfileId':_0x4eda89['params']['id'],'sectionId':_0x4eda89[_0x8101('0x36')][_0x8101('0x60')]}});}})[_0x8101('0x29')](function(){return _0xf7206d;})[_0x8101('0x29')](respondWithStatusCode(_0x4ebeb6,null))[_0x8101('0x47')](handleError(_0x4ebeb6,null));};exports[_0x8101('0x61')]=function(_0x3144f2,_0x142a02){var _0x322621=[];var _0x1f3cdd=[];return db[_0x8101('0x59')]['findAll']({'where':{'userProfileId':_0x3144f2['params']['id']},'raw':!![]})[_0x8101('0x29')](function(_0x931e39){_0x322621=_[_0x8101('0x42')](_0x931e39,function(_0x12be81){return _0x12be81[_0x8101('0x62')]===0x1||_['includes']([0x3eb,0x709],_0x12be81[_0x8101('0x57')]);});if(!_['isEmpty'](_0x322621)){return _[_0x8101('0x35')](_0x322621,function(_0x3b87a8){return _0x3b87a8[_0x8101('0x57')];});}else{return;}})[_0x8101('0x29')](function(_0x39712a){if(_0x39712a)_0x1f3cdd=_0x39712a;if(_[_0x8101('0x63')](_0x1f3cdd,0x64)){var _0x37ec58=_[_0x8101('0x5b')](_0x322621,{'sectionId':0x64});return hasDefaultDashboard(_0x37ec58)[_0x8101('0x29')](function(_0x5620f5){return _[_0x8101('0x35')](_0x322621,function(_0x442775){if(_0x442775['sectionId']===0x64){_0x442775['subsections']=_0x5620f5;}return _0x442775;});});}else{return;}})[_0x8101('0x29')](function(_0xcf0e79){if(_0xcf0e79)_0x322621=_0xcf0e79;if(_[_0x8101('0x63')](_0x1f3cdd,0x3eb)){var _0x5c84a6=_[_0x8101('0x5b')](_0x322621,{'sectionId':0x3eb});return getCustomDashboards(_0x5c84a6)[_0x8101('0x29')](function(_0x1a368c){return _['map'](_0x322621,function(_0x161701){if(_0x5c84a6[_0x8101('0x62')]){if(_0x161701['sectionId']===0x3eb){_0x161701[_0x8101('0x64')]=_0x1a368c;}}else{if(_0x161701[_0x8101('0x57')]===0x64){if(!_0x161701[_0x8101('0x64')]){_0x161701[_0x8101('0x64')]=[];}_0x161701['subsections']=_0x161701[_0x8101('0x64')]['concat'](_0x1a368c);}}return _0x161701;});});}else{return;}})[_0x8101('0x29')](function(_0x2ceb8f){if(_0x2ceb8f)_0x322621=_0x2ceb8f;if(_[_0x8101('0x63')](_0x1f3cdd,0x709)){var _0x2b30eb=_[_0x8101('0x5b')](_0x322621,{'sectionId':0x709});return getPlugins(_0x2b30eb)[_0x8101('0x29')](function(_0x504ba2){if(_0x2b30eb[_0x8101('0x62')]){return _[_0x8101('0x35')](_0x322621,function(_0x2bd9de){if(_0x2bd9de[_0x8101('0x57')]===0x709){_0x2bd9de[_0x8101('0x64')]=_0x504ba2;}return _0x2bd9de;});}else{var _0x1801b0={'sectionId':0x76c,'enabled':0x1,'subsections':_0x504ba2};var _0x4479b2=_[_0x8101('0x35')](_0x322621);_0x4479b2[_0x8101('0x5f')](_0x1801b0);return _0x4479b2;}});}else{return;}})[_0x8101('0x29')](function(_0x3024af){if(_0x3024af)_0x322621=_0x3024af;return _[_0x8101('0x42')](_0x322621,[_0x8101('0x62'),0x1]);})[_0x8101('0x29')](respondWithResult(_0x142a02,null))[_0x8101('0x47')](handleError(_0x142a02,null));};function hasDefaultDashboard(_0x5a8dfe){var _0x458768=[0x65];return new BPromise(function(_0x37e23a,_0x3513d4){try{if(_0x5a8dfe[_0x8101('0x55')]){_0x37e23a(_0x458768);}else{return db[_0x8101('0x56')]['findOne']({'where':{'sectionId':_0x5a8dfe['id']},'raw':!![]})[_0x8101('0x29')](function(_0x23b89f){_0x23b89f?_0x37e23a(_0x458768):_0x37e23a();});}}catch(_0x23d8ff){_0x3513d4(_0x23d8ff);}});}function getCustomDashboards(_0x2c4a7a){var _0x5077fc=[];return new BPromise(function(_0x1271ea,_0x416fea){try{if(_0x2c4a7a[_0x8101('0x55')]){return db[_0x8101('0x65')]['findAll']({'raw':!![]})[_0x8101('0x29')](function(_0x288f8e){_0x288f8e[_0x8101('0x66')](function(_0x35617b){_0x5077fc[_0x8101('0x5f')](_0x35617b['id']+0x1869f);});_0x1271ea(_0x5077fc);});}else{return db[_0x8101('0x56')]['findAll']({'where':{'sectionId':_0x2c4a7a['id']},'raw':!![]})[_0x8101('0x29')](function(_0x4ab24e){_0x4ab24e[_0x8101('0x66')](function(_0x978109){_0x5077fc[_0x8101('0x5f')](_0x978109[_0x8101('0x67')]+0x1869f);});_0x1271ea(_0x5077fc);});}}catch(_0x2c705c){_0x416fea(_0x2c705c);}});}function getPlugins(_0x5d4e1c){var _0x4ec148=[];return new BPromise(function(_0x578a6e,_0x1bccdf){try{if(_0x5d4e1c[_0x8101('0x55')]){return db[_0x8101('0x68')]['findAll']({'raw':!![]})[_0x8101('0x29')](function(_0x5287d4){_0x5287d4[_0x8101('0x66')](function(_0x49cd05){_0x4ec148[_0x8101('0x5f')](_0x49cd05['id']+0x15b38);});_0x578a6e(_0x4ec148);});}else{return db[_0x8101('0x56')]['findAll']({'where':{'sectionId':_0x5d4e1c['id']},'raw':!![]})[_0x8101('0x29')](function(_0x493e51){_0x493e51['forEach'](function(_0xc0b59a){_0x4ec148[_0x8101('0x5f')](_0xc0b59a['resourceId']+0x15b38);});_0x578a6e(_0x4ec148);});}}catch(_0x34a821){_0x1bccdf(_0x34a821);}});}exports[_0x8101('0x69')]=function(_0x4c796e,_0x18f222){return db[_0x8101('0x2f')][_0x8101('0x5b')]({'where':{'id':_0x4c796e[_0x8101('0x48')]['id']}})[_0x8101('0x29')](handleEntityNotFound(_0x18f222,null))[_0x8101('0x29')](function(_0x4dd104){if(_0x4dd104){return db[_0x8101('0x5e')][_0x8101('0x53')](function(_0x2d3130){return db['UserProfileSection'][_0x8101('0x45')]({'where':{'userProfileId':_0x4c796e[_0x8101('0x48')]['id']},'attributes':['id'],'raw':!![]})[_0x8101('0x29')](function(_0x10d934){if(_0x10d934){return db[_0x8101('0x59')][_0x8101('0x2a')]({'where':{'userProfileId':_0x4c796e[_0x8101('0x48')]['id'],'id':_[_0x8101('0x35')](_0x10d934,function(_0x41a497){return _0x41a497['id'];})},'transaction':_0x2d3130});}})['then'](function(_0x963daa){var _0x34b65a=_[_0x8101('0x35')](_0x4c796e[_0x8101('0x4b')],function(_0x53399e){_0x53399e[_0x8101('0x58')]=_0x4c796e['params']['id'];return _0x53399e;});return db[_0x8101('0x59')][_0x8101('0x6a')](_0x34b65a,{'raw':!![],'transaction':_0x2d3130});})[_0x8101('0x29')](function(_0x1164e5){var _0x3b18f5=_[_0x8101('0x42')](_[_0x8101('0x35')](_0x1164e5,function(_0x16ee29){return _0x16ee29[_0x8101('0x4e')]({'plain':!![]});}),{'includeAll':![]});if(_0x3b18f5){return db[_0x8101('0x59')][_0x8101('0x45')]({'where':{'userProfileId':_0x4c796e[_0x8101('0x48')]['id'],'sectionId':_[_0x8101('0x35')](_0x3b18f5,function(_0x5aaecc){return _0x5aaecc[_0x8101('0x57')];})},'attributes':['id',_0x8101('0x57')],'raw':!![]})[_0x8101('0x29')](function(_0x17ced9){var _0x36af24=_['map'](_0x4c796e[_0x8101('0x4b')],function(_0x3c7336){_0x3c7336[_0x8101('0x58')]=_0x4c796e[_0x8101('0x48')]['id'];return _0x3c7336;});return db[_0x8101('0x56')]['bulkCreate'](_0x36af24,{'raw':!![],'transaction':_0x2d3130});});}})[_0x8101('0x47')](handleError(_0x18f222,null));});}})[_0x8101('0x29')](function(_0x1c294d){var _0x491925=_[_0x8101('0x35')](_0x1c294d,function(_0x5b8245){return _0x5b8245[_0x8101('0x4e')]({'plain':!![]});});})[_0x8101('0x29')](respondWithResult(_0x18f222,null))['catch'](handleError(_0x18f222,null));};exports['removeResources']=function(_0x430ec7,_0x411ad4,_0x5747c5){return db[_0x8101('0x2f')][_0x8101('0x5b')]({'where':{'id':_0x430ec7['params']['id']}})[_0x8101('0x29')](handleEntityNotFound(_0x411ad4,null))['then'](function(_0x53f530){if(_0x53f530){return _0x53f530[_0x8101('0x6b')](_0x430ec7[_0x8101('0x36')]['ids']);}})[_0x8101('0x29')](respondWithStatusCode(_0x411ad4,null))[_0x8101('0x47')](handleError(_0x411ad4,null));};exports['getResources']=function(_0x2bd6b1,_0x190080){var _0x1a792f={};if(!_0x2bd6b1[_0x8101('0x36')][_0x8101('0x6c')])throw new Error('Missing\x20section\x20parameter');if(!_0x2bd6b1[_0x8101('0x36')]['hasOwnProperty'](_0x8101('0x3e'))){_0x1a792f[_0x8101('0x21')]=qs['limit'](_0x2bd6b1[_0x8101('0x36')][_0x8101('0x21')]);_0x1a792f[_0x8101('0x1f')]=qs[_0x8101('0x1f')](_0x2bd6b1[_0x8101('0x36')][_0x8101('0x1f')]);}return db[_0x8101('0x2f')][_0x8101('0x5b')]({'where':{'id':_0x2bd6b1[_0x8101('0x48')]['id']}})[_0x8101('0x29')](function(_0x578be3){if(!_0x578be3)throw new Error(_0x8101('0x6d')+_0x2bd6b1['params']['id']);return db[_0x8101('0x2f')][_0x8101('0x6e')](_0x2bd6b1);})[_0x8101('0x29')](respondWithFilteredResult(_0x190080,_0x1a792f))[_0x8101('0x47')](handleError(_0x190080,null));}; \ No newline at end of file +var _0x0d0a=['UserProfileResource','sectionId','userProfileId','UserProfileSection','Resources','describe','addSections','push','ids','getSections','enabled','includes','isEmpty','subsections','concat','findOne','Dashboard','forEach','resourceId','addResources','bulkCreate','removeResources','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','end','error','stack','name','UserProfile','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','clone','get','createdAt','crudPermissions','omit','updatedAt','sequelize','transaction','autoAssociation'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0d0a,0xf6));var _0xa0d0=function(_0xb2386e,_0x40c6b2){_0xb2386e=_0xb2386e-0x0;var _0x568491=_0x0d0a[_0xb2386e];return _0x568491;};'use strict';var emlformat=require(_0xa0d0('0x0'));var rimraf=require(_0xa0d0('0x1'));var zipdir=require(_0xa0d0('0x2'));var jsonpatch=require(_0xa0d0('0x3'));var rp=require(_0xa0d0('0x4'));var moment=require(_0xa0d0('0x5'));var BPromise=require(_0xa0d0('0x6'));var Mustache=require('mustache');var util=require(_0xa0d0('0x7'));var path=require(_0xa0d0('0x8'));var sox=require('sox');var csv=require(_0xa0d0('0x9'));var ejs=require(_0xa0d0('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa0d0('0xb'));var crypto=require(_0xa0d0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa0d0('0xd'));var toCsv=require(_0xa0d0('0x9'));var querystring=require(_0xa0d0('0xe'));var Papa=require(_0xa0d0('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa0d0('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa0d0('0x11'));var logger=require(_0xa0d0('0x12'))('api');var utils=require(_0xa0d0('0x13'));var config=require(_0xa0d0('0x14'));var licenseUtil=require(_0xa0d0('0x15'));var db=require('../../mysqldb')['db'];config[_0xa0d0('0x16')]=_[_0xa0d0('0x17')](config[_0xa0d0('0x16')],{'host':_0xa0d0('0x18'),'port':0x18eb});var socket=require(_0xa0d0('0x19'))(new Redis(config[_0xa0d0('0x16')]));require(_0xa0d0('0x1a'))['register'](socket);function respondWithStatusCode(_0xc08482,_0xf48e22){_0xf48e22=_0xf48e22||0xcc;return function(_0x41d267){if(_0x41d267){return _0xc08482[_0xa0d0('0x1b')](_0xf48e22);}return _0xc08482['status'](_0xf48e22)['end']();};}function respondWithResult(_0x482ae9,_0x3ffd64){_0x3ffd64=_0x3ffd64||0xc8;return function(_0x582ca1){if(_0x582ca1){return _0x482ae9[_0xa0d0('0x1c')](_0x3ffd64)['json'](_0x582ca1);}};}function respondWithFilteredResult(_0x3747ac,_0x36e674){return function(_0x10d2a0){if(_0x10d2a0){var _0x42bdee=typeof _0x36e674[_0xa0d0('0x1d')]===_0xa0d0('0x1e')&&typeof _0x36e674[_0xa0d0('0x1f')]==='undefined';var _0x1132b2=_0x10d2a0[_0xa0d0('0x20')];var _0x31ce62=_0x42bdee?0x0:_0x36e674[_0xa0d0('0x1d')];var _0x1ec680=_0x42bdee?_0x10d2a0[_0xa0d0('0x20')]:_0x36e674[_0xa0d0('0x1d')]+_0x36e674[_0xa0d0('0x1f')];var _0x40da96;if(_0x1ec680>=_0x1132b2){_0x1ec680=_0x1132b2;_0x40da96=0xc8;}else{_0x40da96=0xce;}_0x3747ac['status'](_0x40da96);return _0x3747ac[_0xa0d0('0x21')](_0xa0d0('0x22'),_0x31ce62+'-'+_0x1ec680+'/'+_0x1132b2)[_0xa0d0('0x23')](_0x10d2a0);}return null;};}function patchUpdates(_0x3630fd){return function(_0x237201){try{jsonpatch[_0xa0d0('0x24')](_0x237201,_0x3630fd,!![]);}catch(_0x2da0fd){return BPromise[_0xa0d0('0x25')](_0x2da0fd);}return _0x237201[_0xa0d0('0x26')]();};}function saveUpdates(_0xe884ea,_0x3e005d){return function(_0x563465){if(_0x563465){return _0x563465[_0xa0d0('0x27')](_0xe884ea)['then'](function(_0x5178b8){return _0x5178b8;});}return null;};}function removeEntity(_0x2261cc,_0x229de8){return function(_0x1e9863){if(_0x1e9863){return _0x1e9863[_0xa0d0('0x28')]()[_0xa0d0('0x29')](function(){_0x2261cc[_0xa0d0('0x1c')](0xcc)[_0xa0d0('0x2a')]();});}};}function handleEntityNotFound(_0x494022,_0x5e6d9f){return function(_0x3ba46d){if(!_0x3ba46d){_0x494022[_0xa0d0('0x1b')](0x194);}return _0x3ba46d;};}function handleError(_0x400286,_0x11e966){_0x11e966=_0x11e966||0x1f4;return function(_0x4351c1){logger[_0xa0d0('0x2b')](_0x4351c1[_0xa0d0('0x2c')]);if(_0x4351c1[_0xa0d0('0x2d')]){delete _0x4351c1['name'];}_0x400286[_0xa0d0('0x1c')](_0x11e966)['send'](_0x4351c1);};}exports['index']=function(_0x372d3f,_0x273e09){var _0x337929={},_0xe47f6e={},_0x168ea0={'count':0x0,'rows':[]};var _0xa5517=_['map'](db[_0xa0d0('0x2e')][_0xa0d0('0x2f')],function(_0x4c6fd3){return{'name':_0x4c6fd3[_0xa0d0('0x30')],'type':_0x4c6fd3[_0xa0d0('0x31')]['key']};});_0xe47f6e['model']=_[_0xa0d0('0x32')](_0xa5517,'name');_0xe47f6e[_0xa0d0('0x33')]=_[_0xa0d0('0x34')](_0x372d3f['query']);_0xe47f6e[_0xa0d0('0x35')]=_[_0xa0d0('0x36')](_0xe47f6e[_0xa0d0('0x37')],_0xe47f6e[_0xa0d0('0x33')]);_0x337929[_0xa0d0('0x38')]=_[_0xa0d0('0x36')](_0xe47f6e[_0xa0d0('0x37')],qs[_0xa0d0('0x39')](_0x372d3f['query'][_0xa0d0('0x39')]));_0x337929[_0xa0d0('0x38')]=_0x337929[_0xa0d0('0x38')][_0xa0d0('0x3a')]?_0x337929['attributes']:_0xe47f6e[_0xa0d0('0x37')];if(!_0x372d3f['query'][_0xa0d0('0x3b')](_0xa0d0('0x3c'))){_0x337929[_0xa0d0('0x1f')]=qs[_0xa0d0('0x1f')](_0x372d3f[_0xa0d0('0x33')][_0xa0d0('0x1f')]);_0x337929['offset']=qs['offset'](_0x372d3f[_0xa0d0('0x33')]['offset']);}_0x337929[_0xa0d0('0x3d')]=qs['sort'](_0x372d3f[_0xa0d0('0x33')][_0xa0d0('0x3e')]);_0x337929[_0xa0d0('0x3f')]=qs['filters'](_[_0xa0d0('0x40')](_0x372d3f[_0xa0d0('0x33')],_0xe47f6e[_0xa0d0('0x35')]),_0xa5517);if(_0x372d3f[_0xa0d0('0x33')][_0xa0d0('0x41')]){_0x337929[_0xa0d0('0x3f')]=_[_0xa0d0('0x42')](_0x337929[_0xa0d0('0x3f')],{'$or':_[_0xa0d0('0x32')](_0xa5517,function(_0x5828b4){if(_0x5828b4['type']!==_0xa0d0('0x43')){var _0x3df469={};_0x3df469[_0x5828b4[_0xa0d0('0x2d')]]={'$like':'%'+_0x372d3f[_0xa0d0('0x33')][_0xa0d0('0x41')]+'%'};return _0x3df469;}})});}_0x337929=_[_0xa0d0('0x42')]({},_0x337929,_0x372d3f[_0xa0d0('0x44')]);var _0x5d0ed3={'where':_0x337929['where']};return db[_0xa0d0('0x2e')]['count'](_0x5d0ed3)['then'](function(_0xbee6c9){_0x168ea0[_0xa0d0('0x20')]=_0xbee6c9;if(_0x372d3f['query'][_0xa0d0('0x45')]){_0x337929[_0xa0d0('0x46')]=[{'all':!![]}];}return db[_0xa0d0('0x2e')][_0xa0d0('0x47')](_0x337929);})[_0xa0d0('0x29')](function(_0x5525af){_0x168ea0[_0xa0d0('0x48')]=_0x5525af;return _0x168ea0;})['then'](respondWithFilteredResult(_0x273e09,_0x337929))[_0xa0d0('0x49')](handleError(_0x273e09,null));};exports['show']=function(_0x50e628,_0x395678){var _0x5f048d={'raw':![],'where':{'id':_0x50e628[_0xa0d0('0x4a')]['id']}},_0x57f19a={};_0x57f19a[_0xa0d0('0x37')]=_['keys'](db[_0xa0d0('0x2e')][_0xa0d0('0x2f')]);_0x57f19a[_0xa0d0('0x33')]=_[_0xa0d0('0x34')](_0x50e628[_0xa0d0('0x33')]);_0x57f19a['filters']=_[_0xa0d0('0x36')](_0x57f19a['model'],_0x57f19a[_0xa0d0('0x33')]);_0x5f048d['attributes']=_[_0xa0d0('0x36')](_0x57f19a[_0xa0d0('0x37')],qs[_0xa0d0('0x39')](_0x50e628[_0xa0d0('0x33')]['fields']));_0x5f048d['attributes']=_0x5f048d[_0xa0d0('0x38')][_0xa0d0('0x3a')]?_0x5f048d[_0xa0d0('0x38')]:_0x57f19a[_0xa0d0('0x37')];if(_0x50e628[_0xa0d0('0x33')][_0xa0d0('0x45')]){_0x5f048d[_0xa0d0('0x46')]=[{'all':!![]}];}_0x5f048d=_['merge']({},_0x5f048d,_0x50e628[_0xa0d0('0x44')]);return db[_0xa0d0('0x2e')][_0xa0d0('0x4b')](_0x5f048d)['then'](handleEntityNotFound(_0x395678,null))[_0xa0d0('0x29')](respondWithResult(_0x395678,null))['catch'](handleError(_0x395678,null));};exports[_0xa0d0('0x4c')]=function(_0x3ae491,_0xa30e39){return db[_0xa0d0('0x2e')][_0xa0d0('0x4c')](_0x3ae491[_0xa0d0('0x4d')],{})[_0xa0d0('0x29')](respondWithResult(_0xa30e39,0xc9))['catch'](handleError(_0xa30e39,null));};exports[_0xa0d0('0x4e')]=function(_0x4f2909,_0x25c91d){var _0x24fa71={'where':{'id':_0x4f2909[_0xa0d0('0x4a')]['id']}},_0x4a5389={};_0x4a5389['model']=_[_0xa0d0('0x34')](db[_0xa0d0('0x2e')][_0xa0d0('0x2f')]);_0x24fa71[_0xa0d0('0x38')]=_[_0xa0d0('0x36')](_0x4a5389[_0xa0d0('0x37')],qs[_0xa0d0('0x39')](_0x4f2909[_0xa0d0('0x33')][_0xa0d0('0x39')]));_0x24fa71[_0xa0d0('0x38')]=_0x24fa71[_0xa0d0('0x38')][_0xa0d0('0x3a')]?_0x24fa71[_0xa0d0('0x38')]:_0x4a5389[_0xa0d0('0x37')];if(_0x4f2909[_0xa0d0('0x33')]['includeAll']){_0x24fa71['include']=[{'all':!![]}];}_0x24fa71=_[_0xa0d0('0x42')]({},_0x24fa71,_0x4f2909[_0xa0d0('0x44')]);return db[_0xa0d0('0x2e')][_0xa0d0('0x4b')](_0x24fa71)[_0xa0d0('0x29')](handleEntityNotFound(_0x25c91d,null))[_0xa0d0('0x29')](function(_0x45fa8f){if(_0x45fa8f){var _0x4e7246=_0x45fa8f[_0xa0d0('0x4f')]({'plain':!![]});_0x4e7246=qs['omit'](_0x4e7246,['id',_0xa0d0('0x50'),'updatedAt',_0xa0d0('0x51')]);_0x4f2909[_0xa0d0('0x4d')]=_[_0xa0d0('0x52')](_0x4f2909[_0xa0d0('0x4d')],['id',_0xa0d0('0x50'),_0xa0d0('0x53')]);return db[_0xa0d0('0x54')][_0xa0d0('0x55')](function(_0x3859fd){return db[_0xa0d0('0x2e')][_0xa0d0('0x4c')](_[_0xa0d0('0x42')](_0x4e7246,_0x4f2909[_0xa0d0('0x4d')]),{'include':_0x4f2909[_0xa0d0('0x33')][_0xa0d0('0x45')]?[{'all':!![]}]:undefined,'transaction':_0x3859fd})[_0xa0d0('0x29')](function(_0x178946){var _0x572f10=_0x178946[_0xa0d0('0x4f')]({'plain':!![]});return db['UserProfileSection'][_0xa0d0('0x47')]({'where':{'userProfileId':_0x4f2909[_0xa0d0('0x4a')]['id']},'raw':!![]})[_0xa0d0('0x29')](function(_0x48c5d6){if(_0x48c5d6){return BPromise['each'](_0x48c5d6,function(_0x42c568){return new BPromise(function(_0x150cb0,_0x35b1b4){if(_0x42c568['autoAssociation']===null||_0x42c568[_0xa0d0('0x56')]===0x1)_0x150cb0(null);return db[_0xa0d0('0x57')]['findAll']({'where':{'sectionId':_0x42c568['id']},'raw':!![]})[_0xa0d0('0x29')](function(_0x7a143f){var _0x256c1a=_[_0xa0d0('0x32')](_0x7a143f,function(_0x541524){return qs['omit'](_0x541524,['id',_0xa0d0('0x50'),_0xa0d0('0x53'),_0xa0d0('0x58')]);});_0x150cb0(_0x256c1a);})[_0xa0d0('0x49')](function(_0x44f7f7){_0x35b1b4(_0x44f7f7);});})[_0xa0d0('0x29')](function(_0x13fdb7){var _0x43f14c=qs[_0xa0d0('0x52')](_0x42c568,['id',_0xa0d0('0x50'),_0xa0d0('0x53')]);_0x43f14c[_0xa0d0('0x59')]=_0x572f10['id'];if(_0x13fdb7)_0x43f14c['Resources']=_0x13fdb7;return _0x43f14c;})['then'](function(_0x297d2d){return db[_0xa0d0('0x5a')][_0xa0d0('0x4c')](_0x297d2d,{'include':[{'model':db[_0xa0d0('0x57')],'as':_0xa0d0('0x5b')}],'raw':!![],'transaction':_0x3859fd});});})[_0xa0d0('0x29')](function(){return _0x572f10;});}});});});}})[_0xa0d0('0x29')](respondWithResult(_0x25c91d,0xc9))['catch'](handleError(_0x25c91d,null));};exports[_0xa0d0('0x27')]=function(_0x189e39,_0x258efd){if(_0x189e39[_0xa0d0('0x4d')]['id']){delete _0x189e39[_0xa0d0('0x4d')]['id'];}return db['UserProfile']['find']({'where':{'id':_0x189e39[_0xa0d0('0x4a')]['id']}})[_0xa0d0('0x29')](handleEntityNotFound(_0x258efd,null))[_0xa0d0('0x29')](saveUpdates(_0x189e39[_0xa0d0('0x4d')],null))[_0xa0d0('0x29')](respondWithResult(_0x258efd,null))[_0xa0d0('0x49')](handleError(_0x258efd,null));};exports['destroy']=function(_0x55f52b,_0x40f690){return db[_0xa0d0('0x2e')][_0xa0d0('0x4b')]({'where':{'id':_0x55f52b[_0xa0d0('0x4a')]['id']}})[_0xa0d0('0x29')](handleEntityNotFound(_0x40f690,null))[_0xa0d0('0x29')](removeEntity(_0x40f690,null))[_0xa0d0('0x49')](handleError(_0x40f690,null));};exports[_0xa0d0('0x5c')]=function(_0x5cf970,_0x214a21){return db[_0xa0d0('0x2e')][_0xa0d0('0x5c')]()['then'](respondWithResult(_0x214a21,null))['catch'](handleError(_0x214a21,null));};exports[_0xa0d0('0x5d')]=function(_0xb13f2f,_0x10e693){var _0x1e279c=_0xb13f2f['body'];return db[_0xa0d0('0x2e')][_0xa0d0('0x4b')]({'where':{'id':_0xb13f2f['params']['id']}})['then'](handleEntityNotFound(_0x10e693,null))[_0xa0d0('0x29')](function(_0x3b028a){if(_0x3b028a){return db[_0xa0d0('0x54')]['transaction'](function(_0x5297a0){return db[_0xa0d0('0x5a')][_0xa0d0('0x28')]({'where':{'userProfileId':_0xb13f2f['params']['id'],'sectionId':_[_0xa0d0('0x32')](_0x1e279c,function(_0x3967dd){return _0x3967dd['sectionId'];})},'transaction':_0x5297a0})['then'](function(){var _0x276ca0=_[_0xa0d0('0x32')](_0x1e279c,function(_0x15bd5f){_0x15bd5f[_0xa0d0('0x59')]=_0xb13f2f['params']['id'];return _0x15bd5f;});var _0x38af52=[];return BPromise['each'](_0x276ca0,function(_0x5a642e){return db['UserProfileSection']['create'](_0x5a642e,{'include':[{'model':db['UserProfileResource'],'as':_0xa0d0('0x5b')}],'raw':!![],'transaction':_0x5297a0})[_0xa0d0('0x29')](function(_0x1f7a6f){_0x38af52[_0xa0d0('0x5e')](_0x1f7a6f[_0xa0d0('0x4f')]({'plain':!![]}));});})[_0xa0d0('0x29')](function(){return _0x38af52;});});});}})[_0xa0d0('0x29')](function(_0x5e5781){return _0x5e5781;})[_0xa0d0('0x29')](respondWithResult(_0x10e693,null))[_0xa0d0('0x49')](handleError(_0x10e693,null));};exports['removeSections']=function(_0x5daf38,_0x57f115){var _0x4c06ce;return db[_0xa0d0('0x2e')]['find']({'where':{'id':_0x5daf38['params']['id']},'attributes':['id',_0xa0d0('0x2d')]})[_0xa0d0('0x29')](handleEntityNotFound(_0x57f115,null))[_0xa0d0('0x29')](function(_0xf48508){if(_0xf48508){_0x4c06ce=_0xf48508;return db[_0xa0d0('0x5a')][_0xa0d0('0x28')]({'where':{'userProfileId':_0x5daf38[_0xa0d0('0x4a')]['id'],'sectionId':_0x5daf38[_0xa0d0('0x33')][_0xa0d0('0x5f')]}});}})[_0xa0d0('0x29')](function(){return _0x4c06ce;})['then'](respondWithStatusCode(_0x57f115,null))[_0xa0d0('0x49')](handleError(_0x57f115,null));};exports[_0xa0d0('0x60')]=function(_0x572738,_0x156fe1){var _0x4a7fc3=[];var _0x506bb3=[];return db[_0xa0d0('0x5a')][_0xa0d0('0x47')]({'where':{'userProfileId':_0x572738[_0xa0d0('0x4a')]['id']},'raw':!![]})[_0xa0d0('0x29')](function(_0x1a496d){_0x4a7fc3=_[_0xa0d0('0x41')](_0x1a496d,function(_0x16a00a){return _0x16a00a[_0xa0d0('0x61')]===0x1||_[_0xa0d0('0x62')]([0x3eb,0x709],_0x16a00a['sectionId']);});if(!_[_0xa0d0('0x63')](_0x4a7fc3)){return _[_0xa0d0('0x32')](_0x4a7fc3,function(_0x224a20){return _0x224a20[_0xa0d0('0x58')];});}else{return;}})[_0xa0d0('0x29')](function(_0x13244d){if(_0x13244d)_0x506bb3=_0x13244d;if(_[_0xa0d0('0x62')](_0x506bb3,0x64)){var _0x356986=_[_0xa0d0('0x4b')](_0x4a7fc3,{'sectionId':0x64});return hasDefaultDashboard(_0x356986)[_0xa0d0('0x29')](function(_0x42912d){return _[_0xa0d0('0x32')](_0x4a7fc3,function(_0x4b2601){if(_0x4b2601[_0xa0d0('0x58')]===0x64){_0x4b2601[_0xa0d0('0x64')]=_0x42912d;}return _0x4b2601;});});}else{return;}})['then'](function(_0x3c466f){if(_0x3c466f)_0x4a7fc3=_0x3c466f;if(_[_0xa0d0('0x62')](_0x506bb3,0x3eb)){var _0xf24049=_[_0xa0d0('0x4b')](_0x4a7fc3,{'sectionId':0x3eb});return getCustomDashboards(_0xf24049)['then'](function(_0x508779){return _['map'](_0x4a7fc3,function(_0x20ca70){if(_0xf24049[_0xa0d0('0x61')]){if(_0x20ca70[_0xa0d0('0x58')]===0x3eb){_0x20ca70[_0xa0d0('0x64')]=_0x508779;}}else{if(_0x20ca70[_0xa0d0('0x58')]===0x64){if(!_0x20ca70[_0xa0d0('0x64')]){_0x20ca70[_0xa0d0('0x64')]=[];}_0x20ca70[_0xa0d0('0x64')]=_0x20ca70[_0xa0d0('0x64')][_0xa0d0('0x65')](_0x508779);}}return _0x20ca70;});});}else{return;}})[_0xa0d0('0x29')](function(_0x1099fa){if(_0x1099fa)_0x4a7fc3=_0x1099fa;if(_['includes'](_0x506bb3,0x709)){var _0xea62ec=_[_0xa0d0('0x4b')](_0x4a7fc3,{'sectionId':0x709});return getPlugins(_0xea62ec)[_0xa0d0('0x29')](function(_0x1bddb8){if(_0xea62ec[_0xa0d0('0x61')]){return _['map'](_0x4a7fc3,function(_0x29ea12){if(_0x29ea12[_0xa0d0('0x58')]===0x709){_0x29ea12[_0xa0d0('0x64')]=_0x1bddb8;}return _0x29ea12;});}else{var _0x5736e1={'sectionId':0x76c,'enabled':0x1,'subsections':_0x1bddb8};var _0xc5f401=_[_0xa0d0('0x32')](_0x4a7fc3);_0xc5f401[_0xa0d0('0x5e')](_0x5736e1);return _0xc5f401;}});}else{return;}})['then'](function(_0xd3a511){if(_0xd3a511)_0x4a7fc3=_0xd3a511;return _['filter'](_0x4a7fc3,[_0xa0d0('0x61'),0x1]);})[_0xa0d0('0x29')](respondWithResult(_0x156fe1,null))[_0xa0d0('0x49')](handleError(_0x156fe1,null));};function hasDefaultDashboard(_0x3423b7){var _0x4fe9e3=[0x65];return new BPromise(function(_0x5710d1,_0x2b3d42){try{if(_0x3423b7[_0xa0d0('0x56')]){_0x5710d1(_0x4fe9e3);}else{return db[_0xa0d0('0x57')][_0xa0d0('0x66')]({'where':{'sectionId':_0x3423b7['id']},'raw':!![]})[_0xa0d0('0x29')](function(_0x5574e6){_0x5574e6?_0x5710d1(_0x4fe9e3):_0x5710d1();});}}catch(_0x593ad9){_0x2b3d42(_0x593ad9);}});}function getCustomDashboards(_0x2c56b8){var _0x24da61=[];return new BPromise(function(_0x93ab21,_0x1ae3d4){try{if(_0x2c56b8[_0xa0d0('0x56')]){return db[_0xa0d0('0x67')]['findAll']({'raw':!![]})[_0xa0d0('0x29')](function(_0x1574e7){_0x1574e7[_0xa0d0('0x68')](function(_0x258e56){_0x24da61[_0xa0d0('0x5e')](_0x258e56['id']+0x1869f);});_0x93ab21(_0x24da61);});}else{return db['UserProfileResource'][_0xa0d0('0x47')]({'where':{'sectionId':_0x2c56b8['id']},'raw':!![]})[_0xa0d0('0x29')](function(_0x540e9c){_0x540e9c['forEach'](function(_0x380d6a){_0x24da61[_0xa0d0('0x5e')](_0x380d6a[_0xa0d0('0x69')]+0x1869f);});_0x93ab21(_0x24da61);});}}catch(_0x50e04f){_0x1ae3d4(_0x50e04f);}});}function getPlugins(_0x2f9aa7){var _0x1f5890=[];return new BPromise(function(_0x4f97f9,_0x257479){try{if(_0x2f9aa7[_0xa0d0('0x56')]){return db['Plugin'][_0xa0d0('0x47')]({'raw':!![]})[_0xa0d0('0x29')](function(_0x3b2db1){_0x3b2db1[_0xa0d0('0x68')](function(_0x36e33c){_0x1f5890[_0xa0d0('0x5e')](_0x36e33c['id']+0x15b38);});_0x4f97f9(_0x1f5890);});}else{return db[_0xa0d0('0x57')][_0xa0d0('0x47')]({'where':{'sectionId':_0x2f9aa7['id']},'raw':!![]})[_0xa0d0('0x29')](function(_0x171331){_0x171331[_0xa0d0('0x68')](function(_0x34d885){_0x1f5890[_0xa0d0('0x5e')](_0x34d885[_0xa0d0('0x69')]+0x15b38);});_0x4f97f9(_0x1f5890);});}}catch(_0x4756fb){_0x257479(_0x4756fb);}});}exports[_0xa0d0('0x6a')]=function(_0x524a74,_0x339058){return db['UserProfile'][_0xa0d0('0x4b')]({'where':{'id':_0x524a74['params']['id']}})[_0xa0d0('0x29')](handleEntityNotFound(_0x339058,null))[_0xa0d0('0x29')](function(_0xc1b983){if(_0xc1b983){return db[_0xa0d0('0x54')][_0xa0d0('0x55')](function(_0x3bcf2b){return db[_0xa0d0('0x5a')][_0xa0d0('0x47')]({'where':{'userProfileId':_0x524a74[_0xa0d0('0x4a')]['id']},'attributes':['id'],'raw':!![]})[_0xa0d0('0x29')](function(_0x37a2ee){if(_0x37a2ee){return db[_0xa0d0('0x5a')]['destroy']({'where':{'userProfileId':_0x524a74['params']['id'],'id':_[_0xa0d0('0x32')](_0x37a2ee,function(_0x2a3471){return _0x2a3471['id'];})},'transaction':_0x3bcf2b});}})[_0xa0d0('0x29')](function(_0x2cd4f5){var _0x57129f=_[_0xa0d0('0x32')](_0x524a74['body'],function(_0x15d053){_0x15d053[_0xa0d0('0x59')]=_0x524a74[_0xa0d0('0x4a')]['id'];return _0x15d053;});return db[_0xa0d0('0x5a')][_0xa0d0('0x6b')](_0x57129f,{'raw':!![],'transaction':_0x3bcf2b});})['then'](function(_0x420128){var _0x4b1e37=_[_0xa0d0('0x41')](_[_0xa0d0('0x32')](_0x420128,function(_0x1c756e){return _0x1c756e['get']({'plain':!![]});}),{'includeAll':![]});if(_0x4b1e37){return db[_0xa0d0('0x5a')][_0xa0d0('0x47')]({'where':{'userProfileId':_0x524a74[_0xa0d0('0x4a')]['id'],'sectionId':_[_0xa0d0('0x32')](_0x4b1e37,function(_0x42e64a){return _0x42e64a[_0xa0d0('0x58')];})},'attributes':['id',_0xa0d0('0x58')],'raw':!![]})[_0xa0d0('0x29')](function(_0x2a2ad2){var _0x52f63d=_[_0xa0d0('0x32')](_0x524a74[_0xa0d0('0x4d')],function(_0x417f34){_0x417f34[_0xa0d0('0x59')]=_0x524a74['params']['id'];return _0x417f34;});return db[_0xa0d0('0x57')][_0xa0d0('0x6b')](_0x52f63d,{'raw':!![],'transaction':_0x3bcf2b});});}})[_0xa0d0('0x49')](handleError(_0x339058,null));});}})[_0xa0d0('0x29')](function(_0x486ee8){var _0x2255c9=_['map'](_0x486ee8,function(_0x2124b5){return _0x2124b5[_0xa0d0('0x4f')]({'plain':!![]});});})[_0xa0d0('0x29')](respondWithResult(_0x339058,null))[_0xa0d0('0x49')](handleError(_0x339058,null));};exports[_0xa0d0('0x6c')]=function(_0x42e4b5,_0x2f75e3,_0x26ead9){return db[_0xa0d0('0x2e')][_0xa0d0('0x4b')]({'where':{'id':_0x42e4b5['params']['id']}})[_0xa0d0('0x29')](handleEntityNotFound(_0x2f75e3,null))[_0xa0d0('0x29')](function(_0x41c570){if(_0x41c570){return _0x41c570[_0xa0d0('0x6c')](_0x42e4b5[_0xa0d0('0x33')][_0xa0d0('0x5f')]);}})['then'](respondWithStatusCode(_0x2f75e3,null))['catch'](handleError(_0x2f75e3,null));};exports['getResources']=function(_0x4a70ce,_0x43a60b){var _0x30b43c={};if(!_0x4a70ce[_0xa0d0('0x33')]['section'])throw new Error('Missing\x20section\x20parameter');if(!_0x4a70ce['query'][_0xa0d0('0x3b')](_0xa0d0('0x3c'))){_0x30b43c['limit']=qs[_0xa0d0('0x1f')](_0x4a70ce[_0xa0d0('0x33')][_0xa0d0('0x1f')]);_0x30b43c[_0xa0d0('0x1d')]=qs[_0xa0d0('0x1d')](_0x4a70ce[_0xa0d0('0x33')][_0xa0d0('0x1d')]);}return db[_0xa0d0('0x2e')][_0xa0d0('0x4b')]({'where':{'id':_0x4a70ce[_0xa0d0('0x4a')]['id']}})['then'](function(_0x2adeda){if(!_0x2adeda)throw new Error(_0xa0d0('0x6d')+_0x4a70ce[_0xa0d0('0x4a')]['id']);return db[_0xa0d0('0x2e')][_0xa0d0('0x6e')](_0x4a70ce);})[_0xa0d0('0x29')](respondWithFilteredResult(_0x43a60b,_0x30b43c))[_0xa0d0('0x49')](handleError(_0x43a60b,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 11cd5f4..a60c462 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 _0xe260=['remove','emit','hook','exports','events','UserProfile','setMaxListeners','save','update'];(function(_0x2392bf,_0x975591){var _0xfa60e0=function(_0x2e82a9){while(--_0x2e82a9){_0x2392bf['push'](_0x2392bf['shift']());}};_0xfa60e0(++_0x975591);}(_0xe260,0x94));var _0x0e26=function(_0x16127c,_0x401f88){_0x16127c=_0x16127c-0x0;var _0x179b1a=_0xe260[_0x16127c];return _0x179b1a;};'use strict';var EventEmitter=require(_0x0e26('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x0e26('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x0e26('0x2')](0x0);var events={'afterCreate':_0x0e26('0x3'),'afterUpdate':_0x0e26('0x4'),'afterDestroy':_0x0e26('0x5')};function emitEvent(_0x16613c){return function(_0x4a2388,_0x937f2a,_0x141a58){UserProfileEvents[_0x0e26('0x6')](_0x16613c+':'+_0x4a2388['id'],_0x4a2388);UserProfileEvents['emit'](_0x16613c,_0x4a2388);_0x141a58(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x0e26('0x7')](e,emitEvent(event));}}module[_0x0e26('0x8')]=UserProfileEvents; \ No newline at end of file +var _0xcd05=['exports','events','save','update','remove','hook'];(function(_0x105a4e,_0x54cfa0){var _0x3e4c8f=function(_0x45a981){while(--_0x45a981){_0x105a4e['push'](_0x105a4e['shift']());}};_0x3e4c8f(++_0x54cfa0);}(_0xcd05,0x163));var _0x5cd0=function(_0x4843f9,_0x4af459){_0x4843f9=_0x4843f9-0x0;var _0x193c6a=_0xcd05[_0x4843f9];return _0x193c6a;};'use strict';var EventEmitter=require(_0x5cd0('0x0'));var UserProfile=require('../../mysqldb')['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5cd0('0x1'),'afterUpdate':_0x5cd0('0x2'),'afterDestroy':_0x5cd0('0x3')};function emitEvent(_0x35dfb3){return function(_0x48e5ac,_0x33b92d,_0x2d88ed){UserProfileEvents['emit'](_0x35dfb3+':'+_0x48e5ac['id'],_0x48e5ac);UserProfileEvents['emit'](_0x35dfb3,_0x48e5ac);_0x2d88ed(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x5cd0('0x4')](e,emitEvent(event));}}module[_0x5cd0('0x5')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 7dc53dc..0d2e833 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 _0xfd36=['SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','Tag','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','Reports','metrics','charAt','toUpperCase','slice','SELECT','select','ui.','InteractionId','ui.createdAt','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','OpenTabs','define','user_profiles','../../components/parsers/qs','section','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','all','ignore','autoAssociation','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','merge','key','VIRTUAL','foreignKey','forEach','includeAll','include','default','reportId','DefaultReports','CustomReports','count','rows','ids','customSorting','extraQueryConditions','Tags','color','tag','ThroughTags','openTabs','true','dataValues','fax','openchannel','whatsapp','lodash','./userProfile.attributes','squel','exports','models','filter','field','associatedResources','catch','value','model','findAll','then','name','resolve','UserProfileResource','map','AnalyticExtractedReport','resourceId','type','toLowerCase','childModel','odbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','Lists','lists','CmList','companies','CmCompany','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','Agents','agent','Telephones','membername','User','role','telephone','VoiceQueues','queue','VoiceQueue','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','mailqueues','MailQueue','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','Users','user','ZendeskAccount','SalesforceAccount','freshdeskaccounts','FreshdeskAccount'];(function(_0x2fef7c,_0x1e72c9){var _0x3a6212=function(_0x5f27a7){while(--_0x5f27a7){_0x2fef7c['push'](_0x2fef7c['shift']());}};_0x3a6212(++_0x1e72c9);}(_0xfd36,0x11e));var _0x6fd3=function(_0x147322,_0x5cc0a6){_0x147322=_0x147322-0x0;var _0x5b55e8=_0xfd36[_0x147322];return _0x5b55e8;};'use strict';var _=require(_0x6fd3('0x0'));var attributes=require(_0x6fd3('0x1'));var squel=require(_0x6fd3('0x2'));module[_0x6fd3('0x3')]=function(_0x2ec0dd){var _0x1d2172=_0x2ec0dd[_0x6fd3('0x4')];function _0x542a14(_0x1a8b12,_0x5a9b24){return new Promise(function(_0x263790,_0x5d6a36){if(!_0x5a9b24)return _0x263790(null);var _0x42bd36=_0x5a9b24[_0x6fd3('0x5')]?{[_0x5a9b24[_0x6fd3('0x5')][_0x6fd3('0x6')]]:_0x5a9b24[_0x6fd3('0x5')]['value']}:undefined;return _0x1d2172[_0x1a8b12]['findAll']({'where':_0x42bd36,'raw':!![]})['then'](function(_0x2c27e1){_0x5a9b24[_0x6fd3('0x7')]=_['map'](_0x2c27e1,'id');_0x263790(_0x5a9b24);})[_0x6fd3('0x8')](function(_0x5ceb08){_0x5d6a36(_0x5ceb08);});});}function _0x5f0032(_0x482f1a,_0x182ffe){return new Promise(function(_0x21bae5,_0x58ed40){var _0x5ab780=_0x482f1a[_0x6fd3('0x5')]?{[_0x482f1a['filter'][_0x6fd3('0x6')]]:_0x482f1a['filter'][_0x6fd3('0x9')]}:undefined;return _0x1d2172[_0x482f1a[_0x6fd3('0xa')]][_0x6fd3('0xb')]({'where':_0x5ab780,'raw':!![]})[_0x6fd3('0xc')](function(_0x317d66){_0x182ffe[_0x6fd3('0x7')]=_['map'](_0x317d66,function(_0x3acc8f){return _0x3acc8f[_0x6fd3('0xd')];});_0x21bae5(_0x182ffe);})[_0x6fd3('0x8')](function(_0x499a03){_0x58ed40(_0x499a03);});});}function _0x38895e(_0x2db63c,_0x2e0dea,_0x4c0af9){if(!_0x2e0dea)return Promise[_0x6fd3('0xe')](null);return new Promise(function(_0x53c23a,_0x2c209d){return _0x1d2172[_0x6fd3('0xf')][_0x6fd3('0xb')]({'where':{'sectionId':_0x2e0dea['id']},'raw':!![]})[_0x6fd3('0xc')](function(_0xc82e4a){if(_0x2db63c['field']&&_0x2db63c[_0x6fd3('0x6')]!=='id'){_0x2e0dea[_0x6fd3('0x7')]=_[_0x6fd3('0x10')](_0xc82e4a,function(_0x54cee1){return _0x54cee1[_0x2db63c[_0x6fd3('0x6')]];});}else{if(_0x4c0af9===_0x6fd3('0x11')){_0x2e0dea['associatedResources']=_[_0x6fd3('0x10')](_0xc82e4a,function(_0x13cf89){return{'id':_0x13cf89[_0x6fd3('0x12')],'type':_0x13cf89[_0x6fd3('0x13')]};});}else{_0x2e0dea[_0x6fd3('0x7')]=_[_0x6fd3('0x10')](_0xc82e4a,function(_0x14fc32){return _0x14fc32[_0x6fd3('0x12')];});}}_0x53c23a(_0x2e0dea);})[_0x6fd3('0x8')](function(_0x36e5f5){_0x2c209d(_0x36e5f5);});});}function _0x5573c6(_0x379ced,_0x299ede){var _0x3592ac={'parentSections':[]};switch(_0x379ced[_0x6fd3('0x14')]()){case'squareprojects':_0x3592ac[_0x6fd3('0x15')]='SquareProject';break;case _0x6fd3('0x16'):_0x3592ac[_0x6fd3('0x15')]='SquareOdbc';break;case _0x6fd3('0x17'):_0x3592ac[_0x6fd3('0x15')]=_0x6fd3('0x18');_0x3592ac[_0x6fd3('0x19')]=[{'name':_0x6fd3('0x1a'),'field':'name','foreignKey':_0x6fd3('0x1b')}];break;case _0x6fd3('0x1c'):_0x3592ac[_0x6fd3('0x15')]=_0x6fd3('0x1d');break;case _0x6fd3('0x1e'):_0x3592ac[_0x6fd3('0x15')]=_0x6fd3('0x1f');_0x3592ac[_0x6fd3('0x19')]=[{'name':_0x6fd3('0x20'),'field':'id','foreignKey':'ListId'}];break;case _0x6fd3('0x21'):_0x3592ac['childModel']=_0x6fd3('0x22');break;case _0x6fd3('0x23'):_0x3592ac['childModel']=_0x6fd3('0x24');break;case'globalcustomfields':_0x3592ac[_0x6fd3('0x15')]=_0x6fd3('0x25');break;case _0x6fd3('0x26'):_0x3592ac[_0x6fd3('0x15')]=_0x6fd3('0x27');break;case _0x6fd3('0x28'):_0x3592ac['childModel']=_0x6fd3('0x29');break;case _0x6fd3('0x2a'):_0x3592ac[_0x6fd3('0x15')]=_0x6fd3('0x2b');break;case _0x6fd3('0x2c'):_0x3592ac['childModel']=_0x6fd3('0x2d');break;case _0x6fd3('0x2e'):case _0x6fd3('0x2f'):case _0x6fd3('0x30'):_0x3592ac[_0x6fd3('0x15')]=_0x6fd3('0x31');break;case _0x6fd3('0x32'):_0x3592ac['childModel']=_0x6fd3('0x33');break;case _0x6fd3('0x34'):_0x3592ac[_0x6fd3('0x15')]=_0x6fd3('0x35');break;case'voicerecordings':_0x3592ac[_0x6fd3('0x15')]='VoiceRecording';_0x3592ac['parentSections']=[{'name':_0x6fd3('0x36'),'field':'name','foreignKey':'membername','model':'User','filter':{'field':'role','value':[_0x6fd3('0x37')]}},{'name':_0x6fd3('0x38'),'field':_0x6fd3('0xd'),'foreignKey':_0x6fd3('0x39'),'model':_0x6fd3('0x3a'),'filter':{'field':_0x6fd3('0x3b'),'value':[_0x6fd3('0x3c')]}},{'name':_0x6fd3('0x3d'),'field':_0x6fd3('0xd'),'foreignKey':_0x6fd3('0x3e'),'model':_0x6fd3('0x3f'),'filter':{'field':_0x6fd3('0x13'),'value':['inbound']}},{'name':'QueueCampaigns','field':_0x6fd3('0xd'),'foreignKey':_0x6fd3('0x3e'),'model':_0x6fd3('0x3f'),'filter':{'field':_0x6fd3('0x13'),'value':[_0x6fd3('0x40')]}}];break;case'musiconholds':_0x3592ac[_0x6fd3('0x15')]=_0x6fd3('0x41');break;case _0x6fd3('0x42'):_0x3592ac[_0x6fd3('0x15')]=_0x6fd3('0x43');break;case _0x6fd3('0x44'):_0x3592ac['childModel']=_0x6fd3('0x45');break;case'ivrcampaigns':_0x3592ac[_0x6fd3('0x15')]='Campaign';break;case _0x6fd3('0x46'):_0x3592ac['childModel']=_0x6fd3('0x47');break;case'mailaccounts':_0x3592ac[_0x6fd3('0x15')]=_0x6fd3('0x48');break;case _0x6fd3('0x49'):_0x3592ac[_0x6fd3('0x15')]=_0x6fd3('0x4a');break;case _0x6fd3('0x4b'):_0x3592ac[_0x6fd3('0x15')]=_0x6fd3('0x4c');break;case'openchannelaccounts':_0x3592ac[_0x6fd3('0x15')]=_0x6fd3('0x4d');break;case _0x6fd3('0x4e'):_0x3592ac['childModel']=_0x6fd3('0x4f');break;case _0x6fd3('0x50'):_0x3592ac[_0x6fd3('0x15')]=_0x6fd3('0x51');break;case _0x6fd3('0x52'):_0x3592ac[_0x6fd3('0x15')]=_0x6fd3('0x53');break;case _0x6fd3('0x54'):_0x3592ac[_0x6fd3('0x15')]=_0x6fd3('0x55');break;case _0x6fd3('0x56'):_0x3592ac[_0x6fd3('0x15')]=_0x6fd3('0x57');break;case _0x6fd3('0x58'):case _0x6fd3('0x59'):_0x3592ac[_0x6fd3('0x15')]=_0x6fd3('0x3f');if(_0x299ede){_0x3592ac[_0x6fd3('0x19')]=[{'name':_0x6fd3('0x3d')},{'name':'QueueCampaigns'}];}break;case'users':case'agents':case'telephones':_0x3592ac[_0x6fd3('0x15')]=_0x6fd3('0x3a');if(_0x299ede){_0x3592ac[_0x6fd3('0x19')]=[{'name':_0x6fd3('0x5a'),'filter':{'field':_0x6fd3('0x3b'),'value':['admin',_0x6fd3('0x5b')]},'ignore':!![]},{'name':_0x6fd3('0x36')},{'name':_0x6fd3('0x38')}];}break;case'zendeskaccounts':_0x3592ac[_0x6fd3('0x15')]=_0x6fd3('0x5c');break;case'salesforceaccounts':_0x3592ac[_0x6fd3('0x15')]=_0x6fd3('0x5d');break;case _0x6fd3('0x5e'):_0x3592ac[_0x6fd3('0x15')]=_0x6fd3('0x5f');break;case'sugarcrmaccounts':_0x3592ac[_0x6fd3('0x15')]=_0x6fd3('0x60');break;case _0x6fd3('0x61'):_0x3592ac[_0x6fd3('0x15')]=_0x6fd3('0x62');break;case _0x6fd3('0x63'):_0x3592ac[_0x6fd3('0x15')]=_0x6fd3('0x64');break;case _0x6fd3('0x65'):_0x3592ac[_0x6fd3('0x15')]=_0x6fd3('0x3a');break;case _0x6fd3('0x66'):_0x3592ac[_0x6fd3('0x15')]=_0x6fd3('0x67');break;case _0x6fd3('0x68'):_0x3592ac[_0x6fd3('0x15')]='Disposition';break;case'customdashboards':_0x3592ac[_0x6fd3('0x15')]='Dashboard';break;case _0x6fd3('0x69'):_0x3592ac[_0x6fd3('0x15')]=_0x6fd3('0x6a');break;case _0x6fd3('0x6b'):_0x3592ac['childModel']=_0x6fd3('0x6c');break;case _0x6fd3('0x6d'):_0x3592ac[_0x6fd3('0x15')]=_0x6fd3('0x6e');break;case _0x6fd3('0x6f'):_0x3592ac['childModel']=_0x6fd3('0x70');break;case'tags':_0x3592ac[_0x6fd3('0x15')]=_0x6fd3('0x71');break;case'templates':_0x3592ac['childModel']='Template';break;case'triggers':_0x3592ac[_0x6fd3('0x15')]=_0x6fd3('0x72');break;case _0x6fd3('0x73'):_0x3592ac[_0x6fd3('0x15')]=_0x6fd3('0x74');break;case _0x6fd3('0x75'):_0x3592ac[_0x6fd3('0x15')]=_0x6fd3('0x76');break;case _0x6fd3('0x77'):_0x3592ac[_0x6fd3('0x15')]=_0x6fd3('0x78');break;case _0x6fd3('0x79'):_0x3592ac[_0x6fd3('0x15')]=_0x6fd3('0x11');_0x3592ac[_0x6fd3('0x19')]=[{'name':_0x6fd3('0x7a'),'field':'id','foreignKey':'reportId'}];break;case _0x6fd3('0x7b'):_0x3592ac[_0x6fd3('0x15')]='AnalyticMetric';break;}return _0x3592ac;}function _0x35ca73(_0x3ae002,_0x4ba764){var _0x376d07=_0x3ae002[_0x6fd3('0x7c')](0x0)[_0x6fd3('0x7d')]()+_0x3ae002[_0x6fd3('0x7e')](0x1);var _0x316532={'type':_0x1d2172['Sequelize']['QueryTypes'][_0x6fd3('0x7f')],'raw':!![]};return new Promise(function(_0xe59c6f,_0x2a3efc){var _0x55b063=squel[_0x6fd3('0x80')]()[_0x6fd3('0x6')](_0x6fd3('0x81')+_0x376d07+_0x6fd3('0x82'),'id')[_0x6fd3('0x6')](_0x6fd3('0x83'))['from'](_0x6fd3('0x84')+_0x3ae002+_0x6fd3('0x85'),'ui')[_0x6fd3('0x86')](_0x6fd3('0x87'),_0x4ba764['id']);return _0x1d2172[_0x6fd3('0x88')][_0x6fd3('0x89')](_0x55b063['toString'](),_0x316532)[_0x6fd3('0xc')](function(_0x4a4810){_0x4ba764[_0x376d07+_0x6fd3('0x8a')]=_0x4a4810;_0xe59c6f(_0x4a4810);})[_0x6fd3('0x8')](function(_0x1d8f90){_0x2a3efc(_0x1d8f90);});});}return _0x2ec0dd[_0x6fd3('0x8b')]('UserProfile',attributes,{'tableName':_0x6fd3('0x8c'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x6b4bcb){var _0x571c4d=require(_0x6fd3('0x8d'));var _0x2896cc={'raw':_0x6b4bcb[_0x6fd3('0x89')]['raw'],'where':{}};var _0x1ea8c0={};var _0x3d6027={'count':0x0,'rows':[]};var _0x4c2cd3=_0x6b4bcb[_0x6fd3('0x89')][_0x6fd3('0x8e')];var _0x3800da=_0x6b4bcb[_0x6fd3('0x89')]['mergeResources']||![];var _0x28816a=_0x5573c6(_0x4c2cd3,_0x3800da);if(!_0x28816a['childModel'])throw new Error(_0x6fd3('0x8f')+_0x4c2cd3+'\x27');var _0x3fc561=[{'name':_0x4c2cd3}];if(!_[_0x6fd3('0x90')](_0x28816a[_0x6fd3('0x19')]))_0x3fc561=_0x28816a[_0x6fd3('0x19')];var _0x52828d=[];for(var _0x1116d2=0x0;_0x1116d2<_0x3fc561[_0x6fd3('0x91')];_0x1116d2++){_0x52828d[_0x6fd3('0x92')](_0x1d2172[_0x6fd3('0x93')][_0x6fd3('0x94')]({'where':{'userProfileId':_0x6b4bcb[_0x6fd3('0x95')]['id'],'name':_0x3fc561[_0x1116d2][_0x6fd3('0xd')]},'raw':!![]}));}return Promise[_0x6fd3('0x96')](_0x52828d)[_0x6fd3('0xc')](function(_0x4c3552){var _0x4d6e08=_['filter'](_0x4c3552,function(_0x4be29c){return _0x4be29c?_0x4be29c:undefined;});var _0x11d6ec=_[_0x6fd3('0x5')](_0x3fc561,[_0x6fd3('0x97'),!![]]);var _0x136243=_[_0x6fd3('0x90')](_0x4d6e08)&&_[_0x6fd3('0x90')](_0x11d6ec)?null:_['union'](_0x11d6ec,_0x4d6e08);if(!_0x136243)return null;var _0x3bf675=[];for(var _0x466ebf=0x0;_0x466ebf<_0x136243[_0x6fd3('0x91')];_0x466ebf++){var _0x2162a6=_['find'](_0x3fc561,function(_0x561c33){return _0x136243[_0x466ebf]?_0x561c33[_0x6fd3('0xd')]===_0x136243[_0x466ebf][_0x6fd3('0xd')]:null;});if(_0x2162a6){if(_0x136243[_0x466ebf]['ignore']){_0x3bf675['push'](_0x542a14(_0x28816a[_0x6fd3('0x15')],_0x136243[_0x466ebf]));}else{if(!_0x136243[_0x466ebf][_0x6fd3('0x98')]){_0x3bf675['push'](_0x38895e(_0x2162a6,_0x136243[_0x466ebf],_0x28816a[_0x6fd3('0x15')]));}else{if(_0x2162a6[_0x6fd3('0xa')]){_0x3bf675[_0x6fd3('0x92')](_0x5f0032(_0x2162a6,_0x136243[_0x466ebf]));}}}}}return Promise[_0x6fd3('0x96')](_0x3bf675);})[_0x6fd3('0xc')](function(_0x2c9737){var _0x467974=_0x2c9737;var _0x149b5c=null;if(_0x467974){_0x149b5c=_0x467974['length']===0x1?_0x467974[0x0]:null;}if(!_0x149b5c&&!_0x467974)return _0x3d6027;var _0x38e1b1=_0x1d2172[_0x28816a[_0x6fd3('0x15')]][_0x6fd3('0x99')];_0x1ea8c0[_0x6fd3('0xa')]=_[_0x6fd3('0x9a')](_0x38e1b1);_0x1ea8c0[_0x6fd3('0x89')]=_[_0x6fd3('0x9a')](_0x6b4bcb[_0x6fd3('0x89')]);_0x1ea8c0[_0x6fd3('0x9b')]=_[_0x6fd3('0x9c')](_0x1ea8c0['model'],_0x1ea8c0[_0x6fd3('0x89')]);_0x2896cc[_0x6fd3('0x9d')]=_['intersection'](_0x1ea8c0['model'],_0x571c4d[_0x6fd3('0x9e')](_0x6b4bcb[_0x6fd3('0x89')][_0x6fd3('0x9e')]));_0x2896cc[_0x6fd3('0x9d')]=_0x2896cc[_0x6fd3('0x9d')]['length']?_0x2896cc[_0x6fd3('0x9d')]:_0x1ea8c0['model'];if(!_0x6b4bcb[_0x6fd3('0x89')][_0x6fd3('0x9f')](_0x6fd3('0xa0'))){_0x2896cc[_0x6fd3('0xa1')]=_0x571c4d[_0x6fd3('0xa1')](_0x6b4bcb[_0x6fd3('0x89')]['limit']);_0x2896cc[_0x6fd3('0xa2')]=_0x571c4d[_0x6fd3('0xa2')](_0x6b4bcb[_0x6fd3('0x89')]['offset']);}_0x2896cc[_0x6fd3('0xa3')]=_0x571c4d['sort'](_0x6b4bcb[_0x6fd3('0x89')][_0x6fd3('0xa4')]);_0x2896cc['where']=_0x571c4d['filters'](_['pick'](_0x6b4bcb[_0x6fd3('0x89')],_0x1ea8c0[_0x6fd3('0x9b')]));if(_0x6b4bcb[_0x6fd3('0x89')][_0x6fd3('0x5')]){_0x2896cc['where']=_[_0x6fd3('0xa5')](_0x2896cc[_0x6fd3('0x86')],{'$or':_[_0x6fd3('0x10')](_0x38e1b1,function(_0x3494bc){if(_0x3494bc[_0x6fd3('0x13')][_0x6fd3('0xa6')]!==_0x6fd3('0xa7')){var _0x425644={};_0x425644[_0x3494bc[_0x6fd3('0x6')]]={'$like':'%'+_0x6b4bcb[_0x6fd3('0x89')][_0x6fd3('0x5')]+'%'};return _0x425644;}})});}var _0x497489=[];var _0x23fbde=null;var _0x2faa38={};if(_0x149b5c){_0x23fbde=_[_0x6fd3('0x94')](_0x3fc561,[_0x6fd3('0xd'),_0x149b5c[_0x6fd3('0xd')]]);if(_0x23fbde[_0x6fd3('0x6')]){_0x2faa38={};if(_0x28816a[_0x6fd3('0x15')]===_0x6fd3('0x11')){_0x2faa38[_0x23fbde[_0x6fd3('0xa8')]]=_[_0x6fd3('0x10')](_0x149b5c[_0x6fd3('0x7')],'id');}else{_0x2faa38[_0x23fbde[_0x6fd3('0xa8')]]=_0x149b5c['associatedResources'];}_0x497489[_0x6fd3('0x92')](_0x2faa38);}else{_0x2896cc[_0x6fd3('0x86')]['id']=_0x149b5c[_0x6fd3('0x7')];}}else{for(var _0xcddaa5=0x0;_0xcddaa5<_0x467974['length'];_0xcddaa5++){_0x23fbde=_[_0x6fd3('0x94')](_0x3fc561,[_0x6fd3('0xd'),_0x467974[_0xcddaa5][_0x6fd3('0xd')]]);if(_0x23fbde[_0x6fd3('0x6')]){_0x2faa38={};_0x2faa38[_0x23fbde[_0x6fd3('0xa8')]]=_0x467974[_0xcddaa5]['associatedResources'];_0x497489[_0x6fd3('0x92')](_0x2faa38);}else{if(!_0x2896cc[_0x6fd3('0x86')]['id'])_0x2896cc[_0x6fd3('0x86')]['id']=[];_0x467974[_0xcddaa5][_0x6fd3('0x7')][_0x6fd3('0xa9')](function(_0xcfedd6){_0x2896cc['where']['id'][_0x6fd3('0x92')](_0xcfedd6);});}}}if(!_['isEmpty'](_0x497489)){_0x2896cc[_0x6fd3('0x86')]=_[_0x6fd3('0xa5')](_0x2896cc[_0x6fd3('0x86')],{'$and':{'$or':_0x497489}});}_0x2896cc=_[_0x6fd3('0xa5')]({},_0x2896cc,_0x6b4bcb['options']);if(_0x149b5c&&!_0x149b5c['autoAssociation']&&_0x28816a['childModel']===_0x6fd3('0x11')){if(_0x6b4bcb[_0x6fd3('0x89')][_0x6fd3('0xaa')]){_0x2896cc[_0x6fd3('0xab')]=[{'all':!![]}];}return _0x1d2172[_0x28816a[_0x6fd3('0x15')]]['findAll'](_0x2896cc)['then'](function(_0x158b9d){var _0x13b14e=[];_0x158b9d[_0x6fd3('0xa9')](function(_0x57a81b){var _0x10e7ca;switch(_0x57a81b['reportType']){case _0x6fd3('0xac'):_0x10e7ca=_['find'](_0x149b5c[_0x6fd3('0x7')],function(_0x41614b){return _0x41614b['id']===_0x57a81b[_0x6fd3('0xad')]&&_0x41614b[_0x6fd3('0x13')]===_0x6fd3('0xae');});break;case'custom':_0x10e7ca=_[_0x6fd3('0x94')](_0x149b5c[_0x6fd3('0x7')],function(_0x518cdb){return _0x518cdb['id']===_0x57a81b[_0x6fd3('0xad')]&&_0x518cdb[_0x6fd3('0x13')]===_0x6fd3('0xaf');});break;}if(_0x10e7ca)_0x13b14e['push'](_0x57a81b);});_0x3d6027[_0x6fd3('0xb0')]=_0x13b14e[_0x6fd3('0x91')];_0x3d6027[_0x6fd3('0xb1')]=_0x13b14e;return _0x3d6027;});}else{if(!_[_0x6fd3('0x90')](_0x6b4bcb[_0x6fd3('0x89')][_0x6fd3('0xb2')])){_0x2896cc[_0x6fd3('0x86')]['id']=_0x2896cc['where']['id']?_[_0x6fd3('0x9c')](_0x2896cc[_0x6fd3('0x86')]['id'],_0x6b4bcb['query'][_0x6fd3('0xb2')]):_0x6b4bcb[_0x6fd3('0x89')][_0x6fd3('0xb2')];if(_0x6b4bcb[_0x6fd3('0x89')][_0x6fd3('0xb3')]){_0x2896cc[_0x6fd3('0xa3')]=_0x6b4bcb[_0x6fd3('0x89')][_0x6fd3('0xb3')];}}if(_0x6b4bcb[_0x6fd3('0x89')][_0x6fd3('0xb4')]){_0x2896cc[_0x6fd3('0x86')]=_['merge'](_0x2896cc[_0x6fd3('0x86')],{'$and':_0x6b4bcb[_0x6fd3('0x89')][_0x6fd3('0xb4')]});}return _0x1d2172[_0x28816a[_0x6fd3('0x15')]][_0x6fd3('0xb0')]({'where':_0x2896cc[_0x6fd3('0x86')]})[_0x6fd3('0xc')](function(_0x5e847b){_0x3d6027[_0x6fd3('0xb0')]=_0x5e847b;if(_0x6b4bcb['query'][_0x6fd3('0xaa')]){if(_0x28816a['childModel']===_0x6fd3('0x1f')){_0x2896cc[_0x6fd3('0xab')]=[{'model':_0x1d2172[_0x6fd3('0x71')],'as':_0x6fd3('0xb5'),'attributes':['id',_0x6fd3('0xd'),_0x6fd3('0xb6')],'required':_0x6b4bcb[_0x6fd3('0x89')][_0x6fd3('0xb7')]?!![]:![]},{'model':_0x1d2172[_0x6fd3('0x71')],'as':_0x6fd3('0xb8'),'attributes':['id','name',_0x6fd3('0xb6')],'through':_0x6b4bcb[_0x6fd3('0x89')][_0x6fd3('0xb7')]?{'attributes':[],'where':{'TagId':_0x6b4bcb[_0x6fd3('0x89')][_0x6fd3('0xb7')]||undefined}}:{},'required':_0x6b4bcb[_0x6fd3('0x89')][_0x6fd3('0xb7')]?!![]:![]}];}else{_0x2896cc[_0x6fd3('0xab')]=[{'all':!![]}];}}return _0x1d2172[_0x28816a[_0x6fd3('0x15')]]['findAll'](_0x2896cc);})[_0x6fd3('0xc')](function(_0x5a9ab0){_0x3d6027[_0x6fd3('0xb1')]=_0x5a9ab0;if(_0x4c2cd3==='Agents'&&_0x6b4bcb['query'][_0x6fd3('0xb9')]===_0x6fd3('0xba')){var _0x403a66=[];for(var _0x2e1652=0x0;_0x2e1652<_0x3d6027[_0x6fd3('0xb1')]['length'];_0x2e1652++){_0x403a66[_0x6fd3('0x92')](_0x35ca73('chat',_0x3d6027[_0x6fd3('0xb1')][_0x2e1652][_0x6fd3('0xbb')]));_0x403a66[_0x6fd3('0x92')](_0x35ca73('sms',_0x3d6027[_0x6fd3('0xb1')][_0x2e1652][_0x6fd3('0xbb')]));_0x403a66['push'](_0x35ca73(_0x6fd3('0xbc'),_0x3d6027[_0x6fd3('0xb1')][_0x2e1652][_0x6fd3('0xbb')]));_0x403a66[_0x6fd3('0x92')](_0x35ca73('mail',_0x3d6027[_0x6fd3('0xb1')][_0x2e1652][_0x6fd3('0xbb')]));_0x403a66[_0x6fd3('0x92')](_0x35ca73(_0x6fd3('0xbd'),_0x3d6027[_0x6fd3('0xb1')][_0x2e1652]['dataValues']));_0x403a66[_0x6fd3('0x92')](_0x35ca73(_0x6fd3('0xbe'),_0x3d6027[_0x6fd3('0xb1')][_0x2e1652]['dataValues']));}return Promise[_0x6fd3('0x96')](_0x403a66)[_0x6fd3('0xc')](function(){return _0x3d6027;});}return _0x3d6027;});}});}}});}; \ No newline at end of file +var _0x2bad=['charAt','toUpperCase','slice','Sequelize','QueryTypes','ui.','InteractionId','ui.createdAt','from','_interactions','where','ui.UserId\x20=\x20?','query','toString','UserProfile','../../components/parsers/qs','section','mergeResources','isEmpty','length','push','UserProfileSection','find','params','union','ignore','model','all','rawAttributes','keys','filters','intersection','fields','attributes','hasOwnProperty','limit','offset','order','sort','pick','merge','key','foreignKey','forEach','options','includeAll','include','reportType','default','reportId','DefaultReports','CustomReports','ids','customSorting','extraQueryConditions','count','Tags','color','tag','ThroughTags','openTabs','true','chat','rows','dataValues','fax','whatsapp','lodash','./userProfile.attributes','squel','filter','field','value','findAll','then','associatedResources','map','catch','name','resolve','UserProfileResource','AnalyticExtractedReport','type','resourceId','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projects','contacts','CmContact','Lists','lists','CmList','companies','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','parentSections','Agents','User','agent','membername','telephone','VoiceQueues','queue','VoiceQueue','QueueCampaigns','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','ivrcampaigns','Campaign','MailQueue','mailaccounts','OpenchannelQueue','openchannelaccounts','SmsQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','agents','telephones','Users','role','admin','user','Telephones','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','dispositions','Disposition','customdashboards','Dashboard','intervals','Pause','scheduler','Schedule','Sound','tags','Tag','Template','triggers','Trigger','Trunk','variables','Variable','plugins','Plugin','extractedreports','Reports','metrics','AnalyticMetric'];(function(_0x5002b7,_0x1ae153){var _0x5e7cfe=function(_0x1ac8af){while(--_0x1ac8af){_0x5002b7['push'](_0x5002b7['shift']());}};_0x5e7cfe(++_0x1ae153);}(_0x2bad,0x1bd));var _0xd2ba=function(_0x22d7bb,_0x4c158e){_0x22d7bb=_0x22d7bb-0x0;var _0x40a737=_0x2bad[_0x22d7bb];return _0x40a737;};'use strict';var _=require(_0xd2ba('0x0'));var attributes=require(_0xd2ba('0x1'));var squel=require(_0xd2ba('0x2'));module['exports']=function(_0x4c8a44){var _0xe3442e=_0x4c8a44['models'];function _0x4c5189(_0x6bf2a4,_0xc50cf2){return new Promise(function(_0xc8316,_0x3d2e53){if(!_0xc50cf2)return _0xc8316(null);var _0x1c3a93=_0xc50cf2['filter']?{[_0xc50cf2[_0xd2ba('0x3')][_0xd2ba('0x4')]]:_0xc50cf2[_0xd2ba('0x3')][_0xd2ba('0x5')]}:undefined;return _0xe3442e[_0x6bf2a4][_0xd2ba('0x6')]({'where':_0x1c3a93,'raw':!![]})[_0xd2ba('0x7')](function(_0xcea7d2){_0xc50cf2[_0xd2ba('0x8')]=_[_0xd2ba('0x9')](_0xcea7d2,'id');_0xc8316(_0xc50cf2);})[_0xd2ba('0xa')](function(_0x483f22){_0x3d2e53(_0x483f22);});});}function _0x2121f6(_0x45ac10,_0x5df6da){return new Promise(function(_0x21e794,_0x5e422c){var _0x3764ca=_0x45ac10[_0xd2ba('0x3')]?{[_0x45ac10[_0xd2ba('0x3')][_0xd2ba('0x4')]]:_0x45ac10[_0xd2ba('0x3')][_0xd2ba('0x5')]}:undefined;return _0xe3442e[_0x45ac10['model']][_0xd2ba('0x6')]({'where':_0x3764ca,'raw':!![]})[_0xd2ba('0x7')](function(_0x40afa8){_0x5df6da[_0xd2ba('0x8')]=_[_0xd2ba('0x9')](_0x40afa8,function(_0x5acc1c){return _0x5acc1c[_0xd2ba('0xb')];});_0x21e794(_0x5df6da);})['catch'](function(_0x3b5076){_0x5e422c(_0x3b5076);});});}function _0x429bcd(_0x2e97d3,_0x3eaf70,_0x5eff13){if(!_0x3eaf70)return Promise[_0xd2ba('0xc')](null);return new Promise(function(_0x44e597,_0x47c789){return _0xe3442e[_0xd2ba('0xd')]['findAll']({'where':{'sectionId':_0x3eaf70['id']},'raw':!![]})[_0xd2ba('0x7')](function(_0x3eca2e){if(_0x2e97d3[_0xd2ba('0x4')]&&_0x2e97d3['field']!=='id'){_0x3eaf70['associatedResources']=_['map'](_0x3eca2e,function(_0x43c8c2){return _0x43c8c2[_0x2e97d3[_0xd2ba('0x4')]];});}else{if(_0x5eff13===_0xd2ba('0xe')){_0x3eaf70[_0xd2ba('0x8')]=_[_0xd2ba('0x9')](_0x3eca2e,function(_0x48af4a){return{'id':_0x48af4a['resourceId'],'type':_0x48af4a[_0xd2ba('0xf')]};});}else{_0x3eaf70['associatedResources']=_[_0xd2ba('0x9')](_0x3eca2e,function(_0x291b09){return _0x291b09[_0xd2ba('0x10')];});}}_0x44e597(_0x3eaf70);})['catch'](function(_0x490e33){_0x47c789(_0x490e33);});});}function _0x2f0ad7(_0x4dc226,_0x25d070){var _0x2d34ab={'parentSections':[]};switch(_0x4dc226['toLowerCase']()){case _0xd2ba('0x11'):_0x2d34ab[_0xd2ba('0x12')]=_0xd2ba('0x13');break;case _0xd2ba('0x14'):_0x2d34ab[_0xd2ba('0x12')]=_0xd2ba('0x15');break;case _0xd2ba('0x16'):_0x2d34ab[_0xd2ba('0x12')]=_0xd2ba('0x17');_0x2d34ab['parentSections']=[{'name':_0xd2ba('0x18'),'field':_0xd2ba('0xb'),'foreignKey':'projectName'}];break;case _0xd2ba('0x19'):_0x2d34ab[_0xd2ba('0x12')]='JscriptyProject';break;case _0xd2ba('0x1a'):_0x2d34ab['childModel']=_0xd2ba('0x1b');_0x2d34ab['parentSections']=[{'name':_0xd2ba('0x1c'),'field':'id','foreignKey':'ListId'}];break;case _0xd2ba('0x1d'):_0x2d34ab[_0xd2ba('0x12')]=_0xd2ba('0x1e');break;case _0xd2ba('0x1f'):_0x2d34ab[_0xd2ba('0x12')]='CmCompany';break;case _0xd2ba('0x20'):_0x2d34ab[_0xd2ba('0x12')]=_0xd2ba('0x21');break;case _0xd2ba('0x22'):_0x2d34ab[_0xd2ba('0x12')]=_0xd2ba('0x23');break;case _0xd2ba('0x24'):_0x2d34ab['childModel']=_0xd2ba('0x25');break;case _0xd2ba('0x26'):_0x2d34ab[_0xd2ba('0x12')]=_0xd2ba('0x27');break;case _0xd2ba('0x28'):_0x2d34ab[_0xd2ba('0x12')]=_0xd2ba('0x29');break;case _0xd2ba('0x2a'):case _0xd2ba('0x2b'):case _0xd2ba('0x2c'):_0x2d34ab[_0xd2ba('0x12')]=_0xd2ba('0x2d');break;case _0xd2ba('0x2e'):_0x2d34ab[_0xd2ba('0x12')]=_0xd2ba('0x2f');break;case _0xd2ba('0x30'):_0x2d34ab[_0xd2ba('0x12')]=_0xd2ba('0x31');break;case _0xd2ba('0x32'):_0x2d34ab[_0xd2ba('0x12')]=_0xd2ba('0x33');_0x2d34ab[_0xd2ba('0x34')]=[{'name':_0xd2ba('0x35'),'field':'name','foreignKey':'membername','model':_0xd2ba('0x36'),'filter':{'field':'role','value':[_0xd2ba('0x37')]}},{'name':'Telephones','field':_0xd2ba('0xb'),'foreignKey':_0xd2ba('0x38'),'model':_0xd2ba('0x36'),'filter':{'field':'role','value':[_0xd2ba('0x39')]}},{'name':_0xd2ba('0x3a'),'field':'name','foreignKey':_0xd2ba('0x3b'),'model':_0xd2ba('0x3c'),'filter':{'field':'type','value':['inbound']}},{'name':_0xd2ba('0x3d'),'field':'name','foreignKey':_0xd2ba('0x3b'),'model':'VoiceQueue','filter':{'field':_0xd2ba('0xf'),'value':[_0xd2ba('0x3e')]}}];break;case'musiconholds':_0x2d34ab[_0xd2ba('0x12')]=_0xd2ba('0x3f');break;case _0xd2ba('0x40'):_0x2d34ab[_0xd2ba('0x12')]=_0xd2ba('0x41');break;case _0xd2ba('0x42'):_0x2d34ab[_0xd2ba('0x12')]='VoicePrefix';break;case _0xd2ba('0x43'):_0x2d34ab[_0xd2ba('0x12')]=_0xd2ba('0x44');break;case'mailqueues':_0x2d34ab[_0xd2ba('0x12')]=_0xd2ba('0x45');break;case _0xd2ba('0x46'):_0x2d34ab[_0xd2ba('0x12')]='MailAccount';break;case'mailsubstatuses':_0x2d34ab[_0xd2ba('0x12')]='MailSubstatus';break;case'openchannelqueues':_0x2d34ab[_0xd2ba('0x12')]=_0xd2ba('0x47');break;case _0xd2ba('0x48'):_0x2d34ab[_0xd2ba('0x12')]='OpenchannelAccount';break;case'smsqueues':_0x2d34ab[_0xd2ba('0x12')]=_0xd2ba('0x49');break;case'smsaccounts':_0x2d34ab['childModel']='SmsAccount';break;case'whatsappqueues':_0x2d34ab[_0xd2ba('0x12')]='WhatsappQueue';break;case _0xd2ba('0x4a'):_0x2d34ab[_0xd2ba('0x12')]=_0xd2ba('0x4b');break;case _0xd2ba('0x4c'):_0x2d34ab[_0xd2ba('0x12')]=_0xd2ba('0x4d');break;case _0xd2ba('0x4e'):case _0xd2ba('0x4f'):_0x2d34ab[_0xd2ba('0x12')]='VoiceQueue';if(_0x25d070){_0x2d34ab[_0xd2ba('0x34')]=[{'name':_0xd2ba('0x3a')},{'name':_0xd2ba('0x3d')}];}break;case'users':case _0xd2ba('0x50'):case _0xd2ba('0x51'):_0x2d34ab[_0xd2ba('0x12')]=_0xd2ba('0x36');if(_0x25d070){_0x2d34ab['parentSections']=[{'name':_0xd2ba('0x52'),'filter':{'field':_0xd2ba('0x53'),'value':[_0xd2ba('0x54'),_0xd2ba('0x55')]},'ignore':!![]},{'name':_0xd2ba('0x35')},{'name':_0xd2ba('0x56')}];}break;case'zendeskaccounts':_0x2d34ab[_0xd2ba('0x12')]=_0xd2ba('0x57');break;case _0xd2ba('0x58'):_0x2d34ab[_0xd2ba('0x12')]=_0xd2ba('0x59');break;case'freshdeskaccounts':_0x2d34ab[_0xd2ba('0x12')]=_0xd2ba('0x5a');break;case _0xd2ba('0x5b'):_0x2d34ab['childModel']=_0xd2ba('0x5c');break;case _0xd2ba('0x5d'):_0x2d34ab[_0xd2ba('0x12')]=_0xd2ba('0x5e');break;case _0xd2ba('0x5f'):_0x2d34ab[_0xd2ba('0x12')]=_0xd2ba('0x60');break;case _0xd2ba('0x61'):_0x2d34ab[_0xd2ba('0x12')]=_0xd2ba('0x36');break;case _0xd2ba('0x62'):_0x2d34ab[_0xd2ba('0x12')]='CannedAnswer';break;case _0xd2ba('0x63'):_0x2d34ab[_0xd2ba('0x12')]=_0xd2ba('0x64');break;case _0xd2ba('0x65'):_0x2d34ab[_0xd2ba('0x12')]=_0xd2ba('0x66');break;case _0xd2ba('0x67'):_0x2d34ab[_0xd2ba('0x12')]='Interval';break;case'pauses':_0x2d34ab[_0xd2ba('0x12')]=_0xd2ba('0x68');break;case _0xd2ba('0x69'):_0x2d34ab[_0xd2ba('0x12')]=_0xd2ba('0x6a');break;case'sounds':_0x2d34ab[_0xd2ba('0x12')]=_0xd2ba('0x6b');break;case _0xd2ba('0x6c'):_0x2d34ab['childModel']=_0xd2ba('0x6d');break;case'templates':_0x2d34ab[_0xd2ba('0x12')]=_0xd2ba('0x6e');break;case _0xd2ba('0x6f'):_0x2d34ab[_0xd2ba('0x12')]=_0xd2ba('0x70');break;case'trunks':_0x2d34ab[_0xd2ba('0x12')]=_0xd2ba('0x71');break;case _0xd2ba('0x72'):_0x2d34ab[_0xd2ba('0x12')]=_0xd2ba('0x73');break;case _0xd2ba('0x74'):_0x2d34ab['childModel']=_0xd2ba('0x75');break;case _0xd2ba('0x76'):_0x2d34ab[_0xd2ba('0x12')]=_0xd2ba('0xe');_0x2d34ab[_0xd2ba('0x34')]=[{'name':_0xd2ba('0x77'),'field':'id','foreignKey':'reportId'}];break;case _0xd2ba('0x78'):_0x2d34ab[_0xd2ba('0x12')]=_0xd2ba('0x79');break;}return _0x2d34ab;}function _0x30d060(_0x19e37b,_0x1bdb72){var _0x464a9d=_0x19e37b[_0xd2ba('0x7a')](0x0)[_0xd2ba('0x7b')]()+_0x19e37b[_0xd2ba('0x7c')](0x1);var _0x231d9f={'type':_0xe3442e[_0xd2ba('0x7d')][_0xd2ba('0x7e')]['SELECT'],'raw':!![]};return new Promise(function(_0x320623,_0x474ad6){var _0x5f56dc=squel['select']()[_0xd2ba('0x4')](_0xd2ba('0x7f')+_0x464a9d+_0xd2ba('0x80'),'id')[_0xd2ba('0x4')](_0xd2ba('0x81'))[_0xd2ba('0x82')]('user_has_'+_0x19e37b+_0xd2ba('0x83'),'ui')[_0xd2ba('0x84')](_0xd2ba('0x85'),_0x1bdb72['id']);return _0xe3442e['sequelize'][_0xd2ba('0x86')](_0x5f56dc[_0xd2ba('0x87')](),_0x231d9f)['then'](function(_0x3cf54f){_0x1bdb72[_0x464a9d+'OpenTabs']=_0x3cf54f;_0x320623(_0x3cf54f);})[_0xd2ba('0xa')](function(_0x5a5d60){_0x474ad6(_0x5a5d60);});});}return _0x4c8a44['define'](_0xd2ba('0x88'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x3b6aac){var _0x26b3e9=require(_0xd2ba('0x89'));var _0x3958f5={'raw':_0x3b6aac['query']['raw'],'where':{}};var _0x1e73ce={};var _0x3477c5={'count':0x0,'rows':[]};var _0x590db7=_0x3b6aac['query'][_0xd2ba('0x8a')];var _0x519ead=_0x3b6aac[_0xd2ba('0x86')][_0xd2ba('0x8b')]||![];var _0x50b0c7=_0x2f0ad7(_0x590db7,_0x519ead);if(!_0x50b0c7[_0xd2ba('0x12')])throw new Error('Invalid\x20section\x20\x27'+_0x590db7+'\x27');var _0x58d678=[{'name':_0x590db7}];if(!_[_0xd2ba('0x8c')](_0x50b0c7['parentSections']))_0x58d678=_0x50b0c7[_0xd2ba('0x34')];var _0x10b215=[];for(var _0x356b28=0x0;_0x356b28<_0x58d678[_0xd2ba('0x8d')];_0x356b28++){_0x10b215[_0xd2ba('0x8e')](_0xe3442e[_0xd2ba('0x8f')][_0xd2ba('0x90')]({'where':{'userProfileId':_0x3b6aac[_0xd2ba('0x91')]['id'],'name':_0x58d678[_0x356b28]['name']},'raw':!![]}));}return Promise['all'](_0x10b215)[_0xd2ba('0x7')](function(_0x4bb29f){var _0x4f21ae=_[_0xd2ba('0x3')](_0x4bb29f,function(_0x2d6ebe){return _0x2d6ebe?_0x2d6ebe:undefined;});var _0x3cb775=_[_0xd2ba('0x3')](_0x58d678,['ignore',!![]]);var _0x4422ad=_['isEmpty'](_0x4f21ae)&&_[_0xd2ba('0x8c')](_0x3cb775)?null:_[_0xd2ba('0x92')](_0x3cb775,_0x4f21ae);if(!_0x4422ad)return null;var _0x483cae=[];for(var _0x80614f=0x0;_0x80614f<_0x4422ad[_0xd2ba('0x8d')];_0x80614f++){var _0x2f15e0=_['find'](_0x58d678,function(_0x2ce471){return _0x4422ad[_0x80614f]?_0x2ce471['name']===_0x4422ad[_0x80614f][_0xd2ba('0xb')]:null;});if(_0x2f15e0){if(_0x4422ad[_0x80614f][_0xd2ba('0x93')]){_0x483cae[_0xd2ba('0x8e')](_0x4c5189(_0x50b0c7['childModel'],_0x4422ad[_0x80614f]));}else{if(!_0x4422ad[_0x80614f]['autoAssociation']){_0x483cae[_0xd2ba('0x8e')](_0x429bcd(_0x2f15e0,_0x4422ad[_0x80614f],_0x50b0c7[_0xd2ba('0x12')]));}else{if(_0x2f15e0[_0xd2ba('0x94')]){_0x483cae['push'](_0x2121f6(_0x2f15e0,_0x4422ad[_0x80614f]));}}}}}return Promise[_0xd2ba('0x95')](_0x483cae);})[_0xd2ba('0x7')](function(_0x4783da){var _0x52bee5=_0x4783da;var _0x1e7ab8=null;if(_0x52bee5){_0x1e7ab8=_0x52bee5['length']===0x1?_0x52bee5[0x0]:null;}if(!_0x1e7ab8&&!_0x52bee5)return _0x3477c5;var _0x57768a=_0xe3442e[_0x50b0c7[_0xd2ba('0x12')]][_0xd2ba('0x96')];_0x1e73ce[_0xd2ba('0x94')]=_[_0xd2ba('0x97')](_0x57768a);_0x1e73ce[_0xd2ba('0x86')]=_['keys'](_0x3b6aac[_0xd2ba('0x86')]);_0x1e73ce[_0xd2ba('0x98')]=_[_0xd2ba('0x99')](_0x1e73ce[_0xd2ba('0x94')],_0x1e73ce['query']);_0x3958f5['attributes']=_[_0xd2ba('0x99')](_0x1e73ce[_0xd2ba('0x94')],_0x26b3e9[_0xd2ba('0x9a')](_0x3b6aac[_0xd2ba('0x86')]['fields']));_0x3958f5['attributes']=_0x3958f5[_0xd2ba('0x9b')][_0xd2ba('0x8d')]?_0x3958f5[_0xd2ba('0x9b')]:_0x1e73ce[_0xd2ba('0x94')];if(!_0x3b6aac['query'][_0xd2ba('0x9c')]('nolimit')){_0x3958f5[_0xd2ba('0x9d')]=_0x26b3e9['limit'](_0x3b6aac['query'][_0xd2ba('0x9d')]);_0x3958f5[_0xd2ba('0x9e')]=_0x26b3e9[_0xd2ba('0x9e')](_0x3b6aac[_0xd2ba('0x86')][_0xd2ba('0x9e')]);}_0x3958f5[_0xd2ba('0x9f')]=_0x26b3e9[_0xd2ba('0xa0')](_0x3b6aac[_0xd2ba('0x86')][_0xd2ba('0xa0')]);_0x3958f5[_0xd2ba('0x84')]=_0x26b3e9[_0xd2ba('0x98')](_[_0xd2ba('0xa1')](_0x3b6aac['query'],_0x1e73ce[_0xd2ba('0x98')]));if(_0x3b6aac[_0xd2ba('0x86')][_0xd2ba('0x3')]){_0x3958f5[_0xd2ba('0x84')]=_[_0xd2ba('0xa2')](_0x3958f5[_0xd2ba('0x84')],{'$or':_['map'](_0x57768a,function(_0x298d92){if(_0x298d92[_0xd2ba('0xf')][_0xd2ba('0xa3')]!=='VIRTUAL'){var _0x1974af={};_0x1974af[_0x298d92[_0xd2ba('0x4')]]={'$like':'%'+_0x3b6aac[_0xd2ba('0x86')][_0xd2ba('0x3')]+'%'};return _0x1974af;}})});}var _0x4b0b41=[];var _0x40371a=null;var _0xcdfb2a={};if(_0x1e7ab8){_0x40371a=_[_0xd2ba('0x90')](_0x58d678,['name',_0x1e7ab8[_0xd2ba('0xb')]]);if(_0x40371a[_0xd2ba('0x4')]){_0xcdfb2a={};if(_0x50b0c7['childModel']==='AnalyticExtractedReport'){_0xcdfb2a[_0x40371a['foreignKey']]=_[_0xd2ba('0x9')](_0x1e7ab8[_0xd2ba('0x8')],'id');}else{_0xcdfb2a[_0x40371a[_0xd2ba('0xa4')]]=_0x1e7ab8[_0xd2ba('0x8')];}_0x4b0b41[_0xd2ba('0x8e')](_0xcdfb2a);}else{_0x3958f5['where']['id']=_0x1e7ab8['associatedResources'];}}else{for(var _0x597051=0x0;_0x597051<_0x52bee5[_0xd2ba('0x8d')];_0x597051++){_0x40371a=_[_0xd2ba('0x90')](_0x58d678,['name',_0x52bee5[_0x597051][_0xd2ba('0xb')]]);if(_0x40371a[_0xd2ba('0x4')]){_0xcdfb2a={};_0xcdfb2a[_0x40371a[_0xd2ba('0xa4')]]=_0x52bee5[_0x597051]['associatedResources'];_0x4b0b41[_0xd2ba('0x8e')](_0xcdfb2a);}else{if(!_0x3958f5[_0xd2ba('0x84')]['id'])_0x3958f5[_0xd2ba('0x84')]['id']=[];_0x52bee5[_0x597051]['associatedResources'][_0xd2ba('0xa5')](function(_0x573bec){_0x3958f5[_0xd2ba('0x84')]['id'][_0xd2ba('0x8e')](_0x573bec);});}}}if(!_[_0xd2ba('0x8c')](_0x4b0b41)){_0x3958f5[_0xd2ba('0x84')]=_[_0xd2ba('0xa2')](_0x3958f5[_0xd2ba('0x84')],{'$and':{'$or':_0x4b0b41}});}_0x3958f5=_[_0xd2ba('0xa2')]({},_0x3958f5,_0x3b6aac[_0xd2ba('0xa6')]);if(_0x1e7ab8&&!_0x1e7ab8['autoAssociation']&&_0x50b0c7[_0xd2ba('0x12')]==='AnalyticExtractedReport'){if(_0x3b6aac[_0xd2ba('0x86')][_0xd2ba('0xa7')]){_0x3958f5[_0xd2ba('0xa8')]=[{'all':!![]}];}return _0xe3442e[_0x50b0c7[_0xd2ba('0x12')]][_0xd2ba('0x6')](_0x3958f5)['then'](function(_0x276cf1){var _0x3f62d7=[];_0x276cf1[_0xd2ba('0xa5')](function(_0x4c8fbf){var _0x17b5ea;switch(_0x4c8fbf[_0xd2ba('0xa9')]){case _0xd2ba('0xaa'):_0x17b5ea=_[_0xd2ba('0x90')](_0x1e7ab8[_0xd2ba('0x8')],function(_0x5590a7){return _0x5590a7['id']===_0x4c8fbf[_0xd2ba('0xab')]&&_0x5590a7[_0xd2ba('0xf')]===_0xd2ba('0xac');});break;case'custom':_0x17b5ea=_[_0xd2ba('0x90')](_0x1e7ab8[_0xd2ba('0x8')],function(_0x505aee){return _0x505aee['id']===_0x4c8fbf[_0xd2ba('0xab')]&&_0x505aee[_0xd2ba('0xf')]===_0xd2ba('0xad');});break;}if(_0x17b5ea)_0x3f62d7[_0xd2ba('0x8e')](_0x4c8fbf);});_0x3477c5['count']=_0x3f62d7[_0xd2ba('0x8d')];_0x3477c5['rows']=_0x3f62d7;return _0x3477c5;});}else{if(!_[_0xd2ba('0x8c')](_0x3b6aac[_0xd2ba('0x86')][_0xd2ba('0xae')])){_0x3958f5['where']['id']=_0x3958f5[_0xd2ba('0x84')]['id']?_[_0xd2ba('0x99')](_0x3958f5[_0xd2ba('0x84')]['id'],_0x3b6aac[_0xd2ba('0x86')]['ids']):_0x3b6aac[_0xd2ba('0x86')][_0xd2ba('0xae')];if(_0x3b6aac[_0xd2ba('0x86')][_0xd2ba('0xaf')]){_0x3958f5[_0xd2ba('0x9f')]=_0x3b6aac[_0xd2ba('0x86')]['customSorting'];}}if(_0x3b6aac[_0xd2ba('0x86')][_0xd2ba('0xb0')]){_0x3958f5[_0xd2ba('0x84')]=_[_0xd2ba('0xa2')](_0x3958f5[_0xd2ba('0x84')],{'$and':_0x3b6aac['query'][_0xd2ba('0xb0')]});}return _0xe3442e[_0x50b0c7['childModel']][_0xd2ba('0xb1')]({'where':_0x3958f5[_0xd2ba('0x84')]})[_0xd2ba('0x7')](function(_0x628018){_0x3477c5[_0xd2ba('0xb1')]=_0x628018;if(_0x3b6aac[_0xd2ba('0x86')][_0xd2ba('0xa7')]){if(_0x50b0c7[_0xd2ba('0x12')]==='CmContact'){_0x3958f5[_0xd2ba('0xa8')]=[{'model':_0xe3442e[_0xd2ba('0x6d')],'as':_0xd2ba('0xb2'),'attributes':['id',_0xd2ba('0xb'),_0xd2ba('0xb3')],'required':_0x3b6aac[_0xd2ba('0x86')][_0xd2ba('0xb4')]?!![]:![]},{'model':_0xe3442e['Tag'],'as':_0xd2ba('0xb5'),'attributes':['id',_0xd2ba('0xb'),'color'],'through':_0x3b6aac['query'][_0xd2ba('0xb4')]?{'attributes':[],'where':{'TagId':_0x3b6aac[_0xd2ba('0x86')][_0xd2ba('0xb4')]||undefined}}:{},'required':_0x3b6aac[_0xd2ba('0x86')][_0xd2ba('0xb4')]?!![]:![]}];}else{_0x3958f5['include']=[{'all':!![]}];}}return _0xe3442e[_0x50b0c7[_0xd2ba('0x12')]]['findAll'](_0x3958f5);})['then'](function(_0x50d34f){_0x3477c5['rows']=_0x50d34f;if(_0x590db7==='Agents'&&_0x3b6aac['query'][_0xd2ba('0xb6')]===_0xd2ba('0xb7')){var _0x3b1119=[];for(var _0x45fae3=0x0;_0x45fae3<_0x3477c5['rows'][_0xd2ba('0x8d')];_0x45fae3++){_0x3b1119[_0xd2ba('0x8e')](_0x30d060(_0xd2ba('0xb8'),_0x3477c5[_0xd2ba('0xb9')][_0x45fae3][_0xd2ba('0xba')]));_0x3b1119[_0xd2ba('0x8e')](_0x30d060('sms',_0x3477c5[_0xd2ba('0xb9')][_0x45fae3][_0xd2ba('0xba')]));_0x3b1119[_0xd2ba('0x8e')](_0x30d060(_0xd2ba('0xbb'),_0x3477c5[_0xd2ba('0xb9')][_0x45fae3][_0xd2ba('0xba')]));_0x3b1119['push'](_0x30d060('mail',_0x3477c5[_0xd2ba('0xb9')][_0x45fae3][_0xd2ba('0xba')]));_0x3b1119[_0xd2ba('0x8e')](_0x30d060('openchannel',_0x3477c5[_0xd2ba('0xb9')][_0x45fae3][_0xd2ba('0xba')]));_0x3b1119['push'](_0x30d060(_0xd2ba('0xbc'),_0x3477c5['rows'][_0x45fae3][_0xd2ba('0xba')]));}return Promise[_0xd2ba('0x95')](_0x3b1119)[_0xd2ba('0x7')](function(){return _0x3477c5;});}return _0x3477c5;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 761e6d7..41ab160 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 _0xf78f=['./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','client','redis','defaults','localhost','socket.io-emitter'];(function(_0x16bb0e,_0x343132){var _0x102b8b=function(_0x17a62b){while(--_0x17a62b){_0x16bb0e['push'](_0x16bb0e['shift']());}};_0x102b8b(++_0x343132);}(_0xf78f,0x72));var _0xff78=function(_0x249d5d,_0x3778d9){_0x249d5d=_0x249d5d-0x0;var _0x1d4f69=_0xf78f[_0x249d5d];return _0x1d4f69;};'use strict';var _=require('lodash');var util=require(_0xff78('0x0'));var moment=require(_0xff78('0x1'));var BPromise=require(_0xff78('0x2'));var rs=require(_0xff78('0x3'));var fs=require('fs');var Redis=require(_0xff78('0x4'));var db=require(_0xff78('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xff78('0x6')]['http']({'port':0x232a});config[_0xff78('0x7')]=_[_0xff78('0x8')](config[_0xff78('0x7')],{'host':_0xff78('0x9'),'port':0x18eb});var socket=require(_0xff78('0xa'))(new Redis(config[_0xff78('0x7')]));require(_0xff78('0xb'))[_0xff78('0xc')](socket);function respondWithRpcPromise(_0x4f9abd,_0x4eaba5,_0x36dfa4){return new BPromise(function(_0xa55092,_0x1ea7d4){return client[_0xff78('0xd')](_0x4f9abd,_0x36dfa4)[_0xff78('0xe')](function(_0x2e22e3){logger[_0xff78('0xf')](_0xff78('0x10'),_0x4eaba5,'request\x20sent');logger[_0xff78('0x11')](_0xff78('0x12'),_0x4eaba5,'request\x20sent',JSON[_0xff78('0x13')](_0x2e22e3));if(_0x2e22e3['error']){if(_0x2e22e3[_0xff78('0x14')]['code']===0x1f4){logger[_0xff78('0x14')](_0xff78('0x10'),_0x4eaba5,_0x2e22e3[_0xff78('0x14')][_0xff78('0x15')]);return _0x1ea7d4(_0x2e22e3['error'][_0xff78('0x15')]);}logger[_0xff78('0x14')](_0xff78('0x10'),_0x4eaba5,_0x2e22e3[_0xff78('0x14')][_0xff78('0x15')]);return _0xa55092(_0x2e22e3[_0xff78('0x14')][_0xff78('0x15')]);}else{logger['info'](_0xff78('0x10'),_0x4eaba5,_0xff78('0x16'));_0xa55092(_0x2e22e3[_0xff78('0x17')][_0xff78('0x15')]);}})[_0xff78('0x18')](function(_0x41a06e){logger[_0xff78('0x14')](_0xff78('0x10'),_0x4eaba5,_0x41a06e);_0x1ea7d4(_0x41a06e);});});} \ No newline at end of file +var _0xb7ac=['redis','localhost','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x11dfc4,_0x14f848){var _0x3064d5=function(_0x59742a){while(--_0x59742a){_0x11dfc4['push'](_0x11dfc4['shift']());}};_0x3064d5(++_0x14f848);}(_0xb7ac,0x18a));var _0xcb7a=function(_0x5b8649,_0x1174f3){_0x5b8649=_0x5b8649-0x0;var _0x1a02b2=_0xb7ac[_0x5b8649];return _0x1a02b2;};'use strict';var _=require(_0xcb7a('0x0'));var util=require(_0xcb7a('0x1'));var moment=require(_0xcb7a('0x2'));var BPromise=require(_0xcb7a('0x3'));var rs=require(_0xcb7a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcb7a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcb7a('0x6'))(_0xcb7a('0x7'));var config=require('../../config/environment');var jayson=require(_0xcb7a('0x8'));var client=jayson[_0xcb7a('0x9')][_0xcb7a('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xcb7a('0xb')],{'host':_0xcb7a('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcb7a('0xb')]));require(_0xcb7a('0xd'))[_0xcb7a('0xe')](socket);function respondWithRpcPromise(_0x168efd,_0x392713,_0xe1e01){return new BPromise(function(_0x4a470d,_0x39742a){return client[_0xcb7a('0xf')](_0x168efd,_0xe1e01)[_0xcb7a('0x10')](function(_0x5d84a9){logger[_0xcb7a('0x11')](_0xcb7a('0x12'),_0x392713,'request\x20sent');logger[_0xcb7a('0x13')](_0xcb7a('0x14'),_0x392713,_0xcb7a('0x15'),JSON[_0xcb7a('0x16')](_0x5d84a9));if(_0x5d84a9[_0xcb7a('0x17')]){if(_0x5d84a9[_0xcb7a('0x17')][_0xcb7a('0x18')]===0x1f4){logger[_0xcb7a('0x17')](_0xcb7a('0x12'),_0x392713,_0x5d84a9['error'][_0xcb7a('0x19')]);return _0x39742a(_0x5d84a9['error'][_0xcb7a('0x19')]);}logger[_0xcb7a('0x17')](_0xcb7a('0x12'),_0x392713,_0x5d84a9[_0xcb7a('0x17')]['message']);return _0x4a470d(_0x5d84a9[_0xcb7a('0x17')][_0xcb7a('0x19')]);}else{logger[_0xcb7a('0x11')](_0xcb7a('0x12'),_0x392713,_0xcb7a('0x15'));_0x4a470d(_0x5d84a9[_0xcb7a('0x1a')][_0xcb7a('0x19')]);}})['catch'](function(_0x27454e){logger[_0xcb7a('0x17')](_0xcb7a('0x12'),_0x392713,_0x27454e);_0x39742a(_0x27454e);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index ecf060c..ca128e8 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 _0x7592=['save','remove','emit','removeListener','register','length','userProfile:'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7592,0x150));var _0x2759=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x7592[_0x173441];return _0x2423a8;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x2759('0x0'),_0x2759('0x1'),'update'];function createListener(_0x24e1fb,_0x7859e5){return function(_0x8cdc81){_0x7859e5[_0x2759('0x2')](_0x24e1fb,_0x8cdc81);};}function removeListener(_0x33df98,_0x1ee11d){return function(){UserProfileEvents[_0x2759('0x3')](_0x33df98,_0x1ee11d);};}exports[_0x2759('0x4')]=function(_0x52eb17){for(var _0x5ebf24=0x0,_0x58887c=events[_0x2759('0x5')];_0x5ebf24<_0x58887c;_0x5ebf24++){var _0x3d0c12=events[_0x5ebf24];var _0x305644=createListener(_0x2759('0x6')+_0x3d0c12,_0x52eb17);UserProfileEvents['on'](_0x3d0c12,_0x305644);}}; \ No newline at end of file +var _0x472e=['register','save','emit','removeListener'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x472e,0x175));var _0xe472=function(_0x4d1d2c,_0x44f4d8){_0x4d1d2c=_0x4d1d2c-0x0;var _0x2c4cb9=_0x472e[_0x4d1d2c];return _0x2c4cb9;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0xe472('0x0'),'remove','update'];function createListener(_0x4090f7,_0xadc8c2){return function(_0x2b3b66){_0xadc8c2[_0xe472('0x1')](_0x4090f7,_0x2b3b66);};}function removeListener(_0x2f649a,_0x31a10c){return function(){UserProfileEvents[_0xe472('0x2')](_0x2f649a,_0x31a10c);};}exports[_0xe472('0x3')]=function(_0x4de619){for(var _0x382beb=0x0,_0x34e23e=events['length'];_0x382beb<_0x34e23e;_0x382beb++){var _0x23fe68=events[_0x382beb];var _0x16a58a=createListener('userProfile:'+_0x23fe68,_0x4de619);UserProfileEvents['on'](_0x23fe68,_0x16a58a);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index b1c028e..230726f 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 _0x0f42=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','path','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0f42,0x1b6));var _0x20f4=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x0f42[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x20f4('0x0'));var timeout=require(_0x20f4('0x1'));var express=require(_0x20f4('0x2'));var router=express[_0x20f4('0x3')]();var fs_extra=require(_0x20f4('0x4'));var auth=require(_0x20f4('0x5'));var interaction=require(_0x20f4('0x6'));var config=require('../../config/environment');var controller=require(_0x20f4('0x7'));router[_0x20f4('0x8')]('/',auth['isAuthenticated'](),controller[_0x20f4('0x9')]);router[_0x20f4('0x8')](_0x20f4('0xa'),auth[_0x20f4('0xb')](),controller[_0x20f4('0xc')]);router[_0x20f4('0x8')](_0x20f4('0xd'),auth['isAuthenticated'](),controller[_0x20f4('0xe')]);router[_0x20f4('0xf')]('/',auth['isAuthenticated'](),controller[_0x20f4('0x10')]);router[_0x20f4('0x11')](_0x20f4('0xd'),auth[_0x20f4('0xb')](),controller[_0x20f4('0x12')]);router[_0x20f4('0x13')](_0x20f4('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6bee=['update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x6bee,0x180));var _0xe6be=function(_0x10d301,_0x101ae3){_0x10d301=_0x10d301-0x0;var _0x364a3d=_0x6bee[_0x10d301];return _0x364a3d;};'use strict';var multer=require(_0xe6be('0x0'));var util=require(_0xe6be('0x1'));var path=require('path');var timeout=require(_0xe6be('0x2'));var express=require(_0xe6be('0x3'));var router=express['Router']();var fs_extra=require(_0xe6be('0x4'));var auth=require(_0xe6be('0x5'));var interaction=require(_0xe6be('0x6'));var config=require(_0xe6be('0x7'));var controller=require('./userProfileResource.controller');router['get']('/',auth[_0xe6be('0x8')](),controller[_0xe6be('0x9')]);router[_0xe6be('0xa')]('/describe',auth[_0xe6be('0x8')](),controller['describe']);router[_0xe6be('0xa')](_0xe6be('0xb'),auth[_0xe6be('0x8')](),controller[_0xe6be('0xc')]);router[_0xe6be('0xd')]('/',auth[_0xe6be('0x8')](),controller[_0xe6be('0xe')]);router['put'](_0xe6be('0xb'),auth[_0xe6be('0x8')](),controller[_0xe6be('0xf')]);router[_0xe6be('0x10')]('/:id',auth[_0xe6be('0x8')](),controller[_0xe6be('0x11')]);module[_0xe6be('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 14d0047..c04e186 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 _0x16a2=['exports','STRING','INTEGER'];(function(_0x46ce49,_0x40df08){var _0x207f70=function(_0x449ead){while(--_0x449ead){_0x46ce49['push'](_0x46ce49['shift']());}};_0x207f70(++_0x40df08);}(_0x16a2,0x1d4));var _0x216a=function(_0x2a8860,_0x2da926){_0x2a8860=_0x2a8860-0x0;var _0x2f47a4=_0x16a2[_0x2a8860];return _0x2f47a4;};'use strict';var Sequelize=require('sequelize');module[_0x216a('0x0')]={'name':{'type':Sequelize[_0x216a('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x216a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x216a('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x064a=['sequelize','STRING','INTEGER'];(function(_0x445b39,_0x2e0005){var _0x21cc2a=function(_0x2e0fff){while(--_0x2e0fff){_0x445b39['push'](_0x445b39['shift']());}};_0x21cc2a(++_0x2e0005);}(_0x064a,0xd2));var _0xa064=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x064a[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xa064('0x0'));module['exports']={'name':{'type':Sequelize[_0xa064('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xa064('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xa064('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 0eae68c..4032671 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 _0x4975=['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','UserProfileResource','count','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x4f8b0e,_0x586fc4){var _0x42c3e6=function(_0x32ead0){while(--_0x32ead0){_0x4f8b0e['push'](_0x4f8b0e['shift']());}};_0x42c3e6(++_0x586fc4);}(_0x4975,0x86));var _0x5497=function(_0x40ff86,_0x39b67e){_0x40ff86=_0x40ff86-0x0;var _0x53f67a=_0x4975[_0x40ff86];return _0x53f67a;};'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['UserProfileResource']['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['UserProfileResource'][_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));};exports['describe']=function(_0x1f73eb,_0x5b2c22){return db['UserProfileResource'][_0x5497('0x47')]()[_0x5497('0x24')](respondWithResult(_0x5b2c22,null))['catch'](handleError(_0x5b2c22,null));}; \ No newline at end of file +var _0x2542=['json','offset','limit','undefined','count','set','Content-Range','apply','update','then','error','stack','name','index','map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x1bf611,_0x5a169b){var _0x46c450=function(_0x3528e0){while(--_0x3528e0){_0x1bf611['push'](_0x1bf611['shift']());}};_0x46c450(++_0x5a169b);}(_0x2542,0x169));var _0x2254=function(_0x1cf6d9,_0x53a22e){_0x1cf6d9=_0x1cf6d9-0x0;var _0x161909=_0x2542[_0x1cf6d9];return _0x161909;};'use strict';var emlformat=require(_0x2254('0x0'));var rimraf=require(_0x2254('0x1'));var zipdir=require(_0x2254('0x2'));var jsonpatch=require(_0x2254('0x3'));var rp=require('request-promise');var moment=require(_0x2254('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2254('0x5'));var util=require(_0x2254('0x6'));var path=require(_0x2254('0x7'));var sox=require(_0x2254('0x8'));var csv=require(_0x2254('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2254('0xa'));var _=require(_0x2254('0xb'));var squel=require(_0x2254('0xc'));var crypto=require(_0x2254('0xd'));var jsforce=require(_0x2254('0xe'));var deskjs=require(_0x2254('0xf'));var toCsv=require(_0x2254('0x9'));var querystring=require(_0x2254('0x10'));var Papa=require(_0x2254('0x11'));var Redis=require(_0x2254('0x12'));var authService=require(_0x2254('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2254('0x14'));var hardwareService=require(_0x2254('0x15'));var logger=require(_0x2254('0x16'))(_0x2254('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2254('0x18'));var db=require(_0x2254('0x19'))['db'];function respondWithStatusCode(_0x116b70,_0xdcb670){_0xdcb670=_0xdcb670||0xcc;return function(_0x3c326b){if(_0x3c326b){return _0x116b70[_0x2254('0x1a')](_0xdcb670);}return _0x116b70['status'](_0xdcb670)[_0x2254('0x1b')]();};}function respondWithResult(_0x7c7ab0,_0x504749){_0x504749=_0x504749||0xc8;return function(_0x2f4de){if(_0x2f4de){return _0x7c7ab0[_0x2254('0x1c')](_0x504749)[_0x2254('0x1d')](_0x2f4de);}};}function respondWithFilteredResult(_0x145272,_0x26285a){return function(_0xbc5548){if(_0xbc5548){var _0x50f137=typeof _0x26285a[_0x2254('0x1e')]==='undefined'&&typeof _0x26285a[_0x2254('0x1f')]===_0x2254('0x20');var _0x170ffa=_0xbc5548[_0x2254('0x21')];var _0x1ae11e=_0x50f137?0x0:_0x26285a[_0x2254('0x1e')];var _0x497724=_0x50f137?_0xbc5548['count']:_0x26285a['offset']+_0x26285a[_0x2254('0x1f')];var _0x3a79f8;if(_0x497724>=_0x170ffa){_0x497724=_0x170ffa;_0x3a79f8=0xc8;}else{_0x3a79f8=0xce;}_0x145272[_0x2254('0x1c')](_0x3a79f8);return _0x145272[_0x2254('0x22')](_0x2254('0x23'),_0x1ae11e+'-'+_0x497724+'/'+_0x170ffa)[_0x2254('0x1d')](_0xbc5548);}return null;};}function patchUpdates(_0x487f72){return function(_0x28381e){try{jsonpatch[_0x2254('0x24')](_0x28381e,_0x487f72,!![]);}catch(_0x906cde){return BPromise['reject'](_0x906cde);}return _0x28381e['save']();};}function saveUpdates(_0x5bd982,_0x1e8a98){return function(_0x559af4){if(_0x559af4){return _0x559af4[_0x2254('0x25')](_0x5bd982)['then'](function(_0x5713e4){return _0x5713e4;});}return null;};}function removeEntity(_0x4d8faf,_0x540020){return function(_0x5e5edb){if(_0x5e5edb){return _0x5e5edb['destroy']()[_0x2254('0x26')](function(){_0x4d8faf[_0x2254('0x1c')](0xcc)[_0x2254('0x1b')]();});}};}function handleEntityNotFound(_0x265467,_0x13522d){return function(_0x1349c9){if(!_0x1349c9){_0x265467['sendStatus'](0x194);}return _0x1349c9;};}function handleError(_0x4a8274,_0x1ada42){_0x1ada42=_0x1ada42||0x1f4;return function(_0x4f6877){logger[_0x2254('0x27')](_0x4f6877[_0x2254('0x28')]);if(_0x4f6877[_0x2254('0x29')]){delete _0x4f6877[_0x2254('0x29')];}_0x4a8274[_0x2254('0x1c')](_0x1ada42)['send'](_0x4f6877);};}exports[_0x2254('0x2a')]=function(_0x2a789b,_0x21285d){var _0x37af8b={},_0x13366a={},_0x377c41={'count':0x0,'rows':[]};var _0x3214a7=_[_0x2254('0x2b')](db[_0x2254('0x2c')][_0x2254('0x2d')],function(_0x21c641){return{'name':_0x21c641[_0x2254('0x2e')],'type':_0x21c641[_0x2254('0x2f')][_0x2254('0x30')]};});_0x13366a[_0x2254('0x31')]=_[_0x2254('0x2b')](_0x3214a7,_0x2254('0x29'));_0x13366a[_0x2254('0x32')]=_[_0x2254('0x33')](_0x2a789b['query']);_0x13366a[_0x2254('0x34')]=_[_0x2254('0x35')](_0x13366a[_0x2254('0x31')],_0x13366a[_0x2254('0x32')]);_0x37af8b[_0x2254('0x36')]=_[_0x2254('0x35')](_0x13366a[_0x2254('0x31')],qs[_0x2254('0x37')](_0x2a789b[_0x2254('0x32')]['fields']));_0x37af8b[_0x2254('0x36')]=_0x37af8b[_0x2254('0x36')]['length']?_0x37af8b[_0x2254('0x36')]:_0x13366a[_0x2254('0x31')];if(!_0x2a789b[_0x2254('0x32')][_0x2254('0x38')]('nolimit')){_0x37af8b['limit']=qs[_0x2254('0x1f')](_0x2a789b['query'][_0x2254('0x1f')]);_0x37af8b[_0x2254('0x1e')]=qs[_0x2254('0x1e')](_0x2a789b[_0x2254('0x32')][_0x2254('0x1e')]);}_0x37af8b[_0x2254('0x39')]=qs[_0x2254('0x3a')](_0x2a789b['query'][_0x2254('0x3a')]);_0x37af8b[_0x2254('0x3b')]=qs[_0x2254('0x34')](_[_0x2254('0x3c')](_0x2a789b[_0x2254('0x32')],_0x13366a[_0x2254('0x34')]),_0x3214a7);if(_0x2a789b[_0x2254('0x32')][_0x2254('0x3d')]){_0x37af8b[_0x2254('0x3b')]=_[_0x2254('0x3e')](_0x37af8b['where'],{'$or':_[_0x2254('0x2b')](_0x3214a7,function(_0xde3e4a){if(_0xde3e4a[_0x2254('0x2f')]!==_0x2254('0x3f')){var _0x4c7cc3={};_0x4c7cc3[_0xde3e4a[_0x2254('0x29')]]={'$like':'%'+_0x2a789b[_0x2254('0x32')][_0x2254('0x3d')]+'%'};return _0x4c7cc3;}})});}_0x37af8b=_[_0x2254('0x3e')]({},_0x37af8b,_0x2a789b[_0x2254('0x40')]);var _0x2602db={'where':_0x37af8b[_0x2254('0x3b')]};return db[_0x2254('0x2c')]['count'](_0x2602db)[_0x2254('0x26')](function(_0x5c15d7){_0x377c41[_0x2254('0x21')]=_0x5c15d7;if(_0x2a789b[_0x2254('0x32')][_0x2254('0x41')]){_0x37af8b[_0x2254('0x42')]=[{'all':!![]}];}return db[_0x2254('0x2c')][_0x2254('0x43')](_0x37af8b);})[_0x2254('0x26')](function(_0x568ec9){_0x377c41[_0x2254('0x44')]=_0x568ec9;return _0x377c41;})[_0x2254('0x26')](respondWithFilteredResult(_0x21285d,_0x37af8b))[_0x2254('0x45')](handleError(_0x21285d,null));};exports[_0x2254('0x46')]=function(_0x40d4da,_0x57cda2){var _0x22bb98={'raw':![],'where':{'id':_0x40d4da[_0x2254('0x47')]['id']}},_0x1dec43={};_0x1dec43[_0x2254('0x31')]=_[_0x2254('0x33')](db['UserProfileResource'][_0x2254('0x2d')]);_0x1dec43['query']=_[_0x2254('0x33')](_0x40d4da[_0x2254('0x32')]);_0x1dec43[_0x2254('0x34')]=_[_0x2254('0x35')](_0x1dec43[_0x2254('0x31')],_0x1dec43[_0x2254('0x32')]);_0x22bb98[_0x2254('0x36')]=_[_0x2254('0x35')](_0x1dec43[_0x2254('0x31')],qs[_0x2254('0x37')](_0x40d4da[_0x2254('0x32')][_0x2254('0x37')]));_0x22bb98[_0x2254('0x36')]=_0x22bb98['attributes'][_0x2254('0x48')]?_0x22bb98[_0x2254('0x36')]:_0x1dec43[_0x2254('0x31')];if(_0x40d4da['query'][_0x2254('0x41')]){_0x22bb98[_0x2254('0x42')]=[{'all':!![]}];}_0x22bb98=_[_0x2254('0x3e')]({},_0x22bb98,_0x40d4da[_0x2254('0x40')]);return db[_0x2254('0x2c')][_0x2254('0x49')](_0x22bb98)[_0x2254('0x26')](handleEntityNotFound(_0x57cda2,null))[_0x2254('0x26')](respondWithResult(_0x57cda2,null))[_0x2254('0x45')](handleError(_0x57cda2,null));};exports['create']=function(_0x239ba0,_0x405eb2){return db[_0x2254('0x2c')][_0x2254('0x4a')](_0x239ba0[_0x2254('0x4b')],{})[_0x2254('0x26')](respondWithResult(_0x405eb2,0xc9))[_0x2254('0x45')](handleError(_0x405eb2,null));};exports[_0x2254('0x25')]=function(_0x3ac691,_0xa103ea){if(_0x3ac691['body']['id']){delete _0x3ac691[_0x2254('0x4b')]['id'];}return db[_0x2254('0x2c')]['find']({'where':{'id':_0x3ac691[_0x2254('0x47')]['id']}})[_0x2254('0x26')](handleEntityNotFound(_0xa103ea,null))[_0x2254('0x26')](saveUpdates(_0x3ac691[_0x2254('0x4b')],null))['then'](respondWithResult(_0xa103ea,null))[_0x2254('0x45')](handleError(_0xa103ea,null));};exports[_0x2254('0x4c')]=function(_0x4d2c96,_0x26d01a){return db[_0x2254('0x2c')][_0x2254('0x49')]({'where':{'id':_0x4d2c96[_0x2254('0x47')]['id']}})['then'](handleEntityNotFound(_0x26d01a,null))[_0x2254('0x26')](removeEntity(_0x26d01a,null))[_0x2254('0x45')](handleError(_0x26d01a,null));};exports[_0x2254('0x4d')]=function(_0x4ba6ef,_0x4cc18a){return db[_0x2254('0x2c')][_0x2254('0x4d')]()['then'](respondWithResult(_0x4cc18a,null))[_0x2254('0x45')](handleError(_0x4cc18a,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index a0013a8..2401f83 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 _0x04d6=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','user_profile_has_resources','compositeIndex','sectionId','lodash','util'];(function(_0x39cea6,_0x1bc94a){var _0x4744b1=function(_0x1a69a5){while(--_0x1a69a5){_0x39cea6['push'](_0x39cea6['shift']());}};_0x4744b1(++_0x1bc94a);}(_0x04d6,0x1be));var _0x604d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x04d6[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x604d('0x0'));var util=require(_0x604d('0x1'));var logger=require(_0x604d('0x2'))(_0x604d('0x3'));var moment=require(_0x604d('0x4'));var BPromise=require(_0x604d('0x5'));var rp=require(_0x604d('0x6'));var fs=require('fs');var path=require(_0x604d('0x7'));var rimraf=require(_0x604d('0x8'));var config=require(_0x604d('0x9'));var attributes=require(_0x604d('0xa'));module[_0x604d('0xb')]=function(_0x1a41fd,_0xc96a9a){return _0x1a41fd[_0x604d('0xc')]('UserProfileResource',attributes,{'tableName':_0x604d('0xd'),'paranoid':![],'indexes':[{'name':_0x604d('0xe'),'fields':['resourceId',_0x604d('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1c54=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','user_profile_has_resources','compositeIndex','resourceId','sectionId'];(function(_0x5cd988,_0x1a180f){var _0x59f992=function(_0x2e12e0){while(--_0x2e12e0){_0x5cd988['push'](_0x5cd988['shift']());}};_0x59f992(++_0x1a180f);}(_0x1c54,0x1b2));var _0x41c5=function(_0x363319,_0x4fa1a1){_0x363319=_0x363319-0x0;var _0x182a62=_0x1c54[_0x363319];return _0x182a62;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x41c5('0x0'))(_0x41c5('0x1'));var moment=require(_0x41c5('0x2'));var BPromise=require('bluebird');var rp=require(_0x41c5('0x3'));var fs=require('fs');var path=require(_0x41c5('0x4'));var rimraf=require(_0x41c5('0x5'));var config=require(_0x41c5('0x6'));var attributes=require(_0x41c5('0x7'));module[_0x41c5('0x8')]=function(_0x18a87a,_0x5618da){return _0x18a87a[_0x41c5('0x9')]('UserProfileResource',attributes,{'tableName':_0x41c5('0xa'),'paranoid':![],'indexes':[{'name':_0x41c5('0xb'),'fields':[_0x41c5('0xc'),_0x41c5('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index f6455f9..f829583 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 _0xaa7d=['client','request','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x482bcf,_0x3819b8){var _0x351553=function(_0x546a0a){while(--_0x546a0a){_0x482bcf['push'](_0x482bcf['shift']());}};_0x351553(++_0x3819b8);}(_0xaa7d,0x193));var _0xdaa7=function(_0x58fbb0,_0xe497b5){_0x58fbb0=_0x58fbb0-0x0;var _0x1783d2=_0xaa7d[_0x58fbb0];return _0x1783d2;};'use strict';var _=require(_0xdaa7('0x0'));var util=require(_0xdaa7('0x1'));var moment=require(_0xdaa7('0x2'));var BPromise=require(_0xdaa7('0x3'));var rs=require(_0xdaa7('0x4'));var fs=require('fs');var Redis=require(_0xdaa7('0x5'));var db=require(_0xdaa7('0x6'))['db'];var utils=require(_0xdaa7('0x7'));var logger=require(_0xdaa7('0x8'))(_0xdaa7('0x9'));var config=require(_0xdaa7('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xdaa7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a0969,_0x579b82,_0x39de57){return new BPromise(function(_0x390fa3,_0x3e35d2){return client[_0xdaa7('0xc')](_0x5a0969,_0x39de57)[_0xdaa7('0xd')](function(_0x14b8f9){logger['info'](_0xdaa7('0xe'),_0x579b82,_0xdaa7('0xf'));logger[_0xdaa7('0x10')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x579b82,'request\x20sent',JSON['stringify'](_0x14b8f9));if(_0x14b8f9['error']){if(_0x14b8f9[_0xdaa7('0x11')][_0xdaa7('0x12')]===0x1f4){logger[_0xdaa7('0x11')](_0xdaa7('0xe'),_0x579b82,_0x14b8f9[_0xdaa7('0x11')][_0xdaa7('0x13')]);return _0x3e35d2(_0x14b8f9[_0xdaa7('0x11')][_0xdaa7('0x13')]);}logger[_0xdaa7('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x579b82,_0x14b8f9[_0xdaa7('0x11')]['message']);return _0x390fa3(_0x14b8f9[_0xdaa7('0x11')][_0xdaa7('0x13')]);}else{logger[_0xdaa7('0x14')](_0xdaa7('0xe'),_0x579b82,_0xdaa7('0xf'));_0x390fa3(_0x14b8f9[_0xdaa7('0x15')][_0xdaa7('0x13')]);}})[_0xdaa7('0x16')](function(_0xa36c3f){logger[_0xdaa7('0x11')](_0xdaa7('0xe'),_0x579b82,_0xa36c3f);_0x3e35d2(_0xa36c3f);});});} \ No newline at end of file +var _0x5f2a=['rpc','jayson/promise','client','request','then','info','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x39251c,_0x543903){var _0x22c9c2=function(_0x46fae1){while(--_0x46fae1){_0x39251c['push'](_0x39251c['shift']());}};_0x22c9c2(++_0x543903);}(_0x5f2a,0x19d));var _0xa5f2=function(_0x499b1c,_0x4c6536){_0x499b1c=_0x499b1c-0x0;var _0x236801=_0x5f2a[_0x499b1c];return _0x236801;};'use strict';var _=require(_0xa5f2('0x0'));var util=require(_0xa5f2('0x1'));var moment=require(_0xa5f2('0x2'));var BPromise=require(_0xa5f2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa5f2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa5f2('0x5'));var logger=require(_0xa5f2('0x6'))(_0xa5f2('0x7'));var config=require('../../config/environment');var jayson=require(_0xa5f2('0x8'));var client=jayson[_0xa5f2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33cc53,_0x2a2951,_0x14ef37){return new BPromise(function(_0xa11ea4,_0xe43c28){return client[_0xa5f2('0xa')](_0x33cc53,_0x14ef37)[_0xa5f2('0xb')](function(_0x227133){logger[_0xa5f2('0xc')](_0xa5f2('0xd'),_0x2a2951,'request\x20sent');logger[_0xa5f2('0xe')](_0xa5f2('0xf'),_0x2a2951,'request\x20sent',JSON[_0xa5f2('0x10')](_0x227133));if(_0x227133[_0xa5f2('0x11')]){if(_0x227133[_0xa5f2('0x11')]['code']===0x1f4){logger[_0xa5f2('0x11')](_0xa5f2('0xd'),_0x2a2951,_0x227133[_0xa5f2('0x11')][_0xa5f2('0x12')]);return _0xe43c28(_0x227133[_0xa5f2('0x11')][_0xa5f2('0x12')]);}logger[_0xa5f2('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x2a2951,_0x227133[_0xa5f2('0x11')][_0xa5f2('0x12')]);return _0xa11ea4(_0x227133[_0xa5f2('0x11')][_0xa5f2('0x12')]);}else{logger[_0xa5f2('0xc')](_0xa5f2('0xd'),_0x2a2951,_0xa5f2('0x13'));_0xa11ea4(_0x227133[_0xa5f2('0x14')][_0xa5f2('0x12')]);}})['catch'](function(_0x3d9af3){logger[_0xa5f2('0x11')](_0xa5f2('0xd'),_0x2a2951,_0x3d9af3);_0xe43c28(_0x3d9af3);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index ea75431..d7af509 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 _0xb4f5=['put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','describe','get','show','create'];(function(_0x49d19d,_0x245cf5){var _0x4ebef1=function(_0xf0a4e6){while(--_0xf0a4e6){_0x49d19d['push'](_0x49d19d['shift']());}};_0x4ebef1(++_0x245cf5);}(_0xb4f5,0x83));var _0x5b4f=function(_0x4e7306,_0x51515f){_0x4e7306=_0x4e7306-0x0;var _0x403bbe=_0xb4f5[_0x4e7306];return _0x403bbe;};'use strict';var multer=require(_0x5b4f('0x0'));var util=require(_0x5b4f('0x1'));var path=require(_0x5b4f('0x2'));var timeout=require(_0x5b4f('0x3'));var express=require(_0x5b4f('0x4'));var router=express['Router']();var fs_extra=require(_0x5b4f('0x5'));var auth=require(_0x5b4f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5b4f('0x7'));var controller=require('./userProfileSection.controller');router['get']('/',auth[_0x5b4f('0x8')](),controller['index']);router['get']('/describe',auth[_0x5b4f('0x8')](),controller[_0x5b4f('0x9')]);router[_0x5b4f('0xa')]('/:id',auth[_0x5b4f('0x8')](),controller[_0x5b4f('0xb')]);router['post']('/',auth[_0x5b4f('0x8')](),controller[_0x5b4f('0xc')]);router[_0x5b4f('0xd')](_0x5b4f('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x5b4f('0xf')]('/:id',auth[_0x5b4f('0x8')](),controller[_0x5b4f('0x10')]);module[_0x5b4f('0x11')]=router; \ No newline at end of file +var _0x3a06=['show','post','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','index','isAuthenticated','/:id'];(function(_0x3cf049,_0x411d0b){var _0x533bf8=function(_0x23b09e){while(--_0x23b09e){_0x3cf049['push'](_0x3cf049['shift']());}};_0x533bf8(++_0x411d0b);}(_0x3a06,0x182));var _0x63a0=function(_0x27caff,_0x3d8a9c){_0x27caff=_0x27caff-0x0;var _0x29a280=_0x3a06[_0x27caff];return _0x29a280;};'use strict';var multer=require('multer');var util=require(_0x63a0('0x0'));var path=require(_0x63a0('0x1'));var timeout=require(_0x63a0('0x2'));var express=require(_0x63a0('0x3'));var router=express[_0x63a0('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x63a0('0x5'));var interaction=require(_0x63a0('0x6'));var config=require(_0x63a0('0x7'));var controller=require(_0x63a0('0x8'));router[_0x63a0('0x9')]('/',auth['isAuthenticated'](),controller[_0x63a0('0xa')]);router[_0x63a0('0x9')]('/describe',auth[_0x63a0('0xb')](),controller['describe']);router[_0x63a0('0x9')](_0x63a0('0xc'),auth[_0x63a0('0xb')](),controller[_0x63a0('0xd')]);router[_0x63a0('0xe')]('/',auth[_0x63a0('0xb')](),controller['create']);router[_0x63a0('0xf')](_0x63a0('0xc'),auth[_0x63a0('0xb')](),controller['update']);router[_0x63a0('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x63a0('0x11')]);module[_0x63a0('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 5b4f291..9ca66d1 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 _0xb62e=['STRING','BOOLEAN','setDataValue','crudPermissions','getDataValue','split','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb62e,0x1de));var _0xeb62=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xb62e[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0xeb62('0x0'));module[_0xeb62('0x1')]={'name':{'type':Sequelize[_0xeb62('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xeb62('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0xeb62('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xeb62('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xeb62('0x2')],'set':function(_0x929329){this[_0xeb62('0x4')](_0xeb62('0x5'),_0x929329?_0x929329['join'](''):[]);},'get':function(){return this[_0xeb62('0x6')](_0xeb62('0x5'))?this[_0xeb62('0x6')]('crudPermissions')[_0xeb62('0x7')](''):[];}}}; \ No newline at end of file +var _0xe5b5=['exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','sequelize'];(function(_0xaeed95,_0x422e6e){var _0x3e3959=function(_0x5d59b4){while(--_0x5d59b4){_0xaeed95['push'](_0xaeed95['shift']());}};_0x3e3959(++_0x422e6e);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x421725,_0x318a04){_0x421725=_0x421725-0x0;var _0x51b322=_0xe5b5[_0x421725];return _0x51b322;};'use strict';var Sequelize=require(_0x5e5b('0x0'));module[_0x5e5b('0x1')]={'name':{'type':Sequelize[_0x5e5b('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x5e5b('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x5e5b('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x5e5b('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x5e5b('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x5e5b('0x2')],'set':function(_0xf20c6a){this[_0x5e5b('0x5')](_0x5e5b('0x6'),_0xf20c6a?_0xf20c6a[_0x5e5b('0x7')](''):[]);},'get':function(){return this[_0x5e5b('0x8')](_0x5e5b('0x6'))?this[_0x5e5b('0x8')](_0x5e5b('0x6'))[_0x5e5b('0x9')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 175bba2..8d7688a 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 _0x0001=['index','map','UserProfileSection','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','includeAll','create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','status','stack','name','send'];(function(_0x366992,_0x6862f0){var _0x10bc0c=function(_0xd8a56e){while(--_0xd8a56e){_0x366992['push'](_0x366992['shift']());}};_0x10bc0c(++_0x6862f0);}(_0x0001,0x1e3));var _0x1000=function(_0x4e9e21,_0x3c77d6){_0x4e9e21=_0x4e9e21-0x0;var _0x4021b7=_0x0001[_0x4e9e21];return _0x4021b7;};'use strict';var emlformat=require(_0x1000('0x0'));var rimraf=require(_0x1000('0x1'));var zipdir=require(_0x1000('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1000('0x3'));var moment=require(_0x1000('0x4'));var BPromise=require(_0x1000('0x5'));var Mustache=require(_0x1000('0x6'));var util=require(_0x1000('0x7'));var path=require('path');var sox=require(_0x1000('0x8'));var csv=require(_0x1000('0x9'));var ejs=require(_0x1000('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1000('0xb'));var squel=require(_0x1000('0xc'));var crypto=require(_0x1000('0xd'));var jsforce=require(_0x1000('0xe'));var deskjs=require(_0x1000('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1000('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1000('0x11'));var as=require(_0x1000('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1000('0x13'))(_0x1000('0x14'));var utils=require(_0x1000('0x15'));var config=require(_0x1000('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1000('0x17'))['db'];function respondWithStatusCode(_0x2d248a,_0x277f55){_0x277f55=_0x277f55||0xcc;return function(_0x5e59d2){if(_0x5e59d2){return _0x2d248a[_0x1000('0x18')](_0x277f55);}return _0x2d248a['status'](_0x277f55)[_0x1000('0x19')]();};}function respondWithResult(_0x5594f9,_0xbcfd71){_0xbcfd71=_0xbcfd71||0xc8;return function(_0x1ef246){if(_0x1ef246){return _0x5594f9['status'](_0xbcfd71)[_0x1000('0x1a')](_0x1ef246);}};}function respondWithFilteredResult(_0x454720,_0x2e31c0){return function(_0x40e718){if(_0x40e718){var _0x33d7b3=typeof _0x2e31c0[_0x1000('0x1b')]==='undefined'&&typeof _0x2e31c0[_0x1000('0x1c')]===_0x1000('0x1d');var _0x2be398=_0x40e718[_0x1000('0x1e')];var _0x275be4=_0x33d7b3?0x0:_0x2e31c0[_0x1000('0x1b')];var _0x5517ce=_0x33d7b3?_0x40e718[_0x1000('0x1e')]:_0x2e31c0[_0x1000('0x1b')]+_0x2e31c0[_0x1000('0x1c')];var _0x32fa9b;if(_0x5517ce>=_0x2be398){_0x5517ce=_0x2be398;_0x32fa9b=0xc8;}else{_0x32fa9b=0xce;}_0x454720['status'](_0x32fa9b);return _0x454720[_0x1000('0x1f')](_0x1000('0x20'),_0x275be4+'-'+_0x5517ce+'/'+_0x2be398)[_0x1000('0x1a')](_0x40e718);}return null;};}function patchUpdates(_0x5613be){return function(_0x46d836){try{jsonpatch[_0x1000('0x21')](_0x46d836,_0x5613be,!![]);}catch(_0x572419){return BPromise[_0x1000('0x22')](_0x572419);}return _0x46d836[_0x1000('0x23')]();};}function saveUpdates(_0x47d70f,_0x7576de){return function(_0x2c09c7){if(_0x2c09c7){return _0x2c09c7[_0x1000('0x24')](_0x47d70f)[_0x1000('0x25')](function(_0x12f0da){return _0x12f0da;});}return null;};}function removeEntity(_0x133d57,_0x367764){return function(_0x7b7140){if(_0x7b7140){return _0x7b7140['destroy']()[_0x1000('0x25')](function(){_0x133d57[_0x1000('0x26')](0xcc)[_0x1000('0x19')]();});}};}function handleEntityNotFound(_0x12c58f,_0x23c920){return function(_0x2dfaaf){if(!_0x2dfaaf){_0x12c58f[_0x1000('0x18')](0x194);}return _0x2dfaaf;};}function handleError(_0x4508cc,_0xbb3269){_0xbb3269=_0xbb3269||0x1f4;return function(_0x32619c){logger['error'](_0x32619c[_0x1000('0x27')]);if(_0x32619c[_0x1000('0x28')]){delete _0x32619c[_0x1000('0x28')];}_0x4508cc['status'](_0xbb3269)[_0x1000('0x29')](_0x32619c);};}exports[_0x1000('0x2a')]=function(_0x41015e,_0x14f6ae){var _0x365bd5={},_0xfa88ca={},_0x112bef={'count':0x0,'rows':[]};var _0x5d11fe=_[_0x1000('0x2b')](db[_0x1000('0x2c')][_0x1000('0x2d')],function(_0x18d38d){return{'name':_0x18d38d[_0x1000('0x2e')],'type':_0x18d38d[_0x1000('0x2f')]['key']};});_0xfa88ca[_0x1000('0x30')]=_[_0x1000('0x2b')](_0x5d11fe,_0x1000('0x28'));_0xfa88ca['query']=_[_0x1000('0x31')](_0x41015e[_0x1000('0x32')]);_0xfa88ca[_0x1000('0x33')]=_[_0x1000('0x34')](_0xfa88ca['model'],_0xfa88ca[_0x1000('0x32')]);_0x365bd5[_0x1000('0x35')]=_[_0x1000('0x34')](_0xfa88ca[_0x1000('0x30')],qs[_0x1000('0x36')](_0x41015e[_0x1000('0x32')][_0x1000('0x36')]));_0x365bd5[_0x1000('0x35')]=_0x365bd5[_0x1000('0x35')][_0x1000('0x37')]?_0x365bd5[_0x1000('0x35')]:_0xfa88ca[_0x1000('0x30')];if(!_0x41015e['query']['hasOwnProperty'](_0x1000('0x38'))){_0x365bd5[_0x1000('0x1c')]=qs['limit'](_0x41015e[_0x1000('0x32')][_0x1000('0x1c')]);_0x365bd5[_0x1000('0x1b')]=qs['offset'](_0x41015e[_0x1000('0x32')]['offset']);}_0x365bd5[_0x1000('0x39')]=qs[_0x1000('0x3a')](_0x41015e['query']['sort']);_0x365bd5[_0x1000('0x3b')]=qs['filters'](_[_0x1000('0x3c')](_0x41015e[_0x1000('0x32')],_0xfa88ca[_0x1000('0x33')]),_0x5d11fe);if(_0x41015e['query'][_0x1000('0x3d')]){_0x365bd5[_0x1000('0x3b')]=_[_0x1000('0x3e')](_0x365bd5[_0x1000('0x3b')],{'$or':_[_0x1000('0x2b')](_0x5d11fe,function(_0x1fba1b){if(_0x1fba1b['type']!==_0x1000('0x3f')){var _0x65073e={};_0x65073e[_0x1fba1b[_0x1000('0x28')]]={'$like':'%'+_0x41015e[_0x1000('0x32')][_0x1000('0x3d')]+'%'};return _0x65073e;}})});}_0x365bd5=_[_0x1000('0x3e')]({},_0x365bd5,_0x41015e[_0x1000('0x40')]);var _0x53577b={'where':_0x365bd5[_0x1000('0x3b')]};return db[_0x1000('0x2c')][_0x1000('0x1e')](_0x53577b)[_0x1000('0x25')](function(_0x44bd54){_0x112bef[_0x1000('0x1e')]=_0x44bd54;if(_0x41015e['query']['includeAll']){_0x365bd5[_0x1000('0x41')]=[{'all':!![]}];}return db[_0x1000('0x2c')]['findAll'](_0x365bd5);})['then'](function(_0x446127){_0x112bef[_0x1000('0x42')]=_0x446127;return _0x112bef;})[_0x1000('0x25')](respondWithFilteredResult(_0x14f6ae,_0x365bd5))[_0x1000('0x43')](handleError(_0x14f6ae,null));};exports[_0x1000('0x44')]=function(_0x4945c8,_0x2a8135){var _0x5dce88={'raw':![],'where':{'id':_0x4945c8[_0x1000('0x45')]['id']}},_0x1c9beb={};_0x1c9beb['model']=_['keys'](db[_0x1000('0x2c')][_0x1000('0x2d')]);_0x1c9beb['query']=_['keys'](_0x4945c8[_0x1000('0x32')]);_0x1c9beb[_0x1000('0x33')]=_[_0x1000('0x34')](_0x1c9beb['model'],_0x1c9beb[_0x1000('0x32')]);_0x5dce88[_0x1000('0x35')]=_[_0x1000('0x34')](_0x1c9beb['model'],qs[_0x1000('0x36')](_0x4945c8[_0x1000('0x32')]['fields']));_0x5dce88['attributes']=_0x5dce88[_0x1000('0x35')][_0x1000('0x37')]?_0x5dce88[_0x1000('0x35')]:_0x1c9beb[_0x1000('0x30')];if(_0x4945c8[_0x1000('0x32')][_0x1000('0x46')]){_0x5dce88[_0x1000('0x41')]=[{'all':!![]}];}_0x5dce88=_[_0x1000('0x3e')]({},_0x5dce88,_0x4945c8[_0x1000('0x40')]);return db[_0x1000('0x2c')]['find'](_0x5dce88)['then'](handleEntityNotFound(_0x2a8135,null))['then'](respondWithResult(_0x2a8135,null))['catch'](handleError(_0x2a8135,null));};exports[_0x1000('0x47')]=function(_0x1f6532,_0x56eeab){return db[_0x1000('0x2c')][_0x1000('0x47')](_0x1f6532[_0x1000('0x48')],{})[_0x1000('0x25')](respondWithResult(_0x56eeab,0xc9))[_0x1000('0x43')](handleError(_0x56eeab,null));};exports['update']=function(_0x4addfd,_0x5a9d2e){if(_0x4addfd[_0x1000('0x48')]['id']){delete _0x4addfd[_0x1000('0x48')]['id'];}return db[_0x1000('0x2c')]['find']({'where':{'id':_0x4addfd[_0x1000('0x45')]['id']}})[_0x1000('0x25')](handleEntityNotFound(_0x5a9d2e,null))[_0x1000('0x25')](saveUpdates(_0x4addfd[_0x1000('0x48')],null))['then'](respondWithResult(_0x5a9d2e,null))[_0x1000('0x43')](handleError(_0x5a9d2e,null));};exports[_0x1000('0x49')]=function(_0x2cfe53,_0xd6f55c){return db['UserProfileSection']['find']({'where':{'id':_0x2cfe53[_0x1000('0x45')]['id']}})[_0x1000('0x25')](handleEntityNotFound(_0xd6f55c,null))[_0x1000('0x25')](removeEntity(_0xd6f55c,null))[_0x1000('0x43')](handleError(_0xd6f55c,null));};exports[_0x1000('0x4a')]=function(_0x47967c,_0x1e3e5a){return db[_0x1000('0x2c')][_0x1000('0x4a')]()[_0x1000('0x25')](respondWithResult(_0x1e3e5a,null))['catch'](handleError(_0x1e3e5a,null));}; \ No newline at end of file +var _0xf856=['merge','options','includeAll','findAll','rows','catch','show','params','fields','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','undefined','count','offset','status','set','Content-Range','json','apply','save','update','then','destroy','end','error','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','length','nolimit','limit','sort','where','filters','VIRTUAL'];(function(_0x24474c,_0x1704fd){var _0x78da18=function(_0x41c59e){while(--_0x41c59e){_0x24474c['push'](_0x24474c['shift']());}};_0x78da18(++_0x1704fd);}(_0xf856,0xef));var _0x6f85=function(_0x38d4e1,_0x304ee0){_0x38d4e1=_0x38d4e1-0x0;var _0x423606=_0xf856[_0x38d4e1];return _0x423606;};'use strict';var emlformat=require(_0x6f85('0x0'));var rimraf=require(_0x6f85('0x1'));var zipdir=require(_0x6f85('0x2'));var jsonpatch=require(_0x6f85('0x3'));var rp=require(_0x6f85('0x4'));var moment=require(_0x6f85('0x5'));var BPromise=require(_0x6f85('0x6'));var Mustache=require(_0x6f85('0x7'));var util=require(_0x6f85('0x8'));var path=require('path');var sox=require(_0x6f85('0x9'));var csv=require(_0x6f85('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6f85('0xb'));var squel=require('squel');var crypto=require(_0x6f85('0xc'));var jsforce=require(_0x6f85('0xd'));var deskjs=require(_0x6f85('0xe'));var toCsv=require(_0x6f85('0xa'));var querystring=require('querystring');var Papa=require(_0x6f85('0xf'));var Redis=require(_0x6f85('0x10'));var authService=require(_0x6f85('0x11'));var qs=require(_0x6f85('0x12'));var as=require(_0x6f85('0x13'));var hardwareService=require(_0x6f85('0x14'));var logger=require(_0x6f85('0x15'))('api');var utils=require(_0x6f85('0x16'));var config=require(_0x6f85('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6f85('0x18'))['db'];function respondWithStatusCode(_0x2487c4,_0x5bc75e){_0x5bc75e=_0x5bc75e||0xcc;return function(_0xa6bfa7){if(_0xa6bfa7){return _0x2487c4[_0x6f85('0x19')](_0x5bc75e);}return _0x2487c4['status'](_0x5bc75e)['end']();};}function respondWithResult(_0xd9647f,_0x29b938){_0x29b938=_0x29b938||0xc8;return function(_0x187d48){if(_0x187d48){return _0xd9647f['status'](_0x29b938)['json'](_0x187d48);}};}function respondWithFilteredResult(_0x2a53e8,_0x982980){return function(_0x3f2c2c){if(_0x3f2c2c){var _0x1d671c=typeof _0x982980['offset']===_0x6f85('0x1a')&&typeof _0x982980['limit']===_0x6f85('0x1a');var _0x63ddbc=_0x3f2c2c[_0x6f85('0x1b')];var _0x447918=_0x1d671c?0x0:_0x982980['offset'];var _0x316912=_0x1d671c?_0x3f2c2c[_0x6f85('0x1b')]:_0x982980[_0x6f85('0x1c')]+_0x982980['limit'];var _0x955e9e;if(_0x316912>=_0x63ddbc){_0x316912=_0x63ddbc;_0x955e9e=0xc8;}else{_0x955e9e=0xce;}_0x2a53e8[_0x6f85('0x1d')](_0x955e9e);return _0x2a53e8[_0x6f85('0x1e')](_0x6f85('0x1f'),_0x447918+'-'+_0x316912+'/'+_0x63ddbc)[_0x6f85('0x20')](_0x3f2c2c);}return null;};}function patchUpdates(_0x3aa893){return function(_0x168227){try{jsonpatch[_0x6f85('0x21')](_0x168227,_0x3aa893,!![]);}catch(_0x27aaf9){return BPromise['reject'](_0x27aaf9);}return _0x168227[_0x6f85('0x22')]();};}function saveUpdates(_0xe598f8,_0xd6707e){return function(_0x54f603){if(_0x54f603){return _0x54f603[_0x6f85('0x23')](_0xe598f8)[_0x6f85('0x24')](function(_0x573a47){return _0x573a47;});}return null;};}function removeEntity(_0x4043f6,_0x325cc2){return function(_0x28194f){if(_0x28194f){return _0x28194f[_0x6f85('0x25')]()[_0x6f85('0x24')](function(){_0x4043f6['status'](0xcc)[_0x6f85('0x26')]();});}};}function handleEntityNotFound(_0x51daa2,_0x539201){return function(_0x5e601c){if(!_0x5e601c){_0x51daa2[_0x6f85('0x19')](0x194);}return _0x5e601c;};}function handleError(_0x32fe1b,_0x4dc6c0){_0x4dc6c0=_0x4dc6c0||0x1f4;return function(_0x371bc7){logger[_0x6f85('0x27')](_0x371bc7[_0x6f85('0x28')]);if(_0x371bc7[_0x6f85('0x29')]){delete _0x371bc7[_0x6f85('0x29')];}_0x32fe1b[_0x6f85('0x1d')](_0x4dc6c0)[_0x6f85('0x2a')](_0x371bc7);};}exports[_0x6f85('0x2b')]=function(_0x4bb479,_0x190db7){var _0x28ed1d={},_0x25e24f={},_0x3738c1={'count':0x0,'rows':[]};var _0x51d03c=_[_0x6f85('0x2c')](db[_0x6f85('0x2d')][_0x6f85('0x2e')],function(_0x2af209){return{'name':_0x2af209[_0x6f85('0x2f')],'type':_0x2af209[_0x6f85('0x30')]['key']};});_0x25e24f[_0x6f85('0x31')]=_['map'](_0x51d03c,_0x6f85('0x29'));_0x25e24f[_0x6f85('0x32')]=_[_0x6f85('0x33')](_0x4bb479[_0x6f85('0x32')]);_0x25e24f['filters']=_[_0x6f85('0x34')](_0x25e24f[_0x6f85('0x31')],_0x25e24f[_0x6f85('0x32')]);_0x28ed1d[_0x6f85('0x35')]=_[_0x6f85('0x34')](_0x25e24f[_0x6f85('0x31')],qs['fields'](_0x4bb479[_0x6f85('0x32')]['fields']));_0x28ed1d['attributes']=_0x28ed1d['attributes'][_0x6f85('0x36')]?_0x28ed1d[_0x6f85('0x35')]:_0x25e24f[_0x6f85('0x31')];if(!_0x4bb479[_0x6f85('0x32')]['hasOwnProperty'](_0x6f85('0x37'))){_0x28ed1d[_0x6f85('0x38')]=qs['limit'](_0x4bb479[_0x6f85('0x32')][_0x6f85('0x38')]);_0x28ed1d[_0x6f85('0x1c')]=qs[_0x6f85('0x1c')](_0x4bb479[_0x6f85('0x32')][_0x6f85('0x1c')]);}_0x28ed1d['order']=qs[_0x6f85('0x39')](_0x4bb479['query']['sort']);_0x28ed1d[_0x6f85('0x3a')]=qs[_0x6f85('0x3b')](_['pick'](_0x4bb479[_0x6f85('0x32')],_0x25e24f['filters']),_0x51d03c);if(_0x4bb479[_0x6f85('0x32')]['filter']){_0x28ed1d[_0x6f85('0x3a')]=_['merge'](_0x28ed1d[_0x6f85('0x3a')],{'$or':_['map'](_0x51d03c,function(_0x4eb6ad){if(_0x4eb6ad[_0x6f85('0x30')]!==_0x6f85('0x3c')){var _0xae8f25={};_0xae8f25[_0x4eb6ad[_0x6f85('0x29')]]={'$like':'%'+_0x4bb479[_0x6f85('0x32')]['filter']+'%'};return _0xae8f25;}})});}_0x28ed1d=_[_0x6f85('0x3d')]({},_0x28ed1d,_0x4bb479[_0x6f85('0x3e')]);var _0x4c8055={'where':_0x28ed1d['where']};return db[_0x6f85('0x2d')][_0x6f85('0x1b')](_0x4c8055)[_0x6f85('0x24')](function(_0x275aa3){_0x3738c1['count']=_0x275aa3;if(_0x4bb479[_0x6f85('0x32')][_0x6f85('0x3f')]){_0x28ed1d['include']=[{'all':!![]}];}return db[_0x6f85('0x2d')][_0x6f85('0x40')](_0x28ed1d);})[_0x6f85('0x24')](function(_0x23957c){_0x3738c1[_0x6f85('0x41')]=_0x23957c;return _0x3738c1;})[_0x6f85('0x24')](respondWithFilteredResult(_0x190db7,_0x28ed1d))[_0x6f85('0x42')](handleError(_0x190db7,null));};exports[_0x6f85('0x43')]=function(_0x3afeef,_0x13d6e1){var _0x571e22={'raw':![],'where':{'id':_0x3afeef[_0x6f85('0x44')]['id']}},_0x5e9bb4={};_0x5e9bb4[_0x6f85('0x31')]=_['keys'](db['UserProfileSection']['rawAttributes']);_0x5e9bb4['query']=_['keys'](_0x3afeef[_0x6f85('0x32')]);_0x5e9bb4[_0x6f85('0x3b')]=_[_0x6f85('0x34')](_0x5e9bb4[_0x6f85('0x31')],_0x5e9bb4[_0x6f85('0x32')]);_0x571e22['attributes']=_[_0x6f85('0x34')](_0x5e9bb4['model'],qs['fields'](_0x3afeef[_0x6f85('0x32')][_0x6f85('0x45')]));_0x571e22[_0x6f85('0x35')]=_0x571e22[_0x6f85('0x35')][_0x6f85('0x36')]?_0x571e22['attributes']:_0x5e9bb4[_0x6f85('0x31')];if(_0x3afeef[_0x6f85('0x32')][_0x6f85('0x3f')]){_0x571e22[_0x6f85('0x46')]=[{'all':!![]}];}_0x571e22=_[_0x6f85('0x3d')]({},_0x571e22,_0x3afeef[_0x6f85('0x3e')]);return db['UserProfileSection'][_0x6f85('0x47')](_0x571e22)[_0x6f85('0x24')](handleEntityNotFound(_0x13d6e1,null))[_0x6f85('0x24')](respondWithResult(_0x13d6e1,null))[_0x6f85('0x42')](handleError(_0x13d6e1,null));};exports['create']=function(_0x10d279,_0x4fb122){return db[_0x6f85('0x2d')][_0x6f85('0x48')](_0x10d279[_0x6f85('0x49')],{})['then'](respondWithResult(_0x4fb122,0xc9))[_0x6f85('0x42')](handleError(_0x4fb122,null));};exports[_0x6f85('0x23')]=function(_0x448ee4,_0x1339e0){if(_0x448ee4[_0x6f85('0x49')]['id']){delete _0x448ee4['body']['id'];}return db[_0x6f85('0x2d')][_0x6f85('0x47')]({'where':{'id':_0x448ee4['params']['id']}})['then'](handleEntityNotFound(_0x1339e0,null))[_0x6f85('0x24')](saveUpdates(_0x448ee4['body'],null))[_0x6f85('0x24')](respondWithResult(_0x1339e0,null))[_0x6f85('0x42')](handleError(_0x1339e0,null));};exports[_0x6f85('0x25')]=function(_0x5226a9,_0x47b808){return db['UserProfileSection'][_0x6f85('0x47')]({'where':{'id':_0x5226a9[_0x6f85('0x44')]['id']}})[_0x6f85('0x24')](handleEntityNotFound(_0x47b808,null))[_0x6f85('0x24')](removeEntity(_0x47b808,null))['catch'](handleError(_0x47b808,null));};exports[_0x6f85('0x4a')]=function(_0x117508,_0x5aec6c){return db[_0x6f85('0x2d')][_0x6f85('0x4a')]()[_0x6f85('0x24')](respondWithResult(_0x5aec6c,null))[_0x6f85('0x42')](handleError(_0x5aec6c,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index d30f707..bbb2397 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 _0x4a1b=['api','bluebird','request-promise','../../config/environment','./userProfileSection.attributes','exports','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','lodash','util','../../config/logger'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x4a1b,0x7f));var _0xb4a1=function(_0x743701,_0x3e67bb){_0x743701=_0x743701-0x0;var _0x5a141d=_0x4a1b[_0x743701];return _0x5a141d;};'use strict';var _=require(_0xb4a1('0x0'));var util=require(_0xb4a1('0x1'));var logger=require(_0xb4a1('0x2'))(_0xb4a1('0x3'));var moment=require('moment');var BPromise=require(_0xb4a1('0x4'));var rp=require(_0xb4a1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb4a1('0x6'));var attributes=require(_0xb4a1('0x7'));module[_0xb4a1('0x8')]=function(_0x1bc000,_0x4168a1){return _0x1bc000['define'](_0xb4a1('0x9'),attributes,{'tableName':_0xb4a1('0xa'),'paranoid':![],'indexes':[{'name':_0xb4a1('0xb'),'fields':[_0xb4a1('0xc'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x906b=['./userProfileSection.attributes','define','UserProfileSection','user_profile_has_sections','compositeIndex','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x2d2498,_0x26426d){var _0x447a5b=function(_0x2977e8){while(--_0x2977e8){_0x2d2498['push'](_0x2d2498['shift']());}};_0x447a5b(++_0x26426d);}(_0x906b,0x1ef));var _0xb906=function(_0x54defc,_0x627178){_0x54defc=_0x54defc-0x0;var _0x1955d3=_0x906b[_0x54defc];return _0x1955d3;};'use strict';var _=require(_0xb906('0x0'));var util=require(_0xb906('0x1'));var logger=require(_0xb906('0x2'))(_0xb906('0x3'));var moment=require(_0xb906('0x4'));var BPromise=require(_0xb906('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb906('0x6'));var rimraf=require(_0xb906('0x7'));var config=require(_0xb906('0x8'));var attributes=require(_0xb906('0x9'));module['exports']=function(_0x5d8052,_0x42f096){return _0x5d8052[_0xb906('0xa')](_0xb906('0xb'),attributes,{'tableName':_0xb906('0xc'),'paranoid':![],'indexes':[{'name':_0xb906('0xd'),'fields':['sectionId','userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index ae9d579..587c87e 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 _0xe7ab=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5f2da6,_0x5ad591){var _0x1c7e21=function(_0x4ee65e){while(--_0x4ee65e){_0x5f2da6['push'](_0x5f2da6['shift']());}};_0x1c7e21(++_0x5ad591);}(_0xe7ab,0xe7));var _0xbe7a=function(_0x1176dc,_0x4b4ad7){_0x1176dc=_0x1176dc-0x0;var _0x32fa65=_0xe7ab[_0x1176dc];return _0x32fa65;};'use strict';var _=require(_0xbe7a('0x0'));var util=require(_0xbe7a('0x1'));var moment=require(_0xbe7a('0x2'));var BPromise=require(_0xbe7a('0x3'));var rs=require(_0xbe7a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbe7a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbe7a('0x6'))(_0xbe7a('0x7'));var config=require(_0xbe7a('0x8'));var jayson=require(_0xbe7a('0x9'));var client=jayson[_0xbe7a('0xa')][_0xbe7a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x7aefba,_0xdba467,_0x23a7d3){return new BPromise(function(_0x409fb3,_0x51a955){return client[_0xbe7a('0xc')](_0x7aefba,_0x23a7d3)[_0xbe7a('0xd')](function(_0x1f1c70){logger['info'](_0xbe7a('0xe'),_0xdba467,_0xbe7a('0xf'));logger[_0xbe7a('0x10')](_0xbe7a('0x11'),_0xdba467,_0xbe7a('0xf'),JSON[_0xbe7a('0x12')](_0x1f1c70));if(_0x1f1c70[_0xbe7a('0x13')]){if(_0x1f1c70[_0xbe7a('0x13')][_0xbe7a('0x14')]===0x1f4){logger['error']('UserProfileSection,\x20%s,\x20%s',_0xdba467,_0x1f1c70[_0xbe7a('0x13')]['message']);return _0x51a955(_0x1f1c70[_0xbe7a('0x13')][_0xbe7a('0x15')]);}logger[_0xbe7a('0x13')]('UserProfileSection,\x20%s,\x20%s',_0xdba467,_0x1f1c70['error'][_0xbe7a('0x15')]);return _0x409fb3(_0x1f1c70['error'][_0xbe7a('0x15')]);}else{logger['info'](_0xbe7a('0xe'),_0xdba467,_0xbe7a('0xf'));_0x409fb3(_0x1f1c70['result'][_0xbe7a('0x15')]);}})[_0xbe7a('0x16')](function(_0x18330c){logger['error'](_0xbe7a('0xe'),_0xdba467,_0x18330c);_0x51a955(_0x18330c);});});} \ No newline at end of file +var _0xa3eb=['request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserProfileSection,\x20%s,\x20%s'];(function(_0x5e6ebe,_0x373752){var _0x5d80a0=function(_0x145677){while(--_0x145677){_0x5e6ebe['push'](_0x5e6ebe['shift']());}};_0x5d80a0(++_0x373752);}(_0xa3eb,0x93));var _0xba3e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa3eb[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0xba3e('0x0'));var util=require(_0xba3e('0x1'));var moment=require(_0xba3e('0x2'));var BPromise=require(_0xba3e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xba3e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xba3e('0x5'))(_0xba3e('0x6'));var config=require(_0xba3e('0x7'));var jayson=require(_0xba3e('0x8'));var client=jayson[_0xba3e('0x9')][_0xba3e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x499c19,_0x28d96d,_0x47c02b){return new BPromise(function(_0x516adf,_0x534ffd){return client[_0xba3e('0xb')](_0x499c19,_0x47c02b)[_0xba3e('0xc')](function(_0x431fcc){logger['info'](_0xba3e('0xd'),_0x28d96d,_0xba3e('0xe'));logger[_0xba3e('0xf')](_0xba3e('0x10'),_0x28d96d,_0xba3e('0xe'),JSON[_0xba3e('0x11')](_0x431fcc));if(_0x431fcc['error']){if(_0x431fcc[_0xba3e('0x12')]['code']===0x1f4){logger[_0xba3e('0x12')](_0xba3e('0xd'),_0x28d96d,_0x431fcc['error'][_0xba3e('0x13')]);return _0x534ffd(_0x431fcc[_0xba3e('0x12')]['message']);}logger['error'](_0xba3e('0xd'),_0x28d96d,_0x431fcc[_0xba3e('0x12')][_0xba3e('0x13')]);return _0x516adf(_0x431fcc['error']['message']);}else{logger[_0xba3e('0x14')](_0xba3e('0xd'),_0x28d96d,_0xba3e('0xe'));_0x516adf(_0x431fcc[_0xba3e('0x15')][_0xba3e('0x13')]);}})[_0xba3e('0x16')](function(_0x18342e){logger[_0xba3e('0x12')](_0xba3e('0xd'),_0x28d96d,_0x18342e);_0x534ffd(_0x18342e);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index d220bb5..955a6c9 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4ef221,_0x596540){var _0x202ba5=function(_0x78cb05){while(--_0x78cb05){_0x4ef221['push'](_0x4ef221['shift']());}};_0x202ba5(++_0x596540);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x448fbb,_0x38e9cd){var _0xb0b655=function(_0x42b5e4){while(--_0x42b5e4){_0x448fbb['push'](_0x448fbb['shift']());}};_0xb0b655(++_0x38e9cd);}(_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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 9cab259..f51f7f7 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 _0x0637=['sequelize','INTEGER'];(function(_0x5b0680,_0x2c43fb){var _0x1fe35d=function(_0x1a91ea){while(--_0x1a91ea){_0x5b0680['push'](_0x5b0680['shift']());}};_0x1fe35d(++_0x2c43fb);}(_0x0637,0x7e));var _0x7063=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0637[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x7063('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x7063('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x28ff=['exports','INTEGER'];(function(_0x1b91ea,_0x2be1bb){var _0x13625f=function(_0x5d1f75){while(--_0x5d1f75){_0x1b91ea['push'](_0x1b91ea['shift']());}};_0x13625f(++_0x2be1bb);}(_0x28ff,0x7a));var _0xf28f=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x28ff[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require('sequelize');module[_0xf28f('0x0')]={'penalty':{'type':Sequelize[_0xf28f('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 351bd18..5ac803d 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 _0x7524=['../../config/logger','moment','bluebird','rimraf','./userSmsQueue.attributes','exports','define','user_has_sms_queues','util'];(function(_0x1d1bd0,_0x237c21){var _0x54bcac=function(_0x313159){while(--_0x313159){_0x1d1bd0['push'](_0x1d1bd0['shift']());}};_0x54bcac(++_0x237c21);}(_0x7524,0xce));var _0x4752=function(_0x187435,_0x5675cb){_0x187435=_0x187435-0x0;var _0x32b1d1=_0x7524[_0x187435];return _0x32b1d1;};'use strict';var _=require('lodash');var util=require(_0x4752('0x0'));var logger=require(_0x4752('0x1'))('api');var moment=require(_0x4752('0x2'));var BPromise=require(_0x4752('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4752('0x4'));var config=require('../../config/environment');var attributes=require(_0x4752('0x5'));module[_0x4752('0x6')]=function(_0x66a421,_0x55b411){return _0x66a421[_0x4752('0x7')]('UserSmsQueue',attributes,{'tableName':_0x4752('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x50a5=['util','request-promise','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0x50a5,0xd1));var _0x550a=function(_0x52c62f,_0x16b0a5){_0x52c62f=_0x52c62f-0x0;var _0x59d154=_0x50a5[_0x52c62f];return _0x59d154;};'use strict';var _=require(_0x550a('0x0'));var util=require(_0x550a('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x550a('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x550a('0x3'));var config=require(_0x550a('0x4'));var attributes=require(_0x550a('0x5'));module[_0x550a('0x6')]=function(_0x402f66,_0x3b3c29){return _0x402f66[_0x550a('0x7')](_0x550a('0x8'),attributes,{'tableName':_0x550a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 4ef565d..a7de1e9 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 _0x14cb=['http','UserSmsQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x3f07c7,_0x675256){var _0x1c2cd7=function(_0x108d78){while(--_0x108d78){_0x3f07c7['push'](_0x3f07c7['shift']());}};_0x1c2cd7(++_0x675256);}(_0x14cb,0x7c));var _0xb14c=function(_0xce80ee,_0x345599){_0xce80ee=_0xce80ee-0x0;var _0x4fd68d=_0x14cb[_0xce80ee];return _0x4fd68d;};'use strict';var _=require(_0xb14c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb14c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb14c('0x2'));var db=require(_0xb14c('0x3'))['db'];var utils=require(_0xb14c('0x4'));var logger=require(_0xb14c('0x5'))(_0xb14c('0x6'));var config=require('../../config/environment');var jayson=require(_0xb14c('0x7'));var client=jayson[_0xb14c('0x8')][_0xb14c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35069c,_0x271ff2,_0xf69136){return new BPromise(function(_0x5e0011,_0xc8b9cd){return client['request'](_0x35069c,_0xf69136)['then'](function(_0x365ccd){logger['info'](_0xb14c('0xa'),_0x271ff2,'request\x20sent');logger[_0xb14c('0xb')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x271ff2,_0xb14c('0xc'),JSON[_0xb14c('0xd')](_0x365ccd));if(_0x365ccd[_0xb14c('0xe')]){if(_0x365ccd[_0xb14c('0xe')][_0xb14c('0xf')]===0x1f4){logger['error'](_0xb14c('0xa'),_0x271ff2,_0x365ccd['error']['message']);return _0xc8b9cd(_0x365ccd['error'][_0xb14c('0x10')]);}logger[_0xb14c('0xe')](_0xb14c('0xa'),_0x271ff2,_0x365ccd[_0xb14c('0xe')][_0xb14c('0x10')]);return _0x5e0011(_0x365ccd[_0xb14c('0xe')][_0xb14c('0x10')]);}else{logger[_0xb14c('0x11')](_0xb14c('0xa'),_0x271ff2,_0xb14c('0xc'));_0x5e0011(_0x365ccd['result'][_0xb14c('0x10')]);}})[_0xb14c('0x12')](function(_0x552762){logger['error'](_0xb14c('0xa'),_0x271ff2,_0x552762);_0xc8b9cd(_0x552762);});});} \ No newline at end of file +var _0x3c21=['catch','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x11a54c,_0x469134){var _0x182f4d=function(_0x22bafd){while(--_0x22bafd){_0x11a54c['push'](_0x11a54c['shift']());}};_0x182f4d(++_0x469134);}(_0x3c21,0x17b));var _0x13c2=function(_0x494dc8,_0x3b7c8c){_0x494dc8=_0x494dc8-0x0;var _0x1395ed=_0x3c21[_0x494dc8];return _0x1395ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x13c2('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x13c2('0x1'));var db=require(_0x13c2('0x2'))['db'];var utils=require(_0x13c2('0x3'));var logger=require(_0x13c2('0x4'))(_0x13c2('0x5'));var config=require(_0x13c2('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x13c2('0x7')][_0x13c2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5eb998,_0x510718,_0x9f05d6){return new BPromise(function(_0x552136,_0x4a8a66){return client[_0x13c2('0x9')](_0x5eb998,_0x9f05d6)[_0x13c2('0xa')](function(_0x3dbb95){logger[_0x13c2('0xb')](_0x13c2('0xc'),_0x510718,_0x13c2('0xd'));logger['debug'](_0x13c2('0xe'),_0x510718,_0x13c2('0xd'),JSON[_0x13c2('0xf')](_0x3dbb95));if(_0x3dbb95[_0x13c2('0x10')]){if(_0x3dbb95['error'][_0x13c2('0x11')]===0x1f4){logger['error'](_0x13c2('0xc'),_0x510718,_0x3dbb95[_0x13c2('0x10')][_0x13c2('0x12')]);return _0x4a8a66(_0x3dbb95[_0x13c2('0x10')][_0x13c2('0x12')]);}logger[_0x13c2('0x10')](_0x13c2('0xc'),_0x510718,_0x3dbb95[_0x13c2('0x10')]['message']);return _0x552136(_0x3dbb95[_0x13c2('0x10')][_0x13c2('0x12')]);}else{logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x510718,_0x13c2('0xd'));_0x552136(_0x3dbb95[_0x13c2('0x13')]['message']);}})[_0x13c2('0x14')](function(_0x288cc3){logger[_0x13c2('0x10')](_0x13c2('0xc'),_0x510718,_0x288cc3);_0x4a8a66(_0x288cc3);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index cfa4fbd..d79c59b 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 _0x4ebb=['INTEGER','sequelize','exports'];(function(_0x185267,_0x4163e6){var _0x3423f5=function(_0x2871c2){while(--_0x2871c2){_0x185267['push'](_0x185267['shift']());}};_0x3423f5(++_0x4163e6);}(_0x4ebb,0xb2));var _0xb4eb=function(_0x126b55,_0x56bc93){_0x126b55=_0x126b55-0x0;var _0x5f1415=_0x4ebb[_0x126b55];return _0x5f1415;};'use strict';var Sequelize=require(_0xb4eb('0x0'));module[_0xb4eb('0x1')]={'UserId':{'type':Sequelize[_0xb4eb('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xb4eb('0x2')]}}; \ No newline at end of file +var _0x436e=['INTEGER','sequelize','exports'];(function(_0xfc689f,_0x40e569){var _0x12f1af=function(_0x2d7b20){while(--_0x2d7b20){_0xfc689f['push'](_0xfc689f['shift']());}};_0x12f1af(++_0x40e569);}(_0x436e,0x88));var _0xe436=function(_0x14fac6,_0x487864){_0x14fac6=_0x14fac6-0x0;var _0xb3e133=_0x436e[_0x14fac6];return _0xb3e133;};'use strict';var Sequelize=require(_0xe436('0x0'));module[_0xe436('0x1')]={'UserId':{'type':Sequelize[_0xe436('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xe436('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index b8ee52a..1a468c5 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(_0x2d7dde,_0x115332){var _0x3e72f6=function(_0x501661){while(--_0x501661){_0x2d7dde['push'](_0x2d7dde['shift']());}};_0x3e72f6(++_0x115332);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x3ffc04,_0xe085ea){var _0x556146=function(_0x5c98c1){while(--_0x5c98c1){_0x3ffc04['push'](_0x3ffc04['shift']());}};_0x556146(++_0xe085ea);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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 0332547..cbd8a5c 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x37d8e1,_0x349648){var _0x18584c=function(_0x2b2e4d){while(--_0x2b2e4d){_0x37d8e1['push'](_0x37d8e1['shift']());}};_0x18584c(++_0x349648);}(_0x70e0,0x17b));var _0x070e=function(_0x5d3219,_0x32f848){_0x5d3219=_0x5d3219-0x0;var _0x354ed3=_0x70e0[_0x5d3219];return _0x354ed3;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x25ef7d,_0x4aeaef){var _0xa8bf1e=function(_0x1b94cc){while(--_0x1b94cc){_0x25ef7d['push'](_0x25ef7d['shift']());}};_0xa8bf1e(++_0x4aeaef);}(_0xe706,0xa3));var _0x6e70=function(_0x5a184b,_0x457876){_0x5a184b=_0x5a184b-0x0;var _0x713964=_0xe706[_0x5a184b];return _0x713964;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index eb43197..fb93ae0 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 _0xa7eb=['exports','sequelize'];(function(_0x5bc999,_0x25cf39){var _0x135b6d=function(_0x18c8ce){while(--_0x18c8ce){_0x5bc999['push'](_0x5bc999['shift']());}};_0x135b6d(++_0x25cf39);}(_0xa7eb,0x71));var _0xba7e=function(_0x259917,_0x2ca224){_0x259917=_0x259917-0x0;var _0x4536d0=_0xa7eb[_0x259917];return _0x4536d0;};'use strict';var Sequelize=require(_0xba7e('0x0'));module[_0xba7e('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xf87a=['sequelize','exports'];(function(_0x5c4d97,_0x42dc72){var _0x5b4d19=function(_0x62f76a){while(--_0x62f76a){_0x5c4d97['push'](_0x5c4d97['shift']());}};_0x5b4d19(++_0x42dc72);}(_0xf87a,0xf6));var _0xaf87=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xf87a[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0xaf87('0x0'));module[_0xaf87('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 c5f022f..b05d567 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 _0x66cf=['path','../../config/environment','./userVoiceQueue.attributes','define','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x66cf,0x95));var _0xf66c=function(_0x60a21f,_0x5af97b){_0x60a21f=_0x60a21f-0x0;var _0x21776b=_0x66cf[_0x60a21f];return _0x21776b;};'use strict';var _=require(_0xf66c('0x0'));var util=require(_0xf66c('0x1'));var logger=require(_0xf66c('0x2'))(_0xf66c('0x3'));var moment=require(_0xf66c('0x4'));var BPromise=require(_0xf66c('0x5'));var rp=require(_0xf66c('0x6'));var fs=require('fs');var path=require(_0xf66c('0x7'));var rimraf=require('rimraf');var config=require(_0xf66c('0x8'));var attributes=require(_0xf66c('0x9'));module['exports']=function(_0x60dd26,_0x335bfc){return _0x60dd26[_0xf66c('0xa')](_0xf66c('0xb'),attributes,{'tableName':_0xf66c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x471b=['rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x471b,0x133));var _0xb471=function(_0xd7b22,_0x34ebed){_0xd7b22=_0xd7b22-0x0;var _0x3fbb73=_0x471b[_0xd7b22];return _0x3fbb73;};'use strict';var _=require(_0xb471('0x0'));var util=require(_0xb471('0x1'));var logger=require(_0xb471('0x2'))(_0xb471('0x3'));var moment=require(_0xb471('0x4'));var BPromise=require(_0xb471('0x5'));var rp=require(_0xb471('0x6'));var fs=require('fs');var path=require(_0xb471('0x7'));var rimraf=require(_0xb471('0x8'));var config=require(_0xb471('0x9'));var attributes=require(_0xb471('0xa'));module[_0xb471('0xb')]=function(_0x5f2f59,_0x32ef57){return _0x5f2f59[_0xb471('0xc')](_0xb471('0xd'),attributes,{'tableName':_0xb471('0xe'),'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 8e01951..13214e2 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 _0x2390=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','util','moment'];(function(_0x33154d,_0x854047){var _0x3b2f03=function(_0x35f7a6){while(--_0x35f7a6){_0x33154d['push'](_0x33154d['shift']());}};_0x3b2f03(++_0x854047);}(_0x2390,0x152));var _0x0239=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x2390[_0x187ee1];return _0x388160;};'use strict';var _=require('lodash');var util=require(_0x0239('0x0'));var moment=require(_0x0239('0x1'));var BPromise=require(_0x0239('0x2'));var rs=require(_0x0239('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0239('0x4'))['db'];var utils=require(_0x0239('0x5'));var logger=require('../../config/logger')(_0x0239('0x6'));var config=require('../../config/environment');var jayson=require(_0x0239('0x7'));var client=jayson[_0x0239('0x8')][_0x0239('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7d6c98,_0x354aed,_0x14b709){return new BPromise(function(_0x37acf9,_0x361c95){return client[_0x0239('0xa')](_0x7d6c98,_0x14b709)[_0x0239('0xb')](function(_0x1cf007){logger[_0x0239('0xc')](_0x0239('0xd'),_0x354aed,_0x0239('0xe'));logger[_0x0239('0xf')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x354aed,_0x0239('0xe'),JSON['stringify'](_0x1cf007));if(_0x1cf007[_0x0239('0x10')]){if(_0x1cf007['error'][_0x0239('0x11')]===0x1f4){logger[_0x0239('0x10')]('UserVoiceQueue,\x20%s,\x20%s',_0x354aed,_0x1cf007[_0x0239('0x10')][_0x0239('0x12')]);return _0x361c95(_0x1cf007[_0x0239('0x10')][_0x0239('0x12')]);}logger[_0x0239('0x10')](_0x0239('0xd'),_0x354aed,_0x1cf007[_0x0239('0x10')][_0x0239('0x12')]);return _0x37acf9(_0x1cf007[_0x0239('0x10')][_0x0239('0x12')]);}else{logger[_0x0239('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x354aed,_0x0239('0xe'));_0x37acf9(_0x1cf007['result'][_0x0239('0x12')]);}})[_0x0239('0x13')](function(_0x5734e7){logger[_0x0239('0x10')](_0x0239('0xd'),_0x354aed,_0x5734e7);_0x361c95(_0x5734e7);});});} \ No newline at end of file +var _0xc7d6=['http','request','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x20c110,_0xee227e){var _0x2497ac=function(_0x2cef5f){while(--_0x2cef5f){_0x20c110['push'](_0x20c110['shift']());}};_0x2497ac(++_0xee227e);}(_0xc7d6,0x1b0));var _0x6c7d=function(_0x3fdc6c,_0x254cb1){_0x3fdc6c=_0x3fdc6c-0x0;var _0x59f304=_0xc7d6[_0x3fdc6c];return _0x59f304;};'use strict';var _=require('lodash');var util=require(_0x6c7d('0x0'));var moment=require('moment');var BPromise=require(_0x6c7d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6c7d('0x2'));var db=require(_0x6c7d('0x3'))['db'];var utils=require(_0x6c7d('0x4'));var logger=require(_0x6c7d('0x5'))('rpc');var config=require(_0x6c7d('0x6'));var jayson=require(_0x6c7d('0x7'));var client=jayson[_0x6c7d('0x8')][_0x6c7d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x86ea7e,_0x4bfec3,_0x164d2a){return new BPromise(function(_0x47d33c,_0x3c1c91){return client[_0x6c7d('0xa')](_0x86ea7e,_0x164d2a)['then'](function(_0x13ec7e){logger[_0x6c7d('0xb')](_0x6c7d('0xc'),_0x4bfec3,_0x6c7d('0xd'));logger[_0x6c7d('0xe')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x4bfec3,_0x6c7d('0xd'),JSON[_0x6c7d('0xf')](_0x13ec7e));if(_0x13ec7e[_0x6c7d('0x10')]){if(_0x13ec7e['error'][_0x6c7d('0x11')]===0x1f4){logger[_0x6c7d('0x10')](_0x6c7d('0xc'),_0x4bfec3,_0x13ec7e[_0x6c7d('0x10')][_0x6c7d('0x12')]);return _0x3c1c91(_0x13ec7e['error'][_0x6c7d('0x12')]);}logger[_0x6c7d('0x10')](_0x6c7d('0xc'),_0x4bfec3,_0x13ec7e[_0x6c7d('0x10')][_0x6c7d('0x12')]);return _0x47d33c(_0x13ec7e['error'][_0x6c7d('0x12')]);}else{logger[_0x6c7d('0xb')](_0x6c7d('0xc'),_0x4bfec3,_0x6c7d('0xd'));_0x47d33c(_0x13ec7e[_0x6c7d('0x13')][_0x6c7d('0x12')]);}})[_0x6c7d('0x14')](function(_0x46862e){logger[_0x6c7d('0x10')]('UserVoiceQueue,\x20%s,\x20%s',_0x4bfec3,_0x46862e);_0x3c1c91(_0x46862e);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 4916e3a..c26a2bf 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x163b24,_0x57dbc2){var _0x95087b=function(_0x39d161){while(--_0x39d161){_0x163b24['push'](_0x163b24['shift']());}};_0x95087b(++_0x57dbc2);}(_0x70e0,0x17b));var _0x070e=function(_0x5ed338,_0x26a047){_0x5ed338=_0x5ed338-0x0;var _0x3b09d1=_0x70e0[_0x5ed338];return _0x3b09d1;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x372bff,_0x2bb900){var _0x25b72b=function(_0x37e576){while(--_0x37e576){_0x372bff['push'](_0x372bff['shift']());}};_0x25b72b(++_0x2bb900);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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 723fe9f..9cf84f4 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 _0xbf3d=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x2131f9,_0x3ab36f){var _0x31bbb1=function(_0x15fcdf){while(--_0x15fcdf){_0x2131f9['push'](_0x2131f9['shift']());}};_0x31bbb1(++_0x3ab36f);}(_0xbf3d,0xc5));var _0xdbf3=function(_0x254803,_0x443ed9){_0x254803=_0x254803-0x0;var _0x53351e=_0xbf3d[_0x254803];return _0x53351e;};'use strict';var Sequelize=require(_0xdbf3('0x0'));module[_0xdbf3('0x1')]={'uniqueid':{'type':Sequelize[_0xdbf3('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xdbf3('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0xdbf3('0x3')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0xdbf3('0x4')],'allowNull':![],'unique':_0xdbf3('0x5'),'comment':_0xdbf3('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0xdbf3('0x4')],'allowNull':![],'unique':_0xdbf3('0x5'),'comment':_0xdbf3('0x3')},'penalty':{'type':Sequelize[_0xdbf3('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0xdbf3('0x2')](0xb),'defaultValue':0x0,'comment':_0xdbf3('0x3')}}; \ No newline at end of file +var _0x3658=['STRING','queue_interface','sequelize','INTEGER','Required\x20by\x20Asterisk'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x3658,0x133));var _0x8365=function(_0x2ecb38,_0x520902){_0x2ecb38=_0x2ecb38-0x0;var _0x5e52ab=_0x3658[_0x2ecb38];return _0x5e52ab;};'use strict';var Sequelize=require(_0x8365('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x8365('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x8365('0x2')},'membername':{'type':Sequelize[_0x8365('0x3')],'allowNull':![],'comment':_0x8365('0x2')},'UserId':{'type':Sequelize[_0x8365('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8365('0x4'),'comment':_0x8365('0x2')},'VoiceQueueId':{'type':Sequelize[_0x8365('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x8365('0x3')],'allowNull':![],'unique':_0x8365('0x4'),'comment':_0x8365('0x2')},'penalty':{'type':Sequelize[_0x8365('0x1')](0xb),'defaultValue':0x0,'comment':_0x8365('0x2')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x8365('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 35c3ddf..656a386 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 _0x22e5=['emit','hook','exports','setMaxListeners','update','remove'];(function(_0x8c93f6,_0x2bff97){var _0x4c6aba=function(_0x19ee88){while(--_0x19ee88){_0x8c93f6['push'](_0x8c93f6['shift']());}};_0x4c6aba(++_0x2bff97);}(_0x22e5,0x189));var _0x522e=function(_0x38f939,_0x32a8bf){_0x38f939=_0x38f939-0x0;var _0x113693=_0x22e5[_0x38f939];return _0x113693;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require('../../mysqldb')['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x522e('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':_0x522e('0x1'),'afterDestroy':_0x522e('0x2')};function emitEvent(_0x42a2dd){return function(_0x502229,_0x589434,_0x592a7b){UserVoiceQueueRtEvents['emit'](_0x42a2dd+':'+_0x502229['id'],_0x502229);UserVoiceQueueRtEvents[_0x522e('0x3')](_0x42a2dd,_0x502229);_0x592a7b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x522e('0x4')](e,emitEvent(event));}}module[_0x522e('0x5')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xb0ff=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners'];(function(_0x440a5b,_0x275d9d){var _0x979b76=function(_0x3e3878){while(--_0x3e3878){_0x440a5b['push'](_0x440a5b['shift']());}};_0x979b76(++_0x275d9d);}(_0xb0ff,0x1b4));var _0xfb0f=function(_0x65899e,_0x4d725c){_0x65899e=_0x65899e-0x0;var _0x428c87=_0xb0ff[_0x65899e];return _0x428c87;};'use strict';var EventEmitter=require(_0xfb0f('0x0'));var UserVoiceQueueRt=require(_0xfb0f('0x1'))['db'][_0xfb0f('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xfb0f('0x3')](0x0);var events={'afterCreate':_0xfb0f('0x4'),'afterUpdate':_0xfb0f('0x5'),'afterDestroy':_0xfb0f('0x6')};function emitEvent(_0x1990e1){return function(_0x16f209,_0x1be24e,_0x2137b0){UserVoiceQueueRtEvents['emit'](_0x1990e1+':'+_0x16f209['id'],_0x16f209);UserVoiceQueueRtEvents[_0xfb0f('0x7')](_0x1990e1,_0x16f209);_0x2137b0(null);};}for(var e in events){if(events[_0xfb0f('0x8')](e)){var event=events[e];UserVoiceQueueRt[_0xfb0f('0x9')](e,emitEvent(event));}}module[_0xfb0f('0xa')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index fb449f9..c504e55 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 _0x9068=['define','user_has_voice_queues_rt','util','api','moment','bluebird','rimraf'];(function(_0x197a7a,_0x4b9054){var _0x386cb6=function(_0xa32b1b){while(--_0xa32b1b){_0x197a7a['push'](_0x197a7a['shift']());}};_0x386cb6(++_0x4b9054);}(_0x9068,0x113));var _0x8906=function(_0x302da4,_0x5d3076){_0x302da4=_0x302da4-0x0;var _0x5c152d=_0x9068[_0x302da4];return _0x5c152d;};'use strict';var _=require('lodash');var util=require(_0x8906('0x0'));var logger=require('../../config/logger')(_0x8906('0x1'));var moment=require(_0x8906('0x2'));var BPromise=require(_0x8906('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8906('0x4'));var config=require('../../config/environment');var attributes=require('./userVoiceQueueRt.attributes');module['exports']=function(_0x5964d1,_0x239f62){return _0x5964d1[_0x8906('0x5')]('UserVoiceQueueRt',attributes,{'tableName':_0x8906('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd476=['path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','api','moment','bluebird'];(function(_0x4fb0fa,_0x32c64a){var _0x330041=function(_0x1ca639){while(--_0x1ca639){_0x4fb0fa['push'](_0x4fb0fa['shift']());}};_0x330041(++_0x32c64a);}(_0xd476,0xf9));var _0x6d47=function(_0x3d314e,_0x737e92){_0x3d314e=_0x3d314e-0x0;var _0x20bca1=_0xd476[_0x3d314e];return _0x20bca1;};'use strict';var _=require(_0x6d47('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6d47('0x1'));var moment=require(_0x6d47('0x2'));var BPromise=require(_0x6d47('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6d47('0x4'));var rimraf=require(_0x6d47('0x5'));var config=require(_0x6d47('0x6'));var attributes=require(_0x6d47('0x7'));module['exports']=function(_0x1c3515,_0x2fde96){return _0x1c3515[_0x6d47('0x8')](_0x6d47('0x9'),attributes,{'tableName':_0x6d47('0xa'),'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 a6ada9f..b51aa70 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 _0x9eeb=['UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','stringify','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','http','redis','defaults','localhost','register','request','then'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x9eeb,0x7c));var _0xb9ee=function(_0x5aa00e,_0x3d2e7f){_0x5aa00e=_0x5aa00e-0x0;var _0x966fa6=_0x9eeb[_0x5aa00e];return _0x966fa6;};'use strict';var _=require(_0xb9ee('0x0'));var util=require(_0xb9ee('0x1'));var moment=require(_0xb9ee('0x2'));var BPromise=require(_0xb9ee('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb9ee('0x4'));var db=require(_0xb9ee('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb9ee('0x6'));var config=require('../../config/environment');var jayson=require(_0xb9ee('0x7'));var client=jayson[_0xb9ee('0x8')][_0xb9ee('0x9')]({'port':0x232a});config[_0xb9ee('0xa')]=_[_0xb9ee('0xb')](config[_0xb9ee('0xa')],{'host':_0xb9ee('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./userVoiceQueueRt.socket')[_0xb9ee('0xd')](socket);function respondWithRpcPromise(_0xa256a,_0x235941,_0x11108b){return new BPromise(function(_0x30d6e6,_0x4f3a69){return client[_0xb9ee('0xe')](_0xa256a,_0x11108b)[_0xb9ee('0xf')](function(_0x168b5c){logger['info'](_0xb9ee('0x10'),_0x235941,_0xb9ee('0x11'));logger[_0xb9ee('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x235941,'request\x20sent',JSON['stringify'](_0x168b5c));if(_0x168b5c[_0xb9ee('0x13')]){if(_0x168b5c[_0xb9ee('0x13')][_0xb9ee('0x14')]===0x1f4){logger[_0xb9ee('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x235941,_0x168b5c[_0xb9ee('0x13')][_0xb9ee('0x15')]);return _0x4f3a69(_0x168b5c[_0xb9ee('0x13')][_0xb9ee('0x15')]);}logger[_0xb9ee('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x235941,_0x168b5c[_0xb9ee('0x13')][_0xb9ee('0x15')]);return _0x30d6e6(_0x168b5c['error'][_0xb9ee('0x15')]);}else{logger[_0xb9ee('0x16')](_0xb9ee('0x10'),_0x235941,_0xb9ee('0x11'));_0x30d6e6(_0x168b5c[_0xb9ee('0x17')][_0xb9ee('0x15')]);}})['catch'](function(_0x3715de){logger['error'](_0xb9ee('0x10'),_0x235941,_0x3715de);_0x4f3a69(_0x3715de);});});}exports[_0xb9ee('0x18')]=function(_0x26e119){var _0x5968df=this;return new Promise(function(_0x5c3eb3,_0x2e9653){return db[_0xb9ee('0x19')]['findAll']({'raw':_0x26e119[_0xb9ee('0x1a')]?_0x26e119['options'][_0xb9ee('0x1b')]===undefined?!![]:![]:!![],'where':_0x26e119[_0xb9ee('0x1a')]?_0x26e119[_0xb9ee('0x1a')][_0xb9ee('0x1c')]||null:null,'attributes':[[db[_0xb9ee('0x1d')]['fn'](_0xb9ee('0x1e'),db[_0xb9ee('0x1d')]['fn']('IF',db[_0xb9ee('0x1d')][_0xb9ee('0x1f')](_0xb9ee('0x20')))),'outboundQueuePauses']]})[_0xb9ee('0xf')](function(_0x278340){logger[_0xb9ee('0x16')](_0xb9ee('0x18'),_0x26e119);logger[_0xb9ee('0x12')](_0xb9ee('0x18'),_0x26e119,JSON[_0xb9ee('0x21')](_0x278340));_0x5c3eb3(_0x278340);})[_0xb9ee('0x22')](function(_0x47068a){logger[_0xb9ee('0x13')]('GetVoiceQueueRtPauses',_0x47068a[_0xb9ee('0x15')],_0x26e119);_0x2e9653(_0x5968df['error'](0x1f4,_0x47068a[_0xb9ee('0x15')]));});});}; \ No newline at end of file +var _0x5d8b=['outboundQueuePauses','stringify','lodash','util','bluebird','randomstring','ioredis','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null'];(function(_0x18307e,_0x1898e8){var _0x24186b=function(_0x5ee12b){while(--_0x5ee12b){_0x18307e['push'](_0x18307e['shift']());}};_0x24186b(++_0x1898e8);}(_0x5d8b,0x1b2));var _0xb5d8=function(_0x35e384,_0x51501d){_0x35e384=_0x35e384-0x0;var _0x606b73=_0x5d8b[_0x35e384];return _0x606b73;};'use strict';var _=require(_0xb5d8('0x0'));var util=require(_0xb5d8('0x1'));var moment=require('moment');var BPromise=require(_0xb5d8('0x2'));var rs=require(_0xb5d8('0x3'));var fs=require('fs');var Redis=require(_0xb5d8('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb5d8('0x5'));var config=require(_0xb5d8('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb5d8('0x7')][_0xb5d8('0x8')]({'port':0x232a});config[_0xb5d8('0x9')]=_[_0xb5d8('0xa')](config[_0xb5d8('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xb5d8('0xb'))(new Redis(config['redis']));require(_0xb5d8('0xc'))[_0xb5d8('0xd')](socket);function respondWithRpcPromise(_0x5692af,_0x2e9969,_0x383185){return new BPromise(function(_0x5b5f32,_0x58db4d){return client[_0xb5d8('0xe')](_0x5692af,_0x383185)[_0xb5d8('0xf')](function(_0x4795e7){logger[_0xb5d8('0x10')](_0xb5d8('0x11'),_0x2e9969,_0xb5d8('0x12'));logger[_0xb5d8('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x2e9969,_0xb5d8('0x12'),JSON['stringify'](_0x4795e7));if(_0x4795e7['error']){if(_0x4795e7[_0xb5d8('0x14')][_0xb5d8('0x15')]===0x1f4){logger[_0xb5d8('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x2e9969,_0x4795e7[_0xb5d8('0x14')][_0xb5d8('0x16')]);return _0x58db4d(_0x4795e7[_0xb5d8('0x14')]['message']);}logger[_0xb5d8('0x14')](_0xb5d8('0x11'),_0x2e9969,_0x4795e7[_0xb5d8('0x14')][_0xb5d8('0x16')]);return _0x5b5f32(_0x4795e7[_0xb5d8('0x14')]['message']);}else{logger[_0xb5d8('0x10')](_0xb5d8('0x11'),_0x2e9969,_0xb5d8('0x12'));_0x5b5f32(_0x4795e7[_0xb5d8('0x17')][_0xb5d8('0x16')]);}})[_0xb5d8('0x18')](function(_0x2a3c59){logger[_0xb5d8('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x2e9969,_0x2a3c59);_0x58db4d(_0x2a3c59);});});}exports[_0xb5d8('0x19')]=function(_0x454f0b){var _0x219989=this;return new Promise(function(_0x41729c,_0x34fba0){return db[_0xb5d8('0x1a')][_0xb5d8('0x1b')]({'raw':_0x454f0b[_0xb5d8('0x1c')]?_0x454f0b[_0xb5d8('0x1c')][_0xb5d8('0x1d')]===undefined?!![]:![]:!![],'where':_0x454f0b[_0xb5d8('0x1c')]?_0x454f0b[_0xb5d8('0x1c')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0xb5d8('0x1e'),db[_0xb5d8('0x1f')]['fn']('IF',db['sequelize'][_0xb5d8('0x20')](_0xb5d8('0x21')))),_0xb5d8('0x22')]]})[_0xb5d8('0xf')](function(_0xc11b59){logger['info'](_0xb5d8('0x19'),_0x454f0b);logger['debug'](_0xb5d8('0x19'),_0x454f0b,JSON[_0xb5d8('0x23')](_0xc11b59));_0x41729c(_0xc11b59);})[_0xb5d8('0x18')](function(_0x2b2857){logger['error'](_0xb5d8('0x19'),_0x2b2857[_0xb5d8('0x16')],_0x454f0b);_0x34fba0(_0x219989['error'](0x1f4,_0x2b2857[_0xb5d8('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 5b3f8e4..ca781cf 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 _0x31af=['remove','emit','removeListener','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save'];(function(_0x541de5,_0x19a192){var _0x578514=function(_0x249022){while(--_0x249022){_0x541de5['push'](_0x541de5['shift']());}};_0x578514(++_0x19a192);}(_0x31af,0xde));var _0xf31a=function(_0x3fe7a7,_0x11e498){_0x3fe7a7=_0x3fe7a7-0x0;var _0x2cec17=_0x31af[_0x3fe7a7];return _0x2cec17;};'use strict';var UserVoiceQueueRtEvents=require(_0xf31a('0x0'));var events=[_0xf31a('0x1'),_0xf31a('0x2'),'update'];function createListener(_0x5f5639,_0x4596f6){return function(_0x4a8ef1){_0x4596f6[_0xf31a('0x3')](_0x5f5639,_0x4a8ef1);};}function removeListener(_0x1853d7,_0x820362){return function(){UserVoiceQueueRtEvents[_0xf31a('0x4')](_0x1853d7,_0x820362);};}exports['register']=function(_0x8d7853){for(var _0x209fcc=0x0,_0x405926=events[_0xf31a('0x5')];_0x209fcc<_0x405926;_0x209fcc++){var _0x47b7a1=events[_0x209fcc];var _0x31f8e7=createListener(_0xf31a('0x6')+_0x47b7a1,_0x8d7853);UserVoiceQueueRtEvents['on'](_0x47b7a1,_0x31f8e7);}}; \ No newline at end of file +var _0x1ffe=['register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit','removeListener'];(function(_0x207fa6,_0x54adff){var _0x5e2563=function(_0x51e76b){while(--_0x51e76b){_0x207fa6['push'](_0x207fa6['shift']());}};_0x5e2563(++_0x54adff);}(_0x1ffe,0xa5));var _0xe1ff=function(_0x105a89,_0x3c1d74){_0x105a89=_0x105a89-0x0;var _0x377bf8=_0x1ffe[_0x105a89];return _0x377bf8;};'use strict';var UserVoiceQueueRtEvents=require(_0xe1ff('0x0'));var events=[_0xe1ff('0x1'),_0xe1ff('0x2'),_0xe1ff('0x3')];function createListener(_0x118ffc,_0x32ea02){return function(_0xbfcf6b){_0x32ea02[_0xe1ff('0x4')](_0x118ffc,_0xbfcf6b);};}function removeListener(_0x77b687,_0xceabbd){return function(){UserVoiceQueueRtEvents[_0xe1ff('0x5')](_0x77b687,_0xceabbd);};}exports[_0xe1ff('0x6')]=function(_0x54f710){for(var _0x4bd010=0x0,_0x40fb3a=events[_0xe1ff('0x7')];_0x4bd010<_0x40fb3a;_0x4bd010++){var _0x20d288=events[_0x4bd010];var _0x283152=createListener(_0xe1ff('0x8')+_0x20d288,_0x54f710);UserVoiceQueueRtEvents['on'](_0x20d288,_0x283152);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 04344c4..5e18285 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3d7a63,_0x41e59b){var _0x1b4435=function(_0xb6959b){while(--_0xb6959b){_0x3d7a63['push'](_0x3d7a63['shift']());}};_0x1b4435(++_0x41e59b);}(_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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x7ad661,_0x1e4efa){var _0x363e14=function(_0x507439){while(--_0x507439){_0x7ad661['push'](_0x7ad661['shift']());}};_0x363e14(++_0x1e4efa);}(_0x9c44,0x178));var _0x49c4=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x9c44[_0x45d55e];return _0x29812a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index a846404..797a301 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 _0xed3e=['INTEGER','sequelize','exports'];(function(_0x46390e,_0x39d20f){var _0x4db91c=function(_0x2bd91e){while(--_0x2bd91e){_0x46390e['push'](_0x46390e['shift']());}};_0x4db91c(++_0x39d20f);}(_0xed3e,0xe8));var _0xeed3=function(_0x44d456,_0x10b1c9){_0x44d456=_0x44d456-0x0;var _0x5eca30=_0xed3e[_0x44d456];return _0x5eca30;};'use strict';var Sequelize=require(_0xeed3('0x0'));module[_0xeed3('0x1')]={'penalty':{'type':Sequelize[_0xeed3('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4485=['exports','INTEGER'];(function(_0x2b8b4d,_0x833705){var _0x38150e=function(_0x484130){while(--_0x484130){_0x2b8b4d['push'](_0x2b8b4d['shift']());}};_0x38150e(++_0x833705);}(_0x4485,0x1ac));var _0x5448=function(_0x586fa2,_0x1a45bc){_0x586fa2=_0x586fa2-0x0;var _0x515be9=_0x4485[_0x586fa2];return _0x515be9;};'use strict';var Sequelize=require('sequelize');module[_0x5448('0x0')]={'penalty':{'type':Sequelize[_0x5448('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 5eab73a..5cc26e5 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 _0x4d20=['UserWhatsappQueue','util','../../config/logger','api','moment','path','../../config/environment','./userWhatsappQueue.attributes','exports','define'];(function(_0x30ff34,_0x391498){var _0x168e9b=function(_0x4dd145){while(--_0x4dd145){_0x30ff34['push'](_0x30ff34['shift']());}};_0x168e9b(++_0x391498);}(_0x4d20,0x155));var _0x04d2=function(_0x532b2c,_0x14e660){_0x532b2c=_0x532b2c-0x0;var _0x26f14=_0x4d20[_0x532b2c];return _0x26f14;};'use strict';var _=require('lodash');var util=require(_0x04d2('0x0'));var logger=require(_0x04d2('0x1'))(_0x04d2('0x2'));var moment=require(_0x04d2('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x04d2('0x4'));var rimraf=require('rimraf');var config=require(_0x04d2('0x5'));var attributes=require(_0x04d2('0x6'));module[_0x04d2('0x7')]=function(_0x28e2c4,_0x17d011){return _0x28e2c4[_0x04d2('0x8')](_0x04d2('0x9'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea58=['./userWhatsappQueue.attributes','exports','define','user_has_whatsapp_queues','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4b9d59,_0x910c53){var _0x2426ba=function(_0x25bae3){while(--_0x25bae3){_0x4b9d59['push'](_0x4b9d59['shift']());}};_0x2426ba(++_0x910c53);}(_0xea58,0x101));var _0x8ea5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xea58[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8ea5('0x0'));var util=require(_0x8ea5('0x1'));var logger=require('../../config/logger')(_0x8ea5('0x2'));var moment=require('moment');var BPromise=require(_0x8ea5('0x3'));var rp=require(_0x8ea5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8ea5('0x5'));var config=require(_0x8ea5('0x6'));var attributes=require(_0x8ea5('0x7'));module[_0x8ea5('0x8')]=function(_0x15772e,_0x1e4282){return _0x15772e[_0x8ea5('0x9')]('UserWhatsappQueue',attributes,{'tableName':_0x8ea5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 22cd2d8..5876e07 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 _0xe02f=['../../config/logger','rpc','jayson/promise','client','http','request','then','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x199930,_0x53443e){var _0x22005a=function(_0x4f6ecc){while(--_0x4f6ecc){_0x199930['push'](_0x199930['shift']());}};_0x22005a(++_0x53443e);}(_0xe02f,0x124));var _0xfe02=function(_0x2551dd,_0x5ba066){_0x2551dd=_0x2551dd-0x0;var _0x905704=_0xe02f[_0x2551dd];return _0x905704;};'use strict';var _=require(_0xfe02('0x0'));var util=require(_0xfe02('0x1'));var moment=require(_0xfe02('0x2'));var BPromise=require(_0xfe02('0x3'));var rs=require(_0xfe02('0x4'));var fs=require('fs');var Redis=require(_0xfe02('0x5'));var db=require(_0xfe02('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xfe02('0x7'))(_0xfe02('0x8'));var config=require('../../config/environment');var jayson=require(_0xfe02('0x9'));var client=jayson[_0xfe02('0xa')][_0xfe02('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x222b95,_0xb4d74c,_0x5a8d48){return new BPromise(function(_0x32d624,_0x2f4d92){return client[_0xfe02('0xc')](_0x222b95,_0x5a8d48)[_0xfe02('0xd')](function(_0x15f427){logger['info'](_0xfe02('0xe'),_0xb4d74c,_0xfe02('0xf'));logger['debug'](_0xfe02('0x10'),_0xb4d74c,_0xfe02('0xf'),JSON[_0xfe02('0x11')](_0x15f427));if(_0x15f427[_0xfe02('0x12')]){if(_0x15f427[_0xfe02('0x12')][_0xfe02('0x13')]===0x1f4){logger[_0xfe02('0x12')](_0xfe02('0xe'),_0xb4d74c,_0x15f427[_0xfe02('0x12')][_0xfe02('0x14')]);return _0x2f4d92(_0x15f427[_0xfe02('0x12')][_0xfe02('0x14')]);}logger[_0xfe02('0x12')](_0xfe02('0xe'),_0xb4d74c,_0x15f427[_0xfe02('0x12')][_0xfe02('0x14')]);return _0x32d624(_0x15f427[_0xfe02('0x12')][_0xfe02('0x14')]);}else{logger[_0xfe02('0x15')](_0xfe02('0xe'),_0xb4d74c,'request\x20sent');_0x32d624(_0x15f427['result'][_0xfe02('0x14')]);}})[_0xfe02('0x16')](function(_0xf5d1e3){logger[_0xfe02('0x12')](_0xfe02('0xe'),_0xb4d74c,_0xf5d1e3);_0x2f4d92(_0xf5d1e3);});});} \ No newline at end of file +var _0x02e7=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','http','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xe828e8,_0x2b34ac){var _0x4c1cce=function(_0x1a0b99){while(--_0x1a0b99){_0xe828e8['push'](_0xe828e8['shift']());}};_0x4c1cce(++_0x2b34ac);}(_0x02e7,0x97));var _0x702e=function(_0x10f626,_0x568cb9){_0x10f626=_0x10f626-0x0;var _0x307b1f=_0x02e7[_0x10f626];return _0x307b1f;};'use strict';var _=require(_0x702e('0x0'));var util=require(_0x702e('0x1'));var moment=require(_0x702e('0x2'));var BPromise=require(_0x702e('0x3'));var rs=require(_0x702e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x702e('0x5'))('rpc');var config=require(_0x702e('0x6'));var jayson=require(_0x702e('0x7'));var client=jayson['client'][_0x702e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xa04225,_0x511bea,_0x3ab071){return new BPromise(function(_0x56f75d,_0xf73152){return client['request'](_0xa04225,_0x3ab071)[_0x702e('0x9')](function(_0x4d8168){logger[_0x702e('0xa')](_0x702e('0xb'),_0x511bea,_0x702e('0xc'));logger[_0x702e('0xd')](_0x702e('0xe'),_0x511bea,_0x702e('0xc'),JSON[_0x702e('0xf')](_0x4d8168));if(_0x4d8168['error']){if(_0x4d8168[_0x702e('0x10')][_0x702e('0x11')]===0x1f4){logger[_0x702e('0x10')](_0x702e('0xb'),_0x511bea,_0x4d8168['error'][_0x702e('0x12')]);return _0xf73152(_0x4d8168['error'][_0x702e('0x12')]);}logger['error'](_0x702e('0xb'),_0x511bea,_0x4d8168['error']['message']);return _0x56f75d(_0x4d8168[_0x702e('0x10')][_0x702e('0x12')]);}else{logger[_0x702e('0xa')](_0x702e('0xb'),_0x511bea,_0x702e('0xc'));_0x56f75d(_0x4d8168[_0x702e('0x13')][_0x702e('0x12')]);}})[_0x702e('0x14')](function(_0x1afc60){logger[_0x702e('0x10')](_0x702e('0xb'),_0x511bea,_0x1afc60);_0xf73152(_0x1afc60);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 500208c..0e526e6 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 _0x3cd1=['/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./variable.controller','get','isAuthenticated'];(function(_0x3340fa,_0x54eae8){var _0x309e22=function(_0x1095ff){while(--_0x1095ff){_0x3340fa['push'](_0x3340fa['shift']());}};_0x309e22(++_0x54eae8);}(_0x3cd1,0x112));var _0x13cd=function(_0x52f316,_0x53cbc2){_0x52f316=_0x52f316-0x0;var _0x344ac9=_0x3cd1[_0x52f316];return _0x344ac9;};'use strict';var multer=require('multer');var util=require(_0x13cd('0x0'));var path=require(_0x13cd('0x1'));var timeout=require(_0x13cd('0x2'));var express=require(_0x13cd('0x3'));var router=express[_0x13cd('0x4')]();var fs_extra=require(_0x13cd('0x5'));var auth=require(_0x13cd('0x6'));var interaction=require(_0x13cd('0x7'));var config=require('../../config/environment');var controller=require(_0x13cd('0x8'));router[_0x13cd('0x9')]('/',auth[_0x13cd('0xa')](),controller['index']);router['get'](_0x13cd('0xb'),auth[_0x13cd('0xa')](),controller[_0x13cd('0xc')]);router[_0x13cd('0xd')]('/',auth['isAuthenticated'](),controller[_0x13cd('0xe')]);router[_0x13cd('0xf')](_0x13cd('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x13cd('0x10')](_0x13cd('0xb'),auth[_0x13cd('0xa')](),controller[_0x13cd('0x11')]);module[_0x13cd('0x12')]=router; \ No newline at end of file +var _0xbd3b=['destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./variable.controller','isAuthenticated','get','/:id','post','create','put','update','delete'];(function(_0x36cb19,_0x486e38){var _0x147f66=function(_0x139c84){while(--_0x139c84){_0x36cb19['push'](_0x36cb19['shift']());}};_0x147f66(++_0x486e38);}(_0xbd3b,0x1c3));var _0xbbd3=function(_0x211530,_0x3ea767){_0x211530=_0x211530-0x0;var _0x3b5427=_0xbd3b[_0x211530];return _0x3b5427;};'use strict';var multer=require(_0xbbd3('0x0'));var util=require(_0xbbd3('0x1'));var path=require(_0xbbd3('0x2'));var timeout=require('connect-timeout');var express=require(_0xbbd3('0x3'));var router=express[_0xbbd3('0x4')]();var fs_extra=require(_0xbbd3('0x5'));var auth=require(_0xbbd3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbbd3('0x7'));var controller=require(_0xbbd3('0x8'));router['get']('/',auth[_0xbbd3('0x9')](),controller['index']);router[_0xbbd3('0xa')](_0xbbd3('0xb'),auth[_0xbbd3('0x9')](),controller['show']);router[_0xbbd3('0xc')]('/',auth[_0xbbd3('0x9')](),controller[_0xbbd3('0xd')]);router[_0xbbd3('0xe')]('/:id',auth[_0xbbd3('0x9')](),controller[_0xbbd3('0xf')]);router[_0xbbd3('0x10')](_0xbbd3('0xb'),auth['isAuthenticated'](),controller[_0xbbd3('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 0d9d3ad..af23e4a 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 _0xa4d8=['sequelize','exports','STRING','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa4d8,0x1dc));var _0x8a4d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa4d8[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x8a4d('0x0'));module[_0x8a4d('0x1')]={'name':{'type':Sequelize[_0x8a4d('0x2')],'unique':_0x8a4d('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8a4d('0x2')]}}; \ No newline at end of file +var _0xe933=['exports','STRING','name','sequelize'];(function(_0x46e53b,_0x4453d4){var _0x209da6=function(_0x5089bd){while(--_0x5089bd){_0x46e53b['push'](_0x46e53b['shift']());}};_0x209da6(++_0x4453d4);}(_0xe933,0x103));var _0x3e93=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xe933[_0x42bdad];return _0x122626;};'use strict';var Sequelize=require(_0x3e93('0x0'));module[_0x3e93('0x1')]={'name':{'type':Sequelize[_0x3e93('0x2')],'unique':_0x3e93('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3e93('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 324b871..6882943 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 _0xf747=['hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','update','destroy','then','get','Variables','UserProfileResource','sendStatus','error','name','send','map','Variable','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x1895b7,_0x21fbc7){var _0x1aecdc=function(_0x44682a){while(--_0x44682a){_0x1895b7['push'](_0x1895b7['shift']());}};_0x1aecdc(++_0x21fbc7);}(_0xf747,0x110));var _0x7f74=function(_0x81e87b,_0x30c25a){_0x81e87b=_0x81e87b-0x0;var _0xc7ae21=_0xf747[_0x81e87b];return _0xc7ae21;};'use strict';var emlformat=require(_0x7f74('0x0'));var rimraf=require(_0x7f74('0x1'));var zipdir=require(_0x7f74('0x2'));var jsonpatch=require(_0x7f74('0x3'));var rp=require(_0x7f74('0x4'));var moment=require(_0x7f74('0x5'));var BPromise=require(_0x7f74('0x6'));var Mustache=require('mustache');var util=require(_0x7f74('0x7'));var path=require(_0x7f74('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7f74('0x9'));var fs=require('fs');var fs_extra=require(_0x7f74('0xa'));var _=require('lodash');var squel=require(_0x7f74('0xb'));var crypto=require(_0x7f74('0xc'));var jsforce=require(_0x7f74('0xd'));var deskjs=require(_0x7f74('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7f74('0xf'));var Papa=require(_0x7f74('0x10'));var Redis=require(_0x7f74('0x11'));var authService=require(_0x7f74('0x12'));var qs=require(_0x7f74('0x13'));var as=require(_0x7f74('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7f74('0x15'))(_0x7f74('0x16'));var utils=require(_0x7f74('0x17'));var config=require(_0x7f74('0x18'));var licenseUtil=require(_0x7f74('0x19'));var db=require(_0x7f74('0x1a'))['db'];function respondWithStatusCode(_0x3fe842,_0xe1f229){_0xe1f229=_0xe1f229||0xcc;return function(_0x8323af){if(_0x8323af){return _0x3fe842['sendStatus'](_0xe1f229);}return _0x3fe842[_0x7f74('0x1b')](_0xe1f229)[_0x7f74('0x1c')]();};}function respondWithResult(_0x410df8,_0x287a93){_0x287a93=_0x287a93||0xc8;return function(_0x49b56d){if(_0x49b56d){return _0x410df8[_0x7f74('0x1b')](_0x287a93)[_0x7f74('0x1d')](_0x49b56d);}};}function respondWithFilteredResult(_0x31a3da,_0x212d96){return function(_0x41c292){if(_0x41c292){var _0x47e3f9=typeof _0x212d96[_0x7f74('0x1e')]===_0x7f74('0x1f')&&typeof _0x212d96[_0x7f74('0x20')]==='undefined';var _0x3c317b=_0x41c292['count'];var _0x264097=_0x47e3f9?0x0:_0x212d96['offset'];var _0x460ba3=_0x47e3f9?_0x41c292[_0x7f74('0x21')]:_0x212d96[_0x7f74('0x1e')]+_0x212d96[_0x7f74('0x20')];var _0x203c90;if(_0x460ba3>=_0x3c317b){_0x460ba3=_0x3c317b;_0x203c90=0xc8;}else{_0x203c90=0xce;}_0x31a3da['status'](_0x203c90);return _0x31a3da[_0x7f74('0x22')]('Content-Range',_0x264097+'-'+_0x460ba3+'/'+_0x3c317b)['json'](_0x41c292);}return null;};}function patchUpdates(_0x2bb02c){return function(_0x4cde7a){try{jsonpatch[_0x7f74('0x23')](_0x4cde7a,_0x2bb02c,!![]);}catch(_0x5edeed){return BPromise[_0x7f74('0x24')](_0x5edeed);}return _0x4cde7a['save']();};}function saveUpdates(_0x300cc8,_0x487908){return function(_0x34827a){if(_0x34827a){return _0x34827a[_0x7f74('0x25')](_0x300cc8)['then'](function(_0x164ac2){return _0x164ac2;});}return null;};}function removeEntity(_0x2a12c6,_0x7d4552){return function(_0x3a705e){if(_0x3a705e){return _0x3a705e[_0x7f74('0x26')]()[_0x7f74('0x27')](function(){var _0x46bef8=_0x3a705e[_0x7f74('0x28')]({'plain':!![]});var _0x27ae32=_0x7f74('0x29');return db[_0x7f74('0x2a')][_0x7f74('0x26')]({'where':{'type':_0x27ae32,'resourceId':_0x46bef8['id']}})[_0x7f74('0x27')](function(){return _0x3a705e;});})[_0x7f74('0x27')](function(){_0x2a12c6[_0x7f74('0x1b')](0xcc)[_0x7f74('0x1c')]();});}};}function handleEntityNotFound(_0x18dc24,_0x1c6d34){return function(_0x77f3c9){if(!_0x77f3c9){_0x18dc24[_0x7f74('0x2b')](0x194);}return _0x77f3c9;};}function handleError(_0x5c6589,_0x8d4592){_0x8d4592=_0x8d4592||0x1f4;return function(_0x302207){logger[_0x7f74('0x2c')](_0x302207['stack']);if(_0x302207[_0x7f74('0x2d')]){delete _0x302207[_0x7f74('0x2d')];}_0x5c6589[_0x7f74('0x1b')](_0x8d4592)[_0x7f74('0x2e')](_0x302207);};}exports['index']=function(_0x3af095,_0x1d5fec){var _0x2514d5={},_0x6d6434={},_0x52ffac={'count':0x0,'rows':[]};var _0x2529bd=_[_0x7f74('0x2f')](db[_0x7f74('0x30')][_0x7f74('0x31')],function(_0x433feb){return{'name':_0x433feb[_0x7f74('0x32')],'type':_0x433feb[_0x7f74('0x33')]['key']};});_0x6d6434[_0x7f74('0x34')]=_[_0x7f74('0x2f')](_0x2529bd,_0x7f74('0x2d'));_0x6d6434[_0x7f74('0x35')]=_[_0x7f74('0x36')](_0x3af095[_0x7f74('0x35')]);_0x6d6434[_0x7f74('0x37')]=_[_0x7f74('0x38')](_0x6d6434[_0x7f74('0x34')],_0x6d6434[_0x7f74('0x35')]);_0x2514d5[_0x7f74('0x39')]=_['intersection'](_0x6d6434['model'],qs[_0x7f74('0x3a')](_0x3af095['query'][_0x7f74('0x3a')]));_0x2514d5[_0x7f74('0x39')]=_0x2514d5[_0x7f74('0x39')][_0x7f74('0x3b')]?_0x2514d5['attributes']:_0x6d6434[_0x7f74('0x34')];if(!_0x3af095[_0x7f74('0x35')][_0x7f74('0x3c')](_0x7f74('0x3d'))){_0x2514d5['limit']=qs['limit'](_0x3af095[_0x7f74('0x35')][_0x7f74('0x20')]);_0x2514d5[_0x7f74('0x1e')]=qs[_0x7f74('0x1e')](_0x3af095[_0x7f74('0x35')]['offset']);}_0x2514d5['order']=qs[_0x7f74('0x3e')](_0x3af095[_0x7f74('0x35')][_0x7f74('0x3e')]);_0x2514d5[_0x7f74('0x3f')]=qs['filters'](_[_0x7f74('0x40')](_0x3af095[_0x7f74('0x35')],_0x6d6434['filters']),_0x2529bd);if(_0x3af095[_0x7f74('0x35')][_0x7f74('0x41')]){_0x2514d5['where']=_['merge'](_0x2514d5[_0x7f74('0x3f')],{'$or':_[_0x7f74('0x2f')](_0x2529bd,function(_0xfc5c02){if(_0xfc5c02[_0x7f74('0x33')]!==_0x7f74('0x42')){var _0x5db092={};_0x5db092[_0xfc5c02[_0x7f74('0x2d')]]={'$like':'%'+_0x3af095[_0x7f74('0x35')][_0x7f74('0x41')]+'%'};return _0x5db092;}})});}_0x2514d5=_[_0x7f74('0x43')]({},_0x2514d5,_0x3af095[_0x7f74('0x44')]);var _0x5b5841={'where':_0x2514d5[_0x7f74('0x3f')]};return db[_0x7f74('0x30')][_0x7f74('0x21')](_0x5b5841)['then'](function(_0x5d16df){_0x52ffac[_0x7f74('0x21')]=_0x5d16df;if(_0x3af095['query'][_0x7f74('0x45')]){_0x2514d5['include']=[{'all':!![]}];}return db[_0x7f74('0x30')][_0x7f74('0x46')](_0x2514d5);})['then'](function(_0x5d93be){_0x52ffac['rows']=_0x5d93be;return _0x52ffac;})['then'](respondWithFilteredResult(_0x1d5fec,_0x2514d5))[_0x7f74('0x47')](handleError(_0x1d5fec,null));};exports[_0x7f74('0x48')]=function(_0x173aec,_0x168535){var _0x55f97b={'raw':!![],'where':{'id':_0x173aec[_0x7f74('0x49')]['id']}},_0x564d9e={};_0x564d9e['model']=_[_0x7f74('0x36')](db[_0x7f74('0x30')][_0x7f74('0x31')]);_0x564d9e[_0x7f74('0x35')]=_[_0x7f74('0x36')](_0x173aec[_0x7f74('0x35')]);_0x564d9e[_0x7f74('0x37')]=_[_0x7f74('0x38')](_0x564d9e[_0x7f74('0x34')],_0x564d9e[_0x7f74('0x35')]);_0x55f97b[_0x7f74('0x39')]=_[_0x7f74('0x38')](_0x564d9e[_0x7f74('0x34')],qs['fields'](_0x173aec[_0x7f74('0x35')]['fields']));_0x55f97b['attributes']=_0x55f97b[_0x7f74('0x39')][_0x7f74('0x3b')]?_0x55f97b[_0x7f74('0x39')]:_0x564d9e[_0x7f74('0x34')];if(_0x173aec[_0x7f74('0x35')]['includeAll']){_0x55f97b['include']=[{'all':!![]}];}_0x55f97b=_['merge']({},_0x55f97b,_0x173aec[_0x7f74('0x44')]);return db[_0x7f74('0x30')][_0x7f74('0x4a')](_0x55f97b)[_0x7f74('0x27')](handleEntityNotFound(_0x168535,null))['then'](respondWithResult(_0x168535,null))[_0x7f74('0x47')](handleError(_0x168535,null));};exports['create']=function(_0x5d8cf,_0x568544){return db[_0x7f74('0x30')][_0x7f74('0x4b')](_0x5d8cf[_0x7f74('0x4c')],{})['then'](function(_0x4c4303){var _0x2a1eb8=_0x5d8cf[_0x7f74('0x4d')][_0x7f74('0x28')]({'plain':!![]});if(!_0x2a1eb8)throw new Error(_0x7f74('0x4e'));if(_0x2a1eb8[_0x7f74('0x4f')]===_0x7f74('0x4d')){var _0x4a8bdd=_0x4c4303[_0x7f74('0x28')]({'plain':!![]});var _0x390b06=_0x7f74('0x29');return db['UserProfileSection'][_0x7f74('0x4a')]({'where':{'name':_0x390b06,'userProfileId':_0x2a1eb8[_0x7f74('0x50')]},'raw':!![]})['then'](function(_0x3595c5){if(_0x3595c5&&_0x3595c5[_0x7f74('0x51')]===0x0){return db['UserProfileResource'][_0x7f74('0x4b')]({'name':_0x4a8bdd[_0x7f74('0x2d')],'resourceId':_0x4a8bdd['id'],'type':_0x3595c5[_0x7f74('0x2d')],'sectionId':_0x3595c5['id']},{})[_0x7f74('0x27')](function(){return _0x4c4303;});}else{return _0x4c4303;}})[_0x7f74('0x47')](function(_0x387071){logger['error'](_0x7f74('0x52'),_0x387071);throw _0x387071;});}return _0x4c4303;})[_0x7f74('0x27')](respondWithResult(_0x568544,0xc9))['catch'](handleError(_0x568544,null));};exports[_0x7f74('0x25')]=function(_0x4de313,_0xc7ca8c){if(_0x4de313[_0x7f74('0x4c')]['id']){delete _0x4de313['body']['id'];}return db['Variable'][_0x7f74('0x4a')]({'where':{'id':_0x4de313[_0x7f74('0x49')]['id']}})[_0x7f74('0x27')](handleEntityNotFound(_0xc7ca8c,null))[_0x7f74('0x27')](saveUpdates(_0x4de313[_0x7f74('0x4c')],null))['then'](respondWithResult(_0xc7ca8c,null))[_0x7f74('0x47')](handleError(_0xc7ca8c,null));};exports['destroy']=function(_0x4fc7f2,_0x3f67db){return db[_0x7f74('0x30')][_0x7f74('0x4a')]({'where':{'id':_0x4fc7f2[_0x7f74('0x49')]['id']}})[_0x7f74('0x27')](handleEntityNotFound(_0x3f67db,null))[_0x7f74('0x27')](removeEntity(_0x3f67db,null))[_0x7f74('0x47')](handleError(_0x3f67db,null));}; \ No newline at end of file +var _0x7765=['hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','Content-Range','reject','save','update','then','destroy','get','Variables','UserProfileResource','end','name','index','map','Variable','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x43f2af,_0x583470){var _0x2c0a38=function(_0x4004f7){while(--_0x4004f7){_0x43f2af['push'](_0x43f2af['shift']());}};_0x2c0a38(++_0x583470);}(_0x7765,0x1f4));var _0x5776=function(_0x32267e,_0x308d62){_0x32267e=_0x32267e-0x0;var _0x185fff=_0x7765[_0x32267e];return _0x185fff;};'use strict';var emlformat=require(_0x5776('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5776('0x1'));var rp=require(_0x5776('0x2'));var moment=require(_0x5776('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5776('0x4'));var util=require(_0x5776('0x5'));var path=require('path');var sox=require(_0x5776('0x6'));var csv=require(_0x5776('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5776('0x8'));var _=require(_0x5776('0x9'));var squel=require(_0x5776('0xa'));var crypto=require('crypto');var jsforce=require(_0x5776('0xb'));var deskjs=require(_0x5776('0xc'));var toCsv=require(_0x5776('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5776('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5776('0xe'));var hardwareService=require(_0x5776('0xf'));var logger=require('../../config/logger')(_0x5776('0x10'));var utils=require(_0x5776('0x11'));var config=require(_0x5776('0x12'));var licenseUtil=require(_0x5776('0x13'));var db=require(_0x5776('0x14'))['db'];function respondWithStatusCode(_0x262618,_0x5f28b7){_0x5f28b7=_0x5f28b7||0xcc;return function(_0x52f498){if(_0x52f498){return _0x262618[_0x5776('0x15')](_0x5f28b7);}return _0x262618[_0x5776('0x16')](_0x5f28b7)['end']();};}function respondWithResult(_0x408944,_0x106756){_0x106756=_0x106756||0xc8;return function(_0x209c98){if(_0x209c98){return _0x408944[_0x5776('0x16')](_0x106756)[_0x5776('0x17')](_0x209c98);}};}function respondWithFilteredResult(_0x230233,_0x45db82){return function(_0x55caaf){if(_0x55caaf){var _0xadd6a1=typeof _0x45db82[_0x5776('0x18')]==='undefined'&&typeof _0x45db82[_0x5776('0x19')]===_0x5776('0x1a');var _0x20dd93=_0x55caaf['count'];var _0x3f4fbc=_0xadd6a1?0x0:_0x45db82[_0x5776('0x18')];var _0x365348=_0xadd6a1?_0x55caaf[_0x5776('0x1b')]:_0x45db82[_0x5776('0x18')]+_0x45db82[_0x5776('0x19')];var _0x17fb43;if(_0x365348>=_0x20dd93){_0x365348=_0x20dd93;_0x17fb43=0xc8;}else{_0x17fb43=0xce;}_0x230233[_0x5776('0x16')](_0x17fb43);return _0x230233['set'](_0x5776('0x1c'),_0x3f4fbc+'-'+_0x365348+'/'+_0x20dd93)[_0x5776('0x17')](_0x55caaf);}return null;};}function patchUpdates(_0x5ee81c){return function(_0x331593){try{jsonpatch['apply'](_0x331593,_0x5ee81c,!![]);}catch(_0x28830f){return BPromise[_0x5776('0x1d')](_0x28830f);}return _0x331593[_0x5776('0x1e')]();};}function saveUpdates(_0x4737b8,_0x141341){return function(_0x3663b0){if(_0x3663b0){return _0x3663b0[_0x5776('0x1f')](_0x4737b8)[_0x5776('0x20')](function(_0x56e32f){return _0x56e32f;});}return null;};}function removeEntity(_0x188cc9,_0x31c5f7){return function(_0x47f0a5){if(_0x47f0a5){return _0x47f0a5[_0x5776('0x21')]()[_0x5776('0x20')](function(){var _0x17e074=_0x47f0a5[_0x5776('0x22')]({'plain':!![]});var _0x7e8389=_0x5776('0x23');return db[_0x5776('0x24')][_0x5776('0x21')]({'where':{'type':_0x7e8389,'resourceId':_0x17e074['id']}})[_0x5776('0x20')](function(){return _0x47f0a5;});})[_0x5776('0x20')](function(){_0x188cc9[_0x5776('0x16')](0xcc)[_0x5776('0x25')]();});}};}function handleEntityNotFound(_0x3e24f5,_0x172088){return function(_0x36307c){if(!_0x36307c){_0x3e24f5[_0x5776('0x15')](0x194);}return _0x36307c;};}function handleError(_0x191c60,_0x5cfb7a){_0x5cfb7a=_0x5cfb7a||0x1f4;return function(_0x3b2321){logger['error'](_0x3b2321['stack']);if(_0x3b2321[_0x5776('0x26')]){delete _0x3b2321[_0x5776('0x26')];}_0x191c60[_0x5776('0x16')](_0x5cfb7a)['send'](_0x3b2321);};}exports[_0x5776('0x27')]=function(_0x3e437e,_0x5451a7){var _0x7ad30f={},_0x5ec451={},_0x4e112b={'count':0x0,'rows':[]};var _0x3676e0=_[_0x5776('0x28')](db[_0x5776('0x29')]['rawAttributes'],function(_0x1f87ff){return{'name':_0x1f87ff[_0x5776('0x2a')],'type':_0x1f87ff[_0x5776('0x2b')][_0x5776('0x2c')]};});_0x5ec451[_0x5776('0x2d')]=_[_0x5776('0x28')](_0x3676e0,_0x5776('0x26'));_0x5ec451[_0x5776('0x2e')]=_[_0x5776('0x2f')](_0x3e437e[_0x5776('0x2e')]);_0x5ec451[_0x5776('0x30')]=_[_0x5776('0x31')](_0x5ec451[_0x5776('0x2d')],_0x5ec451[_0x5776('0x2e')]);_0x7ad30f[_0x5776('0x32')]=_['intersection'](_0x5ec451[_0x5776('0x2d')],qs[_0x5776('0x33')](_0x3e437e[_0x5776('0x2e')][_0x5776('0x33')]));_0x7ad30f[_0x5776('0x32')]=_0x7ad30f[_0x5776('0x32')][_0x5776('0x34')]?_0x7ad30f[_0x5776('0x32')]:_0x5ec451[_0x5776('0x2d')];if(!_0x3e437e[_0x5776('0x2e')][_0x5776('0x35')](_0x5776('0x36'))){_0x7ad30f[_0x5776('0x19')]=qs[_0x5776('0x19')](_0x3e437e[_0x5776('0x2e')][_0x5776('0x19')]);_0x7ad30f[_0x5776('0x18')]=qs['offset'](_0x3e437e[_0x5776('0x2e')]['offset']);}_0x7ad30f[_0x5776('0x37')]=qs['sort'](_0x3e437e['query']['sort']);_0x7ad30f[_0x5776('0x38')]=qs[_0x5776('0x30')](_[_0x5776('0x39')](_0x3e437e['query'],_0x5ec451[_0x5776('0x30')]),_0x3676e0);if(_0x3e437e['query'][_0x5776('0x3a')]){_0x7ad30f['where']=_[_0x5776('0x3b')](_0x7ad30f[_0x5776('0x38')],{'$or':_[_0x5776('0x28')](_0x3676e0,function(_0x4f21d1){if(_0x4f21d1[_0x5776('0x2b')]!==_0x5776('0x3c')){var _0x2315ce={};_0x2315ce[_0x4f21d1[_0x5776('0x26')]]={'$like':'%'+_0x3e437e[_0x5776('0x2e')][_0x5776('0x3a')]+'%'};return _0x2315ce;}})});}_0x7ad30f=_[_0x5776('0x3b')]({},_0x7ad30f,_0x3e437e[_0x5776('0x3d')]);var _0xb95bb5={'where':_0x7ad30f[_0x5776('0x38')]};return db[_0x5776('0x29')][_0x5776('0x1b')](_0xb95bb5)['then'](function(_0x1b33dc){_0x4e112b['count']=_0x1b33dc;if(_0x3e437e[_0x5776('0x2e')][_0x5776('0x3e')]){_0x7ad30f['include']=[{'all':!![]}];}return db[_0x5776('0x29')][_0x5776('0x3f')](_0x7ad30f);})['then'](function(_0x8fcdc7){_0x4e112b[_0x5776('0x40')]=_0x8fcdc7;return _0x4e112b;})[_0x5776('0x20')](respondWithFilteredResult(_0x5451a7,_0x7ad30f))[_0x5776('0x41')](handleError(_0x5451a7,null));};exports[_0x5776('0x42')]=function(_0x216137,_0x37940f){var _0x20e89f={'raw':!![],'where':{'id':_0x216137[_0x5776('0x43')]['id']}},_0x19dbf1={};_0x19dbf1[_0x5776('0x2d')]=_[_0x5776('0x2f')](db[_0x5776('0x29')][_0x5776('0x44')]);_0x19dbf1[_0x5776('0x2e')]=_[_0x5776('0x2f')](_0x216137[_0x5776('0x2e')]);_0x19dbf1[_0x5776('0x30')]=_[_0x5776('0x31')](_0x19dbf1[_0x5776('0x2d')],_0x19dbf1[_0x5776('0x2e')]);_0x20e89f[_0x5776('0x32')]=_['intersection'](_0x19dbf1['model'],qs[_0x5776('0x33')](_0x216137[_0x5776('0x2e')][_0x5776('0x33')]));_0x20e89f['attributes']=_0x20e89f[_0x5776('0x32')]['length']?_0x20e89f[_0x5776('0x32')]:_0x19dbf1[_0x5776('0x2d')];if(_0x216137[_0x5776('0x2e')]['includeAll']){_0x20e89f[_0x5776('0x45')]=[{'all':!![]}];}_0x20e89f=_[_0x5776('0x3b')]({},_0x20e89f,_0x216137['options']);return db[_0x5776('0x29')][_0x5776('0x46')](_0x20e89f)[_0x5776('0x20')](handleEntityNotFound(_0x37940f,null))['then'](respondWithResult(_0x37940f,null))['catch'](handleError(_0x37940f,null));};exports[_0x5776('0x47')]=function(_0x491ea3,_0x25c197){return db[_0x5776('0x29')]['create'](_0x491ea3[_0x5776('0x48')],{})[_0x5776('0x20')](function(_0x5c6443){var _0x3d4ffb=_0x491ea3[_0x5776('0x49')][_0x5776('0x22')]({'plain':!![]});if(!_0x3d4ffb)throw new Error(_0x5776('0x4a'));if(_0x3d4ffb[_0x5776('0x4b')]===_0x5776('0x49')){var _0x402b19=_0x5c6443[_0x5776('0x22')]({'plain':!![]});var _0x180257=_0x5776('0x23');return db['UserProfileSection']['find']({'where':{'name':_0x180257,'userProfileId':_0x3d4ffb[_0x5776('0x4c')]},'raw':!![]})[_0x5776('0x20')](function(_0x109b88){if(_0x109b88&&_0x109b88['autoAssociation']===0x0){return db[_0x5776('0x24')]['create']({'name':_0x402b19[_0x5776('0x26')],'resourceId':_0x402b19['id'],'type':_0x109b88[_0x5776('0x26')],'sectionId':_0x109b88['id']},{})['then'](function(){return _0x5c6443;});}else{return _0x5c6443;}})[_0x5776('0x41')](function(_0x4ef90d){logger[_0x5776('0x4d')](_0x5776('0x4e'),_0x4ef90d);throw _0x4ef90d;});}return _0x5c6443;})['then'](respondWithResult(_0x25c197,0xc9))[_0x5776('0x41')](handleError(_0x25c197,null));};exports[_0x5776('0x1f')]=function(_0x3c1910,_0x13e13b){if(_0x3c1910[_0x5776('0x48')]['id']){delete _0x3c1910[_0x5776('0x48')]['id'];}return db[_0x5776('0x29')][_0x5776('0x46')]({'where':{'id':_0x3c1910[_0x5776('0x43')]['id']}})[_0x5776('0x20')](handleEntityNotFound(_0x13e13b,null))['then'](saveUpdates(_0x3c1910[_0x5776('0x48')],null))['then'](respondWithResult(_0x13e13b,null))[_0x5776('0x41')](handleError(_0x13e13b,null));};exports['destroy']=function(_0x2c4305,_0x42f394){return db[_0x5776('0x29')]['find']({'where':{'id':_0x2c4305[_0x5776('0x43')]['id']}})[_0x5776('0x20')](handleEntityNotFound(_0x42f394,null))[_0x5776('0x20')](removeEntity(_0x42f394,null))[_0x5776('0x41')](handleError(_0x42f394,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 2b28d98..f7ae23e 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 _0x2696=['bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','tools_variables','lodash','util','../../config/logger','api','moment'];(function(_0x28baa4,_0x475c23){var _0x284511=function(_0xfc5f53){while(--_0xfc5f53){_0x28baa4['push'](_0x28baa4['shift']());}};_0x284511(++_0x475c23);}(_0x2696,0x18e));var _0x6269=function(_0x4b9dac,_0x13dfb2){_0x4b9dac=_0x4b9dac-0x0;var _0x1243f6=_0x2696[_0x4b9dac];return _0x1243f6;};'use strict';var _=require(_0x6269('0x0'));var util=require(_0x6269('0x1'));var logger=require(_0x6269('0x2'))(_0x6269('0x3'));var moment=require(_0x6269('0x4'));var BPromise=require(_0x6269('0x5'));var rp=require(_0x6269('0x6'));var fs=require('fs');var path=require(_0x6269('0x7'));var rimraf=require(_0x6269('0x8'));var config=require(_0x6269('0x9'));var attributes=require(_0x6269('0xa'));module[_0x6269('0xb')]=function(_0x357484,_0xb0e388){return _0x357484['define']('Variable',attributes,{'tableName':_0x6269('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f9b=['./variable.attributes','exports','define','tools_variables','lodash','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x290781,_0x53d542){var _0x1ef41f=function(_0x2940a5){while(--_0x2940a5){_0x290781['push'](_0x290781['shift']());}};_0x1ef41f(++_0x53d542);}(_0x8f9b,0x86));var _0xb8f9=function(_0xff1d2b,_0x50a288){_0xff1d2b=_0xff1d2b-0x0;var _0x3c549a=_0x8f9b[_0xff1d2b];return _0x3c549a;};'use strict';var _=require(_0xb8f9('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb8f9('0x1'));var BPromise=require('bluebird');var rp=require(_0xb8f9('0x2'));var fs=require('fs');var path=require(_0xb8f9('0x3'));var rimraf=require(_0xb8f9('0x4'));var config=require(_0xb8f9('0x5'));var attributes=require(_0xb8f9('0x6'));module[_0xb8f9('0x7')]=function(_0x422996,_0x2bcb45){return _0x422996[_0xb8f9('0x8')]('Variable',attributes,{'tableName':_0xb8f9('0x9'),'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 1bc909f..6e7c9a2 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ef6=['result','catch','Variable','find','options','raw','include','model','attributes','map','ShowVariable','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x19cbac,_0x4a7597){var _0x180da3=function(_0x219c1a){while(--_0x219c1a){_0x19cbac['push'](_0x19cbac['shift']());}};_0x180da3(++_0x4a7597);}(_0x8ef6,0xf2));var _0x68ef=function(_0x159c26,_0x185fee){_0x159c26=_0x159c26-0x0;var _0x39744f=_0x8ef6[_0x159c26];return _0x39744f;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('Variable,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('Variable,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});}exports['ShowVariable']=function(_0x2633c1){var _0x404870=this;return new Promise(function(_0x4ade0d,_0x527870){return db[_0x68ef('0x18')][_0x68ef('0x19')]({'raw':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1['options'][_0x68ef('0x1b')]===undefined?!![]:![]:!![],'where':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')]['where']||null:null,'attributes':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')]['attributes']||null:null,'include':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')][_0x68ef('0x1c')]?_['map'](_0x2633c1['options']['include'],function(_0x26018d){return{'model':db[_0x26018d[_0x68ef('0x1d')]],'as':_0x26018d['as'],'attributes':_0x26018d[_0x68ef('0x1e')],'include':_0x26018d[_0x68ef('0x1c')]?_[_0x68ef('0x1f')](_0x26018d[_0x68ef('0x1c')],function(_0x258cd5){return{'model':db[_0x258cd5[_0x68ef('0x1d')]],'as':_0x258cd5['as'],'attributes':_0x258cd5[_0x68ef('0x1e')],'include':_0x258cd5[_0x68ef('0x1c')]?_['map'](_0x258cd5[_0x68ef('0x1c')],function(_0x57f9ee){return{'model':db[_0x57f9ee['model']],'as':_0x57f9ee['as'],'attributes':_0x57f9ee['attributes']};}):[]};}):[]};}):[]:[]})[_0x68ef('0xc')](function(_0x268f32){logger[_0x68ef('0xd')](_0x68ef('0x20'),_0x2633c1);logger['debug']('ShowVariable',_0x2633c1,JSON[_0x68ef('0x12')](_0x268f32));_0x4ade0d(_0x268f32);})[_0x68ef('0x17')](function(_0x7bf96){logger[_0x68ef('0x13')](_0x68ef('0x20'),_0x7bf96[_0x68ef('0x15')],_0x2633c1);_0x527870(_0x404870[_0x68ef('0x13')](0x1f4,_0x7bf96[_0x68ef('0x15')]));});});}; \ No newline at end of file +var _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(_0x5c9397,_0xe6bc88){var _0x194baf=function(_0x50d093){while(--_0x50d093){_0x5c9397['push'](_0x5c9397['shift']());}};_0x194baf(++_0xe6bc88);}(_0xe14b,0x93));var _0xbe14=function(_0xc2be36,_0x5a47fc){_0xc2be36=_0xc2be36-0x0;var _0x4c177d=_0xe14b[_0xc2be36];return _0x4c177d;};'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 diff --git a/server/api/version/index.js b/server/api/version/index.js index a8949c4..1a8c27d 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 _0x2c01=['express','Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','/reset','reset','pull','restart','/migrations','migrations'];(function(_0x103ac4,_0x137d0c){var _0x39d4c0=function(_0x40d749){while(--_0x40d749){_0x103ac4['push'](_0x103ac4['shift']());}};_0x39d4c0(++_0x137d0c);}(_0x2c01,0x168));var _0x12c0=function(_0x1e3fdf,_0x87b0ce){_0x1e3fdf=_0x1e3fdf-0x0;var _0x340b71=_0x2c01[_0x1e3fdf];return _0x340b71;};'use strict';var express=require(_0x12c0('0x0'));var router=express[_0x12c0('0x1')]();var auth=require(_0x12c0('0x2'));var controller=require(_0x12c0('0x3'));router[_0x12c0('0x4')]('/',controller[_0x12c0('0x5')]);router[_0x12c0('0x4')](_0x12c0('0x6'),auth[_0x12c0('0x7')](),auth[_0x12c0('0x8')](),controller['fetch']);router['get'](_0x12c0('0x9'),auth[_0x12c0('0x7')](),auth[_0x12c0('0x8')](),controller[_0x12c0('0xa')]);router[_0x12c0('0x4')]('/pull',auth[_0x12c0('0x7')](),auth[_0x12c0('0x8')](),controller[_0x12c0('0xb')]);router[_0x12c0('0x4')]('/restart',auth[_0x12c0('0x7')](),controller[_0x12c0('0xc')]);router[_0x12c0('0x4')](_0x12c0('0xd'),controller[_0x12c0('0xe')]);module['exports']=router; \ No newline at end of file +var _0x1c20=['get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','migrations','exports','Router','../../components/auth/service'];(function(_0x40c6a4,_0x2d633e){var _0x400f11=function(_0x199e91){while(--_0x199e91){_0x40c6a4['push'](_0x40c6a4['shift']());}};_0x400f11(++_0x2d633e);}(_0x1c20,0x1d2));var _0x01c2=function(_0x1aba25,_0x1faed1){_0x1aba25=_0x1aba25-0x0;var _0x47d997=_0x1c20[_0x1aba25];return _0x47d997;};'use strict';var express=require('express');var router=express[_0x01c2('0x0')]();var auth=require(_0x01c2('0x1'));var controller=require('./version.controller');router[_0x01c2('0x2')]('/',controller[_0x01c2('0x3')]);router['get'](_0x01c2('0x4'),auth[_0x01c2('0x5')](),auth[_0x01c2('0x6')](),controller[_0x01c2('0x7')]);router[_0x01c2('0x2')](_0x01c2('0x8'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x01c2('0x9')]);router['get'](_0x01c2('0xa'),auth[_0x01c2('0x5')](),auth[_0x01c2('0x6')](),controller['pull']);router[_0x01c2('0x2')]('/restart',auth[_0x01c2('0x5')](),controller['restart']);router[_0x01c2('0x2')]('/migrations',controller[_0x01c2('0xb')]);module[_0x01c2('0xc')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 85319ae..6d749c1 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 _0x666e=['replace','push','Migration','sequelize','getQueryInterface','constructor','join','map','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash','pkginfo','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','update','simple-git','root','index','exports','version','query','latest','tags','2.0.0','status','json','fetch','master','error','info','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','server'];(function(_0x45ce08,_0x59dcc7){var _0x23dff2=function(_0x1ad0e5){while(--_0x1ad0e5){_0x45ce08['push'](_0x45ce08['shift']());}};_0x23dff2(++_0x59dcc7);}(_0x666e,0x1f4));var _0xe666=function(_0x53816b,_0x2f9ba3){_0x53816b=_0x53816b-0x0;var _0x7f2259=_0x666e[_0x53816b];return _0x7f2259;};'use strict';var Umzug=require(_0xe666('0x0'));var path=require('path');var fs=require('fs');var _=require(_0xe666('0x1'));var pkginfo=require(_0xe666('0x2'))(module,'version');var compareVersions=require(_0xe666('0x3'));var exec=require(_0xe666('0x4'))[_0xe666('0x5')];var db=require(_0xe666('0x6'))['db'];var config=require(_0xe666('0x7'));var pm2=require(_0xe666('0x8'));var logger=require('../../config/logger')(_0xe666('0x9'));var git=require(_0xe666('0xa'))(config[_0xe666('0xb')]);exports[_0xe666('0xc')]=function(_0x4e85fb,_0x1dec13){var _0x5b5336={'current':module[_0xe666('0xd')][_0xe666('0xe')],'phonebar':0x2};if(_0x4e85fb[_0xe666('0xf')]&&_0x4e85fb['query'][_0xe666('0x10')]){return git['fetch']()[_0xe666('0x11')](function(_0x4ae5a1,_0x3c274e){_0x5b5336[_0xe666('0x10')]=(_0x4ae5a1?module[_0xe666('0xd')]['version']:_0x3c274e[_0xe666('0x10')])||_0xe666('0x12');return _0x1dec13[_0xe666('0x13')](0xc8)[_0xe666('0x14')](_0x5b5336);});}else{return _0x1dec13[_0xe666('0x13')](0xc8)[_0xe666('0x14')](_0x5b5336);}};exports['fetch']=function(_0x38faa3,_0x4d6334){return git[_0xe666('0x15')](['origin',_0xe666('0x16')],function(_0x367e9e){if(_0x367e9e){logger[_0xe666('0x17')](_0x367e9e);return _0x4d6334[_0xe666('0x13')](0x1f4)[_0xe666('0x14')](_0x367e9e);}logger[_0xe666('0x18')]('git\x20fetch');return _0x4d6334['status'](0xc8)[_0xe666('0x14')]({'output':_0xe666('0x19')});});};exports[_0xe666('0x1a')]=function(_0x15f751,_0x5b0102){return git[_0xe666('0x1a')](['--hard',_0xe666('0x1b')],function(_0x1b6c28){if(_0x1b6c28){logger['error'](_0x1b6c28);return _0x5b0102['status'](0x1f4)['json'](_0x1b6c28);}logger['info'](_0xe666('0x1c'));return _0x5b0102[_0xe666('0x13')](0xc8)[_0xe666('0x14')]({'output':_0xe666('0x1d')});});};exports[_0xe666('0x1e')]=function(_0x402cbf,_0x5890e7){exec(_0xe666('0x1f'),function(_0x3c8124,_0x4a03e5,_0x1635a1){logger[_0xe666('0x18')](_0x4a03e5);logger[_0xe666('0x18')](_0x1635a1);if(_0x3c8124){logger['error'](_0x3c8124);return _0x5890e7[_0xe666('0x13')](0x1f4)[_0xe666('0x14')](_0x3c8124);}return _0x5890e7[_0xe666('0x13')](0xc8)[_0xe666('0x14')]({'output':_0x4a03e5});});};exports[_0xe666('0x20')]=function(_0xad9a01,_0x4866e9){return pm2[_0xe666('0x20')](_0xe666('0x21'))[_0xe666('0x22')](function(_0xda9344){logger[_0xe666('0x18')](_0xe666('0x23'),_0xda9344);return _0x4866e9[_0xe666('0x13')](0xc8)[_0xe666('0x14')]({'output':_0xe666('0x24')});})[_0xe666('0x25')](function(_0x5ac5f0){logger[_0xe666('0x17')](_0x5ac5f0);return _0x4866e9[_0xe666('0x13')](0x1f4)[_0xe666('0x14')](_0x5ac5f0);});};exports[_0xe666('0x26')]=function(_0x10cb71,_0x4ac3e7){var _0x1667b0=fs['readdirSync'](path['join'](config[_0xe666('0xb')],_0xe666('0x27'),_0xe666('0x26')));var _0x468c03=[];for(var _0x10f7cf=0x0;_0x10f7cf<_0x1667b0['length'];_0x10f7cf++){var _0x382a13=_0x1667b0[_0x10f7cf][_0xe666('0x28')]('.js','');if(compareVersions(module['exports']['version'],_0x382a13)===-0x1){_0x468c03[_0xe666('0x29')](_0x382a13);}}if(_0x468c03['length']){var _0x22ef54=_0x468c03['sort'](compareVersions);var _0x58c237=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0xe666('0x2a')],'modelName':'Migration','columnName':'version'},'migrations':{'params':[db[_0xe666('0x2b')][_0xe666('0x2c')](),db[_0xe666('0x2b')][_0xe666('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[_0xe666('0x2e')](config[_0xe666('0xb')],'server',_0xe666('0x26')),'pattern':/\.js$/}});_0x58c237['up']({'migrations':_[_0xe666('0x2f')](_0x22ef54,function(_0x111453){return _0x111453+_0xe666('0x30');})})['then'](function(){return _0x4ac3e7[_0xe666('0x13')](0xc8)[_0xe666('0x14')]({'output':_0xe666('0x31')+module[_0xe666('0xd')][_0xe666('0xe')]+_0xe666('0x32')+_[_0xe666('0x33')](_0x22ef54),'migrations':_[_0xe666('0x2e')](_0x22ef54)});})['catch'](function(_0x2849c6){if(_0x2849c6 instanceof db['sequelize'][_0xe666('0x34')]){return _0x4ac3e7['status'](0xc8)[_0xe666('0x14')]({'output':_0xe666('0x35')});}else{return _0x4ac3e7['status'](0x1f4)[_0xe666('0x14')](_0x2849c6);}});}else{return _0x4ac3e7[_0xe666('0x13')](0xc8)[_0xe666('0x14')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0x35ed=['git\x20fetch','reset','--hard','FETCH_HEAD','info','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','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.','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','version','compare-versions','exec','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','exports','query','fetch','tags','latest','2.0.0','status','json','origin','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x35ed,0xf3));var _0xd35e=function(_0x19a8eb,_0x3c20f6){_0x19a8eb=_0x19a8eb-0x0;var _0x792638=_0x35ed[_0x19a8eb];return _0x792638;};'use strict';var Umzug=require(_0xd35e('0x0'));var path=require(_0xd35e('0x1'));var fs=require('fs');var _=require(_0xd35e('0x2'));var pkginfo=require('pkginfo')(module,_0xd35e('0x3'));var compareVersions=require(_0xd35e('0x4'));var exec=require('child_process')[_0xd35e('0x5')];var db=require('../../mysqldb')['db'];var config=require(_0xd35e('0x6'));var pm2=require(_0xd35e('0x7'));var logger=require(_0xd35e('0x8'))(_0xd35e('0x9'));var git=require(_0xd35e('0xa'))(config[_0xd35e('0xb')]);exports['index']=function(_0x59ebdb,_0x317c52){var _0x1d1d48={'current':module[_0xd35e('0xc')]['version'],'phonebar':0x2};if(_0x59ebdb[_0xd35e('0xd')]&&_0x59ebdb[_0xd35e('0xd')]['latest']){return git[_0xd35e('0xe')]()[_0xd35e('0xf')](function(_0x361791,_0x5ccc5a){_0x1d1d48[_0xd35e('0x10')]=(_0x361791?module[_0xd35e('0xc')][_0xd35e('0x3')]:_0x5ccc5a[_0xd35e('0x10')])||_0xd35e('0x11');return _0x317c52[_0xd35e('0x12')](0xc8)['json'](_0x1d1d48);});}else{return _0x317c52[_0xd35e('0x12')](0xc8)[_0xd35e('0x13')](_0x1d1d48);}};exports[_0xd35e('0xe')]=function(_0x5edd0e,_0xdb5b3f){return git['fetch']([_0xd35e('0x14'),'master'],function(_0x5b5112){if(_0x5b5112){logger[_0xd35e('0x15')](_0x5b5112);return _0xdb5b3f[_0xd35e('0x12')](0x1f4)['json'](_0x5b5112);}logger['info'](_0xd35e('0x16'));return _0xdb5b3f[_0xd35e('0x12')](0xc8)[_0xd35e('0x13')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0xd35e('0x17')]=function(_0x23ed4b,_0x3471e0){return git[_0xd35e('0x17')]([_0xd35e('0x18'),_0xd35e('0x19')],function(_0x45cfff){if(_0x45cfff){logger['error'](_0x45cfff);return _0x3471e0['status'](0x1f4)[_0xd35e('0x13')](_0x45cfff);}logger[_0xd35e('0x1a')](_0xd35e('0x1b'));return _0x3471e0[_0xd35e('0x12')](0xc8)['json']({'output':_0xd35e('0x1c')});});};exports[_0xd35e('0x1d')]=function(_0xcc25a8,_0x405d47){exec('npm\x20install\x20--production',function(_0x4a6092,_0x10567d,_0x604df8){logger[_0xd35e('0x1a')](_0x10567d);logger[_0xd35e('0x1a')](_0x604df8);if(_0x4a6092){logger[_0xd35e('0x15')](_0x4a6092);return _0x405d47['status'](0x1f4)[_0xd35e('0x13')](_0x4a6092);}return _0x405d47[_0xd35e('0x12')](0xc8)[_0xd35e('0x13')]({'output':_0x10567d});});};exports['restart']=function(_0x38aacd,_0x20ed01){return pm2[_0xd35e('0x1e')](_0xd35e('0x1f'))[_0xd35e('0x20')](function(_0x2e6fb4){logger['info'](_0xd35e('0x21'),_0x2e6fb4);return _0x20ed01[_0xd35e('0x12')](0xc8)['json']({'output':_0xd35e('0x22')});})[_0xd35e('0x23')](function(_0x386c21){logger[_0xd35e('0x15')](_0x386c21);return _0x20ed01['status'](0x1f4)['json'](_0x386c21);});};exports[_0xd35e('0x24')]=function(_0x59d91c,_0x4f9e29){var _0x121ea8=fs[_0xd35e('0x25')](path[_0xd35e('0x26')](config[_0xd35e('0xb')],'server',_0xd35e('0x24')));var _0x2b10e8=[];for(var _0x3bc825=0x0;_0x3bc825<_0x121ea8[_0xd35e('0x27')];_0x3bc825++){var _0x394284=_0x121ea8[_0x3bc825][_0xd35e('0x28')](_0xd35e('0x29'),'');if(compareVersions(module[_0xd35e('0xc')][_0xd35e('0x3')],_0x394284)===-0x1){_0x2b10e8['push'](_0x394284);}}if(_0x2b10e8[_0xd35e('0x27')]){var _0x13ed47=_0x2b10e8[_0xd35e('0x2a')](compareVersions);var _0x1321ea=new Umzug({'storage':_0xd35e('0x2b'),'storageOptions':{'model':db['Migration'],'modelName':_0xd35e('0x2c'),'columnName':_0xd35e('0x3')},'migrations':{'params':[db[_0xd35e('0x2b')][_0xd35e('0x2d')](),db[_0xd35e('0x2b')][_0xd35e('0x2e')],function(){throw new Error(_0xd35e('0x2f'));}],'path':path['join'](config[_0xd35e('0xb')],'server',_0xd35e('0x24')),'pattern':/\.js$/}});_0x1321ea['up']({'migrations':_['map'](_0x13ed47,function(_0x5bfc67){return _0x5bfc67+'.js';})})[_0xd35e('0x20')](function(){return _0x4f9e29[_0xd35e('0x12')](0xc8)[_0xd35e('0x13')]({'output':_0xd35e('0x30')+module['exports'][_0xd35e('0x3')]+_0xd35e('0x31')+_[_0xd35e('0x32')](_0x13ed47),'migrations':_['join'](_0x13ed47)});})[_0xd35e('0x23')](function(_0x3a1872){if(_0x3a1872 instanceof db[_0xd35e('0x2b')][_0xd35e('0x33')]){return _0x4f9e29[_0xd35e('0x12')](0xc8)['json']({'output':_0xd35e('0x34')});}else{return _0x4f9e29[_0xd35e('0x12')](0x1f4)[_0xd35e('0x13')](_0x3a1872);}});}else{return _0x4f9e29['status'](0xc8)[_0xd35e('0x13')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 1d280ba..1f2833e 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 _0x2955=['isAuthenticated','get','/describe','describe','/:id','show','create','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceAgentReport.controller'];(function(_0x15942a,_0x13b58c){var _0x36a9fb=function(_0x549c27){while(--_0x549c27){_0x15942a['push'](_0x15942a['shift']());}};_0x36a9fb(++_0x13b58c);}(_0x2955,0x106));var _0x5295=function(_0x377409,_0x222f7e){_0x377409=_0x377409-0x0;var _0x502a7e=_0x2955[_0x377409];return _0x502a7e;};'use strict';var multer=require(_0x5295('0x0'));var util=require('util');var path=require(_0x5295('0x1'));var timeout=require('connect-timeout');var express=require(_0x5295('0x2'));var router=express[_0x5295('0x3')]();var fs_extra=require(_0x5295('0x4'));var auth=require(_0x5295('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5295('0x6'));var controller=require(_0x5295('0x7'));router['get']('/',auth[_0x5295('0x8')](),controller['index']);router[_0x5295('0x9')](_0x5295('0xa'),auth[_0x5295('0x8')](),controller[_0x5295('0xb')]);router[_0x5295('0x9')](_0x5295('0xc'),auth[_0x5295('0x8')](),controller[_0x5295('0xd')]);router['post']('/',auth[_0x5295('0x8')](),controller[_0x5295('0xe')]);router['put'](_0x5295('0xc'),auth[_0x5295('0x8')](),controller['update']);router[_0x5295('0xf')](_0x5295('0xc'),auth['isAuthenticated'](),controller[_0x5295('0x10')]);module[_0x5295('0x11')]=router; \ No newline at end of file +var _0x28ff=['index','get','/describe','/:id','show','post','put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','isAuthenticated'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x28ff,0x6d));var _0xf28f=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x28ff[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require(_0xf28f('0x0'));var util=require(_0xf28f('0x1'));var path=require(_0xf28f('0x2'));var timeout=require(_0xf28f('0x3'));var express=require(_0xf28f('0x4'));var router=express[_0xf28f('0x5')]();var fs_extra=require(_0xf28f('0x6'));var auth=require(_0xf28f('0x7'));var interaction=require(_0xf28f('0x8'));var config=require('../../config/environment');var controller=require(_0xf28f('0x9'));router['get']('/',auth[_0xf28f('0xa')](),controller[_0xf28f('0xb')]);router[_0xf28f('0xc')](_0xf28f('0xd'),auth[_0xf28f('0xa')](),controller['describe']);router[_0xf28f('0xc')](_0xf28f('0xe'),auth[_0xf28f('0xa')](),controller[_0xf28f('0xf')]);router[_0xf28f('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf28f('0x11')]('/:id',auth[_0xf28f('0xa')](),controller['update']);router['delete']('/:id',auth[_0xf28f('0xa')](),controller[_0xf28f('0x12')]);module[_0xf28f('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index dfff798..63f2471 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 _0x0598=['exports','STRING','DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x362df6,_0xb1b625){var _0x4d26a5=function(_0x28db0c){while(--_0x28db0c){_0x362df6['push'](_0x362df6['shift']());}};_0x4d26a5(++_0xb1b625);}(_0x0598,0x92));var _0x8059=function(_0x4366c7,_0x11c659){_0x4366c7=_0x4366c7-0x0;var _0x10c687=_0x0598[_0x4366c7];return _0x10c687;};'use strict';var Sequelize=require(_0x8059('0x0'));module[_0x8059('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x8059('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x8059('0x2')]},'interface':{'type':Sequelize[_0x8059('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x8059('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x8059('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x8059('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x8059('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x8059('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x8059('0x5')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x8059('0x2')]},'lastevent':{'type':Sequelize[_0x8059('0x2')]},'channel':{'type':Sequelize[_0x8059('0x2')]},'channelstate':{'type':Sequelize[_0x8059('0x5')]},'channelstatedesc':{'type':Sequelize[_0x8059('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x8059('0x2')]},'accountcode':{'type':Sequelize[_0x8059('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x8059('0x2')]},'destchannelstate':{'type':Sequelize[_0x8059('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0x8059('0x2')]},'destcalleridnum':{'type':Sequelize[_0x8059('0x2')]},'destcalleridname':{'type':Sequelize[_0x8059('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x8059('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x8059('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x8059('0x2')]},'destpriority':{'type':Sequelize[_0x8059('0x2')]},'destuniqueid':{'type':Sequelize[_0x8059('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x8059('0x2')],'comment':_0x8059('0x6')},'transferexten':{'type':Sequelize[_0x8059('0x2')]},'transferuniqueid':{'type':Sequelize[_0x8059('0x2')]},'agententerreason':{'type':Sequelize[_0x8059('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb03e=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports'];(function(_0x3edb20,_0x1f08ec){var _0x885d4=function(_0x5b8191){while(--_0x5b8191){_0x3edb20['push'](_0x3edb20['shift']());}};_0x885d4(++_0x1f08ec);}(_0xb03e,0x1eb));var _0xeb03=function(_0x3f6bd1,_0x34afa1){_0x3f6bd1=_0x3f6bd1-0x0;var _0x17db50=_0xb03e[_0x3f6bd1];return _0x17db50;};'use strict';var Sequelize=require('sequelize');module[_0xeb03('0x0')]={'type':{'type':Sequelize[_0xeb03('0x1')]},'uniqueid':{'type':Sequelize[_0xeb03('0x1')]},'calleridnum':{'type':Sequelize[_0xeb03('0x1')]},'calleridname':{'type':Sequelize[_0xeb03('0x1')]},'queue':{'type':Sequelize[_0xeb03('0x1')]},'interface':{'type':Sequelize[_0xeb03('0x1')]},'membername':{'type':Sequelize[_0xeb03('0x1')]},'agentcalledAt':{'type':Sequelize[_0xeb03('0x2')]},'agentconnectAt':{'type':Sequelize[_0xeb03('0x2')]},'agentcompleteAt':{'type':Sequelize[_0xeb03('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xeb03('0x2')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xeb03('0x3')]},'agentcomplete':{'type':Sequelize[_0xeb03('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xeb03('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xeb03('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xeb03('0x3')]},'agentacw':{'type':Sequelize[_0xeb03('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xeb03('0x1')]},'lastevent':{'type':Sequelize[_0xeb03('0x1')]},'channel':{'type':Sequelize[_0xeb03('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xeb03('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xeb03('0x1')]},'language':{'type':Sequelize[_0xeb03('0x1')]},'accountcode':{'type':Sequelize[_0xeb03('0x1')]},'context':{'type':Sequelize[_0xeb03('0x1')]},'exten':{'type':Sequelize[_0xeb03('0x1')]},'priority':{'type':Sequelize[_0xeb03('0x1')]},'destchannel':{'type':Sequelize[_0xeb03('0x1')]},'destchannelstate':{'type':Sequelize[_0xeb03('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xeb03('0x1')]},'destcalleridnum':{'type':Sequelize[_0xeb03('0x1')]},'destcalleridname':{'type':Sequelize[_0xeb03('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xeb03('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xeb03('0x1')]},'destaccountcode':{'type':Sequelize[_0xeb03('0x1')]},'destcontext':{'type':Sequelize[_0xeb03('0x1')]},'destexten':{'type':Sequelize[_0xeb03('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xeb03('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xeb03('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xeb03('0x1')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xeb03('0x1')],'comment':_0xeb03('0x5')},'transferexten':{'type':Sequelize[_0xeb03('0x1')]},'transferuniqueid':{'type':Sequelize[_0xeb03('0x1')]},'agententerreason':{'type':Sequelize[_0xeb03('0x3')],'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 eb8144d..19321eb 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(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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 6a956da..a351eed 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 _0xef8b=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','uniqueid','destuniqueid','util','../../config/logger','api'];(function(_0x55c01a,_0x1c39a6){var _0x8eca10=function(_0x3ba52c){while(--_0x3ba52c){_0x55c01a['push'](_0x55c01a['shift']());}};_0x8eca10(++_0x1c39a6);}(_0xef8b,0x192));var _0xbef8=function(_0x31cb77,_0x348021){_0x31cb77=_0x31cb77-0x0;var _0x710374=_0xef8b[_0x31cb77];return _0x710374;};'use strict';var _=require('lodash');var util=require(_0xbef8('0x0'));var logger=require(_0xbef8('0x1'))(_0xbef8('0x2'));var moment=require(_0xbef8('0x3'));var BPromise=require(_0xbef8('0x4'));var rp=require(_0xbef8('0x5'));var fs=require('fs');var path=require(_0xbef8('0x6'));var rimraf=require(_0xbef8('0x7'));var config=require(_0xbef8('0x8'));var attributes=require(_0xbef8('0x9'));module[_0xbef8('0xa')]=function(_0x550cb1,_0x1dd4a3){return _0x550cb1[_0xbef8('0xb')](_0xbef8('0xc'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0xbef8('0xd'),_0xbef8('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdb2a=['exports','define','report_agent','destuniqueid','lodash','util','../../config/logger','bluebird','request-promise','rimraf','./voiceAgentReport.attributes'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xdb2a,0x16f));var _0xadb2=function(_0x386d23,_0x29dae2){_0x386d23=_0x386d23-0x0;var _0x548f37=_0xdb2a[_0x386d23];return _0x548f37;};'use strict';var _=require(_0xadb2('0x0'));var util=require(_0xadb2('0x1'));var logger=require(_0xadb2('0x2'))('api');var moment=require('moment');var BPromise=require(_0xadb2('0x3'));var rp=require(_0xadb2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xadb2('0x5'));var config=require('../../config/environment');var attributes=require(_0xadb2('0x6'));module[_0xadb2('0x7')]=function(_0x1f5c7e,_0x297e69){return _0x1f5c7e[_0xadb2('0x8')]('VoiceAgentReport',attributes,{'tableName':_0xadb2('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0xadb2('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index e2e7dae..48c2ac6 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 _0x853d=['UpdateVoiceAgentReport','update','attributes','limit','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','CreateVoiceAgentReport','VoiceAgentReport','body','options','raw'];(function(_0x57e958,_0x153503){var _0x565a44=function(_0x50454b){while(--_0x50454b){_0x57e958['push'](_0x57e958['shift']());}};_0x565a44(++_0x153503);}(_0x853d,0x1a8));var _0xd853=function(_0x2331d3,_0x2995bd){_0x2331d3=_0x2331d3-0x0;var _0x24a661=_0x853d[_0x2331d3];return _0x24a661;};'use strict';var _=require(_0xd853('0x0'));var util=require('util');var moment=require(_0xd853('0x1'));var BPromise=require(_0xd853('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd853('0x3'));var db=require(_0xd853('0x4'))['db'];var utils=require(_0xd853('0x5'));var logger=require(_0xd853('0x6'))(_0xd853('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd853('0x8')][_0xd853('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x412528,_0x221a1a,_0x2cd410){return new BPromise(function(_0x3efe57,_0x59c140){return client[_0xd853('0xa')](_0x412528,_0x2cd410)[_0xd853('0xb')](function(_0x137507){logger[_0xd853('0xc')](_0xd853('0xd'),_0x221a1a,'request\x20sent');logger[_0xd853('0xe')](_0xd853('0xf'),_0x221a1a,_0xd853('0x10'),JSON[_0xd853('0x11')](_0x137507));if(_0x137507[_0xd853('0x12')]){if(_0x137507['error']['code']===0x1f4){logger[_0xd853('0x12')](_0xd853('0xd'),_0x221a1a,_0x137507[_0xd853('0x12')]['message']);return _0x59c140(_0x137507[_0xd853('0x12')][_0xd853('0x13')]);}logger[_0xd853('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x221a1a,_0x137507[_0xd853('0x12')][_0xd853('0x13')]);return _0x3efe57(_0x137507[_0xd853('0x12')][_0xd853('0x13')]);}else{logger[_0xd853('0xc')](_0xd853('0xd'),_0x221a1a,_0xd853('0x10'));_0x3efe57(_0x137507['result'][_0xd853('0x13')]);}})[_0xd853('0x14')](function(_0x46a310){logger['error'](_0xd853('0xd'),_0x221a1a,_0x46a310);_0x59c140(_0x46a310);});});}exports[_0xd853('0x15')]=function(_0x4ffcd0){var _0x58db4d=this;return new Promise(function(_0x263755,_0x4168c8){return db[_0xd853('0x16')]['create'](_0x4ffcd0[_0xd853('0x17')],{'raw':_0x4ffcd0[_0xd853('0x18')]?_0x4ffcd0[_0xd853('0x18')][_0xd853('0x19')]===undefined?!![]:![]:!![]})[_0xd853('0xb')](function(_0x310d27){logger[_0xd853('0xc')](_0xd853('0x15'),_0x4ffcd0);logger[_0xd853('0xe')](_0xd853('0x15'),_0x4ffcd0,JSON['stringify'](_0x310d27));_0x263755(_0x310d27);})[_0xd853('0x14')](function(_0x55f65c){logger[_0xd853('0x12')](_0xd853('0x15'),_0x55f65c[_0xd853('0x13')],_0x4ffcd0);_0x4168c8(_0x58db4d['error'](0x1f4,_0x55f65c[_0xd853('0x13')]));});});};exports[_0xd853('0x1a')]=function(_0x9b9abb){var _0x41dd68=this;return new Promise(function(_0x5325a8,_0x2f951d){return db['VoiceAgentReport'][_0xd853('0x1b')](_0x9b9abb[_0xd853('0x17')],{'raw':_0x9b9abb[_0xd853('0x18')]?_0x9b9abb[_0xd853('0x18')][_0xd853('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9b9abb[_0xd853('0x18')]?_0x9b9abb[_0xd853('0x18')]['where']||null:null,'attributes':_0x9b9abb[_0xd853('0x18')]?_0x9b9abb['options'][_0xd853('0x1c')]||null:null,'limit':_0x9b9abb[_0xd853('0x18')]?_0x9b9abb[_0xd853('0x18')][_0xd853('0x1d')]||null:null})['then'](function(_0x2baef3){logger['info'](_0xd853('0x1a'),_0x9b9abb);logger[_0xd853('0xe')](_0xd853('0x1a'),_0x9b9abb,JSON[_0xd853('0x11')](_0x2baef3));_0x5325a8(_0x2baef3);})[_0xd853('0x14')](function(_0x328bfd){logger[_0xd853('0x12')]('UpdateVoiceAgentReport',_0x328bfd[_0xd853('0x13')],_0x9b9abb);_0x2f951d(_0x41dd68[_0xd853('0x12')](0x1f4,_0x328bfd[_0xd853('0x13')]));});});}; \ No newline at end of file +var _0xc837=['VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','message','info','catch','CreateVoiceAgentReport','VoiceAgentReport','options','raw','debug','stringify','update','body','attributes','limit','UpdateVoiceAgentReport','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x5999ba,_0x97b26a){var _0x2140b5=function(_0x23b3fb){while(--_0x23b3fb){_0x5999ba['push'](_0x5999ba['shift']());}};_0x2140b5(++_0x97b26a);}(_0xc837,0x102));var _0x7c83=function(_0x5cb35f,_0x7e8da9){_0x5cb35f=_0x5cb35f-0x0;var _0x2a8213=_0xc837[_0x5cb35f];return _0x2a8213;};'use strict';var _=require('lodash');var util=require(_0x7c83('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7c83('0x1'));var fs=require('fs');var Redis=require(_0x7c83('0x2'));var db=require(_0x7c83('0x3'))['db'];var utils=require(_0x7c83('0x4'));var logger=require(_0x7c83('0x5'))(_0x7c83('0x6'));var config=require(_0x7c83('0x7'));var jayson=require(_0x7c83('0x8'));var client=jayson[_0x7c83('0x9')][_0x7c83('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e464a,_0x52e448,_0x3b1a2f){return new BPromise(function(_0x21642b,_0x21d421){return client[_0x7c83('0xb')](_0x5e464a,_0x3b1a2f)['then'](function(_0x39486d){logger['info'](_0x7c83('0xc'),_0x52e448,_0x7c83('0xd'));logger['debug'](_0x7c83('0xe'),_0x52e448,_0x7c83('0xd'),JSON['stringify'](_0x39486d));if(_0x39486d[_0x7c83('0xf')]){if(_0x39486d['error']['code']===0x1f4){logger[_0x7c83('0xf')](_0x7c83('0xc'),_0x52e448,_0x39486d[_0x7c83('0xf')][_0x7c83('0x10')]);return _0x21d421(_0x39486d[_0x7c83('0xf')][_0x7c83('0x10')]);}logger[_0x7c83('0xf')](_0x7c83('0xc'),_0x52e448,_0x39486d[_0x7c83('0xf')][_0x7c83('0x10')]);return _0x21642b(_0x39486d[_0x7c83('0xf')][_0x7c83('0x10')]);}else{logger[_0x7c83('0x11')](_0x7c83('0xc'),_0x52e448,_0x7c83('0xd'));_0x21642b(_0x39486d['result'][_0x7c83('0x10')]);}})[_0x7c83('0x12')](function(_0x580f8b){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x52e448,_0x580f8b);_0x21d421(_0x580f8b);});});}exports[_0x7c83('0x13')]=function(_0x572eed){var _0x4752d3=this;return new Promise(function(_0x45665a,_0x1d0072){return db[_0x7c83('0x14')]['create'](_0x572eed['body'],{'raw':_0x572eed[_0x7c83('0x15')]?_0x572eed[_0x7c83('0x15')][_0x7c83('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x3342a3){logger[_0x7c83('0x11')](_0x7c83('0x13'),_0x572eed);logger[_0x7c83('0x17')](_0x7c83('0x13'),_0x572eed,JSON[_0x7c83('0x18')](_0x3342a3));_0x45665a(_0x3342a3);})['catch'](function(_0x28e96c){logger['error']('CreateVoiceAgentReport',_0x28e96c[_0x7c83('0x10')],_0x572eed);_0x1d0072(_0x4752d3[_0x7c83('0xf')](0x1f4,_0x28e96c[_0x7c83('0x10')]));});});};exports['UpdateVoiceAgentReport']=function(_0x5b885c){var _0xf698b4=this;return new Promise(function(_0x57e39f,_0x2d1ee9){return db[_0x7c83('0x14')][_0x7c83('0x19')](_0x5b885c[_0x7c83('0x1a')],{'raw':_0x5b885c[_0x7c83('0x15')]?_0x5b885c[_0x7c83('0x15')][_0x7c83('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b885c['options']?_0x5b885c[_0x7c83('0x15')]['where']||null:null,'attributes':_0x5b885c[_0x7c83('0x15')]?_0x5b885c['options'][_0x7c83('0x1b')]||null:null,'limit':_0x5b885c[_0x7c83('0x15')]?_0x5b885c[_0x7c83('0x15')][_0x7c83('0x1c')]||null:null})['then'](function(_0x1193f0){logger[_0x7c83('0x11')](_0x7c83('0x1d'),_0x5b885c);logger[_0x7c83('0x17')](_0x7c83('0x1d'),_0x5b885c,JSON[_0x7c83('0x18')](_0x1193f0));_0x57e39f(_0x1193f0);})[_0x7c83('0x12')](function(_0x26862d){logger['error'](_0x7c83('0x1d'),_0x26862d[_0x7c83('0x10')],_0x5b885c);_0x2d1ee9(_0xf698b4['error'](0x1f4,_0x26862d[_0x7c83('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 8f2050e..0cf86f6 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 _0xd67b=['exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','update','delete','destroy'];(function(_0x198ba6,_0x558252){var _0x5c69eb=function(_0x3d13f9){while(--_0x3d13f9){_0x198ba6['push'](_0x198ba6['shift']());}};_0x5c69eb(++_0x558252);}(_0xd67b,0x133));var _0xbd67=function(_0x42fe64,_0x528d38){_0x42fe64=_0x42fe64-0x0;var _0x509f74=_0xd67b[_0x42fe64];return _0x509f74;};'use strict';var multer=require('multer');var util=require(_0xbd67('0x0'));var path=require('path');var timeout=require(_0xbd67('0x1'));var express=require(_0xbd67('0x2'));var router=express[_0xbd67('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbd67('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xbd67('0x5'));var controller=require('./voiceCallReport.controller');router[_0xbd67('0x6')]('/',auth[_0xbd67('0x7')](),controller[_0xbd67('0x8')]);router[_0xbd67('0x6')](_0xbd67('0x9'),auth[_0xbd67('0x7')](),controller[_0xbd67('0xa')]);router[_0xbd67('0x6')](_0xbd67('0xb'),auth[_0xbd67('0x7')](),controller[_0xbd67('0xc')]);router[_0xbd67('0xd')]('/',auth[_0xbd67('0x7')](),controller['create']);router['put'](_0xbd67('0xb'),auth['isAuthenticated'](),controller[_0xbd67('0xe')]);router[_0xbd67('0xf')](_0xbd67('0xb'),auth[_0xbd67('0x7')](),controller[_0xbd67('0x10')]);module[_0xbd67('0x11')]=router; \ No newline at end of file +var _0xf006=['post','create','put','update','destroy','exports','path','connect-timeout','Router','../../components/auth/service','./voiceCallReport.controller','get','isAuthenticated','describe','/:id','show'];(function(_0x4ad37c,_0x2e7490){var _0x288919=function(_0x3988a2){while(--_0x3988a2){_0x4ad37c['push'](_0x4ad37c['shift']());}};_0x288919(++_0x2e7490);}(_0xf006,0x146));var _0x6f00=function(_0x1fbb0c,_0x41a37f){_0x1fbb0c=_0x1fbb0c-0x0;var _0x517125=_0xf006[_0x1fbb0c];return _0x517125;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6f00('0x0'));var timeout=require(_0x6f00('0x1'));var express=require('express');var router=express[_0x6f00('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x6f00('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6f00('0x4'));router[_0x6f00('0x5')]('/',auth[_0x6f00('0x6')](),controller['index']);router[_0x6f00('0x5')]('/describe',auth[_0x6f00('0x6')](),controller[_0x6f00('0x7')]);router[_0x6f00('0x5')](_0x6f00('0x8'),auth[_0x6f00('0x6')](),controller[_0x6f00('0x9')]);router[_0x6f00('0xa')]('/',auth[_0x6f00('0x6')](),controller[_0x6f00('0xb')]);router[_0x6f00('0xc')](_0x6f00('0x8'),auth[_0x6f00('0x6')](),controller[_0x6f00('0xd')]);router['delete'](_0x6f00('0x8'),auth[_0x6f00('0x6')](),controller[_0x6f00('0xe')]);module[_0x6f00('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 6c9e672..d1a1ba7 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 _0x50d1=['INTEGER','exports','STRING','ENUM','internal','outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE'];(function(_0x33a708,_0x3911e9){var _0x3d7cb1=function(_0x2eaef1){while(--_0x2eaef1){_0x33a708['push'](_0x33a708['shift']());}};_0x3d7cb1(++_0x3911e9);}(_0x50d1,0xf3));var _0x150d=function(_0x1aa938,_0x4ad0fe){_0x1aa938=_0x1aa938-0x0;var _0x31d00d=_0x50d1[_0x1aa938];return _0x31d00d;};'use strict';var Sequelize=require('sequelize');module[_0x150d('0x0')]={'uniqueid':{'type':Sequelize[_0x150d('0x1')]},'type':{'type':Sequelize[_0x150d('0x2')]('inbound',_0x150d('0x3'),_0x150d('0x4'),_0x150d('0x5'),_0x150d('0x6'),_0x150d('0x7'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x150d('0x1')]},'destination':{'type':Sequelize[_0x150d('0x1')]},'destinationcontext':{'type':Sequelize[_0x150d('0x1')]},'callerid':{'type':Sequelize[_0x150d('0x1')]},'channel':{'type':Sequelize[_0x150d('0x1')]},'destinationchannel':{'type':Sequelize[_0x150d('0x1')]},'lastapplication':{'type':Sequelize[_0x150d('0x1')]},'lastdata':{'type':Sequelize[_0x150d('0x8')]},'starttime':{'type':Sequelize[_0x150d('0x9')]},'systemanswertime':{'type':Sequelize[_0x150d('0x9')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x150d('0x9')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x150d('0xa')]},'mohtime':{'type':Sequelize[_0x150d('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x150d('0x1')]},'amaflags':{'type':Sequelize[_0x150d('0x1')]},'userfield':{'type':Sequelize[_0x150d('0x1')]},'userDisposition':{'type':Sequelize[_0x150d('0x1')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x150d('0x1')]},'note':{'type':Sequelize[_0x150d('0x1')]},'prefix':{'type':Sequelize[_0x150d('0x1')]},'routeid':{'type':Sequelize[_0x150d('0xa')]},'sipcallid':{'type':Sequelize[_0x150d('0x1')]}}; \ No newline at end of file +var _0x1280=['DATE','INTEGER','sequelize','STRING','ENUM','inbound','internal','outbound','inbound-fax','dialer'];(function(_0x112a3e,_0x23f15c){var _0x577bfc=function(_0x4c47c0){while(--_0x4c47c0){_0x112a3e['push'](_0x112a3e['shift']());}};_0x577bfc(++_0x23f15c);}(_0x1280,0xac));var _0x0128=function(_0x5ad220,_0x27407e){_0x5ad220=_0x5ad220-0x0;var _0xdec77d=_0x1280[_0x5ad220];return _0xdec77d;};'use strict';var Sequelize=require(_0x0128('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x0128('0x1')]},'type':{'type':Sequelize[_0x0128('0x2')](_0x0128('0x3'),_0x0128('0x4'),_0x0128('0x5'),_0x0128('0x6'),'outbound-fax',_0x0128('0x7'))},'tag':{'type':Sequelize[_0x0128('0x1')]},'accountcode':{'type':Sequelize[_0x0128('0x1')]},'source':{'type':Sequelize[_0x0128('0x1')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x0128('0x1')]},'channel':{'type':Sequelize[_0x0128('0x1')]},'destinationchannel':{'type':Sequelize[_0x0128('0x1')]},'lastapplication':{'type':Sequelize[_0x0128('0x1')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x0128('0x8')]},'systemanswertime':{'type':Sequelize[_0x0128('0x8')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x0128('0x8')]},'duration':{'type':Sequelize[_0x0128('0x9')]},'billableseconds':{'type':Sequelize[_0x0128('0x9')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x0128('0x1')]},'userfield':{'type':Sequelize[_0x0128('0x1')]},'userDisposition':{'type':Sequelize[_0x0128('0x1')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x0128('0x1')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x0128('0x1')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x0128('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index dd5d54e..0a8adf8 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 _0x5f2f=['stack','name','send','index','VoiceCallReport','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','fullname','alias','User','findAll','catch','params','keys','find','create','body','destroy','describe','update','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then'];(function(_0x3ae2b2,_0x2d936f){var _0x1dbf00=function(_0x4072e9){while(--_0x4072e9){_0x3ae2b2['push'](_0x3ae2b2['shift']());}};_0x1dbf00(++_0x2d936f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x42fddb,_0x43d777){_0x42fddb=_0x42fddb-0x0;var _0x357157=_0x5f2f[_0x42fddb];return _0x357157;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'attributes':['id',_0xf5f2('0x26'),_0xf5f2('0x3e'),_0xf5f2('0x3f')],'model':db['User'],'as':_0xf5f2('0x40')}];}return db[_0xf5f2('0x29')][_0xf5f2('0x41')](_0x22c826);})['then'](function(_0x509dbc){_0x11c771['rows']=_0x509dbc;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x42')](handleError(_0x53cb96,null));};exports['show']=function(_0x106272,_0xeed03d){var _0x28e33f={'raw':!![],'where':{'id':_0x106272[_0xf5f2('0x43')]['id']}},_0x31f86c={};_0x31f86c[_0xf5f2('0x31')]=_[_0xf5f2('0x44')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x31f86c[_0xf5f2('0x2e')]=_[_0xf5f2('0x44')](_0x106272[_0xf5f2('0x2e')]);_0x31f86c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x31f86c['model'],_0x31f86c[_0xf5f2('0x2e')]);_0x28e33f['attributes']=_[_0xf5f2('0x30')](_0x31f86c[_0xf5f2('0x31')],qs[_0xf5f2('0x33')](_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x28e33f[_0xf5f2('0x32')]=_0x28e33f['attributes'][_0xf5f2('0x34')]?_0x28e33f[_0xf5f2('0x32')]:_0x31f86c[_0xf5f2('0x31')];if(_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x28e33f[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x28e33f=_[_0xf5f2('0x39')]({},_0x28e33f,_0x106272[_0xf5f2('0x3b')]);return db['VoiceCallReport'][_0xf5f2('0x45')](_0x28e33f)[_0xf5f2('0x24')](handleEntityNotFound(_0xeed03d,null))[_0xf5f2('0x24')](respondWithResult(_0xeed03d,null))['catch'](handleError(_0xeed03d,null));};exports[_0xf5f2('0x46')]=function(_0xc91b64,_0x3179a9){return db['VoiceCallReport']['create'](_0xc91b64[_0xf5f2('0x47')],{})[_0xf5f2('0x24')](respondWithResult(_0x3179a9,0xc9))['catch'](handleError(_0x3179a9,null));};exports[_0xf5f2('0x48')]=function(_0x533cca,_0x740321){return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'id':_0x533cca['params']['id']}})[_0xf5f2('0x24')](handleEntityNotFound(_0x740321,null))[_0xf5f2('0x24')](removeEntity(_0x740321,null))[_0xf5f2('0x42')](handleError(_0x740321,null));};exports[_0xf5f2('0x49')]=function(_0x4fa738,_0x3154c1){return db[_0xf5f2('0x29')]['describe']()['then'](respondWithResult(_0x3154c1,null))[_0xf5f2('0x42')](handleError(_0x3154c1,null));};exports[_0xf5f2('0x4a')]=function(_0x57782c,_0x22b645){if(_0x57782c[_0xf5f2('0x47')][_0xf5f2('0x4b')]){delete _0x57782c[_0xf5f2('0x47')]['uniqueid'];}return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'uniqueid':_0x57782c[_0xf5f2('0x43')]['id'],'UserId':{'$or':[null,_0x57782c['user']['id']]}}})[_0xf5f2('0x24')](handleEntityNotFound(_0x22b645,null))[_0xf5f2('0x24')](saveUpdates(_0x57782c[_0xf5f2('0x47')],null))[_0xf5f2('0x24')](respondWithResult(_0x22b645,null))[_0xf5f2('0x42')](handleError(_0x22b645,null));}; \ No newline at end of file +var _0xadb5=['filter','VIRTUAL','merge','options','includeAll','include','fullname','User','findAll','rows','show','rawAttributes','length','find','catch','body','params','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0xadb5,0xad));var _0x5adb=function(_0x51c00b,_0x90cdb1){_0x51c00b=_0x51c00b-0x0;var _0x358950=_0xadb5[_0x51c00b];return _0x358950;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['VoiceCallReport']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'attributes':['id',_0x5adb('0x26'),_0x5adb('0x40'),'alias'],'model':db['User'],'as':_0x5adb('0x41')}];}return db['VoiceCallReport'][_0x5adb('0x42')](_0x5d457e);})[_0x5adb('0x22')](function(_0x299746){_0x1eac55[_0x5adb('0x43')]=_0x299746;return _0x1eac55;})[_0x5adb('0x22')](respondWithFilteredResult(_0x49992e,_0x5d457e))['catch'](handleError(_0x49992e,null));};exports[_0x5adb('0x44')]=function(_0x565b03,_0x508690){var _0x4160ad={'raw':!![],'where':{'id':_0x565b03['params']['id']}},_0x1a256c={};_0x1a256c[_0x5adb('0x2e')]=_[_0x5adb('0x30')](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x1a256c[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x565b03[_0x5adb('0x2f')]);_0x1a256c['filters']=_['intersection'](_0x1a256c[_0x5adb('0x2e')],_0x1a256c[_0x5adb('0x2f')]);_0x4160ad[_0x5adb('0x32')]=_[_0x5adb('0x31')](_0x1a256c['model'],qs['fields'](_0x565b03[_0x5adb('0x2f')][_0x5adb('0x33')]));_0x4160ad[_0x5adb('0x32')]=_0x4160ad[_0x5adb('0x32')][_0x5adb('0x46')]?_0x4160ad['attributes']:_0x1a256c[_0x5adb('0x2e')];if(_0x565b03[_0x5adb('0x2f')]['includeAll']){_0x4160ad[_0x5adb('0x3f')]=[{'all':!![]}];}_0x4160ad=_[_0x5adb('0x3c')]({},_0x4160ad,_0x565b03[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')][_0x5adb('0x47')](_0x4160ad)[_0x5adb('0x22')](handleEntityNotFound(_0x508690,null))[_0x5adb('0x22')](respondWithResult(_0x508690,null))[_0x5adb('0x48')](handleError(_0x508690,null));};exports['create']=function(_0x3a925b,_0x57dc8b){return db['VoiceCallReport']['create'](_0x3a925b[_0x5adb('0x49')],{})[_0x5adb('0x22')](respondWithResult(_0x57dc8b,0xc9))[_0x5adb('0x48')](handleError(_0x57dc8b,null));};exports['destroy']=function(_0x2ad69d,_0x5cbab5){return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'id':_0x2ad69d[_0x5adb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cbab5,null))[_0x5adb('0x22')](removeEntity(_0x5cbab5,null))['catch'](handleError(_0x5cbab5,null));};exports[_0x5adb('0x4b')]=function(_0x6dc067,_0x55c535){return db[_0x5adb('0x2a')][_0x5adb('0x4b')]()[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x48')](handleError(_0x55c535,null));};exports[_0x5adb('0x21')]=function(_0x4cb36c,_0x36b847){if(_0x4cb36c[_0x5adb('0x49')][_0x5adb('0x4c')]){delete _0x4cb36c[_0x5adb('0x49')]['uniqueid'];}return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'uniqueid':_0x4cb36c[_0x5adb('0x4a')]['id'],'UserId':{'$or':[null,_0x4cb36c['user']['id']]}}})[_0x5adb('0x22')](handleEntityNotFound(_0x36b847,null))[_0x5adb('0x22')](saveUpdates(_0x4cb36c[_0x5adb('0x49')],null))[_0x5adb('0x22')](respondWithResult(_0x36b847,null))['catch'](handleError(_0x36b847,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index cade32f..7632224 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 _0x7763=['./voiceCallReport.attributes','exports','report_call','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x45e440,_0x3516fd){var _0x1a6c22=function(_0x49ae26){while(--_0x49ae26){_0x45e440['push'](_0x45e440['shift']());}};_0x1a6c22(++_0x3516fd);}(_0x7763,0xa0));var _0x3776=function(_0xaede4a,_0x44f7d7){_0xaede4a=_0xaede4a-0x0;var _0x10e86d=_0x7763[_0xaede4a];return _0x10e86d;};'use strict';var _=require(_0x3776('0x0'));var util=require(_0x3776('0x1'));var logger=require(_0x3776('0x2'))(_0x3776('0x3'));var moment=require('moment');var BPromise=require(_0x3776('0x4'));var rp=require(_0x3776('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3776('0x6'));var config=require(_0x3776('0x7'));var attributes=require(_0x3776('0x8'));module[_0x3776('0x9')]=function(_0x4c9d16,_0x2e49de){return _0x4c9d16['define']('VoiceCallReport',attributes,{'tableName':_0x3776('0xa'),'paranoid':![],'indexes':[{'fields':[_0x3776('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1d89=['define','VoiceCallReport','report_call','lodash','../../config/logger','api','moment','bluebird','rimraf'];(function(_0xe0f5da,_0x41478a){var _0x32685c=function(_0x177460){while(--_0x177460){_0xe0f5da['push'](_0xe0f5da['shift']());}};_0x32685c(++_0x41478a);}(_0x1d89,0x18f));var _0x91d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d89[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x91d8('0x0'));var util=require('util');var logger=require(_0x91d8('0x1'))(_0x91d8('0x2'));var moment=require(_0x91d8('0x3'));var BPromise=require(_0x91d8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x91d8('0x5'));var config=require('../../config/environment');var attributes=require('./voiceCallReport.attributes');module['exports']=function(_0x2940a8,_0x4cdfed){return _0x2940a8[_0x91d8('0x6')](_0x91d8('0x7'),attributes,{'tableName':_0x91d8('0x8'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 44ff754..68e0f48 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 _0x4ac3=['stringify','UpdateVoiceCallReport','update','where','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','attributes','limit','include','map','model','debug','CreateVoiceCallReport','create','raw'];(function(_0x12b068,_0x408475){var _0x3fa828=function(_0x1bc57b){while(--_0x1bc57b){_0x12b068['push'](_0x12b068['shift']());}};_0x3fa828(++_0x408475);}(_0x4ac3,0xa1));var _0x34ac=function(_0x3a1675,_0x5aac46){_0x3a1675=_0x3a1675-0x0;var _0x3962b2=_0x4ac3[_0x3a1675];return _0x3962b2;};'use strict';var _=require(_0x34ac('0x0'));var util=require(_0x34ac('0x1'));var moment=require(_0x34ac('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34ac('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x34ac('0x4'));var logger=require(_0x34ac('0x5'))(_0x34ac('0x6'));var config=require(_0x34ac('0x7'));var jayson=require(_0x34ac('0x8'));var client=jayson[_0x34ac('0x9')][_0x34ac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x310cea,_0x5c6e2d,_0xce992){return new BPromise(function(_0x2ed78f,_0x31707e){return client[_0x34ac('0xb')](_0x310cea,_0xce992)['then'](function(_0x9c0f5e){logger[_0x34ac('0xc')](_0x34ac('0xd'),_0x5c6e2d,_0x34ac('0xe'));logger['debug'](_0x34ac('0xf'),_0x5c6e2d,_0x34ac('0xe'),JSON['stringify'](_0x9c0f5e));if(_0x9c0f5e['error']){if(_0x9c0f5e['error'][_0x34ac('0x10')]===0x1f4){logger[_0x34ac('0x11')](_0x34ac('0xd'),_0x5c6e2d,_0x9c0f5e[_0x34ac('0x11')][_0x34ac('0x12')]);return _0x31707e(_0x9c0f5e[_0x34ac('0x11')]['message']);}logger['error'](_0x34ac('0xd'),_0x5c6e2d,_0x9c0f5e[_0x34ac('0x11')][_0x34ac('0x12')]);return _0x2ed78f(_0x9c0f5e[_0x34ac('0x11')][_0x34ac('0x12')]);}else{logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x5c6e2d,_0x34ac('0xe'));_0x2ed78f(_0x9c0f5e[_0x34ac('0x13')][_0x34ac('0x12')]);}})[_0x34ac('0x14')](function(_0x37b320){logger[_0x34ac('0x11')](_0x34ac('0xd'),_0x5c6e2d,_0x37b320);_0x31707e(_0x37b320);});});}exports[_0x34ac('0x15')]=function(_0x3800e4){var _0x2f4264=this;return new Promise(function(_0x2590bb,_0x431e36){return db[_0x34ac('0x16')][_0x34ac('0x17')]({'raw':_0x3800e4[_0x34ac('0x18')]?_0x3800e4[_0x34ac('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3800e4['options']?_0x3800e4[_0x34ac('0x18')]['where']||null:null,'attributes':_0x3800e4[_0x34ac('0x18')]?_0x3800e4[_0x34ac('0x18')][_0x34ac('0x19')]||null:null,'limit':_0x3800e4[_0x34ac('0x18')]?_0x3800e4[_0x34ac('0x18')][_0x34ac('0x1a')]||null:null,'include':_0x3800e4['options']?_0x3800e4[_0x34ac('0x18')][_0x34ac('0x1b')]?_[_0x34ac('0x1c')](_0x3800e4[_0x34ac('0x18')]['include'],function(_0x33dff3){return{'model':db[_0x33dff3[_0x34ac('0x1d')]],'as':_0x33dff3['as'],'attributes':_0x33dff3[_0x34ac('0x19')],'include':_0x33dff3[_0x34ac('0x1b')]?_[_0x34ac('0x1c')](_0x33dff3['include'],function(_0x30843c){return{'model':db[_0x30843c[_0x34ac('0x1d')]],'as':_0x30843c['as'],'attributes':_0x30843c['attributes'],'include':_0x30843c[_0x34ac('0x1b')]?_['map'](_0x30843c[_0x34ac('0x1b')],function(_0x3c5ea1){return{'model':db[_0x3c5ea1[_0x34ac('0x1d')]],'as':_0x3c5ea1['as'],'attributes':_0x3c5ea1[_0x34ac('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x46741e){logger[_0x34ac('0xc')](_0x34ac('0x15'),_0x3800e4);logger[_0x34ac('0x1e')](_0x34ac('0x15'),_0x3800e4,JSON['stringify'](_0x46741e));_0x2590bb(_0x46741e);})['catch'](function(_0x3be2ef){logger[_0x34ac('0x11')](_0x34ac('0x15'),_0x3be2ef[_0x34ac('0x12')],_0x3800e4);_0x431e36(_0x2f4264[_0x34ac('0x11')](0x1f4,_0x3be2ef['message']));});});};exports[_0x34ac('0x1f')]=function(_0xc33ad7){var _0x280438=this;return new Promise(function(_0x2e46e6,_0x9f8770){return db['VoiceCallReport'][_0x34ac('0x20')](_0xc33ad7['body'],{'raw':_0xc33ad7[_0x34ac('0x18')]?_0xc33ad7['options'][_0x34ac('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x2314fc){logger[_0x34ac('0xc')]('CreateVoiceCallReport',_0xc33ad7);logger[_0x34ac('0x1e')]('CreateVoiceCallReport',_0xc33ad7,JSON[_0x34ac('0x22')](_0x2314fc));_0x2e46e6(_0x2314fc);})[_0x34ac('0x14')](function(_0xa87e7a){logger[_0x34ac('0x11')](_0x34ac('0x1f'),_0xa87e7a['message'],_0xc33ad7);_0x9f8770(_0x280438['error'](0x1f4,_0xa87e7a['message']));});});};exports[_0x34ac('0x23')]=function(_0x54cecb){var _0x4a5846=this;return new Promise(function(_0x3360dc,_0x3b3e9b){return db[_0x34ac('0x16')][_0x34ac('0x24')](_0x54cecb['body'],{'raw':_0x54cecb[_0x34ac('0x18')]?_0x54cecb[_0x34ac('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54cecb[_0x34ac('0x18')]?_0x54cecb['options'][_0x34ac('0x25')]||null:null,'attributes':_0x54cecb[_0x34ac('0x18')]?_0x54cecb[_0x34ac('0x18')]['attributes']||null:null,'limit':_0x54cecb[_0x34ac('0x18')]?_0x54cecb[_0x34ac('0x18')][_0x34ac('0x1a')]||null:null})[_0x34ac('0x26')](function(_0x4d3510){logger[_0x34ac('0xc')](_0x34ac('0x23'),_0x54cecb);logger[_0x34ac('0x1e')](_0x34ac('0x23'),_0x54cecb,JSON[_0x34ac('0x22')](_0x4d3510));_0x3360dc(_0x4d3510);})[_0x34ac('0x14')](function(_0x2b494c){logger[_0x34ac('0x11')]('UpdateVoiceCallReport',_0x2b494c[_0x34ac('0x12')],_0x54cecb);_0x3b3e9b(_0x4a5846[_0x34ac('0x11')](0x1f4,_0x2b494c[_0x34ac('0x12')]));});});}; \ No newline at end of file +var _0xcb5e=['../../config/environment','jayson/promise','client','info','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','then','GetVoiceCallReport','stringify','create','CreateVoiceCallReport','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3a78a0,_0x44985f){var _0x48e917=function(_0x1e428c){while(--_0x1e428c){_0x3a78a0['push'](_0x3a78a0['shift']());}};_0x48e917(++_0x44985f);}(_0xcb5e,0x69));var _0xecb5=function(_0x5abfd6,_0x37a1bd){_0x5abfd6=_0x5abfd6-0x0;var _0x354885=_0xcb5e[_0x5abfd6];return _0x354885;};'use strict';var _=require(_0xecb5('0x0'));var util=require(_0xecb5('0x1'));var moment=require(_0xecb5('0x2'));var BPromise=require(_0xecb5('0x3'));var rs=require(_0xecb5('0x4'));var fs=require('fs');var Redis=require(_0xecb5('0x5'));var db=require(_0xecb5('0x6'))['db'];var utils=require(_0xecb5('0x7'));var logger=require(_0xecb5('0x8'))('rpc');var config=require(_0xecb5('0x9'));var jayson=require(_0xecb5('0xa'));var client=jayson[_0xecb5('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa0ddcb,_0x2a30a4,_0x51ba87){return new BPromise(function(_0x3e1934,_0x4df274){return client['request'](_0xa0ddcb,_0x51ba87)['then'](function(_0x4c9257){logger[_0xecb5('0xc')](_0xecb5('0xd'),_0x2a30a4,'request\x20sent');logger[_0xecb5('0xe')](_0xecb5('0xf'),_0x2a30a4,'request\x20sent',JSON['stringify'](_0x4c9257));if(_0x4c9257[_0xecb5('0x10')]){if(_0x4c9257[_0xecb5('0x10')]['code']===0x1f4){logger[_0xecb5('0x10')](_0xecb5('0xd'),_0x2a30a4,_0x4c9257[_0xecb5('0x10')]['message']);return _0x4df274(_0x4c9257[_0xecb5('0x10')]['message']);}logger[_0xecb5('0x10')](_0xecb5('0xd'),_0x2a30a4,_0x4c9257[_0xecb5('0x10')][_0xecb5('0x11')]);return _0x3e1934(_0x4c9257['error'][_0xecb5('0x11')]);}else{logger[_0xecb5('0xc')](_0xecb5('0xd'),_0x2a30a4,_0xecb5('0x12'));_0x3e1934(_0x4c9257[_0xecb5('0x13')]['message']);}})[_0xecb5('0x14')](function(_0x51cd39){logger[_0xecb5('0x10')](_0xecb5('0xd'),_0x2a30a4,_0x51cd39);_0x4df274(_0x51cd39);});});}exports['GetVoiceCallReport']=function(_0x25ad7e){var _0x2230e2=this;return new Promise(function(_0x138de1,_0x1374a8){return db[_0xecb5('0x15')][_0xecb5('0x16')]({'raw':_0x25ad7e['options']?_0x25ad7e[_0xecb5('0x17')][_0xecb5('0x18')]===undefined?!![]:![]:!![],'where':_0x25ad7e[_0xecb5('0x17')]?_0x25ad7e[_0xecb5('0x17')][_0xecb5('0x19')]||null:null,'attributes':_0x25ad7e[_0xecb5('0x17')]?_0x25ad7e[_0xecb5('0x17')][_0xecb5('0x1a')]||null:null,'limit':_0x25ad7e['options']?_0x25ad7e[_0xecb5('0x17')][_0xecb5('0x1b')]||null:null,'include':_0x25ad7e[_0xecb5('0x17')]?_0x25ad7e[_0xecb5('0x17')][_0xecb5('0x1c')]?_[_0xecb5('0x1d')](_0x25ad7e[_0xecb5('0x17')][_0xecb5('0x1c')],function(_0x5b8c27){return{'model':db[_0x5b8c27[_0xecb5('0x1e')]],'as':_0x5b8c27['as'],'attributes':_0x5b8c27[_0xecb5('0x1a')],'include':_0x5b8c27[_0xecb5('0x1c')]?_['map'](_0x5b8c27[_0xecb5('0x1c')],function(_0x12397f){return{'model':db[_0x12397f[_0xecb5('0x1e')]],'as':_0x12397f['as'],'attributes':_0x12397f[_0xecb5('0x1a')],'include':_0x12397f[_0xecb5('0x1c')]?_[_0xecb5('0x1d')](_0x12397f[_0xecb5('0x1c')],function(_0x50785d){return{'model':db[_0x50785d[_0xecb5('0x1e')]],'as':_0x50785d['as'],'attributes':_0x50785d['attributes']};}):[]};}):[]};}):[]:[]})[_0xecb5('0x1f')](function(_0x101e65){logger[_0xecb5('0xc')](_0xecb5('0x20'),_0x25ad7e);logger[_0xecb5('0xe')]('GetVoiceCallReport',_0x25ad7e,JSON[_0xecb5('0x21')](_0x101e65));_0x138de1(_0x101e65);})[_0xecb5('0x14')](function(_0x21cc92){logger[_0xecb5('0x10')](_0xecb5('0x20'),_0x21cc92['message'],_0x25ad7e);_0x1374a8(_0x2230e2['error'](0x1f4,_0x21cc92[_0xecb5('0x11')]));});});};exports['CreateVoiceCallReport']=function(_0x20a8a3){var _0x15070f=this;return new Promise(function(_0x337674,_0xb0c9f2){return db[_0xecb5('0x15')][_0xecb5('0x22')](_0x20a8a3['body'],{'raw':_0x20a8a3[_0xecb5('0x17')]?_0x20a8a3['options'][_0xecb5('0x18')]===undefined?!![]:![]:!![]})[_0xecb5('0x1f')](function(_0x3b59ec){logger[_0xecb5('0xc')](_0xecb5('0x23'),_0x20a8a3);logger[_0xecb5('0xe')](_0xecb5('0x23'),_0x20a8a3,JSON[_0xecb5('0x21')](_0x3b59ec));_0x337674(_0x3b59ec);})[_0xecb5('0x14')](function(_0xdb61b4){logger[_0xecb5('0x10')]('CreateVoiceCallReport',_0xdb61b4[_0xecb5('0x11')],_0x20a8a3);_0xb0c9f2(_0x15070f[_0xecb5('0x10')](0x1f4,_0xdb61b4['message']));});});};exports[_0xecb5('0x24')]=function(_0x5a3906){var _0x38355f=this;return new Promise(function(_0x54cf43,_0xb92b37){return db['VoiceCallReport'][_0xecb5('0x25')](_0x5a3906['body'],{'raw':_0x5a3906[_0xecb5('0x17')]?_0x5a3906[_0xecb5('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a3906[_0xecb5('0x17')]?_0x5a3906[_0xecb5('0x17')][_0xecb5('0x19')]||null:null,'attributes':_0x5a3906[_0xecb5('0x17')]?_0x5a3906['options'][_0xecb5('0x1a')]||null:null,'limit':_0x5a3906[_0xecb5('0x17')]?_0x5a3906['options'][_0xecb5('0x1b')]||null:null})['then'](function(_0x2f73ab){logger[_0xecb5('0xc')](_0xecb5('0x24'),_0x5a3906);logger['debug'](_0xecb5('0x24'),_0x5a3906,JSON[_0xecb5('0x21')](_0x2f73ab));_0x54cf43(_0x2f73ab);})[_0xecb5('0x14')](function(_0x5ad299){logger['error'](_0xecb5('0x24'),_0x5ad299[_0xecb5('0x11')],_0x5a3906);_0xb92b37(_0x38355f[_0xecb5('0x10')](0x1f4,_0x5ad299[_0xecb5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 5ef55a4..5fa7577 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 _0x7079=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout'];(function(_0x8c2c37,_0x45f7bb){var _0x4d32ce=function(_0x55c589){while(--_0x55c589){_0x8c2c37['push'](_0x8c2c37['shift']());}};_0x4d32ce(++_0x45f7bb);}(_0x7079,0x1eb));var _0x9707=function(_0x5b31b9,_0x50edd7){_0x5b31b9=_0x5b31b9-0x0;var _0x4f9e60=_0x7079[_0x5b31b9];return _0x4f9e60;};'use strict';var multer=require('multer');var util=require(_0x9707('0x0'));var path=require(_0x9707('0x1'));var timeout=require(_0x9707('0x2'));var express=require(_0x9707('0x3'));var router=express[_0x9707('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9707('0x5'));var interaction=require(_0x9707('0x6'));var config=require(_0x9707('0x7'));var controller=require('./voiceChanSpy.controller');router[_0x9707('0x8')]('/',auth[_0x9707('0x9')](),controller[_0x9707('0xa')]);router['get'](_0x9707('0xb'),auth['isAuthenticated'](),controller[_0x9707('0xc')]);router[_0x9707('0xd')]('/',auth['isAuthenticated'](),controller[_0x9707('0xe')]);router[_0x9707('0xf')](_0x9707('0xb'),auth[_0x9707('0x9')](),controller['update']);router[_0x9707('0x10')]('/:id',auth[_0x9707('0x9')](),controller[_0x9707('0x11')]);module[_0x9707('0x12')]=router; \ No newline at end of file +var _0xe127=['../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','index','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x442a27,_0x450968){var _0x24a0ed=function(_0x174b0d){while(--_0x174b0d){_0x442a27['push'](_0x442a27['shift']());}};_0x24a0ed(++_0x450968);}(_0xe127,0x19e));var _0x7e12=function(_0x24387f,_0x115d8e){_0x24387f=_0x24387f-0x0;var _0x4067f9=_0xe127[_0x24387f];return _0x4067f9;};'use strict';var multer=require('multer');var util=require(_0x7e12('0x0'));var path=require(_0x7e12('0x1'));var timeout=require(_0x7e12('0x2'));var express=require(_0x7e12('0x3'));var router=express['Router']();var fs_extra=require(_0x7e12('0x4'));var auth=require(_0x7e12('0x5'));var interaction=require(_0x7e12('0x6'));var config=require(_0x7e12('0x7'));var controller=require(_0x7e12('0x8'));router[_0x7e12('0x9')]('/',auth['isAuthenticated'](),controller[_0x7e12('0xa')]);router['get'](_0x7e12('0xb'),auth[_0x7e12('0xc')](),controller[_0x7e12('0xd')]);router[_0x7e12('0xe')]('/',auth[_0x7e12('0xc')](),controller[_0x7e12('0xf')]);router['put'](_0x7e12('0xb'),auth['isAuthenticated'](),controller[_0x7e12('0x10')]);router[_0x7e12('0x11')]('/:id',auth[_0x7e12('0xc')](),controller[_0x7e12('0x12')]);module[_0x7e12('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index c137dd5..d903260 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 _0xa1ff=['getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue','options'];(function(_0x22a716,_0x14793b){var _0x45c97f=function(_0x20b1f7){while(--_0x20b1f7){_0x22a716['push'](_0x22a716['shift']());}};_0x45c97f(++_0x14793b);}(_0xa1ff,0x1c5));var _0xfa1f=function(_0x31d1d7,_0x54bc7c){_0x31d1d7=_0x31d1d7-0x0;var _0x328ad2=_0xa1ff[_0x31d1d7];return _0x328ad2;};'use strict';var Sequelize=require(_0xfa1f('0x0'));module[_0xfa1f('0x1')]={'name':{'type':Sequelize[_0xfa1f('0x2')]},'prefix':{'type':Sequelize[_0xfa1f('0x2')],'unique':_0xfa1f('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xfa1f('0x2')],'set':function(_0x2f7be9){this[_0xfa1f('0x4')]('options',_0x2f7be9?_0x2f7be9['join'](''):[]);},'get':function(){return this['getDataValue'](_0xfa1f('0x5'))?this[_0xfa1f('0x6')](_0xfa1f('0x5'))[_0xfa1f('0x7')](''):[];}},'auth':{'type':Sequelize[_0xfa1f('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0xfa1f('0x2')]},'record':{'type':Sequelize[_0xfa1f('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xfa1f('0x2')]},'description':{'type':Sequelize[_0xfa1f('0x2')]}}; \ No newline at end of file +var _0x8b2b=['STRING','name','options','join','getDataValue','split','BOOLEAN','sequelize'];(function(_0x59dea0,_0x5b17ee){var _0x5ceaa7=function(_0x475c64){while(--_0x475c64){_0x59dea0['push'](_0x59dea0['shift']());}};_0x5ceaa7(++_0x5b17ee);}(_0x8b2b,0xf7));var _0xb8b2=function(_0x597621,_0x18432d){_0x597621=_0x597621-0x0;var _0x4f95a6=_0x8b2b[_0x597621];return _0x4f95a6;};'use strict';var Sequelize=require(_0xb8b2('0x0'));module['exports']={'name':{'type':Sequelize[_0xb8b2('0x1')]},'prefix':{'type':Sequelize['STRING'],'unique':_0xb8b2('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0xb8b2('0x1')],'set':function(_0x278cbf){this['setDataValue'](_0xb8b2('0x3'),_0x278cbf?_0x278cbf[_0xb8b2('0x4')](''):[]);},'get':function(){return this[_0xb8b2('0x5')]('options')?this['getDataValue'](_0xb8b2('0x3'))[_0xb8b2('0x6')](''):[];}},'auth':{'type':Sequelize[_0xb8b2('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0xb8b2('0x1')]},'record':{'type':Sequelize[_0xb8b2('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xb8b2('0x1')]},'description':{'type':Sequelize[_0xb8b2('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 9524450..7468f4f 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 _0x2547=['../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','ChanSpies','error','stack','name','send','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','map','options','includeAll','findAll','rows','catch','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x3f6aba,_0x998f68){var _0x44ea93=function(_0x323036){while(--_0x323036){_0x3f6aba['push'](_0x3f6aba['shift']());}};_0x44ea93(++_0x998f68);}(_0x2547,0x1cd));var _0x7254=function(_0x262e80,_0x49dc41){_0x262e80=_0x262e80-0x0;var _0x1d542c=_0x2547[_0x262e80];return _0x1d542c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7254('0x0'));var zipdir=require(_0x7254('0x1'));var jsonpatch=require(_0x7254('0x2'));var rp=require(_0x7254('0x3'));var moment=require(_0x7254('0x4'));var BPromise=require(_0x7254('0x5'));var Mustache=require(_0x7254('0x6'));var util=require(_0x7254('0x7'));var path=require('path');var sox=require(_0x7254('0x8'));var csv=require(_0x7254('0x9'));var ejs=require(_0x7254('0xa'));var fs=require('fs');var fs_extra=require(_0x7254('0xb'));var _=require('lodash');var squel=require(_0x7254('0xc'));var crypto=require(_0x7254('0xd'));var jsforce=require(_0x7254('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7254('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7254('0xf'));var qs=require(_0x7254('0x10'));var as=require(_0x7254('0x11'));var hardwareService=require(_0x7254('0x12'));var logger=require(_0x7254('0x13'))(_0x7254('0x14'));var utils=require('../../config/utils');var config=require(_0x7254('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7254('0x16'))['db'];function respondWithStatusCode(_0x53fc4f,_0x16c08e){_0x16c08e=_0x16c08e||0xcc;return function(_0x2bfff8){if(_0x2bfff8){return _0x53fc4f[_0x7254('0x17')](_0x16c08e);}return _0x53fc4f[_0x7254('0x18')](_0x16c08e)[_0x7254('0x19')]();};}function respondWithResult(_0x395a8a,_0x124192){_0x124192=_0x124192||0xc8;return function(_0x21cecc){if(_0x21cecc){return _0x395a8a[_0x7254('0x18')](_0x124192)[_0x7254('0x1a')](_0x21cecc);}};}function respondWithFilteredResult(_0x38a99c,_0x1ee5cb){return function(_0x163c8c){if(_0x163c8c){var _0x535065=typeof _0x1ee5cb[_0x7254('0x1b')]===_0x7254('0x1c')&&typeof _0x1ee5cb[_0x7254('0x1d')]===_0x7254('0x1c');var _0x3b5f06=_0x163c8c[_0x7254('0x1e')];var _0x2737e0=_0x535065?0x0:_0x1ee5cb['offset'];var _0x1f48f6=_0x535065?_0x163c8c[_0x7254('0x1e')]:_0x1ee5cb[_0x7254('0x1b')]+_0x1ee5cb[_0x7254('0x1d')];var _0x2a1ddc;if(_0x1f48f6>=_0x3b5f06){_0x1f48f6=_0x3b5f06;_0x2a1ddc=0xc8;}else{_0x2a1ddc=0xce;}_0x38a99c[_0x7254('0x18')](_0x2a1ddc);return _0x38a99c[_0x7254('0x1f')](_0x7254('0x20'),_0x2737e0+'-'+_0x1f48f6+'/'+_0x3b5f06)[_0x7254('0x1a')](_0x163c8c);}return null;};}function patchUpdates(_0x3b6cb6){return function(_0x2594b8){try{jsonpatch[_0x7254('0x21')](_0x2594b8,_0x3b6cb6,!![]);}catch(_0xc617b6){return BPromise[_0x7254('0x22')](_0xc617b6);}return _0x2594b8[_0x7254('0x23')]();};}function saveUpdates(_0x95ceaa,_0x2bb2fe){return function(_0x46c0a2){if(_0x46c0a2){return _0x46c0a2[_0x7254('0x24')](_0x95ceaa)[_0x7254('0x25')](function(_0x1be69b){return _0x1be69b;});}return null;};}function removeEntity(_0x50c34b,_0x493bfd){return function(_0x136ea3){if(_0x136ea3){return _0x136ea3[_0x7254('0x26')]()[_0x7254('0x25')](function(){var _0x54dace=_0x136ea3[_0x7254('0x27')]({'plain':!![]});var _0x36b5d5=_0x7254('0x28');return db['UserProfileResource'][_0x7254('0x26')]({'where':{'type':_0x36b5d5,'resourceId':_0x54dace['id']}})[_0x7254('0x25')](function(){return _0x136ea3;});})[_0x7254('0x25')](function(){_0x50c34b['status'](0xcc)[_0x7254('0x19')]();});}};}function handleEntityNotFound(_0x594a63,_0x1bb6a7){return function(_0x134a9e){if(!_0x134a9e){_0x594a63['sendStatus'](0x194);}return _0x134a9e;};}function handleError(_0x17bb46,_0x158356){_0x158356=_0x158356||0x1f4;return function(_0x4f684c){logger[_0x7254('0x29')](_0x4f684c[_0x7254('0x2a')]);if(_0x4f684c[_0x7254('0x2b')]){delete _0x4f684c[_0x7254('0x2b')];}_0x17bb46[_0x7254('0x18')](_0x158356)[_0x7254('0x2c')](_0x4f684c);};}exports['index']=function(_0x146028,_0x2dba3f){var _0x5569be={},_0x2f75ea={},_0x1279cd={'count':0x0,'rows':[]};var _0x2be5fc=_['map'](db[_0x7254('0x2d')][_0x7254('0x2e')],function(_0x354305){return{'name':_0x354305[_0x7254('0x2f')],'type':_0x354305[_0x7254('0x30')][_0x7254('0x31')]};});_0x2f75ea[_0x7254('0x32')]=_['map'](_0x2be5fc,_0x7254('0x2b'));_0x2f75ea['query']=_['keys'](_0x146028[_0x7254('0x33')]);_0x2f75ea[_0x7254('0x34')]=_[_0x7254('0x35')](_0x2f75ea[_0x7254('0x32')],_0x2f75ea[_0x7254('0x33')]);_0x5569be[_0x7254('0x36')]=_[_0x7254('0x35')](_0x2f75ea[_0x7254('0x32')],qs[_0x7254('0x37')](_0x146028[_0x7254('0x33')][_0x7254('0x37')]));_0x5569be[_0x7254('0x36')]=_0x5569be[_0x7254('0x36')][_0x7254('0x38')]?_0x5569be['attributes']:_0x2f75ea[_0x7254('0x32')];if(!_0x146028[_0x7254('0x33')][_0x7254('0x39')](_0x7254('0x3a'))){_0x5569be[_0x7254('0x1d')]=qs['limit'](_0x146028[_0x7254('0x33')]['limit']);_0x5569be[_0x7254('0x1b')]=qs[_0x7254('0x1b')](_0x146028[_0x7254('0x33')][_0x7254('0x1b')]);}_0x5569be[_0x7254('0x3b')]=qs['sort'](_0x146028[_0x7254('0x33')]['sort']);_0x5569be[_0x7254('0x3c')]=qs[_0x7254('0x34')](_['pick'](_0x146028[_0x7254('0x33')],_0x2f75ea[_0x7254('0x34')]),_0x2be5fc);if(_0x146028[_0x7254('0x33')][_0x7254('0x3d')]){_0x5569be[_0x7254('0x3c')]=_[_0x7254('0x3e')](_0x5569be['where'],{'$or':_[_0x7254('0x3f')](_0x2be5fc,function(_0x102d87){if(_0x102d87[_0x7254('0x30')]!=='VIRTUAL'){var _0x3fbad7={};_0x3fbad7[_0x102d87[_0x7254('0x2b')]]={'$like':'%'+_0x146028[_0x7254('0x33')]['filter']+'%'};return _0x3fbad7;}})});}_0x5569be=_[_0x7254('0x3e')]({},_0x5569be,_0x146028[_0x7254('0x40')]);var _0x18a918={'where':_0x5569be[_0x7254('0x3c')]};return db[_0x7254('0x2d')]['count'](_0x18a918)['then'](function(_0x25004f){_0x1279cd[_0x7254('0x1e')]=_0x25004f;if(_0x146028[_0x7254('0x33')][_0x7254('0x41')]){_0x5569be['include']=[{'all':!![]}];}return db['VoiceChanSpy'][_0x7254('0x42')](_0x5569be);})['then'](function(_0x2ae22e){_0x1279cd[_0x7254('0x43')]=_0x2ae22e;return _0x1279cd;})[_0x7254('0x25')](respondWithFilteredResult(_0x2dba3f,_0x5569be))[_0x7254('0x44')](handleError(_0x2dba3f,null));};exports['show']=function(_0x4adf34,_0x467f31){var _0x3f6ead={'raw':![],'where':{'id':_0x4adf34[_0x7254('0x45')]['id']}},_0x29b90c={};_0x29b90c[_0x7254('0x32')]=_['keys'](db['VoiceChanSpy'][_0x7254('0x2e')]);_0x29b90c[_0x7254('0x33')]=_[_0x7254('0x46')](_0x4adf34['query']);_0x29b90c[_0x7254('0x34')]=_[_0x7254('0x35')](_0x29b90c['model'],_0x29b90c[_0x7254('0x33')]);_0x3f6ead[_0x7254('0x36')]=_[_0x7254('0x35')](_0x29b90c[_0x7254('0x32')],qs['fields'](_0x4adf34[_0x7254('0x33')][_0x7254('0x37')]));_0x3f6ead['attributes']=_0x3f6ead[_0x7254('0x36')][_0x7254('0x38')]?_0x3f6ead[_0x7254('0x36')]:_0x29b90c['model'];if(_0x4adf34[_0x7254('0x33')][_0x7254('0x41')]){_0x3f6ead['include']=[{'all':!![]}];}_0x3f6ead=_['merge']({},_0x3f6ead,_0x4adf34[_0x7254('0x40')]);return db['VoiceChanSpy'][_0x7254('0x47')](_0x3f6ead)[_0x7254('0x25')](handleEntityNotFound(_0x467f31,null))['then'](respondWithResult(_0x467f31,null))['catch'](handleError(_0x467f31,null));};exports[_0x7254('0x48')]=function(_0xc40bc5,_0x38bcd5){return db[_0x7254('0x2d')][_0x7254('0x48')](_0xc40bc5[_0x7254('0x49')],{})['then'](function(_0x245213){var _0x5ef7f9=_0xc40bc5[_0x7254('0x4a')][_0x7254('0x27')]({'plain':!![]});if(!_0x5ef7f9)throw new Error(_0x7254('0x4b'));if(_0x5ef7f9['role']===_0x7254('0x4a')){var _0x1c1a0e=_0x245213[_0x7254('0x27')]({'plain':!![]});var _0x5b3b6e=_0x7254('0x28');return db[_0x7254('0x4c')][_0x7254('0x47')]({'where':{'name':_0x5b3b6e,'userProfileId':_0x5ef7f9[_0x7254('0x4d')]},'raw':!![]})[_0x7254('0x25')](function(_0x4e1e38){if(_0x4e1e38&&_0x4e1e38['autoAssociation']===0x0){return db[_0x7254('0x4e')][_0x7254('0x48')]({'name':_0x1c1a0e[_0x7254('0x2b')],'resourceId':_0x1c1a0e['id'],'type':_0x4e1e38[_0x7254('0x2b')],'sectionId':_0x4e1e38['id']},{})[_0x7254('0x25')](function(){return _0x245213;});}else{return _0x245213;}})['catch'](function(_0x5a44fb){logger[_0x7254('0x29')](_0x7254('0x4f'),_0x5a44fb);throw _0x5a44fb;});}return _0x245213;})[_0x7254('0x25')](respondWithResult(_0x38bcd5,0xc9))[_0x7254('0x44')](handleError(_0x38bcd5,null));};exports['update']=function(_0xaf6d3d,_0x3e3d09){if(_0xaf6d3d['body']['id']){delete _0xaf6d3d[_0x7254('0x49')]['id'];}return db['VoiceChanSpy'][_0x7254('0x47')]({'where':{'id':_0xaf6d3d['params']['id']}})[_0x7254('0x25')](handleEntityNotFound(_0x3e3d09,null))['then'](saveUpdates(_0xaf6d3d['body'],null))[_0x7254('0x25')](respondWithResult(_0x3e3d09,null))[_0x7254('0x44')](handleError(_0x3e3d09,null));};exports[_0x7254('0x26')]=function(_0x1122e8,_0x4f6c9f){return db[_0x7254('0x2d')]['find']({'where':{'id':_0x1122e8[_0x7254('0x45')]['id']}})[_0x7254('0x25')](handleEntityNotFound(_0x4f6c9f,null))[_0x7254('0x25')](removeEntity(_0x4f6c9f,null))[_0x7254('0x44')](handleError(_0x4f6c9f,null));}; \ No newline at end of file +var _0x1b73=['map','VoiceChanSpy','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','update','then','get','UserProfileResource','error','stack','name','send','index'];(function(_0x4d7530,_0xdee31){var _0x1afc9e=function(_0x2a0c56){while(--_0x2a0c56){_0x4d7530['push'](_0x4d7530['shift']());}};_0x1afc9e(++_0xdee31);}(_0x1b73,0x1d5));var _0x31b7=function(_0x3423f1,_0x3326df){_0x3423f1=_0x3423f1-0x0;var _0x8aeeb=_0x1b73[_0x3423f1];return _0x8aeeb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x31b7('0x0'));var zipdir=require(_0x31b7('0x1'));var jsonpatch=require(_0x31b7('0x2'));var rp=require(_0x31b7('0x3'));var moment=require('moment');var BPromise=require(_0x31b7('0x4'));var Mustache=require('mustache');var util=require(_0x31b7('0x5'));var path=require(_0x31b7('0x6'));var sox=require('sox');var csv=require(_0x31b7('0x7'));var ejs=require(_0x31b7('0x8'));var fs=require('fs');var fs_extra=require(_0x31b7('0x9'));var _=require('lodash');var squel=require(_0x31b7('0xa'));var crypto=require(_0x31b7('0xb'));var jsforce=require(_0x31b7('0xc'));var deskjs=require(_0x31b7('0xd'));var toCsv=require(_0x31b7('0x7'));var querystring=require(_0x31b7('0xe'));var Papa=require(_0x31b7('0xf'));var Redis=require('ioredis');var authService=require(_0x31b7('0x10'));var qs=require(_0x31b7('0x11'));var as=require(_0x31b7('0x12'));var hardwareService=require(_0x31b7('0x13'));var logger=require(_0x31b7('0x14'))(_0x31b7('0x15'));var utils=require(_0x31b7('0x16'));var config=require(_0x31b7('0x17'));var licenseUtil=require(_0x31b7('0x18'));var db=require(_0x31b7('0x19'))['db'];function respondWithStatusCode(_0x492612,_0x32afeb){_0x32afeb=_0x32afeb||0xcc;return function(_0x55e1bb){if(_0x55e1bb){return _0x492612[_0x31b7('0x1a')](_0x32afeb);}return _0x492612[_0x31b7('0x1b')](_0x32afeb)[_0x31b7('0x1c')]();};}function respondWithResult(_0x1969d2,_0x7988e2){_0x7988e2=_0x7988e2||0xc8;return function(_0x34e917){if(_0x34e917){return _0x1969d2[_0x31b7('0x1b')](_0x7988e2)['json'](_0x34e917);}};}function respondWithFilteredResult(_0x1e93fb,_0x491c98){return function(_0x210f18){if(_0x210f18){var _0xf213c9=typeof _0x491c98['offset']===_0x31b7('0x1d')&&typeof _0x491c98[_0x31b7('0x1e')]===_0x31b7('0x1d');var _0x39eee9=_0x210f18[_0x31b7('0x1f')];var _0x5f3245=_0xf213c9?0x0:_0x491c98[_0x31b7('0x20')];var _0x437eba=_0xf213c9?_0x210f18[_0x31b7('0x1f')]:_0x491c98[_0x31b7('0x20')]+_0x491c98[_0x31b7('0x1e')];var _0x4b8ab1;if(_0x437eba>=_0x39eee9){_0x437eba=_0x39eee9;_0x4b8ab1=0xc8;}else{_0x4b8ab1=0xce;}_0x1e93fb[_0x31b7('0x1b')](_0x4b8ab1);return _0x1e93fb[_0x31b7('0x21')](_0x31b7('0x22'),_0x5f3245+'-'+_0x437eba+'/'+_0x39eee9)[_0x31b7('0x23')](_0x210f18);}return null;};}function patchUpdates(_0x5b56bc){return function(_0x892fe4){try{jsonpatch[_0x31b7('0x24')](_0x892fe4,_0x5b56bc,!![]);}catch(_0x424318){return BPromise[_0x31b7('0x25')](_0x424318);}return _0x892fe4['save']();};}function saveUpdates(_0x33dd04,_0x20cb03){return function(_0x250574){if(_0x250574){return _0x250574[_0x31b7('0x26')](_0x33dd04)[_0x31b7('0x27')](function(_0x2d24bf){return _0x2d24bf;});}return null;};}function removeEntity(_0x36492c,_0x20e5b0){return function(_0x3b0eff){if(_0x3b0eff){return _0x3b0eff['destroy']()[_0x31b7('0x27')](function(){var _0x35a51f=_0x3b0eff[_0x31b7('0x28')]({'plain':!![]});var _0x2c993b='ChanSpies';return db[_0x31b7('0x29')]['destroy']({'where':{'type':_0x2c993b,'resourceId':_0x35a51f['id']}})[_0x31b7('0x27')](function(){return _0x3b0eff;});})[_0x31b7('0x27')](function(){_0x36492c[_0x31b7('0x1b')](0xcc)[_0x31b7('0x1c')]();});}};}function handleEntityNotFound(_0xffacb,_0x128865){return function(_0x21ab03){if(!_0x21ab03){_0xffacb[_0x31b7('0x1a')](0x194);}return _0x21ab03;};}function handleError(_0x4e58e5,_0x47ef33){_0x47ef33=_0x47ef33||0x1f4;return function(_0x503549){logger[_0x31b7('0x2a')](_0x503549[_0x31b7('0x2b')]);if(_0x503549[_0x31b7('0x2c')]){delete _0x503549['name'];}_0x4e58e5[_0x31b7('0x1b')](_0x47ef33)[_0x31b7('0x2d')](_0x503549);};}exports[_0x31b7('0x2e')]=function(_0x277273,_0x58a87e){var _0x5b0ed2={},_0x34c62a={},_0x4b5cf9={'count':0x0,'rows':[]};var _0x574dfe=_[_0x31b7('0x2f')](db[_0x31b7('0x30')][_0x31b7('0x31')],function(_0x35f83c){return{'name':_0x35f83c['fieldName'],'type':_0x35f83c['type'][_0x31b7('0x32')]};});_0x34c62a[_0x31b7('0x33')]=_[_0x31b7('0x2f')](_0x574dfe,_0x31b7('0x2c'));_0x34c62a[_0x31b7('0x34')]=_['keys'](_0x277273['query']);_0x34c62a[_0x31b7('0x35')]=_[_0x31b7('0x36')](_0x34c62a['model'],_0x34c62a[_0x31b7('0x34')]);_0x5b0ed2[_0x31b7('0x37')]=_['intersection'](_0x34c62a[_0x31b7('0x33')],qs[_0x31b7('0x38')](_0x277273[_0x31b7('0x34')][_0x31b7('0x38')]));_0x5b0ed2[_0x31b7('0x37')]=_0x5b0ed2[_0x31b7('0x37')][_0x31b7('0x39')]?_0x5b0ed2[_0x31b7('0x37')]:_0x34c62a[_0x31b7('0x33')];if(!_0x277273[_0x31b7('0x34')][_0x31b7('0x3a')](_0x31b7('0x3b'))){_0x5b0ed2[_0x31b7('0x1e')]=qs['limit'](_0x277273['query'][_0x31b7('0x1e')]);_0x5b0ed2[_0x31b7('0x20')]=qs[_0x31b7('0x20')](_0x277273[_0x31b7('0x34')][_0x31b7('0x20')]);}_0x5b0ed2[_0x31b7('0x3c')]=qs[_0x31b7('0x3d')](_0x277273[_0x31b7('0x34')][_0x31b7('0x3d')]);_0x5b0ed2[_0x31b7('0x3e')]=qs['filters'](_[_0x31b7('0x3f')](_0x277273[_0x31b7('0x34')],_0x34c62a[_0x31b7('0x35')]),_0x574dfe);if(_0x277273[_0x31b7('0x34')]['filter']){_0x5b0ed2[_0x31b7('0x3e')]=_[_0x31b7('0x40')](_0x5b0ed2['where'],{'$or':_[_0x31b7('0x2f')](_0x574dfe,function(_0x5724fa){if(_0x5724fa['type']!==_0x31b7('0x41')){var _0x10e82c={};_0x10e82c[_0x5724fa[_0x31b7('0x2c')]]={'$like':'%'+_0x277273[_0x31b7('0x34')][_0x31b7('0x42')]+'%'};return _0x10e82c;}})});}_0x5b0ed2=_['merge']({},_0x5b0ed2,_0x277273[_0x31b7('0x43')]);var _0x5d01ee={'where':_0x5b0ed2['where']};return db['VoiceChanSpy'][_0x31b7('0x1f')](_0x5d01ee)[_0x31b7('0x27')](function(_0x1527b3){_0x4b5cf9[_0x31b7('0x1f')]=_0x1527b3;if(_0x277273[_0x31b7('0x34')]['includeAll']){_0x5b0ed2[_0x31b7('0x44')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x31b7('0x45')](_0x5b0ed2);})[_0x31b7('0x27')](function(_0x41c92e){_0x4b5cf9[_0x31b7('0x46')]=_0x41c92e;return _0x4b5cf9;})['then'](respondWithFilteredResult(_0x58a87e,_0x5b0ed2))[_0x31b7('0x47')](handleError(_0x58a87e,null));};exports[_0x31b7('0x48')]=function(_0x1046fb,_0x4b3d24){var _0x31fd89={'raw':![],'where':{'id':_0x1046fb[_0x31b7('0x49')]['id']}},_0x51918d={};_0x51918d[_0x31b7('0x33')]=_['keys'](db[_0x31b7('0x30')][_0x31b7('0x31')]);_0x51918d[_0x31b7('0x34')]=_[_0x31b7('0x4a')](_0x1046fb['query']);_0x51918d[_0x31b7('0x35')]=_['intersection'](_0x51918d['model'],_0x51918d[_0x31b7('0x34')]);_0x31fd89[_0x31b7('0x37')]=_[_0x31b7('0x36')](_0x51918d[_0x31b7('0x33')],qs['fields'](_0x1046fb[_0x31b7('0x34')][_0x31b7('0x38')]));_0x31fd89['attributes']=_0x31fd89[_0x31b7('0x37')][_0x31b7('0x39')]?_0x31fd89[_0x31b7('0x37')]:_0x51918d['model'];if(_0x1046fb[_0x31b7('0x34')][_0x31b7('0x4b')]){_0x31fd89[_0x31b7('0x44')]=[{'all':!![]}];}_0x31fd89=_[_0x31b7('0x40')]({},_0x31fd89,_0x1046fb[_0x31b7('0x43')]);return db[_0x31b7('0x30')][_0x31b7('0x4c')](_0x31fd89)[_0x31b7('0x27')](handleEntityNotFound(_0x4b3d24,null))['then'](respondWithResult(_0x4b3d24,null))[_0x31b7('0x47')](handleError(_0x4b3d24,null));};exports['create']=function(_0x5a72ee,_0x22cc77){return db[_0x31b7('0x30')][_0x31b7('0x4d')](_0x5a72ee[_0x31b7('0x4e')],{})['then'](function(_0x322798){var _0x18556b=_0x5a72ee[_0x31b7('0x4f')]['get']({'plain':!![]});if(!_0x18556b)throw new Error(_0x31b7('0x50'));if(_0x18556b[_0x31b7('0x51')]===_0x31b7('0x4f')){var _0x3b5868=_0x322798[_0x31b7('0x28')]({'plain':!![]});var _0x309077=_0x31b7('0x52');return db[_0x31b7('0x53')]['find']({'where':{'name':_0x309077,'userProfileId':_0x18556b['userProfileId']},'raw':!![]})[_0x31b7('0x27')](function(_0x1d55e6){if(_0x1d55e6&&_0x1d55e6[_0x31b7('0x54')]===0x0){return db[_0x31b7('0x29')]['create']({'name':_0x3b5868['name'],'resourceId':_0x3b5868['id'],'type':_0x1d55e6[_0x31b7('0x2c')],'sectionId':_0x1d55e6['id']},{})[_0x31b7('0x27')](function(){return _0x322798;});}else{return _0x322798;}})[_0x31b7('0x47')](function(_0x5ea605){logger[_0x31b7('0x2a')](_0x31b7('0x55'),_0x5ea605);throw _0x5ea605;});}return _0x322798;})[_0x31b7('0x27')](respondWithResult(_0x22cc77,0xc9))[_0x31b7('0x47')](handleError(_0x22cc77,null));};exports['update']=function(_0x535a3c,_0x43c1ee){if(_0x535a3c[_0x31b7('0x4e')]['id']){delete _0x535a3c[_0x31b7('0x4e')]['id'];}return db[_0x31b7('0x30')][_0x31b7('0x4c')]({'where':{'id':_0x535a3c[_0x31b7('0x49')]['id']}})[_0x31b7('0x27')](handleEntityNotFound(_0x43c1ee,null))[_0x31b7('0x27')](saveUpdates(_0x535a3c[_0x31b7('0x4e')],null))[_0x31b7('0x27')](respondWithResult(_0x43c1ee,null))['catch'](handleError(_0x43c1ee,null));};exports['destroy']=function(_0x4bd00d,_0x954c){return db[_0x31b7('0x30')][_0x31b7('0x4c')]({'where':{'id':_0x4bd00d['params']['id']}})[_0x31b7('0x27')](handleEntityNotFound(_0x954c,null))[_0x31b7('0x27')](removeEntity(_0x954c,null))[_0x31b7('0x47')](handleError(_0x954c,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index b47611f..d070522 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 _0x8bdc=['format','%s%s','prefix','system','merge','Set','CDR(type)=%s','record','push','MixMonitor','recordingFormat','auth','Authenticate','SIP/%s,%s','options','StopMixMonitor','length','internal','name','User','findAll','agent','then','catch','exports','models','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','util','./voiceChanSpy.attributes','context','from-sip'];(function(_0x202b92,_0x5f48f5){var _0x2899f7=function(_0x489c7f){while(--_0x489c7f){_0x202b92['push'](_0x202b92['shift']());}};_0x2899f7(++_0x5f48f5);}(_0x8bdc,0xce));var _0xc8bd=function(_0x15f67d,_0x3eb8dc){_0x15f67d=_0x15f67d-0x0;var _0x21a2e4=_0x8bdc[_0x15f67d];return _0x21a2e4;};'use strict';var _=require('lodash');var util=require(_0xc8bd('0x0'));var BPromise=require('bluebird');var attributes=require(_0xc8bd('0x1'));var getUserApplications=function(_0x3bcee1,_0x5b906a,_0x18507a){var _0x336507=0x1;var _0x4f131a=[];var _0x2f7804={'context':_0x5b906a[_0xc8bd('0x2')]||_0xc8bd('0x3'),'exten':util[_0xc8bd('0x4')](_0xc8bd('0x5'),_0x3bcee1[_0xc8bd('0x6')],_0x18507a),'type':_0xc8bd('0x7'),'isApp':![],'ChanSpyId':_0x3bcee1['id'],'UserId':_0x5b906a['id']};_0x4f131a['push'](_[_0xc8bd('0x8')]({'app':_0xc8bd('0x9'),'appdata':util[_0xc8bd('0x4')](_0xc8bd('0xa'),'chanspy'),'priority':_0x336507++},_0x2f7804));if(_0x3bcee1[_0xc8bd('0xb')]){_0x4f131a[_0xc8bd('0xc')](_['merge']({'app':_0xc8bd('0xd'),'appdata':util[_0xc8bd('0x4')]('${UNIQUEID}.%s,a',_0x3bcee1[_0xc8bd('0xe')]),'priority':_0x336507++},_0x2f7804));}if(_0x3bcee1[_0xc8bd('0xf')]){_0x4f131a['push'](_[_0xc8bd('0x8')]({'app':_0xc8bd('0x10'),'appdata':_0x3bcee1['password'],'priority':_0x336507++},_0x2f7804));}_0x4f131a[_0xc8bd('0xc')](_['merge']({'app':'ChanSpy','appdata':util['format'](_0xc8bd('0x11'),_0x5b906a['name'],_0x3bcee1[_0xc8bd('0x12')]?_0x3bcee1[_0xc8bd('0x12')]['join'](''):''),'priority':_0x336507++},_0x2f7804));if(_0x3bcee1[_0xc8bd('0xb')]){_0x4f131a[_0xc8bd('0xc')](_[_0xc8bd('0x8')]({'app':_0xc8bd('0x13'),'priority':_0x336507++},_0x2f7804));}return _0x4f131a;};var getChanSpyApplications=function(_0xc4aef5,_0x54a601){var _0x1dc4ae=[];for(var _0xe61d12=0x0,_0xd4bf6c=0x1;_0xe61d12<_0x54a601[_0xc8bd('0x14')];_0xe61d12++,_0xd4bf6c=0x1){_0x1dc4ae=_0x1dc4ae['concat'](getUserApplications(_0xc4aef5,_0x54a601[_0xe61d12],_0x54a601[_0xe61d12][_0xc8bd('0x15')]));if(_0x54a601[_0xe61d12][_0xc8bd('0x15')]!=_0x54a601[_0xe61d12][_0xc8bd('0x16')]){_0x1dc4ae=_0x1dc4ae['concat'](getUserApplications(_0xc4aef5,_0x54a601[_0xe61d12],_0x54a601[_0xe61d12][_0xc8bd('0x16')]));}}return _0x1dc4ae;};var getChanSpyPromise=function(_0x1ad3c3,_0x28a5e4){return new BPromise(function(_0xf2dfaa,_0x49d555){return _0x1ad3c3[_0xc8bd('0x17')][_0xc8bd('0x18')]({'attributes':['id','name',_0xc8bd('0x15')],'where':{'role':_0xc8bd('0x19'),'chanspy':!![]},'raw':!![]})[_0xc8bd('0x1a')](function(_0x2f7937){if(_0x2f7937){return _0xf2dfaa(getChanSpyApplications(_0x28a5e4,_0x2f7937));}return _0xf2dfaa([]);})[_0xc8bd('0x1b')](function(_0x2713a9){_0x49d555(_0x2713a9);});});};module[_0xc8bd('0x1c')]=function(_0x2200b9,_0x2b9292){var _0x577a3f=_0x2200b9[_0xc8bd('0x1d')];return _0x2200b9['define'](_0xc8bd('0x1e'),attributes,{'tableName':_0xc8bd('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x10d797,_0x5e7335,_0x11e0c5){return getChanSpyPromise(_0x577a3f,_0x10d797)[_0xc8bd('0x1a')](function(_0x439280){if(_0x439280&&_0x439280['length']){return _0x577a3f[_0xc8bd('0x20')][_0xc8bd('0x21')](_0x439280);}})['then'](function(){_0x11e0c5();})['catch'](function(_0x1251db){_0x11e0c5(_0x1251db);});},'afterUpdate':function(_0x41e183,_0x35c01c,_0x550326){return _0x577a3f[_0xc8bd('0x20')][_0xc8bd('0x22')]({'where':{'ChanSpyId':_0x41e183['id']}})[_0xc8bd('0x1a')](function(){return getChanSpyPromise(_0x577a3f,_0x41e183);})[_0xc8bd('0x1a')](function(_0x1e8747){if(_0x1e8747&&_0x1e8747[_0xc8bd('0x14')]){return _0x577a3f[_0xc8bd('0x20')][_0xc8bd('0x21')](_0x1e8747);}})[_0xc8bd('0x1a')](function(){_0x550326();})[_0xc8bd('0x1b')](function(_0x37af77){_0x550326(_0x37af77);});},'afterDestroy':function(_0x4a48b2,_0xbcd1f3,_0x288203){return _0x577a3f[_0xc8bd('0x20')]['destroy']({'where':{'ChanSpyId':_0x4a48b2['id']}})[_0xc8bd('0x1a')](function(){_0x288203();})['catch'](function(_0x4a085f){_0x288203(_0x4a085f);});}}});}; \ No newline at end of file +var _0xadaa=['push','merge','Set','CDR(type)=%s','chanspy','record','${UNIQUEID}.%s,a','recordingFormat','password','SIP/%s,%s','name','options','StopMixMonitor','concat','internal','agent','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','length','VoiceExtension','destroy','bulkCreate','bluebird','./voiceChanSpy.attributes','context','format','%s%s','prefix'];(function(_0x26bbd1,_0xb274f3){var _0x26b1eb=function(_0x4cf794){while(--_0x4cf794){_0x26bbd1['push'](_0x26bbd1['shift']());}};_0x26b1eb(++_0xb274f3);}(_0xadaa,0x165));var _0xaada=function(_0x1cacba,_0x348d3f){_0x1cacba=_0x1cacba-0x0;var _0x22a27f=_0xadaa[_0x1cacba];return _0x22a27f;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0xaada('0x0'));var attributes=require(_0xaada('0x1'));var getUserApplications=function(_0x172e12,_0x19a3c9,_0x284f29){var _0x1081b8=0x1;var _0x3d1973=[];var _0xe9ec7d={'context':_0x19a3c9[_0xaada('0x2')]||'from-sip','exten':util[_0xaada('0x3')](_0xaada('0x4'),_0x172e12[_0xaada('0x5')],_0x284f29),'type':'system','isApp':![],'ChanSpyId':_0x172e12['id'],'UserId':_0x19a3c9['id']};_0x3d1973[_0xaada('0x6')](_[_0xaada('0x7')]({'app':_0xaada('0x8'),'appdata':util[_0xaada('0x3')](_0xaada('0x9'),_0xaada('0xa')),'priority':_0x1081b8++},_0xe9ec7d));if(_0x172e12[_0xaada('0xb')]){_0x3d1973['push'](_['merge']({'app':'MixMonitor','appdata':util[_0xaada('0x3')](_0xaada('0xc'),_0x172e12[_0xaada('0xd')]),'priority':_0x1081b8++},_0xe9ec7d));}if(_0x172e12['auth']){_0x3d1973[_0xaada('0x6')](_['merge']({'app':'Authenticate','appdata':_0x172e12[_0xaada('0xe')],'priority':_0x1081b8++},_0xe9ec7d));}_0x3d1973[_0xaada('0x6')](_[_0xaada('0x7')]({'app':'ChanSpy','appdata':util[_0xaada('0x3')](_0xaada('0xf'),_0x19a3c9[_0xaada('0x10')],_0x172e12[_0xaada('0x11')]?_0x172e12[_0xaada('0x11')]['join'](''):''),'priority':_0x1081b8++},_0xe9ec7d));if(_0x172e12[_0xaada('0xb')]){_0x3d1973[_0xaada('0x6')](_[_0xaada('0x7')]({'app':_0xaada('0x12'),'priority':_0x1081b8++},_0xe9ec7d));}return _0x3d1973;};var getChanSpyApplications=function(_0x1c72ec,_0x50100d){var _0x2a3877=[];for(var _0xa7467c=0x0,_0x2b0d89=0x1;_0xa7467c<_0x50100d['length'];_0xa7467c++,_0x2b0d89=0x1){_0x2a3877=_0x2a3877[_0xaada('0x13')](getUserApplications(_0x1c72ec,_0x50100d[_0xa7467c],_0x50100d[_0xa7467c]['internal']));if(_0x50100d[_0xa7467c][_0xaada('0x14')]!=_0x50100d[_0xa7467c][_0xaada('0x10')]){_0x2a3877=_0x2a3877[_0xaada('0x13')](getUserApplications(_0x1c72ec,_0x50100d[_0xa7467c],_0x50100d[_0xa7467c]['name']));}}return _0x2a3877;};var getChanSpyPromise=function(_0x5ad417,_0x50ac0f){return new BPromise(function(_0x5bc141,_0x122676){return _0x5ad417['User']['findAll']({'attributes':['id',_0xaada('0x10'),_0xaada('0x14')],'where':{'role':_0xaada('0x15'),'chanspy':!![]},'raw':!![]})[_0xaada('0x16')](function(_0x1e7f9f){if(_0x1e7f9f){return _0x5bc141(getChanSpyApplications(_0x50ac0f,_0x1e7f9f));}return _0x5bc141([]);})[_0xaada('0x17')](function(_0x10d930){_0x122676(_0x10d930);});});};module[_0xaada('0x18')]=function(_0x8af9ba,_0x45665e){var _0x183695=_0x8af9ba[_0xaada('0x19')];return _0x8af9ba[_0xaada('0x1a')](_0xaada('0x1b'),attributes,{'tableName':_0xaada('0x1c'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x21fc8b,_0x4f2022,_0x17f647){return getChanSpyPromise(_0x183695,_0x21fc8b)[_0xaada('0x16')](function(_0x45fa0e){if(_0x45fa0e&&_0x45fa0e[_0xaada('0x1d')]){return _0x183695['VoiceExtension']['bulkCreate'](_0x45fa0e);}})[_0xaada('0x16')](function(){_0x17f647();})[_0xaada('0x17')](function(_0x2c7880){_0x17f647(_0x2c7880);});},'afterUpdate':function(_0x302f4c,_0x41d5fb,_0x17acbb){return _0x183695[_0xaada('0x1e')][_0xaada('0x1f')]({'where':{'ChanSpyId':_0x302f4c['id']}})[_0xaada('0x16')](function(){return getChanSpyPromise(_0x183695,_0x302f4c);})['then'](function(_0xdb3e33){if(_0xdb3e33&&_0xdb3e33[_0xaada('0x1d')]){return _0x183695[_0xaada('0x1e')][_0xaada('0x20')](_0xdb3e33);}})['then'](function(){_0x17acbb();})[_0xaada('0x17')](function(_0x2a4900){_0x17acbb(_0x2a4900);});},'afterDestroy':function(_0x5a8bf4,_0x5f9779,_0x157c2a){return _0x183695[_0xaada('0x1e')][_0xaada('0x1f')]({'where':{'ChanSpyId':_0x5a8bf4['id']}})[_0xaada('0x16')](function(){_0x157c2a();})[_0xaada('0x17')](function(_0x5690c8){_0x157c2a(_0x5690c8);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 31b162f..3729624 100644 --- a/server/api/voiceChanSpy/voiceChanSpy.rpc.js +++ b/server/api/voiceChanSpy/voiceChanSpy.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x765e=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x765e,0x131));var _0xe765=function(_0x581bf1,_0x40f867){_0x581bf1=_0x581bf1-0x0;var _0x17bb7f=_0x765e[_0x581bf1];return _0x17bb7f;};'use strict';var _=require(_0xe765('0x0'));var util=require(_0xe765('0x1'));var moment=require(_0xe765('0x2'));var BPromise=require(_0xe765('0x3'));var rs=require(_0xe765('0x4'));var fs=require('fs');var Redis=require(_0xe765('0x5'));var db=require(_0xe765('0x6'))['db'];var utils=require(_0xe765('0x7'));var logger=require(_0xe765('0x8'))(_0xe765('0x9'));var config=require(_0xe765('0xa'));var jayson=require(_0xe765('0xb'));var client=jayson[_0xe765('0xc')][_0xe765('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xdd89e7,_0x504542,_0x35d891){return new BPromise(function(_0x28e955,_0x27b0f4){return client[_0xe765('0xe')](_0xdd89e7,_0x35d891)[_0xe765('0xf')](function(_0x41801f){logger[_0xe765('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x504542,_0xe765('0x11'));logger[_0xe765('0x12')](_0xe765('0x13'),_0x504542,'request\x20sent',JSON[_0xe765('0x14')](_0x41801f));if(_0x41801f['error']){if(_0x41801f['error']['code']===0x1f4){logger[_0xe765('0x15')](_0xe765('0x16'),_0x504542,_0x41801f[_0xe765('0x15')][_0xe765('0x17')]);return _0x27b0f4(_0x41801f[_0xe765('0x15')]['message']);}logger[_0xe765('0x15')](_0xe765('0x16'),_0x504542,_0x41801f[_0xe765('0x15')][_0xe765('0x17')]);return _0x28e955(_0x41801f[_0xe765('0x15')]['message']);}else{logger['info'](_0xe765('0x16'),_0x504542,_0xe765('0x11'));_0x28e955(_0x41801f[_0xe765('0x18')]['message']);}})[_0xe765('0x19')](function(_0x36aca3){logger[_0xe765('0x15')](_0xe765('0x16'),_0x504542,_0x36aca3);_0x27b0f4(_0x36aca3);});});} \ No newline at end of file +var _0xfe57=['error','code','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xfe57,0x195));var _0x7fe5=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0xfe57[_0x485b5a];return _0xd2b34d;};'use strict';var _=require(_0x7fe5('0x0'));var util=require(_0x7fe5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7fe5('0x2'));var fs=require('fs');var Redis=require(_0x7fe5('0x3'));var db=require(_0x7fe5('0x4'))['db'];var utils=require(_0x7fe5('0x5'));var logger=require(_0x7fe5('0x6'))(_0x7fe5('0x7'));var config=require(_0x7fe5('0x8'));var jayson=require(_0x7fe5('0x9'));var client=jayson[_0x7fe5('0xa')][_0x7fe5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd6146b,_0x2632de,_0x36ff81){return new BPromise(function(_0x4ab081,_0x13b391){return client['request'](_0xd6146b,_0x36ff81)[_0x7fe5('0xc')](function(_0x2ae7f3){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x2632de,_0x7fe5('0xd'));logger[_0x7fe5('0xe')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x2632de,_0x7fe5('0xd'),JSON['stringify'](_0x2ae7f3));if(_0x2ae7f3['error']){if(_0x2ae7f3[_0x7fe5('0xf')][_0x7fe5('0x10')]===0x1f4){logger[_0x7fe5('0xf')](_0x7fe5('0x11'),_0x2632de,_0x2ae7f3['error'][_0x7fe5('0x12')]);return _0x13b391(_0x2ae7f3[_0x7fe5('0xf')]['message']);}logger[_0x7fe5('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x2632de,_0x2ae7f3[_0x7fe5('0xf')][_0x7fe5('0x12')]);return _0x4ab081(_0x2ae7f3['error'][_0x7fe5('0x12')]);}else{logger['info'](_0x7fe5('0x11'),_0x2632de,_0x7fe5('0xd'));_0x4ab081(_0x2ae7f3[_0x7fe5('0x13')][_0x7fe5('0x12')]);}})[_0x7fe5('0x14')](function(_0x104bc8){logger['error'](_0x7fe5('0x11'),_0x2632de,_0x104bc8);_0x13b391(_0x104bc8);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 75c8ec3..785c12a 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 _0x71f7=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','show','create','put','/:id','update','delete','path','connect-timeout','Router'];(function(_0x5b0e51,_0x50113d){var _0x7aceac=function(_0x4e3e6f){while(--_0x4e3e6f){_0x5b0e51['push'](_0x5b0e51['shift']());}};_0x7aceac(++_0x50113d);}(_0x71f7,0x1dd));var _0x771f=function(_0x4d11fd,_0x1b51f2){_0x4d11fd=_0x4d11fd-0x0;var _0x4f4d3f=_0x71f7[_0x4d11fd];return _0x4f4d3f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x771f('0x0'));var timeout=require(_0x771f('0x1'));var express=require('express');var router=express[_0x771f('0x2')]();var fs_extra=require(_0x771f('0x3'));var auth=require(_0x771f('0x4'));var interaction=require(_0x771f('0x5'));var config=require(_0x771f('0x6'));var controller=require('./voiceContext.controller');router['get']('/',auth[_0x771f('0x7')](),controller[_0x771f('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x771f('0x9')]);router['post']('/',auth[_0x771f('0x7')](),controller[_0x771f('0xa')]);router[_0x771f('0xb')](_0x771f('0xc'),auth[_0x771f('0x7')](),controller[_0x771f('0xd')]);router[_0x771f('0xe')](_0x771f('0xc'),auth[_0x771f('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x411c=['../../components/interaction/service','get','/:id','isAuthenticated','show','post','create','put','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2723be,_0xb5b6ce){var _0x497f87=function(_0x23ba52){while(--_0x23ba52){_0x2723be['push'](_0x2723be['shift']());}};_0x497f87(++_0xb5b6ce);}(_0x411c,0xda));var _0xc411=function(_0x274d2d,_0x321f28){_0x274d2d=_0x274d2d-0x0;var _0x18b4ec=_0x411c[_0x274d2d];return _0x18b4ec;};'use strict';var multer=require(_0xc411('0x0'));var util=require('util');var path=require(_0xc411('0x1'));var timeout=require(_0xc411('0x2'));var express=require(_0xc411('0x3'));var router=express[_0xc411('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc411('0x5'));var interaction=require(_0xc411('0x6'));var config=require('../../config/environment');var controller=require('./voiceContext.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc411('0x7')](_0xc411('0x8'),auth[_0xc411('0x9')](),controller[_0xc411('0xa')]);router[_0xc411('0xb')]('/',auth[_0xc411('0x9')](),controller[_0xc411('0xc')]);router[_0xc411('0xd')](_0xc411('0x8'),auth[_0xc411('0x9')](),controller['update']);router[_0xc411('0xe')](_0xc411('0x8'),auth[_0xc411('0x9')](),controller['destroy']);module[_0xc411('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index f6f1b01..8e32937 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 _0xd483=['sequelize','exports','STRING','name','BOOLEAN'];(function(_0x107eb6,_0x1d42b8){var _0x409d7f=function(_0x1f9084){while(--_0x1f9084){_0x107eb6['push'](_0x107eb6['shift']());}};_0x409d7f(++_0x1d42b8);}(_0xd483,0x87));var _0x3d48=function(_0x19f90a,_0x1ca757){_0x19f90a=_0x19f90a-0x0;var _0x4583c6=_0xd483[_0x19f90a];return _0x4583c6;};'use strict';var Sequelize=require(_0x3d48('0x0'));module[_0x3d48('0x1')]={'name':{'type':Sequelize[_0x3d48('0x2')],'unique':_0x3d48('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x3d48('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0417=['BOOLEAN','STRING','name'];(function(_0x24756b,_0x3aa816){var _0x2c2ac4=function(_0x3b6c1a){while(--_0x3b6c1a){_0x24756b['push'](_0x24756b['shift']());}};_0x2c2ac4(++_0x3aa816);}(_0x0417,0x181));var _0x7041=function(_0x9f8ee,_0x5174a2){_0x9f8ee=_0x9f8ee-0x0;var _0x3ae30c=_0x0417[_0x9f8ee];return _0x3ae30c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7041('0x0')],'unique':_0x7041('0x1')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7041('0x2')],'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 16f4c6e..9933a10 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 _0x6ae5=['then','info','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','request\x20sent','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','get','UserProfileResource','name','send','map','VoiceContext','fieldName','key','model','query','keys','attributes','fields','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','intersection','length','find','create','body','readFileSync','root','render','writeFileSync','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Contexts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','/etc/asterisk/extensions_xcally_contexts.conf','server/files/templates/context.ejs','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','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','http','request'];(function(_0x3478d1,_0x31ab6b){var _0x26fa28=function(_0x176df2){while(--_0x176df2){_0x3478d1['push'](_0x3478d1['shift']());}};_0x26fa28(++_0x31ab6b);}(_0x6ae5,0x1ed));var _0x56ae=function(_0x52595f,_0x59531e){_0x52595f=_0x52595f-0x0;var _0x13a13d=_0x6ae5[_0x52595f];return _0x13a13d;};'use strict';var emlformat=require(_0x56ae('0x0'));var rimraf=require(_0x56ae('0x1'));var zipdir=require(_0x56ae('0x2'));var jsonpatch=require(_0x56ae('0x3'));var rp=require('request-promise');var moment=require(_0x56ae('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x56ae('0x5'));var util=require(_0x56ae('0x6'));var path=require(_0x56ae('0x7'));var sox=require(_0x56ae('0x8'));var csv=require(_0x56ae('0x9'));var ejs=require(_0x56ae('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x56ae('0xb'));var jsforce=require(_0x56ae('0xc'));var deskjs=require(_0x56ae('0xd'));var toCsv=require(_0x56ae('0x9'));var querystring=require(_0x56ae('0xe'));var Papa=require(_0x56ae('0xf'));var Redis=require(_0x56ae('0x10'));var authService=require(_0x56ae('0x11'));var qs=require(_0x56ae('0x12'));var as=require(_0x56ae('0x13'));var hardwareService=require(_0x56ae('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x56ae('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x56ae('0x16'));var db=require(_0x56ae('0x17'))['db'];var jayson=require(_0x56ae('0x18'));var client=jayson['client'][_0x56ae('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x332012,_0x131d10,_0x738049,_0x53b7b6){return new BPromise(function(_0x496768,_0x20bc22){var _0x1c6634=_0x53b7b6||client;return _0x1c6634[_0x56ae('0x1a')](_0x332012,_0x738049)[_0x56ae('0x1b')](function(_0x29f7b3){logger[_0x56ae('0x1c')]('VoiceContext,\x20%s,\x20%s',_0x131d10,'request\x20sent');logger[_0x56ae('0x1d')](_0x56ae('0x1e'),_0x131d10,'request\x20sent',JSON[_0x56ae('0x1f')](_0x29f7b3));if(_0x29f7b3[_0x56ae('0x20')]){if(_0x29f7b3[_0x56ae('0x20')][_0x56ae('0x21')]===0x1f4){logger[_0x56ae('0x20')](_0x56ae('0x22'),_0x131d10,_0x29f7b3[_0x56ae('0x20')]['message']);return _0x20bc22(_0x29f7b3[_0x56ae('0x20')][_0x56ae('0x23')]);}logger[_0x56ae('0x20')](_0x56ae('0x22'),_0x131d10,_0x29f7b3[_0x56ae('0x20')][_0x56ae('0x23')]);return _0x496768(_0x29f7b3[_0x56ae('0x20')][_0x56ae('0x23')]);}else{logger[_0x56ae('0x1c')](_0x56ae('0x22'),_0x131d10,_0x56ae('0x24'));_0x496768(_0x29f7b3['result']['message']);}})['catch'](function(_0x1f0741){logger[_0x56ae('0x20')](_0x56ae('0x22'),_0x131d10,_0x1f0741);_0x20bc22(_0x1f0741);});});}function respondWithStatusCode(_0x1bb207,_0x163ef3){_0x163ef3=_0x163ef3||0xcc;return function(_0x5a1c44){if(_0x5a1c44){return _0x1bb207[_0x56ae('0x25')](_0x163ef3);}return _0x1bb207[_0x56ae('0x26')](_0x163ef3)[_0x56ae('0x27')]();};}function respondWithResult(_0x25545d,_0x1fc1b3){_0x1fc1b3=_0x1fc1b3||0xc8;return function(_0x4934cd){if(_0x4934cd){return _0x25545d['status'](_0x1fc1b3)['json'](_0x4934cd);}};}function respondWithFilteredResult(_0x5a38d0,_0x1466bd){return function(_0x5994b5){if(_0x5994b5){var _0x7349e9=typeof _0x1466bd[_0x56ae('0x28')]==='undefined'&&typeof _0x1466bd[_0x56ae('0x29')]===_0x56ae('0x2a');var _0x43a1a3=_0x5994b5[_0x56ae('0x2b')];var _0x3e8774=_0x7349e9?0x0:_0x1466bd['offset'];var _0x43eb05=_0x7349e9?_0x5994b5[_0x56ae('0x2b')]:_0x1466bd['offset']+_0x1466bd[_0x56ae('0x29')];var _0x3b3d2d;if(_0x43eb05>=_0x43a1a3){_0x43eb05=_0x43a1a3;_0x3b3d2d=0xc8;}else{_0x3b3d2d=0xce;}_0x5a38d0[_0x56ae('0x26')](_0x3b3d2d);return _0x5a38d0[_0x56ae('0x2c')](_0x56ae('0x2d'),_0x3e8774+'-'+_0x43eb05+'/'+_0x43a1a3)[_0x56ae('0x2e')](_0x5994b5);}return null;};}function patchUpdates(_0x6d42d){return function(_0x2a841d){try{jsonpatch[_0x56ae('0x2f')](_0x2a841d,_0x6d42d,!![]);}catch(_0x29afd3){return BPromise[_0x56ae('0x30')](_0x29afd3);}return _0x2a841d[_0x56ae('0x31')]();};}function saveUpdates(_0x4de8d1,_0x2eac1b){return function(_0x123aa9){if(_0x123aa9){return _0x123aa9[_0x56ae('0x32')](_0x4de8d1)['then'](function(_0x117c8a){return _0x117c8a;});}return null;};}function removeEntity(_0x2627ad,_0x3e069c){return function(_0x4f28be){if(_0x4f28be){return _0x4f28be[_0x56ae('0x33')]()[_0x56ae('0x1b')](function(){var _0xfa282f=_0x4f28be[_0x56ae('0x34')]({'plain':!![]});var _0x3c7fd4='Contexts';return db[_0x56ae('0x35')][_0x56ae('0x33')]({'where':{'type':_0x3c7fd4,'resourceId':_0xfa282f['id']}})[_0x56ae('0x1b')](function(){return _0x4f28be;});})[_0x56ae('0x1b')](function(){_0x2627ad[_0x56ae('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57b6a1,_0x49ebf9){return function(_0xfd0c9f){if(!_0xfd0c9f){_0x57b6a1[_0x56ae('0x25')](0x194);}return _0xfd0c9f;};}function handleError(_0x3e279a,_0xfdfffe){_0xfdfffe=_0xfdfffe||0x1f4;return function(_0x22de9d){logger[_0x56ae('0x20')](_0x22de9d['stack']);if(_0x22de9d[_0x56ae('0x36')]){delete _0x22de9d[_0x56ae('0x36')];}_0x3e279a['status'](_0xfdfffe)[_0x56ae('0x37')](_0x22de9d);};}exports['index']=function(_0x5c5b0a,_0x2cfa20){var _0x1311be={},_0x1aeceb={},_0x502413={'count':0x0,'rows':[]};var _0x162354=_[_0x56ae('0x38')](db[_0x56ae('0x39')]['rawAttributes'],function(_0x8c89a4){return{'name':_0x8c89a4[_0x56ae('0x3a')],'type':_0x8c89a4['type'][_0x56ae('0x3b')]};});_0x1aeceb[_0x56ae('0x3c')]=_[_0x56ae('0x38')](_0x162354,'name');_0x1aeceb[_0x56ae('0x3d')]=_[_0x56ae('0x3e')](_0x5c5b0a[_0x56ae('0x3d')]);_0x1aeceb['filters']=_['intersection'](_0x1aeceb['model'],_0x1aeceb[_0x56ae('0x3d')]);_0x1311be[_0x56ae('0x3f')]=_['intersection'](_0x1aeceb[_0x56ae('0x3c')],qs[_0x56ae('0x40')](_0x5c5b0a[_0x56ae('0x3d')][_0x56ae('0x40')]));_0x1311be[_0x56ae('0x3f')]=_0x1311be[_0x56ae('0x3f')]['length']?_0x1311be[_0x56ae('0x3f')]:_0x1aeceb[_0x56ae('0x3c')];if(!_0x5c5b0a['query']['hasOwnProperty'](_0x56ae('0x41'))){_0x1311be[_0x56ae('0x29')]=qs[_0x56ae('0x29')](_0x5c5b0a[_0x56ae('0x3d')][_0x56ae('0x29')]);_0x1311be[_0x56ae('0x28')]=qs[_0x56ae('0x28')](_0x5c5b0a[_0x56ae('0x3d')][_0x56ae('0x28')]);}_0x1311be[_0x56ae('0x42')]=qs[_0x56ae('0x43')](_0x5c5b0a['query'][_0x56ae('0x43')]);_0x1311be[_0x56ae('0x44')]=qs[_0x56ae('0x45')](_[_0x56ae('0x46')](_0x5c5b0a[_0x56ae('0x3d')],_0x1aeceb[_0x56ae('0x45')]),_0x162354);if(_0x5c5b0a[_0x56ae('0x3d')][_0x56ae('0x47')]){_0x1311be[_0x56ae('0x44')]=_['merge'](_0x1311be[_0x56ae('0x44')],{'$or':_['map'](_0x162354,function(_0xda1106){if(_0xda1106[_0x56ae('0x48')]!==_0x56ae('0x49')){var _0x4b761b={};_0x4b761b[_0xda1106[_0x56ae('0x36')]]={'$like':'%'+_0x5c5b0a[_0x56ae('0x3d')][_0x56ae('0x47')]+'%'};return _0x4b761b;}})});}_0x1311be=_[_0x56ae('0x4a')]({},_0x1311be,_0x5c5b0a[_0x56ae('0x4b')]);var _0x5c2bd8={'where':_0x1311be['where']};return db[_0x56ae('0x39')][_0x56ae('0x2b')](_0x5c2bd8)['then'](function(_0x1155c7){_0x502413[_0x56ae('0x2b')]=_0x1155c7;if(_0x5c5b0a[_0x56ae('0x3d')][_0x56ae('0x4c')]){_0x1311be[_0x56ae('0x4d')]=[{'all':!![]}];}return db[_0x56ae('0x39')][_0x56ae('0x4e')](_0x1311be);})[_0x56ae('0x1b')](function(_0x15bbaa){_0x502413[_0x56ae('0x4f')]=_0x15bbaa;return _0x502413;})[_0x56ae('0x1b')](respondWithFilteredResult(_0x2cfa20,_0x1311be))[_0x56ae('0x50')](handleError(_0x2cfa20,null));};exports['show']=function(_0x574ac0,_0x2c768b){var _0x309a42={'raw':![],'where':{'id':_0x574ac0[_0x56ae('0x51')]['id']}},_0x38e5b3={};_0x38e5b3[_0x56ae('0x3c')]=_[_0x56ae('0x3e')](db[_0x56ae('0x39')]['rawAttributes']);_0x38e5b3['query']=_[_0x56ae('0x3e')](_0x574ac0[_0x56ae('0x3d')]);_0x38e5b3['filters']=_['intersection'](_0x38e5b3[_0x56ae('0x3c')],_0x38e5b3[_0x56ae('0x3d')]);_0x309a42[_0x56ae('0x3f')]=_[_0x56ae('0x52')](_0x38e5b3[_0x56ae('0x3c')],qs[_0x56ae('0x40')](_0x574ac0['query']['fields']));_0x309a42['attributes']=_0x309a42['attributes'][_0x56ae('0x53')]?_0x309a42[_0x56ae('0x3f')]:_0x38e5b3[_0x56ae('0x3c')];if(_0x574ac0[_0x56ae('0x3d')][_0x56ae('0x4c')]){_0x309a42[_0x56ae('0x4d')]=[{'all':!![]}];}_0x309a42=_['merge']({},_0x309a42,_0x574ac0[_0x56ae('0x4b')]);return db[_0x56ae('0x39')][_0x56ae('0x54')](_0x309a42)[_0x56ae('0x1b')](handleEntityNotFound(_0x2c768b,null))['then'](respondWithResult(_0x2c768b,null))[_0x56ae('0x50')](handleError(_0x2c768b,null));};exports[_0x56ae('0x55')]=function(_0x51ea7f,_0x193ed5,_0x236c1c){var _0x21ab95;return db[_0x56ae('0x39')][_0x56ae('0x55')](_0x51ea7f[_0x56ae('0x56')],{'raw':!![]})[_0x56ae('0x1b')](function(_0x43db47){_0x21ab95=_0x43db47;return db[_0x56ae('0x39')]['findAll']({'raw':!![]});})[_0x56ae('0x1b')](function(_0x16cdbc){var _0x33e14a=fs[_0x56ae('0x57')](path['join'](config[_0x56ae('0x58')],'server/files/templates/context.ejs'),'utf8');var _0x353c8e=ejs[_0x56ae('0x59')](_0x33e14a,{'contexts':_0x16cdbc||[]});fs[_0x56ae('0x5a')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x353c8e);})[_0x56ae('0x1b')](function(){return respondWithRpcPromise(_0x56ae('0x5b'),_0x56ae('0x55'),{'module':_0x56ae('0x5c')});})[_0x56ae('0x1b')](function(){var _0xe58623=_0x51ea7f[_0x56ae('0x5d')][_0x56ae('0x34')]({'plain':!![]});if(!_0xe58623)throw new Error(_0x56ae('0x5e'));if(_0xe58623[_0x56ae('0x5f')]===_0x56ae('0x5d')){var _0x4e09e6=_0x21ab95[_0x56ae('0x34')]({'plain':!![]});return db[_0x56ae('0x60')]['find']({'where':{'name':_0x56ae('0x61'),'userProfileId':_0xe58623[_0x56ae('0x62')]},'raw':!![]})[_0x56ae('0x1b')](function(_0x8817e8){if(_0x8817e8&&_0x8817e8[_0x56ae('0x63')]===0x0){return db['UserProfileResource'][_0x56ae('0x55')]({'name':_0x4e09e6[_0x56ae('0x36')],'resourceId':_0x4e09e6['id'],'type':_0x8817e8['name'],'sectionId':_0x8817e8['id']},{})['then'](function(){return _0x21ab95;});}else{return _0x21ab95;}})['catch'](function(_0x3fb82b){logger[_0x56ae('0x20')](_0x56ae('0x64'),_0x3fb82b);throw _0x3fb82b;});}return _0x21ab95;})[_0x56ae('0x1b')](respondWithResult(_0x193ed5,0xc9))['catch'](handleError(_0x193ed5,null));};exports[_0x56ae('0x32')]=function(_0x460ca2,_0x8d737b,_0x3b3e72){var _0x180155;return db[_0x56ae('0x39')]['find']({'where':{'id':_0x460ca2['params']['id']}})[_0x56ae('0x1b')](handleEntityNotFound(_0x8d737b,null))[_0x56ae('0x1b')](saveUpdates(_0x460ca2[_0x56ae('0x56')],null))[_0x56ae('0x1b')](function(_0x4b2204){if(_0x4b2204){_0x180155=_0x4b2204;return db[_0x56ae('0x39')][_0x56ae('0x4e')]({'raw':!![]});}})['then'](function(_0x5bb4f5){var _0x204f34=fs[_0x56ae('0x57')](path[_0x56ae('0x65')](config['root'],'server/files/templates/context.ejs'),'utf8');var _0x4bd4bb=ejs[_0x56ae('0x59')](_0x204f34,{'contexts':_0x5bb4f5||[]});fs[_0x56ae('0x5a')](_0x56ae('0x66'),_0x4bd4bb);})[_0x56ae('0x1b')](function(){return respondWithRpcPromise('Reload',_0x56ae('0x32'),{'module':_0x56ae('0x5c')});})[_0x56ae('0x1b')](function(){return _0x180155;})[_0x56ae('0x1b')](respondWithResult(_0x8d737b,null))[_0x56ae('0x50')](handleError(_0x8d737b,null));};exports[_0x56ae('0x33')]=function(_0xb12b83,_0x189417,_0x1d8a25){var _0x5a58ff;return db[_0x56ae('0x39')][_0x56ae('0x54')]({'where':{'id':_0xb12b83['params']['id']}})['then'](handleEntityNotFound(_0x189417,null))[_0x56ae('0x1b')](removeEntity(_0x189417,null))[_0x56ae('0x1b')](function(){return db[_0x56ae('0x39')][_0x56ae('0x4e')]({'raw':!![]});})['then'](function(_0x3ee5e0){var _0x146ed2=fs[_0x56ae('0x57')](path[_0x56ae('0x65')](config['root'],_0x56ae('0x67')),'utf8');var _0x3c6f64=ejs[_0x56ae('0x59')](_0x146ed2,{'contexts':_0x3ee5e0});fs[_0x56ae('0x5a')](_0x56ae('0x66'),_0x3c6f64);return respondWithRpcPromise(_0x56ae('0x5b'),'destroy',{'module':_0x56ae('0x5c')});})[_0x56ae('0x50')](handleError(_0x189417,null));}; \ No newline at end of file +var _0x9bcf=['order','sort','where','filters','filter','merge','map','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','/etc/asterisk/extensions_xcally_contexts.conf','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','info','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','destroy','get','Contexts','UserProfileResource','stack','name','send','index','VoiceContext','rawAttributes','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x9bcf,0xf6));var _0xf9bc=function(_0x217e8d,_0x6c599f){_0x217e8d=_0x217e8d-0x0;var _0x44d7e6=_0x9bcf[_0x217e8d];return _0x44d7e6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf9bc('0x0'));var zipdir=require(_0xf9bc('0x1'));var jsonpatch=require(_0xf9bc('0x2'));var rp=require('request-promise');var moment=require(_0xf9bc('0x3'));var BPromise=require(_0xf9bc('0x4'));var Mustache=require('mustache');var util=require(_0xf9bc('0x5'));var path=require('path');var sox=require(_0xf9bc('0x6'));var csv=require(_0xf9bc('0x7'));var ejs=require(_0xf9bc('0x8'));var fs=require('fs');var fs_extra=require(_0xf9bc('0x9'));var _=require(_0xf9bc('0xa'));var squel=require(_0xf9bc('0xb'));var crypto=require(_0xf9bc('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf9bc('0xd'));var toCsv=require(_0xf9bc('0x7'));var querystring=require(_0xf9bc('0xe'));var Papa=require(_0xf9bc('0xf'));var Redis=require(_0xf9bc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf9bc('0x11'));var as=require(_0xf9bc('0x12'));var hardwareService=require(_0xf9bc('0x13'));var logger=require(_0xf9bc('0x14'))(_0xf9bc('0x15'));var utils=require(_0xf9bc('0x16'));var config=require(_0xf9bc('0x17'));var licenseUtil=require(_0xf9bc('0x18'));var db=require(_0xf9bc('0x19'))['db'];var jayson=require(_0xf9bc('0x1a'));var client=jayson['client'][_0xf9bc('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x6393bc,_0xb0a26,_0x1a042b,_0x1cb9eb){return new BPromise(function(_0xf31866,_0x3a3a1e){var _0x27b1e1=_0x1cb9eb||client;return _0x27b1e1[_0xf9bc('0x1c')](_0x6393bc,_0x1a042b)[_0xf9bc('0x1d')](function(_0x39860f){logger[_0xf9bc('0x1e')]('VoiceContext,\x20%s,\x20%s',_0xb0a26,'request\x20sent');logger[_0xf9bc('0x1f')](_0xf9bc('0x20'),_0xb0a26,_0xf9bc('0x21'),JSON['stringify'](_0x39860f));if(_0x39860f['error']){if(_0x39860f[_0xf9bc('0x22')][_0xf9bc('0x23')]===0x1f4){logger[_0xf9bc('0x22')](_0xf9bc('0x24'),_0xb0a26,_0x39860f['error'][_0xf9bc('0x25')]);return _0x3a3a1e(_0x39860f['error']['message']);}logger[_0xf9bc('0x22')](_0xf9bc('0x24'),_0xb0a26,_0x39860f[_0xf9bc('0x22')][_0xf9bc('0x25')]);return _0xf31866(_0x39860f[_0xf9bc('0x22')][_0xf9bc('0x25')]);}else{logger[_0xf9bc('0x1e')](_0xf9bc('0x24'),_0xb0a26,'request\x20sent');_0xf31866(_0x39860f[_0xf9bc('0x26')][_0xf9bc('0x25')]);}})[_0xf9bc('0x27')](function(_0x3045e0){logger['error'](_0xf9bc('0x24'),_0xb0a26,_0x3045e0);_0x3a3a1e(_0x3045e0);});});}function respondWithStatusCode(_0x4db8c2,_0x3c25b6){_0x3c25b6=_0x3c25b6||0xcc;return function(_0x404bc5){if(_0x404bc5){return _0x4db8c2[_0xf9bc('0x28')](_0x3c25b6);}return _0x4db8c2[_0xf9bc('0x29')](_0x3c25b6)[_0xf9bc('0x2a')]();};}function respondWithResult(_0x9644f7,_0x2e3b96){_0x2e3b96=_0x2e3b96||0xc8;return function(_0x601a8d){if(_0x601a8d){return _0x9644f7[_0xf9bc('0x29')](_0x2e3b96)[_0xf9bc('0x2b')](_0x601a8d);}};}function respondWithFilteredResult(_0x5cf0b3,_0x1edb10){return function(_0x4d298d){if(_0x4d298d){var _0x513c9c=typeof _0x1edb10['offset']===_0xf9bc('0x2c')&&typeof _0x1edb10[_0xf9bc('0x2d')]===_0xf9bc('0x2c');var _0x4b6990=_0x4d298d[_0xf9bc('0x2e')];var _0x107831=_0x513c9c?0x0:_0x1edb10[_0xf9bc('0x2f')];var _0x10342f=_0x513c9c?_0x4d298d[_0xf9bc('0x2e')]:_0x1edb10[_0xf9bc('0x2f')]+_0x1edb10[_0xf9bc('0x2d')];var _0x227374;if(_0x10342f>=_0x4b6990){_0x10342f=_0x4b6990;_0x227374=0xc8;}else{_0x227374=0xce;}_0x5cf0b3['status'](_0x227374);return _0x5cf0b3[_0xf9bc('0x30')](_0xf9bc('0x31'),_0x107831+'-'+_0x10342f+'/'+_0x4b6990)[_0xf9bc('0x2b')](_0x4d298d);}return null;};}function patchUpdates(_0x39f1b4){return function(_0x1250cc){try{jsonpatch['apply'](_0x1250cc,_0x39f1b4,!![]);}catch(_0x4ea561){return BPromise['reject'](_0x4ea561);}return _0x1250cc[_0xf9bc('0x32')]();};}function saveUpdates(_0x30aeb3,_0x21213c){return function(_0x394a8e){if(_0x394a8e){return _0x394a8e[_0xf9bc('0x33')](_0x30aeb3)['then'](function(_0xd9b7af){return _0xd9b7af;});}return null;};}function removeEntity(_0x5f1178,_0x5367f2){return function(_0x31ded4){if(_0x31ded4){return _0x31ded4[_0xf9bc('0x34')]()['then'](function(){var _0x21136b=_0x31ded4[_0xf9bc('0x35')]({'plain':!![]});var _0x4c136f=_0xf9bc('0x36');return db[_0xf9bc('0x37')]['destroy']({'where':{'type':_0x4c136f,'resourceId':_0x21136b['id']}})[_0xf9bc('0x1d')](function(){return _0x31ded4;});})[_0xf9bc('0x1d')](function(){_0x5f1178[_0xf9bc('0x29')](0xcc)[_0xf9bc('0x2a')]();});}};}function handleEntityNotFound(_0x29325b,_0x491f71){return function(_0x56b391){if(!_0x56b391){_0x29325b['sendStatus'](0x194);}return _0x56b391;};}function handleError(_0x17b183,_0x35874e){_0x35874e=_0x35874e||0x1f4;return function(_0x40e624){logger['error'](_0x40e624[_0xf9bc('0x38')]);if(_0x40e624[_0xf9bc('0x39')]){delete _0x40e624[_0xf9bc('0x39')];}_0x17b183[_0xf9bc('0x29')](_0x35874e)[_0xf9bc('0x3a')](_0x40e624);};}exports[_0xf9bc('0x3b')]=function(_0x431456,_0x34a055){var _0x51ffd7={},_0x15d35f={},_0x369369={'count':0x0,'rows':[]};var _0x469115=_['map'](db[_0xf9bc('0x3c')][_0xf9bc('0x3d')],function(_0x35ab40){return{'name':_0x35ab40['fieldName'],'type':_0x35ab40[_0xf9bc('0x3e')]['key']};});_0x15d35f[_0xf9bc('0x3f')]=_['map'](_0x469115,'name');_0x15d35f['query']=_[_0xf9bc('0x40')](_0x431456[_0xf9bc('0x41')]);_0x15d35f['filters']=_[_0xf9bc('0x42')](_0x15d35f['model'],_0x15d35f['query']);_0x51ffd7[_0xf9bc('0x43')]=_[_0xf9bc('0x42')](_0x15d35f[_0xf9bc('0x3f')],qs[_0xf9bc('0x44')](_0x431456['query'][_0xf9bc('0x44')]));_0x51ffd7[_0xf9bc('0x43')]=_0x51ffd7[_0xf9bc('0x43')][_0xf9bc('0x45')]?_0x51ffd7['attributes']:_0x15d35f[_0xf9bc('0x3f')];if(!_0x431456[_0xf9bc('0x41')][_0xf9bc('0x46')](_0xf9bc('0x47'))){_0x51ffd7[_0xf9bc('0x2d')]=qs[_0xf9bc('0x2d')](_0x431456[_0xf9bc('0x41')][_0xf9bc('0x2d')]);_0x51ffd7[_0xf9bc('0x2f')]=qs[_0xf9bc('0x2f')](_0x431456['query']['offset']);}_0x51ffd7[_0xf9bc('0x48')]=qs[_0xf9bc('0x49')](_0x431456[_0xf9bc('0x41')][_0xf9bc('0x49')]);_0x51ffd7[_0xf9bc('0x4a')]=qs[_0xf9bc('0x4b')](_['pick'](_0x431456[_0xf9bc('0x41')],_0x15d35f[_0xf9bc('0x4b')]),_0x469115);if(_0x431456[_0xf9bc('0x41')][_0xf9bc('0x4c')]){_0x51ffd7[_0xf9bc('0x4a')]=_[_0xf9bc('0x4d')](_0x51ffd7['where'],{'$or':_[_0xf9bc('0x4e')](_0x469115,function(_0x466d5c){if(_0x466d5c[_0xf9bc('0x3e')]!==_0xf9bc('0x4f')){var _0xb7b266={};_0xb7b266[_0x466d5c[_0xf9bc('0x39')]]={'$like':'%'+_0x431456[_0xf9bc('0x41')][_0xf9bc('0x4c')]+'%'};return _0xb7b266;}})});}_0x51ffd7=_[_0xf9bc('0x4d')]({},_0x51ffd7,_0x431456[_0xf9bc('0x50')]);var _0x2e4616={'where':_0x51ffd7[_0xf9bc('0x4a')]};return db[_0xf9bc('0x3c')][_0xf9bc('0x2e')](_0x2e4616)['then'](function(_0xbe7aba){_0x369369[_0xf9bc('0x2e')]=_0xbe7aba;if(_0x431456[_0xf9bc('0x41')][_0xf9bc('0x51')]){_0x51ffd7['include']=[{'all':!![]}];}return db[_0xf9bc('0x3c')][_0xf9bc('0x52')](_0x51ffd7);})[_0xf9bc('0x1d')](function(_0x704210){_0x369369[_0xf9bc('0x53')]=_0x704210;return _0x369369;})[_0xf9bc('0x1d')](respondWithFilteredResult(_0x34a055,_0x51ffd7))[_0xf9bc('0x27')](handleError(_0x34a055,null));};exports[_0xf9bc('0x54')]=function(_0x1108d9,_0x366718){var _0x4a31be={'raw':![],'where':{'id':_0x1108d9[_0xf9bc('0x55')]['id']}},_0xf4cc98={};_0xf4cc98['model']=_[_0xf9bc('0x40')](db[_0xf9bc('0x3c')][_0xf9bc('0x3d')]);_0xf4cc98[_0xf9bc('0x41')]=_[_0xf9bc('0x40')](_0x1108d9[_0xf9bc('0x41')]);_0xf4cc98[_0xf9bc('0x4b')]=_['intersection'](_0xf4cc98[_0xf9bc('0x3f')],_0xf4cc98[_0xf9bc('0x41')]);_0x4a31be[_0xf9bc('0x43')]=_[_0xf9bc('0x42')](_0xf4cc98[_0xf9bc('0x3f')],qs[_0xf9bc('0x44')](_0x1108d9[_0xf9bc('0x41')][_0xf9bc('0x44')]));_0x4a31be['attributes']=_0x4a31be[_0xf9bc('0x43')][_0xf9bc('0x45')]?_0x4a31be[_0xf9bc('0x43')]:_0xf4cc98['model'];if(_0x1108d9[_0xf9bc('0x41')]['includeAll']){_0x4a31be[_0xf9bc('0x56')]=[{'all':!![]}];}_0x4a31be=_[_0xf9bc('0x4d')]({},_0x4a31be,_0x1108d9[_0xf9bc('0x50')]);return db['VoiceContext'][_0xf9bc('0x57')](_0x4a31be)[_0xf9bc('0x1d')](handleEntityNotFound(_0x366718,null))[_0xf9bc('0x1d')](respondWithResult(_0x366718,null))[_0xf9bc('0x27')](handleError(_0x366718,null));};exports[_0xf9bc('0x58')]=function(_0x360ac2,_0x4d28f8,_0x5efb73){var _0xbfb77;return db[_0xf9bc('0x3c')][_0xf9bc('0x58')](_0x360ac2[_0xf9bc('0x59')],{'raw':!![]})[_0xf9bc('0x1d')](function(_0x3124d2){_0xbfb77=_0x3124d2;return db['VoiceContext'][_0xf9bc('0x52')]({'raw':!![]});})['then'](function(_0x7fd1e6){var _0x296747=fs[_0xf9bc('0x5a')](path[_0xf9bc('0x5b')](config[_0xf9bc('0x5c')],_0xf9bc('0x5d')),_0xf9bc('0x5e'));var _0x5597ca=ejs[_0xf9bc('0x5f')](_0x296747,{'contexts':_0x7fd1e6||[]});fs[_0xf9bc('0x60')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x5597ca);})['then'](function(){return respondWithRpcPromise(_0xf9bc('0x61'),_0xf9bc('0x58'),{'module':_0xf9bc('0x62')});})['then'](function(){var _0x5ec299=_0x360ac2[_0xf9bc('0x63')][_0xf9bc('0x35')]({'plain':!![]});if(!_0x5ec299)throw new Error(_0xf9bc('0x64'));if(_0x5ec299['role']===_0xf9bc('0x63')){var _0x33a396=_0xbfb77[_0xf9bc('0x35')]({'plain':!![]});return db[_0xf9bc('0x65')][_0xf9bc('0x57')]({'where':{'name':_0xf9bc('0x36'),'userProfileId':_0x5ec299[_0xf9bc('0x66')]},'raw':!![]})[_0xf9bc('0x1d')](function(_0x426d40){if(_0x426d40&&_0x426d40[_0xf9bc('0x67')]===0x0){return db[_0xf9bc('0x37')][_0xf9bc('0x58')]({'name':_0x33a396[_0xf9bc('0x39')],'resourceId':_0x33a396['id'],'type':_0x426d40[_0xf9bc('0x39')],'sectionId':_0x426d40['id']},{})['then'](function(){return _0xbfb77;});}else{return _0xbfb77;}})[_0xf9bc('0x27')](function(_0x43beba){logger[_0xf9bc('0x22')](_0xf9bc('0x68'),_0x43beba);throw _0x43beba;});}return _0xbfb77;})['then'](respondWithResult(_0x4d28f8,0xc9))[_0xf9bc('0x27')](handleError(_0x4d28f8,null));};exports[_0xf9bc('0x33')]=function(_0x47fde8,_0x2201ba,_0x1ea36e){var _0x5693f2;return db[_0xf9bc('0x3c')][_0xf9bc('0x57')]({'where':{'id':_0x47fde8['params']['id']}})[_0xf9bc('0x1d')](handleEntityNotFound(_0x2201ba,null))[_0xf9bc('0x1d')](saveUpdates(_0x47fde8['body'],null))['then'](function(_0x4a6629){if(_0x4a6629){_0x5693f2=_0x4a6629;return db[_0xf9bc('0x3c')][_0xf9bc('0x52')]({'raw':!![]});}})[_0xf9bc('0x1d')](function(_0x254c58){var _0x557e53=fs[_0xf9bc('0x5a')](path[_0xf9bc('0x5b')](config['root'],_0xf9bc('0x5d')),'utf8');var _0x59df61=ejs[_0xf9bc('0x5f')](_0x557e53,{'contexts':_0x254c58||[]});fs['writeFileSync'](_0xf9bc('0x69'),_0x59df61);})[_0xf9bc('0x1d')](function(){return respondWithRpcPromise(_0xf9bc('0x61'),_0xf9bc('0x33'),{'module':_0xf9bc('0x62')});})['then'](function(){return _0x5693f2;})['then'](respondWithResult(_0x2201ba,null))[_0xf9bc('0x27')](handleError(_0x2201ba,null));};exports[_0xf9bc('0x34')]=function(_0x42d74b,_0x3ef3ba,_0x167753){var _0x25efa1;return db[_0xf9bc('0x3c')][_0xf9bc('0x57')]({'where':{'id':_0x42d74b[_0xf9bc('0x55')]['id']}})[_0xf9bc('0x1d')](handleEntityNotFound(_0x3ef3ba,null))[_0xf9bc('0x1d')](removeEntity(_0x3ef3ba,null))['then'](function(){return db['VoiceContext'][_0xf9bc('0x52')]({'raw':!![]});})['then'](function(_0x4bd9b3){var _0xe1a788=fs[_0xf9bc('0x5a')](path['join'](config[_0xf9bc('0x5c')],_0xf9bc('0x5d')),_0xf9bc('0x5e'));var _0x59cf23=ejs[_0xf9bc('0x5f')](_0xe1a788,{'contexts':_0x4bd9b3});fs[_0xf9bc('0x60')](_0xf9bc('0x69'),_0x59cf23);return respondWithRpcPromise('Reload',_0xf9bc('0x34'),{'module':_0xf9bc('0x62')});})[_0xf9bc('0x27')](handleError(_0x3ef3ba,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index eef07ca..3323ac7 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 _0x8842=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define'];(function(_0x2edbdf,_0x1892c1){var _0x487a01=function(_0x4b24ff){while(--_0x4b24ff){_0x2edbdf['push'](_0x2edbdf['shift']());}};_0x487a01(++_0x1892c1);}(_0x8842,0x1ea));var _0x2884=function(_0x3e10b0,_0x4544e3){_0x3e10b0=_0x3e10b0-0x0;var _0x14b94d=_0x8842[_0x3e10b0];return _0x14b94d;};'use strict';var _=require(_0x2884('0x0'));var util=require(_0x2884('0x1'));var logger=require(_0x2884('0x2'))(_0x2884('0x3'));var moment=require(_0x2884('0x4'));var BPromise=require(_0x2884('0x5'));var rp=require(_0x2884('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2884('0x7'));var config=require(_0x2884('0x8'));var attributes=require('./voiceContext.attributes');module['exports']=function(_0xe27f2,_0x26293b){return _0xe27f2[_0x2884('0x9')]('VoiceContext',attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0cf1=['voice_contexts','lodash','../../config/logger','api','request-promise','rimraf','../../config/environment'];(function(_0x1b1e76,_0x31695b){var _0x3d743a=function(_0x4ae27b){while(--_0x4ae27b){_0x1b1e76['push'](_0x1b1e76['shift']());}};_0x3d743a(++_0x31695b);}(_0x0cf1,0xb0));var _0x10cf=function(_0x66c0ed,_0x1e0940){_0x66c0ed=_0x66c0ed-0x0;var _0x321ec7=_0x0cf1[_0x66c0ed];return _0x321ec7;};'use strict';var _=require(_0x10cf('0x0'));var util=require('util');var logger=require(_0x10cf('0x1'))(_0x10cf('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x10cf('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x10cf('0x4'));var config=require(_0x10cf('0x5'));var attributes=require('./voiceContext.attributes');module['exports']=function(_0x5e84b3,_0x5097d8){return _0x5e84b3['define']('VoiceContext',attributes,{'tableName':_0x10cf('0x6'),'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 5baa1c1..266e187 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 _0xe195=['jayson/promise','client','request','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x267f04,_0x18005d){var _0x324621=function(_0x3ef6a9){while(--_0x3ef6a9){_0x267f04['push'](_0x267f04['shift']());}};_0x324621(++_0x18005d);}(_0xe195,0x1c6));var _0x5e19=function(_0x5b1b36,_0x20bc0a){_0x5b1b36=_0x5b1b36-0x0;var _0x133f3d=_0xe195[_0x5b1b36];return _0x133f3d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5e19('0x0'));var BPromise=require(_0x5e19('0x1'));var rs=require(_0x5e19('0x2'));var fs=require('fs');var Redis=require(_0x5e19('0x3'));var db=require(_0x5e19('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5e19('0x5'))(_0x5e19('0x6'));var config=require(_0x5e19('0x7'));var jayson=require(_0x5e19('0x8'));var client=jayson[_0x5e19('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ca278,_0x50b913,_0x1e40c4){return new BPromise(function(_0x21e440,_0x377428){return client[_0x5e19('0xa')](_0x2ca278,_0x1e40c4)['then'](function(_0x3a1974){logger['info'](_0x5e19('0xb'),_0x50b913,_0x5e19('0xc'));logger[_0x5e19('0xd')](_0x5e19('0xe'),_0x50b913,_0x5e19('0xc'),JSON[_0x5e19('0xf')](_0x3a1974));if(_0x3a1974[_0x5e19('0x10')]){if(_0x3a1974['error'][_0x5e19('0x11')]===0x1f4){logger[_0x5e19('0x10')](_0x5e19('0xb'),_0x50b913,_0x3a1974[_0x5e19('0x10')][_0x5e19('0x12')]);return _0x377428(_0x3a1974['error'][_0x5e19('0x12')]);}logger[_0x5e19('0x10')]('VoiceContext,\x20%s,\x20%s',_0x50b913,_0x3a1974[_0x5e19('0x10')][_0x5e19('0x12')]);return _0x21e440(_0x3a1974[_0x5e19('0x10')]['message']);}else{logger['info'](_0x5e19('0xb'),_0x50b913,'request\x20sent');_0x21e440(_0x3a1974[_0x5e19('0x13')][_0x5e19('0x12')]);}})[_0x5e19('0x14')](function(_0x5e72a3){logger['error']('VoiceContext,\x20%s,\x20%s',_0x50b913,_0x5e72a3);_0x377428(_0x5e72a3);});});} \ No newline at end of file +var _0x63a5=['result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x409e6b,_0x5bc9d6){var _0x34f3ab=function(_0x2fe920){while(--_0x2fe920){_0x409e6b['push'](_0x409e6b['shift']());}};_0x34f3ab(++_0x5bc9d6);}(_0x63a5,0x18e));var _0x563a=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0x63a5[_0x5a9c0c];return _0x53c77d;};'use strict';var _=require(_0x563a('0x0'));var util=require(_0x563a('0x1'));var moment=require(_0x563a('0x2'));var BPromise=require('bluebird');var rs=require(_0x563a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x563a('0x4'))['db'];var utils=require(_0x563a('0x5'));var logger=require(_0x563a('0x6'))(_0x563a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x563a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2662f7,_0x4f89b4,_0x4d71a0){return new BPromise(function(_0x543920,_0xff1f59){return client[_0x563a('0x9')](_0x2662f7,_0x4d71a0)[_0x563a('0xa')](function(_0x606235){logger[_0x563a('0xb')](_0x563a('0xc'),_0x4f89b4,_0x563a('0xd'));logger[_0x563a('0xe')](_0x563a('0xf'),_0x4f89b4,_0x563a('0xd'),JSON[_0x563a('0x10')](_0x606235));if(_0x606235[_0x563a('0x11')]){if(_0x606235[_0x563a('0x11')][_0x563a('0x12')]===0x1f4){logger['error'](_0x563a('0xc'),_0x4f89b4,_0x606235[_0x563a('0x11')][_0x563a('0x13')]);return _0xff1f59(_0x606235[_0x563a('0x11')][_0x563a('0x13')]);}logger[_0x563a('0x11')]('VoiceContext,\x20%s,\x20%s',_0x4f89b4,_0x606235[_0x563a('0x11')][_0x563a('0x13')]);return _0x543920(_0x606235[_0x563a('0x11')][_0x563a('0x13')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x4f89b4,_0x563a('0xd'));_0x543920(_0x606235[_0x563a('0x14')]['message']);}})[_0x563a('0x15')](function(_0x43fb16){logger[_0x563a('0x11')](_0x563a('0xc'),_0x4f89b4,_0x43fb16);_0xff1f59(_0x43fb16);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index d8b5cf0..8e79553 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 _0x5ef5=['index','get','describe','show','post','/:id','delete','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./voiceDialReport.controller','isAuthenticated'];(function(_0x1f5fbc,_0x5507af){var _0x67da7d=function(_0x5b2a55){while(--_0x5b2a55){_0x1f5fbc['push'](_0x1f5fbc['shift']());}};_0x67da7d(++_0x5507af);}(_0x5ef5,0xa7));var _0x55ef=function(_0x30444b,_0x3260bd){_0x30444b=_0x30444b-0x0;var _0x27f975=_0x5ef5[_0x30444b];return _0x27f975;};'use strict';var multer=require(_0x55ef('0x0'));var util=require(_0x55ef('0x1'));var path=require(_0x55ef('0x2'));var timeout=require(_0x55ef('0x3'));var express=require(_0x55ef('0x4'));var router=express[_0x55ef('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x55ef('0x6'));var config=require('../../config/environment');var controller=require(_0x55ef('0x7'));router['get']('/',auth[_0x55ef('0x8')](),controller[_0x55ef('0x9')]);router[_0x55ef('0xa')]('/describe',auth[_0x55ef('0x8')](),controller[_0x55ef('0xb')]);router['get']('/:id',auth[_0x55ef('0x8')](),controller[_0x55ef('0xc')]);router[_0x55ef('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x55ef('0xe'),auth[_0x55ef('0x8')](),controller['update']);router[_0x55ef('0xf')](_0x55ef('0xe'),auth[_0x55ef('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x168b=['describe','/:id','show','post','create','put','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x250a95,_0x196c08){var _0x16c896=function(_0x45f993){while(--_0x45f993){_0x250a95['push'](_0x250a95['shift']());}};_0x16c896(++_0x196c08);}(_0x168b,0x9b));var _0xb168=function(_0x2bbfdf,_0x5db59d){_0x2bbfdf=_0x2bbfdf-0x0;var _0x5a9041=_0x168b[_0x2bbfdf];return _0x5a9041;};'use strict';var multer=require(_0xb168('0x0'));var util=require(_0xb168('0x1'));var path=require(_0xb168('0x2'));var timeout=require('connect-timeout');var express=require(_0xb168('0x3'));var router=express[_0xb168('0x4')]();var fs_extra=require(_0xb168('0x5'));var auth=require(_0xb168('0x6'));var interaction=require(_0xb168('0x7'));var config=require(_0xb168('0x8'));var controller=require('./voiceDialReport.controller');router[_0xb168('0x9')]('/',auth[_0xb168('0xa')](),controller[_0xb168('0xb')]);router['get'](_0xb168('0xc'),auth[_0xb168('0xa')](),controller[_0xb168('0xd')]);router[_0xb168('0x9')](_0xb168('0xe'),auth[_0xb168('0xa')](),controller[_0xb168('0xf')]);router[_0xb168('0x10')]('/',auth[_0xb168('0xa')](),controller[_0xb168('0x11')]);router[_0xb168('0x12')](_0xb168('0xe'),auth[_0xb168('0xa')](),controller['update']);router[_0xb168('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xb168('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 4948a94..4319625 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 _0xa41a=['exports','STRING','INTEGER','DATE','called,connect,complete','sequelize'];(function(_0x42282c,_0x230809){var _0x1631f5=function(_0x20e27c){while(--_0x20e27c){_0x42282c['push'](_0x42282c['shift']());}};_0x1631f5(++_0x230809);}(_0xa41a,0x6b));var _0xaa41=function(_0x406aca,_0x951c9b){_0x406aca=_0x406aca-0x0;var _0x49370b=_0xa41a[_0x406aca];return _0x49370b;};'use strict';var Sequelize=require(_0xaa41('0x0'));module[_0xaa41('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xaa41('0x2')]},'channelstate':{'type':Sequelize[_0xaa41('0x3')]},'channelstatedesc':{'type':Sequelize[_0xaa41('0x2')]},'calleridnum':{'type':Sequelize[_0xaa41('0x2')]},'calleridname':{'type':Sequelize[_0xaa41('0x2')]},'connectedlinenum':{'type':Sequelize[_0xaa41('0x2')]},'connectedlinename':{'type':Sequelize[_0xaa41('0x2')]},'language':{'type':Sequelize[_0xaa41('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xaa41('0x2')]},'exten':{'type':Sequelize[_0xaa41('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xaa41('0x2')]},'destchannel':{'type':Sequelize[_0xaa41('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xaa41('0x2')]},'destcalleridnum':{'type':Sequelize[_0xaa41('0x2')]},'destcalleridname':{'type':Sequelize[_0xaa41('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xaa41('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xaa41('0x2')]},'destlanguage':{'type':Sequelize[_0xaa41('0x2')]},'destaccountcode':{'type':Sequelize[_0xaa41('0x2')]},'destcontext':{'type':Sequelize[_0xaa41('0x2')]},'destexten':{'type':Sequelize[_0xaa41('0x2')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xaa41('0x2')]},'destlinkedid':{'type':Sequelize[_0xaa41('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xaa41('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xaa41('0x4')]},'lastevent':{'type':Sequelize[_0xaa41('0x2')],'comment':_0xaa41('0x5')},'routeId':{'type':Sequelize[_0xaa41('0x3')]},'duration':{'type':Sequelize[_0xaa41('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xaa41('0x3')]}}; \ No newline at end of file +var _0xa41a=['exports','STRING','INTEGER','DATE','called,connect,complete','sequelize'];(function(_0x526424,_0x4373a1){var _0x54f2d4=function(_0x326877){while(--_0x326877){_0x526424['push'](_0x526424['shift']());}};_0x54f2d4(++_0x4373a1);}(_0xa41a,0x6b));var _0xaa41=function(_0xc38e6f,_0x525004){_0xc38e6f=_0xc38e6f-0x0;var _0x4e7bf5=_0xa41a[_0xc38e6f];return _0x4e7bf5;};'use strict';var Sequelize=require(_0xaa41('0x0'));module[_0xaa41('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xaa41('0x2')]},'channelstate':{'type':Sequelize[_0xaa41('0x3')]},'channelstatedesc':{'type':Sequelize[_0xaa41('0x2')]},'calleridnum':{'type':Sequelize[_0xaa41('0x2')]},'calleridname':{'type':Sequelize[_0xaa41('0x2')]},'connectedlinenum':{'type':Sequelize[_0xaa41('0x2')]},'connectedlinename':{'type':Sequelize[_0xaa41('0x2')]},'language':{'type':Sequelize[_0xaa41('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xaa41('0x2')]},'exten':{'type':Sequelize[_0xaa41('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xaa41('0x2')]},'destchannel':{'type':Sequelize[_0xaa41('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xaa41('0x2')]},'destcalleridnum':{'type':Sequelize[_0xaa41('0x2')]},'destcalleridname':{'type':Sequelize[_0xaa41('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xaa41('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xaa41('0x2')]},'destlanguage':{'type':Sequelize[_0xaa41('0x2')]},'destaccountcode':{'type':Sequelize[_0xaa41('0x2')]},'destcontext':{'type':Sequelize[_0xaa41('0x2')]},'destexten':{'type':Sequelize[_0xaa41('0x2')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xaa41('0x2')]},'destlinkedid':{'type':Sequelize[_0xaa41('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xaa41('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xaa41('0x4')]},'lastevent':{'type':Sequelize[_0xaa41('0x2')],'comment':_0xaa41('0x5')},'routeId':{'type':Sequelize[_0xaa41('0x3')]},'duration':{'type':Sequelize[_0xaa41('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xaa41('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 20bf536..4bbb58f 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 _0x7f25=['filter','merge','options','VoiceDialReport','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick'];(function(_0x4c753a,_0x21664f){var _0x1f0ff1=function(_0x1f3e18){while(--_0x1f3e18){_0x4c753a['push'](_0x4c753a['shift']());}};_0x1f0ff1(++_0x21664f);}(_0x7f25,0xf7));var _0x57f2=function(_0x1d558c,_0x1e497c){_0x1d558c=_0x1d558c-0x0;var _0x15767d=_0x7f25[_0x1d558c];return _0x15767d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x57f2('0x0'));var zipdir=require(_0x57f2('0x1'));var jsonpatch=require(_0x57f2('0x2'));var rp=require(_0x57f2('0x3'));var moment=require(_0x57f2('0x4'));var BPromise=require(_0x57f2('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x57f2('0x6'));var ejs=require(_0x57f2('0x7'));var fs=require('fs');var fs_extra=require(_0x57f2('0x8'));var _=require(_0x57f2('0x9'));var squel=require(_0x57f2('0xa'));var crypto=require('crypto');var jsforce=require(_0x57f2('0xb'));var deskjs=require(_0x57f2('0xc'));var toCsv=require('to-csv');var querystring=require(_0x57f2('0xd'));var Papa=require(_0x57f2('0xe'));var Redis=require(_0x57f2('0xf'));var authService=require(_0x57f2('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x57f2('0x11'));var hardwareService=require(_0x57f2('0x12'));var logger=require(_0x57f2('0x13'))(_0x57f2('0x14'));var utils=require('../../config/utils');var config=require(_0x57f2('0x15'));var licenseUtil=require(_0x57f2('0x16'));var db=require(_0x57f2('0x17'))['db'];function respondWithStatusCode(_0x36cc22,_0x2bd51a){_0x2bd51a=_0x2bd51a||0xcc;return function(_0x2bf6d9){if(_0x2bf6d9){return _0x36cc22[_0x57f2('0x18')](_0x2bd51a);}return _0x36cc22['status'](_0x2bd51a)[_0x57f2('0x19')]();};}function respondWithResult(_0x5842af,_0x56c58f){_0x56c58f=_0x56c58f||0xc8;return function(_0x20383b){if(_0x20383b){return _0x5842af[_0x57f2('0x1a')](_0x56c58f)[_0x57f2('0x1b')](_0x20383b);}};}function respondWithFilteredResult(_0x4bd576,_0x56ed43){return function(_0xb191f8){if(_0xb191f8){var _0x3c2ea2=typeof _0x56ed43[_0x57f2('0x1c')]===_0x57f2('0x1d')&&typeof _0x56ed43[_0x57f2('0x1e')]===_0x57f2('0x1d');var _0x49d323=_0xb191f8['count'];var _0x39250a=_0x3c2ea2?0x0:_0x56ed43[_0x57f2('0x1c')];var _0x53297d=_0x3c2ea2?_0xb191f8[_0x57f2('0x1f')]:_0x56ed43[_0x57f2('0x1c')]+_0x56ed43['limit'];var _0x1207c9;if(_0x53297d>=_0x49d323){_0x53297d=_0x49d323;_0x1207c9=0xc8;}else{_0x1207c9=0xce;}_0x4bd576[_0x57f2('0x1a')](_0x1207c9);return _0x4bd576[_0x57f2('0x20')](_0x57f2('0x21'),_0x39250a+'-'+_0x53297d+'/'+_0x49d323)[_0x57f2('0x1b')](_0xb191f8);}return null;};}function patchUpdates(_0x591953){return function(_0xa7586d){try{jsonpatch[_0x57f2('0x22')](_0xa7586d,_0x591953,!![]);}catch(_0x11a9e3){return BPromise[_0x57f2('0x23')](_0x11a9e3);}return _0xa7586d[_0x57f2('0x24')]();};}function saveUpdates(_0x44d006,_0xb7d91a){return function(_0x4942e0){if(_0x4942e0){return _0x4942e0[_0x57f2('0x25')](_0x44d006)[_0x57f2('0x26')](function(_0x3f098f){return _0x3f098f;});}return null;};}function removeEntity(_0x5a2f3b,_0x5f367f){return function(_0x15d36f){if(_0x15d36f){return _0x15d36f[_0x57f2('0x27')]()[_0x57f2('0x26')](function(){_0x5a2f3b['status'](0xcc)[_0x57f2('0x19')]();});}};}function handleEntityNotFound(_0x59e180,_0x1ec7c3){return function(_0x31dd1d){if(!_0x31dd1d){_0x59e180[_0x57f2('0x18')](0x194);}return _0x31dd1d;};}function handleError(_0x4c151f,_0x13e74e){_0x13e74e=_0x13e74e||0x1f4;return function(_0x852f37){logger['error'](_0x852f37[_0x57f2('0x28')]);if(_0x852f37[_0x57f2('0x29')]){delete _0x852f37[_0x57f2('0x29')];}_0x4c151f[_0x57f2('0x1a')](_0x13e74e)[_0x57f2('0x2a')](_0x852f37);};}exports[_0x57f2('0x2b')]=function(_0x1fb0a0,_0x5ea01f){var _0x301ff9={},_0x18aa71={},_0x4316cf={'count':0x0,'rows':[]};var _0x42d659=_[_0x57f2('0x2c')](db['VoiceDialReport'][_0x57f2('0x2d')],function(_0x5aca0b){return{'name':_0x5aca0b[_0x57f2('0x2e')],'type':_0x5aca0b[_0x57f2('0x2f')][_0x57f2('0x30')]};});_0x18aa71[_0x57f2('0x31')]=_['map'](_0x42d659,_0x57f2('0x29'));_0x18aa71['query']=_[_0x57f2('0x32')](_0x1fb0a0[_0x57f2('0x33')]);_0x18aa71[_0x57f2('0x34')]=_[_0x57f2('0x35')](_0x18aa71['model'],_0x18aa71['query']);_0x301ff9[_0x57f2('0x36')]=_['intersection'](_0x18aa71[_0x57f2('0x31')],qs[_0x57f2('0x37')](_0x1fb0a0['query']['fields']));_0x301ff9[_0x57f2('0x36')]=_0x301ff9[_0x57f2('0x36')]['length']?_0x301ff9[_0x57f2('0x36')]:_0x18aa71[_0x57f2('0x31')];if(!_0x1fb0a0[_0x57f2('0x33')][_0x57f2('0x38')](_0x57f2('0x39'))){_0x301ff9[_0x57f2('0x1e')]=qs[_0x57f2('0x1e')](_0x1fb0a0[_0x57f2('0x33')]['limit']);_0x301ff9[_0x57f2('0x1c')]=qs[_0x57f2('0x1c')](_0x1fb0a0['query'][_0x57f2('0x1c')]);}_0x301ff9['order']=qs[_0x57f2('0x3a')](_0x1fb0a0['query'][_0x57f2('0x3a')]);_0x301ff9[_0x57f2('0x3b')]=qs[_0x57f2('0x34')](_[_0x57f2('0x3c')](_0x1fb0a0['query'],_0x18aa71[_0x57f2('0x34')]),_0x42d659);if(_0x1fb0a0['query'][_0x57f2('0x3d')]){_0x301ff9[_0x57f2('0x3b')]=_[_0x57f2('0x3e')](_0x301ff9[_0x57f2('0x3b')],{'$or':_[_0x57f2('0x2c')](_0x42d659,function(_0x2239ba){if(_0x2239ba['type']!=='VIRTUAL'){var _0x4be0b5={};_0x4be0b5[_0x2239ba[_0x57f2('0x29')]]={'$like':'%'+_0x1fb0a0[_0x57f2('0x33')][_0x57f2('0x3d')]+'%'};return _0x4be0b5;}})});}_0x301ff9=_['merge']({},_0x301ff9,_0x1fb0a0[_0x57f2('0x3f')]);var _0x5db671={'where':_0x301ff9['where']};return db[_0x57f2('0x40')][_0x57f2('0x1f')](_0x5db671)[_0x57f2('0x26')](function(_0x5cff97){_0x4316cf['count']=_0x5cff97;if(_0x1fb0a0[_0x57f2('0x33')][_0x57f2('0x41')]){_0x301ff9[_0x57f2('0x42')]=[{'all':!![]}];}return db[_0x57f2('0x40')][_0x57f2('0x43')](_0x301ff9);})[_0x57f2('0x26')](function(_0x49665c){_0x4316cf[_0x57f2('0x44')]=_0x49665c;return _0x4316cf;})['then'](respondWithFilteredResult(_0x5ea01f,_0x301ff9))[_0x57f2('0x45')](handleError(_0x5ea01f,null));};exports[_0x57f2('0x46')]=function(_0x3296b1,_0x45289e){var _0x46a75f={'raw':!![],'where':{'id':_0x3296b1[_0x57f2('0x47')]['id']}},_0x57cbed={};_0x57cbed[_0x57f2('0x31')]=_['keys'](db[_0x57f2('0x40')][_0x57f2('0x2d')]);_0x57cbed[_0x57f2('0x33')]=_['keys'](_0x3296b1['query']);_0x57cbed[_0x57f2('0x34')]=_[_0x57f2('0x35')](_0x57cbed[_0x57f2('0x31')],_0x57cbed[_0x57f2('0x33')]);_0x46a75f[_0x57f2('0x36')]=_[_0x57f2('0x35')](_0x57cbed[_0x57f2('0x31')],qs[_0x57f2('0x37')](_0x3296b1[_0x57f2('0x33')][_0x57f2('0x37')]));_0x46a75f[_0x57f2('0x36')]=_0x46a75f[_0x57f2('0x36')][_0x57f2('0x48')]?_0x46a75f[_0x57f2('0x36')]:_0x57cbed[_0x57f2('0x31')];if(_0x3296b1[_0x57f2('0x33')][_0x57f2('0x41')]){_0x46a75f[_0x57f2('0x42')]=[{'all':!![]}];}_0x46a75f=_[_0x57f2('0x3e')]({},_0x46a75f,_0x3296b1['options']);return db[_0x57f2('0x40')][_0x57f2('0x49')](_0x46a75f)[_0x57f2('0x26')](handleEntityNotFound(_0x45289e,null))[_0x57f2('0x26')](respondWithResult(_0x45289e,null))[_0x57f2('0x45')](handleError(_0x45289e,null));};exports[_0x57f2('0x4a')]=function(_0x585b5d,_0x36cbe0){return db[_0x57f2('0x40')][_0x57f2('0x4a')](_0x585b5d[_0x57f2('0x4b')],{})['then'](respondWithResult(_0x36cbe0,0xc9))[_0x57f2('0x45')](handleError(_0x36cbe0,null));};exports[_0x57f2('0x25')]=function(_0x3ba271,_0x4400e5){if(_0x3ba271['body']['id']){delete _0x3ba271[_0x57f2('0x4b')]['id'];}return db[_0x57f2('0x40')][_0x57f2('0x49')]({'where':{'id':_0x3ba271[_0x57f2('0x47')]['id']}})['then'](handleEntityNotFound(_0x4400e5,null))[_0x57f2('0x26')](saveUpdates(_0x3ba271['body'],null))[_0x57f2('0x26')](respondWithResult(_0x4400e5,null))[_0x57f2('0x45')](handleError(_0x4400e5,null));};exports[_0x57f2('0x27')]=function(_0x11de1a,_0x3fd524){return db[_0x57f2('0x40')][_0x57f2('0x49')]({'where':{'id':_0x11de1a[_0x57f2('0x47')]['id']}})[_0x57f2('0x26')](handleEntityNotFound(_0x3fd524,null))[_0x57f2('0x26')](removeEntity(_0x3fd524,null))[_0x57f2('0x45')](handleError(_0x3fd524,null));};exports[_0x57f2('0x4c')]=function(_0x1c8b8e,_0x268670){return db['VoiceDialReport'][_0x57f2('0x4c')]()[_0x57f2('0x26')](respondWithResult(_0x268670,null))[_0x57f2('0x45')](handleError(_0x268670,null));}; \ No newline at end of file +var _0x6e50=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','sendStatus','error','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','name','options','includeAll','include','findAll','then','rows','catch','show','params','find','create','body','describe','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x1644ef,_0x4b4041){var _0x5c3967=function(_0x2198c6){while(--_0x2198c6){_0x1644ef['push'](_0x1644ef['shift']());}};_0x5c3967(++_0x4b4041);}(_0x6e50,0x1ab));var _0x06e5=function(_0x27d216,_0x3500dd){_0x27d216=_0x27d216-0x0;var _0x43f016=_0x6e50[_0x27d216];return _0x43f016;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x06e5('0x0'));var rp=require('request-promise');var moment=require(_0x06e5('0x1'));var BPromise=require(_0x06e5('0x2'));var Mustache=require(_0x06e5('0x3'));var util=require(_0x06e5('0x4'));var path=require(_0x06e5('0x5'));var sox=require(_0x06e5('0x6'));var csv=require(_0x06e5('0x7'));var ejs=require(_0x06e5('0x8'));var fs=require('fs');var fs_extra=require(_0x06e5('0x9'));var _=require(_0x06e5('0xa'));var squel=require(_0x06e5('0xb'));var crypto=require('crypto');var jsforce=require(_0x06e5('0xc'));var deskjs=require(_0x06e5('0xd'));var toCsv=require(_0x06e5('0x7'));var querystring=require(_0x06e5('0xe'));var Papa=require(_0x06e5('0xf'));var Redis=require(_0x06e5('0x10'));var authService=require(_0x06e5('0x11'));var qs=require(_0x06e5('0x12'));var as=require(_0x06e5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x06e5('0x14'));var utils=require('../../config/utils');var config=require(_0x06e5('0x15'));var licenseUtil=require(_0x06e5('0x16'));var db=require(_0x06e5('0x17'))['db'];function respondWithStatusCode(_0x4e1e98,_0x474882){_0x474882=_0x474882||0xcc;return function(_0x1fd4ce){if(_0x1fd4ce){return _0x4e1e98['sendStatus'](_0x474882);}return _0x4e1e98['status'](_0x474882)[_0x06e5('0x18')]();};}function respondWithResult(_0x5b8746,_0x179108){_0x179108=_0x179108||0xc8;return function(_0x3a9d60){if(_0x3a9d60){return _0x5b8746[_0x06e5('0x19')](_0x179108)[_0x06e5('0x1a')](_0x3a9d60);}};}function respondWithFilteredResult(_0x24af62,_0x5eb1b2){return function(_0x24ae86){if(_0x24ae86){var _0xb6ec2f=typeof _0x5eb1b2['offset']===_0x06e5('0x1b')&&typeof _0x5eb1b2[_0x06e5('0x1c')]==='undefined';var _0x3caa13=_0x24ae86[_0x06e5('0x1d')];var _0x1d3553=_0xb6ec2f?0x0:_0x5eb1b2[_0x06e5('0x1e')];var _0x24493b=_0xb6ec2f?_0x24ae86['count']:_0x5eb1b2[_0x06e5('0x1e')]+_0x5eb1b2[_0x06e5('0x1c')];var _0xe8be71;if(_0x24493b>=_0x3caa13){_0x24493b=_0x3caa13;_0xe8be71=0xc8;}else{_0xe8be71=0xce;}_0x24af62['status'](_0xe8be71);return _0x24af62[_0x06e5('0x1f')](_0x06e5('0x20'),_0x1d3553+'-'+_0x24493b+'/'+_0x3caa13)[_0x06e5('0x1a')](_0x24ae86);}return null;};}function patchUpdates(_0x165c58){return function(_0x519a3e){try{jsonpatch[_0x06e5('0x21')](_0x519a3e,_0x165c58,!![]);}catch(_0x4a4210){return BPromise['reject'](_0x4a4210);}return _0x519a3e[_0x06e5('0x22')]();};}function saveUpdates(_0x3c7f07,_0x3f341f){return function(_0x115332){if(_0x115332){return _0x115332[_0x06e5('0x23')](_0x3c7f07)['then'](function(_0x29a608){return _0x29a608;});}return null;};}function removeEntity(_0x360a08,_0x1389e4){return function(_0x399a43){if(_0x399a43){return _0x399a43[_0x06e5('0x24')]()['then'](function(){_0x360a08[_0x06e5('0x19')](0xcc)[_0x06e5('0x18')]();});}};}function handleEntityNotFound(_0x926f30,_0x5b822b){return function(_0x5a59ca){if(!_0x5a59ca){_0x926f30[_0x06e5('0x25')](0x194);}return _0x5a59ca;};}function handleError(_0x3d234e,_0x21c8b1){_0x21c8b1=_0x21c8b1||0x1f4;return function(_0x154906){logger[_0x06e5('0x26')](_0x154906['stack']);if(_0x154906['name']){delete _0x154906['name'];}_0x3d234e[_0x06e5('0x19')](_0x21c8b1)['send'](_0x154906);};}exports['index']=function(_0x2e2ad2,_0x12ff33){var _0x3826e7={},_0x5c154f={},_0x75faf9={'count':0x0,'rows':[]};var _0x23fcd7=_[_0x06e5('0x27')](db[_0x06e5('0x28')][_0x06e5('0x29')],function(_0x5f11b6){return{'name':_0x5f11b6[_0x06e5('0x2a')],'type':_0x5f11b6[_0x06e5('0x2b')][_0x06e5('0x2c')]};});_0x5c154f[_0x06e5('0x2d')]=_[_0x06e5('0x27')](_0x23fcd7,'name');_0x5c154f[_0x06e5('0x2e')]=_[_0x06e5('0x2f')](_0x2e2ad2[_0x06e5('0x2e')]);_0x5c154f[_0x06e5('0x30')]=_['intersection'](_0x5c154f[_0x06e5('0x2d')],_0x5c154f[_0x06e5('0x2e')]);_0x3826e7['attributes']=_[_0x06e5('0x31')](_0x5c154f[_0x06e5('0x2d')],qs['fields'](_0x2e2ad2[_0x06e5('0x2e')][_0x06e5('0x32')]));_0x3826e7[_0x06e5('0x33')]=_0x3826e7[_0x06e5('0x33')][_0x06e5('0x34')]?_0x3826e7[_0x06e5('0x33')]:_0x5c154f[_0x06e5('0x2d')];if(!_0x2e2ad2['query'][_0x06e5('0x35')](_0x06e5('0x36'))){_0x3826e7['limit']=qs[_0x06e5('0x1c')](_0x2e2ad2[_0x06e5('0x2e')]['limit']);_0x3826e7['offset']=qs[_0x06e5('0x1e')](_0x2e2ad2[_0x06e5('0x2e')][_0x06e5('0x1e')]);}_0x3826e7[_0x06e5('0x37')]=qs['sort'](_0x2e2ad2[_0x06e5('0x2e')][_0x06e5('0x38')]);_0x3826e7['where']=qs[_0x06e5('0x30')](_['pick'](_0x2e2ad2[_0x06e5('0x2e')],_0x5c154f['filters']),_0x23fcd7);if(_0x2e2ad2[_0x06e5('0x2e')]['filter']){_0x3826e7[_0x06e5('0x39')]=_[_0x06e5('0x3a')](_0x3826e7[_0x06e5('0x39')],{'$or':_[_0x06e5('0x27')](_0x23fcd7,function(_0x43d9ea){if(_0x43d9ea[_0x06e5('0x2b')]!==_0x06e5('0x3b')){var _0x49cc4b={};_0x49cc4b[_0x43d9ea[_0x06e5('0x3c')]]={'$like':'%'+_0x2e2ad2[_0x06e5('0x2e')]['filter']+'%'};return _0x49cc4b;}})});}_0x3826e7=_[_0x06e5('0x3a')]({},_0x3826e7,_0x2e2ad2[_0x06e5('0x3d')]);var _0x195327={'where':_0x3826e7[_0x06e5('0x39')]};return db['VoiceDialReport'][_0x06e5('0x1d')](_0x195327)['then'](function(_0x3295d5){_0x75faf9[_0x06e5('0x1d')]=_0x3295d5;if(_0x2e2ad2[_0x06e5('0x2e')][_0x06e5('0x3e')]){_0x3826e7[_0x06e5('0x3f')]=[{'all':!![]}];}return db[_0x06e5('0x28')][_0x06e5('0x40')](_0x3826e7);})[_0x06e5('0x41')](function(_0x1c6764){_0x75faf9[_0x06e5('0x42')]=_0x1c6764;return _0x75faf9;})[_0x06e5('0x41')](respondWithFilteredResult(_0x12ff33,_0x3826e7))[_0x06e5('0x43')](handleError(_0x12ff33,null));};exports[_0x06e5('0x44')]=function(_0x3c64cb,_0x476c67){var _0x42a65f={'raw':!![],'where':{'id':_0x3c64cb[_0x06e5('0x45')]['id']}},_0x5cd683={};_0x5cd683['model']=_[_0x06e5('0x2f')](db[_0x06e5('0x28')][_0x06e5('0x29')]);_0x5cd683[_0x06e5('0x2e')]=_['keys'](_0x3c64cb[_0x06e5('0x2e')]);_0x5cd683[_0x06e5('0x30')]=_['intersection'](_0x5cd683[_0x06e5('0x2d')],_0x5cd683[_0x06e5('0x2e')]);_0x42a65f[_0x06e5('0x33')]=_[_0x06e5('0x31')](_0x5cd683[_0x06e5('0x2d')],qs[_0x06e5('0x32')](_0x3c64cb[_0x06e5('0x2e')][_0x06e5('0x32')]));_0x42a65f[_0x06e5('0x33')]=_0x42a65f[_0x06e5('0x33')][_0x06e5('0x34')]?_0x42a65f[_0x06e5('0x33')]:_0x5cd683['model'];if(_0x3c64cb[_0x06e5('0x2e')][_0x06e5('0x3e')]){_0x42a65f[_0x06e5('0x3f')]=[{'all':!![]}];}_0x42a65f=_[_0x06e5('0x3a')]({},_0x42a65f,_0x3c64cb[_0x06e5('0x3d')]);return db[_0x06e5('0x28')][_0x06e5('0x46')](_0x42a65f)[_0x06e5('0x41')](handleEntityNotFound(_0x476c67,null))[_0x06e5('0x41')](respondWithResult(_0x476c67,null))[_0x06e5('0x43')](handleError(_0x476c67,null));};exports['create']=function(_0xb83fc9,_0x33d04f){return db[_0x06e5('0x28')][_0x06e5('0x47')](_0xb83fc9[_0x06e5('0x48')],{})[_0x06e5('0x41')](respondWithResult(_0x33d04f,0xc9))['catch'](handleError(_0x33d04f,null));};exports[_0x06e5('0x23')]=function(_0x4b8a58,_0x48998a){if(_0x4b8a58['body']['id']){delete _0x4b8a58[_0x06e5('0x48')]['id'];}return db[_0x06e5('0x28')][_0x06e5('0x46')]({'where':{'id':_0x4b8a58[_0x06e5('0x45')]['id']}})[_0x06e5('0x41')](handleEntityNotFound(_0x48998a,null))[_0x06e5('0x41')](saveUpdates(_0x4b8a58['body'],null))[_0x06e5('0x41')](respondWithResult(_0x48998a,null))['catch'](handleError(_0x48998a,null));};exports['destroy']=function(_0x49eb4b,_0xacbe2d){return db[_0x06e5('0x28')][_0x06e5('0x46')]({'where':{'id':_0x49eb4b['params']['id']}})['then'](handleEntityNotFound(_0xacbe2d,null))[_0x06e5('0x41')](removeEntity(_0xacbe2d,null))[_0x06e5('0x43')](handleError(_0xacbe2d,null));};exports[_0x06e5('0x49')]=function(_0x1052b3,_0xdb5a7e){return db[_0x06e5('0x28')][_0x06e5('0x49')]()[_0x06e5('0x41')](respondWithResult(_0xdb5a7e,null))[_0x06e5('0x43')](handleError(_0xdb5a7e,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 0663ddc..5a71800 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 _0x7f4c=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','report_dial','uniqueid','lodash'];(function(_0x4252fb,_0x2875b6){var _0x40b2ae=function(_0xf9ca79){while(--_0xf9ca79){_0x4252fb['push'](_0x4252fb['shift']());}};_0x40b2ae(++_0x2875b6);}(_0x7f4c,0xd0));var _0xc7f4=function(_0x185f27,_0x3498d9){_0x185f27=_0x185f27-0x0;var _0x2b400d=_0x7f4c[_0x185f27];return _0x2b400d;};'use strict';var _=require(_0xc7f4('0x0'));var util=require('util');var logger=require(_0xc7f4('0x1'))('api');var moment=require('moment');var BPromise=require(_0xc7f4('0x2'));var rp=require(_0xc7f4('0x3'));var fs=require('fs');var path=require(_0xc7f4('0x4'));var rimraf=require(_0xc7f4('0x5'));var config=require(_0xc7f4('0x6'));var attributes=require(_0xc7f4('0x7'));module[_0xc7f4('0x8')]=function(_0x5f5a05,_0xf467a0){return _0x5f5a05['define']('VoiceDialReport',attributes,{'tableName':_0xc7f4('0x9'),'paranoid':![],'indexes':[{'fields':[_0xc7f4('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5947=['exports','VoiceDialReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x5947,0x16e));var _0x7594=function(_0x5089bd,_0x4f78e5){_0x5089bd=_0x5089bd-0x0;var _0x3585bd=_0x5947[_0x5089bd];return _0x3585bd;};'use strict';var _=require(_0x7594('0x0'));var util=require(_0x7594('0x1'));var logger=require(_0x7594('0x2'))(_0x7594('0x3'));var moment=require(_0x7594('0x4'));var BPromise=require(_0x7594('0x5'));var rp=require(_0x7594('0x6'));var fs=require('fs');var path=require(_0x7594('0x7'));var rimraf=require(_0x7594('0x8'));var config=require(_0x7594('0x9'));var attributes=require(_0x7594('0xa'));module[_0x7594('0xb')]=function(_0x1fac2e,_0x378695){return _0x1fac2e['define'](_0x7594('0xc'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index ea5930e..2c68de8 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 _0x931a=['then','info','VoiceDialReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','catch','VoiceDialReport','create','body','options','raw','CreateVoiceDialReport','UpdateVoiceDialReport','update','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x2fa1c6,_0x4a5b8d){var _0x5f3257=function(_0x195b53){while(--_0x195b53){_0x2fa1c6['push'](_0x2fa1c6['shift']());}};_0x5f3257(++_0x4a5b8d);}(_0x931a,0x78));var _0xa931=function(_0x3226b5,_0x297318){_0x3226b5=_0x3226b5-0x0;var _0x32bb4a=_0x931a[_0x3226b5];return _0x32bb4a;};'use strict';var _=require(_0xa931('0x0'));var util=require('util');var moment=require(_0xa931('0x1'));var BPromise=require(_0xa931('0x2'));var rs=require(_0xa931('0x3'));var fs=require('fs');var Redis=require(_0xa931('0x4'));var db=require(_0xa931('0x5'))['db'];var utils=require(_0xa931('0x6'));var logger=require(_0xa931('0x7'))(_0xa931('0x8'));var config=require(_0xa931('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa931('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b98d9,_0x36853f,_0xb918f3){return new BPromise(function(_0x4a6fef,_0x47aaba){return client[_0xa931('0xb')](_0x5b98d9,_0xb918f3)[_0xa931('0xc')](function(_0xfcf564){logger[_0xa931('0xd')](_0xa931('0xe'),_0x36853f,'request\x20sent');logger[_0xa931('0xf')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x36853f,'request\x20sent',JSON[_0xa931('0x10')](_0xfcf564));if(_0xfcf564[_0xa931('0x11')]){if(_0xfcf564[_0xa931('0x11')][_0xa931('0x12')]===0x1f4){logger['error'](_0xa931('0xe'),_0x36853f,_0xfcf564[_0xa931('0x11')]['message']);return _0x47aaba(_0xfcf564['error'][_0xa931('0x13')]);}logger['error'](_0xa931('0xe'),_0x36853f,_0xfcf564[_0xa931('0x11')][_0xa931('0x13')]);return _0x4a6fef(_0xfcf564[_0xa931('0x11')][_0xa931('0x13')]);}else{logger[_0xa931('0xd')](_0xa931('0xe'),_0x36853f,_0xa931('0x14'));_0x4a6fef(_0xfcf564['result']['message']);}})[_0xa931('0x15')](function(_0x1b2491){logger['error'](_0xa931('0xe'),_0x36853f,_0x1b2491);_0x47aaba(_0x1b2491);});});}exports['CreateVoiceDialReport']=function(_0x37df42){var _0x553934=this;return new Promise(function(_0x4904f6,_0x101f95){return db[_0xa931('0x16')][_0xa931('0x17')](_0x37df42[_0xa931('0x18')],{'raw':_0x37df42['options']?_0x37df42[_0xa931('0x19')][_0xa931('0x1a')]===undefined?!![]:![]:!![]})[_0xa931('0xc')](function(_0x16f7c4){logger[_0xa931('0xd')](_0xa931('0x1b'),_0x37df42);logger[_0xa931('0xf')]('CreateVoiceDialReport',_0x37df42,JSON['stringify'](_0x16f7c4));_0x4904f6(_0x16f7c4);})[_0xa931('0x15')](function(_0x4aa01c){logger[_0xa931('0x11')]('CreateVoiceDialReport',_0x4aa01c[_0xa931('0x13')],_0x37df42);_0x101f95(_0x553934[_0xa931('0x11')](0x1f4,_0x4aa01c[_0xa931('0x13')]));});});};exports[_0xa931('0x1c')]=function(_0x414014){var _0xb5cd63=this;return new Promise(function(_0x3c21c1,_0x1d4d37){return db[_0xa931('0x16')][_0xa931('0x1d')](_0x414014[_0xa931('0x18')],{'raw':_0x414014['options']?_0x414014[_0xa931('0x19')][_0xa931('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x414014['options']?_0x414014['options'][_0xa931('0x1e')]||null:null,'attributes':_0x414014[_0xa931('0x19')]?_0x414014[_0xa931('0x19')][_0xa931('0x1f')]||null:null,'limit':_0x414014[_0xa931('0x19')]?_0x414014[_0xa931('0x19')][_0xa931('0x20')]||null:null})[_0xa931('0xc')](function(_0x36c414){logger[_0xa931('0xd')](_0xa931('0x1c'),_0x414014);logger['debug'](_0xa931('0x1c'),_0x414014,JSON[_0xa931('0x10')](_0x36c414));_0x3c21c1(_0x36c414);})[_0xa931('0x15')](function(_0xa34f39){logger[_0xa931('0x11')](_0xa931('0x1c'),_0xa34f39[_0xa931('0x13')],_0x414014);_0x1d4d37(_0xb5cd63[_0xa931('0x11')](0x1f4,_0xa34f39[_0xa931('0x13')]));});});}; \ No newline at end of file +var _0xc013=['message','catch','VoiceDialReport','create','body','options','raw','CreateVoiceDialReport','UpdateVoiceDialReport','update','where','attributes','lodash','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x4fb797,_0x200ee6){var _0x34e096=function(_0x2c0f40){while(--_0x2c0f40){_0x4fb797['push'](_0x4fb797['shift']());}};_0x34e096(++_0x200ee6);}(_0xc013,0x1bc));var _0x3c01=function(_0x58175c,_0x2d9373){_0x58175c=_0x58175c-0x0;var _0x55b88f=_0xc013[_0x58175c];return _0x55b88f;};'use strict';var _=require(_0x3c01('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c01('0x1'))['db'];var utils=require(_0x3c01('0x2'));var logger=require(_0x3c01('0x3'))(_0x3c01('0x4'));var config=require('../../config/environment');var jayson=require(_0x3c01('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x301572,_0x5abcbc,_0x2448fd){return new BPromise(function(_0x39300e,_0x562829){return client[_0x3c01('0x6')](_0x301572,_0x2448fd)[_0x3c01('0x7')](function(_0x1b337f){logger[_0x3c01('0x8')](_0x3c01('0x9'),_0x5abcbc,_0x3c01('0xa'));logger[_0x3c01('0xb')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x5abcbc,'request\x20sent',JSON[_0x3c01('0xc')](_0x1b337f));if(_0x1b337f[_0x3c01('0xd')]){if(_0x1b337f[_0x3c01('0xd')][_0x3c01('0xe')]===0x1f4){logger[_0x3c01('0xd')](_0x3c01('0x9'),_0x5abcbc,_0x1b337f[_0x3c01('0xd')][_0x3c01('0xf')]);return _0x562829(_0x1b337f[_0x3c01('0xd')][_0x3c01('0xf')]);}logger[_0x3c01('0xd')](_0x3c01('0x9'),_0x5abcbc,_0x1b337f[_0x3c01('0xd')][_0x3c01('0xf')]);return _0x39300e(_0x1b337f['error'][_0x3c01('0xf')]);}else{logger['info'](_0x3c01('0x9'),_0x5abcbc,'request\x20sent');_0x39300e(_0x1b337f['result'][_0x3c01('0xf')]);}})[_0x3c01('0x10')](function(_0x49f962){logger[_0x3c01('0xd')](_0x3c01('0x9'),_0x5abcbc,_0x49f962);_0x562829(_0x49f962);});});}exports['CreateVoiceDialReport']=function(_0x59088f){var _0x2a7f7d=this;return new Promise(function(_0x112dbe,_0x16bbbc){return db[_0x3c01('0x11')][_0x3c01('0x12')](_0x59088f[_0x3c01('0x13')],{'raw':_0x59088f[_0x3c01('0x14')]?_0x59088f[_0x3c01('0x14')][_0x3c01('0x15')]===undefined?!![]:![]:!![]})['then'](function(_0x4fcea1){logger[_0x3c01('0x8')]('CreateVoiceDialReport',_0x59088f);logger[_0x3c01('0xb')](_0x3c01('0x16'),_0x59088f,JSON[_0x3c01('0xc')](_0x4fcea1));_0x112dbe(_0x4fcea1);})[_0x3c01('0x10')](function(_0x152434){logger[_0x3c01('0xd')]('CreateVoiceDialReport',_0x152434[_0x3c01('0xf')],_0x59088f);_0x16bbbc(_0x2a7f7d[_0x3c01('0xd')](0x1f4,_0x152434[_0x3c01('0xf')]));});});};exports[_0x3c01('0x17')]=function(_0xaabb9b){var _0x2353fd=this;return new Promise(function(_0x320a09,_0x16b4bc){return db[_0x3c01('0x11')][_0x3c01('0x18')](_0xaabb9b[_0x3c01('0x13')],{'raw':_0xaabb9b[_0x3c01('0x14')]?_0xaabb9b[_0x3c01('0x14')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xaabb9b[_0x3c01('0x14')]?_0xaabb9b['options'][_0x3c01('0x19')]||null:null,'attributes':_0xaabb9b['options']?_0xaabb9b[_0x3c01('0x14')][_0x3c01('0x1a')]||null:null,'limit':_0xaabb9b[_0x3c01('0x14')]?_0xaabb9b[_0x3c01('0x14')]['limit']||null:null})[_0x3c01('0x7')](function(_0x1c8598){logger[_0x3c01('0x8')](_0x3c01('0x17'),_0xaabb9b);logger[_0x3c01('0xb')](_0x3c01('0x17'),_0xaabb9b,JSON[_0x3c01('0xc')](_0x1c8598));_0x320a09(_0x1c8598);})[_0x3c01('0x10')](function(_0x418ad5){logger[_0x3c01('0xd')](_0x3c01('0x17'),_0x418ad5[_0x3c01('0xf')],_0xaabb9b);_0x16b4bc(_0x2353fd[_0x3c01('0xd')](0x1f4,_0x418ad5[_0x3c01('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 16a38f1..1f1643d 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 _0xd21d=['../../config/environment','./voiceExtension.controller','get','isAuthenticated','/:id','show','post','create','/:id/applications','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x4e5f34,_0x166307){var _0x1e9b8f=function(_0x49e25b){while(--_0x49e25b){_0x4e5f34['push'](_0x4e5f34['shift']());}};_0x1e9b8f(++_0x166307);}(_0xd21d,0x174));var _0xdd21=function(_0x314bb5,_0x476e6a){_0x314bb5=_0x314bb5-0x0;var _0x32c85e=_0xd21d[_0x314bb5];return _0x32c85e;};'use strict';var multer=require(_0xdd21('0x0'));var util=require(_0xdd21('0x1'));var path=require(_0xdd21('0x2'));var timeout=require(_0xdd21('0x3'));var express=require(_0xdd21('0x4'));var router=express[_0xdd21('0x5')]();var fs_extra=require(_0xdd21('0x6'));var auth=require(_0xdd21('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xdd21('0x8'));var controller=require(_0xdd21('0x9'));router[_0xdd21('0xa')]('/',auth[_0xdd21('0xb')](),controller['index']);router[_0xdd21('0xa')](_0xdd21('0xc'),auth[_0xdd21('0xb')](),controller[_0xdd21('0xd')]);router[_0xdd21('0xe')]('/',auth[_0xdd21('0xb')](),controller[_0xdd21('0xf')]);router['post'](_0xdd21('0x10'),auth['isAuthenticated'](),controller['addApplications']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xdd21('0x11')]);router[_0xdd21('0x12')](_0xdd21('0xc'),auth[_0xdd21('0xb')](),controller['destroy']);module[_0xdd21('0x13')]=router; \ No newline at end of file +var _0x4709=['../../components/auth/service','../../config/environment','./voiceExtension.controller','get','index','show','post','isAuthenticated','create','/:id/applications','addApplications','put','update','/:id','destroy','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x16bb4b,_0x5fe431){var _0x8aeb84=function(_0x36ba6e){while(--_0x36ba6e){_0x16bb4b['push'](_0x16bb4b['shift']());}};_0x8aeb84(++_0x5fe431);}(_0x4709,0xcc));var _0x9470=function(_0x136268,_0x2821a0){_0x136268=_0x136268-0x0;var _0x5279e1=_0x4709[_0x136268];return _0x5279e1;};'use strict';var multer=require(_0x9470('0x0'));var util=require(_0x9470('0x1'));var path=require('path');var timeout=require(_0x9470('0x2'));var express=require(_0x9470('0x3'));var router=express[_0x9470('0x4')]();var fs_extra=require(_0x9470('0x5'));var auth=require(_0x9470('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9470('0x7'));var controller=require(_0x9470('0x8'));router[_0x9470('0x9')]('/',auth['isAuthenticated'](),controller[_0x9470('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x9470('0xb')]);router[_0x9470('0xc')]('/',auth[_0x9470('0xd')](),controller[_0x9470('0xe')]);router[_0x9470('0xc')](_0x9470('0xf'),auth['isAuthenticated'](),controller[_0x9470('0x10')]);router[_0x9470('0x11')]('/:id',auth[_0x9470('0xd')](),controller[_0x9470('0x12')]);router['delete'](_0x9470('0x13'),auth[_0x9470('0xd')](),controller[_0x9470('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index f360f22..9bab703 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 _0xa5ca=['system','any','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0xa5ca,0x1e3));var _0xaa5c=function(_0x429948,_0x1a6851){_0x429948=_0x429948-0x0;var _0x35d5d1=_0xa5ca[_0x429948];return _0x35d5d1;};'use strict';var Sequelize=require(_0xaa5c('0x0'));module[_0xaa5c('0x1')]={'context':{'type':Sequelize[_0xaa5c('0x2')],'allowNull':![],'unique':_0xaa5c('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xaa5c('0x2')],'allowNull':![],'unique':_0xaa5c('0x3')},'priority':{'type':Sequelize[_0xaa5c('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0xaa5c('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xaa5c('0x2')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0xaa5c('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xaa5c('0x4')](_0xaa5c('0x5'),_0xaa5c('0x6'),_0xaa5c('0x7'),_0xaa5c('0x8'),_0xaa5c('0x9'),_0xaa5c('0xa'),_0xaa5c('0xb')),'allowNull':![]},'description':{'type':Sequelize[_0xaa5c('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0xaa5c('0xc')]},'isApp':{'type':Sequelize[_0xaa5c('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xaa5c('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xaa5c('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0xaa5c('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xaa5c('0xc')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0xaa5c('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0xaa5c('0xe')],'get':function(_0x1bc377){return this[_0xaa5c('0xf')](_0xaa5c('0x10'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xb0e4=['NoOp','ENUM','inbound','outbound','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','exten','sequelize','exports','compositeIndex','STRING'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0xb0e4,0x164));var _0x4b0e=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xb0e4[_0x1f9f37];return _0x21c080;};'use strict';var Sequelize=require(_0x4b0e('0x0'));module[_0x4b0e('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4b0e('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x4b0e('0x3')],'allowNull':![],'unique':_0x4b0e('0x2')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x4b0e('0x2')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x4b0e('0x3')],'allowNull':![],'defaultValue':_0x4b0e('0x4')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x4b0e('0x5')](_0x4b0e('0x6'),_0x4b0e('0x7'),'internal','inbound-fax',_0x4b0e('0x8'),_0x4b0e('0x9'),_0x4b0e('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0x4b0e('0x3')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4b0e('0xb')},'IntervalId':{'type':Sequelize[_0x4b0e('0xc')]},'isApp':{'type':Sequelize[_0x4b0e('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x4b0e('0x3')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0x4b0e('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x4b0e('0xe')},'answer':{'type':Sequelize[_0x4b0e('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0x4b0e('0xf')],'get':function(_0xc9c2ee){return this[_0x4b0e('0x10')](_0x4b0e('0x11'));}},'alias':{'type':Sequelize[_0x4b0e('0x3')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 7641468..7697903 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 _0xe4e4=['order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','length','params','body','startsWith','exten','create','role','user','get','inbound','internal','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','recordingFormat','alias','addApplications','transaction','sequelize','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','destroy','then','InboundRoutes','OutboundRoutes','outbound','InternalRoutes','filter','ignore','map','value','includes','type','find','name','error','send','index','VoiceExtension','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty'];(function(_0x49778b,_0x18e5e4){var _0x120c36=function(_0x4a2718){while(--_0x4a2718){_0x49778b['push'](_0x49778b['shift']());}};_0x120c36(++_0x18e5e4);}(_0xe4e4,0x83));var _0x4e4e=function(_0x5926b1,_0x49ccff){_0x5926b1=_0x5926b1-0x0;var _0x51d745=_0xe4e4[_0x5926b1];return _0x51d745;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x4e4e('0x0'));var config=require(_0x4e4e('0x1'));var db=require('../../mysqldb')['db'];config[_0x4e4e('0x2')]=_[_0x4e4e('0x3')](config[_0x4e4e('0x2')],{'host':_0x4e4e('0x4'),'port':0x18eb});var socket=require(_0x4e4e('0x5'))(new Redis(config[_0x4e4e('0x2')]));require('./voiceExtension.socket')[_0x4e4e('0x6')](socket);function respondWithStatusCode(_0x16607a,_0xebe2d5){_0xebe2d5=_0xebe2d5||0xcc;return function(_0x20d7b3){if(_0x20d7b3){return _0x16607a[_0x4e4e('0x7')](_0xebe2d5);}return _0x16607a[_0x4e4e('0x8')](_0xebe2d5)[_0x4e4e('0x9')]();};}function respondWithResult(_0x170f77,_0xbace87){_0xbace87=_0xbace87||0xc8;return function(_0x525a51){if(_0x525a51){return _0x170f77[_0x4e4e('0x8')](_0xbace87)['json'](_0x525a51);}};}function respondWithFilteredResult(_0x40d466,_0x29c850){return function(_0x350df9){if(_0x350df9){var _0x57dafe=typeof _0x29c850[_0x4e4e('0xa')]==='undefined'&&typeof _0x29c850[_0x4e4e('0xb')]===_0x4e4e('0xc');var _0x195ffa=_0x350df9[_0x4e4e('0xd')];var _0x1bf741=_0x57dafe?0x0:_0x29c850[_0x4e4e('0xa')];var _0x55a561=_0x57dafe?_0x350df9[_0x4e4e('0xd')]:_0x29c850[_0x4e4e('0xa')]+_0x29c850[_0x4e4e('0xb')];var _0x38c114;if(_0x55a561>=_0x195ffa){_0x55a561=_0x195ffa;_0x38c114=0xc8;}else{_0x38c114=0xce;}_0x40d466['status'](_0x38c114);return _0x40d466[_0x4e4e('0xe')](_0x4e4e('0xf'),_0x1bf741+'-'+_0x55a561+'/'+_0x195ffa)[_0x4e4e('0x10')](_0x350df9);}return null;};}function removeEntity(_0x42e946){return function(_0x158623){if(_0x158623){return _0x158623[_0x4e4e('0x11')]()[_0x4e4e('0x12')](function(){var _0x53e4e2=_0x158623['get']({'plain':!![]});var _0x21dae6=[{'name':_0x4e4e('0x13'),'value':'inbound','ignore':![]},{'name':_0x4e4e('0x14'),'value':_0x4e4e('0x15'),'ignore':![]},{'name':_0x4e4e('0x16'),'value':'internal','ignore':![]}];var _0x117d27=_(_0x21dae6)[_0x4e4e('0x17')](_0x4e4e('0x18'))[_0x4e4e('0x19')](_0x4e4e('0x1a'))[_0x4e4e('0x1a')]();if(_[_0x4e4e('0x1b')](_0x117d27,_0x53e4e2[_0x4e4e('0x1c')])){return;}var _0x52d276=_[_0x4e4e('0x1d')](_0x21dae6,['value',_0x53e4e2[_0x4e4e('0x1c')]])[_0x4e4e('0x1e')];return db['UserProfileResource'][_0x4e4e('0x11')]({'where':{'type':_0x52d276,'resourceId':_0x53e4e2['id']}})[_0x4e4e('0x12')](function(){return _0x158623;});})['then'](function(){_0x42e946[_0x4e4e('0x8')](0xcc)[_0x4e4e('0x9')]();});}};}function handleEntityNotFound(_0x5a393e){return function(_0x33627f){if(!_0x33627f){_0x5a393e['sendStatus'](0x194);}return _0x33627f;};}function handleError(_0x2ce68e,_0xb008ae){_0xb008ae=_0xb008ae||0x1f4;return function(_0x4e0009){logger[_0x4e4e('0x1f')](_0x4e0009['stack']);if(_0x4e0009[_0x4e4e('0x1e')]){delete _0x4e0009[_0x4e4e('0x1e')];}_0x2ce68e[_0x4e4e('0x8')](_0xb008ae)[_0x4e4e('0x20')](_0x4e0009);};}exports[_0x4e4e('0x21')]=function(_0x55a161,_0x437012){var _0x8526fa={},_0x16fc40={},_0x32d634={'count':0x0,'rows':[]};var _0x35c77c=_[_0x4e4e('0x19')](db[_0x4e4e('0x22')][_0x4e4e('0x23')],function(_0x12bcd0){return{'name':_0x12bcd0['fieldName'],'type':_0x12bcd0['type'][_0x4e4e('0x24')]};});_0x16fc40[_0x4e4e('0x25')]=_[_0x4e4e('0x19')](_0x35c77c,'name');_0x16fc40[_0x4e4e('0x26')]=_[_0x4e4e('0x27')](_0x55a161[_0x4e4e('0x26')]);_0x16fc40[_0x4e4e('0x28')]=_[_0x4e4e('0x29')](_0x16fc40['model'],_0x16fc40[_0x4e4e('0x26')]);_0x8526fa[_0x4e4e('0x2a')]=_[_0x4e4e('0x29')](_0x16fc40[_0x4e4e('0x25')],qs[_0x4e4e('0x2b')](_0x55a161[_0x4e4e('0x26')][_0x4e4e('0x2b')]));_0x8526fa['attributes']=_0x8526fa[_0x4e4e('0x2a')]['length']?_0x8526fa[_0x4e4e('0x2a')]:_0x16fc40[_0x4e4e('0x25')];if(!_0x55a161[_0x4e4e('0x26')][_0x4e4e('0x2c')]('nolimit')){_0x8526fa[_0x4e4e('0xb')]=qs[_0x4e4e('0xb')](_0x55a161[_0x4e4e('0x26')][_0x4e4e('0xb')]);_0x8526fa[_0x4e4e('0xa')]=qs['offset'](_0x55a161[_0x4e4e('0x26')]['offset']);}_0x8526fa[_0x4e4e('0x2d')]=qs[_0x4e4e('0x2e')](_0x55a161[_0x4e4e('0x26')]['sort']);_0x8526fa[_0x4e4e('0x2f')]=qs[_0x4e4e('0x28')](_[_0x4e4e('0x30')](_0x55a161['query'],_0x16fc40[_0x4e4e('0x28')]),_0x35c77c);if(_0x55a161['query'][_0x4e4e('0x17')]){_0x8526fa[_0x4e4e('0x2f')]=_[_0x4e4e('0x31')](_0x8526fa[_0x4e4e('0x2f')],{'$or':_[_0x4e4e('0x19')](_0x35c77c,function(_0x164a3e){if(_0x164a3e['type']!==_0x4e4e('0x32')){var _0x3d756b={};_0x3d756b[_0x164a3e['name']]={'$like':'%'+_0x55a161[_0x4e4e('0x26')][_0x4e4e('0x17')]+'%'};return _0x3d756b;}})});}_0x8526fa=_[_0x4e4e('0x31')]({},_0x8526fa,_0x55a161[_0x4e4e('0x33')]);var _0x214609={'where':_0x8526fa['where']};return db[_0x4e4e('0x22')][_0x4e4e('0xd')](_0x214609)[_0x4e4e('0x12')](function(_0x498f3d){_0x32d634[_0x4e4e('0xd')]=_0x498f3d;if(_0x55a161[_0x4e4e('0x26')][_0x4e4e('0x34')]){_0x8526fa[_0x4e4e('0x35')]=[{'all':!![]}];}return db['VoiceExtension'][_0x4e4e('0x36')](_0x8526fa);})['then'](function(_0xe7dd0c){_0x32d634[_0x4e4e('0x37')]=_0xe7dd0c;return _0x32d634;})[_0x4e4e('0x12')](respondWithFilteredResult(_0x437012,_0x8526fa))[_0x4e4e('0x38')](handleError(_0x437012,null));};exports['show']=function(_0x5375e9,_0x159642){var _0x311819={'raw':![],'where':{'id':_0x5375e9['params']['id']}},_0x211cff={};_0x211cff[_0x4e4e('0x25')]=_['keys'](db[_0x4e4e('0x22')][_0x4e4e('0x23')]);_0x211cff['query']=_[_0x4e4e('0x27')](_0x5375e9[_0x4e4e('0x26')]);_0x211cff[_0x4e4e('0x28')]=_['intersection'](_0x211cff['model'],_0x211cff[_0x4e4e('0x26')]);_0x311819['attributes']=_[_0x4e4e('0x29')](_0x211cff[_0x4e4e('0x25')],qs[_0x4e4e('0x2b')](_0x5375e9['query'][_0x4e4e('0x2b')]));_0x311819[_0x4e4e('0x2a')]=_0x311819[_0x4e4e('0x2a')][_0x4e4e('0x39')]?_0x311819[_0x4e4e('0x2a')]:_0x211cff[_0x4e4e('0x25')];if(_0x5375e9[_0x4e4e('0x26')][_0x4e4e('0x34')]){_0x311819[_0x4e4e('0x35')]=[{'all':!![]}];}_0x311819=_[_0x4e4e('0x31')]({},_0x311819,_0x5375e9[_0x4e4e('0x33')]);return db[_0x4e4e('0x22')][_0x4e4e('0x1d')](_0x311819)[_0x4e4e('0x12')](handleEntityNotFound(_0x159642,null))[_0x4e4e('0x12')](respondWithResult(_0x159642,null))[_0x4e4e('0x38')](handleError(_0x159642,null));};exports[_0x4e4e('0x11')]=function(_0x1625dc,_0x5240a4){return db[_0x4e4e('0x22')][_0x4e4e('0x1d')]({'where':{'id':_0x1625dc[_0x4e4e('0x3a')]['id']}})[_0x4e4e('0x12')](handleEntityNotFound(_0x5240a4,null))['then'](removeEntity(_0x5240a4,null))[_0x4e4e('0x38')](handleError(_0x5240a4,null));};exports['create']=function(_0x158e78,_0x5f4b7f){if(_0x158e78[_0x4e4e('0x3b')][_0x4e4e('0x1c')]===_0x4e4e('0x15')&&!_[_0x4e4e('0x3c')](_0x158e78[_0x4e4e('0x3b')][_0x4e4e('0x3d')],'_')){_0x158e78['body']['exten']='_'['concat'](_0x158e78[_0x4e4e('0x3b')][_0x4e4e('0x3d')]);}return db[_0x4e4e('0x22')][_0x4e4e('0x3e')](_0x158e78['body'],{'raw':![]})['then'](function(_0x32e734){var _0x2b03ff=_0x158e78['user']['get']({'plain':!![]});if(!_0x2b03ff)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b03ff[_0x4e4e('0x3f')]===_0x4e4e('0x40')){var _0x3e6147=_0x32e734[_0x4e4e('0x41')]({'plain':!![]});var _0x3073d5=[{'name':_0x4e4e('0x13'),'value':_0x4e4e('0x42')},{'name':_0x4e4e('0x14'),'value':_0x4e4e('0x15')},{'name':_0x4e4e('0x16'),'value':_0x4e4e('0x43')}];var _0x225d3e=_['find'](_0x3073d5,['value',_0x3e6147[_0x4e4e('0x1c')]])[_0x4e4e('0x1e')];return db[_0x4e4e('0x44')]['find']({'where':{'name':_0x225d3e,'userProfileId':_0x2b03ff[_0x4e4e('0x45')]},'raw':!![]})[_0x4e4e('0x12')](function(_0x3615cb){if(_0x3615cb&&_0x3615cb[_0x4e4e('0x46')]===0x0){return db[_0x4e4e('0x47')][_0x4e4e('0x3e')]({'name':_0x3e6147[_0x4e4e('0x1e')],'resourceId':_0x3e6147['id'],'type':_0x3615cb[_0x4e4e('0x1e')],'sectionId':_0x3615cb['id']},{})[_0x4e4e('0x12')](function(){return _0x32e734;});}else{return _0x32e734;}})[_0x4e4e('0x38')](function(_0x298cb0){logger[_0x4e4e('0x1f')](_0x4e4e('0x48'),_0x298cb0);throw _0x298cb0;});}return _0x32e734;})[_0x4e4e('0x12')](respondWithResult(_0x5f4b7f,0xc9))[_0x4e4e('0x38')](handleError(_0x5f4b7f,null));};exports['update']=function(_0x4ceb7e,_0x51fa6d){if(_0x4ceb7e[_0x4e4e('0x3b')]['id']){delete _0x4ceb7e['body']['id'];}return db[_0x4e4e('0x22')][_0x4e4e('0x1d')]({'where':{'id':_0x4ceb7e[_0x4e4e('0x3a')]['id']}})[_0x4e4e('0x12')](handleEntityNotFound(_0x51fa6d,null))[_0x4e4e('0x12')](function(_0x3296a7){if(_0x3296a7){return db[_0x4e4e('0x22')]['update'](_['pick'](_0x4ceb7e['body'],['exten',_0x4e4e('0x49'),'description',_0x4e4e('0x4a'),'cutdigits','mandatoryDisposition',_0x4e4e('0x4b')]),{'where':{'context':_0x3296a7[_0x4e4e('0x49')],'exten':_0x3296a7[_0x4e4e('0x3d')]},'individualHooks':!![]})[_0x4e4e('0x12')](function(_0x5c570b){return _0x5c570b;});}return null;})['then'](respondWithStatusCode(_0x51fa6d,null))['catch'](handleError(_0x51fa6d,null));};exports[_0x4e4e('0x4c')]=function(_0x2fdc53,_0x4426f2){var _0x4532c=_0x2fdc53[_0x4e4e('0x3a')]['id'];var _0x3566b1=_0x2fdc53[_0x4e4e('0x3b')];var _0x19c0da=0xc8;var _0x292f60=null;return db['sequelize'][_0x4e4e('0x4d')]({'isolationLevel':db[_0x4e4e('0x4e')]['Transaction'][_0x4e4e('0x4f')][_0x4e4e('0x50')]},function(_0xa7bf14){return db[_0x4e4e('0x22')][_0x4e4e('0x51')]({'where':{'id':_0x4532c},'transaction':_0xa7bf14})[_0x4e4e('0x12')](function(_0x16f337){if(_0x16f337){return db[_0x4e4e('0x22')]['destroy']({'where':{'VoiceExtensionId':_0x4532c},'transaction':_0xa7bf14})[_0x4e4e('0x12')](function(){var _0x3f183a=_[_0x4e4e('0x19')](_0x3566b1,function(_0x20e054){_0x20e054[_0x4e4e('0x52')]=_0x4532c;_0x20e054[_0x4e4e('0x53')]=!![];return _0x20e054;});return _0x16f337['createRouting'](_0x3f183a);})[_0x4e4e('0x12')](function(_0x5c8822){return db[_0x4e4e('0x22')][_0x4e4e('0x54')](_0x5c8822,{'transaction':_0xa7bf14});});}else{_0x19c0da=0x194;_0x292f60=[];}});})['then'](function(){if(_0x19c0da!==0x194){return db[_0x4e4e('0x22')][_0x4e4e('0x55')]({'where':{'isApp':!![],'VoiceExtensionId':_0x4532c},'order':_0x4e4e('0x56')})[_0x4e4e('0x12')](function(_0x3a453d){_0x292f60=_0x3a453d;});}})[_0x4e4e('0x38')](function(_0x17fbfe){_0x19c0da=0x1f4;logger['error'](_0x17fbfe['stack']);if(_0x17fbfe[_0x4e4e('0x1e')]){delete _0x17fbfe[_0x4e4e('0x1e')];}_0x292f60=_0x17fbfe;})[_0x4e4e('0x57')](function(){if(_0x292f60===null){_0x4426f2[_0x4e4e('0x7')](_0x19c0da);}else{if(_0x19c0da===0x1f4){_0x4426f2[_0x4e4e('0x8')](_0x19c0da)[_0x4e4e('0x20')](_0x292f60);}else{_0x4426f2['status'](_0x19c0da)[_0x4e4e('0x10')](_0x292f60);}}});}; \ No newline at end of file +var _0xf481=['filter','ignore','map','type','find','value','name','UserProfileResource','then','sendStatus','stack','index','VoiceExtension','rawAttributes','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','merge','options','includeAll','include','rows','show','catch','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','InboundRoutes','inbound','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','recordingFormat','mandatoryDisposition','alias','context','params','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','send','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','destroy','get','OutboundRoutes','outbound','InternalRoutes','internal'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xf481,0xff));var _0x1f48=function(_0x2d66a8,_0x1625a2){_0x2d66a8=_0x2d66a8-0x0;var _0x374b6e=_0xf481[_0x2d66a8];return _0x374b6e;};'use strict';var _=require(_0x1f48('0x0'));var Redis=require(_0x1f48('0x1'));var qs=require(_0x1f48('0x2'));var logger=require(_0x1f48('0x3'))(_0x1f48('0x4'));var config=require(_0x1f48('0x5'));var db=require(_0x1f48('0x6'))['db'];config[_0x1f48('0x7')]=_['defaults'](config[_0x1f48('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x1f48('0x8'))(new Redis(config['redis']));require('./voiceExtension.socket')[_0x1f48('0x9')](socket);function respondWithStatusCode(_0x1844b5,_0x6070b4){_0x6070b4=_0x6070b4||0xcc;return function(_0x4f08af){if(_0x4f08af){return _0x1844b5['sendStatus'](_0x6070b4);}return _0x1844b5[_0x1f48('0xa')](_0x6070b4)[_0x1f48('0xb')]();};}function respondWithResult(_0x84660a,_0x279365){_0x279365=_0x279365||0xc8;return function(_0x588f77){if(_0x588f77){return _0x84660a[_0x1f48('0xa')](_0x279365)[_0x1f48('0xc')](_0x588f77);}};}function respondWithFilteredResult(_0x1a0d35,_0xcc21a2){return function(_0x1daff7){if(_0x1daff7){var _0x494110=typeof _0xcc21a2[_0x1f48('0xd')]===_0x1f48('0xe')&&typeof _0xcc21a2[_0x1f48('0xf')]===_0x1f48('0xe');var _0xd0d282=_0x1daff7[_0x1f48('0x10')];var _0x4fd15c=_0x494110?0x0:_0xcc21a2[_0x1f48('0xd')];var _0x4169b0=_0x494110?_0x1daff7[_0x1f48('0x10')]:_0xcc21a2[_0x1f48('0xd')]+_0xcc21a2[_0x1f48('0xf')];var _0x3fd1ac;if(_0x4169b0>=_0xd0d282){_0x4169b0=_0xd0d282;_0x3fd1ac=0xc8;}else{_0x3fd1ac=0xce;}_0x1a0d35[_0x1f48('0xa')](_0x3fd1ac);return _0x1a0d35[_0x1f48('0x11')]('Content-Range',_0x4fd15c+'-'+_0x4169b0+'/'+_0xd0d282)[_0x1f48('0xc')](_0x1daff7);}return null;};}function removeEntity(_0x541116){return function(_0x4aff83){if(_0x4aff83){return _0x4aff83[_0x1f48('0x12')]()['then'](function(){var _0x369b2e=_0x4aff83[_0x1f48('0x13')]({'plain':!![]});var _0x359f91=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':_0x1f48('0x14'),'value':_0x1f48('0x15'),'ignore':![]},{'name':_0x1f48('0x16'),'value':_0x1f48('0x17'),'ignore':![]}];var _0x3c061a=_(_0x359f91)[_0x1f48('0x18')](_0x1f48('0x19'))[_0x1f48('0x1a')]('value')['value']();if(_['includes'](_0x3c061a,_0x369b2e[_0x1f48('0x1b')])){return;}var _0x4dac84=_[_0x1f48('0x1c')](_0x359f91,[_0x1f48('0x1d'),_0x369b2e[_0x1f48('0x1b')]])[_0x1f48('0x1e')];return db[_0x1f48('0x1f')][_0x1f48('0x12')]({'where':{'type':_0x4dac84,'resourceId':_0x369b2e['id']}})[_0x1f48('0x20')](function(){return _0x4aff83;});})[_0x1f48('0x20')](function(){_0x541116[_0x1f48('0xa')](0xcc)[_0x1f48('0xb')]();});}};}function handleEntityNotFound(_0x268cb3){return function(_0x2ba766){if(!_0x2ba766){_0x268cb3[_0x1f48('0x21')](0x194);}return _0x2ba766;};}function handleError(_0x310b93,_0x10b3bf){_0x10b3bf=_0x10b3bf||0x1f4;return function(_0xe8f8ad){logger['error'](_0xe8f8ad[_0x1f48('0x22')]);if(_0xe8f8ad[_0x1f48('0x1e')]){delete _0xe8f8ad['name'];}_0x310b93['status'](_0x10b3bf)['send'](_0xe8f8ad);};}exports[_0x1f48('0x23')]=function(_0x103198,_0x52fb4f){var _0x11807b={},_0x2c2a33={},_0x14ad73={'count':0x0,'rows':[]};var _0x1fe1e2=_['map'](db[_0x1f48('0x24')][_0x1f48('0x25')],function(_0x426026){return{'name':_0x426026['fieldName'],'type':_0x426026['type']['key']};});_0x2c2a33['model']=_[_0x1f48('0x1a')](_0x1fe1e2,_0x1f48('0x1e'));_0x2c2a33[_0x1f48('0x26')]=_[_0x1f48('0x27')](_0x103198[_0x1f48('0x26')]);_0x2c2a33['filters']=_[_0x1f48('0x28')](_0x2c2a33[_0x1f48('0x29')],_0x2c2a33['query']);_0x11807b['attributes']=_[_0x1f48('0x28')](_0x2c2a33[_0x1f48('0x29')],qs[_0x1f48('0x2a')](_0x103198[_0x1f48('0x26')]['fields']));_0x11807b[_0x1f48('0x2b')]=_0x11807b[_0x1f48('0x2b')][_0x1f48('0x2c')]?_0x11807b[_0x1f48('0x2b')]:_0x2c2a33[_0x1f48('0x29')];if(!_0x103198[_0x1f48('0x26')][_0x1f48('0x2d')](_0x1f48('0x2e'))){_0x11807b['limit']=qs['limit'](_0x103198[_0x1f48('0x26')][_0x1f48('0xf')]);_0x11807b[_0x1f48('0xd')]=qs[_0x1f48('0xd')](_0x103198[_0x1f48('0x26')][_0x1f48('0xd')]);}_0x11807b[_0x1f48('0x2f')]=qs[_0x1f48('0x30')](_0x103198[_0x1f48('0x26')][_0x1f48('0x30')]);_0x11807b[_0x1f48('0x31')]=qs[_0x1f48('0x32')](_[_0x1f48('0x33')](_0x103198[_0x1f48('0x26')],_0x2c2a33[_0x1f48('0x32')]),_0x1fe1e2);if(_0x103198[_0x1f48('0x26')][_0x1f48('0x18')]){_0x11807b[_0x1f48('0x31')]=_['merge'](_0x11807b[_0x1f48('0x31')],{'$or':_[_0x1f48('0x1a')](_0x1fe1e2,function(_0x132cec){if(_0x132cec[_0x1f48('0x1b')]!==_0x1f48('0x34')){var _0x141d40={};_0x141d40[_0x132cec[_0x1f48('0x1e')]]={'$like':'%'+_0x103198['query']['filter']+'%'};return _0x141d40;}})});}_0x11807b=_[_0x1f48('0x35')]({},_0x11807b,_0x103198[_0x1f48('0x36')]);var _0x100857={'where':_0x11807b[_0x1f48('0x31')]};return db['VoiceExtension'][_0x1f48('0x10')](_0x100857)['then'](function(_0xcad32a){_0x14ad73[_0x1f48('0x10')]=_0xcad32a;if(_0x103198['query'][_0x1f48('0x37')]){_0x11807b[_0x1f48('0x38')]=[{'all':!![]}];}return db['VoiceExtension']['findAll'](_0x11807b);})[_0x1f48('0x20')](function(_0x11bf55){_0x14ad73[_0x1f48('0x39')]=_0x11bf55;return _0x14ad73;})['then'](respondWithFilteredResult(_0x52fb4f,_0x11807b))['catch'](handleError(_0x52fb4f,null));};exports[_0x1f48('0x3a')]=function(_0x4e051,_0x21131c){var _0x278c2a={'raw':![],'where':{'id':_0x4e051['params']['id']}},_0xd2ae71={};_0xd2ae71[_0x1f48('0x29')]=_[_0x1f48('0x27')](db[_0x1f48('0x24')][_0x1f48('0x25')]);_0xd2ae71[_0x1f48('0x26')]=_[_0x1f48('0x27')](_0x4e051[_0x1f48('0x26')]);_0xd2ae71['filters']=_[_0x1f48('0x28')](_0xd2ae71[_0x1f48('0x29')],_0xd2ae71[_0x1f48('0x26')]);_0x278c2a['attributes']=_[_0x1f48('0x28')](_0xd2ae71[_0x1f48('0x29')],qs[_0x1f48('0x2a')](_0x4e051['query'][_0x1f48('0x2a')]));_0x278c2a[_0x1f48('0x2b')]=_0x278c2a[_0x1f48('0x2b')]['length']?_0x278c2a[_0x1f48('0x2b')]:_0xd2ae71[_0x1f48('0x29')];if(_0x4e051[_0x1f48('0x26')][_0x1f48('0x37')]){_0x278c2a[_0x1f48('0x38')]=[{'all':!![]}];}_0x278c2a=_[_0x1f48('0x35')]({},_0x278c2a,_0x4e051[_0x1f48('0x36')]);return db[_0x1f48('0x24')]['find'](_0x278c2a)['then'](handleEntityNotFound(_0x21131c,null))['then'](respondWithResult(_0x21131c,null))[_0x1f48('0x3b')](handleError(_0x21131c,null));};exports[_0x1f48('0x12')]=function(_0x5dd106,_0x5a92fe){return db[_0x1f48('0x24')]['find']({'where':{'id':_0x5dd106['params']['id']}})[_0x1f48('0x20')](handleEntityNotFound(_0x5a92fe,null))[_0x1f48('0x20')](removeEntity(_0x5a92fe,null))['catch'](handleError(_0x5a92fe,null));};exports[_0x1f48('0x3c')]=function(_0x1f7fe5,_0x2694d){if(_0x1f7fe5[_0x1f48('0x3d')][_0x1f48('0x1b')]===_0x1f48('0x15')&&!_[_0x1f48('0x3e')](_0x1f7fe5[_0x1f48('0x3d')][_0x1f48('0x3f')],'_')){_0x1f7fe5['body'][_0x1f48('0x3f')]='_'[_0x1f48('0x40')](_0x1f7fe5[_0x1f48('0x3d')][_0x1f48('0x3f')]);}return db[_0x1f48('0x24')][_0x1f48('0x3c')](_0x1f7fe5[_0x1f48('0x3d')],{'raw':![]})[_0x1f48('0x20')](function(_0x556e39){var _0x52d309=_0x1f7fe5[_0x1f48('0x41')][_0x1f48('0x13')]({'plain':!![]});if(!_0x52d309)throw new Error(_0x1f48('0x42'));if(_0x52d309['role']===_0x1f48('0x41')){var _0x4f9964=_0x556e39['get']({'plain':!![]});var _0x35eb8a=[{'name':_0x1f48('0x43'),'value':_0x1f48('0x44')},{'name':'OutboundRoutes','value':_0x1f48('0x15')},{'name':_0x1f48('0x16'),'value':_0x1f48('0x17')}];var _0x2d0029=_[_0x1f48('0x1c')](_0x35eb8a,['value',_0x4f9964[_0x1f48('0x1b')]])[_0x1f48('0x1e')];return db[_0x1f48('0x45')][_0x1f48('0x1c')]({'where':{'name':_0x2d0029,'userProfileId':_0x52d309['userProfileId']},'raw':!![]})[_0x1f48('0x20')](function(_0x5bf2b4){if(_0x5bf2b4&&_0x5bf2b4[_0x1f48('0x46')]===0x0){return db[_0x1f48('0x1f')]['create']({'name':_0x4f9964[_0x1f48('0x1e')],'resourceId':_0x4f9964['id'],'type':_0x5bf2b4[_0x1f48('0x1e')],'sectionId':_0x5bf2b4['id']},{})['then'](function(){return _0x556e39;});}else{return _0x556e39;}})['catch'](function(_0x311556){logger[_0x1f48('0x47')](_0x1f48('0x48'),_0x311556);throw _0x311556;});}return _0x556e39;})[_0x1f48('0x20')](respondWithResult(_0x2694d,0xc9))[_0x1f48('0x3b')](handleError(_0x2694d,null));};exports[_0x1f48('0x49')]=function(_0x34aac8,_0x3ad2f8){if(_0x34aac8[_0x1f48('0x3d')]['id']){delete _0x34aac8['body']['id'];}return db[_0x1f48('0x24')]['find']({'where':{'id':_0x34aac8['params']['id']}})[_0x1f48('0x20')](handleEntityNotFound(_0x3ad2f8,null))[_0x1f48('0x20')](function(_0x56ccb7){if(_0x56ccb7){return db[_0x1f48('0x24')][_0x1f48('0x49')](_[_0x1f48('0x33')](_0x34aac8[_0x1f48('0x3d')],[_0x1f48('0x3f'),'context',_0x1f48('0x4a'),_0x1f48('0x4b'),'cutdigits',_0x1f48('0x4c'),_0x1f48('0x4d')]),{'where':{'context':_0x56ccb7[_0x1f48('0x4e')],'exten':_0x56ccb7[_0x1f48('0x3f')]},'individualHooks':!![]})[_0x1f48('0x20')](function(_0x4a41b4){return _0x4a41b4;});}return null;})[_0x1f48('0x20')](respondWithStatusCode(_0x3ad2f8,null))[_0x1f48('0x3b')](handleError(_0x3ad2f8,null));};exports['addApplications']=function(_0x1a96dc,_0x12f978){var _0x5b302a=_0x1a96dc[_0x1f48('0x4f')]['id'];var _0x5e3ee1=_0x1a96dc['body'];var _0x3849e3=0xc8;var _0x1576bc=null;return db[_0x1f48('0x50')]['transaction']({'isolationLevel':db[_0x1f48('0x50')][_0x1f48('0x51')][_0x1f48('0x52')][_0x1f48('0x53')]},function(_0x126065){return db['VoiceExtension'][_0x1f48('0x54')]({'where':{'id':_0x5b302a},'transaction':_0x126065})['then'](function(_0xa1054a){if(_0xa1054a){return db[_0x1f48('0x24')]['destroy']({'where':{'VoiceExtensionId':_0x5b302a},'transaction':_0x126065})[_0x1f48('0x20')](function(){var _0x1674e3=_['map'](_0x5e3ee1,function(_0x582b0c){_0x582b0c[_0x1f48('0x55')]=_0x5b302a;_0x582b0c[_0x1f48('0x56')]=!![];return _0x582b0c;});return _0xa1054a[_0x1f48('0x57')](_0x1674e3);})[_0x1f48('0x20')](function(_0x506aa6){return db['VoiceExtension'][_0x1f48('0x58')](_0x506aa6,{'transaction':_0x126065});});}else{_0x3849e3=0x194;_0x1576bc=[];}});})['then'](function(){if(_0x3849e3!==0x194){return db[_0x1f48('0x24')][_0x1f48('0x59')]({'where':{'isApp':!![],'VoiceExtensionId':_0x5b302a},'order':_0x1f48('0x5a')})[_0x1f48('0x20')](function(_0x1f5b23){_0x1576bc=_0x1f5b23;});}})[_0x1f48('0x3b')](function(_0x5477c4){_0x3849e3=0x1f4;logger[_0x1f48('0x47')](_0x5477c4['stack']);if(_0x5477c4[_0x1f48('0x1e')]){delete _0x5477c4[_0x1f48('0x1e')];}_0x1576bc=_0x5477c4;})[_0x1f48('0x5b')](function(){if(_0x1576bc===null){_0x12f978[_0x1f48('0x21')](_0x3849e3);}else{if(_0x3849e3===0x1f4){_0x12f978[_0x1f48('0xa')](_0x3849e3)[_0x1f48('0x5c')](_0x1576bc);}else{_0x12f978['status'](_0x3849e3)[_0x1f48('0xc')](_0x1576bc);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 2ee9547..478c9dd 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 _0xee50=['hasOwnProperty','hook','exports','../../mysqldb','VoiceExtension','setMaxListeners','save','remove','emit'];(function(_0x55cc58,_0x5ce0af){var _0x26062e=function(_0x59e29d){while(--_0x59e29d){_0x55cc58['push'](_0x55cc58['shift']());}};_0x26062e(++_0x5ce0af);}(_0xee50,0xf6));var _0x0ee5=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xee50[_0x11005e];return _0x29338f;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x0ee5('0x0'))['db'][_0x0ee5('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x0ee5('0x2')](0x0);var events={'afterCreate':_0x0ee5('0x3'),'afterUpdate':'update','afterDestroy':_0x0ee5('0x4')};function emitEvent(_0x1ed78f){return function(_0x3be2b3,_0x3c65be,_0x1d82b6){VoiceExtensionEvents[_0x0ee5('0x5')](_0x1ed78f+':'+_0x3be2b3['id'],_0x3be2b3);VoiceExtensionEvents[_0x0ee5('0x5')](_0x1ed78f,_0x3be2b3);_0x1d82b6(null);};}for(var e in events){if(events[_0x0ee5('0x6')](e)){var event=events[e];VoiceExtension[_0x0ee5('0x7')](e,emitEvent(event));}}module[_0x0ee5('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0x9eb4=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','VoiceExtension'];(function(_0x56b138,_0x2396d6){var _0x3df878=function(_0x4b3ccc){while(--_0x4b3ccc){_0x56b138['push'](_0x56b138['shift']());}};_0x3df878(++_0x2396d6);}(_0x9eb4,0x153));var _0x49eb=function(_0x229fa7,_0xcf12a5){_0x229fa7=_0x229fa7-0x0;var _0x26ee05=_0x9eb4[_0x229fa7];return _0x26ee05;};'use strict';var EventEmitter=require(_0x49eb('0x0'));var VoiceExtension=require(_0x49eb('0x1'))['db'][_0x49eb('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x49eb('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x49eb('0x4'),'afterDestroy':_0x49eb('0x5')};function emitEvent(_0x607ccd){return function(_0x1c7592,_0x192aeb,_0x1ed16d){VoiceExtensionEvents[_0x49eb('0x6')](_0x607ccd+':'+_0x1c7592['id'],_0x1c7592);VoiceExtensionEvents['emit'](_0x607ccd,_0x1c7592);_0x1ed16d(null);};}for(var e in events){if(events[_0x49eb('0x7')](e)){var event=events[e];VoiceExtension[_0x49eb('0x8')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 10586ad..ad2c153 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 _0x1e1b=['exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','url','name','trunk','split','phone','param','prefix','SIP','options','indexOf','U(xcally-mixmonitor-context)','replace','join','isEmpty','Interval','interval','then','length','*,*,*,*','intervals','IntervalId','map','toLowerCase','tag','CDR(tag)=','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','includes','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','appType','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','concat','catch','define','VoiceExtension','get','last','lodash','./voiceExtension.attributes','models','type','Set','context'];(function(_0x5b2ad1,_0x4c8974){var _0x5a3c7d=function(_0x4d7e70){while(--_0x4d7e70){_0x5b2ad1['push'](_0x5b2ad1['shift']());}};_0x5a3c7d(++_0x4c8974);}(_0x1e1b,0xfc));var _0xb1e1=function(_0x93942f,_0xb48547){_0x93942f=_0x93942f-0x0;var _0x23fcd8=_0x1e1b[_0x93942f];return _0x23fcd8;};'use strict';var _=require(_0xb1e1('0x0'));var attributes=require(_0xb1e1('0x1'));module['exports']=function(_0x380337){var _0x1f06dc=_0x380337[_0xb1e1('0x2')];function _0x3b0a58(_0x22a9d6){var _0x2ea24a=0x2;var _0x4e7a0b=[{'type':_0x22a9d6[_0xb1e1('0x3')],'app':_0xb1e1('0x4'),'appdata':'CDR(type)='+_0x22a9d6[_0xb1e1('0x3')],'context':_0x22a9d6[_0xb1e1('0x5')],'exten':_0x22a9d6[_0xb1e1('0x6')],'priority':_0x2ea24a++,'VoiceExtensionId':_0x22a9d6['id']},{'type':_0x22a9d6[_0xb1e1('0x3')],'app':_0x22a9d6[_0xb1e1('0x7')]?_0xb1e1('0x4'):_0xb1e1('0x8'),'appdata':_0x22a9d6[_0xb1e1('0x7')]?_0xb1e1('0x9')+_0x22a9d6[_0xb1e1('0x7')]:_0xb1e1('0xa'),'context':_0x22a9d6['context'],'exten':_0x22a9d6[_0xb1e1('0x6')],'priority':_0x2ea24a++,'VoiceExtensionId':_0x22a9d6['id']}];if(_0x22a9d6['type']===_0xb1e1('0xb')){_0x4e7a0b[_0xb1e1('0xc')]({'type':_0xb1e1('0xb'),'app':_0xb1e1('0x4'),'appdata':_0xb1e1('0xd')+_0x22a9d6['id'],'context':_0x22a9d6['context'],'exten':_0x22a9d6[_0xb1e1('0x6')],'priority':_0x2ea24a++,'VoiceExtensionId':_0x22a9d6['id']});}_0x4e7a0b[_0xb1e1('0xc')]({'type':_0x22a9d6[_0xb1e1('0x3')],'app':_0xb1e1('0x4'),'appdata':_0xb1e1('0xe'),'context':_0x22a9d6[_0xb1e1('0x5')],'exten':_0x22a9d6[_0xb1e1('0x6')],'priority':_0x2ea24a++,'VoiceExtensionId':_0x22a9d6['id']},{'type':_0x22a9d6[_0xb1e1('0x3')],'app':_0xb1e1('0x4'),'appdata':_0xb1e1('0xf'),'context':_0x22a9d6[_0xb1e1('0x5')],'exten':_0x22a9d6['exten'],'priority':_0x2ea24a++,'VoiceExtensionId':_0x22a9d6['id']},{'type':_0x22a9d6['type'],'app':'Set','appdata':_0xb1e1('0x10'),'context':_0x22a9d6[_0xb1e1('0x5')],'exten':_0x22a9d6['exten'],'priority':_0x2ea24a++,'VoiceExtensionId':_0x22a9d6['id']});return _0x4e7a0b;}function _0xe83b68(_0x46d0a0){var _0xb18f8=0x2;var _0xb5934e=[{'type':'outbound','app':_0xb1e1('0x4'),'appdata':_0xb1e1('0x11'),'context':_0x46d0a0['context'],'exten':_0x46d0a0[_0xb1e1('0x6')],'priority':_0xb18f8++,'VoiceExtensionId':_0x46d0a0['id']},{'type':_0xb1e1('0x12'),'app':_0x46d0a0[_0xb1e1('0x7')]?'Set':_0xb1e1('0x8'),'appdata':_0x46d0a0[_0xb1e1('0x7')]?_0xb1e1('0x9')+_0x46d0a0[_0xb1e1('0x7')]:'No\x20alias\x20set','context':_0x46d0a0[_0xb1e1('0x5')],'exten':_0x46d0a0['exten'],'priority':_0xb18f8++,'VoiceExtensionId':_0x46d0a0['id']},{'type':_0xb1e1('0x12'),'app':_0xb1e1('0x4'),'appdata':_0xb1e1('0x13')+(_0x46d0a0['cutdigits']?_0xb1e1('0x14')+_0x46d0a0[_0xb1e1('0x15')]+'}':_0xb1e1('0x16')),'context':_0x46d0a0[_0xb1e1('0x5')],'exten':_0x46d0a0[_0xb1e1('0x6')],'priority':_0xb18f8++,'VoiceExtensionId':_0x46d0a0['id']},{'type':'outbound','app':_0xb1e1('0x4'),'appdata':'CDR(routeid)='+_0x46d0a0['id'],'context':_0x46d0a0[_0xb1e1('0x5')],'exten':_0x46d0a0[_0xb1e1('0x6')],'priority':_0xb18f8++,'VoiceExtensionId':_0x46d0a0['id']},{'type':_0xb1e1('0x12'),'app':_0xb1e1('0x17'),'appdata':_0xb1e1('0x18')+(_0xb18f8+0x2)+_0xb1e1('0x19')+(_0xb18f8+0x1)+')','context':_0x46d0a0[_0xb1e1('0x5')],'exten':_0x46d0a0['exten'],'priority':_0xb18f8++,'VoiceExtensionId':_0x46d0a0['id']},{'type':'outbound','app':_0xb1e1('0x4'),'appdata':_0x46d0a0[_0xb1e1('0x15')]?_0xb1e1('0x1a')+_0x46d0a0['cutdigits']+'}':_0xb1e1('0x1b'),'context':_0x46d0a0[_0xb1e1('0x5')],'exten':_0x46d0a0[_0xb1e1('0x6')],'priority':_0xb18f8++,'VoiceExtensionId':_0x46d0a0['id']},{'type':_0xb1e1('0x12'),'app':_0xb1e1('0x4'),'appdata':_0xb1e1('0xe'),'context':_0x46d0a0[_0xb1e1('0x5')],'exten':_0x46d0a0['exten'],'priority':_0xb18f8++,'VoiceExtensionId':_0x46d0a0['id']},{'type':_0xb1e1('0x12'),'app':_0xb1e1('0x4'),'appdata':_0xb1e1('0xf'),'context':_0x46d0a0['context'],'exten':_0x46d0a0['exten'],'priority':_0xb18f8++,'VoiceExtensionId':_0x46d0a0['id']},{'type':_0xb1e1('0x12'),'app':_0xb1e1('0x4'),'appdata':_0xb1e1('0x10'),'context':_0x46d0a0[_0xb1e1('0x5')],'exten':_0x46d0a0[_0xb1e1('0x6')],'priority':_0xb18f8++,'VoiceExtensionId':_0x46d0a0['id']},{'type':_0xb1e1('0x12'),'app':_0xb1e1('0x4'),'appdata':_0xb1e1('0x1c')+_0x46d0a0['id'],'context':_0x46d0a0[_0xb1e1('0x5')],'exten':_0x46d0a0['exten'],'priority':_0xb18f8++,'VoiceExtensionId':_0x46d0a0['id']}];if(_0x46d0a0[_0xb1e1('0x1d')](_0xb1e1('0x1e'))&&_0x46d0a0[_0xb1e1('0x1e')]!==_0xb1e1('0x1f')){_0xb5934e[_0xb1e1('0xc')]({'type':_0xb1e1('0x12'),'app':_0xb1e1('0x4'),'appdata':_0xb1e1('0x20'),'context':_0x46d0a0[_0xb1e1('0x5')],'exten':_0x46d0a0[_0xb1e1('0x6')],'priority':_0xb18f8++,'VoiceExtensionId':_0x46d0a0['id']},{'type':_0xb1e1('0x12'),'app':_0xb1e1('0x4'),'appdata':_0xb1e1('0x21')+_0x46d0a0[_0xb1e1('0x1e')]||_0xb1e1('0x22'),'context':_0x46d0a0[_0xb1e1('0x5')],'exten':_0x46d0a0[_0xb1e1('0x6')],'priority':_0xb18f8++,'VoiceExtensionId':_0x46d0a0['id']});}return _0xb5934e;}function _0x287c4f(_0x446f1d,_0x4b0994){var _0x4e6c10=[{'name':'trunk','param':0x0},{'name':'timeout','param':0x1},{'name':'options','param':0x2},{'name':_0xb1e1('0x23'),'param':0x3}];var _0xd476a4={};var _0x260235=_0x4b0994['split'](',');var _0x1d6374=[];for(var _0xcc5ef7=0x0;_0xcc5ef7<_0x4e6c10['length'];_0xcc5ef7++){switch(_0x4e6c10[_0xcc5ef7][_0xb1e1('0x24')]){case _0xb1e1('0x25'):_0xd476a4[_0xb1e1('0x25')]=_0x260235[_0x4e6c10[_0xcc5ef7]['param']][_0xb1e1('0x26')]('/')[0x1];_0xd476a4[_0xb1e1('0x27')]=_0x260235[_0x4e6c10[_0xcc5ef7][_0xb1e1('0x28')]][_0xb1e1('0x26')]('/')[0x2];_0xd476a4[_0xb1e1('0x29')]=_0xd476a4[_0xb1e1('0x27')]?_0xd476a4[_0xb1e1('0x27')]['split']('$')[0x0]:undefined;_0xd476a4[_0xb1e1('0x27')]=_0x446f1d[_0xb1e1('0x15')]?(_0xd476a4['prefix']||'')+_0xb1e1('0x14')+_0x446f1d[_0xb1e1('0x15')]+'}':(_0xd476a4[_0xb1e1('0x29')]||'')+_0xb1e1('0x16');_0x1d6374[_0x4e6c10[_0xcc5ef7]['param']]=[_0xb1e1('0x2a'),_0xd476a4[_0xb1e1('0x25')],_0xd476a4[_0xb1e1('0x27')]]['join']('/');break;case _0xb1e1('0x2b'):_0xd476a4[_0xb1e1('0x2b')]=_0x260235[_0x4e6c10[_0xcc5ef7]['param']];if(_0x446f1d[_0xb1e1('0x1e')]!=='none'){if(_0xd476a4[_0xb1e1('0x2b')][_0xb1e1('0x2c')](_0xb1e1('0x2d'))<0x0){_0xd476a4['options']+=_0xb1e1('0x2d');}}else{_0xd476a4['options']=_0xd476a4[_0xb1e1('0x2b')][_0xb1e1('0x2e')](_0xb1e1('0x2d'),'');}_0x1d6374[_0x4e6c10[_0xcc5ef7]['param']]=_0xd476a4[_0xb1e1('0x2b')];break;default:_0x1d6374[_0x4e6c10[_0xcc5ef7][_0xb1e1('0x28')]]=_0x260235[_0x4e6c10[_0xcc5ef7]['param']];}}return _0x1d6374[_0xb1e1('0x2f')](',');}function _0x512ec5(_0x1e6a21,_0x44d04e,_0x230fc8){return new Promise(function(_0x209dc2,_0x4ef31e){var _0x5bffb9=[];if(_[_0xb1e1('0x30')](_0x44d04e))return _0x209dc2(_0x5bffb9);_0x1f06dc[_0xb1e1('0x31')]['findAll']({'attributes':['id',_0xb1e1('0x32'),'IntervalId'],'raw':!![]})[_0xb1e1('0x33')](function(_0x542a79){for(var _0x3de839=0x0,_0xc8554d=0x0;_0x3de839<_0x44d04e[_0xb1e1('0x34')];_0x3de839++,_0xc8554d=0x0){var _0x128824=_0x44d04e[_0x3de839];var _0xfe8139=[];var _0x116b5a=[];delete _0x128824['id'];if(_0x128824[_0xb1e1('0x32')]!==_0xb1e1('0x35')){_0x128824[_0xb1e1('0x36')]=[_0x128824['interval']];}else{_0x128824[_0xb1e1('0x36')]=_0x128824[_0xb1e1('0x37')]?_[_0xb1e1('0x38')](_['filter'](_0x542a79,{'IntervalId':_0x128824['IntervalId']}),_0xb1e1('0x32')):[];}_0x128824[_0xb1e1('0x5')]=_0x1e6a21[_0xb1e1('0x5')];_0x128824['exten']=_0x1e6a21['exten'];if(_0x128824[_0xb1e1('0x3')])_0x128824['type']=_0x128824['type'][_0xb1e1('0x39')]();if(_0x1e6a21[_0xb1e1('0x3')]===_0xb1e1('0x12')){if(_0x128824[_0xb1e1('0x1d')](_0xb1e1('0x3a'))&&_0x128824[_0xb1e1('0x3a')]&&_0x128824[_0xb1e1('0x3a')]!=='--'){_0xfe8139[_0xb1e1('0xc')]({'type':_0x128824[_0xb1e1('0x3')][_0xb1e1('0x39')](),'app':'Set','appdata':_0xb1e1('0x3b')+_0x128824[_0xb1e1('0x3a')],'context':_0x1e6a21[_0xb1e1('0x5')],'exten':_0x1e6a21[_0xb1e1('0x6')],'priority':_0x128824[_0xb1e1('0x36')][_0xb1e1('0x34')]+_0x230fc8+_0xc8554d++,'VoiceExtensionId':_0x1e6a21['id']});}_0xfe8139[_0xb1e1('0xc')]({'type':_0x128824[_0xb1e1('0x3')][_0xb1e1('0x39')](),'app':_0xb1e1('0x17'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x128824[_0xb1e1('0x3c')]?_0xb1e1('0x3d')+_0x128824[_0xb1e1('0x3c')]+')':_0xb1e1('0x3e')),'context':_0x1e6a21[_0xb1e1('0x5')],'exten':_0x1e6a21[_0xb1e1('0x6')],'priority':_0x128824[_0xb1e1('0x36')][_0xb1e1('0x34')]+_0x230fc8+_0xc8554d++,'VoiceExtensionId':_0x1e6a21['id']});}else{if(_0x128824[_0xb1e1('0x1d')](_0xb1e1('0x3f'))){if([_0xb1e1('0x40'),'playback'][_0xb1e1('0x41')](_0x128824[_0xb1e1('0x42')][_0xb1e1('0x39')]())&&_0x128824['appType']!==_0xb1e1('0x43')){if(_0x128824[_0xb1e1('0x3f')]){_0xfe8139['push']({'type':_0x128824[_0xb1e1('0x3')][_0xb1e1('0x39')](),'app':_0xb1e1('0x17'),'appdata':_0xb1e1('0x44'),'context':_0x1e6a21[_0xb1e1('0x5')],'exten':_0x1e6a21[_0xb1e1('0x6')],'priority':_0x128824[_0xb1e1('0x36')]['length']+_0x230fc8+_0xc8554d++,'VoiceExtensionId':_0x1e6a21['id']});_0xfe8139[_0xb1e1('0xc')]({'type':_0x128824['type'][_0xb1e1('0x39')](),'app':_0xb1e1('0x4'),'appdata':_0xb1e1('0x45'),'context':_0x1e6a21['context'],'exten':_0x1e6a21[_0xb1e1('0x6')],'priority':_0x128824[_0xb1e1('0x36')]['length']+_0x230fc8+_0xc8554d++,'VoiceExtensionId':_0x1e6a21['id']});}else{_0xfe8139[_0xb1e1('0xc')]({'type':_0x128824[_0xb1e1('0x3')][_0xb1e1('0x39')](),'app':_0xb1e1('0x17'),'appdata':_0xb1e1('0x46'),'context':_0x1e6a21[_0xb1e1('0x5')],'exten':_0x1e6a21[_0xb1e1('0x6')],'priority':_0x128824['intervals']['length']+_0x230fc8+_0xc8554d++,'VoiceExtensionId':_0x1e6a21['id']});_0xfe8139[_0xb1e1('0xc')]({'type':_0x128824[_0xb1e1('0x3')]['toLowerCase'](),'app':_0xb1e1('0x4'),'appdata':_0xb1e1('0x47'),'context':_0x1e6a21['context'],'exten':_0x1e6a21['exten'],'priority':_0x128824[_0xb1e1('0x36')][_0xb1e1('0x34')]+_0x230fc8+_0xc8554d++,'VoiceExtensionId':_0x1e6a21['id']});}}}}for(var _0x169e0a=0x0;_0x169e0a<_0x128824[_0xb1e1('0x36')][_0xb1e1('0x34')];_0x169e0a++){var _0x42abda=_0x230fc8+_0x128824[_0xb1e1('0x36')][_0xb1e1('0x34')];var _0x33784f=_0x169e0a===_0x128824[_0xb1e1('0x36')][_0xb1e1('0x34')]-0x1?_0x230fc8+_0xfe8139[_0xb1e1('0x34')]+_0x116b5a['length']+0x2:_0x230fc8+_0x169e0a+0x1;_0xfe8139['splice'](_0x169e0a,0x0,{'type':_0x1e6a21[_0xb1e1('0x3')],'app':_0xb1e1('0x48'),'appdata':_0x128824[_0xb1e1('0x36')][_0x169e0a]+'?'+_0x1e6a21[_0xb1e1('0x5')]+_0xb1e1('0x49')+_0x42abda+':'+_0x1e6a21[_0xb1e1('0x5')]+_0xb1e1('0x49')+_0x33784f,'exten':_0x1e6a21['exten'],'context':_0x1e6a21[_0xb1e1('0x5')],'priority':_0x230fc8+_0x169e0a,'VoiceExtensionId':_0x1e6a21['id']});}if(_0x128824[_0xb1e1('0x4a')]===_0xb1e1('0x4b')){_0x128824[_0xb1e1('0x4c')]=_0x287c4f(_0x1e6a21,_0x128824[_0xb1e1('0x4c')]);}if(_0x128824[_0xb1e1('0x4a')]===_0xb1e1('0x4d')){_0xfe8139[_0xb1e1('0xc')]({'type':_0x128824[_0xb1e1('0x3')]['toLowerCase'](),'app':_0xb1e1('0x4'),'appdata':_0xb1e1('0x4e'),'context':_0x1e6a21[_0xb1e1('0x5')],'exten':_0x1e6a21['exten'],'priority':_0x128824[_0xb1e1('0x36')]['length']+_0x230fc8+_0xc8554d++,'VoiceExtensionId':_0x1e6a21['id']});}_0x128824['priority']=_0xfe8139['length']?_['last'](_0xfe8139)[_0xb1e1('0x4f')]+0x1:_0x230fc8;_0x5bffb9=_[_0xb1e1('0x50')](_0x5bffb9,_0xfe8139,[_0x128824],_0x116b5a);_0x230fc8=_['last'](_0x5bffb9)[_0xb1e1('0x4f')]+0x1;}return _0x209dc2(_0x5bffb9);})[_0xb1e1('0x51')](function(_0x4f0123){_0x4ef31e(_0x4f0123);});});}return _0x380337[_0xb1e1('0x52')](_0xb1e1('0x53'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x2f1ae4){var _0x4b7cac=this[_0xb1e1('0x54')]({'plain':!![]});var _0x2d5d25=_0x4b7cac[_0xb1e1('0x3')]===_0xb1e1('0x12')?_0xe83b68(_0x4b7cac):_0x3b0a58(_0x4b7cac);return _0x512ec5(_0x4b7cac,_0x2f1ae4,_[_0xb1e1('0x55')](_0x2d5d25)['priority']+0x1)[_0xb1e1('0x33')](function(_0x542f89){var _0x4b8ecb=_[_0xb1e1('0x50')](_0x2d5d25,_0x542f89);_0x4b8ecb['push']({'type':_0x4b7cac[_0xb1e1('0x3')],'app':'Hangup','exten':_0x4b7cac[_0xb1e1('0x6')],'context':_0x4b7cac['context'],'priority':_[_0xb1e1('0x55')](_0x4b8ecb)[_0xb1e1('0x4f')]+0x1,'VoiceExtensionId':_0x4b7cac['id']});return _0x4b8ecb;});}}});}; \ No newline at end of file +var _0xfde6=['includes','app','custom','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','concat','last','catch','define','voice_extensions','lodash','./voiceExtension.attributes','models','type','Set','CDR(type)=','context','NoOp','alias','CDR(routeAlias)=','exten','CDR(routeid)=','push','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','No\x20alias\x20set','cutdigits','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','split','name','phone','prefix','${EXTEN:','SIP','join','param','none','indexOf','U(xcally-mixmonitor-context)','Interval','findAll','interval','IntervalId','then','length','*,*,*,*','intervals','map','toLowerCase','tag','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','answer','queue','playback'];(function(_0x2d5ffd,_0x43d233){var _0x19c4bf=function(_0x801346){while(--_0x801346){_0x2d5ffd['push'](_0x2d5ffd['shift']());}};_0x19c4bf(++_0x43d233);}(_0xfde6,0xaf));var _0x6fde=function(_0x47df23,_0x4c34db){_0x47df23=_0x47df23-0x0;var _0xf4bf0e=_0xfde6[_0x47df23];return _0xf4bf0e;};'use strict';var _=require(_0x6fde('0x0'));var attributes=require(_0x6fde('0x1'));module['exports']=function(_0x347a83){var _0x4e85f3=_0x347a83[_0x6fde('0x2')];function _0x4c12d9(_0x1fac07){var _0x4adc56=0x2;var _0x4aa0f2=[{'type':_0x1fac07[_0x6fde('0x3')],'app':_0x6fde('0x4'),'appdata':_0x6fde('0x5')+_0x1fac07[_0x6fde('0x3')],'context':_0x1fac07[_0x6fde('0x6')],'exten':_0x1fac07['exten'],'priority':_0x4adc56++,'VoiceExtensionId':_0x1fac07['id']},{'type':_0x1fac07[_0x6fde('0x3')],'app':_0x1fac07['alias']?'Set':_0x6fde('0x7'),'appdata':_0x1fac07[_0x6fde('0x8')]?_0x6fde('0x9')+_0x1fac07[_0x6fde('0x8')]:'No\x20alias\x20set','context':_0x1fac07[_0x6fde('0x6')],'exten':_0x1fac07[_0x6fde('0xa')],'priority':_0x4adc56++,'VoiceExtensionId':_0x1fac07['id']}];if(_0x1fac07[_0x6fde('0x3')]==='inbound'){_0x4aa0f2['push']({'type':'inbound','app':_0x6fde('0x4'),'appdata':_0x6fde('0xb')+_0x1fac07['id'],'context':_0x1fac07['context'],'exten':_0x1fac07[_0x6fde('0xa')],'priority':_0x4adc56++,'VoiceExtensionId':_0x1fac07['id']});}_0x4aa0f2[_0x6fde('0xc')]({'type':_0x1fac07[_0x6fde('0x3')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x1fac07[_0x6fde('0x6')],'exten':_0x1fac07[_0x6fde('0xa')],'priority':_0x4adc56++,'VoiceExtensionId':_0x1fac07['id']},{'type':_0x1fac07['type'],'app':_0x6fde('0x4'),'appdata':_0x6fde('0xd'),'context':_0x1fac07[_0x6fde('0x6')],'exten':_0x1fac07[_0x6fde('0xa')],'priority':_0x4adc56++,'VoiceExtensionId':_0x1fac07['id']},{'type':_0x1fac07['type'],'app':_0x6fde('0x4'),'appdata':_0x6fde('0xe'),'context':_0x1fac07['context'],'exten':_0x1fac07[_0x6fde('0xa')],'priority':_0x4adc56++,'VoiceExtensionId':_0x1fac07['id']});return _0x4aa0f2;}function _0xeecad0(_0x3e269b){var _0x4c93db=0x2;var _0x6d8012=[{'type':_0x6fde('0xf'),'app':_0x6fde('0x4'),'appdata':_0x6fde('0x10'),'context':_0x3e269b[_0x6fde('0x6')],'exten':_0x3e269b['exten'],'priority':_0x4c93db++,'VoiceExtensionId':_0x3e269b['id']},{'type':_0x6fde('0xf'),'app':_0x3e269b[_0x6fde('0x8')]?_0x6fde('0x4'):'NoOp','appdata':_0x3e269b[_0x6fde('0x8')]?_0x6fde('0x9')+_0x3e269b[_0x6fde('0x8')]:_0x6fde('0x11'),'context':_0x3e269b[_0x6fde('0x6')],'exten':_0x3e269b['exten'],'priority':_0x4c93db++,'VoiceExtensionId':_0x3e269b['id']},{'type':_0x6fde('0xf'),'app':_0x6fde('0x4'),'appdata':'CDR(destination)='+(_0x3e269b[_0x6fde('0x12')]?'${EXTEN:'+_0x3e269b[_0x6fde('0x12')]+'}':_0x6fde('0x13')),'context':_0x3e269b['context'],'exten':_0x3e269b[_0x6fde('0xa')],'priority':_0x4c93db++,'VoiceExtensionId':_0x3e269b['id']},{'type':_0x6fde('0xf'),'app':_0x6fde('0x4'),'appdata':_0x6fde('0xb')+_0x3e269b['id'],'context':_0x3e269b['context'],'exten':_0x3e269b[_0x6fde('0xa')],'priority':_0x4c93db++,'VoiceExtensionId':_0x3e269b['id']},{'type':'outbound','app':_0x6fde('0x14'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x4c93db+0x2)+_0x6fde('0x15')+(_0x4c93db+0x1)+')','context':_0x3e269b[_0x6fde('0x6')],'exten':_0x3e269b['exten'],'priority':_0x4c93db++,'VoiceExtensionId':_0x3e269b['id']},{'type':_0x6fde('0xf'),'app':_0x6fde('0x4'),'appdata':_0x3e269b[_0x6fde('0x12')]?_0x6fde('0x16')+_0x3e269b['cutdigits']+'}':_0x6fde('0x17'),'context':_0x3e269b[_0x6fde('0x6')],'exten':_0x3e269b[_0x6fde('0xa')],'priority':_0x4c93db++,'VoiceExtensionId':_0x3e269b['id']},{'type':_0x6fde('0xf'),'app':_0x6fde('0x4'),'appdata':_0x6fde('0x18'),'context':_0x3e269b[_0x6fde('0x6')],'exten':_0x3e269b[_0x6fde('0xa')],'priority':_0x4c93db++,'VoiceExtensionId':_0x3e269b['id']},{'type':_0x6fde('0xf'),'app':'Set','appdata':_0x6fde('0xd'),'context':_0x3e269b[_0x6fde('0x6')],'exten':_0x3e269b[_0x6fde('0xa')],'priority':_0x4c93db++,'VoiceExtensionId':_0x3e269b['id']},{'type':'outbound','app':_0x6fde('0x4'),'appdata':_0x6fde('0xe'),'context':_0x3e269b['context'],'exten':_0x3e269b[_0x6fde('0xa')],'priority':_0x4c93db++,'VoiceExtensionId':_0x3e269b['id']},{'type':_0x6fde('0xf'),'app':'Set','appdata':_0x6fde('0x19')+_0x3e269b['id'],'context':_0x3e269b[_0x6fde('0x6')],'exten':_0x3e269b[_0x6fde('0xa')],'priority':_0x4c93db++,'VoiceExtensionId':_0x3e269b['id']}];if(_0x3e269b[_0x6fde('0x1a')](_0x6fde('0x1b'))&&_0x3e269b[_0x6fde('0x1b')]!=='none'){_0x6d8012['push']({'type':_0x6fde('0xf'),'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x3e269b[_0x6fde('0x6')],'exten':_0x3e269b[_0x6fde('0xa')],'priority':_0x4c93db++,'VoiceExtensionId':_0x3e269b['id']},{'type':_0x6fde('0xf'),'app':'Set','appdata':_0x6fde('0x1c')+_0x3e269b[_0x6fde('0x1b')]||_0x6fde('0x1d'),'context':_0x3e269b['context'],'exten':_0x3e269b[_0x6fde('0xa')],'priority':_0x4c93db++,'VoiceExtensionId':_0x3e269b['id']});}return _0x6d8012;}function _0x372463(_0x9bb8d0,_0x4b6b66){var _0x41dfdd=[{'name':_0x6fde('0x1e'),'param':0x0},{'name':_0x6fde('0x1f'),'param':0x1},{'name':_0x6fde('0x20'),'param':0x2},{'name':_0x6fde('0x21'),'param':0x3}];var _0x91a444={};var _0x896c8=_0x4b6b66[_0x6fde('0x22')](',');var _0x4665d0=[];for(var _0x33268f=0x0;_0x33268f<_0x41dfdd['length'];_0x33268f++){switch(_0x41dfdd[_0x33268f][_0x6fde('0x23')]){case _0x6fde('0x1e'):_0x91a444[_0x6fde('0x1e')]=_0x896c8[_0x41dfdd[_0x33268f]['param']]['split']('/')[0x1];_0x91a444[_0x6fde('0x24')]=_0x896c8[_0x41dfdd[_0x33268f]['param']][_0x6fde('0x22')]('/')[0x2];_0x91a444[_0x6fde('0x25')]=_0x91a444['phone']?_0x91a444[_0x6fde('0x24')][_0x6fde('0x22')]('$')[0x0]:undefined;_0x91a444[_0x6fde('0x24')]=_0x9bb8d0['cutdigits']?(_0x91a444[_0x6fde('0x25')]||'')+_0x6fde('0x26')+_0x9bb8d0[_0x6fde('0x12')]+'}':(_0x91a444['prefix']||'')+_0x6fde('0x13');_0x4665d0[_0x41dfdd[_0x33268f]['param']]=[_0x6fde('0x27'),_0x91a444['trunk'],_0x91a444['phone']][_0x6fde('0x28')]('/');break;case _0x6fde('0x20'):_0x91a444[_0x6fde('0x20')]=_0x896c8[_0x41dfdd[_0x33268f][_0x6fde('0x29')]];if(_0x9bb8d0[_0x6fde('0x1b')]!==_0x6fde('0x2a')){if(_0x91a444['options'][_0x6fde('0x2b')](_0x6fde('0x2c'))<0x0){_0x91a444[_0x6fde('0x20')]+=_0x6fde('0x2c');}}else{_0x91a444['options']=_0x91a444[_0x6fde('0x20')]['replace'](_0x6fde('0x2c'),'');}_0x4665d0[_0x41dfdd[_0x33268f]['param']]=_0x91a444[_0x6fde('0x20')];break;default:_0x4665d0[_0x41dfdd[_0x33268f][_0x6fde('0x29')]]=_0x896c8[_0x41dfdd[_0x33268f][_0x6fde('0x29')]];}}return _0x4665d0[_0x6fde('0x28')](',');}function _0x42b42c(_0x203439,_0x933853,_0x3e5733){return new Promise(function(_0x4c1024,_0x1ccc0b){var _0x428189=[];if(_['isEmpty'](_0x933853))return _0x4c1024(_0x428189);_0x4e85f3[_0x6fde('0x2d')][_0x6fde('0x2e')]({'attributes':['id',_0x6fde('0x2f'),_0x6fde('0x30')],'raw':!![]})[_0x6fde('0x31')](function(_0x24b7be){for(var _0x353b18=0x0,_0x1cc40b=0x0;_0x353b18<_0x933853[_0x6fde('0x32')];_0x353b18++,_0x1cc40b=0x0){var _0x2b79b8=_0x933853[_0x353b18];var _0x555c08=[];var _0x56308d=[];delete _0x2b79b8['id'];if(_0x2b79b8[_0x6fde('0x2f')]!==_0x6fde('0x33')){_0x2b79b8[_0x6fde('0x34')]=[_0x2b79b8[_0x6fde('0x2f')]];}else{_0x2b79b8[_0x6fde('0x34')]=_0x2b79b8[_0x6fde('0x30')]?_[_0x6fde('0x35')](_['filter'](_0x24b7be,{'IntervalId':_0x2b79b8[_0x6fde('0x30')]}),_0x6fde('0x2f')):[];}_0x2b79b8['context']=_0x203439[_0x6fde('0x6')];_0x2b79b8['exten']=_0x203439[_0x6fde('0xa')];if(_0x2b79b8['type'])_0x2b79b8[_0x6fde('0x3')]=_0x2b79b8['type'][_0x6fde('0x36')]();if(_0x203439['type']===_0x6fde('0xf')){if(_0x2b79b8[_0x6fde('0x1a')](_0x6fde('0x37'))&&_0x2b79b8[_0x6fde('0x37')]&&_0x2b79b8[_0x6fde('0x37')]!=='--'){_0x555c08[_0x6fde('0xc')]({'type':_0x2b79b8['type'][_0x6fde('0x36')](),'app':_0x6fde('0x4'),'appdata':'CDR(tag)='+_0x2b79b8[_0x6fde('0x37')],'context':_0x203439['context'],'exten':_0x203439['exten'],'priority':_0x2b79b8[_0x6fde('0x34')]['length']+_0x3e5733+_0x1cc40b++,'VoiceExtensionId':_0x203439['id']});}_0x555c08[_0x6fde('0xc')]({'type':_0x2b79b8[_0x6fde('0x3')][_0x6fde('0x36')](),'app':_0x6fde('0x14'),'appdata':_0x6fde('0x38')+(_0x2b79b8[_0x6fde('0x39')]?'Set(CALLERID(all)='+_0x2b79b8['callerID']+')':_0x6fde('0x3a')),'context':_0x203439[_0x6fde('0x6')],'exten':_0x203439[_0x6fde('0xa')],'priority':_0x2b79b8[_0x6fde('0x34')]['length']+_0x3e5733+_0x1cc40b++,'VoiceExtensionId':_0x203439['id']});}else{if(_0x2b79b8[_0x6fde('0x1a')](_0x6fde('0x3b'))){if([_0x6fde('0x3c'),_0x6fde('0x3d')][_0x6fde('0x3e')](_0x2b79b8[_0x6fde('0x3f')][_0x6fde('0x36')]())&&_0x2b79b8['appType']!==_0x6fde('0x40')){if(_0x2b79b8['answer']){_0x555c08[_0x6fde('0xc')]({'type':_0x2b79b8['type'][_0x6fde('0x36')](),'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x203439[_0x6fde('0x6')],'exten':_0x203439[_0x6fde('0xa')],'priority':_0x2b79b8[_0x6fde('0x34')][_0x6fde('0x32')]+_0x3e5733+_0x1cc40b++,'VoiceExtensionId':_0x203439['id']});_0x555c08[_0x6fde('0xc')]({'type':_0x2b79b8[_0x6fde('0x3')][_0x6fde('0x36')](),'app':_0x6fde('0x4'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x203439[_0x6fde('0x6')],'exten':_0x203439[_0x6fde('0xa')],'priority':_0x2b79b8[_0x6fde('0x34')][_0x6fde('0x32')]+_0x3e5733+_0x1cc40b++,'VoiceExtensionId':_0x203439['id']});}else{_0x555c08[_0x6fde('0xc')]({'type':_0x2b79b8['type']['toLowerCase'](),'app':_0x6fde('0x14'),'appdata':_0x6fde('0x41'),'context':_0x203439['context'],'exten':_0x203439[_0x6fde('0xa')],'priority':_0x2b79b8[_0x6fde('0x34')][_0x6fde('0x32')]+_0x3e5733+_0x1cc40b++,'VoiceExtensionId':_0x203439['id']});_0x555c08[_0x6fde('0xc')]({'type':_0x2b79b8[_0x6fde('0x3')][_0x6fde('0x36')](),'app':'Set','appdata':_0x6fde('0x42'),'context':_0x203439['context'],'exten':_0x203439[_0x6fde('0xa')],'priority':_0x2b79b8[_0x6fde('0x34')][_0x6fde('0x32')]+_0x3e5733+_0x1cc40b++,'VoiceExtensionId':_0x203439['id']});}}}}for(var _0x39d6a2=0x0;_0x39d6a2<_0x2b79b8[_0x6fde('0x34')][_0x6fde('0x32')];_0x39d6a2++){var _0x5bef9d=_0x3e5733+_0x2b79b8[_0x6fde('0x34')][_0x6fde('0x32')];var _0x4a2cca=_0x39d6a2===_0x2b79b8[_0x6fde('0x34')][_0x6fde('0x32')]-0x1?_0x3e5733+_0x555c08[_0x6fde('0x32')]+_0x56308d[_0x6fde('0x32')]+0x2:_0x3e5733+_0x39d6a2+0x1;_0x555c08[_0x6fde('0x43')](_0x39d6a2,0x0,{'type':_0x203439['type'],'app':_0x6fde('0x44'),'appdata':_0x2b79b8[_0x6fde('0x34')][_0x39d6a2]+'?'+_0x203439[_0x6fde('0x6')]+_0x6fde('0x45')+_0x5bef9d+':'+_0x203439[_0x6fde('0x6')]+',${EXTEN},'+_0x4a2cca,'exten':_0x203439[_0x6fde('0xa')],'context':_0x203439['context'],'priority':_0x3e5733+_0x39d6a2,'VoiceExtensionId':_0x203439['id']});}if(_0x2b79b8['appType']==='outboundDial'){_0x2b79b8[_0x6fde('0x46')]=_0x372463(_0x203439,_0x2b79b8[_0x6fde('0x46')]);}if(_0x2b79b8['appType']===_0x6fde('0x47')){_0x555c08[_0x6fde('0xc')]({'type':_0x2b79b8[_0x6fde('0x3')][_0x6fde('0x36')](),'app':_0x6fde('0x4'),'appdata':_0x6fde('0x48'),'context':_0x203439['context'],'exten':_0x203439[_0x6fde('0xa')],'priority':_0x2b79b8[_0x6fde('0x34')][_0x6fde('0x32')]+_0x3e5733+_0x1cc40b++,'VoiceExtensionId':_0x203439['id']});}_0x2b79b8[_0x6fde('0x49')]=_0x555c08['length']?_['last'](_0x555c08)[_0x6fde('0x49')]+0x1:_0x3e5733;_0x428189=_[_0x6fde('0x4a')](_0x428189,_0x555c08,[_0x2b79b8],_0x56308d);_0x3e5733=_[_0x6fde('0x4b')](_0x428189)[_0x6fde('0x49')]+0x1;}return _0x4c1024(_0x428189);})[_0x6fde('0x4c')](function(_0x3c10d8){_0x1ccc0b(_0x3c10d8);});});}return _0x347a83[_0x6fde('0x4d')]('VoiceExtension',attributes,{'tableName':_0x6fde('0x4e'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x1d1af8){var _0x47149d=this['get']({'plain':!![]});var _0x17af03=_0x47149d[_0x6fde('0x3')]===_0x6fde('0xf')?_0xeecad0(_0x47149d):_0x4c12d9(_0x47149d);return _0x42b42c(_0x47149d,_0x1d1af8,_[_0x6fde('0x4b')](_0x17af03)[_0x6fde('0x49')]+0x1)[_0x6fde('0x31')](function(_0x49d17c){var _0x271578=_['concat'](_0x17af03,_0x49d17c);_0x271578[_0x6fde('0xc')]({'type':_0x47149d['type'],'app':'Hangup','exten':_0x47149d[_0x6fde('0xa')],'context':_0x47149d['context'],'priority':_[_0x6fde('0x4b')](_0x271578)[_0x6fde('0x49')]+0x1,'VoiceExtensionId':_0x47149d['id']});return _0x271578;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index cc3ea55..c16bdfa 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 _0x6050=['error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','http','localhost','socket.io-emitter','redis','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1522e6,_0x334dec){var _0x582d2d=function(_0x1b3b23){while(--_0x1b3b23){_0x1522e6['push'](_0x1522e6['shift']());}};_0x582d2d(++_0x334dec);}(_0x6050,0x196));var _0x0605=function(_0x58d45b,_0x5eecf4){_0x58d45b=_0x58d45b-0x0;var _0x283170=_0x6050[_0x58d45b];return _0x283170;};'use strict';var _=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var moment=require(_0x0605('0x2'));var BPromise=require(_0x0605('0x3'));var rs=require(_0x0605('0x4'));var fs=require('fs');var Redis=require(_0x0605('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0605('0x6'));var logger=require(_0x0605('0x7'))(_0x0605('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0605('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x0605('0xa'),'port':0x18eb});var socket=require(_0x0605('0xb'))(new Redis(config[_0x0605('0xc')]));require(_0x0605('0xd'))[_0x0605('0xe')](socket);function respondWithRpcPromise(_0x52bb63,_0x1882e6,_0x23dc2b){return new BPromise(function(_0xe54b22,_0x2c5e23){return client[_0x0605('0xf')](_0x52bb63,_0x23dc2b)[_0x0605('0x10')](function(_0x4385d3){logger[_0x0605('0x11')](_0x0605('0x12'),_0x1882e6,_0x0605('0x13'));logger[_0x0605('0x14')](_0x0605('0x15'),_0x1882e6,_0x0605('0x13'),JSON[_0x0605('0x16')](_0x4385d3));if(_0x4385d3[_0x0605('0x17')]){if(_0x4385d3[_0x0605('0x17')][_0x0605('0x18')]===0x1f4){logger[_0x0605('0x17')](_0x0605('0x12'),_0x1882e6,_0x4385d3['error'][_0x0605('0x19')]);return _0x2c5e23(_0x4385d3[_0x0605('0x17')][_0x0605('0x19')]);}logger['error']('VoiceExtension,\x20%s,\x20%s',_0x1882e6,_0x4385d3[_0x0605('0x17')][_0x0605('0x19')]);return _0xe54b22(_0x4385d3[_0x0605('0x17')][_0x0605('0x19')]);}else{logger[_0x0605('0x11')](_0x0605('0x12'),_0x1882e6,_0x0605('0x13'));_0xe54b22(_0x4385d3[_0x0605('0x1a')][_0x0605('0x19')]);}})[_0x0605('0x1b')](function(_0x3a22e9){logger[_0x0605('0x17')](_0x0605('0x12'),_0x1882e6,_0x3a22e9);_0x2c5e23(_0x3a22e9);});});}exports[_0x0605('0x1c')]=function(_0x59bc87){var _0x254020=this;return new Promise(function(_0x14a920,_0x430f28){return db[_0x0605('0x1d')][_0x0605('0x1e')]({'raw':_0x59bc87[_0x0605('0x1f')]?_0x59bc87[_0x0605('0x1f')][_0x0605('0x20')]===undefined?!![]:![]:!![],'where':_0x59bc87[_0x0605('0x1f')]?_0x59bc87['options'][_0x0605('0x21')]||null:null,'attributes':_0x59bc87['options']?_0x59bc87[_0x0605('0x1f')][_0x0605('0x22')]||null:null,'limit':_0x59bc87[_0x0605('0x1f')]?_0x59bc87[_0x0605('0x1f')][_0x0605('0x23')]||null:null,'include':_0x59bc87[_0x0605('0x1f')]?_0x59bc87[_0x0605('0x1f')][_0x0605('0x24')]?_[_0x0605('0x25')](_0x59bc87[_0x0605('0x1f')][_0x0605('0x24')],function(_0x1c3722){return{'model':db[_0x1c3722['model']],'as':_0x1c3722['as'],'attributes':_0x1c3722[_0x0605('0x22')],'include':_0x1c3722[_0x0605('0x24')]?_['map'](_0x1c3722['include'],function(_0x55ebd8){return{'model':db[_0x55ebd8[_0x0605('0x26')]],'as':_0x55ebd8['as'],'attributes':_0x55ebd8[_0x0605('0x22')],'include':_0x55ebd8[_0x0605('0x24')]?_[_0x0605('0x25')](_0x55ebd8[_0x0605('0x24')],function(_0x4554df){return{'model':db[_0x4554df['model']],'as':_0x4554df['as'],'attributes':_0x4554df[_0x0605('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa836f2){logger[_0x0605('0x11')](_0x0605('0x1c'),_0x59bc87);logger[_0x0605('0x14')](_0x0605('0x1c'),_0x59bc87,JSON[_0x0605('0x16')](_0xa836f2));_0x14a920(_0xa836f2);})['catch'](function(_0x165a0c){logger[_0x0605('0x17')](_0x0605('0x1c'),_0x165a0c[_0x0605('0x19')],_0x59bc87);_0x430f28(_0x254020[_0x0605('0x17')](0x1f4,_0x165a0c[_0x0605('0x19')]));});});}; \ No newline at end of file +var _0x4da5=['findAll','options','raw','where','attributes','limit','map','include','model','GetVoiceExtension','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','VoiceExtension'];(function(_0x43a2e8,_0x43cb2d){var _0x5be11f=function(_0x37e05f){while(--_0x37e05f){_0x43a2e8['push'](_0x43a2e8['shift']());}};_0x5be11f(++_0x43cb2d);}(_0x4da5,0x1b7));var _0x54da=function(_0x569211,_0x370fb1){_0x569211=_0x569211-0x0;var _0x34b853=_0x4da5[_0x569211];return _0x34b853;};'use strict';var _=require('lodash');var util=require(_0x54da('0x0'));var moment=require(_0x54da('0x1'));var BPromise=require(_0x54da('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x54da('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x54da('0x4'));var logger=require(_0x54da('0x5'))(_0x54da('0x6'));var config=require(_0x54da('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x54da('0x8')][_0x54da('0x9')]({'port':0x232a});config[_0x54da('0xa')]=_[_0x54da('0xb')](config[_0x54da('0xa')],{'host':_0x54da('0xc'),'port':0x18eb});var socket=require(_0x54da('0xd'))(new Redis(config['redis']));require(_0x54da('0xe'))[_0x54da('0xf')](socket);function respondWithRpcPromise(_0x30c556,_0x52e3d8,_0x270a06){return new BPromise(function(_0x4f37ea,_0x5f4383){return client[_0x54da('0x10')](_0x30c556,_0x270a06)[_0x54da('0x11')](function(_0x86a484){logger[_0x54da('0x12')](_0x54da('0x13'),_0x52e3d8,_0x54da('0x14'));logger[_0x54da('0x15')](_0x54da('0x16'),_0x52e3d8,_0x54da('0x14'),JSON[_0x54da('0x17')](_0x86a484));if(_0x86a484[_0x54da('0x18')]){if(_0x86a484[_0x54da('0x18')][_0x54da('0x19')]===0x1f4){logger['error'](_0x54da('0x13'),_0x52e3d8,_0x86a484[_0x54da('0x18')][_0x54da('0x1a')]);return _0x5f4383(_0x86a484[_0x54da('0x18')]['message']);}logger[_0x54da('0x18')](_0x54da('0x13'),_0x52e3d8,_0x86a484[_0x54da('0x18')][_0x54da('0x1a')]);return _0x4f37ea(_0x86a484[_0x54da('0x18')][_0x54da('0x1a')]);}else{logger['info'](_0x54da('0x13'),_0x52e3d8,_0x54da('0x14'));_0x4f37ea(_0x86a484['result'][_0x54da('0x1a')]);}})[_0x54da('0x1b')](function(_0x4c7bbd){logger['error'](_0x54da('0x13'),_0x52e3d8,_0x4c7bbd);_0x5f4383(_0x4c7bbd);});});}exports['GetVoiceExtension']=function(_0x3fcbcf){var _0x2d26a0=this;return new Promise(function(_0x4f78ed,_0x123cac){return db[_0x54da('0x1c')][_0x54da('0x1d')]({'raw':_0x3fcbcf[_0x54da('0x1e')]?_0x3fcbcf[_0x54da('0x1e')][_0x54da('0x1f')]===undefined?!![]:![]:!![],'where':_0x3fcbcf[_0x54da('0x1e')]?_0x3fcbcf[_0x54da('0x1e')][_0x54da('0x20')]||null:null,'attributes':_0x3fcbcf[_0x54da('0x1e')]?_0x3fcbcf['options'][_0x54da('0x21')]||null:null,'limit':_0x3fcbcf[_0x54da('0x1e')]?_0x3fcbcf[_0x54da('0x1e')][_0x54da('0x22')]||null:null,'include':_0x3fcbcf[_0x54da('0x1e')]?_0x3fcbcf[_0x54da('0x1e')]['include']?_[_0x54da('0x23')](_0x3fcbcf[_0x54da('0x1e')][_0x54da('0x24')],function(_0x18d1bd){return{'model':db[_0x18d1bd[_0x54da('0x25')]],'as':_0x18d1bd['as'],'attributes':_0x18d1bd[_0x54da('0x21')],'include':_0x18d1bd['include']?_[_0x54da('0x23')](_0x18d1bd['include'],function(_0x2f9ed4){return{'model':db[_0x2f9ed4[_0x54da('0x25')]],'as':_0x2f9ed4['as'],'attributes':_0x2f9ed4[_0x54da('0x21')],'include':_0x2f9ed4['include']?_['map'](_0x2f9ed4[_0x54da('0x24')],function(_0x3cc6cc){return{'model':db[_0x3cc6cc[_0x54da('0x25')]],'as':_0x3cc6cc['as'],'attributes':_0x3cc6cc['attributes']};}):[]};}):[]};}):[]:[]})[_0x54da('0x11')](function(_0x1ef2ac){logger['info'](_0x54da('0x26'),_0x3fcbcf);logger[_0x54da('0x15')](_0x54da('0x26'),_0x3fcbcf,JSON['stringify'](_0x1ef2ac));_0x4f78ed(_0x1ef2ac);})['catch'](function(_0x21784e){logger['error'](_0x54da('0x26'),_0x21784e[_0x54da('0x1a')],_0x3fcbcf);_0x123cac(_0x2d26a0[_0x54da('0x18')](0x1f4,_0x21784e[_0x54da('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index dc21c1c..bc52124 100644 --- a/server/api/voiceExtension/voiceExtension.socket.js +++ b/server/api/voiceExtension/voiceExtension.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabce=['voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x4d2f2b,_0x3c596e){var _0x5ac391=function(_0x17a9c0){while(--_0x17a9c0){_0x4d2f2b['push'](_0x4d2f2b['shift']());}};_0x5ac391(++_0x3c596e);}(_0xabce,0x103));var _0xeabc=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xabce[_0x173d7e];return _0x2220d6;};'use strict';var VoiceExtensionEvents=require(_0xeabc('0x0'));var events=[_0xeabc('0x1'),_0xeabc('0x2'),_0xeabc('0x3')];function createListener(_0x49dbcc,_0x5bd1a4){return function(_0x5ebc95){_0x5bd1a4[_0xeabc('0x4')](_0x49dbcc,_0x5ebc95);};}function removeListener(_0x1d9f37,_0x1a88a7){return function(){VoiceExtensionEvents['removeListener'](_0x1d9f37,_0x1a88a7);};}exports['register']=function(_0x1b07a8){for(var _0x52a4d7=0x0,_0x229ba4=events['length'];_0x52a4d7<_0x229ba4;_0x52a4d7++){var _0x3bdc29=events[_0x52a4d7];var _0x9417af=createListener(_0xeabc('0x5')+_0x3bdc29,_0x1b07a8);VoiceExtensionEvents['on'](_0x3bdc29,_0x9417af);}}; \ No newline at end of file +var _0xabce=['voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x543bd8,_0x1382c2){var _0x31ad82=function(_0xc1ee35){while(--_0xc1ee35){_0x543bd8['push'](_0x543bd8['shift']());}};_0x31ad82(++_0x1382c2);}(_0xabce,0x103));var _0xeabc=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xabce[_0xbca1b1];return _0x4e1686;};'use strict';var VoiceExtensionEvents=require(_0xeabc('0x0'));var events=[_0xeabc('0x1'),_0xeabc('0x2'),_0xeabc('0x3')];function createListener(_0x49dbcc,_0x5bd1a4){return function(_0x5ebc95){_0x5bd1a4[_0xeabc('0x4')](_0x49dbcc,_0x5ebc95);};}function removeListener(_0x1d9f37,_0x1a88a7){return function(){VoiceExtensionEvents['removeListener'](_0x1d9f37,_0x1a88a7);};}exports['register']=function(_0x1b07a8){for(var _0x52a4d7=0x0,_0x229ba4=events['length'];_0x52a4d7<_0x229ba4;_0x52a4d7++){var _0x3bdc29=events[_0x52a4d7];var _0x9417af=createListener(_0xeabc('0x5')+_0x3bdc29,_0x1b07a8);VoiceExtensionEvents['on'](_0x3bdc29,_0x9417af);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 11eb076..aa66f5b 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 _0x7880=['Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','create','put','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x1b913f,_0x2b5dc6){var _0x56f28f=function(_0xf8d8cb){while(--_0xf8d8cb){_0x1b913f['push'](_0x1b913f['shift']());}};_0x56f28f(++_0x2b5dc6);}(_0x7880,0x1f4));var _0x0788=function(_0x348bac,_0x1804b2){_0x348bac=_0x348bac-0x0;var _0x4e2cbf=_0x7880[_0x348bac];return _0x4e2cbf;};'use strict';var multer=require('multer');var util=require(_0x0788('0x0'));var path=require(_0x0788('0x1'));var timeout=require(_0x0788('0x2'));var express=require(_0x0788('0x3'));var router=express[_0x0788('0x4')]();var fs_extra=require(_0x0788('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0788('0x6'));var config=require(_0x0788('0x7'));var controller=require(_0x0788('0x8'));router[_0x0788('0x9')]('/',auth[_0x0788('0xa')](),controller[_0x0788('0xb')]);router[_0x0788('0x9')](_0x0788('0xc'),auth[_0x0788('0xa')](),controller[_0x0788('0xd')]);router['get'](_0x0788('0xe'),auth['isAuthenticated'](),controller[_0x0788('0xf')]);router['post']('/',auth[_0x0788('0xa')](),controller[_0x0788('0x10')]);router[_0x0788('0x11')](_0x0788('0xc'),auth[_0x0788('0xa')](),controller['update']);router[_0x0788('0x12')](_0x0788('0xc'),auth[_0x0788('0xa')](),controller[_0x0788('0x13')]);module[_0x0788('0x14')]=router; \ No newline at end of file +var _0x627e=['show','/:id/messages','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id'];(function(_0x4af104,_0x1b8329){var _0x406cc8=function(_0x4c55f6){while(--_0x4c55f6){_0x4af104['push'](_0x4af104['shift']());}};_0x406cc8(++_0x1b8329);}(_0x627e,0x14a));var _0xe627=function(_0x2c6811,_0x44ddff){_0x2c6811=_0x2c6811-0x0;var _0x136771=_0x627e[_0x2c6811];return _0x136771;};'use strict';var multer=require(_0xe627('0x0'));var util=require(_0xe627('0x1'));var path=require(_0xe627('0x2'));var timeout=require(_0xe627('0x3'));var express=require(_0xe627('0x4'));var router=express['Router']();var fs_extra=require(_0xe627('0x5'));var auth=require(_0xe627('0x6'));var interaction=require(_0xe627('0x7'));var config=require('../../config/environment');var controller=require('./voiceMail.controller');router['get']('/',auth[_0xe627('0x8')](),controller[_0xe627('0x9')]);router[_0xe627('0xa')](_0xe627('0xb'),auth[_0xe627('0x8')](),controller[_0xe627('0xc')]);router['get'](_0xe627('0xd'),auth['isAuthenticated'](),controller['getMessages']);router[_0xe627('0xe')]('/',auth[_0xe627('0x8')](),controller['create']);router['put'](_0xe627('0xb'),auth[_0xe627('0x8')](),controller[_0xe627('0xf')]);router[_0xe627('0x10')](_0xe627('0xb'),auth[_0xe627('0x8')](),controller[_0xe627('0x11')]);module[_0xe627('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index c481a73..cdf8254 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 _0xc0bf=['mailbox','sequelize','exports','STRING','contest_mailbox','setDataValue','email','string','trim','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','\x20-\x20'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xc0bf,0xb5));var _0xfc0b=function(_0x3f0a2c,_0x422b65){_0x3f0a2c=_0x3f0a2c-0x0;var _0x38b447=_0xc0bf[_0x3f0a2c];return _0x38b447;};'use strict';var Sequelize=require(_0xfc0b('0x0'));module[_0xfc0b('0x1')]={'customer_id':{'type':Sequelize[_0xfc0b('0x2')]},'context':{'type':Sequelize[_0xfc0b('0x2')],'defaultValue':'from-voicemail','unique':_0xfc0b('0x3')},'mailbox':{'type':Sequelize[_0xfc0b('0x2')],'defaultValue':'','allowNull':![],'unique':_0xfc0b('0x3')},'password':{'type':Sequelize[_0xfc0b('0x2')]},'fullname':{'type':Sequelize[_0xfc0b('0x2')]},'email':{'type':Sequelize[_0xfc0b('0x2')],'validate':{'isEmail':!![]},'set':function(_0x9026ab){this[_0xfc0b('0x4')](_0xfc0b('0x5'),typeof _0x9026ab===_0xfc0b('0x6')&&_0x9026ab[_0xfc0b('0x7')]()?_0x9026ab['trim']():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0xfc0b('0x2')],'defaultValue':'central'},'attach':{'type':Sequelize[_0xfc0b('0x8')](_0xfc0b('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0xfc0b('0x8')](_0xfc0b('0x9'),'no'),'defaultValue':_0xfc0b('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0xfc0b('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0xfc0b('0x8')](_0xfc0b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xfc0b('0x8')](_0xfc0b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0xfc0b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xfc0b('0x8')](_0xfc0b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xfc0b('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0xfc0b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xfc0b('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xfc0b('0x8')](_0xfc0b('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0xfc0b('0x8')](_0xfc0b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xfc0b('0x8')](_0xfc0b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xfc0b('0x8')](_0xfc0b('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0xfc0b('0xb')},'emailsubject':{'type':Sequelize[_0xfc0b('0x2')]},'emailbody':{'type':Sequelize[_0xfc0b('0x2')]},'maxsecs':{'type':Sequelize[_0xfc0b('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xfc0b('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('fullname')+_0xfc0b('0xd')+this['getDataValue'](_0xfc0b('0xe'));}}}; \ No newline at end of file +var _0xc003=['central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','string','trim'];(function(_0x250afa,_0x3813d7){var _0x438f13=function(_0x490203){while(--_0x490203){_0x250afa['push'](_0x250afa['shift']());}};_0x438f13(++_0x3813d7);}(_0xc003,0x16f));var _0x3c00=function(_0x4fcd41,_0x2d4be1){_0x4fcd41=_0x4fcd41-0x0;var _0x23c017=_0xc003[_0x4fcd41];return _0x23c017;};'use strict';var Sequelize=require(_0x3c00('0x0'));module[_0x3c00('0x1')]={'customer_id':{'type':Sequelize[_0x3c00('0x2')]},'context':{'type':Sequelize[_0x3c00('0x2')],'defaultValue':_0x3c00('0x3'),'unique':_0x3c00('0x4')},'mailbox':{'type':Sequelize[_0x3c00('0x2')],'defaultValue':'','allowNull':![],'unique':_0x3c00('0x4')},'password':{'type':Sequelize[_0x3c00('0x2')]},'fullname':{'type':Sequelize[_0x3c00('0x2')]},'email':{'type':Sequelize[_0x3c00('0x2')],'validate':{'isEmail':!![]},'set':function(_0x45cade){this['setDataValue']('email',typeof _0x45cade===_0x3c00('0x5')&&_0x45cade[_0x3c00('0x6')]()?_0x45cade[_0x3c00('0x6')]():null);}},'pager':{'type':Sequelize[_0x3c00('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x3c00('0x7')},'attach':{'type':Sequelize[_0x3c00('0x8')]('yes','no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x3c00('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x3c00('0x2')]},'callback':{'type':Sequelize[_0x3c00('0x2')]},'review':{'type':Sequelize[_0x3c00('0x8')](_0x3c00('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x3c00('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x3c00('0x8')](_0x3c00('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x3c00('0x8')](_0x3c00('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x3c00('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x3c00('0x8')](_0x3c00('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x3c00('0x8')](_0x3c00('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x3c00('0x8')](_0x3c00('0x9'),'no'),'defaultValue':_0x3c00('0x9'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x3c00('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x3c00('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x3c00('0x9'),'allowNull':![]},'stamp':{'type':_0x3c00('0xb')},'emailsubject':{'type':Sequelize[_0x3c00('0x2')]},'emailbody':{'type':Sequelize[_0x3c00('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x3c00('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x3c00('0xd')](_0x3c00('0xe'))+_0x3c00('0xf')+this['getDataValue'](_0x3c00('0x10'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 3d60d33..103f239 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 _0x9c00=['name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','merge','where','VIRTUAL','options','VoiceMail','includeAll','include','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMessages','findOne','VoiceMailMessage','mailbox','findAndCountAll','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','Content-Range','apply','reject','update','destroy','get','Voicemails','UserProfileResource','then','stack'];(function(_0x1c4b40,_0x1a5e89){var _0x7c66a4=function(_0x270365){while(--_0x270365){_0x1c4b40['push'](_0x1c4b40['shift']());}};_0x7c66a4(++_0x1a5e89);}(_0x9c00,0x1a0));var _0x09c0=function(_0x441a8b,_0x4c6cc9){_0x441a8b=_0x441a8b-0x0;var _0x367ac5=_0x9c00[_0x441a8b];return _0x367ac5;};'use strict';var emlformat=require(_0x09c0('0x0'));var rimraf=require(_0x09c0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x09c0('0x2'));var moment=require(_0x09c0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x09c0('0x4'));var util=require(_0x09c0('0x5'));var path=require(_0x09c0('0x6'));var sox=require(_0x09c0('0x7'));var csv=require(_0x09c0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x09c0('0x9'));var squel=require(_0x09c0('0xa'));var crypto=require(_0x09c0('0xb'));var jsforce=require(_0x09c0('0xc'));var deskjs=require(_0x09c0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x09c0('0xe'));var Papa=require(_0x09c0('0xf'));var Redis=require(_0x09c0('0x10'));var authService=require(_0x09c0('0x11'));var qs=require(_0x09c0('0x12'));var as=require(_0x09c0('0x13'));var hardwareService=require(_0x09c0('0x14'));var logger=require(_0x09c0('0x15'))(_0x09c0('0x16'));var utils=require(_0x09c0('0x17'));var config=require(_0x09c0('0x18'));var licenseUtil=require(_0x09c0('0x19'));var db=require(_0x09c0('0x1a'))['db'];function respondWithStatusCode(_0x144271,_0x3b95cc){_0x3b95cc=_0x3b95cc||0xcc;return function(_0x331905){if(_0x331905){return _0x144271[_0x09c0('0x1b')](_0x3b95cc);}return _0x144271[_0x09c0('0x1c')](_0x3b95cc)[_0x09c0('0x1d')]();};}function respondWithResult(_0x3649d2,_0x16e490){_0x16e490=_0x16e490||0xc8;return function(_0x254598){if(_0x254598){return _0x3649d2[_0x09c0('0x1c')](_0x16e490)[_0x09c0('0x1e')](_0x254598);}};}function respondWithFilteredResult(_0x33c3d6,_0x2fdf11){return function(_0x4ff6b7){if(_0x4ff6b7){var _0x590129=typeof _0x2fdf11['offset']===_0x09c0('0x1f')&&typeof _0x2fdf11[_0x09c0('0x20')]===_0x09c0('0x1f');var _0x628272=_0x4ff6b7['count'];var _0x2c4440=_0x590129?0x0:_0x2fdf11['offset'];var _0x4c29a7=_0x590129?_0x4ff6b7[_0x09c0('0x21')]:_0x2fdf11['offset']+_0x2fdf11[_0x09c0('0x20')];var _0x319c36;if(_0x4c29a7>=_0x628272){_0x4c29a7=_0x628272;_0x319c36=0xc8;}else{_0x319c36=0xce;}_0x33c3d6[_0x09c0('0x1c')](_0x319c36);return _0x33c3d6['set'](_0x09c0('0x22'),_0x2c4440+'-'+_0x4c29a7+'/'+_0x628272)[_0x09c0('0x1e')](_0x4ff6b7);}return null;};}function patchUpdates(_0x8ad645){return function(_0x3447c5){try{jsonpatch[_0x09c0('0x23')](_0x3447c5,_0x8ad645,!![]);}catch(_0xa5d16f){return BPromise[_0x09c0('0x24')](_0xa5d16f);}return _0x3447c5['save']();};}function saveUpdates(_0x1695e8,_0x46f171){return function(_0x473fbd){if(_0x473fbd){return _0x473fbd[_0x09c0('0x25')](_0x1695e8)['then'](function(_0x4f6824){return _0x4f6824;});}return null;};}function removeEntity(_0x321bcc,_0x25fdb5){return function(_0x1e8a1c){if(_0x1e8a1c){return _0x1e8a1c[_0x09c0('0x26')]()['then'](function(){var _0x42ebfc=_0x1e8a1c[_0x09c0('0x27')]({'plain':!![]});var _0x56d883=_0x09c0('0x28');return db[_0x09c0('0x29')][_0x09c0('0x26')]({'where':{'type':_0x56d883,'resourceId':_0x42ebfc['id']}})[_0x09c0('0x2a')](function(){return _0x1e8a1c;});})[_0x09c0('0x2a')](function(){_0x321bcc[_0x09c0('0x1c')](0xcc)[_0x09c0('0x1d')]();});}};}function handleEntityNotFound(_0x35b61c,_0x1ea951){return function(_0x1aa80e){if(!_0x1aa80e){_0x35b61c[_0x09c0('0x1b')](0x194);}return _0x1aa80e;};}function handleError(_0x5e53ac,_0x15a667){_0x15a667=_0x15a667||0x1f4;return function(_0x1bdde9){logger['error'](_0x1bdde9[_0x09c0('0x2b')]);if(_0x1bdde9['name']){delete _0x1bdde9[_0x09c0('0x2c')];}_0x5e53ac['status'](_0x15a667)[_0x09c0('0x2d')](_0x1bdde9);};}exports[_0x09c0('0x2e')]=function(_0x108409,_0x4159bc){var _0x4e999a={},_0x5478b7={},_0x17c374={'count':0x0,'rows':[]};var _0x38a315=_[_0x09c0('0x2f')](db['VoiceMail'][_0x09c0('0x30')],function(_0x4bdae9){return{'name':_0x4bdae9[_0x09c0('0x31')],'type':_0x4bdae9[_0x09c0('0x32')][_0x09c0('0x33')]};});_0x5478b7['model']=_[_0x09c0('0x2f')](_0x38a315,_0x09c0('0x2c'));_0x5478b7[_0x09c0('0x34')]=_[_0x09c0('0x35')](_0x108409[_0x09c0('0x34')]);_0x5478b7[_0x09c0('0x36')]=_[_0x09c0('0x37')](_0x5478b7['model'],_0x5478b7[_0x09c0('0x34')]);_0x4e999a[_0x09c0('0x38')]=_[_0x09c0('0x37')](_0x5478b7[_0x09c0('0x39')],qs[_0x09c0('0x3a')](_0x108409['query'][_0x09c0('0x3a')]));_0x4e999a[_0x09c0('0x38')]=_0x4e999a[_0x09c0('0x38')][_0x09c0('0x3b')]?_0x4e999a[_0x09c0('0x38')]:_0x5478b7['model'];if(!_0x108409[_0x09c0('0x34')][_0x09c0('0x3c')](_0x09c0('0x3d'))){_0x4e999a[_0x09c0('0x20')]=qs[_0x09c0('0x20')](_0x108409[_0x09c0('0x34')][_0x09c0('0x20')]);_0x4e999a['offset']=qs[_0x09c0('0x3e')](_0x108409[_0x09c0('0x34')][_0x09c0('0x3e')]);}_0x4e999a[_0x09c0('0x3f')]=qs[_0x09c0('0x40')](_0x108409['query']['sort']);_0x4e999a['where']=qs['filters'](_[_0x09c0('0x41')](_0x108409[_0x09c0('0x34')],_0x5478b7[_0x09c0('0x36')]),_0x38a315);if(_0x108409[_0x09c0('0x34')][_0x09c0('0x42')]){_0x4e999a['where']=_[_0x09c0('0x43')](_0x4e999a[_0x09c0('0x44')],{'$or':_['map'](_0x38a315,function(_0x1067cf){if(_0x1067cf['type']!==_0x09c0('0x45')){var _0x5c80a2={};_0x5c80a2[_0x1067cf[_0x09c0('0x2c')]]={'$like':'%'+_0x108409[_0x09c0('0x34')]['filter']+'%'};return _0x5c80a2;}})});}_0x4e999a=_[_0x09c0('0x43')]({},_0x4e999a,_0x108409[_0x09c0('0x46')]);var _0x5d69fd={'where':_0x4e999a[_0x09c0('0x44')]};return db[_0x09c0('0x47')][_0x09c0('0x21')](_0x5d69fd)[_0x09c0('0x2a')](function(_0xeb8191){_0x17c374[_0x09c0('0x21')]=_0xeb8191;if(_0x108409['query'][_0x09c0('0x48')]){_0x4e999a[_0x09c0('0x49')]=[{'all':!![]}];}return db[_0x09c0('0x47')]['findAll'](_0x4e999a);})[_0x09c0('0x2a')](function(_0x30c0c5){_0x17c374[_0x09c0('0x4a')]=_0x30c0c5;return _0x17c374;})['then'](respondWithFilteredResult(_0x4159bc,_0x4e999a))[_0x09c0('0x4b')](handleError(_0x4159bc,null));};exports[_0x09c0('0x4c')]=function(_0x52cd5c,_0x5bbf4e){var _0x397e73={'raw':!![],'where':{'id':_0x52cd5c['params']['id']}},_0x471078={};_0x471078[_0x09c0('0x39')]=_[_0x09c0('0x35')](db['VoiceMail'][_0x09c0('0x30')]);_0x471078[_0x09c0('0x34')]=_[_0x09c0('0x35')](_0x52cd5c[_0x09c0('0x34')]);_0x471078[_0x09c0('0x36')]=_['intersection'](_0x471078[_0x09c0('0x39')],_0x471078['query']);_0x397e73['attributes']=_[_0x09c0('0x37')](_0x471078[_0x09c0('0x39')],qs[_0x09c0('0x3a')](_0x52cd5c[_0x09c0('0x34')][_0x09c0('0x3a')]));_0x397e73[_0x09c0('0x38')]=_0x397e73['attributes']['length']?_0x397e73['attributes']:_0x471078[_0x09c0('0x39')];if(_0x52cd5c[_0x09c0('0x34')][_0x09c0('0x48')]){_0x397e73['include']=[{'all':!![]}];}_0x397e73=_[_0x09c0('0x43')]({},_0x397e73,_0x52cd5c[_0x09c0('0x46')]);return db[_0x09c0('0x47')][_0x09c0('0x4d')](_0x397e73)[_0x09c0('0x2a')](handleEntityNotFound(_0x5bbf4e,null))[_0x09c0('0x2a')](respondWithResult(_0x5bbf4e,null))[_0x09c0('0x4b')](handleError(_0x5bbf4e,null));};exports[_0x09c0('0x4e')]=function(_0x3f6d14,_0x38085c){return db[_0x09c0('0x47')][_0x09c0('0x4e')](_0x3f6d14[_0x09c0('0x4f')],{})[_0x09c0('0x2a')](function(_0x332b69){var _0x32abbe=_0x3f6d14[_0x09c0('0x50')][_0x09c0('0x27')]({'plain':!![]});if(!_0x32abbe)throw new Error(_0x09c0('0x51'));if(_0x32abbe[_0x09c0('0x52')]==='user'){var _0x4acf54=_0x332b69[_0x09c0('0x27')]({'plain':!![]});var _0x15b0a2=_0x09c0('0x28');return db[_0x09c0('0x53')]['find']({'where':{'name':_0x15b0a2,'userProfileId':_0x32abbe[_0x09c0('0x54')]},'raw':!![]})[_0x09c0('0x2a')](function(_0x1823c2){if(_0x1823c2&&_0x1823c2['autoAssociation']===0x0){return db[_0x09c0('0x29')][_0x09c0('0x4e')]({'name':_0x4acf54[_0x09c0('0x2c')],'resourceId':_0x4acf54['id'],'type':_0x1823c2[_0x09c0('0x2c')],'sectionId':_0x1823c2['id']},{})[_0x09c0('0x2a')](function(){return _0x332b69;});}else{return _0x332b69;}})[_0x09c0('0x4b')](function(_0x45ecd0){logger['error'](_0x09c0('0x55'),_0x45ecd0);throw _0x45ecd0;});}return _0x332b69;})[_0x09c0('0x2a')](respondWithResult(_0x38085c,0xc9))[_0x09c0('0x4b')](handleError(_0x38085c,null));};exports[_0x09c0('0x25')]=function(_0x21fe00,_0x316fbd){if(_0x21fe00[_0x09c0('0x4f')]['id']){delete _0x21fe00['body']['id'];}return db['VoiceMail'][_0x09c0('0x4d')]({'where':{'id':_0x21fe00[_0x09c0('0x56')]['id']}})[_0x09c0('0x2a')](handleEntityNotFound(_0x316fbd,null))['then'](saveUpdates(_0x21fe00[_0x09c0('0x4f')],null))['then'](respondWithResult(_0x316fbd,null))[_0x09c0('0x4b')](handleError(_0x316fbd,null));};exports[_0x09c0('0x26')]=function(_0x42d4dd,_0x290618){return db[_0x09c0('0x47')][_0x09c0('0x4d')]({'where':{'id':_0x42d4dd[_0x09c0('0x56')]['id']}})['then'](handleEntityNotFound(_0x290618,null))[_0x09c0('0x2a')](removeEntity(_0x290618,null))[_0x09c0('0x4b')](handleError(_0x290618,null));};exports[_0x09c0('0x57')]=function(_0x270ff2,_0x3a6845,_0x219195){return db[_0x09c0('0x47')][_0x09c0('0x58')]({'where':{'id':_0x270ff2[_0x09c0('0x56')]['id']}})[_0x09c0('0x2a')](handleEntityNotFound(_0x3a6845,null))[_0x09c0('0x2a')](function(_0x4c4339){var _0x34cc0a;var _0x3564e6={},_0x26dc22={};_0x26dc22[_0x09c0('0x39')]=_['keys'](db[_0x09c0('0x59')]['rawAttributes']);_0x26dc22[_0x09c0('0x34')]=_[_0x09c0('0x35')](_0x270ff2[_0x09c0('0x34')]);_0x26dc22['filters']=_['intersection'](_0x26dc22[_0x09c0('0x39')],_0x26dc22[_0x09c0('0x34')]);_0x3564e6[_0x09c0('0x38')]=_[_0x09c0('0x37')](_0x26dc22['model'],qs[_0x09c0('0x3a')](_0x270ff2[_0x09c0('0x34')]['fields']));_0x3564e6[_0x09c0('0x38')]=_0x3564e6[_0x09c0('0x38')][_0x09c0('0x3b')]?_0x3564e6[_0x09c0('0x38')]:_0x26dc22['model'];if(!_0x270ff2[_0x09c0('0x34')][_0x09c0('0x3c')](_0x09c0('0x3d'))){_0x3564e6[_0x09c0('0x20')]=qs[_0x09c0('0x20')](_0x270ff2[_0x09c0('0x34')][_0x09c0('0x20')]);_0x3564e6[_0x09c0('0x3e')]=qs[_0x09c0('0x3e')](_0x270ff2[_0x09c0('0x34')][_0x09c0('0x3e')]);}_0x3564e6[_0x09c0('0x3f')]=qs[_0x09c0('0x40')](_0x270ff2['query'][_0x09c0('0x40')]);_0x3564e6[_0x09c0('0x44')]=qs[_0x09c0('0x36')](_[_0x09c0('0x41')](_0x270ff2[_0x09c0('0x34')],_0x26dc22['filters']));if(_0x270ff2[_0x09c0('0x34')][_0x09c0('0x42')]){_0x3564e6[_0x09c0('0x44')]=_[_0x09c0('0x43')](_0x3564e6['where'],{'$or':_[_0x09c0('0x2f')](_0x3564e6[_0x09c0('0x38')],function(_0x569462){var _0x325013={};_0x325013[_0x569462]={'$like':'%'+_0x270ff2[_0x09c0('0x34')][_0x09c0('0x42')]+'%'};return _0x325013;})});}_0x3564e6[_0x09c0('0x44')]=_[_0x09c0('0x43')](_0x3564e6['where'],{'mailboxuser':_0x4c4339[_0x09c0('0x5a')]});_0x3564e6=_[_0x09c0('0x43')]({},_0x3564e6,_0x270ff2[_0x09c0('0x46')]);return db[_0x09c0('0x59')][_0x09c0('0x5b')](_0x3564e6)['then'](respondWithFilteredResult(_0x3a6845,_0x3564e6));})[_0x09c0('0x4b')](handleError(_0x3a6845,null));}; \ No newline at end of file +var _0x7334=['map','VoiceMail','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','getMessages','VoiceMailMessage','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','get','Voicemails','UserProfileResource','name','send','index'];(function(_0xf512f8,_0x587d5e){var _0xf49c14=function(_0x1f8265){while(--_0x1f8265){_0xf512f8['push'](_0xf512f8['shift']());}};_0xf49c14(++_0x587d5e);}(_0x7334,0x184));var _0x4733=function(_0x1eca2e,_0xd2b818){_0x1eca2e=_0x1eca2e-0x0;var _0x520fbb=_0x7334[_0x1eca2e];return _0x520fbb;};'use strict';var emlformat=require(_0x4733('0x0'));var rimraf=require(_0x4733('0x1'));var zipdir=require(_0x4733('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4733('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4733('0x4'));var util=require(_0x4733('0x5'));var path=require(_0x4733('0x6'));var sox=require(_0x4733('0x7'));var csv=require(_0x4733('0x8'));var ejs=require(_0x4733('0x9'));var fs=require('fs');var fs_extra=require(_0x4733('0xa'));var _=require(_0x4733('0xb'));var squel=require(_0x4733('0xc'));var crypto=require(_0x4733('0xd'));var jsforce=require(_0x4733('0xe'));var deskjs=require(_0x4733('0xf'));var toCsv=require(_0x4733('0x8'));var querystring=require(_0x4733('0x10'));var Papa=require(_0x4733('0x11'));var Redis=require(_0x4733('0x12'));var authService=require(_0x4733('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4733('0x14'));var hardwareService=require(_0x4733('0x15'));var logger=require('../../config/logger')(_0x4733('0x16'));var utils=require('../../config/utils');var config=require(_0x4733('0x17'));var licenseUtil=require(_0x4733('0x18'));var db=require(_0x4733('0x19'))['db'];function respondWithStatusCode(_0x461f74,_0x100ecd){_0x100ecd=_0x100ecd||0xcc;return function(_0x1c146c){if(_0x1c146c){return _0x461f74[_0x4733('0x1a')](_0x100ecd);}return _0x461f74['status'](_0x100ecd)[_0x4733('0x1b')]();};}function respondWithResult(_0x543caf,_0x4327f3){_0x4327f3=_0x4327f3||0xc8;return function(_0x1a22e4){if(_0x1a22e4){return _0x543caf[_0x4733('0x1c')](_0x4327f3)[_0x4733('0x1d')](_0x1a22e4);}};}function respondWithFilteredResult(_0x3813df,_0x167016){return function(_0x12f111){if(_0x12f111){var _0x9fff=typeof _0x167016[_0x4733('0x1e')]==='undefined'&&typeof _0x167016[_0x4733('0x1f')]===_0x4733('0x20');var _0x47b129=_0x12f111[_0x4733('0x21')];var _0x1d2fb6=_0x9fff?0x0:_0x167016[_0x4733('0x1e')];var _0x384e0c=_0x9fff?_0x12f111['count']:_0x167016['offset']+_0x167016[_0x4733('0x1f')];var _0x3b730a;if(_0x384e0c>=_0x47b129){_0x384e0c=_0x47b129;_0x3b730a=0xc8;}else{_0x3b730a=0xce;}_0x3813df['status'](_0x3b730a);return _0x3813df[_0x4733('0x22')](_0x4733('0x23'),_0x1d2fb6+'-'+_0x384e0c+'/'+_0x47b129)[_0x4733('0x1d')](_0x12f111);}return null;};}function patchUpdates(_0x7a4e0){return function(_0x493cd3){try{jsonpatch[_0x4733('0x24')](_0x493cd3,_0x7a4e0,!![]);}catch(_0xb45e1){return BPromise['reject'](_0xb45e1);}return _0x493cd3[_0x4733('0x25')]();};}function saveUpdates(_0x18da47,_0x478e34){return function(_0x15a291){if(_0x15a291){return _0x15a291[_0x4733('0x26')](_0x18da47)[_0x4733('0x27')](function(_0x1a0643){return _0x1a0643;});}return null;};}function removeEntity(_0x3a2542,_0x24db74){return function(_0x180049){if(_0x180049){return _0x180049[_0x4733('0x28')]()['then'](function(){var _0x3e6976=_0x180049[_0x4733('0x29')]({'plain':!![]});var _0x7884e5=_0x4733('0x2a');return db[_0x4733('0x2b')][_0x4733('0x28')]({'where':{'type':_0x7884e5,'resourceId':_0x3e6976['id']}})[_0x4733('0x27')](function(){return _0x180049;});})[_0x4733('0x27')](function(){_0x3a2542[_0x4733('0x1c')](0xcc)[_0x4733('0x1b')]();});}};}function handleEntityNotFound(_0x521855,_0x3aeb57){return function(_0x4c91bc){if(!_0x4c91bc){_0x521855['sendStatus'](0x194);}return _0x4c91bc;};}function handleError(_0x24e975,_0x49c516){_0x49c516=_0x49c516||0x1f4;return function(_0xcde4f4){logger['error'](_0xcde4f4['stack']);if(_0xcde4f4['name']){delete _0xcde4f4[_0x4733('0x2c')];}_0x24e975[_0x4733('0x1c')](_0x49c516)[_0x4733('0x2d')](_0xcde4f4);};}exports[_0x4733('0x2e')]=function(_0x4fee4a,_0x538a7c){var _0x50f67e={},_0x2b2757={},_0x56872b={'count':0x0,'rows':[]};var _0x5a4814=_[_0x4733('0x2f')](db[_0x4733('0x30')][_0x4733('0x31')],function(_0x59172a){return{'name':_0x59172a['fieldName'],'type':_0x59172a[_0x4733('0x32')][_0x4733('0x33')]};});_0x2b2757[_0x4733('0x34')]=_[_0x4733('0x2f')](_0x5a4814,_0x4733('0x2c'));_0x2b2757['query']=_[_0x4733('0x35')](_0x4fee4a[_0x4733('0x36')]);_0x2b2757[_0x4733('0x37')]=_[_0x4733('0x38')](_0x2b2757[_0x4733('0x34')],_0x2b2757['query']);_0x50f67e['attributes']=_[_0x4733('0x38')](_0x2b2757[_0x4733('0x34')],qs[_0x4733('0x39')](_0x4fee4a[_0x4733('0x36')][_0x4733('0x39')]));_0x50f67e['attributes']=_0x50f67e[_0x4733('0x3a')][_0x4733('0x3b')]?_0x50f67e[_0x4733('0x3a')]:_0x2b2757['model'];if(!_0x4fee4a[_0x4733('0x36')][_0x4733('0x3c')](_0x4733('0x3d'))){_0x50f67e[_0x4733('0x1f')]=qs[_0x4733('0x1f')](_0x4fee4a[_0x4733('0x36')][_0x4733('0x1f')]);_0x50f67e[_0x4733('0x1e')]=qs['offset'](_0x4fee4a[_0x4733('0x36')]['offset']);}_0x50f67e[_0x4733('0x3e')]=qs[_0x4733('0x3f')](_0x4fee4a[_0x4733('0x36')][_0x4733('0x3f')]);_0x50f67e[_0x4733('0x40')]=qs[_0x4733('0x37')](_[_0x4733('0x41')](_0x4fee4a[_0x4733('0x36')],_0x2b2757['filters']),_0x5a4814);if(_0x4fee4a[_0x4733('0x36')][_0x4733('0x42')]){_0x50f67e['where']=_[_0x4733('0x43')](_0x50f67e[_0x4733('0x40')],{'$or':_['map'](_0x5a4814,function(_0x34aefe){if(_0x34aefe['type']!==_0x4733('0x44')){var _0x4c3073={};_0x4c3073[_0x34aefe[_0x4733('0x2c')]]={'$like':'%'+_0x4fee4a[_0x4733('0x36')]['filter']+'%'};return _0x4c3073;}})});}_0x50f67e=_['merge']({},_0x50f67e,_0x4fee4a[_0x4733('0x45')]);var _0x1d7112={'where':_0x50f67e['where']};return db[_0x4733('0x30')][_0x4733('0x21')](_0x1d7112)[_0x4733('0x27')](function(_0x28ed14){_0x56872b[_0x4733('0x21')]=_0x28ed14;if(_0x4fee4a[_0x4733('0x36')][_0x4733('0x46')]){_0x50f67e[_0x4733('0x47')]=[{'all':!![]}];}return db[_0x4733('0x30')][_0x4733('0x48')](_0x50f67e);})[_0x4733('0x27')](function(_0x1d32df){_0x56872b[_0x4733('0x49')]=_0x1d32df;return _0x56872b;})[_0x4733('0x27')](respondWithFilteredResult(_0x538a7c,_0x50f67e))[_0x4733('0x4a')](handleError(_0x538a7c,null));};exports[_0x4733('0x4b')]=function(_0x297bb1,_0x397088){var _0x50b9cb={'raw':!![],'where':{'id':_0x297bb1[_0x4733('0x4c')]['id']}},_0x1a0c5c={};_0x1a0c5c[_0x4733('0x34')]=_[_0x4733('0x35')](db[_0x4733('0x30')][_0x4733('0x31')]);_0x1a0c5c[_0x4733('0x36')]=_[_0x4733('0x35')](_0x297bb1[_0x4733('0x36')]);_0x1a0c5c[_0x4733('0x37')]=_[_0x4733('0x38')](_0x1a0c5c[_0x4733('0x34')],_0x1a0c5c[_0x4733('0x36')]);_0x50b9cb[_0x4733('0x3a')]=_['intersection'](_0x1a0c5c['model'],qs[_0x4733('0x39')](_0x297bb1[_0x4733('0x36')][_0x4733('0x39')]));_0x50b9cb[_0x4733('0x3a')]=_0x50b9cb[_0x4733('0x3a')][_0x4733('0x3b')]?_0x50b9cb[_0x4733('0x3a')]:_0x1a0c5c[_0x4733('0x34')];if(_0x297bb1[_0x4733('0x36')][_0x4733('0x46')]){_0x50b9cb['include']=[{'all':!![]}];}_0x50b9cb=_['merge']({},_0x50b9cb,_0x297bb1['options']);return db['VoiceMail'][_0x4733('0x4d')](_0x50b9cb)[_0x4733('0x27')](handleEntityNotFound(_0x397088,null))[_0x4733('0x27')](respondWithResult(_0x397088,null))[_0x4733('0x4a')](handleError(_0x397088,null));};exports[_0x4733('0x4e')]=function(_0x45b9cf,_0x1c6abf){return db[_0x4733('0x30')][_0x4733('0x4e')](_0x45b9cf[_0x4733('0x4f')],{})['then'](function(_0x53d70b){var _0x29c93d=_0x45b9cf['user'][_0x4733('0x29')]({'plain':!![]});if(!_0x29c93d)throw new Error(_0x4733('0x50'));if(_0x29c93d[_0x4733('0x51')]==='user'){var _0x3f2a78=_0x53d70b[_0x4733('0x29')]({'plain':!![]});var _0x31ae69=_0x4733('0x2a');return db[_0x4733('0x52')][_0x4733('0x4d')]({'where':{'name':_0x31ae69,'userProfileId':_0x29c93d[_0x4733('0x53')]},'raw':!![]})[_0x4733('0x27')](function(_0x28d428){if(_0x28d428&&_0x28d428['autoAssociation']===0x0){return db[_0x4733('0x2b')][_0x4733('0x4e')]({'name':_0x3f2a78[_0x4733('0x2c')],'resourceId':_0x3f2a78['id'],'type':_0x28d428['name'],'sectionId':_0x28d428['id']},{})[_0x4733('0x27')](function(){return _0x53d70b;});}else{return _0x53d70b;}})[_0x4733('0x4a')](function(_0xafb3f8){logger[_0x4733('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xafb3f8);throw _0xafb3f8;});}return _0x53d70b;})[_0x4733('0x27')](respondWithResult(_0x1c6abf,0xc9))['catch'](handleError(_0x1c6abf,null));};exports[_0x4733('0x26')]=function(_0x3b8165,_0x42405e){if(_0x3b8165[_0x4733('0x4f')]['id']){delete _0x3b8165[_0x4733('0x4f')]['id'];}return db['VoiceMail'][_0x4733('0x4d')]({'where':{'id':_0x3b8165[_0x4733('0x4c')]['id']}})['then'](handleEntityNotFound(_0x42405e,null))['then'](saveUpdates(_0x3b8165[_0x4733('0x4f')],null))[_0x4733('0x27')](respondWithResult(_0x42405e,null))[_0x4733('0x4a')](handleError(_0x42405e,null));};exports[_0x4733('0x28')]=function(_0x422010,_0x972fde){return db[_0x4733('0x30')][_0x4733('0x4d')]({'where':{'id':_0x422010['params']['id']}})['then'](handleEntityNotFound(_0x972fde,null))[_0x4733('0x27')](removeEntity(_0x972fde,null))['catch'](handleError(_0x972fde,null));};exports[_0x4733('0x55')]=function(_0x2c532a,_0x51a8db,_0x57034a){return db['VoiceMail']['findOne']({'where':{'id':_0x2c532a[_0x4733('0x4c')]['id']}})[_0x4733('0x27')](handleEntityNotFound(_0x51a8db,null))[_0x4733('0x27')](function(_0x5e451a){var _0x12242a;var _0x3d1157={},_0x15a32e={};_0x15a32e[_0x4733('0x34')]=_[_0x4733('0x35')](db[_0x4733('0x56')][_0x4733('0x31')]);_0x15a32e['query']=_[_0x4733('0x35')](_0x2c532a[_0x4733('0x36')]);_0x15a32e['filters']=_['intersection'](_0x15a32e[_0x4733('0x34')],_0x15a32e[_0x4733('0x36')]);_0x3d1157[_0x4733('0x3a')]=_[_0x4733('0x38')](_0x15a32e[_0x4733('0x34')],qs[_0x4733('0x39')](_0x2c532a[_0x4733('0x36')][_0x4733('0x39')]));_0x3d1157[_0x4733('0x3a')]=_0x3d1157['attributes'][_0x4733('0x3b')]?_0x3d1157[_0x4733('0x3a')]:_0x15a32e[_0x4733('0x34')];if(!_0x2c532a['query'][_0x4733('0x3c')]('nolimit')){_0x3d1157[_0x4733('0x1f')]=qs[_0x4733('0x1f')](_0x2c532a[_0x4733('0x36')][_0x4733('0x1f')]);_0x3d1157[_0x4733('0x1e')]=qs[_0x4733('0x1e')](_0x2c532a['query'][_0x4733('0x1e')]);}_0x3d1157['order']=qs[_0x4733('0x3f')](_0x2c532a[_0x4733('0x36')]['sort']);_0x3d1157[_0x4733('0x40')]=qs['filters'](_['pick'](_0x2c532a[_0x4733('0x36')],_0x15a32e[_0x4733('0x37')]));if(_0x2c532a[_0x4733('0x36')][_0x4733('0x42')]){_0x3d1157[_0x4733('0x40')]=_[_0x4733('0x43')](_0x3d1157[_0x4733('0x40')],{'$or':_[_0x4733('0x2f')](_0x3d1157[_0x4733('0x3a')],function(_0x5eab76){var _0x53d128={};_0x53d128[_0x5eab76]={'$like':'%'+_0x2c532a['query'][_0x4733('0x42')]+'%'};return _0x53d128;})});}_0x3d1157[_0x4733('0x40')]=_[_0x4733('0x43')](_0x3d1157[_0x4733('0x40')],{'mailboxuser':_0x5e451a['mailbox']});_0x3d1157=_[_0x4733('0x43')]({},_0x3d1157,_0x2c532a[_0x4733('0x45')]);return db[_0x4733('0x56')]['findAndCountAll'](_0x3d1157)[_0x4733('0x27')](respondWithFilteredResult(_0x51a8db,_0x3d1157));})['catch'](handleError(_0x51a8db,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 38328a3..7e18782 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 _0x9da4=['../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox','context','util','../../config/logger','api','moment','bluebird','path'];(function(_0x21af3a,_0x386e1d){var _0x268a49=function(_0x41a650){while(--_0x41a650){_0x21af3a['push'](_0x21af3a['shift']());}};_0x268a49(++_0x386e1d);}(_0x9da4,0x182));var _0x49da=function(_0x33638b,_0x4509dd){_0x33638b=_0x33638b-0x0;var _0x4365f8=_0x9da4[_0x33638b];return _0x4365f8;};'use strict';var _=require('lodash');var util=require(_0x49da('0x0'));var logger=require(_0x49da('0x1'))(_0x49da('0x2'));var moment=require(_0x49da('0x3'));var BPromise=require(_0x49da('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x49da('0x5'));var rimraf=require('rimraf');var config=require(_0x49da('0x6'));var attributes=require(_0x49da('0x7'));module[_0x49da('0x8')]=function(_0x182b7f,_0x4e93df){return _0x182b7f[_0x49da('0x9')](_0x49da('0xa'),attributes,{'tableName':_0x49da('0xb'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x49da('0xc'),_0x49da('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0044=['bluebird','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','mailbox_context','lodash','util','api','moment'];(function(_0xd22d95,_0xc59f8f){var _0x15d7a3=function(_0x3db95c){while(--_0x3db95c){_0xd22d95['push'](_0xd22d95['shift']());}};_0x15d7a3(++_0xc59f8f);}(_0x0044,0x11c));var _0x4004=function(_0x525af9,_0x4edd23){_0x525af9=_0x525af9-0x0;var _0x129fbf=_0x0044[_0x525af9];return _0x129fbf;};'use strict';var _=require(_0x4004('0x0'));var util=require(_0x4004('0x1'));var logger=require('../../config/logger')(_0x4004('0x2'));var moment=require(_0x4004('0x3'));var BPromise=require(_0x4004('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4004('0x5'));var config=require(_0x4004('0x6'));var attributes=require(_0x4004('0x7'));module[_0x4004('0x8')]=function(_0x395018,_0x18b6cb){return _0x395018[_0x4004('0x9')](_0x4004('0xa'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x4004('0xb'),'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 842de0e..000c5fc 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 _0x6e0f=['request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','VoiceMail,\x20%s,\x20%s'];(function(_0x2341ab,_0x326a6c){var _0x54533e=function(_0x413273){while(--_0x413273){_0x2341ab['push'](_0x2341ab['shift']());}};_0x54533e(++_0x326a6c);}(_0x6e0f,0x93));var _0xf6e0=function(_0x7feb90,_0x28e700){_0x7feb90=_0x7feb90-0x0;var _0x3c5b33=_0x6e0f[_0x7feb90];return _0x3c5b33;};'use strict';var _=require(_0xf6e0('0x0'));var util=require(_0xf6e0('0x1'));var moment=require(_0xf6e0('0x2'));var BPromise=require('bluebird');var rs=require(_0xf6e0('0x3'));var fs=require('fs');var Redis=require(_0xf6e0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf6e0('0x5'));var logger=require(_0xf6e0('0x6'))(_0xf6e0('0x7'));var config=require(_0xf6e0('0x8'));var jayson=require(_0xf6e0('0x9'));var client=jayson[_0xf6e0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f71a9,_0x2a1ced,_0xff358b){return new BPromise(function(_0x44a3aa,_0x141a42){return client[_0xf6e0('0xb')](_0x3f71a9,_0xff358b)[_0xf6e0('0xc')](function(_0x58f463){logger['info'](_0xf6e0('0xd'),_0x2a1ced,_0xf6e0('0xe'));logger[_0xf6e0('0xf')](_0xf6e0('0x10'),_0x2a1ced,_0xf6e0('0xe'),JSON[_0xf6e0('0x11')](_0x58f463));if(_0x58f463[_0xf6e0('0x12')]){if(_0x58f463[_0xf6e0('0x12')]['code']===0x1f4){logger[_0xf6e0('0x12')](_0xf6e0('0xd'),_0x2a1ced,_0x58f463[_0xf6e0('0x12')][_0xf6e0('0x13')]);return _0x141a42(_0x58f463['error'][_0xf6e0('0x13')]);}logger[_0xf6e0('0x12')]('VoiceMail,\x20%s,\x20%s',_0x2a1ced,_0x58f463[_0xf6e0('0x12')]['message']);return _0x44a3aa(_0x58f463[_0xf6e0('0x12')]['message']);}else{logger[_0xf6e0('0x14')](_0xf6e0('0xd'),_0x2a1ced,_0xf6e0('0xe'));_0x44a3aa(_0x58f463[_0xf6e0('0x15')][_0xf6e0('0x13')]);}})[_0xf6e0('0x16')](function(_0xb2fd92){logger[_0xf6e0('0x12')]('VoiceMail,\x20%s,\x20%s',_0x2a1ced,_0xb2fd92);_0x141a42(_0xb2fd92);});});} \ No newline at end of file +var _0x9b9d=['error','VoiceMail,\x20%s,\x20%s','message','request\x20sent','result','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','VoiceMail,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x6843fd,_0x891cd8){var _0x293849=function(_0x160729){while(--_0x160729){_0x6843fd['push'](_0x6843fd['shift']());}};_0x293849(++_0x891cd8);}(_0x9b9d,0xc4));var _0xd9b9=function(_0xc2dde6,_0x1cccc9){_0xc2dde6=_0xc2dde6-0x0;var _0x9fc29c=_0x9b9d[_0xc2dde6];return _0x9fc29c;};'use strict';var _=require('lodash');var util=require(_0xd9b9('0x0'));var moment=require(_0xd9b9('0x1'));var BPromise=require(_0xd9b9('0x2'));var rs=require(_0xd9b9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd9b9('0x4'));var logger=require(_0xd9b9('0x5'))(_0xd9b9('0x6'));var config=require(_0xd9b9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd9b9('0x8')][_0xd9b9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19f169,_0x20d7b2,_0x378aa6){return new BPromise(function(_0x3e03aa,_0x1e375b){return client['request'](_0x19f169,_0x378aa6)['then'](function(_0x499d41){logger[_0xd9b9('0xa')]('VoiceMail,\x20%s,\x20%s',_0x20d7b2,'request\x20sent');logger['debug'](_0xd9b9('0xb'),_0x20d7b2,'request\x20sent',JSON[_0xd9b9('0xc')](_0x499d41));if(_0x499d41[_0xd9b9('0xd')]){if(_0x499d41['error']['code']===0x1f4){logger[_0xd9b9('0xd')](_0xd9b9('0xe'),_0x20d7b2,_0x499d41[_0xd9b9('0xd')][_0xd9b9('0xf')]);return _0x1e375b(_0x499d41[_0xd9b9('0xd')]['message']);}logger[_0xd9b9('0xd')](_0xd9b9('0xe'),_0x20d7b2,_0x499d41[_0xd9b9('0xd')]['message']);return _0x3e03aa(_0x499d41['error']['message']);}else{logger['info'](_0xd9b9('0xe'),_0x20d7b2,_0xd9b9('0x10'));_0x3e03aa(_0x499d41[_0xd9b9('0x11')]['message']);}})[_0xd9b9('0x12')](function(_0x1f8039){logger[_0xd9b9('0xd')](_0xd9b9('0xe'),_0x20d7b2,_0x1f8039);_0x1e375b(_0x1f8039);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 0e786dc..81251fd 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 _0x0fd0=['download','post','put','exports','express','Router','fs-extra','../../components/interaction/service','./voiceMailMessage.controller','isAuthenticated','index','get','/:id'];(function(_0xc971a4,_0x5b381c){var _0x4ebd6b=function(_0x371149){while(--_0x371149){_0xc971a4['push'](_0xc971a4['shift']());}};_0x4ebd6b(++_0x5b381c);}(_0x0fd0,0xe1));var _0x00fd=function(_0x4b6391,_0x125cdd){_0x4b6391=_0x4b6391-0x0;var _0x375d90=_0x0fd0[_0x4b6391];return _0x375d90;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x00fd('0x0'));var router=express[_0x00fd('0x1')]();var fs_extra=require(_0x00fd('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x00fd('0x3'));var config=require('../../config/environment');var controller=require(_0x00fd('0x4'));router['get']('/',auth[_0x00fd('0x5')](),controller[_0x00fd('0x6')]);router[_0x00fd('0x7')](_0x00fd('0x8'),auth[_0x00fd('0x5')](),controller['show']);router['get']('/:id/download',auth[_0x00fd('0x5')](),controller[_0x00fd('0x9')]);router[_0x00fd('0xa')]('/',auth[_0x00fd('0x5')](),controller['create']);router[_0x00fd('0xb')](_0x00fd('0x8'),auth[_0x00fd('0x5')](),controller['update']);router['delete'](_0x00fd('0x8'),auth[_0x00fd('0x5')](),controller['destroy']);module[_0x00fd('0xc')]=router; \ No newline at end of file +var _0x2468=['post','create','update','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voiceMailMessage.controller','get','index','/:id','isAuthenticated','show','/:id/download','download'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x2468,0x11d));var _0x8246=function(_0x1e4a8e,_0x18022b){_0x1e4a8e=_0x1e4a8e-0x0;var _0x5408f9=_0x2468[_0x1e4a8e];return _0x5408f9;};'use strict';var multer=require('multer');var util=require(_0x8246('0x0'));var path=require(_0x8246('0x1'));var timeout=require(_0x8246('0x2'));var express=require(_0x8246('0x3'));var router=express['Router']();var fs_extra=require(_0x8246('0x4'));var auth=require(_0x8246('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8246('0x6'));var controller=require(_0x8246('0x7'));router[_0x8246('0x8')]('/',auth['isAuthenticated'](),controller[_0x8246('0x9')]);router[_0x8246('0x8')](_0x8246('0xa'),auth[_0x8246('0xb')](),controller[_0x8246('0xc')]);router['get'](_0x8246('0xd'),auth[_0x8246('0xb')](),controller[_0x8246('0xe')]);router[_0x8246('0xf')]('/',auth[_0x8246('0xb')](),controller[_0x8246('0x10')]);router['put'](_0x8246('0xa'),auth[_0x8246('0xb')](),controller[_0x8246('0x11')]);router['delete'](_0x8246('0xa'),auth[_0x8246('0xb')](),controller[_0x8246('0x12')]);module[_0x8246('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 47b2335..9c456c7 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 _0xbb0d=['STRING','BLOB','TIMESTAMP','literal','sequelize','VIRTUAL','getDataValue','INTEGER'];(function(_0x104504,_0x443c9b){var _0x2f3e8f=function(_0x31c8ca){while(--_0x31c8ca){_0x104504['push'](_0x104504['shift']());}};_0x2f3e8f(++_0x443c9b);}(_0xbb0d,0x16c));var _0xdbb0=function(_0x5ca423,_0x22451e){_0x5ca423=_0x5ca423-0x0;var _0x25220d=_0xbb0d[_0x5ca423];return _0x25220d;};'use strict';var Sequelize=require(_0xdbb0('0x0'));module['exports']={'name':{'type':Sequelize[_0xdbb0('0x1')],'get':function(_0x2a9004){return this[_0xdbb0('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xdbb0('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xdbb0('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xdbb0('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xdbb0('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xdbb0('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xdbb0('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0xdbb0('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xdbb0('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xdbb0('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0xdbb0('0x5')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xdbb0('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xdbb0('0x4')],'defaultValue':''},'stamp':{'type':_0xdbb0('0x6'),'defaultValue':Sequelize[_0xdbb0('0x7')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x433d=['exports','VIRTUAL','INTEGER','STRING','BLOB','long','literal'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x433d,0x18f));var _0xd433=function(_0x1b8f5a,_0x57c154){_0x1b8f5a=_0x1b8f5a-0x0;var _0x594189=_0x433d[_0x1b8f5a];return _0x594189;};'use strict';var Sequelize=require('sequelize');module[_0xd433('0x0')]={'name':{'type':Sequelize[_0xd433('0x1')],'get':function(_0x111fd6){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0xd433('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xd433('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0xd433('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xd433('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0xd433('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0xd433('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0xd433('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xd433('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xd433('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0xd433('0x4')](_0xd433('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0xd433('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xd433('0x3')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0xd433('0x6')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 2c4fe47..a87d2dd 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 _0x7f76=['fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','download','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','msg_id','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','set','recording','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceMailMessage'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0x7f76,0x84));var _0x67f7=function(_0x3b4626,_0x14d17b){_0x3b4626=_0x3b4626-0x0;var _0x404a2e=_0x7f76[_0x3b4626];return _0x404a2e;};'use strict';var emlformat=require(_0x67f7('0x0'));var rimraf=require(_0x67f7('0x1'));var zipdir=require(_0x67f7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x67f7('0x3'));var moment=require(_0x67f7('0x4'));var BPromise=require(_0x67f7('0x5'));var Mustache=require(_0x67f7('0x6'));var util=require('util');var path=require(_0x67f7('0x7'));var sox=require(_0x67f7('0x8'));var csv=require('to-csv');var ejs=require(_0x67f7('0x9'));var fs=require('fs');var fs_extra=require(_0x67f7('0xa'));var _=require(_0x67f7('0xb'));var squel=require(_0x67f7('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x67f7('0xd'));var toCsv=require(_0x67f7('0xe'));var querystring=require(_0x67f7('0xf'));var Papa=require(_0x67f7('0x10'));var Redis=require(_0x67f7('0x11'));var authService=require(_0x67f7('0x12'));var qs=require(_0x67f7('0x13'));var as=require(_0x67f7('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x67f7('0x15'))('api');var utils=require(_0x67f7('0x16'));var config=require(_0x67f7('0x17'));var licenseUtil=require(_0x67f7('0x18'));var db=require(_0x67f7('0x19'))['db'];function respondWithStatusCode(_0x344439,_0x52c40c){_0x52c40c=_0x52c40c||0xcc;return function(_0x149edb){if(_0x149edb){return _0x344439[_0x67f7('0x1a')](_0x52c40c);}return _0x344439[_0x67f7('0x1b')](_0x52c40c)[_0x67f7('0x1c')]();};}function respondWithResult(_0x3db444,_0xf4e182){_0xf4e182=_0xf4e182||0xc8;return function(_0x3e3df4){if(_0x3e3df4){return _0x3db444['status'](_0xf4e182)[_0x67f7('0x1d')](_0x3e3df4);}};}function respondWithFilteredResult(_0x3bc09f,_0x12ff0a){return function(_0x2909cc){if(_0x2909cc){var _0x5d9e24=typeof _0x12ff0a[_0x67f7('0x1e')]==='undefined'&&typeof _0x12ff0a['limit']===_0x67f7('0x1f');var _0x3b25b3=_0x2909cc['count'];var _0x2ff723=_0x5d9e24?0x0:_0x12ff0a[_0x67f7('0x1e')];var _0x3a7145=_0x5d9e24?_0x2909cc[_0x67f7('0x20')]:_0x12ff0a[_0x67f7('0x1e')]+_0x12ff0a[_0x67f7('0x21')];var _0x24d89c;if(_0x3a7145>=_0x3b25b3){_0x3a7145=_0x3b25b3;_0x24d89c=0xc8;}else{_0x24d89c=0xce;}_0x3bc09f[_0x67f7('0x1b')](_0x24d89c);return _0x3bc09f['set'](_0x67f7('0x22'),_0x2ff723+'-'+_0x3a7145+'/'+_0x3b25b3)[_0x67f7('0x1d')](_0x2909cc);}return null;};}function patchUpdates(_0x485661){return function(_0x153d84){try{jsonpatch[_0x67f7('0x23')](_0x153d84,_0x485661,!![]);}catch(_0x570607){return BPromise[_0x67f7('0x24')](_0x570607);}return _0x153d84[_0x67f7('0x25')]();};}function saveUpdates(_0x29a7bb,_0x2cacb9){return function(_0x395d05){if(_0x395d05){return _0x395d05[_0x67f7('0x26')](_0x29a7bb)[_0x67f7('0x27')](function(_0x15724d){return _0x15724d;});}return null;};}function removeEntity(_0x1f7203,_0x174e9b){return function(_0x5892aa){if(_0x5892aa){return _0x5892aa[_0x67f7('0x28')]()[_0x67f7('0x27')](function(){_0x1f7203[_0x67f7('0x1b')](0xcc)[_0x67f7('0x1c')]();});}};}function handleEntityNotFound(_0x18617d,_0x624575){return function(_0x24c7fb){if(!_0x24c7fb){_0x18617d[_0x67f7('0x1a')](0x194);}return _0x24c7fb;};}function handleError(_0x4e466e,_0x11b0df){_0x11b0df=_0x11b0df||0x1f4;return function(_0x14d2c9){logger[_0x67f7('0x29')](_0x14d2c9[_0x67f7('0x2a')]);if(_0x14d2c9[_0x67f7('0x2b')]){delete _0x14d2c9[_0x67f7('0x2b')];}_0x4e466e[_0x67f7('0x1b')](_0x11b0df)[_0x67f7('0x2c')](_0x14d2c9);};}exports[_0x67f7('0x2d')]=function(_0x57de40,_0x449893){var _0x365bd4={},_0x2a2d18={},_0x1c80b5={'count':0x0,'rows':[]};var _0x43ef6d=_[_0x67f7('0x2e')](db[_0x67f7('0x2f')]['rawAttributes'],function(_0x5b4e40){return{'name':_0x5b4e40[_0x67f7('0x30')],'type':_0x5b4e40[_0x67f7('0x31')][_0x67f7('0x32')]};});_0x2a2d18[_0x67f7('0x33')]=_[_0x67f7('0x34')](_[_0x67f7('0x2e')](_0x43ef6d,_0x67f7('0x2b')),[_0x67f7('0x2b')]);_0x2a2d18[_0x67f7('0x35')]=_[_0x67f7('0x36')](_0x57de40['query']);_0x2a2d18[_0x67f7('0x37')]=_[_0x67f7('0x38')](_0x2a2d18['model'],_0x2a2d18[_0x67f7('0x35')]);_0x365bd4[_0x67f7('0x39')]=_[_0x67f7('0x38')](_0x2a2d18[_0x67f7('0x33')],qs['fields'](_0x57de40[_0x67f7('0x35')][_0x67f7('0x3a')]));_0x365bd4[_0x67f7('0x39')]=_0x365bd4[_0x67f7('0x39')][_0x67f7('0x3b')]?_0x365bd4['attributes']:_0x2a2d18[_0x67f7('0x33')];if(!_0x57de40['query'][_0x67f7('0x3c')]('nolimit')){_0x365bd4[_0x67f7('0x21')]=qs['limit'](_0x57de40[_0x67f7('0x35')][_0x67f7('0x21')]);_0x365bd4['offset']=qs['offset'](_0x57de40[_0x67f7('0x35')][_0x67f7('0x1e')]);}_0x365bd4[_0x67f7('0x3d')]=qs[_0x67f7('0x3e')](_0x57de40[_0x67f7('0x35')]['sort']);_0x365bd4[_0x67f7('0x3f')]=qs[_0x67f7('0x37')](_['pick'](_0x57de40[_0x67f7('0x35')],_0x2a2d18[_0x67f7('0x37')]),_0x43ef6d);if(_0x57de40[_0x67f7('0x35')][_0x67f7('0x40')]){_0x365bd4['where']=_[_0x67f7('0x41')](_0x365bd4['where'],{'$or':_[_0x67f7('0x2e')](_0x43ef6d,function(_0xf4555c){if(_0xf4555c[_0x67f7('0x31')]!==_0x67f7('0x42')){var _0x5909e8={};_0x5909e8[_0xf4555c['name']]={'$like':'%'+_0x57de40[_0x67f7('0x35')][_0x67f7('0x40')]+'%'};return _0x5909e8;}})});}_0x365bd4=_[_0x67f7('0x41')]({},_0x365bd4,_0x57de40[_0x67f7('0x43')]);var _0x3a1625={'where':_0x365bd4[_0x67f7('0x3f')]};return db[_0x67f7('0x2f')]['count'](_0x3a1625)[_0x67f7('0x27')](function(_0x587af0){_0x1c80b5[_0x67f7('0x20')]=_0x587af0;if(_0x57de40[_0x67f7('0x35')][_0x67f7('0x44')]){_0x365bd4[_0x67f7('0x45')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0x67f7('0x46')](_0x365bd4);})['then'](function(_0x41c94c){_0x1c80b5[_0x67f7('0x47')]=_0x41c94c;return _0x1c80b5;})[_0x67f7('0x27')](respondWithFilteredResult(_0x449893,_0x365bd4))[_0x67f7('0x48')](handleError(_0x449893,null));};exports[_0x67f7('0x49')]=function(_0x49726e,_0x1515a1){var _0x138116={'raw':!![],'where':{'id':_0x49726e[_0x67f7('0x4a')]['id']}},_0x231b19={};_0x231b19['model']=_[_0x67f7('0x36')](db[_0x67f7('0x2f')]['rawAttributes']);_0x231b19[_0x67f7('0x35')]=_['keys'](_0x49726e[_0x67f7('0x35')]);_0x231b19['filters']=_[_0x67f7('0x38')](_0x231b19['model'],_0x231b19[_0x67f7('0x35')]);_0x138116[_0x67f7('0x39')]=_[_0x67f7('0x38')](_0x231b19[_0x67f7('0x33')],qs[_0x67f7('0x3a')](_0x49726e[_0x67f7('0x35')][_0x67f7('0x3a')]));_0x138116[_0x67f7('0x39')]=_0x138116[_0x67f7('0x39')][_0x67f7('0x3b')]?_0x138116[_0x67f7('0x39')]:_0x231b19[_0x67f7('0x33')];if(_0x49726e[_0x67f7('0x35')][_0x67f7('0x44')]){_0x138116[_0x67f7('0x45')]=[{'all':!![]}];}_0x138116=_[_0x67f7('0x41')]({},_0x138116,_0x49726e['options']);return db[_0x67f7('0x2f')][_0x67f7('0x4b')](_0x138116)['then'](handleEntityNotFound(_0x1515a1,null))[_0x67f7('0x27')](respondWithResult(_0x1515a1,null))[_0x67f7('0x48')](handleError(_0x1515a1,null));};exports['create']=function(_0x126939,_0x57aeeb){return db[_0x67f7('0x2f')][_0x67f7('0x4c')](_0x126939[_0x67f7('0x4d')],{})[_0x67f7('0x27')](respondWithResult(_0x57aeeb,0xc9))[_0x67f7('0x48')](handleError(_0x57aeeb,null));};exports[_0x67f7('0x26')]=function(_0x17e49a,_0x121d5c){if(_0x17e49a['body']['id']){delete _0x17e49a[_0x67f7('0x4d')]['id'];}return db[_0x67f7('0x2f')][_0x67f7('0x4b')]({'where':{'id':_0x17e49a[_0x67f7('0x4a')]['id']}})[_0x67f7('0x27')](handleEntityNotFound(_0x121d5c,null))['then'](saveUpdates(_0x17e49a[_0x67f7('0x4d')],null))['then'](respondWithResult(_0x121d5c,null))[_0x67f7('0x48')](handleError(_0x121d5c,null));};exports[_0x67f7('0x28')]=function(_0x21d5e4,_0x4ff43b){return db[_0x67f7('0x2f')]['find']({'where':{'id':_0x21d5e4[_0x67f7('0x4a')]['id']}})[_0x67f7('0x27')](handleEntityNotFound(_0x4ff43b,null))[_0x67f7('0x27')](removeEntity(_0x4ff43b,null))[_0x67f7('0x48')](handleError(_0x4ff43b,null));};exports[_0x67f7('0x4e')]=function(_0x365e88,_0x4fad7e,_0x484732){return db[_0x67f7('0x2f')]['find']({'where':{'id':_0x365e88['params']['id']},'attributes':['id','recording','msg_id']})['then'](handleEntityNotFound(_0x4fad7e,null))['then'](function(_0x307ec0){if(_0x307ec0){if(!_0x307ec0['recording']){throw new db[(_0x67f7('0x4f'))][(_0x67f7('0x50'))](_0x67f7('0x51'));}var _0x534325={'Content-Type':_0x67f7('0x52'),'Content-Disposition':_0x67f7('0x53')};if(_0x307ec0[_0x67f7('0x54')]){_0x534325[_0x67f7('0x55')]=_0x67f7('0x56')+_0x307ec0[_0x67f7('0x54')]+_0x67f7('0x57');}_0x4fad7e[_0x67f7('0x58')](_0x534325);return _0x4fad7e[_0x67f7('0x2c')](new Buffer(_0x307ec0[_0x67f7('0x59')]));}})[_0x67f7('0x48')](handleError(_0x4fad7e,null));}; \ No newline at end of file +var _0x861e=['../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','index','map','VoiceMailMessage','fieldName','type','key','model','differenceBy','name','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','rawAttributes','length','find','body','params','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','.wav\x22','send','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x1db251,_0xf0443d){var _0x56685a=function(_0x6ec6b7){while(--_0x6ec6b7){_0x1db251['push'](_0x1db251['shift']());}};_0x56685a(++_0xf0443d);}(_0x861e,0x91));var _0xe861=function(_0x2969ff,_0x3316b9){_0x2969ff=_0x2969ff-0x0;var _0x934aa8=_0x861e[_0x2969ff];return _0x934aa8;};'use strict';var emlformat=require(_0xe861('0x0'));var rimraf=require(_0xe861('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe861('0x2'));var rp=require(_0xe861('0x3'));var moment=require(_0xe861('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe861('0x5'));var util=require(_0xe861('0x6'));var path=require('path');var sox=require(_0xe861('0x7'));var csv=require(_0xe861('0x8'));var ejs=require(_0xe861('0x9'));var fs=require('fs');var fs_extra=require(_0xe861('0xa'));var _=require('lodash');var squel=require(_0xe861('0xb'));var crypto=require('crypto');var jsforce=require(_0xe861('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe861('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe861('0xe'));var qs=require(_0xe861('0xf'));var as=require(_0xe861('0x10'));var hardwareService=require(_0xe861('0x11'));var logger=require(_0xe861('0x12'))(_0xe861('0x13'));var utils=require(_0xe861('0x14'));var config=require(_0xe861('0x15'));var licenseUtil=require(_0xe861('0x16'));var db=require(_0xe861('0x17'))['db'];function respondWithStatusCode(_0x4d0a8a,_0x1f13ef){_0x1f13ef=_0x1f13ef||0xcc;return function(_0x25d98e){if(_0x25d98e){return _0x4d0a8a[_0xe861('0x18')](_0x1f13ef);}return _0x4d0a8a[_0xe861('0x19')](_0x1f13ef)[_0xe861('0x1a')]();};}function respondWithResult(_0x3db915,_0x45045d){_0x45045d=_0x45045d||0xc8;return function(_0x2e17ff){if(_0x2e17ff){return _0x3db915[_0xe861('0x19')](_0x45045d)[_0xe861('0x1b')](_0x2e17ff);}};}function respondWithFilteredResult(_0xae6166,_0x582992){return function(_0x1daa74){if(_0x1daa74){var _0x272c7c=typeof _0x582992[_0xe861('0x1c')]===_0xe861('0x1d')&&typeof _0x582992[_0xe861('0x1e')]===_0xe861('0x1d');var _0x194a6a=_0x1daa74['count'];var _0x10045c=_0x272c7c?0x0:_0x582992['offset'];var _0x476293=_0x272c7c?_0x1daa74[_0xe861('0x1f')]:_0x582992['offset']+_0x582992[_0xe861('0x1e')];var _0x1d1f8a;if(_0x476293>=_0x194a6a){_0x476293=_0x194a6a;_0x1d1f8a=0xc8;}else{_0x1d1f8a=0xce;}_0xae6166[_0xe861('0x19')](_0x1d1f8a);return _0xae6166[_0xe861('0x20')](_0xe861('0x21'),_0x10045c+'-'+_0x476293+'/'+_0x194a6a)[_0xe861('0x1b')](_0x1daa74);}return null;};}function patchUpdates(_0x464818){return function(_0x1f823e){try{jsonpatch[_0xe861('0x22')](_0x1f823e,_0x464818,!![]);}catch(_0x9a9c8d){return BPromise[_0xe861('0x23')](_0x9a9c8d);}return _0x1f823e[_0xe861('0x24')]();};}function saveUpdates(_0x1dc860,_0x334c63){return function(_0x3cf8c8){if(_0x3cf8c8){return _0x3cf8c8[_0xe861('0x25')](_0x1dc860)[_0xe861('0x26')](function(_0x3a9c3a){return _0x3a9c3a;});}return null;};}function removeEntity(_0x5ed677,_0x3949ab){return function(_0x24836e){if(_0x24836e){return _0x24836e[_0xe861('0x27')]()[_0xe861('0x26')](function(){_0x5ed677[_0xe861('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cc31d,_0x2c93ee){return function(_0x10adbe){if(!_0x10adbe){_0x3cc31d[_0xe861('0x18')](0x194);}return _0x10adbe;};}function handleError(_0x15958c,_0x443be5){_0x443be5=_0x443be5||0x1f4;return function(_0x409cd7){logger[_0xe861('0x28')](_0x409cd7[_0xe861('0x29')]);if(_0x409cd7['name']){delete _0x409cd7['name'];}_0x15958c['status'](_0x443be5)['send'](_0x409cd7);};}exports[_0xe861('0x2a')]=function(_0x2af0b0,_0x45b5f1){var _0x1b4b73={},_0x394ded={},_0x5e952e={'count':0x0,'rows':[]};var _0x37fe30=_[_0xe861('0x2b')](db[_0xe861('0x2c')]['rawAttributes'],function(_0x5b0e7b){return{'name':_0x5b0e7b[_0xe861('0x2d')],'type':_0x5b0e7b[_0xe861('0x2e')][_0xe861('0x2f')]};});_0x394ded[_0xe861('0x30')]=_[_0xe861('0x31')](_[_0xe861('0x2b')](_0x37fe30,_0xe861('0x32')),[_0xe861('0x32')]);_0x394ded[_0xe861('0x33')]=_[_0xe861('0x34')](_0x2af0b0[_0xe861('0x33')]);_0x394ded[_0xe861('0x35')]=_[_0xe861('0x36')](_0x394ded[_0xe861('0x30')],_0x394ded['query']);_0x1b4b73[_0xe861('0x37')]=_[_0xe861('0x36')](_0x394ded['model'],qs[_0xe861('0x38')](_0x2af0b0[_0xe861('0x33')][_0xe861('0x38')]));_0x1b4b73[_0xe861('0x37')]=_0x1b4b73[_0xe861('0x37')]['length']?_0x1b4b73['attributes']:_0x394ded[_0xe861('0x30')];if(!_0x2af0b0['query']['hasOwnProperty'](_0xe861('0x39'))){_0x1b4b73[_0xe861('0x1e')]=qs[_0xe861('0x1e')](_0x2af0b0[_0xe861('0x33')]['limit']);_0x1b4b73[_0xe861('0x1c')]=qs['offset'](_0x2af0b0[_0xe861('0x33')][_0xe861('0x1c')]);}_0x1b4b73[_0xe861('0x3a')]=qs['sort'](_0x2af0b0['query'][_0xe861('0x3b')]);_0x1b4b73[_0xe861('0x3c')]=qs[_0xe861('0x35')](_['pick'](_0x2af0b0[_0xe861('0x33')],_0x394ded['filters']),_0x37fe30);if(_0x2af0b0[_0xe861('0x33')]['filter']){_0x1b4b73['where']=_['merge'](_0x1b4b73[_0xe861('0x3c')],{'$or':_[_0xe861('0x2b')](_0x37fe30,function(_0x54db0d){if(_0x54db0d[_0xe861('0x2e')]!==_0xe861('0x3d')){var _0x4ed2c5={};_0x4ed2c5[_0x54db0d[_0xe861('0x32')]]={'$like':'%'+_0x2af0b0[_0xe861('0x33')][_0xe861('0x3e')]+'%'};return _0x4ed2c5;}})});}_0x1b4b73=_[_0xe861('0x3f')]({},_0x1b4b73,_0x2af0b0[_0xe861('0x40')]);var _0x1310de={'where':_0x1b4b73['where']};return db[_0xe861('0x2c')][_0xe861('0x1f')](_0x1310de)[_0xe861('0x26')](function(_0x14ab9a){_0x5e952e[_0xe861('0x1f')]=_0x14ab9a;if(_0x2af0b0['query'][_0xe861('0x41')]){_0x1b4b73[_0xe861('0x42')]=[{'all':!![]}];}return db[_0xe861('0x2c')][_0xe861('0x43')](_0x1b4b73);})['then'](function(_0x47fc83){_0x5e952e[_0xe861('0x44')]=_0x47fc83;return _0x5e952e;})[_0xe861('0x26')](respondWithFilteredResult(_0x45b5f1,_0x1b4b73))[_0xe861('0x45')](handleError(_0x45b5f1,null));};exports['show']=function(_0x42de01,_0x8ebbf7){var _0x81166={'raw':!![],'where':{'id':_0x42de01['params']['id']}},_0xcd5356={};_0xcd5356['model']=_[_0xe861('0x34')](db[_0xe861('0x2c')][_0xe861('0x46')]);_0xcd5356[_0xe861('0x33')]=_[_0xe861('0x34')](_0x42de01[_0xe861('0x33')]);_0xcd5356[_0xe861('0x35')]=_[_0xe861('0x36')](_0xcd5356['model'],_0xcd5356[_0xe861('0x33')]);_0x81166[_0xe861('0x37')]=_[_0xe861('0x36')](_0xcd5356['model'],qs[_0xe861('0x38')](_0x42de01[_0xe861('0x33')][_0xe861('0x38')]));_0x81166['attributes']=_0x81166['attributes'][_0xe861('0x47')]?_0x81166[_0xe861('0x37')]:_0xcd5356[_0xe861('0x30')];if(_0x42de01[_0xe861('0x33')]['includeAll']){_0x81166[_0xe861('0x42')]=[{'all':!![]}];}_0x81166=_[_0xe861('0x3f')]({},_0x81166,_0x42de01[_0xe861('0x40')]);return db[_0xe861('0x2c')][_0xe861('0x48')](_0x81166)[_0xe861('0x26')](handleEntityNotFound(_0x8ebbf7,null))['then'](respondWithResult(_0x8ebbf7,null))[_0xe861('0x45')](handleError(_0x8ebbf7,null));};exports['create']=function(_0x681a4e,_0x1d0a67){return db[_0xe861('0x2c')]['create'](_0x681a4e[_0xe861('0x49')],{})[_0xe861('0x26')](respondWithResult(_0x1d0a67,0xc9))[_0xe861('0x45')](handleError(_0x1d0a67,null));};exports[_0xe861('0x25')]=function(_0x240138,_0x2655a8){if(_0x240138['body']['id']){delete _0x240138['body']['id'];}return db['VoiceMailMessage'][_0xe861('0x48')]({'where':{'id':_0x240138[_0xe861('0x4a')]['id']}})[_0xe861('0x26')](handleEntityNotFound(_0x2655a8,null))[_0xe861('0x26')](saveUpdates(_0x240138[_0xe861('0x49')],null))['then'](respondWithResult(_0x2655a8,null))[_0xe861('0x45')](handleError(_0x2655a8,null));};exports[_0xe861('0x27')]=function(_0x498d88,_0x5cf6dc){return db[_0xe861('0x2c')][_0xe861('0x48')]({'where':{'id':_0x498d88[_0xe861('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cf6dc,null))[_0xe861('0x26')](removeEntity(_0x5cf6dc,null))[_0xe861('0x45')](handleError(_0x5cf6dc,null));};exports[_0xe861('0x4b')]=function(_0x21bd3a,_0x118446,_0x1d3fab){return db[_0xe861('0x2c')][_0xe861('0x48')]({'where':{'id':_0x21bd3a[_0xe861('0x4a')]['id']},'attributes':['id',_0xe861('0x4c'),_0xe861('0x4d')]})['then'](handleEntityNotFound(_0x118446,null))[_0xe861('0x26')](function(_0x169a66){if(_0x169a66){if(!_0x169a66[_0xe861('0x4c')]){throw new db[(_0xe861('0x4e'))]['ValidationError'](_0xe861('0x4f'));}var _0x516a80={'Content-Type':'audio/wav','Content-Disposition':_0xe861('0x50')};if(_0x169a66[_0xe861('0x4d')]){_0x516a80[_0xe861('0x51')]='attachment;\x20filename=\x22'+_0x169a66[_0xe861('0x4d')]+_0xe861('0x52');}_0x118446['set'](_0x516a80);return _0x118446[_0xe861('0x53')](new Buffer(_0x169a66[_0xe861('0x4c')]));}})[_0xe861('0x45')](handleError(_0x118446,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 4a23a86..2aa54e5 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 _0xd820=['dir','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','VoiceMailMessage'];(function(_0x1e9f16,_0x5c6259){var _0x2335a6=function(_0x2de7f){while(--_0x2de7f){_0x1e9f16['push'](_0x1e9f16['shift']());}};_0x2335a6(++_0x5c6259);}(_0xd820,0x71));var _0x0d82=function(_0xc43657,_0x17b2d8){_0xc43657=_0xc43657-0x0;var _0x6eca29=_0xd820[_0xc43657];return _0x6eca29;};'use strict';var _=require(_0x0d82('0x0'));var util=require(_0x0d82('0x1'));var logger=require(_0x0d82('0x2'))(_0x0d82('0x3'));var moment=require(_0x0d82('0x4'));var BPromise=require(_0x0d82('0x5'));var rp=require(_0x0d82('0x6'));var fs=require('fs');var path=require(_0x0d82('0x7'));var rimraf=require(_0x0d82('0x8'));var config=require(_0x0d82('0x9'));var attributes=require(_0x0d82('0xa'));module[_0x0d82('0xb')]=function(_0x48fd35,_0x355e1f){return _0x48fd35['define'](_0x0d82('0xc'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x0d82('0xd'),'fields':[_0x0d82('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0xc627=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','dir','util'];(function(_0x89654c,_0x100d9a){var _0x2e689e=function(_0x4a5eb8){while(--_0x4a5eb8){_0x89654c['push'](_0x89654c['shift']());}};_0x2e689e(++_0x100d9a);}(_0xc627,0x1af));var _0x7c62=function(_0x5aea41,_0x5a72bf){_0x5aea41=_0x5aea41-0x0;var _0x12b4b5=_0xc627[_0x5aea41];return _0x12b4b5;};'use strict';var _=require('lodash');var util=require(_0x7c62('0x0'));var logger=require(_0x7c62('0x1'))(_0x7c62('0x2'));var moment=require('moment');var BPromise=require(_0x7c62('0x3'));var rp=require(_0x7c62('0x4'));var fs=require('fs');var path=require(_0x7c62('0x5'));var rimraf=require(_0x7c62('0x6'));var config=require(_0x7c62('0x7'));var attributes=require(_0x7c62('0x8'));module[_0x7c62('0x9')]=function(_0x51ef87,_0x89138e){return _0x51ef87[_0x7c62('0xa')]('VoiceMailMessage',attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x7c62('0xb'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index d5aa035..e519f83 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 _0xe8c1=['info','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceMailMessage,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','http'];(function(_0x1265ed,_0x4b85e8){var _0x5ac459=function(_0xf0c114){while(--_0xf0c114){_0x1265ed['push'](_0x1265ed['shift']());}};_0x5ac459(++_0x4b85e8);}(_0xe8c1,0x187));var _0x1e8c=function(_0x30182f,_0x30ce41){_0x30182f=_0x30182f-0x0;var _0x5207db=_0xe8c1[_0x30182f];return _0x5207db;};'use strict';var _=require(_0x1e8c('0x0'));var util=require(_0x1e8c('0x1'));var moment=require('moment');var BPromise=require(_0x1e8c('0x2'));var rs=require(_0x1e8c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1e8c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1e8c('0x5'));var config=require(_0x1e8c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1e8c('0x7')][_0x1e8c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2c8dfe,_0x2eb099,_0x36984c){return new BPromise(function(_0x10959,_0x56c033){return client['request'](_0x2c8dfe,_0x36984c)['then'](function(_0x25fc83){logger[_0x1e8c('0x9')]('VoiceMailMessage,\x20%s,\x20%s',_0x2eb099,'request\x20sent');logger[_0x1e8c('0xa')](_0x1e8c('0xb'),_0x2eb099,_0x1e8c('0xc'),JSON[_0x1e8c('0xd')](_0x25fc83));if(_0x25fc83[_0x1e8c('0xe')]){if(_0x25fc83[_0x1e8c('0xe')][_0x1e8c('0xf')]===0x1f4){logger['error'](_0x1e8c('0x10'),_0x2eb099,_0x25fc83[_0x1e8c('0xe')][_0x1e8c('0x11')]);return _0x56c033(_0x25fc83[_0x1e8c('0xe')]['message']);}logger[_0x1e8c('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0x2eb099,_0x25fc83[_0x1e8c('0xe')]['message']);return _0x10959(_0x25fc83[_0x1e8c('0xe')][_0x1e8c('0x11')]);}else{logger[_0x1e8c('0x9')]('VoiceMailMessage,\x20%s,\x20%s',_0x2eb099,'request\x20sent');_0x10959(_0x25fc83[_0x1e8c('0x12')][_0x1e8c('0x11')]);}})[_0x1e8c('0x13')](function(_0x1c5374){logger[_0x1e8c('0xe')](_0x1e8c('0x10'),_0x2eb099,_0x1c5374);_0x56c033(_0x1c5374);});});} \ No newline at end of file +var _0x4157=['VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x576e2b,_0x328953){var _0x46461a=function(_0xce4d9e){while(--_0xce4d9e){_0x576e2b['push'](_0x576e2b['shift']());}};_0x46461a(++_0x328953);}(_0x4157,0x1c0));var _0x7415=function(_0x1eb00c,_0x210ecc){_0x1eb00c=_0x1eb00c-0x0;var _0x5e0a49=_0x4157[_0x1eb00c];return _0x5e0a49;};'use strict';var _=require('lodash');var util=require(_0x7415('0x0'));var moment=require(_0x7415('0x1'));var BPromise=require(_0x7415('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7415('0x3'))['db'];var utils=require(_0x7415('0x4'));var logger=require('../../config/logger')(_0x7415('0x5'));var config=require(_0x7415('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7415('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5456f8,_0x50d735,_0x3d5cd){return new BPromise(function(_0x470060,_0x33c216){return client[_0x7415('0x8')](_0x5456f8,_0x3d5cd)[_0x7415('0x9')](function(_0x1153b4){logger[_0x7415('0xa')](_0x7415('0xb'),_0x50d735,_0x7415('0xc'));logger[_0x7415('0xd')](_0x7415('0xe'),_0x50d735,_0x7415('0xc'),JSON[_0x7415('0xf')](_0x1153b4));if(_0x1153b4['error']){if(_0x1153b4[_0x7415('0x10')][_0x7415('0x11')]===0x1f4){logger[_0x7415('0x10')](_0x7415('0xb'),_0x50d735,_0x1153b4[_0x7415('0x10')][_0x7415('0x12')]);return _0x33c216(_0x1153b4[_0x7415('0x10')][_0x7415('0x12')]);}logger['error'](_0x7415('0xb'),_0x50d735,_0x1153b4['error']['message']);return _0x470060(_0x1153b4[_0x7415('0x10')][_0x7415('0x12')]);}else{logger[_0x7415('0xa')]('VoiceMailMessage,\x20%s,\x20%s',_0x50d735,_0x7415('0xc'));_0x470060(_0x1153b4[_0x7415('0x13')][_0x7415('0x12')]);}})[_0x7415('0x14')](function(_0x2908d8){logger[_0x7415('0x10')](_0x7415('0xb'),_0x50d735,_0x2908d8);_0x33c216(_0x2908d8);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index e4a5062..7a87525 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 _0x6925=['get','isAuthenticated','/:id/sounds','getSounds','create','post','addSound','put','/:id','update','/:id/sounds/:id2','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller'];(function(_0x1added,_0x3782c7){var _0x2ba01d=function(_0x112bb9){while(--_0x112bb9){_0x1added['push'](_0x1added['shift']());}};_0x2ba01d(++_0x3782c7);}(_0x6925,0x19b));var _0x5692=function(_0x2ad3e6,_0x123f2f){_0x2ad3e6=_0x2ad3e6-0x0;var _0xf2f5e5=_0x6925[_0x2ad3e6];return _0xf2f5e5;};'use strict';var multer=require(_0x5692('0x0'));var util=require(_0x5692('0x1'));var path=require(_0x5692('0x2'));var timeout=require('connect-timeout');var express=require(_0x5692('0x3'));var router=express[_0x5692('0x4')]();var fs_extra=require(_0x5692('0x5'));var auth=require(_0x5692('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5692('0x7'));var controller=require(_0x5692('0x8'));router[_0x5692('0x9')]('/',auth[_0x5692('0xa')](),controller['index']);router[_0x5692('0x9')]('/:id',auth[_0x5692('0xa')](),controller['show']);router[_0x5692('0x9')](_0x5692('0xb'),auth['isAuthenticated'](),controller[_0x5692('0xc')]);router['post']('/',auth[_0x5692('0xa')](),controller[_0x5692('0xd')]);router[_0x5692('0xe')](_0x5692('0xb'),auth[_0x5692('0xa')](),controller[_0x5692('0xf')]);router[_0x5692('0x10')](_0x5692('0x11'),auth['isAuthenticated'](),controller[_0x5692('0x12')]);router['delete']('/:id',auth[_0x5692('0xa')](),controller['destroy']);router['delete'](_0x5692('0x13'),auth[_0x5692('0xa')](),controller['removeSound']);module[_0x5692('0x14')]=router; \ No newline at end of file +var _0xc7c6=['./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','post','addSound','put','update','destroy','delete','/:id/sounds/:id2','removeSound','exports','multer','util','Router','fs-extra','../../config/environment'];(function(_0x935478,_0x7f6768){var _0x3972d9=function(_0x176d5d){while(--_0x176d5d){_0x935478['push'](_0x935478['shift']());}};_0x3972d9(++_0x7f6768);}(_0xc7c6,0xed));var _0x6c7c=function(_0x3405ae,_0x4a92db){_0x3405ae=_0x3405ae-0x0;var _0x756295=_0xc7c6[_0x3405ae];return _0x756295;};'use strict';var multer=require(_0x6c7c('0x0'));var util=require(_0x6c7c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6c7c('0x2')]();var fs_extra=require(_0x6c7c('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6c7c('0x4'));var controller=require(_0x6c7c('0x5'));router[_0x6c7c('0x6')]('/',auth[_0x6c7c('0x7')](),controller[_0x6c7c('0x8')]);router['get'](_0x6c7c('0x9'),auth[_0x6c7c('0x7')](),controller[_0x6c7c('0xa')]);router[_0x6c7c('0x6')](_0x6c7c('0xb'),auth[_0x6c7c('0x7')](),controller[_0x6c7c('0xc')]);router[_0x6c7c('0xd')]('/',auth[_0x6c7c('0x7')](),controller['create']);router['post'](_0x6c7c('0xb'),auth[_0x6c7c('0x7')](),controller[_0x6c7c('0xe')]);router[_0x6c7c('0xf')](_0x6c7c('0x9'),auth[_0x6c7c('0x7')](),controller[_0x6c7c('0x10')]);router['delete'](_0x6c7c('0x9'),auth[_0x6c7c('0x7')](),controller[_0x6c7c('0x11')]);router[_0x6c7c('0x12')](_0x6c7c('0x13'),auth[_0x6c7c('0x7')](),controller[_0x6c7c('0x14')]);module[_0x6c7c('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index d10beaa..c8d7788 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 _0x5461=['name','mp3nb','quietmp3nb','quietmp3','mp3','alpha','BOOLEAN','sequelize','exports','STRING'];(function(_0x200aa5,_0x197802){var _0x458200=function(_0x594959){while(--_0x594959){_0x200aa5['push'](_0x200aa5['shift']());}};_0x458200(++_0x197802);}(_0x5461,0x1bf));var _0x1546=function(_0x25a42a,_0x3d489b){_0x25a42a=_0x25a42a-0x0;var _0x1129b1=_0x5461[_0x25a42a];return _0x1129b1;};'use strict';var Sequelize=require(_0x1546('0x0'));module[_0x1546('0x1')]={'name':{'type':Sequelize[_0x1546('0x2')],'allowNull':![],'unique':_0x1546('0x3')},'mode':{'type':Sequelize['ENUM']('custom','files',_0x1546('0x4'),_0x1546('0x5'),_0x1546('0x6'),_0x1546('0x7')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x1546('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x1546('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x1546('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x1546('0x2')],'allowNull':!![],'defaultValue':_0x1546('0x8')},'format':{'type':Sequelize[_0x1546('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x1546('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4cba=['files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','STRING','name','ENUM','custom'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0x4cba,0x1c2));var _0xa4cb=function(_0x3e8e56,_0x307fa6){_0x3e8e56=_0x3e8e56-0x0;var _0x39ce34=_0x4cba[_0x3e8e56];return _0x39ce34;};'use strict';var Sequelize=require(_0xa4cb('0x0'));module['exports']={'name':{'type':Sequelize[_0xa4cb('0x1')],'allowNull':![],'unique':_0xa4cb('0x2')},'mode':{'type':Sequelize[_0xa4cb('0x3')](_0xa4cb('0x4'),_0xa4cb('0x5'),_0xa4cb('0x6'),_0xa4cb('0x7'),_0xa4cb('0x8'),_0xa4cb('0x9')),'allowNull':!![],'defaultValue':_0xa4cb('0x5')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0xa4cb('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0xa4cb('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0xa4cb('0x1')],'allowNull':!![],'defaultValue':_0xa4cb('0xa')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0xa4cb('0xb')},'defaultEntry':{'type':Sequelize[_0xa4cb('0xc')],'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 f2dff29..82e2d3b 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 _0x5973=['MusicOnHolds','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','readdirSync','forEach','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','createdAt','server/files/sounds/converted','format','save_name','extname','%s.%s','converted_format','symlinkSync','removeSound','id2','getSounds','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','map','VoiceMusicOnHold','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','rawAttributes','find','params','create','transaction','body','mode','directory','join','root','server/files/moh','files','mkdirSync','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x5973,0x1cb));var _0x3597=function(_0xe1f502,_0x4fcee8){_0xe1f502=_0xe1f502-0x0;var _0x5baa21=_0x5973[_0xe1f502];return _0x5baa21;};'use strict';var emlformat=require(_0x3597('0x0'));var rimraf=require(_0x3597('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3597('0x2'));var rp=require('request-promise');var moment=require(_0x3597('0x3'));var BPromise=require(_0x3597('0x4'));var Mustache=require('mustache');var util=require(_0x3597('0x5'));var path=require(_0x3597('0x6'));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('lodash');var squel=require(_0x3597('0x7'));var crypto=require(_0x3597('0x8'));var jsforce=require(_0x3597('0x9'));var deskjs=require(_0x3597('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3597('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3597('0xc'));var hardwareService=require(_0x3597('0xd'));var logger=require('../../config/logger')(_0x3597('0xe'));var utils=require(_0x3597('0xf'));var config=require(_0x3597('0x10'));var licenseUtil=require(_0x3597('0x11'));var db=require(_0x3597('0x12'))['db'];function respondWithStatusCode(_0x119b70,_0xb24d66){_0xb24d66=_0xb24d66||0xcc;return function(_0x44c23e){if(_0x44c23e){return _0x119b70[_0x3597('0x13')](_0xb24d66);}return _0x119b70[_0x3597('0x14')](_0xb24d66)['end']();};}function respondWithResult(_0x35a712,_0x312f0c){_0x312f0c=_0x312f0c||0xc8;return function(_0x204c26){if(_0x204c26){return _0x35a712['status'](_0x312f0c)[_0x3597('0x15')](_0x204c26);}};}function respondWithFilteredResult(_0x554bb0,_0x16a5fe){return function(_0x5f2b49){if(_0x5f2b49){var _0x3aa2e7=typeof _0x16a5fe['offset']===_0x3597('0x16')&&typeof _0x16a5fe['limit']===_0x3597('0x16');var _0x4a7736=_0x5f2b49[_0x3597('0x17')];var _0x42428a=_0x3aa2e7?0x0:_0x16a5fe[_0x3597('0x18')];var _0x431605=_0x3aa2e7?_0x5f2b49[_0x3597('0x17')]:_0x16a5fe[_0x3597('0x18')]+_0x16a5fe[_0x3597('0x19')];var _0x1de274;if(_0x431605>=_0x4a7736){_0x431605=_0x4a7736;_0x1de274=0xc8;}else{_0x1de274=0xce;}_0x554bb0['status'](_0x1de274);return _0x554bb0[_0x3597('0x1a')](_0x3597('0x1b'),_0x42428a+'-'+_0x431605+'/'+_0x4a7736)[_0x3597('0x15')](_0x5f2b49);}return null;};}function patchUpdates(_0x4e8fa3){return function(_0x54d53f){try{jsonpatch[_0x3597('0x1c')](_0x54d53f,_0x4e8fa3,!![]);}catch(_0x21753a){return BPromise[_0x3597('0x1d')](_0x21753a);}return _0x54d53f[_0x3597('0x1e')]();};}function saveUpdates(_0x46435c,_0x4a0c20){return function(_0x31a25a){if(_0x31a25a){return _0x31a25a[_0x3597('0x1f')](_0x46435c)[_0x3597('0x20')](function(_0x1b9697){return _0x1b9697;});}return null;};}function removeEntity(_0x5a62bd,_0x50e40c){return function(_0x181bc3){if(_0x181bc3){return _0x181bc3[_0x3597('0x21')]()[_0x3597('0x20')](function(){var _0x6ba001=_0x181bc3[_0x3597('0x22')]({'plain':!![]});var _0x9e73b5='MusicOnHolds';return db[_0x3597('0x23')][_0x3597('0x21')]({'where':{'type':_0x9e73b5,'resourceId':_0x6ba001['id']}})[_0x3597('0x20')](function(){return _0x181bc3;});})[_0x3597('0x20')](function(){_0x5a62bd['status'](0xcc)[_0x3597('0x24')]();});}};}function handleEntityNotFound(_0xcd04cb,_0x4a3d8d){return function(_0x13b367){if(!_0x13b367){_0xcd04cb['sendStatus'](0x194);}return _0x13b367;};}function handleError(_0x3474c0,_0x1a0782){_0x1a0782=_0x1a0782||0x1f4;return function(_0x51e836){logger[_0x3597('0x25')](_0x51e836[_0x3597('0x26')]);if(_0x51e836[_0x3597('0x27')]){delete _0x51e836[_0x3597('0x27')];}_0x3474c0[_0x3597('0x14')](_0x1a0782)[_0x3597('0x28')](_0x51e836);};}exports[_0x3597('0x29')]=function(_0x488048,_0x3ee925){var _0x323d6c={},_0x23d70c={},_0x2ce8={'count':0x0,'rows':[]};var _0x9fef64=_[_0x3597('0x2a')](db[_0x3597('0x2b')]['rawAttributes'],function(_0x68255e){return{'name':_0x68255e[_0x3597('0x2c')],'type':_0x68255e[_0x3597('0x2d')][_0x3597('0x2e')]};});_0x23d70c['model']=_[_0x3597('0x2a')](_0x9fef64,_0x3597('0x27'));_0x23d70c['query']=_[_0x3597('0x2f')](_0x488048[_0x3597('0x30')]);_0x23d70c[_0x3597('0x31')]=_[_0x3597('0x32')](_0x23d70c[_0x3597('0x33')],_0x23d70c[_0x3597('0x30')]);_0x323d6c[_0x3597('0x34')]=_[_0x3597('0x32')](_0x23d70c['model'],qs[_0x3597('0x35')](_0x488048[_0x3597('0x30')][_0x3597('0x35')]));_0x323d6c[_0x3597('0x34')]=_0x323d6c['attributes'][_0x3597('0x36')]?_0x323d6c[_0x3597('0x34')]:_0x23d70c[_0x3597('0x33')];if(!_0x488048[_0x3597('0x30')]['hasOwnProperty'](_0x3597('0x37'))){_0x323d6c[_0x3597('0x19')]=qs[_0x3597('0x19')](_0x488048['query'][_0x3597('0x19')]);_0x323d6c[_0x3597('0x18')]=qs['offset'](_0x488048[_0x3597('0x30')][_0x3597('0x18')]);}_0x323d6c[_0x3597('0x38')]=qs[_0x3597('0x39')](_0x488048['query'][_0x3597('0x39')]);delete _0x488048[_0x3597('0x30')][_0x3597('0x39')];_0x323d6c[_0x3597('0x3a')]=qs[_0x3597('0x31')](_[_0x3597('0x3b')](_0x488048[_0x3597('0x30')],_0x23d70c['filters']),_0x9fef64);if(_0x488048[_0x3597('0x30')][_0x3597('0x3c')]){_0x323d6c[_0x3597('0x3a')]=_[_0x3597('0x3d')](_0x323d6c['where'],{'$or':_['map'](_0x9fef64,function(_0x5794a2){if(_0x5794a2[_0x3597('0x2d')]!==_0x3597('0x3e')){var _0x3bb7c0={};_0x3bb7c0[_0x5794a2[_0x3597('0x27')]]={'$like':'%'+_0x488048['query'][_0x3597('0x3c')]+'%'};return _0x3bb7c0;}})});}_0x323d6c=_['merge']({},_0x323d6c,_0x488048[_0x3597('0x3f')]);var _0x5d5bb0={'where':_0x323d6c[_0x3597('0x3a')]};return db['VoiceMusicOnHold'][_0x3597('0x17')](_0x5d5bb0)[_0x3597('0x20')](function(_0x28606b){_0x2ce8[_0x3597('0x17')]=_0x28606b;if(_0x488048[_0x3597('0x30')][_0x3597('0x40')]){_0x323d6c[_0x3597('0x41')]=[{'all':!![]}];}return db[_0x3597('0x2b')][_0x3597('0x42')](_0x323d6c);})[_0x3597('0x20')](function(_0x427cc3){_0x2ce8[_0x3597('0x43')]=_0x427cc3;return _0x2ce8;})[_0x3597('0x20')](respondWithFilteredResult(_0x3ee925,_0x323d6c))[_0x3597('0x44')](handleError(_0x3ee925,null));};exports['show']=function(_0x101e3d,_0x53839b){var _0x49ad8a={'raw':![],'where':{'id':_0x101e3d['params']['id']}},_0x154214={};_0x154214[_0x3597('0x33')]=_['keys'](db[_0x3597('0x2b')][_0x3597('0x45')]);_0x154214[_0x3597('0x30')]=_['keys'](_0x101e3d[_0x3597('0x30')]);_0x154214[_0x3597('0x31')]=_['intersection'](_0x154214['model'],_0x154214[_0x3597('0x30')]);_0x49ad8a[_0x3597('0x34')]=_['intersection'](_0x154214[_0x3597('0x33')],qs['fields'](_0x101e3d[_0x3597('0x30')][_0x3597('0x35')]));_0x49ad8a[_0x3597('0x34')]=_0x49ad8a[_0x3597('0x34')][_0x3597('0x36')]?_0x49ad8a[_0x3597('0x34')]:_0x154214[_0x3597('0x33')];if(_0x101e3d['query'][_0x3597('0x40')]){_0x49ad8a['include']=[{'all':!![]}];}_0x49ad8a=_[_0x3597('0x3d')]({},_0x49ad8a,_0x101e3d[_0x3597('0x3f')]);return db[_0x3597('0x2b')][_0x3597('0x46')](_0x49ad8a)[_0x3597('0x20')](handleEntityNotFound(_0x53839b,null))[_0x3597('0x20')](respondWithResult(_0x53839b,null))['catch'](handleError(_0x53839b,null));};exports[_0x3597('0x1f')]=function(_0xfa6f34,_0x4b8a9d){if(_0xfa6f34['body']['id']){delete _0xfa6f34['body']['id'];}return db[_0x3597('0x2b')][_0x3597('0x46')]({'where':{'id':_0xfa6f34[_0x3597('0x47')]['id']}})[_0x3597('0x20')](handleEntityNotFound(_0x4b8a9d,null))[_0x3597('0x20')](saveUpdates(_0xfa6f34['body'],null))[_0x3597('0x20')](respondWithResult(_0x4b8a9d,null))[_0x3597('0x44')](handleError(_0x4b8a9d,null));};exports[_0x3597('0x48')]=function(_0x3d4ea3,_0x17be25,_0x57986c){return db['sequelize'][_0x3597('0x49')](function(_0x45d3bd){if(_0x3d4ea3[_0x3597('0x4a')][_0x3597('0x4b')]==='files'){_0x3d4ea3[_0x3597('0x4a')][_0x3597('0x4c')]=path[_0x3597('0x4d')](config[_0x3597('0x4e')],_0x3597('0x4f'),_0x3d4ea3[_0x3597('0x4a')]['name']);}return db[_0x3597('0x2b')][_0x3597('0x48')](_0x3d4ea3[_0x3597('0x4a')],{'transaction':_0x45d3bd})[_0x3597('0x20')](function(_0x1d76c1){if(_0x3d4ea3[_0x3597('0x4a')][_0x3597('0x4b')]===_0x3597('0x50')){fs[_0x3597('0x51')](_0x1d76c1['directory'],parseInt('0777',0x8));}var _0x3e3e42=_0x3d4ea3[_0x3597('0x52')][_0x3597('0x22')]({'plain':!![]});if(!_0x3e3e42)throw new Error(_0x3597('0x53'));if(_0x3e3e42[_0x3597('0x54')]===_0x3597('0x52')){var _0x26e00f=_0x1d76c1['get']({'plain':!![]});return db[_0x3597('0x55')][_0x3597('0x46')]({'where':{'name':_0x3597('0x56'),'userProfileId':_0x3e3e42['userProfileId']},'raw':!![]})[_0x3597('0x20')](function(_0x4ade9e){if(_0x4ade9e&&_0x4ade9e['autoAssociation']===0x0){return db[_0x3597('0x23')]['create']({'name':_0x26e00f[_0x3597('0x27')],'resourceId':_0x26e00f['id'],'type':_0x4ade9e[_0x3597('0x27')],'sectionId':_0x4ade9e['id']},{})[_0x3597('0x20')](function(){return _0x1d76c1;});}else{return _0x1d76c1;}})[_0x3597('0x44')](function(_0x340731){logger['error'](_0x3597('0x57'),_0x340731);});}return _0x1d76c1;});})[_0x3597('0x20')](respondWithResult(_0x17be25,0xc9))[_0x3597('0x44')](handleError(_0x17be25,null));};exports['destroy']=function(_0x1cfc6e,_0x292ee2,_0x299648){var _0x10bcbb;return db[_0x3597('0x2b')]['find']({'where':{'id':_0x1cfc6e['params']['id']}})[_0x3597('0x20')](function(_0x1c518f){if(_0x1c518f){return db[_0x3597('0x58')][_0x3597('0x49')](function(_0x390c4e){return _0x1c518f[_0x3597('0x21')]({'transaction':_0x390c4e,'raw':!![]})['then'](function(_0x16f7e2){if(_0x16f7e2[_0x3597('0x4c')]){fs[_0x3597('0x59')](_0x16f7e2[_0x3597('0x4c')])[_0x3597('0x5a')](function(_0x8607d9){fs['unlinkSync'](path[_0x3597('0x4d')](_0x16f7e2[_0x3597('0x4c')],_0x8607d9));});fs[_0x3597('0x5b')](_0x16f7e2['directory']);}return _0x16f7e2;});})['catch'](function(_0x4a10b4){throw new db[(_0x3597('0x5c'))][(_0x3597('0x5d'))](_0x4a10b4[_0x3597('0x5e')]);});}})[_0x3597('0x20')](handleEntityNotFound(_0x292ee2,null))[_0x3597('0x20')](removeEntity(_0x292ee2,null))['catch'](handleError(_0x292ee2,null));};exports['addSound']=function(_0x596815,_0x3cb8e0,_0x406c20){return db[_0x3597('0x58')][_0x3597('0x49')](function(_0x58d6a9){var _0x7a73f8;return db[_0x3597('0x2b')]['find']({'where':{'id':_0x596815[_0x3597('0x47')]['id']}})[_0x3597('0x20')](function(_0x21b651){if(_0x21b651){_0x7a73f8=_0x21b651;return _0x21b651[_0x3597('0x5f')](_0x596815['body']['id'],{'transaction':_0x58d6a9});}})['then'](function(_0x445b40){if(_0x445b40){return db[_0x3597('0x60')][_0x3597('0x61')]({'where':{'id':_0x596815[_0x3597('0x4a')]['id']},'attributes':['id',_0x3597('0x27'),'save_name','converted_format',_0x3597('0x62')],'raw':!![]});}})[_0x3597('0x20')](function(_0x36ba9f){if(_0x36ba9f){var _0x2374ef=path[_0x3597('0x4d')](config[_0x3597('0x4e')],_0x3597('0x63'),util[_0x3597('0x64')]('%s.%s',path['basename'](_0x36ba9f[_0x3597('0x65')],path[_0x3597('0x66')](_0x36ba9f['save_name'])),_0x36ba9f['converted_format']));var _0x2c7c62=path[_0x3597('0x4d')](config['root'],_0x3597('0x4f'),_0x7a73f8[_0x3597('0x27')],util['format'](_0x3597('0x67'),_0x36ba9f['name'],_0x36ba9f[_0x3597('0x68')]));fs[_0x3597('0x69')](_0x2374ef,_0x2c7c62);return _0x36ba9f;}})[_0x3597('0x44')](function(_0x587dc9){throw new db['Sequelize'][(_0x3597('0x5d'))](_0x587dc9['message']);});})['then'](handleEntityNotFound(_0x3cb8e0,null))['then'](respondWithResult(_0x3cb8e0,0xc9))[_0x3597('0x44')](handleError(_0x3cb8e0,null));};exports[_0x3597('0x6a')]=function(_0x390826,_0x220ae6,_0x2bfb5f){return db[_0x3597('0x58')][_0x3597('0x49')](function(_0x42a445){var _0x47ce1f;return db[_0x3597('0x2b')][_0x3597('0x61')]({'where':{'id':_0x390826[_0x3597('0x47')]['id']}})[_0x3597('0x20')](handleEntityNotFound(_0x220ae6,null))[_0x3597('0x20')](function(_0x482285){if(_0x482285){_0x47ce1f=_0x482285;return _0x482285[_0x3597('0x6a')](_0x390826['params']['id2']);}})['then'](function(_0xc541ca){if(_0xc541ca){return db[_0x3597('0x60')][_0x3597('0x61')]({'where':{'id':_0x390826[_0x3597('0x47')][_0x3597('0x6b')]},'attributes':['id',_0x3597('0x27'),_0x3597('0x65'),_0x3597('0x68'),'createdAt'],'raw':!![]});}})[_0x3597('0x20')](function(_0x45e46a){if(_0x45e46a){fs['unlinkSync'](path['join'](_0x47ce1f[_0x3597('0x4c')],util[_0x3597('0x64')](_0x3597('0x67'),_0x45e46a['name'],_0x45e46a['converted_format'])));return _0x45e46a;}})['catch'](function(_0x224c06){throw new db[(_0x3597('0x5c'))][(_0x3597('0x5d'))](_0x224c06[_0x3597('0x5e')]);});})[_0x3597('0x20')](handleEntityNotFound(_0x220ae6,null))[_0x3597('0x20')](respondWithStatusCode(_0x220ae6,0xcc))['catch'](handleError(_0x220ae6,null));};exports['getSounds']=function(_0x23ec8d,_0x5c0b90,_0x3d81a0){var _0x2b1ad0={};var _0x3f95eb={};var _0x3ef9e4;var _0x176e88;return db[_0x3597('0x2b')][_0x3597('0x61')]({'where':{'id':_0x23ec8d[_0x3597('0x47')]['id']}})[_0x3597('0x20')](handleEntityNotFound(_0x5c0b90,null))['then'](function(_0x154120){if(_0x154120){_0x3ef9e4=_0x154120;_0x3f95eb[_0x3597('0x33')]=_[_0x3597('0x2f')](db[_0x3597('0x60')][_0x3597('0x45')]);_0x3f95eb[_0x3597('0x30')]=_['keys'](_0x23ec8d[_0x3597('0x30')]);_0x3f95eb['filters']=_[_0x3597('0x32')](_0x3f95eb[_0x3597('0x33')],_0x3f95eb['query']);_0x2b1ad0['attributes']=_['intersection'](_0x3f95eb[_0x3597('0x33')],qs[_0x3597('0x35')](_0x23ec8d[_0x3597('0x30')][_0x3597('0x35')]));_0x2b1ad0[_0x3597('0x34')]=_0x2b1ad0[_0x3597('0x34')][_0x3597('0x36')]?_0x2b1ad0[_0x3597('0x34')]:_0x3f95eb[_0x3597('0x33')];_0x2b1ad0[_0x3597('0x38')]=qs['sort'](_0x23ec8d[_0x3597('0x30')][_0x3597('0x39')]);_0x2b1ad0[_0x3597('0x3a')]=qs[_0x3597('0x31')](_[_0x3597('0x3b')](_0x23ec8d[_0x3597('0x30')],_0x3f95eb['filters']));if(_0x23ec8d[_0x3597('0x30')][_0x3597('0x3c')]){_0x2b1ad0['where']=_[_0x3597('0x3d')](_0x2b1ad0[_0x3597('0x3a')],{'$or':_[_0x3597('0x2a')](_0x2b1ad0['attributes'],function(_0x8594db){var _0x45c65e={};_0x45c65e[_0x8594db]={'$like':'%'+_0x23ec8d['query']['filter']+'%'};return _0x45c65e;})});}_0x2b1ad0=_[_0x3597('0x3d')]({},_0x2b1ad0,_0x23ec8d['options']);return _0x3ef9e4['getSounds'](_0x2b1ad0);}})[_0x3597('0x20')](function(_0x1449e0){if(_0x1449e0){_0x176e88=_0x1449e0[_0x3597('0x36')];if(!_0x23ec8d[_0x3597('0x30')]['hasOwnProperty'](_0x3597('0x37'))){_0x2b1ad0[_0x3597('0x19')]=qs[_0x3597('0x19')](_0x23ec8d[_0x3597('0x30')]['limit']);_0x2b1ad0[_0x3597('0x18')]=qs['offset'](_0x23ec8d[_0x3597('0x30')][_0x3597('0x18')]);}return _0x3ef9e4[_0x3597('0x6c')](_0x2b1ad0);}})[_0x3597('0x20')](function(_0x5bd819){if(_0x5bd819){return _0x5bd819?{'count':_0x176e88,'rows':_0x5bd819}:null;}})[_0x3597('0x20')](respondWithResult(_0x5c0b90,null))[_0x3597('0x44')](handleError(_0x5c0b90,null));}; \ No newline at end of file +var _0x02e4=['type','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','rows','show','params','includeAll','catch','body','find','create','sequelize','mode','files','root','server/files/moh','mkdirSync','directory','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','MusicOnHolds','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','forEach','unlinkSync','rmdirSync','message','addSound','Sound','findOne','save_name','converted_format','createdAt','join','server/files/sounds/converted','basename','format','%s.%s','symlinkSync','ValidationError','removeSound','id2','Sequelize','getSounds','nolimit','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','count','limit','set','Content-Range','apply','reject','save','update','then','get','destroy','end','name','map','VoiceMusicOnHold','rawAttributes','fieldName'];(function(_0x3bec81,_0x4e1562){var _0x2d1336=function(_0x11f682){while(--_0x11f682){_0x3bec81['push'](_0x3bec81['shift']());}};_0x2d1336(++_0x4e1562);}(_0x02e4,0xb8));var _0x402e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x02e4[_0x2b4411];return _0x8e41ef;};'use strict';var emlformat=require(_0x402e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x402e('0x1'));var jsonpatch=require(_0x402e('0x2'));var rp=require('request-promise');var moment=require(_0x402e('0x3'));var BPromise=require(_0x402e('0x4'));var Mustache=require('mustache');var util=require(_0x402e('0x5'));var path=require('path');var sox=require(_0x402e('0x6'));var csv=require(_0x402e('0x7'));var ejs=require(_0x402e('0x8'));var fs=require('fs');var fs_extra=require(_0x402e('0x9'));var _=require(_0x402e('0xa'));var squel=require(_0x402e('0xb'));var crypto=require(_0x402e('0xc'));var jsforce=require(_0x402e('0xd'));var deskjs=require(_0x402e('0xe'));var toCsv=require(_0x402e('0x7'));var querystring=require(_0x402e('0xf'));var Papa=require(_0x402e('0x10'));var Redis=require(_0x402e('0x11'));var authService=require(_0x402e('0x12'));var qs=require(_0x402e('0x13'));var as=require(_0x402e('0x14'));var hardwareService=require(_0x402e('0x15'));var logger=require(_0x402e('0x16'))('api');var utils=require(_0x402e('0x17'));var config=require(_0x402e('0x18'));var licenseUtil=require(_0x402e('0x19'));var db=require(_0x402e('0x1a'))['db'];function respondWithStatusCode(_0xc706ae,_0x3721a9){_0x3721a9=_0x3721a9||0xcc;return function(_0x30196e){if(_0x30196e){return _0xc706ae[_0x402e('0x1b')](_0x3721a9);}return _0xc706ae[_0x402e('0x1c')](_0x3721a9)['end']();};}function respondWithResult(_0x598361,_0x5384b6){_0x5384b6=_0x5384b6||0xc8;return function(_0x49e910){if(_0x49e910){return _0x598361[_0x402e('0x1c')](_0x5384b6)[_0x402e('0x1d')](_0x49e910);}};}function respondWithFilteredResult(_0x31c011,_0x43fca5){return function(_0x2cd074){if(_0x2cd074){var _0x44cb3f=typeof _0x43fca5[_0x402e('0x1e')]==='undefined'&&typeof _0x43fca5['limit']==='undefined';var _0x395725=_0x2cd074[_0x402e('0x1f')];var _0x5e586c=_0x44cb3f?0x0:_0x43fca5[_0x402e('0x1e')];var _0x2762e5=_0x44cb3f?_0x2cd074[_0x402e('0x1f')]:_0x43fca5[_0x402e('0x1e')]+_0x43fca5[_0x402e('0x20')];var _0x5575b2;if(_0x2762e5>=_0x395725){_0x2762e5=_0x395725;_0x5575b2=0xc8;}else{_0x5575b2=0xce;}_0x31c011[_0x402e('0x1c')](_0x5575b2);return _0x31c011[_0x402e('0x21')](_0x402e('0x22'),_0x5e586c+'-'+_0x2762e5+'/'+_0x395725)['json'](_0x2cd074);}return null;};}function patchUpdates(_0x21cbd0){return function(_0x3b93d9){try{jsonpatch[_0x402e('0x23')](_0x3b93d9,_0x21cbd0,!![]);}catch(_0x420843){return BPromise[_0x402e('0x24')](_0x420843);}return _0x3b93d9[_0x402e('0x25')]();};}function saveUpdates(_0x49adfa,_0x5bb2cf){return function(_0x4d8f2a){if(_0x4d8f2a){return _0x4d8f2a[_0x402e('0x26')](_0x49adfa)[_0x402e('0x27')](function(_0x41cc50){return _0x41cc50;});}return null;};}function removeEntity(_0x4fc780,_0x3886db){return function(_0x5105cb){if(_0x5105cb){return _0x5105cb['destroy']()[_0x402e('0x27')](function(){var _0x2770b9=_0x5105cb[_0x402e('0x28')]({'plain':!![]});var _0x28560e='MusicOnHolds';return db['UserProfileResource'][_0x402e('0x29')]({'where':{'type':_0x28560e,'resourceId':_0x2770b9['id']}})[_0x402e('0x27')](function(){return _0x5105cb;});})[_0x402e('0x27')](function(){_0x4fc780['status'](0xcc)[_0x402e('0x2a')]();});}};}function handleEntityNotFound(_0x33bfb3,_0x5c2751){return function(_0x384213){if(!_0x384213){_0x33bfb3[_0x402e('0x1b')](0x194);}return _0x384213;};}function handleError(_0x462fba,_0x241c2f){_0x241c2f=_0x241c2f||0x1f4;return function(_0x99ebeb){logger['error'](_0x99ebeb['stack']);if(_0x99ebeb[_0x402e('0x2b')]){delete _0x99ebeb[_0x402e('0x2b')];}_0x462fba['status'](_0x241c2f)['send'](_0x99ebeb);};}exports['index']=function(_0x3eb7fa,_0x5cb41d){var _0x35f62a={},_0x58ad99={},_0x367fc5={'count':0x0,'rows':[]};var _0x4ff388=_[_0x402e('0x2c')](db[_0x402e('0x2d')][_0x402e('0x2e')],function(_0x873b84){return{'name':_0x873b84[_0x402e('0x2f')],'type':_0x873b84[_0x402e('0x30')][_0x402e('0x31')]};});_0x58ad99['model']=_[_0x402e('0x2c')](_0x4ff388,_0x402e('0x2b'));_0x58ad99['query']=_[_0x402e('0x32')](_0x3eb7fa[_0x402e('0x33')]);_0x58ad99[_0x402e('0x34')]=_[_0x402e('0x35')](_0x58ad99['model'],_0x58ad99[_0x402e('0x33')]);_0x35f62a[_0x402e('0x36')]=_[_0x402e('0x35')](_0x58ad99[_0x402e('0x37')],qs[_0x402e('0x38')](_0x3eb7fa[_0x402e('0x33')][_0x402e('0x38')]));_0x35f62a[_0x402e('0x36')]=_0x35f62a['attributes'][_0x402e('0x39')]?_0x35f62a[_0x402e('0x36')]:_0x58ad99[_0x402e('0x37')];if(!_0x3eb7fa[_0x402e('0x33')][_0x402e('0x3a')]('nolimit')){_0x35f62a[_0x402e('0x20')]=qs[_0x402e('0x20')](_0x3eb7fa[_0x402e('0x33')]['limit']);_0x35f62a[_0x402e('0x1e')]=qs['offset'](_0x3eb7fa[_0x402e('0x33')][_0x402e('0x1e')]);}_0x35f62a['order']=qs[_0x402e('0x3b')](_0x3eb7fa[_0x402e('0x33')]['sort']);delete _0x3eb7fa[_0x402e('0x33')][_0x402e('0x3b')];_0x35f62a['where']=qs[_0x402e('0x34')](_[_0x402e('0x3c')](_0x3eb7fa[_0x402e('0x33')],_0x58ad99[_0x402e('0x34')]),_0x4ff388);if(_0x3eb7fa[_0x402e('0x33')][_0x402e('0x3d')]){_0x35f62a['where']=_['merge'](_0x35f62a[_0x402e('0x3e')],{'$or':_[_0x402e('0x2c')](_0x4ff388,function(_0x37f839){if(_0x37f839[_0x402e('0x30')]!==_0x402e('0x3f')){var _0x2ee826={};_0x2ee826[_0x37f839[_0x402e('0x2b')]]={'$like':'%'+_0x3eb7fa[_0x402e('0x33')][_0x402e('0x3d')]+'%'};return _0x2ee826;}})});}_0x35f62a=_[_0x402e('0x40')]({},_0x35f62a,_0x3eb7fa[_0x402e('0x41')]);var _0x45beea={'where':_0x35f62a['where']};return db['VoiceMusicOnHold'][_0x402e('0x1f')](_0x45beea)[_0x402e('0x27')](function(_0x26cfd0){_0x367fc5[_0x402e('0x1f')]=_0x26cfd0;if(_0x3eb7fa[_0x402e('0x33')]['includeAll']){_0x35f62a[_0x402e('0x42')]=[{'all':!![]}];}return db[_0x402e('0x2d')][_0x402e('0x43')](_0x35f62a);})[_0x402e('0x27')](function(_0x1fe342){_0x367fc5[_0x402e('0x44')]=_0x1fe342;return _0x367fc5;})[_0x402e('0x27')](respondWithFilteredResult(_0x5cb41d,_0x35f62a))['catch'](handleError(_0x5cb41d,null));};exports[_0x402e('0x45')]=function(_0x11dddc,_0x25b438){var _0x2f5b97={'raw':![],'where':{'id':_0x11dddc[_0x402e('0x46')]['id']}},_0x6d45b6={};_0x6d45b6['model']=_[_0x402e('0x32')](db[_0x402e('0x2d')][_0x402e('0x2e')]);_0x6d45b6['query']=_['keys'](_0x11dddc[_0x402e('0x33')]);_0x6d45b6['filters']=_[_0x402e('0x35')](_0x6d45b6[_0x402e('0x37')],_0x6d45b6[_0x402e('0x33')]);_0x2f5b97[_0x402e('0x36')]=_[_0x402e('0x35')](_0x6d45b6[_0x402e('0x37')],qs['fields'](_0x11dddc[_0x402e('0x33')][_0x402e('0x38')]));_0x2f5b97[_0x402e('0x36')]=_0x2f5b97[_0x402e('0x36')][_0x402e('0x39')]?_0x2f5b97[_0x402e('0x36')]:_0x6d45b6[_0x402e('0x37')];if(_0x11dddc[_0x402e('0x33')][_0x402e('0x47')]){_0x2f5b97[_0x402e('0x42')]=[{'all':!![]}];}_0x2f5b97=_[_0x402e('0x40')]({},_0x2f5b97,_0x11dddc[_0x402e('0x41')]);return db[_0x402e('0x2d')]['find'](_0x2f5b97)[_0x402e('0x27')](handleEntityNotFound(_0x25b438,null))[_0x402e('0x27')](respondWithResult(_0x25b438,null))[_0x402e('0x48')](handleError(_0x25b438,null));};exports['update']=function(_0x401411,_0x7f4f1c){if(_0x401411['body']['id']){delete _0x401411[_0x402e('0x49')]['id'];}return db[_0x402e('0x2d')][_0x402e('0x4a')]({'where':{'id':_0x401411[_0x402e('0x46')]['id']}})[_0x402e('0x27')](handleEntityNotFound(_0x7f4f1c,null))[_0x402e('0x27')](saveUpdates(_0x401411[_0x402e('0x49')],null))[_0x402e('0x27')](respondWithResult(_0x7f4f1c,null))['catch'](handleError(_0x7f4f1c,null));};exports[_0x402e('0x4b')]=function(_0x4f1c96,_0x533bc6,_0x1791e5){return db[_0x402e('0x4c')]['transaction'](function(_0x27f201){if(_0x4f1c96['body'][_0x402e('0x4d')]===_0x402e('0x4e')){_0x4f1c96[_0x402e('0x49')]['directory']=path['join'](config[_0x402e('0x4f')],_0x402e('0x50'),_0x4f1c96[_0x402e('0x49')][_0x402e('0x2b')]);}return db[_0x402e('0x2d')]['create'](_0x4f1c96[_0x402e('0x49')],{'transaction':_0x27f201})[_0x402e('0x27')](function(_0xb10e84){if(_0x4f1c96[_0x402e('0x49')]['mode']==='files'){fs[_0x402e('0x51')](_0xb10e84[_0x402e('0x52')],parseInt(_0x402e('0x53'),0x8));}var _0x119d80=_0x4f1c96['user'][_0x402e('0x28')]({'plain':!![]});if(!_0x119d80)throw new Error(_0x402e('0x54'));if(_0x119d80[_0x402e('0x55')]===_0x402e('0x56')){var _0x4d431b=_0xb10e84['get']({'plain':!![]});return db[_0x402e('0x57')]['find']({'where':{'name':_0x402e('0x58'),'userProfileId':_0x119d80[_0x402e('0x59')]},'raw':!![]})['then'](function(_0x37140e){if(_0x37140e&&_0x37140e[_0x402e('0x5a')]===0x0){return db[_0x402e('0x5b')]['create']({'name':_0x4d431b['name'],'resourceId':_0x4d431b['id'],'type':_0x37140e[_0x402e('0x2b')],'sectionId':_0x37140e['id']},{})['then'](function(){return _0xb10e84;});}else{return _0xb10e84;}})[_0x402e('0x48')](function(_0x110521){logger['error'](_0x402e('0x5c'),_0x110521);});}return _0xb10e84;});})[_0x402e('0x27')](respondWithResult(_0x533bc6,0xc9))[_0x402e('0x48')](handleError(_0x533bc6,null));};exports[_0x402e('0x29')]=function(_0x3cc531,_0x43233f,_0x597f15){var _0x352505;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x3cc531['params']['id']}})[_0x402e('0x27')](function(_0x49ec2b){if(_0x49ec2b){return db[_0x402e('0x4c')][_0x402e('0x5d')](function(_0x495dc7){return _0x49ec2b['destroy']({'transaction':_0x495dc7,'raw':!![]})[_0x402e('0x27')](function(_0x25a178){if(_0x25a178[_0x402e('0x52')]){fs['readdirSync'](_0x25a178[_0x402e('0x52')])[_0x402e('0x5e')](function(_0x34da29){fs[_0x402e('0x5f')](path['join'](_0x25a178['directory'],_0x34da29));});fs[_0x402e('0x60')](_0x25a178[_0x402e('0x52')]);}return _0x25a178;});})[_0x402e('0x48')](function(_0x30fc69){throw new db['Sequelize']['ValidationError'](_0x30fc69[_0x402e('0x61')]);});}})[_0x402e('0x27')](handleEntityNotFound(_0x43233f,null))[_0x402e('0x27')](removeEntity(_0x43233f,null))[_0x402e('0x48')](handleError(_0x43233f,null));};exports[_0x402e('0x62')]=function(_0x9e48c2,_0x91b86,_0x38afa7){return db[_0x402e('0x4c')]['transaction'](function(_0x132f1b){var _0x4f4d17;return db[_0x402e('0x2d')][_0x402e('0x4a')]({'where':{'id':_0x9e48c2[_0x402e('0x46')]['id']}})[_0x402e('0x27')](function(_0x487e90){if(_0x487e90){_0x4f4d17=_0x487e90;return _0x487e90[_0x402e('0x62')](_0x9e48c2[_0x402e('0x49')]['id'],{'transaction':_0x132f1b});}})[_0x402e('0x27')](function(_0x997f2e){if(_0x997f2e){return db[_0x402e('0x63')][_0x402e('0x64')]({'where':{'id':_0x9e48c2[_0x402e('0x49')]['id']},'attributes':['id',_0x402e('0x2b'),_0x402e('0x65'),_0x402e('0x66'),_0x402e('0x67')],'raw':!![]});}})[_0x402e('0x27')](function(_0x4eec82){if(_0x4eec82){var _0x19fc40=path[_0x402e('0x68')](config[_0x402e('0x4f')],_0x402e('0x69'),util['format']('%s.%s',path[_0x402e('0x6a')](_0x4eec82[_0x402e('0x65')],path['extname'](_0x4eec82['save_name'])),_0x4eec82[_0x402e('0x66')]));var _0x4a7178=path[_0x402e('0x68')](config[_0x402e('0x4f')],_0x402e('0x50'),_0x4f4d17[_0x402e('0x2b')],util[_0x402e('0x6b')](_0x402e('0x6c'),_0x4eec82[_0x402e('0x2b')],_0x4eec82[_0x402e('0x66')]));fs[_0x402e('0x6d')](_0x19fc40,_0x4a7178);return _0x4eec82;}})[_0x402e('0x48')](function(_0x2795f5){throw new db['Sequelize'][(_0x402e('0x6e'))](_0x2795f5['message']);});})[_0x402e('0x27')](handleEntityNotFound(_0x91b86,null))[_0x402e('0x27')](respondWithResult(_0x91b86,0xc9))[_0x402e('0x48')](handleError(_0x91b86,null));};exports[_0x402e('0x6f')]=function(_0x1dd805,_0x5521e2,_0x107829){return db['sequelize']['transaction'](function(_0x7cb2d8){var _0x5634e8;return db[_0x402e('0x2d')][_0x402e('0x64')]({'where':{'id':_0x1dd805[_0x402e('0x46')]['id']}})['then'](handleEntityNotFound(_0x5521e2,null))[_0x402e('0x27')](function(_0x2fc454){if(_0x2fc454){_0x5634e8=_0x2fc454;return _0x2fc454[_0x402e('0x6f')](_0x1dd805[_0x402e('0x46')][_0x402e('0x70')]);}})[_0x402e('0x27')](function(_0x5382e9){if(_0x5382e9){return db[_0x402e('0x63')][_0x402e('0x64')]({'where':{'id':_0x1dd805[_0x402e('0x46')][_0x402e('0x70')]},'attributes':['id',_0x402e('0x2b'),_0x402e('0x65'),_0x402e('0x66'),_0x402e('0x67')],'raw':!![]});}})[_0x402e('0x27')](function(_0x1f97ef){if(_0x1f97ef){fs['unlinkSync'](path[_0x402e('0x68')](_0x5634e8[_0x402e('0x52')],util['format']('%s.%s',_0x1f97ef[_0x402e('0x2b')],_0x1f97ef[_0x402e('0x66')])));return _0x1f97ef;}})[_0x402e('0x48')](function(_0x120068){throw new db[(_0x402e('0x71'))][(_0x402e('0x6e'))](_0x120068[_0x402e('0x61')]);});})['then'](handleEntityNotFound(_0x5521e2,null))['then'](respondWithStatusCode(_0x5521e2,0xcc))[_0x402e('0x48')](handleError(_0x5521e2,null));};exports[_0x402e('0x72')]=function(_0x22686f,_0x21fc54,_0x2cc637){var _0x38817c={};var _0x4d7c18={};var _0x4b29ac;var _0x21a948;return db[_0x402e('0x2d')]['findOne']({'where':{'id':_0x22686f[_0x402e('0x46')]['id']}})[_0x402e('0x27')](handleEntityNotFound(_0x21fc54,null))[_0x402e('0x27')](function(_0x10a86c){if(_0x10a86c){_0x4b29ac=_0x10a86c;_0x4d7c18[_0x402e('0x37')]=_[_0x402e('0x32')](db[_0x402e('0x63')]['rawAttributes']);_0x4d7c18[_0x402e('0x33')]=_[_0x402e('0x32')](_0x22686f[_0x402e('0x33')]);_0x4d7c18[_0x402e('0x34')]=_[_0x402e('0x35')](_0x4d7c18[_0x402e('0x37')],_0x4d7c18['query']);_0x38817c[_0x402e('0x36')]=_[_0x402e('0x35')](_0x4d7c18[_0x402e('0x37')],qs[_0x402e('0x38')](_0x22686f['query'][_0x402e('0x38')]));_0x38817c[_0x402e('0x36')]=_0x38817c[_0x402e('0x36')][_0x402e('0x39')]?_0x38817c[_0x402e('0x36')]:_0x4d7c18[_0x402e('0x37')];_0x38817c['order']=qs[_0x402e('0x3b')](_0x22686f['query'][_0x402e('0x3b')]);_0x38817c['where']=qs[_0x402e('0x34')](_[_0x402e('0x3c')](_0x22686f[_0x402e('0x33')],_0x4d7c18[_0x402e('0x34')]));if(_0x22686f[_0x402e('0x33')][_0x402e('0x3d')]){_0x38817c[_0x402e('0x3e')]=_['merge'](_0x38817c[_0x402e('0x3e')],{'$or':_[_0x402e('0x2c')](_0x38817c[_0x402e('0x36')],function(_0x25347f){var _0x4ee376={};_0x4ee376[_0x25347f]={'$like':'%'+_0x22686f[_0x402e('0x33')]['filter']+'%'};return _0x4ee376;})});}_0x38817c=_[_0x402e('0x40')]({},_0x38817c,_0x22686f['options']);return _0x4b29ac['getSounds'](_0x38817c);}})[_0x402e('0x27')](function(_0x6bb619){if(_0x6bb619){_0x21a948=_0x6bb619['length'];if(!_0x22686f[_0x402e('0x33')][_0x402e('0x3a')](_0x402e('0x73'))){_0x38817c[_0x402e('0x20')]=qs[_0x402e('0x20')](_0x22686f[_0x402e('0x33')][_0x402e('0x20')]);_0x38817c['offset']=qs[_0x402e('0x1e')](_0x22686f[_0x402e('0x33')][_0x402e('0x1e')]);}return _0x4b29ac['getSounds'](_0x38817c);}})['then'](function(_0x3cb26f){if(_0x3cb26f){return _0x3cb26f?{'count':_0x21a948,'rows':_0x3cb26f}:null;}})[_0x402e('0x27')](respondWithResult(_0x21fc54,null))[_0x402e('0x48')](handleError(_0x21fc54,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index effacc0..9368479 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 _0xdf07=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdf07,0x1af));var _0x7df0=function(_0x205201,_0x280331){_0x205201=_0x205201-0x0;var _0x268a4b=_0xdf07[_0x205201];return _0x268a4b;};'use strict';var _=require('lodash');var util=require(_0x7df0('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x7df0('0x1'));var BPromise=require(_0x7df0('0x2'));var rp=require(_0x7df0('0x3'));var fs=require('fs');var path=require(_0x7df0('0x4'));var rimraf=require(_0x7df0('0x5'));var config=require(_0x7df0('0x6'));var attributes=require(_0x7df0('0x7'));module[_0x7df0('0x8')]=function(_0x3977a2,_0x1c7978){return _0x3977a2[_0x7df0('0x9')](_0x7df0('0xa'),attributes,{'tableName':_0x7df0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5dac=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5dac,0x1c7));var _0xc5da=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x5dac[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0xc5da('0x0'));var util=require(_0xc5da('0x1'));var logger=require(_0xc5da('0x2'))(_0xc5da('0x3'));var moment=require(_0xc5da('0x4'));var BPromise=require(_0xc5da('0x5'));var rp=require(_0xc5da('0x6'));var fs=require('fs');var path=require(_0xc5da('0x7'));var rimraf=require('rimraf');var config=require(_0xc5da('0x8'));var attributes=require(_0xc5da('0x9'));module[_0xc5da('0xa')]=function(_0x11865d,_0x51f7e8){return _0x11865d[_0xc5da('0xb')](_0xc5da('0xc'),attributes,{'tableName':'voice_musiconhold','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 20c0443..ba74a0a 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 _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','VoiceMusicOnHold,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x3d813c,_0x7ed88a){var _0x370ae1=function(_0x3e0a3e){while(--_0x3e0a3e){_0x3d813c['push'](_0x3d813c['shift']());}};_0x370ae1(++_0x7ed88a);}(_0x9c44,0x178));var _0x49c4=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x9c44[_0x1d1779];return _0x2377e9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file +var _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(_0x15ef38,_0x391bc5){var _0x3ebe00=function(_0x2638c9){while(--_0x2638c9){_0x15ef38['push'](_0x15ef38['shift']());}};_0x3ebe00(++_0x391bc5);}(_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 016746b..132e7fa 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 _0x4f16=['removeTeams','multer','util','path','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/users','getAgents','/:id/teams','getTeams','post','create','addAgents','destroy','delete'];(function(_0x40be92,_0x488e3){var _0x33e39c=function(_0x3e90b4){while(--_0x3e90b4){_0x40be92['push'](_0x40be92['shift']());}};_0x33e39c(++_0x488e3);}(_0x4f16,0x11f));var _0x64f1=function(_0x1475a6,_0x56628c){_0x1475a6=_0x1475a6-0x0;var _0x3c0d07=_0x4f16[_0x1475a6];return _0x3c0d07;};'use strict';var multer=require(_0x64f1('0x0'));var util=require(_0x64f1('0x1'));var path=require(_0x64f1('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x64f1('0x3'));var auth=require(_0x64f1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x64f1('0x5'));var controller=require('./voicePrefix.controller');router[_0x64f1('0x6')]('/',auth[_0x64f1('0x7')](),controller[_0x64f1('0x8')]);router[_0x64f1('0x6')](_0x64f1('0x9'),auth[_0x64f1('0x7')](),controller[_0x64f1('0xa')]);router['get'](_0x64f1('0xb'),auth[_0x64f1('0x7')](),controller['show']);router[_0x64f1('0x6')](_0x64f1('0xc'),auth[_0x64f1('0x7')](),controller[_0x64f1('0xd')]);router[_0x64f1('0x6')](_0x64f1('0xe'),auth['isAuthenticated'](),controller[_0x64f1('0xf')]);router[_0x64f1('0x10')]('/',auth[_0x64f1('0x7')](),controller[_0x64f1('0x11')]);router['post']('/:id/users',auth[_0x64f1('0x7')](),controller[_0x64f1('0x12')]);router['post']('/:id/teams',auth[_0x64f1('0x7')](),controller['addTeams']);router['put'](_0x64f1('0xb'),auth[_0x64f1('0x7')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x64f1('0x13')]);router[_0x64f1('0x14')](_0x64f1('0xc'),auth[_0x64f1('0x7')](),controller['removeAgents']);router[_0x64f1('0x14')](_0x64f1('0xe'),auth[_0x64f1('0x7')](),controller[_0x64f1('0x15')]);module['exports']=router; \ No newline at end of file +var _0xf6d0=['update','delete','removeAgents','removeTeams','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','/:id/users','getAgents','post','create','/:id/teams','addTeams','put','/:id'];(function(_0x59ba26,_0x56d56){var _0x3e947b=function(_0x4c2a6d){while(--_0x4c2a6d){_0x59ba26['push'](_0x59ba26['shift']());}};_0x3e947b(++_0x56d56);}(_0xf6d0,0x163));var _0x0f6d=function(_0x2c2dba,_0x289d3b){_0x2c2dba=_0x2c2dba-0x0;var _0x1c14e4=_0xf6d0[_0x2c2dba];return _0x1c14e4;};'use strict';var multer=require(_0x0f6d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0f6d('0x1'));var express=require(_0x0f6d('0x2'));var router=express[_0x0f6d('0x3')]();var fs_extra=require(_0x0f6d('0x4'));var auth=require(_0x0f6d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0f6d('0x6'));var controller=require(_0x0f6d('0x7'));router[_0x0f6d('0x8')]('/',auth[_0x0f6d('0x9')](),controller[_0x0f6d('0xa')]);router[_0x0f6d('0x8')](_0x0f6d('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x0f6d('0x8')]('/:id',auth[_0x0f6d('0x9')](),controller['show']);router['get'](_0x0f6d('0xc'),auth[_0x0f6d('0x9')](),controller[_0x0f6d('0xd')]);router[_0x0f6d('0x8')]('/:id/teams',auth[_0x0f6d('0x9')](),controller['getTeams']);router[_0x0f6d('0xe')]('/',auth[_0x0f6d('0x9')](),controller[_0x0f6d('0xf')]);router['post'](_0x0f6d('0xc'),auth['isAuthenticated'](),controller['addAgents']);router[_0x0f6d('0xe')](_0x0f6d('0x10'),auth[_0x0f6d('0x9')](),controller[_0x0f6d('0x11')]);router[_0x0f6d('0x12')](_0x0f6d('0x13'),auth['isAuthenticated'](),controller[_0x0f6d('0x14')]);router[_0x0f6d('0x15')](_0x0f6d('0x13'),auth[_0x0f6d('0x9')](),controller['destroy']);router[_0x0f6d('0x15')](_0x0f6d('0xc'),auth[_0x0f6d('0x9')](),controller[_0x0f6d('0x16')]);router[_0x0f6d('0x15')]('/:id/teams',auth[_0x0f6d('0x9')](),controller[_0x0f6d('0x17')]);module[_0x0f6d('0x18')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 62eb2e8..30e2990 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 _0x7dc8=['sequelize','STRING','VIRTUAL','system-','getDataValue','name','INTEGER'];(function(_0x12d812,_0x496bb7){var _0x3711ab=function(_0x3259da){while(--_0x3259da){_0x12d812['push'](_0x12d812['shift']());}};_0x3711ab(++_0x496bb7);}(_0x7dc8,0x118));var _0x87dc=function(_0x49c4ab,_0x32bba6){_0x49c4ab=_0x49c4ab-0x0;var _0x591b1f=_0x7dc8[_0x49c4ab];return _0x591b1f;};'use strict';var Sequelize=require(_0x87dc('0x0'));module['exports']={'name':{'type':Sequelize[_0x87dc('0x1')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x87dc('0x2')],'get':function(_0x2e07b6){return _0x87dc('0x3')+this[_0x87dc('0x4')](_0x87dc('0x5'))+'-';}},'description':{'type':Sequelize[_0x87dc('0x1')]},'callerIdAll':{'type':Sequelize[_0x87dc('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x87dc('0x6')]}}; \ No newline at end of file +var _0x738a=['sequelize','exports','STRING','name','VIRTUAL','getDataValue','INTEGER'];(function(_0x31d529,_0x1c419d){var _0x49970b=function(_0x140fdf){while(--_0x140fdf){_0x31d529['push'](_0x31d529['shift']());}};_0x49970b(++_0x1c419d);}(_0x738a,0x149));var _0xa738=function(_0x4d5d0a,_0x4148dd){_0x4d5d0a=_0x4d5d0a-0x0;var _0x502c59=_0x738a[_0x4d5d0a];return _0x502c59;};'use strict';var Sequelize=require(_0xa738('0x0'));module[_0xa738('0x1')]={'name':{'type':Sequelize[_0xa738('0x2')],'allowNull':![],'unique':_0xa738('0x3')},'prefix':{'type':Sequelize[_0xa738('0x4')],'get':function(_0x4bb101){return'system-'+this[_0xa738('0x5')](_0xa738('0x3'))+'-';}},'description':{'type':Sequelize[_0xa738('0x2')]},'callerIdAll':{'type':Sequelize[_0xa738('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xa738('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index af2e801..ad5def2 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 _0xa30a=['priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','Set','push','PREFIX-CALLERIDALL=','charAt','body','VoiceExtensionId','findById','addAgents','ids','omit','spread','emit','removeAgents','userVoicePrefix:remove','getAgents','findOne','User','getTeams','Team','order','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','TeamVoicePrefix','upsert','findOrCreate','userVoicePrefix:save','removeTeams','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','forEach','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','error','stack','name','send','index','VoicePrefix','rawAttributes','fieldName','type','map','keys','filters','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','find','params','describe','create','transaction','VoiceExtension','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','app','description','Voice\x20Prefix\x20Extension'];(function(_0x5197d7,_0xdeff79){var _0x4ccf01=function(_0x3c7e3e){while(--_0x3c7e3e){_0x5197d7['push'](_0x5197d7['shift']());}};_0x4ccf01(++_0xdeff79);}(_0xa30a,0xd7));var _0xaa30=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa30a[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xaa30('0x0'));var rimraf=require(_0xaa30('0x1'));var zipdir=require(_0xaa30('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaa30('0x3'));var moment=require(_0xaa30('0x4'));var BPromise=require(_0xaa30('0x5'));var Mustache=require(_0xaa30('0x6'));var util=require(_0xaa30('0x7'));var path=require(_0xaa30('0x8'));var sox=require(_0xaa30('0x9'));var csv=require('to-csv');var ejs=require(_0xaa30('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaa30('0xb'));var squel=require(_0xaa30('0xc'));var crypto=require(_0xaa30('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xaa30('0xe'));var toCsv=require(_0xaa30('0xf'));var querystring=require(_0xaa30('0x10'));var Papa=require(_0xaa30('0x11'));var Redis=require(_0xaa30('0x12'));var authService=require(_0xaa30('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa30('0x14'));var logger=require('../../config/logger')(_0xaa30('0x15'));var utils=require(_0xaa30('0x16'));var config=require(_0xaa30('0x17'));var licenseUtil=require(_0xaa30('0x18'));var db=require('../../mysqldb')['db'];config[_0xaa30('0x19')]=_[_0xaa30('0x1a')](config[_0xaa30('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xaa30('0x1b'))(new Redis(config[_0xaa30('0x19')]));require(_0xaa30('0x1c'))[_0xaa30('0x1d')](socket);function respondWithStatusCode(_0x41f1d9,_0x31aa0b){_0x31aa0b=_0x31aa0b||0xcc;return function(_0x3240e9){if(_0x3240e9){return _0x41f1d9[_0xaa30('0x1e')](_0x31aa0b);}return _0x41f1d9[_0xaa30('0x1f')](_0x31aa0b)[_0xaa30('0x20')]();};}function respondWithResult(_0x519518,_0x91839d){_0x91839d=_0x91839d||0xc8;return function(_0x591478){if(_0x591478){return _0x519518['status'](_0x91839d)[_0xaa30('0x21')](_0x591478);}};}function respondWithFilteredResult(_0x153939,_0x130606){return function(_0x540e36){if(_0x540e36){var _0x54fa49=typeof _0x130606['offset']===_0xaa30('0x22')&&typeof _0x130606['limit']===_0xaa30('0x22');var _0x332a0a=_0x540e36['count'];var _0x4e29f9=_0x54fa49?0x0:_0x130606['offset'];var _0x3cbf92=_0x54fa49?_0x540e36[_0xaa30('0x23')]:_0x130606[_0xaa30('0x24')]+_0x130606[_0xaa30('0x25')];var _0x43a526;if(_0x3cbf92>=_0x332a0a){_0x3cbf92=_0x332a0a;_0x43a526=0xc8;}else{_0x43a526=0xce;}_0x153939['status'](_0x43a526);return _0x153939[_0xaa30('0x26')](_0xaa30('0x27'),_0x4e29f9+'-'+_0x3cbf92+'/'+_0x332a0a)[_0xaa30('0x21')](_0x540e36);}return null;};}function patchUpdates(_0x2d9e35){return function(_0x1ff442){try{jsonpatch['apply'](_0x1ff442,_0x2d9e35,!![]);}catch(_0x325b42){return BPromise[_0xaa30('0x28')](_0x325b42);}return _0x1ff442[_0xaa30('0x29')]();};}function saveUpdates(_0x326f84,_0x57d1ca){return function(_0x14d7fa){if(_0x14d7fa){return _0x14d7fa[_0xaa30('0x2a')](_0x326f84)[_0xaa30('0x2b')](function(_0x12da2f){return _0x12da2f;});}return null;};}function removeEntity(_0x97b038,_0x2a59ce){return function(_0x55cccb){if(_0x55cccb){return _0x55cccb[_0xaa30('0x2c')]()[_0xaa30('0x2b')](function(){var _0x5d4da8=_0x55cccb[_0xaa30('0x2d')]({'plain':!![]});var _0x5b3efb=_0xaa30('0x2e');return db[_0xaa30('0x2f')][_0xaa30('0x2c')]({'where':{'type':_0x5b3efb,'resourceId':_0x5d4da8['id']}})[_0xaa30('0x2b')](function(){return _0x55cccb;});})[_0xaa30('0x2b')](function(){_0x97b038[_0xaa30('0x1f')](0xcc)[_0xaa30('0x20')]();});}};}function handleEntityNotFound(_0x39f708,_0x1f288c){return function(_0x43fb30){if(!_0x43fb30){_0x39f708[_0xaa30('0x1e')](0x194);}return _0x43fb30;};}function handleError(_0x43003f,_0x2038a6){_0x2038a6=_0x2038a6||0x1f4;return function(_0x46abb9){logger[_0xaa30('0x30')](_0x46abb9[_0xaa30('0x31')]);if(_0x46abb9[_0xaa30('0x32')]){delete _0x46abb9[_0xaa30('0x32')];}_0x43003f['status'](_0x2038a6)[_0xaa30('0x33')](_0x46abb9);};}exports[_0xaa30('0x34')]=function(_0x3bc22f,_0x20916f){var _0x2276e0={},_0x1dce4a={},_0x4dae71={'count':0x0,'rows':[]};var _0x5addbf=_['map'](db[_0xaa30('0x35')][_0xaa30('0x36')],function(_0xb48ef3){return{'name':_0xb48ef3[_0xaa30('0x37')],'type':_0xb48ef3[_0xaa30('0x38')]['key']};});_0x1dce4a['model']=_[_0xaa30('0x39')](_0x5addbf,_0xaa30('0x32'));_0x1dce4a['query']=_[_0xaa30('0x3a')](_0x3bc22f['query']);_0x1dce4a[_0xaa30('0x3b')]=_['intersection'](_0x1dce4a[_0xaa30('0x3c')],_0x1dce4a[_0xaa30('0x3d')]);_0x2276e0['attributes']=_[_0xaa30('0x3e')](_0x1dce4a[_0xaa30('0x3c')],qs[_0xaa30('0x3f')](_0x3bc22f[_0xaa30('0x3d')][_0xaa30('0x3f')]));_0x2276e0[_0xaa30('0x40')]=_0x2276e0['attributes'][_0xaa30('0x41')]?_0x2276e0[_0xaa30('0x40')]:_0x1dce4a['model'];if(!_0x3bc22f[_0xaa30('0x3d')][_0xaa30('0x42')](_0xaa30('0x43'))){_0x2276e0['limit']=qs['limit'](_0x3bc22f[_0xaa30('0x3d')][_0xaa30('0x25')]);_0x2276e0[_0xaa30('0x24')]=qs[_0xaa30('0x24')](_0x3bc22f[_0xaa30('0x3d')][_0xaa30('0x24')]);}_0x2276e0['order']=qs['sort'](_0x3bc22f[_0xaa30('0x3d')][_0xaa30('0x44')]);_0x2276e0[_0xaa30('0x45')]=qs['filters'](_[_0xaa30('0x46')](_0x3bc22f[_0xaa30('0x3d')],_0x1dce4a[_0xaa30('0x3b')]),_0x5addbf);if(_0x3bc22f[_0xaa30('0x3d')]['filter']){_0x2276e0[_0xaa30('0x45')]=_[_0xaa30('0x47')](_0x2276e0[_0xaa30('0x45')],{'$or':_[_0xaa30('0x39')](_0x5addbf,function(_0x1f6f53){if(_0x1f6f53['type']!==_0xaa30('0x48')){var _0x29cf85={};_0x29cf85[_0x1f6f53[_0xaa30('0x32')]]={'$like':'%'+_0x3bc22f[_0xaa30('0x3d')][_0xaa30('0x49')]+'%'};return _0x29cf85;}})});}_0x2276e0=_[_0xaa30('0x47')]({},_0x2276e0,_0x3bc22f[_0xaa30('0x4a')]);var _0x17510b={'where':_0x2276e0['where']};return db['VoicePrefix'][_0xaa30('0x23')](_0x17510b)['then'](function(_0x5208f8){_0x4dae71['count']=_0x5208f8;if(_0x3bc22f[_0xaa30('0x3d')]['includeAll']){_0x2276e0[_0xaa30('0x4b')]=[{'all':!![]}];}return db['VoicePrefix'][_0xaa30('0x4c')](_0x2276e0);})[_0xaa30('0x2b')](function(_0x3f530e){_0x4dae71[_0xaa30('0x4d')]=_0x3f530e;return _0x4dae71;})[_0xaa30('0x2b')](respondWithFilteredResult(_0x20916f,_0x2276e0))[_0xaa30('0x4e')](handleError(_0x20916f,null));};exports[_0xaa30('0x4f')]=function(_0xc1ae21,_0x3302ff){var _0x521462={'raw':![],'where':{'id':_0xc1ae21['params']['id']}},_0x334639={};_0x334639[_0xaa30('0x3c')]=_[_0xaa30('0x3a')](db[_0xaa30('0x35')][_0xaa30('0x36')]);_0x334639[_0xaa30('0x3d')]=_['keys'](_0xc1ae21['query']);_0x334639[_0xaa30('0x3b')]=_['intersection'](_0x334639[_0xaa30('0x3c')],_0x334639[_0xaa30('0x3d')]);_0x521462[_0xaa30('0x40')]=_[_0xaa30('0x3e')](_0x334639[_0xaa30('0x3c')],qs[_0xaa30('0x3f')](_0xc1ae21[_0xaa30('0x3d')]['fields']));_0x521462[_0xaa30('0x40')]=_0x521462[_0xaa30('0x40')][_0xaa30('0x41')]?_0x521462['attributes']:_0x334639[_0xaa30('0x3c')];if(_0xc1ae21[_0xaa30('0x3d')]['includeAll']){_0x521462[_0xaa30('0x4b')]=[{'all':!![]}];}_0x521462=_['merge']({},_0x521462,_0xc1ae21[_0xaa30('0x4a')]);return db['VoicePrefix']['find'](_0x521462)[_0xaa30('0x2b')](handleEntityNotFound(_0x3302ff,null))['then'](respondWithResult(_0x3302ff,null))['catch'](handleError(_0x3302ff,null));};exports[_0xaa30('0x2c')]=function(_0x1083e2,_0x2574f5){return db[_0xaa30('0x35')][_0xaa30('0x50')]({'where':{'id':_0x1083e2[_0xaa30('0x51')]['id']}})['then'](handleEntityNotFound(_0x2574f5,null))[_0xaa30('0x2b')](removeEntity(_0x2574f5,null))[_0xaa30('0x4e')](handleError(_0x2574f5,null));};exports[_0xaa30('0x52')]=function(_0x57a5fa,_0x53bcaa){return db['VoicePrefix']['describe']()[_0xaa30('0x2b')](respondWithResult(_0x53bcaa,null))[_0xaa30('0x4e')](handleError(_0x53bcaa,null));};exports[_0xaa30('0x53')]=function(_0x1d5c15,_0x1cb3f9){var _0x1ed257;return db['sequelize'][_0xaa30('0x54')](function(_0x2db9d5){return db[_0xaa30('0x35')][_0xaa30('0x53')](_0x1d5c15['body'],{'transaction':_0x2db9d5})[_0xaa30('0x2b')](function(_0x2d23f8){_0x1ed257=_0x2d23f8[_0xaa30('0x2d')]({'plain':!![]});return db[_0xaa30('0x55')][_0xaa30('0x50')]({'where':{'id':_0x1ed257['VoiceExtensionId']},'raw':!![]})['then'](function(_0x34ca1c){return createVoicePrefixExtensions(_0x1ed257,_0x34ca1c,_0x2db9d5);});});})[_0xaa30('0x2b')](function(){var _0x3c4f07=_0x1d5c15['user'][_0xaa30('0x2d')]({'plain':!![]});if(!_0x3c4f07)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3c4f07[_0xaa30('0x56')]===_0xaa30('0x57')){var _0x483a01=_0x1ed257;return db[_0xaa30('0x58')][_0xaa30('0x50')]({'where':{'name':'VoicePrefixes','userProfileId':_0x3c4f07[_0xaa30('0x59')]},'raw':!![]})['then'](function(_0x5b227d){if(_0x5b227d&&_0x5b227d[_0xaa30('0x5a')]===0x0){return db[_0xaa30('0x2f')][_0xaa30('0x53')]({'name':_0x483a01['name'],'resourceId':_0x483a01['id'],'type':_0x5b227d[_0xaa30('0x32')],'sectionId':_0x5b227d['id']},{})[_0xaa30('0x2b')](function(){return _0x1ed257;});}else{return _0x1ed257;}})[_0xaa30('0x4e')](function(_0x949d84){logger[_0xaa30('0x30')](_0xaa30('0x5b'),_0x949d84);throw _0x949d84;});}return _0x1ed257;})[_0xaa30('0x2b')](respondWithResult(_0x1cb3f9,null))[_0xaa30('0x4e')](handleError(_0x1cb3f9,null));};function Extension(_0x242b5a,_0x426b90,_0xb1afa8,_0x2f84fa){this[_0xaa30('0x5c')]='from-sip';this[_0xaa30('0x5d')]=_0x242b5a;this[_0xaa30('0x5e')]=_0xb1afa8;this[_0xaa30('0x38')]='system';this[_0xaa30('0x5f')]=_0xaa30('0x60');this[_0xaa30('0x61')]=_0x426b90;this[_0xaa30('0x62')]=_0x2f84fa;}function createVoicePrefixExtensions(_0x9ee658,_0x2c5959,_0x4f1d54){return new BPromise(function(_0x366205,_0x4f5222){var _0x36242e=new Extension(formatPrefixName(_0x9ee658[_0xaa30('0x63')]),0x1,_0xaa30('0x64'),_0xaa30('0x65'));_0x36242e['VoicePrefixId']=_0x9ee658['id'];return db[_0xaa30('0x55')][_0xaa30('0x53')](_0x36242e,{'transaction':_0x4f1d54})['then'](function(_0x26f6f9){var _0x62b307=_0x26f6f9[_0xaa30('0x2d')]({'plain':!![]});var _0x16097e=_[_0xaa30('0x39')](addVoicePrefixExtensions(_0x9ee658,_0x2c5959),function(_0x13ee8f){_0x13ee8f['VoiceExtensionId']=_0x62b307['id'];_0x13ee8f[_0xaa30('0x66')]=_0x9ee658['id'];return _0x13ee8f;});return db[_0xaa30('0x55')][_0xaa30('0x67')](_0x16097e,{'transaction':_0x4f1d54})[_0xaa30('0x2b')](function(_0x334ef1){if(!_0x334ef1){return _0x4f5222(_0xaa30('0x68'));}else{return _0x366205(_0x334ef1);}})[_0xaa30('0x4e')](function(_0x42da00){return _0x4f5222(_0x42da00);});});;});};function addVoicePrefixExtensions(_0x4318a2,_0x6c968e){var _0x46bdc4=[];var _0x2f4d77=formatPrefixName(_0x4318a2[_0xaa30('0x63')]);_0x46bdc4['push'](new Extension(_0x2f4d77,0x2,_0xaa30('0x69'),'CDR(prefix)='+_0x4318a2[_0xaa30('0x32')]));if(_0x4318a2['callerIdAll']){_0x46bdc4[_0xaa30('0x6a')](new Extension(_0x2f4d77,0x3,_0xaa30('0x69'),_0xaa30('0x6b')+_0x4318a2['callerIdAll']));}else{_0x46bdc4[_0xaa30('0x6a')](new Extension(_0x2f4d77,0x3,_0xaa30('0x64'),'No\x20callerid\x20available'));}_0x46bdc4[_0xaa30('0x6a')](new Extension(_0x2f4d77,0x4,'goto',_0x6c968e[_0xaa30('0x5c')]+','+'${EXTEN:'+(0x8+_0x4318a2['name'][_0xaa30('0x41')])+'}'+','+0x1));return _0x46bdc4;}function formatPrefixName(_0x99d382){var _0xd3e52e='_';for(var _0x313bfa=0x0;_0x313bfa<_0x99d382[_0xaa30('0x41')];_0x313bfa++){if(_0x99d382[_0xaa30('0x6c')](_0x313bfa)=='-'){_0xd3e52e+=_0x99d382[_0xaa30('0x6c')](_0x313bfa);}else{_0xd3e52e+='['+_0x99d382['charAt'](_0x313bfa)+']';}}_0xd3e52e+='.';return _0xd3e52e;}exports[_0xaa30('0x2a')]=function(_0x3f2683,_0x1386a9,_0x4aeb5d){var _0x1f8a61=_0x3f2683[_0xaa30('0x6d')];_0x1f8a61[_0xaa30('0x63')]='system-'+_0x1f8a61[_0xaa30('0x32')]+'-';return db['sequelize'][_0xaa30('0x54')](function(_0x4d2787){return db['VoicePrefix'][_0xaa30('0x2a')](_0x1f8a61,{'where':{'id':_0x1f8a61['id']},'transaction':_0x4d2787})[_0xaa30('0x2b')](function(){return db['VoiceExtension'][_0xaa30('0x2c')]({'where':{'VoicePrefixId':_0x1f8a61['id']},'transaction':_0x4d2787})[_0xaa30('0x2b')](function(){return db[_0xaa30('0x55')]['find']({'where':{'id':_0x1f8a61[_0xaa30('0x6e')]},'raw':!![]})[_0xaa30('0x2b')](function(_0x23daeb){return createVoicePrefixExtensions(_0x1f8a61,_0x23daeb,_0x4d2787);});});});})[_0xaa30('0x2b')](function(){return db[_0xaa30('0x35')][_0xaa30('0x6f')](_0x1f8a61['id']);})[_0xaa30('0x2b')](respondWithResult(_0x1386a9,null))['catch'](handleError(_0x1386a9,null));};exports[_0xaa30('0x70')]=function(_0x37c3ee,_0x112dc3,_0x25977d){return db['VoicePrefix'][_0xaa30('0x50')]({'where':{'id':_0x37c3ee[_0xaa30('0x51')]['id']}})['then'](handleEntityNotFound(_0x112dc3,null))[_0xaa30('0x2b')](function(_0x2d9dd8){if(_0x2d9dd8){return _0x2d9dd8[_0xaa30('0x70')](_0x37c3ee[_0xaa30('0x6d')][_0xaa30('0x71')],_[_0xaa30('0x72')](_0x37c3ee['body'],[_0xaa30('0x71'),'id'])||{})[_0xaa30('0x73')](function(_0x5948b4){for(var _0x2aa0ce=0x0;_0x2aa0ce<_0x37c3ee[_0xaa30('0x6d')][_0xaa30('0x71')][_0xaa30('0x41')];_0x2aa0ce+=0x1){socket[_0xaa30('0x74')]('userVoicePrefix:save',{'UserId':Number(_0x37c3ee[_0xaa30('0x6d')][_0xaa30('0x71')][_0x2aa0ce]),'VoicePrefixId':Number(_0x37c3ee[_0xaa30('0x51')]['id'])});}return _0x5948b4;});}})[_0xaa30('0x2b')](respondWithResult(_0x112dc3,null))[_0xaa30('0x4e')](handleError(_0x112dc3,null));};exports[_0xaa30('0x75')]=function(_0x5d3d83,_0x1e3a19,_0x467134){return db['VoicePrefix']['find']({'where':{'id':_0x5d3d83[_0xaa30('0x51')]['id']}})[_0xaa30('0x2b')](handleEntityNotFound(_0x1e3a19,null))[_0xaa30('0x2b')](function(_0x100f18){if(_0x100f18){return _0x100f18[_0xaa30('0x75')](_0x5d3d83[_0xaa30('0x3d')][_0xaa30('0x71')])['then'](function(){if(_['isArray'](_0x5d3d83['query'][_0xaa30('0x71')])){for(var _0x25ebba=0x0;_0x25ebba<_0x5d3d83[_0xaa30('0x3d')][_0xaa30('0x71')][_0xaa30('0x41')];_0x25ebba+=0x1){socket['emit'](_0xaa30('0x76'),{'UserId':Number(_0x5d3d83[_0xaa30('0x3d')][_0xaa30('0x71')][_0x25ebba]),'VoicePrefixId':Number(_0x5d3d83[_0xaa30('0x51')]['id'])});}}else{socket[_0xaa30('0x74')](_0xaa30('0x76'),{'UserId':Number(_0x5d3d83[_0xaa30('0x3d')][_0xaa30('0x71')]),'VoicePrefixId':Number(_0x5d3d83['params']['id'])});}});}})['then'](respondWithStatusCode(_0x1e3a19,null))['catch'](handleError(_0x1e3a19,null));};exports[_0xaa30('0x77')]=function(_0x408362,_0x541d3b,_0x775047){var _0xe9e4={};var _0x15e3ae={};var _0x33551c;var _0x404f82;return db['VoicePrefix'][_0xaa30('0x78')]({'where':{'id':_0x408362[_0xaa30('0x51')]['id']}})[_0xaa30('0x2b')](handleEntityNotFound(_0x541d3b,null))['then'](function(_0x21b87b){if(_0x21b87b){_0x33551c=_0x21b87b;_0x15e3ae[_0xaa30('0x3c')]=_[_0xaa30('0x3a')](db[_0xaa30('0x79')][_0xaa30('0x36')]);_0x15e3ae[_0xaa30('0x3d')]=_[_0xaa30('0x3a')](_0x408362['query']);_0x15e3ae[_0xaa30('0x3b')]=_[_0xaa30('0x3e')](_0x15e3ae[_0xaa30('0x3c')],_0x15e3ae[_0xaa30('0x3d')]);_0xe9e4[_0xaa30('0x40')]=_[_0xaa30('0x3e')](_0x15e3ae[_0xaa30('0x3c')],qs[_0xaa30('0x3f')](_0x408362[_0xaa30('0x3d')][_0xaa30('0x3f')]));_0xe9e4[_0xaa30('0x40')]=_0xe9e4[_0xaa30('0x40')][_0xaa30('0x41')]?_0xe9e4['attributes']:_0x15e3ae[_0xaa30('0x3c')];_0xe9e4['order']=qs[_0xaa30('0x44')](_0x408362[_0xaa30('0x3d')][_0xaa30('0x44')]);_0xe9e4[_0xaa30('0x45')]=qs[_0xaa30('0x3b')](_[_0xaa30('0x46')](_0x408362[_0xaa30('0x3d')],_0x15e3ae[_0xaa30('0x3b')]));if(_0x408362[_0xaa30('0x3d')][_0xaa30('0x49')]){_0xe9e4[_0xaa30('0x45')]=_[_0xaa30('0x47')](_0xe9e4[_0xaa30('0x45')],{'$or':_[_0xaa30('0x39')](_0xe9e4[_0xaa30('0x40')],function(_0x3744b3){var _0x35a47f={};_0x35a47f[_0x3744b3]={'$like':'%'+_0x408362[_0xaa30('0x3d')][_0xaa30('0x49')]+'%'};return _0x35a47f;})});}_0xe9e4=_['merge']({},_0xe9e4,_0x408362[_0xaa30('0x4a')]);return _0x33551c[_0xaa30('0x77')](_0xe9e4);}})[_0xaa30('0x2b')](function(_0x3a67b3){if(_0x3a67b3){_0x404f82=_0x3a67b3[_0xaa30('0x41')];if(!_0x408362[_0xaa30('0x3d')][_0xaa30('0x42')]('nolimit')){_0xe9e4[_0xaa30('0x25')]=qs[_0xaa30('0x25')](_0x408362['query'][_0xaa30('0x25')]);_0xe9e4[_0xaa30('0x24')]=qs['offset'](_0x408362[_0xaa30('0x3d')][_0xaa30('0x24')]);}return _0x33551c[_0xaa30('0x77')](_0xe9e4);}})[_0xaa30('0x2b')](function(_0x5eb209){if(_0x5eb209){return _0x5eb209?{'count':_0x404f82,'rows':_0x5eb209}:null;}})[_0xaa30('0x2b')](respondWithResult(_0x541d3b,null))['catch'](handleError(_0x541d3b,null));};exports[_0xaa30('0x7a')]=function(_0x41480f,_0x24f60f,_0x3fb561){var _0x24a3af={};var _0x4412d4={};var _0x45ffba;var _0x2e73e1;return db[_0xaa30('0x35')]['findOne']({'where':{'id':_0x41480f[_0xaa30('0x51')]['id']}})[_0xaa30('0x2b')](handleEntityNotFound(_0x24f60f,null))['then'](function(_0x1f48c1){if(_0x1f48c1){_0x45ffba=_0x1f48c1;_0x4412d4[_0xaa30('0x3c')]=_['keys'](db[_0xaa30('0x7b')][_0xaa30('0x36')]);_0x4412d4['query']=_[_0xaa30('0x3a')](_0x41480f['query']);_0x4412d4['filters']=_[_0xaa30('0x3e')](_0x4412d4[_0xaa30('0x3c')],_0x4412d4['query']);_0x24a3af['attributes']=_[_0xaa30('0x3e')](_0x4412d4[_0xaa30('0x3c')],qs['fields'](_0x41480f[_0xaa30('0x3d')]['fields']));_0x24a3af['attributes']=_0x24a3af[_0xaa30('0x40')]['length']?_0x24a3af[_0xaa30('0x40')]:_0x4412d4['model'];_0x24a3af[_0xaa30('0x7c')]=qs[_0xaa30('0x44')](_0x41480f[_0xaa30('0x3d')][_0xaa30('0x44')]);_0x24a3af[_0xaa30('0x45')]=qs[_0xaa30('0x3b')](_[_0xaa30('0x46')](_0x41480f[_0xaa30('0x3d')],_0x4412d4[_0xaa30('0x3b')]));if(_0x41480f['query']['filter']){_0x24a3af[_0xaa30('0x45')]=_[_0xaa30('0x47')](_0x24a3af[_0xaa30('0x45')],{'$or':_['map'](_0x24a3af['attributes'],function(_0x46df1d){var _0x554b6b={};_0x554b6b[_0x46df1d]={'$like':'%'+_0x41480f[_0xaa30('0x3d')][_0xaa30('0x49')]+'%'};return _0x554b6b;})});}_0x24a3af=_[_0xaa30('0x47')]({},_0x24a3af,_0x41480f[_0xaa30('0x4a')]);return _0x45ffba['getTeams'](_0x24a3af);}})[_0xaa30('0x2b')](function(_0x5d061b){if(_0x5d061b){_0x2e73e1=_0x5d061b[_0xaa30('0x41')];if(!_0x41480f[_0xaa30('0x3d')][_0xaa30('0x42')](_0xaa30('0x43'))){_0x24a3af['limit']=qs[_0xaa30('0x25')](_0x41480f[_0xaa30('0x3d')]['limit']);_0x24a3af[_0xaa30('0x24')]=qs['offset'](_0x41480f[_0xaa30('0x3d')]['offset']);}return _0x45ffba[_0xaa30('0x7a')](_0x24a3af);}})[_0xaa30('0x2b')](function(_0x11dd5e){if(_0x11dd5e){return _0x11dd5e?{'count':_0x2e73e1,'rows':_0x11dd5e}:null;}})[_0xaa30('0x2b')](respondWithResult(_0x24f60f,null))[_0xaa30('0x4e')](handleError(_0x24f60f,null));};exports[_0xaa30('0x7d')]=function(_0x2f90db,_0x3f382a,_0x36f739){var _0x5687ef=_0x2f90db[_0xaa30('0x6d')][_0xaa30('0x71')];var _0x21e8c7;return db['Team'][_0xaa30('0x4c')]({'where':{'id':_0x5687ef},'attributes':['id'],'include':[{'model':db[_0xaa30('0x79')],'as':_0xaa30('0x7e'),'attributes':['id',_0xaa30('0x32'),_0xaa30('0x7f'),_0xaa30('0x80'),_0xaa30('0x81')],'raw':!![]}]})[_0xaa30('0x2b')](function(_0x16e95c){if(_0x16e95c){_0x21e8c7=_0x16e95c;var _0x4dc93c=_[_0xaa30('0x82')](_0x16e95c,function(_0x25dca3){var _0x13521a=_0x25dca3['get']({'plain':!![]});return _0x13521a[_0xaa30('0x7e')];});return db[_0xaa30('0x35')]['find']({'where':{'id':_0x2f90db[_0xaa30('0x51')]['id']}})['then'](function(_0x51a37a){return db[_0xaa30('0x83')][_0xaa30('0x54')](function(_0xcf7c59){return _0x51a37a[_0xaa30('0x7d')](_0x5687ef,{'transaction':_0xcf7c59})['then'](function(){return BPromise['each'](_0x21e8c7,function(_0x4240d0){return db[_0xaa30('0x84')][_0xaa30('0x85')]({'TeamId':_0x4240d0['id'],'VoicePrefixId':_0x2f90db[_0xaa30('0x51')]['id']},{'transaction':_0xcf7c59});});})[_0xaa30('0x2b')](function(){return BPromise['each'](_0x4dc93c,function(_0x7db5d7){return db['UserVoicePrefix'][_0xaa30('0x86')]({'where':{'UserId':_0x7db5d7['id'],'VoicePrefixId':_0x2f90db[_0xaa30('0x51')]['id']},'transaction':_0xcf7c59});});})[_0xaa30('0x2b')](function(){_0x4dc93c['forEach'](function(_0x1c25b1){socket[_0xaa30('0x74')](_0xaa30('0x87'),{'UserId':_0x1c25b1['id'],'VoicePrefixId':_0x51a37a['id']});});});});});}})[_0xaa30('0x2b')](respondWithStatusCode(_0x3f382a,null))[_0xaa30('0x4e')](handleError(_0x3f382a,null));};exports[_0xaa30('0x88')]=function(_0x51fb85,_0x133a0f,_0x1bd3c2){return db['Team']['findAll']({'where':{'id':_0x51fb85[_0xaa30('0x3d')][_0xaa30('0x71')]},'attributes':['id'],'include':[{'model':db[_0xaa30('0x79')],'as':_0xaa30('0x7e'),'attributes':['id'],'raw':!![]}]})[_0xaa30('0x2b')](handleEntityNotFound(_0x133a0f,null))[_0xaa30('0x2b')](function(_0x3dd250){var _0x2ec205=_[_0xaa30('0x39')](_0x3dd250,'id');var _0x211916=[];var _0x4bba25=[];var _0x73c665=squel['select']();_0x73c665['field'](_0xaa30('0x89'))[_0xaa30('0x8a')](_0xaa30('0x8b'),'tq')['join'](_0xaa30('0x8c'),'ut',_0xaa30('0x8d'))['where'](_0xaa30('0x8e'),_0x51fb85[_0xaa30('0x51')]['id']);for(var _0x2ebaa0=0x0;_0x2ebaa0<_0x3dd250[_0xaa30('0x41')];_0x2ebaa0+=0x1){let _0x420276=_0x3dd250[_0x2ebaa0];for(var _0x2c48a2=0x0;_0x2c48a2<_0x420276['Agents'][_0xaa30('0x41')];_0x2c48a2+=0x1){let _0x206fc4=_0x420276[_0xaa30('0x7e')][_0x2c48a2];var _0x24fccc=_0x73c665[_0xaa30('0x8f')]();_0x24fccc[_0xaa30('0x45')](_0xaa30('0x90'),_0x206fc4['id']);_0x4bba25['push'](db['sequelize'][_0xaa30('0x3d')](_0x24fccc[_0xaa30('0x91')](),{'type':db[_0xaa30('0x83')][_0xaa30('0x92')][_0xaa30('0x93')]})[_0xaa30('0x2b')](function(_0x162810){if(_0x162810[_0xaa30('0x41')]===0x1){return _0x206fc4['id'];}else{var _0x2ed461=_[_0xaa30('0x94')](_[_0xaa30('0x39')](_0x162810,'TeamId'),function(_0x5c21e){return _[_0xaa30('0x95')](_0x2ec205,_0x5c21e);});if(_0x2ed461){return _0x206fc4['id'];}}}));}}return BPromise[_0xaa30('0x96')](_0x4bba25)[_0xaa30('0x2b')](function(_0x46c9a5){_0x211916=_(_0x211916)[_0xaa30('0x97')](_0x46c9a5)[_0xaa30('0x98')]()[_0xaa30('0x99')]();return db[_0xaa30('0x35')][_0xaa30('0x50')]({'where':{'id':_0x51fb85[_0xaa30('0x51')]['id']}})[_0xaa30('0x2b')](function(_0x4cc3f0){return db[_0xaa30('0x83')][_0xaa30('0x54')](function(_0x31bdf6){return _0x4cc3f0['removeTeams'](_0x51fb85['query'][_0xaa30('0x71')],{'transaction':_0x31bdf6})['then'](function(){if(!_[_0xaa30('0x9a')](_0x211916)){return _0x4cc3f0['removeAgents'](_0x211916,{'transaction':_0x31bdf6});}})[_0xaa30('0x2b')](function(){_0x211916[_0xaa30('0x9b')](function(_0xb148d9){socket[_0xaa30('0x74')]('userVoicePrefix:remove',{'UserId':_0xb148d9,'VoicePrefixId':_0x4cc3f0['id']});});});});});});})[_0xaa30('0x2b')](respondWithStatusCode(_0x133a0f,null))[_0xaa30('0x4e')](handleError(_0x133a0f,null));}; \ No newline at end of file +var _0x351d=['isEmpty','forEach','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','redis','defaults','localhost','./voicePrefix.socket','sendStatus','status','offset','undefined','limit','count','set','json','reject','save','update','then','destroy','VoicePrefixes','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','includeAll','include','VoicePrefix','findAll','catch','show','params','length','merge','options','describe','create','transaction','body','VoiceExtension','VoiceExtensionId','user','get','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','Extensions\x20creation\x20failed','CDR(prefix)=','push','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','addAgents','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','order','Team','getTeams','addTeams','online','voicePause','interface','flatMap','sequelize','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','removeTeams','Agents','select','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','toString','QueryTypes','TeamId','all','union','compact','value'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x351d,0x90));var _0xd351=function(_0x19b80b,_0x11126e){_0x19b80b=_0x19b80b-0x0;var _0x1539c8=_0x351d[_0x19b80b];return _0x1539c8;};'use strict';var emlformat=require(_0xd351('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd351('0x1'));var jsonpatch=require(_0xd351('0x2'));var rp=require(_0xd351('0x3'));var moment=require('moment');var BPromise=require(_0xd351('0x4'));var Mustache=require('mustache');var util=require(_0xd351('0x5'));var path=require(_0xd351('0x6'));var sox=require('sox');var csv=require(_0xd351('0x7'));var ejs=require(_0xd351('0x8'));var fs=require('fs');var fs_extra=require(_0xd351('0x9'));var _=require('lodash');var squel=require(_0xd351('0xa'));var crypto=require(_0xd351('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd351('0xc'));var toCsv=require(_0xd351('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd351('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xd351('0xe'));var as=require(_0xd351('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd351('0x10'))(_0xd351('0x11'));var utils=require('../../config/utils');var config=require(_0xd351('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xd351('0x13')]=_[_0xd351('0x14')](config[_0xd351('0x13')],{'host':_0xd351('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd351('0x13')]));require(_0xd351('0x16'))['register'](socket);function respondWithStatusCode(_0xc5a145,_0xb106ef){_0xb106ef=_0xb106ef||0xcc;return function(_0x3c2299){if(_0x3c2299){return _0xc5a145[_0xd351('0x17')](_0xb106ef);}return _0xc5a145[_0xd351('0x18')](_0xb106ef)['end']();};}function respondWithResult(_0x9f790f,_0x49d8bb){_0x49d8bb=_0x49d8bb||0xc8;return function(_0x5bdc03){if(_0x5bdc03){return _0x9f790f[_0xd351('0x18')](_0x49d8bb)['json'](_0x5bdc03);}};}function respondWithFilteredResult(_0x21e591,_0x1de35f){return function(_0x4e0164){if(_0x4e0164){var _0x4c6693=typeof _0x1de35f[_0xd351('0x19')]===_0xd351('0x1a')&&typeof _0x1de35f[_0xd351('0x1b')]===_0xd351('0x1a');var _0x51f265=_0x4e0164[_0xd351('0x1c')];var _0x4abbed=_0x4c6693?0x0:_0x1de35f['offset'];var _0x37d3ac=_0x4c6693?_0x4e0164['count']:_0x1de35f[_0xd351('0x19')]+_0x1de35f[_0xd351('0x1b')];var _0x3634c9;if(_0x37d3ac>=_0x51f265){_0x37d3ac=_0x51f265;_0x3634c9=0xc8;}else{_0x3634c9=0xce;}_0x21e591[_0xd351('0x18')](_0x3634c9);return _0x21e591[_0xd351('0x1d')]('Content-Range',_0x4abbed+'-'+_0x37d3ac+'/'+_0x51f265)[_0xd351('0x1e')](_0x4e0164);}return null;};}function patchUpdates(_0xbbc58){return function(_0x241265){try{jsonpatch['apply'](_0x241265,_0xbbc58,!![]);}catch(_0x1ce7f7){return BPromise[_0xd351('0x1f')](_0x1ce7f7);}return _0x241265[_0xd351('0x20')]();};}function saveUpdates(_0x59fb6d,_0x1ce279){return function(_0x34a5cb){if(_0x34a5cb){return _0x34a5cb[_0xd351('0x21')](_0x59fb6d)[_0xd351('0x22')](function(_0x489c9a){return _0x489c9a;});}return null;};}function removeEntity(_0x40f7f3,_0x483c92){return function(_0x358bff){if(_0x358bff){return _0x358bff[_0xd351('0x23')]()['then'](function(){var _0x2648d0=_0x358bff['get']({'plain':!![]});var _0x50d67e=_0xd351('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x50d67e,'resourceId':_0x2648d0['id']}})[_0xd351('0x22')](function(){return _0x358bff;});})['then'](function(){_0x40f7f3[_0xd351('0x18')](0xcc)[_0xd351('0x25')]();});}};}function handleEntityNotFound(_0x407b50,_0x4d3f48){return function(_0x71ce9c){if(!_0x71ce9c){_0x407b50['sendStatus'](0x194);}return _0x71ce9c;};}function handleError(_0x1c826b,_0x50039b){_0x50039b=_0x50039b||0x1f4;return function(_0x5f07b1){logger[_0xd351('0x26')](_0x5f07b1[_0xd351('0x27')]);if(_0x5f07b1[_0xd351('0x28')]){delete _0x5f07b1[_0xd351('0x28')];}_0x1c826b['status'](_0x50039b)[_0xd351('0x29')](_0x5f07b1);};}exports[_0xd351('0x2a')]=function(_0x38023c,_0x41da60){var _0x140591={},_0x205c79={},_0x103a7b={'count':0x0,'rows':[]};var _0x898949=_[_0xd351('0x2b')](db['VoicePrefix'][_0xd351('0x2c')],function(_0x453270){return{'name':_0x453270[_0xd351('0x2d')],'type':_0x453270[_0xd351('0x2e')]['key']};});_0x205c79[_0xd351('0x2f')]=_[_0xd351('0x2b')](_0x898949,_0xd351('0x28'));_0x205c79[_0xd351('0x30')]=_[_0xd351('0x31')](_0x38023c[_0xd351('0x30')]);_0x205c79[_0xd351('0x32')]=_[_0xd351('0x33')](_0x205c79[_0xd351('0x2f')],_0x205c79['query']);_0x140591['attributes']=_[_0xd351('0x33')](_0x205c79[_0xd351('0x2f')],qs[_0xd351('0x34')](_0x38023c[_0xd351('0x30')][_0xd351('0x34')]));_0x140591[_0xd351('0x35')]=_0x140591['attributes']['length']?_0x140591[_0xd351('0x35')]:_0x205c79['model'];if(!_0x38023c[_0xd351('0x30')][_0xd351('0x36')](_0xd351('0x37'))){_0x140591[_0xd351('0x1b')]=qs[_0xd351('0x1b')](_0x38023c[_0xd351('0x30')][_0xd351('0x1b')]);_0x140591[_0xd351('0x19')]=qs[_0xd351('0x19')](_0x38023c[_0xd351('0x30')][_0xd351('0x19')]);}_0x140591['order']=qs[_0xd351('0x38')](_0x38023c['query'][_0xd351('0x38')]);_0x140591[_0xd351('0x39')]=qs[_0xd351('0x32')](_[_0xd351('0x3a')](_0x38023c[_0xd351('0x30')],_0x205c79[_0xd351('0x32')]),_0x898949);if(_0x38023c['query'][_0xd351('0x3b')]){_0x140591[_0xd351('0x39')]=_['merge'](_0x140591[_0xd351('0x39')],{'$or':_[_0xd351('0x2b')](_0x898949,function(_0x382f5b){if(_0x382f5b[_0xd351('0x2e')]!==_0xd351('0x3c')){var _0x5cc105={};_0x5cc105[_0x382f5b['name']]={'$like':'%'+_0x38023c[_0xd351('0x30')][_0xd351('0x3b')]+'%'};return _0x5cc105;}})});}_0x140591=_['merge']({},_0x140591,_0x38023c['options']);var _0x16677f={'where':_0x140591[_0xd351('0x39')]};return db['VoicePrefix']['count'](_0x16677f)[_0xd351('0x22')](function(_0x18f9d1){_0x103a7b[_0xd351('0x1c')]=_0x18f9d1;if(_0x38023c[_0xd351('0x30')][_0xd351('0x3d')]){_0x140591[_0xd351('0x3e')]=[{'all':!![]}];}return db[_0xd351('0x3f')][_0xd351('0x40')](_0x140591);})[_0xd351('0x22')](function(_0x553360){_0x103a7b['rows']=_0x553360;return _0x103a7b;})[_0xd351('0x22')](respondWithFilteredResult(_0x41da60,_0x140591))[_0xd351('0x41')](handleError(_0x41da60,null));};exports[_0xd351('0x42')]=function(_0x35f38f,_0x2bdd8f){var _0x4332e7={'raw':![],'where':{'id':_0x35f38f[_0xd351('0x43')]['id']}},_0xeaf4dc={};_0xeaf4dc[_0xd351('0x2f')]=_[_0xd351('0x31')](db[_0xd351('0x3f')][_0xd351('0x2c')]);_0xeaf4dc[_0xd351('0x30')]=_[_0xd351('0x31')](_0x35f38f[_0xd351('0x30')]);_0xeaf4dc[_0xd351('0x32')]=_['intersection'](_0xeaf4dc[_0xd351('0x2f')],_0xeaf4dc[_0xd351('0x30')]);_0x4332e7[_0xd351('0x35')]=_['intersection'](_0xeaf4dc[_0xd351('0x2f')],qs[_0xd351('0x34')](_0x35f38f[_0xd351('0x30')][_0xd351('0x34')]));_0x4332e7[_0xd351('0x35')]=_0x4332e7['attributes'][_0xd351('0x44')]?_0x4332e7['attributes']:_0xeaf4dc[_0xd351('0x2f')];if(_0x35f38f[_0xd351('0x30')]['includeAll']){_0x4332e7['include']=[{'all':!![]}];}_0x4332e7=_[_0xd351('0x45')]({},_0x4332e7,_0x35f38f[_0xd351('0x46')]);return db[_0xd351('0x3f')]['find'](_0x4332e7)[_0xd351('0x22')](handleEntityNotFound(_0x2bdd8f,null))[_0xd351('0x22')](respondWithResult(_0x2bdd8f,null))['catch'](handleError(_0x2bdd8f,null));};exports[_0xd351('0x23')]=function(_0x53a2e8,_0x1eb5f3){return db[_0xd351('0x3f')]['find']({'where':{'id':_0x53a2e8['params']['id']}})[_0xd351('0x22')](handleEntityNotFound(_0x1eb5f3,null))['then'](removeEntity(_0x1eb5f3,null))[_0xd351('0x41')](handleError(_0x1eb5f3,null));};exports[_0xd351('0x47')]=function(_0x9f1cd0,_0x4a27e3){return db[_0xd351('0x3f')]['describe']()['then'](respondWithResult(_0x4a27e3,null))['catch'](handleError(_0x4a27e3,null));};exports[_0xd351('0x48')]=function(_0x292af3,_0x334029){var _0x5a2e9b;return db['sequelize'][_0xd351('0x49')](function(_0x42f248){return db['VoicePrefix'][_0xd351('0x48')](_0x292af3[_0xd351('0x4a')],{'transaction':_0x42f248})['then'](function(_0x24ee0f){_0x5a2e9b=_0x24ee0f['get']({'plain':!![]});return db[_0xd351('0x4b')]['find']({'where':{'id':_0x5a2e9b[_0xd351('0x4c')]},'raw':!![]})[_0xd351('0x22')](function(_0x169ab1){return createVoicePrefixExtensions(_0x5a2e9b,_0x169ab1,_0x42f248);});});})[_0xd351('0x22')](function(){var _0xb5f3ee=_0x292af3[_0xd351('0x4d')][_0xd351('0x4e')]({'plain':!![]});if(!_0xb5f3ee)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xb5f3ee['role']===_0xd351('0x4d')){var _0x624224=_0x5a2e9b;return db['UserProfileSection'][_0xd351('0x4f')]({'where':{'name':_0xd351('0x24'),'userProfileId':_0xb5f3ee[_0xd351('0x50')]},'raw':!![]})['then'](function(_0x169122){if(_0x169122&&_0x169122['autoAssociation']===0x0){return db['UserProfileResource'][_0xd351('0x48')]({'name':_0x624224[_0xd351('0x28')],'resourceId':_0x624224['id'],'type':_0x169122['name'],'sectionId':_0x169122['id']},{})[_0xd351('0x22')](function(){return _0x5a2e9b;});}else{return _0x5a2e9b;}})[_0xd351('0x41')](function(_0x2d9747){logger[_0xd351('0x26')](_0xd351('0x51'),_0x2d9747);throw _0x2d9747;});}return _0x5a2e9b;})[_0xd351('0x22')](respondWithResult(_0x334029,null))['catch'](handleError(_0x334029,null));};function Extension(_0x1e1173,_0x2a7390,_0x36fb5b,_0x8461b){this[_0xd351('0x52')]=_0xd351('0x53');this[_0xd351('0x54')]=_0x1e1173;this['app']=_0x36fb5b;this[_0xd351('0x2e')]='system';this[_0xd351('0x55')]=_0xd351('0x56');this[_0xd351('0x57')]=_0x2a7390;this[_0xd351('0x58')]=_0x8461b;}function createVoicePrefixExtensions(_0x70cdb,_0x4eaf18,_0x413931){return new BPromise(function(_0x4c8038,_0x4685fa){var _0x45bcc7=new Extension(formatPrefixName(_0x70cdb[_0xd351('0x59')]),0x1,_0xd351('0x5a'),_0xd351('0x5b'));_0x45bcc7['VoicePrefixId']=_0x70cdb['id'];return db['VoiceExtension'][_0xd351('0x48')](_0x45bcc7,{'transaction':_0x413931})[_0xd351('0x22')](function(_0x4b9367){var _0x2d2655=_0x4b9367[_0xd351('0x4e')]({'plain':!![]});var _0x2718e9=_['map'](addVoicePrefixExtensions(_0x70cdb,_0x4eaf18),function(_0x2b47ab){_0x2b47ab[_0xd351('0x4c')]=_0x2d2655['id'];_0x2b47ab[_0xd351('0x5c')]=_0x70cdb['id'];return _0x2b47ab;});return db[_0xd351('0x4b')]['bulkCreate'](_0x2718e9,{'transaction':_0x413931})['then'](function(_0x40c78b){if(!_0x40c78b){return _0x4685fa(_0xd351('0x5d'));}else{return _0x4c8038(_0x40c78b);}})[_0xd351('0x41')](function(_0xa000b4){return _0x4685fa(_0xa000b4);});});;});};function addVoicePrefixExtensions(_0x36b38f,_0x3b0993){var _0x2c83fe=[];var _0x5e2e06=formatPrefixName(_0x36b38f[_0xd351('0x59')]);_0x2c83fe['push'](new Extension(_0x5e2e06,0x2,'Set',_0xd351('0x5e')+_0x36b38f[_0xd351('0x28')]));if(_0x36b38f['callerIdAll']){_0x2c83fe[_0xd351('0x5f')](new Extension(_0x5e2e06,0x3,'Set','PREFIX-CALLERIDALL='+_0x36b38f['callerIdAll']));}else{_0x2c83fe[_0xd351('0x5f')](new Extension(_0x5e2e06,0x3,_0xd351('0x5a'),_0xd351('0x60')));}_0x2c83fe['push'](new Extension(_0x5e2e06,0x4,_0xd351('0x61'),_0x3b0993[_0xd351('0x52')]+','+_0xd351('0x62')+(0x8+_0x36b38f[_0xd351('0x28')][_0xd351('0x44')])+'}'+','+0x1));return _0x2c83fe;}function formatPrefixName(_0x475534){var _0x15fcab='_';for(var _0x6bf19c=0x0;_0x6bf19c<_0x475534[_0xd351('0x44')];_0x6bf19c++){if(_0x475534[_0xd351('0x63')](_0x6bf19c)=='-'){_0x15fcab+=_0x475534[_0xd351('0x63')](_0x6bf19c);}else{_0x15fcab+='['+_0x475534['charAt'](_0x6bf19c)+']';}}_0x15fcab+='.';return _0x15fcab;}exports[_0xd351('0x21')]=function(_0x2d59a5,_0x431e91,_0xcc7a10){var _0xf24a29=_0x2d59a5[_0xd351('0x4a')];_0xf24a29['prefix']=_0xd351('0x64')+_0xf24a29[_0xd351('0x28')]+'-';return db['sequelize']['transaction'](function(_0x436e1d){return db[_0xd351('0x3f')][_0xd351('0x21')](_0xf24a29,{'where':{'id':_0xf24a29['id']},'transaction':_0x436e1d})[_0xd351('0x22')](function(){return db[_0xd351('0x4b')][_0xd351('0x23')]({'where':{'VoicePrefixId':_0xf24a29['id']},'transaction':_0x436e1d})[_0xd351('0x22')](function(){return db[_0xd351('0x4b')][_0xd351('0x4f')]({'where':{'id':_0xf24a29['VoiceExtensionId']},'raw':!![]})[_0xd351('0x22')](function(_0x129623){return createVoicePrefixExtensions(_0xf24a29,_0x129623,_0x436e1d);});});});})['then'](function(){return db[_0xd351('0x3f')]['findById'](_0xf24a29['id']);})[_0xd351('0x22')](respondWithResult(_0x431e91,null))['catch'](handleError(_0x431e91,null));};exports[_0xd351('0x65')]=function(_0x406d8a,_0xbd31ca,_0x451445){return db[_0xd351('0x3f')][_0xd351('0x4f')]({'where':{'id':_0x406d8a[_0xd351('0x43')]['id']}})['then'](handleEntityNotFound(_0xbd31ca,null))[_0xd351('0x22')](function(_0x2558b4){if(_0x2558b4){return _0x2558b4[_0xd351('0x65')](_0x406d8a[_0xd351('0x4a')][_0xd351('0x66')],_['omit'](_0x406d8a[_0xd351('0x4a')],[_0xd351('0x66'),'id'])||{})[_0xd351('0x67')](function(_0x54b38c){for(var _0x38a3ec=0x0;_0x38a3ec<_0x406d8a[_0xd351('0x4a')][_0xd351('0x66')][_0xd351('0x44')];_0x38a3ec+=0x1){socket[_0xd351('0x68')](_0xd351('0x69'),{'UserId':Number(_0x406d8a[_0xd351('0x4a')][_0xd351('0x66')][_0x38a3ec]),'VoicePrefixId':Number(_0x406d8a[_0xd351('0x43')]['id'])});}return _0x54b38c;});}})['then'](respondWithResult(_0xbd31ca,null))[_0xd351('0x41')](handleError(_0xbd31ca,null));};exports[_0xd351('0x6a')]=function(_0x5036e6,_0x44df63,_0x4c1468){return db['VoicePrefix']['find']({'where':{'id':_0x5036e6[_0xd351('0x43')]['id']}})[_0xd351('0x22')](handleEntityNotFound(_0x44df63,null))[_0xd351('0x22')](function(_0x5b2bf9){if(_0x5b2bf9){return _0x5b2bf9[_0xd351('0x6a')](_0x5036e6['query'][_0xd351('0x66')])['then'](function(){if(_[_0xd351('0x6b')](_0x5036e6[_0xd351('0x30')][_0xd351('0x66')])){for(var _0x16dd16=0x0;_0x16dd16<_0x5036e6[_0xd351('0x30')][_0xd351('0x66')][_0xd351('0x44')];_0x16dd16+=0x1){socket[_0xd351('0x68')](_0xd351('0x6c'),{'UserId':Number(_0x5036e6[_0xd351('0x30')][_0xd351('0x66')][_0x16dd16]),'VoicePrefixId':Number(_0x5036e6[_0xd351('0x43')]['id'])});}}else{socket['emit'](_0xd351('0x6c'),{'UserId':Number(_0x5036e6[_0xd351('0x30')][_0xd351('0x66')]),'VoicePrefixId':Number(_0x5036e6[_0xd351('0x43')]['id'])});}});}})[_0xd351('0x22')](respondWithStatusCode(_0x44df63,null))['catch'](handleError(_0x44df63,null));};exports[_0xd351('0x6d')]=function(_0x1e6c85,_0x2adab4,_0x2a1ea4){var _0x4a4b25={};var _0x1fda25={};var _0x36bbee;var _0x48b5ee;return db[_0xd351('0x3f')][_0xd351('0x6e')]({'where':{'id':_0x1e6c85[_0xd351('0x43')]['id']}})[_0xd351('0x22')](handleEntityNotFound(_0x2adab4,null))['then'](function(_0x523895){if(_0x523895){_0x36bbee=_0x523895;_0x1fda25[_0xd351('0x2f')]=_[_0xd351('0x31')](db[_0xd351('0x6f')][_0xd351('0x2c')]);_0x1fda25['query']=_[_0xd351('0x31')](_0x1e6c85[_0xd351('0x30')]);_0x1fda25[_0xd351('0x32')]=_[_0xd351('0x33')](_0x1fda25[_0xd351('0x2f')],_0x1fda25['query']);_0x4a4b25[_0xd351('0x35')]=_[_0xd351('0x33')](_0x1fda25['model'],qs[_0xd351('0x34')](_0x1e6c85[_0xd351('0x30')]['fields']));_0x4a4b25[_0xd351('0x35')]=_0x4a4b25['attributes'][_0xd351('0x44')]?_0x4a4b25['attributes']:_0x1fda25[_0xd351('0x2f')];_0x4a4b25[_0xd351('0x70')]=qs[_0xd351('0x38')](_0x1e6c85[_0xd351('0x30')][_0xd351('0x38')]);_0x4a4b25[_0xd351('0x39')]=qs[_0xd351('0x32')](_[_0xd351('0x3a')](_0x1e6c85[_0xd351('0x30')],_0x1fda25['filters']));if(_0x1e6c85[_0xd351('0x30')][_0xd351('0x3b')]){_0x4a4b25[_0xd351('0x39')]=_[_0xd351('0x45')](_0x4a4b25[_0xd351('0x39')],{'$or':_[_0xd351('0x2b')](_0x4a4b25[_0xd351('0x35')],function(_0x54041b){var _0x56458b={};_0x56458b[_0x54041b]={'$like':'%'+_0x1e6c85[_0xd351('0x30')]['filter']+'%'};return _0x56458b;})});}_0x4a4b25=_[_0xd351('0x45')]({},_0x4a4b25,_0x1e6c85[_0xd351('0x46')]);return _0x36bbee[_0xd351('0x6d')](_0x4a4b25);}})[_0xd351('0x22')](function(_0x2d5e2b){if(_0x2d5e2b){_0x48b5ee=_0x2d5e2b['length'];if(!_0x1e6c85[_0xd351('0x30')][_0xd351('0x36')](_0xd351('0x37'))){_0x4a4b25[_0xd351('0x1b')]=qs[_0xd351('0x1b')](_0x1e6c85[_0xd351('0x30')][_0xd351('0x1b')]);_0x4a4b25[_0xd351('0x19')]=qs[_0xd351('0x19')](_0x1e6c85[_0xd351('0x30')][_0xd351('0x19')]);}return _0x36bbee[_0xd351('0x6d')](_0x4a4b25);}})[_0xd351('0x22')](function(_0x4ddd65){if(_0x4ddd65){return _0x4ddd65?{'count':_0x48b5ee,'rows':_0x4ddd65}:null;}})['then'](respondWithResult(_0x2adab4,null))[_0xd351('0x41')](handleError(_0x2adab4,null));};exports['getTeams']=function(_0x5c202f,_0x426964,_0x4557ed){var _0x3f6826={};var _0x1a5e8e={};var _0x54fc9c;var _0x2443bd;return db['VoicePrefix']['findOne']({'where':{'id':_0x5c202f[_0xd351('0x43')]['id']}})[_0xd351('0x22')](handleEntityNotFound(_0x426964,null))[_0xd351('0x22')](function(_0x15690b){if(_0x15690b){_0x54fc9c=_0x15690b;_0x1a5e8e[_0xd351('0x2f')]=_[_0xd351('0x31')](db[_0xd351('0x71')]['rawAttributes']);_0x1a5e8e[_0xd351('0x30')]=_[_0xd351('0x31')](_0x5c202f[_0xd351('0x30')]);_0x1a5e8e[_0xd351('0x32')]=_[_0xd351('0x33')](_0x1a5e8e[_0xd351('0x2f')],_0x1a5e8e['query']);_0x3f6826['attributes']=_[_0xd351('0x33')](_0x1a5e8e['model'],qs[_0xd351('0x34')](_0x5c202f[_0xd351('0x30')]['fields']));_0x3f6826[_0xd351('0x35')]=_0x3f6826[_0xd351('0x35')][_0xd351('0x44')]?_0x3f6826[_0xd351('0x35')]:_0x1a5e8e[_0xd351('0x2f')];_0x3f6826['order']=qs[_0xd351('0x38')](_0x5c202f['query'][_0xd351('0x38')]);_0x3f6826[_0xd351('0x39')]=qs['filters'](_[_0xd351('0x3a')](_0x5c202f[_0xd351('0x30')],_0x1a5e8e[_0xd351('0x32')]));if(_0x5c202f[_0xd351('0x30')]['filter']){_0x3f6826['where']=_['merge'](_0x3f6826[_0xd351('0x39')],{'$or':_[_0xd351('0x2b')](_0x3f6826[_0xd351('0x35')],function(_0x40740e){var _0x3606b1={};_0x3606b1[_0x40740e]={'$like':'%'+_0x5c202f[_0xd351('0x30')][_0xd351('0x3b')]+'%'};return _0x3606b1;})});}_0x3f6826=_['merge']({},_0x3f6826,_0x5c202f[_0xd351('0x46')]);return _0x54fc9c['getTeams'](_0x3f6826);}})[_0xd351('0x22')](function(_0x55d564){if(_0x55d564){_0x2443bd=_0x55d564['length'];if(!_0x5c202f[_0xd351('0x30')]['hasOwnProperty'](_0xd351('0x37'))){_0x3f6826[_0xd351('0x1b')]=qs[_0xd351('0x1b')](_0x5c202f[_0xd351('0x30')][_0xd351('0x1b')]);_0x3f6826[_0xd351('0x19')]=qs['offset'](_0x5c202f['query'][_0xd351('0x19')]);}return _0x54fc9c[_0xd351('0x72')](_0x3f6826);}})['then'](function(_0x3d3cfa){if(_0x3d3cfa){return _0x3d3cfa?{'count':_0x2443bd,'rows':_0x3d3cfa}:null;}})['then'](respondWithResult(_0x426964,null))[_0xd351('0x41')](handleError(_0x426964,null));};exports[_0xd351('0x73')]=function(_0x6fd03b,_0x19d16a,_0x127bf9){var _0x4ab9b9=_0x6fd03b[_0xd351('0x4a')]['ids'];var _0x581e66;return db[_0xd351('0x71')][_0xd351('0x40')]({'where':{'id':_0x4ab9b9},'attributes':['id'],'include':[{'model':db[_0xd351('0x6f')],'as':'Agents','attributes':['id','name',_0xd351('0x74'),_0xd351('0x75'),_0xd351('0x76')],'raw':!![]}]})[_0xd351('0x22')](function(_0x1ddacf){if(_0x1ddacf){_0x581e66=_0x1ddacf;var _0x4cadbe=_[_0xd351('0x77')](_0x1ddacf,function(_0x269bf6){var _0x3da123=_0x269bf6[_0xd351('0x4e')]({'plain':!![]});return _0x3da123['Agents'];});return db[_0xd351('0x3f')][_0xd351('0x4f')]({'where':{'id':_0x6fd03b['params']['id']}})[_0xd351('0x22')](function(_0x46745f){return db[_0xd351('0x78')][_0xd351('0x49')](function(_0x37d882){return _0x46745f['addTeams'](_0x4ab9b9,{'transaction':_0x37d882})[_0xd351('0x22')](function(){return BPromise[_0xd351('0x79')](_0x581e66,function(_0x5ceda1){return db[_0xd351('0x7a')]['upsert']({'TeamId':_0x5ceda1['id'],'VoicePrefixId':_0x6fd03b[_0xd351('0x43')]['id']},{'transaction':_0x37d882});});})[_0xd351('0x22')](function(){return BPromise['each'](_0x4cadbe,function(_0x1f0812){return db[_0xd351('0x7b')][_0xd351('0x7c')]({'where':{'UserId':_0x1f0812['id'],'VoicePrefixId':_0x6fd03b[_0xd351('0x43')]['id']},'transaction':_0x37d882});});})[_0xd351('0x22')](function(){_0x4cadbe['forEach'](function(_0x23b2fe){socket['emit'](_0xd351('0x69'),{'UserId':_0x23b2fe['id'],'VoicePrefixId':_0x46745f['id']});});});});});}})[_0xd351('0x22')](respondWithStatusCode(_0x19d16a,null))[_0xd351('0x41')](handleError(_0x19d16a,null));};exports[_0xd351('0x7d')]=function(_0x160102,_0x24ac40,_0x3b2690){return db[_0xd351('0x71')][_0xd351('0x40')]({'where':{'id':_0x160102['query'][_0xd351('0x66')]},'attributes':['id'],'include':[{'model':db[_0xd351('0x6f')],'as':_0xd351('0x7e'),'attributes':['id'],'raw':!![]}]})[_0xd351('0x22')](handleEntityNotFound(_0x24ac40,null))['then'](function(_0x280220){var _0x4f8f00=_[_0xd351('0x2b')](_0x280220,'id');var _0x107886=[];var _0x3a3633=[];var _0x403312=squel[_0xd351('0x7f')]();_0x403312['field'](_0xd351('0x80'))[_0xd351('0x81')]('team_has_voice_prefixes','tq')['join'](_0xd351('0x82'),'ut',_0xd351('0x83'))[_0xd351('0x39')](_0xd351('0x84'),_0x160102[_0xd351('0x43')]['id']);for(var _0x1373c0=0x0;_0x1373c0<_0x280220[_0xd351('0x44')];_0x1373c0+=0x1){let _0x78b55c=_0x280220[_0x1373c0];for(var _0x2de03c=0x0;_0x2de03c<_0x78b55c[_0xd351('0x7e')][_0xd351('0x44')];_0x2de03c+=0x1){let _0x6f4c1e=_0x78b55c[_0xd351('0x7e')][_0x2de03c];var _0x56b88b=_0x403312['clone']();_0x56b88b[_0xd351('0x39')]('ut.UserId\x20=\x20?',_0x6f4c1e['id']);_0x3a3633[_0xd351('0x5f')](db[_0xd351('0x78')][_0xd351('0x30')](_0x56b88b[_0xd351('0x85')](),{'type':db[_0xd351('0x78')][_0xd351('0x86')]['SELECT']})[_0xd351('0x22')](function(_0x2725c4){if(_0x2725c4['length']===0x1){return _0x6f4c1e['id'];}else{var _0x31c1dc=_['every'](_['map'](_0x2725c4,_0xd351('0x87')),function(_0x2f188b){return _['includes'](_0x4f8f00,_0x2f188b);});if(_0x31c1dc){return _0x6f4c1e['id'];}}}));}}return BPromise[_0xd351('0x88')](_0x3a3633)[_0xd351('0x22')](function(_0x5126a1){_0x107886=_(_0x107886)[_0xd351('0x89')](_0x5126a1)[_0xd351('0x8a')]()[_0xd351('0x8b')]();return db[_0xd351('0x3f')][_0xd351('0x4f')]({'where':{'id':_0x160102['params']['id']}})[_0xd351('0x22')](function(_0x1db9db){return db[_0xd351('0x78')][_0xd351('0x49')](function(_0x2ef116){return _0x1db9db[_0xd351('0x7d')](_0x160102[_0xd351('0x30')][_0xd351('0x66')],{'transaction':_0x2ef116})[_0xd351('0x22')](function(){if(!_[_0xd351('0x8c')](_0x107886)){return _0x1db9db[_0xd351('0x6a')](_0x107886,{'transaction':_0x2ef116});}})[_0xd351('0x22')](function(){_0x107886[_0xd351('0x8d')](function(_0x585e94){socket[_0xd351('0x68')](_0xd351('0x6c'),{'UserId':_0x585e94,'VoicePrefixId':_0x1db9db['id']});});});});});});})[_0xd351('0x22')](respondWithStatusCode(_0x24ac40,null))[_0xd351('0x41')](handleError(_0x24ac40,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index da125a8..a833c56 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 _0x505d=['remove','emit','hasOwnProperty','hook','events','setMaxListeners','save'];(function(_0x581af1,_0x4f02c5){var _0x54c22e=function(_0x5a7a5a){while(--_0x5a7a5a){_0x581af1['push'](_0x581af1['shift']());}};_0x54c22e(++_0x4f02c5);}(_0x505d,0x162));var _0xd505=function(_0x32b993,_0x1c5989){_0x32b993=_0x32b993-0x0;var _0x482780=_0x505d[_0x32b993];return _0x482780;};'use strict';var EventEmitter=require(_0xd505('0x0'));var VoicePrefix=require('../../mysqldb')['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xd505('0x1')](0x0);var events={'afterCreate':_0xd505('0x2'),'afterUpdate':'update','afterDestroy':_0xd505('0x3')};function emitEvent(_0x4e63d9){return function(_0x35df29,_0x46efe2,_0x25e27f){VoicePrefixEvents[_0xd505('0x4')](_0x4e63d9+':'+_0x35df29['id'],_0x35df29);VoicePrefixEvents[_0xd505('0x4')](_0x4e63d9,_0x35df29);_0x25e27f(null);};}for(var e in events){if(events[_0xd505('0x5')](e)){var event=events[e];VoicePrefix[_0xd505('0x6')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x37d2=['VoicePrefix','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x5502a7,_0x325618){var _0x3946fa=function(_0x1c8383){while(--_0x1c8383){_0x5502a7['push'](_0x5502a7['shift']());}};_0x3946fa(++_0x325618);}(_0x37d2,0x148));var _0x237d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x37d2[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require(_0x237d('0x0'));var VoicePrefix=require(_0x237d('0x1'))['db'][_0x237d('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x237d('0x3')](0x0);var events={'afterCreate':_0x237d('0x4'),'afterUpdate':'update','afterDestroy':_0x237d('0x5')};function emitEvent(_0x16ceee){return function(_0x492aa2,_0x400f11,_0x3489cd){VoicePrefixEvents['emit'](_0x16ceee+':'+_0x492aa2['id'],_0x492aa2);VoicePrefixEvents[_0x237d('0x6')](_0x16ceee,_0x492aa2);_0x3489cd(null);};}for(var e in events){if(events[_0x237d('0x7')](e)){var event=events[e];VoicePrefix[_0x237d('0x8')](e,emitEvent(event));}}module[_0x237d('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 a1bf6ac..dbde132 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 _0x0198=['../../config/environment','exports','define','VoicePrefix','voice_prefixes','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x3c365e,_0x3b40a9){var _0x198acc=function(_0x46d80e){while(--_0x46d80e){_0x3c365e['push'](_0x3c365e['shift']());}};_0x198acc(++_0x3b40a9);}(_0x0198,0x191));var _0x8019=function(_0x280ae7,_0x456fb1){_0x280ae7=_0x280ae7-0x0;var _0x418b9e=_0x0198[_0x280ae7];return _0x418b9e;};'use strict';var _=require('lodash');var util=require(_0x8019('0x0'));var logger=require(_0x8019('0x1'))(_0x8019('0x2'));var moment=require(_0x8019('0x3'));var BPromise=require('bluebird');var rp=require(_0x8019('0x4'));var fs=require('fs');var path=require(_0x8019('0x5'));var rimraf=require(_0x8019('0x6'));var config=require(_0x8019('0x7'));var attributes=require('./voicePrefix.attributes');module[_0x8019('0x8')]=function(_0x22a3ee,_0xf218c4){return _0x22a3ee[_0x8019('0x9')](_0x8019('0xa'),attributes,{'tableName':_0x8019('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf0db=['api','moment','request-promise','path','../../config/environment','./voicePrefix.attributes','define','VoicePrefix','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf0db,0x1ec));var _0xbf0d=function(_0x1cfee8,_0x5b9174){_0x1cfee8=_0x1cfee8-0x0;var _0x32e4c0=_0xf0db[_0x1cfee8];return _0x32e4c0;};'use strict';var _=require(_0xbf0d('0x0'));var util=require(_0xbf0d('0x1'));var logger=require(_0xbf0d('0x2'))(_0xbf0d('0x3'));var moment=require(_0xbf0d('0x4'));var BPromise=require('bluebird');var rp=require(_0xbf0d('0x5'));var fs=require('fs');var path=require(_0xbf0d('0x6'));var rimraf=require('rimraf');var config=require(_0xbf0d('0x7'));var attributes=require(_0xbf0d('0x8'));module['exports']=function(_0x1e1383,_0x2e966b){return _0x1e1383[_0xbf0d('0x9')](_0xbf0d('0xa'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 8f98f05..5d58aac 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 _0x6691=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x6691,0x12d));var _0x1669=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x6691[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x1669('0x0'));var util=require(_0x1669('0x1'));var moment=require(_0x1669('0x2'));var BPromise=require(_0x1669('0x3'));var rs=require(_0x1669('0x4'));var fs=require('fs');var Redis=require(_0x1669('0x5'));var db=require(_0x1669('0x6'))['db'];var utils=require(_0x1669('0x7'));var logger=require(_0x1669('0x8'))(_0x1669('0x9'));var config=require('../../config/environment');var jayson=require(_0x1669('0xa'));var client=jayson[_0x1669('0xb')][_0x1669('0xc')]({'port':0x232a});config[_0x1669('0xd')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1669('0xe'))(new Redis(config['redis']));require('./voicePrefix.socket')['register'](socket);function respondWithRpcPromise(_0x56e0ee,_0x52b44f,_0x408538){return new BPromise(function(_0x93d633,_0xdf793d){return client[_0x1669('0xf')](_0x56e0ee,_0x408538)[_0x1669('0x10')](function(_0x3d6f5e){logger[_0x1669('0x11')](_0x1669('0x12'),_0x52b44f,_0x1669('0x13'));logger[_0x1669('0x14')](_0x1669('0x15'),_0x52b44f,_0x1669('0x13'),JSON[_0x1669('0x16')](_0x3d6f5e));if(_0x3d6f5e[_0x1669('0x17')]){if(_0x3d6f5e[_0x1669('0x17')][_0x1669('0x18')]===0x1f4){logger[_0x1669('0x17')](_0x1669('0x12'),_0x52b44f,_0x3d6f5e[_0x1669('0x17')][_0x1669('0x19')]);return _0xdf793d(_0x3d6f5e[_0x1669('0x17')][_0x1669('0x19')]);}logger[_0x1669('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x52b44f,_0x3d6f5e[_0x1669('0x17')][_0x1669('0x19')]);return _0x93d633(_0x3d6f5e[_0x1669('0x17')][_0x1669('0x19')]);}else{logger[_0x1669('0x11')]('VoicePrefix,\x20%s,\x20%s',_0x52b44f,'request\x20sent');_0x93d633(_0x3d6f5e[_0x1669('0x1a')][_0x1669('0x19')]);}})[_0x1669('0x1b')](function(_0x4fcf1c){logger[_0x1669('0x17')](_0x1669('0x12'),_0x52b44f,_0x4fcf1c);_0xdf793d(_0x4fcf1c);});});} \ No newline at end of file +var _0x22b4=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash'];(function(_0x228e84,_0x54e9ea){var _0x488e05=function(_0x2ba1f2){while(--_0x2ba1f2){_0x228e84['push'](_0x228e84['shift']());}};_0x488e05(++_0x54e9ea);}(_0x22b4,0x8b));var _0x422b=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x22b4[_0x1a36a5];return _0x746243;};'use strict';var _=require(_0x422b('0x0'));var util=require(_0x422b('0x1'));var moment=require(_0x422b('0x2'));var BPromise=require(_0x422b('0x3'));var rs=require(_0x422b('0x4'));var fs=require('fs');var Redis=require(_0x422b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x422b('0x6'));var logger=require(_0x422b('0x7'))('rpc');var config=require(_0x422b('0x8'));var jayson=require(_0x422b('0x9'));var client=jayson[_0x422b('0xa')][_0x422b('0xb')]({'port':0x232a});config[_0x422b('0xc')]=_[_0x422b('0xd')](config['redis'],{'host':_0x422b('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x422b('0xc')]));require(_0x422b('0xf'))[_0x422b('0x10')](socket);function respondWithRpcPromise(_0x13e837,_0x2223a5,_0x42bcfa){return new BPromise(function(_0x552298,_0x3bfc9a){return client[_0x422b('0x11')](_0x13e837,_0x42bcfa)[_0x422b('0x12')](function(_0x419b65){logger[_0x422b('0x13')](_0x422b('0x14'),_0x2223a5,_0x422b('0x15'));logger[_0x422b('0x16')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x2223a5,'request\x20sent',JSON[_0x422b('0x17')](_0x419b65));if(_0x419b65[_0x422b('0x18')]){if(_0x419b65[_0x422b('0x18')][_0x422b('0x19')]===0x1f4){logger[_0x422b('0x18')](_0x422b('0x14'),_0x2223a5,_0x419b65[_0x422b('0x18')][_0x422b('0x1a')]);return _0x3bfc9a(_0x419b65['error'][_0x422b('0x1a')]);}logger['error'](_0x422b('0x14'),_0x2223a5,_0x419b65[_0x422b('0x18')][_0x422b('0x1a')]);return _0x552298(_0x419b65[_0x422b('0x18')][_0x422b('0x1a')]);}else{logger[_0x422b('0x13')]('VoicePrefix,\x20%s,\x20%s',_0x2223a5,_0x422b('0x15'));_0x552298(_0x419b65[_0x422b('0x1b')][_0x422b('0x1a')]);}})['catch'](function(_0x131330){logger[_0x422b('0x18')](_0x422b('0x14'),_0x2223a5,_0x131330);_0x3bfc9a(_0x131330);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 38c945f..a93f2f1 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 _0x1bb2=['register','length','save','remove','update','emit','removeListener'];(function(_0x5be53c,_0x62a39c){var _0x4fcd9d=function(_0x541c04){while(--_0x541c04){_0x5be53c['push'](_0x5be53c['shift']());}};_0x4fcd9d(++_0x62a39c);}(_0x1bb2,0x152));var _0x21bb=function(_0x2acf76,_0x2e78b4){_0x2acf76=_0x2acf76-0x0;var _0x35e75c=_0x1bb2[_0x2acf76];return _0x35e75c;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x21bb('0x0'),_0x21bb('0x1'),_0x21bb('0x2')];function createListener(_0x480fcb,_0x4e514f){return function(_0x170632){_0x4e514f[_0x21bb('0x3')](_0x480fcb,_0x170632);};}function removeListener(_0x1c21c6,_0x469984){return function(){VoicePrefixEvents[_0x21bb('0x4')](_0x1c21c6,_0x469984);};}exports[_0x21bb('0x5')]=function(_0x198344){for(var _0x267bb0=0x0,_0x36217b=events[_0x21bb('0x6')];_0x267bb0<_0x36217b;_0x267bb0++){var _0x642998=events[_0x267bb0];var _0x316b77=createListener('voicePrefix:'+_0x642998,_0x198344);VoicePrefixEvents['on'](_0x642998,_0x316b77);}}; \ No newline at end of file +var _0x2bdb=['voicePrefix:','./voicePrefix.events','remove','removeListener','register'];(function(_0x207d2f,_0x44400f){var _0x3c3498=function(_0x57fdfb){while(--_0x57fdfb){_0x207d2f['push'](_0x207d2f['shift']());}};_0x3c3498(++_0x44400f);}(_0x2bdb,0x105));var _0xb2bd=function(_0x48304d,_0x27d4a8){_0x48304d=_0x48304d-0x0;var _0x48660f=_0x2bdb[_0x48304d];return _0x48660f;};'use strict';var VoicePrefixEvents=require(_0xb2bd('0x0'));var events=['save',_0xb2bd('0x1'),'update'];function createListener(_0x3b40de,_0x1d3ddb){return function(_0xab9a35){_0x1d3ddb['emit'](_0x3b40de,_0xab9a35);};}function removeListener(_0x438ced,_0x2be356){return function(){VoicePrefixEvents[_0xb2bd('0x2')](_0x438ced,_0x2be356);};}exports[_0xb2bd('0x3')]=function(_0x461137){for(var _0x2ef40b=0x0,_0x3bff5b=events['length'];_0x2ef40b<_0x3bff5b;_0x2ef40b++){var _0x21462b=events[_0x2ef40b];var _0x4d9d3f=createListener(_0xb2bd('0x4')+_0x21462b,_0x461137);VoicePrefixEvents['on'](_0x21462b,_0x4d9d3f);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 6560a7c..72ee74d 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(_0x164760,_0x5874b0){var _0x8b91b2=function(_0x40d20a){while(--_0x40d20a){_0x164760['push'](_0x164760['shift']());}};_0x8b91b2(++_0x5874b0);}(_0xb10b,0x12a));var _0xbb10=function(_0x3ccbc7,_0x3093c8){_0x3ccbc7=_0x3ccbc7-0x0;var _0x50c97a=_0xb10b[_0x3ccbc7];return _0x50c97a;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x35a274,_0x98b399){var _0x40d905=function(_0x5c8455){while(--_0x5c8455){_0x35a274['push'](_0x35a274['shift']());}};_0x40d905(++_0x98b399);}(_0xb10b,0x12a));var _0xbb10=function(_0x40632e,_0x1f7f8f){_0x40632e=_0x40632e-0x0;var _0x3708c4=_0xb10b[_0x40632e];return _0x3708c4;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 6a61b56..2806e78 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 _0x0aca=['Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','always','onlyIfOpen','#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','#RecallMe\x20Timeout\x20(min:1)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','sequelize','exports','STRING','name','outbound','inbound','default','ringall','fewestcalls','random','rrmemory','linear','wrandom','rrordered','getDataValue','type','dialMethod','strategy','preview','roundrobin','includes','setDataValue','INTEGER','yes','ENUM','all','once','periodic_announce','join','joinempty','split','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','progressive','power','predictive','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'];(function(_0x4a3936,_0x971058){var _0x3a66fa=function(_0x2bdcb9){while(--_0x2bdcb9){_0x4a3936['push'](_0x4a3936['shift']());}};_0x3a66fa(++_0x971058);}(_0x0aca,0x116));var _0xa0ac=function(_0x9c6c7d,_0x2d8484){_0x9c6c7d=_0x9c6c7d-0x0;var _0x433f1e=_0x0aca[_0x9c6c7d];return _0x433f1e;};'use strict';var Sequelize=require(_0xa0ac('0x0'));module[_0xa0ac('0x1')]={'name':{'type':Sequelize[_0xa0ac('0x2')],'allowNull':![],'unique':_0xa0ac('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('inbound',_0xa0ac('0x4')),'allowNull':![],'defaultValue':_0xa0ac('0x5')},'musiconhold':{'type':Sequelize[_0xa0ac('0x2')],'defaultValue':_0xa0ac('0x6')},'announce':{'type':Sequelize[_0xa0ac('0x2')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0xa0ac('0x7'),'leastrecent',_0xa0ac('0x8'),_0xa0ac('0x9'),_0xa0ac('0xa'),_0xa0ac('0xb'),_0xa0ac('0xc'),_0xa0ac('0xd')),'allowNull':![],'defaultValue':_0xa0ac('0x7'),'set':function(_0x13fa15){this['setDataValue']('strategy',_0x13fa15?_0x13fa15:_0xa0ac('0xa'));},'get':function(){var _0x2eabae=this[_0xa0ac('0xe')](_0xa0ac('0xf'));var _0x253342=this[_0xa0ac('0xe')](_0xa0ac('0x10'));var _0x1479aa=this[_0xa0ac('0xe')](_0xa0ac('0x11'));if(_0x2eabae===_0xa0ac('0x4')){if(_0x253342===_0xa0ac('0x12')){return null;}if(_0x253342==='booked'&&![_0xa0ac('0xa'),_0xa0ac('0x13')][_0xa0ac('0x14')](_0x1479aa)){this[_0xa0ac('0x15')](_0xa0ac('0x11'),_0xa0ac('0xa'));}}return _0x1479aa;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xa0ac('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xa0ac('0x16')](0xb)},'timeout':{'type':Sequelize[_0xa0ac('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xa0ac('0x2')]},'weight':{'type':Sequelize[_0xa0ac('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xa0ac('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0xa0ac('0x17'),'no'),'defaultValue':_0xa0ac('0x17')},'autopause':{'type':Sequelize[_0xa0ac('0x18')]('yes','no',_0xa0ac('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xa0ac('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0xa0ac('0x18')](_0xa0ac('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xa0ac('0x18')](_0xa0ac('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xa0ac('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0xa0ac('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xa0ac('0x18')](_0xa0ac('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xa0ac('0x18')](_0xa0ac('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0xa0ac('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xa0ac('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xa0ac('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xa0ac('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xa0ac('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xa0ac('0x18')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0xa0ac('0x17'),'no'),'defaultValue':_0xa0ac('0x17')},'announce_holdtime':{'type':Sequelize[_0xa0ac('0x18')](_0xa0ac('0x17'),'no',_0xa0ac('0x1a')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xa0ac('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xa0ac('0x18')]('yes','no')},'announce_position_limit':{'type':Sequelize[_0xa0ac('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xa0ac('0x18')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0xa0ac('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xa0ac('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xa0ac('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xa0ac('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xa0ac('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xa0ac('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0xa0ac('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0xa0ac('0x2')]},'queue_less_than':{'type':Sequelize[_0xa0ac('0x2')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x33f895){this['setDataValue'](_0xa0ac('0x1b'),_0x33f895?_0x33f895[_0xa0ac('0x1c')](','):[]);},'get':function(){return this[_0xa0ac('0xe')]('periodic_announce')?this[_0xa0ac('0xe')](_0xa0ac('0x1b'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0xa0ac('0x2')],'defaultValue':'yes','set':function(_0x42002e){this[_0xa0ac('0x15')](_0xa0ac('0x1d'),_0x42002e?_0x42002e[_0xa0ac('0x1c')](','):undefined);},'get':function(){return this[_0xa0ac('0xe')](_0xa0ac('0x1d'))?this[_0xa0ac('0xe')]('joinempty')[_0xa0ac('0x1e')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xa0ac('0x2')],'defaultValue':'no','set':function(_0x449aad){this[_0xa0ac('0x15')](_0xa0ac('0x1f'),_0x449aad?_0x449aad[_0xa0ac('0x1c')](','):undefined);},'get':function(){return this[_0xa0ac('0xe')](_0xa0ac('0x1f'))?this[_0xa0ac('0xe')](_0xa0ac('0x1f'))[_0xa0ac('0x1e')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0xa0ac('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xa0ac('0x18')](_0xa0ac('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xa0ac('0x2')]},'description':{'type':Sequelize[_0xa0ac('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x54bd71){this[_0xa0ac('0x15')](_0xa0ac('0x20'),_0x54bd71);if(_0x54bd71){if(this[_0xa0ac('0xe')](_0xa0ac('0x21'))<0x2){this[_0xa0ac('0x15')](_0xa0ac('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xa0ac('0x22')],'defaultValue':0x0,'comment':_0xa0ac('0x23')},'dialMethod':{'type':Sequelize[_0xa0ac('0x18')](_0xa0ac('0x12'),_0xa0ac('0x24'),_0xa0ac('0x25'),_0xa0ac('0x26'),'booked'),'defaultValue':_0xa0ac('0x24'),'comment':_0xa0ac('0x27')},'dialLimitChannel':{'type':Sequelize[_0xa0ac('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xa0ac('0x28')},'dialLimitQueue':{'type':Sequelize[_0xa0ac('0x16')](0x4)[_0xa0ac('0x29')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0xa0ac('0x29')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xa0ac('0x2a')},'dialPredictiveOptimization':{'type':Sequelize[_0xa0ac('0x18')](_0xa0ac('0x2b'),'dropRate'),'defaultValue':_0xa0ac('0x2c'),'comment':_0xa0ac('0x2d')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xa0ac('0x2e')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0xa0ac('0x29')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xa0ac('0x2f')},'dialOriginateCallerIdName':{'type':Sequelize[_0xa0ac('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xa0ac('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xa0ac('0x16')](0x3)[_0xa0ac('0x29')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0xa0ac('0x2')],'defaultValue':_0xa0ac('0x30'),'comment':_0xa0ac('0x31')},'dialQueueTimeout':{'type':Sequelize[_0xa0ac('0x16')](0x3)[_0xa0ac('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa0ac('0x32')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0xa0ac('0x33')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa0ac('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa0ac('0x34')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa0ac('0x35')},'dialBusyMaxRetry':{'type':Sequelize[_0xa0ac('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa0ac('0x36')},'dialBusyRetryFrequency':{'type':Sequelize[_0xa0ac('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa0ac('0x37')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa0ac('0x29')],'defaultValue':0x3,'comment':_0xa0ac('0x38')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xa0ac('0x16')](0x5)[_0xa0ac('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa0ac('0x39')},'dialGlobalMaxRetry':{'type':Sequelize[_0xa0ac('0x16')](0x3)[_0xa0ac('0x29')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xa0ac('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0xa0ac('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xa0ac('0x3a'),'never',_0xa0ac('0x3b')),'defaultValue':_0xa0ac('0x3a')},'dialAMDActive':{'type':Sequelize[_0xa0ac('0x22')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xa0ac('0x16')](0x9)[_0xa0ac('0x29')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xa0ac('0x3c')},'dialAMDGreeting':{'type':Sequelize[_0xa0ac('0x16')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xa0ac('0x16')](0x9)[_0xa0ac('0x29')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xa0ac('0x3d')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xa0ac('0x16')](0x9)[_0xa0ac('0x29')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa0ac('0x3e')},'dialAMDMinWordLength':{'type':Sequelize[_0xa0ac('0x16')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xa0ac('0x3f')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xa0ac('0x16')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xa0ac('0x40')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xa0ac('0x41')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xa0ac('0x16')](0x5)[_0xa0ac('0x29')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xa0ac('0x42')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xa0ac('0x16')](0x9)[_0xa0ac('0x29')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa0ac('0x43')},'dialRecallMeTimeout':{'type':Sequelize[_0xa0ac('0x16')](0x5)[_0xa0ac('0x29')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xa0ac('0x44')},'dialRecallInQueue':{'type':Sequelize[_0xa0ac('0x22')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0xa0ac('0x18')](_0xa0ac('0x45'),_0xa0ac('0x46')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0xa0ac('0x2')],'comment':_0xa0ac('0x33')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xa0ac('0x29')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa0ac('0x47')},'dialCutDigit':{'type':Sequelize[_0xa0ac('0x16')](0x3)[_0xa0ac('0x29')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xa0ac('0x16')](0x3)[_0xa0ac('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa0ac('0x48')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xa0ac('0x16')](0x5)[_0xa0ac('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa0ac('0x49')},'dialDropMaxRetry':{'type':Sequelize[_0xa0ac('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa0ac('0x4a')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa0ac('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xa0ac('0x16')](0x3)[_0xa0ac('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa0ac('0x4b')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xa0ac('0x16')](0x5)[_0xa0ac('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa0ac('0x4c')},'dialMachineMaxRetry':{'type':Sequelize[_0xa0ac('0x16')](0x3)[_0xa0ac('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa0ac('0x4d')},'dialMachineRetryFrequency':{'type':Sequelize[_0xa0ac('0x16')](0x5)[_0xa0ac('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa0ac('0x4e')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa0ac('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xa0ac('0x16')](0x5)[_0xa0ac('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa0ac('0x4f')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0xa0ac('0x50')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xa0ac('0x51'),'set':function(_0x332bb4){if(!_0x332bb4)this[_0xa0ac('0x15')]('mandatoryDispositionPauseId',null);this[_0xa0ac('0x15')]('mandatoryDisposition',_0x332bb4);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xa0ac('0x16')](0x3)[_0xa0ac('0x29')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xa0ac('0x22')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xa0ac('0x22')],'defaultValue':![]}}; \ No newline at end of file +var _0x2c21=['yes','all','TEXT','setDataValue','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','power','Dial\x20Method.','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.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','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)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#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','#RecallMe\x20Timeout\x20(min:1)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','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\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','name','ENUM','inbound','outbound','default','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','strategy','getDataValue','type','dialMethod','preview','booked','roundrobin','includes','INTEGER'];(function(_0x1f3d10,_0x565566){var _0x261e8d=function(_0x49464c){while(--_0x49464c){_0x1f3d10['push'](_0x1f3d10['shift']());}};_0x261e8d(++_0x565566);}(_0x2c21,0xf0));var _0x12c2=function(_0x334524,_0x1fca82){_0x334524=_0x334524-0x0;var _0x870ae9=_0x2c21[_0x334524];return _0x870ae9;};'use strict';var Sequelize=require('sequelize');module[_0x12c2('0x0')]={'name':{'type':Sequelize[_0x12c2('0x1')],'allowNull':![],'unique':_0x12c2('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x12c2('0x3')](_0x12c2('0x4'),_0x12c2('0x5')),'allowNull':![],'defaultValue':_0x12c2('0x4')},'musiconhold':{'type':Sequelize[_0x12c2('0x1')],'defaultValue':_0x12c2('0x6')},'announce':{'type':Sequelize[_0x12c2('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x12c2('0x3')]('rr',_0x12c2('0x7'),_0x12c2('0x8'),_0x12c2('0x9'),_0x12c2('0xa'),_0x12c2('0xb'),_0x12c2('0xc'),_0x12c2('0xd'),_0x12c2('0xe')),'allowNull':![],'defaultValue':_0x12c2('0x7'),'set':function(_0x4dbcab){this['setDataValue'](_0x12c2('0xf'),_0x4dbcab?_0x4dbcab:_0x12c2('0xb'));},'get':function(){var _0x3556ea=this[_0x12c2('0x10')](_0x12c2('0x11'));var _0x2f21c7=this['getDataValue'](_0x12c2('0x12'));var _0xd74148=this[_0x12c2('0x10')](_0x12c2('0xf'));if(_0x3556ea===_0x12c2('0x5')){if(_0x2f21c7===_0x12c2('0x13')){return null;}if(_0x2f21c7===_0x12c2('0x14')&&!['rrmemory',_0x12c2('0x15')][_0x12c2('0x16')](_0xd74148)){this['setDataValue'](_0x12c2('0xf'),_0x12c2('0xb'));}}return _0xd74148;}},'servicelevel':{'type':Sequelize[_0x12c2('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x12c2('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x12c2('0x17')](0xb)},'timeout':{'type':Sequelize[_0x12c2('0x17')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x12c2('0x17')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x12c2('0x1')]},'weight':{'type':Sequelize[_0x12c2('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x12c2('0x17')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0x12c2('0x18'),'no'),'defaultValue':_0x12c2('0x18')},'autopause':{'type':Sequelize[_0x12c2('0x3')](_0x12c2('0x18'),'no',_0x12c2('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x12c2('0x17')](0xb)},'autopausebusy':{'type':Sequelize[_0x12c2('0x3')](_0x12c2('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x12c2('0x17')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x12c2('0x3')](_0x12c2('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x12c2('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x12c2('0x3')](_0x12c2('0x18'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x12c2('0x3')](_0x12c2('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x12c2('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x12c2('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x12c2('0x17')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x12c2('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x12c2('0x3')](_0x12c2('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x12c2('0x3')](_0x12c2('0x18'),'no'),'defaultValue':_0x12c2('0x18')},'announce_holdtime':{'type':Sequelize[_0x12c2('0x3')](_0x12c2('0x18'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x12c2('0x3')](_0x12c2('0x18'),'no')},'announce_position_limit':{'type':Sequelize[_0x12c2('0x17')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x12c2('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x12c2('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x12c2('0x1')]},'queue_youarenext':{'type':Sequelize[_0x12c2('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x12c2('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x12c2('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x12c2('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x12c2('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x12c2('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x12c2('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x12c2('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x12c2('0x1')]},'queue_quantity1':{'type':Sequelize[_0x12c2('0x1')]},'queue_quantity2':{'type':Sequelize[_0x12c2('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0x12c2('0x1')]},'queue_less_than':{'type':Sequelize[_0x12c2('0x1')]},'periodic_announce':{'type':Sequelize[_0x12c2('0x1a')],'set':function(_0x3dcf86){this[_0x12c2('0x1b')]('periodic_announce',_0x3dcf86?_0x3dcf86[_0x12c2('0x1c')](','):[]);},'get':function(){return this[_0x12c2('0x10')]('periodic_announce')?this['getDataValue']('periodic_announce')[_0x12c2('0x1d')](','):[];}},'joinempty':{'type':Sequelize[_0x12c2('0x1')],'defaultValue':_0x12c2('0x18'),'set':function(_0x46a57f){this['setDataValue'](_0x12c2('0x1e'),_0x46a57f?_0x46a57f[_0x12c2('0x1c')](','):undefined);},'get':function(){return this[_0x12c2('0x10')](_0x12c2('0x1e'))?this['getDataValue']('joinempty')['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x12c2('0x1')],'defaultValue':'no','set':function(_0x8eb187){this[_0x12c2('0x1b')](_0x12c2('0x1f'),_0x8eb187?_0x8eb187[_0x12c2('0x1c')](','):undefined);},'get':function(){return this[_0x12c2('0x10')](_0x12c2('0x1f'))?this[_0x12c2('0x10')](_0x12c2('0x1f'))[_0x12c2('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x12c2('0x3')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x12c2('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x12c2('0x17')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x12c2('0x3')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x12c2('0x1')]},'description':{'type':Sequelize[_0x12c2('0x1')]},'acw':{'type':Sequelize[_0x12c2('0x20')],'defaultValue':0x0,'set':function(_0x12d53c){this['setDataValue'](_0x12c2('0x21'),_0x12d53c);if(_0x12d53c){if(this[_0x12c2('0x10')]('wrapuptime')<0x2){this[_0x12c2('0x1b')](_0x12c2('0x22'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x12c2('0x23')},'dialMethod':{'type':Sequelize['ENUM']('preview',_0x12c2('0x24'),_0x12c2('0x25'),'predictive','booked'),'defaultValue':_0x12c2('0x24'),'comment':_0x12c2('0x26')},'dialLimitChannel':{'type':Sequelize[_0x12c2('0x17')](0x4)[_0x12c2('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x12c2('0x28')},'dialLimitQueue':{'type':Sequelize[_0x12c2('0x17')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x12c2('0x29')},'dialPowerLevel':{'type':Sequelize[_0x12c2('0x2a')](0x2)[_0x12c2('0x27')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x12c2('0x2b')},'dialPredictiveOptimization':{'type':Sequelize[_0x12c2('0x3')](_0x12c2('0x2c'),'dropRate'),'defaultValue':_0x12c2('0x2d'),'comment':_0x12c2('0x2e')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x12c2('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x12c2('0x2f')},'dialPredictiveInterval':{'type':Sequelize[_0x12c2('0x17')](0x3)[_0x12c2('0x27')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x12c2('0x30')},'dialOriginateCallerIdName':{'type':Sequelize[_0x12c2('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x12c2('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x12c2('0x17')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x12c2('0x31')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x12c2('0x32'),'comment':_0x12c2('0x33')},'dialQueueTimeout':{'type':Sequelize[_0x12c2('0x17')](0x3)[_0x12c2('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x12c2('0x34')},'dialQueueProject':{'type':Sequelize[_0x12c2('0x1')],'comment':_0x12c2('0x35')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x12c2('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x12c2('0x36')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x12c2('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x12c2('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x12c2('0x37')},'dialBusyRetryFrequency':{'type':Sequelize[_0x12c2('0x17')](0x5)[_0x12c2('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x12c2('0x38')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x12c2('0x17')](0x3)[_0x12c2('0x27')],'defaultValue':0x3,'comment':_0x12c2('0x39')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x12c2('0x17')](0x5)[_0x12c2('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x12c2('0x3a')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x12c2('0x27')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x12c2('0x3b')},'dialTimezone':{'type':Sequelize[_0x12c2('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x12c2('0x1')],'defaultValue':_0x12c2('0x3c')},'dialPrefix':{'type':Sequelize[_0x12c2('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x12c2('0x3')](_0x12c2('0x3d'),'never','onlyIfOpen'),'defaultValue':_0x12c2('0x3d')},'dialAMDActive':{'type':Sequelize[_0x12c2('0x20')],'defaultValue':0x0,'comment':_0x12c2('0x3e')},'dialAMDInitialSilence':{'type':Sequelize[_0x12c2('0x17')](0x9)[_0x12c2('0x27')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x12c2('0x3f')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x12c2('0x27')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x12c2('0x40')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x12c2('0x17')](0x9)[_0x12c2('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x12c2('0x41')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x12c2('0x42')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x12c2('0x17')](0x9)[_0x12c2('0x27')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x12c2('0x43')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x12c2('0x17')](0x9)[_0x12c2('0x27')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x12c2('0x44')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x12c2('0x17')](0x5)[_0x12c2('0x27')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x12c2('0x45')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x12c2('0x17')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x12c2('0x46')},'dialRecallMeTimeout':{'type':Sequelize[_0x12c2('0x17')](0x5)[_0x12c2('0x27')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x12c2('0x47')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x12c2('0x3')](_0x12c2('0x48'),_0x12c2('0x49')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0x12c2('0x1')],'comment':_0x12c2('0x35')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x12c2('0x20')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x12c2('0x20')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x12c2('0x17')](0x3)[_0x12c2('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x12c2('0x4a')},'dialCutDigit':{'type':Sequelize[_0x12c2('0x17')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x12c2('0x4b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x12c2('0x17')](0x3)[_0x12c2('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x12c2('0x4c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x12c2('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x12c2('0x4d')},'dialDropMaxRetry':{'type':Sequelize[_0x12c2('0x17')](0x3)[_0x12c2('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x12c2('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x12c2('0x4e')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x12c2('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x12c2('0x4f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x12c2('0x17')](0x5)[_0x12c2('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x12c2('0x50')},'dialMachineMaxRetry':{'type':Sequelize[_0x12c2('0x17')](0x3)[_0x12c2('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x12c2('0x51')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x12c2('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x12c2('0x52')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x12c2('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x12c2('0x53')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x12c2('0x17')](0x5)[_0x12c2('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x12c2('0x54')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x12c2('0x20')],'defaultValue':![],'comment':_0x12c2('0x55'),'set':function(_0x20970e){if(!_0x20970e)this[_0x12c2('0x1b')](_0x12c2('0x56'),null);this['setDataValue'](_0x12c2('0x57'),_0x20970e);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x12c2('0x17')](0x3)[_0x12c2('0x27')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x12c2('0x17')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x12c2('0x20')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x12c2('0x17')](0x3)[_0x12c2('0x27')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x12c2('0x20')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 677e3d2..96156dc 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 _0xe14b=['QueueCampaigns','outbound','filter','map','value','type','find','name','end','error','stack','index','VoiceQueue','rawAttributes','fieldName','key','getOptions','where','include','show','params','model','keys','query','intersection','attributes','fields','length','includeAll','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoiceQueues','UserProfileSection','autoAssociation','UserProfileResource','clone','merge','omit','createdAt','updatedAt','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','CmHopper','filters','hasOwnProperty','nolimit','order','sort','pick','VoiceQueueId','findAll','rows','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','Agents','online','interface','flatMap','penalty','sequelize','UserVoiceQueue','UserVoiceQueueRt','upsert','isNil','format','voicePause','forEach','emit','userVoiceQueue:save','ids','User','select','field','tq.TeamId','from','team_has_voice_queues','join','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','compact','transaction','removeTeams','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','CmListId','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_contacts','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','squel','ioredis','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','get','inbound'];(function(_0x57b74b,_0x65317d){var _0x136375=function(_0x4f3bf5){while(--_0x4f3bf5){_0x57b74b['push'](_0x57b74b['shift']());}};_0x136375(++_0x65317d);}(_0xe14b,0x93));var _0xbe14=function(_0x13a291,_0x269ee8){_0x13a291=_0x13a291-0x0;var _0x1540c7=_0xe14b[_0x13a291];return _0x1540c7;};'use strict';var moment=require(_0xbe14('0x0'));var BPromise=require(_0xbe14('0x1'));var util=require('util');var _=require('lodash');var squel=require(_0xbe14('0x2'));var Redis=require(_0xbe14('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xbe14('0x4'))('api');var config=require('../../config/environment');var db=require(_0xbe14('0x5'))['db'];config[_0xbe14('0x6')]=_[_0xbe14('0x7')](config[_0xbe14('0x6')],{'host':_0xbe14('0x8'),'port':0x18eb});var socket=require(_0xbe14('0x9'))(new Redis(config[_0xbe14('0x6')]));require('./voiceQueue.socket')['register'](socket);function respondWithStatusCode(_0x496063,_0x30c355){_0x30c355=_0x30c355||0xcc;return function(_0x6fceff){if(_0x6fceff){return _0x496063[_0xbe14('0xa')](_0x30c355);}return _0x496063[_0xbe14('0xb')](_0x30c355)['end']();};}function respondWithResult(_0x5b9fc6,_0x113243){_0x113243=_0x113243||0xc8;return function(_0x3f70cb){if(_0x3f70cb){return _0x5b9fc6['status'](_0x113243)[_0xbe14('0xc')](_0x3f70cb);}};}function respondWithFilteredResult(_0x35aa19,_0x886a5e){return function(_0x3d38c2){if(_0x3d38c2){var _0x27792f=typeof _0x886a5e[_0xbe14('0xd')]===_0xbe14('0xe')&&typeof _0x886a5e[_0xbe14('0xf')]===_0xbe14('0xe');var _0xa2cf72=_0x3d38c2[_0xbe14('0x10')];var _0x33fd54=_0x27792f?0x0:_0x886a5e[_0xbe14('0xd')];var _0x530538=_0x27792f?_0x3d38c2['count']:_0x886a5e[_0xbe14('0xd')]+_0x886a5e[_0xbe14('0xf')];var _0xf4ac9;if(_0x530538>=_0xa2cf72){_0x530538=_0xa2cf72;_0xf4ac9=0xc8;}else{_0xf4ac9=0xce;}_0x35aa19[_0xbe14('0xb')](_0xf4ac9);return _0x35aa19['set'](_0xbe14('0x11'),_0x33fd54+'-'+_0x530538+'/'+_0xa2cf72)[_0xbe14('0xc')](_0x3d38c2);}return null;};}function saveUpdates(_0xfd7b8f){return function(_0x123ede){if(_0x123ede){return _0x123ede[_0xbe14('0x12')](_0xfd7b8f)[_0xbe14('0x13')](function(_0x17ae86){return _0x17ae86;});}return null;};}function removeEntity(_0x5ea1f8){return function(_0x137ee5){if(_0x137ee5){return _0x137ee5[_0xbe14('0x14')]()[_0xbe14('0x13')](function(){var _0x433459=_0x137ee5[_0xbe14('0x15')]({'plain':!![]});var _0x37e4c1=[{'name':'VoiceQueues','value':_0xbe14('0x16'),'ignore':![]},{'name':_0xbe14('0x17'),'value':_0xbe14('0x18'),'ignore':![]}];var _0xc12977=_(_0x37e4c1)[_0xbe14('0x19')]('ignore')[_0xbe14('0x1a')]('value')[_0xbe14('0x1b')]();if(_['includes'](_0xc12977,_0x433459[_0xbe14('0x1c')])){return;}var _0x4a25fa=_[_0xbe14('0x1d')](_0x37e4c1,[_0xbe14('0x1b'),_0x433459['type']])[_0xbe14('0x1e')];return db['UserProfileResource'][_0xbe14('0x14')]({'where':{'type':_0x4a25fa,'resourceId':_0x433459['id']}})['then'](function(){return _0x137ee5;});})[_0xbe14('0x13')](function(){_0x5ea1f8[_0xbe14('0xb')](0xcc)[_0xbe14('0x1f')]();});}};}function handleEntityNotFound(_0x39cc81){return function(_0x15ef02){if(!_0x15ef02){_0x39cc81[_0xbe14('0xa')](0x194);}return _0x15ef02;};}function handleError(_0x55d001,_0x1822e0){_0x1822e0=_0x1822e0||0x1f4;return function(_0x1ba46a){logger[_0xbe14('0x20')](_0x1ba46a[_0xbe14('0x21')]);if(_0x1ba46a['name']){delete _0x1ba46a[_0xbe14('0x1e')];}_0x55d001[_0xbe14('0xb')](_0x1822e0)['send'](_0x1ba46a);};}exports[_0xbe14('0x22')]=function(_0x3b3e84,_0x1c7cc7){var _0x19252f={};var _0x34d648={'count':0x0,'rows':[]};var _0x36d4b2=_[_0xbe14('0x1a')](db[_0xbe14('0x23')][_0xbe14('0x24')],function(_0x16a159){return{'name':_0x16a159[_0xbe14('0x25')],'type':_0x16a159[_0xbe14('0x1c')][_0xbe14('0x26')]};});_0x19252f=qs[_0xbe14('0x27')](_0x36d4b2,_0x3b3e84);var _0x223f7a={'where':_0x19252f[_0xbe14('0x28')]};return db[_0xbe14('0x23')][_0xbe14('0x10')](_0x223f7a)[_0xbe14('0x13')](function(_0x14e7c4){_0x34d648['count']=_0x14e7c4;_0x19252f[_0xbe14('0x29')]=qs['include'](_0x3b3e84['query']);return db[_0xbe14('0x23')]['findAll'](_0x19252f);})[_0xbe14('0x13')](function(_0x345b0){_0x34d648['rows']=_0x345b0;return _0x34d648;})['then'](respondWithFilteredResult(_0x1c7cc7,_0x19252f))['catch'](handleError(_0x1c7cc7,null));};exports[_0xbe14('0x2a')]=function(_0xa3d24,_0x5f27b6){var _0x46c570={'raw':![],'where':{'id':_0xa3d24[_0xbe14('0x2b')]['id']}},_0x1faf3e={};_0x1faf3e[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db['VoiceQueue']['rawAttributes']);_0x1faf3e[_0xbe14('0x2e')]=_['keys'](_0xa3d24['query']);_0x1faf3e['filters']=_[_0xbe14('0x2f')](_0x1faf3e[_0xbe14('0x2c')],_0x1faf3e[_0xbe14('0x2e')]);_0x46c570[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x1faf3e[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0xa3d24[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x46c570[_0xbe14('0x30')]=_0x46c570[_0xbe14('0x30')][_0xbe14('0x32')]?_0x46c570['attributes']:_0x1faf3e['model'];if(_0xa3d24[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x46c570[_0xbe14('0x29')]=[{'all':!![]}];}_0x46c570=_['merge']({},_0x46c570,_0xa3d24[_0xbe14('0x34')]);return db[_0xbe14('0x23')][_0xbe14('0x1d')](_0x46c570)[_0xbe14('0x13')](handleEntityNotFound(_0x5f27b6,null))[_0xbe14('0x13')](respondWithResult(_0x5f27b6,null))[_0xbe14('0x35')](handleError(_0x5f27b6,null));};exports[_0xbe14('0x36')]=function(_0x128843,_0x1b2608){return db['VoiceQueue'][_0xbe14('0x36')](_0x128843[_0xbe14('0x37')],{})[_0xbe14('0x13')](function(_0x1b3118){var _0x3287b9=_0x128843[_0xbe14('0x38')]['get']({'plain':!![]});if(!_0x3287b9)throw new Error(_0xbe14('0x39'));if(_0x3287b9[_0xbe14('0x3a')]===_0xbe14('0x38')){var _0x36263c=_0x1b3118['get']({'plain':!![]});var _0x4bfa96=[{'name':_0xbe14('0x3b'),'value':_0xbe14('0x16')},{'name':_0xbe14('0x17'),'value':'outbound'}];var _0x5d5318=_[_0xbe14('0x1d')](_0x4bfa96,['value',_0x36263c['type']])[_0xbe14('0x1e')];return db[_0xbe14('0x3c')][_0xbe14('0x1d')]({'where':{'name':_0x5d5318,'userProfileId':_0x3287b9['userProfileId']},'raw':!![]})['then'](function(_0x5aaa4f){if(_0x5aaa4f&&_0x5aaa4f[_0xbe14('0x3d')]===0x0){return db[_0xbe14('0x3e')][_0xbe14('0x36')]({'name':_0x36263c['name'],'resourceId':_0x36263c['id'],'type':_0x5aaa4f[_0xbe14('0x1e')],'sectionId':_0x5aaa4f['id']},{})[_0xbe14('0x13')](function(){return _0x1b3118;});}else{return _0x1b3118;}})[_0xbe14('0x35')](function(_0x3ab0f6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ab0f6);throw _0x3ab0f6;});}return _0x1b3118;})[_0xbe14('0x13')](respondWithResult(_0x1b2608,0xc9))[_0xbe14('0x35')](handleError(_0x1b2608,null));};exports[_0xbe14('0x3f')]=function(_0xb2b285,_0x2550dc){var _0x4f2d95={'where':{'id':_0xb2b285[_0xbe14('0x2b')]['id']}},_0x51023a={};_0x51023a[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x23')]['rawAttributes']);_0x4f2d95[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x51023a['model'],qs[_0xbe14('0x31')](_0xb2b285[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x4f2d95[_0xbe14('0x30')]=_0x4f2d95['attributes']['length']?_0x4f2d95[_0xbe14('0x30')]:_0x51023a[_0xbe14('0x2c')];if(_0xb2b285['query']['includeAll']){_0x4f2d95[_0xbe14('0x29')]=[{'all':!![]}];}_0x4f2d95=_[_0xbe14('0x40')]({},_0x4f2d95,_0xb2b285[_0xbe14('0x34')]);return db[_0xbe14('0x23')][_0xbe14('0x1d')](_0x4f2d95)[_0xbe14('0x13')](handleEntityNotFound(_0x2550dc,null))[_0xbe14('0x13')](function(_0x5a4068){if(_0x5a4068){var _0xf32e93=_0x5a4068[_0xbe14('0x15')]({'plain':!![]});_0xf32e93=qs[_0xbe14('0x41')](_0xf32e93,['id',_0xbe14('0x42'),_0xbe14('0x43')]);_0xb2b285['body']=_[_0xbe14('0x41')](_0xb2b285[_0xbe14('0x37')],['id',_0xbe14('0x42'),_0xbe14('0x43')]);return db[_0xbe14('0x23')][_0xbe14('0x36')](_['merge'](_0xf32e93,_0xb2b285['body']),{'include':_0xb2b285[_0xbe14('0x2e')][_0xbe14('0x33')]?[{'all':!![]}]:undefined})[_0xbe14('0x13')](function(_0x48554a){var _0x497b00=_0xb2b285[_0xbe14('0x38')][_0xbe14('0x15')]({'plain':!![]});if(!_0x497b00)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x497b00[_0xbe14('0x3a')]===_0xbe14('0x38')){var _0x50c2a0=_0x48554a[_0xbe14('0x15')]({'plain':!![]});var _0x4a40d2=[{'name':_0xbe14('0x3b'),'value':_0xbe14('0x16')},{'name':_0xbe14('0x17'),'value':'outbound'}];var _0x435c8d=_[_0xbe14('0x1d')](_0x4a40d2,['value',_0x50c2a0[_0xbe14('0x1c')]])[_0xbe14('0x1e')];return db[_0xbe14('0x3c')][_0xbe14('0x1d')]({'where':{'name':_0x435c8d,'userProfileId':_0x497b00[_0xbe14('0x44')]},'raw':!![]})['then'](function(_0x42a346){if(_0x42a346&&_0x42a346[_0xbe14('0x3d')]===0x0){return db[_0xbe14('0x3e')][_0xbe14('0x36')]({'name':_0x50c2a0[_0xbe14('0x1e')],'resourceId':_0x50c2a0['id'],'type':_0x42a346[_0xbe14('0x1e')],'sectionId':_0x42a346['id']},{})[_0xbe14('0x13')](function(){return _0x48554a;});}else{return _0x48554a;}})['catch'](function(_0x72c875){logger[_0xbe14('0x20')](_0xbe14('0x45'),_0x72c875);throw _0x72c875;});}return _0x48554a;});}})[_0xbe14('0x13')](respondWithResult(_0x2550dc,0xc9))[_0xbe14('0x35')](handleError(_0x2550dc,null));};exports[_0xbe14('0x12')]=function(_0xd8f78f,_0x32df3c){if(_0xd8f78f[_0xbe14('0x37')]['id']){delete _0xd8f78f[_0xbe14('0x37')]['id'];}return db[_0xbe14('0x23')]['find']({'where':{'id':_0xd8f78f['params']['id']}})['then'](handleEntityNotFound(_0x32df3c,null))[_0xbe14('0x13')](saveUpdates(_0xd8f78f[_0xbe14('0x37')],null))[_0xbe14('0x13')](respondWithResult(_0x32df3c,null))[_0xbe14('0x35')](handleError(_0x32df3c,null));};exports[_0xbe14('0x14')]=function(_0x66ddf,_0x16ee48){return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x66ddf[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x16ee48,null))[_0xbe14('0x13')](removeEntity(_0x16ee48,null))[_0xbe14('0x35')](handleError(_0x16ee48,null));};exports[_0xbe14('0x46')]=function(_0x1c831a,_0xcef8e3){var _0x179077={'raw':![],'where':{}};var _0x2225d9={};var _0x29761b={'count':0x0,'rows':[]};return db[_0xbe14('0x23')]['findOne']({'where':{'id':_0x1c831a[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0xcef8e3,null))[_0xbe14('0x13')](function(_0x46b49c){if(_0x46b49c){_0x2225d9[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x47')][_0xbe14('0x24')]);_0x2225d9[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x1c831a['query']);_0x2225d9[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x2225d9[_0xbe14('0x2c')],_0x2225d9[_0xbe14('0x2e')]);_0x179077[_0xbe14('0x30')]=_['intersection'](_0x2225d9[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x179077[_0xbe14('0x30')]=_0x179077['attributes'][_0xbe14('0x32')]?_0x179077[_0xbe14('0x30')]:_0x2225d9[_0xbe14('0x2c')];if(!_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x179077[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x1c831a['query'][_0xbe14('0xf')]);_0x179077[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x1c831a[_0xbe14('0x2e')][_0xbe14('0xd')]);}_0x179077[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x1c831a['query']['sort']);_0x179077[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_[_0xbe14('0x4d')](_0x1c831a[_0xbe14('0x2e')],_0x2225d9[_0xbe14('0x48')]));_0x179077[_0xbe14('0x28')][_0xbe14('0x4e')]=_0x46b49c['id'];if(_0x1c831a[_0xbe14('0x2e')]['filter']){_0x179077['where']=_[_0xbe14('0x40')](_0x179077[_0xbe14('0x28')],{'$or':_[_0xbe14('0x1a')](_0x179077['attributes'],function(_0x76e91e){var _0x16bca1={};_0x16bca1[_0x76e91e]={'$like':'%'+_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x16bca1;})});}_0x179077=_[_0xbe14('0x40')]({},_0x179077,_0x1c831a[_0xbe14('0x34')]);return db[_0xbe14('0x47')]['count']({'where':_0x179077[_0xbe14('0x28')]})[_0xbe14('0x13')](function(_0x3baa26){_0x29761b[_0xbe14('0x10')]=_0x3baa26;if(_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x179077[_0xbe14('0x29')]=[{'all':!![]}];}return db['CmHopper'][_0xbe14('0x4f')](_0x179077);})[_0xbe14('0x13')](function(_0x3cd17e){_0x29761b[_0xbe14('0x50')]=_0x3cd17e;return _0x29761b;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0xcef8e3,_0x179077))[_0xbe14('0x35')](handleError(_0xcef8e3,null));};exports[_0xbe14('0x51')]=function(_0xd756b2,_0x5d064e){var _0x1e5ce1={'raw':!![],'where':{}};var _0x401968={};var _0x362999={'count':0x0,'rows':[]};return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0xd756b2[_0xbe14('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5d064e,null))[_0xbe14('0x13')](function(_0x175213){if(_0x175213){_0x401968[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db['CmHopperHistory'][_0xbe14('0x24')]);_0x401968[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0xd756b2[_0xbe14('0x2e')]);_0x401968[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x401968[_0xbe14('0x2c')],_0x401968['query']);_0x1e5ce1[_0xbe14('0x30')]=_['intersection'](_0x401968[_0xbe14('0x2c')],qs['fields'](_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x1e5ce1[_0xbe14('0x30')]=_0x1e5ce1['attributes'][_0xbe14('0x32')]?_0x1e5ce1[_0xbe14('0x30')]:_0x401968[_0xbe14('0x2c')];if(!_0xd756b2['query'][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x1e5ce1[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0xd756b2['query'][_0xbe14('0xf')]);_0x1e5ce1[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0xd756b2[_0xbe14('0x2e')][_0xbe14('0xd')]);}_0x1e5ce1[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0xd756b2['query'][_0xbe14('0x4c')]);_0x1e5ce1[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_['pick'](_0xd756b2[_0xbe14('0x2e')],_0x401968[_0xbe14('0x48')]));_0x1e5ce1[_0xbe14('0x28')]['VoiceQueueId']=_0x175213['id'];if(_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x1e5ce1['where']=_[_0xbe14('0x40')](_0x1e5ce1['where'],{'$or':_[_0xbe14('0x1a')](_0x1e5ce1[_0xbe14('0x30')],function(_0x4dfa19){var _0x55d729={};_0x55d729[_0x4dfa19]={'$like':'%'+_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x55d729;})});}_0x1e5ce1=_[_0xbe14('0x40')]({},_0x1e5ce1,_0xd756b2['options']);return db[_0xbe14('0x53')][_0xbe14('0x10')]({'where':_0x1e5ce1[_0xbe14('0x28')]})[_0xbe14('0x13')](function(_0x5ee624){_0x362999['count']=_0x5ee624;if(_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x1e5ce1[_0xbe14('0x29')]=[{'all':!![]}];}return db[_0xbe14('0x53')][_0xbe14('0x4f')](_0x1e5ce1);})[_0xbe14('0x13')](function(_0x139aab){_0x362999['rows']=_0x139aab;return _0x362999;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0x5d064e,_0x1e5ce1))['catch'](handleError(_0x5d064e,null));};exports[_0xbe14('0x54')]=function(_0x3a01bb,_0x8d47f2){var _0x2382c4={'raw':!![],'where':{}};var _0x55a3ae={};var _0x1e160b={'count':0x0,'rows':[]};return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x3a01bb['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x8d47f2,null))[_0xbe14('0x13')](function(_0x4090bc){if(_0x4090bc){_0x55a3ae[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x55')][_0xbe14('0x24')]);_0x55a3ae[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x3a01bb[_0xbe14('0x2e')]);_0x55a3ae[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x55a3ae[_0xbe14('0x2c')],_0x55a3ae[_0xbe14('0x2e')]);_0x2382c4[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x55a3ae[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x2382c4['attributes']=_0x2382c4[_0xbe14('0x30')]['length']?_0x2382c4[_0xbe14('0x30')]:_0x55a3ae[_0xbe14('0x2c')];if(!_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x2382c4['limit']=qs['limit'](_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x2382c4[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x3a01bb['query'][_0xbe14('0xd')]);}_0x2382c4[_0xbe14('0x4b')]=qs['sort'](_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x2382c4[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_['pick'](_0x3a01bb[_0xbe14('0x2e')],_0x55a3ae['filters']));_0x2382c4['where'][_0xbe14('0x4e')]=_0x4090bc['id'];if(_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x2382c4[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x2382c4['where'],{'$or':_[_0xbe14('0x1a')](_0x2382c4[_0xbe14('0x30')],function(_0x5dc793){var _0x4e35ed={};_0x4e35ed[_0x5dc793]={'$like':'%'+_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x4e35ed;})});}_0x2382c4=_['merge']({},_0x2382c4,_0x3a01bb[_0xbe14('0x34')]);return db['CmHopperFinal'][_0xbe14('0x10')]({'where':_0x2382c4['where']})[_0xbe14('0x13')](function(_0x5d4431){_0x1e160b[_0xbe14('0x10')]=_0x5d4431;if(_0x3a01bb['query'][_0xbe14('0x33')]){_0x2382c4[_0xbe14('0x29')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x2382c4);})[_0xbe14('0x13')](function(_0x4db7e8){_0x1e160b['rows']=_0x4db7e8;return _0x1e160b;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0x8d47f2,_0x2382c4))[_0xbe14('0x35')](handleError(_0x8d47f2,null));};exports[_0xbe14('0x56')]=function(_0x11c341,_0x1a780a){var _0x313a87={'raw':!![],'where':{}};var _0x30d2b0={};var _0x57ad22={'count':0x0,'rows':[]};return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x11c341[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x1a780a,null))['then'](function(_0x26372a){if(_0x26372a){_0x30d2b0[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db['CmHopperBlack'][_0xbe14('0x24')]);_0x30d2b0[_0xbe14('0x2e')]=_['keys'](_0x11c341[_0xbe14('0x2e')]);_0x30d2b0['filters']=_[_0xbe14('0x2f')](_0x30d2b0[_0xbe14('0x2c')],_0x30d2b0[_0xbe14('0x2e')]);_0x313a87['attributes']=_[_0xbe14('0x2f')](_0x30d2b0['model'],qs[_0xbe14('0x31')](_0x11c341['query']['fields']));_0x313a87[_0xbe14('0x30')]=_0x313a87['attributes'][_0xbe14('0x32')]?_0x313a87['attributes']:_0x30d2b0[_0xbe14('0x2c')];if(!_0x11c341[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x313a87[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x11c341[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x313a87[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x11c341[_0xbe14('0x2e')][_0xbe14('0xd')]);}_0x313a87[_0xbe14('0x4b')]=qs['sort'](_0x11c341[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x313a87[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_[_0xbe14('0x4d')](_0x11c341['query'],_0x30d2b0['filters']));_0x313a87[_0xbe14('0x28')][_0xbe14('0x4e')]=_0x26372a['id'];if(_0x11c341[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x313a87[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x313a87[_0xbe14('0x28')],{'$or':_[_0xbe14('0x1a')](_0x313a87[_0xbe14('0x30')],function(_0x26e7a7){var _0x761b3d={};_0x761b3d[_0x26e7a7]={'$like':'%'+_0x11c341[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x761b3d;})});}_0x313a87=_[_0xbe14('0x40')]({},_0x313a87,_0x11c341[_0xbe14('0x34')]);return db[_0xbe14('0x57')][_0xbe14('0x10')]({'where':_0x313a87[_0xbe14('0x28')]})[_0xbe14('0x13')](function(_0x28a1e9){_0x57ad22[_0xbe14('0x10')]=_0x28a1e9;if(_0x11c341[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x313a87[_0xbe14('0x29')]=[{'all':!![]}];}return db[_0xbe14('0x57')]['findAll'](_0x313a87);})[_0xbe14('0x13')](function(_0x3303a4){_0x57ad22[_0xbe14('0x50')]=_0x3303a4;return _0x57ad22;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0x1a780a,_0x313a87))[_0xbe14('0x35')](handleError(_0x1a780a,null));};exports[_0xbe14('0x58')]=function(_0x52b75d,_0x5b161c){var _0x165b7a={};var _0x4a44e0={};var _0x3730d1;var _0x4babba;return db[_0xbe14('0x23')]['findOne']({'where':{'id':_0x52b75d[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x5b161c,null))[_0xbe14('0x13')](function(_0x12498f){if(_0x12498f){_0x3730d1=_0x12498f;_0x4a44e0[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x59')][_0xbe14('0x24')]);_0x4a44e0[_0xbe14('0x2e')]=_['keys'](_0x52b75d[_0xbe14('0x2e')]);_0x4a44e0[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x4a44e0[_0xbe14('0x2c')],_0x4a44e0['query']);_0x165b7a[_0xbe14('0x30')]=_['intersection'](_0x4a44e0[_0xbe14('0x2c')],qs['fields'](_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x165b7a[_0xbe14('0x30')]=_0x165b7a['attributes'][_0xbe14('0x32')]?_0x165b7a['attributes']:_0x4a44e0[_0xbe14('0x2c')];_0x165b7a[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x165b7a[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_[_0xbe14('0x4d')](_0x52b75d[_0xbe14('0x2e')],_0x4a44e0['filters']));if(_0x52b75d[_0xbe14('0x2e')]['filter']){_0x165b7a[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x165b7a[_0xbe14('0x28')],{'$or':_['map'](_0x165b7a[_0xbe14('0x30')],function(_0x1c5fbc){var _0x219403={};_0x219403[_0x1c5fbc]={'$like':'%'+_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x219403;})});}_0x165b7a=_['merge']({},_0x165b7a,_0x52b75d['options']);return _0x3730d1[_0xbe14('0x58')](_0x165b7a);}})['then'](function(_0x16b1c8){if(_0x16b1c8){_0x4babba=_0x16b1c8[_0xbe14('0x32')];if(!_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x49')]('nolimit')){_0x165b7a[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x52b75d['query'][_0xbe14('0xf')]);_0x165b7a[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x52b75d[_0xbe14('0x2e')]['offset']);}return _0x3730d1[_0xbe14('0x58')](_0x165b7a);}})[_0xbe14('0x13')](function(_0x37aff6){if(_0x37aff6){return _0x37aff6?{'count':_0x4babba,'rows':_0x37aff6}:null;}})[_0xbe14('0x13')](respondWithResult(_0x5b161c,null))[_0xbe14('0x35')](handleError(_0x5b161c,null));};exports[_0xbe14('0x5a')]=function(_0x208fae,_0x310d42){var _0x9c229f=_0x208fae[_0xbe14('0x37')]['teams'];var _0xdb5515=_[_0xbe14('0x1a')](_0x9c229f,'id');return db[_0xbe14('0x59')][_0xbe14('0x4f')]({'where':{'id':_0xdb5515},'attributes':['id'],'include':[{'model':db['User'],'as':_0xbe14('0x5b'),'attributes':['id',_0xbe14('0x1e'),_0xbe14('0x5c'),'voicePause',_0xbe14('0x5d')],'raw':!![]}]})[_0xbe14('0x13')](function(_0x1ec868){if(_0x1ec868){var _0x1a7321=_[_0xbe14('0x5e')](_0x1ec868,function(_0x2306f6){var _0x426189=_0x2306f6['get']({'plain':!![]});_0x426189[_0xbe14('0x5b')]['forEach'](function(_0x24d528){_0x24d528[_0xbe14('0x5f')]=_[_0xbe14('0x1d')](_0x9c229f,{'id':_0x426189['id']})[_0xbe14('0x5f')];});return _0x426189[_0xbe14('0x5b')];});return db['VoiceQueue']['find']({'where':{'id':_0x208fae[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](function(_0x29a892){return db[_0xbe14('0x60')]['transaction'](function(_0x46a251){return _0x29a892[_0xbe14('0x5a')](_0xdb5515,{'transaction':_0x46a251})[_0xbe14('0x13')](function(){return BPromise['each'](_0x9c229f,function(_0xe69b0e){return db['TeamVoiceQueue']['upsert']({'TeamId':_0xe69b0e['id'],'VoiceQueueId':_0x208fae[_0xbe14('0x2b')]['id'],'penalty':_0xe69b0e[_0xbe14('0x5f')]},{'transaction':_0x46a251});});})[_0xbe14('0x13')](function(){return BPromise['each'](_0x1a7321,function(_0x3ea9c2){return db[_0xbe14('0x61')]['findOrCreate']({'where':{'UserId':_0x3ea9c2['id'],'VoiceQueueId':_0x208fae[_0xbe14('0x2b')]['id']},'defaults':{'penalty':_0x3ea9c2[_0xbe14('0x5f')]},'transaction':_0x46a251});});})[_0xbe14('0x13')](function(){return BPromise['each'](_[_0xbe14('0x19')](_0x1a7321,{'online':!![]}),function(_0x1e2559){return db[_0xbe14('0x62')][_0xbe14('0x63')]({'membername':_0x1e2559[_0xbe14('0x1e')],'UserId':_0x1e2559['id'],'queue_name':_0x29a892['name'],'VoiceQueueId':_0x29a892['id'],'interface':_[_0xbe14('0x64')](_0x1e2559[_0xbe14('0x5d')])?util[_0xbe14('0x65')]('SIP/%s',_0x1e2559[_0xbe14('0x1e')]):_0x1e2559[_0xbe14('0x5d')],'paused':_0x1e2559[_0xbe14('0x66')]||![],'penalty':_0x1e2559[_0xbe14('0x5f')]},{'transaction':_0x46a251});});})[_0xbe14('0x13')](function(){_0x1a7321[_0xbe14('0x67')](function(_0x1b22a0){socket[_0xbe14('0x68')](_0xbe14('0x69'),{'UserId':_0x1b22a0['id'],'VoiceQueueId':_0x29a892['id']});});});});});}})[_0xbe14('0x13')](respondWithStatusCode(_0x310d42,null))[_0xbe14('0x35')](handleError(_0x310d42,null));};exports['removeTeams']=function(_0xf549ec,_0x2c3647){return db[_0xbe14('0x59')]['findAll']({'where':{'id':_0xf549ec[_0xbe14('0x2e')][_0xbe14('0x6a')]},'attributes':['id'],'include':[{'model':db[_0xbe14('0x6b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xbe14('0x13')](handleEntityNotFound(_0x2c3647,null))['then'](function(_0x2d4b18){var _0xcd8cf6=_['map'](_0x2d4b18,'id');var _0x269e5a=[];var _0x4c7e2b=[];var _0x587f58=squel[_0xbe14('0x6c')]();_0x587f58[_0xbe14('0x6d')](_0xbe14('0x6e'))[_0xbe14('0x6f')](_0xbe14('0x70'),'tq')[_0xbe14('0x71')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xbe14('0x28')](_0xbe14('0x72'),_0xf549ec[_0xbe14('0x2b')]['id']);for(var _0x3c23fc=0x0;_0x3c23fc<_0x2d4b18['length'];_0x3c23fc+=0x1){let _0x1d5333=_0x2d4b18[_0x3c23fc];for(var _0x4cb29c=0x0;_0x4cb29c<_0x1d5333[_0xbe14('0x5b')][_0xbe14('0x32')];_0x4cb29c+=0x1){let _0x5270b2=_0x1d5333[_0xbe14('0x5b')][_0x4cb29c];var _0x273df5=_0x587f58[_0xbe14('0x3f')]();_0x273df5[_0xbe14('0x28')](_0xbe14('0x73'),_0x5270b2['id']);_0x4c7e2b[_0xbe14('0x74')](db[_0xbe14('0x60')][_0xbe14('0x2e')](_0x273df5[_0xbe14('0x75')](),{'type':db[_0xbe14('0x60')][_0xbe14('0x76')][_0xbe14('0x77')]})['then'](function(_0x20f196){if(_0x20f196[_0xbe14('0x32')]===0x1){return _0x5270b2['id'];}else{var _0x1eb33b=_[_0xbe14('0x78')](_['map'](_0x20f196,_0xbe14('0x79')),function(_0xede1c1){return _['includes'](_0xcd8cf6,_0xede1c1);});if(_0x1eb33b){return _0x5270b2['id'];}}}));}}return BPromise[_0xbe14('0x7a')](_0x4c7e2b)[_0xbe14('0x13')](function(_0x11085c){_0x269e5a=_(_0x269e5a)['union'](_0x11085c)[_0xbe14('0x7b')]()[_0xbe14('0x1b')]();return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0xf549ec[_0xbe14('0x2b')]['id']}})['then'](function(_0x23208d){return db[_0xbe14('0x60')][_0xbe14('0x7c')](function(_0x3f7732){return _0x23208d[_0xbe14('0x7d')](_0xf549ec['query'][_0xbe14('0x6a')],{'transaction':_0x3f7732})[_0xbe14('0x13')](function(){if(!_[_0xbe14('0x7e')](_0x269e5a)){return _0x23208d[_0xbe14('0x7f')](_0x269e5a,{'transaction':_0x3f7732})[_0xbe14('0x13')](function(){return db[_0xbe14('0x62')][_0xbe14('0x14')]({'where':{'VoiceQueueId':_0xf549ec[_0xbe14('0x2b')]['id'],'UserId':_0x269e5a},'transaction':_0x3f7732});});}})['then'](function(){_0x269e5a['forEach'](function(_0x129ef6){socket[_0xbe14('0x68')](_0xbe14('0x80'),{'UserId':_0x129ef6,'VoiceQueueId':_0x23208d['id']});});});});});});})[_0xbe14('0x13')](respondWithStatusCode(_0x2c3647,null))[_0xbe14('0x35')](handleError(_0x2c3647,null));};exports['addAgents']=function(_0x15c93c,_0xf6ff8){var _0x3eaabe,_0x1ea11a;return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x15c93c[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0xf6ff8,null))['then'](function(_0xf6da38){if(_0xf6da38){_0x1ea11a=_0xf6da38;return _0xf6da38[_0xbe14('0x81')](_0x15c93c['body']['ids'],_[_0xbe14('0x41')](_0x15c93c['body'],[_0xbe14('0x6a'),'id'])||{})[_0xbe14('0x82')](function(_0x776e93){for(var _0x3f5ca3=0x0;_0x3f5ca3<_0x15c93c[_0xbe14('0x37')]['ids'][_0xbe14('0x32')];_0x3f5ca3+=0x1){socket[_0xbe14('0x68')](_0xbe14('0x69'),{'UserId':Number(_0x15c93c[_0xbe14('0x37')][_0xbe14('0x6a')][_0x3f5ca3]),'VoiceQueueId':Number(_0x15c93c[_0xbe14('0x2b')]['id'])});}return _0x776e93;});}})['then'](function(_0x4eea48){_0x3eaabe=_0x4eea48||[];if(_0x1ea11a){return db[_0xbe14('0x6b')]['findAll']({'where':{'id':_0x15c93c[_0xbe14('0x37')][_0xbe14('0x6a')]},'attributes':['id',_0xbe14('0x1e'),'online',_0xbe14('0x66'),_0xbe14('0x5d')],'raw':!![]});}})[_0xbe14('0x13')](function(_0x1ad15d){if(!_[_0xbe14('0x7e')](_0x1ad15d)){var _0x2e5106=[];for(var _0x156fb3=0x0;_0x156fb3<_0x1ad15d['length'];_0x156fb3++){if(_0x1ad15d[_0x156fb3][_0xbe14('0x5c')]){_0x2e5106['push'](db['UserVoiceQueueRt']['upsert']({'membername':_0x1ad15d[_0x156fb3]['name'],'UserId':_0x1ad15d[_0x156fb3]['id'],'queue_name':_0x1ea11a[_0xbe14('0x1e')],'VoiceQueueId':_0x1ea11a['id'],'interface':_[_0xbe14('0x64')](_0x1ad15d[_0x156fb3]['interface'])?util[_0xbe14('0x65')]('SIP/%s',_0x1ad15d[_0x156fb3][_0xbe14('0x1e')]):_0x1ad15d[_0x156fb3]['interface'],'paused':_0x1ad15d[_0x156fb3][_0xbe14('0x66')]||![],'penalty':_0x15c93c[_0xbe14('0x37')][_0xbe14('0x5f')]||0x0}));}}return BPromise[_0xbe14('0x7a')](_0x2e5106);}})[_0xbe14('0x13')](function(){return _0x3eaabe;})['then'](respondWithResult(_0xf6ff8,null))[_0xbe14('0x35')](handleError(_0xf6ff8,null));};exports[_0xbe14('0x7f')]=function(_0x3aaa54,_0x413893){return db['VoiceQueue']['find']({'where':{'id':_0x3aaa54['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x413893,null))[_0xbe14('0x13')](function(_0x3826cf){if(_0x3826cf){return _0x3826cf[_0xbe14('0x7f')](_0x3aaa54[_0xbe14('0x2e')]['ids'])['then'](function(){if(_[_0xbe14('0x83')](_0x3aaa54[_0xbe14('0x2e')][_0xbe14('0x6a')])){for(var _0x26092b=0x0;_0x26092b<_0x3aaa54[_0xbe14('0x2e')]['ids'][_0xbe14('0x32')];_0x26092b+=0x1){socket['emit'](_0xbe14('0x80'),{'UserId':Number(_0x3aaa54[_0xbe14('0x2e')][_0xbe14('0x6a')][_0x26092b]),'VoiceQueueId':Number(_0x3aaa54[_0xbe14('0x2b')]['id'])});}}else{socket['emit'](_0xbe14('0x80'),{'UserId':Number(_0x3aaa54[_0xbe14('0x2e')][_0xbe14('0x6a')]),'VoiceQueueId':Number(_0x3aaa54[_0xbe14('0x2b')]['id'])});}});}})['then'](function(_0x44c341){return db[_0xbe14('0x62')][_0xbe14('0x14')]({'where':{'VoiceQueueId':_0x3aaa54['params']['id'],'UserId':_0x3aaa54['query'][_0xbe14('0x6a')]}})[_0xbe14('0x13')](function(){return _0x44c341;});})[_0xbe14('0x13')](respondWithStatusCode(_0x413893,null))['catch'](handleError(_0x413893,null));};exports[_0xbe14('0x84')]=function(_0x2f0d14,_0x180e61){var _0x952322={};var _0x3ae00b={};var _0x41962a;var _0x4ebf01;return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x2f0d14[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x180e61,null))[_0xbe14('0x13')](function(_0x5f28dd){if(_0x5f28dd){_0x41962a=_0x5f28dd;_0x3ae00b['model']=_[_0xbe14('0x2d')](db['User'][_0xbe14('0x24')]);_0x3ae00b['query']=_[_0xbe14('0x2d')](_0x2f0d14[_0xbe14('0x2e')]);_0x3ae00b[_0xbe14('0x48')]=_['intersection'](_0x3ae00b[_0xbe14('0x2c')],_0x3ae00b[_0xbe14('0x2e')]);_0x952322[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x3ae00b[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x952322[_0xbe14('0x30')]=_0x952322[_0xbe14('0x30')]['length']?_0x952322[_0xbe14('0x30')]:_0x3ae00b[_0xbe14('0x2c')];_0x952322[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x952322[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_['pick'](_0x2f0d14[_0xbe14('0x2e')],_0x3ae00b[_0xbe14('0x48')]));if(_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x952322[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x952322['where'],{'$or':_['map'](_0x952322['attributes'],function(_0x598ccc){var _0x446b3f={};_0x446b3f[_0x598ccc]={'$like':'%'+_0x2f0d14[_0xbe14('0x2e')]['filter']+'%'};return _0x446b3f;})});}_0x952322=_[_0xbe14('0x40')]({},_0x952322,_0x2f0d14['options']);return _0x41962a[_0xbe14('0x84')](_0x952322);}})[_0xbe14('0x13')](function(_0x111ff0){if(_0x111ff0){_0x4ebf01=_0x111ff0[_0xbe14('0x32')];if(!_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x49')]('nolimit')){_0x952322[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x952322[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0xd')]);}return _0x41962a[_0xbe14('0x84')](_0x952322);}})['then'](function(_0x2eb5e6){if(_0x2eb5e6){return _0x2eb5e6?{'count':_0x4ebf01,'rows':_0x2eb5e6}:null;}})['then'](respondWithResult(_0x180e61,null))[_0xbe14('0x35')](handleError(_0x180e61,null));};exports['getMembers']=function(_0x49cddc,_0x3bdbf7){var _0x19a1ae={};var _0x167dee={};var _0x4f6252;var _0x4536b9;return db['VoiceQueue'][_0xbe14('0x52')]({'where':{'id':_0x49cddc['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x3bdbf7,null))[_0xbe14('0x13')](function(_0x21f14e){if(_0x21f14e){_0x4f6252=_0x21f14e;_0x167dee[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x62')]['rawAttributes']);_0x167dee[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x49cddc['query']);_0x167dee['filters']=_['intersection'](_0x167dee[_0xbe14('0x2c')],_0x167dee[_0xbe14('0x2e')]);_0x19a1ae[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x167dee[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x49cddc[_0xbe14('0x2e')]['fields']));_0x19a1ae[_0xbe14('0x30')]=_0x19a1ae[_0xbe14('0x30')][_0xbe14('0x32')]?_0x19a1ae['attributes']:_0x167dee[_0xbe14('0x2c')];_0x19a1ae[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x49cddc['query']['sort']);_0x19a1ae[_0xbe14('0x28')]=qs['filters'](_[_0xbe14('0x4d')](_0x49cddc[_0xbe14('0x2e')],_0x167dee[_0xbe14('0x48')]));if(_0x49cddc[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x19a1ae[_0xbe14('0x28')]=_['merge'](_0x19a1ae[_0xbe14('0x28')],{'$or':_['map'](_0x19a1ae[_0xbe14('0x30')],function(_0x2d0568){var _0x26bb56={};_0x26bb56[_0x2d0568]={'$like':'%'+_0x49cddc['query'][_0xbe14('0x19')]+'%'};return _0x26bb56;})});}_0x19a1ae=_[_0xbe14('0x40')]({},_0x19a1ae,_0x49cddc['options']);return _0x4f6252['getMembers'](_0x19a1ae);}})[_0xbe14('0x13')](function(_0x3d9061){if(_0x3d9061){_0x4536b9=_0x3d9061[_0xbe14('0x32')];if(!_0x49cddc['query'][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x19a1ae['limit']=qs['limit'](_0x49cddc['query']['limit']);_0x19a1ae[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x49cddc['query']['offset']);}return _0x4f6252[_0xbe14('0x85')](_0x19a1ae);}})[_0xbe14('0x13')](function(_0x1046a0){return _0x1046a0?{'count':_0x4536b9,'rows':_0x1046a0}:null;})['then'](respondWithResult(_0x3bdbf7,null))[_0xbe14('0x35')](handleError(_0x3bdbf7,null));};exports[_0xbe14('0x86')]=function(_0x3933c7,_0x416c65){var _0x56f870={};var _0x28b3c4={};var _0x6fe862;var _0x5f4675;return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x3933c7[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x416c65,null))[_0xbe14('0x13')](function(_0x4c4ab9){if(_0x4c4ab9){_0x6fe862=_0x4c4ab9;_0x28b3c4['model']=_[_0xbe14('0x2d')](db[_0xbe14('0x87')][_0xbe14('0x24')]);_0x28b3c4[_0xbe14('0x2e')]=_['keys'](_0x3933c7[_0xbe14('0x2e')]);_0x28b3c4[_0xbe14('0x48')]=_['intersection'](_0x28b3c4[_0xbe14('0x2c')],_0x28b3c4['query']);_0x56f870[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x28b3c4['model'],qs[_0xbe14('0x31')](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x56f870[_0xbe14('0x30')]=_0x56f870[_0xbe14('0x30')][_0xbe14('0x32')]?_0x56f870[_0xbe14('0x30')]:_0x28b3c4[_0xbe14('0x2c')];_0x56f870['order']=qs[_0xbe14('0x4c')](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x56f870['where']=qs['filters'](_['pick'](_0x3933c7[_0xbe14('0x2e')],_0x28b3c4[_0xbe14('0x48')]));if(_0x3933c7[_0xbe14('0x2e')]['filter']){_0x56f870['where']=_[_0xbe14('0x40')](_0x56f870[_0xbe14('0x28')],{'$or':_[_0xbe14('0x1a')](_0x56f870[_0xbe14('0x30')],function(_0x2ac6c0){var _0x3d381e={};_0x3d381e[_0x2ac6c0]={'$like':'%'+_0x3933c7[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x3d381e;})});}_0x56f870=_[_0xbe14('0x40')]({},_0x56f870,_0x3933c7['options']);return _0x6fe862[_0xbe14('0x86')](_0x56f870);}})[_0xbe14('0x13')](function(_0x2ca4de){if(_0x2ca4de){_0x5f4675=_0x2ca4de[_0xbe14('0x32')];if(!_0x3933c7[_0xbe14('0x2e')]['hasOwnProperty'](_0xbe14('0x4a'))){_0x56f870['limit']=qs['limit'](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x56f870['offset']=qs['offset'](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0xd')]);}return _0x6fe862[_0xbe14('0x86')](_0x56f870);}})[_0xbe14('0x13')](function(_0x2e7c31){if(_0x2e7c31){return _0x2e7c31?{'count':_0x5f4675,'rows':_0x2e7c31}:null;}})['then'](respondWithResult(_0x416c65,null))['catch'](handleError(_0x416c65,null));};exports[_0xbe14('0x88')]=function(_0x4b07fc,_0x76e84){var _0x3f687f=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x4f4b69,_0x43d760;return db['VoiceQueue'][_0xbe14('0x1d')]({'where':{'id':_0x4b07fc[_0xbe14('0x2b')]['id']}})['then'](handleEntityNotFound(_0x76e84,null))[_0xbe14('0x13')](function(_0x30657c){if(_0x30657c){_0x43d760=_0x30657c;return _0x30657c[_0xbe14('0x88')](_0x4b07fc[_0xbe14('0x37')][_0xbe14('0x6a')],_['omit'](_0x4b07fc[_0xbe14('0x37')],[_0xbe14('0x6a'),'id'])||{});}return null;})[_0xbe14('0x82')](function(_0xd97d02){var _0x15082b;_0x4f4b69=_0xd97d02||[];var _0x5d15c7=[];if(_0xd97d02){for(var _0x66b6a7=0x0;_0x66b6a7<_0xd97d02[_0xbe14('0x32')];_0x66b6a7+=0x1){var _0x4dfe2c=_0xd97d02[_0x66b6a7][_0xbe14('0x15')]({'plain':!![]});_0x43d760['dialCheckDuplicateType']=_0x4b07fc[_0xbe14('0x37')][_0xbe14('0x89')]?_0x4b07fc[_0xbe14('0x37')][_0xbe14('0x89')]:_0x43d760[_0xbe14('0x89')];switch(_0x43d760[_0xbe14('0x89')]){case'always':_0x15082b=squel[_0xbe14('0x8a')]()[_0xbe14('0x8b')](_0xbe14('0x8c'))[_0xbe14('0x8d')]([_0xbe14('0x8e'),_0xbe14('0x8f'),_0xbe14('0x90'),_0xbe14('0x91'),_0xbe14('0x4e'),_0xbe14('0x42'),'updatedAt'],squel[_0xbe14('0x6c')]()[_0xbe14('0x6d')]('phone',_0xbe14('0x8e'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x8f'))[_0xbe14('0x6d')]('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x4dfe2c[_0xbe14('0x92')][_0xbe14('0x75')](),'ListId')[_0xbe14('0x6d')](_0x4b07fc['params']['id'][_0xbe14('0x75')](),_0xbe14('0x4e'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x42'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0xbe14('0x28')](_0xbe14('0x93'),_0x4dfe2c['CmListId'][_0xbe14('0x75')]())[_0xbe14('0x28')](_0xbe14('0x94'))[_0xbe14('0x28')](_0xbe14('0x95'),squel[_0xbe14('0x6c')]()[_0xbe14('0x6d')](_0xbe14('0x96'))[_0xbe14('0x6f')](_0xbe14('0x97'))[_0xbe14('0x28')]('VoiceQueueId\x20=\x20?',_0x4b07fc[_0xbe14('0x2b')]['id']['toString']()))[_0xbe14('0x28')](_0xbe14('0x95'),squel[_0xbe14('0x6c')]()['field'](_0xbe14('0x98'))[_0xbe14('0x6f')]('cm_hopper')[_0xbe14('0x28')](_0xbe14('0x72'),_0x4b07fc[_0xbe14('0x2b')]['id']['toString']())))[_0xbe14('0x75')]();break;case _0xbe14('0x99'):_0x15082b=squel['insert']()[_0xbe14('0x8b')]('cm_hopper')[_0xbe14('0x8d')]([_0xbe14('0x8e'),_0xbe14('0x8f'),_0xbe14('0x90'),'ListId','VoiceQueueId',_0xbe14('0x42'),_0xbe14('0x43')],squel['select']()['field'](_0xbe14('0x8e'),'phone')[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x8f'))[_0xbe14('0x6d')]('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x4dfe2c[_0xbe14('0x92')][_0xbe14('0x75')](),_0xbe14('0x91'))[_0xbe14('0x6d')](_0x4b07fc[_0xbe14('0x2b')]['id']['toString'](),'VoiceQueueId')['field']('\x27'+_0x3f687f+'\x27',_0xbe14('0x42'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')](_0xbe14('0x9a'))[_0xbe14('0x28')](_0xbe14('0x9b'))[_0xbe14('0x28')](_0xbe14('0x93'),_0x4dfe2c['CmListId'][_0xbe14('0x75')]())[_0xbe14('0x28')](_0xbe14('0x94'))['where'](_0xbe14('0x95'),squel[_0xbe14('0x6c')]()[_0xbe14('0x6d')](_0xbe14('0x98'))[_0xbe14('0x6f')](_0xbe14('0x8c'))[_0xbe14('0x28')]('VoiceQueueId\x20=\x20?',_0x4b07fc[_0xbe14('0x2b')]['id'][_0xbe14('0x75')]())))['toString']();break;default:_0x15082b=squel['insert']()[_0xbe14('0x8b')](_0xbe14('0x8c'))[_0xbe14('0x8d')](['phone',_0xbe14('0x8f'),_0xbe14('0x90'),_0xbe14('0x91'),_0xbe14('0x4e'),_0xbe14('0x42'),_0xbe14('0x43')],squel['select']()[_0xbe14('0x6d')]('phone',_0xbe14('0x8e'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x8f'))['field']('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x4dfe2c['CmListId'][_0xbe14('0x75')](),'ListId')[_0xbe14('0x6d')](_0x4b07fc['params']['id'][_0xbe14('0x75')](),'VoiceQueueId')[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x42'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')]('cm_contacts')[_0xbe14('0x28')](_0xbe14('0x9b'))['where'](_0xbe14('0x93'),_0x4dfe2c[_0xbe14('0x92')]['toString']())[_0xbe14('0x28')](_0xbe14('0x94')))[_0xbe14('0x75')]();}_0x5d15c7['push'](db[_0xbe14('0x60')][_0xbe14('0x2e')](_0x15082b));}return BPromise[_0xbe14('0x7a')](_0x5d15c7);}})[_0xbe14('0x13')](function(){var _0x4bc564=[];var _0x19e7ce=squel[_0xbe14('0x8a')]()[_0xbe14('0x8b')](_0xbe14('0x9c'))[_0xbe14('0x8d')]([_0xbe14('0x9d'),_0xbe14('0x8e'),_0xbe14('0x9e'),_0xbe14('0x42'),'updatedAt'],squel[_0xbe14('0x6c')]()['field']('h.id')[_0xbe14('0x6d')](_0xbe14('0x9f'))['field'](_0xbe14('0xa0'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27','createdAt')[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')](_0xbe14('0xa1'),'ci')[_0xbe14('0x71')](_0xbe14('0x8c'),'h','h.ContactId=ci.CmContactId')['where'](_0xbe14('0xa2'),_0x3f687f)['where'](_0xbe14('0xa3'),_0xbe14('0xa4')))['toString']();_0x4bc564[_0xbe14('0x74')](db[_0xbe14('0x60')][_0xbe14('0x2e')](_0x19e7ce));return BPromise[_0xbe14('0x7a')](_0x4bc564);})[_0xbe14('0x13')](function(){return _0x4f4b69;})[_0xbe14('0x13')](respondWithResult(_0x76e84,null))[_0xbe14('0x35')](handleError(_0x76e84,null));};exports['removeLists']=function(_0x4ceca6,_0x23f4a3){return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x4ceca6[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x23f4a3,null))[_0xbe14('0x13')](function(_0x2fe8b0){if(_0x2fe8b0){return _0x2fe8b0[_0xbe14('0xa5')](_0x4ceca6['query'][_0xbe14('0x6a')]);}})[_0xbe14('0x13')](function(_0x186284){if(_0x186284){return db['CmHopper'][_0xbe14('0x14')]({'where':{'ListId':_0x4ceca6[_0xbe14('0x2e')][_0xbe14('0x6a')],'VoiceQueueId':_0x4ceca6[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](function(){return _0x186284;});}})['then'](respondWithStatusCode(_0x23f4a3,null))[_0xbe14('0x35')](handleError(_0x23f4a3,null));};exports[_0xbe14('0xa6')]=function(_0x4c9319,_0x1173f0){var _0x1e0c81={};var _0x5349a7={};var _0x5e3819;var _0x28c5fe;return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x4c9319['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x1173f0,null))[_0xbe14('0x13')](function(_0x59434a){if(_0x59434a){_0x5e3819=_0x59434a;_0x5349a7[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x87')]['rawAttributes']);_0x5349a7[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x4c9319[_0xbe14('0x2e')]);_0x5349a7[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x5349a7[_0xbe14('0x2c')],_0x5349a7[_0xbe14('0x2e')]);_0x1e0c81[_0xbe14('0x30')]=_['intersection'](_0x5349a7[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x4c9319[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x1e0c81[_0xbe14('0x30')]=_0x1e0c81['attributes'][_0xbe14('0x32')]?_0x1e0c81[_0xbe14('0x30')]:_0x5349a7[_0xbe14('0x2c')];_0x1e0c81[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x4c9319[_0xbe14('0x2e')]['sort']);_0x1e0c81['where']=qs['filters'](_[_0xbe14('0x4d')](_0x4c9319[_0xbe14('0x2e')],_0x5349a7['filters']));if(_0x4c9319[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x1e0c81[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x1e0c81['where'],{'$or':_[_0xbe14('0x1a')](_0x1e0c81[_0xbe14('0x30')],function(_0x52bbc1){var _0x2797ef={};_0x2797ef[_0x52bbc1]={'$like':'%'+_0x4c9319['query']['filter']+'%'};return _0x2797ef;})});}_0x1e0c81=_[_0xbe14('0x40')]({},_0x1e0c81,_0x4c9319[_0xbe14('0x34')]);return _0x5e3819[_0xbe14('0xa6')](_0x1e0c81);}})[_0xbe14('0x13')](function(_0x47bba1){if(_0x47bba1){_0x28c5fe=_0x47bba1[_0xbe14('0x32')];if(!_0x4c9319[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x1e0c81['limit']=qs[_0xbe14('0xf')](_0x4c9319[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x1e0c81[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x4c9319[_0xbe14('0x2e')][_0xbe14('0xd')]);}return _0x5e3819[_0xbe14('0xa6')](_0x1e0c81);}})['then'](function(_0x2592ab){if(_0x2592ab){return _0x2592ab?{'count':_0x28c5fe,'rows':_0x2592ab}:null;}})[_0xbe14('0x13')](respondWithResult(_0x1173f0,null))['catch'](handleError(_0x1173f0,null));};exports['addBlackLists']=function(_0x6a0f29,_0x3d04b9){var _0x21f793;return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x6a0f29[_0xbe14('0x2b')]['id']}})['then'](handleEntityNotFound(_0x3d04b9,null))[_0xbe14('0x13')](function(_0x37e5e8){if(_0x37e5e8){return _0x37e5e8['addBlackLists'](_0x6a0f29[_0xbe14('0x37')][_0xbe14('0x6a')],_[_0xbe14('0x41')](_0x6a0f29[_0xbe14('0x37')],[_0xbe14('0x6a'),'id'])||{});}return null;})[_0xbe14('0x82')](function(_0x14cec7){var _0x524603;_0x21f793=_0x14cec7||[];var _0x38d720=[];if(_0x14cec7){for(var _0x379446=0x0;_0x379446<_0x14cec7[_0xbe14('0x32')];_0x379446+=0x1){var _0x1489c9=_0x14cec7[_0x379446][_0xbe14('0x15')]({'plain':!![]});_0x524603=squel[_0xbe14('0x8a')]()[_0xbe14('0x8b')](_0xbe14('0xa7'))['fromQuery']([_0xbe14('0x8e'),_0xbe14('0x90'),_0xbe14('0x91'),'VoiceQueueId',_0xbe14('0x42'),_0xbe14('0x43')],squel[_0xbe14('0x6c')]()['field'](_0xbe14('0x8e'),'phone')[_0xbe14('0x6d')]('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x1489c9[_0xbe14('0x92')][_0xbe14('0x75')](),_0xbe14('0x91'))[_0xbe14('0x6d')](_0x6a0f29['params']['id'][_0xbe14('0x75')](),_0xbe14('0x4e'))[_0xbe14('0x6d')](_0xbe14('0xa8'),_0xbe14('0x42'))[_0xbe14('0x6d')](_0xbe14('0xa8'),'updatedAt')[_0xbe14('0x6f')](_0xbe14('0x9a'))[_0xbe14('0x28')](_0xbe14('0x9b'))[_0xbe14('0x28')](_0xbe14('0x93'),_0x1489c9[_0xbe14('0x92')][_0xbe14('0x75')]())[_0xbe14('0x28')](_0xbe14('0x94')))[_0xbe14('0x75')]();_0x38d720[_0xbe14('0x74')](db['sequelize'][_0xbe14('0x2e')](_0x524603));}return BPromise[_0xbe14('0x7a')](_0x38d720);}})['then'](function(){return _0x21f793;})['then'](respondWithResult(_0x3d04b9,null))[_0xbe14('0x35')](handleError(_0x3d04b9,null));};exports[_0xbe14('0xa9')]=function(_0x7533c3,_0x3ec670){return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x7533c3[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x3ec670,null))['then'](function(_0x3ee9e2){if(_0x3ee9e2){return _0x3ee9e2['removeBlackLists'](_0x7533c3[_0xbe14('0x2e')][_0xbe14('0x6a')]);}})[_0xbe14('0x13')](function(_0x1d343a){if(_0x1d343a){return db[_0xbe14('0x57')][_0xbe14('0x14')]({'where':{'ListId':_0x7533c3['query']['ids'],'VoiceQueueId':_0x7533c3['params']['id']}})['then'](function(){return _0x1d343a;});}})['then'](respondWithStatusCode(_0x3ec670,null))[_0xbe14('0x35')](handleError(_0x3ec670,null));}; \ No newline at end of file +var _0x3e74=['phone\x20NOT\x20IN\x20(?)','cm_hopper','onlyIfOpen','insert','into','fromQuery','phone\x20IS\x20NOT\x20NULL','COALESCE(phone,\x27\x27)','ListId\x20=\x20?','cm_hopper_additional_phones','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','PHONE','removeLists','getBlackLists','addBlackLists','NOW()','removeBlackLists','moment','util','lodash','squel','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','end','json','offset','undefined','count','limit','Content-Range','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','filter','map','value','includes','type','UserProfileResource','sendStatus','stack','name','status','send','index','VoiceQueue','rawAttributes','fieldName','key','getOptions','where','include','query','findAll','catch','show','intersection','model','attributes','fields','length','includeAll','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','error','clone','params','keys','omit','updatedAt','createdAt','outbound','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','findOne','CmHopper','hasOwnProperty','nolimit','sort','filters','pick','VoiceQueueId','options','rows','CmHopperHistory','getHopperFinals','CmHopperFinal','order','getHopperBlacks','CmHopperBlack','getTeams','Team','teams','online','interface','flatMap','Agents','forEach','penalty','sequelize','transaction','addTeams','each','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','voicePause','emit','userVoiceQueue:save','removeTeams','ids','User','select','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.UserId\x20=\x20?','push','QueryTypes','every','all','union','compact','isEmpty','userVoiceQueue:remove','addAgents','removeAgents','getAgents','getMembers','getLists','CmList','addLists','spread','dialCheckDuplicateType','always','phone','scheduledAt','field','ContactId','CmListId','toString','ListId','cm_contacts','deletedAt\x20IS\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?'];(function(_0x2c2ffb,_0x4e0365){var _0x2dfbce=function(_0x2d45cc){while(--_0x2d45cc){_0x2c2ffb['push'](_0x2c2ffb['shift']());}};_0x2dfbce(++_0x4e0365);}(_0x3e74,0x175));var _0x43e7=function(_0x4cadc2,_0x139406){_0x4cadc2=_0x4cadc2-0x0;var _0x1fb838=_0x3e74[_0x4cadc2];return _0x1fb838;};'use strict';var moment=require(_0x43e7('0x0'));var BPromise=require('bluebird');var util=require(_0x43e7('0x1'));var _=require(_0x43e7('0x2'));var squel=require(_0x43e7('0x3'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x43e7('0x4'))('api');var config=require(_0x43e7('0x5'));var db=require(_0x43e7('0x6'))['db'];config[_0x43e7('0x7')]=_[_0x43e7('0x8')](config[_0x43e7('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x43e7('0x9'))(new Redis(config[_0x43e7('0x7')]));require(_0x43e7('0xa'))[_0x43e7('0xb')](socket);function respondWithStatusCode(_0x21f491,_0x516b4d){_0x516b4d=_0x516b4d||0xcc;return function(_0x212c6c){if(_0x212c6c){return _0x21f491['sendStatus'](_0x516b4d);}return _0x21f491['status'](_0x516b4d)[_0x43e7('0xc')]();};}function respondWithResult(_0x4139c9,_0x5c34f4){_0x5c34f4=_0x5c34f4||0xc8;return function(_0x2803d9){if(_0x2803d9){return _0x4139c9['status'](_0x5c34f4)[_0x43e7('0xd')](_0x2803d9);}};}function respondWithFilteredResult(_0x37302c,_0x4ebc8e){return function(_0x3eb206){if(_0x3eb206){var _0xc960ea=typeof _0x4ebc8e[_0x43e7('0xe')]===_0x43e7('0xf')&&typeof _0x4ebc8e['limit']==='undefined';var _0x2fcb36=_0x3eb206[_0x43e7('0x10')];var _0x44b0bd=_0xc960ea?0x0:_0x4ebc8e['offset'];var _0x5e641c=_0xc960ea?_0x3eb206[_0x43e7('0x10')]:_0x4ebc8e[_0x43e7('0xe')]+_0x4ebc8e[_0x43e7('0x11')];var _0x328445;if(_0x5e641c>=_0x2fcb36){_0x5e641c=_0x2fcb36;_0x328445=0xc8;}else{_0x328445=0xce;}_0x37302c['status'](_0x328445);return _0x37302c['set'](_0x43e7('0x12'),_0x44b0bd+'-'+_0x5e641c+'/'+_0x2fcb36)[_0x43e7('0xd')](_0x3eb206);}return null;};}function saveUpdates(_0x273a32){return function(_0x5d346f){if(_0x5d346f){return _0x5d346f['update'](_0x273a32)[_0x43e7('0x13')](function(_0x1ca758){return _0x1ca758;});}return null;};}function removeEntity(_0x9037d3){return function(_0x140657){if(_0x140657){return _0x140657[_0x43e7('0x14')]()[_0x43e7('0x13')](function(){var _0x619236=_0x140657[_0x43e7('0x15')]({'plain':!![]});var _0x2377a3=[{'name':_0x43e7('0x16'),'value':_0x43e7('0x17'),'ignore':![]},{'name':_0x43e7('0x18'),'value':'outbound','ignore':![]}];var _0xef1a5a=_(_0x2377a3)[_0x43e7('0x19')]('ignore')[_0x43e7('0x1a')](_0x43e7('0x1b'))[_0x43e7('0x1b')]();if(_[_0x43e7('0x1c')](_0xef1a5a,_0x619236[_0x43e7('0x1d')])){return;}var _0x2f4cb4=_['find'](_0x2377a3,[_0x43e7('0x1b'),_0x619236['type']])['name'];return db[_0x43e7('0x1e')][_0x43e7('0x14')]({'where':{'type':_0x2f4cb4,'resourceId':_0x619236['id']}})['then'](function(){return _0x140657;});})[_0x43e7('0x13')](function(){_0x9037d3['status'](0xcc)[_0x43e7('0xc')]();});}};}function handleEntityNotFound(_0x5c5e67){return function(_0x1af208){if(!_0x1af208){_0x5c5e67[_0x43e7('0x1f')](0x194);}return _0x1af208;};}function handleError(_0x20888b,_0x405f85){_0x405f85=_0x405f85||0x1f4;return function(_0x51f4d7){logger['error'](_0x51f4d7[_0x43e7('0x20')]);if(_0x51f4d7['name']){delete _0x51f4d7[_0x43e7('0x21')];}_0x20888b[_0x43e7('0x22')](_0x405f85)[_0x43e7('0x23')](_0x51f4d7);};}exports[_0x43e7('0x24')]=function(_0x5087d7,_0x33a1a5){var _0x4690a6={};var _0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x1a')](db[_0x43e7('0x25')][_0x43e7('0x26')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x27')],'type':_0x31b2a6[_0x43e7('0x1d')][_0x43e7('0x28')]};});_0x4690a6=qs[_0x43e7('0x29')](_0x50f9f5,_0x5087d7);var _0x2bde44={'where':_0x4690a6[_0x43e7('0x2a')]};return db['VoiceQueue'][_0x43e7('0x10')](_0x2bde44)[_0x43e7('0x13')](function(_0x3b8f78){_0x45b675[_0x43e7('0x10')]=_0x3b8f78;_0x4690a6[_0x43e7('0x2b')]=qs['include'](_0x5087d7[_0x43e7('0x2c')]);return db[_0x43e7('0x25')][_0x43e7('0x2d')](_0x4690a6);})[_0x43e7('0x13')](function(_0x4c61b9){_0x45b675['rows']=_0x4c61b9;return _0x45b675;})['then'](respondWithFilteredResult(_0x33a1a5,_0x4690a6))[_0x43e7('0x2e')](handleError(_0x33a1a5,null));};exports[_0x43e7('0x2f')]=function(_0x117c07,_0x234fe6){var _0x108313={'raw':![],'where':{'id':_0x117c07['params']['id']}},_0xde7ed={};_0xde7ed['model']=_['keys'](db['VoiceQueue']['rawAttributes']);_0xde7ed['query']=_['keys'](_0x117c07[_0x43e7('0x2c')]);_0xde7ed['filters']=_[_0x43e7('0x30')](_0xde7ed[_0x43e7('0x31')],_0xde7ed[_0x43e7('0x2c')]);_0x108313[_0x43e7('0x32')]=_[_0x43e7('0x30')](_0xde7ed[_0x43e7('0x31')],qs[_0x43e7('0x33')](_0x117c07['query']['fields']));_0x108313['attributes']=_0x108313[_0x43e7('0x32')][_0x43e7('0x34')]?_0x108313[_0x43e7('0x32')]:_0xde7ed[_0x43e7('0x31')];if(_0x117c07[_0x43e7('0x2c')][_0x43e7('0x35')]){_0x108313[_0x43e7('0x2b')]=[{'all':!![]}];}_0x108313=_[_0x43e7('0x36')]({},_0x108313,_0x117c07['options']);return db[_0x43e7('0x25')][_0x43e7('0x37')](_0x108313)['then'](handleEntityNotFound(_0x234fe6,null))[_0x43e7('0x13')](respondWithResult(_0x234fe6,null))['catch'](handleError(_0x234fe6,null));};exports[_0x43e7('0x38')]=function(_0x2ad008,_0x1c6f45){return db[_0x43e7('0x25')][_0x43e7('0x38')](_0x2ad008[_0x43e7('0x39')],{})['then'](function(_0x574a93){var _0x30dfa9=_0x2ad008[_0x43e7('0x3a')][_0x43e7('0x15')]({'plain':!![]});if(!_0x30dfa9)throw new Error(_0x43e7('0x3b'));if(_0x30dfa9[_0x43e7('0x3c')]==='user'){var _0x32a451=_0x574a93[_0x43e7('0x15')]({'plain':!![]});var _0x575439=[{'name':_0x43e7('0x16'),'value':'inbound'},{'name':_0x43e7('0x18'),'value':'outbound'}];var _0x3d81ae=_[_0x43e7('0x37')](_0x575439,[_0x43e7('0x1b'),_0x32a451[_0x43e7('0x1d')]])['name'];return db['UserProfileSection'][_0x43e7('0x37')]({'where':{'name':_0x3d81ae,'userProfileId':_0x30dfa9[_0x43e7('0x3d')]},'raw':!![]})[_0x43e7('0x13')](function(_0x36b770){if(_0x36b770&&_0x36b770['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x32a451[_0x43e7('0x21')],'resourceId':_0x32a451['id'],'type':_0x36b770['name'],'sectionId':_0x36b770['id']},{})[_0x43e7('0x13')](function(){return _0x574a93;});}else{return _0x574a93;}})['catch'](function(_0x5b28db){logger[_0x43e7('0x3e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b28db);throw _0x5b28db;});}return _0x574a93;})[_0x43e7('0x13')](respondWithResult(_0x1c6f45,0xc9))[_0x43e7('0x2e')](handleError(_0x1c6f45,null));};exports[_0x43e7('0x3f')]=function(_0x99b9e1,_0x4fc5e8){var _0x91f1e4={'where':{'id':_0x99b9e1[_0x43e7('0x40')]['id']}},_0x2b9046={};_0x2b9046[_0x43e7('0x31')]=_[_0x43e7('0x41')](db[_0x43e7('0x25')]['rawAttributes']);_0x91f1e4['attributes']=_[_0x43e7('0x30')](_0x2b9046[_0x43e7('0x31')],qs[_0x43e7('0x33')](_0x99b9e1['query']['fields']));_0x91f1e4['attributes']=_0x91f1e4[_0x43e7('0x32')][_0x43e7('0x34')]?_0x91f1e4['attributes']:_0x2b9046[_0x43e7('0x31')];if(_0x99b9e1[_0x43e7('0x2c')][_0x43e7('0x35')]){_0x91f1e4['include']=[{'all':!![]}];}_0x91f1e4=_['merge']({},_0x91f1e4,_0x99b9e1['options']);return db['VoiceQueue'][_0x43e7('0x37')](_0x91f1e4)[_0x43e7('0x13')](handleEntityNotFound(_0x4fc5e8,null))['then'](function(_0x23e7cb){if(_0x23e7cb){var _0x82d32f=_0x23e7cb[_0x43e7('0x15')]({'plain':!![]});_0x82d32f=qs[_0x43e7('0x42')](_0x82d32f,['id','createdAt',_0x43e7('0x43')]);_0x99b9e1['body']=_['omit'](_0x99b9e1[_0x43e7('0x39')],['id',_0x43e7('0x44'),_0x43e7('0x43')]);return db[_0x43e7('0x25')][_0x43e7('0x38')](_[_0x43e7('0x36')](_0x82d32f,_0x99b9e1[_0x43e7('0x39')]),{'include':_0x99b9e1[_0x43e7('0x2c')][_0x43e7('0x35')]?[{'all':!![]}]:undefined})[_0x43e7('0x13')](function(_0x58dfd0){var _0x119d34=_0x99b9e1[_0x43e7('0x3a')]['get']({'plain':!![]});if(!_0x119d34)throw new Error(_0x43e7('0x3b'));if(_0x119d34['role']===_0x43e7('0x3a')){var _0x520857=_0x58dfd0[_0x43e7('0x15')]({'plain':!![]});var _0x1f561f=[{'name':_0x43e7('0x16'),'value':'inbound'},{'name':'QueueCampaigns','value':_0x43e7('0x45')}];var _0x2ab7ee=_[_0x43e7('0x37')](_0x1f561f,[_0x43e7('0x1b'),_0x520857[_0x43e7('0x1d')]])[_0x43e7('0x21')];return db[_0x43e7('0x46')][_0x43e7('0x37')]({'where':{'name':_0x2ab7ee,'userProfileId':_0x119d34[_0x43e7('0x3d')]},'raw':!![]})[_0x43e7('0x13')](function(_0x312306){if(_0x312306&&_0x312306['autoAssociation']===0x0){return db[_0x43e7('0x1e')][_0x43e7('0x38')]({'name':_0x520857['name'],'resourceId':_0x520857['id'],'type':_0x312306[_0x43e7('0x21')],'sectionId':_0x312306['id']},{})[_0x43e7('0x13')](function(){return _0x58dfd0;});}else{return _0x58dfd0;}})[_0x43e7('0x2e')](function(_0x558d54){logger['error'](_0x43e7('0x47'),_0x558d54);throw _0x558d54;});}return _0x58dfd0;});}})[_0x43e7('0x13')](respondWithResult(_0x4fc5e8,0xc9))['catch'](handleError(_0x4fc5e8,null));};exports[_0x43e7('0x48')]=function(_0x54506d,_0x49a6ce){if(_0x54506d[_0x43e7('0x39')]['id']){delete _0x54506d[_0x43e7('0x39')]['id'];}return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x54506d[_0x43e7('0x40')]['id']}})['then'](handleEntityNotFound(_0x49a6ce,null))[_0x43e7('0x13')](saveUpdates(_0x54506d[_0x43e7('0x39')],null))['then'](respondWithResult(_0x49a6ce,null))[_0x43e7('0x2e')](handleError(_0x49a6ce,null));};exports[_0x43e7('0x14')]=function(_0x296a0d,_0x5bb536){return db['VoiceQueue']['find']({'where':{'id':_0x296a0d[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x5bb536,null))[_0x43e7('0x13')](removeEntity(_0x5bb536,null))[_0x43e7('0x2e')](handleError(_0x5bb536,null));};exports['getHoppers']=function(_0x5a50fc,_0x1b27da){var _0x8b50bb={'raw':![],'where':{}};var _0x140438={};var _0x5dd349={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x43e7('0x49')]({'where':{'id':_0x5a50fc[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x1b27da,null))[_0x43e7('0x13')](function(_0x3369b8){if(_0x3369b8){_0x140438[_0x43e7('0x31')]=_[_0x43e7('0x41')](db[_0x43e7('0x4a')][_0x43e7('0x26')]);_0x140438[_0x43e7('0x2c')]=_[_0x43e7('0x41')](_0x5a50fc['query']);_0x140438['filters']=_[_0x43e7('0x30')](_0x140438['model'],_0x140438['query']);_0x8b50bb['attributes']=_[_0x43e7('0x30')](_0x140438[_0x43e7('0x31')],qs['fields'](_0x5a50fc[_0x43e7('0x2c')][_0x43e7('0x33')]));_0x8b50bb[_0x43e7('0x32')]=_0x8b50bb['attributes'][_0x43e7('0x34')]?_0x8b50bb[_0x43e7('0x32')]:_0x140438[_0x43e7('0x31')];if(!_0x5a50fc[_0x43e7('0x2c')][_0x43e7('0x4b')](_0x43e7('0x4c'))){_0x8b50bb[_0x43e7('0x11')]=qs['limit'](_0x5a50fc[_0x43e7('0x2c')][_0x43e7('0x11')]);_0x8b50bb[_0x43e7('0xe')]=qs['offset'](_0x5a50fc['query'][_0x43e7('0xe')]);}_0x8b50bb['order']=qs['sort'](_0x5a50fc[_0x43e7('0x2c')][_0x43e7('0x4d')]);_0x8b50bb['where']=qs[_0x43e7('0x4e')](_[_0x43e7('0x4f')](_0x5a50fc[_0x43e7('0x2c')],_0x140438[_0x43e7('0x4e')]));_0x8b50bb[_0x43e7('0x2a')][_0x43e7('0x50')]=_0x3369b8['id'];if(_0x5a50fc[_0x43e7('0x2c')]['filter']){_0x8b50bb[_0x43e7('0x2a')]=_[_0x43e7('0x36')](_0x8b50bb['where'],{'$or':_[_0x43e7('0x1a')](_0x8b50bb['attributes'],function(_0x26ee52){var _0x248936={};_0x248936[_0x26ee52]={'$like':'%'+_0x5a50fc[_0x43e7('0x2c')][_0x43e7('0x19')]+'%'};return _0x248936;})});}_0x8b50bb=_['merge']({},_0x8b50bb,_0x5a50fc[_0x43e7('0x51')]);return db[_0x43e7('0x4a')][_0x43e7('0x10')]({'where':_0x8b50bb['where']})[_0x43e7('0x13')](function(_0x38fa5b){_0x5dd349[_0x43e7('0x10')]=_0x38fa5b;if(_0x5a50fc[_0x43e7('0x2c')][_0x43e7('0x35')]){_0x8b50bb['include']=[{'all':!![]}];}return db[_0x43e7('0x4a')][_0x43e7('0x2d')](_0x8b50bb);})[_0x43e7('0x13')](function(_0x2499ef){_0x5dd349[_0x43e7('0x52')]=_0x2499ef;return _0x5dd349;});}})[_0x43e7('0x13')](respondWithFilteredResult(_0x1b27da,_0x8b50bb))[_0x43e7('0x2e')](handleError(_0x1b27da,null));};exports['getHopperHistories']=function(_0x499ee9,_0x405faa){var _0x536477={'raw':!![],'where':{}};var _0x550036={};var _0x5b98bf={'count':0x0,'rows':[]};return db[_0x43e7('0x25')][_0x43e7('0x49')]({'where':{'id':_0x499ee9[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x405faa,null))[_0x43e7('0x13')](function(_0x1ae0c8){if(_0x1ae0c8){_0x550036['model']=_[_0x43e7('0x41')](db[_0x43e7('0x53')][_0x43e7('0x26')]);_0x550036['query']=_[_0x43e7('0x41')](_0x499ee9[_0x43e7('0x2c')]);_0x550036[_0x43e7('0x4e')]=_[_0x43e7('0x30')](_0x550036[_0x43e7('0x31')],_0x550036[_0x43e7('0x2c')]);_0x536477[_0x43e7('0x32')]=_[_0x43e7('0x30')](_0x550036['model'],qs['fields'](_0x499ee9['query'][_0x43e7('0x33')]));_0x536477[_0x43e7('0x32')]=_0x536477['attributes'][_0x43e7('0x34')]?_0x536477[_0x43e7('0x32')]:_0x550036[_0x43e7('0x31')];if(!_0x499ee9[_0x43e7('0x2c')]['hasOwnProperty']('nolimit')){_0x536477['limit']=qs[_0x43e7('0x11')](_0x499ee9[_0x43e7('0x2c')]['limit']);_0x536477['offset']=qs[_0x43e7('0xe')](_0x499ee9[_0x43e7('0x2c')][_0x43e7('0xe')]);}_0x536477['order']=qs[_0x43e7('0x4d')](_0x499ee9[_0x43e7('0x2c')][_0x43e7('0x4d')]);_0x536477[_0x43e7('0x2a')]=qs['filters'](_[_0x43e7('0x4f')](_0x499ee9['query'],_0x550036[_0x43e7('0x4e')]));_0x536477[_0x43e7('0x2a')][_0x43e7('0x50')]=_0x1ae0c8['id'];if(_0x499ee9[_0x43e7('0x2c')][_0x43e7('0x19')]){_0x536477[_0x43e7('0x2a')]=_[_0x43e7('0x36')](_0x536477['where'],{'$or':_[_0x43e7('0x1a')](_0x536477[_0x43e7('0x32')],function(_0x1aea4e){var _0x6fb694={};_0x6fb694[_0x1aea4e]={'$like':'%'+_0x499ee9['query']['filter']+'%'};return _0x6fb694;})});}_0x536477=_['merge']({},_0x536477,_0x499ee9[_0x43e7('0x51')]);return db['CmHopperHistory'][_0x43e7('0x10')]({'where':_0x536477[_0x43e7('0x2a')]})[_0x43e7('0x13')](function(_0x7387f6){_0x5b98bf[_0x43e7('0x10')]=_0x7387f6;if(_0x499ee9[_0x43e7('0x2c')][_0x43e7('0x35')]){_0x536477[_0x43e7('0x2b')]=[{'all':!![]}];}return db[_0x43e7('0x53')][_0x43e7('0x2d')](_0x536477);})[_0x43e7('0x13')](function(_0x5b3565){_0x5b98bf[_0x43e7('0x52')]=_0x5b3565;return _0x5b98bf;});}})[_0x43e7('0x13')](respondWithFilteredResult(_0x405faa,_0x536477))[_0x43e7('0x2e')](handleError(_0x405faa,null));};exports[_0x43e7('0x54')]=function(_0x206e54,_0x4ea4a9){var _0x5e04ec={'raw':!![],'where':{}};var _0x162a27={};var _0x3e3c82={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x43e7('0x49')]({'where':{'id':_0x206e54[_0x43e7('0x40')]['id']}})['then'](handleEntityNotFound(_0x4ea4a9,null))['then'](function(_0x1e869a){if(_0x1e869a){_0x162a27[_0x43e7('0x31')]=_[_0x43e7('0x41')](db[_0x43e7('0x55')][_0x43e7('0x26')]);_0x162a27['query']=_['keys'](_0x206e54[_0x43e7('0x2c')]);_0x162a27[_0x43e7('0x4e')]=_[_0x43e7('0x30')](_0x162a27[_0x43e7('0x31')],_0x162a27['query']);_0x5e04ec[_0x43e7('0x32')]=_[_0x43e7('0x30')](_0x162a27[_0x43e7('0x31')],qs[_0x43e7('0x33')](_0x206e54['query'][_0x43e7('0x33')]));_0x5e04ec[_0x43e7('0x32')]=_0x5e04ec[_0x43e7('0x32')][_0x43e7('0x34')]?_0x5e04ec[_0x43e7('0x32')]:_0x162a27['model'];if(!_0x206e54[_0x43e7('0x2c')][_0x43e7('0x4b')]('nolimit')){_0x5e04ec[_0x43e7('0x11')]=qs[_0x43e7('0x11')](_0x206e54[_0x43e7('0x2c')][_0x43e7('0x11')]);_0x5e04ec['offset']=qs[_0x43e7('0xe')](_0x206e54['query'][_0x43e7('0xe')]);}_0x5e04ec[_0x43e7('0x56')]=qs[_0x43e7('0x4d')](_0x206e54[_0x43e7('0x2c')][_0x43e7('0x4d')]);_0x5e04ec[_0x43e7('0x2a')]=qs[_0x43e7('0x4e')](_[_0x43e7('0x4f')](_0x206e54[_0x43e7('0x2c')],_0x162a27['filters']));_0x5e04ec[_0x43e7('0x2a')][_0x43e7('0x50')]=_0x1e869a['id'];if(_0x206e54[_0x43e7('0x2c')][_0x43e7('0x19')]){_0x5e04ec['where']=_['merge'](_0x5e04ec[_0x43e7('0x2a')],{'$or':_[_0x43e7('0x1a')](_0x5e04ec[_0x43e7('0x32')],function(_0x4d30f7){var _0x12e7a8={};_0x12e7a8[_0x4d30f7]={'$like':'%'+_0x206e54['query']['filter']+'%'};return _0x12e7a8;})});}_0x5e04ec=_['merge']({},_0x5e04ec,_0x206e54[_0x43e7('0x51')]);return db['CmHopperFinal'][_0x43e7('0x10')]({'where':_0x5e04ec[_0x43e7('0x2a')]})[_0x43e7('0x13')](function(_0x2fea54){_0x3e3c82[_0x43e7('0x10')]=_0x2fea54;if(_0x206e54['query']['includeAll']){_0x5e04ec[_0x43e7('0x2b')]=[{'all':!![]}];}return db[_0x43e7('0x55')]['findAll'](_0x5e04ec);})[_0x43e7('0x13')](function(_0x10fd28){_0x3e3c82[_0x43e7('0x52')]=_0x10fd28;return _0x3e3c82;});}})[_0x43e7('0x13')](respondWithFilteredResult(_0x4ea4a9,_0x5e04ec))[_0x43e7('0x2e')](handleError(_0x4ea4a9,null));};exports[_0x43e7('0x57')]=function(_0x399253,_0x32e698){var _0x39ce5e={'raw':!![],'where':{}};var _0x284617={};var _0x610819={'count':0x0,'rows':[]};return db[_0x43e7('0x25')][_0x43e7('0x49')]({'where':{'id':_0x399253[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x32e698,null))[_0x43e7('0x13')](function(_0x3286b1){if(_0x3286b1){_0x284617[_0x43e7('0x31')]=_[_0x43e7('0x41')](db[_0x43e7('0x58')][_0x43e7('0x26')]);_0x284617[_0x43e7('0x2c')]=_['keys'](_0x399253[_0x43e7('0x2c')]);_0x284617[_0x43e7('0x4e')]=_[_0x43e7('0x30')](_0x284617[_0x43e7('0x31')],_0x284617['query']);_0x39ce5e[_0x43e7('0x32')]=_['intersection'](_0x284617[_0x43e7('0x31')],qs[_0x43e7('0x33')](_0x399253[_0x43e7('0x2c')][_0x43e7('0x33')]));_0x39ce5e[_0x43e7('0x32')]=_0x39ce5e[_0x43e7('0x32')]['length']?_0x39ce5e[_0x43e7('0x32')]:_0x284617[_0x43e7('0x31')];if(!_0x399253[_0x43e7('0x2c')][_0x43e7('0x4b')](_0x43e7('0x4c'))){_0x39ce5e['limit']=qs['limit'](_0x399253[_0x43e7('0x2c')]['limit']);_0x39ce5e[_0x43e7('0xe')]=qs[_0x43e7('0xe')](_0x399253[_0x43e7('0x2c')][_0x43e7('0xe')]);}_0x39ce5e['order']=qs['sort'](_0x399253['query'][_0x43e7('0x4d')]);_0x39ce5e['where']=qs['filters'](_['pick'](_0x399253[_0x43e7('0x2c')],_0x284617[_0x43e7('0x4e')]));_0x39ce5e['where'][_0x43e7('0x50')]=_0x3286b1['id'];if(_0x399253['query'][_0x43e7('0x19')]){_0x39ce5e[_0x43e7('0x2a')]=_[_0x43e7('0x36')](_0x39ce5e[_0x43e7('0x2a')],{'$or':_[_0x43e7('0x1a')](_0x39ce5e['attributes'],function(_0x1f4162){var _0x449cb4={};_0x449cb4[_0x1f4162]={'$like':'%'+_0x399253[_0x43e7('0x2c')]['filter']+'%'};return _0x449cb4;})});}_0x39ce5e=_['merge']({},_0x39ce5e,_0x399253[_0x43e7('0x51')]);return db[_0x43e7('0x58')][_0x43e7('0x10')]({'where':_0x39ce5e[_0x43e7('0x2a')]})['then'](function(_0x385cc1){_0x610819[_0x43e7('0x10')]=_0x385cc1;if(_0x399253[_0x43e7('0x2c')]['includeAll']){_0x39ce5e[_0x43e7('0x2b')]=[{'all':!![]}];}return db[_0x43e7('0x58')][_0x43e7('0x2d')](_0x39ce5e);})[_0x43e7('0x13')](function(_0x541ce8){_0x610819[_0x43e7('0x52')]=_0x541ce8;return _0x610819;});}})['then'](respondWithFilteredResult(_0x32e698,_0x39ce5e))[_0x43e7('0x2e')](handleError(_0x32e698,null));};exports[_0x43e7('0x59')]=function(_0x47f29f,_0x4e5484){var _0xc62dc9={};var _0x1480c6={};var _0x21d001;var _0x4600e5;return db[_0x43e7('0x25')][_0x43e7('0x49')]({'where':{'id':_0x47f29f[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x4e5484,null))[_0x43e7('0x13')](function(_0xfc577b){if(_0xfc577b){_0x21d001=_0xfc577b;_0x1480c6[_0x43e7('0x31')]=_['keys'](db[_0x43e7('0x5a')]['rawAttributes']);_0x1480c6[_0x43e7('0x2c')]=_[_0x43e7('0x41')](_0x47f29f[_0x43e7('0x2c')]);_0x1480c6['filters']=_[_0x43e7('0x30')](_0x1480c6[_0x43e7('0x31')],_0x1480c6[_0x43e7('0x2c')]);_0xc62dc9[_0x43e7('0x32')]=_['intersection'](_0x1480c6[_0x43e7('0x31')],qs[_0x43e7('0x33')](_0x47f29f['query']['fields']));_0xc62dc9['attributes']=_0xc62dc9[_0x43e7('0x32')][_0x43e7('0x34')]?_0xc62dc9[_0x43e7('0x32')]:_0x1480c6[_0x43e7('0x31')];_0xc62dc9[_0x43e7('0x56')]=qs[_0x43e7('0x4d')](_0x47f29f[_0x43e7('0x2c')][_0x43e7('0x4d')]);_0xc62dc9['where']=qs[_0x43e7('0x4e')](_[_0x43e7('0x4f')](_0x47f29f[_0x43e7('0x2c')],_0x1480c6[_0x43e7('0x4e')]));if(_0x47f29f['query']['filter']){_0xc62dc9[_0x43e7('0x2a')]=_[_0x43e7('0x36')](_0xc62dc9[_0x43e7('0x2a')],{'$or':_[_0x43e7('0x1a')](_0xc62dc9['attributes'],function(_0x2f529b){var _0x427cec={};_0x427cec[_0x2f529b]={'$like':'%'+_0x47f29f[_0x43e7('0x2c')][_0x43e7('0x19')]+'%'};return _0x427cec;})});}_0xc62dc9=_[_0x43e7('0x36')]({},_0xc62dc9,_0x47f29f[_0x43e7('0x51')]);return _0x21d001['getTeams'](_0xc62dc9);}})[_0x43e7('0x13')](function(_0x52c974){if(_0x52c974){_0x4600e5=_0x52c974['length'];if(!_0x47f29f[_0x43e7('0x2c')][_0x43e7('0x4b')]('nolimit')){_0xc62dc9['limit']=qs[_0x43e7('0x11')](_0x47f29f[_0x43e7('0x2c')]['limit']);_0xc62dc9[_0x43e7('0xe')]=qs[_0x43e7('0xe')](_0x47f29f[_0x43e7('0x2c')][_0x43e7('0xe')]);}return _0x21d001['getTeams'](_0xc62dc9);}})['then'](function(_0x2a084b){if(_0x2a084b){return _0x2a084b?{'count':_0x4600e5,'rows':_0x2a084b}:null;}})[_0x43e7('0x13')](respondWithResult(_0x4e5484,null))[_0x43e7('0x2e')](handleError(_0x4e5484,null));};exports['addTeams']=function(_0x49de67,_0x298239){var _0xf682ec=_0x49de67[_0x43e7('0x39')][_0x43e7('0x5b')];var _0x1e247f=_[_0x43e7('0x1a')](_0xf682ec,'id');return db[_0x43e7('0x5a')][_0x43e7('0x2d')]({'where':{'id':_0x1e247f},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0x43e7('0x5c'),'voicePause',_0x43e7('0x5d')],'raw':!![]}]})[_0x43e7('0x13')](function(_0x44fee0){if(_0x44fee0){var _0x41d130=_[_0x43e7('0x5e')](_0x44fee0,function(_0x5e87d6){var _0x21039a=_0x5e87d6[_0x43e7('0x15')]({'plain':!![]});_0x21039a[_0x43e7('0x5f')][_0x43e7('0x60')](function(_0x59f68a){_0x59f68a[_0x43e7('0x61')]=_[_0x43e7('0x37')](_0xf682ec,{'id':_0x21039a['id']})[_0x43e7('0x61')];});return _0x21039a[_0x43e7('0x5f')];});return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x49de67[_0x43e7('0x40')]['id']}})['then'](function(_0xc9356c){return db[_0x43e7('0x62')][_0x43e7('0x63')](function(_0x3637d9){return _0xc9356c[_0x43e7('0x64')](_0x1e247f,{'transaction':_0x3637d9})['then'](function(){return BPromise[_0x43e7('0x65')](_0xf682ec,function(_0x25ddf8){return db['TeamVoiceQueue'][_0x43e7('0x66')]({'TeamId':_0x25ddf8['id'],'VoiceQueueId':_0x49de67[_0x43e7('0x40')]['id'],'penalty':_0x25ddf8['penalty']},{'transaction':_0x3637d9});});})[_0x43e7('0x13')](function(){return BPromise[_0x43e7('0x65')](_0x41d130,function(_0x110154){return db[_0x43e7('0x67')][_0x43e7('0x68')]({'where':{'UserId':_0x110154['id'],'VoiceQueueId':_0x49de67['params']['id']},'defaults':{'penalty':_0x110154[_0x43e7('0x61')]},'transaction':_0x3637d9});});})[_0x43e7('0x13')](function(){return BPromise[_0x43e7('0x65')](_['filter'](_0x41d130,{'online':!![]}),function(_0x32b788){return db[_0x43e7('0x69')]['upsert']({'membername':_0x32b788[_0x43e7('0x21')],'UserId':_0x32b788['id'],'queue_name':_0xc9356c[_0x43e7('0x21')],'VoiceQueueId':_0xc9356c['id'],'interface':_[_0x43e7('0x6a')](_0x32b788[_0x43e7('0x5d')])?util[_0x43e7('0x6b')](_0x43e7('0x6c'),_0x32b788['name']):_0x32b788[_0x43e7('0x5d')],'paused':_0x32b788[_0x43e7('0x6d')]||![],'penalty':_0x32b788[_0x43e7('0x61')]},{'transaction':_0x3637d9});});})['then'](function(){_0x41d130[_0x43e7('0x60')](function(_0x21901c){socket[_0x43e7('0x6e')](_0x43e7('0x6f'),{'UserId':_0x21901c['id'],'VoiceQueueId':_0xc9356c['id']});});});});});}})[_0x43e7('0x13')](respondWithStatusCode(_0x298239,null))[_0x43e7('0x2e')](handleError(_0x298239,null));};exports[_0x43e7('0x70')]=function(_0x1896b3,_0x4345a5){return db['Team'][_0x43e7('0x2d')]({'where':{'id':_0x1896b3[_0x43e7('0x2c')][_0x43e7('0x71')]},'attributes':['id'],'include':[{'model':db[_0x43e7('0x72')],'as':_0x43e7('0x5f'),'attributes':['id'],'raw':!![]}]})[_0x43e7('0x13')](handleEntityNotFound(_0x4345a5,null))[_0x43e7('0x13')](function(_0x3e8631){var _0x51e17c=_[_0x43e7('0x1a')](_0x3e8631,'id');var _0x6246c4=[];var _0xd0dca2=[];var _0xa721ba=squel[_0x43e7('0x73')]();_0xa721ba['field'](_0x43e7('0x74'))[_0x43e7('0x75')](_0x43e7('0x76'),'tq')[_0x43e7('0x77')](_0x43e7('0x78'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x43e7('0x2a')]('VoiceQueueId\x20=\x20?',_0x1896b3[_0x43e7('0x40')]['id']);for(var _0x339826=0x0;_0x339826<_0x3e8631[_0x43e7('0x34')];_0x339826+=0x1){let _0xc28ac6=_0x3e8631[_0x339826];for(var _0x4b0abd=0x0;_0x4b0abd<_0xc28ac6[_0x43e7('0x5f')][_0x43e7('0x34')];_0x4b0abd+=0x1){let _0x41d636=_0xc28ac6[_0x43e7('0x5f')][_0x4b0abd];var _0x19bdf7=_0xa721ba[_0x43e7('0x3f')]();_0x19bdf7[_0x43e7('0x2a')](_0x43e7('0x79'),_0x41d636['id']);_0xd0dca2[_0x43e7('0x7a')](db[_0x43e7('0x62')][_0x43e7('0x2c')](_0x19bdf7['toString'](),{'type':db['sequelize'][_0x43e7('0x7b')]['SELECT']})['then'](function(_0x4a0d5d){if(_0x4a0d5d[_0x43e7('0x34')]===0x1){return _0x41d636['id'];}else{var _0x5eae45=_[_0x43e7('0x7c')](_['map'](_0x4a0d5d,'TeamId'),function(_0x55f1df){return _[_0x43e7('0x1c')](_0x51e17c,_0x55f1df);});if(_0x5eae45){return _0x41d636['id'];}}}));}}return BPromise[_0x43e7('0x7d')](_0xd0dca2)[_0x43e7('0x13')](function(_0xd6ebb0){_0x6246c4=_(_0x6246c4)[_0x43e7('0x7e')](_0xd6ebb0)[_0x43e7('0x7f')]()[_0x43e7('0x1b')]();return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x1896b3[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](function(_0x2a1218){return db[_0x43e7('0x62')][_0x43e7('0x63')](function(_0xe14e67){return _0x2a1218[_0x43e7('0x70')](_0x1896b3[_0x43e7('0x2c')][_0x43e7('0x71')],{'transaction':_0xe14e67})[_0x43e7('0x13')](function(){if(!_[_0x43e7('0x80')](_0x6246c4)){return _0x2a1218['removeAgents'](_0x6246c4,{'transaction':_0xe14e67})[_0x43e7('0x13')](function(){return db[_0x43e7('0x69')]['destroy']({'where':{'VoiceQueueId':_0x1896b3[_0x43e7('0x40')]['id'],'UserId':_0x6246c4},'transaction':_0xe14e67});});}})[_0x43e7('0x13')](function(){_0x6246c4[_0x43e7('0x60')](function(_0x32b33c){socket['emit'](_0x43e7('0x81'),{'UserId':_0x32b33c,'VoiceQueueId':_0x2a1218['id']});});});});});});})[_0x43e7('0x13')](respondWithStatusCode(_0x4345a5,null))['catch'](handleError(_0x4345a5,null));};exports[_0x43e7('0x82')]=function(_0x1a520e,_0xb4cf23){var _0x559145,_0x22b824;return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x1a520e[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0xb4cf23,null))['then'](function(_0x33b63b){if(_0x33b63b){_0x22b824=_0x33b63b;return _0x33b63b[_0x43e7('0x82')](_0x1a520e['body'][_0x43e7('0x71')],_['omit'](_0x1a520e['body'],['ids','id'])||{})['spread'](function(_0x255113){for(var _0x451fb5=0x0;_0x451fb5<_0x1a520e[_0x43e7('0x39')][_0x43e7('0x71')]['length'];_0x451fb5+=0x1){socket['emit'](_0x43e7('0x6f'),{'UserId':Number(_0x1a520e['body'][_0x43e7('0x71')][_0x451fb5]),'VoiceQueueId':Number(_0x1a520e['params']['id'])});}return _0x255113;});}})[_0x43e7('0x13')](function(_0x4cf7e9){_0x559145=_0x4cf7e9||[];if(_0x22b824){return db['User']['findAll']({'where':{'id':_0x1a520e['body'][_0x43e7('0x71')]},'attributes':['id',_0x43e7('0x21'),_0x43e7('0x5c'),'voicePause',_0x43e7('0x5d')],'raw':!![]});}})[_0x43e7('0x13')](function(_0x517289){if(!_['isEmpty'](_0x517289)){var _0x25fd39=[];for(var _0xb2aca0=0x0;_0xb2aca0<_0x517289[_0x43e7('0x34')];_0xb2aca0++){if(_0x517289[_0xb2aca0][_0x43e7('0x5c')]){_0x25fd39['push'](db[_0x43e7('0x69')]['upsert']({'membername':_0x517289[_0xb2aca0][_0x43e7('0x21')],'UserId':_0x517289[_0xb2aca0]['id'],'queue_name':_0x22b824[_0x43e7('0x21')],'VoiceQueueId':_0x22b824['id'],'interface':_[_0x43e7('0x6a')](_0x517289[_0xb2aca0][_0x43e7('0x5d')])?util[_0x43e7('0x6b')](_0x43e7('0x6c'),_0x517289[_0xb2aca0][_0x43e7('0x21')]):_0x517289[_0xb2aca0]['interface'],'paused':_0x517289[_0xb2aca0][_0x43e7('0x6d')]||![],'penalty':_0x1a520e[_0x43e7('0x39')]['penalty']||0x0}));}}return BPromise[_0x43e7('0x7d')](_0x25fd39);}})[_0x43e7('0x13')](function(){return _0x559145;})[_0x43e7('0x13')](respondWithResult(_0xb4cf23,null))[_0x43e7('0x2e')](handleError(_0xb4cf23,null));};exports[_0x43e7('0x83')]=function(_0x4fd17e,_0x3fd573){return db['VoiceQueue'][_0x43e7('0x37')]({'where':{'id':_0x4fd17e['params']['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x3fd573,null))[_0x43e7('0x13')](function(_0x4446cb){if(_0x4446cb){return _0x4446cb[_0x43e7('0x83')](_0x4fd17e[_0x43e7('0x2c')]['ids'])[_0x43e7('0x13')](function(){if(_['isArray'](_0x4fd17e[_0x43e7('0x2c')][_0x43e7('0x71')])){for(var _0x34d476=0x0;_0x34d476<_0x4fd17e['query'][_0x43e7('0x71')][_0x43e7('0x34')];_0x34d476+=0x1){socket[_0x43e7('0x6e')](_0x43e7('0x81'),{'UserId':Number(_0x4fd17e[_0x43e7('0x2c')]['ids'][_0x34d476]),'VoiceQueueId':Number(_0x4fd17e[_0x43e7('0x40')]['id'])});}}else{socket['emit'](_0x43e7('0x81'),{'UserId':Number(_0x4fd17e[_0x43e7('0x2c')][_0x43e7('0x71')]),'VoiceQueueId':Number(_0x4fd17e[_0x43e7('0x40')]['id'])});}});}})[_0x43e7('0x13')](function(_0x34ed9e){return db[_0x43e7('0x69')]['destroy']({'where':{'VoiceQueueId':_0x4fd17e[_0x43e7('0x40')]['id'],'UserId':_0x4fd17e['query'][_0x43e7('0x71')]}})[_0x43e7('0x13')](function(){return _0x34ed9e;});})[_0x43e7('0x13')](respondWithStatusCode(_0x3fd573,null))[_0x43e7('0x2e')](handleError(_0x3fd573,null));};exports[_0x43e7('0x84')]=function(_0xf9178f,_0x3bb7ab){var _0x2be8c7={};var _0x2bb14d={};var _0x57f7ea;var _0x240478;return db['VoiceQueue'][_0x43e7('0x49')]({'where':{'id':_0xf9178f[_0x43e7('0x40')]['id']}})['then'](handleEntityNotFound(_0x3bb7ab,null))[_0x43e7('0x13')](function(_0x381e47){if(_0x381e47){_0x57f7ea=_0x381e47;_0x2bb14d['model']=_[_0x43e7('0x41')](db[_0x43e7('0x72')][_0x43e7('0x26')]);_0x2bb14d[_0x43e7('0x2c')]=_[_0x43e7('0x41')](_0xf9178f[_0x43e7('0x2c')]);_0x2bb14d[_0x43e7('0x4e')]=_[_0x43e7('0x30')](_0x2bb14d['model'],_0x2bb14d[_0x43e7('0x2c')]);_0x2be8c7[_0x43e7('0x32')]=_[_0x43e7('0x30')](_0x2bb14d['model'],qs[_0x43e7('0x33')](_0xf9178f[_0x43e7('0x2c')]['fields']));_0x2be8c7[_0x43e7('0x32')]=_0x2be8c7[_0x43e7('0x32')]['length']?_0x2be8c7[_0x43e7('0x32')]:_0x2bb14d[_0x43e7('0x31')];_0x2be8c7[_0x43e7('0x56')]=qs['sort'](_0xf9178f[_0x43e7('0x2c')][_0x43e7('0x4d')]);_0x2be8c7['where']=qs[_0x43e7('0x4e')](_[_0x43e7('0x4f')](_0xf9178f[_0x43e7('0x2c')],_0x2bb14d[_0x43e7('0x4e')]));if(_0xf9178f['query']['filter']){_0x2be8c7[_0x43e7('0x2a')]=_[_0x43e7('0x36')](_0x2be8c7[_0x43e7('0x2a')],{'$or':_[_0x43e7('0x1a')](_0x2be8c7['attributes'],function(_0x1e6245){var _0x36860d={};_0x36860d[_0x1e6245]={'$like':'%'+_0xf9178f[_0x43e7('0x2c')][_0x43e7('0x19')]+'%'};return _0x36860d;})});}_0x2be8c7=_['merge']({},_0x2be8c7,_0xf9178f[_0x43e7('0x51')]);return _0x57f7ea[_0x43e7('0x84')](_0x2be8c7);}})[_0x43e7('0x13')](function(_0x3ff5d6){if(_0x3ff5d6){_0x240478=_0x3ff5d6[_0x43e7('0x34')];if(!_0xf9178f['query']['hasOwnProperty']('nolimit')){_0x2be8c7[_0x43e7('0x11')]=qs[_0x43e7('0x11')](_0xf9178f[_0x43e7('0x2c')]['limit']);_0x2be8c7[_0x43e7('0xe')]=qs['offset'](_0xf9178f[_0x43e7('0x2c')][_0x43e7('0xe')]);}return _0x57f7ea[_0x43e7('0x84')](_0x2be8c7);}})[_0x43e7('0x13')](function(_0x249a8d){if(_0x249a8d){return _0x249a8d?{'count':_0x240478,'rows':_0x249a8d}:null;}})[_0x43e7('0x13')](respondWithResult(_0x3bb7ab,null))['catch'](handleError(_0x3bb7ab,null));};exports[_0x43e7('0x85')]=function(_0x202421,_0x12e4a3){var _0x16ca0e={};var _0x2f467b={};var _0x7f43b5;var _0x4637f6;return db[_0x43e7('0x25')][_0x43e7('0x49')]({'where':{'id':_0x202421[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x12e4a3,null))[_0x43e7('0x13')](function(_0x24e9a7){if(_0x24e9a7){_0x7f43b5=_0x24e9a7;_0x2f467b['model']=_[_0x43e7('0x41')](db[_0x43e7('0x69')]['rawAttributes']);_0x2f467b[_0x43e7('0x2c')]=_[_0x43e7('0x41')](_0x202421['query']);_0x2f467b[_0x43e7('0x4e')]=_[_0x43e7('0x30')](_0x2f467b[_0x43e7('0x31')],_0x2f467b['query']);_0x16ca0e['attributes']=_[_0x43e7('0x30')](_0x2f467b[_0x43e7('0x31')],qs[_0x43e7('0x33')](_0x202421[_0x43e7('0x2c')][_0x43e7('0x33')]));_0x16ca0e[_0x43e7('0x32')]=_0x16ca0e[_0x43e7('0x32')][_0x43e7('0x34')]?_0x16ca0e['attributes']:_0x2f467b[_0x43e7('0x31')];_0x16ca0e[_0x43e7('0x56')]=qs[_0x43e7('0x4d')](_0x202421[_0x43e7('0x2c')][_0x43e7('0x4d')]);_0x16ca0e[_0x43e7('0x2a')]=qs[_0x43e7('0x4e')](_[_0x43e7('0x4f')](_0x202421[_0x43e7('0x2c')],_0x2f467b[_0x43e7('0x4e')]));if(_0x202421[_0x43e7('0x2c')][_0x43e7('0x19')]){_0x16ca0e['where']=_[_0x43e7('0x36')](_0x16ca0e[_0x43e7('0x2a')],{'$or':_[_0x43e7('0x1a')](_0x16ca0e[_0x43e7('0x32')],function(_0x49f43c){var _0xad02f6={};_0xad02f6[_0x49f43c]={'$like':'%'+_0x202421['query'][_0x43e7('0x19')]+'%'};return _0xad02f6;})});}_0x16ca0e=_['merge']({},_0x16ca0e,_0x202421[_0x43e7('0x51')]);return _0x7f43b5[_0x43e7('0x85')](_0x16ca0e);}})[_0x43e7('0x13')](function(_0x4a500c){if(_0x4a500c){_0x4637f6=_0x4a500c[_0x43e7('0x34')];if(!_0x202421[_0x43e7('0x2c')]['hasOwnProperty'](_0x43e7('0x4c'))){_0x16ca0e['limit']=qs[_0x43e7('0x11')](_0x202421[_0x43e7('0x2c')][_0x43e7('0x11')]);_0x16ca0e[_0x43e7('0xe')]=qs['offset'](_0x202421[_0x43e7('0x2c')][_0x43e7('0xe')]);}return _0x7f43b5[_0x43e7('0x85')](_0x16ca0e);}})['then'](function(_0x12c4f9){return _0x12c4f9?{'count':_0x4637f6,'rows':_0x12c4f9}:null;})[_0x43e7('0x13')](respondWithResult(_0x12e4a3,null))[_0x43e7('0x2e')](handleError(_0x12e4a3,null));};exports[_0x43e7('0x86')]=function(_0x77c2f,_0x1e4a25){var _0x5790b5={};var _0x3f057e={};var _0x505287;var _0x221938;return db[_0x43e7('0x25')]['findOne']({'where':{'id':_0x77c2f[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x1e4a25,null))['then'](function(_0x46aa47){if(_0x46aa47){_0x505287=_0x46aa47;_0x3f057e[_0x43e7('0x31')]=_[_0x43e7('0x41')](db[_0x43e7('0x87')]['rawAttributes']);_0x3f057e['query']=_[_0x43e7('0x41')](_0x77c2f[_0x43e7('0x2c')]);_0x3f057e[_0x43e7('0x4e')]=_[_0x43e7('0x30')](_0x3f057e[_0x43e7('0x31')],_0x3f057e[_0x43e7('0x2c')]);_0x5790b5[_0x43e7('0x32')]=_[_0x43e7('0x30')](_0x3f057e['model'],qs[_0x43e7('0x33')](_0x77c2f[_0x43e7('0x2c')]['fields']));_0x5790b5[_0x43e7('0x32')]=_0x5790b5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x5790b5[_0x43e7('0x32')]:_0x3f057e[_0x43e7('0x31')];_0x5790b5[_0x43e7('0x56')]=qs[_0x43e7('0x4d')](_0x77c2f['query'][_0x43e7('0x4d')]);_0x5790b5['where']=qs[_0x43e7('0x4e')](_[_0x43e7('0x4f')](_0x77c2f['query'],_0x3f057e[_0x43e7('0x4e')]));if(_0x77c2f['query'][_0x43e7('0x19')]){_0x5790b5[_0x43e7('0x2a')]=_[_0x43e7('0x36')](_0x5790b5['where'],{'$or':_['map'](_0x5790b5[_0x43e7('0x32')],function(_0xcfecd2){var _0x4cd879={};_0x4cd879[_0xcfecd2]={'$like':'%'+_0x77c2f[_0x43e7('0x2c')][_0x43e7('0x19')]+'%'};return _0x4cd879;})});}_0x5790b5=_[_0x43e7('0x36')]({},_0x5790b5,_0x77c2f['options']);return _0x505287[_0x43e7('0x86')](_0x5790b5);}})[_0x43e7('0x13')](function(_0xb2eb62){if(_0xb2eb62){_0x221938=_0xb2eb62['length'];if(!_0x77c2f[_0x43e7('0x2c')][_0x43e7('0x4b')](_0x43e7('0x4c'))){_0x5790b5[_0x43e7('0x11')]=qs[_0x43e7('0x11')](_0x77c2f[_0x43e7('0x2c')]['limit']);_0x5790b5[_0x43e7('0xe')]=qs[_0x43e7('0xe')](_0x77c2f[_0x43e7('0x2c')][_0x43e7('0xe')]);}return _0x505287[_0x43e7('0x86')](_0x5790b5);}})[_0x43e7('0x13')](function(_0x34ab5a){if(_0x34ab5a){return _0x34ab5a?{'count':_0x221938,'rows':_0x34ab5a}:null;}})[_0x43e7('0x13')](respondWithResult(_0x1e4a25,null))[_0x43e7('0x2e')](handleError(_0x1e4a25,null));};exports[_0x43e7('0x88')]=function(_0x13133c,_0x288d6a){var _0x47ef9d=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x56598f,_0x280668;return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x13133c[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x288d6a,null))[_0x43e7('0x13')](function(_0x51dc07){if(_0x51dc07){_0x280668=_0x51dc07;return _0x51dc07['addLists'](_0x13133c[_0x43e7('0x39')][_0x43e7('0x71')],_['omit'](_0x13133c['body'],[_0x43e7('0x71'),'id'])||{});}return null;})[_0x43e7('0x89')](function(_0x58a783){var _0x3d6659;_0x56598f=_0x58a783||[];var _0x57bcab=[];if(_0x58a783){for(var _0x5f4023=0x0;_0x5f4023<_0x58a783[_0x43e7('0x34')];_0x5f4023+=0x1){var _0x2be66d=_0x58a783[_0x5f4023]['get']({'plain':!![]});_0x280668['dialCheckDuplicateType']=_0x13133c[_0x43e7('0x39')][_0x43e7('0x8a')]?_0x13133c[_0x43e7('0x39')][_0x43e7('0x8a')]:_0x280668['dialCheckDuplicateType'];switch(_0x280668[_0x43e7('0x8a')]){case _0x43e7('0x8b'):_0x3d6659=squel['insert']()['into']('cm_hopper')['fromQuery']([_0x43e7('0x8c'),_0x43e7('0x8d'),'ContactId','ListId',_0x43e7('0x50'),_0x43e7('0x44'),_0x43e7('0x43')],squel[_0x43e7('0x73')]()[_0x43e7('0x8e')]('phone',_0x43e7('0x8c'))[_0x43e7('0x8e')]('\x27'+_0x47ef9d+'\x27',_0x43e7('0x8d'))[_0x43e7('0x8e')]('id',_0x43e7('0x8f'))['field'](_0x2be66d[_0x43e7('0x90')][_0x43e7('0x91')](),_0x43e7('0x92'))[_0x43e7('0x8e')](_0x13133c['params']['id'][_0x43e7('0x91')](),_0x43e7('0x50'))[_0x43e7('0x8e')]('\x27'+_0x47ef9d+'\x27',_0x43e7('0x44'))[_0x43e7('0x8e')]('\x27'+_0x47ef9d+'\x27',_0x43e7('0x43'))['from'](_0x43e7('0x93'))[_0x43e7('0x2a')](_0x43e7('0x94'))[_0x43e7('0x2a')]('ListId\x20=\x20?',_0x2be66d[_0x43e7('0x90')]['toString']())[_0x43e7('0x2a')]('phone\x20IS\x20NOT\x20NULL')[_0x43e7('0x2a')]('phone\x20NOT\x20IN\x20(?)',squel[_0x43e7('0x73')]()['field'](_0x43e7('0x95'))[_0x43e7('0x75')](_0x43e7('0x96'))[_0x43e7('0x2a')](_0x43e7('0x97'),_0x13133c[_0x43e7('0x40')]['id'][_0x43e7('0x91')]()))[_0x43e7('0x2a')](_0x43e7('0x98'),squel[_0x43e7('0x73')]()['field']('COALESCE(phone,\x27\x27)')['from'](_0x43e7('0x99'))['where']('VoiceQueueId\x20=\x20?',_0x13133c[_0x43e7('0x40')]['id'][_0x43e7('0x91')]())))[_0x43e7('0x91')]();break;case _0x43e7('0x9a'):_0x3d6659=squel[_0x43e7('0x9b')]()[_0x43e7('0x9c')](_0x43e7('0x99'))[_0x43e7('0x9d')]([_0x43e7('0x8c'),_0x43e7('0x8d'),_0x43e7('0x8f'),'ListId',_0x43e7('0x50'),_0x43e7('0x44'),_0x43e7('0x43')],squel['select']()[_0x43e7('0x8e')](_0x43e7('0x8c'),_0x43e7('0x8c'))['field']('\x27'+_0x47ef9d+'\x27',_0x43e7('0x8d'))[_0x43e7('0x8e')]('id',_0x43e7('0x8f'))[_0x43e7('0x8e')](_0x2be66d[_0x43e7('0x90')][_0x43e7('0x91')](),_0x43e7('0x92'))['field'](_0x13133c['params']['id'][_0x43e7('0x91')](),_0x43e7('0x50'))[_0x43e7('0x8e')]('\x27'+_0x47ef9d+'\x27','createdAt')['field']('\x27'+_0x47ef9d+'\x27',_0x43e7('0x43'))['from'](_0x43e7('0x93'))['where'](_0x43e7('0x94'))[_0x43e7('0x2a')]('ListId\x20=\x20?',_0x2be66d[_0x43e7('0x90')][_0x43e7('0x91')]())[_0x43e7('0x2a')](_0x43e7('0x9e'))['where'](_0x43e7('0x98'),squel[_0x43e7('0x73')]()[_0x43e7('0x8e')](_0x43e7('0x9f'))['from']('cm_hopper')[_0x43e7('0x2a')]('VoiceQueueId\x20=\x20?',_0x13133c['params']['id'][_0x43e7('0x91')]())))[_0x43e7('0x91')]();break;default:_0x3d6659=squel[_0x43e7('0x9b')]()[_0x43e7('0x9c')]('cm_hopper')[_0x43e7('0x9d')]([_0x43e7('0x8c'),_0x43e7('0x8d'),_0x43e7('0x8f'),_0x43e7('0x92'),_0x43e7('0x50'),'createdAt','updatedAt'],squel[_0x43e7('0x73')]()[_0x43e7('0x8e')](_0x43e7('0x8c'),_0x43e7('0x8c'))[_0x43e7('0x8e')]('\x27'+_0x47ef9d+'\x27',_0x43e7('0x8d'))['field']('id',_0x43e7('0x8f'))[_0x43e7('0x8e')](_0x2be66d[_0x43e7('0x90')][_0x43e7('0x91')](),'ListId')[_0x43e7('0x8e')](_0x13133c['params']['id'][_0x43e7('0x91')](),_0x43e7('0x50'))['field']('\x27'+_0x47ef9d+'\x27',_0x43e7('0x44'))['field']('\x27'+_0x47ef9d+'\x27',_0x43e7('0x43'))[_0x43e7('0x75')]('cm_contacts')[_0x43e7('0x2a')](_0x43e7('0x94'))[_0x43e7('0x2a')](_0x43e7('0xa0'),_0x2be66d[_0x43e7('0x90')][_0x43e7('0x91')]())[_0x43e7('0x2a')](_0x43e7('0x9e')))[_0x43e7('0x91')]();}_0x57bcab['push'](db['sequelize'][_0x43e7('0x2c')](_0x3d6659));}return BPromise[_0x43e7('0x7d')](_0x57bcab);}})[_0x43e7('0x13')](function(){var _0x3ac223=[];var _0x486780=squel[_0x43e7('0x9b')]()[_0x43e7('0x9c')](_0x43e7('0xa1'))[_0x43e7('0x9d')]([_0x43e7('0xa2'),_0x43e7('0x8c'),_0x43e7('0xa3'),'createdAt',_0x43e7('0x43')],squel['select']()['field']('h.id')[_0x43e7('0x8e')](_0x43e7('0xa4'))[_0x43e7('0x8e')](_0x43e7('0xa5'))[_0x43e7('0x8e')]('\x27'+_0x47ef9d+'\x27','createdAt')['field']('\x27'+_0x47ef9d+'\x27',_0x43e7('0x43'))['from'](_0x43e7('0xa6'),'ci')['join'](_0x43e7('0x99'),'h',_0x43e7('0xa7'))[_0x43e7('0x2a')](_0x43e7('0xa8'),_0x47ef9d)['where']('ci.ItemClass=?',_0x43e7('0xa9')))[_0x43e7('0x91')]();_0x3ac223['push'](db['sequelize'][_0x43e7('0x2c')](_0x486780));return BPromise[_0x43e7('0x7d')](_0x3ac223);})[_0x43e7('0x13')](function(){return _0x56598f;})[_0x43e7('0x13')](respondWithResult(_0x288d6a,null))[_0x43e7('0x2e')](handleError(_0x288d6a,null));};exports[_0x43e7('0xaa')]=function(_0x71807e,_0x314259){return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x71807e['params']['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x314259,null))[_0x43e7('0x13')](function(_0x2613fc){if(_0x2613fc){return _0x2613fc[_0x43e7('0xaa')](_0x71807e['query'][_0x43e7('0x71')]);}})['then'](function(_0x17b298){if(_0x17b298){return db[_0x43e7('0x4a')][_0x43e7('0x14')]({'where':{'ListId':_0x71807e[_0x43e7('0x2c')]['ids'],'VoiceQueueId':_0x71807e['params']['id']}})[_0x43e7('0x13')](function(){return _0x17b298;});}})['then'](respondWithStatusCode(_0x314259,null))[_0x43e7('0x2e')](handleError(_0x314259,null));};exports[_0x43e7('0xab')]=function(_0x44c536,_0x3a9550){var _0x5dcd3f={};var _0x2e7f00={};var _0x2627e2;var _0x591517;return db['VoiceQueue'][_0x43e7('0x49')]({'where':{'id':_0x44c536[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x3a9550,null))[_0x43e7('0x13')](function(_0x5e042f){if(_0x5e042f){_0x2627e2=_0x5e042f;_0x2e7f00['model']=_[_0x43e7('0x41')](db[_0x43e7('0x87')][_0x43e7('0x26')]);_0x2e7f00[_0x43e7('0x2c')]=_[_0x43e7('0x41')](_0x44c536[_0x43e7('0x2c')]);_0x2e7f00[_0x43e7('0x4e')]=_['intersection'](_0x2e7f00[_0x43e7('0x31')],_0x2e7f00[_0x43e7('0x2c')]);_0x5dcd3f[_0x43e7('0x32')]=_[_0x43e7('0x30')](_0x2e7f00[_0x43e7('0x31')],qs[_0x43e7('0x33')](_0x44c536[_0x43e7('0x2c')][_0x43e7('0x33')]));_0x5dcd3f[_0x43e7('0x32')]=_0x5dcd3f[_0x43e7('0x32')][_0x43e7('0x34')]?_0x5dcd3f[_0x43e7('0x32')]:_0x2e7f00[_0x43e7('0x31')];_0x5dcd3f[_0x43e7('0x56')]=qs[_0x43e7('0x4d')](_0x44c536[_0x43e7('0x2c')][_0x43e7('0x4d')]);_0x5dcd3f['where']=qs[_0x43e7('0x4e')](_[_0x43e7('0x4f')](_0x44c536[_0x43e7('0x2c')],_0x2e7f00[_0x43e7('0x4e')]));if(_0x44c536[_0x43e7('0x2c')]['filter']){_0x5dcd3f[_0x43e7('0x2a')]=_[_0x43e7('0x36')](_0x5dcd3f[_0x43e7('0x2a')],{'$or':_[_0x43e7('0x1a')](_0x5dcd3f[_0x43e7('0x32')],function(_0x5278fd){var _0x84b4f4={};_0x84b4f4[_0x5278fd]={'$like':'%'+_0x44c536['query']['filter']+'%'};return _0x84b4f4;})});}_0x5dcd3f=_['merge']({},_0x5dcd3f,_0x44c536[_0x43e7('0x51')]);return _0x2627e2[_0x43e7('0xab')](_0x5dcd3f);}})[_0x43e7('0x13')](function(_0x4ee587){if(_0x4ee587){_0x591517=_0x4ee587[_0x43e7('0x34')];if(!_0x44c536[_0x43e7('0x2c')]['hasOwnProperty'](_0x43e7('0x4c'))){_0x5dcd3f[_0x43e7('0x11')]=qs['limit'](_0x44c536[_0x43e7('0x2c')][_0x43e7('0x11')]);_0x5dcd3f[_0x43e7('0xe')]=qs[_0x43e7('0xe')](_0x44c536[_0x43e7('0x2c')]['offset']);}return _0x2627e2[_0x43e7('0xab')](_0x5dcd3f);}})[_0x43e7('0x13')](function(_0x3b641e){if(_0x3b641e){return _0x3b641e?{'count':_0x591517,'rows':_0x3b641e}:null;}})[_0x43e7('0x13')](respondWithResult(_0x3a9550,null))[_0x43e7('0x2e')](handleError(_0x3a9550,null));};exports['addBlackLists']=function(_0x5b046d,_0x4a0427){var _0xc3460c;return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x5b046d[_0x43e7('0x40')]['id']}})['then'](handleEntityNotFound(_0x4a0427,null))[_0x43e7('0x13')](function(_0x19c1d2){if(_0x19c1d2){return _0x19c1d2[_0x43e7('0xac')](_0x5b046d['body'][_0x43e7('0x71')],_['omit'](_0x5b046d[_0x43e7('0x39')],[_0x43e7('0x71'),'id'])||{});}return null;})[_0x43e7('0x89')](function(_0x40cc83){var _0x148d72;_0xc3460c=_0x40cc83||[];var _0x1ceb94=[];if(_0x40cc83){for(var _0x19c29b=0x0;_0x19c29b<_0x40cc83[_0x43e7('0x34')];_0x19c29b+=0x1){var _0x38a8db=_0x40cc83[_0x19c29b]['get']({'plain':!![]});_0x148d72=squel[_0x43e7('0x9b')]()[_0x43e7('0x9c')]('cm_hopper_black')['fromQuery']([_0x43e7('0x8c'),_0x43e7('0x8f'),_0x43e7('0x92'),_0x43e7('0x50'),_0x43e7('0x44'),_0x43e7('0x43')],squel[_0x43e7('0x73')]()[_0x43e7('0x8e')](_0x43e7('0x8c'),_0x43e7('0x8c'))[_0x43e7('0x8e')]('id','ContactId')[_0x43e7('0x8e')](_0x38a8db['CmListId'][_0x43e7('0x91')](),_0x43e7('0x92'))[_0x43e7('0x8e')](_0x5b046d[_0x43e7('0x40')]['id']['toString'](),_0x43e7('0x50'))[_0x43e7('0x8e')]('NOW()',_0x43e7('0x44'))[_0x43e7('0x8e')](_0x43e7('0xad'),_0x43e7('0x43'))[_0x43e7('0x75')](_0x43e7('0x93'))[_0x43e7('0x2a')]('deletedAt\x20IS\x20NULL')[_0x43e7('0x2a')](_0x43e7('0xa0'),_0x38a8db[_0x43e7('0x90')][_0x43e7('0x91')]())[_0x43e7('0x2a')](_0x43e7('0x9e')))[_0x43e7('0x91')]();_0x1ceb94[_0x43e7('0x7a')](db[_0x43e7('0x62')]['query'](_0x148d72));}return BPromise[_0x43e7('0x7d')](_0x1ceb94);}})['then'](function(){return _0xc3460c;})[_0x43e7('0x13')](respondWithResult(_0x4a0427,null))[_0x43e7('0x2e')](handleError(_0x4a0427,null));};exports[_0x43e7('0xae')]=function(_0x1dc579,_0x6d9fb){return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x1dc579['params']['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x6d9fb,null))['then'](function(_0x59ca95){if(_0x59ca95){return _0x59ca95[_0x43e7('0xae')](_0x1dc579['query']['ids']);}})[_0x43e7('0x13')](function(_0x759eb5){if(_0x759eb5){return db[_0x43e7('0x58')][_0x43e7('0x14')]({'where':{'ListId':_0x1dc579['query'][_0x43e7('0x71')],'VoiceQueueId':_0x1dc579['params']['id']}})[_0x43e7('0x13')](function(){return _0x759eb5;});}})[_0x43e7('0x13')](respondWithStatusCode(_0x6d9fb,null))[_0x43e7('0x2e')](handleError(_0x6d9fb,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index afbef29..acc0634 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 _0x11b3=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueue'];(function(_0x170493,_0x30930b){var _0x4875cb=function(_0x1b6f96){while(--_0x1b6f96){_0x170493['push'](_0x170493['shift']());}};_0x4875cb(++_0x30930b);}(_0x11b3,0x101));var _0x311b=function(_0x39fee2,_0x299662){_0x39fee2=_0x39fee2-0x0;var _0x35e0df=_0x11b3[_0x39fee2];return _0x35e0df;};'use strict';var EventEmitter=require(_0x311b('0x0'));var VoiceQueue=require(_0x311b('0x1'))['db'][_0x311b('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x311b('0x3'),'afterUpdate':_0x311b('0x4'),'afterDestroy':_0x311b('0x5')};function emitEvent(_0x7c010e){return function(_0x30f7f4,_0x5ad8c5,_0x35e5b0){VoiceQueueEvents['emit'](_0x7c010e+':'+_0x30f7f4['id'],_0x30f7f4);VoiceQueueEvents[_0x311b('0x6')](_0x7c010e,_0x30f7f4);_0x35e5b0(null);};}for(var e in events){if(events[_0x311b('0x7')](e)){var event=events[e];VoiceQueue[_0x311b('0x8')](e,emitEvent(event));}}module[_0x311b('0x9')]=VoiceQueueEvents; \ No newline at end of file +var _0x4a81=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x2cde0a,_0x1f9695){var _0x260610=function(_0x179089){while(--_0x179089){_0x2cde0a['push'](_0x2cde0a['shift']());}};_0x260610(++_0x1f9695);}(_0x4a81,0x1c9));var _0x14a8=function(_0x1e888a,_0x602494){_0x1e888a=_0x1e888a-0x0;var _0x205865=_0x4a81[_0x1e888a];return _0x205865;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x14a8('0x0'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x14a8('0x1')](0x0);var events={'afterCreate':_0x14a8('0x2'),'afterUpdate':_0x14a8('0x3'),'afterDestroy':_0x14a8('0x4')};function emitEvent(_0xc9f88d){return function(_0x31a12b,_0x25f589,_0x29ecab){VoiceQueueEvents[_0x14a8('0x5')](_0xc9f88d+':'+_0x31a12b['id'],_0x31a12b);VoiceQueueEvents['emit'](_0xc9f88d,_0x31a12b);_0x29ecab(null);};}for(var e in events){if(events[_0x14a8('0x6')](e)){var event=events[e];VoiceQueue[_0x14a8('0x7')](e,emitEvent(event));}}module[_0x14a8('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 9b000df..edede96 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 _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x11d20c,_0x1969ac){var _0x509259=function(_0x365d01){while(--_0x365d01){_0x11d20c['push'](_0x11d20c['shift']());}};_0x509259(++_0x1969ac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x2d8d69,_0x8e47ff){var _0x39ae22=function(_0xd7935e){while(--_0xd7935e){_0x2d8d69['push'](_0x2d8d69['shift']());}};_0x39ae22(++_0x8e47ff);}(_0x70e0,0x17b));var _0x070e=function(_0x25e452,_0x54b127){_0x25e452=_0x25e452-0x0;var _0x1c6cf0=_0x70e0[_0x25e452];return _0x1c6cf0;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VoiceQueue',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 0847501..be33e65 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 _0xd072=['stringify','error','code','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','find','ShowVoiceQueue','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','VoiceQueue,\x20%s,\x20%s','debug','VoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x1c8e6f,_0x59bed7){var _0x72924f=function(_0x3c5de4){while(--_0x3c5de4){_0x1c8e6f['push'](_0x1c8e6f['shift']());}};_0x72924f(++_0x59bed7);}(_0xd072,0xe0));var _0x2d07=function(_0x3fa120,_0xb410e0){_0x3fa120=_0x3fa120-0x0;var _0x4ca33a=_0xd072[_0x3fa120];return _0x4ca33a;};'use strict';var _=require(_0x2d07('0x0'));var util=require(_0x2d07('0x1'));var moment=require(_0x2d07('0x2'));var BPromise=require(_0x2d07('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2d07('0x4'));var logger=require(_0x2d07('0x5'))(_0x2d07('0x6'));var config=require(_0x2d07('0x7'));var jayson=require(_0x2d07('0x8'));var client=jayson[_0x2d07('0x9')][_0x2d07('0xa')]({'port':0x232a});config['redis']=_[_0x2d07('0xb')](config[_0x2d07('0xc')],{'host':_0x2d07('0xd'),'port':0x18eb});var socket=require(_0x2d07('0xe'))(new Redis(config['redis']));require('./voiceQueue.socket')[_0x2d07('0xf')](socket);function respondWithRpcPromise(_0x50687d,_0x5e63f5,_0x53709a){return new BPromise(function(_0xfd289e,_0x19e786){return client[_0x2d07('0x10')](_0x50687d,_0x53709a)[_0x2d07('0x11')](function(_0xb84faa){logger[_0x2d07('0x12')](_0x2d07('0x13'),_0x5e63f5,'request\x20sent');logger[_0x2d07('0x14')](_0x2d07('0x15'),_0x5e63f5,'request\x20sent',JSON[_0x2d07('0x16')](_0xb84faa));if(_0xb84faa[_0x2d07('0x17')]){if(_0xb84faa[_0x2d07('0x17')][_0x2d07('0x18')]===0x1f4){logger['error'](_0x2d07('0x13'),_0x5e63f5,_0xb84faa[_0x2d07('0x17')]['message']);return _0x19e786(_0xb84faa[_0x2d07('0x17')][_0x2d07('0x19')]);}logger[_0x2d07('0x17')]('VoiceQueue,\x20%s,\x20%s',_0x5e63f5,_0xb84faa[_0x2d07('0x17')][_0x2d07('0x19')]);return _0xfd289e(_0xb84faa[_0x2d07('0x17')][_0x2d07('0x19')]);}else{logger[_0x2d07('0x12')](_0x2d07('0x13'),_0x5e63f5,'request\x20sent');_0xfd289e(_0xb84faa[_0x2d07('0x1a')][_0x2d07('0x19')]);}})[_0x2d07('0x1b')](function(_0x51dbbc){logger[_0x2d07('0x17')](_0x2d07('0x13'),_0x5e63f5,_0x51dbbc);_0x19e786(_0x51dbbc);});});}exports[_0x2d07('0x1c')]=function(_0x5695e1){var _0x1711c9=this;return new Promise(function(_0x27f5d4,_0x37164a){return db[_0x2d07('0x1d')][_0x2d07('0x1e')]({'raw':_0x5695e1[_0x2d07('0x1f')]?_0x5695e1[_0x2d07('0x1f')][_0x2d07('0x20')]===undefined?!![]:![]:!![],'where':_0x5695e1[_0x2d07('0x1f')]?_0x5695e1[_0x2d07('0x1f')][_0x2d07('0x21')]||null:null,'attributes':_0x5695e1['options']?_0x5695e1[_0x2d07('0x1f')][_0x2d07('0x22')]||null:null,'limit':_0x5695e1[_0x2d07('0x1f')]?_0x5695e1[_0x2d07('0x1f')][_0x2d07('0x23')]||null:null,'include':_0x5695e1['options']?_0x5695e1[_0x2d07('0x1f')][_0x2d07('0x24')]?_[_0x2d07('0x25')](_0x5695e1[_0x2d07('0x1f')][_0x2d07('0x24')],function(_0x156ecb){return{'model':db[_0x156ecb[_0x2d07('0x26')]],'as':_0x156ecb['as'],'attributes':_0x156ecb[_0x2d07('0x22')],'include':_0x156ecb[_0x2d07('0x24')]?_[_0x2d07('0x25')](_0x156ecb[_0x2d07('0x24')],function(_0x17fa4e){return{'model':db[_0x17fa4e[_0x2d07('0x26')]],'as':_0x17fa4e['as'],'attributes':_0x17fa4e[_0x2d07('0x22')],'include':_0x17fa4e[_0x2d07('0x24')]?_['map'](_0x17fa4e[_0x2d07('0x24')],function(_0x12977b){return{'model':db[_0x12977b['model']],'as':_0x12977b['as'],'attributes':_0x12977b[_0x2d07('0x22')]};}):[]};}):[]};}):[]:[]})[_0x2d07('0x11')](function(_0x348296){logger['info'](_0x2d07('0x1c'),_0x5695e1);logger[_0x2d07('0x14')]('GetVoiceQueue',_0x5695e1,JSON[_0x2d07('0x16')](_0x348296));_0x27f5d4(_0x348296);})['catch'](function(_0xf41777){logger['error']('GetVoiceQueue',_0xf41777['message'],_0x5695e1);_0x37164a(_0x1711c9['error'](0x1f4,_0xf41777[_0x2d07('0x19')]));});});};exports['ShowVoiceQueue']=function(_0x55bc14){var _0x286d17=this;return new Promise(function(_0x63fdf4,_0x4e8e71){return db[_0x2d07('0x1d')][_0x2d07('0x27')]({'raw':_0x55bc14[_0x2d07('0x1f')]?_0x55bc14['options']['raw']===undefined?!![]:![]:!![],'where':_0x55bc14['options']?_0x55bc14[_0x2d07('0x1f')][_0x2d07('0x21')]||null:null,'attributes':_0x55bc14[_0x2d07('0x1f')]?_0x55bc14[_0x2d07('0x1f')][_0x2d07('0x22')]||null:null,'include':_0x55bc14[_0x2d07('0x1f')]?_0x55bc14['options'][_0x2d07('0x24')]?_['map'](_0x55bc14[_0x2d07('0x1f')][_0x2d07('0x24')],function(_0x16554b){return{'model':db[_0x16554b['model']],'as':_0x16554b['as'],'attributes':_0x16554b[_0x2d07('0x22')],'include':_0x16554b[_0x2d07('0x24')]?_[_0x2d07('0x25')](_0x16554b[_0x2d07('0x24')],function(_0x4a2890){return{'model':db[_0x4a2890[_0x2d07('0x26')]],'as':_0x4a2890['as'],'attributes':_0x4a2890[_0x2d07('0x22')],'include':_0x4a2890['include']?_[_0x2d07('0x25')](_0x4a2890[_0x2d07('0x24')],function(_0x40eba7){return{'model':db[_0x40eba7[_0x2d07('0x26')]],'as':_0x40eba7['as'],'attributes':_0x40eba7[_0x2d07('0x22')]};}):[]};}):[]};}):[]:[]})[_0x2d07('0x11')](function(_0x39b271){logger[_0x2d07('0x12')](_0x2d07('0x28'),_0x55bc14);logger['debug'](_0x2d07('0x28'),_0x55bc14,JSON['stringify'](_0x39b271));_0x63fdf4(_0x39b271);})[_0x2d07('0x1b')](function(_0x2a8bf9){logger[_0x2d07('0x17')](_0x2d07('0x28'),_0x2a8bf9[_0x2d07('0x19')],_0x55bc14);_0x4e8e71(_0x286d17[_0x2d07('0x17')](0x1f4,_0x2a8bf9[_0x2d07('0x19')]));});});}; \ No newline at end of file +var _0xa2a5=['map','catch','ShowVoiceQueue','find','where','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','then','info','VoiceQueue,\x20%s,\x20%s','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetVoiceQueue','VoiceQueue','findAll','options','attributes','include'];(function(_0x2c0bc2,_0x1410f9){var _0xc787af=function(_0x2af102){while(--_0x2af102){_0x2c0bc2['push'](_0x2c0bc2['shift']());}};_0xc787af(++_0x1410f9);}(_0xa2a5,0xa2));var _0x5a2a=function(_0x206307,_0x2d84d7){_0x206307=_0x206307-0x0;var _0x3e2258=_0xa2a5[_0x206307];return _0x3e2258;};'use strict';var _=require(_0x5a2a('0x0'));var util=require(_0x5a2a('0x1'));var moment=require(_0x5a2a('0x2'));var BPromise=require(_0x5a2a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5a2a('0x4'));var db=require(_0x5a2a('0x5'))['db'];var utils=require(_0x5a2a('0x6'));var logger=require(_0x5a2a('0x7'))(_0x5a2a('0x8'));var config=require(_0x5a2a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5a2a('0xa')][_0x5a2a('0xb')]({'port':0x232a});config[_0x5a2a('0xc')]=_[_0x5a2a('0xd')](config[_0x5a2a('0xc')],{'host':_0x5a2a('0xe'),'port':0x18eb});var socket=require(_0x5a2a('0xf'))(new Redis(config['redis']));require('./voiceQueue.socket')['register'](socket);function respondWithRpcPromise(_0x5edd3c,_0x5455df,_0x3a6f95){return new BPromise(function(_0x477174,_0x5885e8){return client['request'](_0x5edd3c,_0x3a6f95)[_0x5a2a('0x10')](function(_0x4f26f3){logger[_0x5a2a('0x11')](_0x5a2a('0x12'),_0x5455df,'request\x20sent');logger[_0x5a2a('0x13')](_0x5a2a('0x14'),_0x5455df,_0x5a2a('0x15'),JSON[_0x5a2a('0x16')](_0x4f26f3));if(_0x4f26f3[_0x5a2a('0x17')]){if(_0x4f26f3[_0x5a2a('0x17')][_0x5a2a('0x18')]===0x1f4){logger[_0x5a2a('0x17')](_0x5a2a('0x12'),_0x5455df,_0x4f26f3[_0x5a2a('0x17')][_0x5a2a('0x19')]);return _0x5885e8(_0x4f26f3[_0x5a2a('0x17')][_0x5a2a('0x19')]);}logger['error'](_0x5a2a('0x12'),_0x5455df,_0x4f26f3[_0x5a2a('0x17')][_0x5a2a('0x19')]);return _0x477174(_0x4f26f3['error'][_0x5a2a('0x19')]);}else{logger[_0x5a2a('0x11')](_0x5a2a('0x12'),_0x5455df,'request\x20sent');_0x477174(_0x4f26f3[_0x5a2a('0x1a')][_0x5a2a('0x19')]);}})['catch'](function(_0x3830b0){logger[_0x5a2a('0x17')](_0x5a2a('0x12'),_0x5455df,_0x3830b0);_0x5885e8(_0x3830b0);});});}exports[_0x5a2a('0x1b')]=function(_0x2c0b6a){var _0x5356fa=this;return new Promise(function(_0x393753,_0x280ff0){return db[_0x5a2a('0x1c')][_0x5a2a('0x1d')]({'raw':_0x2c0b6a[_0x5a2a('0x1e')]?_0x2c0b6a[_0x5a2a('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x2c0b6a['options']?_0x2c0b6a[_0x5a2a('0x1e')]['where']||null:null,'attributes':_0x2c0b6a[_0x5a2a('0x1e')]?_0x2c0b6a[_0x5a2a('0x1e')][_0x5a2a('0x1f')]||null:null,'limit':_0x2c0b6a[_0x5a2a('0x1e')]?_0x2c0b6a[_0x5a2a('0x1e')]['limit']||null:null,'include':_0x2c0b6a[_0x5a2a('0x1e')]?_0x2c0b6a[_0x5a2a('0x1e')][_0x5a2a('0x20')]?_[_0x5a2a('0x21')](_0x2c0b6a[_0x5a2a('0x1e')][_0x5a2a('0x20')],function(_0x469faa){return{'model':db[_0x469faa['model']],'as':_0x469faa['as'],'attributes':_0x469faa[_0x5a2a('0x1f')],'include':_0x469faa[_0x5a2a('0x20')]?_[_0x5a2a('0x21')](_0x469faa[_0x5a2a('0x20')],function(_0x46d103){return{'model':db[_0x46d103['model']],'as':_0x46d103['as'],'attributes':_0x46d103[_0x5a2a('0x1f')],'include':_0x46d103[_0x5a2a('0x20')]?_['map'](_0x46d103[_0x5a2a('0x20')],function(_0x5467de){return{'model':db[_0x5467de['model']],'as':_0x5467de['as'],'attributes':_0x5467de['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ef106){logger['info'](_0x5a2a('0x1b'),_0x2c0b6a);logger[_0x5a2a('0x13')](_0x5a2a('0x1b'),_0x2c0b6a,JSON[_0x5a2a('0x16')](_0x4ef106));_0x393753(_0x4ef106);})[_0x5a2a('0x22')](function(_0x29a2e9){logger[_0x5a2a('0x17')]('GetVoiceQueue',_0x29a2e9[_0x5a2a('0x19')],_0x2c0b6a);_0x280ff0(_0x5356fa[_0x5a2a('0x17')](0x1f4,_0x29a2e9[_0x5a2a('0x19')]));});});};exports[_0x5a2a('0x23')]=function(_0x3a99dd){var _0x12ff62=this;return new Promise(function(_0x123b92,_0x1277eb){return db['VoiceQueue'][_0x5a2a('0x24')]({'raw':_0x3a99dd[_0x5a2a('0x1e')]?_0x3a99dd[_0x5a2a('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x3a99dd[_0x5a2a('0x1e')]?_0x3a99dd[_0x5a2a('0x1e')][_0x5a2a('0x25')]||null:null,'attributes':_0x3a99dd[_0x5a2a('0x1e')]?_0x3a99dd[_0x5a2a('0x1e')][_0x5a2a('0x1f')]||null:null,'include':_0x3a99dd[_0x5a2a('0x1e')]?_0x3a99dd[_0x5a2a('0x1e')][_0x5a2a('0x20')]?_[_0x5a2a('0x21')](_0x3a99dd[_0x5a2a('0x1e')][_0x5a2a('0x20')],function(_0x3dd888){return{'model':db[_0x3dd888[_0x5a2a('0x26')]],'as':_0x3dd888['as'],'attributes':_0x3dd888['attributes'],'include':_0x3dd888[_0x5a2a('0x20')]?_['map'](_0x3dd888[_0x5a2a('0x20')],function(_0x24bf80){return{'model':db[_0x24bf80[_0x5a2a('0x26')]],'as':_0x24bf80['as'],'attributes':_0x24bf80[_0x5a2a('0x1f')],'include':_0x24bf80[_0x5a2a('0x20')]?_[_0x5a2a('0x21')](_0x24bf80[_0x5a2a('0x20')],function(_0x3c953f){return{'model':db[_0x3c953f[_0x5a2a('0x26')]],'as':_0x3c953f['as'],'attributes':_0x3c953f[_0x5a2a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5a2a('0x10')](function(_0x164f93){logger[_0x5a2a('0x11')](_0x5a2a('0x23'),_0x3a99dd);logger[_0x5a2a('0x13')](_0x5a2a('0x23'),_0x3a99dd,JSON[_0x5a2a('0x16')](_0x164f93));_0x123b92(_0x164f93);})[_0x5a2a('0x22')](function(_0x51196c){logger[_0x5a2a('0x17')]('ShowVoiceQueue',_0x51196c[_0x5a2a('0x19')],_0x3a99dd);_0x1277eb(_0x12ff62[_0x5a2a('0x17')](0x1f4,_0x51196c[_0x5a2a('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 4dc1c75..f34815c 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 _0xfa4f=['removeListener','register','length','voiceQueue:','./voiceQueue.events','save','remove','update','emit'];(function(_0x1c57cc,_0x5aef70){var _0x21d48a=function(_0x2f401f){while(--_0x2f401f){_0x1c57cc['push'](_0x1c57cc['shift']());}};_0x21d48a(++_0x5aef70);}(_0xfa4f,0xd3));var _0xffa4=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xfa4f[_0x1b2ff7];return _0x31656a;};'use strict';var VoiceQueueEvents=require(_0xffa4('0x0'));var events=[_0xffa4('0x1'),_0xffa4('0x2'),_0xffa4('0x3')];function createListener(_0x422bb8,_0x45a8ff){return function(_0x36223c){_0x45a8ff[_0xffa4('0x4')](_0x422bb8,_0x36223c);};}function removeListener(_0x26ab44,_0x18e902){return function(){VoiceQueueEvents[_0xffa4('0x5')](_0x26ab44,_0x18e902);};}exports[_0xffa4('0x6')]=function(_0x1137af){for(var _0x59ca28=0x0,_0x533d53=events[_0xffa4('0x7')];_0x59ca28<_0x533d53;_0x59ca28++){var _0x5716d2=events[_0x59ca28];var _0x4331e7=createListener(_0xffa4('0x8')+_0x5716d2,_0x1137af);VoiceQueueEvents['on'](_0x5716d2,_0x4331e7);}}; \ No newline at end of file +var _0x0a50=['register','length','voiceQueue:','./voiceQueue.events','save','remove','emit'];(function(_0x5d74a3,_0xb52baf){var _0x3f585d=function(_0x3ebe97){while(--_0x3ebe97){_0x5d74a3['push'](_0x5d74a3['shift']());}};_0x3f585d(++_0xb52baf);}(_0x0a50,0xc0));var _0x00a5=function(_0x11f24d,_0x58f26a){_0x11f24d=_0x11f24d-0x0;var _0x1a86e6=_0x0a50[_0x11f24d];return _0x1a86e6;};'use strict';var VoiceQueueEvents=require(_0x00a5('0x0'));var events=[_0x00a5('0x1'),_0x00a5('0x2'),'update'];function createListener(_0x4be0bf,_0x49148e){return function(_0x50c360){_0x49148e[_0x00a5('0x3')](_0x4be0bf,_0x50c360);};}function removeListener(_0x1778bb,_0x413bed){return function(){VoiceQueueEvents['removeListener'](_0x1778bb,_0x413bed);};}exports[_0x00a5('0x4')]=function(_0x252062){for(var _0x3d9d2d=0x0,_0x24db10=events[_0x00a5('0x5')];_0x3d9d2d<_0x24db10;_0x3d9d2d++){var _0x44d058=events[_0x3d9d2d];var _0x34415c=createListener(_0x00a5('0x6')+_0x44d058,_0x252062);VoiceQueueEvents['on'](_0x44d058,_0x34415c);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 5b22520..2663098 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 _0xcdd1=['show','post','create','put','update','delete','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','isAuthenticated','index','get','describe','getVoiceQueuesReport','/:id'];(function(_0x1773f7,_0x54318f){var _0x1983fb=function(_0x50b543){while(--_0x50b543){_0x1773f7['push'](_0x1773f7['shift']());}};_0x1983fb(++_0x54318f);}(_0xcdd1,0xd7));var _0x1cdd=function(_0x101be8,_0x1ea713){_0x101be8=_0x101be8-0x0;var _0x32fb9c=_0xcdd1[_0x101be8];return _0x32fb9c;};'use strict';var multer=require(_0x1cdd('0x0'));var util=require(_0x1cdd('0x1'));var path=require(_0x1cdd('0x2'));var timeout=require(_0x1cdd('0x3'));var express=require('express');var router=express[_0x1cdd('0x4')]();var fs_extra=require(_0x1cdd('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1cdd('0x6'));var controller=require('./voiceQueueReport.controller');router['get']('/',auth[_0x1cdd('0x7')](),controller[_0x1cdd('0x8')]);router[_0x1cdd('0x9')]('/describe',auth[_0x1cdd('0x7')](),controller[_0x1cdd('0xa')]);router[_0x1cdd('0x9')]('/index',auth[_0x1cdd('0x7')](),controller[_0x1cdd('0xb')]);router[_0x1cdd('0x9')](_0x1cdd('0xc'),auth[_0x1cdd('0x7')](),controller[_0x1cdd('0xd')]);router[_0x1cdd('0xe')]('/',auth['isAuthenticated'](),controller[_0x1cdd('0xf')]);router[_0x1cdd('0x10')](_0x1cdd('0xc'),auth[_0x1cdd('0x7')](),controller[_0x1cdd('0x11')]);router[_0x1cdd('0x12')]('/:id',auth[_0x1cdd('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7e3d=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','/:id','show','post'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x7e3d,0x8a));var _0xd7e3=function(_0x16d09a,_0x4d863a){_0x16d09a=_0x16d09a-0x0;var _0x567bca=_0x7e3d[_0x16d09a];return _0x567bca;};'use strict';var multer=require(_0xd7e3('0x0'));var util=require(_0xd7e3('0x1'));var path=require(_0xd7e3('0x2'));var timeout=require(_0xd7e3('0x3'));var express=require(_0xd7e3('0x4'));var router=express[_0xd7e3('0x5')]();var fs_extra=require(_0xd7e3('0x6'));var auth=require(_0xd7e3('0x7'));var interaction=require(_0xd7e3('0x8'));var config=require(_0xd7e3('0x9'));var controller=require(_0xd7e3('0xa'));router[_0xd7e3('0xb')]('/',auth[_0xd7e3('0xc')](),controller['index']);router[_0xd7e3('0xb')]('/describe',auth[_0xd7e3('0xc')](),controller['describe']);router[_0xd7e3('0xb')]('/index',auth[_0xd7e3('0xc')](),controller['getVoiceQueuesReport']);router[_0xd7e3('0xb')](_0xd7e3('0xd'),auth['isAuthenticated'](),controller[_0xd7e3('0xe')]);router[_0xd7e3('0xf')]('/',auth[_0xd7e3('0xc')](),controller[_0xd7e3('0x10')]);router[_0xd7e3('0x11')](_0xd7e3('0xd'),auth[_0xd7e3('0xc')](),controller[_0xd7e3('0x12')]);router[_0xd7e3('0x13')](_0xd7e3('0xd'),auth[_0xd7e3('0xc')](),controller[_0xd7e3('0x14')]);module[_0xd7e3('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index a9ee879..dc20465 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 _0xd18c=['setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','seconds'];(function(_0x2b6b12,_0x41b52d){var _0x5d7176=function(_0x2c1805){while(--_0x2c1805){_0x2b6b12['push'](_0x2b6b12['shift']());}};_0x5d7176(++_0x41b52d);}(_0xd18c,0x163));var _0xcd18=function(_0x25bb9d,_0x4f12cc){_0x25bb9d=_0x25bb9d-0x0;var _0x5e7a45=_0xd18c[_0x25bb9d];return _0x5e7a45;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xcd18('0x0'));module[_0xcd18('0x1')]={'type':{'type':Sequelize[_0xcd18('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xcd18('0x2')]},'queue':{'type':Sequelize[_0xcd18('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0xcd18('0x3')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x1c4378){var _0x4a5c32=moment(_0x1c4378);var _0x1fd65d=moment(this[_0xcd18('0x4')](_0xcd18('0x5')))[_0xcd18('0x6')](_0xcd18('0x7'));var _0x47da52=_0x4a5c32['diff'](_0x1fd65d,_0xcd18('0x8'));this[_0xcd18('0x9')](_0xcd18('0xa'),_0x1c4378);this['setDataValue'](_0xcd18('0xb'),_0x47da52||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0xcd18('0xc')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0xcd18('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xcd18('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xcd18('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0xcd18('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0xcd18('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xcd18('0x2')]},'accountcode':{'type':Sequelize[_0xcd18('0x2')]},'context':{'type':Sequelize[_0xcd18('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xcd18('0x2')]},'holdtime':{'type':Sequelize[_0xcd18('0xc')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xcd18('0x2')]},'transfer':{'type':Sequelize[_0xcd18('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xcd18('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xcd18('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xcd18('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0xcd18('0xc')],'defaultValue':0x0},'note':{'type':Sequelize[_0xcd18('0x2')]}}; \ No newline at end of file +var _0x110d=['BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','moment','exports','STRING','DATE','getDataValue','YYYY-MM-DD\x20HH:mm:ss','diff','setDataValue','holdtime','INTEGER'];(function(_0x535a20,_0x278ee4){var _0x13d870=function(_0x3ae1f0){while(--_0x3ae1f0){_0x535a20['push'](_0x535a20['shift']());}};_0x13d870(++_0x278ee4);}(_0x110d,0xc2));var _0xd110=function(_0xfb0cfd,_0x500179){_0xfb0cfd=_0xfb0cfd-0x0;var _0x2fd8aa=_0x110d[_0xfb0cfd];return _0x2fd8aa;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xd110('0x0'));module[_0xd110('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xd110('0x2')]},'calleridnum':{'type':Sequelize[_0xd110('0x2')]},'calleridname':{'type':Sequelize[_0xd110('0x2')]},'queue':{'type':Sequelize[_0xd110('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0xd110('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xd110('0x3')],'set':function(_0x147d3f){var _0x5cd551=moment(_0x147d3f);var _0x221ccc=moment(this[_0xd110('0x4')]('queuecallerjoinAt'))['format'](_0xd110('0x5'));var _0x5d72ee=_0x5cd551[_0xd110('0x6')](_0x221ccc,'seconds');this[_0xd110('0x7')]('queuecallerleaveAt',_0x147d3f);this[_0xd110('0x7')](_0xd110('0x8'),_0x5d72ee||null);}},'position':{'type':Sequelize[_0xd110('0x9')]},'count':{'type':Sequelize[_0xd110('0x9')]},'queuecallerabandon':{'type':Sequelize[_0xd110('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xd110('0x3')]},'queuecallerexit':{'type':Sequelize[_0xd110('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0xd110('0x2')],'comment':_0xd110('0xb')},'originalposition':{'type':Sequelize[_0xd110('0x9')]},'channel':{'type':Sequelize[_0xd110('0x2')]},'connectedlinenum':{'type':Sequelize[_0xd110('0x2')]},'connectedlinename':{'type':Sequelize[_0xd110('0x2')]},'accountcode':{'type':Sequelize[_0xd110('0x2')]},'context':{'type':Sequelize[_0xd110('0x2')]},'exten':{'type':Sequelize[_0xd110('0x2')]},'priority':{'type':Sequelize[_0xd110('0x2')]},'holdtime':{'type':Sequelize[_0xd110('0x9')]},'mohtime':{'type':Sequelize[_0xd110('0x9')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xd110('0xa')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xd110('0x2')]},'transfer':{'type':Sequelize[_0xd110('0xa')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xd110('0x2')]},'transferuniqueid':{'type':Sequelize[_0xd110('0x2')]},'disposition':{'type':Sequelize[_0xd110('0x2')]},'secondDisposition':{'type':Sequelize[_0xd110('0x2')]},'thirdDisposition':{'type':Sequelize[_0xd110('0x2')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 28ecf91..f8f3d6e 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 _0x28f6=['intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceQueueReport','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','length','find','create','body','describe','getVoiceQueuesReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','stack','name','send','fieldName','type','key','model','map','query','filters'];(function(_0x5a55c9,_0x2b01dc){var _0x1bc51c=function(_0x5cce99){while(--_0x5cce99){_0x5a55c9['push'](_0x5a55c9['shift']());}};_0x1bc51c(++_0x2b01dc);}(_0x28f6,0x75));var _0x628f=function(_0x39dbeb,_0x437b01){_0x39dbeb=_0x39dbeb-0x0;var _0x52827b=_0x28f6[_0x39dbeb];return _0x52827b;};'use strict';var emlformat=require(_0x628f('0x0'));var rimraf=require(_0x628f('0x1'));var zipdir=require(_0x628f('0x2'));var jsonpatch=require(_0x628f('0x3'));var rp=require(_0x628f('0x4'));var moment=require(_0x628f('0x5'));var BPromise=require(_0x628f('0x6'));var Mustache=require(_0x628f('0x7'));var util=require(_0x628f('0x8'));var path=require(_0x628f('0x9'));var sox=require(_0x628f('0xa'));var csv=require(_0x628f('0xb'));var ejs=require(_0x628f('0xc'));var fs=require('fs');var fs_extra=require(_0x628f('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x628f('0xe'));var jsforce=require(_0x628f('0xf'));var deskjs=require(_0x628f('0x10'));var toCsv=require(_0x628f('0xb'));var querystring=require(_0x628f('0x11'));var Papa=require(_0x628f('0x12'));var Redis=require(_0x628f('0x13'));var authService=require(_0x628f('0x14'));var qs=require(_0x628f('0x15'));var as=require(_0x628f('0x16'));var hardwareService=require(_0x628f('0x17'));var logger=require(_0x628f('0x18'))(_0x628f('0x19'));var utils=require(_0x628f('0x1a'));var config=require(_0x628f('0x1b'));var licenseUtil=require(_0x628f('0x1c'));var db=require(_0x628f('0x1d'))['db'];config[_0x628f('0x1e')]=_[_0x628f('0x1f')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x628f('0x20'))(new Redis(config[_0x628f('0x1e')]));require(_0x628f('0x21'))[_0x628f('0x22')](socket);function respondWithStatusCode(_0x459a68,_0x216c61){_0x216c61=_0x216c61||0xcc;return function(_0x3982d7){if(_0x3982d7){return _0x459a68['sendStatus'](_0x216c61);}return _0x459a68[_0x628f('0x23')](_0x216c61)[_0x628f('0x24')]();};}function respondWithResult(_0x843f94,_0x1d4b41){_0x1d4b41=_0x1d4b41||0xc8;return function(_0x192a6a){if(_0x192a6a){return _0x843f94[_0x628f('0x23')](_0x1d4b41)[_0x628f('0x25')](_0x192a6a);}};}function respondWithFilteredResult(_0x84ec06,_0x53e4fe){return function(_0x48e2e0){if(_0x48e2e0){var _0x21240b=typeof _0x53e4fe[_0x628f('0x26')]===_0x628f('0x27')&&typeof _0x53e4fe['limit']===_0x628f('0x27');var _0x31e425=_0x48e2e0[_0x628f('0x28')];var _0x2b2860=_0x21240b?0x0:_0x53e4fe[_0x628f('0x26')];var _0x2aed73=_0x21240b?_0x48e2e0[_0x628f('0x28')]:_0x53e4fe[_0x628f('0x26')]+_0x53e4fe[_0x628f('0x29')];var _0x35058d;if(_0x2aed73>=_0x31e425){_0x2aed73=_0x31e425;_0x35058d=0xc8;}else{_0x35058d=0xce;}_0x84ec06['status'](_0x35058d);return _0x84ec06[_0x628f('0x2a')]('Content-Range',_0x2b2860+'-'+_0x2aed73+'/'+_0x31e425)[_0x628f('0x25')](_0x48e2e0);}return null;};}function patchUpdates(_0x447592){return function(_0x1cebbe){try{jsonpatch[_0x628f('0x2b')](_0x1cebbe,_0x447592,!![]);}catch(_0x21fb10){return BPromise[_0x628f('0x2c')](_0x21fb10);}return _0x1cebbe[_0x628f('0x2d')]();};}function saveUpdates(_0x5f43b9,_0x55f35e){return function(_0xc95e73){if(_0xc95e73){return _0xc95e73[_0x628f('0x2e')](_0x5f43b9)[_0x628f('0x2f')](function(_0x58e8f9){return _0x58e8f9;});}return null;};}function removeEntity(_0x3025a3,_0x33420a){return function(_0xcec81a){if(_0xcec81a){return _0xcec81a[_0x628f('0x30')]()['then'](function(){_0x3025a3[_0x628f('0x23')](0xcc)[_0x628f('0x24')]();});}};}function handleEntityNotFound(_0xb97818,_0x570802){return function(_0x5bda8d){if(!_0x5bda8d){_0xb97818['sendStatus'](0x194);}return _0x5bda8d;};}function handleError(_0x5d34fb,_0x31cd63){_0x31cd63=_0x31cd63||0x1f4;return function(_0x1b2163){logger['error'](_0x1b2163[_0x628f('0x31')]);if(_0x1b2163[_0x628f('0x32')]){delete _0x1b2163['name'];}_0x5d34fb[_0x628f('0x23')](_0x31cd63)[_0x628f('0x33')](_0x1b2163);};}exports['index']=function(_0x120605,_0x3cbc38){var _0x5552ee={},_0x2a490d={},_0x5f2626={'count':0x0,'rows':[]};var _0x2b09e4=_['map'](db['VoiceQueueReport']['rawAttributes'],function(_0x2c4d69){return{'name':_0x2c4d69[_0x628f('0x34')],'type':_0x2c4d69[_0x628f('0x35')][_0x628f('0x36')]};});_0x2a490d[_0x628f('0x37')]=_[_0x628f('0x38')](_0x2b09e4,_0x628f('0x32'));_0x2a490d[_0x628f('0x39')]=_['keys'](_0x120605[_0x628f('0x39')]);_0x2a490d[_0x628f('0x3a')]=_[_0x628f('0x3b')](_0x2a490d[_0x628f('0x37')],_0x2a490d[_0x628f('0x39')]);_0x5552ee[_0x628f('0x3c')]=_[_0x628f('0x3b')](_0x2a490d[_0x628f('0x37')],qs[_0x628f('0x3d')](_0x120605[_0x628f('0x39')][_0x628f('0x3d')]));_0x5552ee['attributes']=_0x5552ee[_0x628f('0x3c')]['length']?_0x5552ee[_0x628f('0x3c')]:_0x2a490d[_0x628f('0x37')];if(!_0x120605[_0x628f('0x39')][_0x628f('0x3e')](_0x628f('0x3f'))){_0x5552ee[_0x628f('0x29')]=qs['limit'](_0x120605[_0x628f('0x39')][_0x628f('0x29')]);_0x5552ee[_0x628f('0x26')]=qs[_0x628f('0x26')](_0x120605['query']['offset']);}_0x5552ee[_0x628f('0x40')]=qs[_0x628f('0x41')](_0x120605[_0x628f('0x39')][_0x628f('0x41')]);_0x5552ee[_0x628f('0x42')]=qs['filters'](_[_0x628f('0x43')](_0x120605[_0x628f('0x39')],_0x2a490d[_0x628f('0x3a')]),_0x2b09e4);if(_0x120605[_0x628f('0x39')][_0x628f('0x44')]){_0x5552ee[_0x628f('0x42')]=_[_0x628f('0x45')](_0x5552ee[_0x628f('0x42')],{'$or':_[_0x628f('0x38')](_0x2b09e4,function(_0x40bc7d){if(_0x40bc7d[_0x628f('0x35')]!==_0x628f('0x46')){var _0x458f58={};_0x458f58[_0x40bc7d['name']]={'$like':'%'+_0x120605[_0x628f('0x39')][_0x628f('0x44')]+'%'};return _0x458f58;}})});}_0x5552ee=_[_0x628f('0x45')]({},_0x5552ee,_0x120605[_0x628f('0x47')]);var _0x489dd2={'where':_0x5552ee[_0x628f('0x42')]};return db[_0x628f('0x48')]['count'](_0x489dd2)[_0x628f('0x2f')](function(_0x37ca85){_0x5f2626['count']=_0x37ca85;if(_0x120605['query'][_0x628f('0x49')]){_0x5552ee[_0x628f('0x4a')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x628f('0x4b')](_0x5552ee);})[_0x628f('0x2f')](function(_0x4a98f3){_0x5f2626[_0x628f('0x4c')]=_0x4a98f3;return _0x5f2626;})[_0x628f('0x2f')](respondWithFilteredResult(_0x3cbc38,_0x5552ee))[_0x628f('0x4d')](handleError(_0x3cbc38,null));};exports[_0x628f('0x4e')]=function(_0x3a0957,_0x5e9251){var _0x52d1e9={'raw':![],'where':{'id':_0x3a0957[_0x628f('0x4f')]['id']}},_0x5aa6f8={};_0x5aa6f8[_0x628f('0x37')]=_[_0x628f('0x50')](db[_0x628f('0x48')][_0x628f('0x51')]);_0x5aa6f8[_0x628f('0x39')]=_['keys'](_0x3a0957[_0x628f('0x39')]);_0x5aa6f8[_0x628f('0x3a')]=_[_0x628f('0x3b')](_0x5aa6f8[_0x628f('0x37')],_0x5aa6f8[_0x628f('0x39')]);_0x52d1e9[_0x628f('0x3c')]=_[_0x628f('0x3b')](_0x5aa6f8['model'],qs[_0x628f('0x3d')](_0x3a0957[_0x628f('0x39')]['fields']));_0x52d1e9[_0x628f('0x3c')]=_0x52d1e9['attributes'][_0x628f('0x52')]?_0x52d1e9[_0x628f('0x3c')]:_0x5aa6f8[_0x628f('0x37')];if(_0x3a0957[_0x628f('0x39')][_0x628f('0x49')]){_0x52d1e9[_0x628f('0x4a')]=[{'all':!![]}];}_0x52d1e9=_[_0x628f('0x45')]({},_0x52d1e9,_0x3a0957['options']);return db[_0x628f('0x48')][_0x628f('0x53')](_0x52d1e9)['then'](handleEntityNotFound(_0x5e9251,null))[_0x628f('0x2f')](respondWithResult(_0x5e9251,null))[_0x628f('0x4d')](handleError(_0x5e9251,null));};exports['create']=function(_0x3a47bf,_0x2bae4f){return db['VoiceQueueReport'][_0x628f('0x54')](_0x3a47bf[_0x628f('0x55')],{})[_0x628f('0x2f')](respondWithResult(_0x2bae4f,0xc9))[_0x628f('0x4d')](handleError(_0x2bae4f,null));};exports[_0x628f('0x2e')]=function(_0x3cc8a0,_0x50e7e5){if(_0x3cc8a0[_0x628f('0x55')]['id']){delete _0x3cc8a0[_0x628f('0x55')]['id'];}return db[_0x628f('0x48')][_0x628f('0x53')]({'where':{'id':_0x3cc8a0[_0x628f('0x4f')]['id']}})[_0x628f('0x2f')](handleEntityNotFound(_0x50e7e5,null))[_0x628f('0x2f')](saveUpdates(_0x3cc8a0[_0x628f('0x55')],null))[_0x628f('0x2f')](respondWithResult(_0x50e7e5,null))[_0x628f('0x4d')](handleError(_0x50e7e5,null));};exports[_0x628f('0x30')]=function(_0x39adb8,_0xa15875){return db[_0x628f('0x48')]['find']({'where':{'id':_0x39adb8[_0x628f('0x4f')]['id']}})[_0x628f('0x2f')](handleEntityNotFound(_0xa15875,null))[_0x628f('0x2f')](removeEntity(_0xa15875,null))[_0x628f('0x4d')](handleError(_0xa15875,null));};exports['describe']=function(_0xdef7f5,_0x35a804){return db['VoiceQueueReport'][_0x628f('0x56')]()[_0x628f('0x2f')](respondWithResult(_0x35a804,null))[_0x628f('0x4d')](handleError(_0x35a804,null));};exports[_0x628f('0x57')]=function(_0xc1cba6,_0x5ef163){var _0x4b9aae={},_0x5a9e8f={},_0x551c5e={'count':0x0,'rows':[]};_0x5a9e8f[_0x628f('0x37')]=_[_0x628f('0x50')](db[_0x628f('0x48')][_0x628f('0x51')]);_0x5a9e8f['query']=_[_0x628f('0x50')](_0xc1cba6[_0x628f('0x39')]);_0x5a9e8f[_0x628f('0x3a')]=_[_0x628f('0x3b')](_0x5a9e8f['model'],_0x5a9e8f['query']);_0x4b9aae[_0x628f('0x3c')]=_[_0x628f('0x3b')](_0x5a9e8f['model'],qs['fields'](_0xc1cba6[_0x628f('0x39')][_0x628f('0x3d')]));_0x4b9aae[_0x628f('0x3c')]=_0x4b9aae[_0x628f('0x3c')][_0x628f('0x52')]?_0x4b9aae[_0x628f('0x3c')]:_0x5a9e8f[_0x628f('0x37')];if(!_0xc1cba6[_0x628f('0x39')][_0x628f('0x3e')](_0x628f('0x3f'))){_0x4b9aae[_0x628f('0x29')]=qs['limit'](_0xc1cba6[_0x628f('0x39')][_0x628f('0x29')]);_0x4b9aae[_0x628f('0x26')]=qs['offset'](_0xc1cba6[_0x628f('0x39')][_0x628f('0x26')]);}_0x4b9aae['order']=qs[_0x628f('0x41')](_0xc1cba6[_0x628f('0x39')][_0x628f('0x41')]);_0x4b9aae[_0x628f('0x42')]=qs['filters'](_[_0x628f('0x43')](_0xc1cba6[_0x628f('0x39')],_0x5a9e8f[_0x628f('0x3a')]));if(_0xc1cba6['query'][_0x628f('0x44')]){_0x4b9aae['where']=_['merge'](_0x4b9aae[_0x628f('0x42')],{'$or':_[_0x628f('0x38')](_0x4b9aae[_0x628f('0x3c')],function(_0x1c7d30){var _0x52b7e0={};_0x52b7e0[_0x1c7d30]={'$like':'%'+_0xc1cba6[_0x628f('0x39')]['filter']+'%'};return _0x52b7e0;})});}_0x4b9aae=_[_0x628f('0x45')]({},_0x4b9aae,_0xc1cba6[_0x628f('0x47')]);var _0x49172b={'where':_0x4b9aae[_0x628f('0x42')]};return db[_0x628f('0x48')]['count'](_0x49172b)['then'](function(_0x16c3b2){_0x551c5e[_0x628f('0x28')]=_0x16c3b2;if(_0xc1cba6[_0x628f('0x39')]['includeAll']){_0x4b9aae[_0x628f('0x4a')]=[{'all':!![]}];}return db[_0x628f('0x48')][_0x628f('0x4b')](_0x4b9aae);})[_0x628f('0x2f')](function(_0x181bad){_0x551c5e[_0x628f('0x4c')]=_0x181bad;return _0x551c5e;})[_0x628f('0x2f')](respondWithFilteredResult(_0x5ef163,_0x4b9aae,_0x628f('0x57')))['catch'](handleError(_0x5ef163,null,_0x628f('0x57')));}; \ No newline at end of file +var _0x08c3=['fs-extra','squel','jsforce','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','VIRTUAL','filter','options','includeAll','findAll','catch','show','keys','find','create','body','params','describe','getVoiceQueuesReport','length','pick','merge','include','rows','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x4d48b7,_0x4da22c){var _0x1c1c57=function(_0x147f7c){while(--_0x147f7c){_0x4d48b7['push'](_0x4d48b7['shift']());}};_0x1c1c57(++_0x4da22c);}(_0x08c3,0xe2));var _0x308c=function(_0x374785,_0x4f71b8){_0x374785=_0x374785-0x0;var _0x572c40=_0x08c3[_0x374785];return _0x572c40;};'use strict';var emlformat=require(_0x308c('0x0'));var rimraf=require(_0x308c('0x1'));var zipdir=require(_0x308c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x308c('0x3'));var moment=require('moment');var BPromise=require(_0x308c('0x4'));var Mustache=require(_0x308c('0x5'));var util=require(_0x308c('0x6'));var path=require(_0x308c('0x7'));var sox=require(_0x308c('0x8'));var csv=require(_0x308c('0x9'));var ejs=require(_0x308c('0xa'));var fs=require('fs');var fs_extra=require(_0x308c('0xb'));var _=require('lodash');var squel=require(_0x308c('0xc'));var crypto=require('crypto');var jsforce=require(_0x308c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x308c('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x308c('0xe'));var as=require(_0x308c('0xf'));var hardwareService=require(_0x308c('0x10'));var logger=require(_0x308c('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x308c('0x12'));var licenseUtil=require(_0x308c('0x13'));var db=require(_0x308c('0x14'))['db'];config[_0x308c('0x15')]=_[_0x308c('0x16')](config[_0x308c('0x15')],{'host':_0x308c('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x308c('0x18'))[_0x308c('0x19')](socket);function respondWithStatusCode(_0x2e9674,_0x4c30a5){_0x4c30a5=_0x4c30a5||0xcc;return function(_0x3a58cc){if(_0x3a58cc){return _0x2e9674[_0x308c('0x1a')](_0x4c30a5);}return _0x2e9674[_0x308c('0x1b')](_0x4c30a5)[_0x308c('0x1c')]();};}function respondWithResult(_0x56a1b7,_0x1cbfae){_0x1cbfae=_0x1cbfae||0xc8;return function(_0xde9d0c){if(_0xde9d0c){return _0x56a1b7[_0x308c('0x1b')](_0x1cbfae)[_0x308c('0x1d')](_0xde9d0c);}};}function respondWithFilteredResult(_0x2c7d34,_0x551e77){return function(_0x3b9d8c){if(_0x3b9d8c){var _0x55c363=typeof _0x551e77['offset']===_0x308c('0x1e')&&typeof _0x551e77[_0x308c('0x1f')]===_0x308c('0x1e');var _0x509dee=_0x3b9d8c[_0x308c('0x20')];var _0x3ad731=_0x55c363?0x0:_0x551e77[_0x308c('0x21')];var _0x56b495=_0x55c363?_0x3b9d8c[_0x308c('0x20')]:_0x551e77['offset']+_0x551e77['limit'];var _0x24bd9b;if(_0x56b495>=_0x509dee){_0x56b495=_0x509dee;_0x24bd9b=0xc8;}else{_0x24bd9b=0xce;}_0x2c7d34[_0x308c('0x1b')](_0x24bd9b);return _0x2c7d34[_0x308c('0x22')]('Content-Range',_0x3ad731+'-'+_0x56b495+'/'+_0x509dee)[_0x308c('0x1d')](_0x3b9d8c);}return null;};}function patchUpdates(_0x3ffcce){return function(_0x1abfdb){try{jsonpatch['apply'](_0x1abfdb,_0x3ffcce,!![]);}catch(_0x537be3){return BPromise[_0x308c('0x23')](_0x537be3);}return _0x1abfdb[_0x308c('0x24')]();};}function saveUpdates(_0x498e44,_0x42a833){return function(_0x47a5f9){if(_0x47a5f9){return _0x47a5f9[_0x308c('0x25')](_0x498e44)[_0x308c('0x26')](function(_0x3e18b1){return _0x3e18b1;});}return null;};}function removeEntity(_0x499eaf,_0x1bc34a){return function(_0x2bbe63){if(_0x2bbe63){return _0x2bbe63[_0x308c('0x27')]()['then'](function(){_0x499eaf['status'](0xcc)[_0x308c('0x1c')]();});}};}function handleEntityNotFound(_0x3dfe1e,_0x2b68bf){return function(_0x954bac){if(!_0x954bac){_0x3dfe1e['sendStatus'](0x194);}return _0x954bac;};}function handleError(_0x35ce5e,_0x72f758){_0x72f758=_0x72f758||0x1f4;return function(_0x5943a0){logger[_0x308c('0x28')](_0x5943a0[_0x308c('0x29')]);if(_0x5943a0[_0x308c('0x2a')]){delete _0x5943a0[_0x308c('0x2a')];}_0x35ce5e[_0x308c('0x1b')](_0x72f758)[_0x308c('0x2b')](_0x5943a0);};}exports[_0x308c('0x2c')]=function(_0x14315d,_0x1eade2){var _0x5c6756={},_0x2c7f80={},_0x296516={'count':0x0,'rows':[]};var _0x18a340=_[_0x308c('0x2d')](db[_0x308c('0x2e')][_0x308c('0x2f')],function(_0x1c8673){return{'name':_0x1c8673['fieldName'],'type':_0x1c8673[_0x308c('0x30')][_0x308c('0x31')]};});_0x2c7f80[_0x308c('0x32')]=_['map'](_0x18a340,'name');_0x2c7f80[_0x308c('0x33')]=_['keys'](_0x14315d[_0x308c('0x33')]);_0x2c7f80[_0x308c('0x34')]=_[_0x308c('0x35')](_0x2c7f80[_0x308c('0x32')],_0x2c7f80[_0x308c('0x33')]);_0x5c6756[_0x308c('0x36')]=_[_0x308c('0x35')](_0x2c7f80[_0x308c('0x32')],qs[_0x308c('0x37')](_0x14315d[_0x308c('0x33')][_0x308c('0x37')]));_0x5c6756[_0x308c('0x36')]=_0x5c6756['attributes']['length']?_0x5c6756[_0x308c('0x36')]:_0x2c7f80[_0x308c('0x32')];if(!_0x14315d[_0x308c('0x33')][_0x308c('0x38')](_0x308c('0x39'))){_0x5c6756[_0x308c('0x1f')]=qs[_0x308c('0x1f')](_0x14315d[_0x308c('0x33')][_0x308c('0x1f')]);_0x5c6756[_0x308c('0x21')]=qs['offset'](_0x14315d[_0x308c('0x33')]['offset']);}_0x5c6756['order']=qs[_0x308c('0x3a')](_0x14315d[_0x308c('0x33')][_0x308c('0x3a')]);_0x5c6756[_0x308c('0x3b')]=qs[_0x308c('0x34')](_['pick'](_0x14315d['query'],_0x2c7f80[_0x308c('0x34')]),_0x18a340);if(_0x14315d['query']['filter']){_0x5c6756['where']=_['merge'](_0x5c6756['where'],{'$or':_[_0x308c('0x2d')](_0x18a340,function(_0x1228fb){if(_0x1228fb[_0x308c('0x30')]!==_0x308c('0x3c')){var _0x3bc158={};_0x3bc158[_0x1228fb['name']]={'$like':'%'+_0x14315d['query'][_0x308c('0x3d')]+'%'};return _0x3bc158;}})});}_0x5c6756=_['merge']({},_0x5c6756,_0x14315d[_0x308c('0x3e')]);var _0x229091={'where':_0x5c6756[_0x308c('0x3b')]};return db[_0x308c('0x2e')][_0x308c('0x20')](_0x229091)[_0x308c('0x26')](function(_0x3645a4){_0x296516['count']=_0x3645a4;if(_0x14315d[_0x308c('0x33')][_0x308c('0x3f')]){_0x5c6756['include']=[{'all':!![]}];}return db[_0x308c('0x2e')][_0x308c('0x40')](_0x5c6756);})[_0x308c('0x26')](function(_0x381af1){_0x296516['rows']=_0x381af1;return _0x296516;})[_0x308c('0x26')](respondWithFilteredResult(_0x1eade2,_0x5c6756))[_0x308c('0x41')](handleError(_0x1eade2,null));};exports[_0x308c('0x42')]=function(_0x1348d3,_0x751bf6){var _0x57579e={'raw':![],'where':{'id':_0x1348d3['params']['id']}},_0xf75bc6={};_0xf75bc6[_0x308c('0x32')]=_[_0x308c('0x43')](db[_0x308c('0x2e')][_0x308c('0x2f')]);_0xf75bc6[_0x308c('0x33')]=_[_0x308c('0x43')](_0x1348d3['query']);_0xf75bc6[_0x308c('0x34')]=_[_0x308c('0x35')](_0xf75bc6[_0x308c('0x32')],_0xf75bc6[_0x308c('0x33')]);_0x57579e[_0x308c('0x36')]=_[_0x308c('0x35')](_0xf75bc6[_0x308c('0x32')],qs[_0x308c('0x37')](_0x1348d3[_0x308c('0x33')][_0x308c('0x37')]));_0x57579e[_0x308c('0x36')]=_0x57579e[_0x308c('0x36')]['length']?_0x57579e[_0x308c('0x36')]:_0xf75bc6[_0x308c('0x32')];if(_0x1348d3['query'][_0x308c('0x3f')]){_0x57579e['include']=[{'all':!![]}];}_0x57579e=_['merge']({},_0x57579e,_0x1348d3[_0x308c('0x3e')]);return db['VoiceQueueReport'][_0x308c('0x44')](_0x57579e)[_0x308c('0x26')](handleEntityNotFound(_0x751bf6,null))[_0x308c('0x26')](respondWithResult(_0x751bf6,null))[_0x308c('0x41')](handleError(_0x751bf6,null));};exports[_0x308c('0x45')]=function(_0x2343b2,_0x50025a){return db['VoiceQueueReport'][_0x308c('0x45')](_0x2343b2[_0x308c('0x46')],{})[_0x308c('0x26')](respondWithResult(_0x50025a,0xc9))['catch'](handleError(_0x50025a,null));};exports[_0x308c('0x25')]=function(_0x139957,_0x3237c1){if(_0x139957[_0x308c('0x46')]['id']){delete _0x139957['body']['id'];}return db[_0x308c('0x2e')][_0x308c('0x44')]({'where':{'id':_0x139957[_0x308c('0x47')]['id']}})[_0x308c('0x26')](handleEntityNotFound(_0x3237c1,null))[_0x308c('0x26')](saveUpdates(_0x139957[_0x308c('0x46')],null))[_0x308c('0x26')](respondWithResult(_0x3237c1,null))[_0x308c('0x41')](handleError(_0x3237c1,null));};exports[_0x308c('0x27')]=function(_0x598b9a,_0x393059){return db[_0x308c('0x2e')][_0x308c('0x44')]({'where':{'id':_0x598b9a[_0x308c('0x47')]['id']}})['then'](handleEntityNotFound(_0x393059,null))[_0x308c('0x26')](removeEntity(_0x393059,null))[_0x308c('0x41')](handleError(_0x393059,null));};exports[_0x308c('0x48')]=function(_0x589684,_0x507701){return db['VoiceQueueReport']['describe']()[_0x308c('0x26')](respondWithResult(_0x507701,null))[_0x308c('0x41')](handleError(_0x507701,null));};exports[_0x308c('0x49')]=function(_0x2bbb79,_0x4f72aa){var _0x1a2282={},_0x49c627={},_0x2f4698={'count':0x0,'rows':[]};_0x49c627[_0x308c('0x32')]=_[_0x308c('0x43')](db[_0x308c('0x2e')][_0x308c('0x2f')]);_0x49c627[_0x308c('0x33')]=_[_0x308c('0x43')](_0x2bbb79[_0x308c('0x33')]);_0x49c627[_0x308c('0x34')]=_[_0x308c('0x35')](_0x49c627['model'],_0x49c627[_0x308c('0x33')]);_0x1a2282[_0x308c('0x36')]=_[_0x308c('0x35')](_0x49c627[_0x308c('0x32')],qs[_0x308c('0x37')](_0x2bbb79['query'][_0x308c('0x37')]));_0x1a2282[_0x308c('0x36')]=_0x1a2282[_0x308c('0x36')][_0x308c('0x4a')]?_0x1a2282['attributes']:_0x49c627[_0x308c('0x32')];if(!_0x2bbb79['query'][_0x308c('0x38')](_0x308c('0x39'))){_0x1a2282[_0x308c('0x1f')]=qs[_0x308c('0x1f')](_0x2bbb79['query']['limit']);_0x1a2282[_0x308c('0x21')]=qs[_0x308c('0x21')](_0x2bbb79[_0x308c('0x33')][_0x308c('0x21')]);}_0x1a2282['order']=qs[_0x308c('0x3a')](_0x2bbb79[_0x308c('0x33')]['sort']);_0x1a2282[_0x308c('0x3b')]=qs[_0x308c('0x34')](_[_0x308c('0x4b')](_0x2bbb79['query'],_0x49c627[_0x308c('0x34')]));if(_0x2bbb79[_0x308c('0x33')]['filter']){_0x1a2282[_0x308c('0x3b')]=_[_0x308c('0x4c')](_0x1a2282[_0x308c('0x3b')],{'$or':_[_0x308c('0x2d')](_0x1a2282[_0x308c('0x36')],function(_0x4621c0){var _0x186e97={};_0x186e97[_0x4621c0]={'$like':'%'+_0x2bbb79[_0x308c('0x33')]['filter']+'%'};return _0x186e97;})});}_0x1a2282=_[_0x308c('0x4c')]({},_0x1a2282,_0x2bbb79[_0x308c('0x3e')]);var _0x1aa62d={'where':_0x1a2282['where']};return db['VoiceQueueReport'][_0x308c('0x20')](_0x1aa62d)[_0x308c('0x26')](function(_0x13afc9){_0x2f4698[_0x308c('0x20')]=_0x13afc9;if(_0x2bbb79['query']['includeAll']){_0x1a2282[_0x308c('0x4d')]=[{'all':!![]}];}return db[_0x308c('0x2e')][_0x308c('0x40')](_0x1a2282);})['then'](function(_0x87c46d){_0x2f4698[_0x308c('0x4e')]=_0x87c46d;return _0x2f4698;})['then'](respondWithFilteredResult(_0x4f72aa,_0x1a2282,'getVoiceQueuesReport'))[_0x308c('0x41')](handleError(_0x4f72aa,null,_0x308c('0x49')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 5b78862..483993e 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 _0xfa72=['../../mysqldb','VoiceQueueReport','setMaxListeners','save','emit','hook','events'];(function(_0x2f35ec,_0x2d2b6c){var _0xc8b618=function(_0x452a3a){while(--_0x452a3a){_0x2f35ec['push'](_0x2f35ec['shift']());}};_0xc8b618(++_0x2d2b6c);}(_0xfa72,0xbc));var _0x2fa7=function(_0x9c8898,_0x14987c){_0x9c8898=_0x9c8898-0x0;var _0x5d84ed=_0xfa72[_0x9c8898];return _0x5d84ed;};'use strict';var EventEmitter=require(_0x2fa7('0x0'));var VoiceQueueReport=require(_0x2fa7('0x1'))['db'][_0x2fa7('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x2fa7('0x3')](0x0);var events={'afterCreate':_0x2fa7('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2475a2){return function(_0x13790d,_0x78145c,_0x1fe46a){VoiceQueueReportEvents['emit'](_0x2475a2+':'+_0x13790d['id'],_0x13790d);VoiceQueueReportEvents[_0x2fa7('0x5')](_0x2475a2,_0x13790d);_0x1fe46a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x2fa7('0x6')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0xbb11=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','VoiceQueueReport'];(function(_0x32cc4d,_0x4a5e15){var _0xaa5ab0=function(_0x762a8d){while(--_0x762a8d){_0x32cc4d['push'](_0x32cc4d['shift']());}};_0xaa5ab0(++_0x4a5e15);}(_0xbb11,0x1d3));var _0x1bb1=function(_0x4d0e35,_0x3916de){_0x4d0e35=_0x4d0e35-0x0;var _0x2b22c3=_0xbb11[_0x4d0e35];return _0x2b22c3;};'use strict';var EventEmitter=require(_0x1bb1('0x0'));var VoiceQueueReport=require(_0x1bb1('0x1'))['db'][_0x1bb1('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x1bb1('0x3')](0x0);var events={'afterCreate':_0x1bb1('0x4'),'afterUpdate':_0x1bb1('0x5'),'afterDestroy':_0x1bb1('0x6')};function emitEvent(_0x21e20c){return function(_0x5cb5dc,_0x58f51c,_0x5524b9){VoiceQueueReportEvents[_0x1bb1('0x7')](_0x21e20c+':'+_0x5cb5dc['id'],_0x5cb5dc);VoiceQueueReportEvents[_0x1bb1('0x7')](_0x21e20c,_0x5cb5dc);_0x5524b9(null);};}for(var e in events){if(events[_0x1bb1('0x8')](e)){var event=events[e];VoiceQueueReport[_0x1bb1('0x9')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 67106c6..a28b210 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 _0x861c=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','VoiceQueueReport','report_queue','uniqueid','calleridnum'];(function(_0x49e59c,_0x37ec1f){var _0x34240e=function(_0x3f7a16){while(--_0x3f7a16){_0x49e59c['push'](_0x49e59c['shift']());}};_0x34240e(++_0x37ec1f);}(_0x861c,0x1c0));var _0xc861=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x861c[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0xc861('0x0'));var logger=require(_0xc861('0x1'))(_0xc861('0x2'));var moment=require(_0xc861('0x3'));var BPromise=require(_0xc861('0x4'));var rp=require(_0xc861('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc861('0x6'));var config=require(_0xc861('0x7'));var attributes=require(_0xc861('0x8'));module[_0xc861('0x9')]=function(_0x4445b0,_0x540084){return _0x4445b0['define'](_0xc861('0xa'),attributes,{'tableName':_0xc861('0xb'),'paranoid':![],'indexes':[{'fields':[_0xc861('0xc')]},{'fields':[_0xc861('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe9fd=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','VoiceQueueReport','report_queue','calleridnum','lodash','../../config/logger','api','moment'];(function(_0x21b4cf,_0x4ffd5f){var _0x560093=function(_0x12ea2e){while(--_0x12ea2e){_0x21b4cf['push'](_0x21b4cf['shift']());}};_0x560093(++_0x4ffd5f);}(_0xe9fd,0x14e));var _0xde9f=function(_0x2aadb9,_0x4d0705){_0x2aadb9=_0x2aadb9-0x0;var _0x2dc9b6=_0xe9fd[_0x2aadb9];return _0x2dc9b6;};'use strict';var _=require(_0xde9f('0x0'));var util=require('util');var logger=require(_0xde9f('0x1'))(_0xde9f('0x2'));var moment=require(_0xde9f('0x3'));var BPromise=require(_0xde9f('0x4'));var rp=require(_0xde9f('0x5'));var fs=require('fs');var path=require(_0xde9f('0x6'));var rimraf=require(_0xde9f('0x7'));var config=require(_0xde9f('0x8'));var attributes=require(_0xde9f('0x9'));module['exports']=function(_0x478562,_0x22ec51){return _0x478562['define'](_0xde9f('0xa'),attributes,{'tableName':_0xde9f('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0xde9f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 7d026ab..337da0b 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 _0x9dfc=['body','UpdateVoiceQueueReport','update','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','request','then','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','include','map','model','CreateVoiceQueueReport','create'];(function(_0x4459b8,_0x3271b8){var _0x4a4b07=function(_0x3075f8){while(--_0x3075f8){_0x4459b8['push'](_0x4459b8['shift']());}};_0x4a4b07(++_0x3271b8);}(_0x9dfc,0xda));var _0xc9df=function(_0x1ae6f8,_0x29a90b){_0x1ae6f8=_0x1ae6f8-0x0;var _0x2bff39=_0x9dfc[_0x1ae6f8];return _0x2bff39;};'use strict';var _=require(_0xc9df('0x0'));var util=require(_0xc9df('0x1'));var moment=require(_0xc9df('0x2'));var BPromise=require('bluebird');var rs=require(_0xc9df('0x3'));var fs=require('fs');var Redis=require(_0xc9df('0x4'));var db=require(_0xc9df('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc9df('0x6'));var config=require(_0xc9df('0x7'));var jayson=require(_0xc9df('0x8'));var client=jayson[_0xc9df('0x9')][_0xc9df('0xa')]({'port':0x232a});config[_0xc9df('0xb')]=_['defaults'](config[_0xc9df('0xb')],{'host':_0xc9df('0xc'),'port':0x18eb});var socket=require(_0xc9df('0xd'))(new Redis(config['redis']));require(_0xc9df('0xe'))['register'](socket);function respondWithRpcPromise(_0x16603f,_0x181324,_0x496e5b){return new BPromise(function(_0x1fab74,_0x4445ec){return client[_0xc9df('0xf')](_0x16603f,_0x496e5b)[_0xc9df('0x10')](function(_0x3e3c66){logger['info'](_0xc9df('0x11'),_0x181324,'request\x20sent');logger[_0xc9df('0x12')](_0xc9df('0x13'),_0x181324,_0xc9df('0x14'),JSON[_0xc9df('0x15')](_0x3e3c66));if(_0x3e3c66['error']){if(_0x3e3c66[_0xc9df('0x16')][_0xc9df('0x17')]===0x1f4){logger[_0xc9df('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x181324,_0x3e3c66[_0xc9df('0x16')][_0xc9df('0x18')]);return _0x4445ec(_0x3e3c66['error'][_0xc9df('0x18')]);}logger[_0xc9df('0x16')](_0xc9df('0x11'),_0x181324,_0x3e3c66[_0xc9df('0x16')]['message']);return _0x1fab74(_0x3e3c66['error'][_0xc9df('0x18')]);}else{logger[_0xc9df('0x19')]('VoiceQueueReport,\x20%s,\x20%s',_0x181324,'request\x20sent');_0x1fab74(_0x3e3c66[_0xc9df('0x1a')][_0xc9df('0x18')]);}})[_0xc9df('0x1b')](function(_0x13ed1c){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x181324,_0x13ed1c);_0x4445ec(_0x13ed1c);});});}exports[_0xc9df('0x1c')]=function(_0x22226e){var _0x3c50a2=this;return new Promise(function(_0x19e1c4,_0x4694f8){return db[_0xc9df('0x1d')][_0xc9df('0x1e')]({'raw':_0x22226e[_0xc9df('0x1f')]?_0x22226e['options'][_0xc9df('0x20')]===undefined?!![]:![]:!![],'where':_0x22226e[_0xc9df('0x1f')]?_0x22226e[_0xc9df('0x1f')][_0xc9df('0x21')]||null:null,'attributes':_0x22226e['options']?_0x22226e['options'][_0xc9df('0x22')]||null:null,'limit':_0x22226e[_0xc9df('0x1f')]?_0x22226e[_0xc9df('0x1f')]['limit']||null:null,'include':_0x22226e[_0xc9df('0x1f')]?_0x22226e[_0xc9df('0x1f')][_0xc9df('0x23')]?_[_0xc9df('0x24')](_0x22226e[_0xc9df('0x1f')][_0xc9df('0x23')],function(_0xcb843d){return{'model':db[_0xcb843d[_0xc9df('0x25')]],'as':_0xcb843d['as'],'attributes':_0xcb843d[_0xc9df('0x22')],'include':_0xcb843d[_0xc9df('0x23')]?_['map'](_0xcb843d[_0xc9df('0x23')],function(_0x24f95c){return{'model':db[_0x24f95c[_0xc9df('0x25')]],'as':_0x24f95c['as'],'attributes':_0x24f95c['attributes'],'include':_0x24f95c[_0xc9df('0x23')]?_['map'](_0x24f95c[_0xc9df('0x23')],function(_0x408b70){return{'model':db[_0x408b70['model']],'as':_0x408b70['as'],'attributes':_0x408b70[_0xc9df('0x22')]};}):[]};}):[]};}):[]:[]})[_0xc9df('0x10')](function(_0x50b924){logger[_0xc9df('0x19')](_0xc9df('0x1c'),_0x22226e);logger[_0xc9df('0x12')](_0xc9df('0x1c'),_0x22226e,JSON['stringify'](_0x50b924));_0x19e1c4(_0x50b924);})['catch'](function(_0x23ab1b){logger['error']('GetVoiceQueueReport',_0x23ab1b[_0xc9df('0x18')],_0x22226e);_0x4694f8(_0x3c50a2[_0xc9df('0x16')](0x1f4,_0x23ab1b[_0xc9df('0x18')]));});});};exports[_0xc9df('0x26')]=function(_0xb7edd3){var _0x186776=this;return new Promise(function(_0x15b05c,_0x5cee12){return db[_0xc9df('0x1d')][_0xc9df('0x27')](_0xb7edd3[_0xc9df('0x28')],{'raw':_0xb7edd3[_0xc9df('0x1f')]?_0xb7edd3[_0xc9df('0x1f')][_0xc9df('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2f675b){logger[_0xc9df('0x19')](_0xc9df('0x26'),_0xb7edd3);logger[_0xc9df('0x12')]('CreateVoiceQueueReport',_0xb7edd3,JSON['stringify'](_0x2f675b));_0x15b05c(_0x2f675b);})[_0xc9df('0x1b')](function(_0xab1c37){logger['error'](_0xc9df('0x26'),_0xab1c37[_0xc9df('0x18')],_0xb7edd3);_0x5cee12(_0x186776[_0xc9df('0x16')](0x1f4,_0xab1c37['message']));});});};exports[_0xc9df('0x29')]=function(_0x3b20d0){var _0x57def3=this;return new Promise(function(_0x118fbf,_0x2b7e25){return db[_0xc9df('0x1d')][_0xc9df('0x2a')](_0x3b20d0[_0xc9df('0x28')],{'raw':_0x3b20d0[_0xc9df('0x1f')]?_0x3b20d0[_0xc9df('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b20d0[_0xc9df('0x1f')]?_0x3b20d0[_0xc9df('0x1f')][_0xc9df('0x21')]||null:null,'attributes':_0x3b20d0[_0xc9df('0x1f')]?_0x3b20d0[_0xc9df('0x1f')][_0xc9df('0x22')]||null:null,'limit':_0x3b20d0['options']?_0x3b20d0['options']['limit']||null:null})[_0xc9df('0x10')](function(_0x18c53d){logger[_0xc9df('0x19')]('UpdateVoiceQueueReport',_0x3b20d0);logger[_0xc9df('0x12')](_0xc9df('0x29'),_0x3b20d0,JSON[_0xc9df('0x15')](_0x18c53d));_0x118fbf(_0x18c53d);})[_0xc9df('0x1b')](function(_0x5c6713){logger[_0xc9df('0x16')](_0xc9df('0x29'),_0x5c6713[_0xc9df('0x18')],_0x3b20d0);_0x2b7e25(_0x57def3['error'](0x1f4,_0x5c6713[_0xc9df('0x18')]));});});}; \ No newline at end of file +var _0x1f88=['localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','where','attributes','limit','map','model','include','stringify','CreateVoiceQueueReport','raw','UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis'];(function(_0x4ee698,_0x4b588f){var _0x503343=function(_0x385a5){while(--_0x385a5){_0x4ee698['push'](_0x4ee698['shift']());}};_0x503343(++_0x4b588f);}(_0x1f88,0x1b6));var _0x81f8=function(_0x113c2a,_0x3a5d1e){_0x113c2a=_0x113c2a-0x0;var _0x34cea6=_0x1f88[_0x113c2a];return _0x34cea6;};'use strict';var _=require(_0x81f8('0x0'));var util=require(_0x81f8('0x1'));var moment=require(_0x81f8('0x2'));var BPromise=require(_0x81f8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x81f8('0x4'));var db=require(_0x81f8('0x5'))['db'];var utils=require(_0x81f8('0x6'));var logger=require(_0x81f8('0x7'))(_0x81f8('0x8'));var config=require(_0x81f8('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x81f8('0xa')][_0x81f8('0xb')]({'port':0x232a});config[_0x81f8('0xc')]=_['defaults'](config[_0x81f8('0xc')],{'host':_0x81f8('0xd'),'port':0x18eb});var socket=require(_0x81f8('0xe'))(new Redis(config[_0x81f8('0xc')]));require(_0x81f8('0xf'))[_0x81f8('0x10')](socket);function respondWithRpcPromise(_0x432829,_0xf4751b,_0x190823){return new BPromise(function(_0x1dd01a,_0x40f484){return client[_0x81f8('0x11')](_0x432829,_0x190823)[_0x81f8('0x12')](function(_0x2fe7ff){logger[_0x81f8('0x13')](_0x81f8('0x14'),_0xf4751b,_0x81f8('0x15'));logger[_0x81f8('0x16')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0xf4751b,'request\x20sent',JSON['stringify'](_0x2fe7ff));if(_0x2fe7ff[_0x81f8('0x17')]){if(_0x2fe7ff[_0x81f8('0x17')]['code']===0x1f4){logger['error'](_0x81f8('0x14'),_0xf4751b,_0x2fe7ff[_0x81f8('0x17')][_0x81f8('0x18')]);return _0x40f484(_0x2fe7ff[_0x81f8('0x17')][_0x81f8('0x18')]);}logger[_0x81f8('0x17')](_0x81f8('0x14'),_0xf4751b,_0x2fe7ff[_0x81f8('0x17')]['message']);return _0x1dd01a(_0x2fe7ff[_0x81f8('0x17')]['message']);}else{logger[_0x81f8('0x13')]('VoiceQueueReport,\x20%s,\x20%s',_0xf4751b,_0x81f8('0x15'));_0x1dd01a(_0x2fe7ff['result'][_0x81f8('0x18')]);}})[_0x81f8('0x19')](function(_0x58d89f){logger[_0x81f8('0x17')](_0x81f8('0x14'),_0xf4751b,_0x58d89f);_0x40f484(_0x58d89f);});});}exports[_0x81f8('0x1a')]=function(_0x5eef89){var _0x3f3b5f=this;return new Promise(function(_0x4aa6ee,_0x1f1607){return db[_0x81f8('0x1b')][_0x81f8('0x1c')]({'raw':_0x5eef89['options']?_0x5eef89[_0x81f8('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5eef89[_0x81f8('0x1d')]?_0x5eef89[_0x81f8('0x1d')][_0x81f8('0x1e')]||null:null,'attributes':_0x5eef89[_0x81f8('0x1d')]?_0x5eef89[_0x81f8('0x1d')][_0x81f8('0x1f')]||null:null,'limit':_0x5eef89[_0x81f8('0x1d')]?_0x5eef89[_0x81f8('0x1d')][_0x81f8('0x20')]||null:null,'include':_0x5eef89['options']?_0x5eef89[_0x81f8('0x1d')]['include']?_[_0x81f8('0x21')](_0x5eef89['options']['include'],function(_0x399998){return{'model':db[_0x399998[_0x81f8('0x22')]],'as':_0x399998['as'],'attributes':_0x399998[_0x81f8('0x1f')],'include':_0x399998['include']?_[_0x81f8('0x21')](_0x399998[_0x81f8('0x23')],function(_0x23d1bd){return{'model':db[_0x23d1bd[_0x81f8('0x22')]],'as':_0x23d1bd['as'],'attributes':_0x23d1bd['attributes'],'include':_0x23d1bd[_0x81f8('0x23')]?_[_0x81f8('0x21')](_0x23d1bd['include'],function(_0xb58630){return{'model':db[_0xb58630[_0x81f8('0x22')]],'as':_0xb58630['as'],'attributes':_0xb58630[_0x81f8('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x81f8('0x12')](function(_0x19614e){logger[_0x81f8('0x13')](_0x81f8('0x1a'),_0x5eef89);logger[_0x81f8('0x16')](_0x81f8('0x1a'),_0x5eef89,JSON[_0x81f8('0x24')](_0x19614e));_0x4aa6ee(_0x19614e);})['catch'](function(_0x33fe51){logger[_0x81f8('0x17')](_0x81f8('0x1a'),_0x33fe51[_0x81f8('0x18')],_0x5eef89);_0x1f1607(_0x3f3b5f[_0x81f8('0x17')](0x1f4,_0x33fe51[_0x81f8('0x18')]));});});};exports[_0x81f8('0x25')]=function(_0x114643){var _0x324f19=this;return new Promise(function(_0x16072f,_0x597a02){return db['VoiceQueueReport']['create'](_0x114643['body'],{'raw':_0x114643[_0x81f8('0x1d')]?_0x114643[_0x81f8('0x1d')][_0x81f8('0x26')]===undefined?!![]:![]:!![]})[_0x81f8('0x12')](function(_0x1da059){logger[_0x81f8('0x13')](_0x81f8('0x25'),_0x114643);logger[_0x81f8('0x16')](_0x81f8('0x25'),_0x114643,JSON['stringify'](_0x1da059));_0x16072f(_0x1da059);})['catch'](function(_0x43c043){logger[_0x81f8('0x17')](_0x81f8('0x25'),_0x43c043[_0x81f8('0x18')],_0x114643);_0x597a02(_0x324f19[_0x81f8('0x17')](0x1f4,_0x43c043[_0x81f8('0x18')]));});});};exports[_0x81f8('0x27')]=function(_0x4d40fd){var _0x38623f=this;return new Promise(function(_0x525721,_0x50476d){return db[_0x81f8('0x1b')][_0x81f8('0x28')](_0x4d40fd['body'],{'raw':_0x4d40fd[_0x81f8('0x1d')]?_0x4d40fd['options'][_0x81f8('0x26')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d40fd[_0x81f8('0x1d')]?_0x4d40fd[_0x81f8('0x1d')]['where']||null:null,'attributes':_0x4d40fd['options']?_0x4d40fd[_0x81f8('0x1d')][_0x81f8('0x1f')]||null:null,'limit':_0x4d40fd[_0x81f8('0x1d')]?_0x4d40fd[_0x81f8('0x1d')]['limit']||null:null})[_0x81f8('0x12')](function(_0xfafa61){logger[_0x81f8('0x13')](_0x81f8('0x27'),_0x4d40fd);logger[_0x81f8('0x16')](_0x81f8('0x27'),_0x4d40fd,JSON[_0x81f8('0x24')](_0xfafa61));_0x525721(_0xfafa61);})['catch'](function(_0x1874c7){logger['error'](_0x81f8('0x27'),_0x1874c7[_0x81f8('0x18')],_0x4d40fd);_0x50476d(_0x38623f[_0x81f8('0x17')](0x1f4,_0x1874c7[_0x81f8('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index b51a360..d5b74bd 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 _0xa2d7=['length','./voiceQueueReport.events','save','remove','emit','removeListener','register'];(function(_0x324012,_0x23f45f){var _0x435cf2=function(_0x378a82){while(--_0x378a82){_0x324012['push'](_0x324012['shift']());}};_0x435cf2(++_0x23f45f);}(_0xa2d7,0x1ba));var _0x7a2d=function(_0x7c1523,_0x2aac09){_0x7c1523=_0x7c1523-0x0;var _0x4e7026=_0xa2d7[_0x7c1523];return _0x4e7026;};'use strict';var VoiceQueueReportEvents=require(_0x7a2d('0x0'));var events=[_0x7a2d('0x1'),_0x7a2d('0x2'),'update'];function createListener(_0x55e1aa,_0x38b15d){return function(_0x28a5ab){_0x38b15d[_0x7a2d('0x3')](_0x55e1aa,_0x28a5ab);};}function removeListener(_0x1f517d,_0x57b3fd){return function(){VoiceQueueReportEvents[_0x7a2d('0x4')](_0x1f517d,_0x57b3fd);};}exports[_0x7a2d('0x5')]=function(_0x33e10e){for(var _0x114a51=0x0,_0x5c5c77=events[_0x7a2d('0x6')];_0x114a51<_0x5c5c77;_0x114a51++){var _0x2dfdc9=events[_0x114a51];var _0x3889a2=createListener('voiceQueueReport:'+_0x2dfdc9,_0x33e10e);VoiceQueueReportEvents['on'](_0x2dfdc9,_0x3889a2);}}; \ No newline at end of file +var _0x16a7=['register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update','emit','removeListener'];(function(_0x819b1,_0x25ca36){var _0x15aa26=function(_0x51cee8){while(--_0x51cee8){_0x819b1['push'](_0x819b1['shift']());}};_0x15aa26(++_0x25ca36);}(_0x16a7,0xa5));var _0x716a=function(_0x3fbc70,_0x2fd217){_0x3fbc70=_0x3fbc70-0x0;var _0x5d3e11=_0x16a7[_0x3fbc70];return _0x5d3e11;};'use strict';var VoiceQueueReportEvents=require(_0x716a('0x0'));var events=[_0x716a('0x1'),_0x716a('0x2'),_0x716a('0x3')];function createListener(_0x4aa23e,_0x4d0520){return function(_0x437ff8){_0x4d0520[_0x716a('0x4')](_0x4aa23e,_0x437ff8);};}function removeListener(_0x56d122,_0x128002){return function(){VoiceQueueReportEvents[_0x716a('0x5')](_0x56d122,_0x128002);};}exports[_0x716a('0x6')]=function(_0x68977a){for(var _0x22b026=0x0,_0x557d05=events[_0x716a('0x7')];_0x22b026<_0x557d05;_0x22b026++){var _0x1ee0e2=events[_0x22b026];var _0x724309=createListener(_0x716a('0x8')+_0x1ee0e2,_0x68977a);VoiceQueueReportEvents['on'](_0x1ee0e2,_0x724309);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 5bd7c5d..bad6603 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 _0xdff8=['update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','put'];(function(_0x329dd0,_0x47e04f){var _0x4f5b90=function(_0x7d2728){while(--_0x7d2728){_0x329dd0['push'](_0x329dd0['shift']());}};_0x4f5b90(++_0x47e04f);}(_0xdff8,0x159));var _0x8dff=function(_0x2e81c9,_0x15a07c){_0x2e81c9=_0x2e81c9-0x0;var _0x217cf2=_0xdff8[_0x2e81c9];return _0x217cf2;};'use strict';var multer=require(_0x8dff('0x0'));var util=require(_0x8dff('0x1'));var path=require(_0x8dff('0x2'));var timeout=require(_0x8dff('0x3'));var express=require(_0x8dff('0x4'));var router=express['Router']();var fs_extra=require(_0x8dff('0x5'));var auth=require(_0x8dff('0x6'));var interaction=require(_0x8dff('0x7'));var config=require(_0x8dff('0x8'));var controller=require(_0x8dff('0x9'));router[_0x8dff('0xa')]('/',auth[_0x8dff('0xb')](),controller[_0x8dff('0xc')]);router[_0x8dff('0xa')](_0x8dff('0xd'),auth[_0x8dff('0xb')](),controller[_0x8dff('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x8dff('0xf')](_0x8dff('0xd'),auth['isAuthenticated'](),controller[_0x8dff('0x10')]);router['delete'](_0x8dff('0xd'),auth[_0x8dff('0xb')](),controller[_0x8dff('0x11')]);module[_0x8dff('0x12')]=router; \ No newline at end of file +var _0xb37f=['util','path','Router','fs-extra','../../config/environment','./voiceQueuesLog.controller','index','get','/:id','isAuthenticated','post','create','update','delete','destroy'];(function(_0x19115e,_0x507bab){var _0x45bbd4=function(_0x1308bf){while(--_0x1308bf){_0x19115e['push'](_0x19115e['shift']());}};_0x45bbd4(++_0x507bab);}(_0xb37f,0x1ef));var _0xfb37=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0xb37f[_0x486f4a];return _0x135d99;};'use strict';var multer=require('multer');var util=require(_0xfb37('0x0'));var path=require(_0xfb37('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfb37('0x2')]();var fs_extra=require(_0xfb37('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfb37('0x4'));var controller=require(_0xfb37('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xfb37('0x6')]);router[_0xfb37('0x7')](_0xfb37('0x8'),auth[_0xfb37('0x9')](),controller['show']);router[_0xfb37('0xa')]('/',auth[_0xfb37('0x9')](),controller[_0xfb37('0xb')]);router['put'](_0xfb37('0x8'),auth[_0xfb37('0x9')](),controller[_0xfb37('0xc')]);router[_0xfb37('0xd')]('/:id',auth[_0xfb37('0x9')](),controller[_0xfb37('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 38cb745..8b6b068 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 _0x4775=['STRING','DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment','exports'];(function(_0x475450,_0x13844b){var _0x29c425=function(_0x9188e6){while(--_0x9188e6){_0x475450['push'](_0x475450['shift']());}};_0x29c425(++_0x13844b);}(_0x4775,0x170));var _0x5477=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0x4775[_0x616290];return _0x453879;};'use strict';var Sequelize=require(_0x5477('0x0'));var moment=require(_0x5477('0x1'));module[_0x5477('0x2')]={'time':{'type':Sequelize[_0x5477('0x3')]},'callid':{'type':Sequelize[_0x5477('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x5477('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x5477('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x5477('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x5477('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x5477('0x5')](_0x5477('0x6'))}}; \ No newline at end of file +var _0xb81c=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment','exports','STRING','literal'];(function(_0x483087,_0xf15c10){var _0x26ec35=function(_0x4e3d89){while(--_0x4e3d89){_0x483087['push'](_0x483087['shift']());}};_0x26ec35(++_0xf15c10);}(_0xb81c,0x79));var _0xcb81=function(_0x3c87f0,_0x2181d8){_0x3c87f0=_0x3c87f0-0x0;var _0x5213bb=_0xb81c[_0x3c87f0];return _0x5213bb;};'use strict';var Sequelize=require(_0xcb81('0x0'));var moment=require(_0xcb81('0x1'));module[_0xcb81('0x2')]={'time':{'type':Sequelize[_0xcb81('0x3')]},'callid':{'type':Sequelize[_0xcb81('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xcb81('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xcb81('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xcb81('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xcb81('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xcb81('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xcb81('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xcb81('0x4')](_0xcb81('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 1f0370e..2d9ed9f 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 _0x9b2e=['undefined','limit','count','set','Content-Range','apply','save','destroy','then','error','name','send','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','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/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x650e61,_0x40055a){var _0x288cfa=function(_0x29c403){while(--_0x29c403){_0x650e61['push'](_0x650e61['shift']());}};_0x288cfa(++_0x40055a);}(_0x9b2e,0xc9));var _0xe9b2=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x9b2e[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0xe9b2('0x0'));var rimraf=require(_0xe9b2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9b2('0x2'));var rp=require(_0xe9b2('0x3'));var moment=require(_0xe9b2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe9b2('0x5'));var util=require(_0xe9b2('0x6'));var path=require(_0xe9b2('0x7'));var sox=require(_0xe9b2('0x8'));var csv=require(_0xe9b2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9b2('0xa'));var _=require(_0xe9b2('0xb'));var squel=require('squel');var crypto=require(_0xe9b2('0xc'));var jsforce=require(_0xe9b2('0xd'));var deskjs=require(_0xe9b2('0xe'));var toCsv=require(_0xe9b2('0x9'));var querystring=require(_0xe9b2('0xf'));var Papa=require(_0xe9b2('0x10'));var Redis=require(_0xe9b2('0x11'));var authService=require(_0xe9b2('0x12'));var qs=require(_0xe9b2('0x13'));var as=require(_0xe9b2('0x14'));var hardwareService=require(_0xe9b2('0x15'));var logger=require(_0xe9b2('0x16'))(_0xe9b2('0x17'));var utils=require(_0xe9b2('0x18'));var config=require(_0xe9b2('0x19'));var licenseUtil=require(_0xe9b2('0x1a'));var db=require(_0xe9b2('0x1b'))['db'];function respondWithStatusCode(_0x1c1548,_0x5b1644){_0x5b1644=_0x5b1644||0xcc;return function(_0x17cd3c){if(_0x17cd3c){return _0x1c1548[_0xe9b2('0x1c')](_0x5b1644);}return _0x1c1548[_0xe9b2('0x1d')](_0x5b1644)[_0xe9b2('0x1e')]();};}function respondWithResult(_0x2132fd,_0x5d6af9){_0x5d6af9=_0x5d6af9||0xc8;return function(_0x2b2d9a){if(_0x2b2d9a){return _0x2132fd['status'](_0x5d6af9)[_0xe9b2('0x1f')](_0x2b2d9a);}};}function respondWithFilteredResult(_0x3769b1,_0x36c60f){return function(_0x3b3f70){if(_0x3b3f70){var _0x4a1c36=typeof _0x36c60f[_0xe9b2('0x20')]===_0xe9b2('0x21')&&typeof _0x36c60f[_0xe9b2('0x22')]===_0xe9b2('0x21');var _0x275e84=_0x3b3f70[_0xe9b2('0x23')];var _0x2aa0bc=_0x4a1c36?0x0:_0x36c60f[_0xe9b2('0x20')];var _0x148778=_0x4a1c36?_0x3b3f70[_0xe9b2('0x23')]:_0x36c60f[_0xe9b2('0x20')]+_0x36c60f[_0xe9b2('0x22')];var _0x27a6ee;if(_0x148778>=_0x275e84){_0x148778=_0x275e84;_0x27a6ee=0xc8;}else{_0x27a6ee=0xce;}_0x3769b1[_0xe9b2('0x1d')](_0x27a6ee);return _0x3769b1[_0xe9b2('0x24')](_0xe9b2('0x25'),_0x2aa0bc+'-'+_0x148778+'/'+_0x275e84)['json'](_0x3b3f70);}return null;};}function patchUpdates(_0x299b00){return function(_0x4e9093){try{jsonpatch[_0xe9b2('0x26')](_0x4e9093,_0x299b00,!![]);}catch(_0x39c937){return BPromise['reject'](_0x39c937);}return _0x4e9093[_0xe9b2('0x27')]();};}function saveUpdates(_0x442fa4,_0x497af6){return function(_0x48decb){if(_0x48decb){return _0x48decb['update'](_0x442fa4)['then'](function(_0x112c22){return _0x112c22;});}return null;};}function removeEntity(_0x1ab5c5,_0x45e8f9){return function(_0x5b0862){if(_0x5b0862){return _0x5b0862[_0xe9b2('0x28')]()[_0xe9b2('0x29')](function(){_0x1ab5c5[_0xe9b2('0x1d')](0xcc)[_0xe9b2('0x1e')]();});}};}function handleEntityNotFound(_0x1437fe,_0x4c9b35){return function(_0x44324b){if(!_0x44324b){_0x1437fe[_0xe9b2('0x1c')](0x194);}return _0x44324b;};}function handleError(_0x2febe8,_0x2e6299){_0x2e6299=_0x2e6299||0x1f4;return function(_0x4c93e0){logger[_0xe9b2('0x2a')](_0x4c93e0['stack']);if(_0x4c93e0['name']){delete _0x4c93e0[_0xe9b2('0x2b')];}_0x2febe8[_0xe9b2('0x1d')](_0x2e6299)[_0xe9b2('0x2c')](_0x4c93e0);};}exports['index']=function(_0xde4ff9,_0x3f946d){var _0x1bbe39={},_0x2545a5={},_0x180144={'count':0x0,'rows':[]};var _0x3d0091=_[_0xe9b2('0x2d')](db[_0xe9b2('0x2e')][_0xe9b2('0x2f')],function(_0x35100c){return{'name':_0x35100c[_0xe9b2('0x30')],'type':_0x35100c[_0xe9b2('0x31')][_0xe9b2('0x32')]};});_0x2545a5[_0xe9b2('0x33')]=_[_0xe9b2('0x2d')](_0x3d0091,_0xe9b2('0x2b'));_0x2545a5[_0xe9b2('0x34')]=_[_0xe9b2('0x35')](_0xde4ff9['query']);_0x2545a5[_0xe9b2('0x36')]=_[_0xe9b2('0x37')](_0x2545a5['model'],_0x2545a5[_0xe9b2('0x34')]);_0x1bbe39[_0xe9b2('0x38')]=_[_0xe9b2('0x37')](_0x2545a5[_0xe9b2('0x33')],qs[_0xe9b2('0x39')](_0xde4ff9['query'][_0xe9b2('0x39')]));_0x1bbe39[_0xe9b2('0x38')]=_0x1bbe39['attributes']['length']?_0x1bbe39[_0xe9b2('0x38')]:_0x2545a5[_0xe9b2('0x33')];if(!_0xde4ff9['query'][_0xe9b2('0x3a')](_0xe9b2('0x3b'))){_0x1bbe39[_0xe9b2('0x22')]=qs['limit'](_0xde4ff9[_0xe9b2('0x34')]['limit']);_0x1bbe39[_0xe9b2('0x20')]=qs['offset'](_0xde4ff9[_0xe9b2('0x34')]['offset']);}_0x1bbe39['order']=qs['sort'](_0xde4ff9[_0xe9b2('0x34')][_0xe9b2('0x3c')]);_0x1bbe39[_0xe9b2('0x3d')]=qs[_0xe9b2('0x36')](_[_0xe9b2('0x3e')](_0xde4ff9[_0xe9b2('0x34')],_0x2545a5['filters']),_0x3d0091);if(_0xde4ff9['query'][_0xe9b2('0x3f')]){_0x1bbe39[_0xe9b2('0x3d')]=_[_0xe9b2('0x40')](_0x1bbe39[_0xe9b2('0x3d')],{'$or':_[_0xe9b2('0x2d')](_0x3d0091,function(_0x1ecb9d){if(_0x1ecb9d[_0xe9b2('0x31')]!==_0xe9b2('0x41')){var _0x5351bf={};_0x5351bf[_0x1ecb9d[_0xe9b2('0x2b')]]={'$like':'%'+_0xde4ff9[_0xe9b2('0x34')][_0xe9b2('0x3f')]+'%'};return _0x5351bf;}})});}_0x1bbe39=_['merge']({},_0x1bbe39,_0xde4ff9[_0xe9b2('0x42')]);var _0x28c187={'where':_0x1bbe39[_0xe9b2('0x3d')]};return db[_0xe9b2('0x2e')][_0xe9b2('0x23')](_0x28c187)[_0xe9b2('0x29')](function(_0x2c0e71){_0x180144[_0xe9b2('0x23')]=_0x2c0e71;if(_0xde4ff9['query'][_0xe9b2('0x43')]){_0x1bbe39[_0xe9b2('0x44')]=[{'all':!![]}];}return db[_0xe9b2('0x2e')][_0xe9b2('0x45')](_0x1bbe39);})[_0xe9b2('0x29')](function(_0x31e0e3){_0x180144[_0xe9b2('0x46')]=_0x31e0e3;return _0x180144;})[_0xe9b2('0x29')](respondWithFilteredResult(_0x3f946d,_0x1bbe39))['catch'](handleError(_0x3f946d,null));};exports[_0xe9b2('0x47')]=function(_0xaef1ec,_0x4404ec){var _0x23e8ea={'raw':!![],'where':{'id':_0xaef1ec[_0xe9b2('0x48')]['id']}},_0x4bba0d={};_0x4bba0d[_0xe9b2('0x33')]=_['keys'](db[_0xe9b2('0x2e')][_0xe9b2('0x2f')]);_0x4bba0d[_0xe9b2('0x34')]=_[_0xe9b2('0x35')](_0xaef1ec[_0xe9b2('0x34')]);_0x4bba0d[_0xe9b2('0x36')]=_[_0xe9b2('0x37')](_0x4bba0d['model'],_0x4bba0d[_0xe9b2('0x34')]);_0x23e8ea[_0xe9b2('0x38')]=_['intersection'](_0x4bba0d[_0xe9b2('0x33')],qs[_0xe9b2('0x39')](_0xaef1ec[_0xe9b2('0x34')]['fields']));_0x23e8ea[_0xe9b2('0x38')]=_0x23e8ea[_0xe9b2('0x38')][_0xe9b2('0x49')]?_0x23e8ea['attributes']:_0x4bba0d[_0xe9b2('0x33')];if(_0xaef1ec['query'][_0xe9b2('0x43')]){_0x23e8ea['include']=[{'all':!![]}];}_0x23e8ea=_['merge']({},_0x23e8ea,_0xaef1ec[_0xe9b2('0x42')]);return db[_0xe9b2('0x2e')][_0xe9b2('0x4a')](_0x23e8ea)['then'](handleEntityNotFound(_0x4404ec,null))[_0xe9b2('0x29')](respondWithResult(_0x4404ec,null))[_0xe9b2('0x4b')](handleError(_0x4404ec,null));};exports[_0xe9b2('0x4c')]=function(_0x41a071,_0x244a46){return db['VoiceQueuesLog']['create'](_0x41a071['body'],{})['then'](respondWithResult(_0x244a46,0xc9))[_0xe9b2('0x4b')](handleError(_0x244a46,null));};exports['update']=function(_0x11235c,_0x560069){if(_0x11235c[_0xe9b2('0x4d')]['id']){delete _0x11235c[_0xe9b2('0x4d')]['id'];}return db[_0xe9b2('0x2e')][_0xe9b2('0x4a')]({'where':{'id':_0x11235c[_0xe9b2('0x48')]['id']}})['then'](handleEntityNotFound(_0x560069,null))[_0xe9b2('0x29')](saveUpdates(_0x11235c[_0xe9b2('0x4d')],null))[_0xe9b2('0x29')](respondWithResult(_0x560069,null))[_0xe9b2('0x4b')](handleError(_0x560069,null));};exports[_0xe9b2('0x28')]=function(_0x82c63b,_0x4e6ae3){return db[_0xe9b2('0x2e')][_0xe9b2('0x4a')]({'where':{'id':_0x82c63b['params']['id']}})[_0xe9b2('0x29')](handleEntityNotFound(_0x4e6ae3,null))[_0xe9b2('0x29')](removeEntity(_0x4e6ae3,null))['catch'](handleError(_0x4e6ae3,null));}; \ No newline at end of file +var _0x7600=['squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','VoiceQueuesLog','includeAll','findAll','rows','show','params','rawAttributes','merge','catch','create','body','update','find','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x4ba10c,_0x1607a4){var _0x19b640=function(_0x292638){while(--_0x292638){_0x4ba10c['push'](_0x4ba10c['shift']());}};_0x19b640(++_0x1607a4);}(_0x7600,0x8c));var _0x0760=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x7600[_0x50a0c2];return _0x5ebadd;};'use strict';var emlformat=require(_0x0760('0x0'));var rimraf=require(_0x0760('0x1'));var zipdir=require(_0x0760('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0760('0x3'));var moment=require(_0x0760('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0760('0x5'));var util=require(_0x0760('0x6'));var path=require(_0x0760('0x7'));var sox=require(_0x0760('0x8'));var csv=require(_0x0760('0x9'));var ejs=require(_0x0760('0xa'));var fs=require('fs');var fs_extra=require(_0x0760('0xb'));var _=require('lodash');var squel=require(_0x0760('0xc'));var crypto=require(_0x0760('0xd'));var jsforce=require(_0x0760('0xe'));var deskjs=require(_0x0760('0xf'));var toCsv=require(_0x0760('0x9'));var querystring=require(_0x0760('0x10'));var Papa=require(_0x0760('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0760('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0760('0x13'));var logger=require('../../config/logger')(_0x0760('0x14'));var utils=require(_0x0760('0x15'));var config=require(_0x0760('0x16'));var licenseUtil=require(_0x0760('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d148c,_0x4b6a3c){_0x4b6a3c=_0x4b6a3c||0xcc;return function(_0x45b25a){if(_0x45b25a){return _0x1d148c[_0x0760('0x18')](_0x4b6a3c);}return _0x1d148c[_0x0760('0x19')](_0x4b6a3c)[_0x0760('0x1a')]();};}function respondWithResult(_0x261d8d,_0x574a32){_0x574a32=_0x574a32||0xc8;return function(_0x55c7f4){if(_0x55c7f4){return _0x261d8d[_0x0760('0x19')](_0x574a32)[_0x0760('0x1b')](_0x55c7f4);}};}function respondWithFilteredResult(_0x23b443,_0x2818ad){return function(_0x127ab7){if(_0x127ab7){var _0x447ec6=typeof _0x2818ad['offset']===_0x0760('0x1c')&&typeof _0x2818ad['limit']===_0x0760('0x1c');var _0x46c933=_0x127ab7[_0x0760('0x1d')];var _0x1c04f8=_0x447ec6?0x0:_0x2818ad[_0x0760('0x1e')];var _0x30464f=_0x447ec6?_0x127ab7[_0x0760('0x1d')]:_0x2818ad[_0x0760('0x1e')]+_0x2818ad[_0x0760('0x1f')];var _0x50c6d6;if(_0x30464f>=_0x46c933){_0x30464f=_0x46c933;_0x50c6d6=0xc8;}else{_0x50c6d6=0xce;}_0x23b443[_0x0760('0x19')](_0x50c6d6);return _0x23b443[_0x0760('0x20')](_0x0760('0x21'),_0x1c04f8+'-'+_0x30464f+'/'+_0x46c933)['json'](_0x127ab7);}return null;};}function patchUpdates(_0x3fce75){return function(_0x37498c){try{jsonpatch[_0x0760('0x22')](_0x37498c,_0x3fce75,!![]);}catch(_0x4fc3df){return BPromise[_0x0760('0x23')](_0x4fc3df);}return _0x37498c[_0x0760('0x24')]();};}function saveUpdates(_0x13bc45,_0x4c45fa){return function(_0x402b28){if(_0x402b28){return _0x402b28['update'](_0x13bc45)[_0x0760('0x25')](function(_0x1518cf){return _0x1518cf;});}return null;};}function removeEntity(_0x1fc170,_0x10e24d){return function(_0x2327c0){if(_0x2327c0){return _0x2327c0[_0x0760('0x26')]()[_0x0760('0x25')](function(){_0x1fc170[_0x0760('0x19')](0xcc)[_0x0760('0x1a')]();});}};}function handleEntityNotFound(_0x25dc20,_0x364421){return function(_0x3a6dbf){if(!_0x3a6dbf){_0x25dc20[_0x0760('0x18')](0x194);}return _0x3a6dbf;};}function handleError(_0x1493e3,_0x5a6bac){_0x5a6bac=_0x5a6bac||0x1f4;return function(_0x4d2332){logger['error'](_0x4d2332[_0x0760('0x27')]);if(_0x4d2332[_0x0760('0x28')]){delete _0x4d2332[_0x0760('0x28')];}_0x1493e3[_0x0760('0x19')](_0x5a6bac)[_0x0760('0x29')](_0x4d2332);};}exports[_0x0760('0x2a')]=function(_0x2b11e7,_0xc3da14){var _0x1a5a25={},_0x78269e={},_0x130b10={'count':0x0,'rows':[]};var _0x3d18b1=_[_0x0760('0x2b')](db['VoiceQueuesLog']['rawAttributes'],function(_0x337ed9){return{'name':_0x337ed9[_0x0760('0x2c')],'type':_0x337ed9['type']['key']};});_0x78269e[_0x0760('0x2d')]=_[_0x0760('0x2b')](_0x3d18b1,_0x0760('0x28'));_0x78269e[_0x0760('0x2e')]=_[_0x0760('0x2f')](_0x2b11e7['query']);_0x78269e[_0x0760('0x30')]=_['intersection'](_0x78269e[_0x0760('0x2d')],_0x78269e[_0x0760('0x2e')]);_0x1a5a25[_0x0760('0x31')]=_[_0x0760('0x32')](_0x78269e[_0x0760('0x2d')],qs[_0x0760('0x33')](_0x2b11e7['query'][_0x0760('0x33')]));_0x1a5a25[_0x0760('0x31')]=_0x1a5a25[_0x0760('0x31')][_0x0760('0x34')]?_0x1a5a25['attributes']:_0x78269e[_0x0760('0x2d')];if(!_0x2b11e7[_0x0760('0x2e')][_0x0760('0x35')](_0x0760('0x36'))){_0x1a5a25[_0x0760('0x1f')]=qs[_0x0760('0x1f')](_0x2b11e7[_0x0760('0x2e')][_0x0760('0x1f')]);_0x1a5a25[_0x0760('0x1e')]=qs[_0x0760('0x1e')](_0x2b11e7['query'][_0x0760('0x1e')]);}_0x1a5a25[_0x0760('0x37')]=qs[_0x0760('0x38')](_0x2b11e7[_0x0760('0x2e')][_0x0760('0x38')]);_0x1a5a25[_0x0760('0x39')]=qs[_0x0760('0x30')](_[_0x0760('0x3a')](_0x2b11e7[_0x0760('0x2e')],_0x78269e['filters']),_0x3d18b1);if(_0x2b11e7[_0x0760('0x2e')][_0x0760('0x3b')]){_0x1a5a25[_0x0760('0x39')]=_['merge'](_0x1a5a25[_0x0760('0x39')],{'$or':_['map'](_0x3d18b1,function(_0x373c4f){if(_0x373c4f[_0x0760('0x3c')]!==_0x0760('0x3d')){var _0x1717a5={};_0x1717a5[_0x373c4f[_0x0760('0x28')]]={'$like':'%'+_0x2b11e7[_0x0760('0x2e')]['filter']+'%'};return _0x1717a5;}})});}_0x1a5a25=_['merge']({},_0x1a5a25,_0x2b11e7[_0x0760('0x3e')]);var _0x17eae7={'where':_0x1a5a25[_0x0760('0x39')]};return db[_0x0760('0x3f')][_0x0760('0x1d')](_0x17eae7)[_0x0760('0x25')](function(_0x529c87){_0x130b10[_0x0760('0x1d')]=_0x529c87;if(_0x2b11e7[_0x0760('0x2e')][_0x0760('0x40')]){_0x1a5a25['include']=[{'all':!![]}];}return db[_0x0760('0x3f')][_0x0760('0x41')](_0x1a5a25);})[_0x0760('0x25')](function(_0x26de31){_0x130b10[_0x0760('0x42')]=_0x26de31;return _0x130b10;})['then'](respondWithFilteredResult(_0xc3da14,_0x1a5a25))['catch'](handleError(_0xc3da14,null));};exports[_0x0760('0x43')]=function(_0x2e1548,_0x5904eb){var _0x552237={'raw':!![],'where':{'id':_0x2e1548[_0x0760('0x44')]['id']}},_0x184a25={};_0x184a25['model']=_['keys'](db['VoiceQueuesLog'][_0x0760('0x45')]);_0x184a25[_0x0760('0x2e')]=_[_0x0760('0x2f')](_0x2e1548[_0x0760('0x2e')]);_0x184a25[_0x0760('0x30')]=_[_0x0760('0x32')](_0x184a25[_0x0760('0x2d')],_0x184a25[_0x0760('0x2e')]);_0x552237[_0x0760('0x31')]=_[_0x0760('0x32')](_0x184a25[_0x0760('0x2d')],qs[_0x0760('0x33')](_0x2e1548['query']['fields']));_0x552237[_0x0760('0x31')]=_0x552237[_0x0760('0x31')][_0x0760('0x34')]?_0x552237[_0x0760('0x31')]:_0x184a25['model'];if(_0x2e1548[_0x0760('0x2e')][_0x0760('0x40')]){_0x552237['include']=[{'all':!![]}];}_0x552237=_[_0x0760('0x46')]({},_0x552237,_0x2e1548[_0x0760('0x3e')]);return db['VoiceQueuesLog']['find'](_0x552237)[_0x0760('0x25')](handleEntityNotFound(_0x5904eb,null))[_0x0760('0x25')](respondWithResult(_0x5904eb,null))[_0x0760('0x47')](handleError(_0x5904eb,null));};exports['create']=function(_0x444185,_0x535761){return db[_0x0760('0x3f')][_0x0760('0x48')](_0x444185[_0x0760('0x49')],{})[_0x0760('0x25')](respondWithResult(_0x535761,0xc9))[_0x0760('0x47')](handleError(_0x535761,null));};exports[_0x0760('0x4a')]=function(_0x2c543b,_0x42e2f8){if(_0x2c543b['body']['id']){delete _0x2c543b['body']['id'];}return db[_0x0760('0x3f')][_0x0760('0x4b')]({'where':{'id':_0x2c543b[_0x0760('0x44')]['id']}})['then'](handleEntityNotFound(_0x42e2f8,null))[_0x0760('0x25')](saveUpdates(_0x2c543b[_0x0760('0x49')],null))['then'](respondWithResult(_0x42e2f8,null))['catch'](handleError(_0x42e2f8,null));};exports['destroy']=function(_0x5c7aee,_0x3a61ec){return db[_0x0760('0x3f')][_0x0760('0x4b')]({'where':{'id':_0x5c7aee[_0x0760('0x44')]['id']}})[_0x0760('0x25')](handleEntityNotFound(_0x3a61ec,null))[_0x0760('0x25')](removeEntity(_0x3a61ec,null))[_0x0760('0x47')](handleError(_0x3a61ec,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index e626c84..952a35e 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 _0x4ee3=['voice_queues_log','event_dtm','lodash','util','../../config/logger','moment','bluebird','path','rimraf','./voiceQueuesLog.attributes','define'];(function(_0xc7bb50,_0x59965a){var _0x826f0c=function(_0x403338){while(--_0x403338){_0xc7bb50['push'](_0xc7bb50['shift']());}};_0x826f0c(++_0x59965a);}(_0x4ee3,0x120));var _0x34ee=function(_0x2e6dd3,_0x2365ce){_0x2e6dd3=_0x2e6dd3-0x0;var _0x54f4b1=_0x4ee3[_0x2e6dd3];return _0x54f4b1;};'use strict';var _=require(_0x34ee('0x0'));var util=require(_0x34ee('0x1'));var logger=require(_0x34ee('0x2'))('api');var moment=require(_0x34ee('0x3'));var BPromise=require(_0x34ee('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x34ee('0x5'));var rimraf=require(_0x34ee('0x6'));var config=require('../../config/environment');var attributes=require(_0x34ee('0x7'));module['exports']=function(_0xd9ffb8,_0x12abdb){return _0xd9ffb8[_0x34ee('0x8')]('VoiceQueuesLog',attributes,{'tableName':_0x34ee('0x9'),'paranoid':![],'indexes':[{'name':_0x34ee('0xa'),'fields':['event','dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0x22c5=['./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','event','dtm','../../config/logger','bluebird'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x22c5,0x6e));var _0x522c=function(_0x2900ec,_0x5ed034){_0x2900ec=_0x2900ec-0x0;var _0x2bdd61=_0x22c5[_0x2900ec];return _0x2bdd61;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x522c('0x0'))('api');var moment=require('moment');var BPromise=require(_0x522c('0x1'));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(_0x522c('0x2'));module[_0x522c('0x3')]=function(_0x84e973,_0x3be57e){return _0x84e973[_0x522c('0x4')](_0x522c('0x5'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x522c('0x6'),_0x522c('0x7')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 998de60..a045cb7 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 _0x6b06=['../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x1c7db9,_0x204c7a){var _0x3add90=function(_0x1dd8b8){while(--_0x1dd8b8){_0x1c7db9['push'](_0x1c7db9['shift']());}};_0x3add90(++_0x204c7a);}(_0x6b06,0x143));var _0x66b0=function(_0x1d705c,_0x313c01){_0x1d705c=_0x1d705c-0x0;var _0x2485b1=_0x6b06[_0x1d705c];return _0x2485b1;};'use strict';var _=require(_0x66b0('0x0'));var util=require(_0x66b0('0x1'));var moment=require(_0x66b0('0x2'));var BPromise=require(_0x66b0('0x3'));var rs=require(_0x66b0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x66b0('0x5'))['db'];var utils=require(_0x66b0('0x6'));var logger=require(_0x66b0('0x7'))(_0x66b0('0x8'));var config=require(_0x66b0('0x9'));var jayson=require(_0x66b0('0xa'));var client=jayson['client'][_0x66b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29c842,_0x3d2690,_0x52b2dc){return new BPromise(function(_0x4abb71,_0x1617c1){return client['request'](_0x29c842,_0x52b2dc)[_0x66b0('0xc')](function(_0x26c2fc){logger[_0x66b0('0xd')](_0x66b0('0xe'),_0x3d2690,_0x66b0('0xf'));logger[_0x66b0('0x10')](_0x66b0('0x11'),_0x3d2690,'request\x20sent',JSON[_0x66b0('0x12')](_0x26c2fc));if(_0x26c2fc[_0x66b0('0x13')]){if(_0x26c2fc[_0x66b0('0x13')][_0x66b0('0x14')]===0x1f4){logger['error'](_0x66b0('0xe'),_0x3d2690,_0x26c2fc['error'][_0x66b0('0x15')]);return _0x1617c1(_0x26c2fc[_0x66b0('0x13')][_0x66b0('0x15')]);}logger['error'](_0x66b0('0xe'),_0x3d2690,_0x26c2fc[_0x66b0('0x13')][_0x66b0('0x15')]);return _0x4abb71(_0x26c2fc[_0x66b0('0x13')][_0x66b0('0x15')]);}else{logger['info'](_0x66b0('0xe'),_0x3d2690,_0x66b0('0xf'));_0x4abb71(_0x26c2fc['result']['message']);}})['catch'](function(_0x441371){logger[_0x66b0('0x13')]('VoiceQueuesLog,\x20%s,\x20%s',_0x3d2690,_0x441371);_0x1617c1(_0x441371);});});} \ No newline at end of file +var _0x500a=['client','http','request','then','info','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','result','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x220fcd,_0x5cb397){var _0x4fef90=function(_0xc656e5){while(--_0xc656e5){_0x220fcd['push'](_0x220fcd['shift']());}};_0x4fef90(++_0x5cb397);}(_0x500a,0xd6));var _0xa500=function(_0x487361,_0x722b9d){_0x487361=_0x487361-0x0;var _0x1fc877=_0x500a[_0x487361];return _0x1fc877;};'use strict';var _=require('lodash');var util=require(_0xa500('0x0'));var moment=require('moment');var BPromise=require(_0xa500('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa500('0x2'))['db'];var utils=require(_0xa500('0x3'));var logger=require(_0xa500('0x4'))(_0xa500('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa500('0x6')][_0xa500('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3781b0,_0xfa3fea,_0x3b0aa0){return new BPromise(function(_0x4ca517,_0x54dbfc){return client[_0xa500('0x8')](_0x3781b0,_0x3b0aa0)[_0xa500('0x9')](function(_0x456376){logger[_0xa500('0xa')]('VoiceQueuesLog,\x20%s,\x20%s',_0xfa3fea,_0xa500('0xb'));logger[_0xa500('0xc')](_0xa500('0xd'),_0xfa3fea,_0xa500('0xb'),JSON[_0xa500('0xe')](_0x456376));if(_0x456376[_0xa500('0xf')]){if(_0x456376[_0xa500('0xf')][_0xa500('0x10')]===0x1f4){logger[_0xa500('0xf')](_0xa500('0x11'),_0xfa3fea,_0x456376[_0xa500('0xf')][_0xa500('0x12')]);return _0x54dbfc(_0x456376[_0xa500('0xf')][_0xa500('0x12')]);}logger['error'](_0xa500('0x11'),_0xfa3fea,_0x456376[_0xa500('0xf')][_0xa500('0x12')]);return _0x4ca517(_0x456376[_0xa500('0xf')][_0xa500('0x12')]);}else{logger[_0xa500('0xa')](_0xa500('0x11'),_0xfa3fea,_0xa500('0xb'));_0x4ca517(_0x456376[_0xa500('0x13')]['message']);}})['catch'](function(_0x159ae0){logger[_0xa500('0xf')]('VoiceQueuesLog,\x20%s,\x20%s',_0xfa3fea,_0x159ae0);_0x54dbfc(_0x159ae0);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index b7c9641..eddb132 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 _0x1b50=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','/:id','/:id/download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','put','update','delete','destroy','exports','multer','util','path'];(function(_0x4bcdde,_0x4d2f0d){var _0x929af5=function(_0x49bd35){while(--_0x49bd35){_0x4bcdde['push'](_0x4bcdde['shift']());}};_0x929af5(++_0x4d2f0d);}(_0x1b50,0x7a));var _0x01b5=function(_0x8a32b5,_0x225a07){_0x8a32b5=_0x8a32b5-0x0;var _0x19b81=_0x1b50[_0x8a32b5];return _0x19b81;};'use strict';var multer=require(_0x01b5('0x0'));var util=require(_0x01b5('0x1'));var path=require(_0x01b5('0x2'));var timeout=require(_0x01b5('0x3'));var express=require(_0x01b5('0x4'));var router=express[_0x01b5('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x01b5('0x6'));var interaction=require(_0x01b5('0x7'));var config=require(_0x01b5('0x8'));var controller=require(_0x01b5('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x01b5('0xa')]('/describe',auth[_0x01b5('0xb')](),controller['describe']);router[_0x01b5('0xa')](_0x01b5('0xc'),auth[_0x01b5('0xb')](),controller['show']);router[_0x01b5('0xa')](_0x01b5('0xd'),auth[_0x01b5('0xb')](),controller['download']);router[_0x01b5('0xa')](_0x01b5('0xe'),controller[_0x01b5('0xf')]);router[_0x01b5('0xa')](_0x01b5('0x10'),auth[_0x01b5('0xb')](),controller[_0x01b5('0x11')]);router[_0x01b5('0x12')]('/',auth[_0x01b5('0xb')](),controller['create']);router['post'](_0x01b5('0x10'),auth['isAuthenticated'](),controller[_0x01b5('0x13')]);router[_0x01b5('0x14')](_0x01b5('0xc'),auth[_0x01b5('0xb')](),controller[_0x01b5('0x15')]);router[_0x01b5('0x16')](_0x01b5('0xc'),auth[_0x01b5('0xb')](),controller[_0x01b5('0x17')]);module[_0x01b5('0x18')]=router; \ No newline at end of file +var _0x8bbc=['../../components/interaction/service','../../config/environment','./voiceRecording.controller','isAuthenticated','index','describe','get','/:id','download','downloads','/:id/transcribe','post','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x403c57,_0x280a51){var _0x35fa69=function(_0x13a356){while(--_0x13a356){_0x403c57['push'](_0x403c57['shift']());}};_0x35fa69(++_0x280a51);}(_0x8bbc,0x149));var _0xc8bb=function(_0x199b1f,_0x4ed849){_0x199b1f=_0x199b1f-0x0;var _0x267ac9=_0x8bbc[_0x199b1f];return _0x267ac9;};'use strict';var multer=require(_0xc8bb('0x0'));var util=require(_0xc8bb('0x1'));var path=require(_0xc8bb('0x2'));var timeout=require('connect-timeout');var express=require(_0xc8bb('0x3'));var router=express[_0xc8bb('0x4')]();var fs_extra=require(_0xc8bb('0x5'));var auth=require(_0xc8bb('0x6'));var interaction=require(_0xc8bb('0x7'));var config=require(_0xc8bb('0x8'));var controller=require(_0xc8bb('0x9'));router['get']('/',auth[_0xc8bb('0xa')](),controller[_0xc8bb('0xb')]);router['get']('/describe',auth[_0xc8bb('0xa')](),controller[_0xc8bb('0xc')]);router[_0xc8bb('0xd')](_0xc8bb('0xe'),auth[_0xc8bb('0xa')](),controller['show']);router[_0xc8bb('0xd')]('/:id/download',auth[_0xc8bb('0xa')](),controller[_0xc8bb('0xf')]);router[_0xc8bb('0xd')]('/:id/downloads',controller[_0xc8bb('0x10')]);router[_0xc8bb('0xd')](_0xc8bb('0x11'),auth[_0xc8bb('0xa')](),controller['downloadTranscribe']);router[_0xc8bb('0x12')]('/',auth[_0xc8bb('0xa')](),controller['create']);router[_0xc8bb('0x12')](_0xc8bb('0x11'),auth[_0xc8bb('0xa')](),controller['runTranscribe']);router[_0xc8bb('0x13')](_0xc8bb('0xe'),auth[_0xc8bb('0xa')](),controller[_0xc8bb('0x14')]);router[_0xc8bb('0x15')](_0xc8bb('0xe'),auth[_0xc8bb('0xa')](),controller[_0xc8bb('0x16')]);module[_0xc8bb('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 0c63b73..97b8073 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(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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 b228fd1..e176134 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 _0xcffb=['papaparse','aws-sdk','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','json','update','then','destroy','error','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','model','differenceBy','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','download','../../components/encryptor','uniqueid','value','format','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','Not\x20found','downloads','sequelize','MD5','$and','push','secrets','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','createBucket','upload','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Setting','transcribe','transcribeRegion','language','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','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','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring'];(function(_0xa3463d,_0x32f8da){var _0x50fd67=function(_0xb984fd){while(--_0xb984fd){_0xa3463d['push'](_0xa3463d['shift']());}};_0x50fd67(++_0x32f8da);}(_0xcffb,0x88));var _0xbcff=function(_0x4e7f7a,_0x57d89c){_0x4e7f7a=_0x4e7f7a-0x0;var _0x227ea7=_0xcffb[_0x4e7f7a];return _0x227ea7;};'use strict';var emlformat=require(_0xbcff('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbcff('0x1'));var rp=require(_0xbcff('0x2'));var moment=require(_0xbcff('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbcff('0x4'));var util=require(_0xbcff('0x5'));var path=require(_0xbcff('0x6'));var sox=require(_0xbcff('0x7'));var csv=require(_0xbcff('0x8'));var ejs=require(_0xbcff('0x9'));var fs=require('fs');var fs_extra=require(_0xbcff('0xa'));var _=require(_0xbcff('0xb'));var squel=require('squel');var crypto=require(_0xbcff('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbcff('0x8'));var querystring=require(_0xbcff('0xd'));var Papa=require(_0xbcff('0xe'));var AWS=require(_0xbcff('0xf'));var uuidv4=require('uuid/v4');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbcff('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbcff('0x11'))(_0xbcff('0x12'));var utils=require('../../config/utils');var config=require(_0xbcff('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xbcff('0x14'))['db'];function respondWithStatusCode(_0x646bf1,_0x3c9061){_0x3c9061=_0x3c9061||0xcc;return function(_0x8d4959){if(_0x8d4959){return _0x646bf1[_0xbcff('0x15')](_0x3c9061);}return _0x646bf1[_0xbcff('0x16')](_0x3c9061)[_0xbcff('0x17')]();};}function respondWithResult(_0x41b389,_0x357837){_0x357837=_0x357837||0xc8;return function(_0x5b9186){if(_0x5b9186){return _0x41b389['status'](_0x357837)['json'](_0x5b9186);}};}function respondWithFilteredResult(_0x3869d4,_0xd80b02){return function(_0x47aa8d){if(_0x47aa8d){var _0x54560e=typeof _0xd80b02[_0xbcff('0x18')]==='undefined'&&typeof _0xd80b02['limit']===_0xbcff('0x19');var _0x43eab5=_0x47aa8d[_0xbcff('0x1a')];var _0x4516b2=_0x54560e?0x0:_0xd80b02[_0xbcff('0x18')];var _0xddf415=_0x54560e?_0x47aa8d[_0xbcff('0x1a')]:_0xd80b02[_0xbcff('0x18')]+_0xd80b02['limit'];var _0x4fb5b9;if(_0xddf415>=_0x43eab5){_0xddf415=_0x43eab5;_0x4fb5b9=0xc8;}else{_0x4fb5b9=0xce;}_0x3869d4[_0xbcff('0x16')](_0x4fb5b9);return _0x3869d4[_0xbcff('0x1b')]('Content-Range',_0x4516b2+'-'+_0xddf415+'/'+_0x43eab5)[_0xbcff('0x1c')](_0x47aa8d);}return null;};}function patchUpdates(_0x46b5e1){return function(_0x3df696){try{jsonpatch['apply'](_0x3df696,_0x46b5e1,!![]);}catch(_0x157aa9){return BPromise['reject'](_0x157aa9);}return _0x3df696['save']();};}function saveUpdates(_0x3ec549,_0x2ff92e){return function(_0xcc71d){if(_0xcc71d){return _0xcc71d[_0xbcff('0x1d')](_0x3ec549)[_0xbcff('0x1e')](function(_0x291fd2){return _0x291fd2;});}return null;};}function removeEntity(_0x1a2d1c,_0x4a9f9f){return function(_0x3dd203){if(_0x3dd203){return _0x3dd203[_0xbcff('0x1f')]()['then'](function(){_0x1a2d1c[_0xbcff('0x16')](0xcc)[_0xbcff('0x17')]();});}};}function handleEntityNotFound(_0x317758,_0x730869){return function(_0x2886e7){if(!_0x2886e7){_0x317758['sendStatus'](0x194);}return _0x2886e7;};}function handleError(_0xd9beb8,_0x5135fb){_0x5135fb=_0x5135fb||0x1f4;return function(_0x5a4be7){logger[_0xbcff('0x20')](_0x5a4be7['stack']);if(_0x5a4be7[_0xbcff('0x21')]){delete _0x5a4be7[_0xbcff('0x21')];}_0xd9beb8['status'](_0x5135fb)[_0xbcff('0x22')](_0x5a4be7);};}exports[_0xbcff('0x23')]=function(_0x2c4727,_0x245757){var _0x432102={},_0x1ee51e={},_0x43a4c9={'count':0x0,'rows':[]};var _0x2717ae=_[_0xbcff('0x24')](db[_0xbcff('0x25')][_0xbcff('0x26')],function(_0x2c64fc){return{'name':_0x2c64fc[_0xbcff('0x27')],'type':_0x2c64fc[_0xbcff('0x28')]['key']};});_0x1ee51e[_0xbcff('0x29')]=_[_0xbcff('0x2a')](_['map'](_0x2717ae,'name'),['format']);_0x1ee51e['query']=_[_0xbcff('0x2b')](_0x2c4727[_0xbcff('0x2c')]);_0x1ee51e[_0xbcff('0x2d')]=_['intersection'](_0x1ee51e['model'],_0x1ee51e[_0xbcff('0x2c')]);_0x432102[_0xbcff('0x2e')]=_[_0xbcff('0x2f')](_0x1ee51e['model'],qs[_0xbcff('0x30')](_0x2c4727['query'][_0xbcff('0x30')]));_0x432102[_0xbcff('0x2e')]=_0x432102[_0xbcff('0x2e')][_0xbcff('0x31')]?_0x432102[_0xbcff('0x2e')]:_0x1ee51e[_0xbcff('0x29')];if(!_0x2c4727[_0xbcff('0x2c')][_0xbcff('0x32')](_0xbcff('0x33'))){_0x432102[_0xbcff('0x34')]=qs[_0xbcff('0x34')](_0x2c4727['query'][_0xbcff('0x34')]);_0x432102[_0xbcff('0x18')]=qs[_0xbcff('0x18')](_0x2c4727[_0xbcff('0x2c')]['offset']);}_0x432102[_0xbcff('0x35')]=qs[_0xbcff('0x36')](_0x2c4727['query'][_0xbcff('0x36')]);_0x432102['where']=qs[_0xbcff('0x2d')](_['pick'](_0x2c4727[_0xbcff('0x2c')],_0x1ee51e[_0xbcff('0x2d')]),_0x2717ae);if(_0x2c4727[_0xbcff('0x2c')][_0xbcff('0x37')]){_0x432102['where']=_['merge'](_0x432102[_0xbcff('0x38')],{'$or':_[_0xbcff('0x24')](_0x2717ae,function(_0x4753ea){if(_0x4753ea[_0xbcff('0x28')]!==_0xbcff('0x39')){var _0x557725={};_0x557725[_0x4753ea[_0xbcff('0x21')]]={'$like':'%'+_0x2c4727[_0xbcff('0x2c')][_0xbcff('0x37')]+'%'};return _0x557725;}})});}_0x432102=_[_0xbcff('0x3a')]({},_0x432102,_0x2c4727[_0xbcff('0x3b')]);var _0x42b82d={'where':_0x432102[_0xbcff('0x38')]};return db[_0xbcff('0x25')][_0xbcff('0x1a')](_0x42b82d)['then'](function(_0x1123ad){_0x43a4c9[_0xbcff('0x1a')]=_0x1123ad;if(_0x2c4727[_0xbcff('0x2c')][_0xbcff('0x3c')]){_0x432102[_0xbcff('0x3d')]=[{'all':!![]}];}return db[_0xbcff('0x25')][_0xbcff('0x3e')](_0x432102);})[_0xbcff('0x1e')](function(_0xe8e4e3){_0x43a4c9[_0xbcff('0x3f')]=_0xe8e4e3;return _0x43a4c9;})[_0xbcff('0x1e')](respondWithFilteredResult(_0x245757,_0x432102))[_0xbcff('0x40')](handleError(_0x245757,null));};exports[_0xbcff('0x41')]=function(_0x20e284,_0x1f0f9c){var _0x4ff59e={'raw':![],'where':{'id':_0x20e284[_0xbcff('0x42')]['id']}},_0x17927b={};_0x17927b[_0xbcff('0x29')]=_[_0xbcff('0x2b')](db['VoiceRecording'][_0xbcff('0x26')]);_0x17927b[_0xbcff('0x2c')]=_[_0xbcff('0x2b')](_0x20e284[_0xbcff('0x2c')]);_0x17927b['filters']=_[_0xbcff('0x2f')](_0x17927b['model'],_0x17927b['query']);_0x4ff59e[_0xbcff('0x2e')]=_[_0xbcff('0x2f')](_0x17927b[_0xbcff('0x29')],qs['fields'](_0x20e284[_0xbcff('0x2c')][_0xbcff('0x30')]));_0x4ff59e['attributes']=_0x4ff59e['attributes'][_0xbcff('0x31')]?_0x4ff59e[_0xbcff('0x2e')]:_0x17927b[_0xbcff('0x29')];if(_0x20e284[_0xbcff('0x2c')][_0xbcff('0x3c')]){_0x4ff59e[_0xbcff('0x3d')]=[{'all':!![]}];}_0x4ff59e=_[_0xbcff('0x3a')]({},_0x4ff59e,_0x20e284[_0xbcff('0x3b')]);return db[_0xbcff('0x25')][_0xbcff('0x43')](_0x4ff59e)[_0xbcff('0x1e')](handleEntityNotFound(_0x1f0f9c,null))['then'](respondWithResult(_0x1f0f9c,null))[_0xbcff('0x40')](handleError(_0x1f0f9c,null));};exports[_0xbcff('0x44')]=function(_0x57d6cd,_0x640b41){return db[_0xbcff('0x25')][_0xbcff('0x44')](_0x57d6cd[_0xbcff('0x45')],{})[_0xbcff('0x1e')](respondWithResult(_0x640b41,0xc9))['catch'](handleError(_0x640b41,null));};exports[_0xbcff('0x1d')]=function(_0x44993f,_0x2438c6){if(_0x44993f['body']['id']){delete _0x44993f[_0xbcff('0x45')]['id'];}return db['VoiceRecording'][_0xbcff('0x43')]({'where':{'id':_0x44993f[_0xbcff('0x42')]['id']}})[_0xbcff('0x1e')](handleEntityNotFound(_0x2438c6,null))[_0xbcff('0x1e')](saveUpdates(_0x44993f[_0xbcff('0x45')],null))[_0xbcff('0x1e')](respondWithResult(_0x2438c6,null))[_0xbcff('0x40')](handleError(_0x2438c6,null));};exports[_0xbcff('0x46')]=function(_0x343763,_0x2470ba){return db['VoiceRecording'][_0xbcff('0x46')]()[_0xbcff('0x1e')](respondWithResult(_0x2470ba,null))['catch'](handleError(_0x2470ba,null));};exports[_0xbcff('0x47')]=function(_0x3a0bc2,_0x35787d,_0x95d188){var _0x4d96a1=require(_0xbcff('0x48'));var _0x8975e7=![];var _0x4c0061={};if(_0x3a0bc2[_0xbcff('0x2c')]['type']&&_0x3a0bc2['query'][_0xbcff('0x28')]===_0xbcff('0x49')){_0x4c0061['uniqueid']=_0x3a0bc2[_0xbcff('0x42')]['id'];}else{_0x4c0061['id']=_0x3a0bc2[_0xbcff('0x42')]['id'];}return db[_0xbcff('0x25')][_0xbcff('0x43')]({'where':_0x4c0061,'attributes':['id',_0xbcff('0x4a')],'raw':!![]})[_0xbcff('0x1e')](handleEntityNotFound(_0x35787d,null))['then'](function(_0xc7d5c4){if(_0xc7d5c4){var _0x5474c8=_0xc7d5c4['value'];var _0x1a4142=util[_0xbcff('0x4b')](_0xbcff('0x4c'),_0x5474c8);if(fs[_0xbcff('0x4d')](_0x1a4142)){_0x8975e7=!![];return _0x4d96a1[_0xbcff('0x4e')](_0x1a4142,_0x5474c8,config['secrets'][_0xbcff('0x4f')])[_0xbcff('0x1e')](function(){return _0xc7d5c4;});}return _0xc7d5c4;}})[_0xbcff('0x1e')](function(_0xd4a07c){if(_0xd4a07c){var _0x161ebc=_0xd4a07c['value'];if(!fs[_0xbcff('0x4d')](_0x161ebc)){throw new db[(_0xbcff('0x50'))][(_0xbcff('0x51'))](_0xbcff('0x52'));}if(_0xd4a07c['filename']){return _0x35787d[_0xbcff('0x47')](_0x161ebc,_0xd4a07c[_0xbcff('0x53')]+path[_0xbcff('0x54')](_0x161ebc),function(){if(_0x8975e7){fs[_0xbcff('0x55')](_0x161ebc);}});}else{return _0x35787d[_0xbcff('0x47')](_0x161ebc,function(_0x173578){if(_0x8975e7){fs['unlink'](_0x161ebc);}});}}})['catch'](function(_0x3b527a){if(_0x3b527a['message']===_0xbcff('0x52')){_0x35787d[_0xbcff('0x16')](0x194)[_0xbcff('0x22')](_0xbcff('0x56'));}else{return handleError(_0x35787d,null);}});};exports[_0xbcff('0x57')]=function(_0x481e40,_0x4507c9,_0x160503){var _0x31d56e=require(_0xbcff('0x48'));var _0x140a9b=![];var _0x5bc0c6={'$and':[db['sequelize']['where'](db[_0xbcff('0x58')]['fn'](_0xbcff('0x59'),db[_0xbcff('0x58')]['col'](_0xbcff('0x49'))),_0x481e40['query']['token'])]};if(_0x481e40[_0xbcff('0x2c')]['type']&&_0x481e40[_0xbcff('0x2c')][_0xbcff('0x28')]==='uniqueid'){_0x5bc0c6[_0xbcff('0x5a')][_0xbcff('0x5b')]({'uniqueid':_0x481e40['params']['id']});}else{_0x5bc0c6[_0xbcff('0x5a')][_0xbcff('0x5b')]({'id':_0x481e40[_0xbcff('0x42')]['id']});}return db[_0xbcff('0x25')][_0xbcff('0x43')]({'where':_0x5bc0c6,'attributes':['id',_0xbcff('0x4a')],'raw':!![]})[_0xbcff('0x1e')](handleEntityNotFound(_0x4507c9,null))[_0xbcff('0x1e')](function(_0x58b43a){if(_0x58b43a){var _0x9bd615=util['format'](_0xbcff('0x4c'),_0x58b43a[_0xbcff('0x4a')]);if(fs[_0xbcff('0x4d')](_0x9bd615)){_0x140a9b=!![];return _0x31d56e[_0xbcff('0x4e')](_0x9bd615,_0x58b43a[_0xbcff('0x4a')],config[_0xbcff('0x5c')]['recording'])[_0xbcff('0x1e')](function(){return _0x58b43a;});}return _0x58b43a;}})['then'](function(_0x44dae0){if(_0x44dae0){if(!fs['existsSync'](_0x44dae0['value'])){throw new db[(_0xbcff('0x50'))][(_0xbcff('0x51'))](_0xbcff('0x52'));}if(_0x44dae0['filename']){return _0x4507c9['download'](_0x44dae0['value'],_0x44dae0[_0xbcff('0x53')]+path[_0xbcff('0x54')](_0x44dae0[_0xbcff('0x4a')]),function(){if(_0x140a9b){fs[_0xbcff('0x55')](_0x44dae0[_0xbcff('0x4a')]);}});}else{return _0x4507c9[_0xbcff('0x47')](_0x44dae0[_0xbcff('0x4a')],function(_0x55f4a){if(_0x140a9b){fs[_0xbcff('0x55')](_0x44dae0['value']);}});}}})[_0xbcff('0x40')](handleError(_0x4507c9,null));};exports[_0xbcff('0x1f')]=function(_0x2ecccb,_0x54775c){return db[_0xbcff('0x25')][_0xbcff('0x43')]({'where':{'id':_0x2ecccb[_0xbcff('0x42')]['id']}})['then'](function(_0x3f1001){if(_[_0xbcff('0x5d')](_0x3f1001)){throw new ReferenceError(_0xbcff('0x5e'));}return _0x3f1001;})['then'](function(_0x505d17){var _0x36bf87=_0x505d17[_0xbcff('0x4a')];logger['info'](_0xbcff('0x5f'),_0x36bf87);if(!_[_0xbcff('0x5d')](_0x505d17[_0xbcff('0x4a')])&&fs[_0xbcff('0x4d')](_0x36bf87)){logger[_0xbcff('0x60')](_0xbcff('0x61')+_0x36bf87+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xbcff('0x62')](_0x36bf87);}_0x36bf87=_0x36bf87+_0xbcff('0x63');if(!_[_0xbcff('0x5d')](_0x505d17[_0xbcff('0x4a')])&&fs[_0xbcff('0x4d')](_0x36bf87)){logger[_0xbcff('0x60')]('File:\x20\x22'+_0x36bf87+_0xbcff('0x64'));fs[_0xbcff('0x62')](_0x36bf87);}return _0x505d17;})[_0xbcff('0x1e')](function(_0x30a4c0){if(!_0x30a4c0)throw new InternalError();return _0x30a4c0[_0xbcff('0x1f')]();})[_0xbcff('0x1e')](function(){_0x54775c[_0xbcff('0x16')](0xcc)[_0xbcff('0x17')]();})[_0xbcff('0x40')](handleError(_0x54775c,null));};function getBucketslist(_0x3f2405,_0x135371,_0x1a736f){return new Promise(function(_0x17c54b,_0x315e26){var _0x32abfd=new AWS['S3']({'accessKeyId':_0x135371,'secretAccessKey':_0x3f2405,'region':_0x1a736f});_0x32abfd['listBuckets']({},function(_0x35ea04,_0x1e39b8){if(_0x35ea04){return _0x315e26(_0x35ea04);}else{return _0x17c54b(_0x1e39b8);}});});}function createBucket(_0xe3a3b7,_0x48cd24,_0x1e90ab,_0x5d8989){return new Promise(function(_0x4db11b,_0x380edb){var _0x1a06ae=new AWS['S3']({'accessKeyId':_0x48cd24,'secretAccessKey':_0xe3a3b7,'region':_0x1e90ab});_0x1a06ae[_0xbcff('0x65')]({'Bucket':_0x5d8989},function(_0x4792a3,_0x44012f){if(_0x4792a3){return _0x380edb(_0x4792a3);}else{return _0x4db11b(_0x44012f);}});});}function uploadFile(_0x2d4c5b,_0x1c4baf,_0x47d9bf,_0xbe01fc,_0x3ef38b,_0x2ec51f){return new Promise(function(_0x48b623,_0x202d38){var _0x54c893=new AWS['S3']({'accessKeyId':_0x1c4baf,'secretAccessKey':_0x2d4c5b,'region':_0x47d9bf});_0x54c893[_0xbcff('0x66')]({'Bucket':_0xbe01fc,'Key':_0x3ef38b,'Body':_0x2ec51f},function(_0x2bc710,_0x1418b1){if(_0x2bc710){return _0x202d38(_0x2bc710);}else{return _0x48b623(_0x1418b1);}});});}function startTranscribe(_0x4a9cc7,_0x452a69,_0x5a953e,_0x97553e,_0x1d2bd0,_0x54ccf4){return new Promise(function(_0x35244e,_0x5c39f7){var _0x532aca=new AWS['TranscribeService']({'accessKeyId':_0x452a69,'secretAccessKey':_0x4a9cc7,'region':_0x5a953e});_0x532aca[_0xbcff('0x67')]({'TranscriptionJobName':_0x97553e,'LanguageCode':_0x1d2bd0,'Media':{'MediaFileUri':_0x54ccf4}},function(_0xf72bf1,_0xf50169){if(_0xf72bf1){return _0x5c39f7(_0xf72bf1);}else{return _0x35244e(_0xf50169);}});});}function transcribe(_0x119ac4,_0x51c653,_0x1a75b2,_0x3296af,_0x42f366,_0x50aa19,_0x251abe){return new Promise(function(_0x1212d8,_0x4b3929){var _0x4a1f41={};logger[_0xbcff('0x60')](util[_0xbcff('0x4b')](_0xbcff('0x68'),_0x119ac4,_0x42f366));return uploadFile(_0x51c653,_0x1a75b2,_0x3296af,_0x42f366,path[_0xbcff('0x69')](_0x50aa19),fs['readFileSync'](_0x50aa19))[_0xbcff('0x1e')](function(_0xbb721c){logger['info'](util[_0xbcff('0x4b')](_0xbcff('0x6a'),_0x119ac4,_0x42f366,_0xbb721c[_0xbcff('0x6b')]));_0x4a1f41[_0xbcff('0x6c')]=_0xbb721c[_0xbcff('0x6d')];_0x4a1f41[_0xbcff('0x6e')]=_0xbb721c[_0xbcff('0x6b')];logger[_0xbcff('0x60')](util[_0xbcff('0x4b')](_0xbcff('0x6f'),_0x119ac4));return startTranscribe(_0x51c653,_0x1a75b2,_0x3296af,uuidv4(),_0x251abe,_0xbb721c[_0xbcff('0x6b')]);})[_0xbcff('0x1e')](function(_0x59332b){logger[_0xbcff('0x60')](util[_0xbcff('0x4b')](_0xbcff('0x70'),_0x119ac4,_0x59332b[_0xbcff('0x71')]['TranscriptionJobName']));_0x4a1f41[_0xbcff('0x72')]=_0x59332b[_0xbcff('0x71')][_0xbcff('0x73')];_0x4a1f41[_0xbcff('0x74')]=_0x59332b[_0xbcff('0x71')][_0xbcff('0x75')];return _0x1212d8(_0x4a1f41);})[_0xbcff('0x40')](function(_0x25f2a5){return _0x4b3929(_0x25f2a5);});});}exports[_0xbcff('0x76')]=function(_0x167c47,_0x2afc28,_0xcfbf2a){var _0x4f7b33;var _0x19ab82;var _0x319ef5;var _0x3e9d1c=require(_0xbcff('0x48'));return db[_0xbcff('0x25')][_0xbcff('0x77')]({'where':{'id':_0x167c47[_0xbcff('0x42')]['id']}})[_0xbcff('0x1e')](function(_0x52a718){if(_0x52a718){var _0x1e7070=util[_0xbcff('0x4b')](_0xbcff('0x4c'),_0x52a718[_0xbcff('0x4a')]);if(fs[_0xbcff('0x4d')](_0x1e7070)){cypher=!![];return _0x3e9d1c[_0xbcff('0x4e')](_0x1e7070,_0x52a718[_0xbcff('0x4a')],config[_0xbcff('0x5c')][_0xbcff('0x4f')])[_0xbcff('0x1e')](function(){return _0x52a718;});}return _0x52a718;}})[_0xbcff('0x1e')](function(_0x4d41a1){if(!_0x4d41a1){throw new db[(_0xbcff('0x50'))][(_0xbcff('0x51'))]('Voice\x20Recording\x20not\x20found');}_0x19ab82=_0x4d41a1;return db[_0xbcff('0x78')][_0xbcff('0x77')]({'where':{'id':0x1}});})[_0xbcff('0x1e')](handleEntityNotFound(_0x2afc28,null))[_0xbcff('0x1e')](function(_0x16b9e0){if(_0x16b9e0){_0x4f7b33=_0x16b9e0;if(!_0x4f7b33[_0xbcff('0x79')]||!_0x4f7b33['transcribeAccountId']||!_0x4f7b33[_0xbcff('0x7a')]||!_0x4f7b33[_0xbcff('0x7b')]||!_0x4f7b33[_0xbcff('0x6c')]){throw new db[(_0xbcff('0x50'))][(_0xbcff('0x51'))]('Transcribe\x20not\x20configured');}if(_0x167c47[_0xbcff('0x45')][_0xbcff('0x7c')]&&(!_0x4f7b33[_0xbcff('0x7d')]||!_0x4f7b33[_0xbcff('0x7e')]||!_0x4f7b33[_0xbcff('0x7f')]||!_0x4f7b33[_0xbcff('0x7b')]||!_0x4f7b33['bucket'])){throw new db['Sequelize']['ValidationError'](_0xbcff('0x80'));}return db[_0xbcff('0x81')][_0xbcff('0x77')]({'where':{'id':_0x4f7b33[_0xbcff('0x82')]}});}})[_0xbcff('0x1e')](function(_0x4cfae7){if(!_0x4cfae7){throw new db[(_0xbcff('0x50'))]['ValidationError'](_0xbcff('0x83'));}if(!_0x4cfae7[_0xbcff('0x84')]||!_0x4cfae7[_0xbcff('0x85')]){throw new db[(_0xbcff('0x50'))][(_0xbcff('0x51'))]('Cloud\x20Provider\x20not\x20configured');}_0x319ef5=_0x4cfae7;return getBucketslist(_0x319ef5[_0xbcff('0x84')],_0x319ef5[_0xbcff('0x85')],_0x4f7b33[_0xbcff('0x7a')]);})[_0xbcff('0x1e')](function(_0x306cee){if(_0x306cee&&_0x306cee[_0xbcff('0x86')]){var _0x51a37c=_['find'](_0x306cee[_0xbcff('0x86')],function(_0x4e4fe0){return _0x4e4fe0[_0xbcff('0x87')]===_0x4f7b33['bucket'];});if(!_0x51a37c){logger[_0xbcff('0x60')](util[_0xbcff('0x4b')](_0xbcff('0x88'),_0x167c47[_0xbcff('0x42')]['id'],_0x4f7b33[_0xbcff('0x6c')]));return createBucket(_0x319ef5['data1'],_0x319ef5['data2'],_0x4f7b33[_0xbcff('0x7a')],_0x4f7b33[_0xbcff('0x6c')]);}logger[_0xbcff('0x60')](util[_0xbcff('0x4b')](_0xbcff('0x89'),_0x167c47['params']['id'],_0x4f7b33[_0xbcff('0x6c')]));return;}})[_0xbcff('0x1e')](function(_0x34df85){if(_0x19ab82[_0xbcff('0x74')]===_0xbcff('0x8a')){return transcribe(_0x167c47[_0xbcff('0x42')]['id'],_0x319ef5[_0xbcff('0x84')],_0x319ef5['data2'],_0x4f7b33['transcribeRegion'],_0x4f7b33['bucket'],_0x19ab82[_0xbcff('0x4a')],_0x4f7b33[_0xbcff('0x7b')]);}else{logger[_0xbcff('0x60')](util[_0xbcff('0x4b')](_0xbcff('0x8b'),_0x167c47[_0xbcff('0x42')]['id']));return{'transcribeStatus':_0xbcff('0x8c')};}})[_0xbcff('0x1e')](function(_0x5933bf){if(_0x5933bf){_0x5933bf[_0xbcff('0x8d')]=_0x167c47[_0xbcff('0x45')][_0xbcff('0x7c')];return _0x19ab82[_0xbcff('0x8e')](_0x5933bf);}})[_0xbcff('0x1e')](respondWithResult(_0x2afc28,null))[_0xbcff('0x40')](handleError(_0x2afc28,null));};function writeFile(_0x352024,_0x136948){return new Promise(function(_0x218d29,_0x4adbe1){fs[_0xbcff('0x8f')](_0x136948,_0x352024,function(_0x59e0d8,_0x54ff8a){if(_0x59e0d8){return _0x4adbe1(_0x59e0d8);}else{return _0x218d29(_0x54ff8a);}});});}exports[_0xbcff('0x90')]=function(_0x187e6f,_0x35fb73,_0x3c2654){return db[_0xbcff('0x25')][_0xbcff('0x77')]({'where':{'id':_0x187e6f[_0xbcff('0x42')]['id']}})[_0xbcff('0x1e')](handleEntityNotFound(_0x35fb73))['then'](function(_0xd90593){if(_0xd90593&&_0xd90593[_0xbcff('0x91')]){var _0x3f2496=_0xd90593[_0xbcff('0x91')];var _0x56f2af=config[_0xbcff('0x92')]+_0xbcff('0x93')+_0xd90593['id']+_0xbcff('0x94');if(fs[_0xbcff('0x4d')](_0x56f2af)){return _0x56f2af;}return writeFile(_0x3f2496,_0x56f2af)[_0xbcff('0x1e')](function(){return _0x56f2af;});}else{throw new db[(_0xbcff('0x50'))]['ValidationError'](_0xbcff('0x95'));}})['then'](function(_0x5ac83d){return _0x35fb73['download'](_0x5ac83d);})['catch'](handleError(_0x35fb73));}; \ No newline at end of file +var _0xfd1d=['existsSync','decryptFile','secrets','recording','value','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','Not\x20found','downloads','sequelize','MD5','col','$and','push','extname','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','unlinkSync','upload','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)','Location','bucket','Bucket','location','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJob','TranscriptionJobStatus','runTranscribe','findOne','Setting','transcribe','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','language','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','aws-sdk','uuid/v4','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','end','offset','undefined','count','limit','set','json','apply','save','update','then','destroy','error','stack','name','send','index','map','fieldName','key','model','differenceBy','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','VoiceRecording','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','describe','download','../../components/encryptor','uniqueid','format','%s.cypher'];(function(_0x5cfa4f,_0x4d8fe9){var _0x2e5acd=function(_0x474d1a){while(--_0x474d1a){_0x5cfa4f['push'](_0x5cfa4f['shift']());}};_0x2e5acd(++_0x4d8fe9);}(_0xfd1d,0x175));var _0xdfd1=function(_0x9160d8,_0x2c8959){_0x9160d8=_0x9160d8-0x0;var _0x4d61aa=_0xfd1d[_0x9160d8];return _0x4d61aa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdfd1('0x0'));var zipdir=require(_0xdfd1('0x1'));var jsonpatch=require(_0xdfd1('0x2'));var rp=require(_0xdfd1('0x3'));var moment=require('moment');var BPromise=require(_0xdfd1('0x4'));var Mustache=require('mustache');var util=require(_0xdfd1('0x5'));var path=require(_0xdfd1('0x6'));var sox=require(_0xdfd1('0x7'));var csv=require('to-csv');var ejs=require(_0xdfd1('0x8'));var fs=require('fs');var fs_extra=require(_0xdfd1('0x9'));var _=require(_0xdfd1('0xa'));var squel=require(_0xdfd1('0xb'));var crypto=require(_0xdfd1('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xdfd1('0xd'));var toCsv=require(_0xdfd1('0xe'));var querystring=require('querystring');var Papa=require(_0xdfd1('0xf'));var AWS=require(_0xdfd1('0x10'));var uuidv4=require(_0xdfd1('0x11'));var Redis=require(_0xdfd1('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xdfd1('0x13'));var as=require(_0xdfd1('0x14'));var hardwareService=require(_0xdfd1('0x15'));var logger=require('../../config/logger')(_0xdfd1('0x16'));var utils=require(_0xdfd1('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3083c3,_0x1c9748){_0x1c9748=_0x1c9748||0xcc;return function(_0x5503a6){if(_0x5503a6){return _0x3083c3[_0xdfd1('0x18')](_0x1c9748);}return _0x3083c3[_0xdfd1('0x19')](_0x1c9748)[_0xdfd1('0x1a')]();};}function respondWithResult(_0x531056,_0xeee6f){_0xeee6f=_0xeee6f||0xc8;return function(_0xcb8bef){if(_0xcb8bef){return _0x531056[_0xdfd1('0x19')](_0xeee6f)['json'](_0xcb8bef);}};}function respondWithFilteredResult(_0x4e1328,_0x4ef3b9){return function(_0x4d6a8b){if(_0x4d6a8b){var _0x58cbc0=typeof _0x4ef3b9[_0xdfd1('0x1b')]===_0xdfd1('0x1c')&&typeof _0x4ef3b9['limit']==='undefined';var _0x393c15=_0x4d6a8b[_0xdfd1('0x1d')];var _0x2e1e06=_0x58cbc0?0x0:_0x4ef3b9[_0xdfd1('0x1b')];var _0x142307=_0x58cbc0?_0x4d6a8b[_0xdfd1('0x1d')]:_0x4ef3b9[_0xdfd1('0x1b')]+_0x4ef3b9[_0xdfd1('0x1e')];var _0x39893c;if(_0x142307>=_0x393c15){_0x142307=_0x393c15;_0x39893c=0xc8;}else{_0x39893c=0xce;}_0x4e1328['status'](_0x39893c);return _0x4e1328[_0xdfd1('0x1f')]('Content-Range',_0x2e1e06+'-'+_0x142307+'/'+_0x393c15)[_0xdfd1('0x20')](_0x4d6a8b);}return null;};}function patchUpdates(_0x4e82ae){return function(_0x49d9b0){try{jsonpatch[_0xdfd1('0x21')](_0x49d9b0,_0x4e82ae,!![]);}catch(_0x36b4bb){return BPromise['reject'](_0x36b4bb);}return _0x49d9b0[_0xdfd1('0x22')]();};}function saveUpdates(_0x681e2b,_0xe6d121){return function(_0x46672c){if(_0x46672c){return _0x46672c[_0xdfd1('0x23')](_0x681e2b)[_0xdfd1('0x24')](function(_0x788ab0){return _0x788ab0;});}return null;};}function removeEntity(_0x18f4dc,_0x1ebeda){return function(_0x3140cb){if(_0x3140cb){return _0x3140cb[_0xdfd1('0x25')]()['then'](function(){_0x18f4dc[_0xdfd1('0x19')](0xcc)[_0xdfd1('0x1a')]();});}};}function handleEntityNotFound(_0x3179a6,_0x4dad40){return function(_0x1d99ba){if(!_0x1d99ba){_0x3179a6['sendStatus'](0x194);}return _0x1d99ba;};}function handleError(_0x3ed5a0,_0x4a937b){_0x4a937b=_0x4a937b||0x1f4;return function(_0x4ff284){logger[_0xdfd1('0x26')](_0x4ff284[_0xdfd1('0x27')]);if(_0x4ff284[_0xdfd1('0x28')]){delete _0x4ff284['name'];}_0x3ed5a0[_0xdfd1('0x19')](_0x4a937b)[_0xdfd1('0x29')](_0x4ff284);};}exports[_0xdfd1('0x2a')]=function(_0x43bdad,_0x949b85){var _0x28903c={},_0x4cc53a={},_0x40ed5b={'count':0x0,'rows':[]};var _0x5c8eba=_[_0xdfd1('0x2b')](db['VoiceRecording']['rawAttributes'],function(_0x4a9e5c){return{'name':_0x4a9e5c[_0xdfd1('0x2c')],'type':_0x4a9e5c['type'][_0xdfd1('0x2d')]};});_0x4cc53a[_0xdfd1('0x2e')]=_[_0xdfd1('0x2f')](_[_0xdfd1('0x2b')](_0x5c8eba,_0xdfd1('0x28')),['format']);_0x4cc53a[_0xdfd1('0x30')]=_[_0xdfd1('0x31')](_0x43bdad[_0xdfd1('0x30')]);_0x4cc53a['filters']=_[_0xdfd1('0x32')](_0x4cc53a[_0xdfd1('0x2e')],_0x4cc53a[_0xdfd1('0x30')]);_0x28903c[_0xdfd1('0x33')]=_[_0xdfd1('0x32')](_0x4cc53a[_0xdfd1('0x2e')],qs['fields'](_0x43bdad[_0xdfd1('0x30')][_0xdfd1('0x34')]));_0x28903c['attributes']=_0x28903c[_0xdfd1('0x33')][_0xdfd1('0x35')]?_0x28903c[_0xdfd1('0x33')]:_0x4cc53a[_0xdfd1('0x2e')];if(!_0x43bdad[_0xdfd1('0x30')]['hasOwnProperty'](_0xdfd1('0x36'))){_0x28903c['limit']=qs[_0xdfd1('0x1e')](_0x43bdad[_0xdfd1('0x30')][_0xdfd1('0x1e')]);_0x28903c[_0xdfd1('0x1b')]=qs[_0xdfd1('0x1b')](_0x43bdad['query'][_0xdfd1('0x1b')]);}_0x28903c[_0xdfd1('0x37')]=qs[_0xdfd1('0x38')](_0x43bdad['query'][_0xdfd1('0x38')]);_0x28903c[_0xdfd1('0x39')]=qs[_0xdfd1('0x3a')](_[_0xdfd1('0x3b')](_0x43bdad['query'],_0x4cc53a[_0xdfd1('0x3a')]),_0x5c8eba);if(_0x43bdad['query'][_0xdfd1('0x3c')]){_0x28903c[_0xdfd1('0x39')]=_[_0xdfd1('0x3d')](_0x28903c[_0xdfd1('0x39')],{'$or':_[_0xdfd1('0x2b')](_0x5c8eba,function(_0x14c5a4){if(_0x14c5a4[_0xdfd1('0x3e')]!==_0xdfd1('0x3f')){var _0x2f2f34={};_0x2f2f34[_0x14c5a4[_0xdfd1('0x28')]]={'$like':'%'+_0x43bdad[_0xdfd1('0x30')][_0xdfd1('0x3c')]+'%'};return _0x2f2f34;}})});}_0x28903c=_[_0xdfd1('0x3d')]({},_0x28903c,_0x43bdad[_0xdfd1('0x40')]);var _0x4dbe6f={'where':_0x28903c[_0xdfd1('0x39')]};return db[_0xdfd1('0x41')][_0xdfd1('0x1d')](_0x4dbe6f)[_0xdfd1('0x24')](function(_0xfa35ff){_0x40ed5b[_0xdfd1('0x1d')]=_0xfa35ff;if(_0x43bdad[_0xdfd1('0x30')][_0xdfd1('0x42')]){_0x28903c[_0xdfd1('0x43')]=[{'all':!![]}];}return db[_0xdfd1('0x41')][_0xdfd1('0x44')](_0x28903c);})[_0xdfd1('0x24')](function(_0x2b3a41){_0x40ed5b[_0xdfd1('0x45')]=_0x2b3a41;return _0x40ed5b;})[_0xdfd1('0x24')](respondWithFilteredResult(_0x949b85,_0x28903c))[_0xdfd1('0x46')](handleError(_0x949b85,null));};exports[_0xdfd1('0x47')]=function(_0x292491,_0x3c3eec){var _0xb13ae={'raw':![],'where':{'id':_0x292491['params']['id']}},_0x4c320e={};_0x4c320e['model']=_[_0xdfd1('0x31')](db['VoiceRecording'][_0xdfd1('0x48')]);_0x4c320e[_0xdfd1('0x30')]=_[_0xdfd1('0x31')](_0x292491[_0xdfd1('0x30')]);_0x4c320e[_0xdfd1('0x3a')]=_[_0xdfd1('0x32')](_0x4c320e[_0xdfd1('0x2e')],_0x4c320e[_0xdfd1('0x30')]);_0xb13ae[_0xdfd1('0x33')]=_[_0xdfd1('0x32')](_0x4c320e[_0xdfd1('0x2e')],qs[_0xdfd1('0x34')](_0x292491[_0xdfd1('0x30')]['fields']));_0xb13ae[_0xdfd1('0x33')]=_0xb13ae[_0xdfd1('0x33')][_0xdfd1('0x35')]?_0xb13ae['attributes']:_0x4c320e[_0xdfd1('0x2e')];if(_0x292491[_0xdfd1('0x30')][_0xdfd1('0x42')]){_0xb13ae[_0xdfd1('0x43')]=[{'all':!![]}];}_0xb13ae=_['merge']({},_0xb13ae,_0x292491[_0xdfd1('0x40')]);return db[_0xdfd1('0x41')][_0xdfd1('0x49')](_0xb13ae)[_0xdfd1('0x24')](handleEntityNotFound(_0x3c3eec,null))[_0xdfd1('0x24')](respondWithResult(_0x3c3eec,null))[_0xdfd1('0x46')](handleError(_0x3c3eec,null));};exports[_0xdfd1('0x4a')]=function(_0xa654aa,_0x27ae2e){return db[_0xdfd1('0x41')]['create'](_0xa654aa[_0xdfd1('0x4b')],{})[_0xdfd1('0x24')](respondWithResult(_0x27ae2e,0xc9))[_0xdfd1('0x46')](handleError(_0x27ae2e,null));};exports[_0xdfd1('0x23')]=function(_0x4f69e3,_0x13f6a1){if(_0x4f69e3[_0xdfd1('0x4b')]['id']){delete _0x4f69e3[_0xdfd1('0x4b')]['id'];}return db['VoiceRecording'][_0xdfd1('0x49')]({'where':{'id':_0x4f69e3[_0xdfd1('0x4c')]['id']}})[_0xdfd1('0x24')](handleEntityNotFound(_0x13f6a1,null))[_0xdfd1('0x24')](saveUpdates(_0x4f69e3['body'],null))[_0xdfd1('0x24')](respondWithResult(_0x13f6a1,null))[_0xdfd1('0x46')](handleError(_0x13f6a1,null));};exports[_0xdfd1('0x4d')]=function(_0x52e02d,_0x26d615){return db[_0xdfd1('0x41')][_0xdfd1('0x4d')]()['then'](respondWithResult(_0x26d615,null))[_0xdfd1('0x46')](handleError(_0x26d615,null));};exports[_0xdfd1('0x4e')]=function(_0x5d066c,_0x19d6a5,_0x53892f){var _0x20b4ef=require(_0xdfd1('0x4f'));var _0x1caaa0=![];var _0x2e3aaa={};if(_0x5d066c[_0xdfd1('0x30')][_0xdfd1('0x3e')]&&_0x5d066c[_0xdfd1('0x30')][_0xdfd1('0x3e')]===_0xdfd1('0x50')){_0x2e3aaa[_0xdfd1('0x50')]=_0x5d066c[_0xdfd1('0x4c')]['id'];}else{_0x2e3aaa['id']=_0x5d066c[_0xdfd1('0x4c')]['id'];}return db['VoiceRecording'][_0xdfd1('0x49')]({'where':_0x2e3aaa,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x19d6a5,null))['then'](function(_0x157b2d){if(_0x157b2d){var _0x2e1451=_0x157b2d['value'];var _0x242a14=util[_0xdfd1('0x51')](_0xdfd1('0x52'),_0x2e1451);if(fs[_0xdfd1('0x53')](_0x242a14)){_0x1caaa0=!![];return _0x20b4ef[_0xdfd1('0x54')](_0x242a14,_0x2e1451,config[_0xdfd1('0x55')][_0xdfd1('0x56')])[_0xdfd1('0x24')](function(){return _0x157b2d;});}return _0x157b2d;}})[_0xdfd1('0x24')](function(_0x3e395a){if(_0x3e395a){var _0x3edd09=_0x3e395a[_0xdfd1('0x57')];if(!fs[_0xdfd1('0x53')](_0x3edd09)){throw new db[(_0xdfd1('0x58'))][(_0xdfd1('0x59'))](_0xdfd1('0x5a'));}if(_0x3e395a[_0xdfd1('0x5b')]){return _0x19d6a5[_0xdfd1('0x4e')](_0x3edd09,_0x3e395a['filename']+path['extname'](_0x3edd09),function(){if(_0x1caaa0){fs[_0xdfd1('0x5c')](_0x3edd09);}});}else{return _0x19d6a5[_0xdfd1('0x4e')](_0x3edd09,function(_0x4d19e4){if(_0x1caaa0){fs[_0xdfd1('0x5c')](_0x3edd09);}});}}})[_0xdfd1('0x46')](function(_0x2cc842){if(_0x2cc842['message']===_0xdfd1('0x5a')){_0x19d6a5[_0xdfd1('0x19')](0x194)['send'](_0xdfd1('0x5d'));}else{return handleError(_0x19d6a5,null);}});};exports[_0xdfd1('0x5e')]=function(_0x5ae2e4,_0x42bf2c,_0x19a88c){var _0x79849a=require(_0xdfd1('0x4f'));var _0x5c5972=![];var _0x28a428={'$and':[db['sequelize'][_0xdfd1('0x39')](db[_0xdfd1('0x5f')]['fn'](_0xdfd1('0x60'),db[_0xdfd1('0x5f')][_0xdfd1('0x61')](_0xdfd1('0x50'))),_0x5ae2e4['query']['token'])]};if(_0x5ae2e4['query'][_0xdfd1('0x3e')]&&_0x5ae2e4[_0xdfd1('0x30')][_0xdfd1('0x3e')]===_0xdfd1('0x50')){_0x28a428[_0xdfd1('0x62')][_0xdfd1('0x63')]({'uniqueid':_0x5ae2e4[_0xdfd1('0x4c')]['id']});}else{_0x28a428[_0xdfd1('0x62')]['push']({'id':_0x5ae2e4['params']['id']});}return db['VoiceRecording'][_0xdfd1('0x49')]({'where':_0x28a428,'attributes':['id',_0xdfd1('0x57')],'raw':!![]})[_0xdfd1('0x24')](handleEntityNotFound(_0x42bf2c,null))[_0xdfd1('0x24')](function(_0x1b2de0){if(_0x1b2de0){var _0x345bc7=util[_0xdfd1('0x51')](_0xdfd1('0x52'),_0x1b2de0[_0xdfd1('0x57')]);if(fs[_0xdfd1('0x53')](_0x345bc7)){_0x5c5972=!![];return _0x79849a[_0xdfd1('0x54')](_0x345bc7,_0x1b2de0['value'],config[_0xdfd1('0x55')][_0xdfd1('0x56')])['then'](function(){return _0x1b2de0;});}return _0x1b2de0;}})[_0xdfd1('0x24')](function(_0x440162){if(_0x440162){if(!fs[_0xdfd1('0x53')](_0x440162[_0xdfd1('0x57')])){throw new db[(_0xdfd1('0x58'))][(_0xdfd1('0x59'))](_0xdfd1('0x5a'));}if(_0x440162[_0xdfd1('0x5b')]){return _0x42bf2c[_0xdfd1('0x4e')](_0x440162['value'],_0x440162[_0xdfd1('0x5b')]+path[_0xdfd1('0x64')](_0x440162['value']),function(){if(_0x5c5972){fs[_0xdfd1('0x5c')](_0x440162['value']);}});}else{return _0x42bf2c['download'](_0x440162['value'],function(_0x384c5f){if(_0x5c5972){fs[_0xdfd1('0x5c')](_0x440162[_0xdfd1('0x57')]);}});}}})['catch'](handleError(_0x42bf2c,null));};exports[_0xdfd1('0x25')]=function(_0x5048f3,_0xacb470){return db[_0xdfd1('0x41')]['find']({'where':{'id':_0x5048f3['params']['id']}})['then'](function(_0x1626f5){if(_[_0xdfd1('0x65')](_0x1626f5)){throw new ReferenceError(_0xdfd1('0x66'));}return _0x1626f5;})[_0xdfd1('0x24')](function(_0x568430){var _0x47f375=_0x568430['value'];logger['info'](_0xdfd1('0x67'),_0x47f375);if(!_[_0xdfd1('0x65')](_0x568430['value'])&&fs[_0xdfd1('0x53')](_0x47f375)){logger[_0xdfd1('0x68')](_0xdfd1('0x69')+_0x47f375+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x47f375);}_0x47f375=_0x47f375+'.cypher';if(!_[_0xdfd1('0x65')](_0x568430[_0xdfd1('0x57')])&&fs[_0xdfd1('0x53')](_0x47f375)){logger[_0xdfd1('0x68')](_0xdfd1('0x69')+_0x47f375+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xdfd1('0x6a')](_0x47f375);}return _0x568430;})['then'](function(_0x2ba534){if(!_0x2ba534)throw new InternalError();return _0x2ba534[_0xdfd1('0x25')]();})['then'](function(){_0xacb470[_0xdfd1('0x19')](0xcc)[_0xdfd1('0x1a')]();})[_0xdfd1('0x46')](handleError(_0xacb470,null));};function getBucketslist(_0x1e097d,_0x4d5b18,_0x4ca1b3){return new Promise(function(_0x13dab0,_0x5c0203){var _0x4bcddd=new AWS['S3']({'accessKeyId':_0x4d5b18,'secretAccessKey':_0x1e097d,'region':_0x4ca1b3});_0x4bcddd['listBuckets']({},function(_0x43dd32,_0x24c8de){if(_0x43dd32){return _0x5c0203(_0x43dd32);}else{return _0x13dab0(_0x24c8de);}});});}function createBucket(_0x4606ea,_0x431e30,_0x33206a,_0x35bbeb){return new Promise(function(_0x244e28,_0x4ee88c){var _0x49b342=new AWS['S3']({'accessKeyId':_0x431e30,'secretAccessKey':_0x4606ea,'region':_0x33206a});_0x49b342['createBucket']({'Bucket':_0x35bbeb},function(_0x5bfa98,_0x12fc0a){if(_0x5bfa98){return _0x4ee88c(_0x5bfa98);}else{return _0x244e28(_0x12fc0a);}});});}function uploadFile(_0x16900e,_0x198179,_0x3cbff1,_0x3f6746,_0x6fc395,_0x130226){return new Promise(function(_0x1e9551,_0x4fd109){var _0x369374=new AWS['S3']({'accessKeyId':_0x198179,'secretAccessKey':_0x16900e,'region':_0x3cbff1});_0x369374[_0xdfd1('0x6b')]({'Bucket':_0x3f6746,'Key':_0x6fc395,'Body':_0x130226},function(_0x2571f7,_0x370668){if(_0x2571f7){return _0x4fd109(_0x2571f7);}else{return _0x1e9551(_0x370668);}});});}function startTranscribe(_0x5668ef,_0x2fc631,_0x4d4645,_0x2e2505,_0x5b0653,_0x5d9677){return new Promise(function(_0x3a1e5c,_0x2f8def){var _0x13d49d=new AWS[(_0xdfd1('0x6c'))]({'accessKeyId':_0x2fc631,'secretAccessKey':_0x5668ef,'region':_0x4d4645});_0x13d49d[_0xdfd1('0x6d')]({'TranscriptionJobName':_0x2e2505,'LanguageCode':_0x5b0653,'Media':{'MediaFileUri':_0x5d9677}},function(_0x19cb46,_0x25a9a9){if(_0x19cb46){return _0x2f8def(_0x19cb46);}else{return _0x3a1e5c(_0x25a9a9);}});});}function transcribe(_0x1f2244,_0x45cdc6,_0x36e5f3,_0xf7419e,_0x2c5ee1,_0x29c37f,_0x12d17e){return new Promise(function(_0x47d6a2,_0x4742d9){var _0x56d853={};logger[_0xdfd1('0x68')](util[_0xdfd1('0x51')](_0xdfd1('0x6e'),_0x1f2244,_0x2c5ee1));return uploadFile(_0x45cdc6,_0x36e5f3,_0xf7419e,_0x2c5ee1,path[_0xdfd1('0x6f')](_0x29c37f),fs[_0xdfd1('0x70')](_0x29c37f))[_0xdfd1('0x24')](function(_0xc00f93){logger['info'](util[_0xdfd1('0x51')](_0xdfd1('0x71'),_0x1f2244,_0x2c5ee1,_0xc00f93[_0xdfd1('0x72')]));_0x56d853[_0xdfd1('0x73')]=_0xc00f93[_0xdfd1('0x74')];_0x56d853[_0xdfd1('0x75')]=_0xc00f93[_0xdfd1('0x72')];logger['info'](util[_0xdfd1('0x51')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x1f2244));return startTranscribe(_0x45cdc6,_0x36e5f3,_0xf7419e,uuidv4(),_0x12d17e,_0xc00f93[_0xdfd1('0x72')]);})[_0xdfd1('0x24')](function(_0x1ac964){logger['info'](util[_0xdfd1('0x51')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x1f2244,_0x1ac964['TranscriptionJob'][_0xdfd1('0x76')]));_0x56d853[_0xdfd1('0x77')]=_0x1ac964['TranscriptionJob'][_0xdfd1('0x76')];_0x56d853[_0xdfd1('0x78')]=_0x1ac964[_0xdfd1('0x79')][_0xdfd1('0x7a')];return _0x47d6a2(_0x56d853);})[_0xdfd1('0x46')](function(_0x2c9d09){return _0x4742d9(_0x2c9d09);});});}exports[_0xdfd1('0x7b')]=function(_0x3d1154,_0x37724a,_0x5c4c36){var _0x47b496;var _0x3503b8;var _0x1d6fc2;var _0x4eae59=require(_0xdfd1('0x4f'));return db[_0xdfd1('0x41')][_0xdfd1('0x7c')]({'where':{'id':_0x3d1154['params']['id']}})[_0xdfd1('0x24')](function(_0x3acbea){if(_0x3acbea){var _0x272738=util['format']('%s.cypher',_0x3acbea['value']);if(fs['existsSync'](_0x272738)){cypher=!![];return _0x4eae59[_0xdfd1('0x54')](_0x272738,_0x3acbea[_0xdfd1('0x57')],config[_0xdfd1('0x55')][_0xdfd1('0x56')])['then'](function(){return _0x3acbea;});}return _0x3acbea;}})[_0xdfd1('0x24')](function(_0x4c055e){if(!_0x4c055e){throw new db[(_0xdfd1('0x58'))][(_0xdfd1('0x59'))]('Voice\x20Recording\x20not\x20found');}_0x3503b8=_0x4c055e;return db[_0xdfd1('0x7d')][_0xdfd1('0x7c')]({'where':{'id':0x1}});})[_0xdfd1('0x24')](handleEntityNotFound(_0x37724a,null))[_0xdfd1('0x24')](function(_0x3caa04){if(_0x3caa04){_0x47b496=_0x3caa04;if(!_0x47b496[_0xdfd1('0x7e')]||!_0x47b496[_0xdfd1('0x7f')]||!_0x47b496[_0xdfd1('0x80')]||!_0x47b496['language']||!_0x47b496[_0xdfd1('0x73')]){throw new db[(_0xdfd1('0x58'))][(_0xdfd1('0x59'))](_0xdfd1('0x81'));}if(_0x3d1154[_0xdfd1('0x4b')][_0xdfd1('0x82')]&&(!_0x47b496[_0xdfd1('0x83')]||!_0x47b496[_0xdfd1('0x84')]||!_0x47b496['sentimentRegion']||!_0x47b496['language']||!_0x47b496[_0xdfd1('0x73')])){throw new db['Sequelize'][(_0xdfd1('0x59'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0xdfd1('0x85')][_0xdfd1('0x7c')]({'where':{'id':_0x47b496['transcribeAccountId']}});}})[_0xdfd1('0x24')](function(_0x391448){if(!_0x391448){throw new db[(_0xdfd1('0x58'))][(_0xdfd1('0x59'))](_0xdfd1('0x86'));}if(!_0x391448[_0xdfd1('0x87')]||!_0x391448[_0xdfd1('0x88')]){throw new db['Sequelize']['ValidationError'](_0xdfd1('0x89'));}_0x1d6fc2=_0x391448;return getBucketslist(_0x1d6fc2[_0xdfd1('0x87')],_0x1d6fc2[_0xdfd1('0x88')],_0x47b496['transcribeRegion']);})[_0xdfd1('0x24')](function(_0x3409e3){if(_0x3409e3&&_0x3409e3[_0xdfd1('0x8a')]){var _0x5c861f=_['find'](_0x3409e3['Buckets'],function(_0x5e9754){return _0x5e9754[_0xdfd1('0x8b')]===_0x47b496[_0xdfd1('0x73')];});if(!_0x5c861f){logger[_0xdfd1('0x68')](util['format'](_0xdfd1('0x8c'),_0x3d1154[_0xdfd1('0x4c')]['id'],_0x47b496[_0xdfd1('0x73')]));return createBucket(_0x1d6fc2[_0xdfd1('0x87')],_0x1d6fc2[_0xdfd1('0x88')],_0x47b496[_0xdfd1('0x80')],_0x47b496[_0xdfd1('0x73')]);}logger['info'](util[_0xdfd1('0x51')](_0xdfd1('0x8d'),_0x3d1154[_0xdfd1('0x4c')]['id'],_0x47b496[_0xdfd1('0x73')]));return;}})[_0xdfd1('0x24')](function(_0x558c7a){if(_0x3503b8[_0xdfd1('0x78')]==='NEW'){return transcribe(_0x3d1154[_0xdfd1('0x4c')]['id'],_0x1d6fc2[_0xdfd1('0x87')],_0x1d6fc2[_0xdfd1('0x88')],_0x47b496[_0xdfd1('0x80')],_0x47b496['bucket'],_0x3503b8[_0xdfd1('0x57')],_0x47b496[_0xdfd1('0x8e')]);}else{logger[_0xdfd1('0x68')](util[_0xdfd1('0x51')](_0xdfd1('0x8f'),_0x3d1154[_0xdfd1('0x4c')]['id']));return{'transcribeStatus':_0xdfd1('0x90')};}})['then'](function(_0x405cf4){if(_0x405cf4){_0x405cf4['tempSentiment']=_0x3d1154[_0xdfd1('0x4b')][_0xdfd1('0x82')];return _0x3503b8[_0xdfd1('0x91')](_0x405cf4);}})[_0xdfd1('0x24')](respondWithResult(_0x37724a,null))[_0xdfd1('0x46')](handleError(_0x37724a,null));};function writeFile(_0x4fab60,_0x23290c){return new Promise(function(_0x5b75d2,_0x36fc8f){fs[_0xdfd1('0x92')](_0x23290c,_0x4fab60,function(_0x17ae35,_0x180613){if(_0x17ae35){return _0x36fc8f(_0x17ae35);}else{return _0x5b75d2(_0x180613);}});});}exports[_0xdfd1('0x93')]=function(_0x3a9446,_0xc90d36,_0x3cec43){return db['VoiceRecording'][_0xdfd1('0x7c')]({'where':{'id':_0x3a9446[_0xdfd1('0x4c')]['id']}})[_0xdfd1('0x24')](handleEntityNotFound(_0xc90d36))[_0xdfd1('0x24')](function(_0x1a403f){if(_0x1a403f&&_0x1a403f[_0xdfd1('0x94')]){var _0x3f0157=_0x1a403f[_0xdfd1('0x94')];var _0x4d99c1=config[_0xdfd1('0x95')]+_0xdfd1('0x96')+_0x1a403f['id']+'.txt';if(fs[_0xdfd1('0x53')](_0x4d99c1)){return _0x4d99c1;}return writeFile(_0x3f0157,_0x4d99c1)[_0xdfd1('0x24')](function(){return _0x4d99c1;});}else{throw new db[(_0xdfd1('0x58'))][(_0xdfd1('0x59'))](_0xdfd1('0x97'));}})[_0xdfd1('0x24')](function(_0x31b220){return _0xc90d36[_0xdfd1('0x4e')](_0x31b220);})['catch'](handleError(_0xc90d36));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index ac6e5a4..245ab8d 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 _0x9a19=['voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','exports','define','VoiceRecording'];(function(_0x16eb11,_0x1a2251){var _0x3ae7ef=function(_0x575a01){while(--_0x575a01){_0x16eb11['push'](_0x16eb11['shift']());}};_0x3ae7ef(++_0x1a2251);}(_0x9a19,0x114));var _0x99a1=function(_0x5581ba,_0x268887){_0x5581ba=_0x5581ba-0x0;var _0x1e927f=_0x9a19[_0x5581ba];return _0x1e927f;};'use strict';var attributes=require(_0x99a1('0x0'));module[_0x99a1('0x1')]=function(_0x3d860b,_0x51ef2b){return _0x3d860b[_0x99a1('0x2')](_0x99a1('0x3'),attributes,{'tableName':_0x99a1('0x4'),'paranoid':![],'indexes':[{'name':_0x99a1('0x5'),'fields':[_0x99a1('0x5')]},{'name':_0x99a1('0x6'),'fields':[_0x99a1('0x6')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fc7=['define','VoiceRecording','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','exports'];(function(_0x2230b6,_0xa8d79a){var _0x1dee6b=function(_0x3669a8){while(--_0x3669a8){_0x2230b6['push'](_0x2230b6['shift']());}};_0x1dee6b(++_0xa8d79a);}(_0x5fc7,0x1e1));var _0x75fc=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0x5fc7[_0x58e469];return _0x4c01c5;};'use strict';var attributes=require(_0x75fc('0x0'));module[_0x75fc('0x1')]=function(_0x13ae0d,_0x2ea392){return _0x13ae0d[_0x75fc('0x2')](_0x75fc('0x3'),attributes,{'tableName':_0x75fc('0x4'),'paranoid':![],'indexes':[{'name':_0x75fc('0x5'),'fields':[_0x75fc('0x5')]},{'name':_0x75fc('0x6'),'fields':[_0x75fc('0x6')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 0915bc7..3df972e 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 _0xef0f=['CreateVoiceRecording','Setting','findOne','callRecordingEncryption','create','body','value','%s.cypher','unlink','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','options','raw','attributes'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0xef0f,0x168));var _0xfef0=function(_0x84f0b5,_0x151f34){_0x84f0b5=_0x84f0b5-0x0;var _0x2e6958=_0xef0f[_0x84f0b5];return _0x2e6958;};'use strict';var _=require(_0xfef0('0x0'));var util=require('util');var moment=require(_0xfef0('0x1'));var BPromise=require(_0xfef0('0x2'));var rs=require(_0xfef0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfef0('0x4'))['db'];var utils=require(_0xfef0('0x5'));var logger=require(_0xfef0('0x6'))('rpc');var config=require(_0xfef0('0x7'));var jayson=require(_0xfef0('0x8'));var client=jayson[_0xfef0('0x9')][_0xfef0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xad43e,_0x11dfd7,_0x5130bd){return new BPromise(function(_0x41ec94,_0x58cf6d){return client[_0xfef0('0xb')](_0xad43e,_0x5130bd)[_0xfef0('0xc')](function(_0x3a81cc){logger[_0xfef0('0xd')](_0xfef0('0xe'),_0x11dfd7,_0xfef0('0xf'));logger[_0xfef0('0x10')](_0xfef0('0x11'),_0x11dfd7,_0xfef0('0xf'),JSON[_0xfef0('0x12')](_0x3a81cc));if(_0x3a81cc[_0xfef0('0x13')]){if(_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x14')]===0x1f4){logger[_0xfef0('0x13')]('VoiceRecording,\x20%s,\x20%s',_0x11dfd7,_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x15')]);return _0x58cf6d(_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x15')]);}logger[_0xfef0('0x13')](_0xfef0('0xe'),_0x11dfd7,_0x3a81cc[_0xfef0('0x13')]['message']);return _0x41ec94(_0x3a81cc[_0xfef0('0x13')]['message']);}else{logger['info']('VoiceRecording,\x20%s,\x20%s',_0x11dfd7,_0xfef0('0xf'));_0x41ec94(_0x3a81cc[_0xfef0('0x16')][_0xfef0('0x15')]);}})[_0xfef0('0x17')](function(_0x2a96d9){logger[_0xfef0('0x13')](_0xfef0('0xe'),_0x11dfd7,_0x2a96d9);_0x58cf6d(_0x2a96d9);});});}exports[_0xfef0('0x18')]=function(_0x581459){var _0xd60678=this;return new Promise(function(_0x1642cd,_0x1577fa){return db[_0xfef0('0x19')][_0xfef0('0x1a')](_0x581459['body'],{'raw':_0x581459[_0xfef0('0x1b')]?_0x581459['options'][_0xfef0('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x581459[_0xfef0('0x1b')]?_0x581459[_0xfef0('0x1b')]['where']||null:null,'attributes':_0x581459[_0xfef0('0x1b')]?_0x581459['options'][_0xfef0('0x1d')]||null:null,'limit':_0x581459[_0xfef0('0x1b')]?_0x581459['options']['limit']||null:null})['then'](function(_0x19fde8){logger['info'](_0xfef0('0x18'),_0x581459);logger[_0xfef0('0x10')](_0xfef0('0x18'),_0x581459,JSON[_0xfef0('0x12')](_0x19fde8));_0x1642cd(_0x19fde8);})[_0xfef0('0x17')](function(_0xd687ed){logger['error']('UpdateVoiceRecording',_0xd687ed[_0xfef0('0x15')],_0x581459);_0x1577fa(_0xd60678[_0xfef0('0x13')](0x1f4,_0xd687ed[_0xfef0('0x15')]));});});};exports[_0xfef0('0x1e')]=function(_0xab231c){var _0xf60f2=this;return new Promise(function(_0x5df04f,_0x168b98){var _0x391279=require('../../components/encryptor');var _0x1a6758;return db[_0xfef0('0x1f')][_0xfef0('0x20')]({'attributes':['id',_0xfef0('0x21')],'where':{'id':0x1},'raw':!![]})[_0xfef0('0xc')](function(_0x1ac4a3){_0x1a6758=_0x1ac4a3;return db[_0xfef0('0x19')][_0xfef0('0x22')](_0xab231c[_0xfef0('0x23')]);})[_0xfef0('0xc')](function(_0x3ee42f){if(_0x1a6758[_0xfef0('0x21')]&&fs['existsSync'](_0x3ee42f[_0xfef0('0x24')])){var _0x5806bd=util['format'](_0xfef0('0x25'),_0x3ee42f[_0xfef0('0x24')]);return _0x391279['encryptFile'](_0x3ee42f['value'],_0x5806bd,config['secrets']['recording'])['then'](function(){fs[_0xfef0('0x26')](_0x3ee42f[_0xfef0('0x24')]);logger[_0xfef0('0xd')]('CreateVoiceRecording\x20file\x20encrypted');return _0x3ee42f;});}return _0x3ee42f;})['then'](function(_0x50430e){logger[_0xfef0('0xd')]('CreateVoiceRecording',_0xab231c);logger[_0xfef0('0x10')](_0xfef0('0x1e'),_0xab231c,JSON[_0xfef0('0x12')](_0x50430e));_0x5df04f(_0x50430e);})['catch'](function(_0x3cad13){logger['error'](_0xfef0('0x1e'),_0x3cad13[_0xfef0('0x15')],_0xab231c);_0x168b98(_0xf60f2[_0xfef0('0x13')](0x1f4,_0x3cad13[_0xfef0('0x15')]));});});}; \ No newline at end of file +var _0x4991=['where','attributes','limit','catch','VoiceRecording','create','existsSync','value','%s.cypher','secrets','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceRecording,\x20%s,\x20%s','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','UpdateVoiceRecording','update','body','options','raw'];(function(_0x49f15e,_0xf21a58){var _0x2ecce3=function(_0x20803d){while(--_0x20803d){_0x49f15e['push'](_0x49f15e['shift']());}};_0x2ecce3(++_0xf21a58);}(_0x4991,0xf7));var _0x1499=function(_0x33e855,_0x15e4ab){_0x33e855=_0x33e855-0x0;var _0x277f04=_0x4991[_0x33e855];return _0x277f04;};'use strict';var _=require(_0x1499('0x0'));var util=require('util');var moment=require(_0x1499('0x1'));var BPromise=require('bluebird');var rs=require(_0x1499('0x2'));var fs=require('fs');var Redis=require(_0x1499('0x3'));var db=require(_0x1499('0x4'))['db'];var utils=require(_0x1499('0x5'));var logger=require(_0x1499('0x6'))(_0x1499('0x7'));var config=require(_0x1499('0x8'));var jayson=require(_0x1499('0x9'));var client=jayson['client'][_0x1499('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c3bd7,_0x1c65c3,_0x33b261){return new BPromise(function(_0x133bae,_0x380e48){return client[_0x1499('0xb')](_0x1c3bd7,_0x33b261)[_0x1499('0xc')](function(_0x48d2ca){logger[_0x1499('0xd')](_0x1499('0xe'),_0x1c65c3,'request\x20sent');logger[_0x1499('0xf')](_0x1499('0x10'),_0x1c65c3,'request\x20sent',JSON[_0x1499('0x11')](_0x48d2ca));if(_0x48d2ca[_0x1499('0x12')]){if(_0x48d2ca['error']['code']===0x1f4){logger['error'](_0x1499('0xe'),_0x1c65c3,_0x48d2ca[_0x1499('0x12')][_0x1499('0x13')]);return _0x380e48(_0x48d2ca[_0x1499('0x12')][_0x1499('0x13')]);}logger['error']('VoiceRecording,\x20%s,\x20%s',_0x1c65c3,_0x48d2ca[_0x1499('0x12')]['message']);return _0x133bae(_0x48d2ca[_0x1499('0x12')][_0x1499('0x13')]);}else{logger[_0x1499('0xd')](_0x1499('0xe'),_0x1c65c3,'request\x20sent');_0x133bae(_0x48d2ca[_0x1499('0x14')][_0x1499('0x13')]);}})['catch'](function(_0x25164c){logger[_0x1499('0x12')](_0x1499('0xe'),_0x1c65c3,_0x25164c);_0x380e48(_0x25164c);});});}exports[_0x1499('0x15')]=function(_0x1e45a9){var _0x27e533=this;return new Promise(function(_0x5b9859,_0x541477){return db['VoiceRecording'][_0x1499('0x16')](_0x1e45a9[_0x1499('0x17')],{'raw':_0x1e45a9['options']?_0x1e45a9[_0x1499('0x18')][_0x1499('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e45a9[_0x1499('0x18')]?_0x1e45a9[_0x1499('0x18')][_0x1499('0x1a')]||null:null,'attributes':_0x1e45a9[_0x1499('0x18')]?_0x1e45a9[_0x1499('0x18')][_0x1499('0x1b')]||null:null,'limit':_0x1e45a9[_0x1499('0x18')]?_0x1e45a9[_0x1499('0x18')][_0x1499('0x1c')]||null:null})[_0x1499('0xc')](function(_0x223f4c){logger[_0x1499('0xd')](_0x1499('0x15'),_0x1e45a9);logger[_0x1499('0xf')](_0x1499('0x15'),_0x1e45a9,JSON['stringify'](_0x223f4c));_0x5b9859(_0x223f4c);})[_0x1499('0x1d')](function(_0xc79f69){logger[_0x1499('0x12')](_0x1499('0x15'),_0xc79f69[_0x1499('0x13')],_0x1e45a9);_0x541477(_0x27e533[_0x1499('0x12')](0x1f4,_0xc79f69['message']));});});};exports['CreateVoiceRecording']=function(_0x12739b){var _0x3c9aca=this;return new Promise(function(_0x3b9259,_0x50f0cc){var _0x32782a=require('../../components/encryptor');var _0x3e5ed1;return db['Setting']['findOne']({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x1499('0xc')](function(_0x103efa){_0x3e5ed1=_0x103efa;return db[_0x1499('0x1e')][_0x1499('0x1f')](_0x12739b[_0x1499('0x17')]);})[_0x1499('0xc')](function(_0x3dd534){if(_0x3e5ed1['callRecordingEncryption']&&fs[_0x1499('0x20')](_0x3dd534[_0x1499('0x21')])){var _0x39995b=util['format'](_0x1499('0x22'),_0x3dd534[_0x1499('0x21')]);return _0x32782a['encryptFile'](_0x3dd534[_0x1499('0x21')],_0x39995b,config[_0x1499('0x23')]['recording'])[_0x1499('0xc')](function(){fs[_0x1499('0x24')](_0x3dd534[_0x1499('0x21')]);logger[_0x1499('0xd')](_0x1499('0x25'));return _0x3dd534;});}return _0x3dd534;})[_0x1499('0xc')](function(_0x7b4d75){logger[_0x1499('0xd')](_0x1499('0x26'),_0x12739b);logger[_0x1499('0xf')](_0x1499('0x26'),_0x12739b,JSON[_0x1499('0x11')](_0x7b4d75));_0x3b9259(_0x7b4d75);})[_0x1499('0x1d')](function(_0x3f4c1a){logger[_0x1499('0x12')](_0x1499('0x26'),_0x3f4c1a[_0x1499('0x13')],_0x12739b);_0x50f0cc(_0x3c9aca[_0x1499('0x12')](0x1f4,_0x3f4c1a[_0x1499('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 54cafb3..5feb4e1 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 _0x2c7d=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','post','create','put','update'];(function(_0x4f4de2,_0x257b5d){var _0x1cbf3a=function(_0x68163){while(--_0x68163){_0x4f4de2['push'](_0x4f4de2['shift']());}};_0x1cbf3a(++_0x257b5d);}(_0x2c7d,0x11f));var _0xd2c7=function(_0x370874,_0x2ae4ab){_0x370874=_0x370874-0x0;var _0x1748c0=_0x2c7d[_0x370874];return _0x1748c0;};'use strict';var multer=require(_0xd2c7('0x0'));var util=require('util');var path=require(_0xd2c7('0x1'));var timeout=require(_0xd2c7('0x2'));var express=require(_0xd2c7('0x3'));var router=express[_0xd2c7('0x4')]();var fs_extra=require(_0xd2c7('0x5'));var auth=require(_0xd2c7('0x6'));var interaction=require(_0xd2c7('0x7'));var config=require('../../config/environment');var controller=require('./voiceTransferReport.controller');router[_0xd2c7('0x8')]('/',auth[_0xd2c7('0x9')](),controller[_0xd2c7('0xa')]);router[_0xd2c7('0x8')](_0xd2c7('0xb'),auth[_0xd2c7('0x9')](),controller['describe']);router[_0xd2c7('0x8')](_0xd2c7('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xd2c7('0xd')]('/',auth[_0xd2c7('0x9')](),controller[_0xd2c7('0xe')]);router[_0xd2c7('0xf')](_0xd2c7('0xc'),auth[_0xd2c7('0x9')](),controller[_0xd2c7('0x10')]);router['delete'](_0xd2c7('0xc'),auth[_0xd2c7('0x9')](),controller[_0xd2c7('0x11')]);module[_0xd2c7('0x12')]=router; \ No newline at end of file +var _0x7149=['delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7149,0x1a1));var _0x9714=function(_0x247da7,_0x1ada31){_0x247da7=_0x247da7-0x0;var _0x470712=_0x7149[_0x247da7];return _0x470712;};'use strict';var multer=require(_0x9714('0x0'));var util=require(_0x9714('0x1'));var path=require(_0x9714('0x2'));var timeout=require('connect-timeout');var express=require(_0x9714('0x3'));var router=express[_0x9714('0x4')]();var fs_extra=require(_0x9714('0x5'));var auth=require(_0x9714('0x6'));var interaction=require(_0x9714('0x7'));var config=require(_0x9714('0x8'));var controller=require(_0x9714('0x9'));router[_0x9714('0xa')]('/',auth[_0x9714('0xb')](),controller[_0x9714('0xc')]);router['get'](_0x9714('0xd'),auth[_0x9714('0xb')](),controller[_0x9714('0xe')]);router['get'](_0x9714('0xf'),auth[_0x9714('0xb')](),controller[_0x9714('0x10')]);router[_0x9714('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9714('0x12')](_0x9714('0xf'),auth[_0x9714('0xb')](),controller[_0x9714('0x13')]);router[_0x9714('0x14')](_0x9714('0xf'),auth[_0x9714('0xb')](),controller[_0x9714('0x15')]);module[_0x9714('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 5d61985..5f2c113 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 _0xa7fc=['Yes','moment','ENUM','blind','attended','STRING'];(function(_0x305eb6,_0x2d6ec2){var _0x455adb=function(_0x1c0ae9){while(--_0x1c0ae9){_0x305eb6['push'](_0x305eb6['shift']());}};_0x455adb(++_0x2d6ec2);}(_0xa7fc,0xb5));var _0xca7f=function(_0x4f5108,_0x46a54b){_0x4f5108=_0x4f5108-0x0;var _0x2d56ca=_0xa7fc[_0x4f5108];return _0x2d56ca;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xca7f('0x0'));module['exports']={'type':{'type':Sequelize[_0xca7f('0x1')](_0xca7f('0x2'),_0xca7f('0x3'))},'result':{'type':Sequelize[_0xca7f('0x4')]},'transfererchannel':{'type':Sequelize[_0xca7f('0x4')]},'transferercalleridnum':{'type':Sequelize[_0xca7f('0x4')]},'transferercalleridname':{'type':Sequelize[_0xca7f('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0xca7f('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0xca7f('0x4')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xca7f('0x4')]},'transfererexten':{'type':Sequelize[_0xca7f('0x4')]},'transfererlinkedid':{'type':Sequelize[_0xca7f('0x4')]},'transfereechannel':{'type':Sequelize[_0xca7f('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0xca7f('0x4')]},'transfereecalleridname':{'type':Sequelize[_0xca7f('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xca7f('0x4')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xca7f('0x4')]},'transfereecontext':{'type':Sequelize[_0xca7f('0x4')]},'transfereeexten':{'type':Sequelize[_0xca7f('0x4')]},'transfereelinkedid':{'type':Sequelize[_0xca7f('0x4')]},'isexternal':{'type':Sequelize[_0xca7f('0x1')](_0xca7f('0x5'),'No')},'context':{'type':Sequelize[_0xca7f('0x4')]},'extension':{'type':Sequelize[_0xca7f('0x4')]}}; \ No newline at end of file +var _0x3845=['exports','ENUM','blind','attended','STRING','Yes','sequelize','moment'];(function(_0xbaeba7,_0x578dfa){var _0x4b42e7=function(_0x23bd26){while(--_0x23bd26){_0xbaeba7['push'](_0xbaeba7['shift']());}};_0x4b42e7(++_0x578dfa);}(_0x3845,0x136));var _0x5384=function(_0x12ec76,_0x45f3b4){_0x12ec76=_0x12ec76-0x0;var _0x586d4e=_0x3845[_0x12ec76];return _0x586d4e;};'use strict';var Sequelize=require(_0x5384('0x0'));var moment=require(_0x5384('0x1'));module[_0x5384('0x2')]={'type':{'type':Sequelize[_0x5384('0x3')](_0x5384('0x4'),_0x5384('0x5'))},'result':{'type':Sequelize[_0x5384('0x6')]},'transfererchannel':{'type':Sequelize[_0x5384('0x6')]},'transferercalleridnum':{'type':Sequelize[_0x5384('0x6')]},'transferercalleridname':{'type':Sequelize[_0x5384('0x6')]},'transfererconnectedlinenum':{'type':Sequelize[_0x5384('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0x5384('0x6')]},'transfereraccountcode':{'type':Sequelize[_0x5384('0x6')]},'transferercontext':{'type':Sequelize[_0x5384('0x6')]},'transfererexten':{'type':Sequelize[_0x5384('0x6')]},'transfererlinkedid':{'type':Sequelize[_0x5384('0x6')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x5384('0x6')]},'transfereecalleridname':{'type':Sequelize[_0x5384('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x5384('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0x5384('0x6')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x5384('0x6')]},'transfereeexten':{'type':Sequelize[_0x5384('0x6')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize['ENUM'](_0x5384('0x7'),'No')},'context':{'type':Sequelize[_0x5384('0x6')]},'extension':{'type':Sequelize[_0x5384('0x6')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 0d5ee36..d806454 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 _0x3416=['query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','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','json','limit','undefined','count','offset','set','apply','save','update','then','destroy','error','stack','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','key','model'];(function(_0x26fab0,_0x45e762){var _0x378971=function(_0x5cef9c){while(--_0x5cef9c){_0x26fab0['push'](_0x26fab0['shift']());}};_0x378971(++_0x45e762);}(_0x3416,0x68));var _0x6341=function(_0x1b25c1,_0x2c6ce6){_0x1b25c1=_0x1b25c1-0x0;var _0x1e4447=_0x3416[_0x1b25c1];return _0x1e4447;};'use strict';var emlformat=require(_0x6341('0x0'));var rimraf=require(_0x6341('0x1'));var zipdir=require(_0x6341('0x2'));var jsonpatch=require(_0x6341('0x3'));var rp=require(_0x6341('0x4'));var moment=require('moment');var BPromise=require(_0x6341('0x5'));var Mustache=require(_0x6341('0x6'));var util=require('util');var path=require('path');var sox=require(_0x6341('0x7'));var csv=require(_0x6341('0x8'));var ejs=require(_0x6341('0x9'));var fs=require('fs');var fs_extra=require(_0x6341('0xa'));var _=require(_0x6341('0xb'));var squel=require(_0x6341('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6341('0xd'));var toCsv=require(_0x6341('0x8'));var querystring=require('querystring');var Papa=require(_0x6341('0xe'));var Redis=require(_0x6341('0xf'));var authService=require(_0x6341('0x10'));var qs=require(_0x6341('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6341('0x12'));var logger=require(_0x6341('0x13'))(_0x6341('0x14'));var utils=require(_0x6341('0x15'));var config=require(_0x6341('0x16'));var licenseUtil=require(_0x6341('0x17'));var db=require(_0x6341('0x18'))['db'];function respondWithStatusCode(_0x1fe7cc,_0x5dc3eb){_0x5dc3eb=_0x5dc3eb||0xcc;return function(_0x38e6d5){if(_0x38e6d5){return _0x1fe7cc[_0x6341('0x19')](_0x5dc3eb);}return _0x1fe7cc[_0x6341('0x1a')](_0x5dc3eb)[_0x6341('0x1b')]();};}function respondWithResult(_0x1635c2,_0x4a65aa){_0x4a65aa=_0x4a65aa||0xc8;return function(_0x2a86d8){if(_0x2a86d8){return _0x1635c2[_0x6341('0x1a')](_0x4a65aa)[_0x6341('0x1c')](_0x2a86d8);}};}function respondWithFilteredResult(_0x27ee12,_0x30770f){return function(_0x5ce78e){if(_0x5ce78e){var _0x37b724=typeof _0x30770f['offset']==='undefined'&&typeof _0x30770f[_0x6341('0x1d')]===_0x6341('0x1e');var _0x26bc52=_0x5ce78e[_0x6341('0x1f')];var _0x5d451c=_0x37b724?0x0:_0x30770f[_0x6341('0x20')];var _0x34ebf0=_0x37b724?_0x5ce78e[_0x6341('0x1f')]:_0x30770f[_0x6341('0x20')]+_0x30770f['limit'];var _0x3da9ac;if(_0x34ebf0>=_0x26bc52){_0x34ebf0=_0x26bc52;_0x3da9ac=0xc8;}else{_0x3da9ac=0xce;}_0x27ee12[_0x6341('0x1a')](_0x3da9ac);return _0x27ee12[_0x6341('0x21')]('Content-Range',_0x5d451c+'-'+_0x34ebf0+'/'+_0x26bc52)[_0x6341('0x1c')](_0x5ce78e);}return null;};}function patchUpdates(_0x31937f){return function(_0x57f4be){try{jsonpatch[_0x6341('0x22')](_0x57f4be,_0x31937f,!![]);}catch(_0x1a8569){return BPromise['reject'](_0x1a8569);}return _0x57f4be[_0x6341('0x23')]();};}function saveUpdates(_0x37801a,_0x5b90e3){return function(_0x1196b4){if(_0x1196b4){return _0x1196b4[_0x6341('0x24')](_0x37801a)[_0x6341('0x25')](function(_0x19738b){return _0x19738b;});}return null;};}function removeEntity(_0x595e4e,_0x4342b6){return function(_0x82d40d){if(_0x82d40d){return _0x82d40d[_0x6341('0x26')]()[_0x6341('0x25')](function(){_0x595e4e[_0x6341('0x1a')](0xcc)[_0x6341('0x1b')]();});}};}function handleEntityNotFound(_0x3ed840,_0x2b2899){return function(_0x52aef8){if(!_0x52aef8){_0x3ed840[_0x6341('0x19')](0x194);}return _0x52aef8;};}function handleError(_0x44caf0,_0xe0330d){_0xe0330d=_0xe0330d||0x1f4;return function(_0x4cb4f5){logger[_0x6341('0x27')](_0x4cb4f5[_0x6341('0x28')]);if(_0x4cb4f5[_0x6341('0x29')]){delete _0x4cb4f5[_0x6341('0x29')];}_0x44caf0[_0x6341('0x1a')](_0xe0330d)[_0x6341('0x2a')](_0x4cb4f5);};}exports[_0x6341('0x2b')]=function(_0x3bedd5,_0x171ba1){var _0x42616d={},_0x16b03d={},_0x26341e={'count':0x0,'rows':[]};var _0xc53802=_[_0x6341('0x2c')](db[_0x6341('0x2d')][_0x6341('0x2e')],function(_0x3a16ac){return{'name':_0x3a16ac[_0x6341('0x2f')],'type':_0x3a16ac['type'][_0x6341('0x30')]};});_0x16b03d[_0x6341('0x31')]=_[_0x6341('0x2c')](_0xc53802,'name');_0x16b03d[_0x6341('0x32')]=_[_0x6341('0x33')](_0x3bedd5[_0x6341('0x32')]);_0x16b03d[_0x6341('0x34')]=_[_0x6341('0x35')](_0x16b03d[_0x6341('0x31')],_0x16b03d[_0x6341('0x32')]);_0x42616d['attributes']=_[_0x6341('0x35')](_0x16b03d['model'],qs[_0x6341('0x36')](_0x3bedd5[_0x6341('0x32')][_0x6341('0x36')]));_0x42616d[_0x6341('0x37')]=_0x42616d[_0x6341('0x37')][_0x6341('0x38')]?_0x42616d[_0x6341('0x37')]:_0x16b03d[_0x6341('0x31')];if(!_0x3bedd5[_0x6341('0x32')][_0x6341('0x39')](_0x6341('0x3a'))){_0x42616d[_0x6341('0x1d')]=qs['limit'](_0x3bedd5[_0x6341('0x32')]['limit']);_0x42616d[_0x6341('0x20')]=qs[_0x6341('0x20')](_0x3bedd5[_0x6341('0x32')][_0x6341('0x20')]);}_0x42616d['order']=qs[_0x6341('0x3b')](_0x3bedd5[_0x6341('0x32')][_0x6341('0x3b')]);_0x42616d[_0x6341('0x3c')]=qs['filters'](_[_0x6341('0x3d')](_0x3bedd5['query'],_0x16b03d['filters']),_0xc53802);if(_0x3bedd5[_0x6341('0x32')][_0x6341('0x3e')]){_0x42616d[_0x6341('0x3c')]=_[_0x6341('0x3f')](_0x42616d[_0x6341('0x3c')],{'$or':_['map'](_0xc53802,function(_0x32e816){if(_0x32e816[_0x6341('0x40')]!==_0x6341('0x41')){var _0x563acf={};_0x563acf[_0x32e816[_0x6341('0x29')]]={'$like':'%'+_0x3bedd5[_0x6341('0x32')][_0x6341('0x3e')]+'%'};return _0x563acf;}})});}_0x42616d=_[_0x6341('0x3f')]({},_0x42616d,_0x3bedd5[_0x6341('0x42')]);var _0x30d990={'where':_0x42616d[_0x6341('0x3c')]};return db[_0x6341('0x2d')][_0x6341('0x1f')](_0x30d990)[_0x6341('0x25')](function(_0x4150b4){_0x26341e['count']=_0x4150b4;if(_0x3bedd5[_0x6341('0x32')][_0x6341('0x43')]){_0x42616d[_0x6341('0x44')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0x6341('0x45')](_0x42616d);})['then'](function(_0x57cfa9){_0x26341e['rows']=_0x57cfa9;return _0x26341e;})[_0x6341('0x25')](respondWithFilteredResult(_0x171ba1,_0x42616d))[_0x6341('0x46')](handleError(_0x171ba1,null));};exports[_0x6341('0x47')]=function(_0x4a4e15,_0x5792be){var _0x31c3b8={'raw':!![],'where':{'id':_0x4a4e15['params']['id']}},_0x2bf2c8={};_0x2bf2c8[_0x6341('0x31')]=_[_0x6341('0x33')](db[_0x6341('0x2d')]['rawAttributes']);_0x2bf2c8[_0x6341('0x32')]=_[_0x6341('0x33')](_0x4a4e15[_0x6341('0x32')]);_0x2bf2c8[_0x6341('0x34')]=_['intersection'](_0x2bf2c8[_0x6341('0x31')],_0x2bf2c8['query']);_0x31c3b8[_0x6341('0x37')]=_[_0x6341('0x35')](_0x2bf2c8['model'],qs[_0x6341('0x36')](_0x4a4e15[_0x6341('0x32')][_0x6341('0x36')]));_0x31c3b8[_0x6341('0x37')]=_0x31c3b8['attributes'][_0x6341('0x38')]?_0x31c3b8['attributes']:_0x2bf2c8[_0x6341('0x31')];if(_0x4a4e15['query'][_0x6341('0x43')]){_0x31c3b8['include']=[{'all':!![]}];}_0x31c3b8=_[_0x6341('0x3f')]({},_0x31c3b8,_0x4a4e15[_0x6341('0x42')]);return db[_0x6341('0x2d')][_0x6341('0x48')](_0x31c3b8)[_0x6341('0x25')](handleEntityNotFound(_0x5792be,null))[_0x6341('0x25')](respondWithResult(_0x5792be,null))[_0x6341('0x46')](handleError(_0x5792be,null));};exports[_0x6341('0x49')]=function(_0x2922b6,_0x526cac){return db[_0x6341('0x2d')][_0x6341('0x49')](_0x2922b6[_0x6341('0x4a')],{})[_0x6341('0x25')](respondWithResult(_0x526cac,0xc9))['catch'](handleError(_0x526cac,null));};exports[_0x6341('0x24')]=function(_0x4ff48c,_0xd4532b){if(_0x4ff48c[_0x6341('0x4a')]['id']){delete _0x4ff48c[_0x6341('0x4a')]['id'];}return db['VoiceTransferReport'][_0x6341('0x48')]({'where':{'id':_0x4ff48c['params']['id']}})[_0x6341('0x25')](handleEntityNotFound(_0xd4532b,null))['then'](saveUpdates(_0x4ff48c[_0x6341('0x4a')],null))[_0x6341('0x25')](respondWithResult(_0xd4532b,null))[_0x6341('0x46')](handleError(_0xd4532b,null));};exports[_0x6341('0x26')]=function(_0x7160f,_0x336416){return db[_0x6341('0x2d')][_0x6341('0x48')]({'where':{'id':_0x7160f[_0x6341('0x4b')]['id']}})['then'](handleEntityNotFound(_0x336416,null))[_0x6341('0x25')](removeEntity(_0x336416,null))['catch'](handleError(_0x336416,null));};exports['describe']=function(_0x45ca19,_0x663f41){return db[_0x6341('0x2d')][_0x6341('0x4c')]()[_0x6341('0x25')](respondWithResult(_0x663f41,null))[_0x6341('0x46')](handleError(_0x663f41,null));}; \ No newline at end of file +var _0x39c3=['VoiceTransferReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','options','find','create','body','params','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','save','update','then','error','name','send','index','map'];(function(_0x2d4421,_0x15a84f){var _0x2d3b01=function(_0xb9e94c){while(--_0xb9e94c){_0x2d4421['push'](_0x2d4421['shift']());}};_0x2d3b01(++_0x15a84f);}(_0x39c3,0xb3));var _0x339c=function(_0x2d126e,_0x1e8257){_0x2d126e=_0x2d126e-0x0;var _0xcb04d3=_0x39c3[_0x2d126e];return _0xcb04d3;};'use strict';var emlformat=require(_0x339c('0x0'));var rimraf=require(_0x339c('0x1'));var zipdir=require(_0x339c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x339c('0x3'));var Mustache=require(_0x339c('0x4'));var util=require(_0x339c('0x5'));var path=require(_0x339c('0x6'));var sox=require(_0x339c('0x7'));var csv=require('to-csv');var ejs=require(_0x339c('0x8'));var fs=require('fs');var fs_extra=require(_0x339c('0x9'));var _=require(_0x339c('0xa'));var squel=require(_0x339c('0xb'));var crypto=require(_0x339c('0xc'));var jsforce=require(_0x339c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x339c('0xe'));var querystring=require(_0x339c('0xf'));var Papa=require('papaparse');var Redis=require(_0x339c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x339c('0x11'));var as=require(_0x339c('0x12'));var hardwareService=require(_0x339c('0x13'));var logger=require(_0x339c('0x14'))(_0x339c('0x15'));var utils=require('../../config/utils');var config=require(_0x339c('0x16'));var licenseUtil=require(_0x339c('0x17'));var db=require(_0x339c('0x18'))['db'];function respondWithStatusCode(_0x53afe3,_0x1f138b){_0x1f138b=_0x1f138b||0xcc;return function(_0x514127){if(_0x514127){return _0x53afe3[_0x339c('0x19')](_0x1f138b);}return _0x53afe3[_0x339c('0x1a')](_0x1f138b)[_0x339c('0x1b')]();};}function respondWithResult(_0x4df7c7,_0x27113){_0x27113=_0x27113||0xc8;return function(_0x314b87){if(_0x314b87){return _0x4df7c7[_0x339c('0x1a')](_0x27113)[_0x339c('0x1c')](_0x314b87);}};}function respondWithFilteredResult(_0x2c4f04,_0x55b6df){return function(_0x4c0dcb){if(_0x4c0dcb){var _0x2411ec=typeof _0x55b6df[_0x339c('0x1d')]===_0x339c('0x1e')&&typeof _0x55b6df['limit']===_0x339c('0x1e');var _0x1f50e3=_0x4c0dcb[_0x339c('0x1f')];var _0x5779d7=_0x2411ec?0x0:_0x55b6df[_0x339c('0x1d')];var _0x5b861b=_0x2411ec?_0x4c0dcb[_0x339c('0x1f')]:_0x55b6df['offset']+_0x55b6df[_0x339c('0x20')];var _0x2af1aa;if(_0x5b861b>=_0x1f50e3){_0x5b861b=_0x1f50e3;_0x2af1aa=0xc8;}else{_0x2af1aa=0xce;}_0x2c4f04[_0x339c('0x1a')](_0x2af1aa);return _0x2c4f04[_0x339c('0x21')](_0x339c('0x22'),_0x5779d7+'-'+_0x5b861b+'/'+_0x1f50e3)[_0x339c('0x1c')](_0x4c0dcb);}return null;};}function patchUpdates(_0x46163a){return function(_0x2af49c){try{jsonpatch['apply'](_0x2af49c,_0x46163a,!![]);}catch(_0x334642){return BPromise['reject'](_0x334642);}return _0x2af49c[_0x339c('0x23')]();};}function saveUpdates(_0x3a1f04,_0x185e06){return function(_0x9f0197){if(_0x9f0197){return _0x9f0197[_0x339c('0x24')](_0x3a1f04)[_0x339c('0x25')](function(_0x334b1b){return _0x334b1b;});}return null;};}function removeEntity(_0x52d543,_0x13abf7){return function(_0x241966){if(_0x241966){return _0x241966['destroy']()['then'](function(){_0x52d543[_0x339c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4867bb,_0x1a5310){return function(_0x114f56){if(!_0x114f56){_0x4867bb['sendStatus'](0x194);}return _0x114f56;};}function handleError(_0x56d712,_0x5ae06a){_0x5ae06a=_0x5ae06a||0x1f4;return function(_0x4347b8){logger[_0x339c('0x26')](_0x4347b8['stack']);if(_0x4347b8[_0x339c('0x27')]){delete _0x4347b8[_0x339c('0x27')];}_0x56d712[_0x339c('0x1a')](_0x5ae06a)[_0x339c('0x28')](_0x4347b8);};}exports[_0x339c('0x29')]=function(_0x35cd67,_0x1f8dca){var _0x52f998={},_0x270c4a={},_0xf00588={'count':0x0,'rows':[]};var _0x324917=_[_0x339c('0x2a')](db[_0x339c('0x2b')][_0x339c('0x2c')],function(_0x13234d){return{'name':_0x13234d[_0x339c('0x2d')],'type':_0x13234d[_0x339c('0x2e')][_0x339c('0x2f')]};});_0x270c4a[_0x339c('0x30')]=_['map'](_0x324917,_0x339c('0x27'));_0x270c4a['query']=_[_0x339c('0x31')](_0x35cd67['query']);_0x270c4a[_0x339c('0x32')]=_[_0x339c('0x33')](_0x270c4a[_0x339c('0x30')],_0x270c4a[_0x339c('0x34')]);_0x52f998[_0x339c('0x35')]=_[_0x339c('0x33')](_0x270c4a[_0x339c('0x30')],qs['fields'](_0x35cd67[_0x339c('0x34')][_0x339c('0x36')]));_0x52f998[_0x339c('0x35')]=_0x52f998[_0x339c('0x35')][_0x339c('0x37')]?_0x52f998[_0x339c('0x35')]:_0x270c4a[_0x339c('0x30')];if(!_0x35cd67[_0x339c('0x34')][_0x339c('0x38')](_0x339c('0x39'))){_0x52f998[_0x339c('0x20')]=qs[_0x339c('0x20')](_0x35cd67[_0x339c('0x34')]['limit']);_0x52f998[_0x339c('0x1d')]=qs[_0x339c('0x1d')](_0x35cd67[_0x339c('0x34')][_0x339c('0x1d')]);}_0x52f998[_0x339c('0x3a')]=qs[_0x339c('0x3b')](_0x35cd67[_0x339c('0x34')][_0x339c('0x3b')]);_0x52f998[_0x339c('0x3c')]=qs[_0x339c('0x32')](_['pick'](_0x35cd67[_0x339c('0x34')],_0x270c4a[_0x339c('0x32')]),_0x324917);if(_0x35cd67[_0x339c('0x34')][_0x339c('0x3d')]){_0x52f998['where']=_[_0x339c('0x3e')](_0x52f998[_0x339c('0x3c')],{'$or':_['map'](_0x324917,function(_0x16c36f){if(_0x16c36f[_0x339c('0x2e')]!==_0x339c('0x3f')){var _0x4a84c8={};_0x4a84c8[_0x16c36f[_0x339c('0x27')]]={'$like':'%'+_0x35cd67[_0x339c('0x34')]['filter']+'%'};return _0x4a84c8;}})});}_0x52f998=_[_0x339c('0x3e')]({},_0x52f998,_0x35cd67['options']);var _0x56fc1c={'where':_0x52f998[_0x339c('0x3c')]};return db[_0x339c('0x2b')][_0x339c('0x1f')](_0x56fc1c)[_0x339c('0x25')](function(_0x2b29ac){_0xf00588[_0x339c('0x1f')]=_0x2b29ac;if(_0x35cd67['query'][_0x339c('0x40')]){_0x52f998['include']=[{'all':!![]}];}return db[_0x339c('0x2b')][_0x339c('0x41')](_0x52f998);})[_0x339c('0x25')](function(_0x28c7b7){_0xf00588[_0x339c('0x42')]=_0x28c7b7;return _0xf00588;})['then'](respondWithFilteredResult(_0x1f8dca,_0x52f998))[_0x339c('0x43')](handleError(_0x1f8dca,null));};exports[_0x339c('0x44')]=function(_0x350b7c,_0x26f162){var _0x288669={'raw':!![],'where':{'id':_0x350b7c['params']['id']}},_0x10bb46={};_0x10bb46[_0x339c('0x30')]=_[_0x339c('0x31')](db[_0x339c('0x2b')][_0x339c('0x2c')]);_0x10bb46[_0x339c('0x34')]=_[_0x339c('0x31')](_0x350b7c[_0x339c('0x34')]);_0x10bb46[_0x339c('0x32')]=_[_0x339c('0x33')](_0x10bb46[_0x339c('0x30')],_0x10bb46[_0x339c('0x34')]);_0x288669[_0x339c('0x35')]=_[_0x339c('0x33')](_0x10bb46[_0x339c('0x30')],qs['fields'](_0x350b7c[_0x339c('0x34')]['fields']));_0x288669[_0x339c('0x35')]=_0x288669['attributes']['length']?_0x288669[_0x339c('0x35')]:_0x10bb46[_0x339c('0x30')];if(_0x350b7c[_0x339c('0x34')][_0x339c('0x40')]){_0x288669['include']=[{'all':!![]}];}_0x288669=_[_0x339c('0x3e')]({},_0x288669,_0x350b7c[_0x339c('0x45')]);return db['VoiceTransferReport'][_0x339c('0x46')](_0x288669)[_0x339c('0x25')](handleEntityNotFound(_0x26f162,null))[_0x339c('0x25')](respondWithResult(_0x26f162,null))[_0x339c('0x43')](handleError(_0x26f162,null));};exports[_0x339c('0x47')]=function(_0x433cfc,_0x3b2184){return db[_0x339c('0x2b')][_0x339c('0x47')](_0x433cfc[_0x339c('0x48')],{})[_0x339c('0x25')](respondWithResult(_0x3b2184,0xc9))[_0x339c('0x43')](handleError(_0x3b2184,null));};exports[_0x339c('0x24')]=function(_0x4c7dfc,_0x5219ca){if(_0x4c7dfc[_0x339c('0x48')]['id']){delete _0x4c7dfc['body']['id'];}return db[_0x339c('0x2b')][_0x339c('0x46')]({'where':{'id':_0x4c7dfc[_0x339c('0x49')]['id']}})[_0x339c('0x25')](handleEntityNotFound(_0x5219ca,null))[_0x339c('0x25')](saveUpdates(_0x4c7dfc['body'],null))[_0x339c('0x25')](respondWithResult(_0x5219ca,null))[_0x339c('0x43')](handleError(_0x5219ca,null));};exports['destroy']=function(_0x31c33a,_0x51cff9){return db['VoiceTransferReport'][_0x339c('0x46')]({'where':{'id':_0x31c33a['params']['id']}})[_0x339c('0x25')](handleEntityNotFound(_0x51cff9,null))[_0x339c('0x25')](removeEntity(_0x51cff9,null))[_0x339c('0x43')](handleError(_0x51cff9,null));};exports['describe']=function(_0x2d618f,_0x548232){return db[_0x339c('0x2b')]['describe']()[_0x339c('0x25')](respondWithResult(_0x548232,null))[_0x339c('0x43')](handleError(_0x548232,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 6ca0cf2..7897a4b 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 _0x8528=['../../config/environment','./voiceTransferReport.attributes','VoiceTransferReport','report_call_transfer','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x1ad0c1,_0x2f5433){var _0x1b56ae=function(_0x44fcc2){while(--_0x44fcc2){_0x1ad0c1['push'](_0x1ad0c1['shift']());}};_0x1b56ae(++_0x2f5433);}(_0x8528,0x1d2));var _0x8852=function(_0xfa818,_0x53748f){_0xfa818=_0xfa818-0x0;var _0x1bb8d4=_0x8528[_0xfa818];return _0x1bb8d4;};'use strict';var _=require('lodash');var util=require(_0x8852('0x0'));var logger=require(_0x8852('0x1'))(_0x8852('0x2'));var moment=require(_0x8852('0x3'));var BPromise=require(_0x8852('0x4'));var rp=require(_0x8852('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8852('0x6'));var config=require(_0x8852('0x7'));var attributes=require(_0x8852('0x8'));module['exports']=function(_0xfd65,_0x35cfff){return _0xfd65['define'](_0x8852('0x9'),attributes,{'tableName':_0x8852('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8134=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','lodash','util'];(function(_0x508431,_0x23e7a4){var _0x44620e=function(_0x28e8d8){while(--_0x28e8d8){_0x508431['push'](_0x508431['shift']());}};_0x44620e(++_0x23e7a4);}(_0x8134,0x1ed));var _0x4813=function(_0x1b021c,_0x12257d){_0x1b021c=_0x1b021c-0x0;var _0x4290d3=_0x8134[_0x1b021c];return _0x4290d3;};'use strict';var _=require(_0x4813('0x0'));var util=require(_0x4813('0x1'));var logger=require(_0x4813('0x2'))(_0x4813('0x3'));var moment=require(_0x4813('0x4'));var BPromise=require(_0x4813('0x5'));var rp=require(_0x4813('0x6'));var fs=require('fs');var path=require(_0x4813('0x7'));var rimraf=require(_0x4813('0x8'));var config=require(_0x4813('0x9'));var attributes=require('./voiceTransferReport.attributes');module['exports']=function(_0xa1b054,_0xe12db7){return _0xa1b054[_0x4813('0xa')]('VoiceTransferReport',attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 021672d..0d38f33 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 _0xacb8=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','stringify','error','code','message','catch','VoiceTransferReport,\x20%s,\x20%s','CreateVoiceTransferReport','VoiceTransferReport','create','options','raw','then','info','lodash'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0xacb8,0x1ca));var _0x8acb=function(_0x3b29cf,_0x171bc9){_0x3b29cf=_0x3b29cf-0x0;var _0x1dc73b=_0xacb8[_0x3b29cf];return _0x1dc73b;};'use strict';var _=require(_0x8acb('0x0'));var util=require(_0x8acb('0x1'));var moment=require(_0x8acb('0x2'));var BPromise=require(_0x8acb('0x3'));var rs=require(_0x8acb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8acb('0x5'));var logger=require(_0x8acb('0x6'))(_0x8acb('0x7'));var config=require(_0x8acb('0x8'));var jayson=require(_0x8acb('0x9'));var client=jayson[_0x8acb('0xa')][_0x8acb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53bbe2,_0x34ba79,_0x50bcb9){return new BPromise(function(_0x1aad1e,_0xd25d51){return client[_0x8acb('0xc')](_0x53bbe2,_0x50bcb9)['then'](function(_0x48cf3a){logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x34ba79,_0x8acb('0xd'));logger['debug']('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x34ba79,'request\x20sent',JSON[_0x8acb('0xe')](_0x48cf3a));if(_0x48cf3a[_0x8acb('0xf')]){if(_0x48cf3a[_0x8acb('0xf')][_0x8acb('0x10')]===0x1f4){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x34ba79,_0x48cf3a[_0x8acb('0xf')][_0x8acb('0x11')]);return _0xd25d51(_0x48cf3a['error'][_0x8acb('0x11')]);}logger[_0x8acb('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0x34ba79,_0x48cf3a[_0x8acb('0xf')]['message']);return _0x1aad1e(_0x48cf3a[_0x8acb('0xf')]['message']);}else{logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x34ba79,_0x8acb('0xd'));_0x1aad1e(_0x48cf3a['result'][_0x8acb('0x11')]);}})[_0x8acb('0x12')](function(_0x13ed67){logger['error'](_0x8acb('0x13'),_0x34ba79,_0x13ed67);_0xd25d51(_0x13ed67);});});}exports[_0x8acb('0x14')]=function(_0x2ecdcc){var _0x4d60e8=this;return new Promise(function(_0x1828e4,_0xd07e0b){return db[_0x8acb('0x15')][_0x8acb('0x16')](_0x2ecdcc['body'],{'raw':_0x2ecdcc[_0x8acb('0x17')]?_0x2ecdcc[_0x8acb('0x17')][_0x8acb('0x18')]===undefined?!![]:![]:!![]})[_0x8acb('0x19')](function(_0x3aae0f){logger[_0x8acb('0x1a')](_0x8acb('0x14'),_0x2ecdcc);logger['debug'](_0x8acb('0x14'),_0x2ecdcc,JSON[_0x8acb('0xe')](_0x3aae0f));_0x1828e4(_0x3aae0f);})[_0x8acb('0x12')](function(_0x48b714){logger[_0x8acb('0xf')](_0x8acb('0x14'),_0x48b714[_0x8acb('0x11')],_0x2ecdcc);_0xd07e0b(_0x4d60e8['error'](0x1f4,_0x48b714[_0x8acb('0x11')]));});});}; \ No newline at end of file +var _0xdafd=['info','VoiceTransferReport,\x20%s,\x20%s','debug','error','code','message','request\x20sent','catch','CreateVoiceTransferReport','VoiceTransferReport','create','options','stringify','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then'];(function(_0x21156d,_0x4cbd72){var _0x358638=function(_0x235e05){while(--_0x235e05){_0x21156d['push'](_0x21156d['shift']());}};_0x358638(++_0x4cbd72);}(_0xdafd,0xb5));var _0xddaf=function(_0x37d5ca,_0x128df8){_0x37d5ca=_0x37d5ca-0x0;var _0xc993f4=_0xdafd[_0x37d5ca];return _0xc993f4;};'use strict';var _=require(_0xddaf('0x0'));var util=require(_0xddaf('0x1'));var moment=require(_0xddaf('0x2'));var BPromise=require(_0xddaf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xddaf('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xddaf('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xddaf('0x6'));var jayson=require(_0xddaf('0x7'));var client=jayson[_0xddaf('0x8')][_0xddaf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x286d0c,_0x53a432,_0xd5b1ab){return new BPromise(function(_0x45edb7,_0x56af84){return client['request'](_0x286d0c,_0xd5b1ab)[_0xddaf('0xa')](function(_0xfe837e){logger[_0xddaf('0xb')](_0xddaf('0xc'),_0x53a432,'request\x20sent');logger[_0xddaf('0xd')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x53a432,'request\x20sent',JSON['stringify'](_0xfe837e));if(_0xfe837e[_0xddaf('0xe')]){if(_0xfe837e[_0xddaf('0xe')][_0xddaf('0xf')]===0x1f4){logger[_0xddaf('0xe')](_0xddaf('0xc'),_0x53a432,_0xfe837e[_0xddaf('0xe')][_0xddaf('0x10')]);return _0x56af84(_0xfe837e[_0xddaf('0xe')][_0xddaf('0x10')]);}logger[_0xddaf('0xe')](_0xddaf('0xc'),_0x53a432,_0xfe837e[_0xddaf('0xe')]['message']);return _0x45edb7(_0xfe837e['error'][_0xddaf('0x10')]);}else{logger[_0xddaf('0xb')](_0xddaf('0xc'),_0x53a432,_0xddaf('0x11'));_0x45edb7(_0xfe837e['result'][_0xddaf('0x10')]);}})[_0xddaf('0x12')](function(_0x1dbe17){logger[_0xddaf('0xe')](_0xddaf('0xc'),_0x53a432,_0x1dbe17);_0x56af84(_0x1dbe17);});});}exports[_0xddaf('0x13')]=function(_0x16e473){var _0x37ca43=this;return new Promise(function(_0x5ec901,_0x5590d5){return db[_0xddaf('0x14')][_0xddaf('0x15')](_0x16e473['body'],{'raw':_0x16e473['options']?_0x16e473[_0xddaf('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xddaf('0xa')](function(_0x104c08){logger[_0xddaf('0xb')](_0xddaf('0x13'),_0x16e473);logger['debug'](_0xddaf('0x13'),_0x16e473,JSON[_0xddaf('0x17')](_0x104c08));_0x5ec901(_0x104c08);})['catch'](function(_0x4b897e){logger['error'](_0xddaf('0x13'),_0x4b897e[_0xddaf('0x10')],_0x16e473);_0x5590d5(_0x37ca43['error'](0x1f4,_0x4b897e[_0xddaf('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 67f11b5..9ac592a 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 _0x91a7=['/originate','isWebrtcLicence','/hangup','isAuthenticated','hangup','/answer','answer','post','/hold','/unhold','unhold','/calls','/transfer','transfer','exports','Router','../../components/auth/service','./webbar.controller'];(function(_0x3891de,_0x55cfe5){var _0x521696=function(_0x1a8b8e){while(--_0x1a8b8e){_0x3891de['push'](_0x3891de['shift']());}};_0x521696(++_0x55cfe5);}(_0x91a7,0xe7));var _0x791a=function(_0x5a36c3,_0xc0a6a6){_0x5a36c3=_0x5a36c3-0x0;var _0xebca21=_0x91a7[_0x5a36c3];return _0xebca21;};'use strict';var express=require('express');var router=express[_0x791a('0x0')]();var auth=require(_0x791a('0x1'));var controller=require(_0x791a('0x2'));router['post'](_0x791a('0x3'),auth['isAuthenticated'](),auth[_0x791a('0x4')](),controller['originate']);router['post'](_0x791a('0x5'),auth[_0x791a('0x6')](),auth['isWebrtcLicence'](),controller[_0x791a('0x7')]);router['post'](_0x791a('0x8'),auth[_0x791a('0x6')](),auth['isWebrtcLicence'](),controller[_0x791a('0x9')]);router[_0x791a('0xa')](_0x791a('0xb'),auth[_0x791a('0x6')](),auth[_0x791a('0x4')](),controller['hold']);router[_0x791a('0xa')](_0x791a('0xc'),auth['isAuthenticated'](),auth[_0x791a('0x4')](),controller[_0x791a('0xd')]);router[_0x791a('0xa')](_0x791a('0xe'),auth[_0x791a('0x6')](),auth[_0x791a('0x4')](),controller['calls']);router['post'](_0x791a('0xf'),auth[_0x791a('0x6')](),auth['isWebrtcLicence'](),controller[_0x791a('0x10')]);module[_0x791a('0x11')]=router; \ No newline at end of file +var _0x9bde=['Router','./webbar.controller','/originate','isAuthenticated','isWebrtcLicence','originate','post','/hangup','hangup','/answer','answer','/hold','/unhold','/calls','transfer'];(function(_0x4dbcd6,_0x34326c){var _0x541e55=function(_0x59eb00){while(--_0x59eb00){_0x4dbcd6['push'](_0x4dbcd6['shift']());}};_0x541e55(++_0x34326c);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4927eb,_0x326497){_0x4927eb=_0x4927eb-0x0;var _0x248226=_0x9bde[_0x4927eb];return _0x248226;};'use strict';var express=require('express');var router=express[_0xe9bd('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xe9bd('0x1'));router['post'](_0xe9bd('0x2'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller[_0xe9bd('0x5')]);router[_0xe9bd('0x6')](_0xe9bd('0x7'),auth[_0xe9bd('0x3')](),auth['isWebrtcLicence'](),controller[_0xe9bd('0x8')]);router[_0xe9bd('0x6')](_0xe9bd('0x9'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller[_0xe9bd('0xa')]);router[_0xe9bd('0x6')](_0xe9bd('0xb'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller['hold']);router['post'](_0xe9bd('0xc'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller['unhold']);router[_0xe9bd('0x6')](_0xe9bd('0xd'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller['calls']);router[_0xe9bd('0x6')]('/transfer',auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller[_0xe9bd('0xe')]);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 b2ca0e9..f572949 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 _0x4fef=['client','http','../../config/logger','webbarapi','ioredis','redis','localhost','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','emit','handleError:','error','stack','name','status','send','NotFound','then','code','message','catch','User','findOne','agent','UserId','length','sessionId\x20','\x20not\x20found!','originate','info','originate\x20fired:','body','json','userId','callNumber','callerId','entityFound:','format','user:%s','originate\x20executed!','hangup','hangup\x20executed!','sessionId','answer\x20executed!','hold','webbar:hold','hold\x20executed!','unhold','webbar:unhold','calls\x20fired:','filter','rows','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer\x20fired:','transferNumber','transfer\x20executed!','path','lodash','../../config/environment','bluebird','jayson/promise'];(function(_0x4a21bd,_0x40577f){var _0x1e7841=function(_0x5366c4){while(--_0x5366c4){_0x4a21bd['push'](_0x4a21bd['shift']());}};_0x1e7841(++_0x40577f);}(_0x4fef,0x10f));var _0xf4fe=function(_0x35d754,_0x5494d5){_0x35d754=_0x35d754-0x0;var _0x4b04df=_0x4fef[_0x35d754];return _0x4b04df;};'use strict';var path=require(_0xf4fe('0x0'));var fs=require('fs');var _=require(_0xf4fe('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0xf4fe('0x2'));var util=require('util');var BPromise=require(_0xf4fe('0x3'));var jayson=require(_0xf4fe('0x4'));var amiClient=jayson[_0xf4fe('0x5')][_0xf4fe('0x6')]({'port':0x232a});var logger=require(_0xf4fe('0x7'))(_0xf4fe('0x8'));var Redis=require(_0xf4fe('0x9'));config[_0xf4fe('0xa')]=_['defaults'](config[_0xf4fe('0xa')],{'host':_0xf4fe('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf4fe('0xa')]));var Schema=require(_0xf4fe('0xc'));var originateValidation=new Schema({'userId':{'type':_0xf4fe('0xd'),'required':[!![],_0xf4fe('0xe')]},'callNumber':{'type':_0xf4fe('0xf'),'required':[!![],_0xf4fe('0x10')]},'callerId':{'type':_0xf4fe('0xf')},'callbackUrl':{'type':_0xf4fe('0xf')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf4fe('0xe')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0xf4fe('0xd'),'required':[!![],_0xf4fe('0xe')]},'sessionId':{'type':_0xf4fe('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xf4fe('0xd'),'required':[!![],_0xf4fe('0xe')]},'sessionId':{'type':'string','required':[!![],_0xf4fe('0x11')]},'transferNumber':{'type':_0xf4fe('0xf'),'required':[!![],_0xf4fe('0x12')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf4fe('0xe')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xf4fe('0xd'),'required':[!![],_0xf4fe('0xe')]},'sessionId':{'type':_0xf4fe('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf4fe('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0xf4fe('0xd'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x2a00ea,_0x362e4d,_0x3493cd){logger['info'](_0x2a00ea,_0x362e4d,JSON['stringify'](_0x3493cd));io['to'](_0x2a00ea)[_0xf4fe('0x13')](_0x362e4d,_0x3493cd);}function handleError(_0x225eee){return function(_0x5ad86c){console['log'](_0xf4fe('0x14'),_0x5ad86c,_0x5ad86c instanceof RangeError);logger[_0xf4fe('0x15')](_0x5ad86c[_0xf4fe('0x16')]);if(_0x5ad86c instanceof RangeError){if(_0x5ad86c[_0xf4fe('0x17')]){delete _0x5ad86c[_0xf4fe('0x17')];}_0x225eee[_0xf4fe('0x18')](0x194)[_0xf4fe('0x19')](_0x5ad86c);}else{if(_0x5ad86c[_0xf4fe('0x17')]){delete _0x5ad86c[_0xf4fe('0x17')];}_0x225eee[_0xf4fe('0x18')](0x1f4)[_0xf4fe('0x19')](_0x5ad86c);}};}function checkError(){return function(_0x3c09d0){if(!_0x3c09d0){throw new RangeError(_0xf4fe('0x1a'));}return _0x3c09d0;};}function respondWithRpcPromise(_0xe2b5cc,_0x554eae){return new BPromise(function(_0x3e1d03,_0x5e8e18){var _0x502b3c=amiClient;return _0x502b3c['request'](_0xe2b5cc,_0x554eae)[_0xf4fe('0x1b')](function(_0x518d0d){if(_0x518d0d['error']){if(_0x518d0d[_0xf4fe('0x15')][_0xf4fe('0x1c')]===0x1f4){return _0x5e8e18(_0x518d0d[_0xf4fe('0x15')][_0xf4fe('0x1d')]);}return _0x3e1d03(_0x518d0d[_0xf4fe('0x15')][_0xf4fe('0x1d')]);}else{_0x3e1d03(_0x518d0d['result']);}})[_0xf4fe('0x1e')](function(_0x5ca51d){_0x5e8e18(_0x5ca51d);});});}function getAgent(_0x186ef0){return db[_0xf4fe('0x1f')][_0xf4fe('0x20')]({'where':{'id':_0x186ef0,'role':_0xf4fe('0x21')}})[_0xf4fe('0x1b')](checkError());}function getAgentCheckSession(_0x5790f9,_0x35ae34){return new BPromise(function(_0x112b80,_0x1c455a){var _0x5c3f68=respondWithRpcPromise('VoiceChannels');var _0x2c94c9=getAgent(_0x5790f9);Promise['all']([_0x5c3f68,_0x2c94c9])['then'](function(_0x3d5133){var _0xcfc7b5=_0x3d5133[0x0];var _0x461367=_0x3d5133[0x1];var _0x1ffadb=_['filter'](_0xcfc7b5['rows'],function(_0x4b4832){return _0x4b4832[_0xf4fe('0x22')]==_0x461367['id']&&_0x4b4832['sessionId']==_0x35ae34;});if(_0x1ffadb[_0xf4fe('0x23')]==0x1){_0x112b80(_0x461367);}else{_0x1c455a(new RangeError(_0xf4fe('0x24')+_0x35ae34+_0xf4fe('0x25')));}});});}exports[_0xf4fe('0x26')]=function(_0x171f83,_0x3a0109){logger[_0xf4fe('0x27')](_0xf4fe('0x28'),_0x171f83[_0xf4fe('0x29')]);var _0x1d65c6=originateValidation[_0xf4fe('0xc')](_0x171f83[_0xf4fe('0x29')]);if(_0x1d65c6[_0xf4fe('0x23')]>0x0){return _0x3a0109['status'](0x190)[_0xf4fe('0x2a')](_0x1d65c6);}var _0x13de6a=_0x171f83['body'][_0xf4fe('0x2b')];var _0x3019ff=_0x171f83['body'][_0xf4fe('0x2c')];var _0x1cfa98=_0x171f83[_0xf4fe('0x29')][_0xf4fe('0x2d')];var _0x1270de=_0x171f83[_0xf4fe('0x29')]['callbackUrl'];return getAgent(_0x13de6a)[_0xf4fe('0x1b')](function(_0x10f729){logger['info'](_0xf4fe('0x2e'),_0x10f729[_0xf4fe('0x17')]);emit(util[_0xf4fe('0x2f')](_0xf4fe('0x30'),_0x10f729[_0xf4fe('0x17')]),'webbar:originate',{'callNumber':_0x3019ff,'callerId':_0x1cfa98,'callbackUrl':_0x1270de});return _0x3a0109[_0xf4fe('0x18')](0xc8)[_0xf4fe('0x2a')]({'error':![],'message':_0xf4fe('0x31')});})['catch'](handleError(_0x3a0109));};exports[_0xf4fe('0x32')]=function(_0x19945f,_0x4ea16a){logger[_0xf4fe('0x27')]('hangup\x20fired:',_0x19945f['body']);var _0x392729=hangupValidation[_0xf4fe('0xc')](_0x19945f[_0xf4fe('0x29')]);if(_0x392729['length']>0x0){return _0x4ea16a[_0xf4fe('0x18')](0x190)[_0xf4fe('0x2a')](_0x392729);}var _0x29396a=_0x19945f[_0xf4fe('0x29')][_0xf4fe('0x2b')];var _0x532784=_0x19945f[_0xf4fe('0x29')]['sessionId'];return getAgent(_0x29396a)['then'](function(_0x3e806c){logger[_0xf4fe('0x27')](_0xf4fe('0x2e'),_0x3e806c[_0xf4fe('0x17')]);emit(util['format'](_0xf4fe('0x30'),_0x3e806c[_0xf4fe('0x17')]),'webbar:hangup',{'sessionId':_0x532784});return _0x4ea16a[_0xf4fe('0x18')](0xc8)[_0xf4fe('0x2a')]({'error':![],'message':_0xf4fe('0x33')});})[_0xf4fe('0x1e')](handleError(_0x4ea16a));};exports['answer']=function(_0xb25f9e,_0x1fe567){logger[_0xf4fe('0x27')]('answer\x20fired:',_0xb25f9e[_0xf4fe('0x29')]);var _0x25c098=answerValidation[_0xf4fe('0xc')](_0xb25f9e[_0xf4fe('0x29')]);if(_0x25c098['length']>0x0){return _0x1fe567[_0xf4fe('0x18')](0x190)[_0xf4fe('0x2a')](_0x25c098);}var _0x3ecd8b=_0xb25f9e[_0xf4fe('0x29')][_0xf4fe('0x2b')];var _0x5effba=_0xb25f9e[_0xf4fe('0x29')][_0xf4fe('0x34')];return getAgent(_0x3ecd8b)[_0xf4fe('0x1b')](function(_0x3d76a8){logger[_0xf4fe('0x27')](_0xf4fe('0x2e'),_0x3d76a8[_0xf4fe('0x17')]);emit(util[_0xf4fe('0x2f')]('user:%s',_0x3d76a8[_0xf4fe('0x17')]),'webbar:answer',{'sessionId':_0x5effba});return _0x1fe567[_0xf4fe('0x18')](0xc8)[_0xf4fe('0x2a')]({'error':![],'message':_0xf4fe('0x35')});})['catch'](handleError(_0x1fe567));};exports[_0xf4fe('0x36')]=function(_0xaf567c,_0xbcfd5){logger[_0xf4fe('0x27')]('hold\x20fired:',_0xaf567c[_0xf4fe('0x29')]);var _0x4b3184=holdValidation[_0xf4fe('0xc')](_0xaf567c[_0xf4fe('0x29')]);if(_0x4b3184[_0xf4fe('0x23')]>0x0){return _0xbcfd5[_0xf4fe('0x18')](0x190)[_0xf4fe('0x2a')](_0x4b3184);}var _0x4a0cf0=_0xaf567c[_0xf4fe('0x29')]['userId'];var _0x6c5690=_0xaf567c[_0xf4fe('0x29')][_0xf4fe('0x34')];return getAgent(_0x4a0cf0)['then'](function(_0x59de95){logger['info'](_0xf4fe('0x2e'),_0x59de95[_0xf4fe('0x17')]);emit(util[_0xf4fe('0x2f')](_0xf4fe('0x30'),_0x59de95[_0xf4fe('0x17')]),_0xf4fe('0x37'),{'sessionId':_0x6c5690});return _0xbcfd5[_0xf4fe('0x18')](0xc8)['json']({'error':![],'message':_0xf4fe('0x38')});})[_0xf4fe('0x1e')](handleError(_0xbcfd5));};exports[_0xf4fe('0x39')]=function(_0x4bf5d7,_0x8b8fd9){logger[_0xf4fe('0x27')]('unhold\x20fired:',_0x4bf5d7[_0xf4fe('0x29')]);var _0x17f367=unholdValidation[_0xf4fe('0xc')](_0x4bf5d7['body']);if(_0x17f367['length']>0x0){return _0x8b8fd9[_0xf4fe('0x18')](0x190)[_0xf4fe('0x2a')](_0x17f367);}var _0x3f3385=_0x4bf5d7[_0xf4fe('0x29')]['userId'];var _0xdaeaa3=_0x4bf5d7[_0xf4fe('0x29')][_0xf4fe('0x34')];return getAgent(_0x3f3385)[_0xf4fe('0x1b')](function(_0x3acba3){logger[_0xf4fe('0x27')]('entityFound:',_0x3acba3[_0xf4fe('0x17')]);emit(util[_0xf4fe('0x2f')]('user:%s',_0x3acba3[_0xf4fe('0x17')]),_0xf4fe('0x3a'),{'sessionId':_0xdaeaa3});return _0x8b8fd9[_0xf4fe('0x18')](0xc8)[_0xf4fe('0x2a')]({'error':![],'message':'unhold\x20executed!'});})['catch'](handleError(_0x8b8fd9));};exports['calls']=function(_0x681557,_0x2ce7de){logger['info'](_0xf4fe('0x3b'),_0x2ce7de[_0xf4fe('0x29')]);var _0x1f21a4=callsValidation[_0xf4fe('0xc')](_0x681557[_0xf4fe('0x29')]);if(_0x1f21a4[_0xf4fe('0x23')]>0x0){return _0x2ce7de[_0xf4fe('0x18')](0x190)['json'](_0x1f21a4);}var _0x3a1cae=_0x681557[_0xf4fe('0x29')]['userId'];var _0x385d17=respondWithRpcPromise('VoiceChannels');var _0x427fef=getAgent(_0x3a1cae);return Promise['all']([_0x385d17,_0x427fef])[_0xf4fe('0x1b')](function(_0x453e83){var _0x36f2bc=_0x453e83[0x0];var _0x45f666=_0x453e83[0x1];var _0x28e559=_[_0xf4fe('0x3c')](_0x36f2bc[_0xf4fe('0x3d')],function(_0x335b0f){return _0x335b0f[_0xf4fe('0x22')]==_0x45f666['id'];});return _0x2ce7de['status'](0xc8)['json']({'count':_0x28e559[_0xf4fe('0x23')],'rows':_0x28e559});})[_0xf4fe('0x1e')](handleError(_0x2ce7de));};exports[_0xf4fe('0x3e')]=function(_0x525375,_0x21331d){logger[_0xf4fe('0x27')](_0xf4fe('0x3f'),_0x525375[_0xf4fe('0x29')]);var _0x4e345d=conferenceValidation[_0xf4fe('0xc')](_0x525375[_0xf4fe('0x29')]);if(_0x4e345d[_0xf4fe('0x23')]>0x0){return _0x21331d['status'](0x190)['json'](_0x4e345d);}var _0x1c3b42=_0x525375[_0xf4fe('0x29')][_0xf4fe('0x2b')];return getAgent(_0x1c3b42)['then'](function(_0x5b73e1){logger[_0xf4fe('0x27')](_0xf4fe('0x2e'),_0x5b73e1[_0xf4fe('0x17')]);emit(util[_0xf4fe('0x2f')](_0xf4fe('0x30'),_0x5b73e1[_0xf4fe('0x17')]),_0xf4fe('0x40'));return _0x21331d[_0xf4fe('0x18')](0xc8)['json']({'error':![],'message':_0xf4fe('0x41')});})[_0xf4fe('0x1e')](handleError(_0x21331d));};exports['transfer']=function(_0x48435d,_0x366ef1){logger[_0xf4fe('0x27')](_0xf4fe('0x42'),_0x48435d[_0xf4fe('0x29')]);var _0x5af151=transferValidation[_0xf4fe('0xc')](_0x48435d['body']);if(_0x5af151[_0xf4fe('0x23')]>0x0){return _0x366ef1[_0xf4fe('0x18')](0x190)[_0xf4fe('0x2a')](_0x5af151);}var _0x4b0f3d=_0x48435d['body']['userId'];var _0x2e625e=_0x48435d[_0xf4fe('0x29')][_0xf4fe('0x34')];var _0x4d770f=_0x48435d[_0xf4fe('0x29')][_0xf4fe('0x43')];return getAgent(_0x4b0f3d)[_0xf4fe('0x1b')](function(_0x3cb883){logger[_0xf4fe('0x27')](_0xf4fe('0x2e'),_0x3cb883['name']);emit(util[_0xf4fe('0x2f')](_0xf4fe('0x30'),_0x3cb883['name']),'webbar:transfer',{'sessionId':_0x2e625e,'transferNumber':_0x4d770f});return _0x366ef1['status'](0xc8)[_0xf4fe('0x2a')]({'error':![],'message':_0xf4fe('0x44')});})[_0xf4fe('0x1e')](handleError(_0x366ef1));}; \ No newline at end of file +var _0x85b5=['emit','handleError:','error','stack','name','status','send','then','code','message','result','catch','User','findOne','agent','VoiceChannels','all','rows','sessionId','length','sessionId\x20','\x20not\x20found!','originate','info','originate\x20fired:','body','json','callNumber','callbackUrl','entityFound:','format','user:%s','originate\x20executed!','hangup','hangup\x20fired:','userId','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','hold','hold\x20fired:','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','calls\x20fired:','filter','UserId','conference','conference\x20fired:','webbar:conference','transfer','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../config/environment','bluebird','http','webbarapi','ioredis','redis','socket.io-emitter','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','sessionId\x20is\x20required'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x85b5,0x7f));var _0x585b=function(_0x861c00,_0xca3ec){_0x861c00=_0x861c00-0x0;var _0x4c87cf=_0x85b5[_0x861c00];return _0x4c87cf;};'use strict';var path=require(_0x585b('0x0'));var fs=require('fs');var _=require(_0x585b('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x585b('0x2'));var util=require('util');var BPromise=require(_0x585b('0x3'));var jayson=require('jayson/promise');var amiClient=jayson['client'][_0x585b('0x4')]({'port':0x232a});var logger=require('../../config/logger')(_0x585b('0x5'));var Redis=require(_0x585b('0x6'));config[_0x585b('0x7')]=_['defaults'](config[_0x585b('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x585b('0x8'))(new Redis(config[_0x585b('0x7')]));var Schema=require(_0x585b('0x9'));var originateValidation=new Schema({'userId':{'type':_0x585b('0xa'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x585b('0xb'),'required':[!![],_0x585b('0xc')]},'callerId':{'type':_0x585b('0xb')},'callbackUrl':{'type':_0x585b('0xb')}});var hangupValidation=new Schema({'userId':{'type':_0x585b('0xa'),'required':[!![],_0x585b('0xd')]},'sessionId':{'type':_0x585b('0xb'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x585b('0xd')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x585b('0xa'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x585b('0xb'),'required':[!![],_0x585b('0xe')]},'transferNumber':{'type':_0x585b('0xb'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x585b('0xa'),'required':[!![],_0x585b('0xd')]},'sessionId':{'type':_0x585b('0xb'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x585b('0xa'),'required':[!![],_0x585b('0xd')]},'sessionId':{'type':_0x585b('0xb'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x585b('0xa'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x585b('0xa'),'required':[!![],_0x585b('0xd')]}});function emit(_0x4c094e,_0x4e2a41,_0xd53614){logger['info'](_0x4c094e,_0x4e2a41,JSON['stringify'](_0xd53614));io['to'](_0x4c094e)[_0x585b('0xf')](_0x4e2a41,_0xd53614);}function handleError(_0x46a9b5){return function(_0x20c4ba){console['log'](_0x585b('0x10'),_0x20c4ba,_0x20c4ba instanceof RangeError);logger[_0x585b('0x11')](_0x20c4ba[_0x585b('0x12')]);if(_0x20c4ba instanceof RangeError){if(_0x20c4ba[_0x585b('0x13')]){delete _0x20c4ba['name'];}_0x46a9b5[_0x585b('0x14')](0x194)[_0x585b('0x15')](_0x20c4ba);}else{if(_0x20c4ba[_0x585b('0x13')]){delete _0x20c4ba['name'];}_0x46a9b5['status'](0x1f4)[_0x585b('0x15')](_0x20c4ba);}};}function checkError(){return function(_0x56d178){if(!_0x56d178){throw new RangeError('NotFound');}return _0x56d178;};}function respondWithRpcPromise(_0x29e033,_0xb8b33a){return new BPromise(function(_0x48d9f8,_0x183308){var _0x272a8d=amiClient;return _0x272a8d['request'](_0x29e033,_0xb8b33a)[_0x585b('0x16')](function(_0xe50751){if(_0xe50751[_0x585b('0x11')]){if(_0xe50751['error'][_0x585b('0x17')]===0x1f4){return _0x183308(_0xe50751['error'][_0x585b('0x18')]);}return _0x48d9f8(_0xe50751[_0x585b('0x11')][_0x585b('0x18')]);}else{_0x48d9f8(_0xe50751[_0x585b('0x19')]);}})[_0x585b('0x1a')](function(_0x1b1241){_0x183308(_0x1b1241);});});}function getAgent(_0xd6bf9b){return db[_0x585b('0x1b')][_0x585b('0x1c')]({'where':{'id':_0xd6bf9b,'role':_0x585b('0x1d')}})[_0x585b('0x16')](checkError());}function getAgentCheckSession(_0x35075c,_0x11dc56){return new BPromise(function(_0x476ed9,_0x183e75){var _0x554099=respondWithRpcPromise(_0x585b('0x1e'));var _0x205ffe=getAgent(_0x35075c);Promise[_0x585b('0x1f')]([_0x554099,_0x205ffe])[_0x585b('0x16')](function(_0x5dad9a){var _0x4e9fc8=_0x5dad9a[0x0];var _0xedf913=_0x5dad9a[0x1];var _0x29b168=_['filter'](_0x4e9fc8[_0x585b('0x20')],function(_0x112fb5){return _0x112fb5['UserId']==_0xedf913['id']&&_0x112fb5[_0x585b('0x21')]==_0x11dc56;});if(_0x29b168[_0x585b('0x22')]==0x1){_0x476ed9(_0xedf913);}else{_0x183e75(new RangeError(_0x585b('0x23')+_0x11dc56+_0x585b('0x24')));}});});}exports[_0x585b('0x25')]=function(_0x3d1433,_0x227149){logger[_0x585b('0x26')](_0x585b('0x27'),_0x3d1433[_0x585b('0x28')]);var _0x4d763c=originateValidation[_0x585b('0x9')](_0x3d1433[_0x585b('0x28')]);if(_0x4d763c[_0x585b('0x22')]>0x0){return _0x227149['status'](0x190)[_0x585b('0x29')](_0x4d763c);}var _0x65cefc=_0x3d1433[_0x585b('0x28')]['userId'];var _0x31c42c=_0x3d1433[_0x585b('0x28')][_0x585b('0x2a')];var _0x7d4cc3=_0x3d1433['body']['callerId'];var _0xa29269=_0x3d1433[_0x585b('0x28')][_0x585b('0x2b')];return getAgent(_0x65cefc)[_0x585b('0x16')](function(_0x179502){logger['info'](_0x585b('0x2c'),_0x179502[_0x585b('0x13')]);emit(util[_0x585b('0x2d')](_0x585b('0x2e'),_0x179502[_0x585b('0x13')]),'webbar:originate',{'callNumber':_0x31c42c,'callerId':_0x7d4cc3,'callbackUrl':_0xa29269});return _0x227149['status'](0xc8)['json']({'error':![],'message':_0x585b('0x2f')});})[_0x585b('0x1a')](handleError(_0x227149));};exports[_0x585b('0x30')]=function(_0x8ecc5f,_0x3e6943){logger[_0x585b('0x26')](_0x585b('0x31'),_0x8ecc5f[_0x585b('0x28')]);var _0x6cec28=hangupValidation['validate'](_0x8ecc5f[_0x585b('0x28')]);if(_0x6cec28[_0x585b('0x22')]>0x0){return _0x3e6943['status'](0x190)[_0x585b('0x29')](_0x6cec28);}var _0x3bf1bd=_0x8ecc5f[_0x585b('0x28')][_0x585b('0x32')];var _0xc82017=_0x8ecc5f[_0x585b('0x28')]['sessionId'];return getAgent(_0x3bf1bd)[_0x585b('0x16')](function(_0x3c10b2){logger[_0x585b('0x26')](_0x585b('0x2c'),_0x3c10b2[_0x585b('0x13')]);emit(util[_0x585b('0x2d')](_0x585b('0x2e'),_0x3c10b2[_0x585b('0x13')]),'webbar:hangup',{'sessionId':_0xc82017});return _0x3e6943[_0x585b('0x14')](0xc8)[_0x585b('0x29')]({'error':![],'message':_0x585b('0x33')});})['catch'](handleError(_0x3e6943));};exports[_0x585b('0x34')]=function(_0x698a0f,_0x2b6b1b){logger['info'](_0x585b('0x35'),_0x698a0f[_0x585b('0x28')]);var _0x5112f5=answerValidation['validate'](_0x698a0f[_0x585b('0x28')]);if(_0x5112f5['length']>0x0){return _0x2b6b1b[_0x585b('0x14')](0x190)['json'](_0x5112f5);}var _0x207d79=_0x698a0f[_0x585b('0x28')]['userId'];var _0xa26652=_0x698a0f['body']['sessionId'];return getAgent(_0x207d79)['then'](function(_0x2d07e4){logger['info'](_0x585b('0x2c'),_0x2d07e4[_0x585b('0x13')]);emit(util['format'](_0x585b('0x2e'),_0x2d07e4[_0x585b('0x13')]),_0x585b('0x36'),{'sessionId':_0xa26652});return _0x2b6b1b['status'](0xc8)['json']({'error':![],'message':'answer\x20executed!'});})[_0x585b('0x1a')](handleError(_0x2b6b1b));};exports[_0x585b('0x37')]=function(_0xa008dc,_0xceec5f){logger['info'](_0x585b('0x38'),_0xa008dc[_0x585b('0x28')]);var _0x30bf1c=holdValidation[_0x585b('0x9')](_0xa008dc['body']);if(_0x30bf1c[_0x585b('0x22')]>0x0){return _0xceec5f[_0x585b('0x14')](0x190)[_0x585b('0x29')](_0x30bf1c);}var _0x5bf8b4=_0xa008dc[_0x585b('0x28')]['userId'];var _0x492f3f=_0xa008dc['body'][_0x585b('0x21')];return getAgent(_0x5bf8b4)['then'](function(_0x1f8ae0){logger['info']('entityFound:',_0x1f8ae0['name']);emit(util[_0x585b('0x2d')](_0x585b('0x2e'),_0x1f8ae0['name']),'webbar:hold',{'sessionId':_0x492f3f});return _0xceec5f[_0x585b('0x14')](0xc8)[_0x585b('0x29')]({'error':![],'message':_0x585b('0x39')});})['catch'](handleError(_0xceec5f));};exports[_0x585b('0x3a')]=function(_0x4ca120,_0x44234e){logger['info'](_0x585b('0x3b'),_0x4ca120['body']);var _0x3b96db=unholdValidation['validate'](_0x4ca120[_0x585b('0x28')]);if(_0x3b96db[_0x585b('0x22')]>0x0){return _0x44234e[_0x585b('0x14')](0x190)[_0x585b('0x29')](_0x3b96db);}var _0x2c5e45=_0x4ca120['body'][_0x585b('0x32')];var _0x2ef157=_0x4ca120[_0x585b('0x28')][_0x585b('0x21')];return getAgent(_0x2c5e45)[_0x585b('0x16')](function(_0x349a8f){logger['info'](_0x585b('0x2c'),_0x349a8f[_0x585b('0x13')]);emit(util[_0x585b('0x2d')](_0x585b('0x2e'),_0x349a8f['name']),_0x585b('0x3c'),{'sessionId':_0x2ef157});return _0x44234e[_0x585b('0x14')](0xc8)[_0x585b('0x29')]({'error':![],'message':'unhold\x20executed!'});})['catch'](handleError(_0x44234e));};exports['calls']=function(_0x593c52,_0x4b4756){logger['info'](_0x585b('0x3d'),_0x4b4756[_0x585b('0x28')]);var _0x102733=callsValidation['validate'](_0x593c52[_0x585b('0x28')]);if(_0x102733[_0x585b('0x22')]>0x0){return _0x4b4756[_0x585b('0x14')](0x190)[_0x585b('0x29')](_0x102733);}var _0x53387b=_0x593c52[_0x585b('0x28')][_0x585b('0x32')];var _0x45b325=respondWithRpcPromise(_0x585b('0x1e'));var _0xe4f07b=getAgent(_0x53387b);return Promise[_0x585b('0x1f')]([_0x45b325,_0xe4f07b])[_0x585b('0x16')](function(_0x55828f){var _0x35b841=_0x55828f[0x0];var _0x3c4ee5=_0x55828f[0x1];var _0x1cb07a=_[_0x585b('0x3e')](_0x35b841[_0x585b('0x20')],function(_0x3c8073){return _0x3c8073[_0x585b('0x3f')]==_0x3c4ee5['id'];});return _0x4b4756[_0x585b('0x14')](0xc8)[_0x585b('0x29')]({'count':_0x1cb07a[_0x585b('0x22')],'rows':_0x1cb07a});})[_0x585b('0x1a')](handleError(_0x4b4756));};exports[_0x585b('0x40')]=function(_0x305064,_0x212d51){logger['info'](_0x585b('0x41'),_0x305064['body']);var _0x26c157=conferenceValidation[_0x585b('0x9')](_0x305064['body']);if(_0x26c157[_0x585b('0x22')]>0x0){return _0x212d51[_0x585b('0x14')](0x190)['json'](_0x26c157);}var _0x58d087=_0x305064['body']['userId'];return getAgent(_0x58d087)['then'](function(_0x477cfb){logger['info'](_0x585b('0x2c'),_0x477cfb[_0x585b('0x13')]);emit(util[_0x585b('0x2d')](_0x585b('0x2e'),_0x477cfb[_0x585b('0x13')]),_0x585b('0x42'));return _0x212d51['status'](0xc8)['json']({'error':![],'message':'conference\x20executed!'});})[_0x585b('0x1a')](handleError(_0x212d51));};exports[_0x585b('0x43')]=function(_0x42e155,_0x117a66){logger[_0x585b('0x26')]('transfer\x20fired:',_0x42e155[_0x585b('0x28')]);var _0x14f0bd=transferValidation[_0x585b('0x9')](_0x42e155[_0x585b('0x28')]);if(_0x14f0bd[_0x585b('0x22')]>0x0){return _0x117a66['status'](0x190)[_0x585b('0x29')](_0x14f0bd);}var _0x35ca81=_0x42e155[_0x585b('0x28')][_0x585b('0x32')];var _0x1efdaa=_0x42e155['body'][_0x585b('0x21')];var _0x219ca8=_0x42e155[_0x585b('0x28')][_0x585b('0x44')];return getAgent(_0x35ca81)['then'](function(_0x3f7717){logger[_0x585b('0x26')](_0x585b('0x2c'),_0x3f7717[_0x585b('0x13')]);emit(util[_0x585b('0x2d')](_0x585b('0x2e'),_0x3f7717['name']),_0x585b('0x45'),{'sessionId':_0x1efdaa,'transferNumber':_0x219ca8});return _0x117a66[_0x585b('0x14')](0xc8)[_0x585b('0x29')]({'error':![],'message':_0x585b('0x46')});})[_0x585b('0x1a')](handleError(_0x117a66));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 2e0783e..5850d85 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 _0x4a11=['/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','post','create','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x3132c2,_0x5a5e74){var _0x318560=function(_0x222546){while(--_0x222546){_0x3132c2['push'](_0x3132c2['shift']());}};_0x318560(++_0x5a5e74);}(_0x4a11,0xb7));var _0x14a1=function(_0x16bb4b,_0x5fe431){_0x16bb4b=_0x16bb4b-0x0;var _0x8aeb84=_0x4a11[_0x16bb4b];return _0x8aeb84;};'use strict';var multer=require(_0x14a1('0x0'));var util=require(_0x14a1('0x1'));var path=require(_0x14a1('0x2'));var timeout=require(_0x14a1('0x3'));var express=require(_0x14a1('0x4'));var router=express[_0x14a1('0x5')]();var fs_extra=require(_0x14a1('0x6'));var auth=require(_0x14a1('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x14a1('0x8'));var controller=require('./whatsappAccount.controller');router[_0x14a1('0x9')]('/',auth[_0x14a1('0xa')](),controller[_0x14a1('0xb')]);router['get'](_0x14a1('0xc'),auth[_0x14a1('0xa')](),controller[_0x14a1('0xd')]);router[_0x14a1('0x9')](_0x14a1('0xe'),auth[_0x14a1('0xa')](),controller[_0x14a1('0xf')]);router[_0x14a1('0x9')](_0x14a1('0x10'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x14a1('0x9')](_0x14a1('0x11'),auth[_0x14a1('0xa')](),controller[_0x14a1('0x12')]);router[_0x14a1('0x9')](_0x14a1('0x13'),auth[_0x14a1('0xa')](),controller[_0x14a1('0x14')]);router[_0x14a1('0x9')](_0x14a1('0x15'),auth[_0x14a1('0xa')](),controller['getApplications']);router[_0x14a1('0x16')]('/',auth['isAuthenticated'](),controller[_0x14a1('0x17')]);router[_0x14a1('0x16')]('/:id/dispositions',auth[_0x14a1('0xa')](),controller['addDisposition']);router[_0x14a1('0x16')](_0x14a1('0x11'),auth[_0x14a1('0xa')](),controller[_0x14a1('0x18')]);router['post'](_0x14a1('0x13'),auth[_0x14a1('0xa')](),controller[_0x14a1('0x19')]);router[_0x14a1('0x16')](_0x14a1('0x15'),auth['isAuthenticated'](),controller[_0x14a1('0x1a')]);router[_0x14a1('0x16')](_0x14a1('0x1b'),controller[_0x14a1('0x1c')]);router[_0x14a1('0x16')](_0x14a1('0x1d'),auth[_0x14a1('0xa')](),controller[_0x14a1('0x1e')]);router[_0x14a1('0x1f')](_0x14a1('0xe'),auth['isAuthenticated'](),controller[_0x14a1('0x20')]);router[_0x14a1('0x21')](_0x14a1('0xe'),auth['isAuthenticated'](),controller[_0x14a1('0x22')]);router[_0x14a1('0x21')](_0x14a1('0x10'),auth['isAuthenticated'](),controller[_0x14a1('0x23')]);router[_0x14a1('0x21')](_0x14a1('0x11'),auth['isAuthenticated'](),controller[_0x14a1('0x24')]);router[_0x14a1('0x21')](_0x14a1('0x13'),auth[_0x14a1('0xa')](),controller[_0x14a1('0x25')]);module[_0x14a1('0x26')]=router; \ No newline at end of file +var _0x90ba=['../../components/auth/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','addDisposition','addAnswer','addAgents','addApplications','/:id/notify','notify','send','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x4b2cc6,_0x29ef43){var _0x3e0b08=function(_0x3b4131){while(--_0x3b4131){_0x4b2cc6['push'](_0x4b2cc6['shift']());}};_0x3e0b08(++_0x29ef43);}(_0x90ba,0x147));var _0xa90b=function(_0x17e356,_0x42c4f0){_0x17e356=_0x17e356-0x0;var _0x2edf87=_0x90ba[_0x17e356];return _0x2edf87;};'use strict';var multer=require(_0xa90b('0x0'));var util=require(_0xa90b('0x1'));var path=require(_0xa90b('0x2'));var timeout=require(_0xa90b('0x3'));var express=require(_0xa90b('0x4'));var router=express[_0xa90b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa90b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa90b('0x7'));var controller=require(_0xa90b('0x8'));router[_0xa90b('0x9')]('/',auth[_0xa90b('0xa')](),controller[_0xa90b('0xb')]);router[_0xa90b('0x9')](_0xa90b('0xc'),auth[_0xa90b('0xa')](),controller['describe']);router[_0xa90b('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0xa90b('0xd'),auth[_0xa90b('0xa')](),controller[_0xa90b('0xe')]);router[_0xa90b('0x9')](_0xa90b('0xf'),auth['isAuthenticated'](),controller[_0xa90b('0x10')]);router[_0xa90b('0x9')](_0xa90b('0x11'),auth[_0xa90b('0xa')](),controller[_0xa90b('0x12')]);router['get'](_0xa90b('0x13'),auth[_0xa90b('0xa')](),controller[_0xa90b('0x14')]);router[_0xa90b('0x15')]('/',auth[_0xa90b('0xa')](),controller['create']);router[_0xa90b('0x15')](_0xa90b('0xd'),auth[_0xa90b('0xa')](),controller[_0xa90b('0x16')]);router[_0xa90b('0x15')](_0xa90b('0xf'),auth[_0xa90b('0xa')](),controller[_0xa90b('0x17')]);router['post'](_0xa90b('0x11'),auth[_0xa90b('0xa')](),controller[_0xa90b('0x18')]);router[_0xa90b('0x15')](_0xa90b('0x13'),auth[_0xa90b('0xa')](),controller[_0xa90b('0x19')]);router[_0xa90b('0x15')](_0xa90b('0x1a'),controller[_0xa90b('0x1b')]);router['post']('/:id/send',auth['isAuthenticated'](),controller[_0xa90b('0x1c')]);router['put'](_0xa90b('0x1d'),auth['isAuthenticated'](),controller[_0xa90b('0x1e')]);router[_0xa90b('0x1f')](_0xa90b('0x1d'),auth[_0xa90b('0xa')](),controller[_0xa90b('0x20')]);router[_0xa90b('0x1f')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xa90b('0x21')]);router[_0xa90b('0x1f')](_0xa90b('0xf'),auth[_0xa90b('0xa')](),controller[_0xa90b('0x22')]);router[_0xa90b('0x1f')](_0xa90b('0x11'),auth['isAuthenticated'](),controller[_0xa90b('0x23')]);module[_0xa90b('0x24')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index d3247cb..902e61e 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 _0x20b3=['setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x410e30,_0x46daa0){var _0x5bb274=function(_0x2043fa){while(--_0x2043fa){_0x410e30['push'](_0x410e30['shift']());}};_0x5bb274(++_0x46daa0);}(_0x20b3,0x1a6));var _0x320b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x20b3[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x320b('0x0'));var rs=require(_0x320b('0x1'));module[_0x320b('0x2')]={'name':{'type':Sequelize[_0x320b('0x3')],'unique':_0x320b('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x320b('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x320b('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x320b('0x3')],'defaultValue':function(){return rs[_0x320b('0x5')]();}},'phone':{'type':Sequelize[_0x320b('0x3')]},'type':{'type':Sequelize[_0x320b('0x6')]('twilio','sinch')},'accountSid':{'type':Sequelize[_0x320b('0x3')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x320b('0x7')],'defaultValue':function(){return _0x320b('0x8');}},'notificationSound':{'type':Sequelize[_0x320b('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x320b('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x320b('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x320b('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x320b('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x320b('0xa')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x320b('0xb'),'set':function(_0x56c85d){if(!_0x56c85d){this[_0x320b('0xc')]('mandatoryDispositionPauseId',null);}this[_0x320b('0xc')](_0x320b('0xd'),_0x56c85d);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x325e=['STRING','name','generate','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring'];(function(_0xad8706,_0x3f7662){var _0x4d1d6c=function(_0x3f5ad7){while(--_0x3f5ad7){_0xad8706['push'](_0xad8706['shift']());}};_0x4d1d6c(++_0x3f7662);}(_0x325e,0xc1));var _0xe325=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x325e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe325('0x0'));var rs=require(_0xe325('0x1'));module['exports']={'name':{'type':Sequelize[_0xe325('0x2')],'unique':_0xe325('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xe325('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xe325('0x2')],'defaultValue':function(){return rs[_0xe325('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM']('twilio',_0xe325('0x5'))},'accountSid':{'type':Sequelize[_0xe325('0x2')]},'baseUrl':{'type':Sequelize[_0xe325('0x2')]},'authToken':{'type':Sequelize[_0xe325('0x2')]},'notificationTemplate':{'type':Sequelize[_0xe325('0x6')],'defaultValue':function(){return _0xe325('0x7');}},'notificationSound':{'type':Sequelize[_0xe325('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xe325('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xe325('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe325('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe325('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe325('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe325('0x9')],'comment':_0xe325('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xe325('0x8')],'defaultValue':![],'comment':_0xe325('0xb'),'set':function(_0x3217e4){if(!_0x3217e4){this[_0xe325('0xc')](_0xe325('0xd'),null);}this[_0xe325('0xc')](_0xe325('0xe'),_0x3217e4);}},'description':{'type':Sequelize[_0xe325('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index c8dc433..1d7b49e 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 _0x6582=['timestamp','applications','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','ListId','mobile','twilio','from','replace','whatsapp:','Body','messageId','MessageSid','sinch','notifications','message_id','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','updatedAt','DESC','list','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','WhatsappQueue','queueId','queue','waitForTheAssignedQueue','Start','entity\x20found','stringify','Content-Type','text/xml','send','\x0a','CmList','List','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','WhatsappAccount,\x20%s,\x20%s','result','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','WhatsappAccounts','UserProfileResource','name','Pause','map','WhatsappAccount','rawAttributes','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','rows','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','User','getAgents','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','findAndCountAll','priority','getApplications','notify','Applications','account','type','statuses','state','WhatsappMessage'];(function(_0xedd0d5,_0x46cfc9){var _0x4800f4=function(_0x4e1017){while(--_0x4e1017){_0xedd0d5['push'](_0xedd0d5['shift']());}};_0x4800f4(++_0x46cfc9);}(_0x6582,0x108));var _0x2658=function(_0x3de822,_0x5d1466){_0x3de822=_0x3de822-0x0;var _0x1475c9=_0x6582[_0x3de822];return _0x1475c9;};'use strict';var emlformat=require(_0x2658('0x0'));var rimraf=require(_0x2658('0x1'));var zipdir=require(_0x2658('0x2'));var jsonpatch=require(_0x2658('0x3'));var rp=require(_0x2658('0x4'));var moment=require('moment');var BPromise=require(_0x2658('0x5'));var Mustache=require(_0x2658('0x6'));var util=require(_0x2658('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2658('0x8'));var fs=require('fs');var fs_extra=require(_0x2658('0x9'));var _=require(_0x2658('0xa'));var squel=require(_0x2658('0xb'));var crypto=require(_0x2658('0xc'));var jsforce=require(_0x2658('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2658('0xe'));var querystring=require(_0x2658('0xf'));var Papa=require(_0x2658('0x10'));var Redis=require(_0x2658('0x11'));var authService=require(_0x2658('0x12'));var qs=require(_0x2658('0x13'));var as=require(_0x2658('0x14'));var hardwareService=require(_0x2658('0x15'));var logger=require(_0x2658('0x16'))('api');var utils=require(_0x2658('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2658('0x18'));var db=require(_0x2658('0x19'))['db'];config[_0x2658('0x1a')]=_[_0x2658('0x1b')](config[_0x2658('0x1a')],{'host':_0x2658('0x1c'),'port':0x18eb});var socket=require(_0x2658('0x1d'))(new Redis(config['redis']));require(_0x2658('0x1e'))[_0x2658('0x1f')](socket);var jayson=require(_0x2658('0x20'));var client=jayson[_0x2658('0x21')][_0x2658('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x59013b,_0x2fc995,_0x5d8ed5,_0x15bd54){return new BPromise(function(_0x496524,_0xc820a){var _0x44c6d2=_0x15bd54||client;return _0x44c6d2[_0x2658('0x23')](_0x59013b,_0x5d8ed5)[_0x2658('0x24')](function(_0x5c65a7){logger[_0x2658('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0x2fc995,_0x2658('0x26'));logger[_0x2658('0x27')](_0x2658('0x28'),_0x2fc995,_0x2658('0x26'),JSON['stringify'](_0x5c65a7));if(_0x5c65a7[_0x2658('0x29')]){if(_0x5c65a7[_0x2658('0x29')][_0x2658('0x2a')]===0x1f4){logger[_0x2658('0x29')](_0x2658('0x2b'),_0x2fc995,_0x5c65a7[_0x2658('0x29')]['message']);return _0xc820a(_0x5c65a7[_0x2658('0x29')]['message']);}logger['error'](_0x2658('0x2b'),_0x2fc995,_0x5c65a7[_0x2658('0x29')]['message']);return _0x496524(_0x5c65a7[_0x2658('0x29')]['message']);}else{logger[_0x2658('0x25')](_0x2658('0x2b'),_0x2fc995,_0x2658('0x26'));_0x496524(_0x5c65a7[_0x2658('0x2c')][_0x2658('0x2d')]);}})[_0x2658('0x2e')](function(_0xe9f81){logger[_0x2658('0x29')](_0x2658('0x2b'),_0x2fc995,_0xe9f81);_0xc820a(_0xe9f81);});});}function respondWithStatusCode(_0x43b6c0,_0x566cec){_0x566cec=_0x566cec||0xcc;return function(_0x2062ef){if(_0x2062ef){return _0x43b6c0[_0x2658('0x2f')](_0x566cec);}return _0x43b6c0[_0x2658('0x30')](_0x566cec)[_0x2658('0x31')]();};}function respondWithResult(_0x25f837,_0x3a4b45){_0x3a4b45=_0x3a4b45||0xc8;return function(_0x58385f){if(_0x58385f){return _0x25f837[_0x2658('0x30')](_0x3a4b45)[_0x2658('0x32')](_0x58385f);}};}function respondWithFilteredResult(_0x2a3141,_0x255759){return function(_0x27e0f5){if(_0x27e0f5){var _0x1492cb=typeof _0x255759[_0x2658('0x33')]===_0x2658('0x34')&&typeof _0x255759[_0x2658('0x35')]===_0x2658('0x34');var _0x2d1fad=_0x27e0f5[_0x2658('0x36')];var _0x291bb4=_0x1492cb?0x0:_0x255759[_0x2658('0x33')];var _0x2c6172=_0x1492cb?_0x27e0f5[_0x2658('0x36')]:_0x255759[_0x2658('0x33')]+_0x255759[_0x2658('0x35')];var _0x47ea74;if(_0x2c6172>=_0x2d1fad){_0x2c6172=_0x2d1fad;_0x47ea74=0xc8;}else{_0x47ea74=0xce;}_0x2a3141[_0x2658('0x30')](_0x47ea74);return _0x2a3141[_0x2658('0x37')](_0x2658('0x38'),_0x291bb4+'-'+_0x2c6172+'/'+_0x2d1fad)['json'](_0x27e0f5);}return null;};}function patchUpdates(_0x3955eb){return function(_0x44db3c){try{jsonpatch[_0x2658('0x39')](_0x44db3c,_0x3955eb,!![]);}catch(_0x5e9e6f){return BPromise[_0x2658('0x3a')](_0x5e9e6f);}return _0x44db3c[_0x2658('0x3b')]();};}function saveUpdates(_0x324403,_0x455e1b){return function(_0x28b0bf){if(_0x28b0bf){return _0x28b0bf[_0x2658('0x3c')](_0x324403)[_0x2658('0x24')](function(_0x1f0640){return _0x1f0640;});}return null;};}function removeEntity(_0xfc7d10,_0x4b96ce){return function(_0x2a9fc9){if(_0x2a9fc9){return _0x2a9fc9[_0x2658('0x3d')]()[_0x2658('0x24')](function(){var _0x4e7578=_0x2a9fc9['get']({'plain':!![]});var _0x5c0f51=_0x2658('0x3e');return db[_0x2658('0x3f')][_0x2658('0x3d')]({'where':{'type':_0x5c0f51,'resourceId':_0x4e7578['id']}})[_0x2658('0x24')](function(){return _0x2a9fc9;});})[_0x2658('0x24')](function(){_0xfc7d10[_0x2658('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b2351,_0x302e36){return function(_0x2b3b99){if(!_0x2b3b99){_0x2b2351['sendStatus'](0x194);}return _0x2b3b99;};}function handleError(_0xb8fd62,_0x3798ba){_0x3798ba=_0x3798ba||0x1f4;return function(_0x117010){logger[_0x2658('0x29')](_0x117010['stack']);if(_0x117010[_0x2658('0x40')]){delete _0x117010[_0x2658('0x40')];}_0xb8fd62['status'](_0x3798ba)['send'](_0x117010);};}exports['index']=function(_0x4fb397,_0x2b5083){var _0x1f6b70={'include':[{'model':db[_0x2658('0x41')],'as':'mandatoryDispositionPause'}]},_0x370026={},_0x5e728d={'count':0x0,'rows':[]};var _0x54d14b=_[_0x2658('0x42')](db[_0x2658('0x43')][_0x2658('0x44')],function(_0x52e358){return{'name':_0x52e358['fieldName'],'type':_0x52e358['type']['key']};});_0x370026[_0x2658('0x45')]=_[_0x2658('0x42')](_0x54d14b,_0x2658('0x40'));_0x370026[_0x2658('0x46')]=_['keys'](_0x4fb397[_0x2658('0x46')]);_0x370026[_0x2658('0x47')]=_[_0x2658('0x48')](_0x370026[_0x2658('0x45')],_0x370026[_0x2658('0x46')]);_0x1f6b70['attributes']=_[_0x2658('0x48')](_0x370026[_0x2658('0x45')],qs[_0x2658('0x49')](_0x4fb397[_0x2658('0x46')][_0x2658('0x49')]));_0x1f6b70[_0x2658('0x4a')]=_0x1f6b70[_0x2658('0x4a')][_0x2658('0x4b')]?_0x1f6b70[_0x2658('0x4a')]:_0x370026[_0x2658('0x45')];if(!_0x4fb397[_0x2658('0x46')][_0x2658('0x4c')]('nolimit')){_0x1f6b70['limit']=qs[_0x2658('0x35')](_0x4fb397[_0x2658('0x46')][_0x2658('0x35')]);_0x1f6b70['offset']=qs[_0x2658('0x33')](_0x4fb397[_0x2658('0x46')][_0x2658('0x33')]);}_0x1f6b70[_0x2658('0x4d')]=qs['sort'](_0x4fb397[_0x2658('0x46')][_0x2658('0x4e')]);_0x1f6b70[_0x2658('0x4f')]=qs[_0x2658('0x47')](_[_0x2658('0x50')](_0x4fb397[_0x2658('0x46')],_0x370026['filters']),_0x54d14b);if(_0x4fb397[_0x2658('0x46')]['filter']){_0x1f6b70[_0x2658('0x4f')]=_[_0x2658('0x51')](_0x1f6b70['where'],{'$or':_[_0x2658('0x42')](_0x54d14b,function(_0x21f380){if(_0x21f380['type']!==_0x2658('0x52')){var _0x14f5ac={};_0x14f5ac[_0x21f380[_0x2658('0x40')]]={'$like':'%'+_0x4fb397[_0x2658('0x46')][_0x2658('0x53')]+'%'};return _0x14f5ac;}})});}_0x1f6b70=_['merge']({},_0x1f6b70,_0x4fb397[_0x2658('0x54')]);var _0x2a43f3={'where':_0x1f6b70['where']};return db[_0x2658('0x43')][_0x2658('0x36')](_0x2a43f3)[_0x2658('0x24')](function(_0x1efb33){_0x5e728d['count']=_0x1efb33;if(_0x4fb397[_0x2658('0x46')][_0x2658('0x55')]){_0x1f6b70[_0x2658('0x56')]=[{'all':!![]}];}return db[_0x2658('0x43')][_0x2658('0x57')](_0x1f6b70);})[_0x2658('0x24')](function(_0x994264){_0x5e728d['rows']=_0x994264;return _0x5e728d;})[_0x2658('0x24')](respondWithFilteredResult(_0x2b5083,_0x1f6b70))['catch'](handleError(_0x2b5083,null));};exports[_0x2658('0x58')]=function(_0x51e522,_0x30da5c){var _0xf4d19f={'raw':![],'where':{'id':_0x51e522[_0x2658('0x59')]['id']},'include':[{'model':db[_0x2658('0x41')],'as':'mandatoryDispositionPause'}]},_0x228d3d={};_0x228d3d[_0x2658('0x45')]=_[_0x2658('0x5a')](db[_0x2658('0x43')]['rawAttributes']);_0x228d3d[_0x2658('0x46')]=_[_0x2658('0x5a')](_0x51e522[_0x2658('0x46')]);_0x228d3d[_0x2658('0x47')]=_['intersection'](_0x228d3d[_0x2658('0x45')],_0x228d3d['query']);_0xf4d19f['attributes']=_[_0x2658('0x48')](_0x228d3d[_0x2658('0x45')],qs[_0x2658('0x49')](_0x51e522['query'][_0x2658('0x49')]));_0xf4d19f[_0x2658('0x4a')]=_0xf4d19f['attributes'][_0x2658('0x4b')]?_0xf4d19f['attributes']:_0x228d3d['model'];if(_0x51e522[_0x2658('0x46')][_0x2658('0x55')]){_0xf4d19f['include']=[{'all':!![]}];}_0xf4d19f=_[_0x2658('0x51')]({},_0xf4d19f,_0x51e522[_0x2658('0x54')]);return db[_0x2658('0x43')]['find'](_0xf4d19f)['then'](handleEntityNotFound(_0x30da5c,null))[_0x2658('0x24')](respondWithResult(_0x30da5c,null))['catch'](handleError(_0x30da5c,null));};exports['create']=function(_0x263a29,_0x5502bb){return db[_0x2658('0x43')][_0x2658('0x5b')](_0x263a29[_0x2658('0x5c')],{})[_0x2658('0x24')](function(_0x22f2dc){var _0x182c0c=_0x263a29[_0x2658('0x5d')]['get']({'plain':!![]});if(!_0x182c0c)throw new Error(_0x2658('0x5e'));if(_0x182c0c['role']===_0x2658('0x5d')){var _0x121405=_0x22f2dc[_0x2658('0x5f')]({'plain':!![]});var _0x41208a='WhatsappAccounts';return db['UserProfileSection'][_0x2658('0x60')]({'where':{'name':_0x41208a,'userProfileId':_0x182c0c[_0x2658('0x61')]},'raw':!![]})['then'](function(_0x5dce22){if(_0x5dce22&&_0x5dce22[_0x2658('0x62')]===0x0){return db[_0x2658('0x3f')][_0x2658('0x5b')]({'name':_0x121405[_0x2658('0x40')],'resourceId':_0x121405['id'],'type':_0x5dce22[_0x2658('0x40')],'sectionId':_0x5dce22['id']},{})['then'](function(){return _0x22f2dc;});}else{return _0x22f2dc;}})[_0x2658('0x2e')](function(_0x566d11){logger[_0x2658('0x29')](_0x2658('0x63'),_0x566d11);throw _0x566d11;});}return _0x22f2dc;})['then'](respondWithResult(_0x5502bb,0xc9))[_0x2658('0x2e')](handleError(_0x5502bb,null));};exports[_0x2658('0x3c')]=function(_0x55b1ec,_0x2405e3){if(_0x55b1ec[_0x2658('0x5c')]['id']){delete _0x55b1ec[_0x2658('0x5c')]['id'];}return db[_0x2658('0x43')]['find']({'where':{'id':_0x55b1ec['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x2658('0x24')](handleEntityNotFound(_0x2405e3,null))['then'](saveUpdates(_0x55b1ec[_0x2658('0x5c')],null))[_0x2658('0x24')](respondWithResult(_0x2405e3,null))[_0x2658('0x2e')](handleError(_0x2405e3,null));};exports[_0x2658('0x3d')]=function(_0x47a6bb,_0x12e573){return db['WhatsappAccount'][_0x2658('0x60')]({'where':{'id':_0x47a6bb[_0x2658('0x59')]['id']}})[_0x2658('0x24')](handleEntityNotFound(_0x12e573,null))[_0x2658('0x24')](removeEntity(_0x12e573,null))['catch'](handleError(_0x12e573,null));};exports[_0x2658('0x64')]=function(_0x4b1610,_0x191889){return db[_0x2658('0x43')][_0x2658('0x64')]()[_0x2658('0x24')](respondWithResult(_0x191889,null))[_0x2658('0x2e')](handleError(_0x191889,null));};exports[_0x2658('0x65')]=function(_0x12ed12,_0x37cab0,_0x5cd263){if(_0x12ed12[_0x2658('0x5c')]['id']){delete _0x12ed12[_0x2658('0x5c')]['id'];}return db[_0x2658('0x43')]['find']({'where':{'id':_0x12ed12[_0x2658('0x59')]['id']}})['then'](handleEntityNotFound(_0x37cab0,null))[_0x2658('0x24')](function(_0x4e69c4){if(_0x4e69c4){_0x12ed12[_0x2658('0x5c')][_0x2658('0x66')]=_0x4e69c4['id'];return db[_0x2658('0x67')]['create'](_0x12ed12['body']);}})['then'](respondWithResult(_0x37cab0,null))['catch'](handleError(_0x37cab0,null));};exports['getDispositions']=function(_0x2d4bb9,_0xd51c51,_0x446895){var _0x107a9e={'raw':![],'where':{}};var _0x4e26f2={};var _0x4267c1={'count':0x0,'rows':[]};return db[_0x2658('0x43')]['findOne']({'where':{'id':_0x2d4bb9[_0x2658('0x59')]['id']}})['then'](handleEntityNotFound(_0xd51c51,null))[_0x2658('0x24')](function(_0x3f62c9){if(_0x3f62c9){_0x4e26f2[_0x2658('0x45')]=_[_0x2658('0x5a')](db[_0x2658('0x67')][_0x2658('0x44')]);_0x4e26f2[_0x2658('0x46')]=_[_0x2658('0x5a')](_0x2d4bb9[_0x2658('0x46')]);_0x4e26f2['filters']=_['intersection'](_0x4e26f2[_0x2658('0x45')],_0x4e26f2[_0x2658('0x46')]);_0x107a9e[_0x2658('0x4a')]=_['intersection'](_0x4e26f2[_0x2658('0x45')],qs[_0x2658('0x49')](_0x2d4bb9[_0x2658('0x46')][_0x2658('0x49')]));_0x107a9e[_0x2658('0x4a')]=_0x107a9e['attributes'][_0x2658('0x4b')]?_0x107a9e[_0x2658('0x4a')]:_0x4e26f2[_0x2658('0x45')];if(!_0x2d4bb9['query'][_0x2658('0x4c')](_0x2658('0x68'))){_0x107a9e[_0x2658('0x35')]=qs[_0x2658('0x35')](_0x2d4bb9['query']['limit']);_0x107a9e['offset']=qs[_0x2658('0x33')](_0x2d4bb9[_0x2658('0x46')][_0x2658('0x33')]);}_0x107a9e[_0x2658('0x4d')]=qs[_0x2658('0x4e')](_0x2d4bb9[_0x2658('0x46')][_0x2658('0x4e')]);_0x107a9e['where']=qs['filters'](_[_0x2658('0x50')](_0x2d4bb9[_0x2658('0x46')],_0x4e26f2['filters']));_0x107a9e['where'][_0x2658('0x66')]=_0x3f62c9['id'];if(_0x2d4bb9[_0x2658('0x46')][_0x2658('0x53')]){_0x107a9e[_0x2658('0x4f')]=_[_0x2658('0x51')](_0x107a9e[_0x2658('0x4f')],{'$or':_[_0x2658('0x42')](_0x107a9e['attributes'],function(_0x4fcfe6){var _0x13e029={};_0x13e029[_0x4fcfe6]={'$like':'%'+_0x2d4bb9['query'][_0x2658('0x53')]+'%'};return _0x13e029;})});}_0x107a9e=_[_0x2658('0x51')]({},_0x107a9e,_0x2d4bb9[_0x2658('0x54')]);return db[_0x2658('0x67')][_0x2658('0x36')]({'where':_0x107a9e['where']})[_0x2658('0x24')](function(_0x4318b7){_0x4267c1[_0x2658('0x36')]=_0x4318b7;if(_0x2d4bb9[_0x2658('0x46')][_0x2658('0x55')]){_0x107a9e['include']=[{'all':!![]}];}return db[_0x2658('0x67')]['findAll'](_0x107a9e);})[_0x2658('0x24')](function(_0x40f776){_0x4267c1['rows']=_0x40f776;return _0x4267c1;});}})[_0x2658('0x24')](respondWithFilteredResult(_0xd51c51,_0x107a9e))['catch'](handleError(_0xd51c51,null));};exports[_0x2658('0x69')]=function(_0x13bc43,_0x272fcb,_0x54aac0){return db[_0x2658('0x43')]['find']({'where':{'id':_0x13bc43['params']['id']}})['then'](handleEntityNotFound(_0x272fcb,null))[_0x2658('0x24')](function(_0x4610e4){if(_0x4610e4){return _0x4610e4[_0x2658('0x69')](_0x13bc43[_0x2658('0x46')][_0x2658('0x6a')]);}})['then'](respondWithStatusCode(_0x272fcb,null))[_0x2658('0x2e')](handleError(_0x272fcb,null));};exports[_0x2658('0x6b')]=function(_0x3a0218,_0x15ba41,_0x368696){if(_0x3a0218[_0x2658('0x5c')]['id']){delete _0x3a0218[_0x2658('0x5c')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x3a0218[_0x2658('0x59')]['id']}})[_0x2658('0x24')](handleEntityNotFound(_0x15ba41,null))[_0x2658('0x24')](function(_0x4c210c){if(_0x4c210c){_0x3a0218[_0x2658('0x5c')][_0x2658('0x66')]=_0x4c210c['id'];return db[_0x2658('0x6c')][_0x2658('0x5b')](_0x3a0218['body']);}})[_0x2658('0x24')](respondWithResult(_0x15ba41,null))[_0x2658('0x2e')](handleError(_0x15ba41,null));};exports[_0x2658('0x6d')]=function(_0x5ecd9b,_0x1a3d83,_0x4c3523){var _0x57d05d={'raw':![],'where':{}};var _0x2a131f={};var _0x5a832a={'count':0x0,'rows':[]};return db[_0x2658('0x43')][_0x2658('0x6e')]({'where':{'id':_0x5ecd9b[_0x2658('0x59')]['id']}})[_0x2658('0x24')](handleEntityNotFound(_0x1a3d83,null))[_0x2658('0x24')](function(_0x207aec){if(_0x207aec){_0x2a131f[_0x2658('0x45')]=_[_0x2658('0x5a')](db[_0x2658('0x6c')][_0x2658('0x44')]);_0x2a131f[_0x2658('0x46')]=_[_0x2658('0x5a')](_0x5ecd9b[_0x2658('0x46')]);_0x2a131f[_0x2658('0x47')]=_[_0x2658('0x48')](_0x2a131f[_0x2658('0x45')],_0x2a131f[_0x2658('0x46')]);_0x57d05d[_0x2658('0x4a')]=_[_0x2658('0x48')](_0x2a131f['model'],qs['fields'](_0x5ecd9b[_0x2658('0x46')][_0x2658('0x49')]));_0x57d05d[_0x2658('0x4a')]=_0x57d05d[_0x2658('0x4a')]['length']?_0x57d05d[_0x2658('0x4a')]:_0x2a131f['model'];if(!_0x5ecd9b[_0x2658('0x46')]['hasOwnProperty'](_0x2658('0x68'))){_0x57d05d[_0x2658('0x35')]=qs[_0x2658('0x35')](_0x5ecd9b[_0x2658('0x46')][_0x2658('0x35')]);_0x57d05d['offset']=qs[_0x2658('0x33')](_0x5ecd9b[_0x2658('0x46')][_0x2658('0x33')]);}_0x57d05d[_0x2658('0x4d')]=qs[_0x2658('0x4e')](_0x5ecd9b['query'][_0x2658('0x4e')]);_0x57d05d[_0x2658('0x4f')]=qs[_0x2658('0x47')](_[_0x2658('0x50')](_0x5ecd9b[_0x2658('0x46')],_0x2a131f[_0x2658('0x47')]));_0x57d05d[_0x2658('0x4f')]['WhatsappAccountId']=_0x207aec['id'];if(_0x5ecd9b[_0x2658('0x46')][_0x2658('0x53')]){_0x57d05d[_0x2658('0x4f')]=_[_0x2658('0x51')](_0x57d05d['where'],{'$or':_[_0x2658('0x42')](_0x57d05d[_0x2658('0x4a')],function(_0x19c57f){var _0x308b74={};_0x308b74[_0x19c57f]={'$like':'%'+_0x5ecd9b[_0x2658('0x46')][_0x2658('0x53')]+'%'};return _0x308b74;})});}_0x57d05d=_['merge']({},_0x57d05d,_0x5ecd9b[_0x2658('0x54')]);return db[_0x2658('0x6c')]['count']({'where':_0x57d05d[_0x2658('0x4f')]})[_0x2658('0x24')](function(_0x1b0fcb){_0x5a832a[_0x2658('0x36')]=_0x1b0fcb;if(_0x5ecd9b['query'][_0x2658('0x55')]){_0x57d05d[_0x2658('0x56')]=[{'all':!![]}];}return db[_0x2658('0x6c')][_0x2658('0x57')](_0x57d05d);})[_0x2658('0x24')](function(_0x33ee12){_0x5a832a[_0x2658('0x6f')]=_0x33ee12;return _0x5a832a;});}})[_0x2658('0x24')](respondWithFilteredResult(_0x1a3d83,_0x57d05d))[_0x2658('0x2e')](handleError(_0x1a3d83,null));};exports['removeAnswers']=function(_0x33d7ae,_0x4d638b,_0x2b9784){return db[_0x2658('0x43')]['find']({'where':{'id':_0x33d7ae[_0x2658('0x59')]['id']}})['then'](handleEntityNotFound(_0x4d638b,null))[_0x2658('0x24')](function(_0x4fef69){if(_0x4fef69){return _0x4fef69['removeAnswers'](_0x33d7ae['query']['ids']);}})[_0x2658('0x24')](respondWithStatusCode(_0x4d638b,null))[_0x2658('0x2e')](handleError(_0x4d638b,null));};exports[_0x2658('0x70')]=function(_0x5c41d3,_0x20e4b8,_0x4b5746){return db[_0x2658('0x43')][_0x2658('0x60')]({'where':{'id':_0x5c41d3[_0x2658('0x59')]['id']}})['then'](handleEntityNotFound(_0x20e4b8,null))[_0x2658('0x24')](function(_0x2fe806){if(_0x2fe806){return _0x2fe806[_0x2658('0x70')](_0x5c41d3[_0x2658('0x5c')][_0x2658('0x6a')],_[_0x2658('0x71')](_0x5c41d3[_0x2658('0x5c')],[_0x2658('0x6a'),'id'])||{})[_0x2658('0x72')](function(_0xa4be8b){for(var _0xa6f685=0x0;_0xa6f685<_0x5c41d3[_0x2658('0x5c')][_0x2658('0x6a')][_0x2658('0x4b')];_0xa6f685+=0x1){socket[_0x2658('0x73')](_0x2658('0x74'),{'UserId':Number(_0x5c41d3[_0x2658('0x5c')][_0x2658('0x6a')][_0xa6f685]),'WhatsappAccountId':Number(_0x5c41d3[_0x2658('0x59')]['id'])});}return _0xa4be8b;});}})[_0x2658('0x24')](respondWithResult(_0x20e4b8,null))[_0x2658('0x2e')](handleError(_0x20e4b8,null));};exports[_0x2658('0x75')]=function(_0x11181a,_0x16a4fe,_0x519492){return db[_0x2658('0x43')][_0x2658('0x60')]({'where':{'id':_0x11181a[_0x2658('0x59')]['id']}})[_0x2658('0x24')](handleEntityNotFound(_0x16a4fe,null))['then'](function(_0x3ae5cb){if(_0x3ae5cb){return _0x3ae5cb[_0x2658('0x75')](_0x11181a[_0x2658('0x46')][_0x2658('0x6a')])['then'](function(){if(_[_0x2658('0x76')](_0x11181a[_0x2658('0x46')][_0x2658('0x6a')])){for(var _0x4568ec=0x0;_0x4568ec<_0x11181a[_0x2658('0x46')][_0x2658('0x6a')]['length'];_0x4568ec+=0x1){socket[_0x2658('0x73')](_0x2658('0x77'),{'UserId':Number(_0x11181a[_0x2658('0x46')][_0x2658('0x6a')][_0x4568ec]),'WhatsappAccountId':Number(_0x11181a['params']['id'])});}}else{socket[_0x2658('0x73')](_0x2658('0x77'),{'UserId':Number(_0x11181a[_0x2658('0x46')][_0x2658('0x6a')]),'WhatsappAccountId':Number(_0x11181a['params']['id'])});}});}})[_0x2658('0x24')](respondWithStatusCode(_0x16a4fe,null))[_0x2658('0x2e')](handleError(_0x16a4fe,null));};exports['getAgents']=function(_0x46733a,_0x4c3361,_0x2010c3){var _0x2573a1={};var _0x3c1443={};var _0xf05e7b;var _0x44f274;return db['WhatsappAccount']['findOne']({'where':{'id':_0x46733a[_0x2658('0x59')]['id']}})[_0x2658('0x24')](handleEntityNotFound(_0x4c3361,null))[_0x2658('0x24')](function(_0x21bfa8){if(_0x21bfa8){_0xf05e7b=_0x21bfa8;_0x3c1443[_0x2658('0x45')]=_[_0x2658('0x5a')](db[_0x2658('0x78')][_0x2658('0x44')]);_0x3c1443['query']=_['keys'](_0x46733a[_0x2658('0x46')]);_0x3c1443[_0x2658('0x47')]=_[_0x2658('0x48')](_0x3c1443[_0x2658('0x45')],_0x3c1443['query']);_0x2573a1[_0x2658('0x4a')]=_[_0x2658('0x48')](_0x3c1443[_0x2658('0x45')],qs[_0x2658('0x49')](_0x46733a[_0x2658('0x46')][_0x2658('0x49')]));_0x2573a1[_0x2658('0x4a')]=_0x2573a1[_0x2658('0x4a')][_0x2658('0x4b')]?_0x2573a1[_0x2658('0x4a')]:_0x3c1443['model'];_0x2573a1['order']=qs[_0x2658('0x4e')](_0x46733a['query']['sort']);_0x2573a1[_0x2658('0x4f')]=qs['filters'](_[_0x2658('0x50')](_0x46733a[_0x2658('0x46')],_0x3c1443[_0x2658('0x47')]));if(_0x46733a[_0x2658('0x46')][_0x2658('0x53')]){_0x2573a1[_0x2658('0x4f')]=_['merge'](_0x2573a1[_0x2658('0x4f')],{'$or':_['map'](_0x2573a1[_0x2658('0x4a')],function(_0x27abad){var _0x232e7d={};_0x232e7d[_0x27abad]={'$like':'%'+_0x46733a['query']['filter']+'%'};return _0x232e7d;})});}_0x2573a1=_[_0x2658('0x51')]({},_0x2573a1,_0x46733a[_0x2658('0x54')]);return _0xf05e7b[_0x2658('0x79')](_0x2573a1);}})[_0x2658('0x24')](function(_0x40dc27){if(_0x40dc27){_0x44f274=_0x40dc27['length'];if(!_0x46733a['query'][_0x2658('0x4c')]('nolimit')){_0x2573a1[_0x2658('0x35')]=qs[_0x2658('0x35')](_0x46733a[_0x2658('0x46')]['limit']);_0x2573a1[_0x2658('0x33')]=qs['offset'](_0x46733a['query'][_0x2658('0x33')]);}return _0xf05e7b[_0x2658('0x79')](_0x2573a1);}})[_0x2658('0x24')](function(_0x64e85d){if(_0x64e85d){return _0x64e85d?{'count':_0x44f274,'rows':_0x64e85d}:null;}})[_0x2658('0x24')](respondWithResult(_0x4c3361,null))['catch'](handleError(_0x4c3361,null));};exports['addApplications']=function(_0x485550,_0x56fd08){var _0x178059=_0x485550['params']['id'];var _0x19a8e7=_0x485550[_0x2658('0x5c')];var _0x364bc1=0xc8;var _0x4a762d=null;return db['sequelize'][_0x2658('0x7a')]({'isolationLevel':db[_0x2658('0x7b')][_0x2658('0x7c')][_0x2658('0x7d')][_0x2658('0x7e')]},function(_0x5524b7){return db[_0x2658('0x43')][_0x2658('0x6e')]({'where':{'id':_0x178059},'transaction':_0x5524b7})[_0x2658('0x24')](function(_0x16c654){if(_0x16c654){return db[_0x2658('0x7f')][_0x2658('0x3d')]({'where':{'WhatsappAccountId':_0x178059},'transaction':_0x5524b7})['then'](function(){var _0x417d02=_['map'](_0x19a8e7,function(_0x302ceb){_0x302ceb[_0x2658('0x66')]=_0x178059;return _0x302ceb;});return db['WhatsappApplication']['bulkCreate'](_0x417d02,{'transaction':_0x5524b7});});}else{_0x364bc1=0x194;_0x4a762d=[];}});})[_0x2658('0x24')](function(){if(_0x364bc1!==0x194){return db[_0x2658('0x7f')][_0x2658('0x80')]({'where':{'WhatsappAccountId':_0x178059},'order':_0x2658('0x81')})[_0x2658('0x24')](function(_0x225ab1){_0x4a762d=_0x225ab1;});}})[_0x2658('0x2e')](function(_0x4c0472){_0x364bc1=0x1f4;logger[_0x2658('0x29')](_0x4c0472['stack']);if(_0x4c0472['name']){delete _0x4c0472[_0x2658('0x40')];}_0x4a762d=_0x4c0472;})['finally'](function(){if(_0x4a762d===null){_0x56fd08[_0x2658('0x2f')](_0x364bc1);}else{if(_0x364bc1===0x1f4){_0x56fd08[_0x2658('0x30')](_0x364bc1)['send'](_0x4a762d);}else{_0x56fd08[_0x2658('0x30')](_0x364bc1)['json'](_0x4a762d);}}});};exports[_0x2658('0x82')]=function(_0x2f02fb,_0x5d899a,_0x1c0ac5){var _0x843f40={};var _0x37f859={};var _0x13839b;var _0x4bc412;return db[_0x2658('0x43')][_0x2658('0x6e')]({'where':{'id':_0x2f02fb[_0x2658('0x59')]['id']}})['then'](handleEntityNotFound(_0x5d899a,null))[_0x2658('0x24')](function(_0x26a2c3){if(_0x26a2c3){_0x13839b=_0x26a2c3;_0x37f859[_0x2658('0x45')]=_['keys'](db['WhatsappApplication']['rawAttributes']);_0x37f859['query']=_[_0x2658('0x5a')](_0x2f02fb[_0x2658('0x46')]);_0x37f859[_0x2658('0x47')]=_['intersection'](_0x37f859[_0x2658('0x45')],_0x37f859['query']);_0x843f40['attributes']=_[_0x2658('0x48')](_0x37f859[_0x2658('0x45')],qs[_0x2658('0x49')](_0x2f02fb[_0x2658('0x46')]['fields']));_0x843f40['attributes']=_0x843f40['attributes'][_0x2658('0x4b')]?_0x843f40[_0x2658('0x4a')]:_0x37f859[_0x2658('0x45')];_0x843f40['order']=qs[_0x2658('0x4e')](_0x2f02fb[_0x2658('0x46')][_0x2658('0x4e')]);_0x843f40[_0x2658('0x4f')]=qs[_0x2658('0x47')](_[_0x2658('0x50')](_0x2f02fb['query'],_0x37f859[_0x2658('0x47')]));if(_0x2f02fb[_0x2658('0x46')][_0x2658('0x53')]){_0x843f40[_0x2658('0x4f')]=_[_0x2658('0x51')](_0x843f40[_0x2658('0x4f')],{'$or':_[_0x2658('0x42')](_0x843f40[_0x2658('0x4a')],function(_0x35a007){var _0x475cbb={};_0x475cbb[_0x35a007]={'$like':'%'+_0x2f02fb[_0x2658('0x46')][_0x2658('0x53')]+'%'};return _0x475cbb;})});}_0x843f40=_[_0x2658('0x51')]({},_0x843f40,_0x2f02fb[_0x2658('0x54')]);return _0x13839b['getApplications'](_0x843f40);}})['then'](function(_0x38120f){if(_0x38120f){_0x4bc412=_0x38120f[_0x2658('0x4b')];if(!_0x2f02fb['query'][_0x2658('0x4c')]('nolimit')){_0x843f40[_0x2658('0x35')]=qs['limit'](_0x2f02fb[_0x2658('0x46')][_0x2658('0x35')]);_0x843f40[_0x2658('0x33')]=qs[_0x2658('0x33')](_0x2f02fb[_0x2658('0x46')]['offset']);}return _0x13839b[_0x2658('0x82')](_0x843f40);}})[_0x2658('0x24')](function(_0x5a64e5){if(_0x5a64e5){return _0x5a64e5?{'count':_0x4bc412,'rows':_0x5a64e5}:null;}})['then'](respondWithResult(_0x5d899a,null))['catch'](handleError(_0x5d899a,null));};exports[_0x2658('0x83')]=function(_0x113285,_0x29c984,_0x3dc03e){var _0x2b4969={'channel':'whatsapp'};var _0x133359=[];var _0x23dcbd=[];var _0x38e6ad={};return db['WhatsappAccount']['find']({'where':{'id':_0x113285['params']['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x2658('0x84')}]})['then'](handleEntityNotFound(_0x29c984,null))[_0x2658('0x24')](function(_0x1404cc){_0x2b4969[_0x2658('0x85')]=_0x1404cc;if(_0x2b4969[_0x2658('0x85')]&&_0x2b4969[_0x2658('0x85')][_0x2658('0x86')]==='sinch'&&_0x113285[_0x2658('0x5c')][_0x2658('0x87')]){if(_0x113285['body'][_0x2658('0x87')][_0x2658('0x4b')]===0x0)return;if(_0x113285[_0x2658('0x5c')][_0x2658('0x87')][0x0][_0x2658('0x88')]!=='read')return;return db[_0x2658('0x89')][_0x2658('0x3c')]({'read':!![],'readAt':_0x113285[_0x2658('0x5c')][_0x2658('0x87')][0x0][_0x2658('0x8a')]},{'where':{'messageId':_0x113285['body'][_0x2658('0x87')][0x0]['message_id']},'individualHooks':!![]})['then'](function(_0xafb481){return _0x29c984[_0x2658('0x30')](0xc8)['json'](_0xafb481);});}_0x2b4969[_0x2658('0x8b')]=_[_0x2658('0x8c')](_0x1404cc[_0x2658('0x84')],[_0x2658('0x81')],[_0x2658('0x8d')]);if(_0x2b4969[_0x2658('0x85')][_0x2658('0x84')]){delete _0x2b4969[_0x2658('0x85')][_0x2658('0x84')];}return db[_0x2658('0x8e')][_0x2658('0x64')]()[_0x2658('0x24')](function(_0xfc20ad){if(!_0xfc20ad){throw new db[(_0x2658('0x8f'))][(_0x2658('0x90'))](_0x2658('0x91'));}_0x133359=_[_0x2658('0x92')](_[_0x2658('0x5a')](_0xfc20ad),[_0x2658('0x93'),'updatedAt']);_0x23dcbd=_['difference'](_[_0x2658('0x5a')](_0xfc20ad),['createdAt','updatedAt','CompanyId',_0x2658('0x94')]);_0x2b4969[_0x2658('0x5c')]={'mapKey':_0x2658('0x95')};if(_0x2b4969[_0x2658('0x85')]&&_0x2b4969[_0x2658('0x85')][_0x2658('0x86')]===_0x2658('0x96')){_0x2b4969[_0x2658('0x5c')][_0x2658('0x97')]=_0x113285[_0x2658('0x5c')]['From'][_0x2658('0x98')](_0x2658('0x99'),'');_0x2b4969['body']['body']=_0x113285[_0x2658('0x5c')][_0x2658('0x9a')];_0x2b4969[_0x2658('0x5c')][_0x2658('0x9b')]=_0x113285[_0x2658('0x5c')][_0x2658('0x9c')];}if(_0x2b4969[_0x2658('0x85')]&&_0x2b4969[_0x2658('0x85')]['type']===_0x2658('0x9d')){_0x2b4969[_0x2658('0x5c')]['from']=_0x113285['body'][_0x2658('0x9e')][0x0][_0x2658('0x97')];_0x2b4969[_0x2658('0x5c')][_0x2658('0x5c')]=_0x113285['body']['notifications'][0x0][_0x2658('0x2d')][_0x2658('0x5c')];_0x2b4969['body'][_0x2658('0x9b')]=_0x113285[_0x2658('0x5c')][_0x2658('0x9e')][0x0][_0x2658('0x9f')];}if(_0x2b4969['body']['id']){delete _0x2b4969[_0x2658('0x5c')]['id'];}if(_['isNil'](_0x2b4969[_0x2658('0x5c')][_0x2658('0x97')])){throw new db[(_0x2658('0x8f'))][(_0x2658('0x90'))](_0x2658('0xa0'));}if(_[_0x2658('0xa1')](_0x2b4969[_0x2658('0x5c')][_0x2658('0x5c')])||_0x2b4969[_0x2658('0x5c')]['body']===''){throw new db['Sequelize'][(_0x2658('0x90'))](_0x2658('0xa2'));}if(_[_0x2658('0xa1')](_0x2b4969[_0x2658('0x5c')][_0x2658('0xa3')])){throw new db['Sequelize'][(_0x2658('0x90'))](_0x2658('0xa4')+_0x23dcbd);}if(!_[_0x2658('0xa5')](_0x23dcbd,_0x2b4969[_0x2658('0x5c')][_0x2658('0xa3')])){throw new db[(_0x2658('0x8f'))][(_0x2658('0x90'))](_0x2658('0xa6')+_0x23dcbd);}_0x38e6ad[_0x2b4969['body'][_0x2658('0xa3')]]=_0x2b4969[_0x2658('0x5c')]['from'];return db['CmList'][_0x2658('0x60')]({'where':{'id':_0x2b4969[_0x2658('0x85')]['ListId']},'include':[{'model':db['CmContact'],'as':_0x2658('0xa7'),'where':_0x38e6ad,'limit':0x1,'order':[[_0x2658('0xa8'),_0x2658('0xa9')]]}]});})[_0x2658('0x24')](handleEntityNotFound(_0x29c984,null))[_0x2658('0x24')](function(_0x1c4325){if(_0x1c4325){_0x2b4969[_0x2658('0xaa')]=_[_0x2658('0x71')](_0x1c4325,['Contacts']);if(_0x1c4325['Contacts'][_0x2658('0x4b')]){return _0x1c4325[_0x2658('0xa7')][0x0];}var _0x4640ad=_[_0x2658('0x1b')](_0x2b4969['body'],{'firstName':_0x2b4969[_0x2658('0x5c')][_0x2658('0x97')],'ListId':_0x1c4325['id']});_0x4640ad[_0x2b4969[_0x2658('0x5c')][_0x2658('0xa3')]]=_0x2b4969['body'][_0x2658('0x97')];return db['CmContact'][_0x2658('0x5b')](_0x4640ad,{'fields':_0x133359,'raw':!![]});}})[_0x2658('0x24')](handleEntityNotFound(_0x29c984,null))['then'](function(_0x568eb3){if(_0x568eb3){_0x2b4969[_0x2658('0xab')]=_0x568eb3;var _0x4f31a7={'ContactId':_0x568eb3['id'],'phone':_0x2b4969[_0x2658('0x5c')][_0x2658('0x97')],'WhatsappAccountId':_0x113285[_0x2658('0x59')]['id']};var _0x419bc5={'ContactId':_0x568eb3['id'],'WhatsappAccountId':_0x113285[_0x2658('0x59')]['id'],'closed':![]};return db[_0x2658('0xac')][_0x2658('0x60')]({'where':_0x419bc5})[_0x2658('0x24')](function(_0x4242f1){if(_0x4242f1){return[_0x4242f1,![]];}return db[_0x2658('0xac')]['create'](_0x4f31a7)[_0x2658('0x24')](function(_0x287992){return[_0x287992,!![]];});});}})[_0x2658('0x72')](function(_0x15d30c,_0x3fe72c){_0x2b4969['interaction']=_0x15d30c['get']({'plain':!![]});_0x2b4969[_0x2658('0xad')][_0x2658('0xae')]=![];if(_0x3fe72c){if(_0x2b4969[_0x2658('0x85')][_0x2658('0xaf')]){_0x2b4969[_0x2658('0x8b')][_0x2658('0xb0')]({'id':0x0,'priority':_0x2b4969[_0x2658('0x8b')][_0x2658('0x4b')]+0x1,'app':_0x2658('0xb1'),'appdata':_0x2658('0xb2'),'interval':'*,*,*,*'});}_0x2b4969[_0x2658('0xad')][_0x2658('0xae')]=!![];}return db['WhatsappMessage'][_0x2658('0x5b')]({'phone':_0x2b4969['body']['from'],'messageId':_0x2b4969[_0x2658('0x5c')][_0x2658('0x9b')],'body':_0x2b4969[_0x2658('0x5c')][_0x2658('0x5c')],'WhatsappAccountId':_0x113285[_0x2658('0x59')]['id'],'WhatsappInteractionId':_0x15d30c['id'],'direction':'in','ContactId':_0x15d30c['ContactId'],'AttachmentId':_0x2b4969['body'][_0x2658('0xb3')]});})['then'](function(_0x287e51){_0x2b4969['message']=_0x287e51;if(!_0x2b4969[_0x2658('0xad')][_0x2658('0xb4')])return;return db['User']['find']({'attributes':['id',_0x2658('0x40')],'where':{'id':_0x2b4969['interaction'][_0x2658('0xb4')]}});})[_0x2658('0x24')](function(_0x2084f8){if(_0x2084f8){_0x2b4969[_0x2658('0x8b')][_0x2658('0xb5')]({'id':0x0,'priority':0x0,'app':_0x2658('0xb6'),'appdata':_0x2084f8[_0x2658('0x40')]+','+(_0x2b4969[_0x2658('0x85')][_0x2658('0xb7')]||0xa),'interval':_0x2658('0xb8')});}if(!_0x2b4969[_0x2658('0xad')]['queueId'])return;return db[_0x2658('0xb9')][_0x2658('0x60')]({'attributes':['id','name'],'where':{'id':_0x2b4969[_0x2658('0xad')][_0x2658('0xba')]}});})[_0x2658('0x24')](function(_0x44bf0f){if(_0x44bf0f){_0x2b4969[_0x2658('0x8b')]['unshift']({'id':0x0,'priority':0x1,'app':_0x2658('0xbb'),'appdata':_0x44bf0f[_0x2658('0x40')]+','+(_0x2b4969[_0x2658('0x85')][_0x2658('0xbc')]||0x12c),'interval':_0x2658('0xb8')});}return respondWithRpcPromise(_0x2658('0xbd'),'startRouting',_0x2b4969);})[_0x2658('0x24')](function(_0x48c0de){if(_0x48c0de){var _0x41cdc4=0xc8;var _0x2d77c4='receiveMessage';logger[_0x2658('0x25')](_0x2658('0x28'),_0x2d77c4,_0x41cdc4,_0x2658('0xbe'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x2d77c4,_0x41cdc4,_0x2658('0xbe'),JSON[_0x2658('0xbf')](_0x48c0de));if(_0x2b4969['account'][_0x2658('0x86')]===_0x2658('0x96')){return _0x29c984['status'](_0x41cdc4)[_0x2658('0x37')](_0x2658('0xc0'),_0x2658('0xc1'))[_0x2658('0xc2')](_0x2658('0xc3'));}else{return _0x29c984[_0x2658('0x30')](_0x41cdc4)[_0x2658('0x32')](_0x48c0de);}}});})[_0x2658('0x2e')](handleError(_0x29c984,null));};exports[_0x2658('0xc2')]=function(_0x3ee50e,_0x3a5f0a,_0x4e35d8){var _0x1182b7,_0x2a4d1c,_0x2e4f95;if(_[_0x2658('0xa1')](_0x3ee50e[_0x2658('0x5c')][_0x2658('0x5c')])||_0x3ee50e[_0x2658('0x5c')]['body']===''){throw new db[(_0x2658('0x8f'))]['ValidationError'](_0x2658('0xa2'));}if(_[_0x2658('0xa1')](_0x3ee50e[_0x2658('0x5c')]['to'])){throw new db['Sequelize'][(_0x2658('0x90'))]('to\x20is\x20mandatory');}_0x1182b7=_0x3ee50e[_0x2658('0x5c')]['to'];return db[_0x2658('0x43')]['find']({'where':{'id':_0x3ee50e['params']['id']},'include':[{'model':db[_0x2658('0xc4')],'as':'List','include':[{'model':db[_0x2658('0x8e')],'as':_0x2658('0xa7'),'where':{'mobile':_0x1182b7},'limit':0x1,'order':[['updatedAt',_0x2658('0xa9')]]}]}]})[_0x2658('0x24')](handleEntityNotFound(_0x3a5f0a,null))[_0x2658('0x24')](function(_0x5886d2){if(_0x5886d2&&_0x5886d2[_0x2658('0xc5')]){_0x2a4d1c=_0x5886d2[_0x2658('0x5f')]({'plain':!![]});if(_0x2a4d1c['List']&&_0x2a4d1c['List'][_0x2658('0xa7')][_0x2658('0x4b')]){return _0x2a4d1c[_0x2658('0xc5')][_0x2658('0xa7')][0x0];}return db[_0x2658('0x8e')][_0x2658('0x5b')](_[_0x2658('0x1b')](_0x3ee50e['body'],{'firstName':_0x1182b7,'mobile':_0x1182b7,'phone':_0x1182b7,'ListId':_0x2a4d1c[_0x2658('0x94')]}));}})[_0x2658('0x24')](handleEntityNotFound(_0x3a5f0a,null))['then'](function(_0xb1f1c5){if(_0xb1f1c5){_0x2e4f95=_0xb1f1c5;return db['WhatsappInteraction'][_0x2658('0x60')]({'where':{'ContactId':_0x2e4f95['id'],'closed':![],'WhatsappAccountId':_0x2a4d1c['id']}})[_0x2658('0x24')](function(_0x5b6ac4){if(_0x5b6ac4){return[_0x5b6ac4,![]];}return db[_0x2658('0xac')][_0x2658('0x5b')]({'UserId':_0x3ee50e[_0x2658('0x5d')]['id'],'ContactId':_0x2e4f95['id'],'WhatsappAccountId':_0x2a4d1c['id'],'phone':_0x1182b7,'firstMsgDirection':_0x2658('0xc6'),'Messages':[_[_0x2658('0x51')](_0x3ee50e[_0x2658('0x5c')],{'read':![],'body':_0x3ee50e['body'][_0x2658('0x5c')],'phone':_0x1182b7,'WhatsappAccountId':_0x2a4d1c['id'],'UserId':_0x3ee50e[_0x2658('0x5d')]['id'],'ContactId':_0x2e4f95['id']})]},{'include':[{'model':db[_0x2658('0x89')],'as':_0x2658('0xc7')}]})[_0x2658('0x24')](function(_0x2a600c){return[_0x2a600c,!![]];});});}})[_0x2658('0x72')](function(_0x4f80de,_0x254390){if(_0x254390){return _0x4f80de;}return db['WhatsappMessage'][_0x2658('0x5b')](_[_0x2658('0x51')](_0x3ee50e[_0x2658('0x5c')],{'read':![],'body':_0x3ee50e[_0x2658('0x5c')][_0x2658('0x5c')],'phone':_0x1182b7,'WhatsappAccountId':_0x2a4d1c['id'],'WhatsappInteractionId':_0x4f80de['id'],'UserId':_0x3ee50e['user']['id'],'ContactId':_0x2e4f95['id']}))[_0x2658('0x24')](function(_0x3cf308){_0x4f80de['dataValues']['Messages']=[];_0x4f80de[_0x2658('0xc8')][_0x2658('0xc7')]['push'](_0x3cf308[_0x2658('0xc8')]);return _0x4f80de;});})[_0x2658('0x24')](respondWithResult(_0x3a5f0a,null))[_0x2658('0x2e')](handleError(_0x3a5f0a,null));}; \ No newline at end of file +var _0x1902=['model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','includeAll','include','findAll','show','params','length','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','describe','addDisposition','Disposition','getDispositions','pick','WhatsappAccountId','rows','removeDispositions','addAnswer','CannedAnswer','findOne','ids','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','timestamp','message_id','orderBy','asc','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','twilio','from','From','replace','whatsapp:','Body','notifications','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','ListId','Contacts','DESC','list','WhatsappInteraction','interaction','created','autoclose','applications','close','unmanaged','WhatsappMessage','messageId','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','queueId','WhatsappQueue','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','sendStatus','status','json','undefined','limit','count','offset','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','end','stack','name','send','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','type','key'];(function(_0x3d74d5,_0xcea1ed){var _0x408ad9=function(_0xdbc83b){while(--_0xdbc83b){_0x3d74d5['push'](_0x3d74d5['shift']());}};_0x408ad9(++_0xcea1ed);}(_0x1902,0x83));var _0x2190=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1902[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x2190('0x0'));var rimraf=require(_0x2190('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2190('0x2'));var rp=require(_0x2190('0x3'));var moment=require(_0x2190('0x4'));var BPromise=require(_0x2190('0x5'));var Mustache=require(_0x2190('0x6'));var util=require(_0x2190('0x7'));var path=require(_0x2190('0x8'));var sox=require('sox');var csv=require(_0x2190('0x9'));var ejs=require(_0x2190('0xa'));var fs=require('fs');var fs_extra=require(_0x2190('0xb'));var _=require(_0x2190('0xc'));var squel=require(_0x2190('0xd'));var crypto=require('crypto');var jsforce=require(_0x2190('0xe'));var deskjs=require(_0x2190('0xf'));var toCsv=require(_0x2190('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2190('0x10'));var authService=require(_0x2190('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2190('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2190('0x13'))('api');var utils=require(_0x2190('0x14'));var config=require(_0x2190('0x15'));var licenseUtil=require(_0x2190('0x16'));var db=require(_0x2190('0x17'))['db'];config[_0x2190('0x18')]=_[_0x2190('0x19')](config[_0x2190('0x18')],{'host':_0x2190('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappAccount.socket')[_0x2190('0x1b')](socket);var jayson=require(_0x2190('0x1c'));var client=jayson[_0x2190('0x1d')][_0x2190('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x5c6880,_0x22519f,_0x340cf3,_0x2dc7ce){return new BPromise(function(_0x23dd69,_0x632c77){var _0x553ae0=_0x2dc7ce||client;return _0x553ae0[_0x2190('0x1f')](_0x5c6880,_0x340cf3)[_0x2190('0x20')](function(_0x47e3c0){logger[_0x2190('0x21')](_0x2190('0x22'),_0x22519f,'request\x20sent');logger['debug'](_0x2190('0x23'),_0x22519f,'request\x20sent',JSON[_0x2190('0x24')](_0x47e3c0));if(_0x47e3c0['error']){if(_0x47e3c0[_0x2190('0x25')]['code']===0x1f4){logger['error'](_0x2190('0x22'),_0x22519f,_0x47e3c0[_0x2190('0x25')][_0x2190('0x26')]);return _0x632c77(_0x47e3c0[_0x2190('0x25')]['message']);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x22519f,_0x47e3c0[_0x2190('0x25')][_0x2190('0x26')]);return _0x23dd69(_0x47e3c0[_0x2190('0x25')][_0x2190('0x26')]);}else{logger[_0x2190('0x21')](_0x2190('0x22'),_0x22519f,_0x2190('0x27'));_0x23dd69(_0x47e3c0[_0x2190('0x28')][_0x2190('0x26')]);}})[_0x2190('0x29')](function(_0x197a8b){logger[_0x2190('0x25')](_0x2190('0x22'),_0x22519f,_0x197a8b);_0x632c77(_0x197a8b);});});}function respondWithStatusCode(_0x1e3e00,_0x40ae20){_0x40ae20=_0x40ae20||0xcc;return function(_0x19fc77){if(_0x19fc77){return _0x1e3e00[_0x2190('0x2a')](_0x40ae20);}return _0x1e3e00['status'](_0x40ae20)['end']();};}function respondWithResult(_0x85621f,_0x1f2f41){_0x1f2f41=_0x1f2f41||0xc8;return function(_0x52e868){if(_0x52e868){return _0x85621f[_0x2190('0x2b')](_0x1f2f41)[_0x2190('0x2c')](_0x52e868);}};}function respondWithFilteredResult(_0x236392,_0x23e672){return function(_0x11259e){if(_0x11259e){var _0x1cafd0=typeof _0x23e672['offset']===_0x2190('0x2d')&&typeof _0x23e672[_0x2190('0x2e')]===_0x2190('0x2d');var _0x575d75=_0x11259e[_0x2190('0x2f')];var _0x459460=_0x1cafd0?0x0:_0x23e672[_0x2190('0x30')];var _0x52d558=_0x1cafd0?_0x11259e[_0x2190('0x2f')]:_0x23e672['offset']+_0x23e672['limit'];var _0x349bdd;if(_0x52d558>=_0x575d75){_0x52d558=_0x575d75;_0x349bdd=0xc8;}else{_0x349bdd=0xce;}_0x236392[_0x2190('0x2b')](_0x349bdd);return _0x236392['set']('Content-Range',_0x459460+'-'+_0x52d558+'/'+_0x575d75)[_0x2190('0x2c')](_0x11259e);}return null;};}function patchUpdates(_0xe36f31){return function(_0x467f9c){try{jsonpatch[_0x2190('0x31')](_0x467f9c,_0xe36f31,!![]);}catch(_0x531a74){return BPromise[_0x2190('0x32')](_0x531a74);}return _0x467f9c[_0x2190('0x33')]();};}function saveUpdates(_0x2607e4,_0x5d27f0){return function(_0x45e348){if(_0x45e348){return _0x45e348[_0x2190('0x34')](_0x2607e4)[_0x2190('0x20')](function(_0x3853d0){return _0x3853d0;});}return null;};}function removeEntity(_0x1a7bb7,_0x3e298c){return function(_0x37f378){if(_0x37f378){return _0x37f378[_0x2190('0x35')]()[_0x2190('0x20')](function(){var _0x34b896=_0x37f378[_0x2190('0x36')]({'plain':!![]});var _0x137b0e=_0x2190('0x37');return db[_0x2190('0x38')][_0x2190('0x35')]({'where':{'type':_0x137b0e,'resourceId':_0x34b896['id']}})['then'](function(){return _0x37f378;});})['then'](function(){_0x1a7bb7['status'](0xcc)[_0x2190('0x39')]();});}};}function handleEntityNotFound(_0x489f4c,_0x1e7e2d){return function(_0x289e9e){if(!_0x289e9e){_0x489f4c[_0x2190('0x2a')](0x194);}return _0x289e9e;};}function handleError(_0x3f7ef8,_0x43fd2f){_0x43fd2f=_0x43fd2f||0x1f4;return function(_0x3379f1){logger[_0x2190('0x25')](_0x3379f1[_0x2190('0x3a')]);if(_0x3379f1[_0x2190('0x3b')]){delete _0x3379f1[_0x2190('0x3b')];}_0x3f7ef8[_0x2190('0x2b')](_0x43fd2f)[_0x2190('0x3c')](_0x3379f1);};}exports['index']=function(_0x5bb9b9,_0x550c62){var _0x73f7c0={'include':[{'model':db[_0x2190('0x3d')],'as':_0x2190('0x3e')}]},_0x286ea4={},_0x5e0c76={'count':0x0,'rows':[]};var _0x31eb98=_[_0x2190('0x3f')](db[_0x2190('0x40')][_0x2190('0x41')],function(_0x25bbc3){return{'name':_0x25bbc3['fieldName'],'type':_0x25bbc3[_0x2190('0x42')][_0x2190('0x43')]};});_0x286ea4[_0x2190('0x44')]=_[_0x2190('0x3f')](_0x31eb98,'name');_0x286ea4[_0x2190('0x45')]=_[_0x2190('0x46')](_0x5bb9b9[_0x2190('0x45')]);_0x286ea4['filters']=_[_0x2190('0x47')](_0x286ea4['model'],_0x286ea4[_0x2190('0x45')]);_0x73f7c0['attributes']=_[_0x2190('0x47')](_0x286ea4[_0x2190('0x44')],qs[_0x2190('0x48')](_0x5bb9b9['query'][_0x2190('0x48')]));_0x73f7c0[_0x2190('0x49')]=_0x73f7c0[_0x2190('0x49')]['length']?_0x73f7c0[_0x2190('0x49')]:_0x286ea4['model'];if(!_0x5bb9b9[_0x2190('0x45')][_0x2190('0x4a')](_0x2190('0x4b'))){_0x73f7c0[_0x2190('0x2e')]=qs[_0x2190('0x2e')](_0x5bb9b9[_0x2190('0x45')]['limit']);_0x73f7c0['offset']=qs[_0x2190('0x30')](_0x5bb9b9[_0x2190('0x45')][_0x2190('0x30')]);}_0x73f7c0[_0x2190('0x4c')]=qs[_0x2190('0x4d')](_0x5bb9b9[_0x2190('0x45')][_0x2190('0x4d')]);_0x73f7c0['where']=qs[_0x2190('0x4e')](_['pick'](_0x5bb9b9[_0x2190('0x45')],_0x286ea4[_0x2190('0x4e')]),_0x31eb98);if(_0x5bb9b9[_0x2190('0x45')][_0x2190('0x4f')]){_0x73f7c0[_0x2190('0x50')]=_[_0x2190('0x51')](_0x73f7c0[_0x2190('0x50')],{'$or':_[_0x2190('0x3f')](_0x31eb98,function(_0x26d8d0){if(_0x26d8d0[_0x2190('0x42')]!==_0x2190('0x52')){var _0x42de21={};_0x42de21[_0x26d8d0['name']]={'$like':'%'+_0x5bb9b9[_0x2190('0x45')]['filter']+'%'};return _0x42de21;}})});}_0x73f7c0=_[_0x2190('0x51')]({},_0x73f7c0,_0x5bb9b9['options']);var _0xa81101={'where':_0x73f7c0['where']};return db['WhatsappAccount']['count'](_0xa81101)[_0x2190('0x20')](function(_0x4a7596){_0x5e0c76[_0x2190('0x2f')]=_0x4a7596;if(_0x5bb9b9['query'][_0x2190('0x53')]){_0x73f7c0[_0x2190('0x54')]=[{'all':!![]}];}return db[_0x2190('0x40')][_0x2190('0x55')](_0x73f7c0);})[_0x2190('0x20')](function(_0x5a4202){_0x5e0c76['rows']=_0x5a4202;return _0x5e0c76;})[_0x2190('0x20')](respondWithFilteredResult(_0x550c62,_0x73f7c0))['catch'](handleError(_0x550c62,null));};exports[_0x2190('0x56')]=function(_0x2400c9,_0x24fd54){var _0x3da0dc={'raw':![],'where':{'id':_0x2400c9[_0x2190('0x57')]['id']},'include':[{'model':db[_0x2190('0x3d')],'as':_0x2190('0x3e')}]},_0x48d815={};_0x48d815[_0x2190('0x44')]=_['keys'](db[_0x2190('0x40')]['rawAttributes']);_0x48d815[_0x2190('0x45')]=_[_0x2190('0x46')](_0x2400c9[_0x2190('0x45')]);_0x48d815['filters']=_[_0x2190('0x47')](_0x48d815[_0x2190('0x44')],_0x48d815[_0x2190('0x45')]);_0x3da0dc[_0x2190('0x49')]=_[_0x2190('0x47')](_0x48d815['model'],qs[_0x2190('0x48')](_0x2400c9[_0x2190('0x45')][_0x2190('0x48')]));_0x3da0dc[_0x2190('0x49')]=_0x3da0dc['attributes'][_0x2190('0x58')]?_0x3da0dc['attributes']:_0x48d815[_0x2190('0x44')];if(_0x2400c9[_0x2190('0x45')][_0x2190('0x53')]){_0x3da0dc[_0x2190('0x54')]=[{'all':!![]}];}_0x3da0dc=_['merge']({},_0x3da0dc,_0x2400c9[_0x2190('0x59')]);return db[_0x2190('0x40')][_0x2190('0x5a')](_0x3da0dc)[_0x2190('0x20')](handleEntityNotFound(_0x24fd54,null))[_0x2190('0x20')](respondWithResult(_0x24fd54,null))[_0x2190('0x29')](handleError(_0x24fd54,null));};exports[_0x2190('0x5b')]=function(_0x43a3fa,_0x1c9190){return db[_0x2190('0x40')][_0x2190('0x5b')](_0x43a3fa[_0x2190('0x5c')],{})[_0x2190('0x20')](function(_0x5dce01){var _0x125df8=_0x43a3fa[_0x2190('0x5d')][_0x2190('0x36')]({'plain':!![]});if(!_0x125df8)throw new Error(_0x2190('0x5e'));if(_0x125df8[_0x2190('0x5f')]===_0x2190('0x5d')){var _0x4a9422=_0x5dce01[_0x2190('0x36')]({'plain':!![]});var _0x11439a=_0x2190('0x37');return db[_0x2190('0x60')][_0x2190('0x5a')]({'where':{'name':_0x11439a,'userProfileId':_0x125df8[_0x2190('0x61')]},'raw':!![]})['then'](function(_0x3e8835){if(_0x3e8835&&_0x3e8835[_0x2190('0x62')]===0x0){return db[_0x2190('0x38')][_0x2190('0x5b')]({'name':_0x4a9422[_0x2190('0x3b')],'resourceId':_0x4a9422['id'],'type':_0x3e8835['name'],'sectionId':_0x3e8835['id']},{})[_0x2190('0x20')](function(){return _0x5dce01;});}else{return _0x5dce01;}})[_0x2190('0x29')](function(_0xa3c586){logger[_0x2190('0x25')](_0x2190('0x63'),_0xa3c586);throw _0xa3c586;});}return _0x5dce01;})[_0x2190('0x20')](respondWithResult(_0x1c9190,0xc9))[_0x2190('0x29')](handleError(_0x1c9190,null));};exports['update']=function(_0x1f67c0,_0x23fc5c){if(_0x1f67c0[_0x2190('0x5c')]['id']){delete _0x1f67c0[_0x2190('0x5c')]['id'];}return db[_0x2190('0x40')][_0x2190('0x5a')]({'where':{'id':_0x1f67c0[_0x2190('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0x2190('0x3e')}]})['then'](handleEntityNotFound(_0x23fc5c,null))[_0x2190('0x20')](saveUpdates(_0x1f67c0[_0x2190('0x5c')],null))['then'](respondWithResult(_0x23fc5c,null))[_0x2190('0x29')](handleError(_0x23fc5c,null));};exports['destroy']=function(_0x32b447,_0x3970e0){return db[_0x2190('0x40')][_0x2190('0x5a')]({'where':{'id':_0x32b447['params']['id']}})['then'](handleEntityNotFound(_0x3970e0,null))[_0x2190('0x20')](removeEntity(_0x3970e0,null))['catch'](handleError(_0x3970e0,null));};exports[_0x2190('0x64')]=function(_0xcacde4,_0x2c2704){return db[_0x2190('0x40')][_0x2190('0x64')]()[_0x2190('0x20')](respondWithResult(_0x2c2704,null))[_0x2190('0x29')](handleError(_0x2c2704,null));};exports[_0x2190('0x65')]=function(_0x1bc3c0,_0x18ab6b,_0x577e50){if(_0x1bc3c0[_0x2190('0x5c')]['id']){delete _0x1bc3c0[_0x2190('0x5c')]['id'];}return db[_0x2190('0x40')][_0x2190('0x5a')]({'where':{'id':_0x1bc3c0[_0x2190('0x57')]['id']}})[_0x2190('0x20')](handleEntityNotFound(_0x18ab6b,null))['then'](function(_0x1a3691){if(_0x1a3691){_0x1bc3c0[_0x2190('0x5c')]['WhatsappAccountId']=_0x1a3691['id'];return db[_0x2190('0x66')][_0x2190('0x5b')](_0x1bc3c0[_0x2190('0x5c')]);}})[_0x2190('0x20')](respondWithResult(_0x18ab6b,null))[_0x2190('0x29')](handleError(_0x18ab6b,null));};exports[_0x2190('0x67')]=function(_0x2363ab,_0x542896,_0x1cbb0d){var _0x544221={'raw':![],'where':{}};var _0x14d81f={};var _0x36cf18={'count':0x0,'rows':[]};return db[_0x2190('0x40')]['findOne']({'where':{'id':_0x2363ab[_0x2190('0x57')]['id']}})[_0x2190('0x20')](handleEntityNotFound(_0x542896,null))[_0x2190('0x20')](function(_0x24b7e4){if(_0x24b7e4){_0x14d81f['model']=_[_0x2190('0x46')](db[_0x2190('0x66')]['rawAttributes']);_0x14d81f['query']=_[_0x2190('0x46')](_0x2363ab[_0x2190('0x45')]);_0x14d81f[_0x2190('0x4e')]=_[_0x2190('0x47')](_0x14d81f['model'],_0x14d81f['query']);_0x544221['attributes']=_[_0x2190('0x47')](_0x14d81f['model'],qs['fields'](_0x2363ab[_0x2190('0x45')]['fields']));_0x544221['attributes']=_0x544221[_0x2190('0x49')][_0x2190('0x58')]?_0x544221['attributes']:_0x14d81f[_0x2190('0x44')];if(!_0x2363ab[_0x2190('0x45')][_0x2190('0x4a')](_0x2190('0x4b'))){_0x544221[_0x2190('0x2e')]=qs[_0x2190('0x2e')](_0x2363ab[_0x2190('0x45')][_0x2190('0x2e')]);_0x544221['offset']=qs[_0x2190('0x30')](_0x2363ab[_0x2190('0x45')][_0x2190('0x30')]);}_0x544221[_0x2190('0x4c')]=qs['sort'](_0x2363ab[_0x2190('0x45')]['sort']);_0x544221['where']=qs[_0x2190('0x4e')](_[_0x2190('0x68')](_0x2363ab[_0x2190('0x45')],_0x14d81f[_0x2190('0x4e')]));_0x544221[_0x2190('0x50')][_0x2190('0x69')]=_0x24b7e4['id'];if(_0x2363ab[_0x2190('0x45')][_0x2190('0x4f')]){_0x544221['where']=_['merge'](_0x544221[_0x2190('0x50')],{'$or':_[_0x2190('0x3f')](_0x544221['attributes'],function(_0x3f0500){var _0x4cd00a={};_0x4cd00a[_0x3f0500]={'$like':'%'+_0x2363ab['query'][_0x2190('0x4f')]+'%'};return _0x4cd00a;})});}_0x544221=_[_0x2190('0x51')]({},_0x544221,_0x2363ab[_0x2190('0x59')]);return db[_0x2190('0x66')][_0x2190('0x2f')]({'where':_0x544221['where']})[_0x2190('0x20')](function(_0x11fcfd){_0x36cf18['count']=_0x11fcfd;if(_0x2363ab[_0x2190('0x45')][_0x2190('0x53')]){_0x544221['include']=[{'all':!![]}];}return db[_0x2190('0x66')][_0x2190('0x55')](_0x544221);})['then'](function(_0x40a69e){_0x36cf18[_0x2190('0x6a')]=_0x40a69e;return _0x36cf18;});}})[_0x2190('0x20')](respondWithFilteredResult(_0x542896,_0x544221))[_0x2190('0x29')](handleError(_0x542896,null));};exports[_0x2190('0x6b')]=function(_0x4eb23e,_0x1b4f60,_0x111541){return db[_0x2190('0x40')][_0x2190('0x5a')]({'where':{'id':_0x4eb23e[_0x2190('0x57')]['id']}})[_0x2190('0x20')](handleEntityNotFound(_0x1b4f60,null))[_0x2190('0x20')](function(_0x9eb492){if(_0x9eb492){return _0x9eb492[_0x2190('0x6b')](_0x4eb23e[_0x2190('0x45')]['ids']);}})['then'](respondWithStatusCode(_0x1b4f60,null))[_0x2190('0x29')](handleError(_0x1b4f60,null));};exports[_0x2190('0x6c')]=function(_0x3623e0,_0x571688,_0x5bb3c5){if(_0x3623e0['body']['id']){delete _0x3623e0[_0x2190('0x5c')]['id'];}return db['WhatsappAccount'][_0x2190('0x5a')]({'where':{'id':_0x3623e0[_0x2190('0x57')]['id']}})[_0x2190('0x20')](handleEntityNotFound(_0x571688,null))[_0x2190('0x20')](function(_0x338a03){if(_0x338a03){_0x3623e0[_0x2190('0x5c')]['WhatsappAccountId']=_0x338a03['id'];return db[_0x2190('0x6d')]['create'](_0x3623e0['body']);}})[_0x2190('0x20')](respondWithResult(_0x571688,null))[_0x2190('0x29')](handleError(_0x571688,null));};exports['getAnswers']=function(_0x3e390f,_0x4486a7,_0x5a0b7b){var _0xd981dd={'raw':![],'where':{}};var _0xb5457={};var _0x5923c9={'count':0x0,'rows':[]};return db[_0x2190('0x40')][_0x2190('0x6e')]({'where':{'id':_0x3e390f[_0x2190('0x57')]['id']}})[_0x2190('0x20')](handleEntityNotFound(_0x4486a7,null))['then'](function(_0x4739f6){if(_0x4739f6){_0xb5457[_0x2190('0x44')]=_[_0x2190('0x46')](db[_0x2190('0x6d')]['rawAttributes']);_0xb5457[_0x2190('0x45')]=_[_0x2190('0x46')](_0x3e390f[_0x2190('0x45')]);_0xb5457[_0x2190('0x4e')]=_[_0x2190('0x47')](_0xb5457[_0x2190('0x44')],_0xb5457[_0x2190('0x45')]);_0xd981dd[_0x2190('0x49')]=_[_0x2190('0x47')](_0xb5457[_0x2190('0x44')],qs[_0x2190('0x48')](_0x3e390f[_0x2190('0x45')][_0x2190('0x48')]));_0xd981dd[_0x2190('0x49')]=_0xd981dd['attributes'][_0x2190('0x58')]?_0xd981dd['attributes']:_0xb5457[_0x2190('0x44')];if(!_0x3e390f[_0x2190('0x45')][_0x2190('0x4a')](_0x2190('0x4b'))){_0xd981dd[_0x2190('0x2e')]=qs[_0x2190('0x2e')](_0x3e390f['query'][_0x2190('0x2e')]);_0xd981dd[_0x2190('0x30')]=qs['offset'](_0x3e390f[_0x2190('0x45')][_0x2190('0x30')]);}_0xd981dd[_0x2190('0x4c')]=qs['sort'](_0x3e390f['query'][_0x2190('0x4d')]);_0xd981dd['where']=qs[_0x2190('0x4e')](_[_0x2190('0x68')](_0x3e390f[_0x2190('0x45')],_0xb5457[_0x2190('0x4e')]));_0xd981dd[_0x2190('0x50')][_0x2190('0x69')]=_0x4739f6['id'];if(_0x3e390f['query'][_0x2190('0x4f')]){_0xd981dd[_0x2190('0x50')]=_[_0x2190('0x51')](_0xd981dd[_0x2190('0x50')],{'$or':_[_0x2190('0x3f')](_0xd981dd['attributes'],function(_0x51fe1b){var _0x1c63b0={};_0x1c63b0[_0x51fe1b]={'$like':'%'+_0x3e390f[_0x2190('0x45')]['filter']+'%'};return _0x1c63b0;})});}_0xd981dd=_['merge']({},_0xd981dd,_0x3e390f[_0x2190('0x59')]);return db['CannedAnswer']['count']({'where':_0xd981dd[_0x2190('0x50')]})[_0x2190('0x20')](function(_0x2447f2){_0x5923c9['count']=_0x2447f2;if(_0x3e390f[_0x2190('0x45')][_0x2190('0x53')]){_0xd981dd['include']=[{'all':!![]}];}return db[_0x2190('0x6d')][_0x2190('0x55')](_0xd981dd);})[_0x2190('0x20')](function(_0x235078){_0x5923c9[_0x2190('0x6a')]=_0x235078;return _0x5923c9;});}})[_0x2190('0x20')](respondWithFilteredResult(_0x4486a7,_0xd981dd))[_0x2190('0x29')](handleError(_0x4486a7,null));};exports['removeAnswers']=function(_0xe0cdee,_0x39aaf8,_0x416e90){return db[_0x2190('0x40')]['find']({'where':{'id':_0xe0cdee[_0x2190('0x57')]['id']}})['then'](handleEntityNotFound(_0x39aaf8,null))[_0x2190('0x20')](function(_0x364295){if(_0x364295){return _0x364295['removeAnswers'](_0xe0cdee[_0x2190('0x45')][_0x2190('0x6f')]);}})[_0x2190('0x20')](respondWithStatusCode(_0x39aaf8,null))[_0x2190('0x29')](handleError(_0x39aaf8,null));};exports[_0x2190('0x70')]=function(_0x411437,_0x449303,_0x284761){return db[_0x2190('0x40')][_0x2190('0x5a')]({'where':{'id':_0x411437[_0x2190('0x57')]['id']}})[_0x2190('0x20')](handleEntityNotFound(_0x449303,null))[_0x2190('0x20')](function(_0x2f2722){if(_0x2f2722){return _0x2f2722['addAgents'](_0x411437['body'][_0x2190('0x6f')],_[_0x2190('0x71')](_0x411437[_0x2190('0x5c')],[_0x2190('0x6f'),'id'])||{})[_0x2190('0x72')](function(_0x5abc03){for(var _0x29a49b=0x0;_0x29a49b<_0x411437[_0x2190('0x5c')][_0x2190('0x6f')]['length'];_0x29a49b+=0x1){socket[_0x2190('0x73')](_0x2190('0x74'),{'UserId':Number(_0x411437[_0x2190('0x5c')][_0x2190('0x6f')][_0x29a49b]),'WhatsappAccountId':Number(_0x411437[_0x2190('0x57')]['id'])});}return _0x5abc03;});}})[_0x2190('0x20')](respondWithResult(_0x449303,null))[_0x2190('0x29')](handleError(_0x449303,null));};exports[_0x2190('0x75')]=function(_0x28b021,_0x100640,_0x776307){return db['WhatsappAccount'][_0x2190('0x5a')]({'where':{'id':_0x28b021[_0x2190('0x57')]['id']}})[_0x2190('0x20')](handleEntityNotFound(_0x100640,null))[_0x2190('0x20')](function(_0x5b6128){if(_0x5b6128){return _0x5b6128[_0x2190('0x75')](_0x28b021[_0x2190('0x45')][_0x2190('0x6f')])[_0x2190('0x20')](function(){if(_[_0x2190('0x76')](_0x28b021[_0x2190('0x45')][_0x2190('0x6f')])){for(var _0x2c9237=0x0;_0x2c9237<_0x28b021['query'][_0x2190('0x6f')][_0x2190('0x58')];_0x2c9237+=0x1){socket[_0x2190('0x73')](_0x2190('0x77'),{'UserId':Number(_0x28b021[_0x2190('0x45')]['ids'][_0x2c9237]),'WhatsappAccountId':Number(_0x28b021[_0x2190('0x57')]['id'])});}}else{socket[_0x2190('0x73')](_0x2190('0x77'),{'UserId':Number(_0x28b021[_0x2190('0x45')][_0x2190('0x6f')]),'WhatsappAccountId':Number(_0x28b021['params']['id'])});}});}})[_0x2190('0x20')](respondWithStatusCode(_0x100640,null))[_0x2190('0x29')](handleError(_0x100640,null));};exports[_0x2190('0x78')]=function(_0x12386e,_0x9643d3,_0x59fe0c){var _0x29a519={};var _0x411e7c={};var _0x10df0a;var _0x3a3059;return db[_0x2190('0x40')]['findOne']({'where':{'id':_0x12386e['params']['id']}})['then'](handleEntityNotFound(_0x9643d3,null))[_0x2190('0x20')](function(_0x50d581){if(_0x50d581){_0x10df0a=_0x50d581;_0x411e7c[_0x2190('0x44')]=_[_0x2190('0x46')](db['User'][_0x2190('0x41')]);_0x411e7c['query']=_[_0x2190('0x46')](_0x12386e[_0x2190('0x45')]);_0x411e7c[_0x2190('0x4e')]=_[_0x2190('0x47')](_0x411e7c[_0x2190('0x44')],_0x411e7c[_0x2190('0x45')]);_0x29a519[_0x2190('0x49')]=_[_0x2190('0x47')](_0x411e7c[_0x2190('0x44')],qs[_0x2190('0x48')](_0x12386e[_0x2190('0x45')][_0x2190('0x48')]));_0x29a519[_0x2190('0x49')]=_0x29a519[_0x2190('0x49')][_0x2190('0x58')]?_0x29a519[_0x2190('0x49')]:_0x411e7c[_0x2190('0x44')];_0x29a519[_0x2190('0x4c')]=qs[_0x2190('0x4d')](_0x12386e['query']['sort']);_0x29a519[_0x2190('0x50')]=qs[_0x2190('0x4e')](_['pick'](_0x12386e['query'],_0x411e7c['filters']));if(_0x12386e[_0x2190('0x45')][_0x2190('0x4f')]){_0x29a519[_0x2190('0x50')]=_['merge'](_0x29a519[_0x2190('0x50')],{'$or':_['map'](_0x29a519[_0x2190('0x49')],function(_0x442f07){var _0x195a75={};_0x195a75[_0x442f07]={'$like':'%'+_0x12386e[_0x2190('0x45')][_0x2190('0x4f')]+'%'};return _0x195a75;})});}_0x29a519=_[_0x2190('0x51')]({},_0x29a519,_0x12386e[_0x2190('0x59')]);return _0x10df0a[_0x2190('0x78')](_0x29a519);}})[_0x2190('0x20')](function(_0xee312d){if(_0xee312d){_0x3a3059=_0xee312d[_0x2190('0x58')];if(!_0x12386e[_0x2190('0x45')][_0x2190('0x4a')](_0x2190('0x4b'))){_0x29a519[_0x2190('0x2e')]=qs[_0x2190('0x2e')](_0x12386e['query']['limit']);_0x29a519[_0x2190('0x30')]=qs[_0x2190('0x30')](_0x12386e[_0x2190('0x45')][_0x2190('0x30')]);}return _0x10df0a[_0x2190('0x78')](_0x29a519);}})[_0x2190('0x20')](function(_0x16f058){if(_0x16f058){return _0x16f058?{'count':_0x3a3059,'rows':_0x16f058}:null;}})[_0x2190('0x20')](respondWithResult(_0x9643d3,null))[_0x2190('0x29')](handleError(_0x9643d3,null));};exports[_0x2190('0x79')]=function(_0x684d97,_0xebed97){var _0x4e42bf=_0x684d97['params']['id'];var _0x48e624=_0x684d97[_0x2190('0x5c')];var _0x3a8670=0xc8;var _0x1d242c=null;return db[_0x2190('0x7a')][_0x2190('0x7b')]({'isolationLevel':db[_0x2190('0x7a')][_0x2190('0x7c')][_0x2190('0x7d')][_0x2190('0x7e')]},function(_0x1db0ae){return db['WhatsappAccount'][_0x2190('0x6e')]({'where':{'id':_0x4e42bf},'transaction':_0x1db0ae})[_0x2190('0x20')](function(_0x28be00){if(_0x28be00){return db[_0x2190('0x7f')]['destroy']({'where':{'WhatsappAccountId':_0x4e42bf},'transaction':_0x1db0ae})[_0x2190('0x20')](function(){var _0xe27845=_[_0x2190('0x3f')](_0x48e624,function(_0x991385){_0x991385['WhatsappAccountId']=_0x4e42bf;return _0x991385;});return db[_0x2190('0x7f')]['bulkCreate'](_0xe27845,{'transaction':_0x1db0ae});});}else{_0x3a8670=0x194;_0x1d242c=[];}});})[_0x2190('0x20')](function(){if(_0x3a8670!==0x194){return db['WhatsappApplication']['findAndCountAll']({'where':{'WhatsappAccountId':_0x4e42bf},'order':'priority'})[_0x2190('0x20')](function(_0xdbcb76){_0x1d242c=_0xdbcb76;});}})[_0x2190('0x29')](function(_0x1a7def){_0x3a8670=0x1f4;logger['error'](_0x1a7def[_0x2190('0x3a')]);if(_0x1a7def[_0x2190('0x3b')]){delete _0x1a7def[_0x2190('0x3b')];}_0x1d242c=_0x1a7def;})[_0x2190('0x80')](function(){if(_0x1d242c===null){_0xebed97[_0x2190('0x2a')](_0x3a8670);}else{if(_0x3a8670===0x1f4){_0xebed97[_0x2190('0x2b')](_0x3a8670)[_0x2190('0x3c')](_0x1d242c);}else{_0xebed97[_0x2190('0x2b')](_0x3a8670)[_0x2190('0x2c')](_0x1d242c);}}});};exports[_0x2190('0x81')]=function(_0x5a7690,_0x256c3f,_0x100165){var _0x54e893={};var _0xcaffbb={};var _0xd05013;var _0x3c2806;return db[_0x2190('0x40')][_0x2190('0x6e')]({'where':{'id':_0x5a7690[_0x2190('0x57')]['id']}})['then'](handleEntityNotFound(_0x256c3f,null))[_0x2190('0x20')](function(_0x5ce078){if(_0x5ce078){_0xd05013=_0x5ce078;_0xcaffbb[_0x2190('0x44')]=_['keys'](db[_0x2190('0x7f')][_0x2190('0x41')]);_0xcaffbb[_0x2190('0x45')]=_[_0x2190('0x46')](_0x5a7690[_0x2190('0x45')]);_0xcaffbb['filters']=_['intersection'](_0xcaffbb['model'],_0xcaffbb[_0x2190('0x45')]);_0x54e893[_0x2190('0x49')]=_[_0x2190('0x47')](_0xcaffbb[_0x2190('0x44')],qs[_0x2190('0x48')](_0x5a7690[_0x2190('0x45')][_0x2190('0x48')]));_0x54e893[_0x2190('0x49')]=_0x54e893[_0x2190('0x49')]['length']?_0x54e893[_0x2190('0x49')]:_0xcaffbb[_0x2190('0x44')];_0x54e893[_0x2190('0x4c')]=qs[_0x2190('0x4d')](_0x5a7690[_0x2190('0x45')][_0x2190('0x4d')]);_0x54e893[_0x2190('0x50')]=qs[_0x2190('0x4e')](_['pick'](_0x5a7690['query'],_0xcaffbb['filters']));if(_0x5a7690[_0x2190('0x45')][_0x2190('0x4f')]){_0x54e893[_0x2190('0x50')]=_['merge'](_0x54e893[_0x2190('0x50')],{'$or':_[_0x2190('0x3f')](_0x54e893['attributes'],function(_0x12b77c){var _0x2cac73={};_0x2cac73[_0x12b77c]={'$like':'%'+_0x5a7690[_0x2190('0x45')]['filter']+'%'};return _0x2cac73;})});}_0x54e893=_[_0x2190('0x51')]({},_0x54e893,_0x5a7690[_0x2190('0x59')]);return _0xd05013[_0x2190('0x81')](_0x54e893);}})[_0x2190('0x20')](function(_0x2b8067){if(_0x2b8067){_0x3c2806=_0x2b8067['length'];if(!_0x5a7690['query'][_0x2190('0x4a')](_0x2190('0x4b'))){_0x54e893[_0x2190('0x2e')]=qs[_0x2190('0x2e')](_0x5a7690[_0x2190('0x45')][_0x2190('0x2e')]);_0x54e893['offset']=qs[_0x2190('0x30')](_0x5a7690[_0x2190('0x45')][_0x2190('0x30')]);}return _0xd05013[_0x2190('0x81')](_0x54e893);}})[_0x2190('0x20')](function(_0x325e72){if(_0x325e72){return _0x325e72?{'count':_0x3c2806,'rows':_0x325e72}:null;}})[_0x2190('0x20')](respondWithResult(_0x256c3f,null))[_0x2190('0x29')](handleError(_0x256c3f,null));};exports[_0x2190('0x82')]=function(_0x5b085a,_0x5631eb,_0x5895f5){var _0x308ecb={'channel':_0x2190('0x83')};var _0x569656=[];var _0x269679=[];var _0x20c852={};return db[_0x2190('0x40')][_0x2190('0x5a')]({'where':{'id':_0x5b085a[_0x2190('0x57')]['id']},'include':[{'model':db[_0x2190('0x7f')],'as':_0x2190('0x84')}]})[_0x2190('0x20')](handleEntityNotFound(_0x5631eb,null))['then'](function(_0xefbfb3){_0x308ecb[_0x2190('0x85')]=_0xefbfb3;if(_0x308ecb[_0x2190('0x85')]&&_0x308ecb[_0x2190('0x85')][_0x2190('0x42')]===_0x2190('0x86')&&_0x5b085a[_0x2190('0x5c')][_0x2190('0x87')]){if(_0x5b085a[_0x2190('0x5c')][_0x2190('0x87')][_0x2190('0x58')]===0x0)return;if(_0x5b085a[_0x2190('0x5c')][_0x2190('0x87')][0x0][_0x2190('0x88')]!=='read')return;return db['WhatsappMessage'][_0x2190('0x34')]({'read':!![],'readAt':_0x5b085a[_0x2190('0x5c')]['statuses'][0x0][_0x2190('0x89')]},{'where':{'messageId':_0x5b085a['body']['statuses'][0x0][_0x2190('0x8a')]},'individualHooks':!![]})[_0x2190('0x20')](function(_0x412c9d){return _0x5631eb[_0x2190('0x2b')](0xc8)[_0x2190('0x2c')](_0x412c9d);});}_0x308ecb['applications']=_[_0x2190('0x8b')](_0xefbfb3[_0x2190('0x84')],['priority'],[_0x2190('0x8c')]);if(_0x308ecb['account'][_0x2190('0x84')]){delete _0x308ecb[_0x2190('0x85')]['Applications'];}return db[_0x2190('0x8d')]['describe']()['then'](function(_0x35267d){if(!_0x35267d){throw new db['Sequelize'][(_0x2190('0x8e'))](_0x2190('0x8f'));}_0x569656=_[_0x2190('0x90')](_[_0x2190('0x46')](_0x35267d),[_0x2190('0x91'),_0x2190('0x92')]);_0x269679=_[_0x2190('0x90')](_[_0x2190('0x46')](_0x35267d),[_0x2190('0x91'),_0x2190('0x92'),_0x2190('0x93'),'ListId']);_0x308ecb['body']={'mapKey':_0x2190('0x94')};if(_0x308ecb['account']&&_0x308ecb[_0x2190('0x85')][_0x2190('0x42')]===_0x2190('0x95')){_0x308ecb[_0x2190('0x5c')][_0x2190('0x96')]=_0x5b085a[_0x2190('0x5c')][_0x2190('0x97')][_0x2190('0x98')](_0x2190('0x99'),'');_0x308ecb[_0x2190('0x5c')][_0x2190('0x5c')]=_0x5b085a[_0x2190('0x5c')][_0x2190('0x9a')];_0x308ecb[_0x2190('0x5c')]['messageId']=_0x5b085a[_0x2190('0x5c')]['MessageSid'];}if(_0x308ecb['account']&&_0x308ecb['account'][_0x2190('0x42')]==='sinch'){_0x308ecb[_0x2190('0x5c')][_0x2190('0x96')]=_0x5b085a[_0x2190('0x5c')]['notifications'][0x0]['from'];_0x308ecb[_0x2190('0x5c')]['body']=_0x5b085a[_0x2190('0x5c')][_0x2190('0x9b')][0x0][_0x2190('0x26')][_0x2190('0x5c')];_0x308ecb[_0x2190('0x5c')]['messageId']=_0x5b085a['body']['notifications'][0x0][_0x2190('0x8a')];}if(_0x308ecb['body']['id']){delete _0x308ecb[_0x2190('0x5c')]['id'];}if(_[_0x2190('0x9c')](_0x308ecb[_0x2190('0x5c')][_0x2190('0x96')])){throw new db[(_0x2190('0x9d'))]['ValidationError'](_0x2190('0x9e'));}if(_['isNil'](_0x308ecb[_0x2190('0x5c')]['body'])||_0x308ecb[_0x2190('0x5c')][_0x2190('0x5c')]===''){throw new db[(_0x2190('0x9d'))][(_0x2190('0x8e'))](_0x2190('0x9f'));}if(_['isNil'](_0x308ecb[_0x2190('0x5c')][_0x2190('0xa0')])){throw new db[(_0x2190('0x9d'))][(_0x2190('0x8e'))](_0x2190('0xa1')+_0x269679);}if(!_[_0x2190('0xa2')](_0x269679,_0x308ecb[_0x2190('0x5c')][_0x2190('0xa0')])){throw new db[(_0x2190('0x9d'))][(_0x2190('0x8e'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x269679);}_0x20c852[_0x308ecb[_0x2190('0x5c')][_0x2190('0xa0')]]=_0x308ecb['body']['from'];return db['CmList'][_0x2190('0x5a')]({'where':{'id':_0x308ecb[_0x2190('0x85')][_0x2190('0xa3')]},'include':[{'model':db[_0x2190('0x8d')],'as':_0x2190('0xa4'),'where':_0x20c852,'limit':0x1,'order':[[_0x2190('0x92'),_0x2190('0xa5')]]}]});})[_0x2190('0x20')](handleEntityNotFound(_0x5631eb,null))[_0x2190('0x20')](function(_0x212bfc){if(_0x212bfc){_0x308ecb[_0x2190('0xa6')]=_[_0x2190('0x71')](_0x212bfc,['Contacts']);if(_0x212bfc[_0x2190('0xa4')][_0x2190('0x58')]){return _0x212bfc[_0x2190('0xa4')][0x0];}var _0x4f45eb=_[_0x2190('0x19')](_0x308ecb[_0x2190('0x5c')],{'firstName':_0x308ecb[_0x2190('0x5c')][_0x2190('0x96')],'ListId':_0x212bfc['id']});_0x4f45eb[_0x308ecb[_0x2190('0x5c')][_0x2190('0xa0')]]=_0x308ecb[_0x2190('0x5c')]['from'];return db[_0x2190('0x8d')][_0x2190('0x5b')](_0x4f45eb,{'fields':_0x569656,'raw':!![]});}})[_0x2190('0x20')](handleEntityNotFound(_0x5631eb,null))[_0x2190('0x20')](function(_0x14685a){if(_0x14685a){_0x308ecb['contact']=_0x14685a;var _0x46f04c={'ContactId':_0x14685a['id'],'phone':_0x308ecb[_0x2190('0x5c')]['from'],'WhatsappAccountId':_0x5b085a[_0x2190('0x57')]['id']};var _0x5c808b={'ContactId':_0x14685a['id'],'WhatsappAccountId':_0x5b085a['params']['id'],'closed':![]};return db[_0x2190('0xa7')][_0x2190('0x5a')]({'where':_0x5c808b})[_0x2190('0x20')](function(_0x2baa29){if(_0x2baa29){return[_0x2baa29,![]];}return db['WhatsappInteraction'][_0x2190('0x5b')](_0x46f04c)['then'](function(_0x1f7840){return[_0x1f7840,!![]];});});}})[_0x2190('0x72')](function(_0x18893e,_0xe84b4){_0x308ecb[_0x2190('0xa8')]=_0x18893e[_0x2190('0x36')]({'plain':!![]});_0x308ecb[_0x2190('0xa8')][_0x2190('0xa9')]=![];if(_0xe84b4){if(_0x308ecb['account'][_0x2190('0xaa')]){_0x308ecb['applications']['push']({'id':0x0,'priority':_0x308ecb[_0x2190('0xab')][_0x2190('0x58')]+0x1,'app':_0x2190('0xac'),'appdata':_0x2190('0xad'),'interval':'*,*,*,*'});}_0x308ecb['interaction'][_0x2190('0xa9')]=!![];}return db[_0x2190('0xae')][_0x2190('0x5b')]({'phone':_0x308ecb[_0x2190('0x5c')][_0x2190('0x96')],'messageId':_0x308ecb[_0x2190('0x5c')][_0x2190('0xaf')],'body':_0x308ecb[_0x2190('0x5c')][_0x2190('0x5c')],'WhatsappAccountId':_0x5b085a[_0x2190('0x57')]['id'],'WhatsappInteractionId':_0x18893e['id'],'direction':'in','ContactId':_0x18893e[_0x2190('0xb0')],'AttachmentId':_0x308ecb[_0x2190('0x5c')][_0x2190('0xb1')]});})['then'](function(_0x4b1f78){_0x308ecb['message']=_0x4b1f78;if(!_0x308ecb[_0x2190('0xa8')][_0x2190('0xb2')])return;return db['User']['find']({'attributes':['id',_0x2190('0x3b')],'where':{'id':_0x308ecb[_0x2190('0xa8')][_0x2190('0xb2')]}});})[_0x2190('0x20')](function(_0x47f6ff){if(_0x47f6ff){_0x308ecb[_0x2190('0xab')][_0x2190('0xb3')]({'id':0x0,'priority':0x0,'app':_0x2190('0xb4'),'appdata':_0x47f6ff['name']+','+(_0x308ecb['account'][_0x2190('0xb5')]||0xa),'interval':_0x2190('0xb6')});}if(!_0x308ecb['interaction'][_0x2190('0xb7')])return;return db[_0x2190('0xb8')][_0x2190('0x5a')]({'attributes':['id',_0x2190('0x3b')],'where':{'id':_0x308ecb[_0x2190('0xa8')][_0x2190('0xb7')]}});})['then'](function(_0x537787){if(_0x537787){_0x308ecb[_0x2190('0xab')][_0x2190('0xb3')]({'id':0x0,'priority':0x1,'app':_0x2190('0xb9'),'appdata':_0x537787[_0x2190('0x3b')]+','+(_0x308ecb[_0x2190('0x85')][_0x2190('0xba')]||0x12c),'interval':_0x2190('0xb6')});}return respondWithRpcPromise(_0x2190('0xbb'),_0x2190('0xbc'),_0x308ecb);})['then'](function(_0x585068){if(_0x585068){var _0x5de06f=0xc8;var _0x453b08=_0x2190('0xbd');logger[_0x2190('0x21')](_0x2190('0x23'),_0x453b08,_0x5de06f,'entity\x20found');logger[_0x2190('0xbe')](_0x2190('0xbf'),_0x453b08,_0x5de06f,'entity\x20found',JSON[_0x2190('0x24')](_0x585068));if(_0x308ecb['account'][_0x2190('0x42')]===_0x2190('0x95')){return _0x5631eb[_0x2190('0x2b')](_0x5de06f)['set'](_0x2190('0xc0'),'text/xml')[_0x2190('0x3c')](_0x2190('0xc1'));}else{return _0x5631eb[_0x2190('0x2b')](_0x5de06f)[_0x2190('0x2c')](_0x585068);}}});})['catch'](handleError(_0x5631eb,null));};exports[_0x2190('0x3c')]=function(_0x326a8d,_0x54552a,_0x42ad64){var _0x2c4a6e,_0x309f63,_0x4d92cd;if(_[_0x2190('0x9c')](_0x326a8d['body'][_0x2190('0x5c')])||_0x326a8d[_0x2190('0x5c')][_0x2190('0x5c')]===''){throw new db[(_0x2190('0x9d'))]['ValidationError'](_0x2190('0x9f'));}if(_[_0x2190('0x9c')](_0x326a8d[_0x2190('0x5c')]['to'])){throw new db[(_0x2190('0x9d'))][(_0x2190('0x8e'))](_0x2190('0xc2'));}_0x2c4a6e=_0x326a8d['body']['to'];return db[_0x2190('0x40')][_0x2190('0x5a')]({'where':{'id':_0x326a8d[_0x2190('0x57')]['id']},'include':[{'model':db['CmList'],'as':_0x2190('0xc3'),'include':[{'model':db['CmContact'],'as':_0x2190('0xa4'),'where':{'mobile':_0x2c4a6e},'limit':0x1,'order':[['updatedAt',_0x2190('0xa5')]]}]}]})[_0x2190('0x20')](handleEntityNotFound(_0x54552a,null))[_0x2190('0x20')](function(_0x38b27e){if(_0x38b27e&&_0x38b27e[_0x2190('0xc3')]){_0x309f63=_0x38b27e['get']({'plain':!![]});if(_0x309f63[_0x2190('0xc3')]&&_0x309f63['List'][_0x2190('0xa4')][_0x2190('0x58')]){return _0x309f63[_0x2190('0xc3')][_0x2190('0xa4')][0x0];}return db['CmContact'][_0x2190('0x5b')](_[_0x2190('0x19')](_0x326a8d[_0x2190('0x5c')],{'firstName':_0x2c4a6e,'mobile':_0x2c4a6e,'phone':_0x2c4a6e,'ListId':_0x309f63['ListId']}));}})[_0x2190('0x20')](handleEntityNotFound(_0x54552a,null))[_0x2190('0x20')](function(_0x5a15b4){if(_0x5a15b4){_0x4d92cd=_0x5a15b4;return db[_0x2190('0xa7')][_0x2190('0x5a')]({'where':{'ContactId':_0x4d92cd['id'],'closed':![],'WhatsappAccountId':_0x309f63['id']}})[_0x2190('0x20')](function(_0x4df62c){if(_0x4df62c){return[_0x4df62c,![]];}return db['WhatsappInteraction'][_0x2190('0x5b')]({'UserId':_0x326a8d[_0x2190('0x5d')]['id'],'ContactId':_0x4d92cd['id'],'WhatsappAccountId':_0x309f63['id'],'phone':_0x2c4a6e,'firstMsgDirection':_0x2190('0xc4'),'Messages':[_[_0x2190('0x51')](_0x326a8d[_0x2190('0x5c')],{'read':![],'body':_0x326a8d[_0x2190('0x5c')][_0x2190('0x5c')],'phone':_0x2c4a6e,'WhatsappAccountId':_0x309f63['id'],'UserId':_0x326a8d['user']['id'],'ContactId':_0x4d92cd['id']})]},{'include':[{'model':db[_0x2190('0xae')],'as':_0x2190('0xc5')}]})[_0x2190('0x20')](function(_0x29f8fa){return[_0x29f8fa,!![]];});});}})[_0x2190('0x72')](function(_0x2cafc4,_0x3d6615){if(_0x3d6615){return _0x2cafc4;}return db[_0x2190('0xae')]['create'](_[_0x2190('0x51')](_0x326a8d[_0x2190('0x5c')],{'read':![],'body':_0x326a8d[_0x2190('0x5c')][_0x2190('0x5c')],'phone':_0x2c4a6e,'WhatsappAccountId':_0x309f63['id'],'WhatsappInteractionId':_0x2cafc4['id'],'UserId':_0x326a8d[_0x2190('0x5d')]['id'],'ContactId':_0x4d92cd['id']}))[_0x2190('0x20')](function(_0x2550ff){_0x2cafc4[_0x2190('0xc6')][_0x2190('0xc5')]=[];_0x2cafc4[_0x2190('0xc6')][_0x2190('0xc5')]['push'](_0x2550ff[_0x2190('0xc6')]);return _0x2cafc4;});})[_0x2190('0x20')](respondWithResult(_0x54552a,null))[_0x2190('0x29')](handleError(_0x54552a,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 4ee0f44..752a03a 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 _0xc56f=['emit','../../mysqldb','WhatsappAccount','setMaxListeners','update','remove'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xc56f,0x17b));var _0xfc56=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xc56f[_0x164eca];return _0x2ce562;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xfc56('0x0'))['db'][_0xfc56('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xfc56('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfc56('0x3'),'afterDestroy':_0xfc56('0x4')};function emitEvent(_0x41122c){return function(_0x55845a,_0x37afcf,_0xb1537d){WhatsappAccountEvents[_0xfc56('0x5')](_0x41122c+':'+_0x55845a['id'],_0x55845a);WhatsappAccountEvents[_0xfc56('0x5')](_0x41122c,_0x55845a);_0xb1537d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0x475a=['emit','hook','exports','events','../../mysqldb','WhatsappAccount','save','update'];(function(_0x43e199,_0x369b43){var _0x26c476=function(_0x3d157c){while(--_0x3d157c){_0x43e199['push'](_0x43e199['shift']());}};_0x26c476(++_0x369b43);}(_0x475a,0xbb));var _0xa475=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x475a[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require(_0xa475('0x0'));var WhatsappAccount=require(_0xa475('0x1'))['db'][_0xa475('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa475('0x3'),'afterUpdate':_0xa475('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5daa2c){return function(_0x19c83e,_0x4eda08,_0x33c119){WhatsappAccountEvents['emit'](_0x5daa2c+':'+_0x19c83e['id'],_0x19c83e);WhatsappAccountEvents[_0xa475('0x5')](_0x5daa2c,_0x19c83e);_0x33c119(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0xa475('0x6')](e,emitEvent(event));}}module[_0xa475('0x7')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index cf61b40..bc66f56 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 _0xaa5c=['exports','define','whatsapp_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./whatsappAccount.attributes'];(function(_0x1d55c3,_0x1429d0){var _0x2be1c9=function(_0x3ed0e9){while(--_0x3ed0e9){_0x1d55c3['push'](_0x1d55c3['shift']());}};_0x2be1c9(++_0x1429d0);}(_0xaa5c,0x9d));var _0xcaa5=function(_0x36489a,_0x2878ac){_0x36489a=_0x36489a-0x0;var _0x4fc5ce=_0xaa5c[_0x36489a];return _0x4fc5ce;};'use strict';var _=require(_0xcaa5('0x0'));var util=require('util');var logger=require(_0xcaa5('0x1'))(_0xcaa5('0x2'));var moment=require(_0xcaa5('0x3'));var BPromise=require(_0xcaa5('0x4'));var rp=require(_0xcaa5('0x5'));var fs=require('fs');var path=require(_0xcaa5('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcaa5('0x7'));module[_0xcaa5('0x8')]=function(_0x62c7bc,_0x37abec){return _0x62c7bc[_0xcaa5('0x9')]('WhatsappAccount',attributes,{'tableName':_0xcaa5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6944=['exports','define','whatsapp_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes'];(function(_0x25a136,_0x57320e){var _0x5b7159=function(_0x32c8f9){while(--_0x32c8f9){_0x25a136['push'](_0x25a136['shift']());}};_0x5b7159(++_0x57320e);}(_0x6944,0x153));var _0x4694=function(_0x4573bd,_0x19b9b5){_0x4573bd=_0x4573bd-0x0;var _0xc07bb9=_0x6944[_0x4573bd];return _0xc07bb9;};'use strict';var _=require(_0x4694('0x0'));var util=require(_0x4694('0x1'));var logger=require(_0x4694('0x2'))(_0x4694('0x3'));var moment=require(_0x4694('0x4'));var BPromise=require(_0x4694('0x5'));var rp=require(_0x4694('0x6'));var fs=require('fs');var path=require(_0x4694('0x7'));var rimraf=require(_0x4694('0x8'));var config=require(_0x4694('0x9'));var attributes=require(_0x4694('0xa'));module[_0x4694('0xb')]=function(_0x6540e5,_0x1f04f4){return _0x6540e5[_0x4694('0xc')]('WhatsappAccount',attributes,{'tableName':_0x4694('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 46af753..25e74c3 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 _0x7fbe=['ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','request','then','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','WhatsappAccount,\x20%s,\x20%s'];(function(_0x4e42ed,_0xd26a6){var _0x16dbac=function(_0x17fbf3){while(--_0x17fbf3){_0x4e42ed['push'](_0x4e42ed['shift']());}};_0x16dbac(++_0xd26a6);}(_0x7fbe,0xbe));var _0xe7fb=function(_0x1a9f8b,_0x53ac1b){_0x1a9f8b=_0x1a9f8b-0x0;var _0x12a2c1=_0x7fbe[_0x1a9f8b];return _0x12a2c1;};'use strict';var _=require(_0xe7fb('0x0'));var util=require(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require('../../config/logger')(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var jayson=require(_0xe7fb('0x8'));var client=jayson[_0xe7fb('0x9')][_0xe7fb('0xa')]({'port':0x232a});config[_0xe7fb('0xb')]=_[_0xe7fb('0xc')](config[_0xe7fb('0xb')],{'host':_0xe7fb('0xd'),'port':0x18eb});var socket=require(_0xe7fb('0xe'))(new Redis(config['redis']));require(_0xe7fb('0xf'))['register'](socket);function respondWithRpcPromise(_0x510118,_0x33eaec,_0xf5f625){return new BPromise(function(_0x142261,_0x196335){return client[_0xe7fb('0x10')](_0x510118,_0xf5f625)[_0xe7fb('0x11')](function(_0x49ce3a){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x33eaec,'request\x20sent');logger[_0xe7fb('0x12')](_0xe7fb('0x13'),_0x33eaec,_0xe7fb('0x14'),JSON[_0xe7fb('0x15')](_0x49ce3a));if(_0x49ce3a['error']){if(_0x49ce3a['error']['code']===0x1f4){logger[_0xe7fb('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x33eaec,_0x49ce3a['error']['message']);return _0x196335(_0x49ce3a[_0xe7fb('0x16')][_0xe7fb('0x17')]);}logger[_0xe7fb('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x33eaec,_0x49ce3a[_0xe7fb('0x16')][_0xe7fb('0x17')]);return _0x142261(_0x49ce3a[_0xe7fb('0x16')][_0xe7fb('0x17')]);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x33eaec,_0xe7fb('0x14'));_0x142261(_0x49ce3a['result'][_0xe7fb('0x17')]);}})[_0xe7fb('0x18')](function(_0x3bb92a){logger[_0xe7fb('0x16')](_0xe7fb('0x19'),_0x33eaec,_0x3bb92a);_0x196335(_0x3bb92a);});});}exports[_0xe7fb('0x1a')]=function(_0x1ec229){var _0x53b787=this;return new Promise(function(_0x30308c,_0x1590d5){return db[_0xe7fb('0x1b')][_0xe7fb('0x1c')]({'raw':_0x1ec229[_0xe7fb('0x1d')]?_0x1ec229[_0xe7fb('0x1d')][_0xe7fb('0x1e')]===undefined?!![]:![]:!![],'where':_0x1ec229[_0xe7fb('0x1d')]?_0x1ec229[_0xe7fb('0x1d')][_0xe7fb('0x1f')]||null:null,'attributes':_0x1ec229['options']?_0x1ec229[_0xe7fb('0x1d')][_0xe7fb('0x20')]||null:null,'include':_0x1ec229[_0xe7fb('0x1d')]?_0x1ec229[_0xe7fb('0x1d')][_0xe7fb('0x21')]?_[_0xe7fb('0x22')](_0x1ec229['options'][_0xe7fb('0x21')],function(_0x5a56eb){return{'model':db[_0x5a56eb[_0xe7fb('0x23')]],'as':_0x5a56eb['as'],'attributes':_0x5a56eb['attributes'],'include':_0x5a56eb['include']?_[_0xe7fb('0x22')](_0x5a56eb[_0xe7fb('0x21')],function(_0x543604){return{'model':db[_0x543604['model']],'as':_0x543604['as'],'attributes':_0x543604[_0xe7fb('0x20')],'include':_0x543604['include']?_[_0xe7fb('0x22')](_0x543604[_0xe7fb('0x21')],function(_0x5e1883){return{'model':db[_0x5e1883['model']],'as':_0x5e1883['as'],'attributes':_0x5e1883[_0xe7fb('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe7fb('0x11')](function(_0x3a7770){logger['info']('ShowWhatsappAccount',_0x1ec229);logger[_0xe7fb('0x12')](_0xe7fb('0x1a'),_0x1ec229,JSON[_0xe7fb('0x15')](_0x3a7770));_0x30308c(_0x3a7770);})[_0xe7fb('0x18')](function(_0x25b2ee){logger[_0xe7fb('0x16')](_0xe7fb('0x1a'),_0x25b2ee['message'],_0x1ec229);_0x1590d5(_0x53b787[_0xe7fb('0x16')](0x1f4,_0x25b2ee[_0xe7fb('0x17')]));});});}; \ No newline at end of file +var _0xf3ca=['request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','ShowWhatsappAccount','options','raw','where','attributes','include','map','model','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','register','request','then','WhatsappAccount,\x20%s,\x20%s'];(function(_0x495d3e,_0x3480bf){var _0x361aa9=function(_0x1daeae){while(--_0x1daeae){_0x495d3e['push'](_0x495d3e['shift']());}};_0x361aa9(++_0x3480bf);}(_0xf3ca,0x1da));var _0xaf3c=function(_0x5daf8f,_0x307436){_0x5daf8f=_0x5daf8f-0x0;var _0x59a139=_0xf3ca[_0x5daf8f];return _0x59a139;};'use strict';var _=require(_0xaf3c('0x0'));var util=require(_0xaf3c('0x1'));var moment=require(_0xaf3c('0x2'));var BPromise=require(_0xaf3c('0x3'));var rs=require(_0xaf3c('0x4'));var fs=require('fs');var Redis=require(_0xaf3c('0x5'));var db=require(_0xaf3c('0x6'))['db'];var utils=require(_0xaf3c('0x7'));var logger=require(_0xaf3c('0x8'))(_0xaf3c('0x9'));var config=require(_0xaf3c('0xa'));var jayson=require(_0xaf3c('0xb'));var client=jayson[_0xaf3c('0xc')][_0xaf3c('0xd')]({'port':0x232a});config[_0xaf3c('0xe')]=_['defaults'](config['redis'],{'host':_0xaf3c('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaf3c('0xe')]));require('./whatsappAccount.socket')[_0xaf3c('0x10')](socket);function respondWithRpcPromise(_0x145d1f,_0x3004ef,_0x34bed8){return new BPromise(function(_0x7bf490,_0x57d61d){return client[_0xaf3c('0x11')](_0x145d1f,_0x34bed8)[_0xaf3c('0x12')](function(_0x5a7a9f){logger['info'](_0xaf3c('0x13'),_0x3004ef,_0xaf3c('0x14'));logger[_0xaf3c('0x15')](_0xaf3c('0x16'),_0x3004ef,'request\x20sent',JSON['stringify'](_0x5a7a9f));if(_0x5a7a9f[_0xaf3c('0x17')]){if(_0x5a7a9f[_0xaf3c('0x17')][_0xaf3c('0x18')]===0x1f4){logger[_0xaf3c('0x17')](_0xaf3c('0x13'),_0x3004ef,_0x5a7a9f['error'][_0xaf3c('0x19')]);return _0x57d61d(_0x5a7a9f[_0xaf3c('0x17')]['message']);}logger['error'](_0xaf3c('0x13'),_0x3004ef,_0x5a7a9f[_0xaf3c('0x17')][_0xaf3c('0x19')]);return _0x7bf490(_0x5a7a9f[_0xaf3c('0x17')][_0xaf3c('0x19')]);}else{logger[_0xaf3c('0x1a')](_0xaf3c('0x13'),_0x3004ef,_0xaf3c('0x14'));_0x7bf490(_0x5a7a9f[_0xaf3c('0x1b')][_0xaf3c('0x19')]);}})['catch'](function(_0x31c1cd){logger[_0xaf3c('0x17')](_0xaf3c('0x13'),_0x3004ef,_0x31c1cd);_0x57d61d(_0x31c1cd);});});}exports[_0xaf3c('0x1c')]=function(_0x30e292){var _0x42b440=this;return new Promise(function(_0x2d6041,_0x498198){return db['WhatsappAccount']['find']({'raw':_0x30e292[_0xaf3c('0x1d')]?_0x30e292[_0xaf3c('0x1d')][_0xaf3c('0x1e')]===undefined?!![]:![]:!![],'where':_0x30e292[_0xaf3c('0x1d')]?_0x30e292[_0xaf3c('0x1d')][_0xaf3c('0x1f')]||null:null,'attributes':_0x30e292['options']?_0x30e292[_0xaf3c('0x1d')][_0xaf3c('0x20')]||null:null,'include':_0x30e292[_0xaf3c('0x1d')]?_0x30e292[_0xaf3c('0x1d')][_0xaf3c('0x21')]?_[_0xaf3c('0x22')](_0x30e292[_0xaf3c('0x1d')][_0xaf3c('0x21')],function(_0x1dca88){return{'model':db[_0x1dca88[_0xaf3c('0x23')]],'as':_0x1dca88['as'],'attributes':_0x1dca88[_0xaf3c('0x20')],'include':_0x1dca88[_0xaf3c('0x21')]?_[_0xaf3c('0x22')](_0x1dca88[_0xaf3c('0x21')],function(_0x51513c){return{'model':db[_0x51513c[_0xaf3c('0x23')]],'as':_0x51513c['as'],'attributes':_0x51513c[_0xaf3c('0x20')],'include':_0x51513c[_0xaf3c('0x21')]?_[_0xaf3c('0x22')](_0x51513c['include'],function(_0x679d2c){return{'model':db[_0x679d2c[_0xaf3c('0x23')]],'as':_0x679d2c['as'],'attributes':_0x679d2c[_0xaf3c('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29d50b){logger[_0xaf3c('0x1a')](_0xaf3c('0x1c'),_0x30e292);logger[_0xaf3c('0x15')](_0xaf3c('0x1c'),_0x30e292,JSON[_0xaf3c('0x24')](_0x29d50b));_0x2d6041(_0x29d50b);})[_0xaf3c('0x25')](function(_0x350359){logger['error'](_0xaf3c('0x1c'),_0x350359[_0xaf3c('0x19')],_0x30e292);_0x498198(_0x42b440[_0xaf3c('0x17')](0x1f4,_0x350359[_0xaf3c('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 4888240..82593a3 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 _0x9044=['update','emit','removeListener','register','length','whatsappAccount:','./whatsappAccount.events','remove'];(function(_0x478f10,_0x194d86){var _0x47c5e9=function(_0x58f932){while(--_0x58f932){_0x478f10['push'](_0x478f10['shift']());}};_0x47c5e9(++_0x194d86);}(_0x9044,0x86));var _0x4904=function(_0x22033b,_0x15843b){_0x22033b=_0x22033b-0x0;var _0x5eb7e5=_0x9044[_0x22033b];return _0x5eb7e5;};'use strict';var WhatsappAccountEvents=require(_0x4904('0x0'));var events=['save',_0x4904('0x1'),_0x4904('0x2')];function createListener(_0x31f6d5,_0x51e550){return function(_0x4b274a){_0x51e550[_0x4904('0x3')](_0x31f6d5,_0x4b274a);};}function removeListener(_0x96ac38,_0x2233b9){return function(){WhatsappAccountEvents[_0x4904('0x4')](_0x96ac38,_0x2233b9);};}exports[_0x4904('0x5')]=function(_0x4c6eb1){for(var _0x5bd14a=0x0,_0x4547d5=events[_0x4904('0x6')];_0x5bd14a<_0x4547d5;_0x5bd14a++){var _0x4e7a90=events[_0x5bd14a];var _0x24898e=createListener(_0x4904('0x7')+_0x4e7a90,_0x4c6eb1);WhatsappAccountEvents['on'](_0x4e7a90,_0x24898e);}}; \ No newline at end of file +var _0x34ad=['save','update','emit','removeListener','register','length','whatsappAccount:','./whatsappAccount.events'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x34ad,0x197));var _0xd34a=function(_0x28b12e,_0x59f4f5){_0x28b12e=_0x28b12e-0x0;var _0x2c3bd1=_0x34ad[_0x28b12e];return _0x2c3bd1;};'use strict';var WhatsappAccountEvents=require(_0xd34a('0x0'));var events=[_0xd34a('0x1'),'remove',_0xd34a('0x2')];function createListener(_0x45e750,_0x126b5b){return function(_0x40d7c0){_0x126b5b[_0xd34a('0x3')](_0x45e750,_0x40d7c0);};}function removeListener(_0x49e412,_0x3b06d7){return function(){WhatsappAccountEvents[_0xd34a('0x4')](_0x49e412,_0x3b06d7);};}exports[_0xd34a('0x5')]=function(_0x5da70f){for(var _0x15b2a3=0x0,_0x47944d=events[_0xd34a('0x6')];_0x15b2a3<_0x47944d;_0x15b2a3++){var _0x4b6e68=events[_0x15b2a3];var _0x4d1685=createListener(_0xd34a('0x7')+_0x4b6e68,_0x5da70f);WhatsappAccountEvents['on'](_0x4b6e68,_0x4d1685);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 0bae465..c57f1c7 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 _0x38d3=['isAuthenticated','create','put','update','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','index','/:id','show'];(function(_0x7cb10c,_0x2fcc3a){var _0x11df59=function(_0x75305f){while(--_0x75305f){_0x7cb10c['push'](_0x7cb10c['shift']());}};_0x11df59(++_0x2fcc3a);}(_0x38d3,0xef));var _0x338d=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x38d3[_0x3899d1];return _0xeb4a7d;};'use strict';var multer=require(_0x338d('0x0'));var util=require(_0x338d('0x1'));var path=require(_0x338d('0x2'));var timeout=require(_0x338d('0x3'));var express=require(_0x338d('0x4'));var router=express['Router']();var fs_extra=require(_0x338d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x338d('0x6'));var config=require(_0x338d('0x7'));var controller=require(_0x338d('0x8'));router[_0x338d('0x9')]('/',auth['isAuthenticated'](),controller[_0x338d('0xa')]);router[_0x338d('0x9')](_0x338d('0xb'),auth['isAuthenticated'](),controller[_0x338d('0xc')]);router['post']('/',auth[_0x338d('0xd')](),controller[_0x338d('0xe')]);router[_0x338d('0xf')](_0x338d('0xb'),auth[_0x338d('0xd')](),controller[_0x338d('0x10')]);router['delete'](_0x338d('0xb'),auth[_0x338d('0xd')](),controller[_0x338d('0x11')]);module['exports']=router; \ No newline at end of file +var _0x84c9=['./whatsappApplication.controller','get','isAuthenticated','index','/:id','post','create','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../config/environment'];(function(_0x340e1b,_0x2daf5f){var _0x28c8b3=function(_0x50089e){while(--_0x50089e){_0x340e1b['push'](_0x340e1b['shift']());}};_0x28c8b3(++_0x2daf5f);}(_0x84c9,0x1c5));var _0x984c=function(_0x5dc8c0,_0x223f5a){_0x5dc8c0=_0x5dc8c0-0x0;var _0x26f78e=_0x84c9[_0x5dc8c0];return _0x26f78e;};'use strict';var multer=require('multer');var util=require(_0x984c('0x0'));var path=require(_0x984c('0x1'));var timeout=require(_0x984c('0x2'));var express=require('express');var router=express[_0x984c('0x3')]();var fs_extra=require(_0x984c('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x984c('0x5'));var controller=require(_0x984c('0x6'));router[_0x984c('0x7')]('/',auth[_0x984c('0x8')](),controller[_0x984c('0x9')]);router['get'](_0x984c('0xa'),auth[_0x984c('0x8')](),controller['show']);router[_0x984c('0xb')]('/',auth[_0x984c('0x8')](),controller[_0x984c('0xc')]);router['put'](_0x984c('0xa'),auth[_0x984c('0x8')](),controller[_0x984c('0xd')]);router[_0x984c('0xe')]('/:id',auth[_0x984c('0x8')](),controller[_0x984c('0xf')]);module[_0x984c('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 657aebf..7dcdcce 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 _0xc4b7=['sequelize','exports','INTEGER','noop','TEXT','STRING','*,*,*,*'];(function(_0x1dfef9,_0x38e3d5){var _0x47326c=function(_0x1022dd){while(--_0x1022dd){_0x1dfef9['push'](_0x1dfef9['shift']());}};_0x47326c(++_0x38e3d5);}(_0xc4b7,0x10a));var _0x7c4b=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0xc4b7[_0x1b6186];return _0x186121;};'use strict';var Sequelize=require(_0x7c4b('0x0'));module[_0x7c4b('0x1')]={'priority':{'type':Sequelize[_0x7c4b('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7c4b('0x3')},'appdata':{'type':Sequelize[_0x7c4b('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x7c4b('0x5')],'defaultValue':_0x7c4b('0x6')}}; \ No newline at end of file +var _0x8897=['sequelize','exports','STRING','*,*,*,*'];(function(_0x48bcef,_0x257e9f){var _0x3ad72e=function(_0x4f35b8){while(--_0x4f35b8){_0x48bcef['push'](_0x48bcef['shift']());}};_0x3ad72e(++_0x257e9f);}(_0x8897,0x70));var _0x7889=function(_0x2cc280,_0x4680f0){_0x2cc280=_0x2cc280-0x0;var _0x2f365d=_0x8897[_0x2cc280];return _0x2f365d;};'use strict';var Sequelize=require(_0x7889('0x0'));module[_0x7889('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x7889('0x2')],'defaultValue':_0x7889('0x3')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 08101a7..465d59c 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 _0x10ad=['filters','intersection','attributes','fields','length','model','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','save','update','then','destroy','end','error','stack','name','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','query','keys'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x10ad,0xf4));var _0xd10a=function(_0x5d8086,_0x4f3f72){_0x5d8086=_0x5d8086-0x0;var _0x55857f=_0x10ad[_0x5d8086];return _0x55857f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd10a('0x0'));var rp=require('request-promise');var moment=require(_0xd10a('0x1'));var BPromise=require(_0xd10a('0x2'));var Mustache=require(_0xd10a('0x3'));var util=require(_0xd10a('0x4'));var path=require('path');var sox=require(_0xd10a('0x5'));var csv=require(_0xd10a('0x6'));var ejs=require(_0xd10a('0x7'));var fs=require('fs');var fs_extra=require(_0xd10a('0x8'));var _=require(_0xd10a('0x9'));var squel=require(_0xd10a('0xa'));var crypto=require(_0xd10a('0xb'));var jsforce=require(_0xd10a('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd10a('0xd'));var Papa=require('papaparse');var Redis=require(_0xd10a('0xe'));var authService=require(_0xd10a('0xf'));var qs=require(_0xd10a('0x10'));var as=require(_0xd10a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd10a('0x12'))(_0xd10a('0x13'));var utils=require(_0xd10a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xd10a('0x15'));var db=require(_0xd10a('0x16'))['db'];function respondWithStatusCode(_0x45441a,_0x42b94d){_0x42b94d=_0x42b94d||0xcc;return function(_0x2142be){if(_0x2142be){return _0x45441a[_0xd10a('0x17')](_0x42b94d);}return _0x45441a['status'](_0x42b94d)['end']();};}function respondWithResult(_0x289066,_0x388c6f){_0x388c6f=_0x388c6f||0xc8;return function(_0x30f838){if(_0x30f838){return _0x289066[_0xd10a('0x18')](_0x388c6f)['json'](_0x30f838);}};}function respondWithFilteredResult(_0x50403e,_0x1c04a7){return function(_0x17fdd7){if(_0x17fdd7){var _0x143557=typeof _0x1c04a7[_0xd10a('0x19')]===_0xd10a('0x1a')&&typeof _0x1c04a7[_0xd10a('0x1b')]===_0xd10a('0x1a');var _0x1ec13f=_0x17fdd7[_0xd10a('0x1c')];var _0x48a07b=_0x143557?0x0:_0x1c04a7['offset'];var _0x40dd9f=_0x143557?_0x17fdd7[_0xd10a('0x1c')]:_0x1c04a7['offset']+_0x1c04a7['limit'];var _0x53ca7c;if(_0x40dd9f>=_0x1ec13f){_0x40dd9f=_0x1ec13f;_0x53ca7c=0xc8;}else{_0x53ca7c=0xce;}_0x50403e[_0xd10a('0x18')](_0x53ca7c);return _0x50403e[_0xd10a('0x1d')]('Content-Range',_0x48a07b+'-'+_0x40dd9f+'/'+_0x1ec13f)[_0xd10a('0x1e')](_0x17fdd7);}return null;};}function patchUpdates(_0x449c8c){return function(_0x48af70){try{jsonpatch['apply'](_0x48af70,_0x449c8c,!![]);}catch(_0x3ff3f0){return BPromise['reject'](_0x3ff3f0);}return _0x48af70[_0xd10a('0x1f')]();};}function saveUpdates(_0x35e066,_0x3b20e6){return function(_0x44d295){if(_0x44d295){return _0x44d295[_0xd10a('0x20')](_0x35e066)[_0xd10a('0x21')](function(_0x5dc935){return _0x5dc935;});}return null;};}function removeEntity(_0x43095a,_0x13eefe){return function(_0x4782c6){if(_0x4782c6){return _0x4782c6[_0xd10a('0x22')]()[_0xd10a('0x21')](function(){_0x43095a[_0xd10a('0x18')](0xcc)[_0xd10a('0x23')]();});}};}function handleEntityNotFound(_0x3715fe,_0x50724d){return function(_0x497a38){if(!_0x497a38){_0x3715fe['sendStatus'](0x194);}return _0x497a38;};}function handleError(_0x2a87ff,_0xaf25b5){_0xaf25b5=_0xaf25b5||0x1f4;return function(_0x58f500){logger[_0xd10a('0x24')](_0x58f500[_0xd10a('0x25')]);if(_0x58f500[_0xd10a('0x26')]){delete _0x58f500[_0xd10a('0x26')];}_0x2a87ff[_0xd10a('0x18')](_0xaf25b5)['send'](_0x58f500);};}exports[_0xd10a('0x27')]=function(_0x198715,_0x11de73){var _0x3c5f47={},_0x41e582={},_0xfede68={'count':0x0,'rows':[]};var _0x23f0ff=_[_0xd10a('0x28')](db[_0xd10a('0x29')][_0xd10a('0x2a')],function(_0xa285ad){return{'name':_0xa285ad[_0xd10a('0x2b')],'type':_0xa285ad[_0xd10a('0x2c')][_0xd10a('0x2d')]};});_0x41e582['model']=_['map'](_0x23f0ff,_0xd10a('0x26'));_0x41e582[_0xd10a('0x2e')]=_[_0xd10a('0x2f')](_0x198715[_0xd10a('0x2e')]);_0x41e582[_0xd10a('0x30')]=_[_0xd10a('0x31')](_0x41e582['model'],_0x41e582[_0xd10a('0x2e')]);_0x3c5f47[_0xd10a('0x32')]=_['intersection'](_0x41e582['model'],qs[_0xd10a('0x33')](_0x198715[_0xd10a('0x2e')][_0xd10a('0x33')]));_0x3c5f47[_0xd10a('0x32')]=_0x3c5f47['attributes'][_0xd10a('0x34')]?_0x3c5f47['attributes']:_0x41e582[_0xd10a('0x35')];if(!_0x198715['query']['hasOwnProperty'](_0xd10a('0x36'))){_0x3c5f47[_0xd10a('0x1b')]=qs[_0xd10a('0x1b')](_0x198715['query'][_0xd10a('0x1b')]);_0x3c5f47['offset']=qs[_0xd10a('0x19')](_0x198715[_0xd10a('0x2e')][_0xd10a('0x19')]);}_0x3c5f47[_0xd10a('0x37')]=qs[_0xd10a('0x38')](_0x198715[_0xd10a('0x2e')][_0xd10a('0x38')]);_0x3c5f47['where']=qs[_0xd10a('0x30')](_[_0xd10a('0x39')](_0x198715[_0xd10a('0x2e')],_0x41e582[_0xd10a('0x30')]),_0x23f0ff);if(_0x198715['query'][_0xd10a('0x3a')]){_0x3c5f47[_0xd10a('0x3b')]=_[_0xd10a('0x3c')](_0x3c5f47['where'],{'$or':_['map'](_0x23f0ff,function(_0x42f0a2){if(_0x42f0a2[_0xd10a('0x2c')]!==_0xd10a('0x3d')){var _0x1100f0={};_0x1100f0[_0x42f0a2['name']]={'$like':'%'+_0x198715[_0xd10a('0x2e')]['filter']+'%'};return _0x1100f0;}})});}_0x3c5f47=_[_0xd10a('0x3c')]({},_0x3c5f47,_0x198715[_0xd10a('0x3e')]);var _0x46720a={'where':_0x3c5f47[_0xd10a('0x3b')]};return db[_0xd10a('0x29')][_0xd10a('0x1c')](_0x46720a)[_0xd10a('0x21')](function(_0x5c48aa){_0xfede68[_0xd10a('0x1c')]=_0x5c48aa;if(_0x198715['query']['includeAll']){_0x3c5f47[_0xd10a('0x3f')]=[{'all':!![]}];}return db[_0xd10a('0x29')][_0xd10a('0x40')](_0x3c5f47);})[_0xd10a('0x21')](function(_0x4c14a7){_0xfede68[_0xd10a('0x41')]=_0x4c14a7;return _0xfede68;})[_0xd10a('0x21')](respondWithFilteredResult(_0x11de73,_0x3c5f47))[_0xd10a('0x42')](handleError(_0x11de73,null));};exports[_0xd10a('0x43')]=function(_0x2af23e,_0x3c74e1){var _0x39e48b={'raw':!![],'where':{'id':_0x2af23e[_0xd10a('0x44')]['id']}},_0x32505c={};_0x32505c[_0xd10a('0x35')]=_[_0xd10a('0x2f')](db['WhatsappApplication'][_0xd10a('0x2a')]);_0x32505c[_0xd10a('0x2e')]=_[_0xd10a('0x2f')](_0x2af23e[_0xd10a('0x2e')]);_0x32505c[_0xd10a('0x30')]=_[_0xd10a('0x31')](_0x32505c[_0xd10a('0x35')],_0x32505c['query']);_0x39e48b[_0xd10a('0x32')]=_[_0xd10a('0x31')](_0x32505c[_0xd10a('0x35')],qs[_0xd10a('0x33')](_0x2af23e[_0xd10a('0x2e')]['fields']));_0x39e48b[_0xd10a('0x32')]=_0x39e48b[_0xd10a('0x32')][_0xd10a('0x34')]?_0x39e48b[_0xd10a('0x32')]:_0x32505c[_0xd10a('0x35')];if(_0x2af23e[_0xd10a('0x2e')][_0xd10a('0x45')]){_0x39e48b[_0xd10a('0x3f')]=[{'all':!![]}];}_0x39e48b=_[_0xd10a('0x3c')]({},_0x39e48b,_0x2af23e[_0xd10a('0x3e')]);return db[_0xd10a('0x29')][_0xd10a('0x46')](_0x39e48b)[_0xd10a('0x21')](handleEntityNotFound(_0x3c74e1,null))[_0xd10a('0x21')](respondWithResult(_0x3c74e1,null))[_0xd10a('0x42')](handleError(_0x3c74e1,null));};exports['create']=function(_0x2aa46a,_0xe55621){return db[_0xd10a('0x29')][_0xd10a('0x47')](_0x2aa46a[_0xd10a('0x48')],{})['then'](respondWithResult(_0xe55621,0xc9))[_0xd10a('0x42')](handleError(_0xe55621,null));};exports[_0xd10a('0x20')]=function(_0x429494,_0x807b4a){if(_0x429494[_0xd10a('0x48')]['id']){delete _0x429494[_0xd10a('0x48')]['id'];}return db[_0xd10a('0x29')][_0xd10a('0x46')]({'where':{'id':_0x429494[_0xd10a('0x44')]['id']}})[_0xd10a('0x21')](handleEntityNotFound(_0x807b4a,null))[_0xd10a('0x21')](saveUpdates(_0x429494[_0xd10a('0x48')],null))[_0xd10a('0x21')](respondWithResult(_0x807b4a,null))[_0xd10a('0x42')](handleError(_0x807b4a,null));};exports[_0xd10a('0x22')]=function(_0x1abc93,_0x2c5d67){return db[_0xd10a('0x29')]['find']({'where':{'id':_0x1abc93['params']['id']}})['then'](handleEntityNotFound(_0x2c5d67,null))[_0xd10a('0x21')](removeEntity(_0x2c5d67,null))[_0xd10a('0x42')](handleError(_0x2c5d67,null));}; \ No newline at end of file +var _0x508a=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','sendStatus','stack','name','index','WhatsappApplication','rawAttributes','type','key','query','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','then','include','findAll','rows','catch','show','keys','includeAll','find','create','body','params','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x508a,0x1aa));var _0xa508=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x508a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xa508('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa508('0x1'));var jsonpatch=require(_0xa508('0x2'));var rp=require(_0xa508('0x3'));var moment=require(_0xa508('0x4'));var BPromise=require(_0xa508('0x5'));var Mustache=require('mustache');var util=require(_0xa508('0x6'));var path=require(_0xa508('0x7'));var sox=require(_0xa508('0x8'));var csv=require('to-csv');var ejs=require(_0xa508('0x9'));var fs=require('fs');var fs_extra=require(_0xa508('0xa'));var _=require(_0xa508('0xb'));var squel=require('squel');var crypto=require(_0xa508('0xc'));var jsforce=require(_0xa508('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa508('0xe'));var querystring=require(_0xa508('0xf'));var Papa=require('papaparse');var Redis=require(_0xa508('0x10'));var authService=require(_0xa508('0x11'));var qs=require(_0xa508('0x12'));var as=require(_0xa508('0x13'));var hardwareService=require(_0xa508('0x14'));var logger=require('../../config/logger')(_0xa508('0x15'));var utils=require(_0xa508('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa508('0x17'));var db=require(_0xa508('0x18'))['db'];function respondWithStatusCode(_0x2012d6,_0x5e60fd){_0x5e60fd=_0x5e60fd||0xcc;return function(_0xc0511c){if(_0xc0511c){return _0x2012d6['sendStatus'](_0x5e60fd);}return _0x2012d6[_0xa508('0x19')](_0x5e60fd)[_0xa508('0x1a')]();};}function respondWithResult(_0x3085b2,_0x16927e){_0x16927e=_0x16927e||0xc8;return function(_0x5cd0ce){if(_0x5cd0ce){return _0x3085b2[_0xa508('0x19')](_0x16927e)[_0xa508('0x1b')](_0x5cd0ce);}};}function respondWithFilteredResult(_0x102adb,_0xb8b8f5){return function(_0x5e2d7d){if(_0x5e2d7d){var _0x15b852=typeof _0xb8b8f5[_0xa508('0x1c')]===_0xa508('0x1d')&&typeof _0xb8b8f5[_0xa508('0x1e')]==='undefined';var _0x1a366f=_0x5e2d7d[_0xa508('0x1f')];var _0x5e29a8=_0x15b852?0x0:_0xb8b8f5['offset'];var _0x1984ae=_0x15b852?_0x5e2d7d[_0xa508('0x1f')]:_0xb8b8f5[_0xa508('0x1c')]+_0xb8b8f5[_0xa508('0x1e')];var _0x421874;if(_0x1984ae>=_0x1a366f){_0x1984ae=_0x1a366f;_0x421874=0xc8;}else{_0x421874=0xce;}_0x102adb[_0xa508('0x19')](_0x421874);return _0x102adb[_0xa508('0x20')](_0xa508('0x21'),_0x5e29a8+'-'+_0x1984ae+'/'+_0x1a366f)['json'](_0x5e2d7d);}return null;};}function patchUpdates(_0x26291a){return function(_0x2fd9be){try{jsonpatch[_0xa508('0x22')](_0x2fd9be,_0x26291a,!![]);}catch(_0x45b284){return BPromise[_0xa508('0x23')](_0x45b284);}return _0x2fd9be['save']();};}function saveUpdates(_0x274804,_0x5712ad){return function(_0xf4f3f7){if(_0xf4f3f7){return _0xf4f3f7[_0xa508('0x24')](_0x274804)['then'](function(_0x3859c9){return _0x3859c9;});}return null;};}function removeEntity(_0x83b79b,_0x14ca1c){return function(_0x306b3c){if(_0x306b3c){return _0x306b3c['destroy']()['then'](function(){_0x83b79b['status'](0xcc)[_0xa508('0x1a')]();});}};}function handleEntityNotFound(_0x2cda06,_0x46af7f){return function(_0x1cfadf){if(!_0x1cfadf){_0x2cda06[_0xa508('0x25')](0x194);}return _0x1cfadf;};}function handleError(_0x350581,_0x2400ee){_0x2400ee=_0x2400ee||0x1f4;return function(_0x4be5bf){logger['error'](_0x4be5bf[_0xa508('0x26')]);if(_0x4be5bf[_0xa508('0x27')]){delete _0x4be5bf['name'];}_0x350581[_0xa508('0x19')](_0x2400ee)['send'](_0x4be5bf);};}exports[_0xa508('0x28')]=function(_0x44616a,_0x528ae9){var _0x370518={},_0x2ca53f={},_0x24f2b2={'count':0x0,'rows':[]};var _0x39189d=_['map'](db[_0xa508('0x29')][_0xa508('0x2a')],function(_0x3eb26c){return{'name':_0x3eb26c['fieldName'],'type':_0x3eb26c[_0xa508('0x2b')][_0xa508('0x2c')]};});_0x2ca53f['model']=_['map'](_0x39189d,_0xa508('0x27'));_0x2ca53f['query']=_['keys'](_0x44616a[_0xa508('0x2d')]);_0x2ca53f['filters']=_['intersection'](_0x2ca53f[_0xa508('0x2e')],_0x2ca53f[_0xa508('0x2d')]);_0x370518['attributes']=_[_0xa508('0x2f')](_0x2ca53f[_0xa508('0x2e')],qs[_0xa508('0x30')](_0x44616a['query']['fields']));_0x370518[_0xa508('0x31')]=_0x370518[_0xa508('0x31')][_0xa508('0x32')]?_0x370518[_0xa508('0x31')]:_0x2ca53f[_0xa508('0x2e')];if(!_0x44616a[_0xa508('0x2d')][_0xa508('0x33')](_0xa508('0x34'))){_0x370518[_0xa508('0x1e')]=qs[_0xa508('0x1e')](_0x44616a[_0xa508('0x2d')]['limit']);_0x370518[_0xa508('0x1c')]=qs[_0xa508('0x1c')](_0x44616a[_0xa508('0x2d')][_0xa508('0x1c')]);}_0x370518['order']=qs[_0xa508('0x35')](_0x44616a[_0xa508('0x2d')][_0xa508('0x35')]);_0x370518['where']=qs[_0xa508('0x36')](_[_0xa508('0x37')](_0x44616a[_0xa508('0x2d')],_0x2ca53f['filters']),_0x39189d);if(_0x44616a['query'][_0xa508('0x38')]){_0x370518[_0xa508('0x39')]=_[_0xa508('0x3a')](_0x370518[_0xa508('0x39')],{'$or':_['map'](_0x39189d,function(_0x2b8e1d){if(_0x2b8e1d[_0xa508('0x2b')]!==_0xa508('0x3b')){var _0x44f78={};_0x44f78[_0x2b8e1d[_0xa508('0x27')]]={'$like':'%'+_0x44616a[_0xa508('0x2d')][_0xa508('0x38')]+'%'};return _0x44f78;}})});}_0x370518=_[_0xa508('0x3a')]({},_0x370518,_0x44616a[_0xa508('0x3c')]);var _0x41c6f8={'where':_0x370518[_0xa508('0x39')]};return db[_0xa508('0x29')]['count'](_0x41c6f8)[_0xa508('0x3d')](function(_0x2f2379){_0x24f2b2[_0xa508('0x1f')]=_0x2f2379;if(_0x44616a[_0xa508('0x2d')]['includeAll']){_0x370518[_0xa508('0x3e')]=[{'all':!![]}];}return db[_0xa508('0x29')][_0xa508('0x3f')](_0x370518);})[_0xa508('0x3d')](function(_0x1aa7d8){_0x24f2b2[_0xa508('0x40')]=_0x1aa7d8;return _0x24f2b2;})[_0xa508('0x3d')](respondWithFilteredResult(_0x528ae9,_0x370518))[_0xa508('0x41')](handleError(_0x528ae9,null));};exports[_0xa508('0x42')]=function(_0xfbba67,_0x159351){var _0x24c3ec={'raw':!![],'where':{'id':_0xfbba67['params']['id']}},_0x7687ed={};_0x7687ed[_0xa508('0x2e')]=_['keys'](db[_0xa508('0x29')][_0xa508('0x2a')]);_0x7687ed[_0xa508('0x2d')]=_[_0xa508('0x43')](_0xfbba67[_0xa508('0x2d')]);_0x7687ed[_0xa508('0x36')]=_[_0xa508('0x2f')](_0x7687ed[_0xa508('0x2e')],_0x7687ed['query']);_0x24c3ec[_0xa508('0x31')]=_[_0xa508('0x2f')](_0x7687ed[_0xa508('0x2e')],qs[_0xa508('0x30')](_0xfbba67[_0xa508('0x2d')][_0xa508('0x30')]));_0x24c3ec[_0xa508('0x31')]=_0x24c3ec[_0xa508('0x31')][_0xa508('0x32')]?_0x24c3ec[_0xa508('0x31')]:_0x7687ed[_0xa508('0x2e')];if(_0xfbba67[_0xa508('0x2d')][_0xa508('0x44')]){_0x24c3ec[_0xa508('0x3e')]=[{'all':!![]}];}_0x24c3ec=_[_0xa508('0x3a')]({},_0x24c3ec,_0xfbba67[_0xa508('0x3c')]);return db[_0xa508('0x29')][_0xa508('0x45')](_0x24c3ec)[_0xa508('0x3d')](handleEntityNotFound(_0x159351,null))[_0xa508('0x3d')](respondWithResult(_0x159351,null))[_0xa508('0x41')](handleError(_0x159351,null));};exports[_0xa508('0x46')]=function(_0x259fc5,_0x2c64ff){return db[_0xa508('0x29')][_0xa508('0x46')](_0x259fc5['body'],{})[_0xa508('0x3d')](respondWithResult(_0x2c64ff,0xc9))[_0xa508('0x41')](handleError(_0x2c64ff,null));};exports[_0xa508('0x24')]=function(_0x11b73c,_0x390c1f){if(_0x11b73c['body']['id']){delete _0x11b73c[_0xa508('0x47')]['id'];}return db[_0xa508('0x29')][_0xa508('0x45')]({'where':{'id':_0x11b73c[_0xa508('0x48')]['id']}})[_0xa508('0x3d')](handleEntityNotFound(_0x390c1f,null))[_0xa508('0x3d')](saveUpdates(_0x11b73c[_0xa508('0x47')],null))['then'](respondWithResult(_0x390c1f,null))[_0xa508('0x41')](handleError(_0x390c1f,null));};exports[_0xa508('0x49')]=function(_0x83bc4f,_0x58fee8){return db[_0xa508('0x29')][_0xa508('0x45')]({'where':{'id':_0x83bc4f[_0xa508('0x48')]['id']}})[_0xa508('0x3d')](handleEntityNotFound(_0x58fee8,null))[_0xa508('0x3d')](removeEntity(_0x58fee8,null))[_0xa508('0x41')](handleError(_0x58fee8,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 326d133..3e9da09 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 _0x6658=['whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappApplication.attributes','define','WhatsappApplication'];(function(_0xabd6a,_0x32d0ff){var _0x59694f=function(_0x1d1843){while(--_0x1d1843){_0xabd6a['push'](_0xabd6a['shift']());}};_0x59694f(++_0x32d0ff);}(_0x6658,0x198));var _0x8665=function(_0x5d50cc,_0x3ef3af){_0x5d50cc=_0x5d50cc-0x0;var _0x588d5b=_0x6658[_0x5d50cc];return _0x588d5b;};'use strict';var _=require(_0x8665('0x0'));var util=require(_0x8665('0x1'));var logger=require(_0x8665('0x2'))(_0x8665('0x3'));var moment=require(_0x8665('0x4'));var BPromise=require(_0x8665('0x5'));var rp=require(_0x8665('0x6'));var fs=require('fs');var path=require(_0x8665('0x7'));var rimraf=require('rimraf');var config=require(_0x8665('0x8'));var attributes=require(_0x8665('0x9'));module['exports']=function(_0x562829,_0x203780){return _0x562829[_0x8665('0xa')](_0x8665('0xb'),attributes,{'tableName':_0x8665('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8665('0xd'),'collate':_0x8665('0xe')});}; \ No newline at end of file +var _0x5089=['util','api','moment','bluebird','request-promise','path','../../config/environment','exports','WhatsappApplication','whatsapp_applications','utf8mb4_unicode_ci','lodash'];(function(_0x3d7b19,_0x32af0f){var _0x37c6fc=function(_0x11a147){while(--_0x11a147){_0x3d7b19['push'](_0x3d7b19['shift']());}};_0x37c6fc(++_0x32af0f);}(_0x5089,0x1bb));var _0x9508=function(_0x162780,_0x47f2e2){_0x162780=_0x162780-0x0;var _0x1ea2dc=_0x5089[_0x162780];return _0x1ea2dc;};'use strict';var _=require(_0x9508('0x0'));var util=require(_0x9508('0x1'));var logger=require('../../config/logger')(_0x9508('0x2'));var moment=require(_0x9508('0x3'));var BPromise=require(_0x9508('0x4'));var rp=require(_0x9508('0x5'));var fs=require('fs');var path=require(_0x9508('0x6'));var rimraf=require('rimraf');var config=require(_0x9508('0x7'));var attributes=require('./whatsappApplication.attributes');module[_0x9508('0x8')]=function(_0x4538dd,_0x257318){return _0x4538dd['define'](_0x9508('0x9'),attributes,{'tableName':_0x9508('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x9508('0xb')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index c10a68e..1189894 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 _0x4bc3=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x565eda,_0x32c0d0){var _0x45453f=function(_0x5c88a5){while(--_0x5c88a5){_0x565eda['push'](_0x565eda['shift']());}};_0x45453f(++_0x32c0d0);}(_0x4bc3,0x16e));var _0x34bc=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x4bc3[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var moment=require('moment');var BPromise=require(_0x34bc('0x2'));var rs=require(_0x34bc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x34bc('0x4'))['db'];var utils=require(_0x34bc('0x5'));var logger=require(_0x34bc('0x6'))(_0x34bc('0x7'));var config=require(_0x34bc('0x8'));var jayson=require(_0x34bc('0x9'));var client=jayson[_0x34bc('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21451b,_0x50320d,_0x502087){return new BPromise(function(_0x18a01c,_0x474108){return client[_0x34bc('0xb')](_0x21451b,_0x502087)[_0x34bc('0xc')](function(_0x409105){logger[_0x34bc('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x50320d,'request\x20sent');logger[_0x34bc('0xe')](_0x34bc('0xf'),_0x50320d,_0x34bc('0x10'),JSON['stringify'](_0x409105));if(_0x409105[_0x34bc('0x11')]){if(_0x409105['error'][_0x34bc('0x12')]===0x1f4){logger[_0x34bc('0x11')](_0x34bc('0x13'),_0x50320d,_0x409105['error'][_0x34bc('0x14')]);return _0x474108(_0x409105['error'][_0x34bc('0x14')]);}logger[_0x34bc('0x11')](_0x34bc('0x13'),_0x50320d,_0x409105['error']['message']);return _0x18a01c(_0x409105[_0x34bc('0x11')]['message']);}else{logger[_0x34bc('0xd')](_0x34bc('0x13'),_0x50320d,_0x34bc('0x10'));_0x18a01c(_0x409105[_0x34bc('0x15')][_0x34bc('0x14')]);}})[_0x34bc('0x16')](function(_0x5e132d){logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x50320d,_0x5e132d);_0x474108(_0x5e132d);});});} \ No newline at end of file +var _0x668b=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x25333f,_0x261098){var _0x275c8f=function(_0x4f727f){while(--_0x4f727f){_0x25333f['push'](_0x25333f['shift']());}};_0x275c8f(++_0x261098);}(_0x668b,0x140));var _0xb668=function(_0x30faec,_0x18940b){_0x30faec=_0x30faec-0x0;var _0x29484f=_0x668b[_0x30faec];return _0x29484f;};'use strict';var _=require(_0xb668('0x0'));var util=require(_0xb668('0x1'));var moment=require('moment');var BPromise=require(_0xb668('0x2'));var rs=require(_0xb668('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb668('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb668('0x5'))(_0xb668('0x6'));var config=require(_0xb668('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb668('0x8')][_0xb668('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3be92e,_0x2778e9,_0x20b749){return new BPromise(function(_0x3f01bc,_0x517fc5){return client[_0xb668('0xa')](_0x3be92e,_0x20b749)[_0xb668('0xb')](function(_0x128cf5){logger[_0xb668('0xc')](_0xb668('0xd'),_0x2778e9,_0xb668('0xe'));logger[_0xb668('0xf')](_0xb668('0x10'),_0x2778e9,'request\x20sent',JSON[_0xb668('0x11')](_0x128cf5));if(_0x128cf5[_0xb668('0x12')]){if(_0x128cf5[_0xb668('0x12')][_0xb668('0x13')]===0x1f4){logger[_0xb668('0x12')](_0xb668('0xd'),_0x2778e9,_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);return _0x517fc5(_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);}logger[_0xb668('0x12')](_0xb668('0xd'),_0x2778e9,_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);return _0x3f01bc(_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);}else{logger[_0xb668('0xc')](_0xb668('0xd'),_0x2778e9,_0xb668('0xe'));_0x3f01bc(_0x128cf5[_0xb668('0x15')][_0xb668('0x14')]);}})[_0xb668('0x16')](function(_0x4ab137){logger[_0xb668('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x2778e9,_0x4ab137);_0x517fc5(_0x4ab137);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 3d27af2..bc8fdbb 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 _0xce68=['Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','isAuthenticated','index','describe','get','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','whatsappinteraction:addtags','addTags','put','whatsapp','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','multer','path','connect-timeout','express'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xce68,0x10c));var _0x8ce6=function(_0x42b6cb,_0x31621d){_0x42b6cb=_0x42b6cb-0x0;var _0x76c634=_0xce68[_0x42b6cb];return _0x76c634;};'use strict';var multer=require(_0x8ce6('0x0'));var util=require('util');var path=require(_0x8ce6('0x1'));var timeout=require(_0x8ce6('0x2'));var express=require(_0x8ce6('0x3'));var router=express[_0x8ce6('0x4')]();var fs_extra=require(_0x8ce6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8ce6('0x6'));var config=require(_0x8ce6('0x7'));var controller=require(_0x8ce6('0x8'));router['get']('/',auth[_0x8ce6('0x9')](),controller[_0x8ce6('0xa')]);router['get']('/describe',auth[_0x8ce6('0x9')](),controller[_0x8ce6('0xb')]);router[_0x8ce6('0xc')](_0x8ce6('0xd'),auth['isAuthenticated'](),controller[_0x8ce6('0xe')]);router[_0x8ce6('0xc')](_0x8ce6('0xf'),auth[_0x8ce6('0x9')](),controller[_0x8ce6('0x10')]);router[_0x8ce6('0xc')](_0x8ce6('0x11'),auth[_0x8ce6('0x9')](),controller[_0x8ce6('0x12')]);router[_0x8ce6('0x13')]('/',auth[_0x8ce6('0x9')](),controller[_0x8ce6('0x14')]);router[_0x8ce6('0x13')](_0x8ce6('0xf'),auth[_0x8ce6('0x9')](),controller[_0x8ce6('0x15')]);router[_0x8ce6('0x13')](_0x8ce6('0x16'),auth['isAuthenticated'](),interaction[_0x8ce6('0x17')]('whatsapp',_0x8ce6('0x18')),controller[_0x8ce6('0x19')]);router[_0x8ce6('0x1a')](_0x8ce6('0xd'),auth[_0x8ce6('0x9')](),interaction[_0x8ce6('0x17')](_0x8ce6('0x1b'),_0x8ce6('0x1c')),controller[_0x8ce6('0x1d')]);router[_0x8ce6('0x1e')]('/:id',auth[_0x8ce6('0x9')](),interaction['tracked'](_0x8ce6('0x1b'),_0x8ce6('0x1f')),controller[_0x8ce6('0x20')]);router['delete']('/:id/tags',auth[_0x8ce6('0x9')](),controller[_0x8ce6('0x21')]);module['exports']=router; \ No newline at end of file +var _0x8b8e=['whatsappinteraction:destroy','removeTags','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','whatsappinteraction:addtags','put','/:id','whatsapp','whatsappinteraction:update','update','delete'];(function(_0x3a1287,_0xb1f80){var _0x3d6a2d=function(_0x2f26e6){while(--_0x2f26e6){_0x3a1287['push'](_0x3a1287['shift']());}};_0x3d6a2d(++_0xb1f80);}(_0x8b8e,0x108));var _0xe8b8=function(_0x3165c5,_0x569d7a){_0x3165c5=_0x3165c5-0x0;var _0x57808c=_0x8b8e[_0x3165c5];return _0x57808c;};'use strict';var multer=require(_0xe8b8('0x0'));var util=require('util');var path=require(_0xe8b8('0x1'));var timeout=require('connect-timeout');var express=require(_0xe8b8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe8b8('0x3'));var interaction=require(_0xe8b8('0x4'));var config=require(_0xe8b8('0x5'));var controller=require(_0xe8b8('0x6'));router[_0xe8b8('0x7')]('/',auth[_0xe8b8('0x8')](),controller[_0xe8b8('0x9')]);router[_0xe8b8('0x7')](_0xe8b8('0xa'),auth[_0xe8b8('0x8')](),controller['describe']);router[_0xe8b8('0x7')]('/:id',auth[_0xe8b8('0x8')](),controller['show']);router['get'](_0xe8b8('0xb'),auth[_0xe8b8('0x8')](),controller['getMessages']);router['get'](_0xe8b8('0xc'),auth[_0xe8b8('0x8')](),controller[_0xe8b8('0xd')]);router[_0xe8b8('0xe')]('/',auth[_0xe8b8('0x8')](),controller[_0xe8b8('0xf')]);router[_0xe8b8('0xe')](_0xe8b8('0xb'),auth[_0xe8b8('0x8')](),controller[_0xe8b8('0x10')]);router[_0xe8b8('0xe')](_0xe8b8('0x11'),auth[_0xe8b8('0x8')](),interaction[_0xe8b8('0x12')]('whatsapp',_0xe8b8('0x13')),controller['addTags']);router[_0xe8b8('0x14')](_0xe8b8('0x15'),auth[_0xe8b8('0x8')](),interaction[_0xe8b8('0x12')](_0xe8b8('0x16'),_0xe8b8('0x17')),controller[_0xe8b8('0x18')]);router[_0xe8b8('0x19')](_0xe8b8('0x15'),auth[_0xe8b8('0x8')](),interaction['tracked'](_0xe8b8('0x16'),_0xe8b8('0x1a')),controller['destroy']);router[_0xe8b8('0x19')](_0xe8b8('0x11'),auth[_0xe8b8('0x8')](),controller[_0xe8b8('0x1b')]);module[_0xe8b8('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 645e1d7..6aff2b0 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 _0x689b=['BOOLEAN','INTEGER','sequelize','exports','STRING','DATE','ENUM','out'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x689b,0x142));var _0xb689=function(_0x22229e,_0x5b047b){_0x22229e=_0x22229e-0x0;var _0x3a10c6=_0x689b[_0x22229e];return _0x3a10c6;};'use strict';var Sequelize=require(_0xb689('0x0'));var moment=require('moment');module[_0xb689('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xb689('0x2')]},'secondDisposition':{'type':Sequelize[_0xb689('0x2')]},'thirdDisposition':{'type':Sequelize[_0xb689('0x2')]},'note':{'type':Sequelize[_0xb689('0x2')]},'phone':{'type':Sequelize[_0xb689('0x2')]},'read1stAt':{'type':Sequelize[_0xb689('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xb689('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb689('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xb689('0x4')]('in',_0xb689('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xb689('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xb689('0x7')]}}; \ No newline at end of file +var _0x1a37=['DATE','STRING','ENUM','out','sequelize','moment','exports','BOOLEAN'];(function(_0x54a9e3,_0x4a3813){var _0x247cce=function(_0x50aa49){while(--_0x50aa49){_0x54a9e3['push'](_0x54a9e3['shift']());}};_0x247cce(++_0x4a3813);}(_0x1a37,0xb4));var _0x71a3=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0x1a37[_0xa8883];return _0x479426;};'use strict';var Sequelize=require(_0x71a3('0x0'));var moment=require(_0x71a3('0x1'));module[_0x71a3('0x2')]={'closed':{'type':Sequelize[_0x71a3('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x71a3('0x4')]},'disposition':{'type':Sequelize[_0x71a3('0x5')]},'secondDisposition':{'type':Sequelize[_0x71a3('0x5')]},'thirdDisposition':{'type':Sequelize[_0x71a3('0x5')]},'note':{'type':Sequelize[_0x71a3('0x5')]},'phone':{'type':Sequelize[_0x71a3('0x5')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x71a3('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x71a3('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x71a3('0x6')]('in',_0x71a3('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x71a3('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index ad6bcb9..8e748c4 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 _0x541e=['split','format','YYYY-MM-DD\x20HH:mm:ss','include','rows','setTags','omit','Tag','color','emit','whatsappInteractionTags:save','removeTags','download','unix','toString','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','push','User','CmContact','Contact','firstName','Attachment','Messages','createdAt','direction','Account','Owner','get','mkdirSync','fullname','N.A.','closed','closedAt','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','lastName','secret','read','value','renderFile','views','downloadInteraction.ejs','transcript-','Whatsapp','createPdfFromHTML','rimraf','zip-dir','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','end','json','limit','undefined','count','offset','status','set','update','sendStatus','error','name','index','map','WhatsappInteraction','rawAttributes','type','key','getOptions','findAll','whatsapp','query','user','then','catch','params','model','keys','intersection','attributes','fields','includeAll','options','create','body','find','destroy','describe','addMessage','WhatsappMessage','ids','findOne','filters','nolimit','order','sort','pick','where','WhatsappInteractionId','filter','merge','$gte'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x541e,0x1b5));var _0xe541=function(_0x47bcae,_0x43b7b6){_0x47bcae=_0x47bcae-0x0;var _0x59b299=_0x541e[_0x47bcae];return _0x59b299;};'use strict';var rimraf=require(_0xe541('0x0'));var zipdir=require(_0xe541('0x1'));var moment=require('moment');var BPromise=require(_0xe541('0x2'));var util=require(_0xe541('0x3'));var path=require(_0xe541('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe541('0x5'));var Redis=require(_0xe541('0x6'));var interaction=require(_0xe541('0x7'));var qs=require(_0xe541('0x8'));var pdf=require(_0xe541('0x9'));var logger=require(_0xe541('0xa'))(_0xe541('0xb'));var config=require(_0xe541('0xc'));var db=require(_0xe541('0xd'))['db'];config[_0xe541('0xe')]=_[_0xe541('0xf')](config[_0xe541('0xe')],{'host':_0xe541('0x10'),'port':0x18eb});var socket=require(_0xe541('0x11'))(new Redis(config[_0xe541('0xe')]));require(_0xe541('0x12'))['register'](socket);function respondWithStatusCode(_0x427d2e,_0x39a428){_0x39a428=_0x39a428||0xcc;return function(_0x18a9eb){if(_0x18a9eb){return _0x427d2e['sendStatus'](_0x39a428);}return _0x427d2e['status'](_0x39a428)[_0xe541('0x13')]();};}function respondWithResult(_0x2cbac6,_0x44d284){_0x44d284=_0x44d284||0xc8;return function(_0x1ea83c){if(_0x1ea83c){return _0x2cbac6['status'](_0x44d284)[_0xe541('0x14')](_0x1ea83c);}};}function respondWithFilteredResult(_0x3cc452,_0x52e5aa){return function(_0x5c6e33){if(_0x5c6e33){var _0x105b45=typeof _0x52e5aa['offset']==='undefined'&&typeof _0x52e5aa[_0xe541('0x15')]===_0xe541('0x16');var _0x598960=_0x5c6e33[_0xe541('0x17')];var _0x418691=_0x105b45?0x0:_0x52e5aa[_0xe541('0x18')];var _0x2df97a=_0x105b45?_0x5c6e33[_0xe541('0x17')]:_0x52e5aa[_0xe541('0x18')]+_0x52e5aa[_0xe541('0x15')];var _0x232451;if(_0x2df97a>=_0x598960){_0x2df97a=_0x598960;_0x232451=0xc8;}else{_0x232451=0xce;}_0x3cc452[_0xe541('0x19')](_0x232451);return _0x3cc452[_0xe541('0x1a')]('Content-Range',_0x418691+'-'+_0x2df97a+'/'+_0x598960)[_0xe541('0x14')](_0x5c6e33);}return null;};}function saveUpdates(_0x4d304b){return function(_0x26d61c){if(_0x26d61c){return _0x26d61c[_0xe541('0x1b')](_0x4d304b)['then'](function(_0x16d6b3){return _0x16d6b3;});}return null;};}function removeEntity(_0xb7f5ad){return function(_0x3ac8c8){if(_0x3ac8c8){return _0x3ac8c8['destroy']()['then'](function(){_0xb7f5ad[_0xe541('0x19')](0xcc)[_0xe541('0x13')]();});}};}function handleEntityNotFound(_0x69f430){return function(_0x214c32){if(!_0x214c32){_0x69f430[_0xe541('0x1c')](0x194);}return _0x214c32;};}function handleError(_0x35efd9,_0x7bacdf){_0x7bacdf=_0x7bacdf||0x1f4;return function(_0x32cd59){logger[_0xe541('0x1d')](_0x32cd59['stack']);if(_0x32cd59[_0xe541('0x1e')]){delete _0x32cd59[_0xe541('0x1e')];}_0x35efd9[_0xe541('0x19')](_0x7bacdf)['send'](_0x32cd59);};}exports[_0xe541('0x1f')]=function(_0x364620,_0x463daa){var _0x1f7941={};var _0x4e3a7b=_[_0xe541('0x20')](db[_0xe541('0x21')][_0xe541('0x22')],function(_0x3a4553){return{'name':_0x3a4553['fieldName'],'type':_0x3a4553[_0xe541('0x23')][_0xe541('0x24')]};});_0x1f7941=qs[_0xe541('0x25')](_0x4e3a7b,_0x364620);return interaction[_0xe541('0x26')](_0xe541('0x27'),_0x364620[_0xe541('0x28')],_0x364620[_0xe541('0x29')],_0x1f7941,_0x4e3a7b)[_0xe541('0x2a')](respondWithFilteredResult(_0x463daa,_0x1f7941))[_0xe541('0x2b')](handleError(_0x463daa,null));};exports['show']=function(_0x3fd332,_0x5c1ebe){var _0x1196c9={'raw':![],'where':{'id':_0x3fd332[_0xe541('0x2c')]['id']}},_0x262c3f={};_0x262c3f[_0xe541('0x2d')]=_['keys'](db[_0xe541('0x21')][_0xe541('0x22')]);_0x262c3f[_0xe541('0x28')]=_[_0xe541('0x2e')](_0x3fd332[_0xe541('0x28')]);_0x262c3f['filters']=_[_0xe541('0x2f')](_0x262c3f['model'],_0x262c3f[_0xe541('0x28')]);_0x1196c9[_0xe541('0x30')]=_[_0xe541('0x2f')](_0x262c3f[_0xe541('0x2d')],qs[_0xe541('0x31')](_0x3fd332['query'][_0xe541('0x31')]));_0x1196c9[_0xe541('0x30')]=_0x1196c9['attributes']['length']?_0x1196c9[_0xe541('0x30')]:_0x262c3f['model'];if(_0x3fd332['query'][_0xe541('0x32')]){_0x1196c9['include']=[{'all':!![]}];}_0x1196c9=_['merge']({},_0x1196c9,_0x3fd332[_0xe541('0x33')]);return db[_0xe541('0x21')]['find'](_0x1196c9)[_0xe541('0x2a')](handleEntityNotFound(_0x5c1ebe,null))[_0xe541('0x2a')](respondWithResult(_0x5c1ebe,null))[_0xe541('0x2b')](handleError(_0x5c1ebe,null));};exports[_0xe541('0x34')]=function(_0x5903d3,_0x14197d){return db['WhatsappInteraction'][_0xe541('0x34')](_0x5903d3['body'],{})[_0xe541('0x2a')](respondWithResult(_0x14197d,0xc9))[_0xe541('0x2b')](handleError(_0x14197d,null));};exports[_0xe541('0x1b')]=function(_0x159f6a,_0x1038c8){if(_0x159f6a['body']['id']){delete _0x159f6a[_0xe541('0x35')]['id'];}return db['WhatsappInteraction'][_0xe541('0x36')]({'where':{'id':_0x159f6a['params']['id']}})[_0xe541('0x2a')](handleEntityNotFound(_0x1038c8,null))['then'](saveUpdates(_0x159f6a[_0xe541('0x35')],null))[_0xe541('0x2a')](respondWithResult(_0x1038c8,null))['catch'](handleError(_0x1038c8,null));};exports[_0xe541('0x37')]=function(_0x56893f,_0x43f8e0){return db[_0xe541('0x21')][_0xe541('0x36')]({'where':{'id':_0x56893f['params']['id']}})[_0xe541('0x2a')](handleEntityNotFound(_0x43f8e0,null))[_0xe541('0x2a')](removeEntity(_0x43f8e0,null))[_0xe541('0x2b')](handleError(_0x43f8e0,null));};exports[_0xe541('0x38')]=function(_0x5d70f3,_0x5ad200){return db[_0xe541('0x21')]['describe']()[_0xe541('0x2a')](respondWithResult(_0x5ad200,null))['catch'](handleError(_0x5ad200,null));};exports[_0xe541('0x39')]=function(_0x324ec5,_0x5633c1){return db[_0xe541('0x3a')][_0xe541('0x36')]({'where':{'id':_0x324ec5[_0xe541('0x2c')]['id']}})['then'](handleEntityNotFound(_0x5633c1,null))['then'](function(_0x19b499){if(_0x19b499){return _0x19b499[_0xe541('0x39')](_0x324ec5[_0xe541('0x35')][_0xe541('0x3b')],_['omit'](_0x324ec5[_0xe541('0x35')],[_0xe541('0x3b'),'id'])||{});}})[_0xe541('0x2a')](respondWithResult(_0x5633c1,null))[_0xe541('0x2b')](handleError(_0x5633c1,null));};exports['getMessages']=function(_0x33cc09,_0x578c1d){var _0x39a797={'raw':![],'where':{}};var _0x1307a9={};var _0x1b7dc6={'count':0x0,'rows':[]};return db[_0xe541('0x21')][_0xe541('0x3c')]({'where':{'id':_0x33cc09[_0xe541('0x2c')]['id']}})[_0xe541('0x2a')](handleEntityNotFound(_0x578c1d,null))[_0xe541('0x2a')](function(_0x944bda){if(_0x944bda){_0x1307a9[_0xe541('0x2d')]=_[_0xe541('0x2e')](db[_0xe541('0x3a')][_0xe541('0x22')]);_0x1307a9['query']=_[_0xe541('0x2e')](_0x33cc09[_0xe541('0x28')]);_0x1307a9[_0xe541('0x3d')]=_[_0xe541('0x2f')](_0x1307a9[_0xe541('0x2d')],_0x1307a9[_0xe541('0x28')]);_0x39a797[_0xe541('0x30')]=_[_0xe541('0x2f')](_0x1307a9[_0xe541('0x2d')],qs['fields'](_0x33cc09[_0xe541('0x28')][_0xe541('0x31')]));_0x39a797[_0xe541('0x30')]=_0x39a797[_0xe541('0x30')]['length']?_0x39a797[_0xe541('0x30')]:_0x1307a9[_0xe541('0x2d')];if(!_0x33cc09[_0xe541('0x28')]['hasOwnProperty'](_0xe541('0x3e'))){_0x39a797['limit']=qs['limit'](_0x33cc09[_0xe541('0x28')]['limit']);_0x39a797[_0xe541('0x18')]=qs[_0xe541('0x18')](_0x33cc09[_0xe541('0x28')][_0xe541('0x18')]);}_0x39a797[_0xe541('0x3f')]=qs['sort'](_0x33cc09[_0xe541('0x28')][_0xe541('0x40')]);_0x39a797['where']=qs[_0xe541('0x3d')](_[_0xe541('0x41')](_0x33cc09['query'],_0x1307a9['filters']));_0x39a797[_0xe541('0x42')][_0xe541('0x43')]=_0x944bda['id'];if(_0x33cc09[_0xe541('0x28')][_0xe541('0x44')]){_0x39a797[_0xe541('0x42')]=_[_0xe541('0x45')](_0x39a797['where'],{'$or':_[_0xe541('0x20')](_0x39a797[_0xe541('0x30')],function(_0x5a95d9){var _0xa66277={};_0xa66277[_0x5a95d9]={'$like':'%'+_0x33cc09[_0xe541('0x28')]['filter']+'%'};return _0xa66277;})});}if(_0x33cc09[_0xe541('0x28')][_0xe541('0x46')]){var _0x36c484=_0x33cc09[_0xe541('0x28')]['$gte'][_0xe541('0x47')](',');var _0x268125={};_0x268125[_0x36c484[0x0]]={'$gte':moment(_0x36c484[0x1])[_0xe541('0x48')](_0xe541('0x49'))};_0x39a797[_0xe541('0x42')]=_[_0xe541('0x45')](_0x39a797[_0xe541('0x42')],_0x268125);}_0x39a797=_[_0xe541('0x45')]({},_0x39a797,_0x33cc09['options']);return db['WhatsappMessage'][_0xe541('0x17')]({'where':_0x39a797['where']})[_0xe541('0x2a')](function(_0x390144){_0x1b7dc6[_0xe541('0x17')]=_0x390144;if(_0x33cc09[_0xe541('0x28')][_0xe541('0x32')]){_0x39a797[_0xe541('0x4a')]=[{'all':!![]}];}return db['WhatsappMessage'][_0xe541('0x26')](_0x39a797);})['then'](function(_0x325e8a){_0x1b7dc6[_0xe541('0x4b')]=_0x325e8a;return _0x1b7dc6;});}})[_0xe541('0x2a')](respondWithFilteredResult(_0x578c1d,_0x39a797))['catch'](handleError(_0x578c1d,null));};exports['addTags']=function(_0x5ead85,_0x3b2756){return db[_0xe541('0x21')][_0xe541('0x36')]({'where':{'id':_0x5ead85[_0xe541('0x2c')]['id']}})[_0xe541('0x2a')](handleEntityNotFound(_0x3b2756,null))[_0xe541('0x2a')](function(_0xb3a134){if(_0xb3a134){return _0xb3a134[_0xe541('0x4c')](_0x5ead85['body'][_0xe541('0x3b')],_[_0xe541('0x4d')](_0x5ead85['body'],[_0xe541('0x3b'),'id'])||{})['spread'](function(){return db[_0xe541('0x4e')][_0xe541('0x26')]({'attributes':['id',_0xe541('0x1e'),_0xe541('0x4f')],'where':{'id':_0x5ead85[_0xe541('0x35')][_0xe541('0x3b')]}});})[_0xe541('0x2a')](function(_0x197327){socket[_0xe541('0x50')](_0xe541('0x51'),{'id':Number(_0x5ead85[_0xe541('0x2c')]['id']),'tags':_0x197327||[]});return{'id':Number(_0x5ead85[_0xe541('0x2c')]['id']),'tags':_0x197327||[]};});}})['then'](respondWithResult(_0x3b2756,null))[_0xe541('0x2b')](handleError(_0x3b2756,null));};exports[_0xe541('0x52')]=function(_0x203047,_0x249322){return db[_0xe541('0x21')]['find']({'where':{'id':_0x203047[_0xe541('0x2c')]['id']}})[_0xe541('0x2a')](handleEntityNotFound(_0x249322,null))[_0xe541('0x2a')](function(_0x3e89e9){if(_0x3e89e9){return _0x3e89e9[_0xe541('0x52')](_0x203047[_0xe541('0x28')][_0xe541('0x3b')]);}})[_0xe541('0x2a')](respondWithStatusCode(_0x249322,null))['catch'](handleError(_0x249322,null));};exports[_0xe541('0x53')]=function(_0x3a4dc4,_0x40cc66){var _0x58df84=moment()[_0xe541('0x54')]()[_0xe541('0x55')]();var _0x18c4ee=path[_0xe541('0x56')](config[_0xe541('0x57')],_0xe541('0x58'),'files',_0xe541('0x59'));var _0x587212=path[_0xe541('0x56')](config[_0xe541('0x57')],_0xe541('0x58'),_0xe541('0x5a'),_0xe541('0x5b'));var _0x2e4bae=path[_0xe541('0x56')](_0x18c4ee,_0x58df84);var _0x155bdf=util[_0xe541('0x48')](_0xe541('0x5c'),_0x3a4dc4[_0xe541('0x2c')]['id'],_0x58df84);var _0x125aa3=path['join'](_0x18c4ee,_0x155bdf);var _0x2452cf=[];_0x2452cf[_0xe541('0x5d')]({'model':db[_0xe541('0x5e')],'as':_0xe541('0x5e'),'attributes':['id','fullname'],'raw':!![]});_0x2452cf[_0xe541('0x5d')]({'model':db[_0xe541('0x5f')],'as':_0xe541('0x60'),'attributes':['id',_0xe541('0x61'),'lastName'],'raw':!![]});if(_0x3a4dc4[_0xe541('0x28')][_0xe541('0x5b')]){_0x2452cf[_0xe541('0x5d')]({'model':db[_0xe541('0x62')],'as':_0xe541('0x62'),'raw':!![]});}var _0x12c227=[{'model':db[_0xe541('0x3a')],'as':_0xe541('0x63'),'attributes':['id',_0xe541('0x35'),_0xe541('0x64'),_0xe541('0x65'),'secret','read'],'include':_0x2452cf}];_0x12c227[_0xe541('0x5d')]({'model':db['WhatsappAccount'],'as':_0xe541('0x66'),'attributes':['id','name']});_0x12c227['push']({'model':db[_0xe541('0x5e')],'as':_0xe541('0x67'),'attributes':['id','fullname']});return db[_0xe541('0x21')][_0xe541('0x36')]({'where':{'id':_0x3a4dc4['params']['id']},'include':_0x12c227})['then'](handleEntityNotFound(_0x40cc66,null))[_0xe541('0x2a')](function(_0x332a8d){if(_0x332a8d){var _0x2f9f79=_0x332a8d[_0xe541('0x68')]({'plain':!![]});fs[_0xe541('0x69')](_0x2e4bae);var _0xce7159={'channel':'Whatsapp','account':_0x2f9f79[_0xe541('0x66')][_0xe541('0x1e')],'agent':_0x2f9f79['Owner']?_0x2f9f79[_0xe541('0x67')][_0xe541('0x6a')]:_0xe541('0x6b'),'createdAt':moment(_0x2f9f79[_0xe541('0x64')])[_0xe541('0x48')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe541('0x55')](),'closedAt':_0x2f9f79[_0xe541('0x6c')]?moment(_0x2f9f79[_0xe541('0x6d')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x2f9f79['disposition'],'messages':_(_0x2f9f79[_0xe541('0x63')])[_0xe541('0x44')]({'secret':![]})[_0xe541('0x20')](function(_0x1ae2f4){if(_0x1ae2f4[_0xe541('0x62')]){var _0x2174ee=path['join'](_0x587212,_0x1ae2f4['Attachment'][_0xe541('0x6e')]);if(fs[_0xe541('0x6f')](_0x2174ee)){fs[_0xe541('0x70')](_0x2174ee)[_0xe541('0x71')](fs[_0xe541('0x72')](path[_0xe541('0x56')](_0x2e4bae,_0x1ae2f4['Attachment'][_0xe541('0x6e')])));}}return{'date':moment(_0x1ae2f4[_0xe541('0x64')])[_0xe541('0x48')](_0xe541('0x49'))['toString'](),'sender':_0x1ae2f4[_0xe541('0x65')]===_0xe541('0x73')?_0x1ae2f4[_0xe541('0x5e')]?_0x1ae2f4['User'][_0xe541('0x6a')]:_0xe541('0x74'):_0x1ae2f4[_0xe541('0x60')]['firstName']+(_0x1ae2f4[_0xe541('0x60')][_0xe541('0x75')]?'\x20'+_0x1ae2f4['Contact'][_0xe541('0x75')]:''),'body':_0x1ae2f4['Attachment']?_0x1ae2f4[_0xe541('0x62')][_0xe541('0x6e')]:_0x1ae2f4[_0xe541('0x35')],'direction':_0x1ae2f4[_0xe541('0x65')]==='out'?'A':'C','secret':_0x1ae2f4[_0xe541('0x76')],'read':_0x1ae2f4[_0xe541('0x77')],'attachment':_0x1ae2f4['Attachment']};})[_0xe541('0x78')]()};return ejs[_0xe541('0x79')](path['join'](config['root'],_0xe541('0x58'),_0xe541('0x7a'),_0xe541('0x7b')),{'interaction':_0xce7159})[_0xe541('0x2a')](function(_0x1ef20f){var _0x441f1f=path[_0xe541('0x56')](_0x2e4bae,_0xe541('0x7c')+_0x2f9f79['id']+'-'+_0x58df84+'.pdf');var _0x44000b={'path':_0x441f1f,'channel':_0xe541('0x7d'),'interactionId':_0x2f9f79['id']};return pdf[_0xe541('0x7e')](_0x1ef20f,_0x44000b);})[_0xe541('0x2a')](function(){return new BPromise(function(_0x36a391,_0x23b442){zipdir(_0x2e4bae,{'saveTo':_0x125aa3},function(_0x1b2287,_0x2ce0b8){if(_0x1b2287)return _0x23b442(_0x1b2287);return _0x36a391(_0x2ce0b8);});})[_0xe541('0x2a')](function(){return new BPromise(function(_0x2d735a,_0x3db09d){rimraf(_0x2e4bae,function(_0xd48f94){if(_0xd48f94)_0x3db09d(_0xd48f94);return _0x2d735a();});});})[_0xe541('0x2a')](function(){return _0x40cc66[_0xe541('0x53')](_0x125aa3,_0x155bdf,function(_0x5d4bad){if(_0x5d4bad){console['log']('err',_0x5d4bad);}else{fs['unlinkSync'](_0x125aa3);}});});});}else{return _0x40cc66['sendStatus'](0xc8);}})[_0xe541('0x2b')](handleError(_0x40cc66,null));}; \ No newline at end of file +var _0x4f81=['util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','then','name','send','index','WhatsappInteraction','rawAttributes','type','getOptions','findAll','query','user','show','params','model','keys','attributes','intersection','fields','include','find','create','body','update','destroy','catch','describe','WhatsappMessage','addMessage','ids','getMessages','findOne','filters','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','addTags','spread','Tag','emit','removeTags','download','join','root','tmp','server','files','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','Attachment','Messages','createdAt','direction','secret','read','WhatsappAccount','Account','Owner','get','Whatsapp','N.A.','closedAt','toString','disposition','map','basename','existsSync','createReadStream','pipe','createWriteStream','out','firstName','lastName','value','renderFile','views','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','moment'];(function(_0x43ffba,_0x8b7ceb){var _0x33acd7=function(_0x3c8ef8){while(--_0x3c8ef8){_0x43ffba['push'](_0x43ffba['shift']());}};_0x33acd7(++_0x8b7ceb);}(_0x4f81,0x1e3));var _0x14f8=function(_0x448e71,_0x3d4caf){_0x448e71=_0x448e71-0x0;var _0x471f72=_0x4f81[_0x448e71];return _0x471f72;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0x14f8('0x0'));var BPromise=require('bluebird');var util=require(_0x14f8('0x1'));var path=require(_0x14f8('0x2'));var ejs=require(_0x14f8('0x3'));var fs=require('fs');var _=require(_0x14f8('0x4'));var Redis=require(_0x14f8('0x5'));var interaction=require(_0x14f8('0x6'));var qs=require(_0x14f8('0x7'));var pdf=require('../../components/export/pdf');var logger=require(_0x14f8('0x8'))('api');var config=require(_0x14f8('0x9'));var db=require(_0x14f8('0xa'))['db'];config['redis']=_[_0x14f8('0xb')](config[_0x14f8('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x14f8('0xd'))(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0x14f8('0xe')](socket);function respondWithStatusCode(_0x40a43d,_0xbfbf2a){_0xbfbf2a=_0xbfbf2a||0xcc;return function(_0xd10497){if(_0xd10497){return _0x40a43d[_0x14f8('0xf')](_0xbfbf2a);}return _0x40a43d[_0x14f8('0x10')](_0xbfbf2a)[_0x14f8('0x11')]();};}function respondWithResult(_0xd41009,_0x3828e8){_0x3828e8=_0x3828e8||0xc8;return function(_0x1e849a){if(_0x1e849a){return _0xd41009[_0x14f8('0x10')](_0x3828e8)[_0x14f8('0x12')](_0x1e849a);}};}function respondWithFilteredResult(_0x5f2843,_0x315ed3){return function(_0x3b6ecb){if(_0x3b6ecb){var _0x235f92=typeof _0x315ed3[_0x14f8('0x13')]===_0x14f8('0x14')&&typeof _0x315ed3[_0x14f8('0x15')]===_0x14f8('0x14');var _0x37e020=_0x3b6ecb[_0x14f8('0x16')];var _0x1216e8=_0x235f92?0x0:_0x315ed3['offset'];var _0x3481a1=_0x235f92?_0x3b6ecb[_0x14f8('0x16')]:_0x315ed3[_0x14f8('0x13')]+_0x315ed3[_0x14f8('0x15')];var _0x2a3019;if(_0x3481a1>=_0x37e020){_0x3481a1=_0x37e020;_0x2a3019=0xc8;}else{_0x2a3019=0xce;}_0x5f2843[_0x14f8('0x10')](_0x2a3019);return _0x5f2843[_0x14f8('0x17')]('Content-Range',_0x1216e8+'-'+_0x3481a1+'/'+_0x37e020)[_0x14f8('0x12')](_0x3b6ecb);}return null;};}function saveUpdates(_0x4495de){return function(_0x4c9dc9){if(_0x4c9dc9){return _0x4c9dc9['update'](_0x4495de)['then'](function(_0x3e62a1){return _0x3e62a1;});}return null;};}function removeEntity(_0x471a81){return function(_0x261596){if(_0x261596){return _0x261596['destroy']()[_0x14f8('0x18')](function(){_0x471a81[_0x14f8('0x10')](0xcc)[_0x14f8('0x11')]();});}};}function handleEntityNotFound(_0x504a1e){return function(_0x3526e5){if(!_0x3526e5){_0x504a1e['sendStatus'](0x194);}return _0x3526e5;};}function handleError(_0x313775,_0x14fa31){_0x14fa31=_0x14fa31||0x1f4;return function(_0x4bfacd){logger['error'](_0x4bfacd['stack']);if(_0x4bfacd['name']){delete _0x4bfacd[_0x14f8('0x19')];}_0x313775[_0x14f8('0x10')](_0x14fa31)[_0x14f8('0x1a')](_0x4bfacd);};}exports[_0x14f8('0x1b')]=function(_0x12122d,_0x18350e){var _0x527632={};var _0x4193a2=_['map'](db[_0x14f8('0x1c')][_0x14f8('0x1d')],function(_0x1e938b){return{'name':_0x1e938b['fieldName'],'type':_0x1e938b[_0x14f8('0x1e')]['key']};});_0x527632=qs[_0x14f8('0x1f')](_0x4193a2,_0x12122d);return interaction[_0x14f8('0x20')]('whatsapp',_0x12122d[_0x14f8('0x21')],_0x12122d[_0x14f8('0x22')],_0x527632,_0x4193a2)[_0x14f8('0x18')](respondWithFilteredResult(_0x18350e,_0x527632))['catch'](handleError(_0x18350e,null));};exports[_0x14f8('0x23')]=function(_0x43bb3d,_0x23aa31){var _0x58ba3b={'raw':![],'where':{'id':_0x43bb3d[_0x14f8('0x24')]['id']}},_0x3e1d02={};_0x3e1d02[_0x14f8('0x25')]=_[_0x14f8('0x26')](db[_0x14f8('0x1c')][_0x14f8('0x1d')]);_0x3e1d02[_0x14f8('0x21')]=_['keys'](_0x43bb3d[_0x14f8('0x21')]);_0x3e1d02['filters']=_['intersection'](_0x3e1d02[_0x14f8('0x25')],_0x3e1d02['query']);_0x58ba3b[_0x14f8('0x27')]=_[_0x14f8('0x28')](_0x3e1d02[_0x14f8('0x25')],qs[_0x14f8('0x29')](_0x43bb3d[_0x14f8('0x21')]['fields']));_0x58ba3b[_0x14f8('0x27')]=_0x58ba3b[_0x14f8('0x27')]['length']?_0x58ba3b['attributes']:_0x3e1d02[_0x14f8('0x25')];if(_0x43bb3d[_0x14f8('0x21')]['includeAll']){_0x58ba3b[_0x14f8('0x2a')]=[{'all':!![]}];}_0x58ba3b=_['merge']({},_0x58ba3b,_0x43bb3d['options']);return db['WhatsappInteraction'][_0x14f8('0x2b')](_0x58ba3b)[_0x14f8('0x18')](handleEntityNotFound(_0x23aa31,null))[_0x14f8('0x18')](respondWithResult(_0x23aa31,null))['catch'](handleError(_0x23aa31,null));};exports[_0x14f8('0x2c')]=function(_0x4ac7b0,_0x296cd5){return db[_0x14f8('0x1c')]['create'](_0x4ac7b0[_0x14f8('0x2d')],{})[_0x14f8('0x18')](respondWithResult(_0x296cd5,0xc9))['catch'](handleError(_0x296cd5,null));};exports[_0x14f8('0x2e')]=function(_0x1a98fb,_0x253986){if(_0x1a98fb[_0x14f8('0x2d')]['id']){delete _0x1a98fb[_0x14f8('0x2d')]['id'];}return db[_0x14f8('0x1c')]['find']({'where':{'id':_0x1a98fb[_0x14f8('0x24')]['id']}})['then'](handleEntityNotFound(_0x253986,null))['then'](saveUpdates(_0x1a98fb[_0x14f8('0x2d')],null))['then'](respondWithResult(_0x253986,null))['catch'](handleError(_0x253986,null));};exports[_0x14f8('0x2f')]=function(_0x107497,_0x12fc5c){return db['WhatsappInteraction']['find']({'where':{'id':_0x107497['params']['id']}})[_0x14f8('0x18')](handleEntityNotFound(_0x12fc5c,null))[_0x14f8('0x18')](removeEntity(_0x12fc5c,null))[_0x14f8('0x30')](handleError(_0x12fc5c,null));};exports[_0x14f8('0x31')]=function(_0xc941a9,_0x329cf2){return db[_0x14f8('0x1c')][_0x14f8('0x31')]()[_0x14f8('0x18')](respondWithResult(_0x329cf2,null))['catch'](handleError(_0x329cf2,null));};exports['addMessage']=function(_0x181451,_0x1e5e75){return db[_0x14f8('0x32')][_0x14f8('0x2b')]({'where':{'id':_0x181451[_0x14f8('0x24')]['id']}})['then'](handleEntityNotFound(_0x1e5e75,null))[_0x14f8('0x18')](function(_0x431500){if(_0x431500){return _0x431500[_0x14f8('0x33')](_0x181451[_0x14f8('0x2d')][_0x14f8('0x34')],_['omit'](_0x181451[_0x14f8('0x2d')],[_0x14f8('0x34'),'id'])||{});}})['then'](respondWithResult(_0x1e5e75,null))[_0x14f8('0x30')](handleError(_0x1e5e75,null));};exports[_0x14f8('0x35')]=function(_0x4def67,_0x415976){var _0x2445db={'raw':![],'where':{}};var _0x2aefb4={};var _0x45d702={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x14f8('0x36')]({'where':{'id':_0x4def67['params']['id']}})[_0x14f8('0x18')](handleEntityNotFound(_0x415976,null))[_0x14f8('0x18')](function(_0x275b37){if(_0x275b37){_0x2aefb4[_0x14f8('0x25')]=_[_0x14f8('0x26')](db['WhatsappMessage'][_0x14f8('0x1d')]);_0x2aefb4[_0x14f8('0x21')]=_[_0x14f8('0x26')](_0x4def67[_0x14f8('0x21')]);_0x2aefb4[_0x14f8('0x37')]=_[_0x14f8('0x28')](_0x2aefb4[_0x14f8('0x25')],_0x2aefb4[_0x14f8('0x21')]);_0x2445db[_0x14f8('0x27')]=_[_0x14f8('0x28')](_0x2aefb4[_0x14f8('0x25')],qs[_0x14f8('0x29')](_0x4def67['query'][_0x14f8('0x29')]));_0x2445db['attributes']=_0x2445db[_0x14f8('0x27')][_0x14f8('0x38')]?_0x2445db['attributes']:_0x2aefb4[_0x14f8('0x25')];if(!_0x4def67[_0x14f8('0x21')][_0x14f8('0x39')](_0x14f8('0x3a'))){_0x2445db['limit']=qs[_0x14f8('0x15')](_0x4def67['query'][_0x14f8('0x15')]);_0x2445db[_0x14f8('0x13')]=qs['offset'](_0x4def67['query'][_0x14f8('0x13')]);}_0x2445db[_0x14f8('0x3b')]=qs[_0x14f8('0x3c')](_0x4def67[_0x14f8('0x21')][_0x14f8('0x3c')]);_0x2445db[_0x14f8('0x3d')]=qs['filters'](_[_0x14f8('0x3e')](_0x4def67[_0x14f8('0x21')],_0x2aefb4[_0x14f8('0x37')]));_0x2445db['where']['WhatsappInteractionId']=_0x275b37['id'];if(_0x4def67[_0x14f8('0x21')][_0x14f8('0x3f')]){_0x2445db[_0x14f8('0x3d')]=_[_0x14f8('0x40')](_0x2445db[_0x14f8('0x3d')],{'$or':_['map'](_0x2445db[_0x14f8('0x27')],function(_0x2da3c6){var _0x1550bd={};_0x1550bd[_0x2da3c6]={'$like':'%'+_0x4def67[_0x14f8('0x21')][_0x14f8('0x3f')]+'%'};return _0x1550bd;})});}if(_0x4def67['query']['$gte']){var _0x2d8741=_0x4def67[_0x14f8('0x21')][_0x14f8('0x41')][_0x14f8('0x42')](',');var _0x48ba53={};_0x48ba53[_0x2d8741[0x0]]={'$gte':moment(_0x2d8741[0x1])[_0x14f8('0x43')](_0x14f8('0x44'))};_0x2445db[_0x14f8('0x3d')]=_[_0x14f8('0x40')](_0x2445db['where'],_0x48ba53);}_0x2445db=_[_0x14f8('0x40')]({},_0x2445db,_0x4def67['options']);return db['WhatsappMessage']['count']({'where':_0x2445db[_0x14f8('0x3d')]})[_0x14f8('0x18')](function(_0x270ba6){_0x45d702[_0x14f8('0x16')]=_0x270ba6;if(_0x4def67[_0x14f8('0x21')][_0x14f8('0x45')]){_0x2445db[_0x14f8('0x2a')]=[{'all':!![]}];}return db[_0x14f8('0x32')][_0x14f8('0x20')](_0x2445db);})['then'](function(_0x3e79cf){_0x45d702['rows']=_0x3e79cf;return _0x45d702;});}})[_0x14f8('0x18')](respondWithFilteredResult(_0x415976,_0x2445db))[_0x14f8('0x30')](handleError(_0x415976,null));};exports[_0x14f8('0x46')]=function(_0x5ba6fa,_0x3f0dbd){return db['WhatsappInteraction']['find']({'where':{'id':_0x5ba6fa['params']['id']}})[_0x14f8('0x18')](handleEntityNotFound(_0x3f0dbd,null))[_0x14f8('0x18')](function(_0x56c202){if(_0x56c202){return _0x56c202['setTags'](_0x5ba6fa[_0x14f8('0x2d')]['ids'],_['omit'](_0x5ba6fa[_0x14f8('0x2d')],[_0x14f8('0x34'),'id'])||{})[_0x14f8('0x47')](function(){return db[_0x14f8('0x48')][_0x14f8('0x20')]({'attributes':['id',_0x14f8('0x19'),'color'],'where':{'id':_0x5ba6fa[_0x14f8('0x2d')][_0x14f8('0x34')]}});})['then'](function(_0x5a6aff){socket[_0x14f8('0x49')]('whatsappInteractionTags:save',{'id':Number(_0x5ba6fa[_0x14f8('0x24')]['id']),'tags':_0x5a6aff||[]});return{'id':Number(_0x5ba6fa['params']['id']),'tags':_0x5a6aff||[]};});}})[_0x14f8('0x18')](respondWithResult(_0x3f0dbd,null))[_0x14f8('0x30')](handleError(_0x3f0dbd,null));};exports[_0x14f8('0x4a')]=function(_0xb8dfe1,_0x27a0d2){return db[_0x14f8('0x1c')][_0x14f8('0x2b')]({'where':{'id':_0xb8dfe1[_0x14f8('0x24')]['id']}})[_0x14f8('0x18')](handleEntityNotFound(_0x27a0d2,null))[_0x14f8('0x18')](function(_0x59a8bf){if(_0x59a8bf){return _0x59a8bf[_0x14f8('0x4a')](_0xb8dfe1[_0x14f8('0x21')][_0x14f8('0x34')]);}})[_0x14f8('0x18')](respondWithStatusCode(_0x27a0d2,null))['catch'](handleError(_0x27a0d2,null));};exports[_0x14f8('0x4b')]=function(_0x38018a,_0x34e190){var _0xe461db=moment()['unix']()['toString']();var _0x313484=path[_0x14f8('0x4c')](config[_0x14f8('0x4d')],'server','files',_0x14f8('0x4e'));var _0x7c6863=path[_0x14f8('0x4c')](config[_0x14f8('0x4d')],_0x14f8('0x4f'),_0x14f8('0x50'),_0x14f8('0x51'));var _0x4a3a60=path['join'](_0x313484,_0xe461db);var _0x1c1eaf=util[_0x14f8('0x43')](_0x14f8('0x52'),_0x38018a[_0x14f8('0x24')]['id'],_0xe461db);var _0x3db1df=path[_0x14f8('0x4c')](_0x313484,_0x1c1eaf);var _0x4dd33c=[];_0x4dd33c[_0x14f8('0x53')]({'model':db[_0x14f8('0x54')],'as':_0x14f8('0x54'),'attributes':['id',_0x14f8('0x55')],'raw':!![]});_0x4dd33c[_0x14f8('0x53')]({'model':db[_0x14f8('0x56')],'as':_0x14f8('0x57'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x38018a[_0x14f8('0x21')]['attachments']){_0x4dd33c[_0x14f8('0x53')]({'model':db[_0x14f8('0x58')],'as':_0x14f8('0x58'),'raw':!![]});}var _0x7d2c41=[{'model':db['WhatsappMessage'],'as':_0x14f8('0x59'),'attributes':['id',_0x14f8('0x2d'),_0x14f8('0x5a'),_0x14f8('0x5b'),_0x14f8('0x5c'),_0x14f8('0x5d')],'include':_0x4dd33c}];_0x7d2c41['push']({'model':db[_0x14f8('0x5e')],'as':_0x14f8('0x5f'),'attributes':['id',_0x14f8('0x19')]});_0x7d2c41[_0x14f8('0x53')]({'model':db[_0x14f8('0x54')],'as':_0x14f8('0x60'),'attributes':['id','fullname']});return db[_0x14f8('0x1c')][_0x14f8('0x2b')]({'where':{'id':_0x38018a[_0x14f8('0x24')]['id']},'include':_0x7d2c41})['then'](handleEntityNotFound(_0x34e190,null))[_0x14f8('0x18')](function(_0x334daa){if(_0x334daa){var _0x893143=_0x334daa[_0x14f8('0x61')]({'plain':!![]});fs['mkdirSync'](_0x4a3a60);var _0x58d0c2={'channel':_0x14f8('0x62'),'account':_0x893143[_0x14f8('0x5f')][_0x14f8('0x19')],'agent':_0x893143[_0x14f8('0x60')]?_0x893143['Owner'][_0x14f8('0x55')]:_0x14f8('0x63'),'createdAt':moment(_0x893143[_0x14f8('0x5a')])['format'](_0x14f8('0x44'))['toString'](),'closedAt':_0x893143['closed']?moment(_0x893143[_0x14f8('0x64')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x14f8('0x65')]():'','disposition':_0x893143[_0x14f8('0x66')],'messages':_(_0x893143[_0x14f8('0x59')])[_0x14f8('0x3f')]({'secret':![]})[_0x14f8('0x67')](function(_0x45b816){if(_0x45b816[_0x14f8('0x58')]){var _0x1a68d4=path[_0x14f8('0x4c')](_0x7c6863,_0x45b816['Attachment'][_0x14f8('0x68')]);if(fs[_0x14f8('0x69')](_0x1a68d4)){fs[_0x14f8('0x6a')](_0x1a68d4)[_0x14f8('0x6b')](fs[_0x14f8('0x6c')](path['join'](_0x4a3a60,_0x45b816[_0x14f8('0x58')][_0x14f8('0x68')])));}}return{'date':moment(_0x45b816['createdAt'])['format'](_0x14f8('0x44'))[_0x14f8('0x65')](),'sender':_0x45b816[_0x14f8('0x5b')]===_0x14f8('0x6d')?_0x45b816[_0x14f8('0x54')]?_0x45b816[_0x14f8('0x54')][_0x14f8('0x55')]:'System':_0x45b816[_0x14f8('0x57')][_0x14f8('0x6e')]+(_0x45b816[_0x14f8('0x57')][_0x14f8('0x6f')]?'\x20'+_0x45b816['Contact']['lastName']:''),'body':_0x45b816['Attachment']?_0x45b816[_0x14f8('0x58')][_0x14f8('0x68')]:_0x45b816[_0x14f8('0x2d')],'direction':_0x45b816[_0x14f8('0x5b')]===_0x14f8('0x6d')?'A':'C','secret':_0x45b816[_0x14f8('0x5c')],'read':_0x45b816[_0x14f8('0x5d')],'attachment':_0x45b816[_0x14f8('0x58')]};})[_0x14f8('0x70')]()};return ejs[_0x14f8('0x71')](path[_0x14f8('0x4c')](config[_0x14f8('0x4d')],_0x14f8('0x4f'),_0x14f8('0x72'),'downloadInteraction.ejs'),{'interaction':_0x58d0c2})[_0x14f8('0x18')](function(_0x58992){var _0x4bb412=path[_0x14f8('0x4c')](_0x4a3a60,_0x14f8('0x73')+_0x893143['id']+'-'+_0xe461db+_0x14f8('0x74'));var _0x21c421={'path':_0x4bb412,'channel':_0x14f8('0x62'),'interactionId':_0x893143['id']};return pdf[_0x14f8('0x75')](_0x58992,_0x21c421);})[_0x14f8('0x18')](function(){return new BPromise(function(_0x5527d4,_0x198e6f){zipdir(_0x4a3a60,{'saveTo':_0x3db1df},function(_0x42e49f,_0x128eb7){if(_0x42e49f)return _0x198e6f(_0x42e49f);return _0x5527d4(_0x128eb7);});})[_0x14f8('0x18')](function(){return new BPromise(function(_0xb38904,_0x455044){rimraf(_0x4a3a60,function(_0x4007b6){if(_0x4007b6)_0x455044(_0x4007b6);return _0xb38904();});});})['then'](function(){return _0x34e190[_0x14f8('0x4b')](_0x3db1df,_0x1c1eaf,function(_0x21a6c1){if(_0x21a6c1){console[_0x14f8('0x76')](_0x14f8('0x77'),_0x21a6c1);}else{fs[_0x14f8('0x78')](_0x3db1df);}});});});}else{return _0x34e190[_0x14f8('0xf')](0xc8);}})['catch'](handleError(_0x34e190,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 1952ee8..2626e59 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 _0x8868=['../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','map','findAll','length','catch','hook','exports','events'];(function(_0x55014d,_0x592cc2){var _0x425283=function(_0xa3b08e){while(--_0xa3b08e){_0x55014d['push'](_0x55014d['shift']());}};_0x425283(++_0x592cc2);}(_0x8868,0x1ca));var _0x8886=function(_0x4a05ad,_0x30842f){_0x4a05ad=_0x4a05ad-0x0;var _0x46e0d4=_0x8868[_0x4a05ad];return _0x46e0d4;};'use strict';var EventEmitter=require(_0x8886('0x0'));var WhatsappInteraction=require(_0x8886('0x1'))['db'][_0x8886('0x2')];var WhatsappMessage=require(_0x8886('0x1'))['db'][_0x8886('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x8886('0x4')](0x0);var events={'afterCreate':_0x8886('0x5'),'afterUpdate':_0x8886('0x6'),'afterDestroy':_0x8886('0x7')};function emitEvent(_0x224e93){return function(_0x433880,_0x59fca9,_0x544272){_0x433880[_0x8886('0x8')]({'attributes':['id'],'raw':!![]})[_0x8886('0x9')](function(_0x5e2a73){_0x433880[_0x8886('0xa')]('Users',_0x5e2a73[_0x8886('0xb')](function(_0x36c0dd){return{'id':_0x36c0dd['id']};}));return WhatsappMessage[_0x8886('0xc')]({'where':{'WhatsappInteractionId':_0x433880['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8886('0x9')](function(_0x1d25b0){_0x433880[_0x8886('0xa')]('unreadMessages',_0x1d25b0[_0x8886('0xd')]);WhatsappInteractionEvents['emit'](_0x224e93+':'+_0x433880['id'],_0x433880);WhatsappInteractionEvents['emit'](_0x224e93,_0x433880);_0x544272(null);})[_0x8886('0xe')](_0x544272(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x8886('0xf')](e,emitEvent(event));}}module[_0x8886('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x2182=['events','../../mysqldb','WhatsappInteraction','setMaxListeners','update','remove','getUsers','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports'];(function(_0x495e95,_0xbe3624){var _0x42881e=function(_0x30d012){while(--_0x30d012){_0x495e95['push'](_0x495e95['shift']());}};_0x42881e(++_0xbe3624);}(_0x2182,0xea));var _0x2218=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x2182[_0x3b380d];return _0x54502b;};'use strict';var EventEmitter=require(_0x2218('0x0'));var WhatsappInteraction=require(_0x2218('0x1'))['db'][_0x2218('0x2')];var WhatsappMessage=require(_0x2218('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x2218('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2218('0x4'),'afterDestroy':_0x2218('0x5')};function emitEvent(_0x3348af){return function(_0x6fd30,_0xf3271d,_0x1e2df1){_0x6fd30[_0x2218('0x6')]({'attributes':['id'],'raw':!![]})[_0x2218('0x7')](function(_0x142d1d){_0x6fd30[_0x2218('0x8')]('Users',_0x142d1d[_0x2218('0x9')](function(_0xed1f79){return{'id':_0xed1f79['id']};}));return WhatsappMessage[_0x2218('0xa')]({'where':{'WhatsappInteractionId':_0x6fd30['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2218('0x7')](function(_0x49df16){_0x6fd30[_0x2218('0x8')](_0x2218('0xb'),_0x49df16[_0x2218('0xc')]);WhatsappInteractionEvents[_0x2218('0xd')](_0x3348af+':'+_0x6fd30['id'],_0x6fd30);WhatsappInteractionEvents['emit'](_0x3348af,_0x6fd30);_0x1e2df1(null);})[_0x2218('0xe')](_0x1e2df1(null));};}for(var e in events){if(events[_0x2218('0xf')](e)){var event=events[e];WhatsappInteraction[_0x2218('0x10')](e,emitEvent(event));}}module[_0x2218('0x11')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index e8943da..9aafdd4 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 _0x77b0=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','changed'];(function(_0x569998,_0x361b8d){var _0x2f8256=function(_0x3354f1){while(--_0x3354f1){_0x569998['push'](_0x569998['shift']());}};_0x2f8256(++_0x361b8d);}(_0x77b0,0xd4));var _0x077b=function(_0x4ba36a,_0x5d51ab){_0x4ba36a=_0x4ba36a-0x0;var _0x4437e5=_0x77b0[_0x4ba36a];return _0x4437e5;};'use strict';var _=require('lodash');var util=require(_0x077b('0x0'));var logger=require(_0x077b('0x1'))('api');var moment=require(_0x077b('0x2'));var BPromise=require(_0x077b('0x3'));var rp=require(_0x077b('0x4'));var fs=require('fs');var path=require(_0x077b('0x5'));var rimraf=require(_0x077b('0x6'));var config=require('../../config/environment');var attributes=require(_0x077b('0x7'));module[_0x077b('0x8')]=function(_0x28d2ae,_0x4848ec){return _0x28d2ae[_0x077b('0x9')](_0x077b('0xa'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x57843c,_0x30d0de,_0x5d2b34){if(_0x57843c[_0x077b('0xb')](_0x077b('0xc'))){_0x57843c[_0x077b('0xd')]=moment()[_0x077b('0xe')](_0x077b('0xf'));}_0x5d2b34(null,_0x57843c);}}});}; \ No newline at end of file +var _0x9edb=['closed','closedAt','format','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions'];(function(_0x11b99e,_0x1e19a8){var _0xb61540=function(_0x2dae53){while(--_0x2dae53){_0x11b99e['push'](_0x11b99e['shift']());}};_0xb61540(++_0x1e19a8);}(_0x9edb,0x7b));var _0xb9ed=function(_0x2e99bb,_0x494bda){_0x2e99bb=_0x2e99bb-0x0;var _0x306fe1=_0x9edb[_0x2e99bb];return _0x306fe1;};'use strict';var _=require(_0xb9ed('0x0'));var util=require(_0xb9ed('0x1'));var logger=require(_0xb9ed('0x2'))('api');var moment=require(_0xb9ed('0x3'));var BPromise=require(_0xb9ed('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb9ed('0x5'));var rimraf=require('rimraf');var config=require(_0xb9ed('0x6'));var attributes=require(_0xb9ed('0x7'));module[_0xb9ed('0x8')]=function(_0x2fe40f,_0x563164){return _0x2fe40f[_0xb9ed('0x9')](_0xb9ed('0xa'),attributes,{'tableName':_0xb9ed('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3ef36e,_0x24ebf3,_0x128b1c){if(_0x3ef36e['changed'](_0xb9ed('0xc'))){_0x3ef36e[_0xb9ed('0xd')]=moment()[_0xb9ed('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x128b1c(null,_0x3ef36e);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index d187e9b..70ea0fe 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 _0x89b9=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./whatsappInteraction.socket','then','info','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','catch','body','options','attributes','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','WhatsappInteraction','find','addTags','ids','omit','AddTags','debug','lodash','util','moment'];(function(_0x384166,_0x4dadc3){var _0x4d8dc0=function(_0x42d207){while(--_0x42d207){_0x384166['push'](_0x384166['shift']());}};_0x4d8dc0(++_0x4dadc3);}(_0x89b9,0x91));var _0x989b=function(_0x4392cf,_0x18c407){_0x4392cf=_0x4392cf-0x0;var _0x32d8d9=_0x89b9[_0x4392cf];return _0x32d8d9;};'use strict';var _=require(_0x989b('0x0'));var util=require(_0x989b('0x1'));var moment=require(_0x989b('0x2'));var BPromise=require(_0x989b('0x3'));var rs=require(_0x989b('0x4'));var fs=require('fs');var Redis=require(_0x989b('0x5'));var db=require(_0x989b('0x6'))['db'];var utils=require(_0x989b('0x7'));var logger=require('../../config/logger')(_0x989b('0x8'));var config=require(_0x989b('0x9'));var jayson=require(_0x989b('0xa'));var client=jayson[_0x989b('0xb')]['http']({'port':0x232a});config[_0x989b('0xc')]=_['defaults'](config[_0x989b('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x989b('0xd'))(new Redis(config[_0x989b('0xc')]));require(_0x989b('0xe'))['register'](socket);function respondWithRpcPromise(_0x5c7c8e,_0x45429c,_0x3cff12){return new BPromise(function(_0x23cfcb,_0x37dbb4){return client['request'](_0x5c7c8e,_0x3cff12)[_0x989b('0xf')](function(_0x471c0b){logger[_0x989b('0x10')]('WhatsappInteraction,\x20%s,\x20%s',_0x45429c,_0x989b('0x11'));logger['debug'](_0x989b('0x12'),_0x45429c,_0x989b('0x11'),JSON[_0x989b('0x13')](_0x471c0b));if(_0x471c0b[_0x989b('0x14')]){if(_0x471c0b[_0x989b('0x14')][_0x989b('0x15')]===0x1f4){logger['error'](_0x989b('0x16'),_0x45429c,_0x471c0b[_0x989b('0x14')][_0x989b('0x17')]);return _0x37dbb4(_0x471c0b[_0x989b('0x14')][_0x989b('0x17')]);}logger[_0x989b('0x14')](_0x989b('0x16'),_0x45429c,_0x471c0b[_0x989b('0x14')][_0x989b('0x17')]);return _0x23cfcb(_0x471c0b[_0x989b('0x14')][_0x989b('0x17')]);}else{logger[_0x989b('0x10')](_0x989b('0x16'),_0x45429c,_0x989b('0x11'));_0x23cfcb(_0x471c0b['result'][_0x989b('0x17')]);}})[_0x989b('0x18')](function(_0x3e4699){logger['error'](_0x989b('0x16'),_0x45429c,_0x3e4699);_0x37dbb4(_0x3e4699);});});}exports['UpdateWhatsappInteraction']=function(_0x484425){var _0x179862=this;return new Promise(function(_0x566930,_0x2fe13b){return db['WhatsappInteraction']['update'](_0x484425[_0x989b('0x19')],{'raw':_0x484425[_0x989b('0x1a')]?_0x484425['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x484425[_0x989b('0x1a')]?_0x484425[_0x989b('0x1a')]['where']||null:null,'attributes':_0x484425[_0x989b('0x1a')]?_0x484425[_0x989b('0x1a')][_0x989b('0x1b')]||null:null,'limit':_0x484425[_0x989b('0x1a')]?_0x484425[_0x989b('0x1a')]['limit']||null:null})['then'](function(_0x1f3c98){logger[_0x989b('0x10')]('UpdateWhatsappInteraction',_0x484425);logger['debug'](_0x989b('0x1c'),_0x484425,JSON['stringify'](_0x1f3c98));_0x566930(_0x1f3c98);})[_0x989b('0x18')](function(_0xeefc76){logger[_0x989b('0x14')]('UpdateWhatsappInteraction',_0xeefc76[_0x989b('0x17')],_0x484425);_0x2fe13b(_0x179862['error'](0x1f4,_0xeefc76[_0x989b('0x17')]));});});};exports[_0x989b('0x1d')]=function(_0x57787a){return new Promise(function(_0x281f48,_0x250606){return db[_0x989b('0x1e')][_0x989b('0x1f')]({'where':_0x57787a[_0x989b('0x1a')]?_0x57787a[_0x989b('0x1a')]['where']||null:null})[_0x989b('0xf')](function(_0x37cea6){if(_0x37cea6){return _0x37cea6[_0x989b('0x20')](_0x57787a['body'][_0x989b('0x21')],_[_0x989b('0x22')](_0x57787a[_0x989b('0x19')],['ids','id'])||{});}})['spread'](function(_0x43843c){logger[_0x989b('0x10')](_0x989b('0x23'),_0x57787a);logger[_0x989b('0x24')](_0x989b('0x23'),_0x57787a,JSON[_0x989b('0x13')](_0x43843c));_0x281f48(_0x43843c);})['catch'](function(_0x3a5f9f){logger[_0x989b('0x14')]('AddTags',_0x3a5f9f[_0x989b('0x17')],_0x57787a);_0x250606(_this['error'](0x1f4,_0x3a5f9f['message']));});});}; \ No newline at end of file +var _0x3b30=['UpdateWhatsappInteraction','WhatsappInteraction','update','options','raw','limit','AddTagsToWhatsappInteraction','find','where','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch'];(function(_0x5672a1,_0x5b303c){var _0x366d06=function(_0x493b34){while(--_0x493b34){_0x5672a1['push'](_0x5672a1['shift']());}};_0x366d06(++_0x5b303c);}(_0x3b30,0x12b));var _0x03b3=function(_0x330d5b,_0x50d6d4){_0x330d5b=_0x330d5b-0x0;var _0x278a10=_0x3b30[_0x330d5b];return _0x278a10;};'use strict';var _=require(_0x03b3('0x0'));var util=require(_0x03b3('0x1'));var moment=require(_0x03b3('0x2'));var BPromise=require(_0x03b3('0x3'));var rs=require(_0x03b3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x03b3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x03b3('0x6'))(_0x03b3('0x7'));var config=require(_0x03b3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x03b3('0x9')][_0x03b3('0xa')]({'port':0x232a});config[_0x03b3('0xb')]=_[_0x03b3('0xc')](config[_0x03b3('0xb')],{'host':_0x03b3('0xd'),'port':0x18eb});var socket=require(_0x03b3('0xe'))(new Redis(config[_0x03b3('0xb')]));require(_0x03b3('0xf'))[_0x03b3('0x10')](socket);function respondWithRpcPromise(_0x108b5d,_0x107ad6,_0x36743e){return new BPromise(function(_0x282c7b,_0x159a09){return client[_0x03b3('0x11')](_0x108b5d,_0x36743e)[_0x03b3('0x12')](function(_0x5ed5cd){logger['info'](_0x03b3('0x13'),_0x107ad6,_0x03b3('0x14'));logger[_0x03b3('0x15')](_0x03b3('0x16'),_0x107ad6,'request\x20sent',JSON[_0x03b3('0x17')](_0x5ed5cd));if(_0x5ed5cd[_0x03b3('0x18')]){if(_0x5ed5cd['error']['code']===0x1f4){logger['error'](_0x03b3('0x13'),_0x107ad6,_0x5ed5cd[_0x03b3('0x18')][_0x03b3('0x19')]);return _0x159a09(_0x5ed5cd[_0x03b3('0x18')][_0x03b3('0x19')]);}logger[_0x03b3('0x18')](_0x03b3('0x13'),_0x107ad6,_0x5ed5cd[_0x03b3('0x18')]['message']);return _0x282c7b(_0x5ed5cd[_0x03b3('0x18')]['message']);}else{logger[_0x03b3('0x1a')](_0x03b3('0x13'),_0x107ad6,'request\x20sent');_0x282c7b(_0x5ed5cd[_0x03b3('0x1b')]['message']);}})[_0x03b3('0x1c')](function(_0xecc7e2){logger[_0x03b3('0x18')](_0x03b3('0x13'),_0x107ad6,_0xecc7e2);_0x159a09(_0xecc7e2);});});}exports[_0x03b3('0x1d')]=function(_0x17942b){var _0x377682=this;return new Promise(function(_0x5324a9,_0x4231c3){return db[_0x03b3('0x1e')][_0x03b3('0x1f')](_0x17942b['body'],{'raw':_0x17942b['options']?_0x17942b[_0x03b3('0x20')][_0x03b3('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17942b[_0x03b3('0x20')]?_0x17942b[_0x03b3('0x20')]['where']||null:null,'attributes':_0x17942b['options']?_0x17942b[_0x03b3('0x20')]['attributes']||null:null,'limit':_0x17942b[_0x03b3('0x20')]?_0x17942b[_0x03b3('0x20')][_0x03b3('0x22')]||null:null})[_0x03b3('0x12')](function(_0x2e2bb7){logger[_0x03b3('0x1a')](_0x03b3('0x1d'),_0x17942b);logger[_0x03b3('0x15')](_0x03b3('0x1d'),_0x17942b,JSON['stringify'](_0x2e2bb7));_0x5324a9(_0x2e2bb7);})[_0x03b3('0x1c')](function(_0x2df433){logger[_0x03b3('0x18')]('UpdateWhatsappInteraction',_0x2df433[_0x03b3('0x19')],_0x17942b);_0x4231c3(_0x377682[_0x03b3('0x18')](0x1f4,_0x2df433[_0x03b3('0x19')]));});});};exports[_0x03b3('0x23')]=function(_0x192d20){return new Promise(function(_0x5a4197,_0xb0cb33){return db[_0x03b3('0x1e')][_0x03b3('0x24')]({'where':_0x192d20['options']?_0x192d20['options'][_0x03b3('0x25')]||null:null})['then'](function(_0x4d41be){if(_0x4d41be){return _0x4d41be['addTags'](_0x192d20['body'][_0x03b3('0x26')],_[_0x03b3('0x27')](_0x192d20['body'],[_0x03b3('0x26'),'id'])||{});}})['spread'](function(_0x1ea230){logger[_0x03b3('0x1a')](_0x03b3('0x28'),_0x192d20);logger['debug']('AddTags',_0x192d20,JSON['stringify'](_0x1ea230));_0x5a4197(_0x1ea230);})[_0x03b3('0x1c')](function(_0x42f647){logger[_0x03b3('0x18')](_0x03b3('0x28'),_0x42f647['message'],_0x192d20);_0xb0cb33(_this[_0x03b3('0x18')](0x1f4,_0x42f647[_0x03b3('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 6ad4c0e..1ac2c61 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 _0xa879=['register','length','whatsappInteraction:','./whatsappInteraction.events','save','remove','update','emit'];(function(_0x15b25b,_0x5af32f){var _0x56a7c3=function(_0x1374c6){while(--_0x1374c6){_0x15b25b['push'](_0x15b25b['shift']());}};_0x56a7c3(++_0x5af32f);}(_0xa879,0x123));var _0x9a87=function(_0x3c80b1,_0x10698d){_0x3c80b1=_0x3c80b1-0x0;var _0xa84632=_0xa879[_0x3c80b1];return _0xa84632;};'use strict';var WhatsappInteractionEvents=require(_0x9a87('0x0'));var events=[_0x9a87('0x1'),_0x9a87('0x2'),_0x9a87('0x3')];function createListener(_0x580698,_0x1c1c60){return function(_0x5d6967){_0x1c1c60[_0x9a87('0x4')](_0x580698,_0x5d6967);};}function removeListener(_0x547ab7,_0x2ae7bf){return function(){WhatsappInteractionEvents['removeListener'](_0x547ab7,_0x2ae7bf);};}exports[_0x9a87('0x5')]=function(_0x7edf09){for(var _0x397d03=0x0,_0x29324a=events[_0x9a87('0x6')];_0x397d03<_0x29324a;_0x397d03++){var _0x5562b4=events[_0x397d03];var _0x6233fa=createListener(_0x9a87('0x7')+_0x5562b4,_0x7edf09);WhatsappInteractionEvents['on'](_0x5562b4,_0x6233fa);}}; \ No newline at end of file +var _0x1ce0=['save','remove','update','emit','register','whatsappInteraction:','./whatsappInteraction.events'];(function(_0x547e27,_0x43f4ad){var _0x4b0697=function(_0xa16261){while(--_0xa16261){_0x547e27['push'](_0x547e27['shift']());}};_0x4b0697(++_0x43f4ad);}(_0x1ce0,0x76));var _0x01ce=function(_0x584f66,_0x39a037){_0x584f66=_0x584f66-0x0;var _0x3908b4=_0x1ce0[_0x584f66];return _0x3908b4;};'use strict';var WhatsappInteractionEvents=require(_0x01ce('0x0'));var events=[_0x01ce('0x1'),_0x01ce('0x2'),_0x01ce('0x3')];function createListener(_0x1b027e,_0x25bd0b){return function(_0xc58ab1){_0x25bd0b[_0x01ce('0x4')](_0x1b027e,_0xc58ab1);};}function removeListener(_0x39eb0d,_0x3c04a9){return function(){WhatsappInteractionEvents['removeListener'](_0x39eb0d,_0x3c04a9);};}exports[_0x01ce('0x5')]=function(_0x5079db){for(var _0x1c033c=0x0,_0x4fa15a=events['length'];_0x1c033c<_0x4fa15a;_0x1c033c++){var _0x5af07c=events[_0x1c033c];var _0x180e19=createListener(_0x01ce('0x6')+_0x5af07c,_0x5079db);WhatsappInteractionEvents['on'](_0x5af07c,_0x180e19);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 8ee8160..cdd4e7a 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 _0xfd7b=['/:id','/:id/accept','accept','put','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','get','/describe','describe','post','tracked','whatsapp','whatsappmessage:create','/:id/status','status'];(function(_0x3d1b44,_0x87f8ec){var _0x535e56=function(_0x133433){while(--_0x133433){_0x3d1b44['push'](_0x3d1b44['shift']());}};_0x535e56(++_0x87f8ec);}(_0xfd7b,0x159));var _0xbfd7=function(_0x1ca9e9,_0x1c4391){_0x1ca9e9=_0x1ca9e9-0x0;var _0x309f3c=_0xfd7b[_0x1ca9e9];return _0x309f3c;};'use strict';var multer=require(_0xbfd7('0x0'));var util=require(_0xbfd7('0x1'));var path=require('path');var timeout=require(_0xbfd7('0x2'));var express=require(_0xbfd7('0x3'));var router=express[_0xbfd7('0x4')]();var fs_extra=require(_0xbfd7('0x5'));var auth=require(_0xbfd7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbfd7('0x7'));var controller=require(_0xbfd7('0x8'));router['get']('/',auth[_0xbfd7('0x9')](),controller['index']);router[_0xbfd7('0xa')](_0xbfd7('0xb'),auth['isAuthenticated'](),controller[_0xbfd7('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xbfd7('0xd')]('/',auth[_0xbfd7('0x9')](),interaction[_0xbfd7('0xe')](_0xbfd7('0xf'),_0xbfd7('0x10')),controller['create']);router[_0xbfd7('0xd')](_0xbfd7('0x11'),controller[_0xbfd7('0x12')]);router['put'](_0xbfd7('0x13'),auth[_0xbfd7('0x9')](),controller['update']);router['put'](_0xbfd7('0x14'),auth['isAuthenticated'](),controller[_0xbfd7('0x15')]);router[_0xbfd7('0x16')](_0xbfd7('0x17'),auth['isAuthenticated'](),controller[_0xbfd7('0x18')]);router[_0xbfd7('0x19')](_0xbfd7('0x13'),auth[_0xbfd7('0x9')](),controller[_0xbfd7('0x1a')]);module[_0xbfd7('0x1b')]=router; \ No newline at end of file +var _0xac42=['whatsapp','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','exports','multer','path','express','Router','fs-extra','get','isAuthenticated','/describe','describe','/:id','show','post','tracked'];(function(_0x1e8326,_0x4791d8){var _0x5417e5=function(_0x294ce7){while(--_0x294ce7){_0x1e8326['push'](_0x1e8326['shift']());}};_0x5417e5(++_0x4791d8);}(_0xac42,0x1e7));var _0x2ac4=function(_0x58eed6,_0x49a046){_0x58eed6=_0x58eed6-0x0;var _0x381fa7=_0xac42[_0x58eed6];return _0x381fa7;};'use strict';var multer=require(_0x2ac4('0x0'));var util=require('util');var path=require(_0x2ac4('0x1'));var timeout=require('connect-timeout');var express=require(_0x2ac4('0x2'));var router=express[_0x2ac4('0x3')]();var fs_extra=require(_0x2ac4('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappMessage.controller');router[_0x2ac4('0x5')]('/',auth[_0x2ac4('0x6')](),controller['index']);router[_0x2ac4('0x5')](_0x2ac4('0x7'),auth['isAuthenticated'](),controller[_0x2ac4('0x8')]);router[_0x2ac4('0x5')](_0x2ac4('0x9'),auth['isAuthenticated'](),controller[_0x2ac4('0xa')]);router[_0x2ac4('0xb')]('/',auth['isAuthenticated'](),interaction[_0x2ac4('0xc')](_0x2ac4('0xd'),'whatsappmessage:create'),controller[_0x2ac4('0xe')]);router[_0x2ac4('0xb')](_0x2ac4('0xf'),controller[_0x2ac4('0x10')]);router[_0x2ac4('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x2ac4('0x12')]);router['put'](_0x2ac4('0x13'),auth[_0x2ac4('0x6')](),controller[_0x2ac4('0x14')]);router[_0x2ac4('0x11')](_0x2ac4('0x15'),auth[_0x2ac4('0x6')](),controller[_0x2ac4('0x16')]);router[_0x2ac4('0x17')](_0x2ac4('0x9'),auth[_0x2ac4('0x6')](),controller['destroy']);module[_0x2ac4('0x18')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 4ea7211..688ab8e 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 _0xd82a=['out','STRING','DATE','BOOLEAN','TEXT','sequelize','medium','ENUM'];(function(_0x589b37,_0x5a7483){var _0x5f2c82=function(_0x1c0f7d){while(--_0x1c0f7d){_0x589b37['push'](_0x589b37['shift']());}};_0x5f2c82(++_0x5a7483);}(_0xd82a,0x7d));var _0xad82=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0xd82a[_0x1f36bb];return _0xaf97fa;};'use strict';var Sequelize=require(_0xad82('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0xad82('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xad82('0x2')]('in',_0xad82('0x3')),'defaultValue':_0xad82('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0xad82('0x4')](0xbe)},'phone':{'type':Sequelize[_0xad82('0x4')]},'readAt':{'type':Sequelize[_0xad82('0x5')]},'secret':{'type':Sequelize[_0xad82('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xad82('0x7')]}}; \ No newline at end of file +var _0x323e=['BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports','TEXT','medium'];(function(_0x5f0d20,_0x106de6){var _0x5be8ba=function(_0x2d2b6a){while(--_0x2d2b6a){_0x5f0d20['push'](_0x5f0d20['shift']());}};_0x5be8ba(++_0x106de6);}(_0x323e,0x188));var _0xe323=function(_0xcae6c9,_0x47c380){_0xcae6c9=_0xcae6c9-0x0;var _0x4d98d7=_0x323e[_0xcae6c9];return _0x4d98d7;};'use strict';var Sequelize=require(_0xe323('0x0'));module[_0xe323('0x1')]={'body':{'type':Sequelize[_0xe323('0x2')](_0xe323('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xe323('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe323('0x5')]('in',_0xe323('0x6')),'defaultValue':_0xe323('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xe323('0x7')](0xbe)},'phone':{'type':Sequelize[_0xe323('0x7')]},'readAt':{'type':Sequelize[_0xe323('0x8')]},'secret':{'type':Sequelize[_0xe323('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xe323('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index b9e6334..7262d23 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 _0xa04a=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','destroy','name','send','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filters','filter','merge','includeAll','include','findAll','rows','show','options','create','body','update','find','params','describe','whatsapp-interactions','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','format','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','event','EventManager','acceptmessage','whatsapp','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','sequelize','QueryTypes','motionChannel','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x9c4b0e,_0x16e233){var _0x2743b8=function(_0x3c1ddc){while(--_0x3c1ddc){_0x9c4b0e['push'](_0x9c4b0e['shift']());}};_0x2743b8(++_0x16e233);}(_0xa04a,0x19c));var _0xaa04=function(_0x1b4587,_0x2add59){_0x1b4587=_0x1b4587-0x0;var _0x771ed4=_0xa04a[_0x1b4587];return _0x771ed4;};'use strict';var emlformat=require(_0xaa04('0x0'));var rimraf=require(_0xaa04('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa04('0x2'));var rp=require(_0xaa04('0x3'));var moment=require(_0xaa04('0x4'));var BPromise=require(_0xaa04('0x5'));var Mustache=require('mustache');var util=require(_0xaa04('0x6'));var path=require(_0xaa04('0x7'));var sox=require(_0xaa04('0x8'));var csv=require('to-csv');var ejs=require(_0xaa04('0x9'));var fs=require('fs');var fs_extra=require(_0xaa04('0xa'));var _=require(_0xaa04('0xb'));var squel=require(_0xaa04('0xc'));var crypto=require(_0xaa04('0xd'));var jsforce=require(_0xaa04('0xe'));var deskjs=require(_0xaa04('0xf'));var toCsv=require('to-csv');var querystring=require(_0xaa04('0x10'));var Papa=require('papaparse');var Redis=require(_0xaa04('0x11'));var authService=require(_0xaa04('0x12'));var qs=require(_0xaa04('0x13'));var as=require(_0xaa04('0x14'));var hardwareService=require(_0xaa04('0x15'));var logger=require(_0xaa04('0x16'))(_0xaa04('0x17'));var utils=require(_0xaa04('0x18'));var config=require(_0xaa04('0x19'));var licenseUtil=require(_0xaa04('0x1a'));var db=require('../../mysqldb')['db'];config[_0xaa04('0x1b')]=_[_0xaa04('0x1c')](config[_0xaa04('0x1b')],{'host':_0xaa04('0x1d'),'port':0x18eb});var socket=require(_0xaa04('0x1e'))(new Redis(config[_0xaa04('0x1b')]));require(_0xaa04('0x1f'))['register'](socket);var jayson=require(_0xaa04('0x20'));var client=jayson[_0xaa04('0x21')][_0xaa04('0x22')]({'port':0x232c});var client9002=jayson[_0xaa04('0x21')][_0xaa04('0x22')]({'port':0x232a});function respondWithRpcPromise(_0xfe32,_0x4dfd44,_0x107c33,_0x37f8e9){return new BPromise(function(_0xf6109a,_0x127807){var _0x1cd339=_0x37f8e9||client;return _0x1cd339[_0xaa04('0x23')](_0xfe32,_0x107c33)[_0xaa04('0x24')](function(_0x4087f3){logger[_0xaa04('0x25')](_0xaa04('0x26'),_0x4dfd44,'request\x20sent');logger[_0xaa04('0x27')](_0xaa04('0x28'),_0x4dfd44,'request\x20sent',JSON[_0xaa04('0x29')](_0x4087f3));if(_0x4087f3['error']){if(_0x4087f3[_0xaa04('0x2a')][_0xaa04('0x2b')]===0x1f4){logger[_0xaa04('0x2a')]('WhatsappMessage,\x20%s,\x20%s',_0x4dfd44,_0x4087f3[_0xaa04('0x2a')][_0xaa04('0x2c')]);return _0x127807(_0x4087f3[_0xaa04('0x2a')]['message']);}logger[_0xaa04('0x2a')](_0xaa04('0x26'),_0x4dfd44,_0x4087f3[_0xaa04('0x2a')][_0xaa04('0x2c')]);return _0xf6109a(_0x4087f3[_0xaa04('0x2a')][_0xaa04('0x2c')]);}else{logger[_0xaa04('0x25')](_0xaa04('0x26'),_0x4dfd44,'request\x20sent');_0xf6109a(_0x4087f3['result'][_0xaa04('0x2c')]);}})[_0xaa04('0x2d')](function(_0x5c7732){logger[_0xaa04('0x2a')]('WhatsappMessage,\x20%s,\x20%s',_0x4dfd44,_0x5c7732);_0x127807(_0x5c7732);});});}function respondWithStatusCode(_0x5d773d,_0xe085e7){_0xe085e7=_0xe085e7||0xcc;return function(_0x315001){if(_0x315001){return _0x5d773d[_0xaa04('0x2e')](_0xe085e7);}return _0x5d773d[_0xaa04('0x2f')](_0xe085e7)[_0xaa04('0x30')]();};}function respondWithResult(_0x25fc98,_0x3e295d){_0x3e295d=_0x3e295d||0xc8;return function(_0x5c44e7){if(_0x5c44e7){return _0x25fc98[_0xaa04('0x2f')](_0x3e295d)['json'](_0x5c44e7);}};}function respondWithFilteredResult(_0x2117cc,_0x232c38){return function(_0x47c96a){if(_0x47c96a){var _0x5a5725=typeof _0x232c38[_0xaa04('0x31')]===_0xaa04('0x32')&&typeof _0x232c38[_0xaa04('0x33')]===_0xaa04('0x32');var _0x11fbe7=_0x47c96a['count'];var _0x3f129d=_0x5a5725?0x0:_0x232c38[_0xaa04('0x31')];var _0xe0b51=_0x5a5725?_0x47c96a[_0xaa04('0x34')]:_0x232c38['offset']+_0x232c38[_0xaa04('0x33')];var _0x8df37f;if(_0xe0b51>=_0x11fbe7){_0xe0b51=_0x11fbe7;_0x8df37f=0xc8;}else{_0x8df37f=0xce;}_0x2117cc['status'](_0x8df37f);return _0x2117cc[_0xaa04('0x35')](_0xaa04('0x36'),_0x3f129d+'-'+_0xe0b51+'/'+_0x11fbe7)[_0xaa04('0x37')](_0x47c96a);}return null;};}function patchUpdates(_0x6aca8d){return function(_0x4e639b){try{jsonpatch[_0xaa04('0x38')](_0x4e639b,_0x6aca8d,!![]);}catch(_0x28db4d){return BPromise[_0xaa04('0x39')](_0x28db4d);}return _0x4e639b[_0xaa04('0x3a')]();};}function saveUpdates(_0x539c2c,_0x5508fe){return function(_0x185a07){if(_0x185a07){return _0x185a07['update'](_0x539c2c)['then'](function(_0x44ae51){return _0x44ae51;});}return null;};}function removeEntity(_0x39227e,_0x53db9c){return function(_0x19e777){if(_0x19e777){return _0x19e777[_0xaa04('0x3b')]()[_0xaa04('0x24')](function(){_0x39227e['status'](0xcc)[_0xaa04('0x30')]();});}};}function handleEntityNotFound(_0x4194f0,_0x187c89){return function(_0x309fce){if(!_0x309fce){_0x4194f0['sendStatus'](0x194);}return _0x309fce;};}function handleError(_0x195ada,_0x14b519){_0x14b519=_0x14b519||0x1f4;return function(_0x42c9b2){logger[_0xaa04('0x2a')](_0x42c9b2['stack']);if(_0x42c9b2['name']){delete _0x42c9b2[_0xaa04('0x3c')];}_0x195ada[_0xaa04('0x2f')](_0x14b519)[_0xaa04('0x3d')](_0x42c9b2);};}exports['index']=function(_0x4d129b,_0x4b63dc){var _0x310e03={},_0x2b0c5b={},_0x49e047={'count':0x0,'rows':[]};var _0x3af23f=_[_0xaa04('0x3e')](db[_0xaa04('0x3f')][_0xaa04('0x40')],function(_0x3d24a0){return{'name':_0x3d24a0[_0xaa04('0x41')],'type':_0x3d24a0[_0xaa04('0x42')][_0xaa04('0x43')]};});_0x2b0c5b[_0xaa04('0x44')]=_[_0xaa04('0x3e')](_0x3af23f,_0xaa04('0x3c'));_0x2b0c5b[_0xaa04('0x45')]=_[_0xaa04('0x46')](_0x4d129b['query']);_0x2b0c5b['filters']=_[_0xaa04('0x47')](_0x2b0c5b[_0xaa04('0x44')],_0x2b0c5b[_0xaa04('0x45')]);_0x310e03[_0xaa04('0x48')]=_['intersection'](_0x2b0c5b['model'],qs['fields'](_0x4d129b[_0xaa04('0x45')][_0xaa04('0x49')]));_0x310e03[_0xaa04('0x48')]=_0x310e03[_0xaa04('0x48')][_0xaa04('0x4a')]?_0x310e03[_0xaa04('0x48')]:_0x2b0c5b[_0xaa04('0x44')];if(!_0x4d129b['query'][_0xaa04('0x4b')]('nolimit')){_0x310e03[_0xaa04('0x33')]=qs[_0xaa04('0x33')](_0x4d129b[_0xaa04('0x45')][_0xaa04('0x33')]);_0x310e03[_0xaa04('0x31')]=qs['offset'](_0x4d129b['query'][_0xaa04('0x31')]);}_0x310e03['order']=qs[_0xaa04('0x4c')](_0x4d129b[_0xaa04('0x45')][_0xaa04('0x4c')]);_0x310e03[_0xaa04('0x4d')]=qs['filters'](_[_0xaa04('0x4e')](_0x4d129b['query'],_0x2b0c5b[_0xaa04('0x4f')]),_0x3af23f);if(_0x4d129b[_0xaa04('0x45')][_0xaa04('0x50')]){_0x310e03['where']=_[_0xaa04('0x51')](_0x310e03[_0xaa04('0x4d')],{'$or':_[_0xaa04('0x3e')](_0x3af23f,function(_0x3f969f){if(_0x3f969f['type']!=='VIRTUAL'){var _0x4ea763={};_0x4ea763[_0x3f969f['name']]={'$like':'%'+_0x4d129b['query'][_0xaa04('0x50')]+'%'};return _0x4ea763;}})});}_0x310e03=_[_0xaa04('0x51')]({},_0x310e03,_0x4d129b['options']);var _0x59779f={'where':_0x310e03[_0xaa04('0x4d')]};return db[_0xaa04('0x3f')]['count'](_0x59779f)[_0xaa04('0x24')](function(_0x3aa967){_0x49e047[_0xaa04('0x34')]=_0x3aa967;if(_0x4d129b['query'][_0xaa04('0x52')]){_0x310e03[_0xaa04('0x53')]=[{'all':!![]}];}return db[_0xaa04('0x3f')][_0xaa04('0x54')](_0x310e03);})['then'](function(_0x55df23){_0x49e047[_0xaa04('0x55')]=_0x55df23;return _0x49e047;})[_0xaa04('0x24')](respondWithFilteredResult(_0x4b63dc,_0x310e03))[_0xaa04('0x2d')](handleError(_0x4b63dc,null));};exports[_0xaa04('0x56')]=function(_0x5a549a,_0x1ab456){var _0x389dd8={'raw':!![],'where':{'id':_0x5a549a['params']['id']}},_0x1d5b3a={};_0x1d5b3a[_0xaa04('0x44')]=_['keys'](db['WhatsappMessage'][_0xaa04('0x40')]);_0x1d5b3a[_0xaa04('0x45')]=_[_0xaa04('0x46')](_0x5a549a[_0xaa04('0x45')]);_0x1d5b3a[_0xaa04('0x4f')]=_[_0xaa04('0x47')](_0x1d5b3a[_0xaa04('0x44')],_0x1d5b3a[_0xaa04('0x45')]);_0x389dd8[_0xaa04('0x48')]=_[_0xaa04('0x47')](_0x1d5b3a[_0xaa04('0x44')],qs['fields'](_0x5a549a[_0xaa04('0x45')][_0xaa04('0x49')]));_0x389dd8['attributes']=_0x389dd8[_0xaa04('0x48')][_0xaa04('0x4a')]?_0x389dd8['attributes']:_0x1d5b3a[_0xaa04('0x44')];if(_0x5a549a[_0xaa04('0x45')][_0xaa04('0x52')]){_0x389dd8[_0xaa04('0x53')]=[{'all':!![]}];}_0x389dd8=_[_0xaa04('0x51')]({},_0x389dd8,_0x5a549a[_0xaa04('0x57')]);return db['WhatsappMessage']['find'](_0x389dd8)[_0xaa04('0x24')](handleEntityNotFound(_0x1ab456,null))['then'](respondWithResult(_0x1ab456,null))[_0xaa04('0x2d')](handleError(_0x1ab456,null));};exports['create']=function(_0xe4e4fd,_0x4988e2){return db['WhatsappMessage'][_0xaa04('0x58')](_0xe4e4fd[_0xaa04('0x59')],{})['then'](respondWithResult(_0x4988e2,0xc9))[_0xaa04('0x2d')](handleError(_0x4988e2,null));};exports[_0xaa04('0x5a')]=function(_0x13d910,_0x22fc17){if(_0x13d910[_0xaa04('0x59')]['id']){delete _0x13d910['body']['id'];}return db[_0xaa04('0x3f')][_0xaa04('0x5b')]({'where':{'id':_0x13d910[_0xaa04('0x5c')]['id']}})[_0xaa04('0x24')](handleEntityNotFound(_0x22fc17,null))[_0xaa04('0x24')](saveUpdates(_0x13d910[_0xaa04('0x59')],null))[_0xaa04('0x24')](respondWithResult(_0x22fc17,null))[_0xaa04('0x2d')](handleError(_0x22fc17,null));};exports[_0xaa04('0x3b')]=function(_0x54fb92,_0x1b2206){return db[_0xaa04('0x3f')]['find']({'where':{'id':_0x54fb92['params']['id']}})[_0xaa04('0x24')](handleEntityNotFound(_0x1b2206,null))[_0xaa04('0x24')](removeEntity(_0x1b2206,null))[_0xaa04('0x2d')](handleError(_0x1b2206,null));};exports['describe']=function(_0x27991f,_0x48a745){return db['WhatsappMessage'][_0xaa04('0x5d')]()[_0xaa04('0x24')](respondWithResult(_0x48a745,null))[_0xaa04('0x2d')](handleError(_0x48a745,null));};var interaction_log=require(_0xaa04('0x16'))(_0xaa04('0x5e'));exports[_0xaa04('0x5f')]=function(_0x441376,_0x3e3036,_0x5e0c1d){var _0x1c5161={'agent':{},'channel':'whatsapp'};if(_0x441376['body']['id']){delete _0x441376[_0xaa04('0x59')]['id'];}_0x441376[_0xaa04('0x59')][_0xaa04('0x60')]=!![];_0x441376['body'][_0xaa04('0x61')]=moment()['format'](_0xaa04('0x62'));_0x441376[_0xaa04('0x59')][_0xaa04('0x63')]=_0x441376[_0xaa04('0x59')][_0xaa04('0x63')]||_0x441376[_0xaa04('0x64')]['id'];_0x1c5161[_0xaa04('0x65')]['id']=_0x441376[_0xaa04('0x59')]['UserId'];return db[_0xaa04('0x3f')][_0xaa04('0x5b')]({'where':{'id':_0x441376[_0xaa04('0x5c')]['id'],'UserId':null}})[_0xaa04('0x24')](handleEntityNotFound(_0x3e3036,null))['then'](saveUpdates(_0x441376['body'],null))[_0xaa04('0x24')](function(_0x258b04){if(_0x258b04){_0x1c5161[_0xaa04('0x2c')]=_0x258b04[_0xaa04('0x66')]({'plain':!![]});return db[_0xaa04('0x67')]['find']({'where':{'id':_0x258b04[_0xaa04('0x68')]}});}return null;})[_0xaa04('0x24')](handleEntityNotFound(_0x3e3036,null))[_0xaa04('0x24')](function(_0x13e71f){if(_0x13e71f){return _0x13e71f[_0xaa04('0x5a')]({'UserId':_0x441376[_0xaa04('0x59')][_0xaa04('0x63')],'read1stAt':_[_0xaa04('0x69')](_0x13e71f[_0xaa04('0x6a')])?moment()[_0xaa04('0x6b')](_0xaa04('0x62')):undefined});}return null;})[_0xaa04('0x24')](function(_0x17fe0f){if(_0x17fe0f){_0x1c5161['interaction']=_0x17fe0f[_0xaa04('0x66')]({'plain':!![]});interaction_log['info'](_0xaa04('0x6c'),_0x441376['user']['id'],_0x441376[_0xaa04('0x64')][_0xaa04('0x3c')],_0x441376['user'][_0xaa04('0x6d')],_0x1c5161[_0xaa04('0x6e')]['id'],_0x441376['body']?JSON[_0xaa04('0x29')](_0x441376[_0xaa04('0x59')]):'null');return respondWithRpcPromise(_0xaa04('0x6f'),'acceptMessage',_0x1c5161);}return null;})[_0xaa04('0x24')](function(_0x4c91bf){var _0x1b08c1=_0xaa04('0x70')+_0x4c91bf[_0xaa04('0x2c')][_0xaa04('0x71')];return db['sequelize'][_0xaa04('0x45')](_0x1b08c1,{'type':db[_0xaa04('0x72')]['QueryTypes'][_0xaa04('0x73')],'raw':!![]})[_0xaa04('0x24')](function(_0x94f33){return _0x94f33;});})['then'](function(_0x2cd4ae){if(_0x2cd4ae){_0x1c5161[_0xaa04('0x2c')][_0xaa04('0x74')]=_0x2cd4ae[0x0];if(!_0x441376[_0xaa04('0x59')][_0xaa04('0x63')])return;return db[_0xaa04('0x75')][_0xaa04('0x5b')]({'where':{'id':_0x441376[_0xaa04('0x59')][_0xaa04('0x63')],'role':_0xaa04('0x65')},'attributes':['id','name',_0xaa04('0x76'),_0xaa04('0x77'),_0xaa04('0x78')],'raw':!![]});}return null;})[_0xaa04('0x24')](function(_0x423460){if(!_0x423460)return null;_0x1c5161['message'][_0xaa04('0x65')]=_0x423460;return _0x1c5161;})[_0xaa04('0x24')](function(_0x103058){if(_0x103058){if(_0x441376[_0xaa04('0x59')]['manual']){_0x1c5161[_0xaa04('0x2c')][_0xaa04('0x79')]=util['format'](_0xaa04('0x7a'),_0x441376[_0xaa04('0x64')]['name']);_0x1c5161[_0xaa04('0x2c')][_0xaa04('0x7b')]=_0x1c5161[_0xaa04('0x7b')];_0x1c5161['message']['motionChannel']=_0x1c5161[_0xaa04('0x7b')];_0x1c5161[_0xaa04('0x2c')][_0xaa04('0x7c')]=_0xaa04('0x5f');return respondWithRpcPromise(_0xaa04('0x7d'),_0xaa04('0x7d'),{'event':_0xaa04('0x7e'),'message':_0x1c5161['message']},client9002)[_0xaa04('0x24')](function(){return _0x1c5161;});}return _0x1c5161;}return null;})[_0xaa04('0x24')](respondWithResult(_0x3e3036,null))[_0xaa04('0x2d')](handleError(_0x3e3036,null));};var interaction_log=require('../../config/logger')(_0xaa04('0x5e'));exports[_0xaa04('0x39')]=function(_0xac4819,_0x1bedad,_0x5416c7){var _0x378f14={'agent':{},'channel':_0xaa04('0x7f')};if(_0xac4819[_0xaa04('0x59')]['id']){delete _0xac4819[_0xaa04('0x59')]['id'];}_0xac4819[_0xaa04('0x59')][_0xaa04('0x63')]=_0xac4819[_0xaa04('0x59')]['UserId']||_0xac4819[_0xaa04('0x64')]['id'];_0x378f14['agent']['id']=_0xac4819['body'][_0xaa04('0x63')];return db[_0xaa04('0x3f')][_0xaa04('0x5b')]({'where':{'id':_0xac4819[_0xaa04('0x5c')]['id'],'UserId':null}})[_0xaa04('0x24')](handleEntityNotFound(_0x1bedad,null))[_0xaa04('0x24')](function(_0x4573fc){if(_0x4573fc){_0x378f14[_0xaa04('0x2c')]=_0x4573fc[_0xaa04('0x66')]({'plain':!![]});return db[_0xaa04('0x67')]['find']({'where':{'id':_0x4573fc['WhatsappInteractionId']}});}return null;})[_0xaa04('0x24')](handleEntityNotFound(_0x1bedad,null))[_0xaa04('0x24')](function(_0x450b87){if(_0x450b87){_0x378f14[_0xaa04('0x6e')]=_0x450b87['get']({'plain':!![]});interaction_log[_0xaa04('0x25')](_0xaa04('0x80'),_0xac4819['user']['id'],_0xac4819[_0xaa04('0x64')][_0xaa04('0x3c')],_0xac4819[_0xaa04('0x64')]['role'],_0x378f14[_0xaa04('0x6e')]['id'],_0xac4819[_0xaa04('0x59')]?JSON[_0xaa04('0x29')](_0xac4819[_0xaa04('0x59')]):_0xaa04('0x81'));return respondWithRpcPromise(_0xaa04('0x82'),_0xaa04('0x83'),_0x378f14);}return null;})['then'](function(_0x527fb5){var _0x552d7a=_0xaa04('0x70')+_0x527fb5[_0xaa04('0x2c')]['ContactId'];return db[_0xaa04('0x84')]['query'](_0x552d7a,{'type':db[_0xaa04('0x72')][_0xaa04('0x85')]['SELECT'],'raw':!![]})[_0xaa04('0x24')](function(_0x2303bd){return _0x2303bd;});})['then'](function(_0x421edb){if(_0x421edb){_0x378f14[_0xaa04('0x2c')]['contact']=_0x421edb[0x0];if(!_0xac4819[_0xaa04('0x59')][_0xaa04('0x63')])return;return db[_0xaa04('0x75')][_0xaa04('0x5b')]({'where':{'id':_0xac4819[_0xaa04('0x59')][_0xaa04('0x63')],'role':'agent'},'attributes':['id','name',_0xaa04('0x76'),_0xaa04('0x77'),_0xaa04('0x78')],'raw':!![]});}return null;})[_0xaa04('0x24')](function(_0x3cebfa){if(!_0x3cebfa)return null;_0x378f14[_0xaa04('0x2c')][_0xaa04('0x65')]=_0x3cebfa;return _0x378f14;})[_0xaa04('0x24')](function(_0x604ad7){if(_0x604ad7){_0x604ad7['message'][_0xaa04('0x79')]=util[_0xaa04('0x6b')](_0xaa04('0x7a'),_0xac4819[_0xaa04('0x64')]['name']);_0x604ad7[_0xaa04('0x2c')][_0xaa04('0x7b')]=_0x378f14[_0xaa04('0x7b')];_0x604ad7[_0xaa04('0x2c')][_0xaa04('0x86')]=_0x378f14['channel'];_0x604ad7['message'][_0xaa04('0x7c')]=_0xaa04('0x39');respondWithRpcPromise(_0xaa04('0x7d'),_0xaa04('0x7d'),{'event':_0xaa04('0x87'),'message':_0x604ad7[_0xaa04('0x2c')]},client9002);return _0x378f14;}return null;})['then'](respondWithResult(_0x1bedad,null))['catch'](handleError(_0x1bedad,null));};exports[_0xaa04('0x2f')]=function(_0x513feb,_0x597ffe,_0x3055d2){if(_0x513feb[_0xaa04('0x59')]['id']){delete _0x513feb[_0xaa04('0x59')]['id'];}var _0x515775;return db[_0xaa04('0x3f')][_0xaa04('0x5b')]({'where':{'id':_0x513feb[_0xaa04('0x5c')]['id']}})[_0xaa04('0x24')](handleEntityNotFound(_0x597ffe,null))['then'](function(_0x96c407){if(_0x96c407){_0x515775=_0x96c407;return db['WhatsappAccount'][_0xaa04('0x5b')]({'where':{'id':_0x96c407[_0xaa04('0x88')]}});}})['then'](handleEntityNotFound(_0x597ffe,null))[_0xaa04('0x24')](function(_0x5d24b4){if(_0x5d24b4){logger[_0xaa04('0x27')](_0xaa04('0x89'),_0xaa04('0x2f'),_0xaa04('0x8a'),_0x5d24b4[_0xaa04('0x42')],util[_0xaa04('0x8b')](_0x513feb['body'],{'showHidden':![],'depth':null}));switch(_0x5d24b4[_0xaa04('0x42')]){case _0xaa04('0x8c'):if(_0x513feb[_0xaa04('0x59')][_0xaa04('0x8d')]&&_0x513feb[_0xaa04('0x59')][_0xaa04('0x8d')]===_0x515775['messageId']&&_0x513feb['body'][_0xaa04('0x8e')]&&_0x513feb['body'][_0xaa04('0x8e')]==='read'){return _0x515775['update']({'read':!![]});}else{logger[_0xaa04('0x2a')](_0xaa04('0x8f'),_0xaa04('0x2f'),_0xaa04('0x8c'),util[_0xaa04('0x8b')](_0x513feb[_0xaa04('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x515775;}})[_0xaa04('0x24')](respondWithResult(_0x597ffe,null))['catch'](handleError(_0x597ffe,null));}; \ No newline at end of file +var _0x9a9d=['SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','internal','interface','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','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','api','../../config/utils','../../config/environment','redis','./whatsappMessage.socket','register','jayson/promise','client','http','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','sendStatus','status','end','undefined','limit','offset','count','Content-Range','json','apply','reject','save','update','then','stack','name','send','map','WhatsappMessage','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','options','find','create','body','params','destroy','describe','../../config/logger','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','WhatsappInteraction','isNil','read1stAt','interaction','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','email','manual'];(function(_0x3c2958,_0x26bbfb){var _0x39b1cb=function(_0x686e81){while(--_0x686e81){_0x3c2958['push'](_0x3c2958['shift']());}};_0x39b1cb(++_0x26bbfb);}(_0x9a9d,0x1b7));var _0xd9a9=function(_0x36e057,_0x52b965){_0x36e057=_0x36e057-0x0;var _0x4cbac8=_0x9a9d[_0x36e057];return _0x4cbac8;};'use strict';var emlformat=require(_0xd9a9('0x0'));var rimraf=require(_0xd9a9('0x1'));var zipdir=require(_0xd9a9('0x2'));var jsonpatch=require(_0xd9a9('0x3'));var rp=require(_0xd9a9('0x4'));var moment=require('moment');var BPromise=require(_0xd9a9('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xd9a9('0x6'));var ejs=require(_0xd9a9('0x7'));var fs=require('fs');var fs_extra=require(_0xd9a9('0x8'));var _=require(_0xd9a9('0x9'));var squel=require(_0xd9a9('0xa'));var crypto=require(_0xd9a9('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd9a9('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd9a9('0xd'));var Papa=require(_0xd9a9('0xe'));var Redis=require(_0xd9a9('0xf'));var authService=require(_0xd9a9('0x10'));var qs=require(_0xd9a9('0x11'));var as=require(_0xd9a9('0x12'));var hardwareService=require(_0xd9a9('0x13'));var logger=require('../../config/logger')(_0xd9a9('0x14'));var utils=require(_0xd9a9('0x15'));var config=require(_0xd9a9('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd9a9('0x17')]));require(_0xd9a9('0x18'))[_0xd9a9('0x19')](socket);var jayson=require(_0xd9a9('0x1a'));var client=jayson[_0xd9a9('0x1b')][_0xd9a9('0x1c')]({'port':0x232c});var client9002=jayson[_0xd9a9('0x1b')][_0xd9a9('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x319c20,_0x32f04e,_0x40db1b,_0x551395){return new BPromise(function(_0x49e508,_0x4bea4a){var _0x2ad849=_0x551395||client;return _0x2ad849[_0xd9a9('0x1d')](_0x319c20,_0x40db1b)['then'](function(_0x45273c){logger[_0xd9a9('0x1e')](_0xd9a9('0x1f'),_0x32f04e,_0xd9a9('0x20'));logger[_0xd9a9('0x21')](_0xd9a9('0x22'),_0x32f04e,_0xd9a9('0x20'),JSON['stringify'](_0x45273c));if(_0x45273c['error']){if(_0x45273c['error'][_0xd9a9('0x23')]===0x1f4){logger[_0xd9a9('0x24')](_0xd9a9('0x1f'),_0x32f04e,_0x45273c['error'][_0xd9a9('0x25')]);return _0x4bea4a(_0x45273c[_0xd9a9('0x24')][_0xd9a9('0x25')]);}logger[_0xd9a9('0x24')](_0xd9a9('0x1f'),_0x32f04e,_0x45273c[_0xd9a9('0x24')][_0xd9a9('0x25')]);return _0x49e508(_0x45273c[_0xd9a9('0x24')][_0xd9a9('0x25')]);}else{logger['info'](_0xd9a9('0x1f'),_0x32f04e,'request\x20sent');_0x49e508(_0x45273c[_0xd9a9('0x26')][_0xd9a9('0x25')]);}})[_0xd9a9('0x27')](function(_0x3f1638){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x32f04e,_0x3f1638);_0x4bea4a(_0x3f1638);});});}function respondWithStatusCode(_0x16eeb0,_0x4f5b8a){_0x4f5b8a=_0x4f5b8a||0xcc;return function(_0x2b0e61){if(_0x2b0e61){return _0x16eeb0[_0xd9a9('0x28')](_0x4f5b8a);}return _0x16eeb0[_0xd9a9('0x29')](_0x4f5b8a)[_0xd9a9('0x2a')]();};}function respondWithResult(_0x47833a,_0x18457f){_0x18457f=_0x18457f||0xc8;return function(_0x31311e){if(_0x31311e){return _0x47833a['status'](_0x18457f)['json'](_0x31311e);}};}function respondWithFilteredResult(_0x5d6c1d,_0x2b8ee6){return function(_0x3e5968){if(_0x3e5968){var _0xc968b0=typeof _0x2b8ee6['offset']===_0xd9a9('0x2b')&&typeof _0x2b8ee6[_0xd9a9('0x2c')]==='undefined';var _0x16488f=_0x3e5968['count'];var _0x43fead=_0xc968b0?0x0:_0x2b8ee6[_0xd9a9('0x2d')];var _0x4f32aa=_0xc968b0?_0x3e5968[_0xd9a9('0x2e')]:_0x2b8ee6['offset']+_0x2b8ee6[_0xd9a9('0x2c')];var _0x3aa9e5;if(_0x4f32aa>=_0x16488f){_0x4f32aa=_0x16488f;_0x3aa9e5=0xc8;}else{_0x3aa9e5=0xce;}_0x5d6c1d[_0xd9a9('0x29')](_0x3aa9e5);return _0x5d6c1d['set'](_0xd9a9('0x2f'),_0x43fead+'-'+_0x4f32aa+'/'+_0x16488f)[_0xd9a9('0x30')](_0x3e5968);}return null;};}function patchUpdates(_0x272203){return function(_0x3fbb5a){try{jsonpatch[_0xd9a9('0x31')](_0x3fbb5a,_0x272203,!![]);}catch(_0x3b71b7){return BPromise[_0xd9a9('0x32')](_0x3b71b7);}return _0x3fbb5a[_0xd9a9('0x33')]();};}function saveUpdates(_0x360b9c,_0x35de36){return function(_0x43c43e){if(_0x43c43e){return _0x43c43e[_0xd9a9('0x34')](_0x360b9c)[_0xd9a9('0x35')](function(_0x2853c4){return _0x2853c4;});}return null;};}function removeEntity(_0x5764ef,_0x282832){return function(_0x1912cd){if(_0x1912cd){return _0x1912cd['destroy']()['then'](function(){_0x5764ef[_0xd9a9('0x29')](0xcc)[_0xd9a9('0x2a')]();});}};}function handleEntityNotFound(_0x3b8086,_0x334edb){return function(_0x1f82af){if(!_0x1f82af){_0x3b8086[_0xd9a9('0x28')](0x194);}return _0x1f82af;};}function handleError(_0x31d4b4,_0xe153cc){_0xe153cc=_0xe153cc||0x1f4;return function(_0x1236e4){logger[_0xd9a9('0x24')](_0x1236e4[_0xd9a9('0x36')]);if(_0x1236e4[_0xd9a9('0x37')]){delete _0x1236e4['name'];}_0x31d4b4[_0xd9a9('0x29')](_0xe153cc)[_0xd9a9('0x38')](_0x1236e4);};}exports['index']=function(_0x58c005,_0x529e51){var _0x33283d={},_0x1dce4b={},_0x4d5e2c={'count':0x0,'rows':[]};var _0x575951=_[_0xd9a9('0x39')](db[_0xd9a9('0x3a')][_0xd9a9('0x3b')],function(_0x50bb2b){return{'name':_0x50bb2b['fieldName'],'type':_0x50bb2b[_0xd9a9('0x3c')][_0xd9a9('0x3d')]};});_0x1dce4b['model']=_[_0xd9a9('0x39')](_0x575951,_0xd9a9('0x37'));_0x1dce4b[_0xd9a9('0x3e')]=_[_0xd9a9('0x3f')](_0x58c005['query']);_0x1dce4b[_0xd9a9('0x40')]=_[_0xd9a9('0x41')](_0x1dce4b[_0xd9a9('0x42')],_0x1dce4b[_0xd9a9('0x3e')]);_0x33283d[_0xd9a9('0x43')]=_[_0xd9a9('0x41')](_0x1dce4b[_0xd9a9('0x42')],qs[_0xd9a9('0x44')](_0x58c005[_0xd9a9('0x3e')][_0xd9a9('0x44')]));_0x33283d[_0xd9a9('0x43')]=_0x33283d[_0xd9a9('0x43')]['length']?_0x33283d['attributes']:_0x1dce4b[_0xd9a9('0x42')];if(!_0x58c005[_0xd9a9('0x3e')][_0xd9a9('0x45')]('nolimit')){_0x33283d[_0xd9a9('0x2c')]=qs[_0xd9a9('0x2c')](_0x58c005['query'][_0xd9a9('0x2c')]);_0x33283d[_0xd9a9('0x2d')]=qs[_0xd9a9('0x2d')](_0x58c005[_0xd9a9('0x3e')][_0xd9a9('0x2d')]);}_0x33283d['order']=qs[_0xd9a9('0x46')](_0x58c005[_0xd9a9('0x3e')][_0xd9a9('0x46')]);_0x33283d[_0xd9a9('0x47')]=qs['filters'](_['pick'](_0x58c005[_0xd9a9('0x3e')],_0x1dce4b[_0xd9a9('0x40')]),_0x575951);if(_0x58c005[_0xd9a9('0x3e')][_0xd9a9('0x48')]){_0x33283d[_0xd9a9('0x47')]=_[_0xd9a9('0x49')](_0x33283d[_0xd9a9('0x47')],{'$or':_[_0xd9a9('0x39')](_0x575951,function(_0x56c85e){if(_0x56c85e[_0xd9a9('0x3c')]!==_0xd9a9('0x4a')){var _0x574a17={};_0x574a17[_0x56c85e[_0xd9a9('0x37')]]={'$like':'%'+_0x58c005[_0xd9a9('0x3e')][_0xd9a9('0x48')]+'%'};return _0x574a17;}})});}_0x33283d=_[_0xd9a9('0x49')]({},_0x33283d,_0x58c005['options']);var _0x2e9b6e={'where':_0x33283d[_0xd9a9('0x47')]};return db[_0xd9a9('0x3a')][_0xd9a9('0x2e')](_0x2e9b6e)[_0xd9a9('0x35')](function(_0x12b1ad){_0x4d5e2c['count']=_0x12b1ad;if(_0x58c005['query'][_0xd9a9('0x4b')]){_0x33283d[_0xd9a9('0x4c')]=[{'all':!![]}];}return db[_0xd9a9('0x3a')][_0xd9a9('0x4d')](_0x33283d);})['then'](function(_0x4c40ed){_0x4d5e2c[_0xd9a9('0x4e')]=_0x4c40ed;return _0x4d5e2c;})[_0xd9a9('0x35')](respondWithFilteredResult(_0x529e51,_0x33283d))[_0xd9a9('0x27')](handleError(_0x529e51,null));};exports[_0xd9a9('0x4f')]=function(_0x1bc521,_0x5b1f7a){var _0x36f471={'raw':!![],'where':{'id':_0x1bc521['params']['id']}},_0x412ce5={};_0x412ce5['model']=_[_0xd9a9('0x3f')](db[_0xd9a9('0x3a')]['rawAttributes']);_0x412ce5['query']=_['keys'](_0x1bc521[_0xd9a9('0x3e')]);_0x412ce5[_0xd9a9('0x40')]=_[_0xd9a9('0x41')](_0x412ce5[_0xd9a9('0x42')],_0x412ce5[_0xd9a9('0x3e')]);_0x36f471[_0xd9a9('0x43')]=_[_0xd9a9('0x41')](_0x412ce5[_0xd9a9('0x42')],qs['fields'](_0x1bc521[_0xd9a9('0x3e')][_0xd9a9('0x44')]));_0x36f471[_0xd9a9('0x43')]=_0x36f471[_0xd9a9('0x43')]['length']?_0x36f471[_0xd9a9('0x43')]:_0x412ce5['model'];if(_0x1bc521['query'][_0xd9a9('0x4b')]){_0x36f471[_0xd9a9('0x4c')]=[{'all':!![]}];}_0x36f471=_[_0xd9a9('0x49')]({},_0x36f471,_0x1bc521[_0xd9a9('0x50')]);return db[_0xd9a9('0x3a')][_0xd9a9('0x51')](_0x36f471)[_0xd9a9('0x35')](handleEntityNotFound(_0x5b1f7a,null))[_0xd9a9('0x35')](respondWithResult(_0x5b1f7a,null))[_0xd9a9('0x27')](handleError(_0x5b1f7a,null));};exports[_0xd9a9('0x52')]=function(_0x421105,_0x4a8f04){return db['WhatsappMessage'][_0xd9a9('0x52')](_0x421105[_0xd9a9('0x53')],{})['then'](respondWithResult(_0x4a8f04,0xc9))['catch'](handleError(_0x4a8f04,null));};exports[_0xd9a9('0x34')]=function(_0x32d92d,_0x1cf01e){if(_0x32d92d[_0xd9a9('0x53')]['id']){delete _0x32d92d[_0xd9a9('0x53')]['id'];}return db[_0xd9a9('0x3a')][_0xd9a9('0x51')]({'where':{'id':_0x32d92d[_0xd9a9('0x54')]['id']}})[_0xd9a9('0x35')](handleEntityNotFound(_0x1cf01e,null))[_0xd9a9('0x35')](saveUpdates(_0x32d92d[_0xd9a9('0x53')],null))['then'](respondWithResult(_0x1cf01e,null))['catch'](handleError(_0x1cf01e,null));};exports[_0xd9a9('0x55')]=function(_0x1ca4bc,_0xcb655a){return db[_0xd9a9('0x3a')]['find']({'where':{'id':_0x1ca4bc[_0xd9a9('0x54')]['id']}})[_0xd9a9('0x35')](handleEntityNotFound(_0xcb655a,null))[_0xd9a9('0x35')](removeEntity(_0xcb655a,null))[_0xd9a9('0x27')](handleError(_0xcb655a,null));};exports[_0xd9a9('0x56')]=function(_0x104e75,_0x2c11d0){return db[_0xd9a9('0x3a')][_0xd9a9('0x56')]()[_0xd9a9('0x35')](respondWithResult(_0x2c11d0,null))[_0xd9a9('0x27')](handleError(_0x2c11d0,null));};var interaction_log=require(_0xd9a9('0x57'))(_0xd9a9('0x58'));exports[_0xd9a9('0x59')]=function(_0x3c16a9,_0xa0b1fd,_0x33f73e){var _0x5dc133={'agent':{},'channel':_0xd9a9('0x5a')};if(_0x3c16a9['body']['id']){delete _0x3c16a9['body']['id'];}_0x3c16a9[_0xd9a9('0x53')][_0xd9a9('0x5b')]=!![];_0x3c16a9[_0xd9a9('0x53')][_0xd9a9('0x5c')]=moment()[_0xd9a9('0x5d')](_0xd9a9('0x5e'));_0x3c16a9[_0xd9a9('0x53')][_0xd9a9('0x5f')]=_0x3c16a9[_0xd9a9('0x53')]['UserId']||_0x3c16a9['user']['id'];_0x5dc133[_0xd9a9('0x60')]['id']=_0x3c16a9['body']['UserId'];return db[_0xd9a9('0x3a')][_0xd9a9('0x51')]({'where':{'id':_0x3c16a9['params']['id'],'UserId':null}})[_0xd9a9('0x35')](handleEntityNotFound(_0xa0b1fd,null))[_0xd9a9('0x35')](saveUpdates(_0x3c16a9[_0xd9a9('0x53')],null))['then'](function(_0x35309f){if(_0x35309f){_0x5dc133[_0xd9a9('0x25')]=_0x35309f['get']({'plain':!![]});return db[_0xd9a9('0x61')][_0xd9a9('0x51')]({'where':{'id':_0x35309f['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0xa0b1fd,null))[_0xd9a9('0x35')](function(_0x568205){if(_0x568205){return _0x568205[_0xd9a9('0x34')]({'UserId':_0x3c16a9[_0xd9a9('0x53')][_0xd9a9('0x5f')],'read1stAt':_[_0xd9a9('0x62')](_0x568205[_0xd9a9('0x63')])?moment()[_0xd9a9('0x5d')](_0xd9a9('0x5e')):undefined});}return null;})[_0xd9a9('0x35')](function(_0xc75c55){if(_0xc75c55){_0x5dc133[_0xd9a9('0x64')]=_0xc75c55[_0xd9a9('0x65')]({'plain':!![]});interaction_log['info'](_0xd9a9('0x66'),_0x3c16a9[_0xd9a9('0x67')]['id'],_0x3c16a9['user']['name'],_0x3c16a9[_0xd9a9('0x67')][_0xd9a9('0x68')],_0x5dc133['interaction']['id'],_0x3c16a9[_0xd9a9('0x53')]?JSON['stringify'](_0x3c16a9[_0xd9a9('0x53')]):_0xd9a9('0x69'));return respondWithRpcPromise(_0xd9a9('0x6a'),_0xd9a9('0x6b'),_0x5dc133);}return null;})['then'](function(_0x62082a){var _0x532338='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x62082a[_0xd9a9('0x25')][_0xd9a9('0x6c')];return db[_0xd9a9('0x6d')][_0xd9a9('0x3e')](_0x532338,{'type':db[_0xd9a9('0x6e')][_0xd9a9('0x6f')][_0xd9a9('0x70')],'raw':!![]})[_0xd9a9('0x35')](function(_0x4bc62e){return _0x4bc62e;});})[_0xd9a9('0x35')](function(_0x458613){if(_0x458613){_0x5dc133[_0xd9a9('0x25')][_0xd9a9('0x71')]=_0x458613[0x0];if(!_0x3c16a9[_0xd9a9('0x53')]['UserId'])return;return db[_0xd9a9('0x72')][_0xd9a9('0x51')]({'where':{'id':_0x3c16a9[_0xd9a9('0x53')]['UserId'],'role':_0xd9a9('0x60')},'attributes':['id',_0xd9a9('0x37'),'fullname',_0xd9a9('0x73'),'internal'],'raw':!![]});}return null;})[_0xd9a9('0x35')](function(_0x57d815){if(!_0x57d815)return null;_0x5dc133[_0xd9a9('0x25')][_0xd9a9('0x60')]=_0x57d815;return _0x5dc133;})[_0xd9a9('0x35')](function(_0x14a35f){if(_0x14a35f){if(_0x3c16a9[_0xd9a9('0x53')][_0xd9a9('0x74')]){_0x5dc133[_0xd9a9('0x25')]['interface']=util[_0xd9a9('0x5d')](_0xd9a9('0x75'),_0x3c16a9['user'][_0xd9a9('0x37')]);_0x5dc133['message'][_0xd9a9('0x76')]=_0x5dc133['channel'];_0x5dc133['message'][_0xd9a9('0x77')]=_0x5dc133[_0xd9a9('0x76')];_0x5dc133['message'][_0xd9a9('0x78')]=_0xd9a9('0x59');return respondWithRpcPromise('EventManager',_0xd9a9('0x79'),{'event':_0xd9a9('0x7a'),'message':_0x5dc133['message']},client9002)[_0xd9a9('0x35')](function(){return _0x5dc133;});}return _0x5dc133;}return null;})['then'](respondWithResult(_0xa0b1fd,null))['catch'](handleError(_0xa0b1fd,null));};var interaction_log=require(_0xd9a9('0x57'))('whatsapp-interactions');exports[_0xd9a9('0x32')]=function(_0xe6a685,_0x2944a7,_0x1c79b8){var _0x132db9={'agent':{},'channel':_0xd9a9('0x5a')};if(_0xe6a685['body']['id']){delete _0xe6a685[_0xd9a9('0x53')]['id'];}_0xe6a685[_0xd9a9('0x53')]['UserId']=_0xe6a685['body']['UserId']||_0xe6a685[_0xd9a9('0x67')]['id'];_0x132db9['agent']['id']=_0xe6a685[_0xd9a9('0x53')][_0xd9a9('0x5f')];return db['WhatsappMessage'][_0xd9a9('0x51')]({'where':{'id':_0xe6a685[_0xd9a9('0x54')]['id'],'UserId':null}})[_0xd9a9('0x35')](handleEntityNotFound(_0x2944a7,null))['then'](function(_0x29c6f0){if(_0x29c6f0){_0x132db9[_0xd9a9('0x25')]=_0x29c6f0['get']({'plain':!![]});return db[_0xd9a9('0x61')][_0xd9a9('0x51')]({'where':{'id':_0x29c6f0[_0xd9a9('0x7b')]}});}return null;})['then'](handleEntityNotFound(_0x2944a7,null))[_0xd9a9('0x35')](function(_0x260dcc){if(_0x260dcc){_0x132db9['interaction']=_0x260dcc['get']({'plain':!![]});interaction_log[_0xd9a9('0x1e')](_0xd9a9('0x7c'),_0xe6a685[_0xd9a9('0x67')]['id'],_0xe6a685[_0xd9a9('0x67')][_0xd9a9('0x37')],_0xe6a685['user'][_0xd9a9('0x68')],_0x132db9[_0xd9a9('0x64')]['id'],_0xe6a685[_0xd9a9('0x53')]?JSON[_0xd9a9('0x7d')](_0xe6a685[_0xd9a9('0x53')]):_0xd9a9('0x69'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x132db9);}return null;})[_0xd9a9('0x35')](function(_0x30d3d1){var _0x7261b5=_0xd9a9('0x7e')+_0x30d3d1[_0xd9a9('0x25')][_0xd9a9('0x6c')];return db[_0xd9a9('0x6d')][_0xd9a9('0x3e')](_0x7261b5,{'type':db[_0xd9a9('0x6e')][_0xd9a9('0x6f')]['SELECT'],'raw':!![]})[_0xd9a9('0x35')](function(_0x763436){return _0x763436;});})[_0xd9a9('0x35')](function(_0x795a1c){if(_0x795a1c){_0x132db9[_0xd9a9('0x25')]['contact']=_0x795a1c[0x0];if(!_0xe6a685[_0xd9a9('0x53')]['UserId'])return;return db[_0xd9a9('0x72')][_0xd9a9('0x51')]({'where':{'id':_0xe6a685[_0xd9a9('0x53')]['UserId'],'role':_0xd9a9('0x60')},'attributes':['id',_0xd9a9('0x37'),'fullname',_0xd9a9('0x73'),_0xd9a9('0x7f')],'raw':!![]});}return null;})[_0xd9a9('0x35')](function(_0x47996d){if(!_0x47996d)return null;_0x132db9['message'][_0xd9a9('0x60')]=_0x47996d;return _0x132db9;})['then'](function(_0x238bc9){if(_0x238bc9){_0x238bc9[_0xd9a9('0x25')][_0xd9a9('0x80')]=util[_0xd9a9('0x5d')](_0xd9a9('0x75'),_0xe6a685[_0xd9a9('0x67')][_0xd9a9('0x37')]);_0x238bc9['message']['channel']=_0x132db9[_0xd9a9('0x76')];_0x238bc9[_0xd9a9('0x25')][_0xd9a9('0x77')]=_0x132db9[_0xd9a9('0x76')];_0x238bc9[_0xd9a9('0x25')][_0xd9a9('0x78')]=_0xd9a9('0x32');respondWithRpcPromise(_0xd9a9('0x79'),_0xd9a9('0x79'),{'event':'rejectmessage','message':_0x238bc9[_0xd9a9('0x25')]},client9002);return _0x132db9;}return null;})['then'](respondWithResult(_0x2944a7,null))[_0xd9a9('0x27')](handleError(_0x2944a7,null));};exports['status']=function(_0x217532,_0x373904,_0x1e8813){if(_0x217532['body']['id']){delete _0x217532[_0xd9a9('0x53')]['id'];}var _0x39f4b6;return db[_0xd9a9('0x3a')][_0xd9a9('0x51')]({'where':{'id':_0x217532[_0xd9a9('0x54')]['id']}})[_0xd9a9('0x35')](handleEntityNotFound(_0x373904,null))[_0xd9a9('0x35')](function(_0x94fc2d){if(_0x94fc2d){_0x39f4b6=_0x94fc2d;return db[_0xd9a9('0x81')][_0xd9a9('0x51')]({'where':{'id':_0x94fc2d[_0xd9a9('0x82')]}});}})[_0xd9a9('0x35')](handleEntityNotFound(_0x373904,null))[_0xd9a9('0x35')](function(_0x4bc02a){if(_0x4bc02a){logger[_0xd9a9('0x21')](_0xd9a9('0x83'),'status',_0xd9a9('0x84'),_0x4bc02a[_0xd9a9('0x3c')],util[_0xd9a9('0x85')](_0x217532['body'],{'showHidden':![],'depth':null}));switch(_0x4bc02a['type']){case _0xd9a9('0x86'):if(_0x217532['body'][_0xd9a9('0x87')]&&_0x217532[_0xd9a9('0x53')][_0xd9a9('0x87')]===_0x39f4b6[_0xd9a9('0x88')]&&_0x217532[_0xd9a9('0x53')][_0xd9a9('0x89')]&&_0x217532['body']['MessageStatus']==='read'){return _0x39f4b6[_0xd9a9('0x34')]({'read':!![]});}else{logger[_0xd9a9('0x24')](_0xd9a9('0x8a'),_0xd9a9('0x29'),_0xd9a9('0x86'),util[_0xd9a9('0x85')](_0x217532[_0xd9a9('0x53')],{'showHidden':![],'depth':null}));}break;}return _0x39f4b6;}})[_0xd9a9('0x35')](respondWithResult(_0x373904,null))[_0xd9a9('0x27')](handleError(_0x373904,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 9647744..be11734 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 _0x80ed=['remove','emit','hasOwnProperty','exports','events','WhatsappMessage','setMaxListeners','save'];(function(_0x4b8e8a,_0xcbb7a){var _0x547ceb=function(_0x1416ec){while(--_0x1416ec){_0x4b8e8a['push'](_0x4b8e8a['shift']());}};_0x547ceb(++_0xcbb7a);}(_0x80ed,0x11c));var _0xd80e=function(_0x4fe505,_0x2e3c7b){_0x4fe505=_0x4fe505-0x0;var _0x287421=_0x80ed[_0x4fe505];return _0x287421;};'use strict';var EventEmitter=require(_0xd80e('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xd80e('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xd80e('0x2')](0x0);var events={'afterCreate':_0xd80e('0x3'),'afterUpdate':'update','afterDestroy':_0xd80e('0x4')};function emitEvent(_0x46876f){return function(_0x2b742b,_0x3413d4,_0x5ae6c6){WhatsappMessageEvents[_0xd80e('0x5')](_0x46876f+':'+_0x2b742b['id'],_0x2b742b);WhatsappMessageEvents[_0xd80e('0x5')](_0x46876f,_0x2b742b);_0x5ae6c6(null);};}for(var e in events){if(events[_0xd80e('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0xd80e('0x7')]=WhatsappMessageEvents; \ No newline at end of file +var _0xed3c=['WhatsappMessage','setMaxListeners','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x1d5497,_0x2c3c3f){var _0x21bc32=function(_0x18e3cc){while(--_0x18e3cc){_0x1d5497['push'](_0x1d5497['shift']());}};_0x21bc32(++_0x2c3c3f);}(_0xed3c,0x1a6));var _0xced3=function(_0x3460e3,_0x23d874){_0x3460e3=_0x3460e3-0x0;var _0x22a450=_0xed3c[_0x3460e3];return _0x22a450;};'use strict';var EventEmitter=require(_0xced3('0x0'));var WhatsappMessage=require(_0xced3('0x1'))['db'][_0xced3('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xced3('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xced3('0x4'),'afterDestroy':_0xced3('0x5')};function emitEvent(_0x14488e){return function(_0x5f03e0,_0x51e500,_0x3d3aa0){WhatsappMessageEvents[_0xced3('0x6')](_0x14488e+':'+_0x5f03e0['id'],_0x5f03e0);WhatsappMessageEvents[_0xced3('0x6')](_0x14488e,_0x5f03e0);_0x3d3aa0(null);};}for(var e in events){if(events[_0xced3('0x7')](e)){var event=events[e];WhatsappMessage['hook'](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 f7bc4d3..5743a07 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 _0x1340=['api','moment','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','isNil','UserId','WhatsappInteraction','then','update','createdAt','catch','error','secret','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','baseUrl','POST','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','util','../../config/logger'];(function(_0x1ed7a5,_0x48a26a){var _0x2a6d0e=function(_0xe2aa6b){while(--_0xe2aa6b){_0x1ed7a5['push'](_0x1ed7a5['shift']());}};_0x2a6d0e(++_0x48a26a);}(_0x1340,0x74));var _0x0134=function(_0x2dd163,_0x314ac1){_0x2dd163=_0x2dd163-0x0;var _0x225b2f=_0x1340[_0x2dd163];return _0x225b2f;};'use strict';var _=require('lodash');var util=require(_0x0134('0x0'));var logger=require(_0x0134('0x1'))(_0x0134('0x2'));var moment=require(_0x0134('0x3'));var BPromise=require('bluebird');var rp=require(_0x0134('0x4'));var fetch=require(_0x0134('0x5'));var fs=require('fs');var path=require(_0x0134('0x6'));var rimraf=require(_0x0134('0x7'));var config=require(_0x0134('0x8'));var attributes=require(_0x0134('0x9'));module[_0x0134('0xa')]=function(_0x1686a8,_0x4a250a){return _0x1686a8[_0x0134('0xb')](_0x0134('0xc'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0x0134('0xd'),'fields':['messageId']},{'name':_0x0134('0xe'),'fields':[_0x0134('0xf')],'type':_0x0134('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x310f84,_0x346d9f,_0x52495b){var _0x4b07d1=_0x1686a8[_0x0134('0x11')];var _0x36ed3a=_0x310f84[_0x0134('0x12')]({'plain':!![]});if(_0x36ed3a[_0x0134('0x13')][_0x0134('0x14')]()==='in'||_0x36ed3a['direction'][_0x0134('0x14')]()==='out'&&!_0x36ed3a['secret']&&!_[_0x0134('0x15')](_0x36ed3a[_0x0134('0x16')])){_0x4b07d1[_0x0134('0x17')]['findOne']({'where':{'id':_0x36ed3a['WhatsappInteractionId']}})[_0x0134('0x18')](function(_0x37c401){if(_0x37c401){_0x37c401[_0x0134('0x19')]({'lastMsgAt':_0x36ed3a[_0x0134('0x1a')],'lastMsgDirection':_0x36ed3a['direction'][_0x0134('0x14')]()});}})[_0x0134('0x1b')](function(_0x518603){console[_0x0134('0x1c')](_0x518603);});}if(_0x36ed3a[_0x0134('0x13')]==='out'&&!_0x36ed3a[_0x0134('0x1d')]){var _0x3037e3;_0x4b07d1[_0x0134('0x1e')][_0x0134('0x1f')]({'where':{'id':_0x36ed3a[_0x0134('0x20')]},'raw':!![]})[_0x0134('0x18')](function(_0x1f2c2d){_0x3037e3=_0x1f2c2d;if(_0x3037e3&&_0x3037e3[_0x0134('0x21')]){switch(_0x3037e3[_0x0134('0x21')]){case _0x0134('0x22'):var _0xde68ba=require(_0x0134('0x22'));if(_0x3037e3[_0x0134('0x23')]&&_0x3037e3[_0x0134('0x24')]&&_0x3037e3[_0x0134('0x25')]){var _0x54e1d4=new _0xde68ba(_0x3037e3[_0x0134('0x23')],_0x3037e3[_0x0134('0x24')]);_0x54e1d4[_0x0134('0x26')][_0x0134('0x27')]({'body':_0x36ed3a[_0x0134('0xf')],'to':_0x0134('0x28')+_0x36ed3a[_0x0134('0x25')],'from':'whatsapp:'+_0x3037e3['phone'],'statusCallback':_0x3037e3[_0x0134('0x29')]+_0x0134('0x2a')+_0x36ed3a['id']+_0x0134('0x2b')+_0x3037e3[_0x0134('0x2c')]})[_0x0134('0x18')](function(_0x3ca411){if(_0x3ca411[_0x0134('0x2d')]){return _0x310f84[_0x0134('0x19')]({'messageId':_0x3ca411['sid']});}})[_0x0134('0x1b')](function(_0x1621e4){logger['error'](_0x0134('0x2e'),_0x0134('0x2f'),_0x0134('0x22'),util[_0x0134('0x30')](_0x1621e4,{'showHidden':![],'depth':null}));});}else{logger[_0x0134('0x1c')](_0x0134('0x2e'),'afterCreate','twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case'sinch':var _0x315be1=_0x3037e3[_0x0134('0x23')];var _0x1e4677=_0x3037e3[_0x0134('0x24')];var _0x183180=_0x3037e3[_0x0134('0x31')]+'/whatsapp/v1/'+_0x315be1+'/messages/';var _0x42fcfd={'to':[_0x36ed3a[_0x0134('0x25')]],'message':{'type':'text','text':_0x36ed3a[_0x0134('0xf')]}};var _0x5f4238={'method':_0x0134('0x32'),'uri':_0x183180,'headers':{'Authorization':_0x0134('0x33')+_0x1e4677,'Content-Type':_0x0134('0x34')},'body':_0x42fcfd,'json':!![]};rp(_0x5f4238)[_0x0134('0x18')](function(_0x4ccd1c){if(_0x4ccd1c[_0x0134('0x35')][0x0][_0x0134('0x36')]){return _0x310f84[_0x0134('0x19')]({'messageId':_0x4ccd1c[_0x0134('0x35')][0x0][_0x0134('0x36')]});}})['catch'](function(_0x581ed8){logger[_0x0134('0x37')](_0x0134('0x38'),_0x581ed8);});break;}}})[_0x0134('0x39')](function(){_0x52495b();});}else{_0x52495b();}}},'charset':_0x0134('0x3a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x7c24=['../../config/logger','api','bluebird','request-promise','node-fetch','path','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','models','get','direction','toLowerCase','out','secret','WhatsappInteraction','findOne','WhatsappInteractionId','createdAt','catch','error','WhatsappAccount','find','type','twilio','accountSid','authToken','phone','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','then','sid','update','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','application/json','statuses','err','finally','lodash','util'];(function(_0x2ee712,_0x5a2179){var _0x2e8783=function(_0x1857d3){while(--_0x1857d3){_0x2ee712['push'](_0x2ee712['shift']());}};_0x2e8783(++_0x5a2179);}(_0x7c24,0x186));var _0x47c2=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x7c24[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0x47c2('0x0'));var util=require(_0x47c2('0x1'));var logger=require(_0x47c2('0x2'))(_0x47c2('0x3'));var moment=require('moment');var BPromise=require(_0x47c2('0x4'));var rp=require(_0x47c2('0x5'));var fetch=require(_0x47c2('0x6'));var fs=require('fs');var path=require(_0x47c2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x47c2('0x8'));module[_0x47c2('0x9')]=function(_0x5f292f,_0x280b64){return _0x5f292f[_0x47c2('0xa')](_0x47c2('0xb'),attributes,{'tableName':_0x47c2('0xc'),'paranoid':![],'indexes':[{'name':_0x47c2('0xd'),'fields':['messageId']},{'name':_0x47c2('0xe'),'fields':[_0x47c2('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1b9e0f,_0x4b8311,_0x1d238a){var _0x515dc0=_0x5f292f[_0x47c2('0x10')];var _0x3ef5c8=_0x1b9e0f[_0x47c2('0x11')]({'plain':!![]});if(_0x3ef5c8[_0x47c2('0x12')][_0x47c2('0x13')]()==='in'||_0x3ef5c8[_0x47c2('0x12')]['toLowerCase']()===_0x47c2('0x14')&&!_0x3ef5c8[_0x47c2('0x15')]&&!_['isNil'](_0x3ef5c8['UserId'])){_0x515dc0[_0x47c2('0x16')][_0x47c2('0x17')]({'where':{'id':_0x3ef5c8[_0x47c2('0x18')]}})['then'](function(_0x5e8787){if(_0x5e8787){_0x5e8787['update']({'lastMsgAt':_0x3ef5c8[_0x47c2('0x19')],'lastMsgDirection':_0x3ef5c8['direction'][_0x47c2('0x13')]()});}})[_0x47c2('0x1a')](function(_0x2010d6){console[_0x47c2('0x1b')](_0x2010d6);});}if(_0x3ef5c8['direction']==='out'&&!_0x3ef5c8['secret']){var _0x49af84;_0x515dc0[_0x47c2('0x1c')][_0x47c2('0x1d')]({'where':{'id':_0x3ef5c8['WhatsappAccountId']},'raw':!![]})['then'](function(_0x1233a1){_0x49af84=_0x1233a1;if(_0x49af84&&_0x49af84[_0x47c2('0x1e')]){switch(_0x49af84['type']){case _0x47c2('0x1f'):var _0xbb554f=require(_0x47c2('0x1f'));if(_0x49af84[_0x47c2('0x20')]&&_0x49af84[_0x47c2('0x21')]&&_0x49af84[_0x47c2('0x22')]){var _0x5b0722=new _0xbb554f(_0x49af84[_0x47c2('0x20')],_0x49af84['authToken']);_0x5b0722['messages']['create']({'body':_0x3ef5c8[_0x47c2('0xf')],'to':_0x47c2('0x23')+_0x3ef5c8['phone'],'from':_0x47c2('0x23')+_0x49af84[_0x47c2('0x22')],'statusCallback':_0x49af84[_0x47c2('0x24')]+_0x47c2('0x25')+_0x3ef5c8['id']+_0x47c2('0x26')+_0x49af84[_0x47c2('0x27')]})[_0x47c2('0x28')](function(_0x5b1ce8){if(_0x5b1ce8[_0x47c2('0x29')]){return _0x1b9e0f[_0x47c2('0x2a')]({'messageId':_0x5b1ce8[_0x47c2('0x29')]});}})[_0x47c2('0x1a')](function(_0x5d3424){logger[_0x47c2('0x1b')](_0x47c2('0x2b'),_0x47c2('0x2c'),'twilio',util[_0x47c2('0x2d')](_0x5d3424,{'showHidden':![],'depth':null}));});}else{logger[_0x47c2('0x1b')](_0x47c2('0x2b'),'afterCreate',_0x47c2('0x1f'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x47c2('0x2e'):var _0x274e2b=_0x49af84[_0x47c2('0x20')];var _0x47e217=_0x49af84[_0x47c2('0x21')];var _0x2f25e0=_0x49af84[_0x47c2('0x2f')]+_0x47c2('0x30')+_0x274e2b+_0x47c2('0x31');var _0x5e379b={'to':[_0x3ef5c8[_0x47c2('0x22')]],'message':{'type':_0x47c2('0x32'),'text':_0x3ef5c8[_0x47c2('0xf')]}};var _0x2f1f7c={'method':_0x47c2('0x33'),'uri':_0x2f25e0,'headers':{'Authorization':'Bearer\x20'+_0x47e217,'Content-Type':_0x47c2('0x34')},'body':_0x5e379b,'json':!![]};rp(_0x2f1f7c)[_0x47c2('0x28')](function(_0x240afa){if(_0x240afa['statuses'][0x0]['message_id']){return _0x1b9e0f[_0x47c2('0x2a')]({'messageId':_0x240afa[_0x47c2('0x35')][0x0]['message_id']});}})[_0x47c2('0x1a')](function(_0x51433a){logger[_0x47c2('0x36')]('WhatsappMessage,\x20%s',_0x51433a);});break;}}})[_0x47c2('0x37')](function(){_0x1d238a();});}else{_0x1d238a();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 2c3a7da..299dcd9 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 _0xccaf=['defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x32cefe,_0x1befba){var _0x283e79=function(_0x1609f1){while(--_0x1609f1){_0x32cefe['push'](_0x32cefe['shift']());}};_0x283e79(++_0x1befba);}(_0xccaf,0xf6));var _0xfcca=function(_0x173dd9,_0x4ecf44){_0x173dd9=_0x173dd9-0x0;var _0x5a0d5a=_0xccaf[_0x173dd9];return _0x5a0d5a;};'use strict';var _=require(_0xfcca('0x0'));var util=require(_0xfcca('0x1'));var moment=require(_0xfcca('0x2'));var BPromise=require(_0xfcca('0x3'));var rs=require(_0xfcca('0x4'));var fs=require('fs');var Redis=require(_0xfcca('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfcca('0x6'));var logger=require('../../config/logger')(_0xfcca('0x7'));var config=require(_0xfcca('0x8'));var jayson=require(_0xfcca('0x9'));var client=jayson[_0xfcca('0xa')][_0xfcca('0xb')]({'port':0x232a});config[_0xfcca('0xc')]=_[_0xfcca('0xd')](config[_0xfcca('0xc')],{'host':_0xfcca('0xe'),'port':0x18eb});var socket=require(_0xfcca('0xf'))(new Redis(config[_0xfcca('0xc')]));require(_0xfcca('0x10'))[_0xfcca('0x11')](socket);function respondWithRpcPromise(_0x537194,_0x3614c8,_0x591d18){return new BPromise(function(_0x4a4743,_0x1d9fe1){return client[_0xfcca('0x12')](_0x537194,_0x591d18)[_0xfcca('0x13')](function(_0x505593){logger[_0xfcca('0x14')](_0xfcca('0x15'),_0x3614c8,_0xfcca('0x16'));logger[_0xfcca('0x17')](_0xfcca('0x18'),_0x3614c8,_0xfcca('0x16'),JSON[_0xfcca('0x19')](_0x505593));if(_0x505593[_0xfcca('0x1a')]){if(_0x505593[_0xfcca('0x1a')][_0xfcca('0x1b')]===0x1f4){logger[_0xfcca('0x1a')](_0xfcca('0x15'),_0x3614c8,_0x505593['error'][_0xfcca('0x1c')]);return _0x1d9fe1(_0x505593['error'][_0xfcca('0x1c')]);}logger[_0xfcca('0x1a')](_0xfcca('0x15'),_0x3614c8,_0x505593[_0xfcca('0x1a')]['message']);return _0x4a4743(_0x505593['error'][_0xfcca('0x1c')]);}else{logger[_0xfcca('0x14')](_0xfcca('0x15'),_0x3614c8,_0xfcca('0x16'));_0x4a4743(_0x505593[_0xfcca('0x1d')][_0xfcca('0x1c')]);}})[_0xfcca('0x1e')](function(_0x1e7293){logger['error'](_0xfcca('0x15'),_0x3614c8,_0x1e7293);_0x1d9fe1(_0x1e7293);});});}exports[_0xfcca('0x1f')]=function(_0x11ea82){var _0x364bdb=this;return new Promise(function(_0x21f913,_0x2588c9){return db[_0xfcca('0x20')][_0xfcca('0x21')](_0x11ea82[_0xfcca('0x22')],{'raw':_0x11ea82[_0xfcca('0x23')]?_0x11ea82[_0xfcca('0x23')][_0xfcca('0x24')]===undefined?!![]:![]:!![]})[_0xfcca('0x13')](function(_0x9d09b4){logger[_0xfcca('0x14')]('CreateWhatsappMessage',_0x11ea82);logger['debug']('CreateWhatsappMessage',_0x11ea82,JSON[_0xfcca('0x19')](_0x9d09b4));_0x21f913(_0x9d09b4);})[_0xfcca('0x1e')](function(_0x29f0f7){logger[_0xfcca('0x1a')]('CreateWhatsappMessage',_0x29f0f7['message'],_0x11ea82);_0x2588c9(_0x364bdb['error'](0x1f4,_0x29f0f7[_0xfcca('0x1c')]));});});}; \ No newline at end of file +var _0xf50d=['CreateWhatsappMessage','WhatsappMessage','create','options','raw','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x4a092d,_0x2e38e0){var _0x3cab90=function(_0x5e10a3){while(--_0x5e10a3){_0x4a092d['push'](_0x4a092d['shift']());}};_0x3cab90(++_0x2e38e0);}(_0xf50d,0xb0));var _0xdf50=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0xf50d[_0x4fbfd9];return _0x31dc94;};'use strict';var _=require(_0xdf50('0x0'));var util=require('util');var moment=require(_0xdf50('0x1'));var BPromise=require(_0xdf50('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdf50('0x3'));var db=require(_0xdf50('0x4'))['db'];var utils=require(_0xdf50('0x5'));var logger=require('../../config/logger')(_0xdf50('0x6'));var config=require(_0xdf50('0x7'));var jayson=require(_0xdf50('0x8'));var client=jayson[_0xdf50('0x9')][_0xdf50('0xa')]({'port':0x232a});config[_0xdf50('0xb')]=_[_0xdf50('0xc')](config['redis'],{'host':_0xdf50('0xd'),'port':0x18eb});var socket=require(_0xdf50('0xe'))(new Redis(config[_0xdf50('0xb')]));require(_0xdf50('0xf'))[_0xdf50('0x10')](socket);function respondWithRpcPromise(_0x571738,_0x33504a,_0x45927c){return new BPromise(function(_0x22699c,_0xd8f6b0){return client[_0xdf50('0x11')](_0x571738,_0x45927c)[_0xdf50('0x12')](function(_0x29e1a6){logger[_0xdf50('0x13')](_0xdf50('0x14'),_0x33504a,_0xdf50('0x15'));logger[_0xdf50('0x16')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x33504a,_0xdf50('0x15'),JSON[_0xdf50('0x17')](_0x29e1a6));if(_0x29e1a6[_0xdf50('0x18')]){if(_0x29e1a6[_0xdf50('0x18')][_0xdf50('0x19')]===0x1f4){logger[_0xdf50('0x18')](_0xdf50('0x14'),_0x33504a,_0x29e1a6['error'][_0xdf50('0x1a')]);return _0xd8f6b0(_0x29e1a6[_0xdf50('0x18')][_0xdf50('0x1a')]);}logger[_0xdf50('0x18')](_0xdf50('0x14'),_0x33504a,_0x29e1a6[_0xdf50('0x18')]['message']);return _0x22699c(_0x29e1a6[_0xdf50('0x18')][_0xdf50('0x1a')]);}else{logger[_0xdf50('0x13')](_0xdf50('0x14'),_0x33504a,_0xdf50('0x15'));_0x22699c(_0x29e1a6[_0xdf50('0x1b')][_0xdf50('0x1a')]);}})['catch'](function(_0x4d657b){logger[_0xdf50('0x18')](_0xdf50('0x14'),_0x33504a,_0x4d657b);_0xd8f6b0(_0x4d657b);});});}exports[_0xdf50('0x1c')]=function(_0x42492a){var _0x20e437=this;return new Promise(function(_0xada8cb,_0x1ed022){return db[_0xdf50('0x1d')][_0xdf50('0x1e')](_0x42492a['body'],{'raw':_0x42492a[_0xdf50('0x1f')]?_0x42492a[_0xdf50('0x1f')][_0xdf50('0x20')]===undefined?!![]:![]:!![]})[_0xdf50('0x12')](function(_0x6b5c5a){logger[_0xdf50('0x13')](_0xdf50('0x1c'),_0x42492a);logger[_0xdf50('0x16')](_0xdf50('0x1c'),_0x42492a,JSON[_0xdf50('0x17')](_0x6b5c5a));_0xada8cb(_0x6b5c5a);})[_0xdf50('0x21')](function(_0x296da0){logger[_0xdf50('0x18')](_0xdf50('0x1c'),_0x296da0[_0xdf50('0x1a')],_0x42492a);_0x1ed022(_0x20e437[_0xdf50('0x18')](0x1f4,_0x296da0['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 3c55166..860cdb0 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 _0x776c=['emit','removeListener','register','length','./whatsappMessage.events','save','remove'];(function(_0xc5d3bf,_0x4c1804){var _0x2bdf29=function(_0x3d7198){while(--_0x3d7198){_0xc5d3bf['push'](_0xc5d3bf['shift']());}};_0x2bdf29(++_0x4c1804);}(_0x776c,0x7b));var _0xc776=function(_0x3e3111,_0x48b78a){_0x3e3111=_0x3e3111-0x0;var _0x4795ca=_0x776c[_0x3e3111];return _0x4795ca;};'use strict';var WhatsappMessageEvents=require(_0xc776('0x0'));var events=[_0xc776('0x1'),_0xc776('0x2'),'update'];function createListener(_0x2eb3d9,_0x485cd5){return function(_0x37cbc8){_0x485cd5[_0xc776('0x3')](_0x2eb3d9,_0x37cbc8);};}function removeListener(_0x1af6fa,_0x17ea52){return function(){WhatsappMessageEvents[_0xc776('0x4')](_0x1af6fa,_0x17ea52);};}exports[_0xc776('0x5')]=function(_0x1a3ab8){for(var _0x1ed5d6=0x0,_0x1d717d=events[_0xc776('0x6')];_0x1ed5d6<_0x1d717d;_0x1ed5d6++){var _0x2a8201=events[_0x1ed5d6];var _0x1b69aa=createListener('whatsappMessage:'+_0x2a8201,_0x1a3ab8);WhatsappMessageEvents['on'](_0x2a8201,_0x1b69aa);}}; \ No newline at end of file +var _0x126c=['update','emit','register','length','whatsappMessage:','remove'];(function(_0x266408,_0x5d9ffc){var _0x1769e3=function(_0x182fa4){while(--_0x182fa4){_0x266408['push'](_0x266408['shift']());}};_0x1769e3(++_0x5d9ffc);}(_0x126c,0x1c1));var _0xc126=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x126c[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=['save',_0xc126('0x0'),_0xc126('0x1')];function createListener(_0x5d0f60,_0x35b130){return function(_0x466b98){_0x35b130[_0xc126('0x2')](_0x5d0f60,_0x466b98);};}function removeListener(_0x4652a1,_0x1533ad){return function(){WhatsappMessageEvents['removeListener'](_0x4652a1,_0x1533ad);};}exports[_0xc126('0x3')]=function(_0x2a0930){for(var _0x59ec7f=0x0,_0x294985=events[_0xc126('0x4')];_0x59ec7f<_0x294985;_0x59ec7f++){var _0x3d3e4f=events[_0x59ec7f];var _0x3fd32b=createListener(_0xc126('0x5')+_0x3d3e4f,_0x2a0930);WhatsappMessageEvents['on'](_0x3d3e4f,_0x3fd32b);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 8a535ab..3f044e3 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 _0xd5b4=['util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','/:id/users','getAgents','create','post','addTeams','addAgents','put','update','delete','destroy','removeAgents','exports','multer'];(function(_0x3b4922,_0x2fa365){var _0x239729=function(_0x82fd7){while(--_0x82fd7){_0x3b4922['push'](_0x3b4922['shift']());}};_0x239729(++_0x2fa365);}(_0xd5b4,0x6f));var _0x4d5b=function(_0x276398,_0x4c1251){_0x276398=_0x276398-0x0;var _0x37ad83=_0xd5b4[_0x276398];return _0x37ad83;};'use strict';var multer=require(_0x4d5b('0x0'));var util=require(_0x4d5b('0x1'));var path=require(_0x4d5b('0x2'));var timeout=require(_0x4d5b('0x3'));var express=require(_0x4d5b('0x4'));var router=express[_0x4d5b('0x5')]();var fs_extra=require(_0x4d5b('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4d5b('0x7'));var controller=require(_0x4d5b('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x4d5b('0x9')]('/describe',auth[_0x4d5b('0xa')](),controller[_0x4d5b('0xb')]);router[_0x4d5b('0x9')](_0x4d5b('0xc'),auth[_0x4d5b('0xa')](),controller[_0x4d5b('0xd')]);router[_0x4d5b('0x9')]('/:id/members',auth[_0x4d5b('0xa')](),controller[_0x4d5b('0xe')]);router[_0x4d5b('0x9')](_0x4d5b('0xf'),auth[_0x4d5b('0xa')](),controller['getTeams']);router[_0x4d5b('0x9')](_0x4d5b('0x10'),auth[_0x4d5b('0xa')](),controller[_0x4d5b('0x11')]);router['post']('/',auth[_0x4d5b('0xa')](),controller[_0x4d5b('0x12')]);router[_0x4d5b('0x13')](_0x4d5b('0xf'),auth[_0x4d5b('0xa')](),controller[_0x4d5b('0x14')]);router[_0x4d5b('0x13')]('/:id/users',auth['isAuthenticated'](),controller[_0x4d5b('0x15')]);router[_0x4d5b('0x16')](_0x4d5b('0xc'),auth[_0x4d5b('0xa')](),controller[_0x4d5b('0x17')]);router[_0x4d5b('0x18')](_0x4d5b('0xc'),auth[_0x4d5b('0xa')](),controller[_0x4d5b('0x19')]);router[_0x4d5b('0x18')](_0x4d5b('0xf'),auth[_0x4d5b('0xa')](),controller['removeTeams']);router['delete']('/:id/users',auth[_0x4d5b('0xa')](),controller[_0x4d5b('0x1a')]);module[_0x4d5b('0x1b')]=router; \ No newline at end of file +var _0x33bf=['/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','update','delete','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','getTeams'];(function(_0x5208fa,_0x2e0115){var _0x340255=function(_0x243db1){while(--_0x243db1){_0x5208fa['push'](_0x5208fa['shift']());}};_0x340255(++_0x2e0115);}(_0x33bf,0xfb));var _0xf33b=function(_0x21b706,_0x1022f4){_0x21b706=_0x21b706-0x0;var _0x13b94a=_0x33bf[_0x21b706];return _0x13b94a;};'use strict';var multer=require(_0xf33b('0x0'));var util=require(_0xf33b('0x1'));var path=require(_0xf33b('0x2'));var timeout=require(_0xf33b('0x3'));var express=require(_0xf33b('0x4'));var router=express['Router']();var fs_extra=require(_0xf33b('0x5'));var auth=require(_0xf33b('0x6'));var interaction=require(_0xf33b('0x7'));var config=require(_0xf33b('0x8'));var controller=require(_0xf33b('0x9'));router[_0xf33b('0xa')]('/',auth[_0xf33b('0xb')](),controller[_0xf33b('0xc')]);router['get'](_0xf33b('0xd'),auth[_0xf33b('0xb')](),controller[_0xf33b('0xe')]);router[_0xf33b('0xa')](_0xf33b('0xf'),auth[_0xf33b('0xb')](),controller[_0xf33b('0x10')]);router['get']('/:id/members',auth[_0xf33b('0xb')](),controller[_0xf33b('0x11')]);router['get']('/:id/teams',auth[_0xf33b('0xb')](),controller[_0xf33b('0x12')]);router[_0xf33b('0xa')](_0xf33b('0x13'),auth[_0xf33b('0xb')](),controller[_0xf33b('0x14')]);router[_0xf33b('0x15')]('/',auth[_0xf33b('0xb')](),controller[_0xf33b('0x16')]);router[_0xf33b('0x15')](_0xf33b('0x17'),auth['isAuthenticated'](),controller[_0xf33b('0x18')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0xf33b('0x19')]);router['put'](_0xf33b('0xf'),auth[_0xf33b('0xb')](),controller[_0xf33b('0x1a')]);router['delete'](_0xf33b('0xf'),auth[_0xf33b('0xb')](),controller['destroy']);router[_0xf33b('0x1b')]('/:id/teams',auth[_0xf33b('0xb')](),controller['removeTeams']);router['delete'](_0xf33b('0x13'),auth[_0xf33b('0xb')](),controller[_0xf33b('0x1c')]);module[_0xf33b('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 36fb82d..0377ef6 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 _0xf2c7=['STRING','name','ENUM','rrmemory','sequelize','exports'];(function(_0x68e9f5,_0x4b5bf1){var _0x26beca=function(_0x1e83aa){while(--_0x1e83aa){_0x68e9f5['push'](_0x68e9f5['shift']());}};_0x26beca(++_0x4b5bf1);}(_0xf2c7,0x1d8));var _0x7f2c=function(_0x3b19ea,_0x518b6b){_0x3b19ea=_0x3b19ea-0x0;var _0x40ece9=_0xf2c7[_0x3b19ea];return _0x40ece9;};'use strict';var Sequelize=require(_0x7f2c('0x0'));module[_0x7f2c('0x1')]={'name':{'type':Sequelize[_0x7f2c('0x2')],'unique':_0x7f2c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7f2c('0x4')](_0x7f2c('0x5'),'beepall','roundrobin')},'description':{'type':Sequelize[_0x7f2c('0x2')]}}; \ No newline at end of file +var _0x1d5b=['roundrobin','sequelize','exports','STRING','INTEGER','rrmemory','beepall'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0x1d5b,0x13c));var _0xb1d5=function(_0x45447d,_0x591ec6){_0x45447d=_0x45447d-0x0;var _0x2962ac=_0x1d5b[_0x45447d];return _0x2962ac;};'use strict';var Sequelize=require(_0xb1d5('0x0'));module[_0xb1d5('0x1')]={'name':{'type':Sequelize[_0xb1d5('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xb1d5('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xb1d5('0x4'),_0xb1d5('0x5'),_0xb1d5('0x6'))},'description':{'type':Sequelize[_0xb1d5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 2ff2f44..f53850b 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 _0xbfab=['compact','removeTeams','isEmpty','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','pick','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','socket.io-emitter','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','name','index','map','WhatsappQueue','rawAttributes','type','getOptions','where','include','query','findAll','catch','show','params','model','keys','filters','intersection','attributes','fields','includeAll','merge','find','create','body','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserWhatsappQueue','nolimit','order','sort','filter','options','UserId','agent','whatsappPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','length','hasOwnProperty','addTeams','ids','User','Agents','voicePause','interface','flatMap','sequelize','transaction','each','emit','userWhatsappQueue:save','select','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','union'];(function(_0x80a5a6,_0xc903eb){var _0xd239bd=function(_0x2f3bea){while(--_0x2f3bea){_0x80a5a6['push'](_0x80a5a6['shift']());}};_0xd239bd(++_0xc903eb);}(_0xbfab,0x82));var _0xbbfa=function(_0x118139,_0x7ce965){_0x118139=_0x118139-0x0;var _0x2fece9=_0xbfab[_0x118139];return _0x2fece9;};'use strict';var BPromise=require(_0xbbfa('0x0'));var util=require(_0xbbfa('0x1'));var _=require(_0xbbfa('0x2'));var squel=require(_0xbbfa('0x3'));var Redis=require(_0xbbfa('0x4'));var qs=require(_0xbbfa('0x5'));var logger=require(_0xbbfa('0x6'))(_0xbbfa('0x7'));var config=require('../../config/environment');var db=require(_0xbbfa('0x8'))['db'];config['redis']=_['defaults'](config[_0xbbfa('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xbbfa('0xa'))(new Redis(config['redis']));require('./whatsappQueue.socket')['register'](socket);function respondWithStatusCode(_0x2fa6ca,_0x4fa99e){_0x4fa99e=_0x4fa99e||0xcc;return function(_0x391e4f){if(_0x391e4f){return _0x2fa6ca[_0xbbfa('0xb')](_0x4fa99e);}return _0x2fa6ca[_0xbbfa('0xc')](_0x4fa99e)[_0xbbfa('0xd')]();};}function respondWithResult(_0x31e692,_0x709bcf){_0x709bcf=_0x709bcf||0xc8;return function(_0x2bdcf8){if(_0x2bdcf8){return _0x31e692['status'](_0x709bcf)['json'](_0x2bdcf8);}};}function respondWithFilteredResult(_0xe41694,_0x3a0f6c){return function(_0x638ebe){if(_0x638ebe){var _0x3bb42d=typeof _0x3a0f6c['offset']===_0xbbfa('0xe')&&typeof _0x3a0f6c[_0xbbfa('0xf')]===_0xbbfa('0xe');var _0x53c01b=_0x638ebe[_0xbbfa('0x10')];var _0x38fe7d=_0x3bb42d?0x0:_0x3a0f6c[_0xbbfa('0x11')];var _0x3d6a12=_0x3bb42d?_0x638ebe[_0xbbfa('0x10')]:_0x3a0f6c['offset']+_0x3a0f6c[_0xbbfa('0xf')];var _0x2f4a14;if(_0x3d6a12>=_0x53c01b){_0x3d6a12=_0x53c01b;_0x2f4a14=0xc8;}else{_0x2f4a14=0xce;}_0xe41694['status'](_0x2f4a14);return _0xe41694[_0xbbfa('0x12')](_0xbbfa('0x13'),_0x38fe7d+'-'+_0x3d6a12+'/'+_0x53c01b)[_0xbbfa('0x14')](_0x638ebe);}return null;};}function saveUpdates(_0x2e7e48){return function(_0x3ead6b){if(_0x3ead6b){return _0x3ead6b[_0xbbfa('0x15')](_0x2e7e48)[_0xbbfa('0x16')](function(_0x3f23d0){return _0x3f23d0;});}return null;};}function removeEntity(_0x101624){return function(_0x17efb9){if(_0x17efb9){return _0x17efb9[_0xbbfa('0x17')]()[_0xbbfa('0x16')](function(){var _0x387c7f=_0x17efb9[_0xbbfa('0x18')]({'plain':!![]});var _0x548245=_0xbbfa('0x19');return db[_0xbbfa('0x1a')]['destroy']({'where':{'type':_0x548245,'resourceId':_0x387c7f['id']}})[_0xbbfa('0x16')](function(){return _0x17efb9;});})['then'](function(){_0x101624[_0xbbfa('0xc')](0xcc)[_0xbbfa('0xd')]();});}};}function handleEntityNotFound(_0x149065){return function(_0x1ac4b2){if(!_0x1ac4b2){_0x149065[_0xbbfa('0xb')](0x194);}return _0x1ac4b2;};}function handleError(_0x241f83,_0xfbc1c8){_0xfbc1c8=_0xfbc1c8||0x1f4;return function(_0x5df663){logger[_0xbbfa('0x1b')](_0x5df663['stack']);if(_0x5df663['name']){delete _0x5df663[_0xbbfa('0x1c')];}_0x241f83['status'](_0xfbc1c8)['send'](_0x5df663);};}exports[_0xbbfa('0x1d')]=function(_0x21a634,_0xe4d74){var _0x2e46b0={};var _0x3116f4={'count':0x0,'rows':[]};var _0x1393bf=_[_0xbbfa('0x1e')](db[_0xbbfa('0x1f')][_0xbbfa('0x20')],function(_0x16ca45){return{'name':_0x16ca45['fieldName'],'type':_0x16ca45[_0xbbfa('0x21')]['key']};});_0x2e46b0=qs[_0xbbfa('0x22')](_0x1393bf,_0x21a634);var _0x2eab93={'where':_0x2e46b0[_0xbbfa('0x23')]};return db[_0xbbfa('0x1f')]['count'](_0x2eab93)[_0xbbfa('0x16')](function(_0x199b92){_0x3116f4[_0xbbfa('0x10')]=_0x199b92;_0x2e46b0[_0xbbfa('0x24')]=qs[_0xbbfa('0x24')](_0x21a634[_0xbbfa('0x25')]);return db[_0xbbfa('0x1f')][_0xbbfa('0x26')](_0x2e46b0);})[_0xbbfa('0x16')](function(_0x4def44){_0x3116f4['rows']=_0x4def44;return _0x3116f4;})[_0xbbfa('0x16')](respondWithFilteredResult(_0xe4d74,_0x2e46b0))[_0xbbfa('0x27')](handleError(_0xe4d74,null));};exports[_0xbbfa('0x28')]=function(_0x227244,_0x15c782){var _0x568445={'raw':!![],'where':{'id':_0x227244[_0xbbfa('0x29')]['id']}},_0x233c36={};_0x233c36[_0xbbfa('0x2a')]=_[_0xbbfa('0x2b')](db['WhatsappQueue'][_0xbbfa('0x20')]);_0x233c36[_0xbbfa('0x25')]=_['keys'](_0x227244[_0xbbfa('0x25')]);_0x233c36[_0xbbfa('0x2c')]=_[_0xbbfa('0x2d')](_0x233c36[_0xbbfa('0x2a')],_0x233c36[_0xbbfa('0x25')]);_0x568445[_0xbbfa('0x2e')]=_[_0xbbfa('0x2d')](_0x233c36['model'],qs[_0xbbfa('0x2f')](_0x227244[_0xbbfa('0x25')][_0xbbfa('0x2f')]));_0x568445['attributes']=_0x568445[_0xbbfa('0x2e')]['length']?_0x568445[_0xbbfa('0x2e')]:_0x233c36[_0xbbfa('0x2a')];if(_0x227244[_0xbbfa('0x25')][_0xbbfa('0x30')]){_0x568445['include']=[{'all':!![]}];}_0x568445=_[_0xbbfa('0x31')]({},_0x568445,_0x227244['options']);return db[_0xbbfa('0x1f')][_0xbbfa('0x32')](_0x568445)[_0xbbfa('0x16')](handleEntityNotFound(_0x15c782,null))[_0xbbfa('0x16')](respondWithResult(_0x15c782,null))[_0xbbfa('0x27')](handleError(_0x15c782,null));};exports[_0xbbfa('0x33')]=function(_0x149011,_0x1fc0c8){return db[_0xbbfa('0x1f')][_0xbbfa('0x33')](_0x149011[_0xbbfa('0x34')],{})[_0xbbfa('0x16')](function(_0x9fc127){var _0x30e0f0=_0x149011['user'][_0xbbfa('0x18')]({'plain':!![]});if(!_0x30e0f0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x30e0f0[_0xbbfa('0x35')]===_0xbbfa('0x36')){var _0x24ea9a=_0x9fc127[_0xbbfa('0x18')]({'plain':!![]});var _0x2f44aa=_0xbbfa('0x19');return db[_0xbbfa('0x37')]['find']({'where':{'name':_0x2f44aa,'userProfileId':_0x30e0f0['userProfileId']},'raw':!![]})[_0xbbfa('0x16')](function(_0x38dba4){if(_0x38dba4&&_0x38dba4['autoAssociation']===0x0){return db[_0xbbfa('0x1a')][_0xbbfa('0x33')]({'name':_0x24ea9a[_0xbbfa('0x1c')],'resourceId':_0x24ea9a['id'],'type':_0x38dba4[_0xbbfa('0x1c')],'sectionId':_0x38dba4['id']},{})[_0xbbfa('0x16')](function(){return _0x9fc127;});}else{return _0x9fc127;}})[_0xbbfa('0x27')](function(_0x4255b0){logger['error'](_0xbbfa('0x38'),_0x4255b0);throw _0x4255b0;});}return _0x9fc127;})['then'](respondWithResult(_0x1fc0c8,0xc9))[_0xbbfa('0x27')](handleError(_0x1fc0c8,null));};exports[_0xbbfa('0x15')]=function(_0x185a27,_0xa2b9cb){if(_0x185a27[_0xbbfa('0x34')]['id']){delete _0x185a27[_0xbbfa('0x34')]['id'];}return db['WhatsappQueue']['find']({'where':{'id':_0x185a27[_0xbbfa('0x29')]['id']}})[_0xbbfa('0x16')](handleEntityNotFound(_0xa2b9cb,null))['then'](saveUpdates(_0x185a27[_0xbbfa('0x34')],null))[_0xbbfa('0x16')](respondWithResult(_0xa2b9cb,null))[_0xbbfa('0x27')](handleError(_0xa2b9cb,null));};exports[_0xbbfa('0x17')]=function(_0x3b895d,_0x5c30c4){return db[_0xbbfa('0x1f')][_0xbbfa('0x32')]({'where':{'id':_0x3b895d[_0xbbfa('0x29')]['id']}})[_0xbbfa('0x16')](handleEntityNotFound(_0x5c30c4,null))[_0xbbfa('0x16')](removeEntity(_0x5c30c4,null))[_0xbbfa('0x27')](handleError(_0x5c30c4,null));};exports[_0xbbfa('0x39')]=function(_0x551625,_0x1179e1){return db['WhatsappQueue']['describe']()[_0xbbfa('0x16')](respondWithResult(_0x1179e1,null))[_0xbbfa('0x27')](handleError(_0x1179e1,null));};exports['getMembers']=function(_0x5687f4,_0x565d8a){var _0x42f02b={'raw':!![],'where':{}},_0x1a5c6f={},_0x1cd544;return db[_0xbbfa('0x1f')][_0xbbfa('0x3a')]({'where':{'id':_0x5687f4[_0xbbfa('0x29')]['id']}})[_0xbbfa('0x16')](handleEntityNotFound(_0x565d8a,null))[_0xbbfa('0x16')](function(_0x2353c5){if(_0x2353c5){_0x1cd544=_0x2353c5[_0xbbfa('0x18')]({'plain':!![]});_0x1a5c6f['model']=_['keys'](db[_0xbbfa('0x3b')]['rawAttributes']);_0x1a5c6f[_0xbbfa('0x25')]=_[_0xbbfa('0x2b')](_0x5687f4[_0xbbfa('0x25')]);_0x1a5c6f[_0xbbfa('0x2c')]=_[_0xbbfa('0x2d')](_0x1a5c6f['model'],_0x1a5c6f[_0xbbfa('0x25')]);_0x42f02b[_0xbbfa('0x2e')]=_['intersection'](_0x1a5c6f[_0xbbfa('0x2a')],qs[_0xbbfa('0x2f')](_0x5687f4[_0xbbfa('0x25')][_0xbbfa('0x2f')]));_0x42f02b[_0xbbfa('0x2e')]=_0x42f02b[_0xbbfa('0x2e')]['length']?_0x42f02b[_0xbbfa('0x2e')]:_0x1a5c6f['model'];if(!_0x5687f4[_0xbbfa('0x25')]['hasOwnProperty'](_0xbbfa('0x3c'))){_0x42f02b[_0xbbfa('0xf')]=qs['limit'](_0x5687f4['query'][_0xbbfa('0xf')]);_0x42f02b[_0xbbfa('0x11')]=qs[_0xbbfa('0x11')](_0x5687f4[_0xbbfa('0x25')][_0xbbfa('0x11')]);}_0x42f02b[_0xbbfa('0x3d')]=qs[_0xbbfa('0x3e')](_0x5687f4[_0xbbfa('0x25')][_0xbbfa('0x3e')]);_0x42f02b['where']=qs[_0xbbfa('0x2c')](_['pick'](_0x5687f4[_0xbbfa('0x25')],_0x1a5c6f[_0xbbfa('0x2c')]));_0x42f02b[_0xbbfa('0x23')]['WhatsappQueueId']=_0x2353c5['id'];if(_0x5687f4[_0xbbfa('0x25')][_0xbbfa('0x3f')]){_0x42f02b['where']=_[_0xbbfa('0x31')](_0x42f02b[_0xbbfa('0x23')],{'$or':_['map'](_0x42f02b[_0xbbfa('0x2e')],function(_0xf09554){var _0x4a7198={};_0x4a7198[_0xf09554]={'$like':'%'+_0x5687f4[_0xbbfa('0x25')][_0xbbfa('0x3f')]+'%'};return _0x4a7198;})});}_0x42f02b=_[_0xbbfa('0x31')]({},_0x42f02b,_0x5687f4[_0xbbfa('0x40')]);return db[_0xbbfa('0x3b')]['findAll'](_0x42f02b);}})[_0xbbfa('0x16')](function(_0x1e6aee){if(_0x1e6aee){return db['User']['findAndCountAll']({'where':{'id':_[_0xbbfa('0x1e')](_0x1e6aee,_0xbbfa('0x41')),'role':_0xbbfa('0x42')},'attributes':['id',_0xbbfa('0x1c'),_0xbbfa('0x43'),_0xbbfa('0x44'),_0xbbfa('0x45')]});}})[_0xbbfa('0x16')](function(_0x38b081){if(_0x38b081){return{'count':_0x38b081[_0xbbfa('0x10')],'rows':_[_0xbbfa('0x1e')](_0x38b081[_0xbbfa('0x46')],function(_0x13708c){return{'membername':_0x13708c[_0xbbfa('0x1c')],'UserId':_0x13708c['id'],'queue_name':_0x1cd544[_0xbbfa('0x1c')],'WhatsappQueueId':_0x1cd544['id'],'interface':util[_0xbbfa('0x47')](_0xbbfa('0x48'),_0xbbfa('0x49'),_0x13708c['name']),'penalty':0x0,'paused':_0x13708c[_0xbbfa('0x43')],'createdAt':_0x13708c['createdAt'],'updatedAt':_0x13708c['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x565d8a,_0x42f02b))[_0xbbfa('0x27')](handleError(_0x565d8a,null));};exports[_0xbbfa('0x4a')]=function(_0x7e3c65,_0xb126f1){var _0x3c97e2={};var _0x271993={};var _0x2c9d6b;var _0x47cf4d;return db['WhatsappQueue'][_0xbbfa('0x3a')]({'where':{'id':_0x7e3c65[_0xbbfa('0x29')]['id']}})['then'](handleEntityNotFound(_0xb126f1,null))[_0xbbfa('0x16')](function(_0x54dc3b){if(_0x54dc3b){_0x2c9d6b=_0x54dc3b;_0x271993['model']=_[_0xbbfa('0x2b')](db['Team'][_0xbbfa('0x20')]);_0x271993[_0xbbfa('0x25')]=_['keys'](_0x7e3c65[_0xbbfa('0x25')]);_0x271993[_0xbbfa('0x2c')]=_['intersection'](_0x271993['model'],_0x271993['query']);_0x3c97e2[_0xbbfa('0x2e')]=_[_0xbbfa('0x2d')](_0x271993[_0xbbfa('0x2a')],qs['fields'](_0x7e3c65['query'][_0xbbfa('0x2f')]));_0x3c97e2['attributes']=_0x3c97e2[_0xbbfa('0x2e')][_0xbbfa('0x4b')]?_0x3c97e2[_0xbbfa('0x2e')]:_0x271993[_0xbbfa('0x2a')];_0x3c97e2[_0xbbfa('0x3d')]=qs[_0xbbfa('0x3e')](_0x7e3c65[_0xbbfa('0x25')][_0xbbfa('0x3e')]);_0x3c97e2[_0xbbfa('0x23')]=qs[_0xbbfa('0x2c')](_['pick'](_0x7e3c65[_0xbbfa('0x25')],_0x271993[_0xbbfa('0x2c')]));if(_0x7e3c65[_0xbbfa('0x25')][_0xbbfa('0x3f')]){_0x3c97e2['where']=_[_0xbbfa('0x31')](_0x3c97e2[_0xbbfa('0x23')],{'$or':_[_0xbbfa('0x1e')](_0x3c97e2[_0xbbfa('0x2e')],function(_0x1445f9){var _0xa9110c={};_0xa9110c[_0x1445f9]={'$like':'%'+_0x7e3c65['query'][_0xbbfa('0x3f')]+'%'};return _0xa9110c;})});}_0x3c97e2=_[_0xbbfa('0x31')]({},_0x3c97e2,_0x7e3c65[_0xbbfa('0x40')]);return _0x2c9d6b[_0xbbfa('0x4a')](_0x3c97e2);}})[_0xbbfa('0x16')](function(_0x1478ab){if(_0x1478ab){_0x47cf4d=_0x1478ab[_0xbbfa('0x4b')];if(!_0x7e3c65[_0xbbfa('0x25')][_0xbbfa('0x4c')](_0xbbfa('0x3c'))){_0x3c97e2['limit']=qs[_0xbbfa('0xf')](_0x7e3c65[_0xbbfa('0x25')]['limit']);_0x3c97e2[_0xbbfa('0x11')]=qs['offset'](_0x7e3c65['query'][_0xbbfa('0x11')]);}return _0x2c9d6b[_0xbbfa('0x4a')](_0x3c97e2);}})[_0xbbfa('0x16')](function(_0x80f57){if(_0x80f57){return _0x80f57?{'count':_0x47cf4d,'rows':_0x80f57}:null;}})[_0xbbfa('0x16')](respondWithResult(_0xb126f1,null))[_0xbbfa('0x27')](handleError(_0xb126f1,null));};exports[_0xbbfa('0x4d')]=function(_0x51d87b,_0x4a78f7){var _0x4d52b8=_0x51d87b['body'][_0xbbfa('0x4e')];return db['Team'][_0xbbfa('0x26')]({'where':{'id':_0x4d52b8},'attributes':['id'],'include':[{'model':db[_0xbbfa('0x4f')],'as':_0xbbfa('0x50'),'attributes':['id',_0xbbfa('0x1c'),'online',_0xbbfa('0x51'),_0xbbfa('0x52')],'raw':!![]}]})[_0xbbfa('0x16')](function(_0x3e2762){if(_0x3e2762){var _0x2083ec=_[_0xbbfa('0x53')](_0x3e2762,function(_0x27d224){var _0x242f1c=_0x27d224['get']({'plain':!![]});return _0x242f1c[_0xbbfa('0x50')];});return db[_0xbbfa('0x1f')]['find']({'where':{'id':_0x51d87b['params']['id']}})[_0xbbfa('0x16')](function(_0x39f6b0){return db[_0xbbfa('0x54')][_0xbbfa('0x55')](function(_0x550be0){return _0x39f6b0[_0xbbfa('0x4d')](_0x4d52b8,{'transaction':_0x550be0})['then'](function(){return BPromise[_0xbbfa('0x56')](_0x2083ec,function(_0x392992){return db[_0xbbfa('0x3b')]['findOrCreate']({'where':{'UserId':_0x392992['id'],'WhatsappQueueId':_0x51d87b[_0xbbfa('0x29')]['id']},'transaction':_0x550be0});});})[_0xbbfa('0x16')](function(){_0x2083ec['forEach'](function(_0x1006a1){socket[_0xbbfa('0x57')](_0xbbfa('0x58'),{'UserId':_0x1006a1['id'],'WhatsappQueueId':_0x39f6b0['id']});});});});});}})[_0xbbfa('0x16')](respondWithStatusCode(_0x4a78f7,null))[_0xbbfa('0x27')](handleError(_0x4a78f7,null));};exports['removeTeams']=function(_0x43e0ce,_0x4b4d95){return db['Team'][_0xbbfa('0x26')]({'where':{'id':_0x43e0ce[_0xbbfa('0x25')][_0xbbfa('0x4e')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xbbfa('0x50'),'attributes':['id'],'raw':!![]}]})[_0xbbfa('0x16')](handleEntityNotFound(_0x4b4d95,null))['then'](function(_0x5da751){var _0x21b8c6=_['map'](_0x5da751,'id');var _0x1f416b=[];var _0x13ec10=[];var _0x1e4866=squel[_0xbbfa('0x59')]();_0x1e4866['field'](_0xbbfa('0x5a'))[_0xbbfa('0x5b')](_0xbbfa('0x5c'),'tq')['join'](_0xbbfa('0x5d'),'ut',_0xbbfa('0x5e'))[_0xbbfa('0x23')](_0xbbfa('0x5f'),_0x43e0ce[_0xbbfa('0x29')]['id']);for(var _0x52615d=0x0;_0x52615d<_0x5da751['length'];_0x52615d+=0x1){let _0x45d198=_0x5da751[_0x52615d];for(var _0x6aad14=0x0;_0x6aad14<_0x45d198['Agents']['length'];_0x6aad14+=0x1){let _0x4acd13=_0x45d198[_0xbbfa('0x50')][_0x6aad14];var _0x2f2290=_0x1e4866[_0xbbfa('0x60')]();_0x2f2290[_0xbbfa('0x23')](_0xbbfa('0x61'),_0x4acd13['id']);_0x13ec10[_0xbbfa('0x62')](db[_0xbbfa('0x54')][_0xbbfa('0x25')](_0x2f2290[_0xbbfa('0x63')](),{'type':db[_0xbbfa('0x54')][_0xbbfa('0x64')][_0xbbfa('0x65')]})[_0xbbfa('0x16')](function(_0x491301){if(_0x491301['length']===0x1){return _0x4acd13['id'];}else{var _0x2f837b=_[_0xbbfa('0x66')](_[_0xbbfa('0x1e')](_0x491301,_0xbbfa('0x67')),function(_0x19ce8d){return _[_0xbbfa('0x68')](_0x21b8c6,_0x19ce8d);});if(_0x2f837b){return _0x4acd13['id'];}}}));}}return BPromise['all'](_0x13ec10)['then'](function(_0x264bab){_0x1f416b=_(_0x1f416b)[_0xbbfa('0x69')](_0x264bab)[_0xbbfa('0x6a')]()['value']();return db[_0xbbfa('0x1f')][_0xbbfa('0x32')]({'where':{'id':_0x43e0ce[_0xbbfa('0x29')]['id']}})['then'](function(_0x497a23){return db[_0xbbfa('0x54')]['transaction'](function(_0x1fb607){return _0x497a23[_0xbbfa('0x6b')](_0x43e0ce['query'][_0xbbfa('0x4e')],{'transaction':_0x1fb607})[_0xbbfa('0x16')](function(){if(!_[_0xbbfa('0x6c')](_0x1f416b)){return _0x497a23[_0xbbfa('0x6d')](_0x1f416b,{'transaction':_0x1fb607});}})[_0xbbfa('0x16')](function(){_0x1f416b[_0xbbfa('0x6e')](function(_0x3c2175){socket[_0xbbfa('0x57')](_0xbbfa('0x6f'),{'UserId':_0x3c2175,'WhatsappQueueId':_0x497a23['id']});});});});});});})[_0xbbfa('0x16')](respondWithStatusCode(_0x4b4d95,null))['catch'](handleError(_0x4b4d95,null));};exports[_0xbbfa('0x70')]=function(_0x3fca84,_0x1a31dd){return db['WhatsappQueue']['find']({'where':{'id':_0x3fca84[_0xbbfa('0x29')]['id']}})['then'](handleEntityNotFound(_0x1a31dd,null))[_0xbbfa('0x16')](function(_0x294381){if(_0x294381){return _0x294381[_0xbbfa('0x70')](_0x3fca84['body'][_0xbbfa('0x4e')],_[_0xbbfa('0x71')](_0x3fca84[_0xbbfa('0x34')],['ids','id'])||{})[_0xbbfa('0x72')](function(_0x1c2d68){for(var _0x4262fa=0x0;_0x4262fa<_0x3fca84[_0xbbfa('0x34')][_0xbbfa('0x4e')][_0xbbfa('0x4b')];_0x4262fa+=0x1){socket[_0xbbfa('0x57')](_0xbbfa('0x58'),{'UserId':Number(_0x3fca84['body'][_0xbbfa('0x4e')][_0x4262fa]),'WhatsappQueueId':Number(_0x3fca84[_0xbbfa('0x29')]['id'])});}return _0x1c2d68;});}})['then'](respondWithResult(_0x1a31dd,null))[_0xbbfa('0x27')](handleError(_0x1a31dd,null));};exports['removeAgents']=function(_0x4e6dac,_0x126c88){return db[_0xbbfa('0x1f')][_0xbbfa('0x32')]({'where':{'id':_0x4e6dac[_0xbbfa('0x29')]['id']}})[_0xbbfa('0x16')](handleEntityNotFound(_0x126c88,null))[_0xbbfa('0x16')](function(_0x3906a){if(_0x3906a){return _0x3906a[_0xbbfa('0x6d')](_0x4e6dac[_0xbbfa('0x25')][_0xbbfa('0x4e')])[_0xbbfa('0x16')](function(){if(_[_0xbbfa('0x73')](_0x4e6dac[_0xbbfa('0x25')]['ids'])){for(var _0x5d85ad=0x0;_0x5d85ad<_0x4e6dac['query'][_0xbbfa('0x4e')]['length'];_0x5d85ad+=0x1){socket[_0xbbfa('0x57')](_0xbbfa('0x6f'),{'UserId':Number(_0x4e6dac['query']['ids'][_0x5d85ad]),'WhatsappQueueId':Number(_0x4e6dac[_0xbbfa('0x29')]['id'])});}}else{socket[_0xbbfa('0x57')](_0xbbfa('0x6f'),{'UserId':Number(_0x4e6dac[_0xbbfa('0x25')][_0xbbfa('0x4e')]),'WhatsappQueueId':Number(_0x4e6dac[_0xbbfa('0x29')]['id'])});}});}})[_0xbbfa('0x16')](respondWithStatusCode(_0x126c88,null))[_0xbbfa('0x27')](handleError(_0x126c88,null));};exports[_0xbbfa('0x74')]=function(_0x12ab9e,_0x265f41){var _0x366879={};var _0x5a3302={};var _0x4a5f04;var _0x41d7de;return db[_0xbbfa('0x1f')][_0xbbfa('0x3a')]({'where':{'id':_0x12ab9e['params']['id']}})[_0xbbfa('0x16')](handleEntityNotFound(_0x265f41,null))['then'](function(_0xccb406){if(_0xccb406){_0x4a5f04=_0xccb406;_0x5a3302[_0xbbfa('0x2a')]=_[_0xbbfa('0x2b')](db[_0xbbfa('0x4f')][_0xbbfa('0x20')]);_0x5a3302[_0xbbfa('0x25')]=_[_0xbbfa('0x2b')](_0x12ab9e[_0xbbfa('0x25')]);_0x5a3302['filters']=_['intersection'](_0x5a3302['model'],_0x5a3302[_0xbbfa('0x25')]);_0x366879[_0xbbfa('0x2e')]=_[_0xbbfa('0x2d')](_0x5a3302[_0xbbfa('0x2a')],qs[_0xbbfa('0x2f')](_0x12ab9e[_0xbbfa('0x25')][_0xbbfa('0x2f')]));_0x366879[_0xbbfa('0x2e')]=_0x366879['attributes'][_0xbbfa('0x4b')]?_0x366879[_0xbbfa('0x2e')]:_0x5a3302[_0xbbfa('0x2a')];_0x366879[_0xbbfa('0x3d')]=qs[_0xbbfa('0x3e')](_0x12ab9e[_0xbbfa('0x25')][_0xbbfa('0x3e')]);_0x366879[_0xbbfa('0x23')]=qs[_0xbbfa('0x2c')](_[_0xbbfa('0x75')](_0x12ab9e['query'],_0x5a3302[_0xbbfa('0x2c')]));if(_0x12ab9e[_0xbbfa('0x25')][_0xbbfa('0x3f')]){_0x366879[_0xbbfa('0x23')]=_[_0xbbfa('0x31')](_0x366879[_0xbbfa('0x23')],{'$or':_['map'](_0x366879[_0xbbfa('0x2e')],function(_0x13b001){var _0x22e841={};_0x22e841[_0x13b001]={'$like':'%'+_0x12ab9e['query'][_0xbbfa('0x3f')]+'%'};return _0x22e841;})});}_0x366879=_[_0xbbfa('0x31')]({},_0x366879,_0x12ab9e[_0xbbfa('0x40')]);return _0x4a5f04['getAgents'](_0x366879);}})[_0xbbfa('0x16')](function(_0x4c8c11){if(_0x4c8c11){_0x41d7de=_0x4c8c11[_0xbbfa('0x4b')];if(!_0x12ab9e[_0xbbfa('0x25')][_0xbbfa('0x4c')](_0xbbfa('0x3c'))){_0x366879['limit']=qs['limit'](_0x12ab9e[_0xbbfa('0x25')][_0xbbfa('0xf')]);_0x366879[_0xbbfa('0x11')]=qs[_0xbbfa('0x11')](_0x12ab9e[_0xbbfa('0x25')][_0xbbfa('0x11')]);}return _0x4a5f04[_0xbbfa('0x74')](_0x366879);}})[_0xbbfa('0x16')](function(_0xf5b62d){if(_0xf5b62d){return _0xf5b62d?{'count':_0x41d7de,'rows':_0xf5b62d}:null;}})['then'](respondWithResult(_0x265f41,null))['catch'](handleError(_0x265f41,null));}; \ No newline at end of file +var _0x3bc7=['removeTeams','Agents','select','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','TeamId','all','union','value','isEmpty','removeAgents','addAgents','omit','spread','isArray','userWhatsappQueue:remove','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./whatsappQueue.socket','register','status','json','offset','undefined','limit','count','Content-Range','then','destroy','get','UserProfileResource','end','sendStatus','error','name','send','index','WhatsappQueue','rawAttributes','fieldName','type','getOptions','where','include','query','findAll','rows','catch','show','params','model','keys','filters','attributes','intersection','fields','length','merge','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','update','body','describe','getMembers','findOne','nolimit','order','pick','filter','User','findAndCountAll','UserId','agent','updatedAt','createdAt','map','format','%s/%s','whatsappPause','getTeams','Team','sort','hasOwnProperty','ids','online','interface','flatMap','transaction','addTeams','each','UserWhatsappQueue','findOrCreate','forEach','emit','userWhatsappQueue:save'];(function(_0x153083,_0xa97d87){var _0x2396d5=function(_0x282cb4){while(--_0x282cb4){_0x153083['push'](_0x153083['shift']());}};_0x2396d5(++_0xa97d87);}(_0x3bc7,0x99));var _0x73bc=function(_0x2df13f,_0x3a3921){_0x2df13f=_0x2df13f-0x0;var _0x5c8a3f=_0x3bc7[_0x2df13f];return _0x5c8a3f;};'use strict';var BPromise=require(_0x73bc('0x0'));var util=require(_0x73bc('0x1'));var _=require(_0x73bc('0x2'));var squel=require(_0x73bc('0x3'));var Redis=require('ioredis');var qs=require(_0x73bc('0x4'));var logger=require(_0x73bc('0x5'))(_0x73bc('0x6'));var config=require(_0x73bc('0x7'));var db=require(_0x73bc('0x8'))['db'];config['redis']=_[_0x73bc('0x9')](config[_0x73bc('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x73bc('0xb'))(new Redis(config[_0x73bc('0xa')]));require(_0x73bc('0xc'))[_0x73bc('0xd')](socket);function respondWithStatusCode(_0x56c845,_0x35f845){_0x35f845=_0x35f845||0xcc;return function(_0xbe5c36){if(_0xbe5c36){return _0x56c845['sendStatus'](_0x35f845);}return _0x56c845[_0x73bc('0xe')](_0x35f845)['end']();};}function respondWithResult(_0x47c165,_0x2aaff0){_0x2aaff0=_0x2aaff0||0xc8;return function(_0xc6e5ee){if(_0xc6e5ee){return _0x47c165[_0x73bc('0xe')](_0x2aaff0)[_0x73bc('0xf')](_0xc6e5ee);}};}function respondWithFilteredResult(_0x45dd26,_0x503e9a){return function(_0xd2a31c){if(_0xd2a31c){var _0xe48743=typeof _0x503e9a[_0x73bc('0x10')]===_0x73bc('0x11')&&typeof _0x503e9a[_0x73bc('0x12')]===_0x73bc('0x11');var _0x4294fc=_0xd2a31c[_0x73bc('0x13')];var _0x55d3f8=_0xe48743?0x0:_0x503e9a['offset'];var _0x1f2e6c=_0xe48743?_0xd2a31c[_0x73bc('0x13')]:_0x503e9a[_0x73bc('0x10')]+_0x503e9a[_0x73bc('0x12')];var _0x2ebf02;if(_0x1f2e6c>=_0x4294fc){_0x1f2e6c=_0x4294fc;_0x2ebf02=0xc8;}else{_0x2ebf02=0xce;}_0x45dd26[_0x73bc('0xe')](_0x2ebf02);return _0x45dd26['set'](_0x73bc('0x14'),_0x55d3f8+'-'+_0x1f2e6c+'/'+_0x4294fc)[_0x73bc('0xf')](_0xd2a31c);}return null;};}function saveUpdates(_0x4cd0d5){return function(_0x12f955){if(_0x12f955){return _0x12f955['update'](_0x4cd0d5)[_0x73bc('0x15')](function(_0x5a1ef4){return _0x5a1ef4;});}return null;};}function removeEntity(_0x5affd5){return function(_0x21a616){if(_0x21a616){return _0x21a616[_0x73bc('0x16')]()[_0x73bc('0x15')](function(){var _0x47a8a3=_0x21a616[_0x73bc('0x17')]({'plain':!![]});var _0x4e335b='WhatsappQueues';return db[_0x73bc('0x18')]['destroy']({'where':{'type':_0x4e335b,'resourceId':_0x47a8a3['id']}})['then'](function(){return _0x21a616;});})[_0x73bc('0x15')](function(){_0x5affd5[_0x73bc('0xe')](0xcc)[_0x73bc('0x19')]();});}};}function handleEntityNotFound(_0x402a87){return function(_0x3766ca){if(!_0x3766ca){_0x402a87[_0x73bc('0x1a')](0x194);}return _0x3766ca;};}function handleError(_0x3e1d6f,_0x1672fe){_0x1672fe=_0x1672fe||0x1f4;return function(_0x36ab71){logger[_0x73bc('0x1b')](_0x36ab71['stack']);if(_0x36ab71[_0x73bc('0x1c')]){delete _0x36ab71[_0x73bc('0x1c')];}_0x3e1d6f['status'](_0x1672fe)[_0x73bc('0x1d')](_0x36ab71);};}exports[_0x73bc('0x1e')]=function(_0x4cd5f7,_0x5d6368){var _0x54930c={};var _0x487dc6={'count':0x0,'rows':[]};var _0x175b29=_['map'](db[_0x73bc('0x1f')][_0x73bc('0x20')],function(_0x344a4e){return{'name':_0x344a4e[_0x73bc('0x21')],'type':_0x344a4e[_0x73bc('0x22')]['key']};});_0x54930c=qs[_0x73bc('0x23')](_0x175b29,_0x4cd5f7);var _0x14aa94={'where':_0x54930c[_0x73bc('0x24')]};return db[_0x73bc('0x1f')]['count'](_0x14aa94)[_0x73bc('0x15')](function(_0x4846ca){_0x487dc6['count']=_0x4846ca;_0x54930c['include']=qs[_0x73bc('0x25')](_0x4cd5f7[_0x73bc('0x26')]);return db[_0x73bc('0x1f')][_0x73bc('0x27')](_0x54930c);})['then'](function(_0x2b2b5b){_0x487dc6[_0x73bc('0x28')]=_0x2b2b5b;return _0x487dc6;})[_0x73bc('0x15')](respondWithFilteredResult(_0x5d6368,_0x54930c))[_0x73bc('0x29')](handleError(_0x5d6368,null));};exports[_0x73bc('0x2a')]=function(_0x42cc69,_0x27ddbf){var _0x51217a={'raw':!![],'where':{'id':_0x42cc69[_0x73bc('0x2b')]['id']}},_0x290363={};_0x290363[_0x73bc('0x2c')]=_['keys'](db[_0x73bc('0x1f')]['rawAttributes']);_0x290363['query']=_[_0x73bc('0x2d')](_0x42cc69['query']);_0x290363[_0x73bc('0x2e')]=_['intersection'](_0x290363[_0x73bc('0x2c')],_0x290363['query']);_0x51217a[_0x73bc('0x2f')]=_[_0x73bc('0x30')](_0x290363[_0x73bc('0x2c')],qs[_0x73bc('0x31')](_0x42cc69[_0x73bc('0x26')][_0x73bc('0x31')]));_0x51217a[_0x73bc('0x2f')]=_0x51217a[_0x73bc('0x2f')][_0x73bc('0x32')]?_0x51217a[_0x73bc('0x2f')]:_0x290363['model'];if(_0x42cc69[_0x73bc('0x26')]['includeAll']){_0x51217a[_0x73bc('0x25')]=[{'all':!![]}];}_0x51217a=_[_0x73bc('0x33')]({},_0x51217a,_0x42cc69[_0x73bc('0x34')]);return db[_0x73bc('0x1f')][_0x73bc('0x35')](_0x51217a)[_0x73bc('0x15')](handleEntityNotFound(_0x27ddbf,null))['then'](respondWithResult(_0x27ddbf,null))[_0x73bc('0x29')](handleError(_0x27ddbf,null));};exports[_0x73bc('0x36')]=function(_0x45a7c2,_0x28ec73){return db[_0x73bc('0x1f')]['create'](_0x45a7c2['body'],{})[_0x73bc('0x15')](function(_0x287706){var _0x171f53=_0x45a7c2['user'][_0x73bc('0x17')]({'plain':!![]});if(!_0x171f53)throw new Error(_0x73bc('0x37'));if(_0x171f53[_0x73bc('0x38')]===_0x73bc('0x39')){var _0x4aabac=_0x287706[_0x73bc('0x17')]({'plain':!![]});var _0x13a0ca='WhatsappQueues';return db[_0x73bc('0x3a')][_0x73bc('0x35')]({'where':{'name':_0x13a0ca,'userProfileId':_0x171f53['userProfileId']},'raw':!![]})[_0x73bc('0x15')](function(_0x246f34){if(_0x246f34&&_0x246f34[_0x73bc('0x3b')]===0x0){return db[_0x73bc('0x18')][_0x73bc('0x36')]({'name':_0x4aabac[_0x73bc('0x1c')],'resourceId':_0x4aabac['id'],'type':_0x246f34[_0x73bc('0x1c')],'sectionId':_0x246f34['id']},{})[_0x73bc('0x15')](function(){return _0x287706;});}else{return _0x287706;}})[_0x73bc('0x29')](function(_0x2cbd12){logger[_0x73bc('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2cbd12);throw _0x2cbd12;});}return _0x287706;})['then'](respondWithResult(_0x28ec73,0xc9))[_0x73bc('0x29')](handleError(_0x28ec73,null));};exports[_0x73bc('0x3c')]=function(_0x27ee67,_0x1325e4){if(_0x27ee67[_0x73bc('0x3d')]['id']){delete _0x27ee67[_0x73bc('0x3d')]['id'];}return db['WhatsappQueue']['find']({'where':{'id':_0x27ee67[_0x73bc('0x2b')]['id']}})[_0x73bc('0x15')](handleEntityNotFound(_0x1325e4,null))[_0x73bc('0x15')](saveUpdates(_0x27ee67[_0x73bc('0x3d')],null))['then'](respondWithResult(_0x1325e4,null))['catch'](handleError(_0x1325e4,null));};exports['destroy']=function(_0x158ca6,_0x1642ed){return db[_0x73bc('0x1f')]['find']({'where':{'id':_0x158ca6[_0x73bc('0x2b')]['id']}})[_0x73bc('0x15')](handleEntityNotFound(_0x1642ed,null))[_0x73bc('0x15')](removeEntity(_0x1642ed,null))[_0x73bc('0x29')](handleError(_0x1642ed,null));};exports[_0x73bc('0x3e')]=function(_0x8beac,_0x22073b){return db[_0x73bc('0x1f')][_0x73bc('0x3e')]()[_0x73bc('0x15')](respondWithResult(_0x22073b,null))[_0x73bc('0x29')](handleError(_0x22073b,null));};exports[_0x73bc('0x3f')]=function(_0x4e05d3,_0x2982cb){var _0x29196c={'raw':!![],'where':{}},_0x4e1b4e={},_0x280f60;return db[_0x73bc('0x1f')][_0x73bc('0x40')]({'where':{'id':_0x4e05d3[_0x73bc('0x2b')]['id']}})[_0x73bc('0x15')](handleEntityNotFound(_0x2982cb,null))[_0x73bc('0x15')](function(_0x419dec){if(_0x419dec){_0x280f60=_0x419dec[_0x73bc('0x17')]({'plain':!![]});_0x4e1b4e[_0x73bc('0x2c')]=_[_0x73bc('0x2d')](db['UserWhatsappQueue'][_0x73bc('0x20')]);_0x4e1b4e[_0x73bc('0x26')]=_[_0x73bc('0x2d')](_0x4e05d3[_0x73bc('0x26')]);_0x4e1b4e[_0x73bc('0x2e')]=_[_0x73bc('0x30')](_0x4e1b4e['model'],_0x4e1b4e[_0x73bc('0x26')]);_0x29196c[_0x73bc('0x2f')]=_[_0x73bc('0x30')](_0x4e1b4e[_0x73bc('0x2c')],qs['fields'](_0x4e05d3['query']['fields']));_0x29196c[_0x73bc('0x2f')]=_0x29196c[_0x73bc('0x2f')][_0x73bc('0x32')]?_0x29196c[_0x73bc('0x2f')]:_0x4e1b4e[_0x73bc('0x2c')];if(!_0x4e05d3[_0x73bc('0x26')]['hasOwnProperty'](_0x73bc('0x41'))){_0x29196c[_0x73bc('0x12')]=qs[_0x73bc('0x12')](_0x4e05d3[_0x73bc('0x26')][_0x73bc('0x12')]);_0x29196c[_0x73bc('0x10')]=qs[_0x73bc('0x10')](_0x4e05d3[_0x73bc('0x26')][_0x73bc('0x10')]);}_0x29196c[_0x73bc('0x42')]=qs['sort'](_0x4e05d3[_0x73bc('0x26')]['sort']);_0x29196c['where']=qs['filters'](_[_0x73bc('0x43')](_0x4e05d3[_0x73bc('0x26')],_0x4e1b4e[_0x73bc('0x2e')]));_0x29196c[_0x73bc('0x24')]['WhatsappQueueId']=_0x419dec['id'];if(_0x4e05d3[_0x73bc('0x26')][_0x73bc('0x44')]){_0x29196c[_0x73bc('0x24')]=_[_0x73bc('0x33')](_0x29196c[_0x73bc('0x24')],{'$or':_['map'](_0x29196c[_0x73bc('0x2f')],function(_0x56fe71){var _0x11ea91={};_0x11ea91[_0x56fe71]={'$like':'%'+_0x4e05d3[_0x73bc('0x26')][_0x73bc('0x44')]+'%'};return _0x11ea91;})});}_0x29196c=_[_0x73bc('0x33')]({},_0x29196c,_0x4e05d3[_0x73bc('0x34')]);return db['UserWhatsappQueue'][_0x73bc('0x27')](_0x29196c);}})[_0x73bc('0x15')](function(_0x2a9eee){if(_0x2a9eee){return db[_0x73bc('0x45')][_0x73bc('0x46')]({'where':{'id':_['map'](_0x2a9eee,_0x73bc('0x47')),'role':_0x73bc('0x48')},'attributes':['id',_0x73bc('0x1c'),'whatsappPause',_0x73bc('0x49'),_0x73bc('0x4a')]});}})[_0x73bc('0x15')](function(_0x20fb4f){if(_0x20fb4f){return{'count':_0x20fb4f['count'],'rows':_[_0x73bc('0x4b')](_0x20fb4f[_0x73bc('0x28')],function(_0x1e3fb5){return{'membername':_0x1e3fb5[_0x73bc('0x1c')],'UserId':_0x1e3fb5['id'],'queue_name':_0x280f60[_0x73bc('0x1c')],'WhatsappQueueId':_0x280f60['id'],'interface':util[_0x73bc('0x4c')](_0x73bc('0x4d'),'SIP',_0x1e3fb5[_0x73bc('0x1c')]),'penalty':0x0,'paused':_0x1e3fb5[_0x73bc('0x4e')],'createdAt':_0x1e3fb5[_0x73bc('0x4a')],'updatedAt':_0x1e3fb5[_0x73bc('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x73bc('0x15')](respondWithFilteredResult(_0x2982cb,_0x29196c))[_0x73bc('0x29')](handleError(_0x2982cb,null));};exports[_0x73bc('0x4f')]=function(_0x151c46,_0x1e3e81){var _0x3b44d6={};var _0x548b52={};var _0x2b4456;var _0x474ca4;return db[_0x73bc('0x1f')][_0x73bc('0x40')]({'where':{'id':_0x151c46[_0x73bc('0x2b')]['id']}})[_0x73bc('0x15')](handleEntityNotFound(_0x1e3e81,null))['then'](function(_0x13c9b1){if(_0x13c9b1){_0x2b4456=_0x13c9b1;_0x548b52[_0x73bc('0x2c')]=_[_0x73bc('0x2d')](db[_0x73bc('0x50')][_0x73bc('0x20')]);_0x548b52[_0x73bc('0x26')]=_['keys'](_0x151c46[_0x73bc('0x26')]);_0x548b52[_0x73bc('0x2e')]=_['intersection'](_0x548b52[_0x73bc('0x2c')],_0x548b52[_0x73bc('0x26')]);_0x3b44d6[_0x73bc('0x2f')]=_['intersection'](_0x548b52['model'],qs[_0x73bc('0x31')](_0x151c46[_0x73bc('0x26')][_0x73bc('0x31')]));_0x3b44d6[_0x73bc('0x2f')]=_0x3b44d6[_0x73bc('0x2f')]['length']?_0x3b44d6[_0x73bc('0x2f')]:_0x548b52[_0x73bc('0x2c')];_0x3b44d6[_0x73bc('0x42')]=qs[_0x73bc('0x51')](_0x151c46['query'][_0x73bc('0x51')]);_0x3b44d6[_0x73bc('0x24')]=qs[_0x73bc('0x2e')](_['pick'](_0x151c46[_0x73bc('0x26')],_0x548b52['filters']));if(_0x151c46['query']['filter']){_0x3b44d6['where']=_[_0x73bc('0x33')](_0x3b44d6[_0x73bc('0x24')],{'$or':_[_0x73bc('0x4b')](_0x3b44d6['attributes'],function(_0x421ba6){var _0x2dff87={};_0x2dff87[_0x421ba6]={'$like':'%'+_0x151c46['query'][_0x73bc('0x44')]+'%'};return _0x2dff87;})});}_0x3b44d6=_[_0x73bc('0x33')]({},_0x3b44d6,_0x151c46[_0x73bc('0x34')]);return _0x2b4456[_0x73bc('0x4f')](_0x3b44d6);}})[_0x73bc('0x15')](function(_0x2f04bd){if(_0x2f04bd){_0x474ca4=_0x2f04bd['length'];if(!_0x151c46[_0x73bc('0x26')][_0x73bc('0x52')](_0x73bc('0x41'))){_0x3b44d6[_0x73bc('0x12')]=qs[_0x73bc('0x12')](_0x151c46[_0x73bc('0x26')][_0x73bc('0x12')]);_0x3b44d6[_0x73bc('0x10')]=qs['offset'](_0x151c46[_0x73bc('0x26')]['offset']);}return _0x2b4456['getTeams'](_0x3b44d6);}})[_0x73bc('0x15')](function(_0x5adc56){if(_0x5adc56){return _0x5adc56?{'count':_0x474ca4,'rows':_0x5adc56}:null;}})[_0x73bc('0x15')](respondWithResult(_0x1e3e81,null))[_0x73bc('0x29')](handleError(_0x1e3e81,null));};exports['addTeams']=function(_0x2271f5,_0x44e38f){var _0x4b62c4=_0x2271f5[_0x73bc('0x3d')][_0x73bc('0x53')];return db[_0x73bc('0x50')][_0x73bc('0x27')]({'where':{'id':_0x4b62c4},'attributes':['id'],'include':[{'model':db[_0x73bc('0x45')],'as':'Agents','attributes':['id',_0x73bc('0x1c'),_0x73bc('0x54'),'voicePause',_0x73bc('0x55')],'raw':!![]}]})[_0x73bc('0x15')](function(_0x2d280b){if(_0x2d280b){var _0x433b79=_[_0x73bc('0x56')](_0x2d280b,function(_0x5c97d0){var _0x462664=_0x5c97d0[_0x73bc('0x17')]({'plain':!![]});return _0x462664['Agents'];});return db[_0x73bc('0x1f')][_0x73bc('0x35')]({'where':{'id':_0x2271f5['params']['id']}})['then'](function(_0x3d327d){return db['sequelize'][_0x73bc('0x57')](function(_0x36f71b){return _0x3d327d[_0x73bc('0x58')](_0x4b62c4,{'transaction':_0x36f71b})[_0x73bc('0x15')](function(){return BPromise[_0x73bc('0x59')](_0x433b79,function(_0x3cf870){return db[_0x73bc('0x5a')][_0x73bc('0x5b')]({'where':{'UserId':_0x3cf870['id'],'WhatsappQueueId':_0x2271f5[_0x73bc('0x2b')]['id']},'transaction':_0x36f71b});});})['then'](function(){_0x433b79[_0x73bc('0x5c')](function(_0x5179c8){socket[_0x73bc('0x5d')](_0x73bc('0x5e'),{'UserId':_0x5179c8['id'],'WhatsappQueueId':_0x3d327d['id']});});});});});}})[_0x73bc('0x15')](respondWithStatusCode(_0x44e38f,null))[_0x73bc('0x29')](handleError(_0x44e38f,null));};exports[_0x73bc('0x5f')]=function(_0x33caa8,_0x2e433d){return db['Team'][_0x73bc('0x27')]({'where':{'id':_0x33caa8[_0x73bc('0x26')][_0x73bc('0x53')]},'attributes':['id'],'include':[{'model':db[_0x73bc('0x45')],'as':_0x73bc('0x60'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2e433d,null))['then'](function(_0x2ec66){var _0x16ba66=_[_0x73bc('0x4b')](_0x2ec66,'id');var _0x1185a2=[];var _0x4dff94=[];var _0x42604b=squel[_0x73bc('0x61')]();_0x42604b['field'](_0x73bc('0x62'))[_0x73bc('0x63')](_0x73bc('0x64'),'tq')[_0x73bc('0x65')](_0x73bc('0x66'),'ut',_0x73bc('0x67'))[_0x73bc('0x24')](_0x73bc('0x68'),_0x33caa8[_0x73bc('0x2b')]['id']);for(var _0x133908=0x0;_0x133908<_0x2ec66[_0x73bc('0x32')];_0x133908+=0x1){let _0x36790f=_0x2ec66[_0x133908];for(var _0x4f7bd9=0x0;_0x4f7bd9<_0x36790f[_0x73bc('0x60')][_0x73bc('0x32')];_0x4f7bd9+=0x1){let _0x1f5a93=_0x36790f[_0x73bc('0x60')][_0x4f7bd9];var _0x490a9c=_0x42604b[_0x73bc('0x69')]();_0x490a9c[_0x73bc('0x24')](_0x73bc('0x6a'),_0x1f5a93['id']);_0x4dff94[_0x73bc('0x6b')](db[_0x73bc('0x6c')][_0x73bc('0x26')](_0x490a9c['toString'](),{'type':db[_0x73bc('0x6c')][_0x73bc('0x6d')][_0x73bc('0x6e')]})['then'](function(_0x35a94b){if(_0x35a94b['length']===0x1){return _0x1f5a93['id'];}else{var _0x3229a0=_[_0x73bc('0x6f')](_[_0x73bc('0x4b')](_0x35a94b,_0x73bc('0x70')),function(_0x423603){return _['includes'](_0x16ba66,_0x423603);});if(_0x3229a0){return _0x1f5a93['id'];}}}));}}return BPromise[_0x73bc('0x71')](_0x4dff94)[_0x73bc('0x15')](function(_0x31ce8b){_0x1185a2=_(_0x1185a2)[_0x73bc('0x72')](_0x31ce8b)['compact']()[_0x73bc('0x73')]();return db[_0x73bc('0x1f')][_0x73bc('0x35')]({'where':{'id':_0x33caa8[_0x73bc('0x2b')]['id']}})[_0x73bc('0x15')](function(_0x132ab3){return db[_0x73bc('0x6c')][_0x73bc('0x57')](function(_0x24d95b){return _0x132ab3['removeTeams'](_0x33caa8[_0x73bc('0x26')][_0x73bc('0x53')],{'transaction':_0x24d95b})['then'](function(){if(!_[_0x73bc('0x74')](_0x1185a2)){return _0x132ab3[_0x73bc('0x75')](_0x1185a2,{'transaction':_0x24d95b});}})['then'](function(){_0x1185a2[_0x73bc('0x5c')](function(_0x3ac12d){socket[_0x73bc('0x5d')]('userWhatsappQueue:remove',{'UserId':_0x3ac12d,'WhatsappQueueId':_0x132ab3['id']});});});});});});})[_0x73bc('0x15')](respondWithStatusCode(_0x2e433d,null))['catch'](handleError(_0x2e433d,null));};exports['addAgents']=function(_0x305736,_0xa413f4){return db[_0x73bc('0x1f')][_0x73bc('0x35')]({'where':{'id':_0x305736[_0x73bc('0x2b')]['id']}})['then'](handleEntityNotFound(_0xa413f4,null))[_0x73bc('0x15')](function(_0x470f95){if(_0x470f95){return _0x470f95[_0x73bc('0x76')](_0x305736[_0x73bc('0x3d')][_0x73bc('0x53')],_[_0x73bc('0x77')](_0x305736[_0x73bc('0x3d')],[_0x73bc('0x53'),'id'])||{})[_0x73bc('0x78')](function(_0x1bad62){for(var _0x438364=0x0;_0x438364<_0x305736['body'][_0x73bc('0x53')][_0x73bc('0x32')];_0x438364+=0x1){socket[_0x73bc('0x5d')]('userWhatsappQueue:save',{'UserId':Number(_0x305736['body'][_0x73bc('0x53')][_0x438364]),'WhatsappQueueId':Number(_0x305736[_0x73bc('0x2b')]['id'])});}return _0x1bad62;});}})[_0x73bc('0x15')](respondWithResult(_0xa413f4,null))[_0x73bc('0x29')](handleError(_0xa413f4,null));};exports[_0x73bc('0x75')]=function(_0x31ba78,_0x541790){return db[_0x73bc('0x1f')][_0x73bc('0x35')]({'where':{'id':_0x31ba78[_0x73bc('0x2b')]['id']}})[_0x73bc('0x15')](handleEntityNotFound(_0x541790,null))[_0x73bc('0x15')](function(_0x4b9df1){if(_0x4b9df1){return _0x4b9df1[_0x73bc('0x75')](_0x31ba78[_0x73bc('0x26')][_0x73bc('0x53')])[_0x73bc('0x15')](function(){if(_[_0x73bc('0x79')](_0x31ba78[_0x73bc('0x26')][_0x73bc('0x53')])){for(var _0x31a6c5=0x0;_0x31a6c5<_0x31ba78['query'][_0x73bc('0x53')]['length'];_0x31a6c5+=0x1){socket[_0x73bc('0x5d')](_0x73bc('0x7a'),{'UserId':Number(_0x31ba78[_0x73bc('0x26')]['ids'][_0x31a6c5]),'WhatsappQueueId':Number(_0x31ba78['params']['id'])});}}else{socket[_0x73bc('0x5d')]('userWhatsappQueue:remove',{'UserId':Number(_0x31ba78[_0x73bc('0x26')][_0x73bc('0x53')]),'WhatsappQueueId':Number(_0x31ba78[_0x73bc('0x2b')]['id'])});}});}})['then'](respondWithStatusCode(_0x541790,null))[_0x73bc('0x29')](handleError(_0x541790,null));};exports['getAgents']=function(_0x367f17,_0x3eda2b){var _0x2c1fc0={};var _0x48b49f={};var _0x1c723d;var _0x21b9fc;return db['WhatsappQueue'][_0x73bc('0x40')]({'where':{'id':_0x367f17[_0x73bc('0x2b')]['id']}})[_0x73bc('0x15')](handleEntityNotFound(_0x3eda2b,null))[_0x73bc('0x15')](function(_0x410a35){if(_0x410a35){_0x1c723d=_0x410a35;_0x48b49f[_0x73bc('0x2c')]=_[_0x73bc('0x2d')](db[_0x73bc('0x45')]['rawAttributes']);_0x48b49f['query']=_[_0x73bc('0x2d')](_0x367f17[_0x73bc('0x26')]);_0x48b49f[_0x73bc('0x2e')]=_[_0x73bc('0x30')](_0x48b49f[_0x73bc('0x2c')],_0x48b49f['query']);_0x2c1fc0[_0x73bc('0x2f')]=_['intersection'](_0x48b49f[_0x73bc('0x2c')],qs[_0x73bc('0x31')](_0x367f17[_0x73bc('0x26')][_0x73bc('0x31')]));_0x2c1fc0[_0x73bc('0x2f')]=_0x2c1fc0[_0x73bc('0x2f')]['length']?_0x2c1fc0[_0x73bc('0x2f')]:_0x48b49f[_0x73bc('0x2c')];_0x2c1fc0[_0x73bc('0x42')]=qs[_0x73bc('0x51')](_0x367f17[_0x73bc('0x26')]['sort']);_0x2c1fc0[_0x73bc('0x24')]=qs['filters'](_[_0x73bc('0x43')](_0x367f17[_0x73bc('0x26')],_0x48b49f[_0x73bc('0x2e')]));if(_0x367f17[_0x73bc('0x26')][_0x73bc('0x44')]){_0x2c1fc0[_0x73bc('0x24')]=_[_0x73bc('0x33')](_0x2c1fc0[_0x73bc('0x24')],{'$or':_[_0x73bc('0x4b')](_0x2c1fc0[_0x73bc('0x2f')],function(_0x52ebdd){var _0x359958={};_0x359958[_0x52ebdd]={'$like':'%'+_0x367f17['query'][_0x73bc('0x44')]+'%'};return _0x359958;})});}_0x2c1fc0=_[_0x73bc('0x33')]({},_0x2c1fc0,_0x367f17[_0x73bc('0x34')]);return _0x1c723d[_0x73bc('0x7b')](_0x2c1fc0);}})[_0x73bc('0x15')](function(_0xa05f78){if(_0xa05f78){_0x21b9fc=_0xa05f78[_0x73bc('0x32')];if(!_0x367f17[_0x73bc('0x26')][_0x73bc('0x52')]('nolimit')){_0x2c1fc0[_0x73bc('0x12')]=qs[_0x73bc('0x12')](_0x367f17[_0x73bc('0x26')][_0x73bc('0x12')]);_0x2c1fc0[_0x73bc('0x10')]=qs['offset'](_0x367f17[_0x73bc('0x26')][_0x73bc('0x10')]);}return _0x1c723d['getAgents'](_0x2c1fc0);}})['then'](function(_0x2771a2){if(_0x2771a2){return _0x2771a2?{'count':_0x21b9fc,'rows':_0x2771a2}:null;}})[_0x73bc('0x15')](respondWithResult(_0x3eda2b,null))['catch'](handleError(_0x3eda2b,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index d185a0a..7fa5a59 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 _0xc128=['hook','exports','WhatsappQueue','setMaxListeners','save','emit'];(function(_0x350182,_0x2a9feb){var _0x4a0892=function(_0x2c994d){while(--_0x2c994d){_0x350182['push'](_0x350182['shift']());}};_0x4a0892(++_0x2a9feb);}(_0xc128,0x1d6));var _0x8c12=function(_0x181384,_0x31b344){_0x181384=_0x181384-0x0;var _0x37b1e0=_0xc128[_0x181384];return _0x37b1e0;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require('../../mysqldb')['db'][_0x8c12('0x0')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x8c12('0x1')](0x0);var events={'afterCreate':_0x8c12('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x403b95){return function(_0x5c349b,_0x316ee8,_0x4ce50e){WhatsappQueueEvents['emit'](_0x403b95+':'+_0x5c349b['id'],_0x5c349b);WhatsappQueueEvents[_0x8c12('0x3')](_0x403b95,_0x5c349b);_0x4ce50e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x8c12('0x4')](e,emitEvent(event));}}module[_0x8c12('0x5')]=WhatsappQueueEvents; \ No newline at end of file +var _0x8b40=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','../../mysqldb','WhatsappQueue'];(function(_0x148316,_0x6c9dc){var _0xdbe95d=function(_0x138a9f){while(--_0x138a9f){_0x148316['push'](_0x148316['shift']());}};_0xdbe95d(++_0x6c9dc);}(_0x8b40,0x1db));var _0x08b4=function(_0x5f3378,_0x55b77a){_0x5f3378=_0x5f3378-0x0;var _0x2d8566=_0x8b40[_0x5f3378];return _0x2d8566;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x08b4('0x0'))['db'][_0x08b4('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x08b4('0x2')](0x0);var events={'afterCreate':_0x08b4('0x3'),'afterUpdate':_0x08b4('0x4'),'afterDestroy':_0x08b4('0x5')};function emitEvent(_0x159884){return function(_0xdfb6c9,_0x397ab8,_0x55b8f8){WhatsappQueueEvents['emit'](_0x159884+':'+_0xdfb6c9['id'],_0xdfb6c9);WhatsappQueueEvents[_0x08b4('0x6')](_0x159884,_0xdfb6c9);_0x55b8f8(null);};}for(var e in events){if(events[_0x08b4('0x7')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x08b4('0x8')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index f7b7e3c..39a6b50 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 _0xf981=['define','WhatsappQueue','whatsapp_queues','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x2c0dc0,_0x19900d){var _0x4c0990=function(_0x530791){while(--_0x530791){_0x2c0dc0['push'](_0x2c0dc0['shift']());}};_0x4c0990(++_0x19900d);}(_0xf981,0x177));var _0x1f98=function(_0x2f5bfa,_0x3f590b){_0x2f5bfa=_0x2f5bfa-0x0;var _0x25449c=_0xf981[_0x2f5bfa];return _0x25449c;};'use strict';var _=require(_0x1f98('0x0'));var util=require(_0x1f98('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1f98('0x2'));var BPromise=require(_0x1f98('0x3'));var rp=require(_0x1f98('0x4'));var fs=require('fs');var path=require(_0x1f98('0x5'));var rimraf=require(_0x1f98('0x6'));var config=require(_0x1f98('0x7'));var attributes=require('./whatsappQueue.attributes');module[_0x1f98('0x8')]=function(_0x5c52d9,_0x3c7441){return _0x5c52d9[_0x1f98('0x9')](_0x1f98('0xa'),attributes,{'tableName':_0x1f98('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfbce=['whatsapp_queues','util','api','bluebird','request-promise','path','rimraf'];(function(_0x32ebb2,_0x5760fd){var _0x3ec997=function(_0x1ef87e){while(--_0x1ef87e){_0x32ebb2['push'](_0x32ebb2['shift']());}};_0x3ec997(++_0x5760fd);}(_0xfbce,0x1ac));var _0xefbc=function(_0x31c0d2,_0x3f0c53){_0x31c0d2=_0x31c0d2-0x0;var _0xf003dd=_0xfbce[_0x31c0d2];return _0xf003dd;};'use strict';var _=require('lodash');var util=require(_0xefbc('0x0'));var logger=require('../../config/logger')(_0xefbc('0x1'));var moment=require('moment');var BPromise=require(_0xefbc('0x2'));var rp=require(_0xefbc('0x3'));var fs=require('fs');var path=require(_0xefbc('0x4'));var rimraf=require(_0xefbc('0x5'));var config=require('../../config/environment');var attributes=require('./whatsappQueue.attributes');module['exports']=function(_0x2aefbc,_0x350e31){return _0x2aefbc['define']('WhatsappQueue',attributes,{'tableName':_0xefbc('0x6'),'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 d1a8165..7360ebf 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 _0x8836=['defaults','localhost','socket.io-emitter','register','request','then','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappQueue,\x20%s,\x20%s','message','info','result','catch','WhatsappQueue','options','raw','where','map','include','model','attributes','GetWhatsappQueue','debug','ShowWhatsappQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8836,0x93));var _0x6883=function(_0x278e33,_0x5f3d85){_0x278e33=_0x278e33-0x0;var _0x35089e=_0x8836[_0x278e33];return _0x35089e;};'use strict';var _=require(_0x6883('0x0'));var util=require(_0x6883('0x1'));var moment=require(_0x6883('0x2'));var BPromise=require(_0x6883('0x3'));var rs=require(_0x6883('0x4'));var fs=require('fs');var Redis=require(_0x6883('0x5'));var db=require(_0x6883('0x6'))['db'];var utils=require(_0x6883('0x7'));var logger=require(_0x6883('0x8'))('rpc');var config=require(_0x6883('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6883('0xa')][_0x6883('0xb')]({'port':0x232a});config[_0x6883('0xc')]=_[_0x6883('0xd')](config['redis'],{'host':_0x6883('0xe'),'port':0x18eb});var socket=require(_0x6883('0xf'))(new Redis(config[_0x6883('0xc')]));require('./whatsappQueue.socket')[_0x6883('0x10')](socket);function respondWithRpcPromise(_0x3df4f0,_0x42e511,_0x18bc1){return new BPromise(function(_0x23c974,_0x1045f0){return client[_0x6883('0x11')](_0x3df4f0,_0x18bc1)[_0x6883('0x12')](function(_0x103069){logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x42e511,'request\x20sent');logger['debug'](_0x6883('0x13'),_0x42e511,_0x6883('0x14'),JSON[_0x6883('0x15')](_0x103069));if(_0x103069[_0x6883('0x16')]){if(_0x103069['error'][_0x6883('0x17')]===0x1f4){logger['error'](_0x6883('0x18'),_0x42e511,_0x103069[_0x6883('0x16')]['message']);return _0x1045f0(_0x103069['error'][_0x6883('0x19')]);}logger[_0x6883('0x16')](_0x6883('0x18'),_0x42e511,_0x103069[_0x6883('0x16')][_0x6883('0x19')]);return _0x23c974(_0x103069[_0x6883('0x16')][_0x6883('0x19')]);}else{logger[_0x6883('0x1a')](_0x6883('0x18'),_0x42e511,_0x6883('0x14'));_0x23c974(_0x103069[_0x6883('0x1b')][_0x6883('0x19')]);}})[_0x6883('0x1c')](function(_0x58b69c){logger[_0x6883('0x16')](_0x6883('0x18'),_0x42e511,_0x58b69c);_0x1045f0(_0x58b69c);});});}exports['GetWhatsappQueue']=function(_0x5d651d){var _0x2b2404=this;return new Promise(function(_0x260fa1,_0x102342){return db[_0x6883('0x1d')]['findAll']({'raw':_0x5d651d[_0x6883('0x1e')]?_0x5d651d[_0x6883('0x1e')][_0x6883('0x1f')]===undefined?!![]:![]:!![],'where':_0x5d651d[_0x6883('0x1e')]?_0x5d651d[_0x6883('0x1e')][_0x6883('0x20')]||null:null,'attributes':_0x5d651d[_0x6883('0x1e')]?_0x5d651d['options']['attributes']||null:null,'limit':_0x5d651d['options']?_0x5d651d[_0x6883('0x1e')]['limit']||null:null,'include':_0x5d651d[_0x6883('0x1e')]?_0x5d651d[_0x6883('0x1e')]['include']?_[_0x6883('0x21')](_0x5d651d[_0x6883('0x1e')][_0x6883('0x22')],function(_0x15714a){return{'model':db[_0x15714a[_0x6883('0x23')]],'as':_0x15714a['as'],'attributes':_0x15714a[_0x6883('0x24')],'include':_0x15714a[_0x6883('0x22')]?_[_0x6883('0x21')](_0x15714a[_0x6883('0x22')],function(_0x40c396){return{'model':db[_0x40c396[_0x6883('0x23')]],'as':_0x40c396['as'],'attributes':_0x40c396[_0x6883('0x24')],'include':_0x40c396[_0x6883('0x22')]?_[_0x6883('0x21')](_0x40c396[_0x6883('0x22')],function(_0x4dbef6){return{'model':db[_0x4dbef6[_0x6883('0x23')]],'as':_0x4dbef6['as'],'attributes':_0x4dbef6[_0x6883('0x24')]};}):[]};}):[]};}):[]:[]})[_0x6883('0x12')](function(_0x3ce50c){logger[_0x6883('0x1a')](_0x6883('0x25'),_0x5d651d);logger[_0x6883('0x26')](_0x6883('0x25'),_0x5d651d,JSON[_0x6883('0x15')](_0x3ce50c));_0x260fa1(_0x3ce50c);})[_0x6883('0x1c')](function(_0x435a04){logger[_0x6883('0x16')]('GetWhatsappQueue',_0x435a04['message'],_0x5d651d);_0x102342(_0x2b2404[_0x6883('0x16')](0x1f4,_0x435a04[_0x6883('0x19')]));});});};exports[_0x6883('0x27')]=function(_0x23a105){var _0x6f4bde=this;return new Promise(function(_0x3b3d19,_0x232aa7){return db['WhatsappQueue']['find']({'raw':_0x23a105[_0x6883('0x1e')]?_0x23a105[_0x6883('0x1e')][_0x6883('0x1f')]===undefined?!![]:![]:!![],'where':_0x23a105[_0x6883('0x1e')]?_0x23a105[_0x6883('0x1e')][_0x6883('0x20')]||null:null,'attributes':_0x23a105['options']?_0x23a105[_0x6883('0x1e')][_0x6883('0x24')]||null:null,'include':_0x23a105[_0x6883('0x1e')]?_0x23a105[_0x6883('0x1e')]['include']?_[_0x6883('0x21')](_0x23a105['options']['include'],function(_0x42f459){return{'model':db[_0x42f459['model']],'as':_0x42f459['as'],'attributes':_0x42f459[_0x6883('0x24')],'include':_0x42f459['include']?_[_0x6883('0x21')](_0x42f459['include'],function(_0x31e86a){return{'model':db[_0x31e86a[_0x6883('0x23')]],'as':_0x31e86a['as'],'attributes':_0x31e86a['attributes'],'include':_0x31e86a[_0x6883('0x22')]?_[_0x6883('0x21')](_0x31e86a[_0x6883('0x22')],function(_0xe3ba67){return{'model':db[_0xe3ba67[_0x6883('0x23')]],'as':_0xe3ba67['as'],'attributes':_0xe3ba67[_0x6883('0x24')]};}):[]};}):[]};}):[]:[]})[_0x6883('0x12')](function(_0x564bd5){logger[_0x6883('0x1a')](_0x6883('0x27'),_0x23a105);logger[_0x6883('0x26')](_0x6883('0x27'),_0x23a105,JSON[_0x6883('0x15')](_0x564bd5));_0x3b3d19(_0x564bd5);})[_0x6883('0x1c')](function(_0x2ec22d){logger[_0x6883('0x16')](_0x6883('0x27'),_0x2ec22d[_0x6883('0x19')],_0x23a105);_0x232aa7(_0x6f4bde[_0x6883('0x16')](0x1f4,_0x2ec22d['message']));});});}; \ No newline at end of file +var _0x6548=['debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','WhatsappQueue','options','where','attributes','limit','include','model','map','GetWhatsappQueue','catch','ShowWhatsappQueue','raw','util','moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x6548,0x1cf));var _0x8654=function(_0x4e0964,_0x4c179b){_0x4e0964=_0x4e0964-0x0;var _0x34eadf=_0x6548[_0x4e0964];return _0x34eadf;};'use strict';var _=require('lodash');var util=require(_0x8654('0x0'));var moment=require(_0x8654('0x1'));var BPromise=require('bluebird');var rs=require(_0x8654('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8654('0x3'))(_0x8654('0x4'));var config=require(_0x8654('0x5'));var jayson=require(_0x8654('0x6'));var client=jayson[_0x8654('0x7')][_0x8654('0x8')]({'port':0x232a});config[_0x8654('0x9')]=_[_0x8654('0xa')](config[_0x8654('0x9')],{'host':_0x8654('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappQueue.socket')[_0x8654('0xc')](socket);function respondWithRpcPromise(_0x27b98a,_0xff0ae1,_0xc356d2){return new BPromise(function(_0x50fef0,_0x1d22c8){return client[_0x8654('0xd')](_0x27b98a,_0xc356d2)[_0x8654('0xe')](function(_0x2dd9e8){logger[_0x8654('0xf')](_0x8654('0x10'),_0xff0ae1,_0x8654('0x11'));logger[_0x8654('0x12')](_0x8654('0x13'),_0xff0ae1,_0x8654('0x11'),JSON[_0x8654('0x14')](_0x2dd9e8));if(_0x2dd9e8['error']){if(_0x2dd9e8['error'][_0x8654('0x15')]===0x1f4){logger[_0x8654('0x16')](_0x8654('0x10'),_0xff0ae1,_0x2dd9e8['error'][_0x8654('0x17')]);return _0x1d22c8(_0x2dd9e8['error']['message']);}logger['error']('WhatsappQueue,\x20%s,\x20%s',_0xff0ae1,_0x2dd9e8[_0x8654('0x16')][_0x8654('0x17')]);return _0x50fef0(_0x2dd9e8['error'][_0x8654('0x17')]);}else{logger['info'](_0x8654('0x10'),_0xff0ae1,_0x8654('0x11'));_0x50fef0(_0x2dd9e8[_0x8654('0x18')][_0x8654('0x17')]);}})['catch'](function(_0xeef876){logger[_0x8654('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0xff0ae1,_0xeef876);_0x1d22c8(_0xeef876);});});}exports['GetWhatsappQueue']=function(_0x57fdd1){var _0x2ec4d7=this;return new Promise(function(_0x2bb1da,_0xd8a5f8){return db[_0x8654('0x19')]['findAll']({'raw':_0x57fdd1[_0x8654('0x1a')]?_0x57fdd1[_0x8654('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x57fdd1[_0x8654('0x1a')]?_0x57fdd1['options'][_0x8654('0x1b')]||null:null,'attributes':_0x57fdd1[_0x8654('0x1a')]?_0x57fdd1['options'][_0x8654('0x1c')]||null:null,'limit':_0x57fdd1[_0x8654('0x1a')]?_0x57fdd1[_0x8654('0x1a')][_0x8654('0x1d')]||null:null,'include':_0x57fdd1['options']?_0x57fdd1[_0x8654('0x1a')][_0x8654('0x1e')]?_['map'](_0x57fdd1[_0x8654('0x1a')]['include'],function(_0x5a5efb){return{'model':db[_0x5a5efb[_0x8654('0x1f')]],'as':_0x5a5efb['as'],'attributes':_0x5a5efb[_0x8654('0x1c')],'include':_0x5a5efb[_0x8654('0x1e')]?_[_0x8654('0x20')](_0x5a5efb[_0x8654('0x1e')],function(_0x44be76){return{'model':db[_0x44be76[_0x8654('0x1f')]],'as':_0x44be76['as'],'attributes':_0x44be76['attributes'],'include':_0x44be76[_0x8654('0x1e')]?_[_0x8654('0x20')](_0x44be76['include'],function(_0x101fd2){return{'model':db[_0x101fd2['model']],'as':_0x101fd2['as'],'attributes':_0x101fd2['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3da203){logger[_0x8654('0xf')](_0x8654('0x21'),_0x57fdd1);logger[_0x8654('0x12')](_0x8654('0x21'),_0x57fdd1,JSON[_0x8654('0x14')](_0x3da203));_0x2bb1da(_0x3da203);})[_0x8654('0x22')](function(_0x590727){logger['error'](_0x8654('0x21'),_0x590727[_0x8654('0x17')],_0x57fdd1);_0xd8a5f8(_0x2ec4d7[_0x8654('0x16')](0x1f4,_0x590727[_0x8654('0x17')]));});});};exports[_0x8654('0x23')]=function(_0x5e2549){var _0x5c8bc8=this;return new Promise(function(_0xa0a3fa,_0x482ec2){return db[_0x8654('0x19')]['find']({'raw':_0x5e2549[_0x8654('0x1a')]?_0x5e2549[_0x8654('0x1a')][_0x8654('0x24')]===undefined?!![]:![]:!![],'where':_0x5e2549[_0x8654('0x1a')]?_0x5e2549[_0x8654('0x1a')]['where']||null:null,'attributes':_0x5e2549['options']?_0x5e2549['options'][_0x8654('0x1c')]||null:null,'include':_0x5e2549[_0x8654('0x1a')]?_0x5e2549[_0x8654('0x1a')][_0x8654('0x1e')]?_[_0x8654('0x20')](_0x5e2549[_0x8654('0x1a')][_0x8654('0x1e')],function(_0x893f7){return{'model':db[_0x893f7[_0x8654('0x1f')]],'as':_0x893f7['as'],'attributes':_0x893f7[_0x8654('0x1c')],'include':_0x893f7[_0x8654('0x1e')]?_['map'](_0x893f7[_0x8654('0x1e')],function(_0x228440){return{'model':db[_0x228440[_0x8654('0x1f')]],'as':_0x228440['as'],'attributes':_0x228440[_0x8654('0x1c')],'include':_0x228440[_0x8654('0x1e')]?_[_0x8654('0x20')](_0x228440['include'],function(_0xc34b7a){return{'model':db[_0xc34b7a[_0x8654('0x1f')]],'as':_0xc34b7a['as'],'attributes':_0xc34b7a[_0x8654('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8654('0xe')](function(_0x14b248){logger[_0x8654('0xf')](_0x8654('0x23'),_0x5e2549);logger[_0x8654('0x12')]('ShowWhatsappQueue',_0x5e2549,JSON['stringify'](_0x14b248));_0xa0a3fa(_0x14b248);})['catch'](function(_0x12fdef){logger[_0x8654('0x16')](_0x8654('0x23'),_0x12fdef[_0x8654('0x17')],_0x5e2549);_0x482ec2(_0x5c8bc8[_0x8654('0x16')](0x1f4,_0x12fdef[_0x8654('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index facedac..0aa6505 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 _0x8acc=['length','whatsappQueue:','./whatsappQueue.events','remove','update','removeListener','register'];(function(_0x31c6ca,_0x5b37b3){var _0x1b5088=function(_0x3c840b){while(--_0x3c840b){_0x31c6ca['push'](_0x31c6ca['shift']());}};_0x1b5088(++_0x5b37b3);}(_0x8acc,0xa3));var _0xc8ac=function(_0x3c2567,_0x31b78e){_0x3c2567=_0x3c2567-0x0;var _0x4ba02e=_0x8acc[_0x3c2567];return _0x4ba02e;};'use strict';var WhatsappQueueEvents=require(_0xc8ac('0x0'));var events=['save',_0xc8ac('0x1'),_0xc8ac('0x2')];function createListener(_0x2a22a0,_0x322a7d){return function(_0x9ef3cb){_0x322a7d['emit'](_0x2a22a0,_0x9ef3cb);};}function removeListener(_0x281f6f,_0x2d5694){return function(){WhatsappQueueEvents[_0xc8ac('0x3')](_0x281f6f,_0x2d5694);};}exports[_0xc8ac('0x4')]=function(_0x271f78){for(var _0x20fba2=0x0,_0x5a1be2=events[_0xc8ac('0x5')];_0x20fba2<_0x5a1be2;_0x20fba2++){var _0x14d8b6=events[_0x20fba2];var _0x38db96=createListener(_0xc8ac('0x6')+_0x14d8b6,_0x271f78);WhatsappQueueEvents['on'](_0x14d8b6,_0x38db96);}}; \ No newline at end of file +var _0x6b29=['remove','register','whatsappQueue:'];(function(_0x26676e,_0x204553){var _0x221b46=function(_0x26f626){while(--_0x26f626){_0x26676e['push'](_0x26676e['shift']());}};_0x221b46(++_0x204553);}(_0x6b29,0xea));var _0x96b2=function(_0x20fdc1,_0xde1296){_0x20fdc1=_0x20fdc1-0x0;var _0x25397c=_0x6b29[_0x20fdc1];return _0x25397c;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=['save',_0x96b2('0x0'),'update'];function createListener(_0x2819a9,_0x32c1f7){return function(_0x3c97ca){_0x32c1f7['emit'](_0x2819a9,_0x3c97ca);};}function removeListener(_0x4630a5,_0x436c6a){return function(){WhatsappQueueEvents['removeListener'](_0x4630a5,_0x436c6a);};}exports[_0x96b2('0x1')]=function(_0x594b89){for(var _0x394574=0x0,_0x463276=events['length'];_0x394574<_0x463276;_0x394574++){var _0x25c859=events[_0x394574];var _0x210773=createListener(_0x96b2('0x2')+_0x25c859,_0x594b89);WhatsappQueueEvents['on'](_0x25c859,_0x210773);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 1a3c96b..585110e 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 _0xb0e3=['describe','/:id','show','post','isAuthenticated','create','put','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe'];(function(_0x38c43b,_0x5baacd){var _0x322dfb=function(_0x56b68e){while(--_0x56b68e){_0x38c43b['push'](_0x38c43b['shift']());}};_0x322dfb(++_0x5baacd);}(_0xb0e3,0x1c3));var _0x3b0e=function(_0x47df7d,_0x47c809){_0x47df7d=_0x47df7d-0x0;var _0x1ef4d2=_0xb0e3[_0x47df7d];return _0x1ef4d2;};'use strict';var multer=require(_0x3b0e('0x0'));var util=require('util');var path=require(_0x3b0e('0x1'));var timeout=require(_0x3b0e('0x2'));var express=require('express');var router=express[_0x3b0e('0x3')]();var fs_extra=require(_0x3b0e('0x4'));var auth=require(_0x3b0e('0x5'));var interaction=require(_0x3b0e('0x6'));var config=require(_0x3b0e('0x7'));var controller=require('./whatsappQueueReport.controller');router[_0x3b0e('0x8')]('/',auth['isAuthenticated'](),controller[_0x3b0e('0x9')]);router[_0x3b0e('0x8')](_0x3b0e('0xa'),auth['isAuthenticated'](),controller[_0x3b0e('0xb')]);router[_0x3b0e('0x8')](_0x3b0e('0xc'),auth['isAuthenticated'](),controller[_0x3b0e('0xd')]);router[_0x3b0e('0xe')]('/',auth[_0x3b0e('0xf')](),controller[_0x3b0e('0x10')]);router[_0x3b0e('0x11')](_0x3b0e('0xc'),auth[_0x3b0e('0xf')](),controller['update']);router[_0x3b0e('0x12')](_0x3b0e('0xc'),auth[_0x3b0e('0xf')](),controller[_0x3b0e('0x13')]);module[_0x3b0e('0x14')]=router; \ No newline at end of file +var _0x399f=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x6cf756,_0x3daec7){var _0x552797=function(_0x2bff8c){while(--_0x2bff8c){_0x6cf756['push'](_0x6cf756['shift']());}};_0x552797(++_0x3daec7);}(_0x399f,0x11d));var _0xf399=function(_0x392c62,_0x543c09){_0x392c62=_0x392c62-0x0;var _0x5ce269=_0x399f[_0x392c62];return _0x5ce269;};'use strict';var multer=require(_0xf399('0x0'));var util=require(_0xf399('0x1'));var path=require(_0xf399('0x2'));var timeout=require('connect-timeout');var express=require(_0xf399('0x3'));var router=express[_0xf399('0x4')]();var fs_extra=require(_0xf399('0x5'));var auth=require(_0xf399('0x6'));var interaction=require(_0xf399('0x7'));var config=require(_0xf399('0x8'));var controller=require('./whatsappQueueReport.controller');router[_0xf399('0x9')]('/',auth['isAuthenticated'](),controller[_0xf399('0xa')]);router[_0xf399('0x9')](_0xf399('0xb'),auth[_0xf399('0xc')](),controller['describe']);router['get'](_0xf399('0xd'),auth[_0xf399('0xc')](),controller[_0xf399('0xe')]);router[_0xf399('0xf')]('/',auth[_0xf399('0xc')](),controller[_0xf399('0x10')]);router[_0xf399('0x11')](_0xf399('0xd'),auth['isAuthenticated'](),controller[_0xf399('0x12')]);router[_0xf399('0x13')](_0xf399('0xd'),auth[_0xf399('0xc')](),controller[_0xf399('0x14')]);module[_0xf399('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 75d8e2c..233d95d 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0xda13c3,_0x27e6ac){var _0x5bcda8=function(_0x19c14b){while(--_0x19c14b){_0xda13c3['push'](_0xda13c3['shift']());}};_0x5bcda8(++_0x27e6ac);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x3c78f0,_0x37d445){var _0xb6e55e=function(_0x2253e7){while(--_0x2253e7){_0x3c78f0['push'](_0x3c78f0['shift']());}};_0xb6e55e(++_0x37d445);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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 9e7572b..75bd4ff 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 _0x0713=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','params','keys','find','catch','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox'];(function(_0x54e3be,_0x59c6d2){var _0xb2dbbc=function(_0x1451a5){while(--_0x1451a5){_0x54e3be['push'](_0x54e3be['shift']());}};_0xb2dbbc(++_0x59c6d2);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3071('0x0'));var jsonpatch=require(_0x3071('0x1'));var rp=require(_0x3071('0x2'));var moment=require(_0x3071('0x3'));var BPromise=require(_0x3071('0x4'));var Mustache=require('mustache');var util=require(_0x3071('0x5'));var path=require(_0x3071('0x6'));var sox=require(_0x3071('0x7'));var csv=require(_0x3071('0x8'));var ejs=require(_0x3071('0x9'));var fs=require('fs');var fs_extra=require(_0x3071('0xa'));var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x8'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var licenseUtil=require(_0x3071('0x19'));var db=require(_0x3071('0x1a'))['db'];function respondWithStatusCode(_0x4a8cc7,_0x5330a8){_0x5330a8=_0x5330a8||0xcc;return function(_0x1826ca){if(_0x1826ca){return _0x4a8cc7['sendStatus'](_0x5330a8);}return _0x4a8cc7[_0x3071('0x1b')](_0x5330a8)[_0x3071('0x1c')]();};}function respondWithResult(_0x5d4883,_0x104e73){_0x104e73=_0x104e73||0xc8;return function(_0x4e1219){if(_0x4e1219){return _0x5d4883[_0x3071('0x1b')](_0x104e73)[_0x3071('0x1d')](_0x4e1219);}};}function respondWithFilteredResult(_0x1271d0,_0x1f14e1){return function(_0x1caa5d){if(_0x1caa5d){var _0x2a6a4b=typeof _0x1f14e1[_0x3071('0x1e')]===_0x3071('0x1f')&&typeof _0x1f14e1[_0x3071('0x20')]===_0x3071('0x1f');var _0x5f3c22=_0x1caa5d[_0x3071('0x21')];var _0x17dbda=_0x2a6a4b?0x0:_0x1f14e1[_0x3071('0x1e')];var _0x108a83=_0x2a6a4b?_0x1caa5d[_0x3071('0x21')]:_0x1f14e1[_0x3071('0x1e')]+_0x1f14e1[_0x3071('0x20')];var _0x26f113;if(_0x108a83>=_0x5f3c22){_0x108a83=_0x5f3c22;_0x26f113=0xc8;}else{_0x26f113=0xce;}_0x1271d0['status'](_0x26f113);return _0x1271d0[_0x3071('0x22')](_0x3071('0x23'),_0x17dbda+'-'+_0x108a83+'/'+_0x5f3c22)[_0x3071('0x1d')](_0x1caa5d);}return null;};}function patchUpdates(_0x56c267){return function(_0xb8f4e3){try{jsonpatch['apply'](_0xb8f4e3,_0x56c267,!![]);}catch(_0x833074){return BPromise[_0x3071('0x24')](_0x833074);}return _0xb8f4e3[_0x3071('0x25')]();};}function saveUpdates(_0x457b57,_0x33090c){return function(_0x34c50e){if(_0x34c50e){return _0x34c50e[_0x3071('0x26')](_0x457b57)[_0x3071('0x27')](function(_0x542646){return _0x542646;});}return null;};}function removeEntity(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(_0xb05b1d){return _0xb05b1d[_0x3071('0x28')]()[_0x3071('0x27')](function(){_0x481a51[_0x3071('0x1b')](0xcc)[_0x3071('0x1c')]();});}};}function handleEntityNotFound(_0x7a4cb4,_0x1fe727){return function(_0x1de5fb){if(!_0x1de5fb){_0x7a4cb4['sendStatus'](0x194);}return _0x1de5fb;};}function handleError(_0x2e5f93,_0x3f1e6e){_0x3f1e6e=_0x3f1e6e||0x1f4;return function(_0x177138){logger['error'](_0x177138[_0x3071('0x29')]);if(_0x177138[_0x3071('0x2a')]){delete _0x177138[_0x3071('0x2a')];}_0x2e5f93[_0x3071('0x1b')](_0x3f1e6e)[_0x3071('0x2b')](_0x177138);};}exports[_0x3071('0x2c')]=function(_0x177b5f,_0x3921a1){var _0x32f1b4={},_0x292205={},_0x254fc8={'count':0x0,'rows':[]};var _0x5aba96=_['map'](db[_0x3071('0x2d')][_0x3071('0x2e')],function(_0x6ddf96){return{'name':_0x6ddf96[_0x3071('0x2f')],'type':_0x6ddf96[_0x3071('0x30')][_0x3071('0x31')]};});_0x292205[_0x3071('0x32')]=_[_0x3071('0x33')](_0x5aba96,'name');_0x292205['query']=_['keys'](_0x177b5f[_0x3071('0x34')]);_0x292205[_0x3071('0x35')]=_['intersection'](_0x292205[_0x3071('0x32')],_0x292205[_0x3071('0x34')]);_0x32f1b4[_0x3071('0x36')]=_[_0x3071('0x37')](_0x292205['model'],qs[_0x3071('0x38')](_0x177b5f[_0x3071('0x34')][_0x3071('0x38')]));_0x32f1b4[_0x3071('0x36')]=_0x32f1b4[_0x3071('0x36')][_0x3071('0x39')]?_0x32f1b4[_0x3071('0x36')]:_0x292205[_0x3071('0x32')];if(!_0x177b5f['query'][_0x3071('0x3a')]('nolimit')){_0x32f1b4['limit']=qs[_0x3071('0x20')](_0x177b5f[_0x3071('0x34')]['limit']);_0x32f1b4[_0x3071('0x1e')]=qs[_0x3071('0x1e')](_0x177b5f[_0x3071('0x34')][_0x3071('0x1e')]);}_0x32f1b4[_0x3071('0x3b')]=qs[_0x3071('0x3c')](_0x177b5f['query'][_0x3071('0x3c')]);_0x32f1b4[_0x3071('0x3d')]=qs['filters'](_[_0x3071('0x3e')](_0x177b5f['query'],_0x292205[_0x3071('0x35')]),_0x5aba96);if(_0x177b5f[_0x3071('0x34')]['filter']){_0x32f1b4['where']=_[_0x3071('0x3f')](_0x32f1b4[_0x3071('0x3d')],{'$or':_[_0x3071('0x33')](_0x5aba96,function(_0x55afa6){if(_0x55afa6[_0x3071('0x30')]!=='VIRTUAL'){var _0x1ac90a={};_0x1ac90a[_0x55afa6['name']]={'$like':'%'+_0x177b5f[_0x3071('0x34')][_0x3071('0x40')]+'%'};return _0x1ac90a;}})});}_0x32f1b4=_[_0x3071('0x3f')]({},_0x32f1b4,_0x177b5f[_0x3071('0x41')]);var _0x30ab68={'where':_0x32f1b4['where']};return db['WhatsappQueueReport'][_0x3071('0x21')](_0x30ab68)[_0x3071('0x27')](function(_0x1455be){_0x254fc8[_0x3071('0x21')]=_0x1455be;if(_0x177b5f['query'][_0x3071('0x42')]){_0x32f1b4[_0x3071('0x43')]=[{'all':!![]}];}return db[_0x3071('0x2d')][_0x3071('0x44')](_0x32f1b4);})[_0x3071('0x27')](function(_0xb9a4b8){_0x254fc8['rows']=_0xb9a4b8;return _0x254fc8;})[_0x3071('0x27')](respondWithFilteredResult(_0x3921a1,_0x32f1b4))['catch'](handleError(_0x3921a1,null));};exports['show']=function(_0x4dc9d1,_0x47ceaf){var _0x2992e6={'raw':!![],'where':{'id':_0x4dc9d1[_0x3071('0x45')]['id']}},_0x1be8b6={};_0x1be8b6[_0x3071('0x32')]=_[_0x3071('0x46')](db[_0x3071('0x2d')][_0x3071('0x2e')]);_0x1be8b6[_0x3071('0x34')]=_['keys'](_0x4dc9d1[_0x3071('0x34')]);_0x1be8b6[_0x3071('0x35')]=_[_0x3071('0x37')](_0x1be8b6[_0x3071('0x32')],_0x1be8b6[_0x3071('0x34')]);_0x2992e6['attributes']=_['intersection'](_0x1be8b6[_0x3071('0x32')],qs[_0x3071('0x38')](_0x4dc9d1[_0x3071('0x34')][_0x3071('0x38')]));_0x2992e6[_0x3071('0x36')]=_0x2992e6['attributes'][_0x3071('0x39')]?_0x2992e6['attributes']:_0x1be8b6[_0x3071('0x32')];if(_0x4dc9d1['query']['includeAll']){_0x2992e6[_0x3071('0x43')]=[{'all':!![]}];}_0x2992e6=_['merge']({},_0x2992e6,_0x4dc9d1[_0x3071('0x41')]);return db['WhatsappQueueReport'][_0x3071('0x47')](_0x2992e6)[_0x3071('0x27')](handleEntityNotFound(_0x47ceaf,null))[_0x3071('0x27')](respondWithResult(_0x47ceaf,null))[_0x3071('0x48')](handleError(_0x47ceaf,null));};exports['create']=function(_0x2d70bf,_0x575c12){return db[_0x3071('0x2d')]['create'](_0x2d70bf[_0x3071('0x49')],{})[_0x3071('0x27')](respondWithResult(_0x575c12,0xc9))['catch'](handleError(_0x575c12,null));};exports[_0x3071('0x26')]=function(_0x117e73,_0x224a70){if(_0x117e73[_0x3071('0x49')]['id']){delete _0x117e73[_0x3071('0x49')]['id'];}return db[_0x3071('0x2d')][_0x3071('0x47')]({'where':{'id':_0x117e73['params']['id']}})[_0x3071('0x27')](handleEntityNotFound(_0x224a70,null))[_0x3071('0x27')](saveUpdates(_0x117e73[_0x3071('0x49')],null))[_0x3071('0x27')](respondWithResult(_0x224a70,null))['catch'](handleError(_0x224a70,null));};exports[_0x3071('0x28')]=function(_0x2aea37,_0x1b832e){return db[_0x3071('0x2d')][_0x3071('0x47')]({'where':{'id':_0x2aea37[_0x3071('0x45')]['id']}})[_0x3071('0x27')](handleEntityNotFound(_0x1b832e,null))[_0x3071('0x27')](removeEntity(_0x1b832e,null))[_0x3071('0x48')](handleError(_0x1b832e,null));};exports[_0x3071('0x4a')]=function(_0x4371e7,_0x111115){return db[_0x3071('0x2d')][_0x3071('0x4a')]()[_0x3071('0x27')](respondWithResult(_0x111115,null))[_0x3071('0x48')](handleError(_0x111115,null));}; \ No newline at end of file +var _0xda3f=['fields','nolimit','sort','filter','where','merge','type','VIRTUAL','options','WhatsappQueueReport','includeAll','include','findAll','rows','catch','params','rawAttributes','length','find','create','body','destroy','describe','rimraf','zip-dir','bluebird','util','path','to-csv','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','end','stack','name','send','map','key','model','query','keys','filters','intersection','attributes'];(function(_0x379a73,_0x5d0978){var _0x19d384=function(_0x586297){while(--_0x586297){_0x379a73['push'](_0x379a73['shift']());}};_0x19d384(++_0x5d0978);}(_0xda3f,0xec));var _0xfda3=function(_0x5a3b0b,_0x3acf39){_0x5a3b0b=_0x5a3b0b-0x0;var _0x149c2a=_0xda3f[_0x5a3b0b];return _0x149c2a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfda3('0x0'));var zipdir=require(_0xfda3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfda3('0x2'));var Mustache=require('mustache');var util=require(_0xfda3('0x3'));var path=require(_0xfda3('0x4'));var sox=require('sox');var csv=require(_0xfda3('0x5'));var ejs=require(_0xfda3('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfda3('0x7'));var crypto=require(_0xfda3('0x8'));var jsforce=require(_0xfda3('0x9'));var deskjs=require(_0xfda3('0xa'));var toCsv=require(_0xfda3('0x5'));var querystring=require(_0xfda3('0xb'));var Papa=require(_0xfda3('0xc'));var Redis=require(_0xfda3('0xd'));var authService=require(_0xfda3('0xe'));var qs=require(_0xfda3('0xf'));var as=require(_0xfda3('0x10'));var hardwareService=require(_0xfda3('0x11'));var logger=require('../../config/logger')(_0xfda3('0x12'));var utils=require(_0xfda3('0x13'));var config=require(_0xfda3('0x14'));var licenseUtil=require(_0xfda3('0x15'));var db=require(_0xfda3('0x16'))['db'];function respondWithStatusCode(_0x4b77ea,_0x583125){_0x583125=_0x583125||0xcc;return function(_0x5d7d5b){if(_0x5d7d5b){return _0x4b77ea[_0xfda3('0x17')](_0x583125);}return _0x4b77ea[_0xfda3('0x18')](_0x583125)['end']();};}function respondWithResult(_0x501588,_0x587e9b){_0x587e9b=_0x587e9b||0xc8;return function(_0x227d72){if(_0x227d72){return _0x501588[_0xfda3('0x18')](_0x587e9b)['json'](_0x227d72);}};}function respondWithFilteredResult(_0x57a229,_0x533365){return function(_0x80ea80){if(_0x80ea80){var _0x474707=typeof _0x533365[_0xfda3('0x19')]===_0xfda3('0x1a')&&typeof _0x533365[_0xfda3('0x1b')]===_0xfda3('0x1a');var _0x2aadcb=_0x80ea80[_0xfda3('0x1c')];var _0x4680bf=_0x474707?0x0:_0x533365[_0xfda3('0x19')];var _0x54a7c6=_0x474707?_0x80ea80[_0xfda3('0x1c')]:_0x533365[_0xfda3('0x19')]+_0x533365[_0xfda3('0x1b')];var _0x32855a;if(_0x54a7c6>=_0x2aadcb){_0x54a7c6=_0x2aadcb;_0x32855a=0xc8;}else{_0x32855a=0xce;}_0x57a229['status'](_0x32855a);return _0x57a229[_0xfda3('0x1d')](_0xfda3('0x1e'),_0x4680bf+'-'+_0x54a7c6+'/'+_0x2aadcb)[_0xfda3('0x1f')](_0x80ea80);}return null;};}function patchUpdates(_0x51e731){return function(_0x5ad52a){try{jsonpatch[_0xfda3('0x20')](_0x5ad52a,_0x51e731,!![]);}catch(_0x38d428){return BPromise[_0xfda3('0x21')](_0x38d428);}return _0x5ad52a['save']();};}function saveUpdates(_0x3cf5a9,_0xef2535){return function(_0x1e15a8){if(_0x1e15a8){return _0x1e15a8[_0xfda3('0x22')](_0x3cf5a9)[_0xfda3('0x23')](function(_0x2b84b7){return _0x2b84b7;});}return null;};}function removeEntity(_0x2677f6,_0xc6fb9a){return function(_0x16eaa6){if(_0x16eaa6){return _0x16eaa6['destroy']()[_0xfda3('0x23')](function(){_0x2677f6[_0xfda3('0x18')](0xcc)[_0xfda3('0x24')]();});}};}function handleEntityNotFound(_0x4ae9b9,_0x45a977){return function(_0x39e246){if(!_0x39e246){_0x4ae9b9[_0xfda3('0x17')](0x194);}return _0x39e246;};}function handleError(_0x38946d,_0x1cb831){_0x1cb831=_0x1cb831||0x1f4;return function(_0xad9f7b){logger['error'](_0xad9f7b[_0xfda3('0x25')]);if(_0xad9f7b[_0xfda3('0x26')]){delete _0xad9f7b[_0xfda3('0x26')];}_0x38946d[_0xfda3('0x18')](_0x1cb831)[_0xfda3('0x27')](_0xad9f7b);};}exports['index']=function(_0x3c1549,_0x4101b1){var _0x301509={},_0x474992={},_0xe21ec6={'count':0x0,'rows':[]};var _0x3cfeb2=_[_0xfda3('0x28')](db['WhatsappQueueReport']['rawAttributes'],function(_0x3aef3c){return{'name':_0x3aef3c['fieldName'],'type':_0x3aef3c['type'][_0xfda3('0x29')]};});_0x474992[_0xfda3('0x2a')]=_[_0xfda3('0x28')](_0x3cfeb2,_0xfda3('0x26'));_0x474992[_0xfda3('0x2b')]=_[_0xfda3('0x2c')](_0x3c1549[_0xfda3('0x2b')]);_0x474992[_0xfda3('0x2d')]=_[_0xfda3('0x2e')](_0x474992['model'],_0x474992[_0xfda3('0x2b')]);_0x301509[_0xfda3('0x2f')]=_[_0xfda3('0x2e')](_0x474992[_0xfda3('0x2a')],qs[_0xfda3('0x30')](_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x30')]));_0x301509[_0xfda3('0x2f')]=_0x301509[_0xfda3('0x2f')]['length']?_0x301509['attributes']:_0x474992[_0xfda3('0x2a')];if(!_0x3c1549[_0xfda3('0x2b')]['hasOwnProperty'](_0xfda3('0x31'))){_0x301509[_0xfda3('0x1b')]=qs[_0xfda3('0x1b')](_0x3c1549['query'][_0xfda3('0x1b')]);_0x301509[_0xfda3('0x19')]=qs[_0xfda3('0x19')](_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x19')]);}_0x301509['order']=qs[_0xfda3('0x32')](_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x32')]);_0x301509['where']=qs[_0xfda3('0x2d')](_['pick'](_0x3c1549[_0xfda3('0x2b')],_0x474992[_0xfda3('0x2d')]),_0x3cfeb2);if(_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x33')]){_0x301509[_0xfda3('0x34')]=_[_0xfda3('0x35')](_0x301509[_0xfda3('0x34')],{'$or':_[_0xfda3('0x28')](_0x3cfeb2,function(_0x577be8){if(_0x577be8[_0xfda3('0x36')]!==_0xfda3('0x37')){var _0xd2dde0={};_0xd2dde0[_0x577be8[_0xfda3('0x26')]]={'$like':'%'+_0x3c1549['query'][_0xfda3('0x33')]+'%'};return _0xd2dde0;}})});}_0x301509=_[_0xfda3('0x35')]({},_0x301509,_0x3c1549[_0xfda3('0x38')]);var _0x5bad90={'where':_0x301509['where']};return db[_0xfda3('0x39')][_0xfda3('0x1c')](_0x5bad90)[_0xfda3('0x23')](function(_0x1aaa6c){_0xe21ec6[_0xfda3('0x1c')]=_0x1aaa6c;if(_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x3a')]){_0x301509[_0xfda3('0x3b')]=[{'all':!![]}];}return db[_0xfda3('0x39')][_0xfda3('0x3c')](_0x301509);})['then'](function(_0x27200f){_0xe21ec6[_0xfda3('0x3d')]=_0x27200f;return _0xe21ec6;})['then'](respondWithFilteredResult(_0x4101b1,_0x301509))[_0xfda3('0x3e')](handleError(_0x4101b1,null));};exports['show']=function(_0x51a314,_0x4e6886){var _0x2208bc={'raw':!![],'where':{'id':_0x51a314[_0xfda3('0x3f')]['id']}},_0x107fb1={};_0x107fb1[_0xfda3('0x2a')]=_['keys'](db[_0xfda3('0x39')][_0xfda3('0x40')]);_0x107fb1[_0xfda3('0x2b')]=_[_0xfda3('0x2c')](_0x51a314['query']);_0x107fb1[_0xfda3('0x2d')]=_[_0xfda3('0x2e')](_0x107fb1[_0xfda3('0x2a')],_0x107fb1['query']);_0x2208bc['attributes']=_[_0xfda3('0x2e')](_0x107fb1[_0xfda3('0x2a')],qs[_0xfda3('0x30')](_0x51a314[_0xfda3('0x2b')][_0xfda3('0x30')]));_0x2208bc[_0xfda3('0x2f')]=_0x2208bc[_0xfda3('0x2f')][_0xfda3('0x41')]?_0x2208bc[_0xfda3('0x2f')]:_0x107fb1[_0xfda3('0x2a')];if(_0x51a314[_0xfda3('0x2b')][_0xfda3('0x3a')]){_0x2208bc[_0xfda3('0x3b')]=[{'all':!![]}];}_0x2208bc=_[_0xfda3('0x35')]({},_0x2208bc,_0x51a314['options']);return db['WhatsappQueueReport'][_0xfda3('0x42')](_0x2208bc)[_0xfda3('0x23')](handleEntityNotFound(_0x4e6886,null))[_0xfda3('0x23')](respondWithResult(_0x4e6886,null))[_0xfda3('0x3e')](handleError(_0x4e6886,null));};exports[_0xfda3('0x43')]=function(_0x60a89d,_0x192133){return db[_0xfda3('0x39')][_0xfda3('0x43')](_0x60a89d[_0xfda3('0x44')],{})['then'](respondWithResult(_0x192133,0xc9))[_0xfda3('0x3e')](handleError(_0x192133,null));};exports[_0xfda3('0x22')]=function(_0x481356,_0x36aa3a){if(_0x481356[_0xfda3('0x44')]['id']){delete _0x481356['body']['id'];}return db[_0xfda3('0x39')][_0xfda3('0x42')]({'where':{'id':_0x481356[_0xfda3('0x3f')]['id']}})['then'](handleEntityNotFound(_0x36aa3a,null))[_0xfda3('0x23')](saveUpdates(_0x481356[_0xfda3('0x44')],null))[_0xfda3('0x23')](respondWithResult(_0x36aa3a,null))['catch'](handleError(_0x36aa3a,null));};exports[_0xfda3('0x45')]=function(_0x33565d,_0x2f54eb){return db[_0xfda3('0x39')][_0xfda3('0x42')]({'where':{'id':_0x33565d['params']['id']}})[_0xfda3('0x23')](handleEntityNotFound(_0x2f54eb,null))['then'](removeEntity(_0x2f54eb,null))[_0xfda3('0x3e')](handleError(_0x2f54eb,null));};exports['describe']=function(_0x1b5e89,_0x6447){return db[_0xfda3('0x39')][_0xfda3('0x46')]()['then'](respondWithResult(_0x6447,null))[_0xfda3('0x3e')](handleError(_0x6447,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index c789946..ba4e976 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 _0xce7c=['api','moment','bluebird','request-promise','rimraf','./whatsappQueueReport.attributes','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xce7c,0xcd));var _0xcce7=function(_0x413f2a,_0x1006e4){_0x413f2a=_0x413f2a-0x0;var _0x1932ec=_0xce7c[_0x413f2a];return _0x1932ec;};'use strict';var _=require(_0xcce7('0x0'));var util=require(_0xcce7('0x1'));var logger=require(_0xcce7('0x2'))(_0xcce7('0x3'));var moment=require(_0xcce7('0x4'));var BPromise=require(_0xcce7('0x5'));var rp=require(_0xcce7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcce7('0x7'));var config=require('../../config/environment');var attributes=require(_0xcce7('0x8'));module['exports']=function(_0x1966a1,_0xdc7a1a){return _0x1966a1[_0xcce7('0x9')](_0xcce7('0xa'),attributes,{'tableName':_0xcce7('0xb'),'paranoid':![],'indexes':[{'name':_0xcce7('0xc'),'fields':[_0xcce7('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x773a=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','report_whatsapp_queue','uniqueid','lodash','util'];(function(_0x1a8324,_0x54cd51){var _0x41aa57=function(_0x458306){while(--_0x458306){_0x1a8324['push'](_0x1a8324['shift']());}};_0x41aa57(++_0x54cd51);}(_0x773a,0x1cc));var _0xa773=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x773a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa773('0x0'));var util=require(_0xa773('0x1'));var logger=require(_0xa773('0x2'))('api');var moment=require(_0xa773('0x3'));var BPromise=require(_0xa773('0x4'));var rp=require(_0xa773('0x5'));var fs=require('fs');var path=require(_0xa773('0x6'));var rimraf=require(_0xa773('0x7'));var config=require(_0xa773('0x8'));var attributes=require(_0xa773('0x9'));module[_0xa773('0xa')]=function(_0x58628c,_0x4a1e07){return _0x58628c[_0xa773('0xb')]('WhatsappQueueReport',attributes,{'tableName':_0xa773('0xc'),'paranoid':![],'indexes':[{'name':_0xa773('0xd'),'fields':[_0xa773('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index a771c82..35ce237 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 _0x3f39=['http','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','debug','UpdateWhatsappQueueReport','update','where','attributes','limit','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5c6aa1,_0x5792a2){var _0x23b899=function(_0x336149){while(--_0x336149){_0x5c6aa1['push'](_0x5c6aa1['shift']());}};_0x23b899(++_0x5792a2);}(_0x3f39,0x106));var _0x93f3=function(_0x3df626,_0x6d324){_0x3df626=_0x3df626-0x0;var _0x57b238=_0x3f39[_0x3df626];return _0x57b238;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x93f3('0x0'));var BPromise=require(_0x93f3('0x1'));var rs=require(_0x93f3('0x2'));var fs=require('fs');var Redis=require(_0x93f3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x93f3('0x4'));var logger=require(_0x93f3('0x5'))(_0x93f3('0x6'));var config=require(_0x93f3('0x7'));var jayson=require(_0x93f3('0x8'));var client=jayson[_0x93f3('0x9')][_0x93f3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5bff34,_0x3917fe,_0x50f0fb){return new BPromise(function(_0x36fb2a,_0x4aae8d){return client['request'](_0x5bff34,_0x50f0fb)[_0x93f3('0xb')](function(_0x282a98){logger[_0x93f3('0xc')](_0x93f3('0xd'),_0x3917fe,_0x93f3('0xe'));logger['debug'](_0x93f3('0xf'),_0x3917fe,_0x93f3('0xe'),JSON[_0x93f3('0x10')](_0x282a98));if(_0x282a98[_0x93f3('0x11')]){if(_0x282a98[_0x93f3('0x11')][_0x93f3('0x12')]===0x1f4){logger[_0x93f3('0x11')](_0x93f3('0xd'),_0x3917fe,_0x282a98[_0x93f3('0x11')][_0x93f3('0x13')]);return _0x4aae8d(_0x282a98[_0x93f3('0x11')][_0x93f3('0x13')]);}logger[_0x93f3('0x11')](_0x93f3('0xd'),_0x3917fe,_0x282a98[_0x93f3('0x11')][_0x93f3('0x13')]);return _0x36fb2a(_0x282a98[_0x93f3('0x11')]['message']);}else{logger[_0x93f3('0xc')](_0x93f3('0xd'),_0x3917fe,_0x93f3('0xe'));_0x36fb2a(_0x282a98[_0x93f3('0x14')][_0x93f3('0x13')]);}})[_0x93f3('0x15')](function(_0x92fff4){logger[_0x93f3('0x11')](_0x93f3('0xd'),_0x3917fe,_0x92fff4);_0x4aae8d(_0x92fff4);});});}exports[_0x93f3('0x16')]=function(_0x1b0fdd){var _0x1f758b=this;return new Promise(function(_0xb0b31a,_0xa6638){return db[_0x93f3('0x17')][_0x93f3('0x18')](_0x1b0fdd[_0x93f3('0x19')],{'raw':_0x1b0fdd[_0x93f3('0x1a')]?_0x1b0fdd['options'][_0x93f3('0x1b')]===undefined?!![]:![]:!![]})[_0x93f3('0xb')](function(_0xd0498b){logger[_0x93f3('0xc')]('CreateWhatsappQueueReport',_0x1b0fdd);logger[_0x93f3('0x1c')](_0x93f3('0x16'),_0x1b0fdd,JSON['stringify'](_0xd0498b));_0xb0b31a(_0xd0498b);})[_0x93f3('0x15')](function(_0x5dc398){logger['error'](_0x93f3('0x16'),_0x5dc398[_0x93f3('0x13')],_0x1b0fdd);_0xa6638(_0x1f758b[_0x93f3('0x11')](0x1f4,_0x5dc398[_0x93f3('0x13')]));});});};exports[_0x93f3('0x1d')]=function(_0x3c616b){var _0x146a84=this;return new Promise(function(_0x95bb79,_0x5020cc){return db[_0x93f3('0x17')][_0x93f3('0x1e')](_0x3c616b[_0x93f3('0x19')],{'raw':_0x3c616b[_0x93f3('0x1a')]?_0x3c616b[_0x93f3('0x1a')][_0x93f3('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c616b[_0x93f3('0x1a')]?_0x3c616b['options'][_0x93f3('0x1f')]||null:null,'attributes':_0x3c616b['options']?_0x3c616b[_0x93f3('0x1a')][_0x93f3('0x20')]||null:null,'limit':_0x3c616b[_0x93f3('0x1a')]?_0x3c616b['options'][_0x93f3('0x21')]||null:null})[_0x93f3('0xb')](function(_0x56eb64){logger[_0x93f3('0xc')](_0x93f3('0x1d'),_0x3c616b);logger[_0x93f3('0x1c')](_0x93f3('0x1d'),_0x3c616b,JSON[_0x93f3('0x10')](_0x56eb64));_0x95bb79(_0x56eb64);})['catch'](function(_0x42106f){logger[_0x93f3('0x11')](_0x93f3('0x1d'),_0x42106f[_0x93f3('0x13')],_0x3c616b);_0x5020cc(_0x146a84['error'](0x1f4,_0x42106f['message']));});});}; \ No newline at end of file +var _0xa6fb=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','message','WhatsappQueueReport,\x20%s,\x20%s','result','WhatsappQueueReport','create','options','raw','CreateWhatsappQueueReport','catch','UpdateWhatsappQueueReport','where','attributes','limit','lodash','moment','bluebird','../../mysqldb'];(function(_0x2f1171,_0x128d87){var _0x561e07=function(_0x1957d8){while(--_0x1957d8){_0x2f1171['push'](_0x2f1171['shift']());}};_0x561e07(++_0x128d87);}(_0xa6fb,0x132));var _0xba6f=function(_0x5ce513,_0x32ca3f){_0x5ce513=_0x5ce513-0x0;var _0x2d18df=_0xa6fb[_0x5ce513];return _0x2d18df;};'use strict';var _=require(_0xba6f('0x0'));var util=require('util');var moment=require(_0xba6f('0x1'));var BPromise=require(_0xba6f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba6f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xba6f('0x4'))(_0xba6f('0x5'));var config=require(_0xba6f('0x6'));var jayson=require(_0xba6f('0x7'));var client=jayson[_0xba6f('0x8')][_0xba6f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f49af,_0x5c5a1d,_0x53b7e8){return new BPromise(function(_0x28a04c,_0x278b08){return client[_0xba6f('0xa')](_0x1f49af,_0x53b7e8)[_0xba6f('0xb')](function(_0x4d5aeb){logger[_0xba6f('0xc')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5c5a1d,_0xba6f('0xd'));logger[_0xba6f('0xe')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x5c5a1d,_0xba6f('0xd'),JSON[_0xba6f('0xf')](_0x4d5aeb));if(_0x4d5aeb[_0xba6f('0x10')]){if(_0x4d5aeb[_0xba6f('0x10')][_0xba6f('0x11')]===0x1f4){logger[_0xba6f('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5c5a1d,_0x4d5aeb[_0xba6f('0x10')][_0xba6f('0x12')]);return _0x278b08(_0x4d5aeb['error']['message']);}logger['error'](_0xba6f('0x13'),_0x5c5a1d,_0x4d5aeb[_0xba6f('0x10')]['message']);return _0x28a04c(_0x4d5aeb['error'][_0xba6f('0x12')]);}else{logger[_0xba6f('0xc')](_0xba6f('0x13'),_0x5c5a1d,_0xba6f('0xd'));_0x28a04c(_0x4d5aeb[_0xba6f('0x14')]['message']);}})['catch'](function(_0xc41aea){logger[_0xba6f('0x10')](_0xba6f('0x13'),_0x5c5a1d,_0xc41aea);_0x278b08(_0xc41aea);});});}exports['CreateWhatsappQueueReport']=function(_0x2169ec){var _0x36448d=this;return new Promise(function(_0x193b8a,_0x16212e){return db[_0xba6f('0x15')][_0xba6f('0x16')](_0x2169ec['body'],{'raw':_0x2169ec['options']?_0x2169ec[_0xba6f('0x17')][_0xba6f('0x18')]===undefined?!![]:![]:!![]})[_0xba6f('0xb')](function(_0x398a95){logger['info'](_0xba6f('0x19'),_0x2169ec);logger[_0xba6f('0xe')]('CreateWhatsappQueueReport',_0x2169ec,JSON[_0xba6f('0xf')](_0x398a95));_0x193b8a(_0x398a95);})[_0xba6f('0x1a')](function(_0xd69d2e){logger[_0xba6f('0x10')](_0xba6f('0x19'),_0xd69d2e[_0xba6f('0x12')],_0x2169ec);_0x16212e(_0x36448d[_0xba6f('0x10')](0x1f4,_0xd69d2e[_0xba6f('0x12')]));});});};exports[_0xba6f('0x1b')]=function(_0x10f715){var _0x3f4d7f=this;return new Promise(function(_0x2ec262,_0x9b214b){return db['WhatsappQueueReport']['update'](_0x10f715['body'],{'raw':_0x10f715['options']?_0x10f715[_0xba6f('0x17')][_0xba6f('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10f715[_0xba6f('0x17')]?_0x10f715[_0xba6f('0x17')][_0xba6f('0x1c')]||null:null,'attributes':_0x10f715[_0xba6f('0x17')]?_0x10f715[_0xba6f('0x17')][_0xba6f('0x1d')]||null:null,'limit':_0x10f715[_0xba6f('0x17')]?_0x10f715['options'][_0xba6f('0x1e')]||null:null})[_0xba6f('0xb')](function(_0x582f6a){logger[_0xba6f('0xc')](_0xba6f('0x1b'),_0x10f715);logger[_0xba6f('0xe')](_0xba6f('0x1b'),_0x10f715,JSON['stringify'](_0x582f6a));_0x2ec262(_0x582f6a);})[_0xba6f('0x1a')](function(_0x4cc59c){logger['error']('UpdateWhatsappQueueReport',_0x4cc59c[_0xba6f('0x12')],_0x10f715);_0x9b214b(_0x3f4d7f[_0xba6f('0x10')](0x1f4,_0x4cc59c[_0xba6f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 8242604..30ab6f0 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 _0x92d1=['index','get','isAuthenticated','describe','show','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller'];(function(_0x29ce14,_0x334166){var _0x48f289=function(_0x288d11){while(--_0x288d11){_0x29ce14['push'](_0x29ce14['shift']());}};_0x48f289(++_0x334166);}(_0x92d1,0x1cb));var _0x192d=function(_0x7942ee,_0x3b8e77){_0x7942ee=_0x7942ee-0x0;var _0x210ff7=_0x92d1[_0x7942ee];return _0x210ff7;};'use strict';var multer=require(_0x192d('0x0'));var util=require(_0x192d('0x1'));var path=require('path');var timeout=require(_0x192d('0x2'));var express=require(_0x192d('0x3'));var router=express[_0x192d('0x4')]();var fs_extra=require(_0x192d('0x5'));var auth=require(_0x192d('0x6'));var interaction=require(_0x192d('0x7'));var config=require('../../config/environment');var controller=require(_0x192d('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x192d('0x9')]);router[_0x192d('0xa')]('/describe',auth[_0x192d('0xb')](),controller[_0x192d('0xc')]);router[_0x192d('0xa')]('/:id',auth[_0x192d('0xb')](),controller[_0x192d('0xd')]);router['post']('/',auth[_0x192d('0xb')](),controller['create']);router['put'](_0x192d('0xe'),auth['isAuthenticated'](),controller[_0x192d('0xf')]);router[_0x192d('0x10')](_0x192d('0xe'),auth[_0x192d('0xb')](),controller['destroy']);module[_0x192d('0x11')]=router; \ No newline at end of file +var _0x662b=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','post','create','put','update','delete','/:id','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x42aa30,_0x28f4f4){var _0x3980d0=function(_0x5dc09d){while(--_0x5dc09d){_0x42aa30['push'](_0x42aa30['shift']());}};_0x3980d0(++_0x28f4f4);}(_0x662b,0x7d));var _0xb662=function(_0x191a30,_0x386f7e){_0x191a30=_0x191a30-0x0;var _0x39361f=_0x662b[_0x191a30];return _0x39361f;};'use strict';var multer=require(_0xb662('0x0'));var util=require(_0xb662('0x1'));var path=require(_0xb662('0x2'));var timeout=require(_0xb662('0x3'));var express=require(_0xb662('0x4'));var router=express[_0xb662('0x5')]();var fs_extra=require(_0xb662('0x6'));var auth=require(_0xb662('0x7'));var interaction=require(_0xb662('0x8'));var config=require(_0xb662('0x9'));var controller=require('./whatsappTransferReport.controller');router[_0xb662('0xa')]('/',auth[_0xb662('0xb')](),controller[_0xb662('0xc')]);router['get']('/describe',auth[_0xb662('0xb')](),controller[_0xb662('0xd')]);router[_0xb662('0xa')]('/:id',auth[_0xb662('0xb')](),controller[_0xb662('0xe')]);router[_0xb662('0xf')]('/',auth['isAuthenticated'](),controller[_0xb662('0x10')]);router[_0xb662('0x11')]('/:id',auth[_0xb662('0xb')](),controller[_0xb662('0x12')]);router[_0xb662('0x13')](_0xb662('0x14'),auth[_0xb662('0xb')](),controller[_0xb662('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index d92f61a..fc5ac28 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 _0x88a6=['DATE','exports','STRING','account','agent','queue'];(function(_0x4da1e6,_0x1566be){var _0x36c34e=function(_0x3d91da){while(--_0x3d91da){_0x4da1e6['push'](_0x4da1e6['shift']());}};_0x36c34e(++_0x1566be);}(_0x88a6,0x121));var _0x688a=function(_0x5f1d74,_0x33e095){_0x5f1d74=_0x5f1d74-0x0;var _0xab75f5=_0x88a6[_0x5f1d74];return _0xab75f5;};'use strict';var Sequelize=require('sequelize');module[_0x688a('0x0')]={'uniqueid':{'type':Sequelize[_0x688a('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x688a('0x2'),_0x688a('0x3'),_0x688a('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x688a('0x5')]}}; \ No newline at end of file +var _0x8ba6=['DATE','sequelize','STRING','account','agent','queue'];(function(_0x470f24,_0x2436a9){var _0x2c6fc8=function(_0x3ef190){while(--_0x3ef190){_0x470f24['push'](_0x470f24['shift']());}};_0x2c6fc8(++_0x2436a9);}(_0x8ba6,0x11b));var _0x68ba=function(_0x1105d4,_0x259e80){_0x1105d4=_0x1105d4-0x0;var _0x5da0c2=_0x8ba6[_0x1105d4];return _0x5da0c2;};'use strict';var Sequelize=require(_0x68ba('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x68ba('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x68ba('0x2'),_0x68ba('0x3'),_0x68ba('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x68ba('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index c6b74e1..f2cae66 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 _0x34d7=['show','params','filters','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','keys','query','intersection','attributes','model','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch'];(function(_0x32b1c3,_0x3db4cd){var _0x34e47b=function(_0xf550e){while(--_0xf550e){_0x32b1c3['push'](_0x32b1c3['shift']());}};_0x34e47b(++_0x3db4cd);}(_0x34d7,0x13c));var _0x734d=function(_0x1a39c8,_0x453b65){_0x1a39c8=_0x1a39c8-0x0;var _0x53bfde=_0x34d7[_0x1a39c8];return _0x53bfde;};'use strict';var emlformat=require(_0x734d('0x0'));var rimraf=require(_0x734d('0x1'));var zipdir=require(_0x734d('0x2'));var jsonpatch=require(_0x734d('0x3'));var rp=require(_0x734d('0x4'));var moment=require(_0x734d('0x5'));var BPromise=require(_0x734d('0x6'));var Mustache=require(_0x734d('0x7'));var util=require(_0x734d('0x8'));var path=require(_0x734d('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x734d('0xa'));var fs=require('fs');var fs_extra=require(_0x734d('0xb'));var _=require(_0x734d('0xc'));var squel=require(_0x734d('0xd'));var crypto=require('crypto');var jsforce=require(_0x734d('0xe'));var deskjs=require(_0x734d('0xf'));var toCsv=require(_0x734d('0x10'));var querystring=require('querystring');var Papa=require(_0x734d('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x734d('0x12'));var as=require(_0x734d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x734d('0x14'))('api');var utils=require(_0x734d('0x15'));var config=require(_0x734d('0x16'));var licenseUtil=require(_0x734d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5bd755,_0x2b46b3){_0x2b46b3=_0x2b46b3||0xcc;return function(_0x5c1a3e){if(_0x5c1a3e){return _0x5bd755[_0x734d('0x18')](_0x2b46b3);}return _0x5bd755['status'](_0x2b46b3)[_0x734d('0x19')]();};}function respondWithResult(_0x27a22c,_0x2b06d7){_0x2b06d7=_0x2b06d7||0xc8;return function(_0xc8986b){if(_0xc8986b){return _0x27a22c[_0x734d('0x1a')](_0x2b06d7)[_0x734d('0x1b')](_0xc8986b);}};}function respondWithFilteredResult(_0x5a8aa7,_0x34b57a){return function(_0x18d675){if(_0x18d675){var _0x2c1be6=typeof _0x34b57a['offset']===_0x734d('0x1c')&&typeof _0x34b57a[_0x734d('0x1d')]===_0x734d('0x1c');var _0x5de199=_0x18d675[_0x734d('0x1e')];var _0x5f02a4=_0x2c1be6?0x0:_0x34b57a[_0x734d('0x1f')];var _0x7aa671=_0x2c1be6?_0x18d675['count']:_0x34b57a[_0x734d('0x1f')]+_0x34b57a[_0x734d('0x1d')];var _0x44297f;if(_0x7aa671>=_0x5de199){_0x7aa671=_0x5de199;_0x44297f=0xc8;}else{_0x44297f=0xce;}_0x5a8aa7[_0x734d('0x1a')](_0x44297f);return _0x5a8aa7[_0x734d('0x20')]('Content-Range',_0x5f02a4+'-'+_0x7aa671+'/'+_0x5de199)[_0x734d('0x1b')](_0x18d675);}return null;};}function patchUpdates(_0x437b84){return function(_0x385d03){try{jsonpatch[_0x734d('0x21')](_0x385d03,_0x437b84,!![]);}catch(_0x2f3cd9){return BPromise[_0x734d('0x22')](_0x2f3cd9);}return _0x385d03[_0x734d('0x23')]();};}function saveUpdates(_0x47a658,_0x47d6ea){return function(_0x2c51c7){if(_0x2c51c7){return _0x2c51c7[_0x734d('0x24')](_0x47a658)['then'](function(_0x5093e4){return _0x5093e4;});}return null;};}function removeEntity(_0x5e1a62,_0x4b10e5){return function(_0x6729aa){if(_0x6729aa){return _0x6729aa[_0x734d('0x25')]()[_0x734d('0x26')](function(){_0x5e1a62[_0x734d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b9e89,_0x2955df){return function(_0x515185){if(!_0x515185){_0x4b9e89['sendStatus'](0x194);}return _0x515185;};}function handleError(_0x5519c9,_0x4f3ac2){_0x4f3ac2=_0x4f3ac2||0x1f4;return function(_0x4ea7de){logger[_0x734d('0x27')](_0x4ea7de[_0x734d('0x28')]);if(_0x4ea7de[_0x734d('0x29')]){delete _0x4ea7de[_0x734d('0x29')];}_0x5519c9['status'](_0x4f3ac2)[_0x734d('0x2a')](_0x4ea7de);};}exports[_0x734d('0x2b')]=function(_0x419656,_0x3c11ee){var _0x5176a0={},_0x439cc5={},_0x32295b={'count':0x0,'rows':[]};var _0x44b211=_[_0x734d('0x2c')](db[_0x734d('0x2d')][_0x734d('0x2e')],function(_0x87d016){return{'name':_0x87d016[_0x734d('0x2f')],'type':_0x87d016[_0x734d('0x30')]['key']};});_0x439cc5['model']=_[_0x734d('0x2c')](_0x44b211,_0x734d('0x29'));_0x439cc5['query']=_[_0x734d('0x31')](_0x419656[_0x734d('0x32')]);_0x439cc5['filters']=_[_0x734d('0x33')](_0x439cc5['model'],_0x439cc5[_0x734d('0x32')]);_0x5176a0[_0x734d('0x34')]=_[_0x734d('0x33')](_0x439cc5[_0x734d('0x35')],qs['fields'](_0x419656[_0x734d('0x32')][_0x734d('0x36')]));_0x5176a0['attributes']=_0x5176a0['attributes']['length']?_0x5176a0['attributes']:_0x439cc5[_0x734d('0x35')];if(!_0x419656['query'][_0x734d('0x37')](_0x734d('0x38'))){_0x5176a0['limit']=qs[_0x734d('0x1d')](_0x419656[_0x734d('0x32')][_0x734d('0x1d')]);_0x5176a0[_0x734d('0x1f')]=qs[_0x734d('0x1f')](_0x419656[_0x734d('0x32')][_0x734d('0x1f')]);}_0x5176a0['order']=qs[_0x734d('0x39')](_0x419656[_0x734d('0x32')][_0x734d('0x39')]);_0x5176a0[_0x734d('0x3a')]=qs['filters'](_[_0x734d('0x3b')](_0x419656['query'],_0x439cc5['filters']),_0x44b211);if(_0x419656[_0x734d('0x32')][_0x734d('0x3c')]){_0x5176a0[_0x734d('0x3a')]=_[_0x734d('0x3d')](_0x5176a0[_0x734d('0x3a')],{'$or':_[_0x734d('0x2c')](_0x44b211,function(_0x935547){if(_0x935547[_0x734d('0x30')]!==_0x734d('0x3e')){var _0xe1848b={};_0xe1848b[_0x935547[_0x734d('0x29')]]={'$like':'%'+_0x419656['query'][_0x734d('0x3c')]+'%'};return _0xe1848b;}})});}_0x5176a0=_[_0x734d('0x3d')]({},_0x5176a0,_0x419656[_0x734d('0x3f')]);var _0x7bb81e={'where':_0x5176a0[_0x734d('0x3a')]};return db[_0x734d('0x2d')][_0x734d('0x1e')](_0x7bb81e)['then'](function(_0x4785d6){_0x32295b[_0x734d('0x1e')]=_0x4785d6;if(_0x419656[_0x734d('0x32')][_0x734d('0x40')]){_0x5176a0[_0x734d('0x41')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x734d('0x42')](_0x5176a0);})['then'](function(_0x3ef0b1){_0x32295b[_0x734d('0x43')]=_0x3ef0b1;return _0x32295b;})[_0x734d('0x26')](respondWithFilteredResult(_0x3c11ee,_0x5176a0))[_0x734d('0x44')](handleError(_0x3c11ee,null));};exports[_0x734d('0x45')]=function(_0x122f40,_0x3f014a){var _0x4a3f5a={'raw':!![],'where':{'id':_0x122f40[_0x734d('0x46')]['id']}},_0x5a711f={};_0x5a711f['model']=_[_0x734d('0x31')](db[_0x734d('0x2d')][_0x734d('0x2e')]);_0x5a711f['query']=_[_0x734d('0x31')](_0x122f40[_0x734d('0x32')]);_0x5a711f[_0x734d('0x47')]=_[_0x734d('0x33')](_0x5a711f[_0x734d('0x35')],_0x5a711f['query']);_0x4a3f5a[_0x734d('0x34')]=_['intersection'](_0x5a711f[_0x734d('0x35')],qs[_0x734d('0x36')](_0x122f40[_0x734d('0x32')][_0x734d('0x36')]));_0x4a3f5a[_0x734d('0x34')]=_0x4a3f5a[_0x734d('0x34')][_0x734d('0x48')]?_0x4a3f5a['attributes']:_0x5a711f[_0x734d('0x35')];if(_0x122f40[_0x734d('0x32')]['includeAll']){_0x4a3f5a['include']=[{'all':!![]}];}_0x4a3f5a=_[_0x734d('0x3d')]({},_0x4a3f5a,_0x122f40[_0x734d('0x3f')]);return db['WhatsappTransferReport'][_0x734d('0x49')](_0x4a3f5a)[_0x734d('0x26')](handleEntityNotFound(_0x3f014a,null))[_0x734d('0x26')](respondWithResult(_0x3f014a,null))[_0x734d('0x44')](handleError(_0x3f014a,null));};exports[_0x734d('0x4a')]=function(_0x31e141,_0x2d9769){return db[_0x734d('0x2d')][_0x734d('0x4a')](_0x31e141[_0x734d('0x4b')],{})[_0x734d('0x26')](respondWithResult(_0x2d9769,0xc9))[_0x734d('0x44')](handleError(_0x2d9769,null));};exports['update']=function(_0x1fe3cd,_0x5cd2bc){if(_0x1fe3cd[_0x734d('0x4b')]['id']){delete _0x1fe3cd['body']['id'];}return db['WhatsappTransferReport'][_0x734d('0x49')]({'where':{'id':_0x1fe3cd[_0x734d('0x46')]['id']}})[_0x734d('0x26')](handleEntityNotFound(_0x5cd2bc,null))[_0x734d('0x26')](saveUpdates(_0x1fe3cd[_0x734d('0x4b')],null))[_0x734d('0x26')](respondWithResult(_0x5cd2bc,null))[_0x734d('0x44')](handleError(_0x5cd2bc,null));};exports[_0x734d('0x25')]=function(_0x5ee3aa,_0x2cf974){return db[_0x734d('0x2d')]['find']({'where':{'id':_0x5ee3aa['params']['id']}})['then'](handleEntityNotFound(_0x2cf974,null))[_0x734d('0x26')](removeEntity(_0x2cf974,null))[_0x734d('0x44')](handleError(_0x2cf974,null));};exports[_0x734d('0x4c')]=function(_0x1441f0,_0x2b9128){return db[_0x734d('0x2d')][_0x734d('0x4c')]()['then'](respondWithResult(_0x2b9128,null))[_0x734d('0x44')](handleError(_0x2b9128,null));}; \ No newline at end of file +var _0x1943=['create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','apply','save','update','destroy','then','error','stack','name','send','map','WhatsappTransferReport','fieldName','key','model','keys','filters','intersection','query','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','rawAttributes','length','options','catch'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1943,0x124));var _0x3194=function(_0x2ee7c3,_0x1753a5){_0x2ee7c3=_0x2ee7c3-0x0;var _0x3a1259=_0x1943[_0x2ee7c3];return _0x3a1259;};'use strict';var emlformat=require(_0x3194('0x0'));var rimraf=require(_0x3194('0x1'));var zipdir=require(_0x3194('0x2'));var jsonpatch=require(_0x3194('0x3'));var rp=require('request-promise');var moment=require(_0x3194('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3194('0x5'));var util=require('util');var path=require('path');var sox=require(_0x3194('0x6'));var csv=require(_0x3194('0x7'));var ejs=require(_0x3194('0x8'));var fs=require('fs');var fs_extra=require(_0x3194('0x9'));var _=require(_0x3194('0xa'));var squel=require(_0x3194('0xb'));var crypto=require(_0x3194('0xc'));var jsforce=require(_0x3194('0xd'));var deskjs=require(_0x3194('0xe'));var toCsv=require(_0x3194('0x7'));var querystring=require(_0x3194('0xf'));var Papa=require('papaparse');var Redis=require(_0x3194('0x10'));var authService=require(_0x3194('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3194('0x12'))(_0x3194('0x13'));var utils=require(_0x3194('0x14'));var config=require(_0x3194('0x15'));var licenseUtil=require(_0x3194('0x16'));var db=require(_0x3194('0x17'))['db'];function respondWithStatusCode(_0x44b87c,_0xa2d324){_0xa2d324=_0xa2d324||0xcc;return function(_0x3a51fa){if(_0x3a51fa){return _0x44b87c[_0x3194('0x18')](_0xa2d324);}return _0x44b87c[_0x3194('0x19')](_0xa2d324)['end']();};}function respondWithResult(_0x41b24d,_0xc2b36e){_0xc2b36e=_0xc2b36e||0xc8;return function(_0x5dc0f8){if(_0x5dc0f8){return _0x41b24d['status'](_0xc2b36e)['json'](_0x5dc0f8);}};}function respondWithFilteredResult(_0x1a5fbc,_0x9be198){return function(_0x34e3f5){if(_0x34e3f5){var _0x176933=typeof _0x9be198[_0x3194('0x1a')]==='undefined'&&typeof _0x9be198[_0x3194('0x1b')]===_0x3194('0x1c');var _0x186a37=_0x34e3f5[_0x3194('0x1d')];var _0x305b2a=_0x176933?0x0:_0x9be198[_0x3194('0x1a')];var _0x4646b0=_0x176933?_0x34e3f5[_0x3194('0x1d')]:_0x9be198[_0x3194('0x1a')]+_0x9be198['limit'];var _0x234091;if(_0x4646b0>=_0x186a37){_0x4646b0=_0x186a37;_0x234091=0xc8;}else{_0x234091=0xce;}_0x1a5fbc[_0x3194('0x19')](_0x234091);return _0x1a5fbc[_0x3194('0x1e')]('Content-Range',_0x305b2a+'-'+_0x4646b0+'/'+_0x186a37)['json'](_0x34e3f5);}return null;};}function patchUpdates(_0x51c388){return function(_0x45a0d0){try{jsonpatch[_0x3194('0x1f')](_0x45a0d0,_0x51c388,!![]);}catch(_0x1bcb1e){return BPromise['reject'](_0x1bcb1e);}return _0x45a0d0[_0x3194('0x20')]();};}function saveUpdates(_0x198a30,_0x7322ea){return function(_0x547173){if(_0x547173){return _0x547173[_0x3194('0x21')](_0x198a30)['then'](function(_0x351fd5){return _0x351fd5;});}return null;};}function removeEntity(_0x497521,_0x1607ae){return function(_0x8f2683){if(_0x8f2683){return _0x8f2683[_0x3194('0x22')]()[_0x3194('0x23')](function(){_0x497521[_0x3194('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfaa419,_0x2e912d){return function(_0xd71bc3){if(!_0xd71bc3){_0xfaa419[_0x3194('0x18')](0x194);}return _0xd71bc3;};}function handleError(_0x5348b6,_0x5440a9){_0x5440a9=_0x5440a9||0x1f4;return function(_0x3bef62){logger[_0x3194('0x24')](_0x3bef62[_0x3194('0x25')]);if(_0x3bef62[_0x3194('0x26')]){delete _0x3bef62['name'];}_0x5348b6['status'](_0x5440a9)[_0x3194('0x27')](_0x3bef62);};}exports['index']=function(_0x11ae63,_0x2233ef){var _0x3b5d9c={},_0x463bf5={},_0x4dd6f8={'count':0x0,'rows':[]};var _0x5f0172=_[_0x3194('0x28')](db[_0x3194('0x29')]['rawAttributes'],function(_0x9baf7d){return{'name':_0x9baf7d[_0x3194('0x2a')],'type':_0x9baf7d['type'][_0x3194('0x2b')]};});_0x463bf5[_0x3194('0x2c')]=_[_0x3194('0x28')](_0x5f0172,_0x3194('0x26'));_0x463bf5['query']=_[_0x3194('0x2d')](_0x11ae63['query']);_0x463bf5[_0x3194('0x2e')]=_[_0x3194('0x2f')](_0x463bf5[_0x3194('0x2c')],_0x463bf5[_0x3194('0x30')]);_0x3b5d9c['attributes']=_['intersection'](_0x463bf5['model'],qs['fields'](_0x11ae63[_0x3194('0x30')][_0x3194('0x31')]));_0x3b5d9c[_0x3194('0x32')]=_0x3b5d9c['attributes']['length']?_0x3b5d9c[_0x3194('0x32')]:_0x463bf5[_0x3194('0x2c')];if(!_0x11ae63[_0x3194('0x30')][_0x3194('0x33')]('nolimit')){_0x3b5d9c[_0x3194('0x1b')]=qs[_0x3194('0x1b')](_0x11ae63['query'][_0x3194('0x1b')]);_0x3b5d9c[_0x3194('0x1a')]=qs[_0x3194('0x1a')](_0x11ae63[_0x3194('0x30')][_0x3194('0x1a')]);}_0x3b5d9c[_0x3194('0x34')]=qs[_0x3194('0x35')](_0x11ae63[_0x3194('0x30')][_0x3194('0x35')]);_0x3b5d9c[_0x3194('0x36')]=qs['filters'](_[_0x3194('0x37')](_0x11ae63[_0x3194('0x30')],_0x463bf5[_0x3194('0x2e')]),_0x5f0172);if(_0x11ae63['query'][_0x3194('0x38')]){_0x3b5d9c[_0x3194('0x36')]=_[_0x3194('0x39')](_0x3b5d9c[_0x3194('0x36')],{'$or':_['map'](_0x5f0172,function(_0x33a965){if(_0x33a965['type']!==_0x3194('0x3a')){var _0x5fce94={};_0x5fce94[_0x33a965[_0x3194('0x26')]]={'$like':'%'+_0x11ae63[_0x3194('0x30')][_0x3194('0x38')]+'%'};return _0x5fce94;}})});}_0x3b5d9c=_[_0x3194('0x39')]({},_0x3b5d9c,_0x11ae63['options']);var _0x5bc6cc={'where':_0x3b5d9c[_0x3194('0x36')]};return db[_0x3194('0x29')]['count'](_0x5bc6cc)['then'](function(_0x1462ba){_0x4dd6f8[_0x3194('0x1d')]=_0x1462ba;if(_0x11ae63['query'][_0x3194('0x3b')]){_0x3b5d9c[_0x3194('0x3c')]=[{'all':!![]}];}return db[_0x3194('0x29')][_0x3194('0x3d')](_0x3b5d9c);})[_0x3194('0x23')](function(_0x45fe78){_0x4dd6f8['rows']=_0x45fe78;return _0x4dd6f8;})[_0x3194('0x23')](respondWithFilteredResult(_0x2233ef,_0x3b5d9c))['catch'](handleError(_0x2233ef,null));};exports[_0x3194('0x3e')]=function(_0x1dc9a8,_0x18d034){var _0x9629f={'raw':!![],'where':{'id':_0x1dc9a8[_0x3194('0x3f')]['id']}},_0x5e6f49={};_0x5e6f49[_0x3194('0x2c')]=_[_0x3194('0x2d')](db[_0x3194('0x29')][_0x3194('0x40')]);_0x5e6f49[_0x3194('0x30')]=_[_0x3194('0x2d')](_0x1dc9a8[_0x3194('0x30')]);_0x5e6f49[_0x3194('0x2e')]=_[_0x3194('0x2f')](_0x5e6f49[_0x3194('0x2c')],_0x5e6f49[_0x3194('0x30')]);_0x9629f['attributes']=_['intersection'](_0x5e6f49[_0x3194('0x2c')],qs[_0x3194('0x31')](_0x1dc9a8['query'][_0x3194('0x31')]));_0x9629f[_0x3194('0x32')]=_0x9629f['attributes'][_0x3194('0x41')]?_0x9629f[_0x3194('0x32')]:_0x5e6f49['model'];if(_0x1dc9a8[_0x3194('0x30')]['includeAll']){_0x9629f[_0x3194('0x3c')]=[{'all':!![]}];}_0x9629f=_[_0x3194('0x39')]({},_0x9629f,_0x1dc9a8[_0x3194('0x42')]);return db[_0x3194('0x29')]['find'](_0x9629f)[_0x3194('0x23')](handleEntityNotFound(_0x18d034,null))[_0x3194('0x23')](respondWithResult(_0x18d034,null))[_0x3194('0x43')](handleError(_0x18d034,null));};exports[_0x3194('0x44')]=function(_0x448b06,_0x27dfff){return db[_0x3194('0x29')][_0x3194('0x44')](_0x448b06[_0x3194('0x45')],{})[_0x3194('0x23')](respondWithResult(_0x27dfff,0xc9))[_0x3194('0x43')](handleError(_0x27dfff,null));};exports[_0x3194('0x21')]=function(_0x31a7c5,_0x45b1cb){if(_0x31a7c5[_0x3194('0x45')]['id']){delete _0x31a7c5['body']['id'];}return db['WhatsappTransferReport'][_0x3194('0x46')]({'where':{'id':_0x31a7c5[_0x3194('0x3f')]['id']}})['then'](handleEntityNotFound(_0x45b1cb,null))[_0x3194('0x23')](saveUpdates(_0x31a7c5[_0x3194('0x45')],null))[_0x3194('0x23')](respondWithResult(_0x45b1cb,null))['catch'](handleError(_0x45b1cb,null));};exports['destroy']=function(_0x9b06f2,_0x53816e){return db[_0x3194('0x29')][_0x3194('0x46')]({'where':{'id':_0x9b06f2[_0x3194('0x3f')]['id']}})[_0x3194('0x23')](handleEntityNotFound(_0x53816e,null))['then'](removeEntity(_0x53816e,null))[_0x3194('0x43')](handleError(_0x53816e,null));};exports[_0x3194('0x47')]=function(_0x41e0a7,_0x3b83b9){return db[_0x3194('0x29')][_0x3194('0x47')]()[_0x3194('0x23')](respondWithResult(_0x3b83b9,null))[_0x3194('0x43')](handleError(_0x3b83b9,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 3d4d4fd..03fda71 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 _0x880a=['api','bluebird','request-promise','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x2ab423,_0x5481bd){var _0x3d79a8=function(_0x93949a){while(--_0x93949a){_0x2ab423['push'](_0x2ab423['shift']());}};_0x3d79a8(++_0x5481bd);}(_0x880a,0xa6));var _0xa880=function(_0xeaf15e,_0x58a614){_0xeaf15e=_0xeaf15e-0x0;var _0x12c623=_0x880a[_0xeaf15e];return _0x12c623;};'use strict';var _=require(_0xa880('0x0'));var util=require(_0xa880('0x1'));var logger=require(_0xa880('0x2'))(_0xa880('0x3'));var moment=require('moment');var BPromise=require(_0xa880('0x4'));var rp=require(_0xa880('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa880('0x6'));var attributes=require(_0xa880('0x7'));module[_0xa880('0x8')]=function(_0x108e69,_0xa1f58a){return _0x108e69[_0xa880('0x9')](_0xa880('0xa'),attributes,{'tableName':_0xa880('0xb'),'paranoid':![],'indexes':[{'name':_0xa880('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3ddf=['rimraf','WhatsappTransferReport','uniqueid','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x303064,_0x12f0c2){var _0x5a1d3d=function(_0x5b9d81){while(--_0x5b9d81){_0x303064['push'](_0x303064['shift']());}};_0x5a1d3d(++_0x12f0c2);}(_0x3ddf,0x174));var _0xf3dd=function(_0x268c6e,_0x3510ae){_0x268c6e=_0x268c6e-0x0;var _0x5b6d25=_0x3ddf[_0x268c6e];return _0x5b6d25;};'use strict';var _=require(_0xf3dd('0x0'));var util=require(_0xf3dd('0x1'));var logger=require(_0xf3dd('0x2'))('api');var moment=require(_0xf3dd('0x3'));var BPromise=require(_0xf3dd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf3dd('0x5'));var rimraf=require(_0xf3dd('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappTransferReport.attributes');module['exports']=function(_0x44f374,_0x5bf3e3){return _0x44f374['define'](_0xf3dd('0x7'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xf3dd('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 1f6d312..b217e31 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 _0xe987=['request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','code','WhatsappTransferReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x2e0967,_0x3fd097){var _0x180b59=function(_0x1048f2){while(--_0x1048f2){_0x2e0967['push'](_0x2e0967['shift']());}};_0x180b59(++_0x3fd097);}(_0xe987,0x162));var _0x7e98=function(_0x57e196,_0x428408){_0x57e196=_0x57e196-0x0;var _0x5941ab=_0xe987[_0x57e196];return _0x5941ab;};'use strict';var _=require('lodash');var util=require(_0x7e98('0x0'));var moment=require(_0x7e98('0x1'));var BPromise=require(_0x7e98('0x2'));var rs=require(_0x7e98('0x3'));var fs=require('fs');var Redis=require(_0x7e98('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7e98('0x5'));var logger=require(_0x7e98('0x6'))(_0x7e98('0x7'));var config=require(_0x7e98('0x8'));var jayson=require(_0x7e98('0x9'));var client=jayson[_0x7e98('0xa')][_0x7e98('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e3fe8,_0x4638ac,_0x5aa9bb){return new BPromise(function(_0xb3986c,_0x3a4b7b){return client[_0x7e98('0xc')](_0x4e3fe8,_0x5aa9bb)['then'](function(_0x1c526e){logger[_0x7e98('0xd')]('WhatsappTransferReport,\x20%s,\x20%s',_0x4638ac,_0x7e98('0xe'));logger[_0x7e98('0xf')](_0x7e98('0x10'),_0x4638ac,_0x7e98('0xe'),JSON['stringify'](_0x1c526e));if(_0x1c526e['error']){if(_0x1c526e[_0x7e98('0x11')][_0x7e98('0x12')]===0x1f4){logger[_0x7e98('0x11')](_0x7e98('0x13'),_0x4638ac,_0x1c526e[_0x7e98('0x11')][_0x7e98('0x14')]);return _0x3a4b7b(_0x1c526e[_0x7e98('0x11')]['message']);}logger[_0x7e98('0x11')](_0x7e98('0x13'),_0x4638ac,_0x1c526e['error'][_0x7e98('0x14')]);return _0xb3986c(_0x1c526e[_0x7e98('0x11')][_0x7e98('0x14')]);}else{logger[_0x7e98('0xd')](_0x7e98('0x13'),_0x4638ac,_0x7e98('0xe'));_0xb3986c(_0x1c526e[_0x7e98('0x15')][_0x7e98('0x14')]);}})[_0x7e98('0x16')](function(_0x3aa15b){logger['error'](_0x7e98('0x13'),_0x4638ac,_0x3aa15b);_0x3a4b7b(_0x3aa15b);});});} \ No newline at end of file +var _0x69e3=['../../mysqldb','../../config/utils','rpc','../../config/environment','client','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','util','moment','randomstring'];(function(_0x49b48b,_0x313a85){var _0x398600=function(_0x15d493){while(--_0x15d493){_0x49b48b['push'](_0x49b48b['shift']());}};_0x398600(++_0x313a85);}(_0x69e3,0x1d0));var _0x369e=function(_0x444a37,_0x593852){_0x444a37=_0x444a37-0x0;var _0x4573c8=_0x69e3[_0x444a37];return _0x4573c8;};'use strict';var _=require(_0x369e('0x0'));var util=require(_0x369e('0x1'));var moment=require(_0x369e('0x2'));var BPromise=require('bluebird');var rs=require(_0x369e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x369e('0x4'))['db'];var utils=require(_0x369e('0x5'));var logger=require('../../config/logger')(_0x369e('0x6'));var config=require(_0x369e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x369e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x489332,_0x32a93a,_0x4cea41){return new BPromise(function(_0x4dea4f,_0x55d742){return client['request'](_0x489332,_0x4cea41)['then'](function(_0x4a7b60){logger['info'](_0x369e('0x9'),_0x32a93a,_0x369e('0xa'));logger[_0x369e('0xb')](_0x369e('0xc'),_0x32a93a,'request\x20sent',JSON['stringify'](_0x4a7b60));if(_0x4a7b60[_0x369e('0xd')]){if(_0x4a7b60[_0x369e('0xd')][_0x369e('0xe')]===0x1f4){logger[_0x369e('0xd')](_0x369e('0x9'),_0x32a93a,_0x4a7b60['error'][_0x369e('0xf')]);return _0x55d742(_0x4a7b60[_0x369e('0xd')][_0x369e('0xf')]);}logger[_0x369e('0xd')](_0x369e('0x9'),_0x32a93a,_0x4a7b60['error'][_0x369e('0xf')]);return _0x4dea4f(_0x4a7b60['error'][_0x369e('0xf')]);}else{logger[_0x369e('0x10')](_0x369e('0x9'),_0x32a93a,_0x369e('0xa'));_0x4dea4f(_0x4a7b60['result'][_0x369e('0xf')]);}})[_0x369e('0x11')](function(_0x1433d7){logger[_0x369e('0xd')]('WhatsappTransferReport,\x20%s,\x20%s',_0x32a93a,_0x1433d7);_0x55d742(_0x1433d7);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 9a0a812..612cbb7 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0f9f=['default','listen','info','start','number','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','name','Online\x20apps:','filter','online','join','Offline\x20apps:','status','None','log','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then'];(function(_0x1f5f5a,_0x2bd54c){var _0x28aab6=function(_0x164913){while(--_0x164913){_0x1f5f5a['push'](_0x1f5f5a['shift']());}};_0x28aab6(++_0x2bd54c);}(_0x0f9f,0xae));var _0xf0f9=function(_0x49d27a,_0x166543){_0x49d27a=_0x49d27a-0x0;var _0x3f0b62=_0x0f9f[_0x49d27a];return _0x3f0b62;};'use strict';var _=require(_0xf0f9('0x0'));var db=require(_0xf0f9('0x1'))['db'];var seedDb=require(_0xf0f9('0x2'));var checkLicense=require(_0xf0f9('0x3'));var rpc=require(_0xf0f9('0x4'));var config=require(_0xf0f9('0x5'));var logger=require(_0xf0f9('0x6'))(_0xf0f9('0x7'));var pm2=require(_0xf0f9('0x8'));var pm2Config=require(_0xf0f9('0x9'));var schedule=require(_0xf0f9('0xa'));var chat=require('./config/schedule/chat');var whatsapp=require(_0xf0f9('0xb'));var transcribe=require(_0xf0f9('0xc'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0xf0f9('0xd')][_0xf0f9('0xe')]()[_0xf0f9('0xf')](function(){if(config['seedDB']){return seedDb[_0xf0f9('0x10')]();}})[_0xf0f9('0xf')](function(){return checkLicense['default']();})[_0xf0f9('0xf')](function(){return rpc[_0xf0f9('0x11')]();})[_0xf0f9('0xf')](function(_0x3be7af){logger[_0xf0f9('0x12')](_0x3be7af);return chat[_0xf0f9('0x13')]();})[_0xf0f9('0xf')](function(){return whatsapp[_0xf0f9('0x13')]();})['then'](function(){return schedule[_0xf0f9('0x13')]();})[_0xf0f9('0xf')](function(){return transcribe[_0xf0f9('0x13')]();})[_0xf0f9('0xf')](function(){return provider['start']();})[_0xf0f9('0xf')](function(_0xd4e645){logger['info'](_0xd4e645);return pm2[_0xf0f9('0x13')](pm2Config);})['then'](function(_0x538864){var _0x2c832a=_0x538864['filter'](function(_0x3e1587){return typeof _0x3e1587['exitCode']===_0xf0f9('0x14')&&_0x3e1587[_0xf0f9('0x15')]>=0x0;});if(_0x2c832a[_0xf0f9('0x16')]>0x0){throw new Error(_0x2c832a[_0xf0f9('0x16')]+_0xf0f9('0x17')+_[_0xf0f9('0x18')](_0x2c832a,function(_0x10dae6){return'\x22'+_0x10dae6['pm2_env'][_0xf0f9('0x19')]+'\x22';}));}logger[_0xf0f9('0x12')](_0xf0f9('0x1a'),_[_0xf0f9('0x18')](_[_0xf0f9('0x1b')](_0x538864,{'status':_0xf0f9('0x1c')}),_0xf0f9('0x19'))[_0xf0f9('0x1d')]());logger['info'](_0xf0f9('0x1e'),_['map'](_[_0xf0f9('0x1b')](_0x538864,function(_0x510119){return _0x510119[_0xf0f9('0x1f')]!==_0xf0f9('0x1c');}),_0xf0f9('0x19'))[_0xf0f9('0x1d')]()||_0xf0f9('0x20'));console[_0xf0f9('0x21')]('App\x20Ready!');})[_0xf0f9('0x22')](function(_0x535c2c){console[_0xf0f9('0x21')](_0xf0f9('0x23'),_0x535c2c);logger['error'](_0xf0f9('0x24'),_0x535c2c);process[_0xf0f9('0x25')](0x1);});}main(); \ No newline at end of file +var _0x0048=['exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','online','join','Offline\x20apps:','status','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./config/seedDB','./rpc','./config/environment','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','then','seedDB','default','listen','info','start','filter'];(function(_0x40b645,_0x12ab5b){var _0x23cf9e=function(_0x4bcbe5){while(--_0x4bcbe5){_0x40b645['push'](_0x40b645['shift']());}};_0x23cf9e(++_0x12ab5b);}(_0x0048,0x129));var _0x8004=function(_0xbccf,_0x5f3f74){_0xbccf=_0xbccf-0x0;var _0x24c504=_0x0048[_0xbccf];return _0x24c504;};'use strict';var _=require('lodash');var db=require(_0x8004('0x0'))['db'];var seedDb=require(_0x8004('0x1'));var checkLicense=require('./config/license');var rpc=require(_0x8004('0x2'));var config=require(_0x8004('0x3'));var logger=require('./config/logger')(_0x8004('0x4'));var pm2=require(_0x8004('0x5'));var pm2Config=require(_0x8004('0x6'));var schedule=require(_0x8004('0x7'));var chat=require('./config/schedule/chat');var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x8004('0x8'));var provider=require(_0x8004('0x9'));function main(){return db[_0x8004('0xa')]['sync']()[_0x8004('0xb')](function(){if(config[_0x8004('0xc')]){return seedDb[_0x8004('0xd')]();}})['then'](function(){return checkLicense['default']();})['then'](function(){return rpc[_0x8004('0xe')]();})['then'](function(_0x59ea76){logger[_0x8004('0xf')](_0x59ea76);return chat[_0x8004('0x10')]();})['then'](function(){return whatsapp['start']();})[_0x8004('0xb')](function(){return schedule[_0x8004('0x10')]();})[_0x8004('0xb')](function(){return transcribe[_0x8004('0x10')]();})[_0x8004('0xb')](function(){return provider[_0x8004('0x10')]();})[_0x8004('0xb')](function(_0x5d9972){logger[_0x8004('0xf')](_0x5d9972);return pm2[_0x8004('0x10')](pm2Config);})[_0x8004('0xb')](function(_0xeaeac3){var _0x235819=_0xeaeac3[_0x8004('0x11')](function(_0x2b63fc){return typeof _0x2b63fc[_0x8004('0x12')]===_0x8004('0x13')&&_0x2b63fc[_0x8004('0x12')]>=0x0;});if(_0x235819[_0x8004('0x14')]>0x0){throw new Error(_0x235819[_0x8004('0x14')]+_0x8004('0x15')+_[_0x8004('0x16')](_0x235819,function(_0x205ff9){return'\x22'+_0x205ff9[_0x8004('0x17')][_0x8004('0x18')]+'\x22';}));}logger[_0x8004('0xf')](_0x8004('0x19'),_['map'](_[_0x8004('0x11')](_0xeaeac3,{'status':_0x8004('0x1a')}),'name')[_0x8004('0x1b')]());logger[_0x8004('0xf')](_0x8004('0x1c'),_[_0x8004('0x16')](_[_0x8004('0x11')](_0xeaeac3,function(_0x1c5c21){return _0x1c5c21[_0x8004('0x1d')]!==_0x8004('0x1a');}),_0x8004('0x18'))[_0x8004('0x1b')]()||'None');console['log']('App\x20Ready!');})[_0x8004('0x1e')](function(_0x24e5a7){console['log'](_0x8004('0x1f'),_0x24e5a7);logger[_0x8004('0x20')](_0x8004('0x21'),_0x24e5a7);process[_0x8004('0x22')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index aebd77e..37a3d88 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 _0x6cb4=['../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','crypto','util','secrets','session','role','fullname','name','internal','userpic','permissions','voicePause','chatPause','faxPause','smsPause','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','privacyEnabled','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','closed','disposition','then','unmanaged','Unmanaged.','Forbidden.','catch','headers','authorization','User','find','pass','json','Wrong\x20credentials.','startsWith','status','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','findOne','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','blocked','add','Invalid\x20API\x20access\x20key','User\x20object\x20not\x20found.','getLicense','update','Forbidden','isWebrtcLicence','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','/dashboards/general','isNil','apiKeyIat','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','length','unshift','encryptString','join','promisify','sign','secret','options','verify','toString','hex','floor','now','../../mysqldb','../../config/environment','../../config/license/hardware'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x6cb4,0xff));var _0x46cb=function(_0x4db7b3,_0xa7135){_0x4db7b3=_0x4db7b3-0x0;var _0x2c7318=_0x6cb4[_0x4db7b3];return _0x2c7318;};'use strict';var db=require(_0x46cb('0x0'))['db'];var config=require(_0x46cb('0x1'));var hardwareConf=require(_0x46cb('0x2'));var licenseUtil=require(_0x46cb('0x3'));var encryptor=require(_0x46cb('0x4'));var _=require(_0x46cb('0x5'));var jwt=require(_0x46cb('0x6'));var expressJwt=require(_0x46cb('0x7'));var compose=require(_0x46cb('0x8'));var basicAuth=require('basic-auth');var crypto=require(_0x46cb('0x9'));var BPromise=require('bluebird');var util=require(_0x46cb('0xa'));var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0x46cb('0xb')][_0x46cb('0xc')]});var userAttributes=['id',_0x46cb('0xd'),_0x46cb('0xe'),_0x46cb('0xf'),_0x46cb('0x10'),'email',_0x46cb('0x11'),_0x46cb('0x12'),'md5secret',_0x46cb('0x13'),_0x46cb('0x14'),'mailPause',_0x46cb('0x15'),_0x46cb('0x16'),'openchannelPause','pauseType','showWebBar',_0x46cb('0x17'),_0x46cb('0x18'),_0x46cb('0x19'),_0x46cb('0x1a'),'passwordResetAt',_0x46cb('0x1b'),_0x46cb('0x1c'),_0x46cb('0x1d'),_0x46cb('0x1e'),_0x46cb('0x1f'),_0x46cb('0x20'),_0x46cb('0x21'),_0x46cb('0x22'),_0x46cb('0x23'),_0x46cb('0x24'),_0x46cb('0x25'),'hotdesk',_0x46cb('0x26'),'userProfileId',_0x46cb('0x27'),'settingsEnabled','wssPort','downloadVoiceRecordings',_0x46cb('0x28'),_0x46cb('0x29'),_0x46cb('0x2a'),_0x46cb('0x2b'),_0x46cb('0x2c'),_0x46cb('0x2d'),_0x46cb('0x2e'),_0x46cb('0x2f'),_0x46cb('0x30'),_0x46cb('0x31'),_0x46cb('0x32'),_0x46cb('0x33'),_0x46cb('0x34'),_0x46cb('0x35'),_0x46cb('0x36'),_0x46cb('0x37'),_0x46cb('0x38')];exports[_0x46cb('0x39')]=function(){return this[_0x46cb('0x3a')](!![])[_0x46cb('0x3b')](function(_0x32a59b,_0x1e9e38,_0x309e4b){if(_0x32a59b[_0x46cb('0x3c')]){_0x309e4b();}else{return db[_0x46cb('0x3d')]['findOne']({'where':{'id':_0x32a59b['params']['id']},'attributes':['id',_0x46cb('0x3e'),_0x46cb('0x3f')],'raw':!![]})[_0x46cb('0x40')](function(_0xe078a8){if(_0xe078a8&&_0xe078a8[_0x46cb('0x3e')]){return _0x1e9e38['status'](_0xe078a8[_0x46cb('0x3f')]==='unmanaged'?0x195:0x193)['json']({'message':_0xe078a8['disposition']===_0x46cb('0x41')?_0x46cb('0x42'):_0x46cb('0x43')});}else{_0x309e4b();}})[_0x46cb('0x44')](function(_0x7cd177){_0x309e4b(_0x7cd177);});}});};exports[_0x46cb('0x3a')]=function isAuthenticated(_0x378dc7){return compose()[_0x46cb('0x3b')](function(_0x2b846a,_0x12e01e,_0x4620ef){var _0x4a1517;if(_0x2b846a[_0x46cb('0x45')][_0x46cb('0x46')]){if(_['startsWith'](_0x2b846a['headers'][_0x46cb('0x46')],'Basic')){var _0x27c22d=basicAuth(_0x2b846a);db[_0x46cb('0x47')][_0x46cb('0x48')]({'where':{'name':_0x27c22d[_0x46cb('0xf')]}})[_0x46cb('0x40')](function(_0x33c248){if(!_0x33c248||!_0x33c248['authenticate'](_0x27c22d[_0x46cb('0x49')])){return _0x12e01e['status'](0x191)[_0x46cb('0x4a')]({'message':_0x46cb('0x4b')});}_0x2b846a['user']={'id':_0x33c248['id']};_0x4620ef();})[_0x46cb('0x44')](function(_0x3f0eb4){_0x4620ef(_0x3f0eb4);});}else if(_[_0x46cb('0x4c')](_0x2b846a[_0x46cb('0x45')][_0x46cb('0x46')],'Bearer')){validateJwt(_0x2b846a,_0x12e01e,_0x4620ef);}else{if(_0x378dc7){_0x4620ef();}else{return _0x12e01e[_0x46cb('0x4d')](0x193)['json']({'message':_0x46cb('0x4e')});}}}else if(_0x2b846a[_0x46cb('0x4f')][_0x46cb('0x50')]){try{var _0x50000e={'audience':hardwareConf[_0x46cb('0x51')](),'issuer':hardwareConf[_0x46cb('0x51')]()};verifyJwt(_0x2b846a['query'][_0x46cb('0x50')],_0x50000e)[_0x46cb('0x40')](function(_0x3ba467){return db[_0x46cb('0x47')][_0x46cb('0x48')]({'where':{'id':_0x3ba467[_0x46cb('0x52')]}})[_0x46cb('0x40')](function(_0x3dabed){_0x4a1517=_0x3dabed;return db[_0x46cb('0x53')][_0x46cb('0x54')]({'where':{'id':0x1},'attributes':[_0x46cb('0x55'),'blockDuration'],'raw':!![]});})['then'](function(_0x4ed12c){if(!_0x4a1517||!_[_0x46cb('0x56')](_0x4a1517[_0x46cb('0x57')],_0x3ba467[_0x46cb('0x58')])){return _0x12e01e[_0x46cb('0x4d')](0x191)[_0x46cb('0x4a')]({'message':_0x46cb('0x59')});}if(_0x4a1517['disabled']){return _0x12e01e[_0x46cb('0x4d')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}if(_0x4a1517[_0x46cb('0x5a')]){if(_0x4ed12c['blockDuration']>0x0){if(moment(_0x4a1517['blockedAt'])[_0x46cb('0x5b')](_0x4ed12c['blockDuration'],'minutes')>moment()){return _0x12e01e[_0x46cb('0x4d')](0x191)[_0x46cb('0x4a')]({'message':_0x46cb('0x5c')});}}else{return _0x12e01e[_0x46cb('0x4d')](0x191)[_0x46cb('0x4a')]({'message':_0x46cb('0x5c')});}}_0x2b846a[_0x46cb('0x3c')]={'id':_0x4a1517['id']};_0x4620ef();});})['catch'](function(){return _0x12e01e[_0x46cb('0x4d')](0x191)['json']({'message':_0x46cb('0x5c')});});}catch(_0x58e8fe){_0x4620ef(_0x58e8fe);}}else if(_0x378dc7){_0x4620ef();}else{return _0x12e01e[_0x46cb('0x4d')](0x193)[_0x46cb('0x4a')]({'message':_0x46cb('0x4e')});}})['use'](function(_0x43b5d2,_0x440a89,_0x4d24b6){if(_0x43b5d2[_0x46cb('0x3c')]){db[_0x46cb('0x47')][_0x46cb('0x48')]({'where':{'id':_0x43b5d2[_0x46cb('0x3c')]['id']},'attributes':userAttributes})[_0x46cb('0x40')](function(_0x524558){if(!_0x524558){return _0x440a89['status'](0x194)[_0x46cb('0x4a')]({'message':'User\x20not\x20found.'});}_0x43b5d2[_0x46cb('0x3c')]=_0x524558;_0x4d24b6();})[_0x46cb('0x44')](function(_0x563e9b){_0x4d24b6(_0x563e9b);});}else if(_0x378dc7){_0x4d24b6();}else{return _0x440a89[_0x46cb('0x4d')](0x194)[_0x46cb('0x4a')]({'message':_0x46cb('0x5d')});}});};exports['canUpdate']=function canUpdate(){return compose()['use'](function(_0x5cbdad,_0x57fedd,_0x2da047){return licenseUtil[_0x46cb('0x5e')]()[_0x46cb('0x40')](function(_0x58eb69){if(_0x58eb69[_0x46cb('0x5f')]){_0x2da047();}else{return _0x57fedd['status'](0x193)['json']({'message':_0x46cb('0x60')});}})[_0x46cb('0x44')](function(_0x5203bf){_0x2da047(_0x5203bf);});});};exports[_0x46cb('0x61')]=function isWebrtcLicence(){return compose()[_0x46cb('0x3b')](function(_0x12f31e,_0x22fbbd,_0x189809){return licenseUtil[_0x46cb('0x5e')]()[_0x46cb('0x40')](function(_0x535a68){if(_0x535a68['webrtc']){_0x189809();}else{return _0x22fbbd[_0x46cb('0x4d')](0x193)['json']({'message':_0x46cb('0x60')});}})[_0x46cb('0x44')](function(_0x1e3f80){_0x189809(_0x1e3f80);});});};exports['isMiddleware']=function(_0x37163b,_0x5c1665,_0x5c02c9){_0x37163b[_0x46cb('0x62')]=!![];return _0x5c02c9();};exports[_0x46cb('0x63')]=function signToken(_0x2c96b7){return signJwt(_0x2c96b7);};exports[_0x46cb('0x64')]=function(_0x1b2072,_0x26adb4){if(!_0x1b2072[_0x46cb('0x3c')]){return _0x26adb4['status'](0x194)['json']({'message':_0x46cb('0x65')});}var _0x12bb44={'payload':{'id':_0x1b2072['user']['id'],'role':_0x1b2072[_0x46cb('0x3c')][_0x46cb('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x12bb44)[_0x46cb('0x40')](function(_0x3b8ae1){_0x26adb4[_0x46cb('0x66')]('motion.token',_0x3b8ae1);_0x26adb4[_0x46cb('0x67')](_0x46cb('0x68'));})[_0x46cb('0x44')](function(_0x52d1a7){return _0x26adb4[_0x46cb('0x4d')](0x1f4)['send'](_0x52d1a7);});};exports['retrieveApiKey']=function(_0x1e46cc){if(_[_0x46cb('0x69')](_0x1e46cc[_0x46cb('0x57')])||_[_0x46cb('0x69')](_0x1e46cc[_0x46cb('0x6a')])){return null;}else{return createJwt(_0x1e46cc);}};exports['generateApiKey']=function(_0x30d3a6){_0x30d3a6[_0x46cb('0x57')]=generateNonce();_0x30d3a6['apiKeyIat']=generateIssuedAt();return createJwt(_0x30d3a6);};exports['regenerateApiKey']=function(_0x1230db,_0xfccf57){var _0x108e57=_0x1230db['query'][_0x46cb('0x50')];if(_0x108e57){var _0x44060a={'nonce':_0xfccf57[_0x46cb('0x57')],'iat':_0xfccf57[_0x46cb('0x6a')],'audience':hardwareConf[_0x46cb('0x51')](),'issuer':hardwareConf[_0x46cb('0x51')]()};return verifyJwt(_0x108e57,_0x44060a)[_0x46cb('0x40')](function(){return generateApiKey(_0xfccf57);});}else{throw{'message':_0x46cb('0x6b')};}};exports[_0x46cb('0x6c')]=function(_0x5d7466){var _0x23f673=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x23f673['test'](_0x5d7466))throw new db[(_0x46cb('0x6d'))][(_0x46cb('0x6e'))](_0x46cb('0x6f'));return;};exports[_0x46cb('0x70')]=function(_0x532aa2,_0x67fb77,_0x13d25f){var _0xc80b74=encryptor[_0x46cb('0x71')](_0x67fb77)[_0x46cb('0x72')](',');for(var _0x28ebe2=0x0;_0x28ebe2<_0x13d25f;_0x28ebe2++){if(!_0xc80b74[_0x28ebe2])break;if(_0x532aa2[_0x46cb('0x73')]()===_0xc80b74[_0x28ebe2][_0x46cb('0x73')]()){var _0x57c29b=util['format']('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x13d25f);if(_0x13d25f===0x1){_0x57c29b='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0x46cb('0x6d'))][(_0x46cb('0x6e'))](_0x57c29b);}}return;};exports['updatePasswordsHistory']=function(_0x429b39,_0xfa28a8){var _0x10c3f9=_0xfa28a8?encryptor['decryptString'](_0xfa28a8)['split'](','):[];if(_0x10c3f9[_0x46cb('0x74')]===0x5){_0x10c3f9['splice'](-0x1,0x1);}_0x10c3f9[_0x46cb('0x75')](_0x429b39);return encryptor[_0x46cb('0x76')](_0x10c3f9[_0x46cb('0x77')](','));};function signJwt(_0xdd2480){var _0x47455d=BPromise[_0x46cb('0x78')](jwt[_0x46cb('0x79')],{'context':jwt});var _0x1ba8c0=_0xdd2480[_0x46cb('0x7a')]||config[_0x46cb('0xb')][_0x46cb('0xc')];return new BPromise(function(_0x472bb2,_0xc4b991){_0x47455d(_0xdd2480['payload'],_0x1ba8c0,_0xdd2480[_0x46cb('0x7b')])['then'](function(_0x3be7b4){_0x472bb2(_0x3be7b4);})[_0x46cb('0x44')](function(_0x3f2936){_0xc4b991(_0x3f2936);});});}function verifyJwt(_0x19ff4f,_0x4f02e9,_0x3dc4bd){var _0x656601=BPromise['promisify'](jwt[_0x46cb('0x7c')],{'context':jwt});var _0x1b5a00=_0x3dc4bd||config[_0x46cb('0xb')][_0x46cb('0xc')];return new BPromise(function(_0x4f65f9,_0x11184e){_0x656601(_0x19ff4f,_0x1b5a00,_0x4f02e9)[_0x46cb('0x40')](function(_0x6dc790){_0x4f65f9(_0x6dc790);})[_0x46cb('0x44')](function(_0x442243){_0x11184e(_0x442243);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x46cb('0x7d')](_0x46cb('0x7e'));}function generateIssuedAt(){return Math[_0x46cb('0x7f')](Date[_0x46cb('0x80')]()/0x3e8)[_0x46cb('0x7d')]();}function createJwt(_0x1938e6){var _0xc94cca={'payload':{'iat':_0x1938e6[_0x46cb('0x6a')],'nonce':_0x1938e6['apiKeyNonce']},'options':{'algorithm':'HS512','subject':_0x1938e6['id']['toString'](),'issuer':hardwareConf[_0x46cb('0x51')](),'audience':hardwareConf[_0x46cb('0x51')]()}};return signJwt(_0xc94cca)[_0x46cb('0x40')](function(_0xd2ab18){return{'iat':_0x1938e6[_0x46cb('0x6a')],'nonce':_0x1938e6[_0x46cb('0x57')],'token':_0xd2ab18};});} \ No newline at end of file +var _0x8603=['moment','secrets','session','role','email','userpic','md5secret','voicePause','mailPause','faxPause','openchannelPause','pauseType','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','disposition','closed','status','unmanaged','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','Basic','find','then','authenticate','pass','Wrong\x20credentials.','Bearer','json','Unknown\x20authorization\x20format','query','getUuid','apikey','sub','allowedLoginAttempts','blockDuration','isEqual','nonce','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','minutes','User','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','isWebrtcLicence','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','/dashboards/general','send','retrieveApiKey','isNil','apiKeyNonce','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','test','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','format','length','splice','promisify','payload','options','verify','randomBytes','toString','hex','floor','HS512','../../config/environment','../../config/license/hardware','../../config/license/util','jsonwebtoken','express-jwt','composable-middleware','crypto','util'];(function(_0x353df7,_0x2bea6a){var _0x4cce74=function(_0x156ed3){while(--_0x156ed3){_0x353df7['push'](_0x353df7['shift']());}};_0x4cce74(++_0x2bea6a);}(_0x8603,0x190));var _0x3860=function(_0x1bbdc0,_0x1d9d11){_0x1bbdc0=_0x1bbdc0-0x0;var _0x5da71c=_0x8603[_0x1bbdc0];return _0x5da71c;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x3860('0x0'));var hardwareConf=require(_0x3860('0x1'));var licenseUtil=require(_0x3860('0x2'));var encryptor=require('../encryptor');var _=require('lodash');var jwt=require(_0x3860('0x3'));var expressJwt=require(_0x3860('0x4'));var compose=require(_0x3860('0x5'));var basicAuth=require('basic-auth');var crypto=require(_0x3860('0x6'));var BPromise=require('bluebird');var util=require(_0x3860('0x7'));var moment=require(_0x3860('0x8'));var validateJwt=expressJwt({'secret':config[_0x3860('0x9')][_0x3860('0xa')]});var userAttributes=['id',_0x3860('0xb'),'fullname','name','internal',_0x3860('0xc'),_0x3860('0xd'),'permissions',_0x3860('0xe'),_0x3860('0xf'),'chatPause',_0x3860('0x10'),_0x3860('0x11'),'smsPause',_0x3860('0x12'),_0x3860('0x13'),'showWebBar',_0x3860('0x14'),_0x3860('0x15'),_0x3860('0x16'),_0x3860('0x17'),_0x3860('0x18'),_0x3860('0x19'),_0x3860('0x1a'),_0x3860('0x1b'),_0x3860('0x1c'),_0x3860('0x1d'),'phoneBarEnableDtmfTone',_0x3860('0x1e'),_0x3860('0x1f'),_0x3860('0x20'),_0x3860('0x21'),_0x3860('0x22'),_0x3860('0x23'),_0x3860('0x24'),_0x3860('0x25'),_0x3860('0x26'),_0x3860('0x27'),_0x3860('0x28'),_0x3860('0x29'),'downloadOmnichannelInteractions','downloadAttachments',_0x3860('0x2a'),_0x3860('0x2b'),_0x3860('0x2c'),'chatAutoanswerDelay',_0x3860('0x2d'),_0x3860('0x2e'),_0x3860('0x2f'),_0x3860('0x30'),_0x3860('0x31'),_0x3860('0x32'),_0x3860('0x33'),_0x3860('0x34'),_0x3860('0x35'),_0x3860('0x36'),_0x3860('0x37')];exports[_0x3860('0x38')]=function(){return this[_0x3860('0x39')](!![])[_0x3860('0x3a')](function(_0xd33a51,_0x564efd,_0xfc10a5){if(_0xd33a51[_0x3860('0x3b')]){_0xfc10a5();}else{return db[_0x3860('0x3c')][_0x3860('0x3d')]({'where':{'id':_0xd33a51[_0x3860('0x3e')]['id']},'attributes':['id','closed',_0x3860('0x3f')],'raw':!![]})['then'](function(_0x577750){if(_0x577750&&_0x577750[_0x3860('0x40')]){return _0x564efd[_0x3860('0x41')](_0x577750['disposition']==='unmanaged'?0x195:0x193)['json']({'message':_0x577750[_0x3860('0x3f')]===_0x3860('0x42')?_0x3860('0x43'):_0x3860('0x44')});}else{_0xfc10a5();}})[_0x3860('0x45')](function(_0x228d34){_0xfc10a5(_0x228d34);});}});};exports['isAuthenticated']=function isAuthenticated(_0x4c4314){return compose()[_0x3860('0x3a')](function(_0x1f1809,_0x5a9af2,_0x2551f4){var _0x3d5143;if(_0x1f1809[_0x3860('0x46')][_0x3860('0x47')]){if(_[_0x3860('0x48')](_0x1f1809['headers'][_0x3860('0x47')],_0x3860('0x49'))){var _0x367b14=basicAuth(_0x1f1809);db['User'][_0x3860('0x4a')]({'where':{'name':_0x367b14['name']}})[_0x3860('0x4b')](function(_0x4825f0){if(!_0x4825f0||!_0x4825f0[_0x3860('0x4c')](_0x367b14[_0x3860('0x4d')])){return _0x5a9af2[_0x3860('0x41')](0x191)['json']({'message':_0x3860('0x4e')});}_0x1f1809[_0x3860('0x3b')]={'id':_0x4825f0['id']};_0x2551f4();})['catch'](function(_0x1c94cc){_0x2551f4(_0x1c94cc);});}else if(_['startsWith'](_0x1f1809[_0x3860('0x46')][_0x3860('0x47')],_0x3860('0x4f'))){validateJwt(_0x1f1809,_0x5a9af2,_0x2551f4);}else{if(_0x4c4314){_0x2551f4();}else{return _0x5a9af2[_0x3860('0x41')](0x193)[_0x3860('0x50')]({'message':_0x3860('0x51')});}}}else if(_0x1f1809[_0x3860('0x52')]['apikey']){try{var _0x1a48b6={'audience':hardwareConf[_0x3860('0x53')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x1f1809[_0x3860('0x52')][_0x3860('0x54')],_0x1a48b6)[_0x3860('0x4b')](function(_0x5af661){return db['User'][_0x3860('0x4a')]({'where':{'id':_0x5af661[_0x3860('0x55')]}})[_0x3860('0x4b')](function(_0xa921ed){_0x3d5143=_0xa921ed;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0x3860('0x56'),_0x3860('0x57')],'raw':!![]});})[_0x3860('0x4b')](function(_0x1fa847){if(!_0x3d5143||!_[_0x3860('0x58')](_0x3d5143['apiKeyNonce'],_0x5af661[_0x3860('0x59')])){return _0x5a9af2[_0x3860('0x41')](0x191)['json']({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x3d5143[_0x3860('0x5a')]){return _0x5a9af2[_0x3860('0x41')](0x191)[_0x3860('0x50')]({'message':_0x3860('0x5b')});}if(_0x3d5143[_0x3860('0x5c')]){if(_0x1fa847['blockDuration']>0x0){if(moment(_0x3d5143[_0x3860('0x5d')])['add'](_0x1fa847[_0x3860('0x57')],_0x3860('0x5e'))>moment()){return _0x5a9af2['status'](0x191)[_0x3860('0x50')]({'message':_0x3860('0x5b')});}}else{return _0x5a9af2['status'](0x191)[_0x3860('0x50')]({'message':_0x3860('0x5b')});}}_0x1f1809[_0x3860('0x3b')]={'id':_0x3d5143['id']};_0x2551f4();});})[_0x3860('0x45')](function(){return _0x5a9af2['status'](0x191)[_0x3860('0x50')]({'message':_0x3860('0x5b')});});}catch(_0xd3896f){_0x2551f4(_0xd3896f);}}else if(_0x4c4314){_0x2551f4();}else{return _0x5a9af2['status'](0x193)[_0x3860('0x50')]({'message':'Unknown\x20authorization\x20format'});}})[_0x3860('0x3a')](function(_0x424801,_0x405bfc,_0x3f613f){if(_0x424801[_0x3860('0x3b')]){db[_0x3860('0x5f')]['find']({'where':{'id':_0x424801[_0x3860('0x3b')]['id']},'attributes':userAttributes})[_0x3860('0x4b')](function(_0x5dc78f){if(!_0x5dc78f){return _0x405bfc['status'](0x194)[_0x3860('0x50')]({'message':_0x3860('0x60')});}_0x424801['user']=_0x5dc78f;_0x3f613f();})[_0x3860('0x45')](function(_0x30d8eb){_0x3f613f(_0x30d8eb);});}else if(_0x4c4314){_0x3f613f();}else{return _0x405bfc['status'](0x194)[_0x3860('0x50')]({'message':_0x3860('0x61')});}});};exports[_0x3860('0x62')]=function canUpdate(){return compose()[_0x3860('0x3a')](function(_0x14f5b2,_0x3fa282,_0x3c06e7){return licenseUtil[_0x3860('0x63')]()[_0x3860('0x4b')](function(_0x6feca3){if(_0x6feca3[_0x3860('0x64')]){_0x3c06e7();}else{return _0x3fa282[_0x3860('0x41')](0x193)[_0x3860('0x50')]({'message':'Forbidden'});}})[_0x3860('0x45')](function(_0x516f88){_0x3c06e7(_0x516f88);});});};exports[_0x3860('0x65')]=function isWebrtcLicence(){return compose()[_0x3860('0x3a')](function(_0x202c92,_0xbad34b,_0x39e2cb){return licenseUtil[_0x3860('0x63')]()[_0x3860('0x4b')](function(_0x27ef92){if(_0x27ef92['webrtc']){_0x39e2cb();}else{return _0xbad34b[_0x3860('0x41')](0x193)[_0x3860('0x50')]({'message':_0x3860('0x66')});}})['catch'](function(_0x9b8ab0){_0x39e2cb(_0x9b8ab0);});});};exports[_0x3860('0x67')]=function(_0x188883,_0x3dc957,_0x5ed2db){_0x188883['isMiddleware']=!![];return _0x5ed2db();};exports[_0x3860('0x68')]=function signToken(_0x480a08){return signJwt(_0x480a08);};exports[_0x3860('0x69')]=function(_0x4226da,_0x410dab){if(!_0x4226da['user']){return _0x410dab[_0x3860('0x41')](0x194)['json']({'message':_0x3860('0x6a')});}var _0x517fe6={'payload':{'id':_0x4226da[_0x3860('0x3b')]['id'],'role':_0x4226da[_0x3860('0x3b')][_0x3860('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x517fe6)['then'](function(_0x4876ab){_0x410dab[_0x3860('0x6b')](_0x3860('0x6c'),_0x4876ab);_0x410dab['redirect'](_0x3860('0x6d'));})['catch'](function(_0x3b3bfe){return _0x410dab[_0x3860('0x41')](0x1f4)[_0x3860('0x6e')](_0x3b3bfe);});};exports[_0x3860('0x6f')]=function(_0x426497){if(_[_0x3860('0x70')](_0x426497[_0x3860('0x71')])||_['isNil'](_0x426497[_0x3860('0x72')])){return null;}else{return createJwt(_0x426497);}};exports[_0x3860('0x73')]=function(_0x3367ce){_0x3367ce[_0x3860('0x71')]=generateNonce();_0x3367ce[_0x3860('0x72')]=generateIssuedAt();return createJwt(_0x3367ce);};exports[_0x3860('0x74')]=function(_0x47ff99,_0x2cf48c){var _0x3ed276=_0x47ff99[_0x3860('0x52')][_0x3860('0x54')];if(_0x3ed276){var _0x3a55e7={'nonce':_0x2cf48c[_0x3860('0x71')],'iat':_0x2cf48c[_0x3860('0x72')],'audience':hardwareConf[_0x3860('0x53')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x3ed276,_0x3a55e7)[_0x3860('0x4b')](function(){return generateApiKey(_0x2cf48c);});}else{throw{'message':_0x3860('0x75')};}};exports['validatePasswordPattern']=function(_0x1fe680){var _0x275df2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x275df2[_0x3860('0x76')](_0x1fe680))throw new db['Sequelize'][(_0x3860('0x77'))]('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[_0x3860('0x78')]=function(_0x214a19,_0x13b978,_0x2cc119){var _0x27a853=encryptor[_0x3860('0x79')](_0x13b978)[_0x3860('0x7a')](',');for(var _0x2c7218=0x0;_0x2c7218<_0x2cc119;_0x2c7218++){if(!_0x27a853[_0x2c7218])break;if(_0x214a19[_0x3860('0x7b')]()===_0x27a853[_0x2c7218][_0x3860('0x7b')]()){var _0x3ba9a1=util[_0x3860('0x7c')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x2cc119);if(_0x2cc119===0x1){_0x3ba9a1='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db['Sequelize'][(_0x3860('0x77'))](_0x3ba9a1);}}return;};exports['updatePasswordsHistory']=function(_0x5a2c1c,_0xc2bd40){var _0x412e0f=_0xc2bd40?encryptor[_0x3860('0x79')](_0xc2bd40)[_0x3860('0x7a')](','):[];if(_0x412e0f[_0x3860('0x7d')]===0x5){_0x412e0f[_0x3860('0x7e')](-0x1,0x1);}_0x412e0f['unshift'](_0x5a2c1c);return encryptor['encryptString'](_0x412e0f['join'](','));};function signJwt(_0x1d6c70){var _0x1c1da4=BPromise[_0x3860('0x7f')](jwt['sign'],{'context':jwt});var _0xf875e4=_0x1d6c70['secret']||config[_0x3860('0x9')][_0x3860('0xa')];return new BPromise(function(_0x5176ff,_0x3345e1){_0x1c1da4(_0x1d6c70[_0x3860('0x80')],_0xf875e4,_0x1d6c70[_0x3860('0x81')])[_0x3860('0x4b')](function(_0x4c5c97){_0x5176ff(_0x4c5c97);})[_0x3860('0x45')](function(_0x38a52f){_0x3345e1(_0x38a52f);});});}function verifyJwt(_0x17f248,_0x508208,_0x552fdc){var _0x26e54b=BPromise[_0x3860('0x7f')](jwt[_0x3860('0x82')],{'context':jwt});var _0x1ca0e7=_0x552fdc||config[_0x3860('0x9')][_0x3860('0xa')];return new BPromise(function(_0x5d0210,_0x2d916a){_0x26e54b(_0x17f248,_0x1ca0e7,_0x508208)[_0x3860('0x4b')](function(_0x5db8f9){_0x5d0210(_0x5db8f9);})[_0x3860('0x45')](function(_0x2afdde){_0x2d916a(_0x2afdde);});});}function generateNonce(){return crypto[_0x3860('0x83')](0x10)[_0x3860('0x84')](_0x3860('0x85'));}function generateIssuedAt(){return Math[_0x3860('0x86')](Date['now']()/0x3e8)[_0x3860('0x84')]();}function createJwt(_0x2aa239){var _0x2aa22f={'payload':{'iat':_0x2aa239[_0x3860('0x72')],'nonce':_0x2aa239[_0x3860('0x71')]},'options':{'algorithm':_0x3860('0x87'),'subject':_0x2aa239['id']['toString'](),'issuer':hardwareConf[_0x3860('0x53')](),'audience':hardwareConf[_0x3860('0x53')]()}};return signJwt(_0x2aa22f)[_0x3860('0x4b')](function(_0x5ebf70){return{'iat':_0x2aa239['apiKeyIat'],'nonce':_0x2aa239[_0x3860('0x71')],'token':_0x5ebf70};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 6c37f24..25645a6 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 _0x0d0f=['../../mysqldb','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','default','where','user','clause','tags','checkListsRestrictions','ids','tag','countFilteredContacts','count','buildContactsQuery','getFilteredContacts','rows','catch','describe','keys','filter','map','CmCustomField','findOne','slice','all','cf_','type','./sql-utils'];(function(_0x5a715e,_0x5551e7){var _0x25d0f1=function(_0x314a8c){while(--_0x314a8c){_0x5a715e['push'](_0x5a715e['shift']());}};_0x25d0f1(++_0x5551e7);}(_0x0d0f,0x192));var _0xf0d0=function(_0x864853,_0x1b7287){_0x864853=_0x864853-0x0;var _0x2d1509=_0x0d0f[_0x864853];return _0x2d1509;};'use strict';var _=require('lodash');var sqlUtils=require(_0xf0d0('0x0'));var db=require(_0xf0d0('0x1'))['db'];exports['findAll']=function(_0x130133,_0x2e9666,_0x443cfc,_0x4e65b1){var _0x3368f0={'count':0x0,'rows':[]};var _0x427a7c=sqlUtils['skipContactsQuery'](_0x2e9666,_0x130133);if(_0x427a7c){return Promise[_0xf0d0('0x2')](_0x3368f0);}var _0x3e6e6c=sqlUtils[_0xf0d0('0x3')]();var _0x208798={};var _0x3b68c2=![];var _0x5316f5=![];return Promise[_0xf0d0('0x2')]()[_0xf0d0('0x4')](function(){if(_0x130133[_0xf0d0('0x5')]){return sqlUtils[_0xf0d0('0x6')](_0x130133[_0xf0d0('0x5')],_0x4e65b1);}else{return sqlUtils['parseQueryParameters'](_0x130133,_0x4e65b1);}})['then'](function(_0x1bc795){_0x3e6e6c['where'](_0x1bc795[_0xf0d0('0x7')]);_0x3e6e6c[_0xf0d0('0x8')](_0x1bc795['fields']);_0x3e6e6c['where'](_0x1bc795['filter']);_0x3e6e6c[_0xf0d0('0x8')](_0x1bc795[_0xf0d0('0x9')][_0xf0d0('0xa')]);_0x208798=_0x1bc795[_0xf0d0('0xb')];_0x5316f5=_0x1bc795[_0xf0d0('0x9')]['skip'];return sqlUtils[_0xf0d0('0xc')](_0x2e9666,_0x130133,_0x5316f5);})[_0xf0d0('0x4')](function(_0x4e6662){_0x3e6e6c[_0xf0d0('0x8')](_0x4e6662);var _0x6ad1e=_0x130133[_0xf0d0('0x5')]?_0x208798[_0xf0d0('0xd')]:_0x130133[_0xf0d0('0xe')];_0x3b68c2=_0x6ad1e?!![]:![];return sqlUtils[_0xf0d0('0xf')](_0x3e6e6c,_0x6ad1e);})[_0xf0d0('0x4')](function(_0x4b881a){_0x3368f0[_0xf0d0('0x10')]=_0x4b881a;if(_0x3368f0[_0xf0d0('0x10')]===0x0){return;}if(_0x130133['User']){_0x5316f5=!![];}return sqlUtils[_0xf0d0('0x11')](_0x3e6e6c,_0x130133['fields'],_0x443cfc,_0x3b68c2,_0x208798[_0xf0d0('0xa')],_0x5316f5);})['then'](function(_0x48be5e){if(!_0x48be5e){return[];}return sqlUtils[_0xf0d0('0x12')](_0x48be5e,_0x130133,_0x443cfc);})[_0xf0d0('0x4')](function(_0x278e0c){_0x3368f0[_0xf0d0('0x13')]=_0x278e0c;return _0x3368f0;})[_0xf0d0('0x14')](function(_0x156f87){throw _0x156f87;});};exports['describe']=function(){var _0x106b60={};var _0x4ca96f=[];return db['CmContact'][_0xf0d0('0x15')]()[_0xf0d0('0x4')](function(_0x5f58d0){_0x106b60=_0x5f58d0;var _0x178173=Object[_0xf0d0('0x16')](_0x106b60)[_0xf0d0('0x17')](function(_0x25085a){return _['startsWith'](_0x25085a,'cf_')?_0x25085a:undefined;});var _0x579984=_0x178173[_0xf0d0('0x18')](function(_0x44bffa){return db[_0xf0d0('0x19')][_0xf0d0('0x1a')]({'where':{'id':_0x44bffa[_0xf0d0('0x1b')](0x3)},'raw':!![]});});return Promise[_0xf0d0('0x1c')](_0x579984);})[_0xf0d0('0x4')](function(_0x19dd38){for(var _0x509c3c=0x0;_0x509c3c<_0x19dd38['length'];_0x509c3c++){if(_0x19dd38[_0x509c3c]){var _0x1c23f4=_0xf0d0('0x1d')+_0x19dd38[_0x509c3c]['id'];_0x106b60[_0x1c23f4]['fieldType']=_0x19dd38[_0x509c3c][_0xf0d0('0x1e')];}}_0x4ca96f=_[_0xf0d0('0x18')](Object['keys'](_0x106b60),function(_0x16f670){return{'name':_0x16f670,'type':_0x106b60[_0x16f670][_0xf0d0('0x1e')]};});return _0x4ca96f;})['catch'](function(_0x25b0a9){throw _0x25b0a9;});}; \ No newline at end of file +var _0x706d=['clause','getFilteredContacts','catch','describe','CmContact','keys','startsWith','cf_','map','CmCustomField','findOne','slice','all','length','fieldType','type','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters','default','where','fields','filter','tags','user','ids','tag','countFilteredContacts','count','buildContactsQuery'];(function(_0x28a5ad,_0x520afa){var _0x176b8a=function(_0x3d71b){while(--_0x3d71b){_0x28a5ad['push'](_0x28a5ad['shift']());}};_0x176b8a(++_0x520afa);}(_0x706d,0x7c));var _0xd706=function(_0x282e8c,_0x1db8cf){_0x282e8c=_0x282e8c-0x0;var _0x48095f=_0x706d[_0x282e8c];return _0x48095f;};'use strict';var _=require('lodash');var sqlUtils=require('./sql-utils');var db=require(_0xd706('0x0'))['db'];exports[_0xd706('0x1')]=function(_0x20795f,_0x207021,_0x3605ba,_0x220c18){var _0x42a9ad={'count':0x0,'rows':[]};var _0x48fbb2=sqlUtils[_0xd706('0x2')](_0x207021,_0x20795f);if(_0x48fbb2){return Promise[_0xd706('0x3')](_0x42a9ad);}var _0x3868c0=sqlUtils[_0xd706('0x4')]();var _0x256082={};var _0x12cb0c=![];var _0x525e40=![];return Promise['resolve']()[_0xd706('0x5')](function(){if(_0x20795f[_0xd706('0x6')]){return sqlUtils[_0xd706('0x7')](_0x20795f[_0xd706('0x6')],_0x220c18);}else{return sqlUtils[_0xd706('0x8')](_0x20795f,_0x220c18);}})[_0xd706('0x5')](function(_0x4bd032){_0x3868c0['where'](_0x4bd032[_0xd706('0x9')]);_0x3868c0[_0xd706('0xa')](_0x4bd032[_0xd706('0xb')]);_0x3868c0[_0xd706('0xa')](_0x4bd032[_0xd706('0xc')]);_0x3868c0[_0xd706('0xa')](_0x4bd032['user']['clause']);_0x256082=_0x4bd032[_0xd706('0xd')];_0x525e40=_0x4bd032[_0xd706('0xe')]['skip'];return sqlUtils['checkListsRestrictions'](_0x207021,_0x20795f,_0x525e40);})['then'](function(_0x393290){_0x3868c0[_0xd706('0xa')](_0x393290);var _0xc63a87=_0x20795f['search']?_0x256082[_0xd706('0xf')]:_0x20795f[_0xd706('0x10')];_0x12cb0c=_0xc63a87?!![]:![];return sqlUtils[_0xd706('0x11')](_0x3868c0,_0xc63a87);})[_0xd706('0x5')](function(_0x4df5ec){_0x42a9ad['count']=_0x4df5ec;if(_0x42a9ad[_0xd706('0x12')]===0x0){return;}if(_0x20795f['User']){_0x525e40=!![];}return sqlUtils[_0xd706('0x13')](_0x3868c0,_0x20795f[_0xd706('0xb')],_0x3605ba,_0x12cb0c,_0x256082[_0xd706('0x14')],_0x525e40);})[_0xd706('0x5')](function(_0x419708){if(!_0x419708){return[];}return sqlUtils[_0xd706('0x15')](_0x419708,_0x20795f,_0x3605ba);})['then'](function(_0x167b44){_0x42a9ad['rows']=_0x167b44;return _0x42a9ad;})[_0xd706('0x16')](function(_0x1177fc){throw _0x1177fc;});};exports[_0xd706('0x17')]=function(){var _0x4c596d={};var _0x15901a=[];return db[_0xd706('0x18')]['describe']()[_0xd706('0x5')](function(_0x22dbe5){_0x4c596d=_0x22dbe5;var _0x2de2cb=Object[_0xd706('0x19')](_0x4c596d)['filter'](function(_0x58be6d){return _[_0xd706('0x1a')](_0x58be6d,_0xd706('0x1b'))?_0x58be6d:undefined;});var _0x504d9f=_0x2de2cb[_0xd706('0x1c')](function(_0x2c1f0b){return db[_0xd706('0x1d')][_0xd706('0x1e')]({'where':{'id':_0x2c1f0b[_0xd706('0x1f')](0x3)},'raw':!![]});});return Promise[_0xd706('0x20')](_0x504d9f);})[_0xd706('0x5')](function(_0x2936f2){for(var _0x163713=0x0;_0x163713<_0x2936f2[_0xd706('0x21')];_0x163713++){if(_0x2936f2[_0x163713]){var _0x3e4cfd='cf_'+_0x2936f2[_0x163713]['id'];_0x4c596d[_0x3e4cfd][_0xd706('0x22')]=_0x2936f2[_0x163713][_0xd706('0x23')];}}_0x15901a=_[_0xd706('0x1c')](Object[_0xd706('0x19')](_0x4c596d),function(_0x22bdfd){return{'name':_0x22bdfd,'type':_0x4c596d[_0x22bdfd][_0xd706('0x23')]};});return _0x15901a;})['catch'](function(_0x430fab){throw _0x430fab;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index c424bb5..d086047 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 _0x106e=['tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','phone','mobile','fax','CompanyId','updatedAt','deletedAt','TagIds','forEach','GROUP_CONCAT(DISTINCT\x20t.id)','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.email\x20LIKE\x20?','parseSearch','sqlOperator','find','name','dateOfBirth','fieldType','castTo','DATE','type','value','start','Tag','split','map','tags','clause','and','ids','User','user','uc.UserId\x20=\x20?','skip','keys','some','compact','Contact','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','then','fields','filter','resolve','c.ListId\x20IS\x20NULL','c.id','limit','offset','subqry.id','having','order','DESC','subqry.','findAll','keyBy','QueryTypes','SELECT','CmContact','sequelize','toString','Tags','push','clone','group','where','t.id\x20IN\x20?','Sequelize','query','exports','lodash','../parsers/qs','../interaction/utils','role','agent','search','select','cm_contacts','subqry','left_join','uc.CmContactId\x20=\x20','cm_contact_has_tags','ct.CmContactId\x20=\x20','.id'];(function(_0x4d519a,_0x3f4429){var _0x467964=function(_0x3c94cd){while(--_0x3c94cd){_0x4d519a['push'](_0x4d519a['shift']());}};_0x467964(++_0x3f4429);}(_0x106e,0x11e));var _0xe106=function(_0x4cfdd3,_0x315e71){_0x4cfdd3=_0x4cfdd3-0x0;var _0x54edd5=_0x106e[_0x4cfdd3];return _0x54edd5;};'use strict';var _=require(_0xe106('0x0'));var squel=require('squel');var as=require('../parsers/advancedSearch');var qs=require(_0xe106('0x1'));var utils=require(_0xe106('0x2'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x2c3df7,_0x95e156){var _0x32afa2=![];if(_0x2c3df7[_0xe106('0x3')]===_0xe106('0x4')&&!_0x95e156[_0xe106('0x5')]&&!_0x95e156['ListId']&&_0x95e156['autocomplete']!=='true'){_0x32afa2=!![];}return _0x32afa2;}function getContactsSubquery(){return squel[_0xe106('0x6')]()['from'](_0xe106('0x7'),'c')['where']('c.deletedAt\x20IS\x20NULL');}function applyJoinClauses(_0x4b9fc7,_0x339a80){var _0x54c11a=_0x339a80?'c':_0xe106('0x8');_0x4b9fc7[_0xe106('0x9')]('cm_user_has_contacts','uc',_0xe106('0xa')+_0x54c11a+'.id')[_0xe106('0x9')](_0xe106('0xb'),'ct',_0xe106('0xc')+_0x54c11a+_0xe106('0xd'))['left_join'](_0xe106('0xe'),'t',_0xe106('0xf'));return _0x4b9fc7;}function addFieldsToQuery(_0x188f84,_0x3c3d53,_0x15c88c,_0x34d5b3,_0x856a6d){var _0x5cf75d=_0x856a6d?'c':'subqry';if(!_0x3c3d53){_0x3c3d53=['id',_0xe106('0x10'),_0xe106('0x11'),_0xe106('0x12'),_0xe106('0x13'),_0xe106('0x14'),'email','ListId',_0xe106('0x15'),'createdAt',_0xe106('0x16'),_0xe106('0x17'),_0xe106('0x18')];}else if(!_0x3c3d53['includes']('id')){_0x3c3d53['push']('id');}var _0x4e30d0=_0x15c88c&&_0x856a6d||!_0x15c88c&&!_0x856a6d;if(_0x34d5b3){_0x4e30d0=_0x34d5b3&&_0x856a6d||!_0x34d5b3&&!_0x856a6d;}_0x3c3d53[_0xe106('0x19')](function(_0x2338cd){if(_0x2338cd===_0xe106('0x18')){if(_0x4e30d0){_0x188f84['field'](_0xe106('0x1a'),_0x2338cd);}else if(_0x15c88c||_0x34d5b3){_0x188f84[_0xe106('0x1b')](_0x5cf75d+'.'+_0x2338cd);}}else{_0x188f84[_0xe106('0x1b')](_0x5cf75d+'.'+_0x2338cd);}});return _0x188f84;}function getSqlClauses(){var _0x1df647={'default':squel[_0xe106('0x1c')](),'fields':squel['expr'](),'filter':squel[_0xe106('0x1c')](),'tags':{'clause':squel[_0xe106('0x1c')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x1df647;}function parseTagParameter(_0x1bb2da){var _0x4ad94f=squel[_0xe106('0x1c')]();if(_0x1bb2da){var _0x3026a0=utils[_0xe106('0x1d')](_0x1bb2da);_0x3026a0[_0xe106('0x19')](function(_0x18d329){_0x4ad94f['or'](_0xe106('0x1e'),'%,'+_0x18d329+',%');});}return _0x4ad94f;}function parseSearchFilter(_0x11297f){var _0x233087=squel['expr']();if(_0x11297f){var _0x5d51d2=_0x11297f[_0xe106('0x1f')]('\x5c','\x5c\x5c')[_0xe106('0x1f')](/'/g,'\x27\x27');if(_0x5d51d2['split']('\x20')[_0xe106('0x20')]>0x1){_0x233087['or'](_0xe106('0x21'),qs[_0xe106('0x22')](_0x5d51d2,!![]),null);}else{if(qs[_0xe106('0x23')](_0x5d51d2)){_0x233087['or'](_0xe106('0x24'),_0x5d51d2+'%');_0x233087['or'](_0xe106('0x25'),_0x5d51d2+'%');_0x233087['or'](_0xe106('0x26'),_0x5d51d2+'%');_0x233087['or']('c.fax\x20LIKE\x20?',_0x5d51d2+'%');}else if(qs['isEmail'](_0x5d51d2)){_0x233087['or']('c.email\x20LIKE\x20?',_0x5d51d2+'%');}else{_0x233087['or'](_0xe106('0x27'),'%'+_0x5d51d2+'%');_0x233087['or']('c.lastName\x20LIKE\x20?','%'+_0x5d51d2+'%');_0x233087['or'](_0xe106('0x28'),'%'+_0x5d51d2+'%');}}}return _0x233087;}function parseAdvancedSearchFilter(_0x2e9df9,_0x2e37b9){var _0x1dea08=getSqlClauses();var _0x4d74d3=as[_0xe106('0x29')](_0x2e9df9);var _0xecbe24=_0x4d74d3[_0xe106('0x2a')];for(var _0x5152da=0x0;_0x5152da<_0x4d74d3['conditions'][_0xe106('0x20')];_0x5152da++){var _0x7acc72=_0x4d74d3['conditions'][_0x5152da];var _0x5269d7='c';var _0x359df1=_[_0xe106('0x2b')](_0x2e37b9,[_0xe106('0x2c'),_0x7acc72['field']]);if(_0x359df1){if(_0x7acc72['field']===_0xe106('0x2d')||_0x359df1[_0xe106('0x2e')]==='datetime'){_0x7acc72[_0xe106('0x2f')]=_0xe106('0x30');}var _0xc921c6=as['buildExpression'](_0x5269d7,_0x359df1[_0xe106('0x31')],_0x7acc72);_0x1dea08['default'][_0xecbe24](_0xc921c6['text'],_0xc921c6[_0xe106('0x32')][_0xe106('0x33')],_0xc921c6[_0xe106('0x32')]['end']);}else{if(_0x7acc72[_0xe106('0x1b')]===_0xe106('0x34')){var _0x54fb49=_0x7acc72['value'][_0xe106('0x35')](',')[_0xe106('0x36')](function(_0x7ab0e5){return Number(_0x7ab0e5);});var _0xb3290f=parseTagParameter(_0x54fb49);_0x1dea08[_0xe106('0x37')][_0xe106('0x38')][_0xe106('0x39')](_0xb3290f);_0x1dea08[_0xe106('0x37')][_0xe106('0x3a')]=_0x54fb49;}else if(_0x7acc72[_0xe106('0x1b')]===_0xe106('0x3b')){_0x1dea08[_0xe106('0x3c')][_0xe106('0x38')][_0xe106('0x39')](_0xe106('0x3d'),_0x7acc72[_0xe106('0x32')]);_0x1dea08[_0xe106('0x3c')][_0xe106('0x3e')]=!![];}}}return _0x1dea08;}function parseModelFields(_0x1e4a5e,_0x4962b3){var _0x5a4030=squel['expr']();var _0x22da01=_(_0x1e4a5e)[_0xe106('0x3f')]()['map'](function(_0x490801){return _[_0xe106('0x40')](_0x4962b3,['name',_0x490801])?_0x490801:undefined;})[_0xe106('0x41')]()[_0xe106('0x32')]();if(_0x1e4a5e[_0xe106('0x42')]){_0x22da01['push']('Contact');}if(_0x1e4a5e[_0xe106('0x3b')]){_0x22da01['push'](_0xe106('0x3b'));}if(_0x22da01[_0xe106('0x20')]>0x0){_0x22da01[_0xe106('0x19')](function(_0x19ba12){if(_0x19ba12===_0xe106('0x43')){_0x5a4030[_0xe106('0x39')](_0xe106('0x44'),[][_0xe106('0x45')](_0x1e4a5e[_0x19ba12]));}else if(_0x19ba12==='Contact'){var _0x35a901='%'+_0x1e4a5e[_0x19ba12]+'%';_0x5a4030['and'](_0xe106('0x46'),_0x35a901);}else if(_0x19ba12===_0xe106('0x3b')){_0x5a4030[_0xe106('0x39')](_0xe106('0x3d'),_0x1e4a5e[_0x19ba12]);}else{_0x5a4030[_0xe106('0x39')]('c.'+_0x19ba12+'\x20=\x20?',_0x1e4a5e[_0x19ba12]);}});}return _0x5a4030;}function parseQueryParameters(_0x3ac230,_0x4ae983){var _0x3242a4=getSqlClauses();return Promise['resolve']()[_0xe106('0x47')](function(){return parseModelFields(_0x3ac230,_0x4ae983);})[_0xe106('0x47')](function(_0x5af017){_0x3242a4[_0xe106('0x48')][_0xe106('0x39')](_0x5af017);return parseTagParameter(_0x3ac230['tag']);})[_0xe106('0x47')](function(_0x50ff28){_0x3242a4[_0xe106('0x37')][_0xe106('0x38')][_0xe106('0x39')](_0x50ff28);return parseSearchFilter(_0x3ac230['filter']);})[_0xe106('0x47')](function(_0x2e9950){_0x3242a4[_0xe106('0x49')]=_0x2e9950;return _0x3242a4;});}function checkListsRestrictions(_0x4b1131,_0x4a0f36,_0x501526){var _0x4c5d6c=squel['expr']();return Promise[_0xe106('0x4a')]()[_0xe106('0x47')](function(){if(_0x4a0f36[_0xe106('0x5')]&&_0x4b1131[_0xe106('0x3')]===_0xe106('0x4')&&!_0x501526){return _0x4b1131['getLists']({'attributes':['id'],'raw':!![]});}})['then'](function(_0xb8cab8){if(_0xb8cab8){if(_0xb8cab8[_0xe106('0x20')]===0x0){_0x4c5d6c[_0xe106('0x39')](_0xe106('0x4b'));}else{_0x4c5d6c[_0xe106('0x39')]('c.ListId\x20IN\x20?',_[_0xe106('0x36')](_0xb8cab8,'id'));}}})[_0xe106('0x47')](function(){return _0x4c5d6c;});}function buildContactsQuery(_0x11a8df,_0x3476af,_0x3a0701,_0x1c0345,_0x47e3ad,_0x5c3e10){if(_0x3476af){_0x3476af=_0x3a0701['attributes'];}_0x11a8df=addFieldsToQuery(_0x11a8df,_0x3476af,_0x1c0345,_0x5c3e10,!![]);var _0x13f707=squel[_0xe106('0x6')]();_0x13f707=addFieldsToQuery(_0x13f707,_0x3476af,_0x1c0345,_0x5c3e10,![]);if(_0x1c0345||_0x5c3e10){_0x11a8df=applyJoinClauses(_0x11a8df,!![]);_0x11a8df['group'](_0xe106('0x4c'));if(_0x3a0701['limit']){_0x13f707[_0xe106('0x4d')](_0x3a0701[_0xe106('0x4d')]);}if(_0x3a0701[_0xe106('0x4e')]){_0x13f707[_0xe106('0x4e')](_0x3a0701[_0xe106('0x4e')]);}}else{_0x13f707=applyJoinClauses(_0x13f707,![]);_0x13f707['group'](_0xe106('0x4f'));if(_0x3a0701[_0xe106('0x4d')]){_0x11a8df[_0xe106('0x4d')](_0x3a0701[_0xe106('0x4d')]);}if(_0x3a0701[_0xe106('0x4e')]){_0x11a8df[_0xe106('0x4e')](_0x3a0701[_0xe106('0x4e')]);}}_0x13f707[_0xe106('0x50')](_0x47e3ad);if(_0x3a0701['order']){_0x3a0701[_0xe106('0x51')][_0xe106('0x19')](function(_0x29c485){_0x11a8df['order']('c.'+_0x29c485[0x0],_0x29c485[0x1]===_0xe106('0x52')?![]:!![]);_0x13f707[_0xe106('0x51')](_0xe106('0x53')+_0x29c485[0x0],_0x29c485[0x1]===_0xe106('0x52')?![]:!![]);});}_0x13f707['from'](_0x11a8df,_0xe106('0x8'));return _0x13f707;}function getFilteredContacts(_0x4575fa){var _0x2691e0=[];return db[_0xe106('0x34')][_0xe106('0x54')]({'attributes':['id',_0xe106('0x2c'),'color'],'raw':!![]})[_0xe106('0x47')](function(_0x7ffad0){_0x2691e0=_[_0xe106('0x55')](_0x7ffad0,'id');var _0x435c24={'type':db['Sequelize'][_0xe106('0x56')][_0xe106('0x57')],'model':db[_0xe106('0x58')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xe106('0x59')]['query'](_0x4575fa[_0xe106('0x5a')](),_0x435c24);})[_0xe106('0x47')](function(_0x544cfe){_0x544cfe['forEach'](function(_0x30ab69){if(_0x30ab69[_0xe106('0x18')]){_0x30ab69[_0xe106('0x5b')]=[];_0x30ab69[_0xe106('0x18')][_0xe106('0x35')](',')[_0xe106('0x19')](function(_0x303026){_0x30ab69['Tags'][_0xe106('0x5c')](_0x2691e0[_0x303026]);});}delete _0x30ab69['TagIds'];});return _0x544cfe;});}function countFilteredContacts(_0x3b76c4,_0x4ed87d){var _0xefa2d5=_0x3b76c4[_0xe106('0x5d')]();_0xefa2d5[_0xe106('0x1b')]('COUNT(*)');_0xefa2d5=applyJoinClauses(_0xefa2d5,!![]);_0x3b76c4[_0xe106('0x5e')](_0xe106('0x4c'));var _0x593826=utils['getSelectedTags'](_0x4ed87d);if(!_['isEmpty'](_0x593826)){_0xefa2d5[_0xe106('0x5f')](_0xe106('0x60'),_0x593826);}var _0x2b67dd={'type':db[_0xe106('0x61')]['QueryTypes'][_0xe106('0x57')],'raw':!![]};return db[_0xe106('0x59')][_0xe106('0x62')](_0xefa2d5[_0xe106('0x5a')](),_0x2b67dd)[_0xe106('0x47')](function(_0x4b5af7){return _0x4b5af7[0x0]['COUNT(*)'];});}module[_0xe106('0x63')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x90fb=['push','forEach','TagIds','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','replace','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','parseSearch','sqlOperator','length','conditions','name','datetime','castTo','DATE','type','default','value','start','end','Tag','map','and','tags','ids','User','user','clause','uc.UserId\x20=\x20?','skip','some','compact','Contact','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','resolve','then','fields','tag','filter','select','c.id','limit','offset','group','having','order','DESC','subqry.','color','keyBy','Sequelize','SELECT','CmContact','query','toString','Tags','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','QueryTypes','sequelize','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','role','agent','search','ListId','autocomplete','true','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','tools_tags','t.id\x20=\x20ct.TagId','subqry','firstName','mobile','fax','email','CompanyId','createdAt','updatedAt','deletedAt','includes'];(function(_0x4409e7,_0x307f17){var _0x24c751=function(_0x3a7d33){while(--_0x3a7d33){_0x4409e7['push'](_0x4409e7['shift']());}};_0x24c751(++_0x307f17);}(_0x90fb,0xb1));var _0xb90f=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x90fb[_0x4fc9e6];return _0x551d28;};'use strict';var _=require('lodash');var squel=require(_0xb90f('0x0'));var as=require(_0xb90f('0x1'));var qs=require(_0xb90f('0x2'));var utils=require(_0xb90f('0x3'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x20cb88,_0x1883a1){var _0x25b10a=![];if(_0x20cb88[_0xb90f('0x4')]===_0xb90f('0x5')&&!_0x1883a1[_0xb90f('0x6')]&&!_0x1883a1[_0xb90f('0x7')]&&_0x1883a1[_0xb90f('0x8')]!==_0xb90f('0x9')){_0x25b10a=!![];}return _0x25b10a;}function getContactsSubquery(){return squel['select']()[_0xb90f('0xa')](_0xb90f('0xb'),'c')[_0xb90f('0xc')](_0xb90f('0xd'));}function applyJoinClauses(_0x516833,_0x134d27){var _0x1b058b=_0x134d27?'c':'subqry';_0x516833[_0xb90f('0xe')](_0xb90f('0xf'),'uc',_0xb90f('0x10')+_0x1b058b+_0xb90f('0x11'))[_0xb90f('0xe')](_0xb90f('0x12'),'ct','ct.CmContactId\x20=\x20'+_0x1b058b+_0xb90f('0x11'))[_0xb90f('0xe')](_0xb90f('0x13'),'t',_0xb90f('0x14'));return _0x516833;}function addFieldsToQuery(_0x567177,_0x392c1c,_0x2d70f6,_0x51f7fb,_0x5e9281){var _0x4d69ea=_0x5e9281?'c':_0xb90f('0x15');if(!_0x392c1c){_0x392c1c=['id',_0xb90f('0x16'),'lastName','phone',_0xb90f('0x17'),_0xb90f('0x18'),_0xb90f('0x19'),_0xb90f('0x7'),_0xb90f('0x1a'),_0xb90f('0x1b'),_0xb90f('0x1c'),_0xb90f('0x1d'),'TagIds'];}else if(!_0x392c1c[_0xb90f('0x1e')]('id')){_0x392c1c[_0xb90f('0x1f')]('id');}var _0x37d658=_0x2d70f6&&_0x5e9281||!_0x2d70f6&&!_0x5e9281;if(_0x51f7fb){_0x37d658=_0x51f7fb&&_0x5e9281||!_0x51f7fb&&!_0x5e9281;}_0x392c1c[_0xb90f('0x20')](function(_0x5ce543){if(_0x5ce543===_0xb90f('0x21')){if(_0x37d658){_0x567177[_0xb90f('0x22')](_0xb90f('0x23'),_0x5ce543);}else if(_0x2d70f6||_0x51f7fb){_0x567177[_0xb90f('0x22')](_0x4d69ea+'.'+_0x5ce543);}}else{_0x567177[_0xb90f('0x22')](_0x4d69ea+'.'+_0x5ce543);}});return _0x567177;}function getSqlClauses(){var _0x295edb={'default':squel[_0xb90f('0x24')](),'fields':squel[_0xb90f('0x24')](),'filter':squel[_0xb90f('0x24')](),'tags':{'clause':squel[_0xb90f('0x24')](),'ids':null},'user':{'clause':squel[_0xb90f('0x24')](),'skip':![]}};return _0x295edb;}function parseTagParameter(_0x3708ec){var _0x288891=squel[_0xb90f('0x24')]();if(_0x3708ec){var _0x4bb9e5=utils['getSelectedTags'](_0x3708ec);_0x4bb9e5[_0xb90f('0x20')](function(_0x143f11){_0x288891['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x143f11+',%');});}return _0x288891;}function parseSearchFilter(_0x4ccad5){var _0x501625=squel[_0xb90f('0x24')]();if(_0x4ccad5){var _0x5a2c4d=_0x4ccad5['replace']('\x5c','\x5c\x5c')[_0xb90f('0x25')](/'/g,'\x27\x27');if(_0x5a2c4d[_0xb90f('0x26')]('\x20')['length']>0x1){_0x501625['or'](_0xb90f('0x27'),qs[_0xb90f('0x28')](_0x5a2c4d,!![]),null);}else{if(qs[_0xb90f('0x29')](_0x5a2c4d)){_0x501625['or'](_0xb90f('0x2a'),_0x5a2c4d+'%');_0x501625['or']('c.phone\x20LIKE\x20?',_0x5a2c4d+'%');_0x501625['or'](_0xb90f('0x2b'),_0x5a2c4d+'%');_0x501625['or']('c.fax\x20LIKE\x20?',_0x5a2c4d+'%');}else if(qs[_0xb90f('0x2c')](_0x5a2c4d)){_0x501625['or'](_0xb90f('0x2d'),_0x5a2c4d+'%');}else{_0x501625['or'](_0xb90f('0x2e'),'%'+_0x5a2c4d+'%');_0x501625['or']('c.lastName\x20LIKE\x20?','%'+_0x5a2c4d+'%');_0x501625['or'](_0xb90f('0x2d'),'%'+_0x5a2c4d+'%');}}}return _0x501625;}function parseAdvancedSearchFilter(_0x200140,_0x1fa2e4){var _0x4237af=getSqlClauses();var _0x2473b0=as[_0xb90f('0x2f')](_0x200140);var _0x41b9fb=_0x2473b0[_0xb90f('0x30')];for(var _0x3cf7d1=0x0;_0x3cf7d1<_0x2473b0['conditions'][_0xb90f('0x31')];_0x3cf7d1++){var _0xca4211=_0x2473b0[_0xb90f('0x32')][_0x3cf7d1];var _0x5ad475='c';var _0x1a186f=_['find'](_0x1fa2e4,[_0xb90f('0x33'),_0xca4211['field']]);if(_0x1a186f){if(_0xca4211[_0xb90f('0x22')]==='dateOfBirth'||_0x1a186f['fieldType']===_0xb90f('0x34')){_0xca4211[_0xb90f('0x35')]=_0xb90f('0x36');}var _0x5d2039=as['buildExpression'](_0x5ad475,_0x1a186f[_0xb90f('0x37')],_0xca4211);_0x4237af[_0xb90f('0x38')][_0x41b9fb](_0x5d2039['text'],_0x5d2039[_0xb90f('0x39')][_0xb90f('0x3a')],_0x5d2039[_0xb90f('0x39')][_0xb90f('0x3b')]);}else{if(_0xca4211[_0xb90f('0x22')]===_0xb90f('0x3c')){var _0x1cdd74=_0xca4211[_0xb90f('0x39')][_0xb90f('0x26')](',')[_0xb90f('0x3d')](function(_0x3a6115){return Number(_0x3a6115);});var _0x49d2c=parseTagParameter(_0x1cdd74);_0x4237af['tags']['clause'][_0xb90f('0x3e')](_0x49d2c);_0x4237af[_0xb90f('0x3f')][_0xb90f('0x40')]=_0x1cdd74;}else if(_0xca4211['field']===_0xb90f('0x41')){_0x4237af[_0xb90f('0x42')][_0xb90f('0x43')][_0xb90f('0x3e')](_0xb90f('0x44'),_0xca4211[_0xb90f('0x39')]);_0x4237af['user'][_0xb90f('0x45')]=!![];}}}return _0x4237af;}function parseModelFields(_0x211403,_0x4e4e7){var _0x161c95=squel[_0xb90f('0x24')]();var _0x2d5b52=_(_0x211403)['keys']()[_0xb90f('0x3d')](function(_0x684dde){return _[_0xb90f('0x46')](_0x4e4e7,[_0xb90f('0x33'),_0x684dde])?_0x684dde:undefined;})[_0xb90f('0x47')]()[_0xb90f('0x39')]();if(_0x211403[_0xb90f('0x48')]){_0x2d5b52['push'](_0xb90f('0x48'));}if(_0x211403[_0xb90f('0x41')]){_0x2d5b52['push']('User');}if(_0x2d5b52[_0xb90f('0x31')]>0x0){_0x2d5b52[_0xb90f('0x20')](function(_0x49bb2b){if(_0x49bb2b===_0xb90f('0x7')){_0x161c95[_0xb90f('0x3e')](_0xb90f('0x49'),[][_0xb90f('0x4a')](_0x211403[_0x49bb2b]));}else if(_0x49bb2b===_0xb90f('0x48')){var _0x373e5a='%'+_0x211403[_0x49bb2b]+'%';_0x161c95[_0xb90f('0x3e')](_0xb90f('0x4b'),_0x373e5a);}else if(_0x49bb2b===_0xb90f('0x41')){_0x161c95[_0xb90f('0x3e')](_0xb90f('0x44'),_0x211403[_0x49bb2b]);}else{_0x161c95['and']('c.'+_0x49bb2b+'\x20=\x20?',_0x211403[_0x49bb2b]);}});}return _0x161c95;}function parseQueryParameters(_0x547c80,_0x3ae815){var _0x5298dc=getSqlClauses();return Promise[_0xb90f('0x4c')]()[_0xb90f('0x4d')](function(){return parseModelFields(_0x547c80,_0x3ae815);})[_0xb90f('0x4d')](function(_0x8dcef0){_0x5298dc[_0xb90f('0x4e')]['and'](_0x8dcef0);return parseTagParameter(_0x547c80[_0xb90f('0x4f')]);})['then'](function(_0x4c9bd7){_0x5298dc[_0xb90f('0x3f')][_0xb90f('0x43')]['and'](_0x4c9bd7);return parseSearchFilter(_0x547c80['filter']);})[_0xb90f('0x4d')](function(_0x1e5794){_0x5298dc[_0xb90f('0x50')]=_0x1e5794;return _0x5298dc;});}function checkListsRestrictions(_0x22209d,_0x4f958f,_0x2b7779){var _0x44acdf=squel['expr']();return Promise[_0xb90f('0x4c')]()[_0xb90f('0x4d')](function(){if(_0x4f958f[_0xb90f('0x6')]&&_0x22209d[_0xb90f('0x4')]==='agent'&&!_0x2b7779){return _0x22209d['getLists']({'attributes':['id'],'raw':!![]});}})[_0xb90f('0x4d')](function(_0x1c30ee){if(_0x1c30ee){if(_0x1c30ee[_0xb90f('0x31')]===0x0){_0x44acdf[_0xb90f('0x3e')]('c.ListId\x20IS\x20NULL');}else{_0x44acdf[_0xb90f('0x3e')](_0xb90f('0x49'),_[_0xb90f('0x3d')](_0x1c30ee,'id'));}}})['then'](function(){return _0x44acdf;});}function buildContactsQuery(_0x54a01e,_0xfcbbd,_0x539d18,_0x334bd8,_0x58a7be,_0x4acd4c){if(_0xfcbbd){_0xfcbbd=_0x539d18['attributes'];}_0x54a01e=addFieldsToQuery(_0x54a01e,_0xfcbbd,_0x334bd8,_0x4acd4c,!![]);var _0x30facc=squel[_0xb90f('0x51')]();_0x30facc=addFieldsToQuery(_0x30facc,_0xfcbbd,_0x334bd8,_0x4acd4c,![]);if(_0x334bd8||_0x4acd4c){_0x54a01e=applyJoinClauses(_0x54a01e,!![]);_0x54a01e['group'](_0xb90f('0x52'));if(_0x539d18['limit']){_0x30facc[_0xb90f('0x53')](_0x539d18['limit']);}if(_0x539d18['offset']){_0x30facc['offset'](_0x539d18[_0xb90f('0x54')]);}}else{_0x30facc=applyJoinClauses(_0x30facc,![]);_0x30facc[_0xb90f('0x55')]('subqry.id');if(_0x539d18[_0xb90f('0x53')]){_0x54a01e[_0xb90f('0x53')](_0x539d18[_0xb90f('0x53')]);}if(_0x539d18[_0xb90f('0x54')]){_0x54a01e[_0xb90f('0x54')](_0x539d18['offset']);}}_0x30facc[_0xb90f('0x56')](_0x58a7be);if(_0x539d18[_0xb90f('0x57')]){_0x539d18[_0xb90f('0x57')]['forEach'](function(_0x253111){_0x54a01e[_0xb90f('0x57')]('c.'+_0x253111[0x0],_0x253111[0x1]===_0xb90f('0x58')?![]:!![]);_0x30facc[_0xb90f('0x57')](_0xb90f('0x59')+_0x253111[0x0],_0x253111[0x1]==='DESC'?![]:!![]);});}_0x30facc[_0xb90f('0xa')](_0x54a01e,_0xb90f('0x15'));return _0x30facc;}function getFilteredContacts(_0x3ef0ab){var _0x5c9b70=[];return db[_0xb90f('0x3c')]['findAll']({'attributes':['id','name',_0xb90f('0x5a')],'raw':!![]})[_0xb90f('0x4d')](function(_0x3f841f){_0x5c9b70=_[_0xb90f('0x5b')](_0x3f841f,'id');var _0x898668={'type':db[_0xb90f('0x5c')]['QueryTypes'][_0xb90f('0x5d')],'model':db[_0xb90f('0x5e')],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0xb90f('0x5f')](_0x3ef0ab[_0xb90f('0x60')](),_0x898668);})['then'](function(_0x57d31c){_0x57d31c[_0xb90f('0x20')](function(_0x39a052){if(_0x39a052[_0xb90f('0x21')]){_0x39a052[_0xb90f('0x61')]=[];_0x39a052['TagIds'][_0xb90f('0x26')](',')[_0xb90f('0x20')](function(_0xdc8e20){_0x39a052[_0xb90f('0x61')][_0xb90f('0x1f')](_0x5c9b70[_0xdc8e20]);});}delete _0x39a052[_0xb90f('0x21')];});return _0x57d31c;});}function countFilteredContacts(_0x1f44fb,_0x237062){var _0x232501=_0x1f44fb[_0xb90f('0x62')]();_0x232501['field'](_0xb90f('0x63'));_0x232501=applyJoinClauses(_0x232501,!![]);_0x1f44fb['group'](_0xb90f('0x52'));var _0x44187e=utils['getSelectedTags'](_0x237062);if(!_[_0xb90f('0x64')](_0x44187e)){_0x232501[_0xb90f('0xc')](_0xb90f('0x65'),_0x44187e);}var _0x25606f={'type':db[_0xb90f('0x5c')][_0xb90f('0x66')][_0xb90f('0x5d')],'raw':!![]};return db[_0xb90f('0x67')][_0xb90f('0x5f')](_0x232501[_0xb90f('0x60')](),_0x25606f)[_0xb90f('0x4d')](function(_0x2213e0){return _0x2213e0[0x0][_0xb90f('0x63')];});}module['exports']={'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 215c9c2..aee1eb3 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 _0x3066=['decryptFile','createWriteStream','createDecipher','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','lodash','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createCipher','data','update','binary','end','final','write','unlink'];(function(_0x3b9653,_0x3a7e27){var _0x14c4b8=function(_0x448025){while(--_0x448025){_0x3b9653['push'](_0x3b9653['shift']());}};_0x14c4b8(++_0x3a7e27);}(_0x3066,0x128));var _0x6306=function(_0xd99597,_0x27f78e){_0xd99597=_0xd99597-0x0;var _0x3a8b30=_0x3066[_0xd99597];return _0x3a8b30;};'use strict';var crypto=require(_0x6306('0x0'));var fs=require('fs');var BPromise=require(_0x6306('0x1'));var _=require(_0x6306('0x2'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x6306('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x6306('0x4')][_0x6306('0x5')],'algorithm':_0x6306('0x6')};const fileOptions={'algorithm':_0x6306('0x7')};if(config[_0x6306('0x8')]&&config[_0x6306('0x8')][_0x6306('0x9')]){var isSupported=isAlgorithmSupported(config[_0x6306('0x8')]['algorithm']);if(isSupported){fileOptions[_0x6306('0x9')]=config[_0x6306('0x8')][_0x6306('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x6306('0xa')](',\x20');logger['error'](config[_0x6306('0x8')]['algorithm'],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x2097a5){return AES_SUPPORTED_RX['test'](_0x2097a5);}function getSupportedCiphers(){return crypto['getCiphers']()[_0x6306('0xb')](isASupportedCipher);}function isAlgorithmSupported(_0x439d24){return getSupportedCiphers()[_0x6306('0xc')](_0x439d24)>-0x1;}function combineOptions(_0x5392a6){var _0x5e9285={};for(var _0x36ce43 in fileOptions){if(fileOptions[_0x6306('0xd')](_0x36ce43)){_0x5e9285[_0x36ce43]=fileOptions[_0x36ce43];}}if(_0x5392a6){for(var _0x37e7b1 in _0x5392a6){if(_0x5392a6['hasOwnProperty'](_0x37e7b1)){_0x5e9285[_0x37e7b1]=_0x5392a6[_0x37e7b1];}}}return _0x5e9285;}exports[_0x6306('0xe')]=function(_0x524fc1,_0x3e5607,_0x42aba5,_0x4b8770){return new BPromise(function(_0x1a578c,_0x4e6648){_0x4b8770=combineOptions(_0x4b8770);var _0x3d2014=new Buffer(_0x42aba5);var _0x220c78=fs[_0x6306('0xf')](_0x524fc1);var _0x173e39=fs['createWriteStream'](_0x3e5607);var _0x2155e1=crypto[_0x6306('0x10')](_0x4b8770[_0x6306('0x9')],_0x3d2014);_0x220c78['on'](_0x6306('0x11'),function(_0x4ee2e1){var _0x26f419=new Buffer(_0x2155e1[_0x6306('0x12')](_0x4ee2e1),_0x6306('0x13'));_0x173e39['write'](_0x26f419);});_0x220c78['on'](_0x6306('0x14'),function(){try{var _0x767ade=new Buffer(_0x2155e1[_0x6306('0x15')](_0x6306('0x13')),_0x6306('0x13'));_0x173e39[_0x6306('0x16')](_0x767ade);_0x173e39[_0x6306('0x14')]();_0x173e39['on']('close',function(){return _0x1a578c(_0x3e5607);});}catch(_0x1083bc){fs[_0x6306('0x17')](_0x3e5607);return _0x4e6648(_0x1083bc);}});});};exports[_0x6306('0x18')]=function(_0x56d30f,_0xdc3420,_0x508d99,_0x299b3e){return new BPromise(function(_0x34aa20,_0x19a648){_0x299b3e=combineOptions(_0x299b3e);var _0x1cabae=new Buffer(_0x508d99);var _0x40de14=fs[_0x6306('0xf')](_0x56d30f);var _0x23752f=fs[_0x6306('0x19')](_0xdc3420);var _0x245efd=crypto[_0x6306('0x1a')](_0x299b3e[_0x6306('0x9')],_0x1cabae);_0x40de14['on'](_0x6306('0x11'),function(_0x56a7c4){var _0x33577c=new Buffer(_0x245efd['update'](_0x56a7c4),'binary');_0x23752f['write'](_0x33577c);});_0x40de14['on'](_0x6306('0x14'),function(){try{var _0x5317d=new Buffer(_0x245efd[_0x6306('0x15')](_0x6306('0x13')),'binary');_0x23752f['write'](_0x5317d);_0x23752f[_0x6306('0x14')]();_0x23752f['on']('close',function(){return _0x34aa20(_0xdc3420);});}catch(_0x4d2c1b){fs['unlink'](_0xdc3420);return _0x19a648(_0x4d2c1b);}});});};exports[_0x6306('0x1b')]=function(_0x1b3c21,_0x41d7ba,_0x563cf4){var _0x3f8e8b=_0x563cf4||stringOptions['algorithm'];var _0x139d23=_0x41d7ba||stringOptions[_0x6306('0x1c')];var _0x26b918=crypto[_0x6306('0x10')](_0x3f8e8b,_0x139d23);var _0x174fe1=_0x26b918[_0x6306('0x12')](_0x1b3c21,_0x6306('0x1d'),_0x6306('0x1e'));_0x174fe1+=_0x26b918['final']('base64');return _0x174fe1;};exports[_0x6306('0x1f')]=function(_0x56a954,_0x9d0a00,_0x3b7593){var _0xd0eb4=_0x3b7593||stringOptions[_0x6306('0x9')];var _0xe6419e=_0x9d0a00||stringOptions[_0x6306('0x1c')];var _0x291b7f=crypto['createDecipher'](_0xd0eb4,_0xe6419e);var _0x4cfb1f=_0x291b7f[_0x6306('0x12')](_0x56a954,_0x6306('0x1e'),'utf8');_0x4cfb1f+=_0x291b7f[_0x6306('0x15')](_0x6306('0x1d'));return _0x4cfb1f;}; \ No newline at end of file +var _0x2e68=['update','binary','write','end','final','close','decryptFile','createDecipher','data','unlink','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','indexOf','hasOwnProperty','createWriteStream','createCipher'];(function(_0x2dd264,_0x4a1627){var _0x1a659d=function(_0x2f6f44){while(--_0x2f6f44){_0x2dd264['push'](_0x2dd264['shift']());}};_0x1a659d(++_0x4a1627);}(_0x2e68,0x78));var _0x82e6=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x2e68[_0xbca1b1];return _0x4e1686;};'use strict';var crypto=require(_0x82e6('0x0'));var fs=require('fs');var BPromise=require(_0x82e6('0x1'));var _=require('lodash');var config=require(_0x82e6('0x2'));var logger=require(_0x82e6('0x3'))(_0x82e6('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x82e6('0x5')][_0x82e6('0x6')],'algorithm':_0x82e6('0x7')};const fileOptions={'algorithm':_0x82e6('0x8')};if(config[_0x82e6('0x9')]&&config[_0x82e6('0x9')][_0x82e6('0xa')]){var isSupported=isAlgorithmSupported(config[_0x82e6('0x9')][_0x82e6('0xa')]);if(isSupported){fileOptions[_0x82e6('0xa')]=config[_0x82e6('0x9')][_0x82e6('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x82e6('0xb')](',\x20');logger[_0x82e6('0xc')](config[_0x82e6('0x9')][_0x82e6('0xa')],_0x82e6('0xd'),supportedAlgorithms);}}function isASupportedCipher(_0x4cad82){return AES_SUPPORTED_RX[_0x82e6('0xe')](_0x4cad82);}function getSupportedCiphers(){return crypto[_0x82e6('0xf')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x2a2fbe){return getSupportedCiphers()[_0x82e6('0x10')](_0x2a2fbe)>-0x1;}function combineOptions(_0x51da1b){var _0x2e99bc={};for(var _0x3fc034 in fileOptions){if(fileOptions[_0x82e6('0x11')](_0x3fc034)){_0x2e99bc[_0x3fc034]=fileOptions[_0x3fc034];}}if(_0x51da1b){for(var _0x11c9a9 in _0x51da1b){if(_0x51da1b[_0x82e6('0x11')](_0x11c9a9)){_0x2e99bc[_0x11c9a9]=_0x51da1b[_0x11c9a9];}}}return _0x2e99bc;}exports['encryptFile']=function(_0x1ba429,_0x4f900c,_0x53fdc3,_0x1b077e){return new BPromise(function(_0x3f7fb8,_0xbcd7de){_0x1b077e=combineOptions(_0x1b077e);var _0x28065a=new Buffer(_0x53fdc3);var _0x362173=fs['createReadStream'](_0x1ba429);var _0x37b453=fs[_0x82e6('0x12')](_0x4f900c);var _0x452a0c=crypto[_0x82e6('0x13')](_0x1b077e[_0x82e6('0xa')],_0x28065a);_0x362173['on']('data',function(_0x4ea427){var _0x14d1c2=new Buffer(_0x452a0c[_0x82e6('0x14')](_0x4ea427),_0x82e6('0x15'));_0x37b453[_0x82e6('0x16')](_0x14d1c2);});_0x362173['on'](_0x82e6('0x17'),function(){try{var _0x225728=new Buffer(_0x452a0c[_0x82e6('0x18')](_0x82e6('0x15')),_0x82e6('0x15'));_0x37b453[_0x82e6('0x16')](_0x225728);_0x37b453['end']();_0x37b453['on'](_0x82e6('0x19'),function(){return _0x3f7fb8(_0x4f900c);});}catch(_0x1fba2d){fs['unlink'](_0x4f900c);return _0xbcd7de(_0x1fba2d);}});});};exports[_0x82e6('0x1a')]=function(_0x1cd68a,_0x35f48c,_0x3c96d1,_0x837fc){return new BPromise(function(_0x4e686b,_0x4c6340){_0x837fc=combineOptions(_0x837fc);var _0x87feb1=new Buffer(_0x3c96d1);var _0x5027a9=fs['createReadStream'](_0x1cd68a);var _0x4ea7ef=fs[_0x82e6('0x12')](_0x35f48c);var _0x1ff0ed=crypto[_0x82e6('0x1b')](_0x837fc[_0x82e6('0xa')],_0x87feb1);_0x5027a9['on'](_0x82e6('0x1c'),function(_0x5805cf){var _0x82f11b=new Buffer(_0x1ff0ed[_0x82e6('0x14')](_0x5805cf),'binary');_0x4ea7ef['write'](_0x82f11b);});_0x5027a9['on'](_0x82e6('0x17'),function(){try{var _0x2866ef=new Buffer(_0x1ff0ed['final'](_0x82e6('0x15')),_0x82e6('0x15'));_0x4ea7ef[_0x82e6('0x16')](_0x2866ef);_0x4ea7ef['end']();_0x4ea7ef['on'](_0x82e6('0x19'),function(){return _0x4e686b(_0x35f48c);});}catch(_0xe95409){fs[_0x82e6('0x1d')](_0x35f48c);return _0x4c6340(_0xe95409);}});});};exports[_0x82e6('0x1e')]=function(_0x7f784b,_0x40b04c,_0x5a3bd4){var _0x5c3722=_0x5a3bd4||stringOptions[_0x82e6('0xa')];var _0x13e748=_0x40b04c||stringOptions[_0x82e6('0x1f')];var _0x474732=crypto[_0x82e6('0x13')](_0x5c3722,_0x13e748);var _0x197043=_0x474732[_0x82e6('0x14')](_0x7f784b,_0x82e6('0x20'),_0x82e6('0x21'));_0x197043+=_0x474732[_0x82e6('0x18')](_0x82e6('0x21'));return _0x197043;};exports[_0x82e6('0x22')]=function(_0x5624f5,_0x2712da,_0x1f8b0a){var _0x487faa=_0x1f8b0a||stringOptions[_0x82e6('0xa')];var _0x4d585a=_0x2712da||stringOptions['secret'];var _0x5b033b=crypto[_0x82e6('0x1b')](_0x487faa,_0x4d585a);var _0x493bf8=_0x5b033b['update'](_0x5624f5,_0x82e6('0x21'),_0x82e6('0x20'));_0x493bf8+=_0x5b033b[_0x82e6('0x18')]('utf8');return _0x493bf8;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index b7a075b..7ce2948 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 _0xd262=['savename','AnalyticExtractedReport','update','info','CSV','Setting','find','splitSizeCsv','then','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','split','length','range','num','forEach','push','dirname','basename','.csv','join','each','%s%d.%s','csv','writeFileSync','%s.%s','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','Failed','finally','util','path','lodash','to-csv','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd262,0x19d));var _0x2d26=function(_0x33ffd7,_0x53db21){_0x33ffd7=_0x33ffd7-0x0;var _0x39f97a=_0xd262[_0x33ffd7];return _0x39f97a;};'use strict';var util=require(_0x2d26('0x0'));var path=require(_0x2d26('0x1'));var _=require(_0x2d26('0x2'));var csv=require(_0x2d26('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0x2d26('0x4'));var db=require(_0x2d26('0x5'))['db'];var dbH=require(_0x2d26('0x5'))[_0x2d26('0x6')];var logger=require(_0x2d26('0x7'))(_0x2d26('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x2d26('0x9')][0x3];var PATH=process[_0x2d26('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x463379,_0x4082f6){var _0x706a60={'status':_0x463379};var _0x409733={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4082f6){_0x706a60[_0x2d26('0xa')]=_0x4082f6;}return db[_0x2d26('0xb')][_0x2d26('0xc')](_0x706a60,_0x409733);}function main(){var _0x5c766f=0x1388;var _0x4c7031;logger[_0x2d26('0xd')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x2d26('0xe')));return db[_0x2d26('0xf')][_0x2d26('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x2d26('0x11')]})[_0x2d26('0x12')](function(_0x350f2d){if(_0x350f2d){_0x4c7031=_0x350f2d;_0x5c766f=_0x4c7031[_0x2d26('0x11')]||0x1388;}})[_0x2d26('0x12')](function(){return dbH['sequelize'][_0x2d26('0x13')](util[_0x2d26('0x14')](_0x2d26('0x15'),QUERY),{'type':dbH[_0x2d26('0x16')][_0x2d26('0x17')][_0x2d26('0x18')]});})[_0x2d26('0x12')](function(_0x408006){if(!_0x408006[0x0]['num']){return analyticExtractedReport('Empty');}var _0x5522e7=[];var _0x4212f5=0x0;if(_0x4c7031[_0x2d26('0x19')]){if(_0x408006&&_0x408006[_0x2d26('0x1a')]){var _0x4a7e68=_[_0x2d26('0x1b')](_0x408006[0x0][_0x2d26('0x1c')]/_0x5c766f);var _0x1c9f51=Number['isInteger'](_0x408006[0x0]['num']/_0x5c766f)?_0x408006[0x0][_0x2d26('0x1c')]%_0x5c766f:0x0;_0x4a7e68[_0x2d26('0x1d')](function(_0x16adf5){if(_0x16adf5>0x0){_0x4212f5+=_0x5c766f;}_0x5522e7[_0x2d26('0x1e')](dbH[_0x2d26('0x16')][_0x2d26('0x13')](util[_0x2d26('0x14')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5c766f,_0x4212f5),{'type':dbH[_0x2d26('0x16')][_0x2d26('0x17')]['SELECT']}));});if(_0x1c9f51>0x0){_0x4212f5+=_0x5c766f;_0x5522e7[_0x2d26('0x1e')](dbH[_0x2d26('0x16')][_0x2d26('0x13')](util[_0x2d26('0x14')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1c9f51,_0x4212f5),{'type':dbH[_0x2d26('0x16')][_0x2d26('0x17')]['SELECT']}));}}}else{_0x5522e7[_0x2d26('0x1e')](dbH[_0x2d26('0x16')][_0x2d26('0x13')](QUERY,{'type':dbH[_0x2d26('0x16')][_0x2d26('0x17')]['SELECT']}));}var _0x222c2f=path[_0x2d26('0x1f')](PATH);var _0x476abf=path[_0x2d26('0x20')](PATH,_0x2d26('0x21'));var _0x56b960=_0x4c7031['split']&&_0x5522e7[_0x2d26('0x1a')]>0x1;var _0x27e0f3=[];if(!fs['existsSync'](path[_0x2d26('0x22')](_0x222c2f,_0x476abf))&&_0x56b960){fs['mkdirSync'](path[_0x2d26('0x22')](_0x222c2f,_0x476abf));}return BPromise[_0x2d26('0x23')](_0x5522e7,function(_0x5c2c99){_0x27e0f3[_0x2d26('0x1e')](_0x5c2c99);})[_0x2d26('0x12')](function(){for(var _0x317f5e=0x0;_0x317f5e<_0x27e0f3[_0x2d26('0x1a')];_0x317f5e+=0x1){var _0x1af164;var _0x437aa8=_0x27e0f3[_0x317f5e];if(_0x56b960){_0x1af164=path['join'](_0x222c2f,_0x476abf,util[_0x2d26('0x14')](_0x2d26('0x24'),_0x476abf,_0x317f5e,'csv'));}else{_0x1af164=path[_0x2d26('0x22')](_0x222c2f,util[_0x2d26('0x14')]('%s.%s',_0x476abf,_0x2d26('0x25')));}fs[_0x2d26('0x26')](_0x1af164,csv(_0x437aa8));}})[_0x2d26('0x12')](function(){if(_0x56b960){return new Promise(function(_0x4f2f52){zipdir(path[_0x2d26('0x22')](_0x222c2f,_0x476abf),{'saveTo':path['join'](_0x222c2f,util['format'](_0x2d26('0x27'),_0x476abf,'zip'))},function(_0x35dd57,_0x549ea3){rimraf(path[_0x2d26('0x22')](_0x222c2f,_0x476abf),function(){});_0x4f2f52(_0x2d26('0x28'));});});}})['then'](function(){logger[_0x2d26('0xd')](util[_0x2d26('0x14')](_0x2d26('0x29'),EXTRACTED_REPORT_ID,_0x2d26('0xe')));return analyticExtractedReport(_0x2d26('0x2a'),_0x56b960?util[_0x2d26('0x14')]('%s.%s',_0x476abf,_0x56b960?_0x2d26('0x2b'):_0x2d26('0x25')):null);});})[_0x2d26('0x2c')](function(_0x2065b6){logger['info'](util[_0x2d26('0x14')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x2d26('0xe')),util['inspect'](_0x2065b6,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x2d26('0x2d'));})[_0x2d26('0x2e')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x6211=['SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','range','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','query','basename','.csv','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','inspect','Failed','finally','util','path','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0x6211,0xe8));var _0x1621=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6211[_0x19e35c];return _0x3e1fe8;};'use strict';var util=require(_0x1621('0x0'));var path=require(_0x1621('0x1'));var _=require('lodash');var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x1621('0x2'));var zipdir=require(_0x1621('0x3'));var rimraf=require(_0x1621('0x4'));var db=require(_0x1621('0x5'))['db'];var dbH=require(_0x1621('0x5'))[_0x1621('0x6')];var logger=require(_0x1621('0x7'))(_0x1621('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x1621('0x9')][0x2]);var QUERY=process[_0x1621('0x9')][0x3];var PATH=process[_0x1621('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4cc5b8,_0x24b7f9){var _0x1ceacb={'status':_0x4cc5b8};var _0x2644a4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x24b7f9){_0x1ceacb[_0x1621('0xa')]=_0x24b7f9;}return db[_0x1621('0xb')][_0x1621('0xc')](_0x1ceacb,_0x2644a4);}function main(){var _0x500016=0x1388;var _0x34d249;logger[_0x1621('0xd')](util[_0x1621('0xe')](_0x1621('0xf'),EXTRACTED_REPORT_ID,_0x1621('0x10')));return db[_0x1621('0x11')][_0x1621('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x1621('0x13'),_0x1621('0x14')]})['then'](function(_0x3c3267){if(_0x3c3267){_0x34d249=_0x3c3267;_0x500016=_0x34d249[_0x1621('0x14')]||0x1388;}})[_0x1621('0x15')](function(){return dbH[_0x1621('0x16')]['query'](util['format'](_0x1621('0x17'),QUERY),{'type':dbH[_0x1621('0x16')][_0x1621('0x18')][_0x1621('0x19')]});})[_0x1621('0x15')](function(_0x206485){if(!_0x206485[0x0][_0x1621('0x1a')]){return analyticExtractedReport(_0x1621('0x1b'));}var _0x28cb28=[];var _0x3e8f08=0x0;if(_0x34d249['split']){if(_0x206485&&_0x206485[_0x1621('0x1c')]){var _0x165db0=_[_0x1621('0x1d')](_0x206485[0x0][_0x1621('0x1a')]/_0x500016);var _0x10af87=Number[_0x1621('0x1e')](_0x206485[0x0][_0x1621('0x1a')]/_0x500016)?_0x206485[0x0][_0x1621('0x1a')]%_0x500016:0x0;_0x165db0['forEach'](function(_0x11c403){if(_0x11c403>0x0){_0x3e8f08+=_0x500016;}_0x28cb28[_0x1621('0x1f')](dbH['sequelize']['query'](util['format'](_0x1621('0x20'),QUERY,_0x500016,_0x3e8f08),{'type':dbH[_0x1621('0x16')][_0x1621('0x18')][_0x1621('0x19')]}));});if(_0x10af87>0x0){_0x3e8f08+=_0x500016;_0x28cb28[_0x1621('0x1f')](dbH[_0x1621('0x16')]['query'](util[_0x1621('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x10af87,_0x3e8f08),{'type':dbH[_0x1621('0x16')][_0x1621('0x18')][_0x1621('0x19')]}));}}}else{_0x28cb28[_0x1621('0x1f')](dbH[_0x1621('0x16')][_0x1621('0x21')](QUERY,{'type':dbH[_0x1621('0x16')][_0x1621('0x18')]['SELECT']}));}var _0x47a7d4=path['dirname'](PATH);var _0x4852b3=path[_0x1621('0x22')](PATH,_0x1621('0x23'));var _0x49e572=_0x34d249[_0x1621('0x13')]&&_0x28cb28[_0x1621('0x1c')]>0x1;var _0x19861f=[];if(!fs['existsSync'](path[_0x1621('0x24')](_0x47a7d4,_0x4852b3))&&_0x49e572){fs[_0x1621('0x25')](path[_0x1621('0x24')](_0x47a7d4,_0x4852b3));}return BPromise[_0x1621('0x26')](_0x28cb28,function(_0x3dfc10){_0x19861f['push'](_0x3dfc10);})['then'](function(){for(var _0x25e5f0=0x0;_0x25e5f0<_0x19861f[_0x1621('0x1c')];_0x25e5f0+=0x1){var _0x33d1d0;var _0x3856f7=_0x19861f[_0x25e5f0];if(_0x49e572){_0x33d1d0=path[_0x1621('0x24')](_0x47a7d4,_0x4852b3,util[_0x1621('0xe')](_0x1621('0x27'),_0x4852b3,_0x25e5f0,_0x1621('0x28')));}else{_0x33d1d0=path[_0x1621('0x24')](_0x47a7d4,util[_0x1621('0xe')](_0x1621('0x29'),_0x4852b3,_0x1621('0x28')));}fs[_0x1621('0x2a')](_0x33d1d0,csv(_0x3856f7));}})[_0x1621('0x15')](function(){if(_0x49e572){return new Promise(function(_0x2d436e){zipdir(path[_0x1621('0x24')](_0x47a7d4,_0x4852b3),{'saveTo':path[_0x1621('0x24')](_0x47a7d4,util[_0x1621('0xe')]('%s.%s',_0x4852b3,_0x1621('0x2b')))},function(_0x47aff8,_0x27242a){rimraf(path['join'](_0x47a7d4,_0x4852b3),function(){});_0x2d436e(_0x1621('0x2c'));});});}})[_0x1621('0x15')](function(){logger['info'](util[_0x1621('0xe')](_0x1621('0x2d'),EXTRACTED_REPORT_ID,_0x1621('0x10')));return analyticExtractedReport(_0x1621('0x2e'),_0x49e572?util[_0x1621('0xe')]('%s.%s',_0x4852b3,_0x49e572?_0x1621('0x2b'):_0x1621('0x28')):null);});})[_0x1621('0x2f')](function(_0x5233a2){logger[_0x1621('0xd')](util[_0x1621('0xe')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x1621('0x10')),util[_0x1621('0x30')](_0x5233a2,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1621('0x31'));})[_0x1621('0x32')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index cb94b13..c14d3da 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 _0x88c4=['path','catch','lodash','util','moment','pdfmake/src/printer','rimraf','window','bluebird','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','update','map','tableHeader','pick','toString','value','fill','length','auto','body','push','chunk','forEach','name','format','endDate','header','pageBreak','before','margin','\x20/\x20','Arial','right','num','splitSizePdf','then','split','range','isInteger','query','sequelize','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.pdf','existsSync','mkdirSync','flatten','createPdfKitDocument','join','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','info','PDF','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','AnalyticExtractedReport','findOne','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','%s\x20#%d','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','pipe','createWriteStream','finish','error','end','createPdfFromHTML'];(function(_0x2f6584,_0x318b6b){var _0x115d2d=function(_0x3966aa){while(--_0x3966aa){_0x2f6584['push'](_0x2f6584['shift']());}};_0x115d2d(++_0x318b6b);}(_0x88c4,0xae));var _0x488c=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x88c4[_0x45d55e];return _0x29812a;};'use strict';var _=require(_0x488c('0x0'));var fs=require('fs');var util=require(_0x488c('0x1'));var path=require('path');var moment=require(_0x488c('0x2'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x488c('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x488c('0x4'));var JSDOM=require('jsdom')['JSDOM'];var window=new JSDOM('')[_0x488c('0x5')];var BPromise=require(_0x488c('0x6'));var db=require(_0x488c('0x7'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require('../../config/logger')(_0x488c('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x488c('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x488c('0x9')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x488c('0xa');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x45d68e,_0x2ee17a){var _0x5c68be={'status':_0x45d68e};var _0x1134e9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2ee17a){_0x5c68be[_0x488c('0xb')]=_0x2ee17a;}return db['AnalyticExtractedReport'][_0x488c('0xc')](_0x5c68be,_0x1134e9);}function getHeaders(_0xa74055){return _[_0x488c('0xd')](_0xa74055,function(_0x4e846f){return{'text':_0x4e846f,'style':_0x488c('0xe')};});}function getRows(_0x5f4af9,_0x4c3852){return _['map'](_0x4c3852,function(_0x4223e7){return _(_0x4223e7)[_0x488c('0xf')](_0x5f4af9)[_0x488c('0xd')](function(_0x20c362){return _0x20c362?_[_0x488c('0x10')](_0x20c362):'';})[_0x488c('0x11')]();});}function createTable(_0x2c7364,_0x29d791){var _0x2d58a7={'widths':_[_0x488c('0x12')](Array(_0x2c7364[_0x488c('0x13')]),0x91),'heights':function(_0x4232ae){return _0x4232ae===0x0?_0x488c('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x2a1cc1=getHeaders(_0x2c7364);_0x2d58a7[_0x488c('0x15')][_0x488c('0x16')](_0x2a1cc1);var _0x26c11=getRows(_0x2c7364,_0x29d791);_0x2d58a7[_0x488c('0x15')]=_0x2d58a7['body']['concat'](_0x26c11);return _0x2d58a7;}function createTables(_0x5e586d){var _0x25a03a=[];var _0x1d6a85=_[_0x488c('0x17')](Object['keys'](_0x5e586d[0x0]),0x5);_0x1d6a85[_0x488c('0x18')](function(_0x5f0984){_0x25a03a[_0x488c('0x16')](createTable(_0x5f0984,_0x5e586d));});return _0x25a03a;}function getPDFDocDefinition(_0x188e99){var _0x11b8c0=util['format']('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0x488c('0x19')],moment(EXTRACTED_REPORT['startDate'])[_0x488c('0x1a')](FORMAT),moment(EXTRACTED_REPORT[_0x488c('0x1b')])[_0x488c('0x1a')](FORMAT));var _0x5d7964=[];for(var _0xc5700e=0x0;_0xc5700e<_0x188e99[_0x488c('0x13')];_0xc5700e++){var _0x3e2b9a=[];if(_0xc5700e===0x0){_0x3e2b9a[_0x488c('0x16')]({'text':_0x11b8c0,'style':_0x488c('0x1c')});}var _0x2bed76={'table':_0x188e99[_0xc5700e]};if(_0xc5700e>0x0){_0x2bed76[_0x488c('0x1d')]=_0x488c('0x1e');_0x2bed76[_0x488c('0x1f')]=[0x0,0x46,0x0,0x0];}_0x3e2b9a['push'](_0x2bed76);_0x5d7964[_0x488c('0x16')](_0x3e2b9a);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x5d7964,'footer':function(_0x465b08,_0x2fd83d){return{'text':_0x465b08['toString']()+_0x488c('0x20')+_0x2fd83d,'style':'footer'};},'defaultStyle':{'font':_0x488c('0x21')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x488c('0x22'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x2848b6){var _0x2d8923=0x1388;var _0x419445;if(!_0x2848b6[0x0][_0x488c('0x23')]){return analyticExtractedReport('Empty');}return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x488c('0x24')]})[_0x488c('0x25')](function(_0x2bd923){if(_0x2bd923){_0x419445=_0x2bd923;_0x2d8923=_0x419445[_0x488c('0x24')]||0x3e8;}})[_0x488c('0x25')](function(){var _0x58234f=[];var _0x46c0cb=0x0;if(_0x419445[_0x488c('0x26')]){if(_0x2848b6&&_0x2848b6[_0x488c('0x13')]){var _0x240f08=_[_0x488c('0x27')](_0x2848b6[0x0][_0x488c('0x23')]/_0x2d8923);var _0x48fefb=Number[_0x488c('0x28')](_0x2848b6[0x0][_0x488c('0x23')]/_0x2d8923)?_0x2848b6[0x0]['num']%_0x2d8923:0x0;_0x240f08[_0x488c('0x18')](function(_0x300eb9){if(_0x300eb9>0x0){_0x46c0cb+=_0x2d8923;}_0x58234f['push'](dbH['sequelize'][_0x488c('0x29')](util[_0x488c('0x1a')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2d8923,_0x46c0cb),{'type':dbH[_0x488c('0x2a')][_0x488c('0x2b')][_0x488c('0x2c')]}));});if(_0x48fefb>0x0){_0x46c0cb+=_0x2d8923;_0x58234f[_0x488c('0x16')](dbH[_0x488c('0x2a')]['query'](util[_0x488c('0x1a')](_0x488c('0x2d'),QUERY,_0x48fefb,_0x46c0cb),{'type':dbH['sequelize'][_0x488c('0x2b')][_0x488c('0x2c')]}));}}}else{_0x58234f[_0x488c('0x16')](dbH[_0x488c('0x2a')][_0x488c('0x29')](QUERY,{'type':dbH[_0x488c('0x2a')][_0x488c('0x2b')][_0x488c('0x2c')]}));}var _0x2d9af6=path[_0x488c('0x2e')](PATH);var _0x121339=path[_0x488c('0x2f')](PATH,_0x488c('0x30'));var _0x2c1f4f=_0x419445['split']&&_0x58234f[_0x488c('0x13')]>0x1;var _0x1a1bf1=[];if(!fs[_0x488c('0x31')](path['join'](_0x2d9af6,_0x121339))&&_0x2c1f4f){fs[_0x488c('0x32')](path['join'](_0x2d9af6,_0x121339));}return BPromise['each'](_0x58234f,function(_0x576665){_0x1a1bf1[_0x488c('0x16')](_0x576665);})[_0x488c('0x25')](function(){var _0x57fa5e=[];for(var _0x4cde98=0x0;_0x4cde98<_0x1a1bf1[_0x488c('0x13')];_0x4cde98+=0x1){var _0x9e877f=_0x1a1bf1[_0x4cde98];var _0x1b93b5=createTables(_[_0x488c('0x33')](_0x9e877f));var _0x5cde21;var _0x675a25=getPDFDocDefinition(_0x1b93b5);var _0x18959d=getPDFPrinter();var _0x2fa54d=_0x18959d[_0x488c('0x34')](_0x675a25);if(_0x2c1f4f){_0x5cde21=path[_0x488c('0x35')](_0x2d9af6,_0x121339,util[_0x488c('0x1a')](_0x488c('0x36'),_0x121339,_0x4cde98,_0x488c('0x37')));}else{_0x5cde21=path[_0x488c('0x35')](_0x2d9af6,util[_0x488c('0x1a')](_0x488c('0x38'),_0x121339,_0x488c('0x37')));}_0x57fa5e[_0x488c('0x16')](writePDFDocument(_0x2fa54d,_0x5cde21));}return Promise[_0x488c('0x39')](_0x57fa5e);})[_0x488c('0x25')](function(){if(_0x2c1f4f){return new Promise(function(_0x5024d9){zipdir(path[_0x488c('0x35')](_0x2d9af6,_0x121339),{'saveTo':path['join'](_0x2d9af6,util['format'](_0x488c('0x38'),_0x121339,_0x488c('0x3a')))},function(){rimraf(path[_0x488c('0x35')](_0x2d9af6,_0x121339),function(){});_0x5024d9(_0x488c('0x3b'));});});}})[_0x488c('0x25')](function(){if(!_0x2c1f4f)return;rimraf(path[_0x488c('0x35')](_0x2d9af6,_0x121339),function(){});})[_0x488c('0x25')](function(){logger[_0x488c('0x3c')](util[_0x488c('0x1a')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x488c('0x3d')));return analyticExtractedReport('Completed',_0x2c1f4f?util['format'](_0x488c('0x38'),_0x121339,_0x2c1f4f?_0x488c('0x3a'):_0x488c('0x37')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x488c('0x1a')](_0x488c('0x3e'),EXTRACTED_REPORT_ID,_0x488c('0x3d')));return db[_0x488c('0x3f')][_0x488c('0x40')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x488c('0x25')](function(_0x1ec71d){EXTRACTED_REPORT=_0x1ec71d;return dbH[_0x488c('0x2a')][_0x488c('0x29')](util[_0x488c('0x1a')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x488c('0x2a')]['QueryTypes']['SELECT']});})[_0x488c('0x25')](extractReport)['catch'](function(_0x24e151){logger['info'](util[_0x488c('0x1a')](_0x488c('0x41'),EXTRACTED_REPORT_ID,_0x488c('0x3d')),util[_0x488c('0x42')](_0x24e151,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x488c('0x43')](function(){process[_0x488c('0x44')](EXIT_CODE);});}main();function getPDFPrinter(){var _0xe9f424=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x488c('0x45'),'italics':__dirname+_0x488c('0x46'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0xe9f424;}function getPDFDocDefinitionFromHTML(_0x205bd2,_0x1d57a9){var _0x413708=util[_0x488c('0x1a')](_0x488c('0x47'),_0x1d57a9['channel'],_0x1d57a9[_0x488c('0x48')]);var _0x4e91f3=moment()['format'](_0x488c('0x49'))[_0x488c('0x10')]();var _0x1c89dc=htmlToPdfmake(_0x205bd2,{'window':window,'tableAutoSize':!![]});return{'content':[_0x1c89dc],'defaultStyle':{'font':_0x488c('0x21')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x488c('0x4a'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x488c('0x4a'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x488c('0x4a')}},'header':function(){return[{'text':_0x488c('0x4b'),'style':_0x488c('0x1c')}];},'footer':function(_0x552567,_0x3c7d3a){return[{'text':util[_0x488c('0x1a')](_0x488c('0x4c'),_0x413708,_0x552567,_0x3c7d3a,_0x4e91f3),'style':_0x488c('0x4d')}];}};}function writePDFDocument(_0x25ee6d,_0x4c3a9d){return new Promise(function(_0x54465c,_0x51d3eb){var _0x583fb2=_0x25ee6d[_0x488c('0x4e')](fs[_0x488c('0x4f')](_0x4c3a9d));_0x583fb2['on'](_0x488c('0x50'),function(){_0x54465c(_0x488c('0x50'));});_0x583fb2['on'](_0x488c('0x51'),function(_0x508d73){_0x51d3eb(_0x508d73);});_0x25ee6d[_0x488c('0x52')]();});}exports[_0x488c('0x53')]=function(_0x276e80,_0xb13cef){var _0x3c6d44=getPDFPrinter();var _0x26133a=getPDFDocDefinitionFromHTML(_0x276e80,_0xb13cef);var _0x320a37=_0x3c6d44[_0x488c('0x34')](_0x26133a);return writePDFDocument(_0x320a37,_0xb13cef[_0x488c('0x54')])[_0x488c('0x55')](function(_0x32c6c4){throw _0x32c6c4;});}; \ No newline at end of file +var _0x8861=['JSDOM','window','bluebird','dbH','../../config/logger','analytics','argv','savename','tableHeader','map','toString','value','fill','length','auto','body','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','push','header','before','landscape','\x20/\x20','Arial','black','right','num','Empty','Setting','find','split','splitSizePdf','then','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','join','mkdirSync','each','flatten','%s%d.%s','pdf','%s.%s','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','zip','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','AnalyticExtractedReport','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','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','footer','pipe','createWriteStream','finish','error','end','createPdfFromHTML','createPdfKitDocument','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','rimraf','jsdom'];(function(_0x4c32d8,_0x4c3af2){var _0x5d205c=function(_0x5812eb){while(--_0x5812eb){_0x4c32d8['push'](_0x4c32d8['shift']());}};_0x5d205c(++_0x4c3af2);}(_0x8861,0x106));var _0x1886=function(_0x7220f4,_0x5ac632){_0x7220f4=_0x7220f4-0x0;var _0x5e4f9f=_0x8861[_0x7220f4];return _0x5e4f9f;};'use strict';var _=require(_0x1886('0x0'));var fs=require('fs');var util=require(_0x1886('0x1'));var path=require(_0x1886('0x2'));var moment=require(_0x1886('0x3'));var htmlToPdfmake=require(_0x1886('0x4'));var PdfPrinter=require(_0x1886('0x5'));var zipdir=require('zip-dir');var rimraf=require(_0x1886('0x6'));var JSDOM=require(_0x1886('0x7'))[_0x1886('0x8')];var window=new JSDOM('')[_0x1886('0x9')];var BPromise=require(_0x1886('0xa'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x1886('0xb')];var logger=require(_0x1886('0xc'))(_0x1886('0xd'));var EXTRACTED_REPORT_ID=Number(process[_0x1886('0xe')][0x2]);var QUERY=process[_0x1886('0xe')][0x3];var PATH=process[_0x1886('0xe')][0x4];var NAME=process[_0x1886('0xe')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x5d190c,_0x4a7082){var _0x5b738a={'status':_0x5d190c};var _0x2b7224={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4a7082){_0x5b738a[_0x1886('0xf')]=_0x4a7082;}return db['AnalyticExtractedReport']['update'](_0x5b738a,_0x2b7224);}function getHeaders(_0x585dde){return _['map'](_0x585dde,function(_0x53befe){return{'text':_0x53befe,'style':_0x1886('0x10')};});}function getRows(_0x80fc41,_0x236f65){return _[_0x1886('0x11')](_0x236f65,function(_0x555734){return _(_0x555734)['pick'](_0x80fc41)['map'](function(_0x593dd4){return _0x593dd4?_[_0x1886('0x12')](_0x593dd4):'';})[_0x1886('0x13')]();});}function createTable(_0x3e8255,_0x422d33){var _0x1f8caf={'widths':_[_0x1886('0x14')](Array(_0x3e8255[_0x1886('0x15')]),0x91),'heights':function(_0x374274){return _0x374274===0x0?_0x1886('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x2de372=getHeaders(_0x3e8255);_0x1f8caf[_0x1886('0x17')]['push'](_0x2de372);var _0xa42190=getRows(_0x3e8255,_0x422d33);_0x1f8caf[_0x1886('0x17')]=_0x1f8caf[_0x1886('0x17')]['concat'](_0xa42190);return _0x1f8caf;}function createTables(_0x2677e7){var _0x481640=[];var _0x4a4d6a=_['chunk'](Object[_0x1886('0x18')](_0x2677e7[0x0]),0x5);_0x4a4d6a[_0x1886('0x19')](function(_0x45c316){_0x481640['push'](createTable(_0x45c316,_0x2677e7));});return _0x481640;}function getPDFDocDefinition(_0x327363){var _0x272ada=util[_0x1886('0x1a')](_0x1886('0x1b'),NAME,EXTRACTED_REPORT[_0x1886('0x1c')],moment(EXTRACTED_REPORT[_0x1886('0x1d')])['format'](FORMAT),moment(EXTRACTED_REPORT[_0x1886('0x1e')])[_0x1886('0x1a')](FORMAT));var _0x23453f=[];for(var _0x41ed71=0x0;_0x41ed71<_0x327363[_0x1886('0x15')];_0x41ed71++){var _0x2e3bde=[];if(_0x41ed71===0x0){_0x2e3bde[_0x1886('0x1f')]({'text':_0x272ada,'style':_0x1886('0x20')});}var _0x184c94={'table':_0x327363[_0x41ed71]};if(_0x41ed71>0x0){_0x184c94['pageBreak']=_0x1886('0x21');_0x184c94['margin']=[0x0,0x46,0x0,0x0];}_0x2e3bde['push'](_0x184c94);_0x23453f[_0x1886('0x1f')](_0x2e3bde);}return{'pageSize':'A4','pageOrientation':_0x1886('0x22'),'content':_0x23453f,'footer':function(_0x29a3ad,_0x4111e6){return{'text':_0x29a3ad[_0x1886('0x12')]()+_0x1886('0x23')+_0x4111e6,'style':'footer'};},'defaultStyle':{'font':_0x1886('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x1886('0x25')},'footer':{'alignment':_0x1886('0x26'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x4b2ba8){var _0x395066=0x1388;var _0x3a2cfe;if(!_0x4b2ba8[0x0][_0x1886('0x27')]){return analyticExtractedReport(_0x1886('0x28'));}return db[_0x1886('0x29')][_0x1886('0x2a')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x1886('0x2b'),_0x1886('0x2c')]})[_0x1886('0x2d')](function(_0x5d81c5){if(_0x5d81c5){_0x3a2cfe=_0x5d81c5;_0x395066=_0x3a2cfe[_0x1886('0x2c')]||0x3e8;}})[_0x1886('0x2d')](function(){var _0x19e3d9=[];var _0x3a402c=0x0;if(_0x3a2cfe[_0x1886('0x2b')]){if(_0x4b2ba8&&_0x4b2ba8[_0x1886('0x15')]){var _0x451a7f=_['range'](_0x4b2ba8[0x0][_0x1886('0x27')]/_0x395066);var _0x1384b6=Number[_0x1886('0x2e')](_0x4b2ba8[0x0][_0x1886('0x27')]/_0x395066)?_0x4b2ba8[0x0][_0x1886('0x27')]%_0x395066:0x0;_0x451a7f[_0x1886('0x19')](function(_0x53a971){if(_0x53a971>0x0){_0x3a402c+=_0x395066;}_0x19e3d9['push'](dbH[_0x1886('0x2f')][_0x1886('0x30')](util[_0x1886('0x1a')](_0x1886('0x31'),QUERY,_0x395066,_0x3a402c),{'type':dbH['sequelize'][_0x1886('0x32')]['SELECT']}));});if(_0x1384b6>0x0){_0x3a402c+=_0x395066;_0x19e3d9[_0x1886('0x1f')](dbH[_0x1886('0x2f')][_0x1886('0x30')](util[_0x1886('0x1a')](_0x1886('0x31'),QUERY,_0x1384b6,_0x3a402c),{'type':dbH['sequelize'][_0x1886('0x32')][_0x1886('0x33')]}));}}}else{_0x19e3d9[_0x1886('0x1f')](dbH['sequelize'][_0x1886('0x30')](QUERY,{'type':dbH[_0x1886('0x2f')][_0x1886('0x32')]['SELECT']}));}var _0x540a82=path[_0x1886('0x34')](PATH);var _0x4f7f9b=path[_0x1886('0x35')](PATH,'.pdf');var _0x5836b3=_0x3a2cfe['split']&&_0x19e3d9['length']>0x1;var _0xd4b4a5=[];if(!fs['existsSync'](path[_0x1886('0x36')](_0x540a82,_0x4f7f9b))&&_0x5836b3){fs[_0x1886('0x37')](path[_0x1886('0x36')](_0x540a82,_0x4f7f9b));}return BPromise[_0x1886('0x38')](_0x19e3d9,function(_0x1ee407){_0xd4b4a5['push'](_0x1ee407);})[_0x1886('0x2d')](function(){var _0x2c3c6c=[];for(var _0xefe8f7=0x0;_0xefe8f7<_0xd4b4a5['length'];_0xefe8f7+=0x1){var _0x4b0fc8=_0xd4b4a5[_0xefe8f7];var _0xa5403d=createTables(_[_0x1886('0x39')](_0x4b0fc8));var _0x5c379a;var _0x1be73f=getPDFDocDefinition(_0xa5403d);var _0xab37e8=getPDFPrinter();var _0x570ec0=_0xab37e8['createPdfKitDocument'](_0x1be73f);if(_0x5836b3){_0x5c379a=path[_0x1886('0x36')](_0x540a82,_0x4f7f9b,util['format'](_0x1886('0x3a'),_0x4f7f9b,_0xefe8f7,_0x1886('0x3b')));}else{_0x5c379a=path[_0x1886('0x36')](_0x540a82,util[_0x1886('0x1a')](_0x1886('0x3c'),_0x4f7f9b,_0x1886('0x3b')));}_0x2c3c6c['push'](writePDFDocument(_0x570ec0,_0x5c379a));}return Promise['all'](_0x2c3c6c);})[_0x1886('0x2d')](function(){if(_0x5836b3){return new Promise(function(_0x35bd2a){zipdir(path[_0x1886('0x36')](_0x540a82,_0x4f7f9b),{'saveTo':path[_0x1886('0x36')](_0x540a82,util[_0x1886('0x1a')](_0x1886('0x3c'),_0x4f7f9b,'zip'))},function(){rimraf(path[_0x1886('0x36')](_0x540a82,_0x4f7f9b),function(){});_0x35bd2a(_0x1886('0x3d'));});});}})[_0x1886('0x2d')](function(){if(!_0x5836b3)return;rimraf(path[_0x1886('0x36')](_0x540a82,_0x4f7f9b),function(){});})[_0x1886('0x2d')](function(){logger[_0x1886('0x3e')](util[_0x1886('0x1a')](_0x1886('0x3f'),EXTRACTED_REPORT_ID,_0x1886('0x40')));return analyticExtractedReport('Completed',_0x5836b3?util[_0x1886('0x1a')](_0x1886('0x3c'),_0x4f7f9b,_0x5836b3?_0x1886('0x41'):_0x1886('0x3b')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x1886('0x3e')](util[_0x1886('0x1a')](_0x1886('0x42'),EXTRACTED_REPORT_ID,'PDF'));return db[_0x1886('0x43')][_0x1886('0x44')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x1886('0x2d')](function(_0x5175b){EXTRACTED_REPORT=_0x5175b;return dbH[_0x1886('0x2f')][_0x1886('0x30')](util[_0x1886('0x1a')](_0x1886('0x45'),QUERY),{'type':dbH[_0x1886('0x2f')]['QueryTypes'][_0x1886('0x33')]});})[_0x1886('0x2d')](extractReport)[_0x1886('0x46')](function(_0x380774){logger[_0x1886('0x3e')](util[_0x1886('0x1a')](_0x1886('0x47'),EXTRACTED_REPORT_ID,'PDF'),util['inspect'](_0x380774,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1886('0x48'));})[_0x1886('0x49')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x20dc9e=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x1886('0x4a'),'italics':__dirname+_0x1886('0x4b'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x20dc9e;}function getPDFDocDefinitionFromHTML(_0x3b9a23,_0x20b1ab){var _0x36844b=util[_0x1886('0x1a')]('%s\x20#%d',_0x20b1ab[_0x1886('0x4c')],_0x20b1ab[_0x1886('0x4d')]);var _0x478a44=moment()[_0x1886('0x1a')](_0x1886('0x4e'))[_0x1886('0x12')]();var _0x382e6b=htmlToPdfmake(_0x3b9a23,{'window':window,'tableAutoSize':!![]});return{'content':[_0x382e6b],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x1886('0x4f'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0x1886('0x50'),'style':_0x1886('0x20')}];},'footer':function(_0x3bc7fb,_0x27212b){return[{'text':util[_0x1886('0x1a')](_0x1886('0x51'),_0x36844b,_0x3bc7fb,_0x27212b,_0x478a44),'style':_0x1886('0x52')}];}};}function writePDFDocument(_0x29d452,_0x565bbf){return new Promise(function(_0x22c8ad,_0x32960c){var _0x5b59de=_0x29d452[_0x1886('0x53')](fs[_0x1886('0x54')](_0x565bbf));_0x5b59de['on'](_0x1886('0x55'),function(){_0x22c8ad(_0x1886('0x55'));});_0x5b59de['on'](_0x1886('0x56'),function(_0x53df91){_0x32960c(_0x53df91);});_0x29d452[_0x1886('0x57')]();});}exports[_0x1886('0x58')]=function(_0x2a56ae,_0x4fec73){var _0x30bbf7=getPDFPrinter();var _0x139c86=getPDFDocDefinitionFromHTML(_0x2a56ae,_0x4fec73);var _0x146095=_0x30bbf7[_0x1886('0x59')](_0x139c86);return writePDFDocument(_0x146095,_0x4fec73[_0x1886('0x2')])[_0x1886('0x46')](function(_0x35da14){throw _0x35da14;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 64a4d63..4b6ad33 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 _0x4628=['xlsx','writeFileSync','binary','%s.%s','zip','zip\x20finished','XLSX','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','path','bluebird','rimraf','../../mysqldb','dbH','argv','savename','AnalyticExtractedReport','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','find','splitSizeXlsx','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','split','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','basename','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s'];(function(_0x50200a,_0x6ed783){var _0xa65ece=function(_0x292fc){while(--_0x292fc){_0x50200a['push'](_0x50200a['shift']());}};_0xa65ece(++_0x6ed783);}(_0x4628,0x70));var _0x8462=function(_0x1a89df,_0x55a137){_0x1a89df=_0x1a89df-0x0;var _0x282029=_0x4628[_0x1a89df];return _0x282029;};'use strict';var util=require('util');var path=require(_0x8462('0x0'));var _=require('lodash');var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x8462('0x1'));var zipdir=require('zip-dir');var rimraf=require(_0x8462('0x2'));var db=require('../../mysqldb')['db'];var dbH=require(_0x8462('0x3'))[_0x8462('0x4')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x8462('0x5')][0x2]);var QUERY=process[_0x8462('0x5')][0x3];var PATH=process[_0x8462('0x5')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x36a09d,_0x470457){var _0x578718={'status':_0x36a09d};var _0x1d4de9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x470457){_0x578718[_0x8462('0x6')]=_0x470457;}return db[_0x8462('0x7')]['update'](_0x578718,_0x1d4de9);}function main(){var _0x4a76bc=0x1388;var _0x5eacf7;logger[_0x8462('0x8')](util['format'](_0x8462('0x9'),EXTRACTED_REPORT_ID,'XLSX'));return db['Setting'][_0x8462('0xa')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x8462('0xb')]})[_0x8462('0xc')](function(_0x1651b1){if(_0x1651b1){_0x5eacf7=_0x1651b1;_0x4a76bc=_0x5eacf7[_0x8462('0xb')]||0x1388;}})[_0x8462('0xc')](function(){return dbH[_0x8462('0xd')][_0x8462('0xe')](util[_0x8462('0xf')](_0x8462('0x10'),QUERY),{'type':dbH[_0x8462('0xd')]['QueryTypes'][_0x8462('0x11')]});})[_0x8462('0xc')](function(_0x4038a1){if(!_0x4038a1[0x0][_0x8462('0x12')]){return analyticExtractedReport(_0x8462('0x13'));}var _0x3dae65=[];var _0x59face=0x0;if(_0x5eacf7[_0x8462('0x14')]){if(_0x4038a1&&_0x4038a1[_0x8462('0x15')]){var _0x49ba1b=_[_0x8462('0x16')](_0x4038a1[0x0][_0x8462('0x12')]/_0x4a76bc);var _0x2ec4d3=Number[_0x8462('0x17')](_0x4038a1[0x0][_0x8462('0x12')]/_0x4a76bc)?_0x4038a1[0x0][_0x8462('0x12')]%_0x4a76bc:0x0;_0x49ba1b[_0x8462('0x18')](function(_0x6d7f81){if(_0x6d7f81>0x0){_0x59face+=_0x4a76bc;}_0x3dae65[_0x8462('0x19')](dbH['sequelize'][_0x8462('0xe')](util[_0x8462('0xf')](_0x8462('0x1a'),QUERY,_0x4a76bc,_0x59face),{'type':dbH[_0x8462('0xd')][_0x8462('0x1b')][_0x8462('0x11')]}));});if(_0x2ec4d3>0x0){_0x59face+=_0x4a76bc;_0x3dae65[_0x8462('0x19')](dbH[_0x8462('0xd')][_0x8462('0xe')](util[_0x8462('0xf')](_0x8462('0x1a'),QUERY,_0x2ec4d3,_0x59face),{'type':dbH[_0x8462('0xd')][_0x8462('0x1b')][_0x8462('0x11')]}));}}}else{_0x3dae65[_0x8462('0x19')](dbH[_0x8462('0xd')]['query'](QUERY,{'type':dbH[_0x8462('0xd')][_0x8462('0x1b')][_0x8462('0x11')]}));}var _0x5ad9b4=path['dirname'](PATH);var _0x305e6b=path[_0x8462('0x1c')](PATH,_0x8462('0x1d'));var _0x352ff4=_0x5eacf7[_0x8462('0x14')]&&_0x3dae65['length']>0x1;var _0x2d262d=[];if(!fs[_0x8462('0x1e')](path[_0x8462('0x1f')](_0x5ad9b4,_0x305e6b))&&_0x352ff4){fs[_0x8462('0x20')](path[_0x8462('0x1f')](_0x5ad9b4,_0x305e6b));}return BPromise[_0x8462('0x21')](_0x3dae65,function(_0x4a3ef1){_0x2d262d[_0x8462('0x19')](_0x4a3ef1);})[_0x8462('0xc')](function(){for(var _0x1d7f99=0x0;_0x1d7f99<_0x2d262d[_0x8462('0x15')];_0x1d7f99+=0x1){var _0xc0e9c2;var _0x3d56a4=_0x2d262d[_0x1d7f99];if(_0x352ff4){_0xc0e9c2=path['join'](_0x5ad9b4,_0x305e6b,util[_0x8462('0xf')](_0x8462('0x22'),_0x305e6b,_0x1d7f99,_0x8462('0x23')));}else{_0xc0e9c2=path[_0x8462('0x1f')](_0x5ad9b4,util[_0x8462('0xf')]('%s.%s',_0x305e6b,_0x8462('0x23')));}fs[_0x8462('0x24')](_0xc0e9c2,json2xls(_0x3d56a4),_0x8462('0x25'));}})['then'](function(){if(_0x352ff4){return new Promise(function(_0x2a134f){zipdir(path['join'](_0x5ad9b4,_0x305e6b),{'saveTo':path[_0x8462('0x1f')](_0x5ad9b4,util[_0x8462('0xf')](_0x8462('0x26'),_0x305e6b,_0x8462('0x27')))},function(_0x5874a5,_0x3347b4){rimraf(path[_0x8462('0x1f')](_0x5ad9b4,_0x305e6b),function(){});_0x2a134f(_0x8462('0x28'));});});}})[_0x8462('0xc')](function(){logger[_0x8462('0x8')](util[_0x8462('0xf')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x8462('0x29')));return analyticExtractedReport(_0x8462('0x2a'),_0x352ff4?util[_0x8462('0xf')](_0x8462('0x26'),_0x305e6b,_0x352ff4?_0x8462('0x27'):_0x8462('0x23')):null);});})[_0x8462('0x2b')](function(_0x5ddd89){logger['info'](util[_0x8462('0xf')](_0x8462('0x2c'),EXTRACTED_REPORT_ID,'XLSX'),util[_0x8462('0x2d')](_0x5ddd89,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x8462('0x2e'));})[_0x8462('0x2f')](function(){process[_0x8462('0x30')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xde4d=['xlsx','writeFileSync','binary','%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','exit','util','path','lodash','json2xls','bluebird','zip-dir','analytics','argv','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','split','length','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','join','mkdirSync','each'];(function(_0x290604,_0x13bb2a){var _0x3893aa=function(_0x397639){while(--_0x397639){_0x290604['push'](_0x290604['shift']());}};_0x3893aa(++_0x13bb2a);}(_0xde4d,0xf1));var _0xdde4=function(_0x4865da,_0x1b3507){_0x4865da=_0x4865da-0x0;var _0x410de8=_0xde4d[_0x4865da];return _0x410de8;};'use strict';var util=require(_0xdde4('0x0'));var path=require(_0xdde4('0x1'));var _=require(_0xdde4('0x2'));var fs=require('fs');var json2xls=require(_0xdde4('0x3'));var BPromise=require(_0xdde4('0x4'));var zipdir=require(_0xdde4('0x5'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require('../../config/logger')(_0xdde4('0x6'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xdde4('0x7')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xa7be0e,_0x130f05){var _0x3b998e={'status':_0xa7be0e};var _0x29f975={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x130f05){_0x3b998e[_0xdde4('0x8')]=_0x130f05;}return db['AnalyticExtractedReport'][_0xdde4('0x9')](_0x3b998e,_0x29f975);}function main(){var _0x507d62=0x1388;var _0x3a9894;logger[_0xdde4('0xa')](util[_0xdde4('0xb')](_0xdde4('0xc'),EXTRACTED_REPORT_ID,_0xdde4('0xd')));return db['Setting'][_0xdde4('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xdde4('0xf')]})[_0xdde4('0x10')](function(_0x119922){if(_0x119922){_0x3a9894=_0x119922;_0x507d62=_0x3a9894[_0xdde4('0xf')]||0x1388;}})[_0xdde4('0x10')](function(){return dbH[_0xdde4('0x11')][_0xdde4('0x12')](util[_0xdde4('0xb')](_0xdde4('0x13'),QUERY),{'type':dbH[_0xdde4('0x11')][_0xdde4('0x14')][_0xdde4('0x15')]});})['then'](function(_0x31ba17){if(!_0x31ba17[0x0][_0xdde4('0x16')]){return analyticExtractedReport('Empty');}var _0x5e0bac=[];var _0x28dc6b=0x0;if(_0x3a9894[_0xdde4('0x17')]){if(_0x31ba17&&_0x31ba17[_0xdde4('0x18')]){var _0x1e2e78=_['range'](_0x31ba17[0x0][_0xdde4('0x16')]/_0x507d62);var _0x1e6d89=Number[_0xdde4('0x19')](_0x31ba17[0x0]['num']/_0x507d62)?_0x31ba17[0x0][_0xdde4('0x16')]%_0x507d62:0x0;_0x1e2e78['forEach'](function(_0x212ac8){if(_0x212ac8>0x0){_0x28dc6b+=_0x507d62;}_0x5e0bac[_0xdde4('0x1a')](dbH[_0xdde4('0x11')][_0xdde4('0x12')](util['format'](_0xdde4('0x1b'),QUERY,_0x507d62,_0x28dc6b),{'type':dbH['sequelize'][_0xdde4('0x14')][_0xdde4('0x15')]}));});if(_0x1e6d89>0x0){_0x28dc6b+=_0x507d62;_0x5e0bac[_0xdde4('0x1a')](dbH['sequelize'][_0xdde4('0x12')](util[_0xdde4('0xb')](_0xdde4('0x1b'),QUERY,_0x1e6d89,_0x28dc6b),{'type':dbH[_0xdde4('0x11')][_0xdde4('0x14')][_0xdde4('0x15')]}));}}}else{_0x5e0bac['push'](dbH['sequelize'][_0xdde4('0x12')](QUERY,{'type':dbH['sequelize'][_0xdde4('0x14')][_0xdde4('0x15')]}));}var _0x1c1fe9=path[_0xdde4('0x1c')](PATH);var _0x277d2c=path[_0xdde4('0x1d')](PATH,_0xdde4('0x1e'));var _0x53f398=_0x3a9894[_0xdde4('0x17')]&&_0x5e0bac[_0xdde4('0x18')]>0x1;var _0x4a95ed=[];if(!fs[_0xdde4('0x1f')](path[_0xdde4('0x20')](_0x1c1fe9,_0x277d2c))&&_0x53f398){fs[_0xdde4('0x21')](path[_0xdde4('0x20')](_0x1c1fe9,_0x277d2c));}return BPromise[_0xdde4('0x22')](_0x5e0bac,function(_0x3e704c){_0x4a95ed[_0xdde4('0x1a')](_0x3e704c);})[_0xdde4('0x10')](function(){for(var _0x1890b3=0x0;_0x1890b3<_0x4a95ed['length'];_0x1890b3+=0x1){var _0x1037cc;var _0x46199d=_0x4a95ed[_0x1890b3];if(_0x53f398){_0x1037cc=path['join'](_0x1c1fe9,_0x277d2c,util[_0xdde4('0xb')]('%s%d.%s',_0x277d2c,_0x1890b3,'xlsx'));}else{_0x1037cc=path[_0xdde4('0x20')](_0x1c1fe9,util[_0xdde4('0xb')]('%s.%s',_0x277d2c,_0xdde4('0x23')));}fs[_0xdde4('0x24')](_0x1037cc,json2xls(_0x46199d),_0xdde4('0x25'));}})['then'](function(){if(_0x53f398){return new Promise(function(_0xc5d122){zipdir(path[_0xdde4('0x20')](_0x1c1fe9,_0x277d2c),{'saveTo':path['join'](_0x1c1fe9,util[_0xdde4('0xb')](_0xdde4('0x26'),_0x277d2c,_0xdde4('0x27')))},function(_0x3d9968,_0x1605b3){rimraf(path[_0xdde4('0x20')](_0x1c1fe9,_0x277d2c),function(){});_0xc5d122(_0xdde4('0x28'));});});}})[_0xdde4('0x10')](function(){logger[_0xdde4('0xa')](util['format'](_0xdde4('0x29'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0xdde4('0x2a'),_0x53f398?util['format'](_0xdde4('0x26'),_0x277d2c,_0x53f398?'zip':_0xdde4('0x23')):null);});})[_0xdde4('0x2b')](function(_0x20caab){logger['info'](util[_0xdde4('0xb')](_0xdde4('0x2c'),EXTRACTED_REPORT_ID,_0xdde4('0xd')),util['inspect'](_0x20caab,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0xdde4('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 994e149..bcda71d 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 _0x7e83=['$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','interval','*,*,*,*','map','intervals','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','Hangup','concat','VoiceExtension','destroy','catch','rewrite','lodash','util','models','Interval','findAll','IntervalId','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','then','filter','groupBy','queue','hasOwnProperty','extension','push','type','format','context','priority','VoiceExtensionId','inbound','extensions','Set','CDR(routeid)=','outbound','cutdigits','${EXTEN}','ExecIf'];(function(_0x141749,_0x477b04){var _0x3e6932=function(_0x47b3f2){while(--_0x47b3f2){_0x141749['push'](_0x141749['shift']());}};_0x3e6932(++_0x477b04);}(_0x7e83,0xa9));var _0x37e8=function(_0x483d2a,_0x4bffba){_0x483d2a=_0x483d2a-0x0;var _0x5ba5d5=_0x7e83[_0x483d2a];return _0x5ba5d5;};'use strict';var _=require(_0x37e8('0x0'));var util=require(_0x37e8('0x1'));function rewrite(_0x2173e0,_0x1cecb3){var _0x2ad105=this;return _0x2173e0[_0x37e8('0x2')][_0x37e8('0x3')][_0x37e8('0x4')]({'raw':!![]})['then'](function(_0x270bb5){_0x2ad105['intervals']=_0x270bb5;return _0x2173e0['models']['VoiceExtension'][_0x37e8('0x4')]({'where':{'IntervalId':_0x1cecb3[_0x37e8('0x5')]},'raw':!![]});})['then'](function(_0x3fea53){return _0x2173e0['models']['VoiceExtension'][_0x37e8('0x4')]({'where':{'exten':{'$in':_[_0x37e8('0x6')](_['map'](_0x3fea53,_0x37e8('0x7')))}},'order':[{'raw':_0x37e8('0x8')}],'raw':!![]});})[_0x37e8('0x9')](function(_0x3567d4){var _0x38846e=_[_0x37e8('0xa')](_0x3567d4,{'priority':'1'});var _0x2d5a99=_[_0x37e8('0xa')](_0x3567d4,{'isApp':0x1});var _0x3da2fc=_[_0x37e8('0xb')](_0x2d5a99,_0x37e8('0x7'));var _0x28cc6c=[_0x37e8('0xc'),'playback'];var _0x2ee002=[];var _0x1691f6=[];for(var _0x246554 in _0x3da2fc){if(_0x3da2fc[_0x37e8('0xd')](_0x246554)){_0x2ad105['priority']=0x2;_0x2ad105['extensions']=[];_0x2ad105[_0x37e8('0xe')]=_['find'](_0x38846e,{'exten':_0x3da2fc[_0x246554][0x0]['exten']});_0x2ad105['extensions'][_0x37e8('0xf')]({'type':_0x3da2fc[_0x246554][0x0][_0x37e8('0x10')],'app':'Set','appdata':util[_0x37e8('0x11')]('CDR(type)=%s',_0x3da2fc[_0x246554][0x0][_0x37e8('0x10')]),'context':_0x3da2fc[_0x246554][0x0][_0x37e8('0x12')],'exten':_0x3da2fc[_0x246554][0x0]['exten'],'priority':_0x2ad105[_0x37e8('0x13')]++,'VoiceExtensionId':_0x3da2fc[_0x246554][0x0][_0x37e8('0x14')]});if(_0x3da2fc[_0x246554][0x0]['type']===_0x37e8('0x15')){_0x2ad105[_0x37e8('0x16')][_0x37e8('0xf')]({'type':_0x3da2fc[_0x246554][0x0][_0x37e8('0x10')],'app':_0x37e8('0x17'),'appdata':_0x37e8('0x18')+_0x3da2fc[_0x246554][0x0][_0x37e8('0x14')],'context':_0x3da2fc[_0x246554][0x0][_0x37e8('0x12')],'exten':_0x3da2fc[_0x246554][0x0]['exten'],'priority':_0x2ad105[_0x37e8('0x13')]++,'VoiceExtensionId':_0x3da2fc[_0x246554][0x0][_0x37e8('0x14')]});}else if(_0x3da2fc[_0x246554][0x0][_0x37e8('0x10')]===_0x37e8('0x19')){if(_0x2ad105['extension']){_0x2ad105[_0x37e8('0x16')][_0x37e8('0xf')]({'type':_0x3da2fc[_0x246554][0x0][_0x37e8('0x10')],'app':_0x37e8('0x17'),'appdata':'CDR(destination)='+(_0x2ad105['extension'][_0x37e8('0x1a')]?'${EXTEN:'+_0x2ad105[_0x37e8('0xe')][_0x37e8('0x1a')]+'}':_0x37e8('0x1b')),'context':_0x3da2fc[_0x246554][0x0][_0x37e8('0x12')],'exten':_0x3da2fc[_0x246554][0x0][_0x37e8('0x7')],'priority':_0x2ad105['priority']++,'VoiceExtensionId':_0x3da2fc[_0x246554][0x0]['VoiceExtensionId']});}_0x2ad105[_0x37e8('0x16')][_0x37e8('0xf')]({'type':_0x3da2fc[_0x246554][0x0][_0x37e8('0x10')],'app':_0x37e8('0x17'),'appdata':_0x37e8('0x18')+_0x3da2fc[_0x246554][0x0]['VoiceExtensionId'],'context':_0x3da2fc[_0x246554][0x0][_0x37e8('0x12')],'exten':_0x3da2fc[_0x246554][0x0][_0x37e8('0x7')],'priority':_0x2ad105['priority']++,'VoiceExtensionId':_0x3da2fc[_0x246554][0x0][_0x37e8('0x14')]});var _0x418432=_0x2ad105['priority']++;_0x2ad105[_0x37e8('0x16')][_0x37e8('0xf')]({'type':_0x3da2fc[_0x246554][0x0][_0x37e8('0x10')],'app':_0x37e8('0x1c'),'appdata':_0x37e8('0x1d')+(_0x418432+0x2)+'):Goto('+(_0x418432+0x1)+')','context':_0x3da2fc[_0x246554][0x0][_0x37e8('0x12')],'exten':_0x3da2fc[_0x246554][0x0][_0x37e8('0x7')],'priority':_0x418432,'VoiceExtensionId':_0x3da2fc[_0x246554][0x0][_0x37e8('0x14')]});if(_0x2ad105[_0x37e8('0xe')]){_0x2ad105[_0x37e8('0x16')][_0x37e8('0xf')]({'type':_0x3da2fc[_0x246554][0x0][_0x37e8('0x10')],'app':_0x37e8('0x17'),'appdata':_0x2ad105['extension'][_0x37e8('0x1a')]?'CDR(prefix)=${EXTEN:0:'+_0x2ad105[_0x37e8('0xe')][_0x37e8('0x1a')]+'}':_0x37e8('0x1e'),'context':_0x3da2fc[_0x246554][0x0][_0x37e8('0x12')],'exten':_0x3da2fc[_0x246554][0x0][_0x37e8('0x7')],'priority':_0x2ad105['priority']++,'VoiceExtensionId':_0x3da2fc[_0x246554][0x0][_0x37e8('0x14')]});}_0x2ad105['extensions'][_0x37e8('0xf')]({'type':_0x3da2fc[_0x246554][0x0][_0x37e8('0x10')],'app':_0x37e8('0x17'),'appdata':_0x37e8('0x1f')+_0x3da2fc[_0x246554][0x0]['VoiceExtensionId'],'context':_0x3da2fc[_0x246554][0x0][_0x37e8('0x12')],'exten':_0x3da2fc[_0x246554][0x0]['exten'],'priority':_0x2ad105[_0x37e8('0x13')]++,'VoiceExtensionId':_0x3da2fc[_0x246554][0x0]['VoiceExtensionId']});if(_0x2ad105[_0x37e8('0xe')]&&_0x2ad105['extension'][_0x37e8('0xd')](_0x37e8('0x20'))&&_0x2ad105[_0x37e8('0xe')][_0x37e8('0x20')]!==_0x37e8('0x21')){_0x2ad105[_0x37e8('0x16')][_0x37e8('0xf')]({'type':_0x3da2fc[_0x246554][0x0]['type'],'app':_0x37e8('0x17'),'appdata':_0x37e8('0x22'),'context':_0x3da2fc[_0x246554][0x0][_0x37e8('0x12')],'exten':_0x3da2fc[_0x246554][0x0][_0x37e8('0x7')],'priority':_0x2ad105[_0x37e8('0x13')]++,'VoiceExtensionId':_0x3da2fc[_0x246554][0x0]['VoiceExtensionId']});_0x2ad105['extensions'][_0x37e8('0xf')]({'type':_0x3da2fc[_0x246554][0x0]['type'],'app':_0x37e8('0x17'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x2ad105[_0x37e8('0xe')]['recordingFormat']||_0x37e8('0x23'),'context':_0x3da2fc[_0x246554][0x0][_0x37e8('0x12')],'exten':_0x3da2fc[_0x246554][0x0][_0x37e8('0x7')],'priority':_0x2ad105[_0x37e8('0x13')]++,'VoiceExtensionId':_0x3da2fc[_0x246554][0x0]['VoiceExtensionId']});}}_0x2ad105[_0x37e8('0x16')][_0x37e8('0xf')]({'type':_0x3da2fc[_0x246554][0x0][_0x37e8('0x10')],'app':'Set','appdata':_0x37e8('0x24'),'context':_0x3da2fc[_0x246554][0x0][_0x37e8('0x12')],'exten':_0x3da2fc[_0x246554][0x0][_0x37e8('0x7')],'priority':_0x2ad105[_0x37e8('0x13')]++,'VoiceExtensionId':_0x3da2fc[_0x246554][0x0][_0x37e8('0x14')]});_0x2ad105['extensions'][_0x37e8('0xf')]({'type':_0x3da2fc[_0x246554][0x0][_0x37e8('0x10')],'app':_0x37e8('0x17'),'appdata':_0x37e8('0x25'),'context':_0x3da2fc[_0x246554][0x0][_0x37e8('0x12')],'exten':_0x3da2fc[_0x246554][0x0][_0x37e8('0x7')],'priority':_0x2ad105['priority']++,'VoiceExtensionId':_0x3da2fc[_0x246554][0x0]['VoiceExtensionId']});_0x2ad105[_0x37e8('0x16')][_0x37e8('0xf')]({'type':_0x3da2fc[_0x246554][0x0][_0x37e8('0x10')],'app':_0x37e8('0x17'),'appdata':_0x37e8('0x26'),'context':_0x3da2fc[_0x246554][0x0]['context'],'exten':_0x3da2fc[_0x246554][0x0][_0x37e8('0x7')],'priority':_0x2ad105['priority']++,'VoiceExtensionId':_0x3da2fc[_0x246554][0x0][_0x37e8('0x14')]});for(var _0x122156=0x0,_0x51a520=0x0;_0x122156<_0x3da2fc[_0x246554][_0x37e8('0x27')];_0x122156+=0x1,_0x51a520=0x0){var _0x452f4c=_0x3da2fc[_0x246554][_0x122156];if(_0x452f4c['type']){_0x452f4c['type']=_0x452f4c[_0x37e8('0x10')][_0x37e8('0x28')]();}var _0x38cd41=[];var _0x2c244c=[];delete _0x452f4c['id'];delete _0x452f4c[_0x37e8('0x29')];delete _0x452f4c['updatedAt'];var _0x4af0f5=_0x452f4c[_0x37e8('0x2a')]!==_0x37e8('0x2b')?[_0x452f4c[_0x37e8('0x2a')]]:_0x452f4c[_0x37e8('0x5')]?_[_0x37e8('0x2c')](_[_0x37e8('0xa')](_0x2ad105[_0x37e8('0x2d')],{'IntervalId':_0x452f4c[_0x37e8('0x5')]}),'interval'):[];if(_0x452f4c[_0x37e8('0xd')]('tag')){if(_0x452f4c[_0x37e8('0x2e')]&&_0x452f4c[_0x37e8('0x2e')]!=='--'){_0x38cd41[_0x37e8('0xf')]({'type':_0x452f4c[_0x37e8('0x10')],'app':'Set','appdata':_0x37e8('0x2f')+_0x452f4c[_0x37e8('0x2e')],'context':_0x452f4c[_0x37e8('0x12')],'exten':_0x452f4c[_0x37e8('0x7')],'priority':_0x4af0f5[_0x37e8('0x27')]+_0x2ad105[_0x37e8('0x13')]+_0x51a520++,'VoiceExtensionId':_0x452f4c['VoiceExtensionId']});}}if(_0x452f4c[_0x37e8('0x10')]==='outbound'&&_0x452f4c['hasOwnProperty']('callerID')){if(_0x452f4c[_0x37e8('0x30')]){_0x38cd41[_0x37e8('0xf')]({'type':_0x452f4c['type'],'app':_0x37e8('0x1c'),'appdata':_0x37e8('0x31')+_0x452f4c[_0x37e8('0x30')]+')','context':_0x452f4c[_0x37e8('0x12')],'exten':_0x452f4c['exten'],'priority':_0x4af0f5[_0x37e8('0x27')]+_0x2ad105[_0x37e8('0x13')]+_0x51a520++,'VoiceExtensionId':_0x452f4c[_0x37e8('0x14')]});}else{_0x38cd41[_0x37e8('0xf')]({'type':_0x452f4c[_0x37e8('0x10')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x452f4c[_0x37e8('0x12')],'exten':_0x452f4c[_0x37e8('0x7')],'priority':_0x4af0f5[_0x37e8('0x27')]+_0x2ad105[_0x37e8('0x13')]+_0x51a520++,'VoiceExtensionId':_0x452f4c[_0x37e8('0x14')]});}}if(_0x452f4c[_0x37e8('0xd')](_0x37e8('0x32'))){if(_0x28cc6c[_0x37e8('0x33')](_0x452f4c['app'][_0x37e8('0x28')]())>=0x0&&_0x452f4c['appType']!==_0x37e8('0x34')){if(_0x452f4c[_0x37e8('0x32')]){_0x38cd41['push']({'type':_0x452f4c[_0x37e8('0x10')],'app':_0x37e8('0x1c'),'appdata':_0x37e8('0x35'),'context':_0x452f4c[_0x37e8('0x12')],'exten':_0x452f4c[_0x37e8('0x7')],'priority':_0x4af0f5[_0x37e8('0x27')]+_0x2ad105[_0x37e8('0x13')]+_0x51a520++,'VoiceExtensionId':_0x452f4c[_0x37e8('0x14')]});_0x38cd41[_0x37e8('0xf')]({'type':_0x452f4c[_0x37e8('0x10')],'app':_0x37e8('0x17'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x452f4c[_0x37e8('0x12')],'exten':_0x452f4c['exten'],'priority':_0x4af0f5[_0x37e8('0x27')]+_0x2ad105[_0x37e8('0x13')]+_0x51a520++,'VoiceExtensionId':_0x452f4c[_0x37e8('0x14')]});}else{_0x38cd41['push']({'type':_0x452f4c[_0x37e8('0x10')],'app':_0x37e8('0x1c'),'appdata':_0x37e8('0x36'),'context':_0x452f4c[_0x37e8('0x12')],'exten':_0x452f4c[_0x37e8('0x7')],'priority':_0x4af0f5[_0x37e8('0x27')]+_0x2ad105[_0x37e8('0x13')]+_0x51a520++,'VoiceExtensionId':_0x452f4c[_0x37e8('0x14')]});_0x38cd41['push']({'type':_0x452f4c[_0x37e8('0x10')],'app':_0x37e8('0x17'),'appdata':_0x37e8('0x37'),'context':_0x452f4c[_0x37e8('0x12')],'exten':_0x452f4c[_0x37e8('0x7')],'priority':_0x4af0f5['length']+_0x2ad105['priority']+_0x51a520++,'VoiceExtensionId':_0x452f4c[_0x37e8('0x14')]});}}}for(var _0x1a6d74=0x0;_0x1a6d74<_0x4af0f5[_0x37e8('0x27')];_0x1a6d74+=0x1){var _0x10017d=_0x2ad105[_0x37e8('0x13')]+_0x4af0f5['length'];var _0x27b50b=_0x1a6d74===_0x4af0f5['length']-0x1?_0x2ad105[_0x37e8('0x13')]+_0x38cd41[_0x37e8('0x27')]+_0x2c244c[_0x37e8('0x27')]+0x2:_0x2ad105[_0x37e8('0x13')]+_0x1a6d74+0x1;_0x38cd41[_0x37e8('0x38')](_0x1a6d74,0x0,{'type':_0x452f4c[_0x37e8('0x10')],'app':_0x37e8('0x39'),'appdata':_0x4af0f5[_0x1a6d74]+'?'+_0x452f4c[_0x37e8('0x12')]+_0x37e8('0x3a')+_0x10017d+':'+_0x452f4c[_0x37e8('0x12')]+_0x37e8('0x3a')+_0x27b50b,'exten':_0x452f4c[_0x37e8('0x7')],'context':_0x452f4c[_0x37e8('0x12')],'priority':_0x2ad105['priority']+_0x1a6d74,'VoiceExtensionId':_0x3da2fc[_0x246554][0x0][_0x37e8('0x14')]});}_0x452f4c[_0x37e8('0x13')]=_0x38cd41['length']?_[_0x37e8('0x3b')](_0x38cd41)['priority']+0x1:_0x2ad105[_0x37e8('0x13')];_0x2ad105[_0x37e8('0x13')]=(_0x2c244c[_0x37e8('0x27')]?_[_0x37e8('0x3b')](_0x2c244c)[_0x37e8('0x13')]:_0x452f4c[_0x37e8('0x13')])+0x1;_0x2ad105[_0x37e8('0x16')]=_['concat'](_0x2ad105['extensions'],_0x38cd41,[_0x452f4c],_0x2c244c);}_0x2ad105[_0x37e8('0x16')][_0x37e8('0xf')]({'type':_0x3da2fc[_0x246554][0x0][_0x37e8('0x10')],'app':_0x37e8('0x3c'),'exten':_0x3da2fc[_0x246554][0x0]['exten'],'context':_0x3da2fc[_0x246554][0x0][_0x37e8('0x12')],'priority':_0x2ad105[_0x37e8('0x13')],'VoiceExtensionId':_0x3da2fc[_0x246554][0x0][_0x37e8('0x14')]});_0x2ee002[_0x37e8('0xf')](_0x3da2fc[_0x246554][0x0][_0x37e8('0x14')]);_0x1691f6=_[_0x37e8('0x3d')](_0x1691f6,_0x2ad105[_0x37e8('0x16')]);}}return _0x2173e0['transaction'](function(_0x149a9a){return _0x2173e0['models'][_0x37e8('0x3e')][_0x37e8('0x3f')]({'where':{'VoiceExtensionId':{'$in':_0x2ee002}},'transaction':_0x149a9a})[_0x37e8('0x9')](function(_0x12de54){return _0x2173e0['models'][_0x37e8('0x3e')]['bulkCreate'](_['sortBy'](_0x1691f6,_0x37e8('0x13')),{'transaction':_0x149a9a});});});})[_0x37e8('0x40')](function(_0x113f2c){console['error'](_0x113f2c);});}exports[_0x37e8('0x41')]=rewrite; \ No newline at end of file +var _0xa9e8=['rewrite','util','Interval','findAll','then','models','VoiceExtension','IntervalId','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','exten','queue','priority','extensions','extension','push','type','format','CDR(type)=%s','VoiceExtensionId','inbound','Set','CDR(routeid)=','context','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','toLowerCase','createdAt','updatedAt','*,*,*,*','interval','map','hasOwnProperty','tag','length','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','app','appType','custom','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','bulkCreate','sortBy','catch','error'];(function(_0xfa7612,_0x1a7e52){var _0x1a3fdb=function(_0x2ef7b4){while(--_0x2ef7b4){_0xfa7612['push'](_0xfa7612['shift']());}};_0x1a3fdb(++_0x1a7e52);}(_0xa9e8,0x89));var _0x8a9e=function(_0x41e78a,_0x162772){_0x41e78a=_0x41e78a-0x0;var _0x9402c0=_0xa9e8[_0x41e78a];return _0x9402c0;};'use strict';var _=require('lodash');var util=require(_0x8a9e('0x0'));function rewrite(_0x2cbcaf,_0x1ee520){var _0x3e9d16=this;return _0x2cbcaf['models'][_0x8a9e('0x1')][_0x8a9e('0x2')]({'raw':!![]})[_0x8a9e('0x3')](function(_0x37bff7){_0x3e9d16['intervals']=_0x37bff7;return _0x2cbcaf[_0x8a9e('0x4')][_0x8a9e('0x5')][_0x8a9e('0x2')]({'where':{'IntervalId':_0x1ee520[_0x8a9e('0x6')]},'raw':!![]});})[_0x8a9e('0x3')](function(_0x13377a){return _0x2cbcaf['models'][_0x8a9e('0x5')][_0x8a9e('0x2')]({'where':{'exten':{'$in':_['uniq'](_['map'](_0x13377a,'exten'))}},'order':[{'raw':_0x8a9e('0x7')}],'raw':!![]});})['then'](function(_0x18fc66){var _0xc59739=_[_0x8a9e('0x8')](_0x18fc66,{'priority':'1'});var _0x59fb73=_[_0x8a9e('0x8')](_0x18fc66,{'isApp':0x1});var _0x401285=_[_0x8a9e('0x9')](_0x59fb73,_0x8a9e('0xa'));var _0x43a18e=[_0x8a9e('0xb'),'playback'];var _0x575451=[];var _0x47d908=[];for(var _0x10bb48 in _0x401285){if(_0x401285['hasOwnProperty'](_0x10bb48)){_0x3e9d16[_0x8a9e('0xc')]=0x2;_0x3e9d16[_0x8a9e('0xd')]=[];_0x3e9d16[_0x8a9e('0xe')]=_['find'](_0xc59739,{'exten':_0x401285[_0x10bb48][0x0][_0x8a9e('0xa')]});_0x3e9d16[_0x8a9e('0xd')][_0x8a9e('0xf')]({'type':_0x401285[_0x10bb48][0x0][_0x8a9e('0x10')],'app':'Set','appdata':util[_0x8a9e('0x11')](_0x8a9e('0x12'),_0x401285[_0x10bb48][0x0][_0x8a9e('0x10')]),'context':_0x401285[_0x10bb48][0x0]['context'],'exten':_0x401285[_0x10bb48][0x0][_0x8a9e('0xa')],'priority':_0x3e9d16[_0x8a9e('0xc')]++,'VoiceExtensionId':_0x401285[_0x10bb48][0x0][_0x8a9e('0x13')]});if(_0x401285[_0x10bb48][0x0][_0x8a9e('0x10')]===_0x8a9e('0x14')){_0x3e9d16['extensions'][_0x8a9e('0xf')]({'type':_0x401285[_0x10bb48][0x0][_0x8a9e('0x10')],'app':_0x8a9e('0x15'),'appdata':_0x8a9e('0x16')+_0x401285[_0x10bb48][0x0][_0x8a9e('0x13')],'context':_0x401285[_0x10bb48][0x0][_0x8a9e('0x17')],'exten':_0x401285[_0x10bb48][0x0][_0x8a9e('0xa')],'priority':_0x3e9d16['priority']++,'VoiceExtensionId':_0x401285[_0x10bb48][0x0][_0x8a9e('0x13')]});}else if(_0x401285[_0x10bb48][0x0][_0x8a9e('0x10')]===_0x8a9e('0x18')){if(_0x3e9d16[_0x8a9e('0xe')]){_0x3e9d16['extensions'][_0x8a9e('0xf')]({'type':_0x401285[_0x10bb48][0x0]['type'],'app':'Set','appdata':_0x8a9e('0x19')+(_0x3e9d16[_0x8a9e('0xe')][_0x8a9e('0x1a')]?_0x8a9e('0x1b')+_0x3e9d16['extension'][_0x8a9e('0x1a')]+'}':_0x8a9e('0x1c')),'context':_0x401285[_0x10bb48][0x0][_0x8a9e('0x17')],'exten':_0x401285[_0x10bb48][0x0]['exten'],'priority':_0x3e9d16['priority']++,'VoiceExtensionId':_0x401285[_0x10bb48][0x0][_0x8a9e('0x13')]});}_0x3e9d16['extensions'][_0x8a9e('0xf')]({'type':_0x401285[_0x10bb48][0x0][_0x8a9e('0x10')],'app':_0x8a9e('0x15'),'appdata':'CDR(routeid)='+_0x401285[_0x10bb48][0x0][_0x8a9e('0x13')],'context':_0x401285[_0x10bb48][0x0]['context'],'exten':_0x401285[_0x10bb48][0x0][_0x8a9e('0xa')],'priority':_0x3e9d16[_0x8a9e('0xc')]++,'VoiceExtensionId':_0x401285[_0x10bb48][0x0]['VoiceExtensionId']});var _0x4723de=_0x3e9d16[_0x8a9e('0xc')]++;_0x3e9d16[_0x8a9e('0xd')][_0x8a9e('0xf')]({'type':_0x401285[_0x10bb48][0x0][_0x8a9e('0x10')],'app':_0x8a9e('0x1d'),'appdata':_0x8a9e('0x1e')+(_0x4723de+0x2)+_0x8a9e('0x1f')+(_0x4723de+0x1)+')','context':_0x401285[_0x10bb48][0x0]['context'],'exten':_0x401285[_0x10bb48][0x0]['exten'],'priority':_0x4723de,'VoiceExtensionId':_0x401285[_0x10bb48][0x0][_0x8a9e('0x13')]});if(_0x3e9d16[_0x8a9e('0xe')]){_0x3e9d16[_0x8a9e('0xd')]['push']({'type':_0x401285[_0x10bb48][0x0][_0x8a9e('0x10')],'app':_0x8a9e('0x15'),'appdata':_0x3e9d16[_0x8a9e('0xe')][_0x8a9e('0x1a')]?_0x8a9e('0x20')+_0x3e9d16[_0x8a9e('0xe')][_0x8a9e('0x1a')]+'}':_0x8a9e('0x21'),'context':_0x401285[_0x10bb48][0x0]['context'],'exten':_0x401285[_0x10bb48][0x0]['exten'],'priority':_0x3e9d16[_0x8a9e('0xc')]++,'VoiceExtensionId':_0x401285[_0x10bb48][0x0][_0x8a9e('0x13')]});}_0x3e9d16[_0x8a9e('0xd')][_0x8a9e('0xf')]({'type':_0x401285[_0x10bb48][0x0]['type'],'app':'Set','appdata':_0x8a9e('0x22')+_0x401285[_0x10bb48][0x0]['VoiceExtensionId'],'context':_0x401285[_0x10bb48][0x0][_0x8a9e('0x17')],'exten':_0x401285[_0x10bb48][0x0][_0x8a9e('0xa')],'priority':_0x3e9d16[_0x8a9e('0xc')]++,'VoiceExtensionId':_0x401285[_0x10bb48][0x0][_0x8a9e('0x13')]});if(_0x3e9d16[_0x8a9e('0xe')]&&_0x3e9d16[_0x8a9e('0xe')]['hasOwnProperty'](_0x8a9e('0x23'))&&_0x3e9d16[_0x8a9e('0xe')][_0x8a9e('0x23')]!==_0x8a9e('0x24')){_0x3e9d16[_0x8a9e('0xd')][_0x8a9e('0xf')]({'type':_0x401285[_0x10bb48][0x0][_0x8a9e('0x10')],'app':_0x8a9e('0x15'),'appdata':_0x8a9e('0x25'),'context':_0x401285[_0x10bb48][0x0][_0x8a9e('0x17')],'exten':_0x401285[_0x10bb48][0x0][_0x8a9e('0xa')],'priority':_0x3e9d16['priority']++,'VoiceExtensionId':_0x401285[_0x10bb48][0x0][_0x8a9e('0x13')]});_0x3e9d16[_0x8a9e('0xd')]['push']({'type':_0x401285[_0x10bb48][0x0]['type'],'app':_0x8a9e('0x15'),'appdata':_0x8a9e('0x26')+_0x3e9d16[_0x8a9e('0xe')][_0x8a9e('0x23')]||_0x8a9e('0x27'),'context':_0x401285[_0x10bb48][0x0][_0x8a9e('0x17')],'exten':_0x401285[_0x10bb48][0x0][_0x8a9e('0xa')],'priority':_0x3e9d16[_0x8a9e('0xc')]++,'VoiceExtensionId':_0x401285[_0x10bb48][0x0]['VoiceExtensionId']});}}_0x3e9d16['extensions'][_0x8a9e('0xf')]({'type':_0x401285[_0x10bb48][0x0]['type'],'app':_0x8a9e('0x15'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x401285[_0x10bb48][0x0][_0x8a9e('0x17')],'exten':_0x401285[_0x10bb48][0x0][_0x8a9e('0xa')],'priority':_0x3e9d16[_0x8a9e('0xc')]++,'VoiceExtensionId':_0x401285[_0x10bb48][0x0]['VoiceExtensionId']});_0x3e9d16['extensions'][_0x8a9e('0xf')]({'type':_0x401285[_0x10bb48][0x0][_0x8a9e('0x10')],'app':_0x8a9e('0x15'),'appdata':_0x8a9e('0x28'),'context':_0x401285[_0x10bb48][0x0][_0x8a9e('0x17')],'exten':_0x401285[_0x10bb48][0x0][_0x8a9e('0xa')],'priority':_0x3e9d16['priority']++,'VoiceExtensionId':_0x401285[_0x10bb48][0x0][_0x8a9e('0x13')]});_0x3e9d16['extensions'][_0x8a9e('0xf')]({'type':_0x401285[_0x10bb48][0x0][_0x8a9e('0x10')],'app':_0x8a9e('0x15'),'appdata':'MONITOR_OPTIONS=ab','context':_0x401285[_0x10bb48][0x0]['context'],'exten':_0x401285[_0x10bb48][0x0][_0x8a9e('0xa')],'priority':_0x3e9d16[_0x8a9e('0xc')]++,'VoiceExtensionId':_0x401285[_0x10bb48][0x0][_0x8a9e('0x13')]});for(var _0x27ee90=0x0,_0x2471b7=0x0;_0x27ee90<_0x401285[_0x10bb48]['length'];_0x27ee90+=0x1,_0x2471b7=0x0){var _0xe0cf1=_0x401285[_0x10bb48][_0x27ee90];if(_0xe0cf1['type']){_0xe0cf1[_0x8a9e('0x10')]=_0xe0cf1[_0x8a9e('0x10')][_0x8a9e('0x29')]();}var _0x31ef32=[];var _0x40eace=[];delete _0xe0cf1['id'];delete _0xe0cf1[_0x8a9e('0x2a')];delete _0xe0cf1[_0x8a9e('0x2b')];var _0x3fd861=_0xe0cf1['interval']!==_0x8a9e('0x2c')?[_0xe0cf1[_0x8a9e('0x2d')]]:_0xe0cf1[_0x8a9e('0x6')]?_[_0x8a9e('0x2e')](_[_0x8a9e('0x8')](_0x3e9d16['intervals'],{'IntervalId':_0xe0cf1['IntervalId']}),_0x8a9e('0x2d')):[];if(_0xe0cf1[_0x8a9e('0x2f')]('tag')){if(_0xe0cf1[_0x8a9e('0x30')]&&_0xe0cf1['tag']!=='--'){_0x31ef32[_0x8a9e('0xf')]({'type':_0xe0cf1['type'],'app':_0x8a9e('0x15'),'appdata':'CDR(tag)='+_0xe0cf1[_0x8a9e('0x30')],'context':_0xe0cf1[_0x8a9e('0x17')],'exten':_0xe0cf1['exten'],'priority':_0x3fd861[_0x8a9e('0x31')]+_0x3e9d16[_0x8a9e('0xc')]+_0x2471b7++,'VoiceExtensionId':_0xe0cf1[_0x8a9e('0x13')]});}}if(_0xe0cf1[_0x8a9e('0x10')]===_0x8a9e('0x18')&&_0xe0cf1['hasOwnProperty'](_0x8a9e('0x32'))){if(_0xe0cf1[_0x8a9e('0x32')]){_0x31ef32['push']({'type':_0xe0cf1[_0x8a9e('0x10')],'app':_0x8a9e('0x1d'),'appdata':_0x8a9e('0x33')+_0xe0cf1['callerID']+')','context':_0xe0cf1[_0x8a9e('0x17')],'exten':_0xe0cf1[_0x8a9e('0xa')],'priority':_0x3fd861['length']+_0x3e9d16['priority']+_0x2471b7++,'VoiceExtensionId':_0xe0cf1[_0x8a9e('0x13')]});}else{_0x31ef32[_0x8a9e('0xf')]({'type':_0xe0cf1[_0x8a9e('0x10')],'app':_0x8a9e('0x1d'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0xe0cf1[_0x8a9e('0x17')],'exten':_0xe0cf1['exten'],'priority':_0x3fd861[_0x8a9e('0x31')]+_0x3e9d16['priority']+_0x2471b7++,'VoiceExtensionId':_0xe0cf1[_0x8a9e('0x13')]});}}if(_0xe0cf1['hasOwnProperty'](_0x8a9e('0x34'))){if(_0x43a18e[_0x8a9e('0x35')](_0xe0cf1[_0x8a9e('0x36')][_0x8a9e('0x29')]())>=0x0&&_0xe0cf1[_0x8a9e('0x37')]!==_0x8a9e('0x38')){if(_0xe0cf1['answer']){_0x31ef32[_0x8a9e('0xf')]({'type':_0xe0cf1[_0x8a9e('0x10')],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0xe0cf1[_0x8a9e('0x17')],'exten':_0xe0cf1['exten'],'priority':_0x3fd861[_0x8a9e('0x31')]+_0x3e9d16[_0x8a9e('0xc')]+_0x2471b7++,'VoiceExtensionId':_0xe0cf1['VoiceExtensionId']});_0x31ef32[_0x8a9e('0xf')]({'type':_0xe0cf1[_0x8a9e('0x10')],'app':_0x8a9e('0x15'),'appdata':_0x8a9e('0x39'),'context':_0xe0cf1[_0x8a9e('0x17')],'exten':_0xe0cf1[_0x8a9e('0xa')],'priority':_0x3fd861[_0x8a9e('0x31')]+_0x3e9d16['priority']+_0x2471b7++,'VoiceExtensionId':_0xe0cf1['VoiceExtensionId']});}else{_0x31ef32['push']({'type':_0xe0cf1[_0x8a9e('0x10')],'app':_0x8a9e('0x1d'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0xe0cf1['context'],'exten':_0xe0cf1[_0x8a9e('0xa')],'priority':_0x3fd861[_0x8a9e('0x31')]+_0x3e9d16[_0x8a9e('0xc')]+_0x2471b7++,'VoiceExtensionId':_0xe0cf1['VoiceExtensionId']});_0x31ef32[_0x8a9e('0xf')]({'type':_0xe0cf1['type'],'app':'Set','appdata':_0x8a9e('0x3a'),'context':_0xe0cf1[_0x8a9e('0x17')],'exten':_0xe0cf1[_0x8a9e('0xa')],'priority':_0x3fd861[_0x8a9e('0x31')]+_0x3e9d16['priority']+_0x2471b7++,'VoiceExtensionId':_0xe0cf1[_0x8a9e('0x13')]});}}}for(var _0x5ac718=0x0;_0x5ac718<_0x3fd861[_0x8a9e('0x31')];_0x5ac718+=0x1){var _0x34d9d4=_0x3e9d16[_0x8a9e('0xc')]+_0x3fd861[_0x8a9e('0x31')];var _0x4fdfed=_0x5ac718===_0x3fd861[_0x8a9e('0x31')]-0x1?_0x3e9d16['priority']+_0x31ef32[_0x8a9e('0x31')]+_0x40eace[_0x8a9e('0x31')]+0x2:_0x3e9d16[_0x8a9e('0xc')]+_0x5ac718+0x1;_0x31ef32['splice'](_0x5ac718,0x0,{'type':_0xe0cf1[_0x8a9e('0x10')],'app':_0x8a9e('0x3b'),'appdata':_0x3fd861[_0x5ac718]+'?'+_0xe0cf1[_0x8a9e('0x17')]+_0x8a9e('0x3c')+_0x34d9d4+':'+_0xe0cf1[_0x8a9e('0x17')]+_0x8a9e('0x3c')+_0x4fdfed,'exten':_0xe0cf1[_0x8a9e('0xa')],'context':_0xe0cf1[_0x8a9e('0x17')],'priority':_0x3e9d16[_0x8a9e('0xc')]+_0x5ac718,'VoiceExtensionId':_0x401285[_0x10bb48][0x0][_0x8a9e('0x13')]});}_0xe0cf1['priority']=_0x31ef32['length']?_[_0x8a9e('0x3d')](_0x31ef32)['priority']+0x1:_0x3e9d16[_0x8a9e('0xc')];_0x3e9d16['priority']=(_0x40eace[_0x8a9e('0x31')]?_[_0x8a9e('0x3d')](_0x40eace)[_0x8a9e('0xc')]:_0xe0cf1[_0x8a9e('0xc')])+0x1;_0x3e9d16[_0x8a9e('0xd')]=_[_0x8a9e('0x3e')](_0x3e9d16[_0x8a9e('0xd')],_0x31ef32,[_0xe0cf1],_0x40eace);}_0x3e9d16[_0x8a9e('0xd')][_0x8a9e('0xf')]({'type':_0x401285[_0x10bb48][0x0]['type'],'app':'Hangup','exten':_0x401285[_0x10bb48][0x0][_0x8a9e('0xa')],'context':_0x401285[_0x10bb48][0x0][_0x8a9e('0x17')],'priority':_0x3e9d16[_0x8a9e('0xc')],'VoiceExtensionId':_0x401285[_0x10bb48][0x0][_0x8a9e('0x13')]});_0x575451[_0x8a9e('0xf')](_0x401285[_0x10bb48][0x0]['VoiceExtensionId']);_0x47d908=_[_0x8a9e('0x3e')](_0x47d908,_0x3e9d16[_0x8a9e('0xd')]);}}return _0x2cbcaf['transaction'](function(_0x5da1dc){return _0x2cbcaf[_0x8a9e('0x4')]['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':{'$in':_0x575451}},'transaction':_0x5da1dc})[_0x8a9e('0x3')](function(_0x2868be){return _0x2cbcaf[_0x8a9e('0x4')][_0x8a9e('0x5')][_0x8a9e('0x3f')](_[_0x8a9e('0x40')](_0x47d908,_0x8a9e('0xc')),{'transaction':_0x5da1dc});});});})[_0x8a9e('0x41')](function(_0x500658){console[_0x8a9e('0x42')](_0x500658);});}exports[_0x8a9e('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 7f1be00..e2e1c91 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 _0xc2f5=['split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','message','join','hasOwnProperty','data','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','length','find','Duplicate\x20Contact','CmContact','keys','then','push','catch','Error\x20while\x20creating\x20contact:\x20','stringify','inspect','insert','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','NOW()','field','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','into','ListId\x20=\x20?','id\x20IN\x20?','str','calleridnum','cm_hopper_final','\x20=\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','CmList','Lists','get','dialCheckDuplicateType','always','query','VoiceQueueId','onlyIfOpen','all','sequelize','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','parse','duplicate','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','papaparse','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','zipObject'];(function(_0x4a98fe,_0x224ed8){var _0x3ff59c=function(_0xd3ffbe){while(--_0xd3ffbe){_0x4a98fe['push'](_0x4a98fe['shift']());}};_0x3ff59c(++_0x224ed8);}(_0xc2f5,0x1b8));var _0x5c2f=function(_0x55c1be,_0x5b4b3e){_0x55c1be=_0x55c1be-0x0;var _0x1f1114=_0xc2f5[_0x55c1be];return _0x1f1114;};'use strict';var BPromise=require(_0x5c2f('0x0'));var util=require(_0x5c2f('0x1'));var _=require(_0x5c2f('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x5c2f('0x3'));var Redis=require(_0x5c2f('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0x5c2f('0x5'));var logger=require(_0x5c2f('0x6'))(_0x5c2f('0x7'));config[_0x5c2f('0x8')]=_[_0x5c2f('0x9')](config[_0x5c2f('0x8')],{'host':_0x5c2f('0xa'),'port':0x18eb});var socket=require(_0x5c2f('0xb'))(new Redis(config[_0x5c2f('0x8')]));require(_0x5c2f('0xc'))[_0x5c2f('0xd')](socket);try{if(!process[_0x5c2f('0xe')][0x2]||process['argv'][0x2]===_0x5c2f('0xf')||process[_0x5c2f('0xe')][0x2]==='null'){throw new Error(_0x5c2f('0x10'));}var FILEPATH=process[_0x5c2f('0xe')][0x2];if(!process[_0x5c2f('0xe')][0x3]||process[_0x5c2f('0xe')][0x3]===_0x5c2f('0xf')||process[_0x5c2f('0xe')][0x3]==='null'||!process[_0x5c2f('0xe')][0x4]||process[_0x5c2f('0xe')][0x4]===_0x5c2f('0xf')||process[_0x5c2f('0xe')][0x4]===_0x5c2f('0x11')){throw new Error(_0x5c2f('0x12'));}var FIELDS=_[_0x5c2f('0x13')](process['argv'][0x3][_0x5c2f('0x14')](','),process['argv'][0x4][_0x5c2f('0x14')](','));if(!process[_0x5c2f('0xe')][0x5]||process[_0x5c2f('0xe')][0x5]==='undefined'||process[_0x5c2f('0xe')][0x5]==='null'){throw new Error(_0x5c2f('0x15'));}var LISTID=process[_0x5c2f('0xe')][0x5];var COMPANYID=process['argv'][0x6]&&process['argv'][0x6]!==_0x5c2f('0xf')&&process['argv'][0x6]!=='null'?process[_0x5c2f('0xe')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x5c2f('0xe')][0x7]!==_0x5c2f('0xf')&&process[_0x5c2f('0xe')][0x7]!==_0x5c2f('0x11')?process['argv'][0x7]:null;if(!process[_0x5c2f('0xe')][0x8]||process['argv'][0x8]===_0x5c2f('0xf')||process['argv'][0x8]===_0x5c2f('0x11')){throw new Error(_0x5c2f('0x16'));}var SOCKET_TIMESTAMP=process[_0x5c2f('0xe')][0x8];}catch(_0x33dbb4){logger['error'](_0x33dbb4);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(_0x10f780,_0x2e59e7,_0x55ae11,_0x31f506){var _0x7faa98={'message':_0x2e59e7};_0x7faa98[_0x10f780]=!![];if(_0x55ae11){_0x7faa98[_0x5c2f('0x17')]=_0x55ae11;}if(_0x31f506){_0x7faa98[_0x5c2f('0x18')]=_0x31f506;}return _0x7faa98;}function isEmail(_0x5a422d){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))*$/[_0x5c2f('0x19')](_0x5a422d);}function checkRow(_0x47898c,_0xd912ee,_0x434dc8){return new BPromise(function(_0x232b31,_0xc07aed){if(_[_0x5c2f('0x1a')](_0x47898c)){return _0xc07aed(handleCheckRowError(_0x5c2f('0x1b'),_0x5c2f('0x1c'),null,_0x434dc8));}if(_0x47898c[_0x5c2f('0x1d')]&&_0x47898c[_0x5c2f('0x1d')]['length']){var _0x43e4f6=_['map'](_0x47898c[_0x5c2f('0x1d')],_0x5c2f('0x1e'))[_0x5c2f('0x1f')](';');return _0xc07aed(handleCheckRowError(_0x5c2f('0x1b'),_0x43e4f6,null,_0x434dc8));}var _0x652bda={};for(var _0x58c34d in FIELDS){if(FIELDS[_0x5c2f('0x20')](_0x58c34d)&&FIELDS[_0x58c34d]){_0x652bda[_0x58c34d]=_0x47898c[_0x5c2f('0x21')][0x0][FIELDS[_0x58c34d]]||_0x47898c[_0x5c2f('0x21')][0x0]['\ufeff'+FIELDS[_0x58c34d]];}}if(!_0x652bda['firstName']){return _0xc07aed(handleCheckRowError(_0x5c2f('0x1b'),_0x5c2f('0x22'),null,_0x434dc8));}if(!_0x652bda[_0x5c2f('0x23')]){return _0xc07aed(handleCheckRowError(_0x5c2f('0x1b'),_0x5c2f('0x24'),null,_0x434dc8));}if(_0x652bda[_0x5c2f('0x25')]){var _0x151e74=moment(_0x652bda[_0x5c2f('0x25')],_0x5c2f('0x26'));if(!_0x151e74[_0x5c2f('0x27')]()){return _0xc07aed(handleCheckRowError(_0x5c2f('0x1b'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x434dc8));}}if(_0x652bda[_0x5c2f('0x28')]){if(!isEmail(_0x652bda[_0x5c2f('0x28')])){return _0xc07aed(handleCheckRowError('error',_0x5c2f('0x29'),null,_0x434dc8));}}_0x652bda[_0x5c2f('0x2a')]=LISTID;_0x652bda[_0x5c2f('0x2b')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0xd912ee){var _0x5d6ffe={};for(var _0x33d36=0x0,_0x5f1f28=DUPLICATES[_0x5c2f('0x2c')];_0x33d36<_0x5f1f28;_0x33d36+=0x1){_0x5d6ffe[DUPLICATES[_0x33d36]]=_0x652bda[DUPLICATES[_0x33d36]];}var _0x1c57cb=_[_0x5c2f('0x2d')](_0xd912ee,_0x5d6ffe);if(_0x1c57cb){return _0xc07aed(handleCheckRowError('duplicate',_0x5c2f('0x2e'),_0x1c57cb,_0x434dc8));}}return db[_0x5c2f('0x2f')]['create'](_0x652bda,{'raw':!![],'hooks':![],'fields':_[_0x5c2f('0x30')](_0x652bda)})[_0x5c2f('0x31')](function(_0x4cb082){if(DUPLICATES&&DUPLICATES['length']&&_0xd912ee){_0xd912ee[_0x5c2f('0x32')](_['pick'](_0x652bda,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x4cb082['id'];return _0x232b31();})[_0x5c2f('0x33')](function(_0x585759){return _0xc07aed(handleCheckRowError('error',_0x5c2f('0x34')+(_0x585759['message']||JSON[_0x5c2f('0x35')](_0x585759)),null,_0x434dc8));});});}function checkHopper(){function _0x3803db(){return function(_0x2990cc){logger[_0x5c2f('0x1b')]('cmContact','checkHopper',util[_0x5c2f('0x36')](_0x2990cc,{'showHidden':![],'depth':null}));};}var _0x5c040c=function(_0x499de0,_0x5bafac){var _0x16be86=squel[_0x5c2f('0x37')]()['into'](_0x5c2f('0x38'))[_0x5c2f('0x39')]([_0x5c2f('0x23'),_0x5c2f('0x3a'),_0x5c2f('0x3b'),_0x5c2f('0x2a'),_0x5bafac,_0x5c2f('0x3c'),_0x5c2f('0x3d')],squel[_0x5c2f('0x3e')]()['field'](_0x5c2f('0x23'),_0x5c2f('0x23'))['field'](_0x5c2f('0x3f'),_0x5c2f('0x3a'))[_0x5c2f('0x40')]('id',_0x5c2f('0x3b'))[_0x5c2f('0x40')](LISTID[_0x5c2f('0x41')](),'ListId')[_0x5c2f('0x40')](_0x499de0['id'][_0x5c2f('0x41')](),_0x5bafac)['field']('NOW()','createdAt')[_0x5c2f('0x40')]('NOW()',_0x5c2f('0x3d'))[_0x5c2f('0x42')](_0x5c2f('0x43'))[_0x5c2f('0x44')](_0x5c2f('0x45'))[_0x5c2f('0x44')]('ListId\x20=\x20?',LISTID['toString']())[_0x5c2f('0x44')](_0x5c2f('0x46'))[_0x5c2f('0x44')](_0x5c2f('0x47'),squel[_0x5c2f('0x3e')]()[_0x5c2f('0x40')](_0x5c2f('0x23'))[_0x5c2f('0x42')]('cm_hopper')[_0x5c2f('0x44')](_0x5bafac+'\x20=\x20?',_0x499de0['id'][_0x5c2f('0x41')]())))['toString']();return _0x16be86;};var _0x3307e3=function(_0x45340d,_0x5aaca2){var _0x14bbe3=squel[_0x5c2f('0x37')]()[_0x5c2f('0x48')](_0x5c2f('0x38'))[_0x5c2f('0x39')]([_0x5c2f('0x23'),_0x5c2f('0x3a'),'ContactId',_0x5c2f('0x2a'),_0x5aaca2,_0x5c2f('0x3c'),_0x5c2f('0x3d')],squel[_0x5c2f('0x3e')]()[_0x5c2f('0x40')](_0x5c2f('0x23'),_0x5c2f('0x23'))[_0x5c2f('0x40')](_0x5c2f('0x3f'),'scheduledAt')[_0x5c2f('0x40')]('id',_0x5c2f('0x3b'))[_0x5c2f('0x40')](LISTID[_0x5c2f('0x41')](),_0x5c2f('0x2a'))[_0x5c2f('0x40')](_0x45340d['id'][_0x5c2f('0x41')](),_0x5aaca2)[_0x5c2f('0x40')](_0x5c2f('0x3f'),_0x5c2f('0x3c'))['field']('NOW()',_0x5c2f('0x3d'))[_0x5c2f('0x42')](_0x5c2f('0x43'))[_0x5c2f('0x44')](_0x5c2f('0x45'))[_0x5c2f('0x44')](_0x5c2f('0x49'),LISTID[_0x5c2f('0x41')]())[_0x5c2f('0x44')](_0x5c2f('0x4a'),squel[_0x5c2f('0x4b')](hopperContacts))[_0x5c2f('0x44')](_0x5c2f('0x46'))[_0x5c2f('0x44')](_0x5c2f('0x47'),squel[_0x5c2f('0x3e')]()[_0x5c2f('0x40')](_0x5c2f('0x4c'))[_0x5c2f('0x42')](_0x5c2f('0x4d'))['where'](_0x5aaca2+_0x5c2f('0x4e'),_0x45340d['id'][_0x5c2f('0x41')]()))[_0x5c2f('0x44')]('phone\x20NOT\x20IN\x20(?)',squel[_0x5c2f('0x3e')]()[_0x5c2f('0x40')](_0x5c2f('0x23'))[_0x5c2f('0x42')]('cm_hopper')[_0x5c2f('0x44')](_0x5aaca2+'\x20=\x20?',_0x45340d['id'][_0x5c2f('0x41')]())))[_0x5c2f('0x41')]();return _0x14bbe3;};function _0x2e9752(_0x23f283,_0x16ab5f){var _0x153a6a=squel['insert']()['into'](_0x5c2f('0x38'))[_0x5c2f('0x39')](['phone',_0x5c2f('0x3a'),_0x5c2f('0x3b'),_0x5c2f('0x2a'),_0x16ab5f,'createdAt',_0x5c2f('0x3d')],squel[_0x5c2f('0x3e')]()[_0x5c2f('0x40')](_0x5c2f('0x23'),_0x5c2f('0x23'))[_0x5c2f('0x40')](_0x5c2f('0x3f'),'scheduledAt')[_0x5c2f('0x40')]('id',_0x5c2f('0x3b'))[_0x5c2f('0x40')](LISTID[_0x5c2f('0x41')](),_0x5c2f('0x2a'))[_0x5c2f('0x40')](_0x23f283['id'][_0x5c2f('0x41')](),_0x16ab5f)[_0x5c2f('0x40')](_0x5c2f('0x3f'),_0x5c2f('0x3c'))['field']('NOW()',_0x5c2f('0x3d'))[_0x5c2f('0x42')](_0x5c2f('0x43'))[_0x5c2f('0x44')](_0x5c2f('0x45'))[_0x5c2f('0x44')](_0x5c2f('0x49'),LISTID[_0x5c2f('0x41')]())[_0x5c2f('0x44')](_0x5c2f('0x4a'),squel[_0x5c2f('0x4b')](hopperContacts))[_0x5c2f('0x44')](_0x5c2f('0x46')))[_0x5c2f('0x41')]();return _0x153a6a;}function _0x271908(_0x64f0be,_0x325189){var _0x5b2c75=squel['insert']()[_0x5c2f('0x48')](_0x5c2f('0x4f'))[_0x5c2f('0x39')]([_0x5c2f('0x23'),_0x5c2f('0x3b'),_0x5c2f('0x2a'),_0x325189,_0x5c2f('0x3c'),_0x5c2f('0x3d')],squel[_0x5c2f('0x3e')]()[_0x5c2f('0x40')]('phone',_0x5c2f('0x23'))[_0x5c2f('0x40')]('id',_0x5c2f('0x3b'))[_0x5c2f('0x40')](LISTID[_0x5c2f('0x41')](),_0x5c2f('0x2a'))[_0x5c2f('0x40')](_0x64f0be['id'][_0x5c2f('0x41')](),_0x325189)[_0x5c2f('0x40')](_0x5c2f('0x3f'),_0x5c2f('0x3c'))[_0x5c2f('0x40')](_0x5c2f('0x3f'),'updatedAt')[_0x5c2f('0x42')](_0x5c2f('0x43'))[_0x5c2f('0x44')](_0x5c2f('0x45'))[_0x5c2f('0x44')]('ListId\x20=\x20?',LISTID[_0x5c2f('0x41')]())[_0x5c2f('0x44')]('id\x20IN\x20?',squel[_0x5c2f('0x4b')](hopperContacts))[_0x5c2f('0x44')](_0x5c2f('0x46')))[_0x5c2f('0x41')]();return _0x5b2c75;}return db[_0x5c2f('0x50')][_0x5c2f('0x51')]({'where':{'type':_0x5c2f('0x52')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x5c2f('0x53')],'as':_0x5c2f('0x54'),'where':{'id':LISTID}}]})['then'](function(_0x2600b9){var _0x431aa8=[];if(_0x2600b9){var _0x7b1e9b;for(var _0x4df4c1=0x0,_0x4151a7;_0x4df4c1<_0x2600b9['length'];_0x4df4c1+=0x1){_0x4151a7=_0x2600b9[_0x4df4c1][_0x5c2f('0x55')]({'plain':!![]});switch(_0x4151a7[_0x5c2f('0x56')]){case _0x5c2f('0x57'):_0x431aa8[_0x5c2f('0x32')](db['sequelize'][_0x5c2f('0x58')](_0x3307e3(_0x4151a7,_0x5c2f('0x59')))[_0x5c2f('0x31')](function(){})[_0x5c2f('0x33')](_0x3803db()));break;case _0x5c2f('0x5a'):_0x431aa8[_0x5c2f('0x32')](db['sequelize']['query'](_0x5c040c(_0x4151a7,_0x5c2f('0x59')))['then'](function(){})[_0x5c2f('0x33')](_0x3803db()));break;default:_0x431aa8[_0x5c2f('0x32')](db['sequelize'][_0x5c2f('0x58')](_0x2e9752(_0x4151a7,_0x5c2f('0x59')))[_0x5c2f('0x31')](function(){})[_0x5c2f('0x33')](_0x3803db()));}}}return _0x431aa8;})[_0x5c2f('0x5b')]()['then'](function(){return db[_0x5c2f('0x50')][_0x5c2f('0x51')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x5c2f('0x53')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x5c2f('0x31')](function(_0xafdedd){var _0x4d398a=[];if(_0xafdedd){var _0x47e67d;for(var _0x48fe2e=0x0,_0x42488a;_0x48fe2e<_0xafdedd[_0x5c2f('0x2c')];_0x48fe2e+=0x1){_0x42488a=_0xafdedd[_0x48fe2e]['get']({'plain':!![]});_0x4d398a[_0x5c2f('0x32')](db[_0x5c2f('0x5c')][_0x5c2f('0x58')](_0x271908(_0x42488a,_0x5c2f('0x59')))[_0x5c2f('0x31')](function(){})[_0x5c2f('0x33')](_0x3803db()));}}return _0x4d398a;})[_0x5c2f('0x5b')]();})['then'](function(){return db[_0x5c2f('0x5d')][_0x5c2f('0x51')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x5c2f('0x53')],'as':_0x5c2f('0x54'),'where':{'id':LISTID}}]})[_0x5c2f('0x31')](function(_0x25d83c){var _0x126ff1=[];if(_0x25d83c){for(var _0xecda34=0x0,_0x52b7ae;_0xecda34<_0x25d83c[_0x5c2f('0x2c')];_0xecda34+=0x1){_0x52b7ae=_0x25d83c[_0xecda34][_0x5c2f('0x55')]({'plain':!![]});switch(_0x52b7ae[_0x5c2f('0x56')]){case'always':_0x126ff1[_0x5c2f('0x32')](db['sequelize']['query'](_0x3307e3(_0x52b7ae,'CampaignId'))['then'](function(){})[_0x5c2f('0x33')](_0x3803db()));break;case _0x5c2f('0x5a'):_0x126ff1[_0x5c2f('0x32')](db[_0x5c2f('0x5c')]['query'](_0x5c040c(_0x52b7ae,_0x5c2f('0x5e')))[_0x5c2f('0x31')](function(){})[_0x5c2f('0x33')](_0x3803db()));break;default:_0x126ff1['push'](db[_0x5c2f('0x5c')]['query'](_0x2e9752(_0x52b7ae,_0x5c2f('0x5e')))[_0x5c2f('0x31')](function(){})[_0x5c2f('0x33')](_0x3803db()));}}}return _0x126ff1;})[_0x5c2f('0x5b')]();})[_0x5c2f('0x31')](function(){return db[_0x5c2f('0x5d')][_0x5c2f('0x51')]({'attributes':['id'],'include':[{'model':db[_0x5c2f('0x53')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x216604){var _0x5b059f=[];if(_0x216604){for(var _0x4e1926=0x0,_0x20699a;_0x4e1926<_0x216604['length'];_0x4e1926+=0x1){_0x20699a=_0x216604[_0x4e1926][_0x5c2f('0x55')]({'plain':!![]});_0x5b059f[_0x5c2f('0x32')](db[_0x5c2f('0x5c')]['query'](_0x271908(_0x20699a,_0x5c2f('0x5e')))['then'](function(){})[_0x5c2f('0x33')](_0x3803db()));}}return _0x5b059f;})['all']();})[_0x5c2f('0x33')](function(_0x1af8c4){logger['error'](_0x5c2f('0x5f'),_0x5c2f('0x60'),_0x1af8c4[_0x5c2f('0x1e')]);});}var processPromises=function(_0x5c8c4a){return BPromise[_0x5c2f('0x5b')](promises)['then'](function(_0x270a2a){})[_0x5c2f('0x33')](function(_0x2c2e16){logger['error'](_0x5c2f('0x61'),JSON[_0x5c2f('0x35')](_0x2c2e16));})['finally'](function(){socket[_0x5c2f('0x62')](_0x5c2f('0x63')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x5c8c4a){return _0x5c8c4a[_0x5c2f('0x64')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x5c2f('0x31')](function(){if(hopperContacts){return checkHopper();}})[_0x5c2f('0x31')](function(){socket[_0x5c2f('0x62')](_0x5c2f('0x63')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x5c2f('0x65')](FILEPATH);}catch(_0x357b94){logger[_0x5c2f('0x1b')](_0x5c2f('0x66'),JSON[_0x5c2f('0x35')](_0x357b94));}finally{process[_0x5c2f('0x67')](0x0);}});};process['on'](_0x5c2f('0x68'),function(){logger[_0x5c2f('0x69')](_0x5c2f('0x6a'));endCsv();});function main(){return BPromise[_0x5c2f('0x6b')]()[_0x5c2f('0x31')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x5c2f('0x14')](',');return db[_0x5c2f('0x2f')][_0x5c2f('0x51')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x5c2f('0x31')](function(_0x83c56b){var _0x558556=fs[_0x5c2f('0x6c')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x5c2f('0x6d')](_0x558556,{'header':!![],'skipEmptyLines':!![],'step':function(_0x2c7a5a,_0x412241){total+=0x1;var _0x3e7012=total;promises[_0x5c2f('0x32')](checkRow(_0x2c7a5a,_0x83c56b,_0x3e7012)['then'](function(){success+=0x1;})[_0x5c2f('0x33')](function(_0x4d35b1){if(_0x4d35b1[_0x5c2f('0x1b')]){errors+=0x1;delete _0x4d35b1[_0x5c2f('0x1b')];}else if(_0x4d35b1[_0x5c2f('0x6e')]){duplicates+=0x1;delete _0x4d35b1[_0x5c2f('0x6e')];}rows[_0x5c2f('0x32')](_0x4d35b1);}));if(total%0xc8===0x0){_0x412241[_0x5c2f('0x6f')]();return processPromises(_0x412241);}},'complete':function(){return processPromises()[_0x5c2f('0x31')](function(){logger[_0x5c2f('0x69')](_0x5c2f('0x70'));endCsv();});},'error':function(_0x3e9959,_0x50d7c2){logger['info'](_0x5c2f('0x71'),JSON[_0x5c2f('0x35')](_0x3e9959));endCsv();}});})[_0x5c2f('0x33')](function(_0x28f468){logger[_0x5c2f('0x1b')](_0x5c2f('0x72'),JSON[_0x5c2f('0x35')](_0x28f468));});}main(); \ No newline at end of file +var _0xbffa=['createdAt','field','NOW()','scheduledAt','toString','updatedAt','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','from','\x20=\x20?','select','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','VoiceQueue','findAll','outbound','Lists','get','dialCheckDuplicateType','always','push','sequelize','VoiceQueueId','query','BlackLists','all','Campaign','CmList','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','CSV\x20import\x20process\x20stopped!','parse','duplicate','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','ioredis','../../../config/logger','api','redis','socket.io-emitter','register','argv','null','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','find','Duplicate\x20Contact','CmContact','create','keys','then','pick','catch','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','ContactId'];(function(_0x3a7066,_0x2ded9e){var _0x137504=function(_0x76a370){while(--_0x76a370){_0x3a7066['push'](_0x3a7066['shift']());}};_0x137504(++_0x2ded9e);}(_0xbffa,0x118));var _0xabff=function(_0x593822,_0x43d0b){_0x593822=_0x593822-0x0;var _0x58c413=_0xbffa[_0x593822];return _0x58c413;};'use strict';var BPromise=require(_0xabff('0x0'));var util=require(_0xabff('0x1'));var _=require(_0xabff('0x2'));var fs=require('fs');var squel=require(_0xabff('0x3'));var Papa=require('papaparse');var Redis=require(_0xabff('0x4'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require(_0xabff('0x5'))(_0xabff('0x6'));config[_0xabff('0x7')]=_['defaults'](config[_0xabff('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xabff('0x8'))(new Redis(config[_0xabff('0x7')]));require('../../../api/cmContact/cmContact.socket')[_0xabff('0x9')](socket);try{if(!process[_0xabff('0xa')][0x2]||process[_0xabff('0xa')][0x2]==='undefined'||process['argv'][0x2]===_0xabff('0xb')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0xabff('0xa')][0x2];if(!process[_0xabff('0xa')][0x3]||process[_0xabff('0xa')][0x3]===_0xabff('0xc')||process[_0xabff('0xa')][0x3]===_0xabff('0xb')||!process['argv'][0x4]||process[_0xabff('0xa')][0x4]===_0xabff('0xc')||process[_0xabff('0xa')][0x4]===_0xabff('0xb')){throw new Error(_0xabff('0xd'));}var FIELDS=_[_0xabff('0xe')](process[_0xabff('0xa')][0x3][_0xabff('0xf')](','),process[_0xabff('0xa')][0x4][_0xabff('0xf')](','));if(!process[_0xabff('0xa')][0x5]||process[_0xabff('0xa')][0x5]==='undefined'||process['argv'][0x5]===_0xabff('0xb')){throw new Error(_0xabff('0x10'));}var LISTID=process[_0xabff('0xa')][0x5];var COMPANYID=process[_0xabff('0xa')][0x6]&&process[_0xabff('0xa')][0x6]!=='undefined'&&process[_0xabff('0xa')][0x6]!==_0xabff('0xb')?process[_0xabff('0xa')][0x6]:null;var DUPLICATES=process[_0xabff('0xa')][0x7]&&process[_0xabff('0xa')][0x7]!==_0xabff('0xc')&&process['argv'][0x7]!==_0xabff('0xb')?process[_0xabff('0xa')][0x7]:null;if(!process['argv'][0x8]||process[_0xabff('0xa')][0x8]===_0xabff('0xc')||process[_0xabff('0xa')][0x8]===_0xabff('0xb')){throw new Error(_0xabff('0x11'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0xe79d04){logger[_0xabff('0x12')](_0xe79d04);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(_0x5d4f5a,_0x1f8059,_0x320df3,_0x23ea48){var _0x1b35d8={'message':_0x1f8059};_0x1b35d8[_0x5d4f5a]=!![];if(_0x320df3){_0x1b35d8[_0xabff('0x13')]=_0x320df3;}if(_0x23ea48){_0x1b35d8['index']=_0x23ea48;}return _0x1b35d8;}function isEmail(_0x49c7f8){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))*$/[_0xabff('0x14')](_0x49c7f8);}function checkRow(_0x40b91f,_0x2debb2,_0x5f5d87){return new BPromise(function(_0x347c19,_0x364c48){if(_[_0xabff('0x15')](_0x40b91f)){return _0x364c48(handleCheckRowError(_0xabff('0x12'),_0xabff('0x16'),null,_0x5f5d87));}if(_0x40b91f[_0xabff('0x17')]&&_0x40b91f[_0xabff('0x17')][_0xabff('0x18')]){var _0x1871cb=_[_0xabff('0x19')](_0x40b91f[_0xabff('0x17')],_0xabff('0x1a'))[_0xabff('0x1b')](';');return _0x364c48(handleCheckRowError('error',_0x1871cb,null,_0x5f5d87));}var _0x2bb78a={};for(var _0x3fbcf8 in FIELDS){if(FIELDS[_0xabff('0x1c')](_0x3fbcf8)&&FIELDS[_0x3fbcf8]){_0x2bb78a[_0x3fbcf8]=_0x40b91f[_0xabff('0x1d')][0x0][FIELDS[_0x3fbcf8]]||_0x40b91f['data'][0x0]['\ufeff'+FIELDS[_0x3fbcf8]];}}if(!_0x2bb78a['firstName']){return _0x364c48(handleCheckRowError(_0xabff('0x12'),_0xabff('0x1e'),null,_0x5f5d87));}if(!_0x2bb78a[_0xabff('0x1f')]){return _0x364c48(handleCheckRowError(_0xabff('0x12'),_0xabff('0x20'),null,_0x5f5d87));}if(_0x2bb78a[_0xabff('0x21')]){var _0x2ddb40=moment(_0x2bb78a[_0xabff('0x21')],'YYYY-MM-DD');if(!_0x2ddb40[_0xabff('0x22')]()){return _0x364c48(handleCheckRowError(_0xabff('0x12'),_0xabff('0x23'),null,_0x5f5d87));}}if(_0x2bb78a[_0xabff('0x24')]){if(!isEmail(_0x2bb78a[_0xabff('0x24')])){return _0x364c48(handleCheckRowError('error',_0xabff('0x25'),null,_0x5f5d87));}}_0x2bb78a[_0xabff('0x26')]=LISTID;_0x2bb78a['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xabff('0x18')]&&_0x2debb2){var _0x1fb907={};for(var _0x60eda5=0x0,_0x310476=DUPLICATES[_0xabff('0x18')];_0x60eda5<_0x310476;_0x60eda5+=0x1){_0x1fb907[DUPLICATES[_0x60eda5]]=_0x2bb78a[DUPLICATES[_0x60eda5]];}var _0x433bc5=_[_0xabff('0x27')](_0x2debb2,_0x1fb907);if(_0x433bc5){return _0x364c48(handleCheckRowError('duplicate',_0xabff('0x28'),_0x433bc5,_0x5f5d87));}}return db[_0xabff('0x29')][_0xabff('0x2a')](_0x2bb78a,{'raw':!![],'hooks':![],'fields':_[_0xabff('0x2b')](_0x2bb78a)})[_0xabff('0x2c')](function(_0x541e58){if(DUPLICATES&&DUPLICATES[_0xabff('0x18')]&&_0x2debb2){_0x2debb2['push'](_[_0xabff('0x2d')](_0x2bb78a,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x541e58['id'];return _0x347c19();})[_0xabff('0x2e')](function(_0x4a64bc){return _0x364c48(handleCheckRowError(_0xabff('0x12'),'Error\x20while\x20creating\x20contact:\x20'+(_0x4a64bc['message']||JSON[_0xabff('0x2f')](_0x4a64bc)),null,_0x5f5d87));});});}function checkHopper(){function _0x345312(){return function(_0x323f3f){logger[_0xabff('0x12')](_0xabff('0x30'),_0xabff('0x31'),util[_0xabff('0x32')](_0x323f3f,{'showHidden':![],'depth':null}));};}var _0x448ca7=function(_0x44a268,_0x1b51c7){var _0x2aa5fd=squel[_0xabff('0x33')]()[_0xabff('0x34')](_0xabff('0x35'))[_0xabff('0x36')]([_0xabff('0x1f'),'scheduledAt',_0xabff('0x37'),_0xabff('0x26'),_0x1b51c7,_0xabff('0x38'),'updatedAt'],squel['select']()[_0xabff('0x39')](_0xabff('0x1f'),_0xabff('0x1f'))[_0xabff('0x39')](_0xabff('0x3a'),_0xabff('0x3b'))['field']('id',_0xabff('0x37'))[_0xabff('0x39')](LISTID[_0xabff('0x3c')](),_0xabff('0x26'))[_0xabff('0x39')](_0x44a268['id'][_0xabff('0x3c')](),_0x1b51c7)['field'](_0xabff('0x3a'),_0xabff('0x38'))[_0xabff('0x39')]('NOW()',_0xabff('0x3d'))['from']('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0xabff('0x3e')]('ListId\x20=\x20?',LISTID[_0xabff('0x3c')]())[_0xabff('0x3e')](_0xabff('0x3f'))[_0xabff('0x3e')](_0xabff('0x40'),squel['select']()[_0xabff('0x39')](_0xabff('0x1f'))[_0xabff('0x41')]('cm_hopper')['where'](_0x1b51c7+_0xabff('0x42'),_0x44a268['id']['toString']())))[_0xabff('0x3c')]();return _0x2aa5fd;};var _0x3b4563=function(_0x411b76,_0x336a74){var _0x4881e6=squel[_0xabff('0x33')]()[_0xabff('0x34')](_0xabff('0x35'))[_0xabff('0x36')](['phone',_0xabff('0x3b'),_0xabff('0x37'),_0xabff('0x26'),_0x336a74,_0xabff('0x38'),_0xabff('0x3d')],squel[_0xabff('0x43')]()[_0xabff('0x39')]('phone',_0xabff('0x1f'))[_0xabff('0x39')](_0xabff('0x3a'),_0xabff('0x3b'))['field']('id',_0xabff('0x37'))['field'](LISTID[_0xabff('0x3c')](),'ListId')[_0xabff('0x39')](_0x411b76['id']['toString'](),_0x336a74)['field']('NOW()','createdAt')[_0xabff('0x39')](_0xabff('0x3a'),_0xabff('0x3d'))[_0xabff('0x41')](_0xabff('0x44'))['where'](_0xabff('0x45'))[_0xabff('0x3e')](_0xabff('0x46'),LISTID[_0xabff('0x3c')]())['where'](_0xabff('0x47'),squel[_0xabff('0x48')](hopperContacts))[_0xabff('0x3e')]('phone\x20IS\x20NOT\x20NULL')[_0xabff('0x3e')](_0xabff('0x40'),squel[_0xabff('0x43')]()[_0xabff('0x39')](_0xabff('0x49'))[_0xabff('0x41')](_0xabff('0x4a'))[_0xabff('0x3e')](_0x336a74+_0xabff('0x42'),_0x411b76['id'][_0xabff('0x3c')]()))[_0xabff('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel[_0xabff('0x43')]()['field']('phone')['from']('cm_hopper')[_0xabff('0x3e')](_0x336a74+_0xabff('0x42'),_0x411b76['id']['toString']())))[_0xabff('0x3c')]();return _0x4881e6;};function _0x2f8024(_0x5c0dcd,_0x2ddf86){var _0x232c49=squel[_0xabff('0x33')]()[_0xabff('0x34')](_0xabff('0x35'))['fromQuery']([_0xabff('0x1f'),'scheduledAt','ContactId','ListId',_0x2ddf86,_0xabff('0x38'),_0xabff('0x3d')],squel['select']()['field']('phone',_0xabff('0x1f'))[_0xabff('0x39')](_0xabff('0x3a'),_0xabff('0x3b'))[_0xabff('0x39')]('id',_0xabff('0x37'))['field'](LISTID['toString'](),'ListId')['field'](_0x5c0dcd['id'][_0xabff('0x3c')](),_0x2ddf86)[_0xabff('0x39')]('NOW()',_0xabff('0x38'))['field'](_0xabff('0x3a'),'updatedAt')[_0xabff('0x41')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0xabff('0x3e')](_0xabff('0x46'),LISTID[_0xabff('0x3c')]())[_0xabff('0x3e')](_0xabff('0x47'),squel[_0xabff('0x48')](hopperContacts))['where'](_0xabff('0x3f')))[_0xabff('0x3c')]();return _0x232c49;}function _0x547aa9(_0x2b0588,_0x33c0c6){var _0x5d28f1=squel[_0xabff('0x33')]()['into'](_0xabff('0x4b'))['fromQuery']([_0xabff('0x1f'),_0xabff('0x37'),_0xabff('0x26'),_0x33c0c6,_0xabff('0x38'),_0xabff('0x3d')],squel[_0xabff('0x43')]()[_0xabff('0x39')](_0xabff('0x1f'),'phone')[_0xabff('0x39')]('id',_0xabff('0x37'))[_0xabff('0x39')](LISTID[_0xabff('0x3c')](),_0xabff('0x26'))[_0xabff('0x39')](_0x2b0588['id'][_0xabff('0x3c')](),_0x33c0c6)['field']('NOW()',_0xabff('0x38'))[_0xabff('0x39')](_0xabff('0x3a'),_0xabff('0x3d'))[_0xabff('0x41')](_0xabff('0x44'))[_0xabff('0x3e')](_0xabff('0x45'))[_0xabff('0x3e')]('ListId\x20=\x20?',LISTID['toString']())['where'](_0xabff('0x47'),squel[_0xabff('0x48')](hopperContacts))[_0xabff('0x3e')](_0xabff('0x3f')))[_0xabff('0x3c')]();return _0x5d28f1;}return db[_0xabff('0x4c')][_0xabff('0x4d')]({'where':{'type':_0xabff('0x4e')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0xabff('0x4f'),'where':{'id':LISTID}}]})[_0xabff('0x2c')](function(_0x4dc607){var _0x44279b=[];if(_0x4dc607){var _0x100a48;for(var _0x5b41df=0x0,_0x36759a;_0x5b41df<_0x4dc607[_0xabff('0x18')];_0x5b41df+=0x1){_0x36759a=_0x4dc607[_0x5b41df][_0xabff('0x50')]({'plain':!![]});switch(_0x36759a[_0xabff('0x51')]){case _0xabff('0x52'):_0x44279b[_0xabff('0x53')](db[_0xabff('0x54')]['query'](_0x3b4563(_0x36759a,_0xabff('0x55')))[_0xabff('0x2c')](function(){})[_0xabff('0x2e')](_0x345312()));break;case'onlyIfOpen':_0x44279b[_0xabff('0x53')](db['sequelize'][_0xabff('0x56')](_0x448ca7(_0x36759a,_0xabff('0x55')))['then'](function(){})['catch'](_0x345312()));break;default:_0x44279b['push'](db[_0xabff('0x54')][_0xabff('0x56')](_0x2f8024(_0x36759a,_0xabff('0x55')))[_0xabff('0x2c')](function(){})[_0xabff('0x2e')](_0x345312()));}}}return _0x44279b;})['all']()[_0xabff('0x2c')](function(){return db[_0xabff('0x4c')][_0xabff('0x4d')]({'where':{'type':_0xabff('0x4e')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xabff('0x57'),'where':{'id':LISTID}}]})[_0xabff('0x2c')](function(_0x5dfb2c){var _0x4ef4d1=[];if(_0x5dfb2c){var _0x3452a0;for(var _0x29b478=0x0,_0x4c3894;_0x29b478<_0x5dfb2c[_0xabff('0x18')];_0x29b478+=0x1){_0x4c3894=_0x5dfb2c[_0x29b478][_0xabff('0x50')]({'plain':!![]});_0x4ef4d1[_0xabff('0x53')](db[_0xabff('0x54')]['query'](_0x547aa9(_0x4c3894,_0xabff('0x55')))[_0xabff('0x2c')](function(){})[_0xabff('0x2e')](_0x345312()));}}return _0x4ef4d1;})[_0xabff('0x58')]();})[_0xabff('0x2c')](function(){return db[_0xabff('0x59')]['findAll']({'attributes':['id',_0xabff('0x51')],'include':[{'model':db[_0xabff('0x5a')],'as':'Lists','where':{'id':LISTID}}]})[_0xabff('0x2c')](function(_0x5773ec){var _0x1eaeb=[];if(_0x5773ec){for(var _0x2a52f9=0x0,_0x14e7e2;_0x2a52f9<_0x5773ec['length'];_0x2a52f9+=0x1){_0x14e7e2=_0x5773ec[_0x2a52f9][_0xabff('0x50')]({'plain':!![]});switch(_0x14e7e2['dialCheckDuplicateType']){case'always':_0x1eaeb['push'](db['sequelize'][_0xabff('0x56')](_0x3b4563(_0x14e7e2,_0xabff('0x5b')))[_0xabff('0x2c')](function(){})[_0xabff('0x2e')](_0x345312()));break;case _0xabff('0x5c'):_0x1eaeb[_0xabff('0x53')](db[_0xabff('0x54')][_0xabff('0x56')](_0x448ca7(_0x14e7e2,_0xabff('0x5b')))[_0xabff('0x2c')](function(){})['catch'](_0x345312()));break;default:_0x1eaeb[_0xabff('0x53')](db[_0xabff('0x54')][_0xabff('0x56')](_0x2f8024(_0x14e7e2,_0xabff('0x5b')))['then'](function(){})[_0xabff('0x2e')](_0x345312()));}}}return _0x1eaeb;})['all']();})[_0xabff('0x2c')](function(){return db['Campaign']['findAll']({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xabff('0x57'),'where':{'id':LISTID}}]})[_0xabff('0x2c')](function(_0x166437){var _0x5381ae=[];if(_0x166437){for(var _0x2f2941=0x0,_0x25d50d;_0x2f2941<_0x166437[_0xabff('0x18')];_0x2f2941+=0x1){_0x25d50d=_0x166437[_0x2f2941]['get']({'plain':!![]});_0x5381ae[_0xabff('0x53')](db[_0xabff('0x54')]['query'](_0x547aa9(_0x25d50d,_0xabff('0x5b')))[_0xabff('0x2c')](function(){})[_0xabff('0x2e')](_0x345312()));}}return _0x5381ae;})['all']();})[_0xabff('0x2e')](function(_0x2bf67b){logger[_0xabff('0x12')](_0xabff('0x5d'),_0xabff('0x5e'),_0x2bf67b[_0xabff('0x1a')]);});}var processPromises=function(_0x14f94d){return BPromise[_0xabff('0x58')](promises)[_0xabff('0x2c')](function(_0x2148a0){})[_0xabff('0x2e')](function(_0x1e4d19){logger[_0xabff('0x12')](_0xabff('0x5f'),JSON[_0xabff('0x2f')](_0x1e4d19));})[_0xabff('0x60')](function(){socket[_0xabff('0x61')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x14f94d){return _0x14f94d[_0xabff('0x62')]();}});};var endCsv=function(){return BPromise[_0xabff('0x63')]()[_0xabff('0x2c')](function(){if(hopperContacts){return checkHopper();}})[_0xabff('0x2c')](function(){socket[_0xabff('0x61')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xabff('0x64')](FILEPATH);}catch(_0x5e1fd4){logger[_0xabff('0x12')](_0xabff('0x65'),JSON[_0xabff('0x2f')](_0x5e1fd4));}finally{process[_0xabff('0x66')](0x0);}});};process['on'](_0xabff('0x67'),function(){logger['info'](_0xabff('0x68'));endCsv();});function main(){return BPromise[_0xabff('0x63')]()[_0xabff('0x2c')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xabff('0xf')](',');return db[_0xabff('0x29')][_0xabff('0x4d')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x30348d){var _0x14af44=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xabff('0x69')](_0x14af44,{'header':!![],'skipEmptyLines':!![],'step':function(_0xc0ffc,_0x3b87bb){total+=0x1;var _0x37f35f=total;promises[_0xabff('0x53')](checkRow(_0xc0ffc,_0x30348d,_0x37f35f)[_0xabff('0x2c')](function(){success+=0x1;})[_0xabff('0x2e')](function(_0xfbc561){if(_0xfbc561[_0xabff('0x12')]){errors+=0x1;delete _0xfbc561[_0xabff('0x12')];}else if(_0xfbc561[_0xabff('0x6a')]){duplicates+=0x1;delete _0xfbc561['duplicate'];}rows[_0xabff('0x53')](_0xfbc561);}));if(total%0xc8===0x0){_0x3b87bb[_0xabff('0x6b')]();return processPromises(_0x3b87bb);}},'complete':function(){return processPromises()[_0xabff('0x2c')](function(){logger[_0xabff('0x6c')](_0xabff('0x6d'));endCsv();});},'error':function(_0x400d02,_0x3756d3){logger[_0xabff('0x6c')](_0xabff('0x6e'),JSON['stringify'](_0x400d02));endCsv();}});})['catch'](function(_0x12eeae){logger[_0xabff('0x12')](_0xabff('0x6f'),JSON[_0xabff('0x2f')](_0x12eeae));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index d4db04d..45dcfc1 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 _0x9ccb=['findAll','AdditionalPhones','then','push','all','split','length','isNil','CmContactHasItem','update','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','into','fromQuery','scheduledat','ListId','createdAt','updatedAt','UserId','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.ListId','ContactId','fields','field','cm_hopper_black','ListId\x20=\x20?','toString','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.UserId','priority','recallme','cm_hopper.id','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_hopper.ListId\x20=\x20?','concat','keys','CompanyId','scheduledAt','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','group','Received\x20SIGINT','message','errors','info','sequelize','query','spread','catch','error','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','voice_queues.id','voice_queues.dialTimezone','voice_queues_has_cm_lists','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','utcOffset','set','main','stringify','send','clone','socket_timestamp','root','.csv','header','name','_description','writeFileSync','createReadStream','data','rows','find','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','includes','email','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','hasOwnProperty','itemTypeId','description','appendFileSync','emit','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','voice_queues','CampaignId','finish','affectedRows','contact:import:','exit','complete','server/files/tmp','file\x20doesn\x27t\x20exists','parse','argv','binding','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','No\x20agent\x20available','uncaughtException','path','lodash','util','bluebird','moment','../../../mysqldb','../../../config/environment','import','redis','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact'];(function(_0x4db527,_0x67ac70){var _0x6997c1=function(_0x33454c){while(--_0x33454c){_0x4db527['push'](_0x4db527['shift']());}};_0x6997c1(++_0x67ac70);}(_0x9ccb,0x13e));var _0xb9cc=function(_0x25483f,_0x43852f){_0x25483f=_0x25483f-0x0;var _0x220d13=_0x9ccb[_0x25483f];return _0x220d13;};'use strict';var fs=require('fs');var path=require(_0xb9cc('0x0'));var _=require(_0xb9cc('0x1'));var Papa=require('papaparse');var util=require(_0xb9cc('0x2'));var BPromise=require(_0xb9cc('0x3'));var moment=require(_0xb9cc('0x4'));var squel=require('squel');var Redis=require('ioredis');var db=require(_0xb9cc('0x5'))['db'];var config=require(_0xb9cc('0x6'));var shared=require('../../../config/environment/shared');var logger=require('../../../config/logger')(_0xb9cc('0x7'));config[_0xb9cc('0x8')]=_['defaults'](config[_0xb9cc('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xb9cc('0x9'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xb9cc('0xa')](_0xb9cc('0xb'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xb9cc('0xa')](_0xb9cc('0xb'));function isEmail(_0x1a8a72){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))*$/[_0xb9cc('0xc')](_0x1a8a72);}function selectNotIn(_0x74c4ef,_0x5642cd,_0x2ac93d,_0x402f54,_0x2bea69){return squel[_0xb9cc('0xd')]()['field'](_0xb9cc('0xe'))[_0xb9cc('0xf')](_0x402f54)[_0xb9cc('0x10')](_0x5642cd,null,_0x5642cd+_0xb9cc('0x11')+_0x402f54+'.'+_0x2ac93d)[_0xb9cc('0x12')](_0x402f54+'.'+_0x2ac93d+_0xb9cc('0x13')+_0x74c4ef+'.'+_0x2ac93d)[_0xb9cc('0x12')](_0x5642cd+_0xb9cc('0x14')+_0x2bea69['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x55c872,_0x4b476e){promisesAdditionalPhones=[];return db[_0xb9cc('0x15')][_0xb9cc('0x16')]({'raw':!![],'attributes':['id',_0xb9cc('0x17')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xb9cc('0x18')](function(_0x2b50ac){if(_0x2b50ac!==null){var _0x1b93ed=[];for(var _0x5ed865=0x0;_0x5ed865<_0x2b50ac['length'];_0x5ed865++){var _0x157909=_0x2b50ac[_0x5ed865];_0x1b93ed[_0xb9cc('0x19')](insertAdditionalPhones(_0x157909));}}Promise[_0xb9cc('0x1a')](_0x1b93ed)['then'](function(){_0x55c872({'val':0x1});});});});}function insertAdditionalPhones(_0x49dd4a){return new Promise(function(_0x5092d4,_0x30cf76){var _0x1fed48=_0x49dd4a[_0xb9cc('0x17')];var _0x159d1e=_0x1fed48[_0xb9cc('0x1b')](';');var _0x1a66cf=[];orderBy=0x0;for(var _0x25604e=0x0;_0x25604e<_0x159d1e['length'];_0x25604e++){_0x1a66cf[_0xb9cc('0x19')](splitAdditionalPhone(_0x49dd4a['id'],_0x159d1e[_0x25604e]));}Promise['all'](_0x1a66cf)[_0xb9cc('0x18')](function(){_0x5092d4({'val':_0x159d1e[_0xb9cc('0x1c')]});});});}function splitAdditionalPhone(_0x330353,_0xa61fd7){return new Promise(function(_0x32a5c5,_0x2c9542){var _0xbff09=_0xa61fd7[_0xb9cc('0x1b')](':');var _0x50d862=_0xbff09[0x0];var _0x6e3165=_0xbff09[0x1];if(!_[_0xb9cc('0x1d')](_0x6e3165)){var _0x409f3c=_0x6e3165[_0xb9cc('0x1b')]('|');var _0x1337c2=[];for(var _0xfa3e1a=0x0;_0xfa3e1a<_0x409f3c[_0xb9cc('0x1c')];_0xfa3e1a++){if(_0x409f3c[_0xfa3e1a]!==''){var _0x2c8759=_['filter'](promisesAdditionalPhones,{'contactId':_0x330353,'phone':_0x409f3c[_0xfa3e1a]});if(_0x2c8759[_0xb9cc('0x1c')]==0x0){orderBy++;promisesAdditionalPhones[_0xb9cc('0x19')]({'contactId':_0x330353,'contactTypeId':_0x50d862,'phone':_0x409f3c[_0xfa3e1a],'orderBy':orderBy});}}}_0x32a5c5({'ok':0x1});}else _0x32a5c5({'res':0x0});});}function createAdditionalPhone(_0x5c0ac8,_0x4e6b38,_0x150895,_0x36575d){var _0x850663='';var _0x4aeace='';var _0x8acf13=_0x150895['split']('§');_0x850663=_0x8acf13[0x0];if(_0x8acf13[_0xb9cc('0x1c')]==0x2)_0x4aeace=_0x8acf13[0x1];return new Promise(function(_0x2ecccf,_0xb3bf0c){return db['CmContactHasItem']['findOne']({'where':{'CmContactId':_0x5c0ac8,'item':_0x850663}})[_0xb9cc('0x18')](function(_0x1f3718){if(_0x1f3718){return db[_0xb9cc('0x1e')][_0xb9cc('0x1f')]({'ItemTypeId':_0x4e6b38,'description':_0x4aeace,'OrderBy':_0x36575d},{'where':{'CmContactId':_0x5c0ac8,'item':_0x850663}})[_0xb9cc('0x18')](function(_0x4ac621){_0x2ecccf({'res':_0xb9cc('0x20')});});}else{return db[_0xb9cc('0x1e')][_0xb9cc('0x21')]({'CmContactId':_0x5c0ac8,'item':_0x850663,'description':_0x4aeace,'ItemTypeId':_0x4e6b38,'OrderBy':_0x36575d,'ItemClass':_0xb9cc('0x22')})['then'](function(_0x35d64d){_0x2ecccf({'res':_0xb9cc('0x23')});});}});});}function insertCmHopper(_0x2a251d,_0x1a0f2b,_0x19ed6a,_0x236990,_0x2b3a17){var _0x3593b4=[_0xb9cc('0x24'),_0xb9cc('0x25'),_0xb9cc('0x26'),'cm_contacts.ListId',_0x1a0f2b+'.'+_0x236990,_0xb9cc('0x27'),_0xb9cc('0x28'),_0xb9cc('0x29'),'cm_contacts.UserId','\x22'+_0x2b3a17+'\x22'];return squel[_0xb9cc('0x2a')]()[_0xb9cc('0x2b')]('cm_hopper')[_0xb9cc('0x2c')]([_0xb9cc('0xe'),_0xb9cc('0x2d'),'ContactId',_0xb9cc('0x2e'),_0x236990,_0xb9cc('0x2f'),_0xb9cc('0x30'),'priority',_0xb9cc('0x31'),'recallme'],squel[_0xb9cc('0xd')]()['fields'](_0x3593b4)[_0xb9cc('0xf')](_0x1a0f2b)[_0xb9cc('0x10')](_0xb9cc('0x32'),null,_0xb9cc('0x33')+_0x1a0f2b+_0xb9cc('0x34'))[_0xb9cc('0x10')](_0x19ed6a,null,_0x19ed6a+_0xb9cc('0x11')+_0x1a0f2b+'.'+_0x236990)[_0xb9cc('0x12')](_0x1a0f2b+_0xb9cc('0x35'),_0x2a251d)[_0xb9cc('0x12')](_0xb9cc('0x36'),NOW)[_0xb9cc('0x12')](_0xb9cc('0x37'),selectNotIn(_0x1a0f2b,_0x19ed6a,_0x236990,_0xb9cc('0x38'),[_0xb9cc('0x39'),_0xb9cc('0x3a')]))['where'](_0xb9cc('0x37'),selectNotIn(_0x1a0f2b,_0x19ed6a,_0x236990,'cm_hopper',['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0xe9a75c,_0x423a8e,_0x47c431,_0x361a72){var _0x27dc7e=[_0xb9cc('0x24'),'cm_contacts.id',_0xb9cc('0x3b'),_0x423a8e+'.'+_0x361a72,_0xb9cc('0x27'),_0xb9cc('0x28')];return squel[_0xb9cc('0x2a')]()['into']('cm_hopper_black')[_0xb9cc('0x2c')]([_0xb9cc('0xe'),_0xb9cc('0x3c'),'ListId',_0x361a72,_0xb9cc('0x2f'),_0xb9cc('0x30')],squel[_0xb9cc('0xd')]()[_0xb9cc('0x3d')](_0x27dc7e)[_0xb9cc('0xf')](_0x423a8e)['join'](_0xb9cc('0x32'),null,_0xb9cc('0x33')+_0x423a8e+_0xb9cc('0x34'))[_0xb9cc('0x10')](_0x47c431,null,_0x47c431+_0xb9cc('0x11')+_0x423a8e+'.'+_0x361a72)[_0xb9cc('0x12')](_0x423a8e+_0xb9cc('0x35'),_0xe9a75c)[_0xb9cc('0x12')](_0xb9cc('0x36'),NOW)[_0xb9cc('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xb9cc('0xd')]()[_0xb9cc('0x3e')]('phone')[_0xb9cc('0xf')](_0xb9cc('0x3f'))['where'](_0xb9cc('0x40'),_0xe9a75c)[_0xb9cc('0x12')](_0x361a72+_0xb9cc('0x13')+_0x423a8e+'.'+_0x361a72)))[_0xb9cc('0x41')]();}function insertTzCmHopper(_0x5f364c,_0x1bf5aa,_0x3bb90a,_0x1d128a,_0x2eb5cc,_0x430ccd){var _0x119af9=['cm_contacts.phone',_0xb9cc('0x42')+_0x430ccd+_0xb9cc('0x43'),_0xb9cc('0x26'),_0xb9cc('0x3b'),_0x1bf5aa+'.'+_0x1d128a,_0xb9cc('0x27'),_0xb9cc('0x28'),_0xb9cc('0x29'),_0xb9cc('0x44'),'\x22'+_0x2eb5cc+'\x22'];var _0x19c663=squel['insert']()[_0xb9cc('0x2b')]('cm_hopper')[_0xb9cc('0x2c')]([_0xb9cc('0xe'),'scheduledat','ContactId',_0xb9cc('0x2e'),_0x1d128a,_0xb9cc('0x2f'),'updatedAt',_0xb9cc('0x45'),_0xb9cc('0x31'),_0xb9cc('0x46')],squel['select']()[_0xb9cc('0x3d')](_0x119af9)[_0xb9cc('0xf')](_0x1bf5aa)['join'](_0xb9cc('0x32'),null,_0xb9cc('0x33')+_0x1bf5aa+'.CmListId')[_0xb9cc('0x10')](_0x3bb90a,null,_0x3bb90a+_0xb9cc('0x11')+_0x1bf5aa+'.'+_0x1d128a)[_0xb9cc('0x10')](_0x430ccd,null,_0x430ccd+'.id\x20=\x20'+_0x1bf5aa+'.'+_0x1d128a)[_0xb9cc('0x12')](_0x1bf5aa+'.CmListId\x20=\x20?',_0x5f364c)[_0xb9cc('0x12')](_0xb9cc('0x36'),NOW)[_0xb9cc('0x12')](_0xb9cc('0x37'),selectNotIn(_0x1bf5aa,_0x3bb90a,_0x1d128a,_0xb9cc('0x38'),[_0xb9cc('0x39'),_0xb9cc('0x3a')]))[_0xb9cc('0x12')](_0xb9cc('0x37'),selectNotIn(_0x1bf5aa,_0x3bb90a,_0x1d128a,'cm_hopper',[_0xb9cc('0x39')])))[_0xb9cc('0x41')]();return _0x19c663;}function insertTzCmHopperBlack(_0xb02ab7,_0x3a2014,_0x22708b,_0x4b6694){var _0x7a084f=[_0xb9cc('0x24'),_0xb9cc('0x26'),_0xb9cc('0x3b'),_0x3a2014+'.'+_0x4b6694,_0xb9cc('0x27'),'cm_contacts.updatedAt'];return squel[_0xb9cc('0x2a')]()['into']('cm_hopper_black')[_0xb9cc('0x2c')]([_0xb9cc('0xe'),_0xb9cc('0x3c'),_0xb9cc('0x2e'),_0x4b6694,'createdAt',_0xb9cc('0x30')],squel[_0xb9cc('0xd')]()[_0xb9cc('0x3d')](_0x7a084f)[_0xb9cc('0xf')](_0x3a2014)[_0xb9cc('0x10')]('cm_contacts',null,_0xb9cc('0x33')+_0x3a2014+_0xb9cc('0x34'))['join'](_0x22708b,null,_0x22708b+_0xb9cc('0x11')+_0x3a2014+'.'+_0x4b6694)[_0xb9cc('0x12')](_0x3a2014+_0xb9cc('0x35'),_0xb02ab7)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0xb9cc('0x12')](_0xb9cc('0x37'),squel[_0xb9cc('0xd')]()[_0xb9cc('0x3e')](_0xb9cc('0xe'))[_0xb9cc('0xf')](_0xb9cc('0x3f'))['where'](_0xb9cc('0x40'),_0xb02ab7)[_0xb9cc('0x12')](_0x4b6694+_0xb9cc('0x13')+_0x3a2014+'.'+_0x4b6694)))['toString']();}function insertCmHopperAdditionalPhones(_0x34a473){var _0x18043d=[_0xb9cc('0x47'),'cm_contact_has_items.item','cm_contact_has_items.OrderBy',_0xb9cc('0x48'),_0xb9cc('0x49')];return squel[_0xb9cc('0x2a')]()[_0xb9cc('0x2b')](_0xb9cc('0x4a'))['fromQuery'](['CmHopperId',_0xb9cc('0xe'),_0xb9cc('0x4b'),_0xb9cc('0x2f'),_0xb9cc('0x30')],squel[_0xb9cc('0xd')]()[_0xb9cc('0x3d')](_0x18043d)['from'](_0xb9cc('0x38'))['join'](_0xb9cc('0x32'),null,_0xb9cc('0x4c'))[_0xb9cc('0x10')](_0xb9cc('0x4d'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0xb9cc('0x12')](_0xb9cc('0x4e'),_0x34a473)[_0xb9cc('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0xb9cc('0x41')]();}function insertCmContact(_0x4ccdd7,_0x3e1a13,_0x68eaad,_0x8a4991){var _0x45fe65=_[_0xb9cc('0x4f')](_[_0xb9cc('0x50')](_0x8a4991),[_0xb9cc('0x2e'),_0xb9cc('0x51'),'createdAt',_0xb9cc('0x30'),_0xb9cc('0x52')]);return squel[_0xb9cc('0x2a')]()['into'](_0xb9cc('0x32'))[_0xb9cc('0x2c')](_0x45fe65,squel['select']()[_0xb9cc('0x3d')](_0x45fe65)['from'](_0x3e1a13)[_0xb9cc('0x12')]('('+_0x68eaad[_0xb9cc('0x10')](',')+')\x20NOT\x20IN\x20?',squel[_0xb9cc('0xd')]()[_0xb9cc('0x3d')](_0x68eaad)['from']('cm_contacts')[_0xb9cc('0x12')](_0xb9cc('0x40'),_0x4ccdd7)['where'](_0xb9cc('0x53')))['where'](_0xb9cc('0x54'),squel['select']()['field']('MIN(id)',_0xb9cc('0x55'))[_0xb9cc('0xf')](_0x3e1a13)[_0xb9cc('0x56')](_0x68eaad['join'](','))))[_0xb9cc('0x41')]();}function handleStop(){logger['info'](_0xb9cc('0x57'));stopped=!![];}function handleUncaughtException(_0xaae4db){logger['error'](_0xaae4db[_0xb9cc('0x58')]);process['exit'](0x1);}function handleError(_0x4fceca,_0x14db62){stats[_0xb9cc('0x59')]['push']({'name':_0x14db62['code'],'message':_0x14db62[_0xb9cc('0x58')],'row':_0x4fceca});}function handleQuery(_0xc27837){logger[_0xb9cc('0x5a')](_0xc27837);return db[_0xb9cc('0x5b')][_0xb9cc('0x5c')](_0xc27837)[_0xb9cc('0x5d')](function(_0x3bd942){results[_0xb9cc('0x19')](_0x3bd942);})[_0xb9cc('0x5e')](function(_0x5365c9){logger[_0xb9cc('0x5f')](_0x5365c9[_0xb9cc('0x58')]);});}function updateTzCampaigns(_0x3bd9a6){return new Promise(function(_0x2743d8,_0x64fae3){var _0x83f361=squel['select']()[_0xb9cc('0x3d')](['campaigns.id','campaigns.dialTimezone'])[_0xb9cc('0xf')](_0xb9cc('0x60'))[_0xb9cc('0x10')](_0xb9cc('0x61'),null,_0xb9cc('0x62'))[_0xb9cc('0x12')](_0xb9cc('0x63')+_0x3bd9a6);db[_0xb9cc('0x5b')][_0xb9cc('0x5c')](_0x83f361[_0xb9cc('0x41')]())[_0xb9cc('0x5d')](function(_0x1cb8b9){var _0x5c0bb0=[];for(var _0x37322b=0x0;_0x37322b<_0x1cb8b9[_0xb9cc('0x1c')];_0x37322b++){_0x5c0bb0['push'](getTimezoneData(_0x1cb8b9[_0x37322b],tmp_campaigns));}BPromise[_0xb9cc('0x1a')](_0x5c0bb0)['then'](function(){_0x2743d8({'val':0x1});});})['catch'](function(_0x374f3a){logger[_0xb9cc('0x5f')](_0x374f3a[_0xb9cc('0x58')]);_0x2743d8({'val':0x0});});});}function updateTzVoiceQueues(_0x54cafc){return new Promise(function(_0x4859cc,_0x6a7a41){var _0x461d4d=squel[_0xb9cc('0xd')]()['fields']([_0xb9cc('0x64'),_0xb9cc('0x65')])[_0xb9cc('0xf')]('voice_queues')[_0xb9cc('0x10')](_0xb9cc('0x66'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0xb9cc('0x12')](_0xb9cc('0x67')+_0x54cafc);db[_0xb9cc('0x5b')][_0xb9cc('0x5c')](_0x461d4d[_0xb9cc('0x41')]())[_0xb9cc('0x5d')](function(_0x5ff7a3){var _0x22e60f=[];for(var _0x118fc4=0x0;_0x118fc4<_0x5ff7a3[_0xb9cc('0x1c')];_0x118fc4++){_0x22e60f[_0xb9cc('0x19')](getTimezoneData(_0x5ff7a3[_0x118fc4],tmp_voice_queues));}BPromise['all'](_0x22e60f)[_0xb9cc('0x18')](function(){_0x4859cc({'val':0x1});});})[_0xb9cc('0x5e')](function(_0x5bb62f){logger[_0xb9cc('0x5f')](_0x5bb62f['message']);_0x4859cc({'val':0x0});});});}function getTimezoneData(_0x42bbad,_0x3305a1){return new Promise(function(_0x38ad46,_0x4960f1){var _0x345da3=shared[_0xb9cc('0x68')];var _0x3bddd8=_0x345da3[_0x42bbad[_0xb9cc('0x69')]];if(_[_0xb9cc('0x1d')](_0x3bddd8)){_0x38ad46({'ret':0x1});}else{var _0x53dd51=_0x3bddd8[_0xb9cc('0x6a')];var _0x3731a5=squel[_0xb9cc('0x2a')]()[_0xb9cc('0x2b')](_0x3305a1)[_0xb9cc('0x6b')]('id',_0x42bbad['id'])['set']('offset',_0x53dd51)[_0xb9cc('0x6b')](_0xb9cc('0x69'),_0x42bbad[_0xb9cc('0x69')])['toString']();return db[_0xb9cc('0x5b')]['query'](_0x3731a5)[_0xb9cc('0x5d')](function(_0x22f8bf){_0x38ad46({'ret':0x1});})['catch'](function(_0x23dcb0){logger[_0xb9cc('0x5f')](_0x23dcb0[_0xb9cc('0x58')]);_0x4960f1({'ret':0x1});});}});}function handleTZQuery(_0x891e20){logger[_0xb9cc('0x5a')](_0x891e20);return db[_0xb9cc('0x5b')][_0xb9cc('0x5c')](_0x891e20)[_0xb9cc('0x5d')](function(_0x444e87){})[_0xb9cc('0x5e')](function(_0x10d9b5){logger['error'](_0x10d9b5[_0xb9cc('0x58')]);});}function main(_0x11b68c,_0x271197,_0x4eea24,_0x2424f7){logger[_0xb9cc('0x5a')](_0xb9cc('0x6c'),_0x11b68c,JSON[_0xb9cc('0x6d')](_0x271197));process[_0xb9cc('0x6e')]('start');var _0x2ca09e=_0x271197['binding'];var _0x388cda=_[_0xb9cc('0x6f')](_0x2ca09e);var _0x1bad89=_0x271197[_0xb9cc('0x70')];var _0x54b027=path[_0xb9cc('0x10')](config[_0xb9cc('0x71')],'server/files/tmp',_0x1bad89+_0xb9cc('0x72'));hasTZ=_[_0xb9cc('0x50')](_0x2ca09e)['includes'](_0xb9cc('0x69'));var _0x597413=_[_0xb9cc('0x50')](_0x2ca09e)[_0xb9cc('0x10')]();logger[_0xb9cc('0x5a')](_0xb9cc('0x73'),_0x597413);db['ContactItemType'][_0xb9cc('0x16')]({'raw':!![],'attributes':['id','name']})[_0xb9cc('0x18')](function(_0x5594b0){for(var _0x481868=0x0;_0x481868<_0x5594b0[_0xb9cc('0x1c')];_0x481868++){if(_0x5594b0[_0x481868][_0xb9cc('0x74')]in _0x2ca09e){contactItemTypes[_0xb9cc('0x19')](_0x5594b0[_0x481868]);delete _0x388cda[_0x5594b0[_0x481868][_0xb9cc('0x74')]];hasAdditionalPhones=!![];}for(var _0x5831c9 in _0x2ca09e){if(_0x5594b0[_0x481868][_0xb9cc('0x74')]+_0xb9cc('0x75')===_0x5831c9){phoneDescriptions['push']({'itemTypeId':_0x5594b0[_0x481868]['id'],'description':_0x5831c9});delete _0x388cda[_0x5831c9];}}}if(hasAdditionalPhones)_0x388cda[_0xb9cc('0x17')]='';var _0x44f4ce=_[_0xb9cc('0x50')](_0x388cda)[_0xb9cc('0x10')]();logger['info'](_0xb9cc('0x73'),_0x44f4ce);fs[_0xb9cc('0x76')](_0x54b027,_0x44f4ce+'\x0a');Papa['parse'](fs[_0xb9cc('0x77')](_0x11b68c),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5bf1cd,_0x22d8fc){try{for(var _0x4442a9=0x0,_0x188691=[];_0x4442a9<_0x5bf1cd[_0xb9cc('0x78')][_0xb9cc('0x1c')];_0x4442a9++){stats[_0xb9cc('0x79')]+=0x1;if(_0x5bf1cd[_0xb9cc('0x59')][_0x4442a9]){handleError(_0x5bf1cd[_0xb9cc('0x78')][_0x4442a9],_0x5bf1cd[_0xb9cc('0x59')][_0x4442a9]);}else{var _0x27f7b8=[];var _0x6eab27=[];var _0x17f919={};for(var _0xd55cfa in _0x2ca09e){let _0x18e7c2=contactItemTypes[_0xb9cc('0x7a')](_0x4ba1ac=>_0x4ba1ac[_0xb9cc('0x74')]===_0xd55cfa);let _0x221fe2=contactItemTypes[_0xb9cc('0x7a')](_0x37dc2f=>_0x37dc2f[_0xb9cc('0x74')]+_0xb9cc('0x75')===_0xd55cfa);if(_[_0xb9cc('0x1d')](_0x18e7c2)&&_[_0xb9cc('0x1d')](_0x221fe2)){if(_0x2ca09e['hasOwnProperty'](_0xd55cfa)){if(_0x5bf1cd[_0xb9cc('0x78')][_0x4442a9][_0x2ca09e[_0xd55cfa]]){var _0x36d712=_[_0xb9cc('0x7b')](_0x5bf1cd['data'][_0x4442a9][_0x2ca09e[_0xd55cfa]][_0xb9cc('0x7c')](/"/g,'\x27'));switch(_0xd55cfa){case'scheduledat':var _0xa08b75=moment(_0x36d712,_0xb9cc('0xb'),!![]);if(_0xa08b75['isValid']()){_0x188691[_0xb9cc('0x19')]('\x22'+_0x36d712+'\x22');}else{_0x27f7b8[_0xb9cc('0x19')](_0xb9cc('0x7d'));}break;case _0xb9cc('0x45'):var _0x4b4205=parseInt(_0x36d712);_0x36d712=_[_0xb9cc('0x7e')](_0x4b4205)||_0x4b4205<0x0||_0x4b4205>0x4?_0x2424f7?0x3:0x2:_0x4b4205;_0x188691[_0xb9cc('0x19')]('\x22'+_0x36d712+'\x22');break;case _0xb9cc('0x31'):var _0x5a6464=parseInt(_0x36d712);if(_['isNumber'](_0x5a6464)&&_[_0xb9cc('0x7f')](_0x4eea24,_0x5a6464)){_0x188691[_0xb9cc('0x19')]('\x22'+_0x5a6464+'\x22');}else{_0x27f7b8[_0xb9cc('0x19')]('agent\x20not\x20exists');}break;case _0xb9cc('0x80'):if(isEmail(_0x36d712)){_0x188691[_0xb9cc('0x19')]('\x22'+_0x36d712+'\x22');}else{_0x27f7b8['push']('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x29a47c=moment(_0x36d712,'YYYY-MM-DD',!![]);if(_0x29a47c[_0xb9cc('0x81')]()){_0x188691['push']('\x22'+_0x36d712+'\x22');}else{_0x27f7b8[_0xb9cc('0x19')](_0xb9cc('0x82'));}break;case _0xb9cc('0x69'):var _0x36a4fd=shared[_0xb9cc('0x68')];var _0x1c7dbe=_0x36a4fd[_0x36d712];if(!_[_0xb9cc('0x1d')](_0x1c7dbe)){var _0x233dbb=_0x1c7dbe[_0xb9cc('0x6a')];_0x188691[_0xb9cc('0x19')]('\x22'+_0x36d712+'\x22');_0x188691[_0xb9cc('0x19')]('\x22'+_0x233dbb+'\x22');}break;default:_0x188691[_0xb9cc('0x19')]('\x22'+_0x36d712+'\x22');}}else{switch(_0xd55cfa){case'firstName':case _0xb9cc('0xe'):_0x27f7b8['push'](_0xd55cfa+_0xb9cc('0x83'));break;default:_0x188691[_0xb9cc('0x19')]('\x22\x22');}}}}else{var _0x180226='';if(!_[_0xb9cc('0x1d')](_0x18e7c2)){if(!_0x17f919[_0xb9cc('0x84')](_0x18e7c2['id'])){if(!_[_0xb9cc('0x1d')](_0x5bf1cd[_0xb9cc('0x78')][_0x4442a9][_0x2ca09e[_0xd55cfa]])){var _0x36d712=_[_0xb9cc('0x7b')](_0x5bf1cd[_0xb9cc('0x78')][_0x4442a9][_0x2ca09e[_0xd55cfa]][_0xb9cc('0x7c')](/"/g,'\x27'));var _0x5522c0=phoneDescriptions[_0xb9cc('0x7a')](_0x10cdba=>_0x10cdba[_0xb9cc('0x85')]===_0x18e7c2['id']);if(!_[_0xb9cc('0x1d')](_0x5522c0)){var _0x25d48b=_['trim'](_0x5bf1cd['data'][_0x4442a9][_0x2ca09e[_0x5522c0[_0xb9cc('0x86')]]]['replace'](/"/g,'\x27'));if(!_[_0xb9cc('0x1d')](_0x25d48b))_0x36d712=_0x36d712+'§'+_0x25d48b;}if(_0x180226=='')_0x180226=_0x36d712;else _0x180226+='|'+_0x36d712;}_0x6eab27[_0xb9cc('0x19')](_0x18e7c2['id']+':'+_0x180226);_0x17f919[_0x18e7c2['id']]=0x1;}}}}if(hasAdditionalPhones){_0x188691[_0xb9cc('0x19')]('\x22'+_0x6eab27[_0xb9cc('0x10')](';')+'\x22');}if(_0x27f7b8[_0xb9cc('0x1c')]){handleError(_0x5bf1cd[_0xb9cc('0x78')][_0x4442a9],{'code':'SystemRow','message':_0x27f7b8[_0xb9cc('0x10')]()});}else{fs[_0xb9cc('0x87')](_0x54b027,_0x188691[_0xb9cc('0x10')]()+'\x0a');}_0x188691=[];}if(!(stats[_0xb9cc('0x79')]%0xc8)){socket[_0xb9cc('0x88')]('contact:import:'+_0x1bad89,stats);stats[_0xb9cc('0x59')]=[];}}if(stopped){logger[_0xb9cc('0x5a')](_0xb9cc('0x89'));_0x22d8fc[_0xb9cc('0x8a')]();}}catch(_0x11e8db){handleError(_0x5bf1cd[_0xb9cc('0x78')][_0x4442a9],{'code':_0xb9cc('0x8b'),'message':_0x11e8db[_0xb9cc('0x58')]});logger[_0xb9cc('0x5f')](_0xb9cc('0x8c'),_0x11e8db[_0xb9cc('0x58')]);}},'complete':function(){try{var _0x24ee41=[];var _0x41d300=[];var _0xa858f1=_0xb9cc('0x32');if(_0x271197[_0xb9cc('0x8d')]&&_0x271197[_0xb9cc('0x8d')]['length']){_0xa858f1=_0xb9cc('0x8e')+_0x1bad89;_0x24ee41['push'](_0xb9cc('0x8f')+_0xa858f1+'\x20LIKE\x20cm_contacts;');}tmp_campaigns='campaigns_'+_0x1bad89;tmp_voice_queues=_0xb9cc('0x90')+_0x1bad89;_0x41d300['push'](_0xb9cc('0x8f')+tmp_campaigns+_0xb9cc('0x91'));_0x41d300[_0xb9cc('0x19')](_0xb9cc('0x8f')+tmp_voice_queues+_0xb9cc('0x91'));BPromise[_0xb9cc('0x92')](_0x41d300,handleTZQuery)['then'](function(_0x3a92ab){updateTzCampaigns(_0x271197[_0xb9cc('0x2e')])[_0xb9cc('0x18')](function(_0x168f7d){updateTzVoiceQueues(_0x271197[_0xb9cc('0x2e')])[_0xb9cc('0x18')](function(_0x1c7be3){if(hasTZ)_0x44f4ce=_0x44f4ce[_0xb9cc('0x7c')](_0xb9cc('0x69'),'dialTimezone,utcOffset');var _0x2d46f0=util[_0xb9cc('0xa')]('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',_0x54b027,_0xa858f1,_0x44f4ce,_0x271197[_0xb9cc('0x2e')],_0x271197['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x2ca09e[_0xb9cc('0x2d')])){_0x2d46f0+=_0xb9cc('0x93');}_0x24ee41[_0xb9cc('0x19')](_0x2d46f0);if(_0x271197[_0xb9cc('0x8d')]&&_0x271197[_0xb9cc('0x8d')][_0xb9cc('0x1c')]){_0x24ee41[_0xb9cc('0x19')](insertCmContact(_0x271197[_0xb9cc('0x2e')],_0xa858f1,_0x271197[_0xb9cc('0x8d')],_0x2ca09e));_0x24ee41[_0xb9cc('0x19')](_0xb9cc('0x94')+_0xa858f1+';');}BPromise['each'](_0x24ee41,handleQuery)['then'](function(_0x4e8029){BPromise[_0xb9cc('0x1a')]([handleAdditionalPhones()])[_0xb9cc('0x18')](function(){_0x24ee41=[];for(var _0x494fbd=0x0;_0x494fbd\x20\x20');}var _0x4e829c=path['join'](config[_0xb9cc('0x71')],_0xb9cc('0xa1'),process['argv'][0x2]);if(!fs['existsSync'](_0x4e829c)){throw new Error(_0xb9cc('0xa2'));}var _0x5f4494={};try{_0x5f4494=JSON[_0xb9cc('0xa3')](process[_0xb9cc('0xa4')][0x3]);if(!_0x5f4494[_0xb9cc('0xa5')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x5f4494['binding'][_0xb9cc('0xe')]){throw new Error(_0xb9cc('0xa6'));}if(!_0x5f4494[_0xb9cc('0xa5')]['firstName']){throw new Error('firstName\x20is\x20mandatory');}var _0x56dc85=0x0;if(_0x5f4494['binding']['UserId']){_0x56dc85=0x1;}if(!_0x5f4494['ListId']){throw new Error(_0xb9cc('0xa7'));}}catch(_0x3f6b05){throw new Error('body\x20id\x20mandatory');}var _0x253ab4=[];try{_0x253ab4=_['map'](JSON[_0xb9cc('0xa3')](process['argv'][0x4]),'id');}catch(_0x40a25e){logger[_0xb9cc('0x5a')](_0xb9cc('0xa8'));}main(_0x4e829c,_0x5f4494,_0x253ab4,_0x56dc85);}validate();process['on']('SIGINT',handleStop);process['on'](_0xb9cc('0xa9'),handleUncaughtException); \ No newline at end of file +var _0xfe0a=['writeFileSync','parse','rows','data','find','trim','replace','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','hasOwnProperty','itemTypeId','description','SystemRow','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','CREATE\x20TABLE\x20','campaigns_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset',',\x20scheduledAt\x20=\x20NOW()','contactId','contactTypeId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','voice_queues_has_cm_lists','DROP\x20TABLE\x20','affectedRows','unlink','exit','complete','argv','arguments\x20\x20\x20','existsSync','binding\x20doesn\x27t\x20exists','binding','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','lodash','papaparse','util','bluebird','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','from','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','AdditionalPhones','then','length','push','all','split','isNil','filter','findOne','CmContactHasItem','create','PHONE','inserted','cm_contacts.phone','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','fromQuery','scheduledat','ContactId','ListId','createdAt','priority','UserId','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.id','into','cm_hopper_black','updatedAt','.CmListId','cm_contacts.phone\x20NOT\x20IN\x20(?)','date_add(cm_contacts.scheduledat,interval\x20','cm_contacts.UserId','recallme','cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId','scheduledAt','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','group','errors','code','message','query','spread','error','campaigns.id','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','sequelize','catch','timezones','dialTimezone','set','offset','info','stringify','send','start','clone','root','server/files/tmp','header','ContactItemType','findAll','name','_description'];(function(_0x3a902a,_0xca8442){var _0x24f2d5=function(_0xb6799a){while(--_0xb6799a){_0x3a902a['push'](_0x3a902a['shift']());}};_0x24f2d5(++_0xca8442);}(_0xfe0a,0x1a8));var _0xafe0=function(_0x4d9a42,_0x4baeaa){_0x4d9a42=_0x4d9a42-0x0;var _0x5833d3=_0xfe0a[_0x4d9a42];return _0x5833d3;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xafe0('0x0'));var Papa=require(_0xafe0('0x1'));var util=require(_0xafe0('0x2'));var BPromise=require(_0xafe0('0x3'));var moment=require('moment');var squel=require(_0xafe0('0x4'));var Redis=require(_0xafe0('0x5'));var db=require(_0xafe0('0x6'))['db'];var config=require(_0xafe0('0x7'));var shared=require(_0xafe0('0x8'));var logger=require(_0xafe0('0x9'))(_0xafe0('0xa'));config[_0xafe0('0xb')]=_[_0xafe0('0xc')](config[_0xafe0('0xb')],{'host':_0xafe0('0xd'),'port':0x18eb});var socket=require(_0xafe0('0xe'))(new Redis(config[_0xafe0('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xafe0('0xf')](_0xafe0('0x10'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xafe0('0xf')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x1db188){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'](_0x1db188);}function selectNotIn(_0x3b7703,_0x2294e3,_0x4a7fac,_0x123b76,_0x52fc9a){return squel[_0xafe0('0x11')]()[_0xafe0('0x12')](_0xafe0('0x13'))[_0xafe0('0x14')](_0x123b76)[_0xafe0('0x15')](_0x2294e3,null,_0x2294e3+_0xafe0('0x16')+_0x123b76+'.'+_0x4a7fac)['where'](_0x123b76+'.'+_0x4a7fac+_0xafe0('0x17')+_0x3b7703+'.'+_0x4a7fac)[_0xafe0('0x18')](_0x2294e3+_0xafe0('0x19')+_0x52fc9a['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x491c7e,_0x25f52d){promisesAdditionalPhones=[];return db['CmContact']['findAll']({'raw':!![],'attributes':['id',_0xafe0('0x1a')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xafe0('0x1b')](function(_0x2ef880){if(_0x2ef880!==null){var _0x5ee615=[];for(var _0x3381f2=0x0;_0x3381f2<_0x2ef880[_0xafe0('0x1c')];_0x3381f2++){var _0x427ec4=_0x2ef880[_0x3381f2];_0x5ee615[_0xafe0('0x1d')](insertAdditionalPhones(_0x427ec4));}}Promise[_0xafe0('0x1e')](_0x5ee615)[_0xafe0('0x1b')](function(){_0x491c7e({'val':0x1});});});});}function insertAdditionalPhones(_0x13427c){return new Promise(function(_0x4da788,_0x4476b3){var _0x469dae=_0x13427c[_0xafe0('0x1a')];var _0x112820=_0x469dae[_0xafe0('0x1f')](';');var _0xdac6f3=[];orderBy=0x0;for(var _0x22593c=0x0;_0x22593c<_0x112820[_0xafe0('0x1c')];_0x22593c++){_0xdac6f3['push'](splitAdditionalPhone(_0x13427c['id'],_0x112820[_0x22593c]));}Promise[_0xafe0('0x1e')](_0xdac6f3)[_0xafe0('0x1b')](function(){_0x4da788({'val':_0x112820['length']});});});}function splitAdditionalPhone(_0x5363e7,_0x3754a6){return new Promise(function(_0xc0b088,_0x314889){var _0x417ab2=_0x3754a6[_0xafe0('0x1f')](':');var _0x20bcef=_0x417ab2[0x0];var _0x4cb245=_0x417ab2[0x1];if(!_[_0xafe0('0x20')](_0x4cb245)){var _0x486b69=_0x4cb245[_0xafe0('0x1f')]('|');var _0x46a36e=[];for(var _0x35fbac=0x0;_0x35fbac<_0x486b69[_0xafe0('0x1c')];_0x35fbac++){if(_0x486b69[_0x35fbac]!==''){var _0x4d5abc=_[_0xafe0('0x21')](promisesAdditionalPhones,{'contactId':_0x5363e7,'phone':_0x486b69[_0x35fbac]});if(_0x4d5abc[_0xafe0('0x1c')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x5363e7,'contactTypeId':_0x20bcef,'phone':_0x486b69[_0x35fbac],'orderBy':orderBy});}}}_0xc0b088({'ok':0x1});}else _0xc0b088({'res':0x0});});}function createAdditionalPhone(_0x4228c9,_0x554cfc,_0x59b201,_0xb2bfb4){var _0x54c8ff='';var _0x1925c3='';var _0x5efa41=_0x59b201[_0xafe0('0x1f')]('§');_0x54c8ff=_0x5efa41[0x0];if(_0x5efa41[_0xafe0('0x1c')]==0x2)_0x1925c3=_0x5efa41[0x1];return new Promise(function(_0x4b986d,_0x17f253){return db['CmContactHasItem'][_0xafe0('0x22')]({'where':{'CmContactId':_0x4228c9,'item':_0x54c8ff}})[_0xafe0('0x1b')](function(_0x3d3570){if(_0x3d3570){return db['CmContactHasItem']['update']({'ItemTypeId':_0x554cfc,'description':_0x1925c3,'OrderBy':_0xb2bfb4},{'where':{'CmContactId':_0x4228c9,'item':_0x54c8ff}})['then'](function(_0x2ad5fc){_0x4b986d({'res':'updated'});});}else{return db[_0xafe0('0x23')][_0xafe0('0x24')]({'CmContactId':_0x4228c9,'item':_0x54c8ff,'description':_0x1925c3,'ItemTypeId':_0x554cfc,'OrderBy':_0xb2bfb4,'ItemClass':_0xafe0('0x25')})[_0xafe0('0x1b')](function(_0x2cdd7b){_0x4b986d({'res':_0xafe0('0x26')});});}});});}function insertCmHopper(_0x262ec3,_0x2e3da3,_0x338675,_0x5d479b,_0x586d3e){var _0xf751d1=[_0xafe0('0x27'),'cm_contacts.scheduledat','cm_contacts.id',_0xafe0('0x28'),_0x2e3da3+'.'+_0x5d479b,_0xafe0('0x29'),_0xafe0('0x2a'),_0xafe0('0x2b'),'cm_contacts.UserId','\x22'+_0x586d3e+'\x22'];return squel[_0xafe0('0x2c')]()['into']('cm_hopper')[_0xafe0('0x2d')]([_0xafe0('0x13'),_0xafe0('0x2e'),_0xafe0('0x2f'),_0xafe0('0x30'),_0x5d479b,_0xafe0('0x31'),'updatedAt',_0xafe0('0x32'),_0xafe0('0x33'),'recallme'],squel['select']()[_0xafe0('0x34')](_0xf751d1)['from'](_0x2e3da3)['join'](_0xafe0('0x35'),null,_0xafe0('0x36')+_0x2e3da3+'.CmListId')[_0xafe0('0x15')](_0x338675,null,_0x338675+_0xafe0('0x16')+_0x2e3da3+'.'+_0x5d479b)[_0xafe0('0x18')](_0x2e3da3+_0xafe0('0x37'),_0x262ec3)[_0xafe0('0x18')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xafe0('0x18')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2e3da3,_0x338675,_0x5d479b,_0xafe0('0x38'),[_0xafe0('0x39'),_0xafe0('0x3a')]))[_0xafe0('0x18')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2e3da3,_0x338675,_0x5d479b,'cm_hopper',[_0xafe0('0x39')])))[_0xafe0('0x3b')]();}function insertCmHopperBlack(_0x18adcc,_0x1834e7,_0x780fa7,_0x344413){var _0xbfe15f=[_0xafe0('0x27'),_0xafe0('0x3c'),_0xafe0('0x28'),_0x1834e7+'.'+_0x344413,_0xafe0('0x29'),'cm_contacts.updatedAt'];return squel['insert']()[_0xafe0('0x3d')](_0xafe0('0x3e'))['fromQuery']([_0xafe0('0x13'),_0xafe0('0x2f'),_0xafe0('0x30'),_0x344413,'createdAt',_0xafe0('0x3f')],squel[_0xafe0('0x11')]()[_0xafe0('0x34')](_0xbfe15f)[_0xafe0('0x14')](_0x1834e7)[_0xafe0('0x15')](_0xafe0('0x35'),null,'cm_contacts.ListId\x20=\x20'+_0x1834e7+_0xafe0('0x40'))[_0xafe0('0x15')](_0x780fa7,null,_0x780fa7+_0xafe0('0x16')+_0x1834e7+'.'+_0x344413)[_0xafe0('0x18')](_0x1834e7+'.CmListId\x20=\x20?',_0x18adcc)[_0xafe0('0x18')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0xafe0('0x41'),squel[_0xafe0('0x11')]()[_0xafe0('0x12')](_0xafe0('0x13'))[_0xafe0('0x14')]('cm_hopper_black')['where']('ListId\x20=\x20?',_0x18adcc)[_0xafe0('0x18')](_0x344413+_0xafe0('0x17')+_0x1834e7+'.'+_0x344413)))[_0xafe0('0x3b')]();}function insertTzCmHopper(_0x8b05b9,_0x54cbb2,_0xa57277,_0x5cd9aa,_0x526c0d,_0x361b15){var _0x4eae31=[_0xafe0('0x27'),_0xafe0('0x42')+_0x361b15+'.offset-cm_contacts.utcOffset\x20minute)',_0xafe0('0x3c'),'cm_contacts.ListId',_0x54cbb2+'.'+_0x5cd9aa,_0xafe0('0x29'),_0xafe0('0x2a'),_0xafe0('0x2b'),_0xafe0('0x43'),'\x22'+_0x526c0d+'\x22'];var _0x542753=squel[_0xafe0('0x2c')]()[_0xafe0('0x3d')](_0xafe0('0x38'))[_0xafe0('0x2d')]([_0xafe0('0x13'),_0xafe0('0x2e'),_0xafe0('0x2f'),'ListId',_0x5cd9aa,'createdAt',_0xafe0('0x3f'),_0xafe0('0x32'),'UserId',_0xafe0('0x44')],squel[_0xafe0('0x11')]()[_0xafe0('0x34')](_0x4eae31)['from'](_0x54cbb2)[_0xafe0('0x15')](_0xafe0('0x35'),null,_0xafe0('0x36')+_0x54cbb2+_0xafe0('0x40'))[_0xafe0('0x15')](_0xa57277,null,_0xa57277+_0xafe0('0x16')+_0x54cbb2+'.'+_0x5cd9aa)[_0xafe0('0x15')](_0x361b15,null,_0x361b15+_0xafe0('0x16')+_0x54cbb2+'.'+_0x5cd9aa)[_0xafe0('0x18')](_0x54cbb2+_0xafe0('0x37'),_0x8b05b9)[_0xafe0('0x18')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xafe0('0x18')](_0xafe0('0x41'),selectNotIn(_0x54cbb2,_0xa57277,_0x5cd9aa,_0xafe0('0x38'),[_0xafe0('0x39'),_0xafe0('0x3a')]))['where'](_0xafe0('0x41'),selectNotIn(_0x54cbb2,_0xa57277,_0x5cd9aa,_0xafe0('0x38'),[_0xafe0('0x39')])))[_0xafe0('0x3b')]();return _0x542753;}function insertTzCmHopperBlack(_0x1b5299,_0x78888b,_0x4086d0,_0xa481a8){var _0x23868c=[_0xafe0('0x27'),'cm_contacts.id',_0xafe0('0x28'),_0x78888b+'.'+_0xa481a8,'cm_contacts.createdAt',_0xafe0('0x2a')];return squel[_0xafe0('0x2c')]()['into'](_0xafe0('0x3e'))[_0xafe0('0x2d')](['phone',_0xafe0('0x2f'),_0xafe0('0x30'),_0xa481a8,_0xafe0('0x31'),_0xafe0('0x3f')],squel[_0xafe0('0x11')]()[_0xafe0('0x34')](_0x23868c)[_0xafe0('0x14')](_0x78888b)['join']('cm_contacts',null,_0xafe0('0x36')+_0x78888b+_0xafe0('0x40'))['join'](_0x4086d0,null,_0x4086d0+'.id\x20=\x20'+_0x78888b+'.'+_0xa481a8)['where'](_0x78888b+'.CmListId\x20=\x20?',_0x1b5299)['where'](_0xafe0('0x45'),NOW)[_0xafe0('0x18')](_0xafe0('0x41'),squel[_0xafe0('0x11')]()[_0xafe0('0x12')](_0xafe0('0x13'))['from']('cm_hopper_black')['where'](_0xafe0('0x46'),_0x1b5299)[_0xafe0('0x18')](_0xa481a8+'\x20=\x20'+_0x78888b+'.'+_0xa481a8)))[_0xafe0('0x3b')]();}function insertCmHopperAdditionalPhones(_0x2f3f89){var _0x2f3063=[_0xafe0('0x47'),_0xafe0('0x48'),'cm_contact_has_items.OrderBy',_0xafe0('0x49'),_0xafe0('0x4a')];return squel[_0xafe0('0x2c')]()[_0xafe0('0x3d')](_0xafe0('0x4b'))['fromQuery']([_0xafe0('0x4c'),_0xafe0('0x13'),_0xafe0('0x4d'),_0xafe0('0x31'),'updatedAt'],squel[_0xafe0('0x11')]()[_0xafe0('0x34')](_0x2f3063)[_0xafe0('0x14')]('cm_hopper')['join'](_0xafe0('0x35'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0xafe0('0x15')](_0xafe0('0x4e'),null,_0xafe0('0x4f'))[_0xafe0('0x18')](_0xafe0('0x50'),_0x2f3f89)[_0xafe0('0x18')](_0xafe0('0x45'),NOW))['toString']();}function insertCmContact(_0x3d662a,_0x527875,_0x39e596,_0x50168a){var _0x2a163d=_[_0xafe0('0x51')](_[_0xafe0('0x52')](_0x50168a),[_0xafe0('0x30'),_0xafe0('0x53'),_0xafe0('0x31'),'updatedAt',_0xafe0('0x54')]);return squel[_0xafe0('0x2c')]()['into']('cm_contacts')[_0xafe0('0x2d')](_0x2a163d,squel[_0xafe0('0x11')]()[_0xafe0('0x34')](_0x2a163d)['from'](_0x527875)['where']('('+_0x39e596[_0xafe0('0x15')](',')+')\x20NOT\x20IN\x20?',squel[_0xafe0('0x11')]()[_0xafe0('0x34')](_0x39e596)[_0xafe0('0x14')]('cm_contacts')[_0xafe0('0x18')]('ListId\x20=\x20?',_0x3d662a)[_0xafe0('0x18')](_0xafe0('0x55')))[_0xafe0('0x18')](_0xafe0('0x56'),squel[_0xafe0('0x11')]()['field'](_0xafe0('0x57'),'min_id')[_0xafe0('0x14')](_0x527875)[_0xafe0('0x58')](_0x39e596[_0xafe0('0x15')](','))))['toString']();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x436724){logger['error'](_0x436724['message']);process['exit'](0x1);}function handleError(_0xf86506,_0x5e7d51){stats[_0xafe0('0x59')][_0xafe0('0x1d')]({'name':_0x5e7d51[_0xafe0('0x5a')],'message':_0x5e7d51[_0xafe0('0x5b')],'row':_0xf86506});}function handleQuery(_0x16d0db){logger['info'](_0x16d0db);return db['sequelize'][_0xafe0('0x5c')](_0x16d0db)[_0xafe0('0x5d')](function(_0x3edcd1){results[_0xafe0('0x1d')](_0x3edcd1);})['catch'](function(_0xc4854c){logger[_0xafe0('0x5e')](_0xc4854c['message']);});}function updateTzCampaigns(_0x75ce86){return new Promise(function(_0x163527,_0x51eb4f){var _0x5a2be5=squel[_0xafe0('0x11')]()['fields']([_0xafe0('0x5f'),'campaigns.dialTimezone'])[_0xafe0('0x14')](_0xafe0('0x60'))['join'](_0xafe0('0x61'),null,_0xafe0('0x62'))[_0xafe0('0x18')]('campaigns_has_cm_lists.CmListId='+_0x75ce86);db['sequelize'][_0xafe0('0x5c')](_0x5a2be5[_0xafe0('0x3b')]())['spread'](function(_0x4f41a9){var _0x1cceb8=[];for(var _0x5b4f28=0x0;_0x5b4f28<_0x4f41a9[_0xafe0('0x1c')];_0x5b4f28++){_0x1cceb8['push'](getTimezoneData(_0x4f41a9[_0x5b4f28],tmp_campaigns));}BPromise[_0xafe0('0x1e')](_0x1cceb8)[_0xafe0('0x1b')](function(){_0x163527({'val':0x1});});})['catch'](function(_0x5bb816){logger[_0xafe0('0x5e')](_0x5bb816[_0xafe0('0x5b')]);_0x163527({'val':0x0});});});}function updateTzVoiceQueues(_0x280c91){return new Promise(function(_0x2cace9,_0x592686){var _0x2fc4f9=squel[_0xafe0('0x11')]()['fields']([_0xafe0('0x63'),_0xafe0('0x64')])[_0xafe0('0x14')](_0xafe0('0x65'))['join']('voice_queues_has_cm_lists',null,_0xafe0('0x66'))[_0xafe0('0x18')](_0xafe0('0x67')+_0x280c91);db[_0xafe0('0x68')][_0xafe0('0x5c')](_0x2fc4f9[_0xafe0('0x3b')]())[_0xafe0('0x5d')](function(_0x2988b8){var _0x3587e1=[];for(var _0x53a095=0x0;_0x53a095<_0x2988b8[_0xafe0('0x1c')];_0x53a095++){_0x3587e1[_0xafe0('0x1d')](getTimezoneData(_0x2988b8[_0x53a095],tmp_voice_queues));}BPromise[_0xafe0('0x1e')](_0x3587e1)[_0xafe0('0x1b')](function(){_0x2cace9({'val':0x1});});})[_0xafe0('0x69')](function(_0x23a8cc){logger[_0xafe0('0x5e')](_0x23a8cc[_0xafe0('0x5b')]);_0x2cace9({'val':0x0});});});}function getTimezoneData(_0x537211,_0xcda4ff){return new Promise(function(_0x4c854d,_0xf7503e){var _0x486ddf=shared[_0xafe0('0x6a')];var _0x31557e=_0x486ddf[_0x537211[_0xafe0('0x6b')]];if(_[_0xafe0('0x20')](_0x31557e)){_0x4c854d({'ret':0x1});}else{var _0x2e8edb=_0x31557e['utcOffset'];var _0x58d171=squel[_0xafe0('0x2c')]()[_0xafe0('0x3d')](_0xcda4ff)['set']('id',_0x537211['id'])[_0xafe0('0x6c')](_0xafe0('0x6d'),_0x2e8edb)['set']('dialTimezone',_0x537211['dialTimezone'])[_0xafe0('0x3b')]();return db[_0xafe0('0x68')][_0xafe0('0x5c')](_0x58d171)[_0xafe0('0x5d')](function(_0x270af1){_0x4c854d({'ret':0x1});})[_0xafe0('0x69')](function(_0x49a1a9){logger[_0xafe0('0x5e')](_0x49a1a9[_0xafe0('0x5b')]);_0xf7503e({'ret':0x1});});}});}function handleTZQuery(_0x2b796a){logger[_0xafe0('0x6e')](_0x2b796a);return db[_0xafe0('0x68')]['query'](_0x2b796a)[_0xafe0('0x5d')](function(_0x3cde7d){})['catch'](function(_0x55b8f2){logger[_0xafe0('0x5e')](_0x55b8f2[_0xafe0('0x5b')]);});}function main(_0x1147c5,_0x3c94d5,_0x2908af,_0x353594){logger[_0xafe0('0x6e')]('main',_0x1147c5,JSON[_0xafe0('0x6f')](_0x3c94d5));process[_0xafe0('0x70')](_0xafe0('0x71'));var _0x29db3d=_0x3c94d5['binding'];var _0x2f385c=_[_0xafe0('0x72')](_0x29db3d);var _0x1b1860=_0x3c94d5['socket_timestamp'];var _0x555b87=path[_0xafe0('0x15')](config[_0xafe0('0x73')],_0xafe0('0x74'),_0x1b1860+'.csv');hasTZ=_[_0xafe0('0x52')](_0x29db3d)['includes'](_0xafe0('0x6b'));var _0x21bec5=_[_0xafe0('0x52')](_0x29db3d)[_0xafe0('0x15')]();logger[_0xafe0('0x6e')](_0xafe0('0x75'),_0x21bec5);db[_0xafe0('0x76')][_0xafe0('0x77')]({'raw':!![],'attributes':['id','name']})[_0xafe0('0x1b')](function(_0x3b8a8b){for(var _0x292b15=0x0;_0x292b15<_0x3b8a8b[_0xafe0('0x1c')];_0x292b15++){if(_0x3b8a8b[_0x292b15][_0xafe0('0x78')]in _0x29db3d){contactItemTypes['push'](_0x3b8a8b[_0x292b15]);delete _0x2f385c[_0x3b8a8b[_0x292b15][_0xafe0('0x78')]];hasAdditionalPhones=!![];}for(var _0x12b989 in _0x29db3d){if(_0x3b8a8b[_0x292b15][_0xafe0('0x78')]+_0xafe0('0x79')===_0x12b989){phoneDescriptions[_0xafe0('0x1d')]({'itemTypeId':_0x3b8a8b[_0x292b15]['id'],'description':_0x12b989});delete _0x2f385c[_0x12b989];}}}if(hasAdditionalPhones)_0x2f385c[_0xafe0('0x1a')]='';var _0x3e0207=_[_0xafe0('0x52')](_0x2f385c)['join']();logger[_0xafe0('0x6e')](_0xafe0('0x75'),_0x3e0207);fs[_0xafe0('0x7a')](_0x555b87,_0x3e0207+'\x0a');Papa[_0xafe0('0x7b')](fs['createReadStream'](_0x1147c5),{'header':!![],'skipEmptyLines':!![],'step':function(_0x352488,_0x5ac340){try{for(var _0x23231a=0x0,_0x32b2ba=[];_0x23231a<_0x352488['data'][_0xafe0('0x1c')];_0x23231a++){stats[_0xafe0('0x7c')]+=0x1;if(_0x352488[_0xafe0('0x59')][_0x23231a]){handleError(_0x352488[_0xafe0('0x7d')][_0x23231a],_0x352488[_0xafe0('0x59')][_0x23231a]);}else{var _0x37c935=[];var _0x329fa8=[];var _0x440c93={};for(var _0x1c571a in _0x29db3d){let _0x463622=contactItemTypes[_0xafe0('0x7e')](_0x485539=>_0x485539['name']===_0x1c571a);let _0x50357e=contactItemTypes['find'](_0x12e22d=>_0x12e22d['name']+_0xafe0('0x79')===_0x1c571a);if(_['isNil'](_0x463622)&&_[_0xafe0('0x20')](_0x50357e)){if(_0x29db3d['hasOwnProperty'](_0x1c571a)){if(_0x352488['data'][_0x23231a][_0x29db3d[_0x1c571a]]){var _0x19773f=_[_0xafe0('0x7f')](_0x352488[_0xafe0('0x7d')][_0x23231a][_0x29db3d[_0x1c571a]][_0xafe0('0x80')](/"/g,'\x27'));switch(_0x1c571a){case _0xafe0('0x2e'):var _0x2f3892=moment(_0x19773f,_0xafe0('0x10'),!![]);if(_0x2f3892['isValid']()){_0x32b2ba['push']('\x22'+_0x19773f+'\x22');}else{_0x37c935[_0xafe0('0x1d')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xafe0('0x32'):var _0x3178d2=parseInt(_0x19773f);_0x19773f=_[_0xafe0('0x81')](_0x3178d2)||_0x3178d2<0x0||_0x3178d2>0x4?_0x353594?0x3:0x2:_0x3178d2;_0x32b2ba[_0xafe0('0x1d')]('\x22'+_0x19773f+'\x22');break;case _0xafe0('0x33'):var _0x547295=parseInt(_0x19773f);if(_[_0xafe0('0x82')](_0x547295)&&_[_0xafe0('0x83')](_0x2908af,_0x547295)){_0x32b2ba[_0xafe0('0x1d')]('\x22'+_0x547295+'\x22');}else{_0x37c935['push'](_0xafe0('0x84'));}break;case _0xafe0('0x85'):if(isEmail(_0x19773f)){_0x32b2ba[_0xafe0('0x1d')]('\x22'+_0x19773f+'\x22');}else{_0x37c935[_0xafe0('0x1d')](_0xafe0('0x86'));}break;case _0xafe0('0x87'):var _0x1b96b7=moment(_0x19773f,'YYYY-MM-DD',!![]);if(_0x1b96b7[_0xafe0('0x88')]()){_0x32b2ba[_0xafe0('0x1d')]('\x22'+_0x19773f+'\x22');}else{_0x37c935['push'](_0xafe0('0x89'));}break;case'dialTimezone':var _0x577936=shared[_0xafe0('0x6a')];var _0x191921=_0x577936[_0x19773f];if(!_[_0xafe0('0x20')](_0x191921)){var _0x427199=_0x191921['utcOffset'];_0x32b2ba[_0xafe0('0x1d')]('\x22'+_0x19773f+'\x22');_0x32b2ba['push']('\x22'+_0x427199+'\x22');}break;default:_0x32b2ba['push']('\x22'+_0x19773f+'\x22');}}else{switch(_0x1c571a){case _0xafe0('0x8a'):case _0xafe0('0x13'):_0x37c935[_0xafe0('0x1d')](_0x1c571a+_0xafe0('0x8b'));break;default:_0x32b2ba[_0xafe0('0x1d')]('\x22\x22');}}}}else{var _0x32cc76='';if(!_[_0xafe0('0x20')](_0x463622)){if(!_0x440c93[_0xafe0('0x8c')](_0x463622['id'])){if(!_[_0xafe0('0x20')](_0x352488[_0xafe0('0x7d')][_0x23231a][_0x29db3d[_0x1c571a]])){var _0x19773f=_[_0xafe0('0x7f')](_0x352488[_0xafe0('0x7d')][_0x23231a][_0x29db3d[_0x1c571a]][_0xafe0('0x80')](/"/g,'\x27'));var _0x3d9321=phoneDescriptions[_0xafe0('0x7e')](_0x452a61=>_0x452a61[_0xafe0('0x8d')]===_0x463622['id']);if(!_[_0xafe0('0x20')](_0x3d9321)){var _0x2d3382=_[_0xafe0('0x7f')](_0x352488[_0xafe0('0x7d')][_0x23231a][_0x29db3d[_0x3d9321[_0xafe0('0x8e')]]][_0xafe0('0x80')](/"/g,'\x27'));if(!_[_0xafe0('0x20')](_0x2d3382))_0x19773f=_0x19773f+'§'+_0x2d3382;}if(_0x32cc76=='')_0x32cc76=_0x19773f;else _0x32cc76+='|'+_0x19773f;}_0x329fa8['push'](_0x463622['id']+':'+_0x32cc76);_0x440c93[_0x463622['id']]=0x1;}}}}if(hasAdditionalPhones){_0x32b2ba[_0xafe0('0x1d')]('\x22'+_0x329fa8[_0xafe0('0x15')](';')+'\x22');}if(_0x37c935[_0xafe0('0x1c')]){handleError(_0x352488[_0xafe0('0x7d')][_0x23231a],{'code':_0xafe0('0x8f'),'message':_0x37c935[_0xafe0('0x15')]()});}else{fs['appendFileSync'](_0x555b87,_0x32b2ba[_0xafe0('0x15')]()+'\x0a');}_0x32b2ba=[];}if(!(stats[_0xafe0('0x7c')]%0xc8)){socket[_0xafe0('0x90')](_0xafe0('0x91')+_0x1b1860,stats);stats[_0xafe0('0x59')]=[];}}if(stopped){logger['info'](_0xafe0('0x92'));_0x5ac340[_0xafe0('0x93')]();}}catch(_0x1f1812){handleError(_0x352488[_0xafe0('0x7d')][_0x23231a],{'code':_0xafe0('0x94'),'message':_0x1f1812[_0xafe0('0x5b')]});logger[_0xafe0('0x5e')](_0xafe0('0x95'),_0x1f1812[_0xafe0('0x5b')]);}},'complete':function(){try{var _0x2c1138=[];var _0x43ea7d=[];var _0x594f9b=_0xafe0('0x35');if(_0x3c94d5[_0xafe0('0x96')]&&_0x3c94d5[_0xafe0('0x96')][_0xafe0('0x1c')]){_0x594f9b='cm_contacts_'+_0x1b1860;_0x2c1138['push'](_0xafe0('0x97')+_0x594f9b+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0xafe0('0x98')+_0x1b1860;tmp_voice_queues='voice_queues_'+_0x1b1860;_0x43ea7d[_0xafe0('0x1d')](_0xafe0('0x97')+tmp_campaigns+_0xafe0('0x99'));_0x43ea7d[_0xafe0('0x1d')](_0xafe0('0x97')+tmp_voice_queues+_0xafe0('0x99'));BPromise[_0xafe0('0x9a')](_0x43ea7d,handleTZQuery)['then'](function(_0x3cbbee){updateTzCampaigns(_0x3c94d5[_0xafe0('0x30')])[_0xafe0('0x1b')](function(_0x2355b3){updateTzVoiceQueues(_0x3c94d5[_0xafe0('0x30')])[_0xafe0('0x1b')](function(_0x2f912a){if(hasTZ)_0x3e0207=_0x3e0207['replace'](_0xafe0('0x6b'),_0xafe0('0x9b'));var _0x5de21d=util['format']('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',_0x555b87,_0x594f9b,_0x3e0207,_0x3c94d5['ListId'],_0x3c94d5[_0xafe0('0x53')]||null,NOW,NOW);if(_[_0xafe0('0x20')](_0x29db3d['scheduledat'])){_0x5de21d+=_0xafe0('0x9c');}_0x2c1138[_0xafe0('0x1d')](_0x5de21d);if(_0x3c94d5[_0xafe0('0x96')]&&_0x3c94d5[_0xafe0('0x96')][_0xafe0('0x1c')]){_0x2c1138[_0xafe0('0x1d')](insertCmContact(_0x3c94d5[_0xafe0('0x30')],_0x594f9b,_0x3c94d5[_0xafe0('0x96')],_0x29db3d));_0x2c1138[_0xafe0('0x1d')]('DROP\x20TABLE\x20'+_0x594f9b+';');}BPromise['each'](_0x2c1138,handleQuery)[_0xafe0('0x1b')](function(_0x2a3539){BPromise[_0xafe0('0x1e')]([handleAdditionalPhones()])['then'](function(){_0x2c1138=[];for(var _0x382068=0x0;_0x382068\x20\x20','existsSync','file\x20doesn\x27t\x20exists','map','SIGINT','uncaughtException','lodash','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','length','isNil','phone','AdditionalPhones','push','catch','error','message','split','all','then','filter','CmContactHasItem','update','updated','create','inserted','CmContact','CmHopper','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone','cm_contacts.createdAt','cm_contacts.updatedAt','insert','cm_hopper_black','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_hopper.ListId\x20=\x20?','CompanyId','ListId\x20=\x20?','id\x20IN\x20?','MIN(id)','min_id','info','Received\x20SIGINT','exit','errors','code','spread','main','stringify','send','start'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0xb5a4,0x17d));var _0x4b5a=function(_0x2fa2ad,_0x6f1532){_0x2fa2ad=_0x2fa2ad-0x0;var _0x502023=_0xb5a4[_0x2fa2ad];return _0x502023;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x4b5a('0x0'));var Papa=require(_0x4b5a('0x1'));var util=require(_0x4b5a('0x2'));var BPromise=require('bluebird');var moment=require(_0x4b5a('0x3'));var squel=require(_0x4b5a('0x4'));var Redis=require(_0x4b5a('0x5'));var db=require(_0x4b5a('0x6'))['db'];var config=require(_0x4b5a('0x7'));var logger=require(_0x4b5a('0x8'))(_0x4b5a('0x9'));config[_0x4b5a('0xa')]=_[_0x4b5a('0xb')](config['redis'],{'host':_0x4b5a('0xc'),'port':0x18eb});var socket=require(_0x4b5a('0xd'))(new Redis(config[_0x4b5a('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x4b5a('0xe')](_0x4b5a('0xf'));var tempTableName=_0x4b5a('0x10')+moment()[_0x4b5a('0xe')](_0x4b5a('0x11'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x5b8213){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))*$/[_0x4b5a('0x12')](_0x5b8213);}function selectNotIn(_0x53f6cd,_0x59395e,_0x1637f4,_0x57b03a,_0x191734){return squel[_0x4b5a('0x13')]()[_0x4b5a('0x14')]('phone')['from'](_0x57b03a)[_0x4b5a('0x15')](_0x59395e,null,_0x59395e+_0x4b5a('0x16')+_0x57b03a+'.'+_0x1637f4)[_0x4b5a('0x17')](_0x57b03a+'.'+_0x1637f4+_0x4b5a('0x18')+_0x53f6cd+'.'+_0x1637f4)[_0x4b5a('0x17')](_0x59395e+_0x4b5a('0x19')+_0x191734['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x50d548,_0x245e99){promisesAdditionalPhones=[];promisesContact=[];return db[_0x4b5a('0x1a')][_0x4b5a('0x1b')]('select\x20*\x20from\x20'+tempTableName)['spread'](function(_0x240552){if(_0x240552!==null){var _0x4fc505=[];for(var _0x3b972d=0x0;_0x3b972d<_0x240552[_0x4b5a('0x1c')];_0x3b972d++){var _0x4f95e2=_0x240552[_0x3b972d];if(!_[_0x4b5a('0x1d')](_0x4f95e2[_0x4b5a('0x1e')])){if(!_[_0x4b5a('0x1d')](_0x4f95e2[_0x4b5a('0x1f')]))_0x4fc505[_0x4b5a('0x20')](insertAdditionalPhones(_0x4f95e2));promisesContact['push']({'contact':_0x4f95e2});}}}Promise['all'](_0x4fc505)['then'](function(){_0x50d548({'val':0x1});});})[_0x4b5a('0x21')](function(_0x3e261e){logger[_0x4b5a('0x22')](_0x3e261e[_0x4b5a('0x23')]);});});}function insertAdditionalPhones(_0x402eb1){return new Promise(function(_0x5140c1,_0x2d7386){var _0x3e504c=_0x402eb1[_0x4b5a('0x1f')];if(_[_0x4b5a('0x1d')](_0x3e504c))_0x2d7386({'val':0x0});else{var _0x485a33=_0x3e504c[_0x4b5a('0x24')](';');var _0x36952f=[];orderBy=0x0;for(var _0x2d4899=0x0;_0x2d4899<_0x485a33['length'];_0x2d4899++){_0x36952f[_0x4b5a('0x20')](splitAdditionalPhone(_0x402eb1['id'],_0x485a33[_0x2d4899]));}Promise[_0x4b5a('0x25')](_0x36952f)[_0x4b5a('0x26')](function(){_0x5140c1({'val':_0x485a33[_0x4b5a('0x1c')]});});}});}function splitAdditionalPhone(_0x3ec6f3,_0x4aa921){return new Promise(function(_0x1938f2,_0x9bcf2){var _0x60f7f5=_0x4aa921['split'](':');var _0x23d677=_0x60f7f5[0x0];var _0x2d4fc8=_0x60f7f5[0x1];if(_0x2d4fc8!==''){var _0x49887a=_0x2d4fc8[_0x4b5a('0x24')]('|');var _0xbe520e=[];for(var _0x561f0f=0x0;_0x561f0f<_0x49887a[_0x4b5a('0x1c')];_0x561f0f++){if(_0x49887a[_0x561f0f]!==''){var _0x2036c2=_[_0x4b5a('0x27')](promisesAdditionalPhones,{'contactId':_0x3ec6f3,'phone':_0x49887a[_0x561f0f]});if(_0x2036c2[_0x4b5a('0x1c')]==0x0){orderBy++;promisesAdditionalPhones[_0x4b5a('0x20')]({'contactId':_0x3ec6f3,'contactTypeId':_0x23d677,'phone':_0x49887a[_0x561f0f],'orderBy':orderBy});}}}_0x1938f2({'ok':0x1});}else _0x1938f2({'res':0x0});});}function createAdditionalPhone(_0x245054,_0x4902ba,_0x517d99,_0x41ba9e){var _0x399db1='';var _0x3b2ba5='';var _0x51c187=_0x517d99['split']('§');_0x399db1=_0x51c187[0x0];if(_0x51c187[_0x4b5a('0x1c')]==0x2)_0x3b2ba5=_0x51c187[0x1];return new Promise(function(_0x448e94,_0x133932){return db['CmContactHasItem']['findOne']({'where':{'CmContactId':_0x245054,'item':_0x399db1}})['then'](function(_0x282cc1){if(_0x282cc1){return db[_0x4b5a('0x28')][_0x4b5a('0x29')]({'ItemTypeId':_0x4902ba,'description':_0x3b2ba5,'OrderBy':_0x41ba9e},{'where':{'CmContactId':_0x245054,'item':_0x399db1}})[_0x4b5a('0x26')](function(_0x2f9507){_0x448e94({'res':_0x4b5a('0x2a')});});}else{return db[_0x4b5a('0x28')][_0x4b5a('0x2b')]({'CmContactId':_0x245054,'item':_0x399db1,'ItemTypeId':_0x4902ba,'description':_0x3b2ba5,'OrderBy':_0x41ba9e,'ItemClass':'PHONE'})[_0x4b5a('0x26')](function(_0x2a0d84){_0x448e94({'res':_0x4b5a('0x2c')});});}});});}function updateContact(_0x7bab9c){return new Promise(function(_0x36cf86,_0x22050f){var _0x41e336=_0x7bab9c['id'];delete _0x7bab9c['id'];return db[_0x4b5a('0x2d')][_0x4b5a('0x29')](_0x7bab9c,{'where':{'id':_0x41e336}})['then'](function(_0x2b2283){updatedRows+=0x1;return db[_0x4b5a('0x2e')][_0x4b5a('0x29')]({'phone':_0x7bab9c['phone']},{'where':{'ContactId':_0x41e336}})['then'](function(_0x3604c){_0x36cf86({'ret':'OK'});});});});}function insertCmHopper(_0x5b38a0,_0x57489c,_0x3a6a76,_0x1e90e8,_0x4aec39){var _0x52b000=['cm_contacts.phone',_0x4b5a('0x2f'),_0x4b5a('0x30'),_0x4b5a('0x31'),_0x57489c+'.'+_0x1e90e8,'cm_contacts.createdAt','cm_contacts.updatedAt',_0x4b5a('0x32'),_0x4b5a('0x33'),'\x22'+_0x4aec39+'\x22'];return squel['insert']()[_0x4b5a('0x34')](_0x4b5a('0x35'))[_0x4b5a('0x36')]([_0x4b5a('0x1e'),_0x4b5a('0x37'),_0x4b5a('0x38'),_0x4b5a('0x39'),_0x1e90e8,_0x4b5a('0x3a'),_0x4b5a('0x3b'),_0x4b5a('0x3c'),_0x4b5a('0x3d'),_0x4b5a('0x3e')],squel['select']()[_0x4b5a('0x3f')](_0x52b000)[_0x4b5a('0x40')](_0x57489c)[_0x4b5a('0x15')](_0x4b5a('0x41'),null,_0x4b5a('0x42')+_0x57489c+_0x4b5a('0x43'))[_0x4b5a('0x15')](_0x3a6a76,null,_0x3a6a76+'.id\x20=\x20'+_0x57489c+'.'+_0x1e90e8)[_0x4b5a('0x17')](_0x57489c+_0x4b5a('0x44'),_0x5b38a0)['where'](_0x4b5a('0x45'),NOW)['where'](_0x4b5a('0x46'),selectNotIn(_0x57489c,_0x3a6a76,_0x1e90e8,_0x4b5a('0x35'),[_0x4b5a('0x47'),_0x4b5a('0x48')]))[_0x4b5a('0x17')](_0x4b5a('0x46'),selectNotIn(_0x57489c,_0x3a6a76,_0x1e90e8,_0x4b5a('0x35'),['\x22always\x22'])))[_0x4b5a('0x49')]();}function insertCmHopperBlack(_0x3ea009,_0x181fd6,_0x5b786a,_0x3e004f){var _0x5db1ca=[_0x4b5a('0x4a'),_0x4b5a('0x30'),_0x4b5a('0x31'),_0x181fd6+'.'+_0x3e004f,_0x4b5a('0x4b'),_0x4b5a('0x4c')];return squel[_0x4b5a('0x4d')]()[_0x4b5a('0x34')](_0x4b5a('0x4e'))[_0x4b5a('0x36')]([_0x4b5a('0x1e'),_0x4b5a('0x38'),_0x4b5a('0x39'),_0x3e004f,_0x4b5a('0x3a'),_0x4b5a('0x3b')],squel[_0x4b5a('0x13')]()[_0x4b5a('0x3f')](_0x5db1ca)[_0x4b5a('0x40')](_0x181fd6)[_0x4b5a('0x15')]('cm_contacts',null,_0x4b5a('0x42')+_0x181fd6+_0x4b5a('0x43'))[_0x4b5a('0x15')](_0x5b786a,null,_0x5b786a+_0x4b5a('0x16')+_0x181fd6+'.'+_0x3e004f)[_0x4b5a('0x17')](_0x181fd6+'.CmListId\x20=\x20?',_0x3ea009)[_0x4b5a('0x17')](_0x4b5a('0x45'),NOW)['where'](_0x4b5a('0x46'),squel[_0x4b5a('0x13')]()[_0x4b5a('0x14')](_0x4b5a('0x1e'))['from']('cm_hopper_black')[_0x4b5a('0x17')]('ListId\x20=\x20?',_0x3ea009)[_0x4b5a('0x17')](_0x3e004f+_0x4b5a('0x4f'),_0x181fd6+'.'+_0x3e004f)))[_0x4b5a('0x49')]();}function insertCmHopperAdditionalPhones(_0xfb5f5c){var _0x27c846=[_0x4b5a('0x50'),_0x4b5a('0x51'),_0x4b5a('0x52'),_0x4b5a('0x53'),_0x4b5a('0x54')];return squel[_0x4b5a('0x4d')]()[_0x4b5a('0x34')](_0x4b5a('0x55'))[_0x4b5a('0x36')]([_0x4b5a('0x56'),_0x4b5a('0x1e'),_0x4b5a('0x57'),_0x4b5a('0x3a'),'updatedAt'],squel['select']()[_0x4b5a('0x3f')](_0x27c846)['from']('cm_hopper')[_0x4b5a('0x15')](_0x4b5a('0x41'),null,_0x4b5a('0x58'))[_0x4b5a('0x15')]('cm_contact_has_items',null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x4b5a('0x17')](_0x4b5a('0x59'),_0xfb5f5c)[_0x4b5a('0x17')](_0x4b5a('0x45'),NOW))[_0x4b5a('0x49')]();}function insertCmContact(_0x236ca4,_0x220fe4,_0x1be47f,_0x46d4e8){var _0x503616=_['concat'](_['keys'](_0x46d4e8),['ListId',_0x4b5a('0x5a'),_0x4b5a('0x3a'),'updatedAt']);return squel[_0x4b5a('0x4d')]()[_0x4b5a('0x34')]('cm_contacts')[_0x4b5a('0x36')](_0x503616,squel[_0x4b5a('0x13')]()[_0x4b5a('0x3f')](_0x503616)[_0x4b5a('0x40')](_0x220fe4)[_0x4b5a('0x17')]('('+_0x1be47f[_0x4b5a('0x15')](',')+')\x20NOT\x20IN\x20?',squel[_0x4b5a('0x13')]()[_0x4b5a('0x3f')](_0x1be47f)[_0x4b5a('0x40')](_0x4b5a('0x41'))[_0x4b5a('0x17')](_0x4b5a('0x5b'),_0x236ca4))[_0x4b5a('0x17')](_0x4b5a('0x5c'),squel['select']()[_0x4b5a('0x14')](_0x4b5a('0x5d'),_0x4b5a('0x5e'))['from'](_0x220fe4)['group'](_0x1be47f[_0x4b5a('0x15')](','))))[_0x4b5a('0x49')]();}function handleStop(){logger[_0x4b5a('0x5f')](_0x4b5a('0x60'));stopped=!![];}function handleUncaughtException(_0x4bea3e){logger[_0x4b5a('0x22')](_0x4bea3e[_0x4b5a('0x23')]);process[_0x4b5a('0x61')](0x1);}function handleError(_0x2e9880,_0xd9cf1f){stats[_0x4b5a('0x62')]['push']({'name':_0xd9cf1f[_0x4b5a('0x63')],'message':_0xd9cf1f[_0x4b5a('0x23')],'row':_0x2e9880});}function handleQuery(_0x6f50ff){logger[_0x4b5a('0x5f')](_0x6f50ff);return db[_0x4b5a('0x1a')]['query'](_0x6f50ff)[_0x4b5a('0x64')](function(_0x4ed25b){results[_0x4b5a('0x20')](_0x4ed25b);})[_0x4b5a('0x21')](function(_0x292178){logger[_0x4b5a('0x22')](_0x292178[_0x4b5a('0x23')]);});}function main(_0x74569d,_0x4caa12,_0x317828,_0x430336){logger[_0x4b5a('0x5f')](_0x4b5a('0x65'),_0x74569d,JSON[_0x4b5a('0x66')](_0x4caa12));process[_0x4b5a('0x67')](_0x4b5a('0x68'));var _0x527f29=_0x4caa12[_0x4b5a('0x69')];var _0x594405=_[_0x4b5a('0x6a')](_0x527f29);var _0x1e97fd=_0x4caa12['socket_timestamp'];var _0x33cbc6=path[_0x4b5a('0x15')](config[_0x4b5a('0x6b')],_0x4b5a('0x6c'),_0x1e97fd+_0x4b5a('0x6d'));logger['info'](_0x4b5a('0x6e'),_0x4caa12);db['ContactItemType'][_0x4b5a('0x6f')]({'raw':!![],'attributes':['id',_0x4b5a('0x70')]})[_0x4b5a('0x26')](function(_0x32778e){for(var _0x195b04=0x0;_0x195b04<_0x32778e['length'];_0x195b04++){if(_0x32778e[_0x195b04][_0x4b5a('0x70')]in _0x527f29){contactItemTypes[_0x4b5a('0x20')](_0x32778e[_0x195b04]);delete _0x594405[_0x32778e[_0x195b04][_0x4b5a('0x70')]];hasAdditionalPhones=!![];}for(var _0x357730 in _0x527f29){if(_0x32778e[_0x195b04]['name']+_0x4b5a('0x71')===_0x357730){phoneDescriptions['push']({'itemTypeId':_0x32778e[_0x195b04]['id'],'description':_0x357730});delete _0x594405[_0x357730];}}}if(hasAdditionalPhones)_0x594405['AdditionalPhones']='';var _0x38201c=_[_0x4b5a('0x72')](_0x594405)[_0x4b5a('0x15')]();logger[_0x4b5a('0x5f')]('header',_0x38201c);fs[_0x4b5a('0x73')](_0x33cbc6,_0x38201c+'\x0a');Papa[_0x4b5a('0x74')](fs[_0x4b5a('0x75')](_0x74569d),{'header':!![],'skipEmptyLines':!![],'step':function(_0x538deb,_0x1cb017){try{for(var _0xb9b311=0x0,_0x58cb97=[];_0xb9b311<_0x538deb['data']['length'];_0xb9b311++){stats[_0x4b5a('0x76')]+=0x1;if(_0x538deb[_0x4b5a('0x62')][_0xb9b311]){handleError(_0x538deb[_0x4b5a('0x77')][_0xb9b311],_0x538deb[_0x4b5a('0x62')][_0xb9b311]);}else{var _0x440b37=[];var _0x224dd4=[];var _0x3de8ea={};for(var _0x10c40a in _0x527f29){let _0x3995a9=contactItemTypes[_0x4b5a('0x78')](_0x1f4770=>_0x1f4770[_0x4b5a('0x70')]===_0x10c40a);let _0x298d37=contactItemTypes[_0x4b5a('0x78')](_0x2447e2=>_0x2447e2[_0x4b5a('0x70')]+_0x4b5a('0x71')===_0x10c40a);if(_[_0x4b5a('0x1d')](_0x3995a9)&&_['isNil'](_0x298d37)){if(_0x527f29['hasOwnProperty'](_0x10c40a)){if(_0x538deb[_0x4b5a('0x77')][_0xb9b311][_0x527f29[_0x10c40a]]){var _0x45920c=_[_0x4b5a('0x79')](_0x538deb['data'][_0xb9b311][_0x527f29[_0x10c40a]]['replace'](/"/g,'\x27'));switch(_0x10c40a){case _0x4b5a('0x37'):var _0x4dca61=moment(_0x45920c,_0x4b5a('0xf'),!![]);if(_0x4dca61[_0x4b5a('0x7a')]()){_0x58cb97[_0x4b5a('0x20')]('\x22'+_0x45920c+'\x22');}else{_0x440b37['push'](_0x4b5a('0x7b'));}break;case _0x4b5a('0x3c'):var _0xc83921=parseInt(_0x45920c);_0x45920c=_[_0x4b5a('0x7c')](_0xc83921)||_0xc83921<0x0||_0xc83921>0x4?_0x430336?0x3:0x2:_0xc83921;_0x58cb97['push']('\x22'+_0x45920c+'\x22');break;case _0x4b5a('0x3d'):var _0x2f42e2=parseInt(_0x45920c);if(_['isNumber'](_0x2f42e2)&&_[_0x4b5a('0x7d')](_0x317828,_0x2f42e2)){_0x58cb97['push']('\x22'+_0x2f42e2+'\x22');}else{_0x440b37[_0x4b5a('0x20')](_0x4b5a('0x7e'));}break;case _0x4b5a('0x7f'):if(isEmail(_0x45920c)){_0x58cb97['push']('\x22'+_0x45920c+'\x22');}else{_0x440b37['push']('email\x20wrong\x20format');}break;case _0x4b5a('0x80'):var _0x442987=moment(_0x45920c,_0x4b5a('0x81'),!![]);if(_0x442987[_0x4b5a('0x7a')]()){_0x58cb97['push']('\x22'+_0x45920c+'\x22');}else{_0x440b37[_0x4b5a('0x20')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x58cb97[_0x4b5a('0x20')]('\x22'+_0x45920c+'\x22');}}else{switch(_0x10c40a){case _0x4b5a('0x82'):case'phone':_0x440b37[_0x4b5a('0x20')](_0x10c40a+_0x4b5a('0x83'));break;default:_0x58cb97[_0x4b5a('0x20')]('\x22\x22');}}}}else{var _0x433156='';if(!_[_0x4b5a('0x1d')](_0x3995a9)){if(!_0x3de8ea[_0x4b5a('0x84')](_0x3995a9['id'])){for(var _0x48dd4e=0x0;_0x48dd4e<_0x527f29[_0x10c40a]['length'];_0x48dd4e++){var _0x45920c=_['trim'](_0x538deb[_0x4b5a('0x77')][_0xb9b311][_0x527f29[_0x10c40a][_0x48dd4e]][_0x4b5a('0x85')](/"/g,'\x27'));var _0x490294=phoneDescriptions['find'](_0x20198b=>_0x20198b[_0x4b5a('0x86')]===_0x3995a9['id']);if(!_['isNil'](_0x490294)){var _0x154513=_[_0x4b5a('0x79')](_0x538deb[_0x4b5a('0x77')][_0xb9b311][_0x527f29[_0x490294['description']][0x0]][_0x4b5a('0x85')](/"/g,'\x27'));if(!_[_0x4b5a('0x1d')](_0x154513))_0x45920c=_0x45920c+'§'+_0x154513;}if(_0x433156=='')_0x433156=_0x45920c;else _0x433156+='|'+_0x45920c;}_0x224dd4[_0x4b5a('0x20')](_0x3995a9['id']+':'+_0x433156);_0x3de8ea[_0x3995a9['id']]=0x1;}}}}if(hasAdditionalPhones){_0x58cb97['push']('\x22'+_0x224dd4[_0x4b5a('0x15')](';')+'\x22');}if(_0x440b37[_0x4b5a('0x1c')]){handleError(_0x538deb['data'][_0xb9b311],{'code':_0x4b5a('0x87'),'message':_0x440b37['join']()});}else{fs['appendFileSync'](_0x33cbc6,_0x58cb97['join']()+'\x0a');}_0x58cb97=[];}if(!(stats[_0x4b5a('0x76')]%0xc8)){socket[_0x4b5a('0x88')](_0x4b5a('0x89')+_0x1e97fd,stats);stats['errors']=[];}}if(stopped){logger[_0x4b5a('0x5f')]('Abort\x20parser');_0x1cb017[_0x4b5a('0x8a')]();}}catch(_0x7d0d5){handleError(_0x538deb['data'][_0xb9b311],{'code':_0x4b5a('0x8b'),'message':_0x7d0d5['message']});logger[_0x4b5a('0x22')](_0x4b5a('0x8c'),_0x7d0d5[_0x4b5a('0x23')]);}},'complete':function(){try{var _0x12231b=[];var _0x605dc1=tempTableName;_0x12231b[_0x4b5a('0x20')](_0x4b5a('0x8d')+_0x605dc1+_0x4b5a('0x8e'));logger[_0x4b5a('0x5f')](_0x4b5a('0x8f'),contactItemTypes[_0x4b5a('0x1c')]);var _0x1697cb=util['format'](_0x4b5a('0x90'),_0x33cbc6,_0x605dc1,_0x38201c,_0x4caa12['ListId'],_0x4caa12[_0x4b5a('0x5a')]||null,NOW,NOW);if(_[_0x4b5a('0x1d')](_0x527f29[_0x4b5a('0x37')])){_0x1697cb+=',\x20scheduledAt\x20=\x20NOW()';}_0x12231b[_0x4b5a('0x20')](_0x1697cb);BPromise[_0x4b5a('0x91')](_0x12231b,handleQuery)[_0x4b5a('0x26')](function(_0x53ada3){BPromise[_0x4b5a('0x25')]([handleAdditionalPhones()])['then'](function(){_0x12231b=[];for(var _0x5df486=0x0;_0x5df486\x20\x20','root'];(function(_0x31db75,_0x373337){var _0x76b89c=function(_0x954b72){while(--_0x954b72){_0x31db75['push'](_0x31db75['shift']());}};_0x76b89c(++_0x373337);}(_0x2b4f,0x142));var _0xf2b4=function(_0x3fb704,_0x568894){_0x3fb704=_0x3fb704-0x0;var _0x4214a9=_0x2b4f[_0x3fb704];return _0x4214a9;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xf2b4('0x0'));var Papa=require('papaparse');var util=require(_0xf2b4('0x1'));var BPromise=require(_0xf2b4('0x2'));var moment=require(_0xf2b4('0x3'));var squel=require(_0xf2b4('0x4'));var Redis=require(_0xf2b4('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0xf2b4('0x6'));var logger=require(_0xf2b4('0x7'))(_0xf2b4('0x8'));config[_0xf2b4('0x9')]=_['defaults'](config[_0xf2b4('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xf2b4('0xa'))(new Redis(config[_0xf2b4('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()[_0xf2b4('0xb')](_0xf2b4('0xc'));var tempTableName=_0xf2b4('0xd')+moment()[_0xf2b4('0xb')](_0xf2b4('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x2a470a){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))*$/[_0xf2b4('0xf')](_0x2a470a);}function selectNotIn(_0x23812d,_0x1ded8a,_0x194675,_0x3d792a,_0x1f3f68){return squel[_0xf2b4('0x10')]()['field'](_0xf2b4('0x11'))[_0xf2b4('0x12')](_0x3d792a)[_0xf2b4('0x13')](_0x1ded8a,null,_0x1ded8a+_0xf2b4('0x14')+_0x3d792a+'.'+_0x194675)['where'](_0x3d792a+'.'+_0x194675+'\x20=\x20'+_0x23812d+'.'+_0x194675)[_0xf2b4('0x15')](_0x1ded8a+'.dialCheckDuplicateType\x20IN\x20('+_0x1f3f68[_0xf2b4('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x1f5b60,_0x266683){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize']['query'](_0xf2b4('0x16')+tempTableName)[_0xf2b4('0x17')](function(_0x3daaf6){if(_0x3daaf6!==null){var _0x323f7b=[];for(var _0x562ab8=0x0;_0x562ab8<_0x3daaf6[_0xf2b4('0x18')];_0x562ab8++){var _0x4d2a47=_0x3daaf6[_0x562ab8];if(!_[_0xf2b4('0x19')](_0x4d2a47[_0xf2b4('0x11')])){if(!_[_0xf2b4('0x19')](_0x4d2a47[_0xf2b4('0x1a')]))_0x323f7b[_0xf2b4('0x1b')](insertAdditionalPhones(_0x4d2a47));promisesContact[_0xf2b4('0x1b')]({'contact':_0x4d2a47});}}}Promise[_0xf2b4('0x1c')](_0x323f7b)[_0xf2b4('0x1d')](function(){_0x1f5b60({'val':0x1});});})['catch'](function(_0x32fe54){logger[_0xf2b4('0x1e')](_0x32fe54[_0xf2b4('0x1f')]);});});}function insertAdditionalPhones(_0x4642bc){return new Promise(function(_0x38afe7,_0x305fa0){var _0x15dcd6=_0x4642bc['AdditionalPhones'];if(_[_0xf2b4('0x19')](_0x15dcd6))_0x305fa0({'val':0x0});else{var _0x12f1c0=_0x15dcd6[_0xf2b4('0x20')](';');var _0x5fc66e=[];orderBy=0x0;for(var _0x51330b=0x0;_0x51330b<_0x12f1c0['length'];_0x51330b++){_0x5fc66e[_0xf2b4('0x1b')](splitAdditionalPhone(_0x4642bc['id'],_0x12f1c0[_0x51330b]));}Promise[_0xf2b4('0x1c')](_0x5fc66e)[_0xf2b4('0x1d')](function(){_0x38afe7({'val':_0x12f1c0[_0xf2b4('0x18')]});});}});}function splitAdditionalPhone(_0x7daac1,_0x4561d7){return new Promise(function(_0x390c94,_0x4346c1){var _0x2ee93b=_0x4561d7[_0xf2b4('0x20')](':');var _0x53a6e6=_0x2ee93b[0x0];var _0x500e28=_0x2ee93b[0x1];if(_0x500e28!==''){var _0x3de06e=_0x500e28[_0xf2b4('0x20')]('|');var _0x57370b=[];for(var _0x27bec0=0x0;_0x27bec0<_0x3de06e[_0xf2b4('0x18')];_0x27bec0++){if(_0x3de06e[_0x27bec0]!==''){var _0x3007eb=_[_0xf2b4('0x21')](promisesAdditionalPhones,{'contactId':_0x7daac1,'phone':_0x3de06e[_0x27bec0]});if(_0x3007eb[_0xf2b4('0x18')]==0x0){orderBy++;promisesAdditionalPhones[_0xf2b4('0x1b')]({'contactId':_0x7daac1,'contactTypeId':_0x53a6e6,'phone':_0x3de06e[_0x27bec0],'orderBy':orderBy});}}}_0x390c94({'ok':0x1});}else _0x390c94({'res':0x0});});}function createAdditionalPhone(_0xcff709,_0x444875,_0x506bab,_0x456055){var _0x463fb5='';var _0xe7971a='';var _0x534445=_0x506bab[_0xf2b4('0x20')]('§');_0x463fb5=_0x534445[0x0];if(_0x534445['length']==0x2)_0xe7971a=_0x534445[0x1];return new Promise(function(_0x449d39,_0x128658){return db[_0xf2b4('0x22')]['findOne']({'where':{'CmContactId':_0xcff709,'item':_0x463fb5}})['then'](function(_0x15ebd9){if(_0x15ebd9){return db['CmContactHasItem']['update']({'ItemTypeId':_0x444875,'description':_0xe7971a,'OrderBy':_0x456055},{'where':{'CmContactId':_0xcff709,'item':_0x463fb5}})['then'](function(_0x788e7c){_0x449d39({'res':_0xf2b4('0x23')});});}else{return db[_0xf2b4('0x22')][_0xf2b4('0x24')]({'CmContactId':_0xcff709,'item':_0x463fb5,'ItemTypeId':_0x444875,'description':_0xe7971a,'OrderBy':_0x456055,'ItemClass':'PHONE'})[_0xf2b4('0x1d')](function(_0x4e456b){_0x449d39({'res':_0xf2b4('0x25')});});}});});}function updateContact(_0x2e0148){return new Promise(function(_0x5a61ca,_0x53b441){var _0x13427d=_0x2e0148['id'];delete _0x2e0148['id'];return db[_0xf2b4('0x26')][_0xf2b4('0x27')](_0x2e0148,{'where':{'id':_0x13427d}})[_0xf2b4('0x1d')](function(_0x8342bf){updatedRows+=0x1;return db[_0xf2b4('0x28')][_0xf2b4('0x27')]({'phone':_0x2e0148['phone']},{'where':{'ContactId':_0x13427d}})[_0xf2b4('0x1d')](function(_0x5f45b7){_0x5a61ca({'ret':'OK'});});});});}function insertCmHopper(_0x223a9b,_0x313275,_0x229d24,_0x4712b6,_0x566391){var _0x136a95=[_0xf2b4('0x29'),'cm_contacts.scheduledat',_0xf2b4('0x2a'),_0xf2b4('0x2b'),_0x313275+'.'+_0x4712b6,'cm_contacts.createdAt',_0xf2b4('0x2c'),_0xf2b4('0x2d'),_0xf2b4('0x2e'),'\x22'+_0x566391+'\x22'];return squel[_0xf2b4('0x2f')]()[_0xf2b4('0x30')](_0xf2b4('0x31'))[_0xf2b4('0x32')](['phone',_0xf2b4('0x33'),_0xf2b4('0x34'),_0xf2b4('0x35'),_0x4712b6,_0xf2b4('0x36'),_0xf2b4('0x37'),_0xf2b4('0x38'),_0xf2b4('0x39'),_0xf2b4('0x3a')],squel[_0xf2b4('0x10')]()[_0xf2b4('0x3b')](_0x136a95)['from'](_0x313275)['join'](_0xf2b4('0x3c'),null,_0xf2b4('0x3d')+_0x313275+_0xf2b4('0x3e'))[_0xf2b4('0x13')](_0x229d24,null,_0x229d24+'.id\x20=\x20'+_0x313275+'.'+_0x4712b6)[_0xf2b4('0x15')](_0x313275+_0xf2b4('0x3f'),_0x223a9b)[_0xf2b4('0x15')](_0xf2b4('0x40'),NOW)[_0xf2b4('0x15')](_0xf2b4('0x41'),selectNotIn(_0x313275,_0x229d24,_0x4712b6,'cm_hopper',[_0xf2b4('0x42'),_0xf2b4('0x43')]))[_0xf2b4('0x15')](_0xf2b4('0x41'),selectNotIn(_0x313275,_0x229d24,_0x4712b6,_0xf2b4('0x31'),[_0xf2b4('0x42')])))[_0xf2b4('0x44')]();}function insertCmHopperBlack(_0xa32ed7,_0x59f73e,_0x55726c,_0x42e154){var _0x3f4a22=['cm_contacts.phone',_0xf2b4('0x2a'),_0xf2b4('0x2b'),_0x59f73e+'.'+_0x42e154,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0xf2b4('0x2f')]()[_0xf2b4('0x30')](_0xf2b4('0x45'))[_0xf2b4('0x32')]([_0xf2b4('0x11'),_0xf2b4('0x34'),_0xf2b4('0x35'),_0x42e154,_0xf2b4('0x36'),_0xf2b4('0x37')],squel[_0xf2b4('0x10')]()[_0xf2b4('0x3b')](_0x3f4a22)['from'](_0x59f73e)[_0xf2b4('0x13')]('cm_contacts',null,_0xf2b4('0x3d')+_0x59f73e+_0xf2b4('0x3e'))['join'](_0x55726c,null,_0x55726c+_0xf2b4('0x14')+_0x59f73e+'.'+_0x42e154)[_0xf2b4('0x15')](_0x59f73e+_0xf2b4('0x3f'),_0xa32ed7)[_0xf2b4('0x15')](_0xf2b4('0x40'),NOW)[_0xf2b4('0x15')](_0xf2b4('0x41'),squel['select']()['field'](_0xf2b4('0x11'))[_0xf2b4('0x12')](_0xf2b4('0x45'))[_0xf2b4('0x15')](_0xf2b4('0x46'),_0xa32ed7)[_0xf2b4('0x15')](_0x42e154+_0xf2b4('0x47'),_0x59f73e+'.'+_0x42e154)))['toString']();}function insertCmHopperAdditionalPhones(_0x516f59){var _0x157f1c=[_0xf2b4('0x48'),_0xf2b4('0x49'),'cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt',_0xf2b4('0x4a')];return squel['insert']()[_0xf2b4('0x30')](_0xf2b4('0x4b'))[_0xf2b4('0x32')]([_0xf2b4('0x4c'),_0xf2b4('0x11'),'OrderBy','createdAt',_0xf2b4('0x37')],squel[_0xf2b4('0x10')]()[_0xf2b4('0x3b')](_0x157f1c)[_0xf2b4('0x12')](_0xf2b4('0x31'))[_0xf2b4('0x13')](_0xf2b4('0x3c'),null,_0xf2b4('0x4d'))[_0xf2b4('0x13')]('cm_contact_has_items',null,_0xf2b4('0x4e'))['where'](_0xf2b4('0x4f'),_0x516f59)[_0xf2b4('0x15')](_0xf2b4('0x40'),NOW))[_0xf2b4('0x44')]();}function insertCmContact(_0x3aca99,_0x175bc9,_0x22ce63,_0x36e357){var _0x142692=_[_0xf2b4('0x50')](_[_0xf2b4('0x51')](_0x36e357),[_0xf2b4('0x35'),_0xf2b4('0x52'),_0xf2b4('0x36'),_0xf2b4('0x37')]);return squel[_0xf2b4('0x2f')]()['into'](_0xf2b4('0x3c'))['fromQuery'](_0x142692,squel[_0xf2b4('0x10')]()[_0xf2b4('0x3b')](_0x142692)['from'](_0x175bc9)[_0xf2b4('0x15')]('('+_0x22ce63[_0xf2b4('0x13')](',')+_0xf2b4('0x53'),squel[_0xf2b4('0x10')]()[_0xf2b4('0x3b')](_0x22ce63)[_0xf2b4('0x12')](_0xf2b4('0x3c'))[_0xf2b4('0x15')](_0xf2b4('0x46'),_0x3aca99))['where'](_0xf2b4('0x54'),squel['select']()[_0xf2b4('0x55')](_0xf2b4('0x56'),_0xf2b4('0x57'))[_0xf2b4('0x12')](_0x175bc9)[_0xf2b4('0x58')](_0x22ce63[_0xf2b4('0x13')](','))))[_0xf2b4('0x44')]();}function handleStop(){logger[_0xf2b4('0x59')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x197f86){logger[_0xf2b4('0x1e')](_0x197f86['message']);process[_0xf2b4('0x5a')](0x1);}function handleError(_0x182ef6,_0x302805){stats['errors'][_0xf2b4('0x1b')]({'name':_0x302805[_0xf2b4('0x5b')],'message':_0x302805[_0xf2b4('0x1f')],'row':_0x182ef6});}function handleQuery(_0x4bbac7){logger[_0xf2b4('0x59')](_0x4bbac7);return db[_0xf2b4('0x5c')]['query'](_0x4bbac7)[_0xf2b4('0x17')](function(_0xc5097e){results[_0xf2b4('0x1b')](_0xc5097e);})[_0xf2b4('0x5d')](function(_0x1b7d09){logger['error'](_0x1b7d09[_0xf2b4('0x1f')]);});}function main(_0x3a775d,_0x2d2a36,_0x557717,_0x12f19c){logger[_0xf2b4('0x59')](_0xf2b4('0x5e'),_0x3a775d,JSON[_0xf2b4('0x5f')](_0x2d2a36));process[_0xf2b4('0x60')](_0xf2b4('0x61'));var _0x33132d=_0x2d2a36[_0xf2b4('0x62')];var _0x157abd=_['clone'](_0x33132d);var _0x2c3720=_0x2d2a36[_0xf2b4('0x63')];var _0x25cfa7=path[_0xf2b4('0x13')](config['root'],'server/files/tmp',_0x2c3720+_0xf2b4('0x64'));logger[_0xf2b4('0x59')]('body',_0x2d2a36);db['ContactItemType'][_0xf2b4('0x65')]({'raw':!![],'attributes':['id',_0xf2b4('0x66')]})[_0xf2b4('0x1d')](function(_0xb0c873){for(var _0x2065d1=0x0;_0x2065d1<_0xb0c873[_0xf2b4('0x18')];_0x2065d1++){if(_0xb0c873[_0x2065d1][_0xf2b4('0x66')]in _0x33132d){contactItemTypes['push'](_0xb0c873[_0x2065d1]);delete _0x157abd[_0xb0c873[_0x2065d1]['name']];hasAdditionalPhones=!![];}for(var _0x302983 in _0x33132d){if(_0xb0c873[_0x2065d1][_0xf2b4('0x66')]+_0xf2b4('0x67')===_0x302983){phoneDescriptions['push']({'itemTypeId':_0xb0c873[_0x2065d1]['id'],'description':_0x302983});delete _0x157abd[_0x302983];}}}if(hasAdditionalPhones)_0x157abd[_0xf2b4('0x1a')]='';var _0x316e2b=_['keys'](_0x157abd)[_0xf2b4('0x13')]();logger[_0xf2b4('0x59')](_0xf2b4('0x68'),_0x316e2b);fs[_0xf2b4('0x69')](_0x25cfa7,_0x316e2b+'\x0a');Papa['parse'](fs[_0xf2b4('0x6a')](_0x3a775d),{'header':!![],'skipEmptyLines':!![],'step':function(_0x454fd3,_0x2cda30){try{for(var _0x1f6537=0x0,_0x987c09=[];_0x1f6537<_0x454fd3[_0xf2b4('0x6b')]['length'];_0x1f6537++){stats[_0xf2b4('0x6c')]+=0x1;if(_0x454fd3['errors'][_0x1f6537]){handleError(_0x454fd3[_0xf2b4('0x6b')][_0x1f6537],_0x454fd3[_0xf2b4('0x6d')][_0x1f6537]);}else{var _0x42608c=[];var _0x5c69b2=[];var _0x221d29={};for(var _0x1d101d in _0x33132d){let _0x154069=contactItemTypes[_0xf2b4('0x6e')](_0x1f2f33=>_0x1f2f33['name']===_0x1d101d);let _0x5ac2e9=contactItemTypes[_0xf2b4('0x6e')](_0x4a66c4=>_0x4a66c4[_0xf2b4('0x66')]+_0xf2b4('0x67')===_0x1d101d);if(_['isNil'](_0x154069)&&_[_0xf2b4('0x19')](_0x5ac2e9)){if(_0x33132d[_0xf2b4('0x6f')](_0x1d101d)){if(_0x454fd3[_0xf2b4('0x6b')][_0x1f6537][_0x33132d[_0x1d101d]]){var _0x20e866=_[_0xf2b4('0x70')](_0x454fd3['data'][_0x1f6537][_0x33132d[_0x1d101d]][_0xf2b4('0x71')](/"/g,'\x27'));switch(_0x1d101d){case'scheduledat':var _0x34fecd=moment(_0x20e866,_0xf2b4('0xc'),!![]);if(_0x34fecd['isValid']()){_0x987c09[_0xf2b4('0x1b')]('\x22'+_0x20e866+'\x22');}else{_0x42608c[_0xf2b4('0x1b')](_0xf2b4('0x72'));}break;case _0xf2b4('0x38'):var _0x27d812=parseInt(_0x20e866);_0x20e866=_[_0xf2b4('0x73')](_0x27d812)||_0x27d812<0x0||_0x27d812>0x4?_0x12f19c?0x3:0x2:_0x27d812;_0x987c09[_0xf2b4('0x1b')]('\x22'+_0x20e866+'\x22');break;case _0xf2b4('0x39'):var _0x67cf8=parseInt(_0x20e866);if(_[_0xf2b4('0x74')](_0x67cf8)&&_[_0xf2b4('0x75')](_0x557717,_0x67cf8)){_0x987c09['push']('\x22'+_0x67cf8+'\x22');}else{_0x42608c[_0xf2b4('0x1b')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x20e866)){_0x987c09[_0xf2b4('0x1b')]('\x22'+_0x20e866+'\x22');}else{_0x42608c[_0xf2b4('0x1b')](_0xf2b4('0x76'));}break;case'dateOfBirth':var _0x37ba0f=moment(_0x20e866,_0xf2b4('0x77'),!![]);if(_0x37ba0f[_0xf2b4('0x78')]()){_0x987c09[_0xf2b4('0x1b')]('\x22'+_0x20e866+'\x22');}else{_0x42608c[_0xf2b4('0x1b')](_0xf2b4('0x79'));}break;default:_0x987c09[_0xf2b4('0x1b')]('\x22'+_0x20e866+'\x22');}}else{switch(_0x1d101d){case'firstName':case _0xf2b4('0x11'):_0x42608c['push'](_0x1d101d+'\x20not\x20specified');break;default:_0x987c09['push']('\x22\x22');}}}}else{var _0x362785='';if(!_[_0xf2b4('0x19')](_0x154069)){if(!_0x221d29[_0xf2b4('0x6f')](_0x154069['id'])){for(var _0x40b8c6=0x0;_0x40b8c6<_0x33132d[_0x1d101d][_0xf2b4('0x18')];_0x40b8c6++){var _0x20e866=_[_0xf2b4('0x70')](_0x454fd3[_0xf2b4('0x6b')][_0x1f6537][_0x33132d[_0x1d101d][_0x40b8c6]][_0xf2b4('0x71')](/"/g,'\x27'));var _0x36d827=phoneDescriptions[_0xf2b4('0x6e')](_0x497b01=>_0x497b01[_0xf2b4('0x7a')]===_0x154069['id']);if(!_[_0xf2b4('0x19')](_0x36d827)){var _0x13d46c=_['trim'](_0x454fd3[_0xf2b4('0x6b')][_0x1f6537][_0x33132d[_0x36d827[_0xf2b4('0x7b')]][0x0]]['replace'](/"/g,'\x27'));if(!_[_0xf2b4('0x19')](_0x13d46c))_0x20e866=_0x20e866+'§'+_0x13d46c;}if(_0x362785=='')_0x362785=_0x20e866;else _0x362785+='|'+_0x20e866;}_0x5c69b2[_0xf2b4('0x1b')](_0x154069['id']+':'+_0x362785);_0x221d29[_0x154069['id']]=0x1;}}}}if(hasAdditionalPhones){_0x987c09['push']('\x22'+_0x5c69b2[_0xf2b4('0x13')](';')+'\x22');}if(_0x42608c[_0xf2b4('0x18')]){handleError(_0x454fd3[_0xf2b4('0x6b')][_0x1f6537],{'code':_0xf2b4('0x7c'),'message':_0x42608c['join']()});}else{fs[_0xf2b4('0x7d')](_0x25cfa7,_0x987c09[_0xf2b4('0x13')]()+'\x0a');}_0x987c09=[];}if(!(stats[_0xf2b4('0x6c')]%0xc8)){socket[_0xf2b4('0x7e')]('contact:import:'+_0x2c3720,stats);stats[_0xf2b4('0x6d')]=[];}}if(stopped){logger['info'](_0xf2b4('0x7f'));_0x2cda30[_0xf2b4('0x80')]();}}catch(_0x11ce4c){handleError(_0x454fd3['data'][_0x1f6537],{'code':_0xf2b4('0x81'),'message':_0x11ce4c[_0xf2b4('0x1f')]});logger[_0xf2b4('0x1e')](_0xf2b4('0x82'),_0x11ce4c[_0xf2b4('0x1f')]);}},'complete':function(){try{var _0x566f3f=[];var _0x1f21e8=tempTableName;_0x566f3f[_0xf2b4('0x1b')](_0xf2b4('0x83')+_0x1f21e8+_0xf2b4('0x84'));logger[_0xf2b4('0x59')](_0xf2b4('0x85'),contactItemTypes[_0xf2b4('0x18')]);var _0x3c0c1a=util[_0xf2b4('0xb')](_0xf2b4('0x86'),_0x25cfa7,_0x1f21e8,_0x316e2b,_0x2d2a36[_0xf2b4('0x35')],_0x2d2a36[_0xf2b4('0x52')]||null,NOW,NOW);if(_['isNil'](_0x33132d[_0xf2b4('0x33')])){_0x3c0c1a+=_0xf2b4('0x87');}_0x566f3f[_0xf2b4('0x1b')](_0x3c0c1a);BPromise[_0xf2b4('0x88')](_0x566f3f,handleQuery)[_0xf2b4('0x1d')](function(_0x462128){BPromise[_0xf2b4('0x1c')]([handleAdditionalPhones()])[_0xf2b4('0x1d')](function(){_0x566f3f=[];for(var _0x19e84f=0x0;_0x19e84f\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','Contact.mobile','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','groupBy','Setting','findOne','all','clone','COUNT(*)','t.id\x20IN\x20?','exports','lodash','squel','../parsers/advancedSearch','./update-interaction','getAccountFK','agent','search','select','field','color','from','tools_tags','getInteractionFK','user_has_','u.id','ui.','left_join','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','getInteractionsTables','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','\x20=\x20i.id','interactionsTags','it.','expr','getSelectedTags','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','includes','fax','openchannel','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)'];(function(_0x543744,_0x254850){var _0x405ab8=function(_0x4ce39a){while(--_0x4ce39a){_0x543744['push'](_0x543744['shift']());}};_0x405ab8(++_0x254850);}(_0x4fcf,0x72));var _0xf4fc=function(_0x43f4a7,_0x5083ba){_0x43f4a7=_0x43f4a7-0x0;var _0x125146=_0x4fcf[_0x43f4a7];return _0x125146;};'use strict';var _=require(_0xf4fc('0x0'));var squel=require(_0xf4fc('0x1'));var as=require(_0xf4fc('0x2'));var qs=require('../parsers/qs');var updateInteraction=require(_0xf4fc('0x3'))['updateInteraction'];var utils=require('./utils');var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x564dcd,_0x191813,_0x1dbce4){var _0x2f7037=![];var _0x5c876d=utils[_0xf4fc('0x4')](_0x564dcd);if(_0x191813['role']===_0xf4fc('0x5')&&!_0x1dbce4[_0xf4fc('0x6')]&&!_0x1dbce4[_0x5c876d]){_0x2f7037=!![];}return _0x2f7037;}function getTagsQuery(){return squel[_0xf4fc('0x7')]()[_0xf4fc('0x8')]('id')['field']('name')[_0xf4fc('0x8')](_0xf4fc('0x9'))[_0xf4fc('0xa')](_0xf4fc('0xb'));}function getUsersQuery(_0x1ed1f7,_0x390f06){var _0x27a521=utils[_0xf4fc('0xc')](_0x1ed1f7);var _0x3a20b8=_0xf4fc('0xd')+_0x1ed1f7+'_interactions';var _0x1ad527=squel[_0xf4fc('0x7')]()[_0xf4fc('0x8')](_0xf4fc('0xe'))[_0xf4fc('0x8')]('u.fullname')[_0xf4fc('0x8')](_0xf4fc('0xf')+_0x27a521)['from'](_0x3a20b8,'ui')[_0xf4fc('0x10')](_0xf4fc('0x11'),'u',_0xf4fc('0x12'));if(_0x390f06[_0xf4fc('0x13')]>0x0){_0x1ad527[_0xf4fc('0x14')](_0xf4fc('0xf')+_0x27a521+_0xf4fc('0x15'),_[_0xf4fc('0x16')](_0x390f06,'id'));}return _0x1ad527;}function getInteractionsQuery(_0x46904e){var _0x575a76=utils[_0xf4fc('0x17')](_0x46904e);var _0x1bfd74=utils['getAccountFK'](_0x46904e);var _0x4fe674=utils[_0xf4fc('0xc')](_0x46904e);return squel[_0xf4fc('0x7')]()['from'](_0x575a76['interactions'],'i')[_0xf4fc('0x10')](_0xf4fc('0x18'),'c',_0xf4fc('0x19'))['left_join'](_0xf4fc('0x11'),'o',_0xf4fc('0x1a'))['left_join'](_0x575a76[_0xf4fc('0x1b')],'a',_0xf4fc('0x1c')+_0x1bfd74)[_0xf4fc('0x10')](_0x575a76['messages'],'me','me.'+_0x4fe674+_0xf4fc('0x1d'))[_0xf4fc('0x10')](_0x575a76[_0xf4fc('0x1e')],'it',_0xf4fc('0x1f')+_0x4fe674+'\x20=\x20i.id')[_0xf4fc('0x10')](_0xf4fc('0xb'),'t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x52642d={'body':squel[_0xf4fc('0x20')](),'contact':squel[_0xf4fc('0x20')](),'default':squel[_0xf4fc('0x20')](),'fields':squel[_0xf4fc('0x20')](),'filter':squel[_0xf4fc('0x20')](),'read':squel[_0xf4fc('0x20')](),'tags':{'clause':squel[_0xf4fc('0x20')](),'ids':null},'user':squel[_0xf4fc('0x20')]()};return _0x52642d;}function parseTagParameter(_0x2d8963){var _0x3d386e=squel[_0xf4fc('0x20')]();if(_0x2d8963){var _0x412c0f=utils[_0xf4fc('0x21')](_0x2d8963);_0x412c0f['forEach'](function(_0x38fa40){_0x3d386e['or'](_0xf4fc('0x22'),'%,'+_0x38fa40+',%');});}return _0x3d386e;}function parseReadParameter(_0x1685c1){var _0x34692e='';if(_0x1685c1){_0x34692e=_0xf4fc('0x23');if(_0x1685c1==='1'){_0x34692e=_0x34692e[_0xf4fc('0x24')](_0xf4fc('0x25'),'=');}else{_0x34692e=_0x34692e[_0xf4fc('0x24')](_0xf4fc('0x25'),'>');}}return _0x34692e;}function parseSearchFilter(_0x2f24bf,_0x30c189){var _0x282361=squel[_0xf4fc('0x20')]();if(_0x30c189){var _0x26fa9f=_0x30c189[_0xf4fc('0x24')]('\x5c','\x5c\x5c')[_0xf4fc('0x24')](/'/g,'\x27\x27');if(qs[_0xf4fc('0x26')](_0x26fa9f)){_0x282361['or'](_0xf4fc('0x27'),_0x26fa9f+'%');if([_0xf4fc('0x28'),'whatsapp'][_0xf4fc('0x29')](_0x2f24bf)){_0x282361['or']('i.phone\x20LIKE\x20?',_0x26fa9f+'%');}else if(_0x2f24bf===_0xf4fc('0x2a')){_0x282361['or']('i.fax\x20LIKE\x20?',_0x26fa9f+'%');}else if(_0x2f24bf===_0xf4fc('0x2b')){_0x282361['or']('i.from\x20LIKE\x20?',_0x26fa9f+'%');}}else if(_0x2f24bf==='mail'&&qs['isEmail'](_0x26fa9f)){_0x282361['or'](_0xf4fc('0x2c'),_0x26fa9f+'%');}else{if(_0x2f24bf==='mail'){_0x282361['or'](_0xf4fc('0x2d'),qs[_0xf4fc('0x2e')](_0x26fa9f,!![]))['or'](_0xf4fc('0x2f'),qs[_0xf4fc('0x2e')](_0x26fa9f));}else if(_0x2f24bf!==_0xf4fc('0x2a')){_0x282361['or'](_0xf4fc('0x30'),qs['getFullTextValue'](_0x26fa9f));}_0x282361['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xf4fc('0x2e')](_0x26fa9f,!![]),null);}}return _0x282361;}function parseAdvancedSearchFilter(_0x342227,_0x22c438){var _0x5a5ddd=getSqlClauses();var _0xa5c66f=as['parseSearch'](_0x342227);var _0x14022b=_0xa5c66f[_0xf4fc('0x31')];for(var _0x1c8098=0x0;_0x1c8098<_0xa5c66f[_0xf4fc('0x32')]['length'];_0x1c8098++){var _0x521b8f=_0xa5c66f[_0xf4fc('0x32')][_0x1c8098];var _0xf7232b='i';var _0xa3d19c=_[_0xf4fc('0x33')](_0x22c438,[_0xf4fc('0x34'),_0x521b8f[_0xf4fc('0x8')]]);if(_0xa3d19c){var _0xe52f7f=as[_0xf4fc('0x35')](_0xf7232b,_0xa3d19c[_0xf4fc('0x36')],_0x521b8f);_0x5a5ddd[_0xf4fc('0x37')][_0x14022b](_0xe52f7f[_0xf4fc('0x38')],_0xe52f7f['value'][_0xf4fc('0x39')],_0xe52f7f[_0xf4fc('0x3a')][_0xf4fc('0x3b')]);}else{switch(_0x521b8f['field']){case _0xf4fc('0x3c'):var _0x373327=parseReadParameter(_0x521b8f[_0xf4fc('0x3a')]);_0x5a5ddd[_0xf4fc('0x3d')][_0xf4fc('0x3e')](_0x373327);break;case _0xf4fc('0x3f'):if(_0x521b8f[_0xf4fc('0x40')]===_0xf4fc('0x41')){if(_0x521b8f[_0xf4fc('0x3a')]['split']('\x20')['length']>0x1){_0x5a5ddd[_0xf4fc('0x42')][_0x14022b](_0xf4fc('0x43'),qs['getFullTextValue'](_0x521b8f[_0xf4fc('0x3a')],!![]),null);}else{var _0xefe0d1='%'+_0x521b8f[_0xf4fc('0x3a')]+'%';_0x5a5ddd[_0xf4fc('0x42')][_0x14022b](_0xf4fc('0x44'),_0xefe0d1,_0xefe0d1,_0xefe0d1);}}else{_0xa3d19c=_['find'](_0x22c438,[_0xf4fc('0x34'),'ContactId']);_0x521b8f[_0xf4fc('0x8')]='ContactId';_0xe52f7f=as[_0xf4fc('0x35')](_0xf7232b,_0xa3d19c[_0xf4fc('0x36')],_0x521b8f);_0x5a5ddd[_0xf4fc('0x42')][_0x14022b](_0xe52f7f['text'],_0xe52f7f[_0xf4fc('0x3a')][_0xf4fc('0x39')],_0xe52f7f['value']['end']);}break;case _0xf4fc('0x45'):var _0x309a73=_0x521b8f[_0xf4fc('0x3a')]['split'](',')[_0xf4fc('0x16')](function(_0x11185f){return Number(_0x11185f);});var _0x74e4b2=parseTagParameter(_0x309a73);_0x5a5ddd[_0xf4fc('0x46')][_0xf4fc('0x47')][_0xf4fc('0x3e')](_0x74e4b2);_0x5a5ddd['tags'][_0xf4fc('0x48')]=_0x309a73;break;case _0xf4fc('0x49'):if(_0x521b8f[_0xf4fc('0x40')]==='$substring'){_0x5a5ddd[_0xf4fc('0x4a')][_0x14022b](_0xf4fc('0x4b'),'%'+_0x521b8f[_0xf4fc('0x3a')]+'%',null);}else{_0xa3d19c=_[_0xf4fc('0x33')](_0x22c438,[_0xf4fc('0x34'),_0xf4fc('0x4c')]);_0x521b8f[_0xf4fc('0x8')]='UserId';_0xe52f7f=as['buildExpression'](_0xf7232b,_0xa3d19c[_0xf4fc('0x36')],_0x521b8f);_0x5a5ddd[_0xf4fc('0x4a')][_0x14022b](_0xe52f7f['text'],_0xe52f7f[_0xf4fc('0x3a')][_0xf4fc('0x39')],_0xe52f7f[_0xf4fc('0x3a')][_0xf4fc('0x3b')]);}break;case _0xf4fc('0x4d'):case _0xf4fc('0x4e'):_0xe52f7f=as[_0xf4fc('0x35')]('me',null,_0x521b8f);_0x5a5ddd[_0xf4fc('0x4d')][_0x14022b](_0xe52f7f['text'],_0xe52f7f['value'][_0xf4fc('0x39')],_0xe52f7f[_0xf4fc('0x3a')][_0xf4fc('0x3b')]);break;}}}return _0x5a5ddd;}function parseModelFields(_0x570cf5,_0x4c87ee,_0x525b6a){var _0x5bd49c=utils['getAccountFK'](_0x570cf5);var _0x4ee5be=squel['expr']();var _0xde2586=_(_0x4c87ee)[_0xf4fc('0x4f')]()['map'](function(_0x9825f5){return _[_0xf4fc('0x50')](_0x525b6a,[_0xf4fc('0x34'),_0x9825f5])?_0x9825f5:undefined;})[_0xf4fc('0x51')]()['value']();if(_0xde2586[_0xf4fc('0x13')]>0x0){_0xde2586[_0xf4fc('0x52')](function(_0x12b794){if(_0x12b794===_0x5bd49c){_0x4ee5be[_0xf4fc('0x3e')]('i.'+_0x5bd49c+_0xf4fc('0x15'),[][_0xf4fc('0x53')](_0x4c87ee[_0x12b794]));}else if(_0x12b794===_0xf4fc('0x54')){var _0x3bbec3=JSON['parse'](_0x4c87ee[_0x12b794])[_0xf4fc('0x55')];var _0x2306fe=JSON['parse'](_0x4c87ee[_0x12b794])[_0xf4fc('0x56')];_0x4ee5be[_0xf4fc('0x3e')](_0xf4fc('0x57'),_0x3bbec3,_0x2306fe);}else{if(_0x4c87ee[_0x12b794]==='null'){_0x4ee5be[_0xf4fc('0x3e')]('i.'+_0x12b794+_0xf4fc('0x58'));}else{_0x4ee5be[_0xf4fc('0x3e')]('i.'+_0x12b794+'\x20=\x20?',_0x4c87ee[_0x12b794]);}}});}return _0x4ee5be;}function parseQueryParameters(_0xe88d8f,_0x1215e3,_0x309845){var _0x3860e1=getSqlClauses();return Promise[_0xf4fc('0x59')]()[_0xf4fc('0x5a')](function(){return parseModelFields(_0xe88d8f,_0x1215e3,_0x309845);})[_0xf4fc('0x5a')](function(_0x29e71f){_0x3860e1[_0xf4fc('0x5b')][_0xf4fc('0x3e')](_0x29e71f);return parseReadParameter(_0x1215e3[_0xf4fc('0x3d')]);})['then'](function(_0xe08a35){_0x3860e1[_0xf4fc('0x3d')]['and'](_0xe08a35);return parseTagParameter(_0x1215e3[_0xf4fc('0x5c')]);})[_0xf4fc('0x5a')](function(_0x2f261a){_0x3860e1[_0xf4fc('0x46')]['clause'][_0xf4fc('0x3e')](_0x2f261a);return parseSearchFilter(_0xe88d8f,_0x1215e3[_0xf4fc('0x5d')]);})['then'](function(_0x4d1712){_0x3860e1[_0xf4fc('0x5d')]=_0x4d1712;return _0x3860e1;});}function checkAccountsRestrictions(_0x121998,_0xcc8b5a,_0x3644fb){var _0x225dbb=utils[_0xf4fc('0x4')](_0x121998);var _0x13157d='get'+_[_0xf4fc('0x5e')](_0x121998)+(_0x121998===_0xf4fc('0x5f')?_0xf4fc('0x60'):_0xf4fc('0x61'));var _0x13e491=squel[_0xf4fc('0x20')]();return Promise[_0xf4fc('0x59')]()[_0xf4fc('0x5a')](function(){if(_0x3644fb[_0xf4fc('0x6')]&&_0xcc8b5a[_0xf4fc('0x62')]===_0xf4fc('0x5')){return _0xcc8b5a[_0x13157d]({'attributes':['id'],'raw':!![]});}})[_0xf4fc('0x5a')](function(_0x956a7b){if(_0x956a7b){if(_0x956a7b['length']===0x0){_0x13e491[_0xf4fc('0x3e')]('i.'+_0x225dbb+_0xf4fc('0x58'));}else{_0x13e491['and']('i.'+_0x225dbb+'\x20IN\x20?',_[_0xf4fc('0x16')](_0x956a7b,'id'));}}else if(!_0x3644fb[_0x225dbb]){_0x13e491[_0xf4fc('0x3e')]('i.'+_0x225dbb+_0xf4fc('0x63'));}})[_0xf4fc('0x5a')](function(){return _0x13e491;});}function getClosedOrderClause(_0x6f52a2,_0x12cd4c){var _0xbf4c81='';var _0xffea78=[_0xf4fc('0x64'),_0xf4fc('0x65'),_0xf4fc('0x66')];if(_0x6f52a2===_0xf4fc('0x67')){_0xffea78[_0xf4fc('0x68')](_0xf4fc('0x69'));}if(_0x12cd4c[_0xf4fc('0x6a')]==='0'&&_0x6f52a2==='mail'){_0xbf4c81='i.substatus';}else{if(_0x12cd4c[_0xf4fc('0x6a')]==='1'){_0xffea78[_0xf4fc('0x6b')]();}_0xbf4c81=_0xf4fc('0x6c')+_0xffea78[_0xf4fc('0x6d')](',\x20')+')';}return _0xbf4c81;}function getFilteredInteractions(_0x40be04,_0x1b04e6,_0x47b5aa,_0x4716ee){var _0x1827cf=utils[_0xf4fc('0xc')](_0x40be04);var _0xa4bfbf=_[_0xf4fc('0x5e')](_0x40be04)+'Interaction';var _0x4a140f=[];var _0xdfc7cc=getTagsQuery();var _0x2ce489={'type':db[_0xf4fc('0x6e')][_0xf4fc('0x6f')][_0xf4fc('0x70')],'raw':!![]};var _0x17b6a7=[];var _0x94b8a5=[];return db[_0xf4fc('0x71')][_0xf4fc('0x72')](_0xdfc7cc[_0xf4fc('0x73')](),_0x2ce489)[_0xf4fc('0x5a')](function(_0x143c62){_0x4a140f=_[_0xf4fc('0x74')](_0x143c62,'id');_0x2ce489=_[_0xf4fc('0x75')](_0x2ce489,{'model':db[_0xa4bfbf],'mapToModel':!![],'nest':!![]});if(_0x47b5aa['fields']){_0x4716ee['attributes'][_0xf4fc('0x52')](function(_0x5ef7d4){_0x1b04e6[_0xf4fc('0x8')]('i.'+_0x5ef7d4);});}else{_0x1b04e6[_0xf4fc('0x8')](_0xf4fc('0x76'),_0xf4fc('0x3c'));_0x1b04e6[_0xf4fc('0x8')]('a.key','Account.key');_0x1b04e6[_0xf4fc('0x8')](_0xf4fc('0x77'),_0xf4fc('0x78'));if(_0x40be04==='mail'){_0x1b04e6[_0xf4fc('0x8')](_0xf4fc('0x79'),_0xf4fc('0x7a'));_0x1b04e6[_0xf4fc('0x8')]('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',_0xf4fc('0x7b'));_0x1b04e6[_0xf4fc('0x8')](_0xf4fc('0x7c'));_0x1b04e6[_0xf4fc('0x8')](_0xf4fc('0x7d'));_0x1b04e6['field'](_0xf4fc('0x7e'));_0x1b04e6[_0xf4fc('0x8')](_0xf4fc('0x7f'));_0x1b04e6[_0xf4fc('0x8')]('i.closedAt');_0x1b04e6[_0xf4fc('0x8')]('i.attach');_0x1b04e6['field'](_0xf4fc('0x80'));_0x1b04e6[_0xf4fc('0x8')]('i.lastMsgDirection');_0x1b04e6[_0xf4fc('0x8')](_0xf4fc('0x81'));_0x1b04e6[_0xf4fc('0x8')](_0xf4fc('0x66'));_0x1b04e6[_0xf4fc('0x8')]('i.secondDisposition');_0x1b04e6[_0xf4fc('0x8')](_0xf4fc('0x64'));_0x1b04e6[_0xf4fc('0x8')]('i.substatus');_0x1b04e6[_0xf4fc('0x8')](_0xf4fc('0x82'));_0x1b04e6[_0xf4fc('0x8')](_0xf4fc('0x83'));_0x1b04e6[_0xf4fc('0x8')](_0xf4fc('0x84'));_0x1b04e6[_0xf4fc('0x8')](_0xf4fc('0x85'));}else if(_0x40be04==='openchannel'){_0x1b04e6['field'](_0xf4fc('0x86'),_0xf4fc('0x7b'));}else{_0x1b04e6['field'](_0xf4fc('0x87'),'contactName');}if(_0x40be04!==_0xf4fc('0x67')){_0x1b04e6[_0xf4fc('0x8')](_0xf4fc('0x88'));}_0x1b04e6['field'](_0xf4fc('0x89'),'Contact.firstName');_0x1b04e6[_0xf4fc('0x8')](_0xf4fc('0x8a'),_0xf4fc('0x8b'));_0x1b04e6['field'](_0xf4fc('0x8c'),_0xf4fc('0x8d'));_0x1b04e6[_0xf4fc('0x8')]('c.phone',_0xf4fc('0x8e'));_0x1b04e6['field']('c.mobile',_0xf4fc('0x8f'));_0x1b04e6[_0xf4fc('0x8')]('c.fax',_0xf4fc('0x90'));_0x1b04e6[_0xf4fc('0x8')](_0xf4fc('0x91'),'Owner.fullname');_0x1b04e6['field'](_0xf4fc('0x92'),_0xf4fc('0x93'));_0x1b04e6[_0xf4fc('0x8')](_0xf4fc('0x94'),_0xf4fc('0x95'));}if(_0x4716ee[_0xf4fc('0x96')]){_0x1b04e6['limit'](_0x4716ee['limit']);}if(_0x4716ee[_0xf4fc('0x97')]){_0x1b04e6[_0xf4fc('0x97')](_0x4716ee[_0xf4fc('0x97')]);}return db[_0xf4fc('0x71')][_0xf4fc('0x72')](_0x1b04e6[_0xf4fc('0x73')](),_0x2ce489);})[_0xf4fc('0x5a')](function(_0x5e35a0){_0x17b6a7=_0x5e35a0;var _0x1b1809=getUsersQuery(_0x40be04,_0x17b6a7);return db[_0xf4fc('0x71')][_0xf4fc('0x72')](_0x1b1809[_0xf4fc('0x73')](),_0x2ce489);})[_0xf4fc('0x5a')](function(_0x5aad44){_0x94b8a5=_[_0xf4fc('0x98')](_0x5aad44,_0x1827cf);if(_0x40be04==='mail'){return db[_0xf4fc('0x99')][_0xf4fc('0x9a')]({'attributes':['enableEmailPreview'],'raw':!![]});}})[_0xf4fc('0x5a')](function(_0x312c84){var _0x10fde0=_0x312c84?_0x312c84['enableEmailPreview']:undefined;var _0x5dd515=_0x17b6a7[_0xf4fc('0x16')](function(_0x30304f){return updateInteraction(_0x30304f,_0x4a140f,_0x94b8a5,_0x10fde0);});return Promise[_0xf4fc('0x9b')](_0x5dd515);});}function countFilteredInteractions(_0x840982,_0xf7788f){var _0x37f990=_0x840982[_0xf4fc('0x9c')]();_0x37f990['field'](_0xf4fc('0x9d'));_0x37f990[_0xf4fc('0x8')](_0xf4fc('0x76'),_0xf4fc('0x3c'));var _0xf9d5d1=utils[_0xf4fc('0x21')](_0xf7788f);if(!_['isEmpty'](_0xf9d5d1)){_0x37f990[_0xf4fc('0x14')](_0xf4fc('0x9e'),_0xf9d5d1);}var _0x4494d2={'type':db[_0xf4fc('0x6e')][_0xf4fc('0x6f')][_0xf4fc('0x70')],'raw':!![]};return db[_0xf4fc('0x71')]['query'](_0x37f990['toString'](),_0x4494d2);}module[_0xf4fc('0x9f')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x2739=['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','c.firstName','Contact.firstName','c.lastName','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','query','groupBy','findOne','enableEmailPreview','all','clone','COUNT(*)','isEmpty','exports','lodash','squel','../parsers/qs','updateInteraction','./utils','../../mysqldb','role','agent','select','field','color','from','tools_tags','user_has_','_interactions','u.id','u.fullname','ui.','left_join','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','getAccountFK','getInteractionFK','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.phone\x20LIKE\x20?','fax','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)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','sqlOperator','conditions','find','name','buildExpression','type','default','text','value','unreadMessages','read','and','Contact','operator','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','start','end','Tag','tags','clause','ids','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','plainBody','keys','some','compact','forEach','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','tag','filter','get','capitalize','chat','Websites','Accounts','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.disposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','QueryTypes','SELECT','sequelize','toString','keyBy','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.lastMsgDirection','i.secondDisposition','i.to','i.MailAccountId'];(function(_0xcad01d,_0xef9abc){var _0x76a4a6=function(_0x15b2a4){while(--_0x15b2a4){_0xcad01d['push'](_0xcad01d['shift']());}};_0x76a4a6(++_0xef9abc);}(_0x2739,0x16f));var _0x9273=function(_0x5b732a,_0x48ea3b){_0x5b732a=_0x5b732a-0x0;var _0x3e418d=_0x2739[_0x5b732a];return _0x3e418d;};'use strict';var _=require(_0x9273('0x0'));var squel=require(_0x9273('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0x9273('0x2'));var updateInteraction=require('./update-interaction')[_0x9273('0x3')];var utils=require(_0x9273('0x4'));var db=require(_0x9273('0x5'))['db'];function skipInteractionsQuery(_0xd6f70c,_0x115a2d,_0xb34724){var _0xa3f38e=![];var _0x1c6434=utils['getAccountFK'](_0xd6f70c);if(_0x115a2d[_0x9273('0x6')]===_0x9273('0x7')&&!_0xb34724['search']&&!_0xb34724[_0x1c6434]){_0xa3f38e=!![];}return _0xa3f38e;}function getTagsQuery(){return squel[_0x9273('0x8')]()[_0x9273('0x9')]('id')['field']('name')[_0x9273('0x9')](_0x9273('0xa'))[_0x9273('0xb')](_0x9273('0xc'));}function getUsersQuery(_0x57b60a,_0x2a52d7){var _0x391c80=utils['getInteractionFK'](_0x57b60a);var _0x3e49f1=_0x9273('0xd')+_0x57b60a+_0x9273('0xe');var _0x346b16=squel[_0x9273('0x8')]()[_0x9273('0x9')](_0x9273('0xf'))['field'](_0x9273('0x10'))['field'](_0x9273('0x11')+_0x391c80)['from'](_0x3e49f1,'ui')[_0x9273('0x12')]('users','u',_0x9273('0x13'));if(_0x2a52d7[_0x9273('0x14')]>0x0){_0x346b16[_0x9273('0x15')](_0x9273('0x11')+_0x391c80+_0x9273('0x16'),_[_0x9273('0x17')](_0x2a52d7,'id'));}return _0x346b16;}function getInteractionsQuery(_0x86c726){var _0x2525df=utils['getInteractionsTables'](_0x86c726);var _0x42198f=utils[_0x9273('0x18')](_0x86c726);var _0x560679=utils[_0x9273('0x19')](_0x86c726);return squel[_0x9273('0x8')]()['from'](_0x2525df[_0x9273('0x1a')],'i')[_0x9273('0x12')](_0x9273('0x1b'),'c',_0x9273('0x1c'))[_0x9273('0x12')](_0x9273('0x1d'),'o',_0x9273('0x1e'))['left_join'](_0x2525df[_0x9273('0x1f')],'a',_0x9273('0x20')+_0x42198f)[_0x9273('0x12')](_0x2525df[_0x9273('0x21')],'me','me.'+_0x560679+_0x9273('0x22'))[_0x9273('0x12')](_0x2525df[_0x9273('0x23')],'it',_0x9273('0x24')+_0x560679+_0x9273('0x22'))[_0x9273('0x12')]('tools_tags','t',_0x9273('0x25'));}function getSqlClauses(){var _0x2a4050={'body':squel[_0x9273('0x26')](),'contact':squel['expr'](),'default':squel[_0x9273('0x26')](),'fields':squel[_0x9273('0x26')](),'filter':squel['expr'](),'read':squel[_0x9273('0x26')](),'tags':{'clause':squel[_0x9273('0x26')](),'ids':null},'user':squel['expr']()};return _0x2a4050;}function parseTagParameter(_0x2e2b39){var _0x2a47b7=squel[_0x9273('0x26')]();if(_0x2e2b39){var _0x1c75e6=utils[_0x9273('0x27')](_0x2e2b39);_0x1c75e6['forEach'](function(_0x1f89a3){_0x2a47b7['or'](_0x9273('0x28'),'%,'+_0x1f89a3+',%');});}return _0x2a47b7;}function parseReadParameter(_0xf25571){var _0x302188='';if(_0xf25571){_0x302188=_0x9273('0x29');if(_0xf25571==='1'){_0x302188=_0x302188[_0x9273('0x2a')](_0x9273('0x2b'),'=');}else{_0x302188=_0x302188['replace']('{OPERATOR}','>');}}return _0x302188;}function parseSearchFilter(_0x412044,_0x5dcdd9){var _0x127464=squel[_0x9273('0x26')]();if(_0x5dcdd9){var _0x2c6594=_0x5dcdd9['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x9273('0x2c')](_0x2c6594)){_0x127464['or'](_0x9273('0x2d'),_0x2c6594+'%');if([_0x9273('0x2e'),_0x9273('0x2f')][_0x9273('0x30')](_0x412044)){_0x127464['or'](_0x9273('0x31'),_0x2c6594+'%');}else if(_0x412044===_0x9273('0x32')){_0x127464['or']('i.fax\x20LIKE\x20?',_0x2c6594+'%');}else if(_0x412044==='openchannel'){_0x127464['or']('i.from\x20LIKE\x20?',_0x2c6594+'%');}}else if(_0x412044===_0x9273('0x33')&&qs[_0x9273('0x34')](_0x2c6594)){_0x127464['or'](_0x9273('0x35'),_0x2c6594+'%');}else{if(_0x412044===_0x9273('0x33')){_0x127464['or'](_0x9273('0x36'),qs[_0x9273('0x37')](_0x2c6594,!![]))['or'](_0x9273('0x38'),qs[_0x9273('0x37')](_0x2c6594));}else if(_0x412044!=='fax'){_0x127464['or'](_0x9273('0x39'),qs[_0x9273('0x37')](_0x2c6594));}_0x127464['or'](_0x9273('0x3a'),qs[_0x9273('0x37')](_0x2c6594,!![]),null);}}return _0x127464;}function parseAdvancedSearchFilter(_0x4e54d9,_0xe21435){var _0xa7362b=getSqlClauses();var _0x596a53=as['parseSearch'](_0x4e54d9);var _0x1575d4=_0x596a53[_0x9273('0x3b')];for(var _0x50a206=0x0;_0x50a206<_0x596a53[_0x9273('0x3c')][_0x9273('0x14')];_0x50a206++){var _0x1bd031=_0x596a53['conditions'][_0x50a206];var _0xb6097='i';var _0x4f671c=_[_0x9273('0x3d')](_0xe21435,[_0x9273('0x3e'),_0x1bd031['field']]);if(_0x4f671c){var _0x4740c5=as[_0x9273('0x3f')](_0xb6097,_0x4f671c[_0x9273('0x40')],_0x1bd031);_0xa7362b[_0x9273('0x41')][_0x1575d4](_0x4740c5[_0x9273('0x42')],_0x4740c5[_0x9273('0x43')]['start'],_0x4740c5[_0x9273('0x43')]['end']);}else{switch(_0x1bd031[_0x9273('0x9')]){case _0x9273('0x44'):var _0x485df5=parseReadParameter(_0x1bd031[_0x9273('0x43')]);_0xa7362b[_0x9273('0x45')][_0x9273('0x46')](_0x485df5);break;case _0x9273('0x47'):if(_0x1bd031[_0x9273('0x48')]===_0x9273('0x49')){if(_0x1bd031[_0x9273('0x43')][_0x9273('0x4a')]('\x20')['length']>0x1){_0xa7362b[_0x9273('0x4b')][_0x1575d4]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x9273('0x37')](_0x1bd031['value'],!![]),null);}else{var _0x23a7fb='%'+_0x1bd031[_0x9273('0x43')]+'%';_0xa7362b['contact'][_0x1575d4](_0x9273('0x4c'),_0x23a7fb,_0x23a7fb,_0x23a7fb);}}else{_0x4f671c=_[_0x9273('0x3d')](_0xe21435,[_0x9273('0x3e'),_0x9273('0x4d')]);_0x1bd031['field']=_0x9273('0x4d');_0x4740c5=as['buildExpression'](_0xb6097,_0x4f671c[_0x9273('0x40')],_0x1bd031);_0xa7362b['contact'][_0x1575d4](_0x4740c5['text'],_0x4740c5[_0x9273('0x43')][_0x9273('0x4e')],_0x4740c5[_0x9273('0x43')][_0x9273('0x4f')]);}break;case _0x9273('0x50'):var _0xbee5e0=_0x1bd031[_0x9273('0x43')][_0x9273('0x4a')](',')[_0x9273('0x17')](function(_0x31a6a1){return Number(_0x31a6a1);});var _0x4c2e94=parseTagParameter(_0xbee5e0);_0xa7362b[_0x9273('0x51')][_0x9273('0x52')][_0x9273('0x46')](_0x4c2e94);_0xa7362b[_0x9273('0x51')][_0x9273('0x53')]=_0xbee5e0;break;case _0x9273('0x54'):if(_0x1bd031['operator']==='$substring'){_0xa7362b[_0x9273('0x55')][_0x1575d4](_0x9273('0x56'),'%'+_0x1bd031['value']+'%',null);}else{_0x4f671c=_[_0x9273('0x3d')](_0xe21435,[_0x9273('0x3e'),_0x9273('0x57')]);_0x1bd031[_0x9273('0x9')]=_0x9273('0x57');_0x4740c5=as[_0x9273('0x3f')](_0xb6097,_0x4f671c['type'],_0x1bd031);_0xa7362b['user'][_0x1575d4](_0x4740c5[_0x9273('0x42')],_0x4740c5['value'][_0x9273('0x4e')],_0x4740c5['value'][_0x9273('0x4f')]);}break;case _0x9273('0x58'):case _0x9273('0x59'):_0x4740c5=as[_0x9273('0x3f')]('me',null,_0x1bd031);_0xa7362b[_0x9273('0x58')][_0x1575d4](_0x4740c5[_0x9273('0x42')],_0x4740c5[_0x9273('0x43')][_0x9273('0x4e')],_0x4740c5[_0x9273('0x43')][_0x9273('0x4f')]);break;}}}return _0xa7362b;}function parseModelFields(_0x309864,_0x10b077,_0x18f6ce){var _0x1c1a97=utils['getAccountFK'](_0x309864);var _0x353442=squel[_0x9273('0x26')]();var _0x366c83=_(_0x10b077)[_0x9273('0x5a')]()[_0x9273('0x17')](function(_0x4e5f70){return _[_0x9273('0x5b')](_0x18f6ce,['name',_0x4e5f70])?_0x4e5f70:undefined;})[_0x9273('0x5c')]()[_0x9273('0x43')]();if(_0x366c83[_0x9273('0x14')]>0x0){_0x366c83[_0x9273('0x5d')](function(_0xb3978a){if(_0xb3978a===_0x1c1a97){_0x353442['and']('i.'+_0x1c1a97+_0x9273('0x16'),[]['concat'](_0x10b077[_0xb3978a]));}else if(_0xb3978a===_0x9273('0x5e')){var _0x5384cc=JSON[_0x9273('0x5f')](_0x10b077[_0xb3978a])[_0x9273('0x60')];var _0x25a710=JSON['parse'](_0x10b077[_0xb3978a])['$lte'];_0x353442['and'](_0x9273('0x61'),_0x5384cc,_0x25a710);}else{if(_0x10b077[_0xb3978a]===_0x9273('0x62')){_0x353442[_0x9273('0x46')]('i.'+_0xb3978a+_0x9273('0x63'));}else{_0x353442[_0x9273('0x46')]('i.'+_0xb3978a+_0x9273('0x64'),_0x10b077[_0xb3978a]);}}});}return _0x353442;}function parseQueryParameters(_0x65ee77,_0x2b60cb,_0x5bd26b){var _0x4724e1=getSqlClauses();return Promise[_0x9273('0x65')]()[_0x9273('0x66')](function(){return parseModelFields(_0x65ee77,_0x2b60cb,_0x5bd26b);})[_0x9273('0x66')](function(_0x2979ed){_0x4724e1[_0x9273('0x67')]['and'](_0x2979ed);return parseReadParameter(_0x2b60cb['read']);})['then'](function(_0x35e1ee){_0x4724e1[_0x9273('0x45')][_0x9273('0x46')](_0x35e1ee);return parseTagParameter(_0x2b60cb[_0x9273('0x68')]);})[_0x9273('0x66')](function(_0x451991){_0x4724e1[_0x9273('0x51')][_0x9273('0x52')][_0x9273('0x46')](_0x451991);return parseSearchFilter(_0x65ee77,_0x2b60cb[_0x9273('0x69')]);})[_0x9273('0x66')](function(_0x535a08){_0x4724e1[_0x9273('0x69')]=_0x535a08;return _0x4724e1;});}function checkAccountsRestrictions(_0x449f3d,_0x4357df,_0x5c498a){var _0x3e11aa=utils['getAccountFK'](_0x449f3d);var _0x324f8b=_0x9273('0x6a')+_[_0x9273('0x6b')](_0x449f3d)+(_0x449f3d===_0x9273('0x6c')?_0x9273('0x6d'):_0x9273('0x6e'));var _0x360775=squel[_0x9273('0x26')]();return Promise[_0x9273('0x65')]()[_0x9273('0x66')](function(){if(_0x5c498a['search']&&_0x4357df[_0x9273('0x6')]===_0x9273('0x7')){return _0x4357df[_0x324f8b]({'attributes':['id'],'raw':!![]});}})[_0x9273('0x66')](function(_0x2936d8){if(_0x2936d8){if(_0x2936d8[_0x9273('0x14')]===0x0){_0x360775[_0x9273('0x46')]('i.'+_0x3e11aa+_0x9273('0x63'));}else{_0x360775[_0x9273('0x46')]('i.'+_0x3e11aa+'\x20IN\x20?',_['map'](_0x2936d8,'id'));}}else if(!_0x5c498a[_0x3e11aa]){_0x360775['and']('i.'+_0x3e11aa+_0x9273('0x6f'));}})[_0x9273('0x66')](function(){return _0x360775;});}function getClosedOrderClause(_0x448e45,_0x55c1fb){var _0xad716e='';var _0x564514=[_0x9273('0x70'),'i.secondDisposition',_0x9273('0x71')];if(_0x448e45==='mail'){_0x564514[_0x9273('0x72')](_0x9273('0x73'));}if(_0x55c1fb[_0x9273('0x74')]==='0'&&_0x448e45===_0x9273('0x33')){_0xad716e=_0x9273('0x73');}else{if(_0x55c1fb[_0x9273('0x74')]==='1'){_0x564514[_0x9273('0x75')]();}_0xad716e=_0x9273('0x76')+_0x564514[_0x9273('0x77')](',\x20')+')';}return _0xad716e;}function getFilteredInteractions(_0x32ad66,_0x4b0b79,_0x4637d9,_0x512617){var _0x351b17=utils[_0x9273('0x19')](_0x32ad66);var _0x263a75=_[_0x9273('0x6b')](_0x32ad66)+_0x9273('0x78');var _0x3c93eb=[];var _0x10719c=getTagsQuery();var _0x51daab={'type':db[_0x9273('0x79')][_0x9273('0x7a')][_0x9273('0x7b')],'raw':!![]};var _0x5d6efb=[];var _0x1d5f72=[];return db[_0x9273('0x7c')]['query'](_0x10719c[_0x9273('0x7d')](),_0x51daab)[_0x9273('0x66')](function(_0x26ca22){_0x3c93eb=_[_0x9273('0x7e')](_0x26ca22,'id');_0x51daab=_[_0x9273('0x7f')](_0x51daab,{'model':db[_0x263a75],'mapToModel':!![],'nest':!![]});if(_0x4637d9[_0x9273('0x67')]){_0x512617[_0x9273('0x80')][_0x9273('0x5d')](function(_0x29c5ea){_0x4b0b79[_0x9273('0x9')]('i.'+_0x29c5ea);});}else{_0x4b0b79[_0x9273('0x9')](_0x9273('0x81'),_0x9273('0x44'));_0x4b0b79[_0x9273('0x9')](_0x9273('0x82'),'Account.key');_0x4b0b79[_0x9273('0x9')]('a.mandatoryDisposition',_0x9273('0x83'));if(_0x32ad66===_0x9273('0x33')){_0x4b0b79['field'](_0x9273('0x84'),_0x9273('0x85'));_0x4b0b79['field'](_0x9273('0x86'),_0x9273('0x87'));_0x4b0b79['field'](_0x9273('0x88'));_0x4b0b79['field'](_0x9273('0x89'));_0x4b0b79[_0x9273('0x9')](_0x9273('0x8a'));_0x4b0b79[_0x9273('0x9')](_0x9273('0x8b'));_0x4b0b79[_0x9273('0x9')]('i.closedAt');_0x4b0b79['field'](_0x9273('0x8c'));_0x4b0b79[_0x9273('0x9')](_0x9273('0x8d'));_0x4b0b79[_0x9273('0x9')](_0x9273('0x8e'));_0x4b0b79[_0x9273('0x9')]('i.subject');_0x4b0b79[_0x9273('0x9')]('i.disposition');_0x4b0b79[_0x9273('0x9')](_0x9273('0x8f'));_0x4b0b79[_0x9273('0x9')](_0x9273('0x70'));_0x4b0b79['field'](_0x9273('0x73'));_0x4b0b79['field'](_0x9273('0x90'));_0x4b0b79[_0x9273('0x9')]('i.ContactId');_0x4b0b79[_0x9273('0x9')](_0x9273('0x91'));_0x4b0b79[_0x9273('0x9')]('i.UserId');}else if(_0x32ad66==='openchannel'){_0x4b0b79['field'](_0x9273('0x92'),'contactName');}else{_0x4b0b79[_0x9273('0x9')]('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',_0x9273('0x87'));}if(_0x32ad66!=='mail'){_0x4b0b79[_0x9273('0x9')]('i.*');}_0x4b0b79[_0x9273('0x9')](_0x9273('0x93'),_0x9273('0x94'));_0x4b0b79[_0x9273('0x9')](_0x9273('0x95'),'Contact.lastName');_0x4b0b79[_0x9273('0x9')]('c.email',_0x9273('0x96'));_0x4b0b79[_0x9273('0x9')](_0x9273('0x97'),'Contact.phone');_0x4b0b79[_0x9273('0x9')](_0x9273('0x98'),_0x9273('0x99'));_0x4b0b79['field'](_0x9273('0x9a'),_0x9273('0x9b'));_0x4b0b79['field'](_0x9273('0x9c'),'Owner.fullname');_0x4b0b79['field']('o.internal',_0x9273('0x9d'));_0x4b0b79[_0x9273('0x9')](_0x9273('0x9e'),_0x9273('0x9f'));}if(_0x512617[_0x9273('0xa0')]){_0x4b0b79[_0x9273('0xa0')](_0x512617['limit']);}if(_0x512617['offset']){_0x4b0b79[_0x9273('0xa1')](_0x512617[_0x9273('0xa1')]);}return db['sequelize'][_0x9273('0xa2')](_0x4b0b79['toString'](),_0x51daab);})['then'](function(_0x141312){_0x5d6efb=_0x141312;var _0x28a47f=getUsersQuery(_0x32ad66,_0x5d6efb);return db['sequelize']['query'](_0x28a47f['toString'](),_0x51daab);})[_0x9273('0x66')](function(_0x4f4b2c){_0x1d5f72=_[_0x9273('0xa3')](_0x4f4b2c,_0x351b17);if(_0x32ad66===_0x9273('0x33')){return db['Setting'][_0x9273('0xa4')]({'attributes':['enableEmailPreview'],'raw':!![]});}})[_0x9273('0x66')](function(_0x16d658){var _0x39e8dc=_0x16d658?_0x16d658[_0x9273('0xa5')]:undefined;var _0x550544=_0x5d6efb[_0x9273('0x17')](function(_0x31044b){return updateInteraction(_0x31044b,_0x3c93eb,_0x1d5f72,_0x39e8dc);});return Promise[_0x9273('0xa6')](_0x550544);});}function countFilteredInteractions(_0x216cc4,_0x35298e){var _0x327932=_0x216cc4[_0x9273('0xa7')]();_0x327932[_0x9273('0x9')](_0x9273('0xa8'));_0x327932[_0x9273('0x9')](_0x9273('0x81'),_0x9273('0x44'));var _0x34227c=utils[_0x9273('0x27')](_0x35298e);if(!_[_0x9273('0xa9')](_0x34227c)){_0x327932[_0x9273('0x15')]('t.id\x20IN\x20?',_0x34227c);}var _0x15834e={'type':db[_0x9273('0x79')][_0x9273('0x7a')][_0x9273('0x7b')],'raw':!![]};return db['sequelize']['query'](_0x327932[_0x9273('0x7d')](),_0x15834e);}module[_0x9273('0xaa')]={'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 def41a2..40ed74c 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 _0x5ee8=['abandoned','total','UserId','disposition','out','plainBody','-id','then','lastMsgText','updateInteraction','TagIds','catch','lodash','map','fullname','push','waiting','talking','unmanaged'];(function(_0x2cc52e,_0x1fd216){var _0x2c5429=function(_0x4cd55a){while(--_0x4cd55a){_0x2cc52e['push'](_0x2cc52e['shift']());}};_0x2c5429(++_0x1fd216);}(_0x5ee8,0xf0));var _0x85ee=function(_0x19cd79,_0x4884cd){_0x19cd79=_0x19cd79-0x0;var _0x5380ae=_0x5ee8[_0x19cd79];return _0x5380ae;};'use strict';var _=require(_0x85ee('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x2bac74,_0x5c5189){return new Promise(function(_0x3b4f1c,_0x4b3b8d){try{var _0x515f50=[];if(_0x5c5189[_0x2bac74]){_0x515f50=_0x5c5189[_0x2bac74][_0x85ee('0x1')](function(_0x696d08){return{'id':_0x696d08['id'],'fullname':_0x696d08[_0x85ee('0x2')]};});}return _0x3b4f1c(_0x515f50);}catch(_0x2590a6){_0x4b3b8d(_0x2590a6);}});}function getInteractionTags(_0x37b2ba,_0x48879a){var _0x4a7aa3=[];if(_0x37b2ba){_0x37b2ba['split'](',')['forEach'](function(_0x50d0f8){_0x4a7aa3[_0x85ee('0x3')](_0x48879a[_0x50d0f8]);});}return _0x4a7aa3;}function updateWaitingCounter(_0x212fd5){if(_0x212fd5[_0x85ee('0x4')]){_0x212fd5['waiting']-=0x1;}}function updateInteractionCounters(_0x26d34c){_0x26d34c[_0x85ee('0x4')]=0x0;_0x26d34c[_0x85ee('0x5')]=0x0;_0x26d34c['answered']=0x0;_0x26d34c[_0x85ee('0x6')]=0x0;_0x26d34c[_0x85ee('0x7')]=0x0;_0x26d34c[_0x85ee('0x8')]=0x0;if(_0x26d34c['closed']){if(_0x26d34c['disposition']===_0x85ee('0x7')){_0x26d34c[_0x85ee('0x7')]+=0x1;updateWaitingCounter(_0x26d34c);}if(_0x26d34c[_0x85ee('0x9')]){_0x26d34c['answered']+=0x1;if(_0x26d34c[_0x85ee('0x5')]){_0x26d34c[_0x85ee('0x5')]-=0x1;}}else{if(_0x26d34c[_0x85ee('0xa')]){_0x26d34c['unmanaged']+=0x1;updateWaitingCounter(_0x26d34c);}}}else{if(!_0x26d34c[_0x85ee('0x9')]){_0x26d34c[_0x85ee('0x4')]+=0x1;}if(_0x26d34c[_0x85ee('0x9')]){_0x26d34c[_0x85ee('0x5')]+=0x1;updateWaitingCounter(_0x26d34c);}}_0x26d34c['total']+=0x1;return _0x26d34c;}function getLastMessageText(_0x11dfdc){return db['MailMessage']['findOne']({'where':{'$and':[{'MailInteractionId':_0x11dfdc['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x85ee('0xb')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x85ee('0xc')],'order':_0x85ee('0xd'),'raw':!![]})[_0x85ee('0xe')](function(_0x32f714){if(_0x32f714&&_0x32f714[_0x85ee('0xc')]){_0x11dfdc[_0x85ee('0xf')]=_['trimStart'](_0x32f714[_0x85ee('0xc')]);}return _0x11dfdc;})['catch'](function(_0x17e677){throw _0x17e677;});}exports[_0x85ee('0x10')]=function(_0xc59343,_0x2aae37,_0x2769d7,_0x2d1a5f){return new Promise(function(_0x3b0936,_0x2be6a1){return getInteractionUsers(_0xc59343['id'],_0x2769d7)[_0x85ee('0xe')](function(_0x2f803b){_0xc59343['Users']=_0x2f803b;return getInteractionTags(_0xc59343[_0x85ee('0x11')],_0x2aae37);})[_0x85ee('0xe')](function(_0x51cf71){_0xc59343['Tags']=_0x51cf71;delete _0xc59343[_0x85ee('0x11')];return updateInteractionCounters(_0xc59343);})['then'](function(_0x5e5c9d){if(_0x2d1a5f){return getLastMessageText(_0x5e5c9d);}else{return _0x5e5c9d;}})[_0x85ee('0xe')](function(_0x13e73b){_0x3b0936(_0x13e73b);})[_0x85ee('0x12')](function(_0x2a0f30){_0x2be6a1(_0x2a0f30);});});}; \ No newline at end of file +var _0x8e27=['UserId','answered','unmanaged','MailMessage','findOne','out','plainBody','-id','then','lastMsgText','trimStart','catch','updateInteraction','Users','TagIds','lodash','../../mysqldb','map','fullname','split','forEach','push','waiting','talking','abandoned','total','closed'];(function(_0x88edb2,_0x4574e8){var _0x5d3c69=function(_0x1f0023){while(--_0x1f0023){_0x88edb2['push'](_0x88edb2['shift']());}};_0x5d3c69(++_0x4574e8);}(_0x8e27,0xb1));var _0x78e2=function(_0x396466,_0xe9857b){_0x396466=_0x396466-0x0;var _0x5e9ab4=_0x8e27[_0x396466];return _0x5e9ab4;};'use strict';var _=require(_0x78e2('0x0'));var db=require(_0x78e2('0x1'))['db'];function getInteractionUsers(_0x4e0ec1,_0x2b6532){return new Promise(function(_0x2ccb23,_0x55fe8a){try{var _0x1d2fbc=[];if(_0x2b6532[_0x4e0ec1]){_0x1d2fbc=_0x2b6532[_0x4e0ec1][_0x78e2('0x2')](function(_0x540aba){return{'id':_0x540aba['id'],'fullname':_0x540aba[_0x78e2('0x3')]};});}return _0x2ccb23(_0x1d2fbc);}catch(_0x3437a0){_0x55fe8a(_0x3437a0);}});}function getInteractionTags(_0x4316f6,_0xebbf4d){var _0x3a4d67=[];if(_0x4316f6){_0x4316f6[_0x78e2('0x4')](',')[_0x78e2('0x5')](function(_0x114b8d){_0x3a4d67[_0x78e2('0x6')](_0xebbf4d[_0x114b8d]);});}return _0x3a4d67;}function updateWaitingCounter(_0x196542){if(_0x196542[_0x78e2('0x7')]){_0x196542['waiting']-=0x1;}}function updateInteractionCounters(_0x1f5039){_0x1f5039[_0x78e2('0x7')]=0x0;_0x1f5039[_0x78e2('0x8')]=0x0;_0x1f5039['answered']=0x0;_0x1f5039['unmanaged']=0x0;_0x1f5039[_0x78e2('0x9')]=0x0;_0x1f5039[_0x78e2('0xa')]=0x0;if(_0x1f5039[_0x78e2('0xb')]){if(_0x1f5039['disposition']==='abandoned'){_0x1f5039['abandoned']+=0x1;updateWaitingCounter(_0x1f5039);}if(_0x1f5039[_0x78e2('0xc')]){_0x1f5039[_0x78e2('0xd')]+=0x1;if(_0x1f5039[_0x78e2('0x8')]){_0x1f5039[_0x78e2('0x8')]-=0x1;}}else{if(_0x1f5039['disposition']){_0x1f5039[_0x78e2('0xe')]+=0x1;updateWaitingCounter(_0x1f5039);}}}else{if(!_0x1f5039[_0x78e2('0xc')]){_0x1f5039['waiting']+=0x1;}if(_0x1f5039[_0x78e2('0xc')]){_0x1f5039[_0x78e2('0x8')]+=0x1;updateWaitingCounter(_0x1f5039);}}_0x1f5039[_0x78e2('0xa')]+=0x1;return _0x1f5039;}function getLastMessageText(_0x5d72d6){return db[_0x78e2('0xf')][_0x78e2('0x10')]({'where':{'$and':[{'MailInteractionId':_0x5d72d6['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x78e2('0x11')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x78e2('0x12')],'order':_0x78e2('0x13'),'raw':!![]})[_0x78e2('0x14')](function(_0x47368d){if(_0x47368d&&_0x47368d['plainBody']){_0x5d72d6[_0x78e2('0x15')]=_[_0x78e2('0x16')](_0x47368d['plainBody']);}return _0x5d72d6;})[_0x78e2('0x17')](function(_0x4b5ec0){throw _0x4b5ec0;});}exports[_0x78e2('0x18')]=function(_0x24620e,_0x4ab351,_0x27128f,_0x30c1b6){return new Promise(function(_0x339250,_0x515a35){return getInteractionUsers(_0x24620e['id'],_0x27128f)[_0x78e2('0x14')](function(_0x2075b7){_0x24620e[_0x78e2('0x19')]=_0x2075b7;return getInteractionTags(_0x24620e[_0x78e2('0x1a')],_0x4ab351);})[_0x78e2('0x14')](function(_0x4fd6d4){_0x24620e['Tags']=_0x4fd6d4;delete _0x24620e[_0x78e2('0x1a')];return updateInteractionCounters(_0x24620e);})[_0x78e2('0x14')](function(_0x471b47){if(_0x30c1b6){return getLastMessageText(_0x471b47);}else{return _0x471b47;}})[_0x78e2('0x14')](function(_0x5c7237){_0x339250(_0x5c7237);})['catch'](function(_0x319a67){_0x515a35(_0x319a67);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 175d7e5..8049d3d 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 _0x4443=['../../mysqldb','../../config/logger','openchannel-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','unknown','websites','accounts','_interactions','_messages','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','Interaction','then','update','info','catch','error'];(function(_0x3c8826,_0x14486d){var _0x11c9c4=function(_0x38f5f0){while(--_0x38f5f0){_0x3c8826['push'](_0x3c8826['shift']());}};_0x11c9c4(++_0x14486d);}(_0x4443,0x13f));var _0x3444=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x4443[_0x4e676e];return _0x336a3c;};'use strict';var _=require('lodash');var db=require(_0x3444('0x0'))['db'];var loggers={'openchannel':require(_0x3444('0x1'))(_0x3444('0x2')),'mail':require('../../config/logger')('mail-interactions'),'fax':require('../../config/logger')('fax-interactions'),'sms':require(_0x3444('0x1'))(_0x3444('0x3')),'chat':require('../../config/logger')(_0x3444('0x4')),'whatsapp':require(_0x3444('0x1'))(_0x3444('0x5'))};function getAccountFK(_0x1158a4){return _[_0x3444('0x6')](_0x1158a4)+(_0x1158a4===_0x3444('0x7')?_0x3444('0x8'):_0x3444('0x9'))+'Id';}function getInteractionFK(_0x1c3fde){return _[_0x3444('0x6')](_0x1c3fde)+_0x3444('0xa');}function getInteractionId(_0x22d27a,_0x3786d3,_0x5943e5){if(_0x22d27a&&_0x22d27a[_[_0x3444('0xb')](_0x5943e5)+_0x3444('0xa')]){return _0x22d27a[_['upperFirst'](_0x5943e5)+_0x3444('0xa')];}else if(_0x22d27a&&_0x22d27a['id']){return _0x22d27a['id'];}else if(_0x3786d3&&_0x3786d3['id']){return _0x3786d3['id'];}else{return _0x3444('0xc');}}function getInteractionsTables(_0x40d014){return{'accounts':_0x40d014+'_'+(_0x40d014==='chat'?_0x3444('0xd'):_0x3444('0xe')),'interactions':_0x40d014+_0x3444('0xf'),'interactionsTags':_0x40d014+'_interaction_has_tags','messages':_0x40d014+_0x3444('0x10'),'userInteractions':'user_has_'+_0x40d014+_0x3444('0xf')};}function getSelectedTags(_0x3aa853){var _0x5e0623=[];if(_0x3aa853){_0x5e0623=Array['isArray'](_0x3aa853)?_0x3aa853:[_0x3aa853];}return _0x5e0623;}function log(_0x5e2388,_0xe48277,_0x42e054,_0x3fb16c,_0x5b7909,_0x18c043){loggers[_0x5b7909[_0x3444('0x11')]()][_0x5e2388](_0x3444('0x12'),_0x18c043[_0x3444('0x13')](),_0xe48277?_0xe48277['id']:null,_0xe48277?_0xe48277[_0x3444('0x14')]:null,_0xe48277?_0xe48277[_0x3444('0x15')]:null,getInteractionId(_0x42e054,_0x3fb16c,_0x5b7909),_0x42e054?JSON[_0x3444('0x16')](_0x42e054):'null');}function updateUser(_0x437119,_0xcf34da,_0x5c7464,_0x7c54db,_0x52a15e){db[_[_0x3444('0xb')](_0x7c54db)+_0x3444('0x17')]['findOne']({'where':{'id':getInteractionId(_0xcf34da,_0x5c7464,_0x7c54db)}})[_0x3444('0x18')](function(_0x52877c){if(_0x52877c){return _0x52877c[_0x3444('0x19')]({'UserId':_0x437119?_0x437119['id']:null});}})['then'](function(_0x4105ba){if(_0x4105ba){log(_0x3444('0x1a'),_0x437119,_0xcf34da,_0x5c7464,_0x7c54db,_0x52a15e);}})[_0x3444('0x1b')](function(){log(_0x3444('0x1c'),_0x437119,_0xcf34da,_0x5c7464,_0x7c54db,_0x52a15e);});}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0xc8b3=['_interaction_has_tags','_messages','user_has_','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role','stringify','Interaction','then','info','catch','error','exports','lodash','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','chat-interactions','whatsapp-interactions','capitalize','Website','Account','InteractionId','upperFirst','unknown','chat','websites','accounts','_interactions'];(function(_0x3e15ee,_0x2ebf1a){var _0xe15522=function(_0x461333){while(--_0x461333){_0x3e15ee['push'](_0x3e15ee['shift']());}};_0xe15522(++_0x2ebf1a);}(_0xc8b3,0x1b1));var _0x3c8b=function(_0x4aaaef,_0x4cd2d0){_0x4aaaef=_0x4aaaef-0x0;var _0xbe59a=_0xc8b3[_0x4aaaef];return _0xbe59a;};'use strict';var _=require(_0x3c8b('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x3c8b('0x1'))(_0x3c8b('0x2')),'mail':require(_0x3c8b('0x1'))(_0x3c8b('0x3')),'fax':require(_0x3c8b('0x1'))(_0x3c8b('0x4')),'sms':require(_0x3c8b('0x1'))('sms-interactions'),'chat':require(_0x3c8b('0x1'))(_0x3c8b('0x5')),'whatsapp':require(_0x3c8b('0x1'))(_0x3c8b('0x6'))};function getAccountFK(_0x223392){return _[_0x3c8b('0x7')](_0x223392)+(_0x223392==='chat'?_0x3c8b('0x8'):_0x3c8b('0x9'))+'Id';}function getInteractionFK(_0x22c785){return _[_0x3c8b('0x7')](_0x22c785)+_0x3c8b('0xa');}function getInteractionId(_0x218ef9,_0x557168,_0x26b27f){if(_0x218ef9&&_0x218ef9[_[_0x3c8b('0xb')](_0x26b27f)+_0x3c8b('0xa')]){return _0x218ef9[_[_0x3c8b('0xb')](_0x26b27f)+_0x3c8b('0xa')];}else if(_0x218ef9&&_0x218ef9['id']){return _0x218ef9['id'];}else if(_0x557168&&_0x557168['id']){return _0x557168['id'];}else{return _0x3c8b('0xc');}}function getInteractionsTables(_0x4d291c){return{'accounts':_0x4d291c+'_'+(_0x4d291c===_0x3c8b('0xd')?_0x3c8b('0xe'):_0x3c8b('0xf')),'interactions':_0x4d291c+_0x3c8b('0x10'),'interactionsTags':_0x4d291c+_0x3c8b('0x11'),'messages':_0x4d291c+_0x3c8b('0x12'),'userInteractions':_0x3c8b('0x13')+_0x4d291c+_0x3c8b('0x10')};}function getSelectedTags(_0x2f0d8b){var _0x2ba1d7=[];if(_0x2f0d8b){_0x2ba1d7=Array['isArray'](_0x2f0d8b)?_0x2f0d8b:[_0x2f0d8b];}return _0x2ba1d7;}function log(_0x5b3e4f,_0x335e8b,_0x541a1e,_0x555b8d,_0x1892e5,_0x5dc75c){loggers[_0x1892e5['toLowerCase']()][_0x5b3e4f](_0x3c8b('0x14'),_0x5dc75c[_0x3c8b('0x15')](),_0x335e8b?_0x335e8b['id']:null,_0x335e8b?_0x335e8b['name']:null,_0x335e8b?_0x335e8b[_0x3c8b('0x16')]:null,getInteractionId(_0x541a1e,_0x555b8d,_0x1892e5),_0x541a1e?JSON[_0x3c8b('0x17')](_0x541a1e):'null');}function updateUser(_0x1ad8f7,_0xda2b80,_0x321274,_0x4b2cbe,_0x3d940f){db[_[_0x3c8b('0xb')](_0x4b2cbe)+_0x3c8b('0x18')]['findOne']({'where':{'id':getInteractionId(_0xda2b80,_0x321274,_0x4b2cbe)}})[_0x3c8b('0x19')](function(_0x5daece){if(_0x5daece){return _0x5daece['update']({'UserId':_0x1ad8f7?_0x1ad8f7['id']:null});}})[_0x3c8b('0x19')](function(_0x56a5e5){if(_0x56a5e5){log(_0x3c8b('0x1a'),_0x1ad8f7,_0xda2b80,_0x321274,_0x4b2cbe,_0x3d940f);}})[_0x3c8b('0x1b')](function(){log(_0x3c8b('0x1c'),_0x1ad8f7,_0xda2b80,_0x321274,_0x4b2cbe,_0x3d940f);});}module[_0x3c8b('0x1d')]={'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 9a2cb0c..9c0afe0 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 _0xe931=['User','admin','util','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','License','findOne','then','count','json','catch'];(function(_0x21f9b7,_0x3afd00){var _0x2c3857=function(_0x148ddb){while(--_0x148ddb){_0x21f9b7['push'](_0x21f9b7['shift']());}};_0x2c3857(++_0x3afd00);}(_0xe931,0x162));var _0x1e93=function(_0x4409b2,_0x5ed5a8){_0x4409b2=_0x4409b2-0x0;var _0x61b710=_0xe931[_0x4409b2];return _0x61b710;};'use strict';var crypto=require('crypto');var util=require(_0x1e93('0x0'));var compose=require('composable-middleware');var db=require(_0x1e93('0x1'))['db'];var config=require(_0x1e93('0x2'));function getValueFromLicense(_0x539071,_0x96fd31){if(_0x539071&&_0x96fd31){if(_0x96fd31[_0x1e93('0x3')]&&_0x96fd31[_0x1e93('0x4')]){var _0x1cfce8=_0x96fd31[_0x1e93('0x3')];var _0x410955=_0x96fd31[_0x1e93('0x4')];var _0x439c80=_0x1cfce8[_0x1e93('0x5')]('-')[0x4];var _0x494a40=_0x1cfce8[_0x1e93('0x5')]('-')[0x0];var _0x513aff=crypto[_0x1e93('0x6')](_0x1e93('0x7'),util[_0x1e93('0x8')](_0x1e93('0x9'),_0x439c80,_0x1cfce8,_0x494a40));var _0x12d477=_0x513aff[_0x1e93('0xa')](_0x410955,_0x1e93('0xb'),_0x1e93('0xc'));_0x12d477+=_0x513aff[_0x1e93('0xd')](_0x1e93('0xc'));var _0xcb4250=JSON['parse'](_0x12d477);return _0xcb4250['hasOwnProperty'](_0x539071)?_0xcb4250[_0x539071]:null;}}return null;}function isLimit(_0x496e4d,_0x50b8e8,_0x558952,_0xddcd9b){var _0x4b1fd6=_0x50b8e8;return compose()['use'](function(_0x5ecbef,_0xd29f4,_0x5a3e36){return db[_0x1e93('0xe')][_0x1e93('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x1e93('0x10')](function(_0x444b5f){var _0x483361=getValueFromLicense(_0x496e4d,_0x444b5f);return _0x483361?_0x483361:_0x4b1fd6;})[_0x1e93('0x10')](function(_0x498641){_0x4b1fd6=_0x498641;return _0x558952[_0x1e93('0x11')](_0xddcd9b);})[_0x1e93('0x10')](function(_0x2537e4){if(_0x2537e4>=_0x4b1fd6){return _0xd29f4['status'](0x193)[_0x1e93('0x12')]({'message':util['format']('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x496e4d)});}_0x5a3e36();})[_0x1e93('0x13')](function(_0xc62d4){_0x5a3e36(_0xc62d4);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x1e93('0x14')],{'where':{'$or':[{'role':_0x1e93('0x15')},{'role':'user'}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0xa2e0=['../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','utf8','final','parse','hasOwnProperty','use','License','findOne','then','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','admin','user','isUserLimit','crypto','composable-middleware'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0xa2e0,0x1e4));var _0x0a2e=function(_0x3e9e5d,_0x64cedc){_0x3e9e5d=_0x3e9e5d-0x0;var _0x14b6c0=_0xa2e0[_0x3e9e5d];return _0x14b6c0;};'use strict';var crypto=require(_0x0a2e('0x0'));var util=require('util');var compose=require(_0x0a2e('0x1'));var db=require(_0x0a2e('0x2'))['db'];var config=require(_0x0a2e('0x3'));function getValueFromLicense(_0x1386cc,_0xca3657){if(_0x1386cc&&_0xca3657){if(_0xca3657[_0x0a2e('0x4')]&&_0xca3657[_0x0a2e('0x5')]){var _0x5a39a6=_0xca3657[_0x0a2e('0x4')];var _0x4a712f=_0xca3657[_0x0a2e('0x5')];var _0x4e14a4=_0x5a39a6['split']('-')[0x4];var _0x123f5a=_0x5a39a6[_0x0a2e('0x6')]('-')[0x0];var _0x20f934=crypto[_0x0a2e('0x7')](_0x0a2e('0x8'),util[_0x0a2e('0x9')](_0x0a2e('0xa'),_0x4e14a4,_0x5a39a6,_0x123f5a));var _0x3de42b=_0x20f934[_0x0a2e('0xb')](_0x4a712f,'base64',_0x0a2e('0xc'));_0x3de42b+=_0x20f934[_0x0a2e('0xd')](_0x0a2e('0xc'));var _0x2adbc4=JSON[_0x0a2e('0xe')](_0x3de42b);return _0x2adbc4[_0x0a2e('0xf')](_0x1386cc)?_0x2adbc4[_0x1386cc]:null;}}return null;}function isLimit(_0x58a6a9,_0x134aba,_0xf9c733,_0x4a095d){var _0x45be9b=_0x134aba;return compose()[_0x0a2e('0x10')](function(_0x484ea6,_0x3a6619,_0x51ee34){return db[_0x0a2e('0x11')][_0x0a2e('0x12')]({'where':{'id':0x1},'raw':!![]})[_0x0a2e('0x13')](function(_0x1b0cd7){var _0x1a5ed1=getValueFromLicense(_0x58a6a9,_0x1b0cd7);return _0x1a5ed1?_0x1a5ed1:_0x45be9b;})[_0x0a2e('0x13')](function(_0x2b1ed8){_0x45be9b=_0x2b1ed8;return _0xf9c733['count'](_0x4a095d);})['then'](function(_0x473326){if(_0x473326>=_0x45be9b){return _0x3a6619[_0x0a2e('0x14')](0x193)['json']({'message':util[_0x0a2e('0x9')](_0x0a2e('0x15'),_0x58a6a9)});}_0x51ee34();})[_0x0a2e('0x16')](function(_0xf58d){_0x51ee34(_0xf58d);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x0a2e('0x17')],{'where':{'$or':[{'role':_0x0a2e('0x18')},{'role':_0x0a2e('0x19')}]}});}exports[_0x0a2e('0x1a')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 0dd305d..2a61962 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 _0xf878=['text','CAST(','field','\x20AS\x20','$ne','\x20IS\x20NULL)','IN\x20?','$notIn','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$endsWith','LIKE\x20?','<\x20?','>\x20?','$lte','<=\x20?','$gte','>=\x20?','$in','start','shift','pop','utcOffset','add','minutes','seconds','lodash','moment','parseSearch','sqlOperator','replace','[$or]','split','slice','forEach','match','filter','indexOf','map','push','operator','$eq','$between','value','includes','$gt','format','YYYY-MM-DD','castTo'];(function(_0x5a9130,_0x1a32f3){var _0x53580d=function(_0x357363){while(--_0x357363){_0x5a9130['push'](_0x5a9130['shift']());}};_0x53580d(++_0x1a32f3);}(_0xf878,0x1e7));var _0x8f87=function(_0x1dba2,_0xbada75){_0x1dba2=_0x1dba2-0x0;var _0x191f97=_0xf878[_0x1dba2];return _0x191f97;};'use strict';var _=require(_0x8f87('0x0'));var moment=require(_0x8f87('0x1'));exports[_0x8f87('0x2')]=function(_0x5a5704){var _0x22049b={'conditions':[]};_0x22049b[_0x8f87('0x3')]=_['startsWith'](_0x5a5704,'[$or]')?'or':'and';var _0x23d55b=_0x5a5704[_0x8f87('0x4')]('[$and]','')['replace'](_0x8f87('0x5'),'')[_0x8f87('0x6')]('||');for(var _0x546b6f=0x0;_0x546b6f<_0x23d55b['length'];_0x546b6f++){var _0x2a7c02=_0x23d55b[_0x546b6f]['split'](':=');var _0x36324f=_0x2a7c02[0x0];var _0x3ca8e2=_0x2a7c02[_0x8f87('0x7')](0x1);_0x3ca8e2[_0x8f87('0x8')](function(_0x557ba0){var _0x4e5663=_0x557ba0[_0x8f87('0x6')]('[')['shift']();var _0x38a181=_0x557ba0[_0x8f87('0x9')](/\[(.*?)\]/g);_0x38a181[_0x8f87('0x8')](function(_0x4e84d7){var _0xd74655=_0x4e84d7[_0x8f87('0x6')]('[')[_0x8f87('0xa')](function(_0x189884){return _0x189884[_0x8f87('0xb')](']')>-0x1;})[_0x8f87('0xc')](function(_0x44bb8c){return _0x44bb8c[_0x8f87('0x6')](']')[0x0];})[0x0];_0x22049b['conditions'][_0x8f87('0xd')]({'field':_0x36324f,'operator':_0x4e5663,'value':_0xd74655});});});}return _0x22049b;};exports['buildExpression']=function(_0x43145e,_0x539f74,_0x51209b){var _0x400477={};if(_0x539f74==='DATE'){if(_0x51209b[_0x8f87('0xe')]===_0x8f87('0xf')){_0x51209b[_0x8f87('0xe')]=_0x8f87('0x10');_0x51209b[_0x8f87('0x11')]+=','+_0x51209b[_0x8f87('0x11')];}else if(_[_0x8f87('0x12')]([_0x8f87('0x13'),'$lte'],_0x51209b['operator'])){_0x51209b[_0x8f87('0x11')]=moment(_0x51209b[_0x8f87('0x11')])['add'](0x1,'days')[_0x8f87('0x14')](_0x8f87('0x15'));}}if(_0x51209b[_0x8f87('0x16')]){_0x539f74=_0x51209b[_0x8f87('0x16')];_0x400477[_0x8f87('0x17')]=_0x8f87('0x18')+_0x43145e+'.'+_0x51209b[_0x8f87('0x19')]+_0x8f87('0x1a')+_0x51209b[_0x8f87('0x16')]+')\x20'+parseOperator(_0x51209b[_0x8f87('0xe')]);}else{_0x400477[_0x8f87('0x17')]=_0x43145e+'.'+_0x51209b[_0x8f87('0x19')]+'\x20'+parseOperator(_0x51209b[_0x8f87('0xe')]);}if(_[_0x8f87('0x12')]([_0x8f87('0x1b'),'$notIn'],_0x51209b['operator']))_0x400477[_0x8f87('0x17')]='('+_0x400477[_0x8f87('0x17')]+'\x20OR\x20'+_0x43145e+'.'+_0x51209b[_0x8f87('0x19')]+_0x8f87('0x1c');_0x400477['value']=parseValue(_0x539f74,_0x51209b[_0x8f87('0xe')],_0x51209b[_0x8f87('0x11')]);return _0x400477;};function parseOperator(_0xbad20d){var _0x144145;switch(_0xbad20d){case'$in':_0x144145=_0x8f87('0x1d');break;case _0x8f87('0x1e'):_0x144145=_0x8f87('0x1f');break;case _0x8f87('0xf'):_0x144145=_0x8f87('0x20');break;case'$ne':_0x144145=_0x8f87('0x21');break;case _0x8f87('0x22'):case'$startsWith':case _0x8f87('0x23'):_0x144145=_0x8f87('0x24');break;case'$lt':_0x144145=_0x8f87('0x25');break;case _0x8f87('0x13'):_0x144145=_0x8f87('0x26');break;case _0x8f87('0x27'):_0x144145=_0x8f87('0x28');break;case _0x8f87('0x29'):_0x144145=_0x8f87('0x2a');break;case _0x8f87('0x10'):_0x144145='BETWEEN\x20?\x20AND\x20?';break;}return _0x144145;}function parseValue(_0x429262,_0x27ff0f,_0x5151fb){var _0x3baa96={'start':undefined,'end':undefined};switch(_0x27ff0f){case _0x8f87('0x2b'):case'$notIn':_0x3baa96[_0x8f87('0x2c')]=_0x5151fb['split'](',');break;case _0x8f87('0x22'):_0x3baa96[_0x8f87('0x2c')]='%'+_0x5151fb+'%';break;case'$startsWith':_0x3baa96[_0x8f87('0x2c')]=_0x5151fb+'%';break;case _0x8f87('0x23'):_0x3baa96[_0x8f87('0x2c')]='%'+_0x5151fb;break;case _0x8f87('0x10'):var _0x2a2fc9=_0x5151fb[_0x8f87('0x6')](',');var _0x5151fb=_0x2a2fc9[_0x8f87('0x2d')]();var _0x49bb2b=_0x2a2fc9[_0x8f87('0x2e')]();if(_0x429262==='DATE'){_0x5151fb=moment(_0x5151fb)['utcOffset'](0x0,!![])[_0x8f87('0x14')]();_0x49bb2b=moment(_0x49bb2b)[_0x8f87('0x2f')](0x0,!![])[_0x8f87('0x30')](0x17,'hours')[_0x8f87('0x30')](0x3b,_0x8f87('0x31'))[_0x8f87('0x30')](0x3b,_0x8f87('0x32'))['format']();}_0x3baa96={'start':_0x5151fb,'end':_0x49bb2b};break;default:_0x3baa96[_0x8f87('0x2c')]=_0x5151fb;break;}return _0x3baa96;} \ No newline at end of file +var _0x0ff9=['CAST(','field','castTo','$ne','$notIn','\x20OR\x20','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','$gte','>=\x20?','start','pop','utcOffset','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','slice','forEach','shift','match','filter','indexOf','map','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','add','days','format','text'];(function(_0x15dbe8,_0x23a090){var _0x1158a2=function(_0x20d61a){while(--_0x20d61a){_0x15dbe8['push'](_0x15dbe8['shift']());}};_0x1158a2(++_0x23a090);}(_0x0ff9,0x126));var _0x90ff=function(_0x5ae834,_0x409bb4){_0x5ae834=_0x5ae834-0x0;var _0x50e0f0=_0x0ff9[_0x5ae834];return _0x50e0f0;};'use strict';var _=require(_0x90ff('0x0'));var moment=require(_0x90ff('0x1'));exports[_0x90ff('0x2')]=function(_0x568947){var _0x49b082={'conditions':[]};_0x49b082[_0x90ff('0x3')]=_[_0x90ff('0x4')](_0x568947,_0x90ff('0x5'))?'or':_0x90ff('0x6');var _0x51942b=_0x568947[_0x90ff('0x7')](_0x90ff('0x8'),'')[_0x90ff('0x7')](_0x90ff('0x5'),'')[_0x90ff('0x9')]('||');for(var _0x24b242=0x0;_0x24b242<_0x51942b[_0x90ff('0xa')];_0x24b242++){var _0x10a59b=_0x51942b[_0x24b242]['split'](':=');var _0x28ae0f=_0x10a59b[0x0];var _0x25e302=_0x10a59b[_0x90ff('0xb')](0x1);_0x25e302[_0x90ff('0xc')](function(_0xd5cd3d){var _0x53ba2c=_0xd5cd3d[_0x90ff('0x9')]('[')[_0x90ff('0xd')]();var _0x11bf7e=_0xd5cd3d[_0x90ff('0xe')](/\[(.*?)\]/g);_0x11bf7e[_0x90ff('0xc')](function(_0x420f48){var _0x219b64=_0x420f48[_0x90ff('0x9')]('[')[_0x90ff('0xf')](function(_0xea40a8){return _0xea40a8[_0x90ff('0x10')](']')>-0x1;})[_0x90ff('0x11')](function(_0x29fc75){return _0x29fc75['split'](']')[0x0];})[0x0];_0x49b082['conditions']['push']({'field':_0x28ae0f,'operator':_0x53ba2c,'value':_0x219b64});});});}return _0x49b082;};exports[_0x90ff('0x12')]=function(_0x10a0ab,_0x5d883f,_0x394c05){var _0x23a725={};if(_0x5d883f===_0x90ff('0x13')){if(_0x394c05[_0x90ff('0x14')]===_0x90ff('0x15')){_0x394c05[_0x90ff('0x14')]=_0x90ff('0x16');_0x394c05[_0x90ff('0x17')]+=','+_0x394c05[_0x90ff('0x17')];}else if(_[_0x90ff('0x18')]([_0x90ff('0x19'),'$lte'],_0x394c05[_0x90ff('0x14')])){_0x394c05[_0x90ff('0x17')]=moment(_0x394c05[_0x90ff('0x17')])[_0x90ff('0x1a')](0x1,_0x90ff('0x1b'))[_0x90ff('0x1c')]('YYYY-MM-DD');}}if(_0x394c05['castTo']){_0x5d883f=_0x394c05['castTo'];_0x23a725[_0x90ff('0x1d')]=_0x90ff('0x1e')+_0x10a0ab+'.'+_0x394c05[_0x90ff('0x1f')]+'\x20AS\x20'+_0x394c05[_0x90ff('0x20')]+')\x20'+parseOperator(_0x394c05['operator']);}else{_0x23a725[_0x90ff('0x1d')]=_0x10a0ab+'.'+_0x394c05[_0x90ff('0x1f')]+'\x20'+parseOperator(_0x394c05[_0x90ff('0x14')]);}if(_['includes']([_0x90ff('0x21'),_0x90ff('0x22')],_0x394c05[_0x90ff('0x14')]))_0x23a725[_0x90ff('0x1d')]='('+_0x23a725[_0x90ff('0x1d')]+_0x90ff('0x23')+_0x10a0ab+'.'+_0x394c05[_0x90ff('0x1f')]+'\x20IS\x20NULL)';_0x23a725['value']=parseValue(_0x5d883f,_0x394c05['operator'],_0x394c05[_0x90ff('0x17')]);return _0x23a725;};function parseOperator(_0x36a484){var _0x4aa3d5;switch(_0x36a484){case'$in':_0x4aa3d5=_0x90ff('0x24');break;case _0x90ff('0x22'):_0x4aa3d5=_0x90ff('0x25');break;case _0x90ff('0x15'):_0x4aa3d5=_0x90ff('0x26');break;case'$ne':_0x4aa3d5=_0x90ff('0x27');break;case _0x90ff('0x28'):case _0x90ff('0x29'):case _0x90ff('0x2a'):_0x4aa3d5=_0x90ff('0x2b');break;case _0x90ff('0x2c'):_0x4aa3d5=_0x90ff('0x2d');break;case'$gt':_0x4aa3d5='>\x20?';break;case'$lte':_0x4aa3d5='<=\x20?';break;case _0x90ff('0x2e'):_0x4aa3d5=_0x90ff('0x2f');break;case _0x90ff('0x16'):_0x4aa3d5='BETWEEN\x20?\x20AND\x20?';break;}return _0x4aa3d5;}function parseValue(_0x4f6110,_0x53758f,_0x24facc){var _0x1ab740={'start':undefined,'end':undefined};switch(_0x53758f){case'$in':case _0x90ff('0x22'):_0x1ab740[_0x90ff('0x30')]=_0x24facc[_0x90ff('0x9')](',');break;case _0x90ff('0x28'):_0x1ab740[_0x90ff('0x30')]='%'+_0x24facc+'%';break;case _0x90ff('0x29'):_0x1ab740[_0x90ff('0x30')]=_0x24facc+'%';break;case _0x90ff('0x2a'):_0x1ab740[_0x90ff('0x30')]='%'+_0x24facc;break;case _0x90ff('0x16'):var _0x376e0f=_0x24facc['split'](',');var _0x24facc=_0x376e0f[_0x90ff('0xd')]();var _0x3b3123=_0x376e0f[_0x90ff('0x31')]();if(_0x4f6110===_0x90ff('0x13')){_0x24facc=moment(_0x24facc)[_0x90ff('0x32')](0x0,!![])[_0x90ff('0x1c')]();_0x3b3123=moment(_0x3b3123)[_0x90ff('0x32')](0x0,!![])[_0x90ff('0x1a')](0x17,_0x90ff('0x33'))[_0x90ff('0x1a')](0x3b,_0x90ff('0x34'))[_0x90ff('0x1a')](0x3b,_0x90ff('0x35'))[_0x90ff('0x1c')]();}_0x1ab740={'start':_0x24facc,'end':_0x3b3123};break;default:_0x1ab740['start']=_0x24facc;break;}return _0x1ab740;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 3878989..ee1df16 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 _0x21cd=['filters','isEmpty','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','isArray','limit','sort','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','omit','length','isObject','isString','unset','isNumeric','match','getFullTextValue','\x22{EXPR}\x22','{EXPR}','forEach','replace','getOptions','query','$id','model','intersection','attributes','hasOwnProperty','nolimit','offset','pick','filter','object','includes','columns','value','where','merge','VIRTUAL','lower','options','include','includeAll','map','lodash','sequelize','../../mysqldb','keys','parse','alias','raw','fields','split'];(function(_0x5a27e8,_0x492a2f){var _0x4e38f7=function(_0x2a4048){while(--_0x2a4048){_0x5a27e8['push'](_0x5a27e8['shift']());}};_0x4e38f7(++_0x492a2f);}(_0x21cd,0x14b));var _0xd21c=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x21cd[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0xd21c('0x0'));var sequelize=require(_0xd21c('0x1'));var moment=require('moment');var db=require(_0xd21c('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x594ccc){var _0x54588d=['ne'];try{var _0x5b225f=JSON['parse'](_0x594ccc);var _0x50d0fe=Object[_0xd21c('0x3')](_0x5b225f)[0x0];return _0x54588d['includes'](_0x50d0fe);}catch(_0x1414f0){return![];}}function getOperatorValue(_0x48790f){var _0x2be42f=JSON[_0xd21c('0x4')](_0x48790f);var _0x68ed7b=Object[_0xd21c('0x3')](_0x2be42f)[0x0];var _0x2874a3=_0x2be42f[_0x68ed7b];return{['$'+_0x68ed7b]:_0x2874a3};}function parseIncludeModel(_0xa99d0c){var _0x53cc02=JSON[_0xd21c('0x4')](_0xa99d0c);return{'model':db[_0x53cc02['model']],'as':_0x53cc02[_0xd21c('0x5')],'attributes':_0x53cc02['fields'],'raw':_0x53cc02[_0xd21c('0x6')]};}exports[_0xd21c('0x7')]=function(_0x2495b5){var _0x1ea878=null;if(_0x2495b5){_0x1ea878=_0x2495b5[_0xd21c('0x8')](',');}return _0x1ea878;};exports[_0xd21c('0x9')]=function(_0x45866a,_0xe1ab56){var _0x1e5f37={};if(!_[_0xd21c('0xa')](_0x45866a)){_['forOwn'](_0x45866a,function(_0x507193,_0x2a0a1d){try{if(_0xe1ab56){var _0x4d3e39=_[_0xd21c('0xb')](_0xe1ab56,{'name':_0x2a0a1d})||{};if(hasSequelizeOperator(_0x507193)){_0x1e5f37[_0x2a0a1d]=getOperatorValue(_0x507193);}else if(_0x4d3e39[_0xd21c('0xc')]===_0xd21c('0xd')&&_[_0xd21c('0xe')](_0x507193)){var _0x3e48b6=JSON['parse'](_0x507193);var _0x50c5de={'$gte':moment(moment(_0x3e48b6[_0xd21c('0xf')])[_0xd21c('0x10')](_0xd21c('0x11')))[_0xd21c('0x12')]()[_0xd21c('0x10')](),'$lte':moment(moment(_0x3e48b6[_0xd21c('0x13')])['format'](_0xd21c('0x11')))[_0xd21c('0x12')]()[_0xd21c('0x14')](0x1,'s')['format']()};_0x1e5f37[_0x2a0a1d]=_0x50c5de;}else if(_0x4d3e39[_0xd21c('0x15')]==='uniqueid'){_0x1e5f37[_0x2a0a1d]=_0x507193;}else{_0x1e5f37[_0x2a0a1d]=_[_0xd21c('0x16')](_0x507193)?_0x507193:JSON[_0xd21c('0x4')](_0x507193);}}else{_0x1e5f37[_0x2a0a1d]=_[_0xd21c('0x16')](_0x507193)?_0x507193:JSON[_0xd21c('0x4')](_0x507193);}}catch(_0x4e9f2f){_0x1e5f37[_0x2a0a1d]=_0x507193['split'](',');}});}return _0x1e5f37;};exports[_0xd21c('0x17')]=function(_0x7229f1){_0x7229f1=parseInt(_0x7229f1,0xa);if(!_0x7229f1||_0x7229f1<0x0){_0x7229f1=LIMIT_VALUE;}return _0x7229f1;};exports['offset']=function(_0x2de5a5){_0x2de5a5=parseInt(_0x2de5a5,0xa);if(!_0x2de5a5||_0x2de5a5<0x0){_0x2de5a5=0x0;}return _0x2de5a5;};exports[_0xd21c('0x18')]=function(_0x45778a){var _0x343290,_0x13f5e4=null;if(_0x45778a){_0x343290=_0x45778a[_0xd21c('0x8')](',');_0x13f5e4=_['map'](_0x343290,function(_0x12e54a){if(_0x12e54a[_0xd21c('0x19')]('-')===0x0){return[_0x12e54a===_0xd21c('0x1a')?sequelize[_0xd21c('0x1b')](sequelize[_0xd21c('0x1c')](_0xd21c('0x1a')),_0xd21c('0x1d')):_0x12e54a[_0xd21c('0x1e')](0x1),_0xd21c('0x1f')];}else{return[_0x12e54a===_0xd21c('0x1a')?sequelize[_0xd21c('0x1b')](sequelize[_0xd21c('0x1c')]('priority'),_0xd21c('0x1d')):_0x12e54a,_0xd21c('0x20')];}});}return _0x13f5e4;};exports[_0xd21c('0x21')]=function(_0x57490d,_0x551baf){if(_['isEmpty'](_0x57490d)){return _0x57490d;}if(_[_0xd21c('0x16')](_0x57490d)){for(var _0x5641f7=0x0;_0x5641f7<_0x57490d[_0xd21c('0x22')];_0x5641f7+=0x1){_0x57490d[_0x5641f7]=this[_0xd21c('0x21')](_0x57490d[_0x5641f7],_0x551baf);}return _0x57490d;}if(!_[_0xd21c('0x23')](_0x57490d)){return _0x57490d;}if(_[_0xd21c('0x24')](_0x551baf)){_0x551baf=[_0x551baf];}if(!_['isArray'](_0x551baf)){return _0x57490d;}for(var _0x9b351d=0x0;_0x9b351d<_0x551baf[_0xd21c('0x22')];_0x9b351d+=0x1){_[_0xd21c('0x25')](_0x57490d,_0x551baf[_0x9b351d]);}for(var _0xcce9be in _0x57490d){if(_0x57490d['hasOwnProperty'](_0xcce9be)){_0x57490d[_0xcce9be]=this[_0xd21c('0x21')](_0x57490d[_0xcce9be],_0x551baf);}}return _0x57490d;};exports[_0xd21c('0x26')]=function(_0x1b71a7){return _0x1b71a7[_0xd21c('0x27')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports['isEmail']=function(_0x2fda08){return _0x2fda08[_0xd21c('0x27')](/^\S+@\S+$/)?!![]:![];};exports[_0xd21c('0x28')]=function(_0x390a85,_0xf4b557){var _0x550bed=[];var _0x5eed0d=/[ `!@#$%^&*()_\-?~]/;var _0x49952b=_0xf4b557?_0xd21c('0x29'):_0xd21c('0x2a');_0x390a85[_0xd21c('0x8')](/[ ,]+/)[_0xd21c('0x2b')](function(_0x5d0803){_0x5d0803=_0x5d0803['replace'](/([^:]")"+/g,'$1');_0x5d0803='+'+_0x5d0803+'*';var _0x982995=_0x5d0803[_0xd21c('0x27')](_0x5eed0d);if(_0x982995){_0x5d0803='\x22'+_0x5d0803+'\x22';}_0x550bed['push'](_0x5d0803);});_0x49952b=_0x49952b[_0xd21c('0x2c')](_0xd21c('0x2a'),_0x550bed['join']('\x20'));return _0x49952b;};exports[_0xd21c('0x2d')]=function(_0xe1c126,_0x2451a4,_0x3a0f3b){var _0x55a281={},_0x1223d8={};if(_0x2451a4[_0xd21c('0x2e')][_0xd21c('0x2f')]){_0x2451a4['query']['id']=_0x2451a4[_0xd21c('0x2e')]['$id'];delete _0x2451a4[_0xd21c('0x2e')]['$id'];}_0x55a281[_0xd21c('0x30')]=_['map'](_0xe1c126,_0xd21c('0x15'));_0x55a281['query']=_[_0xd21c('0x3')](_0x2451a4[_0xd21c('0x2e')]);_0x55a281[_0xd21c('0x9')]=_[_0xd21c('0x31')](_0x55a281[_0xd21c('0x30')],_0x55a281[_0xd21c('0x2e')]);_0x1223d8[_0xd21c('0x32')]=_['intersection'](_0x55a281[_0xd21c('0x30')],this[_0xd21c('0x7')](_0x2451a4['query']['fields']));_0x1223d8[_0xd21c('0x32')]=_0x1223d8['attributes']['length']?_0x1223d8[_0xd21c('0x32')]:_0x55a281[_0xd21c('0x30')];if(!_0x2451a4[_0xd21c('0x2e')][_0xd21c('0x33')](_0xd21c('0x34'))){_0x1223d8[_0xd21c('0x17')]=this['limit'](_0x2451a4[_0xd21c('0x2e')]['limit']);_0x1223d8[_0xd21c('0x35')]=this[_0xd21c('0x35')](_0x2451a4[_0xd21c('0x2e')][_0xd21c('0x35')]);}_0x1223d8['order']=this[_0xd21c('0x18')](_0x2451a4[_0xd21c('0x2e')][_0xd21c('0x18')]);_0x1223d8['where']=this[_0xd21c('0x9')](_[_0xd21c('0x36')](_0x2451a4[_0xd21c('0x2e')],_0x55a281['filters']),_0xe1c126);if(_0x2451a4[_0xd21c('0x2e')][_0xd21c('0x37')]){var _0xd838e4=_0xe1c126;var _0x5141d4=_0x2451a4[_0xd21c('0x2e')][_0xd21c('0x37')];if(typeof _0x5141d4===_0xd21c('0x38')){_0xd838e4=_[_0xd21c('0x37')](_0xe1c126,function(_0x425887){return _[_0xd21c('0x39')](_0x5141d4[_0xd21c('0x3a')],_0x425887['name']);});_0x5141d4=_0x5141d4[_0xd21c('0x3b')];}_0x1223d8[_0xd21c('0x3c')]=_[_0xd21c('0x3d')](_0x1223d8[_0xd21c('0x3c')],{'$or':_['map'](_0xd838e4,function(_0x340ea9){if(_0x340ea9[_0xd21c('0xc')]!==_0xd21c('0x3e')){if(_0x3a0f3b){return sequelize[_0xd21c('0x3c')](sequelize['fn']('lower',sequelize[_0xd21c('0x1c')](_0x340ea9['name'])),{'$like':sequelize['fn'](_0xd21c('0x3f'),'%'+_0x2451a4['query'][_0xd21c('0x37')]+'%')});}else{var _0x47c527={};_0x47c527[_0x340ea9[_0xd21c('0x15')]]={'$like':'%'+_0x2451a4['query'][_0xd21c('0x37')]+'%'};return _0x47c527;}}})});}_0x1223d8=_['merge']({},_0x1223d8,_0x2451a4[_0xd21c('0x40')]);return _0x1223d8;};exports[_0xd21c('0x41')]=function(_0x3ba900){var _0x498e0f=[];if(_0x3ba900[_0xd21c('0x42')]){_0x498e0f['push']({'all':!![]});}else if(_0x3ba900['include']){if(Array[_0xd21c('0x16')](_0x3ba900[_0xd21c('0x41')])){_0x498e0f=Object['keys'](_0x3ba900['include'])[_0xd21c('0x43')](function(_0x17890d){return parseIncludeModel(_0x3ba900[_0xd21c('0x41')][_0x17890d]);});}else{var _0x1693f4=parseIncludeModel(_0x3ba900[_0xd21c('0x41')]);_0x498e0f['push'](_0x1693f4);}}return _0x498e0f;}; \ No newline at end of file +var _0x73a0=['object','columns','value','merge','map','type','VIRTUAL','lower','options','include','includeAll','lodash','sequelize','moment','../../mysqldb','parse','keys','includes','alias','raw','fields','isEmpty','forOwn','DATE','isPlainObject','$gte','format','$lte','YYYY-MM-DD','utc','subtract','isArray','split','limit','offset','col','priority','unsigned','substr','DESC','cast','ASC','omit','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}','forEach','replace','push','join','getOptions','query','$id','model','name','filters','intersection','attributes','length','nolimit','order','sort','where','filter'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x73a0,0x1bb));var _0x073a=function(_0xc2ecc6,_0x121488){_0xc2ecc6=_0xc2ecc6-0x0;var _0x306e05=_0x73a0[_0xc2ecc6];return _0x306e05;};'use strict';var _=require(_0x073a('0x0'));var sequelize=require(_0x073a('0x1'));var moment=require(_0x073a('0x2'));var db=require(_0x073a('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x38cd79){var _0x236ddd=['ne'];try{var _0x588086=JSON[_0x073a('0x4')](_0x38cd79);var _0x33639e=Object[_0x073a('0x5')](_0x588086)[0x0];return _0x236ddd[_0x073a('0x6')](_0x33639e);}catch(_0x42aab6){return![];}}function getOperatorValue(_0x5a54bb){var _0x2d5233=JSON[_0x073a('0x4')](_0x5a54bb);var _0x524347=Object[_0x073a('0x5')](_0x2d5233)[0x0];var _0x2a64e8=_0x2d5233[_0x524347];return{['$'+_0x524347]:_0x2a64e8};}function parseIncludeModel(_0x454fbc){var _0x4f550f=JSON[_0x073a('0x4')](_0x454fbc);return{'model':db[_0x4f550f['model']],'as':_0x4f550f[_0x073a('0x7')],'attributes':_0x4f550f['fields'],'raw':_0x4f550f[_0x073a('0x8')]};}exports[_0x073a('0x9')]=function(_0xb9d1c4){var _0x29b4fe=null;if(_0xb9d1c4){_0x29b4fe=_0xb9d1c4['split'](',');}return _0x29b4fe;};exports['filters']=function(_0x1389b2,_0x59ec15){var _0x4803ca={};if(!_[_0x073a('0xa')](_0x1389b2)){_[_0x073a('0xb')](_0x1389b2,function(_0x420cdd,_0x4e0d1d){try{if(_0x59ec15){var _0xdf1c29=_['find'](_0x59ec15,{'name':_0x4e0d1d})||{};if(hasSequelizeOperator(_0x420cdd)){_0x4803ca[_0x4e0d1d]=getOperatorValue(_0x420cdd);}else if(_0xdf1c29['type']===_0x073a('0xc')&&_[_0x073a('0xd')](_0x420cdd)){var _0x2b7ef6=JSON[_0x073a('0x4')](_0x420cdd);var _0x33e6a8={'$gte':moment(moment(_0x2b7ef6[_0x073a('0xe')])['format']('YYYY-MM-DD'))['utc']()[_0x073a('0xf')](),'$lte':moment(moment(_0x2b7ef6[_0x073a('0x10')])[_0x073a('0xf')](_0x073a('0x11')))[_0x073a('0x12')]()[_0x073a('0x13')](0x1,'s')[_0x073a('0xf')]()};_0x4803ca[_0x4e0d1d]=_0x33e6a8;}else if(_0xdf1c29['name']==='uniqueid'){_0x4803ca[_0x4e0d1d]=_0x420cdd;}else{_0x4803ca[_0x4e0d1d]=_[_0x073a('0x14')](_0x420cdd)?_0x420cdd:JSON['parse'](_0x420cdd);}}else{_0x4803ca[_0x4e0d1d]=_[_0x073a('0x14')](_0x420cdd)?_0x420cdd:JSON[_0x073a('0x4')](_0x420cdd);}}catch(_0x21bb80){_0x4803ca[_0x4e0d1d]=_0x420cdd[_0x073a('0x15')](',');}});}return _0x4803ca;};exports[_0x073a('0x16')]=function(_0x68da27){_0x68da27=parseInt(_0x68da27,0xa);if(!_0x68da27||_0x68da27<0x0){_0x68da27=LIMIT_VALUE;}return _0x68da27;};exports[_0x073a('0x17')]=function(_0x4e8042){_0x4e8042=parseInt(_0x4e8042,0xa);if(!_0x4e8042||_0x4e8042<0x0){_0x4e8042=0x0;}return _0x4e8042;};exports['sort']=function(_0x33b345){var _0xee7bda,_0xdf37cc=null;if(_0x33b345){_0xee7bda=_0x33b345[_0x073a('0x15')](',');_0xdf37cc=_['map'](_0xee7bda,function(_0x3e22ea){if(_0x3e22ea['indexOf']('-')===0x0){return[_0x3e22ea==='priority'?sequelize['cast'](sequelize[_0x073a('0x18')](_0x073a('0x19')),_0x073a('0x1a')):_0x3e22ea[_0x073a('0x1b')](0x1),_0x073a('0x1c')];}else{return[_0x3e22ea===_0x073a('0x19')?sequelize[_0x073a('0x1d')](sequelize[_0x073a('0x18')]('priority'),_0x073a('0x1a')):_0x3e22ea,_0x073a('0x1e')];}});}return _0xdf37cc;};exports['omit']=function(_0x220b9f,_0x5b0574){if(_[_0x073a('0xa')](_0x220b9f)){return _0x220b9f;}if(_[_0x073a('0x14')](_0x220b9f)){for(var _0x252b68=0x0;_0x252b68<_0x220b9f['length'];_0x252b68+=0x1){_0x220b9f[_0x252b68]=this[_0x073a('0x1f')](_0x220b9f[_0x252b68],_0x5b0574);}return _0x220b9f;}if(!_[_0x073a('0x20')](_0x220b9f)){return _0x220b9f;}if(_[_0x073a('0x21')](_0x5b0574)){_0x5b0574=[_0x5b0574];}if(!_[_0x073a('0x14')](_0x5b0574)){return _0x220b9f;}for(var _0x1d2d3b=0x0;_0x1d2d3b<_0x5b0574['length'];_0x1d2d3b+=0x1){_[_0x073a('0x22')](_0x220b9f,_0x5b0574[_0x1d2d3b]);}for(var _0x26c7fb in _0x220b9f){if(_0x220b9f[_0x073a('0x23')](_0x26c7fb)){_0x220b9f[_0x26c7fb]=this[_0x073a('0x1f')](_0x220b9f[_0x26c7fb],_0x5b0574);}}return _0x220b9f;};exports[_0x073a('0x24')]=function(_0xcaf796){return _0xcaf796[_0x073a('0x25')](RegExp(_0x073a('0x26')))?!![]:![];};exports[_0x073a('0x27')]=function(_0x676902){return _0x676902['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x073a('0x28')]=function(_0x340206,_0x2894d7){var _0x31bbc4=[];var _0x163578=/[ `!@#$%^&*()_\-?~]/;var _0x25af85=_0x2894d7?_0x073a('0x29'):_0x073a('0x2a');_0x340206[_0x073a('0x15')](/[ ,]+/)[_0x073a('0x2b')](function(_0x5533a2){_0x5533a2=_0x5533a2[_0x073a('0x2c')](/([^:]")"+/g,'$1');_0x5533a2='+'+_0x5533a2+'*';var _0x27e8e3=_0x5533a2['match'](_0x163578);if(_0x27e8e3){_0x5533a2='\x22'+_0x5533a2+'\x22';}_0x31bbc4[_0x073a('0x2d')](_0x5533a2);});_0x25af85=_0x25af85[_0x073a('0x2c')](_0x073a('0x2a'),_0x31bbc4[_0x073a('0x2e')]('\x20'));return _0x25af85;};exports[_0x073a('0x2f')]=function(_0x3490dd,_0x99afc4,_0x9f8c94){var _0x342fbc={},_0x4e5ed0={};if(_0x99afc4[_0x073a('0x30')][_0x073a('0x31')]){_0x99afc4[_0x073a('0x30')]['id']=_0x99afc4[_0x073a('0x30')][_0x073a('0x31')];delete _0x99afc4[_0x073a('0x30')]['$id'];}_0x342fbc[_0x073a('0x32')]=_['map'](_0x3490dd,_0x073a('0x33'));_0x342fbc[_0x073a('0x30')]=_[_0x073a('0x5')](_0x99afc4[_0x073a('0x30')]);_0x342fbc[_0x073a('0x34')]=_[_0x073a('0x35')](_0x342fbc[_0x073a('0x32')],_0x342fbc[_0x073a('0x30')]);_0x4e5ed0['attributes']=_[_0x073a('0x35')](_0x342fbc[_0x073a('0x32')],this[_0x073a('0x9')](_0x99afc4[_0x073a('0x30')][_0x073a('0x9')]));_0x4e5ed0[_0x073a('0x36')]=_0x4e5ed0['attributes'][_0x073a('0x37')]?_0x4e5ed0['attributes']:_0x342fbc[_0x073a('0x32')];if(!_0x99afc4[_0x073a('0x30')][_0x073a('0x23')](_0x073a('0x38'))){_0x4e5ed0['limit']=this[_0x073a('0x16')](_0x99afc4[_0x073a('0x30')][_0x073a('0x16')]);_0x4e5ed0[_0x073a('0x17')]=this[_0x073a('0x17')](_0x99afc4[_0x073a('0x30')][_0x073a('0x17')]);}_0x4e5ed0[_0x073a('0x39')]=this[_0x073a('0x3a')](_0x99afc4[_0x073a('0x30')][_0x073a('0x3a')]);_0x4e5ed0[_0x073a('0x3b')]=this[_0x073a('0x34')](_['pick'](_0x99afc4[_0x073a('0x30')],_0x342fbc[_0x073a('0x34')]),_0x3490dd);if(_0x99afc4[_0x073a('0x30')]['filter']){var _0x435bb1=_0x3490dd;var _0x331d89=_0x99afc4[_0x073a('0x30')][_0x073a('0x3c')];if(typeof _0x331d89===_0x073a('0x3d')){_0x435bb1=_[_0x073a('0x3c')](_0x3490dd,function(_0x1003d5){return _[_0x073a('0x6')](_0x331d89[_0x073a('0x3e')],_0x1003d5[_0x073a('0x33')]);});_0x331d89=_0x331d89[_0x073a('0x3f')];}_0x4e5ed0[_0x073a('0x3b')]=_[_0x073a('0x40')](_0x4e5ed0[_0x073a('0x3b')],{'$or':_[_0x073a('0x41')](_0x435bb1,function(_0x5eeb25){if(_0x5eeb25[_0x073a('0x42')]!==_0x073a('0x43')){if(_0x9f8c94){return sequelize[_0x073a('0x3b')](sequelize['fn']('lower',sequelize[_0x073a('0x18')](_0x5eeb25[_0x073a('0x33')])),{'$like':sequelize['fn'](_0x073a('0x44'),'%'+_0x99afc4[_0x073a('0x30')][_0x073a('0x3c')]+'%')});}else{var _0x511d08={};_0x511d08[_0x5eeb25[_0x073a('0x33')]]={'$like':'%'+_0x99afc4['query']['filter']+'%'};return _0x511d08;}}})});}_0x4e5ed0=_[_0x073a('0x40')]({},_0x4e5ed0,_0x99afc4[_0x073a('0x45')]);return _0x4e5ed0;};exports[_0x073a('0x46')]=function(_0x41e6c1){var _0x29cdb4=[];if(_0x41e6c1[_0x073a('0x47')]){_0x29cdb4[_0x073a('0x2d')]({'all':!![]});}else if(_0x41e6c1[_0x073a('0x46')]){if(Array[_0x073a('0x14')](_0x41e6c1['include'])){_0x29cdb4=Object[_0x073a('0x5')](_0x41e6c1[_0x073a('0x46')])[_0x073a('0x41')](function(_0x4eeefc){return parseIncludeModel(_0x41e6c1[_0x073a('0x46')][_0x4eeefc]);});}else{var _0x2e4d9b=parseIncludeModel(_0x41e6c1[_0x073a('0x46')]);_0x29cdb4[_0x073a('0x2d')](_0x2e4d9b);}}return _0x29cdb4;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index e1f8997..417f3c9 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 _0x9c5a=['getAgents','all','value','getAgentIdsByQueues','filter','includes','resolve','findAll','name','fullname','chatPause','mailPause','pauseType','globalStatus','getSortedAgentsIdsByStatus','split','fields','startsWith','DESC','ASC','getUpdatedSortOptions','fullname,internal','internal','substring','indexOf','validateSortParameter','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','mailCapacity','smsCapacity','whatsappCapacity','openchannelCurrentCapacity','mailCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','omit','pick','filterAgentAttributes','role','faxStatus','voiceStatusTime','chatCapacity','faxCapacity','chatCurrentCapacity','onhold','getRealtimeAgentsQueryFields','lodash','jayson/promise','client','http','faxPause','openchannelPause','smsPause','every','length','idle','ringing','isNil','voiceStatus','voicePause','pause','chatStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents','then','error','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','*pause','getAgentStatus','isArray','map','findOne'];(function(_0x517e67,_0x46d63c){var _0x4d7215=function(_0x4d4208){while(--_0x4d4208){_0x517e67['push'](_0x517e67['shift']());}};_0x4d7215(++_0x46d63c);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x28cee9,_0xffd3d5){_0x28cee9=_0x28cee9-0x0;var _0x2546e4=_0x9c5a[_0x28cee9];return _0x2546e4;};'use strict';var _=require(_0xa9c5('0x0'));var jayson=require(_0xa9c5('0x1'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0xa9c5('0x2')][_0xa9c5('0x3')]({'port':0x232a});var routingClient=jayson[_0xa9c5('0x2')][_0xa9c5('0x3')]({'port':0x232c});function isAgentPaused(_0x4f5552,_0x2acfaf){var _0x3051b1=[_0x4f5552['chatPause'],_0x4f5552[_0xa9c5('0x4')],_0x4f5552['mailPause'],_0x4f5552[_0xa9c5('0x5')],_0x4f5552[_0xa9c5('0x6')],_0x4f5552['voicePause'],_0x4f5552['whatsappPause']];if(!_0x2acfaf)return _[_0xa9c5('0x7')](_0x3051b1);var _0x16f331=_['filter'](_0x3051b1);return _0x16f331[_0xa9c5('0x8')]>0x0&&_0x16f331[_0xa9c5('0x8')]<_0x3051b1['length']?!![]:![];}function isIdle(_0x2e4f45){return _0x2e4f45===_0xa9c5('0x9')||_0x2e4f45==='unknown'||_0x2e4f45==='unavailable'||_0x2e4f45===_0xa9c5('0xa')||_[_0xa9c5('0xb')](_0x2e4f45);}function isAgentIdle(_0x45f8d8){if(_0x45f8d8[_0xa9c5('0xc')]!==_0xa9c5('0x9')&&_0x45f8d8[_0xa9c5('0xd')]){_0x45f8d8[_0xa9c5('0xc')]=_0xa9c5('0xe');return![];}return _[_0xa9c5('0x7')]([_0x45f8d8[_0xa9c5('0xf')],_0x45f8d8['faxStatus'],_0x45f8d8[_0xa9c5('0x10')],_0x45f8d8[_0xa9c5('0x11')],_0x45f8d8[_0xa9c5('0x12')],_0x45f8d8[_0xa9c5('0xc')],_0x45f8d8[_0xa9c5('0x13')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xa9c5('0x14')](_0xa9c5('0x15'),{})[_0xa9c5('0x16')](function(_0x19a43e){if(_0x19a43e[_0xa9c5('0x17')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x2b0d73=_0x19a43e[_0xa9c5('0x18')];return routingClient[_0xa9c5('0x14')]('Agents',{})[_0xa9c5('0x16')](function(_0x1142d9){if(_0x1142d9[_0xa9c5('0x17')]){throw new Error(_0xa9c5('0x19'));}var _0x452a9b=_0x1142d9[_0xa9c5('0x18')];return _[_0xa9c5('0x1a')]({},_0x2b0d73,_0x452a9b);});})[_0xa9c5('0x1b')](function(_0x2c7cd5){throw _0x2c7cd5;});}exports[_0xa9c5('0x1c')]=getRealtimeAgents;function getAgentStatus(_0x113c8f){var _0x2d95f8='unknown';if(isAgentPaused(_0x113c8f))_0x2d95f8=_0xa9c5('0xe');else if(isAgentPaused(_0x113c8f,!![]))_0x2d95f8=_0xa9c5('0x1d');else if(isAgentIdle(_0x113c8f))_0x2d95f8='idle';else _0x2d95f8='busy';return _0x2d95f8;}exports[_0xa9c5('0x1e')]=getAgentStatus;function getAgentIdsByQueues(_0x366f5c,_0x10b208){var _0x3b497a=_[_0xa9c5('0x1f')](_0x366f5c)?_0x366f5c:[_0x366f5c];var _0xd4b8a1=_['startCase'](_0x10b208)+'Queue';var _0x3d4e1b=_[_0xa9c5('0x20')](_0x3b497a,function(_0x4b0f05){return db[_0xd4b8a1][_0xa9c5('0x21')]({'where':{'id':_0x4b0f05}})[_0xa9c5('0x16')](function(_0x306c9b){if(!_0x306c9b)return[];return _0x306c9b[_0xa9c5('0x22')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xa9c5('0x23')](_0x3d4e1b)[_0xa9c5('0x16')](function(_0xe44e6d){var _0x51b64a=_(_0xe44e6d)['flatten']()[_0xa9c5('0x20')]('id')['uniq']()[_0xa9c5('0x24')]();return _0x51b64a;});}exports[_0xa9c5('0x25')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x4caefa,_0x11a723,_0x320dc0){try{if(_0x11a723['length']>0x0){_0x4caefa=_0x4caefa[_0xa9c5('0x26')](function(_0x32baf9){return _0x11a723[_0xa9c5('0x27')](_0x32baf9['id']);});}var _0x185eb8=_0x4caefa[_0xa9c5('0x26')](function(_0x4f6e70){var _0x36f267='busy';if(isAgentIdle(_0x4f6e70)){_0x36f267=_0xa9c5('0x9');}return _0x36f267===_0x320dc0;});return _[_0xa9c5('0x20')](_0x185eb8,'id');}catch(_0x2eeed1){throw _0x2eeed1;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0xc6d0c1,_0xbe29c5,_0x5bc9bb){return Promise[_0xa9c5('0x28')]()[_0xa9c5('0x16')](function(){if(_0xbe29c5[_0xa9c5('0x8')]>0x0){_0xc6d0c1=_0xc6d0c1[_0xa9c5('0x26')](function(_0x22ee21){return _0xbe29c5[_0xa9c5('0x27')](_0x22ee21['id']);});}return _0xc6d0c1;})[_0xa9c5('0x16')](function(){return db['User'][_0xa9c5('0x29')]({'attributes':['id',_0xa9c5('0x2a'),_0xa9c5('0x2b'),_0xa9c5('0x2c'),_0xa9c5('0x4'),_0xa9c5('0x2d'),_0xa9c5('0x5'),_0xa9c5('0x6'),'voicePause','whatsappPause',_0xa9c5('0x2e')],'where':{'id':{'$in':_[_0xa9c5('0x20')](_0xc6d0c1,'id')}},'raw':!![]});})[_0xa9c5('0x16')](function(_0x1313b2){return _0x1313b2[_0xa9c5('0x20')](function(_0x25121e){var _0x4dfdb5=_['find'](_0xc6d0c1,['id',_0x25121e['id']]);var _0x517b9a=filterAgentAttributes(_0x4dfdb5);_[_0xa9c5('0x1a')](_0x25121e,_0x517b9a);_0x25121e[_0xa9c5('0x2f')]=getAgentStatus(_0x25121e);return _0x25121e;});})['then'](function(_0x13a1f5){var _0x56eb82=sortAgentsByStatus(_0x13a1f5,_0x5bc9bb);return _[_0xa9c5('0x20')](_0x56eb82,'id');})[_0xa9c5('0x1b')](function(_0x2567be){throw _0x2567be;});}exports[_0xa9c5('0x30')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x593be8){var _0x675588={'fields':[],'order':null};var _0x2cd721=_0x593be8[_0xa9c5('0x31')](',');_0x675588[_0xa9c5('0x32')]=_[_0xa9c5('0x26')](_0x2cd721,function(_0x17ef8e){if(!_0x17ef8e[_0xa9c5('0x27')](_0xa9c5('0x2f'))){return!![];}_0x675588['order']=_[_0xa9c5('0x33')](_0x17ef8e,'-')?_0xa9c5('0x34'):_0xa9c5('0x35');return![];});return _0x675588;}exports[_0xa9c5('0x36')]=getUpdatedSortOptions;function validateSortParameter(_0x1132e0){if(!_0x1132e0){_0x1132e0=_0xa9c5('0x37');}if(_0x1132e0['includes'](_0xa9c5('0x2b'))&&!_0x1132e0['includes'](_0xa9c5('0x38'))){var _0x5c89e7=_0x1132e0[_0xa9c5('0x39')](0x0,_0x1132e0[_0xa9c5('0x3a')](_0xa9c5('0x2b')));_0x1132e0+=','+_0x5c89e7+'internal';}return _0x1132e0;}exports[_0xa9c5('0x3b')]=validateSortParameter;function sortAgentsByStatus(_0x1ddd72,_0x3a2b67){var _0x26dd0c=_0x1ddd72['sort'](function(_0x2dbb48,_0x97803f){if(_0x2dbb48[_0xa9c5('0x2f')]===_0x97803f[_0xa9c5('0x2f')]){if(_0x2dbb48[_0xa9c5('0x2f')]==='pause'){if(_0x3a2b67===_0xa9c5('0x34')){return(_0x2dbb48['pauseType']||'')<(_0x97803f[_0xa9c5('0x2e')]||'')||_0x2dbb48[_0xa9c5('0x2b')][_0xa9c5('0x3c')]()>_0x97803f[_0xa9c5('0x2b')][_0xa9c5('0x3c')]()?0x1:-0x1;}else{return(_0x2dbb48[_0xa9c5('0x2e')]||'')<(_0x97803f[_0xa9c5('0x2e')]||'')||_0x2dbb48[_0xa9c5('0x2b')][_0xa9c5('0x3c')]()>_0x97803f[_0xa9c5('0x2b')]['toLowerCase']()?-0x1:0x1;}}else{if(_0x3a2b67===_0xa9c5('0x34')){return _0x2dbb48[_0xa9c5('0x2b')][_0xa9c5('0x3c')]()<_0x97803f[_0xa9c5('0x2b')][_0xa9c5('0x3c')]()?0x1:-0x1;}else{return _0x2dbb48[_0xa9c5('0x2b')]['toLowerCase']()<_0x97803f[_0xa9c5('0x2b')][_0xa9c5('0x3c')]()?-0x1:0x1;}}}else{if(_0x3a2b67==='DESC'){return _0x2dbb48['globalStatus']<_0x97803f['globalStatus']?0x1:-0x1;}else{return _0x2dbb48['globalStatus']<_0x97803f['globalStatus']?-0x1:0x1;}}});return _0x26dd0c;}exports[_0xa9c5('0x3d')]=sortAgentsByStatus;function filterAgentAttributes(_0x569185){var _0x245f9d=[_0xa9c5('0x3e'),_0xa9c5('0x3f'),_0xa9c5('0x40'),_0xa9c5('0x41'),_0xa9c5('0x2e'),_0xa9c5('0x41'),_0xa9c5('0x38'),_0xa9c5('0x42'),_0xa9c5('0x2c'),_0xa9c5('0x5'),'mailPause',_0xa9c5('0x6'),'whatsappPause',_0xa9c5('0x4'),_0xa9c5('0xd'),'chatCapacity','openchannelCapacity',_0xa9c5('0x43'),_0xa9c5('0x44'),_0xa9c5('0x45'),'faxCapacity','chatCurrentCapacity',_0xa9c5('0x46'),_0xa9c5('0x47'),'smsCurrentCapacity',_0xa9c5('0x48'),_0xa9c5('0x49'),_0xa9c5('0xf'),_0xa9c5('0x11'),_0xa9c5('0x10'),_0xa9c5('0x12'),'whatsappStatus','faxStatus','voiceStatus',_0xa9c5('0x4a'),_0xa9c5('0x4b'),_0xa9c5('0x4c'),_0xa9c5('0x4d'),_0xa9c5('0x4e'),_0xa9c5('0x4f'),'voiceStatusTime',_0xa9c5('0x50'),_0xa9c5('0x51'),_0xa9c5('0x52'),_0xa9c5('0x53'),_0xa9c5('0x54'),_0xa9c5('0x55')];var _0x547654=['chatPause',_0xa9c5('0x5'),'mailPause',_0xa9c5('0x6'),'whatsappPause',_0xa9c5('0x4'),_0xa9c5('0xd'),_0xa9c5('0x3f')];var _0x5c7d7c=_(_0x569185)[_0xa9c5('0x56')](_0x547654)[_0xa9c5('0x57')](_0x245f9d)[_0xa9c5('0x24')]();return _0x5c7d7c;}exports[_0xa9c5('0x58')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id','name','fullname',_0xa9c5('0x59'),_0xa9c5('0x38'),_0xa9c5('0x3f'),'globalStatus',_0xa9c5('0x3e'),_0xa9c5('0x40'),_0xa9c5('0x2e'),_0xa9c5('0x41'),_0xa9c5('0x4'),_0xa9c5('0x2c'),_0xa9c5('0x2d'),_0xa9c5('0x5'),'smsPause',_0xa9c5('0xd'),'whatsappPause',_0xa9c5('0xf'),_0xa9c5('0x5a'),_0xa9c5('0x10'),'openchannelStatus',_0xa9c5('0x12'),_0xa9c5('0xc'),'whatsappStatus',_0xa9c5('0x4a'),_0xa9c5('0x4f'),_0xa9c5('0x4c'),_0xa9c5('0x4b'),'smsStatusTime',_0xa9c5('0x5b'),_0xa9c5('0x4e'),_0xa9c5('0x5c'),_0xa9c5('0x5d'),'mailCapacity','openchannelCapacity',_0xa9c5('0x44'),_0xa9c5('0x45'),_0xa9c5('0x5e'),_0xa9c5('0x49'),_0xa9c5('0x47'),_0xa9c5('0x46'),'smsCurrentCapacity',_0xa9c5('0x48'),_0xa9c5('0x53'),_0xa9c5('0x54'),_0xa9c5('0x51'),_0xa9c5('0x5f'),_0xa9c5('0x50'),_0xa9c5('0x55'),_0xa9c5('0x52')];}exports[_0xa9c5('0x60')]=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0xdc97=['openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','routealias','omit','pick','value','filterAgentAttributes','role','userpic','voiceStatusTime','mailCapacity','phoneBarEnableScreenRecordingByAgent','onhold','getRealtimeAgentsQueryFields','lodash','jayson/promise','../../mysqldb','http','chatPause','faxPause','mailPause','smsPause','every','filter','length','idle','unknown','unavailable','ringing','isNil','pause','faxStatus','mailStatus','openchannelStatus','smsStatus','voiceStatus','whatsappStatus','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','*pause','isArray','Queue','map','findOne','uniq','getAgentIdsByQueues','includes','resolve','name','openchannelPause','voicePause','whatsappPause','pauseType','find','getSortedAgentsIdsByStatus','split','fields','globalStatus','order','startsWith','DESC','ASC','fullname,internal','fullname','internal','substring','indexOf','toLowerCase','online','lastLoginAt','lastPauseAt','chatCapacity','openchannelCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatus'];(function(_0x1b925b,_0x1ab3c9){var _0x275f07=function(_0x2ffbe4){while(--_0x2ffbe4){_0x1b925b['push'](_0x1b925b['shift']());}};_0x275f07(++_0x1ab3c9);}(_0xdc97,0x13b));var _0x7dc9=function(_0x2fb691,_0x1cc9dd){_0x2fb691=_0x2fb691-0x0;var _0x4e8b64=_0xdc97[_0x2fb691];return _0x4e8b64;};'use strict';var _=require(_0x7dc9('0x0'));var jayson=require(_0x7dc9('0x1'));var db=require(_0x7dc9('0x2'))['db'];var amiClient=jayson['client'][_0x7dc9('0x3')]({'port':0x232a});var routingClient=jayson['client'][_0x7dc9('0x3')]({'port':0x232c});function isAgentPaused(_0x2b86da,_0x478a95){var _0x2a77c1=[_0x2b86da[_0x7dc9('0x4')],_0x2b86da[_0x7dc9('0x5')],_0x2b86da[_0x7dc9('0x6')],_0x2b86da['openchannelPause'],_0x2b86da[_0x7dc9('0x7')],_0x2b86da['voicePause'],_0x2b86da['whatsappPause']];if(!_0x478a95)return _[_0x7dc9('0x8')](_0x2a77c1);var _0x23737d=_[_0x7dc9('0x9')](_0x2a77c1);return _0x23737d[_0x7dc9('0xa')]>0x0&&_0x23737d[_0x7dc9('0xa')]<_0x2a77c1['length']?!![]:![];}function isIdle(_0xb2fa2a){return _0xb2fa2a===_0x7dc9('0xb')||_0xb2fa2a===_0x7dc9('0xc')||_0xb2fa2a===_0x7dc9('0xd')||_0xb2fa2a===_0x7dc9('0xe')||_[_0x7dc9('0xf')](_0xb2fa2a);}function isAgentIdle(_0x1e336a){if(_0x1e336a['voiceStatus']!=='idle'&&_0x1e336a['voicePause']){_0x1e336a['voiceStatus']=_0x7dc9('0x10');return![];}return _[_0x7dc9('0x8')]([_0x1e336a['chatStatus'],_0x1e336a[_0x7dc9('0x11')],_0x1e336a[_0x7dc9('0x12')],_0x1e336a[_0x7dc9('0x13')],_0x1e336a[_0x7dc9('0x14')],_0x1e336a[_0x7dc9('0x15')],_0x1e336a[_0x7dc9('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0x7dc9('0x17'),{})[_0x7dc9('0x18')](function(_0x1b0aa1){if(_0x1b0aa1[_0x7dc9('0x19')]){throw new Error(_0x7dc9('0x1a'));}var _0xbe0437=_0x1b0aa1[_0x7dc9('0x1b')];return routingClient[_0x7dc9('0x1c')](_0x7dc9('0x17'),{})['then'](function(_0x22577e){if(_0x22577e['error']){throw new Error(_0x7dc9('0x1d'));}var _0x1cc237=_0x22577e['result'];return _[_0x7dc9('0x1e')]({},_0xbe0437,_0x1cc237);});})[_0x7dc9('0x1f')](function(_0x12f08d){throw _0x12f08d;});}exports[_0x7dc9('0x20')]=getRealtimeAgents;function getAgentStatus(_0x43ec33){var _0x184bfd=_0x7dc9('0xc');if(isAgentPaused(_0x43ec33))_0x184bfd=_0x7dc9('0x10');else if(isAgentPaused(_0x43ec33,!![]))_0x184bfd=_0x7dc9('0x21');else if(isAgentIdle(_0x43ec33))_0x184bfd=_0x7dc9('0xb');else _0x184bfd='busy';return _0x184bfd;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x12954f,_0x5981e2){var _0x596e0f=_[_0x7dc9('0x22')](_0x12954f)?_0x12954f:[_0x12954f];var _0x27f7fa=_['startCase'](_0x5981e2)+_0x7dc9('0x23');var _0x43d31f=_[_0x7dc9('0x24')](_0x596e0f,function(_0x4906b1){return db[_0x27f7fa][_0x7dc9('0x25')]({'where':{'id':_0x4906b1}})[_0x7dc9('0x18')](function(_0xf95336){if(!_0xf95336)return[];return _0xf95336['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x43d31f)['then'](function(_0x25b383){var _0x32d032=_(_0x25b383)['flatten']()['map']('id')[_0x7dc9('0x26')]()['value']();return _0x32d032;});}exports[_0x7dc9('0x27')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x1c690b,_0x3a74a0,_0x3e4102){try{if(_0x3a74a0[_0x7dc9('0xa')]>0x0){_0x1c690b=_0x1c690b[_0x7dc9('0x9')](function(_0x236d42){return _0x3a74a0[_0x7dc9('0x28')](_0x236d42['id']);});}var _0x1fcf0e=_0x1c690b[_0x7dc9('0x9')](function(_0x14083d){var _0x2a456c='busy';if(isAgentIdle(_0x14083d)){_0x2a456c='idle';}return _0x2a456c===_0x3e4102;});return _['map'](_0x1fcf0e,'id');}catch(_0x49a4a5){throw _0x49a4a5;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x553a03,_0x58c4e8,_0x59f5d8){return Promise[_0x7dc9('0x29')]()[_0x7dc9('0x18')](function(){if(_0x58c4e8[_0x7dc9('0xa')]>0x0){_0x553a03=_0x553a03[_0x7dc9('0x9')](function(_0x3300ff){return _0x58c4e8[_0x7dc9('0x28')](_0x3300ff['id']);});}return _0x553a03;})['then'](function(){return db['User']['findAll']({'attributes':['id',_0x7dc9('0x2a'),'fullname',_0x7dc9('0x4'),_0x7dc9('0x5'),_0x7dc9('0x6'),_0x7dc9('0x2b'),_0x7dc9('0x7'),_0x7dc9('0x2c'),_0x7dc9('0x2d'),_0x7dc9('0x2e')],'where':{'id':{'$in':_['map'](_0x553a03,'id')}},'raw':!![]});})[_0x7dc9('0x18')](function(_0x4cdec4){return _0x4cdec4[_0x7dc9('0x24')](function(_0x16431a){var _0x3dc8e0=_[_0x7dc9('0x2f')](_0x553a03,['id',_0x16431a['id']]);var _0x48d9b2=filterAgentAttributes(_0x3dc8e0);_[_0x7dc9('0x1e')](_0x16431a,_0x48d9b2);_0x16431a['globalStatus']=getAgentStatus(_0x16431a);return _0x16431a;});})[_0x7dc9('0x18')](function(_0x4f47af){var _0x590bed=sortAgentsByStatus(_0x4f47af,_0x59f5d8);return _[_0x7dc9('0x24')](_0x590bed,'id');})[_0x7dc9('0x1f')](function(_0x21e036){throw _0x21e036;});}exports[_0x7dc9('0x30')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x5dac5b){var _0x9376a5={'fields':[],'order':null};var _0x183d87=_0x5dac5b[_0x7dc9('0x31')](',');_0x9376a5[_0x7dc9('0x32')]=_[_0x7dc9('0x9')](_0x183d87,function(_0x21faa6){if(!_0x21faa6[_0x7dc9('0x28')](_0x7dc9('0x33'))){return!![];}_0x9376a5[_0x7dc9('0x34')]=_[_0x7dc9('0x35')](_0x21faa6,'-')?_0x7dc9('0x36'):_0x7dc9('0x37');return![];});return _0x9376a5;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x34b5c9){if(!_0x34b5c9){_0x34b5c9=_0x7dc9('0x38');}if(_0x34b5c9[_0x7dc9('0x28')](_0x7dc9('0x39'))&&!_0x34b5c9['includes'](_0x7dc9('0x3a'))){var _0x89db0e=_0x34b5c9[_0x7dc9('0x3b')](0x0,_0x34b5c9[_0x7dc9('0x3c')](_0x7dc9('0x39')));_0x34b5c9+=','+_0x89db0e+_0x7dc9('0x3a');}return _0x34b5c9;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x553230,_0x3ef9fd){var _0x36a965=_0x553230['sort'](function(_0x3a705c,_0x4a37ec){if(_0x3a705c[_0x7dc9('0x33')]===_0x4a37ec[_0x7dc9('0x33')]){if(_0x3a705c[_0x7dc9('0x33')]==='pause'){if(_0x3ef9fd===_0x7dc9('0x36')){return(_0x3a705c[_0x7dc9('0x2e')]||'')<(_0x4a37ec[_0x7dc9('0x2e')]||'')||_0x3a705c[_0x7dc9('0x39')][_0x7dc9('0x3d')]()>_0x4a37ec[_0x7dc9('0x39')][_0x7dc9('0x3d')]()?0x1:-0x1;}else{return(_0x3a705c['pauseType']||'')<(_0x4a37ec[_0x7dc9('0x2e')]||'')||_0x3a705c['fullname']['toLowerCase']()>_0x4a37ec[_0x7dc9('0x39')][_0x7dc9('0x3d')]()?-0x1:0x1;}}else{if(_0x3ef9fd===_0x7dc9('0x36')){return _0x3a705c[_0x7dc9('0x39')][_0x7dc9('0x3d')]()<_0x4a37ec[_0x7dc9('0x39')][_0x7dc9('0x3d')]()?0x1:-0x1;}else{return _0x3a705c[_0x7dc9('0x39')][_0x7dc9('0x3d')]()<_0x4a37ec['fullname'][_0x7dc9('0x3d')]()?-0x1:0x1;}}}else{if(_0x3ef9fd===_0x7dc9('0x36')){return _0x3a705c[_0x7dc9('0x33')]<_0x4a37ec[_0x7dc9('0x33')]?0x1:-0x1;}else{return _0x3a705c[_0x7dc9('0x33')]<_0x4a37ec[_0x7dc9('0x33')]?-0x1:0x1;}}});return _0x36a965;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x3774cb){var _0x42e110=['userpic',_0x7dc9('0x3e'),_0x7dc9('0x3f'),_0x7dc9('0x40'),'pauseType',_0x7dc9('0x40'),'internal','address',_0x7dc9('0x4'),_0x7dc9('0x2b'),_0x7dc9('0x6'),'smsPause','whatsappPause',_0x7dc9('0x5'),'voicePause',_0x7dc9('0x41'),_0x7dc9('0x42'),'mailCapacity',_0x7dc9('0x43'),_0x7dc9('0x44'),_0x7dc9('0x45'),_0x7dc9('0x46'),_0x7dc9('0x47'),_0x7dc9('0x48'),_0x7dc9('0x49'),_0x7dc9('0x4a'),_0x7dc9('0x4b'),_0x7dc9('0x4c'),_0x7dc9('0x13'),_0x7dc9('0x12'),_0x7dc9('0x14'),'whatsappStatus',_0x7dc9('0x11'),'voiceStatus','chatStatusTime',_0x7dc9('0x4d'),_0x7dc9('0x4e'),_0x7dc9('0x4f'),_0x7dc9('0x50'),_0x7dc9('0x51'),'voiceStatusTime',_0x7dc9('0x52'),_0x7dc9('0x53'),_0x7dc9('0x54'),'phoneBarEnableScreenRecordingByAgent',_0x7dc9('0x55'),_0x7dc9('0x56')];var _0x2cf133=[_0x7dc9('0x4'),_0x7dc9('0x2b'),_0x7dc9('0x6'),'smsPause',_0x7dc9('0x2d'),_0x7dc9('0x5'),_0x7dc9('0x2c'),_0x7dc9('0x3e')];var _0x877a67=_(_0x3774cb)[_0x7dc9('0x57')](_0x2cf133)[_0x7dc9('0x58')](_0x42e110)[_0x7dc9('0x59')]();return _0x877a67;}exports[_0x7dc9('0x5a')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x7dc9('0x2a'),_0x7dc9('0x39'),_0x7dc9('0x5b'),'internal',_0x7dc9('0x3e'),_0x7dc9('0x33'),_0x7dc9('0x5c'),_0x7dc9('0x3f'),_0x7dc9('0x2e'),'lastPauseAt',_0x7dc9('0x5'),_0x7dc9('0x4'),_0x7dc9('0x6'),_0x7dc9('0x2b'),_0x7dc9('0x7'),_0x7dc9('0x2c'),'whatsappPause','chatStatus','faxStatus',_0x7dc9('0x12'),_0x7dc9('0x13'),_0x7dc9('0x14'),_0x7dc9('0x15'),'whatsappStatus','chatStatusTime',_0x7dc9('0x51'),_0x7dc9('0x4e'),_0x7dc9('0x4d'),_0x7dc9('0x4f'),_0x7dc9('0x5d'),_0x7dc9('0x50'),_0x7dc9('0x41'),'faxCapacity',_0x7dc9('0x5e'),_0x7dc9('0x42'),_0x7dc9('0x43'),_0x7dc9('0x44'),_0x7dc9('0x46'),'faxCurrentCapacity',_0x7dc9('0x48'),_0x7dc9('0x47'),_0x7dc9('0x49'),_0x7dc9('0x4a'),_0x7dc9('0x5f'),_0x7dc9('0x55'),_0x7dc9('0x53'),_0x7dc9('0x60'),_0x7dc9('0x52'),_0x7dc9('0x56'),_0x7dc9('0x54')];}exports[_0x7dc9('0x61')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index f745d00..631264b 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 _0x9656=['erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','voice','startCase','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','catch','getRealtimeQueues','inbound','outbound','concat','get','talking','find','merge','pick','initializeQueues','lodash','jayson/promise','util','client','http','available','loggedIn','paused','waiting','busy','inUse','loggedInDb','notInUse','onHold','unavailable','unknown','pTalking','originated','message','statusMessage','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond'];(function(_0x1debda,_0xe91aba){var _0x30cde6=function(_0x252ac3){while(--_0x252ac3){_0x1debda['push'](_0x1debda['shift']());}};_0x30cde6(++_0xe91aba);}(_0x9656,0x84));var _0x6965=function(_0xfa6653,_0x59db99){_0xfa6653=_0xfa6653-0x0;var _0x565afa=_0x9656[_0xfa6653];return _0x565afa;};'use strict';var _=require(_0x6965('0x0'));var jayson=require(_0x6965('0x1'));var util=require(_0x6965('0x2'));var amiClient=jayson[_0x6965('0x3')][_0x6965('0x4')]({'port':0x232a});var routingClient=jayson[_0x6965('0x3')][_0x6965('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x6965('0x5'),_0x6965('0x6'),_0x6965('0x7'),_0x6965('0x8')];var VOICE_QUEUE_ATTRIBUTES=[_0x6965('0x9'),_0x6965('0xa'),'invalid',_0x6965('0xb'),_0x6965('0xc'),_0x6965('0xd'),'ringing','ringInUse','talking',_0x6965('0xe'),_0x6965('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x6965('0x10'),_0x6965('0x11'),_0x6965('0x12'),_0x6965('0x13'),_0x6965('0x14'),_0x6965('0x15'),_0x6965('0x16'),_0x6965('0x17'),_0x6965('0x18'),_0x6965('0x19'),_0x6965('0x1a'),_0x6965('0x1b'),_0x6965('0x1c'),'dialPredictiveInterval',_0x6965('0x1d'),'dialPredictiveIntervalMinThreshold',_0x6965('0x1e'),_0x6965('0x1f'),_0x6965('0x20'),_0x6965('0x21'),_0x6965('0x22'),_0x6965('0x23'),'predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0x474606,_0x1f15ff){var _0x4ba0a9=_0x1f15ff===_0x6965('0x24')?amiClient:routingClient;return _0x4ba0a9['request'](_[_0x6965('0x25')](_0x1f15ff)+'Queues',_0x474606)[_0x6965('0x26')](function(_0x3a4ab1){if(_0x3a4ab1[_0x6965('0x27')])throw new Error(util[_0x6965('0x28')](_0x6965('0x29'),_0x1f15ff));return _0x3a4ab1['result'];})[_0x6965('0x2a')](function(_0x6c470a){throw _0x6c470a;});}exports[_0x6965('0x2b')]=getRealtimeQueues;function initializeQueues(_0x1fb856,_0xde9266,_0x5b96fb,_0x349cb1){var _0x494530=DEFAULT_QUEUE_ATTRIBUTES;if(_0x5b96fb===_0x6965('0x24')){if(_0x349cb1===_0x6965('0x2c')){_0x494530=_0x494530['concat'](VOICE_QUEUE_ATTRIBUTES);}else if(_0x349cb1===_0x6965('0x2d')){_0x494530=_0x494530[_0x6965('0x2e')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x1fb856['map'](function(_0x3b0a8c){var _0x45d20f=_0x3b0a8c[_0x6965('0x2f')]({'plain':!![]});_0x45d20f[_0x6965('0x7')]=0x0;_0x45d20f['loggedInDb']=0x0;_0x45d20f['loggedIn']=0x0;_0x45d20f[_0x6965('0x5')]=0x0;_0x45d20f[_0x6965('0x8')]=0x0;if(_0x5b96fb===_0x6965('0x24')){_0x45d20f[_0x6965('0x30')]=0x0;_0x45d20f[_0x6965('0x9')]=0x0;if(_0x349cb1===_0x6965('0x2d')){_0x45d20f[_0x6965('0x10')]=0x0;_0x45d20f[_0x6965('0x11')]=0x0;}}var _0x3eccf3=_[_0x6965('0x31')](_0xde9266,['id',_0x45d20f['id']]);if(_0x3eccf3){_[_0x6965('0x32')](_0x45d20f,_[_0x6965('0x33')](_0x3eccf3,_0x494530));}return _0x45d20f;});}exports[_0x6965('0x34')]=initializeQueues; \ No newline at end of file +var _0xbf26=['startCase','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','inbound','outbound','concat','map','get','busy','pTalking','find','merge','pick','lodash','util','client','http','available','loggedIn','paused','waiting','invalid','loggedInDb','notInUse','onHold','ringInUse','talking','unavailable','originated','message','statusMessage','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','voice','request'];(function(_0x39316c,_0x4bc4c1){var _0x1a0099=function(_0x2c5187){while(--_0x2c5187){_0x39316c['push'](_0x39316c['shift']());}};_0x1a0099(++_0x4bc4c1);}(_0xbf26,0x1a9));var _0x6bf2=function(_0x152260,_0x2c8e7d){_0x152260=_0x152260-0x0;var _0x4df0c9=_0xbf26[_0x152260];return _0x4df0c9;};'use strict';var _=require(_0x6bf2('0x0'));var jayson=require('jayson/promise');var util=require(_0x6bf2('0x1'));var amiClient=jayson[_0x6bf2('0x2')][_0x6bf2('0x3')]({'port':0x232a});var routingClient=jayson['client'][_0x6bf2('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x6bf2('0x4'),_0x6bf2('0x5'),_0x6bf2('0x6'),_0x6bf2('0x7')];var VOICE_QUEUE_ATTRIBUTES=['busy','inUse',_0x6bf2('0x8'),_0x6bf2('0x9'),_0x6bf2('0xa'),_0x6bf2('0xb'),'ringing',_0x6bf2('0xc'),_0x6bf2('0xd'),_0x6bf2('0xe'),'unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking',_0x6bf2('0xf'),_0x6bf2('0x10'),_0x6bf2('0x11'),_0x6bf2('0x12'),_0x6bf2('0x13'),_0x6bf2('0x14'),_0x6bf2('0x15'),_0x6bf2('0x16'),_0x6bf2('0x17'),_0x6bf2('0x18'),'erlangAbandonmentRate',_0x6bf2('0x19'),'dialPredictiveInterval',_0x6bf2('0x1a'),_0x6bf2('0x1b'),'predictiveIntervalAvailable',_0x6bf2('0x1c'),_0x6bf2('0x1d'),'predictiveIntervalDroppedCallsTimeout',_0x6bf2('0x1e'),_0x6bf2('0x1f'),'predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0x241635,_0x4f8e8c){var _0x34db39=_0x4f8e8c===_0x6bf2('0x20')?amiClient:routingClient;return _0x34db39[_0x6bf2('0x21')](_[_0x6bf2('0x22')](_0x4f8e8c)+_0x6bf2('0x23'),_0x241635)[_0x6bf2('0x24')](function(_0x467ab1){if(_0x467ab1[_0x6bf2('0x25')])throw new Error(util[_0x6bf2('0x26')](_0x6bf2('0x27'),_0x4f8e8c));return _0x467ab1[_0x6bf2('0x28')];})['catch'](function(_0x3271ca){throw _0x3271ca;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x4d0bb8,_0x3bc047,_0x4481a9,_0x16e9d8){var _0x7a99b9=DEFAULT_QUEUE_ATTRIBUTES;if(_0x4481a9===_0x6bf2('0x20')){if(_0x16e9d8===_0x6bf2('0x29')){_0x7a99b9=_0x7a99b9['concat'](VOICE_QUEUE_ATTRIBUTES);}else if(_0x16e9d8===_0x6bf2('0x2a')){_0x7a99b9=_0x7a99b9[_0x6bf2('0x2b')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x4d0bb8[_0x6bf2('0x2c')](function(_0x1aa466){var _0x1cd71d=_0x1aa466[_0x6bf2('0x2d')]({'plain':!![]});_0x1cd71d[_0x6bf2('0x6')]=0x0;_0x1cd71d[_0x6bf2('0x9')]=0x0;_0x1cd71d[_0x6bf2('0x5')]=0x0;_0x1cd71d[_0x6bf2('0x4')]=0x0;_0x1cd71d[_0x6bf2('0x7')]=0x0;if(_0x4481a9===_0x6bf2('0x20')){_0x1cd71d['talking']=0x0;_0x1cd71d[_0x6bf2('0x2e')]=0x0;if(_0x16e9d8==='outbound'){_0x1cd71d[_0x6bf2('0x2f')]=0x0;_0x1cd71d['originated']=0x0;}}var _0x2a62ed=_[_0x6bf2('0x30')](_0x3bc047,['id',_0x1cd71d['id']]);if(_0x2a62ed){_[_0x6bf2('0x31')](_0x1cd71d,_[_0x6bf2('0x32')](_0x2a62ed,_0x7a99b9));}return _0x1cd71d;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 6f5ca69..9310f00 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x49a1a0,_0x48f776){var _0x518a4f=function(_0x313633){while(--_0x313633){_0x49a1a0['push'](_0x49a1a0['shift']());}};_0x518a4f(++_0x48f776);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _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(_0x260097,_0xfd77f9){var _0x4380de=function(_0x403901){while(--_0x403901){_0x260097['push'](_0x260097['shift']());}};_0x4380de(++_0xfd77f9);}(_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 82852fb..ffa64ed 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 _0xa3c8=['utf8','replace','hostname','ipAddress','lodash','crypto','child_process','execSync','../environment','networkInterfaces','orderBy','keys','length','filter','family','internal','concat','head','mac','127.0.0.1','getFirstInterface','cpus','model','createHash','md5','update','digest','hex','getUuid','platform','licenseToken','win32','dmidecode\x20--string\x20system-uuid'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xa3c8,0x88));var _0x8a3c=function(_0x26aeb6,_0x2ab628){_0x26aeb6=_0x26aeb6-0x0;var _0x341a17=_0xa3c8[_0x26aeb6];return _0x341a17;};'use strict';var _=require(_0x8a3c('0x0'));var os=require('os');var crypto=require(_0x8a3c('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0x8a3c('0x2'))[_0x8a3c('0x3')];var config=require(_0x8a3c('0x4'));function getInterfaces(){var _0x559aba=[];var _0x2e49c7=os[_0x8a3c('0x5')]();var _0x5d8a9b=_[_0x8a3c('0x6')](_[_0x8a3c('0x7')](_0x2e49c7));for(var _0x146dd7=0x0;_0x146dd7<_0x5d8a9b[_0x8a3c('0x8')];_0x146dd7++){var _0x44ef11=_0x2e49c7[_0x5d8a9b[_0x146dd7]][_0x8a3c('0x9')](function(_0x438ef9){return _0x438ef9[_0x8a3c('0xa')]==='IPv4'&&_0x438ef9[_0x8a3c('0xb')]===![];});_0x559aba=_0x559aba[_0x8a3c('0xc')](_0x44ef11);}return _0x559aba;}function getFirstInterface(){var _0x47a8c4=_[_0x8a3c('0xd')](getInterfaces());return{'macAddress':_0x47a8c4&&_0x47a8c4[_0x8a3c('0xe')]?_0x47a8c4[_0x8a3c('0xe')]:'00:00:00:00:00:00','ipAddress':_0x47a8c4&&_0x47a8c4['address']?_0x47a8c4['address']:_0x8a3c('0xf')};}exports[_0x8a3c('0x10')]=getFirstInterface;function getCPUhash(){var _0x3c0123=_[_0x8a3c('0x6')](os[_0x8a3c('0x11')]()['map'](function(_0x9da047){return _0x9da047[_0x8a3c('0x12')];}))['join'](':');return crypto[_0x8a3c('0x13')](_0x8a3c('0x14'))[_0x8a3c('0x15')](_0x3c0123)[_0x8a3c('0x16')](_0x8a3c('0x17'));}exports[_0x8a3c('0x18')]=function(){var _0x4835a2=os[_0x8a3c('0x19')]();var _0x3878ec=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x3878ec['test'](config[_0x8a3c('0x1a')])){return config[_0x8a3c('0x1a')];}else if(_0x4835a2===_0x8a3c('0x1b')){return exec(_0x8a3c('0x1c'),{'encoding':_0x8a3c('0x1d')})[_0x8a3c('0x1e')]('\x0d\x0a','');}else{var _0x5c8da1=getFirstInterface();var _0x1a4143=getCPUhash();var _0x16cac3=_0x1a4143+'|'+os[_0x8a3c('0x1f')]()+'|'+_0x5c8da1['macAddress']+'|'+_0x5c8da1[_0x8a3c('0x20')];var _0x14b19e=crypto[_0x8a3c('0x13')](_0x8a3c('0x14'))[_0x8a3c('0x15')](_0x16cac3)[_0x8a3c('0x16')](_0x8a3c('0x17'));return _0x14b19e['substring'](0x0,0x8)+'-'+_0x14b19e['substring'](0x8,0xc)+'-'+_0x14b19e['substring'](0xc,0x10)+'-'+_0x14b19e['substring'](0x10,0x14)+'-'+_0x14b19e['substring'](0x14);}}; \ No newline at end of file +var _0x4b6c=['getFirstInterface','map','model','createHash','md5','digest','getUuid','platform','licenseToken','test','utf8','replace','hostname','macAddress','ipAddress','update','hex','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','orderBy','keys','length','filter','IPv4','concat','head','address','127.0.0.1'];(function(_0x197853,_0x24487b){var _0x1cbb30=function(_0x53bab3){while(--_0x53bab3){_0x197853['push'](_0x197853['shift']());}};_0x1cbb30(++_0x24487b);}(_0x4b6c,0x11a));var _0xc4b6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b6c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc4b6('0x0'));var os=require('os');var crypto=require(_0xc4b6('0x1'));var machine=require(_0xc4b6('0x2'));var exec=require(_0xc4b6('0x3'))[_0xc4b6('0x4')];var config=require(_0xc4b6('0x5'));function getInterfaces(){var _0x4246b1=[];var _0x510589=os['networkInterfaces']();var _0x3276cc=_[_0xc4b6('0x6')](_[_0xc4b6('0x7')](_0x510589));for(var _0x40d63c=0x0;_0x40d63c<_0x3276cc[_0xc4b6('0x8')];_0x40d63c++){var _0x16d2f6=_0x510589[_0x3276cc[_0x40d63c]][_0xc4b6('0x9')](function(_0x3f040c){return _0x3f040c['family']===_0xc4b6('0xa')&&_0x3f040c['internal']===![];});_0x4246b1=_0x4246b1[_0xc4b6('0xb')](_0x16d2f6);}return _0x4246b1;}function getFirstInterface(){var _0x3ad095=_[_0xc4b6('0xc')](getInterfaces());return{'macAddress':_0x3ad095&&_0x3ad095['mac']?_0x3ad095['mac']:'00:00:00:00:00:00','ipAddress':_0x3ad095&&_0x3ad095[_0xc4b6('0xd')]?_0x3ad095[_0xc4b6('0xd')]:_0xc4b6('0xe')};}exports[_0xc4b6('0xf')]=getFirstInterface;function getCPUhash(){var _0x436a1d=_['orderBy'](os['cpus']()[_0xc4b6('0x10')](function(_0x5d669f){return _0x5d669f[_0xc4b6('0x11')];}))['join'](':');return crypto[_0xc4b6('0x12')](_0xc4b6('0x13'))['update'](_0x436a1d)[_0xc4b6('0x14')]('hex');}exports[_0xc4b6('0x15')]=function(){var _0x5e0641=os[_0xc4b6('0x16')]();var _0x4483b6=/[0-9a-f-]{36}/;if(config[_0xc4b6('0x17')]&&_0x4483b6[_0xc4b6('0x18')](config[_0xc4b6('0x17')])){return config[_0xc4b6('0x17')];}else if(_0x5e0641==='win32'){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0xc4b6('0x19')})[_0xc4b6('0x1a')]('\x0d\x0a','');}else{var _0x5392c7=getFirstInterface();var _0x5703a7=getCPUhash();var _0x59734d=_0x5703a7+'|'+os[_0xc4b6('0x1b')]()+'|'+_0x5392c7[_0xc4b6('0x1c')]+'|'+_0x5392c7[_0xc4b6('0x1d')];var _0x2b749f=crypto[_0xc4b6('0x12')](_0xc4b6('0x13'))[_0xc4b6('0x1e')](_0x59734d)[_0xc4b6('0x14')](_0xc4b6('0x1f'));return _0x2b749f['substring'](0x0,0x8)+'-'+_0x2b749f[_0xc4b6('0x20')](0x8,0xc)+'-'+_0x2b749f['substring'](0xc,0x10)+'-'+_0x2b749f[_0xc4b6('0x20')](0x10,0x14)+'-'+_0x2b749f[_0xc4b6('0x20')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 9987770..bd006ee 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 _0x2812=['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','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','error','finally','getUuid','License','findOrCreate','spread','message','default','util','moment','request-promise','bluebird','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','exports','GET','then','catch','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED'];(function(_0x43a37c,_0x25a567){var _0x5d1d40=function(_0x3ec673){while(--_0x3ec673){_0x43a37c['push'](_0x43a37c['shift']());}};_0x5d1d40(++_0x25a567);}(_0x2812,0x6b));var _0x2281=function(_0x5cb97e,_0x132a39){_0x5cb97e=_0x5cb97e-0x0;var _0x1714b4=_0x2812[_0x5cb97e];return _0x1714b4;};'use strict';var util=require(_0x2281('0x0'));var moment=require(_0x2281('0x1'));var rp=require(_0x2281('0x2'));var BPromise=require(_0x2281('0x3'));var pkginfo=require('pkginfo')(module,_0x2281('0x4'));var db=require(_0x2281('0x5'))['db'];var encryptor=require(_0x2281('0x6'));var hardware=require(_0x2281('0x7'));var logger=require(_0x2281('0x8'))(_0x2281('0x9'));var HOST=_0x2281('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x4e0116){return new BPromise(function(_0x1c8eea,_0x477a33){var _0x212c80=util[_0x2281('0xb')]('%s/api/servers/%s/check?version=%s',HOST,_0x4e0116,module[_0x2281('0xc')][_0x2281('0x4')]);if(oldToken){_0x212c80=util['format']('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x4e0116,module['exports'][_0x2281('0x4')],oldToken);}var _0x29da1e={'uri':_0x212c80,'method':_0x2281('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x29da1e)[_0x2281('0xe')](function(_0x57fe79){_0x1c8eea(_0x57fe79);})[_0x2281('0xf')](function(_0x5e4679){_0x477a33(_0x5e4679);});});}function manageLicense(_0x33452b,_0x528631){var _0x449868=_0x528631[_0x2281('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x449868[_0x2281('0x11')]!==_0x33452b&&!_0x449868[_0x2281('0x12')]){oldToken=_0x449868[_0x2281('0x11')];}httpRequest(_0x33452b)[_0x2281('0xe')](function(_0x1f4842){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x1f4842[_0x2281('0x13')]){isOldTokenSent=![];if(!_0x449868[_0x2281('0x9')]&&_0x449868['license']!=_0x1f4842[_0x2281('0x9')]||_0x449868[_0x2281('0x9')]&&_0x449868[_0x2281('0x12')]){logger[_0x2281('0x14')](_0x2281('0x15'));}if(_0x449868[_0x2281('0x9')]&&!_0x449868[_0x2281('0x12')]&&_0x449868[_0x2281('0x9')]!=_0x1f4842[_0x2281('0x9')]){logger['info'](_0x2281('0x16'));}if(_0x449868['license']&&!_0x449868[_0x2281('0x12')]&&_0x449868[_0x2281('0x9')]==_0x1f4842[_0x2281('0x9')]){return _0x528631;}return _0x528631[_0x2281('0x17')]({'data1':_0x33452b,'data2':null,'license':_0x1f4842['license']});}else{if(_0x1f4842[_0x2281('0x9')]||_0x449868[_0x2281('0x9')]){if(!_0x449868[_0x2281('0x12')]){if(_0x449868['data1']==_0x33452b){GRAY_PERIOD_REASON=_0x2281('0x18');logger[_0x2281('0x14')](_0x2281('0x19'));}else{GRAY_PERIOD_REASON=_0x2281('0x1a');logger[_0x2281('0x14')](_0x2281('0x1b'),_0x449868[_0x2281('0x11')],_0x33452b);}logger[_0x2281('0x14')](_0x2281('0x1c'),GRAY_PERIOD_REASON[_0x2281('0x1d')](),moment()[_0x2281('0xb')](_0x2281('0x1e')));return _0x528631['update']({'data2':encryptor[_0x2281('0x1f')](moment()[_0x2281('0xb')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x2281('0x20')](encryptor[_0x2281('0x21')](_0x449868['data2']),_0x2281('0x22'))>DAYS){logger[_0x2281('0x14')]('DEMO\x20START\x20AT\x20%s',moment()[_0x2281('0xb')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x528631[_0x2281('0x17')]({'data1':_0x33452b,'data2':null,'license':null});}}}else{if(_0x449868['data1']!=_0x33452b){logger[_0x2281('0x14')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x449868[_0x2281('0x11')],_0x33452b);return _0x528631[_0x2281('0x17')]({'data1':_0x33452b,'data2':null,'license':null});}}}return _0x528631;})[_0x2281('0xe')](function(_0x28cfac){_0x528631=_0x28cfac;})[_0x2281('0xf')](function(_0x57057a){logger[_0x2281('0x23')](_0x57057a['message']);})[_0x2281('0x24')](function(){setTimeout(function(){manageLicense(hardware[_0x2281('0x25')](),_0x528631);},TIME);});}function defaultLicense(){var _0x23f32f=hardware[_0x2281('0x25')]();if(_0x23f32f){return db[_0x2281('0x26')][_0x2281('0x27')]({'where':{'id':0x1},'defaults':{'data1':_0x23f32f}})[_0x2281('0x28')](function(_0x18a5de,_0x4bcc5c){logger[_0x2281('0x14')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x23f32f);manageLicense(_0x23f32f,_0x18a5de);})[_0x2281('0xf')](function(_0x3ee4da){logger[_0x2281('0x23')](_0x3ee4da[_0x2281('0x29')]);});}}exports[_0x2281('0x2a')]=defaultLicense; \ No newline at end of file +var _0xcf2b=['./hardware','../logger','license','https://www.xcallymotion.com','format','exports','then','get','data1','data2','active','info','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','decryptString','days','DEMO\x20START\x20AT\x20%s','catch','message','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','default','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0xcf2b,0xbb));var _0xbcf2=function(_0x438434,_0x36f21f){_0x438434=_0x438434-0x0;var _0x3b97c9=_0xcf2b[_0x438434];return _0x3b97c9;};'use strict';var util=require(_0xbcf2('0x0'));var moment=require(_0xbcf2('0x1'));var rp=require(_0xbcf2('0x2'));var BPromise=require(_0xbcf2('0x3'));var pkginfo=require(_0xbcf2('0x4'))(module,_0xbcf2('0x5'));var db=require(_0xbcf2('0x6'))['db'];var encryptor=require(_0xbcf2('0x7'));var hardware=require(_0xbcf2('0x8'));var logger=require(_0xbcf2('0x9'))(_0xbcf2('0xa'));var HOST=_0xbcf2('0xb');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x264654){return new BPromise(function(_0x270966,_0xc2fde6){var _0x1e8a23=util[_0xbcf2('0xc')]('%s/api/servers/%s/check?version=%s',HOST,_0x264654,module['exports'][_0xbcf2('0x5')]);if(oldToken){_0x1e8a23=util[_0xbcf2('0xc')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x264654,module[_0xbcf2('0xd')][_0xbcf2('0x5')],oldToken);}var _0xdde7ad={'uri':_0x1e8a23,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0xdde7ad)[_0xbcf2('0xe')](function(_0x41559a){_0x270966(_0x41559a);})['catch'](function(_0x7ad223){_0xc2fde6(_0x7ad223);});});}function manageLicense(_0x579224,_0x11f941){var _0x44d8ac=_0x11f941[_0xbcf2('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x44d8ac[_0xbcf2('0x10')]!==_0x579224&&!_0x44d8ac[_0xbcf2('0x11')]){oldToken=_0x44d8ac[_0xbcf2('0x10')];}httpRequest(_0x579224)['then'](function(_0x3db924){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x3db924[_0xbcf2('0x12')]){isOldTokenSent=![];if(!_0x44d8ac[_0xbcf2('0xa')]&&_0x44d8ac[_0xbcf2('0xa')]!=_0x3db924[_0xbcf2('0xa')]||_0x44d8ac['license']&&_0x44d8ac[_0xbcf2('0x11')]){logger[_0xbcf2('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x44d8ac[_0xbcf2('0xa')]&&!_0x44d8ac[_0xbcf2('0x11')]&&_0x44d8ac[_0xbcf2('0xa')]!=_0x3db924[_0xbcf2('0xa')]){logger[_0xbcf2('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x44d8ac[_0xbcf2('0xa')]&&!_0x44d8ac[_0xbcf2('0x11')]&&_0x44d8ac[_0xbcf2('0xa')]==_0x3db924['license']){return _0x11f941;}return _0x11f941[_0xbcf2('0x14')]({'data1':_0x579224,'data2':null,'license':_0x3db924['license']});}else{if(_0x3db924['license']||_0x44d8ac[_0xbcf2('0xa')]){if(!_0x44d8ac[_0xbcf2('0x11')]){if(_0x44d8ac[_0xbcf2('0x10')]==_0x579224){GRAY_PERIOD_REASON=_0xbcf2('0x15');logger[_0xbcf2('0x13')](_0xbcf2('0x16'));}else{GRAY_PERIOD_REASON='Changed';logger[_0xbcf2('0x13')](_0xbcf2('0x17'),_0x44d8ac['data1'],_0x579224);}logger[_0xbcf2('0x13')](_0xbcf2('0x18'),GRAY_PERIOD_REASON[_0xbcf2('0x19')](),moment()[_0xbcf2('0xc')](_0xbcf2('0x1a')));return _0x11f941[_0xbcf2('0x14')]({'data2':encryptor['encryptString'](moment()[_0xbcf2('0xc')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()['diff'](encryptor[_0xbcf2('0x1b')](_0x44d8ac[_0xbcf2('0x11')]),_0xbcf2('0x1c'))>DAYS){logger[_0xbcf2('0x13')](_0xbcf2('0x1d'),moment()['format'](_0xbcf2('0x1a')));isOldTokenSent=![];return _0x11f941['update']({'data1':_0x579224,'data2':null,'license':null});}}}else{if(_0x44d8ac[_0xbcf2('0x10')]!=_0x579224){logger[_0xbcf2('0x13')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x44d8ac['data1'],_0x579224);return _0x11f941[_0xbcf2('0x14')]({'data1':_0x579224,'data2':null,'license':null});}}}return _0x11f941;})[_0xbcf2('0xe')](function(_0x15243f){_0x11f941=_0x15243f;})[_0xbcf2('0x1e')](function(_0x5a4d94){logger['error'](_0x5a4d94[_0xbcf2('0x1f')]);})[_0xbcf2('0x20')](function(){setTimeout(function(){manageLicense(hardware[_0xbcf2('0x21')](),_0x11f941);},TIME);});}function defaultLicense(){var _0x2de35a=hardware[_0xbcf2('0x21')]();if(_0x2de35a){return db['License'][_0xbcf2('0x22')]({'where':{'id':0x1},'defaults':{'data1':_0x2de35a}})[_0xbcf2('0x23')](function(_0x675259,_0x117119){logger['info'](_0xbcf2('0x24'),_0x2de35a);manageLicense(_0x2de35a,_0x675259);})[_0xbcf2('0x1e')](function(_0x3d5582){logger[_0xbcf2('0x25')](_0x3d5582[_0xbcf2('0x1f')]);});}}exports[_0xbcf2('0x26')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index b471413..3ad9667 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 _0xb4a8=['add','changed','disabled','message','User','findAll','role','sequelize','COUNT','count','admin','user','telephone','users','telephones','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','moment','bluebird','./hardware','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','License','find','defaults','then','catch','uuid','data1','isEmpty','split','format','%s:%s:%s','demo','machineUuid','gray','deadline'];(function(_0x3f2a90,_0x50baf1){var _0xb46279=function(_0x5e47b5){while(--_0x5e47b5){_0x3f2a90['push'](_0x3f2a90['shift']());}};_0xb46279(++_0x50baf1);}(_0xb4a8,0x142));var _0x8b4a=function(_0x1ab0e6,_0x17ba8d){_0x1ab0e6=_0x1ab0e6-0x0;var _0x248815=_0xb4a8[_0x1ab0e6];return _0x248815;};'use strict';var util=require(_0x8b4a('0x0'));var _=require('lodash');var moment=require(_0x8b4a('0x1'));var BPromise=require(_0x8b4a('0x2'));var hardware=require(_0x8b4a('0x3'));var encryptor=require('../../components/encryptor');var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x8b4a('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x8b4a('0x5'),'machineUuid':hardware[_0x8b4a('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x8b4a('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x8b4a('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0xcbeca2){return new BPromise(function(_0x3cbee3,_0x4827ae){return db[_0x8b4a('0x7')][_0x8b4a('0x8')](_[_0x8b4a('0x9')](_0xcbeca2,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x2f47ab){return checkLicense(_0x2f47ab,null);})[_0x8b4a('0xa')](function(_0x480a0b){_0x3cbee3(_0x480a0b);return;})[_0x8b4a('0xb')](function(_0x4d0845){_0x4827ae(_0x4d0845);});});}function checkLicense(_0xf7eca5,_0x16a358){if(!_0xf7eca5){demoLicense[_0x8b4a('0xc')]=_0xf7eca5[_0x8b4a('0xd')];return demoLicense;}try{var _0x7cd0ec=_0x16a358||_0xf7eca5['license'];if(_[_0x8b4a('0xe')](_0x7cd0ec)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x23f5b6=_0xf7eca5[_0x8b4a('0xd')];var _0x23d5a3=_0xf7eca5['data2'];var _0x2d387e=_0x23f5b6[_0x8b4a('0xf')]('-')[0x4];var _0x1b5910=_0x23f5b6[_0x8b4a('0xf')]('-')[0x0];var _0x4c9c39=encryptor['decryptString'](_0x7cd0ec,util[_0x8b4a('0x10')](_0x8b4a('0x11'),_0x2d387e,_0x23f5b6,_0x1b5910));var _0x3d9787=JSON['parse'](_0x4c9c39);_0x3d9787[_0x8b4a('0x12')]=![];_0x3d9787['uuid']=_0x23f5b6;_0x3d9787[_0x8b4a('0x13')]=hardware[_0x8b4a('0x6')]();if(_0x23d5a3){var _0x4bf53d=encryptor['decryptString'](_0x23d5a3);_0x3d9787[_0x8b4a('0x14')]=_0x4bf53d;_0x3d9787[_0x8b4a('0x15')]=moment(_0x4bf53d)[_0x8b4a('0x16')](0x7,'days')[_0x8b4a('0x10')]();_0x3d9787['grayReason']=_0x3d9787[_0x8b4a('0xc')]!=_0x3d9787[_0x8b4a('0x13')]?_0x8b4a('0x17'):_0x8b4a('0x18');}return _0x3d9787;}catch(_0x1aedf9){breakingLicense[_0x8b4a('0xc')]=_0xf7eca5['data1'];breakingLicense[_0x8b4a('0x19')]=_0x1aedf9[_0x8b4a('0x19')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x472d1b,_0x23db93){getLicense()['then'](function(_0x43f538){return db[_0x8b4a('0x1a')][_0x8b4a('0x1b')]({'attributes':[_0x8b4a('0x1c'),[db[_0x8b4a('0x1d')]['fn'](_0x8b4a('0x1e'),db['sequelize']['col']('role')),_0x8b4a('0x1f')]],'group':'role','where':{'role':{'$or':[_0x8b4a('0x20'),_0x8b4a('0x21'),_0x8b4a('0x22')]}},'raw':!![]})[_0x8b4a('0xa')](function(_0x39eea7){var _0x125976={'user':_0x43f538[_0x8b4a('0x23')]||0x0,'telephone':_0x43f538[_0x8b4a('0x24')]||0x0};_0x39eea7[_0x8b4a('0x25')](function(_0x81c1af){var _0x591c1f=_0x81c1af[_0x8b4a('0x1c')]===_0x8b4a('0x20')?_0x8b4a('0x21'):_0x81c1af[_0x8b4a('0x1c')];_0x125976[_0x591c1f]-=_0x81c1af[_0x8b4a('0x1f')];if(_0x125976[_0x591c1f]<0x0)_0x125976[_0x591c1f]=0x0;});_0x472d1b(_0x125976);return;});})[_0x8b4a('0xb')](function(_0x42dc56){_0x23db93(_0x42dc56);});});}function checkUserLimits(_0x173e2e){return new BPromise(function(_0x4f81a1,_0x42aa24){getLimits()[_0x8b4a('0xa')](function(_0x374966){var _0x4264dd=_[_0x8b4a('0x26')](_[_0x8b4a('0x27')](_0x173e2e,_0x8b4a('0x1c')),['admin',_0x8b4a('0x21'),_0x8b4a('0x22')]);var _0x512617=(_0x4264dd[_0x8b4a('0x20')]||0x0)+(_0x4264dd[_0x8b4a('0x21')]||0x0);var _0x385d72=_0x4264dd[_0x8b4a('0x22')]||0x0;if(_0x512617>_0x374966[_0x8b4a('0x21')])return _0x42aa24(_0x8b4a('0x28'));if(_0x385d72>_0x374966[_0x8b4a('0x22')])return _0x42aa24(_0x8b4a('0x29'));return _0x4f81a1();})[_0x8b4a('0xb')](function(_0x1dc4a9){_0x42aa24(_0x1dc4a9);});});}module[_0x8b4a('0x2a')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x3387=['telephones','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','util','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','License','find','defaults','then','catch','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','decryptString','format','parse','demo','gray','add','days','grayReason','machineUuid','disabled','uuid','message','User','findAll','role','sequelize','COUNT','count','admin','user','telephone','users'];(function(_0x5948dd,_0x1f6ac8){var _0xb1f8be=function(_0x31a8d2){while(--_0x31a8d2){_0x5948dd['push'](_0x5948dd['shift']());}};_0xb1f8be(++_0x1f6ac8);}(_0x3387,0x1ad));var _0x7338=function(_0x292bb4,_0x155a99){_0x292bb4=_0x292bb4-0x0;var _0x75f1cf=_0x3387[_0x292bb4];return _0x75f1cf;};'use strict';var util=require(_0x7338('0x0'));var _=require('lodash');var moment=require(_0x7338('0x1'));var BPromise=require(_0x7338('0x2'));var hardware=require(_0x7338('0x3'));var encryptor=require(_0x7338('0x4'));var db=require(_0x7338('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x7338('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x7338('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x7338('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x7338('0x8'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x1f0829){return new BPromise(function(_0x223a21,_0x45d131){return db[_0x7338('0x9')][_0x7338('0xa')](_[_0x7338('0xb')](_0x1f0829,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x27d054){return checkLicense(_0x27d054,null);})[_0x7338('0xc')](function(_0x138c57){_0x223a21(_0x138c57);return;})[_0x7338('0xd')](function(_0x157698){_0x45d131(_0x157698);});});}function checkLicense(_0x595c91,_0x4c36c6){if(!_0x595c91){demoLicense['uuid']=_0x595c91['data1'];return demoLicense;}try{var _0x1d9881=_0x4c36c6||_0x595c91['license'];if(_[_0x7338('0xe')](_0x1d9881)){throw new Error(_0x7338('0xf'));}var _0x4a7e5a=_0x595c91[_0x7338('0x10')];var _0x27a917=_0x595c91[_0x7338('0x11')];var _0x1b9040=_0x4a7e5a[_0x7338('0x12')]('-')[0x4];var _0x460c5d=_0x4a7e5a[_0x7338('0x12')]('-')[0x0];var _0xaf71ff=encryptor[_0x7338('0x13')](_0x1d9881,util[_0x7338('0x14')]('%s:%s:%s',_0x1b9040,_0x4a7e5a,_0x460c5d));var _0x22caf2=JSON[_0x7338('0x15')](_0xaf71ff);_0x22caf2[_0x7338('0x16')]=![];_0x22caf2['uuid']=_0x4a7e5a;_0x22caf2['machineUuid']=hardware[_0x7338('0x7')]();if(_0x27a917){var _0x3240d0=encryptor[_0x7338('0x13')](_0x27a917);_0x22caf2[_0x7338('0x17')]=_0x3240d0;_0x22caf2['deadline']=moment(_0x3240d0)[_0x7338('0x18')](0x7,_0x7338('0x19'))[_0x7338('0x14')]();_0x22caf2[_0x7338('0x1a')]=_0x22caf2['uuid']!=_0x22caf2[_0x7338('0x1b')]?'changed':_0x7338('0x1c');}return _0x22caf2;}catch(_0x2879fb){breakingLicense[_0x7338('0x1d')]=_0x595c91['data1'];breakingLicense[_0x7338('0x1e')]=_0x2879fb[_0x7338('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x5ab460,_0x5111b3){getLicense()['then'](function(_0x475961){return db[_0x7338('0x1f')][_0x7338('0x20')]({'attributes':[_0x7338('0x21'),[db[_0x7338('0x22')]['fn'](_0x7338('0x23'),db['sequelize']['col']('role')),_0x7338('0x24')]],'group':'role','where':{'role':{'$or':[_0x7338('0x25'),_0x7338('0x26'),_0x7338('0x27')]}},'raw':!![]})[_0x7338('0xc')](function(_0x38febb){var _0x10957a={'user':_0x475961[_0x7338('0x28')]||0x0,'telephone':_0x475961[_0x7338('0x29')]||0x0};_0x38febb[_0x7338('0x2a')](function(_0x47ae45){var _0x355de4=_0x47ae45[_0x7338('0x21')]==='admin'?'user':_0x47ae45[_0x7338('0x21')];_0x10957a[_0x355de4]-=_0x47ae45['count'];if(_0x10957a[_0x355de4]<0x0)_0x10957a[_0x355de4]=0x0;});_0x5ab460(_0x10957a);return;});})[_0x7338('0xd')](function(_0x51833e){_0x5111b3(_0x51833e);});});}function checkUserLimits(_0x15b65c){return new BPromise(function(_0x2e4320,_0x57f183){getLimits()[_0x7338('0xc')](function(_0x53da96){var _0x43b247=_[_0x7338('0x2b')](_[_0x7338('0x2c')](_0x15b65c,_0x7338('0x21')),[_0x7338('0x25'),_0x7338('0x26'),_0x7338('0x27')]);var _0x3d667a=(_0x43b247['admin']||0x0)+(_0x43b247[_0x7338('0x26')]||0x0);var _0x102b16=_0x43b247['telephone']||0x0;if(_0x3d667a>_0x53da96[_0x7338('0x26')])return _0x57f183(_0x7338('0x2d'));if(_0x102b16>_0x53da96[_0x7338('0x27')])return _0x57f183(_0x7338('0x2e'));return _0x2e4320();})['catch'](function(_0xa2d231){_0x57f183(_0xa2d231);});});}module['exports']={'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 088ad65..c95cc22 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 _0xdd4f=['exports','secret'];(function(_0xd6f9e,_0x1f120c){var _0x32ff57=function(_0x433f77){while(--_0x433f77){_0xd6f9e['push'](_0xd6f9e['shift']());}};_0x32ff57(++_0x1f120c);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0xcec852,_0x2a90fa){_0xcec852=_0xcec852-0x0;var _0x54f473=_0xdd4f[_0xcec852];return _0x54f473;};'use strict';module[_0xfdd4('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':'app-id','GOOGLE_SECRET':_0xfdd4('0x1'),'DEBUG':''}; \ No newline at end of file +var _0xb03e=['myappanuglar-secret','app-id','secret','http://localhost:9000'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xb03e,0x1eb));var _0xeb03=function(_0x1763d6,_0x5444e2){_0x1763d6=_0x1763d6-0x0;var _0x1e6398=_0xb03e[_0x1763d6];return _0x1e6398;};'use strict';module['exports']={'DOMAIN':_0xeb03('0x0'),'SESSION_SECRET':_0xeb03('0x1'),'GOOGLE_ID':_0xeb03('0x2'),'GOOGLE_SECRET':_0xeb03('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 446d34d..919477d 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x069b=['fileLogger','../utils/loggers'];(function(_0x193aec,_0x446cec){var _0x5363c1=function(_0x423706){while(--_0x423706){_0x193aec['push'](_0x193aec['shift']());}};_0x5363c1(++_0x446cec);}(_0x069b,0x17d));var _0xb069=function(_0x14951a,_0x28b1d6){_0x14951a=_0x14951a-0x0;var _0x1e2696=_0x069b[_0x14951a];return _0x1e2696;};'use strict';var fileLogger=require(_0xb069('0x0'))[_0xb069('0x1')];module['exports']=fileLogger; \ No newline at end of file +var _0x469a=['exports','../utils/loggers','fileLogger'];(function(_0x4f4ef3,_0x46d544){var _0x8820e9=function(_0x3a2254){while(--_0x3a2254){_0x4f4ef3['push'](_0x4f4ef3['shift']());}};_0x8820e9(++_0x46d544);}(_0x469a,0x157));var _0xa469=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0x469a[_0x5317b5];return _0x3b7ce2;};'use strict';var fileLogger=require(_0xa469('0x0'))[_0xa469('0x1')];module[_0xa469('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 179d943..a9e404b 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 _0x20b2=['../../services/express/index.js','ami','../../services/ami/index.js','../../services/agi/index.js','../../services/email/index.js','../../services/routing/index.js','xdr','../../services/xdr/index.js','path','../../config/environment','resolve','join','legacy-libs','express'];(function(_0x4bab23,_0x252745){var _0xc1776e=function(_0x59c760){while(--_0x59c760){_0x4bab23['push'](_0x4bab23['shift']());}};_0xc1776e(++_0x252745);}(_0x20b2,0xb0));var _0x220b=function(_0x2cf0fc,_0x5528a5){_0x2cf0fc=_0x2cf0fc-0x0;var _0x5e0275=_0x20b2[_0x2cf0fc];return _0x5e0275;};'use strict';var path=require(_0x220b('0x0'));var cfg=require(_0x220b('0x1'));var env={'NODE_PATH':path[_0x220b('0x2')](path[_0x220b('0x3')](cfg['root'],_0x220b('0x4')))};var pm2config={'apps':[{'name':_0x220b('0x5'),'script':path['join'](__dirname,_0x220b('0x6')),'env':env},{'name':_0x220b('0x7'),'script':path[_0x220b('0x3')](__dirname,_0x220b('0x8')),'env':env},{'name':'agi','script':path[_0x220b('0x3')](__dirname,_0x220b('0x9')),'env':env},{'name':'email','script':path[_0x220b('0x3')](__dirname,_0x220b('0xa')),'env':env},{'name':'routing','script':path['join'](__dirname,_0x220b('0xb')),'env':env},{'name':_0x220b('0xc'),'script':path['join'](__dirname,_0x220b('0xd')),'env':env}]};module['exports']=pm2config; \ No newline at end of file +var _0x55c6=['path','../../config/environment','resolve','express','join','../../services/express/index.js','ami','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x55c6,0x90));var _0x655c=function(_0x43dd6d,_0x35c792){_0x43dd6d=_0x43dd6d-0x0;var _0x2b9859=_0x55c6[_0x43dd6d];return _0x2b9859;};'use strict';var path=require(_0x655c('0x0'));var cfg=require(_0x655c('0x1'));var env={'NODE_PATH':path[_0x655c('0x2')](path['join'](cfg['root'],'legacy-libs'))};var pm2config={'apps':[{'name':_0x655c('0x3'),'script':path[_0x655c('0x4')](__dirname,_0x655c('0x5')),'env':env},{'name':_0x655c('0x6'),'script':path[_0x655c('0x4')](__dirname,'../../services/ami/index.js'),'env':env},{'name':'agi','script':path[_0x655c('0x4')](__dirname,'../../services/agi/index.js'),'env':env},{'name':'email','script':path[_0x655c('0x4')](__dirname,_0x655c('0x7')),'env':env},{'name':_0x655c('0x8'),'script':path[_0x655c('0x4')](__dirname,_0x655c('0x9')),'env':env},{'name':_0x655c('0xa'),'script':path[_0x655c('0x4')](__dirname,_0x655c('0xb')),'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 13cc7f3..2a4aeb6 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 _0x9468=['./config','connect','start','then','stop','restart','disconnect','list','describe','delete','dump','pm2','bluebird'];(function(_0x3838a4,_0x2ae1e6){var _0x3c56b4=function(_0x4cbf64){while(--_0x4cbf64){_0x3838a4['push'](_0x3838a4['shift']());}};_0x3c56b4(++_0x2ae1e6);}(_0x9468,0xb4));var _0x8946=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0x9468[_0x3ea913];return _0x2b4f28;};'use strict';var pm2=require(_0x8946('0x0'));var BPromise=require(_0x8946('0x1'));var config=require(_0x8946('0x2'));function connect(){return new BPromise(function(_0x2a3d88,_0x31dfca){return pm2[_0x8946('0x3')](function(_0x1c2d1a){if(_0x1c2d1a){return _0x31dfca(_0x1c2d1a);}return _0x2a3d88('connected');});});};exports[_0x8946('0x4')]=function(_0x17bdf0){return connect()[_0x8946('0x5')](function(){return new BPromise(function(_0x29e4bc,_0x3ae915){return pm2[_0x8946('0x4')](_0x17bdf0,function(_0x476d40,_0xd4e482){if(_0x476d40){return _0x3ae915(_0x476d40);}pm2['disconnect']();return _0x29e4bc(_0xd4e482);});});});};exports[_0x8946('0x6')]=function(_0xacc8e5){return connect()[_0x8946('0x5')](function(){return new BPromise(function(_0x22dd20,_0x2af301){return pm2['stop'](_0xacc8e5,function(_0x284e40,_0x8e578d){if(_0x284e40){return _0x2af301(_0x284e40);}pm2['disconnect']();return _0x22dd20(_0x8e578d);});});});};exports[_0x8946('0x7')]=function(_0x16b208){return connect()['then'](function(){return new BPromise(function(_0x926def,_0x21ec58){return pm2['restart'](_0x16b208,function(_0xbee81a,_0x49e98c){if(_0xbee81a){return _0x21ec58(_0xbee81a);}pm2[_0x8946('0x8')]();return _0x926def(_0x49e98c);});});});};exports['list']=function(){return connect()[_0x8946('0x5')](function(){return new BPromise(function(_0x26d02f,_0x592d28){return pm2[_0x8946('0x9')](function(_0x43d29f,_0x44165a){if(_0x43d29f){return _0x592d28(_0x43d29f);}pm2[_0x8946('0x8')]();return _0x26d02f(_0x44165a);});});});};exports['describe']=function(_0x29d93b){return connect()[_0x8946('0x5')](function(){return new BPromise(function(_0x418be6,_0x5c6bee){return pm2[_0x8946('0xa')](_0x29d93b,function(_0x5a0be3,_0x45bb49){if(_0x5a0be3){return _0x5c6bee(_0x5a0be3);}pm2[_0x8946('0x8')]();return _0x418be6(_0x45bb49);});});});};exports[_0x8946('0xb')]=function(_0x3bf06d){return connect()[_0x8946('0x5')](function(){return new BPromise(function(_0x418f83,_0x2874e6){return pm2['delete'](_0x3bf06d,function(_0x550eba,_0x15d984){if(_0x550eba){return _0x2874e6(_0x550eba);}pm2[_0x8946('0x8')]();return _0x418f83(_0x15d984);});});});};exports[_0x8946('0xc')]=function(){return connect()[_0x8946('0x5')](function(){return new BPromise(function(_0x4191a8,_0x1c27ab){return pm2[_0x8946('0xc')](function(_0x69bc26){if(_0x69bc26){return _0x1c27ab(_0x69bc26);}return _0x4191a8('saved');});});});}; \ No newline at end of file +var _0xadf9=['describe','delete','dump','saved','pm2','bluebird','connect','connected','then','start','disconnect','stop','restart','list'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xadf9,0x11c));var _0x9adf=function(_0x5f48c4,_0x1298b6){_0x5f48c4=_0x5f48c4-0x0;var _0x25fec6=_0xadf9[_0x5f48c4];return _0x25fec6;};'use strict';var pm2=require(_0x9adf('0x0'));var BPromise=require(_0x9adf('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x3c9d3e,_0x50fac3){return pm2[_0x9adf('0x2')](function(_0x2a3fb5){if(_0x2a3fb5){return _0x50fac3(_0x2a3fb5);}return _0x3c9d3e(_0x9adf('0x3'));});});};exports['start']=function(_0x178803){return connect()[_0x9adf('0x4')](function(){return new BPromise(function(_0x2de93c,_0x1cdd93){return pm2[_0x9adf('0x5')](_0x178803,function(_0x21ebce,_0x2da3f1){if(_0x21ebce){return _0x1cdd93(_0x21ebce);}pm2[_0x9adf('0x6')]();return _0x2de93c(_0x2da3f1);});});});};exports['stop']=function(_0x1b0a85){return connect()[_0x9adf('0x4')](function(){return new BPromise(function(_0x3493c3,_0x149030){return pm2[_0x9adf('0x7')](_0x1b0a85,function(_0x3edeb6,_0x103fea){if(_0x3edeb6){return _0x149030(_0x3edeb6);}pm2[_0x9adf('0x6')]();return _0x3493c3(_0x103fea);});});});};exports[_0x9adf('0x8')]=function(_0x2159ff){return connect()[_0x9adf('0x4')](function(){return new BPromise(function(_0x466dcd,_0xb6f271){return pm2[_0x9adf('0x8')](_0x2159ff,function(_0x5f1b56,_0x2453cf){if(_0x5f1b56){return _0xb6f271(_0x5f1b56);}pm2[_0x9adf('0x6')]();return _0x466dcd(_0x2453cf);});});});};exports[_0x9adf('0x9')]=function(){return connect()[_0x9adf('0x4')](function(){return new BPromise(function(_0x2d9187,_0x26abc6){return pm2['list'](function(_0xcd0d70,_0x6ab0d9){if(_0xcd0d70){return _0x26abc6(_0xcd0d70);}pm2[_0x9adf('0x6')]();return _0x2d9187(_0x6ab0d9);});});});};exports['describe']=function(_0x40cfe7){return connect()[_0x9adf('0x4')](function(){return new BPromise(function(_0x30de8b,_0x2962f9){return pm2[_0x9adf('0xa')](_0x40cfe7,function(_0x458826,_0x3e1541){if(_0x458826){return _0x2962f9(_0x458826);}pm2[_0x9adf('0x6')]();return _0x30de8b(_0x3e1541);});});});};exports[_0x9adf('0xb')]=function(_0x3a23f8){return connect()[_0x9adf('0x4')](function(){return new BPromise(function(_0x20bd20,_0x5512d){return pm2[_0x9adf('0xb')](_0x3a23f8,function(_0x5b71e9,_0xcbbfef){if(_0x5b71e9){return _0x5512d(_0x5b71e9);}pm2[_0x9adf('0x6')]();return _0x20bd20(_0xcbbfef);});});});};exports['dump']=function(){return connect()['then'](function(){return new BPromise(function(_0x4b1fc7,_0x4b3fc4){return pm2[_0x9adf('0xc')](function(_0x1e31a3){if(_0x1e31a3){return _0x4b3fc4(_0x1e31a3);}return _0x4b1fc7(_0x9adf('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 804fe59..9311fc5 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 _0x4909=['system','format','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','../../config/environment','../../mysqldb','schedule','localhost','socket.io-emitter','Setting','chatTimeout','then','findAll','lastMsgAt','subtract','minutes','length','info','[CHAT]\x20Interactions\x20to\x20close:','join','update'];(function(_0x2b5513,_0x3fe5cd){var _0x578fd2=function(_0x7a9106){while(--_0x7a9106){_0x2b5513['push'](_0x2b5513['shift']());}};_0x578fd2(++_0x3fe5cd);}(_0x4909,0x10e));var _0x9490=function(_0x263f4c,_0x438626){_0x263f4c=_0x263f4c-0x0;var _0x3a78d3=_0x4909[_0x263f4c];return _0x3a78d3;};'use strict';var _=require(_0x9490('0x0'));var moment=require(_0x9490('0x1'));var Redis=require(_0x9490('0x2'));var util=require('util');var config=require(_0x9490('0x3'));var db=require(_0x9490('0x4'))['db'];var logger=require('../logger')(_0x9490('0x5'));config['redis']=_['defaults'](config['redis'],{'host':_0x9490('0x6'),'port':0x18eb});var io=require(_0x9490('0x7'))(new Redis(config['redis']));function closeInteractions(){var _0x41ee67=0x0;var _0x22400b=[];return db[_0x9490('0x8')]['find']({'raw':!![],'attributes':['id',_0x9490('0x9')],'where':{'id':0x1}})[_0x9490('0xa')](function(_0x182c32){_0x41ee67=_0x182c32[_0x9490('0x9')];if(_0x41ee67){return db['ChatInteraction'][_0x9490('0xb')]({'raw':!![],'attributes':['id',_0x9490('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x9490('0xd')](_0x182c32[_0x9490('0x9')],_0x9490('0xe'))}}});}else{return[];}})[_0x9490('0xa')](function(_0x2ced45){if(_0x2ced45&&_0x2ced45[_0x9490('0xf')]){_0x22400b=_['map'](_0x2ced45||[],'id');logger[_0x9490('0x10')](_0x9490('0x11'),_0x22400b[_0x9490('0x12')]());return db['ChatInteraction'][_0x9490('0x13')]({'closeReason':_0x9490('0x14'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x9490('0x15')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x22400b}});}})[_0x9490('0xa')](function(){if(_0x22400b&&_0x22400b[_0x9490('0xf')]){logger['info'](_0x9490('0x16'),_0x22400b[_0x9490('0x12')]());for(var _0x5e92c6=0x0;_0x5e92c6<_0x22400b[_0x9490('0xf')];_0x5e92c6++){io['emit'](_0x9490('0x17'),{'id':_0x22400b[_0x5e92c6],'closed':!![]});}}})[_0x9490('0x18')](function(_0xc8cb0b){logger[_0x9490('0x19')](_0x9490('0x1a'),_0xc8cb0b?util[_0x9490('0x1b')](_0xc8cb0b,{'showHidden':![],'depth':null}):'');});}exports[_0x9490('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xbc84=['localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','update','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','../../mysqldb','../logger','schedule','redis','defaults'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0xbc84,0xa2));var _0x4bc8=function(_0x57c0ee,_0x2af491){_0x57c0ee=_0x57c0ee-0x0;var _0x610aa=_0xbc84[_0x57c0ee];return _0x610aa;};'use strict';var _=require(_0x4bc8('0x0'));var moment=require(_0x4bc8('0x1'));var Redis=require(_0x4bc8('0x2'));var util=require('util');var config=require('../../config/environment');var db=require(_0x4bc8('0x3'))['db'];var logger=require(_0x4bc8('0x4'))(_0x4bc8('0x5'));config[_0x4bc8('0x6')]=_[_0x4bc8('0x7')](config['redis'],{'host':_0x4bc8('0x8'),'port':0x18eb});var io=require(_0x4bc8('0x9'))(new Redis(config[_0x4bc8('0x6')]));function closeInteractions(){var _0x59741b=0x0;var _0x9b6cb=[];return db[_0x4bc8('0xa')][_0x4bc8('0xb')]({'raw':!![],'attributes':['id',_0x4bc8('0xc')],'where':{'id':0x1}})[_0x4bc8('0xd')](function(_0x43bef2){_0x59741b=_0x43bef2[_0x4bc8('0xc')];if(_0x59741b){return db[_0x4bc8('0xe')][_0x4bc8('0xf')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x4bc8('0x10')](_0x43bef2[_0x4bc8('0xc')],_0x4bc8('0x11'))}}});}else{return[];}})[_0x4bc8('0xd')](function(_0x34a34d){if(_0x34a34d&&_0x34a34d[_0x4bc8('0x12')]){_0x9b6cb=_[_0x4bc8('0x13')](_0x34a34d||[],'id');logger[_0x4bc8('0x14')](_0x4bc8('0x15'),_0x9b6cb['join']());return db[_0x4bc8('0xe')][_0x4bc8('0x16')]({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()[_0x4bc8('0x17')](_0x4bc8('0x18'))},{'where':{'id':_0x9b6cb}});}})[_0x4bc8('0xd')](function(){if(_0x9b6cb&&_0x9b6cb[_0x4bc8('0x12')]){logger[_0x4bc8('0x14')](_0x4bc8('0x19'),_0x9b6cb[_0x4bc8('0x1a')]());for(var _0x2cbf30=0x0;_0x2cbf30<_0x9b6cb[_0x4bc8('0x12')];_0x2cbf30++){io[_0x4bc8('0x1b')](_0x4bc8('0x1c'),{'id':_0x9b6cb[_0x2cbf30],'closed':!![]});}}})[_0x4bc8('0x1d')](function(_0x267fff){logger[_0x4bc8('0x1e')](_0x4bc8('0x1f'),_0x267fff?util[_0x4bc8('0x20')](_0x267fff,{'showHidden':![],'depth':null}):'');});}exports[_0x4bc8('0x21')]=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 221e23e..9d7204a 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 _0x6f92=['startAllRefreshIntervals','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x3202c7,_0x498049){var _0x312e0c=function(_0x5a8b48){while(--_0x5a8b48){_0x3202c7['push'](_0x3202c7['shift']());}};_0x312e0c(++_0x498049);}(_0x6f92,0x99));var _0x26f9=function(_0x57e50b,_0x5f0fb8){_0x57e50b=_0x57e50b-0x0;var _0x314279=_0x6f92[_0x57e50b];return _0x314279;};'use strict';function start(){var _0x450c99=require(_0x26f9('0x0'));return _0x450c99[_0x26f9('0x1')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file +var _0x9537=['startAllRefreshIntervals','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x3b4ee5,_0x573fc6){var _0x474303=function(_0x3ce0e4){while(--_0x3ce0e4){_0x3b4ee5['push'](_0x3b4ee5['shift']());}};_0x474303(++_0x573fc6);}(_0x9537,0x1b1));var _0x7953=function(_0x4f83ea,_0x4b484e){_0x4f83ea=_0x4f83ea-0x0;var _0x3e41f6=_0x9537[_0x4f83ea];return _0x3e41f6;};'use strict';function start(){var _0x2c5eed=require(_0x7953('0x0'));return _0x2c5eed[_0x7953('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 319ef9e..4ea63ad 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 _0xa701=['findAll','MailServerOut','Smtp','CloudProvider','keys','jobs','map','toString','keyBy','difference','intersection','deleteJob','delete\x20cron','length','index','my\x20id','resolve','run\x20job','cron','startAt','add','exists','stop','stop\x20cron','isBetween','endAt','update','update\x20cron','run','util','lodash','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../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','../../files/reports','basename','extname','savename','message','attachments','text','stringify','existsSync','status','Sent','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','then','error','error\x20mail','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xa701,0x72));var _0x1a70=function(_0x26e97d,_0x18ea53){_0x26e97d=_0x26e97d-0x0;var _0x3b5db1=_0xa701[_0x26e97d];return _0x3b5db1;};'use strict';var fs=require('fs');var util=require(_0x1a70('0x0'));var path=require('path');var _=require(_0x1a70('0x1'));var moment=require('moment');var CronJobManager=require(_0x1a70('0x2'));var jayson=require(_0x1a70('0x3'));var BPromise=require(_0x1a70('0x4'));var logger=require(_0x1a70('0x5'))(_0x1a70('0x6'));var db=require(_0x1a70('0x7'))['db'];var analyticCustomReportController=require(_0x1a70('0x8'));var analyticDefaultReportController=require(_0x1a70('0x9'));var client=jayson[_0x1a70('0xa')][_0x1a70('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4671f2,_0x36c4ae){return function(){logger[_0x1a70('0xc')](_0x1a70('0xd'),_0x4671f2[_0x1a70('0xe')]);var _0x204cc6=!![];var _0x2de824=_0x4671f2[_0x1a70('0xf')][_0x1a70('0x10')]();var _0x1f9caa={'account':_0x2de824,'message':{'from':util[_0x1a70('0x11')](_0x1a70('0x12'),_0x4671f2['MailAccount'][_0x1a70('0x13')],_0x4671f2[_0x1a70('0xf')][_0x1a70('0xe')]||_0x4671f2[_0x1a70('0xf')]['Smtp'][_0x1a70('0x14')]),'to':_0x4671f2[_0x1a70('0xe')],'cc':_0x4671f2['cc'],'bcc':_0x4671f2[_0x1a70('0x15')],'subject':util[_0x1a70('0x11')]('Report\x20%s\x20last\x20%s\x20%s',_0x36c4ae[_0x1a70('0x13')],_0x4671f2[_0x1a70('0x16')],_0x4671f2[_0x1a70('0x17')])}};var _0x281a25=path[_0x1a70('0x18')](__dirname,_0x1a70('0x19'));var _0x90abd3=_0x36c4ae['savename'];var _0x299b5f=util[_0x1a70('0x11')]('%s.%s',path[_0x1a70('0x1a')](_0x36c4ae['savename'],path[_0x1a70('0x1b')](_0x36c4ae[_0x1a70('0x1c')])),'zip');var _0xb6189a=path[_0x1a70('0x18')](_0x281a25,_0x90abd3);var _0x1e4b44=path[_0x1a70('0x18')](_0x281a25,_0x299b5f);if(fs['existsSync'](_0xb6189a)){_0x36c4ae['status']='Sent';_0x1f9caa[_0x1a70('0x1d')][_0x1a70('0x1e')]=[{'filename':_0x90abd3,'path':_0xb6189a}];_0x1f9caa['message'][_0x1a70('0x1f')]=util['format']('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x1a70('0x20')](_0x36c4ae,null,0x2));}else if(fs[_0x1a70('0x21')](_0x1e4b44)){_0x36c4ae[_0x1a70('0x22')]=_0x1a70('0x23');_0x1f9caa[_0x1a70('0x1d')][_0x1a70('0x1e')]=[{'filename':_0x299b5f,'path':_0x1e4b44}];}else{_0x1f9caa['message'][_0x1a70('0x1f')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x4671f2[_0x1a70('0x24')]){_0x204cc6=![];logger[_0x1a70('0xc')](_0x1a70('0x25'));}}if(_0x204cc6){return client['request']('SendMail',_0x1f9caa)[_0x1a70('0x26')](function(_0x515e5f){if(_0x515e5f[_0x1a70('0x27')]){return logger['error'](_0x1a70('0x28'),JSON['stringify'](_0x515e5f));}return logger[_0x1a70('0xc')]('email\x20sent');})[_0x1a70('0x29')](function(_0x41c81d){return logger['error'](_0x1a70('0x28'),JSON[_0x1a70('0x20')](_0x41c81d));});}};}function handleError(){return function(_0x104a4b){return logger['error'](JSON['stringify'](_0x104a4b));};}function handleResult(_0x5f5dab){return function(_0x3afd9e){logger[_0x1a70('0xc')](_0x1a70('0x2a'),JSON[_0x1a70('0x20')](_0x3afd9e));if(_0x5f5dab[_0x1a70('0xf')]&&_0x5f5dab[_0x1a70('0xf')]['Smtp']&&!_['isNil'](_0x5f5dab['email'])){setTimeout(handleSendEmail(_0x5f5dab,_0x3afd9e),0x3c*0x3e8);}};}function handleJob(_0x5c1366){return function(){try{if(_[_0x1a70('0x2b')](_0x5c1366[_0x1a70('0x16')])){return logger[_0x1a70('0xc')](_0x1a70('0x2c'));}if(_[_0x1a70('0x2b')](_0x5c1366[_0x1a70('0x17')])){return logger[_0x1a70('0xc')](_0x1a70('0x2d'));}var _0xdb6874={'startDate':moment()[_0x1a70('0x2e')](_0x5c1366[_0x1a70('0x16')],_0x5c1366[_0x1a70('0x17')])[_0x1a70('0x11')](_0x1a70('0x2f')),'endDate':moment()[_0x1a70('0x11')](_0x1a70('0x2f')),'type':'scheduled','output':_0x5c1366[_0x1a70('0x30')],'name':_0x5c1366['name']};if(!_[_0x1a70('0x2b')](_0x5c1366[_0x1a70('0x31')])){logger[_0x1a70('0xc')](_0x1a70('0x32'),_0x5c1366[_0x1a70('0x31')]);return analyticDefaultReportController[_0x1a70('0x33')]({'id':_0x5c1366['DefaultReportId']},_0xdb6874)[_0x1a70('0x26')](handleResult(_0x5c1366))[_0x1a70('0x29')](handleError());}if(!_[_0x1a70('0x2b')](_0x5c1366[_0x1a70('0x34')])){logger[_0x1a70('0xc')](_0x1a70('0x35'),_0x5c1366[_0x1a70('0x34')]);return analyticCustomReportController['runReport']({'id':_0x5c1366['CustomReportId']},_0xdb6874)[_0x1a70('0x26')](handleResult(_0x5c1366))[_0x1a70('0x29')](handleError());}}catch(_0x3320a3){logger[_0x1a70('0x27')](JSON[_0x1a70('0x20')](_0x3320a3));}return logger[_0x1a70('0xc')](_0x1a70('0x36'));};}function getJobs(_0x19391c){var _0x302977={};if(_0x19391c){_0x302977['id']=_0x19391c;}return db[_0x1a70('0x37')][_0x1a70('0x38')]({'where':_0x302977,'include':[{'model':db[_0x1a70('0xf')],'attributes':['id',_0x1a70('0x13'),'email'],'include':[{'model':db[_0x1a70('0x39')],'as':_0x1a70('0x3a'),'include':[{'model':db[_0x1a70('0x3b')],'as':_0x1a70('0x3b')}]}]}]})[_0x1a70('0x26')](function(_0x4e8b85){var _0xb3440a=_[_0x1a70('0x3c')](manager[_0x1a70('0x3d')]);var _0x2c9eb8=_[_0x1a70('0x3e')](_0x4e8b85,function(_0x377150){return _0x377150['id'][_0x1a70('0x3f')]();});var _0x470c9f=_[_0x1a70('0x40')](_0x4e8b85,function(_0x5bff00){return _0x5bff00['id'][_0x1a70('0x3f')]();});var _0x289526=_0x19391c?_0x2c9eb8:_[_0x1a70('0x41')](_0x2c9eb8,_0xb3440a);var _0x50866c=_[_0x1a70('0x42')](_0x2c9eb8,_0xb3440a);var _0x38c319=_[_0x1a70('0x41')](_0xb3440a,_0x2c9eb8);var _0x8095c3;var _0x2dbe8c;for(_0x8095c3=0x0;_0x8095c3<_0x38c319['length']&&!_0x19391c;_0x8095c3+=0x1){_0x2dbe8c=_0x38c319[_0x8095c3][_0x1a70('0x3f')]();if(manager['exists'](_0x2dbe8c)){manager['stop'](_0x2dbe8c);manager[_0x1a70('0x43')](_0x2dbe8c);logger[_0x1a70('0xc')](_0x1a70('0x44'),_0x2dbe8c);}}logger[_0x1a70('0xc')]('toRun',JSON[_0x1a70('0x20')](_0x289526));for(_0x8095c3=0x0;_0x8095c3<_0x289526[_0x1a70('0x45')];_0x8095c3+=0x1){_0x2dbe8c=_0x289526[_0x8095c3][_0x1a70('0x3f')]();logger['info'](_0x1a70('0x46'),_0x2dbe8c);if(_0x19391c){logger[_0x1a70('0xc')](_0x1a70('0x47'),_0x19391c);logger[_0x1a70('0xc')](JSON[_0x1a70('0x20')](_0x470c9f[_0x2dbe8c]));BPromise[_0x1a70('0x48')]()['then'](handleJob(_0x470c9f[_0x2dbe8c]));logger['info'](_0x1a70('0x49'),_0x470c9f[_0x2dbe8c][_0x1a70('0x13')],_0x470c9f[_0x2dbe8c][_0x1a70('0x4a')]);}else if(_0x470c9f[_0x2dbe8c]['cron']&&_0x470c9f[_0x2dbe8c]['active']&&moment()['isBetween'](_0x470c9f[_0x2dbe8c][_0x1a70('0x4b')],_0x470c9f[_0x2dbe8c]['endAt'])){manager[_0x1a70('0x4c')](_0x2dbe8c,_0x470c9f[_0x2dbe8c][_0x1a70('0x4a')],handleJob(_0x470c9f[_0x2dbe8c]));manager['start'](_0x2dbe8c);logger['info']('add\x20cron',_0x470c9f[_0x2dbe8c][_0x1a70('0x13')],_0x470c9f[_0x2dbe8c][_0x1a70('0x4a')]);}else if(manager[_0x1a70('0x4d')](_0x2dbe8c)){manager[_0x1a70('0x4e')](_0x2dbe8c);manager[_0x1a70('0x43')](_0x2dbe8c);logger[_0x1a70('0xc')](_0x1a70('0x4f'),_0x470c9f[_0x2dbe8c]['name'],_0x470c9f[_0x2dbe8c][_0x1a70('0x4a')]);}}for(_0x8095c3=0x0,_0x2dbe8c;_0x8095c3<_0x50866c[_0x1a70('0x45')]&&!_0x19391c;_0x8095c3+=0x1){_0x2dbe8c=_0x50866c[_0x8095c3][_0x1a70('0x3f')]();if(manager[_0x1a70('0x4d')](_0x2dbe8c)){if(_0x470c9f[_0x2dbe8c][_0x1a70('0x4a')]&&_0x470c9f[_0x2dbe8c]['active']&&moment()[_0x1a70('0x50')](_0x470c9f[_0x2dbe8c][_0x1a70('0x4b')],_0x470c9f[_0x2dbe8c][_0x1a70('0x51')])){manager[_0x1a70('0x52')](_0x2dbe8c,_0x470c9f[_0x2dbe8c][_0x1a70('0x4a')],handleJob(_0x470c9f[_0x2dbe8c]));logger['info'](_0x1a70('0x53'),_0x470c9f[_0x2dbe8c][_0x1a70('0x13')],_0x470c9f[_0x2dbe8c][_0x1a70('0x4a')]);}else{manager[_0x1a70('0x4e')](_0x2dbe8c);manager[_0x1a70('0x43')](_0x2dbe8c);logger[_0x1a70('0xc')](_0x1a70('0x4f'),_0x470c9f[_0x2dbe8c][_0x1a70('0x13')],_0x470c9f[_0x2dbe8c]['cron']);}}}})[_0x1a70('0x29')](function(_0x2a257f){logger[_0x1a70('0x27')](JSON[_0x1a70('0x20')](_0x2a257f));});}exports[_0x1a70('0x54')]=function(_0x3902a2){return getJobs(_0x3902a2);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xe64c=['keys','jobs','map','toString','keyBy','difference','intersection','length','exists','delete\x20cron','toRun','index','resolve','run\x20job','cron','active','isBetween','endAt','add','start','add\x20cron','stop','startAt','update\x20cron','stop\x20cron','path','moment','bluebird','../logger','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','getSmtpOptions','\x22%s\x22\x20<%s>','MailAccount','name','Smtp','user','bcc','format','Report\x20%s\x20last\x20%s\x20%s','join','%s.%s','basename','savename','zip','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','sendIfEmpty','request','SendMail','then','error','catch','error\x20mail','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xe64c,0x10c));var _0xce64=function(_0x206afd,_0xddc2de){_0x206afd=_0x206afd-0x0;var _0x4311b7=_0xe64c[_0x206afd];return _0x4311b7;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xce64('0x0'));var _=require('lodash');var moment=require(_0xce64('0x1'));var CronJobManager=require('cron-job-manager');var jayson=require('jayson/promise');var BPromise=require(_0xce64('0x2'));var logger=require(_0xce64('0x3'))('schedule');var db=require('../../mysqldb')['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xce64('0x4')][_0xce64('0x5')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x49981c,_0x139e34){return function(){logger[_0xce64('0x6')](_0xce64('0x7'),_0x49981c[_0xce64('0x8')]);var _0x492db0=!![];var _0x4cf446=_0x49981c['MailAccount'][_0xce64('0x9')]();var _0x3788a9={'account':_0x4cf446,'message':{'from':util['format'](_0xce64('0xa'),_0x49981c[_0xce64('0xb')][_0xce64('0xc')],_0x49981c['MailAccount']['email']||_0x49981c[_0xce64('0xb')][_0xce64('0xd')][_0xce64('0xe')]),'to':_0x49981c[_0xce64('0x8')],'cc':_0x49981c['cc'],'bcc':_0x49981c[_0xce64('0xf')],'subject':util[_0xce64('0x10')](_0xce64('0x11'),_0x139e34['name'],_0x49981c['subtractNumber'],_0x49981c['subtractUnit'])}};var _0x583315=path[_0xce64('0x12')](__dirname,'../../files/reports');var _0x2de4d2=_0x139e34['savename'];var _0x117331=util[_0xce64('0x10')](_0xce64('0x13'),path[_0xce64('0x14')](_0x139e34['savename'],path['extname'](_0x139e34[_0xce64('0x15')])),_0xce64('0x16'));var _0x346663=path['join'](_0x583315,_0x2de4d2);var _0x4206b3=path[_0xce64('0x12')](_0x583315,_0x117331);if(fs[_0xce64('0x17')](_0x346663)){_0x139e34[_0xce64('0x18')]=_0xce64('0x19');_0x3788a9[_0xce64('0x1a')][_0xce64('0x1b')]=[{'filename':_0x2de4d2,'path':_0x346663}];_0x3788a9['message'][_0xce64('0x1c')]=util[_0xce64('0x10')](_0xce64('0x1d'),JSON[_0xce64('0x1e')](_0x139e34,null,0x2));}else if(fs[_0xce64('0x17')](_0x4206b3)){_0x139e34[_0xce64('0x18')]=_0xce64('0x19');_0x3788a9[_0xce64('0x1a')]['attachments']=[{'filename':_0x117331,'path':_0x4206b3}];}else{_0x3788a9[_0xce64('0x1a')][_0xce64('0x1c')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x49981c[_0xce64('0x1f')]){_0x492db0=![];logger[_0xce64('0x6')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x492db0){return client[_0xce64('0x20')](_0xce64('0x21'),_0x3788a9)[_0xce64('0x22')](function(_0x1c6ca8){if(_0x1c6ca8[_0xce64('0x23')]){return logger['error']('error\x20mail',JSON[_0xce64('0x1e')](_0x1c6ca8));}return logger[_0xce64('0x6')]('email\x20sent');})[_0xce64('0x24')](function(_0x103e62){return logger['error'](_0xce64('0x25'),JSON['stringify'](_0x103e62));});}};}function handleError(){return function(_0x6aabf0){return logger[_0xce64('0x23')](JSON[_0xce64('0x1e')](_0x6aabf0));};}function handleResult(_0x47c2d5){return function(_0x2510d4){logger['info'](_0xce64('0x26'),JSON[_0xce64('0x1e')](_0x2510d4));if(_0x47c2d5[_0xce64('0xb')]&&_0x47c2d5['MailAccount'][_0xce64('0xd')]&&!_[_0xce64('0x27')](_0x47c2d5[_0xce64('0x8')])){setTimeout(handleSendEmail(_0x47c2d5,_0x2510d4),0x3c*0x3e8);}};}function handleJob(_0x35ac1d){return function(){try{if(_[_0xce64('0x27')](_0x35ac1d[_0xce64('0x28')])){return logger[_0xce64('0x6')](_0xce64('0x29'));}if(_[_0xce64('0x27')](_0x35ac1d['subtractUnit'])){return logger['info'](_0xce64('0x2a'));}var _0x18ab62={'startDate':moment()[_0xce64('0x2b')](_0x35ac1d[_0xce64('0x28')],_0x35ac1d['subtractUnit'])['format'](_0xce64('0x2c')),'endDate':moment()[_0xce64('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'type':'scheduled','output':_0x35ac1d[_0xce64('0x2d')],'name':_0x35ac1d[_0xce64('0xc')]};if(!_[_0xce64('0x27')](_0x35ac1d[_0xce64('0x2e')])){logger[_0xce64('0x6')](_0xce64('0x2f'),_0x35ac1d[_0xce64('0x2e')]);return analyticDefaultReportController[_0xce64('0x30')]({'id':_0x35ac1d[_0xce64('0x2e')]},_0x18ab62)[_0xce64('0x22')](handleResult(_0x35ac1d))[_0xce64('0x24')](handleError());}if(!_[_0xce64('0x27')](_0x35ac1d[_0xce64('0x31')])){logger[_0xce64('0x6')](_0xce64('0x32'),_0x35ac1d[_0xce64('0x31')]);return analyticCustomReportController[_0xce64('0x30')]({'id':_0x35ac1d[_0xce64('0x31')]},_0x18ab62)[_0xce64('0x22')](handleResult(_0x35ac1d))['catch'](handleError());}}catch(_0x10518c){logger[_0xce64('0x23')](JSON['stringify'](_0x10518c));}return logger['info'](_0xce64('0x33'));};}function getJobs(_0x1ff8ae){var _0x248a74={};if(_0x1ff8ae){_0x248a74['id']=_0x1ff8ae;}return db[_0xce64('0x34')][_0xce64('0x35')]({'where':_0x248a74,'include':[{'model':db[_0xce64('0xb')],'attributes':['id',_0xce64('0xc'),_0xce64('0x8')],'include':[{'model':db[_0xce64('0x36')],'as':_0xce64('0xd'),'include':[{'model':db['CloudProvider'],'as':_0xce64('0x37')}]}]}]})[_0xce64('0x22')](function(_0x16c030){var _0x1ec901=_[_0xce64('0x38')](manager[_0xce64('0x39')]);var _0x1abede=_[_0xce64('0x3a')](_0x16c030,function(_0x9205a4){return _0x9205a4['id'][_0xce64('0x3b')]();});var _0x37da52=_[_0xce64('0x3c')](_0x16c030,function(_0x2655b2){return _0x2655b2['id'][_0xce64('0x3b')]();});var _0x43a11d=_0x1ff8ae?_0x1abede:_[_0xce64('0x3d')](_0x1abede,_0x1ec901);var _0x2faafc=_[_0xce64('0x3e')](_0x1abede,_0x1ec901);var _0x3a86e0=_[_0xce64('0x3d')](_0x1ec901,_0x1abede);var _0x34d773;var _0x2d0c7b;for(_0x34d773=0x0;_0x34d773<_0x3a86e0[_0xce64('0x3f')]&&!_0x1ff8ae;_0x34d773+=0x1){_0x2d0c7b=_0x3a86e0[_0x34d773][_0xce64('0x3b')]();if(manager[_0xce64('0x40')](_0x2d0c7b)){manager['stop'](_0x2d0c7b);manager['deleteJob'](_0x2d0c7b);logger[_0xce64('0x6')](_0xce64('0x41'),_0x2d0c7b);}}logger['info'](_0xce64('0x42'),JSON[_0xce64('0x1e')](_0x43a11d));for(_0x34d773=0x0;_0x34d773<_0x43a11d['length'];_0x34d773+=0x1){_0x2d0c7b=_0x43a11d[_0x34d773][_0xce64('0x3b')]();logger[_0xce64('0x6')](_0xce64('0x43'),_0x2d0c7b);if(_0x1ff8ae){logger[_0xce64('0x6')]('my\x20id',_0x1ff8ae);logger['info'](JSON[_0xce64('0x1e')](_0x37da52[_0x2d0c7b]));BPromise[_0xce64('0x44')]()[_0xce64('0x22')](handleJob(_0x37da52[_0x2d0c7b]));logger[_0xce64('0x6')](_0xce64('0x45'),_0x37da52[_0x2d0c7b][_0xce64('0xc')],_0x37da52[_0x2d0c7b][_0xce64('0x46')]);}else if(_0x37da52[_0x2d0c7b]['cron']&&_0x37da52[_0x2d0c7b][_0xce64('0x47')]&&moment()[_0xce64('0x48')](_0x37da52[_0x2d0c7b]['startAt'],_0x37da52[_0x2d0c7b][_0xce64('0x49')])){manager[_0xce64('0x4a')](_0x2d0c7b,_0x37da52[_0x2d0c7b][_0xce64('0x46')],handleJob(_0x37da52[_0x2d0c7b]));manager[_0xce64('0x4b')](_0x2d0c7b);logger['info'](_0xce64('0x4c'),_0x37da52[_0x2d0c7b][_0xce64('0xc')],_0x37da52[_0x2d0c7b][_0xce64('0x46')]);}else if(manager['exists'](_0x2d0c7b)){manager[_0xce64('0x4d')](_0x2d0c7b);manager['deleteJob'](_0x2d0c7b);logger['info']('stop\x20cron',_0x37da52[_0x2d0c7b]['name'],_0x37da52[_0x2d0c7b][_0xce64('0x46')]);}}for(_0x34d773=0x0,_0x2d0c7b;_0x34d773<_0x2faafc['length']&&!_0x1ff8ae;_0x34d773+=0x1){_0x2d0c7b=_0x2faafc[_0x34d773]['toString']();if(manager['exists'](_0x2d0c7b)){if(_0x37da52[_0x2d0c7b][_0xce64('0x46')]&&_0x37da52[_0x2d0c7b][_0xce64('0x47')]&&moment()['isBetween'](_0x37da52[_0x2d0c7b][_0xce64('0x4e')],_0x37da52[_0x2d0c7b]['endAt'])){manager['update'](_0x2d0c7b,_0x37da52[_0x2d0c7b][_0xce64('0x46')],handleJob(_0x37da52[_0x2d0c7b]));logger['info'](_0xce64('0x4f'),_0x37da52[_0x2d0c7b][_0xce64('0xc')],_0x37da52[_0x2d0c7b][_0xce64('0x46')]);}else{manager['stop'](_0x2d0c7b);manager['deleteJob'](_0x2d0c7b);logger[_0xce64('0x6')](_0xce64('0x50'),_0x37da52[_0x2d0c7b][_0xce64('0xc')],_0x37da52[_0x2d0c7b][_0xce64('0x46')]);}}}})[_0xce64('0x24')](function(_0x26dd36){logger[_0xce64('0x23')](JSON[_0xce64('0x1e')](_0x26dd36));});}exports['run']=function(_0x3e3920){return getJobs(_0x3e3920);};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 c5e744b..23003f4 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 _0x7b37=['util','bluebird','../../config/logger','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','TranscriptionJob','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','length','transcripts','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','language','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','Positive','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribe','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','push','all','start','lodash','aws-sdk'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7b37,0xd9));var _0x77b3=function(_0x562f3b,_0x4c65ae){_0x562f3b=_0x562f3b-0x0;var _0x1edd55=_0x7b37[_0x562f3b];return _0x1edd55;};var _=require(_0x77b3('0x0'));var AWS=require(_0x77b3('0x1'));var rp=require('request-promise');var util=require(_0x77b3('0x2'));var BPromise=require(_0x77b3('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x77b3('0x4'))('transcribe');function getTranscriptionJob(_0x2719f2,_0x2c94ea,_0x2d64f7,_0x579ea7){return new Promise(function(_0x3acdea,_0x32345c){var _0x515f06=new AWS['TranscribeService']({'accessKeyId':_0x2c94ea,'secretAccessKey':_0x2719f2,'region':_0x2d64f7});_0x515f06[_0x77b3('0x5')]({'TranscriptionJobName':_0x579ea7},function(_0x5b3fb4,_0x35becb){if(_0x5b3fb4){return _0x32345c(_0x5b3fb4);}else{return _0x3acdea(_0x35becb);}});});}function sentiment(_0x37fafb,_0x4b3a98,_0x46dc45,_0x31b2ac,_0x24f2a1){return new Promise(function(_0x27bfa6,_0x203a71){var _0x29c263=new AWS[(_0x77b3('0x6'))]({'accessKeyId':_0x4b3a98,'secretAccessKey':_0x37fafb,'region':_0x46dc45});_0x29c263[_0x77b3('0x7')]({'Text':_0x31b2ac,'LanguageCode':_0x24f2a1[_0x77b3('0x8')](0x0,0x2)},function(_0x3e100c,_0x58f30a){if(_0x3e100c){return _0x203a71(_0x3e100c);}else{return _0x27bfa6(_0x58f30a);}});});}function checkTranscribeJob(_0x13bc8e,_0x48adca,_0x804b7){var _0x16692f;return new BPromise(function(_0x3ee308,_0x363de1){logger[_0x77b3('0x9')](util[_0x77b3('0xa')](_0x77b3('0xb'),_0x13bc8e['id'],_0x13bc8e[_0x77b3('0xc')]));return getTranscriptionJob(_0x804b7[_0x77b3('0xd')],_0x804b7[_0x77b3('0xe')],_0x48adca['transcribeRegion'],_0x13bc8e[_0x77b3('0xc')])[_0x77b3('0xf')](function(_0x1c995c){logger[_0x77b3('0x9')](util['format'](_0x77b3('0x10'),_0x13bc8e['id'],_0x13bc8e['transcribeName'],_0x1c995c['TranscriptionJob'][_0x77b3('0x11')]));if(!_0x13bc8e[_0x77b3('0x12')]){switch(_0x1c995c[_0x77b3('0x13')][_0x77b3('0x11')]){case'COMPLETED':var _0x26f445={'transcribeStatus':_0x1c995c['TranscriptionJob']['TranscriptionJobStatus'],'fileUri':_0x1c995c[_0x77b3('0x13')][_0x77b3('0x14')][_0x77b3('0x15')]};logger['info'](util[_0x77b3('0xa')](_0x77b3('0x16'),_0x13bc8e['id']));return rp({'uri':_0x1c995c[_0x77b3('0x13')][_0x77b3('0x14')][_0x77b3('0x15')],'json':!![]})[_0x77b3('0xf')](function(_0x174058){logger[_0x77b3('0x9')](util[_0x77b3('0xa')](_0x77b3('0x17'),_0x13bc8e['id']));if(_0x174058&&_0x174058['results']&&_0x174058[_0x77b3('0x18')]['transcripts']&&_0x174058[_0x77b3('0x18')]['transcripts'][_0x77b3('0x19')]){_0x26f445[_0x77b3('0x12')]='';for(var _0x37de70=0x0;_0x37de70<_0x174058[_0x77b3('0x18')][_0x77b3('0x1a')]['length'];_0x37de70++){_0x26f445['fileText']+=_0x174058[_0x77b3('0x18')][_0x77b3('0x1a')][_0x37de70][_0x77b3('0x1b')]+'';}}return _0x13bc8e['update'](_0x26f445);})[_0x77b3('0xf')](function(){logger[_0x77b3('0x9')](util[_0x77b3('0xa')](_0x77b3('0x1c'),_0x13bc8e['id']));if(!_0x13bc8e[_0x77b3('0x1d')]){throw new db[(_0x77b3('0x1e'))]['ValidationError'](_0x77b3('0x1f'));}if(!_0x48adca[_0x77b3('0x20')]||!_0x48adca['sentimentAccountId']||!_0x48adca['sentimentRegion']||!_0x48adca[_0x77b3('0x21')]||!_0x48adca[_0x77b3('0x22')]){throw new db[(_0x77b3('0x1e'))][(_0x77b3('0x23'))](_0x77b3('0x24'));}if(!_0x26f445[_0x77b3('0x12')]){throw new Error(_0x77b3('0x25'));}if(_0x48adca[_0x77b3('0x26')]===_0x804b7['id']){return _0x804b7;}else{return db[_0x77b3('0x27')][_0x77b3('0x28')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x17b4ec){if(!_0x17b4ec){throw new db[(_0x77b3('0x1e'))]['ValidationError'](_0x77b3('0x29'));}if(!_0x17b4ec[_0x77b3('0xd')]||!_0x17b4ec[_0x77b3('0xe')]){throw new db[(_0x77b3('0x1e'))]['ValidationError'](_0x77b3('0x2a'));}_0x16692f=_0x17b4ec;logger[_0x77b3('0x9')](util[_0x77b3('0xa')](_0x77b3('0x2b'),_0x13bc8e['id']));return sentiment(_0x16692f[_0x77b3('0xd')],_0x16692f[_0x77b3('0xe')],_0x48adca[_0x77b3('0x2c')],_0x26f445['fileText'],_0x48adca['language']);})[_0x77b3('0xf')](function(_0x5ed77f){logger['info'](util['format'](_0x77b3('0x2d'),_0x13bc8e['id']));return _0x13bc8e[_0x77b3('0x2e')]({'sentiment':_0x5ed77f[_0x77b3('0x2f')],'sPositive':_0x5ed77f[_0x77b3('0x30')]['Positive'],'sNegative':_0x5ed77f[_0x77b3('0x30')][_0x77b3('0x31')],'sMixed':_0x5ed77f[_0x77b3('0x30')][_0x77b3('0x32')],'sNeutral':_0x5ed77f['SentimentScore'][_0x77b3('0x33')]});})[_0x77b3('0xf')](function(){logger['info'](util['format'](_0x77b3('0x1c'),_0x13bc8e['id']));_0x3ee308();});case _0x77b3('0x34'):return _0x13bc8e['update']({'transcribeStatus':_0x77b3('0x34'),'failureReason':_0x1c995c['TranscriptionJob'][_0x77b3('0x35')]})[_0x77b3('0xf')](function(){logger[_0x77b3('0x9')](util['format'](_0x77b3('0x1c'),_0x13bc8e['id']));_0x3ee308();});default:logger[_0x77b3('0x9')](util[_0x77b3('0xa')](_0x77b3('0x36'),_0x13bc8e['id']));break;}}else{return BPromise['resolve']()[_0x77b3('0xf')](function(){if(!_0x13bc8e[_0x77b3('0x1d')]){throw new db['Sequelize'][(_0x77b3('0x23'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x48adca[_0x77b3('0x20')]||!_0x48adca[_0x77b3('0x26')]||!_0x48adca[_0x77b3('0x2c')]||!_0x48adca[_0x77b3('0x21')]||!_0x48adca[_0x77b3('0x22')]){throw new db[(_0x77b3('0x1e'))]['ValidationError'](_0x77b3('0x24'));}if(!_0x13bc8e[_0x77b3('0x12')]){throw new Error(_0x77b3('0x25'));}if(_0x48adca[_0x77b3('0x26')]===_0x804b7['id']){return _0x804b7;}else{return db[_0x77b3('0x27')][_0x77b3('0x28')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x77b3('0xf')](function(_0x10568f){if(!_0x10568f){throw new db[(_0x77b3('0x1e'))]['ValidationError'](_0x77b3('0x29'));}if(!_0x10568f['data1']||!_0x10568f[_0x77b3('0xe')]){throw new db['Sequelize'][(_0x77b3('0x23'))](_0x77b3('0x2a'));}_0x16692f=_0x10568f;logger[_0x77b3('0x9')](util[_0x77b3('0xa')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x13bc8e['id']));return sentiment(_0x16692f[_0x77b3('0xd')],_0x16692f[_0x77b3('0xe')],_0x48adca[_0x77b3('0x2c')],_0x13bc8e[_0x77b3('0x12')],_0x48adca['language']);})[_0x77b3('0xf')](function(_0x5bba05){logger['info'](util[_0x77b3('0xa')](_0x77b3('0x2d'),_0x13bc8e['id']));return _0x13bc8e[_0x77b3('0x2e')]({'sentiment':_0x5bba05[_0x77b3('0x2f')],'sPositive':_0x5bba05[_0x77b3('0x30')][_0x77b3('0x37')],'sNegative':_0x5bba05[_0x77b3('0x30')][_0x77b3('0x31')],'sMixed':_0x5bba05['SentimentScore'][_0x77b3('0x32')],'sNeutral':_0x5bba05[_0x77b3('0x30')][_0x77b3('0x33')],'transcribeStatus':'COMPLETED'});})[_0x77b3('0xf')](function(){logger[_0x77b3('0x9')](util[_0x77b3('0xa')](_0x77b3('0x1c'),_0x13bc8e['id']));_0x3ee308();});}})[_0x77b3('0x38')](function(_0x2f373a){if(_0x2f373a){if(!_0x2f373a[_0x77b3('0x39')]||_0x2f373a[_0x77b3('0x39')]!==_0x77b3('0x3a')){logger[_0x77b3('0x3b')](util[_0x77b3('0xa')](_0x77b3('0x3c'),_0x13bc8e['id']),util[_0x77b3('0x3d')](_0x2f373a,{'showHidden':![],'depth':null}));}}_0x3ee308();});});}function checkTranscribe(){var _0xe26db1;var _0xc8b1bb;var _0x127a14;return db['VoiceRecording'][_0x77b3('0x3e')]({'where':{'transcribeStatus':_0x77b3('0x3f')}})[_0x77b3('0xf')](function(_0x45c38b){if(!_0x45c38b||!_0x45c38b[_0x77b3('0x19')]){throw new db[(_0x77b3('0x1e'))][(_0x77b3('0x23'))](_0x77b3('0x40'));}_0xe26db1=_0x45c38b;return db['Setting'][_0x77b3('0x28')]({'where':{'id':0x1}});})[_0x77b3('0xf')](function(_0x1cdff7){if(!_0x1cdff7){throw new db[(_0x77b3('0x1e'))][(_0x77b3('0x23'))](_0x77b3('0x41'));}_0xc8b1bb=_0x1cdff7;if(!_0xc8b1bb[_0x77b3('0x42')]||!_0xc8b1bb[_0x77b3('0x43')]||!_0xc8b1bb[_0x77b3('0x44')]||!_0xc8b1bb[_0x77b3('0x21')]||!_0xc8b1bb[_0x77b3('0x22')]){throw new db[(_0x77b3('0x1e'))][(_0x77b3('0x23'))](_0x77b3('0x45'));}return db[_0x77b3('0x27')][_0x77b3('0x28')]({'where':{'id':_0xc8b1bb['transcribeAccountId']}});})['then'](function(_0x142aff){if(!_0x142aff){throw new db[(_0x77b3('0x1e'))][(_0x77b3('0x23'))](_0x77b3('0x29'));}if(!_0x142aff[_0x77b3('0xd')]||!_0x142aff[_0x77b3('0xe')]){throw new db['Sequelize'][(_0x77b3('0x23'))](_0x77b3('0x2a'));}_0x127a14=_0x142aff;var _0x280eb7=[];_0xe26db1['forEach'](function(_0x106309){_0x280eb7[_0x77b3('0x46')](checkTranscribeJob(_0x106309,_0xc8b1bb,_0x127a14));});return BPromise[_0x77b3('0x47')](_0x280eb7);})[_0x77b3('0x38')](function(_0x3dd7b9){if(_0x3dd7b9){if(!_0x3dd7b9['name']||_0x3dd7b9[_0x77b3('0x39')]!==_0x77b3('0x3a')){logger[_0x77b3('0x3b')](util[_0x77b3('0x3d')](_0x3dd7b9,{'showHidden':![],'depth':null}));}}});}exports[_0x77b3('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x0e21=['Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','tempSentiment','sentiment','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','catch','name','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','findAll','Setting','Settings\x20not\x20available','transcribeAccountId','all','SequelizeValidationError','inspect','start','aws-sdk','request-promise','util','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','substring','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','transcribeRegion','then','info','format','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','language','bucket','Transcript\x20not\x20available','CloudProvider','findOne','data2','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','update','Sentiment','SentimentScore','Positive'];(function(_0x1afa61,_0x4aaf01){var _0x58ea74=function(_0x4ea3d3){while(--_0x4ea3d3){_0x1afa61['push'](_0x1afa61['shift']());}};_0x58ea74(++_0x4aaf01);}(_0x0e21,0xe8));var _0x10e2=function(_0x1f336a,_0x55f30f){_0x1f336a=_0x1f336a-0x0;var _0x3adb12=_0x0e21[_0x1f336a];return _0x3adb12;};var _=require('lodash');var AWS=require(_0x10e2('0x0'));var rp=require(_0x10e2('0x1'));var util=require(_0x10e2('0x2'));var BPromise=require('bluebird');var db=require(_0x10e2('0x3'))['db'];var logger=require(_0x10e2('0x4'))(_0x10e2('0x5'));function getTranscriptionJob(_0x4861d5,_0x4b6911,_0x263df,_0x340513){return new Promise(function(_0x2fb9e4,_0x44e30e){var _0x4e1687=new AWS[(_0x10e2('0x6'))]({'accessKeyId':_0x4b6911,'secretAccessKey':_0x4861d5,'region':_0x263df});_0x4e1687[_0x10e2('0x7')]({'TranscriptionJobName':_0x340513},function(_0x48ab5b,_0x375bbc){if(_0x48ab5b){return _0x44e30e(_0x48ab5b);}else{return _0x2fb9e4(_0x375bbc);}});});}function sentiment(_0x50c758,_0x3594c4,_0x52ef03,_0x559b78,_0x5ac29c){return new Promise(function(_0xe4451a,_0x13c32a){var _0x5c6925=new AWS[(_0x10e2('0x8'))]({'accessKeyId':_0x3594c4,'secretAccessKey':_0x50c758,'region':_0x52ef03});_0x5c6925['detectSentiment']({'Text':_0x559b78,'LanguageCode':_0x5ac29c[_0x10e2('0x9')](0x0,0x2)},function(_0x435c67,_0x26b7dd){if(_0x435c67){return _0x13c32a(_0x435c67);}else{return _0xe4451a(_0x26b7dd);}});});}function checkTranscribeJob(_0x56db90,_0x37dafd,_0x4072f4){var _0x411688;return new BPromise(function(_0x4e584f,_0x4d8533){logger['info'](util['format'](_0x10e2('0xa'),_0x56db90['id'],_0x56db90[_0x10e2('0xb')]));return getTranscriptionJob(_0x4072f4[_0x10e2('0xc')],_0x4072f4['data2'],_0x37dafd[_0x10e2('0xd')],_0x56db90[_0x10e2('0xb')])[_0x10e2('0xe')](function(_0x40c5bc){logger[_0x10e2('0xf')](util[_0x10e2('0x10')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x56db90['id'],_0x56db90[_0x10e2('0xb')],_0x40c5bc[_0x10e2('0x11')][_0x10e2('0x12')]));if(!_0x56db90[_0x10e2('0x13')]){switch(_0x40c5bc[_0x10e2('0x11')][_0x10e2('0x12')]){case _0x10e2('0x14'):var _0x1a8f8d={'transcribeStatus':_0x40c5bc['TranscriptionJob'][_0x10e2('0x12')],'fileUri':_0x40c5bc[_0x10e2('0x11')][_0x10e2('0x15')][_0x10e2('0x16')]};logger['info'](util['format'](_0x10e2('0x17'),_0x56db90['id']));return rp({'uri':_0x40c5bc[_0x10e2('0x11')][_0x10e2('0x15')][_0x10e2('0x16')],'json':!![]})['then'](function(_0x54ef4f){logger[_0x10e2('0xf')](util[_0x10e2('0x10')](_0x10e2('0x18'),_0x56db90['id']));if(_0x54ef4f&&_0x54ef4f[_0x10e2('0x19')]&&_0x54ef4f[_0x10e2('0x19')][_0x10e2('0x1a')]&&_0x54ef4f['results'][_0x10e2('0x1a')][_0x10e2('0x1b')]){_0x1a8f8d[_0x10e2('0x13')]='';for(var _0x46ae73=0x0;_0x46ae73<_0x54ef4f[_0x10e2('0x19')][_0x10e2('0x1a')]['length'];_0x46ae73++){_0x1a8f8d[_0x10e2('0x13')]+=_0x54ef4f['results']['transcripts'][_0x46ae73]['transcript']+'';}}return _0x56db90['update'](_0x1a8f8d);})['then'](function(){logger['info'](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x56db90['id']));if(!_0x56db90['tempSentiment']){throw new db[(_0x10e2('0x1c'))][(_0x10e2('0x1d'))](_0x10e2('0x1e'));}if(!_0x37dafd['sentiment']||!_0x37dafd[_0x10e2('0x1f')]||!_0x37dafd[_0x10e2('0x20')]||!_0x37dafd[_0x10e2('0x21')]||!_0x37dafd[_0x10e2('0x22')]){throw new db[(_0x10e2('0x1c'))][(_0x10e2('0x1d'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x1a8f8d['fileText']){throw new Error(_0x10e2('0x23'));}if(_0x37dafd[_0x10e2('0x1f')]===_0x4072f4['id']){return _0x4072f4;}else{return db[_0x10e2('0x24')][_0x10e2('0x25')]({'where':{'id':_settings[_0x10e2('0x1f')]}});}})[_0x10e2('0xe')](function(_0x45a3a0){if(!_0x45a3a0){throw new db[(_0x10e2('0x1c'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x45a3a0[_0x10e2('0xc')]||!_0x45a3a0[_0x10e2('0x26')]){throw new db[(_0x10e2('0x1c'))][(_0x10e2('0x1d'))]('Cloud\x20Provider\x20not\x20configured');}_0x411688=_0x45a3a0;logger['info'](util[_0x10e2('0x10')](_0x10e2('0x27'),_0x56db90['id']));return sentiment(_0x411688[_0x10e2('0xc')],_0x411688[_0x10e2('0x26')],_0x37dafd[_0x10e2('0x20')],_0x1a8f8d[_0x10e2('0x13')],_0x37dafd['language']);})[_0x10e2('0xe')](function(_0x45590f){logger[_0x10e2('0xf')](util[_0x10e2('0x10')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x56db90['id']));return _0x56db90[_0x10e2('0x28')]({'sentiment':_0x45590f[_0x10e2('0x29')],'sPositive':_0x45590f[_0x10e2('0x2a')][_0x10e2('0x2b')],'sNegative':_0x45590f[_0x10e2('0x2a')][_0x10e2('0x2c')],'sMixed':_0x45590f['SentimentScore'][_0x10e2('0x2d')],'sNeutral':_0x45590f[_0x10e2('0x2a')][_0x10e2('0x2e')]});})[_0x10e2('0xe')](function(){logger[_0x10e2('0xf')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x56db90['id']));_0x4e584f();});case'FAILED':return _0x56db90['update']({'transcribeStatus':_0x10e2('0x2f'),'failureReason':_0x40c5bc['TranscriptionJob'][_0x10e2('0x30')]})[_0x10e2('0xe')](function(){logger[_0x10e2('0xf')](util[_0x10e2('0x10')](_0x10e2('0x31'),_0x56db90['id']));_0x4e584f();});default:logger[_0x10e2('0xf')](util[_0x10e2('0x10')](_0x10e2('0x32'),_0x56db90['id']));break;}}else{return BPromise['resolve']()[_0x10e2('0xe')](function(){if(!_0x56db90[_0x10e2('0x33')]){throw new db['Sequelize'][(_0x10e2('0x1d'))](_0x10e2('0x1e'));}if(!_0x37dafd[_0x10e2('0x34')]||!_0x37dafd[_0x10e2('0x1f')]||!_0x37dafd[_0x10e2('0x20')]||!_0x37dafd['language']||!_0x37dafd[_0x10e2('0x22')]){throw new db[(_0x10e2('0x1c'))][(_0x10e2('0x1d'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x56db90['fileText']){throw new Error(_0x10e2('0x23'));}if(_0x37dafd[_0x10e2('0x1f')]===_0x4072f4['id']){return _0x4072f4;}else{return db[_0x10e2('0x24')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x6836d4){if(!_0x6836d4){throw new db[(_0x10e2('0x1c'))][(_0x10e2('0x1d'))](_0x10e2('0x35'));}if(!_0x6836d4[_0x10e2('0xc')]||!_0x6836d4[_0x10e2('0x26')]){throw new db[(_0x10e2('0x1c'))]['ValidationError'](_0x10e2('0x36'));}_0x411688=_0x6836d4;logger[_0x10e2('0xf')](util[_0x10e2('0x10')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x56db90['id']));return sentiment(_0x411688[_0x10e2('0xc')],_0x411688[_0x10e2('0x26')],_0x37dafd[_0x10e2('0x20')],_0x56db90[_0x10e2('0x13')],_0x37dafd[_0x10e2('0x21')]);})[_0x10e2('0xe')](function(_0x518ee5){logger[_0x10e2('0xf')](util[_0x10e2('0x10')](_0x10e2('0x37'),_0x56db90['id']));return _0x56db90[_0x10e2('0x28')]({'sentiment':_0x518ee5[_0x10e2('0x29')],'sPositive':_0x518ee5[_0x10e2('0x2a')][_0x10e2('0x2b')],'sNegative':_0x518ee5[_0x10e2('0x2a')][_0x10e2('0x2c')],'sMixed':_0x518ee5['SentimentScore']['Mixed'],'sNeutral':_0x518ee5[_0x10e2('0x2a')][_0x10e2('0x2e')],'transcribeStatus':'COMPLETED'});})['then'](function(){logger[_0x10e2('0xf')](util[_0x10e2('0x10')](_0x10e2('0x31'),_0x56db90['id']));_0x4e584f();});}})[_0x10e2('0x38')](function(_0x12a1f0){if(_0x12a1f0){if(!_0x12a1f0['name']||_0x12a1f0[_0x10e2('0x39')]!=='SequelizeValidationError'){logger[_0x10e2('0x3a')](util[_0x10e2('0x10')](_0x10e2('0x3b'),_0x56db90['id']),util['inspect'](_0x12a1f0,{'showHidden':![],'depth':null}));}}_0x4e584f();});});}function checkTranscribe(){var _0x53af61;var _0x2b94e6;var _0x34e2fe;return db[_0x10e2('0x3c')][_0x10e2('0x3d')]({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0x512d4d){if(!_0x512d4d||!_0x512d4d[_0x10e2('0x1b')]){throw new db[(_0x10e2('0x1c'))][(_0x10e2('0x1d'))]('No\x20transcribe\x20job\x20to\x20check');}_0x53af61=_0x512d4d;return db[_0x10e2('0x3e')][_0x10e2('0x25')]({'where':{'id':0x1}});})[_0x10e2('0xe')](function(_0x4bd9e6){if(!_0x4bd9e6){throw new db['Sequelize'][(_0x10e2('0x1d'))](_0x10e2('0x3f'));}_0x2b94e6=_0x4bd9e6;if(!_0x2b94e6['transcribe']||!_0x2b94e6['transcribeAccountId']||!_0x2b94e6[_0x10e2('0xd')]||!_0x2b94e6[_0x10e2('0x21')]||!_0x2b94e6['bucket']){throw new db['Sequelize'][(_0x10e2('0x1d'))]('Transcribe\x20not\x20configured');}return db[_0x10e2('0x24')]['findOne']({'where':{'id':_0x2b94e6[_0x10e2('0x40')]}});})['then'](function(_0xf21188){if(!_0xf21188){throw new db[(_0x10e2('0x1c'))]['ValidationError'](_0x10e2('0x35'));}if(!_0xf21188[_0x10e2('0xc')]||!_0xf21188[_0x10e2('0x26')]){throw new db[(_0x10e2('0x1c'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x34e2fe=_0xf21188;var _0xa9f14f=[];_0x53af61['forEach'](function(_0x3dba83){_0xa9f14f['push'](checkTranscribeJob(_0x3dba83,_0x2b94e6,_0x34e2fe));});return BPromise[_0x10e2('0x41')](_0xa9f14f);})[_0x10e2('0x38')](function(_0x3226bc){if(_0x3226bc){if(!_0x3226bc['name']||_0x3226bc[_0x10e2('0x39')]!==_0x10e2('0x42')){logger[_0x10e2('0x3a')](util[_0x10e2('0x43')](_0x3226bc,{'showHidden':![],'depth':null}));}}});}exports[_0x10e2('0x44')]=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 6fec1f4..f32d7c4 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 _0x6ac3=['findAll','lastMsgAt','subtract','then','length','map','info','join','WhatsappInteraction','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','ioredis','util','../../config/environment','../../mysqldb','schedule','redis','defaults','localhost','socket.io-emitter'];(function(_0x32e649,_0x228649){var _0x14d386=function(_0x3fb3ed){while(--_0x3fb3ed){_0x32e649['push'](_0x32e649['shift']());}};_0x14d386(++_0x228649);}(_0x6ac3,0xb1));var _0x36ac=function(_0x575b5a,_0x3af816){_0x575b5a=_0x575b5a-0x0;var _0x486649=_0x6ac3[_0x575b5a];return _0x486649;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require(_0x36ac('0x0'));var util=require(_0x36ac('0x1'));var config=require(_0x36ac('0x2'));var db=require(_0x36ac('0x3'))['db'];var logger=require('../logger')(_0x36ac('0x4'));config[_0x36ac('0x5')]=_[_0x36ac('0x6')](config[_0x36ac('0x5')],{'host':_0x36ac('0x7'),'port':0x18eb});var io=require(_0x36ac('0x8'))(new Redis(config[_0x36ac('0x5')]));function closeInteractions(){var _0x2f86a8=[];return db['WhatsappInteraction'][_0x36ac('0x9')]({'raw':!![],'attributes':['id',_0x36ac('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x36ac('0xb')](0x18,'hours')}}})[_0x36ac('0xc')](function(_0x20cde3){if(_0x20cde3&&_0x20cde3[_0x36ac('0xd')]){_0x2f86a8=_[_0x36ac('0xe')](_0x20cde3||[],'id');logger[_0x36ac('0xf')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x2f86a8[_0x36ac('0x10')]());return db[_0x36ac('0x11')][_0x36ac('0x12')]({'closeReason':_0x36ac('0x13'),'disposition':_0x36ac('0x14'),'closed':!![],'closedAt':moment()[_0x36ac('0x15')](_0x36ac('0x16'))},{'where':{'id':_0x2f86a8}});}})[_0x36ac('0xc')](function(){if(_0x2f86a8&&_0x2f86a8[_0x36ac('0xd')]){logger[_0x36ac('0xf')](_0x36ac('0x17'),_0x2f86a8['join']());for(var _0x2c951a=0x0;_0x2c951a<_0x2f86a8['length'];_0x2c951a++){io[_0x36ac('0x18')](_0x36ac('0x19'),{'id':_0x2f86a8[_0x2c951a],'closed':!![]});}}})[_0x36ac('0x1a')](function(_0x1e07b3){logger[_0x36ac('0x1b')](_0x36ac('0x1c'),_0x1e07b3?util[_0x36ac('0x1d')](_0x1e07b3,{'showHidden':![],'depth':null}):'');});}exports[_0x36ac('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xb1b4=['[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','length','emit','whatsappInteraction:update','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','lastMsgAt','subtract','then','map','info'];(function(_0x1b1e76,_0x31695b){var _0x3d743a=function(_0x4ae27b){while(--_0x4ae27b){_0x1b1e76['push'](_0x1b1e76['shift']());}};_0x3d743a(++_0x31695b);}(_0xb1b4,0x175));var _0x4b1b=function(_0x625492,_0x1cd944){_0x625492=_0x625492-0x0;var _0x296b94=_0xb1b4[_0x625492];return _0x296b94;};'use strict';var _=require(_0x4b1b('0x0'));var moment=require(_0x4b1b('0x1'));var Redis=require(_0x4b1b('0x2'));var util=require('util');var config=require(_0x4b1b('0x3'));var db=require(_0x4b1b('0x4'))['db'];var logger=require(_0x4b1b('0x5'))(_0x4b1b('0x6'));config[_0x4b1b('0x7')]=_[_0x4b1b('0x8')](config['redis'],{'host':_0x4b1b('0x9'),'port':0x18eb});var io=require(_0x4b1b('0xa'))(new Redis(config[_0x4b1b('0x7')]));function closeInteractions(){var _0x22018d=[];return db[_0x4b1b('0xb')]['findAll']({'raw':!![],'attributes':['id',_0x4b1b('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x4b1b('0xd')](0x18,'hours')}}})[_0x4b1b('0xe')](function(_0x37c350){if(_0x37c350&&_0x37c350['length']){_0x22018d=_[_0x4b1b('0xf')](_0x37c350||[],'id');logger[_0x4b1b('0x10')](_0x4b1b('0x11'),_0x22018d[_0x4b1b('0x12')]());return db[_0x4b1b('0xb')][_0x4b1b('0x13')]({'closeReason':_0x4b1b('0x14'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x4b1b('0x15')](_0x4b1b('0x16'))},{'where':{'id':_0x22018d}});}})['then'](function(){if(_0x22018d&&_0x22018d['length']){logger[_0x4b1b('0x10')](_0x4b1b('0x17'),_0x22018d[_0x4b1b('0x12')]());for(var _0x2fbb01=0x0;_0x2fbb01<_0x22018d[_0x4b1b('0x18')];_0x2fbb01++){io[_0x4b1b('0x19')](_0x4b1b('0x1a'),{'id':_0x22018d[_0x2fbb01],'closed':!![]});}}})['catch'](function(_0x19ab70){logger['error'](_0x4b1b('0x1b'),_0x19ab70?util[_0x4b1b('0x1c')](_0x19ab70,{'showHidden':![],'depth':null}):'');});}exports[_0x4b1b('0x1d')]=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 655167a..84d5fd9 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x14f5=['Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','log','CmHopper','then','finished\x20populating','hopper1','bulkCreate','contacts2','hopper2','catch','util','../mysqldb','push'];(function(_0x527fb4,_0xc15f2e){var _0x4d50cd=function(_0xb9ecaa){while(--_0xb9ecaa){_0x527fb4['push'](_0x527fb4['shift']());}};_0x4d50cd(++_0xc15f2e);}(_0x14f5,0x82));var _0x514f=function(_0x2f48d4,_0x29b0fd){_0x2f48d4=_0x2f48d4-0x0;var _0x515c6f=_0x14f5[_0x2f48d4];return _0x515c6f;};'use strict';var util=require(_0x514f('0x0'));var db=require(_0x514f('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x514f('0x2')]({'id':i,'firstName':_0x514f('0x3')+i,'lastName':_0x514f('0x4')+i,'phone':0xf879fb460+i,'email':_0x514f('0x5')+i+_0x514f('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x514f('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x514f('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x514f('0x2')]({'id':i,'firstName':_0x514f('0x3')+i,'lastName':_0x514f('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x514f('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x514f('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x514f('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x514f('0x7')](),'updatedAt':Date[_0x514f('0x7')]()});}db[_0x514f('0x8')][_0x514f('0x9')]({'where':{}})['then'](function(){return db[_0x514f('0x8')]['bulkCreate'](contacts);})['then'](function(){console[_0x514f('0xa')]('finished\x20populating','contacts1');return db[_0x514f('0xb')]['destroy']({'where':{}});})[_0x514f('0xc')](function(){return db[_0x514f('0xb')]['bulkCreate'](hopper);})['then'](function(){console[_0x514f('0xa')](_0x514f('0xd'),_0x514f('0xe'));return db[_0x514f('0x8')][_0x514f('0xf')](contacts2);})[_0x514f('0xc')](function(){console[_0x514f('0xa')](_0x514f('0xd'),_0x514f('0x10'));return db[_0x514f('0xb')][_0x514f('0xf')](hopper2);})[_0x514f('0xc')](function(){console[_0x514f('0xa')](_0x514f('0xd'),_0x514f('0x11'));})[_0x514f('0x12')](function(_0x49a90e){console[_0x514f('0xa')](_0x49a90e);}); \ No newline at end of file +var _0x28cc=['log','finished\x20populating','contacts1','CmHopper','util','../mysqldb','push','Innocenzo','innocenzo.biondo','now','Biondo','@xcally.com','CmContact','destroy','then','bulkCreate'];(function(_0x4c6a04,_0x1e4f56){var _0x582ffd=function(_0x35ba32){while(--_0x35ba32){_0x4c6a04['push'](_0x4c6a04['shift']());}};_0x582ffd(++_0x1e4f56);}(_0x28cc,0x124));var _0xc28c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x28cc[_0x2641f9];return _0x585741;};'use strict';var util=require(_0xc28c('0x0'));var db=require(_0xc28c('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xc28c('0x2')]({'id':i,'firstName':_0xc28c('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xc28c('0x4')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0xc28c('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xc28c('0x3')+i,'lastName':_0xc28c('0x6')+i,'phone':0xf879fb460+i,'email':_0xc28c('0x4')+i+_0xc28c('0x7')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0xc28c('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xc28c('0x5')](),'updatedAt':Date[_0xc28c('0x5')]()});}db[_0xc28c('0x8')][_0xc28c('0x9')]({'where':{}})[_0xc28c('0xa')](function(){return db[_0xc28c('0x8')][_0xc28c('0xb')](contacts);})[_0xc28c('0xa')](function(){console[_0xc28c('0xc')](_0xc28c('0xd'),_0xc28c('0xe'));return db[_0xc28c('0xf')][_0xc28c('0x9')]({'where':{}});})[_0xc28c('0xa')](function(){return db[_0xc28c('0xf')][_0xc28c('0xb')](hopper);})[_0xc28c('0xa')](function(){console[_0xc28c('0xc')](_0xc28c('0xd'),'hopper1');return db[_0xc28c('0x8')][_0xc28c('0xb')](contacts2);})[_0xc28c('0xa')](function(){console[_0xc28c('0xc')](_0xc28c('0xd'),'contacts2');return db['CmHopper'][_0xc28c('0xb')](hopper2);})[_0xc28c('0xa')](function(){console[_0xc28c('0xc')](_0xc28c('0xd'),'hopper2');})['catch'](function(_0x1083c5){console['log'](_0x1083c5);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 8088c3f..438015f 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0c32=['../mysqldb','push','format','%s%s','agent','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/private/motion.key','actpass','bulkCreate','then','log','add\x20user','catch'];(function(_0x3cb616,_0x166419){var _0x37f4cc=function(_0x1cc7f0){while(--_0x1cc7f0){_0x3cb616['push'](_0x3cb616['shift']());}};_0x37f4cc(++_0x166419);}(_0x0c32,0x143));var _0x20c3=function(_0x136bc8,_0x5e5bd4){_0x136bc8=_0x136bc8-0x0;var _0x33e395=_0x0c32[_0x136bc8];return _0x33e395;};'use strict';var util=require('util');var db=require(_0x20c3('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x20c3('0x1')]({'name':util[_0x20c3('0x2')](_0x20c3('0x3'),_0x20c3('0x4'),i),'fullname':util[_0x20c3('0x2')](_0x20c3('0x3'),_0x20c3('0x4'),i),'email':util[_0x20c3('0x2')]('%s%s@xcally.com','agent',i),'role':_0x20c3('0x4'),'password':_0x20c3('0x5'),'internal':0xfa0+i,'type':_0x20c3('0x6'),'transport':[_0x20c3('0x7'),'ws',_0x20c3('0x8')],'disallow':[_0x20c3('0x9')],'allow':[_0x20c3('0xa')],'defaultuser':util[_0x20c3('0x2')](_0x20c3('0x3'),_0x20c3('0x4'),i),'encryption':'yes','avpf':'yes','force_avp':_0x20c3('0xb'),'icesupport':_0x20c3('0xb'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x20c3('0xc'),'dtlssetup':_0x20c3('0xd'),'callerid':util['format']('\x22%s\x22\x20<%s>',util['format'](_0x20c3('0x3'),_0x20c3('0x4'),i),0xfa0+i)});}db['User'][_0x20c3('0xe')](users)[_0x20c3('0xf')](function(){console[_0x20c3('0x10')](_0x20c3('0x11'));})[_0x20c3('0x12')](function(_0x5cadb4){console[_0x20c3('0x10')](_0x5cadb4);}); \ No newline at end of file +var _0x2fe5=['format','%s%s@xcally.com','wss','all','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','%s%s','agent'];(function(_0x532685,_0x1a38c2){var _0x21426a=function(_0xa48343){while(--_0xa48343){_0x532685['push'](_0x532685['shift']());}};_0x21426a(++_0x1a38c2);}(_0x2fe5,0x68));var _0x52fe=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x2fe5[_0x19950b];return _0x3c6b41;};'use strict';var util=require(_0x52fe('0x0'));var db=require(_0x52fe('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util['format'](_0x52fe('0x2'),_0x52fe('0x3'),i),'fullname':util[_0x52fe('0x4')](_0x52fe('0x2'),'agent',i),'email':util['format'](_0x52fe('0x5'),_0x52fe('0x3'),i),'role':_0x52fe('0x3'),'password':'password','internal':0xfa0+i,'type':'friend','transport':['udp','ws',_0x52fe('0x6')],'disallow':[_0x52fe('0x7')],'allow':['ulaw'],'defaultuser':util['format'](_0x52fe('0x2'),_0x52fe('0x3'),i),'encryption':_0x52fe('0x8'),'avpf':_0x52fe('0x8'),'force_avp':_0x52fe('0x8'),'icesupport':_0x52fe('0x8'),'dtlsenable':_0x52fe('0x8'),'dtlsverify':'no','dtlscertfile':_0x52fe('0x9'),'dtlsprivatekey':_0x52fe('0xa'),'dtlssetup':'actpass','callerid':util[_0x52fe('0x4')](_0x52fe('0xb'),util[_0x52fe('0x4')](_0x52fe('0x2'),_0x52fe('0x3'),i),0xfa0+i)});}db[_0x52fe('0xc')][_0x52fe('0xd')](users)[_0x52fe('0xe')](function(){console[_0x52fe('0xf')](_0x52fe('0x10'));})[_0x52fe('0x11')](function(_0x214464){console[_0x52fe('0xf')](_0x214464);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 7089c35..7318915 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x87bc=['resourceId','User','where','role','Campaign','type','format','%s:queue:%s','length','query','find','handshake','ChatInteraction','ChatInteractions','MailInteraction','SmsInteraction','SmsInteractions','WhatsappInteraction','WhatsappInteractions','user:%s','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','user','userProfileId','ChatQueues','WhatsappQueue','Telephones','Trunks','agent','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','MailInteractions','user_has_mail_interactions:remove','FaxInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','join','default','connection','setMaxListeners','address','request','remotePort','connectedAt','log','SocketIO\x20','disconnect','DISCONNECTED','CONNECTED','lodash','util','../mysqldb','Agents','name','telephone','ivr','UserProfileSection','findOne','then','autoAssociation','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','IvrCampaigns','UserProfileResource','map'];(function(_0x25662e,_0x4cec68){var _0x59b7bc=function(_0xafb159){while(--_0xafb159){_0x25662e['push'](_0x25662e['shift']());}};_0x59b7bc(++_0x4cec68);}(_0x87bc,0x189));var _0xc87b=function(_0x29613d,_0x3cf648){_0x29613d=_0x29613d-0x0;var _0xc3a20c=_0x87bc[_0x29613d];return _0xc3a20c;};'use strict';var _=require(_0xc87b('0x0'));var util=require(_0xc87b('0x1'));var BPromise=require('bluebird');var db=require(_0xc87b('0x2'))['db'];var config=require('./environment');var queryQueues={'attributes':['id','name'],'include':[{'as':_0xc87b('0x3'),'model':db['User'],'attributes':['id',_0xc87b('0x4'),'role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0xc87b('0x5')}};var queryTrunks={'raw':!![],'attributes':['id',_0xc87b('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0xc87b('0x4')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id','name','type'],'where':{'type':_0xc87b('0x6')}};function getAssociatedResources(_0x169bbb,_0x1144cc,_0x19b571){return db[_0xc87b('0x7')][_0xc87b('0x8')]({'where':{'name':_0x169bbb,'userProfileId':_0x1144cc},'raw':!![]})[_0xc87b('0x9')](function(_0x1d834a){if(_0x1d834a){if(_0x1d834a[_0xc87b('0xa')]){switch(_0x169bbb){case'VoiceQueues':case'ChatQueues':case _0xc87b('0xb'):case'SmsQueues':case _0xc87b('0xc'):case _0xc87b('0xd'):case _0xc87b('0xe'):return db[_0x19b571][_0xc87b('0xf')](queryQueues);case'Telephones':return db[_0x19b571][_0xc87b('0xf')](queryTelephones);case'Trunks':return db[_0x19b571][_0xc87b('0xf')](queryTrunks);case _0xc87b('0x10'):return db[_0x19b571]['findAll'](queryCampaigns);}}else{return db[_0xc87b('0x11')][_0xc87b('0xf')]({'attributes':['resourceId'],'where':{'sectionId':_0x1d834a['id']},'raw':!![]})[_0xc87b('0x9')](function(_0x21f1d1){if(_0x21f1d1){var _0x34195e={'where':{'id':_[_0xc87b('0x12')](_0x21f1d1,_0xc87b('0x13'))},'raw':!![]};switch(_0x19b571){case _0xc87b('0x14'):_0x34195e[_0xc87b('0x15')][_0xc87b('0x16')]='telephone';break;case _0xc87b('0x17'):_0x34195e['where'][_0xc87b('0x18')]=_0xc87b('0x6');break;}return db[_0x19b571]['findAll'](_0x34195e);}else{return[];}});}}else{return[];}})[_0xc87b('0x9')](function(_0x372665){return _0x372665;});}function joinOrLeaveQueues(_0x4f56a0,_0x35b58f,_0x4cceeb,_0x36c8c4){_0x4f56a0[_0x35b58f](util[_0xc87b('0x19')](_0xc87b('0x1a'),_0x4cceeb,_0x36c8c4[_0xc87b('0x4')]));if(_0x36c8c4[_0xc87b('0x3')]){for(var _0x211b3c=0x0;_0x211b3c<_0x36c8c4[_0xc87b('0x3')][_0xc87b('0x1b')];_0x211b3c+=0x1){_0x4f56a0[_0x35b58f](util[_0xc87b('0x19')]('user:%s',_0x36c8c4[_0xc87b('0x3')][_0x211b3c]['name']));}}}function joinOrLeave(_0x3c6d50,_0x42d099,_0x147731){var _0x4bff29;if(_0x3c6d50['handshake'][_0xc87b('0x1c')]['id']){db[_0xc87b('0x14')][_0xc87b('0x1d')]({'attributes':['id',_0xc87b('0x4'),_0xc87b('0x16'),'userProfileId'],'where':{'id':_0x3c6d50[_0xc87b('0x1e')][_0xc87b('0x1c')]['id']},'include':[{'model':db[_0xc87b('0x1f')],'as':_0xc87b('0x20'),'attributes':['id'],'raw':!![]},{'model':db[_0xc87b('0x21')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xc87b('0x22')],'as':_0xc87b('0x23'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xc87b('0x24')],'as':_0xc87b('0x25'),'attributes':['id'],'raw':!![]}]})[_0xc87b('0x9')](function(_0x4e02d7){if(_0x4e02d7){_0x4bff29=_0x4e02d7;_0x3c6d50[_0x42d099](util[_0xc87b('0x19')](_0xc87b('0x26'),_0x4e02d7[_0xc87b('0x4')]));var _0x4b1ac6=[];switch(_0x4e02d7[_0xc87b('0x16')]){case _0xc87b('0x27'):_0x3c6d50[_0x42d099](_0xc87b('0x28'));_0x3c6d50[_0x42d099](_0xc87b('0x29'));if(queryQueues[_0xc87b('0x2a')](_0xc87b('0x2b'))){delete queryQueues[_0xc87b('0x2b')];}_0x4b1ac6[_0xc87b('0x2c')](db[_0xc87b('0x2d')][_0xc87b('0xf')](queryQueues));_0x4b1ac6[_0xc87b('0x2c')](db[_0xc87b('0x2e')]['findAll'](queryQueues));_0x4b1ac6[_0xc87b('0x2c')](db[_0xc87b('0x2f')]['findAll'](queryQueues));_0x4b1ac6[_0xc87b('0x2c')](db[_0xc87b('0x30')][_0xc87b('0xf')](queryQueues));_0x4b1ac6['push'](db[_0xc87b('0x31')][_0xc87b('0xf')](queryQueues));_0x4b1ac6[_0xc87b('0x2c')](db[_0xc87b('0x32')][_0xc87b('0xf')](queryQueues));_0x4b1ac6['push'](db['WhatsappQueue'][_0xc87b('0xf')](queryQueues));_0x4b1ac6['push'](db[_0xc87b('0x14')][_0xc87b('0xf')](queryTelephones));_0x4b1ac6[_0xc87b('0x2c')](db[_0xc87b('0x33')]['findAll'](queryTrunks));_0x4b1ac6[_0xc87b('0x2c')](db[_0xc87b('0x17')][_0xc87b('0xf')](queryCampaigns));_0x4b1ac6[_0xc87b('0x2c')](db[_0xc87b('0x14')][_0xc87b('0xf')](queryAgents));break;case _0xc87b('0x34'):_0x3c6d50[_0x42d099]('voice:inbound');_0x3c6d50[_0x42d099](_0xc87b('0x29'));_0x4b1ac6['push'](getAssociatedResources('VoiceQueues',_0x4e02d7[_0xc87b('0x35')],_0xc87b('0x2d')));_0x4b1ac6[_0xc87b('0x2c')](getAssociatedResources(_0xc87b('0x36'),_0x4e02d7[_0xc87b('0x35')],_0xc87b('0x2e')));_0x4b1ac6['push'](getAssociatedResources(_0xc87b('0xb'),_0x4e02d7[_0xc87b('0x35')],_0xc87b('0x2f')));_0x4b1ac6[_0xc87b('0x2c')](getAssociatedResources('SmsQueues',_0x4e02d7[_0xc87b('0x35')],_0xc87b('0x30')));_0x4b1ac6[_0xc87b('0x2c')](getAssociatedResources(_0xc87b('0xc'),_0x4e02d7['userProfileId'],'MailQueue'));_0x4b1ac6['push'](getAssociatedResources(_0xc87b('0xd'),_0x4e02d7[_0xc87b('0x35')],'OpenchannelQueue'));_0x4b1ac6[_0xc87b('0x2c')](getAssociatedResources(_0xc87b('0xe'),_0x4e02d7[_0xc87b('0x35')],_0xc87b('0x37')));_0x4b1ac6[_0xc87b('0x2c')](getAssociatedResources(_0xc87b('0x38'),_0x4e02d7[_0xc87b('0x35')],_0xc87b('0x14')));_0x4b1ac6[_0xc87b('0x2c')](getAssociatedResources(_0xc87b('0x39'),_0x4e02d7[_0xc87b('0x35')],_0xc87b('0x33')));_0x4b1ac6[_0xc87b('0x2c')](getAssociatedResources(_0xc87b('0x10'),_0x4e02d7[_0xc87b('0x35')],'Campaign'));_0x4b1ac6[_0xc87b('0x2c')](db[_0xc87b('0x14')][_0xc87b('0xf')](queryAgents));break;case _0xc87b('0x3a'):_0x3c6d50[_0x42d099](_0xc87b('0x28'));_0x3c6d50[_0x42d099]('voice:outbound');_0x4b1ac6['push'](_0x4e02d7[_0xc87b('0x3b')]({'attributes':['id',_0xc87b('0x4')]}));_0x4b1ac6['push'](_0x4e02d7[_0xc87b('0x3c')]({'attributes':['id',_0xc87b('0x4')]}));_0x4b1ac6[_0xc87b('0x2c')](_0x4e02d7[_0xc87b('0x3d')]({'attributes':['id',_0xc87b('0x4')]}));_0x4b1ac6[_0xc87b('0x2c')](_0x4e02d7['getSmsQueues']({'attributes':['id','name']}));_0x4b1ac6[_0xc87b('0x2c')](_0x4e02d7[_0xc87b('0x3e')]({'attributes':['id',_0xc87b('0x4')]}));_0x4b1ac6[_0xc87b('0x2c')](_0x4e02d7[_0xc87b('0x3f')]({'attributes':['id',_0xc87b('0x4')]}));_0x4b1ac6[_0xc87b('0x2c')](_0x4e02d7[_0xc87b('0x40')]({'attributes':['id',_0xc87b('0x4')]}));break;}return BPromise[_0xc87b('0x41')](_0x4b1ac6);}})[_0xc87b('0x9')](function(_0x2fe333){if(_0x2fe333&&_0x2fe333[_0xc87b('0x1b')]){for(var _0x5ee6ea=0x0;_0x5ee6ea<_0x2fe333[_0xc87b('0x1b')];_0x5ee6ea+=0x1){for(var _0x3b6d31=0x0;_0x3b6d31<_0x2fe333[_0x5ee6ea]['length'];_0x3b6d31+=0x1){switch(_0x5ee6ea){case 0x0:joinOrLeaveQueues(_0x3c6d50,_0x42d099,_0xc87b('0x42'),_0x2fe333[_0x5ee6ea][_0x3b6d31]);break;case 0x1:joinOrLeaveQueues(_0x3c6d50,_0x42d099,_0xc87b('0x43'),_0x2fe333[_0x5ee6ea][_0x3b6d31]);break;case 0x2:joinOrLeaveQueues(_0x3c6d50,_0x42d099,_0xc87b('0x44'),_0x2fe333[_0x5ee6ea][_0x3b6d31]);break;case 0x3:joinOrLeaveQueues(_0x3c6d50,_0x42d099,_0xc87b('0x45'),_0x2fe333[_0x5ee6ea][_0x3b6d31]);break;case 0x4:joinOrLeaveQueues(_0x3c6d50,_0x42d099,_0xc87b('0x46'),_0x2fe333[_0x5ee6ea][_0x3b6d31]);break;case 0x5:joinOrLeaveQueues(_0x3c6d50,_0x42d099,_0xc87b('0x47'),_0x2fe333[_0x5ee6ea][_0x3b6d31]);break;case 0x6:joinOrLeaveQueues(_0x3c6d50,_0x42d099,_0xc87b('0x48'),_0x2fe333[_0x5ee6ea][_0x3b6d31]);break;case 0x7:if(_0x4bff29['role']!=='agent')_0x3c6d50[_0x42d099](util[_0xc87b('0x19')]('telephone:%s',_0x2fe333[_0x5ee6ea][_0x3b6d31][_0xc87b('0x4')]));break;case 0x8:if(_0x4bff29[_0xc87b('0x16')]!==_0xc87b('0x3a'))_0x3c6d50[_0x42d099](util['format'](_0xc87b('0x49'),_0x2fe333[_0x5ee6ea][_0x3b6d31][_0xc87b('0x4')]));break;case 0x9:if(_0x4bff29[_0xc87b('0x16')]!==_0xc87b('0x3a'))_0x3c6d50[_0x42d099](util[_0xc87b('0x19')](_0xc87b('0x4a'),_0x2fe333[_0x5ee6ea][_0x3b6d31][_0xc87b('0x18')],_0x2fe333[_0x5ee6ea][_0x3b6d31]['name']));break;case 0xa:_0x3c6d50[_0x42d099](util['format'](_0xc87b('0x26'),_0x2fe333[_0x5ee6ea][_0x3b6d31][_0xc87b('0x4')]));break;}}}}})[_0xc87b('0x9')](function(){if(_0x42d099===_0xc87b('0x4b')){var _0xe73d52=_['map'](_0x4bff29['ChatInteractions'],'id');return _0x4bff29[_0xc87b('0x4c')](_0xe73d52)[_0xc87b('0x9')](function(){for(var _0x4ac1ca=0x0;_0x4ac1ca<_0xe73d52[_0xc87b('0x1b')];_0x4ac1ca+=0x1){_0x147731[_0xc87b('0x4d')](_0xc87b('0x4e'),{'ChatInteractionId':Number(_0xe73d52[_0x4ac1ca]),'UserId':Number(_0x4bff29['id'])});}});}})[_0xc87b('0x9')](function(){if(_0x42d099==='leave'){var _0x1a38e5=_[_0xc87b('0x12')](_0x4bff29[_0xc87b('0x4f')],'id');return _0x4bff29['removeMailInteractions'](_0x1a38e5)[_0xc87b('0x9')](function(){for(var _0x1d5a58=0x0;_0x1d5a58<_0x1a38e5['length'];_0x1d5a58+=0x1){_0x147731[_0xc87b('0x4d')](_0xc87b('0x50'),{'MailInteractionId':Number(_0x1a38e5[_0x1d5a58]),'UserId':Number(_0x4bff29['id'])});}});}})[_0xc87b('0x9')](function(){if(_0x42d099===_0xc87b('0x4b')){var _0x2fbaf0=_[_0xc87b('0x12')](_0x4bff29[_0xc87b('0x51')],'id');return _0x4bff29['removeFaxInteractions'](_0x2fbaf0)['then'](function(){for(var _0x27f74d=0x0;_0x27f74d<_0x2fbaf0[_0xc87b('0x1b')];_0x27f74d+=0x1){_0x147731[_0xc87b('0x4d')](_0xc87b('0x52'),{'FaxInteractionId':Number(_0x2fbaf0[_0x27f74d]),'UserId':Number(_0x4bff29['id'])});}});}})[_0xc87b('0x9')](function(){if(_0x42d099===_0xc87b('0x4b')){var _0x57dbec=_['map'](_0x4bff29[_0xc87b('0x23')],'id');return _0x4bff29['removeSmsInteractions'](_0x57dbec)['then'](function(){for(var _0x2ef012=0x0;_0x2ef012<_0x57dbec[_0xc87b('0x1b')];_0x2ef012+=0x1){_0x147731[_0xc87b('0x4d')](_0xc87b('0x53'),{'SmsInteractionId':Number(_0x57dbec[_0x2ef012]),'UserId':Number(_0x4bff29['id'])});}});}})[_0xc87b('0x9')](function(){if(_0x42d099===_0xc87b('0x4b')){var _0x3f1a63=_['map'](_0x4bff29[_0xc87b('0x54')],'id');return _0x4bff29[_0xc87b('0x55')](_0x3f1a63)[_0xc87b('0x9')](function(){for(var _0x1594e8=0x0;_0x1594e8<_0x3f1a63[_0xc87b('0x1b')];_0x1594e8+=0x1){_0x147731[_0xc87b('0x4d')](_0xc87b('0x56'),{'OpenchannelInteractionId':Number(_0x3f1a63[_0x1594e8]),'UserId':Number(_0x4bff29['id'])});}});}})[_0xc87b('0x9')](function(){if(_0x42d099===_0xc87b('0x4b')){var _0x5f4553=_[_0xc87b('0x12')](_0x4bff29[_0xc87b('0x25')],'id');return _0x4bff29[_0xc87b('0x57')](_0x5f4553)[_0xc87b('0x9')](function(){for(var _0x5337c9=0x0;_0x5337c9<_0x5f4553[_0xc87b('0x1b')];_0x5337c9+=0x1){_0x147731['emit'](_0xc87b('0x58'),{'WhatsappInteractionId':Number(_0x5f4553[_0x5337c9]),'UserId':Number(_0x4bff29['id'])});}});}})[_0xc87b('0x59')](function(_0xaf8206){_0x3c6d50['log'](_0xaf8206);});}}function onDisconnect(_0x3a7e5b,_0x1900c9){joinOrLeave(_0x3a7e5b,_0xc87b('0x4b'),_0x1900c9);}function onConnect(_0x438abe){joinOrLeave(_0x438abe,_0xc87b('0x5a'));}exports[_0xc87b('0x5b')]=function(_0x342f05){_0x342f05['on'](_0xc87b('0x5c'),function(_0x1c0807){_0x1c0807[_0xc87b('0x5d')](0x0);_0x1c0807[_0xc87b('0x5e')]=_0x1c0807[_0xc87b('0x5f')][_0xc87b('0x5c')]['remoteAddress']+':'+_0x1c0807['request'][_0xc87b('0x5c')][_0xc87b('0x60')];_0x1c0807[_0xc87b('0x61')]=new Date();_0x1c0807[_0xc87b('0x62')]=function(_0x58a215){console[_0xc87b('0x62')](_0xc87b('0x63')+_0x1c0807['nsp'][_0xc87b('0x4')]+'['+_0x1c0807[_0xc87b('0x5e')]+']',_0x58a215);};_0x1c0807['on'](_0xc87b('0x64'),function(){onDisconnect(_0x1c0807,_0x342f05);_0x1c0807[_0xc87b('0x62')](_0xc87b('0x65'));});onConnect(_0x1c0807);_0x1c0807[_0xc87b('0x62')](_0xc87b('0x66'));});}; \ No newline at end of file +var _0x4b20=['map','where','type','format','%s:queue:%s','length','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','SmsQueue','WhatsappQueue','user','OpenchannelQueues','Trunk','IvrCampaigns','Campaign','getVoiceQueues','getChatQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','fax','mail','openchannel','whatsapp','telephone:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','address','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','telephone','ivr','UserProfileSection','then','autoAssociation','VoiceQueues','ChatQueues','SmsQueues','MailQueues','WhatsappQueues','Telephones','findAll','Trunks','UserProfileResource','resourceId'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x4b20,0x116));var _0x04b2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b20[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x04b2('0x0'));var util=require(_0x04b2('0x1'));var BPromise=require(_0x04b2('0x2'));var db=require(_0x04b2('0x3'))['db'];var config=require(_0x04b2('0x4'));var queryQueues={'attributes':['id',_0x04b2('0x5')],'include':[{'as':_0x04b2('0x6'),'model':db[_0x04b2('0x7')],'attributes':['id',_0x04b2('0x5'),_0x04b2('0x8')],'raw':!![],'where':{'role':_0x04b2('0x9')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x04b2('0xa')}};var queryTrunks={'raw':!![],'attributes':['id',_0x04b2('0x5')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x04b2('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x04b2('0x5'),'type'],'where':{'type':_0x04b2('0xb')}};function getAssociatedResources(_0x53212e,_0x291e02,_0x48387f){return db[_0x04b2('0xc')]['findOne']({'where':{'name':_0x53212e,'userProfileId':_0x291e02},'raw':!![]})[_0x04b2('0xd')](function(_0x28a212){if(_0x28a212){if(_0x28a212[_0x04b2('0xe')]){switch(_0x53212e){case _0x04b2('0xf'):case _0x04b2('0x10'):case'FaxQueues':case _0x04b2('0x11'):case _0x04b2('0x12'):case'OpenchannelQueues':case _0x04b2('0x13'):return db[_0x48387f]['findAll'](queryQueues);case _0x04b2('0x14'):return db[_0x48387f][_0x04b2('0x15')](queryTelephones);case _0x04b2('0x16'):return db[_0x48387f][_0x04b2('0x15')](queryTrunks);case'IvrCampaigns':return db[_0x48387f][_0x04b2('0x15')](queryCampaigns);}}else{return db[_0x04b2('0x17')]['findAll']({'attributes':[_0x04b2('0x18')],'where':{'sectionId':_0x28a212['id']},'raw':!![]})[_0x04b2('0xd')](function(_0x181c2d){if(_0x181c2d){var _0x49c773={'where':{'id':_[_0x04b2('0x19')](_0x181c2d,_0x04b2('0x18'))},'raw':!![]};switch(_0x48387f){case _0x04b2('0x7'):_0x49c773[_0x04b2('0x1a')][_0x04b2('0x8')]=_0x04b2('0xa');break;case'Campaign':_0x49c773['where'][_0x04b2('0x1b')]=_0x04b2('0xb');break;}return db[_0x48387f][_0x04b2('0x15')](_0x49c773);}else{return[];}});}}else{return[];}})[_0x04b2('0xd')](function(_0x24e5ff){return _0x24e5ff;});}function joinOrLeaveQueues(_0x6dc675,_0x1f6d1c,_0x11210c,_0x311b94){_0x6dc675[_0x1f6d1c](util[_0x04b2('0x1c')](_0x04b2('0x1d'),_0x11210c,_0x311b94[_0x04b2('0x5')]));if(_0x311b94['Agents']){for(var _0x3cbdd8=0x0;_0x3cbdd8<_0x311b94[_0x04b2('0x6')][_0x04b2('0x1e')];_0x3cbdd8+=0x1){_0x6dc675[_0x1f6d1c](util[_0x04b2('0x1c')](_0x04b2('0x1f'),_0x311b94[_0x04b2('0x6')][_0x3cbdd8][_0x04b2('0x5')]));}}}function joinOrLeave(_0x5599ec,_0x17a70a,_0x4eb4e3){var _0x1432b8;if(_0x5599ec[_0x04b2('0x20')][_0x04b2('0x21')]['id']){db['User'][_0x04b2('0x22')]({'attributes':['id',_0x04b2('0x5'),'role',_0x04b2('0x23')],'where':{'id':_0x5599ec[_0x04b2('0x20')][_0x04b2('0x21')]['id']},'include':[{'model':db[_0x04b2('0x24')],'as':_0x04b2('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x04b2('0x26')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x04b2('0x27')],'as':_0x04b2('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x04b2('0x29')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x04b2('0x2a')],'as':_0x04b2('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0x04b2('0x2c')],'as':_0x04b2('0x2d'),'attributes':['id'],'raw':!![]}]})[_0x04b2('0xd')](function(_0x1f07c4){if(_0x1f07c4){_0x1432b8=_0x1f07c4;_0x5599ec[_0x17a70a](util['format']('user:%s',_0x1f07c4['name']));var _0x5228bf=[];switch(_0x1f07c4[_0x04b2('0x8')]){case _0x04b2('0x2e'):_0x5599ec[_0x17a70a](_0x04b2('0x2f'));_0x5599ec[_0x17a70a](_0x04b2('0x30'));if(queryQueues[_0x04b2('0x31')]('include')){delete queryQueues[_0x04b2('0x32')];}_0x5228bf[_0x04b2('0x33')](db[_0x04b2('0x34')]['findAll'](queryQueues));_0x5228bf['push'](db['ChatQueue'][_0x04b2('0x15')](queryQueues));_0x5228bf[_0x04b2('0x33')](db['FaxQueue']['findAll'](queryQueues));_0x5228bf[_0x04b2('0x33')](db[_0x04b2('0x35')][_0x04b2('0x15')](queryQueues));_0x5228bf[_0x04b2('0x33')](db['MailQueue'][_0x04b2('0x15')](queryQueues));_0x5228bf['push'](db['OpenchannelQueue'][_0x04b2('0x15')](queryQueues));_0x5228bf['push'](db[_0x04b2('0x36')][_0x04b2('0x15')](queryQueues));_0x5228bf[_0x04b2('0x33')](db['User'][_0x04b2('0x15')](queryTelephones));_0x5228bf['push'](db['Trunk']['findAll'](queryTrunks));_0x5228bf[_0x04b2('0x33')](db['Campaign']['findAll'](queryCampaigns));_0x5228bf[_0x04b2('0x33')](db[_0x04b2('0x7')]['findAll'](queryAgents));break;case _0x04b2('0x37'):_0x5599ec[_0x17a70a](_0x04b2('0x2f'));_0x5599ec[_0x17a70a]('voice:outbound');_0x5228bf[_0x04b2('0x33')](getAssociatedResources(_0x04b2('0xf'),_0x1f07c4[_0x04b2('0x23')],_0x04b2('0x34')));_0x5228bf[_0x04b2('0x33')](getAssociatedResources(_0x04b2('0x10'),_0x1f07c4['userProfileId'],'ChatQueue'));_0x5228bf[_0x04b2('0x33')](getAssociatedResources('FaxQueues',_0x1f07c4[_0x04b2('0x23')],'FaxQueue'));_0x5228bf['push'](getAssociatedResources(_0x04b2('0x11'),_0x1f07c4[_0x04b2('0x23')],_0x04b2('0x35')));_0x5228bf[_0x04b2('0x33')](getAssociatedResources(_0x04b2('0x12'),_0x1f07c4[_0x04b2('0x23')],'MailQueue'));_0x5228bf[_0x04b2('0x33')](getAssociatedResources(_0x04b2('0x38'),_0x1f07c4[_0x04b2('0x23')],'OpenchannelQueue'));_0x5228bf[_0x04b2('0x33')](getAssociatedResources('WhatsappQueues',_0x1f07c4[_0x04b2('0x23')],_0x04b2('0x36')));_0x5228bf[_0x04b2('0x33')](getAssociatedResources(_0x04b2('0x14'),_0x1f07c4[_0x04b2('0x23')],_0x04b2('0x7')));_0x5228bf[_0x04b2('0x33')](getAssociatedResources(_0x04b2('0x16'),_0x1f07c4['userProfileId'],_0x04b2('0x39')));_0x5228bf['push'](getAssociatedResources(_0x04b2('0x3a'),_0x1f07c4[_0x04b2('0x23')],_0x04b2('0x3b')));_0x5228bf[_0x04b2('0x33')](db[_0x04b2('0x7')][_0x04b2('0x15')](queryAgents));break;case'agent':_0x5599ec[_0x17a70a](_0x04b2('0x2f'));_0x5599ec[_0x17a70a](_0x04b2('0x30'));_0x5228bf[_0x04b2('0x33')](_0x1f07c4[_0x04b2('0x3c')]({'attributes':['id',_0x04b2('0x5')]}));_0x5228bf[_0x04b2('0x33')](_0x1f07c4[_0x04b2('0x3d')]({'attributes':['id',_0x04b2('0x5')]}));_0x5228bf[_0x04b2('0x33')](_0x1f07c4['getFaxQueues']({'attributes':['id',_0x04b2('0x5')]}));_0x5228bf[_0x04b2('0x33')](_0x1f07c4[_0x04b2('0x3e')]({'attributes':['id',_0x04b2('0x5')]}));_0x5228bf[_0x04b2('0x33')](_0x1f07c4[_0x04b2('0x3f')]({'attributes':['id',_0x04b2('0x5')]}));_0x5228bf[_0x04b2('0x33')](_0x1f07c4[_0x04b2('0x40')]({'attributes':['id',_0x04b2('0x5')]}));_0x5228bf[_0x04b2('0x33')](_0x1f07c4[_0x04b2('0x41')]({'attributes':['id',_0x04b2('0x5')]}));break;}return BPromise[_0x04b2('0x42')](_0x5228bf);}})[_0x04b2('0xd')](function(_0x9a90f6){if(_0x9a90f6&&_0x9a90f6[_0x04b2('0x1e')]){for(var _0x4016f5=0x0;_0x4016f5<_0x9a90f6[_0x04b2('0x1e')];_0x4016f5+=0x1){for(var _0x3b5d26=0x0;_0x3b5d26<_0x9a90f6[_0x4016f5]['length'];_0x3b5d26+=0x1){switch(_0x4016f5){case 0x0:joinOrLeaveQueues(_0x5599ec,_0x17a70a,_0x04b2('0x43'),_0x9a90f6[_0x4016f5][_0x3b5d26]);break;case 0x1:joinOrLeaveQueues(_0x5599ec,_0x17a70a,'chat',_0x9a90f6[_0x4016f5][_0x3b5d26]);break;case 0x2:joinOrLeaveQueues(_0x5599ec,_0x17a70a,_0x04b2('0x44'),_0x9a90f6[_0x4016f5][_0x3b5d26]);break;case 0x3:joinOrLeaveQueues(_0x5599ec,_0x17a70a,'sms',_0x9a90f6[_0x4016f5][_0x3b5d26]);break;case 0x4:joinOrLeaveQueues(_0x5599ec,_0x17a70a,_0x04b2('0x45'),_0x9a90f6[_0x4016f5][_0x3b5d26]);break;case 0x5:joinOrLeaveQueues(_0x5599ec,_0x17a70a,_0x04b2('0x46'),_0x9a90f6[_0x4016f5][_0x3b5d26]);break;case 0x6:joinOrLeaveQueues(_0x5599ec,_0x17a70a,_0x04b2('0x47'),_0x9a90f6[_0x4016f5][_0x3b5d26]);break;case 0x7:if(_0x1432b8['role']!==_0x04b2('0x9'))_0x5599ec[_0x17a70a](util[_0x04b2('0x1c')](_0x04b2('0x48'),_0x9a90f6[_0x4016f5][_0x3b5d26]['name']));break;case 0x8:if(_0x1432b8[_0x04b2('0x8')]!=='agent')_0x5599ec[_0x17a70a](util['format']('trunk:%s',_0x9a90f6[_0x4016f5][_0x3b5d26][_0x04b2('0x5')]));break;case 0x9:if(_0x1432b8[_0x04b2('0x8')]!=='agent')_0x5599ec[_0x17a70a](util['format'](_0x04b2('0x49'),_0x9a90f6[_0x4016f5][_0x3b5d26][_0x04b2('0x1b')],_0x9a90f6[_0x4016f5][_0x3b5d26]['name']));break;case 0xa:_0x5599ec[_0x17a70a](util['format'](_0x04b2('0x1f'),_0x9a90f6[_0x4016f5][_0x3b5d26][_0x04b2('0x5')]));break;}}}}})[_0x04b2('0xd')](function(){if(_0x17a70a===_0x04b2('0x4a')){var _0xe053a0=_[_0x04b2('0x19')](_0x1432b8[_0x04b2('0x25')],'id');return _0x1432b8[_0x04b2('0x4b')](_0xe053a0)['then'](function(){for(var _0x6a8903=0x0;_0x6a8903<_0xe053a0[_0x04b2('0x1e')];_0x6a8903+=0x1){_0x4eb4e3[_0x04b2('0x4c')](_0x04b2('0x4d'),{'ChatInteractionId':Number(_0xe053a0[_0x6a8903]),'UserId':Number(_0x1432b8['id'])});}});}})['then'](function(){if(_0x17a70a===_0x04b2('0x4a')){var _0x2412d5=_['map'](_0x1432b8['MailInteractions'],'id');return _0x1432b8['removeMailInteractions'](_0x2412d5)[_0x04b2('0xd')](function(){for(var _0x1e347b=0x0;_0x1e347b<_0x2412d5[_0x04b2('0x1e')];_0x1e347b+=0x1){_0x4eb4e3[_0x04b2('0x4c')](_0x04b2('0x4e'),{'MailInteractionId':Number(_0x2412d5[_0x1e347b]),'UserId':Number(_0x1432b8['id'])});}});}})[_0x04b2('0xd')](function(){if(_0x17a70a===_0x04b2('0x4a')){var _0x2655ad=_[_0x04b2('0x19')](_0x1432b8[_0x04b2('0x28')],'id');return _0x1432b8[_0x04b2('0x4f')](_0x2655ad)[_0x04b2('0xd')](function(){for(var _0x2b1bf1=0x0;_0x2b1bf1<_0x2655ad['length'];_0x2b1bf1+=0x1){_0x4eb4e3['emit'](_0x04b2('0x50'),{'FaxInteractionId':Number(_0x2655ad[_0x2b1bf1]),'UserId':Number(_0x1432b8['id'])});}});}})[_0x04b2('0xd')](function(){if(_0x17a70a===_0x04b2('0x4a')){var _0xd55a40=_[_0x04b2('0x19')](_0x1432b8[_0x04b2('0x51')],'id');return _0x1432b8[_0x04b2('0x52')](_0xd55a40)[_0x04b2('0xd')](function(){for(var _0x22caf3=0x0;_0x22caf3<_0xd55a40['length'];_0x22caf3+=0x1){_0x4eb4e3[_0x04b2('0x4c')](_0x04b2('0x53'),{'SmsInteractionId':Number(_0xd55a40[_0x22caf3]),'UserId':Number(_0x1432b8['id'])});}});}})[_0x04b2('0xd')](function(){if(_0x17a70a==='leave'){var _0x7eefb=_['map'](_0x1432b8['OpenchannelInteractions'],'id');return _0x1432b8[_0x04b2('0x54')](_0x7eefb)[_0x04b2('0xd')](function(){for(var _0x147c01=0x0;_0x147c01<_0x7eefb['length'];_0x147c01+=0x1){_0x4eb4e3[_0x04b2('0x4c')](_0x04b2('0x55'),{'OpenchannelInteractionId':Number(_0x7eefb[_0x147c01]),'UserId':Number(_0x1432b8['id'])});}});}})[_0x04b2('0xd')](function(){if(_0x17a70a===_0x04b2('0x4a')){var _0x4dd7cf=_['map'](_0x1432b8[_0x04b2('0x2d')],'id');return _0x1432b8[_0x04b2('0x56')](_0x4dd7cf)[_0x04b2('0xd')](function(){for(var _0x3d110d=0x0;_0x3d110d<_0x4dd7cf[_0x04b2('0x1e')];_0x3d110d+=0x1){_0x4eb4e3[_0x04b2('0x4c')](_0x04b2('0x57'),{'WhatsappInteractionId':Number(_0x4dd7cf[_0x3d110d]),'UserId':Number(_0x1432b8['id'])});}});}})[_0x04b2('0x58')](function(_0x410a9d){_0x5599ec[_0x04b2('0x59')](_0x410a9d);});}}function onDisconnect(_0x16f422,_0x233fa1){joinOrLeave(_0x16f422,_0x04b2('0x4a'),_0x233fa1);}function onConnect(_0x455ad4){joinOrLeave(_0x455ad4,_0x04b2('0x5a'));}exports[_0x04b2('0x5b')]=function(_0x476065){_0x476065['on'](_0x04b2('0x5c'),function(_0x15f479){_0x15f479['setMaxListeners'](0x0);_0x15f479[_0x04b2('0x5d')]=_0x15f479[_0x04b2('0x5e')][_0x04b2('0x5c')][_0x04b2('0x5f')]+':'+_0x15f479[_0x04b2('0x5e')][_0x04b2('0x5c')][_0x04b2('0x60')];_0x15f479[_0x04b2('0x61')]=new Date();_0x15f479[_0x04b2('0x59')]=function(_0x11c53c){console[_0x04b2('0x59')](_0x04b2('0x62')+_0x15f479[_0x04b2('0x63')][_0x04b2('0x5')]+'['+_0x15f479[_0x04b2('0x5d')]+']',_0x11c53c);};_0x15f479['on'](_0x04b2('0x64'),function(){onDisconnect(_0x15f479,_0x476065);_0x15f479[_0x04b2('0x59')]('DISCONNECTED');});onConnect(_0x15f479);_0x15f479[_0x04b2('0x59')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index efa5f81..74bf6b9 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 _0x3dc6=['Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','closedinteraction','ChatMessage','ChatOfflineMessage','newmessage','SmsInteraction','Sms','SmsMessage','WhatsappInteraction','Whatsapp','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','request','Trigger,\x20%s','EventManager','error','code','catch','get','channel','motionChannel','event','direction','ContactId','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','query','Sequelize','then','UserId','interface','SIP/%s','agent','incomingmessage','AfterCreateMessage','offlineMessage','resolve','QueryTypes','SELECT','undefined','format','name','AfterCreate','closed','changed','substatus','AfterUpdate','User','find','fullname','email','length','model','hook','callback','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','http'];(function(_0x4574d9,_0x224f1a){var _0x30cea4=function(_0x4d26a5){while(--_0x4d26a5){_0x4574d9['push'](_0x4574d9['shift']());}};_0x30cea4(++_0x224f1a);}(_0x3dc6,0x1ab));var _0x63dc=function(_0x20ebcd,_0x5c35f7){_0x20ebcd=_0x20ebcd-0x0;var _0xb34ddf=_0x3dc6[_0x20ebcd];return _0xb34ddf;};'use strict';var util=require(_0x63dc('0x0'));var db=require(_0x63dc('0x1'))['db'];var jayson=require(_0x63dc('0x2'));var logger=require(_0x63dc('0x3'))('triggers');var client=jayson['client'][_0x63dc('0x4')]({'port':0x232a});var triggers=[{'channel':_0x63dc('0x5'),'model':_0x63dc('0x6'),'event':_0x63dc('0x7'),'condition':_0x63dc('0x8'),'callback':afterCreate},{'channel':_0x63dc('0x5'),'model':_0x63dc('0x6'),'event':_0x63dc('0x9'),'condition':_0x63dc('0xa'),'callback':afterUpdate},{'channel':_0x63dc('0x5'),'model':_0x63dc('0xb'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0x63dc('0x5'),'model':_0x63dc('0xc'),'event':_0x63dc('0x7'),'condition':_0x63dc('0xd'),'callback':afterCreateOfflineMessage},{'channel':'Sms','model':_0x63dc('0xe'),'event':_0x63dc('0x7'),'condition':_0x63dc('0x8'),'callback':afterCreate},{'channel':_0x63dc('0xf'),'model':_0x63dc('0xe'),'event':'afterUpdate','condition':_0x63dc('0xa'),'callback':afterUpdate},{'channel':_0x63dc('0xf'),'model':_0x63dc('0x10'),'event':_0x63dc('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Whatsapp','model':_0x63dc('0x11'),'event':_0x63dc('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x63dc('0x12'),'model':_0x63dc('0x11'),'event':_0x63dc('0x9'),'condition':_0x63dc('0xa'),'callback':afterUpdate},{'channel':_0x63dc('0x12'),'model':_0x63dc('0x13'),'event':_0x63dc('0x7'),'condition':_0x63dc('0xd'),'callback':afterCreateMessage},{'channel':_0x63dc('0x14'),'model':'FaxInteraction','event':_0x63dc('0x7'),'condition':_0x63dc('0x8'),'callback':afterCreate},{'channel':_0x63dc('0x14'),'model':_0x63dc('0x15'),'event':_0x63dc('0x9'),'condition':_0x63dc('0xa'),'callback':afterUpdate},{'channel':_0x63dc('0x14'),'model':_0x63dc('0x16'),'event':'afterCreate','condition':_0x63dc('0xd'),'callback':afterCreateMessage},{'channel':_0x63dc('0x17'),'model':_0x63dc('0x18'),'event':_0x63dc('0x7'),'condition':_0x63dc('0x8'),'callback':afterCreate},{'channel':'Mail','model':'MailInteraction','event':_0x63dc('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Mail','model':_0x63dc('0x19'),'event':_0x63dc('0x7'),'condition':_0x63dc('0xd'),'callback':afterCreateMessage},{'channel':_0x63dc('0x1a'),'model':_0x63dc('0x1b'),'event':'afterCreate','condition':_0x63dc('0x8'),'callback':afterCreate},{'channel':_0x63dc('0x1a'),'model':_0x63dc('0x1b'),'event':'afterUpdate','condition':_0x63dc('0xa'),'callback':afterUpdate},{'channel':_0x63dc('0x1a'),'model':'OpenchannelMessage','event':'afterCreate','condition':'newmessage','callback':afterCreateMessage}];function request(_0x32e7a7){return client[_0x63dc('0x1c')]('EventManager',_0x32e7a7)['then'](function(_0x563513){logger['info'](_0x63dc('0x1d'),_0x63dc('0x1e'),_0x563513);if(_0x563513['error']){if(_0x563513[_0x63dc('0x1f')][_0x63dc('0x20')]===0x1f4){logger[_0x63dc('0x1f')](_0x63dc('0x1d'),'EventManager',_0x563513['error']);}}})[_0x63dc('0x21')](function(_0x5754c1){logger['error'](_0x63dc('0x1d'),_0x63dc('0x1e'),_0x5754c1);});}function afterCreateMessage(_0x49ffb6){return function(_0x56d9fc){_0x56d9fc=_0x56d9fc[_0x63dc('0x22')]({'plain':!![]});_0x56d9fc[_0x63dc('0x23')]=_0x49ffb6;_0x56d9fc[_0x63dc('0x24')]=_0x49ffb6;_0x56d9fc[_0x63dc('0x25')]=_0x56d9fc[_0x63dc('0x26')];Promise['resolve']()['then'](function(){if(typeof _0x56d9fc[_0x63dc('0x27')]==='undefined')return null;var _0x3d903c=_0x63dc('0x28')+_0x56d9fc[_0x63dc('0x27')];return db['sequelize'][_0x63dc('0x29')](_0x3d903c,{'type':db[_0x63dc('0x2a')]['QueryTypes']['SELECT'],'raw':!![]});})[_0x63dc('0x2b')](function(_0x10451d){if(_0x10451d){_0x56d9fc['contact']=_0x10451d[0x0];}if(typeof _0x56d9fc[_0x63dc('0x2c')]==='undefined')return;return getAgent(_0x56d9fc[_0x63dc('0x2c')]);})['then'](function(_0x1bfcf3){if(_0x1bfcf3){_0x56d9fc[_0x63dc('0x2d')]=util['format'](_0x63dc('0x2e'),_0x1bfcf3['name']);_0x56d9fc[_0x63dc('0x2f')]=_0x1bfcf3;_0x56d9fc[_0x63dc('0x23')]=_0x49ffb6;return request({'event':_0x63dc('0x30'),'message':_0x56d9fc});}else{return request({'event':'outgoingmessage','message':_0x56d9fc});}})[_0x63dc('0x21')](function(_0x3f4392){logger[_0x63dc('0x1f')](_0x63dc('0x1d'),_0x63dc('0x31'),_0x3f4392);});};}function afterCreateOfflineMessage(_0x7daf9b){return function(_0x54f83c){_0x54f83c=_0x54f83c[_0x63dc('0x22')]({'plain':!![]});_0x54f83c[_0x63dc('0x23')]=_0x7daf9b;_0x54f83c[_0x63dc('0x24')]=_0x7daf9b;_0x54f83c[_0x63dc('0x25')]=_0x63dc('0x32');return request({'event':_0x54f83c[_0x63dc('0x25')],'message':_0x54f83c});};}function afterCreate(_0x372b91,_0xdedf12){return function(_0x2b784b){_0x2b784b=_0x2b784b['get']({'plain':!![]});_0x2b784b[_0x63dc('0x23')]=_0x372b91;_0x2b784b['motionChannel']=_0x372b91;_0x2b784b[_0x63dc('0x25')]='opened';Promise[_0x63dc('0x33')]()['then'](function(){var _0x4168f0='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2b784b[_0x63dc('0x27')];return db['sequelize'][_0x63dc('0x29')](_0x4168f0,{'type':db[_0x63dc('0x2a')][_0x63dc('0x34')][_0x63dc('0x35')],'raw':!![]});})[_0x63dc('0x2b')](function(_0xa744d3){if(_0xa744d3){_0x2b784b['contact']=_0xa744d3[0x0];}if(typeof _0x2b784b[_0x63dc('0x2c')]===_0x63dc('0x36'))return;return getAgent(_0x2b784b[_0x63dc('0x2c')]);})[_0x63dc('0x2b')](function(_0x3bba43){if(_0x3bba43){_0x2b784b[_0x63dc('0x2d')]=util[_0x63dc('0x37')](_0x63dc('0x2e'),_0x3bba43[_0x63dc('0x38')]);_0x2b784b[_0x63dc('0x2f')]=_0x3bba43;}return request({'event':_0xdedf12,'message':_0x2b784b});})[_0x63dc('0x21')](function(_0x1552e5){logger[_0x63dc('0x1f')](_0x63dc('0x1d'),_0x63dc('0x39'),_0x1552e5);});};}function afterUpdate(_0x2449e){return function(_0x17a529){var _0x19c59f=_0x17a529['changed'](_0x63dc('0x3a'))&&_0x17a529[_0x63dc('0x3a')];var _0xcdd550=_0x17a529[_0x63dc('0x3b')](_0x63dc('0x3c'));if(_0x19c59f||_0xcdd550){var _0x5d93e9=_0x19c59f?_0x63dc('0xa'):_0x63dc('0x3c');var _0x2d606b=_0x17a529[_0x63dc('0x22')]({'plain':!![]});_0x2d606b[_0x63dc('0x23')]=_0x2449e;_0x2d606b['motionChannel']=_0x2449e;_0x2d606b['event']=_0x19c59f?_0x63dc('0x3a'):'substatus';var _0x26c696='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2d606b[_0x63dc('0x27')];return db['sequelize'][_0x63dc('0x29')](_0x26c696,{'type':db[_0x63dc('0x2a')][_0x63dc('0x34')][_0x63dc('0x35')],'raw':!![]})[_0x63dc('0x2b')](function(_0x1399ef){if(_0x1399ef){_0x2d606b['contact']=_0x1399ef[0x0];}if(typeof _0x2d606b[_0x63dc('0x2c')]===_0x63dc('0x36'))return;return getAgent(_0x2d606b[_0x63dc('0x2c')]);})[_0x63dc('0x2b')](function(_0x3f3ac8){if(_0x3f3ac8){_0x2d606b[_0x63dc('0x2d')]=util[_0x63dc('0x37')]('SIP/%s',_0x3f3ac8[_0x63dc('0x38')]);_0x2d606b[_0x63dc('0x2f')]=_0x3f3ac8;}return request({'event':_0x5d93e9,'message':_0x2d606b});})['catch'](function(_0x3ae0ae){logger[_0x63dc('0x1f')](_0x63dc('0x1d'),_0x63dc('0x3d'),_0x3ae0ae);});}};}function getAgent(_0x112399){return db[_0x63dc('0x3e')][_0x63dc('0x3f')]({'where':{'id':_0x112399},'attributes':['id','name',_0x63dc('0x40'),_0x63dc('0x41'),'internal'],'raw':!![]})[_0x63dc('0x2b')](function(_0x5df594){return _0x5df594;});}exports['default']=function(){for(var _0x2dd1f6=0x0;_0x2dd1f6=_0x50fec1[_0xadee('0x15')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x3518b4(_0x3726c4);})[_0xadee('0x16')](function(_0x5830c3){_0x25be53(_0x5830c3);});});}; \ No newline at end of file +var _0x7f00=['voice','mail','chat','fax','sms','isValidChannel','toLowerCase','includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','./license/util'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0x7f00,0x9e));var _0x07f0=function(_0x1905cc,_0x99e86f){_0x1905cc=_0x1905cc-0x0;var _0x15f952=_0x7f00[_0x1905cc];return _0x15f952;};'use strict';var _=require(_0x07f0('0x0'));var BPromise=require(_0x07f0('0x1'));var db=require('../mysqldb')['db'];var util=require(_0x07f0('0x2'));var channels=[_0x07f0('0x3'),_0x07f0('0x4'),_0x07f0('0x5'),_0x07f0('0x6'),_0x07f0('0x7'),'whatsapp','openchannel'];exports['getChannels']=function(){return channels;};exports[_0x07f0('0x8')]=function(_0x5490ec){_0x5490ec=_0x5490ec[_0x07f0('0x9')]();return _[_0x07f0('0xa')](channels,_0x5490ec);};exports[_0x07f0('0xb')]=function(_0xf91b41,_0x18448c,_0x10cc07,_0xa87219){var _0x1a1dd5={'loginAttempts':_0x18448c,'blocked':_0x10cc07};if(!_[_0x07f0('0xc')](_0xa87219)){_0x1a1dd5[_0x07f0('0xd')]=_0xa87219;}return _0xf91b41[_0x07f0('0xe')](_0x1a1dd5);};exports[_0x07f0('0xf')]=function(_0x46363c){return new BPromise(function(_0x59c5df,_0x3048f1){var _0x58ccd0=0x0;if(_0x46363c['role']!==_0x07f0('0x10')){_0x59c5df(_0x46363c);}db[_0x07f0('0x11')][_0x07f0('0x12')]({'where':{'role':_0x07f0('0x10'),'online':!![],'id':{'$ne':_0x46363c['id']}}})['then'](function(_0x5ccd7e){_0x58ccd0=_0x5ccd7e;return util[_0x07f0('0xf')]();})[_0x07f0('0x13')](function(_0x1c7ec4){if(_0x1c7ec4&&_0x1c7ec4['agents']&&_0x58ccd0>=_0x1c7ec4[_0x07f0('0x14')]){throw Error(_0x07f0('0x15'));}_0x59c5df(_0x46363c);})[_0x07f0('0x16')](function(_0x147b78){_0x3048f1(_0x147b78);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index c813fb3..3067909 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(_0x492b00,_0x5a84b8){var _0x10289d=function(_0x1c47ff){while(--_0x1c47ff){_0x492b00['push'](_0x492b00['shift']());}};_0x10289d(++_0x5a84b8);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xc4aa[_0x4d613c];return _0x301fe3;};'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 _0xadb5=['Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','error','statusMessage','status','send','exports','../config/logger','message','name','Error','inherits','Bad\x20Request','Entity\x20not\x20found'];(function(_0x4ad937,_0x3b1001){var _0x360227=function(_0x3e9522){while(--_0x3e9522){_0x4ad937['push'](_0x4ad937['shift']());}};_0x360227(++_0x3b1001);}(_0xadb5,0xad));var _0x5adb=function(_0x24bb84,_0xe4f79a){_0x24bb84=_0x24bb84-0x0;var _0x1dca24=_0xadb5[_0x24bb84];return _0x1dca24;};'use strict';var util=require('util');var logger=require(_0x5adb('0x0'))('api');var APIError=function(_0x3d6340,_0x38f67f){this[_0x5adb('0x1')]=_0x3d6340||'Internal\x20Server\x20Error';this[_0x5adb('0x2')]=_0x38f67f||_0x5adb('0x3');util[_0x5adb('0x4')](APIError,Error);};var APIBadRequestError=function(_0x4cb1d1){this[_0x5adb('0x1')]=_0x4cb1d1||_0x5adb('0x5');this[_0x5adb('0x2')]=_0x5adb('0x5');util[_0x5adb('0x4')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x353885){this[_0x5adb('0x1')]=_0x353885||_0x5adb('0x6');this[_0x5adb('0x2')]=_0x5adb('0x7');util[_0x5adb('0x4')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x336bad){this[_0x5adb('0x1')]=_0x336bad||_0x5adb('0x8');this['name']='Out\x20Of\x20Interval';util[_0x5adb('0x4')](APIOutOfIntervalError,APIError);};function getStatusCode(_0x1ea238){switch(_0x1ea238){case _0x5adb('0x5'):return 0x190;case'Forbidden',_0x5adb('0x9'):return 0x193;case'Not\x20Found':return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0x2a0b70){if(_0x2a0b70==='Out\x20Of\x20Interval')return _0x2a0b70;return null;}function handleError(_0x8cfcc6){return function(_0x39a0b3){logger[_0x5adb('0xa')](_0x39a0b3['stack']);var _0x2a545b=getStatusCode(_0x39a0b3[_0x5adb('0x2')]);var _0xf82f72=getCustomStatusMessage(_0x39a0b3['name']);if(_0x39a0b3[_0x5adb('0x2')])delete _0x39a0b3['name'];if(_0xf82f72)_0x8cfcc6[_0x5adb('0xb')]=_0xf82f72;return _0x8cfcc6[_0x5adb('0xc')](_0x2a545b)[_0x5adb('0xd')](_0x39a0b3);};}module[_0x5adb('0xe')]={'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 659eb11..c780693 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x867d=['status','render','json','404'];(function(_0xa45c07,_0x3b5dec){var _0x3ca164=function(_0x4891e2){while(--_0x4891e2){_0xa45c07['push'](_0xa45c07['shift']());}};_0x3ca164(++_0x3b5dec);}(_0x867d,0x147));var _0xd867=function(_0x514bbc,_0x2b4631){_0x514bbc=_0x514bbc-0x0;var _0x434fed=_0x867d[_0x514bbc];return _0x434fed;};'use strict';module['exports'][0x194]=function pageNotFound(_0xf46b8,_0x4ef153){var _0x465592=_0xd867('0x0');var _0x5853d7=0x194;var _0x2ae911={'status':_0x5853d7};_0x4ef153[_0xd867('0x1')](_0x2ae911[_0xd867('0x1')]);_0x4ef153[_0xd867('0x2')](_0x465592,{},function(_0x36260c,_0x3761a6){if(_0x36260c){return _0x4ef153[_0xd867('0x1')](_0x2ae911[_0xd867('0x1')])[_0xd867('0x3')](_0x2ae911);}_0x4ef153['send'](_0x3761a6);});}; \ No newline at end of file +var _0x40b6=['render','send','exports','404','status'];(function(_0x466d24,_0x3a3d6c){var _0x535da6=function(_0x241c41){while(--_0x241c41){_0x466d24['push'](_0x466d24['shift']());}};_0x535da6(++_0x3a3d6c);}(_0x40b6,0xf7));var _0x640b=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0x40b6[_0xef8146];return _0x5a6cb0;};'use strict';module[_0x640b('0x0')][0x194]=function pageNotFound(_0x484dc5,_0x2c7a0d){var _0x339b4a=_0x640b('0x1');var _0x282298=0x194;var _0x380b64={'status':_0x282298};_0x2c7a0d[_0x640b('0x2')](_0x380b64[_0x640b('0x2')]);_0x2c7a0d[_0x640b('0x3')](_0x339b4a,{},function(_0x1235d6,_0x207d57){if(_0x1235d6){return _0x2c7a0d['status'](_0x380b64['status'])['json'](_0x380b64);}_0x2c7a0d[_0x640b('0x4')](_0x207d57);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 135e685..cf28584 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(_0x200aa5,_0x197802){var _0x458200=function(_0x594959){while(--_0x594959){_0x200aa5['push'](_0x200aa5['shift']());}};_0x458200(++_0x197802);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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(_0x11ca63,_0xea9f9c){var _0x41f1f6=function(_0xb80b69){while(--_0xb80b69){_0x11ca63['push'](_0x11ca63['shift']());}};_0x41f1f6(++_0xea9f9c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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 c55a481..117a84b 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x32c0=['./api/mailApplication','/api/mail/reports/queue','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/messages','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','./api/chatGroup','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/custom_fields','./api/cmCustomField','/api/actions','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','/api/pauses','./api/pause','/api/cdr','./api/cdr','./api/schedule','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/integration','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/setting','/api/square/odbc','./api/squareOdbc','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','/api/sms/reports/transfer','./api/cmList','/api/userProfiles','./api/userProfile','./api/userProfileSection','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','./api/version','/api/system','./api/system','./api/pm2','./api/webbar','join','root','/www','static','/demo','3.5.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','path','express','./config/environment','./utils/client-side-logger','./api/client-side-logs','default','then','/api/users','./api/user','use','/api/voice/chanspy','./api/voiceContext','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/substatuses','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications'];(function(_0x38cef2,_0x20dc5b){var _0x5f3a53=function(_0x37147b){while(--_0x37147b){_0x38cef2['push'](_0x38cef2['shift']());}};_0x5f3a53(++_0x20dc5b);}(_0x32c0,0x1f3));var _0x032c=function(_0x1d8880,_0x7b2a22){_0x1d8880=_0x1d8880-0x0;var _0x9eb010=_0x32c0[_0x1d8880];return _0x9eb010;};'use strict';var path=require(_0x032c('0x0'));var express=require(_0x032c('0x1'));var errors=require('./errors');var config=require(_0x032c('0x2'));var setupLoggers=require(_0x032c('0x3'))['setupLoggers'];var clientSideLogs=require(_0x032c('0x4'));exports[_0x032c('0x5')]=function(_0x283b77){return setupLoggers(_0x283b77)[_0x032c('0x6')](function(){_0x283b77['use'](_0x032c('0x7'),require(_0x032c('0x8')));_0x283b77[_0x032c('0x9')](_0x032c('0xa'),require('./api/voiceChanSpy'));_0x283b77[_0x032c('0x9')]('/api/voice/contexts',require(_0x032c('0xb')));_0x283b77[_0x032c('0x9')]('/api/voice/extensions',require('./api/voiceExtension'));_0x283b77[_0x032c('0x9')]('/api/voice/mohs',require(_0x032c('0xc')));_0x283b77['use'](_0x032c('0xd'),require(_0x032c('0xe')));_0x283b77[_0x032c('0x9')](_0x032c('0xf'),require(_0x032c('0x10')));_0x283b77[_0x032c('0x9')]('/api/screen/recordings',require(_0x032c('0x11')));_0x283b77[_0x032c('0x9')](_0x032c('0x12'),require(_0x032c('0x13')));_0x283b77['use'](_0x032c('0x14'),require(_0x032c('0x15')));_0x283b77[_0x032c('0x9')](_0x032c('0x16'),require(_0x032c('0x17')));_0x283b77[_0x032c('0x9')]('/api/voice/dials/reports',require(_0x032c('0x18')));_0x283b77[_0x032c('0x9')](_0x032c('0x19'),require(_0x032c('0x1a')));_0x283b77[_0x032c('0x9')](_0x032c('0x1b'),require('./api/voiceQueueReport'));_0x283b77[_0x032c('0x9')](_0x032c('0x1c'),require(_0x032c('0x1d')));_0x283b77[_0x032c('0x9')](_0x032c('0x1e'),require(_0x032c('0x1f')));_0x283b77[_0x032c('0x9')](_0x032c('0x20'),require(_0x032c('0x21')));_0x283b77[_0x032c('0x9')](_0x032c('0x22'),require(_0x032c('0x23')));_0x283b77[_0x032c('0x9')]('/api/mail/accounts',require(_0x032c('0x24')));_0x283b77['use']('/api/mail/queues',require('./api/mailQueue'));_0x283b77['use'](_0x032c('0x25'),require('./api/mailSubstatus'));_0x283b77[_0x032c('0x9')](_0x032c('0x26'),require(_0x032c('0x27')));_0x283b77['use'](_0x032c('0x28'),require(_0x032c('0x29')));_0x283b77[_0x032c('0x9')](_0x032c('0x2a'),require(_0x032c('0x2b')));_0x283b77[_0x032c('0x9')](_0x032c('0x2c'),require('./api/mailQueueReport'));_0x283b77[_0x032c('0x9')](_0x032c('0x2d'),require(_0x032c('0x2e')));_0x283b77['use'](_0x032c('0x2f'),require(_0x032c('0x30')));_0x283b77[_0x032c('0x9')](_0x032c('0x31'),require('./api/faxAccount'));_0x283b77[_0x032c('0x9')](_0x032c('0x32'),require(_0x032c('0x33')));_0x283b77[_0x032c('0x9')]('/api/fax/interactions',require(_0x032c('0x34')));_0x283b77[_0x032c('0x9')](_0x032c('0x35'),require(_0x032c('0x36')));_0x283b77[_0x032c('0x9')](_0x032c('0x37'),require(_0x032c('0x38')));_0x283b77['use']('/api/fax/reports/queue',require(_0x032c('0x39')));_0x283b77['use'](_0x032c('0x3a'),require(_0x032c('0x3b')));_0x283b77['use'](_0x032c('0x3c'),require(_0x032c('0x3d')));_0x283b77[_0x032c('0x9')](_0x032c('0x3e'),require('./api/smsInteraction'));_0x283b77[_0x032c('0x9')](_0x032c('0x3f'),require('./api/smsMessage'));_0x283b77[_0x032c('0x9')](_0x032c('0x40'),require(_0x032c('0x41')));_0x283b77[_0x032c('0x9')](_0x032c('0x42'),require('./api/openchannelAccount'));_0x283b77[_0x032c('0x9')]('/api/openchannel/applications',require(_0x032c('0x43')));_0x283b77['use'](_0x032c('0x44'),require(_0x032c('0x45')));_0x283b77[_0x032c('0x9')](_0x032c('0x46'),require(_0x032c('0x47')));_0x283b77[_0x032c('0x9')]('/api/openchannel/queues',require(_0x032c('0x48')));_0x283b77[_0x032c('0x9')]('/api/chat/websites',require(_0x032c('0x49')));_0x283b77[_0x032c('0x9')](_0x032c('0x4a'),require('./api/openchannelQueueReport'));_0x283b77[_0x032c('0x9')](_0x032c('0x4b'),require(_0x032c('0x4c')));_0x283b77[_0x032c('0x9')](_0x032c('0x4d'),require(_0x032c('0x4e')));_0x283b77[_0x032c('0x9')]('/api/chat/messages',require(_0x032c('0x4f')));_0x283b77[_0x032c('0x9')](_0x032c('0x50'),require(_0x032c('0x51')));_0x283b77[_0x032c('0x9')](_0x032c('0x52'),require(_0x032c('0x53')));_0x283b77[_0x032c('0x9')]('/api/chat/groups',require(_0x032c('0x54')));_0x283b77['use'](_0x032c('0x55'),require('./api/chatProactiveAction'));_0x283b77['use'](_0x032c('0x56'),require(_0x032c('0x57')));_0x283b77['use']('/api/cm/contacts',require(_0x032c('0x58')));_0x283b77['use']('/api/cm/hopper',require(_0x032c('0x59')));_0x283b77[_0x032c('0x9')](_0x032c('0x5a'),require(_0x032c('0x5b')));_0x283b77[_0x032c('0x9')](_0x032c('0x5c'),require('./api/cmHopperFinal'));_0x283b77[_0x032c('0x9')]('/api/cm/hopper_history',require('./api/cmHopperHistory'));_0x283b77[_0x032c('0x9')](_0x032c('0x5d'),require(_0x032c('0x5e')));_0x283b77[_0x032c('0x9')](_0x032c('0x5f'),require('./api/action'));_0x283b77['use'](_0x032c('0x60'),require('./api/automation'));_0x283b77[_0x032c('0x9')](_0x032c('0x61'),require(_0x032c('0x62')));_0x283b77[_0x032c('0x9')](_0x032c('0x63'),require(_0x032c('0x64')));_0x283b77[_0x032c('0x9')](_0x032c('0x65'),require(_0x032c('0x66')));_0x283b77['use'](_0x032c('0x67'),require('./api/interval'));_0x283b77['use'](_0x032c('0x68'),require(_0x032c('0x69')));_0x283b77[_0x032c('0x9')](_0x032c('0x6a'),require(_0x032c('0x6b')));_0x283b77['use']('/api/voiceQueuesLog',require('./api/voiceQueuesLog'));_0x283b77[_0x032c('0x9')]('/api/schedules',require(_0x032c('0x6c')));_0x283b77[_0x032c('0x9')]('/api/sounds',require(_0x032c('0x6d')));_0x283b77[_0x032c('0x9')](_0x032c('0x6e'),require(_0x032c('0x6f')));_0x283b77[_0x032c('0x9')](_0x032c('0x70'),require(_0x032c('0x71')));_0x283b77[_0x032c('0x9')](_0x032c('0x72'),require('./api/cmContactHasItem'));_0x283b77[_0x032c('0x9')]('/api/cm_hopper_additional_phones',require(_0x032c('0x73')));_0x283b77[_0x032c('0x9')](_0x032c('0x74'),require(_0x032c('0x75')));_0x283b77[_0x032c('0x9')](_0x032c('0x76'),require(_0x032c('0x77')));_0x283b77[_0x032c('0x9')](_0x032c('0x78'),require('./api/variable'));_0x283b77[_0x032c('0x9')]('/api/integrations',require(_0x032c('0x79')));_0x283b77[_0x032c('0x9')]('/api/integrations/reports',require(_0x032c('0x7a')));_0x283b77[_0x032c('0x9')]('/api/analytics/custom_reports',require(_0x032c('0x7b')));_0x283b77[_0x032c('0x9')](_0x032c('0x7c'),require('./api/analyticDefaultReport'));_0x283b77[_0x032c('0x9')](_0x032c('0x7d'),require(_0x032c('0x7e')));_0x283b77[_0x032c('0x9')](_0x032c('0x7f'),require(_0x032c('0x80')));_0x283b77[_0x032c('0x9')](_0x032c('0x81'),require(_0x032c('0x82')));_0x283b77[_0x032c('0x9')]('/api/analytics/tree_reports',require(_0x032c('0x83')));_0x283b77[_0x032c('0x9')](_0x032c('0x84'),require(_0x032c('0x85')));_0x283b77[_0x032c('0x9')](_0x032c('0x86'),require(_0x032c('0x87')));_0x283b77[_0x032c('0x9')]('/api/integrations/salesforce/fields',require(_0x032c('0x88')));_0x283b77[_0x032c('0x9')](_0x032c('0x89'),require(_0x032c('0x8a')));_0x283b77[_0x032c('0x9')]('/api/integrations/sugarcrm/configurations',require(_0x032c('0x8b')));_0x283b77[_0x032c('0x9')](_0x032c('0x8c'),require(_0x032c('0x8d')));_0x283b77[_0x032c('0x9')](_0x032c('0x8e'),require(_0x032c('0x8f')));_0x283b77[_0x032c('0x9')](_0x032c('0x90'),require(_0x032c('0x91')));_0x283b77[_0x032c('0x9')]('/api/integrations/desk/fields',require('./api/intDeskField'));_0x283b77[_0x032c('0x9')](_0x032c('0x92'),require(_0x032c('0x93')));_0x283b77[_0x032c('0x9')]('/api/integrations/zoho/configurations',require(_0x032c('0x94')));_0x283b77[_0x032c('0x9')](_0x032c('0x95'),require(_0x032c('0x96')));_0x283b77[_0x032c('0x9')](_0x032c('0x97'),require(_0x032c('0x98')));_0x283b77[_0x032c('0x9')](_0x032c('0x99'),require('./api/intZendeskConfiguration'));_0x283b77[_0x032c('0x9')](_0x032c('0x9a'),require(_0x032c('0x9b')));_0x283b77[_0x032c('0x9')]('/api/integrations/freshdesk/accounts',require(_0x032c('0x9c')));_0x283b77[_0x032c('0x9')](_0x032c('0x9d'),require(_0x032c('0x9e')));_0x283b77[_0x032c('0x9')]('/api/integrations/freshdesk/fields',require(_0x032c('0x9f')));_0x283b77[_0x032c('0x9')](_0x032c('0xa0'),require(_0x032c('0xa1')));_0x283b77[_0x032c('0x9')](_0x032c('0xa2'),require(_0x032c('0xa3')));_0x283b77[_0x032c('0x9')]('/api/integrations/vtiger/fields',require('./api/intVtigerField'));_0x283b77[_0x032c('0x9')]('/api/integrations/servicenow/accounts',require(_0x032c('0xa4')));_0x283b77['use'](_0x032c('0xa5'),require(_0x032c('0xa6')));_0x283b77[_0x032c('0x9')](_0x032c('0xa7'),require(_0x032c('0xa8')));_0x283b77['use'](_0x032c('0xa9'),require(_0x032c('0xaa')));_0x283b77['use'](_0x032c('0xab'),require(_0x032c('0xac')));_0x283b77[_0x032c('0x9')]('/api/integrations/dynamics365/fields',require(_0x032c('0xad')));_0x283b77[_0x032c('0x9')]('/api/integrations/freshsales/accounts',require(_0x032c('0xae')));_0x283b77[_0x032c('0x9')](_0x032c('0xaf'),require(_0x032c('0xb0')));_0x283b77[_0x032c('0x9')](_0x032c('0xb1'),require('./api/intFreshsalesField'));_0x283b77[_0x032c('0x9')](_0x032c('0xb2'),require(_0x032c('0xb3')));_0x283b77[_0x032c('0x9')](_0x032c('0xb4'),require(_0x032c('0xb5')));_0x283b77[_0x032c('0x9')](_0x032c('0xb6'),require(_0x032c('0xb7')));_0x283b77['use'](_0x032c('0xb8'),require(_0x032c('0xb9')));_0x283b77[_0x032c('0x9')](_0x032c('0xba'),require(_0x032c('0xbb')));_0x283b77[_0x032c('0x9')](_0x032c('0xbc'),require(_0x032c('0xbd')));_0x283b77[_0x032c('0x9')](_0x032c('0xbe'),require(_0x032c('0xbf')));_0x283b77[_0x032c('0x9')](_0x032c('0xc0'),require(_0x032c('0xc1')));_0x283b77[_0x032c('0x9')](_0x032c('0xc2'),require(_0x032c('0xc3')));_0x283b77[_0x032c('0x9')](_0x032c('0xc4'),require('./api/jscriptyProject'));_0x283b77['use']('/api/settings',require(_0x032c('0xc5')));_0x283b77['use'](_0x032c('0xc6'),require(_0x032c('0xc7')));_0x283b77[_0x032c('0x9')]('/api/square/projects',require(_0x032c('0xc8')));_0x283b77[_0x032c('0x9')](_0x032c('0xc9'),require(_0x032c('0xca')));_0x283b77[_0x032c('0x9')](_0x032c('0xcb'),require(_0x032c('0xcc')));_0x283b77[_0x032c('0x9')]('/api/teams',require(_0x032c('0xcd')));_0x283b77['use'](_0x032c('0xce'),require(_0x032c('0xcf')));_0x283b77[_0x032c('0x9')](_0x032c('0xd0'),require(_0x032c('0xd1')));_0x283b77[_0x032c('0x9')](_0x032c('0xd2'),require('./api/migration'));_0x283b77['use'](_0x032c('0xd3'),require(_0x032c('0xd4')));_0x283b77['use'](_0x032c('0xd5'),require(_0x032c('0xd6')));_0x283b77['use'](_0x032c('0xd7'),require(_0x032c('0xd8')));_0x283b77['use']('/api/chat/reports/transfer',require(_0x032c('0xd9')));_0x283b77[_0x032c('0x9')](_0x032c('0xda'),require('./api/faxTransferReport'));_0x283b77['use']('/api/openchannel/reports/transfer',require('./api/openchannelTransferReport'));_0x283b77['use'](_0x032c('0xdb'),require('./api/smsTransferReport'));_0x283b77[_0x032c('0x9')]('/api/cm/lists',require(_0x032c('0xdc')));_0x283b77[_0x032c('0x9')]('/api/voice/prefixes',require('./api/voicePrefix'));_0x283b77[_0x032c('0x9')](_0x032c('0xdd'),require(_0x032c('0xde')));_0x283b77[_0x032c('0x9')]('/api/userProfile/sections',require(_0x032c('0xdf')));_0x283b77[_0x032c('0x9')]('/api/userProfile/resources',require(_0x032c('0xe0')));_0x283b77[_0x032c('0x9')](_0x032c('0xe1'),require(_0x032c('0xe2')));_0x283b77[_0x032c('0x9')](_0x032c('0xe3'),require(_0x032c('0xe4')));_0x283b77[_0x032c('0x9')](_0x032c('0xe5'),require(_0x032c('0xe6')));_0x283b77[_0x032c('0x9')]('/api/whatsapp/interactions',require(_0x032c('0xe7')));_0x283b77['use'](_0x032c('0xe8'),require(_0x032c('0xe9')));_0x283b77[_0x032c('0x9')]('/api/whatsapp/reports/queue',require(_0x032c('0xea')));_0x283b77['use']('/api/whatsapp/reports/transfer',require(_0x032c('0xeb')));_0x283b77[_0x032c('0x9')](_0x032c('0xec'),require(_0x032c('0xed')));_0x283b77[_0x032c('0x9')](_0x032c('0xee'),require(_0x032c('0xef')));_0x283b77[_0x032c('0x9')]('/api/realtime',require(_0x032c('0xf0')));_0x283b77[_0x032c('0x9')](_0x032c('0xf1'),require(_0x032c('0xf2')));_0x283b77['use'](_0x032c('0xf3'),require(_0x032c('0xf4')));_0x283b77[_0x032c('0x9')](_0x032c('0xf5'),require(_0x032c('0xf6')));_0x283b77[_0x032c('0x9')](_0x032c('0xf7'),require('./api/authActiveDirectory'));_0x283b77[_0x032c('0x9')](_0x032c('0xf8'),require(_0x032c('0xf9')));_0x283b77[_0x032c('0x9')](_0x032c('0xfa'),require(_0x032c('0xfb')));_0x283b77[_0x032c('0x9')]('/api/version',require(_0x032c('0xfc')));_0x283b77[_0x032c('0x9')](_0x032c('0xfd'),require(_0x032c('0xfe')));_0x283b77[_0x032c('0x9')]('/api/pm2',require(_0x032c('0xff')));_0x283b77[_0x032c('0x9')]('/api/webbar',require(_0x032c('0x100')));_0x283b77['use']('/api/logs',clientSideLogs);_0x283b77[_0x032c('0x9')]('/apidoc',express['static'](path[_0x032c('0x101')](config[_0x032c('0x102')],'/apidoc')));_0x283b77[_0x032c('0x9')](_0x032c('0x103'),express[_0x032c('0x104')](path[_0x032c('0x101')](config['root'],_0x032c('0x103'))));_0x283b77[_0x032c('0x9')](_0x032c('0x105'),express[_0x032c('0x104')](path[_0x032c('0x101')](config['root'],_0x032c('0x105'))));_0x283b77['use']('/snippet',express[_0x032c('0x104')](path[_0x032c('0x101')](config[_0x032c('0x102')],'snippet',_0x032c('0x106'))));_0x283b77[_0x032c('0x9')](_0x032c('0x107'),express[_0x032c('0x104')](path[_0x032c('0x101')](config[_0x032c('0x102')],_0x032c('0x108'))));_0x283b77[_0x032c('0x109')](_0x032c('0x10a'))['get'](errors[0x194]);_0x283b77[_0x032c('0x109')]('/*')[_0x032c('0x10b')](function(_0x4238ef,_0x2970fe){_0x2970fe[_0x032c('0x10c')](path[_0x032c('0x10d')](_0x283b77[_0x032c('0x10b')](_0x032c('0x10e'))+'/index.html'));});return _0x283b77;});}; \ No newline at end of file +var _0xf3cd=['./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','./api/smsApplication','./api/smsInteraction','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','/api/openchannel/messages','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','/api/intervals','./api/interval','/api/pauses','./api/pause','./api/cdr','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/template','/api/triggers','./api/trigger','/api/variables','./api/integration','/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/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','./api/intSugarcrmField','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','/api/teams','./api/team','/api/license','/api/migrations','./api/migration','./api/attachment','/api/plugins','/api/mail/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/realtime','./api/realtime','./api/user-setting','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/webbar','./api/webbar','/api/logs','/apidoc','static','root','/www','join','/demo','snippet','3.5.0','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','default','then','/api/users','./api/user','use','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceContext','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings'];(function(_0x523ff9,_0xca72de){var _0x2f5f1f=function(_0x6d3feb){while(--_0x6d3feb){_0x523ff9['push'](_0x523ff9['shift']());}};_0x2f5f1f(++_0xca72de);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3cf053,_0x7a9947){_0x3cf053=_0x3cf053-0x0;var _0x3b55a0=_0xf3cd[_0x3cf053];return _0x3b55a0;};'use strict';var path=require(_0xdf3c('0x0'));var express=require(_0xdf3c('0x1'));var errors=require(_0xdf3c('0x2'));var config=require(_0xdf3c('0x3'));var setupLoggers=require(_0xdf3c('0x4'))[_0xdf3c('0x5')];var clientSideLogs=require('./api/client-side-logs');exports[_0xdf3c('0x6')]=function(_0x71b446){return setupLoggers(_0x71b446)[_0xdf3c('0x7')](function(){_0x71b446['use'](_0xdf3c('0x8'),require(_0xdf3c('0x9')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0xb'),require(_0xdf3c('0xc')));_0x71b446[_0xdf3c('0xa')]('/api/voice/contexts',require(_0xdf3c('0xd')));_0x71b446['use']('/api/voice/extensions',require(_0xdf3c('0xe')));_0x71b446[_0xdf3c('0xa')]('/api/voice/mohs',require(_0xdf3c('0xf')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x10'),require(_0xdf3c('0x11')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x12'),require(_0xdf3c('0x13')));_0x71b446[_0xdf3c('0xa')]('/api/screen/recordings',require(_0xdf3c('0x14')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x15'),require(_0xdf3c('0x16')));_0x71b446['use'](_0xdf3c('0x17'),require(_0xdf3c('0x18')));_0x71b446[_0xdf3c('0xa')]('/api/voice/calls/reports',require(_0xdf3c('0x19')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x1a'),require(_0xdf3c('0x1b')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x1c'),require(_0xdf3c('0x1d')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x1e'),require(_0xdf3c('0x1f')));_0x71b446['use'](_0xdf3c('0x20'),require(_0xdf3c('0x21')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x22'),require(_0xdf3c('0x23')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x24'),require(_0xdf3c('0x25')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x26'),require(_0xdf3c('0x27')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x28'),require('./api/mailAccount'));_0x71b446['use'](_0xdf3c('0x29'),require('./api/mailQueue'));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x2a'),require(_0xdf3c('0x2b')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x2c'),require(_0xdf3c('0x2d')));_0x71b446['use'](_0xdf3c('0x2e'),require(_0xdf3c('0x2f')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x30'),require(_0xdf3c('0x31')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x32'),require(_0xdf3c('0x33')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x34'),require('./api/dashboard'));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x35'),require('./api/dashboardItem'));_0x71b446[_0xdf3c('0xa')]('/api/fax/accounts',require('./api/faxAccount'));_0x71b446['use'](_0xdf3c('0x36'),require(_0xdf3c('0x37')));_0x71b446['use']('/api/fax/interactions',require(_0xdf3c('0x38')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x39'),require(_0xdf3c('0x3a')));_0x71b446['use'](_0xdf3c('0x3b'),require(_0xdf3c('0x3c')));_0x71b446['use']('/api/fax/reports/queue',require(_0xdf3c('0x3d')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x3e'),require('./api/smsAccount'));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x3f'),require(_0xdf3c('0x40')));_0x71b446[_0xdf3c('0xa')]('/api/sms/interactions',require(_0xdf3c('0x41')));_0x71b446[_0xdf3c('0xa')]('/api/sms/messages',require(_0xdf3c('0x42')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x43'),require(_0xdf3c('0x44')));_0x71b446['use'](_0xdf3c('0x45'),require(_0xdf3c('0x46')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x47'),require('./api/openchannelApplication'));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x48'),require('./api/openchannelInteraction'));_0x71b446['use'](_0xdf3c('0x49'),require('./api/openchannelMessage'));_0x71b446[_0xdf3c('0xa')]('/api/openchannel/queues',require('./api/openchannelQueue'));_0x71b446['use'](_0xdf3c('0x4a'),require(_0xdf3c('0x4b')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x4c'),require('./api/openchannelQueueReport'));_0x71b446['use'](_0xdf3c('0x4d'),require('./api/chatApplication'));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x4e'),require(_0xdf3c('0x4f')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x50'),require(_0xdf3c('0x51')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x52'),require(_0xdf3c('0x53')));_0x71b446['use'](_0xdf3c('0x54'),require('./api/chatQueue'));_0x71b446['use'](_0xdf3c('0x55'),require('./api/chatGroup'));_0x71b446[_0xdf3c('0xa')]('/api/chat/proactive_actions',require(_0xdf3c('0x56')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x57'),require(_0xdf3c('0x58')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x59'),require(_0xdf3c('0x5a')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x5b'),require(_0xdf3c('0x5c')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x5d'),require('./api/cmHopperBlack'));_0x71b446['use'](_0xdf3c('0x5e'),require('./api/cmHopperFinal'));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x5f'),require(_0xdf3c('0x60')));_0x71b446[_0xdf3c('0xa')]('/api/cm/custom_fields',require('./api/cmCustomField'));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x61'),require(_0xdf3c('0x62')));_0x71b446['use'](_0xdf3c('0x63'),require(_0xdf3c('0x64')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x65'),require('./api/cannedAnswer'));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x66'),require(_0xdf3c('0x67')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x68'),require('./api/condition'));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x69'),require(_0xdf3c('0x6a')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x6b'),require(_0xdf3c('0x6c')));_0x71b446['use']('/api/cdr',require(_0xdf3c('0x6d')));_0x71b446[_0xdf3c('0xa')]('/api/voiceQueuesLog',require('./api/voiceQueuesLog'));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x6e'),require(_0xdf3c('0x6f')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x70'),require(_0xdf3c('0x71')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x72'),require(_0xdf3c('0x73')));_0x71b446['use'](_0xdf3c('0x74'),require(_0xdf3c('0x75')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x76'),require(_0xdf3c('0x77')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x78'),require('./api/cmHopperAdditionalPhone'));_0x71b446[_0xdf3c('0xa')]('/api/templates',require(_0xdf3c('0x79')));_0x71b446['use'](_0xdf3c('0x7a'),require(_0xdf3c('0x7b')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x7c'),require('./api/variable'));_0x71b446['use']('/api/integrations',require(_0xdf3c('0x7d')));_0x71b446['use'](_0xdf3c('0x7e'),require(_0xdf3c('0x7f')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x80'),require(_0xdf3c('0x81')));_0x71b446['use']('/api/analytics/default_reports',require(_0xdf3c('0x82')));_0x71b446[_0xdf3c('0xa')]('/api/analytics/extracted_reports',require(_0xdf3c('0x83')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x84'),require(_0xdf3c('0x85')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x86'),require(_0xdf3c('0x87')));_0x71b446['use']('/api/analytics/tree_reports',require(_0xdf3c('0x88')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x89'),require(_0xdf3c('0x8a')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x8b'),require(_0xdf3c('0x8c')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x8d'),require(_0xdf3c('0x8e')));_0x71b446[_0xdf3c('0xa')]('/api/integrations/sugarcrm/accounts',require(_0xdf3c('0x8f')));_0x71b446['use']('/api/integrations/sugarcrm/configurations',require('./api/intSugarcrmConfiguration'));_0x71b446['use']('/api/integrations/sugarcrm/fields',require(_0xdf3c('0x90')));_0x71b446[_0xdf3c('0xa')]('/api/integrations/desk/accounts',require(_0xdf3c('0x91')));_0x71b446[_0xdf3c('0xa')]('/api/integrations/desk/configurations',require(_0xdf3c('0x92')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x93'),require(_0xdf3c('0x94')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x95'),require(_0xdf3c('0x96')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x97'),require(_0xdf3c('0x98')));_0x71b446[_0xdf3c('0xa')]('/api/integrations/zoho/fields',require(_0xdf3c('0x99')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x9a'),require('./api/intZendeskAccount'));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x9b'),require(_0xdf3c('0x9c')));_0x71b446['use'](_0xdf3c('0x9d'),require(_0xdf3c('0x9e')));_0x71b446['use'](_0xdf3c('0x9f'),require('./api/intFreshdeskAccount'));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0xa0'),require(_0xdf3c('0xa1')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0xa2'),require(_0xdf3c('0xa3')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0xa4'),require(_0xdf3c('0xa5')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0xa6'),require(_0xdf3c('0xa7')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0xa8'),require(_0xdf3c('0xa9')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0xaa'),require('./api/intServicenowAccount'));_0x71b446['use'](_0xdf3c('0xab'),require(_0xdf3c('0xac')));_0x71b446[_0xdf3c('0xa')]('/api/integrations/servicenow/fields',require(_0xdf3c('0xad')));_0x71b446['use']('/api/integrations/dynamics365/accounts',require(_0xdf3c('0xae')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0xaf'),require(_0xdf3c('0xb0')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0xb1'),require(_0xdf3c('0xb2')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0xb3'),require(_0xdf3c('0xb4')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0xb5'),require(_0xdf3c('0xb6')));_0x71b446['use'](_0xdf3c('0xb7'),require(_0xdf3c('0xb8')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0xb9'),require(_0xdf3c('0xba')));_0x71b446['use'](_0xdf3c('0xbb'),require(_0xdf3c('0xbc')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0xbd'),require(_0xdf3c('0xbe')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0xbf'),require(_0xdf3c('0xc0')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0xc1'),require('./api/jscriptyQuestionReport'));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0xc2'),require(_0xdf3c('0xc3')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0xc4'),require(_0xdf3c('0xc5')));_0x71b446[_0xdf3c('0xa')]('/api/square/reports',require(_0xdf3c('0xc6')));_0x71b446[_0xdf3c('0xa')]('/api/square/details/reports',require('./api/squareReportDetail'));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0xc7'),require(_0xdf3c('0xc8')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0xc9'),require(_0xdf3c('0xca')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0xcb'),require('./api/squareOdbc'));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0xcc'),require(_0xdf3c('0xcd')));_0x71b446['use'](_0xdf3c('0xce'),require(_0xdf3c('0xcf')));_0x71b446[_0xdf3c('0xa')]('/api/square/messages',require(_0xdf3c('0xd0')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0xd1'),require(_0xdf3c('0xd2')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0xd3'),require('./api/license'));_0x71b446['use']('/api/campaigns',require('./api/campaign'));_0x71b446['use'](_0xdf3c('0xd4'),require(_0xdf3c('0xd5')));_0x71b446[_0xdf3c('0xa')]('/api/attachments',require(_0xdf3c('0xd6')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0xd7'),require('./api/plugin'));_0x71b446['use'](_0xdf3c('0xd8'),require('./api/mailTransferReport'));_0x71b446[_0xdf3c('0xa')]('/api/chat/reports/transfer',require(_0xdf3c('0xd9')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0xda'),require(_0xdf3c('0xdb')));_0x71b446['use']('/api/openchannel/reports/transfer',require(_0xdf3c('0xdc')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0xdd'),require(_0xdf3c('0xde')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0xdf'),require('./api/cmList'));_0x71b446[_0xdf3c('0xa')]('/api/voice/prefixes',require(_0xdf3c('0xe0')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0xe1'),require(_0xdf3c('0xe2')));_0x71b446[_0xdf3c('0xa')]('/api/userProfile/sections',require(_0xdf3c('0xe3')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0xe4'),require('./api/userProfileResource'));_0x71b446['use']('/api/userNotifications',require('./api/userNotification'));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0xe5'),require(_0xdf3c('0xe6')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0xe7'),require(_0xdf3c('0xe8')));_0x71b446['use'](_0xdf3c('0xe9'),require('./api/whatsappInteraction'));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0xea'),require(_0xdf3c('0xeb')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0xec'),require(_0xdf3c('0xed')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0xee'),require(_0xdf3c('0xef')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0xf0'),require(_0xdf3c('0xf1')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0xf2'),require('./api/cloudProvider'));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0xf3'),require(_0xdf3c('0xf4')));_0x71b446[_0xdf3c('0xa')]('/api/user-settings',require(_0xdf3c('0xf5')));_0x71b446[_0xdf3c('0xa')]('/api/auth/local',require('./api/authLocal'));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0xf6'),require(_0xdf3c('0xf7')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0xf8'),require('./api/authActiveDirectory'));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0xf9'),require(_0xdf3c('0xfa')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0xfb'),require(_0xdf3c('0xfc')));_0x71b446['use'](_0xdf3c('0xfd'),require(_0xdf3c('0xfe')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0xff'),require(_0xdf3c('0x100')));_0x71b446['use']('/api/pm2',require('./api/pm2'));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x101'),require(_0xdf3c('0x102')));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x103'),clientSideLogs);_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x104'),express[_0xdf3c('0x105')](path['join'](config[_0xdf3c('0x106')],_0xdf3c('0x104'))));_0x71b446[_0xdf3c('0xa')](_0xdf3c('0x107'),express[_0xdf3c('0x105')](path[_0xdf3c('0x108')](config['root'],_0xdf3c('0x107'))));_0x71b446[_0xdf3c('0xa')]('/demo',express['static'](path[_0xdf3c('0x108')](config['root'],_0xdf3c('0x109'))));_0x71b446[_0xdf3c('0xa')]('/snippet',express[_0xdf3c('0x105')](path[_0xdf3c('0x108')](config[_0xdf3c('0x106')],_0xdf3c('0x10a'),_0xdf3c('0x10b'))));_0x71b446[_0xdf3c('0xa')]('/plugins',express[_0xdf3c('0x105')](path[_0xdf3c('0x108')](config[_0xdf3c('0x106')],_0xdf3c('0x10c'))));_0x71b446[_0xdf3c('0x10d')](_0xdf3c('0x10e'))[_0xdf3c('0x10f')](errors[0x194]);_0x71b446['route']('/*')['get'](function(_0x1745fd,_0x259249){_0x259249[_0xdf3c('0x110')](path['resolve'](_0x71b446[_0xdf3c('0x10f')]('appPath')+'/index.html'));});return _0x71b446;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 18bcb53..4e1565a 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a83=['../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.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/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc'];(function(_0x5d8631,_0x44944b){var _0x34c15e=function(_0x4448f8){while(--_0x4448f8){_0x5d8631['push'](_0x5d8631['shift']());}};_0x34c15e(++_0x44944b);}(_0x6a83,0xd2));var _0x36a8=function(_0x129b6d,_0x214a22){_0x129b6d=_0x129b6d-0x0;var _0x5ab808=_0x6a83[_0x129b6d];return _0x5ab808;};'use strict';var jayson=require(_0x36a8('0x0'));var _=require(_0x36a8('0x1'));var config=require(_0x36a8('0x2'));exports[_0x36a8('0x3')]=function(){return new Promise(function(_0x125ca1,_0x367db7){var _0x1f59f3={};_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require(_0x36a8('0x5')));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require(_0x36a8('0x6')));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require(_0x36a8('0x7')));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require(_0x36a8('0x8')));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require(_0x36a8('0x9')));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require(_0x36a8('0xa')));_0x1f59f3=_['merge'](_0x1f59f3,require(_0x36a8('0xb')));_0x1f59f3=_['merge'](_0x1f59f3,require(_0x36a8('0xc')));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require('../api/memberReport/memberReport.rpc'));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require(_0x36a8('0xd')));_0x1f59f3=_['merge'](_0x1f59f3,require(_0x36a8('0xe')));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require(_0x36a8('0xf')));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require(_0x36a8('0x10')));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require(_0x36a8('0x11')));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require('../api/mailQueue/mailQueue.rpc'));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require(_0x36a8('0x12')));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require(_0x36a8('0x13')));_0x1f59f3=_['merge'](_0x1f59f3,require('../api/mailApplication/mailApplication.rpc'));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require(_0x36a8('0x14')));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require(_0x36a8('0x15')));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require(_0x36a8('0x16')));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require('../api/faxInteraction/faxInteraction.rpc'));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require(_0x36a8('0x17')));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require('../api/faxQueue/faxQueue.rpc'));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require(_0x36a8('0x18')));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require('../api/smsInteraction/smsInteraction.rpc'));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require(_0x36a8('0x19')));_0x1f59f3=_['merge'](_0x1f59f3,require(_0x36a8('0x1a')));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require(_0x36a8('0x1b')));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require(_0x36a8('0x1c')));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require(_0x36a8('0x1d')));_0x1f59f3=_['merge'](_0x1f59f3,require(_0x36a8('0x1e')));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require('../api/chatInteraction/chatInteraction.rpc'));_0x1f59f3=_['merge'](_0x1f59f3,require('../api/chatMessage/chatMessage.rpc'));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require(_0x36a8('0x1f')));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require(_0x36a8('0x20')));_0x1f59f3=_['merge'](_0x1f59f3,require(_0x36a8('0x21')));_0x1f59f3=_['merge'](_0x1f59f3,require(_0x36a8('0x22')));_0x1f59f3=_['merge'](_0x1f59f3,require(_0x36a8('0x23')));_0x1f59f3=_['merge'](_0x1f59f3,require(_0x36a8('0x24')));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require(_0x36a8('0x25')));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require(_0x36a8('0x26')));_0x1f59f3=_['merge'](_0x1f59f3,require(_0x36a8('0x27')));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require(_0x36a8('0x28')));_0x1f59f3=_['merge'](_0x1f59f3,require(_0x36a8('0x29')));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require(_0x36a8('0x2a')));_0x1f59f3=_['merge'](_0x1f59f3,require('../api/trigger/trigger.rpc'));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require(_0x36a8('0x2b')));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require(_0x36a8('0x2c')));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require(_0x36a8('0x2d')));_0x1f59f3=_['merge'](_0x1f59f3,require(_0x36a8('0x2e')));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require(_0x36a8('0x2f')));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require(_0x36a8('0x30')));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require(_0x36a8('0x31')));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require(_0x36a8('0x32')));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require(_0x36a8('0x33')));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require(_0x36a8('0x34')));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require(_0x36a8('0x35')));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require(_0x36a8('0x36')));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require(_0x36a8('0x37')));_0x1f59f3=_['merge'](_0x1f59f3,require(_0x36a8('0x38')));_0x1f59f3=_['merge'](_0x1f59f3,require(_0x36a8('0x39')));_0x1f59f3=_['merge'](_0x1f59f3,require('../api/setting/setting.rpc'));_0x1f59f3=_['merge'](_0x1f59f3,require(_0x36a8('0x3a')));_0x1f59f3=_['merge'](_0x1f59f3,require(_0x36a8('0x3b')));_0x1f59f3=_['merge'](_0x1f59f3,require(_0x36a8('0x3c')));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require(_0x36a8('0x3d')));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require(_0x36a8('0x3e')));_0x1f59f3=_['merge'](_0x1f59f3,require('../api/attachment/attachment.rpc'));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require(_0x36a8('0x3f')));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require(_0x36a8('0x40')));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require(_0x36a8('0x41')));_0x1f59f3=_[_0x36a8('0x4')](_0x1f59f3,require(_0x36a8('0x42')));_0x1f59f3=_['merge'](_0x1f59f3,require(_0x36a8('0x43')));var _0x2597fc=jayson[_0x36a8('0x44')](_0x1f59f3)[_0x36a8('0x45')]();var _0x706d00=config[_0x36a8('0x46')][_0x36a8('0x47')]||config['port']+0x1;var _0x58bde1=config['rpc']['ip']||_0x36a8('0x48');_0x2597fc['on'](_0x36a8('0x49'),function(_0x491f2d){return _0x367db7(_0x491f2d);});_0x2597fc[_0x36a8('0x3')](_0x706d00,_0x58bde1,function(){console[_0x36a8('0x4a')](_0x36a8('0x4b'),_0x58bde1,_0x706d00);require('../config/triggers')[_0x36a8('0x4c')]();return _0x125ca1(_0x36a8('0x4d')+_0x58bde1+':'+_0x706d00);});});}; \ No newline at end of file +var _0x700c=['localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','port'];(function(_0x2663be,_0x15b25e){var _0x1204a3=function(_0x17dfa7){while(--_0x17dfa7){_0x2663be['push'](_0x2663be['shift']());}};_0x1204a3(++_0x15b25e);}(_0x700c,0x127));var _0xc700=function(_0x3bc537,_0x4ac5e7){_0x3bc537=_0x3bc537-0x0;var _0x2da5fc=_0x700c[_0x3bc537];return _0x2da5fc;};'use strict';var jayson=require('jayson/promise');var _=require(_0xc700('0x0'));var config=require(_0xc700('0x1'));exports[_0xc700('0x2')]=function(){return new Promise(function(_0x2adb93,_0x24ef03){var _0x2b1d08={};_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require(_0xc700('0x4')));_0x2b1d08=_['merge'](_0x2b1d08,require('../api/voiceExtension/voiceExtension.rpc'));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require('../api/voiceQueue/voiceQueue.rpc'));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require(_0xc700('0x5')));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require(_0xc700('0x6')));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require(_0xc700('0x7')));_0x2b1d08=_['merge'](_0x2b1d08,require(_0xc700('0x8')));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require(_0xc700('0x9')));_0x2b1d08=_['merge'](_0x2b1d08,require(_0xc700('0xa')));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require(_0xc700('0xb')));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require(_0xc700('0xc')));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require(_0xc700('0xd')));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require('../api/mailAccount/mailAccount.rpc'));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require(_0xc700('0xe')));_0x2b1d08=_['merge'](_0x2b1d08,require(_0xc700('0xf')));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require(_0xc700('0x10')));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require(_0xc700('0x11')));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require(_0xc700('0x12')));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require(_0xc700('0x13')));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require('../api/faxApplication/faxApplication.rpc'));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require('../api/faxInteraction/faxInteraction.rpc'));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require(_0xc700('0x14')));_0x2b1d08=_['merge'](_0x2b1d08,require(_0xc700('0x15')));_0x2b1d08=_['merge'](_0x2b1d08,require(_0xc700('0x16')));_0x2b1d08=_['merge'](_0x2b1d08,require(_0xc700('0x17')));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require(_0xc700('0x18')));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require(_0xc700('0x19')));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require('../api/smsQueue/smsQueue.rpc'));_0x2b1d08=_['merge'](_0x2b1d08,require(_0xc700('0x1a')));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require(_0xc700('0x1b')));_0x2b1d08=_['merge'](_0x2b1d08,require(_0xc700('0x1c')));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require(_0xc700('0x1d')));_0x2b1d08=_['merge'](_0x2b1d08,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require(_0xc700('0x1e')));_0x2b1d08=_['merge'](_0x2b1d08,require(_0xc700('0x1f')));_0x2b1d08=_['merge'](_0x2b1d08,require(_0xc700('0x20')));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require(_0xc700('0x21')));_0x2b1d08=_['merge'](_0x2b1d08,require(_0xc700('0x22')));_0x2b1d08=_['merge'](_0x2b1d08,require(_0xc700('0x23')));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require(_0xc700('0x24')));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require(_0xc700('0x25')));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require(_0xc700('0x26')));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require(_0xc700('0x27')));_0x2b1d08=_['merge'](_0x2b1d08,require(_0xc700('0x28')));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require(_0xc700('0x29')));_0x2b1d08=_['merge'](_0x2b1d08,require(_0xc700('0x2a')));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require(_0xc700('0x2b')));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require(_0xc700('0x2c')));_0x2b1d08=_['merge'](_0x2b1d08,require(_0xc700('0x2d')));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require(_0xc700('0x2e')));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require(_0xc700('0x2f')));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require(_0xc700('0x30')));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require(_0xc700('0x31')));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require(_0xc700('0x32')));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require('../api/squareReport/squareReport.rpc'));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require(_0xc700('0x33')));_0x2b1d08=_['merge'](_0x2b1d08,require(_0xc700('0x34')));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require(_0xc700('0x35')));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require(_0xc700('0x36')));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require(_0xc700('0x37')));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require(_0xc700('0x38')));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require(_0xc700('0x39')));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require(_0xc700('0x3a')));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require('../api/plugin/plugin.rpc'));_0x2b1d08=_['merge'](_0x2b1d08,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require(_0xc700('0x3b')));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require(_0xc700('0x3c')));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require(_0xc700('0x3d')));_0x2b1d08=_[_0xc700('0x3')](_0x2b1d08,require(_0xc700('0x3e')));var _0x4eb0c9=jayson[_0xc700('0x3f')](_0x2b1d08)['http']();var _0x1e0227=config['rpc'][_0xc700('0x40')]||config[_0xc700('0x40')]+0x1;var _0x4295da=config['rpc']['ip']||_0xc700('0x41');_0x4eb0c9['on'](_0xc700('0x42'),function(_0x397776){return _0x24ef03(_0x397776);});_0x4eb0c9['listen'](_0x1e0227,_0x4295da,function(){console[_0xc700('0x43')](_0xc700('0x44'),_0x4295da,_0x1e0227);require(_0xc700('0x45'))[_0xc700('0x46')]();return _0x2adb93(_0xc700('0x47')+_0x4295da+':'+_0x1e0227);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 06b6609..39b84f2 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 _0xe14a=['setEncoding','utf8','setTimeout','headers','emit','toLowerCase','hangup','search','520\x20End\x20of\x20proper','function','substring','no\x20code','replace','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','sync','prototype','answer','sendRequest','ANSWER','getData','beep','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','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','setVariable','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setContext','setPriority','getVariable','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','WAIT','exports','./error','call'];(function(_0x4bb145,_0x3e7d33){var _0x4db596=function(_0x144489){while(--_0x144489){_0x4bb145['push'](_0x4bb145['shift']());}};_0x4db596(++_0x3e7d33);}(_0xe14a,0x94));var _0xae14=function(_0x35c1ce,_0x3e3740){_0x35c1ce=_0x35c1ce-0x0;var _0x4c324b=_0xe14a[_0x35c1ce];return _0x4c324b;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require('events')['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0xae14('0x0'));function AGIChannel(_0xb92ae1){var _0x5cdfa7=this,_0x16bd5f=new AGIReply(),_0x2736f8=![],_0x2ec016={};EventEmitter[_0xae14('0x1')](_0x5cdfa7);_0xb92ae1[_0xae14('0x2')](_0xae14('0x3'));_0xb92ae1[_0xae14('0x4')](0x8*0x3c*0x3c*0x3e8);_0x16bd5f[_0xae14('0x2')](_0xae14('0x3'));_0x16bd5f['on'](_0xae14('0x5'),function(_0x103029){for(var _0x3b8063 in _0x103029){_0x5cdfa7[_0x3b8063]=_0x103029[_0x3b8063];}_0x5cdfa7[_0xae14('0x6')]('ready');});_0x16bd5f['on']('line',function(_0x2edf05){if(_0x2edf05[_0xae14('0x7')]()==_0xae14('0x8')){_0x5cdfa7[_0xae14('0x6')](_0xae14('0x8'));return;}if(_0x2edf05['substring'](0x0,0xb)=='520-Invalid'){_0x2736f8=!![];}if(_0x2736f8){_0x2ec016['rx']+=_0x2edf05+'\x0a';if(_0x2edf05[_0xae14('0x9')](_0xae14('0xa'))!=-0x1){_0x2736f8=![];}}else{_0x2ec016['rx']=_0x2edf05;}if(_0x2736f8){return;}if(typeof _0x2ec016['cb']==_0xae14('0xb')){var _0x1d795c=_0x2ec016['rx'][_0xae14('0xc')](0x0,0x3),_0x45f3e3=null,_0x1fb669=null;_0x1d795c=parseInt(_0x1d795c);if(isNaN(_0x1d795c)){_0x2ec016['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xae14('0xd')});return;}if(_0x1d795c!=0xc8){_0x2ec016['cb'](null,{'code':_0x1d795c,'result':-0x1,'extra':'KO'});return;}_0x45f3e3=_0x2ec016['rx'][_0xae14('0xc')](0x4)[_0xae14('0xe')]('result=','');if(_0x45f3e3[_0xae14('0xf')]('\x20')!=-0x1){_0x45f3e3=_0x45f3e3[_0xae14('0x10')](0x0,_0x45f3e3['indexOf']('\x20'));}if(_[_0xae14('0x11')](_0x45f3e3,'-1')){_0x45f3e3=parseInt(_0x45f3e3);}_0x1fb669=_0x2ec016['rx'][_0xae14('0x12')]('\x20');if(_0x1fb669[_0xae14('0x13')]==0x3){_0x1fb669=_0x1fb669[0x2][_0xae14('0xc')](0x1,_0x1fb669[0x2][_0xae14('0x13')]-0x1);}else if(_0x1fb669['length']>0x3){var _0x5c7cf7=/\((.+)\)/;var _0x40160f=_0x2ec016['rx'][_0xae14('0x14')](_0x5c7cf7);if(_0x40160f){_0x1fb669=_0x40160f[0x1];}else{_0x1fb669=null;}}else{_0x1fb669=null;}_0x2ec016['cb'](null,{'code':_0x1d795c,'result':_0x45f3e3,'extra':_0x1fb669});}});_0xb92ae1['on'](_0xae14('0x15'),function(_0x4913e7){_0x5cdfa7['emit'](_0xae14('0x15'),new AGIError(_0xae14('0x16'),_0x4913e7[_0xae14('0x17')]));});_0xb92ae1['on'](_0xae14('0x18'),function(){_0x5cdfa7[_0xae14('0x6')](_0xae14('0x18'),new AGIError(_0xae14('0x19')));});_0xb92ae1['on'](_0xae14('0x1a'),function(){_0x5cdfa7['emit'](_0xae14('0x1a'),new AGIError(_0xae14('0x1b')));_0xb92ae1[_0xae14('0x1c')]();});_0xb92ae1[_0xae14('0x1d')](_0x16bd5f);this[_0xae14('0x1e')]=function(_0x1e2fbc,_0x45fec8){var _0x1e2fbc=_0x1e2fbc||'',_0x45fec8=typeof _0x45fec8==_0xae14('0xb')?_0x45fec8:new Function();_0x2ec016={'tx':_0x1e2fbc,'rx':'','cb':_0x45fec8};_0xb92ae1[_0xae14('0x1f')](_0x1e2fbc+'\x0a');},this[_0xae14('0x18')]=function(){_0xb92ae1[_0xae14('0x1c')]();};}util[_0xae14('0x20')](AGIChannel,EventEmitter);AGIChannel['prototype']['sendRequest']=function(_0x5ca2f8){return this[_0xae14('0x1e')][_0xae14('0x21')](this,_0x5ca2f8);};AGIChannel[_0xae14('0x22')][_0xae14('0x23')]=function(){return this[_0xae14('0x24')](_0xae14('0x25'));};AGIChannel[_0xae14('0x22')][_0xae14('0x26')]=function(_0x30c9f1,_0x338ab0,_0x46d91e){_0x30c9f1=_0x30c9f1===undefined?_0xae14('0x27'):_0x30c9f1;_0x338ab0=_0x338ab0===undefined?'5':_0x338ab0;_0x46d91e=_0x46d91e===undefined?'1':_0x46d91e;return this['sendRequest'](util[_0xae14('0x28')](_0xae14('0x29'),_0x30c9f1,_0x338ab0*0x3e8,_0x46d91e));};AGIChannel[_0xae14('0x22')][_0xae14('0x2a')]=function(_0x43c0e8){_0x43c0e8=_0x43c0e8||_0xae14('0x2b');return this[_0xae14('0x24')](util['format'](_0xae14('0x2c'),_0x43c0e8));};AGIChannel[_0xae14('0x22')][_0xae14('0x2d')]=function(_0x5d3561,_0x535e79){if(_[_0xae14('0x2e')](_0x535e79)){return this[_0xae14('0x24')](util[_0xae14('0x28')](_0xae14('0x2f'),_0x5d3561,_0x535e79['join'](',')));}return this[_0xae14('0x24')](util[_0xae14('0x28')](_0xae14('0x2f'),_0x5d3561,_0x535e79));};AGIChannel['prototype']['setContext']=function(_0x584adc){return this[_0xae14('0x24')](util[_0xae14('0x28')](_0xae14('0x30'),_0x584adc));};AGIChannel['prototype'][_0xae14('0x31')]=function(_0x156ee5){return this[_0xae14('0x24')](util['format'](_0xae14('0x32'),_0x156ee5));};AGIChannel[_0xae14('0x22')]['setPriority']=function(_0x3fe77b){return this[_0xae14('0x24')](util[_0xae14('0x28')](_0xae14('0x33'),_0x3fe77b));};AGIChannel['prototype'][_0xae14('0x8')]=function(){return this[_0xae14('0x24')]('HANGUP');};AGIChannel[_0xae14('0x22')][_0xae14('0x34')]=function(_0x510a64,_0x482003){var _0x29680a=_['isBoolean'](_0x482003)||_[_0xae14('0x35')](_0x482003)?_0x482003[_0xae14('0x36')]():_0x482003;return this[_0xae14('0x24')](util['format'](_0xae14('0x37'),_0x510a64,_0x29680a?_0x29680a[_0xae14('0x36')]()[_0xae14('0xe')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xae14('0x22')][_0xae14('0x38')]=function(_0x7d969,_0x2e9410){return this['sendRequest'](util[_0xae14('0x28')](_0xae14('0x39'),_0x7d969,_0x2e9410));};AGIChannel[_0xae14('0x22')][_0xae14('0x3a')]=function(_0x1b4383,_0x138afc){return this[_0xae14('0x24')](util[_0xae14('0x28')](_0xae14('0x3b'),_0x1b4383,_0x138afc));};AGIChannel[_0xae14('0x22')][_0xae14('0x3c')]=function(_0x484f24,_0x5ae91b){return this[_0xae14('0x24')](util['format'](_0xae14('0x3d'),_0x484f24,_0x5ae91b));};AGIChannel[_0xae14('0x22')][_0xae14('0x3e')]=function(_0x5ac9a3,_0x1e19af,_0xab3352){_0x1e19af=_0x1e19af||this[_0xae14('0x3f')];_0xab3352=_0xab3352||0x1;this[_0xae14('0x40')](_0x5ac9a3);this['setExtension'](_0x1e19af);this[_0xae14('0x41')](_0xab3352);return this['noop'](util[_0xae14('0x28')]('GOTO\x20%s\x20%s\x20%s',_0x5ac9a3,_0x1e19af,_0xab3352));};AGIChannel[_0xae14('0x22')][_0xae14('0x42')]=function(_0x3cfc2c){return this['sendRequest'](util[_0xae14('0x28')]('GET\x20VARIABLE\x20\x22%s\x22',_0x3cfc2c));};AGIChannel[_0xae14('0x22')][_0xae14('0x43')]=function(_0x18f945,_0x4efda1,_0x1f3d81,_0x2452a2,_0x513934,_0x56d3d4){_0x4efda1=_0x4efda1||'wav';_0x1f3d81=_0x1f3d81||'';_0x2452a2=_0x2452a2===undefined?-0x1:_0x2452a2==='-1'?-0x1:_0x2452a2*0x3e8;_0x513934=_0x513934===undefined?'':'s='+_0x513934;_0x56d3d4=_0x56d3d4?_0xae14('0x44'):'';return this[_0xae14('0x24')](util['format'](_0xae14('0x45'),_0x18f945,_0x4efda1,_0x1f3d81,_0x2452a2,_0x56d3d4,_0x513934));};AGIChannel[_0xae14('0x22')][_0xae14('0x46')]=function(_0xa942ea,_0x17df55){_0x17df55=_0x17df55||'';return this[_0xae14('0x24')](util['format'](_0xae14('0x47'),_0xa942ea,_0x17df55));};AGIChannel[_0xae14('0x22')]['agi']=function(_0x3642a6){return this[_0xae14('0x2d')](_0xae14('0x48'),_0x3642a6);};AGIChannel['prototype']['wait']=function(_0xe44447){return this[_0xae14('0x2d')](_0xae14('0x49'),_0xe44447);};AGIChannel[_0xae14('0x22')][_0xae14('0x15')]=function(_0x443850,_0x578be2){this[_0xae14('0x2a')](util[_0xae14('0x28')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x443850['id'],_0x443850['label'],_0x578be2));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xae14('0x4a')]=AGIChannel; \ No newline at end of file +var _0x9269=['destroy','inherits','prototype','sendRequest','answer','ANSWER','getData','format','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','EXEC\x20%s\x20%s','join','setContext','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','replace','sayNumber','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','setExtension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','label','exports','util','events','EventEmitter','./reply','call','setEncoding','utf8','headers','emit','line','hangup','substring','520-Invalid','function','no\x20code','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','command','write'];(function(_0x2e1af3,_0x2a077b){var _0x4150cd=function(_0x1e08f3){while(--_0x1e08f3){_0x2e1af3['push'](_0x2e1af3['shift']());}};_0x4150cd(++_0x2a077b);}(_0x9269,0x147));var _0x9926=function(_0x146979,_0x4dfc32){_0x146979=_0x146979-0x0;var _0x103856=_0x9269[_0x146979];return _0x103856;};'use strict';var util=require(_0x9926('0x0'));var _=require('lodash');var EventEmitter=require(_0x9926('0x1'))[_0x9926('0x2')];var AGIReply=require(_0x9926('0x3'));var AGIError=require('./error');function AGIChannel(_0x596e44){var _0x5dd517=this,_0x417cbf=new AGIReply(),_0x196e8f=![],_0x3056c3={};EventEmitter[_0x9926('0x4')](_0x5dd517);_0x596e44[_0x9926('0x5')](_0x9926('0x6'));_0x596e44['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x417cbf[_0x9926('0x5')](_0x9926('0x6'));_0x417cbf['on'](_0x9926('0x7'),function(_0xe67af7){for(var _0xd433fe in _0xe67af7){_0x5dd517[_0xd433fe]=_0xe67af7[_0xd433fe];}_0x5dd517[_0x9926('0x8')]('ready');});_0x417cbf['on'](_0x9926('0x9'),function(_0x99de72){if(_0x99de72['toLowerCase']()=='hangup'){_0x5dd517[_0x9926('0x8')](_0x9926('0xa'));return;}if(_0x99de72[_0x9926('0xb')](0x0,0xb)==_0x9926('0xc')){_0x196e8f=!![];}if(_0x196e8f){_0x3056c3['rx']+=_0x99de72+'\x0a';if(_0x99de72['search']('520\x20End\x20of\x20proper')!=-0x1){_0x196e8f=![];}}else{_0x3056c3['rx']=_0x99de72;}if(_0x196e8f){return;}if(typeof _0x3056c3['cb']==_0x9926('0xd')){var _0x40bb2e=_0x3056c3['rx']['substring'](0x0,0x3),_0x43412b=null,_0x182de2=null;_0x40bb2e=parseInt(_0x40bb2e);if(isNaN(_0x40bb2e)){_0x3056c3['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x9926('0xe')});return;}if(_0x40bb2e!=0xc8){_0x3056c3['cb'](null,{'code':_0x40bb2e,'result':-0x1,'extra':'KO'});return;}_0x43412b=_0x3056c3['rx'][_0x9926('0xb')](0x4)['replace']('result=','');if(_0x43412b[_0x9926('0xf')]('\x20')!=-0x1){_0x43412b=_0x43412b['substr'](0x0,_0x43412b[_0x9926('0xf')]('\x20'));}if(_[_0x9926('0x10')](_0x43412b,'-1')){_0x43412b=parseInt(_0x43412b);}_0x182de2=_0x3056c3['rx'][_0x9926('0x11')]('\x20');if(_0x182de2['length']==0x3){_0x182de2=_0x182de2[0x2][_0x9926('0xb')](0x1,_0x182de2[0x2][_0x9926('0x12')]-0x1);}else if(_0x182de2[_0x9926('0x12')]>0x3){var _0x1b2924=/\((.+)\)/;var _0x1f195d=_0x3056c3['rx'][_0x9926('0x13')](_0x1b2924);if(_0x1f195d){_0x182de2=_0x1f195d[0x1];}else{_0x182de2=null;}}else{_0x182de2=null;}_0x3056c3['cb'](null,{'code':_0x40bb2e,'result':_0x43412b,'extra':_0x182de2});}});_0x596e44['on'](_0x9926('0x14'),function(_0x1fbfae){_0x5dd517['emit']('error',new AGIError(_0x9926('0x15'),_0x1fbfae[_0x9926('0x16')]));});_0x596e44['on'](_0x9926('0x17'),function(){_0x5dd517[_0x9926('0x8')](_0x9926('0x17'),new AGIError(_0x9926('0x18')));});_0x596e44['on']('timeout',function(){_0x5dd517['emit'](_0x9926('0x19'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x596e44['destroy']();});_0x596e44['pipe'](_0x417cbf);this[_0x9926('0x1a')]=function(_0x25036e,_0x9c88ad){var _0x25036e=_0x25036e||'',_0x9c88ad=typeof _0x9c88ad==_0x9926('0xd')?_0x9c88ad:new Function();_0x3056c3={'tx':_0x25036e,'rx':'','cb':_0x9c88ad};_0x596e44[_0x9926('0x1b')](_0x25036e+'\x0a');},this[_0x9926('0x17')]=function(){_0x596e44[_0x9926('0x1c')]();};}util[_0x9926('0x1d')](AGIChannel,EventEmitter);AGIChannel[_0x9926('0x1e')][_0x9926('0x1f')]=function(_0x358af4){return this['command']['sync'](this,_0x358af4);};AGIChannel['prototype'][_0x9926('0x20')]=function(){return this[_0x9926('0x1f')](_0x9926('0x21'));};AGIChannel[_0x9926('0x1e')][_0x9926('0x22')]=function(_0x37a9b7,_0x34607f,_0x2fb84b){_0x37a9b7=_0x37a9b7===undefined?'beep':_0x37a9b7;_0x34607f=_0x34607f===undefined?'5':_0x34607f;_0x2fb84b=_0x2fb84b===undefined?'1':_0x2fb84b;return this[_0x9926('0x1f')](util[_0x9926('0x23')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x37a9b7,_0x34607f*0x3e8,_0x2fb84b));};AGIChannel[_0x9926('0x1e')][_0x9926('0x24')]=function(_0x515d91){_0x515d91=_0x515d91||_0x9926('0x25');return this[_0x9926('0x1f')](util[_0x9926('0x23')](_0x9926('0x26'),_0x515d91));};AGIChannel[_0x9926('0x1e')][_0x9926('0x27')]=function(_0x589bf4,_0x40065c){if(_['isArray'](_0x40065c)){return this[_0x9926('0x1f')](util['format'](_0x9926('0x28'),_0x589bf4,_0x40065c[_0x9926('0x29')](',')));}return this[_0x9926('0x1f')](util['format'](_0x9926('0x28'),_0x589bf4,_0x40065c));};AGIChannel['prototype'][_0x9926('0x2a')]=function(_0x460198){return this['sendRequest'](util[_0x9926('0x23')]('SET\x20CONTEXT\x20%s',_0x460198));};AGIChannel[_0x9926('0x1e')]['setExtension']=function(_0x638f43){return this[_0x9926('0x1f')](util[_0x9926('0x23')]('SET\x20EXTENSION\x20%s',_0x638f43));};AGIChannel[_0x9926('0x1e')][_0x9926('0x2b')]=function(_0x534bbb){return this[_0x9926('0x1f')](util[_0x9926('0x23')](_0x9926('0x2c'),_0x534bbb));};AGIChannel[_0x9926('0x1e')][_0x9926('0xa')]=function(){return this[_0x9926('0x1f')](_0x9926('0x2d'));};AGIChannel[_0x9926('0x1e')][_0x9926('0x2e')]=function(_0x1ce0f7,_0x1cb564){var _0x1fb76b=_[_0x9926('0x2f')](_0x1cb564)||_[_0x9926('0x30')](_0x1cb564)?_0x1cb564[_0x9926('0x31')]():_0x1cb564;return this['sendRequest'](util[_0x9926('0x23')](_0x9926('0x32'),_0x1ce0f7,_0x1fb76b?_0x1fb76b['toString']()[_0x9926('0x33')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x9926('0x1e')][_0x9926('0x34')]=function(_0x2518e1,_0xdbe40c){return this[_0x9926('0x1f')](util[_0x9926('0x23')]('SAY\x20NUMBER\x20%s\x20%s',_0x2518e1,_0xdbe40c));};AGIChannel[_0x9926('0x1e')]['sayDigits']=function(_0x3659f7,_0x15f5bc){return this['sendRequest'](util[_0x9926('0x23')](_0x9926('0x35'),_0x3659f7,_0x15f5bc));};AGIChannel[_0x9926('0x1e')][_0x9926('0x36')]=function(_0x189225,_0x2fe543){return this[_0x9926('0x1f')](util[_0x9926('0x23')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x189225,_0x2fe543));};AGIChannel['prototype'][_0x9926('0x37')]=function(_0x3e4bad,_0x428381,_0x413a40){_0x428381=_0x428381||this['extension'];_0x413a40=_0x413a40||0x1;this['setContext'](_0x3e4bad);this[_0x9926('0x38')](_0x428381);this[_0x9926('0x2b')](_0x413a40);return this[_0x9926('0x24')](util[_0x9926('0x23')](_0x9926('0x39'),_0x3e4bad,_0x428381,_0x413a40));};AGIChannel['prototype'][_0x9926('0x3a')]=function(_0xb05e1e){return this[_0x9926('0x1f')](util[_0x9926('0x23')](_0x9926('0x3b'),_0xb05e1e));};AGIChannel['prototype']['recordFile']=function(_0x92ab41,_0x5cdc6c,_0x463011,_0x2c4528,_0xc19100,_0x139649){_0x5cdc6c=_0x5cdc6c||_0x9926('0x3c');_0x463011=_0x463011||'';_0x2c4528=_0x2c4528===undefined?-0x1:_0x2c4528==='-1'?-0x1:_0x2c4528*0x3e8;_0xc19100=_0xc19100===undefined?'':'s='+_0xc19100;_0x139649=_0x139649?_0x9926('0x3d'):'';return this[_0x9926('0x1f')](util[_0x9926('0x23')](_0x9926('0x3e'),_0x92ab41,_0x5cdc6c,_0x463011,_0x2c4528,_0x139649,_0xc19100));};AGIChannel[_0x9926('0x1e')][_0x9926('0x3f')]=function(_0x1eb890,_0x100fb7){_0x100fb7=_0x100fb7||'';return this['sendRequest'](util[_0x9926('0x23')](_0x9926('0x40'),_0x1eb890,_0x100fb7));};AGIChannel[_0x9926('0x1e')][_0x9926('0x41')]=function(_0x348f37){return this['exec'](_0x9926('0x42'),_0x348f37);};AGIChannel[_0x9926('0x1e')][_0x9926('0x43')]=function(_0x2db753){return this[_0x9926('0x27')](_0x9926('0x44'),_0x2db753);};AGIChannel['prototype'][_0x9926('0x14')]=function(_0x3f93c7,_0x3a127c){this['noop'](util[_0x9926('0x23')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x3f93c7['id'],_0x3f93c7[_0x9926('0x45')],_0x3a127c));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x9926('0x46')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index dfac844..b8eb1cd 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 _0x25ab=['util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','format','apply','message'];(function(_0x51e42a,_0x2e2098){var _0x483535=function(_0x2f453a){while(--_0x2f453a){_0x51e42a['push'](_0x51e42a['shift']());}};_0x483535(++_0x2e2098);}(_0x25ab,0x170));var _0xb25a=function(_0x50c74c,_0x525747){_0x50c74c=_0x50c74c-0x0;var _0x1da5d2=_0x25ab[_0x50c74c];return _0x1da5d2;};'use strict';var util=require(_0xb25a('0x0'));var error={'E_AGI_UNDEFINED':_0xb25a('0x1'),'E_AGI_ARGUMENT_PORT':_0xb25a('0x2'),'E_AGI_SERVER_ERROR':_0xb25a('0x3'),'E_AGI_SERVER_CLOSE':_0xb25a('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0xb25a('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0xb25a('0x6'),'E_AGI_SOCKET_ERROR':_0xb25a('0x7'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0xb25a('0x8'),'E_AGI_COMMAND_EMPTY':_0xb25a('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xb25a('0xa'),'E_AGI_IVR_ENTRY':_0xb25a('0xb')};function AGIError(_0x4b6eeb){var _0x4b6eeb=_0x4b6eeb||null,_0x45ef18=_0x45ef18||[],_0x1f98f9=0x1,_0x4901e5='';if(!error[_0x4b6eeb]){_0x4b6eeb=_0xb25a('0xc');}_0x45ef18['push'](error[_0x4b6eeb]);while(arguments[_0x1f98f9]){_0x45ef18['push'](arguments[_0x1f98f9]);_0x1f98f9++;}_0x4901e5=util[_0xb25a('0xd')][_0xb25a('0xe')](util,_0x45ef18);this[_0xb25a('0xf')]=_0x4901e5;this['name']=_0x4b6eeb;}module['exports']=AGIError; \ No newline at end of file +var _0xf7f2=['push','apply','message','name','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf7f2,0x112));var _0x2f7f=function(_0x1301aa,_0x4da5c4){_0x1301aa=_0x1301aa-0x0;var _0x5146a1=_0xf7f2[_0x1301aa];return _0x5146a1;};'use strict';var util=require(_0x2f7f('0x0'));var error={'E_AGI_UNDEFINED':_0x2f7f('0x1'),'E_AGI_ARGUMENT_PORT':_0x2f7f('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x2f7f('0x3'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x2f7f('0x4'),'E_AGI_SOCKET_CLOSE':_0x2f7f('0x5'),'E_AGI_SOCKET_TIMEOUT':_0x2f7f('0x6'),'E_AGI_COMMAND_EMPTY':_0x2f7f('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x2f7f('0x8'),'E_AGI_IVR_ENTRY':_0x2f7f('0x9')};function AGIError(_0x58295f){var _0x58295f=_0x58295f||null,_0x348336=_0x348336||[],_0x56ccef=0x1,_0x52f851='';if(!error[_0x58295f]){_0x58295f=_0x2f7f('0xa');}_0x348336[_0x2f7f('0xb')](error[_0x58295f]);while(arguments[_0x56ccef]){_0x348336[_0x2f7f('0xb')](arguments[_0x56ccef]);_0x56ccef++;}_0x52f851=util['format'][_0x2f7f('0xc')](util,_0x348336);this[_0x2f7f('0xd')]=_0x52f851;this[_0x2f7f('0xe')]=_0x58295f;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index da3b8d5..af70447 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 _0xd68a=['error','E_AGI_SERVER_ERROR','message','agi','parse','exports','lodash','events','EventEmitter','ioredis','./error','defaults','redis','localhost','subscribe','emit'];(function(_0x144b30,_0x77072d){var _0x1bb7bc=function(_0x1082cc){while(--_0x1082cc){_0x144b30['push'](_0x144b30['shift']());}};_0x1bb7bc(++_0x77072d);}(_0xd68a,0x136));var _0xad68=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xd68a[_0x2ec461];return _0x28603d;};'use strict';var _=require(_0xad68('0x0'));var EventEmitter=require(_0xad68('0x1'))[_0xad68('0x2')];var Redis=require(_0xad68('0x3'));var AGIError=require(_0xad68('0x4'));var config=require('../../config/environment');config['redis']=_[_0xad68('0x5')](config[_0xad68('0x6')],{'host':_0xad68('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xad68('0x6')]);sub[_0xad68('0x8')]('agi',function(_0x360fad){if(_0x360fad)return eventEmitter[_0xad68('0x9')](_0xad68('0xa'),new AGIError(_0xad68('0xb'),_0x360fad));});sub['on'](_0xad68('0xc'),function(_0x48be91,_0x141f17){if(_0x48be91!==_0xad68('0xd'))return;try{var _0x48cf88=JSON[_0xad68('0xe')](_0x141f17);eventEmitter[_0xad68('0x9')]('projectUpdate',_0x48cf88);}catch(_0x3fa7cb){eventEmitter['emit'](_0xad68('0xa'),new AGIError('E_AGI_SERVER_ERROR',_0x3fa7cb));}});module[_0xad68('0xf')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x593b=['emit','E_AGI_SERVER_ERROR','message','parse','projectUpdate','error','exports','lodash','events','EventEmitter','ioredis','./error','../../config/environment','redis','defaults','localhost','agi'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x593b,0x8f));var _0xb593=function(_0x3ec030,_0x1dba95){_0x3ec030=_0x3ec030-0x0;var _0xe14165=_0x593b[_0x3ec030];return _0xe14165;};'use strict';var _=require(_0xb593('0x0'));var EventEmitter=require(_0xb593('0x1'))[_0xb593('0x2')];var Redis=require(_0xb593('0x3'));var AGIError=require(_0xb593('0x4'));var config=require(_0xb593('0x5'));config[_0xb593('0x6')]=_[_0xb593('0x7')](config[_0xb593('0x6')],{'host':_0xb593('0x8'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xb593('0x6')]);sub['subscribe'](_0xb593('0x9'),function(_0x4f0ed7){if(_0x4f0ed7)return eventEmitter[_0xb593('0xa')]('error',new AGIError(_0xb593('0xb'),_0x4f0ed7));});sub['on'](_0xb593('0xc'),function(_0x4d0a34,_0x1bd9a4){if(_0x4d0a34!=='agi')return;try{var _0x57a478=JSON[_0xb593('0xd')](_0x1bd9a4);eventEmitter[_0xb593('0xa')](_0xb593('0xe'),_0x57a478);}catch(_0x4737a2){eventEmitter[_0xb593('0xa')](_0xb593('0xf'),new AGIError('E_AGI_SERVER_ERROR',_0x4737a2));}});module[_0xb593('0x10')]={'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 346cdf8..cb8a41e 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 _0xb06f=['agi','menu','getsecretdigits','vertices','edges','prototype','addEdge','push','numberOfEdges','size','getVertex','traverseBFS','no\x20vertex\x20found','info','stop\x20traverse','length','condition','split','agicommand','target','vswitch','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','../../../config/logger'];(function(_0x4ca3b4,_0x2450bc){var _0x51ea64=function(_0x1bdfd4){while(--_0x1bdfd4){_0x4ca3b4['push'](_0x4ca3b4['shift']());}};_0x51ea64(++_0x2450bc);}(_0xb06f,0xf2));var _0xfb06=function(_0x143508,_0x3a583c){_0x143508=_0x143508-0x0;var _0x3e9755=_0xb06f[_0x143508];return _0x3e9755;};'use strict';var _=require('lodash');var logger=require(_0xfb06('0x0'))(_0xfb06('0x1'));var verticesWithRetry=[_0xfb06('0x2'),'getdigits',_0xfb06('0x3')];var Graph=function(){this[_0xfb06('0x4')]={};this[_0xfb06('0x5')]={};this['numberOfEdges']=0x0;};Graph[_0xfb06('0x6')]['addVertex']=function(_0x10b32f){this[_0xfb06('0x4')][_0x10b32f['id']]=_0x10b32f;this[_0xfb06('0x5')][_0x10b32f['id']]=[];};Graph['prototype'][_0xfb06('0x7')]=function(_0x1414fd,_0x91cdd5,_0x1dd760){this['edges'][_0x1414fd][_0xfb06('0x8')]({'target':_0x91cdd5,'condition':_0x1dd760});this[_0xfb06('0x9')]+=0x1;};Graph[_0xfb06('0x6')][_0xfb06('0xa')]=function(){return _[_0xfb06('0xa')](this[_0xfb06('0x4')]);};Graph[_0xfb06('0x6')]['relations']=function(){return this[_0xfb06('0x9')];};Graph[_0xfb06('0x6')][_0xfb06('0xb')]=function(_0x3d0647){return this[_0xfb06('0x4')][_0x3d0647];};Graph[_0xfb06('0x6')][_0xfb06('0xc')]=function(_0x1454db,_0x4b968a){if(!this['vertices'][_0x1454db]){return logger['info'](_0xfb06('0xd'));}var _0x51d74c=_0x4b968a(this[_0xfb06('0x4')][_0x1454db]);if(!_0x51d74c){return logger[_0xfb06('0xe')](_0xfb06('0xf'));}if(this[_0xfb06('0x5')][_0x1454db][_0xfb06('0x10')]===0x0){return logger[_0xfb06('0xe')]('no\x20edge/s\x20available');}for(var _0x10dd3f=0x0,_0x186229=[],_0x29c9db=![];_0x10dd3f\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','find','production','handleUnpublished','initialize','getLicense','voice','[LICENSE]\x20CHANNELS:\x20%s','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','finally','./server','listening','connection','syncho','util','../../config/environment','../../config/logger','./project','./events','EventEmitter','agi','defaults','nextTick','findIndex','deleted','splice','push','error','stack','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','format','message','[%s]\x20%s','name','[ERROR]\x20%s','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch'];(function(_0x535784,_0x3cf9d9){var _0x2356d7=function(_0x4e7ba1){while(--_0x4e7ba1){_0x535784['push'](_0x535784['shift']());}};_0x2356d7(++_0x3cf9d9);}(_0xe454,0x138));var _0x4e45=function(_0x16e738,_0x59d6b4){_0x16e738=_0x16e738-0x0;var _0x40de75=_0xe454[_0x16e738];return _0x40de75;};'use strict';var _=require('lodash');var syncho=require(_0x4e45('0x0'));var util=require(_0x4e45('0x1'));var config=require(_0x4e45('0x2'));var logger=require(_0x4e45('0x3'))('agi');var utilLicense=require('../../config/license/util');var rpc=require('./rpc');var Project=require(_0x4e45('0x4'));var AGIEmitter=require(_0x4e45('0x5'))[_0x4e45('0x6')];var projects=[];config[_0x4e45('0x7')]=_[_0x4e45('0x8')](config[_0x4e45('0x7')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x24e3e2){process[_0x4e45('0x9')](function(){syncho(function(){try{setChannelVariables(_0x24e3e2);agiHandler(_0x24e3e2);}catch(_0x10fefe){logger['error'](_0x10fefe['stack']);}});});}function projectUpdateHandler(_0x3ac1f5){try{var _0x59a704=_[_0x4e45('0xa')](projects,['id',_0x3ac1f5['id']]);if(_0x59a704>-0x1){if(_0x3ac1f5[_0x4e45('0xb')]===!![]){projects[_0x4e45('0xc')](_0x59a704,0x1);}else{projects[_0x59a704]=_0x3ac1f5;}}else{projects[_0x4e45('0xd')](_0x3ac1f5);}}catch(_0x104f3c){logger[_0x4e45('0xe')](_0x104f3c[_0x4e45('0xf')]);}}function listeningHandler(){console['log'](_0x4e45('0x10'),config[_0x4e45('0x7')][_0x4e45('0x11')]);logger['info'](util[_0x4e45('0x12')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x4e45('0x7')]['ip'],config[_0x4e45('0x7')][_0x4e45('0x11')]));}function errorHandler(_0x3bc1eb){if(_0x3bc1eb&&_0x3bc1eb['name']&&_0x3bc1eb[_0x4e45('0x13')]){logger[_0x4e45('0xe')](util['format'](_0x4e45('0x14'),_0x3bc1eb[_0x4e45('0x15')],_0x3bc1eb[_0x4e45('0x13')]));}else{logger[_0x4e45('0xe')](util[_0x4e45('0x12')](_0x4e45('0x16'),_0x3bc1eb[_0x4e45('0xf')]));}}function closeHandler(){logger[_0x4e45('0x17')](util['format'](_0x4e45('0x18'),this['arg_1'],this[_0x4e45('0x19')],this[_0x4e45('0x1a')],this['dnid'],this[_0x4e45('0x1b')]));try{createSquareReport(this);}catch(_0x24d234){logger['error'](_0x24d234[_0x4e45('0xf')]);}}function timeoutHandler(){logger['info'](util[_0x4e45('0x12')](_0x4e45('0x1c'),this[_0x4e45('0x1d')],this[_0x4e45('0x19')],this[_0x4e45('0x1a')],this[_0x4e45('0x1e')],this[_0x4e45('0x1b')]));}function hangupHandler(){logger[_0x4e45('0x17')](util['format'](_0x4e45('0x1f'),this[_0x4e45('0x1d')],this['calleridname'],this[_0x4e45('0x1a')],this[_0x4e45('0x1e')],this['uniqueid']));this[_0x4e45('0x20')]=!![];}function createSquareReport(_0x2f2c97,_0x5d9859){rpc[_0x4e45('0x21')](_0x2f2c97)[_0x4e45('0x22')](function(_0x531c9b){if(_0x5d9859){_0x5d9859(null,_0x531c9b);}})[_0x4e45('0x23')](function(_0x32cf3f){if(_0x5d9859){_0x5d9859(null,_0x32cf3f);}});}function setChannelVariables(_0x2018f8){for(var _0x217bf0 in _0x2018f8){if(_0x2018f8[_0x4e45('0x24')](_0x217bf0)){if(_0x217bf0[_0x4e45('0x25')](_0x4e45('0x26'))===0x0){_0x2018f8[_0x217bf0[_0x4e45('0x27')](0x4)]=_0x2018f8[_0x217bf0];delete _0x2018f8[_0x217bf0];}}}}function agiHandler(_0x4da9b0){logger['debug'](_0x4e45('0x28'),JSON['stringify'](_0x4da9b0,null,0x2));logger[_0x4e45('0x17')](util[_0x4e45('0x12')](_0x4e45('0x29'),_0x4da9b0['arg_1'],_0x4da9b0[_0x4e45('0x19')],_0x4da9b0[_0x4e45('0x1a')],_0x4da9b0[_0x4e45('0x1e')],_0x4da9b0[_0x4e45('0x1b')]));_0x4da9b0['on'](_0x4e45('0xe'),errorHandler);_0x4da9b0['on'](_0x4e45('0x2a'),closeHandler);_0x4da9b0['on']('timeout',timeoutHandler);_0x4da9b0[_0x4e45('0x20')]=![];_0x4da9b0['on']('hangup',hangupHandler);var _0x302f91=_[_0x4e45('0x2b')](projects,[_0x4e45('0x15'),_0x4da9b0[_0x4e45('0x1d')]]);if(!_0x302f91)return Project['handleNotFound'](_0x4da9b0);if(!_0x302f91[_0x4e45('0x2c')])return Project[_0x4e45('0x2d')](_0x4da9b0);return Project[_0x4e45('0x2e')](_0x302f91,_0x4da9b0);}function main(){var _0xebebbc;return utilLicense[_0x4e45('0x2f')]()[_0x4e45('0x22')](function(_0x311fb3){if(!_0x311fb3)return;if(_0x311fb3[_0x4e45('0x30')]){if(_0x311fb3['callysquare']&&_0x311fb3['callysquare']>0x0){logger[_0x4e45('0x17')](util[_0x4e45('0x12')](_0x4e45('0x31'),_0x311fb3[_0x4e45('0x32')]));_0xebebbc=_0x311fb3[_0x4e45('0x32')];}else{logger[_0x4e45('0x17')](_0x4e45('0x33'));}}else{logger[_0x4e45('0x17')](_0x4e45('0x34'));_0xebebbc=-0x1;}})[_0x4e45('0x22')](function(){return Project['getAll']();})['then'](function(_0x5f4d46){projects=_0x5f4d46;return;})[_0x4e45('0x23')](function(_0x208e8a){logger[_0x4e45('0xe')](_0x4e45('0x35'),_0x208e8a['stack']);})[_0x4e45('0x36')](function(){var _0xb978b6=require(_0x4e45('0x37'))(config[_0x4e45('0x7')][_0x4e45('0x11')],config[_0x4e45('0x7')]['ip'],_0xebebbc);_0xb978b6['on'](_0x4e45('0xe'),errorHandler);_0xb978b6['on'](_0x4e45('0x38'),listeningHandler);_0xb978b6['on'](_0x4e45('0x39'),connectionHandler);_0xb978b6['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0x0b75=['voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','listening','connection','lodash','syncho','util','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','EventEmitter','defaults','127.0.0.1','projectUpdate','nextTick','error','stack','findIndex','deleted','push','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','[%s]\x20%s','name','message','arg_1','calleridname','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','createSquareReport','then','catch','hasOwnProperty','indexOf','agi_','substring','debug','variables','stringify','close','timeout','evtHangup','hangup','find','handleNotFound','production','handleUnpublished','initialize','getLicense'];(function(_0x3c2cf7,_0x189dc6){var _0x5c219d=function(_0x23c32a){while(--_0x23c32a){_0x3c2cf7['push'](_0x3c2cf7['shift']());}};_0x5c219d(++_0x189dc6);}(_0x0b75,0x1ca));var _0x50b7=function(_0x43d47b,_0x21e7b8){_0x43d47b=_0x43d47b-0x0;var _0x468fb3=_0x0b75[_0x43d47b];return _0x468fb3;};'use strict';var _=require(_0x50b7('0x0'));var syncho=require(_0x50b7('0x1'));var util=require(_0x50b7('0x2'));var config=require(_0x50b7('0x3'));var logger=require(_0x50b7('0x4'))(_0x50b7('0x5'));var utilLicense=require(_0x50b7('0x6'));var rpc=require(_0x50b7('0x7'));var Project=require('./project');var AGIEmitter=require('./events')[_0x50b7('0x8')];var projects=[];config[_0x50b7('0x5')]=_[_0x50b7('0x9')](config['agi'],{'ip':_0x50b7('0xa'),'port':0x11dd});AGIEmitter['on'](_0x50b7('0xb'),projectUpdateHandler);function connectionHandler(_0x391181){process[_0x50b7('0xc')](function(){syncho(function(){try{setChannelVariables(_0x391181);agiHandler(_0x391181);}catch(_0x53072d){logger[_0x50b7('0xd')](_0x53072d[_0x50b7('0xe')]);}});});}function projectUpdateHandler(_0x2320f6){try{var _0x4f12a6=_[_0x50b7('0xf')](projects,['id',_0x2320f6['id']]);if(_0x4f12a6>-0x1){if(_0x2320f6[_0x50b7('0x10')]===!![]){projects['splice'](_0x4f12a6,0x1);}else{projects[_0x4f12a6]=_0x2320f6;}}else{projects[_0x50b7('0x11')](_0x2320f6);}}catch(_0x429bf3){logger[_0x50b7('0xd')](_0x429bf3['stack']);}}function listeningHandler(){console[_0x50b7('0x12')](_0x50b7('0x13'),config[_0x50b7('0x5')][_0x50b7('0x14')]);logger[_0x50b7('0x15')](util[_0x50b7('0x16')](_0x50b7('0x17'),config[_0x50b7('0x5')]['ip'],config[_0x50b7('0x5')][_0x50b7('0x14')]));}function errorHandler(_0x12de44){if(_0x12de44&&_0x12de44['name']&&_0x12de44['message']){logger[_0x50b7('0xd')](util['format'](_0x50b7('0x18'),_0x12de44[_0x50b7('0x19')],_0x12de44[_0x50b7('0x1a')]));}else{logger[_0x50b7('0xd')](util[_0x50b7('0x16')]('[ERROR]\x20%s',_0x12de44['stack']));}}function closeHandler(){logger[_0x50b7('0x15')](util[_0x50b7('0x16')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x50b7('0x1b')],this[_0x50b7('0x1c')],this[_0x50b7('0x1d')],this[_0x50b7('0x1e')],this['uniqueid']));try{createSquareReport(this);}catch(_0x1f6eb8){logger[_0x50b7('0xd')](_0x1f6eb8[_0x50b7('0xe')]);}}function timeoutHandler(){logger['info'](util[_0x50b7('0x16')](_0x50b7('0x1f'),this[_0x50b7('0x1b')],this[_0x50b7('0x1c')],this[_0x50b7('0x1d')],this[_0x50b7('0x1e')],this[_0x50b7('0x20')]));}function hangupHandler(){logger[_0x50b7('0x15')](util[_0x50b7('0x16')](_0x50b7('0x21'),this[_0x50b7('0x1b')],this[_0x50b7('0x1c')],this['callerid'],this[_0x50b7('0x1e')],this[_0x50b7('0x20')]));this['evtHangup']=!![];}function createSquareReport(_0x2a400b,_0x240fdf){rpc[_0x50b7('0x22')](_0x2a400b)[_0x50b7('0x23')](function(_0x114b6e){if(_0x240fdf){_0x240fdf(null,_0x114b6e);}})[_0x50b7('0x24')](function(_0xe2e2fc){if(_0x240fdf){_0x240fdf(null,_0xe2e2fc);}});}function setChannelVariables(_0x40da6d){for(var _0x108bd4 in _0x40da6d){if(_0x40da6d[_0x50b7('0x25')](_0x108bd4)){if(_0x108bd4[_0x50b7('0x26')](_0x50b7('0x27'))===0x0){_0x40da6d[_0x108bd4[_0x50b7('0x28')](0x4)]=_0x40da6d[_0x108bd4];delete _0x40da6d[_0x108bd4];}}}}function agiHandler(_0x54f462){logger[_0x50b7('0x29')](_0x50b7('0x2a'),JSON[_0x50b7('0x2b')](_0x54f462,null,0x2));logger['info'](util[_0x50b7('0x16')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x54f462[_0x50b7('0x1b')],_0x54f462[_0x50b7('0x1c')],_0x54f462['callerid'],_0x54f462[_0x50b7('0x1e')],_0x54f462[_0x50b7('0x20')]));_0x54f462['on'](_0x50b7('0xd'),errorHandler);_0x54f462['on'](_0x50b7('0x2c'),closeHandler);_0x54f462['on'](_0x50b7('0x2d'),timeoutHandler);_0x54f462[_0x50b7('0x2e')]=![];_0x54f462['on'](_0x50b7('0x2f'),hangupHandler);var _0x3e7df7=_[_0x50b7('0x30')](projects,[_0x50b7('0x19'),_0x54f462[_0x50b7('0x1b')]]);if(!_0x3e7df7)return Project[_0x50b7('0x31')](_0x54f462);if(!_0x3e7df7[_0x50b7('0x32')])return Project[_0x50b7('0x33')](_0x54f462);return Project[_0x50b7('0x34')](_0x3e7df7,_0x54f462);}function main(){var _0x12bba0;return utilLicense[_0x50b7('0x35')]()['then'](function(_0x303613){if(!_0x303613)return;if(_0x303613[_0x50b7('0x36')]){if(_0x303613[_0x50b7('0x37')]&&_0x303613[_0x50b7('0x37')]>0x0){logger[_0x50b7('0x15')](util['format'](_0x50b7('0x38'),_0x303613[_0x50b7('0x37')]));_0x12bba0=_0x303613[_0x50b7('0x37')];}else{logger['info'](_0x50b7('0x39'));}}else{logger[_0x50b7('0x15')](_0x50b7('0x3a'));_0x12bba0=-0x1;}})['then'](function(){return Project[_0x50b7('0x3b')]();})[_0x50b7('0x23')](function(_0x5b59cf){projects=_0x5b59cf;return;})[_0x50b7('0x24')](function(_0x33e3e2){logger[_0x50b7('0xd')](_0x50b7('0x3c'),_0x33e3e2[_0x50b7('0xe')]);})[_0x50b7('0x3d')](function(){var _0x5027f0=require('./server')(config[_0x50b7('0x5')]['port'],config[_0x50b7('0x5')]['ip'],_0x12bba0);_0x5027f0['on']('error',errorHandler);_0x5027f0['on'](_0x50b7('0x3e'),listeningHandler);_0x5027f0['on'](_0x50b7('0x3f'),connectionHandler);_0x5027f0['on'](_0x50b7('0x2c'),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 db0500c..f2bccee 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 _0x6e3b=['request','then','error','result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http'];(function(_0x45ea78,_0x31678e){var _0xd722b7=function(_0x25710a){while(--_0x25710a){_0x45ea78['push'](_0x45ea78['shift']());}};_0xd722b7(++_0x31678e);}(_0x6e3b,0x1d5));var _0xb6e3=function(_0x593303,_0x4e7e34){_0x593303=_0x593303-0x0;var _0x36b5bb=_0x6e3b[_0x593303];return _0x36b5bb;};'use strict';var BPromise=require(_0xb6e3('0x0'));var jayson=require(_0xb6e3('0x1'));var client=jayson[_0xb6e3('0x2')][_0xb6e3('0x3')]({'port':0x232b});function request(_0x12f7f4,_0x2c30af){return new BPromise(function(_0x47bf65,_0x1a495a){return client[_0xb6e3('0x4')](_0x12f7f4,_0x2c30af)[_0xb6e3('0x5')](function(_0x55c5ea){if(_0x55c5ea['error']){return _0x1a495a(_0x55c5ea[_0xb6e3('0x6')]['message']);}else{return _0x47bf65(_0x55c5ea[_0xb6e3('0x7')]);}})[_0xb6e3('0x8')](function(_0x14c14a){return _0x1a495a(_0x14c14a);});});}exports[_0xb6e3('0x9')]=function(_0x4ba78a,_0x199cf8){return request(_0xb6e3('0xa'),{'account':_0x4ba78a,'message':_0x199cf8});}; \ No newline at end of file +var _0xb739=['SendMail','jayson/promise','client','http','request','then','error','message','result','sendMailMessage'];(function(_0x5a832a,_0x3687e9){var _0x16dff3=function(_0x207163){while(--_0x207163){_0x5a832a['push'](_0x5a832a['shift']());}};_0x16dff3(++_0x3687e9);}(_0xb739,0x8d));var _0x9b73=function(_0x40ee01,_0x485b90){_0x40ee01=_0x40ee01-0x0;var _0x4ea3e7=_0xb739[_0x40ee01];return _0x4ea3e7;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x9b73('0x0'));var client=jayson[_0x9b73('0x1')][_0x9b73('0x2')]({'port':0x232b});function request(_0x142fa3,_0x5099d0){return new BPromise(function(_0x18b60c,_0x4464ba){return client[_0x9b73('0x3')](_0x142fa3,_0x5099d0)[_0x9b73('0x4')](function(_0x579575){if(_0x579575[_0x9b73('0x5')]){return _0x4464ba(_0x579575['error'][_0x9b73('0x6')]);}else{return _0x18b60c(_0x579575[_0x9b73('0x7')]);}})['catch'](function(_0x5ba80a){return _0x4464ba(_0x5ba80a);});});}exports[_0x9b73('0x8')]=function(_0x19734a,_0x3f8677){return request(_0x9b73('0x9'),{'account':_0x19734a,'message':_0x3f8677});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index f203157..088abc0 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 _0x8e19=['callerid','dnid','uniqueid','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','response','result','evtHangup','debug','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','isUndefined','[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','priority','continueAt','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','close','lodash','xml2json','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','retry','maxRetry','addVertex','omit','mxCell','hasOwnProperty','isArray','length','source','target','addEdge','value','toJson','mxGraphModel','production','start','root','stringify','joinAt','format','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname'];(function(_0x1fe730,_0xd1c412){var _0x52e5d1=function(_0x41d5aa){while(--_0x41d5aa){_0x1fe730['push'](_0x1fe730['shift']());}};_0x52e5d1(++_0xd1c412);}(_0x8e19,0x19b));var _0x98e1=function(_0x5d0347,_0x49ebd2){_0x5d0347=_0x5d0347-0x0;var _0xaaf756=_0x8e19[_0x5d0347];return _0xaaf756;};'use strict';var _=require(_0x98e1('0x0'));var moment=require('moment');var parser=require(_0x98e1('0x1'));var util=require('util');var logger=require(_0x98e1('0x2'))(_0x98e1('0x3'));var rpc=require(_0x98e1('0x4'));var mailRpc=require(_0x98e1('0x5'));var Graph=require(_0x98e1('0x6'));var Vertices=require(_0x98e1('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x98e1('0x8')]()[_0x98e1('0x9')](function(_0x131103){logger[_0x98e1('0xa')](_0x98e1('0xb'),_0x131103[_0x98e1('0xc')]);return[];});}function addVertex(_0x42c9c3,_0x3cff51,_0xcf3a39){_0x3cff51[_0x98e1('0xd')]=_0xcf3a39;if(_0x3cff51['hasOwnProperty'](_0x98e1('0xe'))){_0x3cff51[_0x98e1('0xf')]=parseInt(_0x3cff51['retry'],0xa);}_0x42c9c3[_0x98e1('0x10')](_[_0x98e1('0x11')](_0x3cff51,_0x98e1('0x12')));}function initGraph(_0x2fef1c,_0x356e55){var _0x32321f=new Graph();for(var _0x2e596c in _0x2fef1c){if(_0x2fef1c[_0x98e1('0x13')](_0x2e596c)){if(_[_0x98e1('0x14')](_0x2fef1c[_0x2e596c])){for(var _0xf55350=0x0;_0xf55350<_0x2fef1c[_0x2e596c]['length'];_0xf55350+=0x1){addVertex(_0x32321f,_0x2fef1c[_0x2e596c][_0xf55350],_0x2e596c);}}else{addVertex(_0x32321f,_0x2fef1c[_0x2e596c],_0x2e596c);}}}for(var _0x5b1046=0x0;_0x5b1046<_0x356e55[_0x98e1('0x15')];_0x5b1046+=0x1){if(_0x356e55[_0x5b1046][_0x98e1('0x16')]&&_0x356e55[_0x5b1046][_0x98e1('0x17')]){_0x32321f[_0x98e1('0x18')](_0x356e55[_0x5b1046]['source'],_0x356e55[_0x5b1046][_0x98e1('0x17')],_0x356e55[_0x5b1046][_0x98e1('0x19')]);}}return _0x32321f;}function getRoot(_0x59baeb){return parser[_0x98e1('0x1a')](_0x59baeb,{'object':!![]})[_0x98e1('0x1b')]['root'];}function inspect(_0x1d9715){return util['inspect'](_0x1d9715,{'showHidden':![],'depth':null});}function initialize(_0x2a2bcd,_0x1724f7){var _0x2257fb=getRoot(_0x2a2bcd[_0x98e1('0x1c')]);if(!_0x2257fb||!_0x2257fb[_0x98e1('0x1d')])return;var _0x345248,_0x99e4ab,_0x97bf3f;logger['debug'](_0x98e1('0x1e'),JSON[_0x98e1('0x1f')](_0x2257fb,null,0x2));_0x1724f7[_0x98e1('0x20')]=moment()[_0x98e1('0x21')]('YYYY-MM-DD\x20HH:mm:ss');_0x345248=initGraph(_[_0x98e1('0x11')](_0x2257fb,_0x98e1('0x12')),_0x2257fb[_0x98e1('0x12')]);_0x99e4ab=new Vertices(_0x1724f7,rpc,mailRpc);logger[_0x98e1('0x22')](util[_0x98e1('0x21')](_0x98e1('0x23'),_0x1724f7['arg_1'],_0x1724f7[_0x98e1('0x24')],_0x1724f7[_0x98e1('0x25')],_0x1724f7[_0x98e1('0x26')],_0x1724f7[_0x98e1('0x27')]));_0x345248[_0x98e1('0x28')](_0x2257fb['start']['id'],function(_0x4d59b8){try{_0x4d59b8=_0x99e4ab[_0x98e1('0x29')](_0x4d59b8);logger['debug'](_0x98e1('0x2a'),JSON[_0x98e1('0x1f')](_0x4d59b8,null,0x2));if(_0x4d59b8[_0x98e1('0xd')]===_0x98e1('0x2b')){logger[_0x98e1('0x22')](_0x98e1('0x2c'));_0x1724f7[_0x98e1('0x2d')]=_0x4d59b8[_0x98e1('0x2d')]||_0x1724f7[_0x98e1('0x2d')];_0x1724f7['extension']=_0x4d59b8[_0x98e1('0x2e')];_0x1724f7['priority']=_0x4d59b8['priority']?_0x4d59b8['priority']-0x1:0x1;return null;}else if(_0x4d59b8&&_0x99e4ab[_0x4d59b8['agicommand']]){_0x97bf3f=_0x99e4ab[_0x4d59b8[_0x98e1('0xd')]](_0x4d59b8);logger[_0x98e1('0x22')](_0x98e1('0x2f'),JSON[_0x98e1('0x1f')](_0x97bf3f,null,0x2));if(_0x97bf3f&&_0x97bf3f['code']===AGI_CODE_SUCCESS&&_0x97bf3f[_0x98e1('0x30')]!==AGI_RESULT_ERROR&&!_0x1724f7[_0x98e1('0x31')]){logger[_0x98e1('0x32')](_0x98e1('0x2f'),inspect(_0x97bf3f));return _['isUndefined'](_0x97bf3f[_0x98e1('0x30')])?null:_0x97bf3f[_0x98e1('0x30')][_0x98e1('0x33')]();}else{logger[_0x98e1('0xa')](_0x98e1('0x2f'),inspect(_0x97bf3f));return null;}}else{logger['error'](_0x98e1('0x34'));return null;}}catch(_0x4b83f0){logger[_0x98e1('0xa')](_0x4b83f0[_0x98e1('0xc')]);return null;}});if(_0x2257fb[_0x98e1('0x35')]){logger[_0x98e1('0x22')](util[_0x98e1('0x21')](_0x98e1('0x36'),_0x1724f7[_0x98e1('0x37')],_0x1724f7[_0x98e1('0x24')],_0x1724f7[_0x98e1('0x25')],_0x1724f7[_0x98e1('0x26')],_0x1724f7[_0x98e1('0x27')]));_0x345248[_0x98e1('0x28')](_0x2257fb[_0x98e1('0x35')]['id'],function(_0x2e621e){try{_0x2e621e=_0x99e4ab[_0x98e1('0x29')](_0x2e621e);logger[_0x98e1('0x32')](_0x98e1('0x2a'),JSON[_0x98e1('0x1f')](_0x2e621e,null,0x2));if(_0x2e621e&&_0x99e4ab[_0x2e621e[_0x98e1('0xd')]]){_0x97bf3f=_0x99e4ab[_0x2e621e[_0x98e1('0xd')]](_0x2e621e);if(_0x97bf3f){logger[_0x98e1('0x32')]('response',inspect(_0x97bf3f));return _[_0x98e1('0x38')](_0x97bf3f['result'])?null:_0x97bf3f[_0x98e1('0x30')]['toString']();}else{logger[_0x98e1('0xa')]('response',inspect(_0x97bf3f));return null;}}else{logger[_0x98e1('0xa')](_0x98e1('0x34'));return null;}}catch(_0x410c3d){logger[_0x98e1('0xa')](_0x410c3d[_0x98e1('0xc')]);return null;}});}logger[_0x98e1('0x22')](util[_0x98e1('0x21')](_0x98e1('0x39'),_0x1724f7[_0x98e1('0x37')],_0x1724f7['calleridname'],_0x1724f7[_0x98e1('0x25')],_0x1724f7['dnid'],_0x1724f7['uniqueid']));logger['info'](util[_0x98e1('0x21')](_0x98e1('0x3a'),_0x1724f7[_0x98e1('0x2d')],_0x1724f7[_0x98e1('0x2e')],parseInt(_0x1724f7[_0x98e1('0x3b')],0xa)+0x1));_0x1724f7[_0x98e1('0x3c')](_0x1724f7['context'],_0x1724f7[_0x98e1('0x2e')],parseInt(_0x1724f7[_0x98e1('0x3b')],0xa)+0x1);_0x1724f7['close']();}function handleNotFound(_0x5cbaa4){logger[_0x98e1('0xa')](util[_0x98e1('0x21')](_0x98e1('0x3d'),_0x5cbaa4[_0x98e1('0x37')]));_0x5cbaa4['continueAt'](_0x5cbaa4[_0x98e1('0x2d')],_0x5cbaa4[_0x98e1('0x2e')],parseInt(_0x5cbaa4[_0x98e1('0x3b')],0xa)+0x1);_0x5cbaa4['close']();}function handleUnpublished(_0x413831){logger['error'](util[_0x98e1('0x21')](_0x98e1('0x3e'),_0x413831['arg_1']));_0x413831[_0x98e1('0x3c')](_0x413831[_0x98e1('0x2d')],_0x413831[_0x98e1('0x2e')],parseInt(_0x413831[_0x98e1('0x3b')],0xa)+0x1);_0x413831[_0x98e1('0x3f')]();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xf057=['finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','vertex','[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','exports','moment','xml2json','util','../../config/logger','./vertices','getSquareProjects','error','stack','hasOwnProperty','retry','maxRetry','addVertex','isArray','length','source','addEdge','target','value','toJson','mxGraphModel','root','inspect','production','start','stringify','joinAt','format','omit','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','traverseBFS','clear','debug','context','priority','agicommand','info','response','code','result','isUndefined','toString','agicommand\x20not\x20found'];(function(_0x9b6ca9,_0x1b0f67){var _0x5b32d9=function(_0x46b5c8){while(--_0x46b5c8){_0x9b6ca9['push'](_0x9b6ca9['shift']());}};_0x5b32d9(++_0x1b0f67);}(_0xf057,0x133));var _0x7f05=function(_0x3494e3,_0xb66350){_0x3494e3=_0x3494e3-0x0;var _0xbd00a0=_0xf057[_0x3494e3];return _0xbd00a0;};'use strict';var _=require('lodash');var moment=require(_0x7f05('0x0'));var parser=require(_0x7f05('0x1'));var util=require(_0x7f05('0x2'));var logger=require(_0x7f05('0x3'))('agi');var rpc=require('./rpc');var mailRpc=require('./mailRpc');var Graph=require('./graph');var Vertices=require(_0x7f05('0x4'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x7f05('0x5')]()['catch'](function(_0x6586b5){logger[_0x7f05('0x6')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0x6586b5[_0x7f05('0x7')]);return[];});}function addVertex(_0x544ff,_0x312232,_0x1104ad){_0x312232['agicommand']=_0x1104ad;if(_0x312232[_0x7f05('0x8')](_0x7f05('0x9'))){_0x312232[_0x7f05('0xa')]=parseInt(_0x312232[_0x7f05('0x9')],0xa);}_0x544ff[_0x7f05('0xb')](_['omit'](_0x312232,'mxCell'));}function initGraph(_0x15c231,_0x5f0144){var _0x3b96cc=new Graph();for(var _0x3e3e6e in _0x15c231){if(_0x15c231['hasOwnProperty'](_0x3e3e6e)){if(_[_0x7f05('0xc')](_0x15c231[_0x3e3e6e])){for(var _0x5de644=0x0;_0x5de644<_0x15c231[_0x3e3e6e][_0x7f05('0xd')];_0x5de644+=0x1){addVertex(_0x3b96cc,_0x15c231[_0x3e3e6e][_0x5de644],_0x3e3e6e);}}else{addVertex(_0x3b96cc,_0x15c231[_0x3e3e6e],_0x3e3e6e);}}}for(var _0x5f21d5=0x0;_0x5f21d5<_0x5f0144[_0x7f05('0xd')];_0x5f21d5+=0x1){if(_0x5f0144[_0x5f21d5][_0x7f05('0xe')]&&_0x5f0144[_0x5f21d5]['target']){_0x3b96cc[_0x7f05('0xf')](_0x5f0144[_0x5f21d5][_0x7f05('0xe')],_0x5f0144[_0x5f21d5][_0x7f05('0x10')],_0x5f0144[_0x5f21d5][_0x7f05('0x11')]);}}return _0x3b96cc;}function getRoot(_0x285a41){return parser[_0x7f05('0x12')](_0x285a41,{'object':!![]})[_0x7f05('0x13')][_0x7f05('0x14')];}function inspect(_0x1e1409){return util[_0x7f05('0x15')](_0x1e1409,{'showHidden':![],'depth':null});}function initialize(_0x48eb39,_0x1ffd25){var _0x41b264=getRoot(_0x48eb39[_0x7f05('0x16')]);if(!_0x41b264||!_0x41b264[_0x7f05('0x17')])return;var _0x50bf81,_0x4106eb,_0x40534f;logger['debug']('root',JSON[_0x7f05('0x18')](_0x41b264,null,0x2));_0x1ffd25[_0x7f05('0x19')]=moment()[_0x7f05('0x1a')]('YYYY-MM-DD\x20HH:mm:ss');_0x50bf81=initGraph(_[_0x7f05('0x1b')](_0x41b264,_0x7f05('0x1c')),_0x41b264[_0x7f05('0x1c')]);_0x4106eb=new Vertices(_0x1ffd25,rpc,mailRpc);logger['info'](util[_0x7f05('0x1a')](_0x7f05('0x1d'),_0x1ffd25[_0x7f05('0x1e')],_0x1ffd25[_0x7f05('0x1f')],_0x1ffd25[_0x7f05('0x20')],_0x1ffd25[_0x7f05('0x21')],_0x1ffd25['uniqueid']));_0x50bf81[_0x7f05('0x22')](_0x41b264['start']['id'],function(_0x39322e){try{_0x39322e=_0x4106eb[_0x7f05('0x23')](_0x39322e);logger[_0x7f05('0x24')]('vertex',JSON[_0x7f05('0x18')](_0x39322e,null,0x2));if(_0x39322e['agicommand']==='gotoc'){logger['info']('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x1ffd25[_0x7f05('0x25')]=_0x39322e[_0x7f05('0x25')]||_0x1ffd25['context'];_0x1ffd25['extension']=_0x39322e['extension'];_0x1ffd25[_0x7f05('0x26')]=_0x39322e[_0x7f05('0x26')]?_0x39322e[_0x7f05('0x26')]-0x1:0x1;return null;}else if(_0x39322e&&_0x4106eb[_0x39322e[_0x7f05('0x27')]]){_0x40534f=_0x4106eb[_0x39322e['agicommand']](_0x39322e);logger[_0x7f05('0x28')](_0x7f05('0x29'),JSON[_0x7f05('0x18')](_0x40534f,null,0x2));if(_0x40534f&&_0x40534f[_0x7f05('0x2a')]===AGI_CODE_SUCCESS&&_0x40534f[_0x7f05('0x2b')]!==AGI_RESULT_ERROR&&!_0x1ffd25['evtHangup']){logger[_0x7f05('0x24')]('response',inspect(_0x40534f));return _[_0x7f05('0x2c')](_0x40534f[_0x7f05('0x2b')])?null:_0x40534f[_0x7f05('0x2b')][_0x7f05('0x2d')]();}else{logger[_0x7f05('0x6')](_0x7f05('0x29'),inspect(_0x40534f));return null;}}else{logger[_0x7f05('0x6')](_0x7f05('0x2e'));return null;}}catch(_0x9e0d59){logger[_0x7f05('0x6')](_0x9e0d59['stack']);return null;}});if(_0x41b264[_0x7f05('0x2f')]){logger['info'](util[_0x7f05('0x1a')](_0x7f05('0x30'),_0x1ffd25[_0x7f05('0x1e')],_0x1ffd25[_0x7f05('0x1f')],_0x1ffd25[_0x7f05('0x20')],_0x1ffd25[_0x7f05('0x21')],_0x1ffd25[_0x7f05('0x31')]));_0x50bf81[_0x7f05('0x22')](_0x41b264[_0x7f05('0x2f')]['id'],function(_0x522694){try{_0x522694=_0x4106eb[_0x7f05('0x23')](_0x522694);logger['debug'](_0x7f05('0x32'),JSON[_0x7f05('0x18')](_0x522694,null,0x2));if(_0x522694&&_0x4106eb[_0x522694[_0x7f05('0x27')]]){_0x40534f=_0x4106eb[_0x522694[_0x7f05('0x27')]](_0x522694);if(_0x40534f){logger[_0x7f05('0x24')]('response',inspect(_0x40534f));return _['isUndefined'](_0x40534f[_0x7f05('0x2b')])?null:_0x40534f[_0x7f05('0x2b')][_0x7f05('0x2d')]();}else{logger[_0x7f05('0x6')](_0x7f05('0x29'),inspect(_0x40534f));return null;}}else{logger[_0x7f05('0x6')]('agicommand\x20not\x20found');return null;}}catch(_0x10c969){logger[_0x7f05('0x6')](_0x10c969[_0x7f05('0x7')]);return null;}});}logger['info'](util[_0x7f05('0x1a')](_0x7f05('0x33'),_0x1ffd25[_0x7f05('0x1e')],_0x1ffd25['calleridname'],_0x1ffd25[_0x7f05('0x20')],_0x1ffd25[_0x7f05('0x21')],_0x1ffd25[_0x7f05('0x31')]));logger[_0x7f05('0x28')](util[_0x7f05('0x1a')](_0x7f05('0x34'),_0x1ffd25['context'],_0x1ffd25[_0x7f05('0x35')],parseInt(_0x1ffd25['priority'],0xa)+0x1));_0x1ffd25[_0x7f05('0x36')](_0x1ffd25['context'],_0x1ffd25[_0x7f05('0x35')],parseInt(_0x1ffd25[_0x7f05('0x26')],0xa)+0x1);_0x1ffd25[_0x7f05('0x37')]();}function handleNotFound(_0x7f45b6){logger[_0x7f05('0x6')](util['format'](_0x7f05('0x38'),_0x7f45b6[_0x7f05('0x1e')]));_0x7f45b6['continueAt'](_0x7f45b6['context'],_0x7f45b6[_0x7f05('0x35')],parseInt(_0x7f45b6[_0x7f05('0x26')],0xa)+0x1);_0x7f45b6[_0x7f05('0x37')]();}function handleUnpublished(_0x939def){logger['error'](util[_0x7f05('0x1a')](_0x7f05('0x39'),_0x939def[_0x7f05('0x1e')]));_0x939def[_0x7f05('0x36')](_0x939def[_0x7f05('0x25')],_0x939def[_0x7f05('0x35')],parseInt(_0x939def['priority'],0xa)+0x1);_0x939def[_0x7f05('0x37')]();}module[_0x7f05('0x3a')]={'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 21407c1..787d9df 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 _0xba47=['emit','headers','exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','_transform','toString','indexOf','substring','slice','trim','length'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xba47,0x1ac));var _0x7ba4=function(_0x19d2d0,_0xbe044a){_0x19d2d0=_0x19d2d0-0x0;var _0xe418c4=_0xba47[_0x19d2d0];return _0xe418c4;};'use strict';var util=require(_0x7ba4('0x0'));var Transform=require(_0x7ba4('0x1'))[_0x7ba4('0x2')];function AGIReply(_0x4c18e5){Transform[_0x7ba4('0x3')](this,_0x4c18e5);this[_0x7ba4('0x4')]='';this[_0x7ba4('0x5')]=![];}util[_0x7ba4('0x6')](AGIReply,Transform);AGIReply['prototype'][_0x7ba4('0x7')]=function(_0x3df285,_0x47ac80,_0x4f8c2d){var _0x565107='\x0a',_0x11ea18=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x932508=-0x1,_0x227abe=-0x1,_0x7963fa='',_0x380790=0x0,_0xa58ac3='',_0x224ec0='';this['_localBuffer']+=_0x3df285[_0x7ba4('0x8')]();_0xa58ac3=this['_localBuffer'];if(!this[_0x7ba4('0x5')]){_0x380790=0x0;while(_0x11ea18[_0x380790]){while((_0x227abe=_0xa58ac3[_0x7ba4('0x9')](_0x11ea18[_0x380790]))!=-0x1){_0x7963fa=_0x11ea18[_0x380790];_0x224ec0=_0xa58ac3[_0x7ba4('0xa')](0x0,_0x227abe);_0xa58ac3=_0xa58ac3[_0x7ba4('0xa')](_0x227abe+_0x7963fa['length']);var _0x143384=_0x224ec0['split'](_0x565107),_0xea3411=0x0,_0x4ffe3c={},_0x83d2c='',_0x266be2='',_0x2fdee0=-0x1;while(_0x143384[_0xea3411]){_0x2fdee0=_0x143384[_0xea3411][_0x7ba4('0x9')](':');if(_0x2fdee0!=-0x1){_0x83d2c=_0x143384[_0xea3411][_0x7ba4('0xb')](0x0,_0x2fdee0)[_0x7ba4('0xc')]();_0x266be2=_0x143384[_0xea3411][_0x7ba4('0xb')](_0x2fdee0+0x1)[_0x7ba4('0xc')]();if(_0x83d2c[_0x7ba4('0xd')]>0x0){_0x4ffe3c[_0x83d2c]=_0x266be2;}}else{}_0xea3411++;}this[_0x7ba4('0xe')](_0x7ba4('0xf'),_0x4ffe3c);this[_0x7ba4('0x5')]=!![];}_0x380790++;}this['_localBuffer']=_0xa58ac3;}else{while((_0x932508=_0xa58ac3['indexOf'](_0x565107))!=-0x1){_0x224ec0=_0xa58ac3[_0x7ba4('0xa')](0x0,_0x932508);this[_0x7ba4('0xe')]('line',_0x224ec0);_0xa58ac3=_0xa58ac3[_0x7ba4('0xa')](_0x932508+_0x565107[_0x7ba4('0xd')]);}this[_0x7ba4('0x4')]=_0xa58ac3;}_0x4f8c2d();};module[_0x7ba4('0x10')]=AGIReply; \ No newline at end of file +var _0x1663=['trim','slice','emit','line','exports','stream','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length'];(function(_0xfb9baf,_0x5501b1){var _0x500948=function(_0xa4f100){while(--_0xa4f100){_0xfb9baf['push'](_0xfb9baf['shift']());}};_0x500948(++_0x5501b1);}(_0x1663,0x95));var _0x3166=function(_0x49d7cb,_0x35104a){_0x49d7cb=_0x49d7cb-0x0;var _0x1b4dca=_0x1663[_0x49d7cb];return _0x1b4dca;};'use strict';var util=require('util');var Transform=require(_0x3166('0x0'))['Transform'];function AGIReply(_0xe38fbb){Transform['call'](this,_0xe38fbb);this[_0x3166('0x1')]='';this[_0x3166('0x2')]=![];}util[_0x3166('0x3')](AGIReply,Transform);AGIReply[_0x3166('0x4')][_0x3166('0x5')]=function(_0x3b9b14,_0x1d0f2c,_0x2fddaa){var _0x26923d='\x0a',_0x338308=['\x0a\x0a',_0x3166('0x6')],_0x256a56=-0x1,_0x2c7d74=-0x1,_0x4ac68e='',_0x492c9f=0x0,_0xf39012='',_0x210003='';this['_localBuffer']+=_0x3b9b14[_0x3166('0x7')]();_0xf39012=this[_0x3166('0x1')];if(!this[_0x3166('0x2')]){_0x492c9f=0x0;while(_0x338308[_0x492c9f]){while((_0x2c7d74=_0xf39012[_0x3166('0x8')](_0x338308[_0x492c9f]))!=-0x1){_0x4ac68e=_0x338308[_0x492c9f];_0x210003=_0xf39012['substring'](0x0,_0x2c7d74);_0xf39012=_0xf39012[_0x3166('0x9')](_0x2c7d74+_0x4ac68e[_0x3166('0xa')]);var _0x5db0c4=_0x210003['split'](_0x26923d),_0x4e754a=0x0,_0x38ace9={},_0x2a371e='',_0x3f0c99='',_0x591087=-0x1;while(_0x5db0c4[_0x4e754a]){_0x591087=_0x5db0c4[_0x4e754a][_0x3166('0x8')](':');if(_0x591087!=-0x1){_0x2a371e=_0x5db0c4[_0x4e754a]['slice'](0x0,_0x591087)[_0x3166('0xb')]();_0x3f0c99=_0x5db0c4[_0x4e754a][_0x3166('0xc')](_0x591087+0x1)['trim']();if(_0x2a371e[_0x3166('0xa')]>0x0){_0x38ace9[_0x2a371e]=_0x3f0c99;}}else{}_0x4e754a++;}this[_0x3166('0xd')]('headers',_0x38ace9);this[_0x3166('0x2')]=!![];}_0x492c9f++;}this[_0x3166('0x1')]=_0xf39012;}else{while((_0x256a56=_0xf39012['indexOf'](_0x26923d))!=-0x1){_0x210003=_0xf39012['substring'](0x0,_0x256a56);this['emit'](_0x3166('0xe'),_0x210003);_0xf39012=_0xf39012['substring'](_0x256a56+_0x26923d[_0x3166('0xa')]);}this[_0x3166('0x1')]=_0xf39012;}_0x2fddaa();};module[_0x3166('0xf')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 3119570..a685fef 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 _0x2557=['getMailAccountById','ShowMailAccount','Smtp','email','getSquareProjectById','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','ShowTrunk','getSoundById','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','CreateSquareReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','PauseUser','agentUnpause','LogoutUser','lodash','jayson/promise','client','http','error','message','result','catch','getSquareProjects','GetSquareProjects','name','getSquareProject','ShowSquareProject','production'];(function(_0x2be367,_0xd557e5){var _0x30239d=function(_0x322b45){while(--_0x322b45){_0x2be367['push'](_0x2be367['shift']());}};_0x30239d(++_0xd557e5);}(_0x2557,0x11e));var _0x7255=function(_0x1de895,_0x11cb4b){_0x1de895=_0x1de895-0x0;var _0x4b7c19=_0x2557[_0x1de895];return _0x4b7c19;};'use strict';var _=require(_0x7255('0x0'));var moment=require('moment');var jayson=require(_0x7255('0x1'));var client=jayson[_0x7255('0x2')][_0x7255('0x3')]({'port':0x2329});function request(_0x1d8176,_0x1db25c){return new Promise(function(_0x20bb40,_0x5994ca){return client['request'](_0x1d8176,_0x1db25c)['then'](function(_0x572124){if(_0x572124[_0x7255('0x4')]){return _0x5994ca(_0x572124[_0x7255('0x4')][_0x7255('0x5')]);}else{return _0x20bb40(_0x572124[_0x7255('0x6')]);}})[_0x7255('0x7')](function(_0x5b6aa4){return _0x5994ca(_0x5b6aa4);});});}exports[_0x7255('0x8')]=function(){return request(_0x7255('0x9'),{'options':{'raw':![],'attributes':['id',_0x7255('0xa'),'production']}});};exports[_0x7255('0xb')]=function(_0x18f985){return request(_0x7255('0xc'),{'options':{'raw':![],'where':{'name':_0x18f985},'attributes':[_0x7255('0xd')]}});};exports[_0x7255('0xe')]=function(_0x17601b){return request(_0x7255('0xf'),{'options':{'raw':![],'where':{'id':_0x17601b},'include':[{'model':'MailServerOut','as':_0x7255('0x10'),'include':[{'model':'CloudProvider','as':'CloudProvider'}]}],'attributes':['id','name',_0x7255('0x11')],'smtp':!![]}});};exports[_0x7255('0x12')]=function(_0x2bb148){return request(_0x7255('0xc'),{'options':{'where':{'id':_0x2bb148},'attributes':[_0x7255('0xa')]}});};exports[_0x7255('0x13')]=function(_0x44a4de){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x44a4de},'attributes':[_0x7255('0xa')]}});};exports[_0x7255('0x14')]=function(_0x1c565b){return request(_0x7255('0x15'),{'options':{'where':{'id':_0x1c565b},'attributes':[_0x7255('0xa')]}});};exports[_0x7255('0x16')]=function(_0xa7b77d){return request(_0x7255('0x17'),{'options':{'where':{'id':_0xa7b77d},'attributes':[_0x7255('0x18')]}});};exports[_0x7255('0x19')]=function(_0x2e6489){return request(_0x7255('0x1a'),{'options':{'where':{'id':_0x2e6489},'attributes':[_0x7255('0xa')]}});};exports[_0x7255('0x1b')]=function(_0x3db713){return request(_0x7255('0x1c'),{'options':{'where':{'phone':_0x3db713[_0x7255('0x1d')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x4f26da){return request(_0x7255('0x1e'),{'options':{'where':{'id':_0x4f26da},'attributes':[_0x7255('0xa')]}});};exports[_0x7255('0x1f')]=function(_0xf8fb0){return request('ShowSound',{'options':{'where':{'id':_0xf8fb0},'attributes':[_0x7255('0x20')]}});};exports[_0x7255('0x21')]=function(_0x1be0c4){return request(_0x7255('0x22'),{'options':{'raw':![],'where':{'id':_0x1be0c4},'include':[{'model':_0x7255('0x23'),'as':_0x7255('0x24')}]}});};exports[_0x7255('0x25')]=function(_0x9fdfea){return request('ShowSmsAccount',{'options':{'where':{'id':_0x9fdfea},'attributes':['id',_0x7255('0xa')]}});};exports[_0x7255('0x26')]=function(_0x3f6fea){return request(_0x7255('0x27'),{'body':_0x3f6fea});};exports[_0x7255('0x28')]=function(_0x35dd34){return request(_0x7255('0x29'),{'body':_0x35dd34});};exports['createSquareReport']=function(_0xbf4285){return request(_0x7255('0x2a'),{'body':_[_0x7255('0x2b')](_0xbf4285,{'project_name':_0xbf4285['arg_1'],'prev_project_name':_0xbf4285[_0x7255('0x2c')]||'','is_subproject':_0xbf4285['arg_2']?!![]:![],'leaveAt':moment()[_0x7255('0x2d')](_0x7255('0x2e'))})});};exports['createSquareRecording']=function(_0xe0b108){return request(_0x7255('0x2f'),{'body':_0xe0b108});};exports[_0x7255('0x30')]=function(_0x3dc004){return request(_0x7255('0x31'),{'body':_0x3dc004});};exports[_0x7255('0x32')]=function(_0x54e53a){return request(_0x7255('0x33'),{'options':{'raw':![],'where':{'phone':_0x54e53a[_0x7255('0x1d')],'ListId':_0x54e53a['ListId']}}})['then'](function(_0x22cc6e){if(_0x22cc6e){return _0x22cc6e;}return request(_0x7255('0x34'),{'body':_0x54e53a});});};exports[_0x7255('0x35')]=function(_0x3eeb50){return request(_0x7255('0x36'),{'options':{'where':{'id':_0x3eeb50},'attributes':[_0x7255('0xa')]}});};exports[_0x7255('0x37')]=function(_0x464bc0,_0x5bcb34){return request(_0x7255('0x38'),{'body':{'interface':_0x5bcb34},'options':{'where':_0x464bc0}});};exports['agentPause']=function(_0x162169,_0x5af1af,_0x11635f){return request(_0x7255('0x39'),{'body':{'type':_0x5af1af,'uniqueid':_0x11635f},'options':{'where':_0x162169}});};exports[_0x7255('0x3a')]=function(_0x576583){return request('UnpauseUser',{'body':{},'options':{'where':_0x576583}});};exports['agentLogout']=function(_0x1c019f){return request(_0x7255('0x3b'),{'body':{},'options':{'where':_0x1c019f}});}; \ No newline at end of file +var _0x54ef=['getContactByPhone','GetContactByPhone','phone','getTrunkById','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createCmContact','ShowCmHopper','ListId','ShowPause','agentLogin','LoginUser','agentPause','agentUnpause','agentLogout','LogoutUser','lodash','moment','jayson/promise','http','request','then','error','message','result','GetSquareProjects','name','getSquareProject','ShowSquareProject','production','ShowMailAccount','MailServerOut','Smtp','CloudProvider','getSquareProjectById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','dsn','getUserById','ShowUser'];(function(_0x3a2e49,_0x21ebea){var _0x257140=function(_0x5a2362){while(--_0x5a2362){_0x3a2e49['push'](_0x3a2e49['shift']());}};_0x257140(++_0x21ebea);}(_0x54ef,0x112));var _0xf54e=function(_0x4a1f57,_0x347544){_0x4a1f57=_0x4a1f57-0x0;var _0x2f00e7=_0x54ef[_0x4a1f57];return _0x2f00e7;};'use strict';var _=require(_0xf54e('0x0'));var moment=require(_0xf54e('0x1'));var jayson=require(_0xf54e('0x2'));var client=jayson['client'][_0xf54e('0x3')]({'port':0x2329});function request(_0x18b7d6,_0x18b1cf){return new Promise(function(_0x42b9b2,_0x8b6bb6){return client[_0xf54e('0x4')](_0x18b7d6,_0x18b1cf)[_0xf54e('0x5')](function(_0x4c3022){if(_0x4c3022['error']){return _0x8b6bb6(_0x4c3022[_0xf54e('0x6')][_0xf54e('0x7')]);}else{return _0x42b9b2(_0x4c3022[_0xf54e('0x8')]);}})['catch'](function(_0x27e69b){return _0x8b6bb6(_0x27e69b);});});}exports['getSquareProjects']=function(){return request(_0xf54e('0x9'),{'options':{'raw':![],'attributes':['id',_0xf54e('0xa'),'production']}});};exports[_0xf54e('0xb')]=function(_0xefa1c0){return request(_0xf54e('0xc'),{'options':{'raw':![],'where':{'name':_0xefa1c0},'attributes':[_0xf54e('0xd')]}});};exports['getMailAccountById']=function(_0x558502){return request(_0xf54e('0xe'),{'options':{'raw':![],'where':{'id':_0x558502},'include':[{'model':_0xf54e('0xf'),'as':_0xf54e('0x10'),'include':[{'model':'CloudProvider','as':_0xf54e('0x11')}]}],'attributes':['id','name','email'],'smtp':!![]}});};exports[_0xf54e('0x12')]=function(_0x2033e9){return request(_0xf54e('0xc'),{'options':{'where':{'id':_0x2033e9},'attributes':[_0xf54e('0xa')]}});};exports['getVoiceQueueById']=function(_0x331732){return request(_0xf54e('0x13'),{'options':{'where':{'id':_0x331732},'attributes':[_0xf54e('0xa')]}});};exports[_0xf54e('0x14')]=function(_0x56828e){return request(_0xf54e('0x15'),{'options':{'where':{'id':_0x56828e},'attributes':[_0xf54e('0xa')]}});};exports[_0xf54e('0x16')]=function(_0x5c5d00){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x5c5d00},'attributes':[_0xf54e('0x17')]}});};exports[_0xf54e('0x18')]=function(_0x1c02e7){return request(_0xf54e('0x19'),{'options':{'where':{'id':_0x1c02e7},'attributes':[_0xf54e('0xa')]}});};exports[_0xf54e('0x1a')]=function(_0x2e27b6){return request(_0xf54e('0x1b'),{'options':{'where':{'phone':_0x2e27b6[_0xf54e('0x1c')]},'attributes':['id']}});};exports[_0xf54e('0x1d')]=function(_0x226c96){return request('ShowTrunk',{'options':{'where':{'id':_0x226c96},'attributes':['name']}});};exports[_0xf54e('0x1e')]=function(_0x59f338){return request(_0xf54e('0x1f'),{'options':{'where':{'id':_0x59f338},'attributes':[_0xf54e('0x20')]}});};exports[_0xf54e('0x21')]=function(_0x9903fc){return request(_0xf54e('0x22'),{'options':{'raw':![],'where':{'id':_0x9903fc},'include':[{'model':_0xf54e('0x23'),'as':_0xf54e('0x24')}]}});};exports[_0xf54e('0x25')]=function(_0x3c0169){return request(_0xf54e('0x26'),{'options':{'where':{'id':_0x3c0169},'attributes':['id',_0xf54e('0xa')]}});};exports['createSmsMessage']=function(_0x6f6d29){return request('CreateSmsMessage',{'body':_0x6f6d29});};exports[_0xf54e('0x27')]=function(_0x272df6){return request(_0xf54e('0x28'),{'body':_0x272df6});};exports[_0xf54e('0x29')]=function(_0x3805a7){return request(_0xf54e('0x2a'),{'body':_[_0xf54e('0x2b')](_0x3805a7,{'project_name':_0x3805a7[_0xf54e('0x2c')],'prev_project_name':_0x3805a7[_0xf54e('0x2d')]||'','is_subproject':_0x3805a7[_0xf54e('0x2d')]?!![]:![],'leaveAt':moment()[_0xf54e('0x2e')](_0xf54e('0x2f'))})});};exports[_0xf54e('0x30')]=function(_0x5390b8){return request(_0xf54e('0x31'),{'body':_0x5390b8});};exports['createSquareMessage']=function(_0x282c63){return request('CreateSquareMessage',{'body':_0x282c63});};exports[_0xf54e('0x32')]=function(_0x269f47){return request(_0xf54e('0x33'),{'options':{'raw':![],'where':{'phone':_0x269f47[_0xf54e('0x1c')],'ListId':_0x269f47[_0xf54e('0x34')]}}})[_0xf54e('0x5')](function(_0x36f985){if(_0x36f985){return _0x36f985;}return request('CreateCmContact',{'body':_0x269f47});});};exports['getPauseById']=function(_0x2f96b1){return request(_0xf54e('0x35'),{'options':{'where':{'id':_0x2f96b1},'attributes':[_0xf54e('0xa')]}});};exports[_0xf54e('0x36')]=function(_0xb2d4c4,_0x133cd7){return request(_0xf54e('0x37'),{'body':{'interface':_0x133cd7},'options':{'where':_0xb2d4c4}});};exports[_0xf54e('0x38')]=function(_0x3ae704,_0x12edc3,_0x5ea0cc){return request('PauseUser',{'body':{'type':_0x12edc3,'uniqueid':_0x5ea0cc},'options':{'where':_0x3ae704}});};exports[_0xf54e('0x39')]=function(_0x3169dd){return request('UnpauseUser',{'body':{},'options':{'where':_0x3169dd}});};exports[_0xf54e('0x3a')]=function(_0x82e313){return request(_0xf54e('0x3b'),{'body':{},'options':{'where':_0x82e313}});}; \ 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 abe2cc2..1b04a9d 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 _0x8f6b=['./lex','exports','./polly'];(function(_0x284d20,_0x5c4157){var _0x4283d6=function(_0x1c0d7e){while(--_0x1c0d7e){_0x284d20['push'](_0x284d20['shift']());}};_0x4283d6(++_0x5c4157);}(_0x8f6b,0x146));var _0xb8f6=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x8f6b[_0x397e5f];return _0x5302b8;};var polly=require(_0xb8f6('0x0'));var lex=require(_0xb8f6('0x1'));module[_0xb8f6('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xbea5=['./lex','./polly'];(function(_0x57f775,_0x3a11dc){var _0x44d721=function(_0x5a55fa){while(--_0x5a55fa){_0x57f775['push'](_0x57f775['shift']());}};_0x44d721(++_0x3a11dc);}(_0xbea5,0x177));var _0x5bea=function(_0x258fb0,_0x5362dc){_0x258fb0=_0x258fb0-0x0;var _0x4d1afe=_0xbea5[_0x258fb0];return _0x4d1afe;};var polly=require(_0x5bea('0x0'));var lex=require(_0x5bea('0x1'));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 f29c86e..1c673af 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['exports','./lib/api'];(function(_0x300f36,_0x32d8ab){var _0x43b53d=function(_0x3fe5d2){while(--_0x3fe5d2){_0x300f36['push'](_0x300f36['shift']());}};_0x43b53d(++_0x32d8ab);}(_0xe706,0xa3));var _0x6e70=function(_0x26a906,_0x3d135c){_0x26a906=_0x26a906-0x0;var _0x495575=_0xe706[_0x26a906];return _0x495575;};'use strict';var lex=require(_0x6e70('0x0'));module[_0x6e70('0x1')]=function(_0x311951,_0x5e8446,_0x2cae77,_0x315629,_0x2ca810,_0x7dfbc3){return lex(_0x311951,_0x5e8446,_0x2cae77,_0x315629,_0x2ca810,_0x7dfbc3);}; \ No newline at end of file +var _0x13f6=['./lib/api','exports'];(function(_0x5835ab,_0x57cdd7){var _0x343d8e=function(_0x53e139){while(--_0x53e139){_0x5835ab['push'](_0x5835ab['shift']());}};_0x343d8e(++_0x57cdd7);}(_0x13f6,0x124));var _0x613f=function(_0x548af6,_0x57dfde){_0x548af6=_0x548af6-0x0;var _0x120cf2=_0x13f6[_0x548af6];return _0x120cf2;};'use strict';var lex=require(_0x613f('0x0'));module[_0x613f('0x1')]=function(_0x5f1b3e,_0x563492,_0xd04cfd,_0x13b50a,_0x12dc5a,_0x5414ff){return lex(_0x5f1b3e,_0x563492,_0xd04cfd,_0x13b50a,_0x12dc5a,_0x5414ff);}; \ 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 b0a6525..837093a 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(_0x21fcf8,_0x37a019){var _0x5184df=function(_0xb58854){while(--_0xb58854){_0x21fcf8['push'](_0x21fcf8['shift']());}};_0x5184df(++_0x37a019);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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(_0x160c61,_0x183400){var _0x459829=function(_0x1bba37){while(--_0x1bba37){_0x160c61['push'](_0x160c61['shift']());}};_0x459829(++_0x183400);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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 29f615e..ecbab83 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 _0x1bc8=['exports','./lib/api'];(function(_0xe62d5,_0x35cbb4){var _0x2973ae=function(_0x2980de){while(--_0x2980de){_0xe62d5['push'](_0xe62d5['shift']());}};_0x2973ae(++_0x35cbb4);}(_0x1bc8,0xbd));var _0x81bc=function(_0x4282aa,_0xe66504){_0x4282aa=_0x4282aa-0x0;var _0x5085f0=_0x1bc8[_0x4282aa];return _0x5085f0;};'use strict';var polly=require(_0x81bc('0x0'));module[_0x81bc('0x1')]=function(_0x195fec,_0x91021a,_0x2751bd,_0x20abd3,_0x2c2366,_0x15a0a7,_0x3729dc){return polly(_0x195fec,_0x91021a,_0x2751bd,_0x20abd3,_0x2c2366,_0x15a0a7,_0x3729dc);}; \ No newline at end of file +var _0xdf76=['./lib/api','exports'];(function(_0x3c3705,_0xe26696){var _0x44a55d=function(_0x9a6ba1){while(--_0x9a6ba1){_0x3c3705['push'](_0x3c3705['shift']());}};_0x44a55d(++_0xe26696);}(_0xdf76,0x134));var _0x6df7=function(_0xbce261,_0x5bf87e){_0xbce261=_0xbce261-0x0;var _0x23848f=_0xdf76[_0xbce261];return _0x23848f;};'use strict';var polly=require(_0x6df7('0x0'));module[_0x6df7('0x1')]=function(_0x362caf,_0xe0c382,_0x2f5cf1,_0x4fd722,_0x142afc,_0x160280,_0x4bdfd4){return polly(_0x362caf,_0xe0c382,_0x2f5cf1,_0x4fd722,_0x142afc,_0x160280,_0x4bdfd4);}; \ 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 807e9cd..4e822af 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 _0x972e=['exports','Polly','mp3','path','bluebird','randomstring','aws-sdk','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x121b1a,_0x42fdb7){var _0x2d89a6=function(_0x1b6027){while(--_0x1b6027){_0x121b1a['push'](_0x121b1a['shift']());}};_0x2d89a6(++_0x42fdb7);}(_0x972e,0x1c6));var _0xe972=function(_0x776f54,_0x3c001c){_0x776f54=_0x776f54-0x0;var _0x2a04fc=_0x972e[_0x776f54];return _0x2a04fc;};'use strict';var fs=require('fs');var path=require(_0xe972('0x0'));var BPromise=require(_0xe972('0x1'));var rs=require(_0xe972('0x2'));var AWS=require(_0xe972('0x3'));function pollyResult(_0x3ca441,_0xd34869,_0x1645cb){return new BPromise(function(_0x3f0e5a,_0x18f4b8){_0x3ca441['synthesizeSpeech'](_0xd34869,function(_0x4c564c,_0x306001){if(_0x4c564c){_0x18f4b8(_0x4c564c);}else if(_0x306001){if(_0x306001[_0xe972('0x4')]instanceof Buffer){fs[_0xe972('0x5')](_0x1645cb,_0x306001['AudioStream'],function(_0x34e2ee){if(_0x34e2ee){_0x18f4b8(_0x34e2ee);}else{_0x3f0e5a();}});}else{_0x18f4b8(new Error(_0xe972('0x6')));}}else{_0x18f4b8(new Error(_0xe972('0x7')));}});});}module[_0xe972('0x8')]=function(_0x57e028,_0xdd218,_0x321ce7,_0x4cff0d,_0x586d49,_0x257f8e,_0x1dd76a){var _0x54176c=new AWS[(_0xe972('0x9'))]({'accessKeyId':_0x57e028,'secretAccessKey':_0xdd218,'region':_0x321ce7});var _0x1295a0={'Text':_0x586d49,'TextType':_0x257f8e||'text','OutputFormat':_0xe972('0xa'),'VoiceId':_0x4cff0d};return pollyResult(_0x54176c,_0x1295a0,_0x1dd76a);}; \ No newline at end of file +var _0x9d0b=['randomstring','aws-sdk','AudioStream','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','mp3','path','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9d0b,0x73));var _0xb9d0=function(_0x2573ba,_0x15eb34){_0x2573ba=_0x2573ba-0x0;var _0x56b673=_0x9d0b[_0x2573ba];return _0x56b673;};'use strict';var fs=require('fs');var path=require(_0xb9d0('0x0'));var BPromise=require(_0xb9d0('0x1'));var rs=require(_0xb9d0('0x2'));var AWS=require(_0xb9d0('0x3'));function pollyResult(_0x599df7,_0x8cc42f,_0x27c5b4){return new BPromise(function(_0x51edd7,_0x41b7f2){_0x599df7['synthesizeSpeech'](_0x8cc42f,function(_0x585e07,_0x4f4cb8){if(_0x585e07){_0x41b7f2(_0x585e07);}else if(_0x4f4cb8){if(_0x4f4cb8[_0xb9d0('0x4')]instanceof Buffer){fs['writeFile'](_0x27c5b4,_0x4f4cb8[_0xb9d0('0x4')],function(_0x225cb4){if(_0x225cb4){_0x41b7f2(_0x225cb4);}else{_0x51edd7();}});}else{_0x41b7f2(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x41b7f2(new Error(_0xb9d0('0x5')));}});});}module[_0xb9d0('0x6')]=function(_0x376493,_0x4fb320,_0x2d0e04,_0x3a60d7,_0x407786,_0x492128,_0x530909){var _0x219cfa=new AWS[(_0xb9d0('0x7'))]({'accessKeyId':_0x376493,'secretAccessKey':_0x4fb320,'region':_0x2d0e04});var _0x2a9c7f={'Text':_0x407786,'TextType':_0x492128||'text','OutputFormat':_0xb9d0('0x8'),'VoiceId':_0x3a60d7};return pollyResult(_0x219cfa,_0x2a9c7f,_0x530909);}; \ 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 deb9712..aa08264 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. * // * * // ************************************************************************* -'use strict';var asr=require('./lib/api');module['exports']=function(_0x43aedc,_0x3cc3c9,_0x457a19,_0x2a1660){return asr(_0x43aedc,_0x3cc3c9,_0x457a19);}; \ No newline at end of file +'use strict';var asr=require('./lib/api');module['exports']=function(_0x196dee,_0x5b37e2,_0x499c71,_0x199bbc){return asr(_0x196dee,_0x5b37e2,_0x499c71);}; \ 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 95b03cc..fae52ad 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 _0x063c=['undefined','length','readFileSync','toString','POST','LINEAR16','bluebird','https://speech.googleapis.com','exports','filepath\x20should\x20be\x20a\x20string','string','key\x20should\x20be\x20a\x20string'];(function(_0x2fd7d5,_0x3ac631){var _0x54bb19=function(_0x5663d0){while(--_0x5663d0){_0x2fd7d5['push'](_0x2fd7d5['shift']());}};_0x54bb19(++_0x3ac631);}(_0x063c,0xba));var _0xc063=function(_0x3e4b7a,_0x2e4e1a){_0x3e4b7a=_0x3e4b7a-0x0;var _0x54e20d=_0x063c[_0x3e4b7a];return _0x54e20d;};'use strict';var url=require('url');var BPromise=require(_0xc063('0x0'));var fs=require('fs');var host=_0xc063('0x1');module[_0xc063('0x2')]=function(_0x25e61c,_0x314f1b,_0x33d075){return new BPromise(function(_0x5aa766,_0x3803ac){var _0x5ec48e;if(typeof _0x25e61c!=='string'||_0x25e61c['length']===0x0){return _0x3803ac(_0xc063('0x3'));}if(typeof _0x314f1b!==_0xc063('0x4')||_0x314f1b['length']===0x0){return _0x3803ac(_0xc063('0x5'));}if(typeof _0x33d075!==_0xc063('0x6')&&(typeof _0x33d075!==_0xc063('0x4')||_0x33d075[_0xc063('0x7')]===0x0)){return _0x3803ac('lang\x20should\x20be\x20a\x20string');}try{_0x5ec48e=fs[_0xc063('0x8')](_0x25e61c)[_0xc063('0x9')]('base64');}catch(_0x34d40a){return _0x3803ac(_0x34d40a);}return _0x5aa766({'method':_0xc063('0xa'),'uri':host+'/v1/speech:recognize?key='+_0x314f1b,'body':{'config':{'encoding':_0xc063('0xb'),'sampleRateHertz':'8000','languageCode':_0x33d075},'audio':{'content':_0x5ec48e}},'json':!![]});});}; \ No newline at end of file +var _0x1ba2=['url','https://speech.googleapis.com','string','length','key\x20should\x20be\x20a\x20string','undefined','readFileSync','toString','POST','/v1/speech:recognize?key=','LINEAR16','8000'];(function(_0x539d03,_0x4b316c){var _0xe8112=function(_0x27db3b){while(--_0x27db3b){_0x539d03['push'](_0x539d03['shift']());}};_0xe8112(++_0x4b316c);}(_0x1ba2,0xb4));var _0x21ba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1ba2[_0x14add3];return _0x4a174f;};'use strict';var url=require(_0x21ba('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0x21ba('0x1');module['exports']=function(_0x31494a,_0x349a68,_0x46eb26){return new BPromise(function(_0xface0a,_0x3661dd){var _0x527ad5;if(typeof _0x31494a!==_0x21ba('0x2')||_0x31494a[_0x21ba('0x3')]===0x0){return _0x3661dd('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x349a68!==_0x21ba('0x2')||_0x349a68['length']===0x0){return _0x3661dd(_0x21ba('0x4'));}if(typeof _0x46eb26!==_0x21ba('0x5')&&(typeof _0x46eb26!=='string'||_0x46eb26[_0x21ba('0x3')]===0x0)){return _0x3661dd('lang\x20should\x20be\x20a\x20string');}try{_0x527ad5=fs[_0x21ba('0x6')](_0x31494a)[_0x21ba('0x7')]('base64');}catch(_0x3063e9){return _0x3661dd(_0x3063e9);}return _0xface0a({'method':_0x21ba('0x8'),'uri':host+_0x21ba('0x9')+_0x349a68,'body':{'config':{'encoding':_0x21ba('0xa'),'sampleRateHertz':_0x21ba('0xb'),'languageCode':_0x46eb26},'audio':{'content':_0x527ad5}},'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 714637a..8681891 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 _0x32be=['exports'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x32be,0x153));var _0xe32b=function(_0x321df4,_0x3efec5){_0x321df4=_0x321df4-0x0;var _0x50d06c=_0x32be[_0x321df4];return _0x50d06c;};var asr=require('./asr');module[_0xe32b('0x0')]={'asr':asr}; \ No newline at end of file +var _0xa79f=['./asr','exports'];(function(_0x187399,_0x40c56d){var _0x40fa92=function(_0x36058c){while(--_0x36058c){_0x187399['push'](_0x187399['shift']());}};_0x40fa92(++_0x40c56d);}(_0xa79f,0x1c8));var _0xfa79=function(_0x4d0d1b,_0x96cc39){_0x4d0d1b=_0x4d0d1b-0x0;var _0x3d1c6a=_0xa79f[_0x4d0d1b];return _0x3d1c6a;};var asr=require(_0xfa79('0x0'));module[_0xfa79('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index a11452c..7aeee7d 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 _0xf95b=['apiai-promise','bluebird','dialogflow','md5','path','querystring','url','parse','util','./aws','./google','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','request\x20to\x20','statusCode','statusMessage','\x20failed,\x20status\x20code\x20=\x20','info','finish\x20download\x20file','unlink','error','pipe','end','get','data','transcode','wav','error\x20convert','finish\x20to\x20convert','resolve','.wav','base64','then','777','split','readFileSync','toString','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','text:synthesize','POST','tmp','.mp3','from','audioContent','writeFile','chmodSync','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','null','generic','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','writeFileSync','goggleTTS\x20path','googleASR','asr','results','map','alternatives','transcript','confidence','join','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','code','metadata','isFallbackIntent','SessionsClient','sessionPath','detectIntent','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','generate','polly','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','channelData','CustomActionData','Data','audiofile','dirName'];(function(_0x20d7c3,_0x58591d){var _0xc1729e=function(_0x29c111){while(--_0x29c111){_0x20d7c3['push'](_0x20d7c3['shift']());}};_0xc1729e(++_0x58591d);}(_0xf95b,0x195));var _0xbf95=function(_0x205d7b,_0x1bf0b1){_0x205d7b=_0x205d7b-0x0;var _0x6fd0cc=_0xf95b[_0x205d7b];return _0x6fd0cc;};'use strict';var apiai=require(_0xbf95('0x0'));var BPromise=require(_0xbf95('0x1'));var dialogflow=require(_0xbf95('0x2'));var fs=require('fs');var http=require('http');var https=require('https');var md5=require(_0xbf95('0x3'));var path=require(_0xbf95('0x4'));var querystring=require(_0xbf95('0x5'));var rp=require('request-promise');var rs=require('randomstring');var sox=require('sox');var tts=require('google-tts-api');var urlParse=require(_0xbf95('0x6'))[_0xbf95('0x7')];var util=require(_0xbf95('0x8'));var aws=require(_0xbf95('0x9'));var google=require(_0xbf95('0xa'));var sestek=require('./sestek');var tilde=require(_0xbf95('0xb'));var logger=require(_0xbf95('0xc'))(_0xbf95('0xd'));var ISPEECH_API=_0xbf95('0xe');function downloadFile(_0x469076,_0x4958e4){return new BPromise(function(_0x16999f,_0x46b748){var _0x4134a9=urlParse(_0x469076);var _0x44f2b4=_0x4134a9[_0xbf95('0xf')]==='https:'?https:http;var _0x5586b6={'host':_0x4134a9[_0xbf95('0x10')],'path':_0x4134a9['path'],'headers':{'user-agent':_0xbf95('0x11')}};_0x44f2b4['get'](_0x5586b6,function(_0x27a7b6){if(_0x27a7b6['statusCode']!==0xc8){logger['error'](_0xbf95('0x12')+_0x469076+'\x20failed,\x20status\x20code\x20=\x20'+_0x27a7b6[_0xbf95('0x13')]+'\x20('+_0x27a7b6[_0xbf95('0x14')]+')');_0x46b748(new Error(_0xbf95('0x12')+_0x469076+_0xbf95('0x15')+_0x27a7b6['statusCode']+'\x20('+_0x27a7b6[_0xbf95('0x14')]+')'));return;}var _0x38ea70=fs['createWriteStream'](_0x4958e4);_0x38ea70['on']('finish',function(){logger[_0xbf95('0x16')](_0xbf95('0x17'));_0x38ea70['close'](_0x16999f);});_0x38ea70['on']('error',function(_0x4416c3){fs[_0xbf95('0x18')](_0x4958e4);logger[_0xbf95('0x19')]('download\x20error',_0x4416c3);_0x46b748(_0x4416c3);});_0x27a7b6[_0xbf95('0x1a')](_0x38ea70);})['on'](_0xbf95('0x19'),function(_0xf48937){logger[_0xbf95('0x19')](_0xf48937);_0x46b748(_0xf48937);})[_0xbf95('0x1b')]();});}function uploadFile(_0x140d5f){return new BPromise(function(_0x1a9405,_0x24c916){var _0x406678=urlParse(_0x140d5f);var _0x237f76=_0x406678['protocol']==='https:'?https:http;var _0x223c91={'host':_0x406678['host'],'path':_0x406678[_0xbf95('0x4')],'headers':{'user-agent':_0xbf95('0x11')}};_0x237f76[_0xbf95('0x1c')](_0x223c91,function(_0x320650){if(_0x320650[_0xbf95('0x13')]!==0xc8){_0x24c916(new Error('request\x20to\x20'+_0x140d5f+'\x20failed,\x20status\x20code\x20=\x20'+_0x320650[_0xbf95('0x13')]+'\x20('+_0x320650[_0xbf95('0x14')]+')'));return;}var _0x12ad71='';_0x320650['on'](_0xbf95('0x1d'),function(_0x4ed469){_0x12ad71+=_0x4ed469;});_0x320650['on']('end',function(){_0x1a9405(_0x12ad71);});})['on'](_0xbf95('0x19'),function(_0x599431){_0x24c916(_0x599431);})[_0xbf95('0x1b')]();});}function convertFile(_0x530033,_0x684e22){return new BPromise(function(_0x4417ee,_0x526406){var _0x6c18c7=sox[_0xbf95('0x1e')](_0x530033,_0x684e22,{'sampleRate':0x1f40,'format':_0xbf95('0x1f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x6c18c7['on'](_0xbf95('0x19'),function(_0x547bdf){logger[_0xbf95('0x19')](_0xbf95('0x20'),_0x547bdf);_0x526406(_0x547bdf);});_0x6c18c7['on'](_0xbf95('0x1b'),function(){logger[_0xbf95('0x16')](_0xbf95('0x21'));_0x4417ee();});_0x6c18c7['start']();});}function base64Decode(_0x223914,_0x304a94){var _0x53b762=path[_0xbf95('0x22')](__dirname,'tmp',rs['generate'](0x4)+_0xbf95('0x23'));fs['writeFileSync'](_0x53b762,_0x223914,_0xbf95('0x24'));return convertFile(_0x53b762,_0x304a94)[_0xbf95('0x25')](function(){try{fs[_0xbf95('0x18')](_0x53b762);fs['chmodSync'](_0x304a94,_0xbf95('0x26'));}catch(_0x1325aa){logger[_0xbf95('0x19')](_0x1325aa);}return _0x304a94[_0xbf95('0x27')]('.')[0x0];});}function base64Encode(_0x2cce8e){var _0x13b524=fs[_0xbf95('0x28')](_0x2cce8e);return new Buffer(_0x13b524)[_0xbf95('0x29')](_0xbf95('0x24'));}exports['googleCloudTTS']=function(_0x1f3e2b,_0x3ff826,_0x95feab,_0x2959f9,_0x4371b3,_0x85dae8){var _0x29b4c5,_0x3363b2;var _0x32c60c=_0xbf95('0x2a');var _0x12797e=_0xbf95('0x2b')+_0x1f3e2b;var _0x4e81b4={};if(_0x3ff826===_0xbf95('0x2c')){_0x4e81b4[_0xbf95('0x2d')]={'ssml':_0x95feab};}else{_0x4e81b4[_0xbf95('0x2d')]={'text':_0x95feab};};_0x4e81b4[_0xbf95('0x2e')]={'languageCode':_0x2959f9,'ssmlGender':_0x4371b3};_0x4e81b4[_0xbf95('0x2f')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x4535d4={'url':_0x32c60c+_0xbf95('0x30')+_0x12797e,'method':_0xbf95('0x31'),'json':!![],'body':_0x4e81b4};return rp(_0x4535d4)['then'](function(_0x5d1bd7){return new BPromise(function(_0x253892,_0x43359e){_0x29b4c5=path['resolve'](__dirname,_0xbf95('0x32'),rs['generate'](0x4)+_0xbf95('0x33'));var _0xa78fc9=Buffer[_0xbf95('0x34')](_0x5d1bd7[_0xbf95('0x35')],_0xbf95('0x24'));return fs[_0xbf95('0x36')](_0x29b4c5,_0xa78fc9,function(_0x1a07cc){_0x43359e(_0x1a07cc);},function(_0x4769f5){fs[_0xbf95('0x37')](_0x29b4c5,_0xbf95('0x26'));_0x253892(_0x4769f5);});});})[_0xbf95('0x25')](function(_0x590898){_0x3363b2=path[_0xbf95('0x22')](__dirname,'tmp',rs['generate'](0x4)+_0xbf95('0x23'));return convertFile(_0x29b4c5,_0x3363b2);})['then'](function(){try{fs[_0xbf95('0x18')](_0x29b4c5);fs['chmodSync'](_0x3363b2,_0xbf95('0x26'));}catch(_0x52b1d4){logger[_0xbf95('0x19')](_0x52b1d4);}logger[_0xbf95('0x16')](_0xbf95('0x38'),_0x3363b2[_0xbf95('0x27')]('.')[0x0]);return _0x3363b2['split']('.')[0x0];});};exports[_0xbf95('0x39')]=function(_0x156c38,_0x51796d){var _0x1e2a3c=_0xbf95('0x3a');var _0x36eb27,_0x559633;var _0x1e6310;var _0x402aad={'encoding':_0xbf95('0x3b'),'method':_0xbf95('0x31'),'timeout':0x2710,'url':_0x1e2a3c,'headers':{'Content-Type':_0xbf95('0x3c')},'body':_0xbf95('0x3d')+encodeURIComponent(JSON[_0xbf95('0x3e')]([[['jQ1olc',JSON[_0xbf95('0x3e')]([_0x156c38,_0x51796d||'en',![],_0xbf95('0x3f')]),null,_0xbf95('0x40')]]]))};return rp(_0x402aad)[_0xbf95('0x25')](function(_0x45b15e){try{_0x1e6310=eval(_0x45b15e['slice'](0x5))[0x0][0x2];}catch(_0x53bcf7){throw new Error(_0xbf95('0x41')+_0x45b15e[_0xbf95('0x1d')]);}if(!_0x1e6310){if(_0x156c38[_0xbf95('0x42')]>0xc8){throw new Error(_0xbf95('0x43'));}else{throw new Error(_0xbf95('0x44')+_0x51796d+'\x22\x20might\x20not\x20exist');}}try{_0x1e6310=eval(_0x1e6310)[0x0];}catch(_0x9b477d){throw new Error(_0xbf95('0x41')+res[_0xbf95('0x1d')]);}const _0x218ec8=_0x1e6310;_0x36eb27=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0xbf95('0x33'));fs[_0xbf95('0x45')](_0x36eb27,_0x1e6310,{'encoding':_0xbf95('0x24')});_0x559633=path[_0xbf95('0x22')](__dirname,_0xbf95('0x32'),rs['generate'](0x4)+_0xbf95('0x23'));return convertFile(_0x36eb27,_0x559633);})[_0xbf95('0x25')](function(){try{fs[_0xbf95('0x18')](_0x36eb27);fs[_0xbf95('0x37')](_0x559633,_0xbf95('0x26'));}catch(_0x15c787){logger['error'](_0x15c787);}logger[_0xbf95('0x16')](_0xbf95('0x46'),_0x559633[_0xbf95('0x27')]('.')[0x0]);return _0x559633[_0xbf95('0x27')]('.')[0x0];});};exports[_0xbf95('0x47')]=function(_0x3571c1,_0x53ffee,_0x113695){return google[_0xbf95('0x48')](_0x3571c1,_0x53ffee,_0x113695)[_0xbf95('0x25')](function(_0x16b2f6){logger[_0xbf95('0x16')](_0x16b2f6['uri']);return rp(_0x16b2f6);})[_0xbf95('0x25')](function(_0x277bdb){var _0x472cb3='';var _0x47beb6=0x0;try{fs['unlink'](_0x3571c1);}catch(_0x3e9267){logger[_0xbf95('0x19')](_0x3e9267);}if(_0x277bdb&&_0x277bdb[_0xbf95('0x49')]){_0x472cb3=_0x277bdb[_0xbf95('0x49')][_0xbf95('0x4a')](function(_0x193f3f){return _0x193f3f&&_0x193f3f['alternatives'][0x0]&&_0x193f3f[_0xbf95('0x4b')][0x0][_0xbf95('0x4c')]?_0x193f3f[_0xbf95('0x4b')][0x0][_0xbf95('0x4c')]:'';})['join']('\x0a');_0x47beb6=_0x277bdb[_0xbf95('0x49')][_0xbf95('0x4a')](function(_0x162eea){return _0x162eea&&_0x162eea['alternatives'][0x0]&&_0x162eea[_0xbf95('0x4b')][0x0][_0xbf95('0x4d')]?_0x162eea['alternatives'][0x0][_0xbf95('0x4d')]:0x0;})[_0xbf95('0x4e')]('\x0a');}logger['info'](_0xbf95('0x4f'),_0x472cb3);logger['info'](_0xbf95('0x50'),_0x47beb6);return{'transcript':_0x472cb3,'confidence':_0x47beb6};})[_0xbf95('0x51')](function(_0xa088c5){logger[_0xbf95('0x19')](_0xbf95('0x52'),_0xa088c5[_0xbf95('0x13')],_0xa088c5[_0xbf95('0x53')],_0xa088c5[_0xbf95('0x54')]);});};exports[_0xbf95('0x55')]=function(_0x5b21b8,_0x4578ca,_0x26c8d3,_0x24c4bb){var _0x390140=apiai(_0x4578ca,{'language':_0x24c4bb||'en'});return _0x390140[_0xbf95('0x56')](_0x26c8d3,{'sessionId':md5(_0x5b21b8)})[_0xbf95('0x25')](function(_0x2bf0a1){logger[_0xbf95('0x16')](JSON[_0xbf95('0x3e')](_0x2bf0a1));return{'source':_0x2bf0a1[_0xbf95('0x57')][_0xbf95('0x58')],'resolvedQuery':_0x2bf0a1['result'][_0xbf95('0x59')],'action':_0x2bf0a1['result'][_0xbf95('0x5a')],'actionIncomplete':_0x2bf0a1['result'][_0xbf95('0x5b')],'speech':_0x2bf0a1['result'][_0xbf95('0x5c')][_0xbf95('0x5d')],'score':_0x2bf0a1[_0xbf95('0x57')]['score'],'statusCode':_0x2bf0a1['status'][_0xbf95('0x5e')],'endConversation':_0x2bf0a1['result'][_0xbf95('0x5f')]['endConversation']||![],'isFallbackIntent':_0x2bf0a1[_0xbf95('0x57')][_0xbf95('0x5f')][_0xbf95('0x60')]};});};exports['googleDialogflowV2']=function(_0x87b705,_0x166cb2,_0x145787,_0x1f30e4,_0xc19b7c,_0x3a17cf){var _0x5eddd5=_0x1f30e4['replace'](/\\n/g,'\x0a');var _0x93c324={'credentials':{'private_key':_0x5eddd5,'client_email':_0x145787}};var _0x5ae39c=new dialogflow[(_0xbf95('0x61'))](_0x93c324);var _0x2bb644=_0x5ae39c[_0xbf95('0x62')](_0x166cb2,md5(_0x87b705));var _0x19be65={'session':_0x2bb644,'queryInput':{'text':{'text':_0xc19b7c,'languageCode':_0x3a17cf}}};return _0x5ae39c[_0xbf95('0x63')](_0x19be65)[_0xbf95('0x25')](function(_0x55cc07){if(_0x55cc07&&_0x55cc07[_0xbf95('0x42')]){logger[_0xbf95('0x16')]('Dialogflow\x20V2\x20response:',JSON[_0xbf95('0x3e')](_0x55cc07));var _0x227804=_0x55cc07[0x0];if(_0x227804){var _0x283f88={'action':_0x227804[_0xbf95('0x64')]['action'],'allRequiredParamsPresent':_0x227804[_0xbf95('0x64')][_0xbf95('0x65')],'endConversation':_0x227804['queryResult']['diagnosticInfo']&&_0x227804[_0xbf95('0x64')][_0xbf95('0x66')][_0xbf95('0x67')]?_0x227804[_0xbf95('0x64')][_0xbf95('0x66')]['fields'][_0xbf95('0x68')][_0xbf95('0x69')]:![],'fulfillmentText':_0x227804[_0xbf95('0x64')][_0xbf95('0x6a')],'intentName':_0x227804[_0xbf95('0x64')][_0xbf95('0x6b')][_0xbf95('0x53')],'intentDisplayName':_0x227804[_0xbf95('0x64')][_0xbf95('0x6b')][_0xbf95('0x6c')],'isFallbackIntent':_0x227804[_0xbf95('0x64')]['intent'][_0xbf95('0x6d')],'languageCode':_0x227804[_0xbf95('0x64')][_0xbf95('0x6e')],'queryText':_0x227804[_0xbf95('0x64')][_0xbf95('0x6f')],'responseId':_0x227804[_0xbf95('0x70')],'score':_0x227804['queryResult'][_0xbf95('0x71')],'speech':_0x227804[_0xbf95('0x64')]['fulfillmentText'],'providerResponse':JSON[_0xbf95('0x3e')](_0x55cc07)};return _0x283f88;}}});};exports[_0xbf95('0x72')]=function(_0x320070,_0x1a2872,_0x57f2de,_0x5960f9){return tilde[_0xbf95('0x48')](_0x320070,_0x1a2872,_0x57f2de,_0x5960f9)[_0xbf95('0x25')](function(_0x25d6a7){try{fs[_0xbf95('0x18')](_0x320070);}catch(_0xa40f4e){logger[_0xbf95('0x19')](_0xa40f4e);}logger[_0xbf95('0x16')](_0xbf95('0x73'),_0x25d6a7[_0xbf95('0x4c')]);logger[_0xbf95('0x16')](_0xbf95('0x74'),_0x25d6a7['confidence']);return _0x25d6a7;});};exports[_0xbf95('0x75')]=function(_0x3db0a2,_0x2f36fb,_0x45a38e,_0x4a9c13,_0x207ed3,_0x1f57e8){var _0x12ede0=path[_0xbf95('0x22')](__dirname,'tmp',rs[_0xbf95('0x76')](0x4)+_0xbf95('0x33'));var _0x340e55;return aws[_0xbf95('0x77')](_0x3db0a2,_0x2f36fb,_0x45a38e,_0x4a9c13,_0x207ed3,_0x1f57e8,_0x12ede0)[_0xbf95('0x25')](function(){_0x340e55=path['resolve'](__dirname,_0xbf95('0x32'),rs[_0xbf95('0x76')](0x4)+_0xbf95('0x23'));return convertFile(_0x12ede0,_0x340e55);})['then'](function(){try{fs[_0xbf95('0x18')](_0x12ede0);fs[_0xbf95('0x37')](_0x340e55,_0xbf95('0x26'));}catch(_0x2ae9b4){logger[_0xbf95('0x19')](_0x2ae9b4);}return _0x340e55[_0xbf95('0x27')]('.')[0x0];});};exports['awsLex']=function(_0x4f6c58,_0x5293cc,_0x4256f1,_0x203328,_0x41b25b,_0xb911d7){return aws[_0xbf95('0x78')](_0x4f6c58,_0x5293cc,_0x4256f1,_0x203328,_0x41b25b,_0xb911d7)['then'](function(_0xc5ebb9){logger[_0xbf95('0x16')](JSON[_0xbf95('0x3e')](_0xc5ebb9));return _0xc5ebb9;});};exports[_0xbf95('0x79')]=function(_0x3a82cf,_0x21a67a,_0x5e1550,_0x1989b0){var _0x41a385=util[_0xbf95('0x7a')](_0xbf95('0x7b'),ISPEECH_API,_0x3a82cf,encodeURIComponent(_0x21a67a),_0x5e1550,_0x1989b0);var _0x3e1777=path[_0xbf95('0x22')](__dirname,'tmp',rs[_0xbf95('0x76')](0x4)+_0xbf95('0x33'));var _0x5f3998;return downloadFile(_0x41a385,_0x3e1777)[_0xbf95('0x25')](function(){_0x5f3998=path[_0xbf95('0x22')](__dirname,_0xbf95('0x32'),rs[_0xbf95('0x76')](0x4)+_0xbf95('0x23'));return convertFile(_0x3e1777,_0x5f3998);})[_0xbf95('0x25')](function(){try{fs[_0xbf95('0x18')](_0x3e1777);fs[_0xbf95('0x37')](_0x5f3998,_0xbf95('0x26'));}catch(_0x45b6a8){logger['error'](_0x45b6a8);}return _0x5f3998[_0xbf95('0x27')]('.')[0x0];});};exports[_0xbf95('0x7c')]=function(_0x148f66,_0x45b4b5,_0x4179a0,_0x478075){var _0x23725f=util[_0xbf95('0x7a')](_0xbf95('0x7d'),ISPEECH_API,_0x45b4b5,_0x4179a0,base64Encode(_0x148f66),_0x478075?util[_0xbf95('0x7a')](_0xbf95('0x7e'),encodeURIComponent(_0x478075)):_0xbf95('0x7f'));return uploadFile(_0x23725f)[_0xbf95('0x25')](function(_0x3f630a){return querystring[_0xbf95('0x7')](_0x3f630a);});};exports[_0xbf95('0x80')]=function(_0x102cd6,_0x1e6c87){return sestek[_0xbf95('0x81')](_0x102cd6,_0x1e6c87)['then'](function(_0x7e5bdd){logger[_0xbf95('0x16')](JSON[_0xbf95('0x3e')](_0x7e5bdd));var _0x2a4869={'speech':_0x7e5bdd['text'],'action':_0x7e5bdd[_0xbf95('0x82')]?_0x7e5bdd['channelData']['CustomAction']:undefined,'actiondata':_0x7e5bdd['channelData']?_0x7e5bdd['channelData'][_0xbf95('0x83')]:undefined};if(_0x7e5bdd['channelData']&&_0x7e5bdd[_0xbf95('0x82')]['AudioFromTts']){return base64Decode(_0x7e5bdd[_0xbf95('0x82')]['AudioFromTts'][_0xbf95('0x84')],path[_0xbf95('0x22')](__dirname,_0xbf95('0x32'),rs[_0xbf95('0x76')](0x4)+_0xbf95('0x23')))[_0xbf95('0x25')](function(_0x16e1a7){_0x2a4869[_0xbf95('0x85')]=_0x16e1a7;return _0x2a4869;});}return _0x2a4869;});};exports[_0xbf95('0x86')]=function(){return __dirname;}; \ No newline at end of file +var _0x5c6a=['SessionsClient','Dialogflow\x20V2\x20response:','allRequiredParamsPresent','queryResult','diagnosticInfo','fields','end_conversation','fulfillmentText','intent','displayName','isFallback','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','awsLex','lex','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','parse','sestekNDA','nda','text','channelData','CustomAction','AudioFromTts','Data','dirName','bluebird','http','https','md5','path','randomstring','sox','google-tts-api','url','./aws','./sestek','./tilde','agi','protocol','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','unlink','pipe','end','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','tmp','generate','.wav','base64','then','chmodSync','split','toString','googleCloudTTS','?key=','input','voice','audioConfig','MP3','text:synthesize','POST','resolve','.mp3','from','777','info','googleCloudTTS\x20path','googleTTS','utf8','application/x-www-form-urlencoded','stringify','jQ1olc','generic','slice','parse\x20response\x20failed:\x0a','length','lang\x20\x22','\x22\x20might\x20not\x20exist','writeFileSync','goggleTTS\x20path','asr','uri','results','alternatives','transcript','join','confidence','googleASR\x20confidence','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','action','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace'];(function(_0x3a8db5,_0x31cff7){var _0x2c03cd=function(_0x47dba0){while(--_0x47dba0){_0x3a8db5['push'](_0x3a8db5['shift']());}};_0x2c03cd(++_0x31cff7);}(_0x5c6a,0x197));var _0xa5c6=function(_0x43c1c2,_0x3ec409){_0x43c1c2=_0x43c1c2-0x0;var _0x233420=_0x5c6a[_0x43c1c2];return _0x233420;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0xa5c6('0x0'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0xa5c6('0x1'));var https=require(_0xa5c6('0x2'));var md5=require(_0xa5c6('0x3'));var path=require(_0xa5c6('0x4'));var querystring=require('querystring');var rp=require('request-promise');var rs=require(_0xa5c6('0x5'));var sox=require(_0xa5c6('0x6'));var tts=require(_0xa5c6('0x7'));var urlParse=require(_0xa5c6('0x8'))['parse'];var util=require('util');var aws=require(_0xa5c6('0x9'));var google=require('./google');var sestek=require(_0xa5c6('0xa'));var tilde=require(_0xa5c6('0xb'));var logger=require('../../../config/logger')(_0xa5c6('0xc'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x41d957,_0x484d8a){return new BPromise(function(_0x46854f,_0x5d3841){var _0x2b4e11=urlParse(_0x41d957);var _0x2f1ef8=_0x2b4e11[_0xa5c6('0xd')]===_0xa5c6('0xe')?https:http;var _0x565bd7={'host':_0x2b4e11[_0xa5c6('0xf')],'path':_0x2b4e11[_0xa5c6('0x4')],'headers':{'user-agent':_0xa5c6('0x10')}};_0x2f1ef8[_0xa5c6('0x11')](_0x565bd7,function(_0x578f33){if(_0x578f33[_0xa5c6('0x12')]!==0xc8){logger[_0xa5c6('0x13')](_0xa5c6('0x14')+_0x41d957+'\x20failed,\x20status\x20code\x20=\x20'+_0x578f33[_0xa5c6('0x12')]+'\x20('+_0x578f33['statusMessage']+')');_0x5d3841(new Error('request\x20to\x20'+_0x41d957+_0xa5c6('0x15')+_0x578f33[_0xa5c6('0x12')]+'\x20('+_0x578f33['statusMessage']+')'));return;}var _0x24995d=fs[_0xa5c6('0x16')](_0x484d8a);_0x24995d['on'](_0xa5c6('0x17'),function(){logger['info']('finish\x20download\x20file');_0x24995d['close'](_0x46854f);});_0x24995d['on'](_0xa5c6('0x13'),function(_0x7b9a90){fs[_0xa5c6('0x18')](_0x484d8a);logger[_0xa5c6('0x13')]('download\x20error',_0x7b9a90);_0x5d3841(_0x7b9a90);});_0x578f33[_0xa5c6('0x19')](_0x24995d);})['on'](_0xa5c6('0x13'),function(_0x4ba05d){logger[_0xa5c6('0x13')](_0x4ba05d);_0x5d3841(_0x4ba05d);})[_0xa5c6('0x1a')]();});}function uploadFile(_0x5939b0){return new BPromise(function(_0x1e56b1,_0x415d60){var _0xe73a4c=urlParse(_0x5939b0);var _0x44b98e=_0xe73a4c[_0xa5c6('0xd')]===_0xa5c6('0xe')?https:http;var _0x5971b9={'host':_0xe73a4c[_0xa5c6('0xf')],'path':_0xe73a4c[_0xa5c6('0x4')],'headers':{'user-agent':_0xa5c6('0x10')}};_0x44b98e[_0xa5c6('0x11')](_0x5971b9,function(_0x5c90b6){if(_0x5c90b6[_0xa5c6('0x12')]!==0xc8){_0x415d60(new Error(_0xa5c6('0x14')+_0x5939b0+_0xa5c6('0x15')+_0x5c90b6[_0xa5c6('0x12')]+'\x20('+_0x5c90b6['statusMessage']+')'));return;}var _0x48cf9e='';_0x5c90b6['on'](_0xa5c6('0x1b'),function(_0x14cd0c){_0x48cf9e+=_0x14cd0c;});_0x5c90b6['on'](_0xa5c6('0x1a'),function(){_0x1e56b1(_0x48cf9e);});})['on'](_0xa5c6('0x13'),function(_0x42554a){_0x415d60(_0x42554a);})['end']();});}function convertFile(_0x4b717b,_0x305e35){return new BPromise(function(_0x357bab,_0x15502f){var _0x2993f6=sox[_0xa5c6('0x1c')](_0x4b717b,_0x305e35,{'sampleRate':0x1f40,'format':_0xa5c6('0x1d'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2993f6['on'](_0xa5c6('0x13'),function(_0x146087){logger[_0xa5c6('0x13')](_0xa5c6('0x1e'),_0x146087);_0x15502f(_0x146087);});_0x2993f6['on'](_0xa5c6('0x1a'),function(){logger['info'](_0xa5c6('0x1f'));_0x357bab();});_0x2993f6[_0xa5c6('0x20')]();});}function base64Decode(_0x5ec0ca,_0x56092e){var _0x189c4d=path['resolve'](__dirname,_0xa5c6('0x21'),rs[_0xa5c6('0x22')](0x4)+_0xa5c6('0x23'));fs['writeFileSync'](_0x189c4d,_0x5ec0ca,_0xa5c6('0x24'));return convertFile(_0x189c4d,_0x56092e)[_0xa5c6('0x25')](function(){try{fs[_0xa5c6('0x18')](_0x189c4d);fs[_0xa5c6('0x26')](_0x56092e,'777');}catch(_0x42927d){logger[_0xa5c6('0x13')](_0x42927d);}return _0x56092e[_0xa5c6('0x27')]('.')[0x0];});}function base64Encode(_0x211f61){var _0x20ded6=fs['readFileSync'](_0x211f61);return new Buffer(_0x20ded6)[_0xa5c6('0x28')](_0xa5c6('0x24'));}exports[_0xa5c6('0x29')]=function(_0x33c02a,_0x4384eb,_0xd997d1,_0x37292d,_0x104b35,_0x367a53){var _0x25fe76,_0x374041;var _0xd661c6='https://texttospeech.googleapis.com/v1/';var _0x2aa6dc=_0xa5c6('0x2a')+_0x33c02a;var _0x1dbd7f={};if(_0x4384eb==='ssml'){_0x1dbd7f['input']={'ssml':_0xd997d1};}else{_0x1dbd7f[_0xa5c6('0x2b')]={'text':_0xd997d1};};_0x1dbd7f[_0xa5c6('0x2c')]={'languageCode':_0x37292d,'ssmlGender':_0x104b35};_0x1dbd7f[_0xa5c6('0x2d')]={'audioEncoding':_0xa5c6('0x2e'),'sampleRateHertz':0x1f40};var _0x434e4c={'url':_0xd661c6+_0xa5c6('0x2f')+_0x2aa6dc,'method':_0xa5c6('0x30'),'json':!![],'body':_0x1dbd7f};return rp(_0x434e4c)['then'](function(_0x5124d4){return new BPromise(function(_0x39bb82,_0x383488){_0x25fe76=path[_0xa5c6('0x31')](__dirname,_0xa5c6('0x21'),rs[_0xa5c6('0x22')](0x4)+_0xa5c6('0x32'));var _0x44fa27=Buffer[_0xa5c6('0x33')](_0x5124d4['audioContent'],_0xa5c6('0x24'));return fs['writeFile'](_0x25fe76,_0x44fa27,function(_0x4913e7){_0x383488(_0x4913e7);},function(_0x150733){fs[_0xa5c6('0x26')](_0x25fe76,_0xa5c6('0x34'));_0x39bb82(_0x150733);});});})[_0xa5c6('0x25')](function(_0x37bd1d){_0x374041=path[_0xa5c6('0x31')](__dirname,_0xa5c6('0x21'),rs['generate'](0x4)+_0xa5c6('0x23'));return convertFile(_0x25fe76,_0x374041);})[_0xa5c6('0x25')](function(){try{fs[_0xa5c6('0x18')](_0x25fe76);fs[_0xa5c6('0x26')](_0x374041,'777');}catch(_0x53e50f){logger[_0xa5c6('0x13')](_0x53e50f);}logger[_0xa5c6('0x35')](_0xa5c6('0x36'),_0x374041['split']('.')[0x0]);return _0x374041['split']('.')[0x0];});};exports[_0xa5c6('0x37')]=function(_0x496dce,_0x1f1448){var _0x5cae02='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0xe27c18,_0x89a707;var _0x3d2b1c;var _0x307606={'encoding':_0xa5c6('0x38'),'method':_0xa5c6('0x30'),'timeout':0x2710,'url':_0x5cae02,'headers':{'Content-Type':_0xa5c6('0x39')},'body':'f.req='+encodeURIComponent(JSON[_0xa5c6('0x3a')]([[[_0xa5c6('0x3b'),JSON[_0xa5c6('0x3a')]([_0x496dce,_0x1f1448||'en',![],'null']),null,_0xa5c6('0x3c')]]]))};return rp(_0x307606)[_0xa5c6('0x25')](function(_0x3f11df){try{_0x3d2b1c=eval(_0x3f11df[_0xa5c6('0x3d')](0x5))[0x0][0x2];}catch(_0x527af4){throw new Error(_0xa5c6('0x3e')+_0x3f11df[_0xa5c6('0x1b')]);}if(!_0x3d2b1c){if(_0x496dce[_0xa5c6('0x3f')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0xa5c6('0x40')+_0x1f1448+_0xa5c6('0x41'));}}try{_0x3d2b1c=eval(_0x3d2b1c)[0x0];}catch(_0x371f56){throw new Error(_0xa5c6('0x3e')+res[_0xa5c6('0x1b')]);}const _0x21a342=_0x3d2b1c;_0xe27c18=path['resolve'](__dirname,'tmp',rs[_0xa5c6('0x22')](0x4)+_0xa5c6('0x32'));fs[_0xa5c6('0x42')](_0xe27c18,_0x3d2b1c,{'encoding':_0xa5c6('0x24')});_0x89a707=path[_0xa5c6('0x31')](__dirname,_0xa5c6('0x21'),rs[_0xa5c6('0x22')](0x4)+'.wav');return convertFile(_0xe27c18,_0x89a707);})[_0xa5c6('0x25')](function(){try{fs[_0xa5c6('0x18')](_0xe27c18);fs[_0xa5c6('0x26')](_0x89a707,'777');}catch(_0x1def9b){logger[_0xa5c6('0x13')](_0x1def9b);}logger[_0xa5c6('0x35')](_0xa5c6('0x43'),_0x89a707[_0xa5c6('0x27')]('.')[0x0]);return _0x89a707[_0xa5c6('0x27')]('.')[0x0];});};exports['googleASR']=function(_0x2b67b7,_0x12cd8c,_0x3c36ad){return google[_0xa5c6('0x44')](_0x2b67b7,_0x12cd8c,_0x3c36ad)[_0xa5c6('0x25')](function(_0x4ca5aa){logger[_0xa5c6('0x35')](_0x4ca5aa[_0xa5c6('0x45')]);return rp(_0x4ca5aa);})[_0xa5c6('0x25')](function(_0x5478f4){var _0x33a639='';var _0x40d816=0x0;try{fs[_0xa5c6('0x18')](_0x2b67b7);}catch(_0x23bbdf){logger[_0xa5c6('0x13')](_0x23bbdf);}if(_0x5478f4&&_0x5478f4[_0xa5c6('0x46')]){_0x33a639=_0x5478f4[_0xa5c6('0x46')]['map'](function(_0x281b55){return _0x281b55&&_0x281b55[_0xa5c6('0x47')][0x0]&&_0x281b55['alternatives'][0x0][_0xa5c6('0x48')]?_0x281b55['alternatives'][0x0][_0xa5c6('0x48')]:'';})[_0xa5c6('0x49')]('\x0a');_0x40d816=_0x5478f4[_0xa5c6('0x46')]['map'](function(_0x332b56){return _0x332b56&&_0x332b56[_0xa5c6('0x47')][0x0]&&_0x332b56[_0xa5c6('0x47')][0x0][_0xa5c6('0x4a')]?_0x332b56['alternatives'][0x0][_0xa5c6('0x4a')]:0x0;})['join']('\x0a');}logger[_0xa5c6('0x35')]('googleASR\x20transcription',_0x33a639);logger[_0xa5c6('0x35')](_0xa5c6('0x4b'),_0x40d816);return{'transcript':_0x33a639,'confidence':_0x40d816};})['catch'](function(_0x4b14d2){logger['error'](_0xa5c6('0x4c'),_0x4b14d2[_0xa5c6('0x12')],_0x4b14d2[_0xa5c6('0x4d')],_0x4b14d2[_0xa5c6('0x4e')]);});};exports[_0xa5c6('0x4f')]=function(_0x3076f4,_0x361d0a,_0xa892ed,_0xc82bb9){var _0x25083c=apiai(_0x361d0a,{'language':_0xc82bb9||'en'});return _0x25083c[_0xa5c6('0x50')](_0xa892ed,{'sessionId':md5(_0x3076f4)})['then'](function(_0xcf9932){logger[_0xa5c6('0x35')](JSON[_0xa5c6('0x3a')](_0xcf9932));return{'source':_0xcf9932[_0xa5c6('0x51')]['source'],'resolvedQuery':_0xcf9932[_0xa5c6('0x51')]['resolvedQuery'],'action':_0xcf9932[_0xa5c6('0x51')][_0xa5c6('0x52')],'actionIncomplete':_0xcf9932[_0xa5c6('0x51')]['actionIncomplete'],'speech':_0xcf9932['result'][_0xa5c6('0x53')][_0xa5c6('0x54')],'score':_0xcf9932[_0xa5c6('0x51')][_0xa5c6('0x55')],'statusCode':_0xcf9932[_0xa5c6('0x56')][_0xa5c6('0x57')],'endConversation':_0xcf9932[_0xa5c6('0x51')][_0xa5c6('0x58')][_0xa5c6('0x59')]||![],'isFallbackIntent':_0xcf9932[_0xa5c6('0x51')][_0xa5c6('0x58')][_0xa5c6('0x5a')]};});};exports[_0xa5c6('0x5b')]=function(_0x2f6210,_0x34e260,_0x7cb48b,_0x5db6f2,_0x395381,_0x34f3dd){var _0x183d39=_0x5db6f2[_0xa5c6('0x5c')](/\\n/g,'\x0a');var _0x43c156={'credentials':{'private_key':_0x183d39,'client_email':_0x7cb48b}};var _0x5ea6d5=new dialogflow[(_0xa5c6('0x5d'))](_0x43c156);var _0x343ec1=_0x5ea6d5['sessionPath'](_0x34e260,md5(_0x2f6210));var _0x488b0f={'session':_0x343ec1,'queryInput':{'text':{'text':_0x395381,'languageCode':_0x34f3dd}}};return _0x5ea6d5['detectIntent'](_0x488b0f)[_0xa5c6('0x25')](function(_0x3e17e3){if(_0x3e17e3&&_0x3e17e3['length']){logger[_0xa5c6('0x35')](_0xa5c6('0x5e'),JSON['stringify'](_0x3e17e3));var _0x455295=_0x3e17e3[0x0];if(_0x455295){var _0x476956={'action':_0x455295['queryResult'][_0xa5c6('0x52')],'allRequiredParamsPresent':_0x455295['queryResult'][_0xa5c6('0x5f')],'endConversation':_0x455295[_0xa5c6('0x60')][_0xa5c6('0x61')]&&_0x455295[_0xa5c6('0x60')]['diagnosticInfo']['fields']?_0x455295[_0xa5c6('0x60')][_0xa5c6('0x61')][_0xa5c6('0x62')][_0xa5c6('0x63')]['boolValue']:![],'fulfillmentText':_0x455295[_0xa5c6('0x60')][_0xa5c6('0x64')],'intentName':_0x455295[_0xa5c6('0x60')][_0xa5c6('0x65')][_0xa5c6('0x4d')],'intentDisplayName':_0x455295[_0xa5c6('0x60')]['intent'][_0xa5c6('0x66')],'isFallbackIntent':_0x455295[_0xa5c6('0x60')]['intent'][_0xa5c6('0x67')],'languageCode':_0x455295[_0xa5c6('0x60')]['languageCode'],'queryText':_0x455295[_0xa5c6('0x60')]['queryText'],'responseId':_0x455295[_0xa5c6('0x68')],'score':_0x455295[_0xa5c6('0x60')][_0xa5c6('0x69')],'speech':_0x455295['queryResult'][_0xa5c6('0x64')],'providerResponse':JSON[_0xa5c6('0x3a')](_0x3e17e3)};return _0x476956;}}});};exports[_0xa5c6('0x6a')]=function(_0x21ee1c,_0x26315f,_0x21ca88,_0x473f65){return tilde[_0xa5c6('0x44')](_0x21ee1c,_0x26315f,_0x21ca88,_0x473f65)[_0xa5c6('0x25')](function(_0x36c2b6){try{fs[_0xa5c6('0x18')](_0x21ee1c);}catch(_0xac8b92){logger[_0xa5c6('0x13')](_0xac8b92);}logger[_0xa5c6('0x35')](_0xa5c6('0x6b'),_0x36c2b6[_0xa5c6('0x48')]);logger[_0xa5c6('0x35')](_0xa5c6('0x6c'),_0x36c2b6['confidence']);return _0x36c2b6;});};exports[_0xa5c6('0x6d')]=function(_0x36fce3,_0xb6ed98,_0x54d1ea,_0x23566e,_0x398fdc,_0x9fafa2){var _0xeb19f=path[_0xa5c6('0x31')](__dirname,'tmp',rs[_0xa5c6('0x22')](0x4)+_0xa5c6('0x32'));var _0x2b81b6;return aws['polly'](_0x36fce3,_0xb6ed98,_0x54d1ea,_0x23566e,_0x398fdc,_0x9fafa2,_0xeb19f)[_0xa5c6('0x25')](function(){_0x2b81b6=path[_0xa5c6('0x31')](__dirname,'tmp',rs[_0xa5c6('0x22')](0x4)+_0xa5c6('0x23'));return convertFile(_0xeb19f,_0x2b81b6);})[_0xa5c6('0x25')](function(){try{fs['unlink'](_0xeb19f);fs['chmodSync'](_0x2b81b6,_0xa5c6('0x34'));}catch(_0x1bf74c){logger[_0xa5c6('0x13')](_0x1bf74c);}return _0x2b81b6['split']('.')[0x0];});};exports[_0xa5c6('0x6e')]=function(_0x218a84,_0x2f0d92,_0xb9d3a4,_0x5988eb,_0x4eccc4,_0x1911cd){return aws[_0xa5c6('0x6f')](_0x218a84,_0x2f0d92,_0xb9d3a4,_0x5988eb,_0x4eccc4,_0x1911cd)[_0xa5c6('0x25')](function(_0xbd55eb){logger[_0xa5c6('0x35')](JSON[_0xa5c6('0x3a')](_0xbd55eb));return _0xbd55eb;});};exports['ispeechTTS']=function(_0x1ad6e8,_0x4b1988,_0x52d8bc,_0x28e5ff){var _0x1654ad=util[_0xa5c6('0x70')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x1ad6e8,encodeURIComponent(_0x4b1988),_0x52d8bc,_0x28e5ff);var _0x3df0be=path[_0xa5c6('0x31')](__dirname,_0xa5c6('0x21'),rs[_0xa5c6('0x22')](0x4)+_0xa5c6('0x32'));var _0x4183ef;return downloadFile(_0x1654ad,_0x3df0be)[_0xa5c6('0x25')](function(){_0x4183ef=path['resolve'](__dirname,_0xa5c6('0x21'),rs[_0xa5c6('0x22')](0x4)+_0xa5c6('0x23'));return convertFile(_0x3df0be,_0x4183ef);})['then'](function(){try{fs[_0xa5c6('0x18')](_0x3df0be);fs[_0xa5c6('0x26')](_0x4183ef,_0xa5c6('0x34'));}catch(_0xe786ec){logger['error'](_0xe786ec);}return _0x4183ef[_0xa5c6('0x27')]('.')[0x0];});};exports['ispeechASR']=function(_0x31dd7e,_0x21df20,_0x5320f0,_0x575a64){var _0x3bf93d=util['format'](_0xa5c6('0x71'),ISPEECH_API,_0x21df20,_0x5320f0,base64Encode(_0x31dd7e),_0x575a64?util[_0xa5c6('0x70')](_0xa5c6('0x72'),encodeURIComponent(_0x575a64)):_0xa5c6('0x73'));return uploadFile(_0x3bf93d)['then'](function(_0x430249){return querystring[_0xa5c6('0x74')](_0x430249);});};exports[_0xa5c6('0x75')]=function(_0x3c7ff5,_0x4c32b5){return sestek[_0xa5c6('0x76')](_0x3c7ff5,_0x4c32b5)[_0xa5c6('0x25')](function(_0x4446dc){logger[_0xa5c6('0x35')](JSON['stringify'](_0x4446dc));var _0x12d4ec={'speech':_0x4446dc[_0xa5c6('0x77')],'action':_0x4446dc[_0xa5c6('0x78')]?_0x4446dc[_0xa5c6('0x78')][_0xa5c6('0x79')]:undefined,'actiondata':_0x4446dc[_0xa5c6('0x78')]?_0x4446dc[_0xa5c6('0x78')]['CustomActionData']:undefined};if(_0x4446dc[_0xa5c6('0x78')]&&_0x4446dc[_0xa5c6('0x78')][_0xa5c6('0x7a')]){return base64Decode(_0x4446dc[_0xa5c6('0x78')]['AudioFromTts'][_0xa5c6('0x7b')],path[_0xa5c6('0x31')](__dirname,_0xa5c6('0x21'),rs[_0xa5c6('0x22')](0x4)+_0xa5c6('0x23')))[_0xa5c6('0x25')](function(_0x4fac51){_0x12d4ec['audiofile']=_0x4fac51;return _0x12d4ec;});}return _0x12d4ec;});};exports[_0xa5c6('0x7c')]=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 3a8d1ed..f350dfa 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 _0x69f6=['./nda'];(function(_0x153e72,_0x1cde75){var _0x2d060f=function(_0xdfa3b0){while(--_0xdfa3b0){_0x153e72['push'](_0x153e72['shift']());}};_0x2d060f(++_0x1cde75);}(_0x69f6,0x16c));var _0x669f=function(_0x57e092,_0x230223){_0x57e092=_0x57e092-0x0;var _0x4dd71e=_0x69f6[_0x57e092];return _0x4dd71e;};var nda=require(_0x669f('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0x49d6=['exports'];(function(_0xbf0b04,_0x2dedc1){var _0x25c3a1=function(_0x131a6e){while(--_0x131a6e){_0xbf0b04['push'](_0xbf0b04['shift']());}};_0x25c3a1(++_0x2dedc1);}(_0x49d6,0x178));var _0x649d=function(_0x2b7f81,_0x596907){_0x2b7f81=_0x2b7f81-0x0;var _0x3c1ad9=_0x49d6[_0x2b7f81];return _0x3c1ad9;};var nda=require('./nda');module[_0x649d('0x0')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 5f36592..785fdc0 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 _0xa739=['message','uniqueid','callerid','dnid','extension','text','access_token','project','body','ProjectName','channelData','audio/wav','CustomAction','custom_action_data','CustomActionData','info','stringify','url','agi','exports','POST','ndauth_url','/token','password','username','then','resolve','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type'];(function(_0x23ec5b,_0x51912f){var _0x5d971e=function(_0x56dab6){while(--_0x56dab6){_0x23ec5b['push'](_0x23ec5b['shift']());}};_0x5d971e(++_0x51912f);}(_0xa739,0x1e1));var _0x9a73=function(_0x375323,_0x5e9589){_0x375323=_0x375323-0x0;var _0x51505e=_0xa739[_0x375323];return _0x51505e;};'use strict';var rp=require('request-promise');var url=require(_0x9a73('0x0'));var logger=require('../../../../../config/logger')(_0x9a73('0x1'));module[_0x9a73('0x2')]=function(_0x524293,_0x149e72){var _0x352cec={'method':_0x9a73('0x3'),'uri':url['resolve'](_0x149e72[_0x9a73('0x4')],_0x9a73('0x5')),'form':{'grant_type':_0x9a73('0x6'),'username':_0x149e72[_0x9a73('0x7')],'password':_0x149e72[_0x9a73('0x6')]},'json':!![]};return rp(_0x352cec)[_0x9a73('0x8')](function(_0x3a6506){var _0x125177={'method':'POST','uri':url[_0x9a73('0x9')](_0x149e72['ndassistant_url'],_0x9a73('0xa')),'body':{'type':_0x149e72[_0x9a73('0xb')]||_0x9a73('0xc'),'channelId':'Nda','conversation':{'id':_0x524293[_0x9a73('0xd')]},'from':{'id':_0x524293[_0x9a73('0xe')],'name':_0x524293['calleridname']},'recipient':{'id':_0x524293[_0x9a73('0xf')],'name':_0x524293[_0x9a73('0x10')]},'text':_0x149e72[_0x9a73('0x11')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x3a6506[_0x9a73('0x12')]},'json':!![]};if(_0x149e72[_0x9a73('0x13')]){_0x125177[_0x9a73('0x14')]['channelData'][_0x9a73('0x15')]=_0x149e72[_0x9a73('0x13')];}if(_0x149e72['ndagenerate_audio']=='1'){_0x125177[_0x9a73('0x14')][_0x9a73('0x16')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x9a73('0x17')};}if(_0x149e72['custom_action']){_0x125177[_0x9a73('0x14')]['channelData'][_0x9a73('0x18')]=_0x149e72['custom_action'];if(_0x149e72[_0x9a73('0x19')]){_0x125177[_0x9a73('0x14')][_0x9a73('0x16')][_0x9a73('0x1a')]=_0x149e72[_0x9a73('0x19')];}}logger[_0x9a73('0x1b')](JSON[_0x9a73('0x1c')](_0x125177));return rp(_0x125177);});}; \ No newline at end of file +var _0x3667=['Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','CustomAction','custom_action','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','resolve','ndauth_url','/token','password','username','then','POST','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var rp=require(_0x7366('0x0'));var url=require(_0x7366('0x1'));var logger=require(_0x7366('0x2'))(_0x7366('0x3'));module[_0x7366('0x4')]=function(_0x5d1072,_0x27a90d){var _0x1cfcc9={'method':'POST','uri':url[_0x7366('0x5')](_0x27a90d[_0x7366('0x6')],_0x7366('0x7')),'form':{'grant_type':_0x7366('0x8'),'username':_0x27a90d[_0x7366('0x9')],'password':_0x27a90d['password']},'json':!![]};return rp(_0x1cfcc9)[_0x7366('0xa')](function(_0xa1a3c5){var _0x2dd32b={'method':_0x7366('0xb'),'uri':url[_0x7366('0x5')](_0x27a90d[_0x7366('0xc')],_0x7366('0xd')),'body':{'type':_0x27a90d[_0x7366('0xe')]||_0x7366('0xf'),'channelId':_0x7366('0x10'),'conversation':{'id':_0x5d1072[_0x7366('0x11')]},'from':{'id':_0x5d1072[_0x7366('0x12')],'name':_0x5d1072[_0x7366('0x13')]},'recipient':{'id':_0x5d1072[_0x7366('0x14')],'name':_0x5d1072[_0x7366('0x15')]},'text':_0x27a90d[_0x7366('0x16')],'channelData':{}},'headers':{'Authorization':_0x7366('0x17')+_0xa1a3c5[_0x7366('0x18')]},'json':!![]};if(_0x27a90d[_0x7366('0x19')]){_0x2dd32b[_0x7366('0x1a')][_0x7366('0x1b')][_0x7366('0x1c')]=_0x27a90d[_0x7366('0x19')];}if(_0x27a90d[_0x7366('0x1d')]=='1'){_0x2dd32b[_0x7366('0x1a')][_0x7366('0x1b')][_0x7366('0x1e')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x7366('0x1f')};}if(_0x27a90d['custom_action']){_0x2dd32b[_0x7366('0x1a')][_0x7366('0x1b')][_0x7366('0x20')]=_0x27a90d[_0x7366('0x21')];if(_0x27a90d[_0x7366('0x22')]){_0x2dd32b[_0x7366('0x1a')][_0x7366('0x1b')][_0x7366('0x23')]=_0x27a90d[_0x7366('0x22')];}}logger[_0x7366('0x24')](JSON[_0x7366('0x25')](_0x2dd32b));return rp(_0x2dd32b);});}; \ 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 3c8d19f..38b39b7 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 _0x2b27=['./lib/api'];(function(_0xee812b,_0x25df13){var _0x57b3e1=function(_0x4bff46){while(--_0x4bff46){_0xee812b['push'](_0xee812b['shift']());}};_0x57b3e1(++_0x25df13);}(_0x2b27,0x1e0));var _0x72b2=function(_0x146a97,_0x2d8483){_0x146a97=_0x146a97-0x0;var _0x259d5c=_0x2b27[_0x146a97];return _0x259d5c;};'use strict';var asr=require(_0x72b2('0x0'));module['exports']=function(_0x353162,_0x1e54d0,_0x3ce850,_0x221367){return asr(_0x353162,_0x1e54d0,_0x3ce850,_0x221367);}; \ No newline at end of file +var _0xeeb2=['exports','./lib/api'];(function(_0x45e769,_0x4a93bd){var _0x1fcf2e=function(_0x2071cb){while(--_0x2071cb){_0x45e769['push'](_0x45e769['shift']());}};_0x1fcf2e(++_0x4a93bd);}(_0xeeb2,0x117));var _0x2eeb=function(_0x37ae26,_0x2ecd70){_0x37ae26=_0x37ae26-0x0;var _0x1b1902=_0xeeb2[_0x37ae26];return _0x1b1902;};'use strict';var asr=require(_0x2eeb('0x0'));module[_0x2eeb('0x1')]=function(_0x285c2e,_0x5037cf,_0x3f45dd,_0x43134c){return asr(_0x285c2e,_0x5037cf,_0x3f45dd,_0x43134c);}; \ 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 88e9549..9709b2c 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 _0xbd9f=['sha1','update','hex','Open\x20Tilde\x20ASR\x20socket','send','createReadStream','data','close','error','Tilde\x20ASR\x20send\x20error','stringify','terminate','parse','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbd9f,0x1a3));var _0xfbd9=function(_0x31c910,_0x18554){_0x31c910=_0x31c910-0x0;var _0x7d9a41=_0xbd9f[_0x31c910];return _0x7d9a41;};'use strict';var BPromise=require(_0xfbd9('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xfbd9('0x1'));var crypto=require(_0xfbd9('0x2'));var logger=require(_0xfbd9('0x3'))(_0xfbd9('0x4'));module[_0xfbd9('0x5')]=function(_0x2c3387,_0x175dc9,_0x3976a8,_0x529301){return new BPromise(function(_0x95755d,_0x119c85){logger[_0xfbd9('0x6')](_0xfbd9('0x7'),_0x529301||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x17d433=new WebSocket(_0x529301||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x16d3f4='';var _0x1e5926='0';var _0x3ad9ad='1';var _0x346b2c=_0xfbd9('0x8');function _0x536b51(_0x239b12){var _0x1afb03=crypto[_0xfbd9('0x9')](_0xfbd9('0xa'));_0x1afb03[_0xfbd9('0xb')](_0x239b12);return _0x1afb03['digest'](_0xfbd9('0xc'));}function _0x36a207(){try{logger[_0xfbd9('0x6')](_0xfbd9('0xd'));var _0x515557=moment()['unix']();var _0x2deec7=_0x536b51(_0x515557+_0x175dc9+_0x3976a8);_0x17d433[_0xfbd9('0xe')](JSON['stringify']({'appID':_0x175dc9,'timestamp':_0x515557,'appKey':_0x2deec7}));var _0x1a6eb4=fs[_0xfbd9('0xf')](_0x2c3387);_0x1a6eb4['on'](_0xfbd9('0x10'),function(_0x1933aa){_0x17d433['send'](_0x1933aa);});_0x1a6eb4['on'](_0xfbd9('0x11'),function(){_0x17d433[_0xfbd9('0xe')]('EOS');});}catch(_0x59eb67){logger[_0xfbd9('0x12')](_0xfbd9('0x13'),JSON[_0xfbd9('0x14')](_0x59eb67));_0x17d433[_0xfbd9('0x15')]();}}function _0x3d36e7(_0x3a38ae){try{if(_0x3a38ae){var _0xcf06a2=JSON[_0xfbd9('0x16')](_0x3a38ae);switch(_0xcf06a2['status']){case 0x0:if(_0xcf06a2['result']){if(_0xcf06a2[_0xfbd9('0x17')][_0xfbd9('0x18')]){logger['info'](_0xfbd9('0x19'),JSON[_0xfbd9('0x14')](_0xcf06a2[_0xfbd9('0x17')][_0xfbd9('0x1a')]));_0x16d3f4=_0xcf06a2[_0xfbd9('0x17')]['hypotheses'][0x0]['transcript'];_0x1e5926=_0xcf06a2[_0xfbd9('0x17')]['hypotheses'][0x0][_0xfbd9('0x1b')];_0x3ad9ad='0';_0x346b2c=_0xfbd9('0x1c');_0x17d433[_0xfbd9('0x15')]();}}break;case 0x1:logger[_0xfbd9('0x6')](_0xfbd9('0x8'));_0x3ad9ad='1';_0x346b2c='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0xfbd9('0x6')](_0xfbd9('0x1d'));_0x3ad9ad='2';_0x346b2c=_0xfbd9('0x1d');break;case 0x9:logger[_0xfbd9('0x6')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x3ad9ad='9';_0x346b2c=_0xfbd9('0x1e');break;case 0xa:logger['info'](_0xfbd9('0x1f'));_0x3ad9ad='10';_0x346b2c=_0xfbd9('0x1f');break;case 0xb:logger[_0xfbd9('0x6')](_0xfbd9('0x20'));_0x3ad9ad='11';_0x346b2c=_0xfbd9('0x20');}}}catch(_0x317361){logger[_0xfbd9('0x12')](_0xfbd9('0x21'),JSON['stringify'](_0x317361));_0x17d433[_0xfbd9('0x15')]();}}function _0xd3537a(){logger[_0xfbd9('0x6')](_0xfbd9('0x22'));_0x95755d({'transcript':_0x16d3f4,'confidence':_0x1e5926,'status':_0x3ad9ad,'status_message':_0x346b2c});}function _0x59abf1(_0x3a6c39){logger[_0xfbd9('0x12')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0xfbd9('0x23')](_0x3a6c39)){logger[_0xfbd9('0x12')](_[_0xfbd9('0x24')](_0x3a6c39)?JSON[_0xfbd9('0x14')](_0x3a6c39):_0x3a6c39);}}_0x17d433['on'](_0xfbd9('0x25'),_0x36a207);_0x17d433['on'](_0xfbd9('0x26'),_0x3d36e7);_0x17d433['on'](_0xfbd9('0x11'),_0xd3537a);_0x17d433['on'](_0xfbd9('0x12'),_0x59abf1);});}; \ No newline at end of file +var _0x593f=['Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','close','lodash','crypto','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','data','EOS','stringify','terminate','parse','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Close\x20Tilde\x20ASR\x20socket'];(function(_0xdb12f4,_0x321b9e){var _0xaaff62=function(_0x13d445){while(--_0x13d445){_0xdb12f4['push'](_0xdb12f4['shift']());}};_0xaaff62(++_0x321b9e);}(_0x593f,0x153));var _0xf593=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x593f[_0x18ab2a];return _0x16dcee;};'use strict';var BPromise=require('bluebird');var _=require(_0xf593('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0xf593('0x1'));var logger=require('../../../../../../config/logger')(_0xf593('0x2'));module[_0xf593('0x3')]=function(_0x5a6299,_0xfde75e,_0x384a11,_0x5f42ae){return new BPromise(function(_0x101c31,_0x166507){logger[_0xf593('0x4')](_0xf593('0x5'),_0x5f42ae||_0xf593('0x6'));var _0x2224e4=new WebSocket(_0x5f42ae||_0xf593('0x6'),{'perMessageDeflate':![]});var _0x4de711='';var _0x4b5a89='0';var _0xd12197='1';var _0x5cf8ad=_0xf593('0x7');function _0x1a6175(_0x294e6d){var _0x1c7cf5=crypto[_0xf593('0x8')](_0xf593('0x9'));_0x1c7cf5[_0xf593('0xa')](_0x294e6d);return _0x1c7cf5['digest'](_0xf593('0xb'));}function _0x38c51c(){try{logger[_0xf593('0x4')](_0xf593('0xc'));var _0x4dc0fe=moment()[_0xf593('0xd')]();var _0x3e7261=_0x1a6175(_0x4dc0fe+_0xfde75e+_0x384a11);_0x2224e4[_0xf593('0xe')](JSON['stringify']({'appID':_0xfde75e,'timestamp':_0x4dc0fe,'appKey':_0x3e7261}));var _0x312d34=fs['createReadStream'](_0x5a6299);_0x312d34['on'](_0xf593('0xf'),function(_0x24b1a4){_0x2224e4[_0xf593('0xe')](_0x24b1a4);});_0x312d34['on']('close',function(){_0x2224e4[_0xf593('0xe')](_0xf593('0x10'));});}catch(_0x41f062){logger['error']('Tilde\x20ASR\x20send\x20error',JSON[_0xf593('0x11')](_0x41f062));_0x2224e4[_0xf593('0x12')]();}}function _0x35d18f(_0x385875){try{if(_0x385875){var _0x3656d6=JSON[_0xf593('0x13')](_0x385875);switch(_0x3656d6[_0xf593('0x14')]){case 0x0:if(_0x3656d6[_0xf593('0x15')]){if(_0x3656d6[_0xf593('0x15')]['final']){logger[_0xf593('0x4')](_0xf593('0x16'),JSON[_0xf593('0x11')](_0x3656d6[_0xf593('0x15')]['hypotheses']));_0x4de711=_0x3656d6[_0xf593('0x15')][_0xf593('0x17')][0x0]['transcript'];_0x4b5a89=_0x3656d6['result']['hypotheses'][0x0]['likelihood'];_0xd12197='0';_0x5cf8ad=_0xf593('0x18');_0x2224e4[_0xf593('0x12')]();}}break;case 0x1:logger[_0xf593('0x4')](_0xf593('0x7'));_0xd12197='1';_0x5cf8ad=_0xf593('0x7');break;case 0x2:logger[_0xf593('0x4')](_0xf593('0x19'));_0xd12197='2';_0x5cf8ad=_0xf593('0x19');break;case 0x9:logger['info'](_0xf593('0x1a'));_0xd12197='9';_0x5cf8ad=_0xf593('0x1a');break;case 0xa:logger[_0xf593('0x4')](_0xf593('0x1b'));_0xd12197='10';_0x5cf8ad=_0xf593('0x1b');break;case 0xb:logger[_0xf593('0x4')](_0xf593('0x1c'));_0xd12197='11';_0x5cf8ad=_0xf593('0x1c');}}}catch(_0x46c4fc){logger[_0xf593('0x1d')]('Tilde\x20ASR\x20parse\x20error',JSON[_0xf593('0x11')](_0x46c4fc));_0x2224e4[_0xf593('0x12')]();}}function _0x52dbe2(){logger['info'](_0xf593('0x1e'));_0x101c31({'transcript':_0x4de711,'confidence':_0x4b5a89,'status':_0xd12197,'status_message':_0x5cf8ad});}function _0x3963ff(_0x545d7d){logger['error'](_0xf593('0x1f'));if(!_[_0xf593('0x20')](_0x545d7d)){logger['error'](_[_0xf593('0x21')](_0x545d7d)?JSON[_0xf593('0x11')](_0x545d7d):_0x545d7d);}}_0x2224e4['on'](_0xf593('0x22'),_0x38c51c);_0x2224e4['on'](_0xf593('0x23'),_0x35d18f);_0x2224e4['on'](_0xf593('0x24'),_0x52dbe2);_0x2224e4['on'](_0xf593('0x1d'),_0x3963ff);});}; \ 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 10cb4be..1b49122 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 asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file +var _0x4c19=['exports'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x4c19,0x19c));var _0x94c1=function(_0x52c3c3,_0x5af662){_0x52c3c3=_0x52c3c3-0x0;var _0x34389a=_0x4c19[_0x52c3c3];return _0x34389a;};var asr=require('./asr');module[_0x94c1('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 8effc03..fc8fd65 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 _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(_0x1dab5f,_0x10cd21){var _0x40c2f3=function(_0x325a0d){while(--_0x325a0d){_0x1dab5f['push'](_0x1dab5f['shift']());}};_0x40c2f3(++_0x10cd21);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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 +var _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9c44[_0x16b9ed];return _0x66b1f8;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 0d51961..2b6e785 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 _0x008c=['googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','ssmlGender','audioEncoding','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_secret_access_key','aws_lex_region','googleASR','google_asr_language','tildeASR','appid','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','getVariable','extra','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','mrcpsynth','label','noop','no\x20text\x20configured','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','sestektts','Executed\x20command\x20MRCPSynth\x20%s','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','getSquareOdbc','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','keys','%s[%s][%s]','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','getUser','no\x20user\x20found','DIAL','SIP/%s','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','out','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','streamFile','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','ext_dial','no\x20trunk\x20selected','trunk_id','no\x20trunk\x20found','trunk_name','SIP/%s/%s','opts','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','getData','maxdigit','mindigit','no\x20variable\x20found','hiddendigitsnum','hiddendigitspos','first','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','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','unlink','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','bot','Trying\x20Amazon\x20Lex:\x20%s','message','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','generate','beep','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','appsecret','no\x20appsecret\x20configured','%s/recordings/%s','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','wav','NOBEEP','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','operation','%s[%s]','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','agentPause','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','statusMessage','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','replace','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','getMailAccount','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','subject','template_id','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','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','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','shelljs','odbc','randomstring','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','channel','rpc','getVariableById','then','name','catch','prototype','getVoiceQueueById','getSquareProjectById','getUserById','getTrunk','getSoundById','save_name','sendMailMessage','mailRpc','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','agicommand','arg_1','callerid','createSquareRecording','context','extension','priority','accountcode','file','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','phone','list_id','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','getPause','getPauseById','agent','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','LOCAL','agentLogin','exec'];(function(_0x193e28,_0x3dac1d){var _0x20ef59=function(_0x48047e){while(--_0x48047e){_0x193e28['push'](_0x193e28['shift']());}};_0x20ef59(++_0x3dac1d);}(_0x008c,0x188));var _0xc008=function(_0x26c7d3,_0x31be42){_0x26c7d3=_0x26c7d3-0x0;var _0x430566=_0x008c[_0x26c7d3];return _0x430566;};'use strict';var fs=require('fs');var util=require(_0xc008('0x0'));var _=require(_0xc008('0x1'));var sh=require(_0xc008('0x2'));var odbc=require(_0xc008('0x3'))();var rs=require(_0xc008('0x4'));var moment=require('moment');var Mustache=require(_0xc008('0x5'));var rp=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var scripts=require(_0xc008('0xa'));var FILES_PATH=_0xc008('0xb');var recursiveMapAttributes=[_0xc008('0xc'),_0xc008('0xd')];var verticesWithRetry=['menu',_0xc008('0xe'),'getsecretdigits'];var AGIVertices=function(_0x30be38,_0x5b64f8,_0x52041f){this[_0xc008('0xf')]=_0x30be38;this[_0xc008('0x10')]=_0x5b64f8;this['mailRpc']=_0x52041f;};AGIVertices['prototype']['getVariable']=function(_0x1eacfa,_0xc881aa){this['rpc'][_0xc008('0x11')](_0x1eacfa)[_0xc008('0x12')](function(_0x2ea200){_0xc881aa(null,_0x2ea200?_0x2ea200[_0xc008('0x13')]:![]);})[_0xc008('0x14')](function(_0x1819c6){_0xc881aa(_0x1819c6);});};AGIVertices[_0xc008('0x15')]['getVoiceQueue']=function(_0x560e28,_0x33f44c){this['rpc'][_0xc008('0x16')](_0x560e28)[_0xc008('0x12')](function(_0x2073ef){_0x33f44c(null,_0x2073ef?_0x2073ef[_0xc008('0x13')]:![]);})[_0xc008('0x14')](function(_0x5ee00b){_0x33f44c(_0x5ee00b);});};AGIVertices['prototype']['getSquareProject']=function(_0x11ef38,_0x15a6ad){this[_0xc008('0x10')][_0xc008('0x17')](_0x11ef38)['then'](function(_0x53b06e){_0x15a6ad(null,_0x53b06e?_0x53b06e['name']:![]);})['catch'](function(_0x46042b){_0x15a6ad(_0x46042b);});};AGIVertices[_0xc008('0x15')]['getSquareOdbc']=function(_0x813397,_0x5906e6){this['rpc']['getSquareOdbcById'](_0x813397)['then'](function(_0x5754a0){_0x5906e6(null,_0x5754a0?_0x5754a0['dsn']:![]);})['catch'](function(_0x590a71){_0x5906e6(_0x590a71);});};AGIVertices['prototype']['getUser']=function(_0x13a263,_0x4777a6){this[_0xc008('0x10')][_0xc008('0x18')](_0x13a263)[_0xc008('0x12')](function(_0x110128){_0x4777a6(null,_0x110128?_0x110128['name']:![]);})[_0xc008('0x14')](function(_0x5c85f2){_0x4777a6(_0x5c85f2);});};AGIVertices['prototype'][_0xc008('0x19')]=function(_0x36f358,_0x2e3cfb){this[_0xc008('0x10')]['getTrunkById'](_0x36f358)['then'](function(_0x5de1e9){_0x2e3cfb(null,_0x5de1e9?_0x5de1e9[_0xc008('0x13')]:![]);})[_0xc008('0x14')](function(_0x92c582){_0x2e3cfb(_0x92c582);});};AGIVertices[_0xc008('0x15')]['getSound']=function(_0x5e2aca,_0x4fce9c){var _0x4adbab=this;this['rpc'][_0xc008('0x1a')](_0x5e2aca)[_0xc008('0x12')](function(_0x25eae4){_0x4fce9c(null,_0x25eae4?_0x4adbab['getSoundPath'](_0x25eae4[_0xc008('0x1b')]):![]);})[_0xc008('0x14')](function(_0x209591){_0x4fce9c(_0x209591);});};AGIVertices[_0xc008('0x15')]['getMailAccount']=function(_0xcdb32b,_0x2e0b4e){this['rpc']['getMailAccountById'](_0xcdb32b)['then'](function(_0x1032b2){_0x2e0b4e(null,_0x1032b2?_0x1032b2:![]);})[_0xc008('0x14')](function(_0xf831f2){_0x2e0b4e(_0xf831f2);});};AGIVertices[_0xc008('0x15')][_0xc008('0x1c')]=function(_0xceebc3,_0x294f97,_0x22d8e8){this[_0xc008('0x1d')][_0xc008('0x1c')](_0xceebc3,_0x294f97)[_0xc008('0x12')](function(){_0x22d8e8(null);})[_0xc008('0x14')](function(_0x596ee8){_0x22d8e8(_0x596ee8);});};AGIVertices[_0xc008('0x15')][_0xc008('0x1e')]=function(_0x499754,_0xaf4b84){this[_0xc008('0x10')][_0xc008('0x1f')](_0x499754)[_0xc008('0x12')](function(_0xd0e05a){if(_0xd0e05a){if(_0xd0e05a[_0xc008('0x20')]){_0xaf4b84(null,[_0xd0e05a[_0xc008('0x21')]]);}else{_0xaf4b84(null,_[_0xc008('0x22')](_0xd0e05a[_0xc008('0x23')],'interval'));}}else{_0xaf4b84(null,![]);}})[_0xc008('0x14')](function(_0x389a40){_0xaf4b84(_0x389a40);});};AGIVertices[_0xc008('0x15')][_0xc008('0x24')]=function(_0x40002f){return util[_0xc008('0x25')](_0xc008('0x26'),FILES_PATH,_0x40002f);};AGIVertices['prototype'][_0xc008('0x27')]=function(_0x21763f,_0x50e1d4,_0x399b64){odbc[_0xc008('0x28')](_0x21763f,function(_0x5e38d5){if(_0x5e38d5){logger[_0xc008('0x29')](_0xc008('0x2a'),_0x5e38d5);_0x399b64(_0x5e38d5);}else{logger[_0xc008('0x2b')]('ODBC\x20connection\x20successfully');odbc['query'](_0x50e1d4,function(_0x478810,_0x234f2a){if(_0x478810){logger['info'](_0xc008('0x2c'),_0x50e1d4);_0x399b64(_0x478810);}else{logger[_0xc008('0x2b')](_0xc008('0x2d'),_0x50e1d4);odbc[_0xc008('0x2e')](function(_0x3148e1){if(_0x3148e1){logger[_0xc008('0x29')](_0xc008('0x2f'),_0x3148e1);}_0x399b64(null,_0x234f2a);});}});}});};AGIVertices[_0xc008('0x15')][_0xc008('0x30')]=function(_0x387dfd,_0x3ebb83){this[_0xc008('0x10')][_0xc008('0x31')](_0x387dfd)[_0xc008('0x12')](function(_0x4cace5){_0x3ebb83(null,_0x4cace5?_0x4cace5:![]);})[_0xc008('0x14')](function(_0x23c4db){_0x3ebb83(_0x23c4db);});};AGIVertices[_0xc008('0x15')][_0xc008('0x32')]=function(_0x49a16d,_0x2c4964){this[_0xc008('0x10')][_0xc008('0x32')](_0x49a16d)[_0xc008('0x12')](function(_0x2d142d){_0x2c4964(null,_0x2d142d);})['catch'](function(_0x398cdd){_0x2c4964(_0x398cdd);});};AGIVertices[_0xc008('0x15')][_0xc008('0x33')]=function(_0x3e9a99,_0x7279e8,_0x4f93a4){this[_0xc008('0x10')][_0xc008('0x33')]({'uniqueid':this[_0xc008('0xf')][_0xc008('0x34')],'node':_0x3e9a99['label'],'application':_0x3e9a99[_0xc008('0x35')],'data':_0x7279e8||null,'project_name':this[_0xc008('0xf')][_0xc008('0x36')],'callerid':this['channel'][_0xc008('0x37')]})['then'](function(_0x3dd097){if(_0x4f93a4){_0x4f93a4(null,_0x3dd097);}})['catch'](function(_0x46fa8f){if(_0x4f93a4){_0x4f93a4(_0x46fa8f);}});};AGIVertices[_0xc008('0x15')]['createSquareRecording']=function(_0x31007c,_0x24ba0f,_0x6d6d4c,_0x5caaa2){this[_0xc008('0x10')][_0xc008('0x38')]({'uniqueid':this[_0xc008('0xf')][_0xc008('0x34')],'callerid':this[_0xc008('0xf')][_0xc008('0x37')],'calleridname':this['channel']['calleridname'],'context':this['channel'][_0xc008('0x39')],'extension':this[_0xc008('0xf')][_0xc008('0x3a')],'priority':this[_0xc008('0xf')][_0xc008('0x3b')],'accountcode':this[_0xc008('0xf')][_0xc008('0x3c')],'dnid':this[_0xc008('0xf')]['dnid'],'projectName':this['channel']['arg_1'],'saveName':_0x24ba0f,'filename':_0x31007c[_0xc008('0x3d')]||_0x24ba0f,'savePath':_0x6d6d4c})[_0xc008('0x12')](function(_0x158eae){_0x5caaa2(null,_0x158eae);})['catch'](function(_0x28bc33){_0x5caaa2(_0x28bc33);});};AGIVertices[_0xc008('0x15')][_0xc008('0x3e')]=function(_0x1c2c50,_0x4981b4,_0x56e4ac,_0x17ec90,_0x405e87){this[_0xc008('0x10')][_0xc008('0x3e')]({'uniqueid':this['channel']['uniqueid'],'body':_0x1c2c50,'direction':_0x4981b4,'providerName':_0x56e4ac,'providerResponse':_0x17ec90})[_0xc008('0x12')](function(_0x51cb14){if(_0x405e87){_0x405e87(null,_0x51cb14);}})[_0xc008('0x14')](function(_0x36e6f8){if(_0x405e87){_0x405e87(_0x36e6f8);}});};AGIVertices[_0xc008('0x15')]['createCmContact']=function(_0x144ab2,_0x32b435){this[_0xc008('0x10')][_0xc008('0x3f')]({'firstName':_[_0xc008('0x40')](_0x144ab2['name'])||_[_0xc008('0x41')](_0x144ab2[_0xc008('0x13')])?'callback_'+Math[_0xc008('0x42')]():_0x144ab2[_0xc008('0x13')],'lastName':_['isEmpty'](_0x144ab2['lastName'])||_[_0xc008('0x41')](_0x144ab2[_0xc008('0x43')])?null:_0x144ab2[_0xc008('0x43')],'phone':_0x144ab2[_0xc008('0x44')],'ListId':_0x144ab2[_0xc008('0x45')],'scheduledat':_0x144ab2['scheduledAt'],'callbackUniqueid':this['channel'][_0xc008('0x34')],'tags':'callback','description':_0xc008('0x46')+_0x144ab2[_0xc008('0x47')][_0xc008('0x48')](),'priority':_0x144ab2[_0xc008('0x49')]})[_0xc008('0x12')](function(_0x27a167){_0x32b435(null,_0x27a167);})['catch'](function(_0x2ea742){_0x32b435(_0x2ea742);});};AGIVertices[_0xc008('0x15')][_0xc008('0x4a')]=function(_0x2b350c,_0x4424f5){this['rpc'][_0xc008('0x4b')](_0x2b350c)['then'](function(_0x535e6e){_0x4424f5(null,_0x535e6e?_0x535e6e['name']:![]);})[_0xc008('0x14')](function(_0x1bcbb1){_0x4424f5(_0x1bcbb1);});};AGIVertices[_0xc008('0x15')]['agentPause']=function(_0x3aeeab,_0x2d8361,_0x3dda82){var _0x47a58b={'role':_0xc008('0x4c')};_0x47a58b[_0x3aeeab]=this[_0xc008('0xf')][_0xc008('0x37')];this[_0xc008('0x10')]['agentPause'](_0x47a58b,_0x2d8361,this[_0xc008('0xf')]['uniqueid'])[_0xc008('0x12')](function(_0x422e1f){_0x3dda82(null,_[_0xc008('0x41')](_0x422e1f)?![]:!![]);})[_0xc008('0x14')](function(_0x192c87){logger[_0xc008('0x29')](_0x192c87);_0x3dda82(null,![]);});};AGIVertices['prototype'][_0xc008('0x4d')]=function(_0x570001,_0x5bf4a9){var _0x37ce5e={'role':_0xc008('0x4c')};_0x37ce5e[_0x570001]=this['channel'][_0xc008('0x37')];this[_0xc008('0x10')][_0xc008('0x4d')](_0x37ce5e)[_0xc008('0x12')](function(_0x21ee6d){_0x5bf4a9(null,_[_0xc008('0x41')](_0x21ee6d)?![]:!![]);})[_0xc008('0x14')](function(_0x57ce9a){logger[_0xc008('0x29')](_0x57ce9a);_0x5bf4a9(null,![]);});};AGIVertices[_0xc008('0x15')][_0xc008('0x4e')]=function(_0x2a60e6,_0xb3ca0f){var _0x167425={'role':_0xc008('0x4c')};_0x167425[_0x2a60e6]=this[_0xc008('0xf')][_0xc008('0x37')];this[_0xc008('0x10')][_0xc008('0x4e')](_0x167425)[_0xc008('0x12')](function(_0x131b81){_0xb3ca0f(null,_[_0xc008('0x41')](_0x131b81)?![]:!![]);})['catch'](function(_0x36a08e){logger[_0xc008('0x29')](_0x36a08e);_0xb3ca0f(null,![]);});};AGIVertices[_0xc008('0x15')]['agentLogin']=function(_0xd7d020,_0x3214df){var _0x5e76d8={'role':'agent'};_0x5e76d8[_0xd7d020]=this[_0xc008('0xf')][_0xc008('0x37')];var _0x7bad14=_0xd7d020!=_0xc008('0x4f')?util[_0xc008('0x25')](_0xc008('0x50'),_0xc008('0x51'),this[_0xc008('0xf')][_0xc008('0x37')]):undefined;this[_0xc008('0x10')][_0xc008('0x52')](_0x5e76d8,_0x7bad14)['then'](function(_0x336516){_0x3214df(null,_[_0xc008('0x41')](_0x336516)?![]:!![]);})[_0xc008('0x14')](function(_0x27dc80){logger['error'](_0x27dc80);_0x3214df(null,![]);});};AGIVertices[_0xc008('0x15')]['shellCommand']=function(_0x3a1de5,_0x46fa7b){sh[_0xc008('0x53')](_['trim'](_0x3a1de5),function(_0x1c31f5,_0x2e5e2b){var _0xa80000=_0x2e5e2b['replace'](/(\r\n|\n|\r)/gm,'');_0x46fa7b(null,_0xa80000);});};AGIVertices[_0xc008('0x15')]['googleCloudTTS']=function(_0x50ee03,_0xee7a85){scripts[_0xc008('0x54')](_0x50ee03[_0xc008('0x55')],_0x50ee03[_0xc008('0x56')]||'text',_0x50ee03[_0xc008('0x57')],_0x50ee03[_0xc008('0x58')]||'en-US',_0x50ee03[_0xc008('0x59')]||'MALE',_0x50ee03[_0xc008('0x5a')]||'MP3')[_0xc008('0x12')](function(_0x498cfb){_0xee7a85(null,_0x498cfb);})[_0xc008('0x14')](function(_0x103d75){_0xee7a85(_0x103d75);});};AGIVertices[_0xc008('0x15')][_0xc008('0x5b')]=function(_0x5a94ff,_0x57752c){scripts[_0xc008('0x5b')](_0x5a94ff[_0xc008('0x57')],_0x5a94ff[_0xc008('0x5c')]||'en',0x1)[_0xc008('0x12')](function(_0x13ef78){_0x57752c(null,_0x13ef78);})[_0xc008('0x14')](function(_0x3b46e4){_0x57752c(_0x3b46e4);});};AGIVertices['prototype'][_0xc008('0x5d')]=function(_0x530c2f,_0x511477){var _0x4c84da={'uri':_0x530c2f[_0xc008('0x5e')],'method':_0x530c2f[_0xc008('0x5f')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x530c2f[_0xc008('0x60')])===_0xc008('0x61')&&parseInt(_0x530c2f[_0xc008('0x60')])>=0x1?parseInt(_0x530c2f[_0xc008('0x60')])*0x3e8:0x5*0x3e8};if(_[_0xc008('0x62')]([_0xc008('0x63'),_0xc008('0x64')],_0x4c84da['method'][_0xc008('0x65')]())){try{_0x4c84da[_0xc008('0x66')]=_0x530c2f[_0xc008('0xd')]?JSON[_0xc008('0x67')](_0x530c2f[_0xc008('0xd')]):{};}catch(_0x3b2669){logger[_0xc008('0x29')](_0xc008('0x68'),_0x3b2669);}}try{_0x4c84da[_0xc008('0x69')]=_0x530c2f[_0xc008('0xc')]?JSON[_0xc008('0x67')](_0x530c2f[_0xc008('0xc')]):{};}catch(_0x582814){logger['error'](_0xc008('0x6a'),_0x582814);}if(_0x530c2f[_0xc008('0x6b')]){try{var _0x41e92e=require(_0x530c2f['computedVariables'])[_0xc008('0x6c')](this,_0x4c84da);_0x4c84da[_0xc008('0x6d')]=Mustache['render'](_0x530c2f['url'],_0x41e92e,{},['$$','$$']);if(_0x4c84da['headers']){_0x4c84da[_0xc008('0x69')]=JSON[_0xc008('0x67')](Mustache[_0xc008('0x6e')](JSON[_0xc008('0x6f')](_0x4c84da[_0xc008('0x69')]),_0x41e92e,{},['$$','$$']));}if(_0x4c84da[_0xc008('0x66')]){_0x4c84da[_0xc008('0x66')]=JSON[_0xc008('0x67')](Mustache[_0xc008('0x6e')](JSON[_0xc008('0x6f')](_0x4c84da['body']),_0x41e92e,{},['$$','$$']));}}catch(_0x57b8ad){logger[_0xc008('0x29')](_0xc008('0x70'),_0x57b8ad);}}rp(_0x4c84da)[_0xc008('0x12')](function(_0x3f1e41){var _0x2b94b2={'statusCode':_0x3f1e41[_0xc008('0x71')]||0xc8,'statusMessage':_0x3f1e41['statusMessage']||'OK','headers':_0x3f1e41['headers']||{},'body':_0x3f1e41[_0xc008('0x66')]||{}};_0x511477(null,_0x2b94b2);})[_0xc008('0x14')](function(_0x33e130){var _0x558105={'statusCode':_0x33e130['statusCode']||0x1f4,'statusMessage':_0x33e130['message']||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x33e130['options']['headers']||{},'body':_0x33e130[_0xc008('0x72')]['body']||{}};_0x511477(null,_0x558105);});};AGIVertices[_0xc008('0x15')]['googleDialogflow']=function(_0x2772c9,_0x41151e){scripts[_0xc008('0x73')](this['channel']['uniqueid'],_0x2772c9[_0xc008('0x74')],_0x2772c9['text'],_0x2772c9[_0xc008('0x75')]||'en')[_0xc008('0x12')](function(_0x544519){_0x41151e(null,_0x544519);})[_0xc008('0x14')](function(_0x4db90b){_0x41151e(_0x4db90b);});};AGIVertices['prototype'][_0xc008('0x76')]=function(_0x1d50ac,_0x48de26){scripts[_0xc008('0x76')](this[_0xc008('0xf')][_0xc008('0x34')],_0x1d50ac['dialogflowV2_project_id'],_0x1d50ac[_0xc008('0x77')],_0x1d50ac[_0xc008('0x78')],_0x1d50ac[_0xc008('0x57')],_0x1d50ac[_0xc008('0x79')]||'en')[_0xc008('0x12')](function(_0x1b5b91){_0x48de26(null,_0x1b5b91);})['catch'](function(_0x6dfd99){_0x48de26(_0x6dfd99);});};AGIVertices[_0xc008('0x15')][_0xc008('0x7a')]=function(_0x4946d3,_0x477b14){scripts[_0xc008('0x7a')](this[_0xc008('0xf')],_0x4946d3)['then'](function(_0x48c38b){_0x477b14(null,_0x48c38b);})['catch'](function(_0x46cf1c){_0x477b14(_0x46cf1c);});};AGIVertices[_0xc008('0x15')][_0xc008('0x7b')]=function(_0x3c5da1,_0x1c90d7){scripts[_0xc008('0x7b')](_0x3c5da1[_0xc008('0x74')],_0x3c5da1[_0xc008('0x57')],_0x3c5da1['ispeech_tts_language']||_0xc008('0x7c'),_0x3c5da1[_0xc008('0x7d')])['then'](function(_0x58949b){_0x1c90d7(null,_0x58949b);})[_0xc008('0x14')](function(_0x128123){_0x1c90d7(_0x128123);});};AGIVertices[_0xc008('0x15')][_0xc008('0x7e')]=function(_0x11d33e,_0x49e822,_0xe988da){scripts[_0xc008('0x7e')](_0x49e822,_0x11d33e['key'],_0x11d33e[_0xc008('0x7f')]||_0xc008('0x7c'),this[_0xc008('0x80')](_0x11d33e[_0xc008('0x81')])?_0x11d33e['model']:undefined)[_0xc008('0x12')](function(_0x2d42e0){_0xe988da(null,_0x2d42e0);})[_0xc008('0x14')](function(_0x3004f9){_0xe988da(_0x3004f9);});};AGIVertices['prototype'][_0xc008('0x82')]=function(_0x1d4cdc,_0x57cf19){scripts['awsPolly'](_0x1d4cdc[_0xc008('0x83')],_0x1d4cdc['aws_secret_access_key'],_0x1d4cdc[_0xc008('0x84')],_0x1d4cdc[_0xc008('0x85')]||'Amy',_0x1d4cdc[_0xc008('0x57')],_0x1d4cdc[_0xc008('0x86')]||_0xc008('0x57'))[_0xc008('0x12')](function(_0x3c335f){_0x57cf19(null,_0x3c335f);})[_0xc008('0x14')](function(_0x56fa88){_0x57cf19(_0x56fa88);});};AGIVertices[_0xc008('0x15')][_0xc008('0x87')]=function(_0x2fcad1,_0x59e7eb){scripts['awsLex'](this[_0xc008('0xf')][_0xc008('0x34')],_0x2fcad1['aws_access_key_id'],_0x2fcad1[_0xc008('0x88')],_0x2fcad1[_0xc008('0x89')],_0x2fcad1[_0xc008('0x57')],_0x2fcad1['aws_bot_name'])[_0xc008('0x12')](function(_0x38239a){_0x59e7eb(null,_0x38239a);})[_0xc008('0x14')](function(_0x3eeebd){_0x59e7eb(_0x3eeebd);});};AGIVertices[_0xc008('0x15')][_0xc008('0x8a')]=function(_0x3c9518,_0x5bd010,_0x1530d6){scripts['googleASR'](_0x5bd010,_0x3c9518[_0xc008('0x74')],_0x3c9518[_0xc008('0x8b')]||_0xc008('0x7c'))['then'](function(_0x752b50){_0x1530d6(null,_0x752b50);})[_0xc008('0x14')](function(_0x41143f){_0x1530d6(_0x41143f);});};AGIVertices[_0xc008('0x15')][_0xc008('0x8c')]=function(_0x729d48,_0x872247,_0x287492){scripts[_0xc008('0x8c')](_0x872247,_0x729d48[_0xc008('0x8d')],_0x729d48['appsecret'],_0x729d48[_0xc008('0x6d')])[_0xc008('0x12')](function(_0x15dca4){_0x287492(null,_0x15dca4);})[_0xc008('0x14')](function(_0x43dc6c){_0x287492(_0x43dc6c);});};AGIVertices['prototype'][_0xc008('0x8e')]=function(_0x3dd13f){var _0x36a581=_[_0xc008('0x62')](verticesWithRetry,_0x3dd13f[_0xc008('0x35')])?_0x3dd13f:_[_0xc008('0x8f')](_0x3dd13f);for(var _0x3c3067 in _0x36a581){if(_0x36a581[_0xc008('0x90')](_0x3c3067)){if(_0x36a581[_0x3c3067]&&_[_0xc008('0x91')](_0x36a581[_0x3c3067])){if(_[_0xc008('0x62')](recursiveMapAttributes,_0x3c3067)){_0x36a581[_0x3c3067]=this[_0xc008('0x92')](_0x36a581[_0x3c3067]);}else{_0x36a581[_0x3c3067]=this[_0xc008('0x93')](_0x36a581[_0x3c3067]);}}}}return _0x36a581;};AGIVertices[_0xc008('0x15')][_0xc008('0x94')]=function(_0x16bcc5){for(var _0x5ca2fb in _0x16bcc5){if(_0x16bcc5['hasOwnProperty'](_0x5ca2fb)){if(_[_0xc008('0x95')](_0x16bcc5[_0x5ca2fb])){this[_0xc008('0x94')](_0x16bcc5[_0x5ca2fb]);}else if(_[_0xc008('0x96')](_0x16bcc5[_0x5ca2fb])){for(var _0xfd1b6f=0x0;_0xfd1b6f<_0x16bcc5[_0x5ca2fb][_0xc008('0x97')];_0xfd1b6f++){this[_0xc008('0x94')](_0x16bcc5[_0x5ca2fb][_0xfd1b6f]);}}else if(_[_0xc008('0x91')](_0x16bcc5[_0x5ca2fb])){_0x16bcc5[_0x5ca2fb]=this[_0xc008('0x93')](_0x16bcc5[_0x5ca2fb]);}}}};AGIVertices[_0xc008('0x15')]['saveRestApiResult']=function(_0x9e53af,_0x2bbadf){for(var _0x54fd75 in _0x9e53af){if(_0x9e53af[_0xc008('0x90')](_0x54fd75)){if(_[_0xc008('0x95')](_0x9e53af[_0x54fd75])){if(!_[_0xc008('0x40')](_0x9e53af[_0x54fd75])){this[_0xc008('0x98')](_0x9e53af[_0x54fd75],util[_0xc008('0x25')](_0xc008('0x99'),_0x2bbadf,_0x54fd75));}}else if(_['isArray'](_0x9e53af[_0x54fd75])){for(var _0x26617c=0x0;_0x26617c<_0x9e53af[_0x54fd75][_0xc008('0x97')];_0x26617c++){this[_0xc008('0x98')](_0x9e53af[_0x54fd75][_0x26617c],util[_0xc008('0x25')]('%s.%s',_0x2bbadf,_0x54fd75+'['+_0x26617c+']'));}}else{if(!_[_0xc008('0x41')](_0x9e53af[_0x54fd75])){this['channel'][_0xc008('0x9a')](util[_0xc008('0x25')]('%s.%s',_0x2bbadf,_0x54fd75),_0x9e53af[_0x54fd75]);}}}}};AGIVertices[_0xc008('0x15')]['replaceObjectAllVariables']=function(_0xc35f69){try{var _0x4cb7d7=JSON['parse'](_0xc35f69);this['recursiveNodeIndex'](_0x4cb7d7);return JSON[_0xc008('0x6f')](_0x4cb7d7);}catch(_0x402b67){return this['replaceAllVariables'](_0xc35f69);}};AGIVertices[_0xc008('0x15')][_0xc008('0x93')]=function(_0x4a7692){var _0x40dbd2=_0x4a7692[_0xc008('0x9b')]('{');for(var _0x1564a9=0x1;_0x1564a9<_0x40dbd2['length'];_0x1564a9+=0x1){var _0x33cad3=_0x40dbd2[_0x1564a9][_0xc008('0x9b')]('}');if(_0x33cad3[_0xc008('0x97')]>0x1){_0x4a7692=_0x4a7692[_0xc008('0x9c')]('{'+_0x33cad3[0x0]+'}',this[_0xc008('0xf')][_0xc008('0x9d')](_0x33cad3[0x0])[_0xc008('0x9e')]||_0x33cad3[0x0]);}}if(_0x40dbd2[_0xc008('0x97')]===0x1){return _0x4a7692[_0xc008('0x48')]();}return this[_0xc008('0x93')](_0x4a7692);};AGIVertices[_0xc008('0x15')]['getAndSetVariable']=function(_0x35c753,_0x138ce1){var _0x14c6c2=this['channel'][_0xc008('0x9d')](_0x35c753);if(_0x14c6c2[_0xc008('0x9f')]===-0x1){return _0x14c6c2;}logger[_0xc008('0x2b')](util['format'](_0xc008('0xa0'),_0x138ce1,_0x14c6c2['extra']));return this[_0xc008('0xf')][_0xc008('0x9a')](_0x138ce1,_0x14c6c2[_0xc008('0x9e')]);};AGIVertices['prototype'][_0xc008('0x80')]=function(_0x11cbc7){return _0x11cbc7&&_0x11cbc7!=='0'&&_0x11cbc7!=='-1'&&_0x11cbc7!=='';};AGIVertices[_0xc008('0x15')][_0xc008('0xa1')]=function(_0x3ccb7b){this[_0xc008('0x33')][_0xc008('0x6c')](this,_0x3ccb7b,'-');_0x3ccb7b['retry']=_0x3ccb7b[_0xc008('0xa1')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xc008('0x15')][_0xc008('0xa2')]=function(_0x39d1fd){logger['info'](util[_0xc008('0x25')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x39d1fd[_0xc008('0xa3')]));if(!this[_0xc008('0x80')](_0x39d1fd[_0xc008('0x57')])){return this[_0xc008('0xf')][_0xc008('0xa4')](_0xc008('0xa5'));}var _0x45b3ab='\x22'+_0x39d1fd['text']+'\x22';if(this[_0xc008('0x80')](_0x39d1fd[_0xc008('0x72')])){_0x45b3ab+=','+_0x39d1fd[_0xc008('0x72')];}var _0x3e5a69=this['channel'][_0xc008('0x53')]('MRCPSynth',_0x45b3ab);if(_0x3e5a69[_0xc008('0x9f')]===-0x1){return _0x3e5a69;}return this[_0xc008('0xf')][_0xc008('0xa4')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x45b3ab));};AGIVertices[_0xc008('0x15')]['mrcprecog']=function(_0x4016fc){logger[_0xc008('0x2b')](util[_0xc008('0x25')](_0xc008('0xa6'),_0x4016fc['label']));if(!this[_0xc008('0x80')](_0x4016fc[_0xc008('0xa7')])){return this['channel']['noop'](_0xc008('0xa8'));}var _0x1edf41=_0x4016fc['grammar'];if(this[_0xc008('0x80')](_0x4016fc[_0xc008('0x72')])){_0x1edf41+=','+_0x4016fc[_0xc008('0x72')];}var _0x3d571=this['channel'][_0xc008('0x53')](_0xc008('0xa9'),_0x1edf41);if(_0x3d571[_0xc008('0x9f')]===-0x1){return _0x3d571;}var _0x1337a0=this[_0xc008('0xaa')](_0xc008('0xab'),_0xc008('0xac'));if(_0x1337a0[_0xc008('0x9f')]===-0x1){return _0x1337a0;}var _0x2f0e45=this[_0xc008('0xaa')](_0xc008('0xad'),_0xc008('0xae'));if(_0x2f0e45[_0xc008('0x9f')]===-0x1){return _0x2f0e45;}var _0x555825=this['getAndSetVariable'](_0xc008('0xaf'),_0xc008('0xb0'));if(_0x555825[_0xc008('0x9f')]===-0x1){return _0x555825;}return this[_0xc008('0xf')][_0xc008('0xa4')](util[_0xc008('0x25')](_0xc008('0xb1'),_0x1edf41));};AGIVertices['prototype']['agi']=function(_0x44415c){logger[_0xc008('0x2b')](util[_0xc008('0x25')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x44415c[_0xc008('0xa3')]));return this[_0xc008('0xf')][_0xc008('0x8')]([_0x44415c[_0xc008('0xb2')],_0x44415c[_0xc008('0xb3')]]);};AGIVertices[_0xc008('0x15')][_0xc008('0xb4')]=function(_0x39e8e3){logger[_0xc008('0x2b')](util[_0xc008('0x25')](_0xc008('0xb5'),_0x39e8e3[_0xc008('0xa3')]));if(this['isConfigured'](_0x39e8e3['timeout'])){logger[_0xc008('0x2b')](util[_0xc008('0x25')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x39e8e3[_0xc008('0x60')]));var _0x1d44fa=this[_0xc008('0xf')][_0xc008('0xb6')](_0x39e8e3[_0xc008('0x60')]);if(_0x1d44fa[_0xc008('0x9f')]===-0x1){return _0x1d44fa;}}return this[_0xc008('0xf')][_0xc008('0xb4')]();};AGIVertices[_0xc008('0x15')]['callback']=function(_0x51b305){logger['info'](util[_0xc008('0x25')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x51b305[_0xc008('0xa3')]));if(!this[_0xc008('0x80')](_0x51b305[_0xc008('0x45')])){return this[_0xc008('0xf')][_0xc008('0x29')](_0x51b305,_0xc008('0xb7'));}_0x51b305[_0xc008('0x47')]=moment();if(this[_0xc008('0x80')](_0x51b305[_0xc008('0xb8')])){_0x51b305[_0xc008('0x47')]=moment()[_0xc008('0xb9')](_0x51b305[_0xc008('0xb8')],_0xc008('0xba'));}if(!this[_0xc008('0x80')](_0x51b305[_0xc008('0x49')])){_0x51b305[_0xc008('0x49')]=0x2;}this[_0xc008('0x3f')]['sync'](this,_0x51b305);return this[_0xc008('0xf')]['noop'](util[_0xc008('0x25')](_0xc008('0xbb'),_0x51b305[_0xc008('0x44')],_0x51b305['list_id'],_0x51b305[_0xc008('0x47')]));};AGIVertices[_0xc008('0x15')][_0xc008('0xbc')]=function(_0x2f9cc){logger[_0xc008('0x2b')](util[_0xc008('0x25')](_0xc008('0xbd'),_0x2f9cc['label']));var _0x1cad4b=this[_0xc008('0xf')][_0xc008('0x53')](_0x2f9cc[_0xc008('0xbe')],_0x2f9cc['options']);if(_0x1cad4b['result']===-0x1){return _0x1cad4b;}return this['channel']['noop'](util[_0xc008('0x25')](_0xc008('0xbf'),_0x2f9cc[_0xc008('0xbe')],_0x2f9cc[_0xc008('0x72')]));};AGIVertices['prototype'][_0xc008('0xc0')]=function(_0x13fcee){logger[_0xc008('0x2b')](util['format'](_0xc008('0xc1'),_0x13fcee['label']));if(!this[_0xc008('0x80')](_0x13fcee['text'])){return this[_0xc008('0xf')][_0xc008('0xa4')](_0xc008('0xa5'));}var _0x1a5cc7='\x22'+_0x13fcee['text']+'\x22';if(this[_0xc008('0x80')](_0x13fcee[_0xc008('0x72')])){_0x1a5cc7+=','+_0x13fcee[_0xc008('0x72')];}var _0xa67842=this[_0xc008('0xf')][_0xc008('0x53')](_0xc008('0xc2'),_0x1a5cc7);if(_0xa67842['result']===-0x1){return _0xa67842;}return this[_0xc008('0xf')][_0xc008('0xa4')](util[_0xc008('0x25')]('Executed\x20command\x20MRCPSynth\x20%s',_0x1a5cc7));};AGIVertices['prototype'][_0xc008('0xc3')]=function(_0x36a4b6){logger[_0xc008('0x2b')](util[_0xc008('0x25')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x36a4b6[_0xc008('0xa3')]));if(!this[_0xc008('0x80')](_0x36a4b6['text'])){return this['channel']['noop'](_0xc008('0xa5'));}var _0x573b21='\x22'+_0x36a4b6[_0xc008('0x57')]+'\x22';if(this['isConfigured'](_0x36a4b6[_0xc008('0x72')])){_0x573b21+=','+_0x36a4b6[_0xc008('0x72')];}var _0x32c62a=this[_0xc008('0xf')]['exec']('MRCPSynth',_0x573b21);if(_0x32c62a[_0xc008('0x9f')]===-0x1){return _0x32c62a;}return this[_0xc008('0xf')][_0xc008('0xa4')](util['format'](_0xc008('0xc4'),_0x573b21));};AGIVertices[_0xc008('0x15')][_0xc008('0xc5')]=function(_0x272d98){logger[_0xc008('0x2b')](util[_0xc008('0x25')](_0xc008('0xc6'),_0x272d98[_0xc008('0xa3')]));if(!this[_0xc008('0x80')](_0x272d98[_0xc008('0xa7')])){return this[_0xc008('0xf')]['noop']('no\x20grammar\x20configured');}var _0x2f8ef9=_0x272d98['grammar'];if(this[_0xc008('0x80')](_0x272d98[_0xc008('0x72')])){_0x2f8ef9+=','+_0x272d98['options'];}var _0x487c0d=this[_0xc008('0xf')][_0xc008('0x53')](_0xc008('0xa9'),_0x2f8ef9);if(_0x487c0d[_0xc008('0x9f')]===-0x1){return _0x487c0d;}var _0x3e0b78=this[_0xc008('0xaa')]('RECOG_CONFIDENCE()',_0xc008('0xc7'));if(_0x3e0b78[_0xc008('0x9f')]===-0x1){return _0x3e0b78;}var _0x62e889=this['getAndSetVariable'](_0xc008('0xad'),_0xc008('0xc8'));if(_0x62e889[_0xc008('0x9f')]===-0x1){return _0x62e889;}var _0x42bbae=this['getAndSetVariable']('RECOG_INSTANCE()',_0xc008('0xc9'));if(_0x42bbae['result']===-0x1){return _0x42bbae;}return this[_0xc008('0xf')][_0xc008('0xa4')](util[_0xc008('0x25')](_0xc008('0xb1'),_0x2f8ef9));};AGIVertices[_0xc008('0x15')]['sestekasr']=function(_0x4da1dc){logger[_0xc008('0x2b')](util[_0xc008('0x25')](_0xc008('0xca'),_0x4da1dc[_0xc008('0xa3')]));if(!this[_0xc008('0x80')](_0x4da1dc[_0xc008('0xa7')])){return this[_0xc008('0xf')]['noop'](_0xc008('0xa8'));}var _0x283639=_0x4da1dc[_0xc008('0xa7')];if(this[_0xc008('0x80')](_0x4da1dc[_0xc008('0x72')])){_0x283639+=','+_0x4da1dc[_0xc008('0x72')];}var _0x3af9d0=this[_0xc008('0xf')][_0xc008('0x53')](_0xc008('0xa9'),_0x283639);if(_0x3af9d0[_0xc008('0x9f')]===-0x1){return _0x3af9d0;}var _0x328284=this['getAndSetVariable'](_0xc008('0xab'),_0xc008('0xcb'));if(_0x328284['result']===-0x1){return _0x328284;}var _0x40cb66=this[_0xc008('0xaa')](_0xc008('0xad'),_0xc008('0xcc'));if(_0x40cb66[_0xc008('0x9f')]===-0x1){return _0x40cb66;}var _0xf871fe=this[_0xc008('0xaa')](_0xc008('0xaf'),_0xc008('0xcd'));if(_0xf871fe[_0xc008('0x9f')]===-0x1){return _0xf871fe;}return this[_0xc008('0xf')]['noop'](util[_0xc008('0x25')](_0xc008('0xb1'),_0x283639));};AGIVertices[_0xc008('0x15')][_0xc008('0xce')]=function(_0x33c990){logger[_0xc008('0x2b')](util[_0xc008('0x25')](_0xc008('0xcf'),_0x33c990[_0xc008('0xa3')]));if(!this[_0xc008('0x80')](_0x33c990[_0xc008('0xd0')])){return this[_0xc008('0xf')][_0xc008('0x29')](_0x33c990,_0xc008('0xd1'));}var _0x26b5c8=this[_0xc008('0xd2')]['sync'](this,_0x33c990['odbc_id']);if(!_0x26b5c8){return this['channel'][_0xc008('0x29')](_0x33c990,_0xc008('0xd3'));}if(!this[_0xc008('0x80')](_0x33c990[_0xc008('0xd4')])){return this[_0xc008('0xf')][_0xc008('0x29')](_0x33c990,_0xc008('0xd5'));}var _0x47bc33=_0x33c990[_0xc008('0xd4')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0xc008('0xa4')](util[_0xc008('0x25')]('query:\x20%s',_0x47bc33));var _0x43521e=this[_0xc008('0x27')][_0xc008('0x6c')](this,_0x26b5c8,_0x47bc33);this['createSquareDetailsReport'][_0xc008('0x6c')](this,_0x33c990,_0x47bc33);if(!this[_0xc008('0x80')](_0x33c990[_0xc008('0xd6')])){return this['channel'][_0xc008('0xa4')](_0xc008('0xd7'));}var _0x3b1ab3=this[_0xc008('0x9d')][_0xc008('0x6c')](this,_0x33c990[_0xc008('0xd6')]);if(!_0x3b1ab3){return this[_0xc008('0xf')][_0xc008('0x29')](_0x33c990,'no\x20variable\x20found');}var _0x46eda5=this;_0x43521e[_0xc008('0xd8')](function(_0x2bcebe,_0x1b5f8c){Object[_0xc008('0xd9')](_0x2bcebe)['forEach'](function(_0xb04a1c){_0x46eda5[_0xc008('0xf')][_0xc008('0x9a')](util[_0xc008('0x25')](_0xc008('0xda'),_0x3b1ab3,_0x1b5f8c,_0xb04a1c),_0x2bcebe[_0xb04a1c]);});});this[_0xc008('0xf')][_0xc008('0x9a')](util[_0xc008('0x25')]('%s_ROWS_COUNT',_0x3b1ab3),_0x43521e[_0xc008('0x97')]);return this[_0xc008('0xf')][_0xc008('0xa4')](util[_0xc008('0x25')]('variable\x20%s\x20set',_0x3b1ab3));};AGIVertices['prototype'][_0xc008('0xdb')]=function(_0xbff325){logger['debug'](util[_0xc008('0x25')](_0xc008('0xdc'),_0xbff325[_0xc008('0xa3')]));if(!this[_0xc008('0x80')](_0xbff325[_0xc008('0xdd')])){return this[_0xc008('0xf')][_0xc008('0x29')](_0xbff325,'no\x20user\x20selected');}var _0x56316d=this[_0xc008('0xde')]['sync'](this,_0xbff325[_0xc008('0xdd')]);if(!_0x56316d){return this[_0xc008('0xf')][_0xc008('0x29')](_0xbff325,_0xc008('0xdf'));}var _0x2ea1db=this[_0xc008('0xf')][_0xc008('0x53')](_0xc008('0xe0'),[util[_0xc008('0x25')](_0xc008('0xe1'),_0x56316d),_0xbff325[_0xc008('0x60')],_0xbff325['opts'],_0xbff325[_0xc008('0x5e')]]);if(_0x2ea1db[_0xc008('0x9f')]===-0x1){return _0x2ea1db;}return this[_0xc008('0xf')][_0xc008('0xa4')](util[_0xc008('0x25')](_0xc008('0xe2'),_0xc008('0xe0')));};AGIVertices['prototype'][_0xc008('0xe3')]=function(_0x36c97d){logger[_0xc008('0x2b')](util['format'](_0xc008('0xe4'),_0x36c97d[_0xc008('0xa3')]));if(!this[_0xc008('0x80')](_0x36c97d[_0xc008('0x74')])){return this[_0xc008('0xf')][_0xc008('0xa4')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x36c97d[_0xc008('0x57')])){return this[_0xc008('0xf')][_0xc008('0xa4')](_0xc008('0xa5'));}this[_0xc008('0xf')]['bot']=!![];this[_0xc008('0x33')](_0x36c97d);this['createSquareMessage'](_0x36c97d[_0xc008('0x57')],'in','','');this[_0xc008('0xf')]['noop'](util[_0xc008('0x25')](_0xc008('0xe5'),_0x36c97d[_0xc008('0x57')]));var _0x3d0882=this['googleDialogflow'][_0xc008('0x6c')](this,_0x36c97d);if(_0x3d0882){for(var _0x2d5590 in _0x3d0882){if(_0x3d0882[_0xc008('0x90')](_0x2d5590)){this[_0xc008('0xf')][_0xc008('0x9a')](util['format'](_0xc008('0xe6'),_0x2d5590[_0xc008('0x65')]()),_0x3d0882[_0x2d5590]);}}this[_0xc008('0x3e')](_0x3d0882['speech'],_0xc008('0xe7'),_0xc008('0xe3'),'');return this[_0xc008('0xf')][_0xc008('0xa4')](util['format'](_0xc008('0xe8'),_0x3d0882[_0xc008('0xe9')]));}return this[_0xc008('0xf')][_0xc008('0x29')](_0x36c97d,_0xc008('0xea'));};AGIVertices['prototype'][_0xc008('0xeb')]=function(_0x541892){logger['info'](util[_0xc008('0x25')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x541892[_0xc008('0xa3')]));if(!this[_0xc008('0x80')](_0x541892[_0xc008('0xec')])){return this[_0xc008('0xf')][_0xc008('0xa4')](_0xc008('0xed'));}if(!this[_0xc008('0x80')](_0x541892['client_email'])){return this[_0xc008('0xf')][_0xc008('0xa4')](_0xc008('0xee'));}if(!this[_0xc008('0x80')](_0x541892[_0xc008('0x78')])){return this[_0xc008('0xf')]['noop'](_0xc008('0xef'));}if(!this[_0xc008('0x80')](_0x541892[_0xc008('0x79')])){return this[_0xc008('0xf')][_0xc008('0xa4')](_0xc008('0xf0'));}if(!this[_0xc008('0x80')](_0x541892[_0xc008('0x57')])){return this['channel']['noop'](_0xc008('0xa5'));}this[_0xc008('0xf')]['bot']=!![];this[_0xc008('0x33')](_0x541892);this['createSquareMessage'](_0x541892[_0xc008('0x57')],'in','','');this[_0xc008('0xf')][_0xc008('0xa4')](util[_0xc008('0x25')](_0xc008('0xf1'),_0x541892[_0xc008('0x57')]));var _0x1bd857=this['googleDialogflowV2'][_0xc008('0x6c')](this,_0x541892);if(_0x1bd857){for(var _0x54f526 in _0x1bd857){if(_0x1bd857[_0xc008('0x90')](_0x54f526)){if(_0x54f526!==_0xc008('0xf2')){this[_0xc008('0xf')][_0xc008('0x9a')](util[_0xc008('0x25')](_0xc008('0xe6'),_0x54f526[_0xc008('0x65')]()),_0x1bd857[_0x54f526]);}}}this['createSquareMessage'](_0x1bd857[_0xc008('0xe9')],_0xc008('0xe7'),'dialogflowV2',_0x1bd857[_0xc008('0xf2')]);return this[_0xc008('0xf')][_0xc008('0xa4')](util[_0xc008('0x25')](_0xc008('0xf3'),_0x1bd857[_0xc008('0xe9')]));}return this['channel'][_0xc008('0x29')](_0x541892,_0xc008('0xf4'));};AGIVertices[_0xc008('0x15')][_0xc008('0xf5')]=function(_0x47d263){logger['info'](util['format'](_0xc008('0xf6'),_0x47d263[_0xc008('0xa3')]));if(!this['isConfigured'](_0x47d263['ndauth_url'])){return this['channel']['noop'](_0xc008('0xf7'));}if(!this[_0xc008('0x80')](_0x47d263['username'])){return this[_0xc008('0xf')][_0xc008('0xa4')](_0xc008('0xf8'));}if(!this[_0xc008('0x80')](_0x47d263[_0xc008('0xf9')])){return this['channel']['noop'](_0xc008('0xfa'));}if(!this[_0xc008('0x80')](_0x47d263[_0xc008('0xfb')])){return this[_0xc008('0xf')][_0xc008('0xa4')](_0xc008('0xa5'));}this[_0xc008('0xf')]['bot']=!![];this[_0xc008('0x33')](_0x47d263);this[_0xc008('0x3e')](_0x47d263[_0xc008('0x57')],'in','','');this[_0xc008('0xf')][_0xc008('0xa4')](util[_0xc008('0x25')](_0xc008('0xfc'),_0x47d263['text']));var _0x583226=this[_0xc008('0x7a')][_0xc008('0x6c')](this,_0x47d263);if(_0x583226){for(var _0x11bcba in _0x583226){if(_0x583226[_0xc008('0x90')](_0x11bcba)){this[_0xc008('0xf')][_0xc008('0x9a')](util[_0xc008('0x25')](_0xc008('0xfd'),_0x11bcba[_0xc008('0x65')]()),_0x583226[_0x11bcba]);}}this[_0xc008('0x3e')](_0x583226[_0xc008('0xe9')],_0xc008('0xe7'),_0xc008('0xf5'),'');if(_0x583226['audiofile']){this['channel'][_0xc008('0xa4')](util[_0xc008('0x25')](_0xc008('0xfe'),_0x583226[_0xc008('0xff')]));var _0x25c7dd=this[_0xc008('0xf')][_0xc008('0x100')](_0x583226['audiofile']);try{fs['unlink'](_0x583226['audiofile']+_0xc008('0x101'));}catch(_0x4b7132){logger['error'](_0x4b7132);}return _0x25c7dd;}else{return this['channel'][_0xc008('0xa4')](util[_0xc008('0x25')](_0xc008('0x102'),_0x583226[_0xc008('0xe9')]));}}return this[_0xc008('0xf')][_0xc008('0x29')](_0x47d263,_0xc008('0x103'));};AGIVertices[_0xc008('0x15')][_0xc008('0x104')]=function(_0xdcda1f){logger[_0xc008('0x2b')](util[_0xc008('0x25')]('Enter\x20in\x20END\x20(%s)\x20block',_0xdcda1f['label']));return this[_0xc008('0xf')][_0xc008('0xa4')](_0xc008('0x104'));};AGIVertices[_0xc008('0x15')][_0xc008('0x105')]=function(_0x12a200){logger[_0xc008('0x2b')](util[_0xc008('0x25')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x12a200[_0xc008('0xa3')]));var _0x532c62='';if(_0x12a200['trunk_id']){if(!this['isConfigured'](_0x12a200['trunk_id'])){return this[_0xc008('0xf')]['error'](_0x12a200,_0xc008('0x106'));}else{var _0x38efaa=parseInt(_0x12a200[_0xc008('0x107')],0xa);if(isNaN(_0x38efaa)){_0x532c62=_0x12a200['trunk_id'];}else{_0x532c62=this['getTrunk'][_0xc008('0x6c')](this,_0x12a200[_0xc008('0x107')]);if(!_0x532c62){return this['channel'][_0xc008('0x29')](_0x12a200,_0xc008('0x108'));}}}}else if(_0x12a200[_0xc008('0x109')]){_0x532c62=_0x12a200[_0xc008('0x109')];}else{return this[_0xc008('0xf')][_0xc008('0x29')](_0x12a200,_0xc008('0x106'));}var _0x300a07=this[_0xc008('0xf')][_0xc008('0x53')]('DIAL',[util[_0xc008('0x25')](_0xc008('0x10a'),_0x532c62,_0x12a200['phone']),_0x12a200['timeout'],_0x12a200[_0xc008('0x10b')],_0x12a200[_0xc008('0x5e')]]);if(_0x300a07[_0xc008('0x9f')]===-0x1){return _0x300a07;}return this['channel']['noop'](util['format']('Executed\x20command\x20%s',_0xc008('0xe0')));};AGIVertices[_0xc008('0x15')][_0xc008('0x10c')]=function(_0x347b74){logger[_0xc008('0x2b')](util[_0xc008('0x25')](_0xc008('0x10d'),_0x347b74['label']));return this[_0xc008('0xf')][_0xc008('0xa4')](_0xc008('0x10c'));};AGIVertices[_0xc008('0x15')][_0xc008('0xe')]=function(_0x5104ec){logger[_0xc008('0x2b')](util[_0xc008('0x25')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x5104ec[_0xc008('0xa3')]));if(_0x5104ec[_0xc008('0x10e')]===0x0){return this[_0xc008('0xa1')](_0x5104ec);}_0x5104ec[_0xc008('0x10e')]-=0x1;if(!this['isConfigured'](_0x5104ec[_0xc008('0x10f')])){return this['channel'][_0xc008('0x29')](_0x5104ec,_0xc008('0x110'));}var _0x27cc7e=this[_0xc008('0x111')][_0xc008('0x6c')](this,_0x5104ec['file_id']);if(!_0x27cc7e){return this[_0xc008('0xf')][_0xc008('0x29')](_0x5104ec,_0xc008('0x112'));}if(!this[_0xc008('0x80')](_0x5104ec['variable_id'])){return this[_0xc008('0xf')]['error']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x33ac3f=this[_0xc008('0xf')][_0xc008('0x113')](_0x27cc7e,_0x5104ec['response'],_0x5104ec[_0xc008('0x114')]);var _0x41acd9=_0x33ac3f['result']?_0x33ac3f[_0xc008('0x9f')][_0xc008('0x48')]():'';logger['info']('test',JSON[_0xc008('0x6f')](_0x33ac3f));if(_0x33ac3f['result']===-0x1){this['createSquareDetailsReport'][_0xc008('0x6c')](this,_0x5104ec,_0x41acd9);return _0x33ac3f;}else if(_0x33ac3f['extra']===_0xc008('0x60')){_0x33ac3f[_0xc008('0x9f')]=_0x41acd9[_0xc008('0x97')]>=parseInt(_0x5104ec[_0xc008('0x115')])?'x':'i';}else{_0x33ac3f[_0xc008('0x9f')]=_0x41acd9['length']>=parseInt(_0x5104ec['mindigit'])&&_0x41acd9[_0xc008('0x97')]<=parseInt(_0x5104ec['maxdigit'])?'x':'i';}var _0x120338=this['getVariable']['sync'](this,_0x5104ec['variable_id']);if(!_0x120338){return this[_0xc008('0xf')]['error'](_0x5104ec,_0xc008('0x116'));}this[_0xc008('0xf')]['setVariable'](_0x120338,_0x41acd9);if(this['isConfigured'](_0x5104ec[_0xc008('0x117')])){var _0x202623=parseInt(_0x5104ec[_0xc008('0x117')],0xa);var _0x477482=rs['generate']({'charset':'*','length':_0x202623});var _0x54536d=_0x41acd9[_0xc008('0x97')];if(_0x54536d>0x0){if(_0x54536d>_0x202623){this['createSquareDetailsReport']['sync'](this,_0x5104ec,_0x5104ec[_0xc008('0x118')]===_0xc008('0x119')?_0x477482+_0x41acd9['substr'](_0x202623):_0x41acd9['substr'](0x0,_0x54536d-_0x202623)+_0x477482);}else{this['createSquareDetailsReport'][_0xc008('0x6c')](this,_0x5104ec,rs['generate']({'charset':'*','length':_0x54536d}));}}else{this[_0xc008('0x33')][_0xc008('0x6c')](this,_0x5104ec,'');}}else{this[_0xc008('0x33')][_0xc008('0x6c')](this,_0x5104ec,_0x41acd9);}return _0x33ac3f;};AGIVertices[_0xc008('0x15')]['getsecretdigits']=function(_0x529fa7){logger[_0xc008('0x2b')](util[_0xc008('0x25')](_0xc008('0x11a'),_0x529fa7[_0xc008('0xa3')]));return this[_0xc008('0xe')](_0x529fa7);};AGIVertices[_0xc008('0x15')][_0xc008('0x11b')]=function(_0x2e65fb){logger[_0xc008('0x2b')](util[_0xc008('0x25')](_0xc008('0x11c'),_0x2e65fb[_0xc008('0xa3')]));this['createSquareDetailsReport'][_0xc008('0x6c')](this,_0x2e65fb,_0x2e65fb[_0xc008('0x11d')]);return this[_0xc008('0xf')][_0xc008('0xa4')](util['format'](_0xc008('0x11e'),_0x2e65fb[_0xc008('0x11d')]));};AGIVertices[_0xc008('0x15')][_0xc008('0x11f')]=function(_0x122084){logger[_0xc008('0x2b')](util[_0xc008('0x25')](_0xc008('0x120'),_0x122084['label']));if(!this[_0xc008('0x80')](_0x122084[_0xc008('0x83')])||!this[_0xc008('0x80')](_0x122084[_0xc008('0x88')])){return this[_0xc008('0xf')][_0xc008('0xa4')](_0xc008('0x121'));}if(!this['isConfigured'](_0x122084[_0xc008('0x57')])){return this['channel'][_0xc008('0xa4')](_0xc008('0xa5'));}this[_0xc008('0xf')][_0xc008('0xa4')](util[_0xc008('0x25')](_0xc008('0x122'),_0x122084[_0xc008('0x57')]));var _0x22a459=this[_0xc008('0x82')][_0xc008('0x6c')](this,_0x122084);if(_0x22a459){this['channel'][_0xc008('0xa4')](util[_0xc008('0x25')](_0xc008('0x123'),_0x22a459));var _0x1ddd81=this[_0xc008('0xf')][_0xc008('0x100')](_0x22a459);try{fs[_0xc008('0x124')](_0x22a459+_0xc008('0x101'));}catch(_0x2cd23b){logger[_0xc008('0x29')](_0x2cd23b);}return _0x1ddd81;}return this[_0xc008('0xf')][_0xc008('0x29')](_0x122084,_0xc008('0x125'));};AGIVertices['prototype'][_0xc008('0x126')]=function(_0x4dfecc){logger[_0xc008('0x2b')](util[_0xc008('0x25')](_0xc008('0x127'),_0x4dfecc[_0xc008('0xa3')]));if(!this[_0xc008('0x80')](_0x4dfecc[_0xc008('0x83')])||!this['isConfigured'](_0x4dfecc[_0xc008('0x88')])){return this[_0xc008('0xf')][_0xc008('0xa4')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x4dfecc['aws_bot_name'])){return this[_0xc008('0xf')][_0xc008('0xa4')](_0xc008('0x128'));}if(!this[_0xc008('0x80')](_0x4dfecc[_0xc008('0x57')])){return this[_0xc008('0xf')][_0xc008('0xa4')]('no\x20text\x20configured');}this[_0xc008('0xf')][_0xc008('0x129')]=!![];this[_0xc008('0x33')](_0x4dfecc);this[_0xc008('0x3e')](_0x4dfecc[_0xc008('0x57')],'in','','');this['channel'][_0xc008('0xa4')](util[_0xc008('0x25')](_0xc008('0x12a'),_0x4dfecc[_0xc008('0x57')]));var _0x41877e=this[_0xc008('0x87')][_0xc008('0x6c')](this,_0x4dfecc);if(_0x41877e){for(var _0x3485a3 in _0x41877e){if(_0x41877e[_0xc008('0x90')](_0x3485a3)&&_[_0xc008('0x91')](_0x41877e[_0x3485a3])){this[_0xc008('0xf')]['setVariable'](util[_0xc008('0x25')]('AWS_LEX_%s',_0x3485a3[_0xc008('0x65')]()),_0x41877e[_0x3485a3]);}}if(_[_0xc008('0x41')](_0x41877e[_0xc008('0x12b')])){return this['channel'][_0xc008('0xa4')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0xc008('0x3e')](_0x41877e[_0xc008('0x12b')],_0xc008('0xe7'),_0xc008('0x12c'),'');return this[_0xc008('0xf')][_0xc008('0xa4')](util[_0xc008('0x25')](_0xc008('0x12d'),_0x41877e[_0xc008('0x12b')]));}}return this[_0xc008('0xf')]['error'](_0x4dfecc,_0xc008('0x12e'));};AGIVertices['prototype']['googleasr']=function(_0x35edb8){logger['info'](util[_0xc008('0x25')](_0xc008('0x12f'),_0x35edb8[_0xc008('0xa3')],_0x35edb8[_0xc008('0x60')]));if(!this['isConfigured'](_0x35edb8[_0xc008('0x74')])){return this[_0xc008('0xf')][_0xc008('0xa4')](_0xc008('0x130'));}var _0xc5b3de='wav';var _0x2b9571=util[_0xc008('0x25')]('%s/recordings/%s',FILES_PATH,rs[_0xc008('0x131')](0x4));var _0x1cfb31=util[_0xc008('0x25')](_0xc008('0x99'),_0x2b9571,_0xc5b3de);var _0x252c44=!![];if(_0x35edb8[_0xc008('0x132')]==='NOBEEP'){_0x252c44=![];}var _0x2922a9=this[_0xc008('0xf')][_0xc008('0x133')](_0x2b9571,_0xc5b3de,_0x35edb8[_0xc008('0x134')],_0x35edb8[_0xc008('0x60')],undefined,_0x252c44);if(_0x2922a9[_0xc008('0x9f')]!==-0x1){this[_0xc008('0xf')][_0xc008('0xa4')](util[_0xc008('0x25')](_0xc008('0x135'),_0x1cfb31));var _0x5d74df=this[_0xc008('0x8a')][_0xc008('0x6c')](this,_0x35edb8,_0x1cfb31);if(_0x5d74df){for(var _0x298783 in _0x5d74df){if(_0x5d74df[_0xc008('0x90')](_0x298783)){this['channel'][_0xc008('0x9a')](util[_0xc008('0x25')](_0xc008('0x136'),_0x298783[_0xc008('0x65')]()),_0x5d74df[_0x298783]);}}return this[_0xc008('0xf')][_0xc008('0xa4')](util[_0xc008('0x25')](_0xc008('0x137'),JSON[_0xc008('0x6f')](_0x5d74df)));}}return _0x2922a9;};AGIVertices[_0xc008('0x15')][_0xc008('0x138')]=function(_0x15a061){logger[_0xc008('0x2b')](util[_0xc008('0x25')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x15a061[_0xc008('0xa3')]));if(!this[_0xc008('0x80')](_0x15a061[_0xc008('0x8d')])){return this[_0xc008('0xf')][_0xc008('0xa4')]('no\x20appid\x20configured');}if(!this[_0xc008('0x80')](_0x15a061[_0xc008('0x139')])){return this['channel'][_0xc008('0xa4')](_0xc008('0x13a'));}var _0x552498='wav';var _0x4871bf=util['format'](_0xc008('0x13b'),FILES_PATH,rs['generate'](0x4));var _0x48791d=util[_0xc008('0x25')](_0xc008('0x99'),_0x4871bf,_0x552498);var _0x186dcf=!![];if(_0x15a061['beep']==='NOBEEP'){_0x186dcf=![];}var _0x4c6c36=this[_0xc008('0xf')][_0xc008('0x133')](_0x4871bf,_0x552498,_0x15a061[_0xc008('0x134')],_0x15a061['timeout'],undefined,_0x186dcf);if(_0x4c6c36[_0xc008('0x9f')]!==-0x1){this[_0xc008('0xf')]['noop'](util[_0xc008('0x25')]('tilde\x20%s\x20file\x20created',_0x48791d));var _0x5aedcb=this[_0xc008('0x8c')][_0xc008('0x6c')](this,_0x15a061,_0x48791d);if(_0x5aedcb){for(var _0x545f41 in _0x5aedcb){if(_0x5aedcb['hasOwnProperty'](_0x545f41)){this[_0xc008('0xf')][_0xc008('0x9a')](util['format'](_0xc008('0x13c'),_0x545f41['toUpperCase']()),_0x5aedcb[_0x545f41]);}}return this[_0xc008('0xf')][_0xc008('0xa4')](util[_0xc008('0x25')](_0xc008('0x13d'),JSON[_0xc008('0x6f')](_0x5aedcb)));}}return _0x4c6c36;};AGIVertices[_0xc008('0x15')][_0xc008('0x13e')]=function(_0x41a8a6){logger['info'](util[_0xc008('0x25')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x41a8a6[_0xc008('0xa3')]));return this['channel']['continueAt'](_0x41a8a6[_0xc008('0x39')],_0x41a8a6[_0xc008('0x3a')],_0x41a8a6[_0xc008('0x3b')]);};AGIVertices[_0xc008('0x15')][_0xc008('0x13f')]=function(_0x52d6a3){logger['info'](util[_0xc008('0x25')](_0xc008('0x140'),_0x52d6a3['label']));if(!this['isConfigured'](_0x52d6a3[_0xc008('0x141')])){return this[_0xc008('0xf')][_0xc008('0x29')](_0x52d6a3,_0xc008('0x142'));}try{var _0x166e8a=eval(_0x52d6a3[_0xc008('0x141')])?_0xc008('0x143'):_0xc008('0x144');this['channel'][_0xc008('0xa4')](util[_0xc008('0x25')]('EVAL\x20CONDITION\x20%s\x20%s',_0x52d6a3[_0xc008('0x141')],_0x166e8a));return{'code':0xc8,'result':_0x166e8a};}catch(_0x1859d7){return{'code':0xc8,'result':'false'};}};AGIVertices[_0xc008('0x15')]['gotoiftime']=function(_0x29af3c){logger['info'](util[_0xc008('0x25')](_0xc008('0x145'),_0x29af3c['label']));if(!this[_0xc008('0x80')](_0x29af3c['interval_id'])){return this[_0xc008('0xf')][_0xc008('0x29')](_0x29af3c,_0xc008('0x146'));}var _0x34d4c0=this[_0xc008('0x1e')][_0xc008('0x6c')](this,_0x29af3c[_0xc008('0x147')]);if(!_0x34d4c0){return this[_0xc008('0xf')][_0xc008('0x29')](_0x29af3c,'no\x20intervals\x20found');}for(var _0x194e84=0x0;_0x194e84<_0x34d4c0[_0xc008('0x97')];_0x194e84+=0x1){var _0xd2ce8e=this[_0xc008('0xf')][_0xc008('0x9d')](util['format'](_0xc008('0x148'),_0x34d4c0[_0x194e84]));if(_0xd2ce8e[_0xc008('0x9f')]===-0x1){return _0xd2ce8e;}logger[_0xc008('0x2b')](util[_0xc008('0x25')](_0xc008('0x149'),_0x34d4c0[_0x194e84],_0xd2ce8e[_0xc008('0x9e')]));if(_0xd2ce8e[_0xc008('0x9e')]===_0xc008('0x143')){logger[_0xc008('0x2b')](util[_0xc008('0x25')](_0xc008('0x149'),_0x34d4c0[_0x194e84],_0xc008('0x143')));this[_0xc008('0xf')][_0xc008('0xa4')](util[_0xc008('0x25')](_0xc008('0x149'),_0x34d4c0[_0x194e84],'true'));return{'code':0xc8,'result':_0xc008('0x143')};}else{logger[_0xc008('0x2b')](util[_0xc008('0x25')](_0xc008('0x149'),_0x34d4c0[_0x194e84],_0xc008('0x144')));this[_0xc008('0xf')][_0xc008('0xa4')](util[_0xc008('0x25')](_0xc008('0x149'),_0x34d4c0[_0x194e84],_0xc008('0x144')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0xc008('0x15')][_0xc008('0x14a')]=function(_0x49cb34){logger[_0xc008('0x2b')](util[_0xc008('0x25')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x49cb34[_0xc008('0xa3')]));return this[_0xc008('0xf')][_0xc008('0x14a')]();};AGIVertices[_0xc008('0x15')][_0xc008('0x14b')]=function(_0x2863f8){logger['info'](util[_0xc008('0x25')](_0xc008('0x14c'),_0x2863f8[_0xc008('0xa3')]));if(!this[_0xc008('0x80')](_0x2863f8[_0xc008('0x74')])){return this['channel'][_0xc008('0xa4')](_0xc008('0x130'));}var _0x326860=_0xc008('0x14d');var _0x3a1dfb=util[_0xc008('0x25')](_0xc008('0x13b'),FILES_PATH,rs[_0xc008('0x131')](0x4));var _0x5d3265=util[_0xc008('0x25')](_0xc008('0x99'),_0x3a1dfb,_0x326860);var _0x441dd1=!![];if(_0x2863f8[_0xc008('0x132')]===_0xc008('0x14e')){_0x441dd1=![];}var _0x47b2a0=this[_0xc008('0xf')][_0xc008('0x133')](_0x3a1dfb,_0x326860,_0x2863f8[_0xc008('0x134')],_0x2863f8['timeout'],undefined,_0x441dd1);if(_0x47b2a0['result']!==-0x1){this['channel'][_0xc008('0xa4')](util[_0xc008('0x25')](_0xc008('0x14f'),_0x5d3265));var _0x5d350e=this[_0xc008('0x7e')][_0xc008('0x6c')](this,_0x2863f8,_0x5d3265);if(_0x5d350e){for(var _0x1fa562 in _0x5d350e){if(_0x5d350e[_0xc008('0x90')](_0x1fa562)){this['channel'][_0xc008('0x9a')](util[_0xc008('0x25')](_0xc008('0x150'),_0x1fa562[_0xc008('0x65')]()),_0x5d350e[_0x1fa562]);}}return this[_0xc008('0xf')][_0xc008('0xa4')](util['format']('IspeechASR\x20Result\x20%s',JSON['stringify'](_0x5d350e)));}}return _0x47b2a0;};AGIVertices[_0xc008('0x15')][_0xc008('0x151')]=function(_0x5708a7){logger['info'](util[_0xc008('0x25')](_0xc008('0x152'),_0x5708a7[_0xc008('0xa3')]));if(!this[_0xc008('0x80')](_0x5708a7[_0xc008('0x74')])){return this['channel']['noop'](_0xc008('0x130'));}if(!this[_0xc008('0x80')](_0x5708a7[_0xc008('0x57')])){return this['channel'][_0xc008('0xa4')](_0xc008('0xa5'));}this[_0xc008('0xf')][_0xc008('0xa4')](util[_0xc008('0x25')](_0xc008('0x153'),_0x5708a7[_0xc008('0x57')]));var _0x5f0e69=this['ispeechTTS'][_0xc008('0x6c')](this,_0x5708a7);if(_0x5f0e69){this[_0xc008('0xf')][_0xc008('0xa4')](util[_0xc008('0x25')](_0xc008('0x14f'),_0x5f0e69));var _0x5a406d=this[_0xc008('0xf')]['streamFile'](_0x5f0e69,_0x5708a7['intKey']);try{fs[_0xc008('0x124')](_0x5f0e69+'.wav');}catch(_0x35daed){logger['error'](_0x35daed);}return _0x5a406d;}return this['channel']['error'](_0x5708a7,_0xc008('0x154'));};AGIVertices['prototype'][_0xc008('0x155')]=function(_0x429cc4){logger['info'](util[_0xc008('0x25')](_0xc008('0x156'),_0x429cc4[_0xc008('0xa3')]));if(!this[_0xc008('0x80')](_0x429cc4['findBy'])){return this['channel'][_0xc008('0x29')](_0x429cc4,_0xc008('0x157'));}logger[_0xc008('0x2b')](util[_0xc008('0x25')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xc008('0xf')]['callerid'],_0x429cc4[_0xc008('0x158')]));var _0x3af896=this[_0xc008('0x52')][_0xc008('0x6c')](this,_0x429cc4['findBy']);if(_0x3af896){logger['info'](util[_0xc008('0x25')](_0xc008('0x159'),this[_0xc008('0xf')]['callerid'],_0x429cc4[_0xc008('0x158')]));this[_0xc008('0xf')][_0xc008('0xa4')](util[_0xc008('0x25')](_0xc008('0x159'),this['channel']['callerid'],_0x429cc4[_0xc008('0x158')]));return{'code':0xc8,'result':_0xc008('0x15a')};}else{logger[_0xc008('0x2b')](util[_0xc008('0x25')](_0xc008('0x15b'),this[_0xc008('0xf')][_0xc008('0x37')],_0x429cc4[_0xc008('0x158')]));this[_0xc008('0xf')][_0xc008('0xa4')](util[_0xc008('0x25')](_0xc008('0x15b'),this[_0xc008('0xf')][_0xc008('0x37')],_0x429cc4[_0xc008('0x158')]));return{'code':0xc8,'result':_0xc008('0x15c')};}};AGIVertices['prototype'][_0xc008('0x15d')]=function(_0x651201){logger[_0xc008('0x2b')](util['format'](_0xc008('0x15e'),_0x651201[_0xc008('0xa3')]));if(!this['isConfigured'](_0x651201[_0xc008('0x158')])){return this['channel'][_0xc008('0x29')](_0x651201,_0xc008('0x157'));}logger[_0xc008('0x2b')](util[_0xc008('0x25')](_0xc008('0x15f'),this[_0xc008('0xf')]['callerid'],_0x651201[_0xc008('0x158')]));var _0x893638=this[_0xc008('0x4e')][_0xc008('0x6c')](this,_0x651201[_0xc008('0x158')]);if(_0x893638){logger[_0xc008('0x2b')](util[_0xc008('0x25')](_0xc008('0x159'),this[_0xc008('0xf')]['callerid'],_0x651201[_0xc008('0x158')]));this[_0xc008('0xf')][_0xc008('0xa4')](util['format'](_0xc008('0x159'),this[_0xc008('0xf')][_0xc008('0x37')],_0x651201[_0xc008('0x158')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0xc008('0x25')](_0xc008('0x15b'),this['channel'][_0xc008('0x37')],_0x651201['findBy']));this[_0xc008('0xf')]['noop'](util[_0xc008('0x25')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xc008('0xf')][_0xc008('0x37')],_0x651201[_0xc008('0x158')]));return{'code':0xc8,'result':_0xc008('0x15c')};}};AGIVertices[_0xc008('0x15')][_0xc008('0x160')]=function(_0x534a20){logger['info'](util[_0xc008('0x25')](_0xc008('0x161'),_0x534a20['label']));if(!this['isConfigured'](_0x534a20['operation'])){return this[_0xc008('0xf')][_0xc008('0x29')](_0x534a20,_0xc008('0x162'));}this[_0xc008('0xf')][_0xc008('0xa4')](util[_0xc008('0x25')]('math\x20%s',_0x534a20['operation']));var _0x2fae6e=eval(_0x534a20[_0xc008('0x163')]);if(!this[_0xc008('0x80')](_0x534a20[_0xc008('0xd6')])){return this[_0xc008('0xf')]['noop'](_0xc008('0xd7'));}var _0x9e896a=this['getVariable'][_0xc008('0x6c')](this,_0x534a20[_0xc008('0xd6')]);if(!_0x9e896a){return this[_0xc008('0xf')][_0xc008('0x29')](_0x534a20,_0xc008('0x116'));}if(_['isArray'](_0x2fae6e)){var _0x653f1e=this;_0x2fae6e[_0xc008('0xd8')](function(_0x5139d9,_0x32eda5){_0x653f1e[_0xc008('0xf')]['setVariable'](util[_0xc008('0x25')](_0xc008('0x164'),_0x9e896a,_0x32eda5),_0x5139d9);});return this[_0xc008('0xf')]['noop'](util[_0xc008('0x25')](_0xc008('0x165'),_0x9e896a));}else{return this[_0xc008('0xf')][_0xc008('0x9a')](_0x9e896a,_0x2fae6e);}};AGIVertices[_0xc008('0x15')][_0xc008('0x166')]=function(_0xa21caf){logger[_0xc008('0x2b')](util['format'](_0xc008('0x167'),_0xa21caf[_0xc008('0xa3')]));if(_0xa21caf[_0xc008('0x10e')]===0x0){return this[_0xc008('0xa1')](_0xa21caf);}_0xa21caf['retry']-=0x1;if(!this[_0xc008('0x80')](_0xa21caf['file_id'])){return this['channel'][_0xc008('0x29')](_0xa21caf,'no\x20file\x20audio\x20selected');}var _0xc3738f=this[_0xc008('0x111')][_0xc008('0x6c')](this,_0xa21caf[_0xc008('0x10f')]);if(!_0xc3738f){return this[_0xc008('0xf')]['error'](_0xa21caf,_0xc008('0x112'));}var _0x471938=this[_0xc008('0xf')]['getData'](_0xc3738f,_0xa21caf[_0xc008('0x168')],_0xa21caf[_0xc008('0x169')]);var _0x464b6d=_0x471938[_0xc008('0x9f')];if(_0x471938['result']===-0x1){this[_0xc008('0x33')][_0xc008('0x6c')](this,_0xa21caf,'-1');return _0x471938;}else if(_0x471938[_0xc008('0x9e')]===_0xc008('0x60')){_0x471938['result']=_0x471938[_0xc008('0x9f')][_0xc008('0x97')]>0x0?_0x471938['result']:'t';}else if(_[_0xc008('0x40')](_0x471938['result'])){_0x471938['result']='#';_0x464b6d='#';}if(!this['isConfigured'](_0xa21caf[_0xc008('0xd6')])){this[_0xc008('0xf')][_0xc008('0xa4')](_0xc008('0xd7'));}else{var _0x85aeb3=this[_0xc008('0x9d')][_0xc008('0x6c')](this,_0xa21caf[_0xc008('0xd6')]);if(!_0x85aeb3){return this[_0xc008('0xf')]['error'](_0xa21caf,'no\x20variable\x20found');}this[_0xc008('0xf')][_0xc008('0x9a')](_0x85aeb3,_0x464b6d);}this['createSquareDetailsReport'][_0xc008('0x6c')](this,_0xa21caf,_0x464b6d);return _0x471938;};AGIVertices[_0xc008('0x15')][_0xc008('0xa4')]=function(_0x32ad54){logger[_0xc008('0x2b')](util['format'](_0xc008('0x16a'),_0x32ad54[_0xc008('0xa3')]));return this[_0xc008('0xf')]['noop'](_0x32ad54[_0xc008('0x16b')]||_0x32ad54['label']);};AGIVertices[_0xc008('0x15')][_0xc008('0x16c')]=function(_0x596b13){logger[_0xc008('0x2b')](util[_0xc008('0x25')](_0xc008('0x16d'),_0x596b13['label']));if(!this['isConfigured'](_0x596b13[_0xc008('0x158')])){return this[_0xc008('0xf')][_0xc008('0x29')](_0x596b13,'no\x20find\x20by\x20configured');}logger['info'](util[_0xc008('0x25')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0xc008('0x37')],_0x596b13[_0xc008('0x158')]));var _0x143e71=this[_0xc008('0x4a')][_0xc008('0x6c')](this,_0x596b13[_0xc008('0x16e')]);var _0x359bcc=this[_0xc008('0x16f')]['sync'](this,_0x596b13['findBy'],_0x143e71);if(_0x359bcc){logger[_0xc008('0x2b')](util[_0xc008('0x25')](_0xc008('0x159'),this[_0xc008('0xf')][_0xc008('0x37')],_0x596b13[_0xc008('0x158')]));this[_0xc008('0xf')][_0xc008('0xa4')](util[_0xc008('0x25')](_0xc008('0x159'),this[_0xc008('0xf')][_0xc008('0x37')],_0x596b13[_0xc008('0x158')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0xc008('0x25')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xc008('0xf')]['callerid'],_0x596b13[_0xc008('0x158')]));this[_0xc008('0xf')][_0xc008('0xa4')](util[_0xc008('0x25')](_0xc008('0x159'),this['channel'][_0xc008('0x37')],_0x596b13['findBy']));return{'code':0xc8,'result':_0xc008('0x15c')};}};AGIVertices['prototype'][_0xc008('0x170')]=function(_0x466d46){logger[_0xc008('0x2b')](util[_0xc008('0x25')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x466d46[_0xc008('0xa3')]));if(!this[_0xc008('0x80')](_0x466d46[_0xc008('0x10f')])){return this[_0xc008('0xf')][_0xc008('0x29')](_0x466d46,_0xc008('0x110'));}var _0x8855e3=this['getSound']['sync'](this,_0x466d46[_0xc008('0x10f')]);if(!_0x8855e3){return this['channel'][_0xc008('0x29')](_0x466d46,_0xc008('0x112'));}var _0x453e1a=this[_0xc008('0xf')][_0xc008('0x53')]('PLAYBACK',[_0x8855e3,_0x466d46[_0xc008('0x10b')]]);if(_0x453e1a[_0xc008('0x9f')]===-0x1){return _0x453e1a;}return this[_0xc008('0xf')][_0xc008('0xa4')](util[_0xc008('0x25')](_0xc008('0xbf'),_0xc008('0x171'),_0x8855e3));};AGIVertices[_0xc008('0x15')][_0xc008('0x172')]=function(_0x537459){logger[_0xc008('0x2b')](util[_0xc008('0x25')](_0xc008('0x173'),_0x537459[_0xc008('0xa3')]));if(!this['isConfigured'](_0x537459[_0xc008('0x174')])){return this[_0xc008('0xf')][_0xc008('0x29')](_0x537459,'no\x20queue\x20selected');}var _0x564149='';var _0xdc3675=parseInt(_0x537459[_0xc008('0x174')],0xa);if(isNaN(_0xdc3675)){_0x564149=_0x537459[_0xc008('0x174')];}else{_0x564149=this['getVoiceQueue']['sync'](this,_0x537459[_0xc008('0x174')]);if(!_0x564149){return this[_0xc008('0xf')][_0xc008('0x29')](_0x537459,_0xc008('0x175'));}}var _0x29e610='';if(this[_0xc008('0x80')](_0x537459[_0xc008('0x10f')])){var _0x52cd65=this['getSound'][_0xc008('0x6c')](this,_0x537459[_0xc008('0x10f')]);if(_0x52cd65){_0x29e610=_0x52cd65;}}this[_0xc008('0x33')]['sync'](this,_0x537459,_0x564149);if(_0x537459['opts'][_0xc008('0x176')]('x')<0x0){_0x537459[_0xc008('0x10b')]+='x';}if(_0x537459[_0xc008('0x10b')][_0xc008('0x176')]('X')<0x0){_0x537459[_0xc008('0x10b')]+='X';}this[_0xc008('0xf')][_0xc008('0x9a')](_0xc008('0x177'),_0x564149?_0x564149[_0xc008('0x178')]():'');var _0x126381=this[_0xc008('0xf')]['exec'](_0xc008('0x179'),[_0x564149,_0x537459['opts'],_0x537459[_0xc008('0x5e')],_0x29e610,_0x537459[_0xc008('0x60')],_0x537459[_0xc008('0x8')],_0x537459[_0xc008('0x17a')],_0x537459[_0xc008('0x17b')],'',_0x537459[_0xc008('0x17c')]]);if(_0x126381['result']===-0x1){return _0x126381;}return this['channel']['noop'](util[_0xc008('0x25')]('Executed\x20command\x20%s\x20%s',_0xc008('0x179'),_0x564149));};AGIVertices[_0xc008('0x15')][_0xc008('0x17d')]=function(_0x3796f2){logger[_0xc008('0x2b')](util[_0xc008('0x25')](_0xc008('0x17e'),_0x3796f2[_0xc008('0xa3')]));var _0x17ae61=_0x3796f2[_0xc008('0x17f')]||_0xc008('0x14d');var _0x1c2f3e=util[_0xc008('0x25')](_0xc008('0x180'),this[_0xc008('0xf')]['uniqueid'],rs[_0xc008('0x131')](0x5));var _0x58805a=util[_0xc008('0x25')](_0xc008('0x181'),FILES_PATH,_0x1c2f3e,_0x17ae61);var _0x4fdfc7=util[_0xc008('0x25')](_0xc008('0x13b'),FILES_PATH,_0x1c2f3e);this[_0xc008('0x38')][_0xc008('0x6c')](this,_0x3796f2,_0x1c2f3e,_0x58805a);this[_0xc008('0xf')][_0xc008('0x9a')](_0xc008('0x182'),_0x1c2f3e);logger['info'](_0xc008('0x183'),_0x4fdfc7,_0x17ae61,_0x3796f2[_0xc008('0x184')],_0x3796f2[_0xc008('0x60')]);return this[_0xc008('0xf')][_0xc008('0x133')](_0x4fdfc7,_0x17ae61,_0x3796f2[_0xc008('0x184')],_0x3796f2['timeout'],undefined,!![]);};AGIVertices[_0xc008('0x15')][_0xc008('0x185')]=function(_0x375e6d){logger[_0xc008('0x2b')](util[_0xc008('0x25')](_0xc008('0x186'),_0x375e6d[_0xc008('0xa3')]));if(!this[_0xc008('0x80')](_0x375e6d['url'])){return this[_0xc008('0xf')]['noop'](_0xc008('0x187'));}var _0x270c07=this[_0xc008('0x5d')]['sync'](this,_0x375e6d);logger[_0xc008('0x2b')](util['format'](_0xc008('0x188'),util[_0xc008('0x189')](_0x270c07,{'showHidden':![],'depth':null})));if(!this[_0xc008('0x80')](_0x375e6d['variable_id'])){return this[_0xc008('0xf')]['noop'](_0xc008('0x18a'));}var _0x268963=this['getVariable']['sync'](this,_0x375e6d[_0xc008('0xd6')]);if(!_0x268963){return this[_0xc008('0xf')]['error'](_0x375e6d,_0xc008('0x116'));}this[_0xc008('0xf')][_0xc008('0x9a')](util[_0xc008('0x25')](_0xc008('0x18b'),_0x268963),_0x270c07[_0xc008('0x71')]?_0x270c07[_0xc008('0x71')]:'200');this['channel'][_0xc008('0x9a')](util[_0xc008('0x25')](_0xc008('0x18c'),_0x268963),_0x270c07[_0xc008('0x18d')]?_0x270c07[_0xc008('0x18d')]:'OK');if(_0x270c07['body']){try{this[_0xc008('0x98')](_0x270c07[_0xc008('0x66')],_0x268963);}catch(_0x108342){logger[_0xc008('0x29')](util[_0xc008('0x25')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x268963));}}return this[_0xc008('0xf')][_0xc008('0xa4')](util[_0xc008('0x25')](_0xc008('0x18e'),_0x268963));};AGIVertices[_0xc008('0x15')][_0xc008('0x18f')]=function(_0x54a213){logger[_0xc008('0x2b')](util[_0xc008('0x25')](_0xc008('0x190'),_0x54a213[_0xc008('0xa3')]));return this[_0xc008('0xf')][_0xc008('0x191')](_0x54a213['digits'][_0xc008('0x192')](/\s+/g,''),_0x54a213[_0xc008('0x184')]);};AGIVertices[_0xc008('0x15')][_0xc008('0x193')]=function(_0x11b7f3){logger[_0xc008('0x2b')](util['format'](_0xc008('0x194'),_0x11b7f3[_0xc008('0xa3')]));return this[_0xc008('0xf')]['sayNumber'](_0x11b7f3[_0xc008('0x61')]['replace'](/\s+/g,''),_0x11b7f3[_0xc008('0x184')]);};AGIVertices[_0xc008('0x15')][_0xc008('0x195')]=function(_0x522d53){logger[_0xc008('0x2b')](util['format'](_0xc008('0x196'),_0x522d53[_0xc008('0xa3')]));return this[_0xc008('0xf')][_0xc008('0x197')](_0x522d53['text'],_0x522d53[_0xc008('0x184')]);};AGIVertices[_0xc008('0x15')][_0xc008('0x198')]=function(_0x114505){logger[_0xc008('0x2b')](util[_0xc008('0x25')](_0xc008('0x199'),_0x114505['label']));if(!this[_0xc008('0x80')](_0x114505['account_id'])){return this['channel']['noop'](_0xc008('0x19a'));}var _0x556bb5=this[_0xc008('0x19b')][_0xc008('0x6c')](this,_0x114505[_0xc008('0x19c')]);if(!_0x556bb5||!_0x556bb5[_0xc008('0x19d')]){return this['channel'][_0xc008('0x29')](_0x114505,_0xc008('0x19e'));}var _0x4c5939={'from':util[_0xc008('0x25')](_0xc008('0x19f'),_0x556bb5[_0xc008('0x13')],_0x556bb5[_0xc008('0x1a0')]||_0x556bb5[_0xc008('0x19d')][_0xc008('0x1a1')]),'to':_0x114505['to']||'','cc':_0x114505['cc']||'','bcc':_0x114505['bcc']||'','subject':_0x114505[_0xc008('0x1a2')],'html':_0x114505[_0xc008('0x57')],'text':_0x114505[_0xc008('0x57')]};if(this[_0xc008('0x80')](_0x114505[_0xc008('0x1a3')])){}logger[_0xc008('0x1a4')](_0xc008('0x1a5'),JSON[_0xc008('0x6f')](_0x4c5939));this[_0xc008('0x33')][_0xc008('0x6c')](this,_0x114505,_0x114505[_0xc008('0x19c')]);this[_0xc008('0xf')]['noop'](util[_0xc008('0x25')](_0xc008('0x1a6'),_0x556bb5['name']));this[_0xc008('0x1c')][_0xc008('0x6c')](this,_0x556bb5[_0xc008('0x1a7')],_0x4c5939);return this['channel'][_0xc008('0xa4')](_0xc008('0x1a8'));};AGIVertices['prototype'][_0xc008('0x1a9')]=function(_0x532c31){logger[_0xc008('0x2b')](util[_0xc008('0x25')](_0xc008('0x1aa'),_0x532c31[_0xc008('0xa3')]));return this[_0xc008('0xf')][_0xc008('0xa4')](_0xc008('0x1ab'));};AGIVertices[_0xc008('0x15')][_0xc008('0x1ac')]=function(_0x161b9a){logger[_0xc008('0x2b')](util[_0xc008('0x25')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x161b9a[_0xc008('0xa3')]));if(!this[_0xc008('0x80')](_0x161b9a[_0xc008('0x1ad')])){return this[_0xc008('0xf')]['noop'](_0xc008('0x1ae'));}var _0x387763=this['getSmsAccount'][_0xc008('0x6c')](this,_0x161b9a[_0xc008('0x1ad')]);if(!_0x387763){return this[_0xc008('0xf')][_0xc008('0x29')](_0x161b9a,_0xc008('0x1af'));}var _0x1c80e4={'body':_0x161b9a[_0xc008('0x1b0')],'phone':_0x161b9a['to']||'','SmsAccountId':_0x387763['id']};logger[_0xc008('0x1a4')](_0xc008('0x1b1'),JSON['stringify'](_0x1c80e4));this['createSquareDetailsReport']['sync'](this,_0x161b9a,_0x161b9a[_0xc008('0x1ad')]);this[_0xc008('0xf')][_0xc008('0xa4')](util[_0xc008('0x25')](_0xc008('0x1b2'),_0x387763['name']));this[_0xc008('0x32')]['sync'](this,_0x1c80e4);return this['channel'][_0xc008('0xa4')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xc008('0x15')][_0xc008('0x1b3')]=function(_0x310560){logger[_0xc008('0x2b')](util['format'](_0xc008('0x1b4'),_0x310560[_0xc008('0xa3')]));if(!this[_0xc008('0x80')](_0x310560[_0xc008('0xd6')])){return this[_0xc008('0xf')][_0xc008('0x29')](_0x310560,_0xc008('0x1b5'));}var _0x20d0de=this['getVariable'][_0xc008('0x6c')](this,_0x310560[_0xc008('0xd6')]);if(!_0x20d0de){return this[_0xc008('0xf')][_0xc008('0x29')](_0x310560,_0xc008('0x116'));}return this[_0xc008('0xf')]['setVariable'](_0x20d0de,_0x310560['variable_value']);};AGIVertices[_0xc008('0x15')]['start']=function(_0x310725){logger[_0xc008('0x2b')](util[_0xc008('0x25')](_0xc008('0x1b6'),_0x310725[_0xc008('0xa3')]));this['channel'][_0xc008('0xa4')](_0xc008('0x1b7'));var _0x1580c5=this['channel'][_0xc008('0x9d')](_0xc008('0x1b8'));if(!_[_0xc008('0x40')](_0x1580c5['extra'])){this[_0xc008('0xf')]['uniqueid']=_0x1580c5[_0xc008('0x9e')];}if(_0x310725[_0xc008('0xb4')]===_0xc008('0x1b9')){this['channel'][_0xc008('0xa4')](_0xc008('0x1ba'));return this[_0xc008('0xf')]['answer']();}return this[_0xc008('0xf')]['noop'](_0xc008('0x1bb'));};AGIVertices[_0xc008('0x15')][_0xc008('0x1bc')]=function(_0x50b5ce){logger['info'](util[_0xc008('0x25')](_0xc008('0x1bd'),_0x50b5ce[_0xc008('0xa3')]));if(!this[_0xc008('0x80')](_0x50b5ce[_0xc008('0x1be')])){return this[_0xc008('0xf')][_0xc008('0x29')](_0x50b5ce,_0xc008('0x1bf'));}var _0x57a188=this['getSquareProject'][_0xc008('0x6c')](this,_0x50b5ce[_0xc008('0x1be')]);if(!this['isConfigured'](_0x57a188)){return this[_0xc008('0xf')][_0xc008('0x29')](_0x50b5ce,util['format']('no\x20subproject\x20found\x20with\x20id\x20%d',_0x50b5ce[_0xc008('0x1be')]));}if(_0x57a188===this['channel'][_0xc008('0x36')]){return this[_0xc008('0xf')][_0xc008('0x29')](_0x50b5ce,_0xc008('0x1c0'));}this['createSquareDetailsReport']['sync'](this,_0x50b5ce,_0x57a188);var _0x1c588c=this[_0xc008('0xf')][_0xc008('0x53')]('AGI',util['format'](_0xc008('0x1c1'),config[_0xc008('0x8')][_0xc008('0x1c2')]||_0xc008('0x1c3'),_0x57a188,this[_0xc008('0xf')][_0xc008('0x36')]));if(_0x1c588c[_0xc008('0x9f')]===-0x1){return _0x1c588c;}return this['channel']['noop'](util[_0xc008('0x25')](_0xc008('0xbf'),_0xc008('0x1c4'),_0x57a188));};AGIVertices[_0xc008('0x15')][_0xc008('0x1c5')]=function(_0xb7fda0){logger[_0xc008('0x2b')](util[_0xc008('0x25')](_0xc008('0x1c6'),_0xb7fda0['label']));var _0x5a2336=this[_0xc008('0x1c7')]['sync'](this,_0xb7fda0[_0xc008('0xb2')]);this['createSquareDetailsReport'][_0xc008('0x6c')](this,_0xb7fda0,_0xb7fda0[_0xc008('0xb2')]);if(this[_0xc008('0x80')](_0xb7fda0[_0xc008('0xd6')])){var _0xe65a0=this[_0xc008('0x9d')][_0xc008('0x6c')](this,_0xb7fda0[_0xc008('0xd6')]);if(_0xe65a0){this['channel']['setVariable'](_0xe65a0,_0x5a2336);return this[_0xc008('0xf')]['noop'](util[_0xc008('0x25')](_0xc008('0x1c8'),_0xb7fda0[_0xc008('0xb2')],_0xe65a0));}}return this[_0xc008('0xf')][_0xc008('0xa4')](util[_0xc008('0x25')](_0xc008('0x1c9'),_0xb7fda0[_0xc008('0xb2')]));};AGIVertices[_0xc008('0x15')][_0xc008('0x1ca')]=function(_0x2ac2f2){logger[_0xc008('0x2b')](util[_0xc008('0x25')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x2ac2f2[_0xc008('0xa3')]));_0x2ac2f2[_0xc008('0x57')]=_0x2ac2f2['text'][_0xc008('0x192')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x2ac2f2[_0xc008('0x55')])){return this['channel'][_0xc008('0xa4')]('no\x20apiKey\x20configured');}if(!this['isConfigured'](_0x2ac2f2[_0xc008('0x57')])){return this[_0xc008('0xf')][_0xc008('0xa4')](_0xc008('0xa5'));}this[_0xc008('0xf')][_0xc008('0xa4')](util['format'](_0xc008('0x1cb'),_0x2ac2f2[_0xc008('0x57')]));var _0x51b2b0=this[_0xc008('0x54')][_0xc008('0x6c')](this,_0x2ac2f2);if(_0x51b2b0){this['channel'][_0xc008('0xa4')](util['format'](_0xc008('0x1cc'),_0x51b2b0));var _0x74ef75=this[_0xc008('0xf')][_0xc008('0x100')](_0x51b2b0);try{fs['unlink'](_0x51b2b0+_0xc008('0x101'));}catch(_0x2d12e0){logger[_0xc008('0x29')](_0x2d12e0);}return _0x74ef75;}return this[_0xc008('0xf')][_0xc008('0x29')](_0x2ac2f2,_0xc008('0x1cd'));};AGIVertices['prototype'][_0xc008('0x1ce')]=function(_0x26f044){logger[_0xc008('0x2b')](util['format'](_0xc008('0x1cf'),_0x26f044[_0xc008('0xa3')]));_0x26f044['text']=_0x26f044['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xc008('0x80')](_0x26f044[_0xc008('0x57')])){return this[_0xc008('0xf')]['noop'](_0xc008('0xa5'));}this['channel'][_0xc008('0xa4')](util[_0xc008('0x25')](_0xc008('0x1d0'),_0x26f044[_0xc008('0x57')]));var _0x1a7b13=this[_0xc008('0x5b')]['sync'](this,_0x26f044);if(_0x1a7b13){this[_0xc008('0xf')]['noop'](util['format'](_0xc008('0x1d1'),_0x1a7b13));var _0x404996=this[_0xc008('0xf')][_0xc008('0x100')](_0x1a7b13);try{fs[_0xc008('0x124')](_0x1a7b13+_0xc008('0x101'));}catch(_0x674155){logger[_0xc008('0x29')](_0x674155);}return _0x404996;}return this[_0xc008('0xf')][_0xc008('0x29')](_0x26f044,_0xc008('0x1d2'));};AGIVertices['prototype'][_0xc008('0x1d3')]=function(_0x2f8b0d){logger['info'](util[_0xc008('0x25')](_0xc008('0x1d4'),_0x2f8b0d['label']));if(!this[_0xc008('0x80')](_0x2f8b0d[_0xc008('0x158')])){return this['channel'][_0xc008('0x29')](_0x2f8b0d,_0xc008('0x157'));}logger[_0xc008('0x2b')](util[_0xc008('0x25')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xc008('0xf')]['callerid'],_0x2f8b0d[_0xc008('0x158')]));var _0x5dfdd6=this[_0xc008('0x4d')][_0xc008('0x6c')](this,_0x2f8b0d['findBy']);if(_0x5dfdd6){logger['info'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xc008('0xf')][_0xc008('0x37')],_0x2f8b0d[_0xc008('0x158')]));this[_0xc008('0xf')][_0xc008('0xa4')](util['format'](_0xc008('0x159'),this[_0xc008('0xf')][_0xc008('0x37')],_0x2f8b0d['findBy']));return{'code':0xc8,'result':_0xc008('0x15a')};}else{logger['info'](util[_0xc008('0x25')](_0xc008('0x15b'),this[_0xc008('0xf')][_0xc008('0x37')],_0x2f8b0d[_0xc008('0x158')]));this[_0xc008('0xf')][_0xc008('0xa4')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xc008('0xf')][_0xc008('0x37')],_0x2f8b0d['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0xc008('0x1d5')]=function(_0x5d2994){logger[_0xc008('0x2b')](util[_0xc008('0x25')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x5d2994[_0xc008('0xa3')]));var _0x479af5=this[_0xc008('0xf')][_0xc008('0x53')](_0xc008('0x1d6'),[_0x5d2994[_0xc008('0x1d7')],_0x5d2994[_0xc008('0x72')]]);if(_0x479af5[_0xc008('0x9f')]===-0x1){return _0x479af5;}return this['channel']['noop'](util[_0xc008('0x25')]('Executed\x20command\x20%s\x20%s',_0xc008('0x1d6'),_0x5d2994[_0xc008('0x1d7')]));};AGIVertices[_0xc008('0x15')][_0xc008('0x1d8')]=function(_0x9ca0fa){logger[_0xc008('0x2b')](util['format'](_0xc008('0x1d9'),_0x9ca0fa[_0xc008('0xa3')]));if(!this[_0xc008('0x80')](_0x9ca0fa[_0xc008('0xd6')])){return this[_0xc008('0xf')]['error'](_0x9ca0fa,_0xc008('0x1b5'));}var _0x4cbac9=this[_0xc008('0x9d')][_0xc008('0x6c')](this,_0x9ca0fa[_0xc008('0xd6')]);if(!_0x4cbac9){return this[_0xc008('0xf')][_0xc008('0x29')](_0x9ca0fa,_0xc008('0x116'));}var _0x5664b0=this[_0xc008('0xf')][_0xc008('0x9d')](_0x4cbac9);return{'code':0xc8,'result':_0x5664b0[_0xc008('0x9e')]?_0x5664b0[_0xc008('0x9e')]:'-'};};String[_0xc008('0x15')][_0xc008('0x9c')]=function(_0x263a0a,_0x319c2f){return this[_0xc008('0x9b')](_0x263a0a)[_0xc008('0x1da')](_0x319c2f);};module[_0xc008('0x1db')]=AGIVertices; \ No newline at end of file +var _0x3c94=['out','Dialogflow\x20is\x20unreachable','dialogflowV2','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DIALOGFLOW_%s','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','speech','sesteknda','audiofile','streamFile','.wav','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','Executed\x20command\x20%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','maxRetry','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','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','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','%s/recordings/%s','beep','NOBEEP','recordFile','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','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','unlink','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','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','isArray','Enter\x20in\x20NOOP\x20(%s)\x20block','output','getPause','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','toLowerCase','QUEUE','macro','gosub','position','record','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','no\x20url\x20configured','restAPI','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','getSmsAccount','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','yes','Answer','Skipped\x20Answer','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','host','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','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','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','mailRpc','prototype','getVariable','rpc','getVariableById','then','name','catch','getVoiceQueue','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','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','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','createSquareRecording','callerid','context','extension','priority','accountcode','dnid','arg_1','file','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','agentPause','agent','agentUnpause','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','google_cloud_tts_text_type','text','MALE','audioEncoding','googleTTS','method','timeout','includes','POST','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','parse','computedVariables','sync','uri','render','url','stringify','statusMessage','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','key','ispeech_tts_language','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_access_key_id','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','retry','mrcpsynth','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','keys','forEach','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','toUpperCase'];(function(_0x4427c4,_0x28bd26){var _0x1e568d=function(_0x7e56fb){while(--_0x7e56fb){_0x4427c4['push'](_0x4427c4['shift']());}};_0x1e568d(++_0x28bd26);}(_0x3c94,0xcd));var _0x43c9=function(_0x4d82ea,_0x4d459f){_0x4d82ea=_0x4d82ea-0x0;var _0x257f4a=_0x3c94[_0x4d82ea];return _0x257f4a;};'use strict';var fs=require('fs');var util=require(_0x43c9('0x0'));var _=require(_0x43c9('0x1'));var sh=require(_0x43c9('0x2'));var odbc=require(_0x43c9('0x3'))();var rs=require(_0x43c9('0x4'));var moment=require(_0x43c9('0x5'));var Mustache=require(_0x43c9('0x6'));var rp=require(_0x43c9('0x7'));var logger=require(_0x43c9('0x8'))(_0x43c9('0x9'));var config=require(_0x43c9('0xa'));var scripts=require(_0x43c9('0xb'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x43c9('0xc'),_0x43c9('0xd')];var verticesWithRetry=[_0x43c9('0xe'),_0x43c9('0xf'),_0x43c9('0x10')];var AGIVertices=function(_0x7a0f6b,_0x28aa11,_0x4725aa){this[_0x43c9('0x11')]=_0x7a0f6b;this['rpc']=_0x28aa11;this[_0x43c9('0x12')]=_0x4725aa;};AGIVertices[_0x43c9('0x13')][_0x43c9('0x14')]=function(_0x3b21f5,_0x27ad97){this[_0x43c9('0x15')][_0x43c9('0x16')](_0x3b21f5)[_0x43c9('0x17')](function(_0x41f338){_0x27ad97(null,_0x41f338?_0x41f338[_0x43c9('0x18')]:![]);})[_0x43c9('0x19')](function(_0x31faa1){_0x27ad97(_0x31faa1);});};AGIVertices[_0x43c9('0x13')][_0x43c9('0x1a')]=function(_0xa98d2f,_0x45546d){this[_0x43c9('0x15')]['getVoiceQueueById'](_0xa98d2f)[_0x43c9('0x17')](function(_0x1c7fd9){_0x45546d(null,_0x1c7fd9?_0x1c7fd9[_0x43c9('0x18')]:![]);})[_0x43c9('0x19')](function(_0x3f908d){_0x45546d(_0x3f908d);});};AGIVertices['prototype']['getSquareProject']=function(_0x425238,_0x9a0f50){this[_0x43c9('0x15')][_0x43c9('0x1b')](_0x425238)['then'](function(_0x1d63cf){_0x9a0f50(null,_0x1d63cf?_0x1d63cf[_0x43c9('0x18')]:![]);})[_0x43c9('0x19')](function(_0x22bf3d){_0x9a0f50(_0x22bf3d);});};AGIVertices[_0x43c9('0x13')][_0x43c9('0x1c')]=function(_0x24db4e,_0x1e3996){this[_0x43c9('0x15')][_0x43c9('0x1d')](_0x24db4e)[_0x43c9('0x17')](function(_0x4847b2){_0x1e3996(null,_0x4847b2?_0x4847b2[_0x43c9('0x1e')]:![]);})[_0x43c9('0x19')](function(_0x31248d){_0x1e3996(_0x31248d);});};AGIVertices['prototype'][_0x43c9('0x1f')]=function(_0x5e477,_0x2ef8d9){this['rpc'][_0x43c9('0x20')](_0x5e477)[_0x43c9('0x17')](function(_0x460f53){_0x2ef8d9(null,_0x460f53?_0x460f53['name']:![]);})['catch'](function(_0x2a40f4){_0x2ef8d9(_0x2a40f4);});};AGIVertices[_0x43c9('0x13')][_0x43c9('0x21')]=function(_0x59110e,_0x3bc245){this[_0x43c9('0x15')][_0x43c9('0x22')](_0x59110e)[_0x43c9('0x17')](function(_0x2c69af){_0x3bc245(null,_0x2c69af?_0x2c69af['name']:![]);})[_0x43c9('0x19')](function(_0x3b5c47){_0x3bc245(_0x3b5c47);});};AGIVertices[_0x43c9('0x13')][_0x43c9('0x23')]=function(_0x4633cc,_0xf5b835){var _0x40345f=this;this[_0x43c9('0x15')][_0x43c9('0x24')](_0x4633cc)[_0x43c9('0x17')](function(_0x4eb970){_0xf5b835(null,_0x4eb970?_0x40345f[_0x43c9('0x25')](_0x4eb970[_0x43c9('0x26')]):![]);})[_0x43c9('0x19')](function(_0x519e2c){_0xf5b835(_0x519e2c);});};AGIVertices[_0x43c9('0x13')][_0x43c9('0x27')]=function(_0x4ccda7,_0x2cb41c){this['rpc'][_0x43c9('0x28')](_0x4ccda7)[_0x43c9('0x17')](function(_0x496b67){_0x2cb41c(null,_0x496b67?_0x496b67:![]);})[_0x43c9('0x19')](function(_0x4b835f){_0x2cb41c(_0x4b835f);});};AGIVertices[_0x43c9('0x13')][_0x43c9('0x29')]=function(_0x17dd62,_0x526741,_0x1350c8){this['mailRpc'][_0x43c9('0x29')](_0x17dd62,_0x526741)[_0x43c9('0x17')](function(){_0x1350c8(null);})[_0x43c9('0x19')](function(_0x3cd1db){_0x1350c8(_0x3cd1db);});};AGIVertices['prototype'][_0x43c9('0x2a')]=function(_0x469769,_0x465116){this[_0x43c9('0x15')]['getIntervalById'](_0x469769)[_0x43c9('0x17')](function(_0x197aff){if(_0x197aff){if(_0x197aff[_0x43c9('0x2b')]){_0x465116(null,[_0x197aff[_0x43c9('0x2c')]]);}else{_0x465116(null,_[_0x43c9('0x2d')](_0x197aff[_0x43c9('0x2e')],_0x43c9('0x2c')));}}else{_0x465116(null,![]);}})[_0x43c9('0x19')](function(_0x4d5d8e){_0x465116(_0x4d5d8e);});};AGIVertices[_0x43c9('0x13')][_0x43c9('0x25')]=function(_0x84d661){return util[_0x43c9('0x2f')](_0x43c9('0x30'),FILES_PATH,_0x84d661);};AGIVertices[_0x43c9('0x13')][_0x43c9('0x31')]=function(_0x358202,_0x45d2d4,_0x4a62b2){odbc[_0x43c9('0x32')](_0x358202,function(_0x51c8c7){if(_0x51c8c7){logger[_0x43c9('0x33')](_0x43c9('0x34'),_0x51c8c7);_0x4a62b2(_0x51c8c7);}else{logger[_0x43c9('0x35')](_0x43c9('0x36'));odbc[_0x43c9('0x37')](_0x45d2d4,function(_0x787b76,_0x42dacb){if(_0x787b76){logger[_0x43c9('0x35')](_0x43c9('0x38'),_0x45d2d4);_0x4a62b2(_0x787b76);}else{logger['info'](_0x43c9('0x39'),_0x45d2d4);odbc[_0x43c9('0x3a')](function(_0x585bb3){if(_0x585bb3){logger[_0x43c9('0x33')](_0x43c9('0x3b'),_0x585bb3);}_0x4a62b2(null,_0x42dacb);});}});}});};AGIVertices[_0x43c9('0x13')]['getSmsAccount']=function(_0xb01a6e,_0x33f293){this[_0x43c9('0x15')][_0x43c9('0x3c')](_0xb01a6e)[_0x43c9('0x17')](function(_0x39601e){_0x33f293(null,_0x39601e?_0x39601e:![]);})[_0x43c9('0x19')](function(_0x3a68d8){_0x33f293(_0x3a68d8);});};AGIVertices[_0x43c9('0x13')][_0x43c9('0x3d')]=function(_0x470a66,_0x40d8cc){this['rpc'][_0x43c9('0x3d')](_0x470a66)[_0x43c9('0x17')](function(_0xaecaf5){_0x40d8cc(null,_0xaecaf5);})[_0x43c9('0x19')](function(_0x4d6eee){_0x40d8cc(_0x4d6eee);});};AGIVertices[_0x43c9('0x13')][_0x43c9('0x3e')]=function(_0x5ce14f,_0x2a8f7d,_0x395b1f){this[_0x43c9('0x15')][_0x43c9('0x3e')]({'uniqueid':this[_0x43c9('0x11')][_0x43c9('0x3f')],'node':_0x5ce14f[_0x43c9('0x40')],'application':_0x5ce14f[_0x43c9('0x41')],'data':_0x2a8f7d||null,'project_name':this[_0x43c9('0x11')]['arg_1'],'callerid':this[_0x43c9('0x11')]['callerid']})[_0x43c9('0x17')](function(_0x3fdf47){if(_0x395b1f){_0x395b1f(null,_0x3fdf47);}})[_0x43c9('0x19')](function(_0x45de19){if(_0x395b1f){_0x395b1f(_0x45de19);}});};AGIVertices['prototype'][_0x43c9('0x42')]=function(_0x34c118,_0x53cb85,_0x1d40e4,_0x272c94){this['rpc'][_0x43c9('0x42')]({'uniqueid':this[_0x43c9('0x11')][_0x43c9('0x3f')],'callerid':this['channel'][_0x43c9('0x43')],'calleridname':this['channel']['calleridname'],'context':this[_0x43c9('0x11')][_0x43c9('0x44')],'extension':this[_0x43c9('0x11')][_0x43c9('0x45')],'priority':this[_0x43c9('0x11')][_0x43c9('0x46')],'accountcode':this[_0x43c9('0x11')][_0x43c9('0x47')],'dnid':this[_0x43c9('0x11')][_0x43c9('0x48')],'projectName':this[_0x43c9('0x11')][_0x43c9('0x49')],'saveName':_0x53cb85,'filename':_0x34c118[_0x43c9('0x4a')]||_0x53cb85,'savePath':_0x1d40e4})['then'](function(_0xc57086){_0x272c94(null,_0xc57086);})[_0x43c9('0x19')](function(_0x4deed0){_0x272c94(_0x4deed0);});};AGIVertices[_0x43c9('0x13')][_0x43c9('0x4b')]=function(_0x43f96d,_0x2057a8,_0x246b9c,_0x2e763c,_0x21adfe){this[_0x43c9('0x15')][_0x43c9('0x4b')]({'uniqueid':this['channel'][_0x43c9('0x3f')],'body':_0x43f96d,'direction':_0x2057a8,'providerName':_0x246b9c,'providerResponse':_0x2e763c})[_0x43c9('0x17')](function(_0x4353b1){if(_0x21adfe){_0x21adfe(null,_0x4353b1);}})[_0x43c9('0x19')](function(_0x22e48d){if(_0x21adfe){_0x21adfe(_0x22e48d);}});};AGIVertices[_0x43c9('0x13')]['createCmContact']=function(_0x37b747,_0x1bc3b5){this[_0x43c9('0x15')][_0x43c9('0x4c')]({'firstName':_[_0x43c9('0x4d')](_0x37b747[_0x43c9('0x18')])||_[_0x43c9('0x4e')](_0x37b747[_0x43c9('0x18')])?'callback_'+Math[_0x43c9('0x4f')]():_0x37b747['name'],'lastName':_[_0x43c9('0x4d')](_0x37b747[_0x43c9('0x50')])||_[_0x43c9('0x4e')](_0x37b747[_0x43c9('0x50')])?null:_0x37b747['lastName'],'phone':_0x37b747['phone'],'ListId':_0x37b747['list_id'],'scheduledat':_0x37b747[_0x43c9('0x51')],'callbackUniqueid':this[_0x43c9('0x11')][_0x43c9('0x3f')],'tags':_0x43c9('0x52'),'description':_0x43c9('0x53')+_0x37b747[_0x43c9('0x51')][_0x43c9('0x54')](),'priority':_0x37b747[_0x43c9('0x55')]})['then'](function(_0x4ffc86){_0x1bc3b5(null,_0x4ffc86);})[_0x43c9('0x19')](function(_0x14d9ec){_0x1bc3b5(_0x14d9ec);});};AGIVertices['prototype']['getPause']=function(_0x352844,_0xf98590){this[_0x43c9('0x15')]['getPauseById'](_0x352844)[_0x43c9('0x17')](function(_0x113cc8){_0xf98590(null,_0x113cc8?_0x113cc8[_0x43c9('0x18')]:![]);})[_0x43c9('0x19')](function(_0x223cac){_0xf98590(_0x223cac);});};AGIVertices[_0x43c9('0x13')][_0x43c9('0x56')]=function(_0x1b5a91,_0x45d639,_0x474d58){var _0x50f1dc={'role':_0x43c9('0x57')};_0x50f1dc[_0x1b5a91]=this[_0x43c9('0x11')][_0x43c9('0x43')];this[_0x43c9('0x15')][_0x43c9('0x56')](_0x50f1dc,_0x45d639,this[_0x43c9('0x11')]['uniqueid'])[_0x43c9('0x17')](function(_0x40c8cc){_0x474d58(null,_[_0x43c9('0x4e')](_0x40c8cc)?![]:!![]);})[_0x43c9('0x19')](function(_0x3d7287){logger[_0x43c9('0x33')](_0x3d7287);_0x474d58(null,![]);});};AGIVertices[_0x43c9('0x13')]['agentUnpause']=function(_0xd7f56b,_0x4d4bf4){var _0xf38f9f={'role':_0x43c9('0x57')};_0xf38f9f[_0xd7f56b]=this[_0x43c9('0x11')]['callerid'];this['rpc'][_0x43c9('0x58')](_0xf38f9f)[_0x43c9('0x17')](function(_0x3d47a7){_0x4d4bf4(null,_['isNil'](_0x3d47a7)?![]:!![]);})[_0x43c9('0x19')](function(_0x5225a4){logger[_0x43c9('0x33')](_0x5225a4);_0x4d4bf4(null,![]);});};AGIVertices[_0x43c9('0x13')]['agentLogout']=function(_0x34831c,_0x5c7957){var _0x186038={'role':_0x43c9('0x57')};_0x186038[_0x34831c]=this[_0x43c9('0x11')]['callerid'];this['rpc']['agentLogout'](_0x186038)[_0x43c9('0x17')](function(_0x1b4b27){_0x5c7957(null,_[_0x43c9('0x4e')](_0x1b4b27)?![]:!![]);})[_0x43c9('0x19')](function(_0x431570){logger[_0x43c9('0x33')](_0x431570);_0x5c7957(null,![]);});};AGIVertices[_0x43c9('0x13')][_0x43c9('0x59')]=function(_0x33be1b,_0x49635c){var _0x27d4d4={'role':'agent'};_0x27d4d4[_0x33be1b]=this[_0x43c9('0x11')][_0x43c9('0x43')];var _0x11b73d=_0x33be1b!=_0x43c9('0x5a')?util[_0x43c9('0x2f')](_0x43c9('0x5b'),_0x43c9('0x5c'),this[_0x43c9('0x11')][_0x43c9('0x43')]):undefined;this[_0x43c9('0x15')][_0x43c9('0x59')](_0x27d4d4,_0x11b73d)[_0x43c9('0x17')](function(_0x574f31){_0x49635c(null,_[_0x43c9('0x4e')](_0x574f31)?![]:!![]);})[_0x43c9('0x19')](function(_0x3f743a){logger[_0x43c9('0x33')](_0x3f743a);_0x49635c(null,![]);});};AGIVertices[_0x43c9('0x13')][_0x43c9('0x5d')]=function(_0x9c973e,_0x5cbf81){sh[_0x43c9('0x5e')](_[_0x43c9('0x5f')](_0x9c973e),function(_0x5b00f5,_0x28a9af){var _0x16ce92=_0x28a9af[_0x43c9('0x60')](/(\r\n|\n|\r)/gm,'');_0x5cbf81(null,_0x16ce92);});};AGIVertices[_0x43c9('0x13')][_0x43c9('0x61')]=function(_0x85d3f6,_0x6551fd){scripts[_0x43c9('0x61')](_0x85d3f6['apiKey'],_0x85d3f6[_0x43c9('0x62')]||_0x43c9('0x63'),_0x85d3f6[_0x43c9('0x63')],_0x85d3f6['languageCode']||'en-US',_0x85d3f6['ssmlGender']||_0x43c9('0x64'),_0x85d3f6[_0x43c9('0x65')]||'MP3')[_0x43c9('0x17')](function(_0x526360){_0x6551fd(null,_0x526360);})[_0x43c9('0x19')](function(_0x1bfe9d){_0x6551fd(_0x1bfe9d);});};AGIVertices[_0x43c9('0x13')][_0x43c9('0x66')]=function(_0x27900f,_0x29540b){scripts[_0x43c9('0x66')](_0x27900f[_0x43c9('0x63')],_0x27900f['google_tts_language']||'en',0x1)[_0x43c9('0x17')](function(_0x79934e){_0x29540b(null,_0x79934e);})[_0x43c9('0x19')](function(_0x4d2a19){_0x29540b(_0x4d2a19);});};AGIVertices[_0x43c9('0x13')]['restAPI']=function(_0x566b51,_0x3df13b){var _0x40151f={'uri':_0x566b51['url'],'method':_0x566b51[_0x43c9('0x67')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x566b51['timeout'])==='number'&&parseInt(_0x566b51[_0x43c9('0x68')])>=0x1?parseInt(_0x566b51['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x43c9('0x69')]([_0x43c9('0x6a'),'PUT'],_0x40151f[_0x43c9('0x67')]['toUpperCase']())){try{_0x40151f[_0x43c9('0x6b')]=_0x566b51[_0x43c9('0xd')]?JSON['parse'](_0x566b51['rawBody']):{};}catch(_0x5a4d1b){logger[_0x43c9('0x33')](_0x43c9('0x6c'),_0x5a4d1b);}}try{_0x40151f[_0x43c9('0x6d')]=_0x566b51[_0x43c9('0xc')]?JSON[_0x43c9('0x6e')](_0x566b51['rawHeaders']):{};}catch(_0x1e930f){logger['error']('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x1e930f);}if(_0x566b51['computedVariables']){try{var _0x3e23e0=require(_0x566b51[_0x43c9('0x6f')])[_0x43c9('0x70')](this,_0x40151f);_0x40151f[_0x43c9('0x71')]=Mustache[_0x43c9('0x72')](_0x566b51[_0x43c9('0x73')],_0x3e23e0,{},['$$','$$']);if(_0x40151f[_0x43c9('0x6d')]){_0x40151f['headers']=JSON['parse'](Mustache[_0x43c9('0x72')](JSON[_0x43c9('0x74')](_0x40151f[_0x43c9('0x6d')]),_0x3e23e0,{},['$$','$$']));}if(_0x40151f[_0x43c9('0x6b')]){_0x40151f[_0x43c9('0x6b')]=JSON[_0x43c9('0x6e')](Mustache[_0x43c9('0x72')](JSON[_0x43c9('0x74')](_0x40151f[_0x43c9('0x6b')]),_0x3e23e0,{},['$$','$$']));}}catch(_0x341f60){logger[_0x43c9('0x33')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x341f60);}}rp(_0x40151f)[_0x43c9('0x17')](function(_0x1db11e){var _0x1cb3a3={'statusCode':_0x1db11e['statusCode']||0xc8,'statusMessage':_0x1db11e[_0x43c9('0x75')]||'OK','headers':_0x1db11e[_0x43c9('0x6d')]||{},'body':_0x1db11e[_0x43c9('0x6b')]||{}};_0x3df13b(null,_0x1cb3a3);})['catch'](function(_0x1058b6){var _0x373d05={'statusCode':_0x1058b6[_0x43c9('0x76')]||0x1f4,'statusMessage':_0x1058b6[_0x43c9('0x77')]||_0x43c9('0x78'),'headers':_0x1058b6[_0x43c9('0x79')][_0x43c9('0x6d')]||{},'body':_0x1058b6['options'][_0x43c9('0x6b')]||{}};_0x3df13b(null,_0x373d05);});};AGIVertices['prototype']['googleDialogflow']=function(_0x3a99c7,_0x5e5cc2){scripts[_0x43c9('0x7a')](this[_0x43c9('0x11')][_0x43c9('0x3f')],_0x3a99c7['key'],_0x3a99c7[_0x43c9('0x63')],_0x3a99c7['dialogflow_language']||'en')[_0x43c9('0x17')](function(_0x28b907){_0x5e5cc2(null,_0x28b907);})[_0x43c9('0x19')](function(_0x2bfc87){_0x5e5cc2(_0x2bfc87);});};AGIVertices[_0x43c9('0x13')][_0x43c9('0x7b')]=function(_0x28e816,_0x1ecfbe){scripts[_0x43c9('0x7b')](this[_0x43c9('0x11')][_0x43c9('0x3f')],_0x28e816[_0x43c9('0x7c')],_0x28e816[_0x43c9('0x7d')],_0x28e816[_0x43c9('0x7e')],_0x28e816[_0x43c9('0x63')],_0x28e816[_0x43c9('0x7f')]||'en')[_0x43c9('0x17')](function(_0x13deef){_0x1ecfbe(null,_0x13deef);})[_0x43c9('0x19')](function(_0xd61d2b){_0x1ecfbe(_0xd61d2b);});};AGIVertices[_0x43c9('0x13')][_0x43c9('0x80')]=function(_0x1f67cc,_0x8f3482){scripts[_0x43c9('0x80')](this[_0x43c9('0x11')],_0x1f67cc)[_0x43c9('0x17')](function(_0x1d9f1a){_0x8f3482(null,_0x1d9f1a);})[_0x43c9('0x19')](function(_0x3e1557){_0x8f3482(_0x3e1557);});};AGIVertices[_0x43c9('0x13')][_0x43c9('0x81')]=function(_0x4110c3,_0x15eb1e){scripts[_0x43c9('0x81')](_0x4110c3[_0x43c9('0x82')],_0x4110c3[_0x43c9('0x63')],_0x4110c3[_0x43c9('0x83')]||_0x43c9('0x84'),_0x4110c3[_0x43c9('0x85')])[_0x43c9('0x17')](function(_0x1e1402){_0x15eb1e(null,_0x1e1402);})[_0x43c9('0x19')](function(_0x3e9eb1){_0x15eb1e(_0x3e9eb1);});};AGIVertices[_0x43c9('0x13')][_0x43c9('0x86')]=function(_0x21011d,_0x14cb0c,_0x10522e){scripts['ispeechASR'](_0x14cb0c,_0x21011d[_0x43c9('0x82')],_0x21011d[_0x43c9('0x87')]||_0x43c9('0x84'),this[_0x43c9('0x88')](_0x21011d[_0x43c9('0x89')])?_0x21011d[_0x43c9('0x89')]:undefined)['then'](function(_0x296d48){_0x10522e(null,_0x296d48);})['catch'](function(_0x2d0ead){_0x10522e(_0x2d0ead);});};AGIVertices[_0x43c9('0x13')][_0x43c9('0x8a')]=function(_0x10f6f8,_0x36e8e5){scripts[_0x43c9('0x8a')](_0x10f6f8['aws_access_key_id'],_0x10f6f8[_0x43c9('0x8b')],_0x10f6f8[_0x43c9('0x8c')],_0x10f6f8[_0x43c9('0x8d')]||_0x43c9('0x8e'),_0x10f6f8[_0x43c9('0x63')],_0x10f6f8[_0x43c9('0x8f')]||_0x43c9('0x63'))[_0x43c9('0x17')](function(_0x345593){_0x36e8e5(null,_0x345593);})[_0x43c9('0x19')](function(_0x1a210c){_0x36e8e5(_0x1a210c);});};AGIVertices[_0x43c9('0x13')][_0x43c9('0x90')]=function(_0x813549,_0x505d6b){scripts['awsLex'](this[_0x43c9('0x11')][_0x43c9('0x3f')],_0x813549[_0x43c9('0x91')],_0x813549['aws_secret_access_key'],_0x813549[_0x43c9('0x92')],_0x813549[_0x43c9('0x63')],_0x813549[_0x43c9('0x93')])['then'](function(_0x3c3c4f){_0x505d6b(null,_0x3c3c4f);})['catch'](function(_0x1a23f4){_0x505d6b(_0x1a23f4);});};AGIVertices[_0x43c9('0x13')][_0x43c9('0x94')]=function(_0x1884c0,_0x41adea,_0x209670){scripts[_0x43c9('0x94')](_0x41adea,_0x1884c0[_0x43c9('0x82')],_0x1884c0['google_asr_language']||_0x43c9('0x84'))[_0x43c9('0x17')](function(_0x4a69cf){_0x209670(null,_0x4a69cf);})['catch'](function(_0x53dfd1){_0x209670(_0x53dfd1);});};AGIVertices[_0x43c9('0x13')][_0x43c9('0x95')]=function(_0x3b52e4,_0x49bd0a,_0x1d4c49){scripts[_0x43c9('0x95')](_0x49bd0a,_0x3b52e4[_0x43c9('0x96')],_0x3b52e4[_0x43c9('0x97')],_0x3b52e4[_0x43c9('0x71')])['then'](function(_0x3ceb38){_0x1d4c49(null,_0x3ceb38);})[_0x43c9('0x19')](function(_0x5ce23a){_0x1d4c49(_0x5ce23a);});};AGIVertices[_0x43c9('0x13')][_0x43c9('0x98')]=function(_0x5d5987){var _0x41348f=_[_0x43c9('0x69')](verticesWithRetry,_0x5d5987[_0x43c9('0x41')])?_0x5d5987:_[_0x43c9('0x99')](_0x5d5987);for(var _0x2fcca2 in _0x41348f){if(_0x41348f[_0x43c9('0x9a')](_0x2fcca2)){if(_0x41348f[_0x2fcca2]&&_[_0x43c9('0x9b')](_0x41348f[_0x2fcca2])){if(_[_0x43c9('0x69')](recursiveMapAttributes,_0x2fcca2)){_0x41348f[_0x2fcca2]=this[_0x43c9('0x9c')](_0x41348f[_0x2fcca2]);}else{_0x41348f[_0x2fcca2]=this[_0x43c9('0x9d')](_0x41348f[_0x2fcca2]);}}}}return _0x41348f;};AGIVertices[_0x43c9('0x13')][_0x43c9('0x9e')]=function(_0x2772db){for(var _0x529593 in _0x2772db){if(_0x2772db[_0x43c9('0x9a')](_0x529593)){if(_[_0x43c9('0x9f')](_0x2772db[_0x529593])){this[_0x43c9('0x9e')](_0x2772db[_0x529593]);}else if(_['isArray'](_0x2772db[_0x529593])){for(var _0x55e332=0x0;_0x55e332<_0x2772db[_0x529593][_0x43c9('0xa0')];_0x55e332++){this['recursiveNodeIndex'](_0x2772db[_0x529593][_0x55e332]);}}else if(_[_0x43c9('0x9b')](_0x2772db[_0x529593])){_0x2772db[_0x529593]=this[_0x43c9('0x9d')](_0x2772db[_0x529593]);}}}};AGIVertices[_0x43c9('0x13')]['saveRestApiResult']=function(_0x496840,_0x5555ad){for(var _0x4bce95 in _0x496840){if(_0x496840[_0x43c9('0x9a')](_0x4bce95)){if(_[_0x43c9('0x9f')](_0x496840[_0x4bce95])){if(!_['isEmpty'](_0x496840[_0x4bce95])){this[_0x43c9('0xa1')](_0x496840[_0x4bce95],util[_0x43c9('0x2f')](_0x43c9('0xa2'),_0x5555ad,_0x4bce95));}}else if(_['isArray'](_0x496840[_0x4bce95])){for(var _0xbae8d0=0x0;_0xbae8d0<_0x496840[_0x4bce95]['length'];_0xbae8d0++){this['saveRestApiResult'](_0x496840[_0x4bce95][_0xbae8d0],util[_0x43c9('0x2f')](_0x43c9('0xa2'),_0x5555ad,_0x4bce95+'['+_0xbae8d0+']'));}}else{if(!_['isNil'](_0x496840[_0x4bce95])){this[_0x43c9('0x11')][_0x43c9('0xa3')](util[_0x43c9('0x2f')](_0x43c9('0xa2'),_0x5555ad,_0x4bce95),_0x496840[_0x4bce95]);}}}}};AGIVertices[_0x43c9('0x13')][_0x43c9('0x9c')]=function(_0x4707cc){try{var _0x540cf3=JSON[_0x43c9('0x6e')](_0x4707cc);this[_0x43c9('0x9e')](_0x540cf3);return JSON['stringify'](_0x540cf3);}catch(_0x57fa47){return this[_0x43c9('0x9d')](_0x4707cc);}};AGIVertices['prototype'][_0x43c9('0x9d')]=function(_0x48a18f){var _0x7e5beb=_0x48a18f[_0x43c9('0xa4')]('{');for(var _0x5dbf8d=0x1;_0x5dbf8d<_0x7e5beb['length'];_0x5dbf8d+=0x1){var _0x432fff=_0x7e5beb[_0x5dbf8d][_0x43c9('0xa4')]('}');if(_0x432fff[_0x43c9('0xa0')]>0x1){_0x48a18f=_0x48a18f[_0x43c9('0xa5')]('{'+_0x432fff[0x0]+'}',this[_0x43c9('0x11')][_0x43c9('0x14')](_0x432fff[0x0])[_0x43c9('0xa6')]||_0x432fff[0x0]);}}if(_0x7e5beb[_0x43c9('0xa0')]===0x1){return _0x48a18f[_0x43c9('0x54')]();}return this[_0x43c9('0x9d')](_0x48a18f);};AGIVertices['prototype'][_0x43c9('0xa7')]=function(_0x547578,_0xffbefb){var _0x5697c3=this[_0x43c9('0x11')][_0x43c9('0x14')](_0x547578);if(_0x5697c3[_0x43c9('0xa8')]===-0x1){return _0x5697c3;}logger[_0x43c9('0x35')](util['format'](_0x43c9('0xa9'),_0xffbefb,_0x5697c3[_0x43c9('0xa6')]));return this[_0x43c9('0x11')][_0x43c9('0xa3')](_0xffbefb,_0x5697c3[_0x43c9('0xa6')]);};AGIVertices[_0x43c9('0x13')][_0x43c9('0x88')]=function(_0x50a00e){return _0x50a00e&&_0x50a00e!=='0'&&_0x50a00e!=='-1'&&_0x50a00e!=='';};AGIVertices[_0x43c9('0x13')]['maxRetry']=function(_0x7ea24b){this['createSquareDetailsReport'][_0x43c9('0x70')](this,_0x7ea24b,'-');_0x7ea24b[_0x43c9('0xaa')]=_0x7ea24b['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x43c9('0x13')][_0x43c9('0xab')]=function(_0x12157d){logger['info'](util[_0x43c9('0x2f')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x12157d[_0x43c9('0x40')]));if(!this['isConfigured'](_0x12157d[_0x43c9('0x63')])){return this[_0x43c9('0x11')][_0x43c9('0xac')](_0x43c9('0xad'));}var _0x94966d='\x22'+_0x12157d[_0x43c9('0x63')]+'\x22';if(this['isConfigured'](_0x12157d[_0x43c9('0x79')])){_0x94966d+=','+_0x12157d[_0x43c9('0x79')];}var _0x56bc3d=this['channel'][_0x43c9('0x5e')](_0x43c9('0xae'),_0x94966d);if(_0x56bc3d[_0x43c9('0xa8')]===-0x1){return _0x56bc3d;}return this[_0x43c9('0x11')][_0x43c9('0xac')](util[_0x43c9('0x2f')](_0x43c9('0xaf'),_0x94966d));};AGIVertices[_0x43c9('0x13')]['mrcprecog']=function(_0x19d2e2){logger[_0x43c9('0x35')](util[_0x43c9('0x2f')](_0x43c9('0xb0'),_0x19d2e2['label']));if(!this['isConfigured'](_0x19d2e2['grammar'])){return this[_0x43c9('0x11')]['noop'](_0x43c9('0xb1'));}var _0x461ad9=_0x19d2e2['grammar'];if(this[_0x43c9('0x88')](_0x19d2e2[_0x43c9('0x79')])){_0x461ad9+=','+_0x19d2e2[_0x43c9('0x79')];}var _0x1ef01b=this[_0x43c9('0x11')][_0x43c9('0x5e')](_0x43c9('0xb2'),_0x461ad9);if(_0x1ef01b['result']===-0x1){return _0x1ef01b;}var _0x3d5f9a=this[_0x43c9('0xa7')](_0x43c9('0xb3'),_0x43c9('0xb4'));if(_0x3d5f9a['result']===-0x1){return _0x3d5f9a;}var _0x380859=this[_0x43c9('0xa7')]('RECOG_INPUT()',_0x43c9('0xb5'));if(_0x380859[_0x43c9('0xa8')]===-0x1){return _0x380859;}var _0x20857b=this[_0x43c9('0xa7')](_0x43c9('0xb6'),_0x43c9('0xb7'));if(_0x20857b[_0x43c9('0xa8')]===-0x1){return _0x20857b;}return this[_0x43c9('0x11')][_0x43c9('0xac')](util[_0x43c9('0x2f')]('Executed\x20command\x20MRCPRecog\x20%s',_0x461ad9));};AGIVertices[_0x43c9('0x13')][_0x43c9('0x9')]=function(_0x52317a){logger[_0x43c9('0x35')](util[_0x43c9('0x2f')](_0x43c9('0xb8'),_0x52317a[_0x43c9('0x40')]));return this[_0x43c9('0x11')][_0x43c9('0x9')]([_0x52317a[_0x43c9('0xb9')],_0x52317a[_0x43c9('0xba')]]);};AGIVertices[_0x43c9('0x13')][_0x43c9('0xbb')]=function(_0x232f01){logger[_0x43c9('0x35')](util[_0x43c9('0x2f')](_0x43c9('0xbc'),_0x232f01['label']));if(this[_0x43c9('0x88')](_0x232f01['timeout'])){logger[_0x43c9('0x35')](util[_0x43c9('0x2f')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x232f01[_0x43c9('0x68')]));var _0x132e9d=this[_0x43c9('0x11')][_0x43c9('0xbd')](_0x232f01[_0x43c9('0x68')]);if(_0x132e9d[_0x43c9('0xa8')]===-0x1){return _0x132e9d;}}return this[_0x43c9('0x11')][_0x43c9('0xbb')]();};AGIVertices[_0x43c9('0x13')]['callback']=function(_0x6eec7a){logger[_0x43c9('0x35')](util[_0x43c9('0x2f')](_0x43c9('0xbe'),_0x6eec7a[_0x43c9('0x40')]));if(!this[_0x43c9('0x88')](_0x6eec7a[_0x43c9('0xbf')])){return this[_0x43c9('0x11')][_0x43c9('0x33')](_0x6eec7a,_0x43c9('0xc0'));}_0x6eec7a[_0x43c9('0x51')]=moment();if(this[_0x43c9('0x88')](_0x6eec7a[_0x43c9('0xc1')])){_0x6eec7a[_0x43c9('0x51')]=moment()['add'](_0x6eec7a[_0x43c9('0xc1')],_0x43c9('0xc2'));}if(!this[_0x43c9('0x88')](_0x6eec7a[_0x43c9('0x55')])){_0x6eec7a[_0x43c9('0x55')]=0x2;}this[_0x43c9('0x4c')][_0x43c9('0x70')](this,_0x6eec7a);return this[_0x43c9('0x11')][_0x43c9('0xac')](util['format'](_0x43c9('0xc3'),_0x6eec7a[_0x43c9('0xc4')],_0x6eec7a[_0x43c9('0xbf')],_0x6eec7a[_0x43c9('0x51')]));};AGIVertices[_0x43c9('0x13')]['custom_app']=function(_0x5b3587){logger['info'](util[_0x43c9('0x2f')](_0x43c9('0xc5'),_0x5b3587['label']));var _0x3ba284=this[_0x43c9('0x11')][_0x43c9('0x5e')](_0x5b3587[_0x43c9('0xc6')],_0x5b3587[_0x43c9('0x79')]);if(_0x3ba284[_0x43c9('0xa8')]===-0x1){return _0x3ba284;}return this['channel'][_0x43c9('0xac')](util[_0x43c9('0x2f')](_0x43c9('0xc7'),_0x5b3587[_0x43c9('0xc6')],_0x5b3587[_0x43c9('0x79')]));};AGIVertices[_0x43c9('0x13')]['lumenvoxtts']=function(_0x3d1b8b){logger[_0x43c9('0x35')](util[_0x43c9('0x2f')](_0x43c9('0xc8'),_0x3d1b8b[_0x43c9('0x40')]));if(!this[_0x43c9('0x88')](_0x3d1b8b[_0x43c9('0x63')])){return this['channel'][_0x43c9('0xac')]('no\x20text\x20configured');}var _0x4c9e8a='\x22'+_0x3d1b8b[_0x43c9('0x63')]+'\x22';if(this[_0x43c9('0x88')](_0x3d1b8b[_0x43c9('0x79')])){_0x4c9e8a+=','+_0x3d1b8b[_0x43c9('0x79')];}var _0xa6bd14=this[_0x43c9('0x11')]['exec']('MRCPSynth',_0x4c9e8a);if(_0xa6bd14[_0x43c9('0xa8')]===-0x1){return _0xa6bd14;}return this['channel']['noop'](util['format'](_0x43c9('0xaf'),_0x4c9e8a));};AGIVertices['prototype'][_0x43c9('0xc9')]=function(_0x3cf418){logger[_0x43c9('0x35')](util[_0x43c9('0x2f')](_0x43c9('0xca'),_0x3cf418[_0x43c9('0x40')]));if(!this[_0x43c9('0x88')](_0x3cf418[_0x43c9('0x63')])){return this[_0x43c9('0x11')][_0x43c9('0xac')](_0x43c9('0xad'));}var _0x211c7c='\x22'+_0x3cf418[_0x43c9('0x63')]+'\x22';if(this[_0x43c9('0x88')](_0x3cf418[_0x43c9('0x79')])){_0x211c7c+=','+_0x3cf418['options'];}var _0x17e536=this[_0x43c9('0x11')][_0x43c9('0x5e')](_0x43c9('0xae'),_0x211c7c);if(_0x17e536[_0x43c9('0xa8')]===-0x1){return _0x17e536;}return this[_0x43c9('0x11')][_0x43c9('0xac')](util[_0x43c9('0x2f')](_0x43c9('0xaf'),_0x211c7c));};AGIVertices['prototype'][_0x43c9('0xcb')]=function(_0x19a349){logger[_0x43c9('0x35')](util[_0x43c9('0x2f')](_0x43c9('0xcc'),_0x19a349[_0x43c9('0x40')]));if(!this[_0x43c9('0x88')](_0x19a349['grammar'])){return this['channel'][_0x43c9('0xac')](_0x43c9('0xb1'));}var _0x4df281=_0x19a349[_0x43c9('0xcd')];if(this[_0x43c9('0x88')](_0x19a349[_0x43c9('0x79')])){_0x4df281+=','+_0x19a349[_0x43c9('0x79')];}var _0x295f9c=this[_0x43c9('0x11')][_0x43c9('0x5e')](_0x43c9('0xb2'),_0x4df281);if(_0x295f9c[_0x43c9('0xa8')]===-0x1){return _0x295f9c;}var _0xabbc1e=this[_0x43c9('0xa7')](_0x43c9('0xb3'),_0x43c9('0xce'));if(_0xabbc1e[_0x43c9('0xa8')]===-0x1){return _0xabbc1e;}var _0x8c6f0e=this[_0x43c9('0xa7')](_0x43c9('0xcf'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x8c6f0e[_0x43c9('0xa8')]===-0x1){return _0x8c6f0e;}var _0x94b2c6=this[_0x43c9('0xa7')]('RECOG_INSTANCE()',_0x43c9('0xd0'));if(_0x94b2c6[_0x43c9('0xa8')]===-0x1){return _0x94b2c6;}return this[_0x43c9('0x11')][_0x43c9('0xac')](util[_0x43c9('0x2f')](_0x43c9('0xd1'),_0x4df281));};AGIVertices[_0x43c9('0x13')]['sestekasr']=function(_0x39d05d){logger[_0x43c9('0x35')](util[_0x43c9('0x2f')](_0x43c9('0xd2'),_0x39d05d[_0x43c9('0x40')]));if(!this['isConfigured'](_0x39d05d[_0x43c9('0xcd')])){return this[_0x43c9('0x11')][_0x43c9('0xac')](_0x43c9('0xb1'));}var _0x3198dc=_0x39d05d[_0x43c9('0xcd')];if(this['isConfigured'](_0x39d05d[_0x43c9('0x79')])){_0x3198dc+=','+_0x39d05d[_0x43c9('0x79')];}var _0x11577b=this[_0x43c9('0x11')][_0x43c9('0x5e')](_0x43c9('0xb2'),_0x3198dc);if(_0x11577b['result']===-0x1){return _0x11577b;}var _0x398e85=this[_0x43c9('0xa7')](_0x43c9('0xb3'),_0x43c9('0xd3'));if(_0x398e85[_0x43c9('0xa8')]===-0x1){return _0x398e85;}var _0x1bd8db=this[_0x43c9('0xa7')]('RECOG_INPUT()',_0x43c9('0xd4'));if(_0x1bd8db[_0x43c9('0xa8')]===-0x1){return _0x1bd8db;}var _0x1d58f2=this[_0x43c9('0xa7')](_0x43c9('0xb6'),_0x43c9('0xd5'));if(_0x1d58f2[_0x43c9('0xa8')]===-0x1){return _0x1d58f2;}return this[_0x43c9('0x11')][_0x43c9('0xac')](util[_0x43c9('0x2f')](_0x43c9('0xd1'),_0x3198dc));};AGIVertices[_0x43c9('0x13')][_0x43c9('0xd6')]=function(_0x5cd9d0){logger[_0x43c9('0x35')](util['format'](_0x43c9('0xd7'),_0x5cd9d0[_0x43c9('0x40')]));if(!this[_0x43c9('0x88')](_0x5cd9d0[_0x43c9('0xd8')])){return this[_0x43c9('0x11')][_0x43c9('0x33')](_0x5cd9d0,_0x43c9('0xd9'));}var _0x48bbb5=this[_0x43c9('0x1c')][_0x43c9('0x70')](this,_0x5cd9d0[_0x43c9('0xd8')]);if(!_0x48bbb5){return this['channel'][_0x43c9('0x33')](_0x5cd9d0,_0x43c9('0xda'));}if(!this[_0x43c9('0x88')](_0x5cd9d0[_0x43c9('0x37')])){return this[_0x43c9('0x11')][_0x43c9('0x33')](_0x5cd9d0,_0x43c9('0xdb'));}var _0x21509a=_0x5cd9d0[_0x43c9('0x37')][_0x43c9('0x60')](/(\r\n|\n|\r)/gm,'\x20');this[_0x43c9('0x11')][_0x43c9('0xac')](util[_0x43c9('0x2f')](_0x43c9('0xdc'),_0x21509a));var _0x3c1b51=this['getQueryOdbc'][_0x43c9('0x70')](this,_0x48bbb5,_0x21509a);this[_0x43c9('0x3e')][_0x43c9('0x70')](this,_0x5cd9d0,_0x21509a);if(!this[_0x43c9('0x88')](_0x5cd9d0[_0x43c9('0xdd')])){return this[_0x43c9('0x11')][_0x43c9('0xac')](_0x43c9('0xde'));}var _0x4b003c=this[_0x43c9('0x14')][_0x43c9('0x70')](this,_0x5cd9d0['variable_id']);if(!_0x4b003c){return this[_0x43c9('0x11')][_0x43c9('0x33')](_0x5cd9d0,'no\x20variable\x20found');}var _0x513f34=this;_0x3c1b51['forEach'](function(_0x556f0a,_0xb6bdfe){Object[_0x43c9('0xdf')](_0x556f0a)[_0x43c9('0xe0')](function(_0x354801){_0x513f34[_0x43c9('0x11')][_0x43c9('0xa3')](util[_0x43c9('0x2f')]('%s[%s][%s]',_0x4b003c,_0xb6bdfe,_0x354801),_0x556f0a[_0x354801]);});});this[_0x43c9('0x11')][_0x43c9('0xa3')](util[_0x43c9('0x2f')](_0x43c9('0xe1'),_0x4b003c),_0x3c1b51['length']);return this[_0x43c9('0x11')][_0x43c9('0xac')](util[_0x43c9('0x2f')]('variable\x20%s\x20set',_0x4b003c));};AGIVertices[_0x43c9('0x13')][_0x43c9('0xe2')]=function(_0x4b96f3){logger[_0x43c9('0xe3')](util[_0x43c9('0x2f')](_0x43c9('0xe4'),_0x4b96f3[_0x43c9('0x40')]));if(!this[_0x43c9('0x88')](_0x4b96f3['sip_id'])){return this[_0x43c9('0x11')][_0x43c9('0x33')](_0x4b96f3,_0x43c9('0xe5'));}var _0x171c84=this[_0x43c9('0x1f')]['sync'](this,_0x4b96f3[_0x43c9('0xe6')]);if(!_0x171c84){return this['channel'][_0x43c9('0x33')](_0x4b96f3,_0x43c9('0xe7'));}var _0x1f9006=this[_0x43c9('0x11')][_0x43c9('0x5e')](_0x43c9('0xe8'),[util[_0x43c9('0x2f')](_0x43c9('0xe9'),_0x171c84),_0x4b96f3[_0x43c9('0x68')],_0x4b96f3[_0x43c9('0xea')],_0x4b96f3[_0x43c9('0x73')]]);if(_0x1f9006['result']===-0x1){return _0x1f9006;}return this[_0x43c9('0x11')]['noop'](util[_0x43c9('0x2f')]('Executed\x20command\x20%s',_0x43c9('0xe8')));};AGIVertices['prototype']['dialogflow']=function(_0x58309d){logger[_0x43c9('0x35')](util[_0x43c9('0x2f')](_0x43c9('0xeb'),_0x58309d['label']));if(!this[_0x43c9('0x88')](_0x58309d['key'])){return this[_0x43c9('0x11')][_0x43c9('0xac')](_0x43c9('0xec'));}if(!this[_0x43c9('0x88')](_0x58309d[_0x43c9('0x63')])){return this['channel'][_0x43c9('0xac')]('no\x20text\x20configured');}this[_0x43c9('0x11')][_0x43c9('0xed')]=!![];this[_0x43c9('0x3e')](_0x58309d);this[_0x43c9('0x4b')](_0x58309d[_0x43c9('0x63')],'in','','');this[_0x43c9('0x11')][_0x43c9('0xac')](util['format'](_0x43c9('0xee'),_0x58309d[_0x43c9('0x63')]));var _0x4303b6=this['googleDialogflow'][_0x43c9('0x70')](this,_0x58309d);if(_0x4303b6){for(var _0x10e9a1 in _0x4303b6){if(_0x4303b6[_0x43c9('0x9a')](_0x10e9a1)){this[_0x43c9('0x11')][_0x43c9('0xa3')](util[_0x43c9('0x2f')]('DIALOGFLOW_%s',_0x10e9a1[_0x43c9('0xef')]()),_0x4303b6[_0x10e9a1]);}}this[_0x43c9('0x4b')](_0x4303b6['speech'],_0x43c9('0xf0'),'dialogflow','');return this[_0x43c9('0x11')]['noop'](util[_0x43c9('0x2f')]('Dialogflow\x20Result\x20%s',_0x4303b6['speech']));}return this[_0x43c9('0x11')][_0x43c9('0x33')](_0x58309d,_0x43c9('0xf1'));};AGIVertices[_0x43c9('0x13')][_0x43c9('0xf2')]=function(_0x31f5a2){logger[_0x43c9('0x35')](util[_0x43c9('0x2f')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x31f5a2[_0x43c9('0x40')]));if(!this['isConfigured'](_0x31f5a2[_0x43c9('0x7c')])){return this[_0x43c9('0x11')][_0x43c9('0xac')](_0x43c9('0xf3'));}if(!this['isConfigured'](_0x31f5a2[_0x43c9('0x7d')])){return this[_0x43c9('0x11')][_0x43c9('0xac')](_0x43c9('0xf4'));}if(!this[_0x43c9('0x88')](_0x31f5a2[_0x43c9('0x7e')])){return this[_0x43c9('0x11')][_0x43c9('0xac')](_0x43c9('0xf5'));}if(!this[_0x43c9('0x88')](_0x31f5a2[_0x43c9('0x7f')])){return this['channel'][_0x43c9('0xac')](_0x43c9('0xf6'));}if(!this[_0x43c9('0x88')](_0x31f5a2['text'])){return this[_0x43c9('0x11')][_0x43c9('0xac')](_0x43c9('0xad'));}this[_0x43c9('0x11')]['bot']=!![];this[_0x43c9('0x3e')](_0x31f5a2);this[_0x43c9('0x4b')](_0x31f5a2[_0x43c9('0x63')],'in','','');this[_0x43c9('0x11')]['noop'](util[_0x43c9('0x2f')](_0x43c9('0xf7'),_0x31f5a2['text']));var _0x2bd129=this[_0x43c9('0x7b')]['sync'](this,_0x31f5a2);if(_0x2bd129){for(var _0x33acf1 in _0x2bd129){if(_0x2bd129[_0x43c9('0x9a')](_0x33acf1)){if(_0x33acf1!==_0x43c9('0xf8')){this[_0x43c9('0x11')]['setVariable'](util['format'](_0x43c9('0xf9'),_0x33acf1[_0x43c9('0xef')]()),_0x2bd129[_0x33acf1]);}}}this[_0x43c9('0x4b')](_0x2bd129['speech'],_0x43c9('0xf0'),_0x43c9('0xf2'),_0x2bd129['providerResponse']);return this[_0x43c9('0x11')][_0x43c9('0xac')](util[_0x43c9('0x2f')](_0x43c9('0xfa'),_0x2bd129['speech']));}return this['channel'][_0x43c9('0x33')](_0x31f5a2,_0x43c9('0xfb'));};AGIVertices['prototype']['sesteknda']=function(_0x292038){logger['info'](util[_0x43c9('0x2f')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x292038[_0x43c9('0x40')]));if(!this[_0x43c9('0x88')](_0x292038[_0x43c9('0xfc')])){return this[_0x43c9('0x11')]['noop'](_0x43c9('0xfd'));}if(!this[_0x43c9('0x88')](_0x292038['username'])){return this['channel']['noop']('no\x20username\x20configured');}if(!this[_0x43c9('0x88')](_0x292038['password'])){return this[_0x43c9('0x11')][_0x43c9('0xac')](_0x43c9('0xfe'));}if(!this[_0x43c9('0x88')](_0x292038[_0x43c9('0xff')])){return this['channel'][_0x43c9('0xac')](_0x43c9('0xad'));}this['channel'][_0x43c9('0xed')]=!![];this[_0x43c9('0x3e')](_0x292038);this[_0x43c9('0x4b')](_0x292038[_0x43c9('0x63')],'in','','');this[_0x43c9('0x11')][_0x43c9('0xac')](util[_0x43c9('0x2f')](_0x43c9('0x100'),_0x292038[_0x43c9('0x63')]));var _0x1947c0=this['sestekNDA'][_0x43c9('0x70')](this,_0x292038);if(_0x1947c0){for(var _0x3614ea in _0x1947c0){if(_0x1947c0['hasOwnProperty'](_0x3614ea)){this[_0x43c9('0x11')][_0x43c9('0xa3')](util['format']('SESTEK_NDA_%s',_0x3614ea[_0x43c9('0xef')]()),_0x1947c0[_0x3614ea]);}}this[_0x43c9('0x4b')](_0x1947c0[_0x43c9('0x101')],'out',_0x43c9('0x102'),'');if(_0x1947c0[_0x43c9('0x103')]){this[_0x43c9('0x11')][_0x43c9('0xac')](util[_0x43c9('0x2f')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x1947c0[_0x43c9('0x103')]));var _0x425cbf=this[_0x43c9('0x11')][_0x43c9('0x104')](_0x1947c0['audiofile']);try{fs['unlink'](_0x1947c0[_0x43c9('0x103')]+_0x43c9('0x105'));}catch(_0xd8e0a6){logger[_0x43c9('0x33')](_0xd8e0a6);}return _0x425cbf;}else{return this[_0x43c9('0x11')][_0x43c9('0xac')](util[_0x43c9('0x2f')]('SestekNDA\x20Result\x20%s',_0x1947c0[_0x43c9('0x101')]));}}return this[_0x43c9('0x11')]['error'](_0x292038,_0x43c9('0x106'));};AGIVertices[_0x43c9('0x13')]['end']=function(_0x411dce){logger[_0x43c9('0x35')](util[_0x43c9('0x2f')](_0x43c9('0x107'),_0x411dce[_0x43c9('0x40')]));return this[_0x43c9('0x11')]['noop'](_0x43c9('0x108'));};AGIVertices['prototype'][_0x43c9('0x109')]=function(_0x10af39){logger[_0x43c9('0x35')](util[_0x43c9('0x2f')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x10af39['label']));var _0x8ad6ba='';if(_0x10af39[_0x43c9('0x10a')]){if(!this[_0x43c9('0x88')](_0x10af39[_0x43c9('0x10a')])){return this[_0x43c9('0x11')]['error'](_0x10af39,_0x43c9('0x10b'));}else{var _0x5c9a24=parseInt(_0x10af39[_0x43c9('0x10a')],0xa);if(isNaN(_0x5c9a24)){_0x8ad6ba=_0x10af39[_0x43c9('0x10a')];}else{_0x8ad6ba=this[_0x43c9('0x21')][_0x43c9('0x70')](this,_0x10af39[_0x43c9('0x10a')]);if(!_0x8ad6ba){return this[_0x43c9('0x11')][_0x43c9('0x33')](_0x10af39,_0x43c9('0x10c'));}}}}else if(_0x10af39[_0x43c9('0x10d')]){_0x8ad6ba=_0x10af39[_0x43c9('0x10d')];}else{return this[_0x43c9('0x11')][_0x43c9('0x33')](_0x10af39,_0x43c9('0x10b'));}var _0x2bcba7=this[_0x43c9('0x11')][_0x43c9('0x5e')](_0x43c9('0xe8'),[util[_0x43c9('0x2f')]('SIP/%s/%s',_0x8ad6ba,_0x10af39['phone']),_0x10af39['timeout'],_0x10af39[_0x43c9('0xea')],_0x10af39[_0x43c9('0x73')]]);if(_0x2bcba7[_0x43c9('0xa8')]===-0x1){return _0x2bcba7;}return this['channel'][_0x43c9('0xac')](util[_0x43c9('0x2f')](_0x43c9('0x10e'),_0x43c9('0xe8')));};AGIVertices['prototype']['finally']=function(_0x321c66){logger[_0x43c9('0x35')](util[_0x43c9('0x2f')](_0x43c9('0x10f'),_0x321c66[_0x43c9('0x40')]));return this[_0x43c9('0x11')][_0x43c9('0xac')]('finally');};AGIVertices['prototype'][_0x43c9('0xf')]=function(_0xdf5fd6){logger[_0x43c9('0x35')](util[_0x43c9('0x2f')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0xdf5fd6[_0x43c9('0x40')]));if(_0xdf5fd6[_0x43c9('0xaa')]===0x0){return this[_0x43c9('0x110')](_0xdf5fd6);}_0xdf5fd6[_0x43c9('0xaa')]-=0x1;if(!this['isConfigured'](_0xdf5fd6[_0x43c9('0x111')])){return this[_0x43c9('0x11')]['error'](_0xdf5fd6,_0x43c9('0x112'));}var _0x4870eb=this[_0x43c9('0x23')][_0x43c9('0x70')](this,_0xdf5fd6[_0x43c9('0x111')]);if(!_0x4870eb){return this['channel'][_0x43c9('0x33')](_0xdf5fd6,_0x43c9('0x113'));}if(!this[_0x43c9('0x88')](_0xdf5fd6[_0x43c9('0xdd')])){return this[_0x43c9('0x11')][_0x43c9('0x33')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x1513fc=this[_0x43c9('0x11')][_0x43c9('0x114')](_0x4870eb,_0xdf5fd6[_0x43c9('0x115')],_0xdf5fd6[_0x43c9('0x116')]);var _0x59d091=_0x1513fc[_0x43c9('0xa8')]?_0x1513fc[_0x43c9('0xa8')][_0x43c9('0x54')]():'';logger[_0x43c9('0x35')](_0x43c9('0x117'),JSON[_0x43c9('0x74')](_0x1513fc));if(_0x1513fc['result']===-0x1){this[_0x43c9('0x3e')][_0x43c9('0x70')](this,_0xdf5fd6,_0x59d091);return _0x1513fc;}else if(_0x1513fc[_0x43c9('0xa6')]===_0x43c9('0x68')){_0x1513fc[_0x43c9('0xa8')]=_0x59d091[_0x43c9('0xa0')]>=parseInt(_0xdf5fd6['mindigit'])?'x':'i';}else{_0x1513fc[_0x43c9('0xa8')]=_0x59d091['length']>=parseInt(_0xdf5fd6[_0x43c9('0x118')])&&_0x59d091[_0x43c9('0xa0')]<=parseInt(_0xdf5fd6['maxdigit'])?'x':'i';}var _0x5092e4=this[_0x43c9('0x14')][_0x43c9('0x70')](this,_0xdf5fd6[_0x43c9('0xdd')]);if(!_0x5092e4){return this['channel'][_0x43c9('0x33')](_0xdf5fd6,_0x43c9('0x119'));}this[_0x43c9('0x11')][_0x43c9('0xa3')](_0x5092e4,_0x59d091);if(this[_0x43c9('0x88')](_0xdf5fd6[_0x43c9('0x11a')])){var _0x404836=parseInt(_0xdf5fd6[_0x43c9('0x11a')],0xa);var _0x5ab352=rs[_0x43c9('0x11b')]({'charset':'*','length':_0x404836});var _0x3de3ee=_0x59d091[_0x43c9('0xa0')];if(_0x3de3ee>0x0){if(_0x3de3ee>_0x404836){this[_0x43c9('0x3e')][_0x43c9('0x70')](this,_0xdf5fd6,_0xdf5fd6[_0x43c9('0x11c')]==='first'?_0x5ab352+_0x59d091['substr'](_0x404836):_0x59d091['substr'](0x0,_0x3de3ee-_0x404836)+_0x5ab352);}else{this[_0x43c9('0x3e')][_0x43c9('0x70')](this,_0xdf5fd6,rs[_0x43c9('0x11b')]({'charset':'*','length':_0x3de3ee}));}}else{this[_0x43c9('0x3e')][_0x43c9('0x70')](this,_0xdf5fd6,'');}}else{this[_0x43c9('0x3e')]['sync'](this,_0xdf5fd6,_0x59d091);}return _0x1513fc;};AGIVertices[_0x43c9('0x13')]['getsecretdigits']=function(_0x5bbbed){logger[_0x43c9('0x35')](util[_0x43c9('0x2f')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x5bbbed[_0x43c9('0x40')]));return this['getdigits'](_0x5bbbed);};AGIVertices[_0x43c9('0x13')]['goal']=function(_0x354a24){logger[_0x43c9('0x35')](util[_0x43c9('0x2f')](_0x43c9('0x11d'),_0x354a24[_0x43c9('0x40')]));this[_0x43c9('0x3e')][_0x43c9('0x70')](this,_0x354a24,_0x354a24[_0x43c9('0x11e')]);return this[_0x43c9('0x11')][_0x43c9('0xac')](util[_0x43c9('0x2f')](_0x43c9('0x11f'),_0x354a24['goalname']));};AGIVertices['prototype'][_0x43c9('0x120')]=function(_0x28cc04){logger['info'](util[_0x43c9('0x2f')](_0x43c9('0x121'),_0x28cc04[_0x43c9('0x40')]));if(!this[_0x43c9('0x88')](_0x28cc04[_0x43c9('0x91')])||!this[_0x43c9('0x88')](_0x28cc04[_0x43c9('0x8b')])){return this[_0x43c9('0x11')][_0x43c9('0xac')](_0x43c9('0x122'));}if(!this['isConfigured'](_0x28cc04[_0x43c9('0x63')])){return this[_0x43c9('0x11')][_0x43c9('0xac')](_0x43c9('0xad'));}this[_0x43c9('0x11')][_0x43c9('0xac')](util[_0x43c9('0x2f')]('Trying\x20aws\x20Polly\x20%s',_0x28cc04[_0x43c9('0x63')]));var _0x414d14=this[_0x43c9('0x8a')][_0x43c9('0x70')](this,_0x28cc04);if(_0x414d14){this[_0x43c9('0x11')]['noop'](util[_0x43c9('0x2f')]('aws\x20Polly\x20%s\x20file\x20created',_0x414d14));var _0x5ee70e=this[_0x43c9('0x11')][_0x43c9('0x104')](_0x414d14);try{fs['unlink'](_0x414d14+_0x43c9('0x105'));}catch(_0x3aa8a7){logger['error'](_0x3aa8a7);}return _0x5ee70e;}return this[_0x43c9('0x11')][_0x43c9('0x33')](_0x28cc04,_0x43c9('0x123'));};AGIVertices[_0x43c9('0x13')][_0x43c9('0x124')]=function(_0x5e2226){logger[_0x43c9('0x35')](util['format'](_0x43c9('0x125'),_0x5e2226[_0x43c9('0x40')]));if(!this[_0x43c9('0x88')](_0x5e2226['aws_access_key_id'])||!this[_0x43c9('0x88')](_0x5e2226[_0x43c9('0x8b')])){return this['channel']['noop'](_0x43c9('0x122'));}if(!this['isConfigured'](_0x5e2226[_0x43c9('0x93')])){return this[_0x43c9('0x11')]['noop'](_0x43c9('0x126'));}if(!this[_0x43c9('0x88')](_0x5e2226[_0x43c9('0x63')])){return this['channel'][_0x43c9('0xac')](_0x43c9('0xad'));}this['channel'][_0x43c9('0xed')]=!![];this[_0x43c9('0x3e')](_0x5e2226);this[_0x43c9('0x4b')](_0x5e2226[_0x43c9('0x63')],'in','','');this[_0x43c9('0x11')][_0x43c9('0xac')](util[_0x43c9('0x2f')](_0x43c9('0x127'),_0x5e2226[_0x43c9('0x63')]));var _0x4e4a98=this[_0x43c9('0x90')][_0x43c9('0x70')](this,_0x5e2226);if(_0x4e4a98){for(var _0x1a155e in _0x4e4a98){if(_0x4e4a98[_0x43c9('0x9a')](_0x1a155e)&&_['isString'](_0x4e4a98[_0x1a155e])){this[_0x43c9('0x11')]['setVariable'](util[_0x43c9('0x2f')]('AWS_LEX_%s',_0x1a155e[_0x43c9('0xef')]()),_0x4e4a98[_0x1a155e]);}}if(_['isNil'](_0x4e4a98[_0x43c9('0x77')])){return this[_0x43c9('0x11')][_0x43c9('0xac')](_0x43c9('0x128'));}else{this[_0x43c9('0x4b')](_0x4e4a98['message'],_0x43c9('0xf0'),_0x43c9('0x129'),'');return this[_0x43c9('0x11')]['noop'](util[_0x43c9('0x2f')](_0x43c9('0x12a'),_0x4e4a98[_0x43c9('0x77')]));}}return this[_0x43c9('0x11')]['error'](_0x5e2226,_0x43c9('0x12b'));};AGIVertices['prototype'][_0x43c9('0x12c')]=function(_0x2074c6){logger[_0x43c9('0x35')](util[_0x43c9('0x2f')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x2074c6[_0x43c9('0x40')],_0x2074c6[_0x43c9('0x68')]));if(!this['isConfigured'](_0x2074c6['key'])){return this[_0x43c9('0x11')][_0x43c9('0xac')]('no\x20key\x20configured');}var _0x170c3d=_0x43c9('0x12d');var _0x26a4e7=util[_0x43c9('0x2f')](_0x43c9('0x12e'),FILES_PATH,rs[_0x43c9('0x11b')](0x4));var _0x10a3c2=util['format'](_0x43c9('0xa2'),_0x26a4e7,_0x170c3d);var _0x14dd4c=!![];if(_0x2074c6[_0x43c9('0x12f')]===_0x43c9('0x130')){_0x14dd4c=![];}var _0x5c2489=this[_0x43c9('0x11')][_0x43c9('0x131')](_0x26a4e7,_0x170c3d,_0x2074c6['intKey'],_0x2074c6[_0x43c9('0x68')],undefined,_0x14dd4c);if(_0x5c2489[_0x43c9('0xa8')]!==-0x1){this[_0x43c9('0x11')][_0x43c9('0xac')](util['format'](_0x43c9('0x132'),_0x10a3c2));var _0x1797b3=this[_0x43c9('0x94')][_0x43c9('0x70')](this,_0x2074c6,_0x10a3c2);if(_0x1797b3){for(var _0x2e64ac in _0x1797b3){if(_0x1797b3[_0x43c9('0x9a')](_0x2e64ac)){this[_0x43c9('0x11')][_0x43c9('0xa3')](util[_0x43c9('0x2f')](_0x43c9('0x133'),_0x2e64ac[_0x43c9('0xef')]()),_0x1797b3[_0x2e64ac]);}}return this[_0x43c9('0x11')][_0x43c9('0xac')](util[_0x43c9('0x2f')](_0x43c9('0x134'),JSON['stringify'](_0x1797b3)));}}return _0x5c2489;};AGIVertices[_0x43c9('0x13')][_0x43c9('0x135')]=function(_0x46435d){logger['info'](util[_0x43c9('0x2f')](_0x43c9('0x136'),_0x46435d['label']));if(!this['isConfigured'](_0x46435d[_0x43c9('0x96')])){return this[_0x43c9('0x11')][_0x43c9('0xac')](_0x43c9('0x137'));}if(!this[_0x43c9('0x88')](_0x46435d[_0x43c9('0x97')])){return this[_0x43c9('0x11')][_0x43c9('0xac')](_0x43c9('0x138'));}var _0x5b2fe5=_0x43c9('0x12d');var _0x35c4e7=util['format'](_0x43c9('0x12e'),FILES_PATH,rs[_0x43c9('0x11b')](0x4));var _0x255f2e=util['format'](_0x43c9('0xa2'),_0x35c4e7,_0x5b2fe5);var _0x40317d=!![];if(_0x46435d[_0x43c9('0x12f')]==='NOBEEP'){_0x40317d=![];}var _0x1baa04=this[_0x43c9('0x11')]['recordFile'](_0x35c4e7,_0x5b2fe5,_0x46435d[_0x43c9('0x139')],_0x46435d[_0x43c9('0x68')],undefined,_0x40317d);if(_0x1baa04[_0x43c9('0xa8')]!==-0x1){this[_0x43c9('0x11')][_0x43c9('0xac')](util[_0x43c9('0x2f')](_0x43c9('0x13a'),_0x255f2e));var _0x3f4b4f=this[_0x43c9('0x95')]['sync'](this,_0x46435d,_0x255f2e);if(_0x3f4b4f){for(var _0x2968fa in _0x3f4b4f){if(_0x3f4b4f[_0x43c9('0x9a')](_0x2968fa)){this[_0x43c9('0x11')][_0x43c9('0xa3')](util[_0x43c9('0x2f')](_0x43c9('0x13b'),_0x2968fa['toUpperCase']()),_0x3f4b4f[_0x2968fa]);}}return this['channel'][_0x43c9('0xac')](util[_0x43c9('0x2f')](_0x43c9('0x13c'),JSON[_0x43c9('0x74')](_0x3f4b4f)));}}return _0x1baa04;};AGIVertices[_0x43c9('0x13')][_0x43c9('0x13d')]=function(_0x32ebb0){logger[_0x43c9('0x35')](util[_0x43c9('0x2f')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x32ebb0['label']));return this[_0x43c9('0x11')]['continueAt'](_0x32ebb0[_0x43c9('0x44')],_0x32ebb0[_0x43c9('0x45')],_0x32ebb0[_0x43c9('0x46')]);};AGIVertices[_0x43c9('0x13')][_0x43c9('0x13e')]=function(_0x4f15d4){logger['info'](util[_0x43c9('0x2f')](_0x43c9('0x13f'),_0x4f15d4['label']));if(!this[_0x43c9('0x88')](_0x4f15d4[_0x43c9('0x140')])){return this[_0x43c9('0x11')]['error'](_0x4f15d4,_0x43c9('0x141'));}try{var _0x33d3dc=eval(_0x4f15d4[_0x43c9('0x140')])?_0x43c9('0x142'):_0x43c9('0x143');this['channel'][_0x43c9('0xac')](util[_0x43c9('0x2f')](_0x43c9('0x144'),_0x4f15d4[_0x43c9('0x140')],_0x33d3dc));return{'code':0xc8,'result':_0x33d3dc};}catch(_0x10f9e1){return{'code':0xc8,'result':_0x43c9('0x143')};}};AGIVertices[_0x43c9('0x13')][_0x43c9('0x145')]=function(_0x57bd28){logger[_0x43c9('0x35')](util[_0x43c9('0x2f')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x57bd28[_0x43c9('0x40')]));if(!this[_0x43c9('0x88')](_0x57bd28['interval_id'])){return this['channel'][_0x43c9('0x33')](_0x57bd28,_0x43c9('0x146'));}var _0x366456=this[_0x43c9('0x2a')][_0x43c9('0x70')](this,_0x57bd28['interval_id']);if(!_0x366456){return this[_0x43c9('0x11')][_0x43c9('0x33')](_0x57bd28,_0x43c9('0x147'));}for(var _0x38f9b5=0x0;_0x38f9b5<_0x366456[_0x43c9('0xa0')];_0x38f9b5+=0x1){var _0x402f1b=this[_0x43c9('0x11')]['getVariable'](util[_0x43c9('0x2f')]('IFTIME(%s?true:false)',_0x366456[_0x38f9b5]));if(_0x402f1b['result']===-0x1){return _0x402f1b;}logger['info'](util['format'](_0x43c9('0x148'),_0x366456[_0x38f9b5],_0x402f1b['extra']));if(_0x402f1b[_0x43c9('0xa6')]===_0x43c9('0x142')){logger[_0x43c9('0x35')](util['format'](_0x43c9('0x148'),_0x366456[_0x38f9b5],'true'));this[_0x43c9('0x11')][_0x43c9('0xac')](util[_0x43c9('0x2f')](_0x43c9('0x148'),_0x366456[_0x38f9b5],_0x43c9('0x142')));return{'code':0xc8,'result':'true'};}else{logger[_0x43c9('0x35')](util['format'](_0x43c9('0x148'),_0x366456[_0x38f9b5],_0x43c9('0x143')));this[_0x43c9('0x11')][_0x43c9('0xac')](util['format'](_0x43c9('0x148'),_0x366456[_0x38f9b5],_0x43c9('0x143')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x43c9('0x13')]['hangup']=function(_0x403d1e){logger['info'](util[_0x43c9('0x2f')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x403d1e[_0x43c9('0x40')]));return this[_0x43c9('0x11')]['hangup']();};AGIVertices[_0x43c9('0x13')]['ispeechasr']=function(_0x1ee0c0){logger['info'](util['format']('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x1ee0c0['label']));if(!this[_0x43c9('0x88')](_0x1ee0c0[_0x43c9('0x82')])){return this[_0x43c9('0x11')][_0x43c9('0xac')]('no\x20key\x20configured');}var _0x40ee57=_0x43c9('0x12d');var _0x39290d=util[_0x43c9('0x2f')](_0x43c9('0x12e'),FILES_PATH,rs[_0x43c9('0x11b')](0x4));var _0x2ce0ae=util[_0x43c9('0x2f')](_0x43c9('0xa2'),_0x39290d,_0x40ee57);var _0x46149c=!![];if(_0x1ee0c0[_0x43c9('0x12f')]===_0x43c9('0x130')){_0x46149c=![];}var _0x18cb87=this[_0x43c9('0x11')][_0x43c9('0x131')](_0x39290d,_0x40ee57,_0x1ee0c0[_0x43c9('0x139')],_0x1ee0c0[_0x43c9('0x68')],undefined,_0x46149c);if(_0x18cb87[_0x43c9('0xa8')]!==-0x1){this['channel']['noop'](util['format'](_0x43c9('0x149'),_0x2ce0ae));var _0x2aa8be=this[_0x43c9('0x86')][_0x43c9('0x70')](this,_0x1ee0c0,_0x2ce0ae);if(_0x2aa8be){for(var _0x8f10b2 in _0x2aa8be){if(_0x2aa8be['hasOwnProperty'](_0x8f10b2)){this[_0x43c9('0x11')][_0x43c9('0xa3')](util['format']('ISPEECH_ASR_%s',_0x8f10b2[_0x43c9('0xef')]()),_0x2aa8be[_0x8f10b2]);}}return this[_0x43c9('0x11')][_0x43c9('0xac')](util['format'](_0x43c9('0x14a'),JSON[_0x43c9('0x74')](_0x2aa8be)));}}return _0x18cb87;};AGIVertices[_0x43c9('0x13')]['ispeechtts']=function(_0x4a4b02){logger[_0x43c9('0x35')](util[_0x43c9('0x2f')](_0x43c9('0x14b'),_0x4a4b02[_0x43c9('0x40')]));if(!this[_0x43c9('0x88')](_0x4a4b02[_0x43c9('0x82')])){return this[_0x43c9('0x11')][_0x43c9('0xac')](_0x43c9('0xec'));}if(!this[_0x43c9('0x88')](_0x4a4b02[_0x43c9('0x63')])){return this[_0x43c9('0x11')][_0x43c9('0xac')](_0x43c9('0xad'));}this[_0x43c9('0x11')][_0x43c9('0xac')](util[_0x43c9('0x2f')]('Trying\x20ispeech\x20TTS\x20%s',_0x4a4b02[_0x43c9('0x63')]));var _0x56249d=this[_0x43c9('0x81')][_0x43c9('0x70')](this,_0x4a4b02);if(_0x56249d){this['channel'][_0x43c9('0xac')](util[_0x43c9('0x2f')](_0x43c9('0x149'),_0x56249d));var _0x32ef08=this['channel']['streamFile'](_0x56249d,_0x4a4b02['intKey']);try{fs[_0x43c9('0x14c')](_0x56249d+_0x43c9('0x105'));}catch(_0x5f0069){logger[_0x43c9('0x33')](_0x5f0069);}return _0x32ef08;}return this[_0x43c9('0x11')]['error'](_0x4a4b02,_0x43c9('0x14d'));};AGIVertices[_0x43c9('0x13')][_0x43c9('0x14e')]=function(_0xda555b){logger[_0x43c9('0x35')](util[_0x43c9('0x2f')](_0x43c9('0x14f'),_0xda555b[_0x43c9('0x40')]));if(!this['isConfigured'](_0xda555b['findBy'])){return this[_0x43c9('0x11')][_0x43c9('0x33')](_0xda555b,_0x43c9('0x150'));}logger['info'](util[_0x43c9('0x2f')](_0x43c9('0x151'),this[_0x43c9('0x11')][_0x43c9('0x43')],_0xda555b[_0x43c9('0x152')]));var _0x5b89e9=this[_0x43c9('0x59')]['sync'](this,_0xda555b['findBy']);if(_0x5b89e9){logger[_0x43c9('0x35')](util['format'](_0x43c9('0x153'),this['channel'][_0x43c9('0x43')],_0xda555b[_0x43c9('0x152')]));this['channel'][_0x43c9('0xac')](util[_0x43c9('0x2f')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x43c9('0x43')],_0xda555b[_0x43c9('0x152')]));return{'code':0xc8,'result':_0x43c9('0x154')};}else{logger[_0x43c9('0x35')](util[_0x43c9('0x2f')](_0x43c9('0x155'),this[_0x43c9('0x11')]['callerid'],_0xda555b[_0x43c9('0x152')]));this[_0x43c9('0x11')]['noop'](util[_0x43c9('0x2f')](_0x43c9('0x155'),this[_0x43c9('0x11')]['callerid'],_0xda555b[_0x43c9('0x152')]));return{'code':0xc8,'result':_0x43c9('0x156')};}};AGIVertices[_0x43c9('0x13')][_0x43c9('0x157')]=function(_0x286040){logger[_0x43c9('0x35')](util[_0x43c9('0x2f')](_0x43c9('0x158'),_0x286040[_0x43c9('0x40')]));if(!this[_0x43c9('0x88')](_0x286040[_0x43c9('0x152')])){return this['channel'][_0x43c9('0x33')](_0x286040,_0x43c9('0x150'));}logger[_0x43c9('0x35')](util[_0x43c9('0x2f')](_0x43c9('0x151'),this[_0x43c9('0x11')][_0x43c9('0x43')],_0x286040['findBy']));var _0x5255c0=this['agentLogout'][_0x43c9('0x70')](this,_0x286040[_0x43c9('0x152')]);if(_0x5255c0){logger[_0x43c9('0x35')](util['format'](_0x43c9('0x153'),this[_0x43c9('0x11')][_0x43c9('0x43')],_0x286040['findBy']));this[_0x43c9('0x11')][_0x43c9('0xac')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x43c9('0x11')][_0x43c9('0x43')],_0x286040[_0x43c9('0x152')]));return{'code':0xc8,'result':_0x43c9('0x154')};}else{logger[_0x43c9('0x35')](util[_0x43c9('0x2f')](_0x43c9('0x155'),this['channel'][_0x43c9('0x43')],_0x286040[_0x43c9('0x152')]));this[_0x43c9('0x11')][_0x43c9('0xac')](util['format'](_0x43c9('0x155'),this[_0x43c9('0x11')][_0x43c9('0x43')],_0x286040[_0x43c9('0x152')]));return{'code':0xc8,'result':_0x43c9('0x156')};}};AGIVertices['prototype'][_0x43c9('0x159')]=function(_0x3dcab5){logger['info'](util[_0x43c9('0x2f')](_0x43c9('0x15a'),_0x3dcab5[_0x43c9('0x40')]));if(!this[_0x43c9('0x88')](_0x3dcab5[_0x43c9('0x15b')])){return this[_0x43c9('0x11')][_0x43c9('0x33')](_0x3dcab5,_0x43c9('0x15c'));}this[_0x43c9('0x11')]['noop'](util[_0x43c9('0x2f')](_0x43c9('0x15d'),_0x3dcab5[_0x43c9('0x15b')]));var _0x4bc89c=eval(_0x3dcab5[_0x43c9('0x15b')]);if(!this[_0x43c9('0x88')](_0x3dcab5[_0x43c9('0xdd')])){return this['channel'][_0x43c9('0xac')](_0x43c9('0xde'));}var _0x4dd8d2=this[_0x43c9('0x14')][_0x43c9('0x70')](this,_0x3dcab5[_0x43c9('0xdd')]);if(!_0x4dd8d2){return this[_0x43c9('0x11')][_0x43c9('0x33')](_0x3dcab5,_0x43c9('0x119'));}if(_[_0x43c9('0x15e')](_0x4bc89c)){var _0xb5fb0c=this;_0x4bc89c['forEach'](function(_0x40a178,_0x367086){_0xb5fb0c[_0x43c9('0x11')][_0x43c9('0xa3')](util[_0x43c9('0x2f')]('%s[%s]',_0x4dd8d2,_0x367086),_0x40a178);});return this[_0x43c9('0x11')]['noop'](util['format']('variable\x20%s[key]\x20set',_0x4dd8d2));}else{return this[_0x43c9('0x11')][_0x43c9('0xa3')](_0x4dd8d2,_0x4bc89c);}};AGIVertices['prototype'][_0x43c9('0xe')]=function(_0x382691){logger[_0x43c9('0x35')](util[_0x43c9('0x2f')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x382691[_0x43c9('0x40')]));if(_0x382691[_0x43c9('0xaa')]===0x0){return this[_0x43c9('0x110')](_0x382691);}_0x382691[_0x43c9('0xaa')]-=0x1;if(!this[_0x43c9('0x88')](_0x382691[_0x43c9('0x111')])){return this[_0x43c9('0x11')][_0x43c9('0x33')](_0x382691,_0x43c9('0x112'));}var _0x327e9d=this['getSound'][_0x43c9('0x70')](this,_0x382691[_0x43c9('0x111')]);if(!_0x327e9d){return this['channel'][_0x43c9('0x33')](_0x382691,'no\x20file\x20audio\x20found');}var _0x3270b5=this['channel'][_0x43c9('0x114')](_0x327e9d,_0x382691['response'],_0x382691['digit']);var _0xb7000d=_0x3270b5[_0x43c9('0xa8')];if(_0x3270b5['result']===-0x1){this['createSquareDetailsReport'][_0x43c9('0x70')](this,_0x382691,'-1');return _0x3270b5;}else if(_0x3270b5[_0x43c9('0xa6')]===_0x43c9('0x68')){_0x3270b5[_0x43c9('0xa8')]=_0x3270b5[_0x43c9('0xa8')]['length']>0x0?_0x3270b5[_0x43c9('0xa8')]:'t';}else if(_[_0x43c9('0x4d')](_0x3270b5['result'])){_0x3270b5[_0x43c9('0xa8')]='#';_0xb7000d='#';}if(!this['isConfigured'](_0x382691['variable_id'])){this['channel'][_0x43c9('0xac')](_0x43c9('0xde'));}else{var _0x2463a4=this[_0x43c9('0x14')][_0x43c9('0x70')](this,_0x382691[_0x43c9('0xdd')]);if(!_0x2463a4){return this[_0x43c9('0x11')][_0x43c9('0x33')](_0x382691,_0x43c9('0x119'));}this[_0x43c9('0x11')][_0x43c9('0xa3')](_0x2463a4,_0xb7000d);}this[_0x43c9('0x3e')][_0x43c9('0x70')](this,_0x382691,_0xb7000d);return _0x3270b5;};AGIVertices['prototype'][_0x43c9('0xac')]=function(_0x3b8dfb){logger[_0x43c9('0x35')](util[_0x43c9('0x2f')](_0x43c9('0x15f'),_0x3b8dfb[_0x43c9('0x40')]));return this[_0x43c9('0x11')][_0x43c9('0xac')](_0x3b8dfb[_0x43c9('0x160')]||_0x3b8dfb['label']);};AGIVertices[_0x43c9('0x13')]['pause']=function(_0x306bc2){logger[_0x43c9('0x35')](util['format']('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x306bc2[_0x43c9('0x40')]));if(!this['isConfigured'](_0x306bc2[_0x43c9('0x152')])){return this[_0x43c9('0x11')][_0x43c9('0x33')](_0x306bc2,_0x43c9('0x150'));}logger[_0x43c9('0x35')](util['format'](_0x43c9('0x151'),this[_0x43c9('0x11')][_0x43c9('0x43')],_0x306bc2[_0x43c9('0x152')]));var _0x355dac=this[_0x43c9('0x161')][_0x43c9('0x70')](this,_0x306bc2[_0x43c9('0x162')]);var _0x413235=this[_0x43c9('0x56')][_0x43c9('0x70')](this,_0x306bc2[_0x43c9('0x152')],_0x355dac);if(_0x413235){logger[_0x43c9('0x35')](util[_0x43c9('0x2f')](_0x43c9('0x153'),this[_0x43c9('0x11')][_0x43c9('0x43')],_0x306bc2[_0x43c9('0x152')]));this['channel']['noop'](util['format'](_0x43c9('0x153'),this[_0x43c9('0x11')][_0x43c9('0x43')],_0x306bc2[_0x43c9('0x152')]));return{'code':0xc8,'result':_0x43c9('0x154')};}else{logger[_0x43c9('0x35')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x43c9('0x11')][_0x43c9('0x43')],_0x306bc2[_0x43c9('0x152')]));this[_0x43c9('0x11')]['noop'](util['format'](_0x43c9('0x153'),this['channel']['callerid'],_0x306bc2[_0x43c9('0x152')]));return{'code':0xc8,'result':_0x43c9('0x156')};}};AGIVertices[_0x43c9('0x13')][_0x43c9('0x163')]=function(_0x156d60){logger[_0x43c9('0x35')](util['format'](_0x43c9('0x164'),_0x156d60[_0x43c9('0x40')]));if(!this[_0x43c9('0x88')](_0x156d60[_0x43c9('0x111')])){return this[_0x43c9('0x11')][_0x43c9('0x33')](_0x156d60,'no\x20file\x20audio\x20selected');}var _0x7a8807=this[_0x43c9('0x23')][_0x43c9('0x70')](this,_0x156d60[_0x43c9('0x111')]);if(!_0x7a8807){return this[_0x43c9('0x11')]['error'](_0x156d60,_0x43c9('0x113'));}var _0xe6fbf0=this[_0x43c9('0x11')][_0x43c9('0x5e')](_0x43c9('0x165'),[_0x7a8807,_0x156d60[_0x43c9('0xea')]]);if(_0xe6fbf0[_0x43c9('0xa8')]===-0x1){return _0xe6fbf0;}return this[_0x43c9('0x11')][_0x43c9('0xac')](util[_0x43c9('0x2f')]('Executed\x20command\x20%s\x20%s','PLAYBACK',_0x7a8807));};AGIVertices[_0x43c9('0x13')][_0x43c9('0x166')]=function(_0x239ca1){logger[_0x43c9('0x35')](util[_0x43c9('0x2f')](_0x43c9('0x167'),_0x239ca1[_0x43c9('0x40')]));if(!this[_0x43c9('0x88')](_0x239ca1[_0x43c9('0x168')])){return this[_0x43c9('0x11')][_0x43c9('0x33')](_0x239ca1,_0x43c9('0x169'));}var _0x49f5d7='';var _0x22e56d=parseInt(_0x239ca1[_0x43c9('0x168')],0xa);if(isNaN(_0x22e56d)){_0x49f5d7=_0x239ca1['queue_id'];}else{_0x49f5d7=this[_0x43c9('0x1a')][_0x43c9('0x70')](this,_0x239ca1['queue_id']);if(!_0x49f5d7){return this[_0x43c9('0x11')][_0x43c9('0x33')](_0x239ca1,_0x43c9('0x16a'));}}var _0x397683='';if(this[_0x43c9('0x88')](_0x239ca1[_0x43c9('0x111')])){var _0x4d9a76=this[_0x43c9('0x23')][_0x43c9('0x70')](this,_0x239ca1[_0x43c9('0x111')]);if(_0x4d9a76){_0x397683=_0x4d9a76;}}this[_0x43c9('0x3e')][_0x43c9('0x70')](this,_0x239ca1,_0x49f5d7);if(_0x239ca1[_0x43c9('0xea')][_0x43c9('0x16b')]('x')<0x0){_0x239ca1[_0x43c9('0xea')]+='x';}if(_0x239ca1[_0x43c9('0xea')][_0x43c9('0x16b')]('X')<0x0){_0x239ca1['opts']+='X';}this[_0x43c9('0x11')][_0x43c9('0xa3')]('XMCS-QUEUE',_0x49f5d7?_0x49f5d7[_0x43c9('0x16c')]():'');var _0x2560f1=this[_0x43c9('0x11')][_0x43c9('0x5e')](_0x43c9('0x16d'),[_0x49f5d7,_0x239ca1[_0x43c9('0xea')],_0x239ca1['url'],_0x397683,_0x239ca1[_0x43c9('0x68')],_0x239ca1[_0x43c9('0x9')],_0x239ca1[_0x43c9('0x16e')],_0x239ca1[_0x43c9('0x16f')],'',_0x239ca1[_0x43c9('0x170')]]);if(_0x2560f1[_0x43c9('0xa8')]===-0x1){return _0x2560f1;}return this['channel'][_0x43c9('0xac')](util['format'](_0x43c9('0xc7'),_0x43c9('0x16d'),_0x49f5d7));};AGIVertices[_0x43c9('0x13')][_0x43c9('0x171')]=function(_0x4144aa){logger[_0x43c9('0x35')](util['format']('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x4144aa['label']));var _0x3206b2=_0x4144aa[_0x43c9('0x172')]||_0x43c9('0x12d');var _0x35416a=util[_0x43c9('0x2f')](_0x43c9('0x173'),this['channel'][_0x43c9('0x3f')],rs[_0x43c9('0x11b')](0x5));var _0x48c20b=util['format'](_0x43c9('0x174'),FILES_PATH,_0x35416a,_0x3206b2);var _0x39641c=util['format'](_0x43c9('0x12e'),FILES_PATH,_0x35416a);this['createSquareRecording'][_0x43c9('0x70')](this,_0x4144aa,_0x35416a,_0x48c20b);this[_0x43c9('0x11')][_0x43c9('0xa3')](_0x43c9('0x175'),_0x35416a);logger['info'](_0x43c9('0x176'),_0x39641c,_0x3206b2,_0x4144aa[_0x43c9('0x177')],_0x4144aa[_0x43c9('0x68')]);return this[_0x43c9('0x11')]['recordFile'](_0x39641c,_0x3206b2,_0x4144aa[_0x43c9('0x177')],_0x4144aa[_0x43c9('0x68')],undefined,!![]);};AGIVertices[_0x43c9('0x13')][_0x43c9('0x178')]=function(_0x27060a){logger[_0x43c9('0x35')](util['format']('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x27060a['label']));if(!this[_0x43c9('0x88')](_0x27060a['url'])){return this[_0x43c9('0x11')]['noop'](_0x43c9('0x179'));}var _0x1c5b10=this[_0x43c9('0x17a')][_0x43c9('0x70')](this,_0x27060a);logger['info'](util['format'](_0x43c9('0x17b'),util[_0x43c9('0x17c')](_0x1c5b10,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x27060a['variable_id'])){return this[_0x43c9('0x11')][_0x43c9('0xac')](_0x43c9('0x17d'));}var _0x5df611=this[_0x43c9('0x14')]['sync'](this,_0x27060a[_0x43c9('0xdd')]);if(!_0x5df611){return this[_0x43c9('0x11')][_0x43c9('0x33')](_0x27060a,_0x43c9('0x119'));}this[_0x43c9('0x11')]['setVariable'](util['format']('%s_STATUS_CODE',_0x5df611),_0x1c5b10[_0x43c9('0x76')]?_0x1c5b10[_0x43c9('0x76')]:_0x43c9('0x17e'));this[_0x43c9('0x11')][_0x43c9('0xa3')](util['format']('%s_STATUS_MESSAGE',_0x5df611),_0x1c5b10['statusMessage']?_0x1c5b10['statusMessage']:'OK');if(_0x1c5b10['body']){try{this[_0x43c9('0xa1')](_0x1c5b10['body'],_0x5df611);}catch(_0x48377e){logger[_0x43c9('0x33')](util[_0x43c9('0x2f')](_0x43c9('0x17f'),_0x5df611));}}return this[_0x43c9('0x11')][_0x43c9('0xac')](util[_0x43c9('0x2f')]('variable\x20%s\x20set',_0x5df611));};AGIVertices[_0x43c9('0x13')][_0x43c9('0x180')]=function(_0x158fac){logger[_0x43c9('0x35')](util['format'](_0x43c9('0x181'),_0x158fac[_0x43c9('0x40')]));return this[_0x43c9('0x11')][_0x43c9('0x182')](_0x158fac[_0x43c9('0x183')][_0x43c9('0x60')](/\s+/g,''),_0x158fac[_0x43c9('0x177')]);};AGIVertices[_0x43c9('0x13')]['saynumber']=function(_0x4c3969){logger[_0x43c9('0x35')](util[_0x43c9('0x2f')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x4c3969['label']));return this['channel']['sayNumber'](_0x4c3969['number'][_0x43c9('0x60')](/\s+/g,''),_0x4c3969[_0x43c9('0x177')]);};AGIVertices[_0x43c9('0x13')][_0x43c9('0x184')]=function(_0x4ddeb6){logger[_0x43c9('0x35')](util[_0x43c9('0x2f')](_0x43c9('0x185'),_0x4ddeb6[_0x43c9('0x40')]));return this[_0x43c9('0x11')][_0x43c9('0x186')](_0x4ddeb6[_0x43c9('0x63')],_0x4ddeb6['escape_digits']);};AGIVertices[_0x43c9('0x13')]['sendMail']=function(_0x3c1c34){logger[_0x43c9('0x35')](util[_0x43c9('0x2f')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x3c1c34[_0x43c9('0x40')]));if(!this[_0x43c9('0x88')](_0x3c1c34['account_id'])){return this[_0x43c9('0x11')][_0x43c9('0xac')]('no\x20mail\x20account\x20configured');}var _0x3e86a0=this[_0x43c9('0x27')][_0x43c9('0x70')](this,_0x3c1c34[_0x43c9('0x187')]);if(!_0x3e86a0||!_0x3e86a0[_0x43c9('0x188')]){return this[_0x43c9('0x11')][_0x43c9('0x33')](_0x3c1c34,_0x43c9('0x189'));}var _0x39a156={'from':util[_0x43c9('0x2f')](_0x43c9('0x18a'),_0x3e86a0[_0x43c9('0x18')],_0x3e86a0[_0x43c9('0x18b')]||_0x3e86a0[_0x43c9('0x188')]['user']),'to':_0x3c1c34['to']||'','cc':_0x3c1c34['cc']||'','bcc':_0x3c1c34['bcc']||'','subject':_0x3c1c34[_0x43c9('0x18c')],'html':_0x3c1c34['text'],'text':_0x3c1c34[_0x43c9('0x63')]};if(this[_0x43c9('0x88')](_0x3c1c34[_0x43c9('0x18d')])){}logger[_0x43c9('0xe3')](_0x43c9('0x18e'),JSON[_0x43c9('0x74')](_0x39a156));this[_0x43c9('0x3e')][_0x43c9('0x70')](this,_0x3c1c34,_0x3c1c34['account_id']);this[_0x43c9('0x11')][_0x43c9('0xac')](util[_0x43c9('0x2f')](_0x43c9('0x18f'),_0x3e86a0[_0x43c9('0x18')]));this[_0x43c9('0x29')][_0x43c9('0x70')](this,_0x3e86a0[_0x43c9('0x190')],_0x39a156);return this[_0x43c9('0x11')][_0x43c9('0xac')](_0x43c9('0x191'));};AGIVertices['prototype'][_0x43c9('0x192')]=function(_0x5d192c){logger[_0x43c9('0x35')](util[_0x43c9('0x2f')](_0x43c9('0x193'),_0x5d192c[_0x43c9('0x40')]));return this[_0x43c9('0x11')]['noop']('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x43c9('0x13')][_0x43c9('0x194')]=function(_0x3beb3c){logger[_0x43c9('0x35')](util['format'](_0x43c9('0x195'),_0x3beb3c['label']));if(!this[_0x43c9('0x88')](_0x3beb3c[_0x43c9('0x196')])){return this['channel'][_0x43c9('0xac')]('no\x20sms\x20account\x20configured');}var _0x3c379a=this[_0x43c9('0x197')][_0x43c9('0x70')](this,_0x3beb3c[_0x43c9('0x196')]);if(!_0x3c379a){return this[_0x43c9('0x11')][_0x43c9('0x33')](_0x3beb3c,_0x43c9('0x198'));}var _0x5124b7={'body':_0x3beb3c[_0x43c9('0x199')],'phone':_0x3beb3c['to']||'','SmsAccountId':_0x3c379a['id']};logger[_0x43c9('0xe3')](_0x43c9('0x19a'),JSON['stringify'](_0x5124b7));this['createSquareDetailsReport'][_0x43c9('0x70')](this,_0x3beb3c,_0x3beb3c['sms_account_id']);this[_0x43c9('0x11')][_0x43c9('0xac')](util['format']('Trying\x20SendSMS\x20with\x20account\x20%s',_0x3c379a[_0x43c9('0x18')]));this['createSmsMessage'][_0x43c9('0x70')](this,_0x5124b7);return this['channel'][_0x43c9('0xac')](_0x43c9('0x19b'));};AGIVertices[_0x43c9('0x13')][_0x43c9('0x19c')]=function(_0xa725cb){logger[_0x43c9('0x35')](util[_0x43c9('0x2f')](_0x43c9('0x19d'),_0xa725cb[_0x43c9('0x40')]));if(!this['isConfigured'](_0xa725cb[_0x43c9('0xdd')])){return this[_0x43c9('0x11')][_0x43c9('0x33')](_0xa725cb,_0x43c9('0x19e'));}var _0x2f94dc=this['getVariable'][_0x43c9('0x70')](this,_0xa725cb[_0x43c9('0xdd')]);if(!_0x2f94dc){return this['channel']['error'](_0xa725cb,_0x43c9('0x119'));}return this['channel'][_0x43c9('0xa3')](_0x2f94dc,_0xa725cb[_0x43c9('0x19f')]);};AGIVertices['prototype'][_0x43c9('0x1a0')]=function(_0x1974f5){logger[_0x43c9('0x35')](util[_0x43c9('0x2f')]('Enter\x20in\x20START\x20(%s)\x20block',_0x1974f5['label']));this['channel'][_0x43c9('0xac')]('START\x20CALLY\x20SQUARE');var _0x4c69c3=this['channel']['getVariable']('XMCS-UNIQUEID');if(!_[_0x43c9('0x4d')](_0x4c69c3[_0x43c9('0xa6')])){this[_0x43c9('0x11')][_0x43c9('0x3f')]=_0x4c69c3[_0x43c9('0xa6')];}if(_0x1974f5[_0x43c9('0xbb')]===_0x43c9('0x1a1')){this[_0x43c9('0x11')][_0x43c9('0xac')](_0x43c9('0x1a2'));return this[_0x43c9('0x11')][_0x43c9('0xbb')]();}return this[_0x43c9('0x11')]['noop'](_0x43c9('0x1a3'));};AGIVertices[_0x43c9('0x13')]['subproject']=function(_0x2a6d98){logger['info'](util[_0x43c9('0x2f')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x2a6d98[_0x43c9('0x40')]));if(!this['isConfigured'](_0x2a6d98[_0x43c9('0x1a4')])){return this['channel']['error'](_0x2a6d98,'no\x20subproject\x20selected');}var _0x9a09b6=this['getSquareProject'][_0x43c9('0x70')](this,_0x2a6d98[_0x43c9('0x1a4')]);if(!this['isConfigured'](_0x9a09b6)){return this['channel']['error'](_0x2a6d98,util[_0x43c9('0x2f')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x2a6d98[_0x43c9('0x1a4')]));}if(_0x9a09b6===this[_0x43c9('0x11')][_0x43c9('0x49')]){return this[_0x43c9('0x11')][_0x43c9('0x33')](_0x2a6d98,_0x43c9('0x1a5'));}this[_0x43c9('0x3e')][_0x43c9('0x70')](this,_0x2a6d98,_0x9a09b6);var _0x7971da=this[_0x43c9('0x11')]['exec'](_0x43c9('0x1a6'),util[_0x43c9('0x2f')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x43c9('0x9')][_0x43c9('0x1a7')]||'127.0.0.1',_0x9a09b6,this[_0x43c9('0x11')]['arg_1']));if(_0x7971da[_0x43c9('0xa8')]===-0x1){return _0x7971da;}return this['channel']['noop'](util['format'](_0x43c9('0xc7'),'AGI',_0x9a09b6));};AGIVertices[_0x43c9('0x13')]['system']=function(_0xac6b11){logger[_0x43c9('0x35')](util[_0x43c9('0x2f')](_0x43c9('0x1a8'),_0xac6b11[_0x43c9('0x40')]));var _0x34081f=this[_0x43c9('0x5d')][_0x43c9('0x70')](this,_0xac6b11[_0x43c9('0xb9')]);this[_0x43c9('0x3e')][_0x43c9('0x70')](this,_0xac6b11,_0xac6b11[_0x43c9('0xb9')]);if(this[_0x43c9('0x88')](_0xac6b11[_0x43c9('0xdd')])){var _0x495159=this['getVariable'][_0x43c9('0x70')](this,_0xac6b11[_0x43c9('0xdd')]);if(_0x495159){this[_0x43c9('0x11')]['setVariable'](_0x495159,_0x34081f);return this[_0x43c9('0x11')][_0x43c9('0xac')](util[_0x43c9('0x2f')](_0x43c9('0x1a9'),_0xac6b11[_0x43c9('0xb9')],_0x495159));}}return this['channel']['noop'](util[_0x43c9('0x2f')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0xac6b11['command']));};AGIVertices[_0x43c9('0x13')]['google_cloud_tts']=function(_0x4d8636){logger[_0x43c9('0x35')](util[_0x43c9('0x2f')](_0x43c9('0x1aa'),_0x4d8636['label']));_0x4d8636[_0x43c9('0x63')]=_0x4d8636['text'][_0x43c9('0x60')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x4d8636[_0x43c9('0x1ab')])){return this[_0x43c9('0x11')]['noop']('no\x20apiKey\x20configured');}if(!this[_0x43c9('0x88')](_0x4d8636['text'])){return this['channel'][_0x43c9('0xac')](_0x43c9('0xad'));}this[_0x43c9('0x11')]['noop'](util[_0x43c9('0x2f')](_0x43c9('0x1ac'),_0x4d8636[_0x43c9('0x63')]));var _0xcefa92=this[_0x43c9('0x61')][_0x43c9('0x70')](this,_0x4d8636);if(_0xcefa92){this['channel'][_0x43c9('0xac')](util['format'](_0x43c9('0x1ad'),_0xcefa92));var _0x47e757=this['channel'][_0x43c9('0x104')](_0xcefa92);try{fs[_0x43c9('0x14c')](_0xcefa92+_0x43c9('0x105'));}catch(_0x385c22){logger[_0x43c9('0x33')](_0x385c22);}return _0x47e757;}return this[_0x43c9('0x11')]['error'](_0x4d8636,_0x43c9('0x1ae'));};AGIVertices[_0x43c9('0x13')][_0x43c9('0x1af')]=function(_0x3d772c){logger[_0x43c9('0x35')](util[_0x43c9('0x2f')](_0x43c9('0x1b0'),_0x3d772c[_0x43c9('0x40')]));_0x3d772c['text']=_0x3d772c[_0x43c9('0x63')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x3d772c[_0x43c9('0x63')])){return this[_0x43c9('0x11')]['noop'](_0x43c9('0xad'));}this[_0x43c9('0x11')][_0x43c9('0xac')](util[_0x43c9('0x2f')](_0x43c9('0x1b1'),_0x3d772c[_0x43c9('0x63')]));var _0x12e24b=this[_0x43c9('0x66')][_0x43c9('0x70')](this,_0x3d772c);if(_0x12e24b){this[_0x43c9('0x11')]['noop'](util[_0x43c9('0x2f')](_0x43c9('0x1b2'),_0x12e24b));var _0x5f2c13=this[_0x43c9('0x11')]['streamFile'](_0x12e24b);try{fs['unlink'](_0x12e24b+_0x43c9('0x105'));}catch(_0x282e0a){logger[_0x43c9('0x33')](_0x282e0a);}return _0x5f2c13;}return this['channel']['error'](_0x3d772c,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x43c9('0x13')][_0x43c9('0x1b3')]=function(_0x3b1193){logger['info'](util[_0x43c9('0x2f')](_0x43c9('0x1b4'),_0x3b1193[_0x43c9('0x40')]));if(!this[_0x43c9('0x88')](_0x3b1193[_0x43c9('0x152')])){return this[_0x43c9('0x11')][_0x43c9('0x33')](_0x3b1193,_0x43c9('0x150'));}logger['info'](util['format'](_0x43c9('0x151'),this['channel'][_0x43c9('0x43')],_0x3b1193[_0x43c9('0x152')]));var _0x7b9148=this[_0x43c9('0x58')][_0x43c9('0x70')](this,_0x3b1193['findBy']);if(_0x7b9148){logger[_0x43c9('0x35')](util['format'](_0x43c9('0x153'),this[_0x43c9('0x11')][_0x43c9('0x43')],_0x3b1193[_0x43c9('0x152')]));this['channel'][_0x43c9('0xac')](util[_0x43c9('0x2f')](_0x43c9('0x153'),this[_0x43c9('0x11')][_0x43c9('0x43')],_0x3b1193[_0x43c9('0x152')]));return{'code':0xc8,'result':'success'};}else{logger[_0x43c9('0x35')](util[_0x43c9('0x2f')](_0x43c9('0x155'),this[_0x43c9('0x11')][_0x43c9('0x43')],_0x3b1193[_0x43c9('0x152')]));this['channel'][_0x43c9('0xac')](util[_0x43c9('0x2f')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x43c9('0x43')],_0x3b1193['findBy']));return{'code':0xc8,'result':_0x43c9('0x156')};}};AGIVertices[_0x43c9('0x13')][_0x43c9('0x1b5')]=function(_0x33b639){logger[_0x43c9('0x35')](util[_0x43c9('0x2f')](_0x43c9('0x1b6'),_0x33b639[_0x43c9('0x40')]));var _0x484d61=this[_0x43c9('0x11')][_0x43c9('0x5e')](_0x43c9('0x1b7'),[_0x33b639[_0x43c9('0x1b8')],_0x33b639[_0x43c9('0x79')]]);if(_0x484d61[_0x43c9('0xa8')]===-0x1){return _0x484d61;}return this['channel'][_0x43c9('0xac')](util['format'](_0x43c9('0xc7'),'VOICEMAIL',_0x33b639['mailbox']));};AGIVertices['prototype'][_0x43c9('0x1b9')]=function(_0x17f694){logger['info'](util[_0x43c9('0x2f')](_0x43c9('0x1ba'),_0x17f694[_0x43c9('0x40')]));if(!this[_0x43c9('0x88')](_0x17f694[_0x43c9('0xdd')])){return this[_0x43c9('0x11')][_0x43c9('0x33')](_0x17f694,_0x43c9('0x19e'));}var _0x24b021=this[_0x43c9('0x14')][_0x43c9('0x70')](this,_0x17f694[_0x43c9('0xdd')]);if(!_0x24b021){return this[_0x43c9('0x11')][_0x43c9('0x33')](_0x17f694,'no\x20variable\x20found');}var _0x8acab6=this[_0x43c9('0x11')]['getVariable'](_0x24b021);return{'code':0xc8,'result':_0x8acab6[_0x43c9('0xa6')]?_0x8acab6[_0x43c9('0xa6')]:'-'};};String[_0x43c9('0x13')][_0x43c9('0xa5')]=function(_0x5ec2f4,_0x4a9eb1){return this[_0x43c9('0xa4')](_0x5ec2f4)[_0x43c9('0x1bb')](_0x4a9eb1);};module[_0x43c9('0x1bc')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index dfab2b5..90a7c89 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 _0xae3c=['lodash','moment','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','timers','channels','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','prototype','updateAcw','lastPauseAt','timer','update','uniqueid','[%s][UPDATE][ACWTIME:%s]','[%s][UPDATE][ERRORS:%s]','finally','queue','ACW','mandatoryDisposition','name','agents','getAgent','info','destlinkedid','available','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','error','message','[%s][TIMER][STOP][AGENT:%s]','then','pauseType','saveUnpause','catch','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','interface','[ACW][syncAgentConnect]\x20%s','attended','startAcw','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','Auto-Pause','exports'];(function(_0x547267,_0x2f5db3){var _0x5b93d5=function(_0x474a12){while(--_0x474a12){_0x547267['push'](_0x547267['shift']());}};_0x5b93d5(++_0x2f5db3);}(_0xae3c,0x19a));var _0xcae3=function(_0x5f4cd7,_0x459c44){_0x5f4cd7=_0x5f4cd7-0x0;var _0x47c93f=_0xae3c[_0x5f4cd7];return _0x47c93f;};'use strict';var _=require(_0xcae3('0x0'));var moment=require(_0xcae3('0x1'));var ami=require('../ami');var logger=require(_0xcae3('0x2'))(_0xcae3('0x3'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0xcae3('0x4'));function Acw(_0x354e90){this[_0xcae3('0x5')]=_0x354e90[_0xcae3('0x5')];this['agents']=_0x354e90['agents'];this[_0xcae3('0x6')]=_0x354e90[_0xcae3('0x6')];this[_0xcae3('0x7')]={};ami['on']('agentconnect',this[_0xcae3('0x8')][_0xcae3('0x9')](this));ami['on'](_0xcae3('0xa'),this[_0xcae3('0xb')]['bind'](this));ami['on'](_0xcae3('0xc'),this[_0xcae3('0xd')][_0xcae3('0x9')](this));ami['on'](_0xcae3('0xe'),this[_0xcae3('0xf')][_0xcae3('0x9')](this));ami['on'](_0xcae3('0x10'),this[_0xcae3('0x11')][_0xcae3('0x9')](this));ami['on']('blindtransfer',this[_0xcae3('0x12')][_0xcae3('0x9')](this));ami['on'](_0xcae3('0x13'),this[_0xcae3('0x14')][_0xcae3('0x9')](this));}function getDiff(_0x2a5044){var _0xb8ebd0=moment()[_0xcae3('0x15')](0x0);var _0x4b38b4=moment(_0x2a5044)[_0xcae3('0x15')](0x0);return _0xb8ebd0[_0xcae3('0x16')](_0x4b38b4,'seconds');}Acw[_0xcae3('0x17')][_0xcae3('0x18')]=function(_0x55bec8,_0x58c932){var _0x48869f=this;var _0x54738b=getDiff(_0x48869f['timers'][_0x55bec8][_0xcae3('0x19')]);clearTimeout(_0x48869f[_0xcae3('0x6')][_0x55bec8][_0xcae3('0x1a')]);_0x48869f[_0xcae3('0x6')][_0x55bec8][_0xcae3('0x1a')]=![];return RpcVoiceAgentReport[_0xcae3('0x1b')]({'acwtime':_0x54738b},_0x48869f[_0xcae3('0x6')][_0x55bec8][_0xcae3('0x1c')],_0x55bec8)['then'](function(_0x16cbc5){logger['info'](_0xcae3('0x1d'),_0x58c932,_0x54738b,_0x16cbc5);})['catch'](function(_0x417920){logger['error'](_0xcae3('0x1e'),_0x58c932,_0x417920);})[_0xcae3('0x1f')](function(){delete _0x48869f['timers'][_0x55bec8];});};Acw[_0xcae3('0x17')]['startAcw']=function(_0x4be343){try{var _0xc3b73d=this;var _0x97b47f=this[_0xcae3('0x7')][_0x4be343]['interface'];var _0x539dd7=this[_0xcae3('0x7')][_0x4be343][_0xcae3('0x20')];var _0x3e0176=this[_0xcae3('0x5')][_0x539dd7];var _0x4b1d15=![];var _0x2b2114=_0xcae3('0x21');if(_0x3e0176[_0xcae3('0x22')]&&_0x3e0176['mandatoryDispositionPause'][_0xcae3('0x23')]){_0x4b1d15=!![];_0x2b2114=_0x3e0176['mandatoryDispositionPause']['name'];}if(!_0xc3b73d[_0xcae3('0x24')][_0x97b47f]){return Promise['resolve']();}return RpcUser[_0xcae3('0x25')](_0xc3b73d[_0xcae3('0x24')][_0x97b47f]['id'])['then'](function(_0x121b52){if(!_0x121b52||_0x121b52['voicePause']){logger['info']('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x4be343,_0x97b47f,_0x539dd7);return;}logger[_0xcae3('0x26')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x4be343,_0x97b47f,_0x539dd7);var _0x574285=_0xc3b73d[_0xcae3('0x7')][_0x4be343]['attended']&&_0xc3b73d[_0xcae3('0x7')][_0x4be343]['destlinkedid']?_0xc3b73d[_0xcae3('0x7')][_0x4be343][_0xcae3('0x27')]:_0x4be343;return RpcUser['savePause'](_0xc3b73d[_0xcae3('0x24')][_0x97b47f],_0x2b2114,_0x574285)['then'](function(){_0xc3b73d[_0xcae3('0x5')][_0x539dd7][_0xcae3('0x28')]-=0x1;_0xc3b73d[_0xcae3('0x5')][_0x539dd7][_0xcae3('0x29')]+=0x1;});})['then'](function(_0x439665){if(_0x4b1d15||!_0x439665){return;}_0xc3b73d[_0xcae3('0x6')][_0x97b47f]={};logger['info'](_0xcae3('0x2a'),_0x4be343,_0xc3b73d[_0xcae3('0x5')][_0x539dd7][_0xcae3('0x2b')],_0x97b47f,_0x539dd7);_0xc3b73d[_0xcae3('0x6')][_0x97b47f][_0xcae3('0x1a')]=setTimeout(_0xc3b73d[_0xcae3('0x2c')][_0xcae3('0x9')](_0xc3b73d,_0x97b47f),_0xc3b73d[_0xcae3('0x5')][_0x539dd7][_0xcae3('0x2b')]*0x3e8);_0xc3b73d[_0xcae3('0x6')][_0x97b47f][_0xcae3('0x19')]=moment()[_0xcae3('0x2d')](_0xcae3('0x2e'));_0xc3b73d[_0xcae3('0x6')][_0x97b47f]['uniqueid']=_0x4be343;_0xc3b73d[_0xcae3('0x6')][_0x97b47f][_0xcae3('0x20')]=_0x539dd7;_0xc3b73d[_0xcae3('0x6')][_0x97b47f][_0xcae3('0x18')]=_0xc3b73d[_0xcae3('0x18')][_0xcae3('0x9')](_0xc3b73d,_0x97b47f,_0x4be343);})['catch'](function(){logger[_0xcae3('0x2f')](_0xcae3('0x2a'),_0x4be343,_0xc3b73d['voiceQueues'][_0x539dd7][_0xcae3('0x2b')],_0x97b47f,_0x539dd7);})[_0xcae3('0x1f')](function(){delete _0xc3b73d['channels'][_0x4be343];});}catch(_0x133089){logger['error']('[ACW][START]\x20%s',_0x133089[_0xcae3('0x30')]);}};Acw[_0xcae3('0x17')][_0xcae3('0x2c')]=function(_0x962744){try{var _0x1f51bf=this;if(_0x1f51bf[_0xcae3('0x6')][_0x962744]){_0x1f51bf[_0xcae3('0x6')][_0x962744][_0xcae3('0x1a')]=![];var _0x4490db=_0x1f51bf[_0xcae3('0x6')][_0x962744]['uniqueid'];var _0x15e98a=_0x1f51bf['timers'][_0x962744][_0xcae3('0x20')];var _0x211289=_0x1f51bf['voiceQueues'][_0x15e98a][_0xcae3('0x2b')];logger['info'](_0xcae3('0x31'),_0x4490db,_0x962744);RpcUser[_0xcae3('0x25')](this[_0xcae3('0x24')][_0x962744]['id'])[_0xcae3('0x32')](function(_0x411da3){if(_0x411da3[_0xcae3('0x33')]===_0xcae3('0x21')){return RpcUser[_0xcae3('0x34')](_0x1f51bf[_0xcae3('0x24')][_0x962744]);}});RpcVoiceAgentReport['update']({'acwtime':_0x211289,'agentacw':!![]},_0x4490db,_0x962744)[_0xcae3('0x32')](function(_0x5394b4){logger[_0xcae3('0x26')](_0xcae3('0x1d'),_0x4490db,_0x211289,_0x5394b4);})[_0xcae3('0x35')](function(_0x188ec7){logger[_0xcae3('0x2f')](_0xcae3('0x1e'),_0x4490db,_0x188ec7);});}else{logger[_0xcae3('0x2f')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x962744);if(_0x1f51bf['timers']){logger[_0xcae3('0x26')](_0xcae3('0x36'),JSON[_0xcae3('0x37')](_0x1f51bf[_0xcae3('0x6')]));}}}catch(_0x354702){logger[_0xcae3('0x2f')](_0xcae3('0x38'),_0x354702[_0xcae3('0x30')]);}};Acw[_0xcae3('0x17')]['syncAgentConnect']=function(_0x409c15){try{if(this[_0xcae3('0x5')][_0x409c15['queue']]&&(this['voiceQueues'][_0x409c15[_0xcae3('0x20')]][_0xcae3('0x3')]||this['voiceQueues'][_0x409c15[_0xcae3('0x20')]][_0xcae3('0x22')])){if(this[_0xcae3('0x24')][_0x409c15[_0xcae3('0x39')]]){this[_0xcae3('0x7')][_0x409c15[_0xcae3('0x1c')]]={'queue':_0x409c15['queue'],'interface':_0x409c15[_0xcae3('0x39')],'destlinkedid':_0x409c15[_0xcae3('0x27')]};}}}catch(_0x45f82b){logger[_0xcae3('0x2f')](_0xcae3('0x3a'),_0x45f82b[_0xcae3('0x30')]);}};Acw[_0xcae3('0x17')][_0xcae3('0x14')]=function(_0x57e9fa){try{if(this[_0xcae3('0x5')][_0x57e9fa[_0xcae3('0x20')]]&&(this[_0xcae3('0x5')][_0x57e9fa[_0xcae3('0x20')]][_0xcae3('0x3')]||this[_0xcae3('0x5')][_0x57e9fa[_0xcae3('0x20')]][_0xcae3('0x22')])){if(this[_0xcae3('0x24')][_0x57e9fa['interface']]){this[_0xcae3('0x7')][_0x57e9fa['uniqueid']]={'queue':_0x57e9fa[_0xcae3('0x20')],'interface':_0x57e9fa[_0xcae3('0x39')]};}}}catch(_0x426206){logger[_0xcae3('0x2f')]('[ACW][syncAgentConnectPreview]\x20%s',_0x426206[_0xcae3('0x30')]);}};Acw['prototype'][_0xcae3('0xb')]=function(_0x8898d7){try{if(this[_0xcae3('0x7')][_0x8898d7[_0xcae3('0x1c')]]&&_['isUndefined'](this['channels'][_0x8898d7[_0xcae3('0x1c')]][_0xcae3('0x3b')])){logger['info']('[%s][HANGUP:UNIQUEID]',_0x8898d7['uniqueid']);this[_0xcae3('0x3c')](_0x8898d7[_0xcae3('0x1c')]);}else if(this[_0xcae3('0x7')][_0x8898d7['linkedid']]&&_[_0xcae3('0x3d')](this[_0xcae3('0x7')][_0x8898d7[_0xcae3('0x3e')]][_0xcae3('0x3b')])){logger[_0xcae3('0x26')](_0xcae3('0x3f'),_0x8898d7[_0xcae3('0x3e')]);this['startAcw'](_0x8898d7['linkedid']);}}catch(_0x3506b8){logger['error']('[ACW][syncHangupRequest]\x20%s',_0x3506b8[_0xcae3('0x30')]);}};Acw[_0xcae3('0x17')][_0xcae3('0xd')]=function(_0x136a5d){try{if(this['channels'][_0x136a5d[_0xcae3('0x1c')]]&&this['channels'][_0x136a5d[_0xcae3('0x1c')]][_0xcae3('0x3b')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x136a5d['uniqueid']);this[_0xcae3('0x3c')](_0x136a5d[_0xcae3('0x1c')]);}else if(this[_0xcae3('0x7')][_0x136a5d[_0xcae3('0x3e')]]&&this['channels'][_0x136a5d[_0xcae3('0x3e')]]['attended']){logger[_0xcae3('0x26')](_0xcae3('0x40'),_0x136a5d[_0xcae3('0x3e')]);this['startAcw'](_0x136a5d[_0xcae3('0x3e')]);}}catch(_0x4813d6){logger[_0xcae3('0x2f')]('[ACW][syncHangup]\x20%s',_0x4813d6[_0xcae3('0x30')]);}};Acw['prototype']['syncAttendedTransfer']=function(_0x3daa0f){try{if(!_[_0xcae3('0x41')](this['channels'][_0x3daa0f[_0xcae3('0x42')]])){this[_0xcae3('0x3c')](_0x3daa0f[_0xcae3('0x42')]);if(this[_0xcae3('0x7')][_0x3daa0f[_0xcae3('0x43')]]){this[_0xcae3('0x7')][_0x3daa0f[_0xcae3('0x43')]][_0xcae3('0x3b')]=!![];this[_0xcae3('0x7')][_0x3daa0f[_0xcae3('0x44')]]=this[_0xcae3('0x7')][_0x3daa0f['secondtransfereruniqueid']];delete this[_0xcae3('0x7')][_0x3daa0f[_0xcae3('0x43')]];}}else if(!_[_0xcae3('0x41')](this[_0xcae3('0x7')][_0x3daa0f[_0xcae3('0x44')]])){this[_0xcae3('0x3c')](_0x3daa0f[_0xcae3('0x44')]);if(this[_0xcae3('0x7')][_0x3daa0f[_0xcae3('0x45')]]){this['channels'][_0x3daa0f[_0xcae3('0x45')]][_0xcae3('0x3b')]=!![];this['channels'][_0x3daa0f['transfereeuniqueid']]=this['channels'][_0x3daa0f[_0xcae3('0x45')]];delete this[_0xcae3('0x7')][_0x3daa0f['origtransfereruniqueid']];}}}catch(_0x47ceee){logger[_0xcae3('0x2f')](_0xcae3('0x46'),_0x47ceee[_0xcae3('0x30')]);}};Acw[_0xcae3('0x17')]['syncBlindTransfer']=function(_0x579f93){try{if(this[_0xcae3('0x7')][_0x579f93['transfereruniqueid']]){logger[_0xcae3('0x26')](_0xcae3('0x47'),JSON['stringify'](_0x579f93['transfereruniqueid']));this[_0xcae3('0x3c')](_0x579f93[_0xcae3('0x48')]);}else if(this[_0xcae3('0x7')][_0x579f93[_0xcae3('0x49')]]){logger[_0xcae3('0x26')](_0xcae3('0x4a'),JSON[_0xcae3('0x37')](_0x579f93[_0xcae3('0x49')]));this[_0xcae3('0x3c')](_0x579f93['transfererlinkedid']);}}catch(_0x1474c2){logger[_0xcae3('0x2f')](_0xcae3('0x4b'),_0x1474c2[_0xcae3('0x30')]);}};Acw[_0xcae3('0x17')][_0xcae3('0xf')]=function(_0x2df0a6){try{if(this[_0xcae3('0x5')][_0x2df0a6[_0xcae3('0x20')]]&&this[_0xcae3('0x5')][_0x2df0a6[_0xcae3('0x20')]][_0xcae3('0x4c')]===_0xcae3('0x4d')){if(this['agents'][_0x2df0a6['interface']]){logger[_0xcae3('0x26')](_0xcae3('0x4e'),_0x2df0a6[_0xcae3('0x1c')],_0x2df0a6[_0xcae3('0x39')],_0x2df0a6[_0xcae3('0x20')]);return RpcUser[_0xcae3('0x4f')](this[_0xcae3('0x24')][_0x2df0a6[_0xcae3('0x39')]],_0xcae3('0x50'),_0x2df0a6[_0xcae3('0x1c')]);}}}catch(_0x4aad01){logger[_0xcae3('0x2f')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x4aad01[_0xcae3('0x30')]);}};module[_0xcae3('0x51')]=Acw; \ No newline at end of file +var _0x6ba8=['[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','getAgent','pauseType','ACW','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','syncAgentConnect','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereeuniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','acw','../rpc/user','voiceQueues','agents','timers','channels','agentconnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','lastPauseAt','timer','update','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','finally','startAcw','interface','queue','voicePause'];(function(_0x374075,_0x59ffb7){var _0x1fd0d3=function(_0xc73480){while(--_0xc73480){_0x374075['push'](_0x374075['shift']());}};_0x1fd0d3(++_0x59ffb7);}(_0x6ba8,0x1c4));var _0x86ba=function(_0x2e067e,_0x8d7faf){_0x2e067e=_0x2e067e-0x0;var _0x4a0076=_0x6ba8[_0x2e067e];return _0x4a0076;};'use strict';var _=require(_0x86ba('0x0'));var moment=require(_0x86ba('0x1'));var ami=require('../ami');var logger=require('../../../config/logger')(_0x86ba('0x2'));var RpcUser=require(_0x86ba('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x3ec3c9){this[_0x86ba('0x4')]=_0x3ec3c9['voiceQueues'];this['agents']=_0x3ec3c9[_0x86ba('0x5')];this[_0x86ba('0x6')]=_0x3ec3c9[_0x86ba('0x6')];this[_0x86ba('0x7')]={};ami['on'](_0x86ba('0x8'),this['syncAgentConnect'][_0x86ba('0x9')](this));ami['on'](_0x86ba('0xa'),this[_0x86ba('0xb')]['bind'](this));ami['on'](_0x86ba('0xc'),this[_0x86ba('0xd')]['bind'](this));ami['on']('agentringnoanswer',this[_0x86ba('0xe')][_0x86ba('0x9')](this));ami['on'](_0x86ba('0xf'),this[_0x86ba('0x10')][_0x86ba('0x9')](this));ami['on'](_0x86ba('0x11'),this[_0x86ba('0x12')][_0x86ba('0x9')](this));ami['on'](_0x86ba('0x13'),this[_0x86ba('0x14')][_0x86ba('0x9')](this));}function getDiff(_0xabf33e){var _0x2563bb=moment()[_0x86ba('0x15')](0x0);var _0x3e0712=moment(_0xabf33e)[_0x86ba('0x15')](0x0);return _0x2563bb[_0x86ba('0x16')](_0x3e0712,_0x86ba('0x17'));}Acw[_0x86ba('0x18')]['updateAcw']=function(_0x975101,_0x2eb322){var _0x639691=this;var _0x3cf2ae=getDiff(_0x639691['timers'][_0x975101][_0x86ba('0x19')]);clearTimeout(_0x639691['timers'][_0x975101]['timer']);_0x639691[_0x86ba('0x6')][_0x975101][_0x86ba('0x1a')]=![];return RpcVoiceAgentReport[_0x86ba('0x1b')]({'acwtime':_0x3cf2ae},_0x639691[_0x86ba('0x6')][_0x975101][_0x86ba('0x1c')],_0x975101)[_0x86ba('0x1d')](function(_0xb4a77c){logger[_0x86ba('0x1e')](_0x86ba('0x1f'),_0x2eb322,_0x3cf2ae,_0xb4a77c);})[_0x86ba('0x20')](function(_0x1e3b68){logger[_0x86ba('0x21')](_0x86ba('0x22'),_0x2eb322,_0x1e3b68);})[_0x86ba('0x23')](function(){delete _0x639691[_0x86ba('0x6')][_0x975101];});};Acw[_0x86ba('0x18')][_0x86ba('0x24')]=function(_0x1d4066){try{var _0x8e6b81=this;var _0x3001fb=this[_0x86ba('0x7')][_0x1d4066][_0x86ba('0x25')];var _0x8c0613=this['channels'][_0x1d4066][_0x86ba('0x26')];var _0x6061ed=this[_0x86ba('0x4')][_0x8c0613];var _0x3ec21a=![];var _0x29283f='ACW';if(_0x6061ed['mandatoryDisposition']&&_0x6061ed['mandatoryDispositionPause']['name']){_0x3ec21a=!![];_0x29283f=_0x6061ed['mandatoryDispositionPause']['name'];}if(!_0x8e6b81[_0x86ba('0x5')][_0x3001fb]){return Promise['resolve']();}return RpcUser['getAgent'](_0x8e6b81['agents'][_0x3001fb]['id'])[_0x86ba('0x1d')](function(_0x3d5e37){if(!_0x3d5e37||_0x3d5e37[_0x86ba('0x27')]){logger[_0x86ba('0x1e')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x1d4066,_0x3001fb,_0x8c0613);return;}logger[_0x86ba('0x1e')](_0x86ba('0x28'),_0x1d4066,_0x3001fb,_0x8c0613);var _0x4fdf08=_0x8e6b81[_0x86ba('0x7')][_0x1d4066][_0x86ba('0x29')]&&_0x8e6b81[_0x86ba('0x7')][_0x1d4066][_0x86ba('0x2a')]?_0x8e6b81[_0x86ba('0x7')][_0x1d4066][_0x86ba('0x2a')]:_0x1d4066;return RpcUser['savePause'](_0x8e6b81['agents'][_0x3001fb],_0x29283f,_0x4fdf08)[_0x86ba('0x1d')](function(_0x3f52c1){_0x8e6b81[_0x86ba('0x4')][_0x8c0613]['available']-=0x1;_0x8e6b81[_0x86ba('0x4')][_0x8c0613][_0x86ba('0x2b')]+=0x1;return _0x3f52c1;});})[_0x86ba('0x1d')](function(_0x17c739){if(_0x3ec21a||!_0x17c739){return;}_0x8e6b81[_0x86ba('0x6')][_0x3001fb]={};logger[_0x86ba('0x1e')](_0x86ba('0x2c'),_0x1d4066,_0x8e6b81[_0x86ba('0x4')][_0x8c0613][_0x86ba('0x2d')],_0x3001fb,_0x8c0613);_0x8e6b81[_0x86ba('0x6')][_0x3001fb][_0x86ba('0x1a')]=setTimeout(_0x8e6b81[_0x86ba('0x2e')][_0x86ba('0x9')](_0x8e6b81,_0x3001fb),_0x8e6b81['voiceQueues'][_0x8c0613][_0x86ba('0x2d')]*0x3e8);_0x8e6b81[_0x86ba('0x6')][_0x3001fb]['lastPauseAt']=moment()[_0x86ba('0x2f')](_0x86ba('0x30'));_0x8e6b81[_0x86ba('0x6')][_0x3001fb][_0x86ba('0x1c')]=_0x1d4066;_0x8e6b81['timers'][_0x3001fb]['queue']=_0x8c0613;_0x8e6b81[_0x86ba('0x6')][_0x3001fb][_0x86ba('0x31')]=_0x8e6b81[_0x86ba('0x31')][_0x86ba('0x9')](_0x8e6b81,_0x3001fb,_0x1d4066);})[_0x86ba('0x20')](function(){logger['error']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x1d4066,_0x8e6b81[_0x86ba('0x4')][_0x8c0613]['acwTimeout'],_0x3001fb,_0x8c0613);})[_0x86ba('0x23')](function(){delete _0x8e6b81[_0x86ba('0x7')][_0x1d4066];});}catch(_0x2fb5fe){logger[_0x86ba('0x21')](_0x86ba('0x32'),_0x2fb5fe[_0x86ba('0x33')]);}};Acw[_0x86ba('0x18')]['stopAcw']=function(_0x155a34){try{var _0x32fc3b=this;if(_0x32fc3b[_0x86ba('0x6')][_0x155a34]){_0x32fc3b[_0x86ba('0x6')][_0x155a34][_0x86ba('0x1a')]=![];var _0xff27e8=_0x32fc3b['timers'][_0x155a34][_0x86ba('0x1c')];var _0x39f435=_0x32fc3b[_0x86ba('0x6')][_0x155a34]['queue'];var _0x13b979=_0x32fc3b['voiceQueues'][_0x39f435][_0x86ba('0x2d')];logger['info'](_0x86ba('0x34'),_0xff27e8,_0x155a34);RpcUser[_0x86ba('0x35')](this[_0x86ba('0x5')][_0x155a34]['id'])[_0x86ba('0x1d')](function(_0x270f78){if(_0x270f78[_0x86ba('0x36')]===_0x86ba('0x37')){return RpcUser[_0x86ba('0x38')](_0x32fc3b['agents'][_0x155a34]);}});RpcVoiceAgentReport[_0x86ba('0x1b')]({'acwtime':_0x13b979,'agentacw':!![]},_0xff27e8,_0x155a34)[_0x86ba('0x1d')](function(_0x3563fb){logger[_0x86ba('0x1e')](_0x86ba('0x1f'),_0xff27e8,_0x13b979,_0x3563fb);})['catch'](function(_0x260019){logger[_0x86ba('0x21')](_0x86ba('0x22'),_0xff27e8,_0x260019);});}else{logger[_0x86ba('0x21')](_0x86ba('0x39'),_0x155a34);if(_0x32fc3b['timers']){logger[_0x86ba('0x1e')](_0x86ba('0x3a'),JSON['stringify'](_0x32fc3b[_0x86ba('0x6')]));}}}catch(_0x49a99e){logger['error'](_0x86ba('0x3b'),_0x49a99e['message']);}};Acw[_0x86ba('0x18')][_0x86ba('0x3c')]=function(_0x2c4f5b){try{if(this['voiceQueues'][_0x2c4f5b['queue']]&&(this[_0x86ba('0x4')][_0x2c4f5b[_0x86ba('0x26')]][_0x86ba('0x2')]||this[_0x86ba('0x4')][_0x2c4f5b[_0x86ba('0x26')]]['mandatoryDisposition'])){if(this[_0x86ba('0x5')][_0x2c4f5b['interface']]){this['channels'][_0x2c4f5b[_0x86ba('0x1c')]]={'queue':_0x2c4f5b[_0x86ba('0x26')],'interface':_0x2c4f5b[_0x86ba('0x25')],'destlinkedid':_0x2c4f5b['destlinkedid']};}}}catch(_0x2b60d4){logger['error']('[ACW][syncAgentConnect]\x20%s',_0x2b60d4['message']);}};Acw['prototype'][_0x86ba('0x14')]=function(_0x156f78){try{if(this['voiceQueues'][_0x156f78[_0x86ba('0x26')]]&&(this[_0x86ba('0x4')][_0x156f78[_0x86ba('0x26')]][_0x86ba('0x2')]||this[_0x86ba('0x4')][_0x156f78[_0x86ba('0x26')]]['mandatoryDisposition'])){if(this[_0x86ba('0x5')][_0x156f78[_0x86ba('0x25')]]){this[_0x86ba('0x7')][_0x156f78[_0x86ba('0x1c')]]={'queue':_0x156f78[_0x86ba('0x26')],'interface':_0x156f78[_0x86ba('0x25')]};}}}catch(_0x5ccd2d){logger[_0x86ba('0x21')]('[ACW][syncAgentConnectPreview]\x20%s',_0x5ccd2d[_0x86ba('0x33')]);}};Acw[_0x86ba('0x18')][_0x86ba('0xb')]=function(_0x2aad16){try{if(this['channels'][_0x2aad16['uniqueid']]&&_['isUndefined'](this[_0x86ba('0x7')][_0x2aad16[_0x86ba('0x1c')]][_0x86ba('0x29')])){logger[_0x86ba('0x1e')]('[%s][HANGUP:UNIQUEID]',_0x2aad16[_0x86ba('0x1c')]);this[_0x86ba('0x24')](_0x2aad16[_0x86ba('0x1c')]);}else if(this[_0x86ba('0x7')][_0x2aad16[_0x86ba('0x3d')]]&&_['isUndefined'](this[_0x86ba('0x7')][_0x2aad16[_0x86ba('0x3d')]][_0x86ba('0x29')])){logger['info'](_0x86ba('0x3e'),_0x2aad16['linkedid']);this[_0x86ba('0x24')](_0x2aad16[_0x86ba('0x3d')]);}}catch(_0x248479){logger[_0x86ba('0x21')]('[ACW][syncHangupRequest]\x20%s',_0x248479[_0x86ba('0x33')]);}};Acw[_0x86ba('0x18')][_0x86ba('0xd')]=function(_0x3cbefc){try{if(this[_0x86ba('0x7')][_0x3cbefc[_0x86ba('0x1c')]]&&this[_0x86ba('0x7')][_0x3cbefc[_0x86ba('0x1c')]][_0x86ba('0x29')]){logger[_0x86ba('0x1e')](_0x86ba('0x3f'),_0x3cbefc[_0x86ba('0x1c')]);this[_0x86ba('0x24')](_0x3cbefc[_0x86ba('0x1c')]);}else if(this[_0x86ba('0x7')][_0x3cbefc['linkedid']]&&this['channels'][_0x3cbefc[_0x86ba('0x3d')]]['attended']){logger[_0x86ba('0x1e')](_0x86ba('0x40'),_0x3cbefc['linkedid']);this[_0x86ba('0x24')](_0x3cbefc[_0x86ba('0x3d')]);}}catch(_0x437c38){logger[_0x86ba('0x21')]('[ACW][syncHangup]\x20%s',_0x437c38[_0x86ba('0x33')]);}};Acw[_0x86ba('0x18')][_0x86ba('0x10')]=function(_0x2131f7){try{if(!_[_0x86ba('0x41')](this[_0x86ba('0x7')][_0x2131f7['transfereeuniqueid']])){this['startAcw'](_0x2131f7['transfereeuniqueid']);if(this['channels'][_0x2131f7[_0x86ba('0x42')]]){this[_0x86ba('0x7')][_0x2131f7[_0x86ba('0x42')]][_0x86ba('0x29')]=!![];this['channels'][_0x2131f7[_0x86ba('0x43')]]=this[_0x86ba('0x7')][_0x2131f7['secondtransfereruniqueid']];delete this[_0x86ba('0x7')][_0x2131f7[_0x86ba('0x42')]];}}else if(!_[_0x86ba('0x41')](this[_0x86ba('0x7')][_0x2131f7[_0x86ba('0x43')]])){this[_0x86ba('0x24')](_0x2131f7['transfertargetuniqueid']);if(this[_0x86ba('0x7')][_0x2131f7[_0x86ba('0x44')]]){this[_0x86ba('0x7')][_0x2131f7[_0x86ba('0x44')]][_0x86ba('0x29')]=!![];this[_0x86ba('0x7')][_0x2131f7[_0x86ba('0x45')]]=this[_0x86ba('0x7')][_0x2131f7[_0x86ba('0x44')]];delete this[_0x86ba('0x7')][_0x2131f7[_0x86ba('0x44')]];}}}catch(_0x52fed2){logger['error'](_0x86ba('0x46'),_0x52fed2[_0x86ba('0x33')]);}};Acw[_0x86ba('0x18')][_0x86ba('0x12')]=function(_0x39955d){try{if(this['channels'][_0x39955d[_0x86ba('0x47')]]){logger[_0x86ba('0x1e')](_0x86ba('0x48'),JSON[_0x86ba('0x49')](_0x39955d[_0x86ba('0x47')]));this['startAcw'](_0x39955d[_0x86ba('0x47')]);}else if(this[_0x86ba('0x7')][_0x39955d[_0x86ba('0x4a')]]){logger[_0x86ba('0x1e')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x86ba('0x49')](_0x39955d['transfererlinkedid']));this[_0x86ba('0x24')](_0x39955d[_0x86ba('0x4a')]);}}catch(_0x23ab76){logger['error'](_0x86ba('0x4b'),_0x23ab76['message']);}};Acw[_0x86ba('0x18')][_0x86ba('0xe')]=function(_0x16041a){try{if(this['voiceQueues'][_0x16041a['queue']]&&this[_0x86ba('0x4')][_0x16041a[_0x86ba('0x26')]]['autopause']===_0x86ba('0x4c')){if(this[_0x86ba('0x5')][_0x16041a[_0x86ba('0x25')]]){logger['info'](_0x86ba('0x4d'),_0x16041a[_0x86ba('0x1c')],_0x16041a['interface'],_0x16041a[_0x86ba('0x26')]);return RpcUser[_0x86ba('0x4e')](this['agents'][_0x16041a[_0x86ba('0x25')]],_0x86ba('0x4f'),_0x16041a[_0x86ba('0x1c')]);}}}catch(_0x3745dd){logger[_0x86ba('0x21')](_0x86ba('0x50'),_0x3745dd[_0x86ba('0x33')]);}};module[_0x86ba('0x51')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 849abf7..e566d9b 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 _0x8b12=['sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionDeviceStateList','catch','bluebird','util','../../config/logger','asterisk','port','username','password','keepConnected','Action','promisify','error','format','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','devicestatelist','actionSipPeerStatus'];(function(_0x49e02b,_0x17a0ed){var _0x38e779=function(_0x463ed0){while(--_0x463ed0){_0x49e02b['push'](_0x49e02b['shift']());}};_0x38e779(++_0x17a0ed);}(_0x8b12,0x1c2));var _0x28b1=function(_0x59f0c4,_0x443d24){_0x59f0c4=_0x59f0c4-0x0;var _0x2ee8c6=_0x8b12[_0x59f0c4];return _0x2ee8c6;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x28b1('0x0'));var util=require(_0x28b1('0x1'));var logger=require(_0x28b1('0x2'))('ami');var config=require('../../config/environment');var ami=new Manager(config[_0x28b1('0x3')][_0x28b1('0x4')],config[_0x28b1('0x3')]['ip'],config['asterisk'][_0x28b1('0x5')],config[_0x28b1('0x3')][_0x28b1('0x6')],!![]);ami[_0x28b1('0x7')]();ami[_0x28b1('0x8')]=BPromise[_0x28b1('0x9')](ami['action']);function error(_0x561002){logger[_0x28b1('0xa')](util[_0x28b1('0xb')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x28b1('0x3')][_0x28b1('0x5')],config[_0x28b1('0x3')]['ip'],config['asterisk'][_0x28b1('0x4')],util[_0x28b1('0xc')](_0x561002,![],null)));}function close(){logger['error'](util[_0x28b1('0xb')](_0x28b1('0xd'),config['asterisk'][_0x28b1('0x5')],config[_0x28b1('0x3')]['ip'],config[_0x28b1('0x3')]['port']));}ami[_0x28b1('0xe')]=function(){return function(){return ami['Action']({'action':_0x28b1('0xf')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x28b1('0x8')]({'action':_0x28b1('0x10')});};};ami[_0x28b1('0x11')]=function(){return function(){return ami[_0x28b1('0x8')]({'action':_0x28b1('0x12')});};};ami[_0x28b1('0x13')]=function(){return function(){return ami[_0x28b1('0x8')]({'action':_0x28b1('0x14')});};};ami[_0x28b1('0x15')]=function(){return function(){return ami[_0x28b1('0x8')]({'action':_0x28b1('0x16')});};};function connect(){logger[_0x28b1('0x17')](util[_0x28b1('0xb')](_0x28b1('0x18'),config[_0x28b1('0x3')][_0x28b1('0x5')],config[_0x28b1('0x3')]['ip'],config['asterisk']['port']));ami[_0x28b1('0x19')](_0x28b1('0xa'),error);ami[_0x28b1('0x19')](_0x28b1('0x1a'),close);}ami['on'](_0x28b1('0x1b'),connect);ami['on'](_0x28b1('0x1c'),function(_0x2dce10){logger[_0x28b1('0x17')](util[_0x28b1('0xb')](_0x28b1('0x1d'),config[_0x28b1('0x3')][_0x28b1('0x5')],config[_0x28b1('0x3')]['ip'],config[_0x28b1('0x3')]['port'],util[_0x28b1('0xc')](_0x2dce10,![],null)));});ami['on'](_0x28b1('0x1e'),function(){logger[_0x28b1('0x17')](util[_0x28b1('0xb')](_0x28b1('0x1f'),config['asterisk'][_0x28b1('0x5')],config[_0x28b1('0x3')]['ip'],config['asterisk'][_0x28b1('0x4')]));return Promise[_0x28b1('0x20')]()[_0x28b1('0x21')](ami[_0x28b1('0xe')]())[_0x28b1('0x21')](ami[_0x28b1('0x22')]())[_0x28b1('0x21')](ami[_0x28b1('0x11')]())[_0x28b1('0x21')](ami[_0x28b1('0x13')]())[_0x28b1('0x21')](ami[_0x28b1('0x15')]())[_0x28b1('0x23')](function(_0x44c984){logger[_0x28b1('0xa')]('[ami.js][fullybooted]',util[_0x28b1('0xc')](_0x44c984,{'showHidden':![],'depth':null}));});});ami['once'](_0x28b1('0xa'),error);ami[_0x28b1('0x19')](_0x28b1('0x1a'),close);module['exports']=ami; \ No newline at end of file +var _0x494f=['fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionQueueSummary','catch','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','util','../../config/environment','asterisk','port','password','keepConnected','Action','promisify','action','format','username','inspect','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','actionSipPeerStatus','queuesummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s'];(function(_0xf08e89,_0x1b9466){var _0x4042da=function(_0x2df606){while(--_0x2df606){_0xf08e89['push'](_0xf08e89['shift']());}};_0x4042da(++_0x1b9466);}(_0x494f,0x13a));var _0xf494=function(_0x2d2258,_0x2ce510){_0x2d2258=_0x2d2258-0x0;var _0x18e155=_0x494f[_0x2d2258];return _0x18e155;};'use strict';var Manager=require(_0xf494('0x0'));var BPromise=require(_0xf494('0x1'));var util=require(_0xf494('0x2'));var logger=require('../../config/logger')('ami');var config=require(_0xf494('0x3'));var ami=new Manager(config[_0xf494('0x4')][_0xf494('0x5')],config[_0xf494('0x4')]['ip'],config[_0xf494('0x4')]['username'],config['asterisk'][_0xf494('0x6')],!![]);ami[_0xf494('0x7')]();ami[_0xf494('0x8')]=BPromise[_0xf494('0x9')](ami[_0xf494('0xa')]);function error(_0x5a9a4f){logger['error'](util[_0xf494('0xb')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0xf494('0x4')][_0xf494('0xc')],config['asterisk']['ip'],config[_0xf494('0x4')][_0xf494('0x5')],util[_0xf494('0xd')](_0x5a9a4f,![],null)));}function close(){logger[_0xf494('0xe')](util[_0xf494('0xb')](_0xf494('0xf'),config[_0xf494('0x4')][_0xf494('0xc')],config[_0xf494('0x4')]['ip'],config[_0xf494('0x4')][_0xf494('0x5')]));}ami[_0xf494('0x10')]=function(){return function(){return ami[_0xf494('0x8')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami['Action']({'action':'devicestatelist'});};};ami[_0xf494('0x11')]=function(){return function(){return ami[_0xf494('0x8')]({'action':'sippeerstatus'});};};ami['actionQueueSummary']=function(){return function(){return ami[_0xf494('0x8')]({'action':_0xf494('0x12')});};};ami[_0xf494('0x13')]=function(){return function(){return ami[_0xf494('0x8')]({'action':'coreshowchannels'});};};function connect(){logger[_0xf494('0x14')](util['format'](_0xf494('0x15'),config[_0xf494('0x4')][_0xf494('0xc')],config['asterisk']['ip'],config[_0xf494('0x4')]['port']));ami['once'](_0xf494('0xe'),error);ami[_0xf494('0x16')](_0xf494('0x17'),close);}ami['on'](_0xf494('0x18'),connect);ami['on']('shutdown',function(_0x1d7c47){logger[_0xf494('0x14')](util['format'](_0xf494('0x19'),config[_0xf494('0x4')][_0xf494('0xc')],config[_0xf494('0x4')]['ip'],config['asterisk'][_0xf494('0x5')],util['inspect'](_0x1d7c47,![],null)));});ami['on'](_0xf494('0x1a'),function(){logger['info'](util['format'](_0xf494('0x1b'),config[_0xf494('0x4')]['username'],config['asterisk']['ip'],config[_0xf494('0x4')]['port']));return Promise[_0xf494('0x1c')]()[_0xf494('0x1d')](ami[_0xf494('0x10')]())[_0xf494('0x1d')](ami['actionDeviceStateList']())[_0xf494('0x1d')](ami[_0xf494('0x11')]())[_0xf494('0x1d')](ami[_0xf494('0x1e')]())[_0xf494('0x1d')](ami[_0xf494('0x13')]())[_0xf494('0x1f')](function(_0x1e6cd9){logger[_0xf494('0xe')](_0xf494('0x20'),util['inspect'](_0x1e6cd9,{'showHidden':![],'depth':null}));});});ami[_0xf494('0x16')](_0xf494('0xe'),error);ami[_0xf494('0x16')]('close',close);module[_0xf494('0x21')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index acac1c9..d738d39 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 _0xe706=['result','catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','request','then','debug','rpc','memberReport','error','message'];(function(_0x1f0679,_0x53d43c){var _0x3dc3a4=function(_0x49ba8f){while(--_0x49ba8f){_0x1f0679['push'](_0x1f0679['shift']());}};_0x3dc3a4(++_0x53d43c);}(_0xe706,0xa3));var _0x6e70=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xe706[_0x3b380d];return _0x54502b;};'use strict';var jayson=require(_0x6e70('0x0'));var BPromise=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('ami');var client=jayson[_0x6e70('0x3')][_0x6e70('0x4')]({'port':0x2329});client[_0x6e70('0x5')]=function(_0x7dfbc3,_0x142c27){return new BPromise(function(_0x2164a4,_0x376a8d){return client[_0x6e70('0x6')](_0x7dfbc3,_0x142c27)[_0x6e70('0x7')](function(_0x4381d1){logger[_0x6e70('0x8')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x142c27,_0x4381d1);if(_0x4381d1[_0x6e70('0xb')]){logger[_0x6e70('0xb')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')],_0x142c27);return _0x376a8d(_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')]);}else{return _0x2164a4(_0x4381d1[_0x6e70('0xd')]);}})[_0x6e70('0xe')](function(_0x4600f9){logger['error']('rpc',_0x6e70('0xa'),_0x7dfbc3,_0x4600f9,_0x142c27);return _0x376a8d(_0x4600f9);});});};module[_0x6e70('0xf')]=client; \ No newline at end of file +var _0xe706=['result','catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','request','then','debug','rpc','memberReport','error','message'];(function(_0x93942f,_0xb48547){var _0x23fcd8=function(_0x4728be){while(--_0x4728be){_0x93942f['push'](_0x93942f['shift']());}};_0x23fcd8(++_0xb48547);}(_0xe706,0xa3));var _0x6e70=function(_0x2ba9ac,_0xa1fdc4){_0x2ba9ac=_0x2ba9ac-0x0;var _0x1b0fc9=_0xe706[_0x2ba9ac];return _0x1b0fc9;};'use strict';var jayson=require(_0x6e70('0x0'));var BPromise=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('ami');var client=jayson[_0x6e70('0x3')][_0x6e70('0x4')]({'port':0x2329});client[_0x6e70('0x5')]=function(_0x7dfbc3,_0x142c27){return new BPromise(function(_0x2164a4,_0x376a8d){return client[_0x6e70('0x6')](_0x7dfbc3,_0x142c27)[_0x6e70('0x7')](function(_0x4381d1){logger[_0x6e70('0x8')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x142c27,_0x4381d1);if(_0x4381d1[_0x6e70('0xb')]){logger[_0x6e70('0xb')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')],_0x142c27);return _0x376a8d(_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')]);}else{return _0x2164a4(_0x4381d1[_0x6e70('0xd')]);}})[_0x6e70('0xe')](function(_0x4600f9){logger['error']('rpc',_0x6e70('0xa'),_0x7dfbc3,_0x4600f9,_0x142c27);return _0x376a8d(_0x4600f9);});});};module[_0x6e70('0xf')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index cbbcb2b..f77a795 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 _0xaba5=['reason','agiafterat','dialAgiAfterHangupAgent','createHistory','moveContactManagedDialer','[syncAgentComplete]','updateOriginated','droptime','responsetime','outboundDropCallsDayTimeout','Drop','TIMEOUT','countdropretry','countglobal','dialDropRetryFrequency','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','minutes','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','predictiveIntervalDroppedCallsCallersExit','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','callAdditionalPhoneAfterMin','dialAbandonedMaxRetry','add','ContactId','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','rrmemory','isNil','paused','stateinterface','locked','merge','roundrobin','preview','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','length','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','HANGUP','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','membername','AMD','custom:amd','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','countmachineretry','buildObj','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','Machine','dialMachineMaxRetry','createStateFinal','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','Unknow','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','inUse','talking','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','syncQueueSummaryComplete','throttle','filter','dialPreviewRecallmeReminder','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','No\x20such\x20channel','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','notFound','UserId','[emptyContact][createHistory]','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','handleIvr','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','Trunk','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','substring','dialCutDigit','trim','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','countnoanswerretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','entity\x20is\x20undefine','evt\x20is\x20undefine','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberRetryFrequency','checkRetriveMax','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','reason\x205\x20busy','outboundCongestionCallsDay','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','custom:agentreject','agentreject','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','outboundUnknownCallsDay','[callProgressDetecting]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','round','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','busyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','abandonmentRate','[CatchErlangB]','agentBusyFactor','loggedIn','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','actionOriginate','scheduledat','unlockContact','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','inBlackList','limitCalls','checkContactEmpty','NO_AVAILABLE_CONTACTS','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','countReScheduled','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','getContactDialer','dialOrderByScheduledAt','--------\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','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','Umin\x20=\x20','exports','util','lodash','moment','ioredis','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','../ami','defaults','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','emit','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','voice:queue:%s','name','voice_queue:save','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','info','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','isUndefined','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','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','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','erlangAbandonmentRate','getSeconds','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','temp','contactsRescheduled','message','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','CAMPAIGN_STATUS','state','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','stringify','pick','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','Interval','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','format','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','[ifTime][Action]','Error','isTrunkReachable','active','SIP/%s','status','reachable','unmonitored','TrunkBackup','TRUNK_NOT_REACHABLE','checkIfTime','ifTimeIvr','ifTime','Failure','\x20Intervals\x20is\x20null\x20','UNKNOWN_TIMEZONE','isArray','Action','content','indexOf','push','command','iftime\x20%s,%s','timezones','true','catch','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','resetActiveCalls','syncCampaigns','undefined','resolve','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','Timezone:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','queue','uniqueid','type','ivr','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaba5,0x154));var _0x5aba=function(_0x15f72d,_0x210047){_0x15f72d=_0x15f72d-0x0;var _0x497fac=_0xaba5[_0x15f72d];return _0x497fac;};'use strict';var util=require(_0x5aba('0x0'));var _=require(_0x5aba('0x1'));var uuid=require('uuid');var moment=require(_0x5aba('0x2'));var rr=require('rr');var Redis=require(_0x5aba('0x3'));var utils=require('./utils');var hopperUtils=require(_0x5aba('0x4'));var ut=require(_0x5aba('0x5'));var config=require(_0x5aba('0x6'));var logger=require('../../../config/logger')('dialer');var loggerBooked=require(_0x5aba('0x7'))(_0x5aba('0x8'));var loggerPredictive=require(_0x5aba('0x7'))(_0x5aba('0x9'));var loggerPredictiveCalls=require(_0x5aba('0x7'))(_0x5aba('0xa'));var loggerSyncQueueSummary=require(_0x5aba('0x7'))(_0x5aba('0xb'));var ami=require(_0x5aba('0xc'));config['redis']=_[_0x5aba('0xd')](config[_0x5aba('0xe')],{'host':_0x5aba('0xf'),'port':0x18eb});var io=require(_0x5aba('0x10'))(new Redis(config['redis']));var cmHopper=require(_0x5aba('0x11'));var voiceQueueRt=require(_0x5aba('0x12'));var RpcSetting=require(_0x5aba('0x13'));var Interval=require(_0x5aba('0x14'));var Action=require(_0x5aba('0x15'));var History=require(_0x5aba('0x16'));var Final=require(_0x5aba('0x17'));var AgentComplete=require(_0x5aba('0x18'));var QueueCallerAbandon=require(_0x5aba('0x19'));var Hangup=require(_0x5aba('0x1a'));var ipAgi=process[_0x5aba('0x1b')][_0x5aba('0x1c')]||_0x5aba('0x1d');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x5aba('0x1e')][_0x5aba('0x1f')]=function(_0x1f8f2e){this[_0x5aba('0x20')]=this['tail']?this[_0x5aba('0x20')][_0x5aba('0x21')](_0x1f8f2e):_0x1f8f2e();};function Dialer(_0x4a9bb5,_0x3b6853){this[_0x5aba('0x22')]=new Sequence();this['preview']=_0x3b6853;this[_0x5aba('0x23')]=_0x4a9bb5[_0x5aba('0x23')];this[_0x5aba('0x24')]=_0x4a9bb5[_0x5aba('0x24')];this[_0x5aba('0x25')]=_0x4a9bb5[_0x5aba('0x25')];this[_0x5aba('0x26')]=_0x4a9bb5[_0x5aba('0x26')];this[_0x5aba('0x27')]=config[_0x5aba('0x27')]||0x2;this['channels']={};this[_0x5aba('0x28')]={};this['contactsId']={};this[_0x5aba('0x29')]={};this[_0x5aba('0x2a')]={};this[_0x5aba('0x2b')]={};this[_0x5aba('0x2c')]={};this[_0x5aba('0x2d')]={};this[_0x5aba('0x2e')]={};this[_0x5aba('0x2f')]={};this[_0x5aba('0x30')]={};ami['on'](_0x5aba('0x31'),this[_0x5aba('0x32')][_0x5aba('0x33')](this));ami['on'](_0x5aba('0x34'),this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0x5aba('0x35'),this[_0x5aba('0x36')][_0x5aba('0x33')](this));ami['on'](_0x5aba('0x37'),this[_0x5aba('0x38')][_0x5aba('0x33')](this));ami['on'](_0x5aba('0x39'),this[_0x5aba('0xb')][_0x5aba('0x33')](this));ami['on'](_0x5aba('0x3a'),this['syncQueueSummaryComplete'][_0x5aba('0x33')](this));ami['on'](_0x5aba('0x3b'),this[_0x5aba('0x3c')]['bind'](this));ami['on'](_0x5aba('0x3d'),this[_0x5aba('0x3e')][_0x5aba('0x33')](this));ami['on'](_0x5aba('0x3f'),this[_0x5aba('0x40')][_0x5aba('0x33')](this));ami['on'](_0x5aba('0x41'),this[_0x5aba('0x42')][_0x5aba('0x33')](this));ami['on'](_0x5aba('0x43'),this[_0x5aba('0x44')][_0x5aba('0x33')](this));this[_0x5aba('0x45')]();this[_0x5aba('0x46')]();RpcSetting[_0x5aba('0x47')]()[_0x5aba('0x48')](function(_0x4c26b2){previewRecallmeReminderInterval=_0x4c26b2[_0x5aba('0x49')];});}function isNotNull(_0x2d5717){return _0x2d5717!==null&&!_['isUndefined'](_0x2d5717);}function msgResponse(_0x33b2d4,_0x29f308,_0x337edb){return{'action':_0x33b2d4,'response':_0x29f308,'message':_0x337edb,'stack':_0x337edb};}function emit(_0xe1c180,_0x531fce,_0x544342){io['to'](_0xe1c180)[_0x5aba('0x4a')](_0x531fce,_0x544342);}function emitOutboundVoiceQueueSummary(_0x4bace7){if(_0x4bace7['type']==='outbound'){logger[_0x5aba('0x4b')](_0x5aba('0x4c'),util[_0x5aba('0x4d')](_0x4bace7,{'showHidden':![],'depth':null}));emit(util['format'](_0x5aba('0x4e'),_0x4bace7[_0x5aba('0x4f')]),_0x5aba('0x50'),_0x4bace7);}}function checkGetDataPredictive(_0x2ae465){if(isNotNull(_0x2ae465)&&!_['isEmpty'](_0x2ae465)){loggerPredictive['info'](_0x5aba('0x51'));loggerPredictive['info'](_0x5aba('0x52'),_0x2ae465[_0x5aba('0x53')]);loggerPredictive[_0x5aba('0x54')](_0x5aba('0x55'),_0x2ae465[_0x5aba('0x56')]);loggerPredictive['info'](_0x5aba('0x57'),_0x2ae465[_0x5aba('0x58')]);loggerPredictive[_0x5aba('0x54')](_0x5aba('0x59'),_0x2ae465['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x5aba('0x54')](_0x5aba('0x5a'),_0x2ae465[_0x5aba('0x5b')]);loggerPredictive[_0x5aba('0x54')](_0x5aba('0x5c'),_0x2ae465[_0x5aba('0x5d')]);loggerPredictive[_0x5aba('0x54')](_0x5aba('0x5e'));if(_0x2ae465[_0x5aba('0x53')]>0x0){if(!_[_0x5aba('0x5f')](_0x2ae465[_0x5aba('0x5d')])&&_0x2ae465[_0x5aba('0x5d')]>0x0){return!![];}loggerPredictive[_0x5aba('0x54')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_['isUndefined'](_0x2ae465[_0x5aba('0x5b')])&&_0x2ae465[_0x5aba('0x5b')]>0x0){return!![];}loggerPredictive[_0x5aba('0x54')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x5aba('0x54')](_0x5aba('0x60'));}}else{loggerPredictive[_0x5aba('0x54')](_0x5aba('0x61'));}return![];}function mergeDataErlangB(_0xe72527){return function(_0x1bf018){loggerPredictive[_0x5aba('0x54')](_0x5aba('0x62'));loggerPredictive['info']('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1bf018[_0x5aba('0x63')]);loggerPredictive[_0x5aba('0x54')](_0x5aba('0x64'),_0x1bf018[_0x5aba('0x65')]);loggerPredictive[_0x5aba('0x54')](_0x5aba('0x66'),_0x1bf018['erlangAbandonmentRate']);loggerPredictive[_0x5aba('0x54')](_0x5aba('0x67'),_0x1bf018[_0x5aba('0x68')]);loggerPredictive[_0x5aba('0x54')](_0x5aba('0x66'),_0x1bf018[_0x5aba('0x69')]);loggerPredictive['info'](_0x5aba('0x5e'));_['merge'](_0xe72527,_0x1bf018);};}function ifInterval(_0x387c59,_0x2054c5){if(_[_0x5aba('0x5f')](_0x2054c5)){return![];}return utils[_0x5aba('0x6a')](undefined,_0x2054c5)<_0x387c59*0x3c;}function clearPredictiveAttributes(_0x47cb3c){if(_0x47cb3c[_0x5aba('0x2c')]){_0x47cb3c[_0x5aba('0x2c')]=undefined;loggerPredictive[_0x5aba('0x4b')](_0x47cb3c['name'],_0x5aba('0x6b'));}if(_0x47cb3c[_0x5aba('0x2b')]){_0x47cb3c[_0x5aba('0x2b')]=undefined;loggerPredictive['debug'](_0x47cb3c['name'],_0x5aba('0x6c'));}if(_0x47cb3c[_0x5aba('0x6d')]){clearInterval(_0x47cb3c[_0x5aba('0x6d')]);_0x47cb3c['handlePredictive']=undefined;loggerPredictive[_0x5aba('0x4b')](_0x47cb3c['name'],_0x5aba('0x6e'));}}function loggerCatchPredictive(_0x3cbaf7,_0x144824){return function(_0x38f515){loggerPredictive[_0x5aba('0x6f')](_0x144824[_0x5aba('0x4f')],_0x3cbaf7);loggerPredictive[_0x5aba('0x6f')](_0x38f515[_0x5aba('0x70')]);clearPredictiveAttributes(_0x144824);};}function loggerCatch(_0x1a13e2){return function(_0x247847){logger[_0x5aba('0x6f')](_0x1a13e2,util[_0x5aba('0x4d')](_0x247847,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x4915f4,_0x3c5923,_0x102874){return function(_0x3b9c03){utils[_0x5aba('0x71')](_0x3c5923,_0x102874,0x0);_0x3c5923[_0x5aba('0x72')]=0x0;logger[_0x5aba('0x6f')](_0x4915f4,util[_0x5aba('0x4d')](_0x3b9c03,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x44f987){return function(_0x233f4f){if(isNotNull(_0x233f4f)&&isNotNull(_0x233f4f[0x0])){if(_0x233f4f[0x0][_0x5aba('0x73')]>0x0){_0x44f987[_0x5aba('0x74')]=utils['CAMPAIGN_STATUS'][_0x5aba('0x75')];logger['info'](_0x5aba('0x76')+_0x44f987[_0x5aba('0x4f')],_0x233f4f[0x0][_0x5aba('0x73')],_0x5aba('0x77'));}else{_0x44f987[_0x5aba('0x74')]=utils[_0x5aba('0x78')]['NO_AVAILABLE_CONTACTS'];logger[_0x5aba('0x54')]('[getContactDialer2][Empty]'+_0x44f987[_0x5aba('0x4f')]);}}};}function createObjHistory(_0x37e43c,_0x3cf4cb,_0x909795,_0x454289,_0x3f104f){_0x37e43c[_0x5aba('0x74')]=_0x909795;var _0x5426c6=new Action(_0x37e43c,_0x3cf4cb);var _0x341bee=new History(_0x5426c6);_0x341bee[_0x5aba('0x79')]=_0x454289;_0x341bee[_0x5aba('0x7a')]=_0x3f104f;_0x341bee[_0x5aba('0x7b')]=_0x5426c6[_0x5aba('0x7c')];return _0x341bee;}function unlockQueueStatus(_0x24ccb7,_0x8eef36){setTimeout(function(){if(_[_0x5aba('0x5f')](_0x24ccb7[_0x5aba('0x7d')])){loggerBooked[_0x5aba('0x6f')](_0x5aba('0x7e'),_0x8eef36);}_0x24ccb7[_0x5aba('0x7d')]=!![];loggerBooked[_0x5aba('0x54')]('[booked][unlockQueueStatus]',_0x8eef36,JSON[_0x5aba('0x7f')](_[_0x5aba('0x80')](_0x24ccb7,['name',_0x5aba('0x7d')])));},0x1f3);}function checkInterval(_0x3dda0c){return function(){if(!isNotNull(_0x3dda0c['Interval'])){_0x3dda0c[_0x5aba('0x74')]=utils[_0x5aba('0x78')][_0x5aba('0x81')];throw _0x3dda0c[_0x5aba('0x4f')]+_0x5aba('0x82');}if(!isNotNull(_0x3dda0c['Interval'][_0x5aba('0x83')])){_0x3dda0c[_0x5aba('0x74')]=utils[_0x5aba('0x78')][_0x5aba('0x81')];throw _0x3dda0c[_0x5aba('0x4f')]+_0x5aba('0x82');}if(!isNotNull(_[_0x5aba('0x84')](_0x3dda0c[_0x5aba('0x85')]['Intervals']))){_0x3dda0c['message']=utils[_0x5aba('0x78')]['NULL_INTERVAL'];throw _0x3dda0c[_0x5aba('0x4f')]+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0x2d9225){return function(){if(!utils[_0x5aba('0x86')](_0x2d9225)){_0x2d9225[_0x5aba('0x74')]=utils[_0x5aba('0x78')][_0x5aba('0x87')];throw _0x2d9225['name']+_0x5aba('0x88');}};}function emitCampaignSummary(_0x3de237){if(utils[_0x5aba('0x89')](_0x3de237)){emit(util[_0x5aba('0x8a')](_0x5aba('0x8b'),_0x3de237['name']),_0x5aba('0x8c'),_0x3de237);}}function loggerCatchQueueSummary(_0x42ad26,_0x1e5049){return function(_0x306382){clearPredictiveAttributes(_0x1e5049);emitCampaignSummary(_0x1e5049);loggerSyncQueueSummary[_0x5aba('0x4b')](_0x42ad26,util[_0x5aba('0x4d')](_0x306382,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x3ae30a){if(_0x3ae30a[_0x5aba('0x8d')]){if(_0x3ae30a[_0x5aba('0x8e')]===0x0){_0x3ae30a['sendMessageOneNotActive']=![];_0x3ae30a['message']=utils[_0x5aba('0x78')]['INACTIVE'];loggerSyncQueueSummary['debug'](_0x5aba('0x8f'),_0x3ae30a['name'],_0x5aba('0x90'));}else{_0x3ae30a['message']=utils[_0x5aba('0x78')][_0x5aba('0x91')];loggerSyncQueueSummary[_0x5aba('0x4b')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x3ae30a[_0x5aba('0x4f')],_0x5aba('0x92'));}emitCampaignSummary(_0x3ae30a);}}function myreject(_0x5886a0){return function(_0x12bd82){return _0x5886a0(msgResponse(_0x5aba('0x93'),_0x5aba('0x94'),JSON['stringify'](_0x12bd82)));};}Dialer[_0x5aba('0x1e')][_0x5aba('0x95')]=function(_0x218c21){return!_[_0x5aba('0x5f')](_0x218c21)&&_0x218c21&&!_[_0x5aba('0x5f')](_0x218c21[_0x5aba('0x4f')])&&!_[_0x5aba('0x5f')](_0x218c21[_0x5aba('0x96')])&&_0x218c21[_0x5aba('0x96')]&&(this[_0x5aba('0x26')][util[_0x5aba('0x8a')](_0x5aba('0x97'),_0x218c21[_0x5aba('0x4f')])][_0x5aba('0x98')]===_0x5aba('0x99')||this[_0x5aba('0x26')][util[_0x5aba('0x8a')](_0x5aba('0x97'),_0x218c21[_0x5aba('0x4f')])][_0x5aba('0x98')]===_0x5aba('0x9a'));};Dialer['prototype']['checkIsTrunkReachable']=function(_0x2cd6f1){var _0x12ed25=this;return function(){if(!_0x12ed25[_0x5aba('0x95')](_0x2cd6f1['Trunk'])){if(!_0x12ed25[_0x5aba('0x95')](_0x2cd6f1[_0x5aba('0x9b')])){_0x2cd6f1[_0x5aba('0x74')]=utils[_0x5aba('0x78')][_0x5aba('0x9c')];throw _0x2cd6f1[_0x5aba('0x4f')]+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer[_0x5aba('0x1e')][_0x5aba('0x9d')]=function(_0x17547e,_0x4cc6c9,_0x186168,_0x38cd9e){var _0x32da03=this;return function(){var _0x25c660=!![];return _0x32da03[_0x5aba('0x9e')](_0x17547e,_0x4cc6c9,_0x186168,_0x38cd9e,_0x25c660);};};Dialer[_0x5aba('0x1e')]['checkIfTimeIntervals']=function(_0x13d960,_0x18b0cf,_0x59ea81,_0x34419f){var _0x4bf92f=this;return function(){var _0x48db46=![];return _0x4bf92f['ifTimeIvr'](_0x13d960[_0x5aba('0x83')],_0x18b0cf,_0x59ea81,_0x34419f,_0x48db46);};};Dialer[_0x5aba('0x1e')][_0x5aba('0x9e')]=function(_0xe44988,_0x462d35,_0x1f86e0,_0x3def33,_0x5a1752){var _0x5c8efa=[];return new Promise(function(_0x596931,_0x54570c){if(!isNotNull(_0xe44988)){_0x3def33['message']=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];return _0x54570c(msgResponse(_0x5aba('0x9f'),_0x5aba('0xa0'),_0x1f86e0+_0x5aba('0xa1')));}if(_[_0x5aba('0x84')](_0xe44988)){_0x3def33[_0x5aba('0x74')]=utils[_0x5aba('0x78')]['EMPTY_INTERVAL'];return _0x54570c(msgResponse(_0x5aba('0x9f'),_0x5aba('0xa0'),_0x1f86e0+'\x20Intervals\x20is\x20empty\x20'));}if(_0x462d35&&_['isUndefined'](config['timezones'][_0x462d35])){_0x3def33[_0x5aba('0x74')]=utils[_0x5aba('0x78')][_0x5aba('0xa2')];return _0x54570c(msgResponse('ifTime',_0x5aba('0xa0'),_0x1f86e0+'\x20Timezone\x20unknow\x20'+_0x462d35));}if(_[_0x5aba('0xa3')](_0xe44988)){for(var _0xc7bb20=0x0;_0xc7bb20<_0xe44988['length'];_0xc7bb20+=0x1){_0x5c8efa['push'](ami[_0x5aba('0xa4')]({'action':'command','command':util[_0x5aba('0x8a')]('iftime\x20%s,%s',_0xe44988[_0xc7bb20]['interval'],!_[_0x5aba('0x5f')](config['timezones'][_0x462d35])?_0x462d35:'')})[_0x5aba('0x48')](function(_0x4354ad){return _0x4354ad[_0x5aba('0xa5')][_0x5aba('0xa6')]('true')>=0x0;})['catch'](myreject(_0x54570c)));}}else{_0x5c8efa[_0x5aba('0xa7')](ami[_0x5aba('0xa4')]({'action':_0x5aba('0xa8'),'command':util[_0x5aba('0x8a')](_0x5aba('0xa9'),_0xe44988,!_[_0x5aba('0x5f')](config[_0x5aba('0xaa')][_0x462d35])?_0x462d35:'')})[_0x5aba('0x48')](function(_0x41ef88){return _0x41ef88[_0x5aba('0xa5')][_0x5aba('0xa6')](_0x5aba('0xab'))>=0x0;})[_0x5aba('0xac')](myreject(_0x54570c)));}Promise[_0x5aba('0xad')](_0x5c8efa)[_0x5aba('0x48')](function(_0x5303ca){var _0xfb4b79=_[_0x5aba('0xae')](_0x5303ca);if(_0xfb4b79){return _0x596931(_0xfb4b79);}else{_0x3def33[_0x5aba('0x74')]=_0x5a1752?utils[_0x5aba('0x78')][_0x5aba('0xaf')]:utils[_0x5aba('0x78')][_0x5aba('0xb0')];return _0x54570c(msgResponse(_0x5aba('0xb1'),_0x5aba('0xa0'),'Global:\x20'+_0x5a1752+'\x20'+_0x1f86e0+_0x5aba('0xb2')+util['inspect'](_0xe44988,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x462d35));}})[_0x5aba('0xac')](function(_0x46d6f9){return _0x54570c(msgResponse(_0x5aba('0x9f'),_0x5aba('0xa0'),JSON[_0x5aba('0x7f')](_0x46d6f9)));});});};Dialer[_0x5aba('0x1e')][_0x5aba('0x45')]=function(){var _0xfd4b63=this;return cmHopper[_0x5aba('0xb3')]({'active':![]},{'where':{'active':!![]}})[_0x5aba('0x48')](function(){setInterval(function(){_0xfd4b63['syncCampaigns']();},0x3e8);});};Dialer[_0x5aba('0x1e')][_0x5aba('0xb4')]=function(){var _0x27ee44=this;var _0x1edc74;for(var _0x3d8f75 in this[_0x5aba('0x24')]){if(typeof this[_0x5aba('0x24')][_0x3d8f75]!==_0x5aba('0xb5')){_0x1edc74=this[_0x5aba('0x24')][_0x3d8f75];if(utils['isIVRCampaign'](_0x1edc74)&&utils[_0x5aba('0x86')](_0x1edc74)){_0x1edc74[_0x5aba('0x8d')]=!![];Promise[_0x5aba('0xb6')]()[_0x5aba('0x48')](checkIsIVRCampaignActive(_0x1edc74))[_0x5aba('0x48')](checkInterval(_0x1edc74))[_0x5aba('0x48')](_0x27ee44[_0x5aba('0xb7')](_0x1edc74))[_0x5aba('0x48')](_0x27ee44[_0x5aba('0x9d')](_0x1edc74[_0x5aba('0xb8')],_0x1edc74[_0x5aba('0xb9')],_0x1edc74[_0x5aba('0x4f')],_0x1edc74))[_0x5aba('0x48')](_0x27ee44[_0x5aba('0xba')](_0x1edc74[_0x5aba('0x85')],_0x1edc74['dialTimezone'],_0x1edc74[_0x5aba('0x4f')],_0x1edc74))[_0x5aba('0x48')](_0x27ee44[_0x5aba('0xbb')](_0x1edc74))[_0x5aba('0xac')](loggerCatchQueueSummary(_0x5aba('0xbc'),_0x1edc74));}else{notSendMessagesCampaign(_0x1edc74);}}}};Dialer[_0x5aba('0x1e')][_0x5aba('0xbd')]=function(_0x423c56){if(_0x423c56[_0x5aba('0xbe')]!=='predictive'){clearPredictiveAttributes(_0x423c56);}switch(_0x423c56[_0x5aba('0xbe')]){case _0x5aba('0xbf'):this[_0x5aba('0xc0')](_0x423c56,0x1);break;case _0x5aba('0xc1'):this[_0x5aba('0xc0')](_0x423c56,_0x423c56[_0x5aba('0xc2')]);break;case _0x5aba('0x9'):this[_0x5aba('0x9')](_0x423c56);break;case'booked':this[_0x5aba('0xc0')](_0x423c56,0x1);break;default:logger['error'](_0x5aba('0xc3'),_0x423c56['name'],_0x5aba('0xc4'));}};Dialer['prototype'][_0x5aba('0x9f')]=function(_0x57f4a7,_0x358a32){var _0x18c4f3=_0x57f4a7[_0x5aba('0xb9')];var _0x3666c6=_0x358a32?_0x57f4a7['dialGlobalInterval']:_0x57f4a7[_0x5aba('0x85')][_0x5aba('0x83')];logger[_0x5aba('0xc5')](_0x5aba('0xc6'),_0x3666c6,_0x18c4f3,_0x57f4a7['name'],util['format'](_0x5aba('0xc7'),_0x57f4a7[_0x5aba('0x4f')],_0x57f4a7['id']));var _0x35ace2=null;return Interval[_0x5aba('0xc8')](_0x3666c6,_0x18c4f3)[_0x5aba('0x48')](function(_0x160d16){if(_0x160d16===!![]){return _0x160d16;}else{_0x57f4a7[_0x5aba('0x74')]=_0x358a32?utils[_0x5aba('0x78')][_0x5aba('0xaf')]:utils[_0x5aba('0x78')]['OVERTIME_INTERVAL'];_0x35ace2=msgResponse(_0x5aba('0xb1'),_0x5aba('0xa0'),'Global:\x20'+_0x358a32+'\x20'+_0x57f4a7[_0x5aba('0x4f')]+_0x5aba('0xb2')+util[_0x5aba('0x4d')](_0x3666c6,{'showHidden':![],'depth':null})+_0x5aba('0xc9')+_0x18c4f3);}if(_0x35ace2!==null){logger['silly'](_0x5aba('0xca'),_0x35ace2);_0x35ace2[_0x5aba('0xcb')]=_0x358a32;throw _0x35ace2;}})['catch'](function(_0x36ca84){logger[_0x5aba('0x6f')]('AMI\x20IfTime',_0x36ca84);throw msgResponse(_0x5aba('0x93'),_0x5aba('0x94'),util['inspect'](_0x36ca84,{'showHidden':![],'depth':null}));});};Dialer[_0x5aba('0x1e')]['syncAgentConnect']=function(_0x1add8a){if(this[_0x5aba('0x23')][_0x1add8a[_0x5aba('0xcc')]]){if(this['uniqueId'][_0x1add8a[_0x5aba('0xcd')]]&&this[_0x5aba('0x29')][_0x1add8a[_0x5aba('0xcd')]][_0x5aba('0xce')]!==_0x5aba('0xcf')){this['updateOriginated'](this['voiceQueues'][_0x1add8a[_0x5aba('0xcc')]]);this[_0x5aba('0x29')][_0x1add8a[_0x5aba('0xcd')]]['answertime']=moment()[_0x5aba('0x8a')](_0x5aba('0xd0'));}}};Dialer[_0x5aba('0x1e')][_0x5aba('0x38')]=function(_0x4338f9){var _0x540d18=this[_0x5aba('0x29')][_0x4338f9[_0x5aba('0xcd')]];if(this[_0x5aba('0x23')][_0x4338f9[_0x5aba('0xcc')]]){if(_0x540d18&&_0x540d18[_0x5aba('0xce')]!=='ivr'){delete this[_0x5aba('0x29')][_0x4338f9['uniqueid']];this['voiceQueues'][_0x4338f9['queue']]['outboundAnswerCallsDay']+=0x1;var _0x364cba=new AgentComplete(_0x540d18,_0x4338f9);if(_0x4338f9[_0x5aba('0xd1')]==='agent'){_0x364cba[_0x5aba('0xd2')]=this[_0x5aba('0x23')][_0x4338f9[_0x5aba('0xcc')]]['dialQueueProject2']&&this[_0x5aba('0x23')][_0x4338f9[_0x5aba('0xcc')]][_0x5aba('0xd3')]?moment()['format'](_0x5aba('0xd0')):undefined;}hopperUtils[_0x5aba('0xd4')](_0x364cba)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0x5aba('0xd5')](_0x364cba)[_0x5aba('0xac')](loggerCatch(_0x5aba('0xd6')));}}};Dialer['prototype']['syncQueueCallerAbandon']=function(_0x4a7a9b){var _0xeac363=this[_0x5aba('0x29')][_0x4a7a9b[_0x5aba('0xcd')]];var _0x4a8621=this;var _0x4a3c50=![];var _0x365032;var _0x125e64;if(this[_0x5aba('0x23')][_0x4a7a9b['queue']]){if(_0xeac363&&_0xeac363['type']!==_0x5aba('0xcf')){delete this[_0x5aba('0x29')][_0x4a7a9b[_0x5aba('0xcd')]];this[_0x5aba('0xd7')](this[_0x5aba('0x23')][_0x4a7a9b['queue']]);_0xeac363[_0x5aba('0xd8')]=moment()['format'](_0x5aba('0xd0'));var _0x2dcd63=new QueueCallerAbandon(_0xeac363,_0x4a7a9b);if(utils[_0x5aba('0x6a')](_0xeac363['droptime'],_0xeac363[_0x5aba('0xd9')])>=_0xeac363['dialQueueTimeout']){this[_0x5aba('0x23')][_0x4a7a9b[_0x5aba('0xcc')]][_0x5aba('0x58')]+=0x1;this[_0x5aba('0x23')][_0x4a7a9b[_0x5aba('0xcc')]][_0x5aba('0xda')]+=0x1;this[_0x5aba('0x23')][_0x4a7a9b[_0x5aba('0xcc')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x2dcd63['state']=0xa;_0x2dcd63['statedesc']=_0x5aba('0xdb');_0x2dcd63['dropreason']=_0x5aba('0xdc');_0x2dcd63[_0x5aba('0xd2')]=this[_0x5aba('0x23')][_0x4a7a9b['queue']]['dialQueueProject2']?moment()[_0x5aba('0x8a')](_0x5aba('0xd0')):undefined;_0x2dcd63[_0x5aba('0xdd')]+=0x1;_0x2dcd63[_0x5aba('0xde')]+=0x1;_0x365032=this[_0x5aba('0x23')][_0x4a7a9b[_0x5aba('0xcc')]][_0x5aba('0xdf')];_0x125e64=this[_0x5aba('0x23')][_0x4a7a9b[_0x5aba('0xcc')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x5aba('0xe0')](_0x2dcd63,_0x2dcd63['state'],_0xeac363[_0x5aba('0xe1')])[_0x5aba('0x48')](function(_0x2badf9){_0x4a3c50=_0x2badf9[_0x5aba('0xe2')]==0x1;if(_0x2dcd63['countdropretry']>=_0x4a8621[_0x5aba('0x23')][_0x4a7a9b[_0x5aba('0xcc')]][_0x5aba('0xe3')]){_0x4a8621[_0x5aba('0xe4')](_0x2dcd63,_0x2badf9[_0x5aba('0xe2')]);}else{hopperUtils[_0x5aba('0xe5')]({'active':![],'countdropretry':_0x2dcd63['countdropretry'],'scheduledat':moment()['add'](_0x4a8621[_0x5aba('0x23')][_0x4a7a9b[_0x5aba('0xcc')]][_0x5aba('0xdf')],_0x5aba('0xe6'))[_0x5aba('0x8a')](_0x5aba('0xd0')),'ContactId':_0xeac363['ContactId'],'ListId':_0xeac363[_0x5aba('0xe7')],'VoiceQueueId':_0xeac363[_0x5aba('0xe8')]||undefined,'CampaignId':_0xeac363[_0x5aba('0xe9')]||undefined})[_0x5aba('0xac')](loggerCatch(_0x5aba('0xea')));var _0x3a645d=new History(_0x2dcd63);_0x3a645d[_0x5aba('0x79')]=0xa;_0x3a645d[_0x5aba('0x7a')]=_0x5aba('0xdb');_0x3a645d[_0x5aba('0x7c')]=moment()[_0x5aba('0x8a')](_0x5aba('0xd0'));_0x3a645d['endtime']=_0x3a645d['starttime'];_0x3a645d[_0x5aba('0xeb')]=_0x2dcd63[_0x5aba('0xeb')];_0x3a645d[_0x5aba('0xec')]=_0x2dcd63[_0x5aba('0xec')];hopperUtils['createHistory'](_0x3a645d)[_0x5aba('0xac')](loggerCatch(_0x5aba('0xed')));}})[_0x5aba('0x48')](function(){if(_0x4a3c50)hopperUtils[_0x5aba('0xee')](_0x2dcd63,_0x365032,_0x125e64)[_0x5aba('0x48')](function(){return 0x1;});});}else{this[_0x5aba('0x23')][_0x4a7a9b[_0x5aba('0xcc')]][_0x5aba('0xef')]+=0x1;this[_0x5aba('0x23')][_0x4a7a9b[_0x5aba('0xcc')]][_0x5aba('0xf0')]+=0x1;_0x2dcd63[_0x5aba('0x79')]=0xb;_0x2dcd63[_0x5aba('0x7a')]=_0x5aba('0xf1');_0x2dcd63['dropreason']=_0x5aba('0xf2');_0x2dcd63[_0x5aba('0xf3')]+=0x1;_0x2dcd63[_0x5aba('0xde')]+=0x1;_0x365032=this[_0x5aba('0x23')][_0x4a7a9b[_0x5aba('0xcc')]][_0x5aba('0xf4')];_0x125e64=this[_0x5aba('0x23')][_0x4a7a9b['queue']][_0x5aba('0xf5')];hopperUtils[_0x5aba('0xe0')](_0x2dcd63,_0x2dcd63[_0x5aba('0x79')],_0xeac363['voiceQueue'])[_0x5aba('0x48')](function(_0x30feef){if(_0x2dcd63[_0x5aba('0xf3')]>=_0x4a8621['voiceQueues'][_0x4a7a9b[_0x5aba('0xcc')]][_0x5aba('0xf6')]){_0x4a8621[_0x5aba('0xe4')](_0x2dcd63,_0x30feef[_0x5aba('0xe2')]);}else{hopperUtils[_0x5aba('0xe5')]({'active':![],'countabandonedretry':_0x2dcd63['countabandonedretry'],'scheduledat':moment()[_0x5aba('0xf7')](_0x4a8621[_0x5aba('0x23')][_0x4a7a9b['queue']]['dialAbandonedRetryFrequency'],_0x5aba('0xe6'))[_0x5aba('0x8a')](_0x5aba('0xd0')),'ContactId':_0xeac363[_0x5aba('0xf8')],'ListId':_0xeac363[_0x5aba('0xe7')],'VoiceQueueId':_0xeac363['VoiceQueueId']||undefined,'CampaignId':_0xeac363[_0x5aba('0xe9')]||undefined})[_0x5aba('0xac')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x24bb60=new History(_0x2dcd63);_0x24bb60[_0x5aba('0x79')]=0xb;_0x24bb60[_0x5aba('0x7a')]=_0x5aba('0xf1');_0x24bb60[_0x5aba('0x7c')]=moment()[_0x5aba('0x8a')](_0x5aba('0xd0'));_0x24bb60[_0x5aba('0x7b')]=_0x24bb60[_0x5aba('0x7c')];_0x24bb60[_0x5aba('0xeb')]=_0x2dcd63[_0x5aba('0xeb')];_0x24bb60[_0x5aba('0xec')]=_0x2dcd63[_0x5aba('0xec')];hopperUtils['createHistory'](_0x24bb60)['catch'](loggerCatch(_0x5aba('0xf9')));}})[_0x5aba('0x48')](function(){if(_0x4a3c50)hopperUtils[_0x5aba('0xee')](_0x2dcd63,_0x365032,_0x125e64)['then'](function(){return 0x1;});});}}}};Dialer['prototype'][_0x5aba('0x3e')]=function(_0x22e612){if(this['actions'][_0x22e612['uniqueid']]){this[_0x5aba('0x28')][_0x22e612[_0x5aba('0xcd')]][_0x5aba('0xfa')]=_0x22e612['channel'];}if(this[_0x5aba('0x29')][_0x22e612[_0x5aba('0xcd')]]){this['uniqueId'][_0x22e612[_0x5aba('0xcd')]]['channel']=_0x22e612[_0x5aba('0xfa')];}};Dialer[_0x5aba('0x1e')]['syncQueueMember']=function(_0x58c519){if(!this[_0x5aba('0x28')][_0x58c519['actionid']]){return;}var _0x5e4790=this['voiceQueues'][this['actions'][_0x58c519[_0x5aba('0xfb')]]['queue']][_0x5aba('0xfc')]||_0x5aba('0xfd');if(_0x5e4790==='roundrobin'){if(this[_0x5aba('0x28')][_0x58c519[_0x5aba('0xfb')]]&&_[_0x5aba('0xfe')](this['actions'][_0x58c519['actionid']]['locked'])&&_0x58c519['status']==='1'&&_0x58c519[_0x5aba('0xff')]==='0'){if(this[_0x5aba('0x25')][_0x58c519['stateinterface']]){if(!this[_0x5aba('0x25')][_0x58c519[_0x5aba('0x100')]][_0x5aba('0x101')]){this[_0x5aba('0x25')][_0x58c519['stateinterface']][_0x5aba('0x101')]=!![];this[_0x5aba('0x28')][_0x58c519[_0x5aba('0xfb')]]['locked']=!![];this['actions'][_0x58c519['actionid']][_0x5aba('0x100')]=_0x58c519[_0x5aba('0x100')];}}}}else if(_0x5e4790==='rrmemory'){if(this['actions'][_0x58c519[_0x5aba('0xfb')]]){if(this[_0x5aba('0x25')][_0x58c519[_0x5aba('0x100')]]){this[_0x5aba('0x28')][_0x58c519[_0x5aba('0xfb')]][_0x5aba('0x100')]=_0x58c519[_0x5aba('0x100')];if(_['isNil'](this['queueBooked'][this['actions'][_0x58c519['actionid']][_0x5aba('0xcc')]])){this[_0x5aba('0x2e')][this['actions'][_0x58c519[_0x5aba('0xfb')]]['queue']]=[];}this['queueBooked'][this[_0x5aba('0x28')][_0x58c519[_0x5aba('0xfb')]][_0x5aba('0xcc')]][_0x5aba('0xa7')](_[_0x5aba('0x102')](_[_0x5aba('0x80')](this[_0x5aba('0x28')][_0x58c519[_0x5aba('0xfb')]],['idHopper','stateinterface']),{'status':_0x58c519[_0x5aba('0x98')],'paused':_0x58c519[_0x5aba('0xff')]}));}}}};Dialer[_0x5aba('0x1e')][_0x5aba('0x44')]=function(_0x1464ab){if(!this[_0x5aba('0x28')][_0x1464ab['actionid']]){return;}var _0x442e8f=this;var _0x5a832f=this[_0x5aba('0x23')][this['actions'][_0x1464ab[_0x5aba('0xfb')]][_0x5aba('0xcc')]];var _0x411ec0=_0x5a832f[_0x5aba('0xfc')]||_0x5aba('0xfd');if(_0x411ec0===_0x5aba('0x103')){if(this['actions'][_0x1464ab['actionid']]&&this[_0x5aba('0x28')][_0x1464ab[_0x5aba('0xfb')]][_0x5aba('0x100')]){this[_0x5aba('0x104')][_0x5aba('0x105')](this[_0x5aba('0x28')][_0x1464ab[_0x5aba('0xfb')]][_0x5aba('0x106')],this[_0x5aba('0x28')][_0x1464ab[_0x5aba('0xfb')]][_0x5aba('0x100')])[_0x5aba('0xac')](function(_0x1ee325){logger[_0x5aba('0x6f')](_0x5aba('0x107'),util['inspect'](_0x1ee325,{'showHidden':![],'depth':null}));})[_0x5aba('0x21')](function(){_0x442e8f[_0x5aba('0xd7')](_0x442e8f['voiceQueues'][_0x442e8f[_0x5aba('0x28')][_0x1464ab[_0x5aba('0xfb')]]['queue']]);_0x442e8f['agents'][_0x442e8f['actions'][_0x1464ab[_0x5aba('0xfb')]][_0x5aba('0x100')]][_0x5aba('0x101')]=![];delete _0x442e8f[_0x5aba('0x28')][_0x1464ab[_0x5aba('0xfb')]];unlockQueueStatus(_0x5a832f);});}else{this[_0x5aba('0xd7')](this[_0x5aba('0x23')][this[_0x5aba('0x28')][_0x1464ab[_0x5aba('0xfb')]][_0x5aba('0xcc')]]);hopperUtils['rescheduleContact']({'active':![],'ContactId':this[_0x5aba('0x28')][_0x1464ab[_0x5aba('0xfb')]][_0x5aba('0xf8')],'ListId':this[_0x5aba('0x28')][_0x1464ab['actionid']][_0x5aba('0xe7')],'VoiceQueueId':this[_0x5aba('0x28')][_0x1464ab[_0x5aba('0xfb')]][_0x5aba('0xe8')]||undefined,'CampaignId':this[_0x5aba('0x28')][_0x1464ab[_0x5aba('0xfb')]][_0x5aba('0xe9')]||undefined})[_0x5aba('0xac')](loggerCatch(_0x5aba('0x108')));delete this['actions'][_0x1464ab[_0x5aba('0xfb')]];unlockQueueStatus(_0x5a832f);}}else if(_0x411ec0==='rrmemory'){var _0x5bb2;if(this[_0x5aba('0x28')][_0x1464ab[_0x5aba('0xfb')]]&&!_[_0x5aba('0x84')](this[_0x5aba('0x2e')][this['actions'][_0x1464ab['actionid']][_0x5aba('0xcc')]])){if(this[_0x5aba('0x2f')][_0x442e8f[_0x5aba('0x28')][_0x1464ab[_0x5aba('0xfb')]][_0x5aba('0xcc')]]){this[_0x5aba('0x2f')][_0x442e8f['actions'][_0x1464ab[_0x5aba('0xfb')]][_0x5aba('0xcc')]]=this['queueBookedRR'][this[_0x5aba('0x28')][_0x1464ab[_0x5aba('0xfb')]][_0x5aba('0xcc')]]?this['queueBookedRR'][this[_0x5aba('0x28')][_0x1464ab[_0x5aba('0xfb')]][_0x5aba('0xcc')]]:this[_0x5aba('0x2e')][this[_0x5aba('0x28')][_0x1464ab[_0x5aba('0xfb')]][_0x5aba('0xcc')]]?this[_0x5aba('0x2e')][this[_0x5aba('0x28')][_0x1464ab[_0x5aba('0xfb')]][_0x5aba('0xcc')]][_0x5aba('0x109')]||0x0:0x0;}this[_0x5aba('0x2e')][this['actions'][_0x1464ab[_0x5aba('0xfb')]][_0x5aba('0xcc')]]['_rr']=this[_0x5aba('0x2f')][this[_0x5aba('0x28')][_0x1464ab[_0x5aba('0xfb')]]['queue']];for(var _0x938562=0x0;_0x938562=_0x3b399d[_0x5aba('0x12e')]){_0xc97b7b[_0x5aba('0x12f')](_0x45435d,_0x2485b1,_0xc62e45,_0x5aba('0x130'));}else{if(_0x45435d[_0x5aba('0x127')]>=_0x3b399d['dialMachineMaxRetry']){_0xc97b7b['createStateFinal'](_0x45435d,_0x2485b1,_0xc62e45,_0x5aba('0x131'));}else{hopperUtils[_0x5aba('0xe5')]({'active':![],'countmachineretry':_0x45435d['countmachineretry'],'scheduledat':moment()[_0x5aba('0xf7')](_0x3b399d[_0x5aba('0x132')],_0x5aba('0xe6'))['format'](_0x5aba('0xd0')),'ContactId':_0x45435d[_0x5aba('0xf8')],'ListId':_0x45435d[_0x5aba('0xe7')],'VoiceQueueId':_0x45435d[_0x5aba('0xe8')]||undefined,'CampaignId':_0x45435d[_0x5aba('0xe9')]||undefined})[_0x5aba('0xac')](loggerCatch(_0x5aba('0x133')));_0x2485b1({'reschedule':0x1});}}});}if(_0x4eb6b5[_0x5aba('0xce')]===_0x5aba('0xcf')&&this[_0x5aba('0x24')][_0x4eb6b5[_0x5aba('0xcc')]]['dialAMDActive']&&_0x35f9d4['value']===_0x5aba('0x11d')){delete this[_0x5aba('0x29')][_0x35f9d4[_0x5aba('0xcd')]];this[_0x5aba('0xd7')](this[_0x5aba('0x24')][_0x4eb6b5[_0x5aba('0xcc')]]);_0x59a65c=new Hangup(_0x4eb6b5,_0x35f9d4);_0x59a65c['state']=0x12;_0x59a65c[_0x5aba('0x7a')]='HangupInAMD';_0x59a65c[_0x5aba('0x120')]=_0x5aba('0x121');ami[_0x5aba('0x4a')](_0x5aba('0x122'),ut[_0x5aba('0x128')](_0x59a65c,_0x5aba('0x123')));this[_0x5aba('0x124')](_0x59a65c,_0x5aba('0x134'),_0x5aba('0x135'));}if(_0x4eb6b5['type']==='ivr'&&this[_0x5aba('0x24')][_0x4eb6b5[_0x5aba('0xcc')]]['dialAMDActive']&&_0x35f9d4['value']===_0x5aba('0x136')){return new Promise(function(_0x6abfcd,_0x2ff82c){delete _0xc97b7b[_0x5aba('0x29')][_0x35f9d4[_0x5aba('0xcd')]];_0xc97b7b['updateOriginated'](_0xc97b7b[_0x5aba('0x24')][_0x4eb6b5[_0x5aba('0xcc')]]);_0xc97b7b['campaigns'][_0x4eb6b5[_0x5aba('0xcc')]][_0x5aba('0x11e')]+=0x1;_0xc97b7b[_0x5aba('0x24')][_0x4eb6b5['queue']][_0x5aba('0x11f')]+=0x1;var _0x300445=_0xc97b7b[_0x5aba('0x24')][_0x4eb6b5['queue']];var _0xb32231=new Hangup(_0x4eb6b5,_0x35f9d4);_0xb32231[_0x5aba('0x79')]=0x13;_0xb32231[_0x5aba('0x7a')]=_0x5aba('0x137');_0xb32231[_0x5aba('0x120')]=_0x5aba('0x121');_0xb32231[_0x5aba('0x127')]+=0x1;_0xb32231['countglobal']+=0x1;_0xb32231[_0x5aba('0x123')]=!![];ami[_0x5aba('0x4a')](_0x5aba('0x122'),ut[_0x5aba('0x128')](_0xb32231,_0x5aba('0x123')));hopperUtils[_0x5aba('0xd4')](_0xb32231)[_0x5aba('0xac')](loggerCatch(_0x5aba('0x129')));if(_0xb32231[_0x5aba('0x12a')]+_0xb32231[_0x5aba('0x12b')]+_0xb32231['countnoanswerretry']+_0xb32231[_0x5aba('0x12c')]+_0xb32231['countdropretry']+_0xb32231[_0x5aba('0xf3')]+_0xb32231[_0x5aba('0x127')]+_0xb32231['countagentrejectretry']>=_0x300445[_0x5aba('0x12e')]){_0xc97b7b[_0x5aba('0x12f')](_0xb32231,_0x6abfcd,_0x2ff82c,'reason19\x20machine....');}else{if(_0xb32231[_0x5aba('0x127')]>=_0x300445[_0x5aba('0x138')]){_0xc97b7b[_0x5aba('0x139')](_0xb32231,_0x6abfcd,_0x2ff82c,_0x5aba('0x131'));}else{hopperUtils[_0x5aba('0xe5')]({'active':![],'countmachineretry':_0xb32231[_0x5aba('0x127')],'scheduledat':moment()['add'](_0x300445[_0x5aba('0x132')],_0x5aba('0xe6'))[_0x5aba('0x8a')](_0x5aba('0xd0')),'ContactId':_0xb32231[_0x5aba('0xf8')],'ListId':_0xb32231[_0x5aba('0xe7')],'VoiceQueueId':_0xb32231[_0x5aba('0xe8')]||undefined,'CampaignId':_0xb32231[_0x5aba('0xe9')]||undefined})[_0x5aba('0xac')](loggerCatch(_0x5aba('0x133')));_0x6abfcd({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x5aba('0x3c')]=function(_0x4d75fb){var _0x10d0d2=this[_0x5aba('0x29')][_0x4d75fb['uniqueid']];var _0x33a37b;if(_0x10d0d2&&_0x10d0d2[_0x5aba('0xce')]===_0x5aba('0xcf')){delete this[_0x5aba('0x29')][_0x4d75fb[_0x5aba('0xcd')]];this[_0x5aba('0xd7')](this[_0x5aba('0x24')][_0x10d0d2['queue']]);this[_0x5aba('0x24')][_0x10d0d2[_0x5aba('0xcc')]][_0x5aba('0x13a')]+=0x1;_0x33a37b=new Hangup(_0x10d0d2,_0x4d75fb);hopperUtils[_0x5aba('0xd4')](_0x33a37b)['catch'](loggerCatch(_0x5aba('0x13b')));hopperUtils[_0x5aba('0xd5')](_0x33a37b)[_0x5aba('0xac')](loggerCatch(_0x5aba('0x13c')));}if(_0x10d0d2&&_0x10d0d2[_0x5aba('0xce')]!==_0x5aba('0xcf')&&isNotNull(this['voiceQueues'][_0x10d0d2[_0x5aba('0xcc')]][_0x5aba('0x13d')])){delete this[_0x5aba('0x29')][_0x4d75fb[_0x5aba('0xcd')]];this[_0x5aba('0xd7')](this[_0x5aba('0x23')][_0x10d0d2[_0x5aba('0xcc')]]);this[_0x5aba('0x23')][_0x10d0d2['queue']][_0x5aba('0x11e')]+=0x1;this[_0x5aba('0x23')][_0x10d0d2[_0x5aba('0xcc')]][_0x5aba('0x11f')]+=0x1;_0x33a37b=new Hangup(_0x10d0d2,_0x4d75fb);_0x33a37b[_0x5aba('0x79')]=0x10;_0x33a37b[_0x5aba('0x7a')]=_0x5aba('0x13e');_0x33a37b['membername']=_0x5aba('0x13f');hopperUtils[_0x5aba('0xd4')](_0x33a37b)[_0x5aba('0xac')](loggerCatch(_0x5aba('0x13b')));hopperUtils[_0x5aba('0xd5')](_0x33a37b)['catch'](loggerCatch(_0x5aba('0x13c')));}if(_0x10d0d2&&_0x10d0d2['type']!==_0x5aba('0xcf')&&!isNotNull(this[_0x5aba('0x23')][_0x10d0d2[_0x5aba('0xcc')]][_0x5aba('0x13d')])){delete this[_0x5aba('0x29')][_0x4d75fb[_0x5aba('0xcd')]];this[_0x5aba('0xd7')](this[_0x5aba('0x23')][_0x10d0d2[_0x5aba('0xcc')]]);this[_0x5aba('0x23')][_0x10d0d2[_0x5aba('0xcc')]]['outboundUnknownCallsDay']+=0x1;_0x33a37b=new Hangup(_0x10d0d2,_0x4d75fb);_0x33a37b[_0x5aba('0x79')]=0xc;_0x33a37b[_0x5aba('0x7a')]=_0x4d75fb[_0x5aba('0x140')];_0x33a37b[_0x5aba('0x120')]=_0x5aba('0x141');hopperUtils[_0x5aba('0xd4')](_0x33a37b)[_0x5aba('0xac')](loggerCatch(_0x5aba('0x13b')));hopperUtils[_0x5aba('0xd5')](_0x33a37b)['catch'](loggerCatch(_0x5aba('0x13c')));}};Dialer['prototype'][_0x5aba('0xb')]=function(_0xa35f14){var _0x37be4c=this;if(!_0x37be4c['queuesSummary'][_0xa35f14['name']]){_0x37be4c[_0x5aba('0x30')][_0xa35f14[_0x5aba('0x4f')]]={'running':![]};}else if(_0x37be4c[_0x5aba('0x30')][_0xa35f14['name']]['running']===!![]){return;}else if(_0x37be4c[_0x5aba('0x30')][_0xa35f14[_0x5aba('0x4f')]][_0x5aba('0x142')]===![]){_0x37be4c[_0x5aba('0x30')][_0xa35f14['name']]['running']=!![];}var _0x15f213=_0x37be4c['voiceQueues'][_0xa35f14[_0x5aba('0x4f')]];var _0x112b7a=_0x15f213[_0x5aba('0x74')]!==utils[_0x5aba('0x78')][_0x5aba('0x87')];var _0x21d37b=utils[_0x5aba('0x143')](_0x15f213);_0x15f213[_0x5aba('0x144')]=utils[_0x5aba('0x145')](_0x15f213,_0x37be4c[_0x5aba('0x26')]);Promise[_0x5aba('0xb6')]()[_0x5aba('0x48')](function(){if(_0x15f213['statusMessage']===utils['CAMPAIGN_STATUS']['INACTIVE']){if(_0x112b7a){clearPredictiveAttributes(_0x15f213);_0xa35f14[_0x5aba('0x2b')]=undefined;_0xa35f14[_0x5aba('0x2c')]=undefined;}if(_0x15f213['statusMessage']===utils[_0x5aba('0x78')]['INACTIVE']){_0xa35f14[_0x5aba('0x146')]=0x0;_0xa35f14['paused']=0x0;_0xa35f14[_0x5aba('0x147')]=0x0;_0xa35f14[_0x5aba('0x148')]=0x0;_0xa35f14[_0x5aba('0x149')]=0x0;}}else if(_0x15f213[_0x5aba('0x144')]===utils['CAMPAIGN_STATUS'][_0x5aba('0x14a')]&&!_0x21d37b){return _0x37be4c[_0x5aba('0x9f')](_0x15f213,!![])[_0x5aba('0x48')](function(){return _0x37be4c['ifTime'](_0x15f213,![]);})[_0x5aba('0x48')](function(){return _0x37be4c[_0x5aba('0xbd')](_0x15f213);})['catch'](function(_0x4ca86e){loggerSyncQueueSummary[_0x5aba('0x4b')](_0x5aba('0x14b'),util[_0x5aba('0x4d')](_0x4ca86e,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x15f213);});}else{clearPredictiveAttributes(_0x15f213);}})['then'](function(){var _0x58951a=_0xa35f14[_0x5aba('0x14c')](_0x15f213);if(_0x58951a||_0x15f213[_0x5aba('0x14d')]){_0x15f213[_0x5aba('0x14d')]=![];_0xa35f14[_0x5aba('0x14e')](_0x15f213);Object[_0x5aba('0x14f')](_0x15f213,_0xa35f14);emitOutboundVoiceQueueSummary(_0xa35f14);}_0x37be4c[_0x5aba('0x30')][_0x15f213[_0x5aba('0x4f')]]['running']=![];})['catch'](function(_0x18aa79){logger[_0x5aba('0x6f')](_0x5aba('0x14b'),util[_0x5aba('0x4d')](_0x18aa79,{'showHidden':![],'depth':null}));_0x37be4c['queuesSummary'][_0x15f213[_0x5aba('0x4f')]][_0x5aba('0x142')]=![];});};Dialer[_0x5aba('0x1e')][_0x5aba('0x150')]=_[_0x5aba('0x151')](function(){var _0xd48d0=_[_0x5aba('0x152')](this[_0x5aba('0x23')],function(_0x453bf0){return _0x453bf0[_0x5aba('0x153')];});var _0x378eda=_[_0x5aba('0x152')](this[_0x5aba('0x25')],function(_0x3ea6f9){return _0x3ea6f9['online']&&_0x3ea6f9[_0x5aba('0x98')]===_0x5aba('0x99');});if(_0xd48d0[_0x5aba('0x10a')]>0x0&&_0x378eda[_0x5aba('0x10a')]>0x0){return Promise['resolve']()[_0x5aba('0x48')](cmHopper[_0x5aba('0x154')](_[_0x5aba('0x155')](_0xd48d0,'id'),previewRecallmeReminderInterval,_[_0x5aba('0x155')](_0x378eda,'id')))[_0x5aba('0x48')](function(_0x23d343){for(var _0x125a4a=0x0;_0x125a4a<_0x23d343[_0x5aba('0x10a')];_0x125a4a++){var _0x2d67cc=_0x23d343[_0x125a4a][_0x5aba('0x156')][_0x5aba('0x4f')];if(_0x2d67cc)io['to'](util[_0x5aba('0x8a')](_0x5aba('0x157'),_0x2d67cc))[_0x5aba('0x4a')](_0x5aba('0x158'),{'hopper':_0x23d343[_0x125a4a]});}})[_0x5aba('0xac')](function(_0x1e7fa0){logger[_0x5aba('0x6f')](_0x5aba('0x159'),_0x1e7fa0);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x5aba('0x1e')][_0x5aba('0x46')]=function(){var _0x21d91d=this;setInterval(function(){_0x21d91d[_0x5aba('0x15a')](_0x21d91d[_0x5aba('0x29')],_0x5aba('0x15b'));_0x21d91d[_0x5aba('0x15a')](_0x21d91d['actions'],_0x5aba('0x15c'));},0x32c8);};Dialer[_0x5aba('0x1e')]['clearZombieChannels']=function(_0x1684c6,_0x3dafe7){var _0x32d6bd=this;for(var _0x392650 in _0x1684c6){if(typeof _0x1684c6[_0x392650]!==_0x5aba('0xb5')){this[_0x5aba('0x22')][_0x5aba('0x1f')](function(){if(!_[_0x5aba('0xfe')](_0x1684c6[_0x392650])){return ami['Action']({'action':_0x5aba('0x98'),'channel':_0x1684c6[_0x392650]['channel']})['catch'](function(_0x3e76ee){if(_0x3e76ee[_0x5aba('0x74')]===_0x5aba('0x15d')){setTimeout(function(){if(_0x1684c6[_0x392650]&&_0x1684c6[_0x392650][_0x5aba('0xce')]!==_0x5aba('0xcf')){_0x32d6bd['updateOriginated'](_0x32d6bd[_0x5aba('0x23')][_0x1684c6[_0x392650]['queue']]);logger[_0x5aba('0x6f')]('[Dialer][checkChannel]',_0x3dafe7,_0x392650,_0x1684c6[_0x392650][_0x5aba('0xcc')]);delete _0x1684c6[_0x392650];}if(_0x1684c6[_0x392650]&&_0x1684c6[_0x392650][_0x5aba('0xce')]===_0x5aba('0xcf')){_0x32d6bd[_0x5aba('0xd7')](_0x32d6bd['campaigns'][_0x1684c6[_0x392650][_0x5aba('0xcc')]]);logger[_0x5aba('0x6f')]('[Dialer][checkChannel][ivr]',_0x3dafe7,_0x392650,_0x1684c6[_0x392650]['queue']);delete _0x1684c6[_0x392650];}},0x2328);}});}});}}};Dialer[_0x5aba('0x1e')][_0x5aba('0x15e')]=function(_0x2da712){return Promise[_0x5aba('0xb6')]()['then'](voiceQueueRt[_0x5aba('0x15e')](_0x2da712))['catch'](loggerCatch(_0x5aba('0x15f')));};Dialer['prototype'][_0x5aba('0xd7')]=function(_0x339e7a){if(!_[_0x5aba('0x5f')](_0x339e7a)&&_0x339e7a!==null){if(typeof _0x339e7a[_0x5aba('0x8e')]!==_0x5aba('0xb5')){if(_0x339e7a[_0x5aba('0x8e')]>0x0){_0x339e7a[_0x5aba('0x8e')]-=0x1;}else{logger[_0x5aba('0x6f')](_0x5aba('0x160'));}}}else{logger[_0x5aba('0x6f')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x5aba('0x1e')][_0x5aba('0x161')]=function(_0x7ef75c,_0x2f3896){var _0x4a1abd=this;return function(_0x32d82d){_0x4a1abd['updateOriginated'](_0x2f3896);logger[_0x5aba('0x6f')](_0x7ef75c,util['inspect'](_0x32d82d,{'showHidden':![],'depth':null}));};};Dialer[_0x5aba('0x1e')][_0x5aba('0x162')]=function(_0x1d2ded,_0x2b670d,_0x250c77){var _0xa78600={'state':0x19,'statedesc':_0x5aba('0x163')};this['updateOriginated'](_0x2b670d);this[_0x5aba('0x124')](_['merge'](_0xa78600,_[_0x5aba('0x80')](_0x250c77,[_0x5aba('0xf8'),_0x5aba('0xe7'),_0x5aba('0x164'),_0x5aba('0xe8'),_0x5aba('0xe9')])),_0x5aba('0x165'),'[emptyContact]');logger[_0x5aba('0x6f')](_0x1d2ded);};Dialer[_0x5aba('0x1e')][_0x5aba('0x124')]=function(_0x2d68c8,_0x3ebd7d,_0x55f641){hopperUtils[_0x5aba('0xd4')](_0x2d68c8)[_0x5aba('0xac')](loggerCatch(_0x3ebd7d));hopperUtils[_0x5aba('0xd5')](_0x2d68c8)['catch'](loggerCatch(_0x55f641));};Dialer['prototype']['queueCallerAbandonCreateState']=function(_0x272c34,_0x2253d6){hopperUtils[_0x5aba('0xd4')](_0x272c34)['catch'](loggerCatch(_0x5aba('0x166')));if(_0x2253d6==0x0){hopperUtils['moveContactManagedDialer'](_0x272c34)[_0x5aba('0xac')](loggerCatch(_0x5aba('0x167')));}};Dialer[_0x5aba('0x1e')][_0x5aba('0x159')]=function(_0x65bd7d){return Promise[_0x5aba('0xb6')]()[_0x5aba('0x48')](cmHopper[_0x5aba('0x154')](_0x65bd7d['id'],previewRecallmeReminderInterval))['then'](function(_0x37e4db){for(var _0x4d62d8=0x0;_0x4d62d8<_0x37e4db[_0x5aba('0x10a')];_0x4d62d8++){var _0x2c5f6f=_0x37e4db[_0x4d62d8][_0x5aba('0x156')][_0x5aba('0x4f')];if(_0x2c5f6f)io['to'](util['format'](_0x5aba('0x157'),_0x2c5f6f))[_0x5aba('0x4a')]('user:dialPreviewRecallReminder',{'hopper':_0x37e4db[_0x4d62d8]});}})['catch'](function(){});};Dialer[_0x5aba('0x1e')]['launchHandleIvr']=function(_0x322090){var _0x1b8f5f=this;return function(){_0x1b8f5f[_0x5aba('0x168')](_0x322090);};};Dialer[_0x5aba('0x1e')]['actionOriginate']=function(_0x577cc1,_0x42e698){var _0x369edf=this;var _0x189452=uuid['v4']();this[_0x5aba('0x28')][_0x189452]=new Action(_0x577cc1,_0x42e698,_0x189452);return new Promise(function(_0x96ef92,_0x4ddd5e){if(_[_0x5aba('0x5f')](_0x577cc1)&&typeof _0x577cc1!==_0x5aba('0x169')){return _0x4ddd5e(msgResponse(_0x5aba('0x16a'),_0x5aba('0xa0'),_0x5aba('0x16b')));}if(_[_0x5aba('0x5f')](_0x42e698[_0x5aba('0x16c')])||_0x42e698[_0x5aba('0x16c')]===null){return _0x4ddd5e(msgResponse(_0x5aba('0x16a'),'Failure',_0x5aba('0x16d')));}var _0xc5ef01={'XMD-CALLERID':_0x369edf[_0x5aba('0x28')][_0x189452][_0x5aba('0x16e')](),'XMD-AGI':_0x577cc1['dialQueueProject']?util[_0x5aba('0x8a')](_0x5aba('0x16f'),ipAgi,_0x577cc1['dialQueueProject']):_0x5aba('0x170'),'XMD-AGIAFTER':_0x577cc1[_0x5aba('0x171')]?util['format'](_0x5aba('0x16f'),ipAgi,_0x577cc1['dialQueueProject2']):_0x5aba('0x170'),'XMD-QUEUE':utils[_0x5aba('0x172')](_0x577cc1)?util[_0x5aba('0x8a')](_0x5aba('0x173'),_0x577cc1['name'],_0x577cc1[_0x5aba('0x174')]||'',_0x577cc1[_0x5aba('0xd3')]?'c':'',_0x577cc1['dialQueueTimeout']||0x3):_0x5aba('0x170'),'XMD-CONTACTID':_0x42e698[_0x5aba('0xf8')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x369edf['actions'][_0x189452][_0x5aba('0x16e')](),'XMD-AMD':_0x577cc1[_0x5aba('0x11c')]?_0x5aba('0x14a'):_0x5aba('0x170'),'XMD-DESTINATION':_0x5aba('0x11b')};if(_0x577cc1[_0x5aba('0x11c')]){_0xc5ef01['XMD-AMDINITIALSILENCE']=_0x577cc1[_0x5aba('0x175')]||0x9c4;_0xc5ef01[_0x5aba('0x176')]=_0x577cc1[_0x5aba('0x177')]||0x5dc;_0xc5ef01['XMD-AMDAFTERGREETINGSILENCE']=_0x577cc1[_0x5aba('0x178')]||0x320;_0xc5ef01[_0x5aba('0x179')]=_0x577cc1['dialAMDTotalAnalysisTime']||0x1388;_0xc5ef01[_0x5aba('0x17a')]=_0x577cc1[_0x5aba('0x17b')]||0x64;_0xc5ef01['XMD-AMDBETWEENWORDSSILENCE']=_0x577cc1['dialAMDBetweenWordsSilence']||0x32;_0xc5ef01[_0x5aba('0x17c')]=_0x577cc1[_0x5aba('0x17d')]||0x3;_0xc5ef01['XMD-AMDSILENCETHRESHOLD']=_0x577cc1[_0x5aba('0x17e')]||0x100;_0xc5ef01[_0x5aba('0x17f')]=_0x577cc1['dialAMDMaximumWordLength']||0x1388;}if(utils['isOutboundQueue'](_0x577cc1)){_0xc5ef01[_0x5aba('0x180')]=_0x42e698[_0x5aba('0xe8')];}else{_0xc5ef01[_0x5aba('0x181')]=_0x42e698['CampaignId'];}var _0x24aa66=utils[_0x5aba('0x182')](_0x42e698[_0x5aba('0x183')]);Object[_0x5aba('0x14f')](_0xc5ef01,_0x24aa66);var _0x1dce45=_0x369edf[_0x5aba('0x95')](_0x577cc1[_0x5aba('0x184')])?utils[_0x5aba('0x185')](_0x577cc1[_0x5aba('0x184')][_0x5aba('0x186')],_0x577cc1[_0x5aba('0x187')],_0x577cc1[_0x5aba('0x188')]>0x0?utils[_0x5aba('0x189')](_0x577cc1[_0x5aba('0x18a')],_0x577cc1[_0x5aba('0x188')]):_0x577cc1[_0x5aba('0x18a')]):utils[_0x5aba('0x185')](_[_0x5aba('0xfe')](_0x577cc1['TrunkBackup'])?_0x577cc1[_0x5aba('0x184')][_0x5aba('0x186')]:_0x577cc1[_0x5aba('0x9b')][_0x5aba('0x186')],_0x577cc1[_0x5aba('0x187')],_0x577cc1[_0x5aba('0x188')]>0x0?utils[_0x5aba('0x189')](_0x577cc1['dialOriginateCallerIdNumber'],_0x577cc1['dialRandomLastDigitCallerIdNumber']):_0x577cc1[_0x5aba('0x18a')]);if(_0x1dce45){_0xc5ef01[_0x5aba('0x18b')]=_0x369edf['actions'][_0x189452][_0x5aba('0x18c')]=utils[_0x5aba('0x18d')](_0x1dce45);_0xc5ef01[_0x5aba('0x18e')]=_0x42e698[_0x5aba('0x16c')];}_0x577cc1[_0x5aba('0x18f')]=_0xc5ef01;return ami['Action']({'actionid':_0x189452,'action':_0x5aba('0x16a'),'channel':_0x369edf[_0x5aba('0x95')](_0x577cc1[_0x5aba('0x184')])?util[_0x5aba('0x8a')](_0x5aba('0x190'),_0x577cc1['Trunk'][_0x5aba('0x4f')],isNotNull(_0x577cc1[_0x5aba('0x191')])?_0x577cc1[_0x5aba('0x191')]['trim']()||'':'',_0x577cc1['dialCutDigit']>0x0?_0x42e698[_0x5aba('0x16c')][_0x5aba('0x192')](_0x577cc1[_0x5aba('0x193')]):_0x42e698[_0x5aba('0x16c')]):util[_0x5aba('0x8a')](_0x5aba('0x190'),_[_0x5aba('0xfe')](_0x577cc1[_0x5aba('0x9b')])?_0x577cc1['Trunk'][_0x5aba('0x4f')]:_0x577cc1[_0x5aba('0x9b')][_0x5aba('0x4f')],isNotNull(_0x577cc1['dialPrefix'])?_0x577cc1[_0x5aba('0x191')][_0x5aba('0x194')]()||'':'',_0x577cc1[_0x5aba('0x193')]>0x0?_0x42e698['phone'][_0x5aba('0x192')](_0x577cc1[_0x5aba('0x193')]):_0x42e698[_0x5aba('0x16c')]),'callerid':_0x1dce45,'Exten':'xcally-motion-dialer','Context':_0x5aba('0x195'),'Priority':'1','variable':_0xc5ef01,'timeout':(_0x577cc1[_0x5aba('0x196')]||0x1e)*0x3e8,'async':!![],'channelid':_0x189452})[_0x5aba('0x48')](function(_0x33c1cd){return _0x96ef92(_0x33c1cd);})[_0x5aba('0xac')](function(_0x25b925){_0x577cc1[_0x5aba('0x197')]+=0x1;var _0x1030ca=new History(_0x369edf[_0x5aba('0x28')][_0x189452]);logger[_0x5aba('0x6f')](util['format'](_0x5aba('0x198'),JSON[_0x5aba('0x7f')](_0x25b925)));_0x1030ca[_0x5aba('0x79')]=0xe;_0x1030ca[_0x5aba('0x7a')]=_0x5aba('0x199');_0x1030ca[_0x5aba('0x7c')]=moment()[_0x5aba('0x8a')](_0x5aba('0xd0'));_0x1030ca['endtime']=_0x1030ca[_0x5aba('0x7c')];hopperUtils['createHistory'](_0x1030ca)[_0x5aba('0xac')](loggerCatch(_0x5aba('0x19a')));_0x369edf[_0x5aba('0xd5')](_0x1030ca)[_0x5aba('0xac')](loggerCatch(_0x5aba('0x19a')))['finally'](function(){delete _0x369edf[_0x5aba('0x28')][_0x189452];return _0x4ddd5e(msgResponse('originate',_0x5aba('0x94'),'originate\x20action\x20Error'));});});});};Dialer['prototype']['checkRetriveMax']=function(_0x3664e7,_0x4c769e,_0x294244){var _0x224f0b=new History(_0x4c769e);if(_0x224f0b[_0x5aba('0x12a')]+_0x224f0b[_0x5aba('0x12b')]+_0x224f0b[_0x5aba('0x19b')]+_0x224f0b[_0x5aba('0x12c')]+_0x224f0b['countdropretry']+_0x224f0b[_0x5aba('0xf3')]+_0x224f0b[_0x5aba('0x127')]+_0x224f0b[_0x5aba('0x12d')]>=_0x294244['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x3664e7){case 0x3:if(_0x224f0b[_0x5aba('0x19b')]>=_0x294244[_0x5aba('0x19c')]-0x1){return!![];}hopperUtils[_0x5aba('0xe5')]({'active':![],'countnoanswerretry':_0x224f0b[_0x5aba('0x19b')]+=0x1,'scheduledat':moment()[_0x5aba('0xf7')](_0x294244[_0x5aba('0x19d')],'minutes')[_0x5aba('0x8a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x224f0b['ContactId'],'ListId':_0x224f0b['ListId'],'VoiceQueueId':_0x224f0b['VoiceQueueId']||undefined,'CampaignId':_0x224f0b[_0x5aba('0xe9')]||undefined})[_0x5aba('0xac')](loggerCatch(_0x5aba('0x19e')));break;case 0x5:if(_0x224f0b['countbusyretry']>=_0x294244[_0x5aba('0x19f')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x224f0b[_0x5aba('0x12a')]+=0x1,'scheduledat':moment()[_0x5aba('0xf7')](_0x294244[_0x5aba('0x1a0')],_0x5aba('0xe6'))[_0x5aba('0x8a')](_0x5aba('0xd0')),'ContactId':_0x224f0b['ContactId'],'ListId':_0x224f0b[_0x5aba('0xe7')],'VoiceQueueId':_0x224f0b[_0x5aba('0xe8')]||undefined,'CampaignId':_0x224f0b[_0x5aba('0xe9')]||undefined})[_0x5aba('0xac')](loggerCatch(_0x5aba('0x1a1')));break;case 0x8:if(_0x224f0b[_0x5aba('0x12b')]>=_0x294244[_0x5aba('0x1a2')]-0x1){return!![];}hopperUtils[_0x5aba('0xe5')]({'active':![],'countcongestionretry':_0x224f0b[_0x5aba('0x12b')]+=0x1,'scheduledat':moment()[_0x5aba('0xf7')](_0x294244[_0x5aba('0x1a3')],'minutes')[_0x5aba('0x8a')](_0x5aba('0xd0')),'ContactId':_0x224f0b[_0x5aba('0xf8')],'ListId':_0x224f0b['ListId'],'VoiceQueueId':_0x224f0b['VoiceQueueId']||undefined,'CampaignId':_0x224f0b[_0x5aba('0xe9')]||undefined})[_0x5aba('0xac')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x224f0b['countnosuchnumberretry']>=_0x294244[_0x5aba('0x1a4')]-0x1){return!![];}else{hopperUtils[_0x5aba('0xe5')]({'active':![],'countnosuchnumberretry':_0x224f0b[_0x5aba('0x12c')]+=0x1,'scheduledat':moment()[_0x5aba('0xf7')](_0x294244['dialNoSuchNumberRetryFrequency'],_0x5aba('0xe6'))['format'](_0x5aba('0xd0')),'ContactId':_0x224f0b[_0x5aba('0xf8')],'ListId':_0x224f0b['ListId'],'VoiceQueueId':_0x224f0b[_0x5aba('0xe8')]||undefined,'CampaignId':_0x224f0b[_0x5aba('0xe9')]||undefined})[_0x5aba('0xac')](loggerCatch(_0x5aba('0x1a5')));}break;case 0xa:if(_0x224f0b['countdropretry']>=_0x294244['dialDropMaxRetry']-0x1){return!![];}hopperUtils[_0x5aba('0xe5')]({'active':![],'countdropretry':_0x224f0b[_0x5aba('0xdd')]+=0x1,'scheduledat':moment()[_0x5aba('0xf7')](_0x294244[_0x5aba('0xdf')],_0x5aba('0xe6'))[_0x5aba('0x8a')](_0x5aba('0xd0')),'ContactId':_0x224f0b[_0x5aba('0xf8')],'ListId':_0x224f0b[_0x5aba('0xe7')],'VoiceQueueId':_0x224f0b[_0x5aba('0xe8')]||undefined,'CampaignId':_0x224f0b[_0x5aba('0xe9')]||undefined})[_0x5aba('0xac')](loggerCatch(_0x5aba('0xea')));break;case 0xb:if(_0x224f0b['countabandonedretry']>=_0x294244[_0x5aba('0xf6')]-0x1){return!![];}hopperUtils[_0x5aba('0xe5')]({'active':![],'countabandonedretry':_0x224f0b['countabandonedretry']+=0x1,'scheduledat':moment()[_0x5aba('0xf7')](_0x294244[_0x5aba('0xf4')],_0x5aba('0xe6'))[_0x5aba('0x8a')](_0x5aba('0xd0')),'ContactId':_0x224f0b[_0x5aba('0xf8')],'ListId':_0x224f0b[_0x5aba('0xe7')],'VoiceQueueId':_0x224f0b['VoiceQueueId']||undefined,'CampaignId':_0x224f0b[_0x5aba('0xe9')]||undefined})[_0x5aba('0xac')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x224f0b[_0x5aba('0x127')]>=_0x294244[_0x5aba('0x138')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x224f0b[_0x5aba('0x127')]+=0x1,'scheduledat':moment()['add'](_0x294244[_0x5aba('0x132')],_0x5aba('0xe6'))[_0x5aba('0x8a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x224f0b[_0x5aba('0xf8')],'ListId':_0x224f0b[_0x5aba('0xe7')],'VoiceQueueId':_0x224f0b[_0x5aba('0xe8')]||undefined,'CampaignId':_0x224f0b[_0x5aba('0xe9')]||undefined})[_0x5aba('0xac')](loggerCatch(_0x5aba('0x133')));break;case 0x14:if(_0x224f0b['countagentrejectretry']>=_0x294244['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0x5aba('0xe5')]({'active':![],'countagentrejectretry':_0x224f0b[_0x5aba('0x12d')]+=0x1,'scheduledat':moment()[_0x5aba('0xf7')](_0x294244[_0x5aba('0x1a6')],_0x5aba('0xe6'))[_0x5aba('0x8a')](_0x5aba('0xd0')),'ContactId':_0x224f0b[_0x5aba('0xf8')],'ListId':_0x224f0b['ListId'],'VoiceQueueId':_0x224f0b[_0x5aba('0xe8')]||undefined,'CampaignId':_0x224f0b[_0x5aba('0xe9')]||undefined})[_0x5aba('0xac')](loggerCatch(_0x5aba('0x1a7')));break;default:return!![];}};Dialer['prototype']['callProgressDetecting']=function(_0x4c3ce7,_0x2c370a,_0x591dc2){var _0x4f857d=this;var _0x447867=new History(_0x4c3ce7);var _0x36bdc5=![];var _0x5e88e9;var _0x13e4c6;return new Promise(function(_0x2db7e3,_0x190c87){if(_['isUndefined'](_0x2c370a)&&typeof _0x2c370a!==_0x5aba('0x169')){return _0x190c87(msgResponse('[callProgressDetecting]',_0x5aba('0xa0'),_0x5aba('0x1a8')));}if(_[_0x5aba('0x5f')](_0x591dc2)&&typeof _0x591dc2!==_0x5aba('0x169')){return _0x190c87(msgResponse('[callProgressDetecting]','Failure',_0x5aba('0x1a9')));}hopperUtils[_0x5aba('0xe0')](_0x447867,_0x591dc2['reason'],_0x2c370a)[_0x5aba('0x48')](function(_0x56bcf2){if(_0x56bcf2[_0x5aba('0xe2')]==0x1)_0x36bdc5=!![];switch(_0x591dc2[_0x5aba('0xd1')]){case'0':_0x2c370a['outboundNoSuchCallsDay']+=0x1;_0x447867[_0x5aba('0x79')]=0x0;_0x447867['statedesc']='NoSuchNumber';_0x447867[_0x5aba('0x12c')]+=0x1;_0x447867[_0x5aba('0xde')]+=0x1;ami['emit'](_0x5aba('0x1aa'),ut[_0x5aba('0x128')](_0x4c3ce7,_0x5aba('0x1ab')));_0x5e88e9=_0x2c370a[_0x5aba('0x1ac')];_0x13e4c6=_0x2c370a[_0x5aba('0xf5')];hopperUtils[_0x5aba('0xd4')](_0x447867)[_0x5aba('0xac')](loggerCatch(_0x5aba('0x129')));if(_0x4f857d[_0x5aba('0x1ad')](0x0,_0x4c3ce7,_0x2c370a)&&!_0x36bdc5){if(_0x447867[_0x5aba('0x12c')]>=_0x2c370a[_0x5aba('0x1a4')]){_0x4f857d[_0x5aba('0x139')](_0x447867,_0x2db7e3,_0x190c87,_0x5aba('0x1ae'));}else{_0x4f857d[_0x5aba('0x12f')](_0x447867,_0x2db7e3,_0x190c87,_0x5aba('0x1ae'));}}break;case'3':_0x2c370a[_0x5aba('0x1af')]+=0x1;_0x447867[_0x5aba('0x79')]=0x3;_0x447867[_0x5aba('0x7a')]=_0x5aba('0x1b0');_0x447867[_0x5aba('0x19b')]+=0x1;_0x447867[_0x5aba('0xde')]+=0x1;var _0x13dc31=ut[_0x5aba('0x1b1')](_0x4c3ce7,_0x2c370a);ami[_0x5aba('0x4a')](_0x5aba('0x1b2'),_0x13dc31);_0x5e88e9=_0x2c370a[_0x5aba('0x19d')];_0x13e4c6=_0x2c370a['callAdditionalPhoneAfterMin'];hopperUtils[_0x5aba('0xd4')](_0x447867)[_0x5aba('0xac')](loggerCatch(_0x5aba('0x1b3')));if(_0x4f857d['checkRetriveMax'](0x3,_0x4c3ce7,_0x2c370a)&&!_0x36bdc5){if(_0x447867[_0x5aba('0x19b')]>=_0x2c370a[_0x5aba('0x19c')]){_0x4f857d[_0x5aba('0x139')](_0x447867,_0x2db7e3,_0x190c87,_0x5aba('0x1b4'));}else{_0x4f857d['stateGlobal'](_0x447867,_0x2db7e3,_0x190c87,_0x5aba('0x1b4'));}}break;case'5':_0x2c370a['outboundBusyCallsDay']+=0x1;_0x447867[_0x5aba('0x79')]=0x5;_0x447867['statedesc']=_0x5aba('0x1b5');_0x447867[_0x5aba('0x12a')]+=0x1;_0x447867[_0x5aba('0xde')]+=0x1;ami[_0x5aba('0x4a')](_0x5aba('0x1b6'),ut['buildObj'](_0x4c3ce7,_0x5aba('0x1b7')));_0x5e88e9=_0x2c370a[_0x5aba('0x1a0')];_0x13e4c6=_0x2c370a[_0x5aba('0xf5')];hopperUtils[_0x5aba('0xd4')](_0x447867)[_0x5aba('0xac')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x4f857d['checkRetriveMax'](0x5,_0x4c3ce7,_0x2c370a)&&!_0x36bdc5){if(_0x447867[_0x5aba('0x12a')]>=_0x2c370a['dialBusyMaxRetry']){_0x4f857d[_0x5aba('0x139')](_0x447867,_0x2db7e3,_0x190c87,_0x5aba('0x1b8'));}else{_0x4f857d['stateGlobal'](_0x447867,_0x2db7e3,_0x190c87,_0x5aba('0x1b8'));}}break;case'8':_0x2c370a[_0x5aba('0x1b9')]+=0x1;_0x447867['state']=0x8;_0x447867[_0x5aba('0x7a')]='Congestion';_0x447867[_0x5aba('0x12b')]+=0x1;_0x447867[_0x5aba('0xde')]+=0x1;_0x5e88e9=_0x2c370a['dialCongestionRetryFrequency'];_0x13e4c6=_0x2c370a[_0x5aba('0xf5')];ami[_0x5aba('0x4a')]('custom:agentcongestion',ut[_0x5aba('0x128')](_0x4c3ce7,_0x5aba('0x1ba')));hopperUtils[_0x5aba('0xd4')](_0x447867)[_0x5aba('0xac')](loggerCatch(_0x5aba('0x1bb')));if(_0x4f857d['checkRetriveMax'](0x8,_0x4c3ce7,_0x2c370a)&&!_0x36bdc5){if(_0x447867['countcongestionretry']>=_0x2c370a[_0x5aba('0x1a2')]){_0x4f857d[_0x5aba('0x139')](_0x447867,_0x2db7e3,_0x190c87,_0x5aba('0x1bc'));}else{_0x4f857d['stateGlobal'](_0x447867,_0x2db7e3,_0x190c87,_0x5aba('0x1bc'));}}break;case'11':_0x2c370a['outboundAbandonedCallsDay']+=0x1;_0x447867[_0x5aba('0x79')]=0xb;_0x447867['statedesc']='Abandoned';_0x447867['countabandonedretry']+=0x1;_0x447867[_0x5aba('0xde')]+=0x1;_0x5e88e9=_0x2c370a[_0x5aba('0xf4')];_0x13e4c6=_0x2c370a['callAdditionalPhoneAfterMin'];hopperUtils[_0x5aba('0xd4')](_0x447867)['catch'](loggerCatch(_0x5aba('0xf9')));if(_0x4f857d[_0x5aba('0x1ad')](0xb,_0x4c3ce7,_0x2c370a)&&!_0x36bdc5){if(_0x447867['countabandonedretry']>=_0x2c370a[_0x5aba('0xf6')]){_0x4f857d['createStateFinal'](_0x447867,_0x2db7e3,_0x190c87,_0x5aba('0x1bd'));}else{_0x4f857d[_0x5aba('0x12f')](_0x447867,_0x2db7e3,_0x190c87,'reason\x2011\x20abandoned');}}break;case'20':_0x2c370a[_0x5aba('0x1be')]+=0x1;_0x447867['state']=0x14;_0x447867[_0x5aba('0x7a')]='AgentReject';_0x447867[_0x5aba('0x12d')]+=0x1;_0x447867[_0x5aba('0xde')]+=0x1;_0x5e88e9=_0x2c370a[_0x5aba('0x1a6')];_0x13e4c6=_0x2c370a[_0x5aba('0xf5')];ami['emit'](_0x5aba('0x1bf'),ut['buildObj'](_0x4c3ce7,_0x5aba('0x1c0')));hopperUtils[_0x5aba('0xd4')](_0x447867)[_0x5aba('0xac')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x4f857d[_0x5aba('0x1ad')](0x14,_0x4c3ce7,_0x2c370a)&&!_0x36bdc5){if(_0x447867[_0x5aba('0x12d')]>=_0x2c370a[_0x5aba('0x1c1')]){_0x4f857d[_0x5aba('0x139')](_0x447867,_0x2db7e3,_0x190c87,_0x5aba('0x1c2'));}else{_0x4f857d['stateGlobal'](_0x447867,_0x2db7e3,_0x190c87,_0x5aba('0x1c2'));}}break;default:_0x2c370a[_0x5aba('0x1c3')]+=0x1;_0x447867[_0x5aba('0x79')]=0xc;_0x447867['statedesc']=_0x591dc2[_0x5aba('0xd1')];_0x5e88e9=_0x2c370a[_0x5aba('0x1a6')];_0x13e4c6=_0x2c370a[_0x5aba('0xf5')];hopperUtils['createHistory'](_0x447867)[_0x5aba('0xac')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x4f857d[_0x5aba('0x1ad')](_0x591dc2[_0x5aba('0xd1')],_0x4c3ce7,_0x2c370a)&&!_0x36bdc5){if(_0x447867['countbusyretry']+_0x447867['countcongestionretry']+_0x447867[_0x5aba('0x19b')]+_0x447867[_0x5aba('0x12c')]+_0x447867[_0x5aba('0xdd')]+_0x447867[_0x5aba('0xf3')]+_0x447867[_0x5aba('0x127')]+_0x447867[_0x5aba('0x12d')]>=_0x2c370a[_0x5aba('0x12e')]){_0x4f857d[_0x5aba('0x12f')](_0x447867,_0x2db7e3,_0x190c87,_0x591dc2[_0x5aba('0xd1')]);}else{_0x4f857d[_0x5aba('0x139')](_0x447867,_0x2db7e3,_0x190c87,_0x591dc2[_0x5aba('0xd1')]);}}}})[_0x5aba('0x48')](function(){if(_0x36bdc5){hopperUtils[_0x5aba('0xee')](_0x447867,_0x5e88e9,_0x13e4c6)[_0x5aba('0x48')](function(){return _0x2db7e3(0x1);});}});});};Dialer['prototype']['stateGlobal']=function(_0x109552,_0xff4c31,_0x433953,_0x15573f){var _0x599560=new Final(_0x109552);_0x599560['state']=0xf;_0x599560['statedesc']='Global';this[_0x5aba('0x139')](_0x599560,_0xff4c31,_0x433953,_0x15573f);};Dialer[_0x5aba('0x1e')][_0x5aba('0x139')]=function(_0x1df23f,_0x3caf66,_0xa6561b,_0x38e18f){hopperUtils[_0x5aba('0xd5')](_0x1df23f)[_0x5aba('0x48')](function(){return _0x3caf66(msgResponse(_0x5aba('0x1c4'),_0x5aba('0x115'),_0x38e18f));})['catch'](function(){return _0xa6561b(msgResponse('[moveContactManagedDialer][0]',_0x5aba('0xa0'),_0x5aba('0x1c5')));});};Dialer[_0x5aba('0x1e')][_0x5aba('0x9')]=function(_0x4b4887){var _0x55e055=_0x4b4887[_0x5aba('0x1c6')]/0x64;var _0x3fa5f3=_0x4b4887[_0x5aba('0xda')]/(_0x4b4887[_0x5aba('0xda')]+_0x4b4887['outboundAnswerCallsDay']);var _0x59b314=Math['round'](_0x4b4887[_0x5aba('0x1c7')]*(_0x4b4887[_0x5aba('0x1c8')]/0x64));var _0x5b7544=Math[_0x5aba('0x1c9')](_0x4b4887[_0x5aba('0x1c7')]*(_0x4b4887['predictiveIntervalMinThreshold']/0x64));var _0xe04c83=_0x4b4887[_0x5aba('0x146')]+_0x4b4887[_0x5aba('0x148')];var _0x89088a=Math[_0x5aba('0x1ca')](_0x4b4887['erlangCalls']*_0x4b4887[_0x5aba('0x69')]*_0x4b4887[_0x5aba('0x1cb')]*_0x4b4887[_0x5aba('0x1cc')]);if(_['isUndefined'](_0x4b4887['startProgressive'])){if(!_[_0x5aba('0x5f')](_0x4b4887[_0x5aba('0x2b')])){_0x4b4887['startPredictive']=undefined;loggerPredictive[_0x5aba('0x6f')]('[startMethodPredictive][StartProgressive]',_0x5aba('0x1cd'));}if(!_[_0x5aba('0x5f')](_0x4b4887[_0x5aba('0x6d')])){loggerPredictive['error'](_0x5aba('0x1ce'),_0x5aba('0x1cf'));clearInterval(_0x4b4887[_0x5aba('0x6d')]);_0x4b4887['handlePredictive']=undefined;}_0x4b4887[_0x5aba('0x2c')]=moment()[_0x5aba('0x8a')](_0x5aba('0xd0'));loggerPredictive['info'](_0x4b4887[_0x5aba('0x4f')],'collection\x20data\x20in\x20progressive\x20at',_0x4b4887[_0x5aba('0x2c')]);this[_0x5aba('0xc0')](_0x4b4887,0x1);}else if(ifInterval(_0x4b4887[_0x5aba('0x1d0')],_0x4b4887[_0x5aba('0x2c')])){this[_0x5aba('0xc0')](_0x4b4887,0x1);loggerPredictiveCalls[_0x5aba('0x54')]('[startMethodPredictive][StartProgressive][Loop]',_0x4b4887['startProgressive'],_0x4b4887[_0x5aba('0x4f')]);_0x4b4887['erlangCalls']=0x0;_0x4b4887['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x55e055<_0x3fa5f3&&_0x4b4887['dialPredictiveOptimization']===_0x5aba('0x1d1')){clearPredictiveAttributes(_0x4b4887);loggerPredictive[_0x5aba('0x54')](_0x5aba('0x1d2'),_0x5aba('0x1d3'),_0x3fa5f3,'startProgressive',_0x4b4887[_0x5aba('0x4f')]);}else if(_0x89088a<_0x4b4887[_0x5aba('0x1d4')]&&_0x4b4887[_0x5aba('0x1d5')]===_0x5aba('0x1d1')){clearPredictiveAttributes(_0x4b4887);loggerPredictive[_0x5aba('0x54')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x5aba('0x1d6'),_0x89088a,_0x5aba('0x1d7'),_0x4b4887[_0x5aba('0x1d4')],_0x5aba('0x2c'),_0x4b4887[_0x5aba('0x4f')]);}else if(!ifInterval(_0x4b4887[_0x5aba('0x1d0')],_0x4b4887['startProgressive'])&&_[_0x5aba('0x5f')](_0x4b4887[_0x5aba('0x2b')])&&!_[_0x5aba('0x5f')](_0x4b4887[_0x5aba('0x2c')])){_0x4b4887[_0x5aba('0x2b')]=moment()['format'](_0x5aba('0xd0'));loggerPredictive[_0x5aba('0x54')](_0x4b4887[_0x5aba('0x4f')],_0x5aba('0x1d8'),_0x4b4887[_0x5aba('0x2b')]);hopperUtils['avgHandleTime'](_0x4b4887[_0x5aba('0x1d0')])['then'](this[_0x5aba('0x1d9')](_0x4b4887))[_0x5aba('0x48')](mergeDataErlangB(_0x4b4887))[_0x5aba('0x48')](this[_0x5aba('0x1da')](_0x4b4887))[_0x5aba('0xac')](loggerCatchPredictive(_0x5aba('0x1db'),_0x4b4887));}else if(!ifInterval(_0x4b4887[_0x5aba('0x1d0')],_0x4b4887['startPredictive'])){_0x4b4887['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x4b4887[_0x5aba('0x2b')]=moment()[_0x5aba('0x8a')](_0x5aba('0xd0'));loggerPredictive[_0x5aba('0x54')](_0x4b4887[_0x5aba('0x4f')],_0x5aba('0x1dc'),_0x4b4887['startPredictive']);clearInterval(_0x4b4887[_0x5aba('0x6d')]);_0x4b4887[_0x5aba('0x6d')]=undefined;hopperUtils['avgHandleTime'](_0x4b4887[_0x5aba('0x1d0')])[_0x5aba('0x48')](this['getDataPredictive'](_0x4b4887))[_0x5aba('0x48')](mergeDataErlangB(_0x4b4887))[_0x5aba('0x48')](this[_0x5aba('0x1da')](_0x4b4887))[_0x5aba('0xac')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x4b4887));}else if(_0x4b4887[_0x5aba('0x1c7')]&&_0xe04c83<_0x4b4887[_0x5aba('0x1c7')]-_0x5b7544){clearPredictiveAttributes(_0x4b4887);loggerPredictive[_0x5aba('0x54')](_0x4b4887[_0x5aba('0x4f')],_0x5aba('0x1dd'),_0xe04c83,')\x20are\x20less\x20than\x20threshold\x20(',_0x4b4887[_0x5aba('0x1c7')],'-',_0x5b7544,'=',_0x4b4887[_0x5aba('0x1c7')]-_0x5b7544,')');}else if(_0x4b4887[_0x5aba('0x1c7')]&&_0xe04c83>_0x4b4887['predictiveIntervalAvailable']+_0x59b314){clearPredictiveAttributes(_0x4b4887);loggerPredictive[_0x5aba('0x54')](_0x4b4887['name'],_0x5aba('0x1dd'),_0xe04c83,_0x5aba('0x1de'),_0x4b4887[_0x5aba('0x1c7')],'+',_0x59b314,'=',_0x4b4887[_0x5aba('0x1c7')]+_0x59b314,')');}};Dialer[_0x5aba('0x1e')]['getDataPredictive']=function(_0x30d4cc){var _0x260834=this;return function(_0x1f0c48){return new Promise(function(_0x8db285,_0x15ba16){_[_0x5aba('0x102')](_0x30d4cc,_0x1f0c48[0x0]);if(checkGetDataPredictive(_0x1f0c48[0x0])){var _0x46e17e=_0x30d4cc[_0x5aba('0x1c7')]=_0x30d4cc[_0x5aba('0x148')]+_0x30d4cc[_0x5aba('0x146')];var _0x381bfc=_0x30d4cc[_0x5aba('0x1d0')]*0x3c;var _0x28ed7a=_0x1f0c48[0x0][_0x5aba('0x5d')]+_0x1f0c48[0x0][_0x5aba('0x5b')];var _0x169ac1=(_0x1f0c48[0x0][_0x5aba('0x56')]+_0x1f0c48[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x1f0c48[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x1f0c48[0x0]['predictiveIntervalTotalCalls'];_0x30d4cc[_0x5aba('0x1cb')]=_0x169ac1>0x0?_0x169ac1:0x1;switch(_0x30d4cc[_0x5aba('0x1d5')]){case _0x5aba('0x1d1'):var _0x6b4f8e=_0x30d4cc[_0x5aba('0x1c6')]/0x64;return _0x260834['abandonmentRate'](_0x46e17e,_0x381bfc,_0x28ed7a,_0x169ac1,_0x6b4f8e)[_0x5aba('0x48')](function(_0x522aed){return _0x8db285(_0x522aed);});case'agentBusyFactor':var _0x49191b=_0x30d4cc[_0x5aba('0x1c6')]/0x64;return _0x260834[_0x5aba('0x1df')](_0x46e17e,_0x381bfc,_0x28ed7a,_0x169ac1,_0x49191b)[_0x5aba('0x48')](function(_0x55c95d){return _0x8db285(_0x55c95d);});default:return _0x15ba16(msgResponse('[getDataPredictive]',_0x5aba('0xa0'),_0x5aba('0x1e0')));}}else{return _0x15ba16(msgResponse(_0x5aba('0x1e1'),_0x5aba('0xa0'),_0x5aba('0x1e2')));}});};};Dialer[_0x5aba('0x1e')][_0x5aba('0x1e3')]=function(_0x2c830a){var _0x4d4a2f=this;return function(_0x2038d7){return new Promise(function(_0x704675,_0x57b688){_['merge'](_0x2c830a,_0x2038d7[0x0]);if(checkGetDataPredictive(_0x2038d7[0x0])){loggerPredictive[_0x5aba('0x54')](JSON[_0x5aba('0x7f')](_0x2038d7[0x0]));if(_0x2c830a[_0x5aba('0x1d5')]==='dropRate'){return _0x4d4a2f[_0x5aba('0x15e')](_0x2c830a['id'])[_0x5aba('0x48')](function(_0x41aa76){var _0x39c977=_0x2c830a['loggedIn']-_0x41aa76[0x0][_0x5aba('0x1e4')];var _0x45e667=_0x2c830a[_0x5aba('0x1d0')]*0x3c;var _0x4e0b0a=_0x2038d7[0x0]['predictiveIntervalAvgTalktime']+_0x2038d7[0x0][_0x5aba('0x5b')];var _0x23618e=(_0x2038d7[0x0][_0x5aba('0x56')]+_0x2038d7[0x0][_0x5aba('0x58')]+_0x2038d7[0x0][_0x5aba('0xef')])/_0x2038d7[0x0]['predictiveIntervalTotalCalls'];var _0x4bda3a=_0x2c830a['dialPredictiveOptimizationPercentage']/0x64;_0x2c830a[_0x5aba('0x1e5')]=_0x41aa76[0x0]['outboundQueuePauses']||0x0;_0x2c830a[_0x5aba('0x1cb')]=_0x23618e>0x0?_0x23618e:0x1;return _0x4d4a2f[_0x5aba('0x1e6')](_0x39c977,_0x45e667,_0x4e0b0a,_0x23618e,_0x4bda3a);})[_0x5aba('0x48')](function(_0x1a1a4b){return _0x704675(_0x1a1a4b);})[_0x5aba('0xac')](function(_0x21f48b){return _0x57b688(msgResponse(_0x5aba('0x1e7'),_0x5aba('0xa0'),JSON[_0x5aba('0x7f')](_0x21f48b)));});}if(_0x2c830a[_0x5aba('0x1d5')]===_0x5aba('0x1e8')){return _0x4d4a2f['getVoiceQueueRtPauses'](_0x2c830a['id'])[_0x5aba('0x48')](function(_0x51448c){var _0x238f7d=_0x2c830a[_0x5aba('0x1e9')]-_0x51448c[0x0][_0x5aba('0x1e4')];var _0x179531=_0x2c830a[_0x5aba('0x1d0')]*0x3c;var _0x493f8b=_0x2038d7[0x0]['predictiveIntervalAvgTalktime']+_0x2038d7[0x0][_0x5aba('0x5b')];var _0x2d9e5a=(_0x2038d7[0x0][_0x5aba('0x56')]+_0x2038d7[0x0][_0x5aba('0x58')]+_0x2038d7[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x2038d7[0x0]['predictiveIntervalTotalCalls'];var _0x4f5abb=_0x2c830a['dialPredictiveOptimizationPercentage']/0x64;_0x2c830a[_0x5aba('0x1e5')]=_0x51448c[0x0][_0x5aba('0x1e4')]||0x0;_0x2c830a['predictiveIntervalHitRate']=_0x2d9e5a>0x0?_0x2d9e5a:0x1;return _0x4d4a2f[_0x5aba('0x1df')](_0x238f7d,_0x179531,_0x493f8b,_0x2d9e5a,_0x4f5abb);})[_0x5aba('0x48')](function(_0x4607de){return _0x704675(_0x4607de);})[_0x5aba('0xac')](function(_0xa08904){return _0x57b688(msgResponse(_0x5aba('0x1e7'),_0x5aba('0xa0'),JSON[_0x5aba('0x7f')](_0xa08904)));});}}else{return _0x57b688(msgResponse(_0x5aba('0x1e1'),_0x5aba('0xa0'),_0x5aba('0x1e2')));}});};};Dialer[_0x5aba('0x1e')]['startMethodPredictive']=function(_0x296c1e){var _0x44f0d4=this;return function(){var _0x1b4695=0x0;var _0x18799b=Math[_0x5aba('0x1ca')](_0x296c1e[_0x5aba('0x65')]*0x3e8);if(_0x18799b>0x0){_0x18799b=_0x18799b<0x64?0x64:_0x18799b;loggerPredictive['info'](_0x296c1e[_0x5aba('0x4f')],_0x5aba('0x1ea'),_0x18799b,_0x5aba('0x1eb'));_0x296c1e[_0x5aba('0x6d')]=setInterval(function(){_0x44f0d4[_0x5aba('0x6d')](_0x296c1e);loggerPredictiveCalls['info'](_0x5aba('0x1ec'),_0x1b4695+=0x1);},_0x18799b);}else{loggerPredictive[_0x5aba('0x54')](_0x296c1e[_0x5aba('0x4f')],_0x5aba('0x1ed'));}};};Dialer[_0x5aba('0x1e')][_0x5aba('0x1ee')]=function(_0x1da7e5,_0x28d9a3){var _0xf402bc=this;return function(_0xefd3f4){if(_[_0x5aba('0x84')](_0xefd3f4)){if(_['isNil'](_0x28d9a3[_0x5aba('0x164')])||!_0x28d9a3['recallme']){if(_0x1da7e5['dialMethod']==='booked'){_0x1da7e5[_0x5aba('0x7d')]=_[_0x5aba('0x5f')](_0x1da7e5[_0x5aba('0x7d')])?!![]:_0x1da7e5[_0x5aba('0x7d')];var _0x4fd5f8=uuid['v4']();_0xf402bc[_0x5aba('0x28')][_0x4fd5f8]=new Action(_0x1da7e5,_0x28d9a3,_0x4fd5f8);loggerBooked[_0x5aba('0x54')](_0x5aba('0x1ef'),_0x4fd5f8,_0x5aba('0x1f0'),JSON[_0x5aba('0x7f')](_0x1da7e5[_0x5aba('0x7d')]),_0x5aba('0x1f1'),_0x1da7e5[_0x5aba('0x4f')]);if(_0x1da7e5[_0x5aba('0x7d')]){_0x1da7e5[_0x5aba('0x7d')]=![];_0xf402bc[_0x5aba('0x2e')][_0xf402bc[_0x5aba('0x28')][_0x4fd5f8][_0x5aba('0xcc')]]=[];ami[_0x5aba('0xa4')]({'actionid':_0x4fd5f8,'action':'queuestatus','queue':_0x1da7e5[_0x5aba('0x4f')]})[_0x5aba('0xac')](function(){_0xf402bc['updateOriginated'](_0x1da7e5);hopperUtils[_0x5aba('0xe5')]({'active':![],'ContactId':_0xf402bc[_0x5aba('0x28')][_0x4fd5f8]['ContactId'],'ListId':_0xf402bc[_0x5aba('0x28')][_0x4fd5f8][_0x5aba('0xe7')],'VoiceQueueId':_0xf402bc[_0x5aba('0x28')][_0x4fd5f8][_0x5aba('0xe8')]||undefined,'CampaignId':_0xf402bc[_0x5aba('0x28')][_0x4fd5f8][_0x5aba('0xe9')]||undefined})[_0x5aba('0xac')](loggerCatch(_0x5aba('0x1f2')));delete _0xf402bc[_0x5aba('0x28')][_0x4fd5f8];});}else{loggerBooked[_0x5aba('0x54')](_0x5aba('0x1f3'),JSON['stringify'](_0x1da7e5['queueStatusComplete']),_0x5aba('0x1f1'),_0x1da7e5[_0x5aba('0x4f')]);_0xf402bc[_0x5aba('0xd7')](_0x1da7e5);hopperUtils[_0x5aba('0xe5')]({'active':![],'ContactId':_0xf402bc[_0x5aba('0x28')][_0x4fd5f8][_0x5aba('0xf8')],'ListId':_0xf402bc['actions'][_0x4fd5f8][_0x5aba('0xe7')],'VoiceQueueId':_0xf402bc['actions'][_0x4fd5f8]['VoiceQueueId']||undefined,'CampaignId':_0xf402bc[_0x5aba('0x28')][_0x4fd5f8][_0x5aba('0xe9')]||undefined})[_0x5aba('0xac')](loggerCatch(_0x5aba('0x1f2')));delete _0xf402bc[_0x5aba('0x28')][_0x4fd5f8];}}else{return _0xf402bc[_0x5aba('0x1f4')](_0x1da7e5,_0x28d9a3);}}else{if(utils[_0x5aba('0x6a')](undefined,_0x28d9a3[_0x5aba('0x1f5')])<_0x1da7e5['dialRecallMeTimeout']*0x3c){if(_0x28d9a3['Agent']&&!_0x28d9a3[_0x5aba('0x156')]['voicePause']){_0xf402bc[_0x5aba('0x104')][_0x5aba('0x105')](_0x28d9a3['id'])[_0x5aba('0x21')](function(){_0xf402bc[_0x5aba('0xd7')](_0x1da7e5);});}else{hopperUtils[_0x5aba('0x1f6')]({'active':![]},_0x28d9a3['id'],0x1)[_0x5aba('0x21')](function(){_0xf402bc['updateOriginated'](_0x1da7e5);});}}else{_0x1da7e5['outboundReCallsDay']+=0x1;_0xf402bc[_0x5aba('0xd7')](_0x1da7e5);if(_0x1da7e5[_0x5aba('0x1f7')]){hopperUtils[_0x5aba('0xe5')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x28d9a3['ContactId'],'ListId':_0x28d9a3['ListId'],'VoiceQueueId':_0x28d9a3[_0x5aba('0xe8')]||undefined,'CampaignId':_0x28d9a3[_0x5aba('0xe9')]||undefined})['catch'](loggerCatch(_0x5aba('0x1f8')));hopperUtils[_0x5aba('0xd4')](createObjHistory(_0x1da7e5,_0x28d9a3,utils[_0x5aba('0x78')][_0x5aba('0x1f9')],0x17,_0x5aba('0x1fa')))[_0x5aba('0xac')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0xf402bc[_0x5aba('0x124')](createObjHistory(_0x1da7e5,_0x28d9a3,utils[_0x5aba('0x78')][_0x5aba('0x1fb')],0x16,_0x5aba('0x1fc')),'[Originate][HistoryRecallClose][historyCatch]',_0x5aba('0x1fd'));}}}}else{_0x1da7e5[_0x5aba('0x1fe')]+=0x1;_0xf402bc[_0x5aba('0x124')](createObjHistory(_0x1da7e5,_0x28d9a3,utils[_0x5aba('0x78')][_0x5aba('0x1ff')],0xd,_0x5aba('0x200')),_0x5aba('0x201'),'[Originate][MoveBlacklist]');throw _0x5aba('0x202');}};};Dialer[_0x5aba('0x1e')][_0x5aba('0x168')]=function(_0x42c02e){var _0x224a5e=this;var _0x5ef5ca=_0x42c02e[_0x5aba('0x203')]-_0x42c02e['originated'];emitCampaignSummary(_0x42c02e);if(_0x5ef5ca>0x0&&_0x42c02e[_0x5aba('0x72')]==0x0){if(_0x5ef5ca>this[_0x5aba('0x27')]){_0x5ef5ca=this[_0x5aba('0x27')];}_0x42c02e[_0x5aba('0x72')]=0x1;hopperUtils['getContactDialerIvr'](_0x42c02e,_0x5ef5ca)[_0x5aba('0x48')](function(_0x508db1){_0x42c02e[_0x5aba('0x72')]=0x0;if(_0x508db1){if(!utils[_0x5aba('0x204')](_0x508db1)){_0x42c02e[_0x5aba('0x74')]=utils[_0x5aba('0x78')][_0x5aba('0x205')];logger['info'](_0x5aba('0x206')+_0x42c02e[_0x5aba('0x4f')]);}else{_0x42c02e['originated']+=_0x508db1[_0x5aba('0x10a')];_0x42c02e[_0x5aba('0x74')]=utils[_0x5aba('0x78')][_0x5aba('0x207')];for(var _0x2244f8=0x0;_0x2244f8<_0x508db1[_0x5aba('0x10a')];_0x2244f8+=0x1){_0x42c02e['ivrTotalCallsDays']+=0x1;if(_[_0x5aba('0xfe')](_0x508db1[_0x2244f8])||_[_0x5aba('0xfe')](_0x508db1[_0x2244f8][_0x5aba('0x183')])||_[_0x5aba('0xfe')](_0x508db1[_0x2244f8][_0x5aba('0x16c')])){_0x224a5e[_0x5aba('0x162')](_0x5aba('0x208'),_0x42c02e,_0x508db1[_0x2244f8]);}else{hopperUtils['checkIsBlackListIvr'](_['pick'](_0x508db1[_0x2244f8],[_0x5aba('0xe9'),'phone']))[_0x5aba('0x48')](_0x224a5e[_0x5aba('0x1ee')](_0x42c02e,_0x508db1[_0x2244f8]))[_0x5aba('0xac')](_0x224a5e['loggerHandler'](_0x5aba('0x209'),_0x42c02e));}}}}})[_0x5aba('0xac')](loggerGetContactDialer(_0x5aba('0x20a'),_0x42c02e,_0x5ef5ca));}};Dialer[_0x5aba('0x1e')]['handlePower']=function(_0x3a1b9b,_0x25b988){var _0x1ffb20=this;var _0xef4ab9=[];if(_0x25b988<0x1||_0x3a1b9b[_0x5aba('0xbe')]===_0x5aba('0x8')){_0x25b988=0x1;}var _0x453e4a=Math['floor'](_0x3a1b9b['available']*_0x25b988)-_0x3a1b9b[_0x5aba('0x8e')];if(_0x3a1b9b[_0x5aba('0x20b')]>0x0){var _0x494205=_0x3a1b9b['dialLimitQueue']-_0x3a1b9b['originated']-_0x3a1b9b['talking']-_0x3a1b9b[_0x5aba('0x149')];if(_0x453e4a>_0x494205){_0x453e4a=_0x494205;}}if(_0x453e4a>0x0&&_0x3a1b9b['temp']==0x0){if(_0x3a1b9b[_0x5aba('0xbe')]===_0x5aba('0x8')){_0x453e4a=0x1;}if(_0x453e4a>this[_0x5aba('0x27')]){_0x453e4a=this['maxNumberOriginate'];}for(var _0x4ea249 in this[_0x5aba('0x25')]){if(typeof this['agents'][_0x4ea249]!==_0x5aba('0xb5')){if(this[_0x5aba('0x25')][_0x4ea249][_0x5aba('0x79')]===_0x5aba('0x20c')&&this[_0x5aba('0x25')][_0x4ea249]['status']===_0x5aba('0x99')){_0xef4ab9[_0x5aba('0xa7')](this[_0x5aba('0x25')][_0x4ea249]['id']);}}}_0x3a1b9b[_0x5aba('0x72')]=0x1;hopperUtils['getContactDialer'](_0x3a1b9b,_0xef4ab9,_0x453e4a)['then'](function(_0x598da3){_0x3a1b9b['temp']=0x0;if(_0x598da3){if(!utils[_0x5aba('0x204')](_0x598da3)){hopperUtils[_0x5aba('0x20d')](_0x3a1b9b)['then'](sendMessageReschedule(_0x3a1b9b))[_0x5aba('0xac')](loggerCatch('[countReScheduled]\x20'));}else{_0x3a1b9b['originated']+=_0x598da3[_0x5aba('0x10a')];_0x3a1b9b[_0x5aba('0x74')]=_0x3a1b9b['dialMethod']===_0x5aba('0x8')?utils['CAMPAIGN_STATUS'][_0x5aba('0x14a')]:utils[_0x5aba('0x78')][_0x5aba('0x207')];for(var _0x20ad04=0x0;_0x20ad04<_0x598da3[_0x5aba('0x10a')];_0x20ad04+=0x1){if(_[_0x5aba('0xfe')](_0x598da3[_0x20ad04])||_['isNil'](_0x598da3[_0x20ad04][_0x5aba('0x183')])||_[_0x5aba('0xfe')](_0x598da3[_0x20ad04][_0x5aba('0x16c')])){_0x1ffb20['emptyContact'](_0x5aba('0x208'),_0x3a1b9b,_0x598da3[_0x20ad04]);}else{hopperUtils[_0x5aba('0x20e')](_['pick'](_0x598da3[_0x20ad04],['VoiceQueueId',_0x5aba('0x16c')]))[_0x5aba('0x48')](_0x1ffb20['checkContactBlack'](_0x3a1b9b,_0x598da3[_0x20ad04]))['catch'](_0x1ffb20['loggerHandler'](_0x5aba('0x208'),_0x3a1b9b));}}}}})[_0x5aba('0xac')](loggerGetContactDialer(_0x5aba('0x20f'),_0x3a1b9b,_0x453e4a));}};Dialer[_0x5aba('0x1e')]['handlePredictive']=function(_0x4a7514){if(_0x4a7514[_0x5aba('0x20b')]>0x0){var _0x32d88e=_0x4a7514[_0x5aba('0x20b')]-_0x4a7514[_0x5aba('0x8e')]-_0x4a7514[_0x5aba('0x148')];if(_0x32d88e>0x0&&_0x4a7514[_0x5aba('0x72')]==0x0){this[_0x5aba('0x210')](_0x4a7514);}else{loggerPredictiveCalls['info']('[handlePredictive][limitChannel]');}}else{this[_0x5aba('0x210')](_0x4a7514);}};Dialer['prototype'][_0x5aba('0x210')]=function(_0x42893c){var _0x588b60=this;var _0x4cf672=[];_0x42893c[_0x5aba('0x8e')]+=0x1;for(var _0x3f9a6c in this[_0x5aba('0x25')]){if(typeof this['agents'][_0x3f9a6c]!==_0x5aba('0xb5')){if(this[_0x5aba('0x25')][_0x3f9a6c][_0x5aba('0x79')]===_0x5aba('0x20c')&&this[_0x5aba('0x25')][_0x3f9a6c][_0x5aba('0x98')]===_0x5aba('0x99')){_0x4cf672['push'](this[_0x5aba('0x25')][_0x3f9a6c]['id']);}}}_0x42893c[_0x5aba('0x72')]=0x1;return this[_0x5aba('0x211')](_0x42893c['id'],_0x4cf672,0x1,_0x42893c[_0x5aba('0x212')],_0x42893c)[_0x5aba('0x48')](function(_0x73b065){_0x42893c[_0x5aba('0x72')]=0x1;if(_0x73b065){if(!utils['checkContactEmpty'](_0x73b065)){utils[_0x5aba('0x71')](_0x42893c,0x1,0x0);return hopperUtils[_0x5aba('0x20d')](_0x42893c)[_0x5aba('0x48')](sendMessageReschedule(_0x42893c))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x42893c[_0x5aba('0x74')]=utils['CAMPAIGN_STATUS'][_0x5aba('0x207')];if(_[_0x5aba('0xfe')](_0x73b065[0x0])||_[_0x5aba('0xfe')](_0x73b065[0x0]['Contact'])||_['isNil'](_0x73b065[0x0][_0x5aba('0x16c')])){_0x588b60[_0x5aba('0x162')]('[actionOriginate]\x20',_0x42893c,_0x73b065[0x0]);}else{return hopperUtils[_0x5aba('0x20e')](_[_0x5aba('0x80')](_0x73b065[0x0],['VoiceQueueId','phone']))[_0x5aba('0x48')](_0x588b60[_0x5aba('0x1ee')](_0x42893c,_0x73b065[0x0]))['catch'](_0x588b60[_0x5aba('0x161')]('[actionOriginatePredictive]\x20',_0x42893c));}}}})[_0x5aba('0xac')](loggerGetContactDialer('[getContactDialerPredictive]',_0x42893c,0x1));};Dialer[_0x5aba('0x1e')][_0x5aba('0x1e6')]=function(_0x45c82d,_0x5b009b,_0x30c97f,_0x36ff06,_0x163487,_0x555648){loggerPredictive['info'](_0x5aba('0x213'));loggerPredictive[_0x5aba('0x54')](_0x5aba('0x214'),_0x45c82d);loggerPredictive[_0x5aba('0x54')](_0x5aba('0x215'),_0x5b009b);loggerPredictive[_0x5aba('0x54')](_0x5aba('0x216'),_0x30c97f);loggerPredictive[_0x5aba('0x54')]('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',_0x36ff06);loggerPredictive[_0x5aba('0x54')](_0x5aba('0x217'),_0x163487);loggerPredictive[_0x5aba('0x54')](_0x5aba('0x5e'));return new Promise(function(_0x44b770,_0x4a9099){if(_0x45c82d<=0x0||isNaN(_0x45c82d)){return _0x4a9099(msgResponse(_0x5aba('0x218'),'Error',_0x5aba('0x219')+_0x45c82d));}if(_0x30c97f<=0x0||isNaN(_0x30c97f)){return _0x4a9099(msgResponse(_0x5aba('0x218'),_0x5aba('0x94'),'Ts\x20=\x20'+_0x30c97f));}if(_0x36ff06<=0x0||isNaN(_0x36ff06)){return _0x4a9099(msgResponse(_0x5aba('0x218'),_0x5aba('0x94'),_0x5aba('0x21a')+_0x36ff06));}if(_0x5b009b<=0x0||isNaN(_0x5b009b)){return _0x4a9099(msgResponse(_0x5aba('0x218'),_0x5aba('0x94'),_0x5aba('0x21b')+_0x5b009b));}if(_0x163487<=0x0||isNaN(_0x163487)){return _0x4a9099(msgResponse(_0x5aba('0x218'),_0x5aba('0x94'),_0x5aba('0x21c')+_0x163487));}_0x555648=_0x555648||0x0;var _0xdf8e35=0x1/_0x30c97f;var _0x1e0f18=0x0;var _0x414b92=0x0;var _0x49bf24=0x0;var _0x3042f=0x0;for(var _0x3a3e5d=0x0;_0x49bf24<_0x163487;_0x3a3e5d+=0x1){_0x414b92=_0x3a3e5d/_0x5b009b;_0x1e0f18=(_0x36ff06*_0x414b92+_0x555648)/_0xdf8e35;_0x49bf24=utils[_0x5aba('0x21d')](_0x1e0f18,_0x45c82d);_0x3042f=_0x1e0f18/_0x45c82d*(0x1-utils[_0x5aba('0x21d')](_0x1e0f18,_0x45c82d));}return _0x44b770({'erlangCalls':_0x3a3e5d,'erlangCallToSecond':_0x5b009b/_0x3a3e5d,'erlangAbandonmentRate':_0x49bf24,'erlangBusyFactor':_0x3042f});});};Dialer[_0x5aba('0x1e')][_0x5aba('0x1df')]=function(_0x45d7f0,_0x42ffd6,_0x245e4c,_0x851c9a,_0x4c8c77,_0x372a0a){loggerPredictive['info'](_0x5aba('0x21e'));loggerPredictive[_0x5aba('0x54')](_0x5aba('0x214'),_0x45d7f0);loggerPredictive[_0x5aba('0x54')](_0x5aba('0x215'),_0x42ffd6);loggerPredictive[_0x5aba('0x54')](_0x5aba('0x216'),_0x245e4c);loggerPredictive[_0x5aba('0x54')](_0x5aba('0x21f'),_0x851c9a);loggerPredictive[_0x5aba('0x54')](_0x5aba('0x220'),_0x4c8c77);loggerPredictive[_0x5aba('0x54')](_0x5aba('0x5e'));return new Promise(function(_0x444b34,_0x45c0d8){if(_0x45d7f0<=0x0||isNaN(_0x45d7f0)){return _0x45c0d8(msgResponse(_0x5aba('0x221'),'Error',_0x5aba('0x219')+_0x45d7f0));}if(_0x245e4c<=0x0||isNaN(_0x245e4c)){return _0x45c0d8(msgResponse(_0x5aba('0x221'),_0x5aba('0x94'),_0x5aba('0x222')+_0x245e4c));}if(_0x851c9a<=0x0||isNaN(_0x851c9a)){return _0x45c0d8(msgResponse(_0x5aba('0x221'),_0x5aba('0x94'),_0x5aba('0x21a')+_0x851c9a));}if(_0x42ffd6<=0x0||isNaN(_0x42ffd6)){return _0x45c0d8(msgResponse(_0x5aba('0x221'),_0x5aba('0x94'),'interval\x20=\x20'+_0x42ffd6));}if(_0x4c8c77<=0x0||isNaN(_0x4c8c77)){return _0x45c0d8(msgResponse(_0x5aba('0x221'),_0x5aba('0x94'),_0x5aba('0x223')+_0x4c8c77));}_0x372a0a=_0x372a0a||0x0;var _0x2e4776=0x1/_0x245e4c;var _0x5106ee=0x0;var _0x17fd93=0x0;var _0x21f815=0x0;var _0x42171a=0x0;for(var _0x219af3=0x0;_0x42171a<_0x4c8c77;_0x219af3+=0x1){_0x17fd93=_0x219af3/_0x42ffd6;_0x5106ee=(_0x851c9a*_0x17fd93+_0x372a0a)/_0x2e4776;_0x21f815=utils[_0x5aba('0x21d')](_0x5106ee,_0x45d7f0);_0x42171a=_0x5106ee/_0x45d7f0*(0x1-utils[_0x5aba('0x21d')](_0x5106ee,_0x45d7f0));}return _0x444b34({'erlangCalls':_0x219af3,'erlangCallToSecond':_0x42ffd6/_0x219af3,'erlangAbandonmentRate':_0x21f815,'erlangBusyFactor':_0x42171a});});};module[_0x5aba('0x224')]=Dialer; \ No newline at end of file +var _0x1ece=['[syncAgentComplete]','getSeconds','droptime','predictiveIntervalErlangCallsDroppedCalls','state','dropreason','TIMEOUT','countdropretry','countglobal','dialDropRetryFrequency','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','ContactId','ListId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','callAdditionalPhoneAfterMin','verifyAdditionalPhones','add','dialAbandonedRetryFrequency','minutes','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','syncQueueMember','actionid','strategy','isNil','locked','paused','stateinterface','rrmemory','idHopper','roundrobin','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','VoiceQueueId','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','responsetime','response','Success','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','HangupInAMD','membername','AMD','custom:amd','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','[syncAgentComplete][createHistory][0]','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','buildObj','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','outboundAnswerAgiCallsDay','countbusyretry','countcongestionretry','reason19\x20machine....','createStateFinal','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','cause-txt','running','getQueueCampaignStatusMessage','startProgressive','statusMessage','talking','[syncQueueSummary]','assign','throttle','dialPreviewRecallmeReminder','online','reachable','map','user:%s','user:dialPreviewRecallReminder','[uniqueid]','clearZombieChannels','[actions]','enqueue','No\x20such\x20channel','getVoiceQueueRtPauses','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','checkPreviewRecallReminder','handlePreviewRecallNotifications','Agent','launchHandleIvr','handleIvr','actionOriginate','object','voiceQueue\x20is\x20undefine','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialer','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialPrefix','dialCutDigit','substring','trim','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialAbandonedMaxRetry','dialAgentRejectMaxRetry','callProgressDetecting','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','congestion','reason\x208\x20congestion','reason\x2011\x20abandoned','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','available','floor','erlangAbandonmentRate','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','avgHandleTime','getDataPredictive','Predictive\x20after\x20first\x20interval','startMethodPredictive','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimization','abandonmentRate','agentBusyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','loggedIn','predictiveIntervalPauses','busyFactor','one\x20call\x20every:','milliseconds','[handlePredictive]','checkContactBlack','recallme','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','checkIsBlackListIvr','[actionOriginateIvr]\x20','[getContactCampaign2]','dialMethod','dialLimitQueue','pTalking','not_inuse','getContactDialer','ACTIVE','checkIsBlackList','[actionOriginate]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','countReScheduled','[countReScheduled]\x20','[actionOriginatePredictive]\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\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','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','uuid','ioredis','./utils/hopper','../preview/util/util','../../../config/logger','predictive','predictiveCalls','../ami','redis','localhost','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/history','./models/final','127.0.0.1','prototype','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','uniqueId','startPredictive','queueBooked','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','custom:queuesummary','syncQueueSummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','then','previewRecallmeReminderInterval','emit','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','voice:queue:%s','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','isUndefined','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','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','merge','name','startProgressive\x20value\x20cleared','debug','startPredictive\x20value\x20cleared','handlePredictive','error','stack','checkContactLowerLimitOriginate','temp','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','NO_AVAILABLE_CONTACTS','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','\x20INTERVAL_IS_NULL','Interval','NULL_INTERVAL','Intervals','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','format','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','is\x20not\x20active','DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','[ifTime][Action]','Error','isTrunkReachable','active','SIP/%s','status','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','iftime\x20%s,%s','content','indexOf','true','catch','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','syncCampaigns','undefined','isIVRCampaign','resolve','dialGlobalInterval','dialTimezone','checkDialMethod','progressive','handlePower','dialPowerLevel','booked','Queue','method\x20not\x20recognized','silly','Voice\x20Queue\x20%s\x20$s','intervalIftime','[ifTime][promiseAll]','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','uniqueid','type','updateOriginated','answertime','YYYY-MM-DD\x20HH:mm:ss','syncAgentComplete','queue','ivr','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer'];(function(_0x4ce6fa,_0x26a348){var _0xcd00be=function(_0x2d29e4){while(--_0x2d29e4){_0x4ce6fa['push'](_0x4ce6fa['shift']());}};_0xcd00be(++_0x26a348);}(_0x1ece,0x14f));var _0xe1ec=function(_0x44888f,_0x1b1bea){_0x44888f=_0x44888f-0x0;var _0x526924=_0x1ece[_0x44888f];return _0x526924;};'use strict';var util=require(_0xe1ec('0x0'));var _=require('lodash');var uuid=require(_0xe1ec('0x1'));var moment=require('moment');var rr=require('rr');var Redis=require(_0xe1ec('0x2'));var utils=require('./utils');var hopperUtils=require(_0xe1ec('0x3'));var ut=require(_0xe1ec('0x4'));var config=require('../../../config/environment/');var logger=require(_0xe1ec('0x5'))('dialer');var loggerBooked=require(_0xe1ec('0x5'))('booked');var loggerPredictive=require(_0xe1ec('0x5'))(_0xe1ec('0x6'));var loggerPredictiveCalls=require(_0xe1ec('0x5'))(_0xe1ec('0x7'));var loggerSyncQueueSummary=require('../../../config/logger')('syncQueueSummary');var ami=require(_0xe1ec('0x8'));config[_0xe1ec('0x9')]=_['defaults'](config['redis'],{'host':_0xe1ec('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe1ec('0x9')]));var cmHopper=require(_0xe1ec('0xb'));var voiceQueueRt=require(_0xe1ec('0xc'));var RpcSetting=require(_0xe1ec('0xd'));var Interval=require(_0xe1ec('0xe'));var Action=require('./models/action');var History=require(_0xe1ec('0xf'));var Final=require(_0xe1ec('0x10'));var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require('./models/hangup');var ipAgi=process['env']['XCALLY_IP_AGI']||_0xe1ec('0x11');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xe1ec('0x12')]['enqueue']=function(_0x4d9a55){this[_0xe1ec('0x13')]=this[_0xe1ec('0x13')]?this[_0xe1ec('0x13')][_0xe1ec('0x14')](_0x4d9a55):_0x4d9a55();};function Dialer(_0x2b0657,_0x3ea2d4){this[_0xe1ec('0x15')]=new Sequence();this[_0xe1ec('0x16')]=_0x3ea2d4;this['voiceQueues']=_0x2b0657[_0xe1ec('0x17')];this['campaigns']=_0x2b0657[_0xe1ec('0x18')];this[_0xe1ec('0x19')]=_0x2b0657[_0xe1ec('0x19')];this[_0xe1ec('0x1a')]=_0x2b0657[_0xe1ec('0x1a')];this[_0xe1ec('0x1b')]=config[_0xe1ec('0x1b')]||0x2;this['channels']={};this[_0xe1ec('0x1c')]={};this[_0xe1ec('0x1d')]={};this[_0xe1ec('0x1e')]={};this['optionPredictive']={};this[_0xe1ec('0x1f')]={};this['startProgressive']={};this['ivrOriginated']={};this[_0xe1ec('0x20')]={};this['queueBookedRR']={};this[_0xe1ec('0x21')]={};ami['on'](_0xe1ec('0x22'),this[_0xe1ec('0x23')][_0xe1ec('0x24')](this));ami['on'](_0xe1ec('0x25'),this[_0xe1ec('0x26')][_0xe1ec('0x24')](this));ami['on'](_0xe1ec('0x27'),this[_0xe1ec('0x28')][_0xe1ec('0x24')](this));ami['on']('agentcomplete',this['syncAgentComplete'][_0xe1ec('0x24')](this));ami['on'](_0xe1ec('0x29'),this[_0xe1ec('0x2a')][_0xe1ec('0x24')](this));ami['on'](_0xe1ec('0x2b'),this[_0xe1ec('0x2c')][_0xe1ec('0x24')](this));ami['on'](_0xe1ec('0x2d'),this[_0xe1ec('0x2e')]['bind'](this));ami['on'](_0xe1ec('0x2f'),this[_0xe1ec('0x30')][_0xe1ec('0x24')](this));ami['on'](_0xe1ec('0x31'),this[_0xe1ec('0x32')][_0xe1ec('0x24')](this));ami['on']('queuemember',this['syncQueueMember']['bind'](this));ami['on'](_0xe1ec('0x33'),this[_0xe1ec('0x34')]['bind'](this));this[_0xe1ec('0x35')]();this[_0xe1ec('0x36')]();RpcSetting['getSettings']()[_0xe1ec('0x37')](function(_0x3b15d7){previewRecallmeReminderInterval=_0x3b15d7[_0xe1ec('0x38')];});}function isNotNull(_0xc46dc7){return _0xc46dc7!==null&&!_['isUndefined'](_0xc46dc7);}function msgResponse(_0x3ee53b,_0x9d2a35,_0x3b4344){return{'action':_0x3ee53b,'response':_0x9d2a35,'message':_0x3b4344,'stack':_0x3b4344};}function emit(_0x23d57b,_0x49a3ac,_0x907fcc){io['to'](_0x23d57b)[_0xe1ec('0x39')](_0x49a3ac,_0x907fcc);}function emitOutboundVoiceQueueSummary(_0x2f141f){if(_0x2f141f['type']==='outbound'){logger['debug'](_0xe1ec('0x3a'),util[_0xe1ec('0x3b')](_0x2f141f,{'showHidden':![],'depth':null}));emit(util['format'](_0xe1ec('0x3c'),_0x2f141f['name']),_0xe1ec('0x3d'),_0x2f141f);}}function checkGetDataPredictive(_0x3e828a){if(isNotNull(_0x3e828a)&&!_[_0xe1ec('0x3e')](_0x3e828a)){loggerPredictive[_0xe1ec('0x3f')](_0xe1ec('0x40'));loggerPredictive[_0xe1ec('0x3f')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3e828a[_0xe1ec('0x41')]);loggerPredictive[_0xe1ec('0x3f')](_0xe1ec('0x42'),_0x3e828a[_0xe1ec('0x43')]);loggerPredictive[_0xe1ec('0x3f')](_0xe1ec('0x44'),_0x3e828a[_0xe1ec('0x45')]);loggerPredictive['info'](_0xe1ec('0x46'),_0x3e828a[_0xe1ec('0x47')]);loggerPredictive['info'](_0xe1ec('0x48'),_0x3e828a[_0xe1ec('0x49')]);loggerPredictive[_0xe1ec('0x3f')](_0xe1ec('0x4a'),_0x3e828a[_0xe1ec('0x4b')]);loggerPredictive[_0xe1ec('0x3f')]('---------------------------');if(_0x3e828a[_0xe1ec('0x41')]>0x0){if(!_['isUndefined'](_0x3e828a[_0xe1ec('0x4b')])&&_0x3e828a['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0xe1ec('0x3f')](_0xe1ec('0x4c'));if(!_[_0xe1ec('0x4d')](_0x3e828a[_0xe1ec('0x49')])&&_0x3e828a[_0xe1ec('0x49')]>0x0){return!![];}loggerPredictive[_0xe1ec('0x3f')](_0xe1ec('0x4e'));}else{loggerPredictive[_0xe1ec('0x3f')](_0xe1ec('0x4f'));}}else{loggerPredictive[_0xe1ec('0x3f')](_0xe1ec('0x50'));}return![];}function mergeDataErlangB(_0x29628f){return function(_0x3d34c4){loggerPredictive[_0xe1ec('0x3f')](_0xe1ec('0x51'));loggerPredictive[_0xe1ec('0x3f')](_0xe1ec('0x52'),_0x3d34c4[_0xe1ec('0x53')]);loggerPredictive['info']('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3d34c4[_0xe1ec('0x54')]);loggerPredictive[_0xe1ec('0x3f')](_0xe1ec('0x55'),_0x3d34c4['erlangAbandonmentRate']);loggerPredictive['info'](_0xe1ec('0x56'),_0x3d34c4['erlangBusyFactor']);loggerPredictive[_0xe1ec('0x3f')](_0xe1ec('0x55'),_0x3d34c4['erlangAbandonmentRate']);loggerPredictive[_0xe1ec('0x3f')](_0xe1ec('0x57'));_[_0xe1ec('0x58')](_0x29628f,_0x3d34c4);};}function ifInterval(_0xdd1d83,_0x53e8d1){if(_[_0xe1ec('0x4d')](_0x53e8d1)){return![];}return utils['getSeconds'](undefined,_0x53e8d1)<_0xdd1d83*0x3c;}function clearPredictiveAttributes(_0x6d034){if(_0x6d034['startProgressive']){_0x6d034['startProgressive']=undefined;loggerPredictive['debug'](_0x6d034[_0xe1ec('0x59')],_0xe1ec('0x5a'));}if(_0x6d034[_0xe1ec('0x1f')]){_0x6d034[_0xe1ec('0x1f')]=undefined;loggerPredictive[_0xe1ec('0x5b')](_0x6d034['name'],_0xe1ec('0x5c'));}if(_0x6d034['handlePredictive']){clearInterval(_0x6d034[_0xe1ec('0x5d')]);_0x6d034[_0xe1ec('0x5d')]=undefined;loggerPredictive['debug'](_0x6d034['name'],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x11db91,_0x549d60){return function(_0x4b4e22){loggerPredictive[_0xe1ec('0x5e')](_0x549d60['name'],_0x11db91);loggerPredictive[_0xe1ec('0x5e')](_0x4b4e22[_0xe1ec('0x5f')]);clearPredictiveAttributes(_0x549d60);};}function loggerCatch(_0x1017e4){return function(_0x36a9c1){logger['error'](_0x1017e4,util[_0xe1ec('0x3b')](_0x36a9c1,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x4d94a4,_0x2265cc,_0x5c3a44){return function(_0x55d4c0){utils[_0xe1ec('0x60')](_0x2265cc,_0x5c3a44,0x0);_0x2265cc[_0xe1ec('0x61')]=0x0;logger['error'](_0x4d94a4,util[_0xe1ec('0x3b')](_0x55d4c0,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0xdb3b69){return function(_0x4ba55e){if(isNotNull(_0x4ba55e)&&isNotNull(_0x4ba55e[0x0])){if(_0x4ba55e[0x0][_0xe1ec('0x62')]>0x0){_0xdb3b69[_0xe1ec('0x63')]=utils[_0xe1ec('0x64')][_0xe1ec('0x65')];logger[_0xe1ec('0x3f')](_0xe1ec('0x66')+_0xdb3b69[_0xe1ec('0x59')],_0x4ba55e[0x0][_0xe1ec('0x62')],_0xe1ec('0x67'));}else{_0xdb3b69[_0xe1ec('0x63')]=utils[_0xe1ec('0x64')][_0xe1ec('0x68')];logger[_0xe1ec('0x3f')]('[getContactDialer2][Empty]'+_0xdb3b69['name']);}}};}function createObjHistory(_0x3f36ce,_0x54d70b,_0x90a0ec,_0xcd82cc,_0x420f3a){_0x3f36ce['message']=_0x90a0ec;var _0x46794c=new Action(_0x3f36ce,_0x54d70b);var _0x3bd2d1=new History(_0x46794c);_0x3bd2d1['state']=_0xcd82cc;_0x3bd2d1[_0xe1ec('0x69')]=_0x420f3a;_0x3bd2d1[_0xe1ec('0x6a')]=_0x46794c[_0xe1ec('0x6b')];return _0x3bd2d1;}function unlockQueueStatus(_0x4aa17f,_0x3d778a){setTimeout(function(){if(_[_0xe1ec('0x4d')](_0x4aa17f[_0xe1ec('0x6c')])){loggerBooked[_0xe1ec('0x5e')](_0xe1ec('0x6d'),_0x3d778a);}_0x4aa17f[_0xe1ec('0x6c')]=!![];loggerBooked[_0xe1ec('0x3f')](_0xe1ec('0x6e'),_0x3d778a,JSON[_0xe1ec('0x6f')](_[_0xe1ec('0x70')](_0x4aa17f,[_0xe1ec('0x59'),'queueStatusComplete'])));},0x1f3);}function checkInterval(_0x4a9f33){return function(){if(!isNotNull(_0x4a9f33['Interval'])){_0x4a9f33[_0xe1ec('0x63')]=utils[_0xe1ec('0x64')]['NULL_INTERVAL'];throw _0x4a9f33[_0xe1ec('0x59')]+_0xe1ec('0x71');}if(!isNotNull(_0x4a9f33[_0xe1ec('0x72')]['Intervals'])){_0x4a9f33[_0xe1ec('0x63')]=utils[_0xe1ec('0x64')][_0xe1ec('0x73')];throw _0x4a9f33[_0xe1ec('0x59')]+_0xe1ec('0x71');}if(!isNotNull(_['isEmpty'](_0x4a9f33[_0xe1ec('0x72')][_0xe1ec('0x74')]))){_0x4a9f33[_0xe1ec('0x63')]=utils[_0xe1ec('0x64')]['NULL_INTERVAL'];throw _0x4a9f33[_0xe1ec('0x59')]+_0xe1ec('0x71');}};}function checkIsIVRCampaignActive(_0x57136a){return function(){if(!utils[_0xe1ec('0x75')](_0x57136a)){_0x57136a['message']=utils[_0xe1ec('0x64')][_0xe1ec('0x76')];throw _0x57136a[_0xe1ec('0x59')]+_0xe1ec('0x77');}};}function emitCampaignSummary(_0x3a842f){if(utils['isIVRCampaign'](_0x3a842f)){emit(util[_0xe1ec('0x78')](_0xe1ec('0x79'),_0x3a842f[_0xe1ec('0x59')]),_0xe1ec('0x7a'),_0x3a842f);}}function loggerCatchQueueSummary(_0x475fbd,_0x321ecc){return function(_0x5aad1f){clearPredictiveAttributes(_0x321ecc);emitCampaignSummary(_0x321ecc);loggerSyncQueueSummary[_0xe1ec('0x5b')](_0x475fbd,util[_0xe1ec('0x3b')](_0x5aad1f,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x2733df){if(_0x2733df[_0xe1ec('0x7b')]){if(_0x2733df[_0xe1ec('0x7c')]===0x0){_0x2733df[_0xe1ec('0x7b')]=![];_0x2733df[_0xe1ec('0x63')]=utils['CAMPAIGN_STATUS']['INACTIVE'];loggerSyncQueueSummary['debug']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x2733df[_0xe1ec('0x59')],_0xe1ec('0x7d'));}else{_0x2733df['message']=utils[_0xe1ec('0x64')][_0xe1ec('0x7e')];loggerSyncQueueSummary[_0xe1ec('0x5b')](_0xe1ec('0x7f'),_0x2733df[_0xe1ec('0x59')],_0xe1ec('0x80'));}emitCampaignSummary(_0x2733df);}}function myreject(_0x413e6e){return function(_0xba161d){return _0x413e6e(msgResponse(_0xe1ec('0x81'),_0xe1ec('0x82'),JSON[_0xe1ec('0x6f')](_0xba161d)));};}Dialer[_0xe1ec('0x12')][_0xe1ec('0x83')]=function(_0xb60c1b){return!_[_0xe1ec('0x4d')](_0xb60c1b)&&_0xb60c1b&&!_[_0xe1ec('0x4d')](_0xb60c1b[_0xe1ec('0x59')])&&!_[_0xe1ec('0x4d')](_0xb60c1b[_0xe1ec('0x84')])&&_0xb60c1b[_0xe1ec('0x84')]&&(this[_0xe1ec('0x1a')][util['format'](_0xe1ec('0x85'),_0xb60c1b[_0xe1ec('0x59')])]['status']==='reachable'||this['trunks'][util[_0xe1ec('0x78')](_0xe1ec('0x85'),_0xb60c1b[_0xe1ec('0x59')])][_0xe1ec('0x86')]===_0xe1ec('0x87'));};Dialer['prototype'][_0xe1ec('0x88')]=function(_0x1c9894){var _0x58fb47=this;return function(){if(!_0x58fb47['isTrunkReachable'](_0x1c9894[_0xe1ec('0x89')])){if(!_0x58fb47['isTrunkReachable'](_0x1c9894[_0xe1ec('0x8a')])){_0x1c9894[_0xe1ec('0x63')]=utils[_0xe1ec('0x64')]['TRUNK_NOT_REACHABLE'];throw _0x1c9894[_0xe1ec('0x59')]+_0xe1ec('0x8b');}}};};Dialer[_0xe1ec('0x12')][_0xe1ec('0x8c')]=function(_0x1e9851,_0x8c3de4,_0x1364ca,_0x31190c){var _0x38ee4b=this;return function(){var _0x5a0a51=!![];return _0x38ee4b[_0xe1ec('0x8d')](_0x1e9851,_0x8c3de4,_0x1364ca,_0x31190c,_0x5a0a51);};};Dialer[_0xe1ec('0x12')][_0xe1ec('0x8e')]=function(_0x8d1452,_0x39b68f,_0x2fb17a,_0x22e411){var _0x30bf17=this;return function(){var _0x45868f=![];return _0x30bf17['ifTimeIvr'](_0x8d1452[_0xe1ec('0x74')],_0x39b68f,_0x2fb17a,_0x22e411,_0x45868f);};};Dialer[_0xe1ec('0x12')][_0xe1ec('0x8d')]=function(_0x4f901b,_0x4890a1,_0x3b8738,_0x17dcce,_0x4bc22c){var _0x747f37=[];return new Promise(function(_0x5948ef,_0x2eddb8){if(!isNotNull(_0x4f901b)){_0x17dcce[_0xe1ec('0x63')]=utils[_0xe1ec('0x64')][_0xe1ec('0x73')];return _0x2eddb8(msgResponse(_0xe1ec('0x8f'),_0xe1ec('0x90'),_0x3b8738+_0xe1ec('0x91')));}if(_[_0xe1ec('0x3e')](_0x4f901b)){_0x17dcce['message']=utils[_0xe1ec('0x64')][_0xe1ec('0x92')];return _0x2eddb8(msgResponse(_0xe1ec('0x8f'),'Failure',_0x3b8738+_0xe1ec('0x93')));}if(_0x4890a1&&_[_0xe1ec('0x4d')](config[_0xe1ec('0x94')][_0x4890a1])){_0x17dcce[_0xe1ec('0x63')]=utils[_0xe1ec('0x64')]['UNKNOWN_TIMEZONE'];return _0x2eddb8(msgResponse('ifTime',_0xe1ec('0x90'),_0x3b8738+_0xe1ec('0x95')+_0x4890a1));}if(_[_0xe1ec('0x96')](_0x4f901b)){for(var _0x543cdf=0x0;_0x543cdf<_0x4f901b[_0xe1ec('0x97')];_0x543cdf+=0x1){_0x747f37[_0xe1ec('0x98')](ami[_0xe1ec('0x99')]({'action':_0xe1ec('0x9a'),'command':util[_0xe1ec('0x78')](_0xe1ec('0x9b'),_0x4f901b[_0x543cdf]['interval'],!_[_0xe1ec('0x4d')](config[_0xe1ec('0x94')][_0x4890a1])?_0x4890a1:'')})[_0xe1ec('0x37')](function(_0x2cdc6e){return _0x2cdc6e[_0xe1ec('0x9c')][_0xe1ec('0x9d')](_0xe1ec('0x9e'))>=0x0;})[_0xe1ec('0x9f')](myreject(_0x2eddb8)));}}else{_0x747f37[_0xe1ec('0x98')](ami['Action']({'action':_0xe1ec('0x9a'),'command':util['format']('iftime\x20%s,%s',_0x4f901b,!_['isUndefined'](config[_0xe1ec('0x94')][_0x4890a1])?_0x4890a1:'')})['then'](function(_0x585c49){return _0x585c49[_0xe1ec('0x9c')]['indexOf']('true')>=0x0;})[_0xe1ec('0x9f')](myreject(_0x2eddb8)));}Promise[_0xe1ec('0xa0')](_0x747f37)[_0xe1ec('0x37')](function(_0xdd2737){var _0x53232e=_[_0xe1ec('0xa1')](_0xdd2737);if(_0x53232e){return _0x5948ef(_0x53232e);}else{_0x17dcce[_0xe1ec('0x63')]=_0x4bc22c?utils[_0xe1ec('0x64')][_0xe1ec('0xa2')]:utils['CAMPAIGN_STATUS'][_0xe1ec('0xa3')];return _0x2eddb8(msgResponse('[ifTime][promiseAll]',_0xe1ec('0x90'),_0xe1ec('0xa4')+_0x4bc22c+'\x20'+_0x3b8738+_0xe1ec('0xa5')+util[_0xe1ec('0x3b')](_0x4f901b,{'showHidden':![],'depth':null})+_0xe1ec('0xa6')+_0x4890a1));}})[_0xe1ec('0x9f')](function(_0x1a6210){return _0x2eddb8(msgResponse(_0xe1ec('0x8f'),'Failure',JSON[_0xe1ec('0x6f')](_0x1a6210)));});});};Dialer[_0xe1ec('0x12')]['loopCampaigns']=function(){var _0x1e819c=this;return cmHopper['resetActiveCalls']({'active':![]},{'where':{'active':!![]}})[_0xe1ec('0x37')](function(){setInterval(function(){_0x1e819c[_0xe1ec('0xa7')]();},0x3e8);});};Dialer[_0xe1ec('0x12')][_0xe1ec('0xa7')]=function(){var _0x1d450f=this;var _0x2843b9;for(var _0xfb1991 in this['campaigns']){if(typeof this[_0xe1ec('0x18')][_0xfb1991]!==_0xe1ec('0xa8')){_0x2843b9=this[_0xe1ec('0x18')][_0xfb1991];if(utils[_0xe1ec('0xa9')](_0x2843b9)&&utils[_0xe1ec('0x75')](_0x2843b9)){_0x2843b9[_0xe1ec('0x7b')]=!![];Promise[_0xe1ec('0xaa')]()[_0xe1ec('0x37')](checkIsIVRCampaignActive(_0x2843b9))[_0xe1ec('0x37')](checkInterval(_0x2843b9))[_0xe1ec('0x37')](_0x1d450f['checkIsTrunkReachable'](_0x2843b9))[_0xe1ec('0x37')](_0x1d450f[_0xe1ec('0x8c')](_0x2843b9[_0xe1ec('0xab')],_0x2843b9[_0xe1ec('0xac')],_0x2843b9[_0xe1ec('0x59')],_0x2843b9))[_0xe1ec('0x37')](_0x1d450f[_0xe1ec('0x8e')](_0x2843b9[_0xe1ec('0x72')],_0x2843b9[_0xe1ec('0xac')],_0x2843b9['name'],_0x2843b9))['then'](_0x1d450f['launchHandleIvr'](_0x2843b9))['catch'](loggerCatchQueueSummary('[syncCampaigns]',_0x2843b9));}else{notSendMessagesCampaign(_0x2843b9);}}}};Dialer[_0xe1ec('0x12')][_0xe1ec('0xad')]=function(_0x2bedb2){if(_0x2bedb2['dialMethod']!==_0xe1ec('0x6')){clearPredictiveAttributes(_0x2bedb2);}switch(_0x2bedb2['dialMethod']){case _0xe1ec('0xae'):this[_0xe1ec('0xaf')](_0x2bedb2,0x1);break;case'power':this[_0xe1ec('0xaf')](_0x2bedb2,_0x2bedb2[_0xe1ec('0xb0')]);break;case'predictive':this[_0xe1ec('0x6')](_0x2bedb2);break;case _0xe1ec('0xb1'):this[_0xe1ec('0xaf')](_0x2bedb2,0x1);break;default:logger[_0xe1ec('0x5e')](_0xe1ec('0xb2'),_0x2bedb2['name'],_0xe1ec('0xb3'));}};Dialer[_0xe1ec('0x12')][_0xe1ec('0x8f')]=function(_0x888434,_0x10ae53){var _0x7db1dd=_0x888434[_0xe1ec('0xac')];var _0x559d70=_0x10ae53?_0x888434['dialGlobalInterval']:_0x888434['Interval'][_0xe1ec('0x74')];logger[_0xe1ec('0xb4')]('Dialer::ifTime()',_0x559d70,_0x7db1dd,_0x888434[_0xe1ec('0x59')],util[_0xe1ec('0x78')](_0xe1ec('0xb5'),_0x888434['name'],_0x888434['id']));var _0x762232=null;return Interval[_0xe1ec('0xb6')](_0x559d70,_0x7db1dd)['then'](function(_0xb220a4){if(_0xb220a4===!![]){return _0xb220a4;}else{_0x888434['message']=_0x10ae53?utils[_0xe1ec('0x64')][_0xe1ec('0xa2')]:utils[_0xe1ec('0x64')]['OVERTIME_INTERVAL'];_0x762232=msgResponse(_0xe1ec('0xb7'),_0xe1ec('0x90'),_0xe1ec('0xa4')+_0x10ae53+'\x20'+_0x888434['name']+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x559d70,{'showHidden':![],'depth':null})+_0xe1ec('0xa6')+_0x7db1dd);}if(_0x762232!==null){logger[_0xe1ec('0xb4')](_0xe1ec('0xb8'),_0x762232);_0x762232[_0xe1ec('0xb9')]=_0x10ae53;throw _0x762232;}})[_0xe1ec('0x9f')](function(_0x15ca5d){logger[_0xe1ec('0x5e')](_0xe1ec('0xba'),_0x15ca5d);throw msgResponse('[ifTime][Action]',_0xe1ec('0x82'),util[_0xe1ec('0x3b')](_0x15ca5d,{'showHidden':![],'depth':null}));});};Dialer[_0xe1ec('0x12')][_0xe1ec('0x23')]=function(_0x186d4f){if(this[_0xe1ec('0x17')][_0x186d4f['queue']]){if(this[_0xe1ec('0x1e')][_0x186d4f[_0xe1ec('0xbb')]]&&this['uniqueId'][_0x186d4f[_0xe1ec('0xbb')]][_0xe1ec('0xbc')]!=='ivr'){this[_0xe1ec('0xbd')](this[_0xe1ec('0x17')][_0x186d4f['queue']]);this['uniqueId'][_0x186d4f[_0xe1ec('0xbb')]][_0xe1ec('0xbe')]=moment()[_0xe1ec('0x78')](_0xe1ec('0xbf'));}}};Dialer[_0xe1ec('0x12')][_0xe1ec('0xc0')]=function(_0x4f1854){var _0x24b026=this['uniqueId'][_0x4f1854[_0xe1ec('0xbb')]];if(this[_0xe1ec('0x17')][_0x4f1854[_0xe1ec('0xc1')]]){if(_0x24b026&&_0x24b026[_0xe1ec('0xbc')]!==_0xe1ec('0xc2')){delete this[_0xe1ec('0x1e')][_0x4f1854[_0xe1ec('0xbb')]];this[_0xe1ec('0x17')][_0x4f1854[_0xe1ec('0xc1')]][_0xe1ec('0xc3')]+=0x1;var _0x1f53b7=new AgentComplete(_0x24b026,_0x4f1854);if(_0x4f1854[_0xe1ec('0xc4')]===_0xe1ec('0xc5')){_0x1f53b7[_0xe1ec('0xc6')]=this[_0xe1ec('0x17')][_0x4f1854[_0xe1ec('0xc1')]][_0xe1ec('0xc7')]&&this[_0xe1ec('0x17')][_0x4f1854['queue']][_0xe1ec('0xc8')]?moment()[_0xe1ec('0x78')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils[_0xe1ec('0xc9')](_0x1f53b7)[_0xe1ec('0x9f')](loggerCatch(_0xe1ec('0xca')));hopperUtils[_0xe1ec('0xcb')](_0x1f53b7)[_0xe1ec('0x9f')](loggerCatch(_0xe1ec('0xcc')));}}};Dialer[_0xe1ec('0x12')]['syncQueueCallerAbandon']=function(_0x31baee){var _0x174d9e=this[_0xe1ec('0x1e')][_0x31baee[_0xe1ec('0xbb')]];var _0x485d91=this;var _0x1b6bb0=![];var _0x38056e;var _0x209a83;if(this[_0xe1ec('0x17')][_0x31baee[_0xe1ec('0xc1')]]){if(_0x174d9e&&_0x174d9e[_0xe1ec('0xbc')]!==_0xe1ec('0xc2')){delete this[_0xe1ec('0x1e')][_0x31baee['uniqueid']];this['updateOriginated'](this[_0xe1ec('0x17')][_0x31baee[_0xe1ec('0xc1')]]);_0x174d9e['droptime']=moment()[_0xe1ec('0x78')](_0xe1ec('0xbf'));var _0x1be75e=new QueueCallerAbandon(_0x174d9e,_0x31baee);if(utils[_0xe1ec('0xcd')](_0x174d9e[_0xe1ec('0xce')],_0x174d9e['responsetime'])>=_0x174d9e['dialQueueTimeout']){this[_0xe1ec('0x17')][_0x31baee[_0xe1ec('0xc1')]][_0xe1ec('0x45')]+=0x1;this['voiceQueues'][_0x31baee[_0xe1ec('0xc1')]]['outboundDropCallsDayTimeout']+=0x1;this['voiceQueues'][_0x31baee[_0xe1ec('0xc1')]][_0xe1ec('0xcf')]+=0x1;_0x1be75e[_0xe1ec('0xd0')]=0xa;_0x1be75e[_0xe1ec('0x69')]='Drop';_0x1be75e[_0xe1ec('0xd1')]=_0xe1ec('0xd2');_0x1be75e[_0xe1ec('0xc6')]=this[_0xe1ec('0x17')][_0x31baee['queue']][_0xe1ec('0xc7')]?moment()['format'](_0xe1ec('0xbf')):undefined;_0x1be75e[_0xe1ec('0xd3')]+=0x1;_0x1be75e[_0xe1ec('0xd4')]+=0x1;_0x38056e=this[_0xe1ec('0x17')][_0x31baee[_0xe1ec('0xc1')]][_0xe1ec('0xd5')];_0x209a83=this[_0xe1ec('0x17')][_0x31baee[_0xe1ec('0xc1')]]['callAdditionalPhoneAfterMin'];hopperUtils['verifyAdditionalPhones'](_0x1be75e,_0x1be75e[_0xe1ec('0xd0')],_0x174d9e[_0xe1ec('0xd6')])['then'](function(_0x479931){_0x1b6bb0=_0x479931[_0xe1ec('0xd7')]==0x1;if(_0x1be75e['countdropretry']>=_0x485d91[_0xe1ec('0x17')][_0x31baee[_0xe1ec('0xc1')]][_0xe1ec('0xd8')]){_0x485d91[_0xe1ec('0xd9')](_0x1be75e,_0x479931[_0xe1ec('0xd7')]);}else{hopperUtils[_0xe1ec('0xda')]({'active':![],'countdropretry':_0x1be75e[_0xe1ec('0xd3')],'scheduledat':moment()['add'](_0x485d91[_0xe1ec('0x17')][_0x31baee[_0xe1ec('0xc1')]][_0xe1ec('0xd5')],'minutes')['format'](_0xe1ec('0xbf')),'ContactId':_0x174d9e[_0xe1ec('0xdb')],'ListId':_0x174d9e[_0xe1ec('0xdc')],'VoiceQueueId':_0x174d9e['VoiceQueueId']||undefined,'CampaignId':_0x174d9e[_0xe1ec('0xdd')]||undefined})[_0xe1ec('0x9f')](loggerCatch(_0xe1ec('0xde')));var _0x56f3ea=new History(_0x1be75e);_0x56f3ea[_0xe1ec('0xd0')]=0xa;_0x56f3ea['statedesc']='Drop';_0x56f3ea['starttime']=moment()['format'](_0xe1ec('0xbf'));_0x56f3ea[_0xe1ec('0x6a')]=_0x56f3ea['starttime'];_0x56f3ea[_0xe1ec('0xdf')]=_0x1be75e[_0xe1ec('0xdf')];_0x56f3ea[_0xe1ec('0xe0')]=_0x1be75e['calleridnum'];hopperUtils[_0xe1ec('0xc9')](_0x56f3ea)['catch'](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0xe1ec('0x37')](function(){if(_0x1b6bb0)hopperUtils[_0xe1ec('0xe1')](_0x1be75e,_0x38056e,_0x209a83)[_0xe1ec('0x37')](function(){return 0x1;});});}else{this[_0xe1ec('0x17')][_0x31baee[_0xe1ec('0xc1')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0xe1ec('0x17')][_0x31baee['queue']][_0xe1ec('0xe2')]+=0x1;_0x1be75e[_0xe1ec('0xd0')]=0xb;_0x1be75e[_0xe1ec('0x69')]=_0xe1ec('0xe3');_0x1be75e[_0xe1ec('0xd1')]=_0xe1ec('0xe4');_0x1be75e[_0xe1ec('0xe5')]+=0x1;_0x1be75e[_0xe1ec('0xd4')]+=0x1;_0x38056e=this[_0xe1ec('0x17')][_0x31baee['queue']]['dialAbandonedRetryFrequency'];_0x209a83=this[_0xe1ec('0x17')][_0x31baee[_0xe1ec('0xc1')]][_0xe1ec('0xe6')];hopperUtils[_0xe1ec('0xe7')](_0x1be75e,_0x1be75e[_0xe1ec('0xd0')],_0x174d9e['voiceQueue'])[_0xe1ec('0x37')](function(_0x334f42){if(_0x1be75e[_0xe1ec('0xe5')]>=_0x485d91[_0xe1ec('0x17')][_0x31baee[_0xe1ec('0xc1')]]['dialAbandonedMaxRetry']){_0x485d91[_0xe1ec('0xd9')](_0x1be75e,_0x334f42[_0xe1ec('0xd7')]);}else{hopperUtils[_0xe1ec('0xda')]({'active':![],'countabandonedretry':_0x1be75e[_0xe1ec('0xe5')],'scheduledat':moment()[_0xe1ec('0xe8')](_0x485d91['voiceQueues'][_0x31baee[_0xe1ec('0xc1')]][_0xe1ec('0xe9')],_0xe1ec('0xea'))[_0xe1ec('0x78')](_0xe1ec('0xbf')),'ContactId':_0x174d9e[_0xe1ec('0xdb')],'ListId':_0x174d9e['ListId'],'VoiceQueueId':_0x174d9e['VoiceQueueId']||undefined,'CampaignId':_0x174d9e[_0xe1ec('0xdd')]||undefined})[_0xe1ec('0x9f')](loggerCatch(_0xe1ec('0xeb')));var _0x5c647c=new History(_0x1be75e);_0x5c647c['state']=0xb;_0x5c647c[_0xe1ec('0x69')]=_0xe1ec('0xe3');_0x5c647c['starttime']=moment()[_0xe1ec('0x78')](_0xe1ec('0xbf'));_0x5c647c['endtime']=_0x5c647c[_0xe1ec('0x6b')];_0x5c647c[_0xe1ec('0xdf')]=_0x1be75e['calleridname'];_0x5c647c[_0xe1ec('0xe0')]=_0x1be75e[_0xe1ec('0xe0')];hopperUtils[_0xe1ec('0xc9')](_0x5c647c)[_0xe1ec('0x9f')](loggerCatch(_0xe1ec('0xec')));}})[_0xe1ec('0x37')](function(){if(_0x1b6bb0)hopperUtils[_0xe1ec('0xe1')](_0x1be75e,_0x38056e,_0x209a83)[_0xe1ec('0x37')](function(){return 0x1;});});}}}};Dialer['prototype'][_0xe1ec('0x30')]=function(_0x47cb18){if(this[_0xe1ec('0x1c')][_0x47cb18[_0xe1ec('0xbb')]]){this[_0xe1ec('0x1c')][_0x47cb18[_0xe1ec('0xbb')]][_0xe1ec('0xed')]=_0x47cb18[_0xe1ec('0xed')];}if(this['uniqueId'][_0x47cb18[_0xe1ec('0xbb')]]){this[_0xe1ec('0x1e')][_0x47cb18[_0xe1ec('0xbb')]]['channel']=_0x47cb18[_0xe1ec('0xed')];}};Dialer[_0xe1ec('0x12')][_0xe1ec('0xee')]=function(_0x30f6e2){if(!this[_0xe1ec('0x1c')][_0x30f6e2[_0xe1ec('0xef')]]){return;}var _0x160fa7=this[_0xe1ec('0x17')][this[_0xe1ec('0x1c')][_0x30f6e2[_0xe1ec('0xef')]][_0xe1ec('0xc1')]][_0xe1ec('0xf0')]||'rrmemory';if(_0x160fa7==='roundrobin'){if(this[_0xe1ec('0x1c')][_0x30f6e2[_0xe1ec('0xef')]]&&_[_0xe1ec('0xf1')](this[_0xe1ec('0x1c')][_0x30f6e2[_0xe1ec('0xef')]][_0xe1ec('0xf2')])&&_0x30f6e2[_0xe1ec('0x86')]==='1'&&_0x30f6e2[_0xe1ec('0xf3')]==='0'){if(this[_0xe1ec('0x19')][_0x30f6e2[_0xe1ec('0xf4')]]){if(!this['agents'][_0x30f6e2[_0xe1ec('0xf4')]][_0xe1ec('0xf2')]){this['agents'][_0x30f6e2[_0xe1ec('0xf4')]][_0xe1ec('0xf2')]=!![];this[_0xe1ec('0x1c')][_0x30f6e2[_0xe1ec('0xef')]][_0xe1ec('0xf2')]=!![];this['actions'][_0x30f6e2['actionid']][_0xe1ec('0xf4')]=_0x30f6e2[_0xe1ec('0xf4')];}}}}else if(_0x160fa7===_0xe1ec('0xf5')){if(this[_0xe1ec('0x1c')][_0x30f6e2[_0xe1ec('0xef')]]){if(this['agents'][_0x30f6e2['stateinterface']]){this['actions'][_0x30f6e2[_0xe1ec('0xef')]][_0xe1ec('0xf4')]=_0x30f6e2[_0xe1ec('0xf4')];if(_[_0xe1ec('0xf1')](this[_0xe1ec('0x20')][this['actions'][_0x30f6e2['actionid']][_0xe1ec('0xc1')]])){this[_0xe1ec('0x20')][this[_0xe1ec('0x1c')][_0x30f6e2[_0xe1ec('0xef')]][_0xe1ec('0xc1')]]=[];}this[_0xe1ec('0x20')][this['actions'][_0x30f6e2[_0xe1ec('0xef')]]['queue']]['push'](_[_0xe1ec('0x58')](_[_0xe1ec('0x70')](this['actions'][_0x30f6e2[_0xe1ec('0xef')]],[_0xe1ec('0xf6'),_0xe1ec('0xf4')]),{'status':_0x30f6e2['status'],'paused':_0x30f6e2['paused']}));}}}};Dialer[_0xe1ec('0x12')][_0xe1ec('0x34')]=function(_0x5e95a3){if(!this[_0xe1ec('0x1c')][_0x5e95a3[_0xe1ec('0xef')]]){return;}var _0x312e1c=this;var _0x49f2f1=this[_0xe1ec('0x17')][this[_0xe1ec('0x1c')][_0x5e95a3[_0xe1ec('0xef')]]['queue']];var _0xa22dfd=_0x49f2f1[_0xe1ec('0xf0')]||'rrmemory';if(_0xa22dfd===_0xe1ec('0xf7')){if(this[_0xe1ec('0x1c')][_0x5e95a3[_0xe1ec('0xef')]]&&this[_0xe1ec('0x1c')][_0x5e95a3[_0xe1ec('0xef')]]['stateinterface']){this[_0xe1ec('0x16')][_0xe1ec('0xf8')](this[_0xe1ec('0x1c')][_0x5e95a3[_0xe1ec('0xef')]][_0xe1ec('0xf6')],this[_0xe1ec('0x1c')][_0x5e95a3[_0xe1ec('0xef')]][_0xe1ec('0xf4')])[_0xe1ec('0x9f')](function(_0x98d437){logger['error'](_0xe1ec('0xf9'),util['inspect'](_0x98d437,{'showHidden':![],'depth':null}));})[_0xe1ec('0x14')](function(){_0x312e1c[_0xe1ec('0xbd')](_0x312e1c[_0xe1ec('0x17')][_0x312e1c[_0xe1ec('0x1c')][_0x5e95a3['actionid']]['queue']]);_0x312e1c[_0xe1ec('0x19')][_0x312e1c['actions'][_0x5e95a3[_0xe1ec('0xef')]][_0xe1ec('0xf4')]][_0xe1ec('0xf2')]=![];delete _0x312e1c['actions'][_0x5e95a3[_0xe1ec('0xef')]];unlockQueueStatus(_0x49f2f1);});}else{this['updateOriginated'](this['voiceQueues'][this[_0xe1ec('0x1c')][_0x5e95a3[_0xe1ec('0xef')]][_0xe1ec('0xc1')]]);hopperUtils[_0xe1ec('0xda')]({'active':![],'ContactId':this[_0xe1ec('0x1c')][_0x5e95a3[_0xe1ec('0xef')]][_0xe1ec('0xdb')],'ListId':this['actions'][_0x5e95a3[_0xe1ec('0xef')]][_0xe1ec('0xdc')],'VoiceQueueId':this['actions'][_0x5e95a3[_0xe1ec('0xef')]]['VoiceQueueId']||undefined,'CampaignId':this['actions'][_0x5e95a3[_0xe1ec('0xef')]][_0xe1ec('0xdd')]||undefined})[_0xe1ec('0x9f')](loggerCatch(_0xe1ec('0xfa')));delete this[_0xe1ec('0x1c')][_0x5e95a3[_0xe1ec('0xef')]];unlockQueueStatus(_0x49f2f1);}}else if(_0xa22dfd==='rrmemory'){var _0x579e5b;if(this[_0xe1ec('0x1c')][_0x5e95a3[_0xe1ec('0xef')]]&&!_['isEmpty'](this[_0xe1ec('0x20')][this['actions'][_0x5e95a3['actionid']][_0xe1ec('0xc1')]])){if(this[_0xe1ec('0xfb')][_0x312e1c['actions'][_0x5e95a3[_0xe1ec('0xef')]][_0xe1ec('0xc1')]]){this['queueBookedRR'][_0x312e1c['actions'][_0x5e95a3['actionid']][_0xe1ec('0xc1')]]=this[_0xe1ec('0xfb')][this['actions'][_0x5e95a3[_0xe1ec('0xef')]][_0xe1ec('0xc1')]]?this[_0xe1ec('0xfb')][this['actions'][_0x5e95a3[_0xe1ec('0xef')]][_0xe1ec('0xc1')]]:this[_0xe1ec('0x20')][this[_0xe1ec('0x1c')][_0x5e95a3[_0xe1ec('0xef')]][_0xe1ec('0xc1')]]?this[_0xe1ec('0x20')][this[_0xe1ec('0x1c')][_0x5e95a3[_0xe1ec('0xef')]]['queue']][_0xe1ec('0xfc')]||0x0:0x0;}this['queueBooked'][this['actions'][_0x5e95a3['actionid']][_0xe1ec('0xc1')]]['_rr']=this[_0xe1ec('0xfb')][this[_0xe1ec('0x1c')][_0x5e95a3[_0xe1ec('0xef')]][_0xe1ec('0xc1')]];for(var _0x4be4ef=0x0;_0x4be4ef=_0x3d975e[_0xe1ec('0x120')]){_0x33b7ac[_0xe1ec('0x121')](_0x3de54a,_0x36d1bb,_0x21293a,'reason19\x20machine....');}else{if(_0x3de54a['countmachineretry']>=_0x3d975e[_0xe1ec('0x122')]){_0x33b7ac['createStateFinal'](_0x3de54a,_0x36d1bb,_0x21293a,_0xe1ec('0x123'));}else{hopperUtils[_0xe1ec('0xda')]({'active':![],'countmachineretry':_0x3de54a[_0xe1ec('0x11b')],'scheduledat':moment()[_0xe1ec('0xe8')](_0x3d975e[_0xe1ec('0x124')],_0xe1ec('0xea'))[_0xe1ec('0x78')](_0xe1ec('0xbf')),'ContactId':_0x3de54a[_0xe1ec('0xdb')],'ListId':_0x3de54a[_0xe1ec('0xdc')],'VoiceQueueId':_0x3de54a[_0xe1ec('0x103')]||undefined,'CampaignId':_0x3de54a['CampaignId']||undefined})[_0xe1ec('0x9f')](loggerCatch(_0xe1ec('0x125')));_0x36d1bb({'reschedule':0x1});}}});}if(_0x17d56e[_0xe1ec('0xbc')]===_0xe1ec('0xc2')&&this[_0xe1ec('0x18')][_0x17d56e[_0xe1ec('0xc1')]][_0xe1ec('0x10e')]&&_0x3964ca[_0xe1ec('0x10f')]===_0xe1ec('0x110')){delete this['uniqueId'][_0x3964ca[_0xe1ec('0xbb')]];this[_0xe1ec('0xbd')](this['campaigns'][_0x17d56e[_0xe1ec('0xc1')]]);_0x407fcd=new Hangup(_0x17d56e,_0x3964ca);_0x407fcd[_0xe1ec('0xd0')]=0x12;_0x407fcd[_0xe1ec('0x69')]=_0xe1ec('0x111');_0x407fcd[_0xe1ec('0x112')]=_0xe1ec('0x113');ami[_0xe1ec('0x39')](_0xe1ec('0x114'),ut[_0xe1ec('0x126')](_0x407fcd,'amd'));this[_0xe1ec('0x116')](_0x407fcd,_0xe1ec('0x127'),_0xe1ec('0x128'));}if(_0x17d56e[_0xe1ec('0xbc')]===_0xe1ec('0xc2')&&this[_0xe1ec('0x18')][_0x17d56e[_0xe1ec('0xc1')]]['dialAMDActive']&&_0x3964ca[_0xe1ec('0x10f')]===_0xe1ec('0x119')){return new Promise(function(_0xfe15ae,_0x43847b){delete _0x33b7ac[_0xe1ec('0x1e')][_0x3964ca[_0xe1ec('0xbb')]];_0x33b7ac[_0xe1ec('0xbd')](_0x33b7ac[_0xe1ec('0x18')][_0x17d56e[_0xe1ec('0xc1')]]);_0x33b7ac[_0xe1ec('0x18')][_0x17d56e['queue']][_0xe1ec('0xc3')]+=0x1;_0x33b7ac[_0xe1ec('0x18')][_0x17d56e[_0xe1ec('0xc1')]][_0xe1ec('0x129')]+=0x1;var _0x433638=_0x33b7ac[_0xe1ec('0x18')][_0x17d56e[_0xe1ec('0xc1')]];var _0x596543=new Hangup(_0x17d56e,_0x3964ca);_0x596543[_0xe1ec('0xd0')]=0x13;_0x596543[_0xe1ec('0x69')]='Machine';_0x596543[_0xe1ec('0x112')]=_0xe1ec('0x113');_0x596543[_0xe1ec('0x11b')]+=0x1;_0x596543[_0xe1ec('0xd4')]+=0x1;_0x596543[_0xe1ec('0x115')]=!![];ami['emit']('custom:amd',ut[_0xe1ec('0x126')](_0x596543,_0xe1ec('0x115')));hopperUtils[_0xe1ec('0xc9')](_0x596543)['catch'](loggerCatch(_0xe1ec('0x11c')));if(_0x596543[_0xe1ec('0x12a')]+_0x596543[_0xe1ec('0x12b')]+_0x596543[_0xe1ec('0x11d')]+_0x596543[_0xe1ec('0x11e')]+_0x596543['countdropretry']+_0x596543[_0xe1ec('0xe5')]+_0x596543[_0xe1ec('0x11b')]+_0x596543[_0xe1ec('0x11f')]>=_0x433638[_0xe1ec('0x120')]){_0x33b7ac['stateGlobal'](_0x596543,_0xfe15ae,_0x43847b,_0xe1ec('0x12c'));}else{if(_0x596543[_0xe1ec('0x11b')]>=_0x433638[_0xe1ec('0x122')]){_0x33b7ac[_0xe1ec('0x12d')](_0x596543,_0xfe15ae,_0x43847b,_0xe1ec('0x123'));}else{hopperUtils[_0xe1ec('0xda')]({'active':![],'countmachineretry':_0x596543[_0xe1ec('0x11b')],'scheduledat':moment()[_0xe1ec('0xe8')](_0x433638[_0xe1ec('0x124')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x596543[_0xe1ec('0xdb')],'ListId':_0x596543['ListId'],'VoiceQueueId':_0x596543[_0xe1ec('0x103')]||undefined,'CampaignId':_0x596543['CampaignId']||undefined})[_0xe1ec('0x9f')](loggerCatch(_0xe1ec('0x125')));_0xfe15ae({'reschedule':0x1});}}});}}};Dialer[_0xe1ec('0x12')][_0xe1ec('0x2e')]=function(_0x1c4c65){var _0x3fef76=this[_0xe1ec('0x1e')][_0x1c4c65['uniqueid']];var _0x4fe333;if(_0x3fef76&&_0x3fef76[_0xe1ec('0xbc')]==='ivr'){delete this[_0xe1ec('0x1e')][_0x1c4c65['uniqueid']];this[_0xe1ec('0xbd')](this[_0xe1ec('0x18')][_0x3fef76['queue']]);this[_0xe1ec('0x18')][_0x3fef76[_0xe1ec('0xc1')]][_0xe1ec('0x12e')]+=0x1;_0x4fe333=new Hangup(_0x3fef76,_0x1c4c65);hopperUtils['createHistory'](_0x4fe333)[_0xe1ec('0x9f')](loggerCatch(_0xe1ec('0x12f')));hopperUtils['moveContactManagedDialer'](_0x4fe333)['catch'](loggerCatch(_0xe1ec('0x130')));}if(_0x3fef76&&_0x3fef76[_0xe1ec('0xbc')]!==_0xe1ec('0xc2')&&isNotNull(this[_0xe1ec('0x17')][_0x3fef76[_0xe1ec('0xc1')]][_0xe1ec('0x131')])){delete this['uniqueId'][_0x1c4c65[_0xe1ec('0xbb')]];this[_0xe1ec('0xbd')](this[_0xe1ec('0x17')][_0x3fef76[_0xe1ec('0xc1')]]);this['voiceQueues'][_0x3fef76[_0xe1ec('0xc1')]][_0xe1ec('0xc3')]+=0x1;this[_0xe1ec('0x17')][_0x3fef76[_0xe1ec('0xc1')]][_0xe1ec('0x129')]+=0x1;_0x4fe333=new Hangup(_0x3fef76,_0x1c4c65);_0x4fe333[_0xe1ec('0xd0')]=0x10;_0x4fe333[_0xe1ec('0x69')]=_0xe1ec('0x132');_0x4fe333[_0xe1ec('0x112')]=_0xe1ec('0x133');hopperUtils[_0xe1ec('0xc9')](_0x4fe333)[_0xe1ec('0x9f')](loggerCatch(_0xe1ec('0x12f')));hopperUtils[_0xe1ec('0xcb')](_0x4fe333)[_0xe1ec('0x9f')](loggerCatch(_0xe1ec('0x130')));}if(_0x3fef76&&_0x3fef76[_0xe1ec('0xbc')]!==_0xe1ec('0xc2')&&!isNotNull(this[_0xe1ec('0x17')][_0x3fef76[_0xe1ec('0xc1')]][_0xe1ec('0x131')])){delete this[_0xe1ec('0x1e')][_0x1c4c65['uniqueid']];this[_0xe1ec('0xbd')](this['voiceQueues'][_0x3fef76[_0xe1ec('0xc1')]]);this[_0xe1ec('0x17')][_0x3fef76[_0xe1ec('0xc1')]][_0xe1ec('0x134')]+=0x1;_0x4fe333=new Hangup(_0x3fef76,_0x1c4c65);_0x4fe333['state']=0xc;_0x4fe333[_0xe1ec('0x69')]=_0x1c4c65[_0xe1ec('0x135')];_0x4fe333[_0xe1ec('0x112')]='Unknow';hopperUtils['createHistory'](_0x4fe333)[_0xe1ec('0x9f')](loggerCatch(_0xe1ec('0x12f')));hopperUtils[_0xe1ec('0xcb')](_0x4fe333)[_0xe1ec('0x9f')](loggerCatch(_0xe1ec('0x130')));}};Dialer['prototype'][_0xe1ec('0x2a')]=function(_0xa1196d){var _0x287da1=this;if(!_0x287da1[_0xe1ec('0x21')][_0xa1196d[_0xe1ec('0x59')]]){_0x287da1[_0xe1ec('0x21')][_0xa1196d['name']]={'running':![]};}else if(_0x287da1[_0xe1ec('0x21')][_0xa1196d['name']]['running']===!![]){return;}else if(_0x287da1[_0xe1ec('0x21')][_0xa1196d['name']][_0xe1ec('0x136')]===![]){_0x287da1[_0xe1ec('0x21')][_0xa1196d[_0xe1ec('0x59')]]['running']=!![];}var _0x313752=_0x287da1['voiceQueues'][_0xa1196d[_0xe1ec('0x59')]];var _0xbe5a11=_0x313752['message']!==utils[_0xe1ec('0x64')][_0xe1ec('0x76')];var _0x105b34=utils['isPreviewCampaign'](_0x313752);_0x313752['statusMessage']=utils[_0xe1ec('0x137')](_0x313752,_0x287da1[_0xe1ec('0x1a')]);Promise[_0xe1ec('0xaa')]()[_0xe1ec('0x37')](function(){if(_0x313752['statusMessage']===utils['CAMPAIGN_STATUS'][_0xe1ec('0x76')]){if(_0xbe5a11){clearPredictiveAttributes(_0x313752);_0xa1196d['startPredictive']=undefined;_0xa1196d[_0xe1ec('0x138')]=undefined;}if(_0x313752[_0xe1ec('0x139')]===utils[_0xe1ec('0x64')][_0xe1ec('0x76')]){_0xa1196d['available']=0x0;_0xa1196d['paused']=0x0;_0xa1196d['inUse']=0x0;_0xa1196d[_0xe1ec('0x13a')]=0x0;_0xa1196d['pTalking']=0x0;}}else if(_0x313752['statusMessage']===utils[_0xe1ec('0x64')]['ACTIVE']&&!_0x105b34){return _0x287da1[_0xe1ec('0x8f')](_0x313752,!![])[_0xe1ec('0x37')](function(){return _0x287da1[_0xe1ec('0x8f')](_0x313752,![]);})[_0xe1ec('0x37')](function(){return _0x287da1[_0xe1ec('0xad')](_0x313752);})[_0xe1ec('0x9f')](function(_0x19e9f9){loggerSyncQueueSummary[_0xe1ec('0x5b')](_0xe1ec('0x13b'),util[_0xe1ec('0x3b')](_0x19e9f9,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x313752);});}else{clearPredictiveAttributes(_0x313752);}})[_0xe1ec('0x37')](function(){var _0x4dc5c1=_0xa1196d['compareToOutboundQueue'](_0x313752);if(_0x4dc5c1||_0x313752['queueSummaryCountersUpdated']){_0x313752['queueSummaryCountersUpdated']=![];_0xa1196d['updateReportFromOutboundQueue'](_0x313752);Object[_0xe1ec('0x13c')](_0x313752,_0xa1196d);emitOutboundVoiceQueueSummary(_0xa1196d);}_0x287da1[_0xe1ec('0x21')][_0x313752['name']][_0xe1ec('0x136')]=![];})[_0xe1ec('0x9f')](function(_0x529fb3){logger['error'](_0xe1ec('0x13b'),util[_0xe1ec('0x3b')](_0x529fb3,{'showHidden':![],'depth':null}));_0x287da1[_0xe1ec('0x21')][_0x313752['name']][_0xe1ec('0x136')]=![];});};Dialer[_0xe1ec('0x12')][_0xe1ec('0x2c')]=_[_0xe1ec('0x13d')](function(){var _0x17597d=_['filter'](this[_0xe1ec('0x17')],function(_0x3cffeb){return _0x3cffeb[_0xe1ec('0x13e')];});var _0xe9009d=_['filter'](this[_0xe1ec('0x19')],function(_0x56d2d9){return _0x56d2d9[_0xe1ec('0x13f')]&&_0x56d2d9[_0xe1ec('0x86')]===_0xe1ec('0x140');});if(_0x17597d['length']>0x0&&_0xe9009d[_0xe1ec('0x97')]>0x0){return Promise[_0xe1ec('0xaa')]()[_0xe1ec('0x37')](cmHopper['handlePreviewRecallNotifications'](_[_0xe1ec('0x141')](_0x17597d,'id'),previewRecallmeReminderInterval,_['map'](_0xe9009d,'id')))['then'](function(_0x94a32e){for(var _0x5efcbd=0x0;_0x5efcbd<_0x94a32e[_0xe1ec('0x97')];_0x5efcbd++){var _0x1c8787=_0x94a32e[_0x5efcbd]['Agent'][_0xe1ec('0x59')];if(_0x1c8787)io['to'](util[_0xe1ec('0x78')](_0xe1ec('0x142'),_0x1c8787))[_0xe1ec('0x39')](_0xe1ec('0x143'),{'hopper':_0x94a32e[_0x5efcbd]});}})[_0xe1ec('0x9f')](function(_0x1ca322){logger[_0xe1ec('0x5e')]('checkPreviewRecallReminder',_0x1ca322);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xe1ec('0x12')][_0xe1ec('0x36')]=function(){var _0x5147b3=this;setInterval(function(){_0x5147b3['clearZombieChannels'](_0x5147b3[_0xe1ec('0x1e')],_0xe1ec('0x144'));_0x5147b3[_0xe1ec('0x145')](_0x5147b3['actions'],_0xe1ec('0x146'));},0x32c8);};Dialer[_0xe1ec('0x12')][_0xe1ec('0x145')]=function(_0x419ada,_0x539fe4){var _0x116e5c=this;for(var _0xe99f25 in _0x419ada){if(typeof _0x419ada[_0xe99f25]!==_0xe1ec('0xa8')){this[_0xe1ec('0x15')][_0xe1ec('0x147')](function(){if(!_['isNil'](_0x419ada[_0xe99f25])){return ami['Action']({'action':_0xe1ec('0x86'),'channel':_0x419ada[_0xe99f25][_0xe1ec('0xed')]})[_0xe1ec('0x9f')](function(_0x48985e){if(_0x48985e[_0xe1ec('0x63')]===_0xe1ec('0x148')){setTimeout(function(){if(_0x419ada[_0xe99f25]&&_0x419ada[_0xe99f25][_0xe1ec('0xbc')]!==_0xe1ec('0xc2')){_0x116e5c[_0xe1ec('0xbd')](_0x116e5c['voiceQueues'][_0x419ada[_0xe99f25][_0xe1ec('0xc1')]]);logger[_0xe1ec('0x5e')]('[Dialer][checkChannel]',_0x539fe4,_0xe99f25,_0x419ada[_0xe99f25][_0xe1ec('0xc1')]);delete _0x419ada[_0xe99f25];}if(_0x419ada[_0xe99f25]&&_0x419ada[_0xe99f25][_0xe1ec('0xbc')]===_0xe1ec('0xc2')){_0x116e5c[_0xe1ec('0xbd')](_0x116e5c[_0xe1ec('0x18')][_0x419ada[_0xe99f25]['queue']]);logger[_0xe1ec('0x5e')]('[Dialer][checkChannel][ivr]',_0x539fe4,_0xe99f25,_0x419ada[_0xe99f25][_0xe1ec('0xc1')]);delete _0x419ada[_0xe99f25];}},0x2328);}});}});}}};Dialer[_0xe1ec('0x12')][_0xe1ec('0x149')]=function(_0x1778cd){return Promise[_0xe1ec('0xaa')]()['then'](voiceQueueRt[_0xe1ec('0x149')](_0x1778cd))[_0xe1ec('0x9f')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0xe1ec('0x12')][_0xe1ec('0xbd')]=function(_0x466230){if(!_[_0xe1ec('0x4d')](_0x466230)&&_0x466230!==null){if(typeof _0x466230[_0xe1ec('0x7c')]!=='undefined'){if(_0x466230[_0xe1ec('0x7c')]>0x0){_0x466230[_0xe1ec('0x7c')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xe1ec('0x5e')](_0xe1ec('0x14a'));}};Dialer[_0xe1ec('0x12')][_0xe1ec('0x14b')]=function(_0x353b04,_0x4b8c08){var _0x3adae9=this;return function(_0x26005b){_0x3adae9[_0xe1ec('0xbd')](_0x4b8c08);logger[_0xe1ec('0x5e')](_0x353b04,util[_0xe1ec('0x3b')](_0x26005b,{'showHidden':![],'depth':null}));};};Dialer[_0xe1ec('0x12')][_0xe1ec('0x14c')]=function(_0x239989,_0x2d62d8,_0x16abe9){var _0x19895e={'state':0x19,'statedesc':_0xe1ec('0x14d')};this['updateOriginated'](_0x2d62d8);this[_0xe1ec('0x116')](_[_0xe1ec('0x58')](_0x19895e,_[_0xe1ec('0x70')](_0x16abe9,[_0xe1ec('0xdb'),'ListId',_0xe1ec('0x14e'),_0xe1ec('0x103'),_0xe1ec('0xdd')])),_0xe1ec('0x14f'),_0xe1ec('0x150'));logger[_0xe1ec('0x5e')](_0x239989);};Dialer[_0xe1ec('0x12')][_0xe1ec('0x116')]=function(_0x4fe77c,_0x5e2b5f,_0xb66a16){hopperUtils[_0xe1ec('0xc9')](_0x4fe77c)[_0xe1ec('0x9f')](loggerCatch(_0x5e2b5f));hopperUtils[_0xe1ec('0xcb')](_0x4fe77c)[_0xe1ec('0x9f')](loggerCatch(_0xb66a16));};Dialer['prototype'][_0xe1ec('0xd9')]=function(_0x15b235,_0x3cbfd7){hopperUtils['createHistory'](_0x15b235)[_0xe1ec('0x9f')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x3cbfd7==0x0){hopperUtils[_0xe1ec('0xcb')](_0x15b235)[_0xe1ec('0x9f')](loggerCatch(_0xe1ec('0x151')));}};Dialer['prototype'][_0xe1ec('0x152')]=function(_0x40eb84){return Promise[_0xe1ec('0xaa')]()[_0xe1ec('0x37')](cmHopper[_0xe1ec('0x153')](_0x40eb84['id'],previewRecallmeReminderInterval))[_0xe1ec('0x37')](function(_0x45de41){for(var _0x15d680=0x0;_0x15d680<_0x45de41[_0xe1ec('0x97')];_0x15d680++){var _0x1783ec=_0x45de41[_0x15d680][_0xe1ec('0x154')][_0xe1ec('0x59')];if(_0x1783ec)io['to'](util[_0xe1ec('0x78')]('user:%s',_0x1783ec))[_0xe1ec('0x39')](_0xe1ec('0x143'),{'hopper':_0x45de41[_0x15d680]});}})[_0xe1ec('0x9f')](function(){});};Dialer[_0xe1ec('0x12')][_0xe1ec('0x155')]=function(_0xd774e5){var _0x1ad9a1=this;return function(){_0x1ad9a1[_0xe1ec('0x156')](_0xd774e5);};};Dialer[_0xe1ec('0x12')][_0xe1ec('0x157')]=function(_0xe68197,_0x2434be){var _0x423175=this;var _0x552c1b=uuid['v4']();this[_0xe1ec('0x1c')][_0x552c1b]=new Action(_0xe68197,_0x2434be,_0x552c1b);return new Promise(function(_0x19eadc,_0x43c558){if(_[_0xe1ec('0x4d')](_0xe68197)&&typeof _0xe68197!==_0xe1ec('0x158')){return _0x43c558(msgResponse('originate',_0xe1ec('0x90'),_0xe1ec('0x159')));}if(_[_0xe1ec('0x4d')](_0x2434be[_0xe1ec('0x15a')])||_0x2434be[_0xe1ec('0x15a')]===null){return _0x43c558(msgResponse(_0xe1ec('0x15b'),_0xe1ec('0x90'),_0xe1ec('0x15c')));}var _0x44bc95={'XMD-CALLERID':_0x423175[_0xe1ec('0x1c')][_0x552c1b][_0xe1ec('0x15d')](),'XMD-AGI':_0xe68197['dialQueueProject']?util['format'](_0xe1ec('0x15e'),ipAgi,_0xe68197['dialQueueProject']):_0xe1ec('0x15f'),'XMD-AGIAFTER':_0xe68197[_0xe1ec('0xc7')]?util[_0xe1ec('0x78')](_0xe1ec('0x15e'),ipAgi,_0xe68197[_0xe1ec('0xc7')]):_0xe1ec('0x15f'),'XMD-QUEUE':utils[_0xe1ec('0x160')](_0xe68197)?util[_0xe1ec('0x78')](_0xe1ec('0x161'),_0xe68197[_0xe1ec('0x59')],_0xe68197[_0xe1ec('0x162')]||'',_0xe68197['dialAgiAfterHangupAgent']?'c':'',_0xe68197['dialQueueTimeout']||0x3):_0xe1ec('0x15f'),'XMD-CONTACTID':_0x2434be['ContactId'],'XMD-CDRTYPE':_0xe1ec('0x163'),'CALLERID(all)':_0x423175[_0xe1ec('0x1c')][_0x552c1b][_0xe1ec('0x15d')](),'XMD-AMD':_0xe68197[_0xe1ec('0x10e')]?'ACTIVE':_0xe1ec('0x15f'),'XMD-DESTINATION':_0xe1ec('0x10d')};if(_0xe68197['dialAMDActive']){_0x44bc95['XMD-AMDINITIALSILENCE']=_0xe68197[_0xe1ec('0x164')]||0x9c4;_0x44bc95[_0xe1ec('0x165')]=_0xe68197[_0xe1ec('0x166')]||0x5dc;_0x44bc95[_0xe1ec('0x167')]=_0xe68197[_0xe1ec('0x168')]||0x320;_0x44bc95['XMD-AMDTOTALANALYSISTIME']=_0xe68197['dialAMDTotalAnalysisTime']||0x1388;_0x44bc95[_0xe1ec('0x169')]=_0xe68197[_0xe1ec('0x16a')]||0x64;_0x44bc95[_0xe1ec('0x16b')]=_0xe68197[_0xe1ec('0x16c')]||0x32;_0x44bc95[_0xe1ec('0x16d')]=_0xe68197[_0xe1ec('0x16e')]||0x3;_0x44bc95[_0xe1ec('0x16f')]=_0xe68197[_0xe1ec('0x170')]||0x100;_0x44bc95[_0xe1ec('0x171')]=_0xe68197[_0xe1ec('0x172')]||0x1388;}if(utils[_0xe1ec('0x160')](_0xe68197)){_0x44bc95[_0xe1ec('0x173')]=_0x2434be['VoiceQueueId'];}else{_0x44bc95[_0xe1ec('0x174')]=_0x2434be['CampaignId'];}var _0x5c1023=utils[_0xe1ec('0x175')](_0x2434be[_0xe1ec('0x176')]);Object['assign'](_0x44bc95,_0x5c1023);var _0xbf42b5=_0x423175['isTrunkReachable'](_0xe68197[_0xe1ec('0x89')])?utils[_0xe1ec('0x177')](_0xe68197[_0xe1ec('0x89')][_0xe1ec('0x178')],_0xe68197[_0xe1ec('0x179')],_0xe68197[_0xe1ec('0x17a')]>0x0?utils[_0xe1ec('0x17b')](_0xe68197[_0xe1ec('0x17c')],_0xe68197[_0xe1ec('0x17a')]):_0xe68197[_0xe1ec('0x17c')]):utils[_0xe1ec('0x177')](_[_0xe1ec('0xf1')](_0xe68197[_0xe1ec('0x8a')])?_0xe68197[_0xe1ec('0x89')][_0xe1ec('0x178')]:_0xe68197[_0xe1ec('0x8a')]['callerid'],_0xe68197[_0xe1ec('0x179')],_0xe68197[_0xe1ec('0x17a')]>0x0?utils[_0xe1ec('0x17b')](_0xe68197[_0xe1ec('0x17c')],_0xe68197[_0xe1ec('0x17a')]):_0xe68197[_0xe1ec('0x17c')]);if(_0xbf42b5){_0x44bc95['XMD-ORIGINATECALLERIDNAME']=_0x423175[_0xe1ec('0x1c')][_0x552c1b][_0xe1ec('0x17d')]=utils[_0xe1ec('0x17e')](_0xbf42b5);_0x44bc95[_0xe1ec('0x17f')]=_0x2434be[_0xe1ec('0x15a')];}_0xe68197['variables']=_0x44bc95;return ami[_0xe1ec('0x99')]({'actionid':_0x552c1b,'action':_0xe1ec('0x15b'),'channel':_0x423175['isTrunkReachable'](_0xe68197['Trunk'])?util[_0xe1ec('0x78')](_0xe1ec('0x180'),_0xe68197[_0xe1ec('0x89')]['name'],isNotNull(_0xe68197[_0xe1ec('0x181')])?_0xe68197['dialPrefix']['trim']()||'':'',_0xe68197[_0xe1ec('0x182')]>0x0?_0x2434be[_0xe1ec('0x15a')][_0xe1ec('0x183')](_0xe68197['dialCutDigit']):_0x2434be[_0xe1ec('0x15a')]):util['format'](_0xe1ec('0x180'),_[_0xe1ec('0xf1')](_0xe68197[_0xe1ec('0x8a')])?_0xe68197['Trunk'][_0xe1ec('0x59')]:_0xe68197['TrunkBackup'][_0xe1ec('0x59')],isNotNull(_0xe68197[_0xe1ec('0x181')])?_0xe68197[_0xe1ec('0x181')][_0xe1ec('0x184')]()||'':'',_0xe68197[_0xe1ec('0x182')]>0x0?_0x2434be[_0xe1ec('0x15a')]['substring'](_0xe68197['dialCutDigit']):_0x2434be[_0xe1ec('0x15a')]),'callerid':_0xbf42b5,'Exten':_0xe1ec('0x10d'),'Context':_0xe1ec('0x185'),'Priority':'1','variable':_0x44bc95,'timeout':(_0xe68197['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x552c1b})['then'](function(_0x895986){return _0x19eadc(_0x895986);})[_0xe1ec('0x9f')](function(_0x2ac661){_0xe68197[_0xe1ec('0x186')]+=0x1;var _0x5865ee=new History(_0x423175[_0xe1ec('0x1c')][_0x552c1b]);logger['error'](util[_0xe1ec('0x78')](_0xe1ec('0x187'),JSON['stringify'](_0x2ac661)));_0x5865ee[_0xe1ec('0xd0')]=0xe;_0x5865ee[_0xe1ec('0x69')]=_0xe1ec('0x188');_0x5865ee[_0xe1ec('0x6b')]=moment()[_0xe1ec('0x78')](_0xe1ec('0xbf'));_0x5865ee[_0xe1ec('0x6a')]=_0x5865ee[_0xe1ec('0x6b')];hopperUtils[_0xe1ec('0xc9')](_0x5865ee)['catch'](loggerCatch(_0xe1ec('0x189')));_0x423175[_0xe1ec('0xcb')](_0x5865ee)[_0xe1ec('0x9f')](loggerCatch(_0xe1ec('0x189')))['finally'](function(){delete _0x423175[_0xe1ec('0x1c')][_0x552c1b];return _0x43c558(msgResponse(_0xe1ec('0x15b'),_0xe1ec('0x82'),_0xe1ec('0x18a')));});});});};Dialer['prototype'][_0xe1ec('0x18b')]=function(_0x13522f,_0xa3fab4,_0x3c990d){var _0x3afc72=new History(_0xa3fab4);if(_0x3afc72[_0xe1ec('0x12a')]+_0x3afc72['countcongestionretry']+_0x3afc72[_0xe1ec('0x11d')]+_0x3afc72[_0xe1ec('0x11e')]+_0x3afc72['countdropretry']+_0x3afc72[_0xe1ec('0xe5')]+_0x3afc72[_0xe1ec('0x11b')]+_0x3afc72[_0xe1ec('0x11f')]>=_0x3c990d[_0xe1ec('0x120')]-0x1){return!![];}switch(_0x13522f){case 0x3:if(_0x3afc72[_0xe1ec('0x11d')]>=_0x3c990d[_0xe1ec('0x18c')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x3afc72['countnoanswerretry']+=0x1,'scheduledat':moment()[_0xe1ec('0xe8')](_0x3c990d[_0xe1ec('0x18d')],_0xe1ec('0xea'))['format'](_0xe1ec('0xbf')),'ContactId':_0x3afc72[_0xe1ec('0xdb')],'ListId':_0x3afc72[_0xe1ec('0xdc')],'VoiceQueueId':_0x3afc72['VoiceQueueId']||undefined,'CampaignId':_0x3afc72[_0xe1ec('0xdd')]||undefined})[_0xe1ec('0x9f')](loggerCatch(_0xe1ec('0x18e')));break;case 0x5:if(_0x3afc72[_0xe1ec('0x12a')]>=_0x3c990d['dialBusyMaxRetry']-0x1){return!![];}hopperUtils[_0xe1ec('0xda')]({'active':![],'countbusyretry':_0x3afc72[_0xe1ec('0x12a')]+=0x1,'scheduledat':moment()[_0xe1ec('0xe8')](_0x3c990d[_0xe1ec('0x18f')],_0xe1ec('0xea'))['format'](_0xe1ec('0xbf')),'ContactId':_0x3afc72['ContactId'],'ListId':_0x3afc72[_0xe1ec('0xdc')],'VoiceQueueId':_0x3afc72[_0xe1ec('0x103')]||undefined,'CampaignId':_0x3afc72[_0xe1ec('0xdd')]||undefined})['catch'](loggerCatch(_0xe1ec('0x190')));break;case 0x8:if(_0x3afc72[_0xe1ec('0x12b')]>=_0x3c990d[_0xe1ec('0x191')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0x3afc72['countcongestionretry']+=0x1,'scheduledat':moment()['add'](_0x3c990d[_0xe1ec('0x192')],'minutes')[_0xe1ec('0x78')](_0xe1ec('0xbf')),'ContactId':_0x3afc72[_0xe1ec('0xdb')],'ListId':_0x3afc72[_0xe1ec('0xdc')],'VoiceQueueId':_0x3afc72['VoiceQueueId']||undefined,'CampaignId':_0x3afc72[_0xe1ec('0xdd')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x3afc72[_0xe1ec('0x11e')]>=_0x3c990d[_0xe1ec('0x193')]-0x1){return!![];}else{hopperUtils[_0xe1ec('0xda')]({'active':![],'countnosuchnumberretry':_0x3afc72[_0xe1ec('0x11e')]+=0x1,'scheduledat':moment()[_0xe1ec('0xe8')](_0x3c990d[_0xe1ec('0x194')],'minutes')[_0xe1ec('0x78')](_0xe1ec('0xbf')),'ContactId':_0x3afc72[_0xe1ec('0xdb')],'ListId':_0x3afc72[_0xe1ec('0xdc')],'VoiceQueueId':_0x3afc72[_0xe1ec('0x103')]||undefined,'CampaignId':_0x3afc72[_0xe1ec('0xdd')]||undefined})[_0xe1ec('0x9f')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x3afc72['countdropretry']>=_0x3c990d[_0xe1ec('0xd8')]-0x1){return!![];}hopperUtils[_0xe1ec('0xda')]({'active':![],'countdropretry':_0x3afc72[_0xe1ec('0xd3')]+=0x1,'scheduledat':moment()[_0xe1ec('0xe8')](_0x3c990d[_0xe1ec('0xd5')],_0xe1ec('0xea'))[_0xe1ec('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3afc72[_0xe1ec('0xdb')],'ListId':_0x3afc72[_0xe1ec('0xdc')],'VoiceQueueId':_0x3afc72[_0xe1ec('0x103')]||undefined,'CampaignId':_0x3afc72[_0xe1ec('0xdd')]||undefined})['catch'](loggerCatch(_0xe1ec('0xde')));break;case 0xb:if(_0x3afc72[_0xe1ec('0xe5')]>=_0x3c990d[_0xe1ec('0x195')]-0x1){return!![];}hopperUtils[_0xe1ec('0xda')]({'active':![],'countabandonedretry':_0x3afc72[_0xe1ec('0xe5')]+=0x1,'scheduledat':moment()[_0xe1ec('0xe8')](_0x3c990d[_0xe1ec('0xe9')],_0xe1ec('0xea'))[_0xe1ec('0x78')](_0xe1ec('0xbf')),'ContactId':_0x3afc72['ContactId'],'ListId':_0x3afc72[_0xe1ec('0xdc')],'VoiceQueueId':_0x3afc72[_0xe1ec('0x103')]||undefined,'CampaignId':_0x3afc72[_0xe1ec('0xdd')]||undefined})[_0xe1ec('0x9f')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x3afc72['countmachineretry']>=_0x3c990d[_0xe1ec('0x122')]-0x1){return!![];}hopperUtils[_0xe1ec('0xda')]({'active':![],'countmachineretry':_0x3afc72[_0xe1ec('0x11b')]+=0x1,'scheduledat':moment()[_0xe1ec('0xe8')](_0x3c990d['dialMachineRetryFrequency'],_0xe1ec('0xea'))[_0xe1ec('0x78')](_0xe1ec('0xbf')),'ContactId':_0x3afc72[_0xe1ec('0xdb')],'ListId':_0x3afc72[_0xe1ec('0xdc')],'VoiceQueueId':_0x3afc72['VoiceQueueId']||undefined,'CampaignId':_0x3afc72[_0xe1ec('0xdd')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x3afc72['countagentrejectretry']>=_0x3c990d[_0xe1ec('0x196')]-0x1){return!![];}hopperUtils[_0xe1ec('0xda')]({'active':![],'countagentrejectretry':_0x3afc72[_0xe1ec('0x11f')]+=0x1,'scheduledat':moment()[_0xe1ec('0xe8')](_0x3c990d['dialAgentRejectRetryFrequency'],_0xe1ec('0xea'))[_0xe1ec('0x78')](_0xe1ec('0xbf')),'ContactId':_0x3afc72[_0xe1ec('0xdb')],'ListId':_0x3afc72[_0xe1ec('0xdc')],'VoiceQueueId':_0x3afc72['VoiceQueueId']||undefined,'CampaignId':_0x3afc72[_0xe1ec('0xdd')]||undefined})[_0xe1ec('0x9f')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer['prototype'][_0xe1ec('0x197')]=function(_0x434148,_0x2576d3,_0x5ce695){var _0x401808=this;var _0xd2ce2a=new History(_0x434148);var _0x1e652b=![];var _0xfaac03;var _0x3d2d35;return new Promise(function(_0x27bf27,_0x5baf10){if(_['isUndefined'](_0x2576d3)&&typeof _0x2576d3!==_0xe1ec('0x158')){return _0x5baf10(msgResponse(_0xe1ec('0x198'),'Failure',_0xe1ec('0x199')));}if(_[_0xe1ec('0x4d')](_0x5ce695)&&typeof _0x5ce695!==_0xe1ec('0x158')){return _0x5baf10(msgResponse(_0xe1ec('0x198'),_0xe1ec('0x90'),_0xe1ec('0x19a')));}hopperUtils[_0xe1ec('0xe7')](_0xd2ce2a,_0x5ce695[_0xe1ec('0xc4')],_0x2576d3)[_0xe1ec('0x37')](function(_0x154cd7){if(_0x154cd7['additional']==0x1)_0x1e652b=!![];switch(_0x5ce695[_0xe1ec('0xc4')]){case'0':_0x2576d3[_0xe1ec('0x19b')]+=0x1;_0xd2ce2a['state']=0x0;_0xd2ce2a[_0xe1ec('0x69')]=_0xe1ec('0x19c');_0xd2ce2a['countnosuchnumberretry']+=0x1;_0xd2ce2a[_0xe1ec('0xd4')]+=0x1;ami[_0xe1ec('0x39')](_0xe1ec('0x19d'),ut[_0xe1ec('0x126')](_0x434148,_0xe1ec('0x19e')));_0xfaac03=_0x2576d3[_0xe1ec('0x194')];_0x3d2d35=_0x2576d3[_0xe1ec('0xe6')];hopperUtils[_0xe1ec('0xc9')](_0xd2ce2a)[_0xe1ec('0x9f')](loggerCatch(_0xe1ec('0x11c')));if(_0x401808[_0xe1ec('0x18b')](0x0,_0x434148,_0x2576d3)&&!_0x1e652b){if(_0xd2ce2a[_0xe1ec('0x11e')]>=_0x2576d3[_0xe1ec('0x193')]){_0x401808[_0xe1ec('0x12d')](_0xd2ce2a,_0x27bf27,_0x5baf10,_0xe1ec('0x19f'));}else{_0x401808[_0xe1ec('0x121')](_0xd2ce2a,_0x27bf27,_0x5baf10,_0xe1ec('0x19f'));}}break;case'3':_0x2576d3['outboundNoAnswerCallsDay']+=0x1;_0xd2ce2a[_0xe1ec('0xd0')]=0x3;_0xd2ce2a[_0xe1ec('0x69')]=_0xe1ec('0x1a0');_0xd2ce2a[_0xe1ec('0x11d')]+=0x1;_0xd2ce2a[_0xe1ec('0xd4')]+=0x1;var _0x5623a8=ut['buildNoAnswerEventPayload'](_0x434148,_0x2576d3);ami['emit'](_0xe1ec('0x1a1'),_0x5623a8);_0xfaac03=_0x2576d3[_0xe1ec('0x18d')];_0x3d2d35=_0x2576d3['callAdditionalPhoneAfterMin'];hopperUtils[_0xe1ec('0xc9')](_0xd2ce2a)[_0xe1ec('0x9f')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x401808['checkRetriveMax'](0x3,_0x434148,_0x2576d3)&&!_0x1e652b){if(_0xd2ce2a[_0xe1ec('0x11d')]>=_0x2576d3[_0xe1ec('0x18c')]){_0x401808[_0xe1ec('0x12d')](_0xd2ce2a,_0x27bf27,_0x5baf10,_0xe1ec('0x1a2'));}else{_0x401808[_0xe1ec('0x121')](_0xd2ce2a,_0x27bf27,_0x5baf10,_0xe1ec('0x1a2'));}}break;case'5':_0x2576d3[_0xe1ec('0x1a3')]+=0x1;_0xd2ce2a['state']=0x5;_0xd2ce2a[_0xe1ec('0x69')]=_0xe1ec('0x1a4');_0xd2ce2a['countbusyretry']+=0x1;_0xd2ce2a[_0xe1ec('0xd4')]+=0x1;ami[_0xe1ec('0x39')](_0xe1ec('0x1a5'),ut['buildObj'](_0x434148,_0xe1ec('0x1a6')));_0xfaac03=_0x2576d3['dialBusyRetryFrequency'];_0x3d2d35=_0x2576d3[_0xe1ec('0xe6')];hopperUtils[_0xe1ec('0xc9')](_0xd2ce2a)['catch'](loggerCatch(_0xe1ec('0x1a7')));if(_0x401808[_0xe1ec('0x18b')](0x5,_0x434148,_0x2576d3)&&!_0x1e652b){if(_0xd2ce2a[_0xe1ec('0x12a')]>=_0x2576d3[_0xe1ec('0x1a8')]){_0x401808[_0xe1ec('0x12d')](_0xd2ce2a,_0x27bf27,_0x5baf10,_0xe1ec('0x1a9'));}else{_0x401808[_0xe1ec('0x121')](_0xd2ce2a,_0x27bf27,_0x5baf10,_0xe1ec('0x1a9'));}}break;case'8':_0x2576d3[_0xe1ec('0x1aa')]+=0x1;_0xd2ce2a[_0xe1ec('0xd0')]=0x8;_0xd2ce2a[_0xe1ec('0x69')]='Congestion';_0xd2ce2a[_0xe1ec('0x12b')]+=0x1;_0xd2ce2a[_0xe1ec('0xd4')]+=0x1;_0xfaac03=_0x2576d3['dialCongestionRetryFrequency'];_0x3d2d35=_0x2576d3['callAdditionalPhoneAfterMin'];ami[_0xe1ec('0x39')]('custom:agentcongestion',ut[_0xe1ec('0x126')](_0x434148,_0xe1ec('0x1ab')));hopperUtils['createHistory'](_0xd2ce2a)[_0xe1ec('0x9f')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x401808[_0xe1ec('0x18b')](0x8,_0x434148,_0x2576d3)&&!_0x1e652b){if(_0xd2ce2a[_0xe1ec('0x12b')]>=_0x2576d3[_0xe1ec('0x191')]){_0x401808['createStateFinal'](_0xd2ce2a,_0x27bf27,_0x5baf10,'reason\x208\x20congestion');}else{_0x401808[_0xe1ec('0x121')](_0xd2ce2a,_0x27bf27,_0x5baf10,_0xe1ec('0x1ac'));}}break;case'11':_0x2576d3['outboundAbandonedCallsDay']+=0x1;_0xd2ce2a[_0xe1ec('0xd0')]=0xb;_0xd2ce2a[_0xe1ec('0x69')]='Abandoned';_0xd2ce2a['countabandonedretry']+=0x1;_0xd2ce2a[_0xe1ec('0xd4')]+=0x1;_0xfaac03=_0x2576d3['dialAbandonedRetryFrequency'];_0x3d2d35=_0x2576d3[_0xe1ec('0xe6')];hopperUtils[_0xe1ec('0xc9')](_0xd2ce2a)[_0xe1ec('0x9f')](loggerCatch(_0xe1ec('0xec')));if(_0x401808[_0xe1ec('0x18b')](0xb,_0x434148,_0x2576d3)&&!_0x1e652b){if(_0xd2ce2a[_0xe1ec('0xe5')]>=_0x2576d3[_0xe1ec('0x195')]){_0x401808[_0xe1ec('0x12d')](_0xd2ce2a,_0x27bf27,_0x5baf10,_0xe1ec('0x1ad'));}else{_0x401808[_0xe1ec('0x121')](_0xd2ce2a,_0x27bf27,_0x5baf10,_0xe1ec('0x1ad'));}}break;case'20':_0x2576d3['outboundRejectCallsDay']+=0x1;_0xd2ce2a[_0xe1ec('0xd0')]=0x14;_0xd2ce2a[_0xe1ec('0x69')]='AgentReject';_0xd2ce2a[_0xe1ec('0x11f')]+=0x1;_0xd2ce2a['countglobal']+=0x1;_0xfaac03=_0x2576d3[_0xe1ec('0x1ae')];_0x3d2d35=_0x2576d3[_0xe1ec('0xe6')];ami[_0xe1ec('0x39')](_0xe1ec('0x1af'),ut[_0xe1ec('0x126')](_0x434148,_0xe1ec('0x1b0')));hopperUtils[_0xe1ec('0xc9')](_0xd2ce2a)[_0xe1ec('0x9f')](loggerCatch(_0xe1ec('0x1b1')));if(_0x401808[_0xe1ec('0x18b')](0x14,_0x434148,_0x2576d3)&&!_0x1e652b){if(_0xd2ce2a['countagentrejectretry']>=_0x2576d3[_0xe1ec('0x196')]){_0x401808[_0xe1ec('0x12d')](_0xd2ce2a,_0x27bf27,_0x5baf10,_0xe1ec('0x1b2'));}else{_0x401808[_0xe1ec('0x121')](_0xd2ce2a,_0x27bf27,_0x5baf10,_0xe1ec('0x1b2'));}}break;default:_0x2576d3['outboundUnknownCallsDay']+=0x1;_0xd2ce2a['state']=0xc;_0xd2ce2a[_0xe1ec('0x69')]=_0x5ce695[_0xe1ec('0xc4')];_0xfaac03=_0x2576d3[_0xe1ec('0x1ae')];_0x3d2d35=_0x2576d3['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0xd2ce2a)[_0xe1ec('0x9f')](loggerCatch(_0xe1ec('0x1b3')));if(_0x401808[_0xe1ec('0x18b')](_0x5ce695['reason'],_0x434148,_0x2576d3)&&!_0x1e652b){if(_0xd2ce2a['countbusyretry']+_0xd2ce2a[_0xe1ec('0x12b')]+_0xd2ce2a[_0xe1ec('0x11d')]+_0xd2ce2a[_0xe1ec('0x11e')]+_0xd2ce2a['countdropretry']+_0xd2ce2a[_0xe1ec('0xe5')]+_0xd2ce2a[_0xe1ec('0x11b')]+_0xd2ce2a[_0xe1ec('0x11f')]>=_0x2576d3[_0xe1ec('0x120')]){_0x401808[_0xe1ec('0x121')](_0xd2ce2a,_0x27bf27,_0x5baf10,_0x5ce695[_0xe1ec('0xc4')]);}else{_0x401808[_0xe1ec('0x12d')](_0xd2ce2a,_0x27bf27,_0x5baf10,_0x5ce695[_0xe1ec('0xc4')]);}}}})[_0xe1ec('0x37')](function(){if(_0x1e652b){hopperUtils[_0xe1ec('0xe1')](_0xd2ce2a,_0xfaac03,_0x3d2d35)[_0xe1ec('0x37')](function(){return _0x27bf27(0x1);});}});});};Dialer[_0xe1ec('0x12')][_0xe1ec('0x121')]=function(_0x1513e9,_0x35b0fa,_0xbd4cd8,_0x3211c5){var _0x38c8be=new Final(_0x1513e9);_0x38c8be[_0xe1ec('0xd0')]=0xf;_0x38c8be[_0xe1ec('0x69')]=_0xe1ec('0x1b4');this[_0xe1ec('0x12d')](_0x38c8be,_0x35b0fa,_0xbd4cd8,_0x3211c5);};Dialer[_0xe1ec('0x12')][_0xe1ec('0x12d')]=function(_0x442e85,_0x5ae7d5,_0x390121,_0x1c8084){hopperUtils[_0xe1ec('0xcb')](_0x442e85)['then'](function(){return _0x5ae7d5(msgResponse('[callProgressDetecting]','Success',_0x1c8084));})['catch'](function(){return _0x390121(msgResponse(_0xe1ec('0x1b5'),_0xe1ec('0x90'),_0xe1ec('0x1b6')));});};Dialer[_0xe1ec('0x12')][_0xe1ec('0x6')]=function(_0x560904){var _0x4bc286=_0x560904[_0xe1ec('0x1b7')]/0x64;var _0x4ca757=_0x560904[_0xe1ec('0x1b8')]/(_0x560904[_0xe1ec('0x1b8')]+_0x560904[_0xe1ec('0xc3')]);var _0x4b14e7=Math[_0xe1ec('0x1b9')](_0x560904[_0xe1ec('0x1ba')]*(_0x560904[_0xe1ec('0x1bb')]/0x64));var _0x4e5444=Math[_0xe1ec('0x1b9')](_0x560904['predictiveIntervalAvailable']*(_0x560904[_0xe1ec('0x1bc')]/0x64));var _0x3ca408=_0x560904[_0xe1ec('0x1bd')]+_0x560904[_0xe1ec('0x13a')];var _0x52b70a=Math[_0xe1ec('0x1be')](_0x560904['erlangCalls']*_0x560904[_0xe1ec('0x1bf')]*_0x560904[_0xe1ec('0x1c0')]*_0x560904['predictiveIntervalMultiplicativeFactor']);if(_[_0xe1ec('0x4d')](_0x560904['startProgressive'])){if(!_[_0xe1ec('0x4d')](_0x560904[_0xe1ec('0x1f')])){_0x560904[_0xe1ec('0x1f')]=undefined;loggerPredictive['error'](_0xe1ec('0x1c1'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0xe1ec('0x4d')](_0x560904[_0xe1ec('0x5d')])){loggerPredictive[_0xe1ec('0x5e')](_0xe1ec('0x1c1'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x560904['handlePredictive']);_0x560904[_0xe1ec('0x5d')]=undefined;}_0x560904[_0xe1ec('0x138')]=moment()[_0xe1ec('0x78')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xe1ec('0x3f')](_0x560904[_0xe1ec('0x59')],_0xe1ec('0x1c2'),_0x560904[_0xe1ec('0x138')]);this['handlePower'](_0x560904,0x1);}else if(ifInterval(_0x560904[_0xe1ec('0x1c3')],_0x560904[_0xe1ec('0x138')])){this[_0xe1ec('0xaf')](_0x560904,0x1);loggerPredictiveCalls[_0xe1ec('0x3f')]('[startMethodPredictive][StartProgressive][Loop]',_0x560904[_0xe1ec('0x138')],_0x560904[_0xe1ec('0x59')]);_0x560904[_0xe1ec('0x53')]=0x0;_0x560904['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x4bc286<_0x4ca757&&_0x560904['dialPredictiveOptimization']===_0xe1ec('0x1c4')){clearPredictiveAttributes(_0x560904);loggerPredictive[_0xe1ec('0x3f')](_0xe1ec('0x1c5'),_0xe1ec('0x1c6'),_0x4ca757,_0xe1ec('0x138'),_0x560904['name']);}else if(_0x52b70a<_0x560904[_0xe1ec('0xcf')]&&_0x560904['dialPredictiveOptimization']===_0xe1ec('0x1c4')){clearPredictiveAttributes(_0x560904);loggerPredictive['info'](_0xe1ec('0x1c7'),_0xe1ec('0x1c8'),_0x52b70a,_0xe1ec('0x1c9'),_0x560904[_0xe1ec('0xcf')],_0xe1ec('0x138'),_0x560904[_0xe1ec('0x59')]);}else if(!ifInterval(_0x560904['dialPredictiveInterval'],_0x560904['startProgressive'])&&_[_0xe1ec('0x4d')](_0x560904[_0xe1ec('0x1f')])&&!_[_0xe1ec('0x4d')](_0x560904[_0xe1ec('0x138')])){_0x560904[_0xe1ec('0x1f')]=moment()[_0xe1ec('0x78')](_0xe1ec('0xbf'));loggerPredictive[_0xe1ec('0x3f')](_0x560904[_0xe1ec('0x59')],'started\x20in\x20predictive\x20at',_0x560904['startPredictive']);hopperUtils[_0xe1ec('0x1ca')](_0x560904['dialPredictiveInterval'])[_0xe1ec('0x37')](this[_0xe1ec('0x1cb')](_0x560904))[_0xe1ec('0x37')](mergeDataErlangB(_0x560904))['then'](this['startMethodPredictive'](_0x560904))[_0xe1ec('0x9f')](loggerCatchPredictive(_0xe1ec('0x1cc'),_0x560904));}else if(!ifInterval(_0x560904[_0xe1ec('0x1c3')],_0x560904[_0xe1ec('0x1f')])){_0x560904['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x560904[_0xe1ec('0x1f')]=moment()[_0xe1ec('0x78')](_0xe1ec('0xbf'));loggerPredictive[_0xe1ec('0x3f')](_0x560904[_0xe1ec('0x59')],'recalculate\x20predictive\x20at',_0x560904[_0xe1ec('0x1f')]);clearInterval(_0x560904['handlePredictive']);_0x560904['handlePredictive']=undefined;hopperUtils[_0xe1ec('0x1ca')](_0x560904[_0xe1ec('0x1c3')])[_0xe1ec('0x37')](this[_0xe1ec('0x1cb')](_0x560904))['then'](mergeDataErlangB(_0x560904))[_0xe1ec('0x37')](this[_0xe1ec('0x1cd')](_0x560904))['catch'](loggerCatchPredictive(_0xe1ec('0x1ce'),_0x560904));}else if(_0x560904[_0xe1ec('0x1ba')]&&_0x3ca408<_0x560904[_0xe1ec('0x1ba')]-_0x4e5444){clearPredictiveAttributes(_0x560904);loggerPredictive['info'](_0x560904[_0xe1ec('0x59')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x3ca408,_0xe1ec('0x1cf'),_0x560904[_0xe1ec('0x1ba')],'-',_0x4e5444,'=',_0x560904[_0xe1ec('0x1ba')]-_0x4e5444,')');}else if(_0x560904[_0xe1ec('0x1ba')]&&_0x3ca408>_0x560904[_0xe1ec('0x1ba')]+_0x4b14e7){clearPredictiveAttributes(_0x560904);loggerPredictive['info'](_0x560904[_0xe1ec('0x59')],_0xe1ec('0x1d0'),_0x3ca408,_0xe1ec('0x1d1'),_0x560904[_0xe1ec('0x1ba')],'+',_0x4b14e7,'=',_0x560904[_0xe1ec('0x1ba')]+_0x4b14e7,')');}};Dialer[_0xe1ec('0x12')][_0xe1ec('0x1cb')]=function(_0x3a7d8f){var _0x791845=this;return function(_0x2ce876){return new Promise(function(_0x208394,_0x2d671e){_[_0xe1ec('0x58')](_0x3a7d8f,_0x2ce876[0x0]);if(checkGetDataPredictive(_0x2ce876[0x0])){var _0x5db7f5=_0x3a7d8f[_0xe1ec('0x1ba')]=_0x3a7d8f[_0xe1ec('0x13a')]+_0x3a7d8f[_0xe1ec('0x1bd')];var _0x514e63=_0x3a7d8f[_0xe1ec('0x1c3')]*0x3c;var _0x23655f=_0x2ce876[0x0][_0xe1ec('0x4b')]+_0x2ce876[0x0][_0xe1ec('0x49')];var _0x3ffa3c=(_0x2ce876[0x0][_0xe1ec('0x43')]+_0x2ce876[0x0][_0xe1ec('0x45')]+_0x2ce876[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x2ce876[0x0][_0xe1ec('0x41')];_0x3a7d8f['predictiveIntervalHitRate']=_0x3ffa3c>0x0?_0x3ffa3c:0x1;switch(_0x3a7d8f[_0xe1ec('0x1d2')]){case'dropRate':var _0x49c388=_0x3a7d8f[_0xe1ec('0x1b7')]/0x64;return _0x791845[_0xe1ec('0x1d3')](_0x5db7f5,_0x514e63,_0x23655f,_0x3ffa3c,_0x49c388)[_0xe1ec('0x37')](function(_0x6a6c7c){return _0x208394(_0x6a6c7c);});case _0xe1ec('0x1d4'):var _0x392d10=_0x3a7d8f[_0xe1ec('0x1b7')]/0x64;return _0x791845['busyFactor'](_0x5db7f5,_0x514e63,_0x23655f,_0x3ffa3c,_0x392d10)[_0xe1ec('0x37')](function(_0x4842b1){return _0x208394(_0x4842b1);});default:return _0x2d671e(msgResponse(_0xe1ec('0x1d5'),_0xe1ec('0x90'),'Unknown\x20Predictive'));}}else{return _0x2d671e(msgResponse('[getDataPredictive]',_0xe1ec('0x90'),_0xe1ec('0x1d6')));}});};};Dialer[_0xe1ec('0x12')][_0xe1ec('0x1d7')]=function(_0x5ae109){var _0x1895b8=this;return function(_0x1dd130){return new Promise(function(_0x474a8c,_0x55eb84){_[_0xe1ec('0x58')](_0x5ae109,_0x1dd130[0x0]);if(checkGetDataPredictive(_0x1dd130[0x0])){loggerPredictive[_0xe1ec('0x3f')](JSON[_0xe1ec('0x6f')](_0x1dd130[0x0]));if(_0x5ae109[_0xe1ec('0x1d2')]===_0xe1ec('0x1c4')){return _0x1895b8[_0xe1ec('0x149')](_0x5ae109['id'])[_0xe1ec('0x37')](function(_0x87320e){var _0x2c8617=_0x5ae109['loggedIn']-_0x87320e[0x0][_0xe1ec('0x1d8')];var _0x454387=_0x5ae109[_0xe1ec('0x1c3')]*0x3c;var _0x2780a4=_0x1dd130[0x0]['predictiveIntervalAvgTalktime']+_0x1dd130[0x0][_0xe1ec('0x49')];var _0x211ba9=(_0x1dd130[0x0][_0xe1ec('0x43')]+_0x1dd130[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x1dd130[0x0][_0xe1ec('0x47')])/_0x1dd130[0x0][_0xe1ec('0x41')];var _0x4b4839=_0x5ae109[_0xe1ec('0x1b7')]/0x64;_0x5ae109['predictiveIntervalPauses']=_0x87320e[0x0][_0xe1ec('0x1d8')]||0x0;_0x5ae109[_0xe1ec('0x1c0')]=_0x211ba9>0x0?_0x211ba9:0x1;return _0x1895b8['abandonmentRate'](_0x2c8617,_0x454387,_0x2780a4,_0x211ba9,_0x4b4839);})[_0xe1ec('0x37')](function(_0xc3b0c4){return _0x474a8c(_0xc3b0c4);})[_0xe1ec('0x9f')](function(_0x37d5a8){return _0x55eb84(msgResponse('[CatchErlangB]',_0xe1ec('0x90'),JSON[_0xe1ec('0x6f')](_0x37d5a8)));});}if(_0x5ae109[_0xe1ec('0x1d2')]===_0xe1ec('0x1d4')){return _0x1895b8[_0xe1ec('0x149')](_0x5ae109['id'])[_0xe1ec('0x37')](function(_0x2574dd){var _0x3f7362=_0x5ae109[_0xe1ec('0x1d9')]-_0x2574dd[0x0]['outboundQueuePauses'];var _0x34cffb=_0x5ae109[_0xe1ec('0x1c3')]*0x3c;var _0x3832d2=_0x1dd130[0x0]['predictiveIntervalAvgTalktime']+_0x1dd130[0x0][_0xe1ec('0x49')];var _0x327ea5=(_0x1dd130[0x0]['predictiveIntervalAnsweredCalls']+_0x1dd130[0x0][_0xe1ec('0x45')]+_0x1dd130[0x0][_0xe1ec('0x47')])/_0x1dd130[0x0][_0xe1ec('0x41')];var _0x120f9b=_0x5ae109['dialPredictiveOptimizationPercentage']/0x64;_0x5ae109[_0xe1ec('0x1da')]=_0x2574dd[0x0][_0xe1ec('0x1d8')]||0x0;_0x5ae109[_0xe1ec('0x1c0')]=_0x327ea5>0x0?_0x327ea5:0x1;return _0x1895b8[_0xe1ec('0x1db')](_0x3f7362,_0x34cffb,_0x3832d2,_0x327ea5,_0x120f9b);})['then'](function(_0x1c3295){return _0x474a8c(_0x1c3295);})[_0xe1ec('0x9f')](function(_0x1faeff){return _0x55eb84(msgResponse('[CatchErlangB]',_0xe1ec('0x90'),JSON[_0xe1ec('0x6f')](_0x1faeff)));});}}else{return _0x55eb84(msgResponse(_0xe1ec('0x1d5'),'Failure','check\x20failure'));}});};};Dialer[_0xe1ec('0x12')][_0xe1ec('0x1cd')]=function(_0xf2a13d){var _0x3273bd=this;return function(){var _0x56b040=0x0;var _0x119a59=Math[_0xe1ec('0x1be')](_0xf2a13d[_0xe1ec('0x54')]*0x3e8);if(_0x119a59>0x0){_0x119a59=_0x119a59<0x64?0x64:_0x119a59;loggerPredictive[_0xe1ec('0x3f')](_0xf2a13d[_0xe1ec('0x59')],_0xe1ec('0x1dc'),_0x119a59,_0xe1ec('0x1dd'));_0xf2a13d[_0xe1ec('0x5d')]=setInterval(function(){_0x3273bd[_0xe1ec('0x5d')](_0xf2a13d);loggerPredictiveCalls[_0xe1ec('0x3f')](_0xe1ec('0x1de'),_0x56b040+=0x1);},_0x119a59);}else{loggerPredictive['info'](_0xf2a13d[_0xe1ec('0x59')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0xe1ec('0x12')][_0xe1ec('0x1df')]=function(_0x4bbc90,_0x5c8756){var _0x48ce9a=this;return function(_0x4069c9){if(_[_0xe1ec('0x3e')](_0x4069c9)){if(_[_0xe1ec('0xf1')](_0x5c8756['UserId'])||!_0x5c8756[_0xe1ec('0x1e0')]){if(_0x4bbc90['dialMethod']===_0xe1ec('0xb1')){_0x4bbc90[_0xe1ec('0x6c')]=_[_0xe1ec('0x4d')](_0x4bbc90['queueStatusComplete'])?!![]:_0x4bbc90[_0xe1ec('0x6c')];var _0x194a3b=uuid['v4']();_0x48ce9a[_0xe1ec('0x1c')][_0x194a3b]=new Action(_0x4bbc90,_0x5c8756,_0x194a3b);loggerBooked['info']('[booked][checkContactBlack]',_0x194a3b,_0xe1ec('0x1e1'),JSON[_0xe1ec('0x6f')](_0x4bbc90[_0xe1ec('0x6c')]),_0xe1ec('0x1e2'),_0x4bbc90[_0xe1ec('0x59')]);if(_0x4bbc90['queueStatusComplete']){_0x4bbc90[_0xe1ec('0x6c')]=![];_0x48ce9a[_0xe1ec('0x20')][_0x48ce9a['actions'][_0x194a3b]['queue']]=[];ami[_0xe1ec('0x99')]({'actionid':_0x194a3b,'action':'queuestatus','queue':_0x4bbc90[_0xe1ec('0x59')]})[_0xe1ec('0x9f')](function(){_0x48ce9a[_0xe1ec('0xbd')](_0x4bbc90);hopperUtils[_0xe1ec('0xda')]({'active':![],'ContactId':_0x48ce9a[_0xe1ec('0x1c')][_0x194a3b][_0xe1ec('0xdb')],'ListId':_0x48ce9a[_0xe1ec('0x1c')][_0x194a3b][_0xe1ec('0xdc')],'VoiceQueueId':_0x48ce9a[_0xe1ec('0x1c')][_0x194a3b][_0xe1ec('0x103')]||undefined,'CampaignId':_0x48ce9a[_0xe1ec('0x1c')][_0x194a3b][_0xe1ec('0xdd')]||undefined})[_0xe1ec('0x9f')](loggerCatch(_0xe1ec('0x1e3')));delete _0x48ce9a[_0xe1ec('0x1c')][_0x194a3b];});}else{loggerBooked[_0xe1ec('0x3f')](_0xe1ec('0x1e4'),JSON[_0xe1ec('0x6f')](_0x4bbc90[_0xe1ec('0x6c')]),_0xe1ec('0x1e2'),_0x4bbc90[_0xe1ec('0x59')]);_0x48ce9a[_0xe1ec('0xbd')](_0x4bbc90);hopperUtils[_0xe1ec('0xda')]({'active':![],'ContactId':_0x48ce9a['actions'][_0x194a3b][_0xe1ec('0xdb')],'ListId':_0x48ce9a[_0xe1ec('0x1c')][_0x194a3b]['ListId'],'VoiceQueueId':_0x48ce9a[_0xe1ec('0x1c')][_0x194a3b][_0xe1ec('0x103')]||undefined,'CampaignId':_0x48ce9a[_0xe1ec('0x1c')][_0x194a3b][_0xe1ec('0xdd')]||undefined})[_0xe1ec('0x9f')](loggerCatch(_0xe1ec('0x1e3')));delete _0x48ce9a[_0xe1ec('0x1c')][_0x194a3b];}}else{return _0x48ce9a[_0xe1ec('0x157')](_0x4bbc90,_0x5c8756);}}else{if(utils[_0xe1ec('0xcd')](undefined,_0x5c8756[_0xe1ec('0x1e5')])<_0x4bbc90[_0xe1ec('0x1e6')]*0x3c){if(_0x5c8756[_0xe1ec('0x154')]&&!_0x5c8756[_0xe1ec('0x154')]['voicePause']){_0x48ce9a[_0xe1ec('0x16')][_0xe1ec('0xf8')](_0x5c8756['id'])[_0xe1ec('0x14')](function(){_0x48ce9a[_0xe1ec('0xbd')](_0x4bbc90);});}else{hopperUtils['unlockContact']({'active':![]},_0x5c8756['id'],0x1)[_0xe1ec('0x14')](function(){_0x48ce9a[_0xe1ec('0xbd')](_0x4bbc90);});}}else{_0x4bbc90[_0xe1ec('0x1e7')]+=0x1;_0x48ce9a[_0xe1ec('0xbd')](_0x4bbc90);if(_0x4bbc90['dialRecallInQueue']){hopperUtils[_0xe1ec('0xda')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x5c8756[_0xe1ec('0xdb')],'ListId':_0x5c8756[_0xe1ec('0xdc')],'VoiceQueueId':_0x5c8756[_0xe1ec('0x103')]||undefined,'CampaignId':_0x5c8756['CampaignId']||undefined})[_0xe1ec('0x9f')](loggerCatch(_0xe1ec('0x1e8')));hopperUtils['createHistory'](createObjHistory(_0x4bbc90,_0x5c8756,utils['CAMPAIGN_STATUS'][_0xe1ec('0x1e9')],0x17,_0xe1ec('0x1ea')))[_0xe1ec('0x9f')](loggerCatch(_0xe1ec('0x1eb')));}else{_0x48ce9a[_0xe1ec('0x116')](createObjHistory(_0x4bbc90,_0x5c8756,utils[_0xe1ec('0x64')][_0xe1ec('0x1ec')],0x16,_0xe1ec('0x1ed')),_0xe1ec('0x1ee'),'[Originate][HistoryRecallClose]');}}}}else{_0x4bbc90[_0xe1ec('0x1ef')]+=0x1;_0x48ce9a[_0xe1ec('0x116')](createObjHistory(_0x4bbc90,_0x5c8756,utils[_0xe1ec('0x64')][_0xe1ec('0x1f0')],0xd,_0xe1ec('0x1f1')),_0xe1ec('0x1f2'),_0xe1ec('0x1f3'));throw _0xe1ec('0x1f4');}};};Dialer[_0xe1ec('0x12')][_0xe1ec('0x156')]=function(_0x40f97e){var _0x5cbd98=this;var _0x324bc4=_0x40f97e['limitCalls']-_0x40f97e[_0xe1ec('0x7c')];emitCampaignSummary(_0x40f97e);if(_0x324bc4>0x0&&_0x40f97e[_0xe1ec('0x61')]==0x0){if(_0x324bc4>this[_0xe1ec('0x1b')]){_0x324bc4=this[_0xe1ec('0x1b')];}_0x40f97e['temp']=0x1;hopperUtils[_0xe1ec('0x1f5')](_0x40f97e,_0x324bc4)['then'](function(_0x4c6651){_0x40f97e['temp']=0x0;if(_0x4c6651){if(!utils[_0xe1ec('0x1f6')](_0x4c6651)){_0x40f97e[_0xe1ec('0x63')]=utils[_0xe1ec('0x64')][_0xe1ec('0x68')];logger['info'](_0xe1ec('0x1f7')+_0x40f97e['name']);}else{_0x40f97e[_0xe1ec('0x7c')]+=_0x4c6651[_0xe1ec('0x97')];_0x40f97e[_0xe1ec('0x63')]=utils['CAMPAIGN_STATUS'][_0xe1ec('0x1f8')];for(var _0x309009=0x0;_0x309009<_0x4c6651[_0xe1ec('0x97')];_0x309009+=0x1){_0x40f97e[_0xe1ec('0x1f9')]+=0x1;if(_[_0xe1ec('0xf1')](_0x4c6651[_0x309009])||_[_0xe1ec('0xf1')](_0x4c6651[_0x309009][_0xe1ec('0x176')])||_['isNil'](_0x4c6651[_0x309009][_0xe1ec('0x15a')])){_0x5cbd98[_0xe1ec('0x14c')]('[actionOriginate]\x20',_0x40f97e,_0x4c6651[_0x309009]);}else{hopperUtils[_0xe1ec('0x1fa')](_[_0xe1ec('0x70')](_0x4c6651[_0x309009],['CampaignId',_0xe1ec('0x15a')]))[_0xe1ec('0x37')](_0x5cbd98[_0xe1ec('0x1df')](_0x40f97e,_0x4c6651[_0x309009]))['catch'](_0x5cbd98[_0xe1ec('0x14b')](_0xe1ec('0x1fb'),_0x40f97e));}}}}})[_0xe1ec('0x9f')](loggerGetContactDialer(_0xe1ec('0x1fc'),_0x40f97e,_0x324bc4));}};Dialer[_0xe1ec('0x12')][_0xe1ec('0xaf')]=function(_0x46cb78,_0x251a27){var _0x4a003a=this;var _0x41ffac=[];if(_0x251a27<0x1||_0x46cb78[_0xe1ec('0x1fd')]===_0xe1ec('0xb1')){_0x251a27=0x1;}var _0x530df1=Math[_0xe1ec('0x1be')](_0x46cb78[_0xe1ec('0x1bd')]*_0x251a27)-_0x46cb78[_0xe1ec('0x7c')];if(_0x46cb78[_0xe1ec('0x1fe')]>0x0){var _0x41533f=_0x46cb78[_0xe1ec('0x1fe')]-_0x46cb78[_0xe1ec('0x7c')]-_0x46cb78['talking']-_0x46cb78[_0xe1ec('0x1ff')];if(_0x530df1>_0x41533f){_0x530df1=_0x41533f;}}if(_0x530df1>0x0&&_0x46cb78[_0xe1ec('0x61')]==0x0){if(_0x46cb78['dialMethod']==='booked'){_0x530df1=0x1;}if(_0x530df1>this['maxNumberOriginate']){_0x530df1=this[_0xe1ec('0x1b')];}for(var _0x3e180e in this[_0xe1ec('0x19')]){if(typeof this[_0xe1ec('0x19')][_0x3e180e]!=='undefined'){if(this[_0xe1ec('0x19')][_0x3e180e][_0xe1ec('0xd0')]===_0xe1ec('0x200')&&this[_0xe1ec('0x19')][_0x3e180e][_0xe1ec('0x86')]===_0xe1ec('0x140')){_0x41ffac[_0xe1ec('0x98')](this[_0xe1ec('0x19')][_0x3e180e]['id']);}}}_0x46cb78[_0xe1ec('0x61')]=0x1;hopperUtils[_0xe1ec('0x201')](_0x46cb78,_0x41ffac,_0x530df1)[_0xe1ec('0x37')](function(_0x1920f2){_0x46cb78['temp']=0x0;if(_0x1920f2){if(!utils['checkContactEmpty'](_0x1920f2)){hopperUtils['countReScheduled'](_0x46cb78)[_0xe1ec('0x37')](sendMessageReschedule(_0x46cb78))[_0xe1ec('0x9f')](loggerCatch('[countReScheduled]\x20'));}else{_0x46cb78[_0xe1ec('0x7c')]+=_0x1920f2[_0xe1ec('0x97')];_0x46cb78[_0xe1ec('0x63')]=_0x46cb78[_0xe1ec('0x1fd')]==='booked'?utils['CAMPAIGN_STATUS'][_0xe1ec('0x202')]:utils[_0xe1ec('0x64')][_0xe1ec('0x1f8')];for(var _0x4a4a58=0x0;_0x4a4a58<_0x1920f2['length'];_0x4a4a58+=0x1){if(_[_0xe1ec('0xf1')](_0x1920f2[_0x4a4a58])||_['isNil'](_0x1920f2[_0x4a4a58][_0xe1ec('0x176')])||_[_0xe1ec('0xf1')](_0x1920f2[_0x4a4a58][_0xe1ec('0x15a')])){_0x4a003a[_0xe1ec('0x14c')]('[actionOriginate]\x20',_0x46cb78,_0x1920f2[_0x4a4a58]);}else{hopperUtils[_0xe1ec('0x203')](_[_0xe1ec('0x70')](_0x1920f2[_0x4a4a58],[_0xe1ec('0x103'),_0xe1ec('0x15a')]))[_0xe1ec('0x37')](_0x4a003a['checkContactBlack'](_0x46cb78,_0x1920f2[_0x4a4a58]))[_0xe1ec('0x9f')](_0x4a003a[_0xe1ec('0x14b')](_0xe1ec('0x204'),_0x46cb78));}}}}})[_0xe1ec('0x9f')](loggerGetContactDialer(_0xe1ec('0x205'),_0x46cb78,_0x530df1));}};Dialer[_0xe1ec('0x12')][_0xe1ec('0x5d')]=function(_0x84bf03){if(_0x84bf03[_0xe1ec('0x1fe')]>0x0){var _0xeca092=_0x84bf03['dialLimitQueue']-_0x84bf03[_0xe1ec('0x7c')]-_0x84bf03[_0xe1ec('0x13a')];if(_0xeca092>0x0&&_0x84bf03[_0xe1ec('0x61')]==0x0){this[_0xe1ec('0x206')](_0x84bf03);}else{loggerPredictiveCalls[_0xe1ec('0x3f')](_0xe1ec('0x207'));}}else{this[_0xe1ec('0x206')](_0x84bf03);}};Dialer[_0xe1ec('0x12')]['tryOriginatePredictive']=function(_0x210aa8){var _0x3581a7=this;var _0x2890c8=[];_0x210aa8['originated']+=0x1;for(var _0x67a4cb in this[_0xe1ec('0x19')]){if(typeof this['agents'][_0x67a4cb]!==_0xe1ec('0xa8')){if(this[_0xe1ec('0x19')][_0x67a4cb][_0xe1ec('0xd0')]===_0xe1ec('0x200')&&this[_0xe1ec('0x19')][_0x67a4cb]['status']===_0xe1ec('0x140')){_0x2890c8[_0xe1ec('0x98')](this[_0xe1ec('0x19')][_0x67a4cb]['id']);}}}_0x210aa8[_0xe1ec('0x61')]=0x1;return this['getContactDialer'](_0x210aa8['id'],_0x2890c8,0x1,_0x210aa8[_0xe1ec('0x208')],_0x210aa8)[_0xe1ec('0x37')](function(_0x43a2e6){_0x210aa8[_0xe1ec('0x61')]=0x1;if(_0x43a2e6){if(!utils['checkContactEmpty'](_0x43a2e6)){utils[_0xe1ec('0x60')](_0x210aa8,0x1,0x0);return hopperUtils[_0xe1ec('0x209')](_0x210aa8)[_0xe1ec('0x37')](sendMessageReschedule(_0x210aa8))['catch'](loggerCatch(_0xe1ec('0x20a')));}else{_0x210aa8[_0xe1ec('0x63')]=utils[_0xe1ec('0x64')][_0xe1ec('0x1f8')];if(_[_0xe1ec('0xf1')](_0x43a2e6[0x0])||_[_0xe1ec('0xf1')](_0x43a2e6[0x0]['Contact'])||_[_0xe1ec('0xf1')](_0x43a2e6[0x0][_0xe1ec('0x15a')])){_0x3581a7[_0xe1ec('0x14c')]('[actionOriginate]\x20',_0x210aa8,_0x43a2e6[0x0]);}else{return hopperUtils[_0xe1ec('0x203')](_[_0xe1ec('0x70')](_0x43a2e6[0x0],[_0xe1ec('0x103'),'phone']))['then'](_0x3581a7[_0xe1ec('0x1df')](_0x210aa8,_0x43a2e6[0x0]))['catch'](_0x3581a7[_0xe1ec('0x14b')](_0xe1ec('0x20b'),_0x210aa8));}}}})['catch'](loggerGetContactDialer('[getContactDialerPredictive]',_0x210aa8,0x1));};Dialer[_0xe1ec('0x12')]['abandonmentRate']=function(_0x3a84fb,_0x35a557,_0x3de8e0,_0x17acf3,_0x13139e,_0x3c0217){loggerPredictive[_0xe1ec('0x3f')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0xe1ec('0x3f')]('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',_0x3a84fb);loggerPredictive[_0xe1ec('0x3f')](_0xe1ec('0x20c'),_0x35a557);loggerPredictive['info'](_0xe1ec('0x20d'),_0x3de8e0);loggerPredictive[_0xe1ec('0x3f')]('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',_0x17acf3);loggerPredictive[_0xe1ec('0x3f')](_0xe1ec('0x20e'),_0x13139e);loggerPredictive[_0xe1ec('0x3f')](_0xe1ec('0x57'));return new Promise(function(_0x1e0973,_0x29f203){if(_0x3a84fb<=0x0||isNaN(_0x3a84fb)){return _0x29f203(msgResponse(_0xe1ec('0x20f'),_0xe1ec('0x82'),_0xe1ec('0x210')+_0x3a84fb));}if(_0x3de8e0<=0x0||isNaN(_0x3de8e0)){return _0x29f203(msgResponse(_0xe1ec('0x20f'),_0xe1ec('0x82'),_0xe1ec('0x211')+_0x3de8e0));}if(_0x17acf3<=0x0||isNaN(_0x17acf3)){return _0x29f203(msgResponse('[abandonmentRate]',_0xe1ec('0x82'),_0xe1ec('0x212')+_0x17acf3));}if(_0x35a557<=0x0||isNaN(_0x35a557)){return _0x29f203(msgResponse(_0xe1ec('0x20f'),'Error','interval\x20=\x20'+_0x35a557));}if(_0x13139e<=0x0||isNaN(_0x13139e)){return _0x29f203(msgResponse(_0xe1ec('0x20f'),_0xe1ec('0x82'),_0xe1ec('0x213')+_0x13139e));}_0x3c0217=_0x3c0217||0x0;var _0x46c527=0x1/_0x3de8e0;var _0x55c541=0x0;var _0x16ef14=0x0;var _0x28dc56=0x0;var _0x5a26a3=0x0;for(var _0x27c6c5=0x0;_0x28dc56<_0x13139e;_0x27c6c5+=0x1){_0x16ef14=_0x27c6c5/_0x35a557;_0x55c541=(_0x17acf3*_0x16ef14+_0x3c0217)/_0x46c527;_0x28dc56=utils['erlangb'](_0x55c541,_0x3a84fb);_0x5a26a3=_0x55c541/_0x3a84fb*(0x1-utils[_0xe1ec('0x214')](_0x55c541,_0x3a84fb));}return _0x1e0973({'erlangCalls':_0x27c6c5,'erlangCallToSecond':_0x35a557/_0x27c6c5,'erlangAbandonmentRate':_0x28dc56,'erlangBusyFactor':_0x5a26a3});});};Dialer['prototype'][_0xe1ec('0x1db')]=function(_0x5ed188,_0xc8ed3c,_0x2858f5,_0x3a229,_0x2f61c5,_0x4d1d15){loggerPredictive[_0xe1ec('0x3f')](_0xe1ec('0x215'));loggerPredictive[_0xe1ec('0x3f')](_0xe1ec('0x216'),_0x5ed188);loggerPredictive[_0xe1ec('0x3f')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xc8ed3c);loggerPredictive[_0xe1ec('0x3f')](_0xe1ec('0x20d'),_0x2858f5);loggerPredictive[_0xe1ec('0x3f')]('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',_0x3a229);loggerPredictive[_0xe1ec('0x3f')](_0xe1ec('0x217'),_0x2f61c5);loggerPredictive['info'](_0xe1ec('0x57'));return new Promise(function(_0x49f8c5,_0x39697d){if(_0x5ed188<=0x0||isNaN(_0x5ed188)){return _0x39697d(msgResponse('[busyFactor]',_0xe1ec('0x82'),'m\x20=\x20'+_0x5ed188));}if(_0x2858f5<=0x0||isNaN(_0x2858f5)){return _0x39697d(msgResponse(_0xe1ec('0x218'),_0xe1ec('0x82'),_0xe1ec('0x211')+_0x2858f5));}if(_0x3a229<=0x0||isNaN(_0x3a229)){return _0x39697d(msgResponse(_0xe1ec('0x218'),_0xe1ec('0x82'),_0xe1ec('0x212')+_0x3a229));}if(_0xc8ed3c<=0x0||isNaN(_0xc8ed3c)){return _0x39697d(msgResponse(_0xe1ec('0x218'),_0xe1ec('0x82'),_0xe1ec('0x219')+_0xc8ed3c));}if(_0x2f61c5<=0x0||isNaN(_0x2f61c5)){return _0x39697d(msgResponse(_0xe1ec('0x218'),'Error','Umin\x20=\x20'+_0x2f61c5));}_0x4d1d15=_0x4d1d15||0x0;var _0x379714=0x1/_0x2858f5;var _0x412002=0x0;var _0xe267d6=0x0;var _0x4cdb6b=0x0;var _0x36f5e7=0x0;for(var _0x18b76f=0x0;_0x36f5e7<_0x2f61c5;_0x18b76f+=0x1){_0xe267d6=_0x18b76f/_0xc8ed3c;_0x412002=(_0x3a229*_0xe267d6+_0x4d1d15)/_0x379714;_0x4cdb6b=utils[_0xe1ec('0x214')](_0x412002,_0x5ed188);_0x36f5e7=_0x412002/_0x5ed188*(0x1-utils[_0xe1ec('0x214')](_0x412002,_0x5ed188));}return _0x49f8c5({'erlangCalls':_0x18b76f,'erlangCallToSecond':_0xc8ed3c/_0x18b76f,'erlangAbandonmentRate':_0x4cdb6b,'erlangBusyFactor':_0x36f5e7});});};module[_0xe1ec('0x21a')]=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 f016846..851272a 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 _0xaaac=['countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','CampaignId','idHopper','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','substring','dialCutDigit','getQueue','queue','exports','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','number','active','type','scheduledat'];(function(_0x47fb59,_0x862899){var _0x2bf187=function(_0x1d629){while(--_0x1d629){_0x47fb59['push'](_0x47fb59['shift']());}};_0x2bf187(++_0x862899);}(_0xaaac,0x1df));var _0xcaaa=function(_0x1a5f5b,_0x1944f1){_0x1a5f5b=_0x1a5f5b-0x0;var _0x11acaf=_0xaaac[_0x1a5f5b];return _0x11acaf;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xcaaa('0x0'));function checkNameSurname(_0x526b66,_0x474a6b,_0x25655b){var _0x2347ad='';if(!_[_0xcaaa('0x1')](_0x474a6b)&&_0xcaaa('0x2')===typeof _0x474a6b){_0x2347ad+=_0x474a6b;}if(!_[_0xcaaa('0x1')](_0x25655b)&&'string'===typeof _0x25655b){_0x2347ad+='\x20'+_0x25655b;}if(_0x2347ad!==''){return _0x2347ad;}return _0x526b66;}function Action(_0x48bfc5,_0x375ab6,_0x25b22d){this[_0xcaaa('0x3')]=_0x48bfc5;this[_0xcaaa('0x4')]=_0x25b22d||undefined;this[_0xcaaa('0x5')]=checkNameSurname(_0x375ab6[_0xcaaa('0x6')][_0xcaaa('0x7')],_0x375ab6[_0xcaaa('0x6')][_0xcaaa('0x8')],_0x375ab6[_0xcaaa('0x6')]['lastName']);this[_0xcaaa('0x9')]=_0x375ab6[_0xcaaa('0x7')];this['queue']=_0x48bfc5[_0xcaaa('0x5')];this[_0xcaaa('0xa')]=_0x375ab6['active']||![];this[_0xcaaa('0xb')]=_0x48bfc5['type'];this['dialQueueTimeout']=_0x48bfc5['dialQueueTimeout']||0x3;this[_0xcaaa('0xc')]=_0x375ab6[_0xcaaa('0xc')];this[_0xcaaa('0xd')]=_0x375ab6[_0xcaaa('0xd')];this[_0xcaaa('0xe')]=_0x375ab6[_0xcaaa('0xe')];this[_0xcaaa('0xf')]=_0x375ab6[_0xcaaa('0xf')];this[_0xcaaa('0x10')]=_0x375ab6['countnosuchnumberretry'];this[_0xcaaa('0x11')]=_0x375ab6[_0xcaaa('0x11')];this[_0xcaaa('0x12')]=_0x375ab6[_0xcaaa('0x12')];this[_0xcaaa('0x13')]=_0x375ab6[_0xcaaa('0x13')];this[_0xcaaa('0x14')]=_0x375ab6[_0xcaaa('0x14')];this[_0xcaaa('0x15')]=_0x375ab6['ContactId'];this[_0xcaaa('0x16')]=_0x375ab6[_0xcaaa('0x16')];this[_0xcaaa('0x17')]=_0x375ab6['UserId'];this['VoiceQueueId']=_0x375ab6['VoiceQueueId'];this[_0xcaaa('0x18')]=_0x375ab6[_0xcaaa('0x18')];this[_0xcaaa('0x19')]=_0x375ab6['id'];this['ContactFirstName']=_0x375ab6[_0xcaaa('0x6')]['firstName']||'';this[_0xcaaa('0x1a')]=moment()['format'](_0xcaaa('0x1b'));this[_0xcaaa('0x1c')]=_0x375ab6[_0xcaaa('0x1c')];this[_0xcaaa('0x1d')]=_0x375ab6[_0xcaaa('0x1d')];this[_0xcaaa('0x1e')]=_0x375ab6[_0xcaaa('0x1e')];this[_0xcaaa('0x1f')]=_0x375ab6[_0xcaaa('0x1f')];this['originatecalleridnum']='';this[_0xcaaa('0x20')]='';}Action[_0xcaaa('0x21')][_0xcaaa('0x22')]=function(){return util['format'](_0xcaaa('0x23'),this['name'],this[_0xcaaa('0x3')]['dialCutDigit']>0x0?this[_0xcaaa('0x9')][_0xcaaa('0x24')](this[_0xcaaa('0x3')][_0xcaaa('0x25')]):this['number']);};Action[_0xcaaa('0x21')][_0xcaaa('0x26')]=function(){return this[_0xcaaa('0x27')];};module[_0xcaaa('0x28')]=Action; \ No newline at end of file +var _0x0440=['starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','dialCutDigit','getQueue','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','firstName','number','phone','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName'];(function(_0x4f9522,_0x399e9f){var _0x5a89a7=function(_0x853a9a){while(--_0x853a9a){_0x4f9522['push'](_0x4f9522['shift']());}};_0x5a89a7(++_0x399e9f);}(_0x0440,0x11c));var _0x0044=function(_0x28407a,_0x2a7269){_0x28407a=_0x28407a-0x0;var _0x8bd6ef=_0x0440[_0x28407a];return _0x8bd6ef;};'use strict';var util=require(_0x0044('0x0'));var _=require(_0x0044('0x1'));var moment=require(_0x0044('0x2'));function checkNameSurname(_0x35a188,_0x30a823,_0x2423e1){var _0x4d52b1='';if(!_[_0x0044('0x3')](_0x30a823)&&_0x0044('0x4')===typeof _0x30a823){_0x4d52b1+=_0x30a823;}if(!_[_0x0044('0x3')](_0x2423e1)&&_0x0044('0x4')===typeof _0x2423e1){_0x4d52b1+='\x20'+_0x2423e1;}if(_0x4d52b1!==''){return _0x4d52b1;}return _0x35a188;}function Action(_0x31929e,_0x5ba8e9,_0x296efd){this[_0x0044('0x5')]=_0x31929e;this[_0x0044('0x6')]=_0x296efd||undefined;this[_0x0044('0x7')]=checkNameSurname(_0x5ba8e9[_0x0044('0x8')]['phone'],_0x5ba8e9[_0x0044('0x8')][_0x0044('0x9')],_0x5ba8e9['Contact']['lastName']);this[_0x0044('0xa')]=_0x5ba8e9[_0x0044('0xb')];this[_0x0044('0xc')]=_0x31929e[_0x0044('0x7')];this[_0x0044('0xd')]=_0x5ba8e9[_0x0044('0xd')]||![];this['type']=_0x31929e[_0x0044('0xe')];this[_0x0044('0xf')]=_0x31929e['dialQueueTimeout']||0x3;this[_0x0044('0x10')]=_0x5ba8e9[_0x0044('0x10')];this[_0x0044('0x11')]=_0x5ba8e9[_0x0044('0x11')];this[_0x0044('0x12')]=_0x5ba8e9[_0x0044('0x12')];this[_0x0044('0x13')]=_0x5ba8e9[_0x0044('0x13')];this[_0x0044('0x14')]=_0x5ba8e9[_0x0044('0x14')];this['countdropretry']=_0x5ba8e9[_0x0044('0x15')];this[_0x0044('0x16')]=_0x5ba8e9[_0x0044('0x16')];this[_0x0044('0x17')]=_0x5ba8e9[_0x0044('0x17')];this[_0x0044('0x18')]=_0x5ba8e9['countagentrejectretry'];this['ContactId']=_0x5ba8e9[_0x0044('0x19')];this[_0x0044('0x1a')]=_0x5ba8e9[_0x0044('0x1a')];this[_0x0044('0x1b')]=_0x5ba8e9[_0x0044('0x1b')];this[_0x0044('0x1c')]=_0x5ba8e9[_0x0044('0x1c')];this[_0x0044('0x1d')]=_0x5ba8e9[_0x0044('0x1d')];this['idHopper']=_0x5ba8e9['id'];this[_0x0044('0x1e')]=_0x5ba8e9[_0x0044('0x8')][_0x0044('0x9')]||'';this[_0x0044('0x1f')]=moment()[_0x0044('0x20')](_0x0044('0x21'));this['callback']=_0x5ba8e9[_0x0044('0x22')];this[_0x0044('0x23')]=_0x5ba8e9[_0x0044('0x23')];this[_0x0044('0x24')]=_0x5ba8e9[_0x0044('0x24')];this[_0x0044('0x25')]=_0x5ba8e9['recallme'];this[_0x0044('0x26')]='';this[_0x0044('0x27')]='';}Action[_0x0044('0x28')][_0x0044('0x29')]=function(){return util[_0x0044('0x20')]('\x22%s\x22\x20<%s>',this[_0x0044('0x7')],this[_0x0044('0x5')][_0x0044('0x2a')]>0x0?this['number']['substring'](this[_0x0044('0x5')][_0x0044('0x2a')]):this[_0x0044('0xa')]);};Action[_0x0044('0x28')][_0x0044('0x2b')]=function(){return this[_0x0044('0xc')];};module[_0x0044('0x2c')]=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 4a7db74..29a3453 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 _0x3ae8=['holdtime','talktime','membername','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','state','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridnum','starttime','responsetime','answertime','endtime','format','getSeconds'];(function(_0x47cbbe,_0x4182f2){var _0xbba106=function(_0x3f4598){while(--_0x3f4598){_0x47cbbe['push'](_0x47cbbe['shift']());}};_0xbba106(++_0x4182f2);}(_0x3ae8,0x177));var _0x83ae=function(_0x9029d8,_0x254ec4){_0x9029d8=_0x9029d8-0x0;var _0x1d58bd=_0x3ae8[_0x9029d8];return _0x1d58bd;};'use strict';var moment=require(_0x83ae('0x0'));var utils=require('../utils');function AgentComplete(_0x5ac1f5,_0x4fbdda){this[_0x83ae('0x1')]=0x4;this['statedesc']=_0x83ae('0x2');this[_0x83ae('0x3')]=_0x5ac1f5[_0x83ae('0x3')];this[_0x83ae('0x4')]=_0x5ac1f5['type'];this[_0x83ae('0x5')]=_0x5ac1f5[_0x83ae('0x4')]===_0x83ae('0x6')?_0x83ae('0x7'):_0x5ac1f5['type'];this[_0x83ae('0x8')]=_0x5ac1f5[_0x83ae('0x8')];this[_0x83ae('0x9')]=_0x5ac1f5['countcongestionretry'];this[_0x83ae('0xa')]=_0x5ac1f5[_0x83ae('0xa')];this[_0x83ae('0xb')]=_0x5ac1f5[_0x83ae('0x8')]+_0x5ac1f5[_0x83ae('0x9')]+_0x5ac1f5[_0x83ae('0xa')]+_0x5ac1f5['countnosuchnumberretry']+_0x5ac1f5[_0x83ae('0xc')]+_0x5ac1f5[_0x83ae('0xd')]+_0x5ac1f5[_0x83ae('0xe')]+_0x5ac1f5[_0x83ae('0xf')];this[_0x83ae('0x10')]=_0x5ac1f5['countnosuchnumberretry'];this[_0x83ae('0xc')]=_0x5ac1f5[_0x83ae('0xc')];this[_0x83ae('0xd')]=_0x5ac1f5[_0x83ae('0xd')];this[_0x83ae('0xe')]=_0x5ac1f5[_0x83ae('0xe')];this[_0x83ae('0xf')]=_0x5ac1f5['countagentrejectretry'];this[_0x83ae('0x11')]=_0x4fbdda['uniqueid'];this['calleridname']=_0x5ac1f5['name'];this[_0x83ae('0x12')]=_0x5ac1f5['number'];this[_0x83ae('0x13')]=_0x5ac1f5['starttime'];this[_0x83ae('0x14')]=_0x5ac1f5[_0x83ae('0x14')];this[_0x83ae('0x15')]=_0x5ac1f5[_0x83ae('0x15')];this[_0x83ae('0x16')]=moment()[_0x83ae('0x17')]('YYYY-MM-DD\x20HH:mm:ss');this['ringtime']=utils[_0x83ae('0x18')](_0x5ac1f5[_0x83ae('0x14')],_0x5ac1f5['starttime']);this[_0x83ae('0x19')]=utils[_0x83ae('0x18')](_0x5ac1f5['answertime'],_0x5ac1f5[_0x83ae('0x14')]);this[_0x83ae('0x1a')]=utils[_0x83ae('0x18')](this['endtime'],_0x5ac1f5[_0x83ae('0x15')]);this[_0x83ae('0x7')]=_0x4fbdda['queue'];this[_0x83ae('0x1b')]=_0x4fbdda['membername'];this['reason']=_0x4fbdda['reason'];this[_0x83ae('0x1c')]=_0x5ac1f5[_0x83ae('0x1c')];this[_0x83ae('0x1d')]=_0x5ac1f5[_0x83ae('0x1d')];this[_0x83ae('0x1e')]=_0x5ac1f5[_0x83ae('0x1e')];this[_0x83ae('0x1f')]=_0x5ac1f5[_0x83ae('0x1f')];this['ContactId']=_0x5ac1f5['ContactId'];this[_0x83ae('0x20')]=_0x5ac1f5[_0x83ae('0x20')];this[_0x83ae('0x21')]=_0x5ac1f5[_0x83ae('0x21')];this[_0x83ae('0x22')]=_0x5ac1f5[_0x83ae('0x22')];this[_0x83ae('0x23')]=_0x5ac1f5[_0x83ae('0x23')];this[_0x83ae('0x24')]=_0x5ac1f5[_0x83ae('0x24')]||'';this[_0x83ae('0x25')]=_0x5ac1f5[_0x83ae('0x25')]||'';this['agiafterat']=_0x5ac1f5[_0x83ae('0x26')];}module[_0x83ae('0x27')]=AgentComplete; \ No newline at end of file +var _0xde42=['reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','state','scheduledat','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','number','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','starttime','holdtime','talktime','queue','membername'];(function(_0x79c410,_0x5785ee){var _0x11ec20=function(_0x4b937e){while(--_0x4b937e){_0x79c410['push'](_0x79c410['shift']());}};_0x11ec20(++_0x5785ee);}(_0xde42,0x1c6));var _0x2de4=function(_0x3a6bdc,_0x1b8897){_0x3a6bdc=_0x3a6bdc-0x0;var _0x4b27d7=_0xde42[_0x3a6bdc];return _0x4b27d7;};'use strict';var moment=require(_0x2de4('0x0'));var utils=require(_0x2de4('0x1'));function AgentComplete(_0x4c6b57,_0x262ebc){this[_0x2de4('0x2')]=0x4;this['statedesc']='Answer';this[_0x2de4('0x3')]=_0x4c6b57[_0x2de4('0x3')];this[_0x2de4('0x4')]=_0x4c6b57[_0x2de4('0x4')];this['campaigntype']=_0x4c6b57['type']==='outbound'?'queue':_0x4c6b57[_0x2de4('0x4')];this[_0x2de4('0x5')]=_0x4c6b57[_0x2de4('0x5')];this[_0x2de4('0x6')]=_0x4c6b57[_0x2de4('0x6')];this['countnoanswerretry']=_0x4c6b57[_0x2de4('0x7')];this[_0x2de4('0x8')]=_0x4c6b57['countbusyretry']+_0x4c6b57[_0x2de4('0x6')]+_0x4c6b57[_0x2de4('0x7')]+_0x4c6b57[_0x2de4('0x9')]+_0x4c6b57[_0x2de4('0xa')]+_0x4c6b57[_0x2de4('0xb')]+_0x4c6b57[_0x2de4('0xc')]+_0x4c6b57['countagentrejectretry'];this[_0x2de4('0x9')]=_0x4c6b57[_0x2de4('0x9')];this['countdropretry']=_0x4c6b57[_0x2de4('0xa')];this[_0x2de4('0xb')]=_0x4c6b57[_0x2de4('0xb')];this[_0x2de4('0xc')]=_0x4c6b57[_0x2de4('0xc')];this[_0x2de4('0xd')]=_0x4c6b57[_0x2de4('0xd')];this[_0x2de4('0xe')]=_0x262ebc[_0x2de4('0xe')];this['calleridname']=_0x4c6b57[_0x2de4('0xf')];this[_0x2de4('0x10')]=_0x4c6b57[_0x2de4('0x11')];this['starttime']=_0x4c6b57['starttime'];this['responsetime']=_0x4c6b57[_0x2de4('0x12')];this[_0x2de4('0x13')]=_0x4c6b57[_0x2de4('0x13')];this[_0x2de4('0x14')]=moment()[_0x2de4('0x15')](_0x2de4('0x16'));this[_0x2de4('0x17')]=utils[_0x2de4('0x18')](_0x4c6b57[_0x2de4('0x12')],_0x4c6b57[_0x2de4('0x19')]);this[_0x2de4('0x1a')]=utils[_0x2de4('0x18')](_0x4c6b57[_0x2de4('0x13')],_0x4c6b57[_0x2de4('0x12')]);this[_0x2de4('0x1b')]=utils[_0x2de4('0x18')](this[_0x2de4('0x14')],_0x4c6b57[_0x2de4('0x13')]);this[_0x2de4('0x1c')]=_0x262ebc['queue'];this[_0x2de4('0x1d')]=_0x262ebc[_0x2de4('0x1d')];this[_0x2de4('0x1e')]=_0x262ebc[_0x2de4('0x1e')];this[_0x2de4('0x1f')]=_0x4c6b57[_0x2de4('0x1f')];this[_0x2de4('0x20')]=_0x4c6b57[_0x2de4('0x20')];this['callbackat']=_0x4c6b57[_0x2de4('0x21')];this['recallme']=_0x4c6b57[_0x2de4('0x22')];this[_0x2de4('0x23')]=_0x4c6b57[_0x2de4('0x23')];this['ListId']=_0x4c6b57[_0x2de4('0x24')];this[_0x2de4('0x25')]=_0x4c6b57[_0x2de4('0x25')];this[_0x2de4('0x26')]=_0x4c6b57['VoiceQueueId'];this[_0x2de4('0x27')]=_0x4c6b57['CampaignId'];this['originatecalleridnum']=_0x4c6b57[_0x2de4('0x28')]||'';this[_0x2de4('0x29')]=_0x4c6b57['originatecalleridname']||'';this[_0x2de4('0x2a')]=_0x4c6b57['agiafterat'];}module[_0x2de4('0x2b')]=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 432ddf1..c34707a 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 _0xbb56=['scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countdropretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid'];(function(_0x4d67b8,_0x565134){var _0x55af3b=function(_0x145904){while(--_0x145904){_0x4d67b8['push'](_0x4d67b8['shift']());}};_0x55af3b(++_0x565134);}(_0xbb56,0x65));var _0x6bb5=function(_0xe7908d,_0x38c980){_0xe7908d=_0xe7908d-0x0;var _0x58d6c7=_0xbb56[_0xe7908d];return _0x58d6c7;};'use strict';function Final(_0x3d63ae){this[_0x6bb5('0x0')]=_0x3d63ae[_0x6bb5('0x0')];this['scheduledat']=_0x3d63ae[_0x6bb5('0x1')];this[_0x6bb5('0x2')]=_0x3d63ae[_0x6bb5('0x2')];this[_0x6bb5('0x3')]=_0x3d63ae[_0x6bb5('0x2')]==='outbound'?_0x6bb5('0x4'):_0x3d63ae['type'];this[_0x6bb5('0x5')]=_0x3d63ae[_0x6bb5('0x5')];this[_0x6bb5('0x6')]=_0x3d63ae['countcongestionretry'];this[_0x6bb5('0x7')]=_0x3d63ae[_0x6bb5('0x7')];this[_0x6bb5('0x8')]=_0x3d63ae[_0x6bb5('0x5')]+_0x3d63ae[_0x6bb5('0x6')]+_0x3d63ae[_0x6bb5('0x7')]+_0x3d63ae[_0x6bb5('0x9')]+_0x3d63ae['countdropretry']+_0x3d63ae[_0x6bb5('0xa')]+_0x3d63ae['countmachineretry']+_0x3d63ae['countagentrejectretry'];this[_0x6bb5('0x9')]=_0x3d63ae[_0x6bb5('0x9')];this[_0x6bb5('0xb')]=_0x3d63ae[_0x6bb5('0xb')];this[_0x6bb5('0xa')]=_0x3d63ae[_0x6bb5('0xa')];this['countmachineretry']=_0x3d63ae[_0x6bb5('0xc')];this[_0x6bb5('0xd')]=_0x3d63ae[_0x6bb5('0xd')];this[_0x6bb5('0x4')]=_0x3d63ae[_0x6bb5('0x4')];this[_0x6bb5('0xe')]=_0x3d63ae['calleridname'];this[_0x6bb5('0xf')]=_0x3d63ae[_0x6bb5('0xf')];this[_0x6bb5('0x10')]=_0x3d63ae[_0x6bb5('0x10')];this['responsetime']=_0x3d63ae['responsetime'];this[_0x6bb5('0x11')]=_0x3d63ae['responsetime'];this[_0x6bb5('0x12')]=_0x3d63ae[_0x6bb5('0x12')]||0x0;this[_0x6bb5('0x13')]=_0x3d63ae[_0x6bb5('0x13')]||0x0;this[_0x6bb5('0x14')]=_0x3d63ae[_0x6bb5('0x14')]||0x0;this[_0x6bb5('0x15')]=_0x3d63ae[_0x6bb5('0x15')];this[_0x6bb5('0x16')]=_0x3d63ae[_0x6bb5('0x16')];this[_0x6bb5('0x17')]=_0x3d63ae[_0x6bb5('0x17')];this[_0x6bb5('0x18')]=_0x3d63ae['recallme'];this[_0x6bb5('0x19')]=_0x3d63ae[_0x6bb5('0x19')];this[_0x6bb5('0x1a')]=_0x3d63ae[_0x6bb5('0x1a')];this[_0x6bb5('0x1b')]=_0x3d63ae[_0x6bb5('0x1b')];this[_0x6bb5('0x1c')]=_0x3d63ae[_0x6bb5('0x1c')];this[_0x6bb5('0x1d')]=_0x3d63ae['CampaignId'];this[_0x6bb5('0x1e')]=_0x3d63ae['originatecalleridnum']||'';this[_0x6bb5('0x1f')]=_0x3d63ae[_0x6bb5('0x1f')]||'';this['state']=_0x3d63ae[_0x6bb5('0x20')];this[_0x6bb5('0x21')]=_0x3d63ae[_0x6bb5('0x21')];}module['exports']=Final; \ No newline at end of file +var _0x80f2=['outbound','queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype'];(function(_0x22d0ee,_0x253a7a){var _0x566cf6=function(_0x5378d8){while(--_0x5378d8){_0x22d0ee['push'](_0x22d0ee['shift']());}};_0x566cf6(++_0x253a7a);}(_0x80f2,0x1ac));var _0x280f=function(_0x5902a3,_0x3219ee){_0x5902a3=_0x5902a3-0x0;var _0x3c68cc=_0x80f2[_0x5902a3];return _0x3c68cc;};'use strict';function Final(_0x6a286){this[_0x280f('0x0')]=_0x6a286[_0x280f('0x0')];this['scheduledat']=_0x6a286[_0x280f('0x1')];this[_0x280f('0x2')]=_0x6a286[_0x280f('0x2')];this[_0x280f('0x3')]=_0x6a286[_0x280f('0x2')]===_0x280f('0x4')?_0x280f('0x5'):_0x6a286[_0x280f('0x2')];this['countbusyretry']=_0x6a286[_0x280f('0x6')];this['countcongestionretry']=_0x6a286['countcongestionretry'];this[_0x280f('0x7')]=_0x6a286[_0x280f('0x7')];this[_0x280f('0x8')]=_0x6a286[_0x280f('0x6')]+_0x6a286[_0x280f('0x9')]+_0x6a286[_0x280f('0x7')]+_0x6a286[_0x280f('0xa')]+_0x6a286['countdropretry']+_0x6a286[_0x280f('0xb')]+_0x6a286[_0x280f('0xc')]+_0x6a286[_0x280f('0xd')];this['countnosuchnumberretry']=_0x6a286[_0x280f('0xa')];this[_0x280f('0xe')]=_0x6a286[_0x280f('0xe')];this[_0x280f('0xb')]=_0x6a286[_0x280f('0xb')];this[_0x280f('0xc')]=_0x6a286[_0x280f('0xc')];this[_0x280f('0xd')]=_0x6a286[_0x280f('0xd')];this['queue']=_0x6a286[_0x280f('0x5')];this[_0x280f('0xf')]=_0x6a286[_0x280f('0xf')];this[_0x280f('0x10')]=_0x6a286[_0x280f('0x10')];this[_0x280f('0x11')]=_0x6a286[_0x280f('0x11')];this[_0x280f('0x12')]=_0x6a286['responsetime'];this[_0x280f('0x13')]=_0x6a286['responsetime'];this[_0x280f('0x14')]=_0x6a286[_0x280f('0x14')]||0x0;this[_0x280f('0x15')]=_0x6a286['holdtime']||0x0;this[_0x280f('0x16')]=_0x6a286[_0x280f('0x16')]||0x0;this[_0x280f('0x17')]=_0x6a286[_0x280f('0x17')];this[_0x280f('0x18')]=_0x6a286[_0x280f('0x18')];this[_0x280f('0x19')]=_0x6a286[_0x280f('0x19')];this[_0x280f('0x1a')]=_0x6a286['recallme'];this['ContactId']=_0x6a286[_0x280f('0x1b')];this['ListId']=_0x6a286['ListId'];this[_0x280f('0x1c')]=_0x6a286['UserId'];this[_0x280f('0x1d')]=_0x6a286[_0x280f('0x1d')];this[_0x280f('0x1e')]=_0x6a286['CampaignId'];this[_0x280f('0x1f')]=_0x6a286[_0x280f('0x1f')]||'';this[_0x280f('0x20')]=_0x6a286[_0x280f('0x20')]||'';this[_0x280f('0x21')]=_0x6a286[_0x280f('0x21')];this[_0x280f('0x22')]=_0x6a286[_0x280f('0x22')];}module[_0x280f('0x23')]=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 524638a..6d0494f 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 _0x6697=['UserId','VoiceQueueId','CampaignId','exports','../utils','state','statedesc','scheduledat','type','campaigntype','outbound','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','queue','membername','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x2170e4,_0x5b969e){var _0xec86f5=function(_0x44e53e){while(--_0x44e53e){_0x2170e4['push'](_0x2170e4['shift']());}};_0xec86f5(++_0x5b969e);}(_0x6697,0x10c));var _0x7669=function(_0x3df7b8,_0x55db91){_0x3df7b8=_0x3df7b8-0x0;var _0x16f05d=_0x6697[_0x3df7b8];return _0x16f05d;};'use strict';var moment=require('moment');var utils=require(_0x7669('0x0'));function Hangup(_0x433005,_0x19a4cb){this[_0x7669('0x1')]=0x4;this[_0x7669('0x2')]='Answer';this[_0x7669('0x3')]=_0x433005[_0x7669('0x3')];this['type']=_0x433005[_0x7669('0x4')];this[_0x7669('0x5')]=_0x433005[_0x7669('0x4')]===_0x7669('0x6')?'queue':_0x433005[_0x7669('0x4')];this[_0x7669('0x7')]=_0x433005['amd']||![];this[_0x7669('0x8')]=_0x433005[_0x7669('0x8')];this[_0x7669('0x9')]=_0x433005[_0x7669('0x9')];this[_0x7669('0xa')]=_0x433005[_0x7669('0xa')];this[_0x7669('0xb')]=_0x433005['countbusyretry']+_0x433005[_0x7669('0x9')]+_0x433005[_0x7669('0xa')]+_0x433005[_0x7669('0xc')]+_0x433005[_0x7669('0xd')]+_0x433005[_0x7669('0xe')]+_0x433005[_0x7669('0xf')]+_0x433005['countagentrejectretry'];this[_0x7669('0xc')]=_0x433005[_0x7669('0xc')];this[_0x7669('0xd')]=_0x433005['countdropretry'];this[_0x7669('0xe')]=_0x433005[_0x7669('0xe')];this[_0x7669('0xf')]=_0x433005[_0x7669('0xf')];this[_0x7669('0x10')]=_0x433005[_0x7669('0x10')];this[_0x7669('0x11')]=_0x19a4cb[_0x7669('0x11')];this['calleridname']=_0x433005[_0x7669('0x12')];this[_0x7669('0x13')]=_0x433005[_0x7669('0x14')];this[_0x7669('0x15')]=_0x433005[_0x7669('0x15')];this['responsetime']=_0x433005[_0x7669('0x16')];this[_0x7669('0x17')]=moment()[_0x7669('0x18')](_0x7669('0x19'));this[_0x7669('0x1a')]=utils[_0x7669('0x1b')](_0x433005[_0x7669('0x16')],_0x433005['starttime']);this[_0x7669('0x1c')]=0x0;this[_0x7669('0x1d')]=utils[_0x7669('0x1b')](this[_0x7669('0x17')],_0x433005[_0x7669('0x16')]);this[_0x7669('0x1e')]=_0x433005[_0x7669('0x1e')];this[_0x7669('0x1f')]=_0x7669('0x20');this['reason']=_0x19a4cb[_0x7669('0x21')];this[_0x7669('0x22')]=_0x433005[_0x7669('0x22')];this[_0x7669('0x23')]=_0x433005[_0x7669('0x23')];this[_0x7669('0x24')]=_0x433005[_0x7669('0x24')];this['recallme']=_0x433005[_0x7669('0x25')];this[_0x7669('0x26')]=_0x433005[_0x7669('0x26')];this[_0x7669('0x27')]=_0x433005[_0x7669('0x27')];this[_0x7669('0x28')]=_0x433005['UserId'];this['VoiceQueueId']=_0x433005[_0x7669('0x29')];this[_0x7669('0x2a')]=_0x433005['CampaignId'];}module[_0x7669('0x2b')]=Hangup; \ No newline at end of file +var _0x9bc3=['cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','state','scheduledat','type','queue','amd','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','endtime','membername','IVR'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x9bc3,0xe2));var _0x39bc=function(_0x3d6135,_0x256136){_0x3d6135=_0x3d6135-0x0;var _0x16f3c1=_0x9bc3[_0x3d6135];return _0x16f3c1;};'use strict';var moment=require(_0x39bc('0x0'));var utils=require(_0x39bc('0x1'));function Hangup(_0xe623f0,_0x322f0c){this[_0x39bc('0x2')]=0x4;this['statedesc']='Answer';this[_0x39bc('0x3')]=_0xe623f0[_0x39bc('0x3')];this[_0x39bc('0x4')]=_0xe623f0[_0x39bc('0x4')];this['campaigntype']=_0xe623f0[_0x39bc('0x4')]==='outbound'?_0x39bc('0x5'):_0xe623f0[_0x39bc('0x4')];this[_0x39bc('0x6')]=_0xe623f0[_0x39bc('0x6')]||![];this[_0x39bc('0x7')]=_0xe623f0['countbusyretry'];this['countcongestionretry']=_0xe623f0['countcongestionretry'];this[_0x39bc('0x8')]=_0xe623f0[_0x39bc('0x8')];this[_0x39bc('0x9')]=_0xe623f0['countbusyretry']+_0xe623f0[_0x39bc('0xa')]+_0xe623f0[_0x39bc('0x8')]+_0xe623f0[_0x39bc('0xb')]+_0xe623f0[_0x39bc('0xc')]+_0xe623f0[_0x39bc('0xd')]+_0xe623f0[_0x39bc('0xe')]+_0xe623f0[_0x39bc('0xf')];this[_0x39bc('0xb')]=_0xe623f0[_0x39bc('0xb')];this[_0x39bc('0xc')]=_0xe623f0[_0x39bc('0xc')];this[_0x39bc('0xd')]=_0xe623f0[_0x39bc('0xd')];this['countmachineretry']=_0xe623f0[_0x39bc('0xe')];this['countagentrejectretry']=_0xe623f0['countagentrejectretry'];this[_0x39bc('0x10')]=_0x322f0c[_0x39bc('0x10')];this[_0x39bc('0x11')]=_0xe623f0[_0x39bc('0x12')];this[_0x39bc('0x13')]=_0xe623f0[_0x39bc('0x14')];this[_0x39bc('0x15')]=_0xe623f0[_0x39bc('0x15')];this[_0x39bc('0x16')]=_0xe623f0[_0x39bc('0x16')];this['endtime']=moment()[_0x39bc('0x17')](_0x39bc('0x18'));this[_0x39bc('0x19')]=utils[_0x39bc('0x1a')](_0xe623f0[_0x39bc('0x16')],_0xe623f0[_0x39bc('0x15')]);this[_0x39bc('0x1b')]=0x0;this[_0x39bc('0x1c')]=utils['getSeconds'](this[_0x39bc('0x1d')],_0xe623f0['responsetime']);this[_0x39bc('0x5')]=_0xe623f0[_0x39bc('0x5')];this[_0x39bc('0x1e')]=_0x39bc('0x1f');this['reason']=_0x322f0c[_0x39bc('0x20')];this[_0x39bc('0x21')]=_0xe623f0[_0x39bc('0x21')];this[_0x39bc('0x22')]=_0xe623f0[_0x39bc('0x22')];this['callbackat']=_0xe623f0[_0x39bc('0x23')];this[_0x39bc('0x24')]=_0xe623f0[_0x39bc('0x24')];this['ContactId']=_0xe623f0[_0x39bc('0x25')];this[_0x39bc('0x26')]=_0xe623f0['ListId'];this['UserId']=_0xe623f0[_0x39bc('0x27')];this[_0x39bc('0x28')]=_0xe623f0[_0x39bc('0x28')];this[_0x39bc('0x29')]=_0xe623f0[_0x39bc('0x29')];}module[_0x39bc('0x2a')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index 96d7522..977cd5e 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 _0xce8d=['talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','name','starttime','endtime','responsetime','getSeconds','holdtime'];(function(_0xe406bc,_0x45e9af){var _0x56cbd4=function(_0x29f11a){while(--_0x29f11a){_0xe406bc['push'](_0xe406bc['shift']());}};_0x56cbd4(++_0x45e9af);}(_0xce8d,0x7e));var _0xdce8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xce8d[_0x3dd15e];return _0x231fd0;};'use strict';var utils=require(_0xdce8('0x0'));function History(_0x39b551){this[_0xdce8('0x1')]=_0x39b551[_0xdce8('0x1')];this['scheduledat']=_0x39b551[_0xdce8('0x2')]||undefined;this[_0xdce8('0x3')]=_0x39b551['type'];this[_0xdce8('0x4')]=_0x39b551['type']===_0xdce8('0x5')?_0xdce8('0x6'):_0x39b551[_0xdce8('0x3')];this['countbusyretry']=_0x39b551[_0xdce8('0x7')];this[_0xdce8('0x8')]=_0x39b551[_0xdce8('0x8')];this[_0xdce8('0x9')]=_0x39b551['countnoanswerretry'];this[_0xdce8('0xa')]=_0x39b551[_0xdce8('0x7')]+_0x39b551['countcongestionretry']+_0x39b551['countnoanswerretry']+_0x39b551[_0xdce8('0xb')]+_0x39b551[_0xdce8('0xc')]+_0x39b551[_0xdce8('0xd')]+_0x39b551[_0xdce8('0xe')]+_0x39b551[_0xdce8('0xf')];this[_0xdce8('0xb')]=_0x39b551['countnosuchnumberretry'];this[_0xdce8('0xc')]=_0x39b551[_0xdce8('0xc')];this['countabandonedretry']=_0x39b551[_0xdce8('0xd')];this[_0xdce8('0xe')]=_0x39b551['countmachineretry'];this[_0xdce8('0xf')]=_0x39b551[_0xdce8('0xf')];this['queue']=_0x39b551[_0xdce8('0x6')];this['calleridname']=_0x39b551[_0xdce8('0x10')];this['calleridnum']=_0x39b551['number'];this[_0xdce8('0x11')]=_0x39b551[_0xdce8('0x11')];this['responsetime']=_0x39b551['responsetime'];this[_0xdce8('0x12')]=_0x39b551[_0xdce8('0x13')];this['ringtime']=utils[_0xdce8('0x14')](_0x39b551[_0xdce8('0x13')],_0x39b551[_0xdce8('0x11')]);this[_0xdce8('0x15')]=0x0;this[_0xdce8('0x16')]=0x0;this['callback']=_0x39b551[_0xdce8('0x17')];this['callbackuniqueid']=_0x39b551[_0xdce8('0x18')];this[_0xdce8('0x19')]=_0x39b551['callbackat'];this[_0xdce8('0x1a')]=_0x39b551[_0xdce8('0x1a')];this[_0xdce8('0x1b')]=_0x39b551['ContactId'];this[_0xdce8('0x1c')]=_0x39b551[_0xdce8('0x1c')];this[_0xdce8('0x1d')]=_0x39b551[_0xdce8('0x1d')];this[_0xdce8('0x1e')]=_0x39b551[_0xdce8('0x1e')];this['CampaignId']=_0x39b551[_0xdce8('0x1f')];this[_0xdce8('0x20')]=_0x39b551[_0xdce8('0x20')]||'';this[_0xdce8('0x21')]=_0x39b551[_0xdce8('0x21')]||'';this[_0xdce8('0x22')]=_0x39b551[_0xdce8('0x22')];this[_0xdce8('0x23')]=_0x39b551[_0xdce8('0x23')];}module[_0xdce8('0x24')]=History; \ No newline at end of file +var _0xcb33=['uniqueid','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','queue','name','calleridnum','number','starttime','responsetime','ringtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils'];(function(_0x512c45,_0x36f294){var _0x53de78=function(_0x4382b7){while(--_0x4382b7){_0x512c45['push'](_0x512c45['shift']());}};_0x53de78(++_0x36f294);}(_0xcb33,0x1e0));var _0x3cb3=function(_0x5b4f00,_0x473dee){_0x5b4f00=_0x5b4f00-0x0;var _0x2fbd88=_0xcb33[_0x5b4f00];return _0x2fbd88;};'use strict';var utils=require(_0x3cb3('0x0'));function History(_0x8a6642){this[_0x3cb3('0x1')]=_0x8a6642['uniqueid'];this[_0x3cb3('0x2')]=_0x8a6642[_0x3cb3('0x2')]||undefined;this[_0x3cb3('0x3')]=_0x8a6642[_0x3cb3('0x3')];this[_0x3cb3('0x4')]=_0x8a6642[_0x3cb3('0x3')]==='outbound'?'queue':_0x8a6642[_0x3cb3('0x3')];this['countbusyretry']=_0x8a6642[_0x3cb3('0x5')];this[_0x3cb3('0x6')]=_0x8a6642[_0x3cb3('0x6')];this[_0x3cb3('0x7')]=_0x8a6642[_0x3cb3('0x7')];this[_0x3cb3('0x8')]=_0x8a6642[_0x3cb3('0x5')]+_0x8a6642[_0x3cb3('0x6')]+_0x8a6642[_0x3cb3('0x7')]+_0x8a6642[_0x3cb3('0x9')]+_0x8a6642[_0x3cb3('0xa')]+_0x8a6642['countabandonedretry']+_0x8a6642['countmachineretry']+_0x8a6642[_0x3cb3('0xb')];this[_0x3cb3('0x9')]=_0x8a6642['countnosuchnumberretry'];this[_0x3cb3('0xa')]=_0x8a6642[_0x3cb3('0xa')];this[_0x3cb3('0xc')]=_0x8a6642[_0x3cb3('0xc')];this[_0x3cb3('0xd')]=_0x8a6642[_0x3cb3('0xd')];this[_0x3cb3('0xb')]=_0x8a6642[_0x3cb3('0xb')];this[_0x3cb3('0xe')]=_0x8a6642[_0x3cb3('0xe')];this['calleridname']=_0x8a6642[_0x3cb3('0xf')];this[_0x3cb3('0x10')]=_0x8a6642[_0x3cb3('0x11')];this[_0x3cb3('0x12')]=_0x8a6642[_0x3cb3('0x12')];this['responsetime']=_0x8a6642[_0x3cb3('0x13')];this['endtime']=_0x8a6642['responsetime'];this[_0x3cb3('0x14')]=utils[_0x3cb3('0x15')](_0x8a6642[_0x3cb3('0x13')],_0x8a6642[_0x3cb3('0x12')]);this[_0x3cb3('0x16')]=0x0;this[_0x3cb3('0x17')]=0x0;this[_0x3cb3('0x18')]=_0x8a6642[_0x3cb3('0x18')];this[_0x3cb3('0x19')]=_0x8a6642[_0x3cb3('0x19')];this[_0x3cb3('0x1a')]=_0x8a6642[_0x3cb3('0x1a')];this[_0x3cb3('0x1b')]=_0x8a6642['recallme'];this['ContactId']=_0x8a6642['ContactId'];this['ListId']=_0x8a6642[_0x3cb3('0x1c')];this[_0x3cb3('0x1d')]=_0x8a6642[_0x3cb3('0x1d')];this[_0x3cb3('0x1e')]=_0x8a6642[_0x3cb3('0x1e')];this[_0x3cb3('0x1f')]=_0x8a6642['CampaignId'];this[_0x3cb3('0x20')]=_0x8a6642['originatecalleridnum']||'';this[_0x3cb3('0x21')]=_0x8a6642[_0x3cb3('0x21')]||'';this[_0x3cb3('0x22')]=_0x8a6642[_0x3cb3('0x22')];this['statedesc']=_0x8a6642[_0x3cb3('0x23')];}module[_0x3cb3('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 062f64f..c3ba7e6 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 _0xe72f=['responsetime','droptime','dropreason','endtime','ringtime','getSeconds','membername','connectedlinename','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime'];(function(_0x124f88,_0x3ad501){var _0xed0e3b=function(_0x43a67d){while(--_0x43a67d){_0x124f88['push'](_0x124f88['shift']());}};_0xed0e3b(++_0x3ad501);}(_0xe72f,0x191));var _0xfe72=function(_0x25def1,_0x283b4b){_0x25def1=_0x25def1-0x0;var _0x4c26d5=_0xe72f[_0x25def1];return _0x4c26d5;};'use strict';var utils=require(_0xfe72('0x0'));function QueueCallerAbandon(_0x2cf537,_0x2674bd){this[_0xfe72('0x1')]=_0x2cf537[_0xfe72('0x1')];this[_0xfe72('0x2')]=_0x2cf537[_0xfe72('0x2')];this[_0xfe72('0x3')]=_0x2cf537[_0xfe72('0x2')]==='outbound'?_0xfe72('0x4'):_0x2cf537['type'];this[_0xfe72('0x5')]=_0x2cf537['countbusyretry'];this[_0xfe72('0x6')]=_0x2cf537[_0xfe72('0x6')];this[_0xfe72('0x7')]=_0x2cf537[_0xfe72('0x7')];this[_0xfe72('0x8')]=_0x2cf537['countbusyretry']+_0x2cf537['countcongestionretry']+_0x2cf537[_0xfe72('0x7')]+_0x2cf537[_0xfe72('0x9')]+_0x2cf537[_0xfe72('0xa')]+_0x2cf537[_0xfe72('0xb')]+_0x2cf537[_0xfe72('0xc')]+_0x2cf537[_0xfe72('0xd')];this[_0xfe72('0x9')]=_0x2cf537[_0xfe72('0x9')];this[_0xfe72('0xa')]=_0x2cf537[_0xfe72('0xa')];this[_0xfe72('0xb')]=_0x2cf537['countabandonedretry'];this[_0xfe72('0xc')]=_0x2cf537[_0xfe72('0xc')];this['countagentrejectretry']=_0x2cf537[_0xfe72('0xd')];this[_0xfe72('0xe')]=_0x2674bd['uniqueid'];this[_0xfe72('0xf')]=_0x2cf537[_0xfe72('0x10')];this['calleridnum']=_0x2cf537[_0xfe72('0x11')];this['starttime']=_0x2cf537[_0xfe72('0x12')];this[_0xfe72('0x13')]=_0x2cf537[_0xfe72('0x13')];this['droptime']=_0x2cf537[_0xfe72('0x14')];this['dropreason']=_0x2cf537[_0xfe72('0x15')];this[_0xfe72('0x16')]=this['droptime'];this[_0xfe72('0x17')]=utils[_0xfe72('0x18')](_0x2cf537['responsetime'],_0x2cf537['starttime']);this['holdtime']=utils['getSeconds'](this['droptime'],_0x2cf537[_0xfe72('0x13')]);this['talktime']=0x0;this[_0xfe72('0x4')]=_0x2674bd['queue'];this[_0xfe72('0x19')]=_0x2674bd[_0xfe72('0x1a')];this[_0xfe72('0x1b')]=_0x2674bd['reason'];this['callback']=_0x2cf537['callback'];this[_0xfe72('0x1c')]=_0x2cf537[_0xfe72('0x1c')];this[_0xfe72('0x1d')]=_0x2cf537[_0xfe72('0x1d')];this[_0xfe72('0x1e')]=_0x2cf537[_0xfe72('0x1e')];this[_0xfe72('0x1f')]=_0x2cf537['ContactId'];this[_0xfe72('0x20')]=_0x2cf537[_0xfe72('0x20')];this[_0xfe72('0x21')]=_0x2cf537['UserId'];this[_0xfe72('0x22')]=_0x2cf537['VoiceQueueId'];this['CampaignId']=_0x2cf537[_0xfe72('0x23')];this['originatecalleridnum']=_0x2cf537[_0xfe72('0x24')]||'';this[_0xfe72('0x25')]=_0x2cf537[_0xfe72('0x25')]||'';this[_0xfe72('0x26')]=_0x2cf537[_0xfe72('0x26')];this[_0xfe72('0x27')]=_0x2cf537[_0xfe72('0x27')];this['statedesc']=_0x2cf537[_0xfe72('0x28')];}module[_0xfe72('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0x16be=['originatecalleridname','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','uniqueid','calleridname','name','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum'];(function(_0x20db6c,_0x4ff24a){var _0x30b5d3=function(_0x1ba9f0){while(--_0x1ba9f0){_0x20db6c['push'](_0x20db6c['shift']());}};_0x30b5d3(++_0x4ff24a);}(_0x16be,0x15c));var _0xe16b=function(_0x4783c0,_0x3276cc){_0x4783c0=_0x4783c0-0x0;var _0x2d547e=_0x16be[_0x4783c0];return _0x2d547e;};'use strict';var utils=require(_0xe16b('0x0'));function QueueCallerAbandon(_0x3e83a2,_0x3ee61f){this[_0xe16b('0x1')]=_0x3e83a2[_0xe16b('0x1')];this[_0xe16b('0x2')]=_0x3e83a2[_0xe16b('0x2')];this[_0xe16b('0x3')]=_0x3e83a2['type']===_0xe16b('0x4')?_0xe16b('0x5'):_0x3e83a2[_0xe16b('0x2')];this[_0xe16b('0x6')]=_0x3e83a2[_0xe16b('0x6')];this[_0xe16b('0x7')]=_0x3e83a2[_0xe16b('0x7')];this[_0xe16b('0x8')]=_0x3e83a2[_0xe16b('0x8')];this[_0xe16b('0x9')]=_0x3e83a2[_0xe16b('0x6')]+_0x3e83a2[_0xe16b('0x7')]+_0x3e83a2[_0xe16b('0x8')]+_0x3e83a2['countnosuchnumberretry']+_0x3e83a2[_0xe16b('0xa')]+_0x3e83a2['countabandonedretry']+_0x3e83a2[_0xe16b('0xb')]+_0x3e83a2[_0xe16b('0xc')];this[_0xe16b('0xd')]=_0x3e83a2['countnosuchnumberretry'];this[_0xe16b('0xa')]=_0x3e83a2[_0xe16b('0xa')];this[_0xe16b('0xe')]=_0x3e83a2[_0xe16b('0xe')];this['countmachineretry']=_0x3e83a2[_0xe16b('0xb')];this[_0xe16b('0xc')]=_0x3e83a2[_0xe16b('0xc')];this[_0xe16b('0xf')]=_0x3ee61f[_0xe16b('0xf')];this[_0xe16b('0x10')]=_0x3e83a2[_0xe16b('0x11')];this['calleridnum']=_0x3e83a2[_0xe16b('0x12')];this[_0xe16b('0x13')]=_0x3e83a2[_0xe16b('0x13')];this[_0xe16b('0x14')]=_0x3e83a2[_0xe16b('0x14')];this['droptime']=_0x3e83a2[_0xe16b('0x15')];this['dropreason']=_0x3e83a2[_0xe16b('0x16')];this[_0xe16b('0x17')]=this[_0xe16b('0x15')];this[_0xe16b('0x18')]=utils[_0xe16b('0x19')](_0x3e83a2['responsetime'],_0x3e83a2['starttime']);this[_0xe16b('0x1a')]=utils[_0xe16b('0x19')](this[_0xe16b('0x15')],_0x3e83a2['responsetime']);this['talktime']=0x0;this[_0xe16b('0x5')]=_0x3ee61f[_0xe16b('0x5')];this[_0xe16b('0x1b')]=_0x3ee61f[_0xe16b('0x1c')];this[_0xe16b('0x1d')]=_0x3ee61f['reason'];this[_0xe16b('0x1e')]=_0x3e83a2[_0xe16b('0x1e')];this[_0xe16b('0x1f')]=_0x3e83a2[_0xe16b('0x1f')];this[_0xe16b('0x20')]=_0x3e83a2[_0xe16b('0x20')];this[_0xe16b('0x21')]=_0x3e83a2['recallme'];this['ContactId']=_0x3e83a2['ContactId'];this[_0xe16b('0x22')]=_0x3e83a2[_0xe16b('0x22')];this[_0xe16b('0x23')]=_0x3e83a2[_0xe16b('0x23')];this[_0xe16b('0x24')]=_0x3e83a2[_0xe16b('0x24')];this['CampaignId']=_0x3e83a2[_0xe16b('0x25')];this[_0xe16b('0x26')]=_0x3e83a2[_0xe16b('0x26')]||'';this[_0xe16b('0x27')]=_0x3e83a2[_0xe16b('0x27')]||'';this['agiafterat']=_0x3e83a2['agiafterat'];this[_0xe16b('0x28')]=_0x3e83a2[_0xe16b('0x28')];this[_0xe16b('0x29')]=_0x3e83a2['statedesc'];}module[_0xe16b('0x2a')]=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 832e116..03954b8 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 _0xffd6=['[getContactDialerIvr]','getContactDialerIvr','countReScheduled','[countReScheduled]','rescheduleContact','unlockContact','[unlockContact]','moveContactManagedDialer','checkIsBlackList','checkIsBlackListIvr','verifyAdditionalPhones','[verifyAdditionalPhone]','[swapAdditionalPhone]','avgHandleTime','createHistory','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','getContactDialer','catch','temp','error','[getContactDialer]','dialOrderByScheduledAt'];(function(_0x15369e,_0x3a1a71){var _0x5367ee=function(_0xfd58ba){while(--_0xfd58ba){_0x15369e['push'](_0x15369e['shift']());}};_0x5367ee(++_0x3a1a71);}(_0xffd6,0x97));var _0x6ffd=function(_0x296923,_0x4adaed){_0x296923=_0x296923-0x0;var _0x29af70=_0xffd6[_0x296923];return _0x29af70;};'use strict';var util=require(_0x6ffd('0x0'));var logger=require(_0x6ffd('0x1'))(_0x6ffd('0x2'));var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x6ffd('0x3'));var cmHopperHistory=require(_0x6ffd('0x4'));function inspectError(_0x39fd49){return util['inspect'](_0x39fd49,{'showHidden':![],'depth':null});}function getContactDialer(_0x1d12e3,_0x173979,_0x3b8a46){return cmHopper[_0x6ffd('0x5')](_0x1d12e3['id'],_0x173979,_0x3b8a46,_0x1d12e3['dialOrderByScheduledAt'])[_0x6ffd('0x6')](function(_0xeefe34){_0x1d12e3[_0x6ffd('0x7')]=0x0;logger[_0x6ffd('0x8')](_0x6ffd('0x9'),inspectError(_0xeefe34));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x455dda,_0x417f34){return cmHopper['getContactDialerIvr'](_0x455dda['id'],_0x417f34,_0x455dda[_0x6ffd('0xa')])[_0x6ffd('0x6')](function(_0x23f7f2){_0x455dda[_0x6ffd('0x7')]=0x0;logger[_0x6ffd('0x8')](_0x6ffd('0xb'),inspectError(_0x23f7f2));});}exports[_0x6ffd('0xc')]=getContactDialerIvr;function countReScheduled(_0x5892e1){return cmHopper[_0x6ffd('0xd')](_0x5892e1)[_0x6ffd('0x6')](function(_0x5e8d6d){logger[_0x6ffd('0x8')](_0x6ffd('0xe'),inspectError(_0x5e8d6d));});}exports[_0x6ffd('0xd')]=countReScheduled;function rescheduleContact(_0x1a00d9){return cmHopper['rescheduleContact'](_0x1a00d9)[_0x6ffd('0x6')](function(_0x594cb3){logger[_0x6ffd('0x8')]('[rescheduleContact]',inspectError(_0x594cb3));});}exports[_0x6ffd('0xf')]=rescheduleContact;function unlockContact(_0x261ed7,_0x45db49,_0x5d8aff){return cmHopper[_0x6ffd('0x10')](_0x261ed7,_0x45db49,_0x5d8aff)[_0x6ffd('0x6')](function(_0x350c94){logger[_0x6ffd('0x8')](_0x6ffd('0x11'),inspectError(_0x350c94));});}exports[_0x6ffd('0x10')]=unlockContact;function moveContactManagedDialer(_0x3f38e7){return cmHopper[_0x6ffd('0x12')](_0x3f38e7)['catch'](function(_0x11a609){logger['error']('[moveContactManagedDialer]',inspectError(_0x11a609));});}exports[_0x6ffd('0x12')]=moveContactManagedDialer;function checkIsBlackList(_0x359d09){return cmHopperBlack['checkIsBlackList'](_0x359d09)[_0x6ffd('0x6')](function(_0x4612a3){logger['error']('[checkIsBlackList]',inspectError(_0x4612a3));});}exports[_0x6ffd('0x13')]=checkIsBlackList;function checkIsBlackListIvr(_0x1c9d19){return cmHopperBlack['checkIsBlackListIvr'](_0x1c9d19)[_0x6ffd('0x6')](function(_0x39f25c){logger[_0x6ffd('0x8')]('[checkIsBlackListIvr]',inspectError(_0x39f25c));});}exports[_0x6ffd('0x14')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x2efeb5,_0x50896b,_0x356c9c){return cmHopperAdditionalPhone[_0x6ffd('0x15')](_0x2efeb5,_0x50896b,_0x356c9c)['catch'](function(_0x31fb22){logger[_0x6ffd('0x8')](_0x6ffd('0x16'),inspectError(_0x31fb22));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x46631e,_0x3e5726,_0x46b03f){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x46631e,_0x3e5726,_0x46b03f)[_0x6ffd('0x6')](function(_0x5a55e2){logger[_0x6ffd('0x8')](_0x6ffd('0x17'),inspectError(_0x5a55e2));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x520258){return cmHopperHistory[_0x6ffd('0x18')](_0x520258)[_0x6ffd('0x6')](function(_0x1934d4){logger['error']('[avgHandleTime]',inspectError(_0x1934d4));});}exports[_0x6ffd('0x18')]=avgHandleTime;function createHistory(_0x48feb4){return cmHopperHistory[_0x6ffd('0x19')](_0x48feb4)[_0x6ffd('0x6')](function(_0x51fdb6){logger[_0x6ffd('0x8')](_0x6ffd('0x1a'),inspectError(_0x51fdb6));});}exports[_0x6ffd('0x19')]=createHistory; \ No newline at end of file +var _0xd8fb=['[avgHandleTime]','createHistory','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopper','inspect','dialOrderByScheduledAt','error','[getContactDialer]','getContactDialerIvr','temp','countReScheduled','[countReScheduled]','rescheduleContact','catch','[unlockContact]','unlockContact','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime'];(function(_0x21ed96,_0x5ec9d0){var _0x18b7f0=function(_0x2e2366){while(--_0x2e2366){_0x21ed96['push'](_0x21ed96['shift']());}};_0x18b7f0(++_0x5ec9d0);}(_0xd8fb,0x99));var _0xbd8f=function(_0x26b50e,_0x4d944d){_0x26b50e=_0x26b50e-0x0;var _0xa1b48d=_0xd8fb[_0x26b50e];return _0xa1b48d;};'use strict';var util=require(_0xbd8f('0x0'));var logger=require(_0xbd8f('0x1'))(_0xbd8f('0x2'));var cmHopper=require(_0xbd8f('0x3'));var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x455a12){return util[_0xbd8f('0x4')](_0x455a12,{'showHidden':![],'depth':null});}function getContactDialer(_0x53cccc,_0x400dfb,_0x2343bf){return cmHopper['getContactDialer'](_0x53cccc['id'],_0x400dfb,_0x2343bf,_0x53cccc[_0xbd8f('0x5')])['catch'](function(_0xf503c4){_0x53cccc['temp']=0x0;logger[_0xbd8f('0x6')](_0xbd8f('0x7'),inspectError(_0xf503c4));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x5697bd,_0x3caa93){return cmHopper[_0xbd8f('0x8')](_0x5697bd['id'],_0x3caa93,_0x5697bd[_0xbd8f('0x5')])['catch'](function(_0x255af3){_0x5697bd[_0xbd8f('0x9')]=0x0;logger['error']('[getContactDialerIvr]',inspectError(_0x255af3));});}exports[_0xbd8f('0x8')]=getContactDialerIvr;function countReScheduled(_0x40a5bc){return cmHopper[_0xbd8f('0xa')](_0x40a5bc)['catch'](function(_0x230988){logger[_0xbd8f('0x6')](_0xbd8f('0xb'),inspectError(_0x230988));});}exports[_0xbd8f('0xa')]=countReScheduled;function rescheduleContact(_0x8bc054){return cmHopper[_0xbd8f('0xc')](_0x8bc054)[_0xbd8f('0xd')](function(_0x29ffe8){logger[_0xbd8f('0x6')]('[rescheduleContact]',inspectError(_0x29ffe8));});}exports[_0xbd8f('0xc')]=rescheduleContact;function unlockContact(_0x829fb2,_0xa57e91,_0x10d72e){return cmHopper['unlockContact'](_0x829fb2,_0xa57e91,_0x10d72e)[_0xbd8f('0xd')](function(_0x63db18){logger['error'](_0xbd8f('0xe'),inspectError(_0x63db18));});}exports[_0xbd8f('0xf')]=unlockContact;function moveContactManagedDialer(_0x504adb){return cmHopper[_0xbd8f('0x10')](_0x504adb)[_0xbd8f('0xd')](function(_0x47d317){logger['error'](_0xbd8f('0x11'),inspectError(_0x47d317));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x5705c5){return cmHopperBlack[_0xbd8f('0x12')](_0x5705c5)['catch'](function(_0xd706bc){logger[_0xbd8f('0x6')](_0xbd8f('0x13'),inspectError(_0xd706bc));});}exports[_0xbd8f('0x12')]=checkIsBlackList;function checkIsBlackListIvr(_0xdc11cc){return cmHopperBlack[_0xbd8f('0x14')](_0xdc11cc)[_0xbd8f('0xd')](function(_0x90eff8){logger[_0xbd8f('0x6')](_0xbd8f('0x15'),inspectError(_0x90eff8));});}exports[_0xbd8f('0x14')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x1628f5,_0x2f7c45,_0x15c4a9){return cmHopperAdditionalPhone[_0xbd8f('0x16')](_0x1628f5,_0x2f7c45,_0x15c4a9)[_0xbd8f('0xd')](function(_0x395b1b){logger['error'](_0xbd8f('0x17'),inspectError(_0x395b1b));});}exports[_0xbd8f('0x16')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x1f9fcc,_0x2f3df7,_0xa88414){return cmHopperAdditionalPhone[_0xbd8f('0x18')](_0x1f9fcc,_0x2f3df7,_0xa88414)[_0xbd8f('0xd')](function(_0x264e62){logger['error'](_0xbd8f('0x19'),inspectError(_0x264e62));});}exports[_0xbd8f('0x18')]=swapAdditionalPhones;function avgHandleTime(_0x5a3a8c){return cmHopperHistory[_0xbd8f('0x1a')](_0x5a3a8c)['catch'](function(_0x41b2a6){logger[_0xbd8f('0x6')](_0xbd8f('0x1b'),inspectError(_0x41b2a6));});}exports[_0xbd8f('0x1a')]=avgHandleTime;function createHistory(_0x2aefa2){return cmHopperHistory[_0xbd8f('0x1c')](_0x2aefa2)['catch'](function(_0x166de7){logger[_0xbd8f('0x6')](_0xbd8f('0x1d'),inspectError(_0x166de7));});}exports[_0xbd8f('0x1c')]=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index a7360d5..25c24ed 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 _0x5bff=['string','format','\x22%s\x22\x20<%s>','getCallerId','pow','replace','random','toString','getCallerIdRandom','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','tags','undefined','%s%s','XMD-','toUpperCase','setXMDContactVariables','lodash','moment','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','ivr','isIVRCampaign','type','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','isNil','dialGlobalInterval','Interval','Intervals','isEmpty','EMPTY_INTERVAL','reachable','includes','status','TrunkBackup','INACTIVE','DISACTIVED','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','isUndefined'];(function(_0x2ddb09,_0xe3a959){var _0x4b8417=function(_0x10592c){while(--_0x10592c){_0x2ddb09['push'](_0x2ddb09['shift']());}};_0x4b8417(++_0xe3a959);}(_0x5bff,0x6d));var _0xf5bf=function(_0x4d2e0c,_0x1bdedd){_0x4d2e0c=_0x4d2e0c-0x0;var _0x1c446c=_0x5bff[_0x4d2e0c];return _0x1c446c;};'use strict';var _=require(_0xf5bf('0x0'));var moment=require(_0xf5bf('0x1'));var util=require('util');var logger=require(_0xf5bf('0x2'))(_0xf5bf('0x3'));var timezones=require(_0xf5bf('0x4'))[_0xf5bf('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0xf5bf('0x6'),'BLACKLIST':_0xf5bf('0x7'),'CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':'DEACTIVATED','DISACTIVED':_0xf5bf('0x8'),'EMPTY_INTERVAL':_0xf5bf('0x9'),'INACTIVE':_0xf5bf('0xa'),'NO_AGENTS_LOGGED':_0xf5bf('0xb'),'NO_AVAILABLE_CONTACTS':_0xf5bf('0xc'),'NULL_INTERVAL':_0xf5bf('0xd'),'OVERTIME_INTERVAL':_0xf5bf('0xe'),'OVERTIME_GLOBAL_INTERVAL':_0xf5bf('0xf'),'QUEUE_RECALL':_0xf5bf('0x10'),'RECALL_TIMEOUT':_0xf5bf('0x11'),'RUNNING':_0xf5bf('0x12'),'UNKNOWN_TIMEZONE':_0xf5bf('0x13'),'UNREACHABLE_TRUNK':_0xf5bf('0x14')};exports[_0xf5bf('0x15')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x3f689e){return _0x3f689e[_0xf5bf('0x16')]===_0xf5bf('0x17');}exports['isPreviewCampaign']=isPreviewCampaign;function isIVRCampaign(_0xde3a96){return _0xde3a96['type']===_0xf5bf('0x18');}exports[_0xf5bf('0x19')]=isIVRCampaign;function isOutboundQueue(_0xec47e0){return _0xec47e0[_0xf5bf('0x1a')]==='outbound';}exports[_0xf5bf('0x1b')]=isOutboundQueue;function isQueueCampaignActive(_0x5cccd5){return _0x5cccd5[_0xf5bf('0x1c')];}exports[_0xf5bf('0x1d')]=isQueueCampaignActive;function isIVRCampaignActive(_0x476b14){return _0x476b14[_0xf5bf('0x1e')];}exports[_0xf5bf('0x1f')]=isIVRCampaignActive;function getSeconds(_0x59aa19,_0x1d8001){var _0x28b2a3=moment(_0x59aa19)[_0xf5bf('0x20')](0x0);var _0x4d6e77=moment(_0x1d8001)[_0xf5bf('0x20')](0x0);return _0x28b2a3[_0xf5bf('0x21')](_0x4d6e77,_0xf5bf('0x22'));}exports[_0xf5bf('0x23')]=getSeconds;function hasQueueCampaignDataChanged(_0x35eddf,_0x2721a1){var _0x286aa9=![];var _0x4aa541=_0x35eddf[_0xf5bf('0x16')]!==_0x2721a1[_0xf5bf('0x16')]||_0x35eddf[_0xf5bf('0x1c')]!==_0x2721a1[_0xf5bf('0x1c')]||_0x35eddf[_0xf5bf('0x24')]!==_0x2721a1[_0xf5bf('0x24')];var _0x449d65=_0x35eddf[_0xf5bf('0x25')]!==_0x2721a1[_0xf5bf('0x25')]||_0x35eddf[_0xf5bf('0x26')]!==_0x2721a1[_0xf5bf('0x26')]||_0x35eddf[_0xf5bf('0x27')]!==_0x2721a1[_0xf5bf('0x27')]||_0x35eddf[_0xf5bf('0x28')]!==_0x2721a1[_0xf5bf('0x28')]||_0x35eddf[_0xf5bf('0x29')]!==_0x2721a1[_0xf5bf('0x29')]||_0x35eddf[_0xf5bf('0x2a')]!==_0x2721a1['pTalking']||_0x35eddf[_0xf5bf('0x2b')]!==_0x2721a1[_0xf5bf('0x2b')]||_0x35eddf[_0xf5bf('0x2c')]!==_0x2721a1[_0xf5bf('0x2c')]||_0x35eddf['originated']!==_0x2721a1[_0xf5bf('0x2d')];if(_0x35eddf['Trunk']&&_0x2721a1[_0xf5bf('0x2e')]){_0x286aa9=_0x35eddf[_0xf5bf('0x2e')][_0xf5bf('0x2f')]!==_0x2721a1['Trunk'][_0xf5bf('0x2f')]||_0x35eddf['Trunk']['active']!==_0x2721a1[_0xf5bf('0x2e')][_0xf5bf('0x1e')];}return _0x4aa541||_0x449d65||_0x286aa9;}exports[_0xf5bf('0x30')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x15f073){var _0x4c9e68=null;var _0x37616c=_0x15f073['dialTimezone'];if(_[_0xf5bf('0x31')](_0x15f073[_0xf5bf('0x32')])||_[_0xf5bf('0x31')](_0x15f073['Interval'])||_[_0xf5bf('0x31')](_0x15f073[_0xf5bf('0x33')][_0xf5bf('0x34')])){_0x4c9e68=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_[_0xf5bf('0x35')](_0x15f073[_0xf5bf('0x32')])||_[_0xf5bf('0x35')](_0x15f073['Interval']['Intervals'])){_0x4c9e68=CAMPAIGN_STATUS[_0xf5bf('0x36')];}else if(_0x37616c&&!timezones[_0x37616c]){_0x4c9e68=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0x4c9e68;}function checkAnyValidTrunk(_0x1affb7,_0xaf5f1e){var _0x124fe6=null;var _0x1d92dd='SIP/';var _0x1c56f6=[_0xf5bf('0x37'),'unmonitored'];var _0x2b7b8a=!![];if(_0x1affb7[_0xf5bf('0x2e')]&&_0x1affb7['Trunk'][_0xf5bf('0x1e')]){_0x1d92dd+=_0x1affb7['Trunk'][_0xf5bf('0x2f')];_0x124fe6=_0xaf5f1e[_0x1d92dd];_0x2b7b8a=_0x1c56f6[_0xf5bf('0x38')](_0x124fe6[_0xf5bf('0x39')]);}else if(_0x1affb7[_0xf5bf('0x3a')]&&_0x1affb7[_0xf5bf('0x3a')][_0xf5bf('0x1e')]){_0x1d92dd+=_0x1affb7[_0xf5bf('0x3a')][_0xf5bf('0x2f')];_0x124fe6=_0xaf5f1e[_0x1d92dd];_0x2b7b8a=_0x1c56f6['includes'](_0x124fe6[_0xf5bf('0x39')]);}return _0x2b7b8a;}function getQueueCampaignStatusMessage(_0x963a8d,_0x257229){var _0x476568=CAMPAIGN_STATUS[_0xf5bf('0x6')];var _0x14b892=isPreviewCampaign(_0x963a8d);if(!isQueueCampaignActive(_0x963a8d)){if(_0x14b892){_0x476568=CAMPAIGN_STATUS[_0xf5bf('0x3b')];}else{if(_0x963a8d[_0xf5bf('0x2d')]===0x0&&_0x963a8d['talking']===0x0&&_0x963a8d[_0xf5bf('0x2b')]===0x0&&(_0x963a8d['pTalking']||0x0)===0x0){_0x476568=CAMPAIGN_STATUS[_0xf5bf('0x3b')];}else{_0x476568=CAMPAIGN_STATUS[_0xf5bf('0x3c')];}}}else if(_0x963a8d[_0xf5bf('0x26')]===0x0){_0x476568=CAMPAIGN_STATUS['NO_AGENTS_LOGGED'];}else if(!checkAnyValidTrunk(_0x963a8d,_0x257229)){_0x476568=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0x963a8d)){var _0x5076e2=checkAnyValidQueueCampaignInterval(_0x963a8d);if(_0x5076e2){_0x476568=_0x5076e2;}}return _0x476568;}exports[_0xf5bf('0x3d')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x29bf9e){var _0x16aab1=CAMPAIGN_STATUS[_0xf5bf('0x3c')];if(_0x29bf9e[_0xf5bf('0x2d')]===0x0&&_0x29bf9e[_0xf5bf('0x29')]===0x0&&_0x29bf9e[_0xf5bf('0x2b')]===0x0&&(_0x29bf9e[_0xf5bf('0x2a')]||0x0)===0x0){_0x16aab1=CAMPAIGN_STATUS['INACTIVE'];}return _0x16aab1;}exports[_0xf5bf('0x3e')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x3982fb){var _0x38666e=_0x3982fb[_0xf5bf('0x3f')](/"(.*?)"/);return _0x38666e?_0x38666e[0x1]:_0x3982fb;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x1cbed9,_0x2bbbdc,_0x5c8975){if(!_[_0xf5bf('0x40')](_0x5c8975)&&typeof _0x5c8975===_0xf5bf('0x41')&&!_[_0xf5bf('0x35')](_0x5c8975)){if(!_[_0xf5bf('0x40')](_0x2bbbdc)&&typeof _0x2bbbdc===_0xf5bf('0x41')&&!_[_0xf5bf('0x35')](_0x2bbbdc)){return util[_0xf5bf('0x42')](_0xf5bf('0x43'),_0x2bbbdc,_0x5c8975);}return util[_0xf5bf('0x42')](_0xf5bf('0x43'),_0x5c8975,_0x5c8975);}if(!_['isUndefined'](_0x1cbed9)&&typeof _0x1cbed9===_0xf5bf('0x41')&&!_[_0xf5bf('0x35')](_0x1cbed9)){return _0x1cbed9;}return'\x22\x22\x20<>';}exports[_0xf5bf('0x44')]=getCallerId;function getCallerIdRandom(_0x2e109f,_0x1a691a){var _0x12b9c3;var _0xa6f9e0;var _0x20db91;if(_0x1a691a<=0x0){_0x1a691a=0x1;}_0x12b9c3=new RegExp('\x5cw{0,'+_0x1a691a+'}$');_0xa6f9e0=Math['pow'](0xa,_0x1a691a-0x1);_0x20db91=Math[_0xf5bf('0x45')](0xa,_0x1a691a)-0x1;return util[_0xf5bf('0x42')]('%s',_[_0xf5bf('0x46')](_0x2e109f,_0x12b9c3,_[_0xf5bf('0x47')](_0xa6f9e0,_0x20db91)[_0xf5bf('0x48')]()));}exports[_0xf5bf('0x49')]=getCallerIdRandom;function decrementOriginate(_0xfe3d85){if(_0xfe3d85[_0xf5bf('0x2d')]&&_0xfe3d85[_0xf5bf('0x2d')]>0x0){_0xfe3d85[_0xf5bf('0x2d')]-=0x1;}else{logger['error'](_0xf5bf('0x4a'));}}exports[_0xf5bf('0x4b')]=decrementOriginate;function checkContactEmpty(_0x62775){return _0x62775&&_0x62775[_0xf5bf('0x4c')]>0x0;}exports[_0xf5bf('0x4d')]=checkContactEmpty;function erlangb(_0x1cff3f,_0x441015){if(_0x441015===0x0){return 0x0;}var _0x292929=0x1;for(var _0x2b5202=0x1;_0x2b5202<=_0x441015;_0x2b5202+=0x1){_0x292929=0x1+_0x292929*_0x2b5202/_0x1cff3f;}return 0x1/_0x292929;}exports[_0xf5bf('0x4e')]=erlangb;function checkContactLowerLimitOriginate(_0x3362aa,_0x4cc27e,_0x57c673){if(_0x4cc27e>_0x57c673){for(var _0x39c80b=0x0;_0x39c80b<_0x4cc27e-_0x57c673;_0x39c80b+=0x1){decrementOriginate(_0x3362aa);}}}exports[_0xf5bf('0x4f')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x3a7a9b){var _0x49a6c3={};var _0x3980ec=['id',_0xf5bf('0x50'),'description',_0xf5bf('0x51'),'updatedAt'];if(_0x3a7a9b){for(var _0x5f4ba2 in _0x3a7a9b){if(typeof _0x3a7a9b[_0x5f4ba2]!==_0xf5bf('0x52')){if(!_[_0xf5bf('0x31')](_0x3a7a9b[_0x5f4ba2])&&!_0x3980ec[_0xf5bf('0x38')](_0x5f4ba2)){_0x49a6c3[util['format'](_0xf5bf('0x53'),_0xf5bf('0x54'),_0x5f4ba2[_0xf5bf('0x55')]())]=_0x3a7a9b[_0x5f4ba2];}}}}return _0x49a6c3;}exports[_0xf5bf('0x56')]=setXMDContactVariables; \ No newline at end of file +var _0x61e3=['%s%s','toUpperCase','setXMDContactVariables','lodash','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','milliseconds','diff','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','originated','Trunk','name','active','dialGlobalInterval','isNil','Interval','Intervals','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','includes','status','TrunkBackup','INACTIVE','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','DISACTIVED','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','getCallerId','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','description','tags','updatedAt'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0x61e3,0x1c5));var _0x361e=function(_0x8c642b,_0x5b822e){_0x8c642b=_0x8c642b-0x0;var _0x483870=_0x61e3[_0x8c642b];return _0x483870;};'use strict';var _=require(_0x361e('0x0'));var moment=require(_0x361e('0x1'));var util=require(_0x361e('0x2'));var logger=require(_0x361e('0x3'))(_0x361e('0x4'));var timezones=require(_0x361e('0x5'))[_0x361e('0x6')];var CAMPAIGN_STATUS={'ACTIVE':_0x361e('0x7'),'BLACKLIST':_0x361e('0x8'),'CONTACTS_RESCHEDULED':_0x361e('0x9'),'DEACTIVATED':_0x361e('0xa'),'DISACTIVED':_0x361e('0xb'),'EMPTY_INTERVAL':_0x361e('0xc'),'INACTIVE':_0x361e('0xd'),'NO_AGENTS_LOGGED':_0x361e('0xe'),'NO_AVAILABLE_CONTACTS':_0x361e('0xf'),'NULL_INTERVAL':_0x361e('0x10'),'OVERTIME_INTERVAL':_0x361e('0x11'),'OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':_0x361e('0x12'),'RECALL_TIMEOUT':_0x361e('0x13'),'RUNNING':'RUNNING','UNKNOWN_TIMEZONE':_0x361e('0x14'),'UNREACHABLE_TRUNK':_0x361e('0x15')};exports[_0x361e('0x16')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x530db9){return _0x530db9[_0x361e('0x17')]===_0x361e('0x18');}exports[_0x361e('0x19')]=isPreviewCampaign;function isIVRCampaign(_0x2d241e){return _0x2d241e[_0x361e('0x1a')]==='ivr';}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x487cb6){return _0x487cb6[_0x361e('0x1a')]===_0x361e('0x1b');}exports[_0x361e('0x1c')]=isOutboundQueue;function isQueueCampaignActive(_0x1e1c20){return _0x1e1c20[_0x361e('0x1d')];}exports[_0x361e('0x1e')]=isQueueCampaignActive;function isIVRCampaignActive(_0x540466){return _0x540466['active'];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x462850,_0x5889eb){var _0x476407=moment(_0x462850)['milliseconds'](0x0);var _0x3a4f14=moment(_0x5889eb)[_0x361e('0x1f')](0x0);return _0x476407[_0x361e('0x20')](_0x3a4f14,'seconds');}exports[_0x361e('0x21')]=getSeconds;function hasQueueCampaignDataChanged(_0x35b099,_0x4c3765){var _0x3b0525=![];var _0x237140=_0x35b099[_0x361e('0x17')]!==_0x4c3765['dialMethod']||_0x35b099[_0x361e('0x1d')]!==_0x4c3765[_0x361e('0x1d')]||_0x35b099[_0x361e('0x22')]!==_0x4c3765[_0x361e('0x22')];var _0x1e7e97=_0x35b099[_0x361e('0x23')]!==_0x4c3765['available']||_0x35b099[_0x361e('0x24')]!==_0x4c3765[_0x361e('0x24')]||_0x35b099[_0x361e('0x25')]!==_0x4c3765[_0x361e('0x25')]||_0x35b099[_0x361e('0x26')]!==_0x4c3765[_0x361e('0x26')]||_0x35b099[_0x361e('0x27')]!==_0x4c3765[_0x361e('0x27')]||_0x35b099[_0x361e('0x28')]!==_0x4c3765[_0x361e('0x28')]||_0x35b099[_0x361e('0x29')]!==_0x4c3765[_0x361e('0x29')]||_0x35b099['inUse']!==_0x4c3765['inUse']||_0x35b099[_0x361e('0x2a')]!==_0x4c3765[_0x361e('0x2a')];if(_0x35b099['Trunk']&&_0x4c3765[_0x361e('0x2b')]){_0x3b0525=_0x35b099['Trunk'][_0x361e('0x2c')]!==_0x4c3765[_0x361e('0x2b')][_0x361e('0x2c')]||_0x35b099[_0x361e('0x2b')][_0x361e('0x2d')]!==_0x4c3765[_0x361e('0x2b')][_0x361e('0x2d')];}return _0x237140||_0x1e7e97||_0x3b0525;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x4d102c){var _0x5bc9a7=null;var _0x4779fd=_0x4d102c['dialTimezone'];if(_['isNil'](_0x4d102c[_0x361e('0x2e')])||_[_0x361e('0x2f')](_0x4d102c['Interval'])||_['isNil'](_0x4d102c[_0x361e('0x30')][_0x361e('0x31')])){_0x5bc9a7=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_[_0x361e('0x32')](_0x4d102c[_0x361e('0x2e')])||_[_0x361e('0x32')](_0x4d102c['Interval']['Intervals'])){_0x5bc9a7=CAMPAIGN_STATUS[_0x361e('0x33')];}else if(_0x4779fd&&!timezones[_0x4779fd]){_0x5bc9a7=CAMPAIGN_STATUS[_0x361e('0x34')];}return _0x5bc9a7;}function checkAnyValidTrunk(_0x23aaaa,_0x26196e){var _0x3d4c9e=null;var _0x2b0b1e=_0x361e('0x35');var _0x34ef64=[_0x361e('0x36'),_0x361e('0x37')];var _0x51f381=!![];if(_0x23aaaa[_0x361e('0x2b')]&&_0x23aaaa[_0x361e('0x2b')]['active']){_0x2b0b1e+=_0x23aaaa['Trunk'][_0x361e('0x2c')];_0x3d4c9e=_0x26196e[_0x2b0b1e];_0x51f381=_0x34ef64[_0x361e('0x38')](_0x3d4c9e[_0x361e('0x39')]);}else if(_0x23aaaa['TrunkBackup']&&_0x23aaaa[_0x361e('0x3a')]['active']){_0x2b0b1e+=_0x23aaaa[_0x361e('0x3a')]['name'];_0x3d4c9e=_0x26196e[_0x2b0b1e];_0x51f381=_0x34ef64['includes'](_0x3d4c9e[_0x361e('0x39')]);}return _0x51f381;}function getQueueCampaignStatusMessage(_0x47c209,_0x318aa3){var _0xb4d297=CAMPAIGN_STATUS[_0x361e('0x7')];var _0x2b67b8=isPreviewCampaign(_0x47c209);if(!isQueueCampaignActive(_0x47c209)){if(_0x2b67b8){_0xb4d297=CAMPAIGN_STATUS[_0x361e('0x3b')];}else{if(_0x47c209[_0x361e('0x2a')]===0x0&&_0x47c209[_0x361e('0x27')]===0x0&&_0x47c209[_0x361e('0x29')]===0x0&&(_0x47c209['pTalking']||0x0)===0x0){_0xb4d297=CAMPAIGN_STATUS[_0x361e('0x3b')];}else{_0xb4d297=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x47c209['loggedIn']===0x0){_0xb4d297=CAMPAIGN_STATUS['NO_AGENTS_LOGGED'];}else if(!checkAnyValidTrunk(_0x47c209,_0x318aa3)){_0xb4d297=CAMPAIGN_STATUS[_0x361e('0x3c')];}else if(!isPreviewCampaign(_0x47c209)){var _0x28faba=checkAnyValidQueueCampaignInterval(_0x47c209);if(_0x28faba){_0xb4d297=_0x28faba;}}return _0xb4d297;}exports[_0x361e('0x3d')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x42641c){var _0x3f3c91=CAMPAIGN_STATUS[_0x361e('0x3e')];if(_0x42641c[_0x361e('0x2a')]===0x0&&_0x42641c[_0x361e('0x27')]===0x0&&_0x42641c[_0x361e('0x29')]===0x0&&(_0x42641c[_0x361e('0x28')]||0x0)===0x0){_0x3f3c91=CAMPAIGN_STATUS['INACTIVE'];}return _0x3f3c91;}exports[_0x361e('0x3f')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x298f75){var _0x15892b=_0x298f75[_0x361e('0x40')](/"(.*?)"/);return _0x15892b?_0x15892b[0x1]:_0x298f75;}exports[_0x361e('0x41')]=extractCalleridName;function getCallerId(_0x5dafdd,_0x191eb6,_0x769e9f){if(!_[_0x361e('0x42')](_0x769e9f)&&typeof _0x769e9f==='string'&&!_['isEmpty'](_0x769e9f)){if(!_[_0x361e('0x42')](_0x191eb6)&&typeof _0x191eb6===_0x361e('0x43')&&!_[_0x361e('0x32')](_0x191eb6)){return util[_0x361e('0x44')](_0x361e('0x45'),_0x191eb6,_0x769e9f);}return util[_0x361e('0x44')](_0x361e('0x45'),_0x769e9f,_0x769e9f);}if(!_['isUndefined'](_0x5dafdd)&&typeof _0x5dafdd===_0x361e('0x43')&&!_[_0x361e('0x32')](_0x5dafdd)){return _0x5dafdd;}return'\x22\x22\x20<>';}exports[_0x361e('0x46')]=getCallerId;function getCallerIdRandom(_0x1a7a84,_0x3f6b19){var _0x40b44b;var _0x12230e;var _0x554bba;if(_0x3f6b19<=0x0){_0x3f6b19=0x1;}_0x40b44b=new RegExp(_0x361e('0x47')+_0x3f6b19+'}$');_0x12230e=Math[_0x361e('0x48')](0xa,_0x3f6b19-0x1);_0x554bba=Math[_0x361e('0x48')](0xa,_0x3f6b19)-0x1;return util[_0x361e('0x44')]('%s',_[_0x361e('0x49')](_0x1a7a84,_0x40b44b,_[_0x361e('0x4a')](_0x12230e,_0x554bba)[_0x361e('0x4b')]()));}exports[_0x361e('0x4c')]=getCallerIdRandom;function decrementOriginate(_0x31d8f){if(_0x31d8f[_0x361e('0x2a')]&&_0x31d8f['originated']>0x0){_0x31d8f['originated']-=0x1;}else{logger[_0x361e('0x4d')](_0x361e('0x4e'));}}exports[_0x361e('0x4f')]=decrementOriginate;function checkContactEmpty(_0x28ed36){return _0x28ed36&&_0x28ed36['length']>0x0;}exports[_0x361e('0x50')]=checkContactEmpty;function erlangb(_0x354ea2,_0x28211a){if(_0x28211a===0x0){return 0x0;}var _0x21b0f8=0x1;for(var _0x35fc2f=0x1;_0x35fc2f<=_0x28211a;_0x35fc2f+=0x1){_0x21b0f8=0x1+_0x21b0f8*_0x35fc2f/_0x354ea2;}return 0x1/_0x21b0f8;}exports[_0x361e('0x51')]=erlangb;function checkContactLowerLimitOriginate(_0x1b9813,_0x41dc73,_0x3b2ad6){if(_0x41dc73>_0x3b2ad6){for(var _0xb99fd9=0x0;_0xb99fd9<_0x41dc73-_0x3b2ad6;_0xb99fd9+=0x1){decrementOriginate(_0x1b9813);}}}exports[_0x361e('0x52')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0xd80912){var _0x5e9ebc={};var _0x36df99=['id',_0x361e('0x53'),_0x361e('0x54'),_0x361e('0x55'),_0x361e('0x56')];if(_0xd80912){for(var _0x2a4705 in _0xd80912){if(typeof _0xd80912[_0x2a4705]!=='undefined'){if(!_[_0x361e('0x2f')](_0xd80912[_0x2a4705])&&!_0x36df99[_0x361e('0x38')](_0x2a4705)){_0x5e9ebc[util['format'](_0x361e('0x57'),'XMD-',_0x2a4705[_0x361e('0x58')]())]=_0xd80912[_0x2a4705];}}}}return _0x5e9ebc;}exports[_0x361e('0x59')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 1a78ae5..0878409 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(_0x365917,_0x545bcc){var _0x20f7a0=function(_0x31965e){while(--_0x31965e){_0x365917['push'](_0x365917['shift']());}};_0x20f7a0(++_0x545bcc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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(_0x32a3a6,_0x27dde5){var _0x4133cf=function(_0x568860){while(--_0x568860){_0x32a3a6['push'](_0x32a3a6['shift']());}};_0x4133cf(++_0x27dde5);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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 4f6d224..cfe1e41 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 _0xe14f=['path','./util/gs','fax','../ami','./rpcDb','./util/util','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncOriginateResponse','prototype','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','actions','variable','hasOwnProperty','value','channelstate','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','parse','.pdf','catch','error','\x20notify\x20','\x20receiveFax\x20','stringify','merge','response','reason','update','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','updateStatus','then','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','Trunk','isValid','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','%s/%s.tif','dir','XMF-PATH','variablesAction','Action','addVariables','ext','isTrunkReachable','isNil','active','format','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','util','lodash','bluebird','uuid','moment'];(function(_0x4b763b,_0x579baa){var _0x1f4ef3=function(_0x57eea5){while(--_0x57eea5){_0x4b763b['push'](_0x4b763b['shift']());}};_0x1f4ef3(++_0x579baa);}(_0xe14f,0xdf));var _0xfe14=function(_0x427f99,_0x5915a8){_0x427f99=_0x427f99-0x0;var _0xe65cec=_0xe14f[_0x427f99];return _0xe65cec;};'use strict';var util=require(_0xfe14('0x0'));var _=require(_0xfe14('0x1'));var BPromise=require(_0xfe14('0x2'));var uuid=require(_0xfe14('0x3'));var moment=require(_0xfe14('0x4'));var path=require(_0xfe14('0x5'));var tiff2pdf=require('tiff2pdf');var gs=require(_0xfe14('0x6'));var logger=require('../../../config/logger')(_0xfe14('0x7'));var ami=require(_0xfe14('0x8'));var rpcDb=require(_0xfe14('0x9'));var Channel=require('./channel');var ut=require(_0xfe14('0xa'));var Action=require('./action');var faxAccount=require(_0xfe14('0xb'));var attachment=require(_0xfe14('0xc'));var faxMessage=require(_0xfe14('0xd'));function Fax(_0x4d5ff0){this[_0xfe14('0xe')]={};this[_0xfe14('0xf')]=_0x4d5ff0['faxAccounts'];this['trunks']=_0x4d5ff0[_0xfe14('0x10')];this['actions']={};ami['on'](_0xfe14('0x11'),this[_0xfe14('0x12')][_0xfe14('0x13')](this));ami['on'](_0xfe14('0x14'),this[_0xfe14('0x15')]['bind'](this));ami['on'](_0xfe14('0x16'),this[_0xfe14('0x17')][_0xfe14('0x13')](this));ami['on'](_0xfe14('0x18'),this[_0xfe14('0x19')][_0xfe14('0x13')](this));ami['on'](_0xfe14('0x1a'),this[_0xfe14('0x1b')][_0xfe14('0x13')](this));ami['on'](_0xfe14('0x1c'),this[_0xfe14('0x1d')]['bind'](this));ami['on'](_0xfe14('0x1e'),this['syncHangup'][_0xfe14('0x13')](this));ami['on']('originateresponse',this[_0xfe14('0x1f')][_0xfe14('0x13')](this));}Fax[_0xfe14('0x20')][_0xfe14('0x12')]=function(_0xa0c41e){if(_0xa0c41e['context']==='from-voip-provider'){for(var _0x575362 in this['faxAccounts']){if(this['faxAccounts']['hasOwnProperty'](_0x575362)){if(_0xa0c41e['exten']===this[_0xfe14('0xf')][_0x575362][_0xfe14('0x21')]){this[_0xfe14('0xe')][_0xa0c41e[_0xfe14('0x22')]]={};this['channels'][_0xa0c41e[_0xfe14('0x22')]][_0xfe14('0x23')]=_0xa0c41e[_0xfe14('0x23')];this[_0xfe14('0xe')][_0xa0c41e[_0xfe14('0x22')]]['id']=this[_0xfe14('0xf')][_0x575362]['id'];this[_0xfe14('0xe')][_0xa0c41e[_0xfe14('0x22')]]['name']=this[_0xfe14('0xf')][_0x575362][_0xfe14('0x24')];logger[_0xfe14('0x25')](_0xa0c41e[_0xfe14('0x22')],_0xfe14('0x26'));}}}}if(this[_0xfe14('0x27')][_0xa0c41e[_0xfe14('0x22')]]){this['channels'][_0xa0c41e[_0xfe14('0x22')]]={};this['channels'][_0xa0c41e['uniqueid']][_0xfe14('0x23')]=_0xa0c41e[_0xfe14('0x23')];logger[_0xfe14('0x25')](_0xa0c41e[_0xfe14('0x22')],_0xfe14('0x26'));}};Fax[_0xfe14('0x20')][_0xfe14('0x15')]=function(_0x5e0f0a){if(this[_0xfe14('0xe')][_0x5e0f0a['uniqueid']]){for(var _0x9da29f in _0x5e0f0a['variable']){if(_0x5e0f0a[_0xfe14('0x28')][_0xfe14('0x29')](_0x9da29f)){this[_0xfe14('0xe')][_0x5e0f0a[_0xfe14('0x22')]][_0x9da29f]=_0x5e0f0a[_0xfe14('0x2a')];}}}};Fax[_0xfe14('0x20')][_0xfe14('0x17')]=function(_0x37d2f){if(this['channels'][_0x37d2f['uniqueid']]){this[_0xfe14('0xe')][_0x37d2f[_0xfe14('0x22')]][_0xfe14('0x2b')]=_0x37d2f['channelstate'];this[_0xfe14('0xe')][_0x37d2f[_0xfe14('0x22')]]['channelstatedesc']=_0x37d2f['channelstatedesc'];}};Fax[_0xfe14('0x20')]['syncNewExten']=function(_0xe1ddb0){if(this[_0xfe14('0xe')][_0xe1ddb0[_0xfe14('0x22')]]){for(var _0x5e8c2c in _0xe1ddb0[_0xfe14('0x28')]){if(_0xe1ddb0[_0xfe14('0x28')][_0xfe14('0x29')](_0x5e8c2c)){this[_0xfe14('0xe')][_0xe1ddb0['uniqueid']][_0x5e8c2c]=_0xe1ddb0[_0xfe14('0x2a')];}}}};Fax[_0xfe14('0x20')][_0xfe14('0x1b')]=function(_0x1eaa69){if(this[_0xfe14('0xe')][_0x1eaa69[_0xfe14('0x22')]]){this[_0xfe14('0xe')][_0x1eaa69['uniqueid']][_0xfe14('0x2c')]=_0x1eaa69[_0xfe14('0x2c')];this['channels'][_0x1eaa69['uniqueid']]['status']=_0x1eaa69[_0xfe14('0x2d')];this[_0xfe14('0xe')][_0x1eaa69['uniqueid']][_0xfe14('0x21')]=_0x1eaa69[_0xfe14('0x21')];this[_0xfe14('0xe')][_0x1eaa69['uniqueid']]['filename']=_0x1eaa69[_0xfe14('0x2e')];logger[_0xfe14('0x25')](_0x1eaa69[_0xfe14('0x22')],_0xfe14('0x2f'));}};Fax['prototype'][_0xfe14('0x1d')]=function(_0x41e3f1){var _0x2c5beb=this;if(this['channels'][_0x41e3f1[_0xfe14('0x22')]]){var _0x2fa52f=this[_0xfe14('0xe')][_0x41e3f1[_0xfe14('0x22')]]['id'];this[_0xfe14('0xe')][_0x41e3f1[_0xfe14('0x22')]][_0xfe14('0x30')]=_0x41e3f1[_0xfe14('0x30')];this[_0xfe14('0xe')][_0x41e3f1[_0xfe14('0x22')]][_0xfe14('0x31')]=_0x41e3f1[_0xfe14('0x31')];this['channels'][_0x41e3f1[_0xfe14('0x22')]][_0xfe14('0x21')]=_0x41e3f1[_0xfe14('0x21')];this[_0xfe14('0xe')][_0x41e3f1[_0xfe14('0x22')]][_0xfe14('0x32')]=_0x41e3f1[_0xfe14('0x32')];this['channels'][_0x41e3f1['uniqueid']]['transferrate']=_0x41e3f1[_0xfe14('0x33')];this[_0xfe14('0xe')][_0x41e3f1[_0xfe14('0x22')]][_0xfe14('0x2e')]=_0x41e3f1['filename'];this[_0xfe14('0xe')][_0x41e3f1[_0xfe14('0x22')]][_0xfe14('0x34')]=_0x41e3f1[_0xfe14('0x34')];if(this[_0xfe14('0xe')][_0x41e3f1[_0xfe14('0x22')]]['pagestransferred']>0x0){tiff2pdf(_0x41e3f1[_0xfe14('0x2e')],_0xfe14('0x35'),function(_0x2f8411){logger['info'](_0x41e3f1[_0xfe14('0x22')],'\x20result\x20conversion\x20file\x20',_0x2f8411['message']);attachment['create']({'name':path[_0xfe14('0x36')](_0x41e3f1[_0xfe14('0x2e')])[_0xfe14('0x24')],'basename':path[_0xfe14('0x36')](_0x41e3f1[_0xfe14('0x2e')])[_0xfe14('0x24')]+_0xfe14('0x37'),'type':'application/pdf'})['then'](function(_0x17fa72){faxAccount['notify'](_0x2fa52f,{'from':_0x41e3f1[_0xfe14('0x34')],'mapKey':_0xfe14('0x7'),'body':path[_0xfe14('0x36')](_0x41e3f1['filename'])['name']+_0xfe14('0x37'),'AttachmentId':_0x17fa72['id']})[_0xfe14('0x38')](function(_0x292a40){logger[_0xfe14('0x39')](_0x41e3f1[_0xfe14('0x22')],_0xfe14('0x3a'),JSON['stringify'](_0x292a40));});})[_0xfe14('0x38')](function(_0x3a0086){logger['error'](_0x41e3f1[_0xfe14('0x22')],_0xfe14('0x3b'),JSON[_0xfe14('0x3c')](_0x3a0086));});});}logger[_0xfe14('0x25')](_0x41e3f1[_0xfe14('0x22')],_0xfe14('0x3b'));}};Fax[_0xfe14('0x20')][_0xfe14('0x1f')]=function(_0x43ce78){if(this[_0xfe14('0x27')][_0x43ce78[_0xfe14('0x22')]]){_[_0xfe14('0x3d')](this[_0xfe14('0xe')][_0x43ce78[_0xfe14('0x22')]],_['pick'](_0x43ce78,[_0xfe14('0x3e'),_0xfe14('0x3f')]));}};function updateStatus(_0x35a6d2){if(_0x35a6d2['AttachmentId']){faxMessage[_0xfe14('0x40')](_0x35a6d2[_0xfe14('0x41')],{'failMessage':_0xfe14('0x42')})['then'](function(_0x23c897){ut[_0xfe14('0x43')](_0xfe14('0x44'),_0x23c897);})['catch'](function(_0x24ecb4){ut[_0xfe14('0x43')](_0xfe14('0x45'),_0x24ecb4);});}else{ut[_0xfe14('0x43')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0xfe14('0x20')][_0xfe14('0x46')]=function(_0x50ef37,_0x4b47ea,_0x44ec3c){var _0x40f437=this;var _0x477018={};if(_0x4b47ea){_0x477018={'read':_0x4b47ea};}else{_0x477018={'failMessage':_0x44ec3c};}if(this[_0xfe14('0x27')][_0x50ef37]['AttachmentId']){faxMessage[_0xfe14('0x40')](this['actions'][_0x50ef37][_0xfe14('0x41')],_0x477018)[_0xfe14('0x47')](function(_0x538b36){ut['logger'](_0xfe14('0x48'),_0x538b36);})['catch'](function(_0xc7a491){ut['logger']('[Fax][Message][NoUpdate1]',_0xc7a491);})[_0xfe14('0x49')](function(){delete _0x40f437['channels'][_0x50ef37];delete _0x40f437[_0xfe14('0x27')][_0x50ef37];});}else{ut[_0xfe14('0x43')](_0xfe14('0x4a'));delete this[_0xfe14('0xe')][_0x50ef37];delete this['actions'][_0x50ef37];}};Fax[_0xfe14('0x20')]['syncHangup']=function(_0x4709ba){var _0x3306e9=this;if(this[_0xfe14('0xe')][_0x4709ba['uniqueid']]){if(this[_0xfe14('0x27')][_0x4709ba[_0xfe14('0x22')]]){this[_0xfe14('0xe')][_0x4709ba['uniqueid']]['id']=this[_0xfe14('0x27')][_0x4709ba['uniqueid']]['id'];this['channels'][_0x4709ba[_0xfe14('0x22')]][_0xfe14('0x24')]=this['actions'][_0x4709ba['uniqueid']][_0xfe14('0x24')];}logger[_0xfe14('0x25')](_0x4709ba[_0xfe14('0x22')],this[_0xfe14('0x27')][_0x4709ba[_0xfe14('0x22')]]?_0xfe14('0x4b'):_0xfe14('0x4c'),JSON['stringify'](this['channels'][_0x4709ba[_0xfe14('0x22')]]));if(this[_0xfe14('0x27')][_0x4709ba['uniqueid']]){if(this[_0xfe14('0xe')][_0x4709ba[_0xfe14('0x22')]][_0xfe14('0x4d')]>0x0&&this[_0xfe14('0xe')][_0x4709ba[_0xfe14('0x22')]]['faxstatus']===_0xfe14('0x4e')){this[_0xfe14('0x46')](_0x4709ba[_0xfe14('0x22')],!![]);}else{this[_0xfe14('0x46')](_0x4709ba[_0xfe14('0x22')],![],this[_0xfe14('0xe')][_0x4709ba[_0xfe14('0x22')]][_0xfe14('0x4f')]?_0xfe14('0x50')+this[_0xfe14('0xe')][_0x4709ba[_0xfe14('0x22')]][_0xfe14('0x4f')]:_0xfe14('0x51'));}}}};Fax[_0xfe14('0x20')][_0xfe14('0x52')]=function(_0x2ddf82){var _0x5484de=this;return new BPromise(function(_0x486689,_0x594f1e){_0x5484de[_0xfe14('0x53')](_0x2ddf82,_0x5484de['faxAccounts'][_0x2ddf82[_0xfe14('0x54')]])[_0xfe14('0x47')](function(_0x5a7e0b){ut[_0xfe14('0x43')](_0xfe14('0x55'),_0x5a7e0b);_0x486689(ut[_0xfe14('0x56')](_0xfe14('0x57')));})[_0xfe14('0x38')](function(_0xaa46c3){ut[_0xfe14('0x43')](_0xfe14('0x58'),_0xaa46c3);updateStatus(_0x2ddf82);_0x594f1e(ut[_0xfe14('0x56')](_0xfe14('0x59')));});});};Fax[_0xfe14('0x20')][_0xfe14('0x5a')]=function(_0x52fdd9){var _0x27938a=this;return new BPromise(function(_0x5ad3c1,_0x3702a2){var _0x513678=_0x27938a['checkTrunk'](_0x27938a['faxAccounts'][_0x52fdd9[_0xfe14('0x54')]][_0xfe14('0x5b')],_0x52fdd9);if(_0x513678[_0xfe14('0x5c')]){_0x5ad3c1(ut[_0xfe14('0x56')]('Trunk\x20Reachable'));}else{_0x3702a2(ut[_0xfe14('0x56')](_0x513678[_0xfe14('0x56')]));}});};function originate(_0x18fe9c,_0x231c00,_0x59cb5c){return new BPromise(function(_0x272e42,_0xbe755c){if(_0x59cb5c){var _0x8ace98=util['format'](_0xfe14('0x5d'),path[_0xfe14('0x36')](_0x18fe9c[_0xfe14('0x5')])[_0xfe14('0x24')],_0x18fe9c[_0xfe14('0x5')]);gs['execute'](_0x8ace98)[_0xfe14('0x47')](function(){_0x18fe9c['path']=util['format'](_0xfe14('0x5e'),path[_0xfe14('0x36')](_0x18fe9c['path'])[_0xfe14('0x5f')],path[_0xfe14('0x36')](_0x18fe9c['path'])['name']);_0x231c00[_0xfe14('0x60')]=_0x18fe9c['path'];ut[_0xfe14('0x43')]('Convert\x20pdf\x20to\x20tif','');ami['Action'](ut[_0xfe14('0x61')](_0x18fe9c,_0x231c00))[_0xfe14('0x47')](function(_0x4c55ef){_0x272e42(_0x4c55ef);})[_0xfe14('0x38')](function(_0x29e55e){_0xbe755c(_0x29e55e);});})[_0xfe14('0x38')](function(_0x52a0fe){_0xbe755c(_0x52a0fe);});}else{ami[_0xfe14('0x62')](ut[_0xfe14('0x61')](_0x18fe9c,_0x231c00))['then'](function(_0x120027){_0x272e42(_0x120027);})[_0xfe14('0x38')](function(_0x579bb7){_0xbe755c(_0x579bb7);});}});}Fax[_0xfe14('0x20')][_0xfe14('0x53')]=function(_0x46ab32,_0x2ce00c){var _0xcbe2c0=this;return new BPromise(function(_0xd91d51,_0x5bd725){var _0x510853=uuid['v4']();var _0x2f6017=ut[_0xfe14('0x63')](_0x46ab32,_0x2ce00c);_0xcbe2c0['actions'][_0x510853]=new Action(_0x510853,_0x2ce00c,_0x46ab32);var _0x33097c=_0xcbe2c0[_0xfe14('0x27')][_0x510853];if(path['parse'](_0x46ab32[_0xfe14('0x5')])[_0xfe14('0x64')]===_0xfe14('0x37')){originate(_0x33097c,_0x2f6017,!![])[_0xfe14('0x47')](function(_0x46d3c7){_0xd91d51(_0x46d3c7);})[_0xfe14('0x38')](function(_0x29e238){_0x5bd725(_0x29e238);});}else{originate(_0x33097c,_0x2f6017,![])[_0xfe14('0x47')](function(_0x50bb92){_0xd91d51(_0x50bb92);})[_0xfe14('0x38')](function(_0x90b8c9){_0x5bd725(_0x90b8c9);});}});};Fax[_0xfe14('0x20')][_0xfe14('0x65')]=function(_0x53d655){return!_[_0xfe14('0x66')](_0x53d655)&&!_[_0xfe14('0x66')](_0x53d655[_0xfe14('0x24')])&&!_[_0xfe14('0x66')](_0x53d655[_0xfe14('0x67')])&&_0x53d655[_0xfe14('0x67')]&&!_[_0xfe14('0x66')](this[_0xfe14('0x10')][util[_0xfe14('0x68')](_0xfe14('0x69'),_0x53d655[_0xfe14('0x24')])])&&!_[_0xfe14('0x66')](this['trunks'][util['format'](_0xfe14('0x69'),_0x53d655['name'])][_0xfe14('0x2d')])&&(this[_0xfe14('0x10')][util['format']('SIP/%s',_0x53d655[_0xfe14('0x24')])][_0xfe14('0x2d')]===_0xfe14('0x6a')||this[_0xfe14('0x10')][util[_0xfe14('0x68')](_0xfe14('0x69'),_0x53d655[_0xfe14('0x24')])][_0xfe14('0x2d')]==='unmonitored');};Fax['prototype']['checkTrunk']=function(_0x11be97,_0x4a472e){if(!this[_0xfe14('0x65')](_0x11be97)){ut['logger'](_0xfe14('0x6b'),_[_0xfe14('0x66')](_0x11be97)?'':_0x11be97[_0xfe14('0x24')]+_0xfe14('0x6c'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_['isNil'](_0x4a472e[_0xfe14('0x7')])){ut[_0xfe14('0x43')](_0xfe14('0x6d'),JSON[_0xfe14('0x3c')](_0x4a472e));return{'isValid':![],'message':_0xfe14('0x6e')};}if(_[_0xfe14('0x66')](_0x4a472e[_0xfe14('0x5')])){ut[_0xfe14('0x43')](_0xfe14('0x6f'),JSON[_0xfe14('0x3c')](_0x4a472e));return{'isValid':![],'message':_0xfe14('0x70')};}return{'isValid':!![],'message':_0xfe14('0x71')};};module['exports']=Fax; \ No newline at end of file +var _0x3d48=['../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','syncNewchannel','bind','syncVarSet','newstate','syncNewState','syncNewExten','faxstatus','syncFaxStatus','syncReceiveFax','hangup','syncHangup','originateresponse','prototype','context','from-voip-provider','hasOwnProperty','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','notify','fax','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','reason','AttachmentId','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','updateStatus','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','exports','lodash','bluebird','moment','path','./util/gs','../ami','./channel','./action'];(function(_0x2d4661,_0x2da65c){var _0x42ed1e=function(_0x263c50){while(--_0x263c50){_0x2d4661['push'](_0x2d4661['shift']());}};_0x42ed1e(++_0x2da65c);}(_0x3d48,0x151));var _0x83d4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3d48[_0xa464c9];return _0x3d73c4;};'use strict';var util=require('util');var _=require(_0x83d4('0x0'));var BPromise=require(_0x83d4('0x1'));var uuid=require('uuid');var moment=require(_0x83d4('0x2'));var path=require(_0x83d4('0x3'));var tiff2pdf=require('tiff2pdf');var gs=require(_0x83d4('0x4'));var logger=require('../../../config/logger')('fax');var ami=require(_0x83d4('0x5'));var rpcDb=require('./rpcDb');var Channel=require(_0x83d4('0x6'));var ut=require('./util/util');var Action=require(_0x83d4('0x7'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x83d4('0x8'));var faxMessage=require(_0x83d4('0x9'));function Fax(_0x15d55f){this[_0x83d4('0xa')]={};this['faxAccounts']=_0x15d55f[_0x83d4('0xb')];this[_0x83d4('0xc')]=_0x15d55f[_0x83d4('0xc')];this[_0x83d4('0xd')]={};ami['on']('newchannel',this[_0x83d4('0xe')][_0x83d4('0xf')](this));ami['on']('varset',this[_0x83d4('0x10')]['bind'](this));ami['on'](_0x83d4('0x11'),this[_0x83d4('0x12')]['bind'](this));ami['on']('newexten',this[_0x83d4('0x13')][_0x83d4('0xf')](this));ami['on'](_0x83d4('0x14'),this[_0x83d4('0x15')][_0x83d4('0xf')](this));ami['on']('receivefax',this[_0x83d4('0x16')]['bind'](this));ami['on'](_0x83d4('0x17'),this[_0x83d4('0x18')]['bind'](this));ami['on'](_0x83d4('0x19'),this['syncOriginateResponse'][_0x83d4('0xf')](this));}Fax[_0x83d4('0x1a')]['syncNewchannel']=function(_0x4eef29){if(_0x4eef29[_0x83d4('0x1b')]===_0x83d4('0x1c')){for(var _0x14ea66 in this[_0x83d4('0xb')]){if(this['faxAccounts'][_0x83d4('0x1d')](_0x14ea66)){if(_0x4eef29['exten']===this[_0x83d4('0xb')][_0x14ea66][_0x83d4('0x1e')]){this[_0x83d4('0xa')][_0x4eef29[_0x83d4('0x1f')]]={};this[_0x83d4('0xa')][_0x4eef29[_0x83d4('0x1f')]]['channel']=_0x4eef29[_0x83d4('0x20')];this['channels'][_0x4eef29['uniqueid']]['id']=this[_0x83d4('0xb')][_0x14ea66]['id'];this['channels'][_0x4eef29[_0x83d4('0x1f')]][_0x83d4('0x21')]=this[_0x83d4('0xb')][_0x14ea66][_0x83d4('0x21')];logger[_0x83d4('0x22')](_0x4eef29[_0x83d4('0x1f')],_0x83d4('0x23'));}}}}if(this[_0x83d4('0xd')][_0x4eef29['uniqueid']]){this[_0x83d4('0xa')][_0x4eef29[_0x83d4('0x1f')]]={};this[_0x83d4('0xa')][_0x4eef29[_0x83d4('0x1f')]]['channel']=_0x4eef29[_0x83d4('0x20')];logger[_0x83d4('0x22')](_0x4eef29[_0x83d4('0x1f')],_0x83d4('0x23'));}};Fax[_0x83d4('0x1a')]['syncVarSet']=function(_0x55db39){if(this[_0x83d4('0xa')][_0x55db39[_0x83d4('0x1f')]]){for(var _0x41865f in _0x55db39[_0x83d4('0x24')]){if(_0x55db39[_0x83d4('0x24')][_0x83d4('0x1d')](_0x41865f)){this['channels'][_0x55db39[_0x83d4('0x1f')]][_0x41865f]=_0x55db39['value'];}}}};Fax[_0x83d4('0x1a')][_0x83d4('0x12')]=function(_0xc21d19){if(this[_0x83d4('0xa')][_0xc21d19[_0x83d4('0x1f')]]){this[_0x83d4('0xa')][_0xc21d19[_0x83d4('0x1f')]]['channelstate']=_0xc21d19[_0x83d4('0x25')];this[_0x83d4('0xa')][_0xc21d19['uniqueid']][_0x83d4('0x26')]=_0xc21d19[_0x83d4('0x26')];}};Fax[_0x83d4('0x1a')][_0x83d4('0x13')]=function(_0x584e9a){if(this['channels'][_0x584e9a[_0x83d4('0x1f')]]){for(var _0x6f3236 in _0x584e9a[_0x83d4('0x24')]){if(_0x584e9a['variable']['hasOwnProperty'](_0x6f3236)){this[_0x83d4('0xa')][_0x584e9a['uniqueid']][_0x6f3236]=_0x584e9a['value'];}}}};Fax[_0x83d4('0x1a')][_0x83d4('0x15')]=function(_0x247d4a){if(this[_0x83d4('0xa')][_0x247d4a['uniqueid']]){this[_0x83d4('0xa')][_0x247d4a['uniqueid']][_0x83d4('0x27')]=_0x247d4a[_0x83d4('0x27')];this['channels'][_0x247d4a[_0x83d4('0x1f')]]['status']=_0x247d4a[_0x83d4('0x28')];this['channels'][_0x247d4a[_0x83d4('0x1f')]][_0x83d4('0x1e')]=_0x247d4a['localstationid'];this[_0x83d4('0xa')][_0x247d4a['uniqueid']][_0x83d4('0x29')]=_0x247d4a[_0x83d4('0x29')];logger['info'](_0x247d4a[_0x83d4('0x1f')],_0x83d4('0x2a'));}};Fax[_0x83d4('0x1a')][_0x83d4('0x16')]=function(_0x4f4bd5){var _0x29cbb3=this;if(this['channels'][_0x4f4bd5[_0x83d4('0x1f')]]){var _0x42afc1=this[_0x83d4('0xa')][_0x4f4bd5[_0x83d4('0x1f')]]['id'];this[_0x83d4('0xa')][_0x4f4bd5[_0x83d4('0x1f')]][_0x83d4('0x2b')]=_0x4f4bd5[_0x83d4('0x2b')];this[_0x83d4('0xa')][_0x4f4bd5['uniqueid']][_0x83d4('0x2c')]=_0x4f4bd5[_0x83d4('0x2c')];this[_0x83d4('0xa')][_0x4f4bd5[_0x83d4('0x1f')]][_0x83d4('0x1e')]=_0x4f4bd5[_0x83d4('0x1e')];this['channels'][_0x4f4bd5['uniqueid']][_0x83d4('0x2d')]=_0x4f4bd5[_0x83d4('0x2d')];this[_0x83d4('0xa')][_0x4f4bd5['uniqueid']][_0x83d4('0x2e')]=_0x4f4bd5['transferrate'];this[_0x83d4('0xa')][_0x4f4bd5['uniqueid']][_0x83d4('0x29')]=_0x4f4bd5[_0x83d4('0x29')];this[_0x83d4('0xa')][_0x4f4bd5['uniqueid']][_0x83d4('0x2f')]=_0x4f4bd5['calleridnum'];if(this['channels'][_0x4f4bd5[_0x83d4('0x1f')]][_0x83d4('0x2c')]>0x0){tiff2pdf(_0x4f4bd5['filename'],_0x83d4('0x30'),function(_0x213b87){logger['info'](_0x4f4bd5[_0x83d4('0x1f')],_0x83d4('0x31'),_0x213b87[_0x83d4('0x32')]);attachment[_0x83d4('0x33')]({'name':path['parse'](_0x4f4bd5[_0x83d4('0x29')])[_0x83d4('0x21')],'basename':path[_0x83d4('0x34')](_0x4f4bd5[_0x83d4('0x29')])[_0x83d4('0x21')]+_0x83d4('0x35'),'type':_0x83d4('0x36')})['then'](function(_0x5c6519){faxAccount[_0x83d4('0x37')](_0x42afc1,{'from':_0x4f4bd5[_0x83d4('0x2f')],'mapKey':_0x83d4('0x38'),'body':path[_0x83d4('0x34')](_0x4f4bd5[_0x83d4('0x29')])[_0x83d4('0x21')]+_0x83d4('0x35'),'AttachmentId':_0x5c6519['id']})[_0x83d4('0x39')](function(_0x162c00){logger[_0x83d4('0x3a')](_0x4f4bd5[_0x83d4('0x1f')],_0x83d4('0x3b'),JSON[_0x83d4('0x3c')](_0x162c00));});})[_0x83d4('0x39')](function(_0x3b1f83){logger[_0x83d4('0x3a')](_0x4f4bd5['uniqueid'],'\x20receiveFax\x20',JSON['stringify'](_0x3b1f83));});});}logger[_0x83d4('0x22')](_0x4f4bd5[_0x83d4('0x1f')],_0x83d4('0x3d'));}};Fax['prototype'][_0x83d4('0x3e')]=function(_0x5a91bd){if(this[_0x83d4('0xd')][_0x5a91bd[_0x83d4('0x1f')]]){_[_0x83d4('0x3f')](this[_0x83d4('0xa')][_0x5a91bd['uniqueid']],_[_0x83d4('0x40')](_0x5a91bd,[_0x83d4('0x41'),_0x83d4('0x42')]));}};function updateStatus(_0x5bb0ab){if(_0x5bb0ab[_0x83d4('0x43')]){faxMessage['update'](_0x5bb0ab[_0x83d4('0x43')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x83d4('0x44')](function(_0x163032){ut[_0x83d4('0x45')](_0x83d4('0x46'),_0x163032);})['catch'](function(_0x131772){ut['logger'](_0x83d4('0x47'),_0x131772);});}else{ut[_0x83d4('0x45')]('[Fax][Message][Error][NoUpdate2]');}}Fax['prototype'][_0x83d4('0x48')]=function(_0x27a5a0,_0x471a84,_0x100613){var _0x1a8b47=this;var _0x37226e={};if(_0x471a84){_0x37226e={'read':_0x471a84};}else{_0x37226e={'failMessage':_0x100613};}if(this[_0x83d4('0xd')][_0x27a5a0][_0x83d4('0x43')]){faxMessage[_0x83d4('0x49')](this[_0x83d4('0xd')][_0x27a5a0][_0x83d4('0x43')],_0x37226e)[_0x83d4('0x44')](function(_0x47999c){ut['logger'](_0x83d4('0x4a'),_0x47999c);})[_0x83d4('0x39')](function(_0x2b9b15){ut['logger'](_0x83d4('0x4b'),_0x2b9b15);})[_0x83d4('0x4c')](function(){delete _0x1a8b47[_0x83d4('0xa')][_0x27a5a0];delete _0x1a8b47[_0x83d4('0xd')][_0x27a5a0];});}else{ut[_0x83d4('0x45')](_0x83d4('0x4d'));delete this[_0x83d4('0xa')][_0x27a5a0];delete this['actions'][_0x27a5a0];}};Fax[_0x83d4('0x1a')][_0x83d4('0x18')]=function(_0x5e08f1){var _0x289316=this;if(this[_0x83d4('0xa')][_0x5e08f1['uniqueid']]){if(this['actions'][_0x5e08f1[_0x83d4('0x1f')]]){this[_0x83d4('0xa')][_0x5e08f1[_0x83d4('0x1f')]]['id']=this['actions'][_0x5e08f1[_0x83d4('0x1f')]]['id'];this[_0x83d4('0xa')][_0x5e08f1[_0x83d4('0x1f')]][_0x83d4('0x21')]=this[_0x83d4('0xd')][_0x5e08f1['uniqueid']][_0x83d4('0x21')];}logger[_0x83d4('0x22')](_0x5e08f1[_0x83d4('0x1f')],this['actions'][_0x5e08f1[_0x83d4('0x1f')]]?'\x20hangup\x20sendFile\x20':_0x83d4('0x4e'),JSON[_0x83d4('0x3c')](this[_0x83d4('0xa')][_0x5e08f1['uniqueid']]));if(this['actions'][_0x5e08f1[_0x83d4('0x1f')]]){if(this[_0x83d4('0xa')][_0x5e08f1['uniqueid']]['faxpages']>0x0&&this[_0x83d4('0xa')][_0x5e08f1[_0x83d4('0x1f')]][_0x83d4('0x14')]===_0x83d4('0x4f')){this['updateStatus'](_0x5e08f1[_0x83d4('0x1f')],!![]);}else{this[_0x83d4('0x48')](_0x5e08f1[_0x83d4('0x1f')],![],this[_0x83d4('0xa')][_0x5e08f1['uniqueid']][_0x83d4('0x50')]?'SENDING\x20FAILED:\x20'+this[_0x83d4('0xa')][_0x5e08f1[_0x83d4('0x1f')]]['faxstatusstring']:_0x83d4('0x51'));}}}};Fax[_0x83d4('0x1a')][_0x83d4('0x52')]=function(_0x3449e1){var _0x481cc3=this;return new BPromise(function(_0x14608e,_0x2d8558){_0x481cc3[_0x83d4('0x53')](_0x3449e1,_0x481cc3[_0x83d4('0xb')][_0x3449e1[_0x83d4('0x54')]])[_0x83d4('0x44')](function(_0x473aa6){ut['logger'](_0x83d4('0x55'),_0x473aa6);_0x14608e(ut[_0x83d4('0x32')](_0x83d4('0x56')));})[_0x83d4('0x39')](function(_0x44f565){ut[_0x83d4('0x45')](_0x83d4('0x57'),_0x44f565);updateStatus(_0x3449e1);_0x2d8558(ut[_0x83d4('0x32')](_0x83d4('0x58')));});});};Fax[_0x83d4('0x1a')][_0x83d4('0x59')]=function(_0x491775){var _0x325397=this;return new BPromise(function(_0xd3a13c,_0x49ad06){var _0xf9d48c=_0x325397['checkTrunk'](_0x325397[_0x83d4('0xb')][_0x491775[_0x83d4('0x54')]][_0x83d4('0x5a')],_0x491775);if(_0xf9d48c[_0x83d4('0x5b')]){_0xd3a13c(ut['message'](_0x83d4('0x5c')));}else{_0x49ad06(ut[_0x83d4('0x32')](_0xf9d48c[_0x83d4('0x32')]));}});};function originate(_0x3ba5a7,_0x57db4a,_0x25d769){return new BPromise(function(_0x10fc6b,_0x1c11ac){if(_0x25d769){var _0x1818ac=util[_0x83d4('0x5d')](_0x83d4('0x5e'),path['parse'](_0x3ba5a7[_0x83d4('0x3')])['name'],_0x3ba5a7[_0x83d4('0x3')]);gs[_0x83d4('0x5f')](_0x1818ac)[_0x83d4('0x44')](function(){_0x3ba5a7[_0x83d4('0x3')]=util[_0x83d4('0x5d')](_0x83d4('0x60'),path[_0x83d4('0x34')](_0x3ba5a7['path'])['dir'],path[_0x83d4('0x34')](_0x3ba5a7[_0x83d4('0x3')])[_0x83d4('0x21')]);_0x57db4a['XMF-PATH']=_0x3ba5a7[_0x83d4('0x3')];ut[_0x83d4('0x45')](_0x83d4('0x61'),'');ami[_0x83d4('0x62')](ut[_0x83d4('0x63')](_0x3ba5a7,_0x57db4a))[_0x83d4('0x44')](function(_0x7e1789){_0x10fc6b(_0x7e1789);})['catch'](function(_0x179068){_0x1c11ac(_0x179068);});})[_0x83d4('0x39')](function(_0x59209f){_0x1c11ac(_0x59209f);});}else{ami[_0x83d4('0x62')](ut[_0x83d4('0x63')](_0x3ba5a7,_0x57db4a))[_0x83d4('0x44')](function(_0x46c64d){_0x10fc6b(_0x46c64d);})[_0x83d4('0x39')](function(_0x34d5a){_0x1c11ac(_0x34d5a);});}});}Fax[_0x83d4('0x1a')][_0x83d4('0x53')]=function(_0x5c2f68,_0x191ccc){var _0xc7f152=this;return new BPromise(function(_0x3bc3d1,_0x31b920){var _0x58b9fc=uuid['v4']();var _0x4cba19=ut[_0x83d4('0x64')](_0x5c2f68,_0x191ccc);_0xc7f152[_0x83d4('0xd')][_0x58b9fc]=new Action(_0x58b9fc,_0x191ccc,_0x5c2f68);var _0x49362a=_0xc7f152[_0x83d4('0xd')][_0x58b9fc];if(path[_0x83d4('0x34')](_0x5c2f68[_0x83d4('0x3')])[_0x83d4('0x65')]===_0x83d4('0x35')){originate(_0x49362a,_0x4cba19,!![])[_0x83d4('0x44')](function(_0x345d33){_0x3bc3d1(_0x345d33);})[_0x83d4('0x39')](function(_0x42fd2c){_0x31b920(_0x42fd2c);});}else{originate(_0x49362a,_0x4cba19,![])['then'](function(_0x288cb2){_0x3bc3d1(_0x288cb2);})[_0x83d4('0x39')](function(_0x4bd2e1){_0x31b920(_0x4bd2e1);});}});};Fax[_0x83d4('0x1a')][_0x83d4('0x66')]=function(_0x4631ae){return!_[_0x83d4('0x67')](_0x4631ae)&&!_[_0x83d4('0x67')](_0x4631ae[_0x83d4('0x21')])&&!_[_0x83d4('0x67')](_0x4631ae['active'])&&_0x4631ae[_0x83d4('0x68')]&&!_[_0x83d4('0x67')](this[_0x83d4('0xc')][util['format'](_0x83d4('0x69'),_0x4631ae['name'])])&&!_['isNil'](this[_0x83d4('0xc')][util['format'](_0x83d4('0x69'),_0x4631ae[_0x83d4('0x21')])]['status'])&&(this[_0x83d4('0xc')][util['format'](_0x83d4('0x69'),_0x4631ae[_0x83d4('0x21')])][_0x83d4('0x28')]===_0x83d4('0x6a')||this[_0x83d4('0xc')][util['format'](_0x83d4('0x69'),_0x4631ae[_0x83d4('0x21')])]['status']===_0x83d4('0x6b'));};Fax['prototype']['checkTrunk']=function(_0x585aef,_0x50e6ab){if(!this[_0x83d4('0x66')](_0x585aef)){ut['logger'](_0x83d4('0x6c'),_[_0x83d4('0x67')](_0x585aef)?'':_0x585aef[_0x83d4('0x21')]+_0x83d4('0x6d'));return{'isValid':![],'message':_0x83d4('0x6e')};}if(_[_0x83d4('0x67')](_0x50e6ab[_0x83d4('0x38')])){ut[_0x83d4('0x45')](_0x83d4('0x6f'),JSON[_0x83d4('0x3c')](_0x50e6ab));return{'isValid':![],'message':_0x83d4('0x70')};}if(_[_0x83d4('0x67')](_0x50e6ab[_0x83d4('0x3')])){ut[_0x83d4('0x45')](_0x83d4('0x71'),JSON[_0x83d4('0x3c')](_0x50e6ab));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x83d4('0x72')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index b4955f8..4c38757 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 _0xa5dc=['[Notify]\x20','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','notify','then','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa5dc,0x169));var _0xca5d=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0xa5dc[_0x3c8e9a];return _0x2d4c57;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0xca5d('0x0'))(_0xca5d('0x1'));var _=require(_0xca5d('0x2'));var faxAccount=require(_0xca5d('0x3'));function loggerCatch(_0x316f68){return function(_0xfad042){logger[_0xca5d('0x4')](_0x316f68,util[_0xca5d('0x5')](_0xfad042,{'showHidden':![],'depth':null}));};}exports[_0xca5d('0x6')]=function(_0x49a360,_0x112e96){return BPromise['resolve']()[_0xca5d('0x7')](faxAccount[_0xca5d('0x6')](_0x49a360,_0x112e96))[_0xca5d('0x8')](loggerCatch(_0xca5d('0x9')));}; \ No newline at end of file +var _0xf1a8=['notify','catch','[Notify]\x20','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','resolve','then'];(function(_0x10d66f,_0x492453){var _0x410c1d=function(_0x802237){while(--_0x802237){_0x10d66f['push'](_0x10d66f['shift']());}};_0x410c1d(++_0x492453);}(_0xf1a8,0x147));var _0x8f1a=function(_0x1a670a,_0x379766){_0x1a670a=_0x1a670a-0x0;var _0x5c2c26=_0xf1a8[_0x1a670a];return _0x5c2c26;};'use strict';var util=require('util');var BPromise=require(_0x8f1a('0x0'));var logger=require(_0x8f1a('0x1'))(_0x8f1a('0x2'));var _=require(_0x8f1a('0x3'));var faxAccount=require(_0x8f1a('0x4'));function loggerCatch(_0x308673){return function(_0x30202b){logger[_0x8f1a('0x5')](_0x308673,util[_0x8f1a('0x6')](_0x30202b,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x38e054,_0x1c1576){return BPromise[_0x8f1a('0x7')]()[_0x8f1a('0x8')](faxAccount[_0x8f1a('0x9')](_0x38e054,_0x1c1576))[_0x8f1a('0xa')](loggerCatch(_0x8f1a('0xb')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 60255b5..ba70184 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 _0x589f=['info','Exec\x20gs','\x20Error\x20:','util','fax','child_process','exec','execute'];(function(_0x29e35f,_0x4859ef){var _0x266b74=function(_0xc09e1){while(--_0xc09e1){_0x29e35f['push'](_0x29e35f['shift']());}};_0x266b74(++_0x4859ef);}(_0x589f,0x13b));var _0xf589=function(_0x21a7aa,_0x2248dc){_0x21a7aa=_0x21a7aa-0x0;var _0x20c622=_0x589f[_0x21a7aa];return _0x20c622;};'use strict';var util=require(_0xf589('0x0'));var logger=require('../../../../config/logger')(_0xf589('0x1'));var BPromise=require('bluebird');var exec=require(_0xf589('0x2'))[_0xf589('0x3')];exports[_0xf589('0x4')]=function(_0x22a44b){return new BPromise(function(_0x1f7170,_0x2a4c55){exec(_0x22a44b,function(_0x29ee62,_0x30b16c,_0x2b12ca){logger[_0xf589('0x5')](_0xf589('0x6'),_0x30b16c);if(_0x29ee62){logger[_0xf589('0x5')](_0xf589('0x6'),_0xf589('0x7'),util['inspect'](_0x29ee62,{'showHidden':![],'depth':null}),_0x30b16c,_0x2b12ca);_0x2a4c55(_0x29ee62);}_0x1f7170(_0x30b16c);});});}; \ No newline at end of file +var _0x6ca1=['util','../../../../config/logger','fax','bluebird','exec','Exec\x20gs','info','\x20Error\x20:'];(function(_0x136619,_0x31c9b2){var _0x38c4a5=function(_0x10b74d){while(--_0x10b74d){_0x136619['push'](_0x136619['shift']());}};_0x38c4a5(++_0x31c9b2);}(_0x6ca1,0x1f0));var _0x16ca=function(_0x3abe51,_0x3ae0c6){_0x3abe51=_0x3abe51-0x0;var _0x11bce4=_0x6ca1[_0x3abe51];return _0x11bce4;};'use strict';var util=require(_0x16ca('0x0'));var logger=require(_0x16ca('0x1'))(_0x16ca('0x2'));var BPromise=require(_0x16ca('0x3'));var exec=require('child_process')[_0x16ca('0x4')];exports['execute']=function(_0x2d78ff){return new BPromise(function(_0x5714fa,_0x3487ae){exec(_0x2d78ff,function(_0x48f8ad,_0xe51e95,_0x5599d6){logger['info'](_0x16ca('0x5'),_0xe51e95);if(_0x48f8ad){logger[_0x16ca('0x6')](_0x16ca('0x5'),_0x16ca('0x7'),util['inspect'](_0x48f8ad,{'showHidden':![],'depth':null}),_0xe51e95,_0x5599d6);_0x3487ae(_0x48f8ad);}_0x5714fa(_0xe51e95);});});}; \ 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 9d66e50..a81e5ff 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 _0x8a66=['uniqueid','util','lodash','../../../../config/logger','message','logger','info','addVariables','ecm','headerinfo','minrate','maxrate','\x22%s\x22','modem','gateway','t38timeout','localstationid','path','variablesAction','originate','channel','xcally-motion-fax','from-sip','format'];(function(_0x36d754,_0x573330){var _0xfff8bd=function(_0x5aca27){while(--_0x5aca27){_0x36d754['push'](_0x36d754['shift']());}};_0xfff8bd(++_0x573330);}(_0x8a66,0x1e1));var _0x68a6=function(_0x5d4876,_0x11e6b0){_0x5d4876=_0x5d4876-0x0;var _0x6927ac=_0x8a66[_0x5d4876];return _0x6927ac;};'use strict';var util=require(_0x68a6('0x0'));var _=require(_0x68a6('0x1'));var moment=require('moment');var logger=require(_0x68a6('0x2'))('fax');exports[_0x68a6('0x3')]=function(_0x3215b8){return{'message':_0x3215b8};};exports[_0x68a6('0x4')]=function(_0x40d25b,_0x41561a){logger[_0x68a6('0x5')](_0x40d25b,util['inspect'](_0x41561a,{'showHidden':![],'depth':null}));};exports[_0x68a6('0x6')]=function(_0x205704,_0x3ad8af){var _0x3d9a14={'XMF-ECM':_0x3ad8af[_0x68a6('0x7')],'XMF-HEADERINFO':_0x3ad8af[_0x68a6('0x8')],'XMF-MINRATE':_0x3ad8af[_0x68a6('0x9')],'XMF-MAXRATE':_0x3ad8af[_0x68a6('0xa')],'XMF-MODEM':util['format'](_0x68a6('0xb'),_0x3ad8af[_0x68a6('0xc')]),'XMF-GATEWAY':_0x3ad8af[_0x68a6('0xd')],'XMF-FAXDETECT':_0x3ad8af['faxdetect'],'XMF-T38TIMEOUT':_0x3ad8af[_0x68a6('0xe')],'XMF-LOCALSTATIONID':_0x3ad8af[_0x68a6('0xf')],'XMF-PATH':_0x205704[_0x68a6('0x10')]};return _0x3d9a14;};exports[_0x68a6('0x11')]=function(_0x18da0d,_0x5348a8){return{'actionid':_0x18da0d['uniqueid'],'action':_0x68a6('0x12'),'channel':_0x18da0d[_0x68a6('0x13')],'Exten':_0x68a6('0x14'),'Context':_0x68a6('0x15'),'Priority':'1','callerid':util[_0x68a6('0x16')]('\x22%s\x22\x20<%s>',_0x18da0d[_0x68a6('0x8')]?_0x18da0d[_0x68a6('0x8')]:'',_0x18da0d[_0x68a6('0xf')]),'variable':_0x5348a8,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x18da0d[_0x68a6('0x17')]};}; \ No newline at end of file +var _0xa992=['\x22%s\x22\x20<%s>','headerinfo','util','../../../../config/logger','message','logger','info','inspect','ecm','minrate','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','localstationid','path','variablesAction','uniqueid','channel','xcally-motion-fax','from-sip'];(function(_0x33c425,_0x162116){var _0x4049f4=function(_0x36ab6e){while(--_0x36ab6e){_0x33c425['push'](_0x33c425['shift']());}};_0x4049f4(++_0x162116);}(_0xa992,0x144));var _0x2a99=function(_0x12444a,_0x388e42){_0x12444a=_0x12444a-0x0;var _0x4853a3=_0xa992[_0x12444a];return _0x4853a3;};'use strict';var util=require(_0x2a99('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0x2a99('0x1'))('fax');exports[_0x2a99('0x2')]=function(_0x53da70){return{'message':_0x53da70};};exports[_0x2a99('0x3')]=function(_0x59f5e8,_0x48ce2f){logger[_0x2a99('0x4')](_0x59f5e8,util[_0x2a99('0x5')](_0x48ce2f,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x1bce69,_0x177b4e){var _0x187257={'XMF-ECM':_0x177b4e[_0x2a99('0x6')],'XMF-HEADERINFO':_0x177b4e['headerinfo'],'XMF-MINRATE':_0x177b4e[_0x2a99('0x7')],'XMF-MAXRATE':_0x177b4e[_0x2a99('0x8')],'XMF-MODEM':util[_0x2a99('0x9')](_0x2a99('0xa'),_0x177b4e[_0x2a99('0xb')]),'XMF-GATEWAY':_0x177b4e[_0x2a99('0xc')],'XMF-FAXDETECT':_0x177b4e[_0x2a99('0xd')],'XMF-T38TIMEOUT':_0x177b4e['t38timeout'],'XMF-LOCALSTATIONID':_0x177b4e[_0x2a99('0xe')],'XMF-PATH':_0x1bce69[_0x2a99('0xf')]};return _0x187257;};exports[_0x2a99('0x10')]=function(_0x526342,_0x5c9ed7){return{'actionid':_0x526342[_0x2a99('0x11')],'action':'originate','channel':_0x526342[_0x2a99('0x12')],'Exten':_0x2a99('0x13'),'Context':_0x2a99('0x14'),'Priority':'1','callerid':util[_0x2a99('0x9')](_0x2a99('0x15'),_0x526342['headerinfo']?_0x526342[_0x2a99('0x16')]:'',_0x526342[_0x2a99('0xe')]),'variable':_0x5c9ed7,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x526342[_0x2a99('0x11')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index df813ec..1991a48 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 _0x2e77=['getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','inspect','listen','moment','./server','./acw','./dialer','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','ami','get','hour','resolve','then','getAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initTemplates','getZendeskAccounts','initZendeskAccounts'];(function(_0x16bb5a,_0x33c482){var _0x4f4103=function(_0x198e4d){while(--_0x198e4d){_0x16bb5a['push'](_0x16bb5a['shift']());}};_0x4f4103(++_0x33c482);}(_0x2e77,0x1e3));var _0x72e7=function(_0x585ac4,_0x2c3b3e){_0x585ac4=_0x585ac4-0x0;var _0x48d2bd=_0x2e77[_0x585ac4];return _0x48d2bd;};'use strict';var util=require('util');var moment=require(_0x72e7('0x0'));var server=require(_0x72e7('0x1'));var Realtime=require('./realtime');var Report=require('./report');var Acw=require(_0x72e7('0x2'));var Trigger=require('./trigger');var Dialer=require(_0x72e7('0x3'));var Preview=require(_0x72e7('0x4'));var Fax=require('./fax');var user=require(_0x72e7('0x5'));var voiceQueue=require(_0x72e7('0x6'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x72e7('0x7'));var trunk=require(_0x72e7('0x8'));var trigger=require(_0x72e7('0x9'));var template=require(_0x72e7('0xa'));var cmHopperHistory=require(_0x72e7('0xb'));var campaign=require(_0x72e7('0xc'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x72e7('0xd'));var salesforce=require(_0x72e7('0xe'));var sugarcrm=require(_0x72e7('0xf'));var freshdesk=require(_0x72e7('0x10'));var desk=require(_0x72e7('0x11'));var zoho=require(_0x72e7('0x12'));var vtiger=require(_0x72e7('0x13'));var freshsales=require(_0x72e7('0x14'));var servicenow=require(_0x72e7('0x15'));var dynamics365=require(_0x72e7('0x16'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')(_0x72e7('0x17'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x72e7('0x18')](_0x72e7('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x72e7('0x18')](_0x72e7('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x72e7('0x1a')]()[_0x72e7('0x1b')](user[_0x72e7('0x1c')]())[_0x72e7('0x1b')](realtime['initAgents']())[_0x72e7('0x1b')](user[_0x72e7('0x1d')]())['then'](realtime[_0x72e7('0x1e')]())[_0x72e7('0x1b')](trunk[_0x72e7('0x1f')]())[_0x72e7('0x1b')](realtime[_0x72e7('0x20')]())[_0x72e7('0x1b')](voiceQueue[_0x72e7('0x21')]())[_0x72e7('0x1b')](realtime['initVoiceQueues']())[_0x72e7('0x1b')](trigger['getTriggers']())[_0x72e7('0x1b')](realtime['initTriggers']())[_0x72e7('0x1b')](template['getTemplates']())[_0x72e7('0x1b')](realtime[_0x72e7('0x22')]())[_0x72e7('0x1b')](zendesk[_0x72e7('0x23')]())[_0x72e7('0x1b')](realtime[_0x72e7('0x24')]())['then'](salesforce[_0x72e7('0x25')]())[_0x72e7('0x1b')](realtime[_0x72e7('0x26')]())['then'](sugarcrm[_0x72e7('0x27')]())[_0x72e7('0x1b')](realtime[_0x72e7('0x28')]())[_0x72e7('0x1b')](freshdesk[_0x72e7('0x29')]())['then'](realtime[_0x72e7('0x2a')]())['then'](desk[_0x72e7('0x2b')]())[_0x72e7('0x1b')](realtime[_0x72e7('0x2c')]())[_0x72e7('0x1b')](zoho[_0x72e7('0x2d')]())['then'](realtime[_0x72e7('0x2e')]())['then'](vtiger[_0x72e7('0x2f')]())[_0x72e7('0x1b')](realtime['initVtigerAccounts']())[_0x72e7('0x1b')](freshsales[_0x72e7('0x30')]())[_0x72e7('0x1b')](realtime[_0x72e7('0x31')]())[_0x72e7('0x1b')](servicenow[_0x72e7('0x32')]())[_0x72e7('0x1b')](realtime['initServicenowAccounts']())[_0x72e7('0x1b')](dynamics365[_0x72e7('0x33')]())[_0x72e7('0x1b')](realtime[_0x72e7('0x34')]())['then'](campaign[_0x72e7('0x35')]())[_0x72e7('0x1b')](realtime['initCampaigns']())[_0x72e7('0x1b')](voiceExtension['getVoiceExtensions']())[_0x72e7('0x1b')](realtime[_0x72e7('0x36')]())[_0x72e7('0x1b')](faxAccount[_0x72e7('0x37')]())[_0x72e7('0x1b')](realtime[_0x72e7('0x38')]())[_0x72e7('0x1b')](function(){return realtime;});}function initParams(){return Promise[_0x72e7('0x1a')]()[_0x72e7('0x1b')](voiceQueueReport['getVoiceQueueReports']())[_0x72e7('0x1b')](realtime[_0x72e7('0x39')]())[_0x72e7('0x1b')](cmHopperHistory['getVoiceQueueHopperHistory']())['then'](realtime['initVoiceQueueHopperHistory']())[_0x72e7('0x1b')](cmHopperHistory[_0x72e7('0x3a')]())[_0x72e7('0x1b')](realtime['initCampaignHopperHistory']())[_0x72e7('0x1b')](voiceCallReport[_0x72e7('0x3b')]())[_0x72e7('0x1b')](realtime[_0x72e7('0x3c')]())[_0x72e7('0x3d')](function(_0x39fbdd){logger[_0x72e7('0x3e')]('[index.js][initParams]',util[_0x72e7('0x3f')](_0x39fbdd,{'showHidden':![],'depth':null}));});}function main(){return server[_0x72e7('0x40')](realtime,preview,fax)[_0x72e7('0x1b')](function(){return initRealtime();})[_0x72e7('0x1b')](function(){return initParams();})[_0x72e7('0x1b')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x72e7('0x3d')](function(_0x5ae357){logger[_0x72e7('0x3e')]('[index.js][main]',util[_0x72e7('0x3f')](_0x5ae357,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xb378=['./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','listen','sync','[index.js][main]','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales'];(function(_0xc61a4f,_0xec3751){var _0x2ae80c=function(_0x2715c2){while(--_0x2715c2){_0xc61a4f['push'](_0xc61a4f['shift']());}};_0x2ae80c(++_0xec3751);}(_0xb378,0xcd));var _0x8b37=function(_0x2f90e4,_0x2df97d){_0x2f90e4=_0x2f90e4-0x0;var _0x40d7d1=_0xb378[_0x2f90e4];return _0x40d7d1;};'use strict';var util=require(_0x8b37('0x0'));var moment=require(_0x8b37('0x1'));var server=require(_0x8b37('0x2'));var Realtime=require(_0x8b37('0x3'));var Report=require(_0x8b37('0x4'));var Acw=require(_0x8b37('0x5'));var Trigger=require(_0x8b37('0x6'));var Dialer=require(_0x8b37('0x7'));var Preview=require(_0x8b37('0x8'));var Fax=require(_0x8b37('0x9'));var user=require(_0x8b37('0xa'));var voiceQueue=require(_0x8b37('0xb'));var voiceQueueReport=require(_0x8b37('0xc'));var voiceCallReport=require(_0x8b37('0xd'));var trunk=require(_0x8b37('0xe'));var trigger=require(_0x8b37('0xf'));var template=require(_0x8b37('0x10'));var cmHopperHistory=require(_0x8b37('0x11'));var campaign=require(_0x8b37('0x12'));var voiceExtension=require(_0x8b37('0x13'));var faxAccount=require(_0x8b37('0x14'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x8b37('0x15'));var sugarcrm=require(_0x8b37('0x16'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x8b37('0x17'));var zoho=require(_0x8b37('0x18'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x8b37('0x19'));var servicenow=require(_0x8b37('0x1a'));var dynamics365=require(_0x8b37('0x1b'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x8b37('0x1c'))(_0x8b37('0x1d'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x8b37('0x1e')](_0x8b37('0x1f'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x8b37('0x1f'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise['resolve']()[_0x8b37('0x20')](user[_0x8b37('0x21')]())['then'](realtime[_0x8b37('0x22')]())[_0x8b37('0x20')](user[_0x8b37('0x23')]())[_0x8b37('0x20')](realtime[_0x8b37('0x24')]())[_0x8b37('0x20')](trunk[_0x8b37('0x25')]())[_0x8b37('0x20')](realtime['initTrunks']())[_0x8b37('0x20')](voiceQueue['getVoiceQueues']())[_0x8b37('0x20')](realtime[_0x8b37('0x26')]())['then'](trigger[_0x8b37('0x27')]())[_0x8b37('0x20')](realtime[_0x8b37('0x28')]())['then'](template[_0x8b37('0x29')]())[_0x8b37('0x20')](realtime[_0x8b37('0x2a')]())[_0x8b37('0x20')](zendesk[_0x8b37('0x2b')]())['then'](realtime[_0x8b37('0x2c')]())[_0x8b37('0x20')](salesforce[_0x8b37('0x2d')]())['then'](realtime[_0x8b37('0x2e')]())[_0x8b37('0x20')](sugarcrm[_0x8b37('0x2f')]())[_0x8b37('0x20')](realtime[_0x8b37('0x30')]())[_0x8b37('0x20')](freshdesk[_0x8b37('0x31')]())[_0x8b37('0x20')](realtime[_0x8b37('0x32')]())[_0x8b37('0x20')](desk[_0x8b37('0x33')]())[_0x8b37('0x20')](realtime['initDeskAccounts']())['then'](zoho[_0x8b37('0x34')]())[_0x8b37('0x20')](realtime[_0x8b37('0x35')]())[_0x8b37('0x20')](vtiger[_0x8b37('0x36')]())[_0x8b37('0x20')](realtime['initVtigerAccounts']())['then'](freshsales[_0x8b37('0x37')]())[_0x8b37('0x20')](realtime[_0x8b37('0x38')]())[_0x8b37('0x20')](servicenow['getServicenowAccounts']())['then'](realtime[_0x8b37('0x39')]())['then'](dynamics365['getDynamics365Accounts']())[_0x8b37('0x20')](realtime[_0x8b37('0x3a')]())['then'](campaign[_0x8b37('0x3b')]())[_0x8b37('0x20')](realtime['initCampaigns']())[_0x8b37('0x20')](voiceExtension[_0x8b37('0x3c')]())['then'](realtime['initVoiceExtensions']())[_0x8b37('0x20')](faxAccount[_0x8b37('0x3d')]())[_0x8b37('0x20')](realtime[_0x8b37('0x3e')]())[_0x8b37('0x20')](function(){return realtime;});}function initParams(){return Promise[_0x8b37('0x3f')]()[_0x8b37('0x20')](voiceQueueReport[_0x8b37('0x40')]())[_0x8b37('0x20')](realtime[_0x8b37('0x41')]())[_0x8b37('0x20')](cmHopperHistory[_0x8b37('0x42')]())[_0x8b37('0x20')](realtime[_0x8b37('0x43')]())['then'](cmHopperHistory['getCampaignHopperHistory']())[_0x8b37('0x20')](realtime[_0x8b37('0x44')]())[_0x8b37('0x20')](voiceCallReport[_0x8b37('0x45')]())[_0x8b37('0x20')](realtime[_0x8b37('0x46')]())[_0x8b37('0x47')](function(_0x14702e){logger[_0x8b37('0x48')](_0x8b37('0x49'),util['inspect'](_0x14702e,{'showHidden':![],'depth':null}));});}function main(){return server[_0x8b37('0x4a')](realtime,preview,fax)[_0x8b37('0x20')](function(){return initRealtime();})[_0x8b37('0x20')](function(){return initParams();})[_0x8b37('0x20')](function(){report[_0x8b37('0x4b')]();setInterval(initRealtime,0x1388);})[_0x8b37('0x47')](function(_0x94fa0){logger['error'](_0x8b37('0x4c'),util['inspect'](_0x94fa0,{'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 382029d..d45f7d6 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 _0x07b1=['omit','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','email','accountcode','fullname','stateTime','status','unknown','phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','md5','prototype','updateStatusRealtime','state','toLowerCase','not_inuse','idle','inuse','talking','statePause','toNumber','name','interface','stringify','format','emit'];(function(_0x4ef836,_0x31e02b){var _0x256a91=function(_0x10b7c4){while(--_0x10b7c4){_0x4ef836['push'](_0x4ef836['shift']());}};_0x256a91(++_0x31e02b);}(_0x07b1,0x79));var _0x107b=function(_0x51046c,_0x41f340){_0x51046c=_0x51046c-0x0;var _0x2a19c4=_0x07b1[_0x51046c];return _0x2a19c4;};'use strict';var _=require(_0x107b('0x0'));var util=require(_0x107b('0x1'));var moment=require('moment');var md5=require('md5');var Redis=require(_0x107b('0x2'));var config=require(_0x107b('0x3'));config[_0x107b('0x4')]=_[_0x107b('0x5')](config[_0x107b('0x4')],{'host':_0x107b('0x6'),'port':0x18eb});var io=require(_0x107b('0x7'))(new Redis(config['redis']));function Agent(_0xf0f68f){this['id']=_0xf0f68f['id']||0x0;this['name']=_0xf0f68f['name']||'';this[_0x107b('0x8')]=_0xf0f68f[_0x107b('0x8')]||'';this[_0x107b('0x9')]=_0xf0f68f[_0x107b('0x9')]||'';this[_0x107b('0xa')]=_0xf0f68f[_0x107b('0xa')]||'';this['state']='unknown';this[_0x107b('0xb')]=0x0;this[_0x107b('0xc')]=_0x107b('0xd');this['address']='';this[_0x107b('0xe')]='';this[_0x107b('0xf')]='';this['interface']='';this[_0x107b('0x10')]=_0xf0f68f['online']||![];this[_0x107b('0x11')]=_0x107b('0xd');this[_0x107b('0x12')]=0x0;this[_0x107b('0x13')]='';this[_0x107b('0x14')]='';this[_0x107b('0x15')]=![];this[_0x107b('0x16')]=![];this[_0x107b('0x17')]='';}Agent[_0x107b('0x18')][_0x107b('0x19')]=function(_0x3da6a5){var _0x104b66;if(_0x3da6a5&&_0x3da6a5['state']){_0x104b66=_0x3da6a5[_0x107b('0x1a')][_0x107b('0x1b')]();switch(_0x104b66){case _0x107b('0x1c'):_0x104b66=_0x107b('0x1d');break;case _0x107b('0x1e'):_0x104b66=_0x107b('0x1f');break;}}if(_0x104b66&&this[_0x107b('0x11')]!==_0x104b66||_0x3da6a5[_0x107b('0x20')]){this[_0x107b('0x12')]=_[_0x107b('0x21')](moment()['format']('x'));}if(_0x104b66){this[_0x107b('0x11')]=_0x104b66;}var _0x5a8467={'id':this['id'],'name':this[_0x107b('0x22')],'email':this[_0x107b('0x8')],'accountcode':this[_0x107b('0x9')],'fullname':this['fullname'],'state':this['state'],'stateTime':this[_0x107b('0xb')],'status':this[_0x107b('0xc')],'address':this['address'],'online':this[_0x107b('0x10')],'voiceStatus':this[_0x107b('0x11')],'voiceStatusTime':this[_0x107b('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x107b('0x14')],'interface':this[_0x107b('0x23')],'onhold':this[_0x107b('0x15')]};var _0x13390d=md5(JSON[_0x107b('0x24')](_0x5a8467));if(this[_0x107b('0x17')]!==_0x13390d){this['md5']=_0x13390d;io['to'](util[_0x107b('0x25')]('user:%s',_0x5a8467[_0x107b('0x22')]))[_0x107b('0x26')]('user:ami:update',_[_0x107b('0x27')](_0x5a8467,[_0x107b('0x10')]));io['emit']('user:presence',_0x5a8467);}};module['exports']=Agent; \ No newline at end of file +var _0x134f=['inuse','talking','voiceStatus','statePause','toNumber','format','accountcode','online','user:%s','user:ami:update','emit','user:presence','lodash','util','moment','md5','ioredis','redis','defaults','localhost','name','email','fullname','state','status','unknown','address','phone','mobile','interface','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','updateStatusRealtime','toLowerCase','idle'];(function(_0x54aad7,_0x5d7078){var _0x3c0b0b=function(_0x400ea0){while(--_0x400ea0){_0x54aad7['push'](_0x54aad7['shift']());}};_0x3c0b0b(++_0x5d7078);}(_0x134f,0x188));var _0xf134=function(_0x2c5790,_0x46cb39){_0x2c5790=_0x2c5790-0x0;var _0x21e80d=_0x134f[_0x2c5790];return _0x21e80d;};'use strict';var _=require(_0xf134('0x0'));var util=require(_0xf134('0x1'));var moment=require(_0xf134('0x2'));var md5=require(_0xf134('0x3'));var Redis=require(_0xf134('0x4'));var config=require('../../../config/environment');config[_0xf134('0x5')]=_[_0xf134('0x6')](config[_0xf134('0x5')],{'host':_0xf134('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf134('0x5')]));function Agent(_0x1df934){this['id']=_0x1df934['id']||0x0;this[_0xf134('0x8')]=_0x1df934[_0xf134('0x8')]||'';this[_0xf134('0x9')]=_0x1df934[_0xf134('0x9')]||'';this['accountcode']=_0x1df934['accountcode']||'';this[_0xf134('0xa')]=_0x1df934[_0xf134('0xa')]||'';this[_0xf134('0xb')]='unknown';this['stateTime']=0x0;this[_0xf134('0xc')]=_0xf134('0xd');this[_0xf134('0xe')]='';this[_0xf134('0xf')]='';this[_0xf134('0x10')]='';this[_0xf134('0x11')]='';this['online']=_0x1df934['online']||![];this['voiceStatus']=_0xf134('0xd');this[_0xf134('0x12')]=0x0;this[_0xf134('0x13')]='';this[_0xf134('0x14')]='';this[_0xf134('0x15')]=![];this[_0xf134('0x16')]=![];this[_0xf134('0x3')]='';}Agent['prototype'][_0xf134('0x17')]=function(_0x27c5b8){var _0x5c17f1;if(_0x27c5b8&&_0x27c5b8[_0xf134('0xb')]){_0x5c17f1=_0x27c5b8[_0xf134('0xb')][_0xf134('0x18')]();switch(_0x5c17f1){case'not_inuse':_0x5c17f1=_0xf134('0x19');break;case _0xf134('0x1a'):_0x5c17f1=_0xf134('0x1b');break;}}if(_0x5c17f1&&this[_0xf134('0x1c')]!==_0x5c17f1||_0x27c5b8[_0xf134('0x1d')]){this[_0xf134('0x12')]=_[_0xf134('0x1e')](moment()[_0xf134('0x1f')]('x'));}if(_0x5c17f1){this[_0xf134('0x1c')]=_0x5c17f1;}var _0x2632cb={'id':this['id'],'name':this[_0xf134('0x8')],'email':this['email'],'accountcode':this[_0xf134('0x20')],'fullname':this[_0xf134('0xa')],'state':this[_0xf134('0xb')],'stateTime':this['stateTime'],'status':this[_0xf134('0xc')],'address':this['address'],'online':this[_0xf134('0x21')],'voiceStatus':this[_0xf134('0x1c')],'voiceStatusTime':this[_0xf134('0x12')],'voiceStatusCallerIdNumber':this[_0xf134('0x13')],'voiceStatusQueue':this[_0xf134('0x14')],'interface':this[_0xf134('0x11')],'onhold':this[_0xf134('0x15')]};var _0x394e85=md5(JSON['stringify'](_0x2632cb));if(this[_0xf134('0x3')]!==_0x394e85){this[_0xf134('0x3')]=_0x394e85;io['to'](util[_0xf134('0x1f')](_0xf134('0x22'),_0x2632cb['name']))['emit'](_0xf134('0x23'),_['omit'](_0x2632cb,[_0xf134('0x21')]));io[_0xf134('0x24')](_0xf134('0x25'),_0x2632cb);}};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 6e10670..3abaa8f 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 _0x5c9c=['ivrAnswerCallsDay','ivrTotalCallsDays','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','temp'];(function(_0x364a57,_0x2e1b62){var _0x49fd2b=function(_0x10d7ba){while(--_0x10d7ba){_0x364a57['push'](_0x364a57['shift']());}};_0x49fd2b(++_0x2e1b62);}(_0x5c9c,0x16c));var _0xc5c9=function(_0xd5cf5a,_0xaaf828){_0xd5cf5a=_0xd5cf5a-0x0;var _0x21053a=_0x5c9c[_0xd5cf5a];return _0x21053a;};'use strict';function Campaign(_0x231623){this['id']=_0x231623['id']||0x0;this[_0xc5c9('0x0')]=_0x231623[_0xc5c9('0x0')]||'';this[_0xc5c9('0x1')]=_0x231623[_0xc5c9('0x1')]||_0xc5c9('0x2');this['originated']=0x0;this[_0xc5c9('0x3')]=0x0;this[_0xc5c9('0x4')]=0x0;this[_0xc5c9('0x5')]=0x0;this['message']='';this['sendMessageOneNotActive']=!![];this[_0xc5c9('0x6')]=_0x231623[_0xc5c9('0x6')];this[_0xc5c9('0x7')]=_0x231623['limitCalls'];this[_0xc5c9('0x8')]=_0x231623['dialTimezone']||null;this[_0xc5c9('0x9')]=_0x231623[_0xc5c9('0x9')]?_0x231623[_0xc5c9('0x9')]:null;this[_0xc5c9('0xa')]=_0x231623['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x231623[_0xc5c9('0xb')];this['dialOriginateTimeout']=_0x231623['dialOriginateTimeout']||0x1e;this[_0xc5c9('0xc')]=_0x231623[_0xc5c9('0xc')];this[_0xc5c9('0xd')]=_0x231623['dialCongestionRetryFrequency'];this[_0xc5c9('0xe')]=_0x231623['dialBusyMaxRetry'];this['dialBusyRetryFrequency']=_0x231623[_0xc5c9('0xf')];this[_0xc5c9('0x10')]=_0x231623[_0xc5c9('0x10')];this[_0xc5c9('0x11')]=_0x231623['dialNoAnswerRetryFrequency'];this[_0xc5c9('0x12')]=_0x231623[_0xc5c9('0x12')];this['dialNoSuchNumberMaxRetry']=_0x231623['dialNoSuchNumberMaxRetry']||0x3;this[_0xc5c9('0x13')]=_0x231623[_0xc5c9('0x13')]||0x96;this[_0xc5c9('0x14')]=_0x231623[_0xc5c9('0x14')]||0x3;this['dialDropRetryFrequency']=_0x231623['dialDropRetryFrequency']||0x96;this[_0xc5c9('0x15')]=_0x231623['dialAbandonedMaxRetry']||0x3;this[_0xc5c9('0x16')]=_0x231623[_0xc5c9('0x16')]||0x96;this['dialMachineMaxRetry']=_0x231623['dialMachineMaxRetry']||0x3;this[_0xc5c9('0x17')]=_0x231623['dialMachineRetryFrequency']||0x96;this[_0xc5c9('0x18')]=_0x231623['dialAgentRejectMaxRetry']||0x3;this[_0xc5c9('0x19')]=_0x231623[_0xc5c9('0x19')]||0x96;this[_0xc5c9('0x1a')]=_0x231623[_0xc5c9('0x1a')]||'DESC';this[_0xc5c9('0x1b')]=_0x231623['dialPrefix']||undefined;this[_0xc5c9('0x1c')]=_0x231623['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xc5c9('0x1d')]=_0x231623[_0xc5c9('0x1d')]||undefined;this[_0xc5c9('0x1e')]=_0x231623[_0xc5c9('0x1e')]?_0x231623[_0xc5c9('0x1e')]:undefined;this[_0xc5c9('0x1f')]=_0x231623[_0xc5c9('0x1f')]?_0x231623[_0xc5c9('0x1f')]:undefined;this[_0xc5c9('0x20')]=_0x231623[_0xc5c9('0x20')]?_0x231623[_0xc5c9('0x20')]:undefined;this['SquareProject']=_0x231623[_0xc5c9('0x21')]?_0x231623[_0xc5c9('0x21')]:undefined;this[_0xc5c9('0x22')]=_0x231623['SquareProject']?_0x231623[_0xc5c9('0x21')]['name']:undefined;this['dialAMDActive']=_0x231623[_0xc5c9('0x23')]||![];this[_0xc5c9('0x24')]=_0x231623[_0xc5c9('0x24')];this['dialAMDGreeting']=_0x231623[_0xc5c9('0x25')];this['dialAMDAfterGreetingSilence']=_0x231623[_0xc5c9('0x26')];this[_0xc5c9('0x27')]=_0x231623[_0xc5c9('0x27')];this[_0xc5c9('0x28')]=_0x231623[_0xc5c9('0x28')];this[_0xc5c9('0x29')]=_0x231623[_0xc5c9('0x29')];this[_0xc5c9('0x2a')]=_0x231623[_0xc5c9('0x2a')];this[_0xc5c9('0x2b')]=_0x231623['dialAMDSilenceThreshold'];this[_0xc5c9('0x2c')]=_0x231623[_0xc5c9('0x2c')];}module[_0xc5c9('0x2d')]=Campaign; \ No newline at end of file +var _0xcf95=['dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence'];(function(_0x69b193,_0x571a6c){var _0x593f23=function(_0x1274db){while(--_0x1274db){_0x69b193['push'](_0x69b193['shift']());}};_0x593f23(++_0x571a6c);}(_0xcf95,0xd0));var _0x5cf9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf95[_0x3dd15e];return _0x231fd0;};'use strict';function Campaign(_0x420ff5){this['id']=_0x420ff5['id']||0x0;this[_0x5cf9('0x0')]=_0x420ff5['name']||'';this[_0x5cf9('0x1')]=_0x420ff5[_0x5cf9('0x1')]||_0x5cf9('0x2');this[_0x5cf9('0x3')]=0x0;this[_0x5cf9('0x4')]=0x0;this[_0x5cf9('0x5')]=0x0;this[_0x5cf9('0x6')]=0x0;this['message']='';this[_0x5cf9('0x7')]=!![];this[_0x5cf9('0x8')]=_0x420ff5[_0x5cf9('0x8')];this['limitCalls']=_0x420ff5[_0x5cf9('0x9')];this[_0x5cf9('0xa')]=_0x420ff5['dialTimezone']||null;this[_0x5cf9('0xb')]=_0x420ff5[_0x5cf9('0xb')]?_0x420ff5['dialGlobalInterval']:null;this[_0x5cf9('0xc')]=_0x420ff5[_0x5cf9('0xc')];this[_0x5cf9('0xd')]=_0x420ff5[_0x5cf9('0xd')];this[_0x5cf9('0xe')]=_0x420ff5[_0x5cf9('0xe')]||0x1e;this[_0x5cf9('0xf')]=_0x420ff5['dialCongestionMaxRetry'];this[_0x5cf9('0x10')]=_0x420ff5[_0x5cf9('0x10')];this[_0x5cf9('0x11')]=_0x420ff5[_0x5cf9('0x11')];this['dialBusyRetryFrequency']=_0x420ff5['dialBusyRetryFrequency'];this[_0x5cf9('0x12')]=_0x420ff5['dialNoAnswerMaxRetry'];this[_0x5cf9('0x13')]=_0x420ff5['dialNoAnswerRetryFrequency'];this['dialGlobalMaxRetry']=_0x420ff5[_0x5cf9('0x14')];this['dialNoSuchNumberMaxRetry']=_0x420ff5[_0x5cf9('0x15')]||0x3;this[_0x5cf9('0x16')]=_0x420ff5['dialNoSuchNumberRetryFrequency']||0x96;this[_0x5cf9('0x17')]=_0x420ff5[_0x5cf9('0x17')]||0x3;this[_0x5cf9('0x18')]=_0x420ff5['dialDropRetryFrequency']||0x96;this[_0x5cf9('0x19')]=_0x420ff5[_0x5cf9('0x19')]||0x3;this[_0x5cf9('0x1a')]=_0x420ff5[_0x5cf9('0x1a')]||0x96;this['dialMachineMaxRetry']=_0x420ff5[_0x5cf9('0x1b')]||0x3;this[_0x5cf9('0x1c')]=_0x420ff5['dialMachineRetryFrequency']||0x96;this[_0x5cf9('0x1d')]=_0x420ff5[_0x5cf9('0x1d')]||0x3;this['dialAgentRejectRetryFrequency']=_0x420ff5[_0x5cf9('0x1e')]||0x96;this['dialOrderByScheduledAt']=_0x420ff5['dialOrderByScheduledAt']||_0x5cf9('0x1f');this[_0x5cf9('0x20')]=_0x420ff5[_0x5cf9('0x20')]||undefined;this[_0x5cf9('0x21')]=_0x420ff5[_0x5cf9('0x21')]||undefined;this[_0x5cf9('0x22')]=_0x420ff5['dialCutDigit']||undefined;this['TrunkBackup']=_0x420ff5[_0x5cf9('0x23')]?_0x420ff5['TrunkBackup']:undefined;this[_0x5cf9('0x24')]=_0x420ff5[_0x5cf9('0x24')]?_0x420ff5[_0x5cf9('0x24')]:undefined;this['Interval']=_0x420ff5[_0x5cf9('0x25')]?_0x420ff5[_0x5cf9('0x25')]:undefined;this[_0x5cf9('0x26')]=_0x420ff5[_0x5cf9('0x26')]?_0x420ff5['SquareProject']:undefined;this[_0x5cf9('0x27')]=_0x420ff5['SquareProject']?_0x420ff5['SquareProject'][_0x5cf9('0x0')]:undefined;this[_0x5cf9('0x28')]=_0x420ff5[_0x5cf9('0x28')]||![];this[_0x5cf9('0x29')]=_0x420ff5[_0x5cf9('0x29')];this[_0x5cf9('0x2a')]=_0x420ff5[_0x5cf9('0x2a')];this['dialAMDAfterGreetingSilence']=_0x420ff5[_0x5cf9('0x2b')];this[_0x5cf9('0x2c')]=_0x420ff5[_0x5cf9('0x2c')];this[_0x5cf9('0x2d')]=_0x420ff5['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x420ff5[_0x5cf9('0x2e')];this['dialAMDMaximumNumberOfWords']=_0x420ff5[_0x5cf9('0x2f')];this[_0x5cf9('0x30')]=_0x420ff5[_0x5cf9('0x30')];this[_0x5cf9('0x31')]=_0x420ff5[_0x5cf9('0x31')];}module[_0x5cf9('0x32')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 345d5f5..1fa8c9c 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 _0x41fa=['transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','accountcode','context','uniqueid','linkedid','exten','answered','endtime','unmanaged','abandoned','lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitor','queue','monitors'];(function(_0x4a2b57,_0x31879c){var _0x2e65a1=function(_0x318a55){while(--_0x318a55){_0x4a2b57['push'](_0x4a2b57['shift']());}};_0x2e65a1(++_0x31879c);}(_0x41fa,0x1f1));var _0xa41f=function(_0x13cab0,_0x14d825){_0x13cab0=_0x13cab0-0x0;var _0x38804f=_0x41fa[_0x13cab0];return _0x38804f;};'use strict';function Channel(){this[_0xa41f('0x0')]=null;this[_0xa41f('0x1')]='';this[_0xa41f('0x2')]='';this[_0xa41f('0x3')]=0x0;this[_0xa41f('0x4')]='';this[_0xa41f('0x5')]=undefined;this['connectedlinename']=undefined;this[_0xa41f('0x6')]=0x0;this[_0xa41f('0x7')]='';this[_0xa41f('0x8')]=0x0;this[_0xa41f('0x9')]=0x0;this[_0xa41f('0xa')]=0x0;this[_0xa41f('0xb')]=![];this['answertime']=null;this[_0xa41f('0xc')]=null;this[_0xa41f('0xd')]=![];this[_0xa41f('0xe')]=![];this['lastapplication']='';this[_0xa41f('0xf')]='';this[_0xa41f('0x10')]=0x0;this[_0xa41f('0x11')]=0x0;this[_0xa41f('0x12')]=0x0;this[_0xa41f('0x13')]=null;this[_0xa41f('0x14')]=null;this[_0xa41f('0x15')]=null;this[_0xa41f('0x16')]=![];this['monitorFilename']=null;this[_0xa41f('0x17')]=null;this[_0xa41f('0x18')]=[];this[_0xa41f('0x19')]=undefined;this[_0xa41f('0x1a')]=undefined;this['transferType']=undefined;this[_0xa41f('0x1b')]=0x0;}module[_0xa41f('0x1c')]=Channel; \ No newline at end of file +var _0xb846=['mohtime','exports','starttime','calleridnum','calleridname','connectedlinenum','connectedlinename','uniqueid','linkedid','exten','answered','answertime','abandoned','lastdata','duration','tag','disposition','monitor','transfercalleridnum','transferconnectedlinenum','transferType'];(function(_0x3a8b7c,_0x3e5db2){var _0x40eb80=function(_0x8db6a3){while(--_0x8db6a3){_0x3a8b7c['push'](_0x3a8b7c['shift']());}};_0x40eb80(++_0x3e5db2);}(_0xb846,0x1d0));var _0x6b84=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xb846[_0x126558];return _0x1f6d14;};'use strict';function Channel(){this[_0x6b84('0x0')]=null;this['channel']='';this['destinationchannel']='';this[_0x6b84('0x1')]=0x0;this[_0x6b84('0x2')]='';this[_0x6b84('0x3')]=undefined;this[_0x6b84('0x4')]=undefined;this['accountcode']=0x0;this['context']='';this[_0x6b84('0x5')]=0x0;this[_0x6b84('0x6')]=0x0;this[_0x6b84('0x7')]=0x0;this[_0x6b84('0x8')]=![];this[_0x6b84('0x9')]=null;this['endtime']=null;this['unmanaged']=![];this[_0x6b84('0xa')]=![];this['lastapplication']='';this[_0x6b84('0xb')]='';this[_0x6b84('0xc')]=0x0;this['billableseconds']=0x0;this['holdtime']=0x0;this['type']=null;this[_0x6b84('0xd')]=null;this[_0x6b84('0xe')]=null;this[_0x6b84('0xf')]=![];this['monitorFilename']=null;this['queue']=null;this['monitors']=[];this[_0x6b84('0x10')]=undefined;this[_0x6b84('0x11')]=undefined;this[_0x6b84('0x12')]=undefined;this[_0x6b84('0x13')]=0x0;}module[_0x6b84('0x14')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 16ce6b4..a77c17f 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 _0x335c=['username','remoteUri','authType','password','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name'];(function(_0x1c3dcf,_0x2bab00){var _0x343dc1=function(_0x16d4b6){while(--_0x16d4b6){_0x1c3dcf['push'](_0x1c3dcf['shift']());}};_0x343dc1(++_0x2bab00);}(_0x335c,0x1a3));var _0xc335=function(_0x17699f,_0x5981af){_0x17699f=_0x17699f-0x0;var _0x190a6b=_0x335c[_0x17699f];return _0x190a6b;};'use strict';function DeskAccount(_0x1c825b){this['id']=_0x1c825b['id']||0x0;this[_0xc335('0x0')]=_0x1c825b['name']||'';this[_0xc335('0x1')]=_0x1c825b['username']||'';this[_0xc335('0x2')]=_0x1c825b[_0xc335('0x2')]||'';this[_0xc335('0x3')]=_0x1c825b['authType']||'';this['password']=_0x1c825b[_0xc335('0x4')]||'';this['consumerKey']=_0x1c825b['consumerKey']||'';this[_0xc335('0x5')]=_0x1c825b[_0xc335('0x5')]||'';this[_0xc335('0x6')]=_0x1c825b[_0xc335('0x6')]||'';this[_0xc335('0x7')]=_0x1c825b[_0xc335('0x7')]||'';this[_0xc335('0x8')]=_0x1c825b[_0xc335('0x8')]||'';this[_0xc335('0x9')]=_0x1c825b[_0xc335('0x9')]||'';this['Configurations']=_0x1c825b[_0xc335('0xa')]||{};}module[_0xc335('0xb')]=DeskAccount; \ No newline at end of file +var _0xb112=['name','username','remoteUri','authType','password','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0xb112,0x1c8));var _0x2b11=function(_0x1fc1ff,_0x2289b3){_0x1fc1ff=_0x1fc1ff-0x0;var _0x2199b9=_0xb112[_0x1fc1ff];return _0x2199b9;};'use strict';function DeskAccount(_0x239a02){this['id']=_0x239a02['id']||0x0;this[_0x2b11('0x0')]=_0x239a02[_0x2b11('0x0')]||'';this[_0x2b11('0x1')]=_0x239a02['username']||'';this[_0x2b11('0x2')]=_0x239a02[_0x2b11('0x2')]||'';this[_0x2b11('0x3')]=_0x239a02[_0x2b11('0x3')]||'';this[_0x2b11('0x4')]=_0x239a02['password']||'';this['consumerKey']=_0x239a02['consumerKey']||'';this['consumerSecret']=_0x239a02[_0x2b11('0x5')]||'';this[_0x2b11('0x6')]=_0x239a02['token']||'';this[_0x2b11('0x7')]=_0x239a02[_0x2b11('0x7')]||'';this[_0x2b11('0x8')]=_0x239a02['type']||'';this[_0x2b11('0x9')]=_0x239a02[_0x2b11('0x9')]||'';this[_0x2b11('0xa')]=_0x239a02[_0x2b11('0xa')]||{};}module[_0x2b11('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 b09620d..c24a850 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 _0xd565=['exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider'];(function(_0x1084a5,_0x579890){var _0xf18360=function(_0x595ade){while(--_0x595ade){_0x1084a5['push'](_0x1084a5['shift']());}};_0xf18360(++_0x579890);}(_0xd565,0xb5));var _0x5d56=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xd565[_0xfae23b];return _0x200640;};'use strict';function Dynamics365Account(_0x3e1431){this['id']=_0x3e1431['id']||0x0;this[_0x5d56('0x0')]=_0x3e1431[_0x5d56('0x0')]||'';this[_0x5d56('0x1')]=_0x3e1431[_0x5d56('0x1')]||'';this[_0x5d56('0x2')]=_0x3e1431['password']||'';this[_0x5d56('0x3')]=_0x3e1431['remoteUri']||'';this[_0x5d56('0x4')]=_0x3e1431['tenantId']||'';this[_0x5d56('0x5')]=_0x3e1431[_0x5d56('0x5')]||'';this[_0x5d56('0x6')]=_0x3e1431[_0x5d56('0x6')]||{};this[_0x5d56('0x7')]=_0x3e1431[_0x5d56('0x7')]||'';this[_0x5d56('0x8')]=_0x3e1431[_0x5d56('0x8')]||![];this['Configurations']=_0x3e1431[_0x5d56('0x9')]||{};this[_0x5d56('0xa')]=_0x3e1431[_0x5d56('0xa')]||{};}module[_0x5d56('0xb')]=Dynamics365Account; \ No newline at end of file +var _0x3deb=['CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations'];(function(_0x365be9,_0x3c88b9){var _0x185c12=function(_0xbadbbf){while(--_0xbadbbf){_0x365be9['push'](_0x365be9['shift']());}};_0x185c12(++_0x3c88b9);}(_0x3deb,0xc8));var _0xb3de=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x3deb[_0x8c43de];return _0xa6591b;};'use strict';function Dynamics365Account(_0x30bc8a){this['id']=_0x30bc8a['id']||0x0;this[_0xb3de('0x0')]=_0x30bc8a[_0xb3de('0x0')]||'';this['username']=_0x30bc8a[_0xb3de('0x1')]||'';this[_0xb3de('0x2')]=_0x30bc8a[_0xb3de('0x2')]||'';this[_0xb3de('0x3')]=_0x30bc8a['remoteUri']||'';this[_0xb3de('0x4')]=_0x30bc8a['tenantId']||'';this['clientId']=_0x30bc8a[_0xb3de('0x5')]||'';this['clientSecret']=_0x30bc8a[_0xb3de('0x6')]||{};this[_0xb3de('0x7')]=_0x30bc8a['serverUrl']||'';this['modernAuthentication']=_0x30bc8a['modernAuthentication']||![];this[_0xb3de('0x8')]=_0x30bc8a[_0xb3de('0x8')]||{};this[_0xb3de('0x9')]=_0x30bc8a[_0xb3de('0x9')]||{};}module[_0xb3de('0xa')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index e269de1..9b758d9 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 _0xfa40=['exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','t38timeout','Trunk','ListId','key'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0xfa40,0x97));var _0x0fa4=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xfa40[_0x297fd3];return _0x2af381;};'use strict';function FaxAccount(_0x20f44b){this['id']=_0x20f44b['id']||0x0;this['name']=_0x20f44b[_0x0fa4('0x0')]||'';this['description']=_0x20f44b[_0x0fa4('0x1')];this[_0x0fa4('0x2')]=_0x20f44b[_0x0fa4('0x2')];this[_0x0fa4('0x3')]=_0x20f44b[_0x0fa4('0x3')];this[_0x0fa4('0x4')]=_0x20f44b[_0x0fa4('0x4')];this[_0x0fa4('0x5')]=_0x20f44b[_0x0fa4('0x5')]||0x960;this[_0x0fa4('0x6')]=_0x20f44b[_0x0fa4('0x6')]||0x3840;this[_0x0fa4('0x7')]=_0x20f44b[_0x0fa4('0x7')]||_0x0fa4('0x8');this[_0x0fa4('0x9')]=_0x20f44b[_0x0fa4('0x9')]||'no';this['faxdetect']=_0x20f44b['faxdetect']||'no';this[_0x0fa4('0xa')]=_0x20f44b['t38timeout']||0x1388;this['tech']=_0x20f44b['tech']||'SIP';this[_0x0fa4('0xb')]=_0x20f44b['Trunk']?_0x20f44b[_0x0fa4('0xb')]:undefined;this[_0x0fa4('0xc')]=_0x20f44b[_0x0fa4('0xc')];this['key']=_0x20f44b[_0x0fa4('0xd')];}module[_0x0fa4('0xe')]=FaxAccount; \ No newline at end of file +var _0xa72c=['name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports'];(function(_0x250029,_0x2d37ca){var _0x278597=function(_0x348079){while(--_0x348079){_0x250029['push'](_0x250029['shift']());}};_0x278597(++_0x2d37ca);}(_0xa72c,0xea));var _0xca72=function(_0x5c72ee,_0x5a8bf8){_0x5c72ee=_0x5c72ee-0x0;var _0x231876=_0xa72c[_0x5c72ee];return _0x231876;};'use strict';function FaxAccount(_0x594df7){this['id']=_0x594df7['id']||0x0;this['name']=_0x594df7[_0xca72('0x0')]||'';this[_0xca72('0x1')]=_0x594df7[_0xca72('0x1')];this[_0xca72('0x2')]=_0x594df7[_0xca72('0x2')];this[_0xca72('0x3')]=_0x594df7[_0xca72('0x3')];this[_0xca72('0x4')]=_0x594df7[_0xca72('0x4')];this[_0xca72('0x5')]=_0x594df7['minrate']||0x960;this[_0xca72('0x6')]=_0x594df7['maxrate']||0x3840;this[_0xca72('0x7')]=_0x594df7[_0xca72('0x7')]||_0xca72('0x8');this['gateway']=_0x594df7[_0xca72('0x9')]||'no';this[_0xca72('0xa')]=_0x594df7[_0xca72('0xa')]||'no';this[_0xca72('0xb')]=_0x594df7[_0xca72('0xb')]||0x1388;this['tech']=_0x594df7[_0xca72('0xc')]||_0xca72('0xd');this['Trunk']=_0x594df7[_0xca72('0xe')]?_0x594df7[_0xca72('0xe')]:undefined;this[_0xca72('0xf')]=_0x594df7[_0xca72('0xf')];this[_0xca72('0x10')]=_0x594df7[_0xca72('0x10')];}module[_0xca72('0x11')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 49f7806..dcf8eb7 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 _0x6818=['name','username','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x648163,_0x241576){var _0x199d4d=function(_0x23055d){while(--_0x23055d){_0x648163['push'](_0x648163['shift']());}};_0x199d4d(++_0x241576);}(_0x6818,0x1a4));var _0x8681=function(_0x433cb2,_0x47d9cc){_0x433cb2=_0x433cb2-0x0;var _0x569420=_0x6818[_0x433cb2];return _0x569420;};'use strict';function FreshdeskAccount(_0x41276d){this['id']=_0x41276d['id']||0x0;this[_0x8681('0x0')]=_0x41276d[_0x8681('0x0')]||'';this[_0x8681('0x1')]=_0x41276d[_0x8681('0x1')]||'';this['apiKey']=_0x41276d[_0x8681('0x2')]||'';this[_0x8681('0x3')]=_0x41276d[_0x8681('0x3')]||'';this[_0x8681('0x4')]=_0x41276d[_0x8681('0x4')]||'';this[_0x8681('0x5')]=_0x41276d[_0x8681('0x5')]||{};}module[_0x8681('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x2eac=['Configurations','exports','username','token','remoteUri','serverUrl'];(function(_0x56fc1b,_0x1035fd){var _0x452549=function(_0x417ba8){while(--_0x417ba8){_0x56fc1b['push'](_0x56fc1b['shift']());}};_0x452549(++_0x1035fd);}(_0x2eac,0xaa));var _0xc2ea=function(_0x2e5b2e,_0x5ea0bf){_0x2e5b2e=_0x2e5b2e-0x0;var _0x258724=_0x2eac[_0x2e5b2e];return _0x258724;};'use strict';function FreshdeskAccount(_0x19b7c0){this['id']=_0x19b7c0['id']||0x0;this['name']=_0x19b7c0['name']||'';this['username']=_0x19b7c0[_0xc2ea('0x0')]||'';this['apiKey']=_0x19b7c0[_0xc2ea('0x1')]||'';this[_0xc2ea('0x2')]=_0x19b7c0[_0xc2ea('0x2')]||'';this[_0xc2ea('0x3')]=_0x19b7c0[_0xc2ea('0x3')]||'';this[_0xc2ea('0x4')]=_0x19b7c0['Configurations']||{};}module[_0xc2ea('0x5')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index a6e8666..ddb51e2 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 _0xa751=['Configurations','exports','name','username','apiKey','remoteUri','serverUrl'];(function(_0x3259c0,_0x26e295){var _0x2b56e1=function(_0x48f40f){while(--_0x48f40f){_0x3259c0['push'](_0x3259c0['shift']());}};_0x2b56e1(++_0x26e295);}(_0xa751,0x175));var _0x1a75=function(_0x54d3a5,_0x491440){_0x54d3a5=_0x54d3a5-0x0;var _0x51a5cb=_0xa751[_0x54d3a5];return _0x51a5cb;};'use strict';function FreshsalesAccount(_0x1e981b){this['id']=_0x1e981b['id']||0x0;this[_0x1a75('0x0')]=_0x1e981b[_0x1a75('0x0')]||'';this[_0x1a75('0x1')]=_0x1e981b['username']||'';this[_0x1a75('0x2')]=_0x1e981b['token']||'';this[_0x1a75('0x3')]=_0x1e981b[_0x1a75('0x3')]||'';this[_0x1a75('0x4')]=_0x1e981b['serverUrl']||'';this[_0x1a75('0x5')]=_0x1e981b[_0x1a75('0x5')]||{};}module[_0x1a75('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0x5db2=['serverUrl','Configurations','exports','name','username','apiKey','token','remoteUri'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0x5db2,0xf3));var _0x25db=function(_0x3f55af,_0xa5177a){_0x3f55af=_0x3f55af-0x0;var _0x396e7e=_0x5db2[_0x3f55af];return _0x396e7e;};'use strict';function FreshsalesAccount(_0x52acb7){this['id']=_0x52acb7['id']||0x0;this[_0x25db('0x0')]=_0x52acb7[_0x25db('0x0')]||'';this['username']=_0x52acb7[_0x25db('0x1')]||'';this[_0x25db('0x2')]=_0x52acb7[_0x25db('0x3')]||'';this[_0x25db('0x4')]=_0x52acb7[_0x25db('0x4')]||'';this[_0x25db('0x5')]=_0x52acb7[_0x25db('0x5')]||'';this[_0x25db('0x6')]=_0x52acb7[_0x25db('0x6')]||{};}module[_0x25db('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 7498ff6..43100a9 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 _0xb99d=['uniqueid','calleridnum','calleridname','queue','queuecallerabandonAt','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','assigned','routealias','mohtime','variables','exports','type'];(function(_0x3c08ec,_0x360de7){var _0x1fe698=function(_0x1beabc){while(--_0x1beabc){_0x3c08ec['push'](_0x3c08ec['shift']());}};_0x1fe698(++_0x360de7);}(_0xb99d,0xc5));var _0xdb99=function(_0x38ac44,_0x38c414){_0x38ac44=_0x38ac44-0x0;var _0x42e9ae=_0xb99d[_0x38ac44];return _0x42e9ae;};'use strict';function QueueReport(){this[_0xdb99('0x0')]='inbound';this[_0xdb99('0x1')]='';this[_0xdb99('0x2')]='';this[_0xdb99('0x3')]='';this[_0xdb99('0x4')]='';this['queuecallerjoinAt']=null;this['queuecallerleaveAt']=null;this['position']=0x1;this['count']=0x1;this['queuecallerabandon']=![];this[_0xdb99('0x5')]=null;this['queuecallercomplete']=![];this[_0xdb99('0x6')]=null;this[_0xdb99('0x7')]=![];this[_0xdb99('0x8')]=null;this[_0xdb99('0x9')]=0x1;this[_0xdb99('0xa')]='';this[_0xdb99('0xb')]='';this[_0xdb99('0xc')]='';this[_0xdb99('0xd')]='';this[_0xdb99('0xe')]='';this[_0xdb99('0xf')]='';this[_0xdb99('0x10')]='';this['holdtime']=0x0;this[_0xdb99('0x11')]=![];this['lastAssignedTo']='';this['motionChannel']='voice';this[_0xdb99('0x12')]=null;this[_0xdb99('0x13')]=0x0;this[_0xdb99('0x14')]={};}module[_0xdb99('0x15')]=QueueReport; \ No newline at end of file +var _0x64e5=['voice','routealias','mohtime','variables','type','calleridname','queue','position','count','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','motionChannel'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x64e5,0x149));var _0x564e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x64e5[_0x5783f4];return _0x28e380;};'use strict';function QueueReport(){this[_0x564e('0x0')]='inbound';this['uniqueid']='';this['calleridnum']='';this[_0x564e('0x1')]='';this[_0x564e('0x2')]='';this['queuecallerjoinAt']=null;this['queuecallerleaveAt']=null;this[_0x564e('0x3')]=0x1;this[_0x564e('0x4')]=0x1;this['queuecallerabandon']=![];this[_0x564e('0x5')]=null;this[_0x564e('0x6')]=![];this[_0x564e('0x7')]=null;this[_0x564e('0x8')]=![];this[_0x564e('0x9')]=null;this[_0x564e('0xa')]=0x1;this[_0x564e('0xb')]='';this[_0x564e('0xc')]='';this[_0x564e('0xd')]='';this[_0x564e('0xe')]='';this[_0x564e('0xf')]='';this[_0x564e('0x10')]='';this[_0x564e('0x11')]='';this[_0x564e('0x12')]=0x0;this[_0x564e('0x13')]=![];this['lastAssignedTo']='';this[_0x564e('0x14')]=_0x564e('0x15');this[_0x564e('0x16')]=null;this[_0x564e('0x17')]=0x0;this[_0x564e('0x18')]={};}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 f1a0b91..94130df 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 _0x3059=['username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x295148,_0x585dfa){var _0xaf3076=function(_0x43ecd6){while(--_0x43ecd6){_0x295148['push'](_0x295148['shift']());}};_0xaf3076(++_0x585dfa);}(_0x3059,0x1df));var _0x9305=function(_0xede2d3,_0x57a45f){_0xede2d3=_0xede2d3-0x0;var _0x298652=_0x3059[_0xede2d3];return _0x298652;};'use strict';function SalesforceAccount(_0x1ce1c7){this['id']=_0x1ce1c7['id']||0x0;this[_0x9305('0x0')]=_0x1ce1c7[_0x9305('0x0')]||'';this[_0x9305('0x1')]=_0x1ce1c7[_0x9305('0x1')]||'';this['remoteUri']=_0x1ce1c7[_0x9305('0x2')]||'';this[_0x9305('0x3')]=_0x1ce1c7['password']||'';this[_0x9305('0x4')]=_0x1ce1c7[_0x9305('0x4')]||'';this[_0x9305('0x5')]=_0x1ce1c7[_0x9305('0x5')]||'';this[_0x9305('0x6')]=_0x1ce1c7['securityToken']||'';this['type']=_0x1ce1c7[_0x9305('0x7')]||_0x9305('0x8');this['serverUrl']=_0x1ce1c7[_0x9305('0x9')]||'';this[_0x9305('0xa')]=_0x1ce1c7[_0x9305('0xa')]||{};}module[_0x9305('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x5432=['serverUrl','Configurations','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x5432,0xc8));var _0x2543=function(_0xa61fb7,_0x29f8ba){_0xa61fb7=_0xa61fb7-0x0;var _0x237ea1=_0x5432[_0xa61fb7];return _0x237ea1;};'use strict';function SalesforceAccount(_0x4e3f0f){this['id']=_0x4e3f0f['id']||0x0;this[_0x2543('0x0')]=_0x4e3f0f[_0x2543('0x0')]||'';this[_0x2543('0x1')]=_0x4e3f0f[_0x2543('0x1')]||'';this[_0x2543('0x2')]=_0x4e3f0f[_0x2543('0x2')]||'';this[_0x2543('0x3')]=_0x4e3f0f[_0x2543('0x3')]||'';this[_0x2543('0x4')]=_0x4e3f0f[_0x2543('0x4')]||'';this[_0x2543('0x5')]=_0x4e3f0f[_0x2543('0x5')]||'';this['securityToken']=_0x4e3f0f[_0x2543('0x6')]||'';this[_0x2543('0x7')]=_0x4e3f0f[_0x2543('0x7')]||_0x2543('0x8');this[_0x2543('0x9')]=_0x4e3f0f[_0x2543('0x9')]||'';this[_0x2543('0xa')]=_0x4e3f0f[_0x2543('0xa')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 3721e8d..ec29d15 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 _0xaa52=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x12aaf4,_0x38785a){var _0x4d76e0=function(_0x4332f0){while(--_0x4332f0){_0x12aaf4['push'](_0x12aaf4['shift']());}};_0x4d76e0(++_0x38785a);}(_0xaa52,0x187));var _0x2aa5=function(_0x2888e1,_0x29068a){_0x2888e1=_0x2888e1-0x0;var _0x339066=_0xaa52[_0x2888e1];return _0x339066;};'use strict';function ServicenowAccount(_0x3bdc2f){this['id']=_0x3bdc2f['id']||0x0;this[_0x2aa5('0x0')]=_0x3bdc2f[_0x2aa5('0x0')]||'';this[_0x2aa5('0x1')]=_0x3bdc2f[_0x2aa5('0x1')]||'';this[_0x2aa5('0x2')]=_0x3bdc2f[_0x2aa5('0x2')]||'';this['remoteUri']=_0x3bdc2f[_0x2aa5('0x3')]||'';this[_0x2aa5('0x4')]=_0x3bdc2f[_0x2aa5('0x4')]||'';this['Configurations']=_0x3bdc2f[_0x2aa5('0x5')]||{};}module[_0x2aa5('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xc515=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x8962d6,_0x503ed6){var _0x566f25=function(_0x56b0f0){while(--_0x56b0f0){_0x8962d6['push'](_0x8962d6['shift']());}};_0x566f25(++_0x503ed6);}(_0xc515,0x139));var _0x5c51=function(_0x12df55,_0x24a2cf){_0x12df55=_0x12df55-0x0;var _0x2e2b72=_0xc515[_0x12df55];return _0x2e2b72;};'use strict';function ServicenowAccount(_0x5600cc){this['id']=_0x5600cc['id']||0x0;this[_0x5c51('0x0')]=_0x5600cc[_0x5c51('0x0')]||'';this[_0x5c51('0x1')]=_0x5600cc['username']||'';this[_0x5c51('0x2')]=_0x5600cc[_0x5c51('0x2')]||'';this[_0x5c51('0x3')]=_0x5600cc['remoteUri']||'';this[_0x5c51('0x4')]=_0x5600cc['serverUrl']||'';this[_0x5c51('0x5')]=_0x5600cc[_0x5c51('0x5')]||{};}module[_0x5c51('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 08f81c9..37ac51a 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 _0xb8c2=['serverUrl','exports','name','username','remoteUri'];(function(_0x5e422a,_0x45cf44){var _0x501344=function(_0x92d2a4){while(--_0x92d2a4){_0x5e422a['push'](_0x5e422a['shift']());}};_0x501344(++_0x45cf44);}(_0xb8c2,0x1ab));var _0x2b8c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb8c2[_0x321bb2];return _0x9c12ed;};'use strict';function SugarcrmAccount(_0x1ec964){this['id']=_0x1ec964['id']||0x0;this[_0x2b8c('0x0')]=_0x1ec964[_0x2b8c('0x0')]||'';this[_0x2b8c('0x1')]=_0x1ec964[_0x2b8c('0x1')]||'';this['password']=_0x1ec964['password']||'';this[_0x2b8c('0x2')]=_0x1ec964['remoteUri']||'';this[_0x2b8c('0x3')]=_0x1ec964[_0x2b8c('0x3')]||'';this['Configurations']=_0x1ec964['Configurations']||{};}module[_0x2b8c('0x4')]=SugarcrmAccount; \ No newline at end of file +var _0xf0aa=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x45c717,_0x3a1664){var _0x40456a=function(_0x58b6f7){while(--_0x58b6f7){_0x45c717['push'](_0x45c717['shift']());}};_0x40456a(++_0x3a1664);}(_0xf0aa,0x16e));var _0xaf0a=function(_0x535fef,_0x432ad6){_0x535fef=_0x535fef-0x0;var _0x5a8b97=_0xf0aa[_0x535fef];return _0x5a8b97;};'use strict';function SugarcrmAccount(_0x128e0f){this['id']=_0x128e0f['id']||0x0;this['name']=_0x128e0f[_0xaf0a('0x0')]||'';this[_0xaf0a('0x1')]=_0x128e0f[_0xaf0a('0x1')]||'';this[_0xaf0a('0x2')]=_0x128e0f[_0xaf0a('0x2')]||'';this[_0xaf0a('0x3')]=_0x128e0f[_0xaf0a('0x3')]||'';this[_0xaf0a('0x4')]=_0x128e0f[_0xaf0a('0x4')]||'';this[_0xaf0a('0x5')]=_0x128e0f['Configurations']||{};}module[_0xaf0a('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 30b5623..f095a02 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 _0x3a61=['address','exports','accountcode','state','unknown','stateTime','status'];(function(_0x4dd5c6,_0x4d5c81){var _0x56b748=function(_0x373ff4){while(--_0x373ff4){_0x4dd5c6['push'](_0x4dd5c6['shift']());}};_0x56b748(++_0x4d5c81);}(_0x3a61,0xd4));var _0x13a6=function(_0xce8299,_0x55ec18){_0xce8299=_0xce8299-0x0;var _0xa39773=_0x3a61[_0xce8299];return _0xa39773;};'use strict';function Telephone(_0x141625){this['id']=_0x141625['id']||0x0;this['name']=_0x141625['name']||'';this[_0x13a6('0x0')]=_0x141625[_0x13a6('0x0')]||'';this[_0x13a6('0x1')]=_0x13a6('0x2');this[_0x13a6('0x3')]=0x0;this[_0x13a6('0x4')]=_0x13a6('0x2');this[_0x13a6('0x5')]='';}module[_0x13a6('0x6')]=Telephone; \ No newline at end of file +var _0x9809=['state','unknown','stateTime','status','address','name','accountcode'];(function(_0x3a2f50,_0x350213){var _0x12f3a9=function(_0x5cc12f){while(--_0x5cc12f){_0x3a2f50['push'](_0x3a2f50['shift']());}};_0x12f3a9(++_0x350213);}(_0x9809,0x1da));var _0x9980=function(_0xbdf7b7,_0x4ad095){_0xbdf7b7=_0xbdf7b7-0x0;var _0x2578ff=_0x9809[_0xbdf7b7];return _0x2578ff;};'use strict';function Telephone(_0x28f126){this['id']=_0x28f126['id']||0x0;this[_0x9980('0x0')]=_0x28f126[_0x9980('0x0')]||'';this[_0x9980('0x1')]=_0x28f126[_0x9980('0x1')]||'';this[_0x9980('0x2')]=_0x9980('0x3');this[_0x9980('0x4')]=0x0;this[_0x9980('0x5')]=_0x9980('0x3');this[_0x9980('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 e2124e5..56aa321 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(_0xcf9fab,_0x478cc4){var _0xd613fe=function(_0xf5f817){while(--_0xf5f817){_0xcf9fab['push'](_0xcf9fab['shift']());}};_0xd613fe(++_0x478cc4);}(_0xb10b,0x12a));var _0xbb10=function(_0x41d02a,_0x355e19){_0x41d02a=_0x41d02a-0x0;var _0x4c3983=_0xb10b[_0x41d02a];return _0x4c3983;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x27974b,_0xceb48){var _0x1a12df=function(_0x5922b2){while(--_0x5922b2){_0x27974b['push'](_0x27974b['shift']());}};_0x1a12df(++_0xceb48);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 0405f81..bdfb74a 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 _0x0b0e=['channel','voice','status','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1b1a3b,_0x52a88a){_0x1b1a3b=_0x1b1a3b-0x0;var _0x385347=_0x0b0e[_0x1b1a3b];return _0x385347;};'use strict';function Trigger(_0x29cd1e){this['id']=_0x29cd1e['id']||0x0;this['name']=_0x29cd1e[_0xe0b0('0x0')]||'';this['channel']=_0x29cd1e[_0xe0b0('0x1')]||_0xe0b0('0x2');this[_0xe0b0('0x3')]=_0x29cd1e[_0xe0b0('0x3')]||![];this[_0xe0b0('0x4')]=_0x29cd1e[_0xe0b0('0x4')]||[];this[_0xe0b0('0x5')]=_0x29cd1e[_0xe0b0('0x5')]||[];this[_0xe0b0('0x6')]=_0x29cd1e[_0xe0b0('0x6')]||[];}module[_0xe0b0('0x7')]=Trigger; \ No newline at end of file +var _0x5eb8=['Actions','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x2ae8ce,_0x2a5a1f){var _0x4bf686=function(_0x41cabf){while(--_0x41cabf){_0x2ae8ce['push'](_0x2ae8ce['shift']());}};_0x4bf686(++_0x2a5a1f);}(_0x5eb8,0xb0));var _0x85eb=function(_0x19409d,_0xf48905){_0x19409d=_0x19409d-0x0;var _0x5de146=_0x5eb8[_0x19409d];return _0x5de146;};'use strict';function Trigger(_0x5ea4df){this['id']=_0x5ea4df['id']||0x0;this['name']=_0x5ea4df[_0x85eb('0x0')]||'';this[_0x85eb('0x1')]=_0x5ea4df[_0x85eb('0x1')]||_0x85eb('0x2');this[_0x85eb('0x3')]=_0x5ea4df[_0x85eb('0x3')]||![];this[_0x85eb('0x4')]=_0x5ea4df[_0x85eb('0x4')]||[];this[_0x85eb('0x5')]=_0x5ea4df[_0x85eb('0x5')]||[];this[_0x85eb('0x6')]=_0x5ea4df[_0x85eb('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 7fe30dc..bb9a43a 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 _0x93a3=['stateRegistry','address','defaultuser','exports','active','name','state','stateTime','status','unknown','registry','split','host','port','domain'];(function(_0x111394,_0x4b31f8){var _0x4b7106=function(_0x43705d){while(--_0x43705d){_0x111394['push'](_0x111394['shift']());}};_0x4b7106(++_0x4b31f8);}(_0x93a3,0x112));var _0x393a=function(_0x18212e,_0xa0b65c){_0x18212e=_0x18212e-0x0;var _0x1ab331=_0x93a3[_0x18212e];return _0x1ab331;};'use strict';function Trunk(_0x11921d){this['id']=_0x11921d['id']||0x0;this[_0x393a('0x0')]=_0x11921d[_0x393a('0x0')]||![];this[_0x393a('0x1')]=_0x11921d[_0x393a('0x1')]||'';this[_0x393a('0x2')]='unknown';this[_0x393a('0x3')]=0x0;this[_0x393a('0x4')]=_0x393a('0x5');this['registry']=_0x11921d[_0x393a('0x6')]&&_0x11921d['registry']['indexOf'](':')?_0x11921d[_0x393a('0x6')][_0x393a('0x7')](':')[0x0]:'';this[_0x393a('0x8')]='';this[_0x393a('0x9')]='';this[_0x393a('0xa')]='';this['domainport']='';this['refresh']='';this[_0x393a('0xb')]=_0x393a('0x5');this['registrationtime']='';this[_0x393a('0xc')]='';this[_0x393a('0xd')]=_0x11921d['defaultuser']||'';}module[_0x393a('0xe')]=Trunk; \ No newline at end of file +var _0xf09a=['port','domain','domainport','stateRegistry','registrationtime','address','defaultuser','exports','active','name','unknown','stateTime','registry','indexOf','split'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0xf09a,0x143));var _0xaf09=function(_0x3bcf9e,_0x148a5d){_0x3bcf9e=_0x3bcf9e-0x0;var _0x1bb37c=_0xf09a[_0x3bcf9e];return _0x1bb37c;};'use strict';function Trunk(_0x30a67c){this['id']=_0x30a67c['id']||0x0;this[_0xaf09('0x0')]=_0x30a67c[_0xaf09('0x0')]||![];this[_0xaf09('0x1')]=_0x30a67c[_0xaf09('0x1')]||'';this['state']=_0xaf09('0x2');this[_0xaf09('0x3')]=0x0;this['status']='unknown';this[_0xaf09('0x4')]=_0x30a67c[_0xaf09('0x4')]&&_0x30a67c['registry'][_0xaf09('0x5')](':')?_0x30a67c[_0xaf09('0x4')][_0xaf09('0x6')](':')[0x0]:'';this['host']='';this[_0xaf09('0x7')]='';this[_0xaf09('0x8')]='';this[_0xaf09('0x9')]='';this['refresh']='';this[_0xaf09('0xa')]=_0xaf09('0x2');this[_0xaf09('0xb')]='';this[_0xaf09('0xc')]='';this[_0xaf09('0xd')]=_0x30a67c['defaultuser']||'';}module[_0xaf09('0xe')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 4597d3f..b6f6a0a 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 _0x3ec1=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x22521d,_0x5a1982){var _0x370439=function(_0xe40491){while(--_0xe40491){_0x22521d['push'](_0x22521d['shift']());}};_0x370439(++_0x5a1982);}(_0x3ec1,0x160));var _0x13ec=function(_0x270eac,_0x5d3d11){_0x270eac=_0x270eac-0x0;var _0x54f346=_0x3ec1[_0x270eac];return _0x54f346;};'use strict';function voiceExtension(_0x335338){this['id']=_0x335338['id']||0x0;this['exten']=_0x335338[_0x13ec('0x0')]||'';this[_0x13ec('0x1')]=_0x335338[_0x13ec('0x1')]||_0x13ec('0x2');this['mandatoryDisposition']=_0x335338[_0x13ec('0x3')]||![];}module[_0x13ec('0x4')]=voiceExtension; \ No newline at end of file +var _0x28a3=['none','mandatoryDisposition','exports','exten'];(function(_0x3cd846,_0x488086){var _0x4e89e4=function(_0x125408){while(--_0x125408){_0x3cd846['push'](_0x3cd846['shift']());}};_0x4e89e4(++_0x488086);}(_0x28a3,0x1c7));var _0x328a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x28a3[_0x42cae2];return _0x5f256f;};'use strict';function voiceExtension(_0x3c38d0){this['id']=_0x3c38d0['id']||0x0;this[_0x328a('0x0')]=_0x3c38d0['exten']||'';this['recordingFormat']=_0x3c38d0['recordingFormat']||_0x328a('0x1');this[_0x328a('0x2')]=_0x3c38d0[_0x328a('0x2')]||![];}module[_0x328a('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index eb425a1..5660dac 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 _0x9e8a=['predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','fewestcalls','leastrecent','linear','random','ringall','roundrobin','name','monitor_format','type','inbound','waiting','total','answered','sumHoldTime','sumBillable','unmanaged','abandoned','busy','inUse','invalid','loggedIn','notInUse','onHold','paused','ringing','talking','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCallsDroppedCalls'];(function(_0xc9b988,_0x429150){var _0x5f14fe=function(_0x5c76a8){while(--_0x5c76a8){_0xc9b988['push'](_0xc9b988['shift']());}};_0x5f14fe(++_0x429150);}(_0x9e8a,0x112));var _0xa9e8=function(_0x22f303,_0x1d6034){_0x22f303=_0x22f303-0x0;var _0x295071=_0x9e8a[_0x22f303];return _0x295071;};'use strict';var monitorFormat={'wav':_0xa9e8('0x0'),'wav49':_0xa9e8('0x1'),'gsm':_0xa9e8('0x2')};var strategy={'fewestcalls':_0xa9e8('0x3'),'leastrecent':_0xa9e8('0x4'),'linear':_0xa9e8('0x5'),'random':_0xa9e8('0x6'),'ringall':_0xa9e8('0x7'),'rr':_0xa9e8('0x8'),'rrmemory':'rrmemory','rrordered':'rrordered','wrandom':'wrandom'};function VoiceQueue(_0x5272b7){this['id']=_0x5272b7['id']||0x0;this[_0xa9e8('0x9')]=_0x5272b7[_0xa9e8('0x9')]||'';this[_0xa9e8('0xa')]=_0x5272b7[_0xa9e8('0xa')]||'';this[_0xa9e8('0xb')]=_0x5272b7['type']||_0xa9e8('0xc');this[_0xa9e8('0xd')]=0x0;this[_0xa9e8('0xe')]=0x0;this[_0xa9e8('0xf')]=0x0;this['sumDuration']=0x0;this[_0xa9e8('0x10')]=0x0;this[_0xa9e8('0x11')]=0x0;this[_0xa9e8('0x12')]=0x0;this[_0xa9e8('0x13')]=0x0;this['available']=0x0;this[_0xa9e8('0x14')]=0x0;this[_0xa9e8('0x15')]=0x0;this[_0xa9e8('0x16')]=0x0;this[_0xa9e8('0x17')]=0x0;this[_0xa9e8('0x18')]=0x0;this[_0xa9e8('0x19')]=0x0;this[_0xa9e8('0x1a')]=0x0;this[_0xa9e8('0x1b')]=0x0;this['ringInUse']=0x0;this[_0xa9e8('0x1c')]=0x0;this['unavailable']=0x0;this['unknown']=0x0;this['acw']=_0x5272b7['acw']||![];this['acwTimeout']=_0x5272b7[_0xa9e8('0x1d')]||0xa;this[_0xa9e8('0x1e')]=_0x5272b7[_0xa9e8('0x1e')]||'no';this[_0xa9e8('0x1f')]=!![];this[_0xa9e8('0x20')]='';this[_0xa9e8('0x21')]='';this[_0xa9e8('0x22')]=0x0;this[_0xa9e8('0x23')]=0x0;this['dialTimezone']=_0x5272b7['dialTimezone']||null;this['dialGlobalInterval']=_0x5272b7[_0xa9e8('0x24')]?_0x5272b7[_0xa9e8('0x24')]:null;this[_0xa9e8('0x25')]=_0x5272b7['dialActive'];this[_0xa9e8('0x26')]=_0x5272b7[_0xa9e8('0x26')]||_0xa9e8('0x27');this[_0xa9e8('0x28')]=_0x5272b7[_0xa9e8('0x28')]||0x0;this[_0xa9e8('0x29')]=_0x5272b7[_0xa9e8('0x29')]||0x0;this[_0xa9e8('0x2a')]=_0x5272b7[_0xa9e8('0x2a')]||0x1;this[_0xa9e8('0x2b')]=_0x5272b7[_0xa9e8('0x2b')]||'dropRate';this['dialPredictiveOptimizationPercentage']=_0x5272b7[_0xa9e8('0x2c')]||0.03;this[_0xa9e8('0x2d')]=_0x5272b7[_0xa9e8('0x2d')]||0x258;this[_0xa9e8('0x2e')]=_0x5272b7[_0xa9e8('0x2e')]||'anonymous';this[_0xa9e8('0x2f')]=_0x5272b7['dialOriginateCallerIdNumber']||_0xa9e8('0x30');this[_0xa9e8('0x31')]=_0x5272b7[_0xa9e8('0x31')]||0x1e;this[_0xa9e8('0x32')]=_0x5272b7[_0xa9e8('0x32')]||_0xa9e8('0x33');this['dialQueueTimeout']=_0x5272b7[_0xa9e8('0x34')]||0x3;this['dialQueueProject']=_0x5272b7[_0xa9e8('0x35')]||undefined;this[_0xa9e8('0x36')]=_0x5272b7['dialCongestionMaxRetry']||0x3;this[_0xa9e8('0x37')]=_0x5272b7['dialCongestionRetryFrequency']||0x96;this[_0xa9e8('0x38')]=_0x5272b7[_0xa9e8('0x38')]||0x3;this[_0xa9e8('0x39')]=_0x5272b7['dialBusyRetryFrequency']||0x96;this[_0xa9e8('0x3a')]=_0x5272b7['dialNoAnswerMaxRetry']||0x3;this[_0xa9e8('0x3b')]=_0x5272b7[_0xa9e8('0x3b')]||0x96;this[_0xa9e8('0x3c')]=_0x5272b7[_0xa9e8('0x3c')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x5272b7[_0xa9e8('0x3d')]||0x96;this[_0xa9e8('0x3e')]=_0x5272b7[_0xa9e8('0x3e')]||0x3;this['dialDropRetryFrequency']=_0x5272b7[_0xa9e8('0x3f')]||0x96;this['dialAbandonedMaxRetry']=_0x5272b7[_0xa9e8('0x40')]||0x3;this[_0xa9e8('0x41')]=_0x5272b7[_0xa9e8('0x41')]||0x96;this[_0xa9e8('0x42')]=_0x5272b7[_0xa9e8('0x42')]||0x3;this[_0xa9e8('0x43')]=_0x5272b7[_0xa9e8('0x43')]||0x96;this[_0xa9e8('0x44')]=_0x5272b7[_0xa9e8('0x44')]||0x3;this[_0xa9e8('0x45')]=_0x5272b7[_0xa9e8('0x45')]||0x96;this[_0xa9e8('0x46')]=_0x5272b7[_0xa9e8('0x46')]||0x3;this['dialGlobalMaxRetry']=_0x5272b7[_0xa9e8('0x47')]||0x4;this[_0xa9e8('0x48')]=_0x5272b7[_0xa9e8('0x48')]?_0x5272b7['Trunk']:undefined;this['TrunkBackup']=_0x5272b7[_0xa9e8('0x49')]?_0x5272b7[_0xa9e8('0x49')]:undefined;this[_0xa9e8('0x4a')]=_0x5272b7[_0xa9e8('0x4a')]||undefined;this[_0xa9e8('0x4b')]=_0x5272b7[_0xa9e8('0x4b')]?_0x5272b7[_0xa9e8('0x4b')]:undefined;this[_0xa9e8('0x4c')]=_0x5272b7[_0xa9e8('0x4c')]||_0xa9e8('0x4d');this[_0xa9e8('0x4e')]=_0x5272b7[_0xa9e8('0x4e')]||undefined;this[_0xa9e8('0x4f')]=_0x5272b7[_0xa9e8('0x4f')]||undefined;this[_0xa9e8('0x50')]=strategy[_0x5272b7[_0xa9e8('0x50')]];this[_0xa9e8('0x51')]=!![];this[_0xa9e8('0x52')]=_0x5272b7[_0xa9e8('0x52')]||![];this['dialAMDInitialSilence']=_0x5272b7['dialAMDInitialSilence'];this[_0xa9e8('0x53')]=_0x5272b7['dialAMDGreeting'];this[_0xa9e8('0x54')]=_0x5272b7[_0xa9e8('0x54')];this[_0xa9e8('0x55')]=_0x5272b7[_0xa9e8('0x55')];this[_0xa9e8('0x56')]=_0x5272b7['dialAMDMinWordLength'];this[_0xa9e8('0x57')]=_0x5272b7[_0xa9e8('0x57')];this[_0xa9e8('0x58')]=_0x5272b7[_0xa9e8('0x58')];this[_0xa9e8('0x59')]=_0x5272b7[_0xa9e8('0x59')];this[_0xa9e8('0x5a')]=_0x5272b7[_0xa9e8('0x5a')];this[_0xa9e8('0x5b')]=0x0;this[_0xa9e8('0x5c')]=0x0;this[_0xa9e8('0x5d')]=_0x5272b7[_0xa9e8('0x5d')];this[_0xa9e8('0x5e')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0xa9e8('0x5f')]=0x0;this[_0xa9e8('0x60')]=0x0;this[_0xa9e8('0x61')]=0x0;this[_0xa9e8('0x62')]=0x0;this[_0xa9e8('0x63')]=0x0;this['outboundBlacklistCallsDay']=0x0;this['outboundOriginateFailureCallsDay']=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xa9e8('0x64')]=0x0;this[_0xa9e8('0x65')]=0x0;this[_0xa9e8('0x66')]=0x0;this[_0xa9e8('0x67')]=0x0;this['startProgressive']=undefined;this[_0xa9e8('0x68')]=undefined;this[_0xa9e8('0x69')]=undefined;this[_0xa9e8('0x6a')]=1.05;this[_0xa9e8('0x6b')]=0x0;this[_0xa9e8('0x6c')]=0x0;this[_0xa9e8('0x6d')]=0x0;this[_0xa9e8('0x6e')]=0x0;this[_0xa9e8('0x6f')]=0x0;this[_0xa9e8('0x70')]=0x0;this['predictiveIntervalPauses']=0x0;this['predictiveIntervalAvailable']=0x0;this[_0xa9e8('0x71')]=_0x5272b7['dialPredictiveIntervalMaxThreshold']||0x14;this['predictiveIntervalMinThreshold']=_0x5272b7[_0xa9e8('0x72')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0xa9e8('0x73')]=0x0;this[_0xa9e8('0x74')]=0x1;this[_0xa9e8('0x75')]=0x0;this['erlangCallToSecond']=0x0;this[_0xa9e8('0x76')]=0x0;this[_0xa9e8('0x77')]=0x0;this[_0xa9e8('0x78')]=_0x5272b7['dialRecallMeTimeout']||0x1e;this[_0xa9e8('0x79')]=_0x5272b7[_0xa9e8('0x79')]||![];this['dialPreviewAutoRecallMe']=!!_0x5272b7[_0xa9e8('0x7a')]||![];this['dialPreviewRecallmeReminder']=!!_0x5272b7['dialPreviewRecallmeReminder']||![];this[_0xa9e8('0x7b')]=_0x5272b7[_0xa9e8('0x7b')]||undefined;this[_0xa9e8('0x7c')]=_0x5272b7[_0xa9e8('0x7c')]||![];this[_0xa9e8('0x7d')]=_0x5272b7[_0xa9e8('0x7d')]||![];this['monitor_format']=monitorFormat[_0x5272b7[_0xa9e8('0xa')]]?monitorFormat[_0x5272b7[_0xa9e8('0xa')]]:undefined;this[_0xa9e8('0x7e')]=_0x5272b7[_0xa9e8('0x7e')]||![];this[_0xa9e8('0x7f')]=_0x5272b7[_0xa9e8('0x7f')]?_0x5272b7[_0xa9e8('0x7f')]:undefined;this[_0xa9e8('0x80')]=![];}module[_0xa9e8('0x81')]=VoiceQueue; \ No newline at end of file +var _0xfcd2=['dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','wav','wav49','gsm','fewestcalls','leastrecent','linear','ringall','roundrobin','rrmemory','wrandom','name','monitor_format','type','inbound','total','sumDuration','sumHoldTime','sumBillable','abandoned','available','busy','inUse','invalid','loggedIn','notInUse','paused','ringing','ringInUse','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry'];(function(_0x3aaeda,_0x268877){var _0x2b2922=function(_0x218a62){while(--_0x218a62){_0x3aaeda['push'](_0x3aaeda['shift']());}};_0x2b2922(++_0x268877);}(_0xfcd2,0x13f));var _0x2fcd=function(_0x463a3f,_0x511234){_0x463a3f=_0x463a3f-0x0;var _0x323ace=_0xfcd2[_0x463a3f];return _0x323ace;};'use strict';var monitorFormat={'wav':_0x2fcd('0x0'),'wav49':_0x2fcd('0x1'),'gsm':_0x2fcd('0x2')};var strategy={'fewestcalls':_0x2fcd('0x3'),'leastrecent':_0x2fcd('0x4'),'linear':_0x2fcd('0x5'),'random':'random','ringall':_0x2fcd('0x6'),'rr':_0x2fcd('0x7'),'rrmemory':_0x2fcd('0x8'),'rrordered':'rrordered','wrandom':_0x2fcd('0x9')};function VoiceQueue(_0x565777){this['id']=_0x565777['id']||0x0;this[_0x2fcd('0xa')]=_0x565777['name']||'';this[_0x2fcd('0xb')]=_0x565777[_0x2fcd('0xb')]||'';this[_0x2fcd('0xc')]=_0x565777['type']||_0x2fcd('0xd');this['waiting']=0x0;this[_0x2fcd('0xe')]=0x0;this['answered']=0x0;this[_0x2fcd('0xf')]=0x0;this[_0x2fcd('0x10')]=0x0;this[_0x2fcd('0x11')]=0x0;this['unmanaged']=0x0;this[_0x2fcd('0x12')]=0x0;this[_0x2fcd('0x13')]=0x0;this[_0x2fcd('0x14')]=0x0;this[_0x2fcd('0x15')]=0x0;this[_0x2fcd('0x16')]=0x0;this[_0x2fcd('0x17')]=0x0;this[_0x2fcd('0x18')]=0x0;this['onHold']=0x0;this[_0x2fcd('0x19')]=0x0;this[_0x2fcd('0x1a')]=0x0;this[_0x2fcd('0x1b')]=0x0;this['talking']=0x0;this[_0x2fcd('0x1c')]=0x0;this[_0x2fcd('0x1d')]=0x0;this[_0x2fcd('0x1e')]=_0x565777[_0x2fcd('0x1e')]||![];this[_0x2fcd('0x1f')]=_0x565777[_0x2fcd('0x1f')]||0xa;this[_0x2fcd('0x20')]=_0x565777[_0x2fcd('0x20')]||'no';this[_0x2fcd('0x21')]=!![];this[_0x2fcd('0x22')]='';this[_0x2fcd('0x23')]='';this['originated']=0x0;this[_0x2fcd('0x24')]=0x0;this['dialTimezone']=_0x565777[_0x2fcd('0x25')]||null;this[_0x2fcd('0x26')]=_0x565777[_0x2fcd('0x26')]?_0x565777[_0x2fcd('0x26')]:null;this['dialActive']=_0x565777[_0x2fcd('0x27')];this['dialMethod']=_0x565777[_0x2fcd('0x28')]||_0x2fcd('0x29');this[_0x2fcd('0x2a')]=_0x565777[_0x2fcd('0x2a')]||0x0;this[_0x2fcd('0x2b')]=_0x565777['dialLimitQueue']||0x0;this[_0x2fcd('0x2c')]=_0x565777[_0x2fcd('0x2c')]||0x1;this['dialPredictiveOptimization']=_0x565777['dialPredictiveOptimization']||_0x2fcd('0x2d');this[_0x2fcd('0x2e')]=_0x565777[_0x2fcd('0x2e')]||0.03;this[_0x2fcd('0x2f')]=_0x565777[_0x2fcd('0x2f')]||0x258;this['dialOriginateCallerIdName']=_0x565777[_0x2fcd('0x30')]||_0x2fcd('0x31');this['dialOriginateCallerIdNumber']=_0x565777[_0x2fcd('0x32')]||_0x2fcd('0x31');this[_0x2fcd('0x33')]=_0x565777['dialOriginateTimeout']||0x1e;this['dialQueueOptions']=_0x565777['dialQueueOptions']||_0x2fcd('0x34');this[_0x2fcd('0x35')]=_0x565777[_0x2fcd('0x35')]||0x3;this[_0x2fcd('0x36')]=_0x565777[_0x2fcd('0x36')]||undefined;this[_0x2fcd('0x37')]=_0x565777[_0x2fcd('0x37')]||0x3;this['dialCongestionRetryFrequency']=_0x565777[_0x2fcd('0x38')]||0x96;this[_0x2fcd('0x39')]=_0x565777[_0x2fcd('0x39')]||0x3;this['dialBusyRetryFrequency']=_0x565777['dialBusyRetryFrequency']||0x96;this[_0x2fcd('0x3a')]=_0x565777['dialNoAnswerMaxRetry']||0x3;this[_0x2fcd('0x3b')]=_0x565777[_0x2fcd('0x3b')]||0x96;this[_0x2fcd('0x3c')]=_0x565777[_0x2fcd('0x3c')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x565777[_0x2fcd('0x3d')]||0x96;this[_0x2fcd('0x3e')]=_0x565777[_0x2fcd('0x3e')]||0x3;this[_0x2fcd('0x3f')]=_0x565777['dialDropRetryFrequency']||0x96;this[_0x2fcd('0x40')]=_0x565777[_0x2fcd('0x40')]||0x3;this['dialAbandonedRetryFrequency']=_0x565777['dialAbandonedRetryFrequency']||0x96;this[_0x2fcd('0x41')]=_0x565777[_0x2fcd('0x41')]||0x3;this[_0x2fcd('0x42')]=_0x565777[_0x2fcd('0x42')]||0x96;this[_0x2fcd('0x43')]=_0x565777['dialAgentRejectMaxRetry']||0x3;this[_0x2fcd('0x44')]=_0x565777[_0x2fcd('0x44')]||0x96;this[_0x2fcd('0x45')]=_0x565777['callAdditionalPhoneAfterMin']||0x3;this[_0x2fcd('0x46')]=_0x565777[_0x2fcd('0x46')]||0x4;this[_0x2fcd('0x47')]=_0x565777[_0x2fcd('0x47')]?_0x565777[_0x2fcd('0x47')]:undefined;this[_0x2fcd('0x48')]=_0x565777[_0x2fcd('0x48')]?_0x565777['TrunkBackup']:undefined;this[_0x2fcd('0x49')]=_0x565777['dialPrefix']||undefined;this[_0x2fcd('0x4a')]=_0x565777[_0x2fcd('0x4a')]?_0x565777[_0x2fcd('0x4a')]:undefined;this[_0x2fcd('0x4b')]=_0x565777[_0x2fcd('0x4b')]||'DESC';this[_0x2fcd('0x4c')]=_0x565777[_0x2fcd('0x4c')]||undefined;this[_0x2fcd('0x4d')]=_0x565777[_0x2fcd('0x4d')]||undefined;this[_0x2fcd('0x4e')]=strategy[_0x565777[_0x2fcd('0x4e')]];this[_0x2fcd('0x4f')]=!![];this[_0x2fcd('0x50')]=_0x565777[_0x2fcd('0x50')]||![];this[_0x2fcd('0x51')]=_0x565777['dialAMDInitialSilence'];this[_0x2fcd('0x52')]=_0x565777[_0x2fcd('0x52')];this[_0x2fcd('0x53')]=_0x565777['dialAMDAfterGreetingSilence'];this[_0x2fcd('0x54')]=_0x565777[_0x2fcd('0x54')];this[_0x2fcd('0x55')]=_0x565777[_0x2fcd('0x55')];this[_0x2fcd('0x56')]=_0x565777[_0x2fcd('0x56')];this[_0x2fcd('0x57')]=_0x565777[_0x2fcd('0x57')];this[_0x2fcd('0x58')]=_0x565777[_0x2fcd('0x58')];this[_0x2fcd('0x59')]=_0x565777['dialAMDMaximumWordLength'];this['outboundRejectCallsDay']=0x0;this[_0x2fcd('0x5a')]=0x0;this[_0x2fcd('0x5b')]=_0x565777['timeout'];this[_0x2fcd('0x5c')]=0x0;this[_0x2fcd('0x5d')]=0x0;this[_0x2fcd('0x5e')]=0x0;this[_0x2fcd('0x5f')]=0x0;this[_0x2fcd('0x60')]=0x0;this[_0x2fcd('0x61')]=0x0;this[_0x2fcd('0x62')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x2fcd('0x63')]=0x0;this[_0x2fcd('0x64')]=0x0;this[_0x2fcd('0x65')]=0x0;this[_0x2fcd('0x66')]=0x0;this[_0x2fcd('0x67')]=0x0;this[_0x2fcd('0x68')]=0x0;this[_0x2fcd('0x69')]=undefined;this['startPredictive']=undefined;this[_0x2fcd('0x6a')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x2fcd('0x6b')]=0x0;this[_0x2fcd('0x6c')]=0x0;this[_0x2fcd('0x6d')]=0x0;this[_0x2fcd('0x6e')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x2fcd('0x6f')]=0x0;this[_0x2fcd('0x70')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x2fcd('0x71')]=_0x565777[_0x2fcd('0x72')]||0x14;this[_0x2fcd('0x73')]=_0x565777['dialPredictiveIntervalMaxThreshold']||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x2fcd('0x74')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x2fcd('0x75')]=0x0;this[_0x2fcd('0x76')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x2fcd('0x77')]=0x0;this[_0x2fcd('0x78')]=_0x565777['dialRecallMeTimeout']||0x1e;this[_0x2fcd('0x79')]=_0x565777[_0x2fcd('0x79')]||![];this[_0x2fcd('0x7a')]=!!_0x565777[_0x2fcd('0x7a')]||![];this[_0x2fcd('0x7b')]=!!_0x565777[_0x2fcd('0x7b')]||![];this[_0x2fcd('0x7c')]=_0x565777[_0x2fcd('0x7c')]||undefined;this['dialAgiAfterHangupClient']=_0x565777['dialAgiAfterHangupClient']||![];this[_0x2fcd('0x7d')]=_0x565777[_0x2fcd('0x7d')]||![];this['monitor_format']=monitorFormat[_0x565777[_0x2fcd('0xb')]]?monitorFormat[_0x565777[_0x2fcd('0xb')]]:undefined;this['mandatoryDisposition']=_0x565777[_0x2fcd('0x7e')]||![];this[_0x2fcd('0x7f')]=_0x565777[_0x2fcd('0x7f')]?_0x565777[_0x2fcd('0x7f')]:undefined;this[_0x2fcd('0x80')]=![];}module['exports']=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 7c7b75b..f5675be 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 _0xfd0f=['outboundRejectCallsDay','outboundUnknownCallsDay','sumBillable','sumDuration','name','strategy','abandoned','answered','invalid','onHold','notInUse','ringInUse','sumHoldTime','total','type','unavailable','unknown','unmanaged','waiting','outbound','pTalking','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','callerid','prototype','createReport','busy','loggedin','callers','length','SIP/','online','incall','includes','status','booked','keys','queue','exten','xcally-motion-preview','compareToInboundQueue','compareToOutboundQueue','some','active','updateReportFromOutboundQueue','preview','available','loggedIn','paused','ringing','talking','inUse','loggedInDb','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundReCallsDay'];(function(_0x3e719b,_0xa44458){var _0x20740d=function(_0x22626b){while(--_0x22626b){_0x3e719b['push'](_0x3e719b['shift']());}};_0x20740d(++_0xa44458);}(_0xfd0f,0x1b8));var _0xffd0=function(_0xa0e4d9,_0x456bff){_0xa0e4d9=_0xa0e4d9-0x0;var _0x958984=_0xfd0f[_0xa0e4d9];return _0x958984;};'use strict';var INBOUND_COUNTERS=[_0xffd0('0x0'),_0xffd0('0x1'),'loggedInDb',_0xffd0('0x2'),_0xffd0('0x3'),_0xffd0('0x4'),'waiting'];var OUTBOUND_COUNTERS=[_0xffd0('0x0'),'answered',_0xffd0('0x5'),_0xffd0('0x1'),_0xffd0('0x6'),_0xffd0('0x7'),_0xffd0('0x8'),_0xffd0('0x9'),_0xffd0('0xa'),_0xffd0('0xb'),_0xffd0('0xc'),'outboundNoAnswerCallsDay',_0xffd0('0xd'),_0xffd0('0xe'),_0xffd0('0xf'),_0xffd0('0x10'),'paused','pTalking',_0xffd0('0x4'),_0xffd0('0x11'),_0xffd0('0x12'),'total','waiting'];function VoiceQueueSummary(_0xa824cc){this['id']=_0xa824cc['id'];this[_0xffd0('0x13')]=_0xa824cc['name'];this[_0xffd0('0x14')]=_0xa824cc[_0xffd0('0x14')];this[_0xffd0('0x15')]=_0xa824cc['abandoned']||0x0;this[_0xffd0('0x16')]=_0xa824cc[_0xffd0('0x16')]||0x0;this['available']=_0xa824cc[_0xffd0('0x0')]||0x0;this['busy']=_0xa824cc['busy']||0x0;this[_0xffd0('0x5')]=_0xa824cc['inUse']||0x0;this[_0xffd0('0x17')]=_0xa824cc[_0xffd0('0x17')]||0x0;this[_0xffd0('0x1')]=_0xa824cc[_0xffd0('0x1')]||0x0;this[_0xffd0('0x6')]=_0xa824cc['loggedInDb']||0x0;this['onHold']=_0xa824cc[_0xffd0('0x18')]||0x0;this[_0xffd0('0x19')]=_0xa824cc[_0xffd0('0x19')]||0x0;this[_0xffd0('0x2')]=_0xa824cc[_0xffd0('0x2')]||0x0;this[_0xffd0('0x3')]=_0xa824cc[_0xffd0('0x3')]||0x0;this[_0xffd0('0x1a')]=_0xa824cc[_0xffd0('0x1a')];this[_0xffd0('0x11')]=_0xa824cc[_0xffd0('0x11')];this[_0xffd0('0x12')]=_0xa824cc[_0xffd0('0x12')];this[_0xffd0('0x1b')]=_0xa824cc[_0xffd0('0x1b')]||0x0;this[_0xffd0('0x4')]=_0xa824cc['talking']||0x0;this['total']=_0xa824cc[_0xffd0('0x1c')]||0x0;this[_0xffd0('0x1d')]=_0xa824cc[_0xffd0('0x1d')];this['unavailable']=_0xa824cc[_0xffd0('0x1e')]||0x0;this['unknown']=_0xa824cc[_0xffd0('0x1f')]||0x0;this[_0xffd0('0x20')]=_0xa824cc[_0xffd0('0x20')]||0x0;this[_0xffd0('0x21')]=_0xa824cc[_0xffd0('0x21')]||0x0;if(_0xa824cc[_0xffd0('0x1d')]===_0xffd0('0x22')){this[_0xffd0('0x23')]=_0xa824cc[_0xffd0('0x23')]||0x0;this[_0xffd0('0x24')]=_0xa824cc[_0xffd0('0x24')];this[_0xffd0('0x25')]=_0xa824cc[_0xffd0('0x25')];this['dialOriginateCallerIdName']=_0xa824cc['dialOriginateCallerIdName'];this[_0xffd0('0x26')]=_0xa824cc['dialOriginateCallerIdNumber'];this['dialOriginateTimeout']=_0xa824cc[_0xffd0('0x27')];this[_0xffd0('0x28')]=_0xa824cc[_0xffd0('0x28')];this[_0xffd0('0x29')]=_0xa824cc[_0xffd0('0x29')];this[_0xffd0('0x2a')]=_0xa824cc['outboundAnswerAgiCallsDay'];this[_0xffd0('0x9')]=_0xa824cc['outboundAnswerCallsDay'];this['outboundBlacklistCallsDay']=_0xa824cc['outboundBlacklistCallsDay'];this[_0xffd0('0xb')]=_0xa824cc[_0xffd0('0xb')];this[_0xffd0('0xc')]=_0xa824cc[_0xffd0('0xc')];this[_0xffd0('0x2b')]=_0xa824cc[_0xffd0('0x2b')];this['outboundDropCallsDayCallersExit']=_0xa824cc['outboundDropCallsDayCallersExit'];this['outboundDropCallsDayTimeout']=_0xa824cc[_0xffd0('0x2c')];this['outboundNoAnswerCallsDay']=_0xa824cc[_0xffd0('0x2d')];this[_0xffd0('0xd')]=_0xa824cc['outboundNoSuchCallsDay'];this[_0xffd0('0x2e')]=_0xa824cc['outboundOriginateFailureCallsDay'];this['outboundReCallsDay']=_0xa824cc['outboundReCallsDay'];this[_0xffd0('0xf')]=_0xa824cc[_0xffd0('0xf')];this[_0xffd0('0x10')]=_0xa824cc[_0xffd0('0x10')];this[_0xffd0('0x2f')]=_0xa824cc['predictiveIntervalAnsweredCalls'];this[_0xffd0('0x30')]=_0xa824cc[_0xffd0('0x30')];this['predictiveIntervalAvgTalktime']=_0xa824cc[_0xffd0('0x31')];this[_0xffd0('0x32')]=_0xa824cc[_0xffd0('0x32')];this[_0xffd0('0x33')]=_0xa824cc[_0xffd0('0x33')];this[_0xffd0('0x34')]=_0xa824cc['predictiveIntervalErlangCalls'];this[_0xffd0('0x35')]=_0xa824cc[_0xffd0('0x35')];this['predictiveIntervalHitRate']=_0xa824cc[_0xffd0('0x36')];this[_0xffd0('0x37')]=_0xa824cc['predictiveIntervalMultiplicativeFactor'];this[_0xffd0('0x38')]=_0xa824cc[_0xffd0('0x38')];this['predictiveIntervalAvailable']=_0xa824cc[_0xffd0('0x39')];this['predictiveIntervalTotalCalls']=_0xa824cc[_0xffd0('0x3a')];this[_0xffd0('0x7')]=_0xa824cc['originated'];this[_0xffd0('0x3b')]=_0xa824cc[_0xffd0('0x3b')];this[_0xffd0('0x3c')]=_0xa824cc[_0xffd0('0x3c')];this[_0xffd0('0x3d')]=_0xa824cc[_0xffd0('0x3d')];this[_0xffd0('0x3e')]=_0xa824cc[_0xffd0('0x3e')];this[_0xffd0('0x3f')]=_0xa824cc[_0xffd0('0x3f')];this[_0xffd0('0x40')]=_0xa824cc[_0xffd0('0x40')];this[_0xffd0('0x41')]=_0xa824cc[_0xffd0('0x41')];this[_0xffd0('0x42')]=_0xa824cc[_0xffd0('0x42')];}if(_0xa824cc[_0xffd0('0x43')]){this['Trunk']={'id':_0xa824cc[_0xffd0('0x43')]['id'],'name':_0xa824cc[_0xffd0('0x43')][_0xffd0('0x13')],'active':_0xa824cc[_0xffd0('0x43')]['active'],'callerid':_0xa824cc['Trunk'][_0xffd0('0x44')]};}}VoiceQueueSummary[_0xffd0('0x45')][_0xffd0('0x46')]=function(_0xc0aa,_0x47e2f3,_0x38980a,_0x129362){this[_0xffd0('0x6')]=0x0;this[_0xffd0('0x4')]=0x0;this[_0xffd0('0x2')]=0x0;this[_0xffd0('0x1f')]=0x0;this[_0xffd0('0x19')]=0x0;this[_0xffd0('0x5')]=0x0;this[_0xffd0('0x47')]=0x0;this[_0xffd0('0x17')]=0x0;this[_0xffd0('0x1e')]=0x0;this[_0xffd0('0x3')]=0x0;this[_0xffd0('0x1a')]=0x0;this[_0xffd0('0x18')]=0x0;if(_0x38980a){if(_0x38980a[_0xffd0('0x0')]){this[_0xffd0('0x0')]=Number(_0x38980a[_0xffd0('0x0')]);}if(_0x38980a[_0xffd0('0x48')]){this[_0xffd0('0x1')]=Number(_0x38980a[_0xffd0('0x48')]);}if(_0x38980a[_0xffd0('0x49')]){this['waiting']=Number(_0x38980a[_0xffd0('0x49')]);}}for(var _0x46832f=0x0;_0x46832f<_0xc0aa[_0xffd0('0x4a')];_0x46832f++){var _0x35ce9b=_0x47e2f3[_0xffd0('0x4b')+_0xc0aa[_0x46832f][_0xffd0('0x13')]];if(_0x35ce9b&&_0x35ce9b[_0xffd0('0x4c')]){this[_0xffd0('0x6')]+=0x1;}if(_0xc0aa[_0x46832f][_0xffd0('0x4d')]==='1'){this['talking']+=0x1;}if(_0xc0aa[_0x46832f][_0xffd0('0x2')]==='1'&&!['2','7','8'][_0xffd0('0x4e')](_0xc0aa[_0x46832f][_0xffd0('0x4f')])){this[_0xffd0('0x2')]+=0x1;}switch(_0xc0aa[_0x46832f][_0xffd0('0x4f')]){case'0':this['unknown']+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0xffd0('0x47')]+=0x1;break;case'4':this[_0xffd0('0x17')]+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this[_0xffd0('0x3')]+=0x1;break;case'7':this[_0xffd0('0x1a')]+=0x1;break;case'8':this[_0xffd0('0x18')]+=0x1;break;}}if(this[_0xffd0('0x25')]===_0xffd0('0x50')){var _0x40c14d=Object[_0xffd0('0x51')](_0x129362);for(var _0x2c0ffd=0x0;_0x2c0ffd<_0x40c14d[_0xffd0('0x4a')];_0x2c0ffd++){var _0x27f8a2=_0x40c14d[_0x2c0ffd];var _0x27e4ed=_0x129362[_0x27f8a2];if(_0x27e4ed[_0xffd0('0x52')]===this[_0xffd0('0x13')]&&_0x27e4ed['type']==='dialer'&&_0x27e4ed[_0xffd0('0x53')]===_0xffd0('0x54')){this[_0xffd0('0x4')]+=0x1;}}if(this['talking']>this[_0xffd0('0x5')]){this['talking']=this[_0xffd0('0x5')];}this[_0xffd0('0x23')]=0x0;}return this;};VoiceQueueSummary[_0xffd0('0x45')][_0xffd0('0x55')]=function(_0x55f221){var _0x5e8681=![];if(_0x55f221){_0x5e8681=INBOUND_COUNTERS['some'](function(_0x2a0302){return this[_0x2a0302]!==_0x55f221[_0x2a0302];},this);}return _0x5e8681;};VoiceQueueSummary[_0xffd0('0x45')][_0xffd0('0x56')]=function(_0xab0969){var _0x22e958=![];var _0x320cfb=![];var _0x464838=![];if(_0xab0969){_0x22e958=this[_0xffd0('0x25')]!==_0xab0969[_0xffd0('0x25')]||this[_0xffd0('0x24')]!==_0xab0969[_0xffd0('0x24')]||this[_0xffd0('0x41')]!==_0xab0969['message']||this[_0xffd0('0x42')]!==_0xab0969[_0xffd0('0x42')];_0x320cfb=OUTBOUND_COUNTERS[_0xffd0('0x57')](function(_0x304a52){return this[_0x304a52]!==_0xab0969[_0x304a52];},this);if(this[_0xffd0('0x43')]&&_0xab0969[_0xffd0('0x43')]){_0x464838=this[_0xffd0('0x43')]['name']!==_0xab0969[_0xffd0('0x43')][_0xffd0('0x13')]||this[_0xffd0('0x43')][_0xffd0('0x58')]!==_0xab0969['Trunk']['active'];}}return _0x22e958||_0x320cfb||_0x464838;};VoiceQueueSummary['prototype'][_0xffd0('0x59')]=function(_0x336451){this[_0xffd0('0x16')]=_0x336451[_0xffd0('0x16')];this[_0xffd0('0x41')]=_0x336451[_0xffd0('0x41')];this[_0xffd0('0x42')]=_0x336451['statusMessage'];this[_0xffd0('0x7')]=_0x336451[_0xffd0('0x7')];this[_0xffd0('0x8')]=_0x336451[_0xffd0('0x8')];this[_0xffd0('0x9')]=_0x336451[_0xffd0('0x9')];this[_0xffd0('0xa')]=_0x336451['outboundBlacklistCallsDay'];this['outboundBusyCallsDay']=_0x336451[_0xffd0('0xb')];this[_0xffd0('0xc')]=_0x336451[_0xffd0('0xc')];this['outboundNoAnswerCallsDay']=_0x336451[_0xffd0('0x2d')];this[_0xffd0('0xd')]=_0x336451[_0xffd0('0xd')];this[_0xffd0('0xe')]=_0x336451['outboundReCallsDay'];this['outboundRejectCallsDay']=_0x336451[_0xffd0('0xf')];this['outboundUnknownCallsDay']=_0x336451[_0xffd0('0x10')];this['sumBillable']=_0x336451['sumBillable'];this['sumDuration']=_0x336451['sumDuration'];this[_0xffd0('0x1c')]=_0x336451[_0xffd0('0x1c')];if(this[_0xffd0('0x25')]===_0xffd0('0x5a')){this['pTalking']=_0x336451[_0xffd0('0x23')];}};module['exports']=VoiceQueueSummary; \ No newline at end of file +var _0x565f=['loggedin','length','SIP/','online','incall','includes','booked','queue','dialer','exten','xcally-motion-preview','some','compareToOutboundQueue','active','updateReportFromOutboundQueue','preview','exports','loggedIn','loggedInDb','paused','talking','waiting','available','answered','inUse','outboundAbandonedCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','pTalking','sumBillable','sumDuration','total','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringing','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','prototype','createReport'];(function(_0x25662e,_0x4cec68){var _0x59b7bc=function(_0xafb159){while(--_0xafb159){_0x25662e['push'](_0x25662e['shift']());}};_0x59b7bc(++_0x4cec68);}(_0x565f,0x68));var _0xf565=function(_0xf562ec,_0xfbc235){_0xf562ec=_0xf562ec-0x0;var _0x297e4d=_0x565f[_0xf562ec];return _0x297e4d;};'use strict';var INBOUND_COUNTERS=['available',_0xf565('0x0'),_0xf565('0x1'),_0xf565('0x2'),'ringing',_0xf565('0x3'),_0xf565('0x4')];var OUTBOUND_COUNTERS=[_0xf565('0x5'),_0xf565('0x6'),_0xf565('0x7'),'loggedIn','loggedInDb','originated',_0xf565('0x8'),'outboundAnswerCallsDay',_0xf565('0x9'),_0xf565('0xa'),_0xf565('0xb'),'outboundNoAnswerCallsDay',_0xf565('0xc'),'outboundReCallsDay',_0xf565('0xd'),'outboundUnknownCallsDay',_0xf565('0x2'),_0xf565('0xe'),_0xf565('0x3'),_0xf565('0xf'),_0xf565('0x10'),_0xf565('0x11'),'waiting'];function VoiceQueueSummary(_0x4cb8e1){this['id']=_0x4cb8e1['id'];this[_0xf565('0x12')]=_0x4cb8e1[_0xf565('0x12')];this[_0xf565('0x13')]=_0x4cb8e1[_0xf565('0x13')];this[_0xf565('0x14')]=_0x4cb8e1[_0xf565('0x14')]||0x0;this[_0xf565('0x6')]=_0x4cb8e1[_0xf565('0x6')]||0x0;this[_0xf565('0x5')]=_0x4cb8e1[_0xf565('0x5')]||0x0;this['busy']=_0x4cb8e1[_0xf565('0x15')]||0x0;this[_0xf565('0x7')]=_0x4cb8e1['inUse']||0x0;this[_0xf565('0x16')]=_0x4cb8e1[_0xf565('0x16')]||0x0;this[_0xf565('0x0')]=_0x4cb8e1[_0xf565('0x0')]||0x0;this[_0xf565('0x1')]=_0x4cb8e1['loggedInDb']||0x0;this[_0xf565('0x17')]=_0x4cb8e1['onHold']||0x0;this['notInUse']=_0x4cb8e1[_0xf565('0x18')]||0x0;this[_0xf565('0x2')]=_0x4cb8e1['paused']||0x0;this['ringing']=_0x4cb8e1[_0xf565('0x19')]||0x0;this['ringInUse']=_0x4cb8e1[_0xf565('0x1a')];this[_0xf565('0xf')]=_0x4cb8e1[_0xf565('0xf')];this['sumDuration']=_0x4cb8e1['sumDuration'];this[_0xf565('0x1b')]=_0x4cb8e1[_0xf565('0x1b')]||0x0;this[_0xf565('0x3')]=_0x4cb8e1[_0xf565('0x3')]||0x0;this[_0xf565('0x11')]=_0x4cb8e1['total']||0x0;this[_0xf565('0x1c')]=_0x4cb8e1[_0xf565('0x1c')];this[_0xf565('0x1d')]=_0x4cb8e1[_0xf565('0x1d')]||0x0;this[_0xf565('0x1e')]=_0x4cb8e1[_0xf565('0x1e')]||0x0;this[_0xf565('0x1f')]=_0x4cb8e1[_0xf565('0x1f')]||0x0;this[_0xf565('0x4')]=_0x4cb8e1[_0xf565('0x4')]||0x0;if(_0x4cb8e1['type']===_0xf565('0x20')){this['pTalking']=_0x4cb8e1[_0xf565('0xe')]||0x0;this[_0xf565('0x21')]=_0x4cb8e1['dialActive'];this[_0xf565('0x22')]=_0x4cb8e1[_0xf565('0x22')];this[_0xf565('0x23')]=_0x4cb8e1[_0xf565('0x23')];this[_0xf565('0x24')]=_0x4cb8e1[_0xf565('0x24')];this[_0xf565('0x25')]=_0x4cb8e1[_0xf565('0x25')];this['dialPrefix']=_0x4cb8e1[_0xf565('0x26')];this[_0xf565('0x27')]=_0x4cb8e1[_0xf565('0x27')];this[_0xf565('0x28')]=_0x4cb8e1[_0xf565('0x28')];this['outboundAnswerCallsDay']=_0x4cb8e1[_0xf565('0x29')];this[_0xf565('0x9')]=_0x4cb8e1[_0xf565('0x9')];this[_0xf565('0xa')]=_0x4cb8e1[_0xf565('0xa')];this['outboundCongestionCallsDay']=_0x4cb8e1[_0xf565('0xb')];this[_0xf565('0x2a')]=_0x4cb8e1[_0xf565('0x2a')];this[_0xf565('0x2b')]=_0x4cb8e1[_0xf565('0x2b')];this[_0xf565('0x2c')]=_0x4cb8e1['outboundDropCallsDayTimeout'];this[_0xf565('0x2d')]=_0x4cb8e1[_0xf565('0x2d')];this['outboundNoSuchCallsDay']=_0x4cb8e1[_0xf565('0xc')];this[_0xf565('0x2e')]=_0x4cb8e1[_0xf565('0x2e')];this[_0xf565('0x2f')]=_0x4cb8e1[_0xf565('0x2f')];this[_0xf565('0xd')]=_0x4cb8e1[_0xf565('0xd')];this[_0xf565('0x30')]=_0x4cb8e1['outboundUnknownCallsDay'];this[_0xf565('0x31')]=_0x4cb8e1[_0xf565('0x31')];this[_0xf565('0x32')]=_0x4cb8e1['predictiveIntervalAvgHoldtime'];this[_0xf565('0x33')]=_0x4cb8e1[_0xf565('0x33')];this[_0xf565('0x34')]=_0x4cb8e1[_0xf565('0x34')];this[_0xf565('0x35')]=_0x4cb8e1['predictiveIntervalDroppedCallsTimeout'];this[_0xf565('0x36')]=_0x4cb8e1['predictiveIntervalErlangCalls'];this[_0xf565('0x37')]=_0x4cb8e1[_0xf565('0x37')];this['predictiveIntervalHitRate']=_0x4cb8e1['predictiveIntervalHitRate'];this[_0xf565('0x38')]=_0x4cb8e1[_0xf565('0x38')];this['predictiveIntervalPauses']=_0x4cb8e1[_0xf565('0x39')];this['predictiveIntervalAvailable']=_0x4cb8e1['predictiveIntervalAvailable'];this['predictiveIntervalTotalCalls']=_0x4cb8e1['predictiveIntervalTotalCalls'];this[_0xf565('0x3a')]=_0x4cb8e1[_0xf565('0x3a')];this[_0xf565('0x3b')]=_0x4cb8e1['erlangCalls'];this[_0xf565('0x3c')]=_0x4cb8e1[_0xf565('0x3c')];this[_0xf565('0x3d')]=_0x4cb8e1['erlangAbandonmentRate'];this[_0xf565('0x3e')]=_0x4cb8e1['erlangBusyFactor'];this[_0xf565('0x3f')]=_0x4cb8e1[_0xf565('0x3f')];this[_0xf565('0x40')]=_0x4cb8e1['startProgressive'];this[_0xf565('0x41')]=_0x4cb8e1['message'];this[_0xf565('0x42')]=_0x4cb8e1['statusMessage'];}if(_0x4cb8e1[_0xf565('0x43')]){this[_0xf565('0x43')]={'id':_0x4cb8e1['Trunk']['id'],'name':_0x4cb8e1[_0xf565('0x43')][_0xf565('0x12')],'active':_0x4cb8e1[_0xf565('0x43')]['active'],'callerid':_0x4cb8e1[_0xf565('0x43')]['callerid']};}}VoiceQueueSummary[_0xf565('0x44')][_0xf565('0x45')]=function(_0x3c43ff,_0x45cde0,_0xf9e659,_0x2321f5){this['loggedInDb']=0x0;this['talking']=0x0;this[_0xf565('0x2')]=0x0;this[_0xf565('0x1e')]=0x0;this[_0xf565('0x18')]=0x0;this[_0xf565('0x7')]=0x0;this[_0xf565('0x15')]=0x0;this['invalid']=0x0;this[_0xf565('0x1d')]=0x0;this[_0xf565('0x19')]=0x0;this[_0xf565('0x1a')]=0x0;this[_0xf565('0x17')]=0x0;if(_0xf9e659){if(_0xf9e659['available']){this[_0xf565('0x5')]=Number(_0xf9e659['available']);}if(_0xf9e659['loggedin']){this[_0xf565('0x0')]=Number(_0xf9e659[_0xf565('0x46')]);}if(_0xf9e659['callers']){this['waiting']=Number(_0xf9e659['callers']);}}for(var _0x307cc7=0x0;_0x307cc7<_0x3c43ff[_0xf565('0x47')];_0x307cc7++){var _0x2b602f=_0x45cde0[_0xf565('0x48')+_0x3c43ff[_0x307cc7][_0xf565('0x12')]];if(_0x2b602f&&_0x2b602f[_0xf565('0x49')]){this[_0xf565('0x1')]+=0x1;}if(_0x3c43ff[_0x307cc7][_0xf565('0x4a')]==='1'){this[_0xf565('0x3')]+=0x1;}if(_0x3c43ff[_0x307cc7][_0xf565('0x2')]==='1'&&!['2','7','8'][_0xf565('0x4b')](_0x3c43ff[_0x307cc7]['status'])){this['paused']+=0x1;}switch(_0x3c43ff[_0x307cc7]['status']){case'0':this[_0xf565('0x1e')]+=0x1;break;case'1':this[_0xf565('0x18')]+=0x1;break;case'2':this[_0xf565('0x7')]+=0x1;break;case'3':this['busy']+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0xf565('0x1d')]+=0x1;break;case'6':this[_0xf565('0x19')]+=0x1;break;case'7':this[_0xf565('0x1a')]+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this[_0xf565('0x22')]===_0xf565('0x4c')){var _0x1bd9f4=Object['keys'](_0x2321f5);for(var _0x5b6cbb=0x0;_0x5b6cbb<_0x1bd9f4[_0xf565('0x47')];_0x5b6cbb++){var _0x4ed6f5=_0x1bd9f4[_0x5b6cbb];var _0x3ee900=_0x2321f5[_0x4ed6f5];if(_0x3ee900[_0xf565('0x4d')]===this[_0xf565('0x12')]&&_0x3ee900[_0xf565('0x1c')]===_0xf565('0x4e')&&_0x3ee900[_0xf565('0x4f')]===_0xf565('0x50')){this[_0xf565('0x3')]+=0x1;}}if(this[_0xf565('0x3')]>this[_0xf565('0x7')]){this[_0xf565('0x3')]=this[_0xf565('0x7')];}this[_0xf565('0xe')]=0x0;}return this;};VoiceQueueSummary[_0xf565('0x44')]['compareToInboundQueue']=function(_0x4a49de){var _0x3deb88=![];if(_0x4a49de){_0x3deb88=INBOUND_COUNTERS[_0xf565('0x51')](function(_0x567c8e){return this[_0x567c8e]!==_0x4a49de[_0x567c8e];},this);}return _0x3deb88;};VoiceQueueSummary[_0xf565('0x44')][_0xf565('0x52')]=function(_0x52998f){var _0x4b60ae=![];var _0x13296f=![];var _0x1b1741=![];if(_0x52998f){_0x4b60ae=this[_0xf565('0x22')]!==_0x52998f[_0xf565('0x22')]||this[_0xf565('0x21')]!==_0x52998f[_0xf565('0x21')]||this[_0xf565('0x41')]!==_0x52998f[_0xf565('0x41')]||this['statusMessage']!==_0x52998f[_0xf565('0x42')];_0x13296f=OUTBOUND_COUNTERS['some'](function(_0x46a1b8){return this[_0x46a1b8]!==_0x52998f[_0x46a1b8];},this);if(this[_0xf565('0x43')]&&_0x52998f['Trunk']){_0x1b1741=this['Trunk'][_0xf565('0x12')]!==_0x52998f[_0xf565('0x43')][_0xf565('0x12')]||this[_0xf565('0x43')]['active']!==_0x52998f[_0xf565('0x43')][_0xf565('0x53')];}}return _0x4b60ae||_0x13296f||_0x1b1741;};VoiceQueueSummary[_0xf565('0x44')][_0xf565('0x54')]=function(_0x400021){this['answered']=_0x400021[_0xf565('0x6')];this['message']=_0x400021[_0xf565('0x41')];this['statusMessage']=_0x400021['statusMessage'];this[_0xf565('0x3a')]=_0x400021[_0xf565('0x3a')];this[_0xf565('0x8')]=_0x400021[_0xf565('0x8')];this[_0xf565('0x29')]=_0x400021[_0xf565('0x29')];this['outboundBlacklistCallsDay']=_0x400021['outboundBlacklistCallsDay'];this[_0xf565('0xa')]=_0x400021[_0xf565('0xa')];this['outboundCongestionCallsDay']=_0x400021['outboundCongestionCallsDay'];this[_0xf565('0x2d')]=_0x400021[_0xf565('0x2d')];this[_0xf565('0xc')]=_0x400021['outboundNoSuchCallsDay'];this[_0xf565('0x2f')]=_0x400021[_0xf565('0x2f')];this[_0xf565('0xd')]=_0x400021[_0xf565('0xd')];this['outboundUnknownCallsDay']=_0x400021[_0xf565('0x30')];this[_0xf565('0xf')]=_0x400021['sumBillable'];this[_0xf565('0x10')]=_0x400021[_0xf565('0x10')];this['total']=_0x400021[_0xf565('0x11')];if(this['dialMethod']===_0xf565('0x55')){this[_0xf565('0xe')]=_0x400021['pTalking'];}};module[_0xf565('0x56')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 3a2fe99..6f2b506 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 _0x6642=['remoteUri','serverUrl','Configurations','name','username','accessKey'];(function(_0x69a35f,_0x4fcd24){var _0x4964d1=function(_0x10a3fb){while(--_0x10a3fb){_0x69a35f['push'](_0x69a35f['shift']());}};_0x4964d1(++_0x4fcd24);}(_0x6642,0x81));var _0x2664=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6642[_0x3dd15e];return _0x231fd0;};'use strict';function VtigerAccount(_0x1be20e){this['id']=_0x1be20e['id']||0x0;this['name']=_0x1be20e[_0x2664('0x0')]||'';this[_0x2664('0x1')]=_0x1be20e[_0x2664('0x1')]||'';this[_0x2664('0x2')]=_0x1be20e[_0x2664('0x2')]||'';this[_0x2664('0x3')]=_0x1be20e[_0x2664('0x3')]||'';this[_0x2664('0x4')]=_0x1be20e[_0x2664('0x4')]||'';this['Configurations']=_0x1be20e[_0x2664('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0x6bb7=['serverUrl','Configurations','username','accessKey','remoteUri'];(function(_0x2ed04c,_0x331357){var _0x5a0f96=function(_0x194c0d){while(--_0x194c0d){_0x2ed04c['push'](_0x2ed04c['shift']());}};_0x5a0f96(++_0x331357);}(_0x6bb7,0x18d));var _0x76bb=function(_0x11471c,_0x4859cd){_0x11471c=_0x11471c-0x0;var _0x54fd83=_0x6bb7[_0x11471c];return _0x54fd83;};'use strict';function VtigerAccount(_0x933b58){this['id']=_0x933b58['id']||0x0;this['name']=_0x933b58['name']||'';this['username']=_0x933b58[_0x76bb('0x0')]||'';this[_0x76bb('0x1')]=_0x933b58['accessKey']||'';this[_0x76bb('0x2')]=_0x933b58['remoteUri']||'';this[_0x76bb('0x3')]=_0x933b58['serverUrl']||'';this['Configurations']=_0x933b58[_0x76bb('0x4')]||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index b4fba79..8897e94 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 _0x9492=['authType','type','serverUrl','Configurations','exports','name','username','password','token','remoteUri'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0x9492,0x13b));var _0x2949=function(_0x3b8837,_0x34da1a){_0x3b8837=_0x3b8837-0x0;var _0x35be05=_0x9492[_0x3b8837];return _0x35be05;};'use strict';function ZendeskAccount(_0x3d69d5){this['id']=_0x3d69d5['id']||0x0;this['name']=_0x3d69d5[_0x2949('0x0')]||'';this[_0x2949('0x1')]=_0x3d69d5['username']||'';this[_0x2949('0x2')]=_0x3d69d5['password']||'';this[_0x2949('0x3')]=_0x3d69d5[_0x2949('0x3')]||'';this[_0x2949('0x4')]=_0x3d69d5[_0x2949('0x4')]||'';this['authType']=_0x3d69d5[_0x2949('0x5')]||'';this['type']=_0x3d69d5[_0x2949('0x6')]||'integrationTab';this[_0x2949('0x7')]=_0x3d69d5['serverUrl']||'';this[_0x2949('0x8')]=_0x3d69d5[_0x2949('0x8')]||{};}module[_0x2949('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x2f10=['name','username','password','token','remoteUri','authType','type','serverUrl','Configurations','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2f10,0x1ae));var _0x02f1=function(_0x315307,_0x4beb3b){_0x315307=_0x315307-0x0;var _0xab1924=_0x2f10[_0x315307];return _0xab1924;};'use strict';function ZendeskAccount(_0x2a0f4f){this['id']=_0x2a0f4f['id']||0x0;this['name']=_0x2a0f4f[_0x02f1('0x0')]||'';this[_0x02f1('0x1')]=_0x2a0f4f[_0x02f1('0x1')]||'';this[_0x02f1('0x2')]=_0x2a0f4f[_0x02f1('0x2')]||'';this[_0x02f1('0x3')]=_0x2a0f4f[_0x02f1('0x3')]||'';this[_0x02f1('0x4')]=_0x2a0f4f[_0x02f1('0x4')]||'';this[_0x02f1('0x5')]=_0x2a0f4f[_0x02f1('0x5')]||'';this['type']=_0x2a0f4f[_0x02f1('0x6')]||'integrationTab';this['serverUrl']=_0x2a0f4f[_0x02f1('0x7')]||'';this[_0x02f1('0x8')]=_0x2a0f4f[_0x02f1('0x8')]||{};}module[_0x02f1('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 5f5b4b7..5a57691 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 _0xb8a1=['description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name'];(function(_0x52b0ee,_0x436dbb){var _0x337060=function(_0x41e2d7){while(--_0x41e2d7){_0x52b0ee['push'](_0x52b0ee['shift']());}};_0x337060(++_0x436dbb);}(_0xb8a1,0x6d));var _0x1b8a=function(_0xdedac2,_0x41afb9){_0xdedac2=_0xdedac2-0x0;var _0x525af9=_0xb8a1[_0xdedac2];return _0x525af9;};'use strict';function ZohoAccount(_0xd680e0){this['id']=_0xd680e0['id']||0x0;this[_0x1b8a('0x0')]=_0xd680e0[_0x1b8a('0x0')]||'';this[_0x1b8a('0x1')]=_0xd680e0[_0x1b8a('0x1')]||'';this[_0x1b8a('0x2')]=_0xd680e0[_0x1b8a('0x2')]||'';this[_0x1b8a('0x3')]=_0xd680e0[_0x1b8a('0x3')]||'';this[_0x1b8a('0x4')]=_0xd680e0['clientId']||'';this[_0x1b8a('0x5')]=_0xd680e0[_0x1b8a('0x5')]||'';this[_0x1b8a('0x6')]=_0xd680e0[_0x1b8a('0x6')]||'';this[_0x1b8a('0x7')]=_0xd680e0['code']||'';this[_0x1b8a('0x8')]=_0xd680e0[_0x1b8a('0x8')]||'';this['Configurations']=_0xd680e0[_0x1b8a('0x9')]||{};}module[_0x1b8a('0xa')]=ZohoAccount; \ No newline at end of file +var _0x05d9=['code','refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl'];(function(_0x4c7f40,_0x5dc8a6){var _0x326e1f=function(_0x169687){while(--_0x169687){_0x4c7f40['push'](_0x4c7f40['shift']());}};_0x326e1f(++_0x5dc8a6);}(_0x05d9,0x1bc));var _0x905d=function(_0x249d4f,_0x1bc421){_0x249d4f=_0x249d4f-0x0;var _0x36b88c=_0x05d9[_0x249d4f];return _0x36b88c;};'use strict';function ZohoAccount(_0x3d1231){this['id']=_0x3d1231['id']||0x0;this[_0x905d('0x0')]=_0x3d1231[_0x905d('0x0')]||'';this['description']=_0x3d1231[_0x905d('0x1')]||'';this[_0x905d('0x2')]=_0x3d1231['host']||'';this[_0x905d('0x3')]=_0x3d1231[_0x905d('0x3')]||'';this['clientId']=_0x3d1231[_0x905d('0x4')]||'';this[_0x905d('0x5')]=_0x3d1231[_0x905d('0x5')]||'';this[_0x905d('0x6')]=_0x3d1231[_0x905d('0x6')]||'';this[_0x905d('0x7')]=_0x3d1231[_0x905d('0x7')]||'';this[_0x905d('0x8')]=_0x3d1231[_0x905d('0x8')]||'';this[_0x905d('0x9')]=_0x3d1231[_0x905d('0x9')]||{};}module[_0x905d('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 e46a503..16a91a6 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 _0x5c3c=['prototype','format','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','idContact','queue','type','dialAnswer','Agent','channelAgent','membername','SIP/%s','calleridname','phone','Contact','firstName','lastName','calleridnum','scheduledat','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum'];(function(_0xd0cd0b,_0x490956){var _0x59cced=function(_0x567251){while(--_0x567251){_0xd0cd0b['push'](_0xd0cd0b['shift']());}};_0x59cced(++_0x490956);}(_0x5c3c,0x132));var _0xc5c3=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0x5c3c[_0x424a9a];return _0xa7831c;};'use strict';var util=require(_0xc5c3('0x0'));var _=require(_0xc5c3('0x1'));var moment=require(_0xc5c3('0x2'));function checkNameSurname(_0x32103c,_0x4b9233,_0x400726){var _0x3c5552='';if(!_[_0xc5c3('0x3')](_0x4b9233)&&_0xc5c3('0x4')===typeof _0x4b9233){_0x3c5552+=_0x4b9233;}if(!_[_0xc5c3('0x3')](_0x400726)&&_0xc5c3('0x4')===typeof _0x400726){_0x3c5552+='\x20'+_0x400726;}if(_0x3c5552!==''){return _0x3c5552;}return _0x32103c;}function Action(_0xe85098,_0x23a6b5,_0x28bdd9,_0x5a392b,_0x4b8404){this['uniqueid']=_0x28bdd9||undefined;this[_0xc5c3('0x5')]=_0xe85098['id'];this[_0xc5c3('0x6')]=_0x23a6b5['name'];this[_0xc5c3('0x7')]=_0x23a6b5[_0xc5c3('0x7')];this['campaigntype']=_0xc5c3('0x6');this[_0xc5c3('0x8')]=![];this['membername']=_[_0xc5c3('0x3')](_0xe85098[_0xc5c3('0x9')])?undefined:_0xe85098[_0xc5c3('0x9')]['name'];this[_0xc5c3('0xa')]=this[_0xc5c3('0xb')]?util['format'](_0xc5c3('0xc'),this[_0xc5c3('0xb')]):_0x5a392b||undefined;this[_0xc5c3('0xd')]=checkNameSurname(_0xe85098['Contact'][_0xc5c3('0xe')],_0xe85098[_0xc5c3('0xf')][_0xc5c3('0x10')],_0xe85098[_0xc5c3('0xf')][_0xc5c3('0x11')]);this['active']=_0xe85098['active']||![];this[_0xc5c3('0x12')]=_0xe85098[_0xc5c3('0xe')];this[_0xc5c3('0x13')]=_0xe85098[_0xc5c3('0x13')];this['countbusyretry']=_0xe85098['countbusyretry']||0x0;this[_0xc5c3('0x14')]=_0xe85098['countcongestionretry']||0x0;this[_0xc5c3('0x15')]=_0xe85098[_0xc5c3('0x15')]||0x0;this[_0xc5c3('0x16')]=(_0xe85098[_0xc5c3('0x17')]||0x0)+(_0xe85098[_0xc5c3('0x14')]||0x0)+(_0xe85098['countnoanswerretry']||0x0)+(_0xe85098[_0xc5c3('0x18')]||0x0)+(_0xe85098[_0xc5c3('0x19')]||0x0)+(_0xe85098[_0xc5c3('0x1a')]||0x0)+(_0xe85098[_0xc5c3('0x1b')]||0x0)+(_0xe85098['countagentrejectretry']||0x0);this[_0xc5c3('0x18')]=_0xe85098[_0xc5c3('0x18')]||0x0;this[_0xc5c3('0x19')]=_0xe85098[_0xc5c3('0x19')]||0x0;this[_0xc5c3('0x1a')]=_0xe85098['countabandonedretry']||0x0;this[_0xc5c3('0x1b')]=_0xe85098[_0xc5c3('0x1b')]||0x0;this[_0xc5c3('0x1c')]=_0xe85098[_0xc5c3('0x1c')]||0x0;this[_0xc5c3('0x1d')]=_0xe85098[_0xc5c3('0x1d')];this[_0xc5c3('0x1e')]=_0xe85098['callbackuniqueid'];this['callbackat']=_0xe85098[_0xc5c3('0x1f')];this[_0xc5c3('0x20')]=_0xe85098['recallme'];this['ContactId']=_0xe85098[_0xc5c3('0x21')];this[_0xc5c3('0x22')]=_0xe85098[_0xc5c3('0x22')];this['UserId']=_['isNil'](_0xe85098[_0xc5c3('0x9')])?_0xe85098[_0xc5c3('0x23')]:_0xe85098[_0xc5c3('0x9')]['id'];this[_0xc5c3('0x24')]=_0xe85098['VoiceQueueId'];this[_0xc5c3('0x25')]='';this['originatecalleridname']='';}Action[_0xc5c3('0x26')]['getCaller']=function(){return util[_0xc5c3('0x27')](_0xc5c3('0x28'),this[_0xc5c3('0xd')],this[_0xc5c3('0x29')]);};module[_0xc5c3('0x2a')]=Action; \ No newline at end of file +var _0x5f2f=['phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','exports','util','lodash','moment','isNil','string','idContact','queue','name','type','campaigntype','membername','Agent','format','SIP/%s','calleridname','Contact','firstName','lastName','active','calleridnum'];(function(_0xa0dab4,_0x21d6ce){var _0xc4dc72=function(_0x321c11){while(--_0x321c11){_0xa0dab4['push'](_0xa0dab4['shift']());}};_0xc4dc72(++_0x21d6ce);}(_0x5f2f,0x73));var _0xf5f2=function(_0xdeece,_0x9a85f7){_0xdeece=_0xdeece-0x0;var _0x3ee945=_0x5f2f[_0xdeece];return _0x3ee945;};'use strict';var util=require(_0xf5f2('0x0'));var _=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));function checkNameSurname(_0x1a7be1,_0x1172dd,_0x174bc7){var _0x3c72ee='';if(!_[_0xf5f2('0x3')](_0x1172dd)&&'string'===typeof _0x1172dd){_0x3c72ee+=_0x1172dd;}if(!_['isNil'](_0x174bc7)&&_0xf5f2('0x4')===typeof _0x174bc7){_0x3c72ee+='\x20'+_0x174bc7;}if(_0x3c72ee!==''){return _0x3c72ee;}return _0x1a7be1;}function Action(_0x192215,_0xad7f65,_0x3eebf6,_0x3133bc,_0x473100){this['uniqueid']=_0x3eebf6||undefined;this[_0xf5f2('0x5')]=_0x192215['id'];this[_0xf5f2('0x6')]=_0xad7f65[_0xf5f2('0x7')];this['type']=_0xad7f65[_0xf5f2('0x8')];this[_0xf5f2('0x9')]=_0xf5f2('0x6');this['dialAnswer']=![];this[_0xf5f2('0xa')]=_['isNil'](_0x192215['Agent'])?undefined:_0x192215[_0xf5f2('0xb')][_0xf5f2('0x7')];this['channelAgent']=this[_0xf5f2('0xa')]?util[_0xf5f2('0xc')](_0xf5f2('0xd'),this[_0xf5f2('0xa')]):_0x3133bc||undefined;this[_0xf5f2('0xe')]=checkNameSurname(_0x192215[_0xf5f2('0xf')]['phone'],_0x192215[_0xf5f2('0xf')][_0xf5f2('0x10')],_0x192215[_0xf5f2('0xf')][_0xf5f2('0x11')]);this[_0xf5f2('0x12')]=_0x192215['active']||![];this[_0xf5f2('0x13')]=_0x192215[_0xf5f2('0x14')];this[_0xf5f2('0x15')]=_0x192215[_0xf5f2('0x15')];this[_0xf5f2('0x16')]=_0x192215[_0xf5f2('0x16')]||0x0;this[_0xf5f2('0x17')]=_0x192215[_0xf5f2('0x17')]||0x0;this[_0xf5f2('0x18')]=_0x192215[_0xf5f2('0x18')]||0x0;this[_0xf5f2('0x19')]=(_0x192215[_0xf5f2('0x16')]||0x0)+(_0x192215[_0xf5f2('0x17')]||0x0)+(_0x192215[_0xf5f2('0x18')]||0x0)+(_0x192215[_0xf5f2('0x1a')]||0x0)+(_0x192215[_0xf5f2('0x1b')]||0x0)+(_0x192215[_0xf5f2('0x1c')]||0x0)+(_0x192215['countmachineretry']||0x0)+(_0x192215[_0xf5f2('0x1d')]||0x0);this[_0xf5f2('0x1a')]=_0x192215['countnosuchnumberretry']||0x0;this['countdropretry']=_0x192215[_0xf5f2('0x1b')]||0x0;this[_0xf5f2('0x1c')]=_0x192215['countabandonedretry']||0x0;this[_0xf5f2('0x1e')]=_0x192215[_0xf5f2('0x1e')]||0x0;this[_0xf5f2('0x1d')]=_0x192215[_0xf5f2('0x1d')]||0x0;this[_0xf5f2('0x1f')]=_0x192215['callback'];this[_0xf5f2('0x20')]=_0x192215[_0xf5f2('0x20')];this[_0xf5f2('0x21')]=_0x192215[_0xf5f2('0x21')];this[_0xf5f2('0x22')]=_0x192215['recallme'];this['ContactId']=_0x192215[_0xf5f2('0x23')];this[_0xf5f2('0x24')]=_0x192215[_0xf5f2('0x24')];this[_0xf5f2('0x25')]=_[_0xf5f2('0x3')](_0x192215[_0xf5f2('0xb')])?_0x192215[_0xf5f2('0x25')]:_0x192215[_0xf5f2('0xb')]['id'];this[_0xf5f2('0x26')]=_0x192215['VoiceQueueId'];this[_0xf5f2('0x27')]='';this[_0xf5f2('0x28')]='';}Action[_0xf5f2('0x29')][_0xf5f2('0x2a')]=function(){return util[_0xf5f2('0xc')](_0xf5f2('0x2b'),this['calleridname'],this['number']);};module[_0xf5f2('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 9cb25bb..65ac968 100644 --- a/server/services/ami/preview/index.js +++ b/server/services/ami/preview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x5c8db5,_0x29ad01){var _0x158eb6=function(_0x319455){while(--_0x319455){_0x5c8db5['push'](_0x5c8db5['shift']());}};_0x158eb6(++_0x29ad01);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file +var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x28fd80,_0x257023){var _0x2ae8f8=function(_0x5a143d){while(--_0x5a143d){_0x28fd80['push'](_0x28fd80['shift']());}};_0x2ae8f8(++_0x257023);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 6c91d53..b8e0b18 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 _0x1ea3=['createCustomerHistory','createCustomerFinal','UserId','active','rescheduleContact','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','[createHistory]\x20','resolve','then','catch','moveContactManagedDialer','[moveContactManagedDialer]\x20','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory'];(function(_0xab60cf,_0x12651b){var _0x48b04c=function(_0x291301){while(--_0x291301){_0xab60cf['push'](_0xab60cf['shift']());}};_0x48b04c(++_0x12651b);}(_0x1ea3,0xcd));var _0x31ea=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x1ea3[_0x4b369d];return _0x571a98;};'use strict';var util=require(_0x31ea('0x0'));var BPromise=require('bluebird');var logger=require(_0x31ea('0x1'))('preview');var cmHopper=require(_0x31ea('0x2'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x31ea('0x3'));var agentReportPreview=require(_0x31ea('0x4'));var voiceQueueReport=require(_0x31ea('0x5'));function loggerCatch(_0x4f80ae){return function(_0x23e060){logger[_0x31ea('0x6')](_0x4f80ae,util[_0x31ea('0x7')](_0x23e060,{'showHidden':![],'depth':null}));};}function create(_0xd6f6b6){return cmHopperHistory[_0x31ea('0x8')](_0xd6f6b6)['catch'](loggerCatch(_0x31ea('0x9')));}function createAgent(_0x4a9b65){return BPromise[_0x31ea('0xa')]()[_0x31ea('0xb')](agentReportPreview[_0x31ea('0x8')](_0x4a9b65))[_0x31ea('0xc')](loggerCatch(_0x31ea('0x9')));}function moveContact(_0x5c4b77){return cmHopper[_0x31ea('0xd')](_0x5c4b77,!![])[_0x31ea('0xc')](loggerCatch(_0x31ea('0xe')));}exports['checkIsBlackList']=function(_0x3127b5){return cmHopperBlack['checkIsBlackList'](_0x3127b5)['catch'](loggerCatch(_0x31ea('0xf')));};exports[_0x31ea('0x10')]=function(_0x2f2317){return BPromise['resolve']()[_0x31ea('0xb')](cmHopper[_0x31ea('0x10')](_0x2f2317))[_0x31ea('0xc')](loggerCatch(_0x31ea('0x11')));};exports['createHistory']=function(_0x4f8c48,_0x513744){create(_0x4f8c48)[_0x31ea('0xc')](loggerCatch(_0x513744));moveContact(_0x4f8c48)[_0x31ea('0xc')](loggerCatch(_0x513744));};exports[_0x31ea('0x12')]=function(_0x28e6ec,_0x91ca96){createAgent(_0x28e6ec)['catch'](loggerCatch(_0x91ca96));};exports[_0x31ea('0x13')]=function(_0x534251,_0x4a0189){create(_0x534251)[_0x31ea('0xc')](loggerCatch(_0x4a0189));};exports[_0x31ea('0x14')]=function(_0x189dff,_0x2f6a91){moveContact(_0x189dff)[_0x31ea('0xc')](loggerCatch(_0x2f6a91));};exports['rescheduleContact']=function(_0x483e3a,_0x305f15,_0x3ec70b){if(_0x305f15){_0x483e3a[_0x31ea('0x15')]=null;}if(_0x3ec70b){_0x483e3a[_0x31ea('0x16')]=![];}return cmHopper[_0x31ea('0x17')](_0x483e3a)[_0x31ea('0xc')](loggerCatch(_0x31ea('0x18')));};exports[_0x31ea('0x19')]=function(_0x392f5a){return cmHopper[_0x31ea('0x19')](_0x392f5a)[_0x31ea('0xc')](loggerCatch('[countReScheduled]\x20'));};exports[_0x31ea('0x1a')]=function(_0x597295){return cmHopper[_0x31ea('0x1a')]({'UserId':null},_0x597295,0x1)[_0x31ea('0xc')](loggerCatch(_0x31ea('0x1b')));};exports[_0x31ea('0x1c')]=function(_0x4b6f1f){return cmHopper['unlockContact']({'active':![]},_0x4b6f1f,0x1)[_0x31ea('0xc')](loggerCatch(_0x31ea('0x1d')));};exports['crateCustomerReportQueue']=function(_0x43d698){var _0x26158c={};_0x26158c['type']=_0x43d698[_0x31ea('0x1e')];_0x26158c[_0x31ea('0x1f')]=_0x43d698['uniqueid'];_0x26158c[_0x31ea('0x20')]=_0x43d698[_0x31ea('0x20')];_0x26158c[_0x31ea('0x21')]=_0x43d698[_0x31ea('0x21')];_0x26158c[_0x31ea('0x22')]=_0x43d698[_0x31ea('0x22')];_0x26158c[_0x31ea('0x23')]=_0x43d698[_0x31ea('0x24')];_0x26158c[_0x31ea('0x25')]=_0x43d698['answertime'];_0x26158c[_0x31ea('0x26')]=0x1;_0x26158c['queuecallercompleteAt']=_0x43d698[_0x31ea('0x27')];_0x26158c[_0x31ea('0x28')]=_0x43d698[_0x31ea('0x29')];_0x26158c[_0x31ea('0x2a')]=_0x31ea('0x2b');_0x26158c[_0x31ea('0x2c')]=_0x31ea('0x2d');_0x26158c[_0x31ea('0x2e')]=0x0;_0x26158c[_0x31ea('0x2f')]=0x1;_0x26158c[_0x31ea('0x30')]=_0x43d698[_0x31ea('0x29')];_0x26158c[_0x31ea('0x31')]=_0x31ea('0x32');return BPromise[_0x31ea('0xa')]()[_0x31ea('0xb')](voiceQueueReport['create'](_0x26158c))['catch'](loggerCatch(_0x31ea('0x33')));};exports[_0x31ea('0x34')]=function(_0x4a99ca,_0x47d729){return BPromise[_0x31ea('0xa')]()[_0x31ea('0xb')](cmHopper[_0x31ea('0x34')](_0x4a99ca,_0x47d729))[_0x31ea('0xc')](loggerCatch(_0x31ea('0x35')));};exports[_0x31ea('0x36')]=function(_0x1d16a4){return cmHopper['rescheduleContact'](_0x1d16a4,!![],!![])['catch'](loggerCatch(_0x31ea('0x37')));}; \ No newline at end of file +var _0x7a85=['from-sip','xcally-motion-preview','holdtime','lastAssignedTo','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/agentReportPreview','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','resolve','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','UserId','rescheduleContact','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','context'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x7a85,0x15a));var _0x57a8=function(_0x72b4d2,_0x336804){_0x72b4d2=_0x72b4d2-0x0;var _0x504617=_0x7a85[_0x72b4d2];return _0x504617;};'use strict';var util=require('util');var BPromise=require(_0x57a8('0x0'));var logger=require(_0x57a8('0x1'))('preview');var cmHopper=require(_0x57a8('0x2'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x57a8('0x3'));var agentReportPreview=require(_0x57a8('0x4'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x9ed6cf){return function(_0x4ddd6c){logger['error'](_0x9ed6cf,util['inspect'](_0x4ddd6c,{'showHidden':![],'depth':null}));};}function create(_0x5ce5ef){return cmHopperHistory[_0x57a8('0x5')](_0x5ce5ef)[_0x57a8('0x6')](loggerCatch(_0x57a8('0x7')));}function createAgent(_0x5d1eb0){return BPromise['resolve']()[_0x57a8('0x8')](agentReportPreview['createHistory'](_0x5d1eb0))[_0x57a8('0x6')](loggerCatch(_0x57a8('0x7')));}function moveContact(_0x266184){return cmHopper[_0x57a8('0x9')](_0x266184,!![])[_0x57a8('0x6')](loggerCatch(_0x57a8('0xa')));}exports[_0x57a8('0xb')]=function(_0x42b691){return cmHopperBlack[_0x57a8('0xb')](_0x42b691)[_0x57a8('0x6')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x57a8('0xc')]=function(_0x342b75){return BPromise[_0x57a8('0xd')]()[_0x57a8('0x8')](cmHopper[_0x57a8('0xc')](_0x342b75))[_0x57a8('0x6')](loggerCatch(_0x57a8('0xe')));};exports[_0x57a8('0x5')]=function(_0x5c7480,_0x92579e){create(_0x5c7480)[_0x57a8('0x6')](loggerCatch(_0x92579e));moveContact(_0x5c7480)[_0x57a8('0x6')](loggerCatch(_0x92579e));};exports[_0x57a8('0xf')]=function(_0x460d1a,_0x1c2ae4){createAgent(_0x460d1a)[_0x57a8('0x6')](loggerCatch(_0x1c2ae4));};exports[_0x57a8('0x10')]=function(_0x1fc4c6,_0x1be606){create(_0x1fc4c6)['catch'](loggerCatch(_0x1be606));};exports['createCustomerFinal']=function(_0x34ee44,_0x49f76c){moveContact(_0x34ee44)[_0x57a8('0x6')](loggerCatch(_0x49f76c));};exports['rescheduleContact']=function(_0x49b0c3,_0x568480,_0xf4c0cf){if(_0x568480){_0x49b0c3[_0x57a8('0x11')]=null;}if(_0xf4c0cf){_0x49b0c3['active']=![];}return cmHopper[_0x57a8('0x12')](_0x49b0c3)['catch'](loggerCatch(_0x57a8('0x13')));};exports[_0x57a8('0x14')]=function(_0x164f9c){return cmHopper[_0x57a8('0x14')](_0x164f9c)[_0x57a8('0x6')](loggerCatch('[countReScheduled]\x20'));};exports[_0x57a8('0x15')]=function(_0x37137b){return cmHopper['unlockContact']({'UserId':null},_0x37137b,0x1)['catch'](loggerCatch(_0x57a8('0x16')));};exports[_0x57a8('0x17')]=function(_0x42e4ba){return cmHopper[_0x57a8('0x15')]({'active':![]},_0x42e4ba,0x1)[_0x57a8('0x6')](loggerCatch('[activeContact]\x20'));};exports[_0x57a8('0x18')]=function(_0x438e92){var _0x5ef82f={};_0x5ef82f[_0x57a8('0x19')]=_0x438e92[_0x57a8('0x19')];_0x5ef82f[_0x57a8('0x1a')]=_0x438e92['uniqueid'];_0x5ef82f[_0x57a8('0x1b')]=_0x438e92[_0x57a8('0x1b')];_0x5ef82f[_0x57a8('0x1c')]=_0x438e92[_0x57a8('0x1c')];_0x5ef82f[_0x57a8('0x1d')]=_0x438e92[_0x57a8('0x1d')];_0x5ef82f[_0x57a8('0x1e')]=_0x438e92[_0x57a8('0x1f')];_0x5ef82f[_0x57a8('0x20')]=_0x438e92[_0x57a8('0x1f')];_0x5ef82f[_0x57a8('0x21')]=0x1;_0x5ef82f[_0x57a8('0x22')]=_0x438e92[_0x57a8('0x23')];_0x5ef82f[_0x57a8('0x24')]=_0x438e92['membername'];_0x5ef82f[_0x57a8('0x25')]=_0x57a8('0x26');_0x5ef82f['exten']=_0x57a8('0x27');_0x5ef82f[_0x57a8('0x28')]=0x0;_0x5ef82f['assigned']=0x1;_0x5ef82f[_0x57a8('0x29')]=_0x438e92['membername'];_0x5ef82f[_0x57a8('0x2a')]=_0x57a8('0x2b');return BPromise[_0x57a8('0xd')]()['then'](voiceQueueReport['create'](_0x5ef82f))[_0x57a8('0x6')](loggerCatch(_0x57a8('0x2c')));};exports[_0x57a8('0x2d')]=function(_0x142733,_0x4cddcc){return BPromise[_0x57a8('0xd')]()['then'](cmHopper[_0x57a8('0x2d')](_0x142733,_0x4cddcc))[_0x57a8('0x6')](loggerCatch(_0x57a8('0x2e')));};exports['rescheduleContactInQueue']=function(_0x8be3dd){return cmHopper['rescheduleContact'](_0x8be3dd,!![],!![])[_0x57a8('0x6')](loggerCatch(_0x57a8('0x2f')));}; \ 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 1a6ede5..f7c5c66 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 _0x8222=['active','countcongestionretry','countnoanswerretry','callback','callbackuniqueid','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosloss','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','match','extractCalleridNumber','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','lodash','preview','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','error','logger','info','inspect','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','isActive','isNil','addVariables','Queue','name','calleridname','dialer','dialOriginateTimeout','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','toLowerVariables','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','state','getSeconds','UserId','logCustomer','ringtime','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','channelAgent','calleridnum','from-sip','timeout','countbusyretry','countagentrejectretry','countnosuchnumberretry','scheduledAt','scheduledat','add','minutes','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','motionChannel','mandatoryDisposition','buildObj','agentReadyId','not_inuse','status','reachable','push','milliseconds','diff','seconds','createBody','ContactId','CampaignId','uniqueid','idContact','type','campaigntype','dialAnswer'];(function(_0x459c75,_0x386e2e){var _0x2b4db0=function(_0xe8d63a){while(--_0xe8d63a){_0x459c75['push'](_0x459c75['shift']());}};_0x2b4db0(++_0x386e2e);}(_0x8222,0x146));var _0x2822=function(_0xe4e1d3,_0x18bf45){_0xe4e1d3=_0xe4e1d3-0x0;var _0x3ca6e1=_0x8222[_0xe4e1d3];return _0x3ca6e1;};'use strict';var util=require('util');var _=require(_0x2822('0x0'));var moment=require('moment');var logger=require('../../../../config/logger')(_0x2822('0x1'));var ipAgi=process['env'][_0x2822('0x2')]||_0x2822('0x3');var utils=require(_0x2822('0x4'));exports[_0x2822('0x5')]=function(_0x1786f1){return function(_0x432e19){logger[_0x2822('0x6')](_0x1786f1,util['inspect'](_0x432e19,{'showHidden':![],'depth':null}));};};exports[_0x2822('0x7')]=function(_0x118840,_0x46d0f6){logger[_0x2822('0x8')](_0x118840,util[_0x2822('0x9')](_0x46d0f6,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x1f9d4f,_0x2e5d80){logger[_0x2822('0x6')](_0x1f9d4f,util[_0x2822('0x9')](_0x2e5d80,{'showHidden':![],'depth':null}));};exports[_0x2822('0xa')]=function(_0x35e22e){return function(_0x66944e){logger[_0x2822('0x8')](_0x35e22e,util[_0x2822('0x9')](_0x66944e,{'showHidden':![],'depth':null}));};};exports[_0x2822('0xb')]=function(_0x10c008,_0x104f7d,_0x1ac654){return{'message':_0x10c008,'unlock':_0x104f7d,'active':_0x1ac654};};exports[_0x2822('0xc')]=function(_0x32edd0,_0x425409,_0x3fc3b0){if(!_[_0x2822('0xd')](_0x3fc3b0)&&_0x2822('0xe')===typeof _0x3fc3b0&&!_[_0x2822('0xf')](_0x3fc3b0)){if(!_[_0x2822('0xd')](_0x425409)&&_0x2822('0xe')===typeof _0x425409&&!_[_0x2822('0xf')](_0x425409)){return util[_0x2822('0x10')](_0x2822('0x11'),_0x425409,_0x3fc3b0);}return util[_0x2822('0x10')](_0x2822('0x11'),_0x3fc3b0,_0x3fc3b0);}if(!_['isUndefined'](_0x32edd0)&&_0x2822('0xe')===typeof _0x32edd0&&!_[_0x2822('0xf')](_0x32edd0)){return _0x32edd0;}return'\x22\x22\x20<>';};exports[_0x2822('0x12')]=function(_0x56f2ab){if(_[_0x2822('0x13')](_0x56f2ab)){return![];}return _0x56f2ab;};exports[_0x2822('0x14')]=function(_0x1123db,_0x1412b9,_0x4340ea,_0x1df063,_0x3a35d6,_0x3da245){var _0x365aa4={'XMD-QUEUE':_0x1412b9[_0x2822('0x15')]?_0x1412b9['Queue'][_0x2822('0x16')]:'','XMD-CALLERID':_0x1df063,'XMD-CALLERID-PREVIEW':_0x3da245?util[_0x2822('0x10')](_0x2822('0x11'),_0x3da245[_0x2822('0x17')],_0x3da245['calleridnum']):_0x1df063,'XMD-DIALID':_0x3a35d6,'XMD-CONTACTID':_0x1412b9['ContactId'],'XMD-CDRTYPE':_0x2822('0x18'),'CALLERID(all)':_0x1df063,'XMD-VOICEQUEUEID':_0x1412b9['VoiceQueueId'],'XMD-DIALCHANNEL':_0x4340ea,'XMD-DIALTIMEOUT':_0x1123db[_0x2822('0x19')]||0x1e,'XMD-DIALOPTIONS':util[_0x2822('0x10')]('\x22rtTxX%s%s\x22',_0x1123db[_0x2822('0x1a')]?'g':'',_[_0x2822('0xf')](_0x1123db[_0x2822('0x1b')])?'':_0x2822('0x1c')),'XMD-DIALURL':_0x1123db[_0x2822('0x1d')]||'','XMD-AGI':_0x1123db['dialQueueProject']?util[_0x2822('0x10')](_0x2822('0x1e'),ipAgi,_0x1123db[_0x2822('0x1f')]):_0x2822('0x20'),'XMD-AGIAFTER':_0x1123db[_0x2822('0x1a')]?util[_0x2822('0x10')](_0x2822('0x1e'),ipAgi,_0x1123db[_0x2822('0x1a')]):_0x2822('0x20'),'XMD-ORIGINATECALLERIDNUM':_0x3da245?_0x3da245['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x3da245?_0x3da245[_0x2822('0x21')]:'','XMD-DESTINATION':_0x2822('0x22'),'SIPADDHEADER':_0x2822('0x23')};if(!_['isEmpty'](_0x1123db[_0x2822('0x1b')])){_0x365aa4[util[_0x2822('0x10')]('%s',_0x2822('0x24'))]=_0x1123db[_0x2822('0x1b')];_0x365aa4[util[_0x2822('0x10')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x3a35d6;}return _0x365aa4;};exports[_0x2822('0x25')]=function(_0x42dc44){var _0x291d08={};for(var _0x1d4092 in _0x42dc44){if(_0x42dc44[_0x2822('0x26')](_0x1d4092)){_0x291d08[util[_0x2822('0x10')]('%s',_[_0x2822('0x27')](_0x1d4092))]=_0x42dc44[_0x1d4092];}}return{'variables':_0x291d08};};exports[_0x2822('0x28')]=function(_0x6a3967,_0x1d59e1){if(!_[_0x2822('0x13')](_0x6a3967)){if(_0x6a3967[_0x2822('0x26')]('originated')){if(_0x6a3967['originated']>0x0){_0x6a3967[_0x2822('0x29')]-=0x1;}else{logger[_0x2822('0x6')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x1d59e1);}}}else{logger[_0x2822('0x6')](_0x2822('0x2a'),_0x1d59e1);}};exports[_0x2822('0x2b')]=function(_0x358318){var _0xb8573b=moment()['format'](_0x2822('0x2c'));_0x358318['state']=0xd;_0x358318[_0x2822('0x2d')]=_0x2822('0x2e');_0x358318[_0x2822('0x2f')]=_0xb8573b;_0x358318[_0x2822('0x30')]=_0xb8573b;_0x358318[_0x2822('0x31')]=_0xb8573b;};exports[_0x2822('0x32')]=function(_0x1f52c3,_0x178b87,_0x58e66a){var _0x591f0f=moment()[_0x2822('0x10')](_0x2822('0x2c'));_0x1f52c3[_0x2822('0x33')]=_0x178b87;_0x1f52c3[_0x2822('0x2d')]=_0x58e66a;_0x1f52c3['responsetime']=_0x591f0f;_0x1f52c3['ringtime']=utils[_0x2822('0x34')](_0x1f52c3[_0x2822('0x30')],_0x1f52c3['starttime']);};exports['logLookAgent']=function(_0xb3caab,_0x4fb7c2,_0x4df000){_0xb3caab['membername']=_0x4fb7c2;_0xb3caab[_0x2822('0x35')]=_0x4df000;};exports[_0x2822('0x36')]=function(_0x2c7611,_0x557075,_0x1013df){var _0x64b092=moment()[_0x2822('0x10')](_0x2822('0x2c'));_0x2c7611[_0x2822('0x33')]=_0x557075;_0x2c7611[_0x2822('0x2d')]=_0x1013df;_0x2c7611['responsetime']=_0x2c7611[_0x2822('0x30')]?_0x2c7611[_0x2822('0x30')]:_0x64b092;_0x2c7611['endtime']=_0x2c7611[_0x2822('0x31')]?_0x2c7611[_0x2822('0x31')]:_0x64b092;_0x2c7611[_0x2822('0x37')]=utils[_0x2822('0x34')](_0x2c7611[_0x2822('0x30')]||0x0,_0x2c7611['starttime']||0x0);_0x2c7611[_0x2822('0x38')]=_0x2c7611[_0x2822('0x39')]?utils[_0x2822('0x34')](_0x2c7611[_0x2822('0x31')],_0x2c7611[_0x2822('0x39')]):0x0;};exports[_0x2822('0x3a')]=function(_0x509cfd){return _0x509cfd===_0x2822('0x3b');};exports[_0x2822('0x3c')]=function(_0x3946c5,_0x1ea13b,_0x17c31e,_0x466286,_0x13f50b){var _0x2f62f1=_0x466286?_0x2822('0x3d'):_0x3946c5[_0x2822('0x17')];_0x2f62f1=_0x13f50b?_0x2822('0x3e'):_0x2f62f1;return{'actionid':_0x3946c5['uniqueid'],'action':'originate','channel':_0x3946c5[_0x2822('0x3f')],'callerid':util[_0x2822('0x10')](_0x2822('0x11'),_0x2f62f1,_0x3946c5[_0x2822('0x40')]),'Exten':_0x2822('0x22'),'Context':_0x2822('0x41'),'Priority':'1','variable':_0x17c31e,'timeout':(_0x1ea13b[_0x2822('0x42')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3946c5['uniqueid']};};exports['totalGlobal']=function(_0xf442b){return _0xf442b[_0x2822('0x43')]+_0xf442b['countcongestionretry']+_0xf442b['countnoanswerretry']+_0xf442b[_0x2822('0x44')]+_0xf442b[_0x2822('0x45')];};exports['cloneAction']=function(_0x38e699){var _0x4d17d9=_['clone'](_0x38e699);_0x4d17d9[_0x2822('0x33')]=0xf;_0x4d17d9['statedesc']='Global';return _0x4d17d9;};exports[_0x2822('0x46')]=function(_0x4dabbf,_0x4c41eb,_0x310c7b){var _0x359787={};_0x359787[_0x4c41eb]=_0x4dabbf[_0x4c41eb];_0x359787['active']=![];_0x359787[_0x2822('0x47')]=moment()[_0x2822('0x48')](_0x310c7b,_0x2822('0x49'))['format'](_0x2822('0x2c'));_0x359787['ContactId']=_0x4dabbf['ContactId'];_0x359787[_0x2822('0x4a')]=_0x4dabbf[_0x2822('0x4a')];_0x359787[_0x2822('0x4b')]=_0x4dabbf[_0x2822('0x4b')]||undefined;return _0x359787;};exports[_0x2822('0x4c')]=function(_0x5281bc,_0x5c73e5){if(!_[_0x2822('0x13')](_0x5281bc)){if(_0x5281bc[_0x2822('0x4d')]>0x0){_0x5281bc[_0x2822('0x4d')]-=0x1;}else{logger['error'](_0x5c73e5,_0x2822('0x4e'));}}else{logger[_0x2822('0x6')](_0x5c73e5,_0x2822('0x4f'));}};exports[_0x2822('0x50')]=function(_0x1fa46f){if(_0x1fa46f<=0x0){return!![];}return![];};function buildObj(_0x1e9bb4,_0xea697b,_0x2c5823){_0x1e9bb4[_0x2822('0x51')]=_0xea697b;_0x1e9bb4['name']=_0x1e9bb4[_0x2822('0x52')];_0x1e9bb4[_0x2822('0x53')]=_0x1e9bb4[_0x2822('0x3f')];_0x1e9bb4[_0x2822('0x54')]='voice';if(_0x2c5823){_0x1e9bb4[_0x2822('0x55')]=_0x2c5823[_0x2822('0x55')];}return _0x1e9bb4;}exports[_0x2822('0x56')]=buildObj;exports[_0x2822('0x57')]=function(_0x1ca597){var _0x2ffa03=[];for(var _0x4553b2 in _0x1ca597){if(_0x1ca597['hasOwnProperty'](_0x4553b2)){if(!_[_0x2822('0x13')](_0x1ca597[_0x4553b2])&&_0x1ca597[_0x4553b2][_0x2822('0x33')]===_0x2822('0x58')&&_0x1ca597[_0x4553b2][_0x2822('0x59')]===_0x2822('0x5a')){_0x2ffa03[_0x2822('0x5b')](_0x1ca597[_0x4553b2]['id']);}}}return _0x2ffa03;};exports['getDiff']=function(_0x1d9d2f){var _0x1346ba=moment()[_0x2822('0x5c')](0x0);var _0x2d63ad=moment(_0x1d9d2f)[_0x2822('0x5c')](0x0);return _0x1346ba[_0x2822('0x5d')](_0x2d63ad,_0x2822('0x5e'));};exports[_0x2822('0x5f')]=function(_0x3aeeb3){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3aeeb3[_0x2822('0x60')],'ListId':_0x3aeeb3[_0x2822('0x4a')],'VoiceQueueId':_0x3aeeb3[_0x2822('0x4b')]||undefined,'CampaignId':_0x3aeeb3[_0x2822('0x61')]||undefined};};exports['filterKey']=function(_0x241de2){if(_0x241de2===_0x2822('0x62')||_0x241de2===_0x2822('0x63')||_0x241de2==='queue'||_0x241de2===_0x2822('0x64')||_0x241de2===_0x2822('0x65')||_0x241de2===_0x2822('0x66')||_0x241de2==='membername'||_0x241de2===_0x2822('0x3f')||_0x241de2===_0x2822('0x17')||_0x241de2===_0x2822('0x67')||_0x241de2===_0x2822('0x40')||_0x241de2===_0x2822('0x47')||_0x241de2===_0x2822('0x43')||_0x241de2===_0x2822('0x68')||_0x241de2===_0x2822('0x69')||_0x241de2==='countglobal'||_0x241de2===_0x2822('0x6a')||_0x241de2===_0x2822('0x6b')||_0x241de2==='callbackat'||_0x241de2===_0x2822('0x6c')||_0x241de2===_0x2822('0x60')||_0x241de2===_0x2822('0x4a')||_0x241de2==='UserId'||_0x241de2==='VoiceQueueId'||_0x241de2===_0x2822('0x6d')||_0x241de2===_0x2822('0x6e')||_0x241de2===_0x2822('0x6f')||_0x241de2===_0x2822('0x70')||_0x241de2===_0x2822('0x71')||_0x241de2===_0x2822('0x72')||_0x241de2===_0x2822('0x73')||_0x241de2==='xmd-dialoptions'||_0x241de2==='xmd-dialid'||_0x241de2===_0x2822('0x74')||_0x241de2===_0x2822('0x75')||_0x241de2===_0x2822('0x76')||_0x241de2==='xmd-callerid'||_0x241de2===_0x2822('0x77')||_0x241de2===_0x2822('0x78')||_0x241de2===_0x2822('0x79')||_0x241de2===_0x2822('0x7a')||_0x241de2===_0x2822('0x7b')||_0x241de2===_0x2822('0x7c')||_0x241de2==='rtpaudioqosloss'||_0x241de2===_0x2822('0x7d')||_0x241de2===_0x2822('0x7e')||_0x241de2==='rtpaudioqosrttbridged'||_0x241de2===_0x2822('0x79')||_0x241de2===_0x2822('0x7a')||_0x241de2==='rtpaudioqosjitter'||_0x241de2===_0x2822('0x7c')||_0x241de2===_0x2822('0x7f')||_0x241de2===_0x2822('0x7d')||_0x241de2===_0x2822('0x7e')||_0x241de2===_0x2822('0x80')||_0x241de2===_0x2822('0x81')||_0x241de2===_0x2822('0x82')||_0x241de2===_0x2822('0x33')||_0x241de2==='statedesc'){return![];}return!![];};exports[_0x2822('0x83')]=function(_0x28c048,_0x193686){var _0x40e9c7,_0x120738,_0x387eb9;if(_0x193686<=0x0){_0x193686=0x1;}_0x40e9c7=new RegExp(_0x2822('0x84')+_0x193686+'}$');_0x120738=Math[_0x2822('0x85')](0xa,_0x193686-0x1);_0x387eb9=Math[_0x2822('0x85')](0xa,_0x193686)-0x1;return util['format']('%s',_[_0x2822('0x86')](_0x28c048,_0x40e9c7,_['random'](_0x120738,_0x387eb9)));};exports[_0x2822('0x87')]=function(_0x1c20c1){var _0xbb72f9=_0x1c20c1[_0x2822('0x88')](/"(.*?)"/);return _0xbb72f9?_0xbb72f9[0x1]:_0x1c20c1;};exports[_0x2822('0x89')]=function(_0x4425a0){var _0x1ffb70=_0x4425a0['match'](/<(.*?)>/);return _0x1ffb70?_0x1ffb70[0x1]:_0x4425a0;};function buildNoAnswerEventPayload(_0x4fe2c0,_0x57f4ff){var _0x42acae=buildObj(_0x4fe2c0,'noanswer');if(!_[_0x2822('0xf')](_0x57f4ff[_0x2822('0x8a')])){Object[_0x2822('0x8b')](_0x57f4ff['variables'])[_0x2822('0x8c')](function(_0x29335c){_0x42acae[_0x29335c[_0x2822('0x8d')]()]=_0x57f4ff[_0x2822('0x8a')][_0x29335c];});}return _0x42acae;}exports[_0x2822('0x8e')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0xe408=['logger','info','loggerError','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','statedesc','responsetime','ringtime','getSeconds','starttime','logLookAgent','membername','UserId','logCustomer','endtime','answertime','isFailure','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','queue','interface','voice','mandatoryDisposition','agentReadyId','not_inuse','status','push','getDiff','milliseconds','diff','filterKey','idContact','type','campaigntype','dialAnswer','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','sipcallid','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','random','extractCalleridName','match','noanswer','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','env','XCALLY_IP_AGI','../../dialer/utils','loggerCatch','error','inspect'];(function(_0x4e0546,_0x1ea6a){var _0x280b16=function(_0x2d2329){while(--_0x2d2329){_0x4e0546['push'](_0x4e0546['shift']());}};_0x280b16(++_0x1ea6a);}(_0xe408,0x19d));var _0x8e40=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xe408[_0x2be8c2];return _0x97f531;};'use strict';var util=require(_0x8e40('0x0'));var _=require(_0x8e40('0x1'));var moment=require(_0x8e40('0x2'));var logger=require(_0x8e40('0x3'))('preview');var ipAgi=process[_0x8e40('0x4')][_0x8e40('0x5')]||'127.0.0.1';var utils=require(_0x8e40('0x6'));exports[_0x8e40('0x7')]=function(_0x1f9cbf){return function(_0x5e4f15){logger[_0x8e40('0x8')](_0x1f9cbf,util[_0x8e40('0x9')](_0x5e4f15,{'showHidden':![],'depth':null}));};};exports[_0x8e40('0xa')]=function(_0x41c57e,_0x29cfb0){logger[_0x8e40('0xb')](_0x41c57e,util[_0x8e40('0x9')](_0x29cfb0,{'showHidden':![],'depth':null}));};exports[_0x8e40('0xc')]=function(_0xc36340,_0x3d83c2){logger[_0x8e40('0x8')](_0xc36340,util[_0x8e40('0x9')](_0x3d83c2,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x2a41c6){return function(_0x9936fc){logger['info'](_0x2a41c6,util['inspect'](_0x9936fc,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x181b91,_0x11de41,_0x5819fe){return{'message':_0x181b91,'unlock':_0x11de41,'active':_0x5819fe};};exports[_0x8e40('0xd')]=function(_0x43a3cb,_0x2b6519,_0x534975){if(!_[_0x8e40('0xe')](_0x534975)&&_0x8e40('0xf')===typeof _0x534975&&!_[_0x8e40('0x10')](_0x534975)){if(!_[_0x8e40('0xe')](_0x2b6519)&&_0x8e40('0xf')===typeof _0x2b6519&&!_[_0x8e40('0x10')](_0x2b6519)){return util[_0x8e40('0x11')]('\x22%s\x22\x20<%s>',_0x2b6519,_0x534975);}return util['format'](_0x8e40('0x12'),_0x534975,_0x534975);}if(!_['isUndefined'](_0x43a3cb)&&_0x8e40('0xf')===typeof _0x43a3cb&&!_[_0x8e40('0x10')](_0x43a3cb)){return _0x43a3cb;}return _0x8e40('0x13');};exports['isActive']=function(_0x87259c){if(_[_0x8e40('0x14')](_0x87259c)){return![];}return _0x87259c;};exports[_0x8e40('0x15')]=function(_0x3e3401,_0x31f3e9,_0x50167d,_0x27ddf2,_0x4eadc1,_0x5caba0){var _0x3b5ca4={'XMD-QUEUE':_0x31f3e9[_0x8e40('0x16')]?_0x31f3e9[_0x8e40('0x16')][_0x8e40('0x17')]:'','XMD-CALLERID':_0x27ddf2,'XMD-CALLERID-PREVIEW':_0x5caba0?util['format'](_0x8e40('0x12'),_0x5caba0[_0x8e40('0x18')],_0x5caba0[_0x8e40('0x19')]):_0x27ddf2,'XMD-DIALID':_0x4eadc1,'XMD-CONTACTID':_0x31f3e9[_0x8e40('0x1a')],'XMD-CDRTYPE':_0x8e40('0x1b'),'CALLERID(all)':_0x27ddf2,'XMD-VOICEQUEUEID':_0x31f3e9[_0x8e40('0x1c')],'XMD-DIALCHANNEL':_0x50167d,'XMD-DIALTIMEOUT':_0x3e3401['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x8e40('0x11')](_0x8e40('0x1d'),_0x3e3401[_0x8e40('0x1e')]?'g':'',_['isEmpty'](_0x3e3401[_0x8e40('0x1f')])?'':_0x8e40('0x20')),'XMD-DIALURL':_0x3e3401[_0x8e40('0x21')]||'','XMD-AGI':_0x3e3401[_0x8e40('0x22')]?util[_0x8e40('0x11')](_0x8e40('0x23'),ipAgi,_0x3e3401[_0x8e40('0x22')]):_0x8e40('0x24'),'XMD-AGIAFTER':_0x3e3401['dialQueueProject2']?util[_0x8e40('0x11')](_0x8e40('0x23'),ipAgi,_0x3e3401['dialQueueProject2']):_0x8e40('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x5caba0?_0x5caba0['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x5caba0?_0x5caba0[_0x8e40('0x25')]:'','XMD-DESTINATION':_0x8e40('0x26'),'SIPADDHEADER':_0x8e40('0x27')};if(!_[_0x8e40('0x10')](_0x3e3401[_0x8e40('0x1f')])){_0x3b5ca4[util['format']('%s',_0x8e40('0x28'))]=_0x3e3401[_0x8e40('0x1f')];_0x3b5ca4[util[_0x8e40('0x11')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x4eadc1;}return _0x3b5ca4;};exports[_0x8e40('0x29')]=function(_0x332ffd){var _0x314eee={};for(var _0x5c35f6 in _0x332ffd){if(_0x332ffd['hasOwnProperty'](_0x5c35f6)){_0x314eee[util[_0x8e40('0x11')]('%s',_[_0x8e40('0x2a')](_0x5c35f6))]=_0x332ffd[_0x5c35f6];}}return{'variables':_0x314eee};};exports[_0x8e40('0x2b')]=function(_0xe4702d,_0x139a7b){if(!_[_0x8e40('0x14')](_0xe4702d)){if(_0xe4702d['hasOwnProperty'](_0x8e40('0x2c'))){if(_0xe4702d[_0x8e40('0x2c')]>0x0){_0xe4702d['originated']-=0x1;}else{logger[_0x8e40('0x8')](_0x8e40('0x2d'),_0x139a7b);}}}else{logger[_0x8e40('0x8')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x139a7b);}};exports[_0x8e40('0x2e')]=function(_0x240da7){var _0x8eb03=moment()[_0x8e40('0x11')](_0x8e40('0x2f'));_0x240da7[_0x8e40('0x30')]=0xd;_0x240da7['statedesc']=_0x8e40('0x31');_0x240da7['starttime']=_0x8eb03;_0x240da7['responsetime']=_0x8eb03;_0x240da7['endtime']=_0x8eb03;};exports['logAgent']=function(_0x2b634f,_0x269356,_0x4ee519){var _0x2e885a=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2b634f[_0x8e40('0x30')]=_0x269356;_0x2b634f[_0x8e40('0x32')]=_0x4ee519;_0x2b634f[_0x8e40('0x33')]=_0x2e885a;_0x2b634f[_0x8e40('0x34')]=utils[_0x8e40('0x35')](_0x2b634f['responsetime'],_0x2b634f[_0x8e40('0x36')]);};exports[_0x8e40('0x37')]=function(_0x3353ea,_0x4faeca,_0x52b9d1){_0x3353ea[_0x8e40('0x38')]=_0x4faeca;_0x3353ea[_0x8e40('0x39')]=_0x52b9d1;};exports[_0x8e40('0x3a')]=function(_0x22de98,_0x4c3fc9,_0x412ba9){var _0x4751e2=moment()[_0x8e40('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x22de98[_0x8e40('0x30')]=_0x4c3fc9;_0x22de98[_0x8e40('0x32')]=_0x412ba9;_0x22de98['responsetime']=_0x22de98[_0x8e40('0x33')]?_0x22de98[_0x8e40('0x33')]:_0x4751e2;_0x22de98['endtime']=_0x22de98['endtime']?_0x22de98[_0x8e40('0x3b')]:_0x4751e2;_0x22de98[_0x8e40('0x34')]=utils[_0x8e40('0x35')](_0x22de98['responsetime']||0x0,_0x22de98[_0x8e40('0x36')]||0x0);_0x22de98['talktime']=_0x22de98[_0x8e40('0x3c')]?utils[_0x8e40('0x35')](_0x22de98['endtime'],_0x22de98[_0x8e40('0x3c')]):0x0;};exports[_0x8e40('0x3d')]=function(_0x362ab3){return _0x362ab3==='Failure';};exports['variablesAction']=function(_0x1e1fb2,_0x48cbbe,_0x4a103b,_0xa836de,_0x21eff3){var _0x4eed2e=_0xa836de?_0x8e40('0x3e'):_0x1e1fb2[_0x8e40('0x18')];_0x4eed2e=_0x21eff3?_0x8e40('0x3f'):_0x4eed2e;return{'actionid':_0x1e1fb2[_0x8e40('0x40')],'action':_0x8e40('0x41'),'channel':_0x1e1fb2[_0x8e40('0x42')],'callerid':util[_0x8e40('0x11')](_0x8e40('0x12'),_0x4eed2e,_0x1e1fb2[_0x8e40('0x19')]),'Exten':_0x8e40('0x26'),'Context':_0x8e40('0x43'),'Priority':'1','variable':_0x4a103b,'timeout':(_0x48cbbe[_0x8e40('0x44')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1e1fb2[_0x8e40('0x40')]};};exports[_0x8e40('0x45')]=function(_0x574e4d){return _0x574e4d[_0x8e40('0x46')]+_0x574e4d[_0x8e40('0x47')]+_0x574e4d['countnoanswerretry']+_0x574e4d['countagentrejectretry']+_0x574e4d[_0x8e40('0x48')];};exports[_0x8e40('0x49')]=function(_0x5e5b15){var _0x34ad6d=_[_0x8e40('0x4a')](_0x5e5b15);_0x34ad6d[_0x8e40('0x30')]=0xf;_0x34ad6d[_0x8e40('0x32')]=_0x8e40('0x4b');return _0x34ad6d;};exports[_0x8e40('0x4c')]=function(_0x5ab680,_0x3c1b55,_0x5944cf){var _0xc16357={};_0xc16357[_0x3c1b55]=_0x5ab680[_0x3c1b55];_0xc16357[_0x8e40('0x4d')]=![];_0xc16357[_0x8e40('0x4e')]=moment()[_0x8e40('0x4f')](_0x5944cf,_0x8e40('0x50'))[_0x8e40('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0xc16357[_0x8e40('0x1a')]=_0x5ab680[_0x8e40('0x1a')];_0xc16357[_0x8e40('0x51')]=_0x5ab680['ListId'];_0xc16357[_0x8e40('0x1c')]=_0x5ab680['VoiceQueueId']||undefined;return _0xc16357;};exports['decrementTalkink']=function(_0x523193,_0x4e2646){if(!_[_0x8e40('0x14')](_0x523193)){if(_0x523193[_0x8e40('0x52')]>0x0){_0x523193[_0x8e40('0x52')]-=0x1;}else{logger[_0x8e40('0x8')](_0x4e2646,_0x8e40('0x53'));}}else{logger[_0x8e40('0x8')](_0x4e2646,_0x8e40('0x54'));}};exports[_0x8e40('0x55')]=function(_0x5a21de){if(_0x5a21de<=0x0){return!![];}return![];};function buildObj(_0x5bd1e5,_0x3c33e6,_0x3f224d){_0x5bd1e5['lastevent']=_0x3c33e6;_0x5bd1e5[_0x8e40('0x17')]=_0x5bd1e5[_0x8e40('0x56')];_0x5bd1e5[_0x8e40('0x57')]=_0x5bd1e5['channelAgent'];_0x5bd1e5['motionChannel']=_0x8e40('0x58');if(_0x3f224d){_0x5bd1e5[_0x8e40('0x59')]=_0x3f224d['mandatoryDisposition'];}return _0x5bd1e5;}exports['buildObj']=buildObj;exports[_0x8e40('0x5a')]=function(_0x3dd6dd){var _0x4003c8=[];for(var _0x2c9240 in _0x3dd6dd){if(_0x3dd6dd['hasOwnProperty'](_0x2c9240)){if(!_[_0x8e40('0x14')](_0x3dd6dd[_0x2c9240])&&_0x3dd6dd[_0x2c9240]['state']===_0x8e40('0x5b')&&_0x3dd6dd[_0x2c9240][_0x8e40('0x5c')]==='reachable'){_0x4003c8[_0x8e40('0x5d')](_0x3dd6dd[_0x2c9240]['id']);}}}return _0x4003c8;};exports[_0x8e40('0x5e')]=function(_0x499ed1){var _0x147cad=moment()[_0x8e40('0x5f')](0x0);var _0x5c9b2a=moment(_0x499ed1)[_0x8e40('0x5f')](0x0);return _0x147cad[_0x8e40('0x60')](_0x5c9b2a,'seconds');};exports['createBody']=function(_0x397d43){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x397d43['ContactId'],'ListId':_0x397d43[_0x8e40('0x51')],'VoiceQueueId':_0x397d43['VoiceQueueId']||undefined,'CampaignId':_0x397d43['CampaignId']||undefined};};exports[_0x8e40('0x61')]=function(_0xabd70c){if(_0xabd70c==='uniqueid'||_0xabd70c===_0x8e40('0x62')||_0xabd70c===_0x8e40('0x56')||_0xabd70c===_0x8e40('0x63')||_0xabd70c===_0x8e40('0x64')||_0xabd70c===_0x8e40('0x65')||_0xabd70c===_0x8e40('0x38')||_0xabd70c===_0x8e40('0x42')||_0xabd70c===_0x8e40('0x18')||_0xabd70c===_0x8e40('0x4d')||_0xabd70c==='calleridnum'||_0xabd70c===_0x8e40('0x4e')||_0xabd70c===_0x8e40('0x46')||_0xabd70c===_0x8e40('0x47')||_0xabd70c===_0x8e40('0x66')||_0xabd70c===_0x8e40('0x67')||_0xabd70c===_0x8e40('0x68')||_0xabd70c===_0x8e40('0x69')||_0xabd70c===_0x8e40('0x6a')||_0xabd70c==='recallme'||_0xabd70c==='ContactId'||_0xabd70c===_0x8e40('0x51')||_0xabd70c===_0x8e40('0x39')||_0xabd70c===_0x8e40('0x1c')||_0xabd70c===_0x8e40('0x6b')||_0xabd70c===_0x8e40('0x6c')||_0xabd70c===_0x8e40('0x6d')||_0xabd70c==='xmd-phone'||_0xabd70c===_0x8e40('0x6e')||_0xabd70c===_0x8e40('0x6f')||_0xabd70c===_0x8e40('0x70')||_0xabd70c===_0x8e40('0x71')||_0xabd70c===_0x8e40('0x72')||_0xabd70c==='xmd-dialchannel'||_0xabd70c===_0x8e40('0x73')||_0xabd70c===_0x8e40('0x74')||_0xabd70c===_0x8e40('0x75')||_0xabd70c===_0x8e40('0x76')||_0xabd70c===_0x8e40('0x77')||_0xabd70c===_0x8e40('0x78')||_0xabd70c==='rtpaudioqosbridged'||_0xabd70c===_0x8e40('0x79')||_0xabd70c===_0x8e40('0x7a')||_0xabd70c===_0x8e40('0x7b')||_0xabd70c===_0x8e40('0x7c')||_0xabd70c===_0x8e40('0x7d')||_0xabd70c===_0x8e40('0x7e')||_0xabd70c==='rtpaudioqos'||_0xabd70c==='rtpaudioqosbridged'||_0xabd70c===_0x8e40('0x79')||_0xabd70c===_0x8e40('0x7a')||_0xabd70c==='rtpaudioqosloss'||_0xabd70c==='rtpaudioqoslossbridged'||_0xabd70c==='rtpaudioqosrtt'||_0xabd70c==='rtpaudioqosrttbridged'||_0xabd70c===_0x8e40('0x7f')||_0xabd70c===_0x8e40('0x80')||_0xabd70c===_0x8e40('0x30')||_0xabd70c==='statedesc'){return![];}return!![];};exports[_0x8e40('0x81')]=function(_0x5d1601,_0xe6031){var _0x35298a,_0x380117,_0xedc30e;if(_0xe6031<=0x0){_0xe6031=0x1;}_0x35298a=new RegExp(_0x8e40('0x82')+_0xe6031+'}$');_0x380117=Math[_0x8e40('0x83')](0xa,_0xe6031-0x1);_0xedc30e=Math[_0x8e40('0x83')](0xa,_0xe6031)-0x1;return util[_0x8e40('0x11')]('%s',_['replace'](_0x5d1601,_0x35298a,_[_0x8e40('0x84')](_0x380117,_0xedc30e)));};exports[_0x8e40('0x85')]=function(_0x1487fc){var _0x3cf860=_0x1487fc[_0x8e40('0x86')](/"(.*?)"/);return _0x3cf860?_0x3cf860[0x1]:_0x1487fc;};exports['extractCalleridNumber']=function(_0x433b88){var _0x1ffb4f=_0x433b88[_0x8e40('0x86')](/<(.*?)>/);return _0x1ffb4f?_0x1ffb4f[0x1]:_0x433b88;};function buildNoAnswerEventPayload(_0x503d77,_0x866d2){var _0x3f658c=buildObj(_0x503d77,_0x8e40('0x87'));if(!_[_0x8e40('0x10')](_0x866d2[_0x8e40('0x88')])){Object[_0x8e40('0x89')](_0x866d2[_0x8e40('0x88')])[_0x8e40('0x8a')](function(_0x5695f6){_0x3f658c[_0x5695f6[_0x8e40('0x8b')]()]=_0x866d2[_0x8e40('0x88')][_0x5695f6];});}return _0x3f658c;}exports[_0x8e40('0x8c')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 1f1bf79..35eeb11 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 _0xaeac=['queueadd','string','number','boolean','queueremove','queuepause','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xaeac,0x14d));var _0xcaea=function(_0x2972b0,_0x2af5e8){_0x2972b0=_0x2972b0-0x0;var _0x4dc7bb=_0xaeac[_0x2972b0];return _0x4dc7bb;};'use strict';exports[_0xcaea('0x0')]={'queue':{'type':_0xcaea('0x1'),'required':!![]},'interface':{'type':_0xcaea('0x1'),'required':!![]},'membername':{'type':_0xcaea('0x1'),'required':!![]},'penalty':{'type':_0xcaea('0x2'),'required':![]},'paused':{'type':_0xcaea('0x3'),'required':![]}};exports[_0xcaea('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xcaea('0x1'),'required':!![]}};exports[_0xcaea('0x5')]={'interface':{'type':_0xcaea('0x1'),'required':!![]},'paused':{'type':_0xcaea('0x3')},'reason':{'type':_0xcaea('0x1'),'required':![]}};exports['reload']={'module':{'type':_0xcaea('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xcaea('0x1'),'required':!![]}};exports[_0xcaea('0x6')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':'string'},'format':{'type':_0xcaea('0x1')},'mixmonitorid':{'type':_0xcaea('0x1')}};exports[_0xcaea('0x7')]={'uniqueid':{'type':_0xcaea('0x1'),'required':!![]}};exports[_0xcaea('0x8')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xcaea('0x1'),'required':!![]},'context':{'type':_0xcaea('0x1')}}; \ No newline at end of file +var _0x12c2=['queueadd','string','queueremove','boolean','voicequeuechannel','voicechannel','voicequeuechannelredirect'];(function(_0x22dac7,_0x45d32a){var _0x3e6cfa=function(_0x4c2e9d){while(--_0x4c2e9d){_0x22dac7['push'](_0x22dac7['shift']());}};_0x3e6cfa(++_0x45d32a);}(_0x12c2,0x1b9));var _0x212c=function(_0x51ed22,_0x5e3fb4){_0x51ed22=_0x51ed22-0x0;var _0x3330f8=_0x12c2[_0x51ed22];return _0x3330f8;};'use strict';exports[_0x212c('0x0')]={'queue':{'type':_0x212c('0x1'),'required':!![]},'interface':{'type':_0x212c('0x1'),'required':!![]},'membername':{'type':_0x212c('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':'boolean','required':![]}};exports[_0x212c('0x2')]={'queue':{'type':_0x212c('0x1'),'required':!![]},'interface':{'type':_0x212c('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':_0x212c('0x1'),'required':!![]},'paused':{'type':_0x212c('0x3')},'reason':{'type':_0x212c('0x1'),'required':![]}};exports['reload']={'module':{'type':_0x212c('0x1'),'required':![]}};exports[_0x212c('0x4')]={'uniqueid':{'type':_0x212c('0x1'),'required':!![]}};exports[_0x212c('0x5')]={'uniqueid':{'type':_0x212c('0x1'),'required':!![]},'filename':{'type':_0x212c('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0x212c('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x212c('0x1'),'required':!![]}};exports[_0x212c('0x6')]={'uniqueid':{'type':_0x212c('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index f0368a1..159f8a6 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(_0x4e3948,_0x4fb3c2){var _0x95e0e4=function(_0xe3a434){while(--_0xe3a434){_0x4e3948['push'](_0x4e3948['shift']());}};_0x95e0e4(++_0x4fb3c2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4a17eb,_0x2ff0bb){_0x4a17eb=_0x4a17eb-0x0;var _0x2f7cfe=_0x5f2f[_0x4a17eb];return _0x2f7cfe;};'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 _0xadb5=['ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','initTelephones','length','isUndefined','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','queuecallerleaveAt','diff','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','queuecallercompleteAt','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','moment','../model/agent','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','campaigns','templates','outbound','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','name','hasOwnProperty','isNil','interface','format','SIP/%s','total','answered','sumHoldTime','sumDuration','isEmpty'];(function(_0x29d47e,_0x5f329a){var _0x28ce5d=function(_0xbf55a8){while(--_0xbf55a8){_0x29d47e['push'](_0x29d47e['shift']());}};_0x28ce5d(++_0x5f329a);}(_0xadb5,0xad));var _0x5adb=function(_0x56fec6,_0x4d65b2){_0x56fec6=_0x56fec6-0x0;var _0x10b033=_0xadb5[_0x56fec6];return _0x10b033;};'use strict';var _=require('lodash');var moment=require(_0x5adb('0x0'));var util=require('util');var Agent=require(_0x5adb('0x1'));var Telephone=require(_0x5adb('0x2'));var Trunk=require(_0x5adb('0x3'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x5adb('0x4'));var Template=require(_0x5adb('0x5'));var Campaign=require(_0x5adb('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x5adb('0x7'));var SalesforceAccount=require(_0x5adb('0x8'));var FreshdeskAccount=require(_0x5adb('0x9'));var SugarcrmAccount=require(_0x5adb('0xa'));var ZohoAccount=require(_0x5adb('0xb'));var DeskAccount=require(_0x5adb('0xc'));var VtigerAccount=require(_0x5adb('0xd'));var ServicenowAccount=require(_0x5adb('0xe'));var Dynamics365Account=require(_0x5adb('0xf'));var FreshsalesAccount=require(_0x5adb('0x10'));var FaxAccount=require(_0x5adb('0x11'));function Realtime(){this[_0x5adb('0x12')]={};this[_0x5adb('0x13')]={};this[_0x5adb('0x14')]={};this['voiceQueues']={};this['triggers']={};this[_0x5adb('0x15')]={};this[_0x5adb('0x16')]={};this[_0x5adb('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x5adb('0x18')]={};this['queueChannels']={};this[_0x5adb('0x19')]={};this['timers']={};this[_0x5adb('0x1a')]={};this[_0x5adb('0x1b')]={};this[_0x5adb('0x1c')]={};this['sugarcrmAccounts']={};this[_0x5adb('0x1d')]={};this[_0x5adb('0x1e')]={};this[_0x5adb('0x1f')]={};this['vtigerAccounts']={};this[_0x5adb('0x20')]={};this['dynamics365Accounts']={};this[_0x5adb('0x21')]={};this[_0x5adb('0x22')]={};}function freeIsNotKey(_0x30614e,_0x304784,_0x1c0f97){var _0x39d24d=_[_0x5adb('0x23')](_0x30614e,function(_0x42f4c6){return _0x42f4c6[_0x1c0f97];});for(var _0xb953a6 in _0x304784){if(_0x304784['hasOwnProperty'](_0xb953a6)){if(!_0x39d24d[_0xb953a6]){delete _0x304784[_0xb953a6];}}}}function freeIsNotKeySip(_0x3fff62,_0x5de028){var _0x1d9e86=_['mapKeys'](_0x3fff62,function(_0x3ef465){return util['format']('SIP/%s',_0x3ef465[_0x5adb('0x24')]);});for(var _0x1bed20 in _0x5de028){if(_0x5de028[_0x5adb('0x25')](_0x1bed20)){if(!_0x1d9e86[_0x1bed20]){delete _0x5de028[_0x1bed20];}}}}function freeIsNotKeyAgent(_0x1fd4a7,_0x99bc6c){var _0x5af69d=_[_0x5adb('0x23')](_0x1fd4a7,function(_0x5c296e){var _0x4e9f16=_[_0x5adb('0x26')](_0x5c296e[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x5c296e[_0x5adb('0x24')]):_0x5c296e[_0x5adb('0x27')];return _0x4e9f16;});for(var _0xfd9bb9 in _0x99bc6c){if(_0x99bc6c['hasOwnProperty'](_0xfd9bb9)){if(!_0x5af69d[_0xfd9bb9]){delete _0x99bc6c[_0xfd9bb9];}}}}function clearVoiceCallReports(_0x4b1957){_0x4b1957[_0x5adb('0x2a')]=0x0;_0x4b1957[_0x5adb('0x2b')]=0x0;_0x4b1957[_0x5adb('0x2c')]=0x0;_0x4b1957[_0x5adb('0x2d')]=0x0;_0x4b1957['sumBillable']=0x0;}function clearCampaigns(_0x2fee18){if(!_[_0x5adb('0x2e')](_0x2fee18)){for(var _0x5aed76 in _0x2fee18){if(_0x2fee18[_0x5adb('0x25')](_0x5aed76)){_0x2fee18[_0x5aed76][_0x5adb('0x2f')]=0x0;_0x2fee18[_0x5aed76][_0x5adb('0x30')]=0x0;}}}}function clearVoiceQueues(_0x55b40a){if(!_[_0x5adb('0x2e')](_0x55b40a)){for(var _0xbe21b1 in _0x55b40a){if(_0x55b40a[_0x5adb('0x25')](_0xbe21b1)){_0x55b40a[_0xbe21b1][_0x5adb('0x2a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x2b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x31')]=0x0;_0x55b40a[_0xbe21b1]['abandoned']=0x0;_0x55b40a[_0xbe21b1]['sumHoldTime']=0x0;_0x55b40a[_0xbe21b1]['sumDuration']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x32')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x34')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x35')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x36')]=0x0;_0x55b40a[_0xbe21b1]['outboundNoSuchCallsDay']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x37')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x38')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x39')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3c')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3d')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3e')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3f')]=!![];}}}}Realtime['prototype'][_0x5adb('0x40')]=function(_0x4c8b2e,_0x12424d){for(var _0x20cde6 in _0x12424d){if(_0x4c8b2e['hasOwnProperty'](_0x20cde6)){_0x4c8b2e[_0x20cde6]=_0x12424d[_0x20cde6];}}};Realtime[_0x5adb('0x41')][_0x5adb('0x42')]=function(){var _0x461a39=this;return function(_0x4a3661){if(_0x4a3661){freeIsNotKeyAgent(_0x4a3661,_0x461a39[_0x5adb('0x12')]);for(var _0x14cf00=0x0,_0x4b5887={};_0x14cf00<_0x4a3661['length'];_0x14cf00+=0x1){_0x4b5887=_0x4a3661[_0x14cf00];var _0x1ed9ea=_['isNil'](_0x4b5887[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x4b5887[_0x5adb('0x24')]):_0x4b5887[_0x5adb('0x27')];if(_['isUndefined'](_0x461a39[_0x5adb('0x12')][_0x1ed9ea])){_0x461a39[_0x5adb('0x12')][_0x1ed9ea]=new Agent(_0x4b5887);}else{_0x461a39[_0x5adb('0x40')](_0x461a39['agents'][_0x1ed9ea],_0x4b5887);}}}return _0x461a39['agents'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x43')]=function(){var _0x586820=this;return function(_0x2355bc){if(_0x2355bc){freeIsNotKeySip(_0x2355bc,_0x586820['telephones']);for(var _0x199d3b=0x0,_0x58cc5d={};_0x199d3b<_0x2355bc[_0x5adb('0x44')];_0x199d3b+=0x1){_0x58cc5d=_0x2355bc[_0x199d3b];if(_['isUndefined'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')]('SIP/%s',_0x58cc5d[_0x5adb('0x24')])])){_0x586820['telephones'][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])]=new Telephone(_0x58cc5d);}else{_0x586820['mergeFromDatabase'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])],_0x58cc5d);}}}return _0x586820[_0x5adb('0x13')];};};Realtime['prototype']['initTrunks']=function(){var _0x4f491a=this;return function(_0x599999){if(_0x599999){freeIsNotKeySip(_0x599999,_0x4f491a[_0x5adb('0x14')]);for(var _0x2fbe14=0x0,_0x3a104a={};_0x2fbe14<_0x599999[_0x5adb('0x44')];_0x2fbe14+=0x1){_0x3a104a=_0x599999[_0x2fbe14];if(_[_0x5adb('0x45')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])])){_0x4f491a['trunks'][util[_0x5adb('0x28')]('SIP/%s',_0x3a104a[_0x5adb('0x24')])]=new Trunk(_0x3a104a);}else{_0x4f491a[_0x5adb('0x40')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])],_0x3a104a);}}}return _0x4f491a[_0x5adb('0x14')];};};Realtime[_0x5adb('0x41')]['initTriggers']=function(){var _0x4160ad=this;return function(_0x1a256c){if(_0x1a256c){freeIsNotKey(_0x1a256c,_0x4160ad['triggers'],'id');for(var _0x120497=0x0,_0x407a4c={};_0x120497<_0x1a256c[_0x5adb('0x44')];_0x120497+=0x1){_0x407a4c=_0x1a256c[_0x120497];if(_[_0x5adb('0x45')](_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']])){_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']]=new Trigger(_0x407a4c);}else{_0x4160ad[_0x5adb('0x40')](_0x4160ad['triggers'][_0x407a4c['id']],_0x407a4c);}}}return _0x4160ad['triggers'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x47')]=function(){var _0x1cd0a3=this;return function(_0xb79d85){if(_0xb79d85){freeIsNotKey(_0xb79d85,_0x1cd0a3['templates'],'id');for(var _0x507e48=0x0,_0xaa32e4={};_0x507e48<_0xb79d85[_0x5adb('0x44')];_0x507e48+=0x1){_0xaa32e4=_0xb79d85[_0x507e48];if(_[_0x5adb('0x45')](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']])){_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']]=new Template(_0xaa32e4);}else{_0x1cd0a3['mergeFromDatabase'](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']],_0xaa32e4);}}}return _0x1cd0a3[_0x5adb('0x16')];};};Realtime['prototype'][_0x5adb('0x48')]=function(){var _0x251f45=this;return function(_0x1cdb03){if(_0x1cdb03){freeIsNotKey(_0x1cdb03,_0x251f45[_0x5adb('0x1b')],'id');for(var _0x186bd2=0x0,_0x3a5409={};_0x186bd2<_0x1cdb03[_0x5adb('0x44')];_0x186bd2+=0x1){_0x3a5409=_0x1cdb03[_0x186bd2];if(_[_0x5adb('0x45')](_0x251f45['zendeskAccounts'][_0x3a5409['id']])){_0x251f45[_0x5adb('0x1b')][_0x3a5409['id']]=new ZendeskAccount(_0x3a5409);}else{_0x251f45['mergeFromDatabase'](_0x251f45['zendeskAccounts'][_0x3a5409['id']],_0x3a5409);}}}return _0x251f45['zendeskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x49')]=function(){var _0x207a81=this;return function(_0x4ba0b5){if(_0x4ba0b5){freeIsNotKey(_0x4ba0b5,_0x207a81[_0x5adb('0x1c')],'id');for(var _0x5cbab5=0x0,_0x177a81={};_0x5cbab5<_0x4ba0b5[_0x5adb('0x44')];_0x5cbab5+=0x1){_0x177a81=_0x4ba0b5[_0x5cbab5];if(_[_0x5adb('0x45')](_0x207a81['salesforceAccounts'][_0x177a81['id']])){_0x207a81[_0x5adb('0x1c')][_0x177a81['id']]=new SalesforceAccount(_0x177a81);}else{_0x207a81['mergeFromDatabase'](_0x207a81[_0x5adb('0x1c')][_0x177a81['id']],_0x177a81);}}}return _0x207a81[_0x5adb('0x1c')];};};Realtime['prototype'][_0x5adb('0x4a')]=function(){var _0x1ab97b=this;return function(_0x3594e3){if(_0x3594e3){freeIsNotKey(_0x3594e3,_0x1ab97b[_0x5adb('0x1d')],'id');for(var _0x372734=0x0,_0x4cb36c={};_0x372734<_0x3594e3[_0x5adb('0x44')];_0x372734+=0x1){_0x4cb36c=_0x3594e3[_0x372734];if(_[_0x5adb('0x45')](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']])){_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']]=new FreshdeskAccount(_0x4cb36c);}else{_0x1ab97b['mergeFromDatabase'](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']],_0x4cb36c);}}}return _0x1ab97b[_0x5adb('0x1d')];};};Realtime[_0x5adb('0x41')]['initZohoAccounts']=function(){var _0x2b34a8=this;return function(_0xd0e5b7){if(_0xd0e5b7){freeIsNotKey(_0xd0e5b7,_0x2b34a8[_0x5adb('0x1e')],'id');for(var _0xfd3471=0x0,_0x4f2da9={};_0xfd3471<_0xd0e5b7[_0x5adb('0x44')];_0xfd3471+=0x1){_0x4f2da9=_0xd0e5b7[_0xfd3471];if(_[_0x5adb('0x45')](_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']])){_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']]=new ZohoAccount(_0x4f2da9);}else{_0x2b34a8[_0x5adb('0x40')](_0x2b34a8['zohoAccounts'][_0x4f2da9['id']],_0x4f2da9);}}}return _0x2b34a8[_0x5adb('0x1e')];};};Realtime['prototype'][_0x5adb('0x4b')]=function(){var _0x4f7227=this;return function(_0x31ae72){if(_0x31ae72){freeIsNotKey(_0x31ae72,_0x4f7227[_0x5adb('0x1f')],'id');for(var _0x1a9358=0x0,_0x42f6d9={};_0x1a9358<_0x31ae72['length'];_0x1a9358+=0x1){_0x42f6d9=_0x31ae72[_0x1a9358];if(_[_0x5adb('0x45')](_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']])){_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']]=new DeskAccount(_0x42f6d9);}else{_0x4f7227['mergeFromDatabase'](_0x4f7227['deskAccounts'][_0x42f6d9['id']],_0x42f6d9);}}}return _0x4f7227['deskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x4c')]=function(){var _0xa5ecc0=this;return function(_0x12a146){if(_0x12a146){freeIsNotKey(_0x12a146,_0xa5ecc0[_0x5adb('0x4d')],'id');for(var _0xb06bee=0x0,_0x204b9b={};_0xb06bee<_0x12a146[_0x5adb('0x44')];_0xb06bee+=0x1){_0x204b9b=_0x12a146[_0xb06bee];if(_[_0x5adb('0x45')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']])){_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']]=new SugarcrmAccount(_0x204b9b);}else{_0xa5ecc0[_0x5adb('0x40')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']],_0x204b9b);}}}return _0xa5ecc0['sugarcrmAccounts'];};};Realtime['prototype'][_0x5adb('0x4e')]=function(){var _0x27a8e4=this;return function(_0x43cde9){if(_0x43cde9){freeIsNotKey(_0x43cde9,_0x27a8e4[_0x5adb('0x4f')],'id');for(var _0x5d7a9f=0x0,_0xfba0d5={};_0x5d7a9f<_0x43cde9[_0x5adb('0x44')];_0x5d7a9f+=0x1){_0xfba0d5=_0x43cde9[_0x5d7a9f];if(_['isUndefined'](_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']])){_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']]=new VtigerAccount(_0xfba0d5);}else{_0x27a8e4[_0x5adb('0x40')](_0x27a8e4['vtigerAccounts'][_0xfba0d5['id']],_0xfba0d5);}}}return _0x27a8e4[_0x5adb('0x4f')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x50')]=function(){var _0x30c92c=this;return function(_0x330290){if(_0x330290){freeIsNotKey(_0x330290,_0x30c92c[_0x5adb('0x20')],'id');for(var _0x513f26=0x0,_0x836b91={};_0x513f26<_0x330290[_0x5adb('0x44')];_0x513f26+=0x1){_0x836b91=_0x330290[_0x513f26];if(_[_0x5adb('0x45')](_0x30c92c['servicenowAccounts'][_0x836b91['id']])){_0x30c92c[_0x5adb('0x20')][_0x836b91['id']]=new ServicenowAccount(_0x836b91);}else{_0x30c92c[_0x5adb('0x40')](_0x30c92c[_0x5adb('0x20')][_0x836b91['id']],_0x836b91);}}}return _0x30c92c['servicenowAccounts'];};};Realtime[_0x5adb('0x41')]['initDynamics365Accounts']=function(){var _0xa8ff64=this;return function(_0x1e7e3a){if(_0x1e7e3a){freeIsNotKey(_0x1e7e3a,_0xa8ff64[_0x5adb('0x51')],'id');for(var _0x57f0a4=0x0,_0x192b1f={};_0x57f0a4<_0x1e7e3a[_0x5adb('0x44')];_0x57f0a4+=0x1){_0x192b1f=_0x1e7e3a[_0x57f0a4];if(_['isUndefined'](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']])){_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']]=new Dynamics365Account(_0x192b1f);}else{_0xa8ff64[_0x5adb('0x40')](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']],_0x192b1f);}}}return _0xa8ff64['dynamics365Accounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x52')]=function(){var _0x307f07=this;return function(_0x16716e){if(_0x16716e){freeIsNotKey(_0x16716e,_0x307f07['freshsalesAccounts'],'id');for(var _0x53a4bc=0x0,_0x304512={};_0x53a4bc<_0x16716e['length'];_0x53a4bc+=0x1){_0x304512=_0x16716e[_0x53a4bc];if(_['isUndefined'](_0x307f07['freshsalesAccounts'][_0x304512['id']])){_0x307f07[_0x5adb('0x21')][_0x304512['id']]=new FreshsalesAccount(_0x304512);}else{_0x307f07[_0x5adb('0x40')](_0x307f07['freshsalesAccounts'][_0x304512['id']],_0x304512);}}}return _0x307f07[_0x5adb('0x21')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x53')]=function(){var _0xf6ef8a=this;return function(_0x358a23){for(var _0x126e38=0x0;_0x126e38<_0x358a23[_0x5adb('0x44')];_0x126e38+=0x1){_[_0x5adb('0x54')](_0xf6ef8a['voiceQueues'][_0x358a23[_0x126e38]['name']],_0x358a23[_0x126e38]);}return _0xf6ef8a['voiceQueues'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x55')]=function(){var _0x3a0d1b=this;return function(_0x2a55a3){clearVoiceQueues(_0x3a0d1b[_0x5adb('0x56')]);if(_0x2a55a3){_0x2a55a3=_[_0x5adb('0x57')](_0x2a55a3,_0x5adb('0x58'));for(var _0x25f761 in _0x2a55a3){if(_0x2a55a3['hasOwnProperty'](_0x25f761)){for(var _0x5e55c2=0x0;_0x5e55c2<_0x2a55a3[_0x25f761][_0x5adb('0x44')];_0x5e55c2+=0x1){var _0x56df90=_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x59')];if(_0x3a0d1b[_0x5adb('0x56')][_0x56df90]){if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5a')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x31')]+=0x1;}if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5b')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x5c')]+=0x1;}_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallerjoinAt']),_0x5adb('0x5f'))||0x0;if(_0x5e55c2===_0x2a55a3[_0x25f761][_0x5adb('0x44')]-0x1){_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallercompleteAt']||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x60')]||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x61')])['diff'](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x62')]),_0x5adb('0x5f'))||0x0;_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2a')]+=0x1;if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x63')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2b')]+=0x1;_0x3a0d1b[_0x5adb('0x56')][_0x56df90]['sumBillable']+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x64')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')]),'seconds')||0x0;}}else{_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]||0x0;}}}}}}return _0x3a0d1b[_0x5adb('0x56')];};};Realtime[_0x5adb('0x41')]['initVoiceCallReports']=function(){var _0x3a9735=this;return function(_0x288e4f){clearVoiceCallReports(_0x3a9735[_0x5adb('0x17')]);if(_0x288e4f){for(var _0x3ecc56=0x0;_0x3ecc56<_0x288e4f[_0x5adb('0x44')];_0x3ecc56+=0x1){_0x3a9735['outbound'][_0x5adb('0x2a')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2d')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')];if(_0x288e4f[_0x3ecc56]['disposition']===_0x5adb('0x66')){_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2b')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2c')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')]-_0x288e4f[_0x3ecc56][_0x5adb('0x67')]||0x0;_0x3a9735['outbound'][_0x5adb('0x32')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x67')];}}}return _0x3a9735['outbound'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x68')]=function(){var _0x4fc0d5=this;return function(_0x462fa0){if(_0x462fa0){freeIsNotKey(_0x462fa0,_0x4fc0d5['campaigns'],_0x5adb('0x24'));for(var _0x268df2=0x0,_0x4a2ebc={};_0x268df2<_0x462fa0[_0x5adb('0x44')];_0x268df2+=0x1){_0x4a2ebc=_0x462fa0[_0x268df2];if(_['isUndefined'](_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]])){_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]]=new Campaign(_0x4a2ebc);}else{_0x4fc0d5[_0x5adb('0x40')](_0x4fc0d5['campaigns'][_0x4a2ebc[_0x5adb('0x24')]],_0x4a2ebc);_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]][_0x5adb('0x69')]=_0x4a2ebc['SquareProject']?_0x4a2ebc['SquareProject'][_0x5adb('0x24')]:undefined;}}}return _0x4fc0d5[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6a')]=function(){var _0x277668=this;return function(_0xc74e86){if(_0xc74e86){freeIsNotKey(_0xc74e86,_0x277668[_0x5adb('0x6b')],'id');for(var _0x514833=0x0,_0xda26cc={};_0x514833<_0xc74e86[_0x5adb('0x44')];_0x514833+=0x1){_0xda26cc=_0xc74e86[_0x514833];if(_[_0x5adb('0x45')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']])){_0x277668['voiceExtensions'][_0xda26cc['id']]=new VoiceExtension(_0xda26cc);}else{_0x277668[_0x5adb('0x40')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']],_0xda26cc);}}}return _0x277668[_0x5adb('0x6b')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6c')]=function(){var _0x188cbd=this;return function(_0x315ac6){clearCampaigns(_0x188cbd[_0x5adb('0x15')]);for(var _0x1f753e=0x0;_0x1f753e<_0x315ac6['length'];_0x1f753e+=0x1){_[_0x5adb('0x54')](_0x188cbd[_0x5adb('0x15')][_0x315ac6[_0x1f753e]['name']],_0x315ac6[_0x1f753e]);}return _0x188cbd[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6d')]=function(){var _0x3bb3fc=this;return function(_0x200221){if(_0x200221){freeIsNotKey(_0x200221,_0x3bb3fc[_0x5adb('0x22')],'id');for(var _0x450516=0x0,_0x350bb1={};_0x450516<_0x200221['length'];_0x450516+=0x1){_0x350bb1=_0x200221[_0x450516];if(_[_0x5adb('0x45')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']])){_0x3bb3fc['faxAccounts'][_0x350bb1['id']]=new FaxAccount(_0x350bb1);}else{_0x3bb3fc[_0x5adb('0x40')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']],_0x350bb1);}}}return _0x3bb3fc[_0x5adb('0x22')];};};Realtime['prototype']['initVoiceQueues']=function(){var _0x2d7a9f=this;return function(_0x328851){if(_0x328851){freeIsNotKey(_0x328851,_0x2d7a9f[_0x5adb('0x56')],'name');for(var _0x14b36f=0x0,_0x321c3a={};_0x14b36f<_0x328851[_0x5adb('0x44')];_0x14b36f+=0x1){_0x321c3a=_0x328851[_0x14b36f];if(_[_0x5adb('0x45')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]])){_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]]=new VoiceQueue(_0x321c3a);}else{_0x2d7a9f[_0x5adb('0x40')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]],_0x321c3a);}}}return _0x2d7a9f[_0x5adb('0x56')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 36b779f..f7ff14c 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 _0x56bf=['mergeDBDataToRealtime'];(function(_0x5a16e0,_0x17a147){var _0x4aa617=function(_0x22d329){while(--_0x22d329){_0x5a16e0['push'](_0x5a16e0['shift']());}};_0x4aa617(++_0x17a147);}(_0x56bf,0x1d9));var _0xf56b=function(_0xe15270,_0x227d06){_0xe15270=_0xe15270-0x0;var _0x1e813b=_0x56bf[_0xe15270];return _0x1e813b;};'use strict';function mergeDBDataToRealtime(_0x381222,_0x37e63){var _0xcdfe4e=Object['assign']({},_0x381222);for(var _0x5846fb in _0x37e63){if(_0xcdfe4e['hasOwnProperty'](_0x5846fb)){_0xcdfe4e[_0x5846fb]=_0x37e63[_0x5846fb];}}return _0xcdfe4e;}exports[_0xf56b('0x0')]=mergeDBDataToRealtime; \ No newline at end of file +var _0xbba8=['assign'];(function(_0x508e89,_0x2e4573){var _0x1a460a=function(_0x101f45){while(--_0x101f45){_0x508e89['push'](_0x508e89['shift']());}};_0x1a460a(++_0x2e4573);}(_0xbba8,0x7f));var _0x8bba=function(_0x4ec038,_0xa49018){_0x4ec038=_0x4ec038-0x0;var _0x277dab=_0xbba8[_0x4ec038];return _0x277dab;};'use strict';function mergeDBDataToRealtime(_0x354ead,_0x3cb1b8){var _0x3084cb=Object[_0x8bba('0x0')]({},_0x354ead);for(var _0x36a4ea in _0x3cb1b8){if(_0x3084cb['hasOwnProperty'](_0x36a4ea)){_0x3084cb[_0x36a4ea]=_0x3cb1b8[_0x36a4ea];}}return _0x3084cb;}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 29489d5..0cfd757 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 _0x1826=['xcally-motion-preview','calleridname','connectedlinename','membername','xcally-motion-dialer','voiceAgentReport','isArray','forEach','startsWith','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','bind','voiceCallReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedTransfer','findAgent','accountcode','name','isNil','find','interface','format','SIP/%s','connectedlinenum','assigned','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','voiceQueueReport','match','getAgentByInternal','keys','length','split','calleridnum','outbound','destination','exten','type','dialer','lastapplication','queue','context','from-voip-provider','callerid','from-sip','calleridpreview','originatecalleridnum','destinationchannel','channel','ANSWERED','\x22%s\x22\x20<%s>','transfers','transfereelinkedid','linkedid','getCallType','create','monitor','monitors','monitorFilename','filename','createdAt'];(function(_0x3e885c,_0x4f295b){var _0x29278c=function(_0x3fb14a){while(--_0x3fb14a){_0x3e885c['push'](_0x3e885c['shift']());}};_0x29278c(++_0x4f295b);}(_0x1826,0xc8));var _0x6182=function(_0x2ce8b2,_0x55e8a0){_0x2ce8b2=_0x2ce8b2-0x0;var _0x59e5c1=_0x1826[_0x2ce8b2];return _0x59e5c1;};'use strict';var _=require(_0x6182('0x0'));var moment=require(_0x6182('0x1'));var util=require(_0x6182('0x2'));var config=require(_0x6182('0x3'));var ami=require('../ami');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x6182('0x4'));var RpcMemberReport=require(_0x6182('0x5'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x6182('0x6'));var RpcVoiceTransferReport=require(_0x6182('0x7'));var VoiceQueueReport=require(_0x6182('0x8'));var VoiceCallReport=require(_0x6182('0x9'));var VoiceAgentReport=require(_0x6182('0xa'));var VoiceDialReport=require(_0x6182('0xb'));var UserReport=require('./userReport');function Report(_0xe50e21){this[_0x6182('0xc')]=_0xe50e21;this[_0x6182('0xd')]=_0xe50e21[_0x6182('0xd')];this[_0x6182('0xe')]=_0xe50e21[_0x6182('0xe')];}Report[_0x6182('0xf')][_0x6182('0x10')]=function(_0x53bc8b){var _0x40a0e3=new VoiceQueueReport(this[_0x6182('0xc')]);var _0x42b9f4=new VoiceAgentReport(this[_0x6182('0xc')]);var _0x3cd5eb=new VoiceDialReport(this[_0x6182('0xc')]);var _0x1d7d97=new VoiceCallReport(this[_0x6182('0xc')]);var _0x5d1eb2=new UserReport(this['realtime']);if(config[_0x6182('0x11')]&&config[_0x6182('0x11')][_0x6182('0x12')]){ami['on'](_0x6182('0x13'),this['voiceQueueReport'][_0x6182('0x14')](this));ami['on']('custom:voiceCallReport',this[_0x6182('0x15')][_0x6182('0x14')](this));ami['on']('custom:voiceAgentReport',this['voiceAgentReport']['bind'](this));ami['on'](_0x6182('0x16'),this[_0x6182('0x17')]['bind'](this));ami['on'](_0x6182('0x18'),this[_0x6182('0x19')][_0x6182('0x14')](this));ami['on']('attendedtransfer',this[_0x6182('0x1a')][_0x6182('0x14')](this));}};Report[_0x6182('0xf')][_0x6182('0x1b')]=function(_0x513b80){var _0x289f4b;_0x289f4b=_['find'](this[_0x6182('0xd')],function(_0x5bfc46){return _0x5bfc46[_0x6182('0x1c')]==_0x513b80||_0x5bfc46[_0x6182('0x1d')]==_0x513b80;});if(_[_0x6182('0x1e')](_0x289f4b)){var _0x967790=_['find'](this[_0x6182('0xe')],function(_0x160c6a){return _0x160c6a[_0x6182('0x1c')]==_0x513b80||_0x160c6a['name']==_0x513b80;});if(_0x967790){_0x289f4b=_[_0x6182('0x1f')](this[_0x6182('0xd')],function(_0x29ff2d){return _0x29ff2d[_0x6182('0x20')]==util[_0x6182('0x21')](_0x6182('0x22'),_0x967790['name']);});}}return _0x289f4b;};Report['prototype']['voiceQueueReport']=function(_0xafb364){for(var _0x57040e=0x0;_0x57040e<_0xafb364['length'];_0x57040e+=0x1){var _0x5899e3=this[_0x6182('0x1b')](_0xafb364[_0x57040e][_0x6182('0x23')]);if(_0x5899e3){_0xafb364[_0x57040e][_0x6182('0x1c')]=_0x5899e3[_0x6182('0x1c')];_0xafb364[_0x57040e][_0x6182('0x24')]=!![];_0xafb364[_0x57040e][_0x6182('0x25')]=_0x5899e3[_0x6182('0x1d')];_0xafb364[_0x57040e][_0x6182('0x20')]=_[_0x6182('0x1e')](_0x5899e3['interface'])?util[_0x6182('0x21')](_0x6182('0x22'),_0x5899e3[_0x6182('0x1d')]):_0x5899e3['interface'];if(_0xafb364[_0x57040e][_0x6182('0x26')]){_0xafb364[_0x57040e][_0x6182('0x27')]=moment()[_0x6182('0x21')](_0x6182('0x28'));}if(_0xafb364[_0x57040e]['queuecallerexit']){_0xafb364[_0x57040e][_0x6182('0x29')]=moment()[_0x6182('0x21')](_0x6182('0x28'));}RpcMemberReport[_0x6182('0x2a')](_0xafb364[_0x57040e]);}RpcVoiceQueueReport['create'](_0xafb364[_0x57040e]);}};function extractCalleridNumber(_0x4e4a7b){var _0x2e53df=_0x4e4a7b[_0x6182('0x2b')](/<(.*?)>/);return _0x2e53df?_0x2e53df[0x1]:_0x4e4a7b;}Report['prototype'][_0x6182('0x2c')]=function(_0x2a87f1){for(var _0x53123a=0x0;_0x53123a/);return _0x53f42b?_0x53f42b[0x1]:_0x567d00;}Report[_0x5e7b('0x1c')][_0x5e7b('0x2e')]=function(_0x101972){for(var _0x307edb=0x0;_0x307edb',_0x1f7b99[_0x5e7b('0x44')],_0x1f7b99[_0x5e7b('0x33')]);}if(RpcVoiceTransferReport[_0x5e7b('0x45')][_0x1f7b99[_0x5e7b('0x46')]]){var _0x28131c=RpcVoiceTransferReport[_0x5e7b('0x45')][_0x1f7b99['linkedid']];_0x28131c[_0x5e7b('0x47')]=_0x1f7b99[_0x5e7b('0x48')];RpcVoiceTransferReport[_0x5e7b('0x19')](_0x28131c);delete RpcVoiceTransferReport[_0x5e7b('0x45')][_0x1f7b99[_0x5e7b('0x46')]];}if(_[_0x5e7b('0x1f')](_0x1f7b99[_0x5e7b('0x37')])){_0x1f7b99[_0x5e7b('0x37')]=this[_0x5e7b('0x30')](_0x1f7b99);}if(_[_0x5e7b('0x1f')](_0x1f7b99[_0x5e7b('0x49')])){var _0x288a68=_0x1f7b99[_0x5e7b('0x31')]['split']('-')[0x0];var _0x286709=this['agents'][_0x288a68];if(!_0x286709)_0x286709=this[_0x5e7b('0x2e')](_0x1f7b99['accountcode']);if(_0x286709){_0x1f7b99[_0x5e7b('0x49')]=_0x286709['id'];_0x1f7b99['membername']=_0x286709[_0x5e7b('0x21')];}}RpcVoiceCallReport['create'](_0x1f7b99);if(_0x1f7b99['monitor']){for(var _0x2872ab=0x0;_0x2872ab<_0x1f7b99['monitors'][_0x5e7b('0x24')];_0x2872ab+=0x1){_0x1f7b99[_0x5e7b('0x4a')]=_0x1f7b99['monitors'][_0x2872ab][_0x5e7b('0x4b')];_0x1f7b99[_0x5e7b('0x4c')]=_0x1f7b99['monitors'][_0x2872ab][_0x5e7b('0x4c')];if(_0x1f7b99['exten']==_0x5e7b('0x3e')){_0x1f7b99[_0x5e7b('0x33')]=_0x1f7b99[_0x5e7b('0x4d')];_0x1f7b99[_0x5e7b('0x44')]=_0x1f7b99['connectedlinename'];_0x1f7b99[_0x5e7b('0x4d')]=_0x1f7b99[_0x5e7b('0x20')];_0x1f7b99[_0x5e7b('0x4e')]=_0x1f7b99[_0x5e7b('0x4f')];_0x1f7b99[_0x5e7b('0x36')]=_0x1f7b99[_0x5e7b('0x40')];}else if(_0x1f7b99[_0x5e7b('0x36')]==_0x5e7b('0x50')){_0x1f7b99[_0x5e7b('0x33')]=_0x1f7b99[_0x5e7b('0x35')];_0x1f7b99['exten']=_0x1f7b99['originatecalleridnum'];}RpcVoiceRecording[_0x5e7b('0x51')](_0x1f7b99);}}};Report['prototype'][_0x5e7b('0x18')]=function(_0x3fc826){if(_[_0x5e7b('0x52')](_0x3fc826)){_0x3fc826[_0x5e7b('0x53')](function(_0x5e7931){RpcVoiceAgentReport[_0x5e7b('0x51')](_0x5e7931);});}else{RpcVoiceAgentReport[_0x5e7b('0x51')](_0x3fc826);}};Report[_0x5e7b('0x1c')][_0x5e7b('0x54')]=function(_0x33eb86){RpcVoiceDialReport[_0x5e7b('0x51')](_0x33eb86);var _0x531c55;var _0x4fe55d;var _0x175d08=_0x33eb86[_0x5e7b('0x31')];if(_[_0x5e7b('0x55')](_0x175d08,'Local')){_0x4fe55d=_0x175d08[_0x5e7b('0x56')](_0x175d08[_0x5e7b('0x57')]('/')+0x1,_0x175d08[_0x5e7b('0x57')]('@'));_0x531c55=_['find'](this[_0x5e7b('0x10')],function(_0xb77253){return _0xb77253[_0x5e7b('0x58')]==_0x4fe55d||_0xb77253[_0x5e7b('0x59')]==_0x4fe55d||_0xb77253[_0x5e7b('0x20')]==_0x4fe55d;});}else{_0x4fe55d=_0x175d08[_0x5e7b('0x56')](_0x175d08['indexOf']('/')+0x1,_0x175d08['lastIndexOf']('-'));_0x531c55=this[_0x5e7b('0x1d')](_0x4fe55d);}if(_0x531c55){_0x33eb86['interface']=_[_0x5e7b('0x1f')](_0x531c55[_0x5e7b('0x27')])?util[_0x5e7b('0x22')]('SIP/%s',_0x531c55[_0x5e7b('0x21')]):_0x531c55[_0x5e7b('0x27')];_0x33eb86[_0x5e7b('0x4f')]=_0x531c55['name'];_0x33eb86[_0x5e7b('0x20')]=_0x531c55[_0x5e7b('0x20')];RpcMemberReport['voiceDialReport'](_0x33eb86);}};Report['prototype'][_0x5e7b('0x19')]=function(_0x3e249f){RpcVoiceTransferReport[_0x5e7b('0x45')][_0x3e249f[_0x5e7b('0x5a')]]=_0x3e249f;};Report['prototype']['attendedTransfer']=function(_0xfdb0eb){RpcVoiceTransferReport[_0x5e7b('0x1b')](_0xfdb0eb);};module[_0x5e7b('0x5b')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 592dc16..f77c279 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8bdb=['peerstatus','syncPeerStatus','syncRealtimeShow','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','[userReport][devicestatelist]','resolve','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isUndefined','emit','[userReport][registry]\x20registry:%s\x20state:%s','username','debug','[userReport][registry]','find','trunks','stateRegistry','state','merge','omit','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save','isNotNull','info','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','local','inuse','toLowerCase','stateTime','telephone:%s','telephone:save','toNumber','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','Local','substring','indexOf','phone','accountcode','[userReport][devicestatechange]','peer','address','registered','status','updateStatusRealtime','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','[userReport][peerstatus]','exports','lodash','moment','ioredis','bluebird','../../../config/environment','../../../config/logger','../ami','redis','defaults','localhost','socket.io-emitter','agents','telephones','registryentry','syncRegistry','registry','devicestatechange','syncDeviceState','bind'];(function(_0x4c6797,_0x5645a8){var _0x1ee9cd=function(_0xe7c0d1){while(--_0xe7c0d1){_0x4c6797['push'](_0x4c6797['shift']());}};_0x1ee9cd(++_0x5645a8);}(_0x8bdb,0x1bb));var _0xb8bd=function(_0x27b67f,_0x752793){_0x27b67f=_0x27b67f-0x0;var _0x4ce80c=_0x8bdb[_0x27b67f];return _0x4ce80c;};'use strict';var _=require(_0xb8bd('0x0'));var moment=require(_0xb8bd('0x1'));var util=require('util');var Redis=require(_0xb8bd('0x2'));var BPromise=require(_0xb8bd('0x3'));var config=require(_0xb8bd('0x4'));var logger=require(_0xb8bd('0x5'))('ami');var ami=require(_0xb8bd('0x6'));config[_0xb8bd('0x7')]=_[_0xb8bd('0x8')](config[_0xb8bd('0x7')],{'host':_0xb8bd('0x9'),'port':0x18eb});var io=require(_0xb8bd('0xa'))(new Redis(config[_0xb8bd('0x7')]));function UserReport(_0x492bc1){this['trunks']=_0x492bc1['trunks'];this[_0xb8bd('0xb')]=_0x492bc1[_0xb8bd('0xb')];this[_0xb8bd('0xc')]=_0x492bc1[_0xb8bd('0xc')];ami['on'](_0xb8bd('0xd'),this[_0xb8bd('0xe')]['bind'](this));ami['on'](_0xb8bd('0xf'),this[_0xb8bd('0xe')]['bind'](this));ami['on'](_0xb8bd('0x10'),this[_0xb8bd('0x11')][_0xb8bd('0x12')](this));ami['on'](_0xb8bd('0x13'),this[_0xb8bd('0x14')][_0xb8bd('0x12')](this));return this[_0xb8bd('0x15')]();}function showSipRegistrations(){Promise['resolve']()[_0xb8bd('0x16')](ami[_0xb8bd('0x17')]())[_0xb8bd('0x18')](function(_0x491f17){logger[_0xb8bd('0x19')](_0xb8bd('0x1a'),util[_0xb8bd('0x1b')](_0x491f17,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()[_0xb8bd('0x16')](ami['actionDeviceStateList']())['catch'](function(_0x1b9da6){logger[_0xb8bd('0x19')](_0xb8bd('0x1c'),util[_0xb8bd('0x1b')](_0x1b9da6,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xb8bd('0x1d')]()['then'](ami[_0xb8bd('0x1e')]())[_0xb8bd('0x18')](function(_0x199ad0){logger['error'](_0xb8bd('0x1f'),util[_0xb8bd('0x1b')](_0x199ad0,{'showHidden':![],'depth':null}));});}UserReport[_0xb8bd('0x20')][_0xb8bd('0x15')]=function(){setInterval(function(){BPromise[_0xb8bd('0x1d')]()[_0xb8bd('0x16')](showSipRegistrations())[_0xb8bd('0x16')](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport['prototype']['isNotNull']=function(_0xda0d01){return _0xda0d01!==null&&!_[_0xb8bd('0x21')](_0xda0d01);};UserReport['prototype'][_0xb8bd('0x22')]=function(_0x123f59,_0x597d68,_0x15148b){io['to'](_0x123f59)[_0xb8bd('0x22')](_0x597d68,_0x15148b);};UserReport['prototype'][_0xb8bd('0xe')]=function(_0x243ab3){try{if(this['isNotNull'](_0x243ab3)){logger['info'](_0xb8bd('0x23'),_0x243ab3[_0xb8bd('0x24')],_0x243ab3['state']);logger[_0xb8bd('0x25')](_0xb8bd('0x26'),util[_0xb8bd('0x1b')](_0x243ab3,{'showHidden':![],'depth':null}));var _0x588c50=_[_0xb8bd('0x27')](this[_0xb8bd('0x28')],{'defaultuser':_0x243ab3[_0xb8bd('0x24')]});if(_0x588c50){_0x243ab3[_0xb8bd('0x29')]=_0x243ab3[_0xb8bd('0x2a')];_[_0xb8bd('0x2b')](_0x588c50,_[_0xb8bd('0x2c')](_0x243ab3,['event','actionid',_0xb8bd('0x24'),_0xb8bd('0x2a')]));logger[_0xb8bd('0x25')](_0xb8bd('0x2d'),util['inspect'](_0x588c50,{'showHidden':![],'depth':null}));this[_0xb8bd('0x22')](util[_0xb8bd('0x2e')](_0xb8bd('0x2f'),_0x588c50[_0xb8bd('0x30')]),_0xb8bd('0x31'),_0x588c50);}}}catch(_0x5ac7a4){logger[_0xb8bd('0x19')](_0xb8bd('0x26'),util[_0xb8bd('0x1b')](_0x5ac7a4,{'showHidden':![],'depth':null}));}};UserReport[_0xb8bd('0x20')][_0xb8bd('0x11')]=function(_0x3ae1be){try{if(this[_0xb8bd('0x32')](_0x3ae1be)){logger[_0xb8bd('0x33')](_0xb8bd('0x34'),_0x3ae1be['device'],_0x3ae1be[_0xb8bd('0x2a')]);logger[_0xb8bd('0x25')]('[userReport][devicestatechange]',util[_0xb8bd('0x1b')](_0x3ae1be,{'showHidden':![],'depth':null}));if(this[_0xb8bd('0xb')][_0x3ae1be[_0xb8bd('0x35')]]){if(!this[_0xb8bd('0xb')][_0x3ae1be[_0xb8bd('0x35')]][_0xb8bd('0x36')]||_0x3ae1be['state']['toLowerCase']()==_0xb8bd('0x37')){this[_0xb8bd('0xb')][_0x3ae1be['device']][_0xb8bd('0x36')]=![];if(this[_0xb8bd('0xb')][_0x3ae1be[_0xb8bd('0x35')]][_0xb8bd('0x2a')]!==_0x3ae1be[_0xb8bd('0x2a')][_0xb8bd('0x38')]()){this['agents'][_0x3ae1be[_0xb8bd('0x35')]]['stateTime']=_['toNumber'](moment()['format']('x'));}this['agents'][_0x3ae1be[_0xb8bd('0x35')]]['state']=_0x3ae1be[_0xb8bd('0x2a')][_0xb8bd('0x38')]();this['agents'][_0x3ae1be['device']]['updateStatusRealtime'](_0x3ae1be);}}else if(this[_0xb8bd('0xc')][_0x3ae1be[_0xb8bd('0x35')]]){if(this[_0xb8bd('0xc')][_0x3ae1be['device']][_0xb8bd('0x2a')]!==_0x3ae1be['state'][_0xb8bd('0x38')]()){this[_0xb8bd('0xc')][_0x3ae1be['device']][_0xb8bd('0x39')]=_['toNumber'](moment()[_0xb8bd('0x2e')]('x'));}this[_0xb8bd('0xc')][_0x3ae1be['device']][_0xb8bd('0x2a')]=_0x3ae1be['state']['toLowerCase']();logger['debug']('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util[_0xb8bd('0x1b')](this[_0xb8bd('0xc')][_0x3ae1be[_0xb8bd('0x35')]],{'showHidden':![],'depth':null}));this[_0xb8bd('0x22')](util[_0xb8bd('0x2e')](_0xb8bd('0x3a'),this[_0xb8bd('0xc')][_0x3ae1be[_0xb8bd('0x35')]][_0xb8bd('0x30')]),_0xb8bd('0x3b'),this['telephones'][_0x3ae1be[_0xb8bd('0x35')]]);}else if(this[_0xb8bd('0x28')][_0x3ae1be[_0xb8bd('0x35')]]){if(this[_0xb8bd('0x28')][_0x3ae1be['device']][_0xb8bd('0x2a')]!==_0x3ae1be[_0xb8bd('0x2a')][_0xb8bd('0x38')]()){this[_0xb8bd('0x28')][_0x3ae1be[_0xb8bd('0x35')]][_0xb8bd('0x39')]=_[_0xb8bd('0x3c')](moment()[_0xb8bd('0x2e')]('x'));}this[_0xb8bd('0x28')][_0x3ae1be[_0xb8bd('0x35')]][_0xb8bd('0x2a')]=_0x3ae1be[_0xb8bd('0x2a')][_0xb8bd('0x38')]();logger[_0xb8bd('0x25')](_0xb8bd('0x3d'),util[_0xb8bd('0x1b')](this[_0xb8bd('0x28')][_0x3ae1be['device']],{'showHidden':![],'depth':null}));this['emit'](util[_0xb8bd('0x2e')](_0xb8bd('0x2f'),this[_0xb8bd('0x28')][_0x3ae1be[_0xb8bd('0x35')]]['name']),_0xb8bd('0x31'),this[_0xb8bd('0x28')][_0x3ae1be[_0xb8bd('0x35')]]);}else if(_['startsWith'](_0x3ae1be[_0xb8bd('0x35')],_0xb8bd('0x3e'))){var _0x929a1d=_0x3ae1be[_0xb8bd('0x35')];var _0x49ee95=_0x929a1d[_0xb8bd('0x3f')](_0x929a1d['indexOf']('/')+0x1,_0x929a1d[_0xb8bd('0x40')]('@'));var _0x9f8d50=_['find'](this[_0xb8bd('0xb')],function(_0x4847b2){return _0x4847b2['mobile']==_0x49ee95||_0x4847b2[_0xb8bd('0x41')]==_0x49ee95||_0x4847b2[_0xb8bd('0x42')]==_0x49ee95;});if(_0x9f8d50){if(_0x9f8d50['state']!==_0x3ae1be['state']['toLowerCase']()){_0x9f8d50[_0xb8bd('0x39')]=_[_0xb8bd('0x3c')](moment()[_0xb8bd('0x2e')]('x'));}_0x9f8d50[_0xb8bd('0x2a')]=_0x3ae1be[_0xb8bd('0x2a')][_0xb8bd('0x38')]();_0x9f8d50[_0xb8bd('0x36')]=!![];_0x9f8d50['updateStatusRealtime'](_0x3ae1be);}}}}catch(_0x2260af){logger[_0xb8bd('0x19')](_0xb8bd('0x43'),util[_0xb8bd('0x1b')](_0x2260af,{'showHidden':![],'depth':null}));}};UserReport[_0xb8bd('0x20')][_0xb8bd('0x14')]=function(_0x221a45){try{if(this[_0xb8bd('0x32')](_0x221a45)&&this[_0xb8bd('0x32')](_0x221a45['peerstatus'])){logger[_0xb8bd('0x33')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x221a45[_0xb8bd('0x44')],_0x221a45[_0xb8bd('0x45')],_0x221a45[_0xb8bd('0x13')]);logger[_0xb8bd('0x25')]('[userReport][peerstatus]',util[_0xb8bd('0x1b')](_0x221a45,{'showHidden':![],'depth':null}));if(this[_0xb8bd('0xb')][_0x221a45['peer']]){if(!this[_0xb8bd('0xb')][_0x221a45['peer']]['local']||_0x221a45[_0xb8bd('0x13')][_0xb8bd('0x38')]()==_0xb8bd('0x46')){this[_0xb8bd('0xb')][_0x221a45[_0xb8bd('0x44')]][_0xb8bd('0x36')]=![];this[_0xb8bd('0xb')][_0x221a45[_0xb8bd('0x44')]][_0xb8bd('0x47')]=_0x221a45[_0xb8bd('0x13')][_0xb8bd('0x38')]();this[_0xb8bd('0xb')][_0x221a45[_0xb8bd('0x44')]]['address']=_0x221a45['address'];this[_0xb8bd('0xb')][_0x221a45[_0xb8bd('0x44')]][_0xb8bd('0x48')](_0x221a45);}}else if(this[_0xb8bd('0xc')][_0x221a45['peer']]){this['telephones'][_0x221a45['peer']][_0xb8bd('0x47')]=_0x221a45[_0xb8bd('0x13')]['toLowerCase']();this[_0xb8bd('0xc')][_0x221a45['peer']][_0xb8bd('0x45')]=_0x221a45[_0xb8bd('0x45')];logger[_0xb8bd('0x25')](_0xb8bd('0x49'),util[_0xb8bd('0x1b')](this[_0xb8bd('0xc')][_0x221a45['peer']],{'showHidden':![],'depth':null}));this[_0xb8bd('0x22')](util[_0xb8bd('0x2e')](_0xb8bd('0x3a'),this[_0xb8bd('0xc')][_0x221a45[_0xb8bd('0x44')]][_0xb8bd('0x30')]),_0xb8bd('0x3b'),this[_0xb8bd('0xc')][_0x221a45['peer']]);}else if(this['trunks'][_0x221a45['peer']]){this[_0xb8bd('0x28')][_0x221a45[_0xb8bd('0x44')]][_0xb8bd('0x47')]=_0x221a45[_0xb8bd('0x13')][_0xb8bd('0x38')]();this[_0xb8bd('0x28')][_0x221a45['peer']][_0xb8bd('0x45')]=_0x221a45[_0xb8bd('0x45')];logger[_0xb8bd('0x25')](_0xb8bd('0x4a'),util[_0xb8bd('0x1b')](this[_0xb8bd('0x28')][_0x221a45[_0xb8bd('0x44')]],{'showHidden':![],'depth':null}));this[_0xb8bd('0x22')](util[_0xb8bd('0x2e')](_0xb8bd('0x2f'),this[_0xb8bd('0x28')][_0x221a45[_0xb8bd('0x44')]]['name']),_0xb8bd('0x31'),this[_0xb8bd('0x28')][_0x221a45['peer']]);}}}catch(_0x19f052){logger[_0xb8bd('0x19')](_0xb8bd('0x4b'),util[_0xb8bd('0x1b')](_0x19f052,{'showHidden':![],'depth':null}));}};module[_0xb8bd('0x4c')]=UserReport; \ No newline at end of file +var _0x162d=['catch','error','inspect','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','syncRealtimeShow','prototype','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','[userReport][registry]','find','stateRegistry','merge','omit','event','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save','isNotNull','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','local','inuse','toLowerCase','toNumber','stateTime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:save','startsWith','substring','indexOf','mobile','accountcode','updateStatusRealtime','[userReport][devicestatechange]','peerstatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','registered','status','telephone:%s','lodash','util','ioredis','bluebird','../../../config/logger','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','bind','syncRegistry','devicestatechange','syncDeviceState','syncPeerStatus','resolve','then','actionSipShowRegistry'];(function(_0x227bfa,_0x51bedc){var _0x331aba=function(_0x36e65b){while(--_0x36e65b){_0x227bfa['push'](_0x227bfa['shift']());}};_0x331aba(++_0x51bedc);}(_0x162d,0x1f0));var _0xd162=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x162d[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0xd162('0x0'));var moment=require('moment');var util=require(_0xd162('0x1'));var Redis=require(_0xd162('0x2'));var BPromise=require(_0xd162('0x3'));var config=require('../../../config/environment');var logger=require(_0xd162('0x4'))('ami');var ami=require(_0xd162('0x5'));config[_0xd162('0x6')]=_[_0xd162('0x7')](config['redis'],{'host':_0xd162('0x8'),'port':0x18eb});var io=require(_0xd162('0x9'))(new Redis(config[_0xd162('0x6')]));function UserReport(_0xf6c7ee){this[_0xd162('0xa')]=_0xf6c7ee[_0xd162('0xa')];this[_0xd162('0xb')]=_0xf6c7ee['agents'];this[_0xd162('0xc')]=_0xf6c7ee[_0xd162('0xc')];ami['on'](_0xd162('0xd'),this['syncRegistry'][_0xd162('0xe')](this));ami['on']('registry',this[_0xd162('0xf')]['bind'](this));ami['on'](_0xd162('0x10'),this[_0xd162('0x11')]['bind'](this));ami['on']('peerstatus',this[_0xd162('0x12')]['bind'](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise[_0xd162('0x13')]()[_0xd162('0x14')](ami[_0xd162('0x15')]())[_0xd162('0x16')](function(_0x334f06){logger[_0xd162('0x17')]('[userReport][sipshowregistry]',util[_0xd162('0x18')](_0x334f06,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xd162('0x13')]()[_0xd162('0x14')](ami[_0xd162('0x19')]())[_0xd162('0x16')](function(_0x142585){logger[_0xd162('0x17')](_0xd162('0x1a'),util[_0xd162('0x18')](_0x142585,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xd162('0x13')]()[_0xd162('0x14')](ami[_0xd162('0x1b')]())[_0xd162('0x16')](function(_0x4eaba1){logger[_0xd162('0x17')](_0xd162('0x1c'),util[_0xd162('0x18')](_0x4eaba1,{'showHidden':![],'depth':null}));});}UserReport['prototype'][_0xd162('0x1d')]=function(){setInterval(function(){BPromise[_0xd162('0x13')]()[_0xd162('0x14')](showSipRegistrations())[_0xd162('0x14')](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport[_0xd162('0x1e')]['isNotNull']=function(_0x5dfded){return _0x5dfded!==null&&!_[_0xd162('0x1f')](_0x5dfded);};UserReport['prototype'][_0xd162('0x20')]=function(_0x80bd4a,_0x568593,_0x5ab9db){io['to'](_0x80bd4a)[_0xd162('0x20')](_0x568593,_0x5ab9db);};UserReport[_0xd162('0x1e')][_0xd162('0xf')]=function(_0x286c16){try{if(this['isNotNull'](_0x286c16)){logger[_0xd162('0x21')](_0xd162('0x22'),_0x286c16[_0xd162('0x23')],_0x286c16[_0xd162('0x24')]);logger[_0xd162('0x25')](_0xd162('0x26'),util['inspect'](_0x286c16,{'showHidden':![],'depth':null}));var _0x6de1dc=_[_0xd162('0x27')](this[_0xd162('0xa')],{'defaultuser':_0x286c16[_0xd162('0x23')]});if(_0x6de1dc){_0x286c16[_0xd162('0x28')]=_0x286c16['state'];_[_0xd162('0x29')](_0x6de1dc,_[_0xd162('0x2a')](_0x286c16,[_0xd162('0x2b'),'actionid',_0xd162('0x23'),_0xd162('0x24')]));logger['debug'](_0xd162('0x2c'),util['inspect'](_0x6de1dc,{'showHidden':![],'depth':null}));this[_0xd162('0x20')](util[_0xd162('0x2d')](_0xd162('0x2e'),_0x6de1dc[_0xd162('0x2f')]),_0xd162('0x30'),_0x6de1dc);}}}catch(_0x18ec20){logger[_0xd162('0x17')](_0xd162('0x26'),util[_0xd162('0x18')](_0x18ec20,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xd162('0x11')]=function(_0x5c1386){try{if(this[_0xd162('0x31')](_0x5c1386)){logger[_0xd162('0x21')](_0xd162('0x32'),_0x5c1386[_0xd162('0x33')],_0x5c1386[_0xd162('0x24')]);logger[_0xd162('0x25')]('[userReport][devicestatechange]',util['inspect'](_0x5c1386,{'showHidden':![],'depth':null}));if(this[_0xd162('0xb')][_0x5c1386['device']]){if(!this['agents'][_0x5c1386['device']][_0xd162('0x34')]||_0x5c1386[_0xd162('0x24')]['toLowerCase']()==_0xd162('0x35')){this['agents'][_0x5c1386[_0xd162('0x33')]][_0xd162('0x34')]=![];if(this['agents'][_0x5c1386[_0xd162('0x33')]][_0xd162('0x24')]!==_0x5c1386[_0xd162('0x24')][_0xd162('0x36')]()){this[_0xd162('0xb')][_0x5c1386['device']]['stateTime']=_[_0xd162('0x37')](moment()[_0xd162('0x2d')]('x'));}this[_0xd162('0xb')][_0x5c1386['device']][_0xd162('0x24')]=_0x5c1386[_0xd162('0x24')][_0xd162('0x36')]();this[_0xd162('0xb')][_0x5c1386[_0xd162('0x33')]]['updateStatusRealtime'](_0x5c1386);}}else if(this['telephones'][_0x5c1386['device']]){if(this[_0xd162('0xc')][_0x5c1386[_0xd162('0x33')]][_0xd162('0x24')]!==_0x5c1386[_0xd162('0x24')][_0xd162('0x36')]()){this[_0xd162('0xc')][_0x5c1386['device']][_0xd162('0x38')]=_[_0xd162('0x37')](moment()[_0xd162('0x2d')]('x'));}this['telephones'][_0x5c1386[_0xd162('0x33')]]['state']=_0x5c1386['state'][_0xd162('0x36')]();logger[_0xd162('0x25')](_0xd162('0x39'),util[_0xd162('0x18')](this[_0xd162('0xc')][_0x5c1386[_0xd162('0x33')]],{'showHidden':![],'depth':null}));this[_0xd162('0x20')](util[_0xd162('0x2d')]('telephone:%s',this[_0xd162('0xc')][_0x5c1386[_0xd162('0x33')]][_0xd162('0x2f')]),_0xd162('0x3a'),this[_0xd162('0xc')][_0x5c1386[_0xd162('0x33')]]);}else if(this[_0xd162('0xa')][_0x5c1386['device']]){if(this[_0xd162('0xa')][_0x5c1386[_0xd162('0x33')]][_0xd162('0x24')]!==_0x5c1386[_0xd162('0x24')][_0xd162('0x36')]()){this[_0xd162('0xa')][_0x5c1386[_0xd162('0x33')]][_0xd162('0x38')]=_['toNumber'](moment()['format']('x'));}this[_0xd162('0xa')][_0x5c1386[_0xd162('0x33')]][_0xd162('0x24')]=_0x5c1386['state'][_0xd162('0x36')]();logger['debug']('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0xd162('0x18')](this[_0xd162('0xa')][_0x5c1386[_0xd162('0x33')]],{'showHidden':![],'depth':null}));this[_0xd162('0x20')](util[_0xd162('0x2d')](_0xd162('0x2e'),this[_0xd162('0xa')][_0x5c1386['device']][_0xd162('0x2f')]),_0xd162('0x30'),this[_0xd162('0xa')][_0x5c1386['device']]);}else if(_[_0xd162('0x3b')](_0x5c1386[_0xd162('0x33')],'Local')){var _0x50b61b=_0x5c1386[_0xd162('0x33')];var _0x3d8959=_0x50b61b[_0xd162('0x3c')](_0x50b61b[_0xd162('0x3d')]('/')+0x1,_0x50b61b['indexOf']('@'));var _0x47d886=_['find'](this[_0xd162('0xb')],function(_0x1ff07f){return _0x1ff07f[_0xd162('0x3e')]==_0x3d8959||_0x1ff07f['phone']==_0x3d8959||_0x1ff07f[_0xd162('0x3f')]==_0x3d8959;});if(_0x47d886){if(_0x47d886['state']!==_0x5c1386[_0xd162('0x24')][_0xd162('0x36')]()){_0x47d886[_0xd162('0x38')]=_[_0xd162('0x37')](moment()[_0xd162('0x2d')]('x'));}_0x47d886[_0xd162('0x24')]=_0x5c1386['state']['toLowerCase']();_0x47d886[_0xd162('0x34')]=!![];_0x47d886[_0xd162('0x40')](_0x5c1386);}}}}catch(_0x1eccc0){logger[_0xd162('0x17')](_0xd162('0x41'),util[_0xd162('0x18')](_0x1eccc0,{'showHidden':![],'depth':null}));}};UserReport['prototype']['syncPeerStatus']=function(_0x2e0fe6){try{if(this[_0xd162('0x31')](_0x2e0fe6)&&this[_0xd162('0x31')](_0x2e0fe6[_0xd162('0x42')])){logger['info'](_0xd162('0x43'),_0x2e0fe6[_0xd162('0x44')],_0x2e0fe6[_0xd162('0x45')],_0x2e0fe6[_0xd162('0x42')]);logger[_0xd162('0x25')](_0xd162('0x46'),util[_0xd162('0x18')](_0x2e0fe6,{'showHidden':![],'depth':null}));if(this['agents'][_0x2e0fe6[_0xd162('0x44')]]){if(!this[_0xd162('0xb')][_0x2e0fe6[_0xd162('0x44')]]['local']||_0x2e0fe6[_0xd162('0x42')][_0xd162('0x36')]()==_0xd162('0x47')){this[_0xd162('0xb')][_0x2e0fe6[_0xd162('0x44')]][_0xd162('0x34')]=![];this['agents'][_0x2e0fe6[_0xd162('0x44')]][_0xd162('0x48')]=_0x2e0fe6[_0xd162('0x42')][_0xd162('0x36')]();this[_0xd162('0xb')][_0x2e0fe6[_0xd162('0x44')]][_0xd162('0x45')]=_0x2e0fe6[_0xd162('0x45')];this[_0xd162('0xb')][_0x2e0fe6[_0xd162('0x44')]][_0xd162('0x40')](_0x2e0fe6);}}else if(this['telephones'][_0x2e0fe6[_0xd162('0x44')]]){this[_0xd162('0xc')][_0x2e0fe6[_0xd162('0x44')]][_0xd162('0x48')]=_0x2e0fe6['peerstatus'][_0xd162('0x36')]();this[_0xd162('0xc')][_0x2e0fe6[_0xd162('0x44')]][_0xd162('0x45')]=_0x2e0fe6[_0xd162('0x45')];logger[_0xd162('0x25')]('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util[_0xd162('0x18')](this['telephones'][_0x2e0fe6['peer']],{'showHidden':![],'depth':null}));this[_0xd162('0x20')](util[_0xd162('0x2d')](_0xd162('0x49'),this['telephones'][_0x2e0fe6[_0xd162('0x44')]][_0xd162('0x2f')]),_0xd162('0x3a'),this['telephones'][_0x2e0fe6[_0xd162('0x44')]]);}else if(this[_0xd162('0xa')][_0x2e0fe6['peer']]){this[_0xd162('0xa')][_0x2e0fe6[_0xd162('0x44')]][_0xd162('0x48')]=_0x2e0fe6[_0xd162('0x42')][_0xd162('0x36')]();this['trunks'][_0x2e0fe6['peer']][_0xd162('0x45')]=_0x2e0fe6['address'];logger[_0xd162('0x25')]('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0xd162('0x18')](this['trunks'][_0x2e0fe6[_0xd162('0x44')]],{'showHidden':![],'depth':null}));this[_0xd162('0x20')](util[_0xd162('0x2d')](_0xd162('0x2e'),this['trunks'][_0x2e0fe6[_0xd162('0x44')]][_0xd162('0x2f')]),_0xd162('0x30'),this['trunks'][_0x2e0fe6[_0xd162('0x44')]]);}}}catch(_0x102215){logger[_0xd162('0x17')](_0xd162('0x46'),util['inspect'](_0x102215,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 3deca29..750e4dc 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8252=['rtpaudioqos','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','moment','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','syncAttendedTransfer','prototype','emit','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','mandatoryDisposition','type','inbound','assign','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','calleridnum','queue','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','membername','error','[%s][voiceAgentReport][agentcalled]','isNotNull','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','voiceChannels','routealias','merge','interface','pick','destconnectedlinenum','name','exten','custom:agentconnect','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheremembername','lastevent','answered_elsewhere','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','user:agentringnoanswer','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','abandoned','reason','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','agentconnectAt','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]'];(function(_0x56b32c,_0xbbb33e){var _0x3093fe=function(_0x3bc6d1){while(--_0x3bc6d1){_0x56b32c['push'](_0x56b32c['shift']());}};_0x3093fe(++_0xbbb33e);}(_0x8252,0x166));var _0x2825=function(_0x18465f,_0x24fef8){_0x18465f=_0x18465f-0x0;var _0x4bcf13=_0x8252[_0x18465f];return _0x4bcf13;};'use strict';var _=require('lodash');var moment=require(_0x2825('0x0'));var util=require(_0x2825('0x1'));var Redis=require(_0x2825('0x2'));var config=require(_0x2825('0x3'));var logger=require('../../../config/logger')('ami');var ami=require('../ami');config[_0x2825('0x4')]=_[_0x2825('0x5')](config[_0x2825('0x4')],{'host':_0x2825('0x6'),'port':0x18eb});var io=require(_0x2825('0x7'))(new Redis(config['redis']));function VoiceAgentReport(_0x5351b7){this[_0x2825('0x8')]={};this['voiceChannels']=_0x5351b7[_0x2825('0x8')];this[_0x2825('0x9')]=_0x5351b7['voiceQueues'];this[_0x2825('0xa')]=_0x5351b7[_0x2825('0xa')];this[_0x2825('0xb')]={};ami['on']('agentcalled',this[_0x2825('0xc')][_0x2825('0xd')](this));ami['on'](_0x2825('0xe'),this[_0x2825('0xf')][_0x2825('0xd')](this));ami['on'](_0x2825('0x10'),this[_0x2825('0x11')][_0x2825('0xd')](this));ami['on'](_0x2825('0x12'),this['syncQueueCallerAbandon'][_0x2825('0xd')](this));ami['on'](_0x2825('0x13'),this[_0x2825('0x14')][_0x2825('0xd')](this));ami['on'](_0x2825('0x15'),this[_0x2825('0x16')][_0x2825('0xd')](this));ami['on'](_0x2825('0x17'),this[_0x2825('0x18')]['bind'](this));ami['on'](_0x2825('0x19'),this[_0x2825('0x1a')]['bind'](this));ami['on']('musiconholdstop',this[_0x2825('0x1b')][_0x2825('0xd')](this));ami['on']('attendedtransfer',this[_0x2825('0x1c')][_0x2825('0xd')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x2825('0xd')](this));}VoiceAgentReport[_0x2825('0x1d')][_0x2825('0x1e')]=function(_0x3b37ba,_0x31a2b6,_0x171bbd){io['to'](_0x3b37ba)['emit'](_0x31a2b6,_0x171bbd);};VoiceAgentReport[_0x2825('0x1d')]['isNotNull']=function(_0x1867f7){return _0x1867f7!==null&&!_[_0x2825('0x1f')](_0x1867f7);};VoiceAgentReport[_0x2825('0x1d')]['syncAgentCalled']=function(_0x53f360){try{if(this['isNotNull'](_0x53f360)){logger[_0x2825('0x20')](_0x2825('0x21'),_0x53f360[_0x2825('0x22')],_0x53f360['membername'],_0x53f360['destuniqueid']);logger[_0x2825('0x23')](_0x2825('0x24'),_0x53f360[_0x2825('0x22')],util[_0x2825('0x25')](_0x53f360,{'showHidden':![],'depth':null}));if(_[_0x2825('0x1f')](this[_0x2825('0x8')][_0x53f360[_0x2825('0x22')]])){this['channels'][_0x53f360[_0x2825('0x22')]]={};}var _0x1c5b8d=this['agents'][_0x53f360['interface']];var _0x53167f=this[_0x2825('0x8')][_0x53f360['uniqueid']][_0x53f360[_0x2825('0x26')]];var _0x143e41=this[_0x2825('0x9')][_0x53f360['queue']];var _0x56e339=this['variables'][_0x53f360[_0x2825('0x22')]];if(_[_0x2825('0x1f')](_0x53167f)){_0x53167f={'agentcalledAt':moment()[_0x2825('0x27')](_0x2825('0x28')),'lastevent':_0x2825('0x29'),'mandatoryDisposition':_0x143e41&&_0x143e41['mandatoryDisposition']?_0x143e41[_0x2825('0x2a')]:![],'type':_0x143e41&&_0x143e41[_0x2825('0x2b')]?_0x143e41['type']:_0x2825('0x2c'),'variables':_0x56e339,'motionChannel':'voice'};}Object[_0x2825('0x2d')](_0x53167f,_[_0x2825('0x2e')](_0x53f360,[_0x2825('0x2f'),_0x2825('0x30')]));this['channels'][_0x53f360[_0x2825('0x22')]][_0x53f360[_0x2825('0x26')]]=_0x53167f;logger['debug'](_0x2825('0x31'),_0x53f360[_0x2825('0x22')],util[_0x2825('0x25')](_0x53167f,{'showHidden':![],'depth':null}));ami[_0x2825('0x1e')](_0x2825('0x32'),_0x53167f);var _0x22ed02={'id':_0x1c5b8d['id'],'calleridnum':_0x53167f[_0x2825('0x33')],'queue':_0x53167f[_0x2825('0x34')],'variables':_0x53167f[_0x2825('0xb')],'uniqueid':_0x53f360['uniqueid']};logger[_0x2825('0x23')](_0x2825('0x35'),_0x53f360[_0x2825('0x22')],util['inspect'](_0x22ed02,{'showHidden':![],'depth':null}));this[_0x2825('0x1e')](util['format'](_0x2825('0x36'),_0x53f360[_0x2825('0x37')]),'user:called',_0x22ed02);}}catch(_0x5888cb){logger[_0x2825('0x38')](_0x2825('0x39'),_0x53f360['uniqueid'],util[_0x2825('0x25')](_0x5888cb,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2825('0x1d')][_0x2825('0xf')]=function(_0x1ae342){try{if(this[_0x2825('0x3a')](_0x1ae342)){if(this[_0x2825('0x8')][_0x1ae342[_0x2825('0x22')]]){for(var _0x4461a in this[_0x2825('0x8')][_0x1ae342[_0x2825('0x22')]]){if(this[_0x2825('0x8')][_0x1ae342[_0x2825('0x22')]][_0x2825('0x3b')](_0x4461a)){if(_0x1ae342[_0x2825('0x26')]===_0x4461a){logger[_0x2825('0x20')](_0x2825('0x3c'),_0x1ae342['uniqueid'],_0x1ae342[_0x2825('0x37')],_0x1ae342['destuniqueid']);this[_0x2825('0x8')][_0x1ae342[_0x2825('0x22')]][_0x4461a]['agentconnectAt']=moment()['format'](_0x2825('0x28'));this['channels'][_0x1ae342[_0x2825('0x22')]][_0x4461a]['connectedlinename']=_0x1ae342[_0x2825('0x3d')];this['channels'][_0x1ae342['uniqueid']][_0x4461a]['connectedlinenum']=_0x1ae342[_0x2825('0x3e')];this['channels'][_0x1ae342[_0x2825('0x22')]][_0x4461a][_0x2825('0x3f')]=_0x1ae342[_0x2825('0x3f')];this[_0x2825('0x8')][_0x1ae342[_0x2825('0x22')]][_0x4461a][_0x2825('0x40')]=_0x1ae342[_0x2825('0x40')];this[_0x2825('0x8')][_0x1ae342[_0x2825('0x22')]][_0x4461a]['holdtime']=_0x1ae342[_0x2825('0x41')];this[_0x2825('0x8')][_0x1ae342['uniqueid']][_0x4461a]['lastevent']='connect';if(this[_0x2825('0x42')][this[_0x2825('0x8')][_0x1ae342[_0x2825('0x22')]][_0x4461a][_0x2825('0x22')]]){var _0xa3d11f=this[_0x2825('0x42')][this[_0x2825('0x8')][_0x1ae342['uniqueid']][_0x4461a]['uniqueid']]['routealias'];this[_0x2825('0x8')][_0x1ae342[_0x2825('0x22')]][_0x4461a][_0x2825('0x43')]=_0xa3d11f;_0x1ae342[_0x2825('0x43')]=_0xa3d11f;}_[_0x2825('0x44')](this[_0x2825('0xa')][_0x1ae342[_0x2825('0x45')]],_[_0x2825('0x46')](_0x1ae342,[_0x2825('0x34'),_0x2825('0x47'),_0x2825('0x43')]));var _0x1cf9d5=this[_0x2825('0xa')][_0x1ae342[_0x2825('0x45')]];var _0x40e12e={'id':_0x1cf9d5['id'],'name':_0x1cf9d5[_0x2825('0x48')],'agentconnected':!![],'destaccountcode':_0x1cf9d5['accountcode'],'destconnectedlinenum':this[_0x2825('0x8')][_0x1ae342[_0x2825('0x22')]][_0x1ae342[_0x2825('0x26')]][_0x2825('0x49')],'queue':this['channels'][_0x1ae342[_0x2825('0x22')]][_0x1ae342['destuniqueid']][_0x2825('0x34')],'routealias':this[_0x2825('0x8')][_0x1ae342[_0x2825('0x22')]][_0x1ae342[_0x2825('0x26')]][_0x2825('0x43')],'uniqueid':this[_0x2825('0x8')][_0x1ae342[_0x2825('0x22')]][_0x1ae342[_0x2825('0x26')]][_0x2825('0x22')]};ami['emit'](_0x2825('0x4a'),this[_0x2825('0x8')][_0x1ae342[_0x2825('0x22')]][_0x1ae342[_0x2825('0x26')]]);this[_0x2825('0x1e')](util[_0x2825('0x27')](_0x2825('0x36'),_0x1ae342[_0x2825('0x37')]),_0x2825('0x4b'),_0x40e12e);}else if(!this['channels'][_0x1ae342[_0x2825('0x22')]][_0x4461a][_0x2825('0x10')]&&!this[_0x2825('0x8')][_0x1ae342[_0x2825('0x22')]][_0x4461a]['agentcomplete']){logger[_0x2825('0x20')](_0x2825('0x4c'),_0x1ae342[_0x2825('0x22')],this['channels'][_0x1ae342[_0x2825('0x22')]][_0x4461a]['membername'],_0x4461a);this[_0x2825('0x8')][_0x1ae342[_0x2825('0x22')]][_0x4461a][_0x2825('0x10')]=!![];this[_0x2825('0x8')][_0x1ae342[_0x2825('0x22')]][_0x4461a][_0x2825('0x4d')]=moment()['format'](_0x2825('0x28'));this[_0x2825('0x8')][_0x1ae342[_0x2825('0x22')]][_0x4461a]['answeredelsewheredestinationuniqueid']=_0x1ae342[_0x2825('0x26')];this[_0x2825('0x8')][_0x1ae342[_0x2825('0x22')]][_0x4461a][_0x2825('0x4e')]=_0x1ae342[_0x2825('0x37')];this[_0x2825('0x8')][_0x1ae342[_0x2825('0x22')]][_0x4461a][_0x2825('0x4f')]='answered_elsewhere';this[_0x2825('0x8')][_0x1ae342[_0x2825('0x22')]][_0x4461a]['reason']=_0x2825('0x50');logger[_0x2825('0x23')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x1ae342[_0x2825('0x22')],util[_0x2825('0x25')](this[_0x2825('0x8')][_0x1ae342[_0x2825('0x22')]][_0x4461a],{'showHidden':![],'depth':null}));ami['emit'](_0x2825('0x51'),this[_0x2825('0x8')][_0x1ae342['uniqueid']][_0x4461a]);}else{logger[_0x2825('0x23')](_0x2825('0x52'),_0x1ae342['uniqueid']);}}}}}}catch(_0xa2de00){logger['error']('[%s][voiceAgentReport][agentconnect]',_0x1ae342[_0x2825('0x22')],util[_0x2825('0x25')](_0xa2de00,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2825('0x1d')][_0x2825('0x11')]=function(_0x651148){try{if(this[_0x2825('0x3a')](_0x651148)){logger[_0x2825('0x23')](_0x2825('0x53'),_0x651148[_0x2825('0x22')],util[_0x2825('0x25')](_0x651148,{'showHidden':![],'depth':null}));if(this[_0x2825('0x8')][_0x651148[_0x2825('0x22')]]&&this[_0x2825('0x8')][_0x651148[_0x2825('0x22')]][_0x651148['destuniqueid']]){logger[_0x2825('0x20')](_0x2825('0x54'),_0x651148['uniqueid'],_0x651148[_0x2825('0x37')],_0x651148[_0x2825('0x26')]);var _0x3f9d4=this[_0x2825('0xa')][_0x651148[_0x2825('0x45')]];var _0x49ed20=this[_0x2825('0x8')][_0x651148['uniqueid']][_0x651148[_0x2825('0x26')]];_0x49ed20[_0x2825('0x10')]=!![];_0x49ed20['agentringnoanswerAt']=moment()[_0x2825('0x27')](_0x2825('0x28'));_0x49ed20[_0x2825('0x4f')]='rejected';_0x49ed20['reason']=_0x2825('0x55');var _0x3a5cef={'id':_0x3f9d4['id'],'name':_0x3f9d4['name'],'queue':_0x49ed20[_0x2825('0x34')],'uniqueid':_0x49ed20[_0x2825('0x22')]};logger[_0x2825('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x651148[_0x2825('0x22')],util[_0x2825('0x25')](_0x3a5cef,{'showHidden':![],'depth':null}));this[_0x2825('0x1e')](util['format'](_0x2825('0x36'),_0x3f9d4[_0x2825('0x48')]),_0x2825('0x56'),_0x3a5cef);ami[_0x2825('0x1e')](_0x2825('0x57'),_0x49ed20);this[_0x2825('0x8')][_0x651148[_0x2825('0x22')]][_0x651148['destuniqueid']]=Object[_0x2825('0x2d')]({},_0x49ed20);}}}catch(_0x126842){logger[_0x2825('0x38')](_0x2825('0x58'),_0x651148[_0x2825('0x22')],util['inspect'](_0x126842,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2825('0x1d')]['syncQueueCallerAbandon']=function(_0xe61d92){try{if(this[_0x2825('0x3a')](_0xe61d92)){logger['debug'](_0x2825('0x59'),_0xe61d92[_0x2825('0x22')],util['inspect'](_0xe61d92,{'showHidden':![],'depth':null}));if(this[_0x2825('0x8')][_0xe61d92[_0x2825('0x22')]]){for(var _0x1b3be6 in this['channels'][_0xe61d92[_0x2825('0x22')]]){if(this[_0x2825('0x8')][_0xe61d92[_0x2825('0x22')]][_0x2825('0x3b')](_0x1b3be6)&&!this[_0x2825('0x8')][_0xe61d92['uniqueid']][_0x1b3be6]['agentringnoanswer']&&!this[_0x2825('0x8')][_0xe61d92[_0x2825('0x22')]][_0x1b3be6][_0x2825('0x13')]){logger[_0x2825('0x20')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0xe61d92[_0x2825('0x22')],this[_0x2825('0x8')][_0xe61d92[_0x2825('0x22')]][_0x1b3be6][_0x2825('0x37')],_0x1b3be6);this['channels'][_0xe61d92[_0x2825('0x22')]][_0x1b3be6][_0x2825('0x10')]=!![];this[_0x2825('0x8')][_0xe61d92[_0x2825('0x22')]][_0x1b3be6][_0x2825('0x4d')]=moment()['format'](_0x2825('0x28'));this[_0x2825('0x8')][_0xe61d92[_0x2825('0x22')]][_0x1b3be6][_0x2825('0x4f')]=_0x2825('0x5a');this[_0x2825('0x8')][_0xe61d92[_0x2825('0x22')]][_0x1b3be6][_0x2825('0x5b')]='abandoned';logger[_0x2825('0x23')](_0x2825('0x5c'),_0xe61d92['uniqueid'],util['inspect'](this[_0x2825('0x8')][_0xe61d92[_0x2825('0x22')]][_0x1b3be6],{'showHidden':![],'depth':null}));ami[_0x2825('0x1e')](_0x2825('0x5d'),this['channels'][_0xe61d92['uniqueid']][_0x1b3be6]);}}}}}catch(_0x4b7e76){logger[_0x2825('0x38')](_0x2825('0x5e'),_0xe61d92[_0x2825('0x22')],util[_0x2825('0x25')](_0x4b7e76,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2825('0x1d')][_0x2825('0x14')]=function(_0xadb1c3){try{if(this[_0x2825('0x3a')](_0xadb1c3)){logger[_0x2825('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20event:',_0xadb1c3[_0x2825('0x22')],util[_0x2825('0x25')](_0xadb1c3,{'showHidden':![],'depth':null}));if(this[_0x2825('0x8')][_0xadb1c3[_0x2825('0x22')]]){for(var _0x307761 in this[_0x2825('0x8')][_0xadb1c3['uniqueid']]){if(this[_0x2825('0x8')][_0xadb1c3['uniqueid']]['hasOwnProperty'](_0x307761)){if(this[_0x2825('0x8')][_0xadb1c3['uniqueid']][_0x307761][_0x2825('0x5f')]&&!this[_0x2825('0x8')][_0xadb1c3['uniqueid']][_0x307761]['agentcomplete']){logger[_0x2825('0x20')](_0x2825('0x60'),_0xadb1c3['uniqueid'],this['channels'][_0xadb1c3[_0x2825('0x22')]][_0x307761][_0x2825('0x37')],_0x307761);this['channels'][_0xadb1c3[_0x2825('0x22')]][_0x307761][_0x2825('0x13')]=!![];this[_0x2825('0x8')][_0xadb1c3['uniqueid']][_0x307761][_0x2825('0x61')]=moment()[_0x2825('0x27')](_0x2825('0x28'));this['channels'][_0xadb1c3[_0x2825('0x22')]][_0x307761]['lastevent']=_0x2825('0x62');this[_0x2825('0x8')][_0xadb1c3[_0x2825('0x22')]][_0x307761][_0x2825('0x5b')]=_0xadb1c3['reason']==_0x2825('0x63')?_0x2825('0x64'):_0xadb1c3[_0x2825('0x5b')];this[_0x2825('0x8')][_0xadb1c3[_0x2825('0x22')]][_0x307761][_0x2825('0x65')]=_0xadb1c3[_0x2825('0x65')];if(this[_0x2825('0x9')][_0xadb1c3[_0x2825('0x34')]]&&this[_0x2825('0x9')][_0xadb1c3[_0x2825('0x34')]]['acw']){this[_0x2825('0x8')][_0xadb1c3[_0x2825('0x22')]][_0x307761][_0x2825('0x66')]=this[_0x2825('0x9')][_0xadb1c3[_0x2825('0x34')]][_0x2825('0x67')];this[_0x2825('0x8')][_0xadb1c3[_0x2825('0x22')]][_0x307761][_0x2825('0x68')]=!![];}this[_0x2825('0xa')][_0xadb1c3[_0x2825('0x45')]]=_[_0x2825('0x2e')](this[_0x2825('0xa')][_0xadb1c3[_0x2825('0x45')]],[_0x2825('0x34'),'destconnectedlinenum']);logger[_0x2825('0x23')](_0x2825('0x69'),_0xadb1c3[_0x2825('0x22')],util[_0x2825('0x25')](this[_0x2825('0x8')][_0xadb1c3[_0x2825('0x22')]][_0x307761],{'showHidden':![],'depth':null}));ami[_0x2825('0x1e')](_0x2825('0x6a'),this['channels'][_0xadb1c3[_0x2825('0x22')]][_0x307761]);logger[_0x2825('0x23')](_0x2825('0x6b'),_0xadb1c3['uniqueid'],util[_0x2825('0x25')]({'id':this[_0x2825('0xa')][_0xadb1c3[_0x2825('0x45')]]['id'],'destaccountcode':_0xadb1c3[_0x2825('0x6c')]},{'showHidden':![],'depth':null}));this[_0x2825('0x1e')](util[_0x2825('0x27')](_0x2825('0x36'),_0xadb1c3[_0x2825('0x37')]),_0x2825('0x6d'),{'id':this['agents'][_0xadb1c3[_0x2825('0x45')]]['id'],'destaccountcode':Number(_0xadb1c3[_0x2825('0x6c')])});}}}}}}catch(_0xab1ad){logger[_0x2825('0x38')]('[%s][voiceAgentReport][agentcomplete]',_0xadb1c3['uniqueid'],util['inspect'](_0xab1ad,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2825('0x1d')][_0x2825('0x16')]=function(_0x534b54){try{if(this['isNotNull'](_0x534b54)){logger[_0x2825('0x23')]('[%s][voiceAgentReport][varset]\x20event:',_0x534b54[_0x2825('0x22')],util['inspect'](_0x534b54,{'showHidden':![],'depth':null}));this[_0x2825('0x6e')](_0x534b54[_0x2825('0x22')],_[_0x2825('0x6f')](_0x534b54[_0x2825('0x70')])[0x0],_0x534b54[_0x2825('0x71')]);if(this['channels'][_0x534b54[_0x2825('0x22')]]){for(var _0x5d9dae in this[_0x2825('0x8')][_0x534b54[_0x2825('0x22')]]){if(this[_0x2825('0x8')][_0x534b54['uniqueid']][_0x2825('0x3b')](_0x5d9dae)){logger[_0x2825('0x20')](_0x2825('0x72'),_0x534b54[_0x2825('0x22')],_0x5d9dae,_['keys'](_0x534b54[_0x2825('0x70')])[0x0],_0x534b54[_0x2825('0x71')]);if(_[_0x2825('0x1f')](this[_0x2825('0x8')][_0x534b54[_0x2825('0x22')]][_0x5d9dae][_0x2825('0xb')])){this[_0x2825('0x8')][_0x534b54['uniqueid']][_0x5d9dae]['variables']={};}this[_0x2825('0x8')][_0x534b54[_0x2825('0x22')]][_0x5d9dae]['variables']=this[_0x2825('0xb')][_0x534b54[_0x2825('0x22')]];}}}}}catch(_0x2504db){logger[_0x2825('0x38')](_0x2825('0x73'),_0x534b54[_0x2825('0x22')],util[_0x2825('0x25')](_0x2504db,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x2825('0x6e')]=function(_0x1f6fe7,_0x5b2258,_0x4fdb22){var _0x59fb67=[_0x2825('0x74'),'rtpaudioqosbridged','rtpaudioqosjitter',_0x2825('0x75'),_0x2825('0x76'),'rtpaudioqoslossbridged',_0x2825('0x77'),_0x2825('0x78'),_0x2825('0x79'),_0x2825('0x7a'),_0x2825('0x7b'),_0x2825('0x7c'),_0x2825('0x7d'),_0x2825('0x7e'),_0x2825('0x7f'),_0x2825('0x80'),_0x2825('0x37'),_0x2825('0x81'),_0x2825('0x82')];if(!_[_0x2825('0x83')](_0x5b2258)&&!_[_0x2825('0x84')](_0x59fb67,_0x5b2258)){if(_['isUndefined'](this[_0x2825('0xb')][_0x1f6fe7])){this[_0x2825('0xb')][_0x1f6fe7]={};}this['variables'][_0x1f6fe7][_0x5b2258]=_0x4fdb22;}};VoiceAgentReport['prototype'][_0x2825('0x18')]=function(_0x4e62f5){try{if(this[_0x2825('0x3a')](_0x4e62f5)){logger['debug'](_0x2825('0x85'),_0x4e62f5['uniqueid'],util[_0x2825('0x25')](_0x4e62f5,{'showHidden':![],'depth':null}));if(this['channels'][_0x4e62f5[_0x2825('0x22')]]){for(var _0x45378c in this['channels'][_0x4e62f5['uniqueid']]){if(this[_0x2825('0x8')][_0x4e62f5[_0x2825('0x22')]][_0x2825('0x3b')](_0x45378c)){if(this[_0x2825('0x8')][_0x4e62f5[_0x2825('0x22')]][_0x45378c][_0x2825('0x5b')]==_0x2825('0x63')&&this['channels'][_0x4e62f5['uniqueid']][_0x45378c][_0x2825('0x13')]){logger[_0x2825('0x20')](_0x2825('0x86'),_0x4e62f5['uniqueid'],_0x45378c);this[_0x2825('0x8')][_0x4e62f5[_0x2825('0x22')]][_0x45378c][_0x2825('0x61')]=moment()[_0x2825('0x27')](_0x2825('0x28'));}}}logger[_0x2825('0x23')](_0x2825('0x87'),_0x4e62f5['uniqueid'],util[_0x2825('0x25')](_[_0x2825('0x88')](this[_0x2825('0x8')][_0x4e62f5[_0x2825('0x22')]]),{'showHidden':![],'depth':null}));ami[_0x2825('0x1e')]('custom:voiceAgentReport',_['values'](this[_0x2825('0x8')][_0x4e62f5['uniqueid']]));delete this[_0x2825('0x8')][_0x4e62f5['uniqueid']];}if(this['variables'][_0x4e62f5[_0x2825('0x22')]]){delete this['variables'][_0x4e62f5['uniqueid']];}}}catch(_0x1a622b){logger['error'](_0x2825('0x89'),_0x4e62f5[_0x2825('0x22')],util[_0x2825('0x25')](_0x1a622b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2825('0x1d')]['syncAttendedTransfer']=function(_0xf36672){try{if(this[_0x2825('0x3a')](_0xf36672)){logger[_0x2825('0x23')](_0x2825('0x8a'),_0xf36672[_0x2825('0x22')],util[_0x2825('0x25')](_0xf36672,{'showHidden':![],'depth':null}));if(this['channels'][_0xf36672[_0x2825('0x8b')]]){for(var _0x171a53 in this[_0x2825('0x8')][_0xf36672[_0x2825('0x8b')]]){if(this[_0x2825('0x8')][_0xf36672[_0x2825('0x8b')]][_0x2825('0x3b')](_0x171a53)){if(_0xf36672[_0x2825('0x8c')]===_0x171a53){logger[_0x2825('0x20')](_0x2825('0x8d'),_0xf36672[_0x2825('0x22')],this[_0x2825('0x8')][_0xf36672[_0x2825('0x8b')]][_0x171a53][_0x2825('0x37')],_0x171a53);var _0x903b10=moment();this[_0x2825('0x8')][_0xf36672[_0x2825('0x8b')]][_0x171a53][_0x2825('0x13')]=!![];this['channels'][_0xf36672[_0x2825('0x8b')]][_0x171a53][_0x2825('0x61')]=moment()[_0x2825('0x27')](_0x2825('0x28'));this[_0x2825('0x8')][_0xf36672[_0x2825('0x8b')]][_0x171a53][_0x2825('0x4f')]='complete';this[_0x2825('0x8')][_0xf36672['transfereeuniqueid']][_0x171a53][_0x2825('0x5b')]=_0x2825('0x63');this[_0x2825('0x8')][_0xf36672[_0x2825('0x8b')]][_0x171a53]['talktime']=_0x903b10[_0x2825('0x8e')](this[_0x2825('0x8')][_0xf36672['transfereeuniqueid']][_0x171a53]['agentconnectAt'],_0x2825('0x8f'));}}}}if(this[_0x2825('0x8')][_0xf36672[_0x2825('0x90')]]){var _0x425f79=this[_0x2825('0x8')][_0xf36672[_0x2825('0x90')]];this[_0x2825('0x8')][_0xf36672[_0x2825('0x90')]]=this[_0x2825('0x8')][_0xf36672[_0x2825('0x8b')]];this[_0x2825('0x8')][_0xf36672[_0x2825('0x8b')]]=_0x425f79;}}}catch(_0x17db9a){logger[_0x2825('0x38')](_0x2825('0x91'),_0xf36672['uniqueid'],util['inspect'](_0x17db9a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2825('0x1d')]['syncBlindTransfer']=function(_0x3dbc14){try{if(this[_0x2825('0x3a')](_0x3dbc14)){logger[_0x2825('0x23')]('[%s][voiceAgentReport][blindtransfer]\x20event:',_0x3dbc14[_0x2825('0x22')],util[_0x2825('0x25')](_0x3dbc14,{'showHidden':![],'depth':null}));if(this[_0x2825('0x8')][_0x3dbc14[_0x2825('0x8b')]]){for(var _0x1b855e in this[_0x2825('0x8')][_0x3dbc14[_0x2825('0x8b')]]){if(this[_0x2825('0x8')][_0x3dbc14[_0x2825('0x8b')]][_0x2825('0x3b')](_0x1b855e)){if(_0x3dbc14[_0x2825('0x92')]===_0x1b855e){logger['info'](_0x2825('0x93'),_0x3dbc14['uniqueid'],this[_0x2825('0x8')][_0x3dbc14['transfereeuniqueid']][_0x1b855e][_0x2825('0x37')],_0x1b855e);var _0xf38f9c=moment();this[_0x2825('0x8')][_0x3dbc14['transfereeuniqueid']][_0x1b855e][_0x2825('0x13')]=!![];this[_0x2825('0x8')][_0x3dbc14[_0x2825('0x8b')]][_0x1b855e]['agentcompleteAt']=_0xf38f9c;this[_0x2825('0x8')][_0x3dbc14[_0x2825('0x8b')]][_0x1b855e][_0x2825('0x4f')]='complete';this[_0x2825('0x8')][_0x3dbc14[_0x2825('0x8b')]][_0x1b855e][_0x2825('0x5b')]=_0x2825('0x63');this[_0x2825('0x8')][_0x3dbc14['transfereeuniqueid']][_0x1b855e][_0x2825('0x65')]=_0xf38f9c['diff'](this[_0x2825('0x8')][_0x3dbc14[_0x2825('0x8b')]][_0x1b855e][_0x2825('0x5f')],_0x2825('0x8f'));}}}}}}catch(_0x571fc1){logger[_0x2825('0x38')](_0x2825('0x94'),_0x3dbc14['uniqueid'],util[_0x2825('0x25')](_0x571fc1,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2825('0x1d')][_0x2825('0x1a')]=function(_0x10efd5){var _0x2c65c8='';try{if(this[_0x2825('0x3a')](_0x10efd5)){logger[_0x2825('0x23')](_0x2825('0x95'),_0x10efd5['uniqueid'],util[_0x2825('0x25')](_0x10efd5,{'showHidden':![],'depth':null}));if(_0x10efd5[_0x2825('0x96')]){_0x2c65c8=_0x10efd5[_0x2825('0x96')][_0x2825('0x97')](0x0,_0x10efd5[_0x2825('0x96')][_0x2825('0x98')]('-'));if(this['agents'][_0x2c65c8]){logger[_0x2825('0x20')]('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x10efd5['uniqueid'],_0x2c65c8);this[_0x2825('0xa')][_0x2c65c8][_0x2825('0x99')]=!![];}}}}catch(_0x4d477a){logger[_0x2825('0x38')](_0x2825('0x9a'),_0x10efd5[_0x2825('0x22')],util['inspect'](_0x4d477a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2825('0x1d')][_0x2825('0x1b')]=function(_0x561024){var _0xc89638='';try{if(this[_0x2825('0x3a')](_0x561024)){logger[_0x2825('0x23')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x561024['uniqueid'],util[_0x2825('0x25')](_0x561024,{'showHidden':![],'depth':null}));if(_0x561024[_0x2825('0x96')]){_0xc89638=_0x561024[_0x2825('0x96')][_0x2825('0x97')](0x0,_0x561024['channel'][_0x2825('0x98')]('-'));if(this[_0x2825('0xa')][_0xc89638]){logger['info'](_0x2825('0x9b'),_0x561024[_0x2825('0x22')],_0xc89638);this[_0x2825('0xa')][_0xc89638]['onhold']=![];}}}}catch(_0x4f6de3){logger[_0x2825('0x38')](_0x2825('0x9c'),_0x561024[_0x2825('0x22')],util[_0x2825('0x25')](_0x4f6de3,{'showHidden':![],'depth':null}));}};module[_0x2825('0x9d')]=VoiceAgentReport; \ No newline at end of file +var _0xaebf=['agentconnectAt','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','talktime','acwTimeout','agentacw','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','value','keys','variable','[%s][voiceAgentReport][varset]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','substring','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','util','ioredis','../../../config/environment','../ami','redis','defaults','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues','agents','agentcalled','syncAgentCalled','bind','agentconnect','agentringnoanswer','syncAgentRingNoAnswer','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','uniqueid','membername','destuniqueid','[%s][voiceAgentReport][agentcalled]\x20event:','variables','YYYY-MM-DD\x20HH:mm:ss','called','mandatoryDisposition','type','inbound','voice','assign','omit','event','privilege','debug','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','calleridnum','format','user:%s','error','[%s][voiceAgentReport][agentcalled]','inspect','syncAgentConnect','hasOwnProperty','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','routealias','interface','pick','queue','destconnectedlinenum','name','exten','custom:agentconnect','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','lastevent','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20event:','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:'];(function(_0x2cadc0,_0x120477){var _0x13e727=function(_0x599b74){while(--_0x599b74){_0x2cadc0['push'](_0x2cadc0['shift']());}};_0x13e727(++_0x120477);}(_0xaebf,0x17e));var _0xfaeb=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0xaebf[_0x2adbeb];return _0x5e18a6;};'use strict';var _=require(_0xfaeb('0x0'));var moment=require('moment');var util=require(_0xfaeb('0x1'));var Redis=require(_0xfaeb('0x2'));var config=require(_0xfaeb('0x3'));var logger=require('../../../config/logger')('ami');var ami=require(_0xfaeb('0x4'));config[_0xfaeb('0x5')]=_[_0xfaeb('0x6')](config[_0xfaeb('0x5')],{'host':_0xfaeb('0x7'),'port':0x18eb});var io=require(_0xfaeb('0x8'))(new Redis(config[_0xfaeb('0x5')]));function VoiceAgentReport(_0x2b2164){this[_0xfaeb('0x9')]={};this[_0xfaeb('0xa')]=_0x2b2164[_0xfaeb('0x9')];this[_0xfaeb('0xb')]=_0x2b2164[_0xfaeb('0xb')];this[_0xfaeb('0xc')]=_0x2b2164[_0xfaeb('0xc')];this['variables']={};ami['on'](_0xfaeb('0xd'),this[_0xfaeb('0xe')][_0xfaeb('0xf')](this));ami['on'](_0xfaeb('0x10'),this['syncAgentConnect'][_0xfaeb('0xf')](this));ami['on'](_0xfaeb('0x11'),this[_0xfaeb('0x12')][_0xfaeb('0xf')](this));ami['on']('queuecallerabandon',this[_0xfaeb('0x13')][_0xfaeb('0xf')](this));ami['on'](_0xfaeb('0x14'),this[_0xfaeb('0x15')][_0xfaeb('0xf')](this));ami['on'](_0xfaeb('0x16'),this[_0xfaeb('0x17')]['bind'](this));ami['on'](_0xfaeb('0x18'),this[_0xfaeb('0x19')][_0xfaeb('0xf')](this));ami['on'](_0xfaeb('0x1a'),this[_0xfaeb('0x1b')][_0xfaeb('0xf')](this));ami['on'](_0xfaeb('0x1c'),this[_0xfaeb('0x1d')][_0xfaeb('0xf')](this));ami['on'](_0xfaeb('0x1e'),this['syncAttendedTransfer'][_0xfaeb('0xf')](this));ami['on'](_0xfaeb('0x1f'),this[_0xfaeb('0x20')][_0xfaeb('0xf')](this));}VoiceAgentReport[_0xfaeb('0x21')]['emit']=function(_0x6756d5,_0x4e33f5,_0xb80c8a){io['to'](_0x6756d5)[_0xfaeb('0x22')](_0x4e33f5,_0xb80c8a);};VoiceAgentReport['prototype'][_0xfaeb('0x23')]=function(_0x2af5a5){return _0x2af5a5!==null&&!_[_0xfaeb('0x24')](_0x2af5a5);};VoiceAgentReport['prototype'][_0xfaeb('0xe')]=function(_0x45233a){try{if(this[_0xfaeb('0x23')](_0x45233a)){logger[_0xfaeb('0x25')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x45233a[_0xfaeb('0x26')],_0x45233a[_0xfaeb('0x27')],_0x45233a[_0xfaeb('0x28')]);logger['debug'](_0xfaeb('0x29'),_0x45233a[_0xfaeb('0x26')],util['inspect'](_0x45233a,{'showHidden':![],'depth':null}));if(_[_0xfaeb('0x24')](this[_0xfaeb('0x9')][_0x45233a[_0xfaeb('0x26')]])){this[_0xfaeb('0x9')][_0x45233a[_0xfaeb('0x26')]]={};}var _0x24ffa6=this[_0xfaeb('0xc')][_0x45233a['interface']];var _0x17b114=this[_0xfaeb('0x9')][_0x45233a[_0xfaeb('0x26')]][_0x45233a[_0xfaeb('0x28')]];var _0xc4451b=this[_0xfaeb('0xb')][_0x45233a['queue']];var _0x320cbf=this[_0xfaeb('0x2a')][_0x45233a[_0xfaeb('0x26')]];if(_['isUndefined'](_0x17b114)){_0x17b114={'agentcalledAt':moment()['format'](_0xfaeb('0x2b')),'lastevent':_0xfaeb('0x2c'),'mandatoryDisposition':_0xc4451b&&_0xc4451b[_0xfaeb('0x2d')]?_0xc4451b[_0xfaeb('0x2d')]:![],'type':_0xc4451b&&_0xc4451b[_0xfaeb('0x2e')]?_0xc4451b[_0xfaeb('0x2e')]:_0xfaeb('0x2f'),'variables':_0x320cbf,'motionChannel':_0xfaeb('0x30')};}Object[_0xfaeb('0x31')](_0x17b114,_[_0xfaeb('0x32')](_0x45233a,[_0xfaeb('0x33'),_0xfaeb('0x34')]));this[_0xfaeb('0x9')][_0x45233a[_0xfaeb('0x26')]][_0x45233a['destuniqueid']]=_0x17b114;logger[_0xfaeb('0x35')](_0xfaeb('0x36'),_0x45233a['uniqueid'],util['inspect'](_0x17b114,{'showHidden':![],'depth':null}));ami[_0xfaeb('0x22')](_0xfaeb('0x37'),_0x17b114);var _0x2fd275={'id':_0x24ffa6['id'],'calleridnum':_0x17b114[_0xfaeb('0x38')],'queue':_0x17b114['queue'],'variables':_0x17b114[_0xfaeb('0x2a')],'uniqueid':_0x45233a['uniqueid']};logger[_0xfaeb('0x35')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x45233a['uniqueid'],util['inspect'](_0x2fd275,{'showHidden':![],'depth':null}));this[_0xfaeb('0x22')](util[_0xfaeb('0x39')](_0xfaeb('0x3a'),_0x45233a[_0xfaeb('0x27')]),'user:called',_0x2fd275);}}catch(_0x96eeee){logger[_0xfaeb('0x3b')](_0xfaeb('0x3c'),_0x45233a['uniqueid'],util[_0xfaeb('0x3d')](_0x96eeee,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfaeb('0x21')][_0xfaeb('0x3e')]=function(_0x375f04){try{if(this[_0xfaeb('0x23')](_0x375f04)){if(this[_0xfaeb('0x9')][_0x375f04[_0xfaeb('0x26')]]){for(var _0x5410c6 in this[_0xfaeb('0x9')][_0x375f04['uniqueid']]){if(this[_0xfaeb('0x9')][_0x375f04[_0xfaeb('0x26')]][_0xfaeb('0x3f')](_0x5410c6)){if(_0x375f04[_0xfaeb('0x28')]===_0x5410c6){logger[_0xfaeb('0x25')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x375f04[_0xfaeb('0x26')],_0x375f04['membername'],_0x375f04[_0xfaeb('0x28')]);this[_0xfaeb('0x9')][_0x375f04[_0xfaeb('0x26')]][_0x5410c6]['agentconnectAt']=moment()[_0xfaeb('0x39')](_0xfaeb('0x2b'));this[_0xfaeb('0x9')][_0x375f04[_0xfaeb('0x26')]][_0x5410c6][_0xfaeb('0x40')]=_0x375f04[_0xfaeb('0x40')];this['channels'][_0x375f04['uniqueid']][_0x5410c6][_0xfaeb('0x41')]=_0x375f04[_0xfaeb('0x41')];this['channels'][_0x375f04[_0xfaeb('0x26')]][_0x5410c6][_0xfaeb('0x42')]=_0x375f04[_0xfaeb('0x42')];this[_0xfaeb('0x9')][_0x375f04['uniqueid']][_0x5410c6][_0xfaeb('0x43')]=_0x375f04[_0xfaeb('0x43')];this[_0xfaeb('0x9')][_0x375f04[_0xfaeb('0x26')]][_0x5410c6][_0xfaeb('0x44')]=_0x375f04[_0xfaeb('0x44')];this[_0xfaeb('0x9')][_0x375f04[_0xfaeb('0x26')]][_0x5410c6]['lastevent']=_0xfaeb('0x45');if(this[_0xfaeb('0xa')][this[_0xfaeb('0x9')][_0x375f04[_0xfaeb('0x26')]][_0x5410c6][_0xfaeb('0x26')]]){var _0x15cea0=this[_0xfaeb('0xa')][this['channels'][_0x375f04[_0xfaeb('0x26')]][_0x5410c6][_0xfaeb('0x26')]]['routealias'];this[_0xfaeb('0x9')][_0x375f04['uniqueid']][_0x5410c6][_0xfaeb('0x46')]=_0x15cea0;_0x375f04['routealias']=_0x15cea0;}_['merge'](this[_0xfaeb('0xc')][_0x375f04[_0xfaeb('0x47')]],_[_0xfaeb('0x48')](_0x375f04,[_0xfaeb('0x49'),_0xfaeb('0x4a'),'routealias']));var _0x29a588=this[_0xfaeb('0xc')][_0x375f04[_0xfaeb('0x47')]];var _0x1b27ab={'id':_0x29a588['id'],'name':_0x29a588[_0xfaeb('0x4b')],'agentconnected':!![],'destaccountcode':_0x29a588['accountcode'],'destconnectedlinenum':this[_0xfaeb('0x9')][_0x375f04[_0xfaeb('0x26')]][_0x375f04[_0xfaeb('0x28')]][_0xfaeb('0x4c')],'queue':this[_0xfaeb('0x9')][_0x375f04['uniqueid']][_0x375f04[_0xfaeb('0x28')]][_0xfaeb('0x49')],'routealias':this[_0xfaeb('0x9')][_0x375f04[_0xfaeb('0x26')]][_0x375f04['destuniqueid']][_0xfaeb('0x46')],'uniqueid':this[_0xfaeb('0x9')][_0x375f04[_0xfaeb('0x26')]][_0x375f04[_0xfaeb('0x28')]]['uniqueid']};ami['emit'](_0xfaeb('0x4d'),this[_0xfaeb('0x9')][_0x375f04[_0xfaeb('0x26')]][_0x375f04[_0xfaeb('0x28')]]);this[_0xfaeb('0x22')](util['format']('user:%s',_0x375f04[_0xfaeb('0x27')]),_0xfaeb('0x4e'),_0x1b27ab);}else if(!this[_0xfaeb('0x9')][_0x375f04['uniqueid']][_0x5410c6][_0xfaeb('0x11')]&&!this[_0xfaeb('0x9')][_0x375f04['uniqueid']][_0x5410c6]['agentcomplete']){logger[_0xfaeb('0x25')](_0xfaeb('0x4f'),_0x375f04[_0xfaeb('0x26')],this['channels'][_0x375f04['uniqueid']][_0x5410c6][_0xfaeb('0x27')],_0x5410c6);this[_0xfaeb('0x9')][_0x375f04['uniqueid']][_0x5410c6][_0xfaeb('0x11')]=!![];this[_0xfaeb('0x9')][_0x375f04['uniqueid']][_0x5410c6][_0xfaeb('0x50')]=moment()[_0xfaeb('0x39')](_0xfaeb('0x2b'));this[_0xfaeb('0x9')][_0x375f04[_0xfaeb('0x26')]][_0x5410c6][_0xfaeb('0x51')]=_0x375f04[_0xfaeb('0x28')];this[_0xfaeb('0x9')][_0x375f04['uniqueid']][_0x5410c6]['answeredelsewheremembername']=_0x375f04[_0xfaeb('0x27')];this[_0xfaeb('0x9')][_0x375f04[_0xfaeb('0x26')]][_0x5410c6][_0xfaeb('0x52')]=_0xfaeb('0x53');this[_0xfaeb('0x9')][_0x375f04['uniqueid']][_0x5410c6][_0xfaeb('0x54')]=_0xfaeb('0x53');logger[_0xfaeb('0x35')](_0xfaeb('0x55'),_0x375f04[_0xfaeb('0x26')],util[_0xfaeb('0x3d')](this[_0xfaeb('0x9')][_0x375f04[_0xfaeb('0x26')]][_0x5410c6],{'showHidden':![],'depth':null}));ami[_0xfaeb('0x22')](_0xfaeb('0x56'),this['channels'][_0x375f04['uniqueid']][_0x5410c6]);}else{logger['debug'](_0xfaeb('0x57'),_0x375f04[_0xfaeb('0x26')]);}}}}}}catch(_0x497196){logger[_0xfaeb('0x3b')]('[%s][voiceAgentReport][agentconnect]',_0x375f04[_0xfaeb('0x26')],util[_0xfaeb('0x3d')](_0x497196,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfaeb('0x21')][_0xfaeb('0x12')]=function(_0x4ba160){try{if(this['isNotNull'](_0x4ba160)){logger[_0xfaeb('0x35')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x4ba160['uniqueid'],util[_0xfaeb('0x3d')](_0x4ba160,{'showHidden':![],'depth':null}));if(this[_0xfaeb('0x9')][_0x4ba160['uniqueid']]&&this[_0xfaeb('0x9')][_0x4ba160[_0xfaeb('0x26')]][_0x4ba160['destuniqueid']]){logger['info'](_0xfaeb('0x58'),_0x4ba160[_0xfaeb('0x26')],_0x4ba160['membername'],_0x4ba160[_0xfaeb('0x28')]);var _0x5531c7=this[_0xfaeb('0xc')][_0x4ba160[_0xfaeb('0x47')]];var _0x2723f8=this['channels'][_0x4ba160[_0xfaeb('0x26')]][_0x4ba160[_0xfaeb('0x28')]];_0x2723f8['agentringnoanswer']=!![];_0x2723f8[_0xfaeb('0x50')]=moment()[_0xfaeb('0x39')](_0xfaeb('0x2b'));_0x2723f8[_0xfaeb('0x52')]=_0xfaeb('0x59');_0x2723f8[_0xfaeb('0x54')]=_0xfaeb('0x59');var _0x405590={'id':_0x5531c7['id'],'name':_0x5531c7[_0xfaeb('0x4b')],'queue':_0x2723f8[_0xfaeb('0x49')],'uniqueid':_0x2723f8[_0xfaeb('0x26')]};logger[_0xfaeb('0x35')](_0xfaeb('0x5a'),_0x4ba160['uniqueid'],util[_0xfaeb('0x3d')](_0x405590,{'showHidden':![],'depth':null}));this[_0xfaeb('0x22')](util[_0xfaeb('0x39')]('user:%s',_0x5531c7['name']),'user:agentringnoanswer',_0x405590);ami[_0xfaeb('0x22')](_0xfaeb('0x5b'),_0x2723f8);this[_0xfaeb('0x9')][_0x4ba160['uniqueid']][_0x4ba160[_0xfaeb('0x28')]]=Object[_0xfaeb('0x31')]({},_0x2723f8);}}}catch(_0xc4d508){logger[_0xfaeb('0x3b')]('[%s][voiceAgentReport][agentringnoanswer]',_0x4ba160[_0xfaeb('0x26')],util[_0xfaeb('0x3d')](_0xc4d508,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfaeb('0x21')]['syncQueueCallerAbandon']=function(_0x42de91){try{if(this['isNotNull'](_0x42de91)){logger[_0xfaeb('0x35')](_0xfaeb('0x5c'),_0x42de91[_0xfaeb('0x26')],util['inspect'](_0x42de91,{'showHidden':![],'depth':null}));if(this['channels'][_0x42de91[_0xfaeb('0x26')]]){for(var _0x1dd8c0 in this['channels'][_0x42de91['uniqueid']]){if(this[_0xfaeb('0x9')][_0x42de91[_0xfaeb('0x26')]]['hasOwnProperty'](_0x1dd8c0)&&!this['channels'][_0x42de91[_0xfaeb('0x26')]][_0x1dd8c0][_0xfaeb('0x11')]&&!this['channels'][_0x42de91[_0xfaeb('0x26')]][_0x1dd8c0]['agentcomplete']){logger['info']('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x42de91[_0xfaeb('0x26')],this[_0xfaeb('0x9')][_0x42de91[_0xfaeb('0x26')]][_0x1dd8c0][_0xfaeb('0x27')],_0x1dd8c0);this['channels'][_0x42de91[_0xfaeb('0x26')]][_0x1dd8c0]['agentringnoanswer']=!![];this['channels'][_0x42de91[_0xfaeb('0x26')]][_0x1dd8c0][_0xfaeb('0x50')]=moment()['format'](_0xfaeb('0x2b'));this[_0xfaeb('0x9')][_0x42de91[_0xfaeb('0x26')]][_0x1dd8c0][_0xfaeb('0x52')]=_0xfaeb('0x5d');this['channels'][_0x42de91[_0xfaeb('0x26')]][_0x1dd8c0][_0xfaeb('0x54')]=_0xfaeb('0x5d');logger[_0xfaeb('0x35')](_0xfaeb('0x5e'),_0x42de91[_0xfaeb('0x26')],util[_0xfaeb('0x3d')](this[_0xfaeb('0x9')][_0x42de91[_0xfaeb('0x26')]][_0x1dd8c0],{'showHidden':![],'depth':null}));ami[_0xfaeb('0x22')](_0xfaeb('0x5f'),this[_0xfaeb('0x9')][_0x42de91[_0xfaeb('0x26')]][_0x1dd8c0]);}}}}}catch(_0x9ae748){logger[_0xfaeb('0x3b')](_0xfaeb('0x60'),_0x42de91[_0xfaeb('0x26')],util[_0xfaeb('0x3d')](_0x9ae748,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfaeb('0x21')]['syncAgentComplete']=function(_0x4bef0c){try{if(this[_0xfaeb('0x23')](_0x4bef0c)){logger['debug'](_0xfaeb('0x61'),_0x4bef0c[_0xfaeb('0x26')],util[_0xfaeb('0x3d')](_0x4bef0c,{'showHidden':![],'depth':null}));if(this[_0xfaeb('0x9')][_0x4bef0c[_0xfaeb('0x26')]]){for(var _0x5b8312 in this['channels'][_0x4bef0c[_0xfaeb('0x26')]]){if(this['channels'][_0x4bef0c[_0xfaeb('0x26')]][_0xfaeb('0x3f')](_0x5b8312)){if(this[_0xfaeb('0x9')][_0x4bef0c['uniqueid']][_0x5b8312][_0xfaeb('0x62')]&&!this[_0xfaeb('0x9')][_0x4bef0c['uniqueid']][_0x5b8312][_0xfaeb('0x14')]){logger[_0xfaeb('0x25')](_0xfaeb('0x63'),_0x4bef0c[_0xfaeb('0x26')],this[_0xfaeb('0x9')][_0x4bef0c['uniqueid']][_0x5b8312][_0xfaeb('0x27')],_0x5b8312);this[_0xfaeb('0x9')][_0x4bef0c['uniqueid']][_0x5b8312][_0xfaeb('0x14')]=!![];this['channels'][_0x4bef0c[_0xfaeb('0x26')]][_0x5b8312][_0xfaeb('0x64')]=moment()[_0xfaeb('0x39')](_0xfaeb('0x2b'));this[_0xfaeb('0x9')][_0x4bef0c['uniqueid']][_0x5b8312][_0xfaeb('0x52')]=_0xfaeb('0x65');this['channels'][_0x4bef0c['uniqueid']][_0x5b8312][_0xfaeb('0x54')]=_0x4bef0c['reason']==_0xfaeb('0x66')?'agent':_0x4bef0c[_0xfaeb('0x54')];this[_0xfaeb('0x9')][_0x4bef0c[_0xfaeb('0x26')]][_0x5b8312][_0xfaeb('0x67')]=_0x4bef0c[_0xfaeb('0x67')];if(this[_0xfaeb('0xb')][_0x4bef0c[_0xfaeb('0x49')]]&&this[_0xfaeb('0xb')][_0x4bef0c[_0xfaeb('0x49')]]['acw']){this['channels'][_0x4bef0c[_0xfaeb('0x26')]][_0x5b8312]['acwtime']=this[_0xfaeb('0xb')][_0x4bef0c[_0xfaeb('0x49')]][_0xfaeb('0x68')];this['channels'][_0x4bef0c[_0xfaeb('0x26')]][_0x5b8312][_0xfaeb('0x69')]=!![];}this[_0xfaeb('0xc')][_0x4bef0c[_0xfaeb('0x47')]]=_['omit'](this[_0xfaeb('0xc')][_0x4bef0c[_0xfaeb('0x47')]],[_0xfaeb('0x49'),_0xfaeb('0x4a')]);logger[_0xfaeb('0x35')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x4bef0c['uniqueid'],util[_0xfaeb('0x3d')](this[_0xfaeb('0x9')][_0x4bef0c[_0xfaeb('0x26')]][_0x5b8312],{'showHidden':![],'depth':null}));ami['emit'](_0xfaeb('0x6a'),this['channels'][_0x4bef0c[_0xfaeb('0x26')]][_0x5b8312]);logger['debug'](_0xfaeb('0x6b'),_0x4bef0c[_0xfaeb('0x26')],util[_0xfaeb('0x3d')]({'id':this[_0xfaeb('0xc')][_0x4bef0c[_0xfaeb('0x47')]]['id'],'destaccountcode':_0x4bef0c[_0xfaeb('0x6c')]},{'showHidden':![],'depth':null}));this[_0xfaeb('0x22')](util[_0xfaeb('0x39')](_0xfaeb('0x3a'),_0x4bef0c[_0xfaeb('0x27')]),_0xfaeb('0x6d'),{'id':this['agents'][_0x4bef0c['interface']]['id'],'destaccountcode':Number(_0x4bef0c[_0xfaeb('0x6c')])});}}}}}}catch(_0x3f8957){logger[_0xfaeb('0x3b')](_0xfaeb('0x6e'),_0x4bef0c[_0xfaeb('0x26')],util[_0xfaeb('0x3d')](_0x3f8957,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfaeb('0x21')]['syncVarSet']=function(_0x474994){try{if(this[_0xfaeb('0x23')](_0x474994)){logger[_0xfaeb('0x35')](_0xfaeb('0x6f'),_0x474994[_0xfaeb('0x26')],util[_0xfaeb('0x3d')](_0x474994,{'showHidden':![],'depth':null}));this['addVariable'](_0x474994[_0xfaeb('0x26')],_['keys'](_0x474994['variable'])[0x0],_0x474994[_0xfaeb('0x70')]);if(this[_0xfaeb('0x9')][_0x474994[_0xfaeb('0x26')]]){for(var _0x4a0948 in this[_0xfaeb('0x9')][_0x474994[_0xfaeb('0x26')]]){if(this['channels'][_0x474994[_0xfaeb('0x26')]][_0xfaeb('0x3f')](_0x4a0948)){logger[_0xfaeb('0x25')]('[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s',_0x474994['uniqueid'],_0x4a0948,_[_0xfaeb('0x71')](_0x474994[_0xfaeb('0x72')])[0x0],_0x474994[_0xfaeb('0x70')]);if(_[_0xfaeb('0x24')](this['channels'][_0x474994[_0xfaeb('0x26')]][_0x4a0948]['variables'])){this[_0xfaeb('0x9')][_0x474994[_0xfaeb('0x26')]][_0x4a0948][_0xfaeb('0x2a')]={};}this['channels'][_0x474994[_0xfaeb('0x26')]][_0x4a0948]['variables']=this[_0xfaeb('0x2a')][_0x474994['uniqueid']];}}}}}catch(_0x5ae716){logger[_0xfaeb('0x3b')](_0xfaeb('0x73'),_0x474994['uniqueid'],util['inspect'](_0x5ae716,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xfaeb('0x74')]=function(_0x24df27,_0x1919dd,_0x486c35){var _0x1a9990=[_0xfaeb('0x75'),_0xfaeb('0x76'),_0xfaeb('0x77'),_0xfaeb('0x78'),_0xfaeb('0x79'),_0xfaeb('0x7a'),_0xfaeb('0x7b'),_0xfaeb('0x7c'),'sipcallid',_0xfaeb('0x7d'),_0xfaeb('0x7e'),_0xfaeb('0x7f'),_0xfaeb('0x80'),_0xfaeb('0x81'),_0xfaeb('0x82'),_0xfaeb('0x83'),_0xfaeb('0x27'),'memberpenalty',_0xfaeb('0x84')];if(!_[_0xfaeb('0x85')](_0x1919dd)&&!_[_0xfaeb('0x86')](_0x1a9990,_0x1919dd)){if(_['isUndefined'](this[_0xfaeb('0x2a')][_0x24df27])){this[_0xfaeb('0x2a')][_0x24df27]={};}this[_0xfaeb('0x2a')][_0x24df27][_0x1919dd]=_0x486c35;}};VoiceAgentReport[_0xfaeb('0x21')][_0xfaeb('0x19')]=function(_0xbd9633){try{if(this[_0xfaeb('0x23')](_0xbd9633)){logger[_0xfaeb('0x35')]('[%s][voiceAgentReport][hangup]\x20event:',_0xbd9633[_0xfaeb('0x26')],util[_0xfaeb('0x3d')](_0xbd9633,{'showHidden':![],'depth':null}));if(this[_0xfaeb('0x9')][_0xbd9633[_0xfaeb('0x26')]]){for(var _0x172cd5 in this[_0xfaeb('0x9')][_0xbd9633['uniqueid']]){if(this[_0xfaeb('0x9')][_0xbd9633[_0xfaeb('0x26')]][_0xfaeb('0x3f')](_0x172cd5)){if(this['channels'][_0xbd9633[_0xfaeb('0x26')]][_0x172cd5][_0xfaeb('0x54')]==_0xfaeb('0x66')&&this[_0xfaeb('0x9')][_0xbd9633[_0xfaeb('0x26')]][_0x172cd5]['agentcomplete']){logger[_0xfaeb('0x25')]('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0xbd9633[_0xfaeb('0x26')],_0x172cd5);this[_0xfaeb('0x9')][_0xbd9633[_0xfaeb('0x26')]][_0x172cd5][_0xfaeb('0x64')]=moment()[_0xfaeb('0x39')](_0xfaeb('0x2b'));}}}logger[_0xfaeb('0x35')](_0xfaeb('0x87'),_0xbd9633['uniqueid'],util[_0xfaeb('0x3d')](_[_0xfaeb('0x88')](this[_0xfaeb('0x9')][_0xbd9633['uniqueid']]),{'showHidden':![],'depth':null}));ami[_0xfaeb('0x22')]('custom:voiceAgentReport',_[_0xfaeb('0x88')](this[_0xfaeb('0x9')][_0xbd9633[_0xfaeb('0x26')]]));delete this[_0xfaeb('0x9')][_0xbd9633[_0xfaeb('0x26')]];}if(this[_0xfaeb('0x2a')][_0xbd9633[_0xfaeb('0x26')]]){delete this[_0xfaeb('0x2a')][_0xbd9633['uniqueid']];}}}catch(_0x23f215){logger[_0xfaeb('0x3b')](_0xfaeb('0x89'),_0xbd9633[_0xfaeb('0x26')],util[_0xfaeb('0x3d')](_0x23f215,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfaeb('0x21')][_0xfaeb('0x8a')]=function(_0x247301){try{if(this['isNotNull'](_0x247301)){logger['debug'](_0xfaeb('0x8b'),_0x247301[_0xfaeb('0x26')],util['inspect'](_0x247301,{'showHidden':![],'depth':null}));if(this[_0xfaeb('0x9')][_0x247301[_0xfaeb('0x8c')]]){for(var _0x253119 in this[_0xfaeb('0x9')][_0x247301[_0xfaeb('0x8c')]]){if(this[_0xfaeb('0x9')][_0x247301[_0xfaeb('0x8c')]][_0xfaeb('0x3f')](_0x253119)){if(_0x247301[_0xfaeb('0x8d')]===_0x253119){logger['info'](_0xfaeb('0x8e'),_0x247301[_0xfaeb('0x26')],this[_0xfaeb('0x9')][_0x247301[_0xfaeb('0x8c')]][_0x253119]['membername'],_0x253119);var _0x49509a=moment();this[_0xfaeb('0x9')][_0x247301['transfereeuniqueid']][_0x253119][_0xfaeb('0x14')]=!![];this[_0xfaeb('0x9')][_0x247301[_0xfaeb('0x8c')]][_0x253119][_0xfaeb('0x64')]=moment()[_0xfaeb('0x39')](_0xfaeb('0x2b'));this[_0xfaeb('0x9')][_0x247301[_0xfaeb('0x8c')]][_0x253119][_0xfaeb('0x52')]=_0xfaeb('0x65');this[_0xfaeb('0x9')][_0x247301[_0xfaeb('0x8c')]][_0x253119][_0xfaeb('0x54')]=_0xfaeb('0x66');this[_0xfaeb('0x9')][_0x247301[_0xfaeb('0x8c')]][_0x253119][_0xfaeb('0x67')]=_0x49509a[_0xfaeb('0x8f')](this[_0xfaeb('0x9')][_0x247301[_0xfaeb('0x8c')]][_0x253119][_0xfaeb('0x62')],_0xfaeb('0x90'));}}}}if(this['channels'][_0x247301['secondtransfereruniqueid']]){var _0x4dda22=this[_0xfaeb('0x9')][_0x247301[_0xfaeb('0x91')]];this[_0xfaeb('0x9')][_0x247301['secondtransfereruniqueid']]=this['channels'][_0x247301[_0xfaeb('0x8c')]];this[_0xfaeb('0x9')][_0x247301[_0xfaeb('0x8c')]]=_0x4dda22;}}}catch(_0xb21033){logger['error'](_0xfaeb('0x92'),_0x247301[_0xfaeb('0x26')],util[_0xfaeb('0x3d')](_0xb21033,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfaeb('0x21')]['syncBlindTransfer']=function(_0x3a96a6){try{if(this[_0xfaeb('0x23')](_0x3a96a6)){logger['debug'](_0xfaeb('0x93'),_0x3a96a6[_0xfaeb('0x26')],util[_0xfaeb('0x3d')](_0x3a96a6,{'showHidden':![],'depth':null}));if(this['channels'][_0x3a96a6[_0xfaeb('0x8c')]]){for(var _0x23e6e6 in this['channels'][_0x3a96a6[_0xfaeb('0x8c')]]){if(this[_0xfaeb('0x9')][_0x3a96a6[_0xfaeb('0x8c')]][_0xfaeb('0x3f')](_0x23e6e6)){if(_0x3a96a6[_0xfaeb('0x94')]===_0x23e6e6){logger['info'](_0xfaeb('0x95'),_0x3a96a6[_0xfaeb('0x26')],this[_0xfaeb('0x9')][_0x3a96a6[_0xfaeb('0x8c')]][_0x23e6e6][_0xfaeb('0x27')],_0x23e6e6);var _0x4cf60c=moment();this[_0xfaeb('0x9')][_0x3a96a6[_0xfaeb('0x8c')]][_0x23e6e6]['agentcomplete']=!![];this['channels'][_0x3a96a6[_0xfaeb('0x8c')]][_0x23e6e6][_0xfaeb('0x64')]=_0x4cf60c;this[_0xfaeb('0x9')][_0x3a96a6[_0xfaeb('0x8c')]][_0x23e6e6][_0xfaeb('0x52')]=_0xfaeb('0x65');this[_0xfaeb('0x9')][_0x3a96a6[_0xfaeb('0x8c')]][_0x23e6e6][_0xfaeb('0x54')]=_0xfaeb('0x66');this[_0xfaeb('0x9')][_0x3a96a6['transfereeuniqueid']][_0x23e6e6][_0xfaeb('0x67')]=_0x4cf60c[_0xfaeb('0x8f')](this[_0xfaeb('0x9')][_0x3a96a6['transfereeuniqueid']][_0x23e6e6][_0xfaeb('0x62')],_0xfaeb('0x90'));}}}}}}catch(_0x433d0e){logger['error'](_0xfaeb('0x96'),_0x3a96a6[_0xfaeb('0x26')],util['inspect'](_0x433d0e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfaeb('0x21')][_0xfaeb('0x1b')]=function(_0x4b0227){var _0x592fd8='';try{if(this[_0xfaeb('0x23')](_0x4b0227)){logger[_0xfaeb('0x35')](_0xfaeb('0x97'),_0x4b0227[_0xfaeb('0x26')],util[_0xfaeb('0x3d')](_0x4b0227,{'showHidden':![],'depth':null}));if(_0x4b0227[_0xfaeb('0x98')]){_0x592fd8=_0x4b0227['channel']['substring'](0x0,_0x4b0227[_0xfaeb('0x98')][_0xfaeb('0x99')]('-'));if(this[_0xfaeb('0xc')][_0x592fd8]){logger[_0xfaeb('0x25')](_0xfaeb('0x9a'),_0x4b0227['uniqueid'],_0x592fd8);this['agents'][_0x592fd8]['onhold']=!![];}}}}catch(_0x2ad6b0){logger[_0xfaeb('0x3b')](_0xfaeb('0x9b'),_0x4b0227[_0xfaeb('0x26')],util[_0xfaeb('0x3d')](_0x2ad6b0,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xfaeb('0x1d')]=function(_0xee06b1){var _0x165d78='';try{if(this[_0xfaeb('0x23')](_0xee06b1)){logger['debug'](_0xfaeb('0x9c'),_0xee06b1[_0xfaeb('0x26')],util[_0xfaeb('0x3d')](_0xee06b1,{'showHidden':![],'depth':null}));if(_0xee06b1[_0xfaeb('0x98')]){_0x165d78=_0xee06b1[_0xfaeb('0x98')][_0xfaeb('0x9d')](0x0,_0xee06b1[_0xfaeb('0x98')][_0xfaeb('0x99')]('-'));if(this[_0xfaeb('0xc')][_0x165d78]){logger[_0xfaeb('0x25')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0xee06b1[_0xfaeb('0x26')],_0x165d78);this['agents'][_0x165d78]['onhold']=![];}}}}catch(_0x13a149){logger[_0xfaeb('0x3b')](_0xfaeb('0x9e'),_0xee06b1[_0xfaeb('0x26')],util[_0xfaeb('0x3d')](_0x13a149,{'showHidden':![],'depth':null}));}};module[_0xfaeb('0x9f')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index e5d9d93..5cfbc0d 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7e19=['split','undefined','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','name','user:agentconnect','accountcode','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','applicationdata','appdata','startsWith','CDR(routeAlias)','toLowerCase','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','subtract','duration','seconds','includes','lastapplication','lastdata','match','type','isNil','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridnum','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','diff','UserId','membername','connectedlinename','destinationchannel','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','find','monitors','rec','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','parse','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalllinkedid','[%s][voiceCallReport][varset]','cause-txt','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','transferType','then','stopRecordingOnTransfer','resolve','Action','catch','StopMixMonitor','finally','webbar:stopmonitors','event','BlindTransfer','outbound','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','some','routeid','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfereruniqueid','transfererchannel','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','[%s][voiceCallReport][musiconholdstop]','exports','lodash','moment','util','path','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','../rpc/setting','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','BUSY','redis','defaults','localhost','socket.io-emitter','channels','agents','blindTransfers','syncNewExten','newexten','newchannel','syncNewChannel','bind','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','syncAttendedTransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','info','[voiceCallReport][coreshowchannels]\x20started','error','[voiceCallReport][coreshowchannels]','inspect','isNotNull','isUndefined','prototype','emit','uniqueid','calleridname','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','pick','context','from-sip','channel','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','user:%s','debug','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','keys'];(function(_0x1a9ca3,_0x239eb6){var _0x388986=function(_0x58b97b){while(--_0x58b97b){_0x1a9ca3['push'](_0x1a9ca3['shift']());}};_0x388986(++_0x239eb6);}(_0x7e19,0x7d));var _0x97e1=function(_0x370b89,_0x54e414){_0x370b89=_0x370b89-0x0;var _0x257a63=_0x7e19[_0x370b89];return _0x257a63;};'use strict';var _=require(_0x97e1('0x0'));var moment=require(_0x97e1('0x1'));var util=require(_0x97e1('0x2'));var path=require(_0x97e1('0x3'));var Redis=require('ioredis');var config=require(_0x97e1('0x4'));var logger=require(_0x97e1('0x5'))(_0x97e1('0x6'));var ami=require(_0x97e1('0x7'));var Channel=require(_0x97e1('0x8'));var RpcSetting=require(_0x97e1('0x9'));var applications=[_0x97e1('0xa'),_0x97e1('0xb'),_0x97e1('0xc'),_0x97e1('0xd'),_0x97e1('0xe'),_0x97e1('0xf')];var dispositions=[_0x97e1('0x10'),_0x97e1('0x11'),_0x97e1('0x11'),_0x97e1('0x10'),'NO\x20ANSWER','NO\x20ANSWER','ANSWERED',_0x97e1('0x12'),_0x97e1('0x11'),_0x97e1('0x11'),'FAILED'];config[_0x97e1('0x13')]=_[_0x97e1('0x14')](config[_0x97e1('0x13')],{'host':_0x97e1('0x15'),'port':0x18eb});var io=require(_0x97e1('0x16'))(new Redis(config[_0x97e1('0x13')]));function VoiceCallReport(_0x1dd2d7){this['channels']=_0x1dd2d7[_0x97e1('0x17')];this[_0x97e1('0x18')]=_0x1dd2d7[_0x97e1('0x18')];this[_0x97e1('0x19')]={};ami['on']('coreshowchannel',this[_0x97e1('0x1a')]['bind'](this));ami['on'](_0x97e1('0x1b'),this[_0x97e1('0x1a')]['bind'](this));ami['on'](_0x97e1('0x1c'),this[_0x97e1('0x1d')][_0x97e1('0x1e')](this));ami['on'](_0x97e1('0x1f'),this[_0x97e1('0x20')][_0x97e1('0x1e')](this));ami['on'](_0x97e1('0x21'),this[_0x97e1('0x22')][_0x97e1('0x1e')](this));ami['on'](_0x97e1('0x23'),this[_0x97e1('0x24')]['bind'](this));ami['on'](_0x97e1('0x25'),this[_0x97e1('0x26')][_0x97e1('0x1e')](this));ami['on']('attendedtransfer',this[_0x97e1('0x27')][_0x97e1('0x1e')](this));ami['on']('blindtransfer',this[_0x97e1('0x28')][_0x97e1('0x1e')](this));ami['on'](_0x97e1('0x29'),this[_0x97e1('0x2a')][_0x97e1('0x1e')](this));ami['on'](_0x97e1('0x2b'),this['syncMusicOnHoldStop'][_0x97e1('0x1e')](this));try{logger[_0x97e1('0x2c')](_0x97e1('0x2d'));ami['actionCoreShowChannels']();}catch(_0x5468d4){logger[_0x97e1('0x2e')](_0x97e1('0x2f'),util[_0x97e1('0x30')](_0x5468d4,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype'][_0x97e1('0x31')]=function(_0x423366){return _0x423366!==null&&!_[_0x97e1('0x32')](_0x423366);};VoiceCallReport[_0x97e1('0x33')][_0x97e1('0x34')]=function(_0x568b71,_0x313cd1,_0x2e7993){io['to'](_0x568b71)['emit'](_0x313cd1,_0x2e7993);};VoiceCallReport[_0x97e1('0x33')]['syncNewCallerId']=function(_0x5f15f1){try{if(this[_0x97e1('0x31')](_0x5f15f1)){logger[_0x97e1('0x2c')]('[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s',_0x5f15f1[_0x97e1('0x35')],_0x5f15f1[_0x97e1('0x36')],_0x5f15f1['calleridnum']);logger['debug'](_0x97e1('0x37'),_0x5f15f1[_0x97e1('0x35')],util[_0x97e1('0x30')](_0x5f15f1,{'showHidden':![],'depth':null}));if(_0x5f15f1[_0x97e1('0x35')]===_0x5f15f1[_0x97e1('0x38')]){if(!_[_0x97e1('0x32')](this[_0x97e1('0x17')][_0x5f15f1[_0x97e1('0x35')]])){_[_0x97e1('0x39')](this[_0x97e1('0x17')][_0x5f15f1[_0x97e1('0x35')]],_[_0x97e1('0x3a')](_0x5f15f1,_['keys'](this[_0x97e1('0x17')][_0x5f15f1[_0x97e1('0x35')]])));}}if(_0x5f15f1[_0x97e1('0x3b')]===_0x97e1('0x3c')){var _0x45de11=this[_0x97e1('0x18')][_0x5f15f1[_0x97e1('0x3d')]['split']('-')[0x0]];if(_0x45de11){if(_0x5f15f1[_0x97e1('0x3e')]==_0x97e1('0x3f')){_0x45de11[_0x97e1('0x40')]=_0x5f15f1[_0x97e1('0x41')];this[_0x97e1('0x34')](util['format'](_0x97e1('0x42'),_0x45de11['name']),'user:agentconnect',{'id':_0x45de11['id'],'destaccountcode':_0x45de11['accountcode'],'destconnectedlinenum':_0x5f15f1[_0x97e1('0x41')]});}}}}}catch(_0x99c07c){logger[_0x97e1('0x2e')]('[%s][voiceCallReport][newcallerid]',_0x5f15f1['uniqueid'],util[_0x97e1('0x30')](_0x99c07c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x97e1('0x33')]['syncNewChannel']=function(_0x1e34b4){try{if(this[_0x97e1('0x31')](_0x1e34b4)){logger[_0x97e1('0x43')](_0x97e1('0x44'),_0x1e34b4['uniqueid'],util[_0x97e1('0x30')](_0x1e34b4,{'showHidden':![],'depth':null}));if(this[_0x97e1('0x17')][_0x1e34b4[_0x97e1('0x35')]]){return;}if(_0x1e34b4[_0x97e1('0x3d')]===_0x97e1('0x45')){return;}if(_0x1e34b4[_0x97e1('0x35')]!==_0x1e34b4[_0x97e1('0x38')]&&!this[_0x97e1('0x19')][_0x1e34b4[_0x97e1('0x38')]]){return;}logger[_0x97e1('0x2c')](_0x97e1('0x46'),_0x1e34b4[_0x97e1('0x35')],_0x1e34b4['context'],_0x1e34b4[_0x97e1('0x3e')]);this[_0x97e1('0x17')][_0x1e34b4[_0x97e1('0x35')]]=new Channel();this[_0x97e1('0x17')][_0x1e34b4[_0x97e1('0x35')]][_0x97e1('0x47')]=moment()[_0x97e1('0x48')](_0x97e1('0x49'));this['channels'][_0x1e34b4['uniqueid']][_0x97e1('0x4a')]=dispositions[_[_0x97e1('0x4b')](_0x1e34b4[_0x97e1('0x4c')])];_[_0x97e1('0x39')](this[_0x97e1('0x17')][_0x1e34b4[_0x97e1('0x35')]],_[_0x97e1('0x3a')](_0x1e34b4,_[_0x97e1('0x4d')](this['channels'][_0x1e34b4[_0x97e1('0x35')]])));if(_0x1e34b4[_0x97e1('0x3b')]===_0x97e1('0x3c')){var _0x7c5b40=this[_0x97e1('0x18')][_0x1e34b4[_0x97e1('0x3d')][_0x97e1('0x4e')]('-')[0x0]];if(_0x7c5b40&&typeof _0x7c5b40[_0x97e1('0x40')]===_0x97e1('0x4f')){_0x7c5b40[_0x97e1('0x40')]=_0x1e34b4[_0x97e1('0x3e')];logger[_0x97e1('0x43')](_0x97e1('0x50'),_0x1e34b4[_0x97e1('0x35')],util['inspect']({'id':_0x7c5b40['id'],'destaccountcode':_0x7c5b40['accountcode'],'destconnectedlinenum':_0x1e34b4['exten']},{'showHidden':![],'depth':null}));this[_0x97e1('0x34')](util[_0x97e1('0x48')](_0x97e1('0x42'),_0x7c5b40[_0x97e1('0x51')]),_0x97e1('0x52'),{'id':_0x7c5b40['id'],'destaccountcode':_0x7c5b40[_0x97e1('0x53')],'destconnectedlinenum':_0x1e34b4[_0x97e1('0x3e')]});}}}}catch(_0x4aebf0){logger[_0x97e1('0x2e')](_0x97e1('0x54'),_0x1e34b4[_0x97e1('0x35')],util['inspect'](_0x4aebf0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x97e1('0x33')][_0x97e1('0x1a')]=function(_0x5c3681){try{if(this[_0x97e1('0x31')](_0x5c3681)){logger[_0x97e1('0x43')](_0x97e1('0x55'),_0x5c3681[_0x97e1('0x35')],util['inspect'](_0x5c3681,{'showHidden':![],'depth':null}));if(_0x5c3681[_0x97e1('0x3d')]==='OutgoingSpoolFailed'||_0x5c3681[_0x97e1('0x3e')]==='h')return;if(_0x5c3681['uniqueid']===_0x5c3681[_0x97e1('0x38')]||this[_0x97e1('0x19')][_0x5c3681[_0x97e1('0x38')]]){_0x5c3681[_0x97e1('0x56')]=_0x5c3681[_0x97e1('0x56')]?_0x5c3681[_0x97e1('0x56')]['toLowerCase']():undefined;_0x5c3681[_0x97e1('0x57')]=_0x5c3681[_0x97e1('0x58')]||_0x5c3681['applicationdata'];if(_0x5c3681[_0x97e1('0x58')]&&!_0x5c3681[_0x97e1('0x58')][_0x97e1('0x59')](_0x97e1('0x5a'))&&_0x5c3681['application']!==_0x97e1('0xb')){_0x5c3681[_0x97e1('0x57')]=_0x5c3681['applicationdata'][_0x97e1('0x5b')]();}logger[_0x97e1('0x2c')](_0x97e1('0x5c'),_0x5c3681[_0x97e1('0x35')],_0x5c3681[_0x97e1('0x56')],_0x5c3681[_0x97e1('0x57')]);if(_[_0x97e1('0x32')](this[_0x97e1('0x17')][_0x5c3681[_0x97e1('0x35')]])){this[_0x97e1('0x17')][_0x5c3681[_0x97e1('0x35')]]=new Channel();this[_0x97e1('0x17')][_0x5c3681['uniqueid']][_0x97e1('0x47')]=_0x5c3681['duration']?moment()[_0x97e1('0x5d')](moment[_0x97e1('0x5e')](_0x5c3681[_0x97e1('0x5e')])[_0x97e1('0x5f')](),_0x97e1('0x5f'))['format'](_0x97e1('0x49')):moment()[_0x97e1('0x48')](_0x97e1('0x49'));this[_0x97e1('0x17')][_0x5c3681[_0x97e1('0x35')]][_0x97e1('0x4a')]=_0x97e1('0x10');}_[_0x97e1('0x39')](this[_0x97e1('0x17')][_0x5c3681[_0x97e1('0x35')]],_[_0x97e1('0x3a')](_0x5c3681,_[_0x97e1('0x4d')](this[_0x97e1('0x17')][_0x5c3681[_0x97e1('0x35')]])));if(_[_0x97e1('0x60')](applications,_0x5c3681[_0x97e1('0x56')])){this[_0x97e1('0x17')][_0x5c3681['uniqueid']][_0x97e1('0x61')]=_0x5c3681[_0x97e1('0x56')];this[_0x97e1('0x17')][_0x5c3681[_0x97e1('0x35')]][_0x97e1('0x62')]=_0x5c3681['applicationdata'];if(_0x5c3681[_0x97e1('0x56')]==='set'&&_['startsWith'](_0x5c3681['applicationdata'][_0x97e1('0x5b')](),'cdr(')){var _0x20571f=_0x5c3681[_0x97e1('0x57')][_0x97e1('0x4e')]('=');var _0x2d0c68=_0x20571f[0x0]['toLowerCase']()[_0x97e1('0x63')](/cdr\((.*)\)/);if(_0x2d0c68){if(_0x2d0c68[0x1]===_0x97e1('0x64')&&!_[_0x97e1('0x65')](this[_0x97e1('0x17')][_0x5c3681['uniqueid']][_0x2d0c68[0x1]]))return;this[_0x97e1('0x17')][_0x5c3681[_0x97e1('0x35')]][_0x2d0c68[0x1]]=_0x20571f[0x1];}}else if(_0x5c3681['application']==='queue'){this[_0x97e1('0x17')][_0x5c3681['uniqueid']][_0x97e1('0xb')]=_0x5c3681[_0x97e1('0x57')][_0x97e1('0x4e')](',')[0x0];}}}}}catch(_0x2f9d23){logger['error']('[%s][voiceCallReport][newexten]',_0x5c3681['uniqueid'],util['inspect'](_0x2f9d23,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x97e1('0x20')]=function(_0x22233b){try{if(this[_0x97e1('0x31')](_0x22233b)){logger['info'](_0x97e1('0x66'),_0x22233b[_0x97e1('0x35')],_0x22233b[_0x97e1('0x38')],_0x22233b[_0x97e1('0x36')],_0x22233b[_0x97e1('0x67')]);logger[_0x97e1('0x43')](_0x97e1('0x68'),_0x22233b[_0x97e1('0x35')],util[_0x97e1('0x30')](_0x22233b,{'showHidden':![],'depth':null}));if(_0x22233b[_0x97e1('0x4c')]!=='6')return;var _0x44b158=this['agents'][_0x22233b[_0x97e1('0x3d')][_0x97e1('0x4e')]('-')[0x0]];if(_0x22233b[_0x97e1('0x35')]!==_0x22233b[_0x97e1('0x38')]){var _0x3550b3=moment();if(this['channels'][_0x22233b[_0x97e1('0x38')]]){if(!this[_0x97e1('0x17')][_0x22233b[_0x97e1('0x38')]][_0x97e1('0x69')]){this[_0x97e1('0x17')][_0x22233b['linkedid']][_0x97e1('0x69')]=!![];this[_0x97e1('0x17')][_0x22233b['linkedid']][_0x97e1('0x6a')]=_0x3550b3[_0x97e1('0x48')](_0x97e1('0x49'));if(this[_0x97e1('0x17')][_0x22233b[_0x97e1('0x38')]][_0x97e1('0x47')]){this['channels'][_0x22233b[_0x97e1('0x38')]][_0x97e1('0x6b')]=_0x3550b3[_0x97e1('0x6c')](this[_0x97e1('0x17')][_0x22233b['linkedid']][_0x97e1('0x47')],_0x97e1('0x5f'));}}this[_0x97e1('0x17')][_0x22233b[_0x97e1('0x38')]]['linkedid']=_0x22233b[_0x97e1('0x35')];if(_0x22233b[_0x97e1('0x67')]!==_0x97e1('0x3f')){this[_0x97e1('0x17')][_0x22233b[_0x97e1('0x38')]][_0x97e1('0x41')]=_0x22233b[_0x97e1('0x67')];}this[_0x97e1('0x17')][_0x22233b['linkedid']]['connectedlinename']=_0x22233b[_0x97e1('0x36')];this[_0x97e1('0x17')][_0x22233b[_0x97e1('0x38')]]['destinationchannel']=_0x22233b['channel'];this[_0x97e1('0x17')][_0x22233b[_0x97e1('0x38')]][_0x97e1('0x4a')]=dispositions[_['toNumber'](_0x22233b[_0x97e1('0x4c')])];if(_0x44b158){this[_0x97e1('0x17')][_0x22233b['linkedid']][_0x97e1('0x6d')]=_0x44b158['id'];this[_0x97e1('0x17')][_0x22233b['linkedid']][_0x97e1('0x6e')]=_0x44b158['name'];}}if(this['channels'][_0x22233b[_0x97e1('0x35')]]){if(!this['channels'][_0x22233b[_0x97e1('0x35')]]['answered']){this['channels'][_0x22233b['uniqueid']][_0x97e1('0x69')]=!![];this[_0x97e1('0x17')][_0x22233b[_0x97e1('0x35')]][_0x97e1('0x6a')]=_0x3550b3[_0x97e1('0x48')](_0x97e1('0x49'));if(this[_0x97e1('0x17')][_0x22233b[_0x97e1('0x35')]][_0x97e1('0x47')]){this[_0x97e1('0x17')][_0x22233b[_0x97e1('0x35')]][_0x97e1('0x6b')]=_0x3550b3['diff'](this[_0x97e1('0x17')][_0x22233b[_0x97e1('0x35')]]['starttime'],'seconds');}}if(_0x22233b[_0x97e1('0x67')]!==_0x97e1('0x3f')){this[_0x97e1('0x17')][_0x22233b[_0x97e1('0x35')]][_0x97e1('0x41')]=_0x22233b[_0x97e1('0x67')];}this[_0x97e1('0x17')][_0x22233b[_0x97e1('0x35')]][_0x97e1('0x6f')]=_0x22233b[_0x97e1('0x36')];this[_0x97e1('0x17')][_0x22233b['uniqueid']][_0x97e1('0x70')]=_0x22233b['channel'];this[_0x97e1('0x17')][_0x22233b[_0x97e1('0x35')]][_0x97e1('0x4a')]=dispositions[_[_0x97e1('0x4b')](_0x22233b[_0x97e1('0x4c')])];}}else{if(this['channels'][_0x22233b['uniqueid']]){if(_0x44b158){this[_0x97e1('0x17')][_0x22233b[_0x97e1('0x35')]][_0x97e1('0x6d')]=_0x44b158['id'];this['channels'][_0x22233b[_0x97e1('0x35')]]['membername']=_0x44b158['name'];}}}if(_0x22233b[_0x97e1('0x3b')]==='from-sip'){if(_0x44b158){_0x44b158[_0x97e1('0x40')]=_0x22233b[_0x97e1('0x3e')];var _0xfe0638,_0x28ae1d;if(this['channels'][_0x22233b[_0x97e1('0x35')]]){_0xfe0638=this[_0x97e1('0x17')][_0x22233b[_0x97e1('0x35')]]['routealias'];_0x28ae1d=this[_0x97e1('0x17')][_0x22233b['uniqueid']][_0x97e1('0xb')];}else if(this[_0x97e1('0x17')][_0x22233b['linkedid']]){_0xfe0638=this[_0x97e1('0x17')][_0x22233b[_0x97e1('0x38')]][_0x97e1('0x71')];_0x28ae1d=this[_0x97e1('0x17')][_0x22233b[_0x97e1('0x38')]][_0x97e1('0xb')];}_0x44b158[_0x97e1('0xb')]=_0x28ae1d;_0x44b158['routealias']=_0xfe0638;var _0x319b46={'id':_0x44b158['id'],'name':_0x44b158[_0x97e1('0x51')],'agentconnected':!![],'destaccountcode':_0x44b158['accountcode'],'destconnectedlinenum':_0x22233b[_0x97e1('0x3e')],'queue':_0x28ae1d||undefined,'routealias':_0xfe0638,'uniqueid':_0x22233b[_0x97e1('0x38')]};logger[_0x97e1('0x43')](_0x97e1('0x72'),_0x22233b['uniqueid'],util[_0x97e1('0x30')](_0x319b46,{'showHidden':![],'depth':null}));this[_0x97e1('0x34')](util[_0x97e1('0x48')](_0x97e1('0x42'),_0x44b158['name']),_0x97e1('0x52'),_0x319b46);}}}}catch(_0x2bab8a){logger['error'](_0x97e1('0x73'),_0x22233b[_0x97e1('0x35')],util['inspect'](_0x2bab8a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x97e1('0x33')][_0x97e1('0x74')]=function(_0x24b2d8,_0x41481f){try{if(this[_0x97e1('0x17')][_0x24b2d8]){logger[_0x97e1('0x2c')](_0x97e1('0x75'),_0x24b2d8,_0x41481f);this[_0x97e1('0x17')][_0x24b2d8][_0x97e1('0x76')]=!![];if(_[_0x97e1('0x77')](_0x41481f,_0x97e1('0x78'))){_0x41481f=_0x41481f[_0x97e1('0x79')]('.wav49',_0x97e1('0x7a'));}this[_0x97e1('0x17')][_0x24b2d8][_0x97e1('0x7b')]=_0x41481f;var _0x516bdc=_[_0x97e1('0x7c')](this['channels'][_0x24b2d8]['monitors'],{'filename':_0x41481f});if(_[_0x97e1('0x65')](_0x516bdc)){this[_0x97e1('0x17')][_0x24b2d8][_0x97e1('0x7d')]['push']({'filename':_0x41481f,'createdAt':moment()[_0x97e1('0x48')](_0x97e1('0x49')),'mixmonitorid':'','status':_0x97e1('0x7e')});}}}catch(_0x56f473){logger[_0x97e1('0x2e')]('[%s][voiceCallReport][mixMonitorFilename]',_0x24b2d8,util[_0x97e1('0x30')](_0x56f473,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x97e1('0x33')]['syncVarSet']=function(_0x2c0d16){try{if(this[_0x97e1('0x31')](_0x2c0d16)){logger[_0x97e1('0x43')](_0x97e1('0x7f'),_0x2c0d16[_0x97e1('0x35')],util['inspect'](_0x2c0d16,{'showHidden':![],'depth':null}));if(this[_0x97e1('0x17')][_0x2c0d16[_0x97e1('0x35')]]&&_0x2c0d16[_0x97e1('0x3d')]!='OutgoingSpoolFailed'){if(this[_0x97e1('0x31')](_0x2c0d16['variable'])){if(this[_0x97e1('0x31')](_0x2c0d16[_0x97e1('0x80')][_0x97e1('0x81')])){logger[_0x97e1('0x2c')](_0x97e1('0x82'),_0x2c0d16[_0x97e1('0x35')],_0x2c0d16[_0x97e1('0x83')]);this[_0x97e1('0x74')](_0x2c0d16[_0x97e1('0x35')],_0x2c0d16[_0x97e1('0x83')]);}else if(this[_0x97e1('0x31')](_0x2c0d16[_0x97e1('0x80')][_0x97e1('0x84')])){logger[_0x97e1('0x2c')](_0x97e1('0x85'),_0x2c0d16[_0x97e1('0x35')],_0x2c0d16[_0x97e1('0x83')]);this[_0x97e1('0x17')][_0x2c0d16[_0x97e1('0x35')]][_0x97e1('0x67')]=_0x2c0d16[_0x97e1('0x83')];}else if(this[_0x97e1('0x31')](_0x2c0d16['variable'][_0x97e1('0x86')])){logger[_0x97e1('0x2c')](_0x97e1('0x87'),_0x2c0d16[_0x97e1('0x35')],_0x2c0d16[_0x97e1('0x83')]);this[_0x97e1('0x17')][_0x2c0d16[_0x97e1('0x35')]][_0x97e1('0x88')]=_0x2c0d16[_0x97e1('0x83')];}else if(this['isNotNull'](_0x2c0d16[_0x97e1('0x80')][_0x97e1('0x89')])){logger['info'](_0x97e1('0x8a'),_0x2c0d16[_0x97e1('0x35')],_0x2c0d16[_0x97e1('0x83')]);this[_0x97e1('0x17')][_0x2c0d16['uniqueid']][_0x97e1('0x64')]=_0x2c0d16[_0x97e1('0x83')];}else if(this[_0x97e1('0x31')](_0x2c0d16['variable'][_0x97e1('0x8b')])){logger['info'](_0x97e1('0x8c'),_0x2c0d16[_0x97e1('0x35')],_0x2c0d16[_0x97e1('0x83')][_0x97e1('0x4e')](',')[0x0]);this[_0x97e1('0x17')][_0x2c0d16[_0x97e1('0x35')]][_0x97e1('0xb')]=_0x2c0d16[_0x97e1('0x83')][_0x97e1('0x4e')](',')[0x0];}else if(this[_0x97e1('0x31')](_0x2c0d16[_0x97e1('0x80')][_0x97e1('0x8d')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x2c0d16['uniqueid'],_0x2c0d16[_0x97e1('0x83')]);this[_0x97e1('0x17')][_0x2c0d16[_0x97e1('0x35')]][_0x97e1('0x8e')]=_0x2c0d16[_0x97e1('0x83')];}else if(this['isNotNull'](_0x2c0d16[_0x97e1('0x80')][_0x97e1('0x8f')])){logger[_0x97e1('0x2c')](_0x97e1('0x90'),_0x2c0d16[_0x97e1('0x35')],_0x2c0d16[_0x97e1('0x83')]);this[_0x97e1('0x17')][_0x2c0d16['uniqueid']]['destination']=_0x2c0d16[_0x97e1('0x83')];}else if(this[_0x97e1('0x31')](_0x2c0d16[_0x97e1('0x80')][_0x97e1('0x91')])){logger[_0x97e1('0x2c')](_0x97e1('0x92'),_0x2c0d16[_0x97e1('0x35')],_0x2c0d16['value']);this[_0x97e1('0x17')][_0x2c0d16['uniqueid']]['calleridpreview']=_0x2c0d16[_0x97e1('0x83')];}else if(this[_0x97e1('0x31')](_0x2c0d16[_0x97e1('0x80')][_0x97e1('0x93')])){logger[_0x97e1('0x2c')](_0x97e1('0x94'),_0x2c0d16[_0x97e1('0x35')],_0x2c0d16[_0x97e1('0x83')]);this['channels'][_0x2c0d16['uniqueid']][_0x97e1('0xb')]=_0x2c0d16[_0x97e1('0x83')];}else if(this[_0x97e1('0x31')](_0x2c0d16['variable'][_0x97e1('0x95')])){logger[_0x97e1('0x2c')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x2c0d16[_0x97e1('0x35')],_0x2c0d16[_0x97e1('0x83')]);this[_0x97e1('0x17')][_0x2c0d16[_0x97e1('0x35')]]['sipcalluniqueid']=_0x2c0d16[_0x97e1('0x83')];}}}else if(this[_0x97e1('0x31')](_0x2c0d16[_0x97e1('0x80')][_0x97e1('0x81')])){if(_0x2c0d16['value']){var _0x3e0c64=path[_0x97e1('0x96')](_0x2c0d16[_0x97e1('0x83')])[_0x97e1('0x51')];logger[_0x97e1('0x2c')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x3e0c64,_0x2c0d16['value']);this[_0x97e1('0x74')](_0x3e0c64,_0x2c0d16[_0x97e1('0x83')]);}}else if(this[_0x97e1('0x17')][_0x2c0d16[_0x97e1('0x38')]]){if(this[_0x97e1('0x31')](_0x2c0d16[_0x97e1('0x80')])){if(this[_0x97e1('0x31')](_0x2c0d16[_0x97e1('0x80')][_0x97e1('0x95')])){logger[_0x97e1('0x2c')](_0x97e1('0x97'),_0x2c0d16[_0x97e1('0x38')],_0x2c0d16[_0x97e1('0x83')]);this[_0x97e1('0x17')][_0x2c0d16['linkedid']][_0x97e1('0x98')]=_0x2c0d16['value'];}}}}}catch(_0x59aa0a){logger[_0x97e1('0x2e')](_0x97e1('0x99'),_0x2c0d16[_0x97e1('0x35')],util[_0x97e1('0x30')](_0x59aa0a,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x97e1('0x24')]=function(_0x2d2e6c){try{if(this[_0x97e1('0x31')](_0x2d2e6c)){logger[_0x97e1('0x43')]('[%s][voiceCallReport][hangup]\x20event:',_0x2d2e6c[_0x97e1('0x35')],util['inspect'](_0x2d2e6c,{'showHidden':![],'depth':null}));if(this[_0x97e1('0x19')][_0x2d2e6c[_0x97e1('0x38')]]){if(this[_0x97e1('0x17')][this['blindTransfers'][_0x2d2e6c[_0x97e1('0x38')]][_0x97e1('0x38')]]){this[_0x97e1('0x17')][this[_0x97e1('0x19')][_0x2d2e6c[_0x97e1('0x38')]][_0x97e1('0x38')]]['uniqueid']=_0x2d2e6c[_0x97e1('0x35')];this[_0x97e1('0x17')][this[_0x97e1('0x19')][_0x2d2e6c['linkedid']][_0x97e1('0x38')]]['answered']=this[_0x97e1('0x17')][_0x2d2e6c[_0x97e1('0x35')]][_0x97e1('0x69')];this[_0x97e1('0x17')][this['blindTransfers'][_0x2d2e6c['linkedid']][_0x97e1('0x38')]][_0x97e1('0x6a')]=this[_0x97e1('0x17')][_0x2d2e6c['uniqueid']][_0x97e1('0x6a')];this[_0x97e1('0x17')][this[_0x97e1('0x19')][_0x2d2e6c[_0x97e1('0x38')]][_0x97e1('0x38')]][_0x97e1('0x70')]=this['channels'][this[_0x97e1('0x19')][_0x2d2e6c['linkedid']][_0x97e1('0x38')]][_0x97e1('0x3d')];this[_0x97e1('0x17')][this[_0x97e1('0x19')][_0x2d2e6c[_0x97e1('0x38')]][_0x97e1('0x38')]][_0x97e1('0x4a')]=this[_0x97e1('0x17')][_0x2d2e6c[_0x97e1('0x35')]][_0x97e1('0x4a')];this[_0x97e1('0x17')][_0x2d2e6c[_0x97e1('0x35')]]=this[_0x97e1('0x17')][this[_0x97e1('0x19')][_0x2d2e6c[_0x97e1('0x38')]][_0x97e1('0x38')]];delete this[_0x97e1('0x17')][this[_0x97e1('0x19')][_0x2d2e6c['linkedid']][_0x97e1('0x38')]];}else if(this[_0x97e1('0x17')][this[_0x97e1('0x19')][_0x2d2e6c['linkedid']][_0x97e1('0x35')]]){this[_0x97e1('0x17')][this[_0x97e1('0x19')][_0x2d2e6c[_0x97e1('0x38')]][_0x97e1('0x35')]][_0x97e1('0x35')]=[this[_0x97e1('0x17')][this[_0x97e1('0x19')][_0x2d2e6c[_0x97e1('0x38')]][_0x97e1('0x35')]][_0x97e1('0x38')],this[_0x97e1('0x17')][this[_0x97e1('0x19')][_0x2d2e6c[_0x97e1('0x38')]][_0x97e1('0x35')]][_0x97e1('0x38')]=this[_0x97e1('0x17')][this['blindTransfers'][_0x2d2e6c['linkedid']][_0x97e1('0x35')]][_0x97e1('0x35')]][0x0];this['channels'][this[_0x97e1('0x19')][_0x2d2e6c[_0x97e1('0x38')]]['uniqueid']][_0x97e1('0x69')]=this[_0x97e1('0x17')][_0x2d2e6c['uniqueid']][_0x97e1('0x69')];this[_0x97e1('0x17')][this[_0x97e1('0x19')][_0x2d2e6c[_0x97e1('0x38')]][_0x97e1('0x35')]]['answertime']=this['channels'][_0x2d2e6c[_0x97e1('0x35')]][_0x97e1('0x6a')];this[_0x97e1('0x17')][this['blindTransfers'][_0x2d2e6c[_0x97e1('0x38')]][_0x97e1('0x35')]][_0x97e1('0x70')]=this[_0x97e1('0x17')][this['blindTransfers'][_0x2d2e6c[_0x97e1('0x38')]]['uniqueid']][_0x97e1('0x3d')];this[_0x97e1('0x17')][this[_0x97e1('0x19')][_0x2d2e6c[_0x97e1('0x38')]][_0x97e1('0x35')]]['disposition']=this['channels'][_0x2d2e6c[_0x97e1('0x35')]][_0x97e1('0x4a')];this['channels'][_0x2d2e6c[_0x97e1('0x35')]]=this['channels'][this[_0x97e1('0x19')][_0x2d2e6c[_0x97e1('0x38')]][_0x97e1('0x35')]];delete this[_0x97e1('0x17')][this[_0x97e1('0x19')][_0x2d2e6c[_0x97e1('0x38')]][_0x97e1('0x35')]];}}if(this[_0x97e1('0x17')][_0x2d2e6c[_0x97e1('0x35')]]){logger[_0x97e1('0x2c')]('[%s][voiceCallReport][hangup]\x20reason:%s',_0x2d2e6c['uniqueid'],_0x2d2e6c[_0x97e1('0x9a')]);var _0x50dcb8=moment();this[_0x97e1('0x17')][_0x2d2e6c[_0x97e1('0x35')]][_0x97e1('0x9b')]=_0x50dcb8[_0x97e1('0x48')](_0x97e1('0x49'));this[_0x97e1('0x17')][_0x2d2e6c[_0x97e1('0x35')]][_0x97e1('0x5e')]=_0x50dcb8['diff'](this['channels'][_0x2d2e6c[_0x97e1('0x35')]][_0x97e1('0x47')],_0x97e1('0x5f'));if(this[_0x97e1('0x17')][_0x2d2e6c[_0x97e1('0x35')]][_0x97e1('0x69')]){this[_0x97e1('0x17')][_0x2d2e6c[_0x97e1('0x35')]][_0x97e1('0x9c')]=_0x50dcb8[_0x97e1('0x6c')](this[_0x97e1('0x17')][_0x2d2e6c['uniqueid']][_0x97e1('0x6a')],_0x97e1('0x5f'));this[_0x97e1('0x17')][_0x2d2e6c[_0x97e1('0x35')]][_0x97e1('0x6b')]=this[_0x97e1('0x17')][_0x2d2e6c[_0x97e1('0x35')]][_0x97e1('0x5e')]-this[_0x97e1('0x17')][_0x2d2e6c['uniqueid']]['billableseconds'];}if(_0x2d2e6c[_0x97e1('0x3b')]===_0x97e1('0x3c')){if(this[_0x97e1('0x18')][_0x2d2e6c[_0x97e1('0x3d')][_0x97e1('0x4e')]('-')[0x0]]){this[_0x97e1('0x18')][_0x2d2e6c[_0x97e1('0x3d')][_0x97e1('0x4e')]('-')[0x0]]=_[_0x97e1('0x9d')](this['agents'][_0x2d2e6c[_0x97e1('0x3d')][_0x97e1('0x4e')]('-')[0x0]],[_0x97e1('0x40')]);logger[_0x97e1('0x43')](_0x97e1('0x9e'),_0x2d2e6c[_0x97e1('0x35')],util['inspect']({'id':this[_0x97e1('0x18')][_0x2d2e6c[_0x97e1('0x3d')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0x97e1('0x18')][_0x2d2e6c[_0x97e1('0x3d')][_0x97e1('0x4e')]('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this[_0x97e1('0x34')](util[_0x97e1('0x48')]('user:%s',this[_0x97e1('0x18')][_0x2d2e6c[_0x97e1('0x3d')][_0x97e1('0x4e')]('-')[0x0]][_0x97e1('0x51')]),_0x97e1('0x9f'),{'id':this[_0x97e1('0x18')][_0x2d2e6c['channel'][_0x97e1('0x4e')]('-')[0x0]]['id'],'destaccountcode':this[_0x97e1('0x18')][_0x2d2e6c['channel'][_0x97e1('0x4e')]('-')[0x0]]['accountcode']});for(var _0x42aa2c=0x0;_0x42aa2c0x0?!![]:![];if(!_0x37f978){return this[_0x7e8f('0x16')](this[_0x7e8f('0x13')]['completeEvent']);}};VoiceQueueReport[_0x7e8f('0x34')]['syncQueueMember']=function(_0x24eec7){var _0x4c92ab=this['summary']['id'];if(this[_0x7e8f('0x13')][_0x7e8f('0x5d')][_0x4c92ab]&&this[_0x7e8f('0x13')]['queuestatus'][_0x4c92ab][_0x24eec7[_0x7e8f('0x5c')]]){this['summary'][_0x7e8f('0x5d')][_0x4c92ab][_0x24eec7[_0x7e8f('0x5c')]]['agents']['push'](_0x24eec7);}};VoiceQueueReport[_0x7e8f('0x34')][_0x7e8f('0x14')]=function(_0x498238){var _0x34f11d=this;try{if(this[_0x7e8f('0x55')](_0x498238)&&this['isNotNull'](_0x498238[_0x7e8f('0x49')])){logger[_0x7e8f('0x44')](_0x7e8f('0x69'),util[_0x7e8f('0x3b')](_0x498238,{'showHidden':![],'depth':null}));var _0xc6ea04=this['voiceQueues'][_0x498238[_0x7e8f('0x49')]];if(_0xc6ea04){logger[_0x7e8f('0x44')](_0x7e8f('0x6a'),_0xc6ea04['name']);this[_0x7e8f('0x13')][_0x7e8f('0x57')][_0xc6ea04[_0x7e8f('0x53')]]={'summaryEvent':_0x498238};this[_0x7e8f('0x13')]['statusRequests']+=0x1;return ami[_0x7e8f('0x5a')]({'action':'queuestatus','queue':_0xc6ea04['name']})[_0x7e8f('0x5b')](function(_0x574d2a){if(!_0x34f11d[_0x7e8f('0x13')][_0x7e8f('0x5d')][_0x498238[_0x7e8f('0x5c')]]){_0x34f11d[_0x7e8f('0x13')]['queuestatus'][_0x498238[_0x7e8f('0x5c')]]={};}_0x34f11d['summary'][_0x7e8f('0x5d')][_0x498238[_0x7e8f('0x5c')]][_0x574d2a[_0x7e8f('0x5c')]]={'queue':_0xc6ea04[_0x7e8f('0x53')],'agents':[]};})[_0x7e8f('0x58')](function(_0x5e1b00){throw _0x5e1b00;});}}}catch(_0xbc26f2){logger[_0x7e8f('0x3a')](_0x7e8f('0x5e'),util[_0x7e8f('0x3b')](_0xbc26f2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7e8f('0x34')][_0x7e8f('0x16')]=function(_0x567506){if(this[_0x7e8f('0x13')]['statusRequests']>0x0){this[_0x7e8f('0x13')][_0x7e8f('0x6b')]=_0x567506;return;}logger[_0x7e8f('0x44')](_0x7e8f('0x6c'),util['inspect'](_0x567506,{'showHidden':![],'depth':null}));this[_0x7e8f('0x13')]=initializeSummary();ami[_0x7e8f('0x42')]('custom:queuesummarycomplete',{});};VoiceQueueReport[_0x7e8f('0x34')][_0x7e8f('0x1b')]=function(_0x3e0e48){try{if(this[_0x7e8f('0x55')](_0x3e0e48)){logger[_0x7e8f('0x44')](_0x7e8f('0x6d'),_0x3e0e48[_0x7e8f('0x47')],util[_0x7e8f('0x3b')](_0x3e0e48,{'showHidden':![],'depth':null}));if(_[_0x7e8f('0x6e')](this[_0x7e8f('0xe')][_0x3e0e48[_0x7e8f('0x47')]])){this[_0x7e8f('0xe')][_0x3e0e48['uniqueid']]=[];}if(_[_0x7e8f('0x6e')](this[_0x7e8f('0x10')][_0x3e0e48['uniqueid']])){this[_0x7e8f('0x10')][_0x3e0e48['uniqueid']]={};}var _0x5dae1e=new QueueReport();_0x5dae1e[_0x7e8f('0x49')]=_0x3e0e48[_0x7e8f('0x49')];_0x5dae1e[_0x7e8f('0x65')]=this[_0x7e8f('0x11')][_0x5dae1e[_0x7e8f('0x49')]]&&this[_0x7e8f('0x11')][_0x5dae1e[_0x7e8f('0x49')]][_0x7e8f('0x65')]?this[_0x7e8f('0x11')][_0x5dae1e[_0x7e8f('0x49')]][_0x7e8f('0x65')]||'inbound':_0x7e8f('0x51');_0x5dae1e['queuecallerjoinAt']=moment()[_0x7e8f('0x4d')](_0x7e8f('0x6f'));_0x5dae1e['position']=_0x3e0e48[_0x7e8f('0x70')];_0x5dae1e[_0x7e8f('0x71')]=_0x3e0e48['count'];_0x5dae1e[_0x7e8f('0x47')]=_0x3e0e48[_0x7e8f('0x47')];_0x5dae1e[_0x7e8f('0x72')]=this[_0x7e8f('0x10')][_0x3e0e48[_0x7e8f('0x47')]]['routealias'];logger[_0x7e8f('0x73')](_0x7e8f('0x74'),_0x5dae1e['queue'],_0x5dae1e[_0x7e8f('0x65')]);Object['assign'](_0x5dae1e,_['pick'](_0x3e0e48,_[_0x7e8f('0x75')](_0x5dae1e)));this[_0x7e8f('0xe')][_0x3e0e48['uniqueid']]['push'](_0x5dae1e);this[_0x7e8f('0x10')][_0x3e0e48[_0x7e8f('0x47')]]=_0x5dae1e;this['emitVoiceQueueChannelSave'](_0x5dae1e,_0x7e8f('0x1a'));}}catch(_0x1023de){logger['error'](_0x7e8f('0x6d'),_0x3e0e48['uniqueid'],util[_0x7e8f('0x3b')](_0x1023de,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7e8f('0x34')]['syncQueueCallerAbandon']=function(_0x38451f){try{if(this['isNotNull'](_0x38451f)){logger[_0x7e8f('0x44')](_0x7e8f('0x76'),_0x38451f[_0x7e8f('0x47')],util['inspect'](_0x38451f,{'showHidden':![],'depth':null}));if(this[_0x7e8f('0xe')][_0x38451f[_0x7e8f('0x47')]]){var _0x4f1b21=_[_0x7e8f('0x77')](this['queueReports'][_0x38451f[_0x7e8f('0x47')]]);_0x4f1b21['queuecallercomplete']=![];_0x4f1b21[_0x7e8f('0x78')]=null;_0x4f1b21[_0x7e8f('0x79')]=_0x38451f[_0x7e8f('0x79')];_0x4f1b21['originalposition']=_0x38451f[_0x7e8f('0x7a')];_0x4f1b21[_0x7e8f('0x1c')]=!![];_0x4f1b21['queuecallerabandonAt']=moment()[_0x7e8f('0x4d')](_0x7e8f('0x6f'));_0x4f1b21[_0x7e8f('0x4b')]=_0x7e8f('0x7b');_0x4f1b21[_0x7e8f('0x7c')]=null;logger['info'](_0x7e8f('0x7d'),_0x4f1b21[_0x7e8f('0x49')],_0x4f1b21['type']);this[_0x7e8f('0x10')][_0x38451f[_0x7e8f('0x47')]]=_0x4f1b21;this[_0x7e8f('0x40')](_0x4f1b21,'queuecallerabandon');}}}catch(_0x2f8760){logger[_0x7e8f('0x3a')]('[%s][voiceQueueReport][queuecallerabandon]',_0x38451f['uniqueid'],util[_0x7e8f('0x3b')](_0x2f8760,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7e8f('0x34')][_0x7e8f('0x1e')]=function(_0x3e682e){try{if(this[_0x7e8f('0x55')](_0x3e682e)){logger[_0x7e8f('0x44')](_0x7e8f('0x7e'),_0x3e682e['uniqueid'],util[_0x7e8f('0x3b')](_0x3e682e,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x3e682e[_0x7e8f('0x47')]]){var _0x3c75a2=_['last'](this[_0x7e8f('0xe')][_0x3e682e[_0x7e8f('0x47')]]);_0x3c75a2[_0x7e8f('0x7f')]=moment()['format'](_0x7e8f('0x6f'));_0x3c75a2['connectedlinenum']=_0x3e682e['connectedlinenum'];_0x3c75a2[_0x7e8f('0x80')]=_0x3e682e[_0x7e8f('0x80')];logger[_0x7e8f('0x73')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x3c75a2[_0x7e8f('0x49')],_0x3c75a2[_0x7e8f('0x65')],_0x3e682e[_0x7e8f('0x81')],_0x3e682e['connectedlinename']);this[_0x7e8f('0x10')][_0x3e682e['uniqueid']]=_0x3c75a2;this[_0x7e8f('0x43')](_0x3c75a2,_0x7e8f('0x82'));}}}catch(_0x38b3fa){logger[_0x7e8f('0x3a')](_0x7e8f('0x7e'),_0x3e682e[_0x7e8f('0x47')],util[_0x7e8f('0x3b')](_0x38b3fa,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7e8f('0x34')][_0x7e8f('0x21')]=function(_0x23a977){try{if(this['isNotNull'](_0x23a977)){logger['debug'](_0x7e8f('0x83'),_0x23a977['uniqueid'],util[_0x7e8f('0x3b')](_0x23a977,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x23a977[_0x7e8f('0x47')]]){var _0x207d15=_[_0x7e8f('0x77')](this[_0x7e8f('0xe')][_0x23a977[_0x7e8f('0x47')]]);_0x207d15[_0x7e8f('0x84')]=!![];_0x207d15[_0x7e8f('0x4b')]='COMPLETEDBYAGENT';logger[_0x7e8f('0x73')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x207d15[_0x7e8f('0x49')],_0x207d15[_0x7e8f('0x65')]);}}}catch(_0x216e89){logger[_0x7e8f('0x3a')]('[%s][voiceQueueReport][agentconnect]',_0x23a977[_0x7e8f('0x47')],util[_0x7e8f('0x3b')](_0x216e89,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7e8f('0x34')][_0x7e8f('0x1f')]=function(_0x2c6976){try{if(this[_0x7e8f('0x55')](_0x2c6976)){logger[_0x7e8f('0x44')](_0x7e8f('0x85'),_0x2c6976[_0x7e8f('0x47')],util['inspect'](_0x2c6976,{'showHidden':![],'depth':null}));if(this[_0x7e8f('0xe')][_0x2c6976['uniqueid']]){var _0x54722a=_['last'](this[_0x7e8f('0xe')][_0x2c6976[_0x7e8f('0x47')]]);_0x54722a[_0x7e8f('0x1c')]=![];_0x54722a[_0x7e8f('0x86')]=null;_0x54722a[_0x7e8f('0x87')]=!![];_0x54722a['lastAssignedTo']=_0x2c6976[_0x7e8f('0x88')];_0x54722a[_0x7e8f('0x79')]=_0x2c6976['holdtime'];_0x54722a['queuecallercomplete']=!![];_0x54722a[_0x7e8f('0x33')]=![];_0x54722a[_0x7e8f('0x89')]=null;if(!_0x54722a[_0x7e8f('0x8a')]){if(_0x2c6976[_0x7e8f('0x8b')]=='transfer'){_0x54722a['queuecallerexitreason']=_0x7e8f('0x8c');logger[_0x7e8f('0x73')](_0x7e8f('0x8d'),_0x54722a[_0x7e8f('0x49')],_0x54722a[_0x7e8f('0x65')]);}else{if(_[_0x7e8f('0x8e')](_0x2c6976[_0x7e8f('0x8f')][_0x7e8f('0x90')](),'local/')){if(this[_0x7e8f('0xe')][_0x2c6976[_0x7e8f('0x91')]]){var _0x1272b4=_[_0x7e8f('0x77')](this[_0x7e8f('0xe')][_0x2c6976[_0x7e8f('0x91')]]);_0x1272b4[_0x7e8f('0x84')]=![];_0x1272b4['queuecallerexit']=!![];_0x1272b4[_0x7e8f('0x89')]=moment(_0x54722a[_0x7e8f('0x92')])[_0x7e8f('0x93')](_0x2c6976[_0x7e8f('0x79')],_0x7e8f('0x94'))[_0x7e8f('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x1272b4[_0x7e8f('0x4b')]='FORWARDTRANSFER';_0x1272b4[_0x7e8f('0x8a')]=!![];_0x1272b4['transfertype']='FORWARD';_0x1272b4[_0x7e8f('0x95')]=_0x2c6976[_0x7e8f('0x96')];_0x1272b4[_0x7e8f('0x97')]=_0x2c6976[_0x7e8f('0x47')];logger['info'](_0x7e8f('0x98'),_0x1272b4['queue'],_0x1272b4[_0x7e8f('0x65')]);var _0x321783=this[_0x7e8f('0xe')][_0x2c6976['linkedid']];this[_0x7e8f('0xe')][_0x2c6976[_0x7e8f('0x91')]]=this[_0x7e8f('0xe')][_0x2c6976[_0x7e8f('0x47')]];this[_0x7e8f('0xe')][_0x2c6976[_0x7e8f('0x47')]]=_0x321783;}}else{_0x54722a[_0x7e8f('0x4b')]=_0x7e8f('0x99')+_0x2c6976[_0x7e8f('0x8b')][_0x7e8f('0x9a')]();logger[_0x7e8f('0x73')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x54722a[_0x7e8f('0x49')],_0x54722a[_0x7e8f('0x65')],_0x54722a['queuecallerexitreason']);}}}this['channels'][_0x2c6976[_0x7e8f('0x47')]]=_0x54722a;}}}catch(_0x2e6b10){logger[_0x7e8f('0x3a')](_0x7e8f('0x85'),_0x2c6976[_0x7e8f('0x47')],util[_0x7e8f('0x3b')](_0x2e6b10,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7e8f('0x34')][_0x7e8f('0x9b')]=function(_0x1d41b0){try{if(this[_0x7e8f('0x55')](_0x1d41b0)){logger['debug'](_0x7e8f('0x9c'),_0x1d41b0[_0x7e8f('0x47')],util['inspect'](_0x1d41b0,{'showHidden':![],'depth':null}));this['addVariable'](_0x1d41b0['uniqueid'],_[_0x7e8f('0x75')](_0x1d41b0[_0x7e8f('0x9d')])[0x0],_0x1d41b0[_0x7e8f('0x9e')]);if(this[_0x7e8f('0xe')][_0x1d41b0[_0x7e8f('0x47')]]){var _0x30ebd2=_[_0x7e8f('0x77')](this[_0x7e8f('0xe')][_0x1d41b0[_0x7e8f('0x47')]]);if(_0x30ebd2){if(this[_0x7e8f('0x55')](_0x1d41b0[_0x7e8f('0x9d')])&&this[_0x7e8f('0x55')](_0x1d41b0[_0x7e8f('0x9d')][_0x7e8f('0x5d')])){switch(_0x1d41b0[_0x7e8f('0x9e')]){case _0x7e8f('0x9f'):_0x30ebd2[_0x7e8f('0x33')]=![];_0x30ebd2['queuecallerexitAt']=null;break;case _0x7e8f('0xa0'):_0x30ebd2[_0x7e8f('0xa1')]=_0x7e8f('0xa2');_0x30ebd2[_0x7e8f('0x33')]=!![];_0x30ebd2[_0x7e8f('0x89')]=moment()[_0x7e8f('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x30ebd2[_0x7e8f('0x7f')]=moment()['format'](_0x7e8f('0x6f'));logger[_0x7e8f('0x44')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x1d41b0[_0x7e8f('0x47')],util[_0x7e8f('0x3b')](_0x30ebd2,{'showHidden':![],'depth':null}));ami[_0x7e8f('0x42')](_0x7e8f('0xa3'),_0x30ebd2);break;default:_0x30ebd2['queuecallerexit']=!![];_0x30ebd2[_0x7e8f('0x89')]=moment()[_0x7e8f('0x4d')](_0x7e8f('0x6f'));_0x30ebd2[_0x7e8f('0x7f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x30ebd2[_0x7e8f('0x1c')]=![];_0x30ebd2[_0x7e8f('0x86')]=null;_0x30ebd2[_0x7e8f('0x4b')]=_0x1d41b0[_0x7e8f('0x9e')];this[_0x7e8f('0x10')][_0x1d41b0['uniqueid']]=_0x30ebd2;this['emitVoiceQueueChannelRemove'](_0x30ebd2,'varset');}else if(this[_0x7e8f('0x55')](_0x1d41b0['variable'])&&this[_0x7e8f('0x55')](_0x1d41b0[_0x7e8f('0x9d')][_0x7e8f('0xa4')])){if(!_0x30ebd2['queuecallerabandon']){_0x30ebd2[_0x7e8f('0x33')]=!![];_0x30ebd2[_0x7e8f('0x89')]=moment()[_0x7e8f('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x30ebd2['queuecallerexitreason']=_0x7e8f('0xa5');_0x30ebd2[_0x7e8f('0x7f')]=moment()[_0x7e8f('0x4d')](_0x7e8f('0x6f'));this['channels'][_0x1d41b0[_0x7e8f('0x47')]]=_0x30ebd2;}}logger[_0x7e8f('0x73')](_0x7e8f('0xa6'),_0x1d41b0['uniqueid'],_0x30ebd2[_0x7e8f('0x49')],_0x30ebd2[_0x7e8f('0x65')],_[_0x7e8f('0x75')](_0x1d41b0[_0x7e8f('0x9d')])[0x0],_0x1d41b0['value']);_0x30ebd2[_0x7e8f('0x3d')]=this['variables'][_0x1d41b0[_0x7e8f('0x47')]];}}}}catch(_0x39b2d7){logger[_0x7e8f('0x3a')](_0x7e8f('0x9c'),_0x1d41b0['uniqueid'],util['inspect'](_0x39b2d7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7e8f('0x34')][_0x7e8f('0xa7')]=function(_0x1bdb71,_0x1efeb8,_0x2ee8c0){var _0x14d74d=[_0x7e8f('0xa8'),_0x7e8f('0xa9'),_0x7e8f('0xaa'),_0x7e8f('0xab'),_0x7e8f('0xac'),_0x7e8f('0xad'),_0x7e8f('0xae'),_0x7e8f('0xaf'),_0x7e8f('0xb0'),'sipuri',_0x7e8f('0xb1'),_0x7e8f('0xb2'),_0x7e8f('0xb3'),_0x7e8f('0xb4'),_0x7e8f('0xb5'),_0x7e8f('0xb6'),_0x7e8f('0x88'),_0x7e8f('0xb7'),_0x7e8f('0xb8')];if(!_[_0x7e8f('0x38')](_0x1efeb8)&&!_[_0x7e8f('0xb9')](_0x14d74d,_0x1efeb8)){if(_[_0x7e8f('0x6e')](this[_0x7e8f('0x3d')][_0x1bdb71])){this[_0x7e8f('0x3d')][_0x1bdb71]={};}this['variables'][_0x1bdb71][_0x1efeb8]=_0x2ee8c0;}};VoiceQueueReport[_0x7e8f('0x34')][_0x7e8f('0xba')]=function(_0x2711ef,_0x1495d3,_0x765596){try{var _0x2d0540={};if(this[_0x7e8f('0xe')][_0x2711ef]){for(var _0x36117d=0x0;_0x36117d0x0?!![]:![];if(!_0x3897c8){return this['syncQueueSummaryComplete'](this[_0xfe16('0x14')][_0xfe16('0x69')]);}};VoiceQueueReport[_0xfe16('0xb')][_0xfe16('0x6a')]=function(_0x3e8f4c){var _0x5539e5=this['summary']['id'];if(this[_0xfe16('0x14')]['queuestatus'][_0x5539e5]&&this['summary'][_0xfe16('0x5c')][_0x5539e5][_0x3e8f4c[_0xfe16('0x5d')]]){this[_0xfe16('0x14')][_0xfe16('0x5c')][_0x5539e5][_0x3e8f4c[_0xfe16('0x5d')]][_0xfe16('0xf')]['push'](_0x3e8f4c);}};VoiceQueueReport[_0xfe16('0xb')][_0xfe16('0x17')]=function(_0x3e0fb4){var _0x104899=this;try{if(this[_0xfe16('0x57')](_0x3e0fb4)&&this['isNotNull'](_0x3e0fb4['queue'])){logger[_0xfe16('0x47')](_0xfe16('0x6b'),util[_0xfe16('0x3e')](_0x3e0fb4,{'showHidden':![],'depth':null}));var _0xf684d=this[_0xfe16('0x12')][_0x3e0fb4[_0xfe16('0x4d')]];if(_0xf684d){logger[_0xfe16('0x47')](_0xfe16('0x6c'),_0xf684d[_0xfe16('0x55')]);this[_0xfe16('0x14')]['queues'][_0xf684d[_0xfe16('0x55')]]={'summaryEvent':_0x3e0fb4};this[_0xfe16('0x14')][_0xfe16('0x68')]+=0x1;return ami[_0xfe16('0x59')]({'action':'queuestatus','queue':_0xf684d[_0xfe16('0x55')]})[_0xfe16('0x5b')](function(_0x2d54ba){if(!_0x104899[_0xfe16('0x14')]['queuestatus'][_0x3e0fb4['actionid']]){_0x104899[_0xfe16('0x14')]['queuestatus'][_0x3e0fb4[_0xfe16('0x5d')]]={};}_0x104899[_0xfe16('0x14')]['queuestatus'][_0x3e0fb4[_0xfe16('0x5d')]][_0x2d54ba[_0xfe16('0x5d')]]={'queue':_0xf684d[_0xfe16('0x55')],'agents':[]};})[_0xfe16('0x39')](function(_0x1014f2){throw _0x1014f2;});}}}catch(_0x7f1cfa){logger[_0xfe16('0x3c')](_0xfe16('0x5e'),util[_0xfe16('0x3e')](_0x7f1cfa,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xfe16('0x6d')]=function(_0x2b702e){if(this[_0xfe16('0x14')][_0xfe16('0x68')]>0x0){this[_0xfe16('0x14')]['completeEvent']=_0x2b702e;return;}logger[_0xfe16('0x47')](_0xfe16('0x6e'),util['inspect'](_0x2b702e,{'showHidden':![],'depth':null}));this[_0xfe16('0x14')]=initializeSummary();ami[_0xfe16('0x45')]('custom:queuesummarycomplete',{});};VoiceQueueReport[_0xfe16('0xb')][_0xfe16('0x1d')]=function(_0x2f57ad){try{if(this[_0xfe16('0x57')](_0x2f57ad)){logger[_0xfe16('0x47')](_0xfe16('0x6f'),_0x2f57ad['uniqueid'],util[_0xfe16('0x3e')](_0x2f57ad,{'showHidden':![],'depth':null}));if(_[_0xfe16('0x58')](this['queueReports'][_0x2f57ad[_0xfe16('0x4a')]])){this[_0xfe16('0xe')][_0x2f57ad[_0xfe16('0x4a')]]=[];}if(_[_0xfe16('0x58')](this[_0xfe16('0x10')][_0x2f57ad[_0xfe16('0x4a')]])){this[_0xfe16('0x10')][_0x2f57ad[_0xfe16('0x4a')]]={};}var _0x23fcab=new QueueReport();_0x23fcab['queue']=_0x2f57ad[_0xfe16('0x4d')];_0x23fcab['type']=this['voiceQueues'][_0x23fcab[_0xfe16('0x4d')]]&&this[_0xfe16('0x12')][_0x23fcab[_0xfe16('0x4d')]][_0xfe16('0x66')]?this[_0xfe16('0x12')][_0x23fcab[_0xfe16('0x4d')]][_0xfe16('0x66')]||_0xfe16('0x54'):_0xfe16('0x54');_0x23fcab[_0xfe16('0x70')]=moment()[_0xfe16('0x4b')](_0xfe16('0x71'));_0x23fcab[_0xfe16('0x72')]=_0x2f57ad[_0xfe16('0x72')];_0x23fcab['count']=_0x2f57ad['count'];_0x23fcab[_0xfe16('0x4a')]=_0x2f57ad[_0xfe16('0x4a')];_0x23fcab[_0xfe16('0x73')]=this['channels'][_0x2f57ad[_0xfe16('0x4a')]]['routealias'];logger[_0xfe16('0x74')](_0xfe16('0x75'),_0x23fcab[_0xfe16('0x4d')],_0x23fcab['type']);Object[_0xfe16('0x65')](_0x23fcab,_[_0xfe16('0x76')](_0x2f57ad,_['keys'](_0x23fcab)));this[_0xfe16('0xe')][_0x2f57ad[_0xfe16('0x4a')]][_0xfe16('0x77')](_0x23fcab);this[_0xfe16('0x10')][_0x2f57ad['uniqueid']]=_0x23fcab;this[_0xfe16('0x46')](_0x23fcab,'queuecallerjoin');}}catch(_0x1a8f7f){logger[_0xfe16('0x3c')](_0xfe16('0x6f'),_0x2f57ad['uniqueid'],util['inspect'](_0x1a8f7f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfe16('0xb')][_0xfe16('0x1f')]=function(_0x41b86f){try{if(this[_0xfe16('0x57')](_0x41b86f)){logger[_0xfe16('0x47')](_0xfe16('0x78'),_0x41b86f[_0xfe16('0x4a')],util['inspect'](_0x41b86f,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x41b86f['uniqueid']]){var _0x313d55=_['last'](this['queueReports'][_0x41b86f[_0xfe16('0x4a')]]);_0x313d55[_0xfe16('0x34')]=![];_0x313d55[_0xfe16('0x79')]=null;_0x313d55[_0xfe16('0x7a')]=_0x41b86f['holdtime'];_0x313d55['originalposition']=_0x41b86f['originalposition'];_0x313d55[_0xfe16('0x1e')]=!![];_0x313d55['queuecallerabandonAt']=moment()[_0xfe16('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');_0x313d55[_0xfe16('0x50')]='ABANDONED';_0x313d55[_0xfe16('0x7b')]=null;logger['info']('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x313d55['queue'],_0x313d55[_0xfe16('0x66')]);this['channels'][_0x41b86f[_0xfe16('0x4a')]]=_0x313d55;this[_0xfe16('0x43')](_0x313d55,'queuecallerabandon');}}}catch(_0x57ba02){logger[_0xfe16('0x3c')](_0xfe16('0x78'),_0x41b86f[_0xfe16('0x4a')],util[_0xfe16('0x3e')](_0x57ba02,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfe16('0xb')][_0xfe16('0x21')]=function(_0xbfeae1){try{if(this[_0xfe16('0x57')](_0xbfeae1)){logger[_0xfe16('0x47')](_0xfe16('0x7c'),_0xbfeae1[_0xfe16('0x4a')],util['inspect'](_0xbfeae1,{'showHidden':![],'depth':null}));if(this['queueReports'][_0xbfeae1[_0xfe16('0x4a')]]){var _0x93f626=_[_0xfe16('0x7d')](this[_0xfe16('0xe')][_0xbfeae1[_0xfe16('0x4a')]]);_0x93f626[_0xfe16('0x7e')]=moment()[_0xfe16('0x4b')](_0xfe16('0x71'));_0x93f626[_0xfe16('0x7f')]=_0xbfeae1[_0xfe16('0x7f')];_0x93f626[_0xfe16('0x80')]=_0xbfeae1['connectedlinename'];logger['info']('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x93f626['queue'],_0x93f626[_0xfe16('0x66')],_0xbfeae1[_0xfe16('0x7f')],_0xbfeae1['connectedlinename']);this[_0xfe16('0x10')][_0xbfeae1[_0xfe16('0x4a')]]=_0x93f626;this['emitVoiceQueueChannelSave'](_0x93f626,_0xfe16('0x20'));}}}catch(_0x791c30){logger[_0xfe16('0x3c')]('[%s][voiceQueueReport][queuecallerleave]',_0xbfeae1[_0xfe16('0x4a')],util['inspect'](_0x791c30,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfe16('0xb')][_0xfe16('0x24')]=function(_0x31b146){try{if(this[_0xfe16('0x57')](_0x31b146)){logger['debug'](_0xfe16('0x81'),_0x31b146[_0xfe16('0x4a')],util[_0xfe16('0x3e')](_0x31b146,{'showHidden':![],'depth':null}));if(this[_0xfe16('0xe')][_0x31b146[_0xfe16('0x4a')]]){var _0x4b7258=_[_0xfe16('0x7d')](this['queueReports'][_0x31b146[_0xfe16('0x4a')]]);_0x4b7258[_0xfe16('0x34')]=!![];_0x4b7258[_0xfe16('0x50')]=_0xfe16('0x82');logger[_0xfe16('0x74')](_0xfe16('0x83'),_0x4b7258['queue'],_0x4b7258[_0xfe16('0x66')]);}}}catch(_0x5e6063){logger[_0xfe16('0x3c')](_0xfe16('0x81'),_0x31b146['uniqueid'],util['inspect'](_0x5e6063,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xfe16('0x23')]=function(_0x183118){try{if(this[_0xfe16('0x57')](_0x183118)){logger['debug']('[%s][voiceQueueReport][agentcomplete]',_0x183118[_0xfe16('0x4a')],util[_0xfe16('0x3e')](_0x183118,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x183118[_0xfe16('0x4a')]]){var _0x5cf935=_[_0xfe16('0x7d')](this[_0xfe16('0xe')][_0x183118[_0xfe16('0x4a')]]);_0x5cf935[_0xfe16('0x1e')]=![];_0x5cf935[_0xfe16('0x84')]=null;_0x5cf935[_0xfe16('0x85')]=!![];_0x5cf935[_0xfe16('0x7b')]=_0x183118[_0xfe16('0x86')];_0x5cf935[_0xfe16('0x7a')]=_0x183118['holdtime'];_0x5cf935[_0xfe16('0x34')]=!![];_0x5cf935[_0xfe16('0x33')]=![];_0x5cf935[_0xfe16('0x87')]=null;if(!_0x5cf935[_0xfe16('0x88')]){if(_0x183118[_0xfe16('0x89')]==_0xfe16('0x88')){_0x5cf935[_0xfe16('0x50')]=_0xfe16('0x8a');logger[_0xfe16('0x74')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x5cf935[_0xfe16('0x4d')],_0x5cf935[_0xfe16('0x66')]);}else{if(_[_0xfe16('0x8b')](_0x183118['channel']['toLowerCase'](),'local/')){if(this['queueReports'][_0x183118[_0xfe16('0x8c')]]){var _0x14f3ef=_[_0xfe16('0x7d')](this[_0xfe16('0xe')][_0x183118[_0xfe16('0x8c')]]);_0x14f3ef[_0xfe16('0x34')]=![];_0x14f3ef[_0xfe16('0x33')]=!![];_0x14f3ef[_0xfe16('0x87')]=moment(_0x5cf935[_0xfe16('0x70')])['add'](_0x183118['holdtime'],_0xfe16('0x8d'))[_0xfe16('0x4b')](_0xfe16('0x71'));_0x14f3ef['queuecallerexitreason']='FORWARDTRANSFER';_0x14f3ef[_0xfe16('0x88')]=!![];_0x14f3ef[_0xfe16('0x8e')]=_0xfe16('0x8f');_0x14f3ef[_0xfe16('0x90')]=_0x183118[_0xfe16('0x91')];_0x14f3ef[_0xfe16('0x92')]=_0x183118[_0xfe16('0x4a')];logger['info'](_0xfe16('0x93'),_0x14f3ef[_0xfe16('0x4d')],_0x14f3ef['type']);var _0x551886=this[_0xfe16('0xe')][_0x183118['linkedid']];this['queueReports'][_0x183118[_0xfe16('0x8c')]]=this[_0xfe16('0xe')][_0x183118[_0xfe16('0x4a')]];this[_0xfe16('0xe')][_0x183118['uniqueid']]=_0x551886;}}else{_0x5cf935[_0xfe16('0x50')]=_0xfe16('0x94')+_0x183118['reason']['toUpperCase']();logger[_0xfe16('0x74')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x5cf935['queue'],_0x5cf935[_0xfe16('0x66')],_0x5cf935[_0xfe16('0x50')]);}}}this[_0xfe16('0x10')][_0x183118['uniqueid']]=_0x5cf935;}}}catch(_0x160828){logger[_0xfe16('0x3c')]('[%s][voiceQueueReport][agentcomplete]',_0x183118['uniqueid'],util[_0xfe16('0x3e')](_0x160828,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xfe16('0x95')]=function(_0x69d513){try{if(this[_0xfe16('0x57')](_0x69d513)){logger[_0xfe16('0x47')](_0xfe16('0x96'),_0x69d513[_0xfe16('0x4a')],util[_0xfe16('0x3e')](_0x69d513,{'showHidden':![],'depth':null}));this[_0xfe16('0x97')](_0x69d513[_0xfe16('0x4a')],_[_0xfe16('0x98')](_0x69d513[_0xfe16('0x99')])[0x0],_0x69d513['value']);if(this[_0xfe16('0xe')][_0x69d513[_0xfe16('0x4a')]]){var _0xecf7f3=_[_0xfe16('0x7d')](this[_0xfe16('0xe')][_0x69d513[_0xfe16('0x4a')]]);if(_0xecf7f3){if(this[_0xfe16('0x57')](_0x69d513['variable'])&&this[_0xfe16('0x57')](_0x69d513[_0xfe16('0x99')][_0xfe16('0x5c')])){switch(_0x69d513['value']){case _0xfe16('0x9a'):_0xecf7f3[_0xfe16('0x33')]=![];_0xecf7f3['queuecallerexitAt']=null;break;case'TIMEOUT':_0xecf7f3[_0xfe16('0x9b')]=_0xfe16('0x9c');_0xecf7f3[_0xfe16('0x33')]=!![];_0xecf7f3[_0xfe16('0x87')]=moment()[_0xfe16('0x4b')](_0xfe16('0x71'));_0xecf7f3['queuecallerleaveAt']=moment()[_0xfe16('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0xfe16('0x47')](_0xfe16('0x9d'),_0x69d513[_0xfe16('0x4a')],util[_0xfe16('0x3e')](_0xecf7f3,{'showHidden':![],'depth':null}));ami['emit'](_0xfe16('0x9e'),_0xecf7f3);break;default:_0xecf7f3[_0xfe16('0x33')]=!![];_0xecf7f3[_0xfe16('0x87')]=moment()[_0xfe16('0x4b')](_0xfe16('0x71'));_0xecf7f3[_0xfe16('0x7e')]=moment()[_0xfe16('0x4b')](_0xfe16('0x71'));}_0xecf7f3['queuecallerabandon']=![];_0xecf7f3[_0xfe16('0x84')]=null;_0xecf7f3['queuecallerexitreason']=_0x69d513[_0xfe16('0x9f')];this[_0xfe16('0x10')][_0x69d513[_0xfe16('0x4a')]]=_0xecf7f3;this[_0xfe16('0x43')](_0xecf7f3,_0xfe16('0xa0'));}else if(this[_0xfe16('0x57')](_0x69d513[_0xfe16('0x99')])&&this[_0xfe16('0x57')](_0x69d513[_0xfe16('0x99')]['queueposition'])){if(!_0xecf7f3[_0xfe16('0x1e')]){_0xecf7f3[_0xfe16('0x33')]=!![];_0xecf7f3[_0xfe16('0x87')]=moment()[_0xfe16('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');_0xecf7f3[_0xfe16('0x50')]='EXITWITHKEY';_0xecf7f3['queuecallerleaveAt']=moment()[_0xfe16('0x4b')](_0xfe16('0x71'));this[_0xfe16('0x10')][_0x69d513['uniqueid']]=_0xecf7f3;}}logger[_0xfe16('0x74')](_0xfe16('0xa1'),_0x69d513[_0xfe16('0x4a')],_0xecf7f3['queue'],_0xecf7f3['type'],_[_0xfe16('0x98')](_0x69d513[_0xfe16('0x99')])[0x0],_0x69d513['value']);_0xecf7f3[_0xfe16('0x15')]=this[_0xfe16('0x15')][_0x69d513[_0xfe16('0x4a')]];}}}}catch(_0x1a9f3f){logger[_0xfe16('0x3c')](_0xfe16('0x96'),_0x69d513[_0xfe16('0x4a')],util['inspect'](_0x1a9f3f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfe16('0xb')][_0xfe16('0x97')]=function(_0x3390f9,_0x5ae23f,_0x85ec90){var _0x441efb=['rtpaudioqos',_0xfe16('0xa2'),'rtpaudioqosjitter',_0xfe16('0xa3'),_0xfe16('0xa4'),_0xfe16('0xa5'),_0xfe16('0xa6'),_0xfe16('0xa7'),_0xfe16('0xa8'),'sipuri','bridgepeer',_0xfe16('0xa9'),'membercalls',_0xfe16('0xaa'),'memberinterface',_0xfe16('0xab'),_0xfe16('0x86'),_0xfe16('0xac'),'memberrealtime'];if(!_[_0xfe16('0x37')](_0x5ae23f)&&!_[_0xfe16('0xad')](_0x441efb,_0x5ae23f)){if(_[_0xfe16('0x58')](this[_0xfe16('0x15')][_0x3390f9])){this[_0xfe16('0x15')][_0x3390f9]={};}this[_0xfe16('0x15')][_0x3390f9][_0x5ae23f]=_0x85ec90;}};VoiceQueueReport[_0xfe16('0xb')]['handleHangup']=function(_0x5ed238,_0x56771b,_0x19e52a){try{var _0x520faa={};if(this[_0xfe16('0xe')][_0x5ed238]){for(var _0x13930a=0x0;_0x13930a=0x0?moment(_0x1c8373[_0x7afd('0x17')])[_0x7afd('0xc')](_0x1c8373[_0x7afd('0x16')],'seconds'):null,'data1':'outbound','data2':_0x1c8373['accountcode'],'data3':_0x1c8373[_0x7afd('0xf')],'data4':_0x1c8373[_0x7afd('0x18')]||null,'role':_0x7afd('0x11'),'internal':_0x1c8373[_0x7afd('0x12')]?_['toNumber'](_0x1c8373['accountcode']):undefined,'uniqueid':_0x1c8373[_0x7afd('0x13')]},'log':_0x7afd('0x14')});}; \ No newline at end of file +var _0x2dc6=['voiceDialReport','membername','starttime','endtime','outbound','dialstring','toNumber','moment','lodash','../client','voiceQueueReport','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','diff','queuecallerleaveAt','seconds','inbound','exten','queue','agent','accountcode','uniqueid'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x2dc6,0x7f));var _0x62dc=function(_0x5c5f72,_0x2c9c77){_0x5c5f72=_0x5c5f72-0x0;var _0x568bda=_0x2dc6[_0x5c5f72];return _0x568bda;};'use strict';var moment=require(_0x62dc('0x0'));var _=require(_0x62dc('0x1'));var util=require('util');var client=require(_0x62dc('0x2'));exports[_0x62dc('0x3')]=function(_0x29adc4){var _0x2d1cd6=_0x29adc4['queuecallercompleteAt']||_0x29adc4[_0x62dc('0x4')];return client[_0x62dc('0x5')](_0x62dc('0x6'),{'body':{'channel':_0x62dc('0x7'),'membername':_0x29adc4[_0x62dc('0x8')],'interface':_[_0x62dc('0x9')](_0x29adc4[_0x62dc('0xa')])?util[_0x62dc('0xb')](_0x62dc('0xc'),_0x29adc4[_0x62dc('0x8')]):_0x29adc4[_0x62dc('0xa')],'type':_0x62dc('0xd'),'enterAt':_0x29adc4['queuecallerleaveAt'],'exitAt':_0x2d1cd6,'duration':moment(_0x2d1cd6)[_0x62dc('0xe')](_0x29adc4[_0x62dc('0xf')],_0x62dc('0x10')),'data1':_0x62dc('0x11'),'data2':_0x29adc4['calleridnum'],'data3':_0x29adc4[_0x62dc('0x12')],'data4':null,'data5':_0x29adc4[_0x62dc('0x13')],'role':_0x62dc('0x14'),'internal':_0x29adc4[_0x62dc('0x15')]?_['toNumber'](_0x29adc4['accountcode']):undefined,'uniqueid':_0x29adc4[_0x62dc('0x16')]},'log':'CreateMemberReport'});};exports[_0x62dc('0x17')]=function(_0x30d54c){return client[_0x62dc('0x5')](_0x62dc('0x6'),{'body':{'channel':_0x62dc('0x7'),'membername':_0x30d54c[_0x62dc('0x18')],'interface':_0x30d54c[_0x62dc('0xa')],'type':_0x62dc('0xd'),'enterAt':_0x30d54c[_0x62dc('0x19')],'exitAt':_0x30d54c[_0x62dc('0x1a')],'duration':moment(_0x30d54c[_0x62dc('0x1a')])[_0x62dc('0xe')](_0x30d54c[_0x62dc('0x19')],_0x62dc('0x10'))>=0x0?moment(_0x30d54c[_0x62dc('0x1a')])[_0x62dc('0xe')](_0x30d54c[_0x62dc('0x19')],_0x62dc('0x10')):null,'data1':_0x62dc('0x1b'),'data2':_0x30d54c[_0x62dc('0x15')],'data3':_0x30d54c[_0x62dc('0x12')],'data4':_0x30d54c[_0x62dc('0x1c')]||null,'role':_0x62dc('0x14'),'internal':_0x30d54c[_0x62dc('0x15')]?_[_0x62dc('0x1d')](_0x30d54c['accountcode']):undefined,'uniqueid':_0x30d54c[_0x62dc('0x16')]},'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 5678f72..d4b1cd5 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 _0x66d8=['GetSettings','../client','getSettings','Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval'];(function(_0x26f750,_0x280ab7){var _0x3e194a=function(_0x4a6f05){while(--_0x4a6f05){_0x26f750['push'](_0x26f750['shift']());}};_0x3e194a(++_0x280ab7);}(_0x66d8,0x1c1));var _0x866d=function(_0x3e5d32,_0x19ce13){_0x3e5d32=_0x3e5d32-0x0;var _0x3e7822=_0x66d8[_0x3e5d32];return _0x3e7822;};'use strict';var client=require(_0x866d('0x0'));exports[_0x866d('0x1')]=function(){return client[_0x866d('0x2')](_0x866d('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x866d('0x4'),_0x866d('0x5')]},'log':_0x866d('0x6')});}; \ No newline at end of file +var _0xe495=['Request','ShowSetting','previewRecallmeReminderInterval','GetSettings','../client'];(function(_0x6b4f52,_0x4a17d1){var _0xa387e5=function(_0x2643b8){while(--_0x2643b8){_0x6b4f52['push'](_0x6b4f52['shift']());}};_0xa387e5(++_0x4a17d1);}(_0xe495,0xfe));var _0x5e49=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xe495[_0x3070dc];return _0x431489;};'use strict';var client=require(_0x5e49('0x0'));exports['getSettings']=function(){return client[_0x5e49('0x1')](_0x5e49('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x5e49('0x3')]},'log':_0x5e49('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index b07b5b8..fc3776e 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 _0x5335=['Request','GetTemplate','name','html','../client','getTemplates'];(function(_0x116786,_0x105528){var _0x5e5d3a=function(_0x30cafd){while(--_0x30cafd){_0x116786['push'](_0x116786['shift']());}};_0x5e5d3a(++_0x105528);}(_0x5335,0xa0));var _0x5533=function(_0x53b537,_0x55bf31){_0x53b537=_0x53b537-0x0;var _0x5af388=_0x5335[_0x53b537];return _0x5af388;};'use strict';var client=require(_0x5533('0x0'));exports[_0x5533('0x1')]=function(_0xc4f9fb){return function(_0x329c44){return client[_0x5533('0x2')](_0x5533('0x3'),{'options':{'raw':!![],'attributes':['id',_0x5533('0x4'),_0x5533('0x5')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0x1d3a=['../client','getTemplates','Request','GetTemplate','name','html'];(function(_0x4afaa5,_0x423280){var _0xdbfce2=function(_0x27ef1a){while(--_0x27ef1a){_0x4afaa5['push'](_0x4afaa5['shift']());}};_0xdbfce2(++_0x423280);}(_0x1d3a,0xa2));var _0xa1d3=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0x1d3a[_0x3fba9f];return _0x192cf1;};'use strict';var client=require(_0xa1d3('0x0'));exports[_0xa1d3('0x1')]=function(_0x304300){return function(_0x2c16e2){return client[_0xa1d3('0x2')](_0xa1d3('0x3'),{'options':{'raw':!![],'attributes':['id',_0xa1d3('0x4'),_0xa1d3('0x5')]},'log':_0xa1d3('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index c483a5b..ad501da 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 _0xbde8=['value','AnyConditions','Action','action','data1','data2','data3','data4','data5','data6','data7','GetTrigger','../client','getTriggers','Request','name','channel','status','Condition','AllConditions','field','operator'];(function(_0x1ffd43,_0x292134){var _0x2dc561=function(_0x36435d){while(--_0x36435d){_0x1ffd43['push'](_0x1ffd43['shift']());}};_0x2dc561(++_0x292134);}(_0xbde8,0xe8));var _0x8bde=function(_0x27dba4,_0x419253){_0x27dba4=_0x27dba4-0x0;var _0x35ec9d=_0xbde8[_0x27dba4];return _0x35ec9d;};'use strict';var client=require(_0x8bde('0x0'));exports[_0x8bde('0x1')]=function(_0x36f3e7){return function(_0x4bddaf){return client[_0x8bde('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x8bde('0x3'),_0x8bde('0x4'),_0x8bde('0x5')],'include':[{'model':_0x8bde('0x6'),'as':_0x8bde('0x7'),'attributes':['id',_0x8bde('0x8'),_0x8bde('0x9'),_0x8bde('0xa')]},{'model':_0x8bde('0x6'),'as':_0x8bde('0xb'),'attributes':['id',_0x8bde('0x8'),'operator',_0x8bde('0xa')]},{'model':_0x8bde('0xc'),'as':'Actions','attributes':['id',_0x8bde('0xd'),_0x8bde('0xe'),_0x8bde('0xf'),_0x8bde('0x10'),_0x8bde('0x11'),_0x8bde('0x12'),_0x8bde('0x13'),_0x8bde('0x14')]}]},'log':_0x8bde('0x15')});};}; \ No newline at end of file +var _0x6710=['data6','data7','GetTrigger','../client','getTriggers','status','Condition','AllConditions','field','operator','value','AnyConditions','Action','Actions','data2','data3','data4','data5'];(function(_0x5a709c,_0x1e6cfe){var _0x719025=function(_0x1ddba3){while(--_0x1ddba3){_0x5a709c['push'](_0x5a709c['shift']());}};_0x719025(++_0x1e6cfe);}(_0x6710,0x81));var _0x0671=function(_0x16bbb3,_0xe01e8f){_0x16bbb3=_0x16bbb3-0x0;var _0x296af5=_0x6710[_0x16bbb3];return _0x296af5;};'use strict';var client=require(_0x0671('0x0'));exports[_0x0671('0x1')]=function(_0x4c38a4){return function(_0x2ab1f8){return client['Request']('GetTrigger',{'options':{'raw':![],'attributes':['id','name','channel',_0x0671('0x2')],'include':[{'model':_0x0671('0x3'),'as':_0x0671('0x4'),'attributes':['id',_0x0671('0x5'),_0x0671('0x6'),_0x0671('0x7')]},{'model':'Condition','as':_0x0671('0x8'),'attributes':['id',_0x0671('0x5'),_0x0671('0x6'),_0x0671('0x7')]},{'model':_0x0671('0x9'),'as':_0x0671('0xa'),'attributes':['id','action','data1',_0x0671('0xb'),_0x0671('0xc'),_0x0671('0xd'),_0x0671('0xe'),_0x0671('0xf'),_0x0671('0x10')]}]},'log':_0x0671('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 908a5c4..cdb662b 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 _0x5cad=['../client','getTrunks','Request','GetTrunk','name','registry','defaultuser'];(function(_0x1a8af0,_0x2e4c80){var _0x40a2eb=function(_0x503755){while(--_0x503755){_0x1a8af0['push'](_0x1a8af0['shift']());}};_0x40a2eb(++_0x2e4c80);}(_0x5cad,0x8c));var _0xd5ca=function(_0x160cbc,_0x3025a6){_0x160cbc=_0x160cbc-0x0;var _0x4ac8c6=_0x5cad[_0x160cbc];return _0x4ac8c6;};'use strict';var client=require(_0xd5ca('0x0'));exports[_0xd5ca('0x1')]=function(_0x1ab40a){return function(_0x34dfc7){return client[_0xd5ca('0x2')](_0xd5ca('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xd5ca('0x4'),_0xd5ca('0x5'),_0xd5ca('0x6')]},'log':_0xd5ca('0x3')});};}; \ No newline at end of file +var _0x1793=['../client','getTrunks','GetTrunk','name','registry','defaultuser'];(function(_0x28e2cd,_0x153b42){var _0x11fd46=function(_0x50df13){while(--_0x50df13){_0x28e2cd['push'](_0x28e2cd['shift']());}};_0x11fd46(++_0x153b42);}(_0x1793,0x1ce));var _0x3179=function(_0x4512f2,_0x44be54){_0x4512f2=_0x4512f2-0x0;var _0x4b9a13=_0x1793[_0x4512f2];return _0x4b9a13;};'use strict';var client=require(_0x3179('0x0'));exports[_0x3179('0x1')]=function(_0x14f11d){return function(_0x44fb16){return client['Request'](_0x3179('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x3179('0x3'),_0x3179('0x4'),_0x3179('0x5')]},'log':_0x3179('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 140b61f..20f2bc6 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 _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xe706,0xa3));var _0x6e70=function(_0x10d34b,_0x4fef76){_0x10d34b=_0x10d34b-0x0;var _0x92b0bf=_0xe706[_0x10d34b];return _0x92b0bf;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file +var _0xedd9=['mobile','getTelephones','internal','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','interface','getAgent','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0x5edee8,_0x3fcca5){var _0x4ee39e=function(_0x56a9cb){while(--_0x56a9cb){_0x5edee8['push'](_0x5edee8['shift']());}};_0x4ee39e(++_0x3fcca5);}(_0xedd9,0xfc));var _0x9edd=function(_0x2526a3,_0x4db386){_0x2526a3=_0x2526a3-0x0;var _0x165c8d=_0xedd9[_0x2526a3];return _0x165c8d;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3')},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),_0x9edd('0xb'),'phone',_0x9edd('0xc'),'interface']},'log':_0x9edd('0x0')});};};exports[_0x9edd('0xd')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x9edd('0x4'),'accountcode',_0x9edd('0xe')]},'log':_0x9edd('0xd')});};};exports['savePause']=function(_0xbf9da6,_0x13dc4f,_0x5b6c00){return client[_0x9edd('0x1')](_0x9edd('0xf'),{'body':{'type':_0x13dc4f,'uniqueid':_0x5b6c00},'options':{'where':{'id':_0xbf9da6['id']}},'log':_0x9edd('0x10')});};exports[_0x9edd('0x11')]=function(_0x287ddd){return client[_0x9edd('0x1')](_0x9edd('0x12'),{'body':{},'options':{'where':{'id':_0x287ddd['id']}},'log':_0x9edd('0x10')});};exports['getAgent']=function(_0x176bfa){return client[_0x9edd('0x1')](_0x9edd('0x13'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3'),'id':_0x176bfa},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),'voicePause',_0x9edd('0x14')]},'log':_0x9edd('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index e7b9f92..6ae1971 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 _0x2556=['create','CreateVoiceAgentReport','update','Request','UpdateVoiceAgentReport'];(function(_0x7ed19a,_0x900bd1){var _0x31179b=function(_0x4cf93b){while(--_0x4cf93b){_0x7ed19a['push'](_0x7ed19a['shift']());}};_0x31179b(++_0x900bd1);}(_0x2556,0x118));var _0x6255=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x2556[_0x29d94e];return _0x106237;};'use strict';var client=require('../client');exports[_0x6255('0x0')]=function(_0x56b9c1){return client['Request'](_0x6255('0x1'),{'body':_0x56b9c1,'log':_0x6255('0x1')});};exports[_0x6255('0x2')]=function(_0x5a0929,_0x4a54a2,_0x4f2462){return client[_0x6255('0x3')](_0x6255('0x4'),{'body':_0x5a0929,'options':{'where':{'uniqueid':_0x4a54a2,'interface':_0x4f2462,'agentcomplete':!![]}},'log':_0x6255('0x4')});}; \ No newline at end of file +var _0x9aa8=['Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','create'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x9aa8,0xdb));var _0x89aa=function(_0x5fcec4,_0x1f4113){_0x5fcec4=_0x5fcec4-0x0;var _0x144816=_0x9aa8[_0x5fcec4];return _0x144816;};'use strict';var client=require('../client');exports[_0x89aa('0x0')]=function(_0x31bdc7){return client[_0x89aa('0x1')](_0x89aa('0x2'),{'body':_0x31bdc7,'log':_0x89aa('0x2')});};exports[_0x89aa('0x3')]=function(_0x22e1e9,_0x2ce9af,_0x1f3c5d){return client[_0x89aa('0x1')]('UpdateVoiceAgentReport',{'body':_0x22e1e9,'options':{'where':{'uniqueid':_0x2ce9af,'interface':_0x1f3c5d,'agentcomplete':!![]}},'log':_0x89aa('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index fa20abe..3f53a8c 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 _0x1d77=['CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','Request','outbound','startOf','day','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','GetVoiceCallReports','moment','util','lodash','create'];(function(_0x335191,_0x42f088){var _0x3bf664=function(_0x5e67f8){while(--_0x5e67f8){_0x335191['push'](_0x335191['shift']());}};_0x3bf664(++_0x42f088);}(_0x1d77,0x65));var _0x71d7=function(_0x810e4d,_0x909ef4){_0x810e4d=_0x810e4d-0x0;var _0x13f01c=_0x1d77[_0x810e4d];return _0x13f01c;};'use strict';var moment=require(_0x71d7('0x0'));var util=require(_0x71d7('0x1'));var _=require(_0x71d7('0x2'));var client=require('../client');exports[_0x71d7('0x3')]=function(_0x5d3d56){return client['Request'](_0x71d7('0x4'),{'body':_[_0x71d7('0x5')](_0x5d3d56,{'source':_0x5d3d56[_0x71d7('0x6')],'destinationcontext':_0x5d3d56[_0x71d7('0x7')],'callerid':_0x5d3d56[_0x71d7('0x8')],'amaflags':_0x71d7('0x9')}),'log':_0x71d7('0x4')});};exports[_0x71d7('0xa')]=function(){return function(){return client[_0x71d7('0xb')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x71d7('0xc')],'createdAt':{'$between':[moment()[_0x71d7('0xd')](_0x71d7('0xe'))['format'](_0x71d7('0xf')),moment()[_0x71d7('0x10')](_0x71d7('0xe'))['format'](_0x71d7('0xf'))]}},'attributes':[_0x71d7('0x11'),_0x71d7('0x12'),_0x71d7('0x13'),'billableseconds']},'log':_0x71d7('0x14')});};}; \ No newline at end of file +var _0xd2c0=['outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','billableseconds','GetVoiceCallReports','moment','util','lodash','create','CreateVoiceCallReport','context','getVoiceCallReports','Request','GetVoiceCallReport'];(function(_0x1e0e3c,_0x524bd7){var _0x6ec019=function(_0x38fc42){while(--_0x38fc42){_0x1e0e3c['push'](_0x1e0e3c['shift']());}};_0x6ec019(++_0x524bd7);}(_0xd2c0,0x118));var _0x0d2c=function(_0x1474f5,_0x343679){_0x1474f5=_0x1474f5-0x0;var _0x3c901f=_0xd2c0[_0x1474f5];return _0x3c901f;};'use strict';var moment=require(_0x0d2c('0x0'));var util=require(_0x0d2c('0x1'));var _=require(_0x0d2c('0x2'));var client=require('../client');exports[_0x0d2c('0x3')]=function(_0x276318){return client['Request'](_0x0d2c('0x4'),{'body':_['merge'](_0x276318,{'source':_0x276318['calleridnum'],'destinationcontext':_0x276318[_0x0d2c('0x5')],'callerid':_0x276318['callerid'],'amaflags':'DOCUMENTATION'}),'log':_0x0d2c('0x4')});};exports[_0x0d2c('0x6')]=function(){return function(){return client[_0x0d2c('0x7')](_0x0d2c('0x8'),{'options':{'where':{'type':[_0x0d2c('0x9')],'createdAt':{'$between':[moment()[_0x0d2c('0xa')](_0x0d2c('0xb'))[_0x0d2c('0xc')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf']('day')[_0x0d2c('0xc')](_0x0d2c('0xd'))]}},'attributes':[_0x0d2c('0xe'),'disposition','duration',_0x0d2c('0xf')]},'log':_0x0d2c('0x10')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 7317533..5793271 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 _0x46ab=['CreateVoiceDialReport','../client','create','Request'];(function(_0x3cd934,_0xb38c98){var _0x2226e8=function(_0x3e88d6){while(--_0x3e88d6){_0x3cd934['push'](_0x3cd934['shift']());}};_0x2226e8(++_0xb38c98);}(_0x46ab,0x17d));var _0xb46a=function(_0x5c5cee,_0x87368c){_0x5c5cee=_0x5c5cee-0x0;var _0x1102ae=_0x46ab[_0x5c5cee];return _0x1102ae;};'use strict';var client=require(_0xb46a('0x0'));exports[_0xb46a('0x1')]=function(_0x43f5dc){return client[_0xb46a('0x2')](_0xb46a('0x3'),{'body':_0x43f5dc,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0x6098=['CreateVoiceDialReport','Request'];(function(_0x16e385,_0x4e8db2){var _0x78c03e=function(_0x2db5ad){while(--_0x2db5ad){_0x16e385['push'](_0x16e385['shift']());}};_0x78c03e(++_0x4e8db2);}(_0x6098,0x17d));var _0x8609=function(_0x45bd84,_0x4a61bb){_0x45bd84=_0x45bd84-0x0;var _0x551b62=_0x6098[_0x45bd84];return _0x551b62;};'use strict';var client=require('../client');exports['create']=function(_0x97d941){return client[_0x8609('0x0')](_0x8609('0x1'),{'body':_0x97d941,'log':_0x8609('0x1')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 7c122b1..2fd519d 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 _0x1b73=['exten','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0x4d7379,_0x4b4e63){var _0x46d7cf=function(_0x53f5f0){while(--_0x53f5f0){_0x4d7379['push'](_0x4d7379['shift']());}};_0x46d7cf(++_0x4b4e63);}(_0x1b73,0x1d5));var _0x31b7=function(_0x390466,_0x5e7d23){_0x390466=_0x390466-0x0;var _0x3464f4=_0x1b73[_0x390466];return _0x3464f4;};'use strict';var client=require('../client');exports[_0x31b7('0x0')]=function(){return function(){return client[_0x31b7('0x1')](_0x31b7('0x2'),{'options':{'raw':!![],'attributes':['id',_0x31b7('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x31b7('0x0')});};}; \ No newline at end of file +var _0x8868=['exten','recordingFormat','../client','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0x3ef09b,_0x5fa6d8){var _0x446c88=function(_0x3c5548){while(--_0x3c5548){_0x3ef09b['push'](_0x3ef09b['shift']());}};_0x446c88(++_0x5fa6d8);}(_0x8868,0x1ca));var _0x8886=function(_0x59b207,_0x4a2c19){_0x59b207=_0x59b207-0x0;var _0x435f2a=_0x8868[_0x59b207];return _0x435f2a;};'use strict';var client=require(_0x8886('0x0'));exports[_0x8886('0x1')]=function(){return function(){return client[_0x8886('0x2')](_0x8886('0x3'),{'options':{'raw':!![],'attributes':['id',_0x8886('0x4'),_0x8886('0x5')],'where':{'VoiceExtensionId':null}},'log':_0x8886('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 949d4c0..c385770 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 _0x8498=['dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','active','Pause','TrunkBackup','callerid','Interval','Intervals','getVoiceQueues','Request','GetVoiceQueue','name','acw','autopause','type','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry'];(function(_0x4fb797,_0x200ee6){var _0x34e096=function(_0x2c0f40){while(--_0x2c0f40){_0x4fb797['push'](_0x4fb797['shift']());}};_0x34e096(++_0x200ee6);}(_0x8498,0x1a7));var _0x8849=function(_0x192645,_0xf0eae4){_0x192645=_0x192645-0x0;var _0x50a630=_0x8498[_0x192645];return _0x50a630;};'use strict';var client=require('../client');exports[_0x8849('0x0')]=function(){return function(){return client[_0x8849('0x1')](_0x8849('0x2'),{'options':{'raw':![],'attributes':['id',_0x8849('0x3'),_0x8849('0x4'),'acwTimeout',_0x8849('0x5'),'monitor_format',_0x8849('0x6'),'dialActive','dialMethod',_0x8849('0x7'),_0x8849('0x8'),_0x8849('0x9'),_0x8849('0xa'),_0x8849('0xb'),_0x8849('0xc'),'dialOriginateCallerIdName',_0x8849('0xd'),'dialOriginateTimeout',_0x8849('0xe'),_0x8849('0xf'),'dialQueueProject',_0x8849('0x10'),_0x8849('0x11'),_0x8849('0x12'),_0x8849('0x13'),_0x8849('0x14'),_0x8849('0x15'),'dialGlobalMaxRetry','dialTimezone',_0x8849('0x16'),_0x8849('0x17'),_0x8849('0x18'),_0x8849('0x19'),'dialAMDInitialSilence',_0x8849('0x1a'),_0x8849('0x1b'),_0x8849('0x1c'),_0x8849('0x1d'),'dialAMDBetweenWordsSilence',_0x8849('0x1e'),_0x8849('0x1f'),_0x8849('0x20'),'timeout',_0x8849('0x21'),_0x8849('0x22'),_0x8849('0x23'),'dialAgiAfterHangupAgent','dialAgiAfterHangupClient',_0x8849('0x24'),'monitor_format',_0x8849('0x25'),_0x8849('0x26'),'dialCutDigit',_0x8849('0x27'),'dialNoSuchNumberRetryFrequency',_0x8849('0x28'),_0x8849('0x29'),'dialAbandonedMaxRetry',_0x8849('0x2a'),'dialMachineMaxRetry',_0x8849('0x2b'),'dialAgentRejectMaxRetry',_0x8849('0x2c'),'mandatoryDisposition','dialPredictiveIntervalMaxThreshold',_0x8849('0x2d'),_0x8849('0x2e'),_0x8849('0x2f')],'include':[{'model':_0x8849('0x30'),'as':_0x8849('0x30'),'attributes':['id','name','callerid',_0x8849('0x31')]},{'model':_0x8849('0x32'),'as':'mandatoryDispositionPause','attributes':['id','name']},{'model':'Trunk','as':_0x8849('0x33'),'attributes':['id','name',_0x8849('0x34'),_0x8849('0x31')]},{'model':_0x8849('0x35'),'as':'Interval','attributes':['id',_0x8849('0x3')],'include':[{'model':_0x8849('0x35'),'as':_0x8849('0x36'),'attributes':['id',_0x8849('0x3'),'interval']}]}]},'log':_0x8849('0x0')});};}; \ No newline at end of file +var _0xd9c0=['dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupClient','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','getVoiceQueues','../client','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','dialActive','dialMethod','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive'];(function(_0x279ce4,_0x13a3c8){var _0x3e8bcd=function(_0x122463){while(--_0x122463){_0x279ce4['push'](_0x279ce4['shift']());}};_0x3e8bcd(++_0x13a3c8);}(_0xd9c0,0x1c7));var _0x0d9c=function(_0x26bdc4,_0x2ddff4){_0x26bdc4=_0x26bdc4-0x0;var _0xd85a81=_0xd9c0[_0x26bdc4];return _0xd85a81;};'use strict';var client=require(_0x0d9c('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0x0d9c('0x1')](_0x0d9c('0x2'),{'options':{'raw':![],'attributes':['id',_0x0d9c('0x3'),_0x0d9c('0x4'),_0x0d9c('0x5'),_0x0d9c('0x6'),_0x0d9c('0x7'),'type',_0x0d9c('0x8'),_0x0d9c('0x9'),'dialLimitChannel',_0x0d9c('0xa'),'dialPowerLevel',_0x0d9c('0xb'),_0x0d9c('0xc'),_0x0d9c('0xd'),_0x0d9c('0xe'),'dialOriginateCallerIdNumber',_0x0d9c('0xf'),'dialQueueOptions','dialQueueTimeout','dialQueueProject',_0x0d9c('0x10'),_0x0d9c('0x11'),'dialBusyMaxRetry','dialBusyRetryFrequency',_0x0d9c('0x12'),'dialNoAnswerRetryFrequency',_0x0d9c('0x13'),_0x0d9c('0x14'),_0x0d9c('0x15'),_0x0d9c('0x16'),_0x0d9c('0x17'),_0x0d9c('0x18'),'dialAMDInitialSilence',_0x0d9c('0x19'),'dialAMDAfterGreetingSilence',_0x0d9c('0x1a'),'dialAMDMinWordLength',_0x0d9c('0x1b'),_0x0d9c('0x1c'),_0x0d9c('0x1d'),'dialAMDMaximumWordLength',_0x0d9c('0x1e'),_0x0d9c('0x1f'),_0x0d9c('0x20'),'dialOrderByScheduledAt','dialAgiAfterHangupAgent',_0x0d9c('0x21'),'dialQueueProject2',_0x0d9c('0x7'),_0x0d9c('0x22'),_0x0d9c('0x23'),_0x0d9c('0x24'),_0x0d9c('0x25'),_0x0d9c('0x26'),'dialDropMaxRetry',_0x0d9c('0x27'),_0x0d9c('0x28'),'dialAbandonedRetryFrequency',_0x0d9c('0x29'),_0x0d9c('0x2a'),_0x0d9c('0x2b'),_0x0d9c('0x2c'),_0x0d9c('0x2d'),_0x0d9c('0x2e'),_0x0d9c('0x2f'),_0x0d9c('0x30'),_0x0d9c('0x31')],'include':[{'model':_0x0d9c('0x32'),'as':_0x0d9c('0x32'),'attributes':['id',_0x0d9c('0x3'),_0x0d9c('0x33'),_0x0d9c('0x34')]},{'model':_0x0d9c('0x35'),'as':_0x0d9c('0x36'),'attributes':['id',_0x0d9c('0x3')]},{'model':_0x0d9c('0x32'),'as':_0x0d9c('0x37'),'attributes':['id',_0x0d9c('0x3'),_0x0d9c('0x33'),_0x0d9c('0x34')]},{'model':'Interval','as':_0x0d9c('0x38'),'attributes':['id','name'],'include':[{'model':_0x0d9c('0x38'),'as':_0x0d9c('0x39'),'attributes':['id',_0x0d9c('0x3'),_0x0d9c('0x3a')]}]}]},'log':_0x0d9c('0x3b')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 7716a2f..815b0bf 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(_0x31ee0f,_0x3970c7){var _0x49bc3f=function(_0x4f9baa){while(--_0x4f9baa){_0x31ee0f['push'](_0x31ee0f['shift']());}};_0x49bc3f(++_0x3970c7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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(_0xdd7c81,_0x49e9b1){var _0xaf68dc=function(_0xfbdf07){while(--_0xfbdf07){_0xdd7c81['push'](_0xdd7c81['shift']());}};_0xaf68dc(++_0x49e9b1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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 1b2e19a..ca9d3f2 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 _0xbd78=['../client','getVoiceQueueRtPauses','Request'];(function(_0x41bfa8,_0x2222f0){var _0x5a689e=function(_0x9c9b27){while(--_0x9c9b27){_0x41bfa8['push'](_0x41bfa8['shift']());}};_0x5a689e(++_0x2222f0);}(_0xbd78,0x1d1));var _0x8bd7=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbd78[_0x5ddb1c];return _0x354adc;};'use strict';var client=require(_0x8bd7('0x0'));exports[_0x8bd7('0x1')]=function(_0x7a9187){return function(){return client[_0x8bd7('0x2')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x7a9187,'paused':!![]},'raw':!![]},'log':_0x8bd7('0x1')});};}; \ No newline at end of file +var _0x4682=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4682,0x16d));var _0x2468=function(_0x10d34b,_0x4fef76){_0x10d34b=_0x10d34b-0x0;var _0x92b0bf=_0x4682[_0x10d34b];return _0x92b0bf;};'use strict';var client=require(_0x2468('0x0'));exports[_0x2468('0x1')]=function(_0x346962){return function(){return client[_0x2468('0x2')](_0x2468('0x3'),{'options':{'where':{'VoiceQueueId':_0x346962,'paused':!![]},'raw':!![]},'log':_0x2468('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index b378c00..4c73102 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(_0x23e06f,_0x235d89){var _0x50bc4c=function(_0x4dc62b){while(--_0x4dc62b){_0x23e06f['push'](_0x23e06f['shift']());}};_0x50bc4c(++_0x235d89);}(_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 _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x341ff7,_0x558689){var _0x1f5fb9=function(_0x5c6dc9){while(--_0x5c6dc9){_0x341ff7['push'](_0x341ff7['shift']());}};_0x1f5fb9(++_0x558689);}(_0x7a54,0x106));var _0x47a5=function(_0x3c346a,_0x2949dc){_0x3c346a=_0x3c346a-0x0;var _0x829a92=_0x7a54[_0x3c346a];return _0x829a92;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 47ec100..37b903c 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 _0x7f81=['attendedTransfer','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfereraccountcode','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','extension','blind'];(function(_0x23f01f,_0x4c51b7){var _0x30b2c1=function(_0x3880dc){while(--_0x3880dc){_0x23f01f['push'](_0x23f01f['shift']());}};_0x30b2c1(++_0x4c51b7);}(_0x7f81,0x89));var _0x17f8=function(_0x3e314c,_0x5bc77c){_0x3e314c=_0x3e314c-0x0;var _0x58dc4f=_0x7f81[_0x3e314c];return _0x58dc4f;};'use strict';var client=require(_0x17f8('0x0'));exports[_0x17f8('0x1')]={};exports[_0x17f8('0x2')]=function(_0x41e1ce){return client[_0x17f8('0x3')](_0x17f8('0x4'),{'body':{'result':_0x41e1ce[_0x17f8('0x5')],'transfererchannel':_0x41e1ce[_0x17f8('0x6')],'transferercalleridnum':_0x41e1ce[_0x17f8('0x7')],'transferercalleridname':_0x41e1ce[_0x17f8('0x8')],'transfererconnectedlinenum':_0x41e1ce['transfererconnectedlinenum'],'transfererconnectedlinename':_0x41e1ce['transfererconnectedlinename'],'transfereraccountcode':_0x41e1ce[_0x17f8('0x9')],'transferercontext':_0x41e1ce['transferercontext'],'transfererexten':_0x41e1ce[_0x17f8('0xa')],'transfererlinkedid':_0x41e1ce[_0x17f8('0xb')],'transfereechannel':_0x41e1ce[_0x17f8('0xc')],'transfereecalleridnum':_0x41e1ce[_0x17f8('0xd')],'transfereecalleridname':_0x41e1ce[_0x17f8('0xe')],'transfereeconnectedlinenum':_0x41e1ce['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x41e1ce[_0x17f8('0xf')],'transfereeaccountcode':_0x41e1ce[_0x17f8('0x10')],'transfereecontext':_0x41e1ce[_0x17f8('0x11')],'transfereeexten':_0x41e1ce[_0x17f8('0x12')],'transfereelinkedid':_0x41e1ce[_0x17f8('0x13')],'isexternal':_0x41e1ce[_0x17f8('0x14')],'context':_0x41e1ce['context'],'extension':_0x41e1ce[_0x17f8('0x15')],'type':_0x17f8('0x16')},'log':_0x17f8('0x4')});};exports[_0x17f8('0x17')]=function(_0x136a9d){return client[_0x17f8('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x136a9d[_0x17f8('0x5')],'transfererchannel':_0x136a9d[_0x17f8('0x18')],'transferercalleridnum':_0x136a9d['origtransferercalleridnum'],'transferercalleridname':_0x136a9d[_0x17f8('0x19')],'transfererconnectedlinenum':_0x136a9d['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x136a9d[_0x17f8('0x1a')],'transfereraccountcode':_0x136a9d[_0x17f8('0x1b')],'transferercontext':_0x136a9d[_0x17f8('0x1c')],'transfererexten':_0x136a9d[_0x17f8('0x1d')],'transfererlinkedid':_0x136a9d[_0x17f8('0x1e')],'transfereechannel':_0x136a9d['transfertargetchannel'],'transfereecalleridnum':_0x136a9d[_0x17f8('0x1f')],'transfereecalleridname':_0x136a9d['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x136a9d[_0x17f8('0x20')],'transfereeconnectedlinename':_0x136a9d[_0x17f8('0x21')],'transfereeaccountcode':_0x136a9d[_0x17f8('0x22')],'transfereecontext':_0x136a9d[_0x17f8('0x23')],'transfereeexten':_0x136a9d[_0x17f8('0x24')],'transfereelinkedid':_0x136a9d[_0x17f8('0x25')],'isexternal':_0x136a9d[_0x17f8('0x14')],'context':_0x136a9d['origtransferercontext'],'extension':_0x136a9d[_0x17f8('0x26')],'type':_0x17f8('0x27')},'log':_0x17f8('0x4')});}; \ No newline at end of file +var _0x5068=['secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererexten','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','extension','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode'];(function(_0x1c69b4,_0x306679){var _0x35bb79=function(_0x541c93){while(--_0x541c93){_0x1c69b4['push'](_0x1c69b4['shift']());}};_0x35bb79(++_0x306679);}(_0x5068,0x9b));var _0x8506=function(_0x40f23b,_0x485132){_0x40f23b=_0x40f23b-0x0;var _0x7b4cad=_0x5068[_0x40f23b];return _0x7b4cad;};'use strict';var client=require(_0x8506('0x0'));exports[_0x8506('0x1')]={};exports[_0x8506('0x2')]=function(_0x4bb276){return client[_0x8506('0x3')](_0x8506('0x4'),{'body':{'result':_0x4bb276[_0x8506('0x5')],'transfererchannel':_0x4bb276['transfererchannel'],'transferercalleridnum':_0x4bb276['transferercalleridnum'],'transferercalleridname':_0x4bb276[_0x8506('0x6')],'transfererconnectedlinenum':_0x4bb276[_0x8506('0x7')],'transfererconnectedlinename':_0x4bb276['transfererconnectedlinename'],'transfereraccountcode':_0x4bb276[_0x8506('0x8')],'transferercontext':_0x4bb276[_0x8506('0x9')],'transfererexten':_0x4bb276[_0x8506('0xa')],'transfererlinkedid':_0x4bb276['transfererlinkedid'],'transfereechannel':_0x4bb276[_0x8506('0xb')],'transfereecalleridnum':_0x4bb276[_0x8506('0xc')],'transfereecalleridname':_0x4bb276[_0x8506('0xd')],'transfereeconnectedlinenum':_0x4bb276['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x4bb276[_0x8506('0xe')],'transfereeaccountcode':_0x4bb276[_0x8506('0xf')],'transfereecontext':_0x4bb276[_0x8506('0x10')],'transfereeexten':_0x4bb276[_0x8506('0x11')],'transfereelinkedid':_0x4bb276[_0x8506('0x12')],'isexternal':_0x4bb276[_0x8506('0x13')],'context':_0x4bb276['context'],'extension':_0x4bb276[_0x8506('0x14')],'type':'blind'},'log':_0x8506('0x4')});};exports['attendedTransfer']=function(_0x1a3526){return client[_0x8506('0x3')](_0x8506('0x4'),{'body':{'result':_0x1a3526['result'],'transfererchannel':_0x1a3526[_0x8506('0x15')],'transferercalleridnum':_0x1a3526['origtransferercalleridnum'],'transferercalleridname':_0x1a3526[_0x8506('0x16')],'transfererconnectedlinenum':_0x1a3526['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x1a3526[_0x8506('0x17')],'transfereraccountcode':_0x1a3526[_0x8506('0x18')],'transferercontext':_0x1a3526['secondtransferercontext'],'transfererexten':_0x1a3526[_0x8506('0x19')],'transfererlinkedid':_0x1a3526[_0x8506('0x1a')],'transfereechannel':_0x1a3526[_0x8506('0x1b')],'transfereecalleridnum':_0x1a3526[_0x8506('0x1c')],'transfereecalleridname':_0x1a3526['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x1a3526[_0x8506('0x1d')],'transfereeconnectedlinename':_0x1a3526[_0x8506('0x1e')],'transfereeaccountcode':_0x1a3526['transfertargetaccountcode'],'transfereecontext':_0x1a3526['transfertargetcontext'],'transfereeexten':_0x1a3526[_0x8506('0x1f')],'transfereelinkedid':_0x1a3526[_0x8506('0x20')],'isexternal':_0x1a3526[_0x8506('0x13')],'context':_0x1a3526[_0x8506('0x21')],'extension':_0x1a3526[_0x8506('0x22')],'type':_0x8506('0x23')},'log':_0x8506('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 1d27994..274e07f 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(_0x27c0a4,_0x58ed13){var _0x1f7bd2=function(_0x27d5cf){while(--_0x27d5cf){_0x27c0a4['push'](_0x27c0a4['shift']());}};_0x1f7bd2(++_0x58ed13);}(_0xb10b,0x12a));var _0xbb10=function(_0x49c341,_0x5b9570){_0x49c341=_0x49c341-0x0;var _0x1c106d=_0xb10b[_0x49c341];return _0x1c106d;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file +var _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_0x1fbdd3,_0x5aef1c){var _0x5bdb44=function(_0x5a103f){while(--_0x5a103f){_0x1fbdd3['push'](_0x1fbdd3['shift']());}};_0x5bdb44(++_0x5aef1c);}(_0x7a54,0x106));var _0x47a5=function(_0x308076,_0x504fef){_0x308076=_0x308076-0x0;var _0x4364e4=_0x7a54[_0x308076];return _0x4364e4;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var schema=require('validate');var moment=require(_0x47a5('0x3'));var config=require(_0x47a5('0x4'));var properties=require('../properties');var ami=require(_0x47a5('0x5'));var VoiceQueueSummary=require(_0x47a5('0x6'));exports[_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){return new Promise(function(_0x3d5629,_0x59199c){var _0x343372={'QueuePause':function(_0x30e405){return new Promise(function(_0x506eda){var _0x194fb0=util['format']('%s/%s','SIP',_0x30e405[_0x47a5('0x8')]);if(_0x3717e1[_0x47a5('0x9')]&&_0x3717e1['timers'][_0x194fb0]&&_0x3717e1[_0x47a5('0x9')][_0x194fb0]['timer']){_0x3717e1['timers'][_0x194fb0][_0x47a5('0xa')]();}if(_0x3717e1[_0x47a5('0xb')][_0x194fb0]){_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xc')]({'state':_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xd')],'statePause':_0x30e405[_0x47a5('0xe')]?!![]:![]});}_0x506eda({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x44bd3e){var _0x221b54=this;return new Promise(function(_0x1cf309,_0x711793){if(ami[_0x47a5('0xf')]()==![]){return _0x711793(_0x221b54[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}_0x44bd3e=_[_0x47a5('0x14')](_0x44bd3e,_[_0x47a5('0x15')](properties[_0x47a5('0x16')]['module']));_0x44bd3e['action']=_0x47a5('0x17');return ami['Action'](_0x44bd3e)['then'](function(_0x423a81){_0x1cf309({'code':0xc8,'message':_0x423a81[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x1ef371){_0x711793(_0x221b54[_0x47a5('0x10')](0x1f5,_0x1ef371[_0x47a5('0x18')]));});});},'Command':function(_0x2763d6){var _0xe3c618=this;return new Promise(function(_0x3aed38,_0x4a9fcb){if(ami[_0x47a5('0xf')]()==![]){return _0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')]['join']('\x20')));}_0x2763d6=_[_0x47a5('0x14')](_0x2763d6,_0x47a5('0x1b'));_0x2763d6[_0x47a5('0x1c')]=_0x47a5('0x1d');return ami['Action'](_0x2763d6)[_0x47a5('0x1e')](function(_0x385687){_0x3aed38({'code':0xc8,'message':_0x385687['content']});})[_0x47a5('0x19')](function(_0xc4cd63){_0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f5,_0xc4cd63[_0x47a5('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3abd6a){var _0x50bf17=[];for(var _0x53078a in _0x3717e1[_0x47a5('0x1f')]){if(_0x3717e1['voiceQueues'][_0x47a5('0x20')](_0x53078a)){var _0x5b6c4e=_0x3717e1[_0x47a5('0x1f')][_0x53078a];var _0x378208=new VoiceQueueSummary(_0x5b6c4e);_0x50bf17[_0x47a5('0x21')](_0x378208);}}_0x3abd6a({'count':_0x50bf17[_0x47a5('0x22')],'rows':_0x50bf17});});},'UpdateVoiceQueue':function(_0x21f296){return new Promise(function(_0x3ba0b7,_0x24b162){var _0x136b14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x1f')],{'id':parseInt(_0x21f296['id'])});var _0x1127f8=_[_0x47a5('0x24')](_0x21f296,['id']);if(_0x136b14){for(var _0x3ad507 in _0x1127f8){if(typeof _0x1127f8[_0x3ad507]!=='undefined'&&typeof _0x136b14[_0x3ad507]!==_0x47a5('0x25')){_0x136b14[_0x3ad507]=_0x1127f8[_0x3ad507];}}_0x3ba0b7(_0x136b14);}else{_0x24b162();}});},'VoiceChannels':function(){return new Promise(function(_0x51833b){var _0x2ef875=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x27')]);_0x51833b({'count':_0x2ef875['length'],'rows':_0x2ef875});});},'VoiceChannelMixMonitor':function(_0x256650){var _0x625952=this;return new Promise(function(_0x39b50b,_0x1f1c68){if(ami['isConnected']()==![]){return _0x1f1c68(_0x625952['error'](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],'ami\x20disconnected'][_0x47a5('0x13')]('\x20')));}var _0x51544e=schema(properties['voicechannel'])[_0x47a5('0x28')](_0x256650);if(_0x51544e['length']>0x0){return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x51544e,'message')['join'](',\x20')));}var _0x274e34=_['find'](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x256650[_0x47a5('0x2a')]});if(_0x274e34&&_0x274e34[_0x47a5('0x2b')]){var _0x52749b=util[_0x47a5('0x2c')]('%s.%s',_0x256650['filename']||_0x256650[_0x47a5('0x2a')],_0x256650['format']||_0x47a5('0x2d'));return ami['Action']({'action':_0x47a5('0x2e'),'channel':_0x274e34[_0x47a5('0x2b')],'file':_0x52749b,'options':_0x47a5('0x2f')})[_0x47a5('0x1e')](function(_0x36add5){var _0xed6320=_[_0x47a5('0x23')](_0x274e34[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52749b['toLowerCase']()});if(_[_0x47a5('0x32')](_0xed6320)){_0x274e34[_0x47a5('0x30')]['push']({'filename':_0x47a5('0x31')+_0x52749b[_0x47a5('0x33')](),'createdAt':moment()[_0x47a5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x36add5[_0x47a5('0x34')],'status':_0x47a5('0x35')});}else{_0xed6320['mixmonitorid']=_0x36add5[_0x47a5('0x34')];_0xed6320[_0x47a5('0x36')]='rec';}_0x39b50b({'code':0xc8,'message':[_0x256650['uniqueid'],'MixMonitor\x20Success',_0x36add5[_0x47a5('0x34')]]['join']('\x20'),'mixmonitorid':_0x36add5[_0x47a5('0x34')]});})[_0x47a5('0x19')](function(_0x301a85){_0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,[_0x256650[_0x47a5('0x2a')],_0x301a85[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,_0x47a5('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x280500){var _0x1658e8=this;return new Promise(function(_0x23d6d8,_0x56dbbd){if(ami[_0x47a5('0xf')]()==![]){return _0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')]['join']('\x20')));}var _0x47c7a2=schema(properties['voicechannel'])['validate'](_0x280500);if(_0x47c7a2[_0x47a5('0x22')]>0x0){return _0x56dbbd(_0x1658e8['error'](0x1f4,_[_0x47a5('0x29')](_0x47c7a2,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x494526=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x280500['uniqueid']});if(_0x494526){return Promise['resolve']()[_0x47a5('0x1e')](function(){if(_0x494526['channel']){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x2b')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){if(_0x494526[_0x47a5('0x3a')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x3a')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){var _0x3574d4=_[_0x47a5('0x23')](_0x494526[_0x47a5('0x30')],{'mixmonitorid':_0x280500['mixmonitorid']});if(_0x3574d4){_0x3574d4[_0x47a5('0x36')]=_0x47a5('0x3b');}})['then'](function(){var _0x52b3a8=util[_0x47a5('0x2c')]('%s.%s',_0x280500[_0x47a5('0x3c')]||_0x280500[_0x47a5('0x2a')],_0x280500['format']||'wav');var _0x3d85cc=_['find'](_0x494526[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52b3a8[_0x47a5('0x33')]()});if(_0x3d85cc){_0x3d85cc[_0x47a5('0x36')]=_0x47a5('0x3b');}})[_0x47a5('0x1e')](function(){_0x23d6d8({'code':0xc8,'message':[_0x280500[_0x47a5('0x2a')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x47a5('0x19')](function(_0x411230){_0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f5,[_0x280500[_0x47a5('0x2a')],_0x411230[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x56dbbd(_0x1658e8['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannels':function(_0x1c9a62){var _0x5f6a=this;return new Promise(function(_0x5c3c75){var _0x12ca40=_['values'](_0x3717e1[_0x47a5('0x3d')]);var _0xe31817={'count':_0x12ca40[_0x47a5('0x22')],'rows':_0x12ca40};if(_0x1c9a62&&_0x1c9a62[_0x47a5('0x3e')]){if(!['inbound',_0x47a5('0x3f')][_0x47a5('0x40')](_0x1c9a62[_0x47a5('0x3e')])){return _0x59199c(_0x5f6a[_0x47a5('0x10')](0x190,_0x47a5('0x41')));}var _0x6a53b3=_[_0x47a5('0x42')](_0x12ca40,function(_0x481089){return _0x481089[_0x47a5('0x3e')]===_0x1c9a62[_0x47a5('0x3e')];});_0xe31817[_0x47a5('0x43')]=_0x6a53b3[_0x47a5('0x22')];_0xe31817[_0x47a5('0x44')]=_0x6a53b3;}_0x5c3c75(_0xe31817);});},'VoiceQueuesChannel':function(_0x1ab0bf){var _0x572233=this;return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581=schema(properties['voicequeuechannel'])[_0x47a5('0x28')](_0x1ab0bf);if(_0x1aa581[_0x47a5('0x22')]>0x0){return _0x245a15(_0x572233[_0x47a5('0x10')](0x1f4,_['map'](_0x1aa581,'message')[_0x47a5('0x13')](',\x20')));}var _0x376e1d=_['find'](_0x3717e1['queueChannels'],{'uniqueid':_0x1ab0bf[_0x47a5('0x2a')]});if(_0x376e1d){_0x1ad6a9(_0x376e1d);}else{return _0x245a15(_0x572233['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x5d383d){var _0x482de6=this;return new Promise(function(_0x389ed9,_0x46d2d3){if(ami['isConnected']()==![]){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config['asterisk']['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x867da0=schema(properties[_0x47a5('0x45')])['validate'](_0x5d383d);if(_0x867da0[_0x47a5('0x22')]>0x0){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x867da0,'message')[_0x47a5('0x13')](',\x20')));}var _0x4db625=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x5d383d[_0x47a5('0x2a')]});if(_0x4db625&&_0x4db625[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':'Hangup','channel':_0x4db625[_0x47a5('0x2b')]})['then'](function(_0x5cbe97){_0x389ed9({'code':0xc8,'message':[_0x5d383d['uniqueid'],_0x5cbe97['message'][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')});})[_0x47a5('0x19')](function(_0x52e3ee){_0x46d2d3(_0x482de6['error'](0x1f5,[_0x5d383d[_0x47a5('0x2a')],_0x52e3ee[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3474b7){var _0x519e9e=this;return new Promise(function(_0x22c886,_0x274d31){if(ami['isConnected']()==![]){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x35cca8=schema(properties[_0x47a5('0x46')])['validate'](_0x3474b7);if(_0x35cca8[_0x47a5('0x22')]>0x0){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x35cca8,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x4bbe14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x3474b7[_0x47a5('0x2a')]});if(_0x4bbe14&&_0x4bbe14[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x47'),'channel':_0x4bbe14[_0x47a5('0x2b')],'exten':_0x3474b7[_0x47a5('0x48')],'context':_0x3474b7[_0x47a5('0x49')]||_0x4bbe14[_0x47a5('0x49')],'priority':0x1})[_0x47a5('0x1e')](function(_0x44fda9){_0x22c886({'code':0xc8,'message':[_0x3474b7[_0x47a5('0x2a')],_0x44fda9[_0x47a5('0x18')][_0x47a5('0x33')]()]['join']('\x20')});})[_0x47a5('0x19')](function(_0x284fb8){_0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,[_0x3474b7['uniqueid'],_0x284fb8[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3ac402){return new Promise(function(_0x522ccf){var _0x2d5ee6=_['values'](_0x3717e1[_0x47a5('0xb')]);if(_0x3ac402&&_0x3ac402['id']){var _0x4cf7c5=_[_0x47a5('0x23')](_0x2d5ee6,function(_0x2f27c3){return _0x2f27c3['id']===_0x3ac402['id'];});_0x522ccf(_0x4cf7c5);}else{_0x522ccf({'count':_0x2d5ee6[_0x47a5('0x22')],'rows':_0x2d5ee6});}});},'Telephones':function(){return new Promise(function(_0x58473b){var _0x4af557=_['values'](_0x3717e1[_0x47a5('0x4a')]);_0x58473b({'count':_0x4af557[_0x47a5('0x22')],'rows':_0x4af557});});},'Trunks':function(){return new Promise(function(_0xe3c0a7){var _0x117510=_['values'](_0x3717e1[_0x47a5('0x4b')]);_0xe3c0a7({'count':_0x117510[_0x47a5('0x22')],'rows':_0x117510});});},'OutboundChannels':function(){return new Promise(function(_0x390bc0){var _0xd5b23f=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x4c')]);_0x390bc0({'count':_0xd5b23f[_0x47a5('0x22')],'rows':_0xd5b23f});});},'Outbound':function(){return new Promise(function(_0x39939a){_0x39939a(_0x3717e1[_0x47a5('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0xc69a68){var _0x2e6fcc=_[_0x47a5('0x26')](_0x3717e1['campaigns']);_0xc69a68({'count':_0x2e6fcc[_0x47a5('0x22')],'rows':_0x2e6fcc});});},'VoiceQueuesPreview':function(_0x4833be){var _0x2ad00a=this;return new Promise(function(_0x2ac30f,_0x281e5f){_0xfdf934[_0x47a5('0x4d')](_0x4833be['id'])[_0x47a5('0x1e')](function(_0xa9c853){_0x2ac30f({'code':0xc8,'message':_0xa9c853[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x11c1db){_0x281e5f(_0x2ad00a[_0x47a5('0x10')](0x1f4,_0x11c1db[_0x47a5('0x18')]));});});},'EventManager':function(_0x1f07ac){var _0x8f0035=this;return new Promise(function(_0x2d434c,_0x441d64){if(!_0x1f07ac['event']){return _0x441d64(_0x8f0035['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x47a5('0x4e')+_0x1f07ac[_0x47a5('0x4f')],_0x1f07ac['message']);_0x2d434c({'code':0xc8,'message':_0x1f07ac});});},'FaxAccounts':function(){return new Promise(function(_0x732e00){var _0x44dda2=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x50')]);_0x732e00({'count':_0x44dda2[_0x47a5('0x22')],'rows':_0x44dda2});});},'SendFax':function(_0x930d25){var _0x218dfa=this;return new Promise(function(_0x1c7302,_0x2e9a96){_0x545a97[_0x47a5('0x51')](_0x930d25)[_0x47a5('0x1e')](function(_0x5e5f16){_0x1c7302({'code':0xc8,'message':_0x5e5f16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x420671){_0x2e9a96(_0x218dfa['error'](0x1f4,_0x420671[_0x47a5('0x18')]));});});},'CheckAfterSend':function(_0x32f393){var _0x17b61d=this;return new Promise(function(_0x5d41d8,_0x19dc8c){_0x545a97['checkAfterSend'](_0x32f393)['then'](function(_0x356e16){_0x5d41d8({'code':0xc8,'message':_0x356e16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x27333e){_0x19dc8c(_0x17b61d[_0x47a5('0x10')](0x1f4,_0x27333e[_0x47a5('0x18')]));});});}};var _0x479a82=jayson['server'](_0x343372)[_0x47a5('0x52')]();_0x479a82['on']('error',function(_0x24dbee){return _0x59199c(_0x24dbee);});_0x479a82[_0x47a5('0x7')](0x232a,_0x47a5('0x53'),function(){console[_0x47a5('0x54')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d5629(_0x47a5('0x55')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 923ec08..18a0540 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 _0xa619=['uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','[CM][%s][%s]\x20Contact\x20not\x20found','data4','calleridname','','Unknown','destcalleridname','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','push','format','user:%s','action','toLowerCase','merge','bluebird','ioredis','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','defaults','redis','localhost','socket.io-emitter','info','stringify','emit','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','destcalleridnum','calleridnum','routeId','firstName','fax','createdAt','union','resolve','getContacts','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa619,0xe1));var _0x9a61=function(_0x148e07,_0x1f7134){_0x148e07=_0x148e07-0x0;var _0x3ff8c2=_0xa619[_0x148e07];return _0x3ff8c2;};'use strict';var _=require('lodash');var BPromise=require(_0x9a61('0x0'));var Redis=require(_0x9a61('0x1'));var util=require('util');var config=require(_0x9a61('0x2'));var logger=require(_0x9a61('0x3'))(_0x9a61('0x4'));var cmContactRpc=require(_0x9a61('0x5'));config['redis']=_[_0x9a61('0x6')](config[_0x9a61('0x7')],{'host':_0x9a61('0x8'),'port':0x18eb});var io=require(_0x9a61('0x9'))(new Redis(config[_0x9a61('0x7')]));function emit(_0x160ba8,_0x46417b,_0x515440,_0x210615,_0x255763){logger[_0x9a61('0xa')]('[CM][%s][%s]',_0x160ba8,_0x46417b['id'],_0x515440,_0x210615,JSON[_0x9a61('0xb')](_0x255763));io['to'](_0x515440)[_0x9a61('0xc')](_0x210615,_0x255763);}exports['exec']=function(_0x1dcc4d,_0x519da9,_0x445aed,_0x54eee8){var _0x35098a,_0x3dd3a8;var _0x597f03={};var _0x1f6626;var _0x180529=Number(_0x445aed[_0x9a61('0xd')]);var _0x7dc931=_0x445aed[_0x9a61('0xe')]?Boolean(Number(_0x445aed['data2'])):![];var _0x114355;var _0x36932a=![];if(!_[_0x9a61('0xf')](_0x445aed[_0x9a61('0x10')])){if(_0x445aed[_0x9a61('0x10')]=='1')_0x36932a=!![];}if(!_0x36932a){if(_0x54eee8[_0x9a61('0x11')]){_0x597f03['id']=_0x54eee8[_0x9a61('0x11')];}}if(!_0x597f03['id']){_0x597f03[_0x9a61('0x12')]=_0x180529;_0x114355=_0x445aed['data3']&&_0x445aed[_0x9a61('0x13')]!=='0'?_0x445aed[_0x9a61('0x13')][_0x9a61('0x14')](','):[_0x9a61('0x15')];_0x597f03['$or']=_['map'](_0x114355,function(_0x5bb696){var _0x1133a4={};_0x1133a4[_0x5bb696]=_0x54eee8['routeId']?_0x54eee8[_0x9a61('0x16')]:_0x54eee8[_0x9a61('0x17')];return _0x1133a4;});_0x1f6626=_0x54eee8[_0x9a61('0x18')]?_0x54eee8['destcalleridnum']:_0x54eee8[_0x9a61('0x17')];}var _0x33df3a=['id',_0x9a61('0x19'),'lastName',_0x9a61('0x15'),'mobile',_0x9a61('0x1a'),_0x9a61('0x12'),_0x9a61('0x1b'),'scheduledAt','updatedAt'];var _0x554e28=_[_0x9a61('0x1c')](_0x33df3a,_0x114355);BPromise[_0x9a61('0x1d')]()['then'](cmContactRpc[_0x9a61('0x1e')]({'attributes':_0x554e28,'where':_0x597f03,'phone':_0x1f6626}))[_0x9a61('0x1f')](function(_0x35d89d){_0x3dd3a8=_0x35d89d;if(!_[_0x9a61('0x20')](_0x3dd3a8)){if(_0x3dd3a8[_0x9a61('0x21')]===0x1){_0x35098a=_0x3dd3a8[0x0];logger[_0x9a61('0xa')](_0x9a61('0x22'),_0x54eee8[_0x9a61('0x23')],_0x519da9['id'],_0x35098a['id']);}else{logger[_0x9a61('0xa')](_0x9a61('0x24'),_0x54eee8[_0x9a61('0x23')],_0x519da9['id'],_[_0x9a61('0x25')](_0x3dd3a8,'id')['join'](','));}return;}else{logger[_0x9a61('0xa')](_0x9a61('0x26'),_0x54eee8[_0x9a61('0x23')],_0x519da9['id']);var _0x1d7fe3={'ListId':_0x180529};var _0xf14a3b=_0x445aed[_0x9a61('0x27')]&&_0x445aed['data4']!=='0'?_0x445aed[_0x9a61('0x27')]:_0x9a61('0x15');if(_0x7dc931){logger[_0x9a61('0xa')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x54eee8[_0x9a61('0x23')],_0x519da9['id']);_0x1d7fe3[_0xf14a3b]=_[_0x9a61('0xf')](_0x54eee8[_0x9a61('0x18')])?_0x54eee8[_0x9a61('0x17')]:_0x54eee8[_0x9a61('0x16')];if(_[_0x9a61('0xf')](_0x54eee8['routeId'])){_0x1d7fe3['firstName']=_0x54eee8[_0x9a61('0x28')]&&_0x54eee8[_0x9a61('0x28')]!==_0x9a61('0x29')?_0x54eee8[_0x9a61('0x28')]:_0x9a61('0x2a');}else{_0x1d7fe3['firstName']=_0x54eee8[_0x9a61('0x2b')]&&_0x54eee8[_0x9a61('0x2b')]!==_0x9a61('0x29')?_0x54eee8[_0x9a61('0x2b')]:_0x9a61('0x2a');}return BPromise[_0x9a61('0x1d')]()[_0x9a61('0x1f')](cmContactRpc['createContact'](_0x1d7fe3))[_0x9a61('0x1f')](function(_0x1f54dd){_0x35098a=_0x1f54dd;_0x3dd3a8['push'](_0x1f54dd);if(_0x35098a){logger[_0x9a61('0xa')](_0x9a61('0x2c'),_0x54eee8[_0x9a61('0x23')],_0x519da9['id'],_0x35098a['id']);}return;});}else{logger[_0x9a61('0xa')](_0x9a61('0x2d'),_0x54eee8[_0x9a61('0x23')],_0x519da9['id']);_0x1d7fe3[_0xf14a3b]=_[_0x9a61('0xf')](_0x54eee8[_0x9a61('0x18')])?_0x54eee8[_0x9a61('0x17')]:_0x54eee8['destcalleridnum'];if(_[_0x9a61('0xf')](_0x54eee8[_0x9a61('0x18')])){_0x1d7fe3[_0x9a61('0x19')]=_0x54eee8[_0x9a61('0x28')]&&_0x54eee8[_0x9a61('0x28')]!==_0x9a61('0x29')?_0x54eee8[_0x9a61('0x28')]:'Unknown';}else{_0x1d7fe3[_0x9a61('0x19')]=_0x54eee8['destcalleridname']&&_0x54eee8[_0x9a61('0x2b')]!==_0x9a61('0x29')?_0x54eee8[_0x9a61('0x2b')]:_0x9a61('0x2a');}_0x35098a=_0x1d7fe3;_0x3dd3a8[_0x9a61('0x2e')](_0x1d7fe3);return;}}})[_0x9a61('0x1f')](function(){if(_0x1dcc4d){emit(_0x54eee8['uniqueid'],_0x519da9,util[_0x9a61('0x2f')](_0x9a61('0x30'),_0x1dcc4d['name']),util[_0x9a61('0x2f')]('trigger:%s',_0x445aed[_0x9a61('0x31')][_0x9a61('0x32')]()),{'evt':_[_0x9a61('0x33')](_0x54eee8,{'autoCreate':_0x7dc931}),'contact':_0x35098a===undefined?{}:_0x35098a,'contacts':_0x3dd3a8[_0x9a61('0x21')]===0x0?undefined:_0x3dd3a8});}});}; \ No newline at end of file +var _0x53ce=['uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','destcalleridname','createContact','push','format','user:%s','name','action','toLowerCase','lodash','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','defaults','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','data1','data2','isNil','data5','xmd-contactid','data3','split','phone','$or','map','routeId','calleridnum','destcalleridnum','firstName','lastName','mobile','ListId','createdAt','updatedAt','union','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s'];(function(_0x1c66f1,_0x53c85c){var _0x682d89=function(_0x2e0036){while(--_0x2e0036){_0x1c66f1['push'](_0x1c66f1['shift']());}};_0x682d89(++_0x53c85c);}(_0x53ce,0x12e));var _0xe53c=function(_0x564d22,_0x5db59b){_0x564d22=_0x564d22-0x0;var _0x23d8c0=_0x53ce[_0x564d22];return _0x23d8c0;};'use strict';var _=require(_0xe53c('0x0'));var BPromise=require('bluebird');var Redis=require(_0xe53c('0x1'));var util=require(_0xe53c('0x2'));var config=require(_0xe53c('0x3'));var logger=require(_0xe53c('0x4'))(_0xe53c('0x5'));var cmContactRpc=require(_0xe53c('0x6'));config['redis']=_[_0xe53c('0x7')](config[_0xe53c('0x8')],{'host':_0xe53c('0x9'),'port':0x18eb});var io=require(_0xe53c('0xa'))(new Redis(config['redis']));function emit(_0x257911,_0x10a3bd,_0x21475d,_0x474445,_0x44da10){logger[_0xe53c('0xb')](_0xe53c('0xc'),_0x257911,_0x10a3bd['id'],_0x21475d,_0x474445,JSON[_0xe53c('0xd')](_0x44da10));io['to'](_0x21475d)['emit'](_0x474445,_0x44da10);}exports['exec']=function(_0x53f68c,_0x1bb36e,_0x39573f,_0x8d2000){var _0x4cc417,_0x1fd9ca;var _0x13cc1f={};var _0x1a95f8;var _0x463aaf=Number(_0x39573f[_0xe53c('0xe')]);var _0x16ebdd=_0x39573f[_0xe53c('0xf')]?Boolean(Number(_0x39573f[_0xe53c('0xf')])):![];var _0x1c0d7b;var _0x17e325=![];if(!_[_0xe53c('0x10')](_0x39573f[_0xe53c('0x11')])){if(_0x39573f[_0xe53c('0x11')]=='1')_0x17e325=!![];}if(!_0x17e325){if(_0x8d2000[_0xe53c('0x12')]){_0x13cc1f['id']=_0x8d2000['xmd-contactid'];}}if(!_0x13cc1f['id']){_0x13cc1f['ListId']=_0x463aaf;_0x1c0d7b=_0x39573f[_0xe53c('0x13')]&&_0x39573f['data3']!=='0'?_0x39573f[_0xe53c('0x13')][_0xe53c('0x14')](','):[_0xe53c('0x15')];_0x13cc1f[_0xe53c('0x16')]=_[_0xe53c('0x17')](_0x1c0d7b,function(_0x207f38){var _0xa11b75={};_0xa11b75[_0x207f38]=_0x8d2000[_0xe53c('0x18')]?_0x8d2000['destcalleridnum']:_0x8d2000[_0xe53c('0x19')];return _0xa11b75;});_0x1a95f8=_0x8d2000[_0xe53c('0x18')]?_0x8d2000[_0xe53c('0x1a')]:_0x8d2000[_0xe53c('0x19')];}var _0x232c69=['id',_0xe53c('0x1b'),_0xe53c('0x1c'),'phone',_0xe53c('0x1d'),'fax',_0xe53c('0x1e'),_0xe53c('0x1f'),'scheduledAt',_0xe53c('0x20')];var _0x1b69e8=_[_0xe53c('0x21')](_0x232c69,_0x1c0d7b);BPromise[_0xe53c('0x22')]()[_0xe53c('0x23')](cmContactRpc[_0xe53c('0x24')]({'attributes':_0x1b69e8,'where':_0x13cc1f,'phone':_0x1a95f8}))[_0xe53c('0x23')](function(_0x2017a0){_0x1fd9ca=_0x2017a0;if(!_[_0xe53c('0x25')](_0x1fd9ca)){if(_0x1fd9ca[_0xe53c('0x26')]===0x1){_0x4cc417=_0x1fd9ca[0x0];logger['info'](_0xe53c('0x27'),_0x8d2000[_0xe53c('0x28')],_0x1bb36e['id'],_0x4cc417['id']);}else{logger[_0xe53c('0xb')](_0xe53c('0x29'),_0x8d2000[_0xe53c('0x28')],_0x1bb36e['id'],_[_0xe53c('0x17')](_0x1fd9ca,'id')[_0xe53c('0x2a')](','));}return;}else{logger['info'](_0xe53c('0x2b'),_0x8d2000[_0xe53c('0x28')],_0x1bb36e['id']);var _0x37d554={'ListId':_0x463aaf};var _0xfc85b2=_0x39573f[_0xe53c('0x2c')]&&_0x39573f[_0xe53c('0x2c')]!=='0'?_0x39573f[_0xe53c('0x2c')]:_0xe53c('0x15');if(_0x16ebdd){logger[_0xe53c('0xb')](_0xe53c('0x2d'),_0x8d2000[_0xe53c('0x28')],_0x1bb36e['id']);_0x37d554[_0xfc85b2]=_[_0xe53c('0x10')](_0x8d2000[_0xe53c('0x18')])?_0x8d2000[_0xe53c('0x19')]:_0x8d2000['destcalleridnum'];if(_[_0xe53c('0x10')](_0x8d2000[_0xe53c('0x18')])){_0x37d554['firstName']=_0x8d2000[_0xe53c('0x2e')]&&_0x8d2000['calleridname']!==_0xe53c('0x2f')?_0x8d2000[_0xe53c('0x2e')]:_0xe53c('0x30');}else{_0x37d554[_0xe53c('0x1b')]=_0x8d2000['destcalleridname']&&_0x8d2000[_0xe53c('0x31')]!==''?_0x8d2000[_0xe53c('0x31')]:_0xe53c('0x30');}return BPromise[_0xe53c('0x22')]()['then'](cmContactRpc[_0xe53c('0x32')](_0x37d554))[_0xe53c('0x23')](function(_0x1da349){_0x4cc417=_0x1da349;_0x1fd9ca[_0xe53c('0x33')](_0x1da349);if(_0x4cc417){logger['info']('[CM][%s][%s]\x20Contact\x20created:%s',_0x8d2000['uniqueid'],_0x1bb36e['id'],_0x4cc417['id']);}return;});}else{logger[_0xe53c('0xb')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x8d2000['uniqueid'],_0x1bb36e['id']);_0x37d554[_0xfc85b2]=_[_0xe53c('0x10')](_0x8d2000[_0xe53c('0x18')])?_0x8d2000[_0xe53c('0x19')]:_0x8d2000['destcalleridnum'];if(_['isNil'](_0x8d2000['routeId'])){_0x37d554['firstName']=_0x8d2000[_0xe53c('0x2e')]&&_0x8d2000[_0xe53c('0x2e')]!==_0xe53c('0x2f')?_0x8d2000[_0xe53c('0x2e')]:_0xe53c('0x30');}else{_0x37d554[_0xe53c('0x1b')]=_0x8d2000[_0xe53c('0x31')]&&_0x8d2000['destcalleridname']!==''?_0x8d2000[_0xe53c('0x31')]:'Unknown';}_0x4cc417=_0x37d554;_0x1fd9ca[_0xe53c('0x33')](_0x37d554);return;}}})[_0xe53c('0x23')](function(){if(_0x53f68c){emit(_0x8d2000['uniqueid'],_0x1bb36e,util[_0xe53c('0x34')](_0xe53c('0x35'),_0x53f68c[_0xe53c('0x36')]),util[_0xe53c('0x34')]('trigger:%s',_0x39573f[_0xe53c('0x37')][_0xe53c('0x38')]()),{'evt':_['merge'](_0x8d2000,{'autoCreate':_0x16ebdd}),'contact':_0x4cc417===undefined?{}:_0x4cc417,'contacts':_0x1fd9ca[_0xe53c('0x26')]===0x0?undefined:_0x1fd9ca});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 0902d87..5f549b0 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 _0x0cba=['custom:timeout','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','prototype','emit','stringify','clone','motionChannel','checkTriggers','interface','hasOwnProperty','merge','variables','Actions','length','toLowerCase','contactmanager','motionbar','browser','data1','TemplateId','html','data2','render','template\x20not\x20found','uri','buildUri','isNil','data3','location','windowWidth','800','data5','windowHeight','data6','winapp','winApplication','format','user:%s','trigger:%s:%s','action','name','trigger:%s','exec','integration','queue','routeId','urlforward','script','parse','search','replace','channel','AllConditions','every','some','AnyConditions','checkConditions','debug','checkTrigger:\x20trigger','inspect','evt','field','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','message','event','agent','membername','lastevent','mailSubstatus','substatus','undefined','offlineMessage','exports','util','lodash','url','mustache','ioredis','./urlforward','./cmContact','./script','../../../config/environment','../../../config/logger','../ami','redis','defaults','popup','triggers','agents','voiceQueues','templates','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','bind','custom:agentconnect','syncCustomEvent','custom:agentringnoanswer','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon'];(function(_0xf98d90,_0x2f6f8c){var _0xd67583=function(_0x476676){while(--_0x476676){_0xf98d90['push'](_0xf98d90['shift']());}};_0xd67583(++_0x2f6f8c);}(_0x0cba,0x1d6));var _0xa0cb=function(_0xc1a4cf,_0x17141b){_0xc1a4cf=_0xc1a4cf-0x0;var _0x2930d1=_0x0cba[_0xc1a4cf];return _0x2930d1;};'use strict';var util=require(_0xa0cb('0x0'));var _=require(_0xa0cb('0x1'));var url=require(_0xa0cb('0x2'));var Mustache=require(_0xa0cb('0x3'));var Redis=require(_0xa0cb('0x4'));var urlforward=require(_0xa0cb('0x5'));var integration=require('./integration');var cmContact=require(_0xa0cb('0x6'));var script=require(_0xa0cb('0x7'));var config=require(_0xa0cb('0x8'));var logger=require(_0xa0cb('0x9'))('trigger');var ami=require(_0xa0cb('0xa'));config[_0xa0cb('0xb')]=_[_0xa0cb('0xc')](config[_0xa0cb('0xb')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa0cb('0xb')]));var operators={'equals':function(_0x43a5b9,_0x4ad4af){return _0x43a5b9==_0x4ad4af;},'not_equals':function(_0x38c94f,_0x6dcf2d){return _0x38c94f!=_0x6dcf2d;}};var barAndWebActions=[_0xa0cb('0xd'),_0xa0cb('0x2'),'winapp'];function Trigger(_0x1f7786){this['triggers']=_0x1f7786[_0xa0cb('0xe')];this[_0xa0cb('0xf')]=_0x1f7786[_0xa0cb('0xf')];this[_0xa0cb('0x10')]=_0x1f7786['voiceQueues'];this[_0xa0cb('0x11')]=_0x1f7786[_0xa0cb('0x11')];this['voiceExtensions']=_0x1f7786['voiceExtensions'];this[_0xa0cb('0x12')]=_0x1f7786[_0xa0cb('0x12')];this['freshdeskAccounts']=_0x1f7786[_0xa0cb('0x13')];this[_0xa0cb('0x14')]=_0x1f7786[_0xa0cb('0x14')];this[_0xa0cb('0x15')]=_0x1f7786[_0xa0cb('0x15')];this[_0xa0cb('0x16')]=_0x1f7786[_0xa0cb('0x16')];this[_0xa0cb('0x17')]=_0x1f7786[_0xa0cb('0x17')];this['vtigerAccounts']=_0x1f7786[_0xa0cb('0x18')];this[_0xa0cb('0x19')]=_0x1f7786[_0xa0cb('0x19')];this[_0xa0cb('0x1a')]=_0x1f7786[_0xa0cb('0x1a')];this['freshsalesAccounts']=_0x1f7786[_0xa0cb('0x1b')];this['accounts']={'zendesk':this[_0xa0cb('0x12')],'salesforce':this[_0xa0cb('0x14')],'freshdesk':this[_0xa0cb('0x13')],'sugarcrm':this[_0xa0cb('0x15')],'zoho':this[_0xa0cb('0x16')],'desk':this[_0xa0cb('0x17')],'vtiger':this[_0xa0cb('0x18')],'dynamics365':this[_0xa0cb('0x1a')],'freshsales':this[_0xa0cb('0x1b')],'servicenow':this[_0xa0cb('0x19')]};ami['on']('custom:agentcalled',this['syncCustomEvent'][_0xa0cb('0x1c')](this));ami['on'](_0xa0cb('0x1d'),this[_0xa0cb('0x1e')][_0xa0cb('0x1c')](this));ami['on'](_0xa0cb('0x1f'),this[_0xa0cb('0x1e')][_0xa0cb('0x1c')](this));ami['on']('custom:agentcomplete',this[_0xa0cb('0x1e')]['bind'](this));ami['on'](_0xa0cb('0x20'),this[_0xa0cb('0x1e')][_0xa0cb('0x1c')](this));ami['on'](_0xa0cb('0x21'),this[_0xa0cb('0x1e')][_0xa0cb('0x1c')](this));ami['on']('custom:agentbusy',this[_0xa0cb('0x1e')][_0xa0cb('0x1c')](this));ami['on'](_0xa0cb('0x22'),this[_0xa0cb('0x1e')][_0xa0cb('0x1c')](this));ami['on'](_0xa0cb('0x23'),this[_0xa0cb('0x1e')][_0xa0cb('0x1c')](this));ami['on'](_0xa0cb('0x24'),this['syncCustomEvent']['bind'](this));ami['on'](_0xa0cb('0x25'),this[_0xa0cb('0x1e')][_0xa0cb('0x1c')](this));ami['on'](_0xa0cb('0x26'),this[_0xa0cb('0x1e')][_0xa0cb('0x1c')](this));ami['on']('custom:dialbegin',this[_0xa0cb('0x27')]['bind'](this));ami['on'](_0xa0cb('0x28'),this[_0xa0cb('0x27')][_0xa0cb('0x1c')](this));ami['on'](_0xa0cb('0x29'),this['syncAgentDial'][_0xa0cb('0x1c')](this));ami['on'](_0xa0cb('0x2a'),this[_0xa0cb('0x1e')]['bind'](this));ami['on'](_0xa0cb('0x2b'),this[_0xa0cb('0x1e')][_0xa0cb('0x1c')](this));ami['on'](_0xa0cb('0x2c'),this[_0xa0cb('0x1e')][_0xa0cb('0x1c')](this));ami['on'](_0xa0cb('0x2d'),this[_0xa0cb('0x1e')]['bind'](this));ami['on'](_0xa0cb('0x2e'),this[_0xa0cb('0x1e')]['bind'](this));ami['on'](_0xa0cb('0x2f'),this[_0xa0cb('0x1e')][_0xa0cb('0x1c')](this));ami['on'](_0xa0cb('0x30'),this['syncCustomEvent'][_0xa0cb('0x1c')](this));ami['on'](_0xa0cb('0x31'),this[_0xa0cb('0x1e')][_0xa0cb('0x1c')](this));}Trigger[_0xa0cb('0x32')][_0xa0cb('0x33')]=function(_0x601c9f,_0x278459,_0x2f6ce8){logger['info'](_0x601c9f,_0x278459,JSON[_0xa0cb('0x34')](_0x2f6ce8));io['to'](_0x601c9f)[_0xa0cb('0x33')](_0x278459,_0x2f6ce8);};Trigger[_0xa0cb('0x32')][_0xa0cb('0x1e')]=function(_0x588a3e){var _0x12d3d9=_[_0xa0cb('0x35')](_0x588a3e);if(typeof _0x12d3d9[_0xa0cb('0x36')]==='undefined'){_0x12d3d9['motionChannel']='voice';}logger['debug'](_0xa0cb('0x1e'),util['inspect'](_0x12d3d9,{'showHidden':!![],'depth':null}));this[_0xa0cb('0x37')](_0x12d3d9);};Trigger['prototype'][_0xa0cb('0x27')]=function(_0x2d7ef4){if(this[_0xa0cb('0xf')][_0x2d7ef4[_0xa0cb('0x38')]]){this[_0xa0cb('0x1e')](_0x2d7ef4);}};Trigger[_0xa0cb('0x32')][_0xa0cb('0x37')]=function(_0x1db03e){var _0x54cf08;for(var _0x1b3ef0 in this['triggers']){if(this[_0xa0cb('0xe')][_0xa0cb('0x39')](_0x1b3ef0)){if(this['triggers'][_0x1b3ef0]['status']){_0x54cf08=this['checkTrigger'](this[_0xa0cb('0xe')][_0x1b3ef0],_0x1db03e);if(_0x54cf08){_[_0xa0cb('0x3a')](_0x1db03e,_0x1db03e[_0xa0cb('0x3b')]);for(var _0x4a9d4a=0x0,_0xdad7ed,_0x510c7b,_0x577803;_0x4a9d4a0x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ No newline at end of file +var _0xe14b=['CTI','concat','Tags','Descriptions','/api/v2/users/%d','user','%s/customers/%d/cases','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','integrationTab','newTab','catch','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','ioredis','./util','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','application/json','validateEmail','format','%s/users','then','total_entries','find','_embedded','entries','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','password','token','%s/token:%s','Basic\x20%s','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','%s/customers','remoteUri','POST','length','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variableName','custom_fields','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','xCALLY'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe14b,0x93));var _0xbe14=function(_0x58d3d4,_0x67693b){_0x58d3d4=_0x58d3d4-0x0;var _0x481683=_0xe14b[_0x58d3d4];return _0x481683;};'use strict';var _=require(_0xbe14('0x0'));var rp=require(_0xbe14('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0xbe14('0x2'));var intUtil=require(_0xbe14('0x3'));var config=require('../../../../config/environment');var logger=require(_0xbe14('0x4'))('desk');config['redis']=_[_0xbe14('0x5')](config[_0xbe14('0x6')],{'host':_0xbe14('0x7'),'port':0x18eb});var io=require(_0xbe14('0x8'))(new Redis(config[_0xbe14('0x6')]));function emit(_0x39387e,_0x196fca,_0x566ae7){io['to'](_0x39387e)['emit'](_0x196fca,_0x566ae7);}var headers={'Content-Type':'application/json','Accept':_0xbe14('0x9')};function getUser(_0x6fceff,_0xd68cd7){if(intUtil[_0xbe14('0xa')](_0xd68cd7)===!![]){logger['info']('Getting\x20agent\x20with\x20email',_0xd68cd7);return request({'uri':util[_0xbe14('0xb')](_0xbe14('0xc'),_0x6fceff['remoteUri'])})[_0xbe14('0xd')](function(_0x35aa19){if(_0x35aa19[_0xbe14('0xe')]){return _[_0xbe14('0xf')](_0x35aa19[_0xbe14('0x10')][_0xbe14('0x11')],{'email':_0xd68cd7});}})[_0xbe14('0xd')](function(_0x2850cb){if(_0x2850cb){logger[_0xbe14('0x12')](_0xbe14('0x13'));return _0x2850cb;}else{logger[_0xbe14('0x12')](_0xbe14('0x14'));return request({'uri':util[_0xbe14('0xb')]('%s/users/me',_0x6fceff['remoteUri'])});}});}else{logger[_0xbe14('0x12')](_0xbe14('0x15'));return request({'uri':util[_0xbe14('0xb')](_0xbe14('0x16'),_0x6fceff['remoteUri'])});}}function request(_0x21c789){logger[_0xbe14('0x17')](_0xbe14('0x18'),JSON[_0xbe14('0x19')](_0x21c789));return rp(_[_0xbe14('0x5')](_0x21c789,{'method':_0xbe14('0x1a'),'headers':headers,'json':!![]}));}function getAuth(_0x17ae86){var _0x5ea1f8;if(_0x17ae86[_0xbe14('0x1b')]===_0xbe14('0x1c')){_0x5ea1f8=util[_0xbe14('0xb')](_0xbe14('0x1d'),_0x17ae86[_0xbe14('0x1e')],_0x17ae86[_0xbe14('0x1f')]);}else if(_0x17ae86['authType']===_0xbe14('0x20')){_0x5ea1f8=util[_0xbe14('0xb')](_0xbe14('0x21'),_0x17ae86[_0xbe14('0x1e')],_0x17ae86[_0xbe14('0x20')]);}return util['format'](_0xbe14('0x22'),new Buffer(_0x5ea1f8)['toString'](_0xbe14('0x23')));}function getEndUser(_0x56e80c,_0x32e8eb,_0x4a25fa){logger[_0xbe14('0x12')](_0xbe14('0x24'),_0x4a25fa);return request({'uri':util['format'](_0xbe14('0x25'),_0x56e80c['remoteUri']),'qs':{'phone':_0x4a25fa}})[_0xbe14('0xd')](function(_0x4851f8){if(_0x4851f8[_0xbe14('0xe')]){logger[_0xbe14('0x12')](_0xbe14('0x26'));return _0x4851f8[_0xbe14('0x10')][_0xbe14('0x11')][0x0];}else{logger[_0xbe14('0x12')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xbe14('0xb')](_0xbe14('0x27'),_0x56e80c[_0xbe14('0x28')]),'method':_0xbe14('0x29'),'body':{'first_name':_0x32e8eb,'title':_0x32e8eb,'phone_numbers':[{'type':'work','value':_0x4a25fa}]}});}});}function getTags(_0x16f884,_0x29fc64){var _0x59bf34=[];if(_0x16f884&&_0x16f884[_0xbe14('0x2a')]>0x0){_0x59bf34=_[_0xbe14('0x2b')](_0x16f884,_0x29fc64);}return _0x59bf34;}function getCustomFields(_0x1c7cc7,_0x19252f){var _0x34d648=[];var _0x36d4b2={'custom_fields':{}};if(_0x1c7cc7[_0xbe14('0x2a')]>0x0){_[_0xbe14('0x2c')](_0x1c7cc7,function(_0x4168c8){if(_[_0xbe14('0x2d')]([_0xbe14('0x2e'),_0xbe14('0x2f')],_0x4168c8[_0xbe14('0x30')])&&_0x4168c8[_0xbe14('0x31')]&&!_0x4168c8[_0xbe14('0x32')]){_0x36d4b2[_0x4168c8[_0xbe14('0x31')][_0xbe14('0x33')]()]=_0x4168c8[_0xbe14('0x34')][_0xbe14('0x35')]();}else if(_[_0xbe14('0x2d')](['string',_0xbe14('0x2f')],_0x4168c8['type'])&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x36d4b2['custom_fields'][_0x4168c8[_0xbe14('0x36')]]=_0x4168c8[_0xbe14('0x34')]['toString']();}else if(_0x4168c8['type']==='variable'&&_0x4168c8[_0xbe14('0x37')]&&_0x4168c8[_0xbe14('0x36')]&&_0x4168c8['customField']){_0x19252f[_0x4168c8[_0xbe14('0x37')]]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x37')]][_0xbe14('0x35')]());}else if(_0x4168c8['type']==='customVariable'&&_0x4168c8[_0xbe14('0x39')]&&_0x4168c8['Variable']['name']&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()][_0xbe14('0x35')]());}});}if(_0x36d4b2[_0xbe14('0x3b')]){_0x36d4b2[_0xbe14('0x3b')]=Number(_0x36d4b2['priority']);}return _0x36d4b2;}function getTicket(_0x4f51f8,_0x43cdaa,_0x2951e1,_0x13bfcf,_0x520e09){logger[_0xbe14('0x12')](_0xbe14('0x3c'));var _0xeda70e=_[_0xbe14('0x3d')]({'subject':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x3f')],_0x520e09,'\x20'),'type':_0xbe14('0x40'),'status':_0xbe14('0x41'),'labels':[_0xbe14('0x42'),'Motion',_0xbe14('0x43')][_0xbe14('0x44')](getTags(_0x13bfcf[_0xbe14('0x45')],_0xbe14('0x3a'))),'description':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xbe14('0x47'),_0x43cdaa['id']),'class':_0xbe14('0x48')}},'message':{'direction':'in','body':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a')}},getCustomFields(_0x13bfcf['Fields'],_0x520e09));return request({'uri':util['format'](_0xbe14('0x49'),_0x4f51f8[_0xbe14('0x28')],_0x2951e1['id']),'method':_0xbe14('0x29'),'body':_0xeda70e});}exports['queue']=function(_0x5d5318,_0x6b6aa8,_0x59ae4d,_0x5657fe,_0x3593f8,_0x1f0355){var _0x8216c3,_0x5051e4;_0x1f0355['remoteUri']=intUtil['stripTrailingSlash'](_0x1f0355[_0xbe14('0x28')]);_0x1f0355[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x1f0355['serverUrl']);if(_0x3593f8&&_0x3593f8[_0xbe14('0x4c')]){logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x4e'));_0x6b6aa8['recordingURL']=util['format'](_0xbe14('0x4f'),_0x1f0355[_0xbe14('0x4a')],_0x6b6aa8[_0xbe14('0x50')],md5(_0x6b6aa8[_0xbe14('0x50')]));}else{_0x6b6aa8[_0xbe14('0x51')]='';}headers['Authorization']=getAuth(_0x1f0355);return getUser(_0x1f0355,_0x5657fe['email'])[_0xbe14('0xd')](function(_0x2a3623){_0x8216c3=_0x2a3623;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x8216c3['id']);return getEndUser(_0x1f0355,_0x6b6aa8['calleridname'],_0x6b6aa8[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x53e8ab){_0x5051e4=_0x53e8ab;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x5051e4['id']);return getTicket(_0x1f0355,_0x8216c3,_0x5051e4,_0x59ae4d,_0x6b6aa8);})[_0xbe14('0xd')](function(_0x36c20c){if(_0x36c20c){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x36c20c['id']);switch(_0x1f0355['type']){case'integrationTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x36c20c['id']});break;case'newTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe['name']),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')](_0xbe14('0x5b'),_0x36c20c['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x4d'),_0xbe14('0x5d'));}}})['catch'](function(_0x5aeea9){console[_0xbe14('0x5c')](_0x5aeea9);logger[_0xbe14('0x5c')](_0xbe14('0x4d'),JSON['stringify'](_0x5aeea9));});};exports['outbound']=function(_0x44fe0d,_0x134878,_0x50d78f,_0x339a86,_0x32496a,_0x50c2a0,_0x28f995){var _0x4a40d2,_0x41ba58;_0x50c2a0[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['remoteUri']);_0x50c2a0[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['serverUrl']);if(_0x28f995&&_0x28f995[_0xbe14('0x5e')]&&_0x28f995[_0xbe14('0x5e')]!==_0xbe14('0x5f')){logger[_0xbe14('0x12')](_0xbe14('0x60'),'Recording\x20is\x20enabled!');_0x134878[_0xbe14('0x51')]=util[_0xbe14('0xb')](_0xbe14('0x4f'),_0x50c2a0[_0xbe14('0x4a')],_0x134878[_0xbe14('0x50')],md5(_0x134878[_0xbe14('0x50')]));}headers[_0xbe14('0x61')]=getAuth(_0x50c2a0);return getUser(_0x50c2a0,_0x339a86['email'])[_0xbe14('0xd')](function(_0x1b47a4){_0x4a40d2=_0x1b47a4;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x4a40d2['id']);return getEndUser(_0x50c2a0,_0x134878[_0xbe14('0x62')],_0x134878[_0xbe14('0x63')]);})[_0xbe14('0xd')](function(_0x32df3c){_0x41ba58=_0x32df3c;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x41ba58['id']);return getTicket(_0x50c2a0,_0x4a40d2,_0x41ba58,_0x50d78f,_0x134878);})[_0xbe14('0xd')](function(_0x4bccfc){if(_0x4bccfc){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x4bccfc['id']);switch(_0x50c2a0[_0xbe14('0x30')]){case _0xbe14('0x64'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x4bccfc['id']});break;case _0xbe14('0x65'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')]('%s/agent/tickets/%s',_0x50c2a0[_0xbe14('0x28')],_0x4bccfc['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x60'),_0xbe14('0x5d'));}}})[_0xbe14('0x66')](function(_0x222944){logger[_0xbe14('0x5c')](_0xbe14('0x60'),JSON[_0xbe14('0x19')](_0x222944));});};exports[_0xbe14('0x67')]=function(_0x5917d5,_0x18be56,_0x442ec4,_0x2d4dd4,_0xfd32a3,_0x3ac6d8){var _0x5a1ea6,_0x42b341;_0x3ac6d8[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x3ac6d8[_0xbe14('0x28')]);_0x3ac6d8[_0xbe14('0x4a')]=intUtil['stripTrailingSlash'](_0x3ac6d8[_0xbe14('0x4a')]);if(_0xfd32a3&&_0xfd32a3[_0xbe14('0x4c')]){logger[_0xbe14('0x12')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',_0xbe14('0x4e'));_0x18be56[_0xbe14('0x51')]=util[_0xbe14('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ac6d8[_0xbe14('0x4a')],_0x18be56[_0xbe14('0x50')],md5(_0x18be56[_0xbe14('0x50')]));}else{_0x18be56[_0xbe14('0x51')]='';}headers[_0xbe14('0x61')]=getAuth(_0x3ac6d8);return getUser(_0x3ac6d8)[_0xbe14('0xd')](function(_0x445302){_0x5a1ea6=_0x445302;logger['info']('The\x20User\x20ID\x20is:',_0x5a1ea6['id']);return getEndUser(_0x3ac6d8,_0x18be56[_0xbe14('0x6a')],_0x18be56[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x2510a0){_0x42b341=_0x2510a0;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x42b341['id']);return getTicket(_0x3ac6d8,_0x5a1ea6,_0x42b341,_0x442ec4,_0x18be56);})[_0xbe14('0xd')](function(_0x43511e){if(_0x43511e){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x43511e['id']);}})[_0xbe14('0x66')](function(_0x57729f){logger[_0xbe14('0x5c')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',JSON[_0xbe14('0x19')](_0x57729f));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index f68ab21..8e43bb3 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 _0x1f29=['recordingURL','recordingFormat','none',']\x20The\x20User\x20ID\x20is:',']\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','./util','md5','ioredis','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','resolve','data5','POST','clientId','username','password','then','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','userId','systemuserid','info','toLowerCase','outbound','destcalleridnum','calleridnum','/systemusers(','body','odata-entityid','substring','lastIndexOf','enduserId','telephone1','GET','contacts?$select=','\x20eq\x20\x27','replace','%2b','nothing','includes','string','picklist','type','nameField','idField','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','Fields','phonecall','callDirection','queue','/contacts(','phonecalls','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x1f29,0x151));var _0x91f2=function(_0x188dc2,_0x1229e9){_0x188dc2=_0x188dc2-0x0;var _0x423b4a=_0x1f29[_0x188dc2];return _0x423b4a;};'use strict';var _=require(_0x91f2('0x0'));var rp=require(_0x91f2('0x1'));var util=require(_0x91f2('0x2'));var intUtil=require(_0x91f2('0x3'));var md5=require(_0x91f2('0x4'));var Redis=require(_0x91f2('0x5'));var logger=require('../../../../config/logger')('dynamics365');var config=require(_0x91f2('0x6'));config[_0x91f2('0x7')]=_[_0x91f2('0x8')](config[_0x91f2('0x7')],{'host':_0x91f2('0x9'),'port':0x18eb});var io=require(_0x91f2('0xa'))(new Redis(config['redis']));function getAuthToken(_0xcd1395,_0x137728,_0x34fba3){if(_0xcd1395[_0x91f2('0xb')]){_0xcd1395[_0x91f2('0xc')]=_0xcd1395[_0x91f2('0xd')][_0x91f2('0xe')];_0xcd1395[_0x91f2('0xf')]=_0xcd1395[_0x91f2('0xd')][_0x91f2('0x10')];return Promise[_0x91f2('0x11')](_0xcd1395[_0x91f2('0xd')][_0x91f2('0x12')]);}var _0x3dfafe={'method':_0x91f2('0x13'),'uri':_0x137728,'form':{'client_id':_0xcd1395[_0x91f2('0x14')],'resource':_0xcd1395[_0x91f2('0xc')],'username':_0xcd1395[_0x91f2('0x15')],'password':_0xcd1395[_0x91f2('0x16')],'grant_type':_0x91f2('0x16'),'client_secret':_0xcd1395['clientSecret']},'json':!![]};return rp(_0x3dfafe)[_0x91f2('0x17')](function(_0x1db403){return _0x1db403['access_token'];})[_0x91f2('0x18')](function(_0x15da02){logger[_0x91f2('0x19')]('['+[_0x34fba3[_0x91f2('0x1a')]()]+_0x91f2('0x1b'));return _0x15da02[_0x91f2('0x1c')];});}function getUser(_0x55894d,_0x53ddfe,_0x40f199,_0x5a2bae,_0x4c2ca6,_0x3c3d19){return new Promise(function(_0x1ec4ce,_0x2ae0f9){return getAuthToken(_0x53ddfe,_0x5a2bae,_0x3c3d19)[_0x91f2('0x17')](function(_0x9c81b6){var _0x3eb96c={'method':'GET','uri':_0x4c2ca6+_0x91f2('0x1d'),'headers':{'Authorization':_0x91f2('0x1e')+_0x9c81b6,'OData-Version':_0x91f2('0x1f')},'json':!![]};return rp(_0x3eb96c);})[_0x91f2('0x17')](function(_0x1f60cd){var _0x2a795f=_0x1f60cd[_0x91f2('0x20')];var _0x2bbe6d=![];var _0x494cb7=null;if(!_[_0x91f2('0x21')](_0x40f199)){if(intUtil[_0x91f2('0x22')](_0x40f199[_0x91f2('0x23')])){_0x55894d[_0x91f2('0x24')]=_0x40f199[_0x91f2('0x23')];for(_0x494cb7=0x0;_0x494cb7<_0x2a795f[_0x91f2('0x25')];_0x494cb7++){if(_0x2a795f[_0x494cb7][_0x91f2('0x26')]===_0x40f199[_0x91f2('0x23')]&&!_0x2a795f[_0x494cb7][_0x91f2('0x27')]){_0x2bbe6d=!![];logger['info']('['+[_0x3c3d19['toUpperCase']()]+_0x91f2('0x28')+_0x2a795f[_0x494cb7]['systemuserid']+'!');_0x55894d[_0x91f2('0x29')]=_0x2a795f[_0x494cb7][_0x91f2('0x2a')];}}}}if(!_0x2bbe6d){logger[_0x91f2('0x2b')]('['+[_0x3c3d19[_0x91f2('0x1a')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x55894d[_0x91f2('0x24')]=_0x53ddfe[_0x91f2('0x15')];for(_0x494cb7=0x0;_0x494cb7<_0x2a795f['length'];_0x494cb7++){if(_0x2a795f[_0x494cb7]['internalemailaddress']===_0x53ddfe[_0x91f2('0x15')]){_0x55894d[_0x91f2('0x29')]=_0x2a795f[_0x494cb7][_0x91f2('0x2a')];}}}_0x1ec4ce(_0x55894d);})[_0x91f2('0x18')](function(_0x3ab28c){_0x2ae0f9(_0x3ab28c[_0x91f2('0x1c')]);});});}function createEndUser(_0x3de214,_0x390674,_0x15cb5c,_0x1dd53f,_0x7a3f7d,_0x5076ce,_0x29fbfc){return new Promise(function(_0x4c5eac,_0x1244b7){return getAuthToken(_0x390674,_0x15cb5c,_0x5076ce)[_0x91f2('0x17')](function(_0x49f5df){var _0xbb06eb=_0x5076ce[_0x91f2('0x2c')]()===_0x91f2('0x2d')?_0x7a3f7d[_0x91f2('0x2e')]:_0x7a3f7d[_0x91f2('0x2f')];var _0x3a814e={'method':'POST','uri':_0x1dd53f+'contacts','body':{'fullname':_0xbb06eb,'firstname':_0xbb06eb,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x91f2('0x30')+_0x3de214[_0x91f2('0x29')]+')'},'headers':{'Authorization':_0x91f2('0x1e')+_0x49f5df,'OData-Version':_0x91f2('0x1f')},'json':!![],'resolveWithFullResponse':!![]};_0x3a814e[_0x91f2('0x31')][_0x29fbfc]=_0xbb06eb;return rp(_0x3a814e);})[_0x91f2('0x17')](function(_0x29ca2d){var _0x4cdd78=_0x29ca2d['headers'][_0x91f2('0x32')];var _0x95ae26=_0x4cdd78[_0x91f2('0x33')](_0x4cdd78[_0x91f2('0x34')]('(')+0x1,_0x4cdd78[_0x91f2('0x34')](')'));_0x3de214[_0x91f2('0x35')]=_0x95ae26;_0x4c5eac(_0x3de214);})['catch'](function(_0x301436){_0x1244b7(_0x301436[_0x91f2('0x1c')]);});});}function getEndUser(_0x5259b5,_0x4e2de7,_0x4aeb93,_0x3ed1f4,_0x4c722c,_0x48ccb0,_0x259a43,_0x9533fd){var _0x48012f=_0x48ccb0[_0x91f2('0x2c')]()===_0x91f2('0x2d')?_0x4c722c[_0x91f2('0x2e')]:_0x4c722c['calleridnum'];return getAuthToken(_0x4e2de7,_0x4aeb93,_0x48ccb0)[_0x91f2('0x17')](function(_0x1cdf15){_0x9533fd=_0x9533fd?_0x9533fd:_0x91f2('0x36');var _0x3a83f2={'method':_0x91f2('0x37'),'uri':_0x3ed1f4+_0x91f2('0x38')+_0x9533fd+'&$filter='+_0x9533fd+_0x91f2('0x39')+_0x48012f[_0x91f2('0x3a')]('+',_0x91f2('0x3b'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x1cdf15,'If-None-Match':null,'OData-Version':_0x91f2('0x1f')},'json':!![]};return rp(_0x3a83f2);})[_0x91f2('0x17')](function(_0x3a87b4){var _0x4e47e5=![];if(!_0x3a87b4)return _0x4e47e5;var _0x120ffb=_0x3a87b4[_0x91f2('0x20')];for(var _0x24907c=0x0;_0x24907c<_0x120ffb[_0x91f2('0x25')];_0x24907c++){if(_0x120ffb[_0x24907c][_0x9533fd]===_0x48012f){_0x4e47e5=!![];_0x5259b5[_0x91f2('0x35')]=_0x120ffb[_0x24907c]['contactid'];}}return _0x4e47e5;})[_0x91f2('0x17')](function(_0x1a4f9c){if(_0x1a4f9c)return _0x5259b5;if(_0x259a43===_0x91f2('0x3c')){logger[_0x91f2('0x2b')]('['+[_0x48ccb0[_0x91f2('0x1a')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x5259b5;}return createEndUser(_0x5259b5,_0x4e2de7,_0x4aeb93,_0x3ed1f4,_0x4c722c,_0x48ccb0,_0x9533fd)['then'](function(_0x3fe130){logger['info']('['+[_0x48ccb0['toUpperCase']()]+']\x20Enduser\x20created!',_0x3fe130[_0x91f2('0x35')]);return _0x3fe130;});});}function getCustomFields(_0x2556c1,_0x519681,_0x4958b7){var _0x32c7de={};if(_0x2556c1[_0x91f2('0x25')]>0x0){_['forEach'](_0x2556c1,function(_0x132b6d){if(_[_0x91f2('0x3d')]([_0x91f2('0x3e'),_0x91f2('0x3f')],_0x132b6d[_0x91f2('0x40')])&&_0x132b6d[_0x91f2('0x41')]&&!_0x132b6d['customField']){var _0x270cf7=_0x132b6d[_0x91f2('0x42')][_0x91f2('0x2c')]();var _0x2a7e99=_0x270cf7[_0x91f2('0x33')](0x0,_0x270cf7['indexOf']('_'));var _0x29cf55=_0x270cf7[_0x91f2('0x33')](_0x270cf7[_0x91f2('0x43')]('_')+0x1);if(_0x2a7e99===_0x4958b7){_0x32c7de[_0x29cf55]=_0x132b6d[_0x91f2('0x44')];}}});}return _0x32c7de;}function getTicket(_0x150086,_0x5516dd,_0x4b4a25,_0x126164,_0x11f142,_0x436829,_0x3c9600){return new Promise(function(_0x1128b8,_0xd83fc6){var _0x1c710e;return getAuthToken(_0x5516dd,_0x4b4a25,_0x3c9600)[_0x91f2('0x17')](function(_0x22e72e){if(_0x436829[_0x91f2('0x45')]===_0x91f2('0x46')){_0x1c710e={'method':_0x91f2('0x13'),'uri':_0x126164+_0x91f2('0x47'),'body':Object[_0x91f2('0x48')]({},{'title':intUtil[_0x91f2('0x49')](_0x436829[_0x91f2('0x4a')],_0x11f142,'\x20'),'description':intUtil[_0x91f2('0x49')](_0x436829[_0x91f2('0x4b')],_0x11f142,'\x0a'),'customerid_contact@odata.bind':_0x150086[_0x91f2('0x35')]?'/contacts('+_0x150086[_0x91f2('0x35')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x150086['userId']+')','caseorigincode':'1'},getCustomFields(_0x436829[_0x91f2('0x4c')],_0x11f142,_0x436829[_0x91f2('0x45')])),'headers':{'Authorization':'Bearer\x20'+_0x22e72e,'OData-Version':_0x91f2('0x1f')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x436829[_0x91f2('0x45')]===_0x91f2('0x4d')){var _0x4e3907=_0x150086['enduserId']?[{'partyid_systemuser@odata.bind':_0x91f2('0x30')+_0x150086[_0x91f2('0x29')]+')','participationtypemask':_0x150086[_0x91f2('0x4e')]===_0x91f2('0x4f')?0x2:0x1},{'partyid_contact@odata.bind':_0x91f2('0x50')+_0x150086[_0x91f2('0x35')]+')','participationtypemask':_0x150086[_0x91f2('0x4e')]===_0x91f2('0x4f')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x150086['userId']+')','participationtypemask':_0x150086['callDirection']===_0x91f2('0x4f')?0x2:0x1}];_0x1c710e={'method':_0x91f2('0x13'),'uri':_0x126164+_0x91f2('0x51'),'body':Object[_0x91f2('0x48')]({},{'subject':intUtil[_0x91f2('0x49')](_0x436829['Subjects'],_0x11f142,'\x20'),'phonenumber':String(_0x11f142[_0x91f2('0x2f')]),'description':intUtil['getString'](_0x436829[_0x91f2('0x4b')],_0x11f142,'\x0a'),'regardingobjectid_contact@odata.bind':_0x150086['enduserId']?_0x91f2('0x50')+_0x150086['enduserId']+')':undefined,'ownerid@odata.bind':_0x91f2('0x30')+_0x150086[_0x91f2('0x29')]+')','directioncode':_0x150086[_0x91f2('0x4e')]===_0x91f2('0x4f')?![]:!![],'phonecall_activity_parties':_0x4e3907},getCustomFields(_0x436829['Fields'],_0x11f142,_0x436829['ticketType'])),'headers':{'Authorization':_0x91f2('0x1e')+_0x22e72e,'OData-Version':_0x91f2('0x1f')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1c710e);})[_0x91f2('0x17')](function(_0x3488a2){var _0x3e794f=_0x3488a2['headers'][_0x91f2('0x32')];var _0x37c355=_0x3e794f[_0x91f2('0x33')](_0x3e794f['lastIndexOf']('(')+0x1,_0x3e794f[_0x91f2('0x34')](')'));_0x150086[_0x91f2('0x52')]=_0x37c355;_0x1128b8(_0x150086);})[_0x91f2('0x18')](function(_0x25592f){_0xd83fc6(_0x25592f['message']);});});}function emit(_0x4adbe6,_0x319d9e,_0xb19e8c,_0x464b8b){var _0x551239={'uri':util[_0x91f2('0x53')](_0x91f2('0x54'),_0x4adbe6,_0xb19e8c,_0x464b8b)};io['to'](util[_0x91f2('0x53')](_0x91f2('0x55'),_0x319d9e))[_0x91f2('0x56')]('trigger:browser:url',_0x551239);}exports['cs']=function(_0x319f01,_0x3960ec,_0x438115,_0x1ea484,_0x2276d7,_0x1bcbc9,_0x1cfba3,_0x4ebeb7){var _0x3f6c79={};_0x1bcbc9['remoteUri']=_0x1bcbc9[_0x91f2('0xb')]?intUtil['stripTrailingSlash'](_0x1bcbc9[_0x91f2('0xd')][_0x91f2('0xe')]):intUtil[_0x91f2('0x57')](_0x1bcbc9['remoteUri']);_0x1bcbc9[_0x91f2('0x58')]=intUtil[_0x91f2('0x57')](_0x1bcbc9[_0x91f2('0x58')]);_0x3f6c79[_0x91f2('0x4e')]=_0x4ebeb7==='queue'||_0x4ebeb7==='unmanaged'?_0x91f2('0x4f'):_0x91f2('0x2d');var _0x400ff8=_0x1bcbc9[_0x91f2('0xb')]?util['format'](_0x91f2('0x59'),_0x1bcbc9[_0x91f2('0xd')][_0x91f2('0xe')]):util[_0x91f2('0x53')](_0x91f2('0x59'),_0x1bcbc9[_0x91f2('0xc')]);var _0x24a35b=util[_0x91f2('0x53')](_0x91f2('0x5a'),_0x1bcbc9['tenantId']);var _0x144eab=util[_0x91f2('0x53')](_0x91f2('0x5b'),_0x1bcbc9[_0x91f2('0x58')],_0x3960ec[_0x91f2('0x5c')],md5(_0x3960ec[_0x91f2('0x5c')]));if(_0x2276d7&&_0x2276d7[_0x91f2('0x5d')]){logger[_0x91f2('0x2b')]('[QUEUE]',_0x91f2('0x5e'));_0x3960ec[_0x91f2('0x5f')]=_0x144eab;}else if(_0x1cfba3&&_0x1cfba3[_0x91f2('0x60')]&&_0x1cfba3[_0x91f2('0x60')]!==_0x91f2('0x61')){logger[_0x91f2('0x2b')]('[OUTBOUND]',_0x91f2('0x5e'));_0x3960ec[_0x91f2('0x5f')]=_0x144eab;}else{_0x3960ec[_0x91f2('0x5f')]='';}return getUser(_0x3f6c79,_0x1bcbc9,_0x1ea484,_0x24a35b,_0x400ff8,_0x4ebeb7)['then'](function(_0x384192){logger[_0x91f2('0x2b')]('['+_0x4ebeb7[_0x91f2('0x1a')]()+_0x91f2('0x62'),_0x384192[_0x91f2('0x29')]);logger[_0x91f2('0x2b')]('['+_0x4ebeb7['toUpperCase']()+']\x20The\x20User\x20email\x20is:',_0x384192[_0x91f2('0x24')]);return getEndUser(_0x384192,_0x1bcbc9,_0x24a35b,_0x400ff8,_0x3960ec,_0x4ebeb7,_0x438115['moduleCreate'],_0x438115['additionalSearchContact']);})[_0x91f2('0x17')](function(_0xc284c4){logger[_0x91f2('0x2b')]('['+_0x4ebeb7['toUpperCase']()+_0x91f2('0x63'),_0xc284c4[_0x91f2('0x35')]);logger[_0x91f2('0x2b')]('['+_0x4ebeb7['toUpperCase']()+_0x91f2('0x64'),_0x3960ec[_0x91f2('0x2f')]);return getTicket(_0xc284c4,_0x1bcbc9,_0x24a35b,_0x400ff8,_0x3960ec,_0x438115,_0x4ebeb7);})[_0x91f2('0x17')](function(_0x4d2c84){logger[_0x91f2('0x2b')](util['format']('['+_0x4ebeb7[_0x91f2('0x1a')]()+_0x91f2('0x65'),_0x438115[_0x91f2('0x45')],_0x4d2c84[_0x91f2('0x52')]));logger[_0x91f2('0x2b')](util[_0x91f2('0x53')]('['+_0x4ebeb7[_0x91f2('0x1a')]()+_0x91f2('0x66'),_0x4ebeb7));if(_0x4ebeb7!=='unmanaged'&&_0x438115[_0x91f2('0x67')]){logger[_0x91f2('0x2b')]('['+_0x4ebeb7[_0x91f2('0x1a')]()+']',_0x91f2('0x68'));emit(_0x1bcbc9[_0x91f2('0xc')],_0x1ea484[_0x91f2('0x69')],_0x438115[_0x91f2('0x45')],_0x4d2c84[_0x91f2('0x52')]);}})[_0x91f2('0x18')](function(_0xba82b8){logger[_0x91f2('0x19')]('['+_0x4ebeb7['toUpperCase']()+_0x91f2('0x6a'),_0xba82b8[_0x91f2('0x1c')]);console[_0x91f2('0x19')](_0x91f2('0x6b'),_0xba82b8);});}; \ No newline at end of file +var _0x997a=[']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','ticketId',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','util','./util','md5','ioredis','dynamics365','redis','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','data5','POST','clientId','username','access_token','catch','error',']\x20Wrong\x20credentials!','message','then','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','validateEmail','email','userEmail','internalemailaddress','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','length','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','body','headers','odata-entityid','substring','lastIndexOf','telephone1','GET','contacts?$select=','&$filter=','\x20eq\x20\x27',']\x20Enduser\x20created!','enduserId','forEach','includes','string','picklist','type','nameField','customField','idField','indexOf','content','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','/systemusers(','Fields','ticketType','phonecall','callDirection','queue','phonecalls','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:'];(function(_0x47e7ae,_0x3c357b){var _0xb7c680=function(_0x4b2e09){while(--_0x4b2e09){_0x47e7ae['push'](_0x47e7ae['shift']());}};_0xb7c680(++_0x3c357b);}(_0x997a,0x78));var _0xa997=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x997a[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xa997('0x0'));var rp=require('request-promise');var util=require(_0xa997('0x1'));var intUtil=require(_0xa997('0x2'));var md5=require(_0xa997('0x3'));var Redis=require(_0xa997('0x4'));var logger=require('../../../../config/logger')(_0xa997('0x5'));var config=require('../../../../config/environment');config[_0xa997('0x6')]=_['defaults'](config[_0xa997('0x6')],{'host':_0xa997('0x7'),'port':0x18eb});var io=require(_0xa997('0x8'))(new Redis(config['redis']));function getAuthToken(_0x5ac87c,_0x17f175,_0x27d253){if(_0x5ac87c[_0xa997('0x9')]){_0x5ac87c[_0xa997('0xa')]=_0x5ac87c[_0xa997('0xb')][_0xa997('0xc')];_0x5ac87c[_0xa997('0xd')]=_0x5ac87c[_0xa997('0xb')][_0xa997('0xe')];return Promise['resolve'](_0x5ac87c['CloudProvider'][_0xa997('0xf')]);}var _0x4a6072={'method':_0xa997('0x10'),'uri':_0x17f175,'form':{'client_id':_0x5ac87c[_0xa997('0x11')],'resource':_0x5ac87c[_0xa997('0xa')],'username':_0x5ac87c[_0xa997('0x12')],'password':_0x5ac87c['password'],'grant_type':'password','client_secret':_0x5ac87c['clientSecret']},'json':!![]};return rp(_0x4a6072)['then'](function(_0x374a3a){return _0x374a3a[_0xa997('0x13')];})[_0xa997('0x14')](function(_0x6ec0e3){logger[_0xa997('0x15')]('['+[_0x27d253['toUpperCase']()]+_0xa997('0x16'));return _0x6ec0e3[_0xa997('0x17')];});}function getUser(_0x3e8d11,_0x8eef38,_0x17af7a,_0x4fbf75,_0x648f9f,_0x171c04){return new Promise(function(_0x183017,_0x370652){return getAuthToken(_0x8eef38,_0x4fbf75,_0x171c04)[_0xa997('0x18')](function(_0x5b4fb5){var _0x478c05={'method':'GET','uri':_0x648f9f+_0xa997('0x19'),'headers':{'Authorization':_0xa997('0x1a')+_0x5b4fb5,'OData-Version':_0xa997('0x1b')},'json':!![]};return rp(_0x478c05);})[_0xa997('0x18')](function(_0x20c142){var _0x43235e=_0x20c142[_0xa997('0x1c')];var _0x3326ca=![];var _0x6e3199=null;if(!_['isNil'](_0x17af7a)){if(intUtil[_0xa997('0x1d')](_0x17af7a[_0xa997('0x1e')])){_0x3e8d11[_0xa997('0x1f')]=_0x17af7a['email'];for(_0x6e3199=0x0;_0x6e3199<_0x43235e['length'];_0x6e3199++){if(_0x43235e[_0x6e3199][_0xa997('0x20')]===_0x17af7a['email']&&!_0x43235e[_0x6e3199]['isdisabled']){_0x3326ca=!![];logger[_0xa997('0x21')]('['+[_0x171c04[_0xa997('0x22')]()]+_0xa997('0x23')+_0x43235e[_0x6e3199][_0xa997('0x24')]+'!');_0x3e8d11[_0xa997('0x25')]=_0x43235e[_0x6e3199][_0xa997('0x24')];}}}}if(!_0x3326ca){logger[_0xa997('0x21')]('['+[_0x171c04[_0xa997('0x22')]()]+_0xa997('0x26'));_0x3e8d11[_0xa997('0x1f')]=_0x8eef38[_0xa997('0x12')];for(_0x6e3199=0x0;_0x6e3199<_0x43235e[_0xa997('0x27')];_0x6e3199++){if(_0x43235e[_0x6e3199]['internalemailaddress']===_0x8eef38['username']){_0x3e8d11[_0xa997('0x25')]=_0x43235e[_0x6e3199][_0xa997('0x24')];}}}_0x183017(_0x3e8d11);})[_0xa997('0x14')](function(_0x5e85a9){_0x370652(_0x5e85a9[_0xa997('0x17')]);});});}function createEndUser(_0x3c078c,_0x1c10d2,_0x4da4e6,_0x365b1a,_0x110cb1,_0x1a3069,_0x2ec31d){return new Promise(function(_0x22ce09,_0x47961a){return getAuthToken(_0x1c10d2,_0x4da4e6,_0x1a3069)[_0xa997('0x18')](function(_0x3cadcb){var _0x575889=_0x1a3069[_0xa997('0x28')]()===_0xa997('0x29')?_0x110cb1[_0xa997('0x2a')]:_0x110cb1[_0xa997('0x2b')];var _0xa51709={'method':_0xa997('0x10'),'uri':_0x365b1a+_0xa997('0x2c'),'body':{'fullname':_0x575889,'firstname':_0x575889,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x3c078c[_0xa997('0x25')]+')'},'headers':{'Authorization':_0xa997('0x1a')+_0x3cadcb,'OData-Version':_0xa997('0x1b')},'json':!![],'resolveWithFullResponse':!![]};_0xa51709[_0xa997('0x2d')][_0x2ec31d]=_0x575889;return rp(_0xa51709);})[_0xa997('0x18')](function(_0x4feb00){var _0x1f715f=_0x4feb00[_0xa997('0x2e')][_0xa997('0x2f')];var _0x6bcc68=_0x1f715f[_0xa997('0x30')](_0x1f715f[_0xa997('0x31')]('(')+0x1,_0x1f715f[_0xa997('0x31')](')'));_0x3c078c['enduserId']=_0x6bcc68;_0x22ce09(_0x3c078c);})[_0xa997('0x14')](function(_0x464bc9){_0x47961a(_0x464bc9[_0xa997('0x17')]);});});}function getEndUser(_0x2ff0e4,_0x4ec78e,_0x30ee89,_0x278ce4,_0x27b7e4,_0x60c2ec,_0x1d38d6,_0x361e36){var _0x23cdce=_0x60c2ec[_0xa997('0x28')]()===_0xa997('0x29')?_0x27b7e4[_0xa997('0x2a')]:_0x27b7e4[_0xa997('0x2b')];return getAuthToken(_0x4ec78e,_0x30ee89,_0x60c2ec)[_0xa997('0x18')](function(_0x5e73bb){_0x361e36=_0x361e36?_0x361e36:_0xa997('0x32');var _0x3a93cd={'method':_0xa997('0x33'),'uri':_0x278ce4+_0xa997('0x34')+_0x361e36+_0xa997('0x35')+_0x361e36+_0xa997('0x36')+_0x23cdce['replace']('+','%2b')+'\x27','headers':{'Authorization':_0xa997('0x1a')+_0x5e73bb,'If-None-Match':null,'OData-Version':_0xa997('0x1b')},'json':!![]};return rp(_0x3a93cd);})['then'](function(_0x35ff7e){var _0x184ad6=![];if(!_0x35ff7e)return _0x184ad6;var _0x144961=_0x35ff7e[_0xa997('0x1c')];for(var _0xa61637=0x0;_0xa61637<_0x144961[_0xa997('0x27')];_0xa61637++){if(_0x144961[_0xa61637][_0x361e36]===_0x23cdce){_0x184ad6=!![];_0x2ff0e4['enduserId']=_0x144961[_0xa61637]['contactid'];}}return _0x184ad6;})[_0xa997('0x18')](function(_0x41435a){if(_0x41435a)return _0x2ff0e4;if(_0x1d38d6==='nothing'){logger[_0xa997('0x21')]('['+[_0x60c2ec[_0xa997('0x22')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x2ff0e4;}return createEndUser(_0x2ff0e4,_0x4ec78e,_0x30ee89,_0x278ce4,_0x27b7e4,_0x60c2ec,_0x361e36)[_0xa997('0x18')](function(_0x5902ec){logger['info']('['+[_0x60c2ec[_0xa997('0x22')]()]+_0xa997('0x37'),_0x5902ec[_0xa997('0x38')]);return _0x5902ec;});});}function getCustomFields(_0x28ccaa,_0xb19ad6,_0x3c8993){var _0x1d8b5e={};if(_0x28ccaa['length']>0x0){_[_0xa997('0x39')](_0x28ccaa,function(_0x493f81){if(_[_0xa997('0x3a')]([_0xa997('0x3b'),_0xa997('0x3c')],_0x493f81[_0xa997('0x3d')])&&_0x493f81[_0xa997('0x3e')]&&!_0x493f81[_0xa997('0x3f')]){var _0x55fbb0=_0x493f81[_0xa997('0x40')]['toLowerCase']();var _0x241622=_0x55fbb0[_0xa997('0x30')](0x0,_0x55fbb0['indexOf']('_'));var _0x15da7a=_0x55fbb0[_0xa997('0x30')](_0x55fbb0[_0xa997('0x41')]('_')+0x1);if(_0x241622===_0x3c8993){_0x1d8b5e[_0x15da7a]=_0x493f81[_0xa997('0x42')];}}});}return _0x1d8b5e;}function getTicket(_0x1f3d1d,_0x1e3c58,_0x464b18,_0x4b9545,_0x494b46,_0x4718f9,_0x16e71c){return new Promise(function(_0x236ffa,_0x14069b){var _0x1e4638;return getAuthToken(_0x1e3c58,_0x464b18,_0x16e71c)[_0xa997('0x18')](function(_0x1f69c3){if(_0x4718f9['ticketType']===_0xa997('0x43')){_0x1e4638={'method':_0xa997('0x10'),'uri':_0x4b9545+_0xa997('0x44'),'body':Object[_0xa997('0x45')]({},{'title':intUtil[_0xa997('0x46')](_0x4718f9[_0xa997('0x47')],_0x494b46,'\x20'),'description':intUtil['getString'](_0x4718f9[_0xa997('0x48')],_0x494b46,'\x0a'),'customerid_contact@odata.bind':_0x1f3d1d[_0xa997('0x38')]?_0xa997('0x49')+_0x1f3d1d['enduserId']+')':undefined,'ownerid@odata.bind':_0xa997('0x4a')+_0x1f3d1d[_0xa997('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x4718f9[_0xa997('0x4b')],_0x494b46,_0x4718f9[_0xa997('0x4c')])),'headers':{'Authorization':_0xa997('0x1a')+_0x1f69c3,'OData-Version':_0xa997('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x4718f9[_0xa997('0x4c')]===_0xa997('0x4d')){var _0x1cb263=_0x1f3d1d[_0xa997('0x38')]?[{'partyid_systemuser@odata.bind':_0xa997('0x4a')+_0x1f3d1d[_0xa997('0x25')]+')','participationtypemask':_0x1f3d1d[_0xa997('0x4e')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0xa997('0x49')+_0x1f3d1d[_0xa997('0x38')]+')','participationtypemask':_0x1f3d1d[_0xa997('0x4e')]===_0xa997('0x4f')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xa997('0x4a')+_0x1f3d1d[_0xa997('0x25')]+')','participationtypemask':_0x1f3d1d[_0xa997('0x4e')]===_0xa997('0x4f')?0x2:0x1}];_0x1e4638={'method':_0xa997('0x10'),'uri':_0x4b9545+_0xa997('0x50'),'body':Object['assign']({},{'subject':intUtil[_0xa997('0x46')](_0x4718f9[_0xa997('0x47')],_0x494b46,'\x20'),'phonenumber':String(_0x494b46[_0xa997('0x2b')]),'description':intUtil['getString'](_0x4718f9[_0xa997('0x48')],_0x494b46,'\x0a'),'regardingobjectid_contact@odata.bind':_0x1f3d1d[_0xa997('0x38')]?'/contacts('+_0x1f3d1d[_0xa997('0x38')]+')':undefined,'ownerid@odata.bind':_0xa997('0x4a')+_0x1f3d1d[_0xa997('0x25')]+')','directioncode':_0x1f3d1d[_0xa997('0x4e')]==='queue'?![]:!![],'phonecall_activity_parties':_0x1cb263},getCustomFields(_0x4718f9[_0xa997('0x4b')],_0x494b46,_0x4718f9[_0xa997('0x4c')])),'headers':{'Authorization':_0xa997('0x1a')+_0x1f69c3,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1e4638);})[_0xa997('0x18')](function(_0x3b4e3b){var _0x249f87=_0x3b4e3b[_0xa997('0x2e')][_0xa997('0x2f')];var _0x1bb173=_0x249f87[_0xa997('0x30')](_0x249f87[_0xa997('0x31')]('(')+0x1,_0x249f87[_0xa997('0x31')](')'));_0x1f3d1d['ticketId']=_0x1bb173;_0x236ffa(_0x1f3d1d);})[_0xa997('0x14')](function(_0x366a0a){_0x14069b(_0x366a0a[_0xa997('0x17')]);});});}function emit(_0x59fa7d,_0x567885,_0xe375c0,_0x952945){var _0x1fc7c9={'uri':util[_0xa997('0x51')](_0xa997('0x52'),_0x59fa7d,_0xe375c0,_0x952945)};io['to'](util[_0xa997('0x51')](_0xa997('0x53'),_0x567885))[_0xa997('0x54')](_0xa997('0x55'),_0x1fc7c9);}exports['cs']=function(_0x262acd,_0x5918d5,_0x2710e6,_0x68f9e,_0x5535a5,_0x276ecc,_0x2508bd,_0x5cf015){var _0x50d15c={};_0x276ecc[_0xa997('0xa')]=_0x276ecc[_0xa997('0x9')]?intUtil[_0xa997('0x56')](_0x276ecc['CloudProvider'][_0xa997('0xc')]):intUtil[_0xa997('0x56')](_0x276ecc[_0xa997('0xa')]);_0x276ecc[_0xa997('0x57')]=intUtil['stripTrailingSlash'](_0x276ecc['serverUrl']);_0x50d15c[_0xa997('0x4e')]=_0x5cf015==='queue'||_0x5cf015===_0xa997('0x58')?'queue':_0xa997('0x29');var _0x1d21ba=_0x276ecc[_0xa997('0x9')]?util[_0xa997('0x51')](_0xa997('0x59'),_0x276ecc[_0xa997('0xb')][_0xa997('0xc')]):util['format']('%s/api/data/v9.0/',_0x276ecc[_0xa997('0xa')]);var _0x413425=util[_0xa997('0x51')](_0xa997('0x5a'),_0x276ecc['tenantId']);var _0x26bc8d=util[_0xa997('0x51')](_0xa997('0x5b'),_0x276ecc[_0xa997('0x57')],_0x5918d5[_0xa997('0x5c')],md5(_0x5918d5[_0xa997('0x5c')]));if(_0x5535a5&&_0x5535a5['monitor_format']){logger[_0xa997('0x21')](_0xa997('0x5d'),_0xa997('0x5e'));_0x5918d5['recordingURL']=_0x26bc8d;}else if(_0x2508bd&&_0x2508bd[_0xa997('0x5f')]&&_0x2508bd[_0xa997('0x5f')]!==_0xa997('0x60')){logger[_0xa997('0x21')](_0xa997('0x61'),_0xa997('0x5e'));_0x5918d5['recordingURL']=_0x26bc8d;}else{_0x5918d5[_0xa997('0x62')]='';}return getUser(_0x50d15c,_0x276ecc,_0x68f9e,_0x413425,_0x1d21ba,_0x5cf015)[_0xa997('0x18')](function(_0x553d73){logger[_0xa997('0x21')]('['+_0x5cf015[_0xa997('0x22')]()+_0xa997('0x63'),_0x553d73[_0xa997('0x25')]);logger[_0xa997('0x21')]('['+_0x5cf015['toUpperCase']()+_0xa997('0x64'),_0x553d73[_0xa997('0x1f')]);return getEndUser(_0x553d73,_0x276ecc,_0x413425,_0x1d21ba,_0x5918d5,_0x5cf015,_0x2710e6[_0xa997('0x65')],_0x2710e6[_0xa997('0x66')]);})['then'](function(_0x31d1e4){logger[_0xa997('0x21')]('['+_0x5cf015[_0xa997('0x22')]()+_0xa997('0x67'),_0x31d1e4[_0xa997('0x38')]);logger[_0xa997('0x21')]('['+_0x5cf015[_0xa997('0x22')]()+_0xa997('0x68'),_0x5918d5['calleridnum']);return getTicket(_0x31d1e4,_0x276ecc,_0x413425,_0x1d21ba,_0x5918d5,_0x2710e6,_0x5cf015);})['then'](function(_0x1999c8){logger[_0xa997('0x21')](util['format']('['+_0x5cf015[_0xa997('0x22')]()+_0xa997('0x69'),_0x2710e6[_0xa997('0x4c')],_0x1999c8['ticketId']));logger[_0xa997('0x21')](util['format']('['+_0x5cf015[_0xa997('0x22')]()+']\x20Call\x20direction:\x20%s',_0x5cf015));if(_0x5cf015!==_0xa997('0x58')&&_0x2710e6[_0xa997('0x6a')]){logger['info']('['+_0x5cf015[_0xa997('0x22')]()+']',_0xa997('0x6b'));emit(_0x276ecc[_0xa997('0xa')],_0x68f9e[_0xa997('0x6c')],_0x2710e6[_0xa997('0x4c')],_0x1999c8[_0xa997('0x6d')]);}})[_0xa997('0x14')](function(_0x3074ce){logger[_0xa997('0x15')]('['+_0x5cf015['toUpperCase']()+_0xa997('0x6e'),_0x3074ce[_0xa997('0x17')]);console['error'](_0xa997('0x6f'),_0x3074ce);});}; \ 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 0debf82..07f1d73 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 _0x4ceb=['length','Agent\x20found!','find','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','%s/api/v2/contacts','Enduser\x20created.','apiKey','toString','base64','debug','stringify','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','push','variable','variableName','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','%s/helpdesk/tickets/%d','catch','error','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','lastevent','toUpperCase','The\x20Ticket\x20ID\x20is:','lodash','request-promise','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','remoteUri','POST','then','Ticket\x20created!','format','%s/api/v2/agents'];(function(_0x1d695f,_0x4d8dc8){var _0x5987b5=function(_0x48dca0){while(--_0x48dca0){_0x1d695f['push'](_0x1d695f['shift']());}};_0x5987b5(++_0x4d8dc8);}(_0x4ceb,0x18c));var _0xb4ce=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x4ceb[_0x243b2f];return _0xcb3c2d;};'use strict';var _=require(_0xb4ce('0x0'));var rp=require(_0xb4ce('0x1'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xb4ce('0x2'));var config=require(_0xb4ce('0x3'));var logger=require(_0xb4ce('0x4'))(_0xb4ce('0x5'));config[_0xb4ce('0x6')]=_[_0xb4ce('0x7')](config[_0xb4ce('0x6')],{'host':_0xb4ce('0x8'),'port':0x18eb});var io=require(_0xb4ce('0x9'))(new Redis(config[_0xb4ce('0x6')]));var headers={'Content-Type':_0xb4ce('0xa'),'Accept':'application/json'};function emit(_0x27b5c8,_0x19815a,_0x22bbc3){io['to'](_0x27b5c8)[_0xb4ce('0xb')](_0x19815a,_0x22bbc3);}function getTicket(_0x273813,_0x382efa,_0x5ede5d,_0x3ac813,_0xcf3c8a){logger[_0xb4ce('0xc')](_0xb4ce('0xd'));var _0x328c17=_[_0xb4ce('0xe')]({'responder_id':_0x382efa['id'],'requester_id':_0x5ede5d['id'],'name':util['format'](_0xb4ce('0xf'),_0xcf3c8a[_0xb4ce('0x10')]),'phone':_0xcf3c8a[_0xb4ce('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xb4ce('0x12')](_0x3ac813[_0xb4ce('0x13')],_0xcf3c8a,'\x20'),'description':intUtil[_0xb4ce('0x12')](_0x3ac813['Descriptions'],_0xcf3c8a,_0xb4ce('0x14')),'tags':getTags(_0x3ac813[_0xb4ce('0x15')],_0xb4ce('0x16'))},getCustomFields(_0x3ac813[_0xb4ce('0x17')],_0xcf3c8a));_0x328c17[_0xb4ce('0x18')]=_[_0xb4ce('0x19')](_[_0xb4ce('0x1a')](_0x328c17['custom_fields'],'id'),_0xb4ce('0x1b'));return request({'uri':util['format']('%s/api/v2/tickets',_0x273813[_0xb4ce('0x1c')]),'method':_0xb4ce('0x1d'),'body':_0x328c17})[_0xb4ce('0x1e')](function(_0x286a72){logger[_0xb4ce('0xc')](_0xb4ce('0x1f'));return _0x286a72;});}function getUser(_0x2757fa,_0x505b73){if(intUtil['validateEmail'](_0x505b73)){return request({'uri':util[_0xb4ce('0x20')](_0xb4ce('0x21'),_0x2757fa[_0xb4ce('0x1c')]),'qs':{'email':_0x505b73}})['then'](function(_0x1dffd){if(_0x1dffd[_0xb4ce('0x22')]){logger['info'](_0xb4ce('0x23'));return _[_0xb4ce('0x24')](_0x1dffd,function(_0x19df4e){return _0x19df4e['contact'][_0xb4ce('0x25')]===_0x505b73;});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xb4ce('0x20')](_0xb4ce('0x26'),_0x2757fa['remoteUri'])})['then'](function(_0xbb629f){logger[_0xb4ce('0xc')](_0xb4ce('0x27'));return _0xbb629f;});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xb4ce('0x20')](_0xb4ce('0x26'),_0x2757fa[_0xb4ce('0x1c')])})['then'](function(_0x5ddf0c){logger[_0xb4ce('0xc')]('Admin\x20account\x20selected.');return _0x5ddf0c;});}}function getEndUser(_0x505252,_0x2d1ee9,_0x5f01ad){logger[_0xb4ce('0xc')]('Searching\x20enduser\x20with\x20phone',_0x5f01ad);return request({'uri':util[_0xb4ce('0x20')]('%s/api/v2/contacts',_0x505252[_0xb4ce('0x1c')]),'qs':{'phone':_0x5f01ad}})[_0xb4ce('0x1e')](function(_0x4fddb1){if(_0x4fddb1['length']){logger[_0xb4ce('0xc')]('Enduser\x20found!');return _[_0xb4ce('0x24')](_0x4fddb1,{'phone':_0x5f01ad});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xb4ce('0x20')](_0xb4ce('0x28'),_0x505252[_0xb4ce('0x1c')]),'method':'POST','body':{'name':_0x2d1ee9,'phone':_0x5f01ad}})[_0xb4ce('0x1e')](function(_0x1f411f){logger['info'](_0xb4ce('0x29'));return _0x1f411f;});}});}function getAuth(_0x123a0f){return util[_0xb4ce('0x20')]('Basic\x20%s',new Buffer(_0x123a0f[_0xb4ce('0x2a')]+':X')[_0xb4ce('0x2b')](_0xb4ce('0x2c')));}function request(_0x101cd3){logger[_0xb4ce('0x2d')]('[HTTP]',JSON[_0xb4ce('0x2e')](_0x101cd3));return rp(_['defaults'](_0x101cd3,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x12c47b,_0x59f17a){var _0x3d6210=[];if(_0x12c47b&&_0x12c47b[_0xb4ce('0x22')]>0x0){_0x3d6210=_['map'](_0x12c47b,_0x59f17a);}return _0x3d6210;}function getCustomFields(_0x162cd4,_0xeb6f04){var _0x5df760=[];var _0x5a22a7={'custom_fields':[]};if(_0x162cd4[_0xb4ce('0x22')]>0x0){_[_0xb4ce('0x2f')](_0x162cd4,function(_0x16df3e){if(_[_0xb4ce('0x30')]([_0xb4ce('0x31'),_0xb4ce('0x32')],_0x16df3e[_0xb4ce('0x33')])&&_0x16df3e[_0xb4ce('0x34')]&&!_0x16df3e[_0xb4ce('0x35')]){_0x5a22a7[_0x16df3e[_0xb4ce('0x34')][_0xb4ce('0x36')]()]=_0x16df3e[_0xb4ce('0x37')][_0xb4ce('0x2b')]();}else if(_[_0xb4ce('0x30')]([_0xb4ce('0x31'),_0xb4ce('0x32')],_0x16df3e[_0xb4ce('0x33')])&&_0x16df3e[_0xb4ce('0x38')]&&_0x16df3e['customField']){_0x5a22a7[_0xb4ce('0x18')][_0xb4ce('0x39')]({'id':_0x16df3e['idField'],'value':_0x16df3e[_0xb4ce('0x37')][_0xb4ce('0x2b')]()});}else if(_0x16df3e[_0xb4ce('0x33')]===_0xb4ce('0x3a')&&_0x16df3e[_0xb4ce('0x3b')]&&_0x16df3e[_0xb4ce('0x38')]&&_0x16df3e[_0xb4ce('0x35')]){_0xeb6f04[_0x16df3e[_0xb4ce('0x3b')]]&&_0x5a22a7[_0xb4ce('0x18')][_0xb4ce('0x39')]({'id':_0x16df3e['idField'],'value':_0xeb6f04[_0x16df3e['variableName']][_0xb4ce('0x2b')]()});}else if(_0x16df3e[_0xb4ce('0x33')]==='customVariable'&&_0x16df3e['Variable']&&_0x16df3e[_0xb4ce('0x3c')]['name']&&_0x16df3e[_0xb4ce('0x38')]&&_0x16df3e[_0xb4ce('0x35')]){_0xeb6f04[_0x16df3e[_0xb4ce('0x3c')][_0xb4ce('0x16')]['toLowerCase']()]&&_0x5a22a7['custom_fields']['push']({'id':_0x16df3e[_0xb4ce('0x38')],'value':_0xeb6f04[_0x16df3e[_0xb4ce('0x3c')][_0xb4ce('0x16')][_0xb4ce('0x36')]()][_0xb4ce('0x2b')]()});}});}return _0x5a22a7;}exports['queue']=function(_0x308d20,_0x470117,_0x79d486,_0x11ec28,_0x2da364,_0x56320f){var _0x49dad6,_0x48cc09;_0x56320f[_0xb4ce('0x1c')]=intUtil[_0xb4ce('0x3d')](_0x56320f[_0xb4ce('0x1c')]);_0x56320f['serverUrl']=intUtil[_0xb4ce('0x3d')](_0x56320f[_0xb4ce('0x3e')]);if(_0x2da364&&_0x2da364[_0xb4ce('0x3f')]){logger[_0xb4ce('0xc')](_0xb4ce('0x40'),_0xb4ce('0x41'));_0x470117[_0xb4ce('0x42')]=util[_0xb4ce('0x20')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x56320f[_0xb4ce('0x3e')],_0x470117[_0xb4ce('0x43')],md5(_0x470117['uniqueid']));}else{_0x470117[_0xb4ce('0x42')]='';}headers[_0xb4ce('0x44')]=getAuth(_0x56320f);return getUser(_0x56320f,_0x11ec28[_0xb4ce('0x25')])[_0xb4ce('0x1e')](function(_0x32ef15){_0x49dad6=_0x32ef15;logger[_0xb4ce('0xc')](_0xb4ce('0x45'),_0x49dad6['id']);return getEndUser(_0x56320f,_0x470117[_0xb4ce('0x10')],_0x470117[_0xb4ce('0x11')]);})['then'](function(_0xf01e0b){_0x48cc09=_0xf01e0b;logger[_0xb4ce('0xc')](_0xb4ce('0x46'),_0x48cc09['id']);return getTicket(_0x56320f,_0x49dad6,_0x48cc09,_0x79d486,_0x470117);})['then'](function(_0x34b3f9){if(_0x34b3f9&&_0x34b3f9['id']){logger['info']('Ticket\x20created!');logger[_0xb4ce('0xc')]('The\x20Ticket\x20ID\x20is:',_0x34b3f9['id']);logger[_0xb4ce('0xc')](_0xb4ce('0x40'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xb4ce('0x20')]('user:%s',_0x11ec28[_0xb4ce('0x16')]),'trigger:browser:url',{'uri':util['format'](_0xb4ce('0x47'),_0x56320f[_0xb4ce('0x1c')],_0x34b3f9['id'])});}})[_0xb4ce('0x48')](function(_0x1de5eb){logger[_0xb4ce('0x49')](_0xb4ce('0x40'),JSON['stringify'](_0x1de5eb));});};exports['outbound']=function(_0x228d51,_0xbfa6a9,_0xf16b3a,_0x41c73f,_0x558ba4,_0x1f6bc1,_0x214da3){var _0x9554ae,_0x1309c3;_0x1f6bc1[_0xb4ce('0x1c')]=intUtil[_0xb4ce('0x3d')](_0x1f6bc1[_0xb4ce('0x1c')]);_0x1f6bc1['serverUrl']=intUtil[_0xb4ce('0x3d')](_0x1f6bc1[_0xb4ce('0x3e')]);if(_0x214da3&&_0x214da3['recordingFormat']&&_0x214da3[_0xb4ce('0x4a')]!==_0xb4ce('0x4b')){logger[_0xb4ce('0xc')](_0xb4ce('0x4c'),'Recording\x20is\x20enabled!');_0xbfa6a9[_0xb4ce('0x42')]=util[_0xb4ce('0x20')](_0xb4ce('0x4d'),_0x1f6bc1['serverUrl'],_0xbfa6a9[_0xb4ce('0x43')],md5(_0xbfa6a9['uniqueid']));}headers[_0xb4ce('0x44')]=getAuth(_0x1f6bc1);return getUser(_0x1f6bc1,_0x41c73f[_0xb4ce('0x25')])['then'](function(_0x23bb67){_0x9554ae=_0x23bb67;logger['info']('The\x20User\x20ID\x20is:',_0x9554ae['id']);return getEndUser(_0x1f6bc1,_0xbfa6a9[_0xb4ce('0x4e')],_0xbfa6a9[_0xb4ce('0x4f')]);})[_0xb4ce('0x1e')](function(_0x1a4fe6){_0x1309c3=_0x1a4fe6;logger[_0xb4ce('0xc')](_0xb4ce('0x46'),_0x1309c3['id']);return getTicket(_0x1f6bc1,_0x9554ae,_0x1309c3,_0xf16b3a,_0xbfa6a9);})[_0xb4ce('0x1e')](function(_0x193f1c){if(_0x193f1c&&_0x193f1c['id']){logger[_0xb4ce('0xc')](_0xb4ce('0x1f'));logger[_0xb4ce('0xc')]('The\x20Ticket\x20ID\x20is:',_0x193f1c['id']);logger['info'](_0xb4ce('0x4c'),_0xb4ce('0x50'));emit(util[_0xb4ce('0x20')](_0xb4ce('0x51'),_0x41c73f[_0xb4ce('0x16')]),_0xb4ce('0x52'),{'uri':util[_0xb4ce('0x20')](_0xb4ce('0x47'),_0x1f6bc1['remoteUri'],_0x193f1c['id'])});}})[_0xb4ce('0x48')](function(_0x391353){logger[_0xb4ce('0x49')]('[OUTBOUND]',JSON[_0xb4ce('0x2e')](_0x391353));});};exports['unmanaged']=function(_0x9cf53c,_0x2812d9,_0x1de57b,_0x460c6a,_0x18d6d9,_0x48838a){var _0x5540c6,_0x1c60d0;_0x48838a[_0xb4ce('0x1c')]=intUtil[_0xb4ce('0x3d')](_0x48838a[_0xb4ce('0x1c')]);_0x48838a[_0xb4ce('0x3e')]=intUtil['stripTrailingSlash'](_0x48838a[_0xb4ce('0x3e')]);if(_0x18d6d9&&_0x18d6d9[_0xb4ce('0x3f')]){logger[_0xb4ce('0xc')]('['+_0x2812d9[_0xb4ce('0x53')][_0xb4ce('0x54')]()+']','Recording\x20is\x20enabled!');_0x2812d9[_0xb4ce('0x42')]=util[_0xb4ce('0x20')](_0xb4ce('0x4d'),_0x48838a['serverUrl'],_0x2812d9[_0xb4ce('0x43')],md5(_0x2812d9[_0xb4ce('0x43')]));}else{_0x2812d9['recordingURL']='';}headers[_0xb4ce('0x44')]=getAuth(_0x48838a);return getUser(_0x48838a,'')[_0xb4ce('0x1e')](function(_0x6c78){_0x5540c6=_0x6c78;logger[_0xb4ce('0xc')](_0xb4ce('0x45'),_0x5540c6['id']);return getEndUser(_0x48838a,_0x2812d9[_0xb4ce('0x10')],_0x2812d9[_0xb4ce('0x11')]);})[_0xb4ce('0x1e')](function(_0x267dde){_0x1c60d0=_0x267dde;logger['info']('The\x20Enduser\x20ID\x20is:',_0x1c60d0['id']);return getTicket(_0x48838a,_0x5540c6,_0x1c60d0,_0x1de57b,_0x2812d9);})[_0xb4ce('0x1e')](function(_0x3075a1){if(_0x3075a1){logger[_0xb4ce('0xc')](_0xb4ce('0x1f'));logger[_0xb4ce('0xc')](_0xb4ce('0x55'),_0x3075a1['id']);}})[_0xb4ce('0x48')](function(_0x4571e3){logger[_0xb4ce('0x49')]('['+_0x2812d9[_0xb4ce('0x53')][_0xb4ce('0x54')]()+']',JSON[_0xb4ce('0x2e')](_0x4571e3));});}; \ No newline at end of file +var _0x4382=['destcalleridnum','Ticket\x20created!','%s/helpdesk/tickets/%d','error','unmanaged','monitor_format','lastevent','Recording\x20is\x20enabled!','toUpperCase','lodash','md5','util','ioredis','./util','../../../../config/logger','freshdesk','redis','defaults','socket.io-emitter','application/json','info','calleridname','calleridnum','getString','Subjects','
','name','Fields','custom_fields','mapValues','value','format','%s/api/v2/tickets','POST','validateEmail','%s/api/v2/agents','remoteUri','then','length','Agent\x20found!','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','apiKey','base64','debug','[HTTP]','stringify','map','forEach','includes','string','picklist','type','nameField','customField','content','idField','push','variable','variableName','toString','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','[QUEUE]','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname'];(function(_0x23c27a,_0x31cd89){var _0x2aa7f1=function(_0x1d0aa5){while(--_0x1d0aa5){_0x23c27a['push'](_0x23c27a['shift']());}};_0x2aa7f1(++_0x31cd89);}(_0x4382,0x1df));var _0x2438=function(_0x5b3fb9,_0x71d8cc){_0x5b3fb9=_0x5b3fb9-0x0;var _0x4528ce=_0x4382[_0x5b3fb9];return _0x4528ce;};'use strict';var _=require(_0x2438('0x0'));var rp=require('request-promise');var md5=require(_0x2438('0x1'));var util=require(_0x2438('0x2'));var Redis=require(_0x2438('0x3'));var intUtil=require(_0x2438('0x4'));var config=require('../../../../config/environment');var logger=require(_0x2438('0x5'))(_0x2438('0x6'));config[_0x2438('0x7')]=_[_0x2438('0x8')](config[_0x2438('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x2438('0x9'))(new Redis(config['redis']));var headers={'Content-Type':'application/json','Accept':_0x2438('0xa')};function emit(_0x551a8f,_0x5a8420,_0x283f81){io['to'](_0x551a8f)['emit'](_0x5a8420,_0x283f81);}function getTicket(_0x116fc8,_0xe50bfd,_0x3f9f9d,_0x50dfaa,_0x51e62b){logger[_0x2438('0xb')]('Creating\x20new\x20ticket...');var _0x1aebbe=_['merge']({'responder_id':_0xe50bfd['id'],'requester_id':_0x3f9f9d['id'],'name':util['format']('Caller\x20-\x20%s',_0x51e62b[_0x2438('0xc')]),'phone':_0x51e62b[_0x2438('0xd')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x2438('0xe')](_0x50dfaa[_0x2438('0xf')],_0x51e62b,'\x20'),'description':intUtil[_0x2438('0xe')](_0x50dfaa['Descriptions'],_0x51e62b,_0x2438('0x10')),'tags':getTags(_0x50dfaa['Tags'],_0x2438('0x11'))},getCustomFields(_0x50dfaa[_0x2438('0x12')],_0x51e62b));_0x1aebbe[_0x2438('0x13')]=_[_0x2438('0x14')](_['keyBy'](_0x1aebbe[_0x2438('0x13')],'id'),_0x2438('0x15'));return request({'uri':util[_0x2438('0x16')](_0x2438('0x17'),_0x116fc8['remoteUri']),'method':_0x2438('0x18'),'body':_0x1aebbe})['then'](function(_0x269ea1){logger[_0x2438('0xb')]('Ticket\x20created!');return _0x269ea1;});}function getUser(_0x414a79,_0x11a661){if(intUtil[_0x2438('0x19')](_0x11a661)){return request({'uri':util['format'](_0x2438('0x1a'),_0x414a79[_0x2438('0x1b')]),'qs':{'email':_0x11a661}})[_0x2438('0x1c')](function(_0x6e42eb){if(_0x6e42eb[_0x2438('0x1d')]){logger[_0x2438('0xb')](_0x2438('0x1e'));return _[_0x2438('0x1f')](_0x6e42eb,function(_0x4b17dc){return _0x4b17dc[_0x2438('0x20')]['email']===_0x11a661;});}else{logger[_0x2438('0xb')](_0x2438('0x21'));return request({'uri':util[_0x2438('0x16')]('%s/api/v2/agents/me',_0x414a79[_0x2438('0x1b')])})[_0x2438('0x1c')](function(_0x222187){logger[_0x2438('0xb')]('Admin\x20account\x20selected.');return _0x222187;});}});}else{logger[_0x2438('0xb')](_0x2438('0x22'));return request({'uri':util[_0x2438('0x16')](_0x2438('0x23'),_0x414a79[_0x2438('0x1b')])})['then'](function(_0x282ef2){logger[_0x2438('0xb')](_0x2438('0x24'));return _0x282ef2;});}}function getEndUser(_0x20a766,_0x4186db,_0x2cc377){logger['info'](_0x2438('0x25'),_0x2cc377);return request({'uri':util['format'](_0x2438('0x26'),_0x20a766[_0x2438('0x1b')]),'qs':{'phone':_0x2cc377}})[_0x2438('0x1c')](function(_0x499868){if(_0x499868[_0x2438('0x1d')]){logger[_0x2438('0xb')](_0x2438('0x27'));return _[_0x2438('0x1f')](_0x499868,{'phone':_0x2cc377});}else{logger[_0x2438('0xb')](_0x2438('0x28'));return request({'uri':util['format'](_0x2438('0x26'),_0x20a766[_0x2438('0x1b')]),'method':_0x2438('0x18'),'body':{'name':_0x4186db,'phone':_0x2cc377}})[_0x2438('0x1c')](function(_0x1c694a){logger[_0x2438('0xb')](_0x2438('0x29'));return _0x1c694a;});}});}function getAuth(_0x21f643){return util[_0x2438('0x16')]('Basic\x20%s',new Buffer(_0x21f643[_0x2438('0x2a')]+':X')['toString'](_0x2438('0x2b')));}function request(_0x2d686e){logger[_0x2438('0x2c')](_0x2438('0x2d'),JSON[_0x2438('0x2e')](_0x2d686e));return rp(_[_0x2438('0x8')](_0x2d686e,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x5b01ed,_0x5225c0){var _0x338f4e=[];if(_0x5b01ed&&_0x5b01ed[_0x2438('0x1d')]>0x0){_0x338f4e=_[_0x2438('0x2f')](_0x5b01ed,_0x5225c0);}return _0x338f4e;}function getCustomFields(_0x49d119,_0x314549){var _0x21b019=[];var _0x495434={'custom_fields':[]};if(_0x49d119[_0x2438('0x1d')]>0x0){_[_0x2438('0x30')](_0x49d119,function(_0x38c68e){if(_[_0x2438('0x31')]([_0x2438('0x32'),_0x2438('0x33')],_0x38c68e[_0x2438('0x34')])&&_0x38c68e[_0x2438('0x35')]&&!_0x38c68e[_0x2438('0x36')]){_0x495434[_0x38c68e[_0x2438('0x35')]['toLowerCase']()]=_0x38c68e[_0x2438('0x37')]['toString']();}else if(_[_0x2438('0x31')](['string','picklist'],_0x38c68e[_0x2438('0x34')])&&_0x38c68e[_0x2438('0x38')]&&_0x38c68e[_0x2438('0x36')]){_0x495434[_0x2438('0x13')][_0x2438('0x39')]({'id':_0x38c68e[_0x2438('0x38')],'value':_0x38c68e[_0x2438('0x37')]['toString']()});}else if(_0x38c68e[_0x2438('0x34')]===_0x2438('0x3a')&&_0x38c68e[_0x2438('0x3b')]&&_0x38c68e[_0x2438('0x38')]&&_0x38c68e[_0x2438('0x36')]){_0x314549[_0x38c68e[_0x2438('0x3b')]]&&_0x495434['custom_fields'][_0x2438('0x39')]({'id':_0x38c68e[_0x2438('0x38')],'value':_0x314549[_0x38c68e[_0x2438('0x3b')]][_0x2438('0x3c')]()});}else if(_0x38c68e[_0x2438('0x34')]===_0x2438('0x3d')&&_0x38c68e['Variable']&&_0x38c68e[_0x2438('0x3e')]['name']&&_0x38c68e[_0x2438('0x38')]&&_0x38c68e[_0x2438('0x36')]){_0x314549[_0x38c68e[_0x2438('0x3e')][_0x2438('0x11')][_0x2438('0x3f')]()]&&_0x495434[_0x2438('0x13')]['push']({'id':_0x38c68e[_0x2438('0x38')],'value':_0x314549[_0x38c68e[_0x2438('0x3e')][_0x2438('0x11')][_0x2438('0x3f')]()][_0x2438('0x3c')]()});}});}return _0x495434;}exports[_0x2438('0x40')]=function(_0x5ce581,_0x52fc87,_0x5767fe,_0x2e6b36,_0x3f3479,_0x28aa86){var _0x45472,_0x3b0551;_0x28aa86[_0x2438('0x1b')]=intUtil[_0x2438('0x41')](_0x28aa86[_0x2438('0x1b')]);_0x28aa86[_0x2438('0x42')]=intUtil['stripTrailingSlash'](_0x28aa86[_0x2438('0x42')]);if(_0x3f3479&&_0x3f3479['monitor_format']){logger[_0x2438('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x52fc87[_0x2438('0x43')]=util[_0x2438('0x16')](_0x2438('0x44'),_0x28aa86[_0x2438('0x42')],_0x52fc87[_0x2438('0x45')],md5(_0x52fc87[_0x2438('0x45')]));}else{_0x52fc87[_0x2438('0x43')]='';}headers[_0x2438('0x46')]=getAuth(_0x28aa86);return getUser(_0x28aa86,_0x2e6b36[_0x2438('0x47')])['then'](function(_0x311a6f){_0x45472=_0x311a6f;logger[_0x2438('0xb')](_0x2438('0x48'),_0x45472['id']);return getEndUser(_0x28aa86,_0x52fc87[_0x2438('0xc')],_0x52fc87['calleridnum']);})[_0x2438('0x1c')](function(_0xc69e13){_0x3b0551=_0xc69e13;logger[_0x2438('0xb')](_0x2438('0x49'),_0x3b0551['id']);return getTicket(_0x28aa86,_0x45472,_0x3b0551,_0x5767fe,_0x52fc87);})[_0x2438('0x1c')](function(_0x25b9ae){if(_0x25b9ae&&_0x25b9ae['id']){logger['info']('Ticket\x20created!');logger[_0x2438('0xb')](_0x2438('0x4a'),_0x25b9ae['id']);logger['info']('[QUEUE]',_0x2438('0x4b'));emit(util[_0x2438('0x16')](_0x2438('0x4c'),_0x2e6b36[_0x2438('0x11')]),_0x2438('0x4d'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x28aa86[_0x2438('0x1b')],_0x25b9ae['id'])});}})[_0x2438('0x4e')](function(_0x75c7e0){logger['error'](_0x2438('0x4f'),JSON[_0x2438('0x2e')](_0x75c7e0));});};exports[_0x2438('0x50')]=function(_0x5a1d88,_0x914847,_0x243a7e,_0x549623,_0x514c9d,_0x322562,_0x1160a2){var _0x23f3f3,_0x55db7a;_0x322562[_0x2438('0x1b')]=intUtil[_0x2438('0x41')](_0x322562[_0x2438('0x1b')]);_0x322562['serverUrl']=intUtil[_0x2438('0x41')](_0x322562[_0x2438('0x42')]);if(_0x1160a2&&_0x1160a2[_0x2438('0x51')]&&_0x1160a2[_0x2438('0x51')]!==_0x2438('0x52')){logger['info'](_0x2438('0x53'),'Recording\x20is\x20enabled!');_0x914847[_0x2438('0x43')]=util[_0x2438('0x16')](_0x2438('0x44'),_0x322562['serverUrl'],_0x914847[_0x2438('0x45')],md5(_0x914847[_0x2438('0x45')]));}headers[_0x2438('0x46')]=getAuth(_0x322562);return getUser(_0x322562,_0x549623[_0x2438('0x47')])['then'](function(_0x4d846c){_0x23f3f3=_0x4d846c;logger['info'](_0x2438('0x48'),_0x23f3f3['id']);return getEndUser(_0x322562,_0x914847[_0x2438('0x54')],_0x914847[_0x2438('0x55')]);})[_0x2438('0x1c')](function(_0x4285b9){_0x55db7a=_0x4285b9;logger[_0x2438('0xb')](_0x2438('0x49'),_0x55db7a['id']);return getTicket(_0x322562,_0x23f3f3,_0x55db7a,_0x243a7e,_0x914847);})[_0x2438('0x1c')](function(_0x322c02){if(_0x322c02&&_0x322c02['id']){logger[_0x2438('0xb')](_0x2438('0x56'));logger[_0x2438('0xb')](_0x2438('0x4a'),_0x322c02['id']);logger[_0x2438('0xb')](_0x2438('0x53'),_0x2438('0x4b'));emit(util['format']('user:%s',_0x549623['name']),_0x2438('0x4d'),{'uri':util[_0x2438('0x16')](_0x2438('0x57'),_0x322562[_0x2438('0x1b')],_0x322c02['id'])});}})[_0x2438('0x4e')](function(_0x2bde1f){logger[_0x2438('0x58')](_0x2438('0x53'),JSON[_0x2438('0x2e')](_0x2bde1f));});};exports[_0x2438('0x59')]=function(_0x43f1ca,_0x3d2c0d,_0x2267fb,_0x446490,_0x349180,_0x4b1df8){var _0x96942f,_0x271a5d;_0x4b1df8[_0x2438('0x1b')]=intUtil['stripTrailingSlash'](_0x4b1df8[_0x2438('0x1b')]);_0x4b1df8['serverUrl']=intUtil[_0x2438('0x41')](_0x4b1df8['serverUrl']);if(_0x349180&&_0x349180[_0x2438('0x5a')]){logger[_0x2438('0xb')]('['+_0x3d2c0d[_0x2438('0x5b')]['toUpperCase']()+']',_0x2438('0x5c'));_0x3d2c0d[_0x2438('0x43')]=util[_0x2438('0x16')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4b1df8[_0x2438('0x42')],_0x3d2c0d['uniqueid'],md5(_0x3d2c0d[_0x2438('0x45')]));}else{_0x3d2c0d['recordingURL']='';}headers['Authorization']=getAuth(_0x4b1df8);return getUser(_0x4b1df8,'')[_0x2438('0x1c')](function(_0x3845dd){_0x96942f=_0x3845dd;logger[_0x2438('0xb')]('The\x20User\x20ID\x20is:',_0x96942f['id']);return getEndUser(_0x4b1df8,_0x3d2c0d[_0x2438('0xc')],_0x3d2c0d['calleridnum']);})['then'](function(_0x52c6ff){_0x271a5d=_0x52c6ff;logger[_0x2438('0xb')]('The\x20Enduser\x20ID\x20is:',_0x271a5d['id']);return getTicket(_0x4b1df8,_0x96942f,_0x271a5d,_0x2267fb,_0x3d2c0d);})['then'](function(_0x136f8b){if(_0x136f8b){logger[_0x2438('0xb')](_0x2438('0x56'));logger[_0x2438('0xb')](_0x2438('0x4a'),_0x136f8b['id']);}})['catch'](function(_0x527620){logger[_0x2438('0x58')]('['+_0x3d2c0d[_0x2438('0x5b')][_0x2438('0x5d')]()+']',JSON[_0x2438('0x2e')](_0x527620));});}; \ 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 d320cf9..ec3f714 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 _0xec31=['unmanaged','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','md5','moment','bluebird','ioredis','./util','freshsales','defaults','redis','GET','/api/selector/owners','headers','info','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','message','Getting\x20user\x20list','agentEmail','userEmail','userId','Admin\x20selected','toUpperCase','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','ticketId','task','Task\x20created:','/contacts/','emit','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','serverUrl','username','toLowerCase','outbound','calleridnum','callDirection'];(function(_0x397454,_0x11bf1a){var _0x29ef2e=function(_0x2be629){while(--_0x2be629){_0x397454['push'](_0x397454['shift']());}};_0x29ef2e(++_0x11bf1a);}(_0xec31,0x155));var _0x1ec3=function(_0x20d952,_0x935281){_0x20d952=_0x20d952-0x0;var _0x1563b4=_0xec31[_0x20d952];return _0x1563b4;};'use strict';var _=require(_0x1ec3('0x0'));var rp=require('request-promise');var md5=require(_0x1ec3('0x1'));var util=require('util');var moment=require(_0x1ec3('0x2'));var Promise=require(_0x1ec3('0x3'));var Redis=require(_0x1ec3('0x4'));var intUtil=require(_0x1ec3('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x1ec3('0x6'));config['redis']=_[_0x1ec3('0x7')](config[_0x1ec3('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1ec3('0x8')]));function getAdminId(_0x2a5e76,_0x5b2c36,_0x518ff5,_0xb231ec){return new Promise(function(_0x52d9fd,_0x968e61){var _0x118bec=![];var _0x3deb65={'method':_0x1ec3('0x9'),'uri':_0xb231ec+_0x1ec3('0xa'),'json':!![]};_0x3deb65[_0x1ec3('0xb')]=_0x518ff5;logger[_0x1ec3('0xc')]('Getting\x20admin\x20information');return rp(_0x3deb65)[_0x1ec3('0xd')](function(_0x23c896){if(_0x23c896){var _0x130a64=_0x23c896[_0x1ec3('0xe')];var _0x4816be=null;for(_0x4816be=0x0;_0x4816be<_0x130a64[_0x1ec3('0xf')];_0x4816be++){if(_0x130a64[_0x4816be][_0x1ec3('0x10')]===_0x2a5e76[_0x1ec3('0x11')]){_0x2a5e76[_0x1ec3('0x12')]=_0x130a64[_0x4816be]['id'];_0x118bec=!![];}}if(_0x118bec){logger[_0x1ec3('0xc')](_0x1ec3('0x13'),_0x2a5e76[_0x1ec3('0x12')]);_0x52d9fd(_0x2a5e76);}else{_0x968e61({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x968e61({'statusCode':0x194,'message':_0x1ec3('0x14')});}})[_0x1ec3('0x15')](function(_0x7f7d6){logger[_0x1ec3('0x16')]('['+[_0x5b2c36['toUpperCase']()]+']',_0x7f7d6[_0x1ec3('0x17')]);_0x968e61(_0x7f7d6);});});}function getUser(_0x466fd7,_0x62a3c2,_0x4defc2){return function(_0x2e59cb){return new Promise(function(_0x1961e9,_0x2566c3){var _0x2687d3={'method':_0x1ec3('0x9'),'uri':_0x4defc2+_0x1ec3('0xa'),'json':!![]};_0x2687d3[_0x1ec3('0xb')]=_0x62a3c2;logger[_0x1ec3('0xc')](_0x1ec3('0x18'));return rp(_0x2687d3)[_0x1ec3('0xd')](function(_0x2e36f9){if(_0x2e36f9){var _0x21362b=_0x2e36f9[_0x1ec3('0xe')];var _0x600fa4=![];var _0x3caa82=null;if(_0x2e59cb[_0x1ec3('0x19')]!==null){logger[_0x1ec3('0xc')]('Getting\x20user\x20with\x20email',_0x2e59cb[_0x1ec3('0x19')]);_0x2e59cb[_0x1ec3('0x1a')]=_0x2e59cb[_0x1ec3('0x19')];for(_0x3caa82=0x0;_0x3caa82<_0x21362b['length'];_0x3caa82++){if(_0x21362b[_0x3caa82][_0x1ec3('0x10')]===_0x2e59cb['agentEmail']){_0x600fa4=!![];_0x2e59cb['userId']=_0x21362b[_0x3caa82]['id'];logger[_0x1ec3('0xc')]('User\x20found:',_0x2e59cb[_0x1ec3('0x1b')]);}}}if(!_0x600fa4){logger[_0x1ec3('0xc')](_0x1ec3('0x1c'));_0x2e59cb[_0x1ec3('0x1a')]=_0x2e59cb[_0x1ec3('0x11')];_0x2e59cb['userId']=_0x2e59cb['adminId'];_0x600fa4=!![];}if(_0x600fa4){_0x1961e9(_0x2e59cb);}else{_0x2566c3({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x2566c3({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x1ec3('0x15')](function(_0x14dd4c){logger[_0x1ec3('0x16')]('['+[_0x466fd7[_0x1ec3('0x1d')]()]+']',_0x14dd4c[_0x1ec3('0x17')]);_0x2566c3(_0x14dd4c);});});};}function searchContact(_0x368281,_0x1a1436,_0x465f0a,_0x181ebf){return new Promise(function(_0x2bc51b,_0x44d976){var _0x3353c8={'method':'GET','headers':_0x1a1436,'uri':_0x368281+_0x1ec3('0x1e')+_0x181ebf+_0x1ec3('0x1f')+_0x465f0a+_0x1ec3('0x20'),'json':!![]};rp(_0x3353c8)[_0x1ec3('0xd')](function(_0x8e793){var _0x4f45e9=_[_0x1ec3('0x21')](_0x8e793[_0x1ec3('0x22')]['contacts'],[_0x465f0a,_0x181ebf]);_0x2bc51b(_0x4f45e9);})[_0x1ec3('0x15')](function(_0x307401){_0x44d976(_0x307401);});});}function getEndUser(_0xbcdc1a,_0x4d92d8,_0x5cc376){return function(_0x4f59ea){return new Promise(function(_0x5d4ba0,_0xdd6df7){logger[_0x1ec3('0xc')](util[_0x1ec3('0x23')](_0x1ec3('0x24'),_0x4f59ea[_0x1ec3('0x25')]));searchContact(_0x5cc376,_0x4d92d8,_0x1ec3('0x26'),_0x4f59ea[_0x1ec3('0x25')])[_0x1ec3('0xd')](function(_0x14260f){if(_0x14260f){_0x4f59ea[_0x1ec3('0x27')]=_0x14260f['id'];logger[_0x1ec3('0xc')](_0x1ec3('0x28'),_0x4f59ea[_0x1ec3('0x27')]);return _0x5d4ba0(_0x4f59ea);}searchContact(_0x5cc376,_0x4d92d8,_0x1ec3('0x29'),_0x4f59ea[_0x1ec3('0x25')])['then'](function(_0x217ad1){if(_0x217ad1){_0x4f59ea[_0x1ec3('0x27')]=_0x217ad1['id'];logger[_0x1ec3('0xc')](_0x1ec3('0x2a'),_0x4f59ea['endUserId']);return _0x5d4ba0(_0x4f59ea);}createEndUser(_0x4f59ea,_0xbcdc1a,_0x4d92d8,_0x5cc376)['then'](function(_0x354f7d){logger['info'](_0x1ec3('0x2b'),_0x354f7d[_0x1ec3('0x27')]);return _0x5d4ba0(_0x354f7d);});});})[_0x1ec3('0x15')](function(_0xf45b49){_0xdd6df7(_0xf45b49);});});};}function createEndUser(_0xe83031,_0x11d2d4,_0xe820d6,_0x15f2fc){return new Promise(function(_0x4d078b,_0x2baf1b){var _0x321bbe=moment();var _0x4df5ab={'method':_0x1ec3('0x2c'),'uri':_0x15f2fc+_0x1ec3('0x2d'),'body':{'contact':{'last_name':_0xe83031[_0x1ec3('0x25')],'work_number':_0xe83031[_0x1ec3('0x25')],'mobile_number':_0xe83031['contactNumber'],'owner_id':_0xe83031[_0x1ec3('0x1b')],'created_at':_0x321bbe['format'](_0x1ec3('0x2e'))}},'json':!![]};_0x4df5ab[_0x1ec3('0xb')]=_0xe820d6;logger[_0x1ec3('0xc')](_0x1ec3('0x2f'));return rp(_0x4df5ab)[_0x1ec3('0xd')](function(_0x5e63f2){_0xe83031[_0x1ec3('0x27')]=_0x5e63f2['contact']['id'];_0x4d078b(_0xe83031);})[_0x1ec3('0x15')](function(_0x3be1cd){logger[_0x1ec3('0x16')]('['+[_0x11d2d4[_0x1ec3('0x1d')]()]+']',_0x3be1cd['message']);_0x2baf1b(_0x3be1cd[_0x1ec3('0x17')]);});});}function getTicket(_0x56bf7d,_0x332b79,_0x4950da,_0x4ed77b,_0x4e058c){return function(_0x385c5f){logger['info'](_0x1ec3('0x30'));return new Promise(function(_0x1b6723,_0x485480){var _0x4989a5=moment();var _0x4de419={'method':_0x1ec3('0x2c'),'uri':_0x4950da+_0x1ec3('0x31'),'body':{'title':intUtil[_0x1ec3('0x32')](_0x4ed77b[_0x1ec3('0x33')],_0x4e058c,'\x20'),'description':intUtil[_0x1ec3('0x32')](_0x4ed77b[_0x1ec3('0x34')],_0x4e058c,'\x0a'),'owner_id':_0x385c5f['userId'],'creater_id':_0x385c5f[_0x1ec3('0x12')],'targetable_id':_0x385c5f['endUserId'],'targetable_type':_0x1ec3('0x35'),'created_at':_0x4989a5[_0x1ec3('0x23')](_0x1ec3('0x2e')),'due_date':_0x4989a5['add'](0x1e,'m')[_0x1ec3('0x23')](_0x1ec3('0x2e'))},'json':!![]};_0x4de419['headers']=_0x332b79;return rp(_0x4de419)['then'](function(_0x3c82ff){_0x385c5f[_0x1ec3('0x36')]=_0x3c82ff[_0x1ec3('0x37')]['id'];logger[_0x1ec3('0xc')](_0x1ec3('0x38'),_0x385c5f[_0x1ec3('0x36')]);_0x1b6723(_0x385c5f);})[_0x1ec3('0x15')](function(_0x1ef838){logger[_0x1ec3('0x16')]('['+[_0x56bf7d[_0x1ec3('0x1d')]()]+']',_0x1ef838[_0x1ec3('0x17')]);_0x485480(_0x1ef838[_0x1ec3('0x17')]);});});};}function emit(_0x30ed20,_0x33f76a,_0x44c227){var _0x3db231={'uri':_0x30ed20+_0x1ec3('0x39')+_0x44c227};io['to'](util['format']('user:%s',_0x33f76a))[_0x1ec3('0x3a')]('trigger:browser:url',_0x3db231);}exports['cs']=function(_0x2c51a5,_0x11fd7d,_0x380bae,_0x504828,_0x2abdcc,_0x1edfc0,_0x24748e,_0x784071){var _0x5e6b02={};var _0x377cad={'Authorization':_0x1ec3('0x3b')+_0x1edfc0[_0x1ec3('0x3c')]};_0x1edfc0['remoteUri']=intUtil[_0x1ec3('0x3d')](_0x1edfc0[_0x1ec3('0x3e')]);_0x1edfc0[_0x1ec3('0x3f')]=intUtil[_0x1ec3('0x3d')](_0x1edfc0[_0x1ec3('0x3f')]);var _0x56bb8d=_0x1edfc0[_0x1ec3('0x3e')];_0x5e6b02[_0x1ec3('0x11')]=_0x1edfc0[_0x1ec3('0x40')];_0x5e6b02['contactNumber']=_0x784071[_0x1ec3('0x41')]()===_0x1ec3('0x42')?_0x11fd7d['destcalleridnum']:_0x11fd7d[_0x1ec3('0x43')];_0x5e6b02[_0x1ec3('0x44')]=_0x784071==='queue'||_0x784071===_0x1ec3('0x45')?'queue':_0x1ec3('0x42');if(_0x504828){_0x5e6b02[_0x1ec3('0x19')]=_0x504828[_0x1ec3('0x10')];}var _0x1a300b=util[_0x1ec3('0x23')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1edfc0[_0x1ec3('0x3f')],_0x11fd7d[_0x1ec3('0x46')],md5(_0x11fd7d[_0x1ec3('0x46')]));if(_0x2abdcc&&_0x2abdcc[_0x1ec3('0x47')]){logger[_0x1ec3('0xc')](_0x1ec3('0x48'),_0x1ec3('0x49'));_0x11fd7d[_0x1ec3('0x4a')]=_0x1a300b;}else if(_0x24748e&&_0x24748e[_0x1ec3('0x4b')]&&_0x24748e['recordingFormat']!==_0x1ec3('0x4c')){logger[_0x1ec3('0xc')](_0x1ec3('0x4d'),'Recording\x20is\x20enabled!');_0x11fd7d[_0x1ec3('0x4a')]=_0x1a300b;}else{_0x11fd7d[_0x1ec3('0x4a')]='';}return getAdminId(_0x5e6b02,_0x784071,_0x377cad,_0x56bb8d)[_0x1ec3('0xd')](getUser(_0x784071,_0x377cad,_0x56bb8d))[_0x1ec3('0xd')](getEndUser(_0x784071,_0x377cad,_0x56bb8d))[_0x1ec3('0xd')](getTicket(_0x784071,_0x377cad,_0x56bb8d,_0x380bae,_0x11fd7d))[_0x1ec3('0xd')](function(_0x19b760){logger[_0x1ec3('0xc')](util[_0x1ec3('0x23')](_0x1ec3('0x4e'),_0x19b760['ticketId']));if(_0x784071!=='unmanaged'){logger[_0x1ec3('0xc')]('['+[_0x784071[_0x1ec3('0x1d')]()]+']',_0x1ec3('0x4f'));emit(_0x56bb8d,_0x504828[_0x1ec3('0x50')],_0x19b760[_0x1ec3('0x27')]);}})[_0x1ec3('0x15')](function(_0x11857c){logger[_0x1ec3('0x16')]('['+[_0x784071[_0x1ec3('0x1d')]()]+_0x1ec3('0x51'),util['inspect'](_0x11857c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x1375=['username','toLowerCase','outbound','destcalleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','bluebird','ioredis','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','info','Getting\x20admin\x20information','then','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','users','agentEmail','userEmail','userId','User\x20found:','Admin\x20selected','/api/lookup?q=','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','headers','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','/api/tasks','getString','Subjects','Contact','add','ticketId','task','Task\x20created:','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl'];(function(_0x407481,_0xa676fe){var _0x44e323=function(_0x2eb700){while(--_0x2eb700){_0x407481['push'](_0x407481['shift']());}};_0x44e323(++_0xa676fe);}(_0x1375,0x1b0));var _0x5137=function(_0x46bbc5,_0x30b3c5){_0x46bbc5=_0x46bbc5-0x0;var _0x2f97bd=_0x1375[_0x46bbc5];return _0x2f97bd;};'use strict';var _=require(_0x5137('0x0'));var rp=require(_0x5137('0x1'));var md5=require(_0x5137('0x2'));var util=require(_0x5137('0x3'));var moment=require('moment');var Promise=require(_0x5137('0x4'));var Redis=require(_0x5137('0x5'));var intUtil=require(_0x5137('0x6'));var config=require(_0x5137('0x7'));var logger=require('../../../../config/logger')('freshsales');config[_0x5137('0x8')]=_[_0x5137('0x9')](config[_0x5137('0x8')],{'host':_0x5137('0xa'),'port':0x18eb});var io=require(_0x5137('0xb'))(new Redis(config['redis']));function getAdminId(_0x112697,_0x546e9a,_0x292dff,_0x2e4433){return new Promise(function(_0x421b62,_0x2090f4){var _0x4ba68b=![];var _0x419200={'method':_0x5137('0xc'),'uri':_0x2e4433+_0x5137('0xd'),'json':!![]};_0x419200['headers']=_0x292dff;logger[_0x5137('0xe')](_0x5137('0xf'));return rp(_0x419200)[_0x5137('0x10')](function(_0x4108b){if(_0x4108b){var _0xc63e54=_0x4108b['users'];var _0x595bb3=null;for(_0x595bb3=0x0;_0x595bb3<_0xc63e54[_0x5137('0x11')];_0x595bb3++){if(_0xc63e54[_0x595bb3][_0x5137('0x12')]===_0x112697[_0x5137('0x13')]){_0x112697[_0x5137('0x14')]=_0xc63e54[_0x595bb3]['id'];_0x4ba68b=!![];}}if(_0x4ba68b){logger[_0x5137('0xe')](_0x5137('0x15'),_0x112697[_0x5137('0x14')]);_0x421b62(_0x112697);}else{_0x2090f4({'statusCode':0x194,'message':_0x5137('0x16')});}}else{_0x2090f4({'statusCode':0x194,'message':_0x5137('0x16')});}})[_0x5137('0x17')](function(_0x43d34b){logger[_0x5137('0x18')]('['+[_0x546e9a[_0x5137('0x19')]()]+']',_0x43d34b[_0x5137('0x1a')]);_0x2090f4(_0x43d34b);});});}function getUser(_0x434a6d,_0xe575f2,_0x52a955){return function(_0xabf11c){return new Promise(function(_0x3646ab,_0xf603fd){var _0xdd6271={'method':'GET','uri':_0x52a955+_0x5137('0xd'),'json':!![]};_0xdd6271['headers']=_0xe575f2;logger[_0x5137('0xe')]('Getting\x20user\x20list');return rp(_0xdd6271)[_0x5137('0x10')](function(_0x5d851e){if(_0x5d851e){var _0x2acf2b=_0x5d851e[_0x5137('0x1b')];var _0x321685=![];var _0x21bb1b=null;if(_0xabf11c[_0x5137('0x1c')]!==null){logger[_0x5137('0xe')]('Getting\x20user\x20with\x20email',_0xabf11c['agentEmail']);_0xabf11c[_0x5137('0x1d')]=_0xabf11c[_0x5137('0x1c')];for(_0x21bb1b=0x0;_0x21bb1b<_0x2acf2b['length'];_0x21bb1b++){if(_0x2acf2b[_0x21bb1b][_0x5137('0x12')]===_0xabf11c[_0x5137('0x1c')]){_0x321685=!![];_0xabf11c[_0x5137('0x1e')]=_0x2acf2b[_0x21bb1b]['id'];logger[_0x5137('0xe')](_0x5137('0x1f'),_0xabf11c[_0x5137('0x1e')]);}}}if(!_0x321685){logger[_0x5137('0xe')](_0x5137('0x20'));_0xabf11c[_0x5137('0x1d')]=_0xabf11c['adminEmail'];_0xabf11c[_0x5137('0x1e')]=_0xabf11c[_0x5137('0x14')];_0x321685=!![];}if(_0x321685){_0x3646ab(_0xabf11c);}else{_0xf603fd({'statusCode':0x194,'message':_0x5137('0x16')});}}else{_0xf603fd({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x5137('0x17')](function(_0x24804e){logger[_0x5137('0x18')]('['+[_0x434a6d[_0x5137('0x19')]()]+']',_0x24804e['message']);_0xf603fd(_0x24804e);});});};}function searchContact(_0x37bf68,_0x28d40e,_0x35cfe2,_0x50d968){return new Promise(function(_0x12af2b,_0x54e03b){var _0x500951={'method':_0x5137('0xc'),'headers':_0x28d40e,'uri':_0x37bf68+_0x5137('0x21')+_0x50d968+'&f='+_0x35cfe2+_0x5137('0x22'),'json':!![]};rp(_0x500951)[_0x5137('0x10')](function(_0x11010){var _0x3b7d4b=_['find'](_0x11010['contacts'][_0x5137('0x23')],[_0x35cfe2,_0x50d968]);_0x12af2b(_0x3b7d4b);})[_0x5137('0x17')](function(_0x31dcfb){_0x54e03b(_0x31dcfb);});});}function getEndUser(_0x3e2a31,_0x20ba36,_0x4d3bf7){return function(_0x1ac56d){return new Promise(function(_0x361ffb,_0x20adca){logger[_0x5137('0xe')](util[_0x5137('0x24')](_0x5137('0x25'),_0x1ac56d[_0x5137('0x26')]));searchContact(_0x4d3bf7,_0x20ba36,_0x5137('0x27'),_0x1ac56d[_0x5137('0x26')])[_0x5137('0x10')](function(_0x2cddf0){if(_0x2cddf0){_0x1ac56d[_0x5137('0x28')]=_0x2cddf0['id'];logger[_0x5137('0xe')](_0x5137('0x29'),_0x1ac56d[_0x5137('0x28')]);return _0x361ffb(_0x1ac56d);}searchContact(_0x4d3bf7,_0x20ba36,_0x5137('0x2a'),_0x1ac56d['contactNumber'])[_0x5137('0x10')](function(_0x31c813){if(_0x31c813){_0x1ac56d['endUserId']=_0x31c813['id'];logger['info']('Contact\x20found\x20work_number:',_0x1ac56d[_0x5137('0x28')]);return _0x361ffb(_0x1ac56d);}createEndUser(_0x1ac56d,_0x3e2a31,_0x20ba36,_0x4d3bf7)[_0x5137('0x10')](function(_0x1b4b4e){logger[_0x5137('0xe')](_0x5137('0x2b'),_0x1b4b4e['endUserId']);return _0x361ffb(_0x1b4b4e);});});})['catch'](function(_0xae1166){_0x20adca(_0xae1166);});});};}function createEndUser(_0x2dde3d,_0x2d6ffb,_0x4a1d66,_0x3c9007){return new Promise(function(_0x3cbaf7,_0x3403f2){var _0x1c3e5c=moment();var _0x40cb2f={'method':_0x5137('0x2c'),'uri':_0x3c9007+_0x5137('0x2d'),'body':{'contact':{'last_name':_0x2dde3d[_0x5137('0x26')],'work_number':_0x2dde3d[_0x5137('0x26')],'mobile_number':_0x2dde3d[_0x5137('0x26')],'owner_id':_0x2dde3d[_0x5137('0x1e')],'created_at':_0x1c3e5c[_0x5137('0x24')](_0x5137('0x2e'))}},'json':!![]};_0x40cb2f[_0x5137('0x2f')]=_0x4a1d66;logger['info'](_0x5137('0x30'));return rp(_0x40cb2f)['then'](function(_0x42b611){_0x2dde3d[_0x5137('0x28')]=_0x42b611[_0x5137('0x31')]['id'];_0x3cbaf7(_0x2dde3d);})[_0x5137('0x17')](function(_0x10d492){logger[_0x5137('0x18')]('['+[_0x2d6ffb[_0x5137('0x19')]()]+']',_0x10d492['message']);_0x3403f2(_0x10d492['message']);});});}function getTicket(_0x2c2940,_0x23d5e6,_0x2cd689,_0x49d585,_0x3ee5c1){return function(_0x30444d){logger[_0x5137('0xe')]('Creating\x20new\x20task');return new Promise(function(_0x6a5c3f,_0x4cbe3f){var _0x1b9398=moment();var _0x1fd683={'method':_0x5137('0x2c'),'uri':_0x2cd689+_0x5137('0x32'),'body':{'title':intUtil[_0x5137('0x33')](_0x49d585[_0x5137('0x34')],_0x3ee5c1,'\x20'),'description':intUtil[_0x5137('0x33')](_0x49d585['Descriptions'],_0x3ee5c1,'\x0a'),'owner_id':_0x30444d[_0x5137('0x1e')],'creater_id':_0x30444d['adminId'],'targetable_id':_0x30444d[_0x5137('0x28')],'targetable_type':_0x5137('0x35'),'created_at':_0x1b9398[_0x5137('0x24')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x1b9398[_0x5137('0x36')](0x1e,'m')[_0x5137('0x24')](_0x5137('0x2e'))},'json':!![]};_0x1fd683[_0x5137('0x2f')]=_0x23d5e6;return rp(_0x1fd683)[_0x5137('0x10')](function(_0x400ebd){_0x30444d[_0x5137('0x37')]=_0x400ebd[_0x5137('0x38')]['id'];logger[_0x5137('0xe')](_0x5137('0x39'),_0x30444d[_0x5137('0x37')]);_0x6a5c3f(_0x30444d);})['catch'](function(_0x57d3c9){logger[_0x5137('0x18')]('['+[_0x2c2940[_0x5137('0x19')]()]+']',_0x57d3c9[_0x5137('0x1a')]);_0x4cbe3f(_0x57d3c9['message']);});});};}function emit(_0x3e2105,_0x43d2bd,_0x297fea){var _0x216db7={'uri':_0x3e2105+'/contacts/'+_0x297fea};io['to'](util[_0x5137('0x24')](_0x5137('0x3a'),_0x43d2bd))[_0x5137('0x3b')](_0x5137('0x3c'),_0x216db7);}exports['cs']=function(_0x442143,_0x148222,_0x36515a,_0x5377f1,_0x4dd253,_0x249eac,_0x406a71,_0xd14f5d){var _0x39f873={};var _0x5aa7e1={'Authorization':_0x5137('0x3d')+_0x249eac[_0x5137('0x3e')]};_0x249eac[_0x5137('0x3f')]=intUtil[_0x5137('0x40')](_0x249eac[_0x5137('0x3f')]);_0x249eac[_0x5137('0x41')]=intUtil[_0x5137('0x40')](_0x249eac[_0x5137('0x41')]);var _0x2eac68=_0x249eac['remoteUri'];_0x39f873[_0x5137('0x13')]=_0x249eac[_0x5137('0x42')];_0x39f873['contactNumber']=_0xd14f5d[_0x5137('0x43')]()===_0x5137('0x44')?_0x148222[_0x5137('0x45')]:_0x148222['calleridnum'];_0x39f873[_0x5137('0x46')]=_0xd14f5d===_0x5137('0x47')||_0xd14f5d===_0x5137('0x48')?_0x5137('0x47'):_0x5137('0x44');if(_0x5377f1){_0x39f873['agentEmail']=_0x5377f1[_0x5137('0x12')];}var _0x259eba=util['format'](_0x5137('0x49'),_0x249eac['serverUrl'],_0x148222[_0x5137('0x4a')],md5(_0x148222[_0x5137('0x4a')]));if(_0x4dd253&&_0x4dd253[_0x5137('0x4b')]){logger['info'](_0x5137('0x4c'),_0x5137('0x4d'));_0x148222['recordingURL']=_0x259eba;}else if(_0x406a71&&_0x406a71['recordingFormat']&&_0x406a71['recordingFormat']!=='none'){logger[_0x5137('0xe')]('[OUTBOUND]',_0x5137('0x4d'));_0x148222[_0x5137('0x4e')]=_0x259eba;}else{_0x148222[_0x5137('0x4e')]='';}return getAdminId(_0x39f873,_0xd14f5d,_0x5aa7e1,_0x2eac68)[_0x5137('0x10')](getUser(_0xd14f5d,_0x5aa7e1,_0x2eac68))[_0x5137('0x10')](getEndUser(_0xd14f5d,_0x5aa7e1,_0x2eac68))[_0x5137('0x10')](getTicket(_0xd14f5d,_0x5aa7e1,_0x2eac68,_0x36515a,_0x148222))[_0x5137('0x10')](function(_0x97cb08){logger[_0x5137('0xe')](util[_0x5137('0x24')]('The\x20ticket\x20ID\x20is:\x20%s',_0x97cb08[_0x5137('0x37')]));if(_0xd14f5d!==_0x5137('0x48')){logger[_0x5137('0xe')]('['+[_0xd14f5d[_0x5137('0x19')]()]+']',_0x5137('0x4f'));emit(_0x2eac68,_0x5377f1[_0x5137('0x50')],_0x97cb08[_0x5137('0x28')]);}})[_0x5137('0x17')](function(_0x157ad0){logger['error']('['+[_0xd14f5d['toUpperCase']()]+_0x5137('0x51'),util[_0x5137('0x52')](_0x157ad0,{'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 0df2678..583efe1 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 _0xc374=['desk','unknown\x20integration','error','format','%s\x20configuration\x20#%s\x20not\x20found','data3','[EXEC]','lodash','util','./sugarcrm','./freshdesk','./zoho','./desk','./dynamics365','./freshsales','zendesk','salesforce','freshdesk','zoho','vtiger','dynamics365','freshsales','servicenow','includes','data1','toLowerCase','data2','find','queue','outbound','log','EVENT\x20UNKNOWN','unmanaged','sugarcrm'];(function(_0x79c37f,_0x2899a9){var _0x338ae8=function(_0x2cb1de){while(--_0x2cb1de){_0x79c37f['push'](_0x79c37f['shift']());}};_0x338ae8(++_0x2899a9);}(_0xc374,0x117));var _0x4c37=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc374[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x4c37('0x0'));var util=require(_0x4c37('0x1'));var zendesk=require('./zendesk');var salesforce=require('./salesforce');var sugarcrm=require(_0x4c37('0x2'));var freshdesk=require(_0x4c37('0x3'));var zoho=require(_0x4c37('0x4'));var desk=require(_0x4c37('0x5'));var vtiger=require('./vtiger');var servicenow=require('./servicenow');var dynamics365=require(_0x4c37('0x6'));var freshsales=require(_0x4c37('0x7'));var integrations=[_0x4c37('0x8'),_0x4c37('0x9'),'sugarcrm',_0x4c37('0xa'),_0x4c37('0xb'),'desk',_0x4c37('0xc'),_0x4c37('0xd'),_0x4c37('0xe'),_0x4c37('0xf')];exports['exec']=function(_0x53fe51,_0xe87fc8,_0x5e3877,_0x510033,_0x2b4879,_0x4bae85){if(_0x5e3877){if(_[_0x4c37('0x10')](integrations,_0x53fe51[_0x4c37('0x11')][_0x4c37('0x12')]())){try{var _0x554408=null;var _0x2a0685='';var _0x3bc9ba=_0x5e3877[_0x53fe51['data1'][_0x4c37('0x12')]()];if(_0x3bc9ba){var _0x44b524=_0x3bc9ba[_0x53fe51[_0x4c37('0x13')]];if(_0x44b524){var _0x350a10=_[_0x4c37('0x14')](_0x44b524['Configurations'],{'id':parseInt(_0x53fe51['data3'],0xa)});if(_0x350a10){if(_0x510033){if(_0x2b4879&&_0xe87fc8[_0x4c37('0x15')]){_0x2a0685=_0x4c37('0x15');}else if(_0xe87fc8['routeId']){_0x2a0685=_0x4c37('0x16');}else{console[_0x4c37('0x17')](_0x4c37('0x18'),_0xe87fc8);}}else{_0x2a0685=_0x4c37('0x19');}switch(_0x53fe51[_0x4c37('0x11')][_0x4c37('0x12')]()){case _0x4c37('0x8'):zendesk[_0x2a0685](_0x53fe51,_0xe87fc8,_0x350a10,_0x510033,_0x2b4879,_0x44b524,_0x4bae85);break;case _0x4c37('0x9'):salesforce[_0x2a0685](_0x53fe51,_0xe87fc8,_0x350a10,_0x510033,_0x2b4879,_0x44b524,_0x4bae85);break;case _0x4c37('0x1a'):sugarcrm[_0x2a0685](_0x53fe51,_0xe87fc8,_0x350a10,_0x510033,_0x2b4879,_0x44b524,_0x4bae85);break;case _0x4c37('0xa'):freshdesk[_0x2a0685](_0x53fe51,_0xe87fc8,_0x350a10,_0x510033,_0x2b4879,_0x44b524,_0x4bae85);break;case _0x4c37('0xb'):zoho[_0x2a0685](_0x53fe51,_0xe87fc8,_0x350a10,_0x510033,_0x2b4879,_0x44b524,_0x4bae85);break;case _0x4c37('0x1b'):desk[_0x2a0685](_0x53fe51,_0xe87fc8,_0x350a10,_0x510033,_0x2b4879,_0x44b524,_0x4bae85);break;case _0x4c37('0xc'):vtiger[_0x2a0685](_0x53fe51,_0xe87fc8,_0x350a10,_0x510033,_0x2b4879,_0x44b524,_0x4bae85);break;case _0x4c37('0xe'):freshsales['cs'](_0x53fe51,_0xe87fc8,_0x350a10,_0x510033,_0x2b4879,_0x44b524,_0x4bae85,_0x2a0685);break;case _0x4c37('0xf'):servicenow['cs'](_0x53fe51,_0xe87fc8,_0x350a10,_0x510033,_0x2b4879,_0x44b524,_0x4bae85,_0x2a0685);break;case'dynamics365':dynamics365['cs'](_0x53fe51,_0xe87fc8,_0x350a10,_0x510033,_0x2b4879,_0x44b524,_0x4bae85,_0x2a0685);break;default:console['log'](_0x4c37('0x1c'));}}else{_0x554408=require('../../../../config/logger')(_0x53fe51['data1']['toLowerCase']());_0x554408[_0x4c37('0x1d')]('[EXEC]',util[_0x4c37('0x1e')](_0x4c37('0x1f'),_0x53fe51['data1'][_0x4c37('0x12')](),_0x53fe51[_0x4c37('0x20')]));}}else{_0x554408=require('../../../../config/logger')(_0x53fe51[_0x4c37('0x11')][_0x4c37('0x12')]());_0x554408['error'](_0x4c37('0x21'),util[_0x4c37('0x1e')]('%s\x20account\x20#%s\x20not\x20found',_0x53fe51['data1'][_0x4c37('0x12')](),_0x53fe51[_0x4c37('0x13')]));}}else{}}catch(_0x11f266){console['error'](_0x11f266);}}}}; \ No newline at end of file +var _0x32a3=['routeId','EVENT\x20UNKNOWN','unmanaged','salesforce','log','unknown\x20integration','error','[EXEC]','format','../../../../config/logger','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./desk','./vtiger','./servicenow','zendesk','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','queue'];(function(_0x49fe8d,_0x44ab0f){var _0x23e887=function(_0x5b5ca1){while(--_0x5b5ca1){_0x49fe8d['push'](_0x49fe8d['shift']());}};_0x23e887(++_0x44ab0f);}(_0x32a3,0xb9));var _0x332a=function(_0x1768f6,_0x153a7d){_0x1768f6=_0x1768f6-0x0;var _0xf1ab5f=_0x32a3[_0x1768f6];return _0xf1ab5f;};'use strict';var _=require('lodash');var util=require(_0x332a('0x0'));var zendesk=require(_0x332a('0x1'));var salesforce=require(_0x332a('0x2'));var sugarcrm=require(_0x332a('0x3'));var freshdesk=require(_0x332a('0x4'));var zoho=require('./zoho');var desk=require(_0x332a('0x5'));var vtiger=require(_0x332a('0x6'));var servicenow=require(_0x332a('0x7'));var dynamics365=require('./dynamics365');var freshsales=require('./freshsales');var integrations=[_0x332a('0x8'),'salesforce',_0x332a('0x9'),_0x332a('0xa'),_0x332a('0xb'),_0x332a('0xc'),_0x332a('0xd'),_0x332a('0xe'),_0x332a('0xf'),_0x332a('0x10')];exports[_0x332a('0x11')]=function(_0x3cd836,_0x2e9eee,_0x4757f1,_0x2e8d66,_0x1b60fc,_0x15f7f2){if(_0x4757f1){if(_[_0x332a('0x12')](integrations,_0x3cd836[_0x332a('0x13')]['toLowerCase']())){try{var _0x538d52=null;var _0x487887='';var _0x53c5a2=_0x4757f1[_0x3cd836['data1'][_0x332a('0x14')]()];if(_0x53c5a2){var _0x381585=_0x53c5a2[_0x3cd836[_0x332a('0x15')]];if(_0x381585){var _0x5ac758=_[_0x332a('0x16')](_0x381585[_0x332a('0x17')],{'id':parseInt(_0x3cd836['data3'],0xa)});if(_0x5ac758){if(_0x2e8d66){if(_0x1b60fc&&_0x2e9eee[_0x332a('0x18')]){_0x487887='queue';}else if(_0x2e9eee[_0x332a('0x19')]){_0x487887='outbound';}else{console['log'](_0x332a('0x1a'),_0x2e9eee);}}else{_0x487887=_0x332a('0x1b');}switch(_0x3cd836[_0x332a('0x13')][_0x332a('0x14')]()){case _0x332a('0x8'):zendesk[_0x487887](_0x3cd836,_0x2e9eee,_0x5ac758,_0x2e8d66,_0x1b60fc,_0x381585,_0x15f7f2);break;case _0x332a('0x1c'):salesforce[_0x487887](_0x3cd836,_0x2e9eee,_0x5ac758,_0x2e8d66,_0x1b60fc,_0x381585,_0x15f7f2);break;case _0x332a('0x9'):sugarcrm[_0x487887](_0x3cd836,_0x2e9eee,_0x5ac758,_0x2e8d66,_0x1b60fc,_0x381585,_0x15f7f2);break;case _0x332a('0xa'):freshdesk[_0x487887](_0x3cd836,_0x2e9eee,_0x5ac758,_0x2e8d66,_0x1b60fc,_0x381585,_0x15f7f2);break;case _0x332a('0xb'):zoho[_0x487887](_0x3cd836,_0x2e9eee,_0x5ac758,_0x2e8d66,_0x1b60fc,_0x381585,_0x15f7f2);break;case _0x332a('0xc'):desk[_0x487887](_0x3cd836,_0x2e9eee,_0x5ac758,_0x2e8d66,_0x1b60fc,_0x381585,_0x15f7f2);break;case _0x332a('0xd'):vtiger[_0x487887](_0x3cd836,_0x2e9eee,_0x5ac758,_0x2e8d66,_0x1b60fc,_0x381585,_0x15f7f2);break;case _0x332a('0xf'):freshsales['cs'](_0x3cd836,_0x2e9eee,_0x5ac758,_0x2e8d66,_0x1b60fc,_0x381585,_0x15f7f2,_0x487887);break;case'servicenow':servicenow['cs'](_0x3cd836,_0x2e9eee,_0x5ac758,_0x2e8d66,_0x1b60fc,_0x381585,_0x15f7f2,_0x487887);break;case'dynamics365':dynamics365['cs'](_0x3cd836,_0x2e9eee,_0x5ac758,_0x2e8d66,_0x1b60fc,_0x381585,_0x15f7f2,_0x487887);break;default:console[_0x332a('0x1d')](_0x332a('0x1e'));}}else{_0x538d52=require('../../../../config/logger')(_0x3cd836['data1']['toLowerCase']());_0x538d52[_0x332a('0x1f')](_0x332a('0x20'),util[_0x332a('0x21')]('%s\x20configuration\x20#%s\x20not\x20found',_0x3cd836[_0x332a('0x13')]['toLowerCase'](),_0x3cd836['data3']));}}else{_0x538d52=require(_0x332a('0x22'))(_0x3cd836['data1'][_0x332a('0x14')]());_0x538d52[_0x332a('0x1f')](_0x332a('0x20'),util[_0x332a('0x21')]('%s\x20account\x20#%s\x20not\x20found',_0x3cd836[_0x332a('0x13')][_0x332a('0x14')](),_0x3cd836['data2']));}}else{}}catch(_0x29f8df){console['error'](_0x29f8df);}}}}; \ 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 966e4e4..be0cb26 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 _0xbef1=['customVariable','Variable','name','password','concat','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','Connection\x20established.','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','newTab','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','recordingFormat','none','[OUTBOUND]','outbound','[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','isNil','calleridnum','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','jsforce','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','assign','getString','Subjects','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','lead','WhoId','account','WhatId','Case','contact','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','validateEmail','execute','length','find','resolve','Name','identity','then','user_id','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','cloneDeep','additionalSearchContact','merge','$or','sobject','Contact','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','first','Phone','attributes','type','toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','Caller\x20-\x20%s','format','No\x20Company','upperFirst','create','forEach','string','picklist','content','toString','variable','variableName','idField'];(function(_0x255c49,_0x1aa0c9){var _0x1aa798=function(_0x23dadc){while(--_0x23dadc){_0x255c49['push'](_0x255c49['shift']());}};_0x1aa798(++_0x1aa0c9);}(_0xbef1,0x1a3));var _0x1bef=function(_0x279996,_0x3fdce7){_0x279996=_0x279996-0x0;var _0x1e98d8=_0xbef1[_0x279996];return _0x1e98d8;};'use strict';var _=require(_0x1bef('0x0'));var rp=require(_0x1bef('0x1'));var moment=require('moment');var BPromise=require('bluebird');var md5=require('md5');var jsforce=require(_0x1bef('0x2'));var util=require('util');var Redis=require(_0x1bef('0x3'));var intUtil=require(_0x1bef('0x4'));var config=require(_0x1bef('0x5'));var logger=require(_0x1bef('0x6'))(_0x1bef('0x7'));config[_0x1bef('0x8')]=_[_0x1bef('0x9')](config[_0x1bef('0x8')],{'host':_0x1bef('0xa'),'port':0x18eb});var io=require(_0x1bef('0xb'))(new Redis(config[_0x1bef('0x8')]));function emit(_0x5dd3d5,_0x4ae1e7,_0x2acf78){io['to'](_0x5dd3d5)['emit'](_0x4ae1e7,_0x2acf78);}function getTicket(_0x130872,_0x5100bb,_0xbd5780,_0x42b045,_0x169d9c,_0x2fe386,_0x1bb01e,_0xce7a1d){var _0xa01c04=Object[_0x1bef('0xc')]({},{'OwnerId':_0x5100bb['id'],'Subject':intUtil[_0x1bef('0xd')](_0x42b045[_0x1bef('0xe')],_0x169d9c,'\x20'),'Description':intUtil[_0x1bef('0xd')](_0x42b045['Descriptions'],_0x169d9c,'\x0a')},getCustomFields(_0x2fe386,_0x169d9c));if(_0xbd5780){if(_0x42b045['ticketType']==='Task'){_0xa01c04[_0x1bef('0xf')]=moment[_0x1bef('0x10')]();_0xa01c04[_0x1bef('0x11')]=![];_0xa01c04[_0x1bef('0x12')]=![];if(_0xbd5780['endUserType']==='contact'||_0xbd5780[_0x1bef('0x13')]===_0x1bef('0x14')){_0xa01c04[_0x1bef('0x15')]=_0xbd5780['id'];}else if(_0xbd5780[_0x1bef('0x13')]===_0x1bef('0x16')){_0xa01c04[_0x1bef('0x17')]=_0xbd5780['id'];}}else if(_0x42b045['ticketType']===_0x1bef('0x18')){if(_0xbd5780['endUserType']===_0x1bef('0x19')){_0xa01c04[_0x1bef('0x1a')]=_0xbd5780['id'];}else if(_0xbd5780[_0x1bef('0x13')]==='account'){_0xa01c04[_0x1bef('0x1b')]=_0xbd5780['id'];}else if(_0xbd5780[_0x1bef('0x13')]===_0x1bef('0x14')&&_0x42b045[_0x1bef('0x1c')]){_0xa01c04[_0x42b045[_0x1bef('0x1c')]]=_0xbd5780['id'];}else{logger[_0x1bef('0x1d')](_0x1bef('0x1e'));}}}return _0x1bb01e['sobject'](_0x42b045['ticketType'])['create'](_0xa01c04);}function getUser(_0x25af5d,_0x31e089,_0x238151){if(!_['isNil'](_0x31e089)&&intUtil[_0x1bef('0x1f')](_0x31e089)){var _0x4048e4={'Email':_0x31e089};var _0x5dc09b={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x238151['sobject']('User')['find'](_0x4048e4,_0x5dc09b)[_0x1bef('0x20')]()['then'](function(_0x84874d){if(_0x84874d[_0x1bef('0x21')]){var _0x3f95f6=_[_0x1bef('0x22')](_0x84874d,function(_0x27c782){return _0x27c782['Email']===_0x31e089;});if(_0x3f95f6){logger[_0x1bef('0x1d')]('Agent\x20%s\x20found.',_0x31e089);return BPromise[_0x1bef('0x23')]({'id':_0x3f95f6['Id'],'name':_0x3f95f6[_0x1bef('0x24')]});}}else{logger[_0x1bef('0x1d')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x31e089);return _0x238151[_0x1bef('0x25')]()[_0x1bef('0x26')](function(_0x25d985){return BPromise[_0x1bef('0x23')]({'id':_0x25d985[_0x1bef('0x27')],'name':_0x25d985['display_name']});});}});}else{logger['info'](_0x1bef('0x28'),_0x31e089);return _0x238151['identity']()[_0x1bef('0x26')](function(_0x24c866){return BPromise[_0x1bef('0x23')]({'id':_0x24c866['user_id'],'name':_0x24c866[_0x1bef('0x29')]});});}}function getEndUser(_0x20ff7e,_0x499112,_0x540a44,_0x20e8ad,_0x5f5df2){var _0x22f891={'$or':{'Phone':_0x20e8ad}};var _0x24fa9a={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x1bef('0x23')]()[_0x1bef('0x26')](function(){logger[_0x1bef('0x1d')](_0x1bef('0x2a'),_0x20e8ad,_0x499112[_0x1bef('0x2b')]);switch(_0x499112[_0x1bef('0x2b')]){case'contact_lead':var _0xb69e8b=_[_0x1bef('0x2c')](_0x22f891);if(_0x499112[_0x1bef('0x2d')]){var _0x23ba6c={};_0x23ba6c[_0x499112['additionalSearchContact']]=_0x20e8ad;_[_0x1bef('0x2e')](_0xb69e8b[_0x1bef('0x2f')],_0x23ba6c);}return _0x5f5df2[_0x1bef('0x30')](_0x1bef('0x31'))['find'](_0xb69e8b,_0x24fa9a)[_0x1bef('0x20')]()[_0x1bef('0x26')](function(_0x17abc1){if(_0x17abc1&&_0x17abc1[_0x1bef('0x21')]){return _0x17abc1;}else{var _0x5962e7=_[_0x1bef('0x2c')](_0x22f891);if(_0x499112[_0x1bef('0x32')]){var _0x14239e={};_0x14239e[_0x499112['additionalSearchLead']]=_0x20e8ad;_[_0x1bef('0x2e')](_0x5962e7['$or'],_0x14239e);}return _0x5f5df2[_0x1bef('0x30')](_0x1bef('0x33'))[_0x1bef('0x22')](_0x5962e7,_0x24fa9a);}});case _0x1bef('0x34'):var _0x2d53a5=_[_0x1bef('0x2c')](_0x22f891);if(_0x499112[_0x1bef('0x35')]){var _0x23ba6c={};_0x23ba6c[_0x499112[_0x1bef('0x35')]]=_0x20e8ad;_[_0x1bef('0x2e')](_0x2d53a5[_0x1bef('0x2f')],_0x23ba6c);}return _0x5f5df2[_0x1bef('0x30')]('Account')[_0x1bef('0x22')](_0x2d53a5,_0x24fa9a)[_0x1bef('0x20')]()['then'](function(_0x1084f7){if(_0x1084f7&&_0x1084f7[_0x1bef('0x21')]){return _0x1084f7;}else{var _0x16097a=_['cloneDeep'](_0x22f891);if(_0x499112[_0x1bef('0x2d')]){var _0x4e7364={};_0x4e7364[_0x499112[_0x1bef('0x2d')]]=_0x20e8ad;_[_0x1bef('0x2e')](_0x16097a['$or'],_0x4e7364);}return _0x5f5df2['sobject'](_0x1bef('0x31'))[_0x1bef('0x22')](_0x16097a,_0x24fa9a)[_0x1bef('0x26')](function(_0x23c7b8){if(_0x23c7b8&&_0x23c7b8[_0x1bef('0x21')]){return _0x23c7b8;}else{var _0x3c4dd5=_['cloneDeep'](_0x22f891);if(_0x499112['additionalSearchLead']){var _0x49afc2={};_0x49afc2[_0x499112[_0x1bef('0x32')]]=_0x20e8ad;_['merge'](_0x3c4dd5[_0x1bef('0x2f')],_0x49afc2);}return _0x5f5df2[_0x1bef('0x30')]('Lead')[_0x1bef('0x22')](_0x3c4dd5,_0x24fa9a);}});}});case'contact':var _0xb69e8b=_[_0x1bef('0x2c')](_0x22f891);if(_0x499112[_0x1bef('0x2d')]){var _0x23ba6c={};_0x23ba6c[_0x499112[_0x1bef('0x2d')]]=_0x20e8ad;_[_0x1bef('0x2e')](_0xb69e8b[_0x1bef('0x2f')],_0x23ba6c);}return _0x5f5df2['sobject'](_0x1bef('0x31'))[_0x1bef('0x22')](_0xb69e8b,_0x24fa9a)[_0x1bef('0x20')]();case _0x1bef('0x14'):var _0x54e517=_['cloneDeep'](_0x22f891);if(_0x499112[_0x1bef('0x32')]){var _0x23ba6c={};_0x23ba6c[_0x499112[_0x1bef('0x32')]]=_0x20e8ad;_[_0x1bef('0x2e')](_0x54e517[_0x1bef('0x2f')],_0x23ba6c);}return _0x5f5df2['sobject'](_0x1bef('0x33'))['find'](_0x54e517,_0x24fa9a);case _0x1bef('0x16'):var _0x2d53a5=_['cloneDeep'](_0x22f891);if(_0x499112[_0x1bef('0x35')]){var _0x23ba6c={};_0x23ba6c[_0x499112[_0x1bef('0x35')]]=_0x20e8ad;_[_0x1bef('0x2e')](_0x2d53a5['$or'],_0x23ba6c);}return _0x5f5df2['sobject']('Account')[_0x1bef('0x22')](_0x2d53a5,_0x24fa9a);default:return null;}})[_0x1bef('0x26')](function(_0x33bd01){if(_0x33bd01&&_0x33bd01[_0x1bef('0x21')]){var _0xab0e39=_[_0x1bef('0x36')](_0x33bd01);if(_0xab0e39){return BPromise[_0x1bef('0x23')]({'id':_0xab0e39['Id'],'name':_0xab0e39['Name'],'phone':_0xab0e39[_0x1bef('0x37')],'endUserType':_0xab0e39[_0x1bef('0x38')][_0x1bef('0x39')][_0x1bef('0x3a')]()});}}})[_0x1bef('0x26')](function(_0x4b3a4b){if(_0x4b3a4b){logger[_0x1bef('0x1d')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x4b3a4b[_0x1bef('0x13')],_0x20e8ad);return BPromise[_0x1bef('0x23')](_0x4b3a4b);}else{logger[_0x1bef('0x1d')](_0x1bef('0x3b'),_0x20e8ad);var _0x1ddd62={'Phone':_0x20e8ad};if(_0x499112[_0x1bef('0x3c')]){if(_0x499112[_0x1bef('0x3c')]==='contact'){logger['info'](_0x1bef('0x3d'),_0x20e8ad,_0x499112[_0x1bef('0x3c')]);_0x1ddd62[_0x1bef('0x3e')]=_0x540a44!==_0x1bef('0x3f')?_0x540a44:util['format'](_0x1bef('0x40'),_0x20e8ad);}else if(_0x499112[_0x1bef('0x3c')]===_0x1bef('0x14')){logger[_0x1bef('0x1d')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x20e8ad,_0x499112[_0x1bef('0x3c')]);_0x1ddd62[_0x1bef('0x3e')]=_0x540a44!==_0x1bef('0x3f')?_0x540a44:util[_0x1bef('0x41')](_0x1bef('0x40'),_0x20e8ad);_0x1ddd62['Company']=_0x1bef('0x42');}else if(_0x499112[_0x1bef('0x3c')]===_0x1bef('0x16')){logger[_0x1bef('0x1d')](_0x1bef('0x3d'),_0x20e8ad,_0x499112[_0x1bef('0x3c')]);_0x1ddd62[_0x1bef('0x24')]=_0x540a44!==''?_0x540a44:util[_0x1bef('0x41')]('Caller\x20-\x20%s',_0x20e8ad);}else{return null;}}return _0x5f5df2[_0x1bef('0x30')](_[_0x1bef('0x43')](_0x499112[_0x1bef('0x3c')]))[_0x1bef('0x44')](_0x1ddd62)[_0x1bef('0x26')](function(_0x4c51fc){return BPromise[_0x1bef('0x23')]({'id':_0x4c51fc['id'],'endUserType':_0x499112[_0x1bef('0x3c')]});});}});}function getCustomFields(_0x31f5a0,_0x5410e3){var _0x14d738={};if(_0x31f5a0[_0x1bef('0x21')]>0x0){_[_0x1bef('0x45')](_0x31f5a0,function(_0x5aa245){if(_['includes']([_0x1bef('0x46'),_0x1bef('0x47')],_0x5aa245['type'])&&_0x5aa245['idField']){_0x14d738[_0x5aa245['idField']]=_0x5aa245[_0x1bef('0x48')][_0x1bef('0x49')]();}else if(_0x5aa245[_0x1bef('0x39')]===_0x1bef('0x4a')&&_0x5aa245[_0x1bef('0x4b')]&&_0x5aa245[_0x1bef('0x4c')]){_0x5410e3[_0x5aa245[_0x1bef('0x4b')]]&&(_0x14d738[_0x5aa245[_0x1bef('0x4c')]]=_0x5410e3[_0x5aa245[_0x1bef('0x4b')]][_0x1bef('0x49')]());}else if(_0x5aa245[_0x1bef('0x39')]===_0x1bef('0x4d')&&_0x5aa245[_0x1bef('0x4e')]&&_0x5aa245[_0x1bef('0x4e')][_0x1bef('0x4f')]&&_0x5aa245[_0x1bef('0x4c')]){_0x5410e3[_0x5aa245[_0x1bef('0x4e')][_0x1bef('0x4f')][_0x1bef('0x3a')]()]&&(_0x14d738[_0x5aa245['idField']]=_0x5410e3[_0x5aa245[_0x1bef('0x4e')]['name']['toLowerCase']()][_0x1bef('0x49')]());}});}return _0x14d738;}function getConnection(_0x2ce884){var _0x466fbe=_0x2ce884[_0x1bef('0x50')][_0x1bef('0x51')](_0x2ce884['securityToken']);var _0x5a4b41=new jsforce[(_0x1bef('0x52'))]({'oauth2':{'loginUrl':_0x2ce884[_0x1bef('0x53')]||_0x1bef('0x54'),'clientId':_0x2ce884[_0x1bef('0x55')],'clientSecret':_0x2ce884[_0x1bef('0x56')]}});return _0x5a4b41['login'](_0x2ce884['username'],_0x466fbe)[_0x1bef('0x26')](function(){logger[_0x1bef('0x1d')](_0x1bef('0x57'));return _0x5a4b41;});}exports[_0x1bef('0x58')]=function(_0x56542c,_0x5c5c1d,_0x186b7e,_0x1b057e,_0x35c928,_0x35e1d4){var _0x1cd511,_0x11858e,_0x9922ac,_0x32706f;_0x35e1d4['serverUrl']=intUtil[_0x1bef('0x59')](_0x35e1d4[_0x1bef('0x5a')]);_0x35e1d4[_0x1bef('0x53')]=intUtil[_0x1bef('0x59')](_0x35e1d4['remoteUri']);if(_0x35c928&&_0x35c928[_0x1bef('0x5b')]){logger['info'](_0x1bef('0x5c'),_0x1bef('0x5d'));_0x5c5c1d[_0x1bef('0x5e')]=util[_0x1bef('0x41')](_0x1bef('0x5f'),_0x35e1d4['serverUrl'],_0x5c5c1d[_0x1bef('0x60')],md5(_0x5c5c1d[_0x1bef('0x60')]));}else{_0x5c5c1d[_0x1bef('0x5e')]='';}return getConnection(_0x35e1d4)[_0x1bef('0x26')](function(_0x31937d){_0x32706f=_0x31937d;return getUser(_0x35e1d4,_0x1b057e[_0x1bef('0x61')],_0x32706f);})[_0x1bef('0x26')](function(_0x3938d5){_0x1cd511=_0x3938d5;return getEndUser(_0x35e1d4,_0x186b7e,_0x5c5c1d[_0x1bef('0x62')],_0x5c5c1d['calleridnum'],_0x32706f);})[_0x1bef('0x26')](function(_0x2bbd83){_0x11858e=_0x2bbd83;return getTicket(_0x35e1d4,_0x1cd511,_0x11858e,_0x186b7e,_0x5c5c1d,_0x186b7e[_0x1bef('0x63')],_0x32706f,_0x1bef('0x58'));})['then'](function(_0x381b52){_0x9922ac=_0x381b52;logger[_0x1bef('0x1d')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x9922ac['id']);logger['info'](_0x1bef('0x64'),_0x9922ac['id'],_0x1b057e['name'],_0x35e1d4[_0x1bef('0x39')]);switch(_0x35e1d4[_0x1bef('0x39')]){case'integrationTab':emit(util[_0x1bef('0x41')]('user:%s',_0x1b057e[_0x1bef('0x4f')]),_0x1bef('0x65'),{'recordId':_0x9922ac['id']});break;case _0x1bef('0x66'):emit(util['format'](_0x1bef('0x67'),_0x1b057e[_0x1bef('0x4f')]),_0x1bef('0x68'),{'uri':util[_0x1bef('0x41')](_0x1bef('0x69'),_0x32706f[_0x1bef('0x6a')],_0x9922ac['id'])});break;default:logger[_0x1bef('0x6b')](_0x1bef('0x6c'));}})[_0x1bef('0x6d')](function(_0xf829c4){logger[_0x1bef('0x6b')]('[QUEUE]',_0xf829c4);});};exports['outbound']=function(_0x31c4ab,_0x2c1570,_0x5bb7be,_0x5c4965,_0x47c9d3,_0x1c50b3,_0x2690df){var _0x18f534,_0x420007,_0x5185f5,_0xf1b5bf;_0x1c50b3[_0x1bef('0x5a')]=intUtil['stripTrailingSlash'](_0x1c50b3[_0x1bef('0x5a')]);_0x1c50b3['remoteUri']=intUtil['stripTrailingSlash'](_0x1c50b3[_0x1bef('0x53')]);if(_0x2690df&&_0x2690df[_0x1bef('0x6e')]&&_0x2690df[_0x1bef('0x6e')]!==_0x1bef('0x6f')){logger[_0x1bef('0x1d')](_0x1bef('0x70'),'Recording\x20is\x20enabled!');_0x2c1570[_0x1bef('0x5e')]=util[_0x1bef('0x41')](_0x1bef('0x5f'),_0x1c50b3[_0x1bef('0x5a')],_0x2c1570[_0x1bef('0x60')],md5(_0x2c1570[_0x1bef('0x60')]));}return getConnection(_0x1c50b3)[_0x1bef('0x26')](function(_0x450c00){_0xf1b5bf=_0x450c00;return getUser(_0x1c50b3,_0x5c4965[_0x1bef('0x61')],_0xf1b5bf);})['then'](function(_0x1da412){_0x18f534=_0x1da412;return getEndUser(_0x1c50b3,_0x5bb7be,_0x2c1570['destcalleridname'],_0x2c1570['destcalleridnum'],_0xf1b5bf);})[_0x1bef('0x26')](function(_0x4ce1c9){_0x420007=_0x4ce1c9;return getTicket(_0x1c50b3,_0x18f534,_0x420007,_0x5bb7be,_0x2c1570,_0x5bb7be['Fields'],_0xf1b5bf,_0x1bef('0x71'));})['then'](function(_0xa5d173){_0x5185f5=_0xa5d173;logger[_0x1bef('0x1d')](_0x1bef('0x72'),_0x5185f5['id']);logger[_0x1bef('0x1d')](_0x1bef('0x73'),_0x5185f5['id'],_0x5c4965[_0x1bef('0x4f')],_0x1c50b3[_0x1bef('0x39')]);switch(_0x1c50b3['type']){case'integrationTab':emit(util['format'](_0x1bef('0x67'),_0x5c4965[_0x1bef('0x4f')]),_0x1bef('0x65'),{'recordId':_0x5185f5['id']});break;case _0x1bef('0x66'):emit(util[_0x1bef('0x41')]('user:%s',_0x5c4965[_0x1bef('0x4f')]),'trigger:browser:url',{'uri':util[_0x1bef('0x41')]('%s/%s/e',_0xf1b5bf[_0x1bef('0x6a')],_0x5185f5['id'])});break;default:logger[_0x1bef('0x6b')](_0x1bef('0x70'),_0x1bef('0x74'));}})['catch'](function(_0x9a66c1){logger['error'](_0x1bef('0x70'),_0x9a66c1);});};exports[_0x1bef('0x75')]=function(_0x1e1f77,_0x1f5382,_0x531565,_0x47ae5e,_0x5ed685,_0x4cde12){var _0x3de899,_0x4c5bb7,_0x4d0f5f,_0x3e77b3;_0x4cde12[_0x1bef('0x5a')]=intUtil['stripTrailingSlash'](_0x4cde12[_0x1bef('0x5a')]);_0x4cde12[_0x1bef('0x53')]=intUtil[_0x1bef('0x59')](_0x4cde12['remoteUri']);if(_0x5ed685&&_0x5ed685['monitor_format']){logger[_0x1bef('0x1d')]('['+_0x1f5382[_0x1bef('0x76')]['toUpperCase']()+']',_0x1bef('0x5d'));_0x1f5382[_0x1bef('0x5e')]=util[_0x1bef('0x41')](_0x1bef('0x5f'),_0x4cde12[_0x1bef('0x5a')],_0x1f5382['uniqueid'],md5(_0x1f5382['uniqueid']));}else{_0x1f5382[_0x1bef('0x5e')]='';}return getConnection(_0x4cde12)[_0x1bef('0x26')](function(_0x4761e5){_0x3e77b3=_0x4761e5;if(!_[_0x1bef('0x77')](_0x47ae5e)){return getUser(_0x4cde12,_0x47ae5e[_0x1bef('0x4f')],_0x3e77b3);}else{return getUser(_0x4cde12,null,_0x3e77b3);}})[_0x1bef('0x26')](function(_0x2a9e91){_0x3de899=_0x2a9e91;return getEndUser(_0x4cde12,_0x531565,_0x1f5382[_0x1bef('0x62')],_0x1f5382[_0x1bef('0x78')],_0x3e77b3);})[_0x1bef('0x26')](function(_0x417425){_0x4c5bb7=_0x417425;return getTicket(_0x4cde12,_0x3de899,_0x4c5bb7,_0x531565,_0x1f5382,_0x531565[_0x1bef('0x63')],_0x3e77b3);})[_0x1bef('0x26')](function(_0x38d6bd){_0x4d0f5f=_0x38d6bd;logger[_0x1bef('0x1d')]('['+_0x1f5382['lastevent'][_0x1bef('0x79')]()+_0x1bef('0x7a'),_0x4d0f5f['id']);logger[_0x1bef('0x1d')]('['+_0x1f5382[_0x1bef('0x76')]['toUpperCase']()+_0x1bef('0x7b'),_0x4cde12[_0x1bef('0x39')]);})[_0x1bef('0x6d')](function(_0x195d24){logger['error']('['+_0x1f5382[_0x1bef('0x76')]['toUpperCase']()+']',_0x195d24);});}; \ No newline at end of file +var _0x19d2=['execute','then','length','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','first','attributes','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','format','Caller\x20-\x20%s','lead','','Company','No\x20Company','upperFirst','forEach','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','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','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','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','outbound','recordingFormat','none','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','[OUTBOUND]','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','catch','request-promise','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','socket.io-emitter','emit','assign','getString','Descriptions','ActivityDate','IsReminderSet','IsRecurrence','endUserType','contact','WhatId','ticketType','Case','ContactId','account','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find'];(function(_0x3e2baa,_0x507e45){var _0x266f61=function(_0x168259){while(--_0x168259){_0x3e2baa['push'](_0x3e2baa['shift']());}};_0x266f61(++_0x507e45);}(_0x19d2,0x1ec));var _0x219d=function(_0x2b2c09,_0x35ef00){_0x2b2c09=_0x2b2c09-0x0;var _0x5c0db8=_0x19d2[_0x2b2c09];return _0x5c0db8;};'use strict';var _=require('lodash');var rp=require(_0x219d('0x0'));var moment=require(_0x219d('0x1'));var BPromise=require(_0x219d('0x2'));var md5=require(_0x219d('0x3'));var jsforce=require(_0x219d('0x4'));var util=require(_0x219d('0x5'));var Redis=require(_0x219d('0x6'));var intUtil=require(_0x219d('0x7'));var config=require(_0x219d('0x8'));var logger=require(_0x219d('0x9'))(_0x219d('0xa'));config[_0x219d('0xb')]=_['defaults'](config[_0x219d('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0x219d('0xc'))(new Redis(config['redis']));function emit(_0x1b695f,_0x20f5be,_0x461d35){io['to'](_0x1b695f)[_0x219d('0xd')](_0x20f5be,_0x461d35);}function getTicket(_0x287ee8,_0x427d1c,_0x12d21a,_0x2f40e6,_0x437c12,_0x2b427e,_0x4b2c01,_0x17abc7){var _0x122742=Object[_0x219d('0xe')]({},{'OwnerId':_0x427d1c['id'],'Subject':intUtil[_0x219d('0xf')](_0x2f40e6['Subjects'],_0x437c12,'\x20'),'Description':intUtil['getString'](_0x2f40e6[_0x219d('0x10')],_0x437c12,'\x0a')},getCustomFields(_0x2b427e,_0x437c12));if(_0x12d21a){if(_0x2f40e6['ticketType']==='Task'){_0x122742[_0x219d('0x11')]=moment['utc']();_0x122742[_0x219d('0x12')]=![];_0x122742[_0x219d('0x13')]=![];if(_0x12d21a[_0x219d('0x14')]===_0x219d('0x15')||_0x12d21a[_0x219d('0x14')]==='lead'){_0x122742['WhoId']=_0x12d21a['id'];}else if(_0x12d21a[_0x219d('0x14')]==='account'){_0x122742[_0x219d('0x16')]=_0x12d21a['id'];}}else if(_0x2f40e6[_0x219d('0x17')]===_0x219d('0x18')){if(_0x12d21a[_0x219d('0x14')]===_0x219d('0x15')){_0x122742[_0x219d('0x19')]=_0x12d21a['id'];}else if(_0x12d21a[_0x219d('0x14')]===_0x219d('0x1a')){_0x122742['AccountId']=_0x12d21a['id'];}else if(_0x12d21a['endUserType']==='lead'&&_0x2f40e6[_0x219d('0x1b')]){_0x122742[_0x2f40e6[_0x219d('0x1b')]]=_0x12d21a['id'];}else{logger[_0x219d('0x1c')](_0x219d('0x1d'));}}}return _0x4b2c01[_0x219d('0x1e')](_0x2f40e6[_0x219d('0x17')])[_0x219d('0x1f')](_0x122742);}function getUser(_0x15fb5c,_0x15e471,_0xcdebda){if(!_[_0x219d('0x20')](_0x15e471)&&intUtil[_0x219d('0x21')](_0x15e471)){var _0x3a0b59={'Email':_0x15e471};var _0x1ca1f5={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0xcdebda['sobject'](_0x219d('0x22'))[_0x219d('0x23')](_0x3a0b59,_0x1ca1f5)[_0x219d('0x24')]()[_0x219d('0x25')](function(_0x11eea0){if(_0x11eea0[_0x219d('0x26')]){var _0x366298=_['find'](_0x11eea0,function(_0x4bb53a){return _0x4bb53a[_0x219d('0x27')]===_0x15e471;});if(_0x366298){logger[_0x219d('0x1c')](_0x219d('0x28'),_0x15e471);return BPromise[_0x219d('0x29')]({'id':_0x366298['Id'],'name':_0x366298[_0x219d('0x2a')]});}}else{logger[_0x219d('0x1c')](_0x219d('0x2b'),_0x15e471);return _0xcdebda[_0x219d('0x2c')]()[_0x219d('0x25')](function(_0x23c319){return BPromise[_0x219d('0x29')]({'id':_0x23c319[_0x219d('0x2d')],'name':_0x23c319[_0x219d('0x2e')]});});}});}else{logger[_0x219d('0x1c')](_0x219d('0x2b'),_0x15e471);return _0xcdebda[_0x219d('0x2c')]()[_0x219d('0x25')](function(_0x5097af){return BPromise[_0x219d('0x29')]({'id':_0x5097af[_0x219d('0x2d')],'name':_0x5097af['display_name']});});}}function getEndUser(_0x4fe8d6,_0x4c0acc,_0x5cb00c,_0x2bb415,_0x2f0274){var _0x5b05ee={'$or':{'Phone':_0x2bb415}};var _0x26e1a8={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x219d('0x29')]()['then'](function(){logger['info']('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x2bb415,_0x4c0acc['moduleSearch']);switch(_0x4c0acc[_0x219d('0x2f')]){case _0x219d('0x30'):var _0x2eeb02=_[_0x219d('0x31')](_0x5b05ee);if(_0x4c0acc[_0x219d('0x32')]){var _0x3ead2a={};_0x3ead2a[_0x4c0acc[_0x219d('0x32')]]=_0x2bb415;_[_0x219d('0x33')](_0x2eeb02[_0x219d('0x34')],_0x3ead2a);}return _0x2f0274[_0x219d('0x1e')](_0x219d('0x35'))[_0x219d('0x23')](_0x2eeb02,_0x26e1a8)[_0x219d('0x24')]()[_0x219d('0x25')](function(_0x46117e){if(_0x46117e&&_0x46117e[_0x219d('0x26')]){return _0x46117e;}else{var _0x2d11eb=_[_0x219d('0x31')](_0x5b05ee);if(_0x4c0acc[_0x219d('0x36')]){var _0x4c3462={};_0x4c3462[_0x4c0acc['additionalSearchLead']]=_0x2bb415;_['merge'](_0x2d11eb[_0x219d('0x34')],_0x4c3462);}return _0x2f0274['sobject'](_0x219d('0x37'))[_0x219d('0x23')](_0x2d11eb,_0x26e1a8);}});case _0x219d('0x38'):var _0x3ad71f=_[_0x219d('0x31')](_0x5b05ee);if(_0x4c0acc[_0x219d('0x39')]){var _0x3ead2a={};_0x3ead2a[_0x4c0acc[_0x219d('0x39')]]=_0x2bb415;_[_0x219d('0x33')](_0x3ad71f[_0x219d('0x34')],_0x3ead2a);}return _0x2f0274[_0x219d('0x1e')](_0x219d('0x3a'))[_0x219d('0x23')](_0x3ad71f,_0x26e1a8)[_0x219d('0x24')]()['then'](function(_0x184079){if(_0x184079&&_0x184079[_0x219d('0x26')]){return _0x184079;}else{var _0x3a3862=_['cloneDeep'](_0x5b05ee);if(_0x4c0acc[_0x219d('0x32')]){var _0x11e1c0={};_0x11e1c0[_0x4c0acc['additionalSearchContact']]=_0x2bb415;_[_0x219d('0x33')](_0x3a3862[_0x219d('0x34')],_0x11e1c0);}return _0x2f0274[_0x219d('0x1e')](_0x219d('0x35'))['find'](_0x3a3862,_0x26e1a8)[_0x219d('0x25')](function(_0x32c727){if(_0x32c727&&_0x32c727['length']){return _0x32c727;}else{var _0x2e9181=_['cloneDeep'](_0x5b05ee);if(_0x4c0acc[_0x219d('0x36')]){var _0x3ff7ce={};_0x3ff7ce[_0x4c0acc['additionalSearchLead']]=_0x2bb415;_['merge'](_0x2e9181[_0x219d('0x34')],_0x3ff7ce);}return _0x2f0274[_0x219d('0x1e')]('Lead')[_0x219d('0x23')](_0x2e9181,_0x26e1a8);}});}});case'contact':var _0x2eeb02=_[_0x219d('0x31')](_0x5b05ee);if(_0x4c0acc['additionalSearchContact']){var _0x3ead2a={};_0x3ead2a[_0x4c0acc[_0x219d('0x32')]]=_0x2bb415;_[_0x219d('0x33')](_0x2eeb02[_0x219d('0x34')],_0x3ead2a);}return _0x2f0274[_0x219d('0x1e')](_0x219d('0x35'))[_0x219d('0x23')](_0x2eeb02,_0x26e1a8)[_0x219d('0x24')]();case'lead':var _0xf8bfe0=_[_0x219d('0x31')](_0x5b05ee);if(_0x4c0acc[_0x219d('0x36')]){var _0x3ead2a={};_0x3ead2a[_0x4c0acc[_0x219d('0x36')]]=_0x2bb415;_[_0x219d('0x33')](_0xf8bfe0[_0x219d('0x34')],_0x3ead2a);}return _0x2f0274[_0x219d('0x1e')](_0x219d('0x37'))['find'](_0xf8bfe0,_0x26e1a8);case _0x219d('0x1a'):var _0x3ad71f=_[_0x219d('0x31')](_0x5b05ee);if(_0x4c0acc[_0x219d('0x39')]){var _0x3ead2a={};_0x3ead2a[_0x4c0acc['additionalSearchAccount']]=_0x2bb415;_['merge'](_0x3ad71f[_0x219d('0x34')],_0x3ead2a);}return _0x2f0274[_0x219d('0x1e')](_0x219d('0x3a'))[_0x219d('0x23')](_0x3ad71f,_0x26e1a8);default:return null;}})[_0x219d('0x25')](function(_0xd7f722){if(_0xd7f722&&_0xd7f722['length']){var _0x248363=_[_0x219d('0x3b')](_0xd7f722);if(_0x248363){return BPromise[_0x219d('0x29')]({'id':_0x248363['Id'],'name':_0x248363['Name'],'phone':_0x248363['Phone'],'endUserType':_0x248363[_0x219d('0x3c')]['type'][_0x219d('0x3d')]()});}}})[_0x219d('0x25')](function(_0x472032){if(_0x472032){logger[_0x219d('0x1c')](_0x219d('0x3e'),_0x472032[_0x219d('0x14')],_0x2bb415);return BPromise['resolve'](_0x472032);}else{logger['info'](_0x219d('0x3f'),_0x2bb415);var _0x1b4643={'Phone':_0x2bb415};if(_0x4c0acc[_0x219d('0x40')]){if(_0x4c0acc[_0x219d('0x40')]===_0x219d('0x15')){logger[_0x219d('0x1c')](_0x219d('0x41'),_0x2bb415,_0x4c0acc[_0x219d('0x40')]);_0x1b4643['LastName']=_0x5cb00c!==''?_0x5cb00c:util[_0x219d('0x42')](_0x219d('0x43'),_0x2bb415);}else if(_0x4c0acc[_0x219d('0x40')]===_0x219d('0x44')){logger[_0x219d('0x1c')](_0x219d('0x41'),_0x2bb415,_0x4c0acc['moduleCreate']);_0x1b4643['LastName']=_0x5cb00c!==_0x219d('0x45')?_0x5cb00c:util[_0x219d('0x42')](_0x219d('0x43'),_0x2bb415);_0x1b4643[_0x219d('0x46')]=_0x219d('0x47');}else if(_0x4c0acc[_0x219d('0x40')]===_0x219d('0x1a')){logger[_0x219d('0x1c')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x2bb415,_0x4c0acc[_0x219d('0x40')]);_0x1b4643[_0x219d('0x2a')]=_0x5cb00c!==_0x219d('0x45')?_0x5cb00c:util[_0x219d('0x42')](_0x219d('0x43'),_0x2bb415);}else{return null;}}return _0x2f0274[_0x219d('0x1e')](_[_0x219d('0x48')](_0x4c0acc[_0x219d('0x40')]))[_0x219d('0x1f')](_0x1b4643)['then'](function(_0x5d2fc4){return BPromise[_0x219d('0x29')]({'id':_0x5d2fc4['id'],'endUserType':_0x4c0acc[_0x219d('0x40')]});});}});}function getCustomFields(_0xe823a9,_0x27cf7b){var _0x1a0fa1={};if(_0xe823a9['length']>0x0){_[_0x219d('0x49')](_0xe823a9,function(_0xd436e7){if(_['includes']([_0x219d('0x4a'),_0x219d('0x4b')],_0xd436e7[_0x219d('0x4c')])&&_0xd436e7['idField']){_0x1a0fa1[_0xd436e7[_0x219d('0x4d')]]=_0xd436e7[_0x219d('0x4e')][_0x219d('0x4f')]();}else if(_0xd436e7[_0x219d('0x4c')]===_0x219d('0x50')&&_0xd436e7[_0x219d('0x51')]&&_0xd436e7[_0x219d('0x4d')]){_0x27cf7b[_0xd436e7['variableName']]&&(_0x1a0fa1[_0xd436e7[_0x219d('0x4d')]]=_0x27cf7b[_0xd436e7[_0x219d('0x51')]]['toString']());}else if(_0xd436e7[_0x219d('0x4c')]===_0x219d('0x52')&&_0xd436e7[_0x219d('0x53')]&&_0xd436e7[_0x219d('0x53')][_0x219d('0x54')]&&_0xd436e7[_0x219d('0x4d')]){_0x27cf7b[_0xd436e7['Variable']['name'][_0x219d('0x3d')]()]&&(_0x1a0fa1[_0xd436e7['idField']]=_0x27cf7b[_0xd436e7[_0x219d('0x53')][_0x219d('0x54')]['toLowerCase']()][_0x219d('0x4f')]());}});}return _0x1a0fa1;}function getConnection(_0x2e680d){var _0x18b5d9=_0x2e680d[_0x219d('0x55')][_0x219d('0x56')](_0x2e680d[_0x219d('0x57')]);var _0x3614be=new jsforce[(_0x219d('0x58'))]({'oauth2':{'loginUrl':_0x2e680d[_0x219d('0x59')]||_0x219d('0x5a'),'clientId':_0x2e680d[_0x219d('0x5b')],'clientSecret':_0x2e680d[_0x219d('0x5c')]}});return _0x3614be[_0x219d('0x5d')](_0x2e680d[_0x219d('0x5e')],_0x18b5d9)[_0x219d('0x25')](function(){logger['info'](_0x219d('0x5f'));return _0x3614be;});}exports[_0x219d('0x60')]=function(_0x1f1c52,_0x5962e9,_0x39cbb7,_0x11935c,_0x5a17e4,_0xd3c373){var _0x1f6211,_0x346680,_0x498c87,_0x28f3a3;_0xd3c373[_0x219d('0x61')]=intUtil[_0x219d('0x62')](_0xd3c373['serverUrl']);_0xd3c373[_0x219d('0x59')]=intUtil[_0x219d('0x62')](_0xd3c373['remoteUri']);if(_0x5a17e4&&_0x5a17e4[_0x219d('0x63')]){logger['info'](_0x219d('0x64'),_0x219d('0x65'));_0x5962e9['recordingURL']=util[_0x219d('0x42')](_0x219d('0x66'),_0xd3c373['serverUrl'],_0x5962e9[_0x219d('0x67')],md5(_0x5962e9[_0x219d('0x67')]));}else{_0x5962e9[_0x219d('0x68')]='';}return getConnection(_0xd3c373)[_0x219d('0x25')](function(_0x229836){_0x28f3a3=_0x229836;return getUser(_0xd3c373,_0x11935c[_0x219d('0x69')],_0x28f3a3);})[_0x219d('0x25')](function(_0x518814){_0x1f6211=_0x518814;return getEndUser(_0xd3c373,_0x39cbb7,_0x5962e9[_0x219d('0x6a')],_0x5962e9[_0x219d('0x6b')],_0x28f3a3);})[_0x219d('0x25')](function(_0x1c9b0e){_0x346680=_0x1c9b0e;return getTicket(_0xd3c373,_0x1f6211,_0x346680,_0x39cbb7,_0x5962e9,_0x39cbb7[_0x219d('0x6c')],_0x28f3a3,'queue');})[_0x219d('0x25')](function(_0x3ab732){_0x498c87=_0x3ab732;logger[_0x219d('0x1c')](_0x219d('0x6d'),_0x498c87['id']);logger[_0x219d('0x1c')](_0x219d('0x6e'),_0x498c87['id'],_0x11935c[_0x219d('0x54')],_0xd3c373[_0x219d('0x4c')]);switch(_0xd3c373[_0x219d('0x4c')]){case _0x219d('0x6f'):emit(util[_0x219d('0x42')](_0x219d('0x70'),_0x11935c[_0x219d('0x54')]),'trigger:salesforce:display',{'recordId':_0x498c87['id']});break;case _0x219d('0x71'):emit(util[_0x219d('0x42')](_0x219d('0x70'),_0x11935c[_0x219d('0x54')]),_0x219d('0x72'),{'uri':util[_0x219d('0x42')](_0x219d('0x73'),_0x28f3a3[_0x219d('0x74')],_0x498c87['id'])});break;default:logger[_0x219d('0x75')](_0x219d('0x76'));}})['catch'](function(_0xc59130){logger[_0x219d('0x75')](_0x219d('0x64'),_0xc59130);});};exports[_0x219d('0x77')]=function(_0x5c5149,_0x18912a,_0x4c17fc,_0x1e4957,_0x40a9a6,_0x391e46,_0x5722e5){var _0x508b77,_0x20d8ec,_0x306cda,_0x4d4daa;_0x391e46['serverUrl']=intUtil[_0x219d('0x62')](_0x391e46[_0x219d('0x61')]);_0x391e46['remoteUri']=intUtil['stripTrailingSlash'](_0x391e46[_0x219d('0x59')]);if(_0x5722e5&&_0x5722e5[_0x219d('0x78')]&&_0x5722e5[_0x219d('0x78')]!==_0x219d('0x79')){logger[_0x219d('0x1c')]('[OUTBOUND]',_0x219d('0x65'));_0x18912a[_0x219d('0x68')]=util[_0x219d('0x42')](_0x219d('0x66'),_0x391e46[_0x219d('0x61')],_0x18912a[_0x219d('0x67')],md5(_0x18912a[_0x219d('0x67')]));}return getConnection(_0x391e46)[_0x219d('0x25')](function(_0x457fb2){_0x4d4daa=_0x457fb2;return getUser(_0x391e46,_0x1e4957[_0x219d('0x69')],_0x4d4daa);})[_0x219d('0x25')](function(_0x16413b){_0x508b77=_0x16413b;return getEndUser(_0x391e46,_0x4c17fc,_0x18912a['destcalleridname'],_0x18912a['destcalleridnum'],_0x4d4daa);})[_0x219d('0x25')](function(_0x5273b1){_0x20d8ec=_0x5273b1;return getTicket(_0x391e46,_0x508b77,_0x20d8ec,_0x4c17fc,_0x18912a,_0x4c17fc[_0x219d('0x6c')],_0x4d4daa,_0x219d('0x77'));})[_0x219d('0x25')](function(_0x1c83d8){_0x306cda=_0x1c83d8;logger['info'](_0x219d('0x7a'),_0x306cda['id']);logger['info'](_0x219d('0x7b'),_0x306cda['id'],_0x1e4957[_0x219d('0x54')],_0x391e46[_0x219d('0x4c')]);switch(_0x391e46['type']){case _0x219d('0x6f'):emit(util[_0x219d('0x42')](_0x219d('0x70'),_0x1e4957[_0x219d('0x54')]),'trigger:salesforce:display',{'recordId':_0x306cda['id']});break;case _0x219d('0x71'):emit(util[_0x219d('0x42')](_0x219d('0x70'),_0x1e4957[_0x219d('0x54')]),_0x219d('0x72'),{'uri':util[_0x219d('0x42')](_0x219d('0x73'),_0x4d4daa[_0x219d('0x74')],_0x306cda['id'])});break;default:logger['error']('[OUTBOUND]',_0x219d('0x7c'));}})['catch'](function(_0x118dd4){logger['error'](_0x219d('0x7d'),_0x118dd4);});};exports[_0x219d('0x7e')]=function(_0x421f0c,_0xbb53b2,_0x2ef633,_0x2f52b5,_0x27ca1a,_0x261437){var _0xa2bd04,_0xa29dd2,_0x14da16,_0x59d59f;_0x261437[_0x219d('0x61')]=intUtil[_0x219d('0x62')](_0x261437['serverUrl']);_0x261437['remoteUri']=intUtil['stripTrailingSlash'](_0x261437[_0x219d('0x59')]);if(_0x27ca1a&&_0x27ca1a[_0x219d('0x63')]){logger[_0x219d('0x1c')]('['+_0xbb53b2[_0x219d('0x7f')][_0x219d('0x80')]()+']',_0x219d('0x65'));_0xbb53b2[_0x219d('0x68')]=util['format'](_0x219d('0x66'),_0x261437[_0x219d('0x61')],_0xbb53b2[_0x219d('0x67')],md5(_0xbb53b2[_0x219d('0x67')]));}else{_0xbb53b2[_0x219d('0x68')]='';}return getConnection(_0x261437)['then'](function(_0x5b74ce){_0x59d59f=_0x5b74ce;if(!_[_0x219d('0x20')](_0x2f52b5)){return getUser(_0x261437,_0x2f52b5['name'],_0x59d59f);}else{return getUser(_0x261437,null,_0x59d59f);}})[_0x219d('0x25')](function(_0x3f4c54){_0xa2bd04=_0x3f4c54;return getEndUser(_0x261437,_0x2ef633,_0xbb53b2[_0x219d('0x6a')],_0xbb53b2[_0x219d('0x6b')],_0x59d59f);})['then'](function(_0x1bf932){_0xa29dd2=_0x1bf932;return getTicket(_0x261437,_0xa2bd04,_0xa29dd2,_0x2ef633,_0xbb53b2,_0x2ef633[_0x219d('0x6c')],_0x59d59f);})[_0x219d('0x25')](function(_0x4118c0){_0x14da16=_0x4118c0;logger[_0x219d('0x1c')]('['+_0xbb53b2['lastevent'][_0x219d('0x80')]()+_0x219d('0x81'),_0x14da16['id']);logger[_0x219d('0x1c')]('['+_0xbb53b2[_0x219d('0x7f')][_0x219d('0x80')]()+_0x219d('0x82'),_0x261437[_0x219d('0x4c')]);})[_0x219d('0x83')](function(_0x41359){logger[_0x219d('0x75')]('['+_0xbb53b2[_0x219d('0x7f')][_0x219d('0x80')]()+']',_0x41359);});}; \ 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 af7b396..42651d9 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 _0xcbf8=['outbound','incident','assign','Subjects','Descriptions','ticketId','number','label','?sysparm_query=name%3D','label_entry','Incident\x20-\x20','ticketNumber','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','info','toUpperCase','],\x20getAdminUser\x20crm','error','message','],\x20getUser\x20input\x20crm','userEmail','],\x20getUser\x20entity','active','true','userId','sys_id','catch',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserNumber','forEach','string','type','customField','nameField','content','toString','includes','picklist','idField','toLowerCase','variable','variableName','Variable','name',']\x20getTicket\x20input\x20crm'];(function(_0x1b6f26,_0x1016af){var _0x2ad4c7=function(_0x4e8550){while(--_0x4e8550){_0x1b6f26['push'](_0x1b6f26['shift']());}};_0x2ad4c7(++_0x1016af);}(_0xcbf8,0x9e));var _0x8cbf=function(_0x287cf6,_0x18f260){_0x287cf6=_0x287cf6-0x0;var _0x5c4ddf=_0xcbf8[_0x287cf6];return _0x5c4ddf;};'use strict';var _=require(_0x8cbf('0x0'));var Promise=require(_0x8cbf('0x1'));var rp=require(_0x8cbf('0x2'));var util=require(_0x8cbf('0x3'));var md5=require(_0x8cbf('0x4'));var Redis=require(_0x8cbf('0x5'));var intUtil=require(_0x8cbf('0x6'));var config=require(_0x8cbf('0x7'));var logger=require(_0x8cbf('0x8'))(_0x8cbf('0x9'));config[_0x8cbf('0xa')]=_[_0x8cbf('0xb')](config[_0x8cbf('0xa')],{'host':_0x8cbf('0xc'),'port':0x18eb});var io=require(_0x8cbf('0xd'))(new Redis(config[_0x8cbf('0xa')]));function getAdminUser(_0x21d82f,_0x359481,_0x3dc359,_0x42678e,_0x22da9a,_0x192f15){return new Promise(function(_0x1a5dba,_0x4d8643){var _0x2616e1={'method':_0x8cbf('0xe'),'uri':_0x42678e+_0x8cbf('0xf')+'&'+_0x22da9a+'&'+_0x192f15,'auth':_0x359481,'json':!![]};return rp(_0x2616e1)[_0x8cbf('0x10')](function(_0x623a25){if(_0x623a25[_0x8cbf('0x11')][_0x8cbf('0x12')]>0x0){_0x3dc359[_0x8cbf('0x13')]=_0x623a25[_0x8cbf('0x11')][0x0]['sys_id'];}logger[_0x8cbf('0x14')]('['+[_0x21d82f[_0x8cbf('0x15')]()]+_0x8cbf('0x16'),_0x3dc359);_0x1a5dba(_0x3dc359);})['catch'](function(_0x8fec5c){logger[_0x8cbf('0x17')]('['+[_0x21d82f[_0x8cbf('0x15')]()]+']',_0x8fec5c[_0x8cbf('0x18')]);_0x4d8643(_0x8fec5c[_0x8cbf('0x18')]);});});}function getUser(_0x44dbf1,_0x5dc6f5,_0x2912b7,_0x5d8406,_0x55cffd){return function(_0x499641){logger[_0x8cbf('0x14')]('['+[_0x44dbf1[_0x8cbf('0x15')]()]+_0x8cbf('0x19'),_0x499641);return new Promise(function(_0x23f494,_0x521971){if(intUtil['validateEmail'](_0x499641['userEmail'])){var _0x58fada={'method':_0x8cbf('0xe'),'uri':_0x2912b7+'sys_user?sysparm_query=email%3D'+_0x499641[_0x8cbf('0x1a')]+'&'+_0x5d8406+'&'+_0x55cffd,'auth':_0x5dc6f5,'json':!![]};logger[_0x8cbf('0x14')]('['+[_0x44dbf1[_0x8cbf('0x15')]()]+'],\x20getUser\x20rp\x20obj',_0x58fada);return rp(_0x58fada)['then'](function(_0x37c2a2){logger[_0x8cbf('0x14')]('['+[_0x44dbf1['toUpperCase']()]+_0x8cbf('0x1b'),_0x37c2a2);if(_0x37c2a2[_0x8cbf('0x11')]['length']>0x0&&String(_0x37c2a2[_0x8cbf('0x11')][0x0][_0x8cbf('0x1c')])===_0x8cbf('0x1d')){_0x499641[_0x8cbf('0x1e')]=_0x37c2a2[_0x8cbf('0x11')][0x0][_0x8cbf('0x1f')];}else{_0x499641['userId']=_0x499641[_0x8cbf('0x13')];_0x499641['userEmail']=_0x499641['adminEmail'];}logger[_0x8cbf('0x14')]('['+[_0x44dbf1[_0x8cbf('0x15')]()]+'],\x20getUser\x20crm',_0x499641);_0x23f494(_0x499641);})[_0x8cbf('0x20')](function(_0x3ca0a7){logger[_0x8cbf('0x17')]('['+[_0x44dbf1[_0x8cbf('0x15')]()]+']',_0x3ca0a7[_0x8cbf('0x18')]);_0x521971(_0x3ca0a7[_0x8cbf('0x18')]);});}else{logger[_0x8cbf('0x14')]('['+[_0x44dbf1[_0x8cbf('0x15')]()]+_0x8cbf('0x21'));_0x499641[_0x8cbf('0x1e')]=_0x499641[_0x8cbf('0x13')];_0x499641[_0x8cbf('0x1a')]=_0x499641[_0x8cbf('0x22')];_0x23f494(_0x499641);}});};}function createEndUser(_0x1ba0b0,_0x591ca8,_0x3ec45b,_0x1b1bbc,_0x5de5c3){logger[_0x8cbf('0x14')]('['+[_0x1ba0b0[_0x8cbf('0x15')]()]+_0x8cbf('0x23'),_0x3ec45b);return new Promise(function(_0x3d52f3,_0x41fe55){var _0x2aeb87={'method':_0x8cbf('0x24'),'uri':_0x1b1bbc+_0x8cbf('0x25')+_0x5de5c3,'body':{'user_name':_0x3ec45b['endUserNumber'],'roles':_0x8cbf('0x26'),'first_name':_0x3ec45b['endUserNumber'],'active':_0x8cbf('0x1d'),'date_format':'System','phone':_0x3ec45b['endUserNumber']},'auth':_0x591ca8,'json':!![]};return rp(_0x2aeb87)[_0x8cbf('0x10')](function(_0x43aef2){logger['info']('['+[_0x1ba0b0[_0x8cbf('0x15')]()]+_0x8cbf('0x27'),_0x43aef2['result']);_0x3ec45b[_0x8cbf('0x28')]=_0x43aef2[_0x8cbf('0x11')][_0x8cbf('0x1f')];_0x3d52f3(_0x3ec45b);})[_0x8cbf('0x20')](function(_0x59098e){logger[_0x8cbf('0x17')]('['+[_0x1ba0b0[_0x8cbf('0x15')]()]+']',_0x59098e[_0x8cbf('0x18')]);_0x41fe55(_0x59098e[_0x8cbf('0x18')]);});});}function getEndUser(_0x5a9174,_0x5b5d0e,_0x2de714,_0x156a8d,_0x290ed6){return function(_0x4afe70){logger['info']('['+[_0x5a9174[_0x8cbf('0x15')]()]+_0x8cbf('0x29'),_0x4afe70);return new Promise(function(_0x3c2490,_0x32f763){var _0x22551d={'method':_0x8cbf('0xe'),'uri':_0x2de714+_0x8cbf('0x2a')+_0x4afe70[_0x8cbf('0x2b')]+'&'+_0x156a8d+'&'+_0x290ed6,'auth':_0x5b5d0e,'json':!![]};return rp(_0x22551d)[_0x8cbf('0x10')](function(_0x4726d3){if(_0x4726d3['result'][_0x8cbf('0x12')]>0x0){_0x4afe70[_0x8cbf('0x28')]=_0x4726d3['result'][0x0][_0x8cbf('0x1f')];logger[_0x8cbf('0x14')]('['+[_0x5a9174[_0x8cbf('0x15')]()]+'],\x20getEndUser\x20crm',_0x4afe70);_0x3c2490(_0x4afe70);}else{return createEndUser(_0x5a9174,_0x5b5d0e,_0x4afe70,_0x2de714,_0x156a8d)[_0x8cbf('0x10')](function(_0x30453a){logger[_0x8cbf('0x14')]('['+[_0x5a9174[_0x8cbf('0x15')]()]+'],\x20createEndUser\x20crm',_0x30453a);_0x3c2490(_0x30453a);});}})['catch'](function(_0x5ebcb1){logger[_0x8cbf('0x17')]('['+[_0x5a9174[_0x8cbf('0x15')]()]+']',_0x5ebcb1[_0x8cbf('0x18')]);_0x32f763(_0x5ebcb1['message']);});});};}function getCustomFields(_0x574303,_0x42227f){var _0x4988ca={};if(_0x574303[_0x8cbf('0x12')]>0x0){_[_0x8cbf('0x2c')](_0x574303,function(_0x147c00){if(_['includes']([_0x8cbf('0x2d'),'picklist'],_0x147c00[_0x8cbf('0x2e')])&&_0x147c00['nameField']&&!_0x147c00[_0x8cbf('0x2f')]){_0x4988ca[_0x147c00[_0x8cbf('0x30')]['toLowerCase']()]=_0x147c00[_0x8cbf('0x31')][_0x8cbf('0x32')]();}else if(_[_0x8cbf('0x33')]([_0x8cbf('0x2d'),_0x8cbf('0x34')],_0x147c00[_0x8cbf('0x2e')])&&_0x147c00[_0x8cbf('0x35')]&&_0x147c00[_0x8cbf('0x2f')]){_0x4988ca[_0x147c00['idField'][_0x8cbf('0x36')]()]=_0x147c00[_0x8cbf('0x31')][_0x8cbf('0x32')]();}else if(_0x147c00[_0x8cbf('0x2e')]===_0x8cbf('0x37')&&_0x147c00[_0x8cbf('0x38')]&&_0x147c00[_0x8cbf('0x35')]&&_0x147c00[_0x8cbf('0x2f')]){_0x4988ca[_0x147c00[_0x8cbf('0x35')][_0x8cbf('0x36')]()]=_0x42227f[_0x147c00['variableName']][_0x8cbf('0x32')]();}else if(_0x147c00[_0x8cbf('0x2e')]==='customVariable'&&_0x147c00['Variable']&&_0x147c00[_0x8cbf('0x39')][_0x8cbf('0x3a')]&&_0x147c00[_0x8cbf('0x35')]&&_0x147c00['customField']){_0x4988ca[_0x147c00[_0x8cbf('0x35')][_0x8cbf('0x36')]()]=_0x42227f[_0x147c00[_0x8cbf('0x39')][_0x8cbf('0x3a')][_0x8cbf('0x36')]()][_0x8cbf('0x32')]();}});}return _0x4988ca;}function getTicket(_0x1249f6,_0x1e50f5,_0x304d10,_0x28dc75,_0x389890,_0x3476ae){return function(_0x33cdcc){logger[_0x8cbf('0x14')]('['+[_0x1249f6['toUpperCase']()]+_0x8cbf('0x3b'),_0x33cdcc);return new Promise(function(_0x2842c4,_0x2e1479){var _0x1f4aed=_0x1249f6[_0x8cbf('0x36')]()===_0x8cbf('0x3c')?_0x33cdcc['userId']:_0x33cdcc[_0x8cbf('0x28')];var _0x5aa144={'method':_0x8cbf('0x24'),'uri':_0x304d10+_0x8cbf('0x3d')+'?'+_0x3476ae,'body':Object[_0x8cbf('0x3e')]({},{'active':_0x8cbf('0x1d'),'caller_id':_0x1f4aed,'assigned_to':_0x33cdcc['userId'],'short_description':intUtil['getString'](_0x28dc75[_0x8cbf('0x3f')],_0x389890,'\x20'),'description':intUtil['getString'](_0x28dc75[_0x8cbf('0x40')],_0x389890,'\x0a')},getCustomFields(_0x28dc75['Fields'],_0x389890)),'auth':_0x1e50f5,'json':!![]};return rp(_0x5aa144)[_0x8cbf('0x10')](function(_0x421e74){logger['info']('['+[_0x1249f6[_0x8cbf('0x15')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x421e74[_0x8cbf('0x11')]);_0x33cdcc[_0x8cbf('0x41')]=_0x421e74[_0x8cbf('0x11')]['sys_id'];_0x33cdcc['ticketNumber']=_0x421e74[_0x8cbf('0x11')][_0x8cbf('0x42')];logger[_0x8cbf('0x14')]('['+[_0x1249f6['toUpperCase']()]+']\x20getTicket\x20crm',_0x33cdcc);_0x2842c4(_0x33cdcc);})[_0x8cbf('0x20')](function(_0x231f91){logger['error']('['+[_0x1249f6[_0x8cbf('0x15')]()]+']',_0x231f91[_0x8cbf('0x18')]);_0x2e1479(_0x231f91[_0x8cbf('0x18')]);});});};}function createRemoteTag(_0x38a38b,_0x56b107,_0x124d90,_0x359200){return new Promise(function(_0x1df8d3,_0x34a276){var _0x792cf0={'method':_0x8cbf('0x24'),'uri':_0x124d90+_0x8cbf('0x43')+'?'+_0x359200,'body':{'short_description':_0x38a38b,'global':!![],'active':!![],'name':_0x38a38b},'auth':_0x56b107,'json':!![]};return rp(_0x792cf0)[_0x8cbf('0x10')](function(_0x2133c2){var _0x54bad8=_0x2133c2[_0x8cbf('0x11')][_0x8cbf('0x1f')];_0x1df8d3(_0x54bad8);});});}function getRemoteTag(_0x9bc31d,_0x5cf260,_0x2f5959,_0x6d1a1c,_0x55014c){return new Promise(function(_0x3c48ae,_0x6e253f){var _0x235c9d={'method':_0x8cbf('0xe'),'uri':_0x2f5959+_0x8cbf('0x43')+_0x8cbf('0x44')+_0x9bc31d+'&'+_0x6d1a1c,'auth':_0x5cf260,'json':!![]};return rp(_0x235c9d)[_0x8cbf('0x10')](function(_0x54146d){if(_0x54146d[_0x8cbf('0x11')][_0x8cbf('0x12')]>0x0){var _0x4a36d7=_0x54146d[_0x8cbf('0x11')][0x0][_0x8cbf('0x1f')];_0x3c48ae(_0x4a36d7);}else{return createRemoteTag(_0x9bc31d,_0x5cf260,_0x2f5959,_0x6d1a1c)[_0x8cbf('0x10')](function(_0xe4014){_0x3c48ae(_0xe4014);});}});});}function assignTagToIncident(_0x23b0aa,_0x592f00,_0x421a12,_0x594ce1,_0x309334){return new Promise(function(_0x353363,_0x3cd9b7){var _0xc8d390={'method':_0x8cbf('0x24'),'uri':_0x421a12+_0x8cbf('0x45')+'?'+_0x309334,'body':{'label':_0x23b0aa,'table':_0x8cbf('0x3d'),'id_type':'Incident','table_key':_0x594ce1[_0x8cbf('0x41')],'title':_0x8cbf('0x46')+_0x594ce1[_0x8cbf('0x47')],'id_display':_0x594ce1[_0x8cbf('0x47')]},'auth':_0x592f00,'json':!![]};return rp(_0xc8d390)['then'](function(_0x4a6a11){_0x353363();})['catch'](function(){_0x353363();});});}function manageTags(_0x4c8eed,_0x385ce6,_0x2c73fb,_0x2dbf8f,_0x2f24f1,_0x5f28da,_0x225b45){return new Promise(function(_0x1b31be,_0x11bfac){var _0x1a88d7=[];_0x385ce6[_0x8cbf('0x2c')](function(_0x153623){_0x1a88d7[_0x8cbf('0x48')](getRemoteTag(_0x153623,_0x2c73fb,_0x2dbf8f,_0x5f28da,_0x225b45));});return Promise[_0x8cbf('0x49')](_0x1a88d7)[_0x8cbf('0x10')](function(_0x43320f){if(_0x43320f['length']){logger[_0x8cbf('0x14')]('['+[_0x4c8eed['toUpperCase']()]+_0x8cbf('0x4a'),_0x43320f);var _0x3660aa=[];_0x43320f[_0x8cbf('0x2c')](function(_0xb0b04d){_0x3660aa[_0x8cbf('0x48')](assignTagToIncident(_0xb0b04d,_0x2c73fb,_0x2dbf8f,_0x2f24f1,_0x5f28da));});return Promise[_0x8cbf('0x49')](_0x3660aa)[_0x8cbf('0x10')](function(){_0x1b31be();})[_0x8cbf('0x20')](function(){_0x1b31be();});}else{_0x1b31be();}});});}function getTags(_0x4b6fd7,_0x183dbd,_0x48125a,_0x614970,_0x3b3687,_0x691255){return function(_0x45414f){return new Promise(function(_0x3789bf,_0x31e47d){var _0x9bf3e8=[];var _0x43ae62=_0x614970[_0x8cbf('0x4b')];if(_0x43ae62&&_0x43ae62[_0x8cbf('0x12')]>0x0){_0x9bf3e8=_[_0x8cbf('0x4c')](_0x43ae62,'name');}if(_0x9bf3e8[_0x8cbf('0x12')]>0x0){return manageTags(_0x4b6fd7,_0x9bf3e8,_0x183dbd,_0x48125a,_0x45414f,_0x3b3687,_0x691255)['then'](function(){_0x3789bf(_0x45414f);});}else{_0x3789bf(_0x45414f);}});};}function emit(_0x4b4e73,_0x2b89f8,_0x6f38da){var _0x2638ad=_0x8cbf('0x4d')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x8cbf('0x4e');var _0x3bb47b={'uri':_0x4b4e73+_0x8cbf('0x4f')+_0x6f38da+_0x2638ad};io['to'](util[_0x8cbf('0x50')]('user:%s',_0x2b89f8))[_0x8cbf('0x51')](_0x8cbf('0x52'),_0x3bb47b);}exports['cs']=function(_0x177a8b,_0x1794e8,_0x36a247,_0x39cab8,_0x91658c,_0x465e36,_0x2e2481,_0x26ae0a){var _0x5eecc9={};var _0x37f244={'user':_0x465e36['username'],'pass':_0x465e36[_0x8cbf('0x53')]};var _0x2643a2=_0x8cbf('0x54');var _0xa63bb0=_0x8cbf('0x55');_0x465e36['remoteUri']=intUtil[_0x8cbf('0x56')](_0x465e36[_0x8cbf('0x57')]);_0x465e36[_0x8cbf('0x58')]=intUtil[_0x8cbf('0x56')](_0x465e36[_0x8cbf('0x58')]);var _0x27d564=util[_0x8cbf('0x50')](_0x8cbf('0x59'),_0x465e36[_0x8cbf('0x57')]);_0x5eecc9['userEmail']=!_[_0x8cbf('0x5a')](_0x39cab8)?_0x39cab8[_0x8cbf('0x5b')]:null;_0x5eecc9[_0x8cbf('0x22')]=_0x465e36[_0x8cbf('0x5b')];_0x5eecc9[_0x8cbf('0x2b')]=_0x26ae0a[_0x8cbf('0x36')]()==='outbound'?_0x1794e8[_0x8cbf('0x5c')]:_0x1794e8[_0x8cbf('0x5d')];_0x5eecc9[_0x8cbf('0x5e')]=_0x26ae0a===_0x8cbf('0x5f')||_0x26ae0a===_0x8cbf('0x60')?'queue':_0x8cbf('0x3c');var _0x2e5e25=util[_0x8cbf('0x50')](_0x8cbf('0x61'),_0x465e36['serverUrl'],_0x1794e8[_0x8cbf('0x62')],md5(_0x1794e8[_0x8cbf('0x62')]));if(_0x91658c&&_0x91658c[_0x8cbf('0x63')]){logger[_0x8cbf('0x14')](_0x8cbf('0x64'),_0x8cbf('0x65'));_0x1794e8[_0x8cbf('0x66')]=_0x2e5e25;}else if(_0x2e2481&&_0x2e2481[_0x8cbf('0x67')]&&_0x2e2481[_0x8cbf('0x67')]!=='none'){logger['info'](_0x8cbf('0x68'),_0x8cbf('0x65'));_0x1794e8[_0x8cbf('0x66')]=_0x2e5e25;}else{_0x1794e8['recordingURL']='';}return getAdminUser(_0x26ae0a,_0x37f244,_0x5eecc9,_0x27d564,_0xa63bb0,_0x2643a2)[_0x8cbf('0x10')](getUser(_0x26ae0a,_0x37f244,_0x27d564,_0xa63bb0,_0x2643a2))[_0x8cbf('0x10')](getEndUser(_0x26ae0a,_0x37f244,_0x27d564,_0xa63bb0,_0x2643a2))[_0x8cbf('0x10')](getTicket(_0x26ae0a,_0x37f244,_0x27d564,_0x36a247,_0x1794e8,_0xa63bb0))[_0x8cbf('0x10')](function(_0x56674e){logger[_0x8cbf('0x14')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x56674e[_0x8cbf('0x41')]));logger[_0x8cbf('0x14')](util[_0x8cbf('0x50')](_0x8cbf('0x69'),_0x26ae0a));if(_0x26ae0a!==_0x8cbf('0x60')){logger[_0x8cbf('0x14')]('['+[_0x26ae0a[_0x8cbf('0x15')]()]+']',_0x8cbf('0x6a'));emit(_0x465e36['remoteUri'],_0x39cab8[_0x8cbf('0x3a')],_0x56674e[_0x8cbf('0x41')]);}})[_0x8cbf('0x20')](function(_0x183360){logger[_0x8cbf('0x17')]('['+[_0x26ae0a[_0x8cbf('0x15')]()]+_0x8cbf('0x6b'),util[_0x8cbf('0x6c')](_0x183360,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x31b4=['Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','label_entry','Incident\x20-\x20','push','all','Tags','map','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','emit','trigger:browser:url','password','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','%s/api/now/table/','email','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','Recording\x20is\x20enabled!','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','request-promise','util','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','length','adminId','sys_id','info','catch','error','toUpperCase','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','result','active','userId','adminEmail','message',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','true','endUserNumber','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','string','picklist','type','customField','nameField','toLowerCase','content','toString','includes','idField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','incident','assign','getString'];(function(_0x47dca0,_0x2cc988){var _0x38bcbf=function(_0x1865f1){while(--_0x1865f1){_0x47dca0['push'](_0x47dca0['shift']());}};_0x38bcbf(++_0x2cc988);}(_0x31b4,0x174));var _0x431b=function(_0x506500,_0x2a0c11){_0x506500=_0x506500-0x0;var _0x1d790d=_0x31b4[_0x506500];return _0x1d790d;};'use strict';var _=require(_0x431b('0x0'));var Promise=require(_0x431b('0x1'));var rp=require(_0x431b('0x2'));var util=require(_0x431b('0x3'));var md5=require('md5');var Redis=require(_0x431b('0x4'));var intUtil=require('./util');var config=require(_0x431b('0x5'));var logger=require(_0x431b('0x6'))(_0x431b('0x7'));config[_0x431b('0x8')]=_[_0x431b('0x9')](config[_0x431b('0x8')],{'host':_0x431b('0xa'),'port':0x18eb});var io=require(_0x431b('0xb'))(new Redis(config['redis']));function getAdminUser(_0x4263a9,_0x49da27,_0x23711a,_0x7a50b7,_0x193f3b,_0x1deca4){return new Promise(function(_0x1379cf,_0x335052){var _0x3738f2={'method':_0x431b('0xc'),'uri':_0x7a50b7+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x193f3b+'&'+_0x1deca4,'auth':_0x49da27,'json':!![]};return rp(_0x3738f2)['then'](function(_0x1bb1c1){if(_0x1bb1c1['result'][_0x431b('0xd')]>0x0){_0x23711a[_0x431b('0xe')]=_0x1bb1c1['result'][0x0][_0x431b('0xf')];}logger[_0x431b('0x10')]('['+[_0x4263a9['toUpperCase']()]+'],\x20getAdminUser\x20crm',_0x23711a);_0x1379cf(_0x23711a);})[_0x431b('0x11')](function(_0x4135e3){logger[_0x431b('0x12')]('['+[_0x4263a9['toUpperCase']()]+']',_0x4135e3['message']);_0x335052(_0x4135e3['message']);});});}function getUser(_0x19a3ca,_0x177437,_0x3a07df,_0x53d0d1,_0x233ec8){return function(_0x1e630a){logger[_0x431b('0x10')]('['+[_0x19a3ca[_0x431b('0x13')]()]+_0x431b('0x14'),_0x1e630a);return new Promise(function(_0x3a9d57,_0x23d1e8){if(intUtil[_0x431b('0x15')](_0x1e630a[_0x431b('0x16')])){var _0x2eb918={'method':_0x431b('0xc'),'uri':_0x3a07df+_0x431b('0x17')+_0x1e630a[_0x431b('0x16')]+'&'+_0x53d0d1+'&'+_0x233ec8,'auth':_0x177437,'json':!![]};logger[_0x431b('0x10')]('['+[_0x19a3ca['toUpperCase']()]+_0x431b('0x18'),_0x2eb918);return rp(_0x2eb918)[_0x431b('0x19')](function(_0x2e59dc){logger['info']('['+[_0x19a3ca[_0x431b('0x13')]()]+'],\x20getUser\x20entity',_0x2e59dc);if(_0x2e59dc['result'][_0x431b('0xd')]>0x0&&String(_0x2e59dc[_0x431b('0x1a')][0x0][_0x431b('0x1b')])==='true'){_0x1e630a[_0x431b('0x1c')]=_0x2e59dc['result'][0x0][_0x431b('0xf')];}else{_0x1e630a['userId']=_0x1e630a['adminId'];_0x1e630a[_0x431b('0x16')]=_0x1e630a[_0x431b('0x1d')];}logger[_0x431b('0x10')]('['+[_0x19a3ca['toUpperCase']()]+'],\x20getUser\x20crm',_0x1e630a);_0x3a9d57(_0x1e630a);})[_0x431b('0x11')](function(_0x43f0f3){logger[_0x431b('0x12')]('['+[_0x19a3ca[_0x431b('0x13')]()]+']',_0x43f0f3['message']);_0x23d1e8(_0x43f0f3[_0x431b('0x1e')]);});}else{logger[_0x431b('0x10')]('['+[_0x19a3ca['toUpperCase']()]+_0x431b('0x1f'));_0x1e630a[_0x431b('0x1c')]=_0x1e630a[_0x431b('0xe')];_0x1e630a[_0x431b('0x16')]=_0x1e630a['adminEmail'];_0x3a9d57(_0x1e630a);}});};}function createEndUser(_0x683db5,_0x24a44d,_0x1d5035,_0x47e528,_0x5f374a){logger[_0x431b('0x10')]('['+[_0x683db5['toUpperCase']()]+_0x431b('0x20'),_0x1d5035);return new Promise(function(_0x4feaf7,_0x239d1c){var _0x59d1f1={'method':_0x431b('0x21'),'uri':_0x47e528+_0x431b('0x22')+_0x5f374a,'body':{'user_name':_0x1d5035['endUserNumber'],'roles':_0x431b('0x23'),'first_name':_0x1d5035['endUserNumber'],'active':_0x431b('0x24'),'date_format':'System','phone':_0x1d5035[_0x431b('0x25')]},'auth':_0x24a44d,'json':!![]};return rp(_0x59d1f1)['then'](function(_0x41d2d8){logger[_0x431b('0x10')]('['+[_0x683db5[_0x431b('0x13')]()]+_0x431b('0x26'),_0x41d2d8[_0x431b('0x1a')]);_0x1d5035['endUserId']=_0x41d2d8[_0x431b('0x1a')][_0x431b('0xf')];_0x4feaf7(_0x1d5035);})[_0x431b('0x11')](function(_0x35b359){logger[_0x431b('0x12')]('['+[_0x683db5[_0x431b('0x13')]()]+']',_0x35b359[_0x431b('0x1e')]);_0x239d1c(_0x35b359['message']);});});}function getEndUser(_0x13502d,_0x51a4c6,_0x45f000,_0x1dc971,_0x7c09f0){return function(_0xc74b24){logger[_0x431b('0x10')]('['+[_0x13502d['toUpperCase']()]+_0x431b('0x27'),_0xc74b24);return new Promise(function(_0x956e09,_0x300c63){var _0x2776bc={'method':_0x431b('0xc'),'uri':_0x45f000+_0x431b('0x28')+_0xc74b24[_0x431b('0x25')]+'&'+_0x1dc971+'&'+_0x7c09f0,'auth':_0x51a4c6,'json':!![]};return rp(_0x2776bc)[_0x431b('0x19')](function(_0x488e6f){if(_0x488e6f[_0x431b('0x1a')]['length']>0x0){_0xc74b24[_0x431b('0x29')]=_0x488e6f[_0x431b('0x1a')][0x0][_0x431b('0xf')];logger['info']('['+[_0x13502d[_0x431b('0x13')]()]+_0x431b('0x2a'),_0xc74b24);_0x956e09(_0xc74b24);}else{return createEndUser(_0x13502d,_0x51a4c6,_0xc74b24,_0x45f000,_0x1dc971)[_0x431b('0x19')](function(_0x410873){logger[_0x431b('0x10')]('['+[_0x13502d[_0x431b('0x13')]()]+_0x431b('0x2b'),_0x410873);_0x956e09(_0x410873);});}})['catch'](function(_0x4c5ea9){logger[_0x431b('0x12')]('['+[_0x13502d[_0x431b('0x13')]()]+']',_0x4c5ea9[_0x431b('0x1e')]);_0x300c63(_0x4c5ea9['message']);});});};}function getCustomFields(_0x51782d,_0x4709c1){var _0x380bc8={};if(_0x51782d[_0x431b('0xd')]>0x0){_[_0x431b('0x2c')](_0x51782d,function(_0x1990f6){if(_['includes']([_0x431b('0x2d'),_0x431b('0x2e')],_0x1990f6[_0x431b('0x2f')])&&_0x1990f6['nameField']&&!_0x1990f6[_0x431b('0x30')]){_0x380bc8[_0x1990f6[_0x431b('0x31')][_0x431b('0x32')]()]=_0x1990f6[_0x431b('0x33')][_0x431b('0x34')]();}else if(_[_0x431b('0x35')](['string','picklist'],_0x1990f6[_0x431b('0x2f')])&&_0x1990f6['idField']&&_0x1990f6[_0x431b('0x30')]){_0x380bc8[_0x1990f6[_0x431b('0x36')][_0x431b('0x32')]()]=_0x1990f6[_0x431b('0x33')][_0x431b('0x34')]();}else if(_0x1990f6[_0x431b('0x2f')]===_0x431b('0x37')&&_0x1990f6[_0x431b('0x38')]&&_0x1990f6[_0x431b('0x36')]&&_0x1990f6[_0x431b('0x30')]){_0x380bc8[_0x1990f6['idField'][_0x431b('0x32')]()]=_0x4709c1[_0x1990f6['variableName']][_0x431b('0x34')]();}else if(_0x1990f6[_0x431b('0x2f')]===_0x431b('0x39')&&_0x1990f6[_0x431b('0x3a')]&&_0x1990f6[_0x431b('0x3a')]['name']&&_0x1990f6[_0x431b('0x36')]&&_0x1990f6[_0x431b('0x30')]){_0x380bc8[_0x1990f6[_0x431b('0x36')][_0x431b('0x32')]()]=_0x4709c1[_0x1990f6[_0x431b('0x3a')][_0x431b('0x3b')]['toLowerCase']()][_0x431b('0x34')]();}});}return _0x380bc8;}function getTicket(_0x29f18b,_0x50ebab,_0x2c6eb8,_0x270393,_0xc5698c,_0x2718c1){return function(_0x7d45ae){logger[_0x431b('0x10')]('['+[_0x29f18b['toUpperCase']()]+_0x431b('0x3c'),_0x7d45ae);return new Promise(function(_0x5a67d6,_0x3909fb){var _0x14b7a7=_0x29f18b[_0x431b('0x32')]()==='outbound'?_0x7d45ae[_0x431b('0x1c')]:_0x7d45ae['endUserId'];var _0x2cc9ef={'method':_0x431b('0x21'),'uri':_0x2c6eb8+_0x431b('0x3d')+'?'+_0x2718c1,'body':Object[_0x431b('0x3e')]({},{'active':_0x431b('0x24'),'caller_id':_0x14b7a7,'assigned_to':_0x7d45ae[_0x431b('0x1c')],'short_description':intUtil[_0x431b('0x3f')](_0x270393['Subjects'],_0xc5698c,'\x20'),'description':intUtil[_0x431b('0x3f')](_0x270393[_0x431b('0x40')],_0xc5698c,'\x0a')},getCustomFields(_0x270393[_0x431b('0x41')],_0xc5698c)),'auth':_0x50ebab,'json':!![]};return rp(_0x2cc9ef)['then'](function(_0x396b76){logger[_0x431b('0x10')]('['+[_0x29f18b['toUpperCase']()]+_0x431b('0x42'),_0x396b76[_0x431b('0x1a')]);_0x7d45ae[_0x431b('0x43')]=_0x396b76['result'][_0x431b('0xf')];_0x7d45ae[_0x431b('0x44')]=_0x396b76['result'][_0x431b('0x45')];logger[_0x431b('0x10')]('['+[_0x29f18b[_0x431b('0x13')]()]+_0x431b('0x46'),_0x7d45ae);_0x5a67d6(_0x7d45ae);})[_0x431b('0x11')](function(_0x30e69d){logger[_0x431b('0x12')]('['+[_0x29f18b[_0x431b('0x13')]()]+']',_0x30e69d[_0x431b('0x1e')]);_0x3909fb(_0x30e69d[_0x431b('0x1e')]);});});};}function createRemoteTag(_0x5be822,_0x5c958f,_0x56d522,_0x1df52b){return new Promise(function(_0x32218d,_0x51af01){var _0xd91132={'method':_0x431b('0x21'),'uri':_0x56d522+_0x431b('0x47')+'?'+_0x1df52b,'body':{'short_description':_0x5be822,'global':!![],'active':!![],'name':_0x5be822},'auth':_0x5c958f,'json':!![]};return rp(_0xd91132)[_0x431b('0x19')](function(_0x45e240){var _0x5b646a=_0x45e240['result'][_0x431b('0xf')];_0x32218d(_0x5b646a);});});}function getRemoteTag(_0x28983d,_0x2a4785,_0x11cd7b,_0x4b1825,_0x3fb78d){return new Promise(function(_0x28eaa2,_0x36dbe3){var _0x3eb3e4={'method':'GET','uri':_0x11cd7b+_0x431b('0x47')+'?sysparm_query=name%3D'+_0x28983d+'&'+_0x4b1825,'auth':_0x2a4785,'json':!![]};return rp(_0x3eb3e4)[_0x431b('0x19')](function(_0x5a20e9){if(_0x5a20e9[_0x431b('0x1a')][_0x431b('0xd')]>0x0){var _0x20eb3c=_0x5a20e9[_0x431b('0x1a')][0x0][_0x431b('0xf')];_0x28eaa2(_0x20eb3c);}else{return createRemoteTag(_0x28983d,_0x2a4785,_0x11cd7b,_0x4b1825)[_0x431b('0x19')](function(_0x2691e3){_0x28eaa2(_0x2691e3);});}});});}function assignTagToIncident(_0x214aa9,_0x26d120,_0x15168b,_0x47a36b,_0x170f54){return new Promise(function(_0x225b29,_0x36edf7){var _0x32bcf5={'method':_0x431b('0x21'),'uri':_0x15168b+_0x431b('0x48')+'?'+_0x170f54,'body':{'label':_0x214aa9,'table':'incident','id_type':'Incident','table_key':_0x47a36b[_0x431b('0x43')],'title':_0x431b('0x49')+_0x47a36b[_0x431b('0x44')],'id_display':_0x47a36b[_0x431b('0x44')]},'auth':_0x26d120,'json':!![]};return rp(_0x32bcf5)[_0x431b('0x19')](function(_0x536a5e){_0x225b29();})[_0x431b('0x11')](function(){_0x225b29();});});}function manageTags(_0x50f30f,_0x58569c,_0x194e2d,_0x200dad,_0x3b0c70,_0x356d61,_0x5b28b1){return new Promise(function(_0x6cc0a6,_0x28bac7){var _0x2600e3=[];_0x58569c[_0x431b('0x2c')](function(_0x3264ad){_0x2600e3[_0x431b('0x4a')](getRemoteTag(_0x3264ad,_0x194e2d,_0x200dad,_0x356d61,_0x5b28b1));});return Promise[_0x431b('0x4b')](_0x2600e3)[_0x431b('0x19')](function(_0x2bab7e){if(_0x2bab7e['length']){logger['info']('['+[_0x50f30f['toUpperCase']()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x2bab7e);var _0x34299f=[];_0x2bab7e[_0x431b('0x2c')](function(_0x92cfa9){_0x34299f[_0x431b('0x4a')](assignTagToIncident(_0x92cfa9,_0x194e2d,_0x200dad,_0x3b0c70,_0x356d61));});return Promise[_0x431b('0x4b')](_0x34299f)[_0x431b('0x19')](function(){_0x6cc0a6();})[_0x431b('0x11')](function(){_0x6cc0a6();});}else{_0x6cc0a6();}});});}function getTags(_0x4bba87,_0xd2816,_0x2b1143,_0xa92e91,_0x43a182,_0x445ffc){return function(_0x41953f){return new Promise(function(_0x5c2428,_0x39512){var _0x6260dd=[];var _0x41caf1=_0xa92e91[_0x431b('0x4c')];if(_0x41caf1&&_0x41caf1[_0x431b('0xd')]>0x0){_0x6260dd=_[_0x431b('0x4d')](_0x41caf1,_0x431b('0x3b'));}if(_0x6260dd['length']>0x0){return manageTags(_0x4bba87,_0x6260dd,_0xd2816,_0x2b1143,_0x41953f,_0x43a182,_0x445ffc)['then'](function(){_0x5c2428(_0x41953f);});}else{_0x5c2428(_0x41953f);}});};}function emit(_0x5788c0,_0x554ae3,_0x1ec65f){var _0x2c0b7f='%26sysparm_record_target%3Dincident'+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x431b('0x4e')+_0x431b('0x4f');var _0x4368db={'uri':_0x5788c0+_0x431b('0x50')+_0x1ec65f+_0x2c0b7f};io['to'](util['format'](_0x431b('0x51'),_0x554ae3))[_0x431b('0x52')](_0x431b('0x53'),_0x4368db);}exports['cs']=function(_0x4f746,_0x4f8fee,_0x3fc6c9,_0x1df655,_0x4e3eca,_0x1f2218,_0x4a8959,_0x2cf9ba){var _0x2ae4a9={};var _0x1160e2={'user':_0x1f2218['username'],'pass':_0x1f2218[_0x431b('0x54')]};var _0x31eb7d='sysparm_limit=1';var _0x33864c=_0x431b('0x55');_0x1f2218[_0x431b('0x56')]=intUtil[_0x431b('0x57')](_0x1f2218[_0x431b('0x56')]);_0x1f2218[_0x431b('0x58')]=intUtil['stripTrailingSlash'](_0x1f2218[_0x431b('0x58')]);var _0x5a35ba=util[_0x431b('0x59')](_0x431b('0x5a'),_0x1f2218['remoteUri']);_0x2ae4a9[_0x431b('0x16')]=!_['isNil'](_0x1df655)?_0x1df655[_0x431b('0x5b')]:null;_0x2ae4a9['adminEmail']=_0x1f2218[_0x431b('0x5b')];_0x2ae4a9[_0x431b('0x25')]=_0x2cf9ba['toLowerCase']()===_0x431b('0x5c')?_0x4f8fee[_0x431b('0x5d')]:_0x4f8fee[_0x431b('0x5e')];_0x2ae4a9[_0x431b('0x5f')]=_0x2cf9ba===_0x431b('0x60')||_0x2cf9ba===_0x431b('0x61')?_0x431b('0x60'):_0x431b('0x5c');var _0x37b9fe=util[_0x431b('0x59')](_0x431b('0x62'),_0x1f2218[_0x431b('0x58')],_0x4f8fee[_0x431b('0x63')],md5(_0x4f8fee[_0x431b('0x63')]));if(_0x4e3eca&&_0x4e3eca[_0x431b('0x64')]){logger[_0x431b('0x10')](_0x431b('0x65'),'Recording\x20is\x20enabled!');_0x4f8fee[_0x431b('0x66')]=_0x37b9fe;}else if(_0x4a8959&&_0x4a8959[_0x431b('0x67')]&&_0x4a8959[_0x431b('0x67')]!==_0x431b('0x68')){logger[_0x431b('0x10')]('[OUTBOUND]',_0x431b('0x69'));_0x4f8fee['recordingURL']=_0x37b9fe;}else{_0x4f8fee['recordingURL']='';}return getAdminUser(_0x2cf9ba,_0x1160e2,_0x2ae4a9,_0x5a35ba,_0x33864c,_0x31eb7d)[_0x431b('0x19')](getUser(_0x2cf9ba,_0x1160e2,_0x5a35ba,_0x33864c,_0x31eb7d))[_0x431b('0x19')](getEndUser(_0x2cf9ba,_0x1160e2,_0x5a35ba,_0x33864c,_0x31eb7d))[_0x431b('0x19')](getTicket(_0x2cf9ba,_0x1160e2,_0x5a35ba,_0x3fc6c9,_0x4f8fee,_0x33864c))[_0x431b('0x19')](function(_0x112bcb){logger[_0x431b('0x10')](util[_0x431b('0x59')]('The\x20ticket\x20ID\x20is:\x20%s',_0x112bcb['ticketId']));logger[_0x431b('0x10')](util[_0x431b('0x59')](_0x431b('0x6a'),_0x2cf9ba));if(_0x2cf9ba!=='unmanaged'){logger[_0x431b('0x10')]('['+[_0x2cf9ba[_0x431b('0x13')]()]+']',_0x431b('0x6b'));emit(_0x1f2218[_0x431b('0x56')],_0x1df655[_0x431b('0x3b')],_0x112bcb[_0x431b('0x43')]);}})[_0x431b('0x11')](function(_0x155947){logger[_0x431b('0x12')]('['+[_0x2cf9ba[_0x431b('0x13')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x431b('0x6c')](_0x155947,{'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 c170fe9..d04dd1a 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 _0x5c18=['Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Enduser\x20created.','debug','[HTTP]','merge','map','type','nameField','toLowerCase','content','string','customField','custom_fields','idField','variable','customVariable','Variable','username','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','The\x20Ticket\x20ID\x20is:','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','uri','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20Enduser\x20ID\x20is:','Fields','charAt','unmanaged','toUpperCase','Ticket\x20created!','users','lastevent','lodash','request-promise','bluebird','md5','util','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','created_by','description','Descriptions','slice','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','length','forEach','variableName','push','set_entry','JSON','Calls','Basic\x20%s','apiKey','toString','base64','get_server_info','stringify','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','find','entry_list','name_value_list','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x5c18,0x131));var _0x85c1=function(_0x2720c1,_0x51c127){_0x2720c1=_0x2720c1-0x0;var _0x2f0631=_0x5c18[_0x2720c1];return _0x2f0631;};'use strict';var _=require(_0x85c1('0x0'));var rp=require(_0x85c1('0x1'));var BPromise=require(_0x85c1('0x2'));var md5=require(_0x85c1('0x3'));var util=require(_0x85c1('0x4'));var Redis=require(_0x85c1('0x5'));var intUtil=require('./util');var config=require(_0x85c1('0x6'));var logger=require(_0x85c1('0x7'))('sugarcrm');config[_0x85c1('0x8')]=_[_0x85c1('0x9')](config[_0x85c1('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x85c1('0xa'))(new Redis(config[_0x85c1('0x8')]));var def={'method':_0x85c1('0xb'),'json':!![]};function emit(_0xa1b96d,_0x5a9c6d,_0xac3af5){io['to'](_0xa1b96d)[_0x85c1('0xc')](_0x5a9c6d,_0xac3af5);}function getTicket(_0x5d4e50,_0x4151d9,_0x58cfb3,_0x39c399,_0x5b8895,_0x19231d,_0x4e5302,_0x1e71bb){logger[_0x85c1('0xd')](_0x85c1('0xe'));var _0x10d74c=new Date();var _0x1ee079=[{'name':_0x85c1('0xf'),'value':intUtil[_0x85c1('0x10')](_0x39c399[_0x85c1('0x11')],_0x5b8895,'\x20')},{'name':'assigned_user_id','value':_0x4151d9['id']},{'name':_0x85c1('0x12'),'value':_0x4151d9['id']},{'name':_0x85c1('0x13'),'value':intUtil[_0x85c1('0x10')](_0x39c399[_0x85c1('0x14')],_0x5b8895,'\x0a')},{'name':'date_start','value':_0x10d74c['toISOString']()[_0x85c1('0x15')](0x0,0x13)['replace']('T','\x20')},{'name':_0x85c1('0x16'),'value':'0'},{'name':_0x85c1('0x17'),'value':'15'},{'name':_0x85c1('0x18'),'value':_0x58cfb3['id']},{'name':_0x85c1('0x19'),'value':_0x85c1('0x1a')},{'name':_0x85c1('0x1b'),'value':_0x58cfb3['name']},{'name':'direction','value':_0x1e71bb}];if(_0x19231d[_0x85c1('0x1c')]){_[_0x85c1('0x1d')](_0x19231d,function(_0x496b62){if(_0x5b8895[_0x496b62[_0x85c1('0x1e')]]){_0x1ee079[_0x85c1('0x1f')]({'name':_0x496b62['idField'],'value':_0x5b8895[_0x496b62[_0x85c1('0x1e')]]});}});}return request({'form':{'method':_0x85c1('0x20'),'input_type':_0x85c1('0x21'),'response_type':_0x85c1('0x21'),'rest_data':JSON['stringify']({'session':_0x4e5302['id'],'module_name':_0x85c1('0x22'),'name_value_list':_0x1ee079})}});}function getAuth(_0x10a2d2){return util['format'](_0x85c1('0x23'),new Buffer(_0x10a2d2[_0x85c1('0x24')]+':X')[_0x85c1('0x25')](_0x85c1('0x26')));}function getServerInfo(_0x9fa996){return request({'form':{'method':_0x85c1('0x27'),'input_type':'JSON','response_type':_0x85c1('0x21'),'rest_data':JSON[_0x85c1('0x28')]({'session':_0x9fa996['id']})}});}function getUser(_0x166ec8,_0x4c146e,_0x11a900){if(!_[_0x85c1('0x29')](_0x4c146e)){logger[_0x85c1('0xd')](_0x85c1('0x2a'),_0x4c146e);return request({'form':{'method':_0x85c1('0x2b'),'input_type':_0x85c1('0x21'),'response_type':'JSON','rest_data':JSON[_0x85c1('0x28')]({'session':_0x11a900['id'],'module_name':_0x85c1('0x2c'),'query':util[_0x85c1('0x2d')](_0x85c1('0x2e'),_0x4c146e),'order_by':'','offset':'0','select_fields':['id',_0x85c1('0xf'),_0x85c1('0x2f')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x85c1('0x30')](function(_0xf6ebd3){if(_0xf6ebd3['entry_list'][_0x85c1('0x1c')]){var _0x18fde4=_[_0x85c1('0x31')](_0xf6ebd3[_0x85c1('0x32')],function(_0x2c1acd){return _0x2c1acd[_0x85c1('0x33')]['user_name'][_0x85c1('0x34')]===_0x4c146e;});if(_0x18fde4){logger[_0x85c1('0xd')]('Agent\x20found!');return BPromise[_0x85c1('0x35')]({'id':_0x18fde4['name_value_list']['id'][_0x85c1('0x34')],'name':_0x18fde4['name_value_list'][_0x85c1('0xf')][_0x85c1('0x34')]});}}logger[_0x85c1('0xd')](_0x85c1('0x36'));return BPromise['resolve']({'id':_0x11a900[_0x85c1('0x33')][_0x85c1('0x37')][_0x85c1('0x34')],'name':_0x11a900[_0x85c1('0x33')]['user_name'][_0x85c1('0x34')]});});}else{logger['info'](_0x85c1('0x38'));return BPromise[_0x85c1('0x35')]({'id':_0x11a900['name_value_list'][_0x85c1('0x37')]['value'],'name':_0x11a900['name_value_list']['user_name'][_0x85c1('0x34')]});}}function getEndUser(_0x1a884e,_0x1f4589,_0x2d032e,_0x299bc6){logger[_0x85c1('0xd')](_0x85c1('0x39'),_0x2d032e);return request({'form':{'method':_0x85c1('0x2b'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x85c1('0x28')]({'session':_0x299bc6['id'],'module_name':_0x85c1('0x1a'),'query':util['format'](_0x85c1('0x3a'),_0x2d032e),'order_by':'','offset':'0','select_fields':['id',_0x85c1('0xf'),_0x85c1('0x3b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x1d84fe){if(_0x1d84fe[_0x85c1('0x32')][_0x85c1('0x1c')]){var _0x289caa=_[_0x85c1('0x31')](_0x1d84fe['entry_list'],function(_0x359737){return _0x359737['name_value_list'][_0x85c1('0x3b')][_0x85c1('0x34')]===_0x2d032e;});if(_0x289caa){logger['info'](_0x85c1('0x3c'));return BPromise[_0x85c1('0x35')]({'id':_0x289caa[_0x85c1('0x33')]['id'][_0x85c1('0x34')],'name':_0x289caa[_0x85c1('0x33')][_0x85c1('0xf')][_0x85c1('0x34')],'phone':_0x289caa[_0x85c1('0x33')][_0x85c1('0x3b')][_0x85c1('0x34')]});}}else{logger[_0x85c1('0xd')](_0x85c1('0x3d'));return request({'form':{'method':_0x85c1('0x20'),'input_type':_0x85c1('0x21'),'response_type':_0x85c1('0x21'),'rest_data':JSON['stringify']({'session':_0x299bc6['id'],'module_name':_0x85c1('0x1a'),'name_value_list':[{'name':_0x85c1('0x3e'),'value':_0x1f4589!==_0x85c1('0x3f')?_0x1f4589:util[_0x85c1('0x2d')]('Caller\x20-\x20%s',_0x2d032e)},{'name':'phone_home','value':_0x2d032e}]})}})[_0x85c1('0x30')](function(_0xc6cd40){logger['info'](_0x85c1('0x40'));return BPromise[_0x85c1('0x35')]({'id':_0xc6cd40['id'],'name':_0xc6cd40[_0x85c1('0x32')][_0x85c1('0x3e')][_0x85c1('0x34')],'phone':_0xc6cd40['entry_list']['phone_home'][_0x85c1('0x34')]});});}});}function request(_0x1eeef2){logger[_0x85c1('0x41')](_0x85c1('0x42'),JSON[_0x85c1('0x28')](_0x1eeef2));return rp(_[_0x85c1('0x43')](def,_0x1eeef2));}function getTags(_0x46a67b,_0x235553){var _0xeab506=[];if(_0x46a67b&&_0x46a67b[_0x85c1('0x1c')]>0x0){_0xeab506=_[_0x85c1('0x44')](_0x46a67b,_0x235553);}return _0xeab506;}function getCustomFields(_0x5a90cc,_0x75aa9){var _0x461bca=[];var _0x49bbd5={'custom_fields':[]};if(_0x5a90cc[_0x85c1('0x1c')]>0x0){_['forEach'](_0x5a90cc,function(_0x48c2d7){if(_0x48c2d7[_0x85c1('0x45')]==='string'&&_0x48c2d7[_0x85c1('0x46')]&&!_0x48c2d7['customField']){_0x49bbd5[_0x48c2d7[_0x85c1('0x46')][_0x85c1('0x47')]()]=_0x48c2d7[_0x85c1('0x48')][_0x85c1('0x25')]();}else if(_0x48c2d7[_0x85c1('0x45')]===_0x85c1('0x49')&&_0x48c2d7['idField']&&_0x48c2d7[_0x85c1('0x4a')]){_0x49bbd5[_0x85c1('0x4b')]['push']({'id':_0x48c2d7[_0x85c1('0x4c')],'value':_0x48c2d7['content'][_0x85c1('0x25')]()});}else if(_0x48c2d7[_0x85c1('0x45')]===_0x85c1('0x4d')&&_0x48c2d7[_0x85c1('0x1e')]&&_0x48c2d7['idField']&&_0x48c2d7[_0x85c1('0x4a')]){_0x75aa9[_0x48c2d7['variableName']]&&_0x49bbd5[_0x85c1('0x4b')][_0x85c1('0x1f')]({'id':_0x48c2d7[_0x85c1('0x4c')],'value':_0x75aa9[_0x48c2d7[_0x85c1('0x1e')]][_0x85c1('0x25')]()});}else if(_0x48c2d7[_0x85c1('0x45')]===_0x85c1('0x4e')&&_0x48c2d7[_0x85c1('0x4f')]&&_0x48c2d7[_0x85c1('0x4f')][_0x85c1('0xf')]&&_0x48c2d7[_0x85c1('0x4c')]&&_0x48c2d7['customField']){_0x75aa9[_0x48c2d7['Variable'][_0x85c1('0xf')][_0x85c1('0x47')]()]&&_0x49bbd5[_0x85c1('0x4b')][_0x85c1('0x1f')]({'id':_0x48c2d7['idField'],'value':_0x75aa9[_0x48c2d7[_0x85c1('0x4f')][_0x85c1('0xf')][_0x85c1('0x47')]()][_0x85c1('0x25')]()});}});}return _0x49bbd5;}function getConnection(_0xa49e0a){return request({'method':_0x85c1('0xb'),'form':{'method':'login','input_type':_0x85c1('0x21'),'response_type':_0x85c1('0x21'),'rest_data':JSON[_0x85c1('0x28')]({'user_auth':{'user_name':_0xa49e0a[_0x85c1('0x50')],'password':_0xa49e0a['password'],'encryption':_0x85c1('0x51')},'application':_0x85c1('0x52')})}})['then'](function(_0x386dfa){var _0x11cb30=_0x386dfa;if(_0x11cb30['id']){def['sessionID']=_0x11cb30['id'];return BPromise['resolve'](_0x11cb30);}else{throw new Error(util[_0x85c1('0x2d')](_0x85c1('0x53'),_0xa49e0a['id']));}});}function setRelationship(_0x5f23d8,_0x2f35fb,_0x99b00b,_0x22006e){return request({'form':{'method':_0x85c1('0x54'),'input_type':_0x85c1('0x21'),'response_type':_0x85c1('0x21'),'rest_data':JSON['stringify']({'session':_0x5f23d8['id'],'module_name':'Calls','module_id':_0x99b00b['id'],'link_field_name':_0x22006e,'related_ids':[_0x2f35fb['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x85c1('0x55')]=function(_0x1a94c4,_0x28472e,_0x4506e7,_0x43944f,_0x29955f,_0x3846c3){var _0x2cf7f2,_0x52d111,_0x101b3c,_0x477890;_0x3846c3[_0x85c1('0x56')]=intUtil[_0x85c1('0x57')](_0x3846c3[_0x85c1('0x56')]);_0x3846c3[_0x85c1('0x58')]=intUtil[_0x85c1('0x57')](_0x3846c3[_0x85c1('0x58')]);def['uri']=util[_0x85c1('0x2d')](_0x85c1('0x59'),_0x3846c3[_0x85c1('0x56')]);if(_0x29955f&&_0x29955f['monitor_format']){logger[_0x85c1('0xd')]('[QUEUE]',_0x85c1('0x5a'));_0x28472e[_0x85c1('0x5b')]=util[_0x85c1('0x2d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3846c3['serverUrl'],_0x28472e[_0x85c1('0x5c')],md5(_0x28472e[_0x85c1('0x5c')]));}else{_0x28472e[_0x85c1('0x5b')]='';}return getConnection(_0x3846c3)[_0x85c1('0x30')](function(_0x50604b){_0x477890=_0x50604b;return getUser(_0x3846c3,_0x43944f[_0x85c1('0xf')],_0x477890);})['then'](function(_0x3f92d0){_0x2cf7f2=_0x3f92d0;logger[_0x85c1('0xd')](_0x85c1('0x5d'),_0x2cf7f2['id']);return getEndUser(_0x3846c3,_0x28472e[_0x85c1('0x5e')],_0x28472e[_0x85c1('0x5f')],_0x477890);})[_0x85c1('0x30')](function(_0x45878a){_0x52d111=_0x45878a;logger[_0x85c1('0xd')]('The\x20Enduser\x20ID\x20is:',_0x52d111['id']);return getTicket(_0x3846c3,_0x2cf7f2,_0x52d111,_0x4506e7,_0x28472e,_0x4506e7['Fields'],_0x477890,_0x85c1('0x60'));})['then'](function(_0x2d4cbd){_0x101b3c=_0x2d4cbd;logger[_0x85c1('0xd')]('Ticket\x20created!');logger[_0x85c1('0xd')](_0x85c1('0x61'),_0x101b3c['id']);return setRelationship(_0x477890,_0x2cf7f2,_0x101b3c,'users');})[_0x85c1('0x30')](function(){return setRelationship(_0x477890,_0x52d111,_0x101b3c,_0x85c1('0x62'));})[_0x85c1('0x30')](function(){return getServerInfo(_0x477890);})[_0x85c1('0x30')](function(_0x570929){var _0x1c1c60=parseInt(_0x570929[_0x85c1('0x63')]['charAt'](0x0));var _0x3a3913=util[_0x85c1('0x2d')](_0x85c1('0x64'),_0x3846c3[_0x85c1('0x56')],_0x101b3c['id']);if(_0x1c1c60>0x6){_0x3a3913=util['format'](_0x85c1('0x65'),_0x3846c3[_0x85c1('0x56')],_0x101b3c['id']);}logger[_0x85c1('0xd')](_0x85c1('0x66'),_0x85c1('0x67'));emit(util[_0x85c1('0x2d')](_0x85c1('0x68'),_0x43944f[_0x85c1('0xf')]),_0x85c1('0x69'),{'uri':_0x3a3913});})[_0x85c1('0x6a')](function(_0x391f04){logger[_0x85c1('0x6b')](_0x85c1('0x66'),JSON[_0x85c1('0x28')](_0x391f04));});};exports[_0x85c1('0x6c')]=function(_0x1a4d67,_0x37edf2,_0x19add6,_0x235725,_0x1e5e67,_0x10ea53,_0x4a74b2){var _0x2042c6,_0x36b0f6,_0xf69ea9,_0x15f2fc;_0x10ea53[_0x85c1('0x56')]=intUtil['stripTrailingSlash'](_0x10ea53[_0x85c1('0x56')]);_0x10ea53[_0x85c1('0x58')]=intUtil[_0x85c1('0x57')](_0x10ea53[_0x85c1('0x58')]);def[_0x85c1('0x6d')]=util['format']('%s/service/v4_1/rest.php',_0x10ea53[_0x85c1('0x56')]);if(_0x4a74b2&&_0x4a74b2[_0x85c1('0x6e')]&&_0x4a74b2[_0x85c1('0x6e')]!==_0x85c1('0x6f')){logger['info'](_0x85c1('0x70'),_0x85c1('0x5a'));_0x37edf2['recordingURL']=util[_0x85c1('0x2d')](_0x85c1('0x71'),_0x10ea53[_0x85c1('0x58')],_0x37edf2[_0x85c1('0x5c')],md5(_0x37edf2[_0x85c1('0x5c')]));}return getConnection(_0x10ea53)['then'](function(_0x41319b){_0x15f2fc=_0x41319b;return getUser(_0x10ea53,_0x235725['name'],_0x15f2fc);})['then'](function(_0x15aa21){_0x2042c6=_0x15aa21;logger['info'](_0x85c1('0x5d'),_0x2042c6['id']);return getEndUser(_0x10ea53,_0x37edf2['destcalleridname'],_0x37edf2['destcalleridnum'],_0x15f2fc);})[_0x85c1('0x30')](function(_0x14a68d){_0x36b0f6=_0x14a68d;logger[_0x85c1('0xd')](_0x85c1('0x72'),_0x36b0f6['id']);return getTicket(_0x10ea53,_0x2042c6,_0x36b0f6,_0x19add6,_0x37edf2,_0x19add6[_0x85c1('0x73')],_0x15f2fc,'Outbound');})[_0x85c1('0x30')](function(_0x165184){_0xf69ea9=_0x165184;logger[_0x85c1('0xd')]('Ticket\x20created!');logger['info'](_0x85c1('0x61'),_0xf69ea9['id']);return setRelationship(_0x15f2fc,_0x2042c6,_0xf69ea9,'users');})['then'](function(){return setRelationship(_0x15f2fc,_0x36b0f6,_0xf69ea9,_0x85c1('0x62'));})['then'](function(){return getServerInfo(_0x15f2fc);})[_0x85c1('0x30')](function(_0xd84cb4){var _0x4a1eba=parseInt(_0xd84cb4['version'][_0x85c1('0x74')](0x0));var _0x2e75ec=util[_0x85c1('0x2d')](_0x85c1('0x64'),_0x10ea53[_0x85c1('0x56')],_0xf69ea9['id']);if(_0x4a1eba>0x6){_0x2e75ec=util[_0x85c1('0x2d')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x10ea53['remoteUri'],_0xf69ea9['id']);}logger['info']('[OUTBOUND]',_0x85c1('0x67'));emit(util[_0x85c1('0x2d')]('user:%s',_0x235725[_0x85c1('0xf')]),_0x85c1('0x69'),{'uri':_0x2e75ec});})[_0x85c1('0x6a')](function(_0x35752e){logger[_0x85c1('0x6b')](_0x85c1('0x70'),JSON['stringify'](_0x35752e));});};exports[_0x85c1('0x75')]=function(_0x404fc1,_0x3b6fe7,_0xcf2fa1,_0x50e79b,_0x59448e,_0x14700c){var _0x5b94b1,_0x34146e,_0x37699c,_0x5dd60c;_0x14700c['remoteUri']=intUtil[_0x85c1('0x57')](_0x14700c[_0x85c1('0x56')]);_0x14700c[_0x85c1('0x58')]=intUtil[_0x85c1('0x57')](_0x14700c[_0x85c1('0x58')]);def[_0x85c1('0x6d')]=util[_0x85c1('0x2d')](_0x85c1('0x59'),_0x14700c[_0x85c1('0x56')]);if(_0x59448e&&_0x59448e['monitor_format']){logger[_0x85c1('0xd')]('['+_0x3b6fe7['lastevent'][_0x85c1('0x76')]()+']',_0x85c1('0x5a'));_0x3b6fe7[_0x85c1('0x5b')]=util['format'](_0x85c1('0x71'),_0x14700c[_0x85c1('0x58')],_0x3b6fe7[_0x85c1('0x5c')],md5(_0x3b6fe7['uniqueid']));}else{_0x3b6fe7[_0x85c1('0x5b')]='';}return getConnection(_0x14700c)[_0x85c1('0x30')](function(_0x19e75){_0x5dd60c=_0x19e75;if(!_[_0x85c1('0x29')](_0x50e79b)){return getUser(_0x14700c,_0x50e79b['name'],_0x5dd60c);}else{return getUser(_0x14700c,null,_0x5dd60c);}})['then'](function(_0x5a91d2){_0x5b94b1=_0x5a91d2;logger[_0x85c1('0xd')](_0x85c1('0x5d'),_0x5b94b1['id']);return getEndUser(_0x14700c,_0x3b6fe7[_0x85c1('0x5e')],_0x3b6fe7[_0x85c1('0x5f')],_0x5dd60c);})[_0x85c1('0x30')](function(_0x36cd81){_0x34146e=_0x36cd81;logger[_0x85c1('0xd')](_0x85c1('0x72'),_0x34146e['id']);return getTicket(_0x14700c,_0x5b94b1,_0x34146e,_0xcf2fa1,_0x3b6fe7,_0xcf2fa1[_0x85c1('0x73')],_0x5dd60c,_0x85c1('0x60'));})[_0x85c1('0x30')](function(_0x9854d1){_0x37699c=_0x9854d1;logger[_0x85c1('0xd')](_0x85c1('0x77'));logger[_0x85c1('0xd')](_0x85c1('0x61'),_0x37699c['id']);return setRelationship(_0x5dd60c,_0x5b94b1,_0x37699c,_0x85c1('0x78'));})[_0x85c1('0x30')](function(){return setRelationship(_0x5dd60c,_0x34146e,_0x37699c,_0x85c1('0x62'));})[_0x85c1('0x30')](function(){return getServerInfo(_0x5dd60c);})[_0x85c1('0x6a')](function(_0x1be65f){logger[_0x85c1('0x6b')]('['+_0x3b6fe7[_0x85c1('0x79')][_0x85c1('0x76')]()+']',JSON[_0x85c1('0x28')](_0x1be65f));});}; \ No newline at end of file +var _0xfd41=['Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','debug','[HTTP]','map','forEach','type','nameField','customField','content','string','custom_fields','customVariable','Variable','toLowerCase','login','username','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','stripTrailingSlash','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','[QUEUE]','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','destcalleridname','destcalleridnum','unmanaged','monitor_format','lastevent','isNil','toUpperCase','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','defaults','redis','localhost','POST','emit','name','getString','assigned_user_id','description','slice','replace','duration_hours','parent_id','parent_type','Contacts','parent_name','direction','length','variableName','push','idField','set_entry','JSON','stringify','Calls','format','apiKey','toString','get_server_info','info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!'];(function(_0x1eec3a,_0x168828){var _0x133cf7=function(_0x1a0c97){while(--_0x1a0c97){_0x1eec3a['push'](_0x1eec3a['shift']());}};_0x133cf7(++_0x168828);}(_0xfd41,0xbb));var _0x1fd4=function(_0x4fa166,_0x58b7fb){_0x4fa166=_0x4fa166-0x0;var _0x5dd974=_0xfd41[_0x4fa166];return _0x5dd974;};'use strict';var _=require(_0x1fd4('0x0'));var rp=require(_0x1fd4('0x1'));var BPromise=require(_0x1fd4('0x2'));var md5=require(_0x1fd4('0x3'));var util=require(_0x1fd4('0x4'));var Redis=require(_0x1fd4('0x5'));var intUtil=require(_0x1fd4('0x6'));var config=require(_0x1fd4('0x7'));var logger=require(_0x1fd4('0x8'))(_0x1fd4('0x9'));config['redis']=_[_0x1fd4('0xa')](config[_0x1fd4('0xb')],{'host':_0x1fd4('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1fd4('0xb')]));var def={'method':_0x1fd4('0xd'),'json':!![]};function emit(_0x28033d,_0xd07df3,_0x1b326c){io['to'](_0x28033d)[_0x1fd4('0xe')](_0xd07df3,_0x1b326c);}function getTicket(_0x55c98d,_0x3d1b1b,_0x4ce5a1,_0x184229,_0x23cdcf,_0x214a65,_0x25e081,_0x460905){logger['info']('Creating\x20new\x20ticket...');var _0x2cc8fe=new Date();var _0x62bce0=[{'name':_0x1fd4('0xf'),'value':intUtil[_0x1fd4('0x10')](_0x184229['Subjects'],_0x23cdcf,'\x20')},{'name':_0x1fd4('0x11'),'value':_0x3d1b1b['id']},{'name':'created_by','value':_0x3d1b1b['id']},{'name':_0x1fd4('0x12'),'value':intUtil['getString'](_0x184229['Descriptions'],_0x23cdcf,'\x0a')},{'name':'date_start','value':_0x2cc8fe['toISOString']()[_0x1fd4('0x13')](0x0,0x13)[_0x1fd4('0x14')]('T','\x20')},{'name':_0x1fd4('0x15'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x1fd4('0x16'),'value':_0x4ce5a1['id']},{'name':_0x1fd4('0x17'),'value':_0x1fd4('0x18')},{'name':_0x1fd4('0x19'),'value':_0x4ce5a1[_0x1fd4('0xf')]},{'name':_0x1fd4('0x1a'),'value':_0x460905}];if(_0x214a65[_0x1fd4('0x1b')]){_['forEach'](_0x214a65,function(_0x289267){if(_0x23cdcf[_0x289267[_0x1fd4('0x1c')]]){_0x62bce0[_0x1fd4('0x1d')]({'name':_0x289267[_0x1fd4('0x1e')],'value':_0x23cdcf[_0x289267[_0x1fd4('0x1c')]]});}});}return request({'form':{'method':_0x1fd4('0x1f'),'input_type':_0x1fd4('0x20'),'response_type':_0x1fd4('0x20'),'rest_data':JSON[_0x1fd4('0x21')]({'session':_0x25e081['id'],'module_name':_0x1fd4('0x22'),'name_value_list':_0x62bce0})}});}function getAuth(_0x21a076){return util[_0x1fd4('0x23')]('Basic\x20%s',new Buffer(_0x21a076[_0x1fd4('0x24')]+':X')[_0x1fd4('0x25')]('base64'));}function getServerInfo(_0x8dcd6e){return request({'form':{'method':_0x1fd4('0x26'),'input_type':_0x1fd4('0x20'),'response_type':_0x1fd4('0x20'),'rest_data':JSON[_0x1fd4('0x21')]({'session':_0x8dcd6e['id']})}});}function getUser(_0x1df7cb,_0x42a707,_0xacf062){if(!_['isNil'](_0x42a707)){logger[_0x1fd4('0x27')](_0x1fd4('0x28'),_0x42a707);return request({'form':{'method':_0x1fd4('0x29'),'input_type':_0x1fd4('0x20'),'response_type':_0x1fd4('0x20'),'rest_data':JSON[_0x1fd4('0x21')]({'session':_0xacf062['id'],'module_name':_0x1fd4('0x2a'),'query':util['format'](_0x1fd4('0x2b'),_0x42a707),'order_by':'','offset':'0','select_fields':['id',_0x1fd4('0xf'),_0x1fd4('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x1fd4('0x2d')](function(_0x4ee97e){if(_0x4ee97e[_0x1fd4('0x2e')][_0x1fd4('0x1b')]){var _0x2251a3=_[_0x1fd4('0x2f')](_0x4ee97e[_0x1fd4('0x2e')],function(_0x3003ea){return _0x3003ea[_0x1fd4('0x30')][_0x1fd4('0x2c')][_0x1fd4('0x31')]===_0x42a707;});if(_0x2251a3){logger['info'](_0x1fd4('0x32'));return BPromise['resolve']({'id':_0x2251a3['name_value_list']['id'][_0x1fd4('0x31')],'name':_0x2251a3[_0x1fd4('0x30')][_0x1fd4('0xf')][_0x1fd4('0x31')]});}}logger[_0x1fd4('0x27')](_0x1fd4('0x33'));return BPromise[_0x1fd4('0x34')]({'id':_0xacf062[_0x1fd4('0x30')][_0x1fd4('0x35')][_0x1fd4('0x31')],'name':_0xacf062[_0x1fd4('0x30')][_0x1fd4('0x2c')][_0x1fd4('0x31')]});});}else{logger[_0x1fd4('0x27')](_0x1fd4('0x36'));return BPromise['resolve']({'id':_0xacf062[_0x1fd4('0x30')][_0x1fd4('0x35')][_0x1fd4('0x31')],'name':_0xacf062['name_value_list'][_0x1fd4('0x2c')][_0x1fd4('0x31')]});}}function getEndUser(_0x517f2a,_0x35a44a,_0x4a7147,_0x28cd6f){logger[_0x1fd4('0x27')](_0x1fd4('0x37'),_0x4a7147);return request({'form':{'method':_0x1fd4('0x29'),'input_type':_0x1fd4('0x20'),'response_type':_0x1fd4('0x20'),'rest_data':JSON[_0x1fd4('0x21')]({'session':_0x28cd6f['id'],'module_name':'Contacts','query':util[_0x1fd4('0x23')](_0x1fd4('0x38'),_0x4a7147),'order_by':'','offset':'0','select_fields':['id',_0x1fd4('0xf'),_0x1fd4('0x39')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x1fd4('0x2d')](function(_0x57d880){if(_0x57d880[_0x1fd4('0x2e')][_0x1fd4('0x1b')]){var _0x293691=_[_0x1fd4('0x2f')](_0x57d880[_0x1fd4('0x2e')],function(_0x30db4d){return _0x30db4d[_0x1fd4('0x30')][_0x1fd4('0x39')][_0x1fd4('0x31')]===_0x4a7147;});if(_0x293691){logger['info']('Enduser\x20found!');return BPromise[_0x1fd4('0x34')]({'id':_0x293691['name_value_list']['id'][_0x1fd4('0x31')],'name':_0x293691[_0x1fd4('0x30')][_0x1fd4('0xf')][_0x1fd4('0x31')],'phone':_0x293691[_0x1fd4('0x30')]['phone_home'][_0x1fd4('0x31')]});}}else{logger['info'](_0x1fd4('0x3a'));return request({'form':{'method':'set_entry','input_type':_0x1fd4('0x20'),'response_type':'JSON','rest_data':JSON[_0x1fd4('0x21')]({'session':_0x28cd6f['id'],'module_name':_0x1fd4('0x18'),'name_value_list':[{'name':_0x1fd4('0x3b'),'value':_0x35a44a!==_0x1fd4('0x3c')?_0x35a44a:util[_0x1fd4('0x23')](_0x1fd4('0x3d'),_0x4a7147)},{'name':_0x1fd4('0x39'),'value':_0x4a7147}]})}})[_0x1fd4('0x2d')](function(_0x8cd779){logger['info']('Enduser\x20created.');return BPromise[_0x1fd4('0x34')]({'id':_0x8cd779['id'],'name':_0x8cd779['entry_list'][_0x1fd4('0x3b')][_0x1fd4('0x31')],'phone':_0x8cd779[_0x1fd4('0x2e')][_0x1fd4('0x39')]['value']});});}});}function request(_0x41f542){logger[_0x1fd4('0x3e')](_0x1fd4('0x3f'),JSON[_0x1fd4('0x21')](_0x41f542));return rp(_['merge'](def,_0x41f542));}function getTags(_0x25a357,_0x5b2270){var _0x576447=[];if(_0x25a357&&_0x25a357[_0x1fd4('0x1b')]>0x0){_0x576447=_[_0x1fd4('0x40')](_0x25a357,_0x5b2270);}return _0x576447;}function getCustomFields(_0x5650f4,_0x339a35){var _0x2fc485=[];var _0x2da4ba={'custom_fields':[]};if(_0x5650f4[_0x1fd4('0x1b')]>0x0){_[_0x1fd4('0x41')](_0x5650f4,function(_0x5be5c8){if(_0x5be5c8[_0x1fd4('0x42')]==='string'&&_0x5be5c8[_0x1fd4('0x43')]&&!_0x5be5c8[_0x1fd4('0x44')]){_0x2da4ba[_0x5be5c8[_0x1fd4('0x43')]['toLowerCase']()]=_0x5be5c8[_0x1fd4('0x45')][_0x1fd4('0x25')]();}else if(_0x5be5c8[_0x1fd4('0x42')]===_0x1fd4('0x46')&&_0x5be5c8[_0x1fd4('0x1e')]&&_0x5be5c8[_0x1fd4('0x44')]){_0x2da4ba[_0x1fd4('0x47')][_0x1fd4('0x1d')]({'id':_0x5be5c8[_0x1fd4('0x1e')],'value':_0x5be5c8[_0x1fd4('0x45')][_0x1fd4('0x25')]()});}else if(_0x5be5c8[_0x1fd4('0x42')]==='variable'&&_0x5be5c8['variableName']&&_0x5be5c8[_0x1fd4('0x1e')]&&_0x5be5c8['customField']){_0x339a35[_0x5be5c8['variableName']]&&_0x2da4ba['custom_fields'][_0x1fd4('0x1d')]({'id':_0x5be5c8['idField'],'value':_0x339a35[_0x5be5c8[_0x1fd4('0x1c')]][_0x1fd4('0x25')]()});}else if(_0x5be5c8[_0x1fd4('0x42')]===_0x1fd4('0x48')&&_0x5be5c8[_0x1fd4('0x49')]&&_0x5be5c8[_0x1fd4('0x49')]['name']&&_0x5be5c8[_0x1fd4('0x1e')]&&_0x5be5c8[_0x1fd4('0x44')]){_0x339a35[_0x5be5c8['Variable'][_0x1fd4('0xf')][_0x1fd4('0x4a')]()]&&_0x2da4ba[_0x1fd4('0x47')]['push']({'id':_0x5be5c8[_0x1fd4('0x1e')],'value':_0x339a35[_0x5be5c8[_0x1fd4('0x49')]['name'][_0x1fd4('0x4a')]()]['toString']()});}});}return _0x2da4ba;}function getConnection(_0x2edeed){return request({'method':_0x1fd4('0xd'),'form':{'method':_0x1fd4('0x4b'),'input_type':_0x1fd4('0x20'),'response_type':_0x1fd4('0x20'),'rest_data':JSON[_0x1fd4('0x21')]({'user_auth':{'user_name':_0x2edeed[_0x1fd4('0x4c')],'password':_0x2edeed['password'],'encryption':_0x1fd4('0x4d')},'application':_0x1fd4('0x4e')})}})[_0x1fd4('0x2d')](function(_0x384a34){var _0x51035d=_0x384a34;if(_0x51035d['id']){def[_0x1fd4('0x4f')]=_0x51035d['id'];return BPromise[_0x1fd4('0x34')](_0x51035d);}else{throw new Error(util[_0x1fd4('0x23')](_0x1fd4('0x50'),_0x2edeed['id']));}});}function setRelationship(_0xe6639c,_0x4e9979,_0x5f1fb6,_0x154c3a){return request({'form':{'method':_0x1fd4('0x51'),'input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0xe6639c['id'],'module_name':_0x1fd4('0x22'),'module_id':_0x5f1fb6['id'],'link_field_name':_0x154c3a,'related_ids':[_0x4e9979['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x1fd4('0x52')]=function(_0x58073d,_0x1dedb0,_0x4e7232,_0x24e924,_0x328edd,_0x43d3ef){var _0x3def6f,_0x4b272d,_0x441d38,_0x17055f;_0x43d3ef['remoteUri']=intUtil[_0x1fd4('0x53')](_0x43d3ef[_0x1fd4('0x54')]);_0x43d3ef[_0x1fd4('0x55')]=intUtil[_0x1fd4('0x53')](_0x43d3ef[_0x1fd4('0x55')]);def[_0x1fd4('0x56')]=util[_0x1fd4('0x23')](_0x1fd4('0x57'),_0x43d3ef[_0x1fd4('0x54')]);if(_0x328edd&&_0x328edd['monitor_format']){logger[_0x1fd4('0x27')](_0x1fd4('0x58'),'Recording\x20is\x20enabled!');_0x1dedb0[_0x1fd4('0x59')]=util[_0x1fd4('0x23')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x43d3ef['serverUrl'],_0x1dedb0['uniqueid'],md5(_0x1dedb0['uniqueid']));}else{_0x1dedb0[_0x1fd4('0x59')]='';}return getConnection(_0x43d3ef)[_0x1fd4('0x2d')](function(_0x17df9e){_0x17055f=_0x17df9e;return getUser(_0x43d3ef,_0x24e924['name'],_0x17055f);})[_0x1fd4('0x2d')](function(_0x7936d7){_0x3def6f=_0x7936d7;logger[_0x1fd4('0x27')](_0x1fd4('0x5a'),_0x3def6f['id']);return getEndUser(_0x43d3ef,_0x1dedb0[_0x1fd4('0x5b')],_0x1dedb0[_0x1fd4('0x5c')],_0x17055f);})[_0x1fd4('0x2d')](function(_0x3b61aa){_0x4b272d=_0x3b61aa;logger['info'](_0x1fd4('0x5d'),_0x4b272d['id']);return getTicket(_0x43d3ef,_0x3def6f,_0x4b272d,_0x4e7232,_0x1dedb0,_0x4e7232[_0x1fd4('0x5e')],_0x17055f,_0x1fd4('0x5f'));})[_0x1fd4('0x2d')](function(_0x3e7edd){_0x441d38=_0x3e7edd;logger[_0x1fd4('0x27')](_0x1fd4('0x60'));logger[_0x1fd4('0x27')](_0x1fd4('0x61'),_0x441d38['id']);return setRelationship(_0x17055f,_0x3def6f,_0x441d38,_0x1fd4('0x62'));})[_0x1fd4('0x2d')](function(){return setRelationship(_0x17055f,_0x4b272d,_0x441d38,_0x1fd4('0x63'));})[_0x1fd4('0x2d')](function(){return getServerInfo(_0x17055f);})[_0x1fd4('0x2d')](function(_0x2ab2cb){var _0x362083=parseInt(_0x2ab2cb[_0x1fd4('0x64')]['charAt'](0x0));var _0x1b2855=util['format'](_0x1fd4('0x65'),_0x43d3ef['remoteUri'],_0x441d38['id']);if(_0x362083>0x6){_0x1b2855=util[_0x1fd4('0x23')](_0x1fd4('0x66'),_0x43d3ef[_0x1fd4('0x54')],_0x441d38['id']);}logger[_0x1fd4('0x27')]('[QUEUE]',_0x1fd4('0x67'));emit(util[_0x1fd4('0x23')](_0x1fd4('0x68'),_0x24e924[_0x1fd4('0xf')]),_0x1fd4('0x69'),{'uri':_0x1b2855});})[_0x1fd4('0x6a')](function(_0xf72a24){logger[_0x1fd4('0x6b')](_0x1fd4('0x58'),JSON['stringify'](_0xf72a24));});};exports['outbound']=function(_0x386148,_0x315be9,_0x1a511d,_0x10a2b5,_0x3b627d,_0x4544a6,_0x598791){var _0x3af709,_0x405d49,_0x2f4279,_0x2090bf;_0x4544a6['remoteUri']=intUtil[_0x1fd4('0x53')](_0x4544a6[_0x1fd4('0x54')]);_0x4544a6[_0x1fd4('0x55')]=intUtil['stripTrailingSlash'](_0x4544a6['serverUrl']);def[_0x1fd4('0x56')]=util[_0x1fd4('0x23')]('%s/service/v4_1/rest.php',_0x4544a6[_0x1fd4('0x54')]);if(_0x598791&&_0x598791[_0x1fd4('0x6c')]&&_0x598791[_0x1fd4('0x6c')]!==_0x1fd4('0x6d')){logger[_0x1fd4('0x27')](_0x1fd4('0x6e'),_0x1fd4('0x6f'));_0x315be9[_0x1fd4('0x59')]=util[_0x1fd4('0x23')](_0x1fd4('0x70'),_0x4544a6[_0x1fd4('0x55')],_0x315be9[_0x1fd4('0x71')],md5(_0x315be9[_0x1fd4('0x71')]));}return getConnection(_0x4544a6)[_0x1fd4('0x2d')](function(_0xcde11){_0x2090bf=_0xcde11;return getUser(_0x4544a6,_0x10a2b5[_0x1fd4('0xf')],_0x2090bf);})[_0x1fd4('0x2d')](function(_0x19453a){_0x3af709=_0x19453a;logger[_0x1fd4('0x27')](_0x1fd4('0x5a'),_0x3af709['id']);return getEndUser(_0x4544a6,_0x315be9[_0x1fd4('0x72')],_0x315be9[_0x1fd4('0x73')],_0x2090bf);})[_0x1fd4('0x2d')](function(_0x270f3c){_0x405d49=_0x270f3c;logger['info'](_0x1fd4('0x5d'),_0x405d49['id']);return getTicket(_0x4544a6,_0x3af709,_0x405d49,_0x1a511d,_0x315be9,_0x1a511d[_0x1fd4('0x5e')],_0x2090bf,'Outbound');})[_0x1fd4('0x2d')](function(_0x5a3019){_0x2f4279=_0x5a3019;logger[_0x1fd4('0x27')](_0x1fd4('0x60'));logger[_0x1fd4('0x27')](_0x1fd4('0x61'),_0x2f4279['id']);return setRelationship(_0x2090bf,_0x3af709,_0x2f4279,'users');})[_0x1fd4('0x2d')](function(){return setRelationship(_0x2090bf,_0x405d49,_0x2f4279,'contacts');})[_0x1fd4('0x2d')](function(){return getServerInfo(_0x2090bf);})[_0x1fd4('0x2d')](function(_0x49e74e){var _0x32e350=parseInt(_0x49e74e[_0x1fd4('0x64')]['charAt'](0x0));var _0x7b6db8=util[_0x1fd4('0x23')](_0x1fd4('0x65'),_0x4544a6['remoteUri'],_0x2f4279['id']);if(_0x32e350>0x6){_0x7b6db8=util[_0x1fd4('0x23')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x4544a6['remoteUri'],_0x2f4279['id']);}logger[_0x1fd4('0x27')]('[OUTBOUND]',_0x1fd4('0x67'));emit(util[_0x1fd4('0x23')]('user:%s',_0x10a2b5[_0x1fd4('0xf')]),_0x1fd4('0x69'),{'uri':_0x7b6db8});})[_0x1fd4('0x6a')](function(_0x16ca08){logger[_0x1fd4('0x6b')](_0x1fd4('0x6e'),JSON['stringify'](_0x16ca08));});};exports[_0x1fd4('0x74')]=function(_0x2d6798,_0x522a25,_0x284c1d,_0x50bfc9,_0x630204,_0xed5b3c){var _0x1db69c,_0x3e5a4a,_0x342942,_0x50d645;_0xed5b3c[_0x1fd4('0x54')]=intUtil[_0x1fd4('0x53')](_0xed5b3c['remoteUri']);_0xed5b3c[_0x1fd4('0x55')]=intUtil[_0x1fd4('0x53')](_0xed5b3c['serverUrl']);def[_0x1fd4('0x56')]=util['format'](_0x1fd4('0x57'),_0xed5b3c[_0x1fd4('0x54')]);if(_0x630204&&_0x630204[_0x1fd4('0x75')]){logger[_0x1fd4('0x27')]('['+_0x522a25[_0x1fd4('0x76')]['toUpperCase']()+']',_0x1fd4('0x6f'));_0x522a25[_0x1fd4('0x59')]=util[_0x1fd4('0x23')](_0x1fd4('0x70'),_0xed5b3c['serverUrl'],_0x522a25[_0x1fd4('0x71')],md5(_0x522a25[_0x1fd4('0x71')]));}else{_0x522a25['recordingURL']='';}return getConnection(_0xed5b3c)[_0x1fd4('0x2d')](function(_0x2d5dd2){_0x50d645=_0x2d5dd2;if(!_[_0x1fd4('0x77')](_0x50bfc9)){return getUser(_0xed5b3c,_0x50bfc9['name'],_0x50d645);}else{return getUser(_0xed5b3c,null,_0x50d645);}})[_0x1fd4('0x2d')](function(_0x5a654d){_0x1db69c=_0x5a654d;logger[_0x1fd4('0x27')](_0x1fd4('0x5a'),_0x1db69c['id']);return getEndUser(_0xed5b3c,_0x522a25[_0x1fd4('0x5b')],_0x522a25[_0x1fd4('0x5c')],_0x50d645);})['then'](function(_0x1189c6){_0x3e5a4a=_0x1189c6;logger['info']('The\x20Enduser\x20ID\x20is:',_0x3e5a4a['id']);return getTicket(_0xed5b3c,_0x1db69c,_0x3e5a4a,_0x284c1d,_0x522a25,_0x284c1d[_0x1fd4('0x5e')],_0x50d645,'Inbound');})['then'](function(_0x335381){_0x342942=_0x335381;logger['info'](_0x1fd4('0x60'));logger['info'](_0x1fd4('0x61'),_0x342942['id']);return setRelationship(_0x50d645,_0x1db69c,_0x342942,'users');})[_0x1fd4('0x2d')](function(){return setRelationship(_0x50d645,_0x3e5a4a,_0x342942,_0x1fd4('0x63'));})[_0x1fd4('0x2d')](function(){return getServerInfo(_0x50d645);})[_0x1fd4('0x6a')](function(_0xf43127){logger['error']('['+_0x522a25['lastevent'][_0x1fd4('0x78')]()+']',JSON[_0x1fd4('0x21')](_0xf43127));});}; \ 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 68ce14d..3b6728b 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 _0x12d8=['toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','format','key','keyContent','%s:\x20%s','join','stripTrailingSlash','substring','lastIndexOf','validateEmail','lodash','util','getString','length','string','push','content','type','variable','variableName'];(function(_0x3c9ba9,_0x41fca7){var _0x1d5210=function(_0x5835b5){while(--_0x5835b5){_0x3c9ba9['push'](_0x3c9ba9['shift']());}};_0x1d5210(++_0x41fca7);}(_0x12d8,0x1ca));var _0x812d=function(_0x9f3709,_0x154cb6){_0x9f3709=_0x9f3709-0x0;var _0x4a8a43=_0x12d8[_0x9f3709];return _0x4a8a43;};'use strict';var _=require(_0x812d('0x0'));var util=require(_0x812d('0x1'));exports[_0x812d('0x2')]=function(_0x40c925,_0x19442d,_0x5a8f4a){var _0x57e2a0=[];if(_0x40c925[_0x812d('0x3')]>0x0){var _0x745b1a=_['sortBy'](_0x40c925,['id']);for(var _0x2f6089=0x0;_0x2f6089<_0x745b1a['length'];_0x2f6089++){var _0x510e48=_0x745b1a[_0x2f6089];if(_0x510e48['type']===_0x812d('0x4')){_0x57e2a0[_0x812d('0x5')](_0x510e48[_0x812d('0x6')]);}else if(_0x510e48[_0x812d('0x7')]===_0x812d('0x8')&&_0x510e48[_0x812d('0x9')]){_0x19442d[_0x510e48['variableName']]&&_0x57e2a0['push'](_0x19442d[_0x510e48[_0x812d('0x9')]][_0x812d('0xa')]());}else if(_0x510e48[_0x812d('0x7')]===_0x812d('0xb')&&_0x510e48[_0x812d('0xc')]&&_0x510e48[_0x812d('0xc')][_0x812d('0xd')]){_0x19442d[_0x510e48[_0x812d('0xc')][_0x812d('0xd')][_0x812d('0xe')]()]&&_0x57e2a0[_0x812d('0x5')](_0x19442d[_0x510e48[_0x812d('0xc')][_0x812d('0xd')]['toLowerCase']()][_0x812d('0xa')]());}else if(_0x510e48[_0x812d('0x7')]===_0x812d('0xf')){if(_0x510e48[_0x812d('0x10')]===_0x812d('0x4')&&_0x510e48['key']){_0x57e2a0[_0x812d('0x5')](util[_0x812d('0x11')]('%s:\x20%s',_0x510e48[_0x812d('0x12')],_0x510e48[_0x812d('0x13')]));}else if(_0x510e48['keyType']===_0x812d('0x8')&&_0x510e48['variableName']&&_0x510e48['key']){_0x19442d[_0x510e48[_0x812d('0x9')]]&&_0x57e2a0[_0x812d('0x5')](util['format'](_0x812d('0x14'),_0x510e48[_0x812d('0x12')],_0x19442d[_0x510e48[_0x812d('0x9')]]));}else if(_0x510e48[_0x812d('0x10')]==='customVariable'&&_0x510e48[_0x812d('0xc')]&&_0x510e48[_0x812d('0xc')][_0x812d('0xd')]&&_0x510e48[_0x812d('0x12')]){_0x19442d[_0x510e48[_0x812d('0xc')][_0x812d('0xd')][_0x812d('0xe')]()]&&_0x57e2a0[_0x812d('0x5')](util[_0x812d('0x11')](_0x812d('0x14'),_0x510e48[_0x812d('0x12')],_0x19442d[_0x510e48[_0x812d('0xc')][_0x812d('0xd')][_0x812d('0xe')]()]));}}}}return _0x57e2a0[_0x812d('0x15')](_0x5a8f4a);};exports[_0x812d('0x16')]=function(_0x34ca17){var _0x6c6a91=_0x34ca17['slice'](-0x1);if(_0x6c6a91==='/'){_0x34ca17=_0x34ca17[_0x812d('0x17')](0x0,_0x34ca17[_0x812d('0x18')](_0x6c6a91));}return _0x34ca17;};exports[_0x812d('0x19')]=function(_0x1925aa){if(!_['isNil'](_0x1925aa)&&_0x1925aa!==''){var _0xc04646=/^(([^<>()\[\]\\.,;:\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 _0xc04646['test'](String(_0x1925aa)[_0x812d('0xe')]());}else{return![];}}; \ No newline at end of file +var _0xfd75=['isNil','test','lodash','util','getString','length','sortBy','type','string','content','variableName','push','toString','customVariable','Variable','name','toLowerCase','keyType','key','%s:\x20%s','variable','format','join','stripTrailingSlash','substring','lastIndexOf','validateEmail'];(function(_0x303c30,_0x16edcb){var _0x43161b=function(_0x3330ff){while(--_0x3330ff){_0x303c30['push'](_0x303c30['shift']());}};_0x43161b(++_0x16edcb);}(_0xfd75,0x17c));var _0x5fd7=function(_0x5a513c,_0x1ac679){_0x5a513c=_0x5a513c-0x0;var _0x323bc3=_0xfd75[_0x5a513c];return _0x323bc3;};'use strict';var _=require(_0x5fd7('0x0'));var util=require(_0x5fd7('0x1'));exports[_0x5fd7('0x2')]=function(_0x556363,_0xaca94c,_0x7d827){var _0x20fd87=[];if(_0x556363[_0x5fd7('0x3')]>0x0){var _0x1020ef=_[_0x5fd7('0x4')](_0x556363,['id']);for(var _0x41c30e=0x0;_0x41c30e<_0x1020ef[_0x5fd7('0x3')];_0x41c30e++){var _0x17ba6e=_0x1020ef[_0x41c30e];if(_0x17ba6e[_0x5fd7('0x5')]===_0x5fd7('0x6')){_0x20fd87['push'](_0x17ba6e[_0x5fd7('0x7')]);}else if(_0x17ba6e[_0x5fd7('0x5')]==='variable'&&_0x17ba6e[_0x5fd7('0x8')]){_0xaca94c[_0x17ba6e[_0x5fd7('0x8')]]&&_0x20fd87[_0x5fd7('0x9')](_0xaca94c[_0x17ba6e[_0x5fd7('0x8')]][_0x5fd7('0xa')]());}else if(_0x17ba6e['type']===_0x5fd7('0xb')&&_0x17ba6e[_0x5fd7('0xc')]&&_0x17ba6e[_0x5fd7('0xc')][_0x5fd7('0xd')]){_0xaca94c[_0x17ba6e[_0x5fd7('0xc')]['name'][_0x5fd7('0xe')]()]&&_0x20fd87[_0x5fd7('0x9')](_0xaca94c[_0x17ba6e[_0x5fd7('0xc')][_0x5fd7('0xd')][_0x5fd7('0xe')]()]['toString']());}else if(_0x17ba6e[_0x5fd7('0x5')]==='keyValue'){if(_0x17ba6e[_0x5fd7('0xf')]==='string'&&_0x17ba6e[_0x5fd7('0x10')]){_0x20fd87['push'](util['format'](_0x5fd7('0x11'),_0x17ba6e['key'],_0x17ba6e['keyContent']));}else if(_0x17ba6e[_0x5fd7('0xf')]===_0x5fd7('0x12')&&_0x17ba6e[_0x5fd7('0x8')]&&_0x17ba6e[_0x5fd7('0x10')]){_0xaca94c[_0x17ba6e[_0x5fd7('0x8')]]&&_0x20fd87[_0x5fd7('0x9')](util[_0x5fd7('0x13')]('%s:\x20%s',_0x17ba6e[_0x5fd7('0x10')],_0xaca94c[_0x17ba6e['variableName']]));}else if(_0x17ba6e[_0x5fd7('0xf')]==='customVariable'&&_0x17ba6e[_0x5fd7('0xc')]&&_0x17ba6e['Variable'][_0x5fd7('0xd')]&&_0x17ba6e[_0x5fd7('0x10')]){_0xaca94c[_0x17ba6e[_0x5fd7('0xc')]['name']['toLowerCase']()]&&_0x20fd87[_0x5fd7('0x9')](util[_0x5fd7('0x13')](_0x5fd7('0x11'),_0x17ba6e[_0x5fd7('0x10')],_0xaca94c[_0x17ba6e[_0x5fd7('0xc')][_0x5fd7('0xd')]['toLowerCase']()]));}}}}return _0x20fd87[_0x5fd7('0x14')](_0x7d827);};exports[_0x5fd7('0x15')]=function(_0x12872b){var _0x5a1166=_0x12872b['slice'](-0x1);if(_0x5a1166==='/'){_0x12872b=_0x12872b[_0x5fd7('0x16')](0x0,_0x12872b[_0x5fd7('0x17')](_0x5a1166));}return _0x12872b;};exports[_0x5fd7('0x18')]=function(_0x1f1c1d){if(!_[_0x5fd7('0x19')](_0x1f1c1d)&&_0x1f1c1d!==''){var _0x23aa7b=/^(([^<>()\[\]\\.,;:\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 _0x23aa7b[_0x5fd7('0x1a')](String(_0x1f1c1d)[_0x5fd7('0xe')]());}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 e271fb5..f3c4784 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 _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x137629,_0x5d475c){var _0x433b41=function(_0x2d693a){while(--_0x2d693a){_0x137629['push'](_0x137629['shift']());}};_0x433b41(++_0x5d475c);}(_0xe706,0xa3));var _0x6e70=function(_0x197d5c,_0x1936b0){_0x197d5c=_0x197d5c-0x0;var _0x13dc71=_0xe706[_0x197d5c];return _0x13dc71;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file +var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x46b579,_0x566d72){var _0x373a12=function(_0xe47070){while(--_0xe47070){_0x46b579['push'](_0x46b579['shift']());}};_0x373a12(++_0x566d72);}(_0xe706,0xa3));var _0x6e70=function(_0x3ba748,_0x4b8fb9){_0x3ba748=_0x3ba748-0x0;var _0x5b04e2=_0xe706[_0x3ba748];return _0x5b04e2;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 796e97c..1ce9422 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 _0x4c5d=['replace','error','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','calleridnum','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','request-promise','util','ioredis','./util','../../../../config/environment','redis','defaults','localhost','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','Subjects','getString','Descriptions','Fields','then','Ticket\x20created!','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','type:user\x20role:end-user\x20phone:%s','length','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','end-user','Caller\x20-\x20%s','%s:%s','username','authType','%s/token:%s','token','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','map','forEach','includes','string','picklist','type','customField','nameField','content','custom_fields','push','variableName','idField','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','inspect','outbound','recordingFormat','none','[OUTBOUND]','Authorization','email','destcalleridname','destcalleridnum','newTab'];(function(_0x43d79c,_0x3da79f){var _0x522a04=function(_0xbf362b){while(--_0xbf362b){_0x43d79c['push'](_0x43d79c['shift']());}};_0x522a04(++_0x3da79f);}(_0x4c5d,0x1ba));var _0xd4c5=function(_0x5a769e,_0x51afe3){_0x5a769e=_0x5a769e-0x0;var _0xbe7d5=_0x4c5d[_0x5a769e];return _0xbe7d5;};'use strict';var _=require('lodash');var rp=require(_0xd4c5('0x0'));var md5=require('md5');var util=require(_0xd4c5('0x1'));var Redis=require(_0xd4c5('0x2'));var intUtil=require(_0xd4c5('0x3'));var config=require(_0xd4c5('0x4'));var logger=require('../../../../config/logger')('zendesk');config[_0xd4c5('0x5')]=_[_0xd4c5('0x6')](config['redis'],{'host':_0xd4c5('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd4c5('0x5')]));function emit(_0xa51923,_0xbe38da,_0x513bad){io['to'](_0xa51923)['emit'](_0xbe38da,_0x513bad);}var headers={'Content-Type':_0xd4c5('0x8'),'Accept':_0xd4c5('0x8')};function getTicket(_0x1bbe3a,_0xaf69cf,_0x4c2ef6,_0x3e9a20,_0x2580dc){logger[_0xd4c5('0x9')](_0xd4c5('0xa'));return request({'uri':util[_0xd4c5('0xb')](_0xd4c5('0xc'),_0x1bbe3a[_0xd4c5('0xd')]),'method':_0xd4c5('0xe'),'body':{'ticket':_[_0xd4c5('0xf')]({'requester_id':_0x4c2ef6['id'],'submitter_id':_0xaf69cf?_0xaf69cf['id']:undefined,'assignee_id':_0xaf69cf?_0xaf69cf['id']:undefined,'tags':getTags(_0x3e9a20[_0xd4c5('0x10')],_0xd4c5('0x11')),'subject':intUtil['getString'](_0x3e9a20[_0xd4c5('0x12')],_0x2580dc,'\x20'),'description':intUtil['getString'](_0x3e9a20['Descriptions'],_0x2580dc,'\x0a'),'comment':{'public':![],'body':intUtil[_0xd4c5('0x13')](_0x3e9a20[_0xd4c5('0x14')],_0x2580dc,'\x0a')}},getCustomFields(_0x3e9a20[_0xd4c5('0x15')],_0x2580dc))}})[_0xd4c5('0x16')](function(_0x232546){logger['info'](_0xd4c5('0x17'));return _0x232546['ticket'];});}function getUser(_0x245973,_0x7cf663){if(intUtil[_0xd4c5('0x18')](_0x7cf663)){logger['info'](_0xd4c5('0x19'),_0x7cf663);return request({'uri':util[_0xd4c5('0xb')](_0xd4c5('0x1a'),_0x245973[_0xd4c5('0xd')]),'qs':{'query':util[_0xd4c5('0xb')](_0xd4c5('0x1b'),_0x7cf663)}})[_0xd4c5('0x16')](function(_0x5145d7){if(_0x5145d7[_0xd4c5('0x1c')]){logger['info']('Agent\x20found!');return _['find'](_0x5145d7[_0xd4c5('0x1d')],{'email':_0x7cf663,'role':_0xd4c5('0x1e')});}else{logger['info'](_0xd4c5('0x1f'));return request({'uri':util[_0xd4c5('0xb')](_0xd4c5('0x20'),_0x245973[_0xd4c5('0xd')])})[_0xd4c5('0x16')](function(_0x1aa52c){logger[_0xd4c5('0x9')](_0xd4c5('0x21'));return _0x1aa52c[_0xd4c5('0x22')];});}});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0xd4c5('0x20'),_0x245973[_0xd4c5('0xd')])})[_0xd4c5('0x16')](function(_0x186b33){logger['info'](_0xd4c5('0x21'));return _0x186b33[_0xd4c5('0x22')];});}}function getEndUser(_0x348cbd,_0x467d37,_0x44d098){logger[_0xd4c5('0x9')]('Searching\x20enduser\x20with\x20phone',_0x44d098);return request({'uri':util['format']('%s/search.json',_0x348cbd['remoteUri']),'qs':{'query':util[_0xd4c5('0xb')](_0xd4c5('0x23'),_0x44d098)}})[_0xd4c5('0x16')](function(_0x167cbf){var _0x5330d9;if(_0x167cbf['results'][_0xd4c5('0x24')]){_0x167cbf['results']=_['filter'](_0x167cbf[_0xd4c5('0x1d')],{'suspended':![],'role':'end-user'});if(_0x167cbf[_0xd4c5('0x1d')][_0xd4c5('0x24')]){_0x5330d9=_['first'](_0x167cbf[_0xd4c5('0x1d')]);}}if(_0x5330d9){logger[_0xd4c5('0x9')]('Enduser\x20found!');return _0x5330d9;}else{logger['info'](_0xd4c5('0x25'));return request({'uri':util['format'](_0xd4c5('0x26'),_0x348cbd[_0xd4c5('0xd')]),'method':_0xd4c5('0xe'),'body':{'user':{'role':_0xd4c5('0x27'),'name':util[_0xd4c5('0xb')](_0xd4c5('0x28'),_0x467d37||_0x44d098),'phone':_0x44d098}}})[_0xd4c5('0x16')](function(_0xbdd3f3){logger[_0xd4c5('0x9')]('Enduser\x20created.');return _0xbdd3f3[_0xd4c5('0x22')];});}});}function getAuth(_0x3a61bb){var _0x42be7b;if(_0x3a61bb['authType']==='password'){_0x42be7b=util[_0xd4c5('0xb')](_0xd4c5('0x29'),_0x3a61bb[_0xd4c5('0x2a')],_0x3a61bb['password']);}else if(_0x3a61bb[_0xd4c5('0x2b')]==='token'){_0x42be7b=util[_0xd4c5('0xb')](_0xd4c5('0x2c'),_0x3a61bb[_0xd4c5('0x2a')],_0x3a61bb[_0xd4c5('0x2d')]);}return util[_0xd4c5('0xb')](_0xd4c5('0x2e'),new Buffer(_0x42be7b)[_0xd4c5('0x2f')](_0xd4c5('0x30')));}function request(_0x5edcca){logger[_0xd4c5('0x31')](_0xd4c5('0x32'),JSON[_0xd4c5('0x33')](_0x5edcca));return rp(_[_0xd4c5('0x6')](_0x5edcca,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x20ea80,_0x4e17d5){var _0x16f838=[];if(_0x20ea80&&_0x20ea80[_0xd4c5('0x24')]>0x0){_0x16f838=_[_0xd4c5('0x34')](_0x20ea80,_0x4e17d5);}return _0x16f838;}function getCustomFields(_0x205e2a,_0x1a6339){var _0x20347d=[];var _0x47bf74={'custom_fields':[]};if(_0x205e2a['length']>0x0){_[_0xd4c5('0x35')](_0x205e2a,function(_0x3787d6){if(_[_0xd4c5('0x36')]([_0xd4c5('0x37'),_0xd4c5('0x38')],_0x3787d6[_0xd4c5('0x39')])&&_0x3787d6['nameField']&&!_0x3787d6[_0xd4c5('0x3a')]){_0x47bf74[_0x3787d6[_0xd4c5('0x3b')]['toLowerCase']()]=_0x3787d6[_0xd4c5('0x3c')]['toString']();}else if(_[_0xd4c5('0x36')]([_0xd4c5('0x37'),'picklist'],_0x3787d6[_0xd4c5('0x39')])&&_0x3787d6['idField']&&_0x3787d6[_0xd4c5('0x3a')]){_0x47bf74[_0xd4c5('0x3d')][_0xd4c5('0x3e')]({'id':_0x3787d6['idField'],'value':_0x3787d6['content'][_0xd4c5('0x2f')]()});}else if(_0x3787d6[_0xd4c5('0x39')]==='variable'&&_0x3787d6[_0xd4c5('0x3f')]&&_0x3787d6[_0xd4c5('0x40')]&&_0x3787d6['customField']){_0x1a6339[_0x3787d6[_0xd4c5('0x3f')]]&&_0x47bf74[_0xd4c5('0x3d')][_0xd4c5('0x3e')]({'id':_0x3787d6['idField'],'value':_0x1a6339[_0x3787d6[_0xd4c5('0x3f')]][_0xd4c5('0x2f')]()});}else if(_0x3787d6[_0xd4c5('0x39')]==='customVariable'&&_0x3787d6[_0xd4c5('0x41')]&&_0x3787d6[_0xd4c5('0x41')][_0xd4c5('0x11')]&&_0x3787d6['idField']&&_0x3787d6['customField']){_0x1a6339[_0x3787d6[_0xd4c5('0x41')][_0xd4c5('0x11')][_0xd4c5('0x42')]()]&&_0x47bf74['custom_fields'][_0xd4c5('0x3e')]({'id':_0x3787d6[_0xd4c5('0x40')],'value':_0x1a6339[_0x3787d6[_0xd4c5('0x41')][_0xd4c5('0x11')]['toLowerCase']()][_0xd4c5('0x2f')]()});}});}return _0x47bf74;}exports[_0xd4c5('0x43')]=function(_0x544d49,_0x59937c,_0x53a3d2,_0xb73ed8,_0x34e1db,_0x558751){var _0xb160bd,_0x3bc407;_0x558751['remoteUri']=intUtil[_0xd4c5('0x44')](_0x558751['remoteUri']);_0x558751[_0xd4c5('0x45')]=intUtil[_0xd4c5('0x44')](_0x558751[_0xd4c5('0x45')]);if(_0x34e1db&&_0x34e1db[_0xd4c5('0x46')]){logger[_0xd4c5('0x9')](_0xd4c5('0x47'),'Recording\x20is\x20enabled!');_0x59937c[_0xd4c5('0x48')]=util[_0xd4c5('0xb')](_0xd4c5('0x49'),_0x558751[_0xd4c5('0x45')],_0x59937c[_0xd4c5('0x4a')],md5(_0x59937c[_0xd4c5('0x4a')]));}else{_0x59937c['recordingURL']='';}headers['Authorization']=getAuth(_0x558751);return getUser(_0x558751,_0xb73ed8['email'])[_0xd4c5('0x16')](function(_0xd2bb52){_0xb160bd=_0xd2bb52;logger[_0xd4c5('0x9')]('The\x20User\x20ID\x20is:',_0xb160bd['id']);return getEndUser(_0x558751,_0x59937c[_0xd4c5('0x4b')],_0x59937c['calleridnum']);})['then'](function(_0x249b50){_0x3bc407=_0x249b50;logger[_0xd4c5('0x9')](_0xd4c5('0x4c'),_0x3bc407['id']);return getTicket(_0x558751,_0xb160bd,_0x3bc407,_0x53a3d2,_0x59937c);})[_0xd4c5('0x16')](function(_0x2ad705){if(_0x2ad705){logger[_0xd4c5('0x9')](_0xd4c5('0x4d'),_0x2ad705['id']);switch(_0x558751[_0xd4c5('0x39')]){case _0xd4c5('0x4e'):logger[_0xd4c5('0x9')](_0xd4c5('0x47'),_0xd4c5('0x4f'));return request({'uri':util[_0xd4c5('0xb')](_0xd4c5('0x50'),_0x558751[_0xd4c5('0xd')],_0xb160bd['id'],_0x2ad705['id']),'method':_0xd4c5('0xe')});case'newTab':logger[_0xd4c5('0x9')]('[QUEUE]',_0xd4c5('0x51'));emit(util[_0xd4c5('0xb')](_0xd4c5('0x52'),_0xb73ed8[_0xd4c5('0x11')]),_0xd4c5('0x53'),{'uri':util[_0xd4c5('0xb')](_0xd4c5('0x54'),_0x558751['remoteUri']['replace'](_0xd4c5('0x55'),''),_0x2ad705['id'])});break;default:logger['error'](_0xd4c5('0x47'),_0xd4c5('0x56'));}}})[_0xd4c5('0x57')](function(_0x6efd0e){logger['error']('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0xd4c5('0x58')](_0x6efd0e,{'showHidden':!![],'depth':null}));});};exports[_0xd4c5('0x59')]=function(_0x3a3cee,_0x4c126e,_0x302f7e,_0x4cfd6f,_0xc92c48,_0x1e5375,_0xabe9b0){var _0x12fbd1,_0x26075e;_0x1e5375['remoteUri']=intUtil[_0xd4c5('0x44')](_0x1e5375['remoteUri']);_0x1e5375[_0xd4c5('0x45')]=intUtil[_0xd4c5('0x44')](_0x1e5375[_0xd4c5('0x45')]);if(_0xabe9b0&&_0xabe9b0[_0xd4c5('0x5a')]&&_0xabe9b0[_0xd4c5('0x5a')]!==_0xd4c5('0x5b')){logger[_0xd4c5('0x9')](_0xd4c5('0x5c'),'Recording\x20is\x20enabled!');_0x4c126e[_0xd4c5('0x48')]=util['format'](_0xd4c5('0x49'),_0x1e5375[_0xd4c5('0x45')],_0x4c126e[_0xd4c5('0x4a')],md5(_0x4c126e[_0xd4c5('0x4a')]));}headers[_0xd4c5('0x5d')]=getAuth(_0x1e5375);return getUser(_0x1e5375,_0x4cfd6f[_0xd4c5('0x5e')])[_0xd4c5('0x16')](function(_0xe56ec9){_0x12fbd1=_0xe56ec9;logger[_0xd4c5('0x9')]('The\x20User\x20ID\x20is:',_0x12fbd1['id']);return getEndUser(_0x1e5375,_0x4c126e[_0xd4c5('0x5f')],_0x4c126e[_0xd4c5('0x60')]);})[_0xd4c5('0x16')](function(_0x5bd082){_0x26075e=_0x5bd082;logger[_0xd4c5('0x9')](_0xd4c5('0x4c'),_0x26075e['id']);return getTicket(_0x1e5375,_0x12fbd1,_0x26075e,_0x302f7e,_0x4c126e);})[_0xd4c5('0x16')](function(_0x376be7){if(_0x376be7){logger[_0xd4c5('0x9')]('The\x20Ticket\x20ID\x20is:',_0x376be7['id']);switch(_0x1e5375[_0xd4c5('0x39')]){case _0xd4c5('0x4e'):logger[_0xd4c5('0x9')](_0xd4c5('0x5c'),_0xd4c5('0x4f'));return request({'uri':util[_0xd4c5('0xb')](_0xd4c5('0x50'),_0x1e5375[_0xd4c5('0xd')],_0x12fbd1['id'],_0x376be7['id']),'method':'POST'});case _0xd4c5('0x61'):logger['info']('[OUTBOUND]',_0xd4c5('0x51'));emit(util['format'](_0xd4c5('0x52'),_0x4cfd6f[_0xd4c5('0x11')]),'trigger:browser:url',{'uri':util[_0xd4c5('0xb')](_0xd4c5('0x54'),_0x1e5375[_0xd4c5('0xd')][_0xd4c5('0x62')](_0xd4c5('0x55'),''),_0x376be7['id'])});break;default:logger[_0xd4c5('0x63')](_0xd4c5('0x5c'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x269a08){logger['error'](_0xd4c5('0x64'),util[_0xd4c5('0x58')](_0x269a08,{'showHidden':!![],'depth':null}));});};exports[_0xd4c5('0x65')]=function(_0x482f64,_0x51b1e4,_0x349eea,_0x106700,_0x49a0aa,_0x2a36af){var _0x4e12a6,_0x4c4617;_0x2a36af[_0xd4c5('0xd')]=intUtil['stripTrailingSlash'](_0x2a36af[_0xd4c5('0xd')]);_0x2a36af[_0xd4c5('0x45')]=intUtil[_0xd4c5('0x44')](_0x2a36af[_0xd4c5('0x45')]);if(_0x49a0aa&&_0x49a0aa[_0xd4c5('0x46')]){logger[_0xd4c5('0x9')]('['+_0x51b1e4[_0xd4c5('0x66')]['toUpperCase']()+']',_0xd4c5('0x67'));_0x51b1e4[_0xd4c5('0x48')]=util['format'](_0xd4c5('0x49'),_0x2a36af[_0xd4c5('0x45')],_0x51b1e4['uniqueid'],md5(_0x51b1e4['uniqueid']));}else{_0x51b1e4[_0xd4c5('0x48')]='';}headers[_0xd4c5('0x5d')]=getAuth(_0x2a36af);return getUser(_0x2a36af)['then'](function(_0x9788e2){_0x4e12a6=_0x9788e2;logger['info'](_0xd4c5('0x68'),_0x4e12a6['id']);return getEndUser(_0x2a36af,_0x51b1e4[_0xd4c5('0x4b')],_0x51b1e4[_0xd4c5('0x69')]);})[_0xd4c5('0x16')](function(_0x7f8390){_0x4c4617=_0x7f8390;logger['info'](_0xd4c5('0x4c'),_0x4c4617['id']);return getTicket(_0x2a36af,_0x4e12a6,_0x4c4617,_0x349eea,_0x51b1e4);})[_0xd4c5('0x16')](function(_0x2ebcf5){if(_0x2ebcf5){logger[_0xd4c5('0x9')]('The\x20Ticket\x20ID\x20is:',_0x2ebcf5['id']);}})[_0xd4c5('0x57')](function(_0x77bfe0){logger[_0xd4c5('0x63')]('['+_0x51b1e4[_0xd4c5('0x66')][_0xd4c5('0x6a')]()+']'+_0xd4c5('0x6b'),util['inspect'](_0x77bfe0,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x5b40=['%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','username','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','nameField','toLowerCase','content','idField','customField','custom_fields','variable','variableName','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/agent/tickets/%s','replace','/api/v2','error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','%s/channels/voice/agents/%d/tickets/%d/display.json','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','then','Ticket\x20created!','ticket','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/search.json','type:user\x20role:end-user\x20phone:%s','length','filter','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x5b40,0x1a5));var _0x05b4=function(_0x3b353a,_0x444b43){_0x3b353a=_0x3b353a-0x0;var _0x2ba8bf=_0x5b40[_0x3b353a];return _0x2ba8bf;};'use strict';var _=require(_0x05b4('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x05b4('0x1'));var Redis=require(_0x05b4('0x2'));var intUtil=require(_0x05b4('0x3'));var config=require(_0x05b4('0x4'));var logger=require(_0x05b4('0x5'))('zendesk');config[_0x05b4('0x6')]=_[_0x05b4('0x7')](config[_0x05b4('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x05b4('0x8'))(new Redis(config[_0x05b4('0x6')]));function emit(_0x4cb604,_0x1a3fa1,_0x57e82e){io['to'](_0x4cb604)[_0x05b4('0x9')](_0x1a3fa1,_0x57e82e);}var headers={'Content-Type':_0x05b4('0xa'),'Accept':_0x05b4('0xa')};function getTicket(_0x44d283,_0x26310a,_0x557402,_0x5071da,_0xe4c4cd){logger[_0x05b4('0xb')](_0x05b4('0xc'));return request({'uri':util[_0x05b4('0xd')](_0x05b4('0xe'),_0x44d283[_0x05b4('0xf')]),'method':_0x05b4('0x10'),'body':{'ticket':_[_0x05b4('0x11')]({'requester_id':_0x557402['id'],'submitter_id':_0x26310a?_0x26310a['id']:undefined,'assignee_id':_0x26310a?_0x26310a['id']:undefined,'tags':getTags(_0x5071da[_0x05b4('0x12')],_0x05b4('0x13')),'subject':intUtil[_0x05b4('0x14')](_0x5071da[_0x05b4('0x15')],_0xe4c4cd,'\x20'),'description':intUtil[_0x05b4('0x14')](_0x5071da[_0x05b4('0x16')],_0xe4c4cd,'\x0a'),'comment':{'public':![],'body':intUtil[_0x05b4('0x14')](_0x5071da[_0x05b4('0x16')],_0xe4c4cd,'\x0a')}},getCustomFields(_0x5071da['Fields'],_0xe4c4cd))}})[_0x05b4('0x17')](function(_0x2bfa9c){logger[_0x05b4('0xb')](_0x05b4('0x18'));return _0x2bfa9c[_0x05b4('0x19')];});}function getUser(_0x295c66,_0x32e52c){if(intUtil['validateEmail'](_0x32e52c)){logger[_0x05b4('0xb')]('Getting\x20agent\x20with\x20email',_0x32e52c);return request({'uri':util[_0x05b4('0xd')]('%s/search.json',_0x295c66[_0x05b4('0xf')]),'qs':{'query':util[_0x05b4('0xd')]('type:user\x20role:agent\x20email:%s',_0x32e52c)}})['then'](function(_0x2a60d1){if(_0x2a60d1[_0x05b4('0x1a')]){logger[_0x05b4('0xb')](_0x05b4('0x1b'));return _[_0x05b4('0x1c')](_0x2a60d1[_0x05b4('0x1d')],{'email':_0x32e52c,'role':_0x05b4('0x1e')});}else{logger[_0x05b4('0xb')](_0x05b4('0x1f'));return request({'uri':util['format'](_0x05b4('0x20'),_0x295c66['remoteUri'])})[_0x05b4('0x17')](function(_0x31f7cb){logger[_0x05b4('0xb')]('Admin\x20account\x20selected.');return _0x31f7cb[_0x05b4('0x21')];});}});}else{logger[_0x05b4('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x05b4('0xd')](_0x05b4('0x20'),_0x295c66[_0x05b4('0xf')])})[_0x05b4('0x17')](function(_0x5a1fe7){logger[_0x05b4('0xb')](_0x05b4('0x22'));return _0x5a1fe7[_0x05b4('0x21')];});}}function getEndUser(_0x8ddf32,_0x23f6c6,_0x4717f5){logger['info'](_0x05b4('0x23'),_0x4717f5);return request({'uri':util[_0x05b4('0xd')](_0x05b4('0x24'),_0x8ddf32[_0x05b4('0xf')]),'qs':{'query':util[_0x05b4('0xd')](_0x05b4('0x25'),_0x4717f5)}})[_0x05b4('0x17')](function(_0x5b976e){var _0x4201a3;if(_0x5b976e[_0x05b4('0x1d')][_0x05b4('0x26')]){_0x5b976e[_0x05b4('0x1d')]=_[_0x05b4('0x27')](_0x5b976e[_0x05b4('0x1d')],{'suspended':![],'role':'end-user'});if(_0x5b976e[_0x05b4('0x1d')][_0x05b4('0x26')]){_0x4201a3=_[_0x05b4('0x28')](_0x5b976e[_0x05b4('0x1d')]);}}if(_0x4201a3){logger[_0x05b4('0xb')](_0x05b4('0x29'));return _0x4201a3;}else{logger[_0x05b4('0xb')](_0x05b4('0x2a'));return request({'uri':util[_0x05b4('0xd')](_0x05b4('0x2b'),_0x8ddf32[_0x05b4('0xf')]),'method':_0x05b4('0x10'),'body':{'user':{'role':'end-user','name':util['format'](_0x05b4('0x2c'),_0x23f6c6||_0x4717f5),'phone':_0x4717f5}}})['then'](function(_0x2c4f8a){logger['info'](_0x05b4('0x2d'));return _0x2c4f8a[_0x05b4('0x21')];});}});}function getAuth(_0x4a0661){var _0x52272a;if(_0x4a0661[_0x05b4('0x2e')]===_0x05b4('0x2f')){_0x52272a=util[_0x05b4('0xd')]('%s:%s',_0x4a0661[_0x05b4('0x30')],_0x4a0661[_0x05b4('0x2f')]);}else if(_0x4a0661[_0x05b4('0x2e')]===_0x05b4('0x31')){_0x52272a=util[_0x05b4('0xd')](_0x05b4('0x32'),_0x4a0661['username'],_0x4a0661['token']);}return util[_0x05b4('0xd')](_0x05b4('0x33'),new Buffer(_0x52272a)[_0x05b4('0x34')](_0x05b4('0x35')));}function request(_0x384212){logger[_0x05b4('0x36')](_0x05b4('0x37'),JSON[_0x05b4('0x38')](_0x384212));return rp(_[_0x05b4('0x7')](_0x384212,{'method':_0x05b4('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x1ca50e,_0x50da9f){var _0x2bf397=[];if(_0x1ca50e&&_0x1ca50e['length']>0x0){_0x2bf397=_[_0x05b4('0x3a')](_0x1ca50e,_0x50da9f);}return _0x2bf397;}function getCustomFields(_0x231899,_0x5a435b){var _0x4487d7=[];var _0x183d3b={'custom_fields':[]};if(_0x231899['length']>0x0){_[_0x05b4('0x3b')](_0x231899,function(_0xd4baa0){if(_[_0x05b4('0x3c')]([_0x05b4('0x3d'),_0x05b4('0x3e')],_0xd4baa0[_0x05b4('0x3f')])&&_0xd4baa0['nameField']&&!_0xd4baa0['customField']){_0x183d3b[_0xd4baa0[_0x05b4('0x40')][_0x05b4('0x41')]()]=_0xd4baa0[_0x05b4('0x42')][_0x05b4('0x34')]();}else if(_[_0x05b4('0x3c')]([_0x05b4('0x3d'),'picklist'],_0xd4baa0[_0x05b4('0x3f')])&&_0xd4baa0[_0x05b4('0x43')]&&_0xd4baa0[_0x05b4('0x44')]){_0x183d3b[_0x05b4('0x45')]['push']({'id':_0xd4baa0[_0x05b4('0x43')],'value':_0xd4baa0[_0x05b4('0x42')][_0x05b4('0x34')]()});}else if(_0xd4baa0[_0x05b4('0x3f')]===_0x05b4('0x46')&&_0xd4baa0[_0x05b4('0x47')]&&_0xd4baa0['idField']&&_0xd4baa0['customField']){_0x5a435b[_0xd4baa0['variableName']]&&_0x183d3b[_0x05b4('0x45')][_0x05b4('0x48')]({'id':_0xd4baa0['idField'],'value':_0x5a435b[_0xd4baa0[_0x05b4('0x47')]]['toString']()});}else if(_0xd4baa0[_0x05b4('0x3f')]===_0x05b4('0x49')&&_0xd4baa0[_0x05b4('0x4a')]&&_0xd4baa0[_0x05b4('0x4a')]['name']&&_0xd4baa0['idField']&&_0xd4baa0[_0x05b4('0x44')]){_0x5a435b[_0xd4baa0['Variable'][_0x05b4('0x13')][_0x05b4('0x41')]()]&&_0x183d3b[_0x05b4('0x45')][_0x05b4('0x48')]({'id':_0xd4baa0[_0x05b4('0x43')],'value':_0x5a435b[_0xd4baa0[_0x05b4('0x4a')][_0x05b4('0x13')][_0x05b4('0x41')]()][_0x05b4('0x34')]()});}});}return _0x183d3b;}exports[_0x05b4('0x4b')]=function(_0x5110eb,_0x2b0126,_0x2282f5,_0x40cf0b,_0x5b5482,_0x52c0ab){var _0x3da764,_0x33000f;_0x52c0ab[_0x05b4('0xf')]=intUtil[_0x05b4('0x4c')](_0x52c0ab['remoteUri']);_0x52c0ab[_0x05b4('0x4d')]=intUtil[_0x05b4('0x4c')](_0x52c0ab[_0x05b4('0x4d')]);if(_0x5b5482&&_0x5b5482[_0x05b4('0x4e')]){logger[_0x05b4('0xb')](_0x05b4('0x4f'),_0x05b4('0x50'));_0x2b0126['recordingURL']=util[_0x05b4('0xd')](_0x05b4('0x51'),_0x52c0ab[_0x05b4('0x4d')],_0x2b0126[_0x05b4('0x52')],md5(_0x2b0126[_0x05b4('0x52')]));}else{_0x2b0126[_0x05b4('0x53')]='';}headers[_0x05b4('0x54')]=getAuth(_0x52c0ab);return getUser(_0x52c0ab,_0x40cf0b[_0x05b4('0x55')])[_0x05b4('0x17')](function(_0x400253){_0x3da764=_0x400253;logger[_0x05b4('0xb')](_0x05b4('0x56'),_0x3da764['id']);return getEndUser(_0x52c0ab,_0x2b0126[_0x05b4('0x57')],_0x2b0126[_0x05b4('0x58')]);})[_0x05b4('0x17')](function(_0x678481){_0x33000f=_0x678481;logger['info'](_0x05b4('0x59'),_0x33000f['id']);return getTicket(_0x52c0ab,_0x3da764,_0x33000f,_0x2282f5,_0x2b0126);})[_0x05b4('0x17')](function(_0x275c10){if(_0x275c10){logger[_0x05b4('0xb')](_0x05b4('0x5a'),_0x275c10['id']);switch(_0x52c0ab[_0x05b4('0x3f')]){case _0x05b4('0x5b'):logger[_0x05b4('0xb')]('[QUEUE]',_0x05b4('0x5c'));return request({'uri':util[_0x05b4('0xd')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x52c0ab[_0x05b4('0xf')],_0x3da764['id'],_0x275c10['id']),'method':'POST'});case _0x05b4('0x5d'):logger[_0x05b4('0xb')]('[QUEUE]',_0x05b4('0x5e'));emit(util[_0x05b4('0xd')](_0x05b4('0x5f'),_0x40cf0b[_0x05b4('0x13')]),'trigger:browser:url',{'uri':util['format'](_0x05b4('0x60'),_0x52c0ab[_0x05b4('0xf')][_0x05b4('0x61')](_0x05b4('0x62'),''),_0x275c10['id'])});break;default:logger[_0x05b4('0x63')](_0x05b4('0x4f'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x05b4('0x64')](function(_0x1b256e){logger[_0x05b4('0x63')](_0x05b4('0x65'),util[_0x05b4('0x66')](_0x1b256e,{'showHidden':!![],'depth':null}));});};exports[_0x05b4('0x67')]=function(_0x3e5eba,_0x542654,_0x58cc17,_0x3aca1f,_0x47a1de,_0xd9048f,_0x1f5858){var _0x275fbd,_0xe4b04b;_0xd9048f[_0x05b4('0xf')]=intUtil[_0x05b4('0x4c')](_0xd9048f['remoteUri']);_0xd9048f[_0x05b4('0x4d')]=intUtil['stripTrailingSlash'](_0xd9048f[_0x05b4('0x4d')]);if(_0x1f5858&&_0x1f5858[_0x05b4('0x68')]&&_0x1f5858[_0x05b4('0x68')]!==_0x05b4('0x69')){logger[_0x05b4('0xb')](_0x05b4('0x6a'),'Recording\x20is\x20enabled!');_0x542654[_0x05b4('0x53')]=util[_0x05b4('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xd9048f[_0x05b4('0x4d')],_0x542654['uniqueid'],md5(_0x542654[_0x05b4('0x52')]));}headers[_0x05b4('0x54')]=getAuth(_0xd9048f);return getUser(_0xd9048f,_0x3aca1f[_0x05b4('0x55')])[_0x05b4('0x17')](function(_0x4a02f1){_0x275fbd=_0x4a02f1;logger[_0x05b4('0xb')](_0x05b4('0x56'),_0x275fbd['id']);return getEndUser(_0xd9048f,_0x542654[_0x05b4('0x6b')],_0x542654[_0x05b4('0x6c')]);})['then'](function(_0x2efa95){_0xe4b04b=_0x2efa95;logger[_0x05b4('0xb')]('The\x20Enduser\x20ID\x20is:',_0xe4b04b['id']);return getTicket(_0xd9048f,_0x275fbd,_0xe4b04b,_0x58cc17,_0x542654);})[_0x05b4('0x17')](function(_0x207abf){if(_0x207abf){logger[_0x05b4('0xb')](_0x05b4('0x5a'),_0x207abf['id']);switch(_0xd9048f[_0x05b4('0x3f')]){case _0x05b4('0x5b'):logger[_0x05b4('0xb')]('[OUTBOUND]',_0x05b4('0x5c'));return request({'uri':util[_0x05b4('0xd')](_0x05b4('0x6d'),_0xd9048f[_0x05b4('0xf')],_0x275fbd['id'],_0x207abf['id']),'method':_0x05b4('0x10')});case'newTab':logger[_0x05b4('0xb')](_0x05b4('0x6a'),_0x05b4('0x5e'));emit(util[_0x05b4('0xd')](_0x05b4('0x5f'),_0x3aca1f['name']),'trigger:browser:url',{'uri':util[_0x05b4('0xd')](_0x05b4('0x60'),_0xd9048f['remoteUri'][_0x05b4('0x61')](_0x05b4('0x62'),''),_0x207abf['id'])});break;default:logger['error'](_0x05b4('0x6a'),_0x05b4('0x6e'));}}})[_0x05b4('0x64')](function(_0x491787){logger[_0x05b4('0x63')](_0x05b4('0x6f'),util[_0x05b4('0x66')](_0x491787,{'showHidden':!![],'depth':null}));});};exports[_0x05b4('0x70')]=function(_0x475a51,_0x1a1616,_0x38d27f,_0x3837c7,_0xee7dc7,_0x13e57e){var _0x157c91,_0x24f145;_0x13e57e[_0x05b4('0xf')]=intUtil[_0x05b4('0x4c')](_0x13e57e[_0x05b4('0xf')]);_0x13e57e[_0x05b4('0x4d')]=intUtil[_0x05b4('0x4c')](_0x13e57e[_0x05b4('0x4d')]);if(_0xee7dc7&&_0xee7dc7[_0x05b4('0x4e')]){logger[_0x05b4('0xb')]('['+_0x1a1616[_0x05b4('0x71')][_0x05b4('0x72')]()+']',_0x05b4('0x50'));_0x1a1616['recordingURL']=util[_0x05b4('0xd')](_0x05b4('0x51'),_0x13e57e[_0x05b4('0x4d')],_0x1a1616[_0x05b4('0x52')],md5(_0x1a1616[_0x05b4('0x52')]));}else{_0x1a1616[_0x05b4('0x53')]='';}headers[_0x05b4('0x54')]=getAuth(_0x13e57e);return getUser(_0x13e57e)[_0x05b4('0x17')](function(_0x57c48b){_0x157c91=_0x57c48b;logger[_0x05b4('0xb')](_0x05b4('0x56'),_0x157c91['id']);return getEndUser(_0x13e57e,_0x1a1616[_0x05b4('0x57')],_0x1a1616['calleridnum']);})[_0x05b4('0x17')](function(_0xa95626){_0x24f145=_0xa95626;logger['info'](_0x05b4('0x59'),_0x24f145['id']);return getTicket(_0x13e57e,_0x157c91,_0x24f145,_0x38d27f,_0x1a1616);})[_0x05b4('0x17')](function(_0x30359a){if(_0x30359a){logger['info'](_0x05b4('0x5a'),_0x30359a['id']);}})[_0x05b4('0x64')](function(_0x763b62){logger[_0x05b4('0x63')]('['+_0x1a1616[_0x05b4('0x71')][_0x05b4('0x72')]()+']'+_0x05b4('0x73'),util[_0x05b4('0x66')](_0x763b62,{'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 c9c9840..58e30c6 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 _0xc3f6=['Description','Descriptions','enduserType','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','mm:ss','lastevent','called','Call_Result','complete','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','outbound','agentcalledAt','Inbound','merge','Fields','/crm/v2/Calls','details','err','stack','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','email','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','host','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','/api/voice/recordings/','The\x20User\x20ID\x20is:','destcalleridnum','Outbound','unmanaged','toUpperCase','lodash','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','zoho','redis','defaults','localhost','emit','debug','[HTTP]','stringify','length','forEach','includes','picklist','idField','content','variable','variableName','toString','type','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','seconds','catch','error','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','isArrayLikeObject','users','findIndex','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','profile','user','data','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','log','uri','Contacts','Leads','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','Subject','getString'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xc3f6,0xdf));var _0x6c3f=function(_0x2514fb,_0x1bba45){_0x2514fb=_0x2514fb-0x0;var _0x1e14ab=_0xc3f6[_0x2514fb];return _0x1e14ab;};'use strict';var _=require(_0x6c3f('0x0'));var rp=require('request-promise');var md5=require(_0x6c3f('0x1'));var util=require(_0x6c3f('0x2'));var intUtil=require(_0x6c3f('0x3'));var moment=require(_0x6c3f('0x4'));var Redis=require(_0x6c3f('0x5'));var BPromise=require(_0x6c3f('0x6'));var config=require(_0x6c3f('0x7'));var logger=require('../../../../config/logger')(_0x6c3f('0x8'));config[_0x6c3f('0x9')]=_[_0x6c3f('0xa')](config[_0x6c3f('0x9')],{'host':_0x6c3f('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6c3f('0x9')]));function emit(_0x37c222,_0xde54b8,_0x21e57f){io['to'](_0x37c222)[_0x6c3f('0xc')](_0xde54b8,_0x21e57f);}function request(_0x501226){logger[_0x6c3f('0xd')](_0x6c3f('0xe'),JSON[_0x6c3f('0xf')](_0x501226));return rp(_0x501226);}function getCustomFields(_0x296591,_0x1a174a){var _0x4cb297={};if(_0x296591[_0x6c3f('0x10')]>0x0){_[_0x6c3f('0x11')](_0x296591,function(_0x4e4d7d){if(_[_0x6c3f('0x12')](['string',_0x6c3f('0x13')],_0x4e4d7d['type'])&&_0x4e4d7d[_0x6c3f('0x14')]){_0x4cb297[_0x4e4d7d['idField']]=_0x4e4d7d[_0x6c3f('0x15')]['toString']();}else if(_0x4e4d7d['type']===_0x6c3f('0x16')&&_0x4e4d7d[_0x6c3f('0x17')]&&_0x4e4d7d[_0x6c3f('0x14')]&&_0x1a174a[_0x4e4d7d[_0x6c3f('0x17')]]){_0x4cb297[_0x4e4d7d[_0x6c3f('0x14')]]=_0x1a174a[_0x4e4d7d[_0x6c3f('0x17')]][_0x6c3f('0x18')]();}else if(_0x4e4d7d[_0x6c3f('0x19')]===_0x6c3f('0x1a')&&_0x4e4d7d[_0x6c3f('0x1b')]&&_0x4e4d7d['Variable'][_0x6c3f('0x1c')]&&_0x4e4d7d[_0x6c3f('0x14')]&&_0x1a174a[_0x4e4d7d[_0x6c3f('0x1b')][_0x6c3f('0x1c')][_0x6c3f('0x1d')]()]){_0x4cb297[_0x4e4d7d[_0x6c3f('0x14')]]=_0x1a174a[_0x4e4d7d[_0x6c3f('0x1b')][_0x6c3f('0x1c')]['toLowerCase']()][_0x6c3f('0x18')]();}});}return _0x4cb297;}function getName(_0x72a43a){if(_0x72a43a[_0x6c3f('0x1e')]('\x20')>0x0){var _0xaa2d07=_0x72a43a[_0x6c3f('0x1f')](/ (.+)/);if(_0xaa2d07[0x1]){return _0xaa2d07;}}return[_0x72a43a,_0x72a43a];}var accountsTokens={};function getAccessToken(_0x568ae8){return new Promise(function(_0x185963,_0x38f45d){if(!_[_0x6c3f('0x20')](accountsTokens[_0x568ae8['id']])&&!_['isNil'](accountsTokens[_0x568ae8['id']][_0x6c3f('0x21')])){if(moment()[_0x6c3f('0x22')](accountsTokens[_0x568ae8['id']][_0x6c3f('0x23')])){_0x185963(accountsTokens[_0x568ae8['id']][_0x6c3f('0x21')]);}}var _0x2118f9;switch(_0x568ae8['zone']){case'US':_0x2118f9=_0x6c3f('0x24');break;case'AU':_0x2118f9=_0x6c3f('0x25');break;case'EU':_0x2118f9=_0x6c3f('0x26');break;case'IN':_0x2118f9=_0x6c3f('0x27');break;case'CN':_0x2118f9=_0x6c3f('0x28');break;default:_0x2118f9='https://accounts.zoho.eu';break;}var _0x40be64={'method':_0x6c3f('0x29'),'uri':_0x2118f9+_0x6c3f('0x2a'),'qs':{'refresh_token':_0x568ae8[_0x6c3f('0x2b')],'client_id':_0x568ae8[_0x6c3f('0x2c')],'client_secret':_0x568ae8[_0x6c3f('0x2d')],'grant_type':_0x6c3f('0x2e')},'json':!![]};return rp(_0x40be64)[_0x6c3f('0x2f')](function(_0x446466){accountsTokens[_0x568ae8['id']]={'access_token':_0x446466['access_token'],'expires_in':moment()['add'](_0x446466['expires_in'],_0x6c3f('0x30'))};_0x185963(_0x446466[_0x6c3f('0x21')]);})[_0x6c3f('0x31')](function(_0x529b61){logger[_0x6c3f('0x32')](_0x6c3f('0x33'),_0x529b61['stack']);_0x38f45d(_0x529b61);});});}function getUser(_0x30486e,_0x5c13b2,_0x50bac1,_0x21fd5b){logger[_0x6c3f('0x34')](_0x6c3f('0x35'));return request({'method':_0x6c3f('0x36'),'uri':util[_0x6c3f('0x37')](_0x6c3f('0x38'),_0x5c13b2),'qs':{'type':_0x6c3f('0x39')},'headers':{'Authorization':_0x6c3f('0x3a')+_0x30486e},'json':!![]})[_0x6c3f('0x2f')](function(_0x53ad0e){if(_0x53ad0e['users']){var _0x426b8f=-0x1;if(_[_0x6c3f('0x3b')](_0x53ad0e[_0x6c3f('0x3c')])){if(!_[_0x6c3f('0x20')](_0x21fd5b)){_0x426b8f=_[_0x6c3f('0x3d')](_0x53ad0e[_0x6c3f('0x3c')],function(_0x37957e){return _0x37957e['email']===_0x21fd5b;});}if(_0x426b8f>=0x0){logger['info'](_0x6c3f('0x3e'));}else{logger['info'](_0x6c3f('0x3f'));_0x426b8f=_[_0x6c3f('0x3d')](_0x53ad0e[_0x6c3f('0x3c')],function(_0xe188c1){return _0xe188c1['profile'][_0x6c3f('0x1c')]===_0x6c3f('0x40');});}return _0x53ad0e[_0x6c3f('0x3c')][_0x426b8f];}else{if(_0x53ad0e['user'][_0x6c3f('0x41')][_0x6c3f('0x1c')]==='Administrator'){logger[_0x6c3f('0x34')]('Using\x20the\x20admin\x20account!');user=_0x53ad0e[_0x6c3f('0x42')];return user;}else{logger[_0x6c3f('0x32')]('The\x20failing\x20result\x20is',JSON['stringify'](_0x53ad0e));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x6c3f('0xf')](_0x53ad0e));}}}else{logger[_0x6c3f('0x32')]('The\x20failing\x20result\x20is',JSON[_0x6c3f('0xf')](_0x53ad0e));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x6c3f('0xf')](_0x53ad0e));}})[_0x6c3f('0x31')](function(_0x612052){console[_0x6c3f('0x32')](_0x612052);});}function getZohoUser(_0x1871e1,_0x2013da){return new BPromise(function(_0x7fb3d7,_0x18c861){request(_0x1871e1)['then'](function(_0x191c99){var _0x54ce5c=null;if(_0x191c99){_0x54ce5c=_0x191c99[_0x6c3f('0x43')][0x0];_0x54ce5c['enduserType']=_0x2013da;}_0x7fb3d7(_0x54ce5c);})[_0x6c3f('0x31')](function(_0x584c28){_0x18c861(_0x584c28);});});}function createEndUser(_0xbbecbd,_0x4c4fbf,_0x2eff2b,_0x39d182,_0xb23e9d,_0x156e86){var _0x2eff2b=getName(_0x2eff2b);return request({'method':_0x6c3f('0x29'),'uri':_0x6c3f('0x44')+_0x4c4fbf+'/crm/v2/'+_[_0x6c3f('0x45')](_0x156e86[_0x6c3f('0x46')])+'s','body':{'data':[{'Last_Name':_0x2eff2b[0x1],'First_Name':_0x2eff2b[0x0],'Phone':_0x39d182,'Owner':{'name':!_['isNil'](_0xb23e9d[_0x6c3f('0x47')][_0x6c3f('0x1c')])?_0xb23e9d[_0x6c3f('0x47')]['name']:!_[_0x6c3f('0x20')](_0xb23e9d[_0x6c3f('0x48')])?_0xb23e9d['first_name']+'\x20'+_0xb23e9d[_0x6c3f('0x49')]:_0xb23e9d[_0x6c3f('0x49')],'id':_0xb23e9d['id']}}]},'headers':{'Authorization':_0x6c3f('0x3a')+_0xbbecbd},'json':!![]})[_0x6c3f('0x2f')](function(_0x201dab){if(_0x201dab&&_0x201dab[_0x6c3f('0x43')][0x0]['code']==='SUCCESS'){var _0x2540fa=_0x201dab['data'][0x0]['details'];_0x2540fa['enduserType']=_[_0x6c3f('0x45')](_0x156e86[_0x6c3f('0x46')])+'s';return _0x2540fa;}logger[_0x6c3f('0x32')]('The\x20failing\x20result\x20is',JSON[_0x6c3f('0xf')](data));throw new Error('Error:\x20'+JSON[_0x6c3f('0xf')](data));})['catch'](function(_0x1bc9e6){console[_0x6c3f('0x4a')]('CREATE\x20ERROR',_0x1bc9e6);});}function getEndUser(_0x30793e,_0xc68db1,_0x245db2,_0x3ece55,_0xa4a0a8,_0x1f1af2,_0x5315d6){var _0x591f03={'method':'GET','uri':'','headers':{'Authorization':_0x6c3f('0x3a')+_0x30793e},'json':!![]};switch(_0x5315d6['moduleSearch']){case'contact_lead':_0x591f03[_0x6c3f('0x4b')]=_0x6c3f('0x44')+_0xc68db1+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0xa4a0a8+'))';return getZohoUser(_0x591f03,_0x6c3f('0x4c'))[_0x6c3f('0x2f')](function(_0x55cbad){if(_0x55cbad)return _0x55cbad;_0x591f03[_0x6c3f('0x4b')]=_0x6c3f('0x44')+_0xc68db1+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0xa4a0a8+'))';return getZohoUser(_0x591f03,_0x6c3f('0x4d'))[_0x6c3f('0x2f')](function(_0x692eb8){if(_0x692eb8)return _0x692eb8;if(_0x5315d6['moduleCreate']!=_0x6c3f('0x4e')){return createEndUser(_0x30793e,_0xc68db1,_0x3ece55,_0xa4a0a8,_0x1f1af2,_0x5315d6);}else{return{};}});});break;case _0x6c3f('0x4f'):_0x591f03[_0x6c3f('0x4b')]='https://www.zohoapis.'+_0xc68db1+_0x6c3f('0x50')+_0xa4a0a8+'))';return getZohoUser(_0x591f03,_0x6c3f('0x4c'))['then'](function(_0x274f88){if(_0x274f88)return _0x274f88;if(_0x5315d6['moduleCreate']!='nothing'){return createEndUser(_0x30793e,_0xc68db1,_0x3ece55,_0xa4a0a8,_0x1f1af2,_0x5315d6);}else{return{};}});break;case'lead':_0x591f03[_0x6c3f('0x4b')]='https://www.zohoapis.'+_0xc68db1+_0x6c3f('0x51')+_0xa4a0a8+'))';return getZohoUser(_0x591f03,'Leads')[_0x6c3f('0x2f')](function(_0x565f48){if(_0x565f48)return _0x565f48;if(_0x5315d6['moduleCreate']!=_0x6c3f('0x4e')){return createEndUser(_0x30793e,_0xc68db1,_0x3ece55,_0xa4a0a8,_0x1f1af2,_0x5315d6);}else{return{};}});break;}}function getCall(_0x266354,_0x184442,_0x17ec6c,_0x47952c,_0x322483,_0x41720c,_0x53b5a1,_0x3bdc84){logger[_0x6c3f('0x34')](_0x6c3f('0x52'));var _0x413880={};_0x413880[_0x6c3f('0x53')]={'name':!_['isNil'](_0x47952c[_0x6c3f('0x47')][_0x6c3f('0x1c')])&&!_[_0x6c3f('0x20')](_0x47952c[_0x6c3f('0x41')][_0x6c3f('0x1c')])&&_0x47952c[_0x6c3f('0x41')][_0x6c3f('0x1c')]===_0x6c3f('0x54')?_0x47952c[_0x6c3f('0x47')][_0x6c3f('0x1c')]:!_['isNil'](_0x47952c[_0x6c3f('0x48')])?_0x47952c[_0x6c3f('0x48')]+'\x20'+_0x47952c[_0x6c3f('0x49')]:_0x47952c[_0x6c3f('0x49')],'id':_0x47952c['id']};_0x413880[_0x6c3f('0x55')]=intUtil[_0x6c3f('0x56')](_0x41720c['Subjects'],_0x53b5a1,'\x20');_0x413880[_0x6c3f('0x57')]=intUtil[_0x6c3f('0x56')](_0x41720c[_0x6c3f('0x58')],_0x53b5a1,'\x0a');if(_0x322483[_0x6c3f('0x59')]===_0x6c3f('0x4c')){_0x413880[_0x6c3f('0x5a')]={'name':!_[_0x6c3f('0x20')](_0x322483[_0x6c3f('0x5b')])?_0x322483['Full_Name']:!_['isNil'](_0x322483[_0x6c3f('0x5c')])?_0x322483['First_Name']+'\x20'+_0x322483['Last_Name']:_0x322483[_0x6c3f('0x5d')],'id':_0x322483['id']};}if(_0x322483[_0x6c3f('0x59')]===_0x6c3f('0x4d')){_0x413880[_0x6c3f('0x5e')]={'name':!_[_0x6c3f('0x20')](_0x322483[_0x6c3f('0x5b')])?_0x322483[_0x6c3f('0x5b')]:!_['isNil'](_0x322483[_0x6c3f('0x5c')])?_0x322483[_0x6c3f('0x5c')]+'\x20'+_0x322483[_0x6c3f('0x5d')]:_0x322483[_0x6c3f('0x5d')],'id':_0x322483['id']};_0x413880[_0x6c3f('0x5f')]=_[_0x6c3f('0x45')](_0x322483[_0x6c3f('0x59')]);}if(_0x53b5a1[_0x6c3f('0x60')]){_0x413880[_0x6c3f('0x61')]=moment[_0x6c3f('0x62')](parseInt(_0x53b5a1[_0x6c3f('0x60')])*0x3e8)['format']('mm:ss');}else if(_0x53b5a1[_0x6c3f('0x63')]&&_0x53b5a1[_0x6c3f('0x64')]){_0x413880['Call_Duration']=moment[_0x6c3f('0x62')](moment(_0x53b5a1[_0x6c3f('0x64')],_0x6c3f('0x65'))[_0x6c3f('0x66')](moment(_0x53b5a1[_0x6c3f('0x67')],_0x6c3f('0x65'))))[_0x6c3f('0x37')](_0x6c3f('0x68'));}switch(_0x53b5a1[_0x6c3f('0x69')]){case _0x6c3f('0x6a'):_0x413880[_0x6c3f('0x6b')]='Called';break;case _0x6c3f('0x6c'):case'connect':_0x413880[_0x6c3f('0x6b')]=_0x6c3f('0x6d');break;case _0x6c3f('0x6e'):_0x413880['Call_Result']=_0x6c3f('0x6f');break;case _0x6c3f('0x70'):_0x413880['Call_Result']=_0x6c3f('0x71');break;case _0x6c3f('0x72'):_0x413880[_0x6c3f('0x6b')]=_0x6c3f('0x73');default:}_0x413880['Call_Start_Time']=(_0x3bdc84===_0x6c3f('0x74')?moment(_0x53b5a1[_0x6c3f('0x67')])['format'](_0x6c3f('0x65')):moment(_0x53b5a1[_0x6c3f('0x75')])['format'](_0x6c3f('0x65')))||moment()[_0x6c3f('0x37')](_0x6c3f('0x65'));_0x413880['Call_Type']=_0x3bdc84||_0x6c3f('0x76');_0x413880=_[_0x6c3f('0x77')](_0x413880,getCustomFields(_0x41720c[_0x6c3f('0x78')],_0x53b5a1));return request({'method':_0x6c3f('0x29'),'uri':_0x6c3f('0x44')+_0x184442+_0x6c3f('0x79'),'headers':{'Authorization':_0x6c3f('0x3a')+_0x266354},'body':{'data':[_0x413880]},'json':!![]})['then'](function(_0x4f6a2e){if(_0x4f6a2e&&_0x4f6a2e[_0x6c3f('0x43')][0x0]['code']==='SUCCESS'){logger[_0x6c3f('0x34')]('Call\x20created!');return{'id':_0x4f6a2e['data'][0x0][_0x6c3f('0x7a')]['id']};}})['catch'](function(_0x5b27f4){logger[_0x6c3f('0x34')](_0x6c3f('0x7b'),_0x5b27f4[_0x6c3f('0x7c')]);console[_0x6c3f('0x4a')](_0x6c3f('0x7b'),_0x5b27f4);});}exports[_0x6c3f('0x7d')]=function(_0x8ee48e,_0x3f3f65,_0x1917c3,_0x46e23d,_0x329eaa,_0x31e9dc){var _0x4c40ed,_0x5def4e,_0x2d24a1;_0x31e9dc['host']=intUtil[_0x6c3f('0x7e')](_0x31e9dc['host']);_0x31e9dc[_0x6c3f('0x7f')]=intUtil[_0x6c3f('0x7e')](_0x31e9dc[_0x6c3f('0x7f')]);if(_0x329eaa&&_0x329eaa[_0x6c3f('0x80')]){logger['info'](_0x6c3f('0x81'),_0x6c3f('0x82'));_0x3f3f65[_0x6c3f('0x83')]=_0x31e9dc[_0x6c3f('0x7f')]+'/api/voice/recordings/'+_0x3f3f65[_0x6c3f('0x84')]+_0x6c3f('0x85')+md5(_0x3f3f65[_0x6c3f('0x84')]);}else{_0x3f3f65[_0x6c3f('0x83')]='';}var _0x1c7592=_0x31e9dc['host']===_0x6c3f('0x86')?'eu':_0x6c3f('0x87');return getAccessToken(_0x31e9dc)[_0x6c3f('0x2f')](function(_0x29b226){_0x2d24a1=_0x29b226;return getUser(_0x2d24a1,_0x1c7592,_0x31e9dc,_0x46e23d[_0x6c3f('0x88')]);})['then'](function(_0x2fd71c){_0x4c40ed=_0x2fd71c;logger[_0x6c3f('0x34')]('The\x20User\x20ID\x20is:',_0x4c40ed['id']);return getEndUser(_0x2d24a1,_0x1c7592,_0x31e9dc,_0x3f3f65[_0x6c3f('0x89')],_0x3f3f65[_0x6c3f('0x8a')],_0x4c40ed,_0x1917c3);})['then'](function(_0x1cef69){_0x5def4e=_0x1cef69;return getCall(_0x2d24a1,_0x1c7592,_0x31e9dc,_0x4c40ed,_0x5def4e,_0x1917c3,_0x3f3f65,_0x6c3f('0x76'));})[_0x6c3f('0x2f')](function(_0x36b2b6){if(_0x36b2b6){logger[_0x6c3f('0x34')](_0x6c3f('0x8b'),_0x36b2b6['id']);logger[_0x6c3f('0x34')](_0x6c3f('0x81'),_0x6c3f('0x8c'));emit(util[_0x6c3f('0x37')](_0x6c3f('0x8d'),_0x46e23d[_0x6c3f('0x1c')]),_0x6c3f('0x8e'),{'uri':_0x6c3f('0x8f')+_0x31e9dc[_0x6c3f('0x90')]+_0x6c3f('0x91')+_0x36b2b6['id']});}})[_0x6c3f('0x31')](function(_0x106f6a){logger[_0x6c3f('0x32')]('[QUEUE]',JSON['stringify'](_0x106f6a));});};exports[_0x6c3f('0x74')]=function(_0x4e4c42,_0x333778,_0x5e8ddd,_0x176ba7,_0x181f4a,_0x39b9f3,_0x4f72ba){var _0x4f50ad,_0x5a0e53,_0x58bfae;_0x39b9f3['host']=intUtil[_0x6c3f('0x7e')](_0x39b9f3[_0x6c3f('0x90')]);_0x39b9f3[_0x6c3f('0x7f')]=intUtil[_0x6c3f('0x7e')](_0x39b9f3[_0x6c3f('0x7f')]);if(_0x4f72ba&&_0x4f72ba['recordingFormat']&&_0x4f72ba[_0x6c3f('0x92')]!==_0x6c3f('0x93')){logger[_0x6c3f('0x34')](_0x6c3f('0x94'),_0x6c3f('0x82'));_0x333778[_0x6c3f('0x83')]=_0x39b9f3[_0x6c3f('0x7f')]+_0x6c3f('0x95')+_0x333778['uniqueid']+_0x6c3f('0x85')+md5(_0x333778[_0x6c3f('0x84')]);}var _0x3ebd24=_0x39b9f3[_0x6c3f('0x90')]===_0x6c3f('0x86')?'eu':_0x6c3f('0x87');return getAccessToken(_0x39b9f3)['then'](function(_0x42f361){_0x58bfae=_0x42f361;return getUser(_0x58bfae,_0x3ebd24,_0x39b9f3,_0x176ba7['email']);})[_0x6c3f('0x2f')](function(_0x445864){_0x4f50ad=_0x445864;logger[_0x6c3f('0x34')](_0x6c3f('0x96'),_0x4f50ad['id']);return getEndUser(_0x58bfae,_0x3ebd24,_0x39b9f3,_0x333778['destcalleridname'],_0x333778[_0x6c3f('0x97')],_0x4f50ad,_0x5e8ddd);})[_0x6c3f('0x2f')](function(_0x31dc77){_0x5a0e53=_0x31dc77;return getCall(_0x58bfae,_0x3ebd24,_0x39b9f3,_0x4f50ad,_0x5a0e53,_0x5e8ddd,_0x333778,_0x6c3f('0x98'));})[_0x6c3f('0x2f')](function(_0x195361){if(_0x195361){logger[_0x6c3f('0x34')](_0x6c3f('0x8b'),_0x195361['id']);logger[_0x6c3f('0x34')](_0x6c3f('0x94'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6c3f('0x37')](_0x6c3f('0x8d'),_0x176ba7[_0x6c3f('0x1c')]),_0x6c3f('0x8e'),{'uri':'https://crm.'+_0x39b9f3[_0x6c3f('0x90')]+'/crm/EntityInfo.do?module=Calls&id='+_0x195361['id']});}})[_0x6c3f('0x31')](function(_0x537b7c){logger[_0x6c3f('0x32')](_0x6c3f('0x94'),JSON[_0x6c3f('0xf')](_0x537b7c));});};exports[_0x6c3f('0x99')]=function(_0x4651c2,_0x1806b4,_0x4862c5,_0x35e7a2,_0x585b41,_0x210f97){var _0x1d37cb,_0x491804,_0x4d4574;_0x210f97[_0x6c3f('0x90')]=intUtil['stripTrailingSlash'](_0x210f97[_0x6c3f('0x90')]);_0x210f97[_0x6c3f('0x7f')]=intUtil[_0x6c3f('0x7e')](_0x210f97[_0x6c3f('0x7f')]);if(_0x585b41&&_0x585b41[_0x6c3f('0x80')]){logger[_0x6c3f('0x34')]('['+_0x1806b4['lastevent'][_0x6c3f('0x9a')]()+']','Recording\x20is\x20enabled!');_0x1806b4[_0x6c3f('0x83')]=_0x210f97[_0x6c3f('0x7f')]+_0x6c3f('0x95')+_0x1806b4[_0x6c3f('0x84')]+_0x6c3f('0x85')+md5(_0x1806b4[_0x6c3f('0x84')]);}else{_0x1806b4[_0x6c3f('0x83')]='';}var _0x48b8d6=_0x210f97[_0x6c3f('0x90')]===_0x6c3f('0x86')?'eu':'com';return getAccessToken(_0x210f97)[_0x6c3f('0x2f')](function(_0x55cee6){_0x4d4574=_0x55cee6;return getUser(_0x4d4574,_0x48b8d6,_0x210f97);})[_0x6c3f('0x2f')](function(_0x243147){_0x1d37cb=_0x243147;logger[_0x6c3f('0x34')](_0x6c3f('0x96'),_0x1d37cb['id']);return getEndUser(_0x4d4574,_0x48b8d6,_0x210f97,_0x1806b4[_0x6c3f('0x89')],_0x1806b4['calleridnum'],_0x1d37cb,_0x4862c5);})[_0x6c3f('0x2f')](function(_0x2700a0){_0x491804=_0x2700a0;return getCall(_0x4d4574,_0x48b8d6,_0x210f97,_0x1d37cb,_0x491804,_0x4862c5,_0x1806b4,_0x6c3f('0x76'));})[_0x6c3f('0x2f')](function(_0x2bf3a2){if(_0x2bf3a2){logger[_0x6c3f('0x34')]('The\x20Call\x20ID\x20is:',_0x2bf3a2['id']);}})[_0x6c3f('0x31')](function(_0x2587ce){logger[_0x6c3f('0x32')]('['+_0x1806b4[_0x6c3f('0x69')][_0x6c3f('0x9a')]()+']',JSON[_0x6c3f('0xf')](_0x2587ce));});}; \ No newline at end of file +var _0xece1=['includes','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','isNil','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','expires_in','seconds','catch','error','Failing\x20creating\x20the\x20access_token','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','email','Agent\x20found!','info','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','data','code','SUCCESS','details','moduleCreate','Error:\x20','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','Creating\x20new\x20call...','Owner','administrator','Subject','Subjects','Who_Id','Full_Name','Last_Name','What_Id','First_Name','talktime','Call_Duration','utc','answertime','endtime','YYYY-MM-DDTHH:mm:ss','starttime','mm:ss','lastevent','called','Called','complete','connect','Call_Result','rejected','Rejected','abandoned','Abandoned','timeout','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','log','err','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','host','zoho.eu','The\x20User\x20ID\x20is:','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','com','destcalleridname','destcalleridnum','trigger:browser:url','unmanaged','stripTrailingSlash','toUpperCase','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','[HTTP]','stringify'];(function(_0x5f24ed,_0x2e8ac3){var _0x524f8b=function(_0x1fe511){while(--_0x1fe511){_0x5f24ed['push'](_0x5f24ed['shift']());}};_0x524f8b(++_0x2e8ac3);}(_0xece1,0x8a));var _0x1ece=function(_0x238a66,_0x3a20a7){_0x238a66=_0x238a66-0x0;var _0x56f6f2=_0xece1[_0x238a66];return _0x56f6f2;};'use strict';var _=require(_0x1ece('0x0'));var rp=require(_0x1ece('0x1'));var md5=require(_0x1ece('0x2'));var util=require(_0x1ece('0x3'));var intUtil=require(_0x1ece('0x4'));var moment=require(_0x1ece('0x5'));var Redis=require(_0x1ece('0x6'));var BPromise=require(_0x1ece('0x7'));var config=require(_0x1ece('0x8'));var logger=require(_0x1ece('0x9'))(_0x1ece('0xa'));config[_0x1ece('0xb')]=_[_0x1ece('0xc')](config['redis'],{'host':_0x1ece('0xd'),'port':0x18eb});var io=require(_0x1ece('0xe'))(new Redis(config['redis']));function emit(_0x3642d2,_0x543542,_0x1fb751){io['to'](_0x3642d2)[_0x1ece('0xf')](_0x543542,_0x1fb751);}function request(_0x1dfb84){logger['debug'](_0x1ece('0x10'),JSON[_0x1ece('0x11')](_0x1dfb84));return rp(_0x1dfb84);}function getCustomFields(_0x228648,_0x36c995){var _0x29d106={};if(_0x228648['length']>0x0){_['forEach'](_0x228648,function(_0xfac7b3){if(_[_0x1ece('0x12')]([_0x1ece('0x13'),_0x1ece('0x14')],_0xfac7b3[_0x1ece('0x15')])&&_0xfac7b3[_0x1ece('0x16')]){_0x29d106[_0xfac7b3[_0x1ece('0x16')]]=_0xfac7b3[_0x1ece('0x17')][_0x1ece('0x18')]();}else if(_0xfac7b3[_0x1ece('0x15')]===_0x1ece('0x19')&&_0xfac7b3[_0x1ece('0x1a')]&&_0xfac7b3['idField']&&_0x36c995[_0xfac7b3['variableName']]){_0x29d106[_0xfac7b3[_0x1ece('0x16')]]=_0x36c995[_0xfac7b3['variableName']][_0x1ece('0x18')]();}else if(_0xfac7b3[_0x1ece('0x15')]===_0x1ece('0x1b')&&_0xfac7b3[_0x1ece('0x1c')]&&_0xfac7b3[_0x1ece('0x1c')][_0x1ece('0x1d')]&&_0xfac7b3['idField']&&_0x36c995[_0xfac7b3[_0x1ece('0x1c')]['name'][_0x1ece('0x1e')]()]){_0x29d106[_0xfac7b3[_0x1ece('0x16')]]=_0x36c995[_0xfac7b3[_0x1ece('0x1c')][_0x1ece('0x1d')][_0x1ece('0x1e')]()]['toString']();}});}return _0x29d106;}function getName(_0x1b8d90){if(_0x1b8d90[_0x1ece('0x1f')]('\x20')>0x0){var _0x2764f2=_0x1b8d90['split'](/ (.+)/);if(_0x2764f2[0x1]){return _0x2764f2;}}return[_0x1b8d90,_0x1b8d90];}var accountsTokens={};function getAccessToken(_0x517f26){return new Promise(function(_0x31ee4d,_0x28641d){if(!_[_0x1ece('0x20')](accountsTokens[_0x517f26['id']])&&!_['isNil'](accountsTokens[_0x517f26['id']][_0x1ece('0x21')])){if(moment()['isBefore'](accountsTokens[_0x517f26['id']]['expires_in'])){_0x31ee4d(accountsTokens[_0x517f26['id']][_0x1ece('0x21')]);}}var _0x444d5b;switch(_0x517f26[_0x1ece('0x22')]){case'US':_0x444d5b=_0x1ece('0x23');break;case'AU':_0x444d5b='https://accounts.zoho.com.au';break;case'EU':_0x444d5b=_0x1ece('0x24');break;case'IN':_0x444d5b=_0x1ece('0x25');break;case'CN':_0x444d5b=_0x1ece('0x26');break;default:_0x444d5b=_0x1ece('0x24');break;}var _0x1fd56b={'method':_0x1ece('0x27'),'uri':_0x444d5b+_0x1ece('0x28'),'qs':{'refresh_token':_0x517f26[_0x1ece('0x29')],'client_id':_0x517f26[_0x1ece('0x2a')],'client_secret':_0x517f26[_0x1ece('0x2b')],'grant_type':_0x1ece('0x2c')},'json':!![]};return rp(_0x1fd56b)[_0x1ece('0x2d')](function(_0x3b8f7b){accountsTokens[_0x517f26['id']]={'access_token':_0x3b8f7b[_0x1ece('0x21')],'expires_in':moment()[_0x1ece('0x2e')](_0x3b8f7b[_0x1ece('0x2f')],_0x1ece('0x30'))};_0x31ee4d(_0x3b8f7b[_0x1ece('0x21')]);})[_0x1ece('0x31')](function(_0x2ae79b){logger[_0x1ece('0x32')](_0x1ece('0x33'),_0x2ae79b['stack']);_0x28641d(_0x2ae79b);});});}function getUser(_0x3b0a41,_0xf90ae3,_0x2894ac,_0x452675){logger['info'](_0x1ece('0x34'));return request({'method':_0x1ece('0x35'),'uri':util[_0x1ece('0x36')](_0x1ece('0x37'),_0xf90ae3),'qs':{'type':_0x1ece('0x38')},'headers':{'Authorization':_0x1ece('0x39')+_0x3b0a41},'json':!![]})[_0x1ece('0x2d')](function(_0x3bb310){if(_0x3bb310[_0x1ece('0x3a')]){var _0x20460f=-0x1;if(_['isArrayLikeObject'](_0x3bb310[_0x1ece('0x3a')])){if(!_['isNil'](_0x452675)){_0x20460f=_[_0x1ece('0x3b')](_0x3bb310['users'],function(_0x24f607){return _0x24f607[_0x1ece('0x3c')]===_0x452675;});}if(_0x20460f>=0x0){logger['info'](_0x1ece('0x3d'));}else{logger[_0x1ece('0x3e')]('Using\x20the\x20admin\x20account!');_0x20460f=_[_0x1ece('0x3b')](_0x3bb310[_0x1ece('0x3a')],function(_0x2ee5a0){return _0x2ee5a0[_0x1ece('0x3f')][_0x1ece('0x1d')]===_0x1ece('0x40');});}return _0x3bb310[_0x1ece('0x3a')][_0x20460f];}else{if(_0x3bb310[_0x1ece('0x41')][_0x1ece('0x3f')]['name']==='Administrator'){logger[_0x1ece('0x3e')]('Using\x20the\x20admin\x20account!');user=_0x3bb310[_0x1ece('0x41')];return user;}else{logger[_0x1ece('0x32')](_0x1ece('0x42'),JSON[_0x1ece('0x11')](_0x3bb310));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x1ece('0x11')](_0x3bb310));}}}else{logger[_0x1ece('0x32')]('The\x20failing\x20result\x20is',JSON[_0x1ece('0x11')](_0x3bb310));throw new Error(_0x1ece('0x43')+JSON['stringify'](_0x3bb310));}})[_0x1ece('0x31')](function(_0x3aa1e2){console[_0x1ece('0x32')](_0x3aa1e2);});}function getZohoUser(_0x5843f0,_0xe8b465){return new BPromise(function(_0x5a5f04,_0x1001b0){request(_0x5843f0)[_0x1ece('0x2d')](function(_0x17c6b4){var _0x56f916=null;if(_0x17c6b4){_0x56f916=_0x17c6b4['data'][0x0];_0x56f916[_0x1ece('0x44')]=_0xe8b465;}_0x5a5f04(_0x56f916);})[_0x1ece('0x31')](function(_0xb7afda){_0x1001b0(_0xb7afda);});});}function createEndUser(_0x28d087,_0x5ab415,_0x36f6a9,_0x365751,_0x2090bb,_0x31150f){var _0x36f6a9=getName(_0x36f6a9);return request({'method':_0x1ece('0x27'),'uri':_0x1ece('0x45')+_0x5ab415+_0x1ece('0x46')+_[_0x1ece('0x47')](_0x31150f['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x36f6a9[0x1],'First_Name':_0x36f6a9[0x0],'Phone':_0x365751,'Owner':{'name':!_[_0x1ece('0x20')](_0x2090bb[_0x1ece('0x48')][_0x1ece('0x1d')])?_0x2090bb[_0x1ece('0x48')]['name']:!_['isNil'](_0x2090bb[_0x1ece('0x49')])?_0x2090bb[_0x1ece('0x49')]+'\x20'+_0x2090bb['last_name']:_0x2090bb[_0x1ece('0x4a')],'id':_0x2090bb['id']}}]},'headers':{'Authorization':_0x1ece('0x39')+_0x28d087},'json':!![]})['then'](function(_0x55621a){if(_0x55621a&&_0x55621a[_0x1ece('0x4b')][0x0][_0x1ece('0x4c')]===_0x1ece('0x4d')){var _0x340c62=_0x55621a[_0x1ece('0x4b')][0x0][_0x1ece('0x4e')];_0x340c62[_0x1ece('0x44')]=_[_0x1ece('0x47')](_0x31150f[_0x1ece('0x4f')])+'s';return _0x340c62;}logger[_0x1ece('0x32')](_0x1ece('0x42'),JSON[_0x1ece('0x11')](data));throw new Error(_0x1ece('0x50')+JSON[_0x1ece('0x11')](data));})[_0x1ece('0x31')](function(_0x19a5b6){console['log'](_0x1ece('0x51'),_0x19a5b6);});}function getEndUser(_0xd2be23,_0x17f230,_0x3f691f,_0x15e0b6,_0x35ba5a,_0x189538,_0xfce9fc){var _0x41f996={'method':_0x1ece('0x35'),'uri':'','headers':{'Authorization':_0x1ece('0x39')+_0xd2be23},'json':!![]};switch(_0xfce9fc[_0x1ece('0x52')]){case _0x1ece('0x53'):_0x41f996[_0x1ece('0x54')]=_0x1ece('0x45')+_0x17f230+_0x1ece('0x55')+_0x35ba5a+'))';return getZohoUser(_0x41f996,_0x1ece('0x56'))['then'](function(_0x3fa837){if(_0x3fa837)return _0x3fa837;_0x41f996[_0x1ece('0x54')]=_0x1ece('0x45')+_0x17f230+_0x1ece('0x57')+_0x35ba5a+'))';return getZohoUser(_0x41f996,_0x1ece('0x58'))[_0x1ece('0x2d')](function(_0x1a2172){if(_0x1a2172)return _0x1a2172;if(_0xfce9fc['moduleCreate']!=_0x1ece('0x59')){return createEndUser(_0xd2be23,_0x17f230,_0x15e0b6,_0x35ba5a,_0x189538,_0xfce9fc);}else{return{};}});});break;case _0x1ece('0x5a'):_0x41f996[_0x1ece('0x54')]='https://www.zohoapis.'+_0x17f230+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x35ba5a+'))';return getZohoUser(_0x41f996,_0x1ece('0x56'))['then'](function(_0x14401c){if(_0x14401c)return _0x14401c;if(_0xfce9fc[_0x1ece('0x4f')]!=_0x1ece('0x59')){return createEndUser(_0xd2be23,_0x17f230,_0x15e0b6,_0x35ba5a,_0x189538,_0xfce9fc);}else{return{};}});break;case'lead':_0x41f996[_0x1ece('0x54')]='https://www.zohoapis.'+_0x17f230+_0x1ece('0x57')+_0x35ba5a+'))';return getZohoUser(_0x41f996,_0x1ece('0x58'))[_0x1ece('0x2d')](function(_0x558b16){if(_0x558b16)return _0x558b16;if(_0xfce9fc[_0x1ece('0x4f')]!=_0x1ece('0x59')){return createEndUser(_0xd2be23,_0x17f230,_0x15e0b6,_0x35ba5a,_0x189538,_0xfce9fc);}else{return{};}});break;}}function getCall(_0x299d27,_0x443b21,_0x3e1bed,_0x5bf306,_0x331c18,_0x573d6f,_0x3dc3ab,_0xc342d5){logger[_0x1ece('0x3e')](_0x1ece('0x5b'));var _0x1a6775={};_0x1a6775[_0x1ece('0x5c')]={'name':!_['isNil'](_0x5bf306[_0x1ece('0x48')][_0x1ece('0x1d')])&&!_['isNil'](_0x5bf306[_0x1ece('0x3f')][_0x1ece('0x1d')])&&_0x5bf306['profile'][_0x1ece('0x1d')]===_0x1ece('0x5d')?_0x5bf306[_0x1ece('0x48')]['name']:!_[_0x1ece('0x20')](_0x5bf306['first_name'])?_0x5bf306['first_name']+'\x20'+_0x5bf306['last_name']:_0x5bf306['last_name'],'id':_0x5bf306['id']};_0x1a6775[_0x1ece('0x5e')]=intUtil['getString'](_0x573d6f[_0x1ece('0x5f')],_0x3dc3ab,'\x20');_0x1a6775['Description']=intUtil['getString'](_0x573d6f['Descriptions'],_0x3dc3ab,'\x0a');if(_0x331c18[_0x1ece('0x44')]==='Contacts'){_0x1a6775[_0x1ece('0x60')]={'name':!_[_0x1ece('0x20')](_0x331c18[_0x1ece('0x61')])?_0x331c18[_0x1ece('0x61')]:!_[_0x1ece('0x20')](_0x331c18['First_Name'])?_0x331c18['First_Name']+'\x20'+_0x331c18[_0x1ece('0x62')]:_0x331c18[_0x1ece('0x62')],'id':_0x331c18['id']};}if(_0x331c18['enduserType']===_0x1ece('0x58')){_0x1a6775[_0x1ece('0x63')]={'name':!_[_0x1ece('0x20')](_0x331c18[_0x1ece('0x61')])?_0x331c18[_0x1ece('0x61')]:!_[_0x1ece('0x20')](_0x331c18[_0x1ece('0x64')])?_0x331c18[_0x1ece('0x64')]+'\x20'+_0x331c18[_0x1ece('0x62')]:_0x331c18[_0x1ece('0x62')],'id':_0x331c18['id']};_0x1a6775['$se_module']=_[_0x1ece('0x47')](_0x331c18['enduserType']);}if(_0x3dc3ab[_0x1ece('0x65')]){_0x1a6775[_0x1ece('0x66')]=moment[_0x1ece('0x67')](parseInt(_0x3dc3ab[_0x1ece('0x65')])*0x3e8)[_0x1ece('0x36')]('mm:ss');}else if(_0x3dc3ab[_0x1ece('0x68')]&&_0x3dc3ab[_0x1ece('0x69')]){_0x1a6775['Call_Duration']=moment[_0x1ece('0x67')](moment(_0x3dc3ab[_0x1ece('0x69')],_0x1ece('0x6a'))['diff'](moment(_0x3dc3ab[_0x1ece('0x6b')],'YYYY-MM-DDTHH:mm:ss')))[_0x1ece('0x36')](_0x1ece('0x6c'));}switch(_0x3dc3ab[_0x1ece('0x6d')]){case _0x1ece('0x6e'):_0x1a6775['Call_Result']=_0x1ece('0x6f');break;case _0x1ece('0x70'):case _0x1ece('0x71'):_0x1a6775[_0x1ece('0x72')]='Answered';break;case _0x1ece('0x73'):_0x1a6775[_0x1ece('0x72')]=_0x1ece('0x74');break;case _0x1ece('0x75'):_0x1a6775['Call_Result']=_0x1ece('0x76');break;case _0x1ece('0x77'):_0x1a6775['Call_Result']='Timeout';default:}_0x1a6775['Call_Start_Time']=(_0xc342d5===_0x1ece('0x78')?moment(_0x3dc3ab[_0x1ece('0x6b')])[_0x1ece('0x36')](_0x1ece('0x6a')):moment(_0x3dc3ab[_0x1ece('0x79')])[_0x1ece('0x36')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x1ece('0x36')](_0x1ece('0x6a'));_0x1a6775[_0x1ece('0x7a')]=_0xc342d5||_0x1ece('0x7b');_0x1a6775=_[_0x1ece('0x7c')](_0x1a6775,getCustomFields(_0x573d6f[_0x1ece('0x7d')],_0x3dc3ab));return request({'method':_0x1ece('0x27'),'uri':_0x1ece('0x45')+_0x443b21+_0x1ece('0x7e'),'headers':{'Authorization':_0x1ece('0x39')+_0x299d27},'body':{'data':[_0x1a6775]},'json':!![]})[_0x1ece('0x2d')](function(_0x8aafad){if(_0x8aafad&&_0x8aafad[_0x1ece('0x4b')][0x0][_0x1ece('0x4c')]==='SUCCESS'){logger[_0x1ece('0x3e')]('Call\x20created!');return{'id':_0x8aafad[_0x1ece('0x4b')][0x0][_0x1ece('0x4e')]['id']};}})[_0x1ece('0x31')](function(_0x475d08){logger[_0x1ece('0x3e')]('err',_0x475d08['stack']);console[_0x1ece('0x7f')](_0x1ece('0x80'),_0x475d08);});}exports['queue']=function(_0x4911cb,_0x5bde23,_0x13880f,_0x5ab450,_0xcb4553,_0x1d58e5){var _0x3132f5,_0x33d404,_0x4536d7;_0x1d58e5['host']=intUtil['stripTrailingSlash'](_0x1d58e5['host']);_0x1d58e5['serverUrl']=intUtil['stripTrailingSlash'](_0x1d58e5[_0x1ece('0x81')]);if(_0xcb4553&&_0xcb4553[_0x1ece('0x82')]){logger[_0x1ece('0x3e')](_0x1ece('0x83'),_0x1ece('0x84'));_0x5bde23[_0x1ece('0x85')]=_0x1d58e5[_0x1ece('0x81')]+_0x1ece('0x86')+_0x5bde23[_0x1ece('0x87')]+_0x1ece('0x88')+md5(_0x5bde23[_0x1ece('0x87')]);}else{_0x5bde23[_0x1ece('0x85')]='';}var _0x20a438=_0x1d58e5[_0x1ece('0x89')]===_0x1ece('0x8a')?'eu':'com';return getAccessToken(_0x1d58e5)[_0x1ece('0x2d')](function(_0x2e710d){_0x4536d7=_0x2e710d;return getUser(_0x4536d7,_0x20a438,_0x1d58e5,_0x5ab450['email']);})[_0x1ece('0x2d')](function(_0x52a820){_0x3132f5=_0x52a820;logger[_0x1ece('0x3e')](_0x1ece('0x8b'),_0x3132f5['id']);return getEndUser(_0x4536d7,_0x20a438,_0x1d58e5,_0x5bde23['calleridname'],_0x5bde23[_0x1ece('0x8c')],_0x3132f5,_0x13880f);})[_0x1ece('0x2d')](function(_0x2280bb){_0x33d404=_0x2280bb;return getCall(_0x4536d7,_0x20a438,_0x1d58e5,_0x3132f5,_0x33d404,_0x13880f,_0x5bde23,'Inbound');})[_0x1ece('0x2d')](function(_0x28cec6){if(_0x28cec6){logger['info'](_0x1ece('0x8d'),_0x28cec6['id']);logger[_0x1ece('0x3e')](_0x1ece('0x83'),_0x1ece('0x8e'));emit(util[_0x1ece('0x36')](_0x1ece('0x8f'),_0x5ab450['name']),'trigger:browser:url',{'uri':_0x1ece('0x90')+_0x1d58e5[_0x1ece('0x89')]+_0x1ece('0x91')+_0x28cec6['id']});}})[_0x1ece('0x31')](function(_0x483ac6){logger[_0x1ece('0x32')]('[QUEUE]',JSON[_0x1ece('0x11')](_0x483ac6));});};exports[_0x1ece('0x78')]=function(_0x1777e8,_0x46e4f0,_0x34a1b6,_0x5c52de,_0x548a4b,_0x59d735,_0x24bf43){var _0x289ce1,_0x388d3d,_0x23cae2;_0x59d735['host']=intUtil['stripTrailingSlash'](_0x59d735[_0x1ece('0x89')]);_0x59d735[_0x1ece('0x81')]=intUtil['stripTrailingSlash'](_0x59d735[_0x1ece('0x81')]);if(_0x24bf43&&_0x24bf43[_0x1ece('0x92')]&&_0x24bf43[_0x1ece('0x92')]!==_0x1ece('0x93')){logger['info'](_0x1ece('0x94'),'Recording\x20is\x20enabled!');_0x46e4f0[_0x1ece('0x85')]=_0x59d735[_0x1ece('0x81')]+'/api/voice/recordings/'+_0x46e4f0['uniqueid']+_0x1ece('0x88')+md5(_0x46e4f0[_0x1ece('0x87')]);}var _0x4ffc4e=_0x59d735[_0x1ece('0x89')]===_0x1ece('0x8a')?'eu':_0x1ece('0x95');return getAccessToken(_0x59d735)[_0x1ece('0x2d')](function(_0x209b50){_0x23cae2=_0x209b50;return getUser(_0x23cae2,_0x4ffc4e,_0x59d735,_0x5c52de['email']);})[_0x1ece('0x2d')](function(_0x2a55ff){_0x289ce1=_0x2a55ff;logger[_0x1ece('0x3e')](_0x1ece('0x8b'),_0x289ce1['id']);return getEndUser(_0x23cae2,_0x4ffc4e,_0x59d735,_0x46e4f0[_0x1ece('0x96')],_0x46e4f0[_0x1ece('0x97')],_0x289ce1,_0x34a1b6);})[_0x1ece('0x2d')](function(_0x1b0e9a){_0x388d3d=_0x1b0e9a;return getCall(_0x23cae2,_0x4ffc4e,_0x59d735,_0x289ce1,_0x388d3d,_0x34a1b6,_0x46e4f0,'Outbound');})[_0x1ece('0x2d')](function(_0x5046bd){if(_0x5046bd){logger[_0x1ece('0x3e')](_0x1ece('0x8d'),_0x5046bd['id']);logger['info'](_0x1ece('0x94'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x5c52de[_0x1ece('0x1d')]),_0x1ece('0x98'),{'uri':_0x1ece('0x90')+_0x59d735[_0x1ece('0x89')]+_0x1ece('0x91')+_0x5046bd['id']});}})[_0x1ece('0x31')](function(_0xd306d0){logger['error'](_0x1ece('0x94'),JSON[_0x1ece('0x11')](_0xd306d0));});};exports[_0x1ece('0x99')]=function(_0x368caf,_0x92fdf1,_0x112c46,_0xf93409,_0x2198a4,_0x431fd0){var _0x183194,_0x3b209a,_0x5e27da;_0x431fd0['host']=intUtil[_0x1ece('0x9a')](_0x431fd0['host']);_0x431fd0[_0x1ece('0x81')]=intUtil[_0x1ece('0x9a')](_0x431fd0[_0x1ece('0x81')]);if(_0x2198a4&&_0x2198a4[_0x1ece('0x82')]){logger['info']('['+_0x92fdf1[_0x1ece('0x6d')][_0x1ece('0x9b')]()+']',_0x1ece('0x84'));_0x92fdf1[_0x1ece('0x85')]=_0x431fd0[_0x1ece('0x81')]+_0x1ece('0x86')+_0x92fdf1[_0x1ece('0x87')]+_0x1ece('0x88')+md5(_0x92fdf1[_0x1ece('0x87')]);}else{_0x92fdf1[_0x1ece('0x85')]='';}var _0x5d91d4=_0x431fd0[_0x1ece('0x89')]===_0x1ece('0x8a')?'eu':_0x1ece('0x95');return getAccessToken(_0x431fd0)[_0x1ece('0x2d')](function(_0x3f21f2){_0x5e27da=_0x3f21f2;return getUser(_0x5e27da,_0x5d91d4,_0x431fd0);})[_0x1ece('0x2d')](function(_0x4eae8b){_0x183194=_0x4eae8b;logger[_0x1ece('0x3e')](_0x1ece('0x8b'),_0x183194['id']);return getEndUser(_0x5e27da,_0x5d91d4,_0x431fd0,_0x92fdf1['calleridname'],_0x92fdf1[_0x1ece('0x8c')],_0x183194,_0x112c46);})[_0x1ece('0x2d')](function(_0x5b4fd6){_0x3b209a=_0x5b4fd6;return getCall(_0x5e27da,_0x5d91d4,_0x431fd0,_0x183194,_0x3b209a,_0x112c46,_0x92fdf1,_0x1ece('0x7b'));})[_0x1ece('0x2d')](function(_0x2fe7aa){if(_0x2fe7aa){logger[_0x1ece('0x3e')]('The\x20Call\x20ID\x20is:',_0x2fe7aa['id']);}})['catch'](function(_0xe9e090){logger[_0x1ece('0x32')]('['+_0x92fdf1['lastevent'][_0x1ece('0x9b')]()+']',JSON[_0x1ece('0x11')](_0xe9e090));});}; \ 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 c8e6dd5..5669d58 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 _0x82b3=['trigger','exec','data2','Script','data3','render','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','util','shelljs','mustache','../../../../config/logger'];(function(_0xbb95e,_0x308372){var _0x2b933d=function(_0x8dfdc9){while(--_0x8dfdc9){_0xbb95e['push'](_0xbb95e['shift']());}};_0x2b933d(++_0x308372);}(_0x82b3,0xf3));var _0x382b=function(_0x44a90a,_0x574c1e){_0x44a90a=_0x44a90a-0x0;var _0x34739d=_0x82b3[_0x44a90a];return _0x34739d;};'use strict';var util=require(_0x382b('0x0'));var sh=require(_0x382b('0x1'));var Mustache=require(_0x382b('0x2'));var logger=require(_0x382b('0x3'))(_0x382b('0x4'));exports[_0x382b('0x5')]=function(_0x1c18ec,_0x318d76){var _0x3b4fc7=_0x1c18ec[_0x382b('0x6')]?_0x1c18ec[_0x382b('0x6')]:_0x382b('0x7');var _0x3d3c0d=_0x1c18ec[_0x382b('0x8')]?Mustache[_0x382b('0x9')](_0x1c18ec[_0x382b('0x8')],_0x318d76):_0x318d76;sh[_0x382b('0x5')](_0x3d3c0d,function(_0x49199a,_0x151b56,_0x5ebf4c){if(_0x49199a!==0x0){logger['error'](util[_0x382b('0xa')](_0x382b('0xb'),_0x3b4fc7,_0x3d3c0d,_0x49199a,_0x5ebf4c));}else{logger[_0x382b('0xc')](util[_0x382b('0xa')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x3b4fc7,_0x3d3c0d,_0x151b56));}});}; \ No newline at end of file +var _0x6f0e=['data3','exec','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','../../../../config/logger','trigger','Script'];(function(_0x157ce5,_0xfa6b87){var _0x359c0c=function(_0x403f22){while(--_0x403f22){_0x157ce5['push'](_0x157ce5['shift']());}};_0x359c0c(++_0xfa6b87);}(_0x6f0e,0x67));var _0xe6f0=function(_0x2ec7b2,_0x1d37af){_0x2ec7b2=_0x2ec7b2-0x0;var _0x3427a6=_0x6f0e[_0x2ec7b2];return _0x3427a6;};'use strict';var util=require(_0xe6f0('0x0'));var sh=require(_0xe6f0('0x1'));var Mustache=require('mustache');var logger=require(_0xe6f0('0x2'))(_0xe6f0('0x3'));exports['exec']=function(_0x8fbcf6,_0x55dd98){var _0x1037c7=_0x8fbcf6['data2']?_0x8fbcf6['data2']:_0xe6f0('0x4');var _0x581125=_0x8fbcf6[_0xe6f0('0x5')]?Mustache['render'](_0x8fbcf6['data3'],_0x55dd98):_0x55dd98;sh[_0xe6f0('0x6')](_0x581125,function(_0x33f76a,_0x48a4e0,_0x5d3f72){if(_0x33f76a!==0x0){logger[_0xe6f0('0x7')](util[_0xe6f0('0x8')](_0xe6f0('0x9'),_0x1037c7,_0x581125,_0x33f76a,_0x5d3f72));}else{logger[_0xe6f0('0xa')](util['format'](_0xe6f0('0xb'),_0x1037c7,_0x581125,_0x48a4e0));}});}; \ 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 6a70e48..fd4753e 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 _0x7294=['data2','data5','number','headers','data6','error','stack','toUpperCase','GET','DELETE','POST','data7','parse','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','isNil',',\x20request\x20body:\x20','object','format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','request-promise','util','lodash','mustache','../../../../config/logger','trigger','exec','data1','render'];(function(_0x5483bb,_0x29a2ed){var _0x15b72c=function(_0x33f91e){while(--_0x33f91e){_0x5483bb['push'](_0x5483bb['shift']());}};_0x15b72c(++_0x29a2ed);}(_0x7294,0x83));var _0x4729=function(_0x4f1771,_0x82710c){_0x4f1771=_0x4f1771-0x0;var _0x1d5f87=_0x7294[_0x4f1771];return _0x1d5f87;};'use strict';var rp=require(_0x4729('0x0'));var util=require(_0x4729('0x1'));var _=require(_0x4729('0x2'));var Mustache=require(_0x4729('0x3'));var logger=require(_0x4729('0x4'))(_0x4729('0x5'));exports[_0x4729('0x6')]=function(_0x3538a7,_0x4aeea0){var _0x5672aa,_0x2fe4c9;var _0x5d63f2={'method':_0x3538a7[_0x4729('0x7')]['toUpperCase'](),'uri':Mustache[_0x4729('0x8')](_0x3538a7[_0x4729('0x9')],_0x4aeea0),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3538a7[_0x4729('0xa')])===_0x4729('0xb')&&parseInt(_0x3538a7[_0x4729('0xa')])>=0x1&&parseInt(_0x3538a7[_0x4729('0xa')])<=0xa?parseInt(_0x3538a7['data5'])*0x3e8:0x5*0x3e8};try{_0x5d63f2[_0x4729('0xc')]=_0x3538a7[_0x4729('0xd')]?JSON['parse'](Mustache[_0x4729('0x8')](_0x3538a7['data6'],_0x4aeea0)):{};}catch(_0x9fd799){logger[_0x4729('0xe')](_0x9fd799[_0x4729('0xf')]);}switch(_0x3538a7['data1'][_0x4729('0x10')]()){case _0x4729('0x11'):case _0x4729('0x12'):_0x5672aa=null;_0x5d63f2['qs']=_0x4aeea0;break;case _0x4729('0x13'):case'PUT':if(_0x3538a7[_0x4729('0x14')]){try{_0x5672aa=JSON[_0x4729('0x15')](Mustache[_0x4729('0x8')](_0x3538a7[_0x4729('0x14')],_0x4aeea0));_0x5d63f2['body']=_0x5672aa;}catch(_0x2757b0){logger['error'](_0x2757b0[_0x4729('0xf')]);logger[_0x4729('0xe')](_0x4729('0x16'));}}else{_0x5672aa=_0x4aeea0;_0x5d63f2[_0x4729('0x17')]=_0x5672aa;}break;}logger[_0x4729('0x18')](util['format'](_0x4729('0x19'),_0x3538a7[_0x4729('0x7')],_0x3538a7[_0x4729('0x9')],JSON[_0x4729('0x1a')](_0x5d63f2)));rp(_0x5d63f2)['then'](function(_0x139b64){_0x5672aa=!_[_0x4729('0x1b')](_0x5672aa)?_0x4729('0x1c')+_0x5672aa:'';_0x2fe4c9=typeof _0x139b64[_0x4729('0x17')]===_0x4729('0x1d')?JSON[_0x4729('0x1a')](_0x139b64[_0x4729('0x17')]):_0x139b64[_0x4729('0x17')];logger['info'](util[_0x4729('0x1e')](_0x4729('0x1f'),_0x3538a7[_0x4729('0x7')],_0x3538a7['data2'],_0x139b64[_0x4729('0x20')],_0x2fe4c9));})['catch'](function(_0x3ff1b5){logger[_0x4729('0xe')](util[_0x4729('0x1e')](_0x4729('0x21'),_0x3538a7[_0x4729('0x7')],_0x3538a7[_0x4729('0x9')],_0x3ff1b5[_0x4729('0x20')],_0x3ff1b5[_0x4729('0x22')],_0x3ff1b5['message']));});}; \ No newline at end of file +var _0xcfec=['exec','data1','toUpperCase','render','data5','number','headers','data6','error','GET','POST','PUT','parse','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','data2','stringify',',\x20request\x20body:\x20','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','name','message','request-promise','lodash','../../../../config/logger','trigger'];(function(_0x12baed,_0x45a719){var _0x630772=function(_0x449242){while(--_0x449242){_0x12baed['push'](_0x12baed['shift']());}};_0x630772(++_0x45a719);}(_0xcfec,0xbc));var _0xccfe=function(_0x58adb2,_0xb66883){_0x58adb2=_0x58adb2-0x0;var _0x49564c=_0xcfec[_0x58adb2];return _0x49564c;};'use strict';var rp=require(_0xccfe('0x0'));var util=require('util');var _=require(_0xccfe('0x1'));var Mustache=require('mustache');var logger=require(_0xccfe('0x2'))(_0xccfe('0x3'));exports[_0xccfe('0x4')]=function(_0x53330c,_0x5c5ce9){var _0x228de9,_0x325a7b;var _0x3964b0={'method':_0x53330c[_0xccfe('0x5')][_0xccfe('0x6')](),'uri':Mustache[_0xccfe('0x7')](_0x53330c['data2'],_0x5c5ce9),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x53330c[_0xccfe('0x8')])===_0xccfe('0x9')&&parseInt(_0x53330c[_0xccfe('0x8')])>=0x1&&parseInt(_0x53330c[_0xccfe('0x8')])<=0xa?parseInt(_0x53330c[_0xccfe('0x8')])*0x3e8:0x5*0x3e8};try{_0x3964b0[_0xccfe('0xa')]=_0x53330c[_0xccfe('0xb')]?JSON['parse'](Mustache[_0xccfe('0x7')](_0x53330c[_0xccfe('0xb')],_0x5c5ce9)):{};}catch(_0xf191f6){logger[_0xccfe('0xc')](_0xf191f6['stack']);}switch(_0x53330c[_0xccfe('0x5')][_0xccfe('0x6')]()){case _0xccfe('0xd'):case'DELETE':_0x228de9=null;_0x3964b0['qs']=_0x5c5ce9;break;case _0xccfe('0xe'):case _0xccfe('0xf'):if(_0x53330c['data7']){try{_0x228de9=JSON[_0xccfe('0x10')](Mustache[_0xccfe('0x7')](_0x53330c[_0xccfe('0x11')],_0x5c5ce9));_0x3964b0[_0xccfe('0x12')]=_0x228de9;}catch(_0x52a067){logger[_0xccfe('0xc')](_0x52a067[_0xccfe('0x13')]);logger[_0xccfe('0xc')](_0xccfe('0x14'));}}else{_0x228de9=_0x5c5ce9;_0x3964b0[_0xccfe('0x12')]=_0x228de9;}break;}logger[_0xccfe('0x15')](util[_0xccfe('0x16')](_0xccfe('0x17'),_0x53330c[_0xccfe('0x5')],_0x53330c[_0xccfe('0x18')],JSON[_0xccfe('0x19')](_0x3964b0)));rp(_0x3964b0)['then'](function(_0x514967){_0x228de9=!_['isNil'](_0x228de9)?_0xccfe('0x1a')+_0x228de9:'';_0x325a7b=typeof _0x514967[_0xccfe('0x12')]==='object'?JSON['stringify'](_0x514967[_0xccfe('0x12')]):_0x514967[_0xccfe('0x12')];logger[_0xccfe('0x15')](util[_0xccfe('0x16')](_0xccfe('0x1b'),_0x53330c[_0xccfe('0x5')],_0x53330c[_0xccfe('0x18')],_0x514967[_0xccfe('0x1c')],_0x325a7b));})[_0xccfe('0x1d')](function(_0x148e7a){logger[_0xccfe('0xc')](util[_0xccfe('0x16')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x53330c[_0xccfe('0x5')],_0x53330c[_0xccfe('0x18')],_0x148e7a[_0xccfe('0x1c')],_0x148e7a[_0xccfe('0x1e')],_0x148e7a[_0xccfe('0x1f')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 4379b51..099c436 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 _0x9255=['jayson/promise','bluebird','routing','http','Request','request','then','debug','rpc','error','message','result','catch','exports'];(function(_0x546c68,_0x5c0116){var _0x4a2389=function(_0x5aa205){while(--_0x5aa205){_0x546c68['push'](_0x546c68['shift']());}};_0x4a2389(++_0x5c0116);}(_0x9255,0xd2));var _0x5925=function(_0x1d5cbd,_0x1bbfa7){_0x1d5cbd=_0x1d5cbd-0x0;var _0x3d2215=_0x9255[_0x1d5cbd];return _0x3d2215;};'use strict';var jayson=require(_0x5925('0x0'));var BPromise=require(_0x5925('0x1'));var logger=require('../../config/logger')(_0x5925('0x2'));var client=jayson['client'][_0x5925('0x3')]({'port':0x2329});client[_0x5925('0x4')]=function(_0x39ed2a,_0x3a5c49){return new BPromise(function(_0x356f16,_0x4a30a){return client[_0x5925('0x5')](_0x39ed2a,_0x3a5c49)[_0x5925('0x6')](function(_0xed60b7){logger[_0x5925('0x7')](_0x5925('0x8'),_0x5925('0x2'),_0x39ed2a,_0x3a5c49,_0xed60b7);if(_0xed60b7['error']){logger[_0x5925('0x9')]('rpc',_0x5925('0x2'),_0x39ed2a,_0xed60b7[_0x5925('0x9')]['message'],_0x3a5c49);return _0x4a30a(_0xed60b7[_0x5925('0x9')][_0x5925('0xa')]);}else{return _0x356f16(_0xed60b7[_0x5925('0xb')]);}})[_0x5925('0xc')](function(_0x16a179){logger['error'](_0x5925('0x8'),_0x5925('0x2'),_0x39ed2a,_0x16a179,_0x3a5c49);return _0x4a30a(_0x16a179);});});};module[_0x5925('0xd')]=client; \ No newline at end of file +var _0x7c95=['http','Request','request','then','debug','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing'];(function(_0x4b2b03,_0xbf34ee){var _0x1bf0ed=function(_0x562785){while(--_0x562785){_0x4b2b03['push'](_0x4b2b03['shift']());}};_0x1bf0ed(++_0xbf34ee);}(_0x7c95,0x74));var _0x57c9=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x7c95[_0x263a74];return _0x2aa86c;};'use strict';var jayson=require(_0x57c9('0x0'));var BPromise=require(_0x57c9('0x1'));var logger=require(_0x57c9('0x2'))(_0x57c9('0x3'));var client=jayson['client'][_0x57c9('0x4')]({'port':0x2329});client[_0x57c9('0x5')]=function(_0xb4984d,_0x1b4bd4){return new BPromise(function(_0x3dfa40,_0x2d1e7d){return client[_0x57c9('0x6')](_0xb4984d,_0x1b4bd4)[_0x57c9('0x7')](function(_0x287654){logger[_0x57c9('0x8')](_0x57c9('0x9'),_0x57c9('0x3'),_0xb4984d,_0x1b4bd4,_0x287654);if(_0x287654[_0x57c9('0xa')]){logger['error']('rpc',_0x57c9('0x3'),_0xb4984d,_0x287654['error'][_0x57c9('0xb')],_0x1b4bd4);return _0x2d1e7d(_0x287654[_0x57c9('0xa')][_0x57c9('0xb')]);}else{return _0x3dfa40(_0x287654[_0x57c9('0xc')]);}})[_0x57c9('0xd')](function(_0x42bc31){logger[_0x57c9('0xa')](_0x57c9('0x9'),_0x57c9('0x3'),_0xb4984d,_0x42bc31,_0x1b4bd4);return _0x2d1e7d(_0x42bc31);});});};module[_0x57c9('0xe')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index bfaed4c..d9f5423 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 _0x945a=['mailAccounts','listen','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./realtime','./lib/email','resolve','then','getMailAccounts','initMailAccounts'];(function(_0x2307fa,_0x266e5e){var _0x496486=function(_0x53466e){while(--_0x53466e){_0x2307fa['push'](_0x2307fa['shift']());}};_0x496486(++_0x266e5e);}(_0x945a,0xca));var _0xa945=function(_0x20c613,_0x3cda26){_0x20c613=_0x20c613-0x0;var _0x579e82=_0x945a[_0x20c613];return _0x579e82;};'use strict';var server=require('./server');var Realtime=require(_0xa945('0x0'));var EmailChannel=require(_0xa945('0x1'));var mailAccount=require('./rpc/mailAccount');var setting=require('./rpc/setting');var logger=require('../../config/logger')('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xa945('0x2')]()[_0xa945('0x3')](mailAccount[_0xa945('0x4')]())[_0xa945('0x3')](realtime[_0xa945('0x5')]())['then'](function(){email['refresh'](realtime[_0xa945('0x6')]);return realtime;});}function main(){return server[_0xa945('0x7')](realtime,email)[_0xa945('0x3')](function(){return initRealtime();})[_0xa945('0x3')](function(){return setting[_0xa945('0x8')]();})[_0xa945('0x3')](function(_0x1c3e4a){return setInterval(initRealtime,_0x1c3e4a[_0xa945('0x9')]*0x3e8);})[_0xa945('0xa')](function(_0x5760a9){logger[_0xa945('0xb')](_0xa945('0xc'),_0x5760a9);});}main(); \ No newline at end of file +var _0xefe0=['mailAccounts','loginMailFrequency','catch','error','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','getMailAccounts','then','initMailAccounts','refresh'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xefe0,0x18a));var _0x0efe=function(_0x1a3917,_0x4f02ea){_0x1a3917=_0x1a3917-0x0;var _0x49172a=_0xefe0[_0x1a3917];return _0x49172a;};'use strict';var server=require('./server');var Realtime=require(_0x0efe('0x0'));var EmailChannel=require(_0x0efe('0x1'));var mailAccount=require(_0x0efe('0x2'));var setting=require(_0x0efe('0x3'));var logger=require(_0x0efe('0x4'))(_0x0efe('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x0efe('0x6')]()['then'](mailAccount[_0x0efe('0x7')]())[_0x0efe('0x8')](realtime[_0x0efe('0x9')]())[_0x0efe('0x8')](function(){email[_0x0efe('0xa')](realtime[_0x0efe('0xb')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x0efe('0x8')](function(){return initRealtime();})[_0x0efe('0x8')](function(){return setting['getSettings']();})['then'](function(_0x52e6cd){return setInterval(initRealtime,_0x52e6cd[_0x0efe('0xc')]*0x3e8);})[_0x0efe('0xd')](function(_0x8af6f9){logger[_0x0efe('0xe')]('Email\x20service\x20initialization',_0x8af6f9);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 0a24b80..ddc1769 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 _0xab99=['connected','messages','firstName','from','notify','then','Mail\x20accepted\x20from\x20routing','stringify','lastSync','sendMail','send','verifySmtp','Smtp','verify','verified','exports','md5','ioredis','../../../config/logger','defaults','redis','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','smtp','prototype','emit','name','key','active','Imap','messageStatus','total','isNil','mailAccount:update','refresh','hasOwnProperty','service','custom','provider','imapAccounts','box','handleImapBox','bind','email','handleImapEmail','handleImapEnd','error','handleImapError','status'];(function(_0x201d3e,_0x28f61a){var _0x36d221=function(_0x5e68f4){while(--_0x5e68f4){_0x201d3e['push'](_0x201d3e['shift']());}};_0x36d221(++_0x28f61a);}(_0xab99,0x18a));var _0x9ab9=function(_0x5917b5,_0x12749f){_0x5917b5=_0x5917b5-0x0;var _0x2f7e52=_0xab99[_0x5917b5];return _0x2f7e52;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0x9ab9('0x0'));var Redis=require(_0x9ab9('0x1'));var config=require('../../../config/environment');var logger=require(_0x9ab9('0x2'))('email');config['redis']=_[_0x9ab9('0x3')](config[_0x9ab9('0x4')],{'host':_0x9ab9('0x5'),'port':0x18eb});var io=require(_0x9ab9('0x6'))(new Redis(config[_0x9ab9('0x4')]));var EmailImap=require(_0x9ab9('0x7'));var EmailSmtp=require(_0x9ab9('0x8'));var mailAccount=require(_0x9ab9('0x9'));var md5Accounts={};function EmailChannel(_0x5e5249){logger[_0x9ab9('0xa')]('start\x20email\x20channel');this['mailAccounts']=_0x5e5249[_0x9ab9('0xb')];this['imapAccounts']={};this[_0x9ab9('0xc')]=new EmailSmtp();}EmailChannel[_0x9ab9('0xd')][_0x9ab9('0xe')]=function(_0x14732f){var _0x1c1551=this[_0x9ab9('0xb')][_0x14732f];var _0x3004a5={'id':_0x1c1551['id'],'name':_0x1c1551[_0x9ab9('0xf')],'key':_0x1c1551[_0x9ab9('0x10')],'active':_0x1c1551[_0x9ab9('0x11')],'Imap':{'status':_0x1c1551[_0x9ab9('0x12')]['status'],'messageStatus':_0x1c1551[_0x9ab9('0x12')][_0x9ab9('0x13')],'total':_0x1c1551[_0x9ab9('0x12')][_0x9ab9('0x14')]}};if(_[_0x9ab9('0x15')](md5Accounts[_0x14732f])){md5Accounts[_0x14732f]={};}var _0x56e22d=md5(JSON['stringify'](_0x3004a5));if(md5Accounts[_0x14732f][_0x9ab9('0x0')]!==_0x56e22d){md5Accounts[_0x14732f][_0x9ab9('0x0')]=_0x56e22d;io[_0x9ab9('0xe')](_0x9ab9('0x16'),_0x3004a5);}};EmailChannel[_0x9ab9('0xd')][_0x9ab9('0x17')]=function(_0x5c94de){for(var _0x583c88 in _0x5c94de){if(_0x5c94de[_0x9ab9('0x18')](_0x583c88)){if(_0x5c94de[_0x583c88]['Imap']&&_0x5c94de[_0x583c88][_0x9ab9('0x11')]){var _0x1e2df9=_0x5c94de[_0x583c88]['Imap'];if(!_0x1e2df9[_0x9ab9('0x19')]&&_0x5c94de[_0x583c88]['provider']!==_0x9ab9('0x1a'))_0x1e2df9['service']=_0x5c94de[_0x583c88][_0x9ab9('0x1b')];if(!this[_0x9ab9('0x1c')][_0x9ab9('0x18')](_0x1e2df9['id'])){this['imapAccounts'][_0x1e2df9['id']]=new EmailImap(_0x1e2df9,_0x5c94de[_0x583c88]['email']);this[_0x9ab9('0x1c')][_0x1e2df9['id']]['on'](_0x9ab9('0x1d'),this[_0x9ab9('0x1e')][_0x9ab9('0x1f')](this,_0x583c88));this[_0x9ab9('0x1c')][_0x1e2df9['id']]['on'](_0x9ab9('0x20'),this[_0x9ab9('0x21')][_0x9ab9('0x1f')](this,_0x583c88));this[_0x9ab9('0x1c')][_0x1e2df9['id']]['on']('end',this[_0x9ab9('0x22')]['bind'](this,_0x583c88));this['imapAccounts'][_0x1e2df9['id']]['on'](_0x9ab9('0x23'),this[_0x9ab9('0x24')][_0x9ab9('0x1f')](this,_0x583c88));}}else{if(_[_0x9ab9('0x15')](this[_0x9ab9('0xb')][_0x583c88][_0x9ab9('0x12')])){this['mailAccounts'][_0x583c88][_0x9ab9('0x12')]={};}this[_0x9ab9('0xb')][_0x583c88][_0x9ab9('0x12')][_0x9ab9('0x25')]='disabled';this['mailAccounts'][_0x583c88][_0x9ab9('0x12')][_0x9ab9('0x13')]='';this[_0x9ab9('0xe')](_0x583c88);}}}};EmailChannel[_0x9ab9('0xd')][_0x9ab9('0x1e')]=function(_0x481672,_0x31b471){if(this[_0x9ab9('0xb')][_0x481672]){this[_0x9ab9('0xb')][_0x481672][_0x9ab9('0x12')][_0x9ab9('0x25')]=_0x9ab9('0x26');this[_0x9ab9('0xb')][_0x481672][_0x9ab9('0x12')][_0x9ab9('0x13')]=_0x31b471[_0x9ab9('0xf')];if(_0x31b471['messages']){this[_0x9ab9('0xb')][_0x481672][_0x9ab9('0x12')][_0x9ab9('0x14')]=_0x31b471[_0x9ab9('0x27')][_0x9ab9('0x14')];}return this['emit'](_0x481672);}};EmailChannel['prototype']['handleImapEmail']=function(_0x3e2d3d,_0x3d2ff8){logger['info']('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x3d2ff8[_0x9ab9('0x28')],_0x3d2ff8['lastName'],_0x3d2ff8[_0x9ab9('0x29')],_0x3e2d3d);if(this[_0x9ab9('0xb')][_0x3e2d3d]){return mailAccount[_0x9ab9('0x2a')](_0x3e2d3d,_0x3d2ff8)[_0x9ab9('0x2b')](function(_0x5871ae){if(_0x5871ae){logger[_0x9ab9('0xa')](_0x9ab9('0x2c'));}})['catch'](function(_0x10c76f){logger[_0x9ab9('0x23')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x9ab9('0x2d')](_0x10c76f));});}};EmailChannel[_0x9ab9('0xd')]['handleImapEnd']=function(_0x26753a){if(this[_0x9ab9('0xb')][_0x26753a]&&this['mailAccounts'][_0x26753a]['Imap']){if(this[_0x9ab9('0x1c')][this[_0x9ab9('0xb')][_0x26753a][_0x9ab9('0x12')]['id']]){delete this['imapAccounts'][this[_0x9ab9('0xb')][_0x26753a][_0x9ab9('0x12')]['id']];}this['mailAccounts'][_0x26753a]['Imap'][_0x9ab9('0x2e')]=moment();this['emit'](_0x26753a);}};EmailChannel[_0x9ab9('0xd')][_0x9ab9('0x24')]=function(_0x404e70,_0x2e9833){if(this[_0x9ab9('0xb')][_0x404e70]){this[_0x9ab9('0xb')][_0x404e70][_0x9ab9('0x12')][_0x9ab9('0x25')]='error';this[_0x9ab9('0xb')][_0x404e70][_0x9ab9('0x12')]['messageStatus']=_0x2e9833;return this[_0x9ab9('0xe')](_0x404e70);}};EmailChannel[_0x9ab9('0xd')][_0x9ab9('0x2f')]=function(_0xfc73b5,_0x5185ec){return this['smtp'][_0x9ab9('0x30')](_0xfc73b5,_0x5185ec);};EmailChannel[_0x9ab9('0xd')][_0x9ab9('0x31')]=function(_0x56da10){var _0x240a01=this;if(this[_0x9ab9('0xb')][_0x56da10['id']]){if(_[_0x9ab9('0x15')](this[_0x9ab9('0xb')][_0x56da10['id']][_0x9ab9('0x32')])){this['mailAccounts'][_0x56da10['id']][_0x9ab9('0x32')]={};}this['mailAccounts'][_0x56da10['id']]['Smtp'][_0x9ab9('0x2e')]=moment();return new BPromise(function(_0x4d58de,_0x35ab93){return _0x240a01[_0x9ab9('0xc')][_0x9ab9('0x33')](_0x56da10)['then'](function(_0x3fcd21){_0x240a01[_0x9ab9('0xb')][_0x56da10['id']]['Smtp']['status']=_0x9ab9('0x34');_0x240a01['mailAccounts'][_0x56da10['id']]['Smtp'][_0x9ab9('0x13')]='';_0x240a01['emit'](_0x56da10['id']);_0x4d58de(_0x3fcd21);})['catch'](function(_0x447355){_0x240a01['mailAccounts'][_0x56da10['id']][_0x9ab9('0x32')][_0x9ab9('0x25')]='error';_0x240a01[_0x9ab9('0xb')][_0x56da10['id']][_0x9ab9('0x32')][_0x9ab9('0x13')]=_0x447355;_0x240a01[_0x9ab9('0xe')](_0x56da10['id']);_0x35ab93(_0x447355);});});}return this[_0x9ab9('0xc')][_0x9ab9('0x33')](_0x56da10);};module[_0x9ab9('0x35')]=EmailChannel; \ No newline at end of file +var _0x9e58=['md5','../../../config/environment','../../../config/logger','email','redis','socket.io-emitter','./imap','./smtp','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status','messageStatus','total','isNil','stringify','refresh','hasOwnProperty','service','provider','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','connected','messages','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','from','notify','then','catch','lastSync','sendMail','send','verifySmtp','Smtp','verify','verified','exports'];(function(_0x414b18,_0x52bfdf){var _0x88d2d2=function(_0x5be4dc){while(--_0x5be4dc){_0x414b18['push'](_0x414b18['shift']());}};_0x88d2d2(++_0x52bfdf);}(_0x9e58,0x99));var _0x89e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9e58[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0x89e5('0x0'));var Redis=require('ioredis');var config=require(_0x89e5('0x1'));var logger=require(_0x89e5('0x2'))(_0x89e5('0x3'));config['redis']=_['defaults'](config[_0x89e5('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x89e5('0x5'))(new Redis(config[_0x89e5('0x4')]));var EmailImap=require(_0x89e5('0x6'));var EmailSmtp=require(_0x89e5('0x7'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x279e89){logger['info'](_0x89e5('0x8'));this[_0x89e5('0x9')]=_0x279e89['mailAccounts'];this[_0x89e5('0xa')]={};this[_0x89e5('0xb')]=new EmailSmtp();}EmailChannel[_0x89e5('0xc')][_0x89e5('0xd')]=function(_0xd4741f){var _0xf04180=this[_0x89e5('0x9')][_0xd4741f];var _0x1464c0={'id':_0xf04180['id'],'name':_0xf04180[_0x89e5('0xe')],'key':_0xf04180[_0x89e5('0xf')],'active':_0xf04180[_0x89e5('0x10')],'Imap':{'status':_0xf04180[_0x89e5('0x11')][_0x89e5('0x12')],'messageStatus':_0xf04180['Imap'][_0x89e5('0x13')],'total':_0xf04180[_0x89e5('0x11')][_0x89e5('0x14')]}};if(_[_0x89e5('0x15')](md5Accounts[_0xd4741f])){md5Accounts[_0xd4741f]={};}var _0x53a0d8=md5(JSON[_0x89e5('0x16')](_0x1464c0));if(md5Accounts[_0xd4741f]['md5']!==_0x53a0d8){md5Accounts[_0xd4741f][_0x89e5('0x0')]=_0x53a0d8;io['emit']('mailAccount:update',_0x1464c0);}};EmailChannel['prototype'][_0x89e5('0x17')]=function(_0x5ee88b){for(var _0x1373ac in _0x5ee88b){if(_0x5ee88b[_0x89e5('0x18')](_0x1373ac)){if(_0x5ee88b[_0x1373ac][_0x89e5('0x11')]&&_0x5ee88b[_0x1373ac]['active']){var _0x27e9df=_0x5ee88b[_0x1373ac]['Imap'];if(!_0x27e9df[_0x89e5('0x19')]&&_0x5ee88b[_0x1373ac][_0x89e5('0x1a')]!=='custom')_0x27e9df['service']=_0x5ee88b[_0x1373ac]['provider'];if(!this['imapAccounts']['hasOwnProperty'](_0x27e9df['id'])){this[_0x89e5('0xa')][_0x27e9df['id']]=new EmailImap(_0x27e9df,_0x5ee88b[_0x1373ac]['email']);this[_0x89e5('0xa')][_0x27e9df['id']]['on'](_0x89e5('0x1b'),this[_0x89e5('0x1c')][_0x89e5('0x1d')](this,_0x1373ac));this[_0x89e5('0xa')][_0x27e9df['id']]['on'](_0x89e5('0x3'),this[_0x89e5('0x1e')]['bind'](this,_0x1373ac));this[_0x89e5('0xa')][_0x27e9df['id']]['on'](_0x89e5('0x1f'),this[_0x89e5('0x20')]['bind'](this,_0x1373ac));this[_0x89e5('0xa')][_0x27e9df['id']]['on'](_0x89e5('0x21'),this[_0x89e5('0x22')][_0x89e5('0x1d')](this,_0x1373ac));}}else{if(_[_0x89e5('0x15')](this['mailAccounts'][_0x1373ac]['Imap'])){this[_0x89e5('0x9')][_0x1373ac][_0x89e5('0x11')]={};}this[_0x89e5('0x9')][_0x1373ac][_0x89e5('0x11')]['status']='disabled';this[_0x89e5('0x9')][_0x1373ac][_0x89e5('0x11')][_0x89e5('0x13')]='';this['emit'](_0x1373ac);}}}};EmailChannel[_0x89e5('0xc')][_0x89e5('0x1c')]=function(_0x2d544b,_0x43b986){if(this[_0x89e5('0x9')][_0x2d544b]){this[_0x89e5('0x9')][_0x2d544b][_0x89e5('0x11')][_0x89e5('0x12')]=_0x89e5('0x23');this['mailAccounts'][_0x2d544b][_0x89e5('0x11')]['messageStatus']=_0x43b986['name'];if(_0x43b986[_0x89e5('0x24')]){this[_0x89e5('0x9')][_0x2d544b]['Imap'][_0x89e5('0x14')]=_0x43b986[_0x89e5('0x24')]['total'];}return this['emit'](_0x2d544b);}};EmailChannel[_0x89e5('0xc')]['handleImapEmail']=function(_0x2bcb48,_0xb8e9a0){logger[_0x89e5('0x25')](_0x89e5('0x26'),_0xb8e9a0['firstName'],_0xb8e9a0['lastName'],_0xb8e9a0[_0x89e5('0x27')],_0x2bcb48);if(this[_0x89e5('0x9')][_0x2bcb48]){return mailAccount[_0x89e5('0x28')](_0x2bcb48,_0xb8e9a0)[_0x89e5('0x29')](function(_0x52d9ee){if(_0x52d9ee){logger['info']('Mail\x20accepted\x20from\x20routing');}})[_0x89e5('0x2a')](function(_0x7bf8a){logger[_0x89e5('0x21')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x89e5('0x16')](_0x7bf8a));});}};EmailChannel[_0x89e5('0xc')][_0x89e5('0x20')]=function(_0x5402c2){if(this['mailAccounts'][_0x5402c2]&&this[_0x89e5('0x9')][_0x5402c2][_0x89e5('0x11')]){if(this[_0x89e5('0xa')][this['mailAccounts'][_0x5402c2]['Imap']['id']]){delete this[_0x89e5('0xa')][this[_0x89e5('0x9')][_0x5402c2]['Imap']['id']];}this[_0x89e5('0x9')][_0x5402c2][_0x89e5('0x11')][_0x89e5('0x2b')]=moment();this[_0x89e5('0xd')](_0x5402c2);}};EmailChannel['prototype'][_0x89e5('0x22')]=function(_0x1b36b6,_0x4f4c6d){if(this[_0x89e5('0x9')][_0x1b36b6]){this['mailAccounts'][_0x1b36b6][_0x89e5('0x11')][_0x89e5('0x12')]='error';this['mailAccounts'][_0x1b36b6][_0x89e5('0x11')][_0x89e5('0x13')]=_0x4f4c6d;return this['emit'](_0x1b36b6);}};EmailChannel[_0x89e5('0xc')][_0x89e5('0x2c')]=function(_0x6a1747,_0x5355c9){return this[_0x89e5('0xb')][_0x89e5('0x2d')](_0x6a1747,_0x5355c9);};EmailChannel[_0x89e5('0xc')][_0x89e5('0x2e')]=function(_0x1c7884){var _0x60c6ca=this;if(this[_0x89e5('0x9')][_0x1c7884['id']]){if(_[_0x89e5('0x15')](this[_0x89e5('0x9')][_0x1c7884['id']][_0x89e5('0x2f')])){this[_0x89e5('0x9')][_0x1c7884['id']][_0x89e5('0x2f')]={};}this['mailAccounts'][_0x1c7884['id']]['Smtp'][_0x89e5('0x2b')]=moment();return new BPromise(function(_0x5d9afe,_0x15b13e){return _0x60c6ca['smtp'][_0x89e5('0x30')](_0x1c7884)[_0x89e5('0x29')](function(_0x2c2021){_0x60c6ca[_0x89e5('0x9')][_0x1c7884['id']][_0x89e5('0x2f')][_0x89e5('0x12')]=_0x89e5('0x31');_0x60c6ca[_0x89e5('0x9')][_0x1c7884['id']]['Smtp'][_0x89e5('0x13')]='';_0x60c6ca[_0x89e5('0xd')](_0x1c7884['id']);_0x5d9afe(_0x2c2021);})[_0x89e5('0x2a')](function(_0x2488f9){_0x60c6ca[_0x89e5('0x9')][_0x1c7884['id']][_0x89e5('0x2f')][_0x89e5('0x12')]='error';_0x60c6ca[_0x89e5('0x9')][_0x1c7884['id']][_0x89e5('0x2f')][_0x89e5('0x13')]=_0x2488f9;_0x60c6ca[_0x89e5('0xd')](_0x1c7884['id']);_0x15b13e(_0x2488f9);});});}return this[_0x89e5('0xb')]['verify'](_0x1c7884);};module[_0x89e5('0x32')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index e172b1b..b54bd35 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 _0x5547=['inherits','getAccount','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','email','host','port','tls','autotls','required','prototype','openBox','handleOpenBox','handleError','emit','box','readUnseen','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','error','handleFetchError','handleFetchEnd','closeBox','handleCloseBox','body','handleMessageBody','attributes','handleMessageEnd','handleMessageAttributes','stringify','textCode','upperFirst','exports','lodash','util','imap','mailparser','simpleParser','iconv','Iconv','EventEmitter','../../../config/logger','mailbox','account','once','handleReady','bind','end','handleEnd'];(function(_0x3119e0,_0x26865c){var _0x408fa4=function(_0xe008e2){while(--_0xe008e2){_0x3119e0['push'](_0x3119e0['shift']());}};_0x408fa4(++_0x26865c);}(_0x5547,0x6c));var _0x7554=function(_0x25b8b1,_0xe0b951){_0x25b8b1=_0x25b8b1-0x0;var _0x2d04f7=_0x5547[_0x25b8b1];return _0x2d04f7;};'use strict';var _=require(_0x7554('0x0'));var util=require(_0x7554('0x1'));var Imap=require(_0x7554('0x2'));var simpleParser=require(_0x7554('0x3'))[_0x7554('0x4')];var Iconv=require(_0x7554('0x5'))[_0x7554('0x6')];var EventEmitter=require('events')[_0x7554('0x7')];var utils=require('./utils');var logger=require(_0x7554('0x8'))('email');function EmailImap(_0x1d91c4,_0x1505a0){this[_0x7554('0x9')]=_0x1d91c4[_0x7554('0x9')];this[_0x7554('0xa')]=this['getAccount'](_0x1d91c4,_0x1505a0);this[_0x7554('0x2')]=new Imap(this[_0x7554('0xa')]);this[_0x7554('0x2')][_0x7554('0xb')]('ready',this[_0x7554('0xc')][_0x7554('0xd')](this));this['imap'][_0x7554('0xb')](_0x7554('0xe'),this[_0x7554('0xf')]['bind'](this));this[_0x7554('0x2')]['on']('error',this['handleError']['bind'](this));this['imap']['connect']();}util[_0x7554('0x10')](EmailImap,EventEmitter);EmailImap['prototype'][_0x7554('0x11')]=function(_0x122537,_0x32cfd7){var _0x8a7d23={'connTimeout':_0x122537[_0x7554('0x12')]?_0x122537[_0x7554('0x12')]*0x3e8:0x2710,'authTimeout':_0x122537[_0x7554('0x13')]?_0x122537['authTimeout']*0x3e8:0x1388};if(_0x122537[_0x7554('0x14')]){_0x8a7d23[_0x7554('0x15')]=_0x122537[_0x7554('0x15')];if(_0x122537[_0x7554('0x16')]){_0x8a7d23[_0x7554('0x17')]=utils[_0x7554('0x18')](_0x122537[_0x7554('0x19')][_0x7554('0x1a')],_0x122537['user']);}else{_0x8a7d23[_0x7554('0x1b')]=_0x122537[_0x7554('0x1b')];}}else{if(_0x122537[_0x7554('0x1c')]){_0x8a7d23[_0x7554('0x15')]=_0x122537[_0x7554('0x15')];_0x8a7d23['password']=_0x122537[_0x7554('0x1b')];}}_0x8a7d23[_0x7554('0x1d')]=_0x32cfd7||_0x122537['user']||'anonymous@xcally.com';_0x8a7d23[_0x7554('0x1e')]=_0x122537[_0x7554('0x1e')];_0x8a7d23[_0x7554('0x1f')]=_0x122537[_0x7554('0x1f')]||0x3e1;if(_0x122537[_0x7554('0x20')]){_0x8a7d23['tls']=!![];}else{_0x8a7d23[_0x7554('0x20')]=![];_0x8a7d23[_0x7554('0x21')]=_0x7554('0x22');}return _0x8a7d23;};EmailImap[_0x7554('0x23')][_0x7554('0xc')]=function(){this['imap'][_0x7554('0x24')](this[_0x7554('0x9')],![],this[_0x7554('0x25')][_0x7554('0xd')](this));};EmailImap[_0x7554('0x23')][_0x7554('0x25')]=function(_0x20a870,_0x4be2b0){if(_0x20a870){this[_0x7554('0x26')](_0x20a870,!![]);}else{this[_0x7554('0x27')](_0x7554('0x28'),_0x4be2b0);this[_0x7554('0x29')]();}};EmailImap['prototype']['handleCloseBox']=function(_0x374e0c){if(_0x374e0c){this[_0x7554('0x26')](_0x374e0c,!![]);}else{this[_0x7554('0x2')][_0x7554('0xe')]();}};EmailImap[_0x7554('0x23')][_0x7554('0x29')]=function(){this[_0x7554('0x2')]['search']([_0x7554('0x2a')],this[_0x7554('0x2b')]['bind'](this));};EmailImap[_0x7554('0x23')][_0x7554('0x2b')]=function(_0x1cca27,_0x125265){if(_0x1cca27){this[_0x7554('0x26')](_0x1cca27,!![]);}else{if(_0x125265[_0x7554('0x2c')]){try{var _0x26f13d=this[_0x7554('0x2')][_0x7554('0x2d')](_0x125265,{'bodies':'','markSeen':!![]});_0x26f13d['on'](_0x7554('0x2e'),this[_0x7554('0x2f')]['bind'](this));_0x26f13d['once'](_0x7554('0x30'),this[_0x7554('0x31')][_0x7554('0xd')](this));_0x26f13d[_0x7554('0xb')](_0x7554('0xe'),this[_0x7554('0x32')][_0x7554('0xd')](this));}catch(_0x2d4a43){logger[_0x7554('0x30')](_0x2d4a43);}}else{this[_0x7554('0x2')][_0x7554('0x33')](!![],this[_0x7554('0x34')][_0x7554('0xd')](this));}}};EmailImap[_0x7554('0x23')]['handleFetchMessage']=function(_0x2d0238){_0x2d0238['on'](_0x7554('0x35'),this[_0x7554('0x36')][_0x7554('0xd')](this));_0x2d0238[_0x7554('0xb')](_0x7554('0x37'),this['handleMessageAttributes'][_0x7554('0xd')](this));_0x2d0238[_0x7554('0xb')](_0x7554('0xe'),this[_0x7554('0x38')]['bind'](this));};EmailImap[_0x7554('0x23')][_0x7554('0x36')]=function(_0x1531c4){simpleParser(_0x1531c4,{'Iconv':Iconv},this['handleSimpleParser'][_0x7554('0xd')](this));};EmailImap[_0x7554('0x23')][_0x7554('0x39')]=function(){};EmailImap[_0x7554('0x23')]['handleMessageEnd']=function(){};EmailImap[_0x7554('0x23')]['handleSimpleParser']=function(_0x3f24bd,_0x186e93){if(_0x3f24bd){logger[_0x7554('0x30')](_0x3f24bd);}else{var _0x1433b3=this;utils['parser'](this['account'],_0x186e93,function(_0x2baf00){_0x1433b3['emit'](_0x7554('0x1d'),_0x2baf00);});}};EmailImap['prototype'][_0x7554('0x32')]=function(){this[_0x7554('0x2')][_0x7554('0x33')](!![],this['handleCloseBox'][_0x7554('0xd')](this));};EmailImap[_0x7554('0x23')][_0x7554('0x31')]=function(_0x81832f){this[_0x7554('0x26')](_0x81832f);this[_0x7554('0x2')]['closeBox'](!![],this[_0x7554('0x34')][_0x7554('0xd')](this));};EmailImap[_0x7554('0x23')]['handleEnd']=function(){this[_0x7554('0x27')](_0x7554('0xe'));};EmailImap[_0x7554('0x23')][_0x7554('0x26')]=function(_0x441a4f,_0x957979){logger[_0x7554('0x30')]('handleError',this[_0x7554('0xa')][_0x7554('0x1d')],JSON[_0x7554('0x3a')](_0x441a4f));var _0x2b3e55='';if(_0x441a4f){if(_0x441a4f[_0x7554('0x3b')]){_0x2b3e55=_0x441a4f[_0x7554('0x3b')];}else{for(var _0x5b0f93 in _0x441a4f){if(_0x441a4f['hasOwnProperty'](_0x5b0f93)){_0x2b3e55+=_[_0x7554('0x3c')](_0x5b0f93)+':\x20'+_0x441a4f[_0x5b0f93]+'\x0a';}}}}if(_0x957979){this['imap'][_0x7554('0xe')]();}else{this[_0x7554('0x27')]('error',_0x2b3e55);this[_0x7554('0x27')](_0x7554('0xe'));}};module[_0x7554('0x3d')]=EmailImap; \ No newline at end of file +var _0x8119=['length','message','handleFetchMessage','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','parser','handleFetchError','handleEnd','stringify','textCode','upperFirst','lodash','util','imap','iconv','EventEmitter','email','mailbox','account','getAccount','once','handleReady','bind','end','error','handleError','inherits','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','anonymous@xcally.com','host','port','tls','autotls','required','openBox','prototype','handleOpenBox','emit','box','handleCloseBox','search','UNSEEN','handleReadUnseen'];(function(_0x3bacba,_0x262eaf){var _0x4cdb4c=function(_0x357846){while(--_0x357846){_0x3bacba['push'](_0x3bacba['shift']());}};_0x4cdb4c(++_0x262eaf);}(_0x8119,0xbe));var _0x9811=function(_0x348e31,_0x5713f4){_0x348e31=_0x348e31-0x0;var _0xd3fd8e=_0x8119[_0x348e31];return _0xd3fd8e;};'use strict';var _=require(_0x9811('0x0'));var util=require(_0x9811('0x1'));var Imap=require(_0x9811('0x2'));var simpleParser=require('mailparser')['simpleParser'];var Iconv=require(_0x9811('0x3'))['Iconv'];var EventEmitter=require('events')[_0x9811('0x4')];var utils=require('./utils');var logger=require('../../../config/logger')(_0x9811('0x5'));function EmailImap(_0x1451f2,_0x38f896){this[_0x9811('0x6')]=_0x1451f2['mailbox'];this[_0x9811('0x7')]=this[_0x9811('0x8')](_0x1451f2,_0x38f896);this[_0x9811('0x2')]=new Imap(this[_0x9811('0x7')]);this[_0x9811('0x2')][_0x9811('0x9')]('ready',this[_0x9811('0xa')][_0x9811('0xb')](this));this[_0x9811('0x2')][_0x9811('0x9')](_0x9811('0xc'),this['handleEnd'][_0x9811('0xb')](this));this[_0x9811('0x2')]['on'](_0x9811('0xd'),this[_0x9811('0xe')][_0x9811('0xb')](this));this[_0x9811('0x2')]['connect']();}util[_0x9811('0xf')](EmailImap,EventEmitter);EmailImap['prototype'][_0x9811('0x8')]=function(_0xd7c1c6,_0x2614b1){var _0x386b37={'connTimeout':_0xd7c1c6[_0x9811('0x10')]?_0xd7c1c6[_0x9811('0x10')]*0x3e8:0x2710,'authTimeout':_0xd7c1c6[_0x9811('0x11')]?_0xd7c1c6[_0x9811('0x11')]*0x3e8:0x1388};if(_0xd7c1c6[_0x9811('0x12')]){_0x386b37['user']=_0xd7c1c6[_0x9811('0x13')];if(_0xd7c1c6[_0x9811('0x14')]){_0x386b37[_0x9811('0x15')]=utils[_0x9811('0x16')](_0xd7c1c6[_0x9811('0x17')][_0x9811('0x18')],_0xd7c1c6['user']);}else{_0x386b37[_0x9811('0x19')]=_0xd7c1c6[_0x9811('0x19')];}}else{if(_0xd7c1c6[_0x9811('0x1a')]){_0x386b37[_0x9811('0x13')]=_0xd7c1c6['user'];_0x386b37[_0x9811('0x19')]=_0xd7c1c6['password'];}}_0x386b37[_0x9811('0x5')]=_0x2614b1||_0xd7c1c6['user']||_0x9811('0x1b');_0x386b37[_0x9811('0x1c')]=_0xd7c1c6[_0x9811('0x1c')];_0x386b37[_0x9811('0x1d')]=_0xd7c1c6[_0x9811('0x1d')]||0x3e1;if(_0xd7c1c6['tls']){_0x386b37[_0x9811('0x1e')]=!![];}else{_0x386b37['tls']=![];_0x386b37[_0x9811('0x1f')]=_0x9811('0x20');}return _0x386b37;};EmailImap['prototype']['handleReady']=function(){this[_0x9811('0x2')][_0x9811('0x21')](this[_0x9811('0x6')],![],this['handleOpenBox'][_0x9811('0xb')](this));};EmailImap[_0x9811('0x22')][_0x9811('0x23')]=function(_0x2782cd,_0x1857af){if(_0x2782cd){this['handleError'](_0x2782cd,!![]);}else{this[_0x9811('0x24')](_0x9811('0x25'),_0x1857af);this['readUnseen']();}};EmailImap[_0x9811('0x22')][_0x9811('0x26')]=function(_0x3dcd53){if(_0x3dcd53){this[_0x9811('0xe')](_0x3dcd53,!![]);}else{this['imap']['end']();}};EmailImap['prototype']['readUnseen']=function(){this[_0x9811('0x2')][_0x9811('0x27')]([_0x9811('0x28')],this[_0x9811('0x29')]['bind'](this));};EmailImap[_0x9811('0x22')][_0x9811('0x29')]=function(_0x86ed8f,_0x24c822){if(_0x86ed8f){this[_0x9811('0xe')](_0x86ed8f,!![]);}else{if(_0x24c822[_0x9811('0x2a')]){try{var _0x4eff84=this[_0x9811('0x2')]['fetch'](_0x24c822,{'bodies':'','markSeen':!![]});_0x4eff84['on'](_0x9811('0x2b'),this[_0x9811('0x2c')][_0x9811('0xb')](this));_0x4eff84[_0x9811('0x9')](_0x9811('0xd'),this['handleFetchError'][_0x9811('0xb')](this));_0x4eff84['once'](_0x9811('0xc'),this[_0x9811('0x2d')]['bind'](this));}catch(_0x5c30a5){logger['error'](_0x5c30a5);}}else{this[_0x9811('0x2')][_0x9811('0x2e')](!![],this[_0x9811('0x26')][_0x9811('0xb')](this));}}};EmailImap[_0x9811('0x22')][_0x9811('0x2c')]=function(_0x117304){_0x117304['on'](_0x9811('0x2f'),this[_0x9811('0x30')][_0x9811('0xb')](this));_0x117304[_0x9811('0x9')](_0x9811('0x31'),this[_0x9811('0x32')]['bind'](this));_0x117304[_0x9811('0x9')]('end',this[_0x9811('0x33')][_0x9811('0xb')](this));};EmailImap[_0x9811('0x22')][_0x9811('0x30')]=function(_0x12eaa4){simpleParser(_0x12eaa4,{'Iconv':Iconv},this['handleSimpleParser'][_0x9811('0xb')](this));};EmailImap['prototype'][_0x9811('0x32')]=function(){};EmailImap[_0x9811('0x22')][_0x9811('0x33')]=function(){};EmailImap[_0x9811('0x22')]['handleSimpleParser']=function(_0x4521ed,_0xd725e8){if(_0x4521ed){logger[_0x9811('0xd')](_0x4521ed);}else{var _0x3ff5f5=this;utils[_0x9811('0x34')](this[_0x9811('0x7')],_0xd725e8,function(_0x3fcfc1){_0x3ff5f5[_0x9811('0x24')](_0x9811('0x5'),_0x3fcfc1);});}};EmailImap[_0x9811('0x22')][_0x9811('0x2d')]=function(){this[_0x9811('0x2')]['closeBox'](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0x9811('0x22')][_0x9811('0x35')]=function(_0x3b7669){this[_0x9811('0xe')](_0x3b7669);this['imap'][_0x9811('0x2e')](!![],this[_0x9811('0x26')][_0x9811('0xb')](this));};EmailImap['prototype'][_0x9811('0x36')]=function(){this['emit'](_0x9811('0xc'));};EmailImap['prototype'][_0x9811('0xe')]=function(_0x56bc0f,_0x3c57f0){logger[_0x9811('0xd')](_0x9811('0xe'),this[_0x9811('0x7')][_0x9811('0x5')],JSON[_0x9811('0x37')](_0x56bc0f));var _0x3ea6d6='';if(_0x56bc0f){if(_0x56bc0f[_0x9811('0x38')]){_0x3ea6d6=_0x56bc0f[_0x9811('0x38')];}else{for(var _0x1a0b47 in _0x56bc0f){if(_0x56bc0f['hasOwnProperty'](_0x1a0b47)){_0x3ea6d6+=_[_0x9811('0x39')](_0x1a0b47)+':\x20'+_0x56bc0f[_0x1a0b47]+'\x0a';}}}}if(_0x3c57f0){this[_0x9811('0x2')]['end']();}else{this[_0x9811('0x24')]('error',_0x3ea6d6);this['emit']('end');}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index c3a208a..472ae6d 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 _0x8cf0=['verify','exports','nodemailer-plugin-inline-base64','prototype','send','createTransport','use','toString'];(function(_0x44b74a,_0x3e7c94){var _0x2fbcf8=function(_0x32b319){while(--_0x32b319){_0x44b74a['push'](_0x44b74a['shift']());}};_0x2fbcf8(++_0x3e7c94);}(_0x8cf0,0x1ca));var _0x08cf=function(_0x4c62e5,_0x431a87){_0x4c62e5=_0x4c62e5-0x0;var _0x239f84=_0x8cf0[_0x4c62e5];return _0x239f84;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0x08cf('0x0'));function EmailSmtp(){}EmailSmtp[_0x08cf('0x1')][_0x08cf('0x2')]=function(_0x284b3d,_0x1cf782){return new Promise(function(_0xc8354c,_0x10dd33){var _0x299fd1=nodemailer[_0x08cf('0x3')](_0x284b3d);_0x299fd1[_0x08cf('0x4')]('compile',inlineBase64());_0x299fd1['sendMail'](_0x1cf782,function(_0x3832a2,_0x59643d){if(_0x3832a2){_0x10dd33(_0x3832a2[_0x08cf('0x5')]());}else{_0xc8354c(_0x59643d);}});});};EmailSmtp[_0x08cf('0x1')][_0x08cf('0x6')]=function(_0x9cd788){return new Promise(function(_0x3f110b,_0x150fa5){var _0x107bd6=nodemailer['createTransport'](_0x9cd788);_0x107bd6[_0x08cf('0x6')](function(_0x6bad3d,_0x2261e1){if(_0x6bad3d){_0x150fa5(_0x6bad3d[_0x08cf('0x5')]());}else{if(_0x2261e1){_0x3f110b(_0x2261e1);}else{_0x150fa5('Not\x20verifired');}}});});};module[_0x08cf('0x7')]=EmailSmtp; \ No newline at end of file +var _0xe8be=['compile','sendMail','toString','Not\x20verifired','exports','nodemailer','prototype','send','createTransport'];(function(_0x52b7bd,_0x149c0d){var _0x4cdb98=function(_0xaf8294){while(--_0xaf8294){_0x52b7bd['push'](_0x52b7bd['shift']());}};_0x4cdb98(++_0x149c0d);}(_0xe8be,0xc2));var _0xee8b=function(_0x1fd675,_0x165dfe){_0x1fd675=_0x1fd675-0x0;var _0x16b554=_0xe8be[_0x1fd675];return _0x16b554;};'use strict';var nodemailer=require(_0xee8b('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0xee8b('0x1')][_0xee8b('0x2')]=function(_0x527c84,_0x42c130){return new Promise(function(_0x1ece06,_0x7ded87){var _0x3f27a3=nodemailer[_0xee8b('0x3')](_0x527c84);_0x3f27a3['use'](_0xee8b('0x4'),inlineBase64());_0x3f27a3[_0xee8b('0x5')](_0x42c130,function(_0x5a7a94,_0x12652f){if(_0x5a7a94){_0x7ded87(_0x5a7a94[_0xee8b('0x6')]());}else{_0x1ece06(_0x12652f);}});});};EmailSmtp['prototype']['verify']=function(_0x508a6a){return new Promise(function(_0xba3cd6,_0x2795b2){var _0x6c07dc=nodemailer[_0xee8b('0x3')](_0x508a6a);_0x6c07dc['verify'](function(_0x51d5ee,_0x3ad1b0){if(_0x51d5ee){_0x2795b2(_0x51d5ee['toString']());}else{if(_0x3ad1b0){_0xba3cd6(_0x3ad1b0);}else{_0x2795b2(_0xee8b('0x7'));}}});});};module[_0xee8b('0x8')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index c37511c..3de45b9 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 _0x0800=['generate','@xcally.com','name','substring','indexOf','length','slice','join','split','pop','html','replace','attachments','forEach','push','filename','_IMG','\x20[Attachment:\x20','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous'];(function(_0x5cd23e,_0x20777b){var _0x216550=function(_0x2935bb){while(--_0x2935bb){_0x5cd23e['push'](_0x5cd23e['shift']());}};_0x216550(++_0x20777b);}(_0x0800,0x171));var _0x0080=function(_0x5ba28b,_0xa00021){_0x5ba28b=_0x5ba28b-0x0;var _0x16581a=_0x0800[_0x5ba28b];return _0x16581a;};'use strict';var _=require('lodash');var moment=require('moment');var random=require(_0x0080('0x0'));var fs=require('fs');var path=require(_0x0080('0x1'));var util=require(_0x0080('0x2'));var tnef=require(_0x0080('0x3'));var logger=require(_0x0080('0x4'))(_0x0080('0x5'));var config=require(_0x0080('0x6'));function getAddress(_0x2ee274){var _0x3f8039=_[_0x0080('0x7')](_0x2ee274[_0x0080('0x8')]);return _0x3f8039&&_0x3f8039['address']?_0x3f8039[_0x0080('0x9')]:_0x0080('0xa')+random[_0x0080('0xb')](0x6)+_0x0080('0xc');}function getFirstName(_0x1717e6){var _0x20bb8d=_['head'](_0x1717e6[_0x0080('0x8')]);if(_0x20bb8d&&_0x20bb8d['name']){if(_0x20bb8d[_0x0080('0xd')]==_0x20bb8d[_0x0080('0x9')]){return _0x20bb8d[_0x0080('0xd')][_0x0080('0xe')](0x0,_0x20bb8d[_0x0080('0xd')][_0x0080('0xf')]('@'));}var _0xaea98e=_0x20bb8d[_0x0080('0xd')]['split'](/\s+/);return _0xaea98e[_0x0080('0x10')]>0x1?_0xaea98e[_0x0080('0x11')](0x0,-0x1)[_0x0080('0x12')]('\x20'):_0x20bb8d[_0x0080('0xd')];}return'Anonymous';}function getLastName(_0x46bcbf){var _0xb714ce=_[_0x0080('0x7')](_0x46bcbf[_0x0080('0x8')]);if(_0xb714ce&&_0xb714ce[_0x0080('0xd')]){var _0x2ba215=_0xb714ce[_0x0080('0xd')][_0x0080('0x13')](/\s+/);return _0x2ba215[_0x0080('0x10')]>0x1?_0x2ba215[_0x0080('0x14')]():'';}return'';}function getMails(_0x1f87cb,_0x218619){var _0x515d28='';for(var _0x379c18=0x0;_0x379c18<_0x218619[_0x0080('0x8')][_0x0080('0x10')];_0x379c18+=0x1){if(_0x218619[_0x0080('0x8')][_0x379c18]['address']!==_0x1f87cb){if(!_['isEmpty'](_0x515d28)){_0x515d28+=',';}_0x515d28+=_0x218619[_0x0080('0x8')][_0x379c18][_0x0080('0xd')]||_0x218619[_0x0080('0x8')][_0x379c18][_0x0080('0x9')]||'';_0x515d28+='\x20<';_0x515d28+=_0x218619[_0x0080('0x8')][_0x379c18][_0x0080('0x9')]?_0x218619['value'][_0x379c18]['address']:'anonymous'+random['generate'](0x6)+'@xcally.com';_0x515d28+='>';}}return _0x515d28;}function parseEmail(_0x414e13,_0x59ce3c,_0x46e9cc){if(_0x59ce3c[_0x0080('0x15')]){var _0x397071=/)<[^<]*)*<\/script>/gi;while(_0x397071['test'](_0x59ce3c[_0x0080('0x15')])){_0x59ce3c[_0x0080('0x15')]=_0x59ce3c['html'][_0x0080('0x16')](_0x397071,'');}if(_0x59ce3c[_0x0080('0x15')]['includes']('{_0x1fc941[_0x0080('0x19')](_0x36bd7e[_0x0080('0x1a')]);});var _0x2cf7f0=/]+>/g;var _0x40c0e1=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x501e18=_0x59ce3c[_0x0080('0x15')][_0x0080('0x16')](_0x40c0e1,'_SRC');var _0x4bd3c3=_0x501e18[_0x0080('0x16')](_0x2cf7f0,_0x0080('0x1b'));for(let _0x599441=0x0;_0x599441<_0x1fc941[_0x0080('0x10')];_0x599441++){var _0x478a49=_0x4bd3c3[_0x0080('0x16')](_0x0080('0x1b'),_0x0080('0x1c')+_0x1fc941[_0x599441]+'\x20]');_0x4bd3c3=_0x478a49;}_0x59ce3c[_0x0080('0x15')]=_0x4bd3c3;}_0x46e9cc[_0x0080('0x1d')]=_0x59ce3c['html'];}else{_0x46e9cc[_0x0080('0x1d')]=_0x59ce3c[_0x0080('0x1e')];}if(_0x46e9cc[_0x0080('0x1d')]){_0x46e9cc[_0x0080('0x1d')]=_0x46e9cc[_0x0080('0x1d')]['replace'](/0x0){var _0xf812d1=[_0x0080('0x32'),_0x0080('0x33'),_0x0080('0x34')];for(var _0x257668=0x0;_0x257668<_0x59ce3c[_0x0080('0x31')][_0x0080('0x10')];_0x257668++){var _0x81aebd=_[_0x0080('0xf')](_0xf812d1,_0x59ce3c[_0x0080('0x31')][_0x257668]['line']);if(_0x81aebd>=0x0){_0x46e9cc[_0x0080('0x35')]=!![];}}}return _0x46e9cc;}exports[_0x0080('0x36')]=function(_0x3f58be,_0x554cbc,_0x483ab2){var _0x44aa26={'from':getAddress(_0x554cbc['from']),'firstName':getFirstName(_0x554cbc['from']),'lastName':getLastName(_0x554cbc['from']),'mapKey':_0x0080('0x5'),'message':{'from':getMails(_0x3f58be['email'],_0x554cbc[_0x0080('0x37')]),'to':_0x3f58be[_0x0080('0x5')],'cc':'','subject':_0x554cbc[_0x0080('0x38')]||'','messageId':_0x554cbc[_0x0080('0x39')],'inReplyTo':_0x554cbc[_0x0080('0x3a')],'sentAt':moment(_0x554cbc[_0x0080('0x3b')])[_0x0080('0x2a')](_0x0080('0x3c')),'attach':![],'attachments':[]}};if(!_0x554cbc[_0x0080('0x15')]&&!_0x554cbc['textAsHtml']){var _0x28d923=_[_0x0080('0x3d')](_0x554cbc[_0x0080('0x17')],{'contentType':_0x0080('0x3e')});if(_0x28d923[_0x0080('0x10')]){logger[_0x0080('0x3f')](util['format']('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x554cbc[_0x0080('0x39')]));tnef[_0x0080('0x40')](_['first'](_0x28d923)['content'],function(_0x4be89a,_0x4ebfab){if(_0x4ebfab){_0x554cbc['html']=_0x4ebfab[_0x0080('0x41')]||_0x0080('0x42');if(_0x4ebfab['Attachments']){for(var _0x1e6af3=0x0;_0x1e6af3<_0x4ebfab[_0x0080('0x43')][_0x0080('0x10')];_0x1e6af3++){var _0x1f5fba=_0x4ebfab[_0x0080('0x43')][_0x1e6af3];_0x44aa26[_0x0080('0x20')][_0x0080('0x17')][_0x0080('0x19')]({'filename':_0x1f5fba[_0x0080('0x44')],'content':Buffer[_0x0080('0x37')](_0x1f5fba[_0x0080('0x45')])});}}}_0x483ab2(parseEmail(_0x3f58be,_0x554cbc,_0x44aa26));});}else{_0x554cbc[_0x0080('0x15')]='

Empty\x20message

';_0x483ab2(parseEmail(_0x3f58be,_0x554cbc,_0x44aa26));}}else{_0x483ab2(parseEmail(_0x3f58be,_0x554cbc,_0x44aa26));}};exports[_0x0080('0x46')]=function(_0x23b9b8,_0x2f4cc0){var _0x2dc2c0=[_0x0080('0x47')+(_0x2f4cc0||''),_0x0080('0x48')+_0x23b9b8,'',''];return Buffer[_0x0080('0x37')](_0x2dc2c0[_0x0080('0x12')](''),_0x0080('0x49'))[_0x0080('0x4a')](_0x0080('0x4b'));}; \ No newline at end of file +var _0xc896=['auth=Bearer\x20','utf-8','base64','lodash','moment','randomstring','util','../../../config/logger','email','../../../config/environment','head','value','address','generate','name','substring','indexOf','length','slice','join','pop','anonymous','@xcally.com','test','html','includes','\x20[Attachment:\x20','\x20]','body','Empty\x20message

','Attachments','Data','generateXOAuth2Token','user='];(function(_0x3474ac,_0x22d0f7){var _0x5345ec=function(_0x45056e){while(--_0x45056e){_0x3474ac['push'](_0x3474ac['shift']());}};_0x5345ec(++_0x22d0f7);}(_0xc896,0x123));var _0x6c89=function(_0x214c7e,_0x3d3093){_0x214c7e=_0x214c7e-0x0;var _0x226d54=_0xc896[_0x214c7e];return _0x226d54;};'use strict';var _=require(_0x6c89('0x0'));var moment=require(_0x6c89('0x1'));var random=require(_0x6c89('0x2'));var fs=require('fs');var path=require('path');var util=require(_0x6c89('0x3'));var tnef=require('node-tnef');var logger=require(_0x6c89('0x4'))(_0x6c89('0x5'));var config=require(_0x6c89('0x6'));function getAddress(_0x4e19ef){var _0x29d334=_[_0x6c89('0x7')](_0x4e19ef[_0x6c89('0x8')]);return _0x29d334&&_0x29d334[_0x6c89('0x9')]?_0x29d334[_0x6c89('0x9')]:'anonymous'+random[_0x6c89('0xa')](0x6)+'@xcally.com';}function getFirstName(_0x37a22f){var _0x220573=_[_0x6c89('0x7')](_0x37a22f[_0x6c89('0x8')]);if(_0x220573&&_0x220573[_0x6c89('0xb')]){if(_0x220573[_0x6c89('0xb')]==_0x220573[_0x6c89('0x9')]){return _0x220573[_0x6c89('0xb')][_0x6c89('0xc')](0x0,_0x220573[_0x6c89('0xb')][_0x6c89('0xd')]('@'));}var _0x4a2e17=_0x220573[_0x6c89('0xb')]['split'](/\s+/);return _0x4a2e17[_0x6c89('0xe')]>0x1?_0x4a2e17[_0x6c89('0xf')](0x0,-0x1)[_0x6c89('0x10')]('\x20'):_0x220573[_0x6c89('0xb')];}return'Anonymous';}function getLastName(_0x4670e9){var _0x5a0683=_[_0x6c89('0x7')](_0x4670e9[_0x6c89('0x8')]);if(_0x5a0683&&_0x5a0683[_0x6c89('0xb')]){var _0x53bc4b=_0x5a0683[_0x6c89('0xb')]['split'](/\s+/);return _0x53bc4b['length']>0x1?_0x53bc4b[_0x6c89('0x11')]():'';}return'';}function getMails(_0x2e11a9,_0x324c68){var _0x4678d7='';for(var _0x285a71=0x0;_0x285a71<_0x324c68[_0x6c89('0x8')][_0x6c89('0xe')];_0x285a71+=0x1){if(_0x324c68[_0x6c89('0x8')][_0x285a71][_0x6c89('0x9')]!==_0x2e11a9){if(!_['isEmpty'](_0x4678d7)){_0x4678d7+=',';}_0x4678d7+=_0x324c68[_0x6c89('0x8')][_0x285a71][_0x6c89('0xb')]||_0x324c68[_0x6c89('0x8')][_0x285a71]['address']||'';_0x4678d7+='\x20<';_0x4678d7+=_0x324c68[_0x6c89('0x8')][_0x285a71]['address']?_0x324c68[_0x6c89('0x8')][_0x285a71]['address']:_0x6c89('0x12')+random[_0x6c89('0xa')](0x6)+_0x6c89('0x13');_0x4678d7+='>';}}return _0x4678d7;}function parseEmail(_0x2f50de,_0x54a5a0,_0x5a14d3){if(_0x54a5a0['html']){var _0x717a73=/)<[^<]*)*<\/script>/gi;while(_0x717a73[_0x6c89('0x14')](_0x54a5a0[_0x6c89('0x15')])){_0x54a5a0['html']=_0x54a5a0[_0x6c89('0x15')]['replace'](_0x717a73,'');}if(_0x54a5a0['html'][_0x6c89('0x16')](_0x6c89('0x17'))){var _0x147a91=[];_0x54a5a0['attachments'][_0x6c89('0x18')](_0x43e787=>{_0x147a91['push'](_0x43e787[_0x6c89('0x19')]);});var _0x24e97f=/]+>/g;var _0x3c86d6=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x3bb9b7=_0x54a5a0['html']['replace'](_0x3c86d6,_0x6c89('0x1a'));var _0x5a66df=_0x3bb9b7['replace'](_0x24e97f,'_IMG');for(let _0x54a577=0x0;_0x54a577<_0x147a91['length'];_0x54a577++){var _0x515b64=_0x5a66df[_0x6c89('0x1b')](_0x6c89('0x1c'),_0x6c89('0x1d')+_0x147a91[_0x54a577]+_0x6c89('0x1e'));_0x5a66df=_0x515b64;}_0x54a5a0['html']=_0x5a66df;}_0x5a14d3[_0x6c89('0x1f')]=_0x54a5a0[_0x6c89('0x15')];}else{_0x5a14d3['body']=_0x54a5a0['textAsHtml'];}if(_0x5a14d3[_0x6c89('0x1f')]){_0x5a14d3[_0x6c89('0x1f')]=_0x5a14d3[_0x6c89('0x1f')]['replace'](/0x0){var _0x29ab26=['Auto-Submitted:\x20auto-replied',_0x6c89('0x31'),'Precedence:\x20auto_reply'];for(var _0x29c973=0x0;_0x29c973<_0x54a5a0[_0x6c89('0x30')][_0x6c89('0xe')];_0x29c973++){var _0x1cd0d5=_[_0x6c89('0xd')](_0x29ab26,_0x54a5a0[_0x6c89('0x30')][_0x29c973][_0x6c89('0x32')]);if(_0x1cd0d5>=0x0){_0x5a14d3[_0x6c89('0x33')]=!![];}}}return _0x5a14d3;}exports[_0x6c89('0x34')]=function(_0x4f0977,_0x400c31,_0xc34e0c){var _0x379f6b={'from':getAddress(_0x400c31[_0x6c89('0x35')]),'firstName':getFirstName(_0x400c31[_0x6c89('0x35')]),'lastName':getLastName(_0x400c31[_0x6c89('0x35')]),'mapKey':_0x6c89('0x5'),'message':{'from':getMails(_0x4f0977[_0x6c89('0x5')],_0x400c31['from']),'to':_0x4f0977['email'],'cc':'','subject':_0x400c31[_0x6c89('0x36')]||'','messageId':_0x400c31[_0x6c89('0x37')],'inReplyTo':_0x400c31[_0x6c89('0x38')],'sentAt':moment(_0x400c31[_0x6c89('0x39')])[_0x6c89('0x2a')](_0x6c89('0x3a')),'attach':![],'attachments':[]}};if(!_0x400c31[_0x6c89('0x15')]&&!_0x400c31[_0x6c89('0x3b')]){var _0x169c2b=_[_0x6c89('0x3c')](_0x400c31[_0x6c89('0x26')],{'contentType':_0x6c89('0x3d')});if(_0x169c2b['length']){logger[_0x6c89('0x3e')](util['format']('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x400c31[_0x6c89('0x37')]));tnef[_0x6c89('0x3f')](_['first'](_0x169c2b)[_0x6c89('0x2e')],function(_0x30e2d2,_0x245ba5){if(_0x245ba5){_0x400c31[_0x6c89('0x15')]=_0x245ba5['BodyHTML']||_0x6c89('0x40');if(_0x245ba5[_0x6c89('0x41')]){for(var _0x48bbc0=0x0;_0x48bbc0<_0x245ba5[_0x6c89('0x41')][_0x6c89('0xe')];_0x48bbc0++){var _0x398b30=_0x245ba5['Attachments'][_0x48bbc0];_0x379f6b['message'][_0x6c89('0x26')][_0x6c89('0x2f')]({'filename':_0x398b30['Title'],'content':Buffer[_0x6c89('0x35')](_0x398b30[_0x6c89('0x42')])});}}}_0xc34e0c(parseEmail(_0x4f0977,_0x400c31,_0x379f6b));});}else{_0x400c31[_0x6c89('0x15')]=_0x6c89('0x40');_0xc34e0c(parseEmail(_0x4f0977,_0x400c31,_0x379f6b));}}else{_0xc34e0c(parseEmail(_0x4f0977,_0x400c31,_0x379f6b));}};exports[_0x6c89('0x43')]=function(_0x22c7f8,_0x5c8fd3){var _0x279dce=[_0x6c89('0x44')+(_0x5c8fd3||''),_0x6c89('0x45')+_0x22c7f8,'',''];return Buffer[_0x6c89('0x35')](_0x279dce['join'](''),_0x6c89('0x46'))['toString'](_0x6c89('0x47'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 86ee4e5..85832f3 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 _0x2374=['key','SERV','Imap','exports','lodash','name','Service'];(function(_0x36cb9e,_0x4cd164){var _0x353836=function(_0x5421bf){while(--_0x5421bf){_0x36cb9e['push'](_0x36cb9e['shift']());}};_0x353836(++_0x4cd164);}(_0x2374,0x17e));var _0x4237=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x2374[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x4237('0x0'));function MailAccount(_0x352f45){this['id']=_0x352f45['id']||0x0;this[_0x4237('0x1')]=_0x352f45['name']||_0x4237('0x2');this['key']=_0x352f45[_0x4237('0x3')]||_0x4237('0x4');this['active']=_0x352f45['active']||![];this[_0x4237('0x5')]=_0x352f45[_0x4237('0x5')]||[];this['Smtp']=_0x352f45['Smtp']||[];}module[_0x4237('0x6')]=MailAccount; \ No newline at end of file +var _0xced0=['active','Imap','Smtp','exports','lodash','name','Service','key','SERV'];(function(_0x461835,_0x455d6c){var _0x50da20=function(_0x321c9c){while(--_0x321c9c){_0x461835['push'](_0x461835['shift']());}};_0x50da20(++_0x455d6c);}(_0xced0,0x82));var _0x0ced=function(_0x15ee41,_0x9275d8){_0x15ee41=_0x15ee41-0x0;var _0x2b2846=_0xced0[_0x15ee41];return _0x2b2846;};'use strict';var _=require(_0x0ced('0x0'));function MailAccount(_0x36d809){this['id']=_0x36d809['id']||0x0;this[_0x0ced('0x1')]=_0x36d809[_0x0ced('0x1')]||_0x0ced('0x2');this['key']=_0x36d809[_0x0ced('0x3')]||_0x0ced('0x4');this['active']=_0x36d809[_0x0ced('0x5')]||![];this[_0x0ced('0x6')]=_0x36d809[_0x0ced('0x6')]||[];this[_0x0ced('0x7')]=_0x36d809[_0x0ced('0x7')]||[];}module[_0x0ced('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 4cdbdc0..bc5fcda 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 _0x6141=['hasOwnProperty','prototype','mergeFromDatabase','isUndefined','merge','exports','lodash','mailAccounts','mapKeys'];(function(_0x1e5362,_0x118bbe){var _0x2a6014=function(_0x16f322){while(--_0x16f322){_0x1e5362['push'](_0x1e5362['shift']());}};_0x2a6014(++_0x118bbe);}(_0x6141,0x177));var _0x1614=function(_0x138cba,_0x410547){_0x138cba=_0x138cba-0x0;var _0x534cd7=_0x6141[_0x138cba];return _0x534cd7;};'use strict';var _=require(_0x1614('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0x1614('0x1')]={};};function freeIsNotKey(_0x14f064,_0xf0cd15,_0x518b67){var _0x27b8d3=_[_0x1614('0x2')](_0x14f064,function(_0x3ac3c4,_0x39c764){return _0x3ac3c4[_0x518b67];});for(var _0x16cde7 in _0xf0cd15){if(_0xf0cd15[_0x1614('0x3')](_0x16cde7)){if(!_0x27b8d3[_0x16cde7]){delete _0xf0cd15[_0x16cde7];}}}}Realtime[_0x1614('0x4')][_0x1614('0x5')]=function(_0x19394d,_0x40019f){for(var _0x428170 in _0x40019f){if(_0x19394d[_0x1614('0x3')](_0x428170)){_0x19394d[_0x428170]=_0x40019f[_0x428170];}}};Realtime[_0x1614('0x4')]['initMailAccounts']=function(){var _0x15f4b7=this;return function(_0x169b4f){if(_0x169b4f){freeIsNotKey(_0x169b4f,_0x15f4b7[_0x1614('0x1')],'id');for(var _0x46ad9f=0x0,_0x5859cb={},_0x474ee6={};_0x46ad9f<_0x169b4f['length'];_0x46ad9f+=0x1){_0x5859cb=_0x169b4f[_0x46ad9f];if(_[_0x1614('0x6')](_0x15f4b7['mailAccounts'][_0x5859cb['id']])){_0x15f4b7['mailAccounts'][_0x5859cb['id']]=new MailAccount(_0x5859cb);}else{_[_0x1614('0x7')](_0x15f4b7[_0x1614('0x1')][_0x5859cb['id']],_0x5859cb);}}}return _0x15f4b7[_0x1614('0x1')];};};module[_0x1614('0x8')]=Realtime; \ No newline at end of file +var _0x2e5e=['merge','exports','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','isUndefined'];(function(_0xb935ec,_0x2e217e){var _0x309513=function(_0x20339f){while(--_0x20339f){_0xb935ec['push'](_0xb935ec['shift']());}};_0x309513(++_0x2e217e);}(_0x2e5e,0x1c5));var _0xe2e5=function(_0x59880c,_0x294cde){_0x59880c=_0x59880c-0x0;var _0x12c5a3=_0x2e5e[_0x59880c];return _0x12c5a3;};'use strict';var _=require(_0xe2e5('0x0'));var MailAccount=require(_0xe2e5('0x1'));var Realtime=function(){this[_0xe2e5('0x2')]={};};function freeIsNotKey(_0x2ce028,_0x1909ad,_0xe83a71){var _0x57490e=_[_0xe2e5('0x3')](_0x2ce028,function(_0x1e2729,_0x3b8898){return _0x1e2729[_0xe83a71];});for(var _0x290fb7 in _0x1909ad){if(_0x1909ad[_0xe2e5('0x4')](_0x290fb7)){if(!_0x57490e[_0x290fb7]){delete _0x1909ad[_0x290fb7];}}}}Realtime[_0xe2e5('0x5')][_0xe2e5('0x6')]=function(_0x4cf9ca,_0x2455ed){for(var _0x15fe6b in _0x2455ed){if(_0x4cf9ca['hasOwnProperty'](_0x15fe6b)){_0x4cf9ca[_0x15fe6b]=_0x2455ed[_0x15fe6b];}}};Realtime[_0xe2e5('0x5')][_0xe2e5('0x7')]=function(){var _0x389b22=this;return function(_0x5d488b){if(_0x5d488b){freeIsNotKey(_0x5d488b,_0x389b22['mailAccounts'],'id');for(var _0xe0d723=0x0,_0x519872={},_0x936d3a={};_0xe0d723<_0x5d488b['length'];_0xe0d723+=0x1){_0x519872=_0x5d488b[_0xe0d723];if(_[_0xe2e5('0x8')](_0x389b22[_0xe2e5('0x2')][_0x519872['id']])){_0x389b22[_0xe2e5('0x2')][_0x519872['id']]=new MailAccount(_0x519872);}else{_[_0xe2e5('0x9')](_0x389b22[_0xe2e5('0x2')][_0x519872['id']],_0x519872);}}}return _0x389b22['mailAccounts'];};};module[_0xe2e5('0xa')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 328c7b2..8b2444c 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 _0x3c85=['../client','getMailAccounts','Request','GetMailAccount','service','email','active','ListId','TemplateId','MailServerIn','type','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount'];(function(_0x589bb7,_0x11a7f0){var _0x3b7e60=function(_0x6cec15){while(--_0x6cec15){_0x589bb7['push'](_0x589bb7['shift']());}};_0x3b7e60(++_0x11a7f0);}(_0x3c85,0x1a0));var _0x53c8=function(_0x1eb3a6,_0x2e5848){_0x1eb3a6=_0x1eb3a6-0x0;var _0x159f3b=_0x3c85[_0x1eb3a6];return _0x159f3b;};'use strict';var client=require(_0x53c8('0x0'));exports[_0x53c8('0x1')]=function(){return function(){return client[_0x53c8('0x2')](_0x53c8('0x3'),{'options':{'attributes':['id','name','provider',_0x53c8('0x4'),_0x53c8('0x5'),_0x53c8('0x6'),'key',_0x53c8('0x7'),_0x53c8('0x8')],'raw':![],'include':[{'model':_0x53c8('0x9'),'as':'Imap','include':[{'model':'CloudProvider','attributes':['id','name','service',_0x53c8('0xa'),'data5'],'as':'CloudProvider'}]},{'model':_0x53c8('0xb'),'as':_0x53c8('0xc'),'include':[{'model':'CloudProvider','attributes':['id','name','service',_0x53c8('0xa'),'data5'],'as':'CloudProvider'}]}]},'log':_0x53c8('0xd')});};};exports[_0x53c8('0xe')]=function(_0x394f5f,_0x25d2af){return client[_0x53c8('0x2')]('NotifyMailAccount',{'account':{'id':_0x394f5f},'body':_0x25d2af,'log':_0x53c8('0xf')});}; \ No newline at end of file +var _0x27af=['CloudProvider','data5','MailServerOut','Smtp','service','type','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','name','provider','active','key','ListId','TemplateId','MailServerIn','Imap'];(function(_0x58bf72,_0x270672){var _0x5ac3aa=function(_0x5b6191){while(--_0x5b6191){_0x58bf72['push'](_0x58bf72['shift']());}};_0x5ac3aa(++_0x270672);}(_0x27af,0x199));var _0xf27a=function(_0x144616,_0x1188de){_0x144616=_0x144616-0x0;var _0x100e2f=_0x27af[_0x144616];return _0x100e2f;};'use strict';var client=require(_0xf27a('0x0'));exports[_0xf27a('0x1')]=function(){return function(){return client[_0xf27a('0x2')]('GetMailAccount',{'options':{'attributes':['id',_0xf27a('0x3'),_0xf27a('0x4'),'service','email',_0xf27a('0x5'),_0xf27a('0x6'),_0xf27a('0x7'),_0xf27a('0x8')],'raw':![],'include':[{'model':_0xf27a('0x9'),'as':_0xf27a('0xa'),'include':[{'model':_0xf27a('0xb'),'attributes':['id',_0xf27a('0x3'),'service','type',_0xf27a('0xc')],'as':_0xf27a('0xb')}]},{'model':_0xf27a('0xd'),'as':_0xf27a('0xe'),'include':[{'model':'CloudProvider','attributes':['id','name',_0xf27a('0xf'),_0xf27a('0x10'),_0xf27a('0xc')],'as':_0xf27a('0xb')}]}]},'log':_0xf27a('0x11')});};};exports[_0xf27a('0x12')]=function(_0x31152b,_0x327381){return client[_0xf27a('0x2')](_0xf27a('0x13'),{'account':{'id':_0x31152b},'body':_0x327381,'log':_0xf27a('0x13')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 1d186eb..a71da38 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 _0x7577=['getSettings','ShowSetting','loginMailFrequency','GetSettings','../client'];(function(_0x5465e6,_0x2a8809){var _0x10044e=function(_0x1d5dcd){while(--_0x1d5dcd){_0x5465e6['push'](_0x5465e6['shift']());}};_0x10044e(++_0x2a8809);}(_0x7577,0x1d0));var _0x7757=function(_0x369cbd,_0x21f52a){_0x369cbd=_0x369cbd-0x0;var _0xb32be0=_0x7577[_0x369cbd];return _0xb32be0;};'use strict';var client=require(_0x7757('0x0'));exports[_0x7757('0x1')]=function(){return client['Request'](_0x7757('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x7757('0x3')]},'log':_0x7757('0x4')});}; \ No newline at end of file +var _0x921f=['getSettings','ShowSetting','loginMailFrequency','GetSettings','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x921f,0x18f));var _0xf921=function(_0x1ca7d1,_0x3c0176){_0x1ca7d1=_0x1ca7d1-0x0;var _0x52f447=_0x921f[_0x1ca7d1];return _0x52f447;};'use strict';var client=require(_0xf921('0x0'));exports[_0xf921('0x1')]=function(){return client['Request'](_0xf921('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xf921('0x3')]},'log':_0xf921('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index d4b6012..86ee48f 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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 fa88671..2d8ac59 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 _0x91b6=['sticky-session','createServer','timeout','listen','port','socket.io','websocket','redis','defaults','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express'];(function(_0x55fc1b,_0x16d022){var _0x26257d=function(_0x5b7a91){while(--_0x5b7a91){_0x55fc1b['push'](_0x55fc1b['shift']());}};_0x26257d(++_0x16d022);}(_0x91b6,0xed));var _0x691b=function(_0x42d9cf,_0x55f9bc){_0x42d9cf=_0x42d9cf-0x0;var _0x1e98fb=_0x91b6[_0x42d9cf];return _0x1e98fb;};'use strict';var _=require(_0x691b('0x0'));var http=require(_0x691b('0x1'));var express=require(_0x691b('0x2'));var sticky=require(_0x691b('0x3'));var Redis=require('ioredis');var config=require('../../config/environment');var app=express();var server=http[_0x691b('0x4')](app);server[_0x691b('0x5')]=0xdbba0;if(sticky[_0x691b('0x6')](server,config[_0x691b('0x7')])){var socketio=require(_0x691b('0x8'))(server,{'transports':[_0x691b('0x9'),'polling']});config[_0x691b('0xa')]=_[_0x691b('0xb')](config['redis'],{'host':_0x691b('0xc'),'port':0x18eb});socketio[_0x691b('0xd')](require(_0x691b('0xe'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x691b('0xa')])}));require(_0x691b('0xf'))[_0x691b('0x10')]();require(_0x691b('0x11'))[_0x691b('0x10')](socketio);require('../../config/express')['default'](app);require(_0x691b('0x12'))[_0x691b('0x10')](app);}else{server[_0x691b('0x13')](_0x691b('0x14'),function(){console[_0x691b('0x15')](_0x691b('0x16'),config[_0x691b('0x7')]);});}exports=module[_0x691b('0x17')]=app; \ No newline at end of file +var _0x6461=['../../config/socketio','default','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports','http','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','socket.io','websocket','redis','defaults','localhost','../../config/triggers'];(function(_0x2379d1,_0x4fa156){var _0x4368b9=function(_0x6451ef){while(--_0x6451ef){_0x2379d1['push'](_0x2379d1['shift']());}};_0x4368b9(++_0x4fa156);}(_0x6461,0x82));var _0x1646=function(_0x233a82,_0x2d6b7f){_0x233a82=_0x233a82-0x0;var _0xd40a5f=_0x6461[_0x233a82];return _0xd40a5f;};'use strict';var _=require('lodash');var http=require(_0x1646('0x0'));var express=require(_0x1646('0x1'));var sticky=require(_0x1646('0x2'));var Redis=require(_0x1646('0x3'));var config=require(_0x1646('0x4'));var app=express();var server=http[_0x1646('0x5')](app);server[_0x1646('0x6')]=0xdbba0;if(sticky[_0x1646('0x7')](server,config['port'])){var socketio=require(_0x1646('0x8'))(server,{'transports':[_0x1646('0x9'),'polling']});config[_0x1646('0xa')]=_[_0x1646('0xb')](config['redis'],{'host':_0x1646('0xc'),'port':0x18eb});socketio['adapter'](require('socket.io-redis')({'pubClient':new Redis(config[_0x1646('0xa')]),'subClient':new Redis(config['redis'])}));require(_0x1646('0xd'))['default']();require(_0x1646('0xe'))[_0x1646('0xf')](socketio);require(_0x1646('0x10'))[_0x1646('0xf')](app);require(_0x1646('0x11'))[_0x1646('0xf')](app);}else{server[_0x1646('0x12')](_0x1646('0x13'),function(){console[_0x1646('0x14')](_0x1646('0x15'),config[_0x1646('0x16')]);});}exports=module[_0x1646('0x17')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index b47655f..edeb2e2 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 _0x53bc=['Request','request','then','debug','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http'];(function(_0x47725b,_0x229703){var _0x283b1e=function(_0x5d5b6c){while(--_0x5d5b6c){_0x47725b['push'](_0x47725b['shift']());}};_0x283b1e(++_0x229703);}(_0x53bc,0x19a));var _0xc53b=function(_0x157da5,_0x5a5f5e){_0x157da5=_0x157da5-0x0;var _0x2a82a8=_0x53bc[_0x157da5];return _0x2a82a8;};'use strict';var jayson=require(_0xc53b('0x0'));var BPromise=require(_0xc53b('0x1'));var logger=require(_0xc53b('0x2'))(_0xc53b('0x3'));var client=jayson[_0xc53b('0x4')][_0xc53b('0x5')]({'port':0x2329});client[_0xc53b('0x6')]=function(_0x3db015,_0x10fdda){return new BPromise(function(_0x12fe30,_0x4d231a){return client[_0xc53b('0x7')](_0x3db015,_0x10fdda)[_0xc53b('0x8')](function(_0x225124){logger[_0xc53b('0x9')](_0xc53b('0xa'),'routing',_0x3db015,_0x10fdda,_0x225124);if(_0x225124[_0xc53b('0xb')]){logger[_0xc53b('0xb')]('rpc',_0xc53b('0x3'),_0x3db015,_0x225124[_0xc53b('0xb')][_0xc53b('0xc')],_0x10fdda);return _0x4d231a(_0x225124['error'][_0xc53b('0xc')]);}else{return _0x12fe30(_0x225124[_0xc53b('0xd')]);}})[_0xc53b('0xe')](function(_0x190459){logger[_0xc53b('0xb')](_0xc53b('0xa'),_0xc53b('0x3'),_0x3db015,_0x190459,_0x10fdda);return _0x4d231a(_0x190459);});});};module[_0xc53b('0xf')]=client; \ No newline at end of file +var _0x549a=['catch','exports','jayson/promise','bluebird','routing','client','Request','request','then','debug','rpc','error','message','result'];(function(_0x55554a,_0x3a24d0){var _0x179793=function(_0x5e25b0){while(--_0x5e25b0){_0x55554a['push'](_0x55554a['shift']());}};_0x179793(++_0x3a24d0);}(_0x549a,0x80));var _0xa549=function(_0x3dc483,_0x30ccf8){_0x3dc483=_0x3dc483-0x0;var _0x22c712=_0x549a[_0x3dc483];return _0x22c712;};'use strict';var jayson=require(_0xa549('0x0'));var BPromise=require(_0xa549('0x1'));var logger=require('../../config/logger')(_0xa549('0x2'));var client=jayson[_0xa549('0x3')]['http']({'port':0x2329});client[_0xa549('0x4')]=function(_0x191497,_0x37e8a6){return new BPromise(function(_0x49cc94,_0xea52f2){return client[_0xa549('0x5')](_0x191497,_0x37e8a6)[_0xa549('0x6')](function(_0x4593a3){logger[_0xa549('0x7')](_0xa549('0x8'),_0xa549('0x2'),_0x191497,_0x37e8a6,_0x4593a3);if(_0x4593a3[_0xa549('0x9')]){logger[_0xa549('0x9')](_0xa549('0x8'),_0xa549('0x2'),_0x191497,_0x4593a3[_0xa549('0x9')][_0xa549('0xa')],_0x37e8a6);return _0xea52f2(_0x4593a3[_0xa549('0x9')][_0xa549('0xa')]);}else{return _0x49cc94(_0x4593a3[_0xa549('0xb')]);}})[_0xa549('0xc')](function(_0x5566fb){logger[_0xa549('0x9')](_0xa549('0x8'),_0xa549('0x2'),_0x191497,_0x5566fb,_0x37e8a6);return _0xea52f2(_0x5566fb);});});};module[_0xa549('0xd')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index f87e68f..a1a9b5b 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 _0x7b31=['initAgents','getIntervals','then','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','initSmsQueues','initFaxQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/whatsappQueue','getAgents'];(function(_0x3d8bca,_0x116130){var _0x54606=function(_0x2f246a){while(--_0x2f246a){_0x3d8bca['push'](_0x3d8bca['shift']());}};_0x54606(++_0x116130);}(_0x7b31,0x1d9));var _0x17b3=function(_0x18272e,_0x2ad430){_0x18272e=_0x18272e-0x0;var _0xe4b727=_0x7b31[_0x18272e];return _0xe4b727;};'use strict';var BPromise=require(_0x17b3('0x0'));var server=require(_0x17b3('0x1'));var Realtime=require(_0x17b3('0x2'));var user=require(_0x17b3('0x3'));var interval=require(_0x17b3('0x4'));var openchannelQueue=require(_0x17b3('0x5'));var chatQueue=require(_0x17b3('0x6'));var smsQueue=require(_0x17b3('0x7'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0x17b3('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()['then'](user[_0x17b3('0x9')]())['then'](realtime[_0x17b3('0xa')]())['then'](interval[_0x17b3('0xb')]())[_0x17b3('0xc')](realtime[_0x17b3('0xd')]())[_0x17b3('0xc')](openchannelQueue[_0x17b3('0xe')]())[_0x17b3('0xc')](realtime[_0x17b3('0xf')]())[_0x17b3('0xc')](chatQueue[_0x17b3('0x10')]())[_0x17b3('0xc')](realtime[_0x17b3('0x11')]())['then'](smsQueue['getSmsQueues']())[_0x17b3('0xc')](realtime[_0x17b3('0x12')]())['then'](mailQueue['getMailQueues']())[_0x17b3('0xc')](realtime['initMailQueues']())[_0x17b3('0xc')](faxQueue['getFaxQueues']())['then'](realtime[_0x17b3('0x13')]())[_0x17b3('0xc')](whatsappQueue['getWhatsappQueues']())['then'](realtime['initWhatsappQueues']())[_0x17b3('0xc')](function(){return realtime;});}function main(){return server[_0x17b3('0x14')](realtime)[_0x17b3('0xc')](function(_0x2a6b19){return initRealtime();})['then'](function(_0x1652fd){return setInterval(initRealtime,0x1388);})[_0x17b3('0x15')](function(_0x275b72){console[_0x17b3('0x16')](_0x275b72);});}main(); \ No newline at end of file +var _0x97b0=['./rpc/faxQueue','resolve','then','getAgents','getIntervals','initIntervals','getOpenchannelQueues','initChatQueues','getMailQueues','initMailQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','bluebird','./server','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue'];(function(_0x4b6507,_0x5518b5){var _0x2001ec=function(_0x330ddf){while(--_0x330ddf){_0x4b6507['push'](_0x4b6507['shift']());}};_0x2001ec(++_0x5518b5);}(_0x97b0,0x1db));var _0x097b=function(_0x4af378,_0x32f59e){_0x4af378=_0x4af378-0x0;var _0x391814=_0x97b0[_0x4af378];return _0x391814;};'use strict';var BPromise=require(_0x097b('0x0'));var server=require(_0x097b('0x1'));var Realtime=require('./realtime');var user=require('./rpc/user');var interval=require(_0x097b('0x2'));var openchannelQueue=require(_0x097b('0x3'));var chatQueue=require(_0x097b('0x4'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0x097b('0x5'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x097b('0x6')]()[_0x097b('0x7')](user[_0x097b('0x8')]())['then'](realtime['initAgents']())[_0x097b('0x7')](interval[_0x097b('0x9')]())[_0x097b('0x7')](realtime[_0x097b('0xa')]())[_0x097b('0x7')](openchannelQueue[_0x097b('0xb')]())[_0x097b('0x7')](realtime['initOpenchannelQueues']())[_0x097b('0x7')](chatQueue['getChatQueues']())[_0x097b('0x7')](realtime[_0x097b('0xc')]())['then'](smsQueue['getSmsQueues']())['then'](realtime['initSmsQueues']())[_0x097b('0x7')](mailQueue[_0x097b('0xd')]())[_0x097b('0x7')](realtime[_0x097b('0xe')]())[_0x097b('0x7')](faxQueue['getFaxQueues']())['then'](realtime[_0x097b('0xf')]())[_0x097b('0x7')](whatsappQueue[_0x097b('0x10')]())[_0x097b('0x7')](realtime[_0x097b('0x11')]())[_0x097b('0x7')](function(){return realtime;});}function main(){return server[_0x097b('0x12')](realtime)['then'](function(_0x24b700){return initRealtime();})[_0x097b('0x7')](function(_0x279f4d){return setInterval(initRealtime,0x1388);})[_0x097b('0x13')](function(_0x3ceed8){console['log'](_0x3ceed8);});}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 1b8ce1e..a583ad9 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(_0x2ded17,_0x1750bb){var _0x41378d=function(_0x23c76c){while(--_0x23c76c){_0x2ded17['push'](_0x2ded17['shift']());}};_0x41378d(++_0x1750bb);}(_0x2ef3,0xba));var _0x32ef=function(_0x9fed0e,_0x22fc8e){_0x9fed0e=_0x9fed0e-0x0;var _0x53e251=_0x2ef3[_0x9fed0e];return _0x53e251;};'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 _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x533c7f,_0x5c65fe){var _0x12921f=function(_0x264203){while(--_0x264203){_0x533c7f['push'](_0x533c7f['shift']());}};_0x12921f(++_0x5c65fe);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xc4aa[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 4d308cf..d185c6e 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 _0xd027=['client','http','request','then','error','message','catch','sendMailMessage','SendMail','jayson/promise'];(function(_0x11f85e,_0x16341e){var _0x2a046d=function(_0x339eac){while(--_0x339eac){_0x11f85e['push'](_0x11f85e['shift']());}};_0x2a046d(++_0x16341e);}(_0xd027,0x6d));var _0x7d02=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd027[_0x14add3];return _0x4a174f;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x7d02('0x0'));var client=jayson[_0x7d02('0x1')][_0x7d02('0x2')]({'port':0x232b});function request(_0x3fe777,_0x1b11a7){return new BPromise(function(_0x4f0805,_0x46d5df){return client[_0x7d02('0x3')](_0x3fe777,_0x1b11a7)[_0x7d02('0x4')](function(_0x412266){if(_0x412266[_0x7d02('0x5')]){return _0x46d5df(_0x412266['error'][_0x7d02('0x6')]);}else{return _0x4f0805(_0x412266['result']);}})[_0x7d02('0x7')](function(_0x2df9db){return _0x46d5df(_0x2df9db);});});}exports[_0x7d02('0x8')]=function(_0x36665f,_0x4988cd){return request(_0x7d02('0x9'),{'account':_0x36665f,'message':_0x4988cd});}; \ No newline at end of file +var _0x68ed=['SendMail','jayson/promise','client','http','request','error','catch','sendMailMessage'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x68ed,0x151));var _0xd68e=function(_0x306081,_0x2cc909){_0x306081=_0x306081-0x0;var _0x5b4f09=_0x68ed[_0x306081];return _0x5b4f09;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xd68e('0x0'));var client=jayson[_0xd68e('0x1')][_0xd68e('0x2')]({'port':0x232b});function request(_0xf67992,_0x455122){return new BPromise(function(_0x4b5110,_0x1da8e3){return client[_0xd68e('0x3')](_0xf67992,_0x455122)['then'](function(_0x5e7958){if(_0x5e7958[_0xd68e('0x4')]){return _0x1da8e3(_0x5e7958[_0xd68e('0x4')]['message']);}else{return _0x4b5110(_0x5e7958['result']);}})[_0xd68e('0x5')](function(_0x71bbf6){return _0x1da8e3(_0x71bbf6);});});}exports[_0xd68e('0x6')]=function(_0x485719,_0x2a3e30){return request(_0xd68e('0x7'),{'account':_0x485719,'message':_0x2a3e30});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 25f7b28..9bc0142 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 _0xcaf2=['busyQueue','emit','user:routing:update','exports','lodash','moment','ioredis','redis','defaults','localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','md5','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','Capacity','CurrentCapacity','maxcapacity','working','idle','mail','openchannel','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','chatStatus','smsCurrentCapacity','whatsappStatusTime'];(function(_0x5401f6,_0x3b8658){var _0x38f962=function(_0x156455){while(--_0x156455){_0x5401f6['push'](_0x5401f6['shift']());}};_0x38f962(++_0x3b8658);}(_0xcaf2,0x8a));var _0x2caf=function(_0x1de641,_0x44d464){_0x1de641=_0x1de641-0x0;var _0xccacbc=_0xcaf2[_0x1de641];return _0xccacbc;};'use strict';var _=require(_0x2caf('0x0'));var md5=require('md5');var moment=require(_0x2caf('0x1'));var Redis=require(_0x2caf('0x2'));var config=require('../../../config/environment');config[_0x2caf('0x3')]=_[_0x2caf('0x4')](config['redis'],{'host':_0x2caf('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2caf('0x3')]));function Agent(_0xae320c){this['id']=_0xae320c['id']||0x0;this[_0x2caf('0x6')]=_0xae320c['name']||'';this[_0x2caf('0x7')]=_0xae320c[_0x2caf('0x7')]||!![];this[_0x2caf('0x8')]=_0xae320c[_0x2caf('0x8')]||![];this['chatPause']=_0xae320c[_0x2caf('0x9')]||![];this[_0x2caf('0xa')]=_0xae320c[_0x2caf('0xa')]||![];this[_0x2caf('0xb')]=_0xae320c[_0x2caf('0xb')]||![];this[_0x2caf('0xc')]=_0xae320c[_0x2caf('0xc')]||![];this[_0x2caf('0xd')]=_0xae320c[_0x2caf('0xd')]||![];this['chatStatus']=_0x2caf('0xe');this[_0x2caf('0xf')]=0x0;this[_0x2caf('0x10')]=_0xae320c[_0x2caf('0x10')]||0x0;this[_0x2caf('0x11')]=0x0;this[_0x2caf('0x12')]=_0x2caf('0xe');this[_0x2caf('0x13')]=0x0;this['mailCapacity']=_0xae320c[_0x2caf('0x14')]||0x0;this[_0x2caf('0x15')]=0x0;this['faxStatus']='unknown';this['faxStatusTime']=0x0;this[_0x2caf('0x16')]=_0xae320c['faxCapacity']||0x0;this[_0x2caf('0x17')]=0x0;this[_0x2caf('0x18')]=_0x2caf('0xe');this[_0x2caf('0x19')]=0x0;this['smsCapacity']=_0xae320c[_0x2caf('0x1a')]||0x0;this['smsCurrentCapacity']=0x0;this[_0x2caf('0x1b')]='unknown';this['whatsappStatusTime']=0x0;this[_0x2caf('0x1c')]=_0xae320c['whatsappCapacity']||0x0;this[_0x2caf('0x1d')]=0x0;this[_0x2caf('0x1e')]='unknown';this[_0x2caf('0x1f')]=0x0;this[_0x2caf('0x20')]=_0xae320c[_0x2caf('0x20')]||0x0;this[_0x2caf('0x21')]=0x0;this[_0x2caf('0x22')]=![];this['busyQueue']=undefined;this[_0x2caf('0x23')]='';this[_0x2caf('0x24')]={};this[_0x2caf('0x25')]={};this[_0x2caf('0x26')]={};this[_0x2caf('0x27')]={};this[_0x2caf('0x28')]={};this[_0x2caf('0x29')]={};this[_0x2caf('0x2a')]();}Agent[_0x2caf('0x2b')][_0x2caf('0x2c')]=function(_0x6814bc){if(this[_0x6814bc+'CurrentCapacity']>0x0){if(this[_0x6814bc+_0x2caf('0x2d')]>0x0&&this[_0x6814bc+_0x2caf('0x2e')]>=this[_0x6814bc+_0x2caf('0x2d')]){return _0x2caf('0x2f');}else{return _0x2caf('0x30');}}else{return _0x2caf('0x31');}};Agent[_0x2caf('0x2b')][_0x2caf('0x2a')]=function(){var _0x2e0a75=[_0x2caf('0x32'),'chat',_0x2caf('0x33'),_0x2caf('0x34'),_0x2caf('0x35'),_0x2caf('0x36')];for(var _0x3c60d1=0x0;_0x3c60d1<_0x2e0a75[_0x2caf('0x37')];_0x3c60d1+=0x1){var _0x13e8d9=this[_0x2caf('0x2c')](_0x2e0a75[_0x3c60d1]);if(this[_0x2e0a75[_0x3c60d1]+_0x2caf('0x38')]!==_0x13e8d9){this[_0x2e0a75[_0x3c60d1]+_0x2caf('0x39')]=_[_0x2caf('0x3a')](moment()[_0x2caf('0x3b')]('x'));}this[_0x2e0a75[_0x3c60d1]+_0x2caf('0x38')]=_0x13e8d9;}var _0x48b5f7={'id':this['id'],'name':this[_0x2caf('0x6')],'online':this[_0x2caf('0x7')],'voicePause':this[_0x2caf('0x8')],'chatPause':this[_0x2caf('0x9')],'mailPause':this[_0x2caf('0xa')],'smsPause':this[_0x2caf('0xc')],'faxPause':this[_0x2caf('0xb')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x2caf('0x3c')],'chatStatusTime':this[_0x2caf('0xf')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x2caf('0x11')],'mailStatus':this[_0x2caf('0x12')],'mailStatusTime':this[_0x2caf('0x13')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x2caf('0x15')],'faxStatus':this['faxStatus'],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x2caf('0x16')],'faxCurrentCapacity':this[_0x2caf('0x17')],'smsStatus':this[_0x2caf('0x18')],'smsStatusTime':this[_0x2caf('0x19')],'smsCapacity':this[_0x2caf('0x1a')],'smsCurrentCapacity':this[_0x2caf('0x3d')],'whatsappStatus':this[_0x2caf('0x1b')],'whatsappStatusTime':this[_0x2caf('0x3e')],'whatsappCapacity':this[_0x2caf('0x1c')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x2caf('0x1e')],'openchannelStatusTime':this[_0x2caf('0x1f')],'openchannelCapacity':this[_0x2caf('0x20')],'openchannelCurrentCapacity':this[_0x2caf('0x21')],'busy':this[_0x2caf('0x22')],'busyQueue':this[_0x2caf('0x3f')],'chatWaitingInteractions':this[_0x2caf('0x24')],'faxWaitingInteractions':this[_0x2caf('0x25')],'mailWaitingInteractions':this[_0x2caf('0x26')],'openchannelWaitingInteractions':this[_0x2caf('0x27')],'smsWaitingInteractions':this[_0x2caf('0x28')],'whatsappWaitingInteractions':this[_0x2caf('0x29')]};var _0x4d1dec=md5(JSON['stringify'](_0x48b5f7));if(this[_0x2caf('0x23')]!==_0x4d1dec){this[_0x2caf('0x23')]=_0x4d1dec;io[_0x2caf('0x40')](_0x2caf('0x41'),_['omit'](_0x48b5f7,[_0x2caf('0x7')]));}};module[_0x2caf('0x42')]=Agent; \ No newline at end of file +var _0x6a95=['Capacity','maxcapacity','idle','mail','openchannel','fax','sms','whatsapp','length','StatusTime','toNumber','Status','chatStatusTime','faxStatusTime','smsStatusTime','smsCurrentCapacity','busyQueue','smsWaitingInteractions','stringify','exports','lodash','md5','moment','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','online','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity'];(function(_0x2976cb,_0xb3f89a){var _0x15eabf=function(_0x18d998){while(--_0x18d998){_0x2976cb['push'](_0x2976cb['shift']());}};_0x15eabf(++_0xb3f89a);}(_0x6a95,0x1db));var _0x56a9=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x6a95[_0x220dbb];return _0x2b77de;};'use strict';var _=require(_0x56a9('0x0'));var md5=require(_0x56a9('0x1'));var moment=require(_0x56a9('0x2'));var Redis=require(_0x56a9('0x3'));var config=require(_0x56a9('0x4'));config[_0x56a9('0x5')]=_[_0x56a9('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x56a9('0x7'))(new Redis(config[_0x56a9('0x5')]));function Agent(_0x1b42ac){this['id']=_0x1b42ac['id']||0x0;this[_0x56a9('0x8')]=_0x1b42ac[_0x56a9('0x8')]||'';this[_0x56a9('0x9')]=_0x1b42ac[_0x56a9('0x9')]||!![];this['voicePause']=_0x1b42ac['voicePause']||![];this[_0x56a9('0xa')]=_0x1b42ac[_0x56a9('0xa')]||![];this['mailPause']=_0x1b42ac[_0x56a9('0xb')]||![];this[_0x56a9('0xc')]=_0x1b42ac[_0x56a9('0xc')]||![];this[_0x56a9('0xd')]=_0x1b42ac[_0x56a9('0xd')]||![];this[_0x56a9('0xe')]=_0x1b42ac[_0x56a9('0xe')]||![];this[_0x56a9('0xf')]=_0x56a9('0x10');this['chatStatusTime']=0x0;this[_0x56a9('0x11')]=_0x1b42ac['chatCapacity']||0x0;this[_0x56a9('0x12')]=0x0;this[_0x56a9('0x13')]=_0x56a9('0x10');this[_0x56a9('0x14')]=0x0;this[_0x56a9('0x15')]=_0x1b42ac[_0x56a9('0x15')]||0x0;this[_0x56a9('0x16')]=0x0;this[_0x56a9('0x17')]=_0x56a9('0x10');this['faxStatusTime']=0x0;this['faxCapacity']=_0x1b42ac[_0x56a9('0x18')]||0x0;this[_0x56a9('0x19')]=0x0;this[_0x56a9('0x1a')]=_0x56a9('0x10');this['smsStatusTime']=0x0;this[_0x56a9('0x1b')]=_0x1b42ac['smsCapacity']||0x0;this['smsCurrentCapacity']=0x0;this['whatsappStatus']=_0x56a9('0x10');this[_0x56a9('0x1c')]=0x0;this[_0x56a9('0x1d')]=_0x1b42ac[_0x56a9('0x1d')]||0x0;this[_0x56a9('0x1e')]=0x0;this[_0x56a9('0x1f')]=_0x56a9('0x10');this[_0x56a9('0x20')]=0x0;this[_0x56a9('0x21')]=_0x1b42ac[_0x56a9('0x21')]||0x0;this[_0x56a9('0x22')]=0x0;this[_0x56a9('0x23')]=![];this['busyQueue']=undefined;this['md5']='';this[_0x56a9('0x24')]={};this[_0x56a9('0x25')]={};this[_0x56a9('0x26')]={};this[_0x56a9('0x27')]={};this['smsWaitingInteractions']={};this[_0x56a9('0x28')]={};this[_0x56a9('0x29')]();}Agent[_0x56a9('0x2a')][_0x56a9('0x2b')]=function(_0x5a82e0){if(this[_0x5a82e0+_0x56a9('0x2c')]>0x0){if(this[_0x5a82e0+_0x56a9('0x2d')]>0x0&&this[_0x5a82e0+_0x56a9('0x2c')]>=this[_0x5a82e0+_0x56a9('0x2d')]){return _0x56a9('0x2e');}else{return'working';}}else{return _0x56a9('0x2f');}};Agent[_0x56a9('0x2a')][_0x56a9('0x29')]=function(){var _0x5e3052=[_0x56a9('0x30'),'chat',_0x56a9('0x31'),_0x56a9('0x32'),_0x56a9('0x33'),_0x56a9('0x34')];for(var _0x45f38c=0x0;_0x45f38c<_0x5e3052[_0x56a9('0x35')];_0x45f38c+=0x1){var _0x1133e6=this[_0x56a9('0x2b')](_0x5e3052[_0x45f38c]);if(this[_0x5e3052[_0x45f38c]+'Status']!==_0x1133e6){this[_0x5e3052[_0x45f38c]+_0x56a9('0x36')]=_[_0x56a9('0x37')](moment()['format']('x'));}this[_0x5e3052[_0x45f38c]+_0x56a9('0x38')]=_0x1133e6;}var _0x4f9be1={'id':this['id'],'name':this['name'],'online':this[_0x56a9('0x9')],'voicePause':this['voicePause'],'chatPause':this[_0x56a9('0xa')],'mailPause':this[_0x56a9('0xb')],'smsPause':this[_0x56a9('0xd')],'faxPause':this[_0x56a9('0xc')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x56a9('0xf')],'chatStatusTime':this[_0x56a9('0x39')],'chatCapacity':this[_0x56a9('0x11')],'chatCurrentCapacity':this[_0x56a9('0x12')],'mailStatus':this[_0x56a9('0x13')],'mailStatusTime':this[_0x56a9('0x14')],'mailCapacity':this[_0x56a9('0x15')],'mailCurrentCapacity':this[_0x56a9('0x16')],'faxStatus':this[_0x56a9('0x17')],'faxStatusTime':this[_0x56a9('0x3a')],'faxCapacity':this[_0x56a9('0x18')],'faxCurrentCapacity':this[_0x56a9('0x19')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x56a9('0x3b')],'smsCapacity':this[_0x56a9('0x1b')],'smsCurrentCapacity':this[_0x56a9('0x3c')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x56a9('0x1c')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x56a9('0x20')],'openchannelCapacity':this[_0x56a9('0x21')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this[_0x56a9('0x3d')],'chatWaitingInteractions':this[_0x56a9('0x24')],'faxWaitingInteractions':this[_0x56a9('0x25')],'mailWaitingInteractions':this[_0x56a9('0x26')],'openchannelWaitingInteractions':this[_0x56a9('0x27')],'smsWaitingInteractions':this[_0x56a9('0x3e')],'whatsappWaitingInteractions':this[_0x56a9('0x28')]};var _0x3f8bd0=md5(JSON[_0x56a9('0x3f')](_0x4f9be1));if(this[_0x56a9('0x1')]!==_0x3f8bd0){this['md5']=_0x3f8bd0;io['emit']('user:routing:update',_['omit'](_0x4f9be1,[_0x56a9('0x9')]));}};module[_0x56a9('0x40')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 06b15ed..c39dea9 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 _0xaf89=['updateRealtime','loggedIn','paused','chatPause','available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','strategy','Agents','mapAgentsId','waiting','updateRouting','_rr','map','prototype'];(function(_0x8bcdde,_0x52898a){var _0xc62ab3=function(_0xb60aab){while(--_0xb60aab){_0x8bcdde['push'](_0x8bcdde['shift']());}};_0xc62ab3(++_0x52898a);}(_0xaf89,0x14f));var _0x9af8=function(_0x1a0ef3,_0x535bbf){_0x1a0ef3=_0x1a0ef3-0x0;var _0x2b86da=_0xaf89[_0x1a0ef3];return _0x2b86da;};'use strict';var _=require('lodash');var md5=require(_0x9af8('0x0'));var util=require(_0x9af8('0x1'));var Redis=require(_0x9af8('0x2'));var config=require(_0x9af8('0x3'));config[_0x9af8('0x4')]=_[_0x9af8('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x9af8('0x6'))(new Redis(config[_0x9af8('0x4')]));function ChatQueue(_0x5e2426){this['id']=_0x5e2426['id']||0x0;this['name']=_0x5e2426[_0x9af8('0x7')]||'';this['timeout']=_0x5e2426['timeout']||0xa;this[_0x9af8('0x8')]=_0x5e2426[_0x9af8('0x8')]||'beepall';this[_0x9af8('0x9')]=_0x5e2426[_0x9af8('0x9')];this[_0x9af8('0xa')]={};this[_0x9af8('0xb')]=0x0;this[_0x9af8('0x0')]='';this[_0x9af8('0xc')]();this['updateRealtime']();}ChatQueue['prototype'][_0x9af8('0xc')]=function(){var _0x3815e5=this['mapAgentsId'][_0x9af8('0xd')];this[_0x9af8('0xa')]=_[_0x9af8('0xe')](this[_0x9af8('0x9')],'id');this['mapAgentsId']['_rr']=_0x3815e5;};ChatQueue[_0x9af8('0xf')][_0x9af8('0x10')]=function(){this[_0x9af8('0x11')]=0x0;this[_0x9af8('0x12')]=0x0;for(var _0x209c20=0x0;_0x209c20=0x0?this[_0x9af8('0x14')]:0x0;var _0x45dea9={'id':this['id'],'available':this[_0x9af8('0x14')],'loggedIn':this[_0x9af8('0x11')],'name':this[_0x9af8('0x7')],'paused':this['paused'],'waiting':this[_0x9af8('0xb')]};var _0x143c58=md5(JSON[_0x9af8('0x15')](_0x45dea9));if(this[_0x9af8('0x0')]!==_0x143c58){this[_0x9af8('0x0')]=_0x143c58;io['to'](util[_0x9af8('0x16')](_0x9af8('0x17'),_0x45dea9[_0x9af8('0x7')]))[_0x9af8('0x18')](_0x9af8('0x19'),_0x45dea9);}};module[_0x9af8('0x1a')]=ChatQueue; \ No newline at end of file +var _0xa664=['available','waiting','stringify','format','chat:queue:%s','emit','chat_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRealtime','prototype','updateRouting','_rr','loggedIn','paused','length','online','chatPause'];(function(_0x56d422,_0x332792){var _0x30d83c=function(_0x455d4d){while(--_0x455d4d){_0x56d422['push'](_0x56d422['shift']());}};_0x30d83c(++_0x332792);}(_0xa664,0x1e7));var _0x4a66=function(_0x42a3d3,_0x4252a7){_0x42a3d3=_0x42a3d3-0x0;var _0x2d434b=_0xa664[_0x42a3d3];return _0x2d434b;};'use strict';var _=require(_0x4a66('0x0'));var md5=require(_0x4a66('0x1'));var util=require(_0x4a66('0x2'));var Redis=require(_0x4a66('0x3'));var config=require(_0x4a66('0x4'));config[_0x4a66('0x5')]=_[_0x4a66('0x6')](config[_0x4a66('0x5')],{'host':_0x4a66('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4a66('0x5')]));function ChatQueue(_0x29b9d9){this['id']=_0x29b9d9['id']||0x0;this['name']=_0x29b9d9[_0x4a66('0x8')]||'';this[_0x4a66('0x9')]=_0x29b9d9['timeout']||0xa;this['strategy']=_0x29b9d9[_0x4a66('0xa')]||_0x4a66('0xb');this[_0x4a66('0xc')]=_0x29b9d9[_0x4a66('0xc')];this[_0x4a66('0xd')]={};this['waiting']=0x0;this[_0x4a66('0x1')]='';this['updateRouting']();this[_0x4a66('0xe')]();}ChatQueue[_0x4a66('0xf')][_0x4a66('0x10')]=function(){var _0x32026d=this[_0x4a66('0xd')][_0x4a66('0x11')];this[_0x4a66('0xd')]=_['map'](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x32026d;};ChatQueue[_0x4a66('0xf')][_0x4a66('0xe')]=function(){this[_0x4a66('0x12')]=0x0;this[_0x4a66('0x13')]=0x0;for(var _0x278983=0x0;_0x278983=0x0?this[_0x4a66('0x17')]:0x0;var _0x45aefc={'id':this['id'],'available':this[_0x4a66('0x17')],'loggedIn':this[_0x4a66('0x12')],'name':this['name'],'paused':this[_0x4a66('0x13')],'waiting':this[_0x4a66('0x18')]};var _0x12a9c3=md5(JSON[_0x4a66('0x19')](_0x45aefc));if(this['md5']!==_0x12a9c3){this['md5']=_0x12a9c3;io['to'](util[_0x4a66('0x1a')](_0x4a66('0x1b'),_0x45aefc[_0x4a66('0x8')]))[_0x4a66('0x1c')](_0x4a66('0x1d'),_0x45aefc);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 28eebac..ab67aa8 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 _0x2daa=['loggedIn','length','online','faxPause','available','paused','stringify','fax_queue:save','md5','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map'];(function(_0x25c92e,_0x47c77d){var _0x3f27d9=function(_0x30eb1b){while(--_0x30eb1b){_0x25c92e['push'](_0x25c92e['shift']());}};_0x3f27d9(++_0x47c77d);}(_0x2daa,0x166));var _0xa2da=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0x2daa[_0x5ddaac];return _0x2a9c58;};'use strict';var _=require('lodash');var md5=require(_0xa2da('0x0'));var util=require('util');var Redis=require('ioredis');var config=require(_0xa2da('0x1'));config['redis']=_['defaults'](config[_0xa2da('0x2')],{'host':_0xa2da('0x3'),'port':0x18eb});var io=require(_0xa2da('0x4'))(new Redis(config[_0xa2da('0x2')]));function FaxQueue(_0xc73cd9){this['id']=_0xc73cd9['id']||0x0;this[_0xa2da('0x5')]=_0xc73cd9[_0xa2da('0x5')]||'';this[_0xa2da('0x6')]=_0xc73cd9[_0xa2da('0x6')]||0xa;this['strategy']=_0xc73cd9[_0xa2da('0x7')]||_0xa2da('0x8');this[_0xa2da('0x9')]=_0xc73cd9[_0xa2da('0x9')];this[_0xa2da('0xa')]={};this[_0xa2da('0xb')]=0x0;this[_0xa2da('0x0')]='';this[_0xa2da('0xc')]();this[_0xa2da('0xd')]();}FaxQueue[_0xa2da('0xe')][_0xa2da('0xc')]=function(){var _0x2273ad=this[_0xa2da('0xa')][_0xa2da('0xf')];this[_0xa2da('0xa')]=_[_0xa2da('0x10')](this[_0xa2da('0x9')],'id');this[_0xa2da('0xa')][_0xa2da('0xf')]=_0x2273ad;};FaxQueue[_0xa2da('0xe')]['updateRealtime']=function(){this[_0xa2da('0x11')]=0x0;this['paused']=0x0;for(var _0x6049e7=0x0;_0x6049e7=0x0?this[_0xa2da('0x15')]:0x0;var _0x218f81={'id':this['id'],'available':this[_0xa2da('0x15')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xa2da('0xb')]};var _0xcc0abe=md5(JSON[_0xa2da('0x17')](_0x218f81));if(this[_0xa2da('0x0')]!==_0xcc0abe){this[_0xa2da('0x0')]=_0xcc0abe;io['to'](util['format']('fax:queue:%s',_0x218f81[_0xa2da('0x5')]))['emit'](_0xa2da('0x18'),_0x218f81);}};module['exports']=FaxQueue; \ No newline at end of file +var _0x084d=['prototype','updateRouting','mapAgentsId','map','_rr','loggedIn','paused','length','online','faxPause','available','stringify','fax:queue:%s','emit','fax_queue:save','exports','md5','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','waiting','updateRealtime'];(function(_0x35b07d,_0x3d0ae7){var _0x2868bc=function(_0xd8ef42){while(--_0xd8ef42){_0x35b07d['push'](_0x35b07d['shift']());}};_0x2868bc(++_0x3d0ae7);}(_0x084d,0x67));var _0xd084=function(_0x39c474,_0x3ba182){_0x39c474=_0x39c474-0x0;var _0x4ce6db=_0x084d[_0x39c474];return _0x4ce6db;};'use strict';var _=require('lodash');var md5=require(_0xd084('0x0'));var util=require('util');var Redis=require(_0xd084('0x1'));var config=require(_0xd084('0x2'));config['redis']=_[_0xd084('0x3')](config[_0xd084('0x4')],{'host':_0xd084('0x5'),'port':0x18eb});var io=require(_0xd084('0x6'))(new Redis(config[_0xd084('0x4')]));function FaxQueue(_0x5a6e0){this['id']=_0x5a6e0['id']||0x0;this[_0xd084('0x7')]=_0x5a6e0['name']||'';this[_0xd084('0x8')]=_0x5a6e0[_0xd084('0x8')]||0xa;this[_0xd084('0x9')]=_0x5a6e0[_0xd084('0x9')]||'beepall';this[_0xd084('0xa')]=_0x5a6e0[_0xd084('0xa')];this['mapAgentsId']={};this[_0xd084('0xb')]=0x0;this[_0xd084('0x0')]='';this['updateRouting']();this[_0xd084('0xc')]();}FaxQueue[_0xd084('0xd')][_0xd084('0xe')]=function(){var _0xdaca78=this[_0xd084('0xf')]['_rr'];this[_0xd084('0xf')]=_[_0xd084('0x10')](this['Agents'],'id');this[_0xd084('0xf')][_0xd084('0x11')]=_0xdaca78;};FaxQueue[_0xd084('0xd')][_0xd084('0xc')]=function(){this[_0xd084('0x12')]=0x0;this[_0xd084('0x13')]=0x0;for(var _0x2e496f=0x0;_0x2e496f=0x0?this['available']:0x0;var _0x488397={'id':this['id'],'available':this['available'],'loggedIn':this[_0xd084('0x12')],'name':this[_0xd084('0x7')],'paused':this[_0xd084('0x13')],'waiting':this[_0xd084('0xb')]};var _0x522132=md5(JSON[_0xd084('0x18')](_0x488397));if(this[_0xd084('0x0')]!==_0x522132){this['md5']=_0x522132;io['to'](util['format'](_0xd084('0x19'),_0x488397[_0xd084('0x7')]))[_0xd084('0x1a')](_0xd084('0x1b'),_0x488397);}};module[_0xd084('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 72fa50f..a7fa4d9 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 _0x379e=['Intervals','exports','name'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x379e,0x14c));var _0xe379=function(_0x41f246,_0x103097){_0x41f246=_0x41f246-0x0;var _0x1944da=_0x379e[_0x41f246];return _0x1944da;};'use strict';function Interval(_0x1a32c5){this['id']=_0x1a32c5['id']||0x0;this[_0xe379('0x0')]=_0x1a32c5[_0xe379('0x0')]||'';this['Intervals']=_0x1a32c5[_0xe379('0x1')]||{};}module[_0xe379('0x2')]=Interval; \ No newline at end of file +var _0x80bd=['name','Intervals','exports'];(function(_0x2a7c9d,_0x5af019){var _0x294b9b=function(_0x3bf1a7){while(--_0x3bf1a7){_0x2a7c9d['push'](_0x2a7c9d['shift']());}};_0x294b9b(++_0x5af019);}(_0x80bd,0x1bf));var _0xd80b=function(_0x4a0e29,_0x22ec81){_0x4a0e29=_0x4a0e29-0x0;var _0x468f89=_0x80bd[_0x4a0e29];return _0x468f89;};'use strict';function Interval(_0x3bbc42){this['id']=_0x3bbc42['id']||0x0;this['name']=_0x3bbc42[_0xd80b('0x0')]||'';this[_0xd80b('0x1')]=_0x3bbc42[_0xd80b('0x1')]||{};}module[_0xd80b('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 85ca538..c153274 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 _0xbc36=['format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','online','mailPause','available','stringify'];(function(_0x18dc4e,_0x48a30b){var _0x3a6d10=function(_0x204994){while(--_0x204994){_0x18dc4e['push'](_0x18dc4e['shift']());}};_0x3a6d10(++_0x48a30b);}(_0xbc36,0x171));var _0x6bc3=function(_0x125562,_0x46b1f8){_0x125562=_0x125562-0x0;var _0x1bf93e=_0xbc36[_0x125562];return _0x1bf93e;};'use strict';var _=require(_0x6bc3('0x0'));var md5=require(_0x6bc3('0x1'));var util=require(_0x6bc3('0x2'));var Redis=require(_0x6bc3('0x3'));var config=require(_0x6bc3('0x4'));config[_0x6bc3('0x5')]=_['defaults'](config[_0x6bc3('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6bc3('0x5')]));function MailQueue(_0x35fe8a){this['id']=_0x35fe8a['id']||0x0;this[_0x6bc3('0x6')]=_0x35fe8a[_0x6bc3('0x6')]||'';this[_0x6bc3('0x7')]=_0x35fe8a[_0x6bc3('0x7')]||0xa;this[_0x6bc3('0x8')]=_0x35fe8a[_0x6bc3('0x8')]||_0x6bc3('0x9');this['Agents']=_0x35fe8a[_0x6bc3('0xa')];this[_0x6bc3('0xb')]={};this[_0x6bc3('0xc')]=0x0;this[_0x6bc3('0x1')]='';this[_0x6bc3('0xd')]();this[_0x6bc3('0xe')]();}MailQueue[_0x6bc3('0xf')]['updateRouting']=function(){var _0x324a14=this[_0x6bc3('0xb')][_0x6bc3('0x10')];this[_0x6bc3('0xb')]=_['map'](this[_0x6bc3('0xa')],'id');this[_0x6bc3('0xb')][_0x6bc3('0x10')]=_0x324a14;};MailQueue[_0x6bc3('0xf')]['updateRealtime']=function(){this[_0x6bc3('0x11')]=0x0;this[_0x6bc3('0x12')]=0x0;for(var _0x260303=0x0;_0x260303=0x0?this[_0x6bc3('0x15')]:0x0;var _0x386824={'id':this['id'],'available':this[_0x6bc3('0x15')],'loggedIn':this[_0x6bc3('0x11')],'name':this[_0x6bc3('0x6')],'paused':this[_0x6bc3('0x12')],'waiting':this[_0x6bc3('0xc')]};var _0x27b64f=md5(JSON[_0x6bc3('0x16')](_0x386824));if(this[_0x6bc3('0x1')]!==_0x27b64f){this['md5']=_0x27b64f;io['to'](util[_0x6bc3('0x17')](_0x6bc3('0x18'),_0x386824[_0x6bc3('0x6')]))[_0x6bc3('0x19')](_0x6bc3('0x1a'),_0x386824);}};module[_0x6bc3('0x1b')]=MailQueue; \ No newline at end of file +var _0x19a7=['mail_queue:save','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','available','stringify','format','mail:queue:%s','emit'];(function(_0x19c57a,_0x5c9c7c){var _0x576a08=function(_0x929c62){while(--_0x929c62){_0x19c57a['push'](_0x19c57a['shift']());}};_0x576a08(++_0x5c9c7c);}(_0x19a7,0x92));var _0x719a=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0x19a7[_0x468b0f];return _0x3e74d9;};'use strict';var _=require(_0x719a('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x719a('0x1'));var config=require(_0x719a('0x2'));config[_0x719a('0x3')]=_[_0x719a('0x4')](config['redis'],{'host':_0x719a('0x5'),'port':0x18eb});var io=require(_0x719a('0x6'))(new Redis(config['redis']));function MailQueue(_0x228a27){this['id']=_0x228a27['id']||0x0;this[_0x719a('0x7')]=_0x228a27[_0x719a('0x7')]||'';this[_0x719a('0x8')]=_0x228a27[_0x719a('0x8')]||0xa;this[_0x719a('0x9')]=_0x228a27[_0x719a('0x9')]||'beepall';this[_0x719a('0xa')]=_0x228a27[_0x719a('0xa')];this[_0x719a('0xb')]={};this[_0x719a('0xc')]=0x0;this[_0x719a('0xd')]='';this[_0x719a('0xe')]();this[_0x719a('0xf')]();}MailQueue[_0x719a('0x10')][_0x719a('0xe')]=function(){var _0x46d11b=this['mapAgentsId'][_0x719a('0x11')];this[_0x719a('0xb')]=_[_0x719a('0x12')](this[_0x719a('0xa')],'id');this[_0x719a('0xb')][_0x719a('0x11')]=_0x46d11b;};MailQueue[_0x719a('0x10')][_0x719a('0xf')]=function(){this[_0x719a('0x13')]=0x0;this[_0x719a('0x14')]=0x0;for(var _0x4bc6a5=0x0;_0x4bc6a5=0x0?this[_0x719a('0x17')]:0x0;var _0x57a323={'id':this['id'],'available':this[_0x719a('0x17')],'loggedIn':this[_0x719a('0x13')],'name':this[_0x719a('0x7')],'paused':this['paused'],'waiting':this[_0x719a('0xc')]};var _0x5ebff2=md5(JSON[_0x719a('0x18')](_0x57a323));if(this['md5']!==_0x5ebff2){this[_0x719a('0xd')]=_0x5ebff2;io['to'](util[_0x719a('0x19')](_0x719a('0x1a'),_0x57a323['name']))[_0x719a('0x1b')](_0x719a('0x1c'),_0x57a323);}};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 962fd24..35bb42e 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(_0x427f38,_0x34f332){var _0x2f39d7=function(_0x593940){while(--_0x593940){_0x427f38['push'](_0x427f38['shift']());}};_0x2f39d7(++_0x34f332);}(_0x5fc3,0xa8));var _0x35fc=function(_0x274dd7,_0x2e6051){_0x274dd7=_0x274dd7-0x0;var _0x148829=_0x5fc3[_0x274dd7];return _0x148829;};'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 _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xc4aa[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index e87455e..8c53f23 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 _0x0cfa=['timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','length','online','smsPause','paused','available','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','util','ioredis','redis','socket.io-emitter','name'];(function(_0x15ce3a,_0x1cf22c){var _0x202f3b=function(_0xd3605e){while(--_0xd3605e){_0x15ce3a['push'](_0x15ce3a['shift']());}};_0x202f3b(++_0x1cf22c);}(_0x0cfa,0x18f));var _0xa0cf=function(_0x1d23a5,_0x3840f4){_0x1d23a5=_0x1d23a5-0x0;var _0x314337=_0x0cfa[_0x1d23a5];return _0x314337;};'use strict';var _=require(_0xa0cf('0x0'));var md5=require(_0xa0cf('0x1'));var util=require(_0xa0cf('0x2'));var Redis=require(_0xa0cf('0x3'));var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0xa0cf('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xa0cf('0x5'))(new Redis(config[_0xa0cf('0x4')]));function SmsQueue(_0x19f827){this['id']=_0x19f827['id']||0x0;this[_0xa0cf('0x6')]=_0x19f827['name']||'';this[_0xa0cf('0x7')]=_0x19f827['timeout']||0xa;this[_0xa0cf('0x8')]=_0x19f827['strategy']||_0xa0cf('0x9');this['Agents']=_0x19f827[_0xa0cf('0xa')];this[_0xa0cf('0xb')]={};this[_0xa0cf('0xc')]=0x0;this['md5']='';this[_0xa0cf('0xd')]();this[_0xa0cf('0xe')]();}SmsQueue['prototype']['updateRouting']=function(){var _0xe98d2a=this[_0xa0cf('0xb')][_0xa0cf('0xf')];this['mapAgentsId']=_[_0xa0cf('0x10')](this[_0xa0cf('0xa')],'id');this[_0xa0cf('0xb')][_0xa0cf('0xf')]=_0xe98d2a;};SmsQueue[_0xa0cf('0x11')][_0xa0cf('0xe')]=function(){this[_0xa0cf('0x12')]=0x0;this['paused']=0x0;for(var _0x560c9b=0x0;_0x560c9b=0x0?this[_0xa0cf('0x17')]:0x0;var _0x53a186={'id':this['id'],'available':this[_0xa0cf('0x17')],'loggedIn':this[_0xa0cf('0x12')],'name':this[_0xa0cf('0x6')],'paused':this[_0xa0cf('0x16')],'waiting':this[_0xa0cf('0xc')]};var _0x8bb2ab=md5(JSON['stringify'](_0x53a186));if(this[_0xa0cf('0x1')]!==_0x8bb2ab){this[_0xa0cf('0x1')]=_0x8bb2ab;io['to'](util[_0xa0cf('0x18')](_0xa0cf('0x19'),_0x53a186[_0xa0cf('0x6')]))[_0xa0cf('0x1a')](_0xa0cf('0x1b'),_0x53a186);}};module[_0xa0cf('0x1c')]=SmsQueue; \ No newline at end of file +var _0x9b67=['redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','available','stringify','sms:queue:%s','emit','exports','lodash','md5','util','ioredis','../../../config/environment','defaults'];(function(_0x3db75a,_0xaf6f8d){var _0x10d96d=function(_0x2ee206){while(--_0x2ee206){_0x3db75a['push'](_0x3db75a['shift']());}};_0x10d96d(++_0xaf6f8d);}(_0x9b67,0xf6));var _0x79b6=function(_0x546256,_0x87208){_0x546256=_0x546256-0x0;var _0x40eb74=_0x9b67[_0x546256];return _0x40eb74;};'use strict';var _=require(_0x79b6('0x0'));var md5=require(_0x79b6('0x1'));var util=require(_0x79b6('0x2'));var Redis=require(_0x79b6('0x3'));var config=require(_0x79b6('0x4'));config['redis']=_[_0x79b6('0x5')](config[_0x79b6('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x79b6('0x6')]));function SmsQueue(_0x174768){this['id']=_0x174768['id']||0x0;this[_0x79b6('0x7')]=_0x174768[_0x79b6('0x7')]||'';this[_0x79b6('0x8')]=_0x174768[_0x79b6('0x8')]||0xa;this[_0x79b6('0x9')]=_0x174768['strategy']||_0x79b6('0xa');this[_0x79b6('0xb')]=_0x174768[_0x79b6('0xb')];this[_0x79b6('0xc')]={};this[_0x79b6('0xd')]=0x0;this['md5']='';this[_0x79b6('0xe')]();this[_0x79b6('0xf')]();}SmsQueue[_0x79b6('0x10')][_0x79b6('0xe')]=function(){var _0x58a98b=this['mapAgentsId'][_0x79b6('0x11')];this[_0x79b6('0xc')]=_[_0x79b6('0x12')](this['Agents'],'id');this[_0x79b6('0xc')][_0x79b6('0x11')]=_0x58a98b;};SmsQueue[_0x79b6('0x10')][_0x79b6('0xf')]=function(){this[_0x79b6('0x13')]=0x0;this[_0x79b6('0x14')]=0x0;for(var _0x19d5b2=0x0;_0x19d5b2=0x0?this[_0x79b6('0x17')]:0x0;var _0x3123b8={'id':this['id'],'available':this[_0x79b6('0x17')],'loggedIn':this[_0x79b6('0x13')],'name':this[_0x79b6('0x7')],'paused':this[_0x79b6('0x14')],'waiting':this[_0x79b6('0xd')]};var _0x52a70f=md5(JSON[_0x79b6('0x18')](_0x3123b8));if(this['md5']!==_0x52a70f){this[_0x79b6('0x1')]=_0x52a70f;io['to'](util['format'](_0x79b6('0x19'),_0x3123b8[_0x79b6('0x7')]))[_0x79b6('0x1a')]('sms_queue:save',_0x3123b8);}};module[_0x79b6('0x1b')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 1c5d17e..4efa242 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 _0x7412=['util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','map','prototype','updateRealtime','loggedIn','length','paused','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0x7412,0x8f));var _0x2741=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0x7412[_0x556927];return _0x5f1235;};'use strict';var _=require(_0x2741('0x0'));var md5=require(_0x2741('0x1'));var util=require(_0x2741('0x2'));var Redis=require(_0x2741('0x3'));var config=require(_0x2741('0x4'));config[_0x2741('0x5')]=_['defaults'](config[_0x2741('0x5')],{'host':_0x2741('0x6'),'port':0x18eb});var io=require(_0x2741('0x7'))(new Redis(config[_0x2741('0x5')]));function WhatsappQueue(_0x1b62e9){this['id']=_0x1b62e9['id']||0x0;this['name']=_0x1b62e9[_0x2741('0x8')]||'';this[_0x2741('0x9')]=_0x1b62e9[_0x2741('0x9')]||0xa;this[_0x2741('0xa')]=_0x1b62e9[_0x2741('0xa')]||_0x2741('0xb');this[_0x2741('0xc')]=_0x1b62e9[_0x2741('0xc')];this[_0x2741('0xd')]={};this[_0x2741('0xe')]=0x0;this['md5']='';this['updateRouting']();this['updateRealtime']();}WhatsappQueue['prototype'][_0x2741('0xf')]=function(){var _0x31c66b=this[_0x2741('0xd')]['_rr'];this[_0x2741('0xd')]=_[_0x2741('0x10')](this[_0x2741('0xc')],'id');this[_0x2741('0xd')]['_rr']=_0x31c66b;};WhatsappQueue[_0x2741('0x11')][_0x2741('0x12')]=function(){this[_0x2741('0x13')]=0x0;this['paused']=0x0;for(var _0x24b83c=0x0;_0x24b83c=0x0?this[_0x2741('0x16')]:0x0;var _0x4404f8={'id':this['id'],'available':this[_0x2741('0x16')],'loggedIn':this['loggedIn'],'name':this[_0x2741('0x8')],'paused':this[_0x2741('0x15')],'waiting':this[_0x2741('0xe')]};var _0x85c9ab=md5(JSON[_0x2741('0x17')](_0x4404f8));if(this['md5']!==_0x85c9ab){this[_0x2741('0x1')]=_0x85c9ab;io['to'](util[_0x2741('0x18')](_0x2741('0x19'),_0x4404f8[_0x2741('0x8')]))[_0x2741('0x1a')](_0x2741('0x1b'),_0x4404f8);}};module[_0x2741('0x1c')]=WhatsappQueue; \ No newline at end of file +var _0x23d9=['updateRealtime','prototype','_rr','loggedIn','paused','length','online','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x23d9,0x13b));var _0x923d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x23d9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x923d('0x0'));var md5=require(_0x923d('0x1'));var util=require(_0x923d('0x2'));var Redis=require(_0x923d('0x3'));var config=require(_0x923d('0x4'));config['redis']=_[_0x923d('0x5')](config[_0x923d('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x923d('0x7'))(new Redis(config[_0x923d('0x6')]));function WhatsappQueue(_0x57bb3e){this['id']=_0x57bb3e['id']||0x0;this['name']=_0x57bb3e[_0x923d('0x8')]||'';this['timeout']=_0x57bb3e[_0x923d('0x9')]||0xa;this[_0x923d('0xa')]=_0x57bb3e[_0x923d('0xa')]||_0x923d('0xb');this[_0x923d('0xc')]=_0x57bb3e['Agents'];this[_0x923d('0xd')]={};this[_0x923d('0xe')]=0x0;this[_0x923d('0x1')]='';this['updateRouting']();this[_0x923d('0xf')]();}WhatsappQueue[_0x923d('0x10')]['updateRouting']=function(){var _0x5d2c1b=this[_0x923d('0xd')]['_rr'];this[_0x923d('0xd')]=_['map'](this[_0x923d('0xc')],'id');this[_0x923d('0xd')][_0x923d('0x11')]=_0x5d2c1b;};WhatsappQueue['prototype'][_0x923d('0xf')]=function(){this[_0x923d('0x12')]=0x0;this[_0x923d('0x13')]=0x0;for(var _0x28e4b5=0x0;_0x28e4b5=0x0?this[_0x923d('0x17')]:0x0;var _0x8732b9={'id':this['id'],'available':this[_0x923d('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x923d('0x8')],'paused':this['paused'],'waiting':this[_0x923d('0xe')]};var _0x55b550=md5(JSON[_0x923d('0x18')](_0x8732b9));if(this[_0x923d('0x1')]!==_0x55b550){this[_0x923d('0x1')]=_0x55b550;io['to'](util[_0x923d('0x19')](_0x923d('0x1a'),_0x8732b9['name']))[_0x923d('0x1b')](_0x923d('0x1c'),_0x8732b9);}};module[_0x923d('0x1d')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 2ca2e1b..8f8ad69 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(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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(_0x3b73fa,_0x63edc5){var _0x488e4b=function(_0x3a45e3){while(--_0x3a45e3){_0x3b73fa['push'](_0x3b73fa['shift']());}};_0x488e4b(++_0x63edc5);}(_0xb10b,0x12a));var _0xbb10=function(_0x24c39a,_0x48fc91){_0x24c39a=_0x24c39a-0x0;var _0x4c2fa6=_0xb10b[_0x24c39a];return _0x4c2fa6;};'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 b7900a5..9bf8ff0 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 _0xa0b7=['Request','addTagsToChatInteraction','../client','update','updateChatInteraction'];(function(_0x14b020,_0x5f3bc1){var _0x34965d=function(_0x1d8f8c){while(--_0x1d8f8c){_0x14b020['push'](_0x14b020['shift']());}};_0x34965d(++_0x5f3bc1);}(_0xa0b7,0x93));var _0x7a0b=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xa0b7[_0xfae23b];return _0x200640;};'use strict';var client=require(_0x7a0b('0x0'));exports[_0x7a0b('0x1')]=function(_0x231b14,_0x5d5f63){return client['Request']('UpdateChatInteraction',{'body':_0x5d5f63,'options':{'where':{'id':_0x231b14}},'log':_0x7a0b('0x2')});};exports['addTags']=function(_0x3fa4bf,_0x2cda09){return client[_0x7a0b('0x3')]('AddTagsToChatInteraction',{'body':_0x2cda09,'options':{'where':{'id':_0x3fa4bf}},'log':_0x7a0b('0x4')});}; \ No newline at end of file +var _0xbe94=['../client','update','UpdateChatInteraction','updateChatInteraction','addTags','Request','addTagsToChatInteraction'];(function(_0x78e522,_0x37c539){var _0x4a170d=function(_0x2ef664){while(--_0x2ef664){_0x78e522['push'](_0x78e522['shift']());}};_0x4a170d(++_0x37c539);}(_0xbe94,0xb6));var _0x4be9=function(_0x2109ff,_0x59366e){_0x2109ff=_0x2109ff-0x0;var _0x1b22e6=_0xbe94[_0x2109ff];return _0x1b22e6;};'use strict';var client=require(_0x4be9('0x0'));exports[_0x4be9('0x1')]=function(_0x1c72ee,_0x2ce900){return client['Request'](_0x4be9('0x2'),{'body':_0x2ce900,'options':{'where':{'id':_0x1c72ee}},'log':_0x4be9('0x3')});};exports[_0x4be9('0x4')]=function(_0x47927d,_0x58df5d){return client[_0x4be9('0x5')]('AddTagsToChatInteraction',{'body':_0x58df5d,'options':{'where':{'id':_0x47927d}},'log':_0x4be9('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index c463f64..e4be8a3 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 _0xd7f2=['create','Request','createChatMessage','../client'];(function(_0x1e948a,_0x4188f3){var _0xd6959=function(_0x435550){while(--_0x435550){_0x1e948a['push'](_0x1e948a['shift']());}};_0xd6959(++_0x4188f3);}(_0xd7f2,0xef));var _0x2d7f=function(_0x385757,_0x1d67e4){_0x385757=_0x385757-0x0;var _0x27e764=_0xd7f2[_0x385757];return _0x27e764;};'use strict';var client=require(_0x2d7f('0x0'));exports[_0x2d7f('0x1')]=function(_0x3abb9f){return client[_0x2d7f('0x2')]('CreateChatMessage',{'body':_0x3abb9f,'log':_0x2d7f('0x3')});}; \ No newline at end of file +var _0x6957=['Request','CreateChatMessage','../client','create'];(function(_0x11ecca,_0x55ff30){var _0xfdb50d=function(_0x229ec5){while(--_0x229ec5){_0x11ecca['push'](_0x11ecca['shift']());}};_0xfdb50d(++_0x55ff30);}(_0x6957,0xaa));var _0x7695=function(_0x38f709,_0x5adf17){_0x38f709=_0x38f709-0x0;var _0x4affe0=_0x6957[_0x38f709];return _0x4affe0;};'use strict';var client=require(_0x7695('0x0'));exports[_0x7695('0x1')]=function(_0x2ae3ef){return client[_0x7695('0x2')](_0x7695('0x3'),{'body':_0x2ae3ef,'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 87c5a82..cea16e0 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 _0xf873=['GetChatQueue','name','timeout','strategy','User','Agents','chatPause','getChatQueues','Request'];(function(_0x3eea06,_0x303898){var _0x47e4c4=function(_0x2e27fe){while(--_0x2e27fe){_0x3eea06['push'](_0x3eea06['shift']());}};_0x47e4c4(++_0x303898);}(_0xf873,0xb2));var _0x3f87=function(_0xfd177a,_0x2ff02a){_0xfd177a=_0xfd177a-0x0;var _0x329ef9=_0xf873[_0xfd177a];return _0x329ef9;};'use strict';var client=require('../client');exports[_0x3f87('0x0')]=function(){return function(){return client[_0x3f87('0x1')](_0x3f87('0x2'),{'options':{'raw':![],'attributes':['id',_0x3f87('0x3'),_0x3f87('0x4'),_0x3f87('0x5')],'include':[{'model':_0x3f87('0x6'),'as':_0x3f87('0x7'),'attributes':['id',_0x3f87('0x3'),'online',_0x3f87('0x8')]}]},'log':_0x3f87('0x0')});};}; \ No newline at end of file +var _0x0c42=['name','User','Agents','online','chatPause','../client','getChatQueues','Request','GetChatQueue'];(function(_0x208c01,_0x2dd63d){var _0x54a5fc=function(_0x35120d){while(--_0x35120d){_0x208c01['push'](_0x208c01['shift']());}};_0x54a5fc(++_0x2dd63d);}(_0x0c42,0x191));var _0x20c4=function(_0x110cde,_0x1afc5f){_0x110cde=_0x110cde-0x0;var _0x53c55f=_0x0c42[_0x110cde];return _0x53c55f;};'use strict';var client=require(_0x20c4('0x0'));exports[_0x20c4('0x1')]=function(){return function(){return client[_0x20c4('0x2')](_0x20c4('0x3'),{'options':{'raw':![],'attributes':['id',_0x20c4('0x4'),'timeout','strategy'],'include':[{'model':_0x20c4('0x5'),'as':_0x20c4('0x6'),'attributes':['id',_0x20c4('0x4'),_0x20c4('0x7'),_0x20c4('0x8')]}]},'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 5f0b618..328f83f 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 _0xccdc=['update','Request','UpdateChatQueueReport','DESC','../client','create','CreateChatQueueReport'];(function(_0xb4ec3a,_0x2bace0){var _0x1b83db=function(_0x5278f3){while(--_0x5278f3){_0xb4ec3a['push'](_0xb4ec3a['shift']());}};_0x1b83db(++_0x2bace0);}(_0xccdc,0x1c4));var _0xcccd=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xccdc[_0x6cf19c];return _0xce14f3;};'use strict';var client=require(_0xcccd('0x0'));exports[_0xcccd('0x1')]=function(_0x48efea){return client['Request'](_0xcccd('0x2'),{'body':_0x48efea,'log':_0xcccd('0x2')});};exports[_0xcccd('0x3')]=function(_0x183a99,_0x41cab2){return client[_0xcccd('0x4')](_0xcccd('0x5'),{'body':_0x41cab2,'options':{'where':{'uniqueid':_0x183a99},'order':[['id',_0xcccd('0x6')]],'limit':0x1},'log':_0xcccd('0x5')});}; \ No newline at end of file +var _0x8c25=['../client','create','Request','CreateChatQueueReport','DESC'];(function(_0x2ba9ac,_0xa1fdc4){var _0x1b0fc9=function(_0x4343de){while(--_0x4343de){_0x2ba9ac['push'](_0x2ba9ac['shift']());}};_0x1b0fc9(++_0xa1fdc4);}(_0x8c25,0x15e));var _0x58c2=function(_0x3b3931,_0x2aa0c1){_0x3b3931=_0x3b3931-0x0;var _0x9747e0=_0x8c25[_0x3b3931];return _0x9747e0;};'use strict';var client=require(_0x58c2('0x0'));exports[_0x58c2('0x1')]=function(_0x2c2f26){return client[_0x58c2('0x2')](_0x58c2('0x3'),{'body':_0x2c2f26,'log':_0x58c2('0x3')});};exports['update']=function(_0x2808d9,_0x4b834a){return client['Request']('UpdateChatQueueReport',{'body':_0x4b834a,'options':{'where':{'uniqueid':_0x2808d9},'order':[['id',_0x58c2('0x4')]],'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 cc205db..b8ae80e 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(_0x515e24,_0x70620b){var _0xe6ee8=function(_0x26c517){while(--_0x26c517){_0x515e24['push'](_0x515e24['shift']());}};_0xe6ee8(++_0x70620b);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x229128,_0x273558){var _0x1875b9=function(_0x275e35){while(--_0x275e35){_0x229128['push'](_0x229128['shift']());}};_0x1875b9(++_0x273558);}(_0x7a54,0x106));var _0x47a5=function(_0x40680d,_0x4f1bfb){_0x40680d=_0x40680d-0x0;var _0x4cfbc2=_0x7a54[_0x40680d];return _0x4cfbc2;};'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 212b119..9d9918d 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 _0xfef1=['../client','create','Request','CreateFaxMessage'];(function(_0x27dbcf,_0x435eba){var _0xdc91bc=function(_0x21a1f0){while(--_0x21a1f0){_0x27dbcf['push'](_0x27dbcf['shift']());}};_0xdc91bc(++_0x435eba);}(_0xfef1,0x1d8));var _0x1fef=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xfef1[_0x4ea69d];return _0x5318e0;};'use strict';var client=require(_0x1fef('0x0'));exports[_0x1fef('0x1')]=function(_0x4cc777){return client[_0x1fef('0x2')](_0x1fef('0x3'),{'body':_0x4cc777,'log':'createFaxMessage'});}; \ No newline at end of file +var _0x06fb=['Request','createFaxMessage','../client','create'];(function(_0x1a7e4b,_0x2fbd40){var _0x37a8fd=function(_0x4eaa73){while(--_0x4eaa73){_0x1a7e4b['push'](_0x1a7e4b['shift']());}};_0x37a8fd(++_0x2fbd40);}(_0x06fb,0x112));var _0xb06f=function(_0x42cd08,_0x2467dd){_0x42cd08=_0x42cd08-0x0;var _0x2ed9a7=_0x06fb[_0x42cd08];return _0x2ed9a7;};'use strict';var client=require(_0xb06f('0x0'));exports[_0xb06f('0x1')]=function(_0x3c1929){return client[_0xb06f('0x2')]('CreateFaxMessage',{'body':_0x3c1929,'log':_0xb06f('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 93c9f52..b4e42d0 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 _0xe35e=['strategy','User','online','faxPause','../client','getFaxQueues','Request','name','timeout'];(function(_0x200e0c,_0x5e715d){var _0x2b2175=function(_0x2eab0e){while(--_0x2eab0e){_0x200e0c['push'](_0x200e0c['shift']());}};_0x2b2175(++_0x5e715d);}(_0xe35e,0x148));var _0xee35=function(_0x269ee8,_0x477226){_0x269ee8=_0x269ee8-0x0;var _0x4d98bd=_0xe35e[_0x269ee8];return _0x4d98bd;};'use strict';var client=require(_0xee35('0x0'));exports[_0xee35('0x1')]=function(){return function(){return client[_0xee35('0x2')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0xee35('0x3'),_0xee35('0x4'),_0xee35('0x5')],'include':[{'model':_0xee35('0x6'),'as':'Agents','attributes':['id','name',_0xee35('0x7'),_0xee35('0x8')]}]},'log':_0xee35('0x1')});};}; \ No newline at end of file +var _0xd15e=['getFaxQueues','Request','GetFaxQueue','name','strategy','User','faxPause'];(function(_0x4fb51c,_0x4a4b6b){var _0x217373=function(_0x6e11d5){while(--_0x6e11d5){_0x4fb51c['push'](_0x4fb51c['shift']());}};_0x217373(++_0x4a4b6b);}(_0xd15e,0x1e3));var _0xed15=function(_0x5ba6d4,_0x5913d6){_0x5ba6d4=_0x5ba6d4-0x0;var _0x5af907=_0xd15e[_0x5ba6d4];return _0x5af907;};'use strict';var client=require('../client');exports[_0xed15('0x0')]=function(){return function(){return client[_0xed15('0x1')](_0xed15('0x2'),{'options':{'raw':![],'attributes':['id',_0xed15('0x3'),'timeout',_0xed15('0x4')],'include':[{'model':_0xed15('0x5'),'as':'Agents','attributes':['id',_0xed15('0x3'),'online',_0xed15('0x6')]}]},'log':_0xed15('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index ad46a9a..7784f36 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 _0x6a84=['CreateFaxQueueReport','Request','DESC','UpdateFaxQueueReport','create'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x6a84,0x158));var _0x46a8=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x6a84[_0x543084];return _0x306a57;};'use strict';var client=require('../client');exports[_0x46a8('0x0')]=function(_0x57160b){return client['Request'](_0x46a8('0x1'),{'body':_0x57160b,'log':_0x46a8('0x1')});};exports['update']=function(_0x4bd3c1,_0x2765a3){return client[_0x46a8('0x2')]('UpdateFaxQueueReport',{'body':_0x2765a3,'options':{'where':{'uniqueid':_0x4bd3c1},'order':[['id',_0x46a8('0x3')]],'limit':0x1},'log':_0x46a8('0x4')});}; \ No newline at end of file +var _0x9096=['create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client'];(function(_0x28f982,_0x3d108c){var _0x4dfb7e=function(_0x54a345){while(--_0x54a345){_0x28f982['push'](_0x28f982['shift']());}};_0x4dfb7e(++_0x3d108c);}(_0x9096,0x117));var _0x6909=function(_0x6158cf,_0x58bbbc){_0x6158cf=_0x6158cf-0x0;var _0xe2accf=_0x9096[_0x6158cf];return _0xe2accf;};'use strict';var client=require(_0x6909('0x0'));exports[_0x6909('0x1')]=function(_0x54fcb1){return client[_0x6909('0x2')](_0x6909('0x3'),{'body':_0x54fcb1,'log':_0x6909('0x3')});};exports[_0x6909('0x4')]=function(_0x383821,_0x40fc90){return client[_0x6909('0x2')](_0x6909('0x5'),{'body':_0x40fc90,'options':{'where':{'uniqueid':_0x383821},'order':[['id',_0x6909('0x6')]],'limit':0x1},'log':_0x6909('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 5d5e270..9c20ce9 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 _0x068d=['../client','Request','GetInterval','Interval','Intervals','name','interval','getIntervals'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x068d,0x68));var _0xd068=function(_0x19f9d7,_0x614db2){_0x19f9d7=_0x19f9d7-0x0;var _0x4d377a=_0x068d[_0x19f9d7];return _0x4d377a;};'use strict';var client=require(_0xd068('0x0'));exports['getIntervals']=function(){return function(){return client[_0xd068('0x1')](_0xd068('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xd068('0x3'),'as':_0xd068('0x4'),'attributes':['id',_0xd068('0x5'),_0xd068('0x6')]}]},'log':_0xd068('0x7')});};}; \ No newline at end of file +var _0x3999=['Intervals','interval','../client','getIntervals','name','Interval'];(function(_0xa38daf,_0x30406b){var _0x1b786a=function(_0x375bfd){while(--_0x375bfd){_0xa38daf['push'](_0xa38daf['shift']());}};_0x1b786a(++_0x30406b);}(_0x3999,0x12e));var _0x9399=function(_0xf3578c,_0x58f9aa){_0xf3578c=_0xf3578c-0x0;var _0x3a7275=_0x3999[_0xf3578c];return _0x3a7275;};'use strict';var client=require(_0x9399('0x0'));exports[_0x9399('0x1')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x9399('0x2')],'include':[{'model':_0x9399('0x3'),'as':_0x9399('0x4'),'attributes':['id',_0x9399('0x2'),_0x9399('0x5')]}]},'log':_0x9399('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 7a35be7..b6b7937 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 _0x7708=['update','AddTagsToMailInteraction','../client'];(function(_0x1f027d,_0x4eb301){var _0x12e5ee=function(_0x28ebb8){while(--_0x28ebb8){_0x1f027d['push'](_0x1f027d['shift']());}};_0x12e5ee(++_0x4eb301);}(_0x7708,0x188));var _0x8770=function(_0x5c4585,_0x3d0eab){_0x5c4585=_0x5c4585-0x0;var _0x21dede=_0x7708[_0x5c4585];return _0x21dede;};'use strict';var client=require(_0x8770('0x0'));exports[_0x8770('0x1')]=function(_0x5ce108,_0x141ddf){return client['Request']('UpdateMailInteraction',{'body':_0x141ddf,'options':{'where':{'id':_0x5ce108}},'log':'updateMailInteraction'});};exports['addTags']=function(_0x182d52,_0x1a796d){return client['Request'](_0x8770('0x2'),{'body':_0x1a796d,'options':{'where':{'id':_0x182d52}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x77e6=['addTags','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x57da0a,_0x284aed){var _0x3145d5=function(_0xfe7c3b){while(--_0xfe7c3b){_0x57da0a['push'](_0x57da0a['shift']());}};_0x3145d5(++_0x284aed);}(_0x77e6,0x1a6));var _0x677e=function(_0xc1d5dd,_0x43ff14){_0xc1d5dd=_0xc1d5dd-0x0;var _0x1f2db2=_0x77e6[_0xc1d5dd];return _0x1f2db2;};'use strict';var client=require(_0x677e('0x0'));exports[_0x677e('0x1')]=function(_0x3855c7,_0xa48f0c){return client[_0x677e('0x2')](_0x677e('0x3'),{'body':_0xa48f0c,'options':{'where':{'id':_0x3855c7}},'log':_0x677e('0x4')});};exports[_0x677e('0x5')]=function(_0x50231c,_0x2f0307){return client[_0x677e('0x2')]('AddTagsToMailInteraction',{'body':_0x2f0307,'options':{'where':{'id':_0x50231c}},'log':_0x677e('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 0b0c148..222abc3 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 _0x5cdb=['CreateMailMessage','../client','create'];(function(_0x40973b,_0x5ca6b1){var _0x4c9765=function(_0x19077b){while(--_0x19077b){_0x40973b['push'](_0x40973b['shift']());}};_0x4c9765(++_0x5ca6b1);}(_0x5cdb,0x18d));var _0xb5cd=function(_0x1ebdca,_0x44732d){_0x1ebdca=_0x1ebdca-0x0;var _0x106295=_0x5cdb[_0x1ebdca];return _0x106295;};'use strict';var client=require(_0xb5cd('0x0'));exports[_0xb5cd('0x1')]=function(_0x8a9092){return client['Request'](_0xb5cd('0x2'),{'body':_0x8a9092,'log':'createMailMessage'});}; \ No newline at end of file +var _0x1ce2=['create','Request','CreateMailMessage','createMailMessage','../client'];(function(_0x5dca2b,_0x156511){var _0x22aab=function(_0x3eedcc){while(--_0x3eedcc){_0x5dca2b['push'](_0x5dca2b['shift']());}};_0x22aab(++_0x156511);}(_0x1ce2,0x77));var _0x21ce=function(_0x1f5d42,_0x1c5ece){_0x1f5d42=_0x1f5d42-0x0;var _0x1f9ebb=_0x1ce2[_0x1f5d42];return _0x1f9ebb;};'use strict';var client=require(_0x21ce('0x0'));exports[_0x21ce('0x1')]=function(_0x21b3a7){return client[_0x21ce('0x2')](_0x21ce('0x3'),{'body':_0x21b3a7,'log':_0x21ce('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index ddb758d..58d5eb5 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 _0x859b=['name','online','mailPause','../client','getMailQueues','Request','GetMailQueue'];(function(_0x1f029c,_0x1e2b73){var _0x3ebbea=function(_0x441626){while(--_0x441626){_0x1f029c['push'](_0x1f029c['shift']());}};_0x3ebbea(++_0x1e2b73);}(_0x859b,0xf8));var _0xb859=function(_0x2ad7f4,_0x25ffb3){_0x2ad7f4=_0x2ad7f4-0x0;var _0x525f20=_0x859b[_0x2ad7f4];return _0x525f20;};'use strict';var client=require(_0xb859('0x0'));exports[_0xb859('0x1')]=function(){return function(){return client[_0xb859('0x2')](_0xb859('0x3'),{'options':{'raw':![],'attributes':['id',_0xb859('0x4'),'timeout','strategy'],'include':[{'model':'User','as':'Agents','attributes':['id',_0xb859('0x4'),_0xb859('0x5'),_0xb859('0x6')]}]},'log':_0xb859('0x1')});};}; \ No newline at end of file +var _0x92dd=['timeout','Agents','../client','Request','GetMailQueue','name'];(function(_0x3bab53,_0x46230f){var _0x1a969e=function(_0x15ecb1){while(--_0x15ecb1){_0x3bab53['push'](_0x3bab53['shift']());}};_0x1a969e(++_0x46230f);}(_0x92dd,0xbc));var _0xd92d=function(_0x4321a0,_0x1f0ee5){_0x4321a0=_0x4321a0-0x0;var _0x5d7f81=_0x92dd[_0x4321a0];return _0x5d7f81;};'use strict';var client=require(_0xd92d('0x0'));exports['getMailQueues']=function(){return function(){return client[_0xd92d('0x1')](_0xd92d('0x2'),{'options':{'raw':![],'attributes':['id',_0xd92d('0x3'),_0xd92d('0x4'),'strategy'],'include':[{'model':'User','as':_0xd92d('0x5'),'attributes':['id',_0xd92d('0x3'),'online','mailPause']}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index e15984e..cb7e89b 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 _0xea92=['update','UpdateMailQueueReport','DESC','create','Request','CreateMailQueueReport'];(function(_0x1e0357,_0x5ae9f8){var _0x3af747=function(_0x15b29e){while(--_0x15b29e){_0x1e0357['push'](_0x1e0357['shift']());}};_0x3af747(++_0x5ae9f8);}(_0xea92,0x171));var _0x2ea9=function(_0x153f59,_0xcfdfb){_0x153f59=_0x153f59-0x0;var _0x1483c6=_0xea92[_0x153f59];return _0x1483c6;};'use strict';var client=require('../client');exports[_0x2ea9('0x0')]=function(_0x404cc4){return client[_0x2ea9('0x1')](_0x2ea9('0x2'),{'body':_0x404cc4,'log':'CreateMailQueueReport'});};exports[_0x2ea9('0x3')]=function(_0x37b1a2,_0x46134b){return client['Request'](_0x2ea9('0x4'),{'body':_0x46134b,'options':{'where':{'uniqueid':_0x37b1a2},'order':[['id',_0x2ea9('0x5')]],'limit':0x1},'log':_0x2ea9('0x4')});}; \ No newline at end of file +var _0xdc5a=['DESC','../client','create','Request','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdc5a,0x17b));var _0xadc5=function(_0x2b3ce6,_0x2f6839){_0x2b3ce6=_0x2b3ce6-0x0;var _0x4fa551=_0xdc5a[_0x2b3ce6];return _0x4fa551;};'use strict';var client=require(_0xadc5('0x0'));exports[_0xadc5('0x1')]=function(_0x52c2ae){return client[_0xadc5('0x2')](_0xadc5('0x3'),{'body':_0x52c2ae,'log':_0xadc5('0x3')});};exports[_0xadc5('0x4')]=function(_0x5a3f53,_0x10d733){return client[_0xadc5('0x2')](_0xadc5('0x5'),{'body':_0x10d733,'options':{'where':{'uniqueid':_0x5a3f53},'order':[['id',_0xadc5('0x6')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 79f66b0..d0324f2 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 _0xb252=['addTagsToChatInteraction','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction'];(function(_0x2c98f5,_0x3505bd){var _0x1d5794=function(_0x4b511b){while(--_0x4b511b){_0x2c98f5['push'](_0x2c98f5['shift']());}};_0x1d5794(++_0x3505bd);}(_0xb252,0x119));var _0x2b25=function(_0x13d995,_0x30e77d){_0x13d995=_0x13d995-0x0;var _0x30999a=_0xb252[_0x13d995];return _0x30999a;};'use strict';var client=require('../client');exports[_0x2b25('0x0')]=function(_0x4525b4,_0x501147){return client[_0x2b25('0x1')](_0x2b25('0x2'),{'body':_0x501147,'options':{'where':{'id':_0x4525b4}},'log':_0x2b25('0x3')});};exports[_0x2b25('0x4')]=function(_0x298bbf,_0x20ec53){return client['Request'](_0x2b25('0x5'),{'body':_0x20ec53,'options':{'where':{'id':_0x298bbf}},'log':_0x2b25('0x6')});}; \ No newline at end of file +var _0x136e=['update','updateOpenchannelInteraction','addTags','Request','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client'];(function(_0x283e65,_0x5e5a81){var _0x1996c2=function(_0x3353fd){while(--_0x3353fd){_0x283e65['push'](_0x283e65['shift']());}};_0x1996c2(++_0x5e5a81);}(_0x136e,0x1e9));var _0xe136=function(_0x19ba34,_0x12bc3c){_0x19ba34=_0x19ba34-0x0;var _0x340938=_0x136e[_0x19ba34];return _0x340938;};'use strict';var client=require(_0xe136('0x0'));exports[_0xe136('0x1')]=function(_0x371727,_0x156b36){return client['Request']('UpdateOpenchannelInteraction',{'body':_0x156b36,'options':{'where':{'id':_0x371727}},'log':_0xe136('0x2')});};exports[_0xe136('0x3')]=function(_0x5b8a39,_0x3bcf65){return client[_0xe136('0x4')](_0xe136('0x5'),{'body':_0x3bcf65,'options':{'where':{'id':_0x5b8a39}},'log':_0xe136('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index bee49ef..89b7f07 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 _0xb3c3=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create'];(function(_0x38946b,_0x2bc5c4){var _0x25c440=function(_0x1b92aa){while(--_0x1b92aa){_0x38946b['push'](_0x38946b['shift']());}};_0x25c440(++_0x2bc5c4);}(_0xb3c3,0x18e));var _0x3b3c=function(_0x4bb5c9,_0x295b27){_0x4bb5c9=_0x4bb5c9-0x0;var _0x106534=_0xb3c3[_0x4bb5c9];return _0x106534;};'use strict';var client=require(_0x3b3c('0x0'));exports[_0x3b3c('0x1')]=function(_0x8be203){return client['Request'](_0x3b3c('0x2'),{'body':_0x8be203,'log':_0x3b3c('0x3')});}; \ No newline at end of file +var _0xe49e=['../client','Request','CreateOpenchannelMessage'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xe49e,0xf0));var _0xee49=function(_0x2f4dc4,_0x311d42){_0x2f4dc4=_0x2f4dc4-0x0;var _0x58e608=_0xe49e[_0x2f4dc4];return _0x58e608;};'use strict';var client=require(_0xee49('0x0'));exports['create']=function(_0x433cf0){return client[_0xee49('0x1')](_0xee49('0x2'),{'body':_0x433cf0,'log':'createOpenchannelMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 875184c..1702f85 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 _0x09a0=['name','strategy','User','Agents','online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue'];(function(_0x180abe,_0x36eada){var _0x42ab7a=function(_0xccdb5a){while(--_0xccdb5a){_0x180abe['push'](_0x180abe['shift']());}};_0x42ab7a(++_0x36eada);}(_0x09a0,0x13c));var _0x009a=function(_0x241695,_0x1a8e19){_0x241695=_0x241695-0x0;var _0x5792f0=_0x09a0[_0x241695];return _0x5792f0;};'use strict';var client=require(_0x009a('0x0'));exports[_0x009a('0x1')]=function(){return function(){return client[_0x009a('0x2')](_0x009a('0x3'),{'options':{'raw':![],'attributes':['id',_0x009a('0x4'),'timeout',_0x009a('0x5')],'include':[{'model':_0x009a('0x6'),'as':_0x009a('0x7'),'attributes':['id',_0x009a('0x4'),_0x009a('0x8'),_0x009a('0x9')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0x7114=['Agents','online','openchannelPause','../client','getOpenchannelQueues','Request','name','timeout','User'];(function(_0x1672b5,_0x3de7c1){var _0x34ab9a=function(_0x2837c8){while(--_0x2837c8){_0x1672b5['push'](_0x1672b5['shift']());}};_0x34ab9a(++_0x3de7c1);}(_0x7114,0xd2));var _0x4711=function(_0x231d66,_0x189630){_0x231d66=_0x231d66-0x0;var _0x48d0c3=_0x7114[_0x231d66];return _0x48d0c3;};'use strict';var client=require(_0x4711('0x0'));exports[_0x4711('0x1')]=function(){return function(){return client[_0x4711('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x4711('0x3'),_0x4711('0x4'),'strategy'],'include':[{'model':_0x4711('0x5'),'as':_0x4711('0x6'),'attributes':['id',_0x4711('0x3'),_0x4711('0x7'),_0x4711('0x8')]}]},'log':_0x4711('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 5cafacf..eb10fbe 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 _0x7c35=['Request','CreateOpenchannelQueueReport','update','DESC','create'];(function(_0x9be28f,_0x231334){var _0xa9f52d=function(_0x239dad){while(--_0x239dad){_0x9be28f['push'](_0x9be28f['shift']());}};_0xa9f52d(++_0x231334);}(_0x7c35,0x135));var _0x57c3=function(_0x1815ca,_0x3c440f){_0x1815ca=_0x1815ca-0x0;var _0x33a318=_0x7c35[_0x1815ca];return _0x33a318;};'use strict';var client=require('../client');exports[_0x57c3('0x0')]=function(_0x25b947){return client[_0x57c3('0x1')](_0x57c3('0x2'),{'body':_0x25b947,'log':_0x57c3('0x2')});};exports[_0x57c3('0x3')]=function(_0x33d06e,_0x5519f2){return client[_0x57c3('0x1')]('UpdateOpenchannelQueueReport',{'body':_0x5519f2,'options':{'where':{'uniqueid':_0x33d06e},'order':[['id',_0x57c3('0x4')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0x7c47=['../client','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport'];(function(_0x585647,_0x47708f){var _0x334b4c=function(_0x137364){while(--_0x137364){_0x585647['push'](_0x585647['shift']());}};_0x334b4c(++_0x47708f);}(_0x7c47,0x1b8));var _0x77c4=function(_0x129bc3,_0x4590c6){_0x129bc3=_0x129bc3-0x0;var _0x128b08=_0x7c47[_0x129bc3];return _0x128b08;};'use strict';var client=require(_0x77c4('0x0'));exports['create']=function(_0x2b9e68){return client[_0x77c4('0x1')](_0x77c4('0x2'),{'body':_0x2b9e68,'log':_0x77c4('0x2')});};exports[_0x77c4('0x3')]=function(_0x39e7d0,_0x1b6f5d){return client['Request'](_0x77c4('0x4'),{'body':_0x1b6f5d,'options':{'where':{'uniqueid':_0x39e7d0},'order':[['id','DESC']],'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 1ccdf1e..f39df81 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 _0x9658=['addTagsToSmsInteraction','../client','UpdateSmsInteraction','addTags','AddTagsToSmsInteraction'];(function(_0x287cf8,_0x5cedf2){var _0x132e0f=function(_0x2ac0b8){while(--_0x2ac0b8){_0x287cf8['push'](_0x287cf8['shift']());}};_0x132e0f(++_0x5cedf2);}(_0x9658,0x6f));var _0x8965=function(_0x456a4b,_0x51df8){_0x456a4b=_0x456a4b-0x0;var _0x42957c=_0x9658[_0x456a4b];return _0x42957c;};'use strict';var client=require(_0x8965('0x0'));exports['update']=function(_0x1f5bb6,_0xa89576){return client['Request'](_0x8965('0x1'),{'body':_0xa89576,'options':{'where':{'id':_0x1f5bb6}},'log':'updateSmsInteraction'});};exports[_0x8965('0x2')]=function(_0x761b45,_0x254d05){return client['Request'](_0x8965('0x3'),{'body':_0x254d05,'options':{'where':{'id':_0x761b45}},'log':_0x8965('0x4')});}; \ No newline at end of file +var _0x782e=['AddTagsToSmsInteraction','UpdateSmsInteraction','updateSmsInteraction','Request'];(function(_0x36a241,_0x209d68){var _0x3b4bef=function(_0x453a2f){while(--_0x453a2f){_0x36a241['push'](_0x36a241['shift']());}};_0x3b4bef(++_0x209d68);}(_0x782e,0xb9));var _0xe782=function(_0x1a6264,_0x4ba686){_0x1a6264=_0x1a6264-0x0;var _0x29c464=_0x782e[_0x1a6264];return _0x29c464;};'use strict';var client=require('../client');exports['update']=function(_0x120c31,_0x15b01d){return client['Request'](_0xe782('0x0'),{'body':_0x15b01d,'options':{'where':{'id':_0x120c31}},'log':_0xe782('0x1')});};exports['addTags']=function(_0x26f960,_0x6726f){return client[_0xe782('0x2')](_0xe782('0x3'),{'body':_0x6726f,'options':{'where':{'id':_0x26f960}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 57b9f53..00f1431 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 _0xf902=['Request','createSmsMessage','../client','create'];(function(_0x24a654,_0x2ca441){var _0x458651=function(_0x1ecda1){while(--_0x1ecda1){_0x24a654['push'](_0x24a654['shift']());}};_0x458651(++_0x2ca441);}(_0xf902,0x72));var _0x2f90=function(_0x324ad3,_0x268d10){_0x324ad3=_0x324ad3-0x0;var _0x35f76a=_0xf902[_0x324ad3];return _0x35f76a;};'use strict';var client=require(_0x2f90('0x0'));exports[_0x2f90('0x1')]=function(_0x2297cc){return client[_0x2f90('0x2')]('CreateSmsMessage',{'body':_0x2297cc,'log':_0x2f90('0x3')});}; \ No newline at end of file +var _0xb20b=['Request','CreateSmsMessage','createSmsMessage','../client'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xb20b,0x93));var _0xbb20=function(_0x10262a,_0x5330d3){_0x10262a=_0x10262a-0x0;var _0x1fae28=_0xb20b[_0x10262a];return _0x1fae28;};'use strict';var client=require(_0xbb20('0x0'));exports['create']=function(_0x17abe9){return client[_0xbb20('0x1')](_0xbb20('0x2'),{'body':_0x17abe9,'log':_0xbb20('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 9d3a698..6398aac 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x5c6244,_0x112ab8){var _0x5800ce=function(_0x304e3d){while(--_0x304e3d){_0x5c6244['push'](_0x5c6244['shift']());}};_0x5800ce(++_0x112ab8);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'attributes':['id',_0x3071('0x2'),_0x3071('0x3'),_0x3071('0x4')],'include':[{'model':'User','as':_0x3071('0x5'),'attributes':['id',_0x3071('0x2'),_0x3071('0x6'),_0x3071('0x7')]}]},'log':_0x3071('0x8')});};}; \ No newline at end of file +var _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x442f02,_0x47d845){var _0xab6ef1=function(_0x4cad5c){while(--_0x4cad5c){_0x442f02['push'](_0x442f02['shift']());}};_0xab6ef1(++_0x47d845);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'attributes':['id',_0x3071('0x2'),_0x3071('0x3'),_0x3071('0x4')],'include':[{'model':'User','as':_0x3071('0x5'),'attributes':['id',_0x3071('0x2'),_0x3071('0x6'),_0x3071('0x7')]}]},'log':_0x3071('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index d33fd57..05c4834 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 _0x3e74=['CreateSmsQueueReport','UpdateSmsQueueReport','DESC','../client','Request'];(function(_0x5a4392,_0x10c285){var _0x566468=function(_0x3d2a8a){while(--_0x3d2a8a){_0x5a4392['push'](_0x5a4392['shift']());}};_0x566468(++_0x10c285);}(_0x3e74,0x175));var _0x43e7=function(_0x9425c1,_0x2c85ef){_0x9425c1=_0x9425c1-0x0;var _0x40ee87=_0x3e74[_0x9425c1];return _0x40ee87;};'use strict';var client=require(_0x43e7('0x0'));exports['create']=function(_0x349480){return client[_0x43e7('0x1')](_0x43e7('0x2'),{'body':_0x349480,'log':'CreateSmsQueueReport'});};exports['update']=function(_0xc58479,_0x4f9bbe){return client[_0x43e7('0x1')](_0x43e7('0x3'),{'body':_0x4f9bbe,'options':{'where':{'uniqueid':_0xc58479},'order':[['id',_0x43e7('0x4')]],'limit':0x1},'log':_0x43e7('0x3')});}; \ No newline at end of file +var _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0xf17841,_0x46e1e2){var _0x2803fd=function(_0x24038a){while(--_0x24038a){_0xf17841['push'](_0xf17841['shift']());}};_0x2803fd(++_0x46e1e2);}(_0x55ca,0x126));var _0xa55c=function(_0x514846,_0x34ac8d){_0x514846=_0x514846-0x0;var _0x2627a8=_0x55ca[_0x514846];return _0x2627a8;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index ba4dde9..0d8440c 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(_0x1f2373,_0x14f5cc){var _0x4526e4=function(_0x34ef7d){while(--_0x34ef7d){_0x1f2373['push'](_0x1f2373['shift']());}};_0x4526e4(++_0x14f5cc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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(_0x268106,_0x15267b){var _0x2eacb7=function(_0x1d3f57){while(--_0x1d3f57){_0x268106['push'](_0x268106['shift']());}};_0x2eacb7(++_0x15267b);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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 a6da426..c1bbd10 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 _0xe08b=['addTags','Request','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','UpdateWhatsappInteraction','updateWhatsappInteraction'];(function(_0x567ac9,_0x43b49e){var _0x101959=function(_0x543727){while(--_0x543727){_0x567ac9['push'](_0x567ac9['shift']());}};_0x101959(++_0x43b49e);}(_0xe08b,0x10e));var _0xbe08=function(_0x277fa3,_0x3b2dde){_0x277fa3=_0x277fa3-0x0;var _0x2e4520=_0xe08b[_0x277fa3];return _0x2e4520;};'use strict';var client=require(_0xbe08('0x0'));exports['update']=function(_0x35038b,_0x41c652){return client['Request'](_0xbe08('0x1'),{'body':_0x41c652,'options':{'where':{'id':_0x35038b}},'log':_0xbe08('0x2')});};exports[_0xbe08('0x3')]=function(_0x469522,_0x41edfb){return client[_0xbe08('0x4')](_0xbe08('0x5'),{'body':_0x41edfb,'options':{'where':{'id':_0x469522}},'log':_0xbe08('0x6')});}; \ No newline at end of file +var _0xdf55=['Request','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdf55,0x83));var _0x5df5=function(_0x34eb0d,_0x43448b){_0x34eb0d=_0x34eb0d-0x0;var _0x309bb3=_0xdf55[_0x34eb0d];return _0x309bb3;};'use strict';var client=require(_0x5df5('0x0'));exports[_0x5df5('0x1')]=function(_0x4d02f3,_0x20db42){return client[_0x5df5('0x2')]('UpdateWhatsappInteraction',{'body':_0x20db42,'options':{'where':{'id':_0x4d02f3}},'log':_0x5df5('0x3')});};exports[_0x5df5('0x4')]=function(_0x381a4c,_0x521007){return client[_0x5df5('0x2')](_0x5df5('0x5'),{'body':_0x521007,'options':{'where':{'id':_0x381a4c}},'log':_0x5df5('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 8d99d07..2ae049d 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 _0xe17d=['CreateWhatsappMessage','createWhatsappMessage','../client','create'];(function(_0x144b30,_0x77072d){var _0x1bb7bc=function(_0x1082cc){while(--_0x1082cc){_0x144b30['push'](_0x144b30['shift']());}};_0x1bb7bc(++_0x77072d);}(_0xe17d,0x76));var _0xde17=function(_0x3c1860,_0x3e2a35){_0x3c1860=_0x3c1860-0x0;var _0x4d1874=_0xe17d[_0x3c1860];return _0x4d1874;};'use strict';var client=require(_0xde17('0x0'));exports[_0xde17('0x1')]=function(_0x4469f6){return client['Request'](_0xde17('0x2'),{'body':_0x4469f6,'log':_0xde17('0x3')});}; \ No newline at end of file +var _0x2658=['Request','createWhatsappMessage','../client','create'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x2658,0x6e));var _0x8265=function(_0x14a3f1,_0x57d171){_0x14a3f1=_0x14a3f1-0x0;var _0x25e61e=_0x2658[_0x14a3f1];return _0x25e61e;};'use strict';var client=require(_0x8265('0x0'));exports[_0x8265('0x1')]=function(_0x4d0bfe){return client[_0x8265('0x2')]('CreateWhatsappMessage',{'body':_0x4d0bfe,'log':_0x8265('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 7d3b616..6fac3a4 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 _0x6faf=['whatsappPause','getWhatsappQueues','GetWhatsappQueue','name','strategy','User','Agents'];(function(_0x52dec0,_0x209eab){var _0x4c8fcf=function(_0x2555e5){while(--_0x2555e5){_0x52dec0['push'](_0x52dec0['shift']());}};_0x4c8fcf(++_0x209eab);}(_0x6faf,0x78));var _0xf6fa=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6faf[_0xa464c9];return _0x3d73c4;};'use strict';var client=require('../client');exports[_0xf6fa('0x0')]=function(){return function(){return client['Request'](_0xf6fa('0x1'),{'options':{'raw':![],'attributes':['id',_0xf6fa('0x2'),'timeout',_0xf6fa('0x3')],'include':[{'model':_0xf6fa('0x4'),'as':_0xf6fa('0x5'),'attributes':['id',_0xf6fa('0x2'),'online',_0xf6fa('0x6')]}]},'log':_0xf6fa('0x0')});};}; \ No newline at end of file +var _0x2486=['../client','GetWhatsappQueue','name','strategy','Agents','online','whatsappPause','getWhatsappQueues'];(function(_0x5411cb,_0x1cd69d){var _0x32727a=function(_0x22a762){while(--_0x22a762){_0x5411cb['push'](_0x5411cb['shift']());}};_0x32727a(++_0x1cd69d);}(_0x2486,0x1e8));var _0x6248=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2486[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x6248('0x0'));exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0x6248('0x1'),{'options':{'raw':![],'attributes':['id',_0x6248('0x2'),'timeout',_0x6248('0x3')],'include':[{'model':'User','as':_0x6248('0x4'),'attributes':['id',_0x6248('0x2'),_0x6248('0x5'),_0x6248('0x6')]}]},'log':_0x6248('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index a64cdc2..b5b9ff7 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 _0x3570=['CreateWhatsappQueueReport','UpdateWhatsappQueueReport','DESC','../client','create','Request'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3570,0x8d));var _0x0357=function(_0xce48cd,_0x439e02){_0xce48cd=_0xce48cd-0x0;var _0x16edb8=_0x3570[_0xce48cd];return _0x16edb8;};'use strict';var client=require(_0x0357('0x0'));exports[_0x0357('0x1')]=function(_0x269c8b){return client[_0x0357('0x2')](_0x0357('0x3'),{'body':_0x269c8b,'log':_0x0357('0x3')});};exports['update']=function(_0x141c35,_0x38ca2d){return client[_0x0357('0x2')](_0x0357('0x4'),{'body':_0x38ca2d,'options':{'where':{'uniqueid':_0x141c35},'order':[['id',_0x0357('0x5')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0x5309=['../client','create','CreateWhatsappQueueReport','update','Request','UpdateWhatsappQueueReport'];(function(_0x5f2b0e,_0x11271c){var _0x2a3323=function(_0x1e26a4){while(--_0x1e26a4){_0x5f2b0e['push'](_0x5f2b0e['shift']());}};_0x2a3323(++_0x11271c);}(_0x5309,0x144));var _0x9530=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x5309[_0x521929];return _0x632436;};'use strict';var client=require(_0x9530('0x0'));exports[_0x9530('0x1')]=function(_0x2a4ecf){return client['Request'](_0x9530('0x2'),{'body':_0x2a4ecf,'log':'CreateWhatsappQueueReport'});};exports[_0x9530('0x3')]=function(_0x33f8f4,_0x256f50){return client[_0x9530('0x4')](_0x9530('0x5'),{'body':_0x256f50,'options':{'where':{'uniqueid':_0x33f8f4},'order':[['id','DESC']],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index dbe32aa..380dac7 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 _0xeb53=['timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','map','message','join','stop','timeout','atimeout','channel','START:%s','rules','end','close','complete','info','[%s][AGENT]\x20ROUTING\x20END','next','[%s][QUEUE]\x20%s','validate','lodash','util','seq-queue','../../../../config/logger','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x52eaa5,_0x37dfda){var _0x272cbb=function(_0x48f3fe){while(--_0x48f3fe){_0x52eaa5['push'](_0x52eaa5['shift']());}};_0x272cbb(++_0x37dfda);}(_0xeb53,0xf8));var _0x3eb5=function(_0x105045,_0x2e471e){_0x105045=_0x105045-0x0;var _0x2487d0=_0xeb53[_0x105045];return _0x2487d0;};'use strict';var schema=require(_0x3eb5('0x0'));var _=require(_0x3eb5('0x1'));var util=require(_0x3eb5('0x2'));var seqqueue=require(_0x3eb5('0x3'));var logger=require(_0x3eb5('0x4'))('routing');var strategy=require(_0x3eb5('0x5'));var queue=schema({'name':{'type':_0x3eb5('0x6'),'required':!![],'message':_0x3eb5('0x7')},'timeout':{'type':'number','message':_0x3eb5('0x8')}});function writeLog(_0xec7067,_0x58d628,_0x447ece){return logger['info'](util[_0x3eb5('0x9')](_0x3eb5('0xa'),_0xec7067,_0x58d628['name'],_0x447ece));}function handleFindAgent(_0x41e2cf){return function(_0x821766){return _0x821766[_0x3eb5('0xb')][_0x3eb5('0xc')]()===_0x41e2cf['toLowerCase']();};}exports[_0x3eb5('0xd')]=function(_0x2c6bcc,_0x55cce4,_0x2fe6cb,_0x41bea5){return function(_0x5b8bca){try{var _0x59524e={'name':_0x55cce4[0x0],'timeout':_0x55cce4[0x1]};var _0xd87194=queue[_0x3eb5('0x0')](_0x59524e,{'typecast':!![]});if(_0xd87194[_0x3eb5('0xe')]){logger[_0x3eb5('0xf')]('[%s][AGENT]\x20%s',_0x2c6bcc,_[_0x3eb5('0x10')](_0xd87194,_0x3eb5('0x11'))[_0x3eb5('0x12')](',\x20'));_0x5b8bca[_0x3eb5('0x13')]();}else{var _0x2cbcc5=_['find'](_0x2fe6cb['agents'],handleFindAgent(_0x59524e[_0x3eb5('0xb')]));if(_0x2cbcc5){var _0xdc3555=(_0x59524e[_0x3eb5('0x14')]||0xa)*0x3e8;var _0xf33e76,_0x41fbef;var _0xd71de4=seqqueue['createQueue'](_0xdc3555);_0xd71de4['id']=_0x2c6bcc;_0xd71de4[_0x3eb5('0x15')]=_0xdc3555;_0xd71de4[_0x3eb5('0x16')]=_0x41bea5['channel'];writeLog(_0x2c6bcc,_0x2cbcc5,util[_0x3eb5('0x9')](_0x3eb5('0x17'),_0xdc3555));_0x2fe6cb[_0x3eb5('0x18')][_0x2c6bcc]['on'](_0x3eb5('0x19'),function(){logger['info']('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x2c6bcc);clearTimeout(_0x41fbef);_0x41fbef=undefined;_0xd71de4[_0x3eb5('0x1a')]();if(_0x2fe6cb[_0x3eb5('0x18')][_0x2c6bcc]){delete _0x2fe6cb['rules'][_0x2c6bcc];}_0x5b8bca['stop']();});_0x2fe6cb[_0x3eb5('0x18')][_0x2c6bcc]['on'](_0x3eb5('0x1b'),function(){if(_0x2fe6cb['rules'][_0x2c6bcc]){delete _0x2fe6cb['rules'][_0x2c6bcc];}});_0x41fbef=setTimeout(function(){logger[_0x3eb5('0x1c')](_0x3eb5('0x1d'),_0x2c6bcc);clearTimeout(_0x41fbef);_0xd71de4[_0x3eb5('0x1a')]();_0x5b8bca[_0x3eb5('0x1e')]();},_0xdc3555);strategy['agent'](_0xd71de4,_0x2cbcc5,_0x2fe6cb,_0x41bea5);}else{logger[_0x3eb5('0xf')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x2c6bcc,_0x59524e[_0x3eb5('0xb')]);_0x5b8bca[_0x3eb5('0x13')]();}}}catch(_0xf4005e){console['log'](_0xf4005e);logger[_0x3eb5('0xf')](_0x3eb5('0x1f'),_0x2c6bcc,_0xf4005e['stack']);_0x5b8bca[_0x3eb5('0x13')]();}};}; \ No newline at end of file +var _0xf3ac=['rules','complete','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','validate','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','length','error','[%s][AGENT]\x20%s','map','message','join','stop','agents','timeout','createQueue','atimeout','channel','START:%s','end','close'];(function(_0x40aec4,_0x1936c5){var _0xef8ac1=function(_0x4141d9){while(--_0x4141d9){_0x40aec4['push'](_0x40aec4['shift']());}};_0xef8ac1(++_0x1936c5);}(_0xf3ac,0x1b2));var _0xcf3a=function(_0x475170,_0x4a161f){_0x475170=_0x475170-0x0;var _0x243984=_0xf3ac[_0x475170];return _0x243984;};'use strict';var schema=require(_0xcf3a('0x0'));var _=require('lodash');var util=require(_0xcf3a('0x1'));var seqqueue=require(_0xcf3a('0x2'));var logger=require(_0xcf3a('0x3'))(_0xcf3a('0x4'));var strategy=require(_0xcf3a('0x5'));var queue=schema({'name':{'type':_0xcf3a('0x6'),'required':!![],'message':_0xcf3a('0x7')},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x264a63,_0x273488,_0x117b79){return logger[_0xcf3a('0x8')](util[_0xcf3a('0x9')](_0xcf3a('0xa'),_0x264a63,_0x273488[_0xcf3a('0xb')],_0x117b79));}function handleFindAgent(_0x37774b){return function(_0x66ce8f){return _0x66ce8f['name']['toLowerCase']()===_0x37774b[_0xcf3a('0xc')]();};}exports['consequence']=function(_0x22a7ad,_0x47304d,_0x331fe2,_0x38657b){return function(_0x5e23b7){try{var _0x197f79={'name':_0x47304d[0x0],'timeout':_0x47304d[0x1]};var _0xc93b2d=queue['validate'](_0x197f79,{'typecast':!![]});if(_0xc93b2d[_0xcf3a('0xd')]){logger[_0xcf3a('0xe')](_0xcf3a('0xf'),_0x22a7ad,_[_0xcf3a('0x10')](_0xc93b2d,_0xcf3a('0x11'))[_0xcf3a('0x12')](',\x20'));_0x5e23b7[_0xcf3a('0x13')]();}else{var _0x443c16=_['find'](_0x331fe2[_0xcf3a('0x14')],handleFindAgent(_0x197f79[_0xcf3a('0xb')]));if(_0x443c16){var _0x53692f=(_0x197f79[_0xcf3a('0x15')]||0xa)*0x3e8;var _0x5a033d,_0x14bfb2;var _0x11e257=seqqueue[_0xcf3a('0x16')](_0x53692f);_0x11e257['id']=_0x22a7ad;_0x11e257[_0xcf3a('0x17')]=_0x53692f;_0x11e257[_0xcf3a('0x18')]=_0x38657b[_0xcf3a('0x18')];writeLog(_0x22a7ad,_0x443c16,util[_0xcf3a('0x9')](_0xcf3a('0x19'),_0x53692f));_0x331fe2['rules'][_0x22a7ad]['on'](_0xcf3a('0x1a'),function(){logger['info']('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x22a7ad);clearTimeout(_0x14bfb2);_0x14bfb2=undefined;_0x11e257[_0xcf3a('0x1b')]();if(_0x331fe2[_0xcf3a('0x1c')][_0x22a7ad]){delete _0x331fe2[_0xcf3a('0x1c')][_0x22a7ad];}_0x5e23b7['stop']();});_0x331fe2[_0xcf3a('0x1c')][_0x22a7ad]['on'](_0xcf3a('0x1d'),function(){if(_0x331fe2['rules'][_0x22a7ad]){delete _0x331fe2[_0xcf3a('0x1c')][_0x22a7ad];}});_0x14bfb2=setTimeout(function(){logger['info']('[%s][AGENT]\x20ROUTING\x20END',_0x22a7ad);clearTimeout(_0x14bfb2);_0x11e257[_0xcf3a('0x1b')]();_0x5e23b7[_0xcf3a('0x1e')]();},_0x53692f);strategy['agent'](_0x11e257,_0x443c16,_0x331fe2,_0x38657b);}else{logger[_0xcf3a('0xe')](_0xcf3a('0x1f'),_0x22a7ad,_0x197f79[_0xcf3a('0xb')]);_0x5e23b7[_0xcf3a('0x13')]();}}}catch(_0xc9f85d){console['log'](_0xc9f85d);logger[_0xcf3a('0xe')](_0xcf3a('0x20'),_0x22a7ad,_0xc9f85d['stack']);_0x5e23b7['stop']();}};}; \ 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 b2e9896..480cf32 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 _0xd696=['sms','whatsapp','phone','interaction','chat','ChatWebsiteId','account','AccountId','InteractionId','isEmpty','Message','create','catch','error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','$LATEST','message','body','postText','next','amazonlex','providerResponse','then','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel'];(function(_0x348704,_0x3630d9){var _0x425098=function(_0x430509){while(--_0x430509){_0x348704['push'](_0x348704['shift']());}};_0x425098(++_0x3630d9);}(_0xd696,0x155));var _0x6d69=function(_0x4f3487,_0x143272){_0x4f3487=_0x4f3487-0x0;var _0x58d74f=_0xd696[_0x4f3487];return _0x58d74f;};'use strict';var _=require(_0x6d69('0x0'));var moment=require(_0x6d69('0x1'));var AWS=require(_0x6d69('0x2'));var utils=require(_0x6d69('0x3'));var logger=require(_0x6d69('0x4'))(_0x6d69('0x5'));var rpc={'chatMessage':require(_0x6d69('0x6')),'openchannelMessage':require(_0x6d69('0x7')),'mailMessage':require(_0x6d69('0x8')),'smsMessage':require(_0x6d69('0x9')),'faxMessage':require(_0x6d69('0xa')),'whatsappMessage':require(_0x6d69('0xb'))};exports[_0x6d69('0xc')]=function(_0x28da90,_0x24fd7f){return function(_0x5e48f7){try{if(!_[_0x6d69('0xd')](this['interaction'][_0x6d69('0xe')])){logger[_0x6d69('0xf')](_0x6d69('0x10'),_0x28da90,_0x6d69('0x11'));return _0x5e48f7['next']();}var _0x37538d={'ContactId':this[_0x6d69('0x12')]['id'],'sentAt':moment()[_0x6d69('0x13')](_0x6d69('0x14')),'direction':_0x6d69('0x15')};if(this[_0x6d69('0x16')]===_0x6d69('0x17')||this[_0x6d69('0x16')]===_0x6d69('0x18')){_0x37538d[_0x6d69('0x19')]=this[_0x6d69('0x1a')]['phone'];}var _0x1a27b0=this[_0x6d69('0x16')];if(_0x1a27b0===_0x6d69('0x1b')){_0x37538d[_0x6d69('0x1c')]=this[_0x6d69('0x1d')]['id'];}else{_0x37538d[_['upperFirst'](_0x1a27b0)+_0x6d69('0x1e')]=this[_0x6d69('0x1d')]['id'];}_0x37538d[_['upperFirst'](_0x1a27b0)+_0x6d69('0x1f')]=this[_0x6d69('0x1a')]['id'];if(this[_0x6d69('0x1a')]['created']){var _0x33c27f=_0x24fd7f[0x4];if(!_[_0x6d69('0x20')](_0x33c27f)){_0x37538d['body']=utils['getMustacheRender'](_0x33c27f,this);return rpc[_0x1a27b0+_0x6d69('0x21')][_0x6d69('0x22')](_0x37538d)['then'](function(_0x50aa87){logger[_0x6d69('0xf')](_0x6d69('0x10'),_0x28da90,_0x37538d['body']);})[_0x6d69('0x23')](function(_0x9d5f38){logger[_0x6d69('0x24')](_0x6d69('0x10'),_0x28da90,JSON[_0x6d69('0x25')](_0x9d5f38));})['finally'](function(){logger[_0x6d69('0xf')](_0x6d69('0x26'),_0x28da90);_0x5e48f7['stop']();});}else{logger[_0x6d69('0xf')](_0x6d69('0x27'),_0x28da90);_0x5e48f7[_0x6d69('0x28')]();}}else{var _0x1900c8=this;var _0x3ec502=new AWS[(_0x6d69('0x29'))]({'accessKeyId':_0x24fd7f[0x0],'secretAccessKey':_0x24fd7f[0x1],'region':_0x24fd7f[0x2]});var _0x2b38a4={'botAlias':_0x6d69('0x2a'),'botName':_0x24fd7f[0x3],'inputText':this[_0x6d69('0x2b')][_0x6d69('0x2c')],'userId':this[_0x6d69('0x16')]+':'+this['interaction']['id']['toString']()};_0x3ec502[_0x6d69('0x2d')](_0x2b38a4,function(_0x34fbfd,_0x3cf029){if(_0x34fbfd){logger[_0x6d69('0x24')](_0x6d69('0x10'),_0x28da90,_0x34fbfd[_0x6d69('0x2b')]);_0x5e48f7[_0x6d69('0x2e')]();}else if(_0x3cf029&&_0x3cf029['message']){_0x1900c8[_0x6d69('0x2c')][_0x6d69('0x2f')]=_0x3cf029;_0x37538d[_0x6d69('0x2c')]=_0x3cf029[_0x6d69('0x2b')];_0x37538d['providerName']=_0x6d69('0x2f');_0x37538d[_0x6d69('0x30')]=JSON['stringify'](_0x3cf029);return rpc[_0x1a27b0+_0x6d69('0x21')][_0x6d69('0x22')](_0x37538d)[_0x6d69('0x31')](function(_0x22b328){logger[_0x6d69('0xf')]('[%s][AMAZONLEX]\x20%s',_0x28da90,_0x37538d[_0x6d69('0x2c')]);if(_0x3cf029[_0x6d69('0x32')]==_0x6d69('0x33')){_0x5e48f7[_0x6d69('0x2e')]();}else{_0x5e48f7[_0x6d69('0x28')]();}})['catch'](function(_0x538724){logger[_0x6d69('0x24')](_0x6d69('0x10'),_0x28da90,JSON[_0x6d69('0x25')](_0x538724));_0x5e48f7[_0x6d69('0x2e')]();});}else{_0x5e48f7['next']();}});}}catch(_0x1e4e49){logger['error'](_0x6d69('0x10'),_0x28da90,JSON[_0x6d69('0x25')](_0x1e4e49));_0x5e48f7[_0x6d69('0x28')]();}};}; \ No newline at end of file +var _0xbfdd=['../../rpc/faxMessage','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','chat','ChatWebsiteId','AccountId','account','upperFirst','InteractionId','created','isEmpty','Message','create','info','[%s][AMAZONLEX]\x20%s','body','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','message','toString','postText','next','providerResponse','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xbfdd,0x1e0));var _0xdbfd=function(_0x4074d5,_0xa57194){_0x4074d5=_0x4074d5-0x0;var _0x502cfe=_0xbfdd[_0x4074d5];return _0x502cfe;};'use strict';var _=require(_0xdbfd('0x0'));var moment=require(_0xdbfd('0x1'));var AWS=require(_0xdbfd('0x2'));var utils=require(_0xdbfd('0x3'));var logger=require(_0xdbfd('0x4'))(_0xdbfd('0x5'));var rpc={'chatMessage':require(_0xdbfd('0x6')),'openchannelMessage':require(_0xdbfd('0x7')),'mailMessage':require(_0xdbfd('0x8')),'smsMessage':require(_0xdbfd('0x9')),'faxMessage':require(_0xdbfd('0xa')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xdbfd('0xb')]=function(_0x6ff218,_0xf44b63){return function(_0x38a206){try{if(!_[_0xdbfd('0xc')](this[_0xdbfd('0xd')][_0xdbfd('0xe')])){logger['info']('[%s][AMAZONLEX]\x20%s',_0x6ff218,_0xdbfd('0xf'));return _0x38a206['next']();}var _0x55158f={'ContactId':this['contact']['id'],'sentAt':moment()[_0xdbfd('0x10')](_0xdbfd('0x11')),'direction':'out'};if(this[_0xdbfd('0x12')]===_0xdbfd('0x13')||this[_0xdbfd('0x12')]===_0xdbfd('0x14')){_0x55158f[_0xdbfd('0x15')]=this[_0xdbfd('0xd')][_0xdbfd('0x15')];}var _0x39c77c=this['channel'];if(_0x39c77c===_0xdbfd('0x16')){_0x55158f[_0xdbfd('0x17')]=this['account']['id'];}else{_0x55158f[_['upperFirst'](_0x39c77c)+_0xdbfd('0x18')]=this[_0xdbfd('0x19')]['id'];}_0x55158f[_[_0xdbfd('0x1a')](_0x39c77c)+_0xdbfd('0x1b')]=this['interaction']['id'];if(this[_0xdbfd('0xd')][_0xdbfd('0x1c')]){var _0x5d5d7e=_0xf44b63[0x4];if(!_[_0xdbfd('0x1d')](_0x5d5d7e)){_0x55158f['body']=utils['getMustacheRender'](_0x5d5d7e,this);return rpc[_0x39c77c+_0xdbfd('0x1e')][_0xdbfd('0x1f')](_0x55158f)['then'](function(_0x4cfcc3){logger[_0xdbfd('0x20')](_0xdbfd('0x21'),_0x6ff218,_0x55158f[_0xdbfd('0x22')]);})[_0xdbfd('0x23')](function(_0x38ab2b){logger[_0xdbfd('0x24')](_0xdbfd('0x21'),_0x6ff218,JSON[_0xdbfd('0x25')](_0x38ab2b));})[_0xdbfd('0x26')](function(){logger[_0xdbfd('0x20')](_0xdbfd('0x27'),_0x6ff218);_0x38a206[_0xdbfd('0x28')]();});}else{logger[_0xdbfd('0x20')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x6ff218);_0x38a206[_0xdbfd('0x28')]();}}else{var _0x304022=this;var _0x9b3f06=new AWS[(_0xdbfd('0x29'))]({'accessKeyId':_0xf44b63[0x0],'secretAccessKey':_0xf44b63[0x1],'region':_0xf44b63[0x2]});var _0x6850f9={'botAlias':'$LATEST','botName':_0xf44b63[0x3],'inputText':this[_0xdbfd('0x2a')][_0xdbfd('0x22')],'userId':this['channel']+':'+this[_0xdbfd('0xd')]['id'][_0xdbfd('0x2b')]()};_0x9b3f06[_0xdbfd('0x2c')](_0x6850f9,function(_0x2c72b6,_0xd3ff02){if(_0x2c72b6){logger['error']('[%s][AMAZONLEX]\x20%s',_0x6ff218,_0x2c72b6[_0xdbfd('0x2a')]);_0x38a206[_0xdbfd('0x2d')]();}else if(_0xd3ff02&&_0xd3ff02[_0xdbfd('0x2a')]){_0x304022[_0xdbfd('0x22')]['amazonlex']=_0xd3ff02;_0x55158f[_0xdbfd('0x22')]=_0xd3ff02[_0xdbfd('0x2a')];_0x55158f['providerName']='amazonlex';_0x55158f[_0xdbfd('0x2e')]=JSON[_0xdbfd('0x25')](_0xd3ff02);return rpc[_0x39c77c+_0xdbfd('0x1e')][_0xdbfd('0x1f')](_0x55158f)['then'](function(_0x460987){logger[_0xdbfd('0x20')](_0xdbfd('0x21'),_0x6ff218,_0x55158f[_0xdbfd('0x22')]);if(_0xd3ff02[_0xdbfd('0x2f')]==_0xdbfd('0x30')){_0x38a206[_0xdbfd('0x2d')]();}else{_0x38a206[_0xdbfd('0x28')]();}})[_0xdbfd('0x23')](function(_0x50e0c3){logger['error'](_0xdbfd('0x21'),_0x6ff218,JSON[_0xdbfd('0x25')](_0x50e0c3));_0x38a206[_0xdbfd('0x2d')]();});}else{_0x38a206[_0xdbfd('0x2d')]();}});}}catch(_0x465f4b){logger[_0xdbfd('0x24')](_0xdbfd('0x21'),_0x6ff218,JSON[_0xdbfd('0x25')](_0x465f4b));_0x38a206[_0xdbfd('0x28')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 704ab13..21eaa82 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 _0x0c67=['ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','','replace','','headers','auto-replied','All','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','catch','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally','resolve','update','error','Interaction','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/smsInteraction','../../rpc/faxInteraction','../../mailRpc','consequence','channel','mail','body','[%s][AUTOREPLY]\x20%s','next','interaction','created','info','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','subject','startsWith','Re:','Re:\x20'];(function(_0x4cb4d1,_0xdd2da6){var _0x19ba8d=function(_0x130dc0){while(--_0x130dc0){_0x4cb4d1['push'](_0x4cb4d1['shift']());}};_0x19ba8d(++_0xdd2da6);}(_0x0c67,0xe5));var _0x70c6=function(_0x2994c5,_0x44e749){_0x2994c5=_0x2994c5-0x0;var _0x5212e9=_0x0c67[_0x2994c5];return _0x5212e9;};'use strict';var _=require(_0x70c6('0x0'));var moment=require(_0x70c6('0x1'));var utils=require(_0x70c6('0x2'));var logger=require(_0x70c6('0x3'))(_0x70c6('0x4'));var rpc={'chatMessage':require(_0x70c6('0x5')),'openchannelMessage':require(_0x70c6('0x6')),'mailMessage':require(_0x70c6('0x7')),'smsMessage':require(_0x70c6('0x8')),'faxMessage':require(_0x70c6('0x9')),'whatsappMessage':require(_0x70c6('0xa')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0x70c6('0xb')),'faxInteraction':require(_0x70c6('0xc')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0x70c6('0xd'));exports[_0x70c6('0xe')]=function(_0x5cd0f3,_0x7081bd,_0x1232c0,_0x53cca4){return function(_0x5ea950){try{var _0x6a4183=this[_0x70c6('0xf')];if(_0x6a4183===_0x70c6('0x10')&&_0x53cca4[_0x70c6('0x11')]['isAutoreply']){logger['info'](_0x70c6('0x12'),_0x5cd0f3,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x5ea950[_0x70c6('0x13')]();}if(_0x7081bd[0x0]==='1'&&(_['isNil'](this[_0x70c6('0x14')][_0x70c6('0x15')])||!this[_0x70c6('0x14')]['created'])){logger[_0x70c6('0x16')]('[%s][AUTOREPLY]\x20%s',_0x5cd0f3,_0x70c6('0x17'));return _0x5ea950[_0x70c6('0x13')]();}if(_0x7081bd[0x0]==='2'&&this[_0x70c6('0x14')][_0x70c6('0x18')]){logger['info'](_0x70c6('0x19'),_0x5cd0f3,_0x70c6('0x1a'));return _0x5ea950['next']();}var _0x557dc0={'ContactId':this[_0x70c6('0x1b')]['id'],'sentAt':moment()[_0x70c6('0x1c')](_0x70c6('0x1d')),'direction':_0x70c6('0x1e')};if(this[_0x70c6('0xf')]===_0x70c6('0x10')){_0x557dc0[_0x70c6('0x11')]=utils[_0x70c6('0x1f')](_0x7081bd[0x2],this);}else{_0x557dc0[_0x70c6('0x11')]=utils[_0x70c6('0x1f')](_0x7081bd[0x1],this);}if(this['message']){_0x557dc0['to']=this[_0x70c6('0x20')][_0x70c6('0x21')]||'';if(this[_0x70c6('0xf')]===_0x70c6('0x10')&&_0x7081bd[0x1]==='1'){_0x557dc0['cc']=this[_0x70c6('0x20')]['cc']||'';}_0x557dc0[_0x70c6('0x21')]=this[_0x70c6('0x20')]['to']||'';_0x557dc0[_0x70c6('0x22')]=this[_0x70c6('0x20')][_0x70c6('0x22')]||'';_0x557dc0['read']=!![];if(this['message'][_0x70c6('0x23')]){_0x557dc0[_0x70c6('0x23')]='';_0x557dc0[_0x70c6('0x23')]+=_[_0x70c6('0x24')](this[_0x70c6('0x20')][_0x70c6('0x23')],_0x70c6('0x25'))?'':_0x70c6('0x26');_0x557dc0[_0x70c6('0x23')]+=this[_0x70c6('0x20')]['subject'];}}if(this[_0x70c6('0xf')]==='chat'){_0x557dc0[_0x70c6('0x27')]=this[_0x70c6('0x28')]['id'];}else{_0x557dc0[_[_0x70c6('0x29')](this[_0x70c6('0xf')])+_0x70c6('0x2a')]=this[_0x70c6('0x28')]['id'];}_0x557dc0[_[_0x70c6('0x29')](this[_0x70c6('0xf')])+_0x70c6('0x2b')]=this[_0x70c6('0x14')]['id'];var _0x52d9ac=this['interaction'];if(rpc[this['channel']+_0x70c6('0x2c')]){if(this[_0x70c6('0xf')]===_0x70c6('0x10')){_0x557dc0['inReplyTo']=this[_0x70c6('0x20')]['messageId'];_0x557dc0['html']=_0x70c6('0x2d')+_[_0x70c6('0x2e')](_0x557dc0[_0x70c6('0x11')],_0x70c6('0x2f'),'','','headers','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','resolve','Interaction','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','finally','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','info'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0x8975,0x1bb));var _0x5897=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x8975[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x5897('0x0'));var moment=require(_0x5897('0x1'));var utils=require('./utils');var logger=require(_0x5897('0x2'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x5897('0x3')),'mailMessage':require(_0x5897('0x4')),'smsMessage':require(_0x5897('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x5897('0x6')),'chatInteraction':require(_0x5897('0x7')),'openchannelInteraction':require(_0x5897('0x8')),'mailInteraction':require(_0x5897('0x9')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0x5897('0xa')),'whatsappInteraction':require(_0x5897('0xb'))};var mailRpc=require(_0x5897('0xc'));exports[_0x5897('0xd')]=function(_0x2d6f7a,_0xba2255,_0x4bdbfa,_0x22a6c2){return function(_0x27aa08){try{var _0x24f0a1=this[_0x5897('0xe')];if(_0x24f0a1===_0x5897('0xf')&&_0x22a6c2[_0x5897('0x10')][_0x5897('0x11')]){logger[_0x5897('0x12')](_0x5897('0x13'),_0x2d6f7a,_0x5897('0x14'));return _0x27aa08[_0x5897('0x15')]();}if(_0xba2255[0x0]==='1'&&(_[_0x5897('0x16')](this[_0x5897('0x17')]['created'])||!this[_0x5897('0x17')]['created'])){logger['info'](_0x5897('0x13'),_0x2d6f7a,'Autoreply\x20already\x20sent');return _0x27aa08[_0x5897('0x15')]();}if(_0xba2255[0x0]==='2'&&this[_0x5897('0x17')][_0x5897('0x18')]){logger[_0x5897('0x12')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x2d6f7a,_0x5897('0x19'));return _0x27aa08['next']();}var _0x2fe024={'ContactId':this[_0x5897('0x1a')]['id'],'sentAt':moment()[_0x5897('0x1b')](_0x5897('0x1c')),'direction':'out'};if(this['channel']===_0x5897('0xf')){_0x2fe024[_0x5897('0x10')]=utils['getMustacheRender'](_0xba2255[0x2],this);}else{_0x2fe024[_0x5897('0x10')]=utils['getMustacheRender'](_0xba2255[0x1],this);}if(this[_0x5897('0x1d')]){_0x2fe024['to']=this[_0x5897('0x1d')][_0x5897('0x1e')]||'';if(this['channel']===_0x5897('0xf')&&_0xba2255[0x1]==='1'){_0x2fe024['cc']=this[_0x5897('0x1d')]['cc']||'';}_0x2fe024[_0x5897('0x1e')]=this[_0x5897('0x1d')]['to']||'';_0x2fe024[_0x5897('0x1f')]=this[_0x5897('0x1d')][_0x5897('0x1f')]||'';_0x2fe024['read']=!![];if(this['message'][_0x5897('0x20')]){_0x2fe024['subject']='';_0x2fe024[_0x5897('0x20')]+=_[_0x5897('0x21')](this['message']['subject'],_0x5897('0x22'))?'':_0x5897('0x23');_0x2fe024[_0x5897('0x20')]+=this[_0x5897('0x1d')]['subject'];}}if(this[_0x5897('0xe')]===_0x5897('0x24')){_0x2fe024['ChatWebsiteId']=this[_0x5897('0x25')]['id'];}else{_0x2fe024[_[_0x5897('0x26')](this['channel'])+_0x5897('0x27')]=this[_0x5897('0x25')]['id'];}_0x2fe024[_['upperFirst'](this['channel'])+_0x5897('0x28')]=this['interaction']['id'];var _0x15fb61=this['interaction'];if(rpc[this[_0x5897('0xe')]+'Message']){if(this[_0x5897('0xe')]==='mail'){_0x2fe024['inReplyTo']=this[_0x5897('0x1d')][_0x5897('0x29')];_0x2fe024[_0x5897('0x2a')]=_0x5897('0x2b')+_['replace'](_0x2fe024[_0x5897('0x10')],_0x5897('0x2c'),_0x5897('0x2d'))+_0x5897('0x2e');_0x2fe024[_0x5897('0x2f')]={'Auto-Submitted':_0x5897('0x30'),'X-Auto-Response-Suppress':_0x5897('0x31'),'Precedence':_0x5897('0x32')};return mailRpc[_0x5897('0x33')](this[_0x5897('0x25')][_0x5897('0x34')],_0x2fe024)[_0x5897('0x35')](function(_0x394ec7){logger['info'](_0x5897('0x36'),_0x2d6f7a);_0x2fe024[_0x5897('0x29')]=_0x394ec7[_0x5897('0x1d')][_0x5897('0x29')];return rpc[_0x24f0a1+'Message']['create'](_0x2fe024);})[_0x5897('0x35')](function(_0x15b94a){logger['info'](_0x5897('0x13'),_0x2d6f7a,JSON[_0x5897('0x37')](_0x15b94a));})[_0x5897('0x38')](function(_0x31c260){logger[_0x5897('0x39')](_0x5897('0x3a'),_0x2d6f7a,JSON[_0x5897('0x37')](_0x31c260));})['finally'](function(){Promise[_0x5897('0x3b')]()[_0x5897('0x35')](function(){if(_0xba2255[0x0]!=='2'||_0x15fb61[_0x5897('0x18')])return;return rpc[_0x24f0a1+_0x5897('0x3c')]['update'](_0x15fb61['id'],{'autoreplyExecuted':!![]})[_0x5897('0x35')](function(_0x2d1138){logger[_0x5897('0x12')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x2d6f7a,JSON[_0x5897('0x37')](_0x2d1138));})[_0x5897('0x38')](function(_0x3cc6eb){logger[_0x5897('0x39')](_0x5897('0x3d'),_0x2d6f7a,JSON[_0x5897('0x37')](_0x3cc6eb));});})['then'](function(){_0x27aa08[_0x5897('0x15')]();});});}else{return rpc[this[_0x5897('0xe')]+'Message']['create'](_0x2fe024)['then'](function(){logger[_0x5897('0x12')](_0x5897('0x13'),_0x2d6f7a,_0x2fe024[_0x5897('0x10')]);})[_0x5897('0x38')](function(_0xa08598){logger[_0x5897('0x39')]('[%s][AUTOREPLY]\x20%s',_0x2d6f7a,JSON[_0x5897('0x37')](_0xa08598));})[_0x5897('0x3e')](function(){Promise['resolve']()['then'](function(){if(_0xba2255[0x0]!=='2'||_0x15fb61[_0x5897('0x18')])return;return rpc[_0x24f0a1+_0x5897('0x3c')][_0x5897('0x3f')](_0x15fb61['id'],{'autoreplyExecuted':!![]})[_0x5897('0x35')](function(_0x54aae1){logger['info'](_0x5897('0x40'),_0x2d6f7a,JSON[_0x5897('0x37')](_0x54aae1));})[_0x5897('0x38')](function(_0x5974fb){logger['error'](_0x5897('0x3d'),_0x2d6f7a,JSON[_0x5897('0x37')](_0x5974fb));});})[_0x5897('0x35')](function(){_0x27aa08['next']();});});}}}catch(_0x5a1fe9){logger[_0x5897('0x39')](_0x5897('0x13'),_0x2d6f7a,JSON[_0x5897('0x37')](_0x5a1fe9));_0x27aa08[_0x5897('0x41')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 19231c4..da19024 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 _0x128c=['YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','stringify','finally','stop','[%s][CLOSE]\x20%s','moment','../../../../config/logger','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format'];(function(_0x2ba609,_0x391585){var _0x563793=function(_0x3f28f5){while(--_0x3f28f5){_0x2ba609['push'](_0x2ba609['shift']());}};_0x563793(++_0x391585);}(_0x128c,0xde));var _0xc128=function(_0xadb44a,_0x247803){_0xadb44a=_0xadb44a-0x0;var _0x20ed90=_0x128c[_0xadb44a];return _0x20ed90;};'use strict';var moment=require(_0xc128('0x0'));var logger=require(_0xc128('0x1'))('routing');var rpc={'chatInteraction':require(_0xc128('0x2')),'openchannelInteraction':require(_0xc128('0x3')),'smsInteraction':require(_0xc128('0x4')),'mailInteraction':require(_0xc128('0x5')),'faxInteraction':require(_0xc128('0x6')),'whatsappInteraction':require(_0xc128('0x7'))};exports[_0xc128('0x8')]=function(_0x16dbb5,_0x251b1b,_0x3f31e1,_0x4f9cef){return function(_0x579eb6){try{logger[_0xc128('0x9')](_0xc128('0xa'),_0x16dbb5,_0x251b1b[0x0]);var _0x32928a={'closed':0x1,'closedAt':moment()[_0xc128('0xb')](_0xc128('0xc')),'closeReason':_0xc128('0xd'),'disposition':_0x251b1b[0x0]};if(rpc[_0x4f9cef[_0xc128('0xe')]+_0xc128('0xf')]){rpc[_0x4f9cef[_0xc128('0xe')]+_0xc128('0xf')][_0xc128('0x10')](_0x4f9cef[_0xc128('0x11')]['id'],_0x32928a)[_0xc128('0x12')](function(_0x422f04){logger[_0xc128('0x9')](_0xc128('0x13'),_0x16dbb5,_0x4f9cef[_0xc128('0x11')]['id']);})[_0xc128('0x14')](function(_0x2c5d58){logger[_0xc128('0x15')]('[%s][CLOSE]\x20%s',_0x16dbb5,JSON[_0xc128('0x16')](_0x2c5d58));})[_0xc128('0x17')](function(){_0x579eb6[_0xc128('0x18')]();});}}catch(_0x95f754){logger[_0xc128('0x15')](_0xc128('0x19'),_0x16dbb5,JSON[_0xc128('0x16')](_0x95f754));_0x579eb6[_0xc128('0x18')]();}};}; \ No newline at end of file +var _0x5164=['../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../../../config/logger','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction'];(function(_0x95e2c9,_0x230d15){var _0x3a687f=function(_0x26415a){while(--_0x26415a){_0x95e2c9['push'](_0x95e2c9['shift']());}};_0x3a687f(++_0x230d15);}(_0x5164,0x1da));var _0x4516=function(_0x4e9bf9,_0x1b68f8){_0x4e9bf9=_0x4e9bf9-0x0;var _0x556466=_0x5164[_0x4e9bf9];return _0x556466;};'use strict';var moment=require(_0x4516('0x0'));var logger=require(_0x4516('0x1'))('routing');var rpc={'chatInteraction':require(_0x4516('0x2')),'openchannelInteraction':require(_0x4516('0x3')),'smsInteraction':require(_0x4516('0x4')),'mailInteraction':require(_0x4516('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x4516('0x6'))};exports[_0x4516('0x7')]=function(_0x228f03,_0x4e595b,_0x55e975,_0x44630c){return function(_0x56c1f9){try{logger[_0x4516('0x8')](_0x4516('0x9'),_0x228f03,_0x4e595b[0x0]);var _0x2da918={'closed':0x1,'closedAt':moment()['format'](_0x4516('0xa')),'closeReason':_0x4516('0xb'),'disposition':_0x4e595b[0x0]};if(rpc[_0x44630c[_0x4516('0xc')]+_0x4516('0xd')]){rpc[_0x44630c['channel']+_0x4516('0xd')][_0x4516('0xe')](_0x44630c[_0x4516('0xf')]['id'],_0x2da918)[_0x4516('0x10')](function(_0x4ea6a0){logger[_0x4516('0x8')](_0x4516('0x11'),_0x228f03,_0x44630c[_0x4516('0xf')]['id']);})[_0x4516('0x12')](function(_0x9b1808){logger[_0x4516('0x13')](_0x4516('0x14'),_0x228f03,JSON[_0x4516('0x15')](_0x9b1808));})[_0x4516('0x16')](function(){_0x56c1f9[_0x4516('0x17')]();});}}catch(_0x350748){logger[_0x4516('0x13')](_0x4516('0x14'),_0x228f03,JSON[_0x4516('0x15')](_0x350748));_0x56c1f9[_0x4516('0x17')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 71ba1bc..4639354 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 _0x5655=['body','result','providerName','metadata','endConversation','catch','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','next','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','account','upperFirst','AccountId','InteractionId','created','getMustacheRender','Message','then','error','stringify','finally','stop','message','dialogflow'];(function(_0x123091,_0x259aa0){var _0x5a80ef=function(_0x287cfe){while(--_0x287cfe){_0x123091['push'](_0x123091['shift']());}};_0x5a80ef(++_0x259aa0);}(_0x5655,0x15e));var _0x5565=function(_0x76614a,_0xeac0c6){_0x76614a=_0x76614a-0x0;var _0x5081ca=_0x5655[_0x76614a];return _0x5081ca;};'use strict';var _=require(_0x5565('0x0'));var moment=require(_0x5565('0x1'));var apiai=require(_0x5565('0x2'));var md5=require(_0x5565('0x3'));var utils=require(_0x5565('0x4'));var logger=require(_0x5565('0x5'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x5565('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x5565('0x7')),'faxMessage':require(_0x5565('0x8')),'whatsappMessage':require(_0x5565('0x9'))};exports[_0x5565('0xa')]=function(_0x106d59,_0x5427a3){return function(_0xc88d42){try{if(!_[_0x5565('0xb')](this[_0x5565('0xc')][_0x5565('0xd')])){logger[_0x5565('0xe')](_0x5565('0xf'),_0x106d59,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0xc88d42[_0x5565('0x10')]();}var _0x367ce8={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x5565('0x11')),'direction':_0x5565('0x12')};if(this['channel']==='sms'||this[_0x5565('0x13')]===_0x5565('0x14')){_0x367ce8[_0x5565('0x15')]=this[_0x5565('0xc')][_0x5565('0x15')];}var _0x18dd5d=this[_0x5565('0x13')];if(_0x18dd5d===_0x5565('0x16')){_0x367ce8['ChatWebsiteId']=this[_0x5565('0x17')]['id'];}else{_0x367ce8[_[_0x5565('0x18')](_0x18dd5d)+_0x5565('0x19')]=this[_0x5565('0x17')]['id'];}_0x367ce8[_['upperFirst'](_0x18dd5d)+_0x5565('0x1a')]=this[_0x5565('0xc')]['id'];if(this[_0x5565('0xc')][_0x5565('0x1b')]){var _0x433461=_0x5427a3[0x2];if(!_['isEmpty'](_0x433461)){_0x367ce8['body']=utils[_0x5565('0x1c')](_0x433461,this);return rpc[_0x18dd5d+_0x5565('0x1d')]['create'](_0x367ce8)[_0x5565('0x1e')](function(_0x42002c){logger[_0x5565('0xe')](_0x5565('0xf'),_0x106d59,_0x367ce8['body']);})['catch'](function(_0x1986e1){logger[_0x5565('0x1f')](_0x5565('0xf'),_0x106d59,JSON[_0x5565('0x20')](_0x1986e1));})[_0x5565('0x21')](function(){logger[_0x5565('0xe')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x106d59);_0xc88d42[_0x5565('0x22')]();});}else{logger[_0x5565('0xe')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x106d59);_0xc88d42[_0x5565('0x22')]();}}else{var _0x25f8c9=this;var _0x2344b6=apiai(_0x5427a3[0x0],{'language':_0x5427a3[0x1]||'en'});return _0x2344b6['textRequest'](this[_0x5565('0x23')]['body'],{'sessionId':md5(this[_0x5565('0xc')]['id'])})[_0x5565('0x1e')](function(_0x53f065){_0x25f8c9['body'][_0x5565('0x24')]=_0x53f065;_0x367ce8[_0x5565('0x25')]=_0x53f065[_0x5565('0x26')]['fulfillment']['speech'];_0x367ce8[_0x5565('0x27')]=_0x5565('0x24');_0x367ce8['providerResponse']=JSON[_0x5565('0x20')](_0x53f065);return rpc[_0x18dd5d+_0x5565('0x1d')]['create'](_0x367ce8)[_0x5565('0x1e')](function(_0x4eed17){logger[_0x5565('0xe')](_0x5565('0xf'),_0x106d59,_0x367ce8[_0x5565('0x25')]);if(_0x53f065[_0x5565('0x26')][_0x5565('0x28')][_0x5565('0x29')]){_0xc88d42[_0x5565('0x10')]();}else{_0xc88d42[_0x5565('0x22')]();}})[_0x5565('0x2a')](function(_0x4bde60){logger[_0x5565('0x1f')]('[%s][DIALOGFLOW]\x20%s',_0x106d59,JSON['stringify'](_0x4bde60));_0xc88d42[_0x5565('0x10')]();});})['catch'](function(_0x37925a){logger[_0x5565('0x1f')](_0x5565('0xf'),_0x106d59,_0x37925a['message']);_0xc88d42['next']();});}}catch(_0x33765b){logger[_0x5565('0x1f')](_0x5565('0xf'),_0x106d59,JSON['stringify'](_0x33765b));_0xc88d42['stop']();}};}; \ No newline at end of file +var _0x9a14=['AccountId','InteractionId','created','body','getMustacheRender','create','error','[%s][DIALOGFLOW]\x20%s','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','then','dialogflow','result','fulfillment','speech','providerName','stringify','Message','metadata','catch','message','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst'];(function(_0x18f21e,_0x175491){var _0x47f718=function(_0x31e354){while(--_0x31e354){_0x18f21e['push'](_0x18f21e['shift']());}};_0x47f718(++_0x175491);}(_0x9a14,0xa8));var _0x49a1=function(_0x4b743d,_0x59878d){_0x4b743d=_0x4b743d-0x0;var _0x4440e1=_0x9a14[_0x4b743d];return _0x4440e1;};'use strict';var _=require('lodash');var moment=require('moment');var apiai=require(_0x49a1('0x0'));var md5=require(_0x49a1('0x1'));var utils=require(_0x49a1('0x2'));var logger=require(_0x49a1('0x3'))(_0x49a1('0x4'));var rpc={'chatMessage':require(_0x49a1('0x5')),'openchannelMessage':require(_0x49a1('0x6')),'mailMessage':require(_0x49a1('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x9394fc,_0x2b210c){return function(_0x7ef1ba){try{if(!_['isNil'](this[_0x49a1('0x8')][_0x49a1('0x9')])){logger[_0x49a1('0xa')]('[%s][DIALOGFLOW]\x20%s',_0x9394fc,_0x49a1('0xb'));return _0x7ef1ba[_0x49a1('0xc')]();}var _0x572dea={'ContactId':this[_0x49a1('0xd')]['id'],'sentAt':moment()[_0x49a1('0xe')](_0x49a1('0xf')),'direction':_0x49a1('0x10')};if(this[_0x49a1('0x11')]==='sms'||this[_0x49a1('0x11')]===_0x49a1('0x12')){_0x572dea[_0x49a1('0x13')]=this[_0x49a1('0x8')][_0x49a1('0x13')];}var _0x420029=this[_0x49a1('0x11')];if(_0x420029===_0x49a1('0x14')){_0x572dea[_0x49a1('0x15')]=this[_0x49a1('0x16')]['id'];}else{_0x572dea[_[_0x49a1('0x17')](_0x420029)+_0x49a1('0x18')]=this[_0x49a1('0x16')]['id'];}_0x572dea[_[_0x49a1('0x17')](_0x420029)+_0x49a1('0x19')]=this['interaction']['id'];if(this[_0x49a1('0x8')][_0x49a1('0x1a')]){var _0x20aa5d=_0x2b210c[0x2];if(!_['isEmpty'](_0x20aa5d)){_0x572dea[_0x49a1('0x1b')]=utils[_0x49a1('0x1c')](_0x20aa5d,this);return rpc[_0x420029+'Message'][_0x49a1('0x1d')](_0x572dea)['then'](function(_0x3c1352){logger[_0x49a1('0xa')]('[%s][DIALOGFLOW]\x20%s',_0x9394fc,_0x572dea[_0x49a1('0x1b')]);})['catch'](function(_0x3578ec){logger[_0x49a1('0x1e')](_0x49a1('0x1f'),_0x9394fc,JSON['stringify'](_0x3578ec));})[_0x49a1('0x20')](function(){logger[_0x49a1('0xa')](_0x49a1('0x21'),_0x9394fc);_0x7ef1ba[_0x49a1('0x22')]();});}else{logger[_0x49a1('0xa')](_0x49a1('0x23'),_0x9394fc);_0x7ef1ba['stop']();}}else{var _0xe5c860=this;var _0x108d66=apiai(_0x2b210c[0x0],{'language':_0x2b210c[0x1]||'en'});return _0x108d66[_0x49a1('0x24')](this['message'][_0x49a1('0x1b')],{'sessionId':md5(this[_0x49a1('0x8')]['id'])})[_0x49a1('0x25')](function(_0x4b4bf3){_0xe5c860['body'][_0x49a1('0x26')]=_0x4b4bf3;_0x572dea[_0x49a1('0x1b')]=_0x4b4bf3[_0x49a1('0x27')][_0x49a1('0x28')][_0x49a1('0x29')];_0x572dea[_0x49a1('0x2a')]=_0x49a1('0x26');_0x572dea['providerResponse']=JSON[_0x49a1('0x2b')](_0x4b4bf3);return rpc[_0x420029+_0x49a1('0x2c')][_0x49a1('0x1d')](_0x572dea)[_0x49a1('0x25')](function(_0x20af10){logger[_0x49a1('0xa')](_0x49a1('0x1f'),_0x9394fc,_0x572dea[_0x49a1('0x1b')]);if(_0x4b4bf3['result'][_0x49a1('0x2d')]['endConversation']){_0x7ef1ba['next']();}else{_0x7ef1ba['stop']();}})[_0x49a1('0x2e')](function(_0x14f0a9){logger[_0x49a1('0x1e')]('[%s][DIALOGFLOW]\x20%s',_0x9394fc,JSON[_0x49a1('0x2b')](_0x14f0a9));_0x7ef1ba[_0x49a1('0xc')]();});})[_0x49a1('0x2e')](function(_0x330ec6){logger[_0x49a1('0x1e')](_0x49a1('0x1f'),_0x9394fc,_0x330ec6[_0x49a1('0x2f')]);_0x7ef1ba[_0x49a1('0xc')]();});}}catch(_0x3b6b86){logger[_0x49a1('0x1e')](_0x49a1('0x1f'),_0x9394fc,JSON[_0x49a1('0x2b')](_0x3b6b86));_0x7ef1ba[_0x49a1('0x22')]();}};}; \ 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 3ab13f4..a780085 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 _0x4839=['fields','end_conversation','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','boolValue','name','DIALOGFLOWV2_INTENTDISPLAYNAME','intent','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','intentDetectionConfidence','providerResponse','fulfillmentText','push','stack','dialogflow','md5','moment','bluebird','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','clone','Message','then','info','body','catch','error','[%s][DIALOGFLOWV2]\x20%s','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','sms','whatsapp','phone','channel','ChatWebsiteId','upperFirst','account','InteractionId','create','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0x4839,0x133));var _0x9483=function(_0x110c90,_0x7d605a){_0x110c90=_0x110c90-0x0;var _0x2982c6=_0x4839[_0x110c90];return _0x2982c6;};'use strict';var _=require('lodash');var dialogflow=require(_0x9483('0x0'));var md5=require(_0x9483('0x1'));var moment=require(_0x9483('0x2'));var Promise=require(_0x9483('0x3'));var logger=require('../../../../config/logger')(_0x9483('0x4'));var utils=require(_0x9483('0x5'));var rpc={'chatMessage':require(_0x9483('0x6')),'openchannelMessage':require(_0x9483('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x9483('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x9483('0x9'))};function createMessage(_0x5cc107,_0x44569d,_0x1d54d0,_0x3438b5){return new Promise(function(_0x519a5c,_0x588a99){var _0x597709=_[_0x9483('0xa')](_0x1d54d0);_0x597709['body']=_0x3438b5;return rpc[_0x44569d+_0x9483('0xb')]['create'](_0x597709)[_0x9483('0xc')](function(){logger[_0x9483('0xd')]('[%s][DIALOGFLOWV2]\x20%s',_0x5cc107,_0x597709[_0x9483('0xe')]);_0x519a5c();})[_0x9483('0xf')](function(_0x34204a){logger[_0x9483('0x10')](_0x9483('0x11'),_0x5cc107,JSON[_0x9483('0x12')](_0x34204a));_0x588a99(_0x34204a);});});}exports[_0x9483('0x13')]=function(_0x36005a,_0x1e8f8e){return function(_0x39961f){try{if(!_[_0x9483('0x14')](this[_0x9483('0x15')][_0x9483('0x16')])){logger[_0x9483('0xd')](_0x9483('0x11'),_0x36005a,_0x9483('0x17'));return _0x39961f[_0x9483('0x18')]();}var _0x424f49={'ContactId':this[_0x9483('0x19')]['id'],'sentAt':moment()['format'](_0x9483('0x1a')),'direction':'out'};if(this['channel']===_0x9483('0x1b')||this['channel']===_0x9483('0x1c')){_0x424f49[_0x9483('0x1d')]=this[_0x9483('0x15')]['phone'];}var _0x4fde3f=this[_0x9483('0x1e')];if(_0x4fde3f==='chat'){_0x424f49[_0x9483('0x1f')]=this['account']['id'];}else{_0x424f49[_[_0x9483('0x20')](_0x4fde3f)+'AccountId']=this[_0x9483('0x21')]['id'];}_0x424f49[_['upperFirst'](_0x4fde3f)+_0x9483('0x22')]=this[_0x9483('0x15')]['id'];if(this[_0x9483('0x15')]['created']){var _0x57b472=_0x1e8f8e[0x4];if(!_['isEmpty'](_0x57b472)){_0x424f49[_0x9483('0xe')]=utils['getMustacheRender'](_0x57b472,this);return rpc[_0x4fde3f+_0x9483('0xb')][_0x9483('0x23')](_0x424f49)['then'](function(_0x5be84c){logger['info'](_0x9483('0x11'),_0x36005a,_0x424f49['body']);})[_0x9483('0xf')](function(_0x223419){logger[_0x9483('0x10')](_0x9483('0x11'),_0x36005a,JSON[_0x9483('0x12')](_0x223419));})[_0x9483('0x24')](function(){logger[_0x9483('0xd')](_0x9483('0x25'),_0x36005a);_0x39961f[_0x9483('0x26')]();});}else{logger[_0x9483('0xd')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x36005a);_0x39961f[_0x9483('0x26')]();}}else{var _0x45edc2=this;var _0x57c50e=_0x1e8f8e[0x2][_0x9483('0x27')](/\\n/g,'\x0a');var _0x232773={'credentials':{'private_key':_0x57c50e,'client_email':_0x1e8f8e[0x1]}};var _0x498821=new dialogflow[(_0x9483('0x28'))](_0x232773);var _0x3b003e=_0x498821[_0x9483('0x29')](_0x1e8f8e[0x0],md5(_0x45edc2[_0x9483('0x15')]['id']));var _0x64f78d={'session':_0x3b003e,'queryInput':{'text':{'text':_0x45edc2[_0x9483('0x2a')][_0x9483('0xe')],'languageCode':_0x1e8f8e[0x3]||'en'}}};return _0x498821[_0x9483('0x2b')](_0x64f78d)['then'](function(_0x3035ee){if(_0x3035ee&&_0x3035ee[_0x9483('0x2c')]){_0x45edc2[_0x9483('0xe')][_0x9483('0x2d')]=_0x3035ee;var _0x23b4dd=_0x3035ee[0x0];var _0x1c2e4a=_0x23b4dd[_0x9483('0x2e')]['diagnosticInfo']&&_0x23b4dd[_0x9483('0x2e')][_0x9483('0x2f')]['fields']?_0x23b4dd[_0x9483('0x2e')][_0x9483('0x2f')][_0x9483('0x30')][_0x9483('0x31')]['boolValue']:![];_0x45edc2['body'][_0x9483('0x32')]=_0x23b4dd[_0x9483('0x2e')][_0x9483('0x33')];_0x45edc2[_0x9483('0xe')][_0x9483('0x34')]=_0x23b4dd[_0x9483('0x2e')][_0x9483('0x35')];_0x45edc2[_0x9483('0xe')][_0x9483('0x36')]=_0x23b4dd[_0x9483('0x2e')][_0x9483('0x2f')]&&_0x23b4dd['queryResult'][_0x9483('0x2f')]['fields']?_0x23b4dd[_0x9483('0x2e')][_0x9483('0x2f')][_0x9483('0x30')][_0x9483('0x31')][_0x9483('0x37')]:![];_0x45edc2['body']['DIALOGFLOWV2_INTENTNAME']=_0x23b4dd[_0x9483('0x2e')]['intent'][_0x9483('0x38')];_0x45edc2[_0x9483('0xe')][_0x9483('0x39')]=_0x23b4dd[_0x9483('0x2e')][_0x9483('0x3a')][_0x9483('0x3b')];_0x45edc2[_0x9483('0xe')][_0x9483('0x3c')]=_0x23b4dd['queryResult'][_0x9483('0x3a')][_0x9483('0x3d')];_0x45edc2['body'][_0x9483('0x3e')]=_0x23b4dd[_0x9483('0x2e')][_0x9483('0x3f')];_0x45edc2[_0x9483('0xe')][_0x9483('0x40')]=_0x23b4dd[_0x9483('0x2e')][_0x9483('0x41')];_0x45edc2[_0x9483('0xe')]['DIALOGFLOWV2_SCORE']=_0x23b4dd[_0x9483('0x2e')][_0x9483('0x42')];_0x424f49['providerName']=_0x9483('0x2d');_0x424f49[_0x9483('0x43')]=JSON[_0x9483('0x12')](_0x3035ee);var _0xb62e1e=[];for(var _0x5755ad=0x0;_0x5755ad<_0x3035ee['length'];_0x5755ad++){var _0x3e520f=_0x3035ee[_0x5755ad];if(_0x3e520f&&_0x3e520f['queryResult']&&_0x3e520f[_0x9483('0x2e')][_0x9483('0x44')]){_0xb62e1e[_0x9483('0x45')](createMessage(_0x36005a,_0x4fde3f,_0x424f49,_0x3e520f[_0x9483('0x2e')][_0x9483('0x44')]));}}return Promise['all'](_0xb62e1e)[_0x9483('0xc')](function(){if(_0x1c2e4a){_0x39961f[_0x9483('0x18')]();}else{_0x39961f['stop']();}})[_0x9483('0xf')](function(_0x5a8ec4){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x36005a,JSON[_0x9483('0x12')](_0x5a8ec4));_0x39961f[_0x9483('0x18')]();});}})[_0x9483('0xf')](function(_0x462922){logger['error'](_0x9483('0x11'),_0x36005a,_0x462922['message'],_0x462922[_0x9483('0x46')]);_0x39961f[_0x9483('0x18')]();});}}catch(_0x1ec412){logger[_0x9483('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x36005a,JSON['stringify'](_0x1ec412));_0x39961f[_0x9483('0x26')]();}};}; \ No newline at end of file +var _0xafff=['all','stack','lodash','dialogflow','md5','bluebird','../../../../config/logger','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','clone','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','channel','sms','whatsapp','phone','ChatWebsiteId','AccountId','upperFirst','InteractionId','created','isEmpty','getMustacheRender','body','error','finally','stop','replace','sessionPath','message','length','dialogflowV2','diagnosticInfo','queryResult','fields','end_conversation','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','boolValue','DIALOGFLOWV2_INTENTNAME','name','DIALOGFLOWV2_INTENTDISPLAYNAME','intent','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','push','fulfillmentText'];(function(_0x4d2263,_0x3fbf0d){var _0x24aba0=function(_0x389a59){while(--_0x389a59){_0x4d2263['push'](_0x4d2263['shift']());}};_0x24aba0(++_0x3fbf0d);}(_0xafff,0x112));var _0xfaff=function(_0x368c3f,_0x215ba5){_0x368c3f=_0x368c3f-0x0;var _0x4abd7a=_0xafff[_0x368c3f];return _0x4abd7a;};'use strict';var _=require(_0xfaff('0x0'));var dialogflow=require(_0xfaff('0x1'));var md5=require(_0xfaff('0x2'));var moment=require('moment');var Promise=require(_0xfaff('0x3'));var logger=require(_0xfaff('0x4'))('routing');var utils=require(_0xfaff('0x5'));var rpc={'chatMessage':require(_0xfaff('0x6')),'openchannelMessage':require(_0xfaff('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xfaff('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x5422e5,_0x4e2c20,_0x48e661,_0x510264){return new Promise(function(_0xf20981,_0x260c0b){var _0x232e3e=_[_0xfaff('0x9')](_0x48e661);_0x232e3e['body']=_0x510264;return rpc[_0x4e2c20+_0xfaff('0xa')][_0xfaff('0xb')](_0x232e3e)[_0xfaff('0xc')](function(){logger[_0xfaff('0xd')](_0xfaff('0xe'),_0x5422e5,_0x232e3e['body']);_0xf20981();})[_0xfaff('0xf')](function(_0x43e95){logger['error'](_0xfaff('0xe'),_0x5422e5,JSON[_0xfaff('0x10')](_0x43e95));_0x260c0b(_0x43e95);});});}exports[_0xfaff('0x11')]=function(_0x3b8be1,_0xf9d539){return function(_0x262e53){try{if(!_[_0xfaff('0x12')](this[_0xfaff('0x13')][_0xfaff('0x14')])){logger[_0xfaff('0xd')]('[%s][DIALOGFLOWV2]\x20%s',_0x3b8be1,_0xfaff('0x15'));return _0x262e53[_0xfaff('0x16')]();}var _0x20e759={'ContactId':this[_0xfaff('0x17')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0xfaff('0x18')]===_0xfaff('0x19')||this[_0xfaff('0x18')]===_0xfaff('0x1a')){_0x20e759[_0xfaff('0x1b')]=this[_0xfaff('0x13')]['phone'];}var _0x7a4c05=this[_0xfaff('0x18')];if(_0x7a4c05==='chat'){_0x20e759[_0xfaff('0x1c')]=this['account']['id'];}else{_0x20e759[_['upperFirst'](_0x7a4c05)+_0xfaff('0x1d')]=this['account']['id'];}_0x20e759[_[_0xfaff('0x1e')](_0x7a4c05)+_0xfaff('0x1f')]=this[_0xfaff('0x13')]['id'];if(this['interaction'][_0xfaff('0x20')]){var _0x2ab0e4=_0xf9d539[0x4];if(!_[_0xfaff('0x21')](_0x2ab0e4)){_0x20e759['body']=utils[_0xfaff('0x22')](_0x2ab0e4,this);return rpc[_0x7a4c05+_0xfaff('0xa')][_0xfaff('0xb')](_0x20e759)['then'](function(_0x3345d2){logger[_0xfaff('0xd')](_0xfaff('0xe'),_0x3b8be1,_0x20e759[_0xfaff('0x23')]);})[_0xfaff('0xf')](function(_0x376861){logger[_0xfaff('0x24')](_0xfaff('0xe'),_0x3b8be1,JSON[_0xfaff('0x10')](_0x376861));})[_0xfaff('0x25')](function(){logger[_0xfaff('0xd')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x3b8be1);_0x262e53[_0xfaff('0x26')]();});}else{logger[_0xfaff('0xd')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x3b8be1);_0x262e53[_0xfaff('0x26')]();}}else{var _0x2948f7=this;var _0x41c280=_0xf9d539[0x2][_0xfaff('0x27')](/\\n/g,'\x0a');var _0x39b4d0={'credentials':{'private_key':_0x41c280,'client_email':_0xf9d539[0x1]}};var _0x514018=new dialogflow['SessionsClient'](_0x39b4d0);var _0x2cb472=_0x514018[_0xfaff('0x28')](_0xf9d539[0x0],md5(_0x2948f7[_0xfaff('0x13')]['id']));var _0x573ec8={'session':_0x2cb472,'queryInput':{'text':{'text':_0x2948f7[_0xfaff('0x29')][_0xfaff('0x23')],'languageCode':_0xf9d539[0x3]||'en'}}};return _0x514018['detectIntent'](_0x573ec8)[_0xfaff('0xc')](function(_0x5cd9a4){if(_0x5cd9a4&&_0x5cd9a4[_0xfaff('0x2a')]){_0x2948f7[_0xfaff('0x23')][_0xfaff('0x2b')]=_0x5cd9a4;var _0xfd0140=_0x5cd9a4[0x0];var _0x1fd15f=_0xfd0140['queryResult'][_0xfaff('0x2c')]&&_0xfd0140[_0xfaff('0x2d')][_0xfaff('0x2c')][_0xfaff('0x2e')]?_0xfd0140['queryResult'][_0xfaff('0x2c')]['fields'][_0xfaff('0x2f')]['boolValue']:![];_0x2948f7[_0xfaff('0x23')][_0xfaff('0x30')]=_0xfd0140['queryResult'][_0xfaff('0x31')];_0x2948f7[_0xfaff('0x23')][_0xfaff('0x32')]=_0xfd0140[_0xfaff('0x2d')][_0xfaff('0x33')];_0x2948f7[_0xfaff('0x23')][_0xfaff('0x34')]=_0xfd0140['queryResult']['diagnosticInfo']&&_0xfd0140[_0xfaff('0x2d')]['diagnosticInfo']['fields']?_0xfd0140[_0xfaff('0x2d')][_0xfaff('0x2c')][_0xfaff('0x2e')]['end_conversation'][_0xfaff('0x35')]:![];_0x2948f7[_0xfaff('0x23')][_0xfaff('0x36')]=_0xfd0140[_0xfaff('0x2d')]['intent'][_0xfaff('0x37')];_0x2948f7[_0xfaff('0x23')][_0xfaff('0x38')]=_0xfd0140[_0xfaff('0x2d')][_0xfaff('0x39')]['displayName'];_0x2948f7['body'][_0xfaff('0x3a')]=_0xfd0140[_0xfaff('0x2d')][_0xfaff('0x39')][_0xfaff('0x3b')];_0x2948f7[_0xfaff('0x23')][_0xfaff('0x3c')]=_0xfd0140[_0xfaff('0x2d')]['languageCode'];_0x2948f7[_0xfaff('0x23')]['DIALOGFLOWV2_QUERYTEXT']=_0xfd0140[_0xfaff('0x2d')]['queryText'];_0x2948f7['body'][_0xfaff('0x3d')]=_0xfd0140['queryResult'][_0xfaff('0x3e')];_0x20e759[_0xfaff('0x3f')]=_0xfaff('0x2b');_0x20e759['providerResponse']=JSON['stringify'](_0x5cd9a4);var _0x72ce6c=[];for(var _0x3da53a=0x0;_0x3da53a<_0x5cd9a4['length'];_0x3da53a++){var _0x162ab5=_0x5cd9a4[_0x3da53a];if(_0x162ab5&&_0x162ab5[_0xfaff('0x2d')]&&_0x162ab5['queryResult']['fulfillmentText']){_0x72ce6c[_0xfaff('0x40')](createMessage(_0x3b8be1,_0x7a4c05,_0x20e759,_0x162ab5[_0xfaff('0x2d')][_0xfaff('0x41')]));}}return Promise[_0xfaff('0x42')](_0x72ce6c)[_0xfaff('0xc')](function(){if(_0x1fd15f){_0x262e53[_0xfaff('0x16')]();}else{_0x262e53[_0xfaff('0x26')]();}})[_0xfaff('0xf')](function(_0x3417af){logger[_0xfaff('0x24')](_0xfaff('0xe'),_0x3b8be1,JSON[_0xfaff('0x10')](_0x3417af));_0x262e53[_0xfaff('0x16')]();});}})['catch'](function(_0x29b4e0){logger[_0xfaff('0x24')](_0xfaff('0xe'),_0x3b8be1,_0x29b4e0[_0xfaff('0x29')],_0x29b4e0[_0xfaff('0x43')]);_0x262e53['next']();});}}catch(_0x309705){logger[_0xfaff('0x24')](_0xfaff('0xe'),_0x3b8be1,JSON[_0xfaff('0x10')](_0x309705));_0x262e53[_0xfaff('0x26')]();}};}; \ 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 c59c86b..68fa756 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 _0x7db1=['condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityTrue','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','html-to-text','./utils','../../../../config/logger'];(function(_0x15c922,_0x538013){var _0xa4df75=function(_0x5dd8df){while(--_0x5dd8df){_0x15c922['push'](_0x15c922['shift']());}};_0xa4df75(++_0x538013);}(_0x7db1,0x10a));var _0x17db=function(_0x44e577,_0x16a38d){_0x44e577=_0x44e577-0x0;var _0x2ff124=_0x7db1[_0x44e577];return _0x2ff124;};'use strict';var schema=require(_0x17db('0x0'));var _=require('lodash');var htmlToText=require(_0x17db('0x1'));var utils=require(_0x17db('0x2'));var logger=require(_0x17db('0x3'))('routing');var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x17db('0x4')},'priorityTrue':{'type':_0x17db('0x5'),'message':_0x17db('0x6')},'priorityFalse':{'type':_0x17db('0x5'),'message':_0x17db('0x7')}});exports[_0x17db('0x8')]=function(_0x5b15c5,_0x5b7924){return function(_0x43a4e4){try{var _0x2ebf45={'condition':htmlToText['fromString'](utils['getMustacheRender'](_0x5b7924[0x0],this),{'wordwrap':![]})[_0x17db('0x9')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x5b7924[0x1],'priorityFalse':_0x5b7924[0x2]};var _0x4a4039=gotoif[_0x17db('0x0')](_0x2ebf45,{'typecast':!![]});if(_0x4a4039[_0x17db('0xa')]){logger[_0x17db('0xb')](_0x17db('0xc'),_0x5b15c5,_[_0x17db('0xd')](_0x4a4039,_0x17db('0xe'))[_0x17db('0xf')](',\x20'));_0x43a4e4[_0x17db('0x10')]();}else{try{var _0x55c4c4=eval('('+_0x2ebf45[_0x17db('0x11')]+')');var _0xd11291=_0x55c4c4?_0x2ebf45[_0x17db('0x12')]:_0x2ebf45['priorityFalse'];logger[_0x17db('0x13')](_0x17db('0x14'),_0x5b15c5,_0x2ebf45[_0x17db('0x11')],_0x55c4c4,_0xd11291||_0x17db('0x15'));if(_0xd11291){var _0x5c7014=_[_0x17db('0x16')](_0x43a4e4['rules'](),{'p':_0xd11291});if(_0x5c7014>=0x0){logger[_0x17db('0x13')](_0x17db('0x17'),_0x5b15c5,_0xd11291||'next',_0x5c7014);_0x43a4e4[_0x17db('0x15')](_0x5c7014);}else{logger[_0x17db('0x13')](_0x17db('0x18'),_0x5b15c5,_0xd11291||_0x17db('0x15'));_0x43a4e4[_0x17db('0x10')]();}}else{_0x43a4e4[_0x17db('0x15')]();}}catch(_0x3c2d36){logger['error'](_0x17db('0x19'),_0x5b15c5,_0x3c2d36[_0x17db('0xe')]);_0x43a4e4['stop']();}}}catch(_0x34500c){logger[_0x17db('0xb')](_0x17db('0xc'),_0x5b15c5,JSON[_0x17db('0x1a')](_0x34500c));_0x43a4e4['stop']();}};}; \ No newline at end of file +var _0xe2ff=['[%s][GOTOIF]\x20%s','map','join','stop','priorityTrue','info','condition','next','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify','validate','lodash','html-to-text','../../../../config/logger','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','replace','length','error'];(function(_0x5e4b85,_0x6cf965){var _0x5cd3cb=function(_0x589c9e){while(--_0x589c9e){_0x5e4b85['push'](_0x5e4b85['shift']());}};_0x5cd3cb(++_0x6cf965);}(_0xe2ff,0x160));var _0xfe2f=function(_0x638984,_0x24b52a){_0x638984=_0x638984-0x0;var _0x2c0f0e=_0xe2ff[_0x638984];return _0x2c0f0e;};'use strict';var schema=require(_0xfe2f('0x0'));var _=require(_0xfe2f('0x1'));var htmlToText=require(_0xfe2f('0x2'));var utils=require('./utils');var logger=require(_0xfe2f('0x3'))('routing');var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0xfe2f('0x4')},'priorityTrue':{'type':_0xfe2f('0x5'),'message':_0xfe2f('0x6')},'priorityFalse':{'type':_0xfe2f('0x5'),'message':_0xfe2f('0x7')}});exports['consequence']=function(_0xfc41ae,_0x23a73c){return function(_0x188fed){try{var _0x31c4a0={'condition':htmlToText[_0xfe2f('0x8')](utils['getMustacheRender'](_0x23a73c[0x0],this),{'wordwrap':![]})[_0xfe2f('0x9')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x23a73c[0x1],'priorityFalse':_0x23a73c[0x2]};var _0x4613fd=gotoif[_0xfe2f('0x0')](_0x31c4a0,{'typecast':!![]});if(_0x4613fd[_0xfe2f('0xa')]){logger[_0xfe2f('0xb')](_0xfe2f('0xc'),_0xfc41ae,_[_0xfe2f('0xd')](_0x4613fd,'message')[_0xfe2f('0xe')](',\x20'));_0x188fed[_0xfe2f('0xf')]();}else{try{var _0x41ba22=eval('('+_0x31c4a0['condition']+')');var _0x37b8b1=_0x41ba22?_0x31c4a0[_0xfe2f('0x10')]:_0x31c4a0['priorityFalse'];logger[_0xfe2f('0x11')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0xfc41ae,_0x31c4a0[_0xfe2f('0x12')],_0x41ba22,_0x37b8b1||_0xfe2f('0x13'));if(_0x37b8b1){var _0x44d963=_['findIndex'](_0x188fed[_0xfe2f('0x14')](),{'p':_0x37b8b1});if(_0x44d963>=0x0){logger[_0xfe2f('0x11')](_0xfe2f('0x15'),_0xfc41ae,_0x37b8b1||_0xfe2f('0x13'),_0x44d963);_0x188fed[_0xfe2f('0x13')](_0x44d963);}else{logger[_0xfe2f('0x11')](_0xfe2f('0x16'),_0xfc41ae,_0x37b8b1||_0xfe2f('0x13'));_0x188fed[_0xfe2f('0xf')]();}}else{_0x188fed[_0xfe2f('0x13')]();}}catch(_0x430502){logger[_0xfe2f('0xb')](_0xfe2f('0x17'),_0xfc41ae,_0x430502[_0xfe2f('0x18')]);_0x188fed[_0xfe2f('0xf')]();}}}catch(_0x4dbafc){logger['error'](_0xfe2f('0xc'),_0xfc41ae,JSON[_0xfe2f('0x19')](_0x4dbafc));_0x188fed[_0xfe2f('0xf')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 934b568..a6b415e 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 _0x4142=['number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][GOTOP]\x20%s','map','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','next','stringify','routing'];(function(_0x24a6bf,_0x357772){var _0x21cf49=function(_0x25e93a){while(--_0x25e93a){_0x24a6bf['push'](_0x24a6bf['shift']());}};_0x21cf49(++_0x357772);}(_0x4142,0x179));var _0x2414=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4142[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require('validate');var _=require('lodash');var logger=require('../../../../config/logger')(_0x2414('0x0'));var gotop=schema({'priority':{'type':_0x2414('0x1'),'required':!![],'message':_0x2414('0x2')}});exports[_0x2414('0x3')]=function(_0x298960,_0x381af9){return function(_0x1a3487){try{var _0x1df9d7={'priority':_0x381af9[0x0]};var _0x252b23=gotop[_0x2414('0x4')](_0x1df9d7,{'typecast':!![]});if(_0x252b23[_0x2414('0x5')]){logger[_0x2414('0x6')](_0x2414('0x7'),_0x298960,_[_0x2414('0x8')](_0x252b23,'message')[_0x2414('0x9')](',\x20'));_0x1a3487[_0x2414('0xa')]();}else{logger[_0x2414('0xb')](_0x2414('0xc'),_0x298960,_0x1df9d7['priority']);if(_0x1df9d7[_0x2414('0xd')]){var _0x355cc0=_[_0x2414('0xe')](_0x1a3487['rules'](),{'p':_0x1df9d7['priority']});if(_0x355cc0>=0x0){logger['info']('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x298960,_0x1df9d7[_0x2414('0xd')]||'next',_0x355cc0);_0x1a3487['next'](_0x355cc0);}else{logger[_0x2414('0xb')](_0x2414('0xf'),_0x298960,_0x1df9d7[_0x2414('0xd')]||_0x2414('0x10'));_0x1a3487[_0x2414('0xa')]();}}else{_0x1a3487[_0x2414('0x10')]();}}}catch(_0x2f45e7){logger[_0x2414('0x6')](_0x2414('0x7'),_0x298960,JSON[_0x2414('0x11')](_0x2f45e7));_0x1a3487[_0x2414('0xa')]();}};}; \ No newline at end of file +var _0x3bda=['map','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','routing','number','consequence','length','error','[%s][GOTOP]\x20%s'];(function(_0x41e614,_0x4d5713){var _0x547787=function(_0x134477){while(--_0x134477){_0x41e614['push'](_0x41e614['shift']());}};_0x547787(++_0x4d5713);}(_0x3bda,0x106));var _0xa3bd=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0x3bda[_0x5ddaac];return _0x2a9c58;};'use strict';var schema=require(_0xa3bd('0x0'));var _=require(_0xa3bd('0x1'));var logger=require('../../../../config/logger')(_0xa3bd('0x2'));var gotop=schema({'priority':{'type':_0xa3bd('0x3'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xa3bd('0x4')]=function(_0x38f590,_0x2b64b3){return function(_0x4f3f5e){try{var _0x324f6e={'priority':_0x2b64b3[0x0]};var _0x346a82=gotop[_0xa3bd('0x0')](_0x324f6e,{'typecast':!![]});if(_0x346a82[_0xa3bd('0x5')]){logger[_0xa3bd('0x6')](_0xa3bd('0x7'),_0x38f590,_[_0xa3bd('0x8')](_0x346a82,'message')[_0xa3bd('0x9')](',\x20'));_0x4f3f5e[_0xa3bd('0xa')]();}else{logger[_0xa3bd('0xb')](_0xa3bd('0xc'),_0x38f590,_0x324f6e[_0xa3bd('0xd')]);if(_0x324f6e[_0xa3bd('0xd')]){var _0x2b5f3f=_[_0xa3bd('0xe')](_0x4f3f5e['rules'](),{'p':_0x324f6e[_0xa3bd('0xd')]});if(_0x2b5f3f>=0x0){logger[_0xa3bd('0xb')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x38f590,_0x324f6e[_0xa3bd('0xd')]||_0xa3bd('0xf'),_0x2b5f3f);_0x4f3f5e[_0xa3bd('0xf')](_0x2b5f3f);}else{logger[_0xa3bd('0xb')](_0xa3bd('0x10'),_0x38f590,_0x324f6e[_0xa3bd('0xd')]||_0xa3bd('0xf'));_0x4f3f5e[_0xa3bd('0xa')]();}}else{_0x4f3f5e['next']();}}}catch(_0x46e817){logger[_0xa3bd('0x6')](_0xa3bd('0x7'),_0x38f590,JSON[_0xa3bd('0x11')](_0x46e817));_0x4f3f5e['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index c12ffd4..3b0a6a5 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 _0x73a1=['[%s][MESSAGE]\x20%s','stringify','stop','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','InteractionId','interaction','create','info','body','next','catch','error'];(function(_0x439a9a,_0xfe21a3){var _0x585f97=function(_0x587358){while(--_0x587358){_0x439a9a['push'](_0x439a9a['shift']());}};_0x585f97(++_0xfe21a3);}(_0x73a1,0x161));var _0x173a=function(_0x5d8631,_0x44944b){_0x5d8631=_0x5d8631-0x0;var _0x34c15e=_0x73a1[_0x5d8631];return _0x34c15e;};'use strict';var _=require('lodash');var utils=require('./utils');var logger=require(_0x173a('0x0'))(_0x173a('0x1'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x173a('0x2')),'mailMessage':require(_0x173a('0x3')),'smsMessage':require(_0x173a('0x4')),'faxMessage':require(_0x173a('0x5')),'whatsappMessage':require(_0x173a('0x6'))};exports['consequence']=function(_0x417ec0,_0x1a8b94){return function(_0xac84a){try{var _0xbd8757={'body':utils[_0x173a('0x7')](_0x1a8b94[0x0],this),'ContactId':this[_0x173a('0x8')]['id']};if(this[_0x173a('0x9')]===_0x173a('0xa')){_0xbd8757[_0x173a('0xb')]=this[_0x173a('0xc')]['id'];}else{_0xbd8757[_[_0x173a('0xd')](this[_0x173a('0x9')])+'AccountId']=this[_0x173a('0xc')]['id'];}_0xbd8757[_['upperFirst'](this[_0x173a('0x9')])+_0x173a('0xe')]=this[_0x173a('0xf')]['id'];if(rpc[this[_0x173a('0x9')]+'Message']){return rpc[this[_0x173a('0x9')]+'Message'][_0x173a('0x10')](_0xbd8757)['then'](function(_0x127dc2){logger[_0x173a('0x11')]('[%s][MESSAGE]\x20%s',_0x417ec0,_0xbd8757[_0x173a('0x12')]);_0xac84a[_0x173a('0x13')]();})[_0x173a('0x14')](function(_0x20eb9f){logger[_0x173a('0x15')](_0x173a('0x16'),_0x417ec0,JSON[_0x173a('0x17')](_0x20eb9f));_0xac84a[_0x173a('0x18')]();});}}catch(_0x5e4252){logger[_0x173a('0x15')](_0x173a('0x16'),_0x417ec0,JSON[_0x173a('0x17')](_0x5e4252));_0xac84a['stop']();}};}; \ No newline at end of file +var _0x4ffe=['[%s][MESSAGE]\x20%s','next','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','interaction','Message','then'];(function(_0x48a830,_0x200d85){var _0x1ad000=function(_0x11183e){while(--_0x11183e){_0x48a830['push'](_0x48a830['shift']());}};_0x1ad000(++_0x200d85);}(_0x4ffe,0x172));var _0xe4ff=function(_0x566342,_0x4a8a5d){_0x566342=_0x566342-0x0;var _0x1271e6=_0x4ffe[_0x566342];return _0x1271e6;};'use strict';var _=require(_0xe4ff('0x0'));var utils=require(_0xe4ff('0x1'));var logger=require(_0xe4ff('0x2'))('routing');var rpc={'chatMessage':require(_0xe4ff('0x3')),'openchannelMessage':require(_0xe4ff('0x4')),'mailMessage':require(_0xe4ff('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xe4ff('0x6')),'whatsappMessage':require(_0xe4ff('0x7'))};exports[_0xe4ff('0x8')]=function(_0x33a19a,_0x68c0c7){return function(_0x50250d){try{var _0x5eed52={'body':utils[_0xe4ff('0x9')](_0x68c0c7[0x0],this),'ContactId':this[_0xe4ff('0xa')]['id']};if(this[_0xe4ff('0xb')]==='chat'){_0x5eed52[_0xe4ff('0xc')]=this['account']['id'];}else{_0x5eed52[_[_0xe4ff('0xd')](this[_0xe4ff('0xb')])+_0xe4ff('0xe')]=this[_0xe4ff('0xf')]['id'];}_0x5eed52[_['upperFirst'](this['channel'])+_0xe4ff('0x10')]=this[_0xe4ff('0x11')]['id'];if(rpc[this[_0xe4ff('0xb')]+_0xe4ff('0x12')]){return rpc[this[_0xe4ff('0xb')]+_0xe4ff('0x12')]['create'](_0x5eed52)[_0xe4ff('0x13')](function(_0x20c8c1){logger['info'](_0xe4ff('0x14'),_0x33a19a,_0x5eed52['body']);_0x50250d[_0xe4ff('0x15')]();})[_0xe4ff('0x16')](function(_0x5702dc){logger[_0xe4ff('0x17')](_0xe4ff('0x14'),_0x33a19a,JSON[_0xe4ff('0x18')](_0x5702dc));_0x50250d[_0xe4ff('0x19')]();});}}catch(_0x2b7212){logger[_0xe4ff('0x17')]('[%s][MESSAGE]\x20%s',_0x33a19a,JSON[_0xe4ff('0x18')](_0x2b7212));_0x50250d[_0xe4ff('0x19')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index b81b2de..e3a1b5f 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 _0x20bb=['getMustacheRender','next','error','[%s][NOOP]\x20%s','stringify','stop','../../../../config/logger','routing','consequence'];(function(_0x3b185c,_0x5a3f59){var _0x567483=function(_0x50a73b){while(--_0x50a73b){_0x3b185c['push'](_0x3b185c['shift']());}};_0x567483(++_0x5a3f59);}(_0x20bb,0x180));var _0xb20b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x20bb[_0x321bb2];return _0x9c12ed;};'use strict';var utils=require('./utils');var logger=require(_0xb20b('0x0'))(_0xb20b('0x1'));exports[_0xb20b('0x2')]=function(_0x30518d,_0x13b6be){return function(_0x4ebf11){try{logger['info']('[%s][NOOP]\x20%s',_0x30518d,utils[_0xb20b('0x3')](_0x13b6be[0x0],this));_0x4ebf11[_0xb20b('0x4')]();}catch(_0x3c41c9){logger[_0xb20b('0x5')](_0xb20b('0x6'),_0x30518d,JSON[_0xb20b('0x7')](_0x3c41c9));_0x4ebf11[_0xb20b('0x8')]();}};}; \ No newline at end of file +var _0xbb19=['routing','consequence','info','next','[%s][NOOP]\x20%s','stringify','./utils'];(function(_0xa606b7,_0x565ca5){var _0x3e5f8b=function(_0x1705c8){while(--_0x1705c8){_0xa606b7['push'](_0xa606b7['shift']());}};_0x3e5f8b(++_0x565ca5);}(_0xbb19,0xd1));var _0x9bb1=function(_0x516ec5,_0x1da856){_0x516ec5=_0x516ec5-0x0;var _0x3e1681=_0xbb19[_0x516ec5];return _0x3e1681;};'use strict';var utils=require(_0x9bb1('0x0'));var logger=require('../../../../config/logger')(_0x9bb1('0x1'));exports[_0x9bb1('0x2')]=function(_0x5b93cf,_0x13b435){return function(_0x47e530){try{logger[_0x9bb1('0x3')]('[%s][NOOP]\x20%s',_0x5b93cf,utils['getMustacheRender'](_0x13b435[0x0],this));_0x47e530[_0x9bb1('0x4')]();}catch(_0x49c88d){logger['error'](_0x9bb1('0x5'),_0x5b93cf,JSON[_0x9bb1('0x6')](_0x49c88d));_0x47e530['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 9176fc3..a43b826 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 _0x2828=['%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','contact','list','channel','QueueId','upperFirst','interaction','MessageId','message','chat','WebsiteId','info','name','QueueReport','catch','create\x20queue\x20report','waiting','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','then','update','error','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','[%s][QUEUE]\x20%s','map','stop','find','Queues','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','next','strategy','stack','validate','util','seq-queue','moment','../../../../config/environment','../../../../config/logger','./strategy','redis','defaults','socket.io-emitter','queue_id','account','queue','from','joinAt','clone','push','capitalize','InteractionId','format','pick','%sQueuesWaitingInteractions'];(function(_0x101176,_0x1ad975){var _0x4ec27c=function(_0x13b7bb){while(--_0x13b7bb){_0x101176['push'](_0x101176['shift']());}};_0x4ec27c(++_0x1ad975);}(_0x2828,0x18e));var _0x8282=function(_0x400096,_0x101dc3){_0x400096=_0x400096-0x0;var _0x31755a=_0x2828[_0x400096];return _0x31755a;};'use strict';var schema=require(_0x8282('0x0'));var _=require('lodash');var util=require(_0x8282('0x1'));var seqqueue=require(_0x8282('0x2'));var moment=require(_0x8282('0x3'));var Redis=require('ioredis');var config=require(_0x8282('0x4'));var logger=require(_0x8282('0x5'))('routing');var strategy=require(_0x8282('0x6'));config[_0x8282('0x7')]=_[_0x8282('0x8')](config[_0x8282('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x8282('0x9'))(new Redis(config['redis']));var attributes=['id',_0x8282('0xa'),_0x8282('0xb'),_0x8282('0xc'),_0x8282('0xd'),_0x8282('0xe')];function emit(_0x5ea25a,_0x1aa25a,_0x17f742){io['to'](_0x5ea25a)['emit'](_0x1aa25a,_0x17f742);}function emitChannelQueueInteraction(_0xf0782b,_0x16dcb2,_0x32b3aa,_0x4fe098,_0x2d2691,_0x5ba6c4,_0x144d62,_0x40a09b){var _0x572997=_[_0x8282('0xf')](_0x32b3aa);_0x572997['queue_id']=_0x40a09b;_0x572997[_0x8282('0xc')]=_0x16dcb2;_0x572997['account']=_0x4fe098;_0x572997['id']=_0x2d2691;if(_0x5ba6c4){attributes[_0x8282('0x10')](_[_0x8282('0x11')](_0xf0782b)+_0x8282('0x12'));_0x144d62[util[_0x8282('0x13')]('%sQueuesWaitingInteractions',_0xf0782b)][_0x2d2691]=_[_0x8282('0x14')](_0x572997,attributes);}else{delete _0x144d62[util[_0x8282('0x13')](_0x8282('0x15'),_0xf0782b)][_0x2d2691];}emit(util[_0x8282('0x13')]('%s:queue:%s',_0xf0782b,_0x16dcb2),util[_0x8282('0x13')](_0x8282('0x16'),_0xf0782b,_0x5ba6c4?_0x8282('0x17'):_0x8282('0x18')),_[_0x8282('0x14')](_0x572997,attributes));}var rpc={'openchannelQueueReport':require(_0x8282('0x19')),'mailQueueReport':require(_0x8282('0x1a')),'chatQueueReport':require(_0x8282('0x1b')),'smsQueueReport':require(_0x8282('0x1c')),'faxQueueReport':require(_0x8282('0x1d')),'whatsappQueueReport':require(_0x8282('0x1e')),'chatInteraction':require('../../rpc/chatInteraction'),'faxInteraction':require(_0x8282('0x1f')),'mailInteraction':require(_0x8282('0x20')),'openchannelInteraction':require(_0x8282('0x21')),'smsInteraction':require(_0x8282('0x22')),'whatsappInteraction':require(_0x8282('0x23'))};var queue=schema({'name':{'type':_0x8282('0x24'),'required':!![],'message':_0x8282('0x25')},'timeout':{'type':_0x8282('0x26'),'message':_0x8282('0x27')}});function startRouting(_0x379345,_0x3f3ea1,_0x466e85,_0x16e4c9){if(_0x379345&&_0x3f3ea1&&_0x466e85){_0x3f3ea1['waiting']+=0x1;var _0x20923c={'uniqueid':_0x379345,'from':_0x466e85[_0x8282('0x28')]?_0x466e85[_0x8282('0x28')]['from']:'','joinAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x466e85['contact']?_0x466e85[_0x8282('0x29')]['id']:null,'ListId':_0x466e85['list']?_0x466e85[_0x8282('0x2a')]['id']:null};_0x20923c[_['upperFirst'](_0x466e85[_0x8282('0x2b')])+_0x8282('0x2c')]=_0x3f3ea1['id']||null;_0x20923c[_[_0x8282('0x2d')](_0x466e85[_0x8282('0x2b')])+_0x8282('0x12')]=_0x466e85[_0x8282('0x2e')]?_0x466e85[_0x8282('0x2e')]['id']:null;_0x20923c[_[_0x8282('0x2d')](_0x466e85[_0x8282('0x2b')])+_0x8282('0x2f')]=_0x466e85['message']?_0x466e85[_0x8282('0x30')]['id']:null;_0x20923c[_[_0x8282('0x2d')](_0x466e85[_0x8282('0x2b')])+(_0x466e85[_0x8282('0x2b')]!==_0x8282('0x31')?'AccountId':_0x8282('0x32'))]=_0x466e85[_0x8282('0xb')]?_0x466e85[_0x8282('0xb')]['id']:null;logger[_0x8282('0x33')](util[_0x8282('0x13')]('[%s][START:QUEUE][NAME:%s]',_0x379345,_0x3f3ea1[_0x8282('0x34')]));emitChannelQueueInteraction(_0x466e85[_0x8282('0x2b')],_0x3f3ea1['name'],_0x20923c,_0x466e85[_0x8282('0xb')][_0x8282('0x34')],_0x466e85[_0x8282('0x30')]['id'],!![],_0x16e4c9,_0x3f3ea1['id']);if(rpc[_0x466e85[_0x8282('0x2b')]+_0x8282('0x35')]){return rpc[_0x466e85[_0x8282('0x2b')]+_0x8282('0x35')]['create'](_0x20923c)[_0x8282('0x36')](function(_0x5ce507){logger['error'](_0x8282('0x37'),_0x5ce507);});}}}function stopRouting(_0x5bd7a1,_0x948496,_0x262c7f,_0x1b9fc1){if(_0x5bd7a1&&_0x948496){_0x948496[_0x8282('0x38')]-=0x1;var _0xe5cebf={'leaveAt':moment()['format'](_0x8282('0x39')),'acceptAt':moment()[_0x8282('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x8282('0x3a')};logger[_0x8282('0x33')](util['format'](_0x8282('0x3b'),_0x5bd7a1,_0x948496[_0x8282('0x34')]));emitChannelQueueInteraction(_0x262c7f[_0x8282('0x2b')],_0x948496[_0x8282('0x34')],_0x262c7f[_0x8282('0x28')],_0x262c7f['account'][_0x8282('0x34')],_0x262c7f[_0x8282('0x30')]['id'],![],_0x1b9fc1,_0x948496['id']);return rpc[_0x262c7f['channel']+_0x8282('0x3c')]['update'](_0x262c7f['interaction']['id'],{'queueId':_0x948496['id']})[_0x8282('0x3d')](function(){if(rpc[_0x262c7f[_0x8282('0x2b')]+_0x8282('0x35')]){return rpc[_0x262c7f[_0x8282('0x2b')]+_0x8282('0x35')][_0x8282('0x3e')](_0x5bd7a1,_0xe5cebf)['catch'](function(_0x155ab6){logger[_0x8282('0x3f')](_0x8282('0x40'),_0x155ab6);});}});}}function endRouting(_0x115666,_0xabc128,_0x4a65f9,_0x266595){if(_0x115666&&_0xabc128){_0xabc128[_0x8282('0x38')]-=0x1;var _0x313554={'leaveAt':moment()[_0x8282('0x13')](_0x8282('0x39')),'exitAt':moment()[_0x8282('0x13')](_0x8282('0x39')),'reason':'timeout'};logger['info'](util[_0x8282('0x13')](_0x8282('0x41'),_0x115666,_0xabc128['name']));emitChannelQueueInteraction(_0x4a65f9[_0x8282('0x2b')],_0xabc128[_0x8282('0x34')],_0x4a65f9[_0x8282('0x28')],_0x4a65f9[_0x8282('0xb')][_0x8282('0x34')],_0x4a65f9[_0x8282('0x30')]['id'],![],_0x266595);if(rpc[_0x4a65f9[_0x8282('0x2b')]+'QueueReport']){return rpc[_0x4a65f9[_0x8282('0x2b')]+'QueueReport'][_0x8282('0x3e')](_0x115666,_0x313554)[_0x8282('0x36')](function(_0x1be5ff){logger['error']('update\x20queue\x20report',_0x1be5ff);});}}}function handleFindQueue(_0x24bec5){return function(_0x4ef1ee){return _0x4ef1ee['name']['toLowerCase']()===_0x24bec5[_0x8282('0x42')]();};}exports[_0x8282('0x43')]=function(_0x12f44c,_0x3db09b,_0x163ed1,_0x420097){return function(_0x3c5445){try{var _0x435d1f={'name':_0x3db09b[0x0],'timeout':_0x3db09b[0x1]};var _0x11375e=queue['validate'](_0x435d1f,{'typecast':!![]});if(_0x11375e['length']){logger['error'](_0x8282('0x44'),_0x12f44c,_[_0x8282('0x45')](_0x11375e,_0x8282('0x30'))['join'](',\x20'));_0x3c5445[_0x8282('0x46')]();}else{var _0x25b756=_[_0x8282('0x47')](_0x163ed1[_0x420097[_0x8282('0x2b')]+_0x8282('0x48')],handleFindQueue(_0x435d1f[_0x8282('0x34')]));if(_0x25b756){startRouting(_0x12f44c,_0x25b756,_0x420097,_0x163ed1);var _0x479a54=(_0x25b756['timeout']||0xa)*0x3e8;var _0x180bf1=(_0x435d1f['timeout']||0x14)*0x3e8;var _0x286b17;if(_0x479a54>_0x180bf1){_0x180bf1=_0x479a54;}var _0x48ce1e=seqqueue['createQueue'](_0x479a54);_0x48ce1e['id']=_0x12f44c;_0x48ce1e[_0x8282('0x49')]=_0x479a54;_0x48ce1e[_0x8282('0x4a')]=_0x180bf1;_0x48ce1e[_0x8282('0x2b')]=_0x420097['channel'];_0x163ed1[_0x8282('0x4b')][_0x12f44c]['on'](_0x8282('0x4c'),function(){logger['info'](_0x8282('0x4d'),_0x12f44c);stopRouting(_0x12f44c,_0x25b756,_0x420097,_0x163ed1);clearTimeout(_0x286b17);_0x286b17=undefined;_0x48ce1e['close'](!![]);if(_0x163ed1['rules'][_0x12f44c]){delete _0x163ed1[_0x8282('0x4b')][_0x12f44c];}_0x3c5445['stop']();});_0x163ed1['rules'][_0x12f44c]['on'](_0x8282('0x4e'),function(){if(_0x163ed1['rules'][_0x12f44c]){delete _0x163ed1[_0x8282('0x4b')][_0x12f44c];}});_0x286b17=setTimeout(function(){logger[_0x8282('0x33')](_0x8282('0x4f'),_0x12f44c);endRouting(_0x12f44c,_0x25b756,_0x420097,_0x163ed1);clearTimeout(_0x286b17);_0x48ce1e[_0x8282('0x50')](!![]);_0x3c5445[_0x8282('0x51')]();},_0x180bf1);switch(_0x25b756[_0x8282('0x52')]){case'rrmemory':strategy['rrmemory'](_0x48ce1e,_0x25b756,_0x163ed1,_0x420097);break;default:strategy['beepall'](_0x48ce1e,_0x25b756,_0x163ed1,_0x420097);}}else{logger['error']('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x12f44c,_0x435d1f[_0x8282('0x34')]);_0x3c5445[_0x8282('0x46')]();}}}catch(_0x2b6195){logger['error'](_0x8282('0x44'),_0x12f44c,_0x2b6195[_0x8282('0x53')]);_0x3c5445['stop']();}};}; \ No newline at end of file +var _0x3de3=['rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','util','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','defaults','localhost','queue_id','account','from','joinAt','emit','queue','capitalize','InteractionId','format','%sQueuesWaitingInteractions','%s_queue_waiting_interaction:%s','save','pick','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','QueueId','upperFirst','MessageId','message','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','error','waiting','accepted','Interaction','interaction','then','update','update\x20queue\x20report','timeout','toLowerCase','length','[%s][QUEUE]\x20%s','join','find','qtimeout'];(function(_0x544099,_0x372b30){var _0x20ab09=function(_0x149613){while(--_0x149613){_0x544099['push'](_0x544099['shift']());}};_0x20ab09(++_0x372b30);}(_0x3de3,0x1ce));var _0x33de=function(_0x4ed91b,_0x269d43){_0x4ed91b=_0x4ed91b-0x0;var _0x39b55f=_0x3de3[_0x4ed91b];return _0x39b55f;};'use strict';var schema=require(_0x33de('0x0'));var _=require('lodash');var util=require(_0x33de('0x1'));var seqqueue=require(_0x33de('0x2'));var moment=require('moment');var Redis=require(_0x33de('0x3'));var config=require(_0x33de('0x4'));var logger=require(_0x33de('0x5'))(_0x33de('0x6'));var strategy=require('./strategy');config[_0x33de('0x7')]=_[_0x33de('0x8')](config['redis'],{'host':_0x33de('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x33de('0x7')]));var attributes=['id',_0x33de('0xa'),_0x33de('0xb'),'queue',_0x33de('0xc'),_0x33de('0xd')];function emit(_0x2e0419,_0x5e1be7,_0x2cbf35){io['to'](_0x2e0419)[_0x33de('0xe')](_0x5e1be7,_0x2cbf35);}function emitChannelQueueInteraction(_0x8b655d,_0x241211,_0x330047,_0x189634,_0x8dfa3b,_0x59db80,_0x1f02bd,_0x306efc){var _0x27d1d8=_['clone'](_0x330047);_0x27d1d8[_0x33de('0xa')]=_0x306efc;_0x27d1d8[_0x33de('0xf')]=_0x241211;_0x27d1d8['account']=_0x189634;_0x27d1d8['id']=_0x8dfa3b;if(_0x59db80){attributes['push'](_[_0x33de('0x10')](_0x8b655d)+_0x33de('0x11'));_0x1f02bd[util[_0x33de('0x12')](_0x33de('0x13'),_0x8b655d)][_0x8dfa3b]=_['pick'](_0x27d1d8,attributes);}else{delete _0x1f02bd[util[_0x33de('0x12')](_0x33de('0x13'),_0x8b655d)][_0x8dfa3b];}emit(util['format']('%s:queue:%s',_0x8b655d,_0x241211),util[_0x33de('0x12')](_0x33de('0x14'),_0x8b655d,_0x59db80?_0x33de('0x15'):'remove'),_[_0x33de('0x16')](_0x27d1d8,attributes));}var rpc={'openchannelQueueReport':require(_0x33de('0x17')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x33de('0x18')),'smsQueueReport':require(_0x33de('0x19')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require('../../rpc/whatsappQueueReport'),'chatInteraction':require(_0x33de('0x1a')),'faxInteraction':require('../../rpc/faxInteraction'),'mailInteraction':require(_0x33de('0x1b')),'openchannelInteraction':require(_0x33de('0x1c')),'smsInteraction':require(_0x33de('0x1d')),'whatsappInteraction':require(_0x33de('0x1e'))};var queue=schema({'name':{'type':_0x33de('0x1f'),'required':!![],'message':_0x33de('0x20')},'timeout':{'type':_0x33de('0x21'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x571086,_0x34e7ef,_0x5af3fa,_0x8acd8d){if(_0x571086&&_0x34e7ef&&_0x5af3fa){_0x34e7ef['waiting']+=0x1;var _0x28ed17={'uniqueid':_0x571086,'from':_0x5af3fa[_0x33de('0x22')]?_0x5af3fa['body'][_0x33de('0xc')]:'','joinAt':moment()['format'](_0x33de('0x23')),'ContactId':_0x5af3fa['contact']?_0x5af3fa[_0x33de('0x24')]['id']:null,'ListId':_0x5af3fa[_0x33de('0x25')]?_0x5af3fa[_0x33de('0x25')]['id']:null};_0x28ed17[_['upperFirst'](_0x5af3fa[_0x33de('0x26')])+_0x33de('0x27')]=_0x34e7ef['id']||null;_0x28ed17[_[_0x33de('0x28')](_0x5af3fa['channel'])+_0x33de('0x11')]=_0x5af3fa['interaction']?_0x5af3fa['interaction']['id']:null;_0x28ed17[_[_0x33de('0x28')](_0x5af3fa[_0x33de('0x26')])+_0x33de('0x29')]=_0x5af3fa[_0x33de('0x2a')]?_0x5af3fa[_0x33de('0x2a')]['id']:null;_0x28ed17[_[_0x33de('0x28')](_0x5af3fa[_0x33de('0x26')])+(_0x5af3fa[_0x33de('0x26')]!=='chat'?'AccountId':_0x33de('0x2b'))]=_0x5af3fa[_0x33de('0xb')]?_0x5af3fa[_0x33de('0xb')]['id']:null;logger[_0x33de('0x2c')](util[_0x33de('0x12')](_0x33de('0x2d'),_0x571086,_0x34e7ef[_0x33de('0x2e')]));emitChannelQueueInteraction(_0x5af3fa['channel'],_0x34e7ef[_0x33de('0x2e')],_0x28ed17,_0x5af3fa[_0x33de('0xb')][_0x33de('0x2e')],_0x5af3fa[_0x33de('0x2a')]['id'],!![],_0x8acd8d,_0x34e7ef['id']);if(rpc[_0x5af3fa['channel']+_0x33de('0x2f')]){return rpc[_0x5af3fa[_0x33de('0x26')]+'QueueReport']['create'](_0x28ed17)['catch'](function(_0x2dd46e){logger[_0x33de('0x30')]('create\x20queue\x20report',_0x2dd46e);});}}}function stopRouting(_0x1d0194,_0x4855e5,_0x532575,_0xe61fb9){if(_0x1d0194&&_0x4855e5){_0x4855e5[_0x33de('0x31')]-=0x1;var _0x42c57e={'leaveAt':moment()[_0x33de('0x12')](_0x33de('0x23')),'acceptAt':moment()[_0x33de('0x12')](_0x33de('0x23')),'reason':_0x33de('0x32')};logger['info'](util[_0x33de('0x12')]('[%s][STOP:QUEUE][NAME:%s]',_0x1d0194,_0x4855e5[_0x33de('0x2e')]));emitChannelQueueInteraction(_0x532575['channel'],_0x4855e5['name'],_0x532575[_0x33de('0x22')],_0x532575[_0x33de('0xb')][_0x33de('0x2e')],_0x532575[_0x33de('0x2a')]['id'],![],_0xe61fb9,_0x4855e5['id']);return rpc[_0x532575[_0x33de('0x26')]+_0x33de('0x33')]['update'](_0x532575[_0x33de('0x34')]['id'],{'queueId':_0x4855e5['id']})[_0x33de('0x35')](function(){if(rpc[_0x532575[_0x33de('0x26')]+_0x33de('0x2f')]){return rpc[_0x532575[_0x33de('0x26')]+_0x33de('0x2f')][_0x33de('0x36')](_0x1d0194,_0x42c57e)['catch'](function(_0x4bd6f2){logger[_0x33de('0x30')](_0x33de('0x37'),_0x4bd6f2);});}});}}function endRouting(_0x3e11eb,_0x46ddfe,_0x35064e,_0x1126b6){if(_0x3e11eb&&_0x46ddfe){_0x46ddfe['waiting']-=0x1;var _0x2f663f={'leaveAt':moment()[_0x33de('0x12')](_0x33de('0x23')),'exitAt':moment()[_0x33de('0x12')](_0x33de('0x23')),'reason':_0x33de('0x38')};logger['info'](util[_0x33de('0x12')]('[%s][END:QUEUE][NAME:%s]',_0x3e11eb,_0x46ddfe[_0x33de('0x2e')]));emitChannelQueueInteraction(_0x35064e[_0x33de('0x26')],_0x46ddfe['name'],_0x35064e[_0x33de('0x22')],_0x35064e[_0x33de('0xb')][_0x33de('0x2e')],_0x35064e[_0x33de('0x2a')]['id'],![],_0x1126b6);if(rpc[_0x35064e[_0x33de('0x26')]+_0x33de('0x2f')]){return rpc[_0x35064e[_0x33de('0x26')]+_0x33de('0x2f')][_0x33de('0x36')](_0x3e11eb,_0x2f663f)['catch'](function(_0x5101b9){logger[_0x33de('0x30')](_0x33de('0x37'),_0x5101b9);});}}}function handleFindQueue(_0x20d04f){return function(_0x376c55){return _0x376c55['name'][_0x33de('0x39')]()===_0x20d04f['toLowerCase']();};}exports['consequence']=function(_0x1f164c,_0x3caa1f,_0x384b12,_0x129e37){return function(_0x109894){try{var _0x29fe69={'name':_0x3caa1f[0x0],'timeout':_0x3caa1f[0x1]};var _0x105e10=queue['validate'](_0x29fe69,{'typecast':!![]});if(_0x105e10[_0x33de('0x3a')]){logger['error'](_0x33de('0x3b'),_0x1f164c,_['map'](_0x105e10,_0x33de('0x2a'))[_0x33de('0x3c')](',\x20'));_0x109894['stop']();}else{var _0x18db5e=_[_0x33de('0x3d')](_0x384b12[_0x129e37[_0x33de('0x26')]+'Queues'],handleFindQueue(_0x29fe69['name']));if(_0x18db5e){startRouting(_0x1f164c,_0x18db5e,_0x129e37,_0x384b12);var _0x24c440=(_0x18db5e[_0x33de('0x38')]||0xa)*0x3e8;var _0x4bf097=(_0x29fe69['timeout']||0x14)*0x3e8;var _0x44be7b;if(_0x24c440>_0x4bf097){_0x4bf097=_0x24c440;}var _0x5a161f=seqqueue['createQueue'](_0x24c440);_0x5a161f['id']=_0x1f164c;_0x5a161f['atimeout']=_0x24c440;_0x5a161f[_0x33de('0x3e')]=_0x4bf097;_0x5a161f[_0x33de('0x26')]=_0x129e37[_0x33de('0x26')];_0x384b12[_0x33de('0x3f')][_0x1f164c]['on']('end',function(){logger['info'](_0x33de('0x40'),_0x1f164c);stopRouting(_0x1f164c,_0x18db5e,_0x129e37,_0x384b12);clearTimeout(_0x44be7b);_0x44be7b=undefined;_0x5a161f[_0x33de('0x41')](!![]);if(_0x384b12['rules'][_0x1f164c]){delete _0x384b12[_0x33de('0x3f')][_0x1f164c];}_0x109894[_0x33de('0x42')]();});_0x384b12[_0x33de('0x3f')][_0x1f164c]['on'](_0x33de('0x43'),function(){if(_0x384b12[_0x33de('0x3f')][_0x1f164c]){delete _0x384b12['rules'][_0x1f164c];}});_0x44be7b=setTimeout(function(){logger[_0x33de('0x2c')](_0x33de('0x44'),_0x1f164c);endRouting(_0x1f164c,_0x18db5e,_0x129e37,_0x384b12);clearTimeout(_0x44be7b);_0x5a161f['close'](!![]);_0x109894[_0x33de('0x45')]();},_0x4bf097);switch(_0x18db5e[_0x33de('0x46')]){case _0x33de('0x47'):strategy[_0x33de('0x47')](_0x5a161f,_0x18db5e,_0x384b12,_0x129e37);break;default:strategy[_0x33de('0x48')](_0x5a161f,_0x18db5e,_0x384b12,_0x129e37);}}else{logger[_0x33de('0x30')](_0x33de('0x49'),_0x1f164c,_0x29fe69[_0x33de('0x2e')]);_0x109894[_0x33de('0x42')]();}}}catch(_0x1b4397){logger['error'](_0x33de('0x3b'),_0x1f164c,_0x1b4397[_0x33de('0x4a')]);_0x109894[_0x33de('0x42')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index a41072b..03572bd 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 _0x3937=['prototype','handleDrained','debug','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','agents','channel','busy','showNotification','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger','notificationId','squeue','agent','realtime','routing','push','handleRun','bind','timeout','handleTimeout'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x3937,0xbf));var _0x7393=function(_0x216d32,_0x57baa5){_0x216d32=_0x216d32-0x0;var _0x4a6700=_0x3937[_0x216d32];return _0x4a6700;};'use strict';var _=require(_0x7393('0x0'));var uuid=require('uuid');var util=require(_0x7393('0x1'));var logger=require(_0x7393('0x2'))('routing');var Agent=function(_0x45cd02,_0x503841,_0x224468,_0x4c9c71){this[_0x7393('0x3')]=uuid['v4']();this[_0x7393('0x4')]=_0x45cd02;this[_0x7393('0x5')]=_0x503841;this[_0x7393('0x6')]=_0x224468;this[_0x7393('0x7')]=_0x4c9c71;this[_0x7393('0x4')][_0x7393('0x8')](this[_0x7393('0x9')][_0x7393('0xa')](this),this['handleTimeout']['bind'](this));this[_0x7393('0x4')]['on'](_0x7393('0xb'),this[_0x7393('0xc')]['bind'](this));this[_0x7393('0x4')]['on']('drained',this['handleDrained']['bind'](this));};Agent['prototype'][_0x7393('0x8')]=function(){this[_0x7393('0x4')][_0x7393('0x8')](this['handleRun'][_0x7393('0xa')](this),this[_0x7393('0xc')][_0x7393('0xa')](this));};Agent[_0x7393('0xd')][_0x7393('0xe')]=function(){this[_0x7393('0xc')](!![]);};Agent[_0x7393('0xd')][_0x7393('0x9')]=function(){logger[_0x7393('0xf')]('[%s][AGENT]\x20try\x20with\x20%s',this['squeue']['id'],this[_0x7393('0x5')]['id']);if(_['isNil'](this['realtime']['agents'][this[_0x7393('0x5')]['id']])){logger['debug'](_0x7393('0x10'),this[_0x7393('0x4')]['id'],this['agent']['id']);setTimeout(this[_0x7393('0x8')]['bind'](this),0x3e8);}else{if(this['routing'][_0x7393('0x11')]||util[_0x7393('0x12')](this[_0x7393('0x4')]['id'],this[_0x7393('0x6')][_0x7393('0x13')][this[_0x7393('0x5')]['id']],this[_0x7393('0x4')][_0x7393('0x14')],![])){this['realtime']['agents'][this[_0x7393('0x5')]['id']][_0x7393('0x15')]=!![];this[_0x7393('0x6')][_0x7393('0x13')][this[_0x7393('0x5')]['id']]['busyQueue']=undefined;util['saveWaitingNotification'](this['realtime'],this[_0x7393('0x7')],this['agent'],this['squeue'][_0x7393('0x14')]);util[_0x7393('0x16')](this['notificationId'],this[_0x7393('0x4')]['id'],this[_0x7393('0x6')][_0x7393('0x13')][this[_0x7393('0x5')]['id']],null,this[_0x7393('0x7')]);util[_0x7393('0x17')](this[_0x7393('0x4')]['id'],this[_0x7393('0x6')][_0x7393('0x13')][this[_0x7393('0x5')]['id']],_0x7393('0x18')+(this[_0x7393('0x7')][_0x7393('0x11')]?':FORCED':''));}else{logger[_0x7393('0xf')](_0x7393('0x19'),this[_0x7393('0x4')]['id'],this[_0x7393('0x5')]['id']);setTimeout(this[_0x7393('0x8')][_0x7393('0xa')](this),0x3e8);}}};Agent['prototype'][_0x7393('0xc')]=function(_0x4befa4){if(_[_0x7393('0x1a')](this['realtime'][_0x7393('0x13')][this[_0x7393('0x5')]['id']])){return logger[_0x7393('0xf')](_0x7393('0x10'),this[_0x7393('0x4')]['id'],this[_0x7393('0x5')]['id']);}else{logger[_0x7393('0xf')](_0x7393('0x1b'),this[_0x7393('0x4')]['id'],this[_0x7393('0x5')]['id']);util[_0x7393('0x1c')](this[_0x7393('0x3')],this['squeue']['id'],this['realtime'][_0x7393('0x13')][this['agent']['id']],null,this[_0x7393('0x7')]);this['realtime'][_0x7393('0x13')][this['agent']['id']][_0x7393('0x15')]=![];this[_0x7393('0x6')][_0x7393('0x13')][this[_0x7393('0x5')]['id']][_0x7393('0x1d')]=undefined;util[_0x7393('0x1e')](this[_0x7393('0x6')],this[_0x7393('0x7')],this[_0x7393('0x5')],this[_0x7393('0x4')]['channel']);util[_0x7393('0x17')](this['squeue']['id'],this[_0x7393('0x6')]['agents'][this[_0x7393('0x5')]['id']],_0x4befa4?_0x7393('0x1f'):_0x7393('0x20'));}if(!_0x4befa4){setTimeout(this[_0x7393('0x8')][_0x7393('0xa')](this),0x3e8);}};function agent(_0x487a9b,_0x14ee6e,_0x596f49,_0x434333){return new Agent(_0x487a9b,_0x14ee6e,_0x596f49,_0x434333);}module[_0x7393('0x21')]=agent; \ No newline at end of file +var _0x34e5=['saveWaitingNotification','channel','showNotification','writeLog','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification','TIMEOUT','uuid','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','bind','handleTimeout','handleDrained','prototype','handleRun','debug','[%s][AGENT]\x20try\x20with\x20%s','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','busy','busyQueue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x34e5,0x172));var _0x534e=function(_0x26095d,_0xda53ad){_0x26095d=_0x26095d-0x0;var _0x35e668=_0x34e5[_0x26095d];return _0x35e668;};'use strict';var _=require('lodash');var uuid=require(_0x534e('0x0'));var util=require('./util');var logger=require(_0x534e('0x1'))(_0x534e('0x2'));var Agent=function(_0x425ae8,_0x246650,_0x83eb2d,_0x50b790){this[_0x534e('0x3')]=uuid['v4']();this[_0x534e('0x4')]=_0x425ae8;this[_0x534e('0x5')]=_0x246650;this[_0x534e('0x6')]=_0x83eb2d;this[_0x534e('0x2')]=_0x50b790;this[_0x534e('0x4')][_0x534e('0x7')](this['handleRun'][_0x534e('0x8')](this),this[_0x534e('0x9')][_0x534e('0x8')](this));this['squeue']['on']('timeout',this[_0x534e('0x9')]['bind'](this));this[_0x534e('0x4')]['on']('drained',this[_0x534e('0xa')][_0x534e('0x8')](this));};Agent[_0x534e('0xb')]['push']=function(){this[_0x534e('0x4')][_0x534e('0x7')](this[_0x534e('0xc')][_0x534e('0x8')](this),this[_0x534e('0x9')]['bind'](this));};Agent[_0x534e('0xb')][_0x534e('0xa')]=function(){this[_0x534e('0x9')](!![]);};Agent[_0x534e('0xb')][_0x534e('0xc')]=function(){logger[_0x534e('0xd')](_0x534e('0xe'),this[_0x534e('0x4')]['id'],this[_0x534e('0x5')]['id']);if(_['isNil'](this[_0x534e('0x6')][_0x534e('0xf')][this['agent']['id']])){logger['debug'](_0x534e('0x10'),this[_0x534e('0x4')]['id'],this[_0x534e('0x5')]['id']);setTimeout(this[_0x534e('0x7')][_0x534e('0x8')](this),0x3e8);}else{if(this[_0x534e('0x2')][_0x534e('0x11')]||util['isAgentAvailable'](this[_0x534e('0x4')]['id'],this[_0x534e('0x6')][_0x534e('0xf')][this[_0x534e('0x5')]['id']],this[_0x534e('0x4')]['channel'],![])){this[_0x534e('0x6')][_0x534e('0xf')][this[_0x534e('0x5')]['id']][_0x534e('0x12')]=!![];this[_0x534e('0x6')][_0x534e('0xf')][this[_0x534e('0x5')]['id']][_0x534e('0x13')]=undefined;util[_0x534e('0x14')](this['realtime'],this[_0x534e('0x2')],this[_0x534e('0x5')],this[_0x534e('0x4')][_0x534e('0x15')]);util[_0x534e('0x16')](this[_0x534e('0x3')],this[_0x534e('0x4')]['id'],this[_0x534e('0x6')]['agents'][this[_0x534e('0x5')]['id']],null,this['routing']);util[_0x534e('0x17')](this[_0x534e('0x4')]['id'],this[_0x534e('0x6')][_0x534e('0xf')][this[_0x534e('0x5')]['id']],'RINGING'+(this[_0x534e('0x2')][_0x534e('0x11')]?':FORCED':''));}else{logger['debug'](_0x534e('0x18'),this['squeue']['id'],this[_0x534e('0x5')]['id']);setTimeout(this[_0x534e('0x7')][_0x534e('0x8')](this),0x3e8);}}};Agent[_0x534e('0xb')][_0x534e('0x9')]=function(_0x42119b){if(_[_0x534e('0x19')](this['realtime']['agents'][this[_0x534e('0x5')]['id']])){return logger[_0x534e('0xd')](_0x534e('0x10'),this[_0x534e('0x4')]['id'],this[_0x534e('0x5')]['id']);}else{logger[_0x534e('0xd')](_0x534e('0x1a'),this[_0x534e('0x4')]['id'],this[_0x534e('0x5')]['id']);util[_0x534e('0x1b')](this[_0x534e('0x3')],this[_0x534e('0x4')]['id'],this['realtime'][_0x534e('0xf')][this[_0x534e('0x5')]['id']],null,this['routing']);this[_0x534e('0x6')]['agents'][this[_0x534e('0x5')]['id']][_0x534e('0x12')]=![];this[_0x534e('0x6')][_0x534e('0xf')][this['agent']['id']][_0x534e('0x13')]=undefined;util[_0x534e('0x1c')](this['realtime'],this['routing'],this[_0x534e('0x5')],this[_0x534e('0x4')][_0x534e('0x15')]);util[_0x534e('0x17')](this['squeue']['id'],this[_0x534e('0x6')]['agents'][this[_0x534e('0x5')]['id']],_0x42119b?'STOP':_0x534e('0x1d'));}if(!_0x42119b){setTimeout(this[_0x534e('0x7')]['bind'](this),0x3e8);}};function agent(_0x2f5cd1,_0x5c34a7,_0x593fb0,_0x519b40){return new Agent(_0x2f5cd1,_0x5c34a7,_0x593fb0,_0x519b40);}module['exports']=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 66a65d3..3891e3c 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 _0xd319=['busyQueue','name','saveWaitingNotification','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','writeLog','TIMEOUT','removeWaitingNotification','exports','uuid','./util','notificationId','squeue','realtime','routing','push','handleRun','handleTimeout','timeout','bind','drained','handleDrained','prototype','isNil','queue','Agents','length','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','RINGING','busy'];(function(_0x290fa6,_0x16d017){var _0x47f1f3=function(_0x2b5eb8){while(--_0x2b5eb8){_0x290fa6['push'](_0x290fa6['shift']());}};_0x47f1f3(++_0x16d017);}(_0xd319,0xb9));var _0x9d31=function(_0x2f69d3,_0x14bf6f){_0x2f69d3=_0x2f69d3-0x0;var _0x17628a=_0xd319[_0x2f69d3];return _0x17628a;};'use strict';var _=require('lodash');var uuid=require(_0x9d31('0x0'));var util=require(_0x9d31('0x1'));var logger=require('../../../../../config/logger')('routing');var Beepall=function(_0x38fb44,_0x30e4e8,_0x3a2ad0,_0x483b8d){this[_0x9d31('0x2')]=uuid['v4']();this[_0x9d31('0x3')]=_0x38fb44;this['queue']=_0x30e4e8;this[_0x9d31('0x4')]=_0x3a2ad0;this[_0x9d31('0x5')]=_0x483b8d;this[_0x9d31('0x3')][_0x9d31('0x6')](this[_0x9d31('0x7')]['bind'](this),this[_0x9d31('0x8')]['bind'](this));this[_0x9d31('0x3')]['on'](_0x9d31('0x9'),this[_0x9d31('0x8')][_0x9d31('0xa')](this));this[_0x9d31('0x3')]['on'](_0x9d31('0xb'),this[_0x9d31('0xc')][_0x9d31('0xa')](this));};Beepall[_0x9d31('0xd')][_0x9d31('0x6')]=function(){this[_0x9d31('0x3')][_0x9d31('0x6')](this['handleRun'][_0x9d31('0xa')](this),this[_0x9d31('0x8')]['bind'](this));};Beepall[_0x9d31('0xd')]['handleDrained']=function(){this['handleTimeout'](!![]);};Beepall[_0x9d31('0xd')][_0x9d31('0x7')]=function(){var _0x435541=!![];if(!_[_0x9d31('0xe')](this['queue'])&&!_[_0x9d31('0xe')](this[_0x9d31('0xf')][_0x9d31('0x10')])&&this[_0x9d31('0xf')]['Agents'][_0x9d31('0x11')]>0x0){for(var _0x9228d8=0x0,_0x56cb2a;_0x9228d80x0){for(var _0x3bc866=0x0,_0x88aa3e;_0x3bc8660x0&&_0x5c93e6[_0x352b9f+'CurrentCapacity']>=_0x5c93e6[_0x352b9f+_0xe22b('0x21')]){writeLog(_0x1be946,_0x5c93e6,_0x352b9f[_0xe22b('0x23')]()+_0xe22b('0x24'));return![];}}return!![];};exports[_0xe22b('0x25')]=function(_0x20b0d2,_0x141dfc,_0xb85344,_0xed3182,_0x59e053){return sendNotification(!![],_0x20b0d2,_0x141dfc,_0xb85344,_0xed3182,_0x59e053);};exports[_0xe22b('0x26')]=function(_0x4293a1,_0x5f2a2e,_0x17dddf,_0x2b95a3,_0x40d0ac){return sendNotification(![],_0x4293a1,_0x5f2a2e,_0x17dddf,_0x2b95a3,_0x40d0ac);};exports['checkWaitingNotifications']=function(_0x17f868,_0x4fc53e,_0xed1a9b){var _0x1772e0=_0x4fc53e[_0xe22b('0x27')]['UserId'];if(!_0x1772e0&&_0xed1a9b){_0x1772e0=_0xed1a9b['id'];}var _0x4651c4=_['some'](_0x17f868[_0x4fc53e['channel']+_0xe22b('0x28')],function(_0x111c6e){var _0x3be907=_['capitalize'](_0x4fc53e[_0xe22b('0x29')])+_0xe22b('0x2a');return _0x111c6e[_0x3be907]===_0x4fc53e[_0xe22b('0x27')]['id'];});if(!_0x4651c4&&_0x1772e0&&_0x17f868[_0xe22b('0x2b')][_0x1772e0]){_0x4651c4=_['some'](_0x17f868[_0xe22b('0x2b')][_0x1772e0][_0x4fc53e[_0xe22b('0x29')]+_0xe22b('0x2c')],function(_0x3100aa){return _0x3100aa['id']===_0x4fc53e['interaction']['id'];});}return _0x4651c4;};exports[_0xe22b('0x2d')]=function(_0x478f66,_0x168b1b,_0x317564,_0x5be5f2){if(_0x317564&&_0x317564['id']&&_0x478f66[_0xe22b('0x2b')]&&_0x478f66[_0xe22b('0x2b')][_0x317564['id']]){_0x478f66[_0xe22b('0x2b')][_0x317564['id']][_0x5be5f2+'WaitingInteractions'][_0x168b1b[_0xe22b('0x14')]['id']]={'id':_0x168b1b[_0xe22b('0x27')]['id']};}};exports[_0xe22b('0x2e')]=function(_0x21ea9c,_0x13d478,_0x2bb504,_0x9e7fd2){if(_0x2bb504&&_0x2bb504['id']&&_0x21ea9c[_0xe22b('0x2b')]&&_0x21ea9c['agents'][_0x2bb504['id']]){delete _0x21ea9c['agents'][_0x2bb504['id']][_0x9e7fd2+_0xe22b('0x2c')][_0x13d478[_0xe22b('0x14')]['id']];}};exports['writeLog']=writeLog; \ No newline at end of file +var _0x8107=['showNotification','hideNotification','checkWaitingNotifications','UserId','some','channel','QueuesWaitingInteractions','capitalize','InteractionId','interaction','agents','WaitingInteractions','saveWaitingNotification','removeWaitingNotification','writeLog','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','routing','defaults','redis','localhost','split','name','account','notificationSound','notificationShake','body','queue','msg','I\x20can\x27t\x20render\x20your\x20template','error','format','[%s][QUEUE]\x20%s','message','user:%s','save','remove','isAgentAvailable','busy','online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY'];(function(_0x3e97b5,_0x144e0d){var _0x1c035c=function(_0xc1f47d){while(--_0xc1f47d){_0x3e97b5['push'](_0x3e97b5['shift']());}};_0x1c035c(++_0x144e0d);}(_0x8107,0x109));var _0x7810=function(_0x37b1d8,_0x614312){_0x37b1d8=_0x37b1d8-0x0;var _0x3739e7=_0x8107[_0x37b1d8];return _0x3739e7;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x7810('0x0'));var Redis=require(_0x7810('0x1'));var config=require(_0x7810('0x2'));var logger=require(_0x7810('0x3'))(_0x7810('0x4'));config['redis']=_[_0x7810('0x5')](config[_0x7810('0x6')],{'host':_0x7810('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function sendNotification(_0x12e2ec,_0x5e25f2,_0x5b22da,_0x19f6dd,_0x3ee53f,_0x21024f){var _0x56cca9=_0x21024f||{};var _0x7ef0bf=_0x5b22da[_0x7810('0x8')]('.');var _0xac1e09={'uniqueid':_0x5e25f2,'channel':_0x7ef0bf[0x0],'id':_0x7ef0bf[0x1],'title':_0x7ef0bf[0x0]+'\x20interaction','interactionId':_0x7ef0bf[0x2],'queue':_0x3ee53f?_0x3ee53f[_0x7810('0x9')]:null,'sound':_0x56cca9[_0x7810('0xa')][_0x7810('0xb')],'shake':_0x56cca9[_0x7810('0xa')][_0x7810('0xc')]};try{if(!_0x56cca9[_0x7810('0xd')]){_0x56cca9['body']={};}if(_0x3ee53f){_0x56cca9[_0x7810('0xd')][_0x7810('0xe')]=_0x3ee53f;}else if(_0x56cca9[_0x7810('0xd')][_0x7810('0xe')]){delete _0x56cca9[_0x7810('0xd')][_0x7810('0xe')];}_0xac1e09[_0x7810('0xf')]=utils['getMustacheRender'](_0x56cca9[_0x7810('0xa')]['notificationTemplate'],_0x56cca9);}catch(_0x1bf6e0){_0xac1e09['msg']=_0x7810('0x10');logger[_0x7810('0x11')](util[_0x7810('0x12')](_0x7810('0x13'),_0x5e25f2,_0x1bf6e0[_0x7810('0x14')]));}io['to'](util[_0x7810('0x12')](_0x7810('0x15'),_0x19f6dd[_0x7810('0x9')]))['emit'](util[_0x7810('0x12')]('notification:%s',_0x12e2ec?_0x7810('0x16'):_0x7810('0x17')),_0xac1e09);}function writeLog(_0x1fbeed,_0x9d8b85,_0xc64100){return logger['debug'](util[_0x7810('0x12')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x1fbeed,_0x9d8b85[_0x7810('0x9')],_0xc64100));}exports[_0x7810('0x18')]=function(_0x158dd8,_0x4290bf,_0x3e5c47,_0x1ac58f){if(_0x4290bf[_0x7810('0x19')]){writeLog(_0x158dd8,_0x4290bf,'BUSY');return![];}if(!_0x4290bf[_0x7810('0x1a')]){writeLog(_0x158dd8,_0x4290bf,_0x7810('0x1b'));return![];}if(_0x4290bf[_0x3e5c47+_0x7810('0x1c')]){writeLog(_0x158dd8,_0x4290bf,_0x7810('0x1d'));return![];}if(_0x1ac58f&&_0x4290bf[_0x7810('0x1e')](_0x3e5c47+_0x7810('0x1f'))&&_0x4290bf['hasOwnProperty'](_0x3e5c47+_0x7810('0x20'))){if(_0x4290bf[_0x3e5c47+'Capacity']>0x0&&_0x4290bf[_0x3e5c47+_0x7810('0x20')]>=_0x4290bf[_0x3e5c47+'Capacity']){writeLog(_0x158dd8,_0x4290bf,_0x3e5c47[_0x7810('0x21')]()+_0x7810('0x22'));return![];}}return!![];};exports[_0x7810('0x23')]=function(_0x295ed5,_0x475538,_0x110db2,_0x106d8c,_0x560684){return sendNotification(!![],_0x295ed5,_0x475538,_0x110db2,_0x106d8c,_0x560684);};exports[_0x7810('0x24')]=function(_0x9b37c6,_0x598fb3,_0x1eef42,_0xe5c5d9,_0x180c10){return sendNotification(![],_0x9b37c6,_0x598fb3,_0x1eef42,_0xe5c5d9,_0x180c10);};exports[_0x7810('0x25')]=function(_0xd00cf6,_0x26425a,_0x35edd5){var _0x4a4dab=_0x26425a['interaction'][_0x7810('0x26')];if(!_0x4a4dab&&_0x35edd5){_0x4a4dab=_0x35edd5['id'];}var _0x3893a9=_[_0x7810('0x27')](_0xd00cf6[_0x26425a[_0x7810('0x28')]+_0x7810('0x29')],function(_0x171496){var _0x243f58=_[_0x7810('0x2a')](_0x26425a[_0x7810('0x28')])+_0x7810('0x2b');return _0x171496[_0x243f58]===_0x26425a[_0x7810('0x2c')]['id'];});if(!_0x3893a9&&_0x4a4dab&&_0xd00cf6['agents'][_0x4a4dab]){_0x3893a9=_[_0x7810('0x27')](_0xd00cf6[_0x7810('0x2d')][_0x4a4dab][_0x26425a['channel']+_0x7810('0x2e')],function(_0x164075){return _0x164075['id']===_0x26425a['interaction']['id'];});}return _0x3893a9;};exports[_0x7810('0x2f')]=function(_0x22f282,_0x1b3eff,_0x4ca18e,_0x440e17){if(_0x4ca18e&&_0x4ca18e['id']&&_0x22f282[_0x7810('0x2d')]&&_0x22f282[_0x7810('0x2d')][_0x4ca18e['id']]){_0x22f282[_0x7810('0x2d')][_0x4ca18e['id']][_0x440e17+_0x7810('0x2e')][_0x1b3eff[_0x7810('0x14')]['id']]={'id':_0x1b3eff['interaction']['id']};}};exports[_0x7810('0x30')]=function(_0x17919a,_0x5722ac,_0x3450fe,_0x1fcb2e){if(_0x3450fe&&_0x3450fe['id']&&_0x17919a[_0x7810('0x2d')]&&_0x17919a['agents'][_0x3450fe['id']]){delete _0x17919a[_0x7810('0x2d')][_0x3450fe['id']][_0x1fcb2e+_0x7810('0x2e')][_0x5722ac[_0x7810('0x14')]['id']];}};exports[_0x7810('0x31')]=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 f102ce4..9460066 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 _0xb066=['next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','[%s][SYSTEM]\x20%s','isObject','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','shelljs','lodash','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','error','message','join','info'];(function(_0x16b2d1,_0x4126c1){var _0x4f2026=function(_0xc752ff){while(--_0xc752ff){_0x16b2d1['push'](_0x16b2d1['shift']());}};_0x4f2026(++_0x4126c1);}(_0xb066,0x1c9));var _0x6b06=function(_0x5df9c2,_0x2438b9){_0x5df9c2=_0x5df9c2-0x0;var _0x428d29=_0xb066[_0x5df9c2];return _0x428d29;};'use strict';var schema=require('validate');var sh=require(_0x6b06('0x0'));var _=require(_0x6b06('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x6b06('0x2'));var system=schema({'command':{'type':_0x6b06('0x3'),'required':!![],'message':_0x6b06('0x4')}});exports[_0x6b06('0x5')]=function(_0x7a9ff8,_0x2a09ab){return function(_0x3e2b79){try{var _0xa85096={'command':_0x2a09ab[0x0]};var _0x1e303d=system[_0x6b06('0x6')](_0xa85096,{'typecast':!![]});if(_0x1e303d['length']){logger[_0x6b06('0x7')]('[%s][SYSTEM]\x20%s',_0x7a9ff8,_['map'](_0x1e303d,_0x6b06('0x8'))[_0x6b06('0x9')](',\x20'));logger[_0x6b06('0xa')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x7a9ff8);_0x3e2b79[_0x6b06('0xb')]();}else{var _0x3cfd65=this;var _0x5f2712=utils[_0x6b06('0xc')](_0x2a09ab[0x0],this);logger[_0x6b06('0xa')](_0x6b06('0xd'),_0x7a9ff8,_0x5f2712);sh[_0x6b06('0xe')](_[_0x6b06('0xf')](_0x5f2712),function(_0x415df5,_0x5af4b3){logger[_0x6b06('0xa')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x7a9ff8,_0x415df5);if(_0x415df5==0x0){var _0x37df11=_0x5af4b3[_0x6b06('0x10')](/(\r\n|\n|\r)/gm,'');if(_[_0x6b06('0x11')](_0x2a09ab[0x1])||_[_0x6b06('0x12')](_0x2a09ab[0x1])){logger[_0x6b06('0xa')](_0x6b06('0x13'),_0x7a9ff8);_0x3cfd65[_0x6b06('0x14')][_0x2a09ab[0x1]]=_0x37df11;}else{logger['info'](_0x6b06('0x15'),_0x7a9ff8,_0x2a09ab[0x1],_0x37df11);_0x3cfd65[_0x6b06('0x14')][_0x2a09ab[0x1]]=_0x37df11;}}_0x3e2b79['next']();});}}catch(_0x4ccd87){logger[_0x6b06('0x7')](_0x6b06('0x16'),_0x7a9ff8,_[_0x6b06('0x17')](_0x4ccd87)?JSON[_0x6b06('0x18')](_0x4ccd87):_0x4ccd87);logger[_0x6b06('0xa')](_0x6b06('0x19'),_0x7a9ff8);_0x3e2b79['next']();}};}; \ No newline at end of file +var _0xc9d4=['[%s][SYSTEM]\x20%s','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length'];(function(_0x16a84a,_0x135c8c){var _0x15df75=function(_0x2c6ab0){while(--_0x2c6ab0){_0x16a84a['push'](_0x16a84a['shift']());}};_0x15df75(++_0x135c8c);}(_0xc9d4,0xf0));var _0x4c9d=function(_0x32958b,_0x242da1){_0x32958b=_0x32958b-0x0;var _0xdfa3a3=_0xc9d4[_0x32958b];return _0xdfa3a3;};'use strict';var schema=require(_0x4c9d('0x0'));var sh=require(_0x4c9d('0x1'));var _=require(_0x4c9d('0x2'));var utils=require(_0x4c9d('0x3'));var logger=require(_0x4c9d('0x4'))(_0x4c9d('0x5'));var system=schema({'command':{'type':_0x4c9d('0x6'),'required':!![],'message':_0x4c9d('0x7')}});exports[_0x4c9d('0x8')]=function(_0x231e0e,_0x26ccfb){return function(_0x11c352){try{var _0x3c392a={'command':_0x26ccfb[0x0]};var _0x21d81d=system[_0x4c9d('0x0')](_0x3c392a,{'typecast':!![]});if(_0x21d81d[_0x4c9d('0x9')]){logger['error'](_0x4c9d('0xa'),_0x231e0e,_['map'](_0x21d81d,_0x4c9d('0xb'))[_0x4c9d('0xc')](',\x20'));logger[_0x4c9d('0xd')](_0x4c9d('0xe'),_0x231e0e);_0x11c352[_0x4c9d('0xf')]();}else{var _0x2cf51e=this;var _0x40e9ae=utils[_0x4c9d('0x10')](_0x26ccfb[0x0],this);logger[_0x4c9d('0xd')](_0x4c9d('0x11'),_0x231e0e,_0x40e9ae);sh['exec'](_['trim'](_0x40e9ae),function(_0x449d01,_0x3fea59){logger[_0x4c9d('0xd')](_0x4c9d('0x12'),_0x231e0e,_0x449d01);if(_0x449d01==0x0){var _0x2533d4=_0x3fea59['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x4c9d('0x13')](_0x26ccfb[0x1])||_[_0x4c9d('0x14')](_0x26ccfb[0x1])){logger['info']('[%s][SYSTEM]\x20no\x20variable',_0x231e0e);_0x2cf51e[_0x4c9d('0x15')][_0x26ccfb[0x1]]=_0x2533d4;}else{logger[_0x4c9d('0xd')](_0x4c9d('0x16'),_0x231e0e,_0x26ccfb[0x1],_0x2533d4);_0x2cf51e[_0x4c9d('0x15')][_0x26ccfb[0x1]]=_0x2533d4;}}_0x11c352[_0x4c9d('0xf')]();});}}catch(_0x3d2980){logger['error'](_0x4c9d('0xa'),_0x231e0e,_[_0x4c9d('0x17')](_0x3d2980)?JSON[_0x4c9d('0x18')](_0x3d2980):_0x3d2980);logger[_0x4c9d('0xd')](_0x4c9d('0xe'),_0x231e0e);_0x11c352[_0x4c9d('0xf')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index bf0ac08..8442b1d 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 _0x1862=['isObject','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','consequence','length','error','[%s][TAG]\x20%s','map','message','info','next','channel','Interaction','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x1862,0x196));var _0x2186=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1862[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0x2186('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0x2186('0x1')),'openchannelInteraction':require(_0x2186('0x2')),'smsInteraction':require(_0x2186('0x3')),'mailInteraction':require(_0x2186('0x4')),'faxInteraction':require(_0x2186('0x5')),'whatsappInteraction':require(_0x2186('0x6'))};var logger=require(_0x2186('0x7'))(_0x2186('0x8'));var tag=schema({'tag':{'type':_0x2186('0x9'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x2186('0xa')]=function(_0x19bb97,_0xe00e1e,_0x272158,_0x5daa8e){return function(_0x3bb863){try{var _0x51bfb4={'tag':_0xe00e1e[0x0]};var _0x40920e=tag[_0x2186('0x0')](_0x51bfb4,{'typecast':!![]});if(_0x40920e[_0x2186('0xb')]){logger[_0x2186('0xc')](_0x2186('0xd'),_0x19bb97,_[_0x2186('0xe')](_0x40920e,_0x2186('0xf'))['join'](',\x20'));logger[_0x2186('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x19bb97);_0x3bb863[_0x2186('0x11')]();}else{var _0x15ba99={'ids':[_0xe00e1e[0x0]]};if(rpc[_0x5daa8e[_0x2186('0x12')]+_0x2186('0x13')]){rpc[_0x5daa8e[_0x2186('0x12')]+_0x2186('0x13')]['addTags'](_0x5daa8e[_0x2186('0x14')]['id'],_0x15ba99)[_0x2186('0x15')](function(_0x4e4ff4){logger['info'](_0x2186('0x16'),_0x19bb97,_0xe00e1e[0x1],_0x5daa8e[_0x2186('0x12')],_0x5daa8e[_0x2186('0x14')]['id']);})[_0x2186('0x17')](function(_0xc47ecc){logger[_0x2186('0xc')](_0x2186('0xd'),_0x19bb97,JSON[_0x2186('0x18')](_0xc47ecc));logger['info'](_0x2186('0x19'),_0x19bb97);})['finally'](function(){_0x3bb863['next']();});}}}catch(_0x475669){logger[_0x2186('0xc')](_0x2186('0xd'),_0x19bb97,_[_0x2186('0x1a')](_0x475669)?JSON[_0x2186('0x18')](_0x475669):_0x475669);logger[_0x2186('0x10')](_0x2186('0x19'),_0x19bb97);_0x3bb863[_0x2186('0x11')]();}};}; \ No newline at end of file +var _0xce2e=['channel','Interaction','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../../../config/logger','length','error','[%s][TAG]\x20%s','map','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next'];(function(_0x2c4214,_0x4a6057){var _0x175b15=function(_0x505641){while(--_0x505641){_0x2c4214['push'](_0x2c4214['shift']());}};_0x175b15(++_0x4a6057);}(_0xce2e,0x129));var _0xece2=function(_0x157ac7,_0x332e33){_0x157ac7=_0x157ac7-0x0;var _0x253f41=_0xce2e[_0x157ac7];return _0x253f41;};'use strict';var schema=require(_0xece2('0x0'));var _=require(_0xece2('0x1'));var rpc={'chatInteraction':require(_0xece2('0x2')),'openchannelInteraction':require(_0xece2('0x3')),'smsInteraction':require(_0xece2('0x4')),'mailInteraction':require(_0xece2('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0xece2('0x6'))('routing');var tag=schema({'tag':{'type':'number','required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x3488c5,_0x1eb6e4,_0x3a0e1c,_0x4a3ba2){return function(_0x23dc75){try{var _0x44009d={'tag':_0x1eb6e4[0x0]};var _0x509ae2=tag[_0xece2('0x0')](_0x44009d,{'typecast':!![]});if(_0x509ae2[_0xece2('0x7')]){logger[_0xece2('0x8')](_0xece2('0x9'),_0x3488c5,_[_0xece2('0xa')](_0x509ae2,_0xece2('0xb'))['join'](',\x20'));logger[_0xece2('0xc')](_0xece2('0xd'),_0x3488c5);_0x23dc75[_0xece2('0xe')]();}else{var _0x54bdb8={'ids':[_0x1eb6e4[0x0]]};if(rpc[_0x4a3ba2['channel']+'Interaction']){rpc[_0x4a3ba2[_0xece2('0xf')]+_0xece2('0x10')]['addTags'](_0x4a3ba2[_0xece2('0x11')]['id'],_0x54bdb8)[_0xece2('0x12')](function(_0x25dcc5){logger['info'](_0xece2('0x13'),_0x3488c5,_0x1eb6e4[0x1],_0x4a3ba2[_0xece2('0xf')],_0x4a3ba2[_0xece2('0x11')]['id']);})[_0xece2('0x14')](function(_0x1a324c){logger[_0xece2('0x8')]('[%s][TAG]\x20%s',_0x3488c5,JSON[_0xece2('0x15')](_0x1a324c));logger[_0xece2('0xc')](_0xece2('0xd'),_0x3488c5);})[_0xece2('0x16')](function(){_0x23dc75[_0xece2('0xe')]();});}}}catch(_0x36ea79){logger['error'](_0xece2('0x9'),_0x3488c5,_[_0xece2('0x17')](_0x36ea79)?JSON[_0xece2('0x15')](_0x36ea79):_0x36ea79);logger[_0xece2('0xc')](_0xece2('0xd'),_0x3488c5);_0x23dc75['next']();}};}; \ 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 b226e7c..83b0abf 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 _0x13cc=['params','stringify','POST','application/json-rpc','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','stop','catch','error','[%s][TVOX]\x20%s','isObject','info','next','request-promise','../../../../config/logger','lodash','consequence','replace','push','urlOnAnswer','?params=','title','jsonrpc','method'];(function(_0x6ada2c,_0x1d7e69){var _0x28ec9a=function(_0x30013b){while(--_0x30013b){_0x6ada2c['push'](_0x6ada2c['shift']());}};_0x28ec9a(++_0x1d7e69);}(_0x13cc,0x1c6));var _0xc13c=function(_0x388f3e,_0x453d03){_0x388f3e=_0x388f3e-0x0;var _0x57745d=_0x13cc[_0x388f3e];return _0x57745d;};'use strict';var rp=require(_0xc13c('0x0'));var logger=require(_0xc13c('0x1'))('routing');var _=require(_0xc13c('0x2'));var arr=[];exports[_0xc13c('0x3')]=function(_0x22f9f9,_0x2998b5){return function(_0xe0b5a5){var _0x28ea70=_0x2998b5[0xa];var _0x1bc57f=_0x2998b5[0xb];var _0xecfbfd=_0x2998b5[0xc];var _0x102968=_0x2998b5[0xd];var _0xa61148=_0x2998b5[0xe];var _0x34574c=_0x2998b5[0xf][_0xc13c('0x4')](/\n/g,'\x20-\x20');var _0x504020=_0x2998b5[0x10]['replace'](/\n/g,'\x20');if(!arr['includes'](_0x1bc57f)){arr[_0xc13c('0x5')](_0x1bc57f);var _0x294669=_0x2998b5[0x3];var _0x522406=_0x2998b5[0x4];var _0xadeee3=_0x2998b5[0x1];var _0x7c6566=_0x2998b5[0x0];var _0x5ee212={};_0x5ee212[_0xc13c('0x6')]=_0x2998b5[0x8]+_0xc13c('0x7')+_0xecfbfd+'|'+_0x28ea70+'|'+_0x102968+'|'+_0x1bc57f+'|'+_0xa61148;_0x5ee212['urlOnRing']=_0x2998b5[0x7]+'?params='+_0xecfbfd+'|'+_0x28ea70+'|'+_0x102968+'|'+_0x1bc57f+'|'+_0xa61148+'|'+_0x34574c+'|'+_0x504020;_0x5ee212[_0xc13c('0x8')]=_0x2998b5[0x9];var _0x2204bb={};_0x2204bb[_0xc13c('0x9')]='2.0';_0x2204bb[_0xc13c('0xa')]='login';var _0x316ec9=[];_0x316ec9['push'](_0x2998b5[0x2]);_0x316ec9[_0xc13c('0x5')](_0x2998b5[0x5]);_0x316ec9['push'](_0x2998b5[0x6]);_0x2204bb[_0xc13c('0xb')]=_0x316ec9;_0x2204bb['id']=0x1;var _0x162076=JSON[_0xc13c('0xc')](_0x2204bb);var _0x2a3a16={'encoding':'utf8','method':_0xc13c('0xd'),'timeout':0x2710,'url':_0x294669,'headers':{'Content-Type':_0xc13c('0xe')},'body':_0x162076};return rp(_0x2a3a16)[_0xc13c('0xf')](function(_0x16c562){const _0x1d9ca8=JSON[_0xc13c('0x10')](_0x16c562);if(!_0x1d9ca8[_0xc13c('0x11')][_0xc13c('0x12')]){throw new Error(_0xc13c('0x13'));}var _0x342d50=_0x1bc57f;var _0x4043d1=_0xc13c('0x14')+_0xadeee3+_0xc13c('0x15')+_0x7c6566+_0xc13c('0x16')+_0x342d50+_0xc13c('0x17')+JSON[_0xc13c('0xc')](_0x5ee212);var _0x7be87b=_0x522406+'?'+_0x4043d1;return rp(_0x7be87b);})[_0xc13c('0xf')](function(_0x1cd8b0){logger['info']('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x22f9f9,_0x1cd8b0);_0xe0b5a5[_0xc13c('0x18')]();})[_0xc13c('0x19')](function(_0x530dad){logger[_0xc13c('0x1a')](_0xc13c('0x1b'),_0x22f9f9,_[_0xc13c('0x1c')](_0x530dad)?JSON['stringify'](_0x530dad):_0x530dad);_0xe0b5a5[_0xc13c('0x18')]();});}else{logger[_0xc13c('0x1d')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x22f9f9);_0xe0b5a5[_0xc13c('0x1e')]();}};}; \ No newline at end of file +var _0xe10a=['POST','application/json-rpc','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','stop','catch','error','[%s][TVOX]\x20%s','isObject','stringify','next','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','includes','push','?params=','urlOnRing','2.0','method','login','params'];(function(_0x3625dc,_0x58ccd2){var _0x4c29dc=function(_0x3d6568){while(--_0x3d6568){_0x3625dc['push'](_0x3625dc['shift']());}};_0x4c29dc(++_0x58ccd2);}(_0xe10a,0xd2));var _0xae10=function(_0x3be595,_0x264454){_0x3be595=_0x3be595-0x0;var _0x414585=_0xe10a[_0x3be595];return _0x414585;};'use strict';var rp=require('request-promise');var logger=require(_0xae10('0x0'))(_0xae10('0x1'));var _=require(_0xae10('0x2'));var arr=[];exports[_0xae10('0x3')]=function(_0x51539a,_0x2793f1){return function(_0x1c03a9){var _0x379e3f=_0x2793f1[0xa];var _0x4f5088=_0x2793f1[0xb];var _0x25d470=_0x2793f1[0xc];var _0x156f06=_0x2793f1[0xd];var _0x58a41e=_0x2793f1[0xe];var _0x5093f8=_0x2793f1[0xf][_0xae10('0x4')](/\n/g,_0xae10('0x5'));var _0x22eb85=_0x2793f1[0x10]['replace'](/\n/g,'\x20');if(!arr[_0xae10('0x6')](_0x4f5088)){arr[_0xae10('0x7')](_0x4f5088);var _0x2150fa=_0x2793f1[0x3];var _0x3d202a=_0x2793f1[0x4];var _0x1721f6=_0x2793f1[0x1];var _0x1fed26=_0x2793f1[0x0];var _0x3627c3={};_0x3627c3['urlOnAnswer']=_0x2793f1[0x8]+_0xae10('0x8')+_0x25d470+'|'+_0x379e3f+'|'+_0x156f06+'|'+_0x4f5088+'|'+_0x58a41e;_0x3627c3[_0xae10('0x9')]=_0x2793f1[0x7]+_0xae10('0x8')+_0x25d470+'|'+_0x379e3f+'|'+_0x156f06+'|'+_0x4f5088+'|'+_0x58a41e+'|'+_0x5093f8+'|'+_0x22eb85;_0x3627c3['title']=_0x2793f1[0x9];var _0x44a9b3={};_0x44a9b3['jsonrpc']=_0xae10('0xa');_0x44a9b3[_0xae10('0xb')]=_0xae10('0xc');var _0x6668d3=[];_0x6668d3[_0xae10('0x7')](_0x2793f1[0x2]);_0x6668d3[_0xae10('0x7')](_0x2793f1[0x5]);_0x6668d3[_0xae10('0x7')](_0x2793f1[0x6]);_0x44a9b3[_0xae10('0xd')]=_0x6668d3;_0x44a9b3['id']=0x1;var _0x24d3ce=JSON['stringify'](_0x44a9b3);var _0x234566={'encoding':'utf8','method':_0xae10('0xe'),'timeout':0x2710,'url':_0x2150fa,'headers':{'Content-Type':_0xae10('0xf')},'body':_0x24d3ce};return rp(_0x234566)[_0xae10('0x10')](function(_0xc8efc3){const _0x1a6557=JSON[_0xae10('0x11')](_0xc8efc3);if(!_0x1a6557[_0xae10('0x12')][_0xae10('0x13')]){throw new Error(_0xae10('0x14'));}var _0x41f4e7=_0x4f5088;var _0xe96fe2=_0xae10('0x15')+_0x1721f6+_0xae10('0x16')+_0x1fed26+_0xae10('0x17')+_0x41f4e7+_0xae10('0x18')+JSON['stringify'](_0x3627c3);var _0x216c68=_0x3d202a+'?'+_0xe96fe2;return rp(_0x216c68);})[_0xae10('0x10')](function(_0x5de0f1){logger['info']('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x51539a,_0x5de0f1);_0x1c03a9[_0xae10('0x19')]();})[_0xae10('0x1a')](function(_0x4f6122){logger[_0xae10('0x1b')](_0xae10('0x1c'),_0x51539a,_[_0xae10('0x1d')](_0x4f6122)?JSON[_0xae10('0x1e')](_0x4f6122):_0x4f6122);_0x1c03a9['stop']();});}else{logger['info']('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x51539a);_0x1c03a9[_0xae10('0x1f')]();}};}; \ 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 539656c..9bf8d98 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 _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x2ebdb3,_0x682c5b){var _0x471eec=function(_0xaad025){while(--_0xaad025){_0x2ebdb3['push'](_0x2ebdb3['shift']());}};_0x471eec(++_0x682c5b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x34bb11,_0x45ae8c){var _0x2f4534=function(_0x3797cc){while(--_0x3797cc){_0x34bb11['push'](_0x34bb11['shift']());}};_0x2f4534(++_0x45ae8c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 975dfb1..3f23f33 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 _0xbac1=['listen','rules','message','interaction','applications','isArray','length','existsSync','join','.js','app','toLowerCase','appdata','split','channel','mail','push','slice','dialogflow','dialogflowv2','amazonlex','tag','tvox','getMustacheRender','account','ChatWebsiteId','ContactId','body','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','error','stack','routing\x20is\x20empty','agent','agents','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','busyQueue','end','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','server','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','map'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xbac1,0x17f));var _0x1bac=function(_0x1829a3,_0x303a18){_0x1829a3=_0x1829a3-0x0;var _0x15e120=_0xbac1[_0x1829a3];return _0x15e120;};'use strict';var _=require('lodash');var util=require(_0x1bac('0x0'));var path=require(_0x1bac('0x1'));var fs=require('fs');var jayson=require(_0x1bac('0x2'));var BPromise=require(_0x1bac('0x3'));var utils=require(_0x1bac('0x4'));var sUtils=require(_0x1bac('0x5'));var logger=require('../../../config/logger')(_0x1bac('0x6'));var rpc={'openchannelQueueReport':require(_0x1bac('0x7')),'mailQueueReport':require(_0x1bac('0x8')),'chatQueueReport':require(_0x1bac('0x9')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x1bac('0xa'))};var RuleEngine=require(_0x1bac('0xb'));function getId(_0x5441f0,_0x1e6480,_0x86c896){return util[_0x1bac('0xc')]('%s.%s.%s',_0x5441f0,_0x1e6480||0x0,_0x86c896||0x0);}function getIntervals(_0x1f2f10,_0x138649){var _0xbac0f0=[];if(!_[_0x1bac('0xd')](_0x138649['IntervalId'])&&!_[_0x1bac('0xd')](_0x1f2f10[_0x138649[_0x1bac('0xe')]])&&!_[_0x1bac('0xd')](_0x1f2f10[_0x138649[_0x1bac('0xe')]][_0x1bac('0xf')])){_0xbac0f0=_[_0x1bac('0x10')](_0x1f2f10[_0x138649[_0x1bac('0xe')]][_0x1bac('0xf')],'interval');}else if(!_[_0x1bac('0xd')](_0x138649['interval'])){_0xbac0f0=[_0x138649['interval']];}return _0xbac0f0;}exports[_0x1bac('0x11')]=function(_0x33d2dc){_0x33d2dc[_0x1bac('0x12')]={};return new BPromise(function(_0x216c5a,_0x281da9){var _0x5b2fb2={'Start':function(_0x109b5b){var _0x5d6017=this;return new Promise(function(_0xa2da02,_0x59be64){if(_0x109b5b){try{var _0x47c516=[];var _0x44257b=getId(_0x109b5b['channel'],_0x109b5b['message']?_0x109b5b[_0x1bac('0x13')]['id']:0x0,_0x109b5b[_0x1bac('0x14')]?_0x109b5b[_0x1bac('0x14')]['id']:0x0);var _0x11f29d=sUtils['checkWaitingNotifications'](_0x33d2dc,_0x109b5b);if(_0x109b5b['transfer']||!_0x11f29d&&_0x109b5b[_0x1bac('0x15')]&&_[_0x1bac('0x16')](_0x109b5b[_0x1bac('0x15')])&&_0x109b5b[_0x1bac('0x15')][_0x1bac('0x17')]){for(var _0x5de03d=0x0;_0x5de03d<_0x109b5b[_0x1bac('0x15')][_0x1bac('0x17')];_0x5de03d+=0x1){var _0x32af3f=_0x109b5b['applications'][_0x5de03d];if(fs[_0x1bac('0x18')](path[_0x1bac('0x19')](__dirname,_0x1bac('0x15'),_0x32af3f['app']+_0x1bac('0x1a')))){var _0x57a5e3=[];switch(_0x32af3f[_0x1bac('0x1b')][_0x1bac('0x1c')]()){case'autoreply':var _0x3296f0=_0x32af3f[_0x1bac('0x1d')][_0x1bac('0x1e')](',');if(_0x109b5b[_0x1bac('0x1f')]===_0x1bac('0x20')){_0x57a5e3[_0x1bac('0x21')](_0x3296f0[0x0]);_0x57a5e3[_0x1bac('0x21')](_0x3296f0[0x1]);_0x57a5e3[_0x1bac('0x21')](_0x3296f0[_0x1bac('0x22')](0x2,_0x3296f0[_0x1bac('0x17')])[_0x1bac('0x19')](','));}else{_0x57a5e3[_0x1bac('0x21')](_0x3296f0[0x0]);_0x57a5e3[_0x1bac('0x21')](_0x3296f0[_0x1bac('0x22')](0x1,_0x3296f0[_0x1bac('0x17')])['join'](','));}break;case _0x1bac('0x23'):var _0x265957=_0x32af3f['appdata'][_0x1bac('0x1e')](',');_0x57a5e3[_0x1bac('0x21')](_0x265957[0x0]);_0x57a5e3['push'](_0x265957[0x1]);_0x57a5e3[_0x1bac('0x21')](_0x265957['slice'](0x2,_0x265957[_0x1bac('0x17')])[_0x1bac('0x19')](','));break;case _0x1bac('0x24'):var _0x516cfa=_0x32af3f[_0x1bac('0x1d')][_0x1bac('0x1e')](',');_0x57a5e3[_0x1bac('0x21')](_0x516cfa[0x0]);_0x57a5e3['push'](_0x516cfa[0x1]);_0x57a5e3['push'](_0x516cfa[0x2]);_0x57a5e3[_0x1bac('0x21')](_0x516cfa[0x3]);_0x57a5e3['push'](_0x516cfa['slice'](0x4,_0x516cfa[_0x1bac('0x17')])[_0x1bac('0x19')](','));break;case _0x1bac('0x25'):var _0x5dec3b=_0x32af3f[_0x1bac('0x1d')][_0x1bac('0x1e')](',');_0x57a5e3[_0x1bac('0x21')](_0x5dec3b[0x0]);_0x57a5e3[_0x1bac('0x21')](_0x5dec3b[0x1]);_0x57a5e3['push'](_0x5dec3b[0x2]);_0x57a5e3['push'](_0x5dec3b[0x3]);_0x57a5e3[_0x1bac('0x21')](_0x5dec3b['slice'](0x4,_0x5dec3b[_0x1bac('0x17')])['join'](','));break;case _0x1bac('0x13'):_0x57a5e3[_0x1bac('0x21')](_0x32af3f[_0x1bac('0x1d')]);break;case _0x1bac('0x26'):_0x57a5e3[_0x1bac('0x21')](_0x32af3f['TagId']);_0x57a5e3[_0x1bac('0x21')](_0x32af3f['appdata']);break;case _0x1bac('0x27'):var _0x156fd2=utils[_0x1bac('0x28')](_0x109b5b[_0x1bac('0x29')]['notificationTemplate'],_0x109b5b);var _0x2a3698=_0x32af3f[_0x1bac('0x1d')][_0x1bac('0x1e')](',');_0x57a5e3[_0x1bac('0x21')](_0x2a3698[0x0]);_0x57a5e3[_0x1bac('0x21')](_0x2a3698[0x1]);_0x57a5e3[_0x1bac('0x21')](_0x2a3698[0x2]);_0x57a5e3[_0x1bac('0x21')](_0x2a3698[0x3]);_0x57a5e3['push'](_0x2a3698[0x4]);_0x57a5e3[_0x1bac('0x21')](_0x2a3698[0x5]);_0x57a5e3[_0x1bac('0x21')](_0x2a3698[0x6]);_0x57a5e3[_0x1bac('0x21')](_0x2a3698[0x7]);_0x57a5e3[_0x1bac('0x21')](_0x2a3698[0x8]);_0x57a5e3['push'](_0x2a3698[0x9]);_0x57a5e3[_0x1bac('0x21')](_0x2a3698[0xa]);_0x57a5e3[_0x1bac('0x21')](_0x109b5b[_0x1bac('0x14')]['id']);_0x57a5e3[_0x1bac('0x21')](_0x109b5b[_0x1bac('0x13')]['id']);_0x57a5e3[_0x1bac('0x21')](_0x32af3f[_0x1bac('0x2a')]);_0x57a5e3[_0x1bac('0x21')](_0x109b5b[_0x1bac('0x14')][_0x1bac('0x2b')]);_0x57a5e3[_0x1bac('0x21')](_0x109b5b['body'][_0x1bac('0x2c')]);_0x57a5e3['push'](_0x156fd2);break;default:_0x57a5e3=_[_0x1bac('0xd')](_0x32af3f[_0x1bac('0x1d')])?[]:_0x32af3f[_0x1bac('0x1d')][_0x1bac('0x1e')](',');}var _0xc1b717={'id':util[_0x1bac('0xc')]('%s:%s:%s',_0x44257b,_0x32af3f['id'],_0x32af3f['app']),'condition':require('./interval')[_0x1bac('0x2d')](_0x44257b,getIntervals(_0x33d2dc[_0x1bac('0x2e')],_0x32af3f),_0x33d2dc),'consequence':require(_0x1bac('0x2f')+_0x32af3f[_0x1bac('0x1b')])[_0x1bac('0x30')](_0x44257b,_0x57a5e3,_0x33d2dc,_0x109b5b),'p':_0x32af3f[_0x1bac('0x31')]||0x0};logger[_0x1bac('0x32')](_0x1bac('0x33'),_0xc1b717['id'],_0x1bac('0x34'),getIntervals(_0x33d2dc[_0x1bac('0x2e')],_0x32af3f)[_0x1bac('0x19')](_0x1bac('0x35')));_0x47c516[_0x1bac('0x21')](_0xc1b717);}else{logger['error'](_0x1bac('0x36'),path[_0x1bac('0x19')](__dirname,_0x1bac('0x15'),_0x32af3f['app']+_0x1bac('0x1a')));}}_0x33d2dc['rules'][_0x44257b]=new RuleEngine(_0x47c516);_0x33d2dc['rules'][_0x44257b][_0x1bac('0x37')](_0x109b5b,function(_0x5f4e2a){logger[_0x1bac('0x32')](_0x1bac('0x38'),JSON[_0x1bac('0x39')](_0x5f4e2a[_0x1bac('0x3a')]));if(_0x33d2dc['rules'][_0x44257b]){_0x33d2dc[_0x1bac('0x12')][_0x44257b][_0x1bac('0x3b')]('complete');}});return _0xa2da02({'code':0xc8,'message':_0x109b5b});}else{if(_0x11f29d){logger['info'](util['format'](_0x1bac('0x3c'),_0x44257b));}else{logger[_0x1bac('0x32')](_0x1bac('0x3d'));}return _0xa2da02({'code':0xc8,'message':_0x109b5b});}}catch(_0x355109){logger[_0x1bac('0x3e')](_0x355109[_0x1bac('0x3f')]);return _0x59be64(_0x5d6017[_0x1bac('0x3e')](0x1f4,_0x355109));}}return _0x59be64(_0x1bac('0x40'));});},'AcceptMessage':function(_0x5d2cc3){var _0x4c16ed=this;return new Promise(function(_0x5c2418,_0x5b6169){if(_0x5d2cc3[_0x1bac('0x41')]&&_0x5d2cc3['agent']['id']){if(_0x33d2dc[_0x1bac('0x42')][_0x5d2cc3[_0x1bac('0x41')]['id']]){_0x33d2dc[_0x1bac('0x42')][_0x5d2cc3[_0x1bac('0x41')]['id']]['busy']=![];_0x33d2dc['agents'][_0x5d2cc3[_0x1bac('0x41')]['id']]['busyQueue']=undefined;}}if(_0x5d2cc3['message']&&_0x5d2cc3['message']['id']){try{var _0x3c2671=getId(_0x5d2cc3[_0x1bac('0x1f')],_0x5d2cc3[_0x1bac('0x13')]?_0x5d2cc3[_0x1bac('0x13')]['id']:0x0,_0x5d2cc3[_0x1bac('0x14')]?_0x5d2cc3[_0x1bac('0x14')]['id']:0x0);if(_0x33d2dc['rules'][_0x3c2671]){_0x33d2dc[_0x1bac('0x12')][_0x3c2671][_0x1bac('0x3b')]('end');if(rpc[_0x5d2cc3['channel']+'QueueReport']){rpc[_0x5d2cc3[_0x1bac('0x1f')]+'QueueReport'][_0x1bac('0x43')](_0x3c2671,{'UserId':_0x5d2cc3[_0x1bac('0x13')][_0x1bac('0x44')]})[_0x1bac('0x45')](function(){logger[_0x1bac('0x3e')](_0x1bac('0x46'));});}}return _0x5c2418({'code':0xc8,'message':_0x5d2cc3});}catch(_0x4862aa){logger['error'](_0x4862aa['stack']);return _0x5b6169(_0x4c16ed[_0x1bac('0x3e')](0x1f4,_0x4862aa));}}logger[_0x1bac('0x3e')](_0x1bac('0x47'));return _0x5b6169(_0x4c16ed['error'](0x1f4,_0x1bac('0x47')));});},'RejectMessage':function(_0x352e70){var _0x166a2a=this;return new Promise(function(_0x8c84b6,_0x4abfbb){if(_0x352e70[_0x1bac('0x41')]&&_0x352e70[_0x1bac('0x41')]['id']){try{if(_0x33d2dc[_0x1bac('0x42')][_0x352e70[_0x1bac('0x41')]['id']]){_0x33d2dc[_0x1bac('0x42')][_0x352e70[_0x1bac('0x41')]['id']][_0x1bac('0x48')]=![];_0x33d2dc[_0x1bac('0x42')][_0x352e70['agent']['id']][_0x1bac('0x49')]=undefined;}return _0x8c84b6({'code':0xc8,'message':_0x352e70});}catch(_0x1883db){logger[_0x1bac('0x3e')](_0x1883db[_0x1bac('0x3f')]);return _0x4abfbb(_0x166a2a[_0x1bac('0x3e')](0x1f4,_0x1883db));}}logger[_0x1bac('0x3e')]('message\x20is\x20empty');return _0x4abfbb(_0x166a2a['error'](0x1f4,_0x1bac('0x47')));});},'AbandonInteraction':function(_0xbdc374){var _0x5d3a6f=this;return new Promise(function(_0x397e9f,_0x1bc6df){if(_0xbdc374['channel']&&_0xbdc374[_0x1bac('0x14')]&&_0xbdc374[_0x1bac('0x14')]['id']){try{var _0x47a8ef=getId(_0xbdc374[_0x1bac('0x1f')],_0xbdc374[_0x1bac('0x13')]?_0xbdc374['message']['id']:0x0,_0xbdc374[_0x1bac('0x14')]?_0xbdc374[_0x1bac('0x14')]['id']:0x0);if(_0x33d2dc[_0x1bac('0x12')][_0x47a8ef]){_0x33d2dc[_0x1bac('0x12')][_0x47a8ef]['emit'](_0x1bac('0x4a'));}return _0x397e9f({'code':0xc8,'message':_0xbdc374});}catch(_0xed0986){logger['error'](_0xed0986[_0x1bac('0x3f')]);return _0x1bc6df(_0x5d3a6f[_0x1bac('0x3e')](0x1f4,_0xed0986));}}logger['error'](_0x1bac('0x47'));return _0x1bc6df(_0x5d3a6f[_0x1bac('0x3e')](0x1f4,_0x1bac('0x47')));});},'AgentCapacity':function(_0x5d2e25){var _0x33fb55=this;return new Promise(function(_0x13bfa0,_0x31d3d3){if(_0x33d2dc['agents']['hasOwnProperty'](_0x5d2e25['id'])){for(var _0xfb39c9 in _0x5d2e25[_0x1bac('0x4b')]){if(_0x5d2e25['capacity'][_0x1bac('0x4c')](_0xfb39c9)){if(_0x33d2dc[_0x1bac('0x42')][_0x5d2e25['id']][_0x1bac('0x4c')](_0xfb39c9+'CurrentCapacity')){_0x33d2dc[_0x1bac('0x42')][_0x5d2e25['id']][_0xfb39c9+_0x1bac('0x4d')]=parseInt(_0x5d2e25[_0x1bac('0x4b')][_0xfb39c9],0xa);}}}_0x33d2dc['agents'][_0x5d2e25['id']][_0x1bac('0x4e')]();return _0x13bfa0({'code':0xc8,'message':_0x33d2dc[_0x1bac('0x42')][_0x5d2e25['id']]});}else{return _0x31d3d3(_0x33fb55[_0x1bac('0x3e')](0x1f4,_0x1bac('0x4f')));}});},'Agents':function(_0x50aa1b){return new Promise(function(_0x3a4111){var _0x345bab=_[_0x1bac('0x50')](_0x33d2dc[_0x1bac('0x42')]);if(_0x50aa1b&&_0x50aa1b['id']){var _0x16116e=_[_0x1bac('0x51')](_0x345bab,function(_0x5ebe00){return _0x5ebe00['id']===_0x50aa1b['id'];});_0x3a4111(_0x16116e);}else{_0x3a4111({'count':_0x345bab[_0x1bac('0x17')],'rows':_0x345bab});}});},'ChatQueues':function(){return new Promise(function(_0xfcd678){var _0x13a127=[];for(var _0x1faa72 in _0x33d2dc[_0x1bac('0x52')]){if(_0x33d2dc[_0x1bac('0x52')]['hasOwnProperty'](_0x1faa72)){var _0x41d143=_0x33d2dc['chatQueues'][_0x1faa72];var _0x146082={'id':_0x41d143['id'],'available':_0x41d143[_0x1bac('0x53')],'loggedIn':_0x41d143[_0x1bac('0x54')],'name':_0x41d143[_0x1bac('0x55')],'paused':_0x41d143[_0x1bac('0x56')],'waiting':_0x41d143[_0x1bac('0x57')]};_0x13a127['push'](_0x146082);}}_0xfcd678({'count':_0x13a127[_0x1bac('0x17')],'rows':_0x13a127});});},'MailQueues':function(){return new Promise(function(_0xaa2473){var _0x2dbb0e=[];for(var _0x93b25c in _0x33d2dc[_0x1bac('0x58')]){if(_0x33d2dc[_0x1bac('0x58')][_0x1bac('0x4c')](_0x93b25c)){var _0x169f6f=_0x33d2dc[_0x1bac('0x58')][_0x93b25c];var _0x2f940f={'id':_0x169f6f['id'],'available':_0x169f6f[_0x1bac('0x53')],'loggedIn':_0x169f6f['loggedIn'],'name':_0x169f6f[_0x1bac('0x55')],'paused':_0x169f6f['paused'],'waiting':_0x169f6f[_0x1bac('0x57')]};_0x2dbb0e[_0x1bac('0x21')](_0x2f940f);}}_0xaa2473({'count':_0x2dbb0e[_0x1bac('0x17')],'rows':_0x2dbb0e});});},'OpenchannelQueues':function(){return new Promise(function(_0x16d83c){var _0x466985=[];for(var _0x5b7212 in _0x33d2dc[_0x1bac('0x59')]){if(_0x33d2dc[_0x1bac('0x59')][_0x1bac('0x4c')](_0x5b7212)){var _0x3819e8=_0x33d2dc[_0x1bac('0x59')][_0x5b7212];var _0x5ec7c7={'id':_0x3819e8['id'],'available':_0x3819e8['available'],'loggedIn':_0x3819e8[_0x1bac('0x54')],'name':_0x3819e8[_0x1bac('0x55')],'paused':_0x3819e8[_0x1bac('0x56')],'waiting':_0x3819e8[_0x1bac('0x57')]};_0x466985['push'](_0x5ec7c7);}}_0x16d83c({'count':_0x466985[_0x1bac('0x17')],'rows':_0x466985});});},'SmsQueues':function(){return new Promise(function(_0x4484c8){var _0x4328b0=[];for(var _0x597c7d in _0x33d2dc[_0x1bac('0x5a')]){if(_0x33d2dc[_0x1bac('0x5a')][_0x1bac('0x4c')](_0x597c7d)){var _0x50b556=_0x33d2dc[_0x1bac('0x5a')][_0x597c7d];var _0x456203={'id':_0x50b556['id'],'available':_0x50b556['available'],'loggedIn':_0x50b556[_0x1bac('0x54')],'name':_0x50b556['name'],'paused':_0x50b556['paused'],'waiting':_0x50b556[_0x1bac('0x57')]};_0x4328b0[_0x1bac('0x21')](_0x456203);}}_0x4484c8({'count':_0x4328b0[_0x1bac('0x17')],'rows':_0x4328b0});});},'FaxQueues':function(){return new Promise(function(_0x167a25){var _0x14d18b=[];for(var _0x55f4d3 in _0x33d2dc[_0x1bac('0x5b')]){if(_0x33d2dc['faxQueues']['hasOwnProperty'](_0x55f4d3)){var _0x8ec129=_0x33d2dc[_0x1bac('0x5b')][_0x55f4d3];var _0x423e77={'id':_0x8ec129['id'],'available':_0x8ec129['available'],'loggedIn':_0x8ec129['loggedIn'],'name':_0x8ec129[_0x1bac('0x55')],'paused':_0x8ec129[_0x1bac('0x56')],'waiting':_0x8ec129[_0x1bac('0x57')]};_0x14d18b[_0x1bac('0x21')](_0x423e77);}}_0x167a25({'count':_0x14d18b[_0x1bac('0x17')],'rows':_0x14d18b});});},'WhatsappQueues':function(){return new Promise(function(_0x305552){var _0x3a7620=[];for(var _0x5e2997 in _0x33d2dc[_0x1bac('0x5c')]){if(_0x33d2dc[_0x1bac('0x5c')][_0x1bac('0x4c')](_0x5e2997)){var _0x41b3da=_0x33d2dc[_0x1bac('0x5c')][_0x5e2997];var _0x3346dd={'id':_0x41b3da['id'],'available':_0x41b3da['available'],'loggedIn':_0x41b3da[_0x1bac('0x54')],'name':_0x41b3da[_0x1bac('0x55')],'paused':_0x41b3da['paused'],'waiting':_0x41b3da[_0x1bac('0x57')]};_0x3a7620[_0x1bac('0x21')](_0x3346dd);}}_0x305552({'count':_0x3a7620['length'],'rows':_0x3a7620});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x34f8ff){var _0x3ead12=_['values'](_0x33d2dc['chatQueuesWaitingInteractions']);_0x34f8ff({'count':_0x3ead12[_0x1bac('0x17')],'rows':_0x3ead12});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x2ab2c1){var _0x3487be=_['values'](_0x33d2dc[_0x1bac('0x5d')]);_0x2ab2c1({'count':_0x3487be[_0x1bac('0x17')],'rows':_0x3487be});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x5bacbb){var _0x286a63=_[_0x1bac('0x50')](_0x33d2dc[_0x1bac('0x5e')]);_0x5bacbb({'count':_0x286a63[_0x1bac('0x17')],'rows':_0x286a63});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x3f7484){var _0x551375=_[_0x1bac('0x50')](_0x33d2dc[_0x1bac('0x5f')]);_0x3f7484({'count':_0x551375[_0x1bac('0x17')],'rows':_0x551375});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x4eb364){var _0x15ce16=_['values'](_0x33d2dc['faxQueuesWaitingInteractions']);_0x4eb364({'count':_0x15ce16[_0x1bac('0x17')],'rows':_0x15ce16});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x22cf50){var _0x1d72c2=_[_0x1bac('0x50')](_0x33d2dc['whatsappQueuesWaitingInteractions']);_0x22cf50({'count':_0x1d72c2[_0x1bac('0x17')],'rows':_0x1d72c2});});}};var _0x4af290=jayson[_0x1bac('0x60')](_0x5b2fb2)['http']();_0x4af290['on']('error',function(_0x3c9fec){logger['error'](JSON['stringify'](_0x3c9fec));return _0x281da9(_0x3c9fec);});_0x4af290['listen'](0x232c,_0x1bac('0x61'),function(){console[_0x1bac('0x62')](_0x1bac('0x63'),0x232c);return _0x216c5a('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0x3c50=['hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','find','chatQueues','available','loggedIn','name','paused','mailQueues','waiting','openchannelQueues','smsQueues','faxQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','listen','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','path','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','rules','channel','message','interaction','checkWaitingNotifications','transfer','applications','length','join','app','.js','toLowerCase','autoreply','appdata','mail','push','slice','dialogflow','split','amazonlex','tag','TagId','tvox','account','body','format','%s:%s:%s','./interval','intervals','Push\x20new\x20rule','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','info','matchPath','emit','Skipped\x20routing\x20for\x20%s','stack','agent','agents','busy','busyQueue','end','QueueReport','update','UserId','message\x20is\x20empty'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0x3c50,0x132));var _0x03c5=function(_0x451928,_0x4815ea){_0x451928=_0x451928-0x0;var _0x35a457=_0x3c50[_0x451928];return _0x35a457;};'use strict';var _=require(_0x03c5('0x0'));var util=require('util');var path=require(_0x03c5('0x1'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x03c5('0x2'));var utils=require(_0x03c5('0x3'));var sUtils=require(_0x03c5('0x4'));var logger=require(_0x03c5('0x5'))(_0x03c5('0x6'));var rpc={'openchannelQueueReport':require(_0x03c5('0x7')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x03c5('0x8')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x03c5('0x9')),'whatsappQueueReport':require(_0x03c5('0xa'))};var RuleEngine=require(_0x03c5('0xb'));function getId(_0x55c6a3,_0x3cc5ef,_0x4dadc4){return util['format'](_0x03c5('0xc'),_0x55c6a3,_0x3cc5ef||0x0,_0x4dadc4||0x0);}function getIntervals(_0x51cecb,_0x457ec8){var _0x5a3bed=[];if(!_[_0x03c5('0xd')](_0x457ec8[_0x03c5('0xe')])&&!_['isNil'](_0x51cecb[_0x457ec8[_0x03c5('0xe')]])&&!_[_0x03c5('0xd')](_0x51cecb[_0x457ec8[_0x03c5('0xe')]][_0x03c5('0xf')])){_0x5a3bed=_[_0x03c5('0x10')](_0x51cecb[_0x457ec8[_0x03c5('0xe')]]['Intervals'],_0x03c5('0x11'));}else if(!_[_0x03c5('0xd')](_0x457ec8[_0x03c5('0x11')])){_0x5a3bed=[_0x457ec8[_0x03c5('0x11')]];}return _0x5a3bed;}exports['listen']=function(_0x39bbb7){_0x39bbb7[_0x03c5('0x12')]={};return new BPromise(function(_0x4990c4,_0x4eccd8){var _0x19588f={'Start':function(_0x5a7113){var _0x4a46fe=this;return new Promise(function(_0x4ebb44,_0xc23735){if(_0x5a7113){try{var _0x4c71ed=[];var _0x2458fa=getId(_0x5a7113[_0x03c5('0x13')],_0x5a7113['message']?_0x5a7113[_0x03c5('0x14')]['id']:0x0,_0x5a7113[_0x03c5('0x15')]?_0x5a7113[_0x03c5('0x15')]['id']:0x0);var _0x47dd55=sUtils[_0x03c5('0x16')](_0x39bbb7,_0x5a7113);if(_0x5a7113[_0x03c5('0x17')]||!_0x47dd55&&_0x5a7113['applications']&&_['isArray'](_0x5a7113[_0x03c5('0x18')])&&_0x5a7113[_0x03c5('0x18')]['length']){for(var _0x57a601=0x0;_0x57a601<_0x5a7113[_0x03c5('0x18')][_0x03c5('0x19')];_0x57a601+=0x1){var _0x1af209=_0x5a7113[_0x03c5('0x18')][_0x57a601];if(fs['existsSync'](path[_0x03c5('0x1a')](__dirname,'applications',_0x1af209[_0x03c5('0x1b')]+_0x03c5('0x1c')))){var _0x5acdbb=[];switch(_0x1af209[_0x03c5('0x1b')][_0x03c5('0x1d')]()){case _0x03c5('0x1e'):var _0x114308=_0x1af209[_0x03c5('0x1f')]['split'](',');if(_0x5a7113['channel']===_0x03c5('0x20')){_0x5acdbb[_0x03c5('0x21')](_0x114308[0x0]);_0x5acdbb['push'](_0x114308[0x1]);_0x5acdbb[_0x03c5('0x21')](_0x114308[_0x03c5('0x22')](0x2,_0x114308['length'])['join'](','));}else{_0x5acdbb[_0x03c5('0x21')](_0x114308[0x0]);_0x5acdbb[_0x03c5('0x21')](_0x114308[_0x03c5('0x22')](0x1,_0x114308['length'])[_0x03c5('0x1a')](','));}break;case _0x03c5('0x23'):var _0xea7372=_0x1af209[_0x03c5('0x1f')][_0x03c5('0x24')](',');_0x5acdbb[_0x03c5('0x21')](_0xea7372[0x0]);_0x5acdbb[_0x03c5('0x21')](_0xea7372[0x1]);_0x5acdbb[_0x03c5('0x21')](_0xea7372['slice'](0x2,_0xea7372[_0x03c5('0x19')])[_0x03c5('0x1a')](','));break;case'dialogflowv2':var _0x2c2b3c=_0x1af209['appdata']['split'](',');_0x5acdbb['push'](_0x2c2b3c[0x0]);_0x5acdbb[_0x03c5('0x21')](_0x2c2b3c[0x1]);_0x5acdbb[_0x03c5('0x21')](_0x2c2b3c[0x2]);_0x5acdbb[_0x03c5('0x21')](_0x2c2b3c[0x3]);_0x5acdbb['push'](_0x2c2b3c['slice'](0x4,_0x2c2b3c[_0x03c5('0x19')])['join'](','));break;case _0x03c5('0x25'):var _0x5ec69e=_0x1af209['appdata'][_0x03c5('0x24')](',');_0x5acdbb[_0x03c5('0x21')](_0x5ec69e[0x0]);_0x5acdbb['push'](_0x5ec69e[0x1]);_0x5acdbb[_0x03c5('0x21')](_0x5ec69e[0x2]);_0x5acdbb['push'](_0x5ec69e[0x3]);_0x5acdbb[_0x03c5('0x21')](_0x5ec69e[_0x03c5('0x22')](0x4,_0x5ec69e[_0x03c5('0x19')])[_0x03c5('0x1a')](','));break;case _0x03c5('0x14'):_0x5acdbb[_0x03c5('0x21')](_0x1af209[_0x03c5('0x1f')]);break;case _0x03c5('0x26'):_0x5acdbb['push'](_0x1af209[_0x03c5('0x27')]);_0x5acdbb['push'](_0x1af209[_0x03c5('0x1f')]);break;case _0x03c5('0x28'):var _0x49f044=utils['getMustacheRender'](_0x5a7113[_0x03c5('0x29')]['notificationTemplate'],_0x5a7113);var _0x340a02=_0x1af209[_0x03c5('0x1f')][_0x03c5('0x24')](',');_0x5acdbb['push'](_0x340a02[0x0]);_0x5acdbb[_0x03c5('0x21')](_0x340a02[0x1]);_0x5acdbb[_0x03c5('0x21')](_0x340a02[0x2]);_0x5acdbb[_0x03c5('0x21')](_0x340a02[0x3]);_0x5acdbb[_0x03c5('0x21')](_0x340a02[0x4]);_0x5acdbb[_0x03c5('0x21')](_0x340a02[0x5]);_0x5acdbb[_0x03c5('0x21')](_0x340a02[0x6]);_0x5acdbb['push'](_0x340a02[0x7]);_0x5acdbb['push'](_0x340a02[0x8]);_0x5acdbb[_0x03c5('0x21')](_0x340a02[0x9]);_0x5acdbb['push'](_0x340a02[0xa]);_0x5acdbb[_0x03c5('0x21')](_0x5a7113['interaction']['id']);_0x5acdbb[_0x03c5('0x21')](_0x5a7113[_0x03c5('0x14')]['id']);_0x5acdbb[_0x03c5('0x21')](_0x1af209['ChatWebsiteId']);_0x5acdbb[_0x03c5('0x21')](_0x5a7113['interaction']['ContactId']);_0x5acdbb[_0x03c5('0x21')](_0x5a7113[_0x03c5('0x2a')]['body']);_0x5acdbb['push'](_0x49f044);break;default:_0x5acdbb=_['isNil'](_0x1af209['appdata'])?[]:_0x1af209['appdata'][_0x03c5('0x24')](',');}var _0x262ceb={'id':util[_0x03c5('0x2b')](_0x03c5('0x2c'),_0x2458fa,_0x1af209['id'],_0x1af209['app']),'condition':require(_0x03c5('0x2d'))['condition'](_0x2458fa,getIntervals(_0x39bbb7[_0x03c5('0x2e')],_0x1af209),_0x39bbb7),'consequence':require('./applications/'+_0x1af209[_0x03c5('0x1b')])['consequence'](_0x2458fa,_0x5acdbb,_0x39bbb7,_0x5a7113),'p':_0x1af209['priority']||0x0};logger['info'](_0x03c5('0x2f'),_0x262ceb['id'],'on\x20interval',getIntervals(_0x39bbb7['intervals'],_0x1af209)[_0x03c5('0x1a')](_0x03c5('0x30')));_0x4c71ed[_0x03c5('0x21')](_0x262ceb);}else{logger[_0x03c5('0x31')](_0x03c5('0x32'),path[_0x03c5('0x1a')](__dirname,_0x03c5('0x18'),_0x1af209[_0x03c5('0x1b')]+_0x03c5('0x1c')));}}_0x39bbb7[_0x03c5('0x12')][_0x2458fa]=new RuleEngine(_0x4c71ed);_0x39bbb7[_0x03c5('0x12')][_0x2458fa][_0x03c5('0x33')](_0x5a7113,function(_0x3aec6a){logger[_0x03c5('0x34')]('Applications\x20executed',JSON['stringify'](_0x3aec6a[_0x03c5('0x35')]));if(_0x39bbb7[_0x03c5('0x12')][_0x2458fa]){_0x39bbb7[_0x03c5('0x12')][_0x2458fa][_0x03c5('0x36')]('complete');}});return _0x4ebb44({'code':0xc8,'message':_0x5a7113});}else{if(_0x47dd55){logger[_0x03c5('0x34')](util['format'](_0x03c5('0x37'),_0x2458fa));}else{logger[_0x03c5('0x34')]('No\x20applications\x20to\x20execute');}return _0x4ebb44({'code':0xc8,'message':_0x5a7113});}}catch(_0x383b5a){logger[_0x03c5('0x31')](_0x383b5a[_0x03c5('0x38')]);return _0xc23735(_0x4a46fe['error'](0x1f4,_0x383b5a));}}return _0xc23735('routing\x20is\x20empty');});},'AcceptMessage':function(_0x248d24){var _0x1f4f81=this;return new Promise(function(_0x5a8fd6,_0x319da6){if(_0x248d24[_0x03c5('0x39')]&&_0x248d24[_0x03c5('0x39')]['id']){if(_0x39bbb7[_0x03c5('0x3a')][_0x248d24[_0x03c5('0x39')]['id']]){_0x39bbb7[_0x03c5('0x3a')][_0x248d24['agent']['id']][_0x03c5('0x3b')]=![];_0x39bbb7['agents'][_0x248d24[_0x03c5('0x39')]['id']][_0x03c5('0x3c')]=undefined;}}if(_0x248d24[_0x03c5('0x14')]&&_0x248d24['message']['id']){try{var _0x168d1c=getId(_0x248d24[_0x03c5('0x13')],_0x248d24['message']?_0x248d24['message']['id']:0x0,_0x248d24[_0x03c5('0x15')]?_0x248d24['interaction']['id']:0x0);if(_0x39bbb7['rules'][_0x168d1c]){_0x39bbb7[_0x03c5('0x12')][_0x168d1c][_0x03c5('0x36')](_0x03c5('0x3d'));if(rpc[_0x248d24[_0x03c5('0x13')]+_0x03c5('0x3e')]){rpc[_0x248d24[_0x03c5('0x13')]+'QueueReport'][_0x03c5('0x3f')](_0x168d1c,{'UserId':_0x248d24['message'][_0x03c5('0x40')]})['catch'](function(){logger[_0x03c5('0x31')]('error\x20update\x20queue\x20report');});}}return _0x5a8fd6({'code':0xc8,'message':_0x248d24});}catch(_0x565529){logger[_0x03c5('0x31')](_0x565529[_0x03c5('0x38')]);return _0x319da6(_0x1f4f81[_0x03c5('0x31')](0x1f4,_0x565529));}}logger[_0x03c5('0x31')](_0x03c5('0x41'));return _0x319da6(_0x1f4f81[_0x03c5('0x31')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x4a0ab9){var _0x128f9c=this;return new Promise(function(_0x1344a3,_0x2b8eb1){if(_0x4a0ab9['agent']&&_0x4a0ab9[_0x03c5('0x39')]['id']){try{if(_0x39bbb7[_0x03c5('0x3a')][_0x4a0ab9[_0x03c5('0x39')]['id']]){_0x39bbb7[_0x03c5('0x3a')][_0x4a0ab9['agent']['id']][_0x03c5('0x3b')]=![];_0x39bbb7['agents'][_0x4a0ab9['agent']['id']][_0x03c5('0x3c')]=undefined;}return _0x1344a3({'code':0xc8,'message':_0x4a0ab9});}catch(_0x22b890){logger[_0x03c5('0x31')](_0x22b890[_0x03c5('0x38')]);return _0x2b8eb1(_0x128f9c[_0x03c5('0x31')](0x1f4,_0x22b890));}}logger[_0x03c5('0x31')](_0x03c5('0x41'));return _0x2b8eb1(_0x128f9c[_0x03c5('0x31')](0x1f4,_0x03c5('0x41')));});},'AbandonInteraction':function(_0x3f74fb){var _0x587ec5=this;return new Promise(function(_0x130d35,_0x3e8de2){if(_0x3f74fb['channel']&&_0x3f74fb['interaction']&&_0x3f74fb['interaction']['id']){try{var _0xd0101a=getId(_0x3f74fb[_0x03c5('0x13')],_0x3f74fb['message']?_0x3f74fb[_0x03c5('0x14')]['id']:0x0,_0x3f74fb['interaction']?_0x3f74fb[_0x03c5('0x15')]['id']:0x0);if(_0x39bbb7[_0x03c5('0x12')][_0xd0101a]){_0x39bbb7[_0x03c5('0x12')][_0xd0101a][_0x03c5('0x36')](_0x03c5('0x3d'));}return _0x130d35({'code':0xc8,'message':_0x3f74fb});}catch(_0xee76b1){logger[_0x03c5('0x31')](_0xee76b1[_0x03c5('0x38')]);return _0x3e8de2(_0x587ec5[_0x03c5('0x31')](0x1f4,_0xee76b1));}}logger['error']('message\x20is\x20empty');return _0x3e8de2(_0x587ec5[_0x03c5('0x31')](0x1f4,_0x03c5('0x41')));});},'AgentCapacity':function(_0x20b20f){var _0x49561b=this;return new Promise(function(_0xadce59,_0x14141b){if(_0x39bbb7[_0x03c5('0x3a')][_0x03c5('0x42')](_0x20b20f['id'])){for(var _0x4ba813 in _0x20b20f[_0x03c5('0x43')]){if(_0x20b20f[_0x03c5('0x43')][_0x03c5('0x42')](_0x4ba813)){if(_0x39bbb7[_0x03c5('0x3a')][_0x20b20f['id']]['hasOwnProperty'](_0x4ba813+_0x03c5('0x44'))){_0x39bbb7['agents'][_0x20b20f['id']][_0x4ba813+_0x03c5('0x44')]=parseInt(_0x20b20f[_0x03c5('0x43')][_0x4ba813],0xa);}}}_0x39bbb7[_0x03c5('0x3a')][_0x20b20f['id']][_0x03c5('0x45')]();return _0xadce59({'code':0xc8,'message':_0x39bbb7['agents'][_0x20b20f['id']]});}else{return _0x14141b(_0x49561b['error'](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0xc956c){return new Promise(function(_0x4d62ca){var _0x4e4dd8=_[_0x03c5('0x46')](_0x39bbb7[_0x03c5('0x3a')]);if(_0xc956c&&_0xc956c['id']){var _0x9aa7e9=_[_0x03c5('0x47')](_0x4e4dd8,function(_0xb81021){return _0xb81021['id']===_0xc956c['id'];});_0x4d62ca(_0x9aa7e9);}else{_0x4d62ca({'count':_0x4e4dd8[_0x03c5('0x19')],'rows':_0x4e4dd8});}});},'ChatQueues':function(){return new Promise(function(_0x526a15){var _0x54d111=[];for(var _0x4904ae in _0x39bbb7[_0x03c5('0x48')]){if(_0x39bbb7[_0x03c5('0x48')]['hasOwnProperty'](_0x4904ae)){var _0x241374=_0x39bbb7['chatQueues'][_0x4904ae];var _0x470a36={'id':_0x241374['id'],'available':_0x241374[_0x03c5('0x49')],'loggedIn':_0x241374[_0x03c5('0x4a')],'name':_0x241374[_0x03c5('0x4b')],'paused':_0x241374[_0x03c5('0x4c')],'waiting':_0x241374['waiting']};_0x54d111[_0x03c5('0x21')](_0x470a36);}}_0x526a15({'count':_0x54d111['length'],'rows':_0x54d111});});},'MailQueues':function(){return new Promise(function(_0x3e783a){var _0x3ad4cf=[];for(var _0x4b337e in _0x39bbb7[_0x03c5('0x4d')]){if(_0x39bbb7['mailQueues'][_0x03c5('0x42')](_0x4b337e)){var _0xb822f9=_0x39bbb7[_0x03c5('0x4d')][_0x4b337e];var _0x30443c={'id':_0xb822f9['id'],'available':_0xb822f9['available'],'loggedIn':_0xb822f9[_0x03c5('0x4a')],'name':_0xb822f9[_0x03c5('0x4b')],'paused':_0xb822f9[_0x03c5('0x4c')],'waiting':_0xb822f9[_0x03c5('0x4e')]};_0x3ad4cf[_0x03c5('0x21')](_0x30443c);}}_0x3e783a({'count':_0x3ad4cf[_0x03c5('0x19')],'rows':_0x3ad4cf});});},'OpenchannelQueues':function(){return new Promise(function(_0x5217f2){var _0x4a66ad=[];for(var _0x31ac0c in _0x39bbb7[_0x03c5('0x4f')]){if(_0x39bbb7[_0x03c5('0x4f')]['hasOwnProperty'](_0x31ac0c)){var _0x455c6e=_0x39bbb7[_0x03c5('0x4f')][_0x31ac0c];var _0xf23795={'id':_0x455c6e['id'],'available':_0x455c6e['available'],'loggedIn':_0x455c6e['loggedIn'],'name':_0x455c6e[_0x03c5('0x4b')],'paused':_0x455c6e['paused'],'waiting':_0x455c6e[_0x03c5('0x4e')]};_0x4a66ad[_0x03c5('0x21')](_0xf23795);}}_0x5217f2({'count':_0x4a66ad[_0x03c5('0x19')],'rows':_0x4a66ad});});},'SmsQueues':function(){return new Promise(function(_0x122929){var _0x21c978=[];for(var _0x3e1b77 in _0x39bbb7[_0x03c5('0x50')]){if(_0x39bbb7[_0x03c5('0x50')][_0x03c5('0x42')](_0x3e1b77)){var _0x35545e=_0x39bbb7[_0x03c5('0x50')][_0x3e1b77];var _0x4307d1={'id':_0x35545e['id'],'available':_0x35545e[_0x03c5('0x49')],'loggedIn':_0x35545e['loggedIn'],'name':_0x35545e['name'],'paused':_0x35545e['paused'],'waiting':_0x35545e[_0x03c5('0x4e')]};_0x21c978[_0x03c5('0x21')](_0x4307d1);}}_0x122929({'count':_0x21c978[_0x03c5('0x19')],'rows':_0x21c978});});},'FaxQueues':function(){return new Promise(function(_0x31df8e){var _0x202242=[];for(var _0x4ac0f5 in _0x39bbb7[_0x03c5('0x51')]){if(_0x39bbb7[_0x03c5('0x51')][_0x03c5('0x42')](_0x4ac0f5)){var _0x23397b=_0x39bbb7['faxQueues'][_0x4ac0f5];var _0x5ddad9={'id':_0x23397b['id'],'available':_0x23397b[_0x03c5('0x49')],'loggedIn':_0x23397b[_0x03c5('0x4a')],'name':_0x23397b[_0x03c5('0x4b')],'paused':_0x23397b[_0x03c5('0x4c')],'waiting':_0x23397b[_0x03c5('0x4e')]};_0x202242[_0x03c5('0x21')](_0x5ddad9);}}_0x31df8e({'count':_0x202242[_0x03c5('0x19')],'rows':_0x202242});});},'WhatsappQueues':function(){return new Promise(function(_0x3c5694){var _0x34acc7=[];for(var _0x31be8d in _0x39bbb7['whatsappQueues']){if(_0x39bbb7['whatsappQueues'][_0x03c5('0x42')](_0x31be8d)){var _0x450ef6=_0x39bbb7['whatsappQueues'][_0x31be8d];var _0xde47cd={'id':_0x450ef6['id'],'available':_0x450ef6[_0x03c5('0x49')],'loggedIn':_0x450ef6[_0x03c5('0x4a')],'name':_0x450ef6[_0x03c5('0x4b')],'paused':_0x450ef6[_0x03c5('0x4c')],'waiting':_0x450ef6[_0x03c5('0x4e')]};_0x34acc7[_0x03c5('0x21')](_0xde47cd);}}_0x3c5694({'count':_0x34acc7[_0x03c5('0x19')],'rows':_0x34acc7});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x159fd0){var _0x2ecbdf=_[_0x03c5('0x46')](_0x39bbb7[_0x03c5('0x52')]);_0x159fd0({'count':_0x2ecbdf[_0x03c5('0x19')],'rows':_0x2ecbdf});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x61073c){var _0x1fedc0=_[_0x03c5('0x46')](_0x39bbb7[_0x03c5('0x53')]);_0x61073c({'count':_0x1fedc0[_0x03c5('0x19')],'rows':_0x1fedc0});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0xec9bd3){var _0x130c6b=_['values'](_0x39bbb7[_0x03c5('0x54')]);_0xec9bd3({'count':_0x130c6b[_0x03c5('0x19')],'rows':_0x130c6b});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x234d59){var _0x212bc8=_['values'](_0x39bbb7[_0x03c5('0x55')]);_0x234d59({'count':_0x212bc8[_0x03c5('0x19')],'rows':_0x212bc8});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x1cda30){var _0x15b560=_[_0x03c5('0x46')](_0x39bbb7[_0x03c5('0x56')]);_0x1cda30({'count':_0x15b560[_0x03c5('0x19')],'rows':_0x15b560});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x36c366){var _0x49eb66=_[_0x03c5('0x46')](_0x39bbb7[_0x03c5('0x57')]);_0x36c366({'count':_0x49eb66[_0x03c5('0x19')],'rows':_0x49eb66});});}};var _0x2f9dee=jayson[_0x03c5('0x58')](_0x19588f)['http']();_0x2f9dee['on'](_0x03c5('0x31'),function(_0x1c6a75){logger[_0x03c5('0x31')](JSON['stringify'](_0x1c6a75));return _0x4eccd8(_0x1c6a75);});_0x2f9dee[_0x03c5('0x59')](0x232c,'127.0.0.1',function(){console[_0x03c5('0x5a')](_0x03c5('0x5b'),0x232c);return _0x4990c4(_0x03c5('0x5c')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index ec47e2a..7a44a31 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 _0x384d=['[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s','lodash','iftime','routing','condition','rules','info','stop','map','some','[%s][INTERVAL\x20VALID]\x20%s\x20%s','join','\x20|\x20','when'];(function(_0x10921d,_0x242a14){var _0x163ca1=function(_0x3429b2){while(--_0x3429b2){_0x10921d['push'](_0x10921d['shift']());}};_0x163ca1(++_0x242a14);}(_0x384d,0x7f));var _0xd384=function(_0x24e3f7,_0x318e1c){_0x24e3f7=_0x24e3f7-0x0;var _0x3dc1b4=_0x384d[_0x24e3f7];return _0x3dc1b4;};'use strict';var _=require(_0xd384('0x0'));var iftime=require('../../../utils/iftime')[_0xd384('0x1')];var logger=require('../../../config/logger')(_0xd384('0x2'));exports[_0xd384('0x3')]=function(_0x15efe8,_0x33a47b,_0x2b7bb0){return function(_0x41f8b8){if(_0x2b7bb0[_0xd384('0x4')]&&!_0x2b7bb0[_0xd384('0x4')][_0x15efe8]){logger[_0xd384('0x5')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x15efe8);return _0x41f8b8[_0xd384('0x6')]();}var _0x3e7cdd=_0x33a47b[_0xd384('0x7')](function(_0x54e193){return iftime(_0x54e193);});var _0x341a93=_[_0xd384('0x8')](_0x3e7cdd);if(_0x341a93){logger[_0xd384('0x5')](_0xd384('0x9'),_0x15efe8,_0x33a47b[_0xd384('0xa')](_0xd384('0xb')),_0x341a93);_0x41f8b8[_0xd384('0xc')](_0x341a93);}else{logger[_0xd384('0x5')](_0xd384('0xd'),_0x15efe8,_0x33a47b[_0xd384('0xa')](_0xd384('0xb')));_0x41f8b8[_0xd384('0x6')]();}};}; \ No newline at end of file +var _0x2b88=['../../../config/logger','routing','condition','rules','info','stop','map','some','[%s][INTERVAL\x20VALID]\x20%s\x20%s','join','when','[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s','\x20|\x20','lodash','../../../utils/iftime'];(function(_0x58473a,_0x207a8b){var _0x3f0ebc=function(_0x26c308){while(--_0x26c308){_0x58473a['push'](_0x58473a['shift']());}};_0x3f0ebc(++_0x207a8b);}(_0x2b88,0x1ed));var _0x82b8=function(_0x13fcaf,_0x416c69){_0x13fcaf=_0x13fcaf-0x0;var _0x4fa631=_0x2b88[_0x13fcaf];return _0x4fa631;};'use strict';var _=require(_0x82b8('0x0'));var iftime=require(_0x82b8('0x1'))['iftime'];var logger=require(_0x82b8('0x2'))(_0x82b8('0x3'));exports[_0x82b8('0x4')]=function(_0xfb3b8f,_0x370f0a,_0x330f48){return function(_0x27a0b5){if(_0x330f48['rules']&&!_0x330f48[_0x82b8('0x5')][_0xfb3b8f]){logger[_0x82b8('0x6')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0xfb3b8f);return _0x27a0b5[_0x82b8('0x7')]();}var _0x34f76c=_0x370f0a[_0x82b8('0x8')](function(_0x1b79c3){return iftime(_0x1b79c3);});var _0x3a96d1=_[_0x82b8('0x9')](_0x34f76c);if(_0x3a96d1){logger[_0x82b8('0x6')](_0x82b8('0xa'),_0xfb3b8f,_0x370f0a[_0x82b8('0xb')]('\x20|\x20'),_0x3a96d1);_0x27a0b5[_0x82b8('0xc')](_0x3a96d1);}else{logger[_0x82b8('0x6')](_0x82b8('0xd'),_0xfb3b8f,_0x370f0a[_0x82b8('0xb')](_0x82b8('0xe')));_0x27a0b5[_0x82b8('0x7')]();}};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 66f092d..97d05da 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 _0x702d=['error','[%s][agents][agentringnoanswer]','agentringnoanswer','agentringnoanswerAt','now','timeout','reason','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','transferexten','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfererexten','transferuniqueid','transfertargetuniqueid','clone','calleridname','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','lodash','util','./utils','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','called','connectedlinename','info'];(function(_0x5095da,_0x4b42dc){var _0x4df9f6=function(_0x167840){while(--_0x167840){_0x5095da['push'](_0x5095da['shift']());}};_0x4df9f6(++_0x4b42dc);}(_0x702d,0x147));var _0xd702=function(_0x354c8b,_0x299f92){_0x354c8b=_0x354c8b-0x0;var _0x3b4f2e=_0x702d[_0x354c8b];return _0x3b4f2e;};'use strict';var _=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var utils=require(_0xd702('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x33e7c5,_0x37ed5c){utils['info'](util[_0xd702('0x3')](_0xd702('0x4'),_0x33e7c5[_0xd702('0x5')],_0x33e7c5[_0xd702('0x6')],_0x33e7c5['queue'],_0x33e7c5[_0xd702('0x7')],_0x33e7c5['interface'],_0x33e7c5[_0xd702('0x8')],_0x33e7c5[_0xd702('0x9')],_0x33e7c5[_0xd702('0xa')]));if(_0x33e7c5['queue']){utils[_0xd702('0xb')](_0x33e7c5['queue'])[_0xd702('0xc')](function(_0x25423f){if(_0x25423f){_0x33e7c5[_0xd702('0xd')]=_0x25423f[_0xd702('0xd')];_0x33e7c5[_0xd702('0xe')]=_0x33e7c5[_0xd702('0xf')]?_0x25423f[_0xd702('0x10')]:![];_0x33e7c5[_0xd702('0x11')]=_0x33e7c5[_0xd702('0xe')]?_0x25423f[_0xd702('0x12')]:0x0;}utils['request']('CreateVoiceAgentReport',_0x33e7c5);});}else{utils[_0xd702('0x13')](_0xd702('0x14'),_0x33e7c5);}if(_0x37ed5c){delete transfers[_0x33e7c5[_0xd702('0x5')]];}else{delete agents[_0x33e7c5['destuniqueid']];}}exports[_0xd702('0x15')]=function(_0x128add){try{utils[_0xd702('0x16')](util[_0xd702('0x3')](_0xd702('0x17'),_0x128add[_0xd702('0x5')]),_0x128add);agents[_0x128add['destuniqueid']]=_0x128add;agents[_0x128add[_0xd702('0x18')]][_0xd702('0x19')]=utils['now']();agents[_0x128add[_0xd702('0x18')]]['lastevent']=_0xd702('0x1a');agents[_0x128add[_0xd702('0x18')]]['connectedlinenum']=null;agents[_0x128add[_0xd702('0x18')]][_0xd702('0x1b')]=null;utils[_0xd702('0x1c')](util['format']('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x128add[_0xd702('0x5')],agents[_0x128add['destuniqueid']][_0xd702('0x7')],_0x128add[_0xd702('0x18')]));}catch(_0x37267c){utils[_0xd702('0x1d')](util[_0xd702('0x3')](_0xd702('0x17'),_0x128add[_0xd702('0x5')]),_0x37267c);}};exports['agentringnoanswer']=function(_0x4be140){try{if(!_['isNil'](agents[_0x4be140[_0xd702('0x18')]])){utils[_0xd702('0x16')](util['format'](_0xd702('0x1e'),_0x4be140['uniqueid']),_0x4be140);utils[_0xd702('0x1c')](util['format']('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x4be140['uniqueid'],agents[_0x4be140[_0xd702('0x18')]][_0xd702('0x7')],_0x4be140[_0xd702('0x18')]));agents[_0x4be140['destuniqueid']][_0xd702('0x1f')]=!![];agents[_0x4be140[_0xd702('0x18')]][_0xd702('0x20')]=utils[_0xd702('0x21')]();agents[_0x4be140[_0xd702('0x18')]][_0xd702('0xa')]=_0xd702('0x22');agents[_0x4be140[_0xd702('0x18')]][_0xd702('0x23')]='timeout';agents[_0x4be140[_0xd702('0x18')]][_0xd702('0x24')]=_0x4be140[_0xd702('0x25')]?parseInt(_0x4be140[_0xd702('0x25')])/0x3e8:0x0;agents[_0x4be140[_0xd702('0x18')]][_0xd702('0x26')]=0x0;unanswered[_0xd702('0x27')](_0x4be140[_0xd702('0x18')]);}}catch(_0x5f1084){utils['error'](util[_0xd702('0x3')](_0xd702('0x1e'),_0x4be140['uniqueid']),_0x5f1084);}};exports[_0xd702('0x28')]=function(_0xee8bf1){try{_[_0xd702('0x29')](agents,function(_0x2946ae,_0x56e9cd){if(_0x2946ae[_0xd702('0x5')]==_0xee8bf1[_0xd702('0x5')]&&!_[_0xd702('0x2a')](unanswered,_0x2946ae[_0xd702('0x18')])){utils[_0xd702('0x16')](util['format'](_0xd702('0x2b'),_0xee8bf1[_0xd702('0x5')]),_0xee8bf1);utils[_0xd702('0x1c')](util['format'](_0xd702('0x2c'),_0xee8bf1['uniqueid'],_0x2946ae['membername'],_0x2946ae[_0xd702('0x18')]));_0x2946ae[_0xd702('0x1f')]=!![];_0x2946ae[_0xd702('0x20')]=utils['now']();_0x2946ae[_0xd702('0xa')]=_0xd702('0x2d');_0x2946ae['reason']=_0xd702('0x2d');_0x2946ae[_0xd702('0x24')]=_0xee8bf1[_0xd702('0x24')];_0x2946ae[_0xd702('0x26')]=0x0;writeDB(_0x2946ae);}});}catch(_0xa6b40a){utils[_0xd702('0x1d')](util[_0xd702('0x3')](_0xd702('0x2b'),_0xee8bf1[_0xd702('0x5')]),_0xa6b40a);}};exports[_0xd702('0x2e')]=function(_0x9f458b){try{if(agents[_0x9f458b[_0xd702('0x18')]]){utils[_0xd702('0x16')](util['format'](_0xd702('0x2f'),_0x9f458b[_0xd702('0x5')]),_0x9f458b);utils[_0xd702('0x1c')](util[_0xd702('0x3')](_0xd702('0x30'),_0x9f458b[_0xd702('0x5')],agents[_0x9f458b[_0xd702('0x18')]]['membername'],_0x9f458b['destuniqueid']));agents[_0x9f458b[_0xd702('0x18')]][_0xd702('0x31')]=utils['now']();agents[_0x9f458b['destuniqueid']][_0xd702('0x9')]=_0x9f458b[_0xd702('0x9')];agents[_0x9f458b['destuniqueid']][_0xd702('0x1b')]=_0x9f458b[_0xd702('0x1b')];agents[_0x9f458b[_0xd702('0x18')]]['holdtime']=_0x9f458b[_0xd702('0x25')];agents[_0x9f458b[_0xd702('0x18')]][_0xd702('0xa')]='connect';_[_0xd702('0x29')](agents,function(_0x512854,_0x359bbd){if(_0x512854[_0xd702('0x18')]!=_0x9f458b[_0xd702('0x18')]&&_0x512854[_0xd702('0x5')]==_0x9f458b[_0xd702('0x5')]){_0x512854[_0xd702('0x26')]=0x0;_0x512854[_0xd702('0x24')]=_0x9f458b[_0xd702('0x25')];_0x512854['agentringnoanswer']=!![];_0x512854[_0xd702('0x20')]=utils[_0xd702('0x21')]();_0x512854[_0xd702('0xa')]=_0xd702('0x32');_0x512854[_0xd702('0x23')]='answered_elsewhere';_0x512854[_0xd702('0x33')]=_0x9f458b[_0xd702('0x18')];_0x512854[_0xd702('0x34')]=_0x9f458b['membername'];writeDB(_0x512854);}});}}catch(_0xd48ad0){utils[_0xd702('0x1d')](util[_0xd702('0x3')](_0xd702('0x2f'),_0x9f458b['uniqueid']),_0xd48ad0);}};exports[_0xd702('0xf')]=function(_0xfa5e9){try{if(!_[_0xd702('0x35')](agents[_0xfa5e9[_0xd702('0x18')]])){utils[_0xd702('0x16')](util['format'](_0xd702('0x36'),_0xfa5e9[_0xd702('0x5')]),_0xfa5e9);utils['info'](util['format'](_0xd702('0x37'),_0xfa5e9[_0xd702('0x5')],agents[_0xfa5e9[_0xd702('0x18')]][_0xd702('0x7')],_0xfa5e9[_0xd702('0x18')]));agents[_0xfa5e9[_0xd702('0x18')]][_0xd702('0xf')]=!![];agents[_0xfa5e9[_0xd702('0x18')]][_0xd702('0x38')]=utils['now']();agents[_0xfa5e9['destuniqueid']][_0xd702('0x26')]=utils['diffTime'](agents[_0xfa5e9[_0xd702('0x18')]]['agentcompleteAt'],agents[_0xfa5e9[_0xd702('0x18')]]['agentconnectAt']);agents[_0xfa5e9[_0xd702('0x18')]]['reason']=_0xfa5e9[_0xd702('0x23')];agents[_0xfa5e9[_0xd702('0x18')]]['lastevent']=_0xd702('0x39');writeDB(agents[_0xfa5e9[_0xd702('0x18')]]);}}catch(_0x2c0528){utils[_0xd702('0x1d')](util[_0xd702('0x3')]('[%s][agents][agentcomplete]',_0xfa5e9[_0xd702('0x5')]),_0x2c0528);}};exports[_0xd702('0x3a')]=function(_0x2d09be){try{if(!_['isNil'](agents[_0x2d09be[_0xd702('0x3b')]])){utils['debug'](util[_0xd702('0x3')](_0xd702('0x3c'),_0x2d09be[_0xd702('0x5')]),_0x2d09be);utils['info'](util['format'](_0xd702('0x3d'),_0x2d09be[_0xd702('0x5')],agents[_0x2d09be[_0xd702('0x3b')]][_0xd702('0x7')],agents[_0x2d09be[_0xd702('0x3b')]][_0xd702('0x5')]));agents[_0x2d09be[_0xd702('0x3b')]][_0xd702('0x3e')]=!![];agents[_0x2d09be[_0xd702('0x3b')]][_0xd702('0x3f')]='blind';agents[_0x2d09be['transfereruniqueid']][_0xd702('0x40')]=_0x2d09be[_0xd702('0x41')];agents[_0x2d09be[_0xd702('0x3b')]]['transferuniqueid']=agents[_0x2d09be['transfereruniqueid']][_0xd702('0x5')];}}catch(_0x54c7e2){utils[_0xd702('0x1d')](util[_0xd702('0x3')](_0xd702('0x3c'),_0x2d09be[_0xd702('0x5')]),_0x54c7e2);}};exports[_0xd702('0x42')]=function(_0x3cd4c1){try{utils[_0xd702('0x16')](util[_0xd702('0x3')](_0xd702('0x43'),_0x3cd4c1['origtransfereruniqueid']),_0x3cd4c1);if(_0x3cd4c1[_0xd702('0x44')]==_0x3cd4c1[_0xd702('0x45')]){if(!_[_0xd702('0x35')](agents[_0x3cd4c1[_0xd702('0x46')]])){utils['info'](util[_0xd702('0x3')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x3cd4c1[_0xd702('0x44')],agents[_0x3cd4c1['secondtransfereruniqueid']]['membername']));agents[_0x3cd4c1[_0xd702('0x46')]][_0xd702('0x3e')]=!![];agents[_0x3cd4c1[_0xd702('0x46')]][_0xd702('0x3f')]=_0xd702('0x47');agents[_0x3cd4c1[_0xd702('0x46')]]['transferexten']=_0x3cd4c1[_0xd702('0x48')];agents[_0x3cd4c1[_0xd702('0x46')]]['transferuniqueid']=_0x3cd4c1[_0xd702('0x44')];}if(_0x3cd4c1[_0xd702('0x49')]&&agents[_0x3cd4c1[_0xd702('0x49')]]){agents[_0x3cd4c1[_0xd702('0x49')]][_0xd702('0x4a')]=0x1;transfers[_0x3cd4c1[_0xd702('0x49')]]=_['clone'](agents[_0x3cd4c1[_0xd702('0x49')]]);transfers[_0x3cd4c1[_0xd702('0x49')]][_0xd702('0x8')]=agents[_0x3cd4c1[_0xd702('0x46')]][_0xd702('0x8')];transfers[_0x3cd4c1['transfereeuniqueid']]['calleridname']=agents[_0x3cd4c1[_0xd702('0x46')]]['calleridname'];transfers[_0x3cd4c1['transfereeuniqueid']][_0xd702('0x19')]=utils['now']();transfers[_0x3cd4c1[_0xd702('0x49')]][_0xd702('0x31')]=utils[_0xd702('0x21')]();transfers[_0x3cd4c1[_0xd702('0x49')]]['holdtime']=0x0;transfers[_0x3cd4c1[_0xd702('0x49')]]['agententerreason']=0x2;}}else if(_0x3cd4c1[_0xd702('0x46')]==_0x3cd4c1['secondtransfererlinkedid']){if(!_[_0xd702('0x35')](agents[_0x3cd4c1[_0xd702('0x44')]])){utils[_0xd702('0x1c')](util[_0xd702('0x3')](_0xd702('0x4b'),_0x3cd4c1[_0xd702('0x44')],agents[_0x3cd4c1[_0xd702('0x44')]]['membername']));agents[_0x3cd4c1['origtransfereruniqueid']][_0xd702('0x3e')]=!![];agents[_0x3cd4c1['origtransfereruniqueid']][_0xd702('0x3f')]=_0xd702('0x47');agents[_0x3cd4c1['origtransfereruniqueid']][_0xd702('0x40')]=_0x3cd4c1[_0xd702('0x4c')];agents[_0x3cd4c1['origtransfereruniqueid']][_0xd702('0x4d')]=_0x3cd4c1['secondtransfereruniqueid'];}if(_0x3cd4c1[_0xd702('0x4e')]&&agents[_0x3cd4c1[_0xd702('0x4e')]]){agents[_0x3cd4c1[_0xd702('0x4e')]][_0xd702('0x4a')]=0x1;transfers[_0x3cd4c1['transfertargetuniqueid']]=_[_0xd702('0x4f')](agents[_0x3cd4c1[_0xd702('0x4e')]]);transfers[_0x3cd4c1[_0xd702('0x4e')]][_0xd702('0x8')]=agents[_0x3cd4c1[_0xd702('0x44')]]['calleridnum'];transfers[_0x3cd4c1[_0xd702('0x4e')]][_0xd702('0x50')]=agents[_0x3cd4c1[_0xd702('0x44')]][_0xd702('0x50')];transfers[_0x3cd4c1[_0xd702('0x4e')]][_0xd702('0x19')]=utils['now']();transfers[_0x3cd4c1[_0xd702('0x4e')]]['agentconnectAt']=utils[_0xd702('0x21')]();transfers[_0x3cd4c1[_0xd702('0x4e')]][_0xd702('0x24')]=0x0;transfers[_0x3cd4c1[_0xd702('0x4e')]]['agententerreason']=0x2;}}}catch(_0x3e99ff){utils[_0xd702('0x1d')](util[_0xd702('0x3')](_0xd702('0x43'),_0x3cd4c1[_0xd702('0x44')]),_0x3e99ff);}};exports['hangup']=function(_0x5bc3dd){try{utils[_0xd702('0x16')](util[_0xd702('0x3')](_0xd702('0x51'),_0x5bc3dd[_0xd702('0x5')]),_0x5bc3dd);if(agents[_0x5bc3dd[_0xd702('0x5')]]&&agents[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x23')]===_0xd702('0x22')){if(_0x5bc3dd[_0xd702('0x52')]==='21'){agents[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x23')]=_0xd702('0x53');agents[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0xa')]=_0xd702('0x53');}utils[_0xd702('0x1c')](util['format'](_0xd702('0x54'),_0x5bc3dd['uniqueid'],agents[_0x5bc3dd['uniqueid']][_0xd702('0x7')],agents[_0x5bc3dd['uniqueid']][_0xd702('0x23')],agents[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0xa')]));writeDB(agents[_0x5bc3dd[_0xd702('0x5')]]);var _0x472e5a=unanswered[_0xd702('0x55')](_0x5bc3dd[_0xd702('0x5')]);if(_0x472e5a>-0x1){unanswered[_0xd702('0x56')](_0x472e5a,0x1);}}if(transfers[_0x5bc3dd[_0xd702('0x5')]]){transfers[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0xf')]=!![];transfers[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x38')]=utils[_0xd702('0x21')]();transfers[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x26')]=utils[_0xd702('0x57')](transfers[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x38')],transfers[_0x5bc3dd['uniqueid']][_0xd702('0x31')]);transfers[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x23')]=_0xd702('0x58');transfers[_0x5bc3dd[_0xd702('0x5')]]['lastevent']=_0xd702('0x39');utils[_0xd702('0x1c')](util['format'](_0xd702('0x54'),_0x5bc3dd[_0xd702('0x5')],transfers[_0x5bc3dd[_0xd702('0x5')]]['membername'],transfers[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x23')],transfers[_0x5bc3dd['uniqueid']][_0xd702('0xa')]));writeDB(transfers[_0x5bc3dd[_0xd702('0x5')]],!![]);}if(agents[_0x5bc3dd[_0xd702('0x5')]]&&agents[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x31')]){agents[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0xf')]=!![];agents[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x38')]=utils[_0xd702('0x21')]();agents[_0x5bc3dd[_0xd702('0x5')]]['talktime']=utils[_0xd702('0x57')](agents[_0x5bc3dd[_0xd702('0x5')]]['agentcompleteAt'],agents[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x31')]);agents[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x23')]=agents[_0x5bc3dd[_0xd702('0x5')]]['transfer']?'transfer':_0xd702('0x58');agents[_0x5bc3dd['uniqueid']][_0xd702('0xa')]=_0xd702('0x39');utils[_0xd702('0x1c')](util[_0xd702('0x3')](_0xd702('0x54'),_0x5bc3dd['uniqueid'],agents[_0x5bc3dd[_0xd702('0x5')]]['membername'],agents[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x23')],agents[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0xa')]));writeDB(agents[_0x5bc3dd[_0xd702('0x5')]]);}}catch(_0x1ea077){utils['error'](util['format'](_0xd702('0x51'),_0x5bc3dd[_0xd702('0x5')]),_0x1ea077);}}; \ No newline at end of file +var _0xf45e=['secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfererexten','transferuniqueid','transfereeuniqueid','clone','calleridname','agentcalledAt','ATTENDED','transfertargetuniqueid','agententerreason','hangup','[%s][agents][hangup]','cause','rejected','indexOf','splice','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','lodash','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentcomplete','acw','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','agentringnoanswer','debug','[%s][agents][agentringnoanswer]','agentringnoanswerAt','timeout','ringtime','includes','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','talktime','agentconnect','[%s][agents][agentconnect]','agentconnectAt','now','connectedlinename','answered_elsewhere','reason','answeredelsewheremembername','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','[%s][agents][blindtransfer]','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xf45e,0x115));var _0xef45=function(_0x302a9e,_0x5df184){_0x302a9e=_0x302a9e-0x0;var _0x40a690=_0xf45e[_0x302a9e];return _0x40a690;};'use strict';var _=require(_0xef45('0x0'));var util=require('util');var utils=require(_0xef45('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x5762da,_0x17b897){utils[_0xef45('0x2')](util[_0xef45('0x3')](_0xef45('0x4'),_0x5762da[_0xef45('0x5')],_0x5762da[_0xef45('0x6')],_0x5762da[_0xef45('0x7')],_0x5762da[_0xef45('0x8')],_0x5762da[_0xef45('0x9')],_0x5762da[_0xef45('0xa')],_0x5762da[_0xef45('0xb')],_0x5762da[_0xef45('0xc')]));if(_0x5762da[_0xef45('0x7')]){utils[_0xef45('0xd')](_0x5762da[_0xef45('0x7')])[_0xef45('0xe')](function(_0x134c86){if(_0x134c86){_0x5762da[_0xef45('0xf')]=_0x134c86[_0xef45('0xf')];_0x5762da['agentacw']=_0x5762da[_0xef45('0x10')]?_0x134c86[_0xef45('0x11')]:![];_0x5762da[_0xef45('0x12')]=_0x5762da[_0xef45('0x13')]?_0x134c86[_0xef45('0x14')]:0x0;}utils[_0xef45('0x15')]('CreateVoiceAgentReport',_0x5762da);});}else{utils[_0xef45('0x15')](_0xef45('0x16'),_0x5762da);}if(_0x17b897){delete transfers[_0x5762da[_0xef45('0x5')]];}else{delete agents[_0x5762da[_0xef45('0x17')]];}}exports[_0xef45('0x18')]=function(_0x4a6e5c){try{utils['debug'](util[_0xef45('0x3')]('[%s][agents][agentcalled]',_0x4a6e5c[_0xef45('0x5')]),_0x4a6e5c);agents[_0x4a6e5c[_0xef45('0x17')]]=_0x4a6e5c;agents[_0x4a6e5c[_0xef45('0x17')]]['agentcalledAt']=utils['now']();agents[_0x4a6e5c[_0xef45('0x17')]]['lastevent']=_0xef45('0x19');agents[_0x4a6e5c[_0xef45('0x17')]][_0xef45('0xb')]=null;agents[_0x4a6e5c[_0xef45('0x17')]]['connectedlinename']=null;utils['info'](util[_0xef45('0x3')](_0xef45('0x1a'),_0x4a6e5c[_0xef45('0x5')],agents[_0x4a6e5c[_0xef45('0x17')]]['membername'],_0x4a6e5c['destuniqueid']));}catch(_0x2c57fc){utils[_0xef45('0x1b')](util[_0xef45('0x3')](_0xef45('0x1c'),_0x4a6e5c[_0xef45('0x5')]),_0x2c57fc);}};exports[_0xef45('0x1d')]=function(_0x375cbd){try{if(!_['isNil'](agents[_0x375cbd[_0xef45('0x17')]])){utils[_0xef45('0x1e')](util[_0xef45('0x3')](_0xef45('0x1f'),_0x375cbd[_0xef45('0x5')]),_0x375cbd);utils['info'](util[_0xef45('0x3')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x375cbd['uniqueid'],agents[_0x375cbd[_0xef45('0x17')]][_0xef45('0x8')],_0x375cbd[_0xef45('0x17')]));agents[_0x375cbd[_0xef45('0x17')]][_0xef45('0x1d')]=!![];agents[_0x375cbd[_0xef45('0x17')]][_0xef45('0x20')]=utils['now']();agents[_0x375cbd[_0xef45('0x17')]]['lastevent']=_0xef45('0x21');agents[_0x375cbd[_0xef45('0x17')]]['reason']=_0xef45('0x21');agents[_0x375cbd[_0xef45('0x17')]]['holdtime']=_0x375cbd[_0xef45('0x22')]?parseInt(_0x375cbd['ringtime'])/0x3e8:0x0;agents[_0x375cbd['destuniqueid']]['talktime']=0x0;unanswered['push'](_0x375cbd[_0xef45('0x17')]);}}catch(_0x2f72ef){utils[_0xef45('0x1b')](util[_0xef45('0x3')]('[%s][agents][agentringnoanswer]',_0x375cbd[_0xef45('0x5')]),_0x2f72ef);}};exports['queuecallerabandon']=function(_0x2525da){try{_['forIn'](agents,function(_0x3e6922,_0x5bfd2d){if(_0x3e6922['uniqueid']==_0x2525da[_0xef45('0x5')]&&!_[_0xef45('0x23')](unanswered,_0x3e6922[_0xef45('0x17')])){utils[_0xef45('0x1e')](util[_0xef45('0x3')]('[%s][agents][queuecallerabandon]',_0x2525da['uniqueid']),_0x2525da);utils['info'](util[_0xef45('0x3')](_0xef45('0x24'),_0x2525da[_0xef45('0x5')],_0x3e6922[_0xef45('0x8')],_0x3e6922[_0xef45('0x17')]));_0x3e6922[_0xef45('0x1d')]=!![];_0x3e6922[_0xef45('0x20')]=utils['now']();_0x3e6922['lastevent']=_0xef45('0x25');_0x3e6922['reason']=_0xef45('0x25');_0x3e6922['holdtime']=_0x2525da[_0xef45('0x26')];_0x3e6922[_0xef45('0x27')]=0x0;writeDB(_0x3e6922);}});}catch(_0x2a7c53){utils[_0xef45('0x1b')](util[_0xef45('0x3')]('[%s][agents][queuecallerabandon]',_0x2525da[_0xef45('0x5')]),_0x2a7c53);}};exports[_0xef45('0x28')]=function(_0x9df07e){try{if(agents[_0x9df07e['destuniqueid']]){utils['debug'](util[_0xef45('0x3')](_0xef45('0x29'),_0x9df07e['uniqueid']),_0x9df07e);utils[_0xef45('0x2')](util['format']('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x9df07e[_0xef45('0x5')],agents[_0x9df07e[_0xef45('0x17')]][_0xef45('0x8')],_0x9df07e['destuniqueid']));agents[_0x9df07e[_0xef45('0x17')]][_0xef45('0x2a')]=utils[_0xef45('0x2b')]();agents[_0x9df07e[_0xef45('0x17')]]['connectedlinenum']=_0x9df07e['connectedlinenum'];agents[_0x9df07e[_0xef45('0x17')]][_0xef45('0x2c')]=_0x9df07e[_0xef45('0x2c')];agents[_0x9df07e[_0xef45('0x17')]][_0xef45('0x26')]=_0x9df07e[_0xef45('0x22')];agents[_0x9df07e[_0xef45('0x17')]][_0xef45('0xc')]='connect';_['forIn'](agents,function(_0x13f8b2,_0x35d014){if(_0x13f8b2[_0xef45('0x17')]!=_0x9df07e[_0xef45('0x17')]&&_0x13f8b2[_0xef45('0x5')]==_0x9df07e[_0xef45('0x5')]){_0x13f8b2[_0xef45('0x27')]=0x0;_0x13f8b2[_0xef45('0x26')]=_0x9df07e[_0xef45('0x22')];_0x13f8b2[_0xef45('0x1d')]=!![];_0x13f8b2[_0xef45('0x20')]=utils[_0xef45('0x2b')]();_0x13f8b2[_0xef45('0xc')]=_0xef45('0x2d');_0x13f8b2[_0xef45('0x2e')]=_0xef45('0x2d');_0x13f8b2['answeredelsewheredestinationuniqueid']=_0x9df07e[_0xef45('0x17')];_0x13f8b2[_0xef45('0x2f')]=_0x9df07e[_0xef45('0x8')];writeDB(_0x13f8b2);}});}}catch(_0x82c123){utils['error'](util[_0xef45('0x3')]('[%s][agents][agentconnect]',_0x9df07e[_0xef45('0x5')]),_0x82c123);}};exports['agentcomplete']=function(_0x5faf67){try{if(!_[_0xef45('0x30')](agents[_0x5faf67[_0xef45('0x17')]])){utils[_0xef45('0x1e')](util[_0xef45('0x3')](_0xef45('0x31'),_0x5faf67[_0xef45('0x5')]),_0x5faf67);utils['info'](util[_0xef45('0x3')](_0xef45('0x32'),_0x5faf67[_0xef45('0x5')],agents[_0x5faf67[_0xef45('0x17')]][_0xef45('0x8')],_0x5faf67[_0xef45('0x17')]));agents[_0x5faf67[_0xef45('0x17')]][_0xef45('0x10')]=!![];agents[_0x5faf67[_0xef45('0x17')]][_0xef45('0x33')]=utils[_0xef45('0x2b')]();agents[_0x5faf67[_0xef45('0x17')]][_0xef45('0x27')]=utils[_0xef45('0x34')](agents[_0x5faf67[_0xef45('0x17')]]['agentcompleteAt'],agents[_0x5faf67[_0xef45('0x17')]][_0xef45('0x2a')]);agents[_0x5faf67[_0xef45('0x17')]]['reason']=_0x5faf67['reason'];agents[_0x5faf67['destuniqueid']][_0xef45('0xc')]=_0xef45('0x35');writeDB(agents[_0x5faf67[_0xef45('0x17')]]);}}catch(_0x34e9d5){utils[_0xef45('0x1b')](util[_0xef45('0x3')]('[%s][agents][agentcomplete]',_0x5faf67[_0xef45('0x5')]),_0x34e9d5);}};exports[_0xef45('0x36')]=function(_0x2b2419){try{if(!_['isNil'](agents[_0x2b2419['transfereruniqueid']])){utils[_0xef45('0x1e')](util[_0xef45('0x3')]('[%s][agents][blindtransfer]',_0x2b2419[_0xef45('0x5')]),_0x2b2419);utils[_0xef45('0x2')](util[_0xef45('0x3')](_0xef45('0x37'),_0x2b2419[_0xef45('0x5')],agents[_0x2b2419[_0xef45('0x38')]][_0xef45('0x8')],agents[_0x2b2419[_0xef45('0x38')]][_0xef45('0x5')]));agents[_0x2b2419[_0xef45('0x38')]][_0xef45('0x39')]=!![];agents[_0x2b2419[_0xef45('0x38')]][_0xef45('0x3a')]=_0xef45('0x3b');agents[_0x2b2419['transfereruniqueid']][_0xef45('0x3c')]=_0x2b2419[_0xef45('0x3d')];agents[_0x2b2419[_0xef45('0x38')]]['transferuniqueid']=agents[_0x2b2419[_0xef45('0x38')]][_0xef45('0x5')];}}catch(_0x464bda){utils[_0xef45('0x1b')](util['format'](_0xef45('0x3e'),_0x2b2419[_0xef45('0x5')]),_0x464bda);}};exports[_0xef45('0x3f')]=function(_0x310105){try{utils[_0xef45('0x1e')](util[_0xef45('0x3')](_0xef45('0x40'),_0x310105[_0xef45('0x41')]),_0x310105);if(_0x310105[_0xef45('0x41')]==_0x310105[_0xef45('0x42')]){if(!_[_0xef45('0x30')](agents[_0x310105[_0xef45('0x43')]])){utils['info'](util[_0xef45('0x3')](_0xef45('0x44'),_0x310105[_0xef45('0x41')],agents[_0x310105[_0xef45('0x43')]][_0xef45('0x8')]));agents[_0x310105[_0xef45('0x43')]]['transfer']=!![];agents[_0x310105['secondtransfereruniqueid']][_0xef45('0x3a')]='ATTENDED';agents[_0x310105[_0xef45('0x43')]][_0xef45('0x3c')]=_0x310105[_0xef45('0x45')];agents[_0x310105['secondtransfereruniqueid']][_0xef45('0x46')]=_0x310105[_0xef45('0x41')];}if(_0x310105['transfereeuniqueid']&&agents[_0x310105[_0xef45('0x47')]]){agents[_0x310105['transfereeuniqueid']]['agententerreason']=0x1;transfers[_0x310105[_0xef45('0x47')]]=_[_0xef45('0x48')](agents[_0x310105[_0xef45('0x47')]]);transfers[_0x310105[_0xef45('0x47')]][_0xef45('0xa')]=agents[_0x310105['secondtransfereruniqueid']][_0xef45('0xa')];transfers[_0x310105[_0xef45('0x47')]]['calleridname']=agents[_0x310105[_0xef45('0x43')]][_0xef45('0x49')];transfers[_0x310105[_0xef45('0x47')]][_0xef45('0x4a')]=utils[_0xef45('0x2b')]();transfers[_0x310105[_0xef45('0x47')]][_0xef45('0x2a')]=utils[_0xef45('0x2b')]();transfers[_0x310105['transfereeuniqueid']][_0xef45('0x26')]=0x0;transfers[_0x310105['transfereeuniqueid']]['agententerreason']=0x2;}}else if(_0x310105[_0xef45('0x43')]==_0x310105['secondtransfererlinkedid']){if(!_[_0xef45('0x30')](agents[_0x310105[_0xef45('0x41')]])){utils['info'](util[_0xef45('0x3')](_0xef45('0x44'),_0x310105[_0xef45('0x41')],agents[_0x310105[_0xef45('0x41')]][_0xef45('0x8')]));agents[_0x310105[_0xef45('0x41')]]['transfer']=!![];agents[_0x310105[_0xef45('0x41')]][_0xef45('0x3a')]=_0xef45('0x4b');agents[_0x310105[_0xef45('0x41')]][_0xef45('0x3c')]=_0x310105['secondtransfererexten'];agents[_0x310105[_0xef45('0x41')]]['transferuniqueid']=_0x310105[_0xef45('0x43')];}if(_0x310105[_0xef45('0x4c')]&&agents[_0x310105['transfertargetuniqueid']]){agents[_0x310105[_0xef45('0x4c')]][_0xef45('0x4d')]=0x1;transfers[_0x310105[_0xef45('0x4c')]]=_['clone'](agents[_0x310105['transfertargetuniqueid']]);transfers[_0x310105[_0xef45('0x4c')]][_0xef45('0xa')]=agents[_0x310105[_0xef45('0x41')]]['calleridnum'];transfers[_0x310105[_0xef45('0x4c')]][_0xef45('0x49')]=agents[_0x310105['origtransfereruniqueid']][_0xef45('0x49')];transfers[_0x310105['transfertargetuniqueid']][_0xef45('0x4a')]=utils[_0xef45('0x2b')]();transfers[_0x310105[_0xef45('0x4c')]][_0xef45('0x2a')]=utils[_0xef45('0x2b')]();transfers[_0x310105[_0xef45('0x4c')]][_0xef45('0x26')]=0x0;transfers[_0x310105[_0xef45('0x4c')]]['agententerreason']=0x2;}}}catch(_0x3e6b06){utils[_0xef45('0x1b')](util[_0xef45('0x3')](_0xef45('0x40'),_0x310105[_0xef45('0x41')]),_0x3e6b06);}};exports[_0xef45('0x4e')]=function(_0xef7b79){try{utils[_0xef45('0x1e')](util[_0xef45('0x3')](_0xef45('0x4f'),_0xef7b79[_0xef45('0x5')]),_0xef7b79);if(agents[_0xef7b79['uniqueid']]&&agents[_0xef7b79[_0xef45('0x5')]][_0xef45('0x2e')]===_0xef45('0x21')){if(_0xef7b79[_0xef45('0x50')]==='21'){agents[_0xef7b79[_0xef45('0x5')]]['reason']=_0xef45('0x51');agents[_0xef7b79[_0xef45('0x5')]]['lastevent']='rejected';}utils[_0xef45('0x2')](util[_0xef45('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0xef7b79['uniqueid'],agents[_0xef7b79['uniqueid']][_0xef45('0x8')],agents[_0xef7b79[_0xef45('0x5')]]['reason'],agents[_0xef7b79['uniqueid']][_0xef45('0xc')]));writeDB(agents[_0xef7b79['uniqueid']]);var _0x36586a=unanswered[_0xef45('0x52')](_0xef7b79[_0xef45('0x5')]);if(_0x36586a>-0x1){unanswered[_0xef45('0x53')](_0x36586a,0x1);}}if(transfers[_0xef7b79[_0xef45('0x5')]]){transfers[_0xef7b79[_0xef45('0x5')]][_0xef45('0x10')]=!![];transfers[_0xef7b79['uniqueid']][_0xef45('0x33')]=utils[_0xef45('0x2b')]();transfers[_0xef7b79[_0xef45('0x5')]][_0xef45('0x27')]=utils[_0xef45('0x34')](transfers[_0xef7b79[_0xef45('0x5')]]['agentcompleteAt'],transfers[_0xef7b79['uniqueid']][_0xef45('0x2a')]);transfers[_0xef7b79[_0xef45('0x5')]][_0xef45('0x2e')]=_0xef45('0x54');transfers[_0xef7b79[_0xef45('0x5')]][_0xef45('0xc')]=_0xef45('0x35');utils[_0xef45('0x2')](util['format'](_0xef45('0x55'),_0xef7b79[_0xef45('0x5')],transfers[_0xef7b79[_0xef45('0x5')]][_0xef45('0x8')],transfers[_0xef7b79[_0xef45('0x5')]][_0xef45('0x2e')],transfers[_0xef7b79[_0xef45('0x5')]]['lastevent']));writeDB(transfers[_0xef7b79[_0xef45('0x5')]],!![]);}if(agents[_0xef7b79['uniqueid']]&&agents[_0xef7b79[_0xef45('0x5')]][_0xef45('0x2a')]){agents[_0xef7b79['uniqueid']][_0xef45('0x10')]=!![];agents[_0xef7b79[_0xef45('0x5')]][_0xef45('0x33')]=utils['now']();agents[_0xef7b79[_0xef45('0x5')]]['talktime']=utils[_0xef45('0x34')](agents[_0xef7b79[_0xef45('0x5')]][_0xef45('0x33')],agents[_0xef7b79[_0xef45('0x5')]]['agentconnectAt']);agents[_0xef7b79[_0xef45('0x5')]][_0xef45('0x2e')]=agents[_0xef7b79[_0xef45('0x5')]]['transfer']?_0xef45('0x39'):_0xef45('0x54');agents[_0xef7b79[_0xef45('0x5')]][_0xef45('0xc')]=_0xef45('0x35');utils['info'](util[_0xef45('0x3')](_0xef45('0x55'),_0xef7b79[_0xef45('0x5')],agents[_0xef7b79[_0xef45('0x5')]][_0xef45('0x8')],agents[_0xef7b79[_0xef45('0x5')]][_0xef45('0x2e')],agents[_0xef7b79[_0xef45('0x5')]][_0xef45('0xc')]));writeDB(agents[_0xef7b79['uniqueid']]);}}catch(_0xd3a51e){utils[_0xef45('0x1b')](util[_0xef45('0x3')]('[%s][agents][hangup]',_0xef7b79[_0xef45('0x5')]),_0xd3a51e);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 3fdab1d..5f9d010 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 _0x6bb0=['[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','getUserByInternal','accountcode','then','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','context','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','info','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','isNil','channelstate','transfer','destinationchannel','answertime','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','[%s][calls][musiconholdstop]','[%s][calls][varset]','variable','xmd-originatecalleridnum','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith','split','substring','lastIndexOf','includes','noop','execif','gotoif','[%s][calls][newexten]','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','format'];(function(_0xe8129c,_0x2fb03c){var _0x709fc5=function(_0xb8e0c6){while(--_0xb8e0c6){_0xe8129c['push'](_0xe8129c['shift']());}};_0x709fc5(++_0x2fb03c);}(_0x6bb0,0x64));var _0x06bb=function(_0x5f4864,_0x48dd66){_0x5f4864=_0x5f4864-0x0;var _0xa73468=_0x6bb0[_0x5f4864];return _0xa73468;};'use strict';var _=require(_0x06bb('0x0'));var util=require(_0x06bb('0x1'));var utils=require(_0x06bb('0x2'));var dispositions=[_0x06bb('0x3'),_0x06bb('0x4'),_0x06bb('0x4'),_0x06bb('0x3'),_0x06bb('0x3'),_0x06bb('0x3'),_0x06bb('0x5'),_0x06bb('0x6'),_0x06bb('0x4'),_0x06bb('0x4'),_0x06bb('0x4')];var channels={};function writeDB(_0x1756f0){utils['info'](util[_0x06bb('0x7')](_0x06bb('0x8'),_0x1756f0[_0x06bb('0x9')],_0x1756f0[_0x06bb('0xa')],_0x1756f0[_0x06bb('0xb')],_0x1756f0[_0x06bb('0xc')],_0x1756f0[_0x06bb('0xd')],_0x1756f0[_0x06bb('0xe')],_0x1756f0[_0x06bb('0xf')],_0x1756f0['lastevent']));if(_0x1756f0['accountcode']){utils[_0x06bb('0x10')](_0x1756f0[_0x06bb('0x11')])[_0x06bb('0x12')](function(_0x29dfb2){if(_0x29dfb2){_0x1756f0[_0x06bb('0x13')]=_0x29dfb2['id'];}utils[_0x06bb('0x14')]('CreateVoiceCallReport',_0x1756f0);});}else{utils[_0x06bb('0x14')](_0x06bb('0x15'),_0x1756f0);}if(channels[_0x1756f0['uniqueid']]){delete channels[_0x1756f0[_0x06bb('0x9')]];}}exports[_0x06bb('0x16')]=function(_0x288d49){try{utils[_0x06bb('0x17')](util[_0x06bb('0x7')](_0x06bb('0x18'),_0x288d49['uniqueid']),_0x288d49);if(_0x288d49[_0x06bb('0x9')]==_0x288d49[_0x06bb('0x19')]&&_0x288d49[_0x06bb('0xa')]!=_0x06bb('0x1a')){utils['info'](util[_0x06bb('0x7')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x288d49[_0x06bb('0x9')],_0x288d49[_0x06bb('0x1b')],_0x288d49[_0x06bb('0x1c')]));channels[_0x288d49['uniqueid']]={'uniqueid':_0x288d49[_0x06bb('0x9')],'accountcode':_0x288d49[_0x06bb('0x11')],'source':_0x288d49[_0x06bb('0xe')],'destination':_0x288d49[_0x06bb('0x1c')],'destinationcontext':_0x288d49[_0x06bb('0x1b')],'channel':_0x288d49[_0x06bb('0xa')],'starttime':utils[_0x06bb('0x1d')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x06bb('0x3'),'amaflags':_0x06bb('0x1e')};}}catch(_0x121b01){utils[_0x06bb('0x1f')](util['format'](_0x06bb('0x18'),_0x288d49[_0x06bb('0x9')]),_0x121b01);}};exports[_0x06bb('0x20')]=function(_0x23cdfe){try{utils[_0x06bb('0x17')](util[_0x06bb('0x7')](_0x06bb('0x21'),_0x23cdfe[_0x06bb('0x9')]),_0x23cdfe);if(!_['isNil'](channels[_0x23cdfe[_0x06bb('0x9')]])&&_0x23cdfe['channelstate']==0x6){utils[_0x06bb('0x22')](util[_0x06bb('0x7')](_0x06bb('0x23'),_0x23cdfe[_0x06bb('0x9')],_0x23cdfe[_0x06bb('0x1b')],_0x23cdfe[_0x06bb('0xa')]));if(_['isNil'](channels[_0x23cdfe['uniqueid']][_0x06bb('0x24')])){channels[_0x23cdfe['uniqueid']]['systemanswertime']=utils[_0x06bb('0x1d')]();}}else if(!_[_0x06bb('0x25')](channels[_0x23cdfe[_0x06bb('0x19')]])&&_0x23cdfe[_0x06bb('0x26')]==0x6&&_0x23cdfe['context']!=_0x06bb('0x27')){utils[_0x06bb('0x22')](util[_0x06bb('0x7')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x23cdfe['uniqueid'],_0x23cdfe[_0x06bb('0x19')],_0x23cdfe['context'],_0x23cdfe[_0x06bb('0xa')]));channels[_0x23cdfe[_0x06bb('0x19')]][_0x06bb('0x11')]=_0x23cdfe['accountcode'];channels[_0x23cdfe[_0x06bb('0x19')]][_0x06bb('0x28')]=_0x23cdfe[_0x06bb('0xa')];if(_['isNil'](channels[_0x23cdfe['linkedid']][_0x06bb('0x29')])){channels[_0x23cdfe[_0x06bb('0x19')]][_0x06bb('0x29')]=utils[_0x06bb('0x1d')]();}channels[_0x23cdfe['linkedid']]['disposition']=dispositions[_['toNumber'](_0x23cdfe[_0x06bb('0x26')])]||_0x06bb('0x5');}}catch(_0x7c902e){utils[_0x06bb('0x1f')](util[_0x06bb('0x7')]('[%s][calls][newstate]',_0x23cdfe[_0x06bb('0x9')]),_0x7c902e);}};exports[_0x06bb('0x2a')]=function(_0x51a00d){try{if(!_[_0x06bb('0x25')](channels[_0x51a00d[_0x06bb('0x9')]])){utils[_0x06bb('0x17')](util[_0x06bb('0x7')](_0x06bb('0x2b'),_0x51a00d['uniqueid']),_0x51a00d);if(_[_0x06bb('0x25')](channels[_0x51a00d['uniqueid']][_0x06bb('0x2c')])){channels[_0x51a00d[_0x06bb('0x9')]][_0x06bb('0x2c')]=_0x51a00d[_0x06bb('0x2d')]+'\x20<'+_0x51a00d['calleridnum']+'>';}utils['info'](util[_0x06bb('0x7')](_0x06bb('0x2e'),_0x51a00d['uniqueid'],channels[_0x51a00d[_0x06bb('0x9')]][_0x06bb('0x2c')],_0x51a00d[_0x06bb('0x2f')]));channels[_0x51a00d[_0x06bb('0x9')]][_0x06bb('0x30')]=utils[_0x06bb('0x1d')]();channels[_0x51a00d[_0x06bb('0x9')]][_0x06bb('0x31')]=utils[_0x06bb('0x32')](channels[_0x51a00d['uniqueid']][_0x06bb('0x30')],channels[_0x51a00d[_0x06bb('0x9')]][_0x06bb('0x33')]);channels[_0x51a00d[_0x06bb('0x9')]][_0x06bb('0x34')]=channels[_0x51a00d[_0x06bb('0x9')]][_0x06bb('0x29')]?utils['diffTime'](channels[_0x51a00d[_0x06bb('0x9')]]['endtime'],channels[_0x51a00d[_0x06bb('0x9')]][_0x06bb('0x29')]):0x0;writeDB(channels[_0x51a00d['uniqueid']]);}}catch(_0x22a07e){utils[_0x06bb('0x1f')](util[_0x06bb('0x7')](_0x06bb('0x2b'),_0x51a00d[_0x06bb('0x9')]),_0x22a07e);}};exports['attendedtransfer']=function(_0x30c9d5){try{if(!_[_0x06bb('0x25')](channels[_0x30c9d5[_0x06bb('0x35')]])){utils[_0x06bb('0x17')](util[_0x06bb('0x7')](_0x06bb('0x36'),_0x30c9d5['origtransfereruniqueid']),_0x30c9d5);if(channels[_0x30c9d5[_0x06bb('0x35')]][_0x06bb('0xa')]==_0x30c9d5[_0x06bb('0x37')]){utils[_0x06bb('0x22')](util[_0x06bb('0x7')](_0x06bb('0x38'),_0x30c9d5[_0x06bb('0x39')],_0x30c9d5[_0x06bb('0x35')],_0x30c9d5['secondtransfererchannel']));channels[_0x30c9d5['localtwolinkedid']][_0x06bb('0x28')]=_0x30c9d5['secondtransfererchannel'];channels[_0x30c9d5[_0x06bb('0x35')]][_0x06bb('0x3a')]=_0x06bb('0x3b');}else if(channels[_0x30c9d5[_0x06bb('0x35')]][_0x06bb('0xa')]=_0x30c9d5[_0x06bb('0x3c')]){utils[_0x06bb('0x22')](util[_0x06bb('0x7')](_0x06bb('0x38'),_0x30c9d5['origtransfereruniqueid'],_0x30c9d5[_0x06bb('0x35')],_0x30c9d5['origtransfererchannel']));channels[_0x30c9d5[_0x06bb('0x35')]][_0x06bb('0x28')]=_0x30c9d5[_0x06bb('0x3d')];channels[_0x30c9d5[_0x06bb('0x35')]]['userfield']=_0x06bb('0x3b');}}}catch(_0xc28860){utils[_0x06bb('0x1f')](util[_0x06bb('0x7')]('[%s][calls][attendedtransfer]',_0x30c9d5[_0x06bb('0x39')]),_0xc28860);}};exports[_0x06bb('0x3e')]=function(_0x554d89){try{if(!_[_0x06bb('0x25')](channels[_0x554d89[_0x06bb('0x9')]])){utils[_0x06bb('0x17')](util[_0x06bb('0x7')]('[%s][calls][musiconholdstart]',_0x554d89[_0x06bb('0x9')]),_0x554d89);channels[_0x554d89[_0x06bb('0x9')]][_0x06bb('0x3f')]=utils[_0x06bb('0x1d')]();utils[_0x06bb('0x22')](util[_0x06bb('0x7')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x554d89['uniqueid'],channels[_0x554d89['uniqueid']]['musiconholdstartAt']));}}catch(_0x584c45){utils[_0x06bb('0x1f')](util[_0x06bb('0x7')]('[%s][calls][musiconholdstart]',_0x554d89[_0x06bb('0x9')]),_0x584c45);}};exports[_0x06bb('0x40')]=function(_0x2eca70){try{if(!_[_0x06bb('0x25')](channels[_0x2eca70[_0x06bb('0x9')]])){utils[_0x06bb('0x17')](util['format']('[%s][calls][musiconholdstop]',_0x2eca70['uniqueid']),_0x2eca70);if(!_[_0x06bb('0x25')](channels[_0x2eca70[_0x06bb('0x9')]]['musiconholdstartAt'])){channels[_0x2eca70[_0x06bb('0x9')]]['mohtime']+=utils[_0x06bb('0x32')](utils[_0x06bb('0x1d')](),channels[_0x2eca70[_0x06bb('0x9')]][_0x06bb('0x3f')]);utils[_0x06bb('0x22')](util[_0x06bb('0x7')](_0x06bb('0x41'),_0x2eca70[_0x06bb('0x9')],channels[_0x2eca70[_0x06bb('0x9')]][_0x06bb('0x42')]));delete channels[_0x2eca70[_0x06bb('0x9')]][_0x06bb('0x3f')];}}}catch(_0x4dc715){utils['error'](util[_0x06bb('0x7')](_0x06bb('0x43'),_0x2eca70[_0x06bb('0x9')]),_0x4dc715);}};exports['varset']=function(_0x1f9c44){try{if(!_[_0x06bb('0x25')](channels[_0x1f9c44[_0x06bb('0x9')]])){utils[_0x06bb('0x17')](util[_0x06bb('0x7')](_0x06bb('0x44'),_0x1f9c44[_0x06bb('0x9')]),_0x1f9c44);if(!_['isNil'](_0x1f9c44[_0x06bb('0x45')][_0x06bb('0x46')])){utils[_0x06bb('0x22')](util[_0x06bb('0x7')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x1f9c44[_0x06bb('0x9')],_0x1f9c44[_0x06bb('0x47')]));channels[_0x1f9c44[_0x06bb('0x9')]][_0x06bb('0x48')]=_0x1f9c44[_0x06bb('0x47')];}if(!_[_0x06bb('0x25')](_0x1f9c44[_0x06bb('0x45')][_0x06bb('0x49')])){utils[_0x06bb('0x22')](util[_0x06bb('0x7')](_0x06bb('0x4a'),_0x1f9c44[_0x06bb('0x9')],_0x1f9c44[_0x06bb('0x47')]));channels[_0x1f9c44[_0x06bb('0x9')]]['destination']=_0x1f9c44[_0x06bb('0x47')];channels[_0x1f9c44['uniqueid']][_0x06bb('0x2c')]='\x22'+_0x1f9c44[_0x06bb('0x47')]+_0x06bb('0x4b')+_0x1f9c44[_0x06bb('0x47')]+'>';}if(!_['isNil'](_0x1f9c44[_0x06bb('0x45')][_0x06bb('0x4c')])||!_[_0x06bb('0x25')](_0x1f9c44[_0x06bb('0x45')][_0x06bb('0x4d')])){utils[_0x06bb('0x22')](util[_0x06bb('0x7')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x1f9c44[_0x06bb('0x9')],!_[_0x06bb('0x25')](_0x1f9c44['variable'][_0x06bb('0x4c')])?_0x06bb('0x4c'):'xmd-callerid',_0x1f9c44[_0x06bb('0x47')]));channels[_0x1f9c44[_0x06bb('0x9')]][_0x06bb('0x2c')]=_0x1f9c44[_0x06bb('0x47')];}if(!_[_0x06bb('0x25')](_0x1f9c44[_0x06bb('0x45')][_0x06bb('0x4e')])||!_[_0x06bb('0x25')](_0x1f9c44['variable'][_0x06bb('0x4f')])){utils[_0x06bb('0x22')](util[_0x06bb('0x7')](_0x06bb('0x50'),_0x1f9c44[_0x06bb('0x9')],!_['isNil'](_0x1f9c44[_0x06bb('0x45')][_0x06bb('0x4e')])?'xmd-queue':_0x06bb('0x4f'),_0x1f9c44[_0x06bb('0x47')]));channels[_0x1f9c44[_0x06bb('0x9')]][_0x06bb('0x51')]=_0x06bb('0x52');channels[_0x1f9c44[_0x06bb('0x9')]][_0x06bb('0x53')]=_0x1f9c44[_0x06bb('0x47')];channels[_0x1f9c44[_0x06bb('0x9')]][_0x06bb('0xb')]=!![];}if(!_[_0x06bb('0x25')](_0x1f9c44[_0x06bb('0x45')][_0x06bb('0x54')])){utils['info'](util[_0x06bb('0x7')](_0x06bb('0x55'),_0x1f9c44[_0x06bb('0x9')],_0x1f9c44[_0x06bb('0x47')]));channels[_0x1f9c44['uniqueid']][_0x06bb('0x56')]=_0x1f9c44[_0x06bb('0x47')];}if(!_['isNil'](_0x1f9c44[_0x06bb('0x45')][_0x06bb('0x57')])){utils[_0x06bb('0x22')](util['format'](_0x06bb('0x58'),_0x1f9c44['uniqueid'],_0x1f9c44[_0x06bb('0x47')]));channels[_0x1f9c44['uniqueid']][_0x06bb('0x59')]=_0x1f9c44[_0x06bb('0x47')];}if(!_[_0x06bb('0x25')](_0x1f9c44[_0x06bb('0x45')][_0x06bb('0x5a')])){utils[_0x06bb('0x22')](util[_0x06bb('0x7')](_0x06bb('0x5b'),_0x1f9c44[_0x06bb('0x9')],_0x1f9c44['value']));channels[_0x1f9c44[_0x06bb('0x9')]][_0x06bb('0x5c')]=_0x1f9c44[_0x06bb('0x47')];}if(!_[_0x06bb('0x25')](_0x1f9c44[_0x06bb('0x45')][_0x06bb('0x5d')])){utils[_0x06bb('0x22')](util[_0x06bb('0x7')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x1f9c44[_0x06bb('0x9')],_0x1f9c44[_0x06bb('0x47')]));channels[_0x1f9c44['uniqueid']][_0x06bb('0x5d')]=_0x1f9c44[_0x06bb('0x47')];}}}catch(_0x4fc3fd){utils[_0x06bb('0x1f')](util['format']('[%s][calls][varset]',_0x1f9c44['uniqueid']),_0x4fc3fd);}};exports['newexten']=function(_0x3b6787){try{if(!_[_0x06bb('0x25')](channels[_0x3b6787[_0x06bb('0x9')]])){utils['debug'](util[_0x06bb('0x7')]('[%s][calls][newexten]',_0x3b6787['uniqueid']),_0x3b6787);utils[_0x06bb('0x22')](util[_0x06bb('0x7')](_0x06bb('0x5e'),_0x3b6787[_0x06bb('0x9')],_0x3b6787['application'],_0x3b6787[_0x06bb('0x5f')]));if(_0x3b6787[_0x06bb('0x60')][_0x06bb('0x61')]()==_0x06bb('0x62')&&_[_0x06bb('0x63')](_0x3b6787[_0x06bb('0x5f')][_0x06bb('0x61')](),'cdr')){var _0x3d2192=_0x3b6787[_0x06bb('0x5f')][_0x06bb('0x64')]('=');var _0x313a9f=_0x3d2192[0x0][_0x06bb('0x65')](_0x3d2192[0x0]['lastIndexOf']('(')+0x1,_0x3d2192[0x0][_0x06bb('0x66')](')'));var _0x5a3b52=_0x3d2192[0x1];channels[_0x3b6787[_0x06bb('0x9')]][_0x313a9f]=_0x5a3b52;}if(!_[_0x06bb('0x67')](['hangup',_0x06bb('0x68'),_0x06bb('0x69'),_0x06bb('0x62'),_0x06bb('0x6a')],_0x3b6787[_0x06bb('0x60')][_0x06bb('0x61')]())){channels[_0x3b6787[_0x06bb('0x9')]]['lastapplication']=_0x3b6787[_0x06bb('0x60')];channels[_0x3b6787[_0x06bb('0x9')]][_0x06bb('0x53')]=_0x3b6787['appdata'];}}}catch(_0x34c6f4){utils[_0x06bb('0x1f')](util[_0x06bb('0x7')](_0x06bb('0x6b'),_0x3b6787[_0x06bb('0x9')]),_0x34c6f4);}}; \ No newline at end of file +var _0x7d29=['[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','source','value','variable','xmd-phone','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','[%s][calls][varset]','newexten','[%s][calls][newexten]','application','appdata','set','toLowerCase','split','substring','lastIndexOf','includes','noop','execif','gotoif','lodash','NO\x20ANSWER','FAILED','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','interface','calleridnum','connectedlinenum','accountcode','getUserByInternal','UserId','request','uniqueid','debug','format','[%s][calls][newchannel]','linkedid','channel','OutgoingSpoolFailed','context','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','systemanswertime','transfer','destinationchannel','answertime','disposition','toNumber','ANSWERED','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel'];(function(_0x5abdec,_0x4c8d8b){var _0xe86d72=function(_0x4f5030){while(--_0x4f5030){_0x5abdec['push'](_0x5abdec['shift']());}};_0xe86d72(++_0x4c8d8b);}(_0x7d29,0xf8));var _0x97d2=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x7d29[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x97d2('0x0'));var util=require('util');var utils=require('./utils');var dispositions=[_0x97d2('0x1'),_0x97d2('0x2'),_0x97d2('0x2'),_0x97d2('0x1'),_0x97d2('0x1'),_0x97d2('0x1'),'ANSWERED','BUSY',_0x97d2('0x2'),_0x97d2('0x2'),_0x97d2('0x2')];var channels={};function writeDB(_0x1b3e5d){utils[_0x97d2('0x3')](util['format'](_0x97d2('0x4'),_0x1b3e5d['uniqueid'],_0x1b3e5d['channel'],_0x1b3e5d['queue'],_0x1b3e5d['membername'],_0x1b3e5d[_0x97d2('0x5')],_0x1b3e5d[_0x97d2('0x6')],_0x1b3e5d[_0x97d2('0x7')],_0x1b3e5d['lastevent']));if(_0x1b3e5d[_0x97d2('0x8')]){utils[_0x97d2('0x9')](_0x1b3e5d[_0x97d2('0x8')])['then'](function(_0x3bdaae){if(_0x3bdaae){_0x1b3e5d[_0x97d2('0xa')]=_0x3bdaae['id'];}utils[_0x97d2('0xb')]('CreateVoiceCallReport',_0x1b3e5d);});}else{utils[_0x97d2('0xb')]('CreateVoiceCallReport',_0x1b3e5d);}if(channels[_0x1b3e5d[_0x97d2('0xc')]]){delete channels[_0x1b3e5d[_0x97d2('0xc')]];}}exports['newchannel']=function(_0x1763d6){try{utils[_0x97d2('0xd')](util[_0x97d2('0xe')](_0x97d2('0xf'),_0x1763d6['uniqueid']),_0x1763d6);if(_0x1763d6[_0x97d2('0xc')]==_0x1763d6[_0x97d2('0x10')]&&_0x1763d6[_0x97d2('0x11')]!=_0x97d2('0x12')){utils[_0x97d2('0x3')](util['format']('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x1763d6[_0x97d2('0xc')],_0x1763d6[_0x97d2('0x13')],_0x1763d6[_0x97d2('0x14')]));channels[_0x1763d6[_0x97d2('0xc')]]={'uniqueid':_0x1763d6[_0x97d2('0xc')],'accountcode':_0x1763d6[_0x97d2('0x8')],'source':_0x1763d6[_0x97d2('0x6')],'destination':_0x1763d6[_0x97d2('0x14')],'destinationcontext':_0x1763d6[_0x97d2('0x13')],'channel':_0x1763d6[_0x97d2('0x11')],'starttime':utils[_0x97d2('0x15')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x97d2('0x1'),'amaflags':_0x97d2('0x16')};}}catch(_0x2e934d){utils[_0x97d2('0x17')](util['format'](_0x97d2('0xf'),_0x1763d6[_0x97d2('0xc')]),_0x2e934d);}};exports[_0x97d2('0x18')]=function(_0x6678b5){try{utils['debug'](util[_0x97d2('0xe')](_0x97d2('0x19'),_0x6678b5['uniqueid']),_0x6678b5);if(!_[_0x97d2('0x1a')](channels[_0x6678b5[_0x97d2('0xc')]])&&_0x6678b5[_0x97d2('0x1b')]==0x6){utils['info'](util[_0x97d2('0xe')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x6678b5['uniqueid'],_0x6678b5['context'],_0x6678b5['channel']));if(_[_0x97d2('0x1a')](channels[_0x6678b5['uniqueid']]['systemanswertime'])){channels[_0x6678b5['uniqueid']][_0x97d2('0x1c')]=utils[_0x97d2('0x15')]();}}else if(!_[_0x97d2('0x1a')](channels[_0x6678b5[_0x97d2('0x10')]])&&_0x6678b5['channelstate']==0x6&&_0x6678b5[_0x97d2('0x13')]!=_0x97d2('0x1d')){utils[_0x97d2('0x3')](util['format']('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x6678b5[_0x97d2('0xc')],_0x6678b5[_0x97d2('0x10')],_0x6678b5[_0x97d2('0x13')],_0x6678b5[_0x97d2('0x11')]));channels[_0x6678b5[_0x97d2('0x10')]]['accountcode']=_0x6678b5['accountcode'];channels[_0x6678b5[_0x97d2('0x10')]][_0x97d2('0x1e')]=_0x6678b5['channel'];if(_[_0x97d2('0x1a')](channels[_0x6678b5[_0x97d2('0x10')]][_0x97d2('0x1f')])){channels[_0x6678b5['linkedid']]['answertime']=utils[_0x97d2('0x15')]();}channels[_0x6678b5['linkedid']][_0x97d2('0x20')]=dispositions[_[_0x97d2('0x21')](_0x6678b5[_0x97d2('0x1b')])]||_0x97d2('0x22');}}catch(_0x1a4c94){utils['error'](util['format'](_0x97d2('0x19'),_0x6678b5[_0x97d2('0xc')]),_0x1a4c94);}};exports[_0x97d2('0x23')]=function(_0x270e8d){try{if(!_[_0x97d2('0x1a')](channels[_0x270e8d[_0x97d2('0xc')]])){utils[_0x97d2('0xd')](util[_0x97d2('0xe')](_0x97d2('0x24'),_0x270e8d['uniqueid']),_0x270e8d);if(_['isNil'](channels[_0x270e8d[_0x97d2('0xc')]][_0x97d2('0x25')])){channels[_0x270e8d[_0x97d2('0xc')]]['callerid']=_0x270e8d[_0x97d2('0x26')]+'\x20<'+_0x270e8d[_0x97d2('0x6')]+'>';}utils[_0x97d2('0x3')](util[_0x97d2('0xe')](_0x97d2('0x27'),_0x270e8d[_0x97d2('0xc')],channels[_0x270e8d['uniqueid']]['callerid'],_0x270e8d[_0x97d2('0x28')]));channels[_0x270e8d[_0x97d2('0xc')]][_0x97d2('0x29')]=utils[_0x97d2('0x15')]();channels[_0x270e8d[_0x97d2('0xc')]][_0x97d2('0x2a')]=utils[_0x97d2('0x2b')](channels[_0x270e8d[_0x97d2('0xc')]][_0x97d2('0x29')],channels[_0x270e8d['uniqueid']]['starttime']);channels[_0x270e8d[_0x97d2('0xc')]][_0x97d2('0x2c')]=channels[_0x270e8d[_0x97d2('0xc')]][_0x97d2('0x1f')]?utils[_0x97d2('0x2b')](channels[_0x270e8d[_0x97d2('0xc')]][_0x97d2('0x29')],channels[_0x270e8d[_0x97d2('0xc')]][_0x97d2('0x1f')]):0x0;writeDB(channels[_0x270e8d[_0x97d2('0xc')]]);}}catch(_0x11f5a4){utils['error'](util[_0x97d2('0xe')](_0x97d2('0x24'),_0x270e8d[_0x97d2('0xc')]),_0x11f5a4);}};exports[_0x97d2('0x2d')]=function(_0x159ac8){try{if(!_[_0x97d2('0x1a')](channels[_0x159ac8[_0x97d2('0x2e')]])){utils[_0x97d2('0xd')](util[_0x97d2('0xe')](_0x97d2('0x2f'),_0x159ac8['origtransfereruniqueid']),_0x159ac8);if(channels[_0x159ac8[_0x97d2('0x2e')]][_0x97d2('0x11')]==_0x159ac8[_0x97d2('0x30')]){utils[_0x97d2('0x3')](util[_0x97d2('0xe')](_0x97d2('0x31'),_0x159ac8[_0x97d2('0x32')],_0x159ac8['localtwolinkedid'],_0x159ac8[_0x97d2('0x33')]));channels[_0x159ac8[_0x97d2('0x2e')]][_0x97d2('0x1e')]=_0x159ac8[_0x97d2('0x33')];channels[_0x159ac8['localtwolinkedid']][_0x97d2('0x34')]=_0x97d2('0x35');}else if(channels[_0x159ac8[_0x97d2('0x2e')]][_0x97d2('0x11')]=_0x159ac8[_0x97d2('0x36')]){utils[_0x97d2('0x3')](util['format'](_0x97d2('0x31'),_0x159ac8[_0x97d2('0x32')],_0x159ac8[_0x97d2('0x2e')],_0x159ac8[_0x97d2('0x37')]));channels[_0x159ac8[_0x97d2('0x2e')]][_0x97d2('0x1e')]=_0x159ac8['origtransfererchannel'];channels[_0x159ac8['localtwolinkedid']][_0x97d2('0x34')]=_0x97d2('0x35');}}}catch(_0x352446){utils[_0x97d2('0x17')](util['format']('[%s][calls][attendedtransfer]',_0x159ac8[_0x97d2('0x32')]),_0x352446);}};exports[_0x97d2('0x38')]=function(_0x4f1c56){try{if(!_['isNil'](channels[_0x4f1c56[_0x97d2('0xc')]])){utils[_0x97d2('0xd')](util['format'](_0x97d2('0x39'),_0x4f1c56['uniqueid']),_0x4f1c56);channels[_0x4f1c56[_0x97d2('0xc')]][_0x97d2('0x3a')]=utils[_0x97d2('0x15')]();utils[_0x97d2('0x3')](util['format'](_0x97d2('0x3b'),_0x4f1c56['uniqueid'],channels[_0x4f1c56[_0x97d2('0xc')]][_0x97d2('0x3a')]));}}catch(_0x4ec39c){utils['error'](util[_0x97d2('0xe')]('[%s][calls][musiconholdstart]',_0x4f1c56['uniqueid']),_0x4ec39c);}};exports[_0x97d2('0x3c')]=function(_0x2630f7){try{if(!_[_0x97d2('0x1a')](channels[_0x2630f7[_0x97d2('0xc')]])){utils[_0x97d2('0xd')](util[_0x97d2('0xe')](_0x97d2('0x3d'),_0x2630f7['uniqueid']),_0x2630f7);if(!_['isNil'](channels[_0x2630f7[_0x97d2('0xc')]][_0x97d2('0x3a')])){channels[_0x2630f7[_0x97d2('0xc')]]['mohtime']+=utils[_0x97d2('0x2b')](utils[_0x97d2('0x15')](),channels[_0x2630f7[_0x97d2('0xc')]][_0x97d2('0x3a')]);utils['info'](util[_0x97d2('0xe')](_0x97d2('0x3e'),_0x2630f7['uniqueid'],channels[_0x2630f7[_0x97d2('0xc')]]['mohtime']));delete channels[_0x2630f7[_0x97d2('0xc')]][_0x97d2('0x3a')];}}}catch(_0x4e4b52){utils[_0x97d2('0x17')](util[_0x97d2('0xe')](_0x97d2('0x3d'),_0x2630f7['uniqueid']),_0x4e4b52);}};exports[_0x97d2('0x3f')]=function(_0x3759b3){try{if(!_[_0x97d2('0x1a')](channels[_0x3759b3[_0x97d2('0xc')]])){utils[_0x97d2('0xd')](util['format']('[%s][calls][varset]',_0x3759b3[_0x97d2('0xc')]),_0x3759b3);if(!_[_0x97d2('0x1a')](_0x3759b3['variable']['xmd-originatecalleridnum'])){utils[_0x97d2('0x3')](util[_0x97d2('0xe')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x3759b3[_0x97d2('0xc')],_0x3759b3['value']));channels[_0x3759b3['uniqueid']][_0x97d2('0x40')]=_0x3759b3[_0x97d2('0x41')];}if(!_[_0x97d2('0x1a')](_0x3759b3[_0x97d2('0x42')][_0x97d2('0x43')])){utils['info'](util[_0x97d2('0xe')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x3759b3[_0x97d2('0xc')],_0x3759b3[_0x97d2('0x41')]));channels[_0x3759b3[_0x97d2('0xc')]]['destination']=_0x3759b3[_0x97d2('0x41')];channels[_0x3759b3[_0x97d2('0xc')]][_0x97d2('0x25')]='\x22'+_0x3759b3['value']+_0x97d2('0x44')+_0x3759b3['value']+'>';}if(!_[_0x97d2('0x1a')](_0x3759b3[_0x97d2('0x42')][_0x97d2('0x45')])||!_['isNil'](_0x3759b3['variable'][_0x97d2('0x46')])){utils[_0x97d2('0x3')](util[_0x97d2('0xe')](_0x97d2('0x47'),_0x3759b3[_0x97d2('0xc')],!_[_0x97d2('0x1a')](_0x3759b3[_0x97d2('0x42')][_0x97d2('0x45')])?_0x97d2('0x45'):'xmd-callerid',_0x3759b3[_0x97d2('0x41')]));channels[_0x3759b3[_0x97d2('0xc')]][_0x97d2('0x25')]=_0x3759b3[_0x97d2('0x41')];}if(!_[_0x97d2('0x1a')](_0x3759b3[_0x97d2('0x42')][_0x97d2('0x48')])||!_['isNil'](_0x3759b3[_0x97d2('0x42')][_0x97d2('0x49')])){utils[_0x97d2('0x3')](util[_0x97d2('0xe')](_0x97d2('0x47'),_0x3759b3[_0x97d2('0xc')],!_['isNil'](_0x3759b3['variable'][_0x97d2('0x48')])?_0x97d2('0x48'):'xmcs-queue',_0x3759b3[_0x97d2('0x41')]));channels[_0x3759b3[_0x97d2('0xc')]][_0x97d2('0x4a')]='Queue';channels[_0x3759b3[_0x97d2('0xc')]][_0x97d2('0x4b')]=_0x3759b3[_0x97d2('0x41')];channels[_0x3759b3[_0x97d2('0xc')]]['queue']=!![];}if(!_[_0x97d2('0x1a')](_0x3759b3[_0x97d2('0x42')][_0x97d2('0x4c')])){utils[_0x97d2('0x3')](util[_0x97d2('0xe')](_0x97d2('0x4d'),_0x3759b3['uniqueid'],_0x3759b3[_0x97d2('0x41')]));channels[_0x3759b3[_0x97d2('0xc')]][_0x97d2('0x4e')]=_0x3759b3['value'];}if(!_[_0x97d2('0x1a')](_0x3759b3[_0x97d2('0x42')][_0x97d2('0x4f')])){utils[_0x97d2('0x3')](util[_0x97d2('0xe')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x3759b3[_0x97d2('0xc')],_0x3759b3['value']));channels[_0x3759b3[_0x97d2('0xc')]][_0x97d2('0x50')]=_0x3759b3[_0x97d2('0x41')];}if(!_[_0x97d2('0x1a')](_0x3759b3['variable']['outboundrouteid'])){utils[_0x97d2('0x3')](util['format'](_0x97d2('0x51'),_0x3759b3[_0x97d2('0xc')],_0x3759b3[_0x97d2('0x41')]));channels[_0x3759b3[_0x97d2('0xc')]][_0x97d2('0x52')]=_0x3759b3[_0x97d2('0x41')];}if(!_[_0x97d2('0x1a')](_0x3759b3['variable']['sipcallid'])){utils[_0x97d2('0x3')](util[_0x97d2('0xe')](_0x97d2('0x53'),_0x3759b3[_0x97d2('0xc')],_0x3759b3[_0x97d2('0x41')]));channels[_0x3759b3[_0x97d2('0xc')]][_0x97d2('0x54')]=_0x3759b3['value'];}}}catch(_0x4e783e){utils['error'](util['format'](_0x97d2('0x55'),_0x3759b3[_0x97d2('0xc')]),_0x4e783e);}};exports[_0x97d2('0x56')]=function(_0x29bd24){try{if(!_[_0x97d2('0x1a')](channels[_0x29bd24[_0x97d2('0xc')]])){utils[_0x97d2('0xd')](util[_0x97d2('0xe')](_0x97d2('0x57'),_0x29bd24[_0x97d2('0xc')]),_0x29bd24);utils['info'](util['format']('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x29bd24[_0x97d2('0xc')],_0x29bd24[_0x97d2('0x58')],_0x29bd24[_0x97d2('0x59')]));if(_0x29bd24[_0x97d2('0x58')]['toLowerCase']()==_0x97d2('0x5a')&&_['startsWith'](_0x29bd24[_0x97d2('0x59')][_0x97d2('0x5b')](),'cdr')){var _0x5ac676=_0x29bd24['appdata'][_0x97d2('0x5c')]('=');var _0x370480=_0x5ac676[0x0][_0x97d2('0x5d')](_0x5ac676[0x0][_0x97d2('0x5e')]('(')+0x1,_0x5ac676[0x0]['lastIndexOf'](')'));var _0x678832=_0x5ac676[0x1];channels[_0x29bd24[_0x97d2('0xc')]][_0x370480]=_0x678832;}if(!_[_0x97d2('0x5f')]([_0x97d2('0x23'),_0x97d2('0x60'),_0x97d2('0x61'),'set',_0x97d2('0x62')],_0x29bd24[_0x97d2('0x58')][_0x97d2('0x5b')]())){channels[_0x29bd24['uniqueid']][_0x97d2('0x4a')]=_0x29bd24[_0x97d2('0x58')];channels[_0x29bd24['uniqueid']][_0x97d2('0x4b')]=_0x29bd24[_0x97d2('0x59')];}}}catch(_0x3861e1){utils[_0x97d2('0x17')](util[_0x97d2('0xe')](_0x97d2('0x57'),_0x29bd24[_0x97d2('0xc')]),_0x3861e1);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 27d81c4..aaf25ad 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 _0x5bf9=['close','[core]\x20close','managerevent','./utils','connect','info','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error'];(function(_0x3edc62,_0x2c2627){var _0x39c88c=function(_0x138695){while(--_0x138695){_0x3edc62['push'](_0x3edc62['shift']());}};_0x39c88c(++_0x2c2627);}(_0x5bf9,0x1d1));var _0x95bf=function(_0x4475cc,_0x2ae903){_0x4475cc=_0x4475cc-0x0;var _0x56d24a=_0x5bf9[_0x4475cc];return _0x56d24a;};'use strict';var utils=require(_0x95bf('0x0'));exports[_0x95bf('0x1')]=function(){utils[_0x95bf('0x2')]('[core]\x20connected');};exports['shutdown']=function(){utils[_0x95bf('0x2')](_0x95bf('0x3'));};exports[_0x95bf('0x4')]=function(){utils[_0x95bf('0x2')](_0x95bf('0x5'));};exports[_0x95bf('0x6')]=function(_0x4760b3){utils[_0x95bf('0x6')](_0x95bf('0x7'),_0x4760b3);};exports[_0x95bf('0x8')]=function(){utils['info'](_0x95bf('0x9'));};exports[_0x95bf('0xa')]=function(_0x341e32){}; \ No newline at end of file +var _0x8d48=['[core]\x20close','managerevent','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','error','[core]\x20error','close'];(function(_0x529abc,_0x17b97e){var _0x453afa=function(_0x536263){while(--_0x536263){_0x529abc['push'](_0x529abc['shift']());}};_0x453afa(++_0x17b97e);}(_0x8d48,0xc0));var _0x88d4=function(_0x4deff,_0x42c328){_0x4deff=_0x4deff-0x0;var _0x440123=_0x8d48[_0x4deff];return _0x440123;};'use strict';var utils=require('./utils');exports['connect']=function(){utils[_0x88d4('0x0')](_0x88d4('0x1'));};exports[_0x88d4('0x2')]=function(){utils[_0x88d4('0x0')](_0x88d4('0x3'));};exports[_0x88d4('0x4')]=function(){utils[_0x88d4('0x0')]('[core]\x20fullybooted');};exports[_0x88d4('0x5')]=function(_0x4b67d6){utils[_0x88d4('0x5')](_0x88d4('0x6'),_0x4b67d6);};exports[_0x88d4('0x7')]=function(){utils[_0x88d4('0x0')](_0x88d4('0x8'));};exports[_0x88d4('0x9')]=function(_0x22beca){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 3d37e31..27e668f 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 _0xc926=['[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','uniqueid','newexten','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','split','error','varset','debug','[%s][dials][varset]','isNil','variable','value','dialbegin','[%s][dials][dialbegin]','now','called','starttime','dialend','assign','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup','[%s][dials][hangup]','calleridname','cause-txt','complete','duration','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','info','format'];(function(_0x46e76c,_0x8e786a){var _0x3f58c7=function(_0x501ee9){while(--_0x501ee9){_0x46e76c['push'](_0x46e76c['shift']());}};_0x3f58c7(++_0x8e786a);}(_0xc926,0x65));var _0x6c92=function(_0x29f191,_0x3f0e73){_0x29f191=_0x29f191-0x0;var _0x581ad0=_0xc926[_0x29f191];return _0x581ad0;};'use strict';var _=require(_0x6c92('0x0'));var util=require(_0x6c92('0x1'));var utils=require(_0x6c92('0x2'));var dials={};function writeDB(_0x5543e5){utils[_0x6c92('0x3')](util[_0x6c92('0x4')](_0x6c92('0x5'),_0x5543e5['uniqueid'],_0x5543e5[_0x6c92('0x6')],_0x5543e5[_0x6c92('0x7')],_0x5543e5[_0x6c92('0x8')],_0x5543e5[_0x6c92('0x9')],_0x5543e5[_0x6c92('0xa')]));utils[_0x6c92('0xb')](_0x6c92('0xc'),_0x5543e5);delete dials[_0x5543e5[_0x6c92('0xd')]];}exports[_0x6c92('0xe')]=function(_0x98f8f7){try{utils['debug'](util[_0x6c92('0x4')](_0x6c92('0xf'),_0x98f8f7['uniqueid']),_0x98f8f7);utils[_0x6c92('0x3')](util[_0x6c92('0x4')](_0x6c92('0x10'),_0x98f8f7['uniqueid'],_0x98f8f7[_0x6c92('0x11')],_0x98f8f7[_0x6c92('0x12')]));if(_0x98f8f7[_0x6c92('0x11')][_0x6c92('0x13')]()==_0x6c92('0x14')&&_[_0x6c92('0x15')](_0x98f8f7['appdata'][_0x6c92('0x13')](),_0x6c92('0x16'))){var _0x340ed1=_0x98f8f7[_0x6c92('0x12')][_0x6c92('0x17')]('=');dials[_0x98f8f7[_0x6c92('0xd')]]={'routeId':_0x340ed1[0x1]};}}catch(_0x12fa31){utils[_0x6c92('0x18')](util[_0x6c92('0x4')](_0x6c92('0xf'),_0x98f8f7[_0x6c92('0xd')]),_0x12fa31);}};exports[_0x6c92('0x19')]=function(_0x42836c){try{utils[_0x6c92('0x1a')](util[_0x6c92('0x4')](_0x6c92('0x1b'),_0x42836c['uniqueid']),_0x42836c);if(!_[_0x6c92('0x1c')](_0x42836c[_0x6c92('0x1d')]['outboundrouteid'])){utils[_0x6c92('0x3')](util['format']('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x42836c['uniqueid'],_0x42836c['value']));dials[_0x42836c[_0x6c92('0xd')]]={'routeId':_0x42836c[_0x6c92('0x1e')]};}}catch(_0x189329){utils[_0x6c92('0x18')](util['format'](_0x6c92('0x1b'),_0x42836c[_0x6c92('0xd')]),_0x189329);}};exports[_0x6c92('0x1f')]=function(_0x50f105){try{if(!_[_0x6c92('0x1c')](dials[_0x50f105[_0x6c92('0xd')]])){utils[_0x6c92('0x1a')](util[_0x6c92('0x4')](_0x6c92('0x20'),_0x50f105[_0x6c92('0xd')]),_0x50f105);dials[_0x50f105[_0x6c92('0xd')]]=_['assign'](dials[_0x50f105['uniqueid']],_0x50f105);dials[_0x50f105[_0x6c92('0xd')]]['starttime']=utils[_0x6c92('0x21')]();dials[_0x50f105[_0x6c92('0xd')]]['lastevent']=_0x6c92('0x22');utils['info'](util['format']('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x50f105[_0x6c92('0xd')],dials[_0x50f105[_0x6c92('0xd')]][_0x6c92('0x23')]));}}catch(_0x52ffd9){utils['error'](util[_0x6c92('0x4')](_0x6c92('0x20'),_0x50f105[_0x6c92('0xd')]),_0x52ffd9);}};exports[_0x6c92('0x24')]=function(_0x5e45e0){try{if(!_[_0x6c92('0x1c')](dials[_0x5e45e0[_0x6c92('0xd')]])){utils[_0x6c92('0x1a')](util[_0x6c92('0x4')]('[%s][dials][dialend]',_0x5e45e0[_0x6c92('0xd')]),_0x5e45e0);dials[_0x5e45e0[_0x6c92('0xd')]][_0x6c92('0xa')]=_0x5e45e0['dialstatus'];if(_0x5e45e0[_0x6c92('0xa')]=='ANSWER'){dials[_0x5e45e0['uniqueid']]=_[_0x6c92('0x25')](dials[_0x5e45e0[_0x6c92('0xd')]],_0x5e45e0);dials[_0x5e45e0[_0x6c92('0xd')]][_0x6c92('0x26')]=utils['now']();dials[_0x5e45e0[_0x6c92('0xd')]]['lastevent']=_0x6c92('0x27');utils[_0x6c92('0x3')](util[_0x6c92('0x4')](_0x6c92('0x28'),_0x5e45e0[_0x6c92('0xd')],_0x5e45e0[_0x6c92('0xa')],dials[_0x5e45e0[_0x6c92('0xd')]][_0x6c92('0x26')]));}else{utils[_0x6c92('0x3')](util[_0x6c92('0x4')](_0x6c92('0x29'),_0x5e45e0[_0x6c92('0xd')],_0x5e45e0[_0x6c92('0xa')]));}}}catch(_0x315848){utils[_0x6c92('0x18')](util[_0x6c92('0x4')](_0x6c92('0x2a'),_0x5e45e0[_0x6c92('0xd')]),_0x315848);}};exports[_0x6c92('0x2b')]=function(_0x52e52a){try{if(!_['isNil'](dials[_0x52e52a[_0x6c92('0xd')]])){utils[_0x6c92('0x1a')](util['format'](_0x6c92('0x2c'),_0x52e52a[_0x6c92('0xd')]),_0x52e52a);utils[_0x6c92('0x3')](util['format']('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x52e52a[_0x6c92('0xd')],_0x52e52a[_0x6c92('0x8')],_0x52e52a[_0x6c92('0x2d')],_0x52e52a[_0x6c92('0x2e')]));dials[_0x52e52a[_0x6c92('0xd')]]=_['assign'](dials[_0x52e52a[_0x6c92('0xd')]],{'endtime':utils[_0x6c92('0x21')](),'lastevent':_0x6c92('0x2f')});dials[_0x52e52a[_0x6c92('0xd')]][_0x6c92('0x30')]=utils[_0x6c92('0x31')](dials[_0x52e52a['uniqueid']][_0x6c92('0x32')],dials[_0x52e52a['uniqueid']][_0x6c92('0x23')]);dials[_0x52e52a['uniqueid']][_0x6c92('0x33')]=utils['diffTime'](dials[_0x52e52a['uniqueid']][_0x6c92('0x26')]||dials[_0x52e52a[_0x6c92('0xd')]][_0x6c92('0x32')],dials[_0x52e52a[_0x6c92('0xd')]][_0x6c92('0x23')]);dials[_0x52e52a[_0x6c92('0xd')]][_0x6c92('0x34')]=dials[_0x52e52a['uniqueid']][_0x6c92('0x26')]?utils[_0x6c92('0x31')](dials[_0x52e52a[_0x6c92('0xd')]][_0x6c92('0x32')],dials[_0x52e52a['uniqueid']][_0x6c92('0x26')]):0x0;writeDB(dials[_0x52e52a['uniqueid']]);}}catch(_0x2c7d87){utils['error'](util['format']('[%s][dials][hangup]',_0x52e52a[_0x6c92('0xd')]),_0x2c7d87);}}; \ No newline at end of file +var _0xdcd5=['calleridname','cause-txt','complete','duration','diffTime','endtime','holdtime','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','calleridnum','connectedlinenum','dialstatus','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','application','toLowerCase','startsWith','appdata','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','assign','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]'];(function(_0x34b9c5,_0x42700f){var _0x10b193=function(_0x14df10){while(--_0x14df10){_0x34b9c5['push'](_0x34b9c5['shift']());}};_0x10b193(++_0x42700f);}(_0xdcd5,0xd7));var _0x5dcd=function(_0x2fa1c6,_0x4a5b8d){_0x2fa1c6=_0x2fa1c6-0x0;var _0x5f3257=_0xdcd5[_0x2fa1c6];return _0x5f3257;};'use strict';var _=require(_0x5dcd('0x0'));var util=require(_0x5dcd('0x1'));var utils=require(_0x5dcd('0x2'));var dials={};function writeDB(_0x2a9677){utils[_0x5dcd('0x3')](util[_0x5dcd('0x4')](_0x5dcd('0x5'),_0x2a9677[_0x5dcd('0x6')],_0x2a9677[_0x5dcd('0x7')],_0x2a9677['dialstring'],_0x2a9677[_0x5dcd('0x8')],_0x2a9677[_0x5dcd('0x9')],_0x2a9677[_0x5dcd('0xa')]));utils['request'](_0x5dcd('0xb'),_0x2a9677);delete dials[_0x2a9677[_0x5dcd('0x6')]];}exports[_0x5dcd('0xc')]=function(_0x48284d){try{utils[_0x5dcd('0xd')](util['format'](_0x5dcd('0xe'),_0x48284d[_0x5dcd('0x6')]),_0x48284d);utils[_0x5dcd('0x3')](util['format']('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x48284d[_0x5dcd('0x6')],_0x48284d['application'],_0x48284d['appdata']));if(_0x48284d[_0x5dcd('0xf')][_0x5dcd('0x10')]()=='set'&&_[_0x5dcd('0x11')](_0x48284d[_0x5dcd('0x12')]['toLowerCase'](),_0x5dcd('0x13'))){var _0x73ef97=_0x48284d[_0x5dcd('0x12')][_0x5dcd('0x14')]('=');dials[_0x48284d[_0x5dcd('0x6')]]={'routeId':_0x73ef97[0x1]};}}catch(_0x1edbcc){utils[_0x5dcd('0x15')](util[_0x5dcd('0x4')](_0x5dcd('0xe'),_0x48284d[_0x5dcd('0x6')]),_0x1edbcc);}};exports[_0x5dcd('0x16')]=function(_0x67104a){try{utils[_0x5dcd('0xd')](util['format'](_0x5dcd('0x17'),_0x67104a['uniqueid']),_0x67104a);if(!_[_0x5dcd('0x18')](_0x67104a[_0x5dcd('0x19')][_0x5dcd('0x1a')])){utils[_0x5dcd('0x3')](util[_0x5dcd('0x4')](_0x5dcd('0x1b'),_0x67104a[_0x5dcd('0x6')],_0x67104a[_0x5dcd('0x1c')]));dials[_0x67104a['uniqueid']]={'routeId':_0x67104a['value']};}}catch(_0x4573ef){utils[_0x5dcd('0x15')](util['format']('[%s][dials][varset]',_0x67104a[_0x5dcd('0x6')]),_0x4573ef);}};exports[_0x5dcd('0x1d')]=function(_0x26f6bc){try{if(!_[_0x5dcd('0x18')](dials[_0x26f6bc[_0x5dcd('0x6')]])){utils[_0x5dcd('0xd')](util[_0x5dcd('0x4')](_0x5dcd('0x1e'),_0x26f6bc['uniqueid']),_0x26f6bc);dials[_0x26f6bc[_0x5dcd('0x6')]]=_['assign'](dials[_0x26f6bc[_0x5dcd('0x6')]],_0x26f6bc);dials[_0x26f6bc[_0x5dcd('0x6')]][_0x5dcd('0x1f')]=utils[_0x5dcd('0x20')]();dials[_0x26f6bc[_0x5dcd('0x6')]][_0x5dcd('0x21')]=_0x5dcd('0x22');utils[_0x5dcd('0x3')](util[_0x5dcd('0x4')](_0x5dcd('0x23'),_0x26f6bc['uniqueid'],dials[_0x26f6bc[_0x5dcd('0x6')]][_0x5dcd('0x1f')]));}}catch(_0x55356e){utils[_0x5dcd('0x15')](util[_0x5dcd('0x4')]('[%s][dials][dialbegin]',_0x26f6bc[_0x5dcd('0x6')]),_0x55356e);}};exports[_0x5dcd('0x24')]=function(_0x198dc9){try{if(!_[_0x5dcd('0x18')](dials[_0x198dc9['uniqueid']])){utils[_0x5dcd('0xd')](util[_0x5dcd('0x4')](_0x5dcd('0x25'),_0x198dc9[_0x5dcd('0x6')]),_0x198dc9);dials[_0x198dc9['uniqueid']][_0x5dcd('0xa')]=_0x198dc9['dialstatus'];if(_0x198dc9[_0x5dcd('0xa')]==_0x5dcd('0x26')){dials[_0x198dc9[_0x5dcd('0x6')]]=_[_0x5dcd('0x27')](dials[_0x198dc9[_0x5dcd('0x6')]],_0x198dc9);dials[_0x198dc9[_0x5dcd('0x6')]][_0x5dcd('0x28')]=utils[_0x5dcd('0x20')]();dials[_0x198dc9['uniqueid']][_0x5dcd('0x21')]=_0x5dcd('0x29');utils[_0x5dcd('0x3')](util[_0x5dcd('0x4')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x198dc9['uniqueid'],_0x198dc9[_0x5dcd('0xa')],dials[_0x198dc9[_0x5dcd('0x6')]][_0x5dcd('0x28')]));}else{utils[_0x5dcd('0x3')](util[_0x5dcd('0x4')](_0x5dcd('0x2a'),_0x198dc9['uniqueid'],_0x198dc9['dialstatus']));}}}catch(_0xfd4dd6){utils[_0x5dcd('0x15')](util[_0x5dcd('0x4')]('[%s][dials][dialend]',_0x198dc9['uniqueid']),_0xfd4dd6);}};exports[_0x5dcd('0x2b')]=function(_0x4074c5){try{if(!_[_0x5dcd('0x18')](dials[_0x4074c5[_0x5dcd('0x6')]])){utils[_0x5dcd('0xd')](util[_0x5dcd('0x4')](_0x5dcd('0x2c'),_0x4074c5['uniqueid']),_0x4074c5);utils[_0x5dcd('0x3')](util[_0x5dcd('0x4')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x4074c5[_0x5dcd('0x6')],_0x4074c5[_0x5dcd('0x8')],_0x4074c5[_0x5dcd('0x2d')],_0x4074c5[_0x5dcd('0x2e')]));dials[_0x4074c5[_0x5dcd('0x6')]]=_[_0x5dcd('0x27')](dials[_0x4074c5[_0x5dcd('0x6')]],{'endtime':utils[_0x5dcd('0x20')](),'lastevent':_0x5dcd('0x2f')});dials[_0x4074c5['uniqueid']][_0x5dcd('0x30')]=utils[_0x5dcd('0x31')](dials[_0x4074c5[_0x5dcd('0x6')]][_0x5dcd('0x32')],dials[_0x4074c5[_0x5dcd('0x6')]][_0x5dcd('0x1f')]);dials[_0x4074c5[_0x5dcd('0x6')]][_0x5dcd('0x33')]=utils['diffTime'](dials[_0x4074c5[_0x5dcd('0x6')]][_0x5dcd('0x28')]||dials[_0x4074c5[_0x5dcd('0x6')]][_0x5dcd('0x32')],dials[_0x4074c5['uniqueid']][_0x5dcd('0x1f')]);dials[_0x4074c5['uniqueid']]['billableseconds']=dials[_0x4074c5['uniqueid']][_0x5dcd('0x28')]?utils[_0x5dcd('0x31')](dials[_0x4074c5[_0x5dcd('0x6')]][_0x5dcd('0x32')],dials[_0x4074c5[_0x5dcd('0x6')]][_0x5dcd('0x28')]):0x0;writeDB(dials[_0x4074c5['uniqueid']]);}}catch(_0x3e200d){utils[_0x5dcd('0x15')](util[_0x5dcd('0x4')](_0x5dcd('0x2c'),_0x4074c5[_0x5dcd('0x6')]),_0x3e200d);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index a45462f..f1af7d4 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 _0x6f0f=['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]','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','local','port','asterisk','username','password','keepConnected','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]'];(function(_0x3ea23a,_0x506a32){var _0x5823f=function(_0x2ae7c0){while(--_0x2ae7c0){_0x3ea23a['push'](_0x3ea23a['shift']());}};_0x5823f(++_0x506a32);}(_0x6f0f,0x65));var _0xf6f0=function(_0x45a91c,_0x56541f){_0x45a91c=_0x45a91c-0x0;var _0x587932=_0x6f0f[_0x45a91c];return _0x587932;};var AsteriskManager=require(_0xf6f0('0x0'));var config=require(_0xf6f0('0x1'));var utils=require(_0xf6f0('0x2'));var util=require(_0xf6f0('0x3'));var isXDREnabled=config[_0xf6f0('0x4')]&&config[_0xf6f0('0x4')][_0xf6f0('0x5')]?!config[_0xf6f0('0x4')][_0xf6f0('0x5')]:!![];var isProduction=config['env']==='production'||![];var isLocalAsterisk=config[_0xf6f0('0x4')]&&config[_0xf6f0('0x4')][_0xf6f0('0x6')]===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0xf6f0('0x7')],config[_0xf6f0('0x8')]['ip'],config[_0xf6f0('0x8')][_0xf6f0('0x9')],config['asterisk'][_0xf6f0('0xa')],!![]);ami[_0xf6f0('0xb')]();if(!isXDREnabled){utils['info']('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0xf6f0('0xc')](_0xf6f0('0xd'));}else{var agents=require(_0xf6f0('0xe'));var calls=require(_0xf6f0('0xf'));var queues=require(_0xf6f0('0x10'));var recordings=require('./recordings.controller');var members=require(_0xf6f0('0x11'));var dials=require(_0xf6f0('0x12'));var transfers=require(_0xf6f0('0x13'));var core=require(_0xf6f0('0x14'));ami['on']('connect',core[_0xf6f0('0x15')]);ami['on'](_0xf6f0('0x16'),core[_0xf6f0('0x16')]);ami['on']('fullybooted',core[_0xf6f0('0x17')]);ami['on'](_0xf6f0('0x18'),core[_0xf6f0('0x18')]);ami['on'](_0xf6f0('0x19'),core[_0xf6f0('0x19')]);ami['on']('managerevent',core[_0xf6f0('0x1a')]);ami['on'](_0xf6f0('0x1b'),function(_0x10e20a){try{utils[_0xf6f0('0x1c')](util[_0xf6f0('0x1d')]('[%s][index][devicestatechange]',_0x10e20a['device']),_0x10e20a);members[_0xf6f0('0x1b')](_0x10e20a);}catch(_0x3b5ee6){utils[_0xf6f0('0x18')](util[_0xf6f0('0x1d')](_0xf6f0('0x1e'),_0x10e20a[_0xf6f0('0x1f')]),_0x3b5ee6);}});ami['on'](_0xf6f0('0x20'),function(_0x16b01a){try{utils[_0xf6f0('0x1c')](util[_0xf6f0('0x1d')](_0xf6f0('0x21'),_0x16b01a[_0xf6f0('0x22')]),_0x16b01a);agents['agentcalled'](_0x16b01a);}catch(_0x3a87d6){utils['error'](util[_0xf6f0('0x1d')](_0xf6f0('0x21'),_0x16b01a['uniqueid']),_0x3a87d6);}});ami['on'](_0xf6f0('0x23'),function(_0x5ca461){try{utils[_0xf6f0('0x1c')](util[_0xf6f0('0x1d')](_0xf6f0('0x24'),_0x5ca461['uniqueid']),_0x5ca461);agents[_0xf6f0('0x23')](_0x5ca461);}catch(_0xfc7739){utils[_0xf6f0('0x18')](util[_0xf6f0('0x1d')]('[%s][index][agentringnoanswer]',_0x5ca461['uniqueid']),_0xfc7739);}});ami['on'](_0xf6f0('0x25'),function(_0x5cbc42){try{utils[_0xf6f0('0x1c')](util['format'](_0xf6f0('0x26'),_0x5cbc42[_0xf6f0('0x22')]),_0x5cbc42);agents[_0xf6f0('0x25')](_0x5cbc42);queues[_0xf6f0('0x25')](_0x5cbc42);}catch(_0x4e2717){utils[_0xf6f0('0x18')](util[_0xf6f0('0x1d')](_0xf6f0('0x26'),_0x5cbc42[_0xf6f0('0x22')]),_0x4e2717);}});ami['on'](_0xf6f0('0x27'),function(_0x957bab){try{utils[_0xf6f0('0x1c')](util[_0xf6f0('0x1d')]('[%s][index][agentcomplete]',_0x957bab[_0xf6f0('0x22')]),_0x957bab);agents[_0xf6f0('0x27')](_0x957bab);queues[_0xf6f0('0x27')](_0x957bab);members['agentcomplete'](_0x957bab);}catch(_0x1ad7e3){utils[_0xf6f0('0x18')](util[_0xf6f0('0x1d')](_0xf6f0('0x28'),_0x957bab[_0xf6f0('0x22')]),_0x1ad7e3);}});ami['on'](_0xf6f0('0x29'),function(_0x170949){try{utils[_0xf6f0('0x1c')](util[_0xf6f0('0x1d')](_0xf6f0('0x2a'),_0x170949[_0xf6f0('0x22')]),_0x170949);agents[_0xf6f0('0x29')](_0x170949);queues[_0xf6f0('0x29')](_0x170949);}catch(_0x2cdd5b){utils[_0xf6f0('0x18')](util['format']('[%s][index][queuecallerabandon]',_0x170949[_0xf6f0('0x22')]),_0x2cdd5b);}});ami['on'](_0xf6f0('0x2b'),function(_0xf26734){try{utils[_0xf6f0('0x1c')](util['format'](_0xf6f0('0x2c'),_0xf26734[_0xf6f0('0x22')]),_0xf26734);queues[_0xf6f0('0x2b')](_0xf26734);recordings[_0xf6f0('0x2b')](_0xf26734);}catch(_0x2054c9){utils[_0xf6f0('0x18')](util['format'](_0xf6f0('0x2c'),_0xf26734['uniqueid']),_0x2054c9);}});ami['on'](_0xf6f0('0x2d'),function(_0x1770ca){try{utils[_0xf6f0('0x1c')](util[_0xf6f0('0x1d')](_0xf6f0('0x2e'),_0x1770ca[_0xf6f0('0x22')]),_0x1770ca);queues[_0xf6f0('0x2d')](_0x1770ca);}catch(_0x47f024){utils[_0xf6f0('0x18')](util[_0xf6f0('0x1d')](_0xf6f0('0x2e'),_0x1770ca[_0xf6f0('0x22')]),_0x47f024);}});ami['on'](_0xf6f0('0x2f'),function(_0x1753e4){try{utils[_0xf6f0('0x1c')](util[_0xf6f0('0x1d')](_0xf6f0('0x30'),_0x1753e4['uniqueid']),_0x1753e4);queues[_0xf6f0('0x2f')](_0x1753e4);calls['musiconholdstart'](_0x1753e4);}catch(_0x2f0f11){utils['error'](util['format'](_0xf6f0('0x30'),_0x1753e4[_0xf6f0('0x22')]),_0x2f0f11);}});ami['on'](_0xf6f0('0x31'),function(_0x3ac0dc){try{utils[_0xf6f0('0x1c')](util[_0xf6f0('0x1d')](_0xf6f0('0x32'),_0x3ac0dc[_0xf6f0('0x22')]),_0x3ac0dc);queues[_0xf6f0('0x31')](_0x3ac0dc);calls[_0xf6f0('0x31')](_0x3ac0dc);}catch(_0x56928c){utils[_0xf6f0('0x18')](util[_0xf6f0('0x1d')](_0xf6f0('0x32'),_0x3ac0dc[_0xf6f0('0x22')]),_0x56928c);}});ami['on'](_0xf6f0('0x33'),function(_0x210341){try{utils[_0xf6f0('0x1c')](util['format']('[%s][index][newstate]',_0x210341[_0xf6f0('0x22')]),_0x210341);calls[_0xf6f0('0x33')](_0x210341);recordings['newstate'](_0x210341);}catch(_0x2e4575){utils['error'](util[_0xf6f0('0x1d')](_0xf6f0('0x34'),_0x210341[_0xf6f0('0x22')]),_0x2e4575);}});ami['on'](_0xf6f0('0x35'),function(_0x37a270){try{utils[_0xf6f0('0x1c')](util['format'](_0xf6f0('0x36'),_0x37a270[_0xf6f0('0x22')]),_0x37a270);calls[_0xf6f0('0x35')](_0x37a270);recordings['hangup'](_0x37a270);dials[_0xf6f0('0x35')](_0x37a270);agents[_0xf6f0('0x35')](_0x37a270);queues[_0xf6f0('0x35')](_0x37a270);}catch(_0x395e3b){utils[_0xf6f0('0x18')](util[_0xf6f0('0x1d')]('[%s][index][hangup]',_0x37a270['uniqueid']),_0x395e3b);}});ami['on'](_0xf6f0('0x37'),function(_0x34d181){try{utils['debug'](util[_0xf6f0('0x1d')](_0xf6f0('0x38'),_0x34d181[_0xf6f0('0x22')]),_0x34d181);members['cdr'](_0x34d181);}catch(_0x59477a){utils['error'](util['format'](_0xf6f0('0x38'),_0x34d181['uniqueid']),_0x59477a);}});ami['on']('blindtransfer',function(_0x18e550){try{utils[_0xf6f0('0x1c')](util[_0xf6f0('0x1d')](_0xf6f0('0x39'),_0x18e550['uniqueid']),_0x18e550);queues[_0xf6f0('0x3a')](_0x18e550);agents['blindtransfer'](_0x18e550);transfers[_0xf6f0('0x3a')](_0x18e550);}catch(_0x2c6c1d){utils['error'](util[_0xf6f0('0x1d')](_0xf6f0('0x39'),_0x18e550[_0xf6f0('0x22')]),_0x2c6c1d);}});ami['on'](_0xf6f0('0x3b'),function(_0x54b436){try{utils['debug'](util[_0xf6f0('0x1d')](_0xf6f0('0x3c'),_0x54b436[_0xf6f0('0x3d')]),_0x54b436);queues[_0xf6f0('0x3b')](_0x54b436);transfers['attendedtransfer'](_0x54b436);agents[_0xf6f0('0x3b')](_0x54b436);calls[_0xf6f0('0x3b')](_0x54b436);}catch(_0x38950b){utils[_0xf6f0('0x18')](util[_0xf6f0('0x1d')](_0xf6f0('0x3c'),_0x54b436[_0xf6f0('0x3d')]),_0x38950b);}});ami['on'](_0xf6f0('0x3e'),function(_0x280eb9){try{utils['debug'](util[_0xf6f0('0x1d')]('[%s][index][varset]',_0x280eb9[_0xf6f0('0x22')]),_0x280eb9);queues[_0xf6f0('0x3e')](_0x280eb9);recordings['varset'](_0x280eb9);calls[_0xf6f0('0x3e')](_0x280eb9);dials[_0xf6f0('0x3e')](_0x280eb9);}catch(_0x55b588){utils[_0xf6f0('0x18')](util[_0xf6f0('0x1d')](_0xf6f0('0x3f'),_0x280eb9[_0xf6f0('0x22')]),_0x55b588);}});ami['on'](_0xf6f0('0x40'),function(_0x506c6f){try{utils['debug'](util[_0xf6f0('0x1d')](_0xf6f0('0x41'),_0x506c6f[_0xf6f0('0x22')]),_0x506c6f);calls[_0xf6f0('0x40')](_0x506c6f);recordings[_0xf6f0('0x40')](_0x506c6f);dials[_0xf6f0('0x40')](_0x506c6f);}catch(_0x408431){utils[_0xf6f0('0x18')](util[_0xf6f0('0x1d')](_0xf6f0('0x41'),_0x506c6f[_0xf6f0('0x22')]),_0x408431);}});ami['on'](_0xf6f0('0x42'),function(_0x56c9ec){try{utils[_0xf6f0('0x1c')](util[_0xf6f0('0x1d')]('[%s][index][newchannel]',_0x56c9ec['uniqueid']),_0x56c9ec);calls[_0xf6f0('0x42')](_0x56c9ec);recordings['newchannel'](_0x56c9ec);}catch(_0x4d88ac){utils['error'](util[_0xf6f0('0x1d')]('[%s][index][newchannel]',_0x56c9ec[_0xf6f0('0x22')]),_0x4d88ac);}});ami['on'](_0xf6f0('0x43'),function(_0x2fb10c){try{utils['debug'](util[_0xf6f0('0x1d')]('[%s][index][dialbegin]',_0x2fb10c[_0xf6f0('0x22')]),_0x2fb10c);dials['dialbegin'](_0x2fb10c);}catch(_0x48adc4){utils['error'](util[_0xf6f0('0x1d')](_0xf6f0('0x44'),_0x2fb10c['uniqueid']),_0x48adc4);}});ami['on'](_0xf6f0('0x45'),function(_0x5c624f){try{utils[_0xf6f0('0x1c')](util[_0xf6f0('0x1d')](_0xf6f0('0x46'),_0x5c624f[_0xf6f0('0x22')]),_0x5c624f);dials[_0xf6f0('0x45')](_0x5c624f);}catch(_0x1d26b2){utils[_0xf6f0('0x18')](util[_0xf6f0('0x1d')](_0xf6f0('0x46'),_0x5c624f['uniqueid']),_0x1d26b2);}});} \ No newline at end of file +var _0xf01c=['newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','[%s][index][dialend]','dialend','asterisk-manager','../../config/environment','util','xdr','disabled','env','production','local','asterisk','port','username','password','keepConnected','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','uniqueid','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]'];(function(_0x58aa6d,_0x3faa2d){var _0x483794=function(_0x12ea99){while(--_0x12ea99){_0x58aa6d['push'](_0x58aa6d['shift']());}};_0x483794(++_0x3faa2d);}(_0xf01c,0x129));var _0xcf01=function(_0x189c67,_0x55f88d){_0x189c67=_0x189c67-0x0;var _0x406e91=_0xf01c[_0x189c67];return _0x406e91;};var AsteriskManager=require(_0xcf01('0x0'));var config=require(_0xcf01('0x1'));var utils=require('./utils');var util=require(_0xcf01('0x2'));var isXDREnabled=config[_0xcf01('0x3')]&&config[_0xcf01('0x3')][_0xcf01('0x4')]?!config[_0xcf01('0x3')][_0xcf01('0x4')]:!![];var isProduction=config[_0xcf01('0x5')]===_0xcf01('0x6')||![];var isLocalAsterisk=config['xdr']&&config[_0xcf01('0x3')][_0xcf01('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0xcf01('0x8')][_0xcf01('0x9')],config[_0xcf01('0x8')]['ip'],config['asterisk'][_0xcf01('0xa')],config[_0xcf01('0x8')][_0xcf01('0xb')],!![]);ami[_0xcf01('0xc')]();if(!isXDREnabled){utils[_0xcf01('0xd')](_0xcf01('0xe'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xcf01('0xd')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0xcf01('0xf'));var calls=require(_0xcf01('0x10'));var queues=require(_0xcf01('0x11'));var recordings=require(_0xcf01('0x12'));var members=require('./members.controller');var dials=require('./dials.controller');var transfers=require(_0xcf01('0x13'));var core=require(_0xcf01('0x14'));ami['on'](_0xcf01('0x15'),core[_0xcf01('0x15')]);ami['on']('shutdown',core[_0xcf01('0x16')]);ami['on'](_0xcf01('0x17'),core[_0xcf01('0x17')]);ami['on'](_0xcf01('0x18'),core[_0xcf01('0x18')]);ami['on'](_0xcf01('0x19'),core['close']);ami['on'](_0xcf01('0x1a'),core[_0xcf01('0x1a')]);ami['on'](_0xcf01('0x1b'),function(_0x587682){try{utils[_0xcf01('0x1c')](util[_0xcf01('0x1d')]('[%s][index][devicestatechange]',_0x587682['device']),_0x587682);members[_0xcf01('0x1b')](_0x587682);}catch(_0x336727){utils['error'](util[_0xcf01('0x1d')](_0xcf01('0x1e'),_0x587682[_0xcf01('0x1f')]),_0x336727);}});ami['on'](_0xcf01('0x20'),function(_0x3e1948){try{utils[_0xcf01('0x1c')](util['format'](_0xcf01('0x21'),_0x3e1948['uniqueid']),_0x3e1948);agents['agentcalled'](_0x3e1948);}catch(_0x4fd450){utils[_0xcf01('0x18')](util[_0xcf01('0x1d')](_0xcf01('0x21'),_0x3e1948['uniqueid']),_0x4fd450);}});ami['on'](_0xcf01('0x22'),function(_0x215bdd){try{utils[_0xcf01('0x1c')](util[_0xcf01('0x1d')](_0xcf01('0x23'),_0x215bdd['uniqueid']),_0x215bdd);agents[_0xcf01('0x22')](_0x215bdd);}catch(_0x3ad26c){utils['error'](util['format'](_0xcf01('0x23'),_0x215bdd[_0xcf01('0x24')]),_0x3ad26c);}});ami['on'](_0xcf01('0x25'),function(_0x13d976){try{utils[_0xcf01('0x1c')](util['format'](_0xcf01('0x26'),_0x13d976[_0xcf01('0x24')]),_0x13d976);agents[_0xcf01('0x25')](_0x13d976);queues[_0xcf01('0x25')](_0x13d976);}catch(_0x640eb2){utils['error'](util[_0xcf01('0x1d')](_0xcf01('0x26'),_0x13d976[_0xcf01('0x24')]),_0x640eb2);}});ami['on']('agentcomplete',function(_0x53381c){try{utils[_0xcf01('0x1c')](util['format'](_0xcf01('0x27'),_0x53381c[_0xcf01('0x24')]),_0x53381c);agents[_0xcf01('0x28')](_0x53381c);queues[_0xcf01('0x28')](_0x53381c);members[_0xcf01('0x28')](_0x53381c);}catch(_0x5c3f87){utils[_0xcf01('0x18')](util['format'](_0xcf01('0x27'),_0x53381c[_0xcf01('0x24')]),_0x5c3f87);}});ami['on'](_0xcf01('0x29'),function(_0x99b626){try{utils[_0xcf01('0x1c')](util[_0xcf01('0x1d')](_0xcf01('0x2a'),_0x99b626[_0xcf01('0x24')]),_0x99b626);agents['queuecallerabandon'](_0x99b626);queues[_0xcf01('0x29')](_0x99b626);}catch(_0x25f2f6){utils[_0xcf01('0x18')](util[_0xcf01('0x1d')](_0xcf01('0x2a'),_0x99b626[_0xcf01('0x24')]),_0x25f2f6);}});ami['on']('queuecallerjoin',function(_0x3aa51c){try{utils[_0xcf01('0x1c')](util[_0xcf01('0x1d')]('[%s][index][queuecallerjoin]',_0x3aa51c[_0xcf01('0x24')]),_0x3aa51c);queues[_0xcf01('0x2b')](_0x3aa51c);recordings[_0xcf01('0x2b')](_0x3aa51c);}catch(_0x3aebb4){utils[_0xcf01('0x18')](util[_0xcf01('0x1d')]('[%s][index][queuecallerjoin]',_0x3aa51c[_0xcf01('0x24')]),_0x3aebb4);}});ami['on'](_0xcf01('0x2c'),function(_0x4d85a0){try{utils[_0xcf01('0x1c')](util[_0xcf01('0x1d')](_0xcf01('0x2d'),_0x4d85a0['uniqueid']),_0x4d85a0);queues[_0xcf01('0x2c')](_0x4d85a0);}catch(_0x13c60e){utils['error'](util[_0xcf01('0x1d')]('[%s][index][queuecallerleave]',_0x4d85a0[_0xcf01('0x24')]),_0x13c60e);}});ami['on']('musiconholdstart',function(_0x38b768){try{utils['debug'](util['format'](_0xcf01('0x2e'),_0x38b768['uniqueid']),_0x38b768);queues[_0xcf01('0x2f')](_0x38b768);calls['musiconholdstart'](_0x38b768);}catch(_0x46c411){utils[_0xcf01('0x18')](util[_0xcf01('0x1d')](_0xcf01('0x2e'),_0x38b768[_0xcf01('0x24')]),_0x46c411);}});ami['on']('musiconholdstop',function(_0x57ba91){try{utils['debug'](util[_0xcf01('0x1d')](_0xcf01('0x30'),_0x57ba91[_0xcf01('0x24')]),_0x57ba91);queues['musiconholdstop'](_0x57ba91);calls[_0xcf01('0x31')](_0x57ba91);}catch(_0x239cef){utils['error'](util[_0xcf01('0x1d')](_0xcf01('0x30'),_0x57ba91[_0xcf01('0x24')]),_0x239cef);}});ami['on'](_0xcf01('0x32'),function(_0x5c1676){try{utils[_0xcf01('0x1c')](util['format'](_0xcf01('0x33'),_0x5c1676[_0xcf01('0x24')]),_0x5c1676);calls['newstate'](_0x5c1676);recordings['newstate'](_0x5c1676);}catch(_0x2f23b6){utils[_0xcf01('0x18')](util[_0xcf01('0x1d')]('[%s][index][newstate]',_0x5c1676[_0xcf01('0x24')]),_0x2f23b6);}});ami['on'](_0xcf01('0x34'),function(_0xe4e8de){try{utils[_0xcf01('0x1c')](util[_0xcf01('0x1d')](_0xcf01('0x35'),_0xe4e8de[_0xcf01('0x24')]),_0xe4e8de);calls[_0xcf01('0x34')](_0xe4e8de);recordings[_0xcf01('0x34')](_0xe4e8de);dials[_0xcf01('0x34')](_0xe4e8de);agents[_0xcf01('0x34')](_0xe4e8de);queues[_0xcf01('0x34')](_0xe4e8de);}catch(_0x5cf03f){utils[_0xcf01('0x18')](util['format'](_0xcf01('0x35'),_0xe4e8de[_0xcf01('0x24')]),_0x5cf03f);}});ami['on'](_0xcf01('0x36'),function(_0x4f8f30){try{utils[_0xcf01('0x1c')](util[_0xcf01('0x1d')]('[%s][index][cdr]',_0x4f8f30[_0xcf01('0x24')]),_0x4f8f30);members['cdr'](_0x4f8f30);}catch(_0x450fd4){utils[_0xcf01('0x18')](util[_0xcf01('0x1d')](_0xcf01('0x37'),_0x4f8f30[_0xcf01('0x24')]),_0x450fd4);}});ami['on'](_0xcf01('0x38'),function(_0x50ff52){try{utils[_0xcf01('0x1c')](util['format']('[%s][index][blindtransfer]',_0x50ff52['uniqueid']),_0x50ff52);queues[_0xcf01('0x38')](_0x50ff52);agents[_0xcf01('0x38')](_0x50ff52);transfers[_0xcf01('0x38')](_0x50ff52);}catch(_0x3786a6){utils[_0xcf01('0x18')](util[_0xcf01('0x1d')](_0xcf01('0x39'),_0x50ff52[_0xcf01('0x24')]),_0x3786a6);}});ami['on'](_0xcf01('0x3a'),function(_0x54ee4d){try{utils[_0xcf01('0x1c')](util['format'](_0xcf01('0x3b'),_0x54ee4d[_0xcf01('0x3c')]),_0x54ee4d);queues[_0xcf01('0x3a')](_0x54ee4d);transfers[_0xcf01('0x3a')](_0x54ee4d);agents['attendedtransfer'](_0x54ee4d);calls['attendedtransfer'](_0x54ee4d);}catch(_0x39c7e3){utils[_0xcf01('0x18')](util['format'](_0xcf01('0x3b'),_0x54ee4d[_0xcf01('0x3c')]),_0x39c7e3);}});ami['on'](_0xcf01('0x3d'),function(_0x4b920f){try{utils[_0xcf01('0x1c')](util[_0xcf01('0x1d')](_0xcf01('0x3e'),_0x4b920f['uniqueid']),_0x4b920f);queues['varset'](_0x4b920f);recordings['varset'](_0x4b920f);calls['varset'](_0x4b920f);dials['varset'](_0x4b920f);}catch(_0x2cf985){utils[_0xcf01('0x18')](util[_0xcf01('0x1d')]('[%s][index][varset]',_0x4b920f['uniqueid']),_0x2cf985);}});ami['on'](_0xcf01('0x3f'),function(_0x5d644c){try{utils[_0xcf01('0x1c')](util['format'](_0xcf01('0x40'),_0x5d644c[_0xcf01('0x24')]),_0x5d644c);calls[_0xcf01('0x3f')](_0x5d644c);recordings[_0xcf01('0x3f')](_0x5d644c);dials[_0xcf01('0x3f')](_0x5d644c);}catch(_0x1789fe){utils[_0xcf01('0x18')](util[_0xcf01('0x1d')]('[%s][index][newexten]',_0x5d644c[_0xcf01('0x24')]),_0x1789fe);}});ami['on']('newchannel',function(_0x6a84){try{utils['debug'](util[_0xcf01('0x1d')](_0xcf01('0x41'),_0x6a84[_0xcf01('0x24')]),_0x6a84);calls[_0xcf01('0x42')](_0x6a84);recordings['newchannel'](_0x6a84);}catch(_0x1109da){utils['error'](util[_0xcf01('0x1d')](_0xcf01('0x41'),_0x6a84[_0xcf01('0x24')]),_0x1109da);}});ami['on'](_0xcf01('0x43'),function(_0x47ee89){try{utils[_0xcf01('0x1c')](util[_0xcf01('0x1d')](_0xcf01('0x44'),_0x47ee89[_0xcf01('0x24')]),_0x47ee89);dials[_0xcf01('0x43')](_0x47ee89);}catch(_0x386417){utils[_0xcf01('0x18')](util[_0xcf01('0x1d')](_0xcf01('0x45'),_0x47ee89[_0xcf01('0x24')]),_0x386417);}});ami['on']('dialend',function(_0x213d61){try{utils[_0xcf01('0x1c')](util[_0xcf01('0x1d')](_0xcf01('0x46'),_0x213d61[_0xcf01('0x24')]),_0x213d61);dials[_0xcf01('0x47')](_0x213d61);}catch(_0x2fa081){utils[_0xcf01('0x18')](util[_0xcf01('0x1d')]('[%s][index][dialend]',_0x213d61[_0xcf01('0x24')]),_0x2fa081);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 1477a9c..91f7774 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 _0x8406=['[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][cdr]','channel','data1','data2','source','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','destination','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','uniqueid','interface','membername','type','getUserByInterface','then','name','internal','request','getUserByName','split','CreateMemberReport','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','agent','NOT_INUSE','isNil','exitAt','now','duration','enterAt'];(function(_0x54fb56,_0x28bc6c){var _0x3e084b=function(_0x551483){while(--_0x551483){_0x54fb56['push'](_0x54fb56['shift']());}};_0x3e084b(++_0x28bc6c);}(_0x8406,0x10c));var _0x6840=function(_0x49f435,_0x2f6231){_0x49f435=_0x49f435-0x0;var _0x2b6df7=_0x8406[_0x49f435];return _0x2b6df7;};'use strict';var _=require(_0x6840('0x0'));var util=require(_0x6840('0x1'));var utils=require(_0x6840('0x2'));var members={};var exclude=[_0x6840('0x3'),_0x6840('0x4')];function writeDB(_0x4f2e70){utils[_0x6840('0x5')](util[_0x6840('0x6')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x4f2e70[_0x6840('0x7')],_0x4f2e70[_0x6840('0x8')],_0x4f2e70['channel'],_0x4f2e70['data2'],_0x4f2e70[_0x6840('0x9')],_0x4f2e70[_0x6840('0xa')]));if(_0x4f2e70[_0x6840('0x8')]){utils[_0x6840('0xb')](_0x4f2e70[_0x6840('0x8')])[_0x6840('0xc')](function(_0x214710){if(_0x214710){_0x4f2e70['membername']=_0x214710[_0x6840('0xd')];_0x4f2e70['internal']=_0x214710[_0x6840('0xe')];utils[_0x6840('0xf')]('CreateMemberReport',_0x4f2e70);}else{utils[_0x6840('0x10')](_0x4f2e70[_0x6840('0x8')][_0x6840('0x11')]('/')[0x1])['then'](function(_0x25f4b3){if(_0x25f4b3){_0x4f2e70[_0x6840('0x9')]=_0x25f4b3['name'];_0x4f2e70[_0x6840('0xe')]=_0x25f4b3[_0x6840('0xe')];utils[_0x6840('0xf')](_0x6840('0x12'),_0x4f2e70);}});}})[_0x6840('0x13')](function(_0x34953f){utils[_0x6840('0x14')](util[_0x6840('0x6')](_0x6840('0x15'),_0x4f2e70[_0x6840('0x7')]),_0x34953f);});}delete members[_0x4f2e70['interface']];}function startsWith(_0x349faa,_0x2b9c5b){return _[_0x6840('0x16')](_0x349faa,function(_0x566394){return _[_0x6840('0x17')](_0x2b9c5b,_0x566394);});}exports[_0x6840('0x18')]=function(_0x16c89d){try{utils[_0x6840('0x19')](util[_0x6840('0x6')]('[%s][members][devicestatechange]',members[_0x16c89d[_0x6840('0x1a')]]?members[_0x16c89d[_0x6840('0x1a')]][_0x6840('0x7')]:_0x16c89d[_0x6840('0x1a')]),_0x16c89d);utils[_0x6840('0x5')](util['format'](_0x6840('0x1b'),members[_0x16c89d[_0x6840('0x1a')]]?members[_0x16c89d[_0x6840('0x1a')]][_0x6840('0x7')]:_0x16c89d[_0x6840('0x1a')],_0x16c89d[_0x6840('0x1c')],_0x16c89d[_0x6840('0x1a')]));switch(_0x16c89d[_0x6840('0x1c')]){case _0x6840('0x1d'):case _0x6840('0x1e'):if(!startsWith(exclude,_0x16c89d[_0x6840('0x1a')])){members[_0x16c89d[_0x6840('0x1a')]]={'channel':'voice','interface':_0x16c89d[_0x6840('0x1a')],'type':'TALKING','enterAt':utils['now'](),'role':_0x6840('0x1f')};}break;case _0x6840('0x20'):if(!_[_0x6840('0x21')](members[_0x16c89d['device']])){members[_0x16c89d['device']][_0x6840('0x22')]=utils[_0x6840('0x23')]();members[_0x16c89d[_0x6840('0x1a')]][_0x6840('0x24')]=utils['diffTime'](members[_0x16c89d['device']][_0x6840('0x22')],members[_0x16c89d[_0x6840('0x1a')]][_0x6840('0x25')]);if(members[_0x16c89d[_0x6840('0x1a')]][_0x6840('0x7')]){writeDB(members[_0x16c89d['device']]);}}break;default:break;}}catch(_0x4c5135){utils['error'](util['format']('[%s][members][devicestatechange]',members[_0x16c89d['device']]?members[_0x16c89d[_0x6840('0x1a')]][_0x6840('0x7')]:_0x16c89d[_0x6840('0x1a')]),_0x4c5135);}};exports['agentcomplete']=function(_0xf6da35){try{if(!_['isNil'](members[_0xf6da35['interface']])){utils['debug'](util['format'](_0x6840('0x26'),_0xf6da35['uniqueid']),_0xf6da35);utils['info'](util['format'](_0x6840('0x27'),_0xf6da35[_0x6840('0x7')],_0xf6da35[_0x6840('0x8')],_0xf6da35[_0x6840('0x28')]));members[_0xf6da35['interface']]=_[_0x6840('0x29')](members[_0xf6da35[_0x6840('0x8')]],{'data4':_0xf6da35['queue'],'uniqueid':_0xf6da35[_0x6840('0x7')]});}}catch(_0x24b431){utils[_0x6840('0x14')](util[_0x6840('0x6')](_0x6840('0x26'),_0xf6da35[_0x6840('0x7')]),_0x24b431);}};exports['cdr']=function(_0xffb612){try{utils['debug'](util[_0x6840('0x6')](_0x6840('0x2a'),_0xffb612['uniqueid']),_0xffb612);if(_0xffb612[_0x6840('0x2b')]){var _0x2cf1f8=_0xffb612[_0x6840('0x2b')][_0x6840('0x11')]('-')[0x0];if(!_[_0x6840('0x21')](members[_0x2cf1f8])){members[_0x2cf1f8]=_['assign'](members[_0x2cf1f8],{'data1':members[_0x2cf1f8][_0x6840('0x2c')]||_0xffb612[_0x6840('0xa')],'data2':members[_0x2cf1f8][_0x6840('0x2d')]||_0xffb612[_0x6840('0x2e')],'data3':members[_0x2cf1f8][_0x6840('0x2f')]||_0xffb612['destination'],'uniqueid':members[_0x2cf1f8][_0x6840('0x7')]||_0xffb612[_0x6840('0x7')]});utils['info'](util[_0x6840('0x6')](_0x6840('0x30'),_0xffb612[_0x6840('0x7')],members[_0x2cf1f8][_0x6840('0x2c')],members[_0x2cf1f8][_0x6840('0x2d')],members[_0x2cf1f8][_0x6840('0x2f')]));if(members[_0x2cf1f8][_0x6840('0x22')]){writeDB(members[_0x2cf1f8]);}}}if(_0xffb612[_0x6840('0x31')]){var _0x3a3316=_0xffb612['destinationchannel'][_0x6840('0x11')]('-')[0x0];if(!_['isNil'](members[_0x3a3316])){members[_0x3a3316]=_[_0x6840('0x29')](members[_0x3a3316],{'data1':members[_0x3a3316]['data1']||_0xffb612[_0x6840('0xa')],'data2':members[_0x3a3316][_0x6840('0x2d')]||_0xffb612[_0x6840('0x2e')],'data3':members[_0x3a3316][_0x6840('0x2f')]||_0xffb612[_0x6840('0x32')],'uniqueid':members[_0x3a3316][_0x6840('0x7')]||_0xffb612[_0x6840('0x7')]});utils['info'](util['format'](_0x6840('0x30'),_0xffb612[_0x6840('0x7')],members[_0x3a3316][_0x6840('0x2c')],members[_0x3a3316][_0x6840('0x2d')],members[_0x3a3316][_0x6840('0x2f')]));if(members[_0x3a3316][_0x6840('0x22')]){writeDB(members[_0x3a3316]);}}}}catch(_0x420611){utils[_0x6840('0x14')](util[_0x6840('0x6')]('[%s][members][cdr]',_0xffb612['uniqueid']),_0x420611);}}; \ No newline at end of file +var _0xb88f=['interface','name','internal','CreateMemberReport','getUserByName','request','catch','error','[%s][members][writeDB]','startsWith','devicestatechange','[%s][members][devicestatechange]','device','state','INUSE','BUSY','voice','NOT_INUSE','isNil','exitAt','diffTime','debug','queue','assign','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','data1','type','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','split','util','Local/_attended@transfer','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','channel','data2','membername'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0xb88f,0x124));var _0xfb88=function(_0x152678,_0x11e0ac){_0x152678=_0x152678-0x0;var _0x311a9=_0xb88f[_0x152678];return _0x311a9;};'use strict';var _=require('lodash');var util=require(_0xfb88('0x0'));var utils=require('./utils');var members={};var exclude=[_0xfb88('0x1'),'Queue:'];function writeDB(_0x1b8b3e){utils[_0xfb88('0x2')](util[_0xfb88('0x3')](_0xfb88('0x4'),_0x1b8b3e[_0xfb88('0x5')],_0x1b8b3e['interface'],_0x1b8b3e[_0xfb88('0x6')],_0x1b8b3e[_0xfb88('0x7')],_0x1b8b3e[_0xfb88('0x8')],_0x1b8b3e['type']));if(_0x1b8b3e[_0xfb88('0x9')]){utils['getUserByInterface'](_0x1b8b3e[_0xfb88('0x9')])['then'](function(_0x4d6d92){if(_0x4d6d92){_0x1b8b3e[_0xfb88('0x8')]=_0x4d6d92[_0xfb88('0xa')];_0x1b8b3e[_0xfb88('0xb')]=_0x4d6d92['internal'];utils['request'](_0xfb88('0xc'),_0x1b8b3e);}else{utils[_0xfb88('0xd')](_0x1b8b3e[_0xfb88('0x9')]['split']('/')[0x1])['then'](function(_0x49e9b1){if(_0x49e9b1){_0x1b8b3e[_0xfb88('0x8')]=_0x49e9b1[_0xfb88('0xa')];_0x1b8b3e[_0xfb88('0xb')]=_0x49e9b1[_0xfb88('0xb')];utils[_0xfb88('0xe')](_0xfb88('0xc'),_0x1b8b3e);}});}})[_0xfb88('0xf')](function(_0x5c9ec7){utils[_0xfb88('0x10')](util[_0xfb88('0x3')](_0xfb88('0x11'),_0x1b8b3e[_0xfb88('0x5')]),_0x5c9ec7);});}delete members[_0x1b8b3e['interface']];}function startsWith(_0x5c595a,_0x7f6e25){return _['some'](_0x5c595a,function(_0x2d99c6){return _[_0xfb88('0x12')](_0x7f6e25,_0x2d99c6);});}exports[_0xfb88('0x13')]=function(_0x66fab){try{utils['debug'](util[_0xfb88('0x3')](_0xfb88('0x14'),members[_0x66fab[_0xfb88('0x15')]]?members[_0x66fab['device']]['uniqueid']:_0x66fab[_0xfb88('0x15')]),_0x66fab);utils[_0xfb88('0x2')](util['format']('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x66fab[_0xfb88('0x15')]]?members[_0x66fab['device']]['uniqueid']:_0x66fab[_0xfb88('0x15')],_0x66fab[_0xfb88('0x16')],_0x66fab[_0xfb88('0x15')]));switch(_0x66fab[_0xfb88('0x16')]){case _0xfb88('0x17'):case _0xfb88('0x18'):if(!startsWith(exclude,_0x66fab['device'])){members[_0x66fab[_0xfb88('0x15')]]={'channel':_0xfb88('0x19'),'interface':_0x66fab[_0xfb88('0x15')],'type':'TALKING','enterAt':utils['now'](),'role':'agent'};}break;case _0xfb88('0x1a'):if(!_[_0xfb88('0x1b')](members[_0x66fab[_0xfb88('0x15')]])){members[_0x66fab['device']][_0xfb88('0x1c')]=utils['now']();members[_0x66fab[_0xfb88('0x15')]]['duration']=utils[_0xfb88('0x1d')](members[_0x66fab[_0xfb88('0x15')]][_0xfb88('0x1c')],members[_0x66fab[_0xfb88('0x15')]]['enterAt']);if(members[_0x66fab[_0xfb88('0x15')]][_0xfb88('0x5')]){writeDB(members[_0x66fab[_0xfb88('0x15')]]);}}break;default:break;}}catch(_0x482018){utils[_0xfb88('0x10')](util[_0xfb88('0x3')](_0xfb88('0x14'),members[_0x66fab[_0xfb88('0x15')]]?members[_0x66fab[_0xfb88('0x15')]]['uniqueid']:_0x66fab['device']),_0x482018);}};exports['agentcomplete']=function(_0x5e6837){try{if(!_[_0xfb88('0x1b')](members[_0x5e6837[_0xfb88('0x9')]])){utils[_0xfb88('0x1e')](util['format']('[%s][members][agentcomplete]',_0x5e6837[_0xfb88('0x5')]),_0x5e6837);utils['info'](util['format']('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x5e6837['uniqueid'],_0x5e6837[_0xfb88('0x9')],_0x5e6837[_0xfb88('0x1f')]));members[_0x5e6837[_0xfb88('0x9')]]=_[_0xfb88('0x20')](members[_0x5e6837[_0xfb88('0x9')]],{'data4':_0x5e6837[_0xfb88('0x1f')],'uniqueid':_0x5e6837[_0xfb88('0x5')]});}}catch(_0x167139){utils[_0xfb88('0x10')](util[_0xfb88('0x3')](_0xfb88('0x21'),_0x5e6837['uniqueid']),_0x167139);}};exports[_0xfb88('0x22')]=function(_0x530f86){try{utils[_0xfb88('0x1e')](util['format'](_0xfb88('0x23'),_0x530f86[_0xfb88('0x5')]),_0x530f86);if(_0x530f86[_0xfb88('0x6')]){var _0x5ec245=_0x530f86[_0xfb88('0x6')]['split']('-')[0x0];if(!_['isNil'](members[_0x5ec245])){members[_0x5ec245]=_[_0xfb88('0x20')](members[_0x5ec245],{'data1':members[_0x5ec245][_0xfb88('0x24')]||_0x530f86[_0xfb88('0x25')],'data2':members[_0x5ec245]['data2']||_0x530f86[_0xfb88('0x26')],'data3':members[_0x5ec245][_0xfb88('0x27')]||_0x530f86[_0xfb88('0x28')],'uniqueid':members[_0x5ec245][_0xfb88('0x5')]||_0x530f86[_0xfb88('0x5')]});utils[_0xfb88('0x2')](util[_0xfb88('0x3')](_0xfb88('0x29'),_0x530f86['uniqueid'],members[_0x5ec245]['data1'],members[_0x5ec245][_0xfb88('0x7')],members[_0x5ec245][_0xfb88('0x27')]));if(members[_0x5ec245]['exitAt']){writeDB(members[_0x5ec245]);}}}if(_0x530f86['destinationchannel']){var _0x4bf69d=_0x530f86['destinationchannel'][_0xfb88('0x2a')]('-')[0x0];if(!_[_0xfb88('0x1b')](members[_0x4bf69d])){members[_0x4bf69d]=_[_0xfb88('0x20')](members[_0x4bf69d],{'data1':members[_0x4bf69d]['data1']||_0x530f86['type'],'data2':members[_0x4bf69d][_0xfb88('0x7')]||_0x530f86[_0xfb88('0x26')],'data3':members[_0x4bf69d][_0xfb88('0x27')]||_0x530f86['destination'],'uniqueid':members[_0x4bf69d][_0xfb88('0x5')]||_0x530f86[_0xfb88('0x5')]});utils[_0xfb88('0x2')](util[_0xfb88('0x3')](_0xfb88('0x29'),_0x530f86[_0xfb88('0x5')],members[_0x4bf69d][_0xfb88('0x24')],members[_0x4bf69d][_0xfb88('0x7')],members[_0x4bf69d][_0xfb88('0x27')]));if(members[_0x4bf69d]['exitAt']){writeDB(members[_0x4bf69d]);}}}}catch(_0x2869fc){utils[_0xfb88('0x10')](util[_0xfb88('0x3')](_0xfb88('0x23'),_0x530f86[_0xfb88('0x5')]),_0x2869fc);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 93ee06c..4ce5ecd 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 _0x50ab=['reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transferexten','secondtransfereruniqueid','transfertargetlinkedid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','format','[%s][queues][queuecallerjoin]','uniqueid','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','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','value','CONTINUE','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queueposition','queuecallerabandonAt','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','[%s][queues][queuecallerleave]','agentconnect','[%s][queues][agentconnect]','membername','destaccountcode','agentcomplete','assigned'];(function(_0xe86e8b,_0x5da3bf){var _0x46341e=function(_0x51fb22){while(--_0x51fb22){_0xe86e8b['push'](_0xe86e8b['shift']());}};_0x46341e(++_0x5da3bf);}(_0x50ab,0x95));var _0xb50a=function(_0x529167,_0x426891){_0x529167=_0x529167-0x0;var _0x1adee1=_0x50ab[_0x529167];return _0x1adee1;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var queues={};function writeDB(_0x12b66d){utils[_0xb50a('0x0')](util['format'](_0xb50a('0x1'),_0x12b66d['uniqueid'],_0x12b66d[_0xb50a('0x2')],_0x12b66d['queue'],_0x12b66d[_0xb50a('0x3')],_0x12b66d[_0xb50a('0x4')],_0x12b66d[_0xb50a('0x5')],_0x12b66d[_0xb50a('0x6')]));if(_0x12b66d[_0xb50a('0x7')]){utils[_0xb50a('0x8')](_0x12b66d[_0xb50a('0x7')])[_0xb50a('0x9')](function(_0x30dff3){if(_0x30dff3){_0x12b66d[_0xb50a('0xa')]=_0x30dff3[_0xb50a('0xa')];}utils[_0xb50a('0xb')](_0xb50a('0xc'),_0x12b66d);});}else{utils[_0xb50a('0xb')]('CreateVoiceQueueReport',_0x12b66d);}if(_0x12b66d[_0xb50a('0xd')]){delete queues[_0x12b66d[_0xb50a('0xd')]];}else{delete queues[_0x12b66d['uniqueid']];}}exports[_0xb50a('0xe')]=function(_0x31e436){try{utils[_0xb50a('0xf')](util[_0xb50a('0x10')](_0xb50a('0x11'),_0x31e436[_0xb50a('0x12')]),_0x31e436);utils['info'](util[_0xb50a('0x10')](_0xb50a('0x13'),_0x31e436[_0xb50a('0x12')],_0x31e436[_0xb50a('0x7')],_0x31e436[_0xb50a('0x14')]));queues[_0x31e436[_0xb50a('0x12')]]=_[_0xb50a('0x15')](_0x31e436,{'originalposition':_0x31e436[_0xb50a('0x14')],'queuecallerjoinAt':utils[_0xb50a('0x16')](),'mohtime':0x0});}catch(_0x495002){utils[_0xb50a('0x17')](util[_0xb50a('0x10')](_0xb50a('0x11'),_0x31e436[_0xb50a('0x12')]),_0x495002);}};exports[_0xb50a('0x18')]=function(_0x357843){try{if(!_[_0xb50a('0x19')](queues[_0x357843['uniqueid']])){utils[_0xb50a('0xf')](util[_0xb50a('0x10')](_0xb50a('0x1a'),_0x357843[_0xb50a('0x12')]),_0x357843);if(queues[_0x357843[_0xb50a('0x12')]][_0xb50a('0x1b')]){if(!queues[_0x357843[_0xb50a('0x12')]][_0xb50a('0x1c')]&&!queues[_0x357843['uniqueid']][_0xb50a('0x1d')]){queues[_0x357843[_0xb50a('0x12')]][_0xb50a('0x1e')]=!![];queues[_0x357843[_0xb50a('0x12')]][_0xb50a('0x1f')]=utils[_0xb50a('0x16')]();queues[_0x357843[_0xb50a('0x12')]][_0xb50a('0x6')]=_0xb50a('0x20');}utils['info'](util['format'](_0xb50a('0x21'),_0x357843[_0xb50a('0x12')],queues[_0x357843[_0xb50a('0x12')]][_0xb50a('0x22')],queues[_0x357843[_0xb50a('0x12')]]['queuecallerexitreason']));writeDB(queues[_0x357843['uniqueid']]);}else if(queues[_0x357843[_0xb50a('0x12')]][_0xb50a('0xd')]){utils[_0xb50a('0x0')](util[_0xb50a('0x10')](_0xb50a('0x23'),_0x357843[_0xb50a('0x12')],queues[_0x357843['uniqueid']][_0xb50a('0x22')],queues[_0x357843[_0xb50a('0x12')]][_0xb50a('0xd')]));queues[queues[_0x357843[_0xb50a('0x12')]]['transfereduniqueid']]=queues[_0x357843[_0xb50a('0x12')]];queues[queues[_0x357843[_0xb50a('0x12')]]['transfereduniqueid']][_0xb50a('0x24')]=0x2;delete queues[_0x357843[_0xb50a('0x12')]];}}}catch(_0x156836){utils[_0xb50a('0x17')](util[_0xb50a('0x10')]('[%s][queues][hangup]',_0x357843[_0xb50a('0x12')]),_0x156836);}};exports[_0xb50a('0x25')]=function(_0x4c9c36){try{utils['debug'](util[_0xb50a('0x10')](_0xb50a('0x26'),_0x4c9c36[_0xb50a('0x12')]),_0x4c9c36);if(!_[_0xb50a('0x19')](_0x4c9c36['variable'][_0xb50a('0x27')])&&_0x4c9c36[_0xb50a('0x28')]['toUpperCase']()!==_0xb50a('0x29')){if(!_['isNil'](queues[_0x4c9c36['uniqueid']])){queues[_0x4c9c36[_0xb50a('0x12')]]['queuecallerabandon']=![];queues[_0x4c9c36[_0xb50a('0x12')]]['queuecallerabandonAt']=null;queues[_0x4c9c36[_0xb50a('0x12')]][_0xb50a('0x1d')]=!![];queues[_0x4c9c36[_0xb50a('0x12')]]['queuecallerexitAt']=utils['now']();queues[_0x4c9c36[_0xb50a('0x12')]][_0xb50a('0x6')]=_0x4c9c36['value'][_0xb50a('0x2a')]();utils['info'](util[_0xb50a('0x10')](_0xb50a('0x2b'),_0x4c9c36['uniqueid'],queues[_0x4c9c36[_0xb50a('0x12')]][_0xb50a('0x22')],_0x4c9c36[_0xb50a('0x28')],queues[_0x4c9c36[_0xb50a('0x12')]]['queuecallerexitreason']));writeDB(queues[_0x4c9c36[_0xb50a('0x12')]]);}}else if(!_['isNil'](_0x4c9c36[_0xb50a('0x2c')][_0xb50a('0x2d')])){if(!_[_0xb50a('0x19')](queues[_0x4c9c36['uniqueid']])&&!queues[_0x4c9c36[_0xb50a('0x12')]][_0xb50a('0x1c')]){queues[_0x4c9c36[_0xb50a('0x12')]][_0xb50a('0x1c')]=![];queues[_0x4c9c36[_0xb50a('0x12')]][_0xb50a('0x2e')]=null;queues[_0x4c9c36['uniqueid']][_0xb50a('0x1d')]=!![];queues[_0x4c9c36[_0xb50a('0x12')]][_0xb50a('0x2f')]=utils['now']();queues[_0x4c9c36[_0xb50a('0x12')]][_0xb50a('0x6')]=_0xb50a('0x30');utils[_0xb50a('0x0')](util[_0xb50a('0x10')](_0xb50a('0x31'),_0x4c9c36[_0xb50a('0x12')],queues[_0x4c9c36['uniqueid']]['name'],_0x4c9c36[_0xb50a('0x28')],queues[_0x4c9c36[_0xb50a('0x12')]][_0xb50a('0x6')]));}}}catch(_0x102b01){utils[_0xb50a('0x17')](util[_0xb50a('0x10')]('[%s][queues][varset]',_0x4c9c36[_0xb50a('0x12')]),_0x102b01);}};exports[_0xb50a('0x1c')]=function(_0x48176c){try{if(!_['isNil'](queues[_0x48176c['uniqueid']])){utils[_0xb50a('0xf')](util[_0xb50a('0x10')](_0xb50a('0x32'),_0x48176c[_0xb50a('0x12')]),_0x48176c);queues[_0x48176c[_0xb50a('0x12')]][_0xb50a('0x1d')]=![];queues[_0x48176c[_0xb50a('0x12')]][_0xb50a('0x2f')]=null;queues[_0x48176c['uniqueid']][_0xb50a('0x1c')]=!![];queues[_0x48176c[_0xb50a('0x12')]][_0xb50a('0x2e')]=utils[_0xb50a('0x16')]();queues[_0x48176c[_0xb50a('0x12')]][_0xb50a('0x6')]='ABANDONED';utils[_0xb50a('0x0')](util[_0xb50a('0x10')](_0xb50a('0x33'),_0x48176c[_0xb50a('0x12')],queues[_0x48176c[_0xb50a('0x12')]][_0xb50a('0x22')],queues[_0x48176c[_0xb50a('0x12')]][_0xb50a('0x6')]));}}catch(_0x3e844b){utils['error'](util[_0xb50a('0x10')](_0xb50a('0x32'),_0x48176c['uniqueid']),_0x3e844b);}};exports[_0xb50a('0x34')]=function(_0x204455){try{if(!_[_0xb50a('0x19')](queues[_0x204455['uniqueid']])){utils[_0xb50a('0xf')](util[_0xb50a('0x10')]('[%s][queues][queuecallerleave]',_0x204455['uniqueid']),_0x204455);utils[_0xb50a('0x0')](util[_0xb50a('0x10')](_0xb50a('0x35'),_0x204455[_0xb50a('0x12')],queues[_0x204455['uniqueid']]['name'],_0x204455['connectedlinenum'],_0x204455[_0xb50a('0x36')]));queues[_0x204455['uniqueid']][_0xb50a('0x34')]=!![];queues[_0x204455['uniqueid']][_0xb50a('0x1b')]=utils[_0xb50a('0x16')]();queues[_0x204455['uniqueid']][_0xb50a('0x37')]=utils[_0xb50a('0x38')](queues[_0x204455[_0xb50a('0x12')]]['queuecallerleaveAt'],queues[_0x204455[_0xb50a('0x12')]][_0xb50a('0x39')]);queues[_0x204455[_0xb50a('0x12')]][_0xb50a('0x14')]=_0x204455['position'];queues[_0x204455[_0xb50a('0x12')]][_0xb50a('0x3a')]=_0x204455['count'];queues[_0x204455['uniqueid']][_0xb50a('0x3b')]=_0x204455[_0xb50a('0x3b')];queues[_0x204455['uniqueid']][_0xb50a('0x36')]=_0x204455[_0xb50a('0x36')];}}catch(_0x8cd1ff){utils['error'](util[_0xb50a('0x10')](_0xb50a('0x3c'),_0x204455[_0xb50a('0x12')]),_0x8cd1ff);}};exports[_0xb50a('0x3d')]=function(_0x357cd7){try{if(!_[_0xb50a('0x19')](queues[_0x357cd7[_0xb50a('0x12')]])){utils[_0xb50a('0xf')](util['format'](_0xb50a('0x3e'),_0x357cd7[_0xb50a('0x12')]),_0x357cd7);utils['info'](util[_0xb50a('0x10')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x357cd7[_0xb50a('0x12')],queues[_0x357cd7[_0xb50a('0x12')]][_0xb50a('0x22')],_0x357cd7[_0xb50a('0x3f')],_0x357cd7['destaccountcode']));queues[_0x357cd7[_0xb50a('0x12')]]['queuecallerabandon']=![];queues[_0x357cd7[_0xb50a('0x12')]][_0xb50a('0x1c')]=![];queues[_0x357cd7['uniqueid']][_0xb50a('0x2e')]=null;queues[_0x357cd7['uniqueid']][_0xb50a('0x1d')]=![];queues[_0x357cd7[_0xb50a('0x12')]]['queuecallerexitreason']=null;queues[_0x357cd7[_0xb50a('0x12')]][_0xb50a('0x2f')]=null;queues[_0x357cd7[_0xb50a('0x12')]]['assigned']=!![];queues[_0x357cd7['uniqueid']][_0xb50a('0x5')]=_0x357cd7[_0xb50a('0x40')];queues[_0x357cd7[_0xb50a('0x12')]][_0xb50a('0x3')]=_0x357cd7[_0xb50a('0x3f')];}}catch(_0x36439e){utils[_0xb50a('0x17')](util[_0xb50a('0x10')](_0xb50a('0x3e'),_0x357cd7[_0xb50a('0x12')]),_0x36439e);}};exports[_0xb50a('0x41')]=function(_0x32dee8){try{if(!_[_0xb50a('0x19')](queues[_0x32dee8[_0xb50a('0x12')]])){if(queues[_0x32dee8[_0xb50a('0x12')]][_0xb50a('0x1b')]){utils['debug'](util[_0xb50a('0x10')]('[%s][queues][agentcomplete]',_0x32dee8[_0xb50a('0x12')]),_0x32dee8);queues[_0x32dee8['uniqueid']][_0xb50a('0x1c')]=![];queues[_0x32dee8['uniqueid']][_0xb50a('0x1c')]=![];queues[_0x32dee8[_0xb50a('0x12')]][_0xb50a('0x2e')]=null;queues[_0x32dee8[_0xb50a('0x12')]][_0xb50a('0x1d')]=![];queues[_0x32dee8['uniqueid']][_0xb50a('0x2f')]=null;queues[_0x32dee8['uniqueid']][_0xb50a('0x42')]=!![];queues[_0x32dee8['uniqueid']]['lastAssignedTo']=_0x32dee8[_0xb50a('0x3f')];queues[_0x32dee8['uniqueid']][_0xb50a('0x1e')]=!![];queues[_0x32dee8['uniqueid']][_0xb50a('0x1f')]=utils[_0xb50a('0x16')]();if(_0x32dee8[_0xb50a('0x43')]==_0xb50a('0x44')){if(!queues[_0x32dee8[_0xb50a('0x12')]]['transfer']){queues[_0x32dee8[_0xb50a('0x12')]][_0xb50a('0x6')]=_0xb50a('0x45');}}else{queues[_0x32dee8[_0xb50a('0x12')]][_0xb50a('0x6')]=_0xb50a('0x46')+_0x32dee8[_0xb50a('0x43')][_0xb50a('0x2a')]();}utils[_0xb50a('0x0')](util[_0xb50a('0x10')](_0xb50a('0x47'),_0x32dee8[_0xb50a('0x12')],queues[_0x32dee8[_0xb50a('0x12')]][_0xb50a('0x22')],_0x32dee8[_0xb50a('0x3f')],queues[_0x32dee8[_0xb50a('0x12')]][_0xb50a('0x6')]));writeDB(queues[_0x32dee8['uniqueid']]);}}}catch(_0x125eee){utils[_0xb50a('0x17')](util[_0xb50a('0x10')](_0xb50a('0x48'),_0x32dee8[_0xb50a('0x12')]),_0x125eee);}};exports[_0xb50a('0x49')]=function(_0x2d79e2){try{if(!_[_0xb50a('0x19')](queues[_0x2d79e2[_0xb50a('0x4a')]])){utils[_0xb50a('0xf')](util['format'](_0xb50a('0x4b'),_0x2d79e2[_0xb50a('0x12')]),_0x2d79e2);queues[_0x2d79e2[_0xb50a('0x4a')]][_0xb50a('0x44')]=!![];queues[_0x2d79e2[_0xb50a('0x4a')]][_0xb50a('0x4c')]=_0xb50a('0x4d');queues[_0x2d79e2[_0xb50a('0x4a')]]['transferexten']=_0x2d79e2[_0xb50a('0x4e')];queues[_0x2d79e2[_0xb50a('0x4a')]][_0xb50a('0x4f')]=_0x2d79e2[_0xb50a('0x4a')];queues[_0x2d79e2[_0xb50a('0x4a')]]['queuecallerexitreason']='BLINDTRANSFER';utils[_0xb50a('0x0')](util['format'](_0xb50a('0x50'),_0x2d79e2[_0xb50a('0x12')],queues[_0x2d79e2[_0xb50a('0x4a')]][_0xb50a('0x22')],_0x2d79e2[_0xb50a('0x4a')],_0x2d79e2[_0xb50a('0x4e')]));}}catch(_0x5b7265){utils['error'](util[_0xb50a('0x10')](_0xb50a('0x4b'),_0x2d79e2[_0xb50a('0x12')]),_0x5b7265);}};exports[_0xb50a('0x51')]=function(_0x3ea622){try{utils[_0xb50a('0xf')](util['format'](_0xb50a('0x52'),_0x3ea622['origtransfereruniqueid']),_0x3ea622);if(_0x3ea622[_0xb50a('0x53')]==_0x3ea622[_0xb50a('0x54')]){if(!_[_0xb50a('0x19')](queues[_0x3ea622[_0xb50a('0x55')]])){utils[_0xb50a('0x0')](util[_0xb50a('0x10')](_0xb50a('0x56'),_0x3ea622['origtransfereruniqueid'],queues[_0x3ea622[_0xb50a('0x55')]][_0xb50a('0x22')],_0x3ea622[_0xb50a('0x57')]));queues[_0x3ea622[_0xb50a('0x55')]][_0xb50a('0x44')]=!![];queues[_0x3ea622[_0xb50a('0x55')]][_0xb50a('0x4c')]=_0xb50a('0x58');queues[_0x3ea622['secondtransfererlinkedid']]['transferexten']=_0x3ea622[_0xb50a('0x57')];queues[_0x3ea622[_0xb50a('0x55')]][_0xb50a('0x4f')]=_0x3ea622[_0xb50a('0x53')];queues[_0x3ea622[_0xb50a('0x55')]][_0xb50a('0x6')]=_0xb50a('0x59');}if(!_[_0xb50a('0x19')](queues[_0x3ea622[_0xb50a('0x54')]])){if(_0x3ea622[_0xb50a('0x5a')]&&queues[_0x3ea622[_0xb50a('0x5a')]]){queues[_0x3ea622[_0xb50a('0x5a')]][_0xb50a('0x24')]=0x1;queues[_0x3ea622['transfereeuniqueid']]=_[_0xb50a('0x5b')](queues[_0x3ea622[_0xb50a('0x5a')]]);queues[_0x3ea622[_0xb50a('0x4a')]][_0xb50a('0xd')]=_0x3ea622[_0xb50a('0x5c')];queues[_0x3ea622[_0xb50a('0x4a')]][_0xb50a('0x24')]=0x2;queues[_0x3ea622['transfereeuniqueid']][_0xb50a('0x4')]=queues[_0x3ea622[_0xb50a('0x55')]][_0xb50a('0x4')];queues[_0x3ea622[_0xb50a('0x4a')]][_0xb50a('0x5d')]=queues[_0x3ea622[_0xb50a('0x55')]][_0xb50a('0x5d')];queues[_0x3ea622[_0xb50a('0x4a')]][_0xb50a('0x39')]=utils[_0xb50a('0x16')]();queues[_0x3ea622[_0xb50a('0x4a')]][_0xb50a('0x1b')]=utils['now']();queues[_0x3ea622[_0xb50a('0x4a')]][_0xb50a('0x37')]=0x0;queues[_0x3ea622['transfereeuniqueid']]['mohtime']=0x0;utils[_0xb50a('0x0')](util[_0xb50a('0x10')](_0xb50a('0x5e'),_0x3ea622[_0xb50a('0x53')],queues[_0x3ea622[_0xb50a('0x4a')]]['name'],queues[_0x3ea622[_0xb50a('0x4a')]]['calleridnum'],queues[_0x3ea622[_0xb50a('0x4a')]][_0xb50a('0x5d')]));}else{utils[_0xb50a('0x0')](util[_0xb50a('0x10')](_0xb50a('0x5f'),_0x3ea622[_0xb50a('0x53')],queues[_0x3ea622['origtransfererlinkedid']][_0xb50a('0x22')],_0x3ea622[_0xb50a('0x55')]));queues[_0x3ea622['origtransfererlinkedid']]['transfereduniqueid']=_0x3ea622[_0xb50a('0x55')];}}}else if(_0x3ea622['secondtransfereruniqueid']==_0x3ea622['secondtransfererlinkedid']){if(!_[_0xb50a('0x19')](queues[_0x3ea622['origtransfererlinkedid']])){utils['info'](util[_0xb50a('0x10')](_0xb50a('0x60'),_0x3ea622['origtransfereruniqueid'],queues[_0x3ea622['origtransfererlinkedid']]['name'],_0x3ea622['secondtransfereruniqueid'],_0x3ea622[_0xb50a('0x61')]));queues[_0x3ea622[_0xb50a('0x54')]][_0xb50a('0x44')]=!![];queues[_0x3ea622[_0xb50a('0x54')]][_0xb50a('0x4c')]=_0xb50a('0x58');queues[_0x3ea622[_0xb50a('0x54')]][_0xb50a('0x62')]=_0x3ea622[_0xb50a('0x61')];queues[_0x3ea622[_0xb50a('0x54')]][_0xb50a('0x4f')]=_0x3ea622[_0xb50a('0x63')];queues[_0x3ea622['origtransfererlinkedid']][_0xb50a('0x6')]=_0xb50a('0x59');}if(!_[_0xb50a('0x19')](queues[_0x3ea622[_0xb50a('0x55')]])){if(_0x3ea622[_0xb50a('0x64')]&&queues[_0x3ea622['transfertargetlinkedid']]){queues[_0x3ea622[_0xb50a('0x64')]][_0xb50a('0x24')]=0x1;queues[_0x3ea622[_0xb50a('0x5c')]]=_[_0xb50a('0x5b')](queues[_0x3ea622[_0xb50a('0x64')]]);queues[_0x3ea622[_0xb50a('0x5c')]]['transfereduniqueid']=_0x3ea622[_0xb50a('0x5c')];queues[_0x3ea622['transfertargetuniqueid']]['queuecallerenterreason']=0x2;queues[_0x3ea622['transfertargetuniqueid']][_0xb50a('0x4')]=queues[_0x3ea622[_0xb50a('0x54')]][_0xb50a('0x4')];queues[_0x3ea622[_0xb50a('0x5c')]][_0xb50a('0x5d')]=queues[_0x3ea622[_0xb50a('0x54')]][_0xb50a('0x5d')];queues[_0x3ea622[_0xb50a('0x5c')]]['queuecallerjoinAt']=utils[_0xb50a('0x16')]();queues[_0x3ea622[_0xb50a('0x5c')]][_0xb50a('0x1b')]=utils[_0xb50a('0x16')]();queues[_0x3ea622[_0xb50a('0x5c')]][_0xb50a('0x37')]=0x0;queues[_0x3ea622['transfertargetuniqueid']][_0xb50a('0x65')]=0x0;utils[_0xb50a('0x0')](util[_0xb50a('0x10')](_0xb50a('0x66'),_0x3ea622[_0xb50a('0x53')],queues[_0x3ea622['transfertargetuniqueid']][_0xb50a('0x22')],queues[_0x3ea622[_0xb50a('0x5c')]][_0xb50a('0xd')],queues[_0x3ea622[_0xb50a('0x5c')]][_0xb50a('0x4')],queues[_0x3ea622[_0xb50a('0x5c')]]['calleridname']));}else{utils[_0xb50a('0x0')](util['format'](_0xb50a('0x5f'),_0x3ea622['origtransfereruniqueid'],queues[_0x3ea622['secondtransfererlinkedid']]['name'],_0x3ea622[_0xb50a('0x54')]));queues[_0x3ea622[_0xb50a('0x55')]][_0xb50a('0xd')]=_0x3ea622['origtransfererlinkedid'];}}}}catch(_0x4eacb5){utils[_0xb50a('0x17')](util['format'](_0xb50a('0x52'),_0x3ea622[_0xb50a('0x53')]),_0x4eacb5);}};exports['musiconholdstart']=function(_0x583869){try{if(!_[_0xb50a('0x19')](queues[_0x583869[_0xb50a('0x12')]])){utils[_0xb50a('0xf')](util['format'](_0xb50a('0x67'),_0x583869[_0xb50a('0x12')]),_0x583869);queues[_0x583869[_0xb50a('0x12')]][_0xb50a('0x68')]=utils[_0xb50a('0x16')]();utils[_0xb50a('0x0')](util[_0xb50a('0x10')](_0xb50a('0x69'),_0x583869[_0xb50a('0x12')],queues[_0x583869[_0xb50a('0x12')]][_0xb50a('0x22')],queues[_0x583869[_0xb50a('0x12')]][_0xb50a('0x68')]));}}catch(_0x3ac53e){utils['error'](util[_0xb50a('0x10')](_0xb50a('0x67'),_0x583869['uniqueid']),_0x3ac53e);}};exports['musiconholdstop']=function(_0x14e987){try{if(!_[_0xb50a('0x19')](queues[_0x14e987[_0xb50a('0x12')]])){if(!_[_0xb50a('0x19')](queues[_0x14e987[_0xb50a('0x12')]][_0xb50a('0x68')])){utils[_0xb50a('0xf')](util['format'](_0xb50a('0x6a'),_0x14e987[_0xb50a('0x12')]),_0x14e987);queues[_0x14e987['uniqueid']][_0xb50a('0x65')]+=utils[_0xb50a('0x38')](utils[_0xb50a('0x16')](),queues[_0x14e987['uniqueid']]['musiconholdstartAt']);utils['info'](util[_0xb50a('0x10')](_0xb50a('0x6b'),_0x14e987['uniqueid'],queues[_0x14e987['uniqueid']][_0xb50a('0x22')],queues[_0x14e987[_0xb50a('0x12')]]['mohtime']));delete queues[_0x14e987['uniqueid']][_0xb50a('0x68')];}}}catch(_0x399007){utils[_0xb50a('0x17')](util[_0xb50a('0x10')]('[%s][queues][musiconholdstop]',_0x14e987['uniqueid']),_0x399007);}}; \ No newline at end of file +var _0x526d=['transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','assign','position','[%s][queues][queuecallerjoin]','hangup','isNil','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallercomplete','now','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','error','varset','[%s][queues][varset]','variable','value','toUpperCase','CONTINUE','queuecallerexit','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','EXITWITHKEY','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','queuecallerleave','holdtime','queuecallerjoinAt','count','connectedlinenum','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','assigned','queuecallercompleteAt','reason','transfer','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','ATTENDED','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten'];(function(_0x1d96e5,_0x38fff6){var _0x345df0=function(_0x5c6b08){while(--_0x5c6b08){_0x1d96e5['push'](_0x1d96e5['shift']());}};_0x345df0(++_0x38fff6);}(_0x526d,0x198));var _0xd526=function(_0x31ffbd,_0x2b4998){_0x31ffbd=_0x31ffbd-0x0;var _0x436b5f=_0x526d[_0x31ffbd];return _0x436b5f;};'use strict';var _=require(_0xd526('0x0'));var util=require(_0xd526('0x1'));var utils=require(_0xd526('0x2'));var queues={};function writeDB(_0x4fee6a){utils[_0xd526('0x3')](util[_0xd526('0x4')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x4fee6a[_0xd526('0x5')],_0x4fee6a[_0xd526('0x6')],_0x4fee6a[_0xd526('0x7')],_0x4fee6a[_0xd526('0x8')],_0x4fee6a[_0xd526('0x9')],_0x4fee6a[_0xd526('0xa')],_0x4fee6a[_0xd526('0xb')]));if(_0x4fee6a[_0xd526('0x7')]){utils[_0xd526('0xc')](_0x4fee6a[_0xd526('0x7')])[_0xd526('0xd')](function(_0x113e48){if(_0x113e48){_0x4fee6a['type']=_0x113e48['type'];}utils[_0xd526('0xe')](_0xd526('0xf'),_0x4fee6a);});}else{utils[_0xd526('0xe')](_0xd526('0xf'),_0x4fee6a);}if(_0x4fee6a[_0xd526('0x10')]){delete queues[_0x4fee6a[_0xd526('0x10')]];}else{delete queues[_0x4fee6a[_0xd526('0x5')]];}}exports[_0xd526('0x11')]=function(_0x5e4a14){try{utils['debug'](util[_0xd526('0x4')]('[%s][queues][queuecallerjoin]',_0x5e4a14[_0xd526('0x5')]),_0x5e4a14);utils[_0xd526('0x3')](util['format']('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x5e4a14[_0xd526('0x5')],_0x5e4a14[_0xd526('0x7')],_0x5e4a14['position']));queues[_0x5e4a14[_0xd526('0x5')]]=_[_0xd526('0x12')](_0x5e4a14,{'originalposition':_0x5e4a14[_0xd526('0x13')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x52ff5c){utils['error'](util[_0xd526('0x4')](_0xd526('0x14'),_0x5e4a14['uniqueid']),_0x52ff5c);}};exports[_0xd526('0x15')]=function(_0x261183){try{if(!_[_0xd526('0x16')](queues[_0x261183[_0xd526('0x5')]])){utils[_0xd526('0x17')](util[_0xd526('0x4')](_0xd526('0x18'),_0x261183[_0xd526('0x5')]),_0x261183);if(queues[_0x261183[_0xd526('0x5')]][_0xd526('0x19')]){if(!queues[_0x261183[_0xd526('0x5')]]['queuecallerabandon']&&!queues[_0x261183[_0xd526('0x5')]]['queuecallerexit']){queues[_0x261183[_0xd526('0x5')]][_0xd526('0x1a')]=!![];queues[_0x261183[_0xd526('0x5')]]['queuecallercompleteAt']=utils[_0xd526('0x1b')]();queues[_0x261183['uniqueid']]['queuecallerexitreason']=_0xd526('0x1c');}utils['info'](util[_0xd526('0x4')](_0xd526('0x1d'),_0x261183['uniqueid'],queues[_0x261183[_0xd526('0x5')]][_0xd526('0x1e')],queues[_0x261183[_0xd526('0x5')]][_0xd526('0xb')]));writeDB(queues[_0x261183[_0xd526('0x5')]]);}else if(queues[_0x261183[_0xd526('0x5')]][_0xd526('0x10')]){utils[_0xd526('0x3')](util[_0xd526('0x4')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x261183[_0xd526('0x5')],queues[_0x261183[_0xd526('0x5')]][_0xd526('0x1e')],queues[_0x261183[_0xd526('0x5')]][_0xd526('0x10')]));queues[queues[_0x261183['uniqueid']]['transfereduniqueid']]=queues[_0x261183['uniqueid']];queues[queues[_0x261183[_0xd526('0x5')]][_0xd526('0x10')]][_0xd526('0x1f')]=0x2;delete queues[_0x261183[_0xd526('0x5')]];}}}catch(_0x409bd1){utils[_0xd526('0x20')](util['format']('[%s][queues][hangup]',_0x261183[_0xd526('0x5')]),_0x409bd1);}};exports[_0xd526('0x21')]=function(_0x315a24){try{utils[_0xd526('0x17')](util['format'](_0xd526('0x22'),_0x315a24[_0xd526('0x5')]),_0x315a24);if(!_[_0xd526('0x16')](_0x315a24[_0xd526('0x23')]['queuestatus'])&&_0x315a24[_0xd526('0x24')][_0xd526('0x25')]()!==_0xd526('0x26')){if(!_[_0xd526('0x16')](queues[_0x315a24['uniqueid']])){queues[_0x315a24[_0xd526('0x5')]]['queuecallerabandon']=![];queues[_0x315a24['uniqueid']]['queuecallerabandonAt']=null;queues[_0x315a24[_0xd526('0x5')]][_0xd526('0x27')]=!![];queues[_0x315a24['uniqueid']]['queuecallerexitAt']=utils[_0xd526('0x1b')]();queues[_0x315a24[_0xd526('0x5')]][_0xd526('0xb')]=_0x315a24[_0xd526('0x24')][_0xd526('0x25')]();utils[_0xd526('0x3')](util[_0xd526('0x4')](_0xd526('0x28'),_0x315a24[_0xd526('0x5')],queues[_0x315a24[_0xd526('0x5')]][_0xd526('0x1e')],_0x315a24[_0xd526('0x24')],queues[_0x315a24[_0xd526('0x5')]][_0xd526('0xb')]));writeDB(queues[_0x315a24[_0xd526('0x5')]]);}}else if(!_[_0xd526('0x16')](_0x315a24[_0xd526('0x23')]['queueposition'])){if(!_[_0xd526('0x16')](queues[_0x315a24['uniqueid']])&&!queues[_0x315a24[_0xd526('0x5')]][_0xd526('0x29')]){queues[_0x315a24[_0xd526('0x5')]][_0xd526('0x29')]=![];queues[_0x315a24['uniqueid']][_0xd526('0x2a')]=null;queues[_0x315a24['uniqueid']][_0xd526('0x27')]=!![];queues[_0x315a24[_0xd526('0x5')]][_0xd526('0x2b')]=utils[_0xd526('0x1b')]();queues[_0x315a24[_0xd526('0x5')]]['queuecallerexitreason']=_0xd526('0x2c');utils[_0xd526('0x3')](util[_0xd526('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x315a24[_0xd526('0x5')],queues[_0x315a24['uniqueid']][_0xd526('0x1e')],_0x315a24[_0xd526('0x24')],queues[_0x315a24['uniqueid']][_0xd526('0xb')]));}}}catch(_0x1dd418){utils[_0xd526('0x20')](util[_0xd526('0x4')]('[%s][queues][varset]',_0x315a24['uniqueid']),_0x1dd418);}};exports['queuecallerabandon']=function(_0x358b39){try{if(!_[_0xd526('0x16')](queues[_0x358b39[_0xd526('0x5')]])){utils[_0xd526('0x17')](util['format']('[%s][queues][queuecallerabandon]',_0x358b39['uniqueid']),_0x358b39);queues[_0x358b39['uniqueid']]['queuecallerexit']=![];queues[_0x358b39[_0xd526('0x5')]][_0xd526('0x2b')]=null;queues[_0x358b39[_0xd526('0x5')]][_0xd526('0x29')]=!![];queues[_0x358b39['uniqueid']][_0xd526('0x2a')]=utils[_0xd526('0x1b')]();queues[_0x358b39[_0xd526('0x5')]]['queuecallerexitreason']=_0xd526('0x2d');utils['info'](util['format'](_0xd526('0x2e'),_0x358b39[_0xd526('0x5')],queues[_0x358b39['uniqueid']][_0xd526('0x1e')],queues[_0x358b39[_0xd526('0x5')]][_0xd526('0xb')]));}}catch(_0x5200ba){utils[_0xd526('0x20')](util[_0xd526('0x4')](_0xd526('0x2f'),_0x358b39[_0xd526('0x5')]),_0x5200ba);}};exports['queuecallerleave']=function(_0x482279){try{if(!_['isNil'](queues[_0x482279[_0xd526('0x5')]])){utils['debug'](util[_0xd526('0x4')](_0xd526('0x30'),_0x482279[_0xd526('0x5')]),_0x482279);utils['info'](util[_0xd526('0x4')](_0xd526('0x31'),_0x482279[_0xd526('0x5')],queues[_0x482279[_0xd526('0x5')]][_0xd526('0x1e')],_0x482279['connectedlinenum'],_0x482279[_0xd526('0x32')]));queues[_0x482279[_0xd526('0x5')]][_0xd526('0x33')]=!![];queues[_0x482279['uniqueid']][_0xd526('0x19')]=utils[_0xd526('0x1b')]();queues[_0x482279['uniqueid']][_0xd526('0x34')]=utils['diffTime'](queues[_0x482279[_0xd526('0x5')]][_0xd526('0x19')],queues[_0x482279[_0xd526('0x5')]][_0xd526('0x35')]);queues[_0x482279['uniqueid']]['position']=_0x482279['position'];queues[_0x482279['uniqueid']][_0xd526('0x36')]=_0x482279['count'];queues[_0x482279[_0xd526('0x5')]][_0xd526('0x37')]=_0x482279['connectedlinenum'];queues[_0x482279[_0xd526('0x5')]][_0xd526('0x32')]=_0x482279['connectedlinename'];}}catch(_0x27cc34){utils[_0xd526('0x20')](util[_0xd526('0x4')](_0xd526('0x30'),_0x482279['uniqueid']),_0x27cc34);}};exports[_0xd526('0x38')]=function(_0x50fccd){try{if(!_[_0xd526('0x16')](queues[_0x50fccd[_0xd526('0x5')]])){utils['debug'](util[_0xd526('0x4')](_0xd526('0x39'),_0x50fccd[_0xd526('0x5')]),_0x50fccd);utils[_0xd526('0x3')](util['format'](_0xd526('0x3a'),_0x50fccd[_0xd526('0x5')],queues[_0x50fccd[_0xd526('0x5')]][_0xd526('0x1e')],_0x50fccd[_0xd526('0x3b')],_0x50fccd[_0xd526('0x3c')]));queues[_0x50fccd[_0xd526('0x5')]][_0xd526('0x29')]=![];queues[_0x50fccd[_0xd526('0x5')]]['queuecallerabandon']=![];queues[_0x50fccd[_0xd526('0x5')]][_0xd526('0x2a')]=null;queues[_0x50fccd[_0xd526('0x5')]][_0xd526('0x27')]=![];queues[_0x50fccd['uniqueid']]['queuecallerexitreason']=null;queues[_0x50fccd[_0xd526('0x5')]][_0xd526('0x2b')]=null;queues[_0x50fccd[_0xd526('0x5')]]['assigned']=!![];queues[_0x50fccd[_0xd526('0x5')]][_0xd526('0xa')]=_0x50fccd[_0xd526('0x3c')];queues[_0x50fccd[_0xd526('0x5')]][_0xd526('0x8')]=_0x50fccd['membername'];}}catch(_0x4a113e){utils[_0xd526('0x20')](util[_0xd526('0x4')](_0xd526('0x39'),_0x50fccd[_0xd526('0x5')]),_0x4a113e);}};exports[_0xd526('0x3d')]=function(_0x13eb14){try{if(!_[_0xd526('0x16')](queues[_0x13eb14['uniqueid']])){if(queues[_0x13eb14[_0xd526('0x5')]][_0xd526('0x19')]){utils[_0xd526('0x17')](util[_0xd526('0x4')](_0xd526('0x3e'),_0x13eb14[_0xd526('0x5')]),_0x13eb14);queues[_0x13eb14[_0xd526('0x5')]][_0xd526('0x29')]=![];queues[_0x13eb14['uniqueid']][_0xd526('0x29')]=![];queues[_0x13eb14[_0xd526('0x5')]]['queuecallerabandonAt']=null;queues[_0x13eb14['uniqueid']][_0xd526('0x27')]=![];queues[_0x13eb14[_0xd526('0x5')]][_0xd526('0x2b')]=null;queues[_0x13eb14[_0xd526('0x5')]][_0xd526('0x3f')]=!![];queues[_0x13eb14['uniqueid']][_0xd526('0x8')]=_0x13eb14[_0xd526('0x3b')];queues[_0x13eb14[_0xd526('0x5')]]['queuecallercomplete']=!![];queues[_0x13eb14[_0xd526('0x5')]][_0xd526('0x40')]=utils['now']();if(_0x13eb14[_0xd526('0x41')]==_0xd526('0x42')){if(!queues[_0x13eb14[_0xd526('0x5')]][_0xd526('0x42')]){queues[_0x13eb14[_0xd526('0x5')]][_0xd526('0xb')]='TRANSFER';}}else{queues[_0x13eb14['uniqueid']][_0xd526('0xb')]='COMPLETEDBY'+_0x13eb14[_0xd526('0x41')][_0xd526('0x25')]();}utils['info'](util[_0xd526('0x4')](_0xd526('0x43'),_0x13eb14['uniqueid'],queues[_0x13eb14[_0xd526('0x5')]][_0xd526('0x1e')],_0x13eb14[_0xd526('0x3b')],queues[_0x13eb14[_0xd526('0x5')]][_0xd526('0xb')]));writeDB(queues[_0x13eb14['uniqueid']]);}}}catch(_0x4cff5c){utils[_0xd526('0x20')](util[_0xd526('0x4')]('[%s][queues][agentcomplete]',_0x13eb14[_0xd526('0x5')]),_0x4cff5c);}};exports['blindtransfer']=function(_0x11f1de){try{if(!_[_0xd526('0x16')](queues[_0x11f1de[_0xd526('0x44')]])){utils[_0xd526('0x17')](util[_0xd526('0x4')](_0xd526('0x45'),_0x11f1de[_0xd526('0x5')]),_0x11f1de);queues[_0x11f1de['transfereeuniqueid']]['transfer']=!![];queues[_0x11f1de[_0xd526('0x44')]][_0xd526('0x46')]='BLIND';queues[_0x11f1de[_0xd526('0x44')]][_0xd526('0x47')]=_0x11f1de[_0xd526('0x48')];queues[_0x11f1de[_0xd526('0x44')]][_0xd526('0x49')]=_0x11f1de[_0xd526('0x44')];queues[_0x11f1de[_0xd526('0x44')]][_0xd526('0xb')]=_0xd526('0x4a');utils[_0xd526('0x3')](util[_0xd526('0x4')](_0xd526('0x4b'),_0x11f1de['uniqueid'],queues[_0x11f1de[_0xd526('0x44')]][_0xd526('0x1e')],_0x11f1de[_0xd526('0x44')],_0x11f1de[_0xd526('0x48')]));}}catch(_0x25e59a){utils['error'](util[_0xd526('0x4')](_0xd526('0x45'),_0x11f1de[_0xd526('0x5')]),_0x25e59a);}};exports['attendedtransfer']=function(_0xe1b895){try{utils['debug'](util[_0xd526('0x4')](_0xd526('0x4c'),_0xe1b895[_0xd526('0x4d')]),_0xe1b895);if(_0xe1b895[_0xd526('0x4d')]==_0xe1b895[_0xd526('0x4e')]){if(!_[_0xd526('0x16')](queues[_0xe1b895[_0xd526('0x4f')]])){utils[_0xd526('0x3')](util[_0xd526('0x4')](_0xd526('0x50'),_0xe1b895[_0xd526('0x4d')],queues[_0xe1b895[_0xd526('0x4f')]][_0xd526('0x1e')],_0xe1b895['origtransfererexten']));queues[_0xe1b895[_0xd526('0x4f')]]['transfer']=!![];queues[_0xe1b895[_0xd526('0x4f')]][_0xd526('0x46')]=_0xd526('0x51');queues[_0xe1b895[_0xd526('0x4f')]][_0xd526('0x47')]=_0xe1b895[_0xd526('0x52')];queues[_0xe1b895['secondtransfererlinkedid']][_0xd526('0x49')]=_0xe1b895[_0xd526('0x4d')];queues[_0xe1b895[_0xd526('0x4f')]][_0xd526('0xb')]=_0xd526('0x53');}if(!_['isNil'](queues[_0xe1b895[_0xd526('0x4e')]])){if(_0xe1b895['transfereelinkedid']&&queues[_0xe1b895[_0xd526('0x54')]]){queues[_0xe1b895[_0xd526('0x54')]][_0xd526('0x1f')]=0x1;queues[_0xe1b895[_0xd526('0x44')]]=_[_0xd526('0x55')](queues[_0xe1b895['transfereelinkedid']]);queues[_0xe1b895[_0xd526('0x44')]][_0xd526('0x10')]=_0xe1b895[_0xd526('0x56')];queues[_0xe1b895[_0xd526('0x44')]][_0xd526('0x1f')]=0x2;queues[_0xe1b895['transfereeuniqueid']][_0xd526('0x9')]=queues[_0xe1b895[_0xd526('0x4f')]][_0xd526('0x9')];queues[_0xe1b895['transfereeuniqueid']][_0xd526('0x57')]=queues[_0xe1b895[_0xd526('0x4f')]][_0xd526('0x57')];queues[_0xe1b895[_0xd526('0x44')]][_0xd526('0x35')]=utils[_0xd526('0x1b')]();queues[_0xe1b895[_0xd526('0x44')]][_0xd526('0x19')]=utils[_0xd526('0x1b')]();queues[_0xe1b895[_0xd526('0x44')]][_0xd526('0x34')]=0x0;queues[_0xe1b895[_0xd526('0x44')]][_0xd526('0x58')]=0x0;utils[_0xd526('0x3')](util[_0xd526('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0xe1b895['origtransfereruniqueid'],queues[_0xe1b895[_0xd526('0x44')]]['name'],queues[_0xe1b895['transfereeuniqueid']][_0xd526('0x9')],queues[_0xe1b895['transfereeuniqueid']][_0xd526('0x57')]));}else{utils[_0xd526('0x3')](util['format'](_0xd526('0x59'),_0xe1b895[_0xd526('0x4d')],queues[_0xe1b895['origtransfererlinkedid']][_0xd526('0x1e')],_0xe1b895[_0xd526('0x4f')]));queues[_0xe1b895[_0xd526('0x4e')]][_0xd526('0x10')]=_0xe1b895['secondtransfererlinkedid'];}}}else if(_0xe1b895[_0xd526('0x5a')]==_0xe1b895[_0xd526('0x4f')]){if(!_[_0xd526('0x16')](queues[_0xe1b895[_0xd526('0x4e')]])){utils[_0xd526('0x3')](util[_0xd526('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0xe1b895[_0xd526('0x4d')],queues[_0xe1b895[_0xd526('0x4e')]][_0xd526('0x1e')],_0xe1b895[_0xd526('0x5a')],_0xe1b895[_0xd526('0x5b')]));queues[_0xe1b895[_0xd526('0x4e')]][_0xd526('0x42')]=!![];queues[_0xe1b895['origtransfererlinkedid']][_0xd526('0x46')]=_0xd526('0x51');queues[_0xe1b895[_0xd526('0x4e')]][_0xd526('0x47')]=_0xe1b895[_0xd526('0x5b')];queues[_0xe1b895[_0xd526('0x4e')]][_0xd526('0x49')]=_0xe1b895['secondtransfereruniqueid'];queues[_0xe1b895[_0xd526('0x4e')]]['queuecallerexitreason']=_0xd526('0x53');}if(!_[_0xd526('0x16')](queues[_0xe1b895[_0xd526('0x4f')]])){if(_0xe1b895['transfertargetlinkedid']&&queues[_0xe1b895[_0xd526('0x5c')]]){queues[_0xe1b895[_0xd526('0x5c')]][_0xd526('0x1f')]=0x1;queues[_0xe1b895['transfertargetuniqueid']]=_['clone'](queues[_0xe1b895[_0xd526('0x5c')]]);queues[_0xe1b895['transfertargetuniqueid']][_0xd526('0x10')]=_0xe1b895['transfertargetuniqueid'];queues[_0xe1b895['transfertargetuniqueid']][_0xd526('0x1f')]=0x2;queues[_0xe1b895['transfertargetuniqueid']][_0xd526('0x9')]=queues[_0xe1b895[_0xd526('0x4e')]][_0xd526('0x9')];queues[_0xe1b895[_0xd526('0x56')]][_0xd526('0x57')]=queues[_0xe1b895[_0xd526('0x4e')]][_0xd526('0x57')];queues[_0xe1b895[_0xd526('0x56')]][_0xd526('0x35')]=utils['now']();queues[_0xe1b895['transfertargetuniqueid']][_0xd526('0x19')]=utils[_0xd526('0x1b')]();queues[_0xe1b895[_0xd526('0x56')]][_0xd526('0x34')]=0x0;queues[_0xe1b895[_0xd526('0x56')]][_0xd526('0x58')]=0x0;utils[_0xd526('0x3')](util['format'](_0xd526('0x5d'),_0xe1b895[_0xd526('0x4d')],queues[_0xe1b895[_0xd526('0x56')]][_0xd526('0x1e')],queues[_0xe1b895[_0xd526('0x56')]][_0xd526('0x10')],queues[_0xe1b895['transfertargetuniqueid']][_0xd526('0x9')],queues[_0xe1b895[_0xd526('0x56')]][_0xd526('0x57')]));}else{utils['info'](util[_0xd526('0x4')](_0xd526('0x59'),_0xe1b895[_0xd526('0x4d')],queues[_0xe1b895[_0xd526('0x4f')]][_0xd526('0x1e')],_0xe1b895[_0xd526('0x4e')]));queues[_0xe1b895[_0xd526('0x4f')]]['transfereduniqueid']=_0xe1b895[_0xd526('0x4e')];}}}}catch(_0xb6208a){utils['error'](util[_0xd526('0x4')]('[%s][queues][attendedtransfer]',_0xe1b895[_0xd526('0x4d')]),_0xb6208a);}};exports[_0xd526('0x5e')]=function(_0x332592){try{if(!_[_0xd526('0x16')](queues[_0x332592[_0xd526('0x5')]])){utils[_0xd526('0x17')](util[_0xd526('0x4')]('[%s][queues][musiconholdstart]',_0x332592[_0xd526('0x5')]),_0x332592);queues[_0x332592[_0xd526('0x5')]][_0xd526('0x5f')]=utils[_0xd526('0x1b')]();utils[_0xd526('0x3')](util[_0xd526('0x4')](_0xd526('0x60'),_0x332592[_0xd526('0x5')],queues[_0x332592[_0xd526('0x5')]][_0xd526('0x1e')],queues[_0x332592[_0xd526('0x5')]][_0xd526('0x5f')]));}}catch(_0x4303b5){utils[_0xd526('0x20')](util[_0xd526('0x4')]('[%s][queues][musiconholdstart]',_0x332592[_0xd526('0x5')]),_0x4303b5);}};exports[_0xd526('0x61')]=function(_0x17a78d){try{if(!_[_0xd526('0x16')](queues[_0x17a78d[_0xd526('0x5')]])){if(!_[_0xd526('0x16')](queues[_0x17a78d[_0xd526('0x5')]][_0xd526('0x5f')])){utils[_0xd526('0x17')](util[_0xd526('0x4')](_0xd526('0x62'),_0x17a78d[_0xd526('0x5')]),_0x17a78d);queues[_0x17a78d['uniqueid']][_0xd526('0x58')]+=utils['diffTime'](utils[_0xd526('0x1b')](),queues[_0x17a78d[_0xd526('0x5')]][_0xd526('0x5f')]);utils[_0xd526('0x3')](util[_0xd526('0x4')](_0xd526('0x63'),_0x17a78d[_0xd526('0x5')],queues[_0x17a78d[_0xd526('0x5')]][_0xd526('0x1e')],queues[_0x17a78d['uniqueid']]['mohtime']));delete queues[_0x17a78d[_0xd526('0x5')]][_0xd526('0x5f')];}}}catch(_0x83e256){utils['error'](util[_0xd526('0x4')]('[%s][queues][musiconholdstop]',_0x17a78d[_0xd526('0x5')]),_0x83e256);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 2d4c00a..3c8e65d 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 _0x3e68=['name','UserId','request','CreateVoiceRecording','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','calleridnum','calleridname','connectedlinenum','connectedlinename','type','forEach','clone','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','cdr','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','uniqueid','accountcode','then','membername'];(function(_0x4b3172,_0x227392){var _0x1f5fd0=function(_0x47ae9f){while(--_0x47ae9f){_0x4b3172['push'](_0x4b3172['shift']());}};_0x1f5fd0(++_0x227392);}(_0x3e68,0x165));var _0x83e6=function(_0x5b0712,_0xee29bf){_0x5b0712=_0x5b0712-0x0;var _0x1ae2df=_0x3e68[_0x5b0712];return _0x1ae2df;};'use strict';var _=require(_0x83e6('0x0'));var util=require(_0x83e6('0x1'));var utils=require(_0x83e6('0x2'));var recordings={};function writeDB(_0x1d6a64){utils[_0x83e6('0x3')](util[_0x83e6('0x4')]('[%s][recordings][writeDB]',_0x1d6a64[_0x83e6('0x5')]));if(_0x1d6a64[_0x83e6('0x6')]){utils['getUserByInternal'](_0x1d6a64['accountcode'])[_0x83e6('0x7')](function(_0x506f51){if(_0x506f51){_0x1d6a64[_0x83e6('0x8')]=_0x506f51[_0x83e6('0x9')];_0x1d6a64[_0x83e6('0xa')]=_0x506f51['id'];}utils[_0x83e6('0xb')](_0x83e6('0xc'),_0x1d6a64);});}else{utils[_0x83e6('0xb')](_0x83e6('0xc'),_0x1d6a64);}}exports['newchannel']=function(_0x2ab2f0){try{utils[_0x83e6('0xd')](util[_0x83e6('0x4')](_0x83e6('0xe'),_0x2ab2f0[_0x83e6('0x5')]),_0x2ab2f0);if(_0x2ab2f0[_0x83e6('0x5')]==_0x2ab2f0[_0x83e6('0xf')]){utils[_0x83e6('0x3')](util['format'](_0x83e6('0x10'),_0x2ab2f0['uniqueid'],_0x2ab2f0[_0x83e6('0x11')],_0x2ab2f0[_0x83e6('0x12')]));recordings[_0x2ab2f0[_0x83e6('0x5')]]={'uniqueid':_0x2ab2f0[_0x83e6('0x5')],'accountcode':_0x2ab2f0[_0x83e6('0x6')],'exten':_0x2ab2f0[_0x83e6('0x12')],'context':_0x2ab2f0['context'],'channel':_0x2ab2f0[_0x83e6('0x13')],'monitors':[]};}}catch(_0xd67331){utils[_0x83e6('0x14')](util[_0x83e6('0x4')](_0x83e6('0xe'),_0x2ab2f0[_0x83e6('0x5')]),_0xd67331);}};exports[_0x83e6('0x15')]=function(_0x28bed4){try{utils['debug'](util[_0x83e6('0x4')](_0x83e6('0x16'),_0x28bed4['uniqueid']),_0x28bed4);if(!_[_0x83e6('0x17')](recordings[_0x28bed4['uniqueid']])&&_0x28bed4[_0x83e6('0x18')]==0x6){utils[_0x83e6('0x3')](util[_0x83e6('0x4')](_0x83e6('0x19'),_0x28bed4[_0x83e6('0x5')],_0x28bed4['context'],_0x28bed4[_0x83e6('0x13')]));}else if(!_[_0x83e6('0x17')](recordings[_0x28bed4[_0x83e6('0xf')]])&&_0x28bed4[_0x83e6('0x18')]==0x6&&_0x28bed4['context']!=_0x83e6('0x1a')){utils[_0x83e6('0x3')](util[_0x83e6('0x4')](_0x83e6('0x1b'),_0x28bed4['uniqueid'],_0x28bed4[_0x83e6('0xf')],_0x28bed4[_0x83e6('0x11')],_0x28bed4[_0x83e6('0x13')]));recordings[_0x28bed4[_0x83e6('0xf')]][_0x83e6('0x6')]=_0x28bed4[_0x83e6('0x6')];}}catch(_0xec16a6){utils[_0x83e6('0x14')](util[_0x83e6('0x4')](_0x83e6('0x16'),_0x28bed4[_0x83e6('0x5')]),_0xec16a6);}};exports[_0x83e6('0x1c')]=function(_0x32313a){try{if(!_[_0x83e6('0x17')](_0x32313a[_0x83e6('0x1d')])&&!_['isNil'](_0x32313a[_0x83e6('0x1d')][_0x83e6('0x1e')])){utils[_0x83e6('0xd')](util[_0x83e6('0x4')](_0x83e6('0x1f'),_0x32313a[_0x83e6('0x5')]),_0x32313a);utils['info'](util[_0x83e6('0x4')](_0x83e6('0x20'),_0x32313a[_0x83e6('0x5')],_0x32313a[_0x83e6('0x1d')],_0x32313a['value']));if(_[_0x83e6('0x21')](_0x32313a[_0x83e6('0x22')],'.wav49')){_0x32313a[_0x83e6('0x22')]=_0x32313a[_0x83e6('0x22')][_0x83e6('0x23')]('.wav49',_0x83e6('0x24'));}if(recordings[_0x32313a['linkedid']]){var _0x24b4a0=_[_0x83e6('0x25')](recordings[_0x32313a['linkedid']][_0x83e6('0x26')],{'value':_0x32313a[_0x83e6('0x22')]});if(_[_0x83e6('0x17')](_0x24b4a0)){recordings[_0x32313a['linkedid']][_0x83e6('0x26')][_0x83e6('0x27')]({'value':_0x32313a[_0x83e6('0x22')]});}}}}catch(_0x330c5f){utils[_0x83e6('0x14')](util[_0x83e6('0x4')](_0x83e6('0x1f'),_0x32313a[_0x83e6('0x5')]),_0x330c5f);}};exports[_0x83e6('0x28')]=function(_0x487468){try{if(!_[_0x83e6('0x17')](recordings[_0x487468[_0x83e6('0x5')]])){utils[_0x83e6('0xd')](util['format'](_0x83e6('0x29'),_0x487468['uniqueid']),_0x487468);utils[_0x83e6('0x3')](util[_0x83e6('0x4')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x487468[_0x83e6('0x5')],_0x487468['calleridnum'],_0x487468['calleridname'],_0x487468['cause-txt']));recordings[_0x487468[_0x83e6('0x5')]]['calleridnum']=_0x487468[_0x83e6('0x2a')];recordings[_0x487468['uniqueid']][_0x83e6('0x2b')]=_0x487468['calleridname'];recordings[_0x487468[_0x83e6('0x5')]][_0x83e6('0x2c')]=_0x487468['connectedlinenum'];recordings[_0x487468['uniqueid']][_0x83e6('0x2d')]=_0x487468[_0x83e6('0x2d')];if(recordings[_0x487468[_0x83e6('0x5')]][_0x83e6('0x2e')]=='outbound'&&recordings[_0x487468[_0x83e6('0x5')]][_0x83e6('0x6')]){recordings[_0x487468['uniqueid']][_0x83e6('0x2c')]=recordings[_0x487468[_0x83e6('0x5')]][_0x83e6('0x6')];recordings[_0x487468['uniqueid']][_0x83e6('0x2d')]='';}recordings[_0x487468[_0x83e6('0x5')]][_0x83e6('0x26')][_0x83e6('0x2f')](function(_0xe4dcc){var _0x52b340=_[_0x83e6('0x30')](recordings[_0x487468[_0x83e6('0x5')]]);_0x52b340[_0x83e6('0x22')]=_0xe4dcc[_0x83e6('0x22')];writeDB(_0x52b340);});delete recordings[_0x487468[_0x83e6('0x5')]];}}catch(_0x25c192){utils['error'](util['format'](_0x83e6('0x29'),_0x487468[_0x83e6('0x5')]),_0x25c192);}};exports['newexten']=function(_0x3f8322){try{if(!_['isNil'](recordings[_0x3f8322[_0x83e6('0x5')]])){utils[_0x83e6('0xd')](util[_0x83e6('0x4')](_0x83e6('0x31'),_0x3f8322[_0x83e6('0x5')]),_0x3f8322);utils[_0x83e6('0x3')](util[_0x83e6('0x4')](_0x83e6('0x32'),_0x3f8322['uniqueid'],_0x3f8322[_0x83e6('0x33')],_0x3f8322[_0x83e6('0x34')]));if(_0x3f8322[_0x83e6('0x33')]['toLowerCase']()==_0x83e6('0x35')&&_[_0x83e6('0x36')](_0x3f8322[_0x83e6('0x34')]['toLowerCase'](),_0x83e6('0x37'))){var _0x41a3a2=_0x3f8322[_0x83e6('0x34')]['split']('=');var _0x2fe4fc=_0x41a3a2[0x0]['substring'](_0x41a3a2[0x0][_0x83e6('0x38')]('(')+0x1,_0x41a3a2[0x0][_0x83e6('0x38')](')'));var _0x50d087=_0x41a3a2[0x1];recordings[_0x3f8322['uniqueid']][_0x2fe4fc]=_0x50d087;}}}catch(_0x50790d){utils['error'](util[_0x83e6('0x4')](_0x83e6('0x31'),_0x3f8322['uniqueid']),_0x50790d);}};exports[_0x83e6('0x39')]=function(_0x595e75){try{if(!_['isNil'](recordings[_0x595e75[_0x83e6('0x5')]])){utils[_0x83e6('0xd')](util[_0x83e6('0x4')](_0x83e6('0x3a'),_0x595e75[_0x83e6('0x5')]),_0x595e75);utils[_0x83e6('0x3')](util['format'](_0x83e6('0x3b'),_0x595e75[_0x83e6('0x5')],_0x595e75[_0x83e6('0x3c')]));recordings[_0x595e75[_0x83e6('0x5')]]['queue']=_0x595e75[_0x83e6('0x3c')];}}catch(_0x30eff1){utils['error'](util['format']('[%s][recordings][queuecallerjoin]',_0x595e75[_0x83e6('0x5')]),_0x30eff1);}}; \ No newline at end of file +var _0x13f4=['request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','error','channelstate','context','channel','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','isNil','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','replace','.wav49','.WAV','find','monitors','push','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','connectedlinename','outbound','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','then','membername','name'];(function(_0x4d4a06,_0x30289a){var _0x1dbcd8=function(_0x30ed6e){while(--_0x30ed6e){_0x4d4a06['push'](_0x4d4a06['shift']());}};_0x1dbcd8(++_0x30289a);}(_0x13f4,0x6b));var _0x413f=function(_0x4d183d,_0x123de0){_0x4d183d=_0x4d183d-0x0;var _0x431236=_0x13f4[_0x4d183d];return _0x431236;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x413f('0x0'));var recordings={};function writeDB(_0x20efc8){utils[_0x413f('0x1')](util[_0x413f('0x2')](_0x413f('0x3'),_0x20efc8[_0x413f('0x4')]));if(_0x20efc8[_0x413f('0x5')]){utils['getUserByInternal'](_0x20efc8[_0x413f('0x5')])[_0x413f('0x6')](function(_0x5f4c74){if(_0x5f4c74){_0x20efc8[_0x413f('0x7')]=_0x5f4c74[_0x413f('0x8')];_0x20efc8['UserId']=_0x5f4c74['id'];}utils[_0x413f('0x9')](_0x413f('0xa'),_0x20efc8);});}else{utils[_0x413f('0x9')](_0x413f('0xa'),_0x20efc8);}}exports[_0x413f('0xb')]=function(_0x15400a){try{utils[_0x413f('0xc')](util[_0x413f('0x2')](_0x413f('0xd'),_0x15400a[_0x413f('0x4')]),_0x15400a);if(_0x15400a[_0x413f('0x4')]==_0x15400a[_0x413f('0xe')]){utils[_0x413f('0x1')](util['format'](_0x413f('0xf'),_0x15400a[_0x413f('0x4')],_0x15400a['context'],_0x15400a[_0x413f('0x10')]));recordings[_0x15400a[_0x413f('0x4')]]={'uniqueid':_0x15400a[_0x413f('0x4')],'accountcode':_0x15400a[_0x413f('0x5')],'exten':_0x15400a[_0x413f('0x10')],'context':_0x15400a['context'],'channel':_0x15400a['channel'],'monitors':[]};}}catch(_0x6b7f52){utils[_0x413f('0x11')](util[_0x413f('0x2')](_0x413f('0xd'),_0x15400a[_0x413f('0x4')]),_0x6b7f52);}};exports['newstate']=function(_0x3ac16b){try{utils['debug'](util['format']('[%s][recordings][newstate]',_0x3ac16b['uniqueid']),_0x3ac16b);if(!_['isNil'](recordings[_0x3ac16b[_0x413f('0x4')]])&&_0x3ac16b[_0x413f('0x12')]==0x6){utils[_0x413f('0x1')](util[_0x413f('0x2')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x3ac16b[_0x413f('0x4')],_0x3ac16b[_0x413f('0x13')],_0x3ac16b[_0x413f('0x14')]));}else if(!_['isNil'](recordings[_0x3ac16b[_0x413f('0xe')]])&&_0x3ac16b[_0x413f('0x12')]==0x6&&_0x3ac16b[_0x413f('0x13')]!=_0x413f('0x15')){utils['info'](util[_0x413f('0x2')](_0x413f('0x16'),_0x3ac16b[_0x413f('0x4')],_0x3ac16b[_0x413f('0xe')],_0x3ac16b[_0x413f('0x13')],_0x3ac16b['channel']));recordings[_0x3ac16b[_0x413f('0xe')]][_0x413f('0x5')]=_0x3ac16b[_0x413f('0x5')];}}catch(_0x4acc01){utils[_0x413f('0x11')](util[_0x413f('0x2')](_0x413f('0x17'),_0x3ac16b['uniqueid']),_0x4acc01);}};exports['varset']=function(_0x4021b3){try{if(!_[_0x413f('0x18')](_0x4021b3[_0x413f('0x19')])&&!_[_0x413f('0x18')](_0x4021b3[_0x413f('0x19')][_0x413f('0x1a')])){utils[_0x413f('0xc')](util[_0x413f('0x2')](_0x413f('0x1b'),_0x4021b3['uniqueid']),_0x4021b3);utils[_0x413f('0x1')](util[_0x413f('0x2')](_0x413f('0x1c'),_0x4021b3[_0x413f('0x4')],_0x4021b3['variable'],_0x4021b3[_0x413f('0x1d')]));if(_[_0x413f('0x1e')](_0x4021b3[_0x413f('0x1d')],'.wav49')){_0x4021b3[_0x413f('0x1d')]=_0x4021b3[_0x413f('0x1d')][_0x413f('0x1f')](_0x413f('0x20'),_0x413f('0x21'));}if(recordings[_0x4021b3[_0x413f('0xe')]]){var _0x167ced=_[_0x413f('0x22')](recordings[_0x4021b3[_0x413f('0xe')]][_0x413f('0x23')],{'value':_0x4021b3[_0x413f('0x1d')]});if(_['isNil'](_0x167ced)){recordings[_0x4021b3[_0x413f('0xe')]]['monitors'][_0x413f('0x24')]({'value':_0x4021b3[_0x413f('0x1d')]});}}}}catch(_0x52850d){utils['error'](util[_0x413f('0x2')]('[%s][recordings][varset]',_0x4021b3[_0x413f('0x4')]),_0x52850d);}};exports['hangup']=function(_0x42da6c){try{if(!_[_0x413f('0x18')](recordings[_0x42da6c['uniqueid']])){utils[_0x413f('0xc')](util[_0x413f('0x2')](_0x413f('0x25'),_0x42da6c[_0x413f('0x4')]),_0x42da6c);utils[_0x413f('0x1')](util[_0x413f('0x2')](_0x413f('0x26'),_0x42da6c[_0x413f('0x4')],_0x42da6c[_0x413f('0x27')],_0x42da6c[_0x413f('0x28')],_0x42da6c['cause-txt']));recordings[_0x42da6c[_0x413f('0x4')]][_0x413f('0x27')]=_0x42da6c[_0x413f('0x27')];recordings[_0x42da6c[_0x413f('0x4')]][_0x413f('0x28')]=_0x42da6c['calleridname'];recordings[_0x42da6c[_0x413f('0x4')]]['connectedlinenum']=_0x42da6c[_0x413f('0x29')];recordings[_0x42da6c['uniqueid']][_0x413f('0x2a')]=_0x42da6c[_0x413f('0x2a')];if(recordings[_0x42da6c['uniqueid']]['type']==_0x413f('0x2b')&&recordings[_0x42da6c['uniqueid']][_0x413f('0x5')]){recordings[_0x42da6c[_0x413f('0x4')]][_0x413f('0x29')]=recordings[_0x42da6c[_0x413f('0x4')]][_0x413f('0x5')];recordings[_0x42da6c[_0x413f('0x4')]][_0x413f('0x2a')]='';}recordings[_0x42da6c['uniqueid']][_0x413f('0x23')]['forEach'](function(_0x51d4da){var _0x4db0b6=_['clone'](recordings[_0x42da6c[_0x413f('0x4')]]);_0x4db0b6['value']=_0x51d4da[_0x413f('0x1d')];writeDB(_0x4db0b6);});delete recordings[_0x42da6c['uniqueid']];}}catch(_0x9c1712){utils[_0x413f('0x11')](util[_0x413f('0x2')]('[%s][recordings][hangup]',_0x42da6c['uniqueid']),_0x9c1712);}};exports[_0x413f('0x2c')]=function(_0x599c69){try{if(!_[_0x413f('0x18')](recordings[_0x599c69[_0x413f('0x4')]])){utils[_0x413f('0xc')](util[_0x413f('0x2')]('[%s][recordings][newexten]',_0x599c69[_0x413f('0x4')]),_0x599c69);utils[_0x413f('0x1')](util[_0x413f('0x2')](_0x413f('0x2d'),_0x599c69[_0x413f('0x4')],_0x599c69['application'],_0x599c69[_0x413f('0x2e')]));if(_0x599c69[_0x413f('0x2f')][_0x413f('0x30')]()=='set'&&_[_0x413f('0x31')](_0x599c69['appdata'][_0x413f('0x30')](),_0x413f('0x32'))){var _0x1a8621=_0x599c69[_0x413f('0x2e')][_0x413f('0x33')]('=');var _0x541174=_0x1a8621[0x0][_0x413f('0x34')](_0x1a8621[0x0][_0x413f('0x35')]('(')+0x1,_0x1a8621[0x0][_0x413f('0x35')](')'));var _0x5b63f7=_0x1a8621[0x1];recordings[_0x599c69[_0x413f('0x4')]][_0x541174]=_0x5b63f7;}}}catch(_0x1f74ae){utils[_0x413f('0x11')](util[_0x413f('0x2')]('[%s][recordings][newexten]',_0x599c69[_0x413f('0x4')]),_0x1f74ae);}};exports[_0x413f('0x36')]=function(_0x2cea3d){try{if(!_[_0x413f('0x18')](recordings[_0x2cea3d['uniqueid']])){utils[_0x413f('0xc')](util[_0x413f('0x2')]('[%s][recordings][queuecallerjoin]',_0x2cea3d[_0x413f('0x4')]),_0x2cea3d);utils[_0x413f('0x1')](util[_0x413f('0x2')](_0x413f('0x37'),_0x2cea3d[_0x413f('0x4')],_0x2cea3d[_0x413f('0x38')]));recordings[_0x2cea3d[_0x413f('0x4')]][_0x413f('0x38')]=_0x2cea3d[_0x413f('0x38')];}}catch(_0x3e1e6e){utils[_0x413f('0x11')](util[_0x413f('0x2')](_0x413f('0x39'),_0x2cea3d[_0x413f('0x4')]),_0x3e1e6e);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 248da6c..3c5c818 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 _0x8e35=['transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','error','lodash','util','./utils','format','[%s][transfers][writeDB]\x20type:%s','type','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','attendedtransfer','[%s][transfers][attendedtransfer]','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','origtransfererchannel','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','attended','assign','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename'];(function(_0x1b282e,_0x2da5c5){var _0x292eb3=function(_0x4b4061){while(--_0x4b4061){_0x1b282e['push'](_0x1b282e['shift']());}};_0x292eb3(++_0x2da5c5);}(_0x8e35,0x1f0));var _0x58e3=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x8e35[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x58e3('0x0'));var util=require(_0x58e3('0x1'));var utils=require(_0x58e3('0x2'));function writeDB(_0x3b89e2){utils['info'](util[_0x58e3('0x3')](_0x58e3('0x4'),_0x3b89e2[_0x58e3('0x5')]==='attended'?_0x3b89e2[_0x58e3('0x6')]:_0x3b89e2[_0x58e3('0x7')],_0x3b89e2[_0x58e3('0x5')]));utils[_0x58e3('0x8')](_0x58e3('0x9'),_0x3b89e2);}exports[_0x58e3('0xa')]=function(_0x224f18){try{utils[_0x58e3('0xb')](util['format'](_0x58e3('0xc'),_0x224f18['uniqueid']),_0x224f18);utils[_0x58e3('0xd')](util['format'](_0x58e3('0xe'),_0x224f18['uniqueid'],_0x224f18[_0x58e3('0xf')],_0x224f18[_0x58e3('0x10')],_0x224f18[_0x58e3('0x11')],_0x224f18[_0x58e3('0x12')]));_0x224f18[_0x58e3('0x5')]=_0x58e3('0x13');writeDB(_0x224f18);}catch(_0x3a562c){utils['error'](util['format'](_0x58e3('0xc'),_0x224f18[_0x58e3('0x7')]),_0x3a562c);}};exports[_0x58e3('0x14')]=function(_0x40f550){try{utils[_0x58e3('0xb')](util[_0x58e3('0x3')](_0x58e3('0x15'),_0x40f550[_0x58e3('0x6')]),_0x40f550);utils[_0x58e3('0xd')](util[_0x58e3('0x3')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x40f550[_0x58e3('0x6')],_0x40f550[_0x58e3('0x16')],_0x40f550[_0x58e3('0x17')],_0x40f550[_0x58e3('0x18')],_0x40f550[_0x58e3('0x19')]));_0x40f550=_['assign'](_0x40f550,{'transfererchannel':_0x40f550[_0x58e3('0x1a')],'transferercalleridnum':_0x40f550[_0x58e3('0x16')],'transferercalleridname':_0x40f550[_0x58e3('0x17')],'transfererconnectedlinenum':_0x40f550['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x40f550[_0x58e3('0x1b')],'transfereraccountcode':_0x40f550[_0x58e3('0x1c')],'transferercontext':_0x40f550['secondtransferercontext'],'transfererexten':_0x40f550[_0x58e3('0x1d')],'transfererlinkedid':_0x40f550[_0x58e3('0x1e')],'context':_0x40f550[_0x58e3('0x1f')],'extension':_0x40f550['origtransfererexten'],'type':_0x58e3('0x20')});if(_['isNil'](_0x40f550['transfereechannel'])){_0x40f550=_[_0x58e3('0x21')](_0x40f550,{'transfereechannel':_0x40f550[_0x58e3('0x22')],'transfereecalleridnum':_0x40f550[_0x58e3('0x18')],'transfereecalleridname':_0x40f550['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x40f550[_0x58e3('0x23')],'transfereeconnectedlinename':_0x40f550[_0x58e3('0x24')],'transfereeaccountcode':_0x40f550[_0x58e3('0x25')],'transfereecontext':_0x40f550['transfertargetcontext'],'transfereeexten':_0x40f550[_0x58e3('0x26')],'transfereelinkedid':_0x40f550[_0x58e3('0x27')]});}writeDB(_0x40f550);}catch(_0x395035){utils[_0x58e3('0x28')](util[_0x58e3('0x3')](_0x58e3('0x15'),_0x40f550[_0x58e3('0x6')]),_0x395035);}}; \ No newline at end of file +var _0x6cdd=['transferercalleridnum','transferercalleridname','transfereecalleridnum','blind','attendedtransfer','[%s][transfers][attendedtransfer]','origtransferercalleridnum','origtransferercalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','origtransferercontext','isNil','transfereechannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','error','lodash','util','./utils','info','type','attended','origtransfereruniqueid','uniqueid','CreateVoiceTransferReport','debug','[%s][transfers][blindtransfer]','format','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6cdd,0x137));var _0xd6cd=function(_0x4588fe,_0x3aa83c){_0x4588fe=_0x4588fe-0x0;var _0xd3a627=_0x6cdd[_0x4588fe];return _0xd3a627;};'use strict';var _=require(_0xd6cd('0x0'));var util=require(_0xd6cd('0x1'));var utils=require(_0xd6cd('0x2'));function writeDB(_0x5deb9f){utils[_0xd6cd('0x3')](util['format']('[%s][transfers][writeDB]\x20type:%s',_0x5deb9f[_0xd6cd('0x4')]===_0xd6cd('0x5')?_0x5deb9f[_0xd6cd('0x6')]:_0x5deb9f[_0xd6cd('0x7')],_0x5deb9f['type']));utils['request'](_0xd6cd('0x8'),_0x5deb9f);}exports['blindtransfer']=function(_0x2d1a89){try{utils[_0xd6cd('0x9')](util['format'](_0xd6cd('0xa'),_0x2d1a89[_0xd6cd('0x7')]),_0x2d1a89);utils[_0xd6cd('0x3')](util[_0xd6cd('0xb')](_0xd6cd('0xc'),_0x2d1a89[_0xd6cd('0x7')],_0x2d1a89[_0xd6cd('0xd')],_0x2d1a89[_0xd6cd('0xe')],_0x2d1a89[_0xd6cd('0xf')],_0x2d1a89['transfereecalleridname']));_0x2d1a89['type']=_0xd6cd('0x10');writeDB(_0x2d1a89);}catch(_0x179cca){utils['error'](util[_0xd6cd('0xb')]('[%s][transfers][blindtransfer]',_0x2d1a89[_0xd6cd('0x7')]),_0x179cca);}};exports[_0xd6cd('0x11')]=function(_0x55a4f0){try{utils[_0xd6cd('0x9')](util['format'](_0xd6cd('0x12'),_0x55a4f0[_0xd6cd('0x6')]),_0x55a4f0);utils[_0xd6cd('0x3')](util[_0xd6cd('0xb')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x55a4f0[_0xd6cd('0x6')],_0x55a4f0[_0xd6cd('0x13')],_0x55a4f0[_0xd6cd('0x14')],_0x55a4f0['transfertargetcalleridnum'],_0x55a4f0['transfertargetcalleridname']));_0x55a4f0=_[_0xd6cd('0x15')](_0x55a4f0,{'transfererchannel':_0x55a4f0[_0xd6cd('0x16')],'transferercalleridnum':_0x55a4f0[_0xd6cd('0x13')],'transferercalleridname':_0x55a4f0[_0xd6cd('0x14')],'transfererconnectedlinenum':_0x55a4f0[_0xd6cd('0x17')],'transfererconnectedlinename':_0x55a4f0['secondtransfererconnectedlinename'],'transfereraccountcode':_0x55a4f0[_0xd6cd('0x18')],'transferercontext':_0x55a4f0[_0xd6cd('0x19')],'transfererexten':_0x55a4f0['secondtransfererexten'],'transfererlinkedid':_0x55a4f0[_0xd6cd('0x1a')],'context':_0x55a4f0[_0xd6cd('0x1b')],'extension':_0x55a4f0['origtransfererexten'],'type':_0xd6cd('0x5')});if(_[_0xd6cd('0x1c')](_0x55a4f0[_0xd6cd('0x1d')])){_0x55a4f0=_['assign'](_0x55a4f0,{'transfereechannel':_0x55a4f0['transfertargetchannel'],'transfereecalleridnum':_0x55a4f0[_0xd6cd('0x1e')],'transfereecalleridname':_0x55a4f0[_0xd6cd('0x1f')],'transfereeconnectedlinenum':_0x55a4f0['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x55a4f0['transfertargetconnectedlinename'],'transfereeaccountcode':_0x55a4f0[_0xd6cd('0x20')],'transfereecontext':_0x55a4f0['transfertargetcontext'],'transfereeexten':_0x55a4f0[_0xd6cd('0x21')],'transfereelinkedid':_0x55a4f0[_0xd6cd('0x22')]});}writeDB(_0x55a4f0);}catch(_0x4a91ba){utils[_0xd6cd('0x23')](util[_0xd6cd('0xb')](_0xd6cd('0x12'),_0x55a4f0[_0xd6cd('0x6')]),_0x4a91ba);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 52131c9..382dc3e 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 _0x885c=['[utils][getUserByInterface]\x20interface:%s\x20%s','found','notfound','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','format','YYYY-MM-DD\x20HH:mm:ss','subtract','diffTime','diff','sumTime','now','isAfter','isBefore','moment','util','client','../../config/logger','xdr','info','inspect','debug','error','request','catch','[utils][request]\x20name:%s','GetUser','internal','name','then','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','[utils][getUserByInternal]'];(function(_0x3439ef,_0x198707){var _0x3c7937=function(_0xaf5100){while(--_0xaf5100){_0x3439ef['push'](_0x3439ef['shift']());}};_0x3c7937(++_0x198707);}(_0x885c,0x190));var _0xc885=function(_0x333714,_0x3370ac){_0x333714=_0x333714-0x0;var _0x4c211e=_0x885c[_0x333714];return _0x4c211e;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var moment=require(_0xc885('0x0'));var util=require(_0xc885('0x1'));var client=jayson[_0xc885('0x2')]['http']({'port':0x2329});var logger=require(_0xc885('0x3'))(_0xc885('0x4'));exports[_0xc885('0x5')]=function(_0x2dae11,_0x1fd23b){logger[_0xc885('0x5')](_0x2dae11,_0x1fd23b?util[_0xc885('0x6')](_0x1fd23b,{'showHidden':![],'depth':null}):'');};exports[_0xc885('0x7')]=function(_0x1703fd,_0x9f0853){logger[_0xc885('0x7')](_0x1703fd,_0x9f0853?util['inspect'](_0x9f0853,{'showHidden':![],'depth':null}):'');};exports[_0xc885('0x8')]=function(_0x513947,_0x2fa017){logger['error'](_0x513947,_0x2fa017?util[_0xc885('0x6')](_0x2fa017,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x4ad3a5,_0x308978){return client[_0xc885('0x9')](_0x4ad3a5,{'body':_0x308978})['then'](function(_0x257377){logger['debug']('[utils][request]\x20name:%s',_0x4ad3a5,_0x257377?util[_0xc885('0x6')](_0x257377,{'showHidden':![],'depth':null}):'');})[_0xc885('0xa')](function(_0x52065b){logger['error'](_0xc885('0xb'),_0x4ad3a5,_0x52065b?util['inspect'](_0x52065b,{'showHidden':![],'depth':null}):'');});};function getUser(_0xc8defe){return client['request'](_0xc885('0xc'),{'options':{'raw':!![],'attributes':['id',_0xc885('0xd'),_0xc885('0xe'),'interface'],'where':_0xc8defe,'limit':0x1}})[_0xc885('0xf')](function(_0x41667d){logger['debug'](_0xc885('0x10'),JSON[_0xc885('0x11')](_0xc8defe),_0x41667d?util['inspect'](_0x41667d,{'showHidden':![],'depth':null}):'');return _0x41667d[_0xc885('0x12')][_0xc885('0x13')]?_0x41667d[_0xc885('0x12')][0x0]:null;});}exports[_0xc885('0x14')]=function(_0x4546ea){return new BPromise(function(_0x3139a9,_0x1c9b63){if(_0x4546ea){return getUser({'internal':_0x4546ea})[_0xc885('0xf')](function(_0x33f473){logger[_0xc885('0x5')](_0xc885('0x15'),_0x4546ea,_0x33f473?'found':'notfound');return _0x3139a9(_0x33f473);})[_0xc885('0xa')](function(_0x385a9e){logger[_0xc885('0x8')](_0xc885('0x16'),_0x385a9e?util[_0xc885('0x6')](_0x385a9e,{'showHidden':![],'depth':null}):'');return _0x3139a9(null);});}return _0x3139a9(null);});};exports['getUserByInterface']=function(_0x553cac){return new BPromise(function(_0x2b6267,_0x47137f){if(_0x553cac){return getUser({'interface':_0x553cac})[_0xc885('0xf')](function(_0x470ae6){logger[_0xc885('0x5')](_0xc885('0x17'),_0x553cac,_0x470ae6?_0xc885('0x18'):_0xc885('0x19'));return _0x2b6267(_0x470ae6);})['catch'](function(_0x5a6fa2){logger['error']('[utils][getUserByInterface]',_0x5a6fa2?util[_0xc885('0x6')](_0x5a6fa2,{'showHidden':![],'depth':null}):'');return _0x2b6267(null);});}return _0x2b6267(null);});};exports[_0xc885('0x1a')]=function(_0x347cda){return new BPromise(function(_0x5d9fb6,_0x3ccf3c){if(_0x347cda){return getUser({'name':_0x347cda})[_0xc885('0xf')](function(_0x44b914){logger[_0xc885('0x5')](_0xc885('0x1b'),_0x347cda,_0x44b914?'found':_0xc885('0x19'));return _0x5d9fb6(_0x44b914);})[_0xc885('0xa')](function(_0x283b4e){logger[_0xc885('0x8')](_0xc885('0x1c'),_0x283b4e?util[_0xc885('0x6')](_0x283b4e,{'showHidden':![],'depth':null}):'');return _0x5d9fb6(null);});}return _0x5d9fb6(null);});};exports[_0xc885('0x1d')]=function(_0x5b8589){return new BPromise(function(_0x5cb45d,_0x3803de){if(_0x5b8589){return client[_0xc885('0x9')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id','name',_0xc885('0x1e'),_0xc885('0x1f'),_0xc885('0x20')],'where':{'name':_0x5b8589},'limit':0x1}})[_0xc885('0xf')](function(_0x11660b){logger[_0xc885('0x7')](_0xc885('0x21'),_0x5b8589,_0x11660b?util[_0xc885('0x6')](_0x11660b,{'showHidden':![],'depth':null}):'');logger['info'](_0xc885('0x22'),_0x5b8589,_0x11660b?'found':_0xc885('0x19'));return _0x5cb45d(_0x11660b[_0xc885('0x12')][_0xc885('0x13')]?_0x11660b[_0xc885('0x12')][0x0]:null);})['catch'](function(_0x28f699){logger[_0xc885('0x8')](_0xc885('0x23'),_0x28f699?util['inspect'](_0x28f699,{'showHidden':![],'depth':null}):'');return _0x5cb45d(null);});}return _0x5cb45d(null);});};exports[_0xc885('0x24')]=function(_0x4d1b39,_0x4589e8){return moment(_0x4d1b39)[_0xc885('0x25')](_0x4589e8,'seconds')[_0xc885('0x26')](_0xc885('0x27'));};exports['subtractTime']=function(_0x55352a,_0x54f774){return moment(_0x55352a)[_0xc885('0x28')](_0x54f774,'seconds')[_0xc885('0x26')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xc885('0x29')]=function(_0x161233,_0x2b4624){return moment(_0x161233)[_0xc885('0x2a')](moment(_0x2b4624),'seconds');};exports[_0xc885('0x2b')]=function(_0x53f17d,_0x446bbe){return parseInt(_0x53f17d,0xa)+parseInt(_0x446bbe,0xa);};exports[_0xc885('0x2c')]=function(){return moment()[_0xc885('0x26')]('YYYY-MM-DD\x20HH:mm:ss');};exports['isAfter']=function(_0xff276d,_0xbef60d){if(_0xbef60d){return moment(_0xff276d)[_0xc885('0x2d')](_0xbef60d);}return!![];};exports[_0xc885('0x2e')]=function(_0x8dbc4b,_0x53609a){if(_0x53609a){return moment(_0x8dbc4b)['isBefore'](_0x53609a);}else if(_0x8dbc4b){return!![];}return![];}; \ No newline at end of file +var _0x4c60=['util','http','info','inspect','debug','error','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','getUserByInterface','found','notfound','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','request','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','now','isAfter','isBefore','bluebird','jayson/promise','moment'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x4c60,0xc1));var _0x04c6=function(_0x3df631,_0x95f5a7){_0x3df631=_0x3df631-0x0;var _0x5f200f=_0x4c60[_0x3df631];return _0x5f200f;};'use strict';var BPromise=require(_0x04c6('0x0'));var jayson=require(_0x04c6('0x1'));var moment=require(_0x04c6('0x2'));var util=require(_0x04c6('0x3'));var client=jayson['client'][_0x04c6('0x4')]({'port':0x2329});var logger=require('../../config/logger')('xdr');exports['info']=function(_0x53ca7a,_0x3a9493){logger[_0x04c6('0x5')](_0x53ca7a,_0x3a9493?util[_0x04c6('0x6')](_0x3a9493,{'showHidden':![],'depth':null}):'');};exports[_0x04c6('0x7')]=function(_0x2b9041,_0x39be2d){logger[_0x04c6('0x7')](_0x2b9041,_0x39be2d?util['inspect'](_0x39be2d,{'showHidden':![],'depth':null}):'');};exports[_0x04c6('0x8')]=function(_0x43a27e,_0x207649){logger[_0x04c6('0x8')](_0x43a27e,_0x207649?util['inspect'](_0x207649,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x5498a9,_0x376da8){return client['request'](_0x5498a9,{'body':_0x376da8})[_0x04c6('0x9')](function(_0x2772fa){logger['debug'](_0x04c6('0xa'),_0x5498a9,_0x2772fa?util[_0x04c6('0x6')](_0x2772fa,{'showHidden':![],'depth':null}):'');})[_0x04c6('0xb')](function(_0x4e5e6){logger['error'](_0x04c6('0xa'),_0x5498a9,_0x4e5e6?util[_0x04c6('0x6')](_0x4e5e6,{'showHidden':![],'depth':null}):'');});};function getUser(_0x4384ad){return client['request'](_0x04c6('0xc'),{'options':{'raw':!![],'attributes':['id',_0x04c6('0xd'),_0x04c6('0xe'),_0x04c6('0xf')],'where':_0x4384ad,'limit':0x1}})[_0x04c6('0x9')](function(_0x19a26f){logger[_0x04c6('0x7')](_0x04c6('0x10'),JSON['stringify'](_0x4384ad),_0x19a26f?util[_0x04c6('0x6')](_0x19a26f,{'showHidden':![],'depth':null}):'');return _0x19a26f[_0x04c6('0x11')][_0x04c6('0x12')]?_0x19a26f[_0x04c6('0x11')][0x0]:null;});}exports[_0x04c6('0x13')]=function(_0xfb4db5){return new BPromise(function(_0x21674a,_0x423ea9){if(_0xfb4db5){return getUser({'internal':_0xfb4db5})['then'](function(_0x142065){logger[_0x04c6('0x5')](_0x04c6('0x14'),_0xfb4db5,_0x142065?'found':'notfound');return _0x21674a(_0x142065);})['catch'](function(_0x41ad4f){logger[_0x04c6('0x8')]('[utils][getUserByInternal]',_0x41ad4f?util['inspect'](_0x41ad4f,{'showHidden':![],'depth':null}):'');return _0x21674a(null);});}return _0x21674a(null);});};exports[_0x04c6('0x15')]=function(_0x2eed94){return new BPromise(function(_0x3cd448,_0x5daa22){if(_0x2eed94){return getUser({'interface':_0x2eed94})[_0x04c6('0x9')](function(_0x13f2dc){logger[_0x04c6('0x5')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x2eed94,_0x13f2dc?_0x04c6('0x16'):_0x04c6('0x17'));return _0x3cd448(_0x13f2dc);})['catch'](function(_0x54a8b0){logger['error'](_0x04c6('0x18'),_0x54a8b0?util[_0x04c6('0x6')](_0x54a8b0,{'showHidden':![],'depth':null}):'');return _0x3cd448(null);});}return _0x3cd448(null);});};exports[_0x04c6('0x19')]=function(_0x115e35){return new BPromise(function(_0x3e1328,_0x52e5f5){if(_0x115e35){return getUser({'name':_0x115e35})['then'](function(_0x383435){logger[_0x04c6('0x5')](_0x04c6('0x1a'),_0x115e35,_0x383435?_0x04c6('0x16'):_0x04c6('0x17'));return _0x3e1328(_0x383435);})[_0x04c6('0xb')](function(_0x47c69a){logger[_0x04c6('0x8')](_0x04c6('0x1b'),_0x47c69a?util['inspect'](_0x47c69a,{'showHidden':![],'depth':null}):'');return _0x3e1328(null);});}return _0x3e1328(null);});};exports[_0x04c6('0x1c')]=function(_0x1cd16a){return new BPromise(function(_0x5f1331,_0x5c9003){if(_0x1cd16a){return client[_0x04c6('0x1d')](_0x04c6('0x1e'),{'options':{'raw':!![],'attributes':['id',_0x04c6('0xe'),_0x04c6('0x1f'),_0x04c6('0x20'),_0x04c6('0x21')],'where':{'name':_0x1cd16a},'limit':0x1}})['then'](function(_0x5d8c88){logger['debug'](_0x04c6('0x22'),_0x1cd16a,_0x5d8c88?util['inspect'](_0x5d8c88,{'showHidden':![],'depth':null}):'');logger[_0x04c6('0x5')](_0x04c6('0x23'),_0x1cd16a,_0x5d8c88?'found':_0x04c6('0x17'));return _0x5f1331(_0x5d8c88[_0x04c6('0x11')][_0x04c6('0x12')]?_0x5d8c88[_0x04c6('0x11')][0x0]:null);})['catch'](function(_0x7c3207){logger[_0x04c6('0x8')](_0x04c6('0x24'),_0x7c3207?util[_0x04c6('0x6')](_0x7c3207,{'showHidden':![],'depth':null}):'');return _0x5f1331(null);});}return _0x5f1331(null);});};exports[_0x04c6('0x25')]=function(_0x902e66,_0x3e59b2){return moment(_0x902e66)[_0x04c6('0x26')](_0x3e59b2,_0x04c6('0x27'))[_0x04c6('0x28')](_0x04c6('0x29'));};exports[_0x04c6('0x2a')]=function(_0x46eccb,_0x3d56ea){return moment(_0x46eccb)[_0x04c6('0x2b')](_0x3d56ea,'seconds')[_0x04c6('0x28')](_0x04c6('0x29'));};exports[_0x04c6('0x2c')]=function(_0x206e32,_0x5a2e6a){return moment(_0x206e32)[_0x04c6('0x2d')](moment(_0x5a2e6a),_0x04c6('0x27'));};exports['sumTime']=function(_0x59dad3,_0x4aac49){return parseInt(_0x59dad3,0xa)+parseInt(_0x4aac49,0xa);};exports[_0x04c6('0x2e')]=function(){return moment()[_0x04c6('0x28')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x04c6('0x2f')]=function(_0x4c8f4c,_0x15c270){if(_0x15c270){return moment(_0x4c8f4c)[_0x04c6('0x2f')](_0x15c270);}return!![];};exports[_0x04c6('0x30')]=function(_0x2b28cd,_0x5144f5){if(_0x5144f5){return moment(_0x2b28cd)['isBefore'](_0x5144f5);}else if(_0x2b28cd){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 c3528d3..0f5d5c3 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 _0xdba7=['use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','method','x-forwarded-for','headers','remoteAddress','url','statusCode','responseTime','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','connection','other','agent_id','agent_name','test','setupLoggers','path','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','client','role','name','ensureDir','then','catch','user','no-user','data','timestamp','api','auth','set','client-side-logger'];(function(_0x4b0dc3,_0x25948f){var _0x5bea77=function(_0x513c2c){while(--_0x513c2c){_0x4b0dc3['push'](_0x4b0dc3['shift']());}};_0x5bea77(++_0x25948f);}(_0xdba7,0x15f));var _0x7dba=function(_0x2a646d,_0x18fee8){_0x2a646d=_0x2a646d-0x0;var _0x560d1a=_0xdba7[_0x2a646d];return _0x560d1a;};var fs=require('fs-extra');var _=require('lodash');var ewinston=require('express-winston');var path=require(_0x7dba('0x0'));var util=require('util');var fileLogger=require(_0x7dba('0x1'))[_0x7dba('0x2')];var safeTemplate=require(_0x7dba('0x3'))[_0x7dba('0x4')];var maskSensitiveData=require(_0x7dba('0x5'))[_0x7dba('0x6')];function ClientSideLogger(){function _0x7a53b0(_0x4c8f75){var _0x50d43b=path[_0x7dba('0x7')](_0x7dba('0x8'),_0x7dba('0x9'),_0x7dba('0xa'));var _0x238f81=path[_0x7dba('0x7')](_0x7dba('0xb'),_0x4c8f75[_0x7dba('0xc')]+'-'+_0x4c8f75[_0x7dba('0xd')]);return fs[_0x7dba('0xe')](path[_0x7dba('0x7')](_0x50d43b,_0x238f81))[_0x7dba('0xf')](function(){var _0x3e7d99=fileLogger(_0x7dba('0xb'),path[_0x7dba('0x7')](_0x50d43b,_0x238f81));return _0x3e7d99;})[_0x7dba('0x10')](function(_0x14c143){throw _0x14c143;});}this[_0x7dba('0x9')]=function(_0x1d1594,_0x15ae22,_0x1429c8,_0x2718a4){return _0x7a53b0(_0x1d1594[_0x7dba('0x11')])[_0x7dba('0xf')](function(_0x5836f0){var _0x231b2f=_0x5836f0[_0x15ae22];return _0x231b2f;})[_0x7dba('0xf')](function(_0x12b295){var _0xba3c98=_0x1d1594[_0x7dba('0x11')]?_0x1d1594['user']['id']:_0x7dba('0x12');var _0x556aa6=_0x2718a4[_0x7dba('0x13')];var _0x5618f8=_0x2718a4[_0x7dba('0x14')];var _0x1da54a=new Date(Number(_0x5618f8));return _0x12b295(_0xba3c98,_0x1da54a,_0x1429c8,_0x556aa6);})[_0x7dba('0x10')](function(_0x151ece){fileLogger(_0x7dba('0xb'))['error'](_0x151ece);});};}function setupLoggers(_0x1edb33){return new Promise(function(_0x34285f){var _0x8b5a78=new ClientSideLogger();var _0xf89921=fileLogger(_0x7dba('0x15'));var _0x5848fe=fileLogger(_0x7dba('0x16'));_0x1edb33[_0x7dba('0x17')](_0x7dba('0x18'),_0x8b5a78);_0x1edb33[_0x7dba('0x19')](ewinston[_0x7dba('0x1a')]({'winstonInstance':_0xf89921,'meta':![],'statusLevels':!![],'msg':function(_0x2935a9,_0x452a86){var _0x3315cf=_0x7dba('0x1b');if(!_[_0x7dba('0x1c')](_0x2935a9[_0x7dba('0x1d')])){_0x3315cf+='\x20body=%s';var _0x5506f3=_0x2935a9[_0x7dba('0x1d')];maskSensitiveData(_0x5506f3);}return safeTemplate(util[_0x7dba('0x1e')](_0x3315cf,_0x2935a9[_0x7dba('0x1f')],_0x2935a9['headers'][_0x7dba('0x20')]?_0x2935a9[_0x7dba('0x21')][_0x7dba('0x20')]:_0x2935a9['connection'][_0x7dba('0x22')]||_0x2935a9['ip'],_0x2935a9[_0x7dba('0x23')],_0x452a86[_0x7dba('0x24')],_0x452a86[_0x7dba('0x25')],_0x2935a9[_0x7dba('0x11')]?_0x2935a9[_0x7dba('0x11')]['id']:null,_0x2935a9['user']?_0x2935a9['user']['name']:null,_0x2935a9[_0x7dba('0x11')]?_0x2935a9[_0x7dba('0x11')][_0x7dba('0xc')]:null,_0x5506f3?util['inspect'](_0x5506f3,![],null):''));}}));_0x1edb33[_0x7dba('0x19')](ewinston[_0x7dba('0x1a')]({'winstonInstance':_0x5848fe,'meta':![],'statusLevels':!![],'msg':function(_0x25dab7,_0x145e6e){var _0xa58efa=_0x7dba('0x26');if(_0x25dab7['body']&&_0x25dab7[_0x7dba('0x1d')][_0x7dba('0x27')]&&_0x25dab7[_0x7dba('0x1d')]['agent_id']){_0xa58efa=_0x7dba('0x28');}return util[_0x7dba('0x1e')](_0xa58efa,_0x25dab7[_0x7dba('0x1f')],_0x25dab7[_0x7dba('0x21')][_0x7dba('0x20')]?_0x25dab7[_0x7dba('0x21')][_0x7dba('0x20')]:_0x25dab7[_0x7dba('0x29')][_0x7dba('0x22')]||_0x25dab7['ip'],_0x25dab7[_0x7dba('0x23')],_0x145e6e[_0x7dba('0x24')],_0x145e6e['responseTime'],_0x25dab7['user']?_0x25dab7[_0x7dba('0x11')]['id']:null,_0x25dab7[_0x7dba('0x11')]?_0x25dab7['user'][_0x7dba('0xd')]:null,_0x25dab7['user']?_0x25dab7[_0x7dba('0x11')][_0x7dba('0xc')]:null,_0x25dab7[_0x7dba('0x1d')]&&_0x25dab7[_0x7dba('0x1d')]['device']?_0x25dab7[_0x7dba('0x1d')][_0x7dba('0x27')]:_0x7dba('0x2a'),_0x25dab7[_0x7dba('0x1d')]&&_0x25dab7[_0x7dba('0x1d')][_0x7dba('0x2b')]?_0x25dab7[_0x7dba('0x1d')]['agent_id']:'',_0x25dab7[_0x7dba('0x1d')]&&_0x25dab7['body'][_0x7dba('0x2c')]?_0x25dab7[_0x7dba('0x1d')][_0x7dba('0x2c')]:'');},'ignoreRoute':function(_0x4f4d67){var _0x3d2e41=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3d2e41[_0x7dba('0x2d')](_0x4f4d67['url']);}}));return _0x34285f();});}exports[_0x7dba('0x2e')]=setupLoggers; \ No newline at end of file +var _0x35dc=['fs-extra','express-winston','path','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','/var','join','client','name','then','catch','log','user','no-user','data','timestamp','api','set','client-side-logger','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','url','statusCode','device','other','agent_name','setupLoggers'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x35dc,0x1ae));var _0xc35d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x35dc[_0x321bb2];return _0x9c12ed;};var fs=require(_0xc35d('0x0'));var _=require('lodash');var ewinston=require(_0xc35d('0x1'));var path=require(_0xc35d('0x2'));var util=require(_0xc35d('0x3'));var fileLogger=require(_0xc35d('0x4'))[_0xc35d('0x5')];var safeTemplate=require(_0xc35d('0x6'))[_0xc35d('0x7')];var maskSensitiveData=require(_0xc35d('0x8'))['maskSensitiveData'];function ClientSideLogger(){function _0x57053f(_0x2edd06){var _0x39f654=path['join'](_0xc35d('0x9'),'log','xcally');var _0x79514a=path[_0xc35d('0xa')](_0xc35d('0xb'),_0x2edd06['role']+'-'+_0x2edd06[_0xc35d('0xc')]);return fs['ensureDir'](path[_0xc35d('0xa')](_0x39f654,_0x79514a))[_0xc35d('0xd')](function(){var _0x5a33a5=fileLogger(_0xc35d('0xb'),path['join'](_0x39f654,_0x79514a));return _0x5a33a5;})[_0xc35d('0xe')](function(_0x24eae8){throw _0x24eae8;});}this[_0xc35d('0xf')]=function(_0x197927,_0x1d443a,_0x4d4979,_0x1d7f53){return _0x57053f(_0x197927['user'])['then'](function(_0x2f6acf){var _0x234230=_0x2f6acf[_0x1d443a];return _0x234230;})[_0xc35d('0xd')](function(_0x5134de){var _0x4c0319=_0x197927[_0xc35d('0x10')]?_0x197927[_0xc35d('0x10')]['id']:_0xc35d('0x11');var _0x5ea063=_0x1d7f53[_0xc35d('0x12')];var _0x2fb582=_0x1d7f53[_0xc35d('0x13')];var _0x4f670c=new Date(Number(_0x2fb582));return _0x5134de(_0x4c0319,_0x4f670c,_0x4d4979,_0x5ea063);})[_0xc35d('0xe')](function(_0x3e0d6b){fileLogger(_0xc35d('0xb'))['error'](_0x3e0d6b);});};}function setupLoggers(_0x4ede0e){return new Promise(function(_0x2e30b8){var _0x2ee4ef=new ClientSideLogger();var _0x757128=fileLogger(_0xc35d('0x14'));var _0x768a84=fileLogger('auth');_0x4ede0e[_0xc35d('0x15')](_0xc35d('0x16'),_0x2ee4ef);_0x4ede0e[_0xc35d('0x17')](ewinston['logger']({'winstonInstance':_0x757128,'meta':![],'statusLevels':!![],'msg':function(_0x8631a8,_0x23d604){var _0x2f5c80=_0xc35d('0x18');if(!_['isEmpty'](_0x8631a8['body'])){_0x2f5c80+=_0xc35d('0x19');var _0x48ab70=_0x8631a8['body'];maskSensitiveData(_0x48ab70);}return safeTemplate(util[_0xc35d('0x1a')](_0x2f5c80,_0x8631a8[_0xc35d('0x1b')],_0x8631a8[_0xc35d('0x1c')][_0xc35d('0x1d')]?_0x8631a8[_0xc35d('0x1c')][_0xc35d('0x1d')]:_0x8631a8[_0xc35d('0x1e')][_0xc35d('0x1f')]||_0x8631a8['ip'],_0x8631a8['url'],_0x23d604['statusCode'],_0x23d604['responseTime'],_0x8631a8[_0xc35d('0x10')]?_0x8631a8[_0xc35d('0x10')]['id']:null,_0x8631a8[_0xc35d('0x10')]?_0x8631a8[_0xc35d('0x10')]['name']:null,_0x8631a8[_0xc35d('0x10')]?_0x8631a8[_0xc35d('0x10')]['role']:null,_0x48ab70?util['inspect'](_0x48ab70,![],null):''));}}));_0x4ede0e[_0xc35d('0x17')](ewinston[_0xc35d('0x20')]({'winstonInstance':_0x768a84,'meta':![],'statusLevels':!![],'msg':function(_0x901126,_0x66bec4){var _0x531ca5=_0xc35d('0x21');if(_0x901126[_0xc35d('0x22')]&&_0x901126[_0xc35d('0x22')]['device']&&_0x901126[_0xc35d('0x22')][_0xc35d('0x23')]){_0x531ca5=_0xc35d('0x24');}return util[_0xc35d('0x1a')](_0x531ca5,_0x901126[_0xc35d('0x1b')],_0x901126[_0xc35d('0x1c')][_0xc35d('0x1d')]?_0x901126[_0xc35d('0x1c')][_0xc35d('0x1d')]:_0x901126[_0xc35d('0x1e')][_0xc35d('0x1f')]||_0x901126['ip'],_0x901126[_0xc35d('0x25')],_0x66bec4[_0xc35d('0x26')],_0x66bec4['responseTime'],_0x901126[_0xc35d('0x10')]?_0x901126[_0xc35d('0x10')]['id']:null,_0x901126[_0xc35d('0x10')]?_0x901126[_0xc35d('0x10')]['name']:null,_0x901126[_0xc35d('0x10')]?_0x901126[_0xc35d('0x10')]['role']:null,_0x901126['body']&&_0x901126[_0xc35d('0x22')][_0xc35d('0x27')]?_0x901126[_0xc35d('0x22')][_0xc35d('0x27')]:_0xc35d('0x28'),_0x901126[_0xc35d('0x22')]&&_0x901126[_0xc35d('0x22')][_0xc35d('0x23')]?_0x901126[_0xc35d('0x22')][_0xc35d('0x23')]:'',_0x901126[_0xc35d('0x22')]&&_0x901126[_0xc35d('0x22')][_0xc35d('0x29')]?_0x901126[_0xc35d('0x22')][_0xc35d('0x29')]:'');},'ignoreRoute':function(_0xc94e7d){var _0x466bd5=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x466bd5['test'](_0xc94e7d['url']);}}));return _0x2e30b8();});}exports[_0xc35d('0x2a')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index b8a80df..4205652 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8bd7=['includes','monthCompare','guess','test','length','padStart','lodash','moment-timezone','map','source','join','Interval\x20string\x20not\x20valid','isValid','split','locale','weekdaysShort','toLowerCase','indexOf','slice','circularDoWInterval','monthsShort','concat','exports','circularMonthInterval','clone','hours','minutes','startOf','endOf','isBetween','timeCompare','format','ddd','daysInMonth','max','min','domCompare'];(function(_0x5e42a7,_0x3eba35){var _0x36d21b=function(_0x567f0a){while(--_0x567f0a){_0x5e42a7['push'](_0x5e42a7['shift']());}};_0x36d21b(++_0x3eba35);}(_0x8bd7,0xbf));var _0x78bd=function(_0x1048c1,_0x273701){_0x1048c1=_0x1048c1-0x0;var _0x560e0f=_0x8bd7[_0x1048c1];return _0x560e0f;};var _=require(_0x78bd('0x0'));var moment=require(_0x78bd('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][_0x78bd('0x2')](function(_0x4173d1){return _0x4173d1[_0x78bd('0x3')];})[_0x78bd('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x78bd('0x5');var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0xd9fb73){if(!_0xd9fb73[_0x78bd('0x6')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x19220c){var _0xf36ba2=_0x19220c[_0x78bd('0x7')](':')[_0x78bd('0x2')](function(_0x325f4a){return parseInt(_0x325f4a,0xa);});var _0x12f00e=_0xf36ba2[0x0];var _0x4d13a9=_0xf36ba2[0x1];if(_0x12f00e<0x0||_0x12f00e>0x17||_0x4d13a9<0x0||_0x4d13a9>0x3b){throw new Error(EINVALID_DATE);}return[_0x12f00e,_0x4d13a9];}function circularDoWInterval(_0x2e89a7,_0x5c28b1){if(_0x2e89a7===_0x5c28b1){return[_0x2e89a7];}else{var _0x54d360=moment[_0x78bd('0x8')]();moment[_0x78bd('0x8')]('en');var _0x214e29=moment[_0x78bd('0x9')]()[_0x78bd('0x2')](function(_0x1a955d){return _0x1a955d[_0x78bd('0xa')]();});moment[_0x78bd('0x8')](_0x54d360);var _0x285c28=_0x214e29[_0x78bd('0xb')](_0x2e89a7);var _0x24a285=_0x214e29[_0x78bd('0xb')](_0x5c28b1);if(_0x24a285>_0x285c28){return _0x214e29['slice'](_0x285c28,_0x24a285+0x1);}else{var _0x5d157b=_0x214e29[_0x78bd('0xc')](0x0,_0x24a285+0x1);var _0x2dcdba=_0x214e29[_0x78bd('0xc')](_0x285c28);return _0x2dcdba['concat'](_0x5d157b);}}}module['exports'][_0x78bd('0xd')]=circularDoWInterval;function circularMonthInterval(_0x1928fb,_0x8f1ce6){if(_0x1928fb===_0x8f1ce6){return[_0x1928fb];}else{var _0x3f6cc2=moment['locale']();moment[_0x78bd('0x8')]('en');var _0x2cfd60=moment[_0x78bd('0xe')]()[_0x78bd('0x2')](function(_0x1de8ca){return _0x1de8ca[_0x78bd('0xa')]();});moment[_0x78bd('0x8')](_0x3f6cc2);var _0x4c585c=_0x2cfd60[_0x78bd('0xb')](_0x1928fb);var _0x3f2168=_0x2cfd60[_0x78bd('0xb')](_0x8f1ce6);if(_0x3f2168>_0x4c585c){return _0x2cfd60['slice'](_0x4c585c,_0x3f2168+0x1);}else{var _0x589794=_0x2cfd60[_0x78bd('0xc')](0x0,_0x3f2168+0x1);var _0x5c60b3=_0x2cfd60[_0x78bd('0xc')](_0x4c585c);return _0x5c60b3[_0x78bd('0xf')](_0x589794);}}}module[_0x78bd('0x10')][_0x78bd('0x11')]=circularMonthInterval;function parseDom(_0x1e2bd8){var _0x1bf708=parseInt(_0x1e2bd8,0xa);if(_0x1bf708<0x1||_0x1bf708>0x1f){throw new Error(EINVALID_DATE);}return _0x1bf708;}function timeCompare(_0x1f9e42,_0x42a704,_0x85e0ed){var _0x21b83f=_0x1f9e42[_0x78bd('0x12')]();var _0x1d2e3e=extractTime(_0x42a704);var _0x4a8033=_0x1d2e3e[0x0];var _0x8a0ca1=_0x1d2e3e[0x1];var _0x502c50=_0x1f9e42[_0x78bd('0x12')]()[_0x78bd('0x13')](_0x4a8033)[_0x78bd('0x14')](_0x8a0ca1);throwIfDateNotValid(_0x502c50);var _0x319e8c=extractTime(_0x85e0ed);var _0x2aefd1=_0x319e8c[0x0];var _0x4565ea=_0x319e8c[0x1];var _0x8bfff0=_0x1f9e42[_0x78bd('0x12')]()[_0x78bd('0x13')](_0x2aefd1)[_0x78bd('0x14')](_0x4565ea);throwIfDateNotValid(_0x8bfff0);if(_0x8bfff0['isBefore'](_0x502c50)){var _0x554b1e=_0x21b83f[_0x78bd('0x12')]()[_0x78bd('0x15')]('day');var _0x2b7332=_0x21b83f['clone']()[_0x78bd('0x16')]('day');return _0x21b83f[_0x78bd('0x17')](_0x502c50,_0x2b7332,undefined,'[]')||_0x21b83f[_0x78bd('0x17')](_0x554b1e,_0x8bfff0,undefined,'[]');}else{return _0x21b83f[_0x78bd('0x17')](_0x502c50,_0x8bfff0,undefined,'[]');}}module['exports'][_0x78bd('0x18')]=timeCompare;function dowCompare(_0x27757a,_0x348fb2,_0xf08b19){var _0xbd2404=_0x27757a[_0x78bd('0x8')]('en')[_0x78bd('0x19')](_0x78bd('0x1a'))[_0x78bd('0xa')]();return circularDoWInterval(_0x348fb2,_0xf08b19)['includes'](_0xbd2404);}module[_0x78bd('0x10')]['dowCompare']=dowCompare;function domCompare(_0x218ce8,_0x163098,_0xcfd7b0){var _0x205324=_0x218ce8['date']();if(_0x163098===_0xcfd7b0){return _0x205324===_0x163098;}else{var _0x3a3086=_0x218ce8[_0x78bd('0x1b')]();var _0x15a3bf=_0x163098<_0xcfd7b0;let _0x1e4d28=![];var _0x3941a8=0x0;var _0x470da5=0x0;if(_0x15a3bf){_0x3941a8=Math[_0x78bd('0x1c')](0x1,_0x163098);_0x470da5=Math[_0x78bd('0x1d')](_0xcfd7b0,_0x3a3086);_0x1e4d28=_0x205324>=_0x3941a8&&_0x205324<=_0x470da5;}else{_0x3941a8=Math[_0x78bd('0x1d')](_0x163098,_0x3a3086);_0x470da5=Math[_0x78bd('0x1c')](0x1,_0xcfd7b0);_0x1e4d28=_0x205324>=_0x3941a8||_0x205324<=_0x470da5;}return _0x1e4d28;}}module[_0x78bd('0x10')][_0x78bd('0x1e')]=domCompare;function monthCompare(_0x5cdefa,_0x14eb02,_0x54964a){var _0x2f2345=_0x5cdefa[_0x78bd('0x8')]('en')[_0x78bd('0x19')]('MMM')[_0x78bd('0xa')]();return circularMonthInterval(_0x14eb02,_0x54964a)[_0x78bd('0x1f')](_0x2f2345);}module[_0x78bd('0x10')][_0x78bd('0x20')]=monthCompare;function iftime(_0x5a5628,_0x26441f=moment['tz'][_0x78bd('0x21')](),_0x16ae97=moment()){if(!validateRx[_0x78bd('0x22')](_0x5a5628)){throw new Error(EINVALID_STRING);}else{var _0x480f14=(moment['isMoment'](_0x16ae97)?_0x16ae97[_0x78bd('0x12')]():moment(_0x16ae97))['tz'](_0x26441f)['locale']('en');throwIfDateNotValid(_0x480f14);var _0x284b94=_0x5a5628[_0x78bd('0x7')](',');var _0x5799e5=_0x284b94[0x0];var _0x79f502=_0x284b94[0x1];var _0xdf78c3=_0x284b94[0x2];var _0x3563c5=_0x284b94[0x3];let _0x27a4ab=!![];if(_0x5799e5!=='*'){var _0x11ab53=_0x5799e5[_0x78bd('0x7')]('-');var _0x1afbed=_['padStart'](_0x11ab53[0x0],0x5,'0');var _0x1e4a01=_0x11ab53[_0x78bd('0x23')]===0x2?_[_0x78bd('0x24')](_0x11ab53[0x1],0x5,'0'):_0x1afbed;_0x27a4ab=timeCompare(_0x480f14,_0x1afbed,_0x1e4a01);}let _0x12af71=!![];if(_0x79f502!=='*'){var _0x2e4a8e=_0x79f502['split']('-');var _0x1991a8=_0x2e4a8e[0x0];var _0x2a1abd=_0x2e4a8e['length']===0x2?_0x2e4a8e[0x1]:_0x1991a8;_0x12af71=dowCompare(_0x480f14,_0x1991a8,_0x2a1abd);}let _0x126568=!![];if(_0xdf78c3!=='*'){var _0x4f3ceb=_0xdf78c3[_0x78bd('0x7')]('-');var _0x4438b9=parseDom(_0x4f3ceb[0x0]);var _0x3ab0e6=_0x4f3ceb[_0x78bd('0x23')]===0x2?parseDom(_0x4f3ceb[0x1]):_0x4438b9;_0x126568=domCompare(_0x480f14,_0x4438b9,_0x3ab0e6);}let _0x4f3533=!![];if(_0x3563c5!=='*'){var _0x5098f3=_0x3563c5[_0x78bd('0x7')]('-');var _0x41306e=_0x5098f3[0x0];var _0x3a889c=_0x5098f3[_0x78bd('0x23')]===0x2?_0x5098f3[0x1]:_0x5098f3[0x0];_0x4f3533=monthCompare(_0x480f14,_0x41306e,_0x3a889c);}return _0x27a4ab&&_0x12af71&&_0x126568&&_0x4f3533;}}module[_0x78bd('0x10')]['iftime']=iftime; \ No newline at end of file +var _0xf09a=['length','iftime','lodash','moment-timezone','map','source','join','Interval\x20string\x20not\x20valid','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','monthsShort','clone','hours','minutes','isBefore','startOf','endOf','day','isBetween','timeCompare','format','ddd','includes','dowCompare','date','daysInMonth','min','domCompare','guess','test','isMoment','split'];(function(_0x4dede2,_0xbeb5c4){var _0x25f6c4=function(_0x4a34e6){while(--_0x4a34e6){_0x4dede2['push'](_0x4dede2['shift']());}};_0x25f6c4(++_0xbeb5c4);}(_0xf09a,0x199));var _0xaf09=function(_0x470b0a,_0x2889d6){_0x470b0a=_0x470b0a-0x0;var _0x4463f6=_0xf09a[_0x470b0a];return _0x4463f6;};var _=require(_0xaf09('0x0'));var moment=require(_0xaf09('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][_0xaf09('0x2')](function(_0x5d376a){return _0x5d376a[_0xaf09('0x3')];})[_0xaf09('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xaf09('0x5');var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x505eeb){if(!_0x505eeb['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x132de2){var _0x2d018c=_0x132de2['split'](':')[_0xaf09('0x2')](function(_0x4e8a71){return parseInt(_0x4e8a71,0xa);});var _0x20441d=_0x2d018c[0x0];var _0x2c52ad=_0x2d018c[0x1];if(_0x20441d<0x0||_0x20441d>0x17||_0x2c52ad<0x0||_0x2c52ad>0x3b){throw new Error(EINVALID_DATE);}return[_0x20441d,_0x2c52ad];}function circularDoWInterval(_0x3c497f,_0x301de5){if(_0x3c497f===_0x301de5){return[_0x3c497f];}else{var _0x1a6a3b=moment[_0xaf09('0x6')]();moment[_0xaf09('0x6')]('en');var _0x3cc9d4=moment[_0xaf09('0x7')]()['map'](function(_0x34a778){return _0x34a778[_0xaf09('0x8')]();});moment[_0xaf09('0x6')](_0x1a6a3b);var _0x56bb04=_0x3cc9d4[_0xaf09('0x9')](_0x3c497f);var _0x192d89=_0x3cc9d4[_0xaf09('0x9')](_0x301de5);if(_0x192d89>_0x56bb04){return _0x3cc9d4[_0xaf09('0xa')](_0x56bb04,_0x192d89+0x1);}else{var _0x26021d=_0x3cc9d4['slice'](0x0,_0x192d89+0x1);var _0x246d3a=_0x3cc9d4[_0xaf09('0xa')](_0x56bb04);return _0x246d3a[_0xaf09('0xb')](_0x26021d);}}}module[_0xaf09('0xc')]['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x5bdf83,_0x1437c1){if(_0x5bdf83===_0x1437c1){return[_0x5bdf83];}else{var _0x2bc8bc=moment[_0xaf09('0x6')]();moment[_0xaf09('0x6')]('en');var _0xa32b07=moment[_0xaf09('0xd')]()[_0xaf09('0x2')](function(_0x448ccb){return _0x448ccb[_0xaf09('0x8')]();});moment[_0xaf09('0x6')](_0x2bc8bc);var _0x4daff8=_0xa32b07['indexOf'](_0x5bdf83);var _0x2bba4f=_0xa32b07[_0xaf09('0x9')](_0x1437c1);if(_0x2bba4f>_0x4daff8){return _0xa32b07[_0xaf09('0xa')](_0x4daff8,_0x2bba4f+0x1);}else{var _0x493c63=_0xa32b07['slice'](0x0,_0x2bba4f+0x1);var _0x42ea01=_0xa32b07[_0xaf09('0xa')](_0x4daff8);return _0x42ea01[_0xaf09('0xb')](_0x493c63);}}}module[_0xaf09('0xc')]['circularMonthInterval']=circularMonthInterval;function parseDom(_0x324f54){var _0x3f1f50=parseInt(_0x324f54,0xa);if(_0x3f1f50<0x1||_0x3f1f50>0x1f){throw new Error(EINVALID_DATE);}return _0x3f1f50;}function timeCompare(_0x60c0a4,_0x408b3c,_0x47925b){var _0x996b6c=_0x60c0a4[_0xaf09('0xe')]();var _0x5341c2=extractTime(_0x408b3c);var _0x418ee5=_0x5341c2[0x0];var _0x21b36a=_0x5341c2[0x1];var _0x281e48=_0x60c0a4['clone']()['hours'](_0x418ee5)['minutes'](_0x21b36a);throwIfDateNotValid(_0x281e48);var _0x29fb77=extractTime(_0x47925b);var _0x3fe9cf=_0x29fb77[0x0];var _0x5574c4=_0x29fb77[0x1];var _0x4f76d1=_0x60c0a4['clone']()[_0xaf09('0xf')](_0x3fe9cf)[_0xaf09('0x10')](_0x5574c4);throwIfDateNotValid(_0x4f76d1);if(_0x4f76d1[_0xaf09('0x11')](_0x281e48)){var _0xa854e4=_0x996b6c['clone']()[_0xaf09('0x12')]('day');var _0xa96d7c=_0x996b6c['clone']()[_0xaf09('0x13')](_0xaf09('0x14'));return _0x996b6c[_0xaf09('0x15')](_0x281e48,_0xa96d7c,undefined,'[]')||_0x996b6c['isBetween'](_0xa854e4,_0x4f76d1,undefined,'[]');}else{return _0x996b6c[_0xaf09('0x15')](_0x281e48,_0x4f76d1,undefined,'[]');}}module[_0xaf09('0xc')][_0xaf09('0x16')]=timeCompare;function dowCompare(_0x23df93,_0x21280b,_0x39e4e0){var _0x105eb3=_0x23df93[_0xaf09('0x6')]('en')[_0xaf09('0x17')](_0xaf09('0x18'))[_0xaf09('0x8')]();return circularDoWInterval(_0x21280b,_0x39e4e0)[_0xaf09('0x19')](_0x105eb3);}module[_0xaf09('0xc')][_0xaf09('0x1a')]=dowCompare;function domCompare(_0x2e2cea,_0x13c54e,_0x3668b8){var _0x3c43ee=_0x2e2cea[_0xaf09('0x1b')]();if(_0x13c54e===_0x3668b8){return _0x3c43ee===_0x13c54e;}else{var _0x409201=_0x2e2cea[_0xaf09('0x1c')]();var _0x1ddd24=_0x13c54e<_0x3668b8;let _0x235337=![];var _0x5c92c9=0x0;var _0x4dea8f=0x0;if(_0x1ddd24){_0x5c92c9=Math['max'](0x1,_0x13c54e);_0x4dea8f=Math[_0xaf09('0x1d')](_0x3668b8,_0x409201);_0x235337=_0x3c43ee>=_0x5c92c9&&_0x3c43ee<=_0x4dea8f;}else{_0x5c92c9=Math['min'](_0x13c54e,_0x409201);_0x4dea8f=Math['max'](0x1,_0x3668b8);_0x235337=_0x3c43ee>=_0x5c92c9||_0x3c43ee<=_0x4dea8f;}return _0x235337;}}module['exports'][_0xaf09('0x1e')]=domCompare;function monthCompare(_0x150c90,_0xc91031,_0x2406dc){var _0x4b5ddf=_0x150c90[_0xaf09('0x6')]('en')[_0xaf09('0x17')]('MMM')[_0xaf09('0x8')]();return circularMonthInterval(_0xc91031,_0x2406dc)[_0xaf09('0x19')](_0x4b5ddf);}module[_0xaf09('0xc')]['monthCompare']=monthCompare;function iftime(_0x56a82a,_0x4f9c11=moment['tz'][_0xaf09('0x1f')](),_0x2d354b=moment()){if(!validateRx[_0xaf09('0x20')](_0x56a82a)){throw new Error(EINVALID_STRING);}else{var _0x1bb5ce=(moment[_0xaf09('0x21')](_0x2d354b)?_0x2d354b['clone']():moment(_0x2d354b))['tz'](_0x4f9c11)[_0xaf09('0x6')]('en');throwIfDateNotValid(_0x1bb5ce);var _0x3df81c=_0x56a82a['split'](',');var _0x633ceb=_0x3df81c[0x0];var _0x53a607=_0x3df81c[0x1];var _0x2eec34=_0x3df81c[0x2];var _0x12a653=_0x3df81c[0x3];let _0x4ebdb9=!![];if(_0x633ceb!=='*'){var _0x5e722c=_0x633ceb[_0xaf09('0x22')]('-');var _0x2ebc34=_['padStart'](_0x5e722c[0x0],0x5,'0');var _0x133c3b=_0x5e722c[_0xaf09('0x23')]===0x2?_['padStart'](_0x5e722c[0x1],0x5,'0'):_0x2ebc34;_0x4ebdb9=timeCompare(_0x1bb5ce,_0x2ebc34,_0x133c3b);}let _0x316fc5=!![];if(_0x53a607!=='*'){var _0x487171=_0x53a607[_0xaf09('0x22')]('-');var _0x433993=_0x487171[0x0];var _0x389f78=_0x487171['length']===0x2?_0x487171[0x1]:_0x433993;_0x316fc5=dowCompare(_0x1bb5ce,_0x433993,_0x389f78);}let _0x3b51ff=!![];if(_0x2eec34!=='*'){var _0x25080b=_0x2eec34[_0xaf09('0x22')]('-');var _0x37ef35=parseDom(_0x25080b[0x0]);var _0x4bda63=_0x25080b[_0xaf09('0x23')]===0x2?parseDom(_0x25080b[0x1]):_0x37ef35;_0x3b51ff=domCompare(_0x1bb5ce,_0x37ef35,_0x4bda63);}let _0x2b2d4c=!![];if(_0x12a653!=='*'){var _0xe1eb81=_0x12a653[_0xaf09('0x22')]('-');var _0x108bf3=_0xe1eb81[0x0];var _0x6e4b59=_0xe1eb81[_0xaf09('0x23')]===0x2?_0xe1eb81[0x1]:_0xe1eb81[0x0];_0x2b2d4c=monthCompare(_0x1bb5ce,_0x108bf3,_0x6e4b59);}return _0x4ebdb9&&_0x316fc5&&_0x3b51ff&&_0x2b2d4c;}}module[_0xaf09('0xc')][_0xaf09('0x24')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index a8c9609..dadd888 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2cad=['message','{{{','}}}','replace','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','keys','meta','stringify','transports','Console','warn','Logger','File','error','%s-%s','fileLogger','util','winston','../config/environment','debugLevel','info','redBG\x20white','white','bold\x20white','bold\x20green','gray','addColors','/var/log/xcally','join','format'];(function(_0x64bbb9,_0x909c76){var _0x5c3707=function(_0x26ded5){while(--_0x26ded5){_0x64bbb9['push'](_0x64bbb9['shift']());}};_0x5c3707(++_0x909c76);}(_0x2cad,0x15d));var _0xd2ca=function(_0x3c7869,_0x207240){_0x3c7869=_0x3c7869-0x0;var _0x23bc0b=_0x2cad[_0x3c7869];return _0x23bc0b;};'use strict';var path=require('path');var util=require(_0xd2ca('0x0'));var moment=require('moment');var winston=require(_0xd2ca('0x1'));var config=require(_0xd2ca('0x2'));var debugLevel=config[_0xd2ca('0x3')]?config[_0xd2ca('0x3')]['toLowerCase']():_0xd2ca('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':_0xd2ca('0x5'),'error':'red','warn':'bold\x20yellow','info':_0xd2ca('0x6'),'print':_0xd2ca('0x7'),'success':_0xd2ca('0x8'),'http':_0xd2ca('0x9'),'verbose':'bold\x20magenta','debug':'bold\x20blue','silly':'bold\x20cyan'};winston[_0xd2ca('0xa')](XC_LOG_COLORS);function getLogFileName(_0x37c15b,_0x20aa92,_0xadc165){var _0x86c166=_0x37c15b||_0xd2ca('0xb');return path[_0xd2ca('0xc')](_0x86c166,util[_0xd2ca('0xd')]('%s-%s.log',_0x20aa92,_0xadc165));}function formatter(_0x925280,_0x50571){_0x50571['message']=_0x50571[_0xd2ca('0xe')]['replace'](/@@{/g,_0xd2ca('0xf'))['replace'](/}@@/g,_0xd2ca('0x10'))[_0xd2ca('0x11')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0xd2ca('0xd')](_0xd2ca('0x12'),moment()[_0xd2ca('0xd')](_0xd2ca('0x13')),_0x50571[_0xd2ca('0x14')][_0xd2ca('0x15')](),_0x925280,_0x50571[_0xd2ca('0xe')]);}function fileFormat(_0x18290c,_0x25b083){_0x25b083[_0xd2ca('0xe')]=_0x25b083[_0xd2ca('0xe')][_0xd2ca('0x11')](/@@{/g,_0xd2ca('0xf'))[_0xd2ca('0x11')](/}@@/g,_0xd2ca('0x10'))[_0xd2ca('0x11')](/@{/g,'{{')[_0xd2ca('0x11')](/}@/g,'}}');var _0x586601=_0x25b083['meta']&&Object[_0xd2ca('0x16')](_0x25b083[_0xd2ca('0x17')])['length']?'\x0a\x09'+JSON[_0xd2ca('0x18')](_0x25b083[_0xd2ca('0x17')]):'';return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0xd2ca('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),_0x25b083[_0xd2ca('0x14')][_0xd2ca('0x15')](),_0x18290c,_0x25b083[_0xd2ca('0xe')],_0x586601);}function consoleLogger(){var _0xf7019c=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xd2ca('0x19'))][(_0xd2ca('0x1a'))]({'level':_0xd2ca('0x1b'),'json':![],'formatter':function(_0xa2c4d0){return formatter('',_0xa2c4d0);}})]});return _0xf7019c;}function fileLogger(_0x40d849,_0x50cd37){var _0x57ec08=new winston[(_0xd2ca('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xd2ca('0x19'))][(_0xd2ca('0x1d'))]({'name':util[_0xd2ca('0xd')]('%s-%s',_0x40d849,_0xd2ca('0x1e')),'filename':getLogFileName(_0x50cd37,_0x40d849,_0xd2ca('0x1e')),'level':_0xd2ca('0x1e'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1ce127){return fileFormat(_0x40d849,_0x1ce127);}}),new winston[(_0xd2ca('0x19'))][(_0xd2ca('0x1d'))]({'name':util[_0xd2ca('0xd')](_0xd2ca('0x1f'),_0x40d849,debugLevel),'filename':getLogFileName(_0x50cd37,_0x40d849,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x12bca6){return fileFormat(_0x40d849,_0x12bca6);}}),new winston[(_0xd2ca('0x19'))]['Console']({'level':_0xd2ca('0x1b'),'json':![],'formatter':function(_0x1c41e6){return fileFormat(_0x40d849,_0x1c41e6);}})]});return _0x57ec08;}exports['consoleLogger']=consoleLogger;exports[_0xd2ca('0x20')]=fileLogger; \ No newline at end of file +var _0x68f0=['length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','Console','File','%s-%s','error','warn','consoleLogger','fileLogger','path','util','moment','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','bold\x20white','gray','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','%s-%s.log','message','replace','{{{','}}}','format','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta'];(function(_0x5256d8,_0x1f45be){var _0x163b69=function(_0x498efd){while(--_0x498efd){_0x5256d8['push'](_0x5256d8['shift']());}};_0x163b69(++_0x1f45be);}(_0x68f0,0x81));var _0x068f=function(_0x2301c1,_0x3c5a47){_0x2301c1=_0x2301c1-0x0;var _0x28f1eb=_0x68f0[_0x2301c1];return _0x28f1eb;};'use strict';var path=require(_0x068f('0x0'));var util=require(_0x068f('0x1'));var moment=require(_0x068f('0x2'));var winston=require('winston');var config=require(_0x068f('0x3'));var debugLevel=config['debugLevel']?config[_0x068f('0x4')][_0x068f('0x5')]():_0x068f('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':_0x068f('0x7'),'error':_0x068f('0x8'),'warn':_0x068f('0x9'),'info':'white','print':_0x068f('0xa'),'success':'bold\x20green','http':_0x068f('0xb'),'verbose':'bold\x20magenta','debug':_0x068f('0xc'),'silly':_0x068f('0xd')};winston[_0x068f('0xe')](XC_LOG_COLORS);function getLogFileName(_0x4b4211,_0x4e9137,_0x3dd84c){var _0x31cbad=_0x4b4211||_0x068f('0xf');return path[_0x068f('0x10')](_0x31cbad,util['format'](_0x068f('0x11'),_0x4e9137,_0x3dd84c));}function formatter(_0xfdaaa,_0x5289f6){_0x5289f6[_0x068f('0x12')]=_0x5289f6['message'][_0x068f('0x13')](/@@{/g,_0x068f('0x14'))[_0x068f('0x13')](/}@@/g,_0x068f('0x15'))[_0x068f('0x13')](/@{/g,'{{')[_0x068f('0x13')](/}@/g,'}}');return util[_0x068f('0x16')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()['format'](_0x068f('0x17')),_0x5289f6[_0x068f('0x18')][_0x068f('0x19')](),_0xfdaaa,_0x5289f6[_0x068f('0x12')]);}function fileFormat(_0xe73fb8,_0x4f4383){_0x4f4383['message']=_0x4f4383[_0x068f('0x12')][_0x068f('0x13')](/@@{/g,_0x068f('0x14'))['replace'](/}@@/g,'}}}')[_0x068f('0x13')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x5ad40f=_0x4f4383[_0x068f('0x1a')]&&Object['keys'](_0x4f4383['meta'])[_0x068f('0x1b')]?'\x0a\x09'+JSON[_0x068f('0x1c')](_0x4f4383[_0x068f('0x1a')]):'';return util[_0x068f('0x16')](_0x068f('0x1d'),moment()[_0x068f('0x16')](_0x068f('0x17')),_0x4f4383[_0x068f('0x18')][_0x068f('0x19')](),_0xe73fb8,_0x4f4383['message'],_0x5ad40f);}function consoleLogger(){var _0x31860d=new winston[(_0x068f('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x068f('0x1f'))][(_0x068f('0x20'))]({'level':'warn','json':![],'formatter':function(_0x35a497){return formatter('',_0x35a497);}})]});return _0x31860d;}function fileLogger(_0x424572,_0x256039){var _0x4f4ad0=new winston[(_0x068f('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x068f('0x1f'))][(_0x068f('0x21'))]({'name':util[_0x068f('0x16')](_0x068f('0x22'),_0x424572,_0x068f('0x23')),'filename':getLogFileName(_0x256039,_0x424572,_0x068f('0x23')),'level':_0x068f('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x242c9a){return fileFormat(_0x424572,_0x242c9a);}}),new winston[(_0x068f('0x1f'))][(_0x068f('0x21'))]({'name':util[_0x068f('0x16')](_0x068f('0x22'),_0x424572,debugLevel),'filename':getLogFileName(_0x256039,_0x424572,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x973f57){return fileFormat(_0x424572,_0x973f57);}}),new winston[(_0x068f('0x1f'))]['Console']({'level':_0x068f('0x24'),'json':![],'formatter':function(_0x218024){return fileFormat(_0x424572,_0x218024);}})]});return _0x4f4ad0;}exports[_0x068f('0x25')]=consoleLogger;exports[_0x068f('0x26')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index e92c702..7d48869 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['exten','vidaooApiKey','privateKey','secretaccesskey','user','pass','accountSid','dsn','secret','registry','isPlainObject','isArray','length','isString','replace','@@{','}@@','username','newPassword','apiKey','firstName','street','phone','mobile','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','calleridnum'];(function(_0x80897f,_0x35c299){var _0x29a750=function(_0x138f81){while(--_0x138f81){_0x80897f['push'](_0x80897f['shift']());}};_0x29a750(++_0x35c299);}(_0xadb5,0xad));var _0x5adb=function(_0x23c311,_0x4f4e50){_0x23c311=_0x23c311-0x0;var _0x4d15a6=_0xadb5[_0x23c311];return _0x4d15a6;};var _=require('lodash');var sensitiveFields=[_0x5adb('0x0'),'password',_0x5adb('0x1'),_0x5adb('0x2'),_0x5adb('0x3'),'lastName',_0x5adb('0x4'),_0x5adb('0x5'),_0x5adb('0x6'),'fax',_0x5adb('0x7'),_0x5adb('0x8'),_0x5adb('0x9'),_0x5adb('0xa'),_0x5adb('0xb'),_0x5adb('0xc'),_0x5adb('0xd'),_0x5adb('0xe'),_0x5adb('0xf'),_0x5adb('0x10'),_0x5adb('0x11'),_0x5adb('0x12'),_0x5adb('0x13'),_0x5adb('0x14'),'membername','calleridname',_0x5adb('0x15'),_0x5adb('0x16'),_0x5adb('0x17'),'clientEmail',_0x5adb('0x18'),'accesskeyid',_0x5adb('0x19'),'key',_0x5adb('0x1a'),_0x5adb('0x1b'),_0x5adb('0x1c'),'localstationid',_0x5adb('0x1d'),_0x5adb('0x1e'),_0x5adb('0x1f'),'oldPassword'];function maskSensitiveData(_0x2312de){const _0x518823=/(?!^)[\s\S](?!$)/g;if(_[_0x5adb('0x20')](_0x2312de)){for(const _0x42a482 in _0x2312de){if(_[_0x5adb('0x21')](_0x2312de[_0x42a482])){for(let _0x304784=0x0;_0x304784<_0x2312de[_0x42a482][_0x5adb('0x22')];_0x304784++){maskSensitiveData(_0x2312de[_0x42a482][_0x304784]);}}else if(_[_0x5adb('0x20')](_0x2312de[_0x42a482])){maskSensitiveData(_0x2312de[_0x42a482]);}else if(_[_0x5adb('0x23')](_0x2312de[_0x42a482])){_0x2312de[_0x42a482]=_0x2312de[_0x42a482][_0x5adb('0x24')](/{{{/g,_0x5adb('0x25'))['replace'](/}}}/g,_0x5adb('0x26'))['replace'](/{{/g,'@{')[_0x5adb('0x24')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x42a482)){_0x2312de[_0x42a482]=_0x2312de[_0x42a482][_0x5adb('0x24')](_0x518823,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x1a85=['isString','@@{','replace','}@@','includes','exports','maskSensitiveData','password','newPassword','apiKey','street','phone','mobile','email','clientSecret','code','accessKey','token','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','dsn','secret','registry','isPlainObject','isArray','length'];(function(_0x5471ec,_0x1ce81a){var _0x121d4c=function(_0xefb655){while(--_0xefb655){_0x5471ec['push'](_0x5471ec['shift']());}};_0x121d4c(++_0x1ce81a);}(_0x1a85,0x178));var _0x51a8=function(_0x168765,_0x534f44){_0x168765=_0x168765-0x0;var _0x3ee3a0=_0x1a85[_0x168765];return _0x3ee3a0;};var _=require('lodash');var sensitiveFields=['username',_0x51a8('0x0'),_0x51a8('0x1'),_0x51a8('0x2'),'firstName','lastName',_0x51a8('0x3'),_0x51a8('0x4'),_0x51a8('0x5'),'fax',_0x51a8('0x6'),'clientId',_0x51a8('0x7'),'securityToken',_0x51a8('0x8'),_0x51a8('0x9'),'tenantId',_0x51a8('0xa'),'channelSecret','accessToken',_0x51a8('0xb'),_0x51a8('0xc'),_0x51a8('0xd'),_0x51a8('0xe'),_0x51a8('0xf'),_0x51a8('0x10'),_0x51a8('0x11'),_0x51a8('0x12'),_0x51a8('0x13'),_0x51a8('0x14'),_0x51a8('0x15'),_0x51a8('0x16'),_0x51a8('0x17'),_0x51a8('0x18'),_0x51a8('0x19'),_0x51a8('0x1a'),_0x51a8('0x1b'),'localstationid',_0x51a8('0x1c'),_0x51a8('0x1d'),_0x51a8('0x1e'),'oldPassword'];function maskSensitiveData(_0xf4eb6e){const _0x547d40=/(?!^)[\s\S](?!$)/g;if(_[_0x51a8('0x1f')](_0xf4eb6e)){for(const _0x2b8d37 in _0xf4eb6e){if(_[_0x51a8('0x20')](_0xf4eb6e[_0x2b8d37])){for(let _0x2b0521=0x0;_0x2b0521<_0xf4eb6e[_0x2b8d37][_0x51a8('0x21')];_0x2b0521++){maskSensitiveData(_0xf4eb6e[_0x2b8d37][_0x2b0521]);}}else if(_[_0x51a8('0x1f')](_0xf4eb6e[_0x2b8d37])){maskSensitiveData(_0xf4eb6e[_0x2b8d37]);}else if(_[_0x51a8('0x22')](_0xf4eb6e[_0x2b8d37])){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](/{{{/g,_0x51a8('0x23'))[_0x51a8('0x24')](/}}}/g,_0x51a8('0x25'))[_0x51a8('0x24')](/{{/g,'@{')[_0x51a8('0x24')](/}}/g,'}@');if(_[_0x51a8('0x26')](sensitiveFields,_0x2b8d37)){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](_0x547d40,'*');}}}}}module[_0x51a8('0x27')][_0x51a8('0x28')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 6c1ca34..32257b4 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 _0x4024=['exports','lodash','\x20}\x20}','string','isArray','map','keys','reduce'];(function(_0x336b3d,_0x224a25){var _0x264a18=function(_0x409d57){while(--_0x409d57){_0x336b3d['push'](_0x336b3d['shift']());}};_0x264a18(++_0x224a25);}(_0x4024,0x89));var _0x4402=function(_0x2ae099,_0x1d9376){_0x2ae099=_0x2ae099-0x0;var _0x2ce323=_0x4024[_0x2ae099];return _0x2ce323;};var _=require(_0x4402('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x10e0ef){return _0x10e0ef==='{{'?'{\x20{\x20':_0x4402('0x1');}function safeTemplate(_0x2b36c7){var _0x49a2e2=_0x2b36c7;if(typeof _0x2b36c7===_0x4402('0x2')){_0x49a2e2=_0x2b36c7['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x4402('0x3')](_0x2b36c7)){_0x49a2e2=_0x2b36c7[_0x4402('0x4')](function(_0x5bdb3f){return safeTemplate(_0x5bdb3f);});}else if(_['isPlainObject'](_0x2b36c7)){_0x49a2e2=Object[_0x4402('0x5')](_0x2b36c7)[_0x4402('0x6')](function(_0x168acd,_0x4ed77d){_0x168acd[_0x4ed77d]=safeTemplate(_0x2b36c7[_0x4ed77d]);return _0x168acd;},{});}return _0x49a2e2;}module[_0x4402('0x7')]['safeTemplate']=safeTemplate; \ No newline at end of file +var _0x14a0=['string','replace','isPlainObject','keys','exports','safeTemplate','{\x20{\x20','\x20}\x20}'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x14a0,0x8e));var _0x014a=function(_0x2e75bc,_0x30666d){_0x2e75bc=_0x2e75bc-0x0;var _0x4216ec=_0x14a0[_0x2e75bc];return _0x4216ec;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x105436){return _0x105436==='{{'?_0x014a('0x0'):_0x014a('0x1');}function safeTemplate(_0x28b0f6){var _0x32e88c=_0x28b0f6;if(typeof _0x28b0f6===_0x014a('0x2')){_0x32e88c=_0x28b0f6[_0x014a('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x28b0f6)){_0x32e88c=_0x28b0f6['map'](function(_0x1730a5){return safeTemplate(_0x1730a5);});}else if(_[_0x014a('0x4')](_0x28b0f6)){_0x32e88c=Object[_0x014a('0x5')](_0x28b0f6)['reduce'](function(_0x5a61ac,_0x11b8ce){_0x5a61ac[_0x11b8ce]=safeTemplate(_0x28b0f6[_0x11b8ce]);return _0x5a61ac;},{});}return _0x32e88c;}module[_0x014a('0x6')][_0x014a('0x7')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 03bacd1..230896a 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 _0x6273=['legacy-libs','isArray','apps','name','motion2','env','string','NODE_PATH','pathExists','then','readJSON','updated','info','writeJSON','exports','path','resolve','server/app.json'];(function(_0x54c9dd,_0x233a86){var _0x855156=function(_0x2dd60b){while(--_0x2dd60b){_0x54c9dd['push'](_0x54c9dd['shift']());}};_0x855156(++_0x233a86);}(_0x6273,0x177));var _0x3627=function(_0x40a2d5,_0x17091e){_0x40a2d5=_0x40a2d5-0x0;var _0x2410ee=_0x6273[_0x40a2d5];return _0x2410ee;};var fs=require('fs-extra');var path=require(_0x3627('0x0'));var config=require('../config/environment');var root=config['root'];var APP_JSON_PATH=path[_0x3627('0x1')](root,_0x3627('0x2'));var NODEPATH=path['resolve'](root,_0x3627('0x3'));function setLegacyLibsNodeEnvPath(_0x3a85b7){let _0xe88c75=![];if(Array[_0x3627('0x4')](_0x3a85b7[_0x3627('0x5')])){var _0x1c3263=_0x3a85b7['apps']['findIndex'](function(_0x128ffa){return _0x128ffa[_0x3627('0x6')]===_0x3627('0x7');});if(_0x1c3263>-0x1){var _0x1f8370=_0x3a85b7[_0x3627('0x5')][_0x1c3263];if(typeof _0x1f8370[_0x3627('0x8')]['NODE_PATH']!==_0x3627('0x9')){_0x1f8370[_0x3627('0x8')][_0x3627('0xa')]=NODEPATH;_0xe88c75=!![];}}return{'appConfig':_0x3a85b7,'updated':_0xe88c75};}}function updateAppConfig(_0x281efd){return fs[_0x3627('0xb')](APP_JSON_PATH)[_0x3627('0xc')](function(_0x280461){if(_0x280461){return fs[_0x3627('0xd')](APP_JSON_PATH)[_0x3627('0xc')](function(_0x12cf00){var _0x6d3993=setLegacyLibsNodeEnvPath(_0x12cf00);if(_0x6d3993[_0x3627('0xe')]){_0x281efd[_0x3627('0xf')]('Updating\x20app.json');return fs[_0x3627('0x10')](APP_JSON_PATH,_0x12cf00,{'spaces':0x2});}else{return Promise[_0x3627('0x1')]();}});}else{return Promise[_0x3627('0x1')]();}});}module[_0x3627('0x11')]=updateAppConfig; \ No newline at end of file +var _0x918c=['string','NODE_PATH','pathExists','then','info','writeJSON','exports','fs-extra','path','../config/environment','server/app.json','resolve','legacy-libs','isArray','apps','findIndex','name','motion2','env'];(function(_0x5d728f,_0xfbad5f){var _0x440b1a=function(_0x4260db){while(--_0x4260db){_0x5d728f['push'](_0x5d728f['shift']());}};_0x440b1a(++_0xfbad5f);}(_0x918c,0x111));var _0xc918=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0x918c[_0xc8a931];return _0x28bd27;};var fs=require(_0xc918('0x0'));var path=require(_0xc918('0x1'));var config=require(_0xc918('0x2'));var root=config['root'];var APP_JSON_PATH=path['resolve'](root,_0xc918('0x3'));var NODEPATH=path[_0xc918('0x4')](root,_0xc918('0x5'));function setLegacyLibsNodeEnvPath(_0x3cccdd){let _0x59637d=![];if(Array[_0xc918('0x6')](_0x3cccdd[_0xc918('0x7')])){var _0x18bdc8=_0x3cccdd[_0xc918('0x7')][_0xc918('0x8')](function(_0x26fcdc){return _0x26fcdc[_0xc918('0x9')]===_0xc918('0xa');});if(_0x18bdc8>-0x1){var _0x44e88a=_0x3cccdd[_0xc918('0x7')][_0x18bdc8];if(typeof _0x44e88a[_0xc918('0xb')]['NODE_PATH']!==_0xc918('0xc')){_0x44e88a[_0xc918('0xb')][_0xc918('0xd')]=NODEPATH;_0x59637d=!![];}}return{'appConfig':_0x3cccdd,'updated':_0x59637d};}}function updateAppConfig(_0x5a2a67){return fs[_0xc918('0xe')](APP_JSON_PATH)['then'](function(_0x20390e){if(_0x20390e){return fs['readJSON'](APP_JSON_PATH)[_0xc918('0xf')](function(_0x2a05a6){var _0x3e11dd=setLegacyLibsNodeEnvPath(_0x2a05a6);if(_0x3e11dd['updated']){_0x5a2a67[_0xc918('0x10')]('Updating\x20app.json');return fs[_0xc918('0x11')](APP_JSON_PATH,_0x2a05a6,{'spaces':0x2});}else{return Promise[_0xc918('0x4')]();}});}else{return Promise[_0xc918('0x4')]();}});}module[_0xc918('0x12')]=updateAppConfig; \ No newline at end of file